summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-19 23:49:56 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-19 23:49:56 +0200
commit781969994b5381ba4bed03beef217f9bde6e7c58 (patch)
treeaede27c7532f0fbe82f03dc0c04c9316be510fd5
parent0b17959f31afe3baffbc328e7f92e88e634ad8b8 (diff)
Indent with spaces and strip trailing whitespace.
-rw-r--r--gs/Resource/Init/gs_agl.ps6
-rw-r--r--gs/Resource/Init/gs_btokn.ps254
-rw-r--r--gs/Resource/Init/gs_cet.ps8
-rw-r--r--gs/Resource/Init/gs_cff.ps141
-rw-r--r--gs/Resource/Init/gs_cidcm.ps84
-rw-r--r--gs/Resource/Init/gs_ciddc.ps6
-rw-r--r--gs/Resource/Init/gs_cidfm.ps10
-rw-r--r--gs/Resource/Init/gs_cidfn.ps130
-rw-r--r--gs/Resource/Init/gs_cidtt.ps16
-rw-r--r--gs/Resource/Init/gs_cmap.ps134
-rw-r--r--gs/Resource/Init/gs_cspace.ps36
-rw-r--r--gs/Resource/Init/gs_css_e.ps6
-rw-r--r--gs/Resource/Init/gs_dbt_e.ps6
-rw-r--r--gs/Resource/Init/gs_diskf.ps104
-rw-r--r--gs/Resource/Init/gs_diskn.ps34
-rw-r--r--gs/Resource/Init/gs_dpnxt.ps58
-rw-r--r--gs/Resource/Init/gs_dps.ps68
-rw-r--r--gs/Resource/Init/gs_dps1.ps50
-rw-r--r--gs/Resource/Init/gs_dps2.ps138
-rw-r--r--gs/Resource/Init/gs_dscp.ps34
-rw-r--r--gs/Resource/Init/gs_epsf.ps104
-rw-r--r--gs/Resource/Init/gs_fapi.ps47
-rw-r--r--gs/Resource/Init/gs_fntem.ps33
-rw-r--r--gs/Resource/Init/gs_fonts.ps29
-rw-r--r--gs/Resource/Init/gs_frsd.ps44
-rw-r--r--gs/Resource/Init/gs_icc.ps20
-rw-r--r--gs/Resource/Init/gs_il1_e.ps30
-rw-r--r--gs/Resource/Init/gs_img.ps84
-rw-r--r--gs/Resource/Init/gs_init.ps829
-rw-r--r--gs/Resource/Init/gs_l2img.ps96
-rw-r--r--gs/Resource/Init/gs_lev2.ps214
-rw-r--r--gs/Resource/Init/gs_ll3.ps92
-rw-r--r--gs/Resource/Init/gs_mex_e.ps6
-rw-r--r--gs/Resource/Init/gs_mgl_e.ps26
-rw-r--r--gs/Resource/Init/gs_mro_e.ps26
-rw-r--r--gs/Resource/Init/gs_pdf_e.ps8
-rw-r--r--gs/Resource/Init/gs_pdfwr.ps155
-rw-r--r--gs/Resource/Init/gs_res.ps642
-rw-r--r--gs/Resource/Init/gs_resmp.ps51
-rw-r--r--gs/Resource/Init/gs_setpd.ps436
-rw-r--r--gs/Resource/Init/gs_statd.ps88
-rw-r--r--gs/Resource/Init/gs_std_e.ps22
-rw-r--r--gs/Resource/Init/gs_sym_e.ps54
-rw-r--r--gs/Resource/Init/gs_trap.ps10
-rw-r--r--gs/Resource/Init/gs_ttf.ps734
-rw-r--r--gs/Resource/Init/gs_typ32.ps42
-rw-r--r--gs/Resource/Init/gs_typ42.ps24
-rw-r--r--gs/Resource/Init/gs_type1.ps96
-rw-r--r--gs/Resource/Init/gs_wan_e.ps18
-rw-r--r--gs/Resource/Init/pdf_base.ps282
-rw-r--r--gs/Resource/Init/pdf_cslayer.ps6
-rw-r--r--gs/Resource/Init/pdf_draw.ps548
-rw-r--r--gs/Resource/Init/pdf_font.ps419
-rw-r--r--gs/Resource/Init/pdf_main.ps642
-rw-r--r--gs/Resource/Init/pdf_ops.ps390
-rw-r--r--gs/Resource/Init/pdf_rbld.ps78
-rw-r--r--gs/Resource/Init/pdf_sec.ps137
-rw-r--r--gs/base/ConvertUTF.c614
-rw-r--r--gs/base/ConvertUTF.h74
-rw-r--r--gs/base/aes.c1
-rw-r--r--gs/base/aes.h4
-rw-r--r--gs/base/assert_.h2
-rw-r--r--gs/base/ctype_.h2
-rw-r--r--gs/base/dirent_.h2
-rw-r--r--gs/base/dos_.h2
-rw-r--r--gs/base/echogs.c382
-rw-r--r--gs/base/errno_.h2
-rw-r--r--gs/base/errors.h4
-rw-r--r--gs/base/fcntl_.h2
-rw-r--r--gs/base/gconf.c12
-rw-r--r--gs/base/gconf.h2
-rw-r--r--gs/base/gdebug.h6
-rw-r--r--gs/base/gdev3852.c255
-rw-r--r--gs/base/gdev3b1.c695
-rw-r--r--gs/base/gdev4081.c105
-rw-r--r--gs/base/gdev4693.c234
-rw-r--r--gs/base/gdev8510.c188
-rw-r--r--gs/base/gdev8bcm.c30
-rw-r--r--gs/base/gdev8bcm.h6
-rw-r--r--gs/base/gdevabuf.c207
-rw-r--r--gs/base/gdevadmp.c513
-rw-r--r--gs/base/gdevatx.c148
-rw-r--r--gs/base/gdevbbox.c914
-rw-r--r--gs/base/gdevbbox.h26
-rw-r--r--gs/base/gdevbit.c432
-rw-r--r--gs/base/gdevbj10.c480
-rw-r--r--gs/base/gdevbjc.h2
-rw-r--r--gs/base/gdevbjcl.c22
-rw-r--r--gs/base/gdevbjcl.h22
-rw-r--r--gs/base/gdevbmp.c124
-rw-r--r--gs/base/gdevbmp.h2
-rw-r--r--gs/base/gdevbmpa.c424
-rw-r--r--gs/base/gdevbmpc.c130
-rw-r--r--gs/base/gdevccr.c113
-rw-r--r--gs/base/gdevcdj.c2409
-rw-r--r--gs/base/gdevcfax.c92
-rw-r--r--gs/base/gdevcgm.c322
-rw-r--r--gs/base/gdevcgml.c396
-rw-r--r--gs/base/gdevcgml.h56
-rw-r--r--gs/base/gdevcgmx.h4
-rw-r--r--gs/base/gdevcif.c54
-rw-r--r--gs/base/gdevclj.c175
-rw-r--r--gs/base/gdevcljc.c38
-rw-r--r--gs/base/gdevcp50.c88
-rw-r--r--gs/base/gdevcslw.c126
-rw-r--r--gs/base/gdevdbit.c792
-rw-r--r--gs/base/gdevdcrd.c104
-rw-r--r--gs/base/gdevdcrd.h4
-rw-r--r--gs/base/gdevddrw.c895
-rw-r--r--gs/base/gdevddrw.h3
-rw-r--r--gs/base/gdevdevn.c1913
-rw-r--r--gs/base/gdevdevn.h69
-rw-r--r--gs/base/gdevdfax.c80
-rw-r--r--gs/base/gdevdflt.c201
-rw-r--r--gs/base/gdevdgbr.c916
-rw-r--r--gs/base/gdevdjet.c282
-rw-r--r--gs/base/gdevdjtc.c185
-rw-r--r--gs/base/gdevdljm.c350
-rw-r--r--gs/base/gdevdljm.h33
-rw-r--r--gs/base/gdevdm24.c264
-rw-r--r--gs/base/gdevdsha.c217
-rw-r--r--gs/base/gdevdsp.c1725
-rw-r--r--gs/base/gdevdsp.h53
-rw-r--r--gs/base/gdevdsp2.h16
-rw-r--r--gs/base/gdevemap.c2
-rw-r--r--gs/base/gdevepsc.c619
-rw-r--r--gs/base/gdevepsn.c647
-rw-r--r--gs/base/gdevescp.c562
-rw-r--r--gs/base/gdevevga.c34
-rw-r--r--gs/base/gdevfax.c1
-rw-r--r--gs/base/gdevfax.h20
-rw-r--r--gs/base/gdevherc.c579
-rw-r--r--gs/base/gdevhit.c8
-rw-r--r--gs/base/gdevhl7x.c590
-rw-r--r--gs/base/gdevifno.c1137
-rw-r--r--gs/base/gdevijs.c848
-rw-r--r--gs/base/gdevimdi.c252
-rw-r--r--gs/base/gdevimgn.c547
-rw-r--r--gs/base/gdevjbig2.c38
-rw-r--r--gs/base/gdevjpeg.c286
-rw-r--r--gs/base/gdevjpx.c88
-rw-r--r--gs/base/gdevl256.c133
-rw-r--r--gs/base/gdevl31s.c298
-rw-r--r--gs/base/gdevlbp8.c199
-rw-r--r--gs/base/gdevlj56.c174
-rw-r--r--gs/base/gdevlp8k.c349
-rw-r--r--gs/base/gdevlxm.c437
-rw-r--r--gs/base/gdevm1.c376
-rw-r--r--gs/base/gdevm16.c114
-rw-r--r--gs/base/gdevm2.c164
-rw-r--r--gs/base/gdevm24.c721
-rw-r--r--gs/base/gdevm32.c286
-rw-r--r--gs/base/gdevm4.c281
-rw-r--r--gs/base/gdevm40.c583
-rw-r--r--gs/base/gdevm48.c521
-rw-r--r--gs/base/gdevm56.c631
-rw-r--r--gs/base/gdevm64.c439
-rw-r--r--gs/base/gdevmac.c1320
-rw-r--r--gs/base/gdevmac.h105
-rw-r--r--gs/base/gdevmacpictop.h888
-rw-r--r--gs/base/gdevmacttf.h47
-rw-r--r--gs/base/gdevmacxf.c557
-rw-r--r--gs/base/gdevmeds.c110
-rw-r--r--gs/base/gdevmeds.h4
-rw-r--r--gs/base/gdevmem.c528
-rw-r--r--gs/base/gdevmem.h146
-rw-r--r--gs/base/gdevmgr.c406
-rw-r--r--gs/base/gdevmgr.h18
-rw-r--r--gs/base/gdevmiff.c52
-rw-r--r--gs/base/gdevmpla.h4
-rw-r--r--gs/base/gdevmr1.c32
-rw-r--r--gs/base/gdevmr2n.c160
-rw-r--r--gs/base/gdevmrop.h24
-rw-r--r--gs/base/gdevmrun.c345
-rw-r--r--gs/base/gdevmrun.h16
-rw-r--r--gs/base/gdevmswn.c576
-rw-r--r--gs/base/gdevmswn.h20
-rw-r--r--gs/base/gdevmsxf.c332
-rw-r--r--gs/base/gdevn533.c118
-rw-r--r--gs/base/gdevnfwd.c587
-rw-r--r--gs/base/gdevo182.c362
-rw-r--r--gs/base/gdevokii.c434
-rw-r--r--gs/base/gdevos2p.c420
-rw-r--r--gs/base/gdevp14.c4208
-rw-r--r--gs/base/gdevp14.h28
-rw-r--r--gs/base/gdevp2up.c112
-rw-r--r--gs/base/gdevpbm.c1
-rw-r--r--gs/base/gdevpccm.c30
-rw-r--r--gs/base/gdevpccm.h2
-rw-r--r--gs/base/gdevpcfb.c854
-rw-r--r--gs/base/gdevpcfb.h60
-rw-r--r--gs/base/gdevpcl.c472
-rw-r--r--gs/base/gdevpcl.h2
-rw-r--r--gs/base/gdevpcx.c260
-rw-r--r--gs/base/gdevpdf.c1339
-rw-r--r--gs/base/gdevpdfb.c764
-rw-r--r--gs/base/gdevpdfb.h20
-rw-r--r--gs/base/gdevpdfc.c1299
-rw-r--r--gs/base/gdevpdfc.h16
-rw-r--r--gs/base/gdevpdfd.c1552
-rw-r--r--gs/base/gdevpdfe.c869
-rw-r--r--gs/base/gdevpdfg.c1456
-rw-r--r--gs/base/gdevpdfg.h119
-rw-r--r--gs/base/gdevpdfi.c1673
-rw-r--r--gs/base/gdevpdfj.c634
-rw-r--r--gs/base/gdevpdfk.c476
-rw-r--r--gs/base/gdevpdfm.c1877
-rw-r--r--gs/base/gdevpdfo.c961
-rw-r--r--gs/base/gdevpdfo.h28
-rw-r--r--gs/base/gdevpdfp.c710
-rw-r--r--gs/base/gdevpdfr.c376
-rw-r--r--gs/base/gdevpdft.c425
-rw-r--r--gs/base/gdevpdfu.c2517
-rw-r--r--gs/base/gdevpdfv.c981
-rw-r--r--gs/base/gdevpdfx.h193
-rw-r--r--gs/base/gdevpdt.c16
-rw-r--r--gs/base/gdevpdt.h10
-rw-r--r--gs/base/gdevpdtb.c642
-rw-r--r--gs/base/gdevpdtb.h20
-rw-r--r--gs/base/gdevpdtc.c1165
-rw-r--r--gs/base/gdevpdtd.c606
-rw-r--r--gs/base/gdevpdtd.h16
-rw-r--r--gs/base/gdevpdte.c1578
-rw-r--r--gs/base/gdevpdtf.c836
-rw-r--r--gs/base/gdevpdtf.h194
-rw-r--r--gs/base/gdevpdti.c895
-rw-r--r--gs/base/gdevpdti.h8
-rw-r--r--gs/base/gdevpdts.c599
-rw-r--r--gs/base/gdevpdts.h27
-rw-r--r--gs/base/gdevpdtt.c3176
-rw-r--r--gs/base/gdevpdtt.h80
-rw-r--r--gs/base/gdevpdtv.c2
-rw-r--r--gs/base/gdevpdtv.h2
-rw-r--r--gs/base/gdevpdtw.c742
-rw-r--r--gs/base/gdevpdtw.h19
-rw-r--r--gs/base/gdevpdtx.h2
-rw-r--r--gs/base/gdevpe.c526
-rw-r--r--gs/base/gdevperm.c236
-rw-r--r--gs/base/gdevphex.c4174
-rw-r--r--gs/base/gdevpipe.c10
-rw-r--r--gs/base/gdevpjet.c302
-rw-r--r--gs/base/gdevplib.c23
-rw-r--r--gs/base/gdevplnx.c894
-rw-r--r--gs/base/gdevplnx.h12
-rw-r--r--gs/base/gdevpm.h2
-rw-r--r--gs/base/gdevpng.c636
-rw-r--r--gs/base/gdevppla.c47
-rw-r--r--gs/base/gdevppla.h16
-rw-r--r--gs/base/gdevprn.c1187
-rw-r--r--gs/base/gdevprn.h356
-rw-r--r--gs/base/gdevprna.c533
-rw-r--r--gs/base/gdevprna.h28
-rw-r--r--gs/base/gdevps.c1371
-rw-r--r--gs/base/gdevpsd.c617
-rw-r--r--gs/base/gdevpsdf.h193
-rw-r--r--gs/base/gdevpsdi.c798
-rw-r--r--gs/base/gdevpsdp.c789
-rw-r--r--gs/base/gdevpsds.c1057
-rw-r--r--gs/base/gdevpsds.h32
-rw-r--r--gs/base/gdevpsdu.c359
-rw-r--r--gs/base/gdevpsf.h82
-rw-r--r--gs/base/gdevpsf1.c604
-rw-r--r--gs/base/gdevpsf2.c1231
-rw-r--r--gs/base/gdevpsfm.c345
-rw-r--r--gs/base/gdevpsft.c1274
-rw-r--r--gs/base/gdevpsfu.c310
-rw-r--r--gs/base/gdevpsfx.c1211
-rw-r--r--gs/base/gdevpsim.c246
-rw-r--r--gs/base/gdevpsu.c176
-rw-r--r--gs/base/gdevpsu.h15
-rw-r--r--gs/base/gdevpx.c1561
-rw-r--r--gs/base/gdevpxen.h4
-rw-r--r--gs/base/gdevpxop.h2
-rw-r--r--gs/base/gdevpxut.c152
-rw-r--r--gs/base/gdevpxut.h8
-rw-r--r--gs/base/gdevrinkj.c730
-rw-r--r--gs/base/gdevrops.c52
-rw-r--r--gs/base/gdevs3ga.c150
-rw-r--r--gs/base/gdevsco.c92
-rw-r--r--gs/base/gdevsgi.c248
-rw-r--r--gs/base/gdevsgi.h4
-rw-r--r--gs/base/gdevsj48.c389
-rw-r--r--gs/base/gdevsnfb.c24
-rw-r--r--gs/base/gdevsppr.c42
-rw-r--r--gs/base/gdevstc.c90
-rw-r--r--gs/base/gdevstc.h11
-rw-r--r--gs/base/gdevstc1.c8
-rw-r--r--gs/base/gdevstc2.c21
-rw-r--r--gs/base/gdevstc3.c6
-rw-r--r--gs/base/gdevstc4.c221
-rw-r--r--gs/base/gdevsun.c795
-rw-r--r--gs/base/gdevsunr.c38
-rw-r--r--gs/base/gdevsvg.c183
-rw-r--r--gs/base/gdevsvga.c780
-rw-r--r--gs/base/gdevsvga.h40
-rw-r--r--gs/base/gdevtfax.c134
-rw-r--r--gs/base/gdevtfax.h4
-rw-r--r--gs/base/gdevtfnx.c116
-rw-r--r--gs/base/gdevtifs.c2
-rw-r--r--gs/base/gdevtifs.h10
-rw-r--r--gs/base/gdevtknk.c146
-rw-r--r--gs/base/gdevtrac.c566
-rw-r--r--gs/base/gdevtsep.c6
-rw-r--r--gs/base/gdevtxtw.c161
-rw-r--r--gs/base/gdevupd.c64
-rw-r--r--gs/base/gdevvec.c1264
-rw-r--r--gs/base/gdevvec.h210
-rw-r--r--gs/base/gdevvglb.c235
-rw-r--r--gs/base/gdevwddb.c493
-rw-r--r--gs/base/gdevwdib.c409
-rw-r--r--gs/base/gdevwpr2.c1124
-rw-r--r--gs/base/gdevwprn.c530
-rw-r--r--gs/base/gdevwts.c915
-rw-r--r--gs/base/gdevx.c1135
-rw-r--r--gs/base/gdevx.h42
-rw-r--r--gs/base/gdevxalt.c329
-rw-r--r--gs/base/gdevxcf.c884
-rw-r--r--gs/base/gdevxcmp.c1025
-rw-r--r--gs/base/gdevxcmp.h60
-rw-r--r--gs/base/gdevxini.c1176
-rw-r--r--gs/base/gdevxres.c6
-rw-r--r--gs/base/gdevxxf.c476
-rw-r--r--gs/base/genarch.c76
-rw-r--r--gs/base/genconf.c874
-rw-r--r--gs/base/gendev.c370
-rw-r--r--gs/base/genht.c298
-rw-r--r--gs/base/gp.h55
-rw-r--r--gs/base/gp_dosfe.c82
-rw-r--r--gs/base/gp_dosfs.c54
-rw-r--r--gs/base/gp_dvx.c40
-rw-r--r--gs/base/gp_getnv.c24
-rw-r--r--gs/base/gp_mac.c189
-rw-r--r--gs/base/gp_mac.h3
-rw-r--r--gs/base/gp_macio.c682
-rw-r--r--gs/base/gp_macpoll.c58
-rw-r--r--gs/base/gp_mktmp.c24
-rw-r--r--gs/base/gp_msdll.c6
-rw-r--r--gs/base/gp_msdos.c28
-rw-r--r--gs/base/gp_mshdl.c36
-rw-r--r--gs/base/gp_mslib.c4
-rw-r--r--gs/base/gp_mspol.c10
-rw-r--r--gs/base/gp_msprn.c130
-rw-r--r--gs/base/gp_mswin.c490
-rw-r--r--gs/base/gp_mswin.h5
-rw-r--r--gs/base/gp_nsync.c12
-rw-r--r--gs/base/gp_ntfs.c114
-rw-r--r--gs/base/gp_os2.c344
-rw-r--r--gs/base/gp_os2.h3
-rw-r--r--gs/base/gp_os2fs.c182
-rw-r--r--gs/base/gp_os2pr.c28
-rw-r--r--gs/base/gp_os9.c45
-rw-r--r--gs/base/gp_paper.c4
-rw-r--r--gs/base/gp_psync.c56
-rw-r--r--gs/base/gp_stdia.c4
-rw-r--r--gs/base/gp_stdin.c5
-rw-r--r--gs/base/gp_strdl.c10
-rw-r--r--gs/base/gp_sysv.c14
-rw-r--r--gs/base/gp_unix.c2
-rw-r--r--gs/base/gp_unix_cache.c3
-rw-r--r--gs/base/gp_upapr.c38
-rw-r--r--gs/base/gp_vms.c352
-rw-r--r--gs/base/gp_wgetv.c125
-rw-r--r--gs/base/gp_win32.c24
-rw-r--r--gs/base/gp_wpapr.c84
-rw-r--r--gs/base/gp_wsync.c57
-rw-r--r--gs/base/gpcheck.h4
-rw-r--r--gs/base/gpgetenv.h2
-rw-r--r--gs/base/gpmisc.c387
-rw-r--r--gs/base/gpmisc.h20
-rw-r--r--gs/base/gs_agl.h6
-rw-r--r--gs/base/gs_dll_call.h7
-rw-r--r--gs/base/gs_mgl_e.h6
-rw-r--r--gs/base/gs_mro_e.h6
-rw-r--r--gs/base/gsalloc.c1765
-rw-r--r--gs/base/gsalloc.h8
-rw-r--r--gs/base/gsalpha.c6
-rw-r--r--gs/base/gsalpha.h2
-rw-r--r--gs/base/gsalphac.c708
-rw-r--r--gs/base/gsalphac.h6
-rw-r--r--gs/base/gsargs.c260
-rw-r--r--gs/base/gsargs.h20
-rw-r--r--gs/base/gsbitcom.c292
-rw-r--r--gs/base/gsbitmap.h38
-rw-r--r--gs/base/gsbitops.c776
-rw-r--r--gs/base/gsbittab.c2
-rw-r--r--gs/base/gsbittab.h2
-rw-r--r--gs/base/gsccode.h16
-rw-r--r--gs/base/gsccolor.h9
-rw-r--r--gs/base/gscdef.c10
-rw-r--r--gs/base/gscdefs.h4
-rw-r--r--gs/base/gscdevn.c242
-rw-r--r--gs/base/gscdevn.h23
-rw-r--r--gs/base/gscedata.c2
-rw-r--r--gs/base/gscedata.h2
-rw-r--r--gs/base/gscencs.c78
-rw-r--r--gs/base/gscencs.h2
-rw-r--r--gs/base/gschar.c96
-rw-r--r--gs/base/gschar.h24
-rw-r--r--gs/base/gschar0.c566
-rw-r--r--gs/base/gscicach.c198
-rw-r--r--gs/base/gscicach.h6
-rw-r--r--gs/base/gscie.c800
-rw-r--r--gs/base/gscie.h145
-rw-r--r--gs/base/gsciemap.c510
-rw-r--r--gs/base/gscindex.h34
-rw-r--r--gs/base/gsclipsr.c50
-rw-r--r--gs/base/gsclipsr.h2
-rw-r--r--gs/base/gscms.h46
-rw-r--r--gs/base/gscolor.c51
-rw-r--r--gs/base/gscolor.h2
-rw-r--r--gs/base/gscolor1.c67
-rw-r--r--gs/base/gscolor1.h14
-rw-r--r--gs/base/gscolor2.c6
-rw-r--r--gs/base/gscolor2.h4
-rw-r--r--gs/base/gscolor3.c48
-rw-r--r--gs/base/gscolor3.h2
-rw-r--r--gs/base/gscolorbuffer.c16
-rw-r--r--gs/base/gscolorbuffer.h6
-rw-r--r--gs/base/gscompt.h2
-rw-r--r--gs/base/gscoord.c226
-rw-r--r--gs/base/gscoord.h2
-rw-r--r--gs/base/gscparam.c446
-rw-r--r--gs/base/gscpixel.c36
-rw-r--r--gs/base/gscpixel.h4
-rw-r--r--gs/base/gscpm.h2
-rw-r--r--gs/base/gscrd.c175
-rw-r--r--gs/base/gscrd.h64
-rw-r--r--gs/base/gscrdp.c574
-rw-r--r--gs/base/gscrdp.h18
-rw-r--r--gs/base/gscrypt1.c16
-rw-r--r--gs/base/gscrypt1.h6
-rw-r--r--gs/base/gscscie.c170
-rw-r--r--gs/base/gscsel.h2
-rw-r--r--gs/base/gscsepr.c155
-rw-r--r--gs/base/gscsepr.h19
-rw-r--r--gs/base/gscspace.c185
-rw-r--r--gs/base/gscspace.h65
-rw-r--r--gs/base/gscssub.c50
-rw-r--r--gs/base/gscssub.h6
-rw-r--r--gs/base/gsdcolor.h97
-rw-r--r--gs/base/gsdevice.c564
-rw-r--r--gs/base/gsdevice.h26
-rw-r--r--gs/base/gsdevmem.c248
-rw-r--r--gs/base/gsdfilt.c26
-rw-r--r--gs/base/gsdfilt.h9
-rw-r--r--gs/base/gsdll.h30
-rw-r--r--gs/base/gsdllwin.h12
-rw-r--r--gs/base/gsdparam.c804
-rw-r--r--gs/base/gsdpnext.h2
-rw-r--r--gs/base/gsdps.c40
-rw-r--r--gs/base/gsdps.h2
-rw-r--r--gs/base/gsdps1.c296
-rw-r--r--gs/base/gsdsrc.c86
-rw-r--r--gs/base/gsdsrc.h8
-rw-r--r--gs/base/gsequivc.c190
-rw-r--r--gs/base/gsequivc.h12
-rw-r--r--gs/base/gserror.h7
-rw-r--r--gs/base/gserrors.h2
-rw-r--r--gs/base/gsexit.h5
-rw-r--r--gs/base/gsfcid.c92
-rw-r--r--gs/base/gsfcid2.c196
-rw-r--r--gs/base/gsfcmap.c308
-rw-r--r--gs/base/gsfcmap.h14
-rw-r--r--gs/base/gsfcmap1.c162
-rw-r--r--gs/base/gsflip.c234
-rw-r--r--gs/base/gsflip.h6
-rw-r--r--gs/base/gsfname.c44
-rw-r--r--gs/base/gsfname.h6
-rw-r--r--gs/base/gsfont.c707
-rw-r--r--gs/base/gsfont.h14
-rw-r--r--gs/base/gsfont0.c46
-rw-r--r--gs/base/gsfont0c.c64
-rw-r--r--gs/base/gsfunc.c121
-rw-r--r--gs/base/gsfunc.h18
-rw-r--r--gs/base/gsfunc0.c1397
-rw-r--r--gs/base/gsfunc0.h8
-rw-r--r--gs/base/gsfunc3.c632
-rw-r--r--gs/base/gsfunc3.h20
-rw-r--r--gs/base/gsfunc4.c1089
-rw-r--r--gs/base/gsfunc4.h8
-rw-r--r--gs/base/gsgc.h16
-rw-r--r--gs/base/gsgcache.c106
-rw-r--r--gs/base/gsgcache.h7
-rw-r--r--gs/base/gsgdata.c32
-rw-r--r--gs/base/gsgdata.h28
-rw-r--r--gs/base/gshsb.c162
-rw-r--r--gs/base/gshsb.h2
-rw-r--r--gs/base/gsht.c49
-rw-r--r--gs/base/gsht.h10
-rw-r--r--gs/base/gsht1.c716
-rw-r--r--gs/base/gsht1.h2
-rw-r--r--gs/base/gshtscr.c142
-rw-r--r--gs/base/gshtx.c443
-rw-r--r--gs/base/gshtx.h58
-rw-r--r--gs/base/gsicc.c71
-rw-r--r--gs/base/gsicc.h8
-rw-r--r--gs/base/gsicc_cache.c255
-rw-r--r--gs/base/gsicc_cache.h26
-rw-r--r--gs/base/gsicc_cms.h3
-rw-r--r--gs/base/gsicc_create.c468
-rw-r--r--gs/base/gsicc_create.h28
-rw-r--r--gs/base/gsicc_lcms.c3
-rw-r--r--gs/base/gsicc_lcms2.c26
-rw-r--r--gs/base/gsicc_manage.c3
-rw-r--r--gs/base/gsicc_manage.h23
-rw-r--r--gs/base/gsicc_profilecache.c56
-rw-r--r--gs/base/gsicc_profilecache.h5
-rw-r--r--gs/base/gsimage.c479
-rw-r--r--gs/base/gsimage.h20
-rw-r--r--gs/base/gsimpath.c152
-rw-r--r--gs/base/gsinit.c8
-rw-r--r--gs/base/gsio.h2
-rw-r--r--gs/base/gsiodev.c142
-rw-r--r--gs/base/gsiodevs.c44
-rw-r--r--gs/base/gsiodisk.c207
-rw-r--r--gs/base/gsiomacres.c172
-rw-r--r--gs/base/gsiorom.c210
-rw-r--r--gs/base/gsiorom.h2
-rw-r--r--gs/base/gsipar3x.h2
-rw-r--r--gs/base/gsiparam.h122
-rw-r--r--gs/base/gsiparm2.h2
-rw-r--r--gs/base/gsiparm3.h4
-rw-r--r--gs/base/gsiparm4.h6
-rw-r--r--gs/base/gsistate.c33
-rw-r--r--gs/base/gsjconf.h2
-rw-r--r--gs/base/gsjmorec.h2
-rw-r--r--gs/base/gslib.c744
-rw-r--r--gs/base/gslib.h2
-rw-r--r--gs/base/gslibctx.c5
-rw-r--r--gs/base/gslibctx.h9
-rw-r--r--gs/base/gsline.c116
-rw-r--r--gs/base/gsline.h2
-rw-r--r--gs/base/gslparam.h2
-rw-r--r--gs/base/gsmalloc.c316
-rw-r--r--gs/base/gsmalloc.h4
-rw-r--r--gs/base/gsmatrix.c520
-rw-r--r--gs/base/gsmatrix.h2
-rw-r--r--gs/base/gsmchunk.c536
-rw-r--r--gs/base/gsmchunk.h6
-rw-r--r--gs/base/gsmdebug.h2
-rw-r--r--gs/base/gsmemlok.c270
-rw-r--r--gs/base/gsmemlok.h8
-rw-r--r--gs/base/gsmemory.c185
-rw-r--r--gs/base/gsmemory.h150
-rw-r--r--gs/base/gsmemraw.h115
-rw-r--r--gs/base/gsmemret.c196
-rw-r--r--gs/base/gsmemret.h12
-rw-r--r--gs/base/gsmisc.c4
-rw-r--r--gs/base/gsnamecl.c138
-rw-r--r--gs/base/gsnamecl.h99
-rw-r--r--gs/base/gsncdummy.c752
-rw-r--r--gs/base/gsncdummy.h3
-rw-r--r--gs/base/gsnogc.c17
-rw-r--r--gs/base/gsnogc.h2
-rw-r--r--gs/base/gsnorop.c66
-rw-r--r--gs/base/gsnotify.c50
-rw-r--r--gs/base/gsnotify.h10
-rw-r--r--gs/base/gsovrc.c55
-rw-r--r--gs/base/gsovrc.h20
-rw-r--r--gs/base/gspaint.c286
-rw-r--r--gs/base/gspaint.h2
-rw-r--r--gs/base/gsparam.c313
-rw-r--r--gs/base/gsparam.h226
-rw-r--r--gs/base/gsparam2.c467
-rw-r--r--gs/base/gsparams.c471
-rw-r--r--gs/base/gsparams.h2
-rw-r--r--gs/base/gsparamx.c188
-rw-r--r--gs/base/gsparamx.h10
-rw-r--r--gs/base/gspath.c278
-rw-r--r--gs/base/gspath.h6
-rw-r--r--gs/base/gspath1.c2
-rw-r--r--gs/base/gspath2.h2
-rw-r--r--gs/base/gspcolor.c98
-rw-r--r--gs/base/gspcolor.h4
-rw-r--r--gs/base/gspenum.h2
-rw-r--r--gs/base/gspmdrv.c1334
-rw-r--r--gs/base/gspmdrv.h2
-rw-r--r--gs/base/gsptype1.c16
-rw-r--r--gs/base/gsptype1.h48
-rw-r--r--gs/base/gsptype2.c155
-rw-r--r--gs/base/gsptype2.h8
-rw-r--r--gs/base/gsrect.h4
-rw-r--r--gs/base/gsrefct.h24
-rw-r--r--gs/base/gsromfs0.c4
-rw-r--r--gs/base/gsrop.c16
-rw-r--r--gs/base/gsrop.h2
-rw-r--r--gs/base/gsroprun.c13
-rw-r--r--gs/base/gsropt.h2
-rw-r--r--gs/base/gsroptab.c98
-rw-r--r--gs/base/gsserial.c8
-rw-r--r--gs/base/gsserial.h9
-rw-r--r--gs/base/gsshade.c204
-rw-r--r--gs/base/gsshade.h42
-rw-r--r--gs/base/gsstate.c2
-rw-r--r--gs/base/gsstate.h2
-rw-r--r--gs/base/gsstruct.h144
-rw-r--r--gs/base/gsstype.h54
-rw-r--r--gs/base/gstext.c268
-rw-r--r--gs/base/gstext.h104
-rw-r--r--gs/base/gstparam.h18
-rw-r--r--gs/base/gstrans.c1
-rw-r--r--gs/base/gstrans.h36
-rw-r--r--gs/base/gstrap.c66
-rw-r--r--gs/base/gstrap.h2
-rw-r--r--gs/base/gstype1.c778
-rw-r--r--gs/base/gstype1.h20
-rw-r--r--gs/base/gstype2.c1282
-rw-r--r--gs/base/gstype42.c1877
-rw-r--r--gs/base/gstypes.h2
-rw-r--r--gs/base/gsuid.h2
-rw-r--r--gs/base/gsutil.c215
-rw-r--r--gs/base/gsutil.h8
-rw-r--r--gs/base/gswts.c1063
-rw-r--r--gs/base/gswts.h2
-rw-r--r--gs/base/gsxfont.h2
-rw-r--r--gs/base/gx.h2
-rw-r--r--gs/base/gxacpath.c436
-rw-r--r--gs/base/gxalloc.h100
-rw-r--r--gs/base/gxalpha.h2
-rw-r--r--gs/base/gxarith.h2
-rw-r--r--gs/base/gxband.h8
-rw-r--r--gs/base/gxbcache.c52
-rw-r--r--gs/base/gxbcache.h28
-rw-r--r--gs/base/gxbitfmt.h6
-rw-r--r--gs/base/gxbitmap.h10
-rw-r--r--gs/base/gxbitops.h16
-rw-r--r--gs/base/gxblend.c1422
-rw-r--r--gs/base/gxblend.h132
-rw-r--r--gs/base/gxblend1.c635
-rw-r--r--gs/base/gxccache.c550
-rw-r--r--gs/base/gxccman.c1001
-rw-r--r--gs/base/gxcdevn.h2
-rw-r--r--gs/base/gxchar.h20
-rw-r--r--gs/base/gxchrout.c18
-rw-r--r--gs/base/gxchrout.h2
-rw-r--r--gs/base/gxcht.c1073
-rw-r--r--gs/base/gxcid.h2
-rw-r--r--gs/base/gxcie.h28
-rw-r--r--gs/base/gxcindex.h32
-rw-r--r--gs/base/gxclbits.c838
-rw-r--r--gs/base/gxcldev.h156
-rw-r--r--gs/base/gxclfile.c86
-rw-r--r--gs/base/gxclimag.c14
-rw-r--r--gs/base/gxclio.h8
-rw-r--r--gs/base/gxclip.c388
-rw-r--r--gs/base/gxclip.h16
-rw-r--r--gs/base/gxclip2.c212
-rw-r--r--gs/base/gxclip2.h8
-rw-r--r--gs/base/gxclipm.c276
-rw-r--r--gs/base/gxclipm.h2
-rw-r--r--gs/base/gxclipsr.h2
-rw-r--r--gs/base/gxclist.c78
-rw-r--r--gs/base/gxclist.h204
-rw-r--r--gs/base/gxcllzw.c2
-rw-r--r--gs/base/gxclmem.c1318
-rw-r--r--gs/base/gxclmem.h64
-rw-r--r--gs/base/gxclpage.c114
-rw-r--r--gs/base/gxclpage.h6
-rw-r--r--gs/base/gxclpath.c1899
-rw-r--r--gs/base/gxclpath.h66
-rw-r--r--gs/base/gxclrast.c4
-rw-r--r--gs/base/gxclread.c724
-rw-r--r--gs/base/gxclrect.c1496
-rw-r--r--gs/base/gxclthrd.c5
-rw-r--r--gs/base/gxclthrd.h6
-rw-r--r--gs/base/gxclutil.c633
-rw-r--r--gs/base/gxcmap.c546
-rw-r--r--gs/base/gxcmap.h23
-rw-r--r--gs/base/gxcolor2.h11
-rw-r--r--gs/base/gxcomp.h19
-rw-r--r--gs/base/gxcoord.h2
-rw-r--r--gs/base/gxcpath.c1062
-rw-r--r--gs/base/gxcpath.h8
-rw-r--r--gs/base/gxcspace.h42
-rw-r--r--gs/base/gxctable.c162
-rw-r--r--gs/base/gxctable.h6
-rw-r--r--gs/base/gxcvalue.h2
-rw-r--r--gs/base/gxdcconv.c130
-rw-r--r--gs/base/gxdcconv.h10
-rw-r--r--gs/base/gxdcolor.c266
-rw-r--r--gs/base/gxdcolor.h29
-rw-r--r--gs/base/gxdda.h12
-rw-r--r--gs/base/gxdevbuf.h15
-rw-r--r--gs/base/gxdevcli.h383
-rw-r--r--gs/base/gxdevmem.h94
-rw-r--r--gs/base/gxdevndi.c172
-rw-r--r--gs/base/gxdevndi.h11
-rw-r--r--gs/base/gxdevrop.h2
-rw-r--r--gs/base/gxdevsop.h6
-rw-r--r--gs/base/gxdht.h10
-rw-r--r--gs/base/gxdhtres.h2
-rw-r--r--gs/base/gxdhtserial.c32
-rw-r--r--gs/base/gxdhtserial.h3
-rw-r--r--gs/base/gxdither.h2
-rw-r--r--gs/base/gxdtfill.h366
-rw-r--r--gs/base/gxfapiu.c98
-rw-r--r--gs/base/gxfapiu.h3
-rw-r--r--gs/base/gxfarith.h2
-rw-r--r--gs/base/gxfcache.h33
-rw-r--r--gs/base/gxfcid.h12
-rw-r--r--gs/base/gxfcmap.h34
-rw-r--r--gs/base/gxfcmap1.h10
-rw-r--r--gs/base/gxfcopy.c1997
-rw-r--r--gs/base/gxfcopy.h35
-rw-r--r--gs/base/gxfdrop.c659
-rw-r--r--gs/base/gxfdrop.h11
-rw-r--r--gs/base/gxfill.c8
-rw-r--r--gs/base/gxfill.h16
-rw-r--r--gs/base/gxfillsl.h363
-rw-r--r--gs/base/gxfilltr.h575
-rw-r--r--gs/base/gxfillts.h1
-rw-r--r--gs/base/gxfixed.h23
-rw-r--r--gs/base/gxfmap.h6
-rw-r--r--gs/base/gxfont.h98
-rw-r--r--gs/base/gxfont0.h2
-rw-r--r--gs/base/gxfont0c.h12
-rw-r--r--gs/base/gxfont1.h38
-rw-r--r--gs/base/gxfont42.h42
-rw-r--r--gs/base/gxfrac.h2
-rw-r--r--gs/base/gxftype.h2
-rw-r--r--gs/base/gxfunc.h8
-rw-r--r--gs/base/gxgetbit.h14
-rw-r--r--gs/base/gxhintn.c2488
-rw-r--r--gs/base/gxhintn.h18
-rw-r--r--gs/base/gxhintn1.c866
-rw-r--r--gs/base/gxhldevc.c99
-rw-r--r--gs/base/gxhldevc.h24
-rw-r--r--gs/base/gxht.c282
-rw-r--r--gs/base/gxht.h36
-rw-r--r--gs/base/gxht_thresh.c23
-rw-r--r--gs/base/gxht_thresh.h7
-rw-r--r--gs/base/gxhtbit.c192
-rw-r--r--gs/base/gxhttile.h2
-rw-r--r--gs/base/gxhttype.h12
-rw-r--r--gs/base/gxi12bit.c600
-rw-r--r--gs/base/gxi16bit.c30
-rw-r--r--gs/base/gxiclass.h4
-rw-r--r--gs/base/gxicolor.c598
-rw-r--r--gs/base/gxidata.c538
-rw-r--r--gs/base/gxifast.c874
-rw-r--r--gs/base/gximag3x.c876
-rw-r--r--gs/base/gximag3x.h48
-rw-r--r--gs/base/gximage.c312
-rw-r--r--gs/base/gximage.h1
-rw-r--r--gs/base/gximage1.c92
-rw-r--r--gs/base/gximage2.c297
-rw-r--r--gs/base/gximage3.c756
-rw-r--r--gs/base/gximage3.h46
-rw-r--r--gs/base/gximage4.c88
-rw-r--r--gs/base/gximask.c69
-rw-r--r--gs/base/gximask.h7
-rw-r--r--gs/base/gximono.c3
-rw-r--r--gs/base/gxino12b.c2
-rw-r--r--gs/base/gxino16b.c2
-rw-r--r--gs/base/gxiodev.h8
-rw-r--r--gs/base/gxiparam.h36
-rw-r--r--gs/base/gxipixel.c1
-rw-r--r--gs/base/gxiscale.c2
-rw-r--r--gs/base/gxistate.h204
-rw-r--r--gs/base/gxline.h6
-rw-r--r--gs/base/gxlum.h2
-rw-r--r--gs/base/gxmatrix.h10
-rw-r--r--gs/base/gxmclip.c74
-rw-r--r--gs/base/gxmclip.h66
-rw-r--r--gs/base/gxobj.h34
-rw-r--r--gs/base/gxoprect.c13
-rw-r--r--gs/base/gxoprect.h2
-rw-r--r--gs/base/gxp1fill.c18
-rw-r--r--gs/base/gxp1impl.h4
-rw-r--r--gs/base/gxpageq.c141
-rw-r--r--gs/base/gxpageq.h134
-rw-r--r--gs/base/gxpaint.c30
-rw-r--r--gs/base/gxpaint.h16
-rw-r--r--gs/base/gxpath.c590
-rw-r--r--gs/base/gxpath.h50
-rw-r--r--gs/base/gxpath2.c619
-rw-r--r--gs/base/gxpcache.h2
-rw-r--r--gs/base/gxpcmap.c790
-rw-r--r--gs/base/gxpcolor.h108
-rw-r--r--gs/base/gxpcopy.c986
-rw-r--r--gs/base/gxpdash.c278
-rw-r--r--gs/base/gxpflat.c473
-rw-r--r--gs/base/gxrplane.h4
-rw-r--r--gs/base/gxsample.c8
-rw-r--r--gs/base/gxsample.h6
-rw-r--r--gs/base/gxsamplp.h258
-rw-r--r--gs/base/gxshade.c296
-rw-r--r--gs/base/gxshade.h32
-rw-r--r--gs/base/gxshade1.c923
-rw-r--r--gs/base/gxshade4.c212
-rw-r--r--gs/base/gxshade4.h36
-rw-r--r--gs/base/gxshade6.c9
-rw-r--r--gs/base/gxstate.h9
-rw-r--r--gs/base/gxstdio.h3
-rw-r--r--gs/base/gxstroke.c2058
-rw-r--r--gs/base/gxsync.c56
-rw-r--r--gs/base/gxsync.h19
-rw-r--r--gs/base/gxtext.h30
-rw-r--r--gs/base/gxtmap.h6
-rw-r--r--gs/base/gxttf.h196
-rw-r--r--gs/base/gxttfb.c588
-rw-r--r--gs/base/gxttfb.h26
-rw-r--r--gs/base/gxtype1.c553
-rw-r--r--gs/base/gxtype1.h43
-rw-r--r--gs/base/gxwts.c309
-rw-r--r--gs/base/gxwts.h6
-rw-r--r--gs/base/gxxfont.h2
-rw-r--r--gs/base/gzacpath.h12
-rw-r--r--gs/base/gzcpath.h2
-rw-r--r--gs/base/gzht.h48
-rw-r--r--gs/base/gzline.h2
-rw-r--r--gs/base/gzpath.h47
-rw-r--r--gs/base/gzspotan.c701
-rw-r--r--gs/base/gzspotan.h20
-rw-r--r--gs/base/gzstate.h12
-rw-r--r--gs/base/jerror_.h2
-rw-r--r--gs/base/locale_.h2
-rw-r--r--gs/base/macos_carbon_d_pre.h2
-rw-r--r--gs/base/macos_carbon_pre.h2
-rw-r--r--gs/base/macos_classic_d_pre.h4
-rw-r--r--gs/base/macsystypes.h2
-rw-r--r--gs/base/malloc_.h2
-rw-r--r--gs/base/math_.h2
-rw-r--r--gs/base/md5.c123
-rw-r--r--gs/base/md5.h12
-rw-r--r--gs/base/md5main.c94
-rw-r--r--gs/base/memory_.h30
-rw-r--r--gs/base/minftrsz.c2
-rw-r--r--gs/base/mkromfs.c848
-rw-r--r--gs/base/opdfread.h6
-rw-r--r--gs/base/pipe_.h4
-rw-r--r--gs/base/png_.h2
-rw-r--r--gs/base/rinkj/evenbetter-rll.c1345
-rw-r--r--gs/base/rinkj/evenbetter-rll.h6
-rw-r--r--gs/base/rinkj/rinkj-byte-stream.c7
-rw-r--r--gs/base/rinkj/rinkj-byte-stream.h3
-rw-r--r--gs/base/rinkj/rinkj-config.c88
-rw-r--r--gs/base/rinkj/rinkj-config.h2
-rw-r--r--gs/base/rinkj/rinkj-device.c6
-rw-r--r--gs/base/rinkj/rinkj-device.h6
-rw-r--r--gs/base/rinkj/rinkj-dither.c2
-rw-r--r--gs/base/rinkj/rinkj-dither.h3
-rw-r--r--gs/base/rinkj/rinkj-epson870.c342
-rw-r--r--gs/base/rinkj/rinkj-epson870.h2
-rw-r--r--gs/base/rinkj/rinkj-screen-eb.c114
-rw-r--r--gs/base/rinkj/rinkj-screen-eb.h2
-rw-r--r--gs/base/sa85d.c244
-rw-r--r--gs/base/sa85d.h2
-rw-r--r--gs/base/sa85x.h2
-rw-r--r--gs/base/saes.c42
-rw-r--r--gs/base/saes.h2
-rw-r--r--gs/base/sarc4.c45
-rw-r--r--gs/base/sarc4.h4
-rw-r--r--gs/base/sbcp.c222
-rw-r--r--gs/base/sbcp.h2
-rw-r--r--gs/base/sbhc.c214
-rw-r--r--gs/base/sbhc.h24
-rw-r--r--gs/base/sbtx.h2
-rw-r--r--gs/base/sbwbs.c312
-rw-r--r--gs/base/sbwbs.h26
-rw-r--r--gs/base/scanchar.h2
-rw-r--r--gs/base/scantab.c18
-rw-r--r--gs/base/scf.h148
-rw-r--r--gs/base/scfd.c840
-rw-r--r--gs/base/scfdgen.c98
-rw-r--r--gs/base/scfdtab.c1810
-rw-r--r--gs/base/scfe.c530
-rw-r--r--gs/base/scfetab.c110
-rw-r--r--gs/base/scfparam.c28
-rw-r--r--gs/base/scfx.h70
-rw-r--r--gs/base/scommon.h10
-rw-r--r--gs/base/sdcparam.c592
-rw-r--r--gs/base/sdcparam.h24
-rw-r--r--gs/base/sdct.h26
-rw-r--r--gs/base/sdctd.c306
-rw-r--r--gs/base/sdcte.c210
-rw-r--r--gs/base/sddparam.c16
-rw-r--r--gs/base/sdeparam.c258
-rw-r--r--gs/base/seexec.c176
-rw-r--r--gs/base/setjmp_.h4
-rw-r--r--gs/base/sfilter.h6
-rw-r--r--gs/base/sfilter2.c296
-rw-r--r--gs/base/sfxboth.c2
-rw-r--r--gs/base/sfxcommon.c90
-rw-r--r--gs/base/sfxfd.c158
-rw-r--r--gs/base/sfxstdio.c156
-rw-r--r--gs/base/sha2.c1375
-rw-r--r--gs/base/sha2.h35
-rw-r--r--gs/base/shc.c30
-rw-r--r--gs/base/shc.h54
-rw-r--r--gs/base/shcgen.c354
-rw-r--r--gs/base/shcgen.h4
-rw-r--r--gs/base/sidscale.c323
-rw-r--r--gs/base/sidscale.h2
-rw-r--r--gs/base/siinterp.c216
-rw-r--r--gs/base/siinterp.h2
-rw-r--r--gs/base/simscale.c178
-rw-r--r--gs/base/simscale.h2
-rw-r--r--gs/base/siscale.c3
-rw-r--r--gs/base/siscale.h2
-rw-r--r--gs/base/sisparam.h6
-rw-r--r--gs/base/sjbig2.c63
-rw-r--r--gs/base/sjbig2.h6
-rw-r--r--gs/base/sjbig2_luratech.c344
-rw-r--r--gs/base/sjbig2_luratech.h11
-rw-r--r--gs/base/sjpeg.h16
-rw-r--r--gs/base/sjpegc.c55
-rw-r--r--gs/base/sjpegd.c20
-rw-r--r--gs/base/sjpege.c36
-rw-r--r--gs/base/sjpx.c9
-rw-r--r--gs/base/sjpx_luratech.c21
-rw-r--r--gs/base/sjpx_luratech.h4
-rw-r--r--gs/base/slzwc.c2
-rw-r--r--gs/base/slzwd.c436
-rw-r--r--gs/base/slzwe.c228
-rw-r--r--gs/base/slzwx.h14
-rw-r--r--gs/base/smd5.c38
-rw-r--r--gs/base/smd5.h4
-rw-r--r--gs/base/smtf.c142
-rw-r--r--gs/base/smtf.h6
-rw-r--r--gs/base/spdiff.c656
-rw-r--r--gs/base/spdiffx.h2
-rw-r--r--gs/base/spngp.c370
-rw-r--r--gs/base/spngpx.h8
-rw-r--r--gs/base/spprint.c36
-rw-r--r--gs/base/spprint.h20
-rw-r--r--gs/base/spsdf.c242
-rw-r--r--gs/base/spsdf.h8
-rw-r--r--gs/base/srdline.h8
-rw-r--r--gs/base/srld.c104
-rw-r--r--gs/base/srle.c212
-rw-r--r--gs/base/srlx.h6
-rw-r--r--gs/base/ssha2.c22
-rw-r--r--gs/base/sstring.c456
-rw-r--r--gs/base/sstring.h2
-rw-r--r--gs/base/stat_.h2
-rw-r--r--gs/base/std.h1
-rw-r--r--gs/base/stdint_.h4
-rw-r--r--gs/base/stdio_.h2
-rw-r--r--gs/base/stdpn.h2
-rw-r--r--gs/base/stdpre.h8
-rw-r--r--gs/base/stream.c869
-rw-r--r--gs/base/stream.h40
-rw-r--r--gs/base/strimpl.h2
-rw-r--r--gs/base/string_.h4
-rw-r--r--gs/base/strmio.h4
-rw-r--r--gs/base/szlibc.c48
-rw-r--r--gs/base/szlibe.c30
-rw-r--r--gs/base/szlibx.h2
-rw-r--r--gs/base/szlibxx.h2
-rw-r--r--gs/base/time_.h13
-rw-r--r--gs/base/ttcalc.c17
-rw-r--r--gs/base/ttcalc.h7
-rw-r--r--gs/base/ttcommon.h3
-rw-r--r--gs/base/ttconf.h3
-rw-r--r--gs/base/ttconfig.h23
-rw-r--r--gs/base/ttfinp.c24
-rw-r--r--gs/base/ttfinp.h2
-rw-r--r--gs/base/ttfmain.c991
-rw-r--r--gs/base/ttfmemd.c16
-rw-r--r--gs/base/ttfmemd.h2
-rw-r--r--gs/base/ttfoutl.h32
-rw-r--r--gs/base/ttfsfnt.h329
-rw-r--r--gs/base/ttinterp.c304
-rw-r--r--gs/base/ttinterp.h8
-rw-r--r--gs/base/ttload.c21
-rw-r--r--gs/base/ttload.h20
-rw-r--r--gs/base/ttmisc.h2
-rw-r--r--gs/base/ttobjs.c65
-rw-r--r--gs/base/ttobjs.h82
-rw-r--r--gs/base/tttables.h17
-rw-r--r--gs/base/tttype.h89
-rw-r--r--gs/base/tttypes.h16
-rw-r--r--gs/base/unistd_.h7
-rw-r--r--[-rwxr-xr-x]gs/base/valgrind.h2
-rw-r--r--gs/base/vdtrace.c12
-rw-r--r--gs/base/vdtrace.h18
-rw-r--r--gs/base/vms_x_fix.h5
-rw-r--r--gs/base/vmsmath.h2
-rw-r--r--gs/base/whitelst.c72
-rw-r--r--gs/base/whitelst.h2
-rw-r--r--gs/base/windows_.h8
-rw-r--r--gs/base/wtsimdi.c53
-rw-r--r--gs/base/x_.h4
-rw-r--r--gs/contrib/defs.h7
-rw-r--r--gs/contrib/eplaser/gdevescv.c1296
-rw-r--r--gs/contrib/eplaser/gdevescv.h6
-rw-r--r--gs/contrib/gdevbjc_.c368
-rw-r--r--gs/contrib/gdevbjc_.h33
-rw-r--r--gs/contrib/gdevbjca.c135
-rw-r--r--gs/contrib/gdevcd8.c2488
-rw-r--r--gs/contrib/gdevdj9.c3396
-rw-r--r--gs/contrib/gdevgdi.c510
-rw-r--r--gs/contrib/gdevhl12.c497
-rw-r--r--gs/contrib/gdevln03.c106
-rw-r--r--gs/contrib/gdevlx32.c5535
-rw-r--r--gs/contrib/gdevlx50.c2515
-rw-r--r--gs/contrib/gdevlx7.c489
-rw-r--r--gs/contrib/gdevmd2k.c579
-rw-r--r--gs/contrib/gdevop4w.c476
-rw-r--r--gs/contrib/gdevxes.c154
-rw-r--r--gs/contrib/gomni.c20
-rw-r--r--gs/contrib/japanese/dviprlib.c709
-rw-r--r--gs/contrib/japanese/dviprlib.h56
-rw-r--r--gs/contrib/japanese/gdev10v.c400
-rw-r--r--gs/contrib/japanese/gdevalps.c400
-rw-r--r--gs/contrib/japanese/gdevdmpr.c173
-rw-r--r--gs/contrib/japanese/gdevespg.c108
-rw-r--r--gs/contrib/japanese/gdevfmlbp.c103
-rw-r--r--gs/contrib/japanese/gdevfmpr.c42
-rw-r--r--gs/contrib/japanese/gdevj100.c302
-rw-r--r--gs/contrib/japanese/gdevlbp3.c418
-rw-r--r--gs/contrib/japanese/gdevmag.c28
-rw-r--r--gs/contrib/japanese/gdevmjc.c1448
-rw-r--r--gs/contrib/japanese/gdevmjc.h6372
-rw-r--r--gs/contrib/japanese/gdevml6.c453
-rw-r--r--gs/contrib/japanese/gdevnpdl.c568
-rw-r--r--gs/contrib/japanese/gdevp201.c415
-rw-r--r--gs/contrib/japanese/gdevrpdl.c78
-rw-r--r--gs/contrib/lips4/gdevl4r.c1296
-rw-r--r--gs/contrib/lips4/gdevl4v.c2355
-rw-r--r--gs/contrib/lips4/gdevlips.c133
-rw-r--r--gs/contrib/lips4/gdevlips.h4
-rw-r--r--gs/contrib/lips4/gdevlprn.c265
-rw-r--r--gs/contrib/lips4/gdevlprn.h34
-rw-r--r--gs/contrib/opvp/gdevopvp.c31
-rw-r--r--gs/contrib/opvp/opvp.h279
-rw-r--r--gs/contrib/opvp/opvp_0_2_0.h297
-rw-r--r--gs/contrib/opvp/opvp_common.h1
-rw-r--r--gs/contrib/pcl3/eprn/eprnfs.c86
-rw-r--r--gs/contrib/pcl3/eprn/eprnparm.c1
-rw-r--r--gs/contrib/pcl3/eprn/eprnrend.c150
-rw-r--r--gs/contrib/pcl3/eprn/gdeveprn.h91
-rw-r--r--gs/contrib/pcl3/eprn/mediasize.c18
-rw-r--r--gs/contrib/pcl3/eprn/mediasize.h3
-rw-r--r--gs/contrib/pcl3/eprn/pagecount.c22
-rw-r--r--gs/contrib/pcl3/ps/calign.ps2
-rw-r--r--gs/contrib/pcl3/ps/levels-test.ps32
-rw-r--r--gs/contrib/pcl3/src/pcl3opts.c354
-rw-r--r--gs/contrib/pcl3/src/pclcap.c192
-rw-r--r--gs/contrib/pcl3/src/pclcomp.c39
-rw-r--r--gs/contrib/pcl3/src/pclgen.c496
-rw-r--r--gs/contrib/pcl3/src/pclgen.h135
-rw-r--r--gs/contrib/pcl3/src/pclscan.c230
-rw-r--r--gs/contrib/pcl3/src/pclscan.h22
-rw-r--r--gs/contrib/pcl3/src/pclsize.c6
-rw-r--r--gs/contrib/pcl3/src/pclsize.h2
-rw-r--r--gs/contrib/pscolor/black.ps5
-rw-r--r--gs/contrib/pscolor/color.ps5
-rw-r--r--gs/contrib/pscolor/input.ps22
-rw-r--r--gs/contrib/pscolor/test.c184
-rw-r--r--gs/icclib/icc.c20537
-rw-r--r--gs/icclib/icc.h978
-rw-r--r--gs/icclib/icc9809.h195
-rw-r--r--gs/ijs/ijs.c20
-rw-r--r--gs/ijs/ijs_client.c22
-rw-r--r--gs/ijs/ijs_client.h20
-rw-r--r--gs/ijs/ijs_client_example.c247
-rw-r--r--gs/ijs/ijs_exec_unix.c9
-rw-r--r--gs/ijs/ijs_exec_win.c110
-rw-r--r--gs/ijs/ijs_server.c104
-rw-r--r--gs/ijs/ijs_server.h66
-rw-r--r--gs/ijs/ijs_server_example.c240
-rw-r--r--gs/ijs/ijs_spec.ps50
-rw-r--r--gs/imdi/arch.h34
-rw-r--r--gs/imdi/cctiff.c2114
-rw-r--r--gs/imdi/cgen.c3197
-rw-r--r--gs/imdi/config.h2
-rw-r--r--gs/imdi/copyright.h3
-rw-r--r--gs/imdi/imdi.c285
-rw-r--r--gs/imdi/imdi.h52
-rw-r--r--gs/imdi/imdi_gen.c1010
-rw-r--r--gs/imdi/imdi_gen.h79
-rw-r--r--gs/imdi/imdi_imp.h286
-rw-r--r--gs/imdi/imdi_k.c69547
-rw-r--r--gs/imdi/imdi_k.h301
-rw-r--r--gs/imdi/imdi_tab.c983
-rw-r--r--gs/imdi/imdi_tab.h136
-rw-r--r--gs/lib/EndOfTask.ps2
-rw-r--r--gs/lib/PDFA_def.ps4
-rw-r--r--gs/lib/PDFX_def.ps4
-rw-r--r--gs/lib/acctest.ps6
-rw-r--r--gs/lib/addxchar.ps66
-rw-r--r--gs/lib/align.ps6
-rw-r--r--gs/lib/bdftops.ps416
-rw-r--r--gs/lib/caption.ps10
-rw-r--r--gs/lib/cat.ps98
-rw-r--r--gs/lib/cid2code.ps36
-rw-r--r--gs/lib/docie.ps44
-rw-r--r--gs/lib/dumphint.ps55
-rw-r--r--gs/lib/font2c.ps178
-rw-r--r--gs/lib/font2pcl.ps240
-rw-r--r--gs/lib/gs_ce_e.ps6
-rw-r--r--gs/lib/gs_cmdl.ps56
-rw-r--r--gs/lib/gs_fform.ps30
-rw-r--r--gs/lib/gs_il2_e.ps6
-rw-r--r--gs/lib/gs_kanji.ps72
-rw-r--r--gs/lib/gs_ksb_e.ps6
-rw-r--r--gs/lib/gs_lgo_e.ps6
-rw-r--r--gs/lib/gs_lgx_e.ps6
-rw-r--r--gs/lib/gs_pfile.ps50
-rw-r--r--gs/lib/gs_rdlin.ps6
-rw-r--r--gs/lib/gs_wl1_e.ps38
-rw-r--r--gs/lib/gs_wl2_e.ps38
-rw-r--r--gs/lib/gs_wl5_e.ps38
-rw-r--r--gs/lib/gslp.ps104
-rw-r--r--gs/lib/gsnup.ps16
-rw-r--r--gs/lib/image-qa.ps462
-rw-r--r--gs/lib/impath.ps20
-rw-r--r--gs/lib/jispaper.ps6
-rw-r--r--gs/lib/landscap.ps6
-rw-r--r--gs/lib/lines.ps18
-rw-r--r--gs/lib/markhint.ps12
-rw-r--r--gs/lib/markpath.ps8
-rw-r--r--gs/lib/mkcidfm.ps42
-rw-r--r--gs/lib/opdfread.ps418
-rw-r--r--gs/lib/packfile.ps78
-rw-r--r--gs/lib/pcharstr.ps14
-rw-r--r--gs/lib/pdf2dsc.ps22
-rw-r--r--gs/lib/pdfopt.ps373
-rw-r--r--gs/lib/pdfwrite.ps36
-rw-r--r--gs/lib/pf2afm.ps3
-rw-r--r--gs/lib/pfbtopfa.ps6
-rw-r--r--gs/lib/ppath.ps6
-rw-r--r--gs/lib/pphs.ps24
-rw-r--r--gs/lib/prfont.ps58
-rw-r--r--gs/lib/printafm.ps232
-rw-r--r--gs/lib/ps2ai.ps54
-rw-r--r--gs/lib/ps2ascii.ps168
-rw-r--r--gs/lib/ps2epsi.ps123
-rw-r--r--gs/lib/rollconv.ps59
-rw-r--r--gs/lib/showchar.ps10
-rw-r--r--gs/lib/stcinfo.ps104
-rw-r--r--gs/lib/stcolor.ps35
-rw-r--r--gs/lib/stocht.ps6
-rw-r--r--gs/lib/traceimg.ps6
-rw-r--r--gs/lib/traceop.ps8
-rw-r--r--gs/lib/type1enc.ps8
-rw-r--r--gs/lib/type1ops.ps16
-rw-r--r--gs/lib/uninfo.ps24
-rw-r--r--gs/lib/unprot.ps6
-rw-r--r--gs/lib/viewcmyk.ps12
-rw-r--r--gs/lib/viewgif.ps64
-rw-r--r--gs/lib/viewjpeg.ps72
-rw-r--r--gs/lib/viewmiff.ps58
-rw-r--r--gs/lib/viewpbm.ps38
-rw-r--r--gs/lib/viewpcx.ps48
-rw-r--r--gs/lib/viewps2a.ps6
-rw-r--r--[-rwxr-xr-x]gs/lib/viewrgb.ps96
-rw-r--r--gs/lib/wftopfa.ps24
-rw-r--r--gs/lib/winmaps.ps8
-rw-r--r--gs/lib/wrfont.ps262
-rw-r--r--gs/lib/zeroline.ps6
-rw-r--r--gs/psi/bfont.h32
-rw-r--r--gs/psi/btoken.h6
-rw-r--r--gs/psi/dmmain.c43
-rw-r--r--gs/psi/dpmain.c992
-rw-r--r--gs/psi/dscparse.c5205
-rw-r--r--gs/psi/dscparse.h61
-rw-r--r--gs/psi/dstack.h70
-rw-r--r--gs/psi/dwdll.c144
-rw-r--r--gs/psi/dwdll.h24
-rw-r--r--gs/psi/dwimg.c1978
-rw-r--r--gs/psi/dwimg.h2
-rw-r--r--gs/psi/dwinst.h132
-rw-r--r--gs/psi/dwmain.c240
-rw-r--r--gs/psi/dwmainc.c241
-rw-r--r--gs/psi/dwnodll.c2
-rw-r--r--gs/psi/dwreg.c53
-rw-r--r--gs/psi/dwreg.h2
-rw-r--r--gs/psi/dwres.h2
-rw-r--r--gs/psi/dwsetup.h5
-rw-r--r--gs/psi/dwtext.c1163
-rw-r--r--gs/psi/dwtext.h8
-rw-r--r--gs/psi/dwtrace.c157
-rw-r--r--gs/psi/dwtrace.h2
-rw-r--r--gs/psi/dwuninst.h4
-rw-r--r--gs/psi/dxmain.c1291
-rw-r--r--gs/psi/dxmainc.c47
-rw-r--r--gs/psi/estack.h2
-rw-r--r--gs/psi/fapi_ft.c132
-rw-r--r--gs/psi/fapibstm.c133
-rw-r--r--gs/psi/fapiufst.c567
-rw-r--r--gs/psi/files.h58
-rw-r--r--gs/psi/ghost.h2
-rw-r--r--gs/psi/gs.c80
-rw-r--r--gs/psi/gsdll.c38
-rw-r--r--gs/psi/gserver.c92
-rw-r--r--gs/psi/ialloc.c314
-rw-r--r--gs/psi/ialloc.h2
-rw-r--r--gs/psi/iapi.c153
-rw-r--r--gs/psi/iapi.h75
-rw-r--r--gs/psi/iastate.h2
-rw-r--r--gs/psi/iastruct.h2
-rw-r--r--gs/psi/ibnum.c212
-rw-r--r--gs/psi/ibnum.h2
-rw-r--r--gs/psi/ichar.h2
-rw-r--r--gs/psi/ichar1.h16
-rw-r--r--gs/psi/icharout.h16
-rw-r--r--gs/psi/icid.h10
-rw-r--r--gs/psi/icie.h66
-rw-r--r--gs/psi/icolor.h4
-rw-r--r--gs/psi/iconf.c8
-rw-r--r--gs/psi/iconf.h2
-rw-r--r--gs/psi/icontext.c154
-rw-r--r--gs/psi/icontext.h6
-rw-r--r--gs/psi/icremap.h2
-rw-r--r--gs/psi/icsmap.h8
-rw-r--r--gs/psi/icstate.h5
-rw-r--r--gs/psi/iddict.h2
-rw-r--r--gs/psi/iddstack.h2
-rw-r--r--gs/psi/idebug.c312
-rw-r--r--gs/psi/idebug.h10
-rw-r--r--gs/psi/idict.c816
-rw-r--r--gs/psi/idict.h14
-rw-r--r--gs/psi/idictdef.h4
-rw-r--r--gs/psi/idicttpl.h42
-rw-r--r--gs/psi/idisp.c62
-rw-r--r--gs/psi/idisp.h3
-rw-r--r--gs/psi/idosave.h6
-rw-r--r--gs/psi/idparam.c352
-rw-r--r--gs/psi/idparam.h52
-rw-r--r--gs/psi/idsdata.h2
-rw-r--r--gs/psi/idstack.c238
-rw-r--r--gs/psi/idstack.h8
-rw-r--r--gs/psi/ierrors.h10
-rw-r--r--gs/psi/iesdata.h2
-rw-r--r--gs/psi/iestack.h2
-rw-r--r--gs/psi/ifapi.h39
-rw-r--r--gs/psi/ifcid.h6
-rw-r--r--gs/psi/ifilter.h38
-rw-r--r--gs/psi/ifilter2.h2
-rw-r--r--gs/psi/ifont.h40
-rw-r--r--gs/psi/ifont1.h20
-rw-r--r--gs/psi/ifont2.h4
-rw-r--r--gs/psi/ifont42.h10
-rw-r--r--gs/psi/ifrpred.h6
-rw-r--r--gs/psi/ifunc.h11
-rw-r--r--gs/psi/ifwpred.h6
-rw-r--r--gs/psi/igc.c1237
-rw-r--r--gs/psi/igc.h8
-rw-r--r--gs/psi/igcref.c826
-rw-r--r--gs/psi/igcstr.c452
-rw-r--r--gs/psi/igcstr.h2
-rw-r--r--gs/psi/igstate.h34
-rw-r--r--gs/psi/iht.h6
-rw-r--r--gs/psi/iimage.h6
-rw-r--r--gs/psi/iimage2.h2
-rw-r--r--gs/psi/iinit.c1
-rw-r--r--gs/psi/iinit.h2
-rw-r--r--gs/psi/ilevel.h2
-rw-r--r--gs/psi/ilocate.c586
-rw-r--r--gs/psi/imain.c2
-rw-r--r--gs/psi/imain.h45
-rw-r--r--gs/psi/imainarg.h2
-rw-r--r--gs/psi/imemory.h25
-rw-r--r--gs/psi/iminst.h4
-rw-r--r--gs/psi/iname.c448
-rw-r--r--gs/psi/iname.h3
-rw-r--r--gs/psi/inamedef.h28
-rw-r--r--gs/psi/inameidx.h4
-rw-r--r--gs/psi/inames.h4
-rw-r--r--gs/psi/inamestr.h4
-rw-r--r--gs/psi/inobtokn.c2
-rw-r--r--gs/psi/inouparm.c2
-rw-r--r--gs/psi/interp.h10
-rw-r--r--gs/psi/iosdata.h2
-rw-r--r--gs/psi/iostack.h2
-rw-r--r--gs/psi/ipacked.h2
-rw-r--r--gs/psi/iparam.c802
-rw-r--r--gs/psi/iparam.h26
-rw-r--r--gs/psi/iparray.h4
-rw-r--r--gs/psi/ipcolor.h4
-rw-r--r--gs/psi/iplugin.c2
-rw-r--r--gs/psi/iplugin.h2
-rw-r--r--gs/psi/ireclaim.c126
-rw-r--r--gs/psi/iref.h56
-rw-r--r--gs/psi/isave.c1095
-rw-r--r--gs/psi/isave.h3
-rw-r--r--gs/psi/iscanbin.c1112
-rw-r--r--gs/psi/iscanbin.h2
-rw-r--r--gs/psi/iscannum.c442
-rw-r--r--gs/psi/iscannum.h4
-rw-r--r--gs/psi/isdata.h8
-rw-r--r--gs/psi/isstate.h2
-rw-r--r--gs/psi/istack.c370
-rw-r--r--gs/psi/istack.h16
-rw-r--r--gs/psi/istkparm.h4
-rw-r--r--gs/psi/istream.h12
-rw-r--r--gs/psi/istruct.h2
-rw-r--r--gs/psi/iutil.c970
-rw-r--r--gs/psi/iutil.h12
-rw-r--r--gs/psi/iutil2.c80
-rw-r--r--gs/psi/iutil2.h2
-rw-r--r--gs/psi/ivmem2.h2
-rw-r--r--gs/psi/ivmspace.h2
-rw-r--r--gs/psi/main.h10
-rw-r--r--gs/psi/oparc.h2
-rw-r--r--gs/psi/opcheck.h2
-rw-r--r--gs/psi/opdef.h2
-rw-r--r--gs/psi/oper.h4
-rw-r--r--gs/psi/opextern.h2
-rw-r--r--gs/psi/ostack.h2
-rw-r--r--gs/psi/sfilter1.c378
-rw-r--r--gs/psi/store.h32
-rw-r--r--gs/psi/wrfont.c82
-rw-r--r--gs/psi/wrfont.h16
-rw-r--r--gs/psi/write_t1.c553
-rw-r--r--gs/psi/write_t1.h2
-rw-r--r--gs/psi/write_t2.c778
-rw-r--r--gs/psi/write_t2.h2
-rw-r--r--gs/psi/zalg.c152
-rw-r--r--gs/psi/zarith.c302
-rw-r--r--gs/psi/zarray.c76
-rw-r--r--gs/psi/zbfont.c757
-rw-r--r--gs/psi/zbseq.c24
-rw-r--r--gs/psi/zcfont.c132
-rw-r--r--gs/psi/zchar.c639
-rw-r--r--gs/psi/zchar1.c929
-rw-r--r--gs/psi/zchar2.c2
-rw-r--r--gs/psi/zchar32.c140
-rw-r--r--gs/psi/zchar42.c188
-rw-r--r--gs/psi/zchar42.h6
-rw-r--r--gs/psi/zcharout.c364
-rw-r--r--gs/psi/zcharx.c108
-rw-r--r--gs/psi/zcid.c200
-rw-r--r--gs/psi/zcidtest.c74
-rw-r--r--gs/psi/zcie.c450
-rw-r--r--gs/psi/zcie.h2
-rw-r--r--gs/psi/zcolor.c5773
-rw-r--r--gs/psi/zcolor.h79
-rw-r--r--gs/psi/zcolor1.c57
-rw-r--r--gs/psi/zcolor2.c4
-rw-r--r--gs/psi/zcolor3.c7
-rw-r--r--gs/psi/zcontext.c751
-rw-r--r--gs/psi/zcontrol.c430
-rw-r--r--gs/psi/zcrd.c282
-rw-r--r--gs/psi/zcsdevn.c2
-rw-r--r--gs/psi/zcsindex.c11
-rw-r--r--gs/psi/zcspixel.c3
-rw-r--r--gs/psi/zcssepr.c4
-rw-r--r--gs/psi/zdevcal.c34
-rw-r--r--gs/psi/zdevice.c226
-rw-r--r--gs/psi/zdevice2.c140
-rw-r--r--gs/psi/zdfilter.c2
-rw-r--r--gs/psi/zdict.c234
-rw-r--r--gs/psi/zdosio.c2
-rw-r--r--gs/psi/zdouble.c140
-rw-r--r--gs/psi/zdpnext.c234
-rw-r--r--gs/psi/zdps.c228
-rw-r--r--gs/psi/zdps1.c178
-rw-r--r--gs/psi/zdscpars.c83
-rw-r--r--gs/psi/zfaes.c6
-rw-r--r--gs/psi/zfapi.c137
-rw-r--r--gs/psi/zfarc4.c14
-rw-r--r--gs/psi/zfbcp.c2
-rw-r--r--gs/psi/zfcid.c32
-rw-r--r--gs/psi/zfcid0.c507
-rw-r--r--gs/psi/zfcid1.c494
-rw-r--r--gs/psi/zfcmap.c405
-rw-r--r--gs/psi/zfdctd.c22
-rw-r--r--gs/psi/zfdcte.c36
-rw-r--r--gs/psi/zfdecode.c234
-rw-r--r--gs/psi/zfile.c9
-rw-r--r--gs/psi/zfile.h2
-rw-r--r--gs/psi/zfile1.c31
-rw-r--r--gs/psi/zfileio.c487
-rw-r--r--gs/psi/zfilter.c285
-rw-r--r--gs/psi/zfilter2.c120
-rw-r--r--gs/psi/zfilterx.c154
-rw-r--r--gs/psi/zfimscale.c10
-rw-r--r--gs/psi/zfjbig2.c86
-rw-r--r--gs/psi/zfjpx.c129
-rw-r--r--gs/psi/zfmd5.c2
-rw-r--r--gs/psi/zfont.c371
-rw-r--r--gs/psi/zfont0.c294
-rw-r--r--gs/psi/zfont1.c153
-rw-r--r--gs/psi/zfont2.c946
-rw-r--r--gs/psi/zfont32.c13
-rw-r--r--gs/psi/zfont42.c263
-rw-r--r--gs/psi/zfontenum.c122
-rw-r--r--gs/psi/zfproc.c152
-rw-r--r--gs/psi/zfrsd.c246
-rw-r--r--gs/psi/zfrsd.h4
-rw-r--r--gs/psi/zfsample.c358
-rw-r--r--gs/psi/zfunc.c266
-rw-r--r--gs/psi/zfunc.h2
-rw-r--r--gs/psi/zfunc0.c72
-rw-r--r--gs/psi/zfunc3.c118
-rw-r--r--gs/psi/zfunc4.c326
-rw-r--r--gs/psi/zfzlib.c12
-rw-r--r--gs/psi/zgeneric.c554
-rw-r--r--gs/psi/zgstate.c62
-rw-r--r--gs/psi/zhsb.c8
-rw-r--r--gs/psi/zht.c128
-rw-r--r--gs/psi/zht1.c80
-rw-r--r--gs/psi/zht2.c556
-rw-r--r--gs/psi/zht2.h10
-rw-r--r--gs/psi/zicc.c91
-rw-r--r--gs/psi/zicc.h4
-rw-r--r--gs/psi/zimage.c497
-rw-r--r--gs/psi/zimage2.c7
-rw-r--r--gs/psi/zimage3.c86
-rw-r--r--gs/psi/ziodev2.c42
-rw-r--r--gs/psi/ziodevs.c142
-rw-r--r--gs/psi/ziodevsc.c208
-rw-r--r--gs/psi/zmath.c54
-rw-r--r--gs/psi/zmatrix.c216
-rw-r--r--gs/psi/zmedia2.c546
-rw-r--r--gs/psi/zmisc.c318
-rw-r--r--gs/psi/zmisc1.c98
-rw-r--r--gs/psi/zmisc2.c246
-rw-r--r--gs/psi/zmisc3.c94
-rw-r--r--gs/psi/zncdummy.c2
-rw-r--r--gs/psi/zpacked.c250
-rw-r--r--gs/psi/zpaint.c12
-rw-r--r--gs/psi/zpath.c20
-rw-r--r--gs/psi/zpath1.c76
-rw-r--r--gs/psi/zpcolor.c196
-rw-r--r--gs/psi/zpdfops.c54
-rw-r--r--gs/psi/zrelbit.c168
-rw-r--r--gs/psi/zrop.c4
-rw-r--r--gs/psi/zshade.c502
-rw-r--r--gs/psi/zstack.c218
-rw-r--r--gs/psi/zstring.c72
-rw-r--r--gs/psi/zsysvm.c2
-rw-r--r--gs/psi/ztrans.c168
-rw-r--r--gs/psi/ztrap.c6
-rw-r--r--gs/psi/zupath.c600
-rw-r--r--gs/psi/zusparam.c376
-rw-r--r--gs/psi/zutf8.c38
-rw-r--r--gs/psi/zvmem.c378
-rw-r--r--gs/psi/zvmem2.c32
-rw-r--r--gs/psi/zwinutf8.c14
-rw-r--r--gs/toolbin/GenSubstCID.psbin5845 -> 5818 bytes
-rw-r--r--gs/toolbin/bmpcmp.c3
-rw-r--r--gs/toolbin/color/halftone/halfttoning/halftone.c436
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/CIELAB.h3
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h16
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h27
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/icc34.h204
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/icc_create.h7
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/resource.h2
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/stdafx.h13
-rw-r--r--gs/toolbin/color/icc_creator/ICC_Creator/targetver.h6
-rw-r--r--gs/toolbin/drawafm.ps12
-rw-r--r--gs/toolbin/encs2c.ps23
-rw-r--r--gs/toolbin/extractFonts.ps99
-rw-r--r--gs/toolbin/extractICCprofiles.ps80
-rw-r--r--gs/toolbin/genfontmap.ps10
-rw-r--r--gs/toolbin/jpxtopdf.c229
-rw-r--r--gs/toolbin/pdf_info.ps53
-rw-r--r--gs/toolbin/pdfinflt.ps186
-rw-r--r--gs/toolbin/tests/fuzzy.c286
-rw-r--r--pcl/pcbiptrn.c61
-rw-r--r--pcl/pccid.c44
-rw-r--r--pcl/pccolor.c22
-rw-r--r--pcl/pccprint.c10
-rw-r--r--pcl/pccrd.c10
-rw-r--r--pcl/pccrd.h12
-rw-r--r--pcl/pccsbase.c23
-rw-r--r--pcl/pccsbase.h2
-rw-r--r--pcl/pcdict.h1
-rw-r--r--pcl/pcdraw.c4
-rw-r--r--pcl/pcfont.c697
-rw-r--r--pcl/pcfont.h2
-rw-r--r--pcl/pcfontpg.c30
-rw-r--r--pcl/pcfrgrnd.c53
-rw-r--r--pcl/pcfrgrnd.h14
-rw-r--r--pcl/pcfsel.c420
-rw-r--r--pcl/pcfsel.h6
-rw-r--r--pcl/pcht.c214
-rw-r--r--pcl/pcht.h14
-rw-r--r--pcl/pcimpl.c5
-rw-r--r--pcl/pcindxed.c32
-rw-r--r--pcl/pcindxed.h7
-rw-r--r--pcl/pcjob.c270
-rw-r--r--pcl/pclookup.c4
-rw-r--r--pcl/pclookup.h2
-rw-r--r--pcl/pcmacros.c334
-rw-r--r--pcl/pcmisc.c34
-rw-r--r--pcl/pcmtx3.c2
-rw-r--r--pcl/pcmtx3.h17
-rw-r--r--pcl/pcommand.c1
-rw-r--r--pcl/pcommand.h14
-rw-r--r--pcl/pcpage.c7
-rw-r--r--pcl/pcpalet.c179
-rw-r--r--pcl/pcpalet.h9
-rw-r--r--pcl/pcparse.c936
-rw-r--r--pcl/pcparse.h8
-rw-r--r--pcl/pcpatrn.c141
-rw-r--r--pcl/pcpatrn.h154
-rw-r--r--pcl/pcpattyp.h1
-rw-r--r--pcl/pcpatxfm.c16
-rw-r--r--pcl/pcpatxfm.h7
-rw-r--r--pcl/pcrect.c34
-rw-r--r--pcl/pcsfont.c75
-rw-r--r--pcl/pcstate.h28
-rw-r--r--pcl/pcstatus.c979
-rw-r--r--pcl/pcsymbol.c450
-rw-r--r--pcl/pcsymbol.h2
-rw-r--r--pcl/pctext.c229
-rw-r--r--pcl/pctop.c302
-rw-r--r--pcl/pctop.h1
-rw-r--r--pcl/pctpm.h4
-rw-r--r--pcl/pcuptrn.c36
-rw-r--r--pcl/pcursor.c5
-rw-r--r--pcl/pcwhtidx.c6
-rw-r--r--pcl/pcxfmst.h6
-rw-r--r--pcl/pgchar.c582
-rw-r--r--pcl/pgcolor.c22
-rw-r--r--pcl/pgconfig.c758
-rw-r--r--pcl/pgdraw.c1480
-rw-r--r--pcl/pgdraw.h14
-rw-r--r--pcl/pgfdata.c93
-rw-r--r--pcl/pgfdata.h2
-rw-r--r--pcl/pgfont.c108
-rw-r--r--pcl/pgframe.c161
-rw-r--r--pcl/pggeom.c102
-rw-r--r--pcl/pggeom.h20
-rw-r--r--pcl/pglabel.c1024
-rw-r--r--pcl/pglfill.c522
-rw-r--r--pcl/pgmisc.c32
-rw-r--r--pcl/pgmisc.h4
-rw-r--r--pcl/pgparse.c524
-rw-r--r--pcl/pgpoly.c383
-rw-r--r--pcl/pgstate.h332
-rw-r--r--pcl/rtgmode.c105
-rw-r--r--pcl/rtgmode.h1
-rw-r--r--pcl/rtmisc.c76
-rw-r--r--pcl/rtraster.c155
-rw-r--r--pcl/rtrstcmp.c10
-rw-r--r--pcl/rtrstcmp.h4
-rw-r--r--pcl/rtrstst.h10
-rw-r--r--pl/dwimg.c1976
-rw-r--r--pl/dwimg.h2
-rw-r--r--pl/dwmainc.c232
-rw-r--r--pl/dwreg.c53
-rw-r--r--pl/dwreg.h2
-rw-r--r--pl/dwres.h2
-rw-r--r--pl/pjparse.c852
-rw-r--r--pl/pjparse.h12
-rw-r--r--pl/pjparsei.c164
-rw-r--r--pl/pjtop.c40
-rw-r--r--pl/pjtop.h17
-rw-r--r--pl/plalloc.c4
-rw-r--r--pl/plalloc.h2
-rw-r--r--pl/plapi.h15
-rw-r--r--pl/plchar.c357
-rw-r--r--pl/pldict.c256
-rw-r--r--pl/pldict.h4
-rw-r--r--pl/pldraw.c14
-rw-r--r--pl/plfont.c916
-rw-r--r--pl/plfont.h22
-rw-r--r--pl/plftable.c97
-rw-r--r--pl/plht.c2
-rw-r--r--pl/plimpl.c14
-rw-r--r--pl/pllfont.c4
-rw-r--r--pl/plmain.c105
-rw-r--r--pl/plplatf.c4
-rw-r--r--pl/plplatf.h2
-rw-r--r--pl/plplatfps.c4
-rw-r--r--pl/plsrgb.c54
-rw-r--r--pl/plsymbol.c22
-rw-r--r--pl/plsymbol.h4
-rw-r--r--pl/pltop.c105
-rw-r--r--pl/pltop.h11
-rw-r--r--pl/pltoputl.c70
-rw-r--r--pl/pltoputl.h8
-rw-r--r--pl/pluchar.c43
-rw-r--r--pl/plufont.c14
-rw-r--r--pl/plulfont.c45
-rw-r--r--pl/plvocab.c12
-rw-r--r--[-rwxr-xr-x]psi/psitop.c297
-rw-r--r--pxl/pxasm.ps8
-rw-r--r--pxl/pxbfont.c148
-rw-r--r--pxl/pxbfont.ps25
-rw-r--r--pxl/pxerrors.h4
-rw-r--r--pxl/pxffont.c116
-rw-r--r--pxl/pxfont.c10
-rw-r--r--pxl/pxgstate.c941
-rw-r--r--pxl/pxgstate.h18
-rw-r--r--pxl/pximage.c768
-rw-r--r--pxl/pximpl.c6
-rw-r--r--pxl/pxink.c2
-rw-r--r--pxl/pxoper.h2
-rw-r--r--pxl/pxpaint.c945
-rw-r--r--pxl/pxparse.c1349
-rw-r--r--pxl/pxparse.h8
-rw-r--r--pxl/pxpthr.c4
-rw-r--r--pxl/pxsessio.c854
-rw-r--r--pxl/pxstate.c26
-rw-r--r--pxl/pxstate.h38
-rw-r--r--pxl/pxstream.c6
-rw-r--r--pxl/pxsymbol.ps4
-rw-r--r--pxl/pxtop.c650
-rw-r--r--pxl/pxvalue.c42
-rw-r--r--pxl/pxvalue.h4
-rw-r--r--svg/ghostsvg.h1
-rw-r--r--svg/svgcolor.c137
-rw-r--r--svg/svgdoc.c285
-rw-r--r--svg/svgshapes.c681
-rw-r--r--svg/svgtop.c125
-rw-r--r--svg/svgtransform.c287
-rw-r--r--svg/svgtypes.c20
-rw-r--r--svg/svgxml.c175
-rw-r--r--tools/GOT/detag.c3
-rw-r--r--tools/GOT/tagimage.c2
-rw-r--r--tools/gslite/gslt.h1
-rw-r--r--tools/gslite/gslt_alloc.c95
-rw-r--r--tools/gslite/gslt_alloc.h1
-rw-r--r--tools/gslite/gslt_font.h1
-rw-r--r--tools/gslite/gslt_font_api.c1
-rw-r--r--tools/gslite/gslt_font_api.h1
-rw-r--r--tools/gslite/gslt_font_api_test.c2
-rw-r--r--tools/gslite/gslt_font_cache.c25
-rw-r--r--tools/gslite/gslt_font_cff.c657
-rw-r--r--tools/gslite/gslt_font_encoding.c57
-rw-r--r--tools/gslite/gslt_font_glyph.c95
-rw-r--r--tools/gslite/gslt_font_int.h1
-rw-r--r--tools/gslite/gslt_font_test.c78
-rw-r--r--tools/gslite/gslt_font_ttf.c9
-rw-r--r--tools/gslite/gslt_image.c11
-rw-r--r--tools/gslite/gslt_image.h5
-rw-r--r--tools/gslite/gslt_image_jpeg.c26
-rw-r--r--tools/gslite/gslt_image_png.c24
-rw-r--r--tools/gslite/gslt_image_test.c77
-rw-r--r--tools/gslite/gslt_image_threads_test.c82
-rw-r--r--tools/gslite/gslt_image_tiff.c42
-rw-r--r--tools/gslite/gslt_init.c7
-rw-r--r--tools/gslite/gslt_test.c644
-rw-r--r--tools/tt2pcl.c33
-rw-r--r--[-rwxr-xr-x]tools/xps2tiff/xps2tiff/stdafx.h0
-rw-r--r--xps/xpsgradient.c4
1634 files changed, 222118 insertions, 225747 deletions
diff --git a/gs/Resource/Init/gs_agl.ps b/gs/Resource/Init/gs_agl.ps
index dcf5e74d8..f97a51bb3 100644
--- a/gs/Resource/Init/gs_agl.ps
+++ b/gs/Resource/Init/gs_agl.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/Resource/Init/gs_btokn.ps b/gs/Resource/Init/gs_btokn.ps
index 12beb60f0..09f184c9f 100644
--- a/gs/Resource/Init/gs_btokn.ps
+++ b/gs/Resource/Init/gs_btokn.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -29,118 +29,118 @@ level2dict begin
mark
% 0
- /abs /add /aload /anchorsearch /and
- /arc /arcn /arct /arcto /array
- /ashow /astore /awidthshow /begin /bind
- /bitshift /ceiling /charpath /clear /cleartomark
+ /abs /add /aload /anchorsearch /and
+ /arc /arcn /arct /arcto /array
+ /ashow /astore /awidthshow /begin /bind
+ /bitshift /ceiling /charpath /clear /cleartomark
% 20
- /clip /clippath /closepath /concat /concatmatrix
- /copy /count /counttomark /currentcmykcolor /currentdash
- /currentdict /currentfile /currentfont /currentgray /currentgstate
- /currenthsbcolor /currentlinecap /currentlinejoin /currentlinewidth /currentmatrix
+ /clip /clippath /closepath /concat /concatmatrix
+ /copy /count /counttomark /currentcmykcolor /currentdash
+ /currentdict /currentfile /currentfont /currentgray /currentgstate
+ /currenthsbcolor /currentlinecap /currentlinejoin /currentlinewidth /currentmatrix
% 40
- /currentpoint /currentrgbcolor /currentshared /curveto /cvi
- /cvlit /cvn /cvr /cvrs /cvs
- /cvx /def /defineusername /dict /div
- /dtransform /dup /end /eoclip /eofill
+ /currentpoint /currentrgbcolor /currentshared /curveto /cvi
+ /cvlit /cvn /cvr /cvrs /cvs
+ /cvx /def /defineusername /dict /div
+ /dtransform /dup /end /eoclip /eofill
% 60
- /eoviewclip /eq /exch /exec /exit
- /file /fill /findfont /flattenpath /floor
- /flush /flushfile /for /forall /ge
- /get /getinterval /grestore /gsave /gstate
+ /eoviewclip /eq /exch /exec /exit
+ /file /fill /findfont /flattenpath /floor
+ /flush /flushfile /for /forall /ge
+ /get /getinterval /grestore /gsave /gstate
% 80
- /gt /identmatrix /idiv /idtransform /if
- /ifelse /image /imagemask /index /ineofill
- /infill /initviewclip /inueofill /inufill /invertmatrix
- /itransform /known /le /length /lineto
+ /gt /identmatrix /idiv /idtransform /if
+ /ifelse /image /imagemask /index /ineofill
+ /infill /initviewclip /inueofill /inufill /invertmatrix
+ /itransform /known /le /length /lineto
% 100
- /load /loop /lt /makefont /matrix
- /maxlength /mod /moveto /mul /ne
- /neg /newpath /not /null /or
- /pathbbox /pathforall /pop /print /printobject
+ /load /loop /lt /makefont /matrix
+ /maxlength /mod /moveto /mul /ne
+ /neg /newpath /not /null /or
+ /pathbbox /pathforall /pop /print /printobject
% 120
- /put /putinterval /rcurveto /read /readhexstring
- /readline /readstring /rectclip /rectfill /rectstroke
- /rectviewclip /repeat /restore /rlineto /rmoveto
- /roll /rotate /round /save /scale
+ /put /putinterval /rcurveto /read /readhexstring
+ /readline /readstring /rectclip /rectfill /rectstroke
+ /rectviewclip /repeat /restore /rlineto /rmoveto
+ /roll /rotate /round /save /scale
% 140
- /scalefont /search /selectfont /setbbox /setcachedevice
- /setcachedevice2 /setcharwidth /setcmykcolor /setdash /setfont
- /setgray /setgstate /sethsbcolor /setlinecap /setlinejoin
- /setlinewidth /setmatrix /setrgbcolor /setshared /shareddict
+ /scalefont /search /selectfont /setbbox /setcachedevice
+ /setcachedevice2 /setcharwidth /setcmykcolor /setdash /setfont
+ /setgray /setgstate /sethsbcolor /setlinecap /setlinejoin
+ /setlinewidth /setmatrix /setrgbcolor /setshared /shareddict
% 160
- /show /showpage /stop /stopped /store
- /string /stringwidth /stroke /strokepath /sub
- /systemdict /token /transform /translate /truncate
- /type /uappend /ucache /ueofill /ufill
+ /show /showpage /stop /stopped /store
+ /string /stringwidth /stroke /strokepath /sub
+ /systemdict /token /transform /translate /truncate
+ /type /uappend /ucache /ueofill /ufill
% 180
- /undef /upath /userdict /ustroke /viewclip
- /viewclippath /where /widthshow /write /writehexstring
- /writeobject /writestring /wtranslation /xor /xshow
- /xyshow /yshow /FontDirectory /SharedFontDirectory /Courier
+ /undef /upath /userdict /ustroke /viewclip
+ /viewclippath /where /widthshow /write /writehexstring
+ /writeobject /writestring /wtranslation /xor /xshow
+ /xyshow /yshow /FontDirectory /SharedFontDirectory /Courier
% 200
- /Courier-Bold /Courier-BoldOblique /Courier-Oblique /Helvetica /Helvetica-Bold
- /Helvetica-BoldOblique /Helvetica-Oblique /Symbol /Times-Bold /Times-BoldItalic
- /Times-Italic /Times-Roman /execuserobject /currentcolor /currentcolorspace
- /currentglobal /execform /filter /findresource /globaldict
+ /Courier-Bold /Courier-BoldOblique /Courier-Oblique /Helvetica /Helvetica-Bold
+ /Helvetica-BoldOblique /Helvetica-Oblique /Symbol /Times-Bold /Times-BoldItalic
+ /Times-Italic /Times-Roman /execuserobject /currentcolor /currentcolorspace
+ /currentglobal /execform /filter /findresource /globaldict
% 220
- /makepattern /setcolor /setcolorspace /setglobal /setpagedevice
- /setpattern
+ /makepattern /setcolor /setcolorspace /setglobal /setpagedevice
+ /setpattern
% pad to 256
- counttomark 256 exch sub { 0 } repeat
+ counttomark 256 exch sub { 0 } repeat
% 256
- /= /== /ISOLatin1Encoding /StandardEncoding
+ /= /== /ISOLatin1Encoding /StandardEncoding
% 260
- ([) cvn (]) cvn /atan /banddevice /bytesavailable
- /cachestatus /closefile /colorimage /condition /copypage
- /cos /countdictstack /countexecstack /cshow /currentblackgeneration
- /currentcacheparams /currentcolorscreen /currentcolortransfer /currentcontext /currentflat
+ ([) cvn (]) cvn /atan /banddevice /bytesavailable
+ /cachestatus /closefile /colorimage /condition /copypage
+ /cos /countdictstack /countexecstack /cshow /currentblackgeneration
+ /currentcacheparams /currentcolorscreen /currentcolortransfer /currentcontext /currentflat
% 280
- /currenthalftone /currenthalftonephase /currentmiterlimit /currentobjectformat /currentpacking
- /currentscreen /currentstrokeadjust /currenttransfer /currentundercolorremoval /defaultmatrix
- /definefont /deletefile /detach /deviceinfo /dictstack
- /echo /erasepage /errordict /execstack /executeonly
+ /currenthalftone /currenthalftonephase /currentmiterlimit /currentobjectformat /currentpacking
+ /currentscreen /currentstrokeadjust /currenttransfer /currentundercolorremoval /defaultmatrix
+ /definefont /deletefile /detach /deviceinfo /dictstack
+ /echo /erasepage /errordict /execstack /executeonly
% 300
- /exp /false /filenameforall /fileposition /fork
- /framedevice /grestoreall /handleerror /initclip /initgraphics
- /initmatrix /instroke /inustroke /join /kshow
- /ln /lock /log /mark /monitor
+ /exp /false /filenameforall /fileposition /fork
+ /framedevice /grestoreall /handleerror /initclip /initgraphics
+ /initmatrix /instroke /inustroke /join /kshow
+ /ln /lock /log /mark /monitor
% 320
- /noaccess /notify /nulldevice /packedarray /quit
- /rand /rcheck /readonly /realtime /renamefile
- /renderbands /resetfile /reversepath /rootfont /rrand
- /run /scheck /setblackgeneration /setcachelimit /setcacheparams
+ /noaccess /notify /nulldevice /packedarray /quit
+ /rand /rcheck /readonly /realtime /renamefile
+ /renderbands /resetfile /reversepath /rootfont /rrand
+ /run /scheck /setblackgeneration /setcachelimit /setcacheparams
% 340
- /setcolorscreen /setcolortransfer /setfileposition /setflat /sethalftone
- /sethalftonephase /setmiterlimit /setobjectformat /setpacking /setscreen
- /setstrokeadjust /settransfer /setucacheparams /setundercolorremoval /sin
- /sqrt /srand /stack /status /statusdict
+ /setcolorscreen /setcolortransfer /setfileposition /setflat /sethalftone
+ /sethalftonephase /setmiterlimit /setobjectformat /setpacking /setscreen
+ /setstrokeadjust /settransfer /setucacheparams /setundercolorremoval /sin
+ /sqrt /srand /stack /status /statusdict
% 360
- /true /ucachestatus /undefinefont /usertime /ustrokepath
- /version /vmreclaim /vmstatus /wait /wcheck
- /xcheck /yield /defineuserobject /undefineuserobject /UserObjects
- /cleardictstack
+ /true /ucachestatus /undefinefont /usertime /ustrokepath
+ /version /vmreclaim /vmstatus /wait /wcheck
+ /xcheck /yield /defineuserobject /undefineuserobject /UserObjects
+ /cleardictstack
% 376
- /A /B /C /D /E /F /G /H /I /J /K /L /M
- /N /O /P /Q /R /S /T /U /V /W /X /Y /Z
- /a /b /c /d /e /f /g /h /i /j /k /l /m
- /n /o /p /q /r /s /t /u /v /w /x /y /z
+ /A /B /C /D /E /F /G /H /I /J /K /L /M
+ /N /O /P /Q /R /S /T /U /V /W /X /Y /Z
+ /a /b /c /d /e /f /g /h /i /j /k /l /m
+ /n /o /p /q /r /s /t /u /v /w /x /y /z
% 428
- /setvmthreshold (<<) cvn
- (>>) cvn /currentcolorrendering /currentdevparams /currentoverprint /currentpagedevice
- /currentsystemparams /currentuserparams /defineresource /findencoding /gcheck
+ /setvmthreshold (<<) cvn
+ (>>) cvn /currentcolorrendering /currentdevparams /currentoverprint /currentpagedevice
+ /currentsystemparams /currentuserparams /defineresource /findencoding /gcheck
% 440
- /glyphshow /languagelevel /product /pstack /resourceforall
- /resourcestatus /revision /serialnumber /setcolorrendering /setdevparams
- /setoverprint /setsystemparams /setuserparams /startjob /undefineresource
- /GlobalFontDirectory /ASCII85Decode /ASCII85Encode /ASCIIHexDecode /ASCIIHexEncode
+ /glyphshow /languagelevel /product /pstack /resourceforall
+ /resourcestatus /revision /serialnumber /setcolorrendering /setdevparams
+ /setoverprint /setsystemparams /setuserparams /startjob /undefineresource
+ /GlobalFontDirectory /ASCII85Decode /ASCII85Encode /ASCIIHexDecode /ASCIIHexEncode
% 460
- /CCITTFaxDecode /CCITTFaxEncode /DCTDecode /DCTEncode /LZWDecode
- /LZWEncode /NullEncode /RunLengthDecode /RunLengthEncode /SubFileDecode
- /CIEBasedA /CIEBasedABC /DeviceCMYK /DeviceGray /DeviceRGB
- /Indexed /Pattern /Separation /CIEBasedDEF /CIEBasedDEFG
+ /CCITTFaxDecode /CCITTFaxEncode /DCTDecode /DCTEncode /LZWDecode
+ /LZWEncode /NullEncode /RunLengthDecode /RunLengthEncode /SubFileDecode
+ /CIEBasedA /CIEBasedABC /DeviceCMYK /DeviceGray /DeviceRGB
+ /Indexed /Pattern /Separation /CIEBasedDEF /CIEBasedDEFG
% 480
- /DeviceN
+ /DeviceN
% 481 -- end
.packtomark .installsystemnames
@@ -175,9 +175,9 @@ cntdict /arraytype {
cntdict /dicttype {
WRITEDICTS {
dup dup length 2 mul 5 -1 roll add 4 2 roll {
- % We have to use .execn here, rather than simply rolling the
- % value under the top elements, because key might involve arrays
- % or dictionaries.
+ % We have to use .execn here, rather than simply rolling the
+ % value under the top elements, because key might involve arrays
+ % or dictionaries.
cvlit {.cntobj} exch 2 .execn .cntobj
} forall
} {
@@ -191,15 +191,15 @@ cntdict /dicttype {
.dicttomark def
/.bosheader { % <top_length> <total_length> <string8> .bosheader
- % <string4|8>
+ % <string4|8>
dup 0 currentobjectformat 127 add put % object format => BOS tag
2 index 255 le 2 index 65531 le and {
- % Use the short header format: tag toplen(1) totlen(2)
+ % Use the short header format: tag toplen(1) totlen(2)
exch 4 add exch
0 4 getinterval
dup 1 5 -1 roll put
} {
- % Use the long header format: tag 0(1) toplen(2) totlen(4)
+ % Use the long header format: tag 0(1) toplen(2) totlen(4)
exch 8 add exch
0 0 4 2 roll .bosobject exch pop exch pop % store with byte swapping
} ifelse % Stack: shortlen str
@@ -214,66 +214,66 @@ cntdict /dicttype {
/.writeobjects { % <file> <tag> <array> .writeobjects -
mark exch
- % Count the space required for refs and strings.
+ % Count the space required for refs and strings.
dup length 0 3 -1 roll
- % Stack: file tag -mark- #refs #chars array
+ % Stack: file tag -mark- #refs #chars array
dup 4 1 roll { .cntobj } forall
- % Write the header.
+ % Write the header.
- % Stack: file tag -mark- array1 ... (array|dict)N #refs #chars
+ % Stack: file tag -mark- array1 ... (array|dict)N #refs #chars
counttomark 3 add -2 roll 4 1 roll
- % Stack: -mark- array1 ... (array|dict)N tag #refs #chars file
+ % Stack: -mark- array1 ... (array|dict)N tag #refs #chars file
dup counttomark 1 sub index length
4 index 3 bitshift 4 index add
(xxxxxxxx) .bosheader writestring
- % Write the objects per se.
+ % Write the objects per se.
3 1 roll pop
counttomark 1 sub index length 3 bitshift exch
3 bitshift
- % Stack: -mark- array1 ... (array|dict)N tag file ref# char#
+ % Stack: -mark- array1 ... (array|dict)N tag file ref# char#
counttomark 4 sub {
counttomark -1 roll dup 6 1 roll
- % Stack: ... objN tag file ref# char# objN
+ % Stack: ... objN tag file ref# char# objN
dup type /dicttype eq { % can't be first object
{ 5 1 roll (x\000xxxxxx) .bosobject
- 3 index exch writestring
- 4 -1 roll (x\000xxxxxx) .bosobject
- 3 index exch writestring
+ 3 index exch writestring
+ 4 -1 roll (x\000xxxxxx) .bosobject
+ 3 index exch writestring
} forall
} {
{ (x\000xxxxxx) .bosobject
- dup 1 6 index put
- 3 index exch writestring
- 4 -1 roll pop 0 4 1 roll % clear tag
+ dup 1 6 index put
+ 3 index exch writestring
+ 4 -1 roll pop 0 4 1 roll % clear tag
} forall
} ifelse
} repeat
- % Write the strings and names.
+ % Write the strings and names.
pop pop exch pop
- % Stack: -mark- array1 ... array|dictN file
+ % Stack: -mark- array1 ... array|dictN file
counttomark 1 sub {
counttomark -1 roll {
- % The counting pass ensured that the keys and values
- % of any dictionary must be writable objects.
- % Hence, we are processing a dictionary iff
- % the next-to-top stack element is not a file.
+ % The counting pass ensured that the keys and values
+ % of any dictionary must be writable objects.
+ % Hence, we are processing a dictionary iff
+ % the next-to-top stack element is not a file.
1 index type /filetype ne {
- exch 2 index exch dup type //w2dict exch .knownget
- { exec } { pop } ifelse pop
+ exch 2 index exch dup type //w2dict exch .knownget
+ { exec } { pop } ifelse pop
} if
dup type //w2dict exch .knownget { exec } { pop } ifelse
} forall
} repeat
- % Clean up.
+ % Clean up.
- % Stack: -mark- file
+ % Stack: -mark- file
pop pop
} .bind def
@@ -293,25 +293,25 @@ cntdict /dicttype {
} odef
/.writeobject {
3 copy exch
- % We must allocate the array in local VM
- % to avoid a possible invalidaccess.
+ % We must allocate the array in local VM
+ % to avoid a possible invalidaccess.
.currentglobal //false .setglobal exch 1 array astore exch .setglobal
.writeobjects pop pop pop
} .bind def
% Implement binary error message output.
/.objectprinttest { % <obj> .objectprinttest -
- % This is a pseudo-operator so it will restore the stack
- % if it gets an error.
+ % This is a pseudo-operator so it will restore the stack
+ % if it gets an error.
mark 0 0 3 .argindex .cntobj cleartomark pop
} bind odef
/.printerror {
$error /binary get .languagelevel 2 ge and {
currentobjectformat 0 ne {
[ /Error $error /errorname get $error /command get
- % Convert the object with cvs if it isn't printable.
+ % Convert the object with cvs if it isn't printable.
dup { .objectprinttest } .internalstopped {
- pop 100 string cvs
+ pop 100 string cvs
} if
//false ] 250 printobject
}
diff --git a/gs/Resource/Init/gs_cet.ps b/gs/Resource/Init/gs_cet.ps
index 4af8ef8f2..c9409b9ae 100644
--- a/gs/Resource/Init/gs_cet.ps
+++ b/gs/Resource/Init/gs_cet.ps
@@ -8,7 +8,7 @@
} if
300 .sethiresscreen % needed for language switch build since it
- % processes gs_init.ps BEFORE setting the resolution
+ % processes gs_init.ps BEFORE setting the resolution
0 array 0 setdash % CET 09-08 wants local setdash
@@ -34,7 +34,7 @@ setundercolorremoval
% Redefine Font category to return -1 (unknown) VM usage
% in all cases to avoid differences between hosts.
/Font /Category findresource
-dup length dict copy
+dup length dict copy
dup
dup /.loadfontresource get
dup length array copy cvx
@@ -61,9 +61,9 @@ setpagedevice
% Patch setsmoothness, currentsmoothness for a better view of shadings :
userdict /.smoothness currentsmoothness put
-/setsmoothness {
+/setsmoothness {
dup type dup /integertype eq exch /realtype eq or {
- userdict /.smoothness 3 2 roll cvr put
+ userdict /.smoothness 3 2 roll cvr put
} {
/setsmoothness .systemvar /typecheck signalerror
} ifelse
diff --git a/gs/Resource/Init/gs_cff.ps b/gs/Resource/Init/gs_cff.ps
index 271f86388..ffba6d8f1 100644
--- a/gs/Resource/Init/gs_cff.ps
+++ b/gs/Resource/Init/gs_cff.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997, 1998, 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -38,13 +38,13 @@
/.loadnonottofontfile /.loadfontfile load def
/.loadfontfile {
dup 4 string .peekstring pop (OTTO) eq {
- % If this is a font at all, it's an OpenType CFF font set.
+ % If this is a font at all, it's an OpenType CFF font set.
.init_otto_font_file
- % Use a random FontSet resource name. ****** WRONG ******
+ % Use a random FontSet resource name. ****** WRONG ******
realtime rand xor =string cvs exch //false //false
ReadData pop
} {
- % Not a TrueType font.
+ % Not a TrueType font.
.loadnonottofontfile
} ifelse
} bind def
@@ -55,16 +55,16 @@
2 dict begin
/f exch def /cff //null def
card32 pop card16 6 { next pop } repeat dup {
- % Stack: numtables tablesleft
+ % Stack: numtables tablesleft
dup 0 eq {
pop pop /.loadottofontfile cvx /invalidfont signalerror
} if
f 4 string readstring pop (CFF ) eq { sub exit } if
f 12 string readstring pop pop 1 sub % skip to next table
} loop
- % Stack: tablesread
+ % Stack: tablesread
card32 pop card32 card32
- % Stack: tablesread start length
+ % Stack: tablesread start length
exch 3 -1 roll 1 add 16 mul 12 add sub
f exch subfilefilter flushfile % skip to start
f exch subfilefilter end
@@ -75,8 +75,8 @@
% ---------------- Standard strings (actually names) ---------------- %
/StandardStrings mark
- % The initial StandardStrings that that denote characters are
- % defined as a pseudo-Encoding.
+ % The initial StandardStrings that that denote characters are
+ % defined as a pseudo-Encoding.
% 0
/CFFStandardStrings .findencoding aload pop
% 379
@@ -189,7 +189,7 @@ mark
0
CFFDEBUG { ( Out of range access, assuming 0) = } if
/pdfformaterror where {
- pop
+ pop
( **** Warning: Out of range access to a CFF table, assuming 0.\n)
pdfformaterror
} if
@@ -243,7 +243,7 @@ def
mark card16
dup 0 ne {
1 exch next
- dup 0 eq {
+ dup 0 eq {
pop % skip incorrect index, bug 689854
} {
offsetproc dup exec pop exch {
@@ -263,26 +263,26 @@ def
dup 28 lt { exit } if
dup 32 lt {
28 sub {
- { card16 32768 xor 32768 sub }
- { 4 offset dup 16#7fffffff gt { -1 32 bitshift add } if }
- { tokenreal }
- { 31 exit }
+ { card16 32768 xor 32768 sub }
+ { 4 offset dup 16#7fffffff gt { -1 32 bitshift add } if }
+ { tokenreal }
+ { 31 exit }
} exch get exec
} {
dup 247 lt {
- 139 sub
+ 139 sub
} {
- 247 sub {
- { next 108 add }
- { next 364 add }
- { next 620 add }
- { next 876 add }
- { next 108 add neg }
- { next 364 add neg }
- { next 620 add neg }
- { next 876 add neg }
- % 255 is deliberately omitted and will cause a rangecheck
- } exch get exec
+ 247 sub {
+ { next 108 add }
+ { next 364 add }
+ { next 620 add }
+ { next 876 add }
+ { next 108 add neg }
+ { next 364 add neg }
+ { next 620 add neg }
+ { next 876 add neg }
+ % 255 is deliberately omitted and will cause a rangecheck
+ } exch get exec
} ifelse
} ifelse
} loop
@@ -302,8 +302,8 @@ def
/tokenreal { % - tokenreal <float>
0 {
next exch 1 index -4 bitshift tokenrealarray exch get exec tokenput
- % We must leave the byte on the stack temporarily so that
- % the exit will see a consistent stack state.
+ % We must leave the byte on the stack temporarily so that
+ % the exit will see a consistent stack state.
1 index 15 and tokenrealarray exch get exec tokenput exch pop
} loop
tokenbuf 0 3 -1 roll getinterval cvr exch pop
@@ -322,7 +322,7 @@ def
idstring dup type /nametype ne { cvn } if
} bind def
/subfilefilter { % <file> <length> subfilefilter <filter>
- % SubFileDecode interprets a length of 0 as infinite.
+ % SubFileDecode interprets a length of 0 as infinite.
dup 0 le { pop pop () 0 } if () /SubFileDecode filter
} bind def
@@ -397,7 +397,7 @@ def
}
17 { { readCharStrings } offput }
18 { exch /readPrivate cvx 2 packedarray offput }
- % CIDFont operators
+ % CIDFont operators
62 { % ROS, must be first in a CIDFont
currentdict /FontType undef
currentdict /Encoding undef
@@ -419,8 +419,8 @@ def
67 { /UIDBase pxdef }
68 { { readFDArray } offput }
69 { { readFDSelect } offput }
- % This operator only appears in a FDArray element.
- % We don't really need it, so ignore an error.
+ % This operator only appears in a FDArray element.
+ % We don't really need it, so ignore an error.
70 { { idstring } .internalstopped { pop pop } { /FontName pxdef } ifelse }
.dicttomark readonly def
@@ -430,11 +430,11 @@ def
% queued read should be read.
/charstringcount { % <font> charstringcount <count> true
- % <font> charstringcount <length> false
+ % <font> charstringcount <length> false
/CharStringArray .knownget {
length //true
} {
- % Hack: look for the next queued read.
+ % Hack: look for the next queued read.
16#7fffffff offsets { pop .min } forall
pos sub //false
} ifelse
@@ -478,7 +478,7 @@ def
} bind
{ 1 next {
next next 1 add {
- % Stack: gid code
+ % Stack: gid code
Encoding 1 index 3 index put
exch 1 add exch 1 add
} repeat pop
@@ -493,7 +493,7 @@ def
/Encoding [ 256 { /.notdef } repeat ] def
next encodingformats 1 index 127 and get exec
128 ge {
- % Read supplementary encodings.
+ % Read supplementary encodings.
next {
Encoding next sid idname put
} repeat
@@ -525,7 +525,7 @@ dup % Format 2
% The following procedure does not use excessive op-stack space.
{ pop 65535 array card16 card16 exch % Format 3
{ % Stack: array previndex
- card8 card16
+ card8 card16
exch 1 index 4 -1 roll
exch 1 exch 1 sub
{ 3 index exch 2 index put } for pop
@@ -539,7 +539,6 @@ dup % Format 2
begin fdselectformats next get currentdict exch exec /FDSelect exch def end
} bind def
-
% ------ Private dictionary ------ %
/deltarray { % -mark- <num1> ... deltarray <num1'> ...
@@ -569,7 +568,7 @@ dup % Format 2
19 { PrivateStart add { readSubrs } offput }
20 { /defaultWidthX pxdef }
21 { /nominalWidthX pxdef }
- % Multiple Master fonts only
+ % Multiple Master fonts only
59 { /NDV pxdef }
60 { /CDV pxdef }
61 { /lenBuildCharArray pxdef }
@@ -577,7 +576,7 @@ dup % Format 2
/readPrivate { % <font> <size> readPrivate -
2 dict begin
- f 3 1 roll exch % f <size> <font>
+ f 3 1 roll exch % f <size> <font>
StringCache queued_offset known {
/PrivateStart queued_offset def
} {
@@ -593,7 +592,7 @@ dup % Format 2
} ifelse
dup /FontType .knownget not { 2 } if exch
/Private get begin
- % Default lenIV to -1 even for Type 1 CharStrings.
+ % Default lenIV to -1 even for Type 1 CharStrings.
2 ne { /lenIV -1 def } if
//privatedictops Dict end
exch /f exch store advance
@@ -608,16 +607,16 @@ dup % Format 2
% Clean up after finishing a font.
/cleanupFont { % (currentdict) cleanupFont -
- % Remove unwanted entries.
+ % Remove unwanted entries.
currentdict /charset undef
currentdict /CharStringArray undef
} bind def
% Update the Encoding and CharStrings for a real font.
/finishFont { % (currentdict) finishFont -
- % Construct the real Encoding.
- % The value of Encoding is either a number, for predefined
- % encodings, or an array of mixed GIDs and names.
+ % Construct the real Encoding.
+ % The value of Encoding is either a number, for predefined
+ % encodings, or an array of mixed GIDs and names.
/Encoding mark Encoding
CFFDEBUG { (Encoding: ) print dup === flush } if
dup type /integertype eq {
@@ -627,9 +626,9 @@ dup % Format 2
dup type /integertype eq { charset exch get idname } if
} forall
} ifelse .packtomark def
- % Construct the CharStrings.
- % Note that they may only correspond to an initial
- % subset of the charset.
+ % Construct the CharStrings.
+ % Note that they may only correspond to an initial
+ % subset of the charset.
/CharStrings charset length CharStringArray length .min dict def
CFFDEBUG {
charset length =only ( charset ) print
@@ -646,7 +645,7 @@ dup % Format 2
% Replace CharStrings with GlyphDirectory for a CIDFont;
% Move GlobalSubrs to descendent fonts.
/finishCIDFont { % (currentdict) finishCIDFont -
- % Construct the GlyphDirectory, similar to CharStrings.
+ % Construct the GlyphDirectory, similar to CharStrings.
/FDBytes FDArray length 1 gt { 1 } { 0 } ifelse def
/GlyphDirectory charset length CharStringArray length .min dict def
CFFDEBUG {
@@ -656,8 +655,8 @@ dup % Format 2
} if
0 1 GlyphDirectory maxlength 1 sub {
dup CharStringArray exch get
- % If there is more than one FDArray entry, add the font
- % index to the beginning of each charstring.
+ % If there is more than one FDArray entry, add the font
+ % index to the beginning of each charstring.
FDBytes 1 eq {
FDSelect 2 index get
1 string dup 0 4 -1 roll put exch concatstrings
@@ -673,7 +672,7 @@ dup % Format 2
Private /GlobalSubrs undef
} if
- % Clean up.
+ % Clean up.
currentdict /FDSelect undef
cleanupFont
} bind def
@@ -723,7 +722,7 @@ dup % Format 2
currentfile exch subfilefilter //false //false ReadData pop
} bind def
/ReadData { % <resname> <file> <forceresname> <forcecid> ReadData <fontset>
- % Initialize.
+ % Initialize.
30 dict begin
/forcecidfont exch def
@@ -747,14 +746,14 @@ systemdict /OLDCFF known {
f exch () /SubFileDecode filter flushfile
} if
- % Read the Indexes.
+ % Read the Indexes.
/names Index def
/topdicts Index def
/strings Index def
/gsubrs Index def
- % Read the top Dicts.
+ % Read the top Dicts.
/offsets 50 dict def
/queued [] def
@@ -763,31 +762,31 @@ systemdict /OLDCFF known {
/fonts [ topdicts {
0 () /SubFileDecode filter /f exch def
40 dict begin
- % Preload defaults that differ from PostScript defaults,
- % or that are required.
+ % Preload defaults that differ from PostScript defaults,
+ % or that are required.
/FontType 2 def
/PaintType 0 def
/FontMatrix [0.001 0 0 0.001 0 0] def
/charset StandardCharsets 0 get def
/Encoding 0 def
/FontInfo 10 dict
- dup /UnderlinePosition -100 put
- dup /UnderlineThickness 50 put
+ dup /UnderlinePosition -100 put
+ dup /UnderlineThickness 50 put
def
/Private 20 dict
- gsubrs length 0 ne { dup /GlobalSubrs gsubrs put } if
+ gsubrs length 0 ne { dup /GlobalSubrs gsubrs put } if
def
//topdictops Dict
currentdict end
} forall ] def
- % Read other tables with queued offsets.
+ % Read other tables with queued offsets.
% We process these in order so we can advance if needed.
- % The CFF file may not be positionable.
+ % The CFF file may not be positionable.
{ % outer loop since offsets may be updated when processing
CFFDEBUG { (offsets: ) print [ offsets { pop } forall ] //== exec } if
[ offsets { pop } forall ] { lt } .sort % process in order of appearance
- {
+ {
CFFDEBUG { (queued offset: ) print dup =print flush (, current pos=) print pos = } if
/queued_offset 1 index def
StringCache 1 index .knownget {
@@ -803,12 +802,12 @@ systemdict /OLDCFF known {
offsets length 0 eq { exit } if
} loop
- % Process out-of-order tables.
+ % Process out-of-order tables.
CFFDEBUG { queued length =only ( queued) = flush } if
queued { exec } forall
- % Update Encoding and CharStrings.
+ % Update Encoding and CharStrings.
fonts {
begin
@@ -819,7 +818,7 @@ systemdict /OLDCFF known {
} ifelse
end
} forall
- % Wrap up.
+ % Wrap up.
resname mark 0 1 fonts length 1 sub {
CFFDEBUG { dup =only ( ) print flush } if
@@ -828,11 +827,11 @@ systemdict /OLDCFF known {
CFFDEBUG { dup //== exec flush } if
exch fonts exch get
dup /CIDFontType known {
- % This is a CIDFont.
+ % This is a CIDFont.
dup /CIDFontName 3 index put
1 index exch /CIDFont defineresource
} {
- % This is a font.
+ % This is a font.
dup /FontName 3 index put
1 index exch definefont
} ifelse
diff --git a/gs/Resource/Init/gs_cidcm.ps b/gs/Resource/Init/gs_cidcm.ps
index 47029e471..d86bccc00 100644
--- a/gs/Resource/Init/gs_cidcm.ps
+++ b/gs/Resource/Init/gs_cidcm.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -18,7 +18,6 @@
languagelevel 2 .setlanguagelevel currentglobal //true setglobal
-
% In the comments below, 'CSI' is an abbreviation/acronym for CIDSystemInfo.
% We pre-scan resource files to retrieve the CSI from them.
% First we define a hidden procset .prs_dict containing
@@ -38,7 +37,7 @@ languagelevel 2 .setlanguagelevel currentglobal //true setglobal
% Define local variables :
/.prs_dict currentdict def % self-reference (constant)
-/.prs_empty 0 dict readonly def
+/.prs_empty 0 dict readonly def
/path_buffer 8192 string def
/name_buffer 1024 string def
/minus (-) 0 get def % character code constant for '-'
@@ -55,7 +54,7 @@ languagelevel 2 .setlanguagelevel currentglobal //true setglobal
% Define a dummy CIDInit procset to use while pre-scanning :
-/DummyCIDInit 15 dict
+/DummyCIDInit 15 dict
begin
/begincmap {} def
@@ -63,7 +62,7 @@ begin
{stop} bind
[ /begincodespacerange /endcodespacerange /beginnotdefchar /endnotdefchar
- /beginnotdefrange /endnotdefrange /begincidchar /endcidchar /begincidrange
+ /beginnotdefrange /endnotdefrange /begincidchar /endcidchar /begincidrange
/endcidrange /endcmap /usefont /StartData
] {
1 index def
@@ -87,8 +86,8 @@ currentdict end def
% Define procedures for pre-scanning :
/StopIfCSIDefined { % - StopIfCSIDefined -
-
- % Check if the dictionary stack contains a dictionary containing /CIDSystemInfo.
+
+ % Check if the dictionary stack contains a dictionary containing /CIDSystemInfo.
% The search is limited to the top .prsDictCount dictionaries in the stack.
% If so, retrieve the CSI, and execute stop to terminate the pre-scanning of the file.
% Otherwise, do nothing, so the pre-scanning continues.
@@ -105,7 +104,7 @@ currentdict end def
} bind def
/PrescanFile { % - PrescanFile -
- { //.prs_dict /.prsFile get token {
+ { //.prs_dict /.prsFile get token {
dup type % token type
dup /nametype eq exch /operatortype eq or {
dup xcheck {
@@ -120,7 +119,7 @@ currentdict end def
} bind odef
/GetCIDSystemInfoFromFile { % <file> GetCIDSystemInfoFromFile <CSI>
-
+
% This procedure reads resource files with 'token',
% executing the tokens untill /CIDSystemInfo appears to be defined.
% Normally the resource file creates a new dictionary on
@@ -141,12 +140,12 @@ currentdict end def
} bind def
/GetCIDSystemInfo { % <InstName> <CatName> GetCIDSystemInfo <CSI>
-
+
% Retrieve CSI, using caches.
RESMPDEBUG { (cidcm GetCIDSystemInfo beg) = } if
/Category findresource begin % /InstName
- dup ResourceStatus
+ dup ResourceStatus
{
pop 2 lt {
FindResource /CIDSystemInfo .knownget not {
@@ -202,7 +201,7 @@ currentdict end def
} bind def
/IsCompatibleCSI { % <CSI-M> <CSI-F> IsCompatibleCSI <bool>
-
+
% The CSI in a CIDFont may be an array, a dict, or null.
% If it is an array, it must be of 1 element, which is a dict.
% In this case the dict is used for testing the compatibility.
@@ -229,7 +228,7 @@ currentdict end def
} if
} if
//true % <<CSI-M>> <<CSI-F>> bEQ
- [/Registry /Ordering] {
+ [/Registry /Ordering] {
2 index 1 index .knownget not {
1234567
} if % <<CSI-M>> <<CSI-F>> bEQ /key vF
@@ -245,12 +244,12 @@ currentdict end def
} bind def
/IsWellComposed { % <CIDFontName> <CMapName> IsWellComposed <bool>
-
+
% Check if the given CIDFont and CMap have compatible CSIs.
exch % /CMapName /CIDFontName
/CIDFont //GetCIDSystemInfo exec % /CMapName CSI-F
dup type /dicttype eq {
- dup length 0 ne {
+ dup length 0 ne {
exch % CSI-F /CMapName
/CMap //GetCIDSystemInfo exec % CSI-F CSI-M
//IsCompatibleCSI exec % bool
@@ -264,7 +263,7 @@ currentdict end def
/IsComposedFont { % <FontName> IsComposedFont <CIDFontName> <CMapName> true
% <FontName> IsComposedFont false
-
+
% Check if the given font name may be decomposed into CIDFont.CMap, CIDFont-CMap
% or into CIDFont--CMap, such that CIDFont and CMap have compatible CSIs.
% FontName
@@ -273,7 +272,7 @@ currentdict end def
} if % (FontName)
{ dup length 2 sub -1 1 {
% (FontName) i
- 2 copy get dup //minus eq exch //period eq or {
+ 2 copy get dup //minus eq exch //period eq or {
2 copy 2 copy % (FontName) i (FontName) i (FontName) i
2 copy get //minus eq {
2 copy 1 sub get //minus eq {
@@ -285,7 +284,7 @@ currentdict end def
1 add dup % (FontName) i /CIDFontName (FontName) i1 i1
5 index length % (FontName) i /CIDFontName (FontName) i1 i1 l
exch sub getinterval cvn % (FontName) i /CIDFontName /CMapName
- 2 copy //IsWellComposed exec { % (FontName) i /CIDFontName /CMapName
+ 2 copy //IsWellComposed exec { % (FontName) i /CIDFontName /CMapName
4 2 roll pop pop % /CIDFontName /CMapName
stop
} if
@@ -317,14 +316,13 @@ currentdict end def
% defined in the old /Font category dictionary :
% /IsComposedFont, /IsWellComposed .
-
/Font /Category findresource dup length dict copy begin
/FindResource { % <InstName> FindResource <inst>
dup //ResourceStatus exec {
pop pop //FindResource exec
- } {
- dup //IsComposedFont exec { % /FontName /CIDFontName /CMapName
+ } {
+ dup //IsComposedFont exec { % /FontName /CIDFontName /CMapName
exch [ exch ] composefont % inst
} {
//FindResource exec
@@ -334,13 +332,13 @@ currentdict end def
/ResourceStatus { % <InstName> ResourceStatus <nStatus> <nSize> true
% <InstName> ResourceStatus false
- dup //ResourceStatus exec {
+ dup //ResourceStatus exec {
3 2 roll pop //true % nStatus nSize true
} {
- //IsComposedFont exec { % /CIDFontName /CMapName
- /CMap resourcestatus { % /CIDFontName nStatusM nSizeM
- exch pop exch % nSizeM /CIDFontName
- /CIDFont resourcestatus { % nSizeM nStatusF nSizeF
+ //IsComposedFont exec { % /CIDFontName /CMapName
+ /CMap resourcestatus { % /CIDFontName nStatusM nSizeM
+ exch pop exch % nSizeM /CIDFontName
+ /CIDFont resourcestatus { % nSizeM nStatusF nSizeF
exch pop % nSizeF nSizeM
dup 0 ge {
exch dup 0 ge {
@@ -352,10 +350,10 @@ currentdict end def
pop
} ifelse % nSize
2 exch //true % nStatus nSize true
- } {
+ } {
pop pop pop //false % work around buggy resource file
} ifelse
- } {
+ } {
pop pop pop //false % work around buggy resource file
} ifelse
} {
@@ -364,18 +362,17 @@ currentdict end def
} ifelse
} bind def
-/ResourceForAll { % <template> <proc> <scratch> ResourceForAll -
+/ResourceForAll { % <template> <proc> <scratch> ResourceForAll -
- % We suppose that the resourceforall procedure does not
+ % We suppose that the resourceforall procedure does not
% define or install new fonts, CMaps, and/or CIDFonts.
% First we create 3 temporary dictionaries to store temporary data
% about fonts, CMaps and CIDFonts.
- % These dictionaries must be created dynamically, to allow for a possible
+ % These dictionaries must be created dynamically, to allow for a possible
% recursive call to resourceforall from the resourceforall procedure.
currentglobal //false setglobal
20 dict 20 dict 20 dict % (templ) proc (scr) g <<CIDFont>> <<CMap>> <<Fonts>>
-
% Store resource identifiers into local dictionaries
% A resource instance can have a key that is not a name or a string. In this
@@ -403,30 +400,30 @@ currentdict end def
%% Make the list of fonts in the form (/Name status) :
% (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
- dup {
+ dup {
pop dup
- //ResourceStatus exec {
+ //ResourceStatus exec {
pop 2 index % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>> /Name nStatus <<Font>>
3 1 roll put % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
} {
pop
} ifelse
} forall % (templ) proc (scr) <<CIDFont>> <<CMap>> <<Fonts>>
-
+
%% Add CIDFont-CMap to it (filtering duplicates) :
-
- 3 2 roll {
- 3 index {
+
+ 3 2 roll {
+ 3 index {
3 1 roll % (templ) proc (scr) <<CMap>> <<Font>> /CIDFont /CMap /CIDFont /CMap
6 index //ComposeName exec % (templ) proc (scr) <<CMap>> <<Font>> /CIDFont /CMap (Font)
- dup 8 index .stringmatch {
+ dup 8 index .stringmatch {
cvn % (templ) proc (scr) <<CMap>> <<Font>> /CIDFont /CMap /Font
dup 4 index exch known {
pop pop
- } {
+ } {
2 index % (templ) proc (scr) <<CMap>> <<Font>> /CIDFont /CMap /Font /CIDFont
4 2 roll % (templ) proc (scr) <<CMap>> <<Font>> /Font /CIDFont /CIDFont /CMap
- //IsWellComposed exec {
+ //IsWellComposed exec {
exch 2 index exch 2 put % (templ) proc (scr) <<CMap>> <<Font>> /CIDFont
} {
exch pop
@@ -446,7 +443,6 @@ currentdict end def
/MappedCategoryRedefiner /ProcSet findresource /MakeResourceEnumerator get exec exec
} bind def
-
currentdict end /Font exch /Category defineresource pop
end
setglobal .setlanguagelevel
diff --git a/gs/Resource/Init/gs_ciddc.ps b/gs/Resource/Init/gs_ciddc.ps
index 6e38ae492..e53bdb411 100644
--- a/gs/Resource/Init/gs_ciddc.ps
+++ b/gs/Resource/Init/gs_ciddc.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/Resource/Init/gs_cidfm.ps b/gs/Resource/Init/gs_cidfm.ps
index 47ad29fb2..a26eff344 100644
--- a/gs/Resource/Init/gs_cidfm.ps
+++ b/gs/Resource/Init/gs_cidfm.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -53,7 +53,7 @@ languagelevel 2 .setlanguagelevel
} bind def
/GetCSI % <record> GetCSI null
- % <record> GetCSI dict
+ % <record> GetCSI dict
{ % We know that currentdict is the category.
RESMPDEBUG { (cidfm GetCSI beg ) = } if
/Substitute get % /Name
@@ -122,7 +122,7 @@ currentdict end def
} ifelse
} bind def
-currentdict end
+currentdict end
/MappedCategoryRedefiner /ProcSet findresource /Redefine get exec
diff --git a/gs/Resource/Init/gs_cidfn.ps b/gs/Resource/Init/gs_cidfn.ps
index 62abb6adb..d98680434 100644
--- a/gs/Resource/Init/gs_cidfn.ps
+++ b/gs/Resource/Init/gs_cidfn.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -83,17 +83,17 @@ dup 0 {
} forall
} ifelse
dup /FDArray get {
- % Read the Subrs if necessary.
+ % Read the Subrs if necessary.
dup /Private get dup /Subrs known not {
dup /SubrCount .knownget {
- % Stack: font Private SubrCount
- currentglobal 3 1 roll 1 index gcheck setglobal
- array 1 index /Subrs 3 -1 roll put
- % Stack: font global Private
- 2 index begin begin .loadsubrs end end
- setglobal
+ % Stack: font Private SubrCount
+ currentglobal 3 1 roll 1 index gcheck setglobal
+ array 1 index /Subrs 3 -1 roll put
+ % Stack: font global Private
+ 2 index begin begin .loadsubrs end end
+ setglobal
} {
- pop
+ pop
} ifelse readonly pop
} {
pop pop
@@ -119,15 +119,15 @@ dup 0 {
/.loadsubrs {
Subrs length 0 ne {
SubrCache SubrMapOffset .knownget {
- % We've already loaded some Subrs at this offset.
- % Make sure we've got as many as we need.
+ % We've already loaded some Subrs at this offset.
+ % Make sure we've got as many as we need.
dup length SubrCount lt {
- % We need to load more.
- SubrCount array exch 1 index copy length .readsubrs
- SubrCache SubrMapOffset 2 index put
+ % We need to load more.
+ SubrCount array exch 1 index copy length .readsubrs
+ SubrCache SubrMapOffset 2 index put
} if
} {
- % We haven't loaded any Subrs at this offset yet.
+ % We haven't loaded any Subrs at this offset yet.
SubrCount array 0 .readsubrs
SubrCache SubrMapOffset 2 index put
} ifelse
@@ -154,55 +154,55 @@ pop % .cidfonttypes
% ---------------- Reading CIDFontType 0 files ---------------- %
/StartData { % <(Binary)|(Hex)> <datalength> StartData -
- % (currentdict is CID font dict)
- % If we're loading a resource file and the data format is
- % binary, we can just save a pointer to the data and load it
- % incrementally.
+ % (currentdict is CID font dict)
+ % If we're loading a resource file and the data format is
+ % binary, we can just save a pointer to the data and load it
+ % incrementally.
mark {
- % Previous versions of this code made provisions for
- % reading hex-encoded data incrementally. Since hex data
- % doesn't seem to be used in practice, we no longer bother.
+ % Previous versions of this code made provisions for
+ % reading hex-encoded data incrementally. Since hex data
+ % doesn't seem to be used in practice, we no longer bother.
2 index (Binary) ne { stop } if
currentfile .currentresourcefile ne { stop } if
- % Hack: the pdfwrite driver relies on finalization to write
- % out fonts. However, the font may be finalized after the
- % resource file, in which case the resource file will be
- % closed. So if the current output device is pdfwrite,
- % don't use incremental loading.
+ % Hack: the pdfwrite driver relies on finalization to write
+ % out fonts. However, the font may be finalized after the
+ % resource file, in which case the resource file will be
+ % closed. So if the current output device is pdfwrite,
+ % don't use incremental loading.
currentdevice 1 dict dup /AllowIncrementalCFF dup put .getdeviceparams
dup type /booleantype eq {{stop}if}if
cleartomark
currentfile fileposition
} .internalstopped {
- % File is not positionable, or uses hex data.
- % Load the data now.
+ % File is not positionable, or uses hex data.
+ % Load the data now.
cleartomark exch
currentfile exch
(Hex) eq { /ASCIIHexDecode filter } if
exch
- % Stack: file length
+ % Stack: file length
dup 65400 le {
- % readstring with a 0-length string causes a rangecheck,
- % but a data length of 0 is allowed.
+ % readstring with a 0-length string causes a rangecheck,
+ % but a data length of 0 is allowed.
string dup () ne { 1 index exch readstring pop } if
} {
mark 3 1 roll {
- % Stack: mark str ... file length
- dup 0 eq { pop exit } if
- dup 65400 .min dup string 3 index exch readstring pop
- % Stack: mark str ... file length newstrlen newstr
- 4 1 roll sub
+ % Stack: mark str ... file length
+ dup 0 eq { pop exit } if
+ dup 65400 .min dup string 3 index exch readstring pop
+ % Stack: mark str ... file length newstrlen newstr
+ 4 1 roll sub
} loop
counttomark 1 add 1 roll ]
} ifelse
/GlyphData exch def
dup currentfile eq { pop } { closefile } ifelse
} {
- % File is positionable and binary, just save a pointer.
- % Stack: (Binary) length -mark- pos
+ % File is positionable and binary, just save a pointer.
+ % Stack: (Binary) length -mark- pos
/GlyphData 0 def
exch pop 3 -1 roll pop exch
- % Stack: pos length
+ % Stack: pos length
/DataSource currentfile 2 index () .subfiledecode //true .reusablestream def
currentfile 3 1 roll add setfileposition
} ifelse
@@ -225,39 +225,39 @@ pop % .cidfonttypes
% GlyphData in RAM).
/ReadString { % <pos> <string> ReadString <string>
GlyphData 0 eq {
- % Read from the file.
+ % Read from the file.
DataSource 3 -1 roll setfileposition
DataSource exch readstring pop
} {
- % Read from a string or an array of strings.
+ % Read from a string or an array of strings.
GlyphData .stringsreadstring
} ifelse
} bind def
/.stringsreadstring % <pos> <string> <strings> .stringsreadstring
- % <vmstring>
+ % <vmstring>
{ dup type /stringtype eq
{ 3 1 roll length getinterval
}
{ { % Stack: pos string glyphdata
- dup 0 get length dup 4 index gt { exit } if
- 4 -1 roll exch sub 3 1 roll
- dup length 1 sub 1 exch getinterval
+ dup 0 get length dup 4 index gt { exit } if
+ 4 -1 roll exch sub 3 1 roll
+ dup length 1 sub 1 exch getinterval
}
loop
- % Stack: pos string glyphdata glyphdata[0]length
- % We know no request can span more than 2 strings.
+ % Stack: pos string glyphdata glyphdata[0]length
+ % We know no request can span more than 2 strings.
3 index 3 index length add 1 index le
{ % Request fits in a single string: just return a substring.
- pop 0 get 3 1 roll length getinterval
+ pop 0 get 3 1 roll length getinterval
}
{ % Request spans 2 strings. Copy the first part.
- 1 index 0 get 4 index 3 -1 roll 1 index sub getinterval
- 2 index copy
- % Copy the second part.
- % Stack: pos str glyphdata str1
- length exch 1 get 0 3 index length
- 3 index sub getinterval 2 index 3 1 roll putinterval
- exch pop
+ 1 index 0 get 4 index 3 -1 roll 1 index sub getinterval
+ 2 index copy
+ % Copy the second part.
+ % Stack: pos str glyphdata str1
+ length exch 1 get 0 3 index length
+ 3 index sub getinterval 2 index 3 1 roll putinterval
+ exch pop
}
ifelse
}
@@ -292,10 +292,10 @@ currentdict end
.currentglobal 3 1 roll 1 index gcheck .setglobal
1 index begin
dup .readglyphdata dup //null eq {
- % Substitute CID 0. **** WRONG ****
+ % Substitute CID 0. **** WRONG ****
pop pop 0 .readglyphdata
} if
- % Stack: cidfont cid subfont charstring
+ % Stack: cidfont cid subfont charstring
dup //null eq { pop pop pop pop } { %**** WRONG ****
4 -1 roll pop
3 1 roll exch dup 4 -1 roll 0 0 moveto
@@ -310,11 +310,11 @@ currentdict end
% BuildGlyph procedure for CIDFontType 2.
% The name %Type11BuildGlyph is known to the interpreter.
(%Type11BuildGlyph) cvn { % <cidfont> <cid> %Type11BuildGlyph -
- % We must be prepared for out-of-range CIDs.
+ % We must be prepared for out-of-range CIDs.
2 copy { .type11mapcid } .internalstopped {
pop /CharStrings get /.notdef get
} if
- % Stack: cidfont cid glyphindex
+ % Stack: cidfont cid glyphindex
1 index exch .type42execchar
} bind def
@@ -341,7 +341,7 @@ languagelevel exch 2 .setlanguagelevel
% Type 32 (CIDFontType 4) fonts, the font can be registered in the Font
% category with only a CIDFontType and no FontType.
/.buildcidfont { % <name> <fontdict> .buildcidfont
- % <name> <cidfont>
+ % <name> <cidfont>
systemdict /ProvideUnicode .knownget not { //false } if {
/FontEmulationProcs /ProcSet findresource
/ProvideUnicodeDecoding get exec
@@ -394,8 +394,8 @@ dup /.LoadResource {
/CIDMap /Generic /Category findresource dup length dict .copydict
dup /.CheckResource {
- % Allow a string, an array of strings, or (as of Adobe release 3011)
- % a dictionary.
+ % Allow a string, an array of strings, or (as of Adobe release 3011)
+ % a dictionary.
dup type dup dup /stringtype eq exch /dicttype eq or {
pop //true
} {
diff --git a/gs/Resource/Init/gs_cidtt.ps b/gs/Resource/Init/gs_cidtt.ps
index 813a6f2d9..ff2f92489 100644
--- a/gs/Resource/Init/gs_cidtt.ps
+++ b/gs/Resource/Init/gs_cidtt.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -42,7 +42,7 @@ currentdict /super.complete_instance currentdict /complete_instance get put
} {
44000 string
CIDCount 44000 gt {
- % need three strings
+ % need three strings
44000 string % 22000 2 mul string
CIDCount 44000 sub 2 mul string
} {
@@ -62,12 +62,12 @@ currentdict /super.complete_instance currentdict /complete_instance get put
currentdict end
} bind def
-/load_sfnts % <FontDict> load_sfnts <FontDict>
+/load_sfnts % <FontDict> load_sfnts <FontDict>
{ % Read the True Type file from the path /Path, and buld /sfnts,
- % skipping glyf and loca.
+ % skipping glyf and loca.
dup /Path get % <font> (path)
QUIET not {
- (Loading a TT font from ) print dup print
+ (Loading a TT font from ) print dup print
( to emulate a CID font ) print 1 index /CIDFontName get =only ( ... ) print
} if
(r) file dup % <font> file file
@@ -83,7 +83,7 @@ currentdict /super.complete_instance currentdict /complete_instance get put
2 index /Decoding get =string cvs % <font> () () ()
concatstrings concatstrings cvn /Decoding exch put % <font>
dup dup /CIDSystemInfo get /Ordering get (-WMode) % <font> <font> () ()
- concatstrings cvn /SubstCID
+ concatstrings cvn /SubstCID
2 copy resourcestatus {
pop pop
findresource /subst_CID_on_WMode exch put % <font>
diff --git a/gs/Resource/Init/gs_cmap.ps b/gs/Resource/Init/gs_cmap.ps
index fcd54a156..ef9fa22f1 100644
--- a/gs/Resource/Init/gs_cmap.ps
+++ b/gs/Resource/Init/gs_cmap.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -54,19 +54,19 @@
/Encoding [ 0 1 FDepVector length 1 sub { } for ] def
/FontInfo 1 dict def % for .processToUnicode in pdf_font.ps .
/FDepVector [ 0 1 FDepVector length 1 sub {
- % Stack: name cmap[name] fonts /FDepVector [ fonts... i
+ % Stack: name cmap[name] fonts /FDepVector [ fonts... i
FDepVector 1 index get
dup type /dicttype ne {
- dup /CIDFont resourcestatus {
- pop pop /CIDFont
- } {
- /Font
- } ifelse findresource
+ dup /CIDFont resourcestatus {
+ pop pop /CIDFont
+ } {
+ /Font
+ } ifelse findresource
} if
exch CMap /FontMatrices get dup length 2 index gt {
- exch get dup //null eq { pop } { makefont } ifelse
+ exch get dup //null eq { pop } { makefont } ifelse
} {
- pop pop
+ pop pop
} ifelse
} for ] readonly def
/FMapType 9 def
@@ -74,7 +74,7 @@
/FontName 3 index def
CMap /WMode .knownget { /WMode exch def } if
/FontType 0 def
- pop pop currentdict end
+ pop pop currentdict end
} bind odef
% composefont doesn't appear in CMap files -- it's documented in
@@ -134,14 +134,14 @@
pop
} repeat
} if
-
+
/.CodeMapData dup load [ exch
- .TempMaps aload pop begin begin begin
+ .TempMaps aload pop begin begin begin
{
[ exch aload pop
- 0 1 currentdict length 1 sub {
- currentdict exch get
- } for
+ 0 1 currentdict length 1 sub {
+ currentdict exch get
+ } for
]
end
} forall
@@ -159,11 +159,11 @@
/.endmap { % <map> .endmap <map>
dup type /arraytype eq {
- % This might be a shared read-only array inherited via usecmap.
- % Don't try to update its elements if this is the case.
+ % This might be a shared read-only array inherited via usecmap.
+ % Don't try to update its elements if this is the case.
dup wcheck {
0 1 2 index length 1 sub {
- 2 copy 2 copy get .endmap put pop
+ 2 copy 2 copy get .endmap put pop
} for readonly
} if
} {
@@ -186,7 +186,7 @@
/usecmap { % <CMap_name> usecmap -
/CMap findresource dup
- % Copy the top level of .CodeMapData
+ % Copy the top level of .CodeMapData
/.CodeMapData exch /.CodeMapData get copyarray def
/FontMatrices exch /FontMatrices get copyarray def
} bind def
@@ -236,35 +236,35 @@
pop mark
} bind def
/endbfrange { % <code_lo> <code_hi> <to_code|(charname*)> ...
- % endbfrange -
+ % endbfrange -
counttomark 3 idiv {
counttomark -3 roll % process in correct order
dup type dup /arraytype eq exch /packedarraytype eq or {
- % Array value, split up.
+ % Array value, split up.
exch pop {
- % Stack: code to_code|charname
- 1 index exch .addbfchar
- % Increment the code. As noted above, we require
- % that only the last byte vary, but we still must
- % mask it after incrementing, in case the last
- % value was 0xff.
- % Stack: code prefix params key value fontindex
- 6 -1 roll dup length string copy
- dup dup length 1 sub 2 copy get 1 add 255 and put
+ % Stack: code to_code|charname
+ 1 index exch .addbfchar
+ % Increment the code. As noted above, we require
+ % that only the last byte vary, but we still must
+ % mask it after incrementing, in case the last
+ % value was 0xff.
+ % Stack: code prefix params key value fontindex
+ 6 -1 roll dup length string copy
+ dup dup length 1 sub 2 copy get 1 add 255 and put
} forall pop
} {
- % Single value, handle directly.
+ % Single value, handle directly.
.addbfrange
} ifelse
} repeat 1 .appendmap
} bind def
/.addbfchar { % <code> <to_code|charname> .addbfchar
- % <prefix> <params> <key> <value> <font_index>
+ % <prefix> <params> <key> <value> <font_index>
1 index exch .addbfrange
} bind def
/.addbfrange { % <code_lo> <code_hi> <to_code|charname>
- % .addbfrange <<same as .addbfchar>>
+ % .addbfrange <<same as .addbfchar>>
4 string dup 3
3 index type /nametype eq {
2 index 2 1 put % dst = CODE_VALUE_GLYPH, see gxfcmap.h .
@@ -273,16 +273,16 @@
2 index 2 2 put % dst = CODE_VALUE_CHARS, see gxfcmap.h .
3 index length
} ifelse put
- % Stack: code_lo code_hi value params
+ % Stack: code_lo code_hi value params
3 index 3 index eq {
- % Single value.
+ % Single value.
3 -1 roll pop exch () exch
} {
- % Range.
+ % Range.
dup 0 1 put dup 1 1 put
4 2 roll
dup dup length 1 sub 0 exch getinterval 5 1 roll % prefix
- % Stack: prefix value params code_lo code_hi
+ % Stack: prefix value params code_lo code_hi
2 { exch dup length 1 sub 1 getinterval } repeat concatstrings
3 -1 roll
} ifelse
@@ -376,23 +376,23 @@
} bind def
/.endmapranges { % -mark- <code_lo> <code_hi> <cid_base> ... <map#>
- % .endmapranges -
+ % .endmapranges -
counttomark 1 add 1 roll
counttomark 3 idiv {
counttomark -3 roll % process in correct order
- % Construct prefix, params, key_lo, key_hi, value, font_index
+ % Construct prefix, params, key_lo, key_hi, value, font_index
3 1 roll % <cid_base> <code_lo> <code_hi>
- % prefix key
- % 1-byte code: () .
- % 1-byte range: () .
- % N-byte code: . (*)
- % N-byte range: (*) (*)
+ % prefix key
+ % 1-byte code: () .
+ % 1-byte range: () .
+ % N-byte code: . (*)
+ % N-byte range: (*) (*)
dup 2 index eq { % <code_lo> == <code_hi>
- % 0: prefix_len for 1-byte code
- % 1: prefix_len for N-byte code
+ % 0: prefix_len for 1-byte code
+ % 1: prefix_len for N-byte code
dup length 1 eq { 0 } { 1 } ifelse
} { % <code_lo> != <code_hi>
- % calculate prefix_len for *-byte range
+ % calculate prefix_len for *-byte range
dup length 1 sub % <cid_base> <code_lo> <code_hi> <code_len-1>
0 % initial value for N
{ % <cid_base> <code_lo> <code_hi> (code_len-1) N
@@ -403,13 +403,13 @@
} loop
exch pop % discard <code_len-1>
} ifelse
- % cid_base code_lo code_hi prefix_len
+ % cid_base code_lo code_hi prefix_len
% Althogh Adobe CPSI with native CID/CMap support accept
% multi-dimensional range specification in notdef & cidrange
% (and CID is calculated as relative position in multi-dimensional
% range), but older CPSI & ATM cannot handle it.
- %
+ %
% GS accepts such specification, but it's recommended to keep
% from using this feature for notdef & cidrange.
% Following is a disabler of this feature.
@@ -436,9 +436,9 @@
% -------------------------------------------------------------
1 index exch 0 exch getinterval
- % cid_base code_lo code_hi prefix
+ % cid_base code_lo code_hi prefix
dup length 3 index length exch sub
- % cid_base code_lo code_hi prefix range_len
+ % cid_base code_lo code_hi prefix range_len
dup 255 gt {
(too long coderange specification for current GS\n) print
/.endmapranges cvx /rangecheck signalerror
@@ -455,27 +455,27 @@
% make "keys" (concatenated key_lo + key_hi)
exch concatstrings
- %
+ %
4 -1 roll
.endmapvalue
- % See if we can merge with the previous value.
- % The prefix, params, and font index must match.
+ % See if we can merge with the previous value.
+ % The prefix, params, and font index must match.
% prefix params keys value fontindex
counttomark 5 gt { % 2 (or more) ranges (1 range = 5 item)
4 index 10 index eq % compare prefix
4 index 10 index eq and % compare params
1 index 7 index eq and % compare fontindex
- {
+ {
CMAPDEBUG { (merge!\n) print } if
- pop 4 2 roll pop pop
+ pop 4 2 roll pop pop
% prefix params keys value fontindex keys2 value2
- 5 -1 roll 3 -1 roll concatstrings
+ 5 -1 roll 3 -1 roll concatstrings
% prefix params value fontindex value2 keys'
- 4 -1 roll 3 -1 roll concatstrings
+ 4 -1 roll 3 -1 roll concatstrings
% prefix params fontindex keys' values'
- 3 -1 roll
- } if
+ 3 -1 roll
+ } if
} if % end of 2 (or more) ranges
} repeat
counttomark 2 add -1 roll .appendmap
@@ -512,9 +512,9 @@ languagelevel exch 2 .setlanguagelevel
/CMap /Generic /Category findresource dup length dict .copydict
dup /InstanceType /dicttype put
dup /DefineResource {
- % The AdobePS5 Windows driver emits code that attempts to
- % create CMaps without the required CMapName entry.
- % Work around this here.
+ % The AdobePS5 Windows driver emits code that attempts to
+ % create CMaps without the required CMapName entry.
+ % Work around this here.
dup /CMapName known not {
dup wcheck not {
.currentglobal exch dup wcheck .setglobal
@@ -538,9 +538,9 @@ dup /DefineResource {
/Generic /Category findresource /DefineResource get exec
} bind put
/Category defineresource pop
- % We might have loaded CID font support already.
+ % We might have loaded CID font support already.
/CIDInit /ProcSet 2 copy { findresource } .internalstopped
- % An interior `stopped' might have reset VM allocation to local.
+ % An interior `stopped' might have reset VM allocation to local.
//true .setglobal
{ pop pop 3 -1 roll }
{ dup length 4 index length add dict .copydict 4 -1 roll exch .copydict }
diff --git a/gs/Resource/Init/gs_cspace.ps b/gs/Resource/Init/gs_cspace.ps
index cf80a4ce0..6b6ef3b6c 100644
--- a/gs/Resource/Init/gs_cspace.ps
+++ b/gs/Resource/Init/gs_cspace.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2002 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -20,7 +20,7 @@
% There have been some major changes to the PostScript colour handling.
% In particular, the vast majority of the colour space code has been
% converted from PostScript to C. This file has been extensively
-% modified, as has gs_icc.ps. The remaining PostScript files which
+% modified, as has gs_icc.ps. The remaining PostScript files which
% previously implemented colour space handling; gs_ciecs2.ps, gs_ciecs3.ps
% gs_devcs.ps, gs_devn.ps, gs_devpxl.ps, gs_indxd.ps, gs_patrn.ps and
% gs_sepr.ps have been superceded by the C code and removed.
@@ -55,7 +55,7 @@ end % colorspacedict
% even if the argument presented to setcolorspace was a simple device
% space name. Not only that, but in order to satisfy some Adobe
% applications, it must be the *same* array every time. The only way
-% to do that is to define an appropriate set initial arrays and always return
+% to do that is to define an appropriate set initial arrays and always return
% one of those. These arrays are defined here.
%
/DeviceGray_array /DeviceGray 1 array astore readonly def
@@ -71,11 +71,10 @@ end % colorspacedict
%
/initgraphics
{ initgraphics systemdict /DeviceGray_array get setcolorspace }
-.bind odef
-
+.bind odef
%
-% These routines used for the NOSUBSTDEVICECOLORS switch. This prevents
+% These routines used for the NOSUBSTDEVICECOLORS switch. This prevents
% substitution of DeviceGray, DeviceRGB and DeviceCMYK with a Default*
% colour space when /UseCIEColors is true. If the job includes a
% definition of /DefaltGray, DefaultRGB or DefaultCMYK then it also executes
@@ -100,13 +99,13 @@ end % colorspacedict
cleartomark
} {
{
- % Check to see if this space was defined by defineresource, if so then
- % the job defined it, otherwise its the usual default, so ignore it.
+ % Check to see if this space was defined by defineresource, if so then
+ % the job defined it, otherwise its the usual default, so ignore it.
dup /ColorSpace resourcestatus {
pop 0 eq {
- % Default* defined by defineresource
+ % Default* defined by defineresource
systemdict /..page_default_spaces get 1 index //true put
- dup /ColorSpace findresource 4 2 roll pop pop //true
+ dup /ColorSpace findresource 4 2 roll pop pop //true
}{
cleartomark
} ifelse
@@ -122,15 +121,15 @@ end % colorspacedict
% <color_space_name> ..includecolorspace -
%
/..includecolorspace
-{
+{
% If we have already recorded this space, don't repeat it.
systemdict /..page_default_spaces get 1 index known {
pop
} {
mark exch
{
- % Check to see if this space was defined by defineresource, if so then
- % the job defined it, otherwise its the usual default, so ignore it.
+ % Check to see if this space was defined by defineresource, if so then
+ % the job defined it, otherwise its the usual default, so ignore it.
dup /ColorSpace resourcestatus {
pop 0 eq {
% Job defined /Default*, so record it and allow the device access to it
@@ -151,7 +150,7 @@ end % colorspacedict
%
/cs_substitute_generic
{ .getuseciecolor
- {NOSUBSTDEVICECOLORS
+ {NOSUBSTDEVICECOLORS
{ //..includecolorspace exec dup }
{ /ColorSpace findresource }
ifelse
@@ -177,14 +176,13 @@ bind def
/ColorSpace findresource
} {
//cs_substitute_generic exec
- } ifelse
+ } ifelse
} bind def
-end
+end
%
% Set the initial device space
%
systemdict /DeviceGray_array get setcolorspace
-
.setglobal
diff --git a/gs/Resource/Init/gs_css_e.ps b/gs/Resource/Init/gs_css_e.ps
index 0b2d6656d..2c88bc6ca 100644
--- a/gs/Resource/Init/gs_css_e.ps
+++ b/gs/Resource/Init/gs_css_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/Resource/Init/gs_dbt_e.ps b/gs/Resource/Init/gs_dbt_e.ps
index d6106671a..6421f1dcb 100644
--- a/gs/Resource/Init/gs_dbt_e.ps
+++ b/gs/Resource/Init/gs_dbt_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993, 1994 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/Resource/Init/gs_diskf.ps b/gs/Resource/Init/gs_diskf.ps
index cfe48abb5..b930a1155 100644
--- a/gs/Resource/Init/gs_diskf.ps
+++ b/gs/Resource/Init/gs_diskf.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -91,31 +91,31 @@
dup dup length 2 sub 2 getinterval <0c06> eq % seac
{ dup length
Private /lenIV known { Private /lenIV get } { 4 } ifelse
- exch 1 index sub getinterval
+ exch 1 index sub getinterval
% Parse the string just enough to extract the seac information.
% We assume that the only possible operators are hsbw, sbw, and seac,
% and that there are no 5-byte numbers.
- mark 0 3 -1 roll
- { exch
- { { dup 32 lt
- { pop 0 }
- { dup 247 lt
- { 139 sub 0 }
- { dup 251 lt
- { 247 sub 256 mul 108 add 1 1 }
- { 251 sub -256 mul -108 add -1 1 }
- ifelse
- }
- ifelse
- }
- ifelse
- } % 0
- { mul add 0 } % 1
- }
- exch get exec
- }
- forall pop
- counttomark 1 add 2 roll cleartomark % pop all but achar bchar
+ mark 0 3 -1 roll
+ { exch
+ { { dup 32 lt
+ { pop 0 }
+ { dup 247 lt
+ { 139 sub 0 }
+ { dup 251 lt
+ { 247 sub 256 mul 108 add 1 1 }
+ { 251 sub -256 mul -108 add -1 1 }
+ ifelse
+ }
+ ifelse
+ }
+ ifelse
+ } % 0
+ { mul add 0 } % 1
+ }
+ exch get exec
+ }
+ forall pop
+ counttomark 1 add 2 roll cleartomark % pop all but achar bchar
}
{ pop % not seac
}
@@ -158,35 +158,35 @@
}
/readonly % for procedures and CharStrings dictionary
{ % We want to take the following non-standard actions here:
- % - If the operand is the CharStrings dictionary, do nothing;
- % - If the operand is a number (a file position replacing the
- % actual CharString), do nothing;
- % - If the operand is either of the reading procedures (-| or -!),
- % substitute a different one.
+ % - If the operand is the CharStrings dictionary, do nothing;
+ % - If the operand is a number (a file position replacing the
+ % actual CharString), do nothing;
+ % - If the operand is either of the reading procedures (-| or -!),
+ % substitute a different one.
dup type /dicttype eq % CharStrings or Private
count 2 gt and
{ 1 index /CharStrings ne { readonly } if }
{ dup type /arraytype eq % procedure or data array
- { dup length 5 ge 1 index xcheck and
- { dup 0 get /string eq
- 1 index 1 get /currentfile eq and
- 1 index 2 get /exch eq and
- 1 index 3 get dup /readstring eq exch /readhexstring eq or and
- 1 index 4 get /pop eq and
- { /cskip_C cvx 2 packedarray cvx
- }
- { readonly
- }
- ifelse
- }
- { readonly
- }
- ifelse
- }
- { dup type /stringtype eq % must be a Subr string
- { readonly }
- if
- }
+ { dup length 5 ge 1 index xcheck and
+ { dup 0 get /string eq
+ 1 index 1 get /currentfile eq and
+ 1 index 2 get /exch eq and
+ 1 index 3 get dup /readstring eq exch /readhexstring eq or and
+ 1 index 4 get /pop eq and
+ { /cskip_C cvx 2 packedarray cvx
+ }
+ { readonly
+ }
+ ifelse
+ }
+ { readonly
+ }
+ ifelse
+ }
+ { dup type /stringtype eq % must be a Subr string
+ { readonly }
+ if
+ }
ifelse
}
ifelse
@@ -207,7 +207,7 @@ counttomark 2 idiv { .loadfontdict 3 1 roll put } repeat pop
/build_C % <font> <code|name> build_C -
{ 1 index begin
dup dup type /integertype eq { Encoding exch get } if
- % Stack: font code|name name
+ % Stack: font code|name name
dup CharStrings exch .knownget not
{ 2 copy eq { exch pop /.notdef exch } if
QUIET not
@@ -216,7 +216,7 @@ counttomark 2 idiv { .loadfontdict 3 1 roll put } repeat pop
ifelse
/.notdef CharStrings /.notdef get
} if
- % Stack: font code|name name charstring
+ % Stack: font code|name name charstring
dup type /integertype eq
{ load_C end build_C }
{ end .type1execchar }
diff --git a/gs/Resource/Init/gs_diskn.ps b/gs/Resource/Init/gs_diskn.ps
index 616f214f7..ec84c2b97 100644
--- a/gs/Resource/Init/gs_diskn.ps
+++ b/gs/Resource/Init/gs_diskn.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -25,7 +25,7 @@ systemdict begin
/.getsearchabledevs { % - .getsearchabledevs [ list_of_strings ]
//systemdict /.searchabledevs .knownget not {
.currentglobal //true .setglobal
- mark (*) {
+ mark (*) {
dup length string copy dup currentdevparams /Searchable
.knownget { not { pop } if } { pop } ifelse
} 8192 string /IODevice resourceforall
@@ -33,19 +33,19 @@ systemdict begin
% now process the array into correct SearchOrder
0 1 2 {
mark exch 2 index {
- dup currentdevparams /SearchOrder get 2 index eq
- { exch } { pop } ifelse
+ dup currentdevparams /SearchOrder get 2 index eq
+ { exch } { pop } ifelse
} forall % devices on the old list
pop
% make the array and sort it by name
- ] { lt } bind .sort
+ ] { lt } bind .sort
exch
} for
% collect all devices with SearchOrder > 2
mark 2 index {
- dup currentdevparams /SearchOrder get 2 gt
+ dup currentdevparams /SearchOrder get 2 gt
{ exch } { pop } ifelse
- } forall
+ } forall
] exch pop
% We now have 4 arrays on the stack, SO=0 SO=1 SO=2 SO>2
% make them into a single array
@@ -61,14 +61,14 @@ systemdict begin
% We could be smarter and check for %disk* device, but this
% doesn't get run enough to justify the complication
//.putdevparams
- //systemdict /.searchabledevs .forceundef
+ //systemdict /.searchabledevs .forceundef
} .bind odef % must be bound and hidden for .forceundef
% ------ extend filenameforall to handle wildcards in %dev% part of pattern -------%
/filenameforall {
count 3 ge {
2 index (%) search {
- pop pop
+ pop pop
} {
% no device specified, so search them all
pop (*%) 3 index concatstrings
@@ -100,7 +100,7 @@ systemdict begin
} forall
]
3 1 roll pop pop
- 4 -1 roll pop
+ 4 -1 roll pop
% now we need to invoke filenameforall for each of the strings
% in the array. We do this by building a procedure that is like
% an unrolled 'forall' loop. We do this to get the parameters
@@ -131,8 +131,8 @@ systemdict begin
{ 3 index concatstrings % prepend the device
{
2 index //file } .internalstopped not {
- 4 1 roll pop pop pop //true
- exit % exit with success
+ 4 1 roll pop pop pop //true
+ exit % exit with success
} {
pop pop
}
@@ -169,13 +169,13 @@ systemdict begin
{ 2 index concatstrings % prepend the device
{ //status } .internalstopped not {
{ //true 7 -2 roll pop pop //true exit } % exit with success
- if
+ if
}
if
}
forall
% If we made it this far, no devices were found to status the file
- % clean up to return 'false'
+ % clean up to return 'false'
exch pop
} {
//status
@@ -204,7 +204,7 @@ systemdict begin
% redefine devforall to process devices in numeric order
% Spec's for 'devforall' are unclear, but font downloaders may expect this
/devforall { % <proc> <scratch> devforall -
- [ { dup length string copy } 2 index //devforall ]
+ [ { dup length string copy } 2 index //devforall ]
% stack: proc scratch array_of_device_names
{ lt } .sort
% We don't really invoke the procedure with the scratch string
diff --git a/gs/Resource/Init/gs_dpnxt.ps b/gs/Resource/Init/gs_dpnxt.ps
index 3c54b5f1d..75cac505b 100644
--- a/gs/Resource/Init/gs_dpnxt.ps
+++ b/gs/Resource/Init/gs_dpnxt.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997, 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -47,56 +47,56 @@ counttomark { counttomark 1 sub def } repeat pop
% the supplied procedure(s).
/readimage { % <x> <y> <width> <height> <proc> [... <procN-1>]
- % <string> <alpha?> readimage -
+ % <string> <alpha?> readimage -
.sizeimageparams exch {
- % multiproc = true. If N > 1, store the procedures in an array.
+ % multiproc = true. If N > 1, store the procedures in an array.
exch pop 1 index { 1 add } if
- % Stack: ... string alpha? nprocs
+ % Stack: ... string alpha? nprocs
dup 1 eq {
pop //false % only 1 procedure, multiproc is irrelevant
} {
dup array 4 1 roll 3 add 2 roll astore 3 1 roll //true
} ifelse
} {
- % multiproc = false.
+ % multiproc = false.
pop pop //false
} ifelse
- % Map the rectangle to device coordinates.
- % Stack: x y w h proc(s) str alpha? multi?
+ % Map the rectangle to device coordinates.
+ % Stack: x y w h proc(s) str alpha? multi?
8 -4 roll matrix .sizeimagebox pop 8 4 roll
- % Make sure we allocate the operand array in local VM
- % to avoid a possible invalidaccess.
+ % Make sure we allocate the operand array in local VM
+ % to avoid a possible invalidaccess.
.currentglobal //false .setglobal 9 1 roll
exch { 1 } { 0 } ifelse exch % alpha is last, if present
exch 4 1 roll 8 array astore exch .setglobal
{ % Read out a block of scan lines and pass them to the procedure.
- % Stack: [x y w h alpha? proc(s) str multi?] -- we must consume this.
+ % Stack: [x y w h alpha? proc(s) str multi?] -- we must consume this.
dup 3 get 0 eq { pop exit } if
aload 9 1 roll pop exch pop currentdevice 7 1 roll
- % Always read out the data as standard (not native) pixels.
+ % Always read out the data as standard (not native) pixels.
.sizeimageparams pop pop exch .getbitsrect
- % Stack: [x y w h alpha? proc(s) str multi?] hread substr
+ % Stack: [x y w h alpha? proc(s) str multi?] hread substr
3 -1 roll
- % Stack: hread substr [x y w h alpha? proc(s) str multi?]
+ % Stack: hread substr [x y w h alpha? proc(s) str multi?]
dup 1 2 copy get 5 index add put
- % Stack: hread substr [x y' w h alpha? proc(s) str multi?]
+ % Stack: hread substr [x y' w h alpha? proc(s) str multi?]
dup 3 2 copy get 6 -1 roll sub put
- % Stack: substr [x y' w h' alpha? proc(s) str multi?]
+ % Stack: substr [x y' w h' alpha? proc(s) str multi?]
dup 5 get exch 7 get {
- % multiproc = true, pass each plane to a different procedure.
- % Stack: substr procs
+ % multiproc = true, pass each plane to a different procedure.
+ % Stack: substr procs
0 1 2 index length 1 sub {
- % Push 1 plane and its procedure under the top 2 elements.
- % Stack: ... substr procs plane#
- 2 index length 2 index length idiv % bytes per plane
- dup 2 index mul exch
- % Stack: ... substr procs plane# start length
- 4 index 3 1 roll getinterval 4 1 roll
- 2 copy get 4 1 roll pop
+ % Push 1 plane and its procedure under the top 2 elements.
+ % Stack: ... substr procs plane#
+ 2 index length 2 index length idiv % bytes per plane
+ dup 2 index mul exch
+ % Stack: ... substr procs plane# start length
+ 4 index 3 1 roll getinterval 4 1 roll
+ 2 copy get 4 1 roll pop
} for
exch pop length 2 mul .execn
} {
- % multiproc = false, just call the procedure.
+ % multiproc = false, just call the procedure.
exec
} ifelse
} //systemdict /exec get 3 packedarray cvx loop
@@ -127,8 +127,8 @@ end
% Implement sizeimage using lower-level operators.
/sizeimage { % <x> <y> <width> <height> <matrix> sizeimage
- % <devwidth> <devheight> <bits/sample> <matrix>
- % <multiproc> <ncolors>
+ % <devwidth> <devheight> <bits/sample> <matrix>
+ % <multiproc> <ncolors>
.sizeimagebox 5 -2 roll pop pop
.sizeimageparams 3 -1 roll 4 1 roll
} bind odef
diff --git a/gs/Resource/Init/gs_dps.ps b/gs/Resource/Init/gs_dps.ps
index 283618928..847e19e77 100644
--- a/gs/Resource/Init/gs_dps.ps
+++ b/gs/Resource/Init/gs_dps.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -55,20 +55,20 @@
pop pop
} {
dup type /dicttype eq {
- % Save a copy of this dictionary in global VM.
- dup maxlength dict .copydict readonly
+ % Save a copy of this dictionary in global VM.
+ dup maxlength dict .copydict readonly
} {
- pop pop
+ pop pop
} ifelse
} ifelse
} forall .dicttomark readonly put
- % Create localdicts for the current context.
+ % Create localdicts for the current context.
//false .setglobal
userdict /localdicts mark savedlocaldicts {
pop dup load
} forall /internaldict dup load
.dicttomark readonly put
- % Save a copy of the initial gstate.
+ % Save a copy of the initial gstate.
//true .setglobal
//systemdict /savedinitialgstate gstate readonly put
.setglobal
@@ -79,8 +79,8 @@
% having systemdict point to dictionaries that are in a non-current
% local VM. Because of this, we turn off garbage collection temporarily.
/.copylocal { % <name> <dict> .copylocal <name> <dict'>
- % Copy a dictionary to the current (local) VM,
- % and make it read-only if its current definition is.
+ % Copy a dictionary to the current (local) VM,
+ % and make it read-only if its current definition is.
dup maxlength dict .copydict
1 index load wcheck not { readonly } if
} .bind def
@@ -90,41 +90,41 @@
-2 vmreclaim
.currentglobal //systemdict begin
//false .setglobal
- % Since localdicts doesn't exist yet, references from
- % systemdict to local objects won't get restored if
- % a context switch happens in this code. Therefore,
- % until localdicts is defined, we have to keep all our
- % state on the operand stack.
-
- % Acquire userdict.
- %****** WRONG IF NON-STANDARD INITIAL DSTACK ******
+ % Since localdicts doesn't exist yet, references from
+ % systemdict to local objects won't get restored if
+ % a context switch happens in this code. Therefore,
+ % until localdicts is defined, we have to keep all our
+ % state on the operand stack.
+
+ % Acquire userdict.
+ %****** WRONG IF NON-STANDARD INITIAL DSTACK ******
countdictstack array dictstack
{ dup gcheck not { exit } if pop } forall
- % Create localdicts with a local copy of each dictionary,
- % except for userdict and userparams, which just need
- % to be filled in.
+ % Create localdicts with a local copy of each dictionary,
+ % except for userdict and userparams, which just need
+ % to be filled in.
mark savedlocaldicts {
1 index /userdict eq {
- % Stack: userdict mark ... /userdict inituserdict
+ % Stack: userdict mark ... /userdict inituserdict
counttomark 1 add index .copydict
} {
1 index /userparams eq {
- % Stack: userdict mark ... /userparams inituserparams
- userparams .copydict
+ % Stack: userdict mark ... /userparams inituserparams
+ userparams .copydict
} {
- .copylocal
+ .copylocal
} ifelse
} ifelse
} forall /internaldict dup .makeinternaldict .makeoperator
.dicttomark readonly /localdicts exch put
- % localdicts is now defined in userdict.
- % Copy the definitions into systemdict.
+ % localdicts is now defined in userdict.
+ % Copy the definitions into systemdict.
localdicts { .forcedef } forall
- % Set the user parameters.
+ % Set the user parameters.
userparams readonly .setuserparams
- % Establish the initial gstate(s).
+ % Establish the initial gstate(s).
/savedinitialgstate .systemvar setgstate gsave
- % Wrap up.
+ % Wrap up.
end .setglobal
} odef
@@ -138,8 +138,8 @@
% The .localfork operator does all the work, but we must ensure that
% .initlocaldicts gets called when the new context starts up.
/localfork { % <mark> <obj1> ... <objN> <proc>
- % <stdin|null> <stdout|null>
- % localfork <context>
+ % <stdin|null> <stdout|null>
+ % localfork <context>
.currentglobal //true .setglobal 3 index
dup .proccheck not {
pop .setglobal /localfork .systemvar /typecheck signalerror
@@ -153,7 +153,7 @@
% userparams dictionary for the context, but we still need to initialize
% this dictionary when the new context starts up.
/.postfork { % - .postfork -
- % Initialize the user parameters.
+ % Initialize the user parameters.
savedlocaldicts /userparams get userparams .copydict readonly pop
} odef
/fork { % <mark> <obj1> ... <objN> <proc> fork <context>
@@ -219,6 +219,6 @@ currentdict /.wtdict .undef
% ------ View clipping ------ %
/rectviewclip { % <x> <y> <width> <height> rectviewclip -
- % <numarray|numstring> rectviewclip -
+ % <numarray|numstring> rectviewclip -
newpath .rectappend viewclip
} odef
diff --git a/gs/Resource/Init/gs_dps1.ps b/gs/Resource/Init/gs_dps1.ps
index 838545faf..0eaed1d4c 100644
--- a/gs/Resource/Init/gs_dps1.ps
+++ b/gs/Resource/Init/gs_dps1.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -57,7 +57,7 @@ level2dict begin
{ /LocalFontDirectory .systemvar } % can't embed ref to local VM
ifelse .forceput pop % LocalFontDirectory is local, systemdict is global
} .bind odef % must bind .forceput and .setglobal
- % even if NOBIND in effect
+ % even if NOBIND in effect
% Don't just copy (load) the definition of .setglobal:
% it gets redefined for LL3.
/setshared { /.setglobal .systemvar exec } odef
@@ -84,11 +84,11 @@ level2dict begin
if
}
{ % Current mode is local; if there was a shadowed global
- % definition, copy it into the local directory.
+ % definition, copy it into the local directory.
//systemdict /SharedFontDirectory .knownget
{ 1 index .knownget
- { .FontDirectory 2 index 3 -1 roll { put } //superexec } % readonly
- if
+ { .FontDirectory 2 index 3 -1 roll { put } //superexec } % readonly
+ if
}
if
}
@@ -107,26 +107,26 @@ level2dict begin
/LocalFontDirectory .systemvar
FAKEFONTS
{ mark
- % We want to delete a fake font from the local directory
- % iff the global directory now has no definition for it,
- % or a non-fake definition.
+ % We want to delete a fake font from the local directory
+ % iff the global directory now has no definition for it,
+ % or a non-fake definition.
1 index dup
{ % Stack: lfd mark lfd key ... lfd key value
- length 1 gt
- { % This is a real local definition; don't do anything.
- pop
- }
- { % This is a fake local definition, check for global.
- //SharedFontDirectory 1 index .knownget
- { % A global definition exists, check for fake.
- length 1 eq { pop } { 1 index } ifelse
- }
- { % No global definition, delete the local one.
- 1 index
- }
- ifelse
- }
- ifelse
+ length 1 gt
+ { % This is a real local definition; don't do anything.
+ pop
+ }
+ { % This is a fake local definition, check for global.
+ //SharedFontDirectory 1 index .knownget
+ { % A global definition exists, check for fake.
+ length 1 eq { pop } { 1 index } ifelse
+ }
+ { % No global definition, delete the local one.
+ 1 index
+ }
+ ifelse
+ }
+ ifelse
} forall
pop counttomark 2 idiv { .forceundef } repeat pop % readonly
}
diff --git a/gs/Resource/Init/gs_dps2.ps b/gs/Resource/Init/gs_dps2.ps
index 4b81389c3..da18224ad 100644
--- a/gs/Resource/Init/gs_dps2.ps
+++ b/gs/Resource/Init/gs_dps2.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990, 1996, 1997, 1998, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -28,36 +28,36 @@ level2dict begin
% ------ Halftones ------ %
/.makestackdict
- { { counttomark -1 roll } forall .dicttomark
- } bind def
+ { { counttomark -1 roll } forall .dicttomark
+ } bind def
/currenthalftone % - currenthalftone <dict>
- { mark .currenthalftone
- { { exch pop } % halftone
- { /HalftoneType 1 % screen
- { /Frequency /Angle /SpotFunction }
- .makestackdict readonly
- }
- { /HalftoneType 2 % colorscreen
- { /RedFrequency /RedAngle /RedSpotFunction
- /GreenFrequency /GreenAngle /GreenSpotFunction
- /BlueFrequency /BlueAngle /BlueSpotFunction
- /GrayFrequency /GrayAngle /GraySpotFunction
- }
- .makestackdict readonly
- }
- }
- exch get exec
- } odef
+ { mark .currenthalftone
+ { { exch pop } % halftone
+ { /HalftoneType 1 % screen
+ { /Frequency /Angle /SpotFunction }
+ .makestackdict readonly
+ }
+ { /HalftoneType 2 % colorscreen
+ { /RedFrequency /RedAngle /RedSpotFunction
+ /GreenFrequency /GreenAngle /GreenSpotFunction
+ /BlueFrequency /BlueAngle /BlueSpotFunction
+ /GrayFrequency /GrayAngle /GraySpotFunction
+ }
+ .makestackdict readonly
+ }
+ }
+ exch get exec
+ } odef
% Define sethalftone so it converts types 1-4 to type 5.
/.makehalftoneRGBV { % <dict> <type> <keys> <keysRGBV>
4 -1 roll exch { 1 index exch get exch } forall 15 1 roll
14 -2 roll mark 15 1 roll { /Gray /Blue /Green /Red } {
- % stack: v0 v1 v2 type keys comp
+ % stack: v0 v1 v2 type keys comp
mark
2 index 0 get 8 -1 roll
4 index 1 get 9 -1 roll
6 index 2 get 10 -1 roll
- % stack: type keys comp mark k0 v0 k1 v1 k2 v2
+ % stack: type keys comp mark k0 v0 k1 v1 k2 v2
/HalftoneType 10 index .dicttomark
counttomark 2 roll
} forall pop pop
@@ -96,29 +96,29 @@ systemdict begin
5 {
pop dup length dict copy
mark 1 index {
- % Even HalftoneType 5 dictionaries have entries other than
- % subsidiary halftone dictionaries.
+ % Even HalftoneType 5 dictionaries have entries other than
+ % subsidiary halftone dictionaries.
dup type /dicttype ne {
- 0
+ 0
} {
- dup /HalftoneType .knownget not { 0 } if
+ dup /HalftoneType .knownget not { 0 } if
} ifelse dup 5 gt {
- % Stack: dict mark ... keyN dictN httypeN
- % Assume that all HalftoneTypes > 5 convert to 5.
- 1 index 3 1 roll
- //.halftonetypes exch get exec pop /Default get
- % Stack: dict mark ... keyN setdict'N htdict'N
- counttomark 1 add index 3 index 4 -1 roll put
+ % Stack: dict mark ... keyN dictN httypeN
+ % Assume that all HalftoneTypes > 5 convert to 5.
+ 1 index 3 1 roll
+ //.halftonetypes exch get exec pop /Default get
+ % Stack: dict mark ... keyN setdict'N htdict'N
+ counttomark 1 add index 3 index 4 -1 roll put
} {
- pop
+ pop
} ifelse
} forall .dicttomark { .sethalftone5 }
} bind def
end
end
/sethalftone { % <dict> sethalftone -
- % We must create the new dictionary in the same VM as the
- % operand; otherwise, invalidaccess errors may occur.
+ % We must create the new dictionary in the same VM as the
+ % operand; otherwise, invalidaccess errors may occur.
.currentglobal 1 .argindex dup gcheck .setglobal
dup //.halftonetypes 1 index /HalftoneType get
dup type /integertype ne {
@@ -134,7 +134,7 @@ end
% and to insert the Frequency and Angle into Type 1 halftones, per
% Adobe TN 5085.
/.fixsethalftonescreen % <freq> <angle> <dict> .fix...screen
- % <freq> <angle> <dict> <dict'>
+ % <freq> <angle> <dict> <dict'>
{ dup dup /HalftoneType get 1 eq
{ dup wcheck not { dup length dict .copydict } if
dup /Frequency 5 index put
@@ -144,17 +144,17 @@ end
if
} bind def
/setscreen % <ignore*2> <dict> setscreen -
- { dup type /dicttype eq
- { .fixsethalftonescreen sethalftone pop pop pop }
- { //setscreen }
- ifelse
- } .bind odef
+ { dup type /dicttype eq
+ { .fixsethalftonescreen sethalftone pop pop pop }
+ { //setscreen }
+ ifelse
+ } .bind odef
/setcolorscreen % <ignore*11> <dict> setcolorscreen -
- { dup type /dicttype eq
- { .fixsethalftonescreen sethalftone 12 { pop } repeat }
- { //setcolorscreen }
- ifelse
- } .bind odef
+ { dup type /dicttype eq
+ { .fixsethalftonescreen sethalftone 12 { pop } repeat }
+ { //setcolorscreen }
+ ifelse
+ } .bind odef
% Redefine currentscreen and currentcolorscreen to extract the Frequency
% and Angle from Type 1 halftones, per Adobe TN 5085.
/.fixcurrenthalftonescreen % <dict> .fix... <freq> <angle> <proc>
@@ -164,22 +164,22 @@ end
ifelse 3 2 roll
} bind def
/currentscreen % - currentscreen 60 0 <dict>
- { .currenthalftone
- { { .fixcurrenthalftonescreen } % halftone
- { } % screen
- { 12 3 roll 9 { pop } repeat % colorscreen
- dup type /dicttype eq { .fixcurrenthalftonescreen } if
- }
- }
- exch get exec
- } odef
+ { .currenthalftone
+ { { .fixcurrenthalftonescreen } % halftone
+ { } % screen
+ { 12 3 roll 9 { pop } repeat % colorscreen
+ dup type /dicttype eq { .fixcurrenthalftonescreen } if
+ }
+ }
+ exch get exec
+ } odef
/currentcolorscreen % - currentcolorscreen (60 0 <dict>)*4
{ .currenthalftone
{ { .fixcurrenthalftonescreen 3 copy 6 copy } % halftone
{ % screen
- % The procedure might not be readable....
- dup rcheck { dup length array copy cvx } if
- 3 copy 6 copy
+ % The procedure might not be readable....
+ dup rcheck { dup length array copy cvx } if
+ 3 copy 6 copy
}
{ } % colorscreen
}
@@ -198,11 +198,11 @@ end
/defineuserobject { % <index> <value> defineuserobject -
1 index 65535 gt {
% .localvmarray throws limitcheck but CET 31-02 wants rangecheck
- /defineuserobject .systemvar /rangecheck signalerror
+ /defineuserobject .systemvar /rangecheck signalerror
} if
.UserObjects .knownget {
length dup 3 .argindex le {
- % Stack: index value len
+ % Stack: index value len
2 index eq { 1 index 2 mul } { 1 index 1 add } ifelse
.localvmarray .UserObjects get
1 index copy pop
@@ -217,14 +217,14 @@ end
} odef
/execuserobject { % <index> execuserobject -
dup type /integertype ne {
- % Adobe validates the argument before accessing UserObjects - CET 31-03
- /execuserobject .systemvar /typecheck signalerror
+ % Adobe validates the argument before accessing UserObjects - CET 31-03
+ /execuserobject .systemvar /typecheck signalerror
} if
.UserObjects get 1 .argindex get exch pop exec
} odef
/undefineuserobject { % <index> undefineuserobject -
dup type /integertype ne {
- % Adobe validates the argument before accessing UserObjects - CET 31-11
+ % Adobe validates the argument before accessing UserObjects - CET 31-11
/undefineuserobject .systemvar /typecheck signalerror
} if
.UserObjects get 1 .argindex //null put pop
@@ -235,12 +235,12 @@ end
% Dummy definitions for cache control operators
/ucachestatus { % - ucachestatus -mark- ? ? ? ? <size>
- mark 0 0 0 0 /MaxUPathItem getuserparam
+ mark 0 0 0 0 /MaxUPathItem getuserparam
} odef
/setucacheparams { % -mark- ... <size> setucacheparams -
- % Provoke an appropriate error if needed.
- counttomark 1 lt { () 0 get } if
- dup 0 or /MaxUPathItem getuserparam .max
+ % Provoke an appropriate error if needed.
+ counttomark 1 lt { () 0 get } if
+ dup 0 or /MaxUPathItem getuserparam .max
1 dict dup /MaxUPathItem 4 -1 roll put setuserparams cleartomark
} odef
diff --git a/gs/Resource/Init/gs_dscp.ps b/gs/Resource/Init/gs_dscp.ps
index eb7a0ab5b..0509b8c2f 100644
--- a/gs/Resource/Init/gs_dscp.ps
+++ b/gs/Resource/Init/gs_dscp.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -17,8 +17,8 @@
% Postscript interface routines to DSC parser
/send_orientation { % <orientation> send_orientation -
- % .parse_dsc_comments returns -1 for an Orientation key with an
- % unrecognized value.
+ % .parse_dsc_comments returns -1 for an Orientation key with an
+ % unrecognized value.
dup 0 ge {
<< /Orientation 2 index >> setpagedevice
} if pop
@@ -30,8 +30,8 @@
/DSCparseprocs mark
/Orientation { dup /Orientation get send_orientation } bind
/PageOrientation { dup /PageOrientation .knownget { send_orientation }
- { dup /Orientation .knownget { send_orientation } if }
- ifelse } bind
+ { dup /Orientation .knownget { send_orientation } if }
+ ifelse } bind
/Page { dup /Orientation .knownget { send_orientation } if } bind
/NOP { } bind
.dicttomark readonly def
@@ -39,8 +39,8 @@
% This procedure is called whenever a DSC comment is found by the interpreter
/do_parse_dsc //false def
/parse_dsc { % <file> <DSC string> [<prev proc>]
- % parse_dsc -
- % Run any previously installed parser.
+ % parse_dsc -
+ % Run any previously installed parser.
0 get dup //null eq { pop } { 3 copy exec pop } ifelse
do_parse_dsc { % Check if this parser is enabled
@@ -57,7 +57,6 @@
pop pop % remove file, dict
} bind def
-
% Check whether the currently installed parser is the one defined in this file.
/.using_parse_dsc { % - .using_parse_dsc <proc> <using?>
currentuserparams /ProcessDSCComment get
@@ -78,11 +77,11 @@ userdict /dsc_dict //null put
/dsc_dict 50 dict store % Size must be large enough for all DSC values
dsc_dict .initialize_dsc_parser
.using_parse_dsc {
- % Already using this parser.
+ % Already using this parser.
pop
} {
- % Encapsulate the previous parser. We know it is in global VM:
- % allocate the new one in global VM as well.
+ % Encapsulate the previous parser. We know it is in global VM:
+ % allocate the new one in global VM as well.
1 array astore
/parse_dsc load /exec load 3 array astore cvx readonly
<< /ProcessDSCComment 3 -1 roll >>
@@ -92,7 +91,6 @@ userdict /dsc_dict //null put
/do_parse_dsc //true def
} bind def
-
% Enable the DSC parser defined in this file.
% - enable_dsc -
/enable_dsc {
@@ -102,10 +100,10 @@ userdict /dsc_dict //null put
% Disable the DSC parser defined in this file.
% - disable_dsc -
/disable_dsc {
- % There might be another parser installed: if so, restore it.
- % (If it has encapsulated our parser, we can't.)
+ % There might be another parser installed: if so, restore it.
+ % (If it has encapsulated our parser, we can't.)
.using_parse_dsc {
- % Restore the parser we encapsulated.
+ % Restore the parser we encapsulated.
0 get 0 get
currentglobal //true setglobal exch
<< /ProcessDSCComment 3 -1 roll >>
@@ -113,6 +111,6 @@ userdict /dsc_dict //null put
} {
pop
} ifelse
- % If we couldn't restore the old parser, at least disable ours.
+ % If we couldn't restore the old parser, at least disable ours.
/do_parse_dsc //false def
} bind def
diff --git a/gs/Resource/Init/gs_epsf.ps b/gs/Resource/Init/gs_epsf.ps
index c5efaa41f..6b444c330 100644
--- a/gs/Resource/Init/gs_epsf.ps
+++ b/gs/Resource/Init/gs_epsf.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989, 1996, 2002 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -14,7 +14,7 @@
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
% $Id$
-% Allow the interpreter to encapsulate EPS files, to recognize MS-DOS
+% Allow the interpreter to encapsulate EPS files, to recognize MS-DOS
% EPSF file headers, and skip to the PostScript section of the file.
% Encapsulate EPS files and optionally resize page or rescale image.
@@ -54,9 +54,9 @@
% translate to new origin at lower left of clippath
3 index 3 index translate
% calculate scale to fit smaller of width or height
- exch 4 -1 roll sub 3 1 roll exch sub
+ exch 4 -1 roll sub 3 1 roll exch sub
4 2 roll 5 index 5 index 4 2 roll
- exch 4 -1 roll sub 3 1 roll exch sub
+ exch 4 -1 roll sub 3 1 roll exch sub
4 2 roll
exch 4 -1 roll div 3 1 roll exch div
1 index 1 index lt {pop}{exch pop} ifelse
@@ -67,41 +67,40 @@
% Crop the page to the BoundingBox
/EPSBoundingBoxCrop { % llx lly urx ury --
- EPSDEBUG {
- (gs_epsf.ps: Setting pagesize from EPS bounding box\n) print flush
+ EPSDEBUG {
+ (gs_epsf.ps: Setting pagesize from EPS bounding box\n) print flush
} if
exch 3 index sub exch 2 index sub % stack: llx lly urx-llx ury-lly
<< /PageSize [ 5 -2 roll ] >> setpagedevice
neg exch neg exch translate
} bind def
-
/EPSBoundingBoxProcess { % (llx lly urx ury) state --
//systemdict /EPSBoundingBoxState get 1 index lt {
- exch EPSBoundingBoxParse
+ exch EPSBoundingBoxParse
{
//systemdict /EPSCrop known {
EPSBoundingBoxCrop
} {
//systemdict /EPSFitPage known {
EPSBoundingBoxFitPage
- } {
- % Warn if some of the EPS file will be clipped
- clippath pathbbox newpath
- { % context for exit
- 5 -1 roll lt { 6 { pop } repeat //true exit } if
- 4 -1 roll lt { 4 { pop } repeat //true exit } if
- 3 -1 roll gt { 2 { pop } repeat //true exit } if
- exch gt { //true exit } if
- //false exit
- } loop
- QUIET not and /EPSBoundingBoxState .systemvar 1 and 1 eq and {
- (\n **** Warning: Some of the BoundingBox for the EPS file will be clipped.) =
- ( Use -dEPSCrop or -dEPSFitPage to avoid clipping.\n) =
- flush
+ } {
+ % Warn if some of the EPS file will be clipped
+ clippath pathbbox newpath
+ { % context for exit
+ 5 -1 roll lt { 6 { pop } repeat //true exit } if
+ 4 -1 roll lt { 4 { pop } repeat //true exit } if
+ 3 -1 roll gt { 2 { pop } repeat //true exit } if
+ exch gt { //true exit } if
+ //false exit
+ } loop
+ QUIET not and /EPSBoundingBoxState .systemvar 1 and 1 eq and {
+ (\n **** Warning: Some of the BoundingBox for the EPS file will be clipped.) =
+ ( Use -dEPSCrop or -dEPSFitPage to avoid clipping.\n) =
+ flush
1 add
} if
- } ifelse
+ } ifelse
} ifelse
EPSBoundingBoxSetState
} {
@@ -121,17 +120,17 @@
5 EPSBoundingBoxSetState
} {
(%%BoundingBox:) anchorsearch {
- pop
- EPSDEBUG { (gs_epsf.ps: found %%BoundingBox\n) print flush } if
- 1 EPSBoundingBoxProcess
+ pop
+ EPSDEBUG { (gs_epsf.ps: found %%BoundingBox\n) print flush } if
+ 1 EPSBoundingBoxProcess
} {
- (%%HiResBoundingBox:) anchorsearch {
- pop
- EPSDEBUG { (gs_epsf.ps: found %%HiResBoundingBox\n) print flush } if
- 3 EPSBoundingBoxProcess
- } {
- pop % Not interested in this DSC comment
- } ifelse
+ (%%HiResBoundingBox:) anchorsearch {
+ pop
+ EPSDEBUG { (gs_epsf.ps: found %%HiResBoundingBox\n) print flush } if
+ 3 EPSBoundingBoxProcess
+ } {
+ pop % Not interested in this DSC comment
+ } ifelse
} ifelse
} ifelse
} if
@@ -142,7 +141,7 @@
systemdict /NOEPS known not {
% Merge ProcessEPSComment with existing handler
/ProcessEPSComment load /exec load
- currentuserparams /ProcessDSCComment get
+ currentuserparams /ProcessDSCComment get
dup //null eq {pop {pop pop}} if /exec load
4 array astore cvx readonly
<< /ProcessDSCComment 3 -1 roll >> setuserparams
@@ -155,10 +154,10 @@
/runEPS_save save def
/runEPS_dict_count countdictstack def
/runEPS_op_count count 2 sub def
- /runEPS_page_count currentpagedevice /PageCount get def
+ /runEPS_page_count currentpagedevice /PageCount get def
0 EPSBoundingBoxSetState
.runNoEPS
- currentpagedevice /PageCount get runEPS_page_count sub 0 eq
+ currentpagedevice /PageCount get runEPS_page_count sub 0 eq
{ /showpage load exec } if
count runEPS_op_count sub {pop} repeat
countdictstack runEPS_dict_count sub {end} repeat
@@ -200,34 +199,33 @@
} ifelse
} bind odef
-
% Handle DOS EPS files.
/.runnoepsf /run load def
/.epsfheader <C5D0D3C6> def
/run
{ dup type /filetype ne { (r) file } if
- % Check for MS-DOS EPSF file (see Red Book p. 729).
- dup ( ) .peekstring
+ % Check for MS-DOS EPSF file (see Red Book p. 729).
+ dup ( ) .peekstring
{ .epsfheader eq { dup ( ) readstring exch pop } { //false } ifelse }
{ pop //false }
ifelse
- % Stack: file true/false
+ % Stack: file true/false
{ % This block is executed if the file is MS-DOS EPSF.
- % Build up the little-endian byte offset and length.
+ % Build up the little-endian byte offset and length.
2
- { 1 0 4
- { 2 index read not { pop exit } if % if EOF, let error happen
- 2 index mul add exch 256 mul exch
- }
- repeat exch pop exch
- }
+ { 1 0 4
+ { 2 index read not { pop exit } if % if EOF, let error happen
+ 2 index mul add exch 256 mul exch
+ }
+ repeat exch pop exch
+ }
repeat
- % Stack: offset length file
- % Use flushfile to skip quickly to the start of the
- % PostScript section.
+ % Stack: offset length file
+ % Use flushfile to skip quickly to the start of the
+ % PostScript section.
dup 4 -1 roll 12 sub () /SubFileDecode filter flushfile
- % Now interpret the PostScript.
+ % Now interpret the PostScript.
exch () /SubFileDecode filter cvx run
}
{ .runnoepsf
diff --git a/gs/Resource/Init/gs_fapi.ps b/gs/Resource/Init/gs_fapi.ps
index b212d389a..551850088 100644
--- a/gs/Resource/Init/gs_fapi.ps
+++ b/gs/Resource/Init/gs_fapi.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -78,20 +78,20 @@ languagelevel 2 .setlanguagelevel
/Config
<<
% If we've got a FAPIConfig, run it now.
- systemdict /FAPIconfig known
+ systemdict /FAPIconfig known
{
/FAPIconfig .systemvar .runlibfile
} if
-
+
% Now setup defaults for any entries not set above - these defaults are correct
% for FAPI/Freeetype
currentdict /FontPath known not { /FontPath (/Fonts)} if % A default directory for FAPI-handled font files
- % path in FAPIfontmap.
+ % path in FAPIfontmap.
currentdict /CIDFontPath known not { /CIDFontPath (/CIDFonts)} if % A default directory for FAPI-handled CIDfont % files path in FAPIcidfmap.
currentdict /HookDiskFonts known not { /HookDiskFonts [1 2 9 11 42] } if % FontType values for disk PS fonts to be
- % redirected to FAPI.
+ % redirected to FAPI.
currentdict /HookEmbeddedFonts known not { /HookEmbeddedFonts [1 2 9 11 42] } if % FontType values for embedded PS fonts to be
- % redirected to FAPI.
+ % redirected to FAPI.
/ServerOptions 2 dict
>> def
systemdict /.FAPIconfig //Config put
@@ -108,7 +108,7 @@ systemdict /UFST_PlugIn .knownget {
} if
dup length 0 ne {
//Config /ServerOptions get exch /UFST exch put
-} {
+} {
pop
} ifelse
@@ -195,7 +195,7 @@ currentdict end def
/ReadFCOfontmap: cvx /rangecheck signalerror
} if
} ifelse
- findencoding
+ findencoding
exch dup token not {
//null
} {
@@ -203,13 +203,13 @@ currentdict end def
/ReadFCOfontmap: cvx /rangecheck signalerror
} if
/Decoding findresource
- } ifelse
+ } ifelse
exch closefile % index name enc dec|null
- 4 3 roll % name enc dec|null index
+ 4 3 roll % name enc dec|null index
<< /Path fontfile
- /FontType 1
- /FAPI /UFST
- /SubfontId counttomark 2 add -1 roll
+ /FontType 1
+ /FAPI /UFST
+ /SubfontId counttomark 2 add -1 roll
/Decoding counttomark 2 add -1 roll
dup //null eq {
pop pop
@@ -235,7 +235,7 @@ currentdict end def
/CharStrings
<<
/.notdef ( )
- StandardEncoding { ( ) } forall
+ StandardEncoding { ( ) } forall
>>
% FontBBox will get replaced with valid numbers pulled from the rendering engine
/FontBBox [-128 -128 1024 1024] cvx
@@ -248,7 +248,6 @@ currentdict end def
currentdict /fontfile undef
} bind def
-
%----------------------------------The Redefintion---------------------
/MappedCategoryRedefiner /ProcSet findresource /Redefine get /Redefine exch def
@@ -300,8 +299,8 @@ currentdict end Redefine
%
% 3. Executing .loadfont, we place /FAPI_hook_disable in the 0th
% element of some procedure on the execution stack - see gs_fonts.ps .
-% If FAPI_hook finds /FAPI_hook_disable in there,
-% it knows that it is called for a disk font during
+% If FAPI_hook finds /FAPI_hook_disable in there,
+% it knows that it is called for a disk font during
% its internal definefont.
%
% 4. If font dictionary has no /FAPI entry, and has no /Path entry,
@@ -313,18 +312,18 @@ currentdict end Redefine
% HookDiskFonts controls disk PS fonts (which fall into (2) and (3) ).
% HookEmbeddedFonts controls fonts being embedded into documents.
%
-% 7. We apply the operator .passtoFAPI for checking whether FAPI can handle a font.
+% 7. We apply the operator .passtoFAPI for checking whether FAPI can handle a font.
% If so, we insert /FAPI entry into the font dictionary and convert it
% with .FAPIrebuildfont . Otherwise the font is handled with the native GS font renderer.
/FAPI_hook_debug % <proc> FAPI_hook_debug -
FAPIDEBUG { {exec} } { {pop} } ifelse
bind def
-
+
/FAPI_hook_warn % <proc> FAPI_hook_debug -
QUIET { {pop} } { {exec} } ifelse
bind def
-
+
/FAPI_is_hook_disabled % - FAPI_is_hook_disabled <bool>
{ % checks whether execution stack contains packedarray started with /FAPI_hook_disable .
/FAPI_hook_disable /MappedCategoryRedefiner /ProcSet findresource /execstack_lookup get exec
@@ -365,7 +364,7 @@ bind def
{
1 index //GetFontType exec //FindInArray exec % name <<font>> bHook
} ifelse
-
+
{ { (Trying to render the font ) print //PrintFontRef exec ( with FAPI...) = } //FAPI_hook_debug exec
//.FAPIpassfont {
{ //PrintFontRef exec ( is being rendered with FAPI=) print dup /FAPI get = } //FAPI_hook_debug exec
@@ -376,7 +375,7 @@ bind def
} {
{ (The font ) print //PrintFontRef exec ( doesn't need to render with FAPI.) = } //FAPI_hook_debug exec
} ifelse
-
+
% Remove the plugin request from the font dictionary
dup /FAPIPlugInReq undef
} ifelse
diff --git a/gs/Resource/Init/gs_fntem.ps b/gs/Resource/Init/gs_fntem.ps
index 1d6a89b47..e3ec45782 100644
--- a/gs/Resource/Init/gs_fntem.ps
+++ b/gs/Resource/Init/gs_fntem.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -43,7 +43,6 @@ systemdict exch /.xlatmap exch put
%-------------------------------Font--------------------------------
-
/FontCommon % - font_common -
{ currentdict /PaintType known not {
/PaintType 0 def
@@ -63,7 +62,7 @@ systemdict exch /.xlatmap exch put
/TypeKey /FontType def
1
- {
+ {
currentdict /FontMatrix known not { /FontMatrix [0.001 0 0 0.001 0 0] def } if
currentdict /FontBBox known not { /FontBBox [-128 -128 1024 1024] cvx def } if % zfapi.ps refines it.
/Private 0 dict def
@@ -93,9 +92,9 @@ currentdict end def
{ RESMPDEBUG { (fntem TranslateCSI beg ) = } if
begin
CSI length 2 eq {
- << /Registry (Adobe)
- /Ordering CSI aload pop
- /Supplement exch
+ << /Registry (Adobe)
+ /Ordering CSI aload pop
+ /Supplement exch
>>
} {
<< /Registry CSI 0 get
@@ -114,17 +113,17 @@ currentdict end def
/CIDCount 1 def % ChooseDecoding will set a reasonable value.
} bind def
-% GFlyph substitution table for narrow, wide, proportional glyphs -
+% GFlyph substitution table for narrow, wide, proportional glyphs -
% used with TrueTypes.
currentpacking //false setpacking
-/SubstNWP <<
+/SubstNWP <<
% Array format : orig_type, beg_CID, end_CID, subst_beg_CID, subst_type
% type = (n==narrow, w==wide, p==proportional).
/Japan1
- { p 1 94 231 n
+ { p 1 94 231 n
p 17 26 780 w
p 34 59 790 w
@@ -165,7 +164,7 @@ currentpacking //false setpacking
/GB1
{ p 2 94 814 n
-
+
p 2 94 262 w
p 1 1 7716 n
@@ -273,7 +272,7 @@ currentdict end def
pop (*) { dup cvn
EncodingDirectory exch .knownget not {
% A work around bug 688710 on Linux :
- % findencoding can't load resource files until gs_init.ps executes .fixresources .
+ % findencoding can't load resource files until gs_init.ps executes .fixresources .
% It will happen after gs_init.ps runs INITFILES,
% from which the current file runs.
% Windows build has no such problem.
@@ -290,8 +289,8 @@ currentdict end def
} {
exch cvn exch
} ifelse
- exch
- } 1024 string /Encoding resourceforall
+ exch
+ } 1024 string /Encoding resourceforall
} if
.dicttomark def
@@ -326,7 +325,7 @@ currentdict end def
}
{
//true
- } ifelse
+ } ifelse
{
% unknown encoding, or an encoding for which we don't have a
@@ -397,7 +396,7 @@ currentdict end def
{
% If the font is maintained by FAPI, or if it is TT-emulated CID font,
% it already has /Decoding. But its value isn't guaranteeed to
- % be an Unicode decoding. Since we can't determine whether
+ % be an Unicode decoding. Since we can't determine whether
% it is an Unicode decoding, we unconditionally load an appropriate Unicode decoding
% and attach it with /GlyphNames2Unicode entry.
%
diff --git a/gs/Resource/Init/gs_fonts.ps b/gs/Resource/Init/gs_fonts.ps
index 513691aa8..771961adf 100644
--- a/gs/Resource/Init/gs_fonts.ps
+++ b/gs/Resource/Init/gs_fonts.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990-2003 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -128,8 +128,8 @@ userdict /Fontmap .FontDirectory maxlength dict put
0 1 2 index length 1 sub {
% stack: fontname filename fontnamestring addflag newstring index
dup 4 index exch 2 mul get 0 ne {
- % High byte of pair is not \000
- pop pop //false exch
+ % High byte of pair is not \000
+ pop pop //false exch
exit
} if
dup 4 index exch 2 mul 1 add get 2 index 3 1 roll put
@@ -366,7 +366,7 @@ FONTPATH length 0 eq { (%END FONTPATH) .skipeof } if
% of strings: what the system thinks is the ps name,
% and the access path.
/.setnativefontmapbuilt { % set whether we've been run
- systemdict exch /.nativefontmapbuilt exch .forceput
+ systemdict exch /.nativefontmapbuilt exch .forceput
} .bind executeonly def
systemdict /NONATIVEFONTMAP known .setnativefontmapbuilt
/.buildnativefontmap { % - .buildnativefontmap <bool>
@@ -382,13 +382,13 @@ systemdict /NONATIVEFONTMAP known .setnativefontmapbuilt
% verify the font name ourselves
dup 1 get (r) { file } stopped
{
- % skip the entry if we can't open the returned path
+ % skip the entry if we can't open the returned path
pop pop pop
}{
% we could open the font file
.findfontname
not { dup 0 get } if % stack: (newname) [ (name) (path) ]
- % DEBUG { ( found ) print dup print (\n) print flush } if
+ % DEBUG { ( found ) print dup print (\n) print flush } if
% add entry to the fontmap
1 index exch 0 exch dup type /nametype ne {cvn} if put
aload pop .definefontmap
@@ -425,7 +425,7 @@ buildfontdict 3 /.buildfont3 cvx put
{ dup wcheck not { dup maxlength dict .copydict } if
}
ifelse
- } bind def
+ } bind def
/.completefont {
{ % Check for disabled platform fonts.
NOPLATFONTS
@@ -879,7 +879,7 @@ $error /SubstituteFont { } put
% now and look for the font again.
.scannextfontdir {
% Start over with an empty alias list.
- counttomark 1 sub { pop } repeat % mark <fontname>
+ counttomark 1 sub { pop } repeat % mark <fontname>
.dofindfont
} {
% No more directories to scan. Try building the native
@@ -907,7 +907,7 @@ $error /SubstituteFont { } put
%
% igorm: I guess the surrounding code assumes that .stdsubstfont
% must ADD an alias to allow .checkalias and .findfont to work properly.
- % Also I guess that a trailing recursion is
+ % Also I guess that a trailing recursion is
% used in .dofindfont and through .stdsubstfont
% just to represent a simple iteration,
% which accumulates the aliases after the mark.
@@ -979,7 +979,6 @@ $error /SubstituteFont { } put
} ifelse
} .bind odef % must be bound and hidden for .forceput
-
% Attempt to load a font from a file.
/.tryloadfont { % <fontname> .tryloadfont <font> true
% <fontname> .tryloadfont false
@@ -1013,14 +1012,14 @@ $error /SubstituteFont { } put
} if
% check <libflag>
- {
+ {
findlibfile not
} {
dup (r) { file } stopped {
pop pop //true
} {
//false
- } ifelse
+ } ifelse
} ifelse {
QUIET not
{ (Can't find \(or can't open\) font file ) print dup print
@@ -1076,7 +1075,7 @@ $error /SubstituteFont { } put
% Check to make sure the font was actually loaded.
dup 3 index .fontknownget
{ dup /PathLoad 4 index //.putgstringcopy exec
- 4 1 roll pop pop pop //true exit
+ 4 1 roll pop pop pop //true exit
} if
% Maybe the file had a different FontName.
diff --git a/gs/Resource/Init/gs_frsd.ps b/gs/Resource/Init/gs_frsd.ps
index 9ae0a930f..31f4e8abb 100644
--- a/gs/Resource/Init/gs_frsd.ps
+++ b/gs/Resource/Init/gs_frsd.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -22,20 +22,20 @@ level2dict begin
% ------ ReusableStreamDecode filter ------ %
/.reusablestreamdecode { % <source> <dict> .reusablestreamdecode <file>
- % <source> .reusablestreamdecode <file>
- % Collect the filter parameters.
+ % <source> .reusablestreamdecode <file>
+ % Collect the filter parameters.
dup type /dicttype eq { 2 copy } { dup 0 dict } ifelse
dup .rsdparams
- % Construct the filter pipeline.
- % The very first filter should use the value of CloseSource
- % from the RSD dictionary; all the others should have
- % CloseSource = true.
- % Stack: source dict filters parms
+ % Construct the filter pipeline.
+ % The very first filter should use the value of CloseSource
+ % from the RSD dictionary; all the others should have
+ % CloseSource = true.
+ % Stack: source dict filters parms
2 index /CloseSource .knownget not { //false } if 5 -1 roll
- % Stack: dict filters parms CloseSource source
+ % Stack: dict filters parms CloseSource source
0 1 5 index length 1 sub {
4 index 1 index get
- % Stack: dict filters parms CloseSource source index filtname
+ % Stack: dict filters parms CloseSource source index filtname
4 index //null eq {
0 dict
} {
@@ -44,34 +44,34 @@ level2dict begin
3 -1 roll pop exch filter
exch pop //true exch % set CloseSource for further filters
} for
- % If AsyncRead is true, try to create the filter directly.
- % Stack: dict filters parms CloseSource source
+ % If AsyncRead is true, try to create the filter directly.
+ % Stack: dict filters parms CloseSource source
4 index /AsyncRead .knownget not { //false } if {
1 index { .reusablestream } .internalstopped
} {
//null //true
} ifelse {
pop
- % No luck. Read the entire contents of the stream now.
+ % No luck. Read the entire contents of the stream now.
dup type /filetype ne {
- % Make a stream from a procedure or string data source.
+ % Make a stream from a procedure or string data source.
0 () .subfiledecode
} if
- % We must allocate the string in the same VM space as its
- % source, since the reusable stream must be allocated there.
+ % We must allocate the string in the same VM space as its
+ % source, since the reusable stream must be allocated there.
.currentglobal 1 index gcheck .setglobal exch
currentpacking //false setpacking exch
- % Stack: dict filters parms CloseSource oldglobal oldpacking file
+ % Stack: dict filters parms CloseSource oldglobal oldpacking file
[ exch { dup 40000 string readstring not { exit } if exch } loop
exch pop
]
- % Stack: dict filters parms CloseSource oldglobal oldpacking [()...]
+ % Stack: dict filters parms CloseSource oldglobal oldpacking [()...]
3 1 roll setpacking setglobal
- % Stack: dict filters parms CloseSource [()...]
+ % Stack: dict filters parms CloseSource [()...]
1 index .reusablestream
} if
- % We created the stream successfully: clean up.
+ % We created the stream successfully: clean up.
4 { exch pop } repeat
1 index type /dicttype eq { exch pop } if exch pop
} odef
diff --git a/gs/Resource/Init/gs_icc.ps b/gs/Resource/Init/gs_icc.ps
index 93f79f51c..252a2f9dc 100644
--- a/gs/Resource/Init/gs_icc.ps
+++ b/gs/Resource/Init/gs_icc.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2001, 2002 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -56,29 +56,29 @@ systemdict begin
% an array of strings. This string can be used directly as a
% source for ReusableStreamDecode filter.
%
- % stack: --file-- (%%BeginICCProfile: ...)
+ % stack: --file-- (%%BeginICCProfile: ...)
1 index 0 (%%EndICCProfile) /SubFileDecode filter
[ { counttomark 1 add index
64000 string readhexstring
not { exit } if
} loop
] exch closefile
-
+
% make a seekable -file- out of the string array
mark /AsyncRead //true .dicttomark /ReusableStreamDecode filter
- % stack: --file-- (%%BeginICCProfile: ...) --icc_subfile--
+ % stack: --file-- (%%BeginICCProfile: ...) --icc_subfile--
dup 16 setfileposition
dup (1234) readstring pop
1 index 0 setfileposition
-
- //cs-sig-dict exch .knownget {
+
+ //cs-sig-dict exch .knownget {
3 dict begin
/Alternate {0 /DeviceGray 0 /DeviceRGB /DeviceCMYK } 2 index get def
/N exch def
/DataSource exch def
[/ICCBased currentdict]
- end
+ end
{ setcolorspace } stopped {
pop
QUIET not { ( *** Unable to load ICC profile from PostScript DSC comments ***) = flush } if
@@ -95,7 +95,7 @@ currentdict /cs-sig-dict undef
% Merge ProcessICCcomment with existing handler
/.ProcessICCcomment load /exec load
-currentuserparams /ProcessDSCComment get
+currentuserparams /ProcessDSCComment get
dup //null eq {pop {pop pop}} if /exec load
4 array astore cvx readonly
<< /ProcessDSCComment 3 -1 roll >> setuserparams
diff --git a/gs/Resource/Init/gs_il1_e.ps b/gs/Resource/Init/gs_il1_e.ps
index 35eec4515..92d69542b 100644
--- a/gs/Resource/Init/gs_il1_e.ps
+++ b/gs/Resource/Init/gs_il1_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993, 1994, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -32,31 +32,31 @@ StandardEncoding 46 82 getinterval aload pop
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
% \24x
/space /exclamdown /cent /sterling
- /currency /yen /brokenbar /section
+ /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft
- /logicalnot /hyphen /registered /macron
+ /logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior
- /acute /mu /paragraph /periodcentered
+ /acute /mu /paragraph /periodcentered
/cedilla /onesuperior /ordmasculine /guillemotright
- /onequarter /onehalf /threequarters /questiondown
+ /onequarter /onehalf /threequarters /questiondown
% \30x
/Agrave /Aacute /Acircumflex /Atilde
- /Adieresis /Aring /AE /Ccedilla
+ /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis
- /Igrave /Iacute /Icircumflex /Idieresis
+ /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute
- /Ocircumflex /Otilde /Odieresis /multiply
+ /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex
- /Udieresis /Yacute /Thorn /germandbls
+ /Udieresis /Yacute /Thorn /germandbls
% \34x
/agrave /aacute /acircumflex /atilde
- /adieresis /aring /ae /ccedilla
+ /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis
- /igrave /iacute /icircumflex /idieresis
+ /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute
- /ocircumflex /otilde /odieresis /divide
+ /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex
- /udieresis /yacute /thorn /ydieresis
+ /udieresis /yacute /thorn /ydieresis
% Make an array on large systems, a packed array on small ones.
256
vmstatus exch pop exch pop
diff --git a/gs/Resource/Init/gs_img.ps b/gs/Resource/Init/gs_img.ps
index 75f1d472d..a52c1e43e 100644
--- a/gs/Resource/Init/gs_img.ps
+++ b/gs/Resource/Init/gs_img.ps
@@ -1,12 +1,12 @@
% (C) 2002 Artifex, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -99,7 +99,6 @@
% handling is required in this case.)
%
-
%
% Create a dictionary of operators for specific image and image mask types.
% Each of these will always handle ImageType 1. Additional types are added
@@ -120,7 +119,7 @@ def
end
.setglobal
-%
+%
% Build a dictionary of utility procedures and constants for use in
% impelementing the image operators. This dictionary is in global VM but
% is maintained (during initialization) in userdict. It should be pushed
@@ -134,7 +133,6 @@ end
userdict /img_utils_dict 30 dict put
img_utils_dict begin
-
%
% Some useful local data structures:
%
@@ -184,7 +182,6 @@ def
//img_mask_check_ary 2 1 index length 2 sub getinterval
def
-
%
% <?any?> <array> img_check_keys <?any?> <bool>
%
@@ -432,7 +429,6 @@ currentdict /good_image_types .undef
}
.bind def
-
%
% <width> <height> <polarity> <matrix> <dsrc>
% img_unbuild_imagemask_dict
@@ -485,11 +481,10 @@ currentdict /good_image_types .undef
}
.bind def
-
%
% <width> <height> <bits/component> <matrix> <dsrc_0> ...
% <multi> <ncomp> <has_alpha>
-% .colorimage
+% .colorimage
% -
%
% Convert the image/colorimage operator from their traditional form to
@@ -526,18 +521,18 @@ currentdict /good_image_types .undef
% execute .image1 in a stopped context
{
gsave
- % The CET test file 12-02.ps creates colorimages with a width and
- % height of 0. Ignore these since that is what the CET expects.
- 1 index dup /Height get 0 eq exch /Width get 0 eq or
+ % The CET test file 12-02.ps creates colorimages with a width and
+ % height of 0. Ignore these since that is what the CET expects.
+ 1 index dup /Height get 0 eq exch /Width get 0 eq or
{ pop pop } % Ignore colorimage. Pop bool and dict
- {
+ {
0 .setoverprintmode % disable overprint mode for images
//img_csary 2 index /IMG_NComps get get setcolorspace
{ .alphaimage }
{ .image1 }
ifelse
- }
- ifelse
+ }
+ ifelse
}
stopped
grestore
@@ -550,11 +545,10 @@ currentdict /good_image_types .undef
}
.bind def
-
-%
+%
% <width> <height> <bits/component> <matrix> <dsrc_0> ...
% <multi> <ncomp>
-% colorimage
+% colorimage
% -
%
% Build the colorimage pseudo-operator only if setcolorscreen is visible.
@@ -563,7 +557,7 @@ systemdict /setcolorscreen .knownget
{
type /operatortype eq
{
- /colorimage
+ /colorimage
{
//false
//.colorimage
@@ -577,10 +571,9 @@ systemdict /setcolorscreen .knownget
}
if
-
%
% width height bits_per_component matrix data_src image -
-%
+%
% <dict> image -
%
% Some special handling is required for ImageType 2 (Display PostScript
@@ -590,7 +583,7 @@ if
/image
{
dup type /dicttype eq .languagelevel 2 ge and
- {
+ {
dup /ImageType get dup 2 eq
{
% verify the ImageType 2 is supported
@@ -609,7 +602,7 @@ if
% should be used.
%
% The mechanism to determine depth for the DevicePixel
- % color space when BitsPerPixel is not available is
+ % color space when BitsPerPixel is not available is
% somewhat of a hack.
%
gsave
@@ -656,14 +649,14 @@ if
}
{
/image .systemvar exch type /integertype eq
- { /rangecheck } { /typecheck }
+ { /rangecheck } { /typecheck }
ifelse signalerror
}
ifelse
}
ifelse
}
- {
+ {
//false 1 //false
//.colorimage
stopped
@@ -689,7 +682,6 @@ if
2 gt % arbitrary
} .bind def
-
%
% width height polarity matrix datasrc imagemask -
%
@@ -703,25 +695,25 @@ if
//.imagemasktypes exch .knownget
{ 1 index //.is_low_resolution exec
2 index /ImageType get 1 eq and
- 2 index /BitsPerComponent get 1 eq and
- 2 index /Interpolate .knownget not { //false } if and
- //filterdict /ImscaleDecode known and {
- % Apply interpolated imagemask scaling filter
- exch .currentglobal exch dup .gcheck .setglobal
+ 2 index /BitsPerComponent get 1 eq and
+ 2 index /Interpolate .knownget not { //false } if and
+ //filterdict /ImscaleDecode known and {
+ % Apply interpolated imagemask scaling filter
+ exch .currentglobal exch dup .gcheck .setglobal
dup length dict .copydict
- dup dup /DataSource get
+ dup dup /DataSource get
dup type /stringtype eq {
1 array astore cvx % image.* operators read strings repeatesly
} if
- mark /Width 3 index /Width get /Height 5 index /Height get .dicttomark
- /ImscaleDecode filter /DataSource exch put
- dup dup /Width get 4 mul /Width exch put
- dup dup /Height get 4 mul /Height exch put
- dup dup /ImageMatrix get
+ mark /Width 3 index /Width get /Height 5 index /Height get .dicttomark
+ /ImscaleDecode filter /DataSource exch put
+ dup dup /Width get 4 mul /Width exch put
+ dup dup /Height get 4 mul /Height exch put
+ dup dup /ImageMatrix get
{ 4 0 0 4 0 0 } matrix concatmatrix /ImageMatrix exch put
- 3 1 roll .setglobal
- } if
- exec
+ 3 1 roll .setglobal
+ } if
+ exec
}
{ % CET 12-08b.ps wants /typecheck
/imagemask .systemvar /typecheck signalerror
@@ -768,7 +760,7 @@ currentdict /NOTERPOLATE known or not {
//false .setglobal
9 dict begin % w h bit [] {}...{} multi ncomp glob
2 .argindex { 1 index 7 add } { 8 } ifelse
- dup .argindex pop % check # of arguments
+ dup .argindex pop % check # of arguments
copy gsave pop % preserve the arguments
{ 0 /DeviceGray 0 /DeviceRGB /DeviceCMYK }
1 index get setcolorspace % ... glob w h bit [] {}...{} multi ncomp
@@ -782,7 +774,7 @@ currentdict /NOTERPOLATE known or not {
/ImageMatrix exch def % ... glob w h bit
/BitsPerComponent exch def % ... glob w h
/Height exch def % ... glob w
- /Width exch def % ... glob
+ /Width exch def % ... glob
/ImageType 1 def
/Interpolate //true def
.setglobal currentdict end % ... <<>>
@@ -799,19 +791,19 @@ currentdict /NOTERPOLATE known or not {
{ dup type /dicttype eq
{ dup /ImageType get 3 eq
{ .currentglobal //false .setglobal exch
- dup length dict copy begin .setglobal
+ dup length dict copy begin .setglobal
/DataDict DataDict .interpolate def
/MaskDict MaskDict .interpolate def
currentdict end
}
- { .interpolate
+ { .interpolate
}
ifelse
image
}
{ /INTERPOLATE .systemvar
{ 4 .argindex pop % check # of args
- .currentglobal //false .setglobal
+ .currentglobal //false .setglobal
8 dict begin .setglobal
/ImageType 1 def
/DataSource 1 index def
diff --git a/gs/Resource/Init/gs_init.ps b/gs/Resource/Init/gs_init.ps
index c336b4427..da36842e9 100644
--- a/gs/Resource/Init/gs_init.ps
+++ b/gs/Resource/Init/gs_init.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989-2009 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -67,12 +67,12 @@ ifelse
systemdict /.languagelevel known not { /.languagelevel 1 def } if
% Optionally choose a default paper size other than U.S. letter.
-% The default page size for many devices is set at compile time to
-% letter, but this can be changed to A4 although this is rarely done.
+% The default page size for many devices is set at compile time to
+% letter, but this can be changed to A4 although this is rarely done.
% Some devices such as bbox have a different default page size,
% and should not be set to A4 or letter.
% When ghostscript is used in countries that use the international
-% standard page size A4 rather than US letter, the page size of
+% standard page size A4 rather than US letter, the page size of
% devices that default to letter or A4 can be changed by setting
% DEFAULTPAPERSIZE.
% /DEFAULTPAPERSIZE (a4) def
@@ -92,7 +92,7 @@ currentdict /DEBUG known /DEBUG exch def
mark % '[' isn't defined yet
/CCFONTDEBUG % Compiled Fonts
/CFFDEBUG % CFF Fonts
- /CMAPDEBUG % CMAP
+ /CMAPDEBUG % CMAP
/DOCIEDEBUG % CIE color
/EPSDEBUG % EPS handling
/FAPIDEBUG % Font API
@@ -115,22 +115,22 @@ PDFSTEP { /PDFDEBUG //true def } if
/VMDEBUG
INITDEBUG {{print mark
systemdict /level2dict known
- { .currentglobal dup //false .setglobal vmstatus
- //true .setglobal vmstatus 3 -1 roll pop
- 6 -2 roll pop .setglobal
- }
- { vmstatus 3 -1 roll pop
- }
- ifelse usertime 16#fffff and counttomark
- { ( ) print ( ) cvs print }
- repeat pop
- ( ) print systemdict length ( ) cvs print
- ( ) print countdictstack ( ) cvs print
- ( <) print count ( ) cvs print (>\n) print flush
- }}
- {{pop
- }}
- ifelse
+ { .currentglobal dup //false .setglobal vmstatus
+ //true .setglobal vmstatus 3 -1 roll pop
+ 6 -2 roll pop .setglobal
+ }
+ { vmstatus 3 -1 roll pop
+ }
+ ifelse usertime 16#fffff and counttomark
+ { ( ) print ( ) cvs print }
+ repeat pop
+ ( ) print systemdict length ( ) cvs print
+ ( ) print countdictstack ( ) cvs print
+ ( <) print count ( ) cvs print (>\n) print flush
+ }}
+ {{pop
+ }}
+ ifelse
def
currentdict /BATCH known /BATCH exch def
@@ -200,13 +200,13 @@ currentdict /DEVICE known not
/.currentuserparams where {
pop mark
- % The Adobe implementations appear to have very large maximum
- % stack sizes. This turns out to actually make a difference,
- % since some badly-behaved files include extremely long procedures,
- % or construct huge arrays on the operand stack.
- % We reset the stack sizes now so that we don't have to worry
- % about overflowing the (rather small) built-in stack sizes
- % during initialization.
+ % The Adobe implementations appear to have very large maximum
+ % stack sizes. This turns out to actually make a difference,
+ % since some badly-behaved files include extremely long procedures,
+ % or construct huge arrays on the operand stack.
+ % We reset the stack sizes now so that we don't have to worry
+ % about overflowing the (rather small) built-in stack sizes
+ % during initialization.
/MaxDictStack 500
/MaxExecStack 5000
/MaxOpStack 300000
@@ -292,8 +292,8 @@ DELAYBIND NOBIND not and
systemdict /.delaybind 2000 array .forceput
.setglobal
userdict /.delaycount 0 put
- % When we've done the delayed bind, we want to stop saving.
- % Detect this by the disappearance of .delaybind.
+ % When we've done the delayed bind, we want to stop saving.
+ % Detect this by the disappearance of .delaybind.
/bind
{ /.delaybind .systemvar dup length 0 ne
{ .delaycount 2 index put
@@ -353,49 +353,49 @@ currentdict /hwsizedict .undef
userdict /#copies 1 put
% Adobe implementations don't accept /[ or /], so we don't either.
([) cvn
- /mark load def
+ /mark load def
(]) cvn
- {counttomark array astore exch pop} odef
+ {counttomark array astore exch pop} odef
% .beginpage is redefined if setpagedevice is present.
/.beginpage { } odef
% In LanguageLevel 3, copypage erases the page.
/copypage {
- .languagelevel 3 ge
- dup { 0 } { 1 } ifelse .endpage .doneshowpage {
- .currentnumcopies 1 index .outputpage
- (>>copypage, press <return> to continue<<\n) .confirm
- dup { erasepage } if
- } if pop
+ .languagelevel 3 ge
+ dup { 0 } { 1 } ifelse .endpage .doneshowpage {
+ .currentnumcopies 1 index .outputpage
+ (>>copypage, press <return> to continue<<\n) .confirm
+ dup { erasepage } if
+ } if pop
systemdict /..page_default_spaces .knownget { //.PurgeDict exec } if
.beginpage
} odef
/currentmatrix {
- dup type /arraytype ne
- { /currentmatrix load /typecheck signalerror } if
- dup length 6 ne
- { /currentmatrix load /rangecheck signalerror } if
- .currentmatrix 6 .argindex astore pop
+ dup type /arraytype ne
+ { /currentmatrix load /typecheck signalerror } if
+ dup length 6 ne
+ { /currentmatrix load /rangecheck signalerror } if
+ .currentmatrix 6 .argindex astore pop
} odef
% .currentnumcopies is redefined in Level 2.
/.currentnumcopies { #copies } odef
/setcolorscreen where { pop % not in all Level 1 configurations
/currentcolorscreen
- { .currenthalftone
- { { 60.0 exch 0.0 exch 3 copy 6 copy } % halftone - not possible
- { 3 copy 6 copy } % screen
- { } % colorscreen
- }
- exch get exec
- } odef
+ { .currenthalftone
+ { { 60.0 exch 0.0 exch 3 copy 6 copy } % halftone - not possible
+ { 3 copy 6 copy } % screen
+ { } % colorscreen
+ }
+ exch get exec
+ } odef
} if
/currentscreen
- { .currenthalftone
- { { 60.0 exch 0.0 exch } % halftone - not possible
- { } % screen
- { 12 3 roll 9 { pop } repeat } % colorscreen
- }
- exch get exec
- } odef
+ { .currenthalftone
+ { { 60.0 exch 0.0 exch } % halftone - not possible
+ { } % screen
+ { 12 3 roll 9 { pop } repeat } % colorscreen
+ }
+ exch get exec
+ } odef
/.echo /echo load def
userdict /.echo.mode //true put
/echo {dup /.echo.mode exch store .echo} odef
@@ -404,12 +404,12 @@ userdict /.echo.mode //true put
/seed 55665
.dicttomark readonly def
/eexec {
- % Rebind .currentresourcefile if it is the source for the eexec.
+ % Rebind .currentresourcefile if it is the source for the eexec.
dup //.eexec_param_dict //filterdict /eexecDecode get exec
cvx exch .currentresourcefile eq
//systemdict begin { {exec} .execasresource } { exec } ifelse
- % Only pop systemdict if it is still the top element,
- % because this is apparently what Adobe interpreters do.
+ % Only pop systemdict if it is still the top element,
+ % because this is apparently what Adobe interpreters do.
currentdict //systemdict eq { end } if
} odef
% .endpage is redefined if setpagedevice is present.
@@ -417,35 +417,35 @@ userdict /.echo.mode //true put
% erasepage mustn't use gsave/grestore, because we call it before
% the graphics state stack has been fully initialized.
/erasepage
- { /currentcolor where
- { pop currentcolor currentcolorspace { setcolorspace setcolor } }
- { /currentcmykcolor where
- { pop currentcmykcolor { setcmykcolor } }
- { currentrgbcolor { setrgbcolor } }
- ifelse
- }
- ifelse
+ { /currentcolor where
+ { pop currentcolor currentcolorspace { setcolorspace setcolor } }
+ { /currentcmykcolor where
+ { pop currentcmykcolor { setcmykcolor } }
+ { currentrgbcolor { setrgbcolor } }
+ ifelse
+ }
+ ifelse
currentoverprint //false setoverprint 1 setgray .fillpage setoverprint
exec
- } odef
+ } odef
% To satisfy the Genoa FTS, executive must be a procedure, not an operator.
/executive
- { { prompt
- { (%statementedit) (r) .systemvmfile } stopped
- { pop pop $error /errorname get /undefinedfilename eq
- { .clearerror exit } if % EOF
- /handleerror .systemvar exec //null % ioerror??
- }
- if
- cvx { .runexec } .execute pop
- } loop
- } bind def
+ { { prompt
+ { (%statementedit) (r) .systemvmfile } stopped
+ { pop pop $error /errorname get /undefinedfilename eq
+ { .clearerror exit } if % EOF
+ /handleerror .systemvar exec //null % ioerror??
+ }
+ if
+ cvx { .runexec } .execute pop
+ } loop
+ } bind def
/filter
- { //filterdict 1 .argindex .knownget
- { exch pop exec }
- { /filter .systemvar /undefined signalerror }
- ifelse
- } odef
+ { //filterdict 1 .argindex .knownget
+ { exch pop exec }
+ { /filter .systemvar /undefined signalerror }
+ ifelse
+ } odef
% handleerror procedure as mentioned in the "Operators" section of the PLRM Section 8.2
% This invokes the handleerror procedure from errordict (unless we are running under a
% JOBSERVER where we want to always use a defined error handler (many error handlers in
@@ -454,37 +454,37 @@ userdict /.echo.mode //true put
% We run the handleerror procedure using .internalstopped so that broken error handlers
% won't cause nested errors (Unexpected Error conditions).
/handleerror
- JOBSERVER {
- { /.GShandleerror .systemvar .internalstopped pop } bind % always use .GShandleerror.
- } {
- { /errordict .systemvar /handleerror get .internalstopped pop } bind % PLRM standard errorhandling
- } ifelse def
+ JOBSERVER {
+ { /.GShandleerror .systemvar .internalstopped pop } bind % always use .GShandleerror.
+ } {
+ { /errordict .systemvar /handleerror get .internalstopped pop } bind % PLRM standard errorhandling
+ } ifelse def
/identmatrix [1.0 0.0 0.0 1.0 0.0 0.0] readonly def
/identmatrix {
- dup type /arraytype ne { /identmatrix load /typecheck signalerror } if
- dup length 6 ne { /identmatrix load /rangecheck signalerror } if
- dup 0 //identmatrix putinterval
+ dup type /arraytype ne { /identmatrix load /typecheck signalerror } if
+ dup length 6 ne { /identmatrix load /rangecheck signalerror } if
+ dup 0 //identmatrix putinterval
} odef
/languagelevel 1 def % gs_lev2.ps may change this
/makeimagedevice { //false makewordimagedevice } odef
/matrix { 6 array identmatrix } odef
% .promptmsg is redefined if the interpreter includes readline support.
/.promptmsg {
- (GS) print
- count 0 ne { (<) print count =only } if
- (>) print flush
+ (GS) print
+ count 0 ne { (<) print count =only } if
+ (>) print flush
} bind def
/prompt { flush flushpage NOPROMPT not { .promptmsg } if } bind def
/pstack { 0 1 count 3 sub { index == } for } bind def
/putdeviceprops
- { .putdeviceprops { erasepage } if } odef
+ { .putdeviceprops { erasepage } if } odef
/quit { /quit load 0 .quit } odef
/run { dup type /filetype ne { (r) .systemvmfile } if
- % We must close the file when execution terminates,
- % regardless of the state of the stack,
- % and then propagate an error, if any.
- cvx //null {.runexec} .errorexec
- } odef
+ % We must close the file when execution terminates,
+ % regardless of the state of the stack,
+ % and then propagate an error, if any.
+ cvx //null {.runexec} .errorexec
+ } odef
% Execute a file.
% Level 2 uses 2 .stop to clear the e-stack for a successful startjob:
% we detect that here, since we need to handle this even if we start out
@@ -495,9 +495,9 @@ userdict /.echo.mode //true put
/.runexec1 { % <file|fileproc> .runexec1 -
dup type /filetype ne { cvx exec } if
cvx //null 2 .stopped
- % If we got back here from a startjob, just keep going.
- % startjob replaces the null on the o-stack with a procedure
- % to be executed when we get back here.
+ % If we got back here from a startjob, just keep going.
+ % startjob replaces the null on the o-stack with a procedure
+ % to be executed when we get back here.
dup //null ne { exec //true } { pop //false } ifelse
} bind def
/.runexec2 { % <continue> <file|fileproc> .runexec2 -
@@ -513,11 +513,11 @@ userdict /.echo.mode //true put
} bind def
% The following is only for compatibility with Adobe interpreters.
/setdash {
- 0 .argindex type dup /integertype eq exch /realtype eq or not {
- /setdash .systemvar /typecheck signalerror
- } if
- 1 .argindex length 11 gt { /setdash .systemvar /limitcheck signalerror } if
- //setdash
+ 0 .argindex type dup /integertype eq exch /realtype eq or not {
+ /setdash .systemvar /typecheck signalerror
+ } if
+ 1 .argindex length 11 gt { /setdash .systemvar /limitcheck signalerror } if
+ //setdash
} odef
/setdevice
{
@@ -539,32 +539,32 @@ userdict /.echo.mode //true put
}
odef
/setlinecap {
- dup 2 gt { /setlinecap .systemvar /rangecheck signalerror } if
- .setlinecap
+ dup 2 gt { /setlinecap .systemvar /rangecheck signalerror } if
+ .setlinecap
} odef
/setlinejoin {
- dup 2 gt { /setlinejoin .systemvar /rangecheck signalerror } if
- .setlinejoin
+ dup 2 gt { /setlinejoin .systemvar /rangecheck signalerror } if
+ .setlinejoin
} odef
/setmatrix {
- dup type /arraytype ne {
- dup type /packedarraytype ne {
- /setmatrix load /typecheck signalerror
- } if
- } if
- dup length 6 ne { /setmatrix load /rangecheck signalerror } if
- dup aload pop .setmatrix pop
+ dup type /arraytype ne {
+ dup type /packedarraytype ne {
+ /setmatrix load /typecheck signalerror
+ } if
+ } if
+ dup length 6 ne { /setmatrix load /rangecheck signalerror } if
+ dup aload pop .setmatrix pop
} odef
/showpage {
- 0 .endpage .doneshowpage {
- .currentnumcopies //true .outputpage
- (>>showpage, press <return> to continue<<\n) .confirm
- initgraphics
+ 0 .endpage .doneshowpage {
+ .currentnumcopies //true .outputpage
+ (>>showpage, press <return> to continue<<\n) .confirm
+ initgraphics
currentoverprint //false setoverprint 1 setcolor
.fillpage
setoverprint 0 setcolor
- }
- { initgraphics } ifelse
+ }
+ { initgraphics } ifelse
systemdict /..page_default_spaces .knownget { //.PurgeDict exec } if
.beginpage
} odef
@@ -576,11 +576,11 @@ odef
% should use .internalstopped to avoid setting newerror et al.
/.internalstopped { //null 1 .stopped //null ne } bind def
/store { % Don't alter operands before completing.
- 1 .argindex where { 2 index 2 index put pop pop } { def } ifelse
+ 1 .argindex where { 2 index 2 index put pop pop } { def } ifelse
} odef
/.typenames mark .typenames counttomark packedarray exch pop def
/type {
- //.typenames .type
+ //.typenames .type
} odef
currentdict /.typenames .undef
% When running in Level 1 mode, this interpreter is supposed to be
@@ -589,7 +589,7 @@ currentdict /.typenames .undef
/.wheredict 10 dict def
/.where /where load def
/where {
- //.wheredict 1 .argindex .knownget { exec } { .where } ifelse
+ //.wheredict 1 .argindex .knownget { exec } { .where } ifelse
} odef
% internaldict is defined in systemdict, but the dictionary is allocated
@@ -600,11 +600,11 @@ currentdict /.typenames .undef
/.makeinternaldict {
.currentglobal //true .setglobal
[ /dup .systemvar 1183615869 /eq .systemvar
- [ /pop .systemvar //null ] cvx
- //false .setglobal
- dup 1 10 dict .forceput % proc is global, dict is local
- //true .setglobal
- [ /internaldict /cvx .systemvar /invalidaccess /signalerror cvx ] cvx
+ [ /pop .systemvar //null ] cvx
+ //false .setglobal
+ dup 1 10 dict .forceput % proc is global, dict is local
+ //true .setglobal
+ [ /internaldict /cvx .systemvar /invalidaccess /signalerror cvx ] cvx
/ifelse .systemvar
] cvx executeonly
exch .setglobal
@@ -617,32 +617,32 @@ systemdict /internaldict dup .makeinternaldict .makeoperator
% Warning: these are not guaranteed to stay the same from one release
% to the next!
/concatstrings % (str1) (str2) concatstrings (str1str2)
- { exch dup length 2 index length add string % str2 str1 new
- dup dup 4 2 roll copy % str2 new new new1
- length 4 -1 roll putinterval
- } bind def
+ { exch dup length 2 index length add string % str2 str1 new
+ dup dup 4 2 roll copy % str2 new new new1
+ length 4 -1 roll putinterval
+ } bind def
/copyarray
- { dup length array copy } bind def
+ { dup length array copy } bind def
% Copy a dictionary per the Level 2 spec even in Level 1.
/.copydict % <fromdict> <todict> .copydict <todict>
- { dup 3 -1 roll { put dup } forall pop } bind def
+ { dup 3 -1 roll { put dup } forall pop } bind def
/copystring
- { dup length string copy } bind def
+ { dup length string copy } bind def
/findlibfile {
.systemvmlibfile { dup .filename pop exch //true } { //false } ifelse
} odef
/.growdictlength % get size for growing a dictionary
- { length 3 mul 2 idiv 1 add
- } bind def
+ { length 3 mul 2 idiv 1 add
+ } bind def
/.growdict % grow a dictionary
- { dup .growdictlength .setmaxlength
- } bind def
+ { dup .growdictlength .setmaxlength
+ } bind def
/.growput % put, grow the dictionary if needed
- { 2 index length 3 index maxlength eq
- { 3 copy pop known not { 2 index .growdict } if
- } if
- put
- } bind def
+ { 2 index length 3 index maxlength eq
+ { 3 copy pop known not { 2 index .growdict } if
+ } if
+ put
+ } bind def
% .localvmarray may be an operator: see zsysvm.c.
/.localvmarray where {
pop
@@ -661,21 +661,21 @@ systemdict /internaldict dup .makeinternaldict .makeoperator
} bind def
} ifelse
/.packtomark
- { counttomark packedarray exch pop } bind def
+ { counttomark packedarray exch pop } bind def
/ppstack
- { 0 1 count 3 sub { index === } for } bind def
+ { 0 1 count 3 sub { index === } for } bind def
/runlibfile
- { % We don't want to bind 'run' into this procedure,
- % since run may get redefined.
- findlibfile
- { exch pop /run .systemvar exec }
- { /undefinedfilename signalerror }
- ifelse
- } bind def
+ { % We don't want to bind 'run' into this procedure,
+ % since run may get redefined.
+ findlibfile
+ { exch pop /run .systemvar exec }
+ { /undefinedfilename signalerror }
+ ifelse
+ } bind def
/selectdevice
- { finddevice setdevice .setdefaultscreen } bind def
+ { finddevice setdevice .setdefaultscreen } bind def
/signalerror % <object> <errorname> signalerror -
- { /errordict .systemvar exch get exec } bind def
+ { /errordict .systemvar exch get exec } bind def
/signaloperror { % <object> <errorname> signaloperror -
% Same as signalerror, except that if we are inside a pseudo-operator
% or .errorexec, we use its error object, just as errors generated by
@@ -689,10 +689,10 @@ systemdict /internaldict dup .makeinternaldict .makeoperator
% which is used by some PostScript programs even though
% it isn't documented anywhere.
/write=only {
- .writecvs
+ .writecvs
} bind def
/write= {
- 1 index exch write=only (\n) writestring
+ 1 index exch write=only (\n) writestring
} bind def
/=only { (%stdout) (w) file exch write=only } bind def
/= { =only (\n) print } bind def
@@ -707,9 +707,9 @@ systemdict /internaldict dup .makeinternaldict .makeoperator
/finddevice { % <devicename> finddevice <device>
/devicedict .systemvar exch get
dup 1 get //null eq {
- % This is the first request for this type of device.
- % Create a default instance now.
- % Stack: [proto null]
+ % This is the first request for this type of device.
+ % Create a default instance now.
+ % Stack: [proto null]
.currentglobal //true .setglobal exch
dup dup 0 get copydevice 1 exch put
exch .setglobal
@@ -725,7 +725,7 @@ userdict /.currentresourcefile //null put
/.execasresource { % <file> <proc|runfile> .execasresource -
/stopped .systemvar
/.currentresourcefile .uservar
- % Stack: file proc -stopped- currfile
+ % Stack: file proc -stopped- currfile
.userdict /.currentresourcefile 5 index cvlit put
2 .execn % stopped <file>
.userdict /.currentresourcefile 3 -1 roll put
@@ -754,18 +754,18 @@ userdict /.currentresourcefile //null put
% Define auxiliary procedures needed for the above.
/shellarguments % -> shell_arguments true (or) false
- { /ARGUMENTS where
- { /ARGUMENTS get dup type /arraytype eq
- { aload pop /ARGUMENTS //null store //true }
- { pop //false }
- ifelse }
- { //false } ifelse
- } bind def
+ { /ARGUMENTS where
+ { /ARGUMENTS get dup type /arraytype eq
+ { aload pop /ARGUMENTS //null store //true }
+ { pop //false }
+ ifelse }
+ { //false } ifelse
+ } bind def
/.confirm {
DISPLAYING NOPAUSE not TTYPAUSE or and {
- % Print a message (unless NOPAGEPROMPT or NOPROMPT is true)
- % and wait for the user to type something.
- % If the user just types a newline, flush it.
+ % Print a message (unless NOPAGEPROMPT or NOPROMPT is true)
+ % and wait for the user to type something.
+ % If the user just types a newline, flush it.
NOPAGEPROMPT NOPROMPT or { pop } { print flush } ifelse
.confirmread
} {
@@ -825,19 +825,19 @@ userdict /.currentresourcefile //null put
% Define a special version of runlibfile that aborts on errors.
/runlibfile0
- { cvlit dup dup /.currentfilename exch def
- { findlibfile not { stop } if }
- stopped
- { (Can't find \(or open\) initialization file ) print
- .currentfilename == flush /runlibfile0 cvx 1 .quit
- } if
- exch pop cvx
- { stopped } 0 get 3 -1 roll 2 array astore cvx exec
- /.currentfilename exch store
- { (While reading ) print .currentfilename print (:\n) print flush
- /handleerror .systemvar exec /runlibfile0 1 .quit
- } if
- } bind def
+ { cvlit dup dup /.currentfilename exch def
+ { findlibfile not { stop } if }
+ stopped
+ { (Can't find \(or open\) initialization file ) print
+ .currentfilename == flush /runlibfile0 cvx 1 .quit
+ } if
+ exch pop cvx
+ { stopped } 0 get 3 -1 roll 2 array astore cvx exec
+ /.currentfilename exch store
+ { (While reading ) print .currentfilename print (:\n) print flush
+ /handleerror .systemvar exec /runlibfile0 1 .quit
+ } if
+ } bind def
% Temporarily substitute it for the real runlibfile.
/.runlibfile /runlibfile load def
/runlibfile /runlibfile0 load def
@@ -847,7 +847,7 @@ userdict /.currentresourcefile //null put
% The interpreter has created the ErrorNames array.
/.unstoppederrorhandler % <command> <errorname> .unstoppederrorhandler -
{ % This is the handler that gets used for recursive errors,
- % or errors outside the scope of a 'stopped'.
+ % or errors outside the scope of a 'stopped'.
2 copy SHORTERRORS
{ (%%[ Error: ) print =only flush
(; OffendingCommand: ) print =only ( ]%%) =
@@ -857,7 +857,7 @@ userdict /.currentresourcefile //null put
count 2 gt
{ (Operand stack:\n ) print
count 1 sub -1 2 { ( ) print index =only flush } for
- () = flush
+ () = flush
} if
}
ifelse
@@ -899,15 +899,15 @@ userdict /.currentresourcefile //null put
{ currentfile { fileposition } .internalstopped { pop //null } if
}
{ % If this was a scanner error, the file is no longer current,
- % but the command holds the file, which may still be open.
+ % but the command holds the file, which may still be open.
$error /command get dup type /filetype eq
{ { fileposition } .internalstopped { pop //null } if }
{ pop //null }
ifelse
}
ifelse put
- % During initialization, we don't reset the allocation
- % mode on errors.
+ % During initialization, we don't reset the allocation
+ % mode on errors.
$error /globalmode get $error /.nosetlocal get and .setglobal
$error /.inerror //false put
stop
@@ -919,28 +919,28 @@ userdict /.currentresourcefile //null put
{ $error begin newerror
{
/command load errorname SHORTERRORS
- { (%%[ Error: ) print =only flush
- (; OffendingCommand: ) print =only
- errorinfo dup //null eq {
- pop
- } {
- (;\nErrorInfo:) print
- dup type /arraytype eq
- { { ( ) print =only } forall }
- { ( ) print =only }
- ifelse
- } ifelse
+ { (%%[ Error: ) print =only flush
+ (; OffendingCommand: ) print =only
+ errorinfo dup //null eq {
+ pop
+ } {
+ (;\nErrorInfo:) print
+ dup type /arraytype eq
+ { { ( ) print =only } forall }
+ { ( ) print =only }
+ ifelse
+ } ifelse
( ]%%) = flush
- }
- { (Error: ) print ==only flush
- ( in ) print ==only flush
- errorinfo dup //null eq {
- pop
- } {
- (\nAdditional information: ) print ==only flush
- } ifelse
- .printerror_long
- }
+ }
+ { (Error: ) print ==only flush
+ ( in ) print ==only flush
+ errorinfo dup //null eq {
+ pop
+ } {
+ (\nAdditional information: ) print ==only flush
+ } ifelse
+ .printerror_long
+ }
ifelse
.clearerror flush
}
@@ -950,59 +950,59 @@ userdict /.currentresourcefile //null put
% being set. We were erroring in this case, due to /command load failing.
//JOBSERVER {
- /errordict .systemvar /handleerror get /.GShandleerror .systemvar ne
- } {
- //false
- } ifelse
+ /errordict .systemvar /handleerror get /.GShandleerror .systemvar ne
+ } {
+ //false
+ } ifelse
{ /errordict .systemvar begin /handleerror load .internalstopped pop end
}
if
}
- ifelse % newerror
+ ifelse % newerror
end
flush
- } bind def
+ } bind def
/.printerror_long % long error printout,
- % $error is on the dict stack
+ % $error is on the dict stack
{ % Push the (anonymous) stack printing procedure.
- % <heading> <==flag> <override-name> <stackname> proc
+ % <heading> <==flag> <override-name> <stackname> proc
{
- currentdict exch .knownget % stackname defined in $error?
- {
- 4 1 roll % stack: <stack> <head> <==flag> <over>
- /errordict .systemvar exch .knownget % overridename defined?
- {
- exch pop exch pop exec % call override with <stack>
- }
- {
- exch print exch % print heading. stack <==flag> <stack>
- 1 index not { () = } if
- { 1 index { (\n ) } { ( ) } ifelse print
- dup type /dicttype eq
- {
- (--dict:) print
- dup rcheck {
- dup length =only (/) print dup maxlength =only
- dup wcheck not { ((ro)) print } if
- } if
- /gcheck where {
- pop gcheck { ((G)) } { ((L)) } ifelse print
- } {
- pop
- } ifelse (--) print
- }
- {
- dup type /stringtype eq 2 index or
- { ==only } { =only } ifelse
- } ifelse
- } forall
- pop
- }
- ifelse % overridden
- }
- { pop pop pop
- }
- ifelse % stack known
+ currentdict exch .knownget % stackname defined in $error?
+ {
+ 4 1 roll % stack: <stack> <head> <==flag> <over>
+ /errordict .systemvar exch .knownget % overridename defined?
+ {
+ exch pop exch pop exec % call override with <stack>
+ }
+ {
+ exch print exch % print heading. stack <==flag> <stack>
+ 1 index not { () = } if
+ { 1 index { (\n ) } { ( ) } ifelse print
+ dup type /dicttype eq
+ {
+ (--dict:) print
+ dup rcheck {
+ dup length =only (/) print dup maxlength =only
+ dup wcheck not { ((ro)) print } if
+ } if
+ /gcheck where {
+ pop gcheck { ((G)) } { ((L)) } ifelse print
+ } {
+ pop
+ } ifelse (--) print
+ }
+ {
+ dup type /stringtype eq 2 index or
+ { ==only } { =only } ifelse
+ } ifelse
+ } forall
+ pop
+ }
+ ifelse % overridden
+ }
+ { pop pop pop
+ }
+ ifelse % stack known
}
(\nOperand stack:) OSTACKPRINT /.printostack /ostack 4 index exec
@@ -1013,29 +1013,29 @@ userdict /.currentresourcefile //null put
pop % printing procedure
errorname /VMerror eq
- { (VM status:) print mark vmstatus
- counttomark { ( ) print counttomark -1 roll dup =only } repeat
- cleartomark () =
- } if
+ { (VM status:) print mark vmstatus
+ counttomark { ( ) print counttomark -1 roll dup =only } repeat
+ cleartomark () =
+ } if
.languagelevel 2 ge
- { (Current allocation mode is ) print
- globalmode { (global\n) } { (local\n) } ifelse print
- } if
+ { (Current allocation mode is ) print
+ globalmode { (global\n) } { (local\n) } ifelse print
+ } if
.oserrno dup 0 ne
- { (Last OS error: ) print
- errorname /VMerror ne
- { dup .oserrorstring { = pop } { = } ifelse }
- { = }
- ifelse
- }
- { pop
- }
+ { (Last OS error: ) print
+ errorname /VMerror ne
+ { dup .oserrorstring { = pop } { = } ifelse }
+ { = }
+ ifelse
+ }
+ { pop
+ }
ifelse
position //null ne
- { (Current file position is ) print position = }
+ { (Current file position is ) print position = }
if
} bind def
@@ -1050,11 +1050,11 @@ userdict /.currentresourcefile //null put
% Define $error. This must be in local VM.
.currentglobal //false .setglobal
/$error 40 dict .forcedef % $error is local, systemdict is global
- % newerror, errorname, command, errorinfo,
- % ostack, estack, dstack, recordstacks,
- % binary, globalmode,
- % .inerror, .nosetlocal, position,
- % plus extra space for badly designed error handers.
+ % newerror, errorname, command, errorinfo,
+ % ostack, estack, dstack, recordstacks,
+ % binary, globalmode,
+ % .inerror, .nosetlocal, position,
+ % plus extra space for badly designed error handers.
$error begin
/newerror //false def
/recordstacks //true def
@@ -1119,22 +1119,22 @@ begin def
/.p1 {2 index exch writestring} bind def
/.p2 {3 index exch writestring} bind def
/.print
- { dup type .dict exch .knownget { exec } { .cvp } ifelse
- } bind def
+ { dup type .dict exch .knownget { exec } { .cvp } ifelse
+ } bind def
/arraytype
- {dup rcheck
- {() exch dup xcheck
- {({) .p2
- {exch .p1
- 1 index exch .print pop ( )} forall
- (})}
- {([) .p2
- {exch .p1
- 1 index exch .print pop ( )} forall
- (])}
- ifelse exch pop .p}
- {.cvp}
- ifelse} bind def
+ {dup rcheck
+ {() exch dup xcheck
+ {({) .p2
+ {exch .p1
+ 1 index exch .print pop ( )} forall
+ (})}
+ {([) .p2
+ {exch .p1
+ 1 index exch .print pop ( )} forall
+ (])}
+ ifelse exch pop .p}
+ {.cvp}
+ ifelse} bind def
/packedarraytype /arraytype load def
{//.dict begin .print pop end}
bind
@@ -1150,20 +1150,20 @@ end
/.dict /write==only load 0 get dup length 2 add dict .copydict dup
begin def
/dicttype
- { dup rcheck
- { (<< ) .p1
- { 2 index 3 -1 roll .print pop ( ) .p1
- 1 index exch .print pop ( ) .p
- }
- forall (>>) .p
- }
- { .cvp
- }
- ifelse
- } bind def
+ { dup rcheck
+ { (<< ) .p1
+ { 2 index 3 -1 roll .print pop ( ) .p1
+ 1 index exch .print pop ( ) .p
+ }
+ forall (>>) .p
+ }
+ { .cvp
+ }
+ ifelse
+ } bind def
/stringtype
- { 1 index exch 2 .writecvp
- } bind def
+ { 1 index exch 2 .writecvp
+ } bind def
{//.dict begin .print pop end}
bind
@@ -1262,7 +1262,7 @@ end
% the value in the dictionary is actually a 2-element writable array,
% to allow us to create a default instance of the prototype on demand.
- % Loop until the .getdevice gets a rangecheck.
+ % Loop until the .getdevice gets a rangecheck.
errordict /rangecheck 2 copy get
errordict /rangecheck { pop stop } put % pop the command
0 { {dup .getdevice exch 1 add} loop} .internalstopped pop
@@ -1281,7 +1281,7 @@ put % errordict /rangecheck
{ systemdict /DEVICE .knownget
{ devicedict 1 index known not
{ (Unknown device: ) print =
- flush /defaultdevice cvx 1 .quit
+ flush /defaultdevice cvx 1 .quit
}
if
}
@@ -1318,30 +1318,30 @@ devicedict /Default devicedict .defaultdevicename get put
% Use an ordered dither for low-resolution devices.
/.setloreshalftone { % <dpi> .setloreshalftone -
- % The following 'ordered dither' spot function was contributed by
- % Gregg Townsend. Thanks, Gregg!
+ % The following 'ordered dither' spot function was contributed by
+ % Gregg Townsend. Thanks, Gregg!
16.001 div 0 % not 16: avoids rounding problems
{ 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add <
- 0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
- CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
- 3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
- FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
- 01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
- C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
- 31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
- F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
- 0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
- CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
- 3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
- FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
- 02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
- C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
- 32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
- F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
+ 0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
+ CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
+ 3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
+ FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
+ 01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
+ C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
+ 31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
+ F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
+ 0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
+ CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
+ 3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
+ FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
+ 02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
+ C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
+ 32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
+ F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
> exch get 256 div
}
bind
- % Use correct, per-plane screens for CMYK devices only.
+ % Use correct, per-plane screens for CMYK devices only.
//systemdict /setcolorscreen known processcolors 4 eq and
{ 3 copy 6 copy //setcolorscreen }
{ //setscreen }
@@ -1358,20 +1358,20 @@ currentpacking //false setpacking
/.linescreen
% The following screen algorithm is used by permission of the author.
{ ((C) 1989 Berthold K.P. Horn) pop
- 1 add 180 mul cos 1 0.08 add mul exch 2 add 180 mul cos
+ 1 add 180 mul cos 1 0.08 add mul exch 2 add 180 mul cos
1 0.08 sub mul add 2 div
}
bind readonly def
setpacking
/.sethireshalftone { % <dpi> .sethireshalftone <doscreen>
- % According to information published by Hewlett-Packard,
- % they use a 60 line screen on 300 DPI printers and
- % an 85 line screen on 600 DPI printers.
- % However, we use a 106 line screen, which produces smoother-
- % looking shades but fewer of them (32 vs. 50).
- % 46 was suggested as a good frequency value for printers
- % between 200 and 400 DPI, so we use it for lower resolutions.
- % Imagesetters need even higher frequency screens.
+ % According to information published by Hewlett-Packard,
+ % they use a 60 line screen on 300 DPI printers and
+ % an 85 line screen on 600 DPI printers.
+ % However, we use a 106 line screen, which produces smoother-
+ % looking shades but fewer of them (32 vs. 50).
+ % 46 was suggested as a good frequency value for printers
+ % between 200 and 400 DPI, so we use it for lower resolutions.
+ % Imagesetters need even higher frequency screens.
//systemdict /DITHERPPI known
{ DITHERPPI
}
@@ -1383,11 +1383,11 @@ setpacking
1 index 4.01 div .min % at least a 4x4 cell
45
//.linescreen
- % Determine whether we have lots of process colors.
- % If so, don't bother with color screening or gamma correction.
- % Also don't do gamma correction on very high-resolution devices.
- % (This should depend on dot gain, not resolution, but we don't
- % currently have a way to determine this.) Ignore missing components
+ % Determine whether we have lots of process colors.
+ % If so, don't bother with color screening or gamma correction.
+ % Also don't do gamma correction on very high-resolution devices.
+ % (This should depend on dot gain, not resolution, but we don't
+ % currently have a way to determine this.) Ignore missing components
% (*Values = 1).
currentdevice mark
/RedValues 0 /GreenValues 0 /BlueValues 0 /GrayValues 0
@@ -1404,33 +1404,33 @@ setpacking
}
repeat
exch pop exch pop 32 lt 4 index 800 lt and 5 1 roll
- % Stack: doscreen dpi freq angle proc
- % Ghostscript currently doesn't use correct, per-plane halftones
- % unless setcolorscreen has been executed. Since these are
- % computationally much more expensive than binary halftones,
- % we check to make sure they are really warranted, i.e., we have
- % a high-resolution CMYK device (i.e., not a display) with
- % fewer than 5 bits per plane (i.e., not a true-color device).
+ % Stack: doscreen dpi freq angle proc
+ % Ghostscript currently doesn't use correct, per-plane halftones
+ % unless setcolorscreen has been executed. Since these are
+ % computationally much more expensive than binary halftones,
+ % we check to make sure they are really warranted, i.e., we have
+ % a high-resolution CMYK device (i.e., not a display) with
+ % fewer than 5 bits per plane (i.e., not a true-color device).
4 -1 roll 150 ge
{ /setcolorscreen where
{ pop //systemdict /COLORSCREEN known
- { COLORSCREEN }
- { 3 index }
- ifelse
- dup //false ne
- { 4 1 roll 3 copy 6 copy 13 -1 roll
- % For really high-quality screening on printers, we need to
- % give each plane its own screen angle. Unfortunately,
- % this currently has very large space and time costs.
- //true eq % true => different angles,
- % 0 => same angles
- { { 45 90 15 75 } { 3 1 roll exch pop 12 3 roll } forall
- }
- if //setcolorscreen
- }
- { pop //setscreen % false => single binary screen
- }
- ifelse
+ { COLORSCREEN }
+ { 3 index }
+ ifelse
+ dup //false ne
+ { 4 1 roll 3 copy 6 copy 13 -1 roll
+ % For really high-quality screening on printers, we need to
+ % give each plane its own screen angle. Unfortunately,
+ % this currently has very large space and time costs.
+ //true eq % true => different angles,
+ % 0 => same angles
+ { { 45 90 15 75 } { 3 1 roll exch pop 12 3 roll } forall
+ }
+ if //setcolorscreen
+ }
+ { pop //setscreen % false => single binary screen
+ }
+ ifelse
}
{ //setscreen % setcolorscreen not known
}
@@ -1440,9 +1440,9 @@ setpacking
}
ifelse
} bind def
-/.sethiresscreen { % <dpi> .sethiresscreen
+/.sethiresscreen { % <dpi> .sethiresscreen
.sethireshalftone % pushes true if a screen halftone used
- % Stack: doscree
+ % Stack: doscree
{
% Set the transfer function to lighten up the grays.
% Parameter values closer to 1 are better for devices with
@@ -1480,7 +1480,7 @@ setpacking
} if
} bind def
/.useloresscreen { % - .useloresscreen <bool>
- % Compute min(|dpi x|,|dpi y|) as the definition of the resolution.
+ % Compute min(|dpi x|,|dpi y|) as the definition of the resolution.
72 72 matrix defaultmatrix dtransform abs exch abs .min
dup 150 lt //systemdict /DITHERPPI known not and
} bind def
@@ -1489,7 +1489,7 @@ setpacking
% contexts so that with LL1, the .set??reshalftone will be used.
%
% - .getdefaulthalftone <halftonedict> true if default found
-% false
+% false
/.getdefaulthalftone {
% try the device to see if it has a default halftone
{ currentdevice /HalftoneDefault gsgetdeviceprop } .internalstopped
@@ -1500,14 +1500,14 @@ setpacking
% false not found
dup not
{ % device did not provide a default, try Resource
- pop { /Default /Halftone /findresource .systemvar exec } .internalstopped
+ pop { /Default /Halftone /findresource .systemvar exec } .internalstopped
{ pop pop //false } { //true } ifelse
}
if
} bind def
/.setdefaulthalftone {
- .getdefaulthalftone
+ .getdefaulthalftone
{ sethalftone }
{ % default not found
.useloresscreen { .setloreshalftone } { .sethireshalftone pop } ifelse
@@ -1534,7 +1534,6 @@ setpacking
(END BASIC COLOR) VMDEBUG
-
% Load image support
%% Replace 1 (gs_img.ps)
(gs_img.ps) runlibfile
@@ -1553,19 +1552,19 @@ setpacking
2 index 2 index 92
put
exch 1 add exch
- }
+ }
if
dup 42 eq { % * -> \*
2 index 2 index 92
put
exch 1 add exch
- }
+ }
if
dup 63 eq { % ? -> \?
2 index 2 index 92
put
exch 1 add exch
- }
+ }
if
2 index 2 index 3 -1 roll put 1 add
} for
@@ -1594,7 +1593,7 @@ setpacking
% because it is already a template.
% Besides that, we cannot combine template using .file_name_combine,
% because template syntax breaks the platform path syntax.
- % To resolve this, we first convert the <template> into
+ % To resolve this, we first convert the <template> into
% a fake filename, and combine it with path,
% obtaining a correct separator. Then we replace
% the fake file name with the given template.
@@ -1625,9 +1624,9 @@ setpacking
} loop
pop pop % b [dl] (templ) (ffn)
- % An internal procedure :
+ % An internal procedure :
{ % {} b [dl] (templ) (ffn) (dffn)
- dup length
+ dup length
1 sub % drop 'x', which was added above.
exch % {} b [dl] (templ) (ffn) ldffn (dffn)
.makepathtemplate % {} b [dl] (templ) (ffn) ldffn (Dffn)
@@ -1683,7 +1682,7 @@ if
% If Level 2 (or higher) functionality is implemented, enable it now.
/.setlanguagelevel where {
pop 2 .setlanguagelevel
- % If the resource machinery is loaded, fix up some things now.
+ % If the resource machinery is loaded, fix up some things now.
/.fixresources where { pop .fixresources } if
} if
/ll3dict where {
@@ -1732,8 +1731,8 @@ currentdict /.runlibfile .undef
currentdict
{ dup type /operatortype eq
{ % This might be a real operator, so bind might cause a typecheck,
- % but we've made the error a no-op temporarily.
- .bind % do a real bind even if NOBIND is set
+ % but we've made the error a no-op temporarily.
+ .bind % do a real bind even if NOBIND is set
}
if pop pop
} forall
@@ -1750,11 +1749,11 @@ defaultdevice
% situation, which pstoedit (among other programs) relies on.
%DISPLAYING not { setdevice (%END DISPLAYING) .skipeof } if
-% If the paper size is not specifed and the device defaults to
+% If the paper size is not specifed and the device defaults to
% letter or A4 paper, select the DEFAULTPAPERSIZE.
systemdict /DEFAULTPAPERSIZE known not {
% Use .defaultpapersize if it returns a known paper size
- .defaultpapersize {
+ .defaultpapersize {
statusdict /.pagetypeprocs get 1 index known {
systemdict exch /DEFAULTPAPERSIZE exch put
} {
@@ -1773,7 +1772,7 @@ systemdict /DEVICEHEIGHT known not and
systemdict /DEVICEWIDTHPOINTS known not and
systemdict /DEVICEHEIGHTPOINTS known not and
{
- defaultdevice mark /PageSize //null .dicttomark .getdeviceparams
+ defaultdevice mark /PageSize //null .dicttomark .getdeviceparams
.dicttomark /PageSize get
dup 0 get 0.5 add cvi 612 eq 1 index 1 get 0.5 add cvi 792 eq and
1 index 0 get 0.5 add cvi 595 eq 2 index 1 get 0.5 add cvi 842 eq and
@@ -1814,7 +1813,7 @@ systemdict /DEVICEHEIGHTPOINTS known not and {
mark /HWResolution //null /HWSize //null /PageSize //null .dicttomark
.getdeviceparams .dicttomark begin
mark
- % Check for resolution.
+ % Check for resolution.
/DEVICEXRESOLUTION where dup
{ exch pop HWResolution 0 DEVICEXRESOLUTION put }
if
@@ -1822,7 +1821,7 @@ systemdict /DEVICEHEIGHTPOINTS known not and {
{ exch pop HWResolution 1 DEVICEYRESOLUTION put }
if
or { /HWResolution HWResolution } if
- % Check for device sizes specified in pixels.
+ % Check for device sizes specified in pixels.
/DEVICEWIDTH where dup
{ exch pop HWSize 0 DEVICEWIDTH put }
if
@@ -1830,7 +1829,7 @@ systemdict /DEVICEHEIGHTPOINTS known not and {
{ exch pop HWSize 1 DEVICEHEIGHT put }
if
or { /HWSize HWSize } if
- % Check for device sizes specified in points.
+ % Check for device sizes specified in points.
/DEVICEWIDTHPOINTS where dup
{ exch pop PageSize 0 DEVICEWIDTHPOINTS put }
if
@@ -1838,7 +1837,7 @@ systemdict /DEVICEHEIGHTPOINTS known not and {
{ exch pop PageSize 1 DEVICEHEIGHTPOINTS put }
if
or { /PageSize PageSize } if
- % Check whether any parameters were set.
+ % Check whether any parameters were set.
dup mark eq { pop defaultdevice } { defaultdevice putdeviceprops } ifelse
end
%END DEVICE
@@ -1873,22 +1872,22 @@ dup { pop .currentpagedevice exch pop } if
not { (%END MEDIA) .skipeof } if
currentpagedevice dup length dict .copydict
dup /Policies
- % Stack: <pagedevice> <pagedevice> /Policies
+ % Stack: <pagedevice> <pagedevice> /Policies
1 index /InputAttributes
2 copy get dup length dict .copydict
- % Stack: <pagedevice> <pagedevice> /Policies <pagedevice>
- % /InputAttributes <inputattrs'>
+ % Stack: <pagedevice> <pagedevice> /Policies <pagedevice>
+ % /InputAttributes <inputattrs'>
dup 0 2 copy get dup length dict .copydict
- % Stack: <pagedevice> <pagedevice> /Policies <pagedevice>
- % /InputAttributes <inputattrs'> <inputattrs'> 0 <attrs0'>
+ % Stack: <pagedevice> <pagedevice> /Policies <pagedevice>
+ % /InputAttributes <inputattrs'> <inputattrs'> 0 <attrs0'>
dup /PageSize 7 index /PageSize get
put % PageSize in 0
put % 0 in InputAttributes
put % InputAttributes in pagedevice
% Also change the page size policy so we don't get an error.
- % Stack: <pagedevice> <pagedevice> /Policies
+ % Stack: <pagedevice> <pagedevice> /Policies
2 copy get dup length dict .copydict
- % Stack: <pagedevice> <pagedevice> /Policies <policies'>
+ % Stack: <pagedevice> <pagedevice> /Policies <policies'>
dup /PageSize 7 put % PageSize in Policies
put % Policies in pagedevice
.setpagedevice
@@ -1911,11 +1910,11 @@ put % Policies in pagedevice
% of the default device, or for a character consuming 1% of the
% maximum cache size, whichever is larger.
mark
- % Compute limit based on character size.
+ % Compute limit based on character size.
18 dup dtransform
exch abs cvi 31 add 32 idiv 4 mul % X raster
exch abs cvi mul % Y
- % Compute limit based on allocated space.
+ % Compute limit based on allocated space.
cachestatus pop pop pop pop pop exch pop 0.01 mul cvi
.max dup 10 idiv exch
setcacheparams
@@ -1984,8 +1983,8 @@ readonly def
/PermitFileReading [
currentuserparams /PermitFileReading get aload pop
/FONTPATH .systemvar (*) .generate_dir_list_templates
- % Library files :
- /LIBPATH .systemvar (*) .generate_dir_list_templates
+ % Library files :
+ /LIBPATH .systemvar (*) .generate_dir_list_templates
% Resource files on OpenVMS requires a separate template (gs:[dir.*]*)
% because the (gs:[dir]*) doesn't cover them.
/LIBPATH .systemvar (*) .file_name_separator (*)
@@ -2080,22 +2079,22 @@ SAFER { .setsafe } if
/.currentuserparams where {
pop
- % Remove real user params from psuserparams.
+ % Remove real user params from psuserparams.
mark .currentuserparams counttomark 2 idiv {
pop psuserparams exch undef
} repeat pop
- % Update the copy of the user parameters.
+ % Update the copy of the user parameters.
mark .currentuserparams counttomark 2 idiv {
userparams 3 1 roll .forceput % userparams is read-only
} repeat pop
- % Turn on idiom recognition, if available.
+ % Turn on idiom recognition, if available.
currentuserparams /IdiomRecognition known {
/IdiomRecognition //true .definepsuserparam
} if
psuserparams readonly pop
systemdict /.definepsuserparam undef
- % Save a copy of userparams for use with save/restore
- % (and, if implemented, context switching).
+ % Save a copy of userparams for use with save/restore
+ % (and, if implemented, context switching).
.currentglobal //false .setglobal
mark userparams { } forall .dicttomark readonly
/userparams exch .forcedef % systemdict is read-only
@@ -2103,7 +2102,7 @@ SAFER { .setsafe } if
} if
/.currentsystemparams where {
pop
- % Remove real system params from pssystemparams.
+ % Remove real system params from pssystemparams.
mark .currentsystemparams counttomark 2 idiv {
pop pssystemparams exch .forceundef
} repeat pop
@@ -2130,13 +2129,13 @@ $error /.nosetlocal //false put
(END GLOBAL) VMDEBUG
/.savelocalstate where {
- % If we might create new contexts, save away copies of all dictionaries
- % referenced from systemdict that are stored in local VM,
- % and also save a copy of the initial gstate.
+ % If we might create new contexts, save away copies of all dictionaries
+ % referenced from systemdict that are stored in local VM,
+ % and also save a copy of the initial gstate.
pop .savelocalstate
} {
- % If we're *not* running in a multi-context system and FAKEFONTS is
- % defined, add the fake fonts to LocalFontDirectory.
+ % If we're *not* running in a multi-context system and FAKEFONTS is
+ % defined, add the fake fonts to LocalFontDirectory.
.definefakefonts % current VM is local
} ifelse
diff --git a/gs/Resource/Init/gs_l2img.ps b/gs/Resource/Init/gs_l2img.ps
index fc4e2b286..37594b5ee 100644
--- a/gs/Resource/Init/gs_l2img.ps
+++ b/gs/Resource/Init/gs_l2img.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -40,39 +40,39 @@ ifelse
/DeviceCMYK { 4 /setcmykcolor load } bind def
/Indexed
{ dup 1 index 1 get //.csncompdict exch get exec
- % Stack: [/Indexed base hival map] ncomp basesetcolor
+ % Stack: [/Indexed base hival map] ncomp basesetcolor
3 -1 roll 3 get mark 3 1 roll
- % Stack: ncomp -mark- basesetcolor map
+ % Stack: ncomp -mark- basesetcolor map
dup type /stringtype eq
{ { -
- { exch round cvi get 255 div
- }
- -
- { exch round cvi 3 mul 2 copy 2 copy get 255 div
- 3 1 roll 1 add get 255 div
- 4 2 roll 2 add get 255 div
- }
- { exch round cvi 4 mul 2 copy 2 copy 2 copy get 255 div
- 3 1 roll 1 add get 255 div
- 4 2 roll 2 add get 255 div
- 5 3 roll 3 add get 255 div
- }
- }
- 4 index get aload pop counttomark -1 roll
+ { exch round cvi get 255 div
+ }
+ -
+ { exch round cvi 3 mul 2 copy 2 copy get 255 div
+ 3 1 roll 1 add get 255 div
+ 4 2 roll 2 add get 255 div
+ }
+ { exch round cvi 4 mul 2 copy 2 copy 2 copy get 255 div
+ 3 1 roll 1 add get 255 div
+ 4 2 roll 2 add get 255 div
+ 5 3 roll 3 add get 255 div
+ }
+ }
+ 4 index get aload pop counttomark -1 roll
}
{ /exec load 3 -1 roll
- % Stack: -mark- mapproc --exec-- basesetcolor
+ % Stack: -mark- mapproc --exec-- basesetcolor
}
ifelse .packtomark cvx
exch pop 1 exch
} bind def
/Separation
{ dup 2 index //.csncompdict exch get exec
- % Stack: [/Separation name alt xform] ncomp altsetcolor
+ % Stack: [/Separation name alt xform] ncomp altsetcolor
3 -1 roll 3 get /exec load 3 -1 roll 3 array astore readonly cvx
exch pop 1 exch
} bind def
- % Substitute device spaces for CIE spaces.
+ % Substitute device spaces for CIE spaces.
/CIEBasedA /DeviceGray load def
/CIEBasedABC /DeviceRGB load def
/CIEBasedDEF /DeviceRGB load def
@@ -82,8 +82,8 @@ end
/.packtomark { counttomark packedarray exch pop } bind def
/.csinextbits % - .csinextbits <bits>
- % Uses b, nnb, i, row, mask, BitsPerComponent;
- % sets b, nnb, i.
+ % Uses b, nnb, i, row, mask, BitsPerComponent;
+ % sets b, nnb, i.
{ /nnb nnb BitsPerComponent add
{ dup 0 le { exit } if
/b b 8 bitshift row i get add def
@@ -108,10 +108,10 @@ end
ifelse def
/nextpixel mark 0 2 ncomp 1 sub 2 mul
{ /nextbits cvx exch
- Decode exch 2 getinterval
- dup aload pop exch sub
- dup mask eq { pop } { mask div /mul load 3 -1 roll } ifelse
- 0 get dup 0 eq { pop } { /sub load 3 -1 roll } ifelse
+ Decode exch 2 getinterval
+ dup aload pop exch sub
+ dup mask eq { pop } { mask div /mul load 3 -1 roll } ifelse
+ 0 get dup 0 eq { pop } { /sub load 3 -1 roll } ifelse
}
for
/setpixelcolor load dup type /operatortype ne { /exec load } if
@@ -119,30 +119,30 @@ end
/readrow
/DataSource load dup type
dup /arraytype eq exch /packedarraytype eq or
- { % Must be { <file> <string> ... }
- aload length 1 add array /pop load exch astore
- dup 1 row put cvx
- }
- { pop
- % Adobe requires readstring to signal an error if given
- % an empty string. Work around this nonsense here.
+ { % Must be { <file> <string> ... }
+ aload length 1 add array /pop load exch astore
+ dup 1 row put cvx
+ }
+ { pop
+ % Adobe requires readstring to signal an error if given
+ % an empty string. Work around this nonsense here.
row length 0 eq
- { { } }
- { { DataSource row readstring pop pop } }
- ifelse
- }
+ { { } }
+ { { DataSource row readstring pop pop } }
+ ifelse
+ }
ifelse def
ImageMatrix matrix invertmatrix concat
/imat matrix def
0 1 Height 1 sub
{ imat 5 3 -1 roll neg put
- readrow
- /b 0 def /nnb 0 def /i 0 def
- 0 1 Width 1 sub
- { imat 4 3 -1 roll neg put nextpixel
- 1 1 //true imat {<80>} imagemask
- }
- for
+ readrow
+ /b 0 def /nnb 0 def /i 0 def
+ 0 1 Width 1 sub
+ { imat 4 3 -1 roll neg put nextpixel
+ 1 1 //true imat {<80>} imagemask
+ }
+ for
}
for
end restore
@@ -162,7 +162,7 @@ currentdict end def
/Decode /DataSource /ImageMatrix /BitsPerComponent /Height /Width
] def
/colorimage % <width> <height> <bits/comp> <matrix>
- % <datasrc> false <ncomp> colorimage -
+ % <datasrc> false <ncomp> colorimage -
{ 1 index { /colorimage .systemvar /rangecheck signalerror } if exch pop
//.cincompdict exch get exec
7 dict begin /ColorSpace exch cvlit def
@@ -171,7 +171,7 @@ currentdict end def
} bind odef
/image
{ dup type /dicttype ne
- { 7 dict begin /ColorSpace /DeviceGray def [0 1]
+ { 7 dict begin /ColorSpace /DeviceGray def [0 1]
.imagekeys { exch cvlit def } forall
currentdict end
}
diff --git a/gs/Resource/Init/gs_lev2.ps b/gs/Resource/Init/gs_lev2.ps
index 0017150ca..fb21dcf7d 100644
--- a/gs/Resource/Init/gs_lev2.ps
+++ b/gs/Resource/Init/gs_lev2.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -49,17 +49,17 @@ level2dict begin
exch type eq
} .bind def
/.checksetparams { % <newdict> <opname> <checkdict>
- % .checksetparams <newdict>
+ % .checksetparams <newdict>
2 .argindex {
- % Stack: newdict opname checkdict key newvalue
+ % Stack: newdict opname checkdict key newvalue
3 copy 3 1 roll .knownget {
exec not {
- pop pop pop load /typecheck signalerror
+ pop pop pop load /typecheck signalerror
} if
dup type /stringtype eq {
- dup rcheck not {
- pop pop pop load /invalidaccess signalerror
- } if
+ dup rcheck not {
+ pop pop pop load /invalidaccess signalerror
+ } if
} if
} {
pop
@@ -75,20 +75,20 @@ level2dict begin
% be changed. Also be careful to preserve 'executable' state.
/.copyparam { % <value> .copyparam <value'>
dup type /arraytype eq {
- .currentglobal //true .setglobal exch
+ .currentglobal //true .setglobal exch
dup wcheck exch dup xcheck exch % original attributes
dup length array exch dup { % stack: destination_array original_array original_array
dup type /arraytype eq {
- dup 2 index ne { % avoid recursion
+ dup 2 index ne { % avoid recursion
.copyparam % recurse to handle composite array elements
} {
- % this array self referenced, do it again (yuk!)
- pop 1 index % get copy of destination array
- } ifelse
+ % this array self referenced, do it again (yuk!)
+ pop 1 index % get copy of destination array
+ } ifelse
} {
dup type /stringtype eq {
- .copyparam
- } if
+ .copyparam
+ } if
}
ifelse 3 1 roll % keep arrays on top
} forall pop astore
@@ -128,28 +128,28 @@ end
% We break out setuserparams into a separate procedure so that setvmxxx
% can use it without affecting the command in case of an error.
/.setuserparams2 {
- % Check that we will be able to set the PostScript-level
- % user parameters.
+ % Check that we will be able to set the PostScript-level
+ % user parameters.
/setuserparams /psuserparams .systemvar .checksetparams
- % Set the C-level user params. If this succeeds, we know that
- % the password check succeeded.
+ % Set the C-level user params. If this succeeds, we know that
+ % the password check succeeded.
dup .setuserparams
- % Now set the PostScript-level params.
- % The interpreter may have adjusted the values of some of the
- % parameters, so we have to read them back.
+ % Now set the PostScript-level params.
+ % The interpreter may have adjusted the values of some of the
+ % parameters, so we have to read them back.
dup {
/userparams .systemvar 2 index known {
psuserparams 2 index known not {
- pop dup .getuserparam
+ pop dup .getuserparam
} if
.copyparam
% special protection for the security related parameters
[ /PermitFileReading /PermitFileWriting /PermitFileControl ]
{ 2 index eq { % force all strings to readonly but make sure the
- % array is in the correct VM space (local/global).
- currentglobal exch dup gcheck setglobal
- dup length array exch { readonly exch } forall astore
- exch setglobal
+ % array is in the correct VM space (local/global).
+ currentglobal exch dup gcheck setglobal
+ dup length array exch { readonly exch } forall astore
+ exch setglobal
} if
} forall
% protect top level of parameters that we copied
@@ -159,10 +159,10 @@ end
pop pop
} ifelse
} forall
- % A context switch might have occurred during the above loop,
- % causing the interpreter-level parameters to be reset.
- % Set them again to the new values. From here on, we are safe,
- % since a context switch will consult userparams.
+ % A context switch might have occurred during the above loop,
+ % causing the interpreter-level parameters to be reset.
+ % Set them again to the new values. From here on, we are safe,
+ % since a context switch will consult userparams.
.setuserparams
} .bind def
/setuserparams { % <dict> setuserparams -
@@ -191,14 +191,14 @@ end
mark .currentsystemparams //pssystemparams { } forall .dicttomark
} odef
/setsystemparams { % <dict> setsystemparams -
- % Check that we will be able to set the PostScript-level
- % system parameters.
+ % Check that we will be able to set the PostScript-level
+ % system parameters.
dup pop % check # of args
/SAFETY .systemvar /safe get {
% SAFER mode disallows some changes
[ /GenericResourceDir /FontResourceDir /GenericResourcePathSep ] {
2 copy .knownget {
- exch //pssystemparams exch .knownget {
+ exch //pssystemparams exch .knownget {
ne { /setsystemparams /invalidaccess signalerror } if
} {
pop
@@ -211,18 +211,18 @@ end
/setsystemparams //pssystemparams mark exch {
type cvlit /.checkparamtype cvx 2 packedarray cvx
} forall .dicttomark .checksetparams
- % Set the C-level system params. If this succeeds, we know that
- % the password check succeeded.
+ % Set the C-level system params. If this succeeds, we know that
+ % the password check succeeded.
dup .setsystemparams
- % Now set the PostScript-level params. We must copy local strings
- % into global VM.
+ % Now set the PostScript-level params. We must copy local strings
+ % into global VM.
dup
{ //pssystemparams 2 index known
{ % Stack: key newvalue
- .copyparam
- % protect top level parameters that we copied
+ .copyparam
+ % protect top level parameters that we copied
dup type dup /arraytype eq exch /stringtype eq or { readonly } if
- //pssystemparams 3 1 roll .forceput % pssystemparams is read-only
+ //pssystemparams 3 1 roll .forceput % pssystemparams is read-only
}
{ pop pop
}
@@ -246,10 +246,10 @@ end
} if
} .bind odef
/setcacheparams {
- % The MaxFontCache parameter is a system parameter, which we might
- % not be able to set. Fortunately, this doesn't matter, because
- % system parameters don't have to be synchronized between this code
- % and the VM.
+ % The MaxFontCache parameter is a system parameter, which we might
+ % not be able to set. Fortunately, this doesn't matter, because
+ % system parameters don't have to be synchronized between this code
+ % and the VM.
counttomark 1 add copy setcacheparams
currentcacheparams % mark size lower upper
3 -1 roll pop
@@ -282,7 +282,7 @@ end
% in addition to validating the value, ensure the value is read/only
dup { readonly exch } forall
.currentglobal exch dup gcheck .setglobal length array exch .setglobal
- astore readonly
+ astore readonly
}
ifelse
} {
@@ -450,7 +450,7 @@ serverdict begin
/.jobsave //null def % top-level save object
/.jobsavelevel 0 def % save depth of job (0 if .jobsave is null,
- % 1 otherwise)
+ % 1 otherwise)
/.adminjob //true def % status of current unencapsulated job
end % serverdict
@@ -463,49 +463,49 @@ end % serverdict
%**************** The definition of startjob is not complete yet, since
% it doesn't reset stdin/stdout.
/.startnewjob { % <exit_bool> <password_level>
- % .startnewjob -
+ % .startnewjob -
serverdict /.jobsave get dup //null eq { pop } { restore } ifelse
exch {
- % Unencapsulated job
+ % Unencapsulated job
serverdict /.jobsave //null put
serverdict /.jobsavelevel 0 put
serverdict /.adminjob 3 -1 roll 1 gt put
} {
- % Encapsulated job
+ % Encapsulated job
pop
serverdict /.jobsave save put
serverdict /.jobsavelevel 1 put
.userdict /quit { stop } .bind put % CET 28-10 requires a procedure
} ifelse
- % Reset the interpreter state.
+ % Reset the interpreter state.
clear cleardictstack
initgraphics
//false setglobal
2 vmreclaim % Make sure GC'ed memory is reclaimed and freed.
} bind def
/.startjob { % <exit_bool> <password> <finish_proc>
- % .startjob <ok_bool>
+ % .startjob <ok_bool>
vmstatus pop pop serverdict /.jobsavelevel get eq
2 .argindex .checkpassword 0 gt and {
exch .checkpassword exch count 3 roll count 3 sub { pop } repeat
cleardictstack
- % Reset the e-stack back to the 2 .stopped in .runexec,
- % passing the finish_proc to be executed afterwards.
+ % Reset the e-stack back to the 2 .stopped in .runexec,
+ % passing the finish_proc to be executed afterwards.
2 .stop
} { % Password check failed
pop pop pop //false
} ifelse
} odef
/startjob { % <exit_bool> <password> startjob <ok_bool>
- % This is a hack. We really need some way to indicate explicitly
- % to the interpreter that we are under control of a job server.
+ % This is a hack. We really need some way to indicate explicitly
+ % to the interpreter that we are under control of a job server.
1 .argindex type /booleantype ne {
/startjob .systemvar /typecheck signalerror
} if
{ .startnewjob //true } .startjob
} odef
-% The procedure to undo the job encapsulation
+% The procedure to undo the job encapsulation
/.endjob {
clear cleardictstack
serverdict /.jobsave get dup //null eq { pop } { restore } ifelse
@@ -630,7 +630,6 @@ currentuserparams /WaitTimeout known
%pagestackorder
%setpagestackorder
-
% -------- ICC manager -------- %
% All color management is going
% through ICC flow. We need
@@ -646,10 +645,10 @@ currentuserparams /WaitTimeout known
mark .currentuserparams .dicttomark /ICCProfilesDir get
(default_gray.icc) concatstrings status {
pop pop pop pop % current value was OK. Just clean up stack
- } {
+ } {
% Search for valid (iccprofiles) directory as a sibling to (Resource)
% and set it as a default if found.
- LIBPATH {
+ LIBPATH {
(Resource) search {
exch pop exch pop (iccprofiles) concatstrings
.file_name_separator concatstrings
@@ -724,24 +723,24 @@ currentdict end
(*) 3 1 roll /IODevice resourceforall
} odef
/devstatus { % <(%disk*%)> devstatus <searchable> <writable>
- % <hasNames> <mounted> <removable> <searchOrder>
- % <freePages> <size> true
- % <string> devstatus false
+ % <hasNames> <mounted> <removable> <searchOrder>
+ % <freePages> <size> true
+ % <string> devstatus false
dup length 5 ge {
dup 0 5 getinterval (%disk) eq {
dup /IODevice resourcestatus {
- pop pop dup currentdevparams
- dup /Searchable get
- exch dup /Writeable get
- exch dup /HasNames get
- exch dup /Mounted get
- exch dup /Removable get
- exch dup /SearchOrder get
- exch dup /Free get
- exch /LogicalSize get
- 9 -1 roll pop //true
+ pop pop dup currentdevparams
+ dup /Searchable get
+ exch dup /Writeable get
+ exch dup /HasNames get
+ exch dup /Mounted get
+ exch dup /Removable get
+ exch dup /SearchOrder get
+ exch dup /Free get
+ exch /LogicalSize get
+ 9 -1 roll pop //true
} {
- pop //false
+ pop //false
} ifelse
} {
pop //false
@@ -765,27 +764,25 @@ systemdict /colorspacedict get begin
/Separation [] def
end
-
-
% ------ CIE color rendering ------ %
% Define findcolorrendering and a default ColorRendering ProcSet.
/findcolorrendering { % <intentname> findcolorrendering
- % <crdname> <found>
+ % <crdname> <found>
% Adobe interpreters report /findcolorrendering (literal name), not the
% operator itself, if an error occurs in findcolorrendering.
/findcolorrendering {
- /ColorRendering /ProcSet findresource
- 1 .argindex dup type /nametype eq { .namestring } if (.) concatstrings
- 1 index /GetPageDeviceName get exec dup type /nametype eq { .namestring } if (.) concatstrings
- 2 index /GetHalftoneName get exec dup type /nametype eq { .namestring } if
- concatstrings concatstrings cvn % stack: intentname procset crdname
- dup /ColorRendering resourcestatus {
- pop pop exch pop exch pop //true
- } {
- pop /GetSubstituteCRD get exec //false
- } ifelse
+ /ColorRendering /ProcSet findresource
+ 1 .argindex dup type /nametype eq { .namestring } if (.) concatstrings
+ 1 index /GetPageDeviceName get exec dup type /nametype eq { .namestring } if (.) concatstrings
+ 2 index /GetHalftoneName get exec dup type /nametype eq { .namestring } if
+ concatstrings concatstrings cvn % stack: intentname procset crdname
+ dup /ColorRendering resourcestatus {
+ pop pop exch pop exch pop //true
+ } {
+ pop /GetSubstituteCRD get exec //false
+ } ifelse
} .errorexec
} odef
@@ -822,7 +819,7 @@ end
/setcolorrendering .systemvar /typecheck signalerror
} if
//.colorrenderingtypes exch .knownget {
- exec
+ exec
} {
/setcolorrendering .systemvar /rangecheck signalerror
} ifelse
@@ -831,7 +828,7 @@ end
/.setcolorrendering1 where { pop } { (%END CRD) .skipeof } ifelse
.colorrenderingtypes 1 {
- % Adobe ProcSet "Adobe_AGM_Core 2.0 0" places an /Intent key into CRD's
+ % Adobe ProcSet "Adobe_AGM_Core 2.0 0" places an /Intent key into CRD's
dup /Intent .knownget {
//.renderingintentdict exch .knownget { .setrenderingintent } if
} if
@@ -851,12 +848,12 @@ mark
% Bradford Cone Space
/MatrixPQR [ 0.8951 -0.7502 0.0389
- 0.2664 1.7135 -0.0685
- -0.1614 0.0367 1.0296] readonly
+ 0.2664 1.7135 -0.0685
+ -0.1614 0.0367 1.0296] readonly
/MatrixLMN [ 3.240449 -0.969265 0.055643
- -1.537136 1.876011 -0.204026
- -0.498531 0.041556 1.057229 ] readonly
+ -1.537136 1.876011 -0.204026
+ -0.498531 0.041556 1.057229 ] readonly
% Inverse sRGB gamma transform
/EncodeABC [ { dup 0.00304 le
@@ -873,7 +870,7 @@ mark
/TransformPQR
% The implementations have been moved to C for performance.
[ { .TransformPQR_scale_WB0 } bind
- { .TransformPQR_scale_WB1 } bind
+ { .TransformPQR_scale_WB1 } bind
{ .TransformPQR_scale_WB2 } bind
] readonly
.dicttomark setcolorrendering
@@ -895,27 +892,26 @@ mark
.dicttomark readonly
] readonly def
-
% Special type to install
% sRGB ICC profile color space
/CIEsRGBICC [ /ICCBased
mark
- /N 3
+ /N 3
/DataSource (srgb)
/Alternate [/DeviceRGB]
- /Name (srgb)
- .dicttomark
+ /Name (srgb)
+ .dicttomark
] def
% Special type to install
% sGray ICC profile color space
/CIEsGRAYICC [ /ICCBased
mark
- /N 1
+ /N 1
/DataSource (sgray)
/Alternate [/DeviceGray]
- /Name (sgray)
- .dicttomark
+ /Name (sgray)
+ .dicttomark
] def
% ------ Painting ------ %
@@ -923,8 +919,8 @@ mark
% A straightforward definition of execform that doesn't actually
% do any caching.
/.execform1 {
- % This is a separate operator so that the stacks will be restored
- % properly if an error occurs.
+ % This is a separate operator so that the stacks will be restored
+ % properly if an error occurs.
dup /Matrix get concat
dup /BBox get aload pop
exch 3 index sub exch 2 index sub rectclip
@@ -958,11 +954,11 @@ def
/makepattern .systemvar /rangecheck signalerror
} if
.currentglobal //false .setglobal exch
- % Stack: proto matrix global buildproc
+ % Stack: proto matrix global buildproc
3 index dup length 1 add dict .copydict
- % Stack: proto matrix global buildproc newdict
+ % Stack: proto matrix global buildproc newdict
3 index 3 -1 roll exec
- % Stack: proto matrix global newdict instance
+ % Stack: proto matrix global newdict instance
% Create an 'Implementation' entry for the pattern dict. The PRLM 3rd says
% this about the contents of Implementation: "The type and value of this
% entry are implementation-dependent." The CET (page 2 of 18-02f) expects
@@ -972,7 +968,7 @@ def
1 index /Implementation 3 -1 roll
.getCPSImode { gstate } { //null } ifelse 2 array astore
put % put Implementation into the pattern dict.
- % Stack: proto matrix global newdict
+ % Stack: proto matrix global newdict
readonly exch .setglobal exch pop exch pop
} odef
@@ -996,7 +992,7 @@ def
%
% We are providing these functions because we have found files created by
% "QuarkXPress: pictwpstops filter 1.0" which produce bad shading dictionaries
-% if these operators are not defined.
+% if these operators are not defined.
% Conditionally disable the TN 5044 psuedo-ops if NO_TN5044 specified
/NO_TN5044 where { pop (%END TN 5044 psuedo-ops) .skipeof } if
diff --git a/gs/Resource/Init/gs_ll3.ps b/gs/Resource/Init/gs_ll3.ps
index 43d1d2d5c..0531dbef2 100644
--- a/gs/Resource/Init/gs_ll3.ps
+++ b/gs/Resource/Init/gs_ll3.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -40,18 +40,18 @@ languagelevel dup 2 .max .setlanguagelevel
(*) {
/IdiomSet findresource
//false exch {
- % Stack: proc //false dummykey [template substitute]
- exch pop dup 1 get exch 0 get
- % Stack: proc //false substitute template
- 3 index .eqproc {
- 2 index gcheck 1 index gcheck not and {
- pop
- } {
- 3 -1 roll pop exch not exit
- } ifelse
- } {
- pop
- } ifelse
+ % Stack: proc //false dummykey [template substitute]
+ exch pop dup 1 get exch 0 get
+ % Stack: proc //false substitute template
+ 3 index .eqproc {
+ 2 index gcheck 1 index gcheck not and {
+ pop
+ } {
+ 3 -1 roll pop exch not exit
+ } ifelse
+ } {
+ pop
+ } ifelse
} forall { exit } if
} //.bindscratch /IdiomSet resourceforall
} if
@@ -59,7 +59,7 @@ languagelevel dup 2 .max .setlanguagelevel
/.bind /.bind_ load odef % note that .bind_ will get bound
currentdict /.bindscratch .undef
-DELAYBIND NOBIND or not {
+DELAYBIND NOBIND or not {
% We can't just do
% /bind /.bind load def
% because then /bind load == prints --.bind-- .
@@ -85,8 +85,8 @@ currentdict /.bind_ undef
% (currently only 1 and 3).
/.makehalftone7 { % <dict> <dict> <source> <Width> <Height>
- % (<Width2> <Height2> | null) <BPS> .makehalftone7
- % <setdict> <dict5> { .sethalftone5 }
+ % (<Width2> <Height2> | null) <BPS> .makehalftone7
+ % <setdict> <dict5> { .sethalftone5 }
8 dict begin
/HalftoneType 7 def
/BitsPerSample exch def
@@ -98,13 +98,13 @@ currentdict /.bind_ undef
/Height 1 index def
/Width 2 index def
mul add BitsPerSample 8 idiv mul .bigstring
- % Stack: dict dict source str
+ % Stack: dict dict source str
dup type /stringtype eq { readstring } { .readbytestring } ifelse
not { /sethalftone .systemvar /rangecheck signalerror exit } if
readonly /Thresholds exch def
/TransferFunction .knownget { /TransferFunction exch def } if
- % If the original Thresholds was a file, replace it with
- % a new one.
+ % If the original Thresholds was a file, replace it with
+ % a new one.
dup /Thresholds get type /filetype eq {
dup /Thresholds [ Thresholds ] cvx 0 () .subfiledecode put
} if
@@ -117,39 +117,39 @@ currentdict /.bind_ undef
} bind def
/.readbytestring { % <source> <bytestring> .readbytestring
- % <bytestring> <filled>
- % Note that since bytestrings don't implement getinterval,
- % if filled is false, there is no way to tell how much
- % was read.
+ % <bytestring> <filled>
+ % Note that since bytestrings don't implement getinterval,
+ % if filled is false, there is no way to tell how much
+ % was read.
//true exch 0 1 2 index length 1 sub {
- % Stack: source true str index
+ % Stack: source true str index
3 index read not { pop exch not exch exit } if
3 copy put pop pop
} for 3 -1 roll pop exch
} bind def
/.sethalftone6 { % <dict> <dict> .sethalftone6 <setdict> <dict5>
- % { .sethalftone5 }
- % Keys: Width, Height, Thresholds, T'Function
+ % { .sethalftone5 }
+ % Keys: Width, Height, Thresholds, T'Function
dup /Thresholds get
1 index /Width get 2 index /Height get
//null 8 .makehalftone7
} bind def
/.sethalftone10 { % <dict> <dict> .sethalftone10 <setdict> <dict5>
- % { .sethalftone5 }
- % Keys: Xsquare, Ysquare, Thresholds, T'Function
- % Note that this is the only one of these three HalftoneTypes
- % that allows either a file or a string for Thresholds.
+ % { .sethalftone5 }
+ % Keys: Xsquare, Ysquare, Thresholds, T'Function
+ % Note that this is the only one of these three HalftoneTypes
+ % that allows either a file or a string for Thresholds.
dup /Thresholds get dup type /stringtype eq { 0 () .subfiledecode } if
1 index /Xsquare get dup 3 index /Ysquare get dup
8 .makehalftone7
} bind def
/.sethalftone16 { % <dict> <dict> .sethalftone16 <setdict> <dict5>
- % { .sethalftone5 }
- % Keys: Width, Height, Width2, Height2,
- % Thresholds, T'Function
+ % { .sethalftone5 }
+ % Keys: Width, Height, Width2, Height2,
+ % Thresholds, T'Function
dup /Thresholds get
1 index /Width get 2 index /Height get
3 index /Width2 .knownget { % 2-rectangle case
@@ -375,15 +375,15 @@ systemdict /.reuseparamdict mark
% Copy the dictionary to replace the DataSource, but make sure the
% copy is in the same VM as the original.
.currentglobal 2 index gcheck .setglobal
- % Stack: shdict rsdfile saveglobal
+ % Stack: shdict rsdfile saveglobal
2 index dup length dict copy exch .setglobal
dup /DataSource 4 -1 roll put exch pop
} {
pop
} ifelse
} if
- % The .buildshading operators use the current color space
- % for ColorSpace.
+ % The .buildshading operators use the current color space
+ % for ColorSpace.
dup /ShadingType .knownget not { % error handling for CET 12-14b conformance
/$error .systemvar /errorinfo [ /ShadingType //null ] put
/shfill .systemvar /undefined signalerror
@@ -402,7 +402,7 @@ systemdict /.reuseparamdict mark
/shfill .systemvar /$error .systemvar /errorname get signalerror
} if
exec
- } {
+ } {
/$error .systemvar /errorinfo [ /ColorSpace //null ] put
/shfill .systemvar /undefined signalerror
} ifelse
@@ -410,13 +410,13 @@ systemdict /.reuseparamdict mark
systemdict /.reuseparamdict undef
/.buildpattern2 { % <template> <matrix> .buildpattern2
- % <template> <pattern>
- % We want to build the pattern without doing gsave/grestore,
- % since we want it to load the CIE caches.
+ % <template> <pattern>
+ % We want to build the pattern without doing gsave/grestore,
+ % since we want it to load the CIE caches.
1 index /Shading get
mark currentcolor currentcolorspace
counttomark 4 add -3 roll mark 4 1 roll
- % Stack: -mark- ..color.. cspace -mark- template matrix shadingdict
+ % Stack: -mark- ..color.. cspace -mark- template matrix shadingdict
{ .buildshading } stopped {
cleartomark setcolorspace setcolor pop stop
} if
@@ -428,9 +428,9 @@ systemdict /.reuseparamdict undef
2 /.buildpattern2 load put
/shfill { % <shadingdict> shfill -
- % Currently, .shfill requires that the color space
- % in the pattern be the current color space.
- % Disable overprintmode for shfill
+ % Currently, .shfill requires that the color space
+ % in the pattern be the current color space.
+ % Disable overprintmode for shfill
{ dup gsave 0 .setoverprintmode .buildshading .shfill } stopped
grestore {
/$error .systemvar /errorinfo 2 copy known {
diff --git a/gs/Resource/Init/gs_mex_e.ps b/gs/Resource/Init/gs_mex_e.ps
index cc1e20857..d69e03bb9 100644
--- a/gs/Resource/Init/gs_mex_e.ps
+++ b/gs/Resource/Init/gs_mex_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/Resource/Init/gs_mgl_e.ps b/gs/Resource/Init/gs_mgl_e.ps
index cfdc8a751..3d2143f82 100644
--- a/gs/Resource/Init/gs_mgl_e.ps
+++ b/gs/Resource/Init/gs_mgl_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -29,11 +29,11 @@ ifelse
99 index 128 45 getinterval aload pop
% 143
/notequal /AE
- /Oslash /infinity /plusminus /lessequal /greaterequal
+ /Oslash /infinity /plusminus /lessequal /greaterequal
/yen /mu1 /partialdiff /summation /product
- /pi /integral /ordfeminine /ordmasculine /Ohm
+ /pi /integral /ordfeminine /ordmasculine /Ohm
/ae /oslash /questiondown /exclamdown /logicalnot
- /radical /florin /approxequal /increment /guillemotleft
+ /radical /florin /approxequal /increment /guillemotleft
/guillemotright /ellipsis /nbspace
% 173
174 index 203 12 getinterval aload pop
@@ -47,16 +47,16 @@ ifelse
% 219
220 index 249 7 getinterval aload pop
% 226
- /Lslash /lslash /Scaron /scaron
+ /Lslash /lslash /Scaron /scaron
/Zcaron /zcaron /brokenbar /Eth /eth
- /Yacute /yacute /Thorn /thorn /minus
+ /Yacute /yacute /Thorn /thorn /minus
/multiply /onesuperior /twosuperior /threesuperior /onehalf
- /onequarter /threequarters /franc /Gbreve /gbreve
- % The TrueType documentation says the next glyph is named
- % Idot, but the Adobe standard name for this glyph is
- % Idotaccent.
+ /onequarter /threequarters /franc /Gbreve /gbreve
+ % The TrueType documentation says the next glyph is named
+ % Idot, but the Adobe standard name for this glyph is
+ % Idotaccent.
/Idotaccent /Scedilla /scedilla /Cacute /cacute
- /Ccaron /ccaron /dmacron
+ /Ccaron /ccaron /dmacron
260 -1 roll pop % delete MacRomanEncoding
258 packedarray
7 1 index .registerencoding
diff --git a/gs/Resource/Init/gs_mro_e.ps b/gs/Resource/Init/gs_mro_e.ps
index d6006d4c6..f83fa9d74 100644
--- a/gs/Resource/Init/gs_mro_e.ps
+++ b/gs/Resource/Init/gs_mro_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -29,9 +29,9 @@ StandardEncoding 97 31 getinterval aload pop
/Adieresis /Aring /Ccedilla /Eacute /Ntilde /Odieresis /Udieresis /aacute
/agrave /acircumflex /adieresis /atilde /aring /ccedilla /eacute /egrave
/ecircumflex /edieresis /iacute /igrave
- /icircumflex /idieresis /ntilde /oacute
+ /icircumflex /idieresis /ntilde /oacute
/ograve /ocircumflex /odieresis /otilde
- /uacute /ugrave /ucircumflex /udieresis
+ /uacute /ugrave /ucircumflex /udieresis
% \24x
/dagger /degree /cent /sterling /section /bullet /paragraph /germandbls
/registered /copyright /trademark /acute /dieresis /.notdef /AE /Oslash
@@ -39,21 +39,21 @@ StandardEncoding 97 31 getinterval aload pop
/.notdef /.notdef /.notdef /ordfeminine /ordmasculine /.notdef /ae /oslash
% \30x
/questiondown /exclamdown /logicalnot /.notdef
- /florin /.notdef /.notdef /guillemotleft
+ /florin /.notdef /.notdef /guillemotleft
/guillemotright /ellipsis /space /Agrave /Atilde /Otilde /OE /oe
/endash /emdash /quotedblleft /quotedblright
- /quoteleft /quoteright /divide /.notdef
- % NOTE: Euro should replace currency, but the PDF 1.3 documentation
- % explicitly says it does not.
+ /quoteleft /quoteright /divide /.notdef
+ % NOTE: Euro should replace currency, but the PDF 1.3 documentation
+ % explicitly says it does not.
/ydieresis /Ydieresis /fraction /currency
- /guilsinglleft /guilsinglright /fi /fl
+ /guilsinglleft /guilsinglright /fi /fl
% \34x
/daggerdbl /periodcentered /quotesinglbase /quotedblbase
- /perthousand /Acircumflex /Ecircumflex /Aacute
+ /perthousand /Acircumflex /Ecircumflex /Aacute
/Edieresis /Egrave /Iacute /Icircumflex
- /Idieresis /Igrave /Oacute /Ocircumflex
+ /Idieresis /Igrave /Oacute /Ocircumflex
/.notdef /Ograve /Uacute /Ucircumflex
- /Ugrave /dotlessi /circumflex /tilde
+ /Ugrave /dotlessi /circumflex /tilde
/macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron
256 packedarray
5 1 index .registerencoding
diff --git a/gs/Resource/Init/gs_pdf_e.ps b/gs/Resource/Init/gs_pdf_e.ps
index 65ef4479a..270f60c79 100644
--- a/gs/Resource/Init/gs_pdf_e.ps
+++ b/gs/Resource/Init/gs_pdf_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1997, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -32,7 +32,7 @@ ISOLatin1Encoding 97 31 getinterval aload pop
% \20x
/bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction
/guilsinglleft /guilsinglright /minus /perthousand
- /quotedblbase /quotedblleft /quotedblright /quoteleft
+ /quotedblbase /quotedblleft /quotedblright /quoteleft
/quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE /Scaron
/Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron /.notdef
% \24x
diff --git a/gs/Resource/Init/gs_pdfwr.ps b/gs/Resource/Init/gs_pdfwr.ps
index b441f732d..140854ed3 100644
--- a/gs/Resource/Init/gs_pdfwr.ps
+++ b/gs/Resource/Init/gs_pdfwr.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -50,7 +50,7 @@
/AutoPositionEPSFiles //true
/Binding /Left
/CalCMYKProfile (None) % (U.S. Web Coated (SWOP) v2)
- /CalGrayProfile (None) % (Dot Gain 20%)
+ /CalGrayProfile (None) % (Dot Gain 20%)
/CalRGBProfile (None) % (sRGB IEC61966-2.1)
/ColorImageDepth -1
/ColorImageDict .defaultImageDict
@@ -257,12 +257,12 @@
/PreserveOPIComments //true
/PreserveOverprintSettings //true
/UCRandBGInfo /Preserve
- /PreserveHalftoneInfo //true
- /TransferFunctionInfo /Preserve
- /MaxViewerMemorySize 8000000
- /CompressPages //true
- /CompressFonts //true
- /ASCII85EncodePages //true
+ /PreserveHalftoneInfo //true
+ /TransferFunctionInfo /Preserve
+ /MaxViewerMemorySize 8000000
+ /CompressPages //true
+ /CompressFonts //true
+ /ASCII85EncodePages //true
.dicttomark readonly
.dicttomark readonly def
@@ -272,7 +272,7 @@
% Set optimizations for converting PostScript to PDF.
% The ps2pdf* scripts invoke this.
/.setpdfwrite { % - .setpdfwrite -
- % Set a large VM threshold to reduce garbage collection.
+ % Set a large VM threshold to reduce garbage collection.
currentuserparams /VMThreshold get 3000000 .max setvmthreshold
} bind def
@@ -280,13 +280,13 @@
/.write_small_positive_real % <file> <real> .write_small_positive_real -
{ % The argument must be grater than 0 and must be strongly samller than 0.1.
- % The conversion isn't simple due to the low (24 bits) precision
+ % The conversion isn't simple due to the low (24 bits) precision
% of the floating point arithmetics in Postscript.
- % For best result we first use the 1e8 factor since its binary
+ % For best result we first use the 1e8 factor since its binary
% representation 101111101011110000100000000 well rounds into 14 significant
% bits : 101111101011110000000000000 .
1 index (.) writestring
- { dup 100000000 mul
+ { dup 100000000 mul
dup 10 mul 1 ge {
% Will need not greater than 0.1 due to a rounding below.
pop exit
@@ -295,9 +295,9 @@
1 index (00000000) writestring
} loop
% Now it is not smaller than 1e-9, use simple digitizing.
- { dup 10 mul
- dup 10 mul 1 ge {
- pop exit
+ { dup 10 mul
+ dup 10 mul 1 ge {
+ pop exit
} if
exch pop
1 index (0) writestring
@@ -321,9 +321,9 @@
(0123456789) exch 1 getinterval % f N r' (d)
3 index exch writestring % f N r'
dup 3 2 roll exch mod % f r' N'
- dup 0 eq {
+ dup 0 eq {
% Don't write trailing zeros.
- exit
+ exit
} if
exch % f N' r'
} loop
@@ -335,10 +335,10 @@
/.pdf===dict mark
/arraytype
{ dup xcheck { ({) (}) } { ([) (]) } ifelse
- % Stack: file obj left right
+ % Stack: file obj left right
4 1 roll 2 index exch writestring () exch
{ exch 2 index exch writestring
- 1 index exch pdf===only ( )
+ 1 index exch pdf===only ( )
}
forall pop exch writestring
} bind
@@ -346,7 +346,7 @@
/dicttype
{ 1 index (<<\n) writestring
{ 2 index 3 -1 roll pdf===only 1 index ( ) writestring
- 1 index exch pdf===only dup (\n) writestring
+ 1 index exch pdf===only dup (\n) writestring
}
forall (>>) writestring
} bind
@@ -362,7 +362,7 @@
% Note that \004 may be self-delimiting in gs, but is not in standard PS.
dup .namestring (\000\004\011\012\014\015 %()/<>[]{}) .stringbreak //null ne {
dup .namestring (\000) .stringbreak //null ne {
- /rangecheck signalerror
+ /rangecheck signalerror
} if
1 index <0000> writestring 1 index exch write===only 0 write
} {
@@ -393,7 +393,7 @@ userdict /.pdfcvstring () put
/.pdfcvs { % <obj> .pdfcvs <string>
currentglobal exch //false .setglobal
/.pdfcvstring () store
- % We can't handle long values yet.
+ % We can't handle long values yet.
{ pop dup length 0 eq { pop } {
/.pdfcvstring .pdfcvstring 3 -1 roll concatstrings store
} ifelse //.pdfcvbuf
@@ -407,17 +407,17 @@ userdict /.pdfcvstring () put
% /key1 (value1) ... (CTM) /type
/.pdfputparams { % -mark- <key1> <value1> ... .pdfputparams <result...>
currentdevice //null //false counttomark 1 add 3 roll
- % Don't allow the page device to get cleared....
+ % Don't allow the page device to get cleared....
{.putdeviceparams} .currentpagedevice pop {.setpagedevice} 3 .execn
} bind def
% Convert relevant operands to strings in an array.
/.pdfcvsloop { % -mark- values ... markname start step .pdfcvsloop
- % [values ... ctm markname]
+ % [values ... ctm markname]
matrix currentmatrix .pdfcvs 4 1 roll
- counttomark 1 add 2 roll
+ counttomark 1 add 2 roll
counttomark .localvmarray astore exch pop
3 1 roll
- % Stack: values start step
+ % Stack: values start step
2 index length 3 sub { 2 copy 2 copy get .pdfcvs put pop } for
} bind def
/.pdfcvsall { % -mark- values ... markname .pdfcvsall <<same>>
@@ -437,27 +437,27 @@ userdict /.pdfcvstring () put
% pdfmark operand list (including the pdfmark name) on the stack;
% they may modify this ad lib. They must call .pdfcvsxxx.
/.pdfmarkparams mark
- % Unpack a dictionary for PUT, and don't convert stream data.
+ % Unpack a dictionary for PUT, and don't convert stream data.
/PUT {
counttomark 3 eq {
1 index type /dicttype eq {
- pop { } forall /.PUTDICT .pdfcvsall
+ pop { } forall /.PUTDICT .pdfcvsall
} {
- pop dup type /filetype eq {
- % Read the file into a sequence of strings.
- % This isn't great, but it's simple.
- {
- dup 64000 string readstring not { exch exit } if
- exch
- } loop closefile
- } if
- /.PUTSTREAM .pdfcvsfirst
+ pop dup type /filetype eq {
+ % Read the file into a sequence of strings.
+ % This isn't great, but it's simple.
+ {
+ dup 64000 string readstring not { exch exit } if
+ exch
+ } loop closefile
+ } if
+ /.PUTSTREAM .pdfcvsfirst
} ifelse
} {
.pdfcvsall
} ifelse
} bind
- % Unpack the array for PUTINTERVAL.
+ % Unpack the array for PUTINTERVAL.
/PUTINTERVAL {
pop aload pop /.PUTINTERVAL .pdfcvsall
} bind
@@ -469,12 +469,12 @@ userdict /.pdfcvstring () put
/pdfmark { % -mark- <key> <value> ... <markname> pdfmark -
dup /SP eq {
% A hack for synchronizing the clipping path.
- gsave
+ gsave
[1 0 0 1 0 0] setmatrix 0 setlinewidth
newpath -3 -3 moveto closepath stroke % Paints outside the device bbox.
grestore
} if
- dup /PS eq systemdict /PDFX .knownget not { //false } if
+ dup /PS eq systemdict /PDFX .knownget not { //false } if
systemdict /PDFA .knownget not { //false } if or and {
% Execute it since PDF/X doesn't allow to embed it.
pop
@@ -500,7 +500,6 @@ userdict /.pdfcvstring () put
userdict /pdfmark .undef
currentdict /.pdfmarkparams .undef
-
% <dict> .hook_DSC_Creator -
/.pdf_hook_DSC_Creator
{
@@ -526,7 +525,7 @@ currentdict /.pdfmarkparams .undef
} {
pop
} ifelse
-}
+}
bind def
% Use the DSC processing hook to pass DSC comments to the driver.
@@ -535,14 +534,14 @@ bind def
/.pdfdsc_dict 2 dict def
/.pdfdsc { % <file> <DSC string> <dsc dict> [<prev proc>] .pdfdsc -
0 get dup //null ne { 4 copy exch pop exec pop } { pop } ifelse 3 -1 roll pop
- % Stack: <dsc string> <dsc dict>
+ % Stack: <dsc string> <dsc dict>
20 .localvmdict 1 index { 3 copy put pop pop } forall
3 -1 roll .parse_dsc_comments % <dsc dict> <dict> <type>
1 index //.pdf_hook_DSC_Creator exec
dup /NOP ne 2 index length 1 gt or { % Skip unparsed comments
PDFWRDEBUG { (**** DSC comment: ) print dup //== exec 1 index === flush } if
exch mark 4 1 roll {
- % mark <key1> <value1> ... <dsc dict> <type> <key> <value>
+ % mark <key1> <value1> ... <dsc dict> <type> <key> <value>
3 index 2 index known { % Skip the DSC_struct entry
pop pop
} {
@@ -562,7 +561,7 @@ bind def
currentdict /.pdf_hook_DSC_Creator undef
/.initialize_dsc_parser where {
pop
- 3000 % priority
+ 3000 % priority
{
currentglobal //true setglobal
2 dict dup .initialize_dsc_parser readonly
@@ -579,7 +578,7 @@ currentdict /.pdf_hook_DSC_Creator undef
% Define setdistillerparams / currentdistillerparams.
% Distiller parameters are currently treated as device parameters.
/.distillerparamkeys mark
- % General parameters -- all distillers
+ % General parameters -- all distillers
/ASCII85EncodePages { }
/AutoRotatePages { }
/Binding { }
@@ -597,13 +596,13 @@ currentdict /.pdf_hook_DSC_Creator undef
/TransferFunctionInfo { }
/UCRandBGInfo { }
/UseFlateCompression { }
- % General parameters -- PDF writer
- % StartPage and EndPage are renamed because EndPage
- % clashes with a page device parameter.
+ % General parameters -- PDF writer
+ % StartPage and EndPage are renamed because EndPage
+ % clashes with a page device parameter.
/CoreDistVersion { }
/CompatibilityLevel { }
- % ****** NOTE: StartPage and EndPage are disabled because
- % ****** EndPage clashes with a page device parameter.
+ % ****** NOTE: StartPage and EndPage are disabled because
+ % ****** EndPage clashes with a page device parameter.
% /EndPage { exch pop /PDFEndPage exch }
/PDFEndPage { pop pop }
% /StartPage { exch pop /PDFStartPage exch }
@@ -618,11 +617,11 @@ currentdict /.pdf_hook_DSC_Creator undef
/PreserveCopyPage { }
/UsePrologue { }
/OffOptimizations { }
- % PDF/X parameters
+ % PDF/X parameters
/PDFXTrimBoxToMediaBoxOffset { }
/PDFXSetBleedBoxToMediaBox { }
/PDFXBleedBoxToTrimBoxOffset { }
- % Color sampled image parameters
+ % Color sampled image parameters
/ColorACSImageDict { }
/AntiAliasColorImages { }
/AutoFilterColorImages { }
@@ -634,7 +633,7 @@ currentdict /.pdf_hook_DSC_Creator undef
/EncodeColorImages { }
/ColorImageFilter { }
/ColorImageResolution { }
- % Color processing parameters
+ % Color processing parameters
/CalCMYKProfile { }
/CalGrayProfile { }
/CalRGBProfile { }
@@ -642,7 +641,7 @@ currentdict /.pdf_hook_DSC_Creator undef
/ColorConversionStrategy { }
/ConvertCMYKImagesToRGB { }
/ConvertImagesToIndexed { }
- % Grayscale sampled image parameters
+ % Grayscale sampled image parameters
/GrayACSImageDict { }
/AntiAliasGrayImages { }
/AutoFilterGrayImages { }
@@ -654,7 +653,7 @@ currentdict /.pdf_hook_DSC_Creator undef
/EncodeGrayImages { }
/GrayImageFilter { }
/GrayImageResolution { }
- % Monochrome sampled image parameters
+ % Monochrome sampled image parameters
/AntiAliasMonoImages { }
/MonoImageDepth { }
/MonoImageDict { }
@@ -664,9 +663,9 @@ currentdict /.pdf_hook_DSC_Creator undef
/EncodeMonoImages { }
/MonoImageFilter { }
/MonoImageResolution { }
- % Font embedding parameters
+ % Font embedding parameters
/AlwaysEmbed
- { dup length 0 gt
+ { dup length 0 gt
{ dup 0 get type /booleantype eq } { //false } ifelse
{ dup 0 get
{ dup length 1 sub 1 exch getinterval
@@ -678,7 +677,7 @@ currentdict /.pdf_hook_DSC_Creator undef
} ifelse
}
/NeverEmbed
- { dup length 0 gt
+ { dup length 0 gt
{ dup 0 get type /booleantype eq } { //false } ifelse
{ dup 0 get
{ dup length 1 sub 1 exch getinterval
@@ -696,7 +695,7 @@ currentdict /.pdf_hook_DSC_Creator undef
/DSCEncodingToUnicode { }
.dicttomark readonly def
/.distillerdevice
- {
+ {
% Check to see if the current device is a Distiller
% and return it if so.
currentdevice 1 dict dup /IsDistiller dup put .getdeviceparams
@@ -709,7 +708,7 @@ currentdict /.pdf_hook_DSC_Creator undef
% Some badly designed PostScript files only expect the current/set
% distillerparams operators to exist in a distiller. Since we have
% this as a runtime option, we enable these operators IFF the
-% currentdevice is pdfwrite. Also, we mask their existence in
+% currentdevice is pdfwrite. Also, we mask their existence in
% systemdict so that 'where' and 'known' don't show them unless
% the currentdevice is pdfwrite.
/.setdistillerparams { % <dict> setdistillerparams -
@@ -724,9 +723,9 @@ currentdict /.pdf_hook_DSC_Creator undef
} odef
/.currentdistillerparams { % - currentdistillerparams <dict>
.distillerdevice //.distillerparamkeys .getdeviceparams .dicttomark
- % Patch StartPage and EndPage
- % ****** NOTE: StartPage and EndPage are disabled because
- % ****** EndPage clashes with a page device parameter.
+ % Patch StartPage and EndPage
+ % ****** NOTE: StartPage and EndPage are disabled because
+ % ****** EndPage clashes with a page device parameter.
% begin /StartPage PDFStartPage /EndPage PDFEndPage
% currentdict dup /PDFStartPage undef /PDFEndPage undef
% def def currentdict end
@@ -752,7 +751,7 @@ currentdict /.pdf_hook_DSC_Creator undef
% Patch 'where' so that the distiller operators are only visible
% if the pdfwrite device is the current one.
-{
+{
% Check to see if the current device is a Distiller
currentdevice 1 dict dup /IsDistiller dup put .getdeviceparams
dup type /booleantype eq not {cleartomark //false}{3 1 roll cleartomark}ifelse
@@ -768,10 +767,10 @@ currentdict /.pdf_hook_DSC_Creator undef
% Patch 'known' to hide the systemdict version of distiller operators
% unless the currentdevice is pdfwrite.
/known {
- /currentdistillerparams 1 index eq /setdistillerparams 2 index eq or
+ /currentdistillerparams 1 index eq /setdistillerparams 2 index eq or
/pdfmark 2 index eq or {
systemdict 2 index eq { % only mask the operator in systemdict
- known
+ known
% Check to see if the current device is a Distiller
currentdevice 1 dict dup /IsDistiller dup put .getdeviceparams
dup type /booleantype eq not {cleartomark //false}{3 1 roll cleartomark}ifelse not
@@ -804,16 +803,16 @@ currentdict /.pdf_hook_DSC_Creator undef
} if
exch pop % [out] [in] i c
} { % [out] [in] i n
- (DSCEncoding defines a character that is not in AdobeGlyphList : )
+ (DSCEncoding defines a character that is not in AdobeGlyphList : )
exch .namestring concatstrings =
- /.make_DSC_translation_table cvx /undefined signalerror
+ /.make_DSC_translation_table cvx /undefined signalerror
} ifelse
} ifelse
3 index % [out] [in] i c [out]
3 1 roll put % [out] [in]
} for
pop % [out]
-} bind def
+} bind def
1000 % priority
{
@@ -822,7 +821,7 @@ currentdict /.pdf_hook_DSC_Creator undef
% Check to see if the current device wants ToUnicode info
currentdevice 1 dict dup /WantsToUnicode dup put .getdeviceparams
dup type /booleantype eq not {cleartomark //false}{3 1 roll cleartomark}ifelse
- systemdict /ProvideUnicode .knownget not { //false } if or
+ systemdict /ProvideUnicode .knownget not { //false } if or
{
currentglobal true setglobal
systemdict /.setupUnicodeDecoder known {
@@ -843,9 +842,9 @@ currentdict /.pdf_hook_DSC_Creator undef
1010 % priority
{
% Set a predefined configuration in the distiller device (pdfwrite)
- /PDFSETTINGS where {
- pop /PDFSETTINGS load
- } {
+ /PDFSETTINGS where {
+ pop /PDFSETTINGS load
+ } {
currentdevice .devicename /ps2write eq { /PSL2Printer } { /default } ifelse
} ifelse
.distillersettings exch get
@@ -860,12 +859,12 @@ currentdict /.pdf_hook_DSC_Creator undef
systemdict /PDFX known systemdict /PDFA known or {
/DSCEncoding where {
/DSCEncoding get .make_DSC_translation_table
- /DSCEncodingToUnicode exch def
+ /DSCEncodingToUnicode exch def
} if
} if
} if
currentdict end .setdistillerparams
- .distillerdevice //null //false mark .putdeviceparams
+ .distillerdevice //null //false mark .putdeviceparams
dup type /booleantype eq not { cleartomark pop } if pop pop
} bind .schedule_init
diff --git a/gs/Resource/Init/gs_res.ps b/gs/Resource/Init/gs_res.ps
index e779c0484..cb381e2b7 100644
--- a/gs/Resource/Init/gs_res.ps
+++ b/gs/Resource/Init/gs_res.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -102,7 +102,7 @@ setglobal
% so that the command in case of error will be correct rather than an
% internal invocation of findresource.
/.findcategory { % <name> .findcategory -
- % (pushes the category on the dstack)
+ % (pushes the category on the dstack)
/Category .findresource begin % note: *not* findresource
} bind def
@@ -123,13 +123,13 @@ setglobal
} bind def
/.resourceexec { % <key> /xxxResource .resourceexec -
- % (also pops the category from the dstack)
+ % (also pops the category from the dstack)
load exec end
} bind def
% .getvminstance treats instances on disk as undefined.
/.getvminstance { % <key> .getvminstance <instance> -true-
- % <key> .getvminstance -false-
+ % <key> .getvminstance -false-
.GetInstance {
dup 1 get 2 ne { //true } { pop //false } ifelse
} {
@@ -139,46 +139,46 @@ setglobal
20 dict begin
- % Standard entries
+ % Standard entries
/Category /Category def
/InstanceType /dicttype def
/DefineResource {
- .CheckResource {
- dup /Category 3 index cvlit .growput
- dup [ exch 0 -1 ] exch
- .Instances 4 2 roll put
- % Make the Category dictionary read-only. We will have to
- % use .forceput / .forcedef later to replace the dummy,
- % empty .Instances dictionary with the real one later.
- readonly
- } {
- /defineresource cvx /typecheck signaloperror
- } ifelse
+ .CheckResource {
+ dup /Category 3 index cvlit .growput
+ dup [ exch 0 -1 ] exch
+ .Instances 4 2 roll put
+ % Make the Category dictionary read-only. We will have to
+ % use .forceput / .forcedef later to replace the dummy,
+ % empty .Instances dictionary with the real one later.
+ readonly
+ } {
+ /defineresource cvx /typecheck signaloperror
+ } ifelse
} bind def
/FindResource % (redefined below)
- { .Instances exch get 0 get
- } bind def
+ { .Instances exch get 0 get
+ } bind def
- % Additional entries
+ % Additional entries
/.Instances 30 dict def
.Instances /Category [currentdict 0 -1] put
/.LocalInstances 0 dict def
/.GetInstance
- { .Instances exch .knownget
- } bind def
+ { .Instances exch .knownget
+ } bind def
/.CheckResource
- { dup gcheck currentglobal and
- { /DefineResource /FindResource /ResourceForAll /ResourceStatus
- /UndefineResource }
- { 2 index exch known and }
- forall
- not { /defineresource cvx /invalidaccess signaloperror } if
- //true
- } bind def
+ { dup gcheck currentglobal and
+ { /DefineResource /FindResource /ResourceForAll /ResourceStatus
+ /UndefineResource }
+ { 2 index exch known and }
+ forall
+ not { /defineresource cvx /invalidaccess signaloperror } if
+ //true
+ } bind def
.Instances end begin % for the base case of findresource
@@ -196,9 +196,9 @@ setglobal
% We define its contents as a separate procedure so that .findcategory
% can use it without entering another level of pseudo-operator.
/.findresource { % <key> <category> findresource <instance>
- 2 copy dup /Category eq
- { pop //Category 0 get begin } { .findcategory } ifelse
- /FindResource .resourceexec exch pop exch pop
+ 2 copy dup /Category eq
+ { pop //Category 0 get begin } { .findcategory } ifelse
+ /FindResource .resourceexec exch pop exch pop
} bind
end % .Instances of Category
def
@@ -217,15 +217,15 @@ def
2 .argindex 2 index 2 index % catch stackunderflow
% See above re .errorexec.
/defineresource cvx {
- .findcategory
- currentdict /InstanceType known {
- dup type InstanceType ne {
- dup type /packedarraytype eq InstanceType /arraytype eq and
- not { /defineresource cvx /typecheck signaloperror } if
- } if
- } if
- /DefineResource .resourceexec
- 4 1 roll pop pop pop
+ .findcategory
+ currentdict /InstanceType known {
+ dup type InstanceType ne {
+ dup type /packedarraytype eq InstanceType /arraytype eq and
+ not { /defineresource cvx /typecheck signaloperror } if
+ } if
+ } if
+ /DefineResource .resourceexec
+ 4 1 roll pop pop pop
} .errorexec
} bind odef
% We must prevent resourceforall from automatically restoring the stacks,
@@ -236,17 +236,17 @@ def
% calls, so stack protection doesn't apply to the very last token of an
% operator procedure.
/resourceforall1 { % <template> <proc> <scratch> <category> resourceforall1 -
- dup .findcategory
- /ResourceForAll load
- % Stack: <template> <proc> <scratch> <category> proc
- exch pop % pop the category
- exec end
+ dup .findcategory
+ /ResourceForAll load
+ % Stack: <template> <proc> <scratch> <category> proc
+ exch pop % pop the category
+ exec end
} bind def
/resourceforall { % <template> <proc> <scratch> <category> resourceforall1 -
- //resourceforall1 exec % see above
+ //resourceforall1 exec % see above
} bind odef
/resourcestatus { % <key> <category> resourcestatus <status> <size> true
- % <key> <category> resourcestatus false
+ % <key> <category> resourcestatus false
{
0 .argindex type /nametype ne {
% CET 23-26 wants typecheck here, not undefineresource that happens
@@ -323,7 +323,7 @@ pssystemparams begin
readonly .forcedef % pssys'params is r-o
pop % .default_resource_dir
/GenericResourcePathSep
- .file_name_separator readonly .forcedef % pssys'params is r-o
+ .file_name_separator readonly .forcedef % pssys'params is r-o
(%diskFontResourceDir) cvn (/Resource/Font/) readonly .forcedef % pssys'params is r-o
(%diskGenericResourceDir) cvn (/Resource/) readonly .forcedef % pssys'params is r-o
end
@@ -332,7 +332,7 @@ end
% Check if GenericResourceDir presents in LIBPATH.
% The value of GenericResourceDir must end with directory separator.
-% We use .file_name_combine to check it.
+% We use .file_name_combine to check it.
% Comments use OpenVMS syntax, because it is the most complicated case.
(x) pssystemparams /GenericResourcePathSep get
(y) concatstrings concatstrings dup length % (x]y) l1
@@ -351,7 +351,7 @@ ne {
pop pop
pssystemparams dup /GenericResourceDir get exch /GenericResourcePathSep get
-(Init) exch (gs_init.ps) concatstrings concatstrings concatstrings
+(Init) exch (gs_init.ps) concatstrings concatstrings concatstrings
status {
pop pop pop pop
} {
@@ -369,7 +369,7 @@ status {
/Generic mark
- % Standard entries
+ % Standard entries
% We're still running in Level 1 mode, so dictionaries won't expand.
% Leave room for the /Category entry.
@@ -381,8 +381,8 @@ status {
1 index type dup /stringtype eq exch /nametype eq or {
exch 1 index 2 get cvs exch
} if
- % Use .setstackprotect to prevent the stacks from being restored if
- % an error occurs during execution of proc.
+ % Use .setstackprotect to prevent the stacks from being restored if
+ % an error occurs during execution of proc.
1 get //false .setstackprotect exec //true .setstackprotect
} bind def
/.localresourceforall { % <key> <value> <args> .localr'forall -
@@ -404,7 +404,7 @@ status {
/.externalresourceforall { % <filename> <len> <args> .externalr'forall -
3 1 roll 1 index length 1 index sub getinterval exch
dup 3 get begin .Instances .LocalInstances end
- % Stack: key args insts localinsts
+ % Stack: key args insts localinsts
3 index known {
pop pop pop
} {
@@ -413,150 +413,150 @@ status {
} bind def
/DefineResource {
- .CheckResource
- { dup [ exch 0 -1 ]
- % Stack: key value instance
- currentglobal
- { //false setglobal 2 index UndefineResource % remove local def if any
- //true setglobal
- .Instances dup //.emptydict eq {
- pop 3 dict
- % As noted above, Category dictionaries are read-only,
- % so we have to use .forcedef here.
- /.Instances 1 index .forcedef % Category dict is read-only
- } if
- }
- { .LocalInstances dup //.emptydict eq
- { pop 3 dict localinstancedict Category 2 index put
- }
- if
- }
- ifelse
- % Stack: key value instance instancedict
- 3 index 2 index .growput
- % Now make the resource value read-only.
- 0 2 copy get { readonly } .internalstopped pop
- dup 4 1 roll put exch pop exch pop
- }
- { /defineresource cvx /typecheck signaloperror
- }
- ifelse
+ .CheckResource
+ { dup [ exch 0 -1 ]
+ % Stack: key value instance
+ currentglobal
+ { //false setglobal 2 index UndefineResource % remove local def if any
+ //true setglobal
+ .Instances dup //.emptydict eq {
+ pop 3 dict
+ % As noted above, Category dictionaries are read-only,
+ % so we have to use .forcedef here.
+ /.Instances 1 index .forcedef % Category dict is read-only
+ } if
+ }
+ { .LocalInstances dup //.emptydict eq
+ { pop 3 dict localinstancedict Category 2 index put
+ }
+ if
+ }
+ ifelse
+ % Stack: key value instance instancedict
+ 3 index 2 index .growput
+ % Now make the resource value read-only.
+ 0 2 copy get { readonly } .internalstopped pop
+ dup 4 1 roll put exch pop exch pop
+ }
+ { /defineresource cvx /typecheck signaloperror
+ }
+ ifelse
} .bind executeonly % executeonly to prevent access to .forcedef
/UndefineResource
- { { dup 2 index .knownget
- { dup 1 get 1 ge
- { dup 0 //null put 1 2 put pop pop }
- { pop exch .undef }
- ifelse
- }
- { pop pop
- }
- ifelse
- }
- currentglobal
- { 2 copy .Instances exch exec
- }
- if .LocalInstances exch exec
- } bind
+ { { dup 2 index .knownget
+ { dup 1 get 1 ge
+ { dup 0 //null put 1 2 put pop pop }
+ { pop exch .undef }
+ ifelse
+ }
+ { pop pop
+ }
+ ifelse
+ }
+ currentglobal
+ { 2 copy .Instances exch exec
+ }
+ if .LocalInstances exch exec
+ } bind
% Because of some badly designed code in Adobe's CID font downloader that
% makes findresource and resourcestatus deliberately inconsistent with each
% other, the default FindResource must not call ResourceStatus if there is
% an instance of the desired name already defined in VM.
/FindResource {
- dup //null eq {
+ dup //null eq {
% CET 13-06 wants /typecheck for "null findencoding" but
% .knownget doesn't fail on null
/findresource cvx /typecheck signaloperror
} if
- dup .getvminstance {
- exch pop 0 get
- } {
- dup ResourceStatus {
- pop 1 gt {
- .DoLoadResource .getvminstance not {
- /findresource cvx .undefinedresource
- } if 0 get
- } {
- .GetInstance pop 0 get
- } ifelse
- } {
- /findresource cvx .undefinedresource
- } ifelse
- } ifelse
+ dup .getvminstance {
+ exch pop 0 get
+ } {
+ dup ResourceStatus {
+ pop 1 gt {
+ .DoLoadResource .getvminstance not {
+ /findresource cvx .undefinedresource
+ } if 0 get
+ } {
+ .GetInstance pop 0 get
+ } ifelse
+ } {
+ /findresource cvx .undefinedresource
+ } ifelse
+ } ifelse
} bind
% Because of some badly designed code in Adobe's CID font downloader, the
% definition of ResourceStatus for Generic and Font must be the same (!).
% We patch around this by using an intermediate .ResourceFileStatus procedure.
/ResourceStatus {
- dup .GetInstance {
- exch pop dup 1 get exch 2 get //true
- } {
- .ResourceFileStatus
- } ifelse
+ dup .GetInstance {
+ exch pop dup 1 get exch 2 get //true
+ } {
+ .ResourceFileStatus
+ } ifelse
} bind
/.ResourceFileStatus {
- .ResourceFile { closefile 2 -1 //true } { pop //false } ifelse
+ .ResourceFile { closefile 2 -1 //true } { pop //false } ifelse
} bind
/ResourceForAll {
- % Construct a new procedure to hold the arguments.
- % All objects constructed here must be in local VM to avoid
- % a possible invalidaccess.
- currentdict 4 .localvmpackedarray % [template proc scratch resdict]
- % We must pop the resource dictionary off the dict stack
- % when doing the actual iteration, and restore it afterwards.
- .currentglobal not {
- .LocalInstances length 0 ne {
- % We must do local instances, and do them first.
- //.localresourceforall {exec} 0 get 3 .localvmpackedarray cvx
- .LocalInstances exch {forall} 0 get 1 index 0 get
- currentdict end 3 .execn begin
- } if
- } if
- % Do global instances next.
- //.globalresourceforall {exec} 0 get 3 .localvmpackedarray cvx
- .Instances exch cvx {forall} 0 get 1 index 0 get
- currentdict end 3 .execn begin
+ % Construct a new procedure to hold the arguments.
+ % All objects constructed here must be in local VM to avoid
+ % a possible invalidaccess.
+ currentdict 4 .localvmpackedarray % [template proc scratch resdict]
+ % We must pop the resource dictionary off the dict stack
+ % when doing the actual iteration, and restore it afterwards.
+ .currentglobal not {
+ .LocalInstances length 0 ne {
+ % We must do local instances, and do them first.
+ //.localresourceforall {exec} 0 get 3 .localvmpackedarray cvx
+ .LocalInstances exch {forall} 0 get 1 index 0 get
+ currentdict end 3 .execn begin
+ } if
+ } if
+ % Do global instances next.
+ //.globalresourceforall {exec} 0 get 3 .localvmpackedarray cvx
+ .Instances exch cvx {forall} 0 get 1 index 0 get
+ currentdict end 3 .execn begin
mark % args [
Category .namestring .file_name_separator concatstrings
2 index 0 get % args [ (c/) (t)
dup length 3 1 roll % args [ l (c/) (t)
concatstrings % args [ l (c/t)
- [
- //true /LIBPATH .systemvar 3 index
- .generate_dir_list_templates_with_length % args (t) [ l [(pt) Lp ...]
- % also add on the Resources as specified by the GenericResourceDir
+ [
+ //true /LIBPATH .systemvar 3 index
+ .generate_dir_list_templates_with_length % args (t) [ l [(pt) Lp ...]
+ % also add on the Resources as specified by the GenericResourceDir
//true [ currentsystemparams /GenericResourceDir get]
- counttomark 1 add index .generate_dir_list_templates_with_length
+ counttomark 1 add index .generate_dir_list_templates_with_length
% Resource files on OpenVMS require a separate template (gs:[dir.*]*)
//true [ currentsystemparams /GenericResourceDir get]
- counttomark 1 add index .file_name_separator (*)
+ counttomark 1 add index .file_name_separator (*)
concatstrings concatstrings .generate_dir_list_templates_with_length
- ] exch pop
- dup length 1 sub 0 exch 2 exch { % args [ l [] i
- 2 copy get % args [ l [] i (pt)
- exch 2 index exch 1 add get % args [ l [] (pt) Lp
- exch % args [ l [] Lp (pt)
-
- { % args [ l [] Lp (pf)
- dup length % args [ l [] Lp (pf) Lpf
- 2 index sub % args [ l [] Lp (pf) Lf
- 2 index exch % args [ l [] Lp (pf) Lp Lf
- getinterval cvn dup % args [ l [] Lp /n /n
- 5 2 roll % args [ /n /n l [] Lp
- } //.rfnstring filenameforall
- pop % args [ /n1 /n1 ... /nN /nN l []
- } for % args [ /n1 /n1 ... /nN /nN l []
- pop pop
- .dicttomark % An easy way to exclude duplicates. % args <</n/n>>
- % {
- { pop } 0 get
+ ] exch pop
+ dup length 1 sub 0 exch 2 exch { % args [ l [] i
+ 2 copy get % args [ l [] i (pt)
+ exch 2 index exch 1 add get % args [ l [] (pt) Lp
+ exch % args [ l [] Lp (pt)
+
+ { % args [ l [] Lp (pf)
+ dup length % args [ l [] Lp (pf) Lpf
+ 2 index sub % args [ l [] Lp (pf) Lf
+ 2 index exch % args [ l [] Lp (pf) Lp Lf
+ getinterval cvn dup % args [ l [] Lp /n /n
+ 5 2 roll % args [ /n /n l [] Lp
+ } //.rfnstring filenameforall
+ pop % args [ /n1 /n1 ... /nN /nN l []
+ } for % args [ /n1 /n1 ... /nN /nN l []
+ pop pop
+ .dicttomark % An easy way to exclude duplicates. % args <</n/n>>
+ % {
+ { pop } 0 get
2 index 2 get { cvs 0 } aload pop 5 index
//.externalresourceforall {exec} 0 get
% }
7 .localvmpackedarray cvx
3 2 roll pop % args
- { forall } 0 get
- currentdict end 2 .execn begin
+ { forall } 0 get
+ currentdict end 2 .execn begin
} bind
/ResourceFileName { % /in (scr) --> (p/c/n)
@@ -582,7 +582,7 @@ status {
exch copy % (p/c/n)
} bind
- % Additional entries
+ % Additional entries
% Unfortunately, we can't create the real .Instances dictionary now,
% because if someone copies the Generic category (which pp. 95-96 of the
@@ -593,59 +593,59 @@ status {
/.Instances //.emptydict
/.LocalInstances
- { localinstancedict Category .knownget not { //.emptydict } if
- } bind
+ { localinstancedict Category .knownget not { //.emptydict } if
+ } bind
/.GetInstance
- { currentglobal
- { .Instances exch .knownget }
- { .LocalInstances 1 index .knownget
- { exch pop //true }
- { .Instances exch .knownget }
- ifelse
- }
- ifelse
- } bind
+ { currentglobal
+ { .Instances exch .knownget }
+ { .LocalInstances 1 index .knownget
+ { exch pop //true }
+ { .Instances exch .knownget }
+ ifelse
+ }
+ ifelse
+ } bind
/.CheckResource
- { //true
- } bind
+ { //true
+ } bind
/.vmused {
- % - .vmused <usedvalue>
- % usedvalue = vmstatus in global + vmstatus in local.
+ % - .vmused <usedvalue>
+ % usedvalue = vmstatus in global + vmstatus in local.
0 2 {
.currentglobal not .setglobal
vmstatus pop exch pop add
} repeat
} bind def
/.DoLoadResource {
- % .LoadResource may push entries on the operand stack.
- % It is an undocumented feature of Adobe implementations,
- % which we must match for the sake of some badly written
- % font downloading code, that such entries are popped
- % automatically.
- count 1 index cvlit .vmused
- % Stack: key count litkey memused
- {.LoadResource} 4 1 roll 4 .execn
- % Stack: ... count key memused
- .vmused exch sub
- 1 index .getvminstance not {
- pop dup .undefinedresource % didn't load
- } if
- dup 1 1 put
- 2 3 -1 roll put
- % Stack: ... count key
- exch count 1 sub exch sub {exch pop} repeat
+ % .LoadResource may push entries on the operand stack.
+ % It is an undocumented feature of Adobe implementations,
+ % which we must match for the sake of some badly written
+ % font downloading code, that such entries are popped
+ % automatically.
+ count 1 index cvlit .vmused
+ % Stack: key count litkey memused
+ {.LoadResource} 4 1 roll 4 .execn
+ % Stack: ... count key memused
+ .vmused exch sub
+ 1 index .getvminstance not {
+ pop dup .undefinedresource % didn't load
+ } if
+ dup 1 1 put
+ 2 3 -1 roll put
+ % Stack: ... count key
+ exch count 1 sub exch sub {exch pop} repeat
} bind
/.LoadResource
- { dup .ResourceFile
- { exch pop currentglobal
- { .runresource }
- { //true setglobal { .runresource } stopped //false setglobal { stop } if }
- ifelse
- }
- { dup .undefinedresource
- }
- ifelse
- } bind
+ { dup .ResourceFile
+ { exch pop currentglobal
+ { .runresource }
+ { //true setglobal { .runresource } stopped //false setglobal { stop } if }
+ ifelse
+ }
+ { dup .undefinedresource
+ }
+ ifelse
+ } bind
/.ResourceFile
{
Category //.rfnstring cvs length % key l
@@ -661,22 +661,20 @@ status {
} {
pop
currentdict /ResourceFileName known {
- mark 1 index //.rfnstring { ResourceFileName } .internalstopped {
- cleartomark //false
- } {
- (r) { file } .internalstopped {
- cleartomark //false
- } {
- exch pop exch pop //true
- } ifelse
- } ifelse
- } {
- pop //false
- } ifelse
+ mark 1 index //.rfnstring { ResourceFileName } .internalstopped {
+ cleartomark //false
+ } {
+ (r) { file } .internalstopped {
+ cleartomark //false
+ } {
+ exch pop exch pop //true
+ } ifelse
+ } ifelse
+ } {
+ pop //false
+ } ifelse
} ifelse
- } bind
-
-
+ } bind
.dicttomark
/Category defineresource pop
@@ -695,7 +693,7 @@ pop readonly pop end
% Define the fixed categories.
mark
- % Non-Type categories with existing entries.
+ % Non-Type categories with existing entries.
/ColorSpaceFamily
{ } % These must be deferred, because optional features may add some.
/Emulator
@@ -703,7 +701,7 @@ mark
/Filter
{ } % These must be deferred, because optional features may add some.
/IODevice
- % Loop until the .getiodevice gets a rangecheck.
+ % Loop until the .getiodevice gets a rangecheck.
errordict /rangecheck 2 copy get
errordict /rangecheck { pop stop } put % pop the command
mark 0 { {
@@ -712,7 +710,7 @@ mark
pop pop pop .packtomark
4 1 roll put
.clearerror
- % Type categories listed in the Red Book.
+ % Type categories listed in the Red Book.
/ColorRenderingType
{ } % These must be deferred, because optional features may add some.
/FMapType
@@ -727,50 +725,50 @@ mark
{ } % Deferred, optional features may add some.
/PatternType
{ } % Deferred, optional features may add some.
- % Type categories added since the Red Book.
+ % Type categories added since the Red Book.
/setsmoothness where {
pop /ShadingType { } % Deferred, optional features may add some.
} if
counttomark 2 idiv
{ mark
- % Standard entries
+ % Standard entries
- % We'd like to prohibit defineresource,
- % but because optional features may add entries, we can't.
- % We can at least require that the key and value match.
+ % We'd like to prohibit defineresource,
+ % but because optional features may add entries, we can't.
+ % We can at least require that the key and value match.
/DefineResource
- { currentglobal not
- { /defineresource cvx /invalidaccess signaloperror }
- { 2 copy ne
- { /defineresource cvx /rangecheck signaloperror }
- { dup .Instances 4 -2 roll .growput }
- ifelse
- }
- ifelse
- } bind
+ { currentglobal not
+ { /defineresource cvx /invalidaccess signaloperror }
+ { 2 copy ne
+ { /defineresource cvx /rangecheck signaloperror }
+ { dup .Instances 4 -2 roll .growput }
+ ifelse
+ }
+ ifelse
+ } bind
/UndefineResource
- { /undefineresource cvx /invalidaccess signaloperror } bind
+ { /undefineresource cvx /invalidaccess signaloperror } bind
/FindResource
- { .Instances 1 index .knownget
- { exch pop }
- { /findresource cvx .undefinedresource }
- ifelse
- } bind
+ { .Instances 1 index .knownget
+ { exch pop }
+ { /findresource cvx .undefinedresource }
+ ifelse
+ } bind
/ResourceStatus
- { .Instances exch known { 0 0 //true } { //false } ifelse } bind
+ { .Instances exch known { 0 0 //true } { //false } ifelse } bind
/ResourceForAll
- /Generic .findcategory /ResourceForAll load end
+ /Generic .findcategory /ResourceForAll load end
- % Additional entries
+ % Additional entries
counttomark 2 add -1 roll
dup length dict dup begin exch { dup def } forall end
- % We'd like to make the .Instances readonly here,
- % but because optional features may add entries, we can't.
+ % We'd like to make the .Instances readonly here,
+ % but because optional features may add entries, we can't.
/.Instances exch
/.LocalInstances % used by ResourceForAll
- 0 dict def
+ 0 dict def
.dicttomark /Category defineresource pop
} repeat pop
@@ -846,19 +844,19 @@ userdict /.localcsdefaults //false put
/UndefineResource {
dup /Generic /Category findresource /UndefineResource get exec
//.defaultcsnames 1 index .knownget {
- % Stack: resname index
+ % Stack: resname index
currentglobal {
.undefinedefaultcs pop
} {
- % We removed the local definition, but there might be a global one.
+ % We removed the local definition, but there might be a global one.
exch .GetInstance {
- 0 get .definedefaultcs
+ 0 get .definedefaultcs
} {
- .undefinedefaultcs
+ .undefinedefaultcs
} ifelse
- % Recompute .localcsdefaults by scanning. This is rarely needed.
+ % Recompute .localcsdefaults by scanning. This is rarely needed.
.userdict /.localcsdefaults //false //.defaultcsnames {
- pop .LocalInstances exch known { pop //true exit } if
+ pop .LocalInstances exch known { pop //true exit } if
} forall put
} ifelse
} {
@@ -911,34 +909,34 @@ userdict /.localcsdefaults //false put
/.fontstatus { % <fontname> .fontstatus <fontname> <found>
{ % Create a loop context just so we can exit it early.
- % Check Fontmap.
+ % Check Fontmap.
Fontmap 1 index .knownget {
{
- dup type /nametype eq {
- .fontstatus { pop //null exit } if
- } {
- dup type /stringtype eq {
- findlibfile { closefile pop //null exit } if pop
- } {
- % Procedure, assume success.
- pop //null exit
- } ifelse
- } ifelse
+ dup type /nametype eq {
+ .fontstatus { pop //null exit } if
+ } {
+ dup type /stringtype eq {
+ findlibfile { closefile pop //null exit } if pop
+ } {
+ % Procedure, assume success.
+ pop //null exit
+ } ifelse
+ } ifelse
} forall dup //null eq { pop //true exit } if
} if
dup / eq { //false exit } if % / throws an error from findlibfile
- % Convert names to strings; give up on other types.
+ % Convert names to strings; give up on other types.
dup type /nametype eq { .namestring } if
dup type /stringtype ne { //false exit } if
- % Check the resource directory.
+ % Check the resource directory.
dup .fonttempstring /FontResourceDir getsystemparam .genericrfn
status {
pop pop pop pop //true exit
} if
- % Check for a file on the search path with the same name
- % as the font.
+ % Check for a file on the search path with the same name
+ % as the font.
findlibfile { closefile //true exit } if
- % Scan a FONTPATH directory and try again.
+ % Scan a FONTPATH directory and try again.
.scannextfontdir not { //false exit } if
} loop
} bind def
@@ -948,47 +946,47 @@ userdict /.localcsdefaults //false put
/InstanceType /dicttype
/DefineResource
- { 2 copy //definefont exch pop
- /Generic /Category findresource /DefineResource get exec
- } bind
+ { 2 copy //definefont exch pop
+ /Generic /Category findresource /DefineResource get exec
+ } bind
/UndefineResource
- { dup //undefinefont
- /Generic /Category findresource /UndefineResource get exec
- } bind
+ { dup //undefinefont
+ /Generic /Category findresource /UndefineResource get exec
+ } bind
/FindResource {
- dup .getvminstance {
- exch pop 0 get
- } {
- dup ResourceStatus {
- pop 1 gt { .loadfontresource } { .GetInstance pop 0 get } ifelse
- } {
- .loadfontresource
- } ifelse
- } ifelse
+ dup .getvminstance {
+ exch pop 0 get
+ } {
+ dup ResourceStatus {
+ pop 1 gt { .loadfontresource } { .GetInstance pop 0 get } ifelse
+ } {
+ .loadfontresource
+ } ifelse
+ } ifelse
} bind
/ResourceForAll {
- { .scannextfontdir not { exit } if } loop
- /Generic /Category findresource /ResourceForAll get exec
+ { .scannextfontdir not { exit } if } loop
+ /Generic /Category findresource /ResourceForAll get exec
} bind
/.ResourceFileStatus {
- .fontstatus { pop 2 -1 //true } { pop //false } ifelse
+ .fontstatus { pop 2 -1 //true } { pop //false } ifelse
} bind
/.loadfontresource {
- dup .vmused exch
- % Hack: rebind .currentresourcefile so that all calls of
- % definefont will know these are built-in fonts.
- currentfile {pop //findfont exec} .execasresource % (findfont is a procedure)
- exch .vmused exch sub
- % stack: name font vmused
- % findfont has the prerogative of not calling definefont
- % in certain obscure cases of font substitution.
- 2 index .getvminstance {
- dup 1 1 put
- 2 3 -1 roll put
- } {
- pop
- } ifelse exch pop
+ dup .vmused exch
+ % Hack: rebind .currentresourcefile so that all calls of
+ % definefont will know these are built-in fonts.
+ currentfile {pop //findfont exec} .execasresource % (findfont is a procedure)
+ exch .vmused exch sub
+ % stack: name font vmused
+ % findfont has the prerogative of not calling definefont
+ % in certain obscure cases of font substitution.
+ 2 index .getvminstance {
+ dup 1 1 put
+ 2 3 -1 roll put
+ } {
+ pop
+ } ifelse exch pop
} bind
/.Instances FontDirectory length 2 mul dict
@@ -1002,7 +1000,7 @@ userdict /.localcsdefaults //false put
{ pop
}
{ 2 index
- % Make sure we create the array in global VM.
+ % Make sure we create the array in global VM.
.currentglobal //true .setglobal
[//null 2 -1] exch .setglobal
.growput
@@ -1046,7 +1044,7 @@ end % level2dict
% Convert deferred resources after we finally switch to Level 2.
/.fixresources {
- % Encoding resources
+ % Encoding resources
EncodingDirectory
{ dup length 256 eq
{ /Encoding defineresource pop }
@@ -1060,13 +1058,13 @@ end % level2dict
} bind def
/findencoding /.findencoding load def % must be a procedure
/.defineencoding { /Encoding defineresource pop } bind def
- % ColorRendering resources and ProcSet
+ % ColorRendering resources and ProcSet
systemdict /ColorRendering .knownget {
/ColorRendering exch /ProcSet defineresource pop
systemdict /ColorRendering undef
/DefaultColorRendering currentcolorrendering /ColorRendering defineresource pop
} if
- % ColorSpace resources
+ % ColorSpace resources
systemdict /CIEsRGB .knownget {
/sRGB exch /ColorSpace defineresource pop
systemdict /CIEsRGB undef
@@ -1079,27 +1077,27 @@ end % level2dict
/sGrayICC exch /ColorSpace defineresource pop
systemdict /CIEsGRAYICC undef
} if
- % ColorSpaceFamily resources
+ % ColorSpaceFamily resources
colorspacedict { pop dup /ColorSpaceFamily defineresource pop } forall
- % Filter resources
+ % Filter resources
filterdict { pop dup /Filter defineresource pop } forall
- % FontType and FMapType resources
+ % FontType and FMapType resources
buildfontdict { pop dup /FontType defineresource pop } forall
mark
buildfontdict 0 known { 2 3 4 5 6 7 8 } if
buildfontdict 9 known { 9 } if
counttomark { dup /FMapType defineresource pop } repeat pop
- % FormType resources
+ % FormType resources
.formtypes { pop dup /FormType defineresource pop } forall
- % HalftoneType resources
+ % HalftoneType resources
.halftonetypes { pop dup /HalftoneType defineresource pop } forall
- % ColorRenderingType resources
+ % ColorRenderingType resources
.colorrenderingtypes {pop dup /ColorRenderingType defineresource pop} forall
- % ImageType resources
+ % ImageType resources
.imagetypes { pop dup /ImageType defineresource pop } forall
- % PatternType resources
+ % PatternType resources
.patterntypes { pop dup /PatternType defineresource pop } forall
- % Make the fixed resource categories immutable.
+ % Make the fixed resource categories immutable.
/.shadingtypes where {
pop .shadingtypes { pop dup /ShadingType defineresource pop } forall
} if
@@ -1112,7 +1110,7 @@ end % level2dict
.LocalInstances readonly pop
readonly pop
} forall
- % clean up
+ % clean up
systemdict /.fixresources undef
} bind def
diff --git a/gs/Resource/Init/gs_resmp.ps b/gs/Resource/Init/gs_resmp.ps
index e4088f955..7580b21f1 100644
--- a/gs/Resource/Init/gs_resmp.ps
+++ b/gs/Resource/Init/gs_resmp.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -17,9 +17,9 @@
% A procset to redefine a resource category with a resource map.
% Public entries :
-
+
% Redefine - a procedure for redefining a resource category with a map.
-% Methods for interpreting the resource map to be provided by client
+% Methods for interpreting the resource map to be provided by client
% in the argument dictionary.
%
% Note that the procedure Redefine is idempotential :
@@ -32,7 +32,7 @@
% redefining any category. It provides a proper order of instances
% and proper stacks during resourceforall.
-% BindWithCurrentdict - a procedure for generating temporary procedures
+% BindWithCurrentdict - a procedure for generating temporary procedures
% from templates, binding them with a local dictionary.
% execstack_lookup - a procedure for communicating through the execution stack.
@@ -49,7 +49,7 @@ currentglobal //true setglobal
currentpacking //false setpacking
/InstanceEnumeratorPattern % - InstanceEnumeratorPattern ...
-{
+{
% This is a pattern for enumeration procedure to be built dynamically,
% applying BindWithCurrentdict with a temporary dictionary.
% The following names will be replaced with specific objects
@@ -65,10 +65,10 @@ currentpacking //false setpacking
% to provide the <proc> to write to the underlying dictionary,
% and put it back after the enumeration is completed.
end
- {
+ {
0 1 2 {
en_local_dict exch /status exch put
- InstancesStatus {
+ InstancesStatus {
en_local_dict /status get eq {
scr cvs % ... (Font)
proc exec %
@@ -90,7 +90,7 @@ currentpacking //false setpacking
setpacking
/BindWithCurrentdict % <proc> BindWithCurrentdict <proc>
-{
+{
% Make a copy of the given procedure, binding in the values of all names
% defined in currentdict.
% Caution1 : this code cannot handle procedures that were already
@@ -99,7 +99,7 @@ setpacking
% intentionally for a termination of the procedure tree.
dup length array copy
- dup length 1 sub -1 0 {
+ dup length 1 sub -1 0 {
2 copy get % {precopy} i {elem}
dup dup type /arraytype eq exch xcheck and {
% {precopy} i {elem}
@@ -108,9 +108,9 @@ setpacking
} {
dup dup type /nametype eq exch xcheck and {
% {precopy} i {elem}
- currentdict exch .knownget {
+ currentdict exch .knownget {
2 index 3 1 roll put % {precopy}
- } {
+ } {
pop
} ifelse
} {
@@ -217,7 +217,7 @@ currentpacking //false setpacking
% Procedures in this dictionary really are patterns for new category methods.
% The following names will be replaced with specific objects during BindWithCurrentdict :
% .map - the map dictionary;
- % DefineResource, ResourceStatus, ResourceFileName, FindResource, ResourceForAll
+ % DefineResource, ResourceStatus, ResourceFileName, FindResource, ResourceForAll
% - procedures from the original resource category.
/FindResource % <Name> FindResource <dict>
@@ -251,10 +251,10 @@ currentpacking //false setpacking
pop
} ifelse % Instance
} { % /Name /Name <<record>>
- pop pop FindResource exec
+ pop pop FindResource exec
} ifelse
} { % /Name /Name
- pop FindResource exec
+ pop FindResource exec
} ifelse
} ifelse
RESMPDEBUG { (resmp FindResource end) = } if
@@ -299,7 +299,7 @@ currentpacking //false setpacking
{ RESMPDEBUG { (resmp ResourceFileName beg ) print 1 index = } if
exch % (scratch) /Name
.map 1 index .knownget { % (scratch) /Name <<record>>
- RESMPDEBUG { (resmp ResourceFileName : have a map record.) = } if
+ RESMPDEBUG { (resmp ResourceFileName : have a map record.) = } if
dup dup /RecordVirtualMethods get /IsActive get exec {
RESMPDEBUG { (resmp ResourceFileName : record is active.) = } if
dup /RecordVirtualMethods get /GetFilePath get exec % (string)
@@ -309,7 +309,7 @@ currentpacking //false setpacking
pop exch ResourceFileName exec
RESMPDEBUG { (resmp ResourceFileName : retrieving ) print dup = } if
} ifelse
- } {
+ } {
RESMPDEBUG { (resmp ResourceFileName : have NO map record.) = } if
exch ResourceFileName exec
RESMPDEBUG { (resmp ResourceFileName : retrieving ) print dup = } if
@@ -434,7 +434,7 @@ setpacking
OldCategory /NewCategory exch def
} {
% Redefine with a new category instance.
- OldCategory dup length dict
+ OldCategory dup length dict
dup /.PreprocessRecord 4 dict put
copy /NewCategory exch def
} ifelse
@@ -443,7 +443,7 @@ setpacking
% to allow different record types to be mixed in a single map file.
% We do this with building a dictionary of PreprocessRecord procedures,
% which come from different calls to Redefine :
- NewCategory /.PreprocessRecord get dup length % <<pr>> l
+ NewCategory /.PreprocessRecord get dup length % <<pr>> l
currentdict /PreprocessRecord get .growput
currentdict /MapFileName known {
@@ -462,7 +462,7 @@ setpacking
pop 0 dict % <<map>>
} ifelse
} {
- currentdict /.map .knownget not {
+ currentdict /.map .knownget not {
0 dict % <<map>>
} if
} ifelse
@@ -470,7 +470,7 @@ setpacking
% Preprocess entries :
dup NewCategory /.PreprocessRecord get % <<map>> <<map>> <<pr>>
3 1 roll { % <<pr>> <<map>> /Name raw_record
- //false 3 1 roll % <<pr>> <<map>> false /Name raw_record
+ //false 3 1 roll % <<pr>> <<map>> false /Name raw_record
4 index { % <<pr>> <<map>> false /Name raw_record i {pr}
exch pop % <<pr>> <<map>> false /Name raw_record {pr}
exec { % <<pr>> <<map>> false /Name record
@@ -490,7 +490,6 @@ setpacking
} forall % <<pr>> <<map>>
exch pop % <<map>>
-
% Add the map :
OldCategory /.IsRedefinedWithMap known { % <<map>>
% Just add to the old map :
@@ -502,15 +501,15 @@ setpacking
} ifelse
OldCategory /.IsRedefinedWithMap known not {
% Copy old methods to OptionsDict :
- [ /DefineResource /ResourceStatus /ResourceFileName
+ [ /DefineResource /ResourceStatus /ResourceFileName
/FindResource /ResourceForAll
] {
dup OldCategory exch get def
} forall
-
+
% Build new methods :
//MethodsToRedefine {
- //BindWithCurrentdict exec NewCategory 3 1 roll put
+ //BindWithCurrentdict exec NewCategory 3 1 roll put
} forall
CategoryName /CIDFont ne {
NewCategory /GetCIDSystemInfoFromMap undef
diff --git a/gs/Resource/Init/gs_setpd.ps b/gs/Resource/Init/gs_setpd.ps
index 05b68fce3..cdb5e6506 100644
--- a/gs/Resource/Init/gs_setpd.ps
+++ b/gs/Resource/Init/gs_setpd.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -31,9 +31,9 @@ level2dict begin
.currentshowpagecount {
.currentpagedevice pop
dup //null ne { /BeginPage .knownget } { pop //false } ifelse {
- % Stack: ... pagecount proc
+ % Stack: ... pagecount proc
count 2 .execn
- % Stack: ... ..???.. oldcount
+ % Stack: ... ..???.. oldcount
count 1 add exch sub { pop } repeat
} {
pop
@@ -46,9 +46,9 @@ level2dict begin
.currentshowpagecount {
1 index .currentpagedevice pop
dup //null ne { /EndPage .knownget } { pop //false } ifelse {
- % Stack: ... reason pagecount reason proc
+ % Stack: ... reason pagecount reason proc
count 2 .execn
- % Stack: ... ..???.. print oldcount
+ % Stack: ... ..???.. print oldcount
count 2 add exch sub { exch pop } repeat
} {
pop pop 2 ne
@@ -94,8 +94,8 @@ level2dict begin
/.installpagedevice
{ % Since setpagedevice doesn't create new device objects,
- % we must (carefully) reinstall the old parameters in
- % the same device.
+ % we must (carefully) reinstall the old parameters in
+ % the same device.
.currentpagedevice pop //null currentdevice //null .trysetparams
dup type /booleantype eq
{ pop pop }
@@ -105,8 +105,8 @@ level2dict begin
/.installpagedevice cvx /rangecheck signalerror
}
ifelse pop pop
- % A careful reading of the Red Book reveals that an erasepage
- % should occur, but *not* an initgraphics.
+ % A careful reading of the Red Book reveals that an erasepage
+ % should occur, but *not* an initgraphics.
erasepage .beginpage
} bind def
@@ -175,7 +175,7 @@ level2dict begin
/PolicyNotFound 1
/PolicyReport {
dup /.LockSafetyParams known {
- % Only possible error is invalidaccess
+ % Only possible error is invalidaccess
/setpagedevice .systemvar /invalidaccess signalerror
}
if
@@ -186,7 +186,7 @@ level2dict begin
/.requiredattrs mark
/PageDeviceName //null
/PageOffset [0 0] readonly
-% We populate InputAttributes with all of the known page sizes
+% We populate InputAttributes with all of the known page sizes
% followed by a dummy media type that handles pages of any size.
% This will create some duplicates, but that only slightly slows
% down the media selection (loop is in zmedia2.c).
@@ -214,9 +214,9 @@ level2dict begin
% the 'match any' PageSize entry
systemdict /NORANGEPAGESIZE known not {
% Add one last entry which is the 4 element range array (non-standard)
- counttomark 2 idiv
- % PageSize with either dimension 0 will be detected in
- % match_page_size, so we can allow it here
+ counttomark 2 idiv
+ % PageSize with either dimension 0 will be detected in
+ % match_page_size, so we can allow it here
mark /PageSize [0 dup 16#7ffff dup] .dicttomark
} if
.dicttomark
@@ -248,30 +248,30 @@ level2dict begin
.dicttomark readonly def
/.makecurrentpagedevice { % - .makecurrentpagedevice <dict>
currentdevice //null .getdeviceparams
- % Make the dictionary large enough to add defaulted entries.
+ % Make the dictionary large enough to add defaulted entries.
counttomark 2 idiv .requiredattrs length add dict
counttomark 2 idiv { dup 4 2 roll put } repeat exch pop
- % Add any missing required attributes.
- % Make a writable and (if possible) local copy of any default
- % dictionaries, to work around a bug in the output of WordPerfect,
- % which assumes that these dictionaries are writable and local.
+ % Add any missing required attributes.
+ % Make a writable and (if possible) local copy of any default
+ % dictionaries, to work around a bug in the output of WordPerfect,
+ % which assumes that these dictionaries are writable and local.
.currentglobal exch dup gcheck .setglobal
.requiredattrs {
2 index 2 index known {
1 index /Policies eq {
- % Merge policies from the device driver with defaults
- 2 index % <<>> /key value <<>>
- 3 2 roll get % <<>> value <<policies>>
- exch {
- 2 index 2 index known {
- pop pop
- } {
- 2 index 3 1 roll put
- } ifelse
- } forall
- pop
+ % Merge policies from the device driver with defaults
+ 2 index % <<>> /key value <<>>
+ 3 2 roll get % <<>> value <<policies>>
+ exch {
+ 2 index 2 index known {
+ pop pop
+ } {
+ 2 index 3 1 roll put
+ } ifelse
+ } forall
+ pop
} {
- pop pop
+ pop pop
} ifelse
} {
exec 2 index 3 1 roll put
@@ -284,66 +284,66 @@ level2dict begin
dup length 0 eq {
pop .makecurrentpagedevice
} {
- % If any of the dynamic keys have changed,
- % we must update the page device dictionary.
+ % If any of the dynamic keys have changed,
+ % we must update the page device dictionary.
currentdevice //.dynamicppkeys .getdeviceparams .dicttomark {
- % Stack: current key value
- 2 index 2 index .knownget { 1 index ne } { //true } ifelse
- { 2 index wcheck not
- { % This is the first entry being updated.
- % Copy the dictionary to make it writable.
- 3 -1 roll
- currentglobal 1 index dup gcheck currentglobal and setglobal
- length dict
- exch setglobal
- .copydict
- 3 1 roll
- }
- if
- 2 index 3 1 roll put
- }
- { pop pop
- }
- ifelse
+ % Stack: current key value
+ 2 index 2 index .knownget { 1 index ne } { //true } ifelse
+ { 2 index wcheck not
+ { % This is the first entry being updated.
+ % Copy the dictionary to make it writable.
+ 3 -1 roll
+ currentglobal 1 index dup gcheck currentglobal and setglobal
+ length dict
+ exch setglobal
+ .copydict
+ 3 1 roll
+ }
+ if
+ 2 index 3 1 roll put
+ }
+ { pop pop
+ }
+ ifelse
} forall
% If the device is the distiller device, update distillerparams that
% may have been changed by setdistillerparams
% Check to see if the current device supports Tr
currentdevice 1 dict dup /IsDistiller dup put .getdeviceparams
dup type /booleantype eq not {cleartomark false}{3 1 roll cleartomark}ifelse
-% currentdevice .devicename /pdfwrite eq
+% currentdevice .devicename /pdfwrite eq
{
- currentdistillerparams {
- % Stack: current key value
- 2 index 2 index .knownget { 1 index ne } { //true } ifelse
- { 2 index 3 1 roll put } { pop pop } ifelse
- } forall
+ currentdistillerparams {
+ % Stack: current key value
+ 2 index 2 index .knownget { 1 index ne } { //true } ifelse
+ { 2 index 3 1 roll put } { pop pop } ifelse
+ } forall
} if
- % If the dictionary was global and is now local, copy
- % any global subsidiary dictionaries to local VM. This
- % too is to work around the Word Perfect bug (see above).
+ % If the dictionary was global and is now local, copy
+ % any global subsidiary dictionaries to local VM. This
+ % too is to work around the Word Perfect bug (see above).
dup gcheck not {
- dup {
- dup type /dicttype eq { dup gcheck } { //false } ifelse {
- % Copy-on-write, see above.
- 2 index wcheck not {
- 3 -1 roll dup length dict .copydict
- 3 1 roll
- } if
- .copytree 2 index 3 1 roll put
- } {
- pop pop
- } ifelse
- } forall
+ dup {
+ dup type /dicttype eq { dup gcheck } { //false } ifelse {
+ % Copy-on-write, see above.
+ 2 index wcheck not {
+ 3 -1 roll dup length dict .copydict
+ 3 1 roll
+ } if
+ .copytree 2 index 3 1 roll put
+ } {
+ pop pop
+ } ifelse
+ } forall
} if
- % We would like to do a .setpagedevice so we don't keep
- % re-creating the dictionary. Unfortunately, the effect
- % of this is that if any dynamic key changes (PageCount
- % in particular), we will do the equivalent of a
- % setpagedevice at the next restore or grestore.
- % Therefore, we make the dictionary read-only, but
- % we don't store it away. I.e., NOT:
- % dup wcheck { .setpagedevice .currentpagedevice pop } if
+ % We would like to do a .setpagedevice so we don't keep
+ % re-creating the dictionary. Unfortunately, the effect
+ % of this is that if any dynamic key changes (PageCount
+ % in particular), we will do the equivalent of a
+ % setpagedevice at the next restore or grestore.
+ % Therefore, we make the dictionary read-only, but
+ % we don't store it away. I.e., NOT:
+ % dup wcheck { .setpagedevice .currentpagedevice pop } if
readonly
} ifelse
} if
@@ -370,13 +370,13 @@ level2dict begin
{ pop //null
}
{ 3 copy pop .knownget
- { dup //null eq
- { pop dup length dict }
- { dup length 2 index length add dict .copydict }
- ifelse
- }
- { dup length dict
- }
+ { dup //null eq
+ { pop dup length dict }
+ { dup length 2 index length add dict .copydict }
+ ifelse
+ }
+ { dup length dict
+ }
ifelse .copydict readonly
}
ifelse
@@ -413,7 +413,7 @@ NOMEDIAATTRS {
% Define the keys used in input attribute matching.
/.inputattrkeys [
/PageSize /MediaColor /MediaWeight /MediaType /InsertSheet /ManualFeed
- % The following are documented in Adobe's supplement for v2017.
+ % The following are documented in Adobe's supplement for v2017.
/LeadingEdge /MediaClass
] readonly def
% Define other keys used in media selection.
@@ -446,8 +446,8 @@ NOMEDIAATTRS {
.dynamicppkeys
{ pop dup /LeadingEdge ne { //false } { pop } ifelse }
forall
- % We must ignore an explicit request for .MediaSize,
- % because media matching always handles this.
+ % We must ignore an explicit request for .MediaSize,
+ % because media matching always handles this.
/.MediaSize //false
/Name //false
/OutputDevice //false
@@ -471,21 +471,21 @@ NOMEDIAATTRS {
/BeginPage //false
/EndPage //false
/Policies //false
- % Our extensions:
+ % Our extensions:
/HWColorMap
{ % HACK: don't transmit the color map, because
- % window systems can change the color map on their own
- % incrementally. Someday we'll have a better
- % solution for this....
+ % window systems can change the color map on their own
+ % incrementally. Someday we'll have a better
+ % solution for this....
//false
}
/ViewerPreProcess //false
/ImagingBBox //false % This prevents the ImagingBBox value in the setpagedevice
- % from affecting the device's ImagingBBox parameter, but
- % does retain a 'shadow' copy at the PostScript level.
- % This is done for Adobe compatibility since Adobe does
- % render marks outside the ImagingBBox (and QuarkXpress
- % relies on it).
+ % from affecting the device's ImagingBBox parameter, but
+ % does retain a 'shadow' copy at the PostScript level.
+ % This is done for Adobe compatibility since Adobe does
+ % render marks outside the ImagingBBox (and QuarkXpress
+ % relies on it).
.dicttomark readonly def
% Define access to device defaults.
@@ -498,28 +498,28 @@ NOMEDIAATTRS {
% <pagedict> <attrdict> <policydict> <keys> .matchmedia false
% <pagedict> null <policydict> <keys> .matchmedia null true
/.selectmedia % <orig> <request> <merged> <failed> <-- retained
- % <attrdict> <policydict> <attrkeys> <mediakey>
- % .selectmedia
+ % <attrdict> <policydict> <attrkeys> <mediakey>
+ % .selectmedia
{ 5 index 5 -2 roll 4 index .matchmedia
- % Stack: orig request merged failed attrkeys mediakey
- % (key true | false)
+ % Stack: orig request merged failed attrkeys mediakey
+ % (key true | false)
{ 4 index 3 1 roll put pop
}
{ % Adobe's implementations have a "big hairy heuristic"
- % to choose the set of keys to report as having failed the match.
- % For the moment, we report any keys that are in the request
- % and don't have the same value as in the original dictionary.
+ % to choose the set of keys to report as having failed the match.
+ % For the moment, we report any keys that are in the request
+ % and don't have the same value as in the original dictionary.
5 index 1 index .knownget
{ 4 index 3 1 roll put }
{ 3 index exch .undef }
ifelse
{ % Stack: <orig> <request> <merged> <failed> <attrkey>
- 3 index 1 index .knownget
- { 5 index 2 index .knownget { ne } { pop //true } ifelse }
- { //false }
- ifelse % Stack: ... <failed> <attrkey> <report>
- { 2 copy /rangecheck put }
- if pop
+ 3 index 1 index .knownget
+ { 5 index 2 index .knownget { ne } { pop //true } ifelse }
+ { //false }
+ ifelse % Stack: ... <failed> <attrkey> <report>
+ { 2 copy /rangecheck put }
+ if pop
}
forall
}
@@ -548,37 +548,37 @@ NOMEDIAATTRS {
% NOMEDIAATTRS means that the default policy is 7...
pop 2 index exch 7 put
} {
- pop dup 4 index exch get 2 array astore
- $error /errorinfo 3 -1 roll put
- cleartomark
- /setpagedevice .systemvar /configurationerror signalerror
+ pop dup 4 index exch get 2 array astore
+ $error /errorinfo 3 -1 roll put
+ cleartomark
+ /setpagedevice .systemvar /configurationerror signalerror
} ifelse
} bind
1 { % Roll back the failed request to its previous status.
SETPDDEBUG { (Rolling back.) = pstack flush } if
- 3 index 2 index 3 -1 roll .forceput
- 4 index 1 index .knownget
- { 4 index 3 1 roll .forceput }
- { 3 index exch .undef }
- ifelse
+ 3 index 2 index 3 -1 roll .forceput
+ 4 index 1 index .knownget
+ { 4 index 3 1 roll .forceput }
+ { 3 index exch .undef }
+ ifelse
} .bind
7 { % For PageSize only, just impose the request.
- 1 index /PageSize eq
- { pop pop 1 index /PageSize 7 put }
- { .policyprocs 0 get exec }
- ifelse
+ 1 index /PageSize eq
+ { pop pop 1 index /PageSize 7 put }
+ { .policyprocs 0 get exec }
+ ifelse
} bind
.dicttomark readonly def
/.applypolicies % <orig> <merged> <failed> .applypolicies
- % <orig> <merged'> <failed'>
+ % <orig> <merged'> <failed'>
{ 1 index /Policies get 1 index
{ type /integertype eq
{ pop % already processed
}
{ 2 copy .knownget not { 1 index /PolicyNotFound get } if
- % Stack: <orig> <merged> <failed> <Policies> <key>
- % <policy>
- .policyprocs 1 index .knownget not { .policyprocs 0 get } if exec
+ % Stack: <orig> <merged> <failed> <Policies> <key>
+ % <policy>
+ .policyprocs 1 index .knownget not { .policyprocs 0 get } if exec
}
ifelse
}
@@ -601,10 +601,10 @@ SETPDDEBUG { (Rolling back.) = pstack flush } if
% Put device parameters without resetting currentpagedevice.
% (.putdeviceparams clears the current page device.)
/.putdeviceparamsonly % <device> <Policies|null> <require_all> -mark-
- % <key1> <value1> ... .putdeviceparamsonly
- % On success: <device> <eraseflag>
- % On failure: <device> <Policies|null> <req_all> -mark-
- % <key1> <error1> ...
+ % <key1> <value1> ... .putdeviceparamsonly
+ % On success: <device> <eraseflag>
+ % On failure: <device> <Policies|null> <req_all> -mark-
+ % <key1> <error1> ...
{ .currentpagedevice
{ counttomark 4 add 1 roll .putdeviceparams
dup type /booleantype eq { 3 } { counttomark 5 add } ifelse -1 roll
@@ -617,11 +617,11 @@ SETPDDEBUG { (Rolling back.) = pstack flush } if
% Try setting the device parameters from the merged request.
/.trysetparams % <merged> <(ignored)> <device> <Policies>
- % .trysetparams
+ % .trysetparams
{ //true 4 index .prepareparams
- % Add the computed .MediaSize.
- % Stack: merged (ignored) device Policies -true-
- % -mark- key1 value1 ...
+ % Add the computed .MediaSize.
+ % Stack: merged (ignored) device Policies -true-
+ % -mark- key1 value1 ...
counttomark 5 add index .computemediasize
exch pop exch pop /.MediaSize exch
SETPDDEBUG { (Putting.) = pstack flush } if
@@ -632,19 +632,19 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
% Compute the media size and initial matrix from a merged request (after
% media selection).
/.computemediasize % <request> .computemediasize
- % <request> <matrix> <[width height]>
+ % <request> <matrix> <[width height]>
{ dup /PageSize get % requested page size
1 index /InputAttributes get
2 index (%MediaSource) get get /PageSize get % media size
- % (may be a range)
+ % (may be a range)
2 index /Policies get
dup /PageSize .knownget
{ exch pop } { /PolicyNotFound get } ifelse % PageSize policy,
- % affects scaling
+ % affects scaling
3 index /Orientation .knownget not { //null } if
4 index /RollFedMedia .knownget not { //false } if
matrix .matchpagesize not {
- % This is a "can't happen" condition!
+ % This is a "can't happen" condition!
/setpagedevice .systemvar /rangecheck signalerror
} if
2 array astore
@@ -654,31 +654,31 @@ SETPDDEBUG { (Result of putting.) = pstack flush } if
/setpagedevice
{ % We mustn't pop the argument until the very end,
- % so that the pseudo-operator machinery can restore the stack
- % if an error occurs.
+ % so that the pseudo-operator machinery can restore the stack
+ % if an error occurs.
mark 1 index currentpagedevice
- % Check whether we are changing OutputDevice;
- % also handle the case where the current device
- % is not a page device.
- % Stack: mark <request> <current>
+ % Check whether we are changing OutputDevice;
+ % also handle the case where the current device
+ % is not a page device.
+ % Stack: mark <request> <current>
SETPDDEBUG { (Checking.) = pstack flush } if
dup /OutputDevice .knownget
{ % Current device is a page device.
2 index /OutputDevice .knownget
{ % A specific OutputDevice was requested.
- 2 copy eq
- { pop pop //null }
- { exch pop }
- ifelse
+ 2 copy eq
+ { pop pop //null }
+ { exch pop }
+ ifelse
}
{ pop //null
}
ifelse
}
{ % Current device is not a page device.
- % Use the default device.
+ % Use the default device.
1 index /OutputDevice .knownget not { .defaultdevicename } if
}
ifelse
@@ -686,24 +686,24 @@ SETPDDEBUG { (Checking.) = pstack flush } if
{ pop
}
{ exch pop .defaultdeviceparams
- % In case of duplicate keys, .dicttomark takes the entry
- % lower on the stack, so we can just append the defaults here.
+ % In case of duplicate keys, .dicttomark takes the entry
+ % lower on the stack, so we can just append the defaults here.
.requiredattrs { exec } forall .dicttomark
}
ifelse
- % Check whether a viewer wants to intervene.
- % We must check both the request (which takes precedence)
- % and the current dictionary.
- % Stack: mark <request> <orig>
+ % Check whether a viewer wants to intervene.
+ % We must check both the request (which takes precedence)
+ % and the current dictionary.
+ % Stack: mark <request> <orig>
exch dup /ViewerPreProcess .knownget
{ exec }
{ 1 index /ViewerPreProcess .knownget { exec } if }
ifelse exch
- % Construct a merged request from the actual request plus
- % any keys that should always be propagated.
- % Stack: mark <request> <orig>
+ % Construct a merged request from the actual request plus
+ % any keys that should always be propagated.
+ % Stack: mark <request> <orig>
SETPDDEBUG { (Merging.) = pstack flush } if
exch 1 index length 1 index length add dict
@@ -712,34 +712,34 @@ SETPDDEBUG { (Merging.) = pstack flush } if
3 index 1 index .knownget { 3 copy put pop } if pop
}
forall
- % Stack: <orig> <request> <merged>
+ % Stack: <orig> <request> <merged>
dup 2 index
{ % stack: <orig> <request> <merged> <merged> <rkey> <rvalue>
.mergespecial 2 index .knownget { exec } if
put dup
}
forall pop
- % Hack: if FIXEDRESOLUTION is true, discard any attempt to
- % change HWResolution.
+ % Hack: if FIXEDRESOLUTION is true, discard any attempt to
+ % change HWResolution.
FIXEDRESOLUTION { dup /HWResolution .undef } if
- % Hack: if FIXEDMEDIA is true, discard any attempt to change
- % PageSize or HWSize.
+ % Hack: if FIXEDMEDIA is true, discard any attempt to change
+ % PageSize or HWSize.
FIXEDMEDIA
{ dup /PageSize 4 index /PageSize get put
dup /HWSize 4 index /HWSize get put
} if
- % Hack: to work around some files that take a PageSize
- % from InputAttributes and impose it, discard any attempt
- % to set PageSize to a 4-element value.
- % Stack: mark <orig> <request> <merged>
+ % Hack: to work around some files that take a PageSize
+ % from InputAttributes and impose it, discard any attempt
+ % to set PageSize to a 4-element value.
+ % Stack: mark <orig> <request> <merged>
dup /PageSize .knownget {
length 2 ne {
- dup /PageSize 4 index /PageSize get put
+ dup /PageSize 4 index /PageSize get put
} if
} if
- % Select input and output media.
- % Stack: mark <orig> <request> <merged>
+ % Select input and output media.
+ % Stack: mark <orig> <request> <merged>
SETPDDEBUG { (Selecting.) = pstack flush } if
0 dict % <failed>
@@ -755,30 +755,30 @@ SETPDDEBUG { (Selecting.) = pstack flush } if
.applypolicies
3 -1 roll 4 1 roll % swap back
- % Construct the new device, and attempt to set its attributes.
- % Stack: mark <orig> <request> <merged> <failed>
+ % Construct the new device, and attempt to set its attributes.
+ % Stack: mark <orig> <request> <merged> <failed>
SETPDDEBUG { (Constructing.) = pstack flush } if
currentdevice .devicename 2 index /OutputDevice get eq
{ currentdevice }
{ 1 index /OutputDevice get finddevice }
ifelse
- %**************** We should copy the device here,
- %**************** but since we can't close the old device,
- %**************** we don't. This is WRONG.
- %****************copydevice
+ %**************** We should copy the device here,
+ %**************** but since we can't close the old device,
+ %**************** we don't. This is WRONG.
+ %****************copydevice
2 index /Policies get
.trysetparams
dup type /booleantype ne
{ % The request failed.
- % Stack: ... <orig> <request> <merged> <failed> <device>
- % <Policies> true mark <name> <errorname> ...
+ % Stack: ... <orig> <request> <merged> <failed> <device>
+ % <Policies> true mark <name> <errorname> ...
SETPDDEBUG { (Recovering.) = pstack flush } if
counttomark 4 add index
counttomark 2 idiv { dup 4 -2 roll put } repeat
pop pop pop
- % Stack: mark ... <orig> <request> <merged> <failed> <device>
- % <Policies>
+ % Stack: mark ... <orig> <request> <merged> <failed> <device>
+ % <Policies>
6 2 roll 3 -1 roll 4 1 roll
.applypolicies
3 -1 roll 4 1 roll 6 -2 roll
@@ -791,8 +791,8 @@ SETPDDEBUG { (Recovering.) = pstack flush } if
}
if
- % The attempt succeeded. Install the new device.
- % Stack: mark ... <merged> <failed> <device> <eraseflag>
+ % The attempt succeeded. Install the new device.
+ % Stack: mark ... <merged> <failed> <device> <eraseflag>
SETPDDEBUG { (Installing.) = pstack flush } if
pop 2 .endpage
@@ -800,23 +800,23 @@ SETPDDEBUG { (Installing.) = pstack flush } if
(>>setpagedevice, press <return> to continue<<\n) .confirm
}
if
- % .setdevice clears the current page device!
+ % .setdevice clears the current page device!
.currentpagedevice pop exch
.setdevice pop
.setpagedevice
- % Implement UseCIEColor directly if this is a LL3 system.
- % The color substitution feature is now implemented in
- % the interpreter, and this is used as an optimization.
- %
- % NB: This shoud be the only use of the .setuseciecolor
- % operator anywhere.
- %
- % Set some color space other than /DeviceGray, to insure
- % that initgraphics will actually perform a setcolorspace
- % operation (there is an optimization in setcolorspace
- % that does nothing if the operand and current color
- % spaces are the same)
+ % Implement UseCIEColor directly if this is a LL3 system.
+ % The color substitution feature is now implemented in
+ % the interpreter, and this is used as an optimization.
+ %
+ % NB: This shoud be the only use of the .setuseciecolor
+ % operator anywhere.
+ %
+ % Set some color space other than /DeviceGray, to insure
+ % that initgraphics will actually perform a setcolorspace
+ % operation (there is an optimization in setcolorspace
+ % that does nothing if the operand and current color
+ % spaces are the same)
/.setuseciecolor where
{
@@ -828,24 +828,24 @@ SETPDDEBUG { (Installing.) = pstack flush } if
}
if
- % Merge the request into the current page device,
- % unless we're changing the OutputDevice.
- % Stack: mark ... <merged> <failed>
+ % Merge the request into the current page device,
+ % unless we're changing the OutputDevice.
+ % Stack: mark ... <merged> <failed>
exch currentpagedevice dup length 2 index length add dict
- % Stack: mark ... <failed> <merged> <current> <newdict>
+ % Stack: mark ... <failed> <merged> <current> <newdict>
2 index /OutputDevice .knownget {
2 index /OutputDevice .knownget not { //null } if eq
} {
//true
} ifelse {
- % Same OutputDevice, merge the dictionaries.
+ % Same OutputDevice, merge the dictionaries.
.copydict
} {
- % Different OutputDevice, discard the old dictionary.
+ % Different OutputDevice, discard the old dictionary.
exch pop
} ifelse .copydict
- % Initialize the default matrix, taking media matching
- % into account.
+ % Initialize the default matrix, taking media matching
+ % into account.
.computemediasize pop initmatrix concat
dup /PageOffset .knownget
{ % Translate by the given number of 1/72" units in device X/Y.
@@ -855,8 +855,8 @@ SETPDDEBUG { (Installing.) = pstack flush } if
idtransform translate
}
if
- % We must install the new page device dictionary
- % before calling the Install procedure.
+ % We must install the new page device dictionary
+ % before calling the Install procedure.
dup .setpagedevice
currentdevice 1 dict dup /HighLevelDevice dup put .getdeviceparams
dup type /booleantype eq not {cleartomark //true}{3 1 roll cleartomark not}ifelse
@@ -890,26 +890,26 @@ SETPDDEBUG { (Installing.) = pstack flush } if
/.execinstall { % <proc> .execinstall -
dup % element left on the stack if the exec fails.
- % Because the interpreter optimizes tail calls, we can't just let
- % the body of this procedure be 'exec', because that would lose
- % the stack protection that is the whole reason for having the
- % procedure in the first place. The 'pop' for the dummy element
- % on the op stack suffices.
+ % Because the interpreter optimizes tail calls, we can't just let
+ % the body of this procedure be 'exec', because that would lose
+ % the stack protection that is the whole reason for having the
+ % procedure in the first place. The 'pop' for the dummy element
+ % on the op stack suffices.
exec
pop % See above.
} odef
/.postinstall { % mark ... <failed> <merged> .postinstall -
matrix currentmatrix .setdefaultmatrix
- % Erase and initialize the page.
+ % Erase and initialize the page.
initgraphics
currentoverprint //false setoverprint 1 setcolor
.fillpage
0 setcolor setoverprint
.beginpage
- % Clean up, calling PolicyReport if needed.
- % Stack: mark ... <failed> <merged>
+ % Clean up, calling PolicyReport if needed.
+ % Stack: mark ... <failed> <merged>
SETPDDEBUG { (Finishing.) = pstack flush } if
exch dup length 0 ne
diff --git a/gs/Resource/Init/gs_statd.ps b/gs/Resource/Init/gs_statd.ps
index d341fc889..4f5ae09f0 100644
--- a/gs/Resource/Init/gs_statd.ps
+++ b/gs/Resource/Init/gs_statd.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -19,12 +19,12 @@
% that 'know' they are running on a LaserWriter.
systemdict begin
- % We make statusdict a little larger for Level 2 stuff.
- % Note that it must be allocated in local VM.
+ % We make statusdict a little larger for Level 2 stuff.
+ % Note that it must be allocated in local VM.
.currentglobal //false .setglobal
/statusdict 91 dict .forcedef % statusdict is local, sys'dict global
- % To support the Level 2 job control features,
- % serverdict must also be in local VM.
+ % To support the Level 2 job control features,
+ % serverdict must also be in local VM.
/serverdict 10 dict .forcedef % serverdict is local, sys'dict global
.setglobal
end
@@ -42,9 +42,9 @@ statusdict begin
/.setpagesize { /statusdict .systemvar begin .setpagesize end } bind def
- % Page sizes defined by Adobe documentation
- % Note: these executable arrays should all begin with two
- % integers which are the width and height (see gs_setpd.ps).
+ % Page sizes defined by Adobe documentation
+ % Note: these executable arrays should all begin with two
+ % integers which are the width and height (see gs_setpd.ps).
/11x17 {792 1224 //.setpagesize exec} bind def % 11x17 portrait
/a3 {842 1191 //.setpagesize exec} bind def
/a4 {595 842 //.setpagesize exec} bind def
@@ -59,10 +59,10 @@ statusdict begin
% note should be letter (or some other size) with the ImagingBBox
% shrunk by 25 units on all 4 sides.
/note /letter load def
- % End of Adobe-defined page sizes
+ % End of Adobe-defined page sizes
STRICT { (%END SIZES) .skipeof } if
- % Other page sizes
- % ISO standard paper sizes
+ % Other page sizes
+ % ISO standard paper sizes
/a0 {2384 3370 //.setpagesize exec} bind def
/a1 {1684 2384 //.setpagesize exec} bind def
/a2 {1191 1684 //.setpagesize exec} bind def
@@ -103,21 +103,21 @@ STRICT { (%END SIZES) .skipeof } if
/c4 {649 918 //.setpagesize exec} bind def
/c5 {459 649 //.setpagesize exec} bind def
/c6 {323 459 //.setpagesize exec} bind def
- % U.S. CAD standard paper sizes
+ % U.S. CAD standard paper sizes
/archE {2592 3456 //.setpagesize exec} bind def
/archD {1728 2592 //.setpagesize exec} bind def
/archC {1296 1728 //.setpagesize exec} bind def
/archB {864 1296 //.setpagesize exec} bind def
/archA {648 864 //.setpagesize exec} bind def
- % Other paper sizes
+ % Other paper sizes
/flsa {612 936 //.setpagesize exec} bind def % U.S. foolscap
/flse {612 936 //.setpagesize exec} bind def % European foolscap
/halfletter {396 612 //.setpagesize exec} bind def
- % minimum of a4 and letter (a4 width, letter length)
+ % minimum of a4 and letter (a4 width, letter length)
/pa4 {595 792 //.setpagesize exec} bind def
- % Japanese postcard size, 100mm x 148mm
+ % Japanese postcard size, 100mm x 148mm
/hagaki {283 420 //.setpagesize exec} bind def
- % U.S. ANSI/ASME Y14.1 paper sizes
+ % U.S. ANSI/ASME Y14.1 paper sizes
/ANSI_A //letter def
/ANSI_B //11x17 def
/tabloid //11x17 def
@@ -143,19 +143,19 @@ readonly def
/ramsize 4194304 def
/hardwareiomode 0 def
- /sethardwareiomode {pop} bind def
+ /sethardwareiomode {pop} bind def
/softwareiomode 0 def
- /setsoftwareiomode {pop} bind def
+ /setsoftwareiomode {pop} bind def
/dosysstart //false def
- /setdosysstart {pop} bind def
+ /setdosysstart {pop} bind def
/allowjobreset //true def
- /setallowjobreset {pop} bind def
+ /setallowjobreset {pop} bind def
/defaultpaperfamily 0 def
- /setdefaultpaperfamily {pop} bind def
+ /setdefaultpaperfamily {pop} bind def
/defaultpapertray 0 def
- /setdefaultpapertray {pop} bind def
+ /setdefaultpapertray {pop} bind def
/defaulttrayswitch //false def
- /setdefaulttrayswitch {pop} bind def
+ /setdefaulttrayswitch {pop} bind def
% Tray and format selection
@@ -177,7 +177,7 @@ readonly def
/paperfamily 0 def % 0 is US, 1 is European
/papertray 1 def
- /setpapertray {statusdict exch /papertray exch put} bind def
+ /setpapertray {statusdict exch /papertray exch put} bind def
/trayswitch //false def % paperout feeds from another tray
% We don't implement the (undocumented by Adobe) papersize 'operator',
% because it's very awkward to make it interact properly with all the
@@ -259,10 +259,10 @@ readonly def
} bind def
/setpagetype
{ statusdict begin
- % The Adobe documentation only defines setpagetype
- % (a Level 1 operator) as accepting the values 0 and 1,
- % so we do too.
- {/letter /note} 1 index get
+ % The Adobe documentation only defines setpagetype
+ % (a Level 1 operator) as accepting the values 0 and 1,
+ % so we do too.
+ {/letter /note} 1 index get
//systemdict /userdict get exch get cvx exec
/pagetype exch def
end
@@ -328,24 +328,24 @@ systemdict begin
} odef
/devstatus { % <(%disk*%)> devstatus <searchable> <writable>
- % <hasNames> <mounted> <removable> <searchOrder>
- % <freePages> <size> //true
- % <string> devstatus //false
+ % <hasNames> <mounted> <removable> <searchOrder>
+ % <freePages> <size> //true
+ % <string> devstatus //false
dup length 5 ge {
dup 0 5 getinterval (%disk) eq {
dup /IODevice resourcestatus {
- pop pop dup currentdevparams
- dup /Searchable get
- exch dup /Writeable get
- exch dup /HasNames get
- exch dup /Mounted get
- exch dup /Removable get
- exch dup /SearchOrder get
- exch dup /Free get
- exch /LogicalSize get
- 9 -1 roll pop //true
+ pop pop dup currentdevparams
+ dup /Searchable get
+ exch dup /Writeable get
+ exch dup /HasNames get
+ exch dup /Mounted get
+ exch dup /Removable get
+ exch dup /SearchOrder get
+ exch dup /Free get
+ exch /LogicalSize get
+ 9 -1 roll pop //true
} {
- pop //false
+ pop //false
} ifelse
} {
pop //false
diff --git a/gs/Resource/Init/gs_std_e.ps b/gs/Resource/Init/gs_std_e.ps
index 4e1aa10e6..1cae50217 100644
--- a/gs/Resource/Init/gs_std_e.ps
+++ b/gs/Resource/Init/gs_std_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993, 1994 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -23,13 +23,13 @@
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
% \04x
/space /exclam /quotedbl /numbersign
- /dollar /percent /ampersand /quoteright
+ /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus
- /comma /hyphen /period /slash
+ /comma /hyphen /period /slash
/zero /one /two /three
- /four /five /six /seven
+ /four /five /six /seven
/eight /nine /colon /semicolon
- /less /equal /greater /question
+ /less /equal /greater /question
% \10x
/at /A /B /C /D /E /F /G
/H /I /J /K /L /M /N /O
@@ -47,13 +47,13 @@
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
% \24x
/.notdef /exclamdown /cent /sterling
- /fraction /yen /florin /section
+ /fraction /yen /florin /section
/currency /quotesingle /quotedblleft /guillemotleft
- /guilsinglleft /guilsinglright /fi /fl
+ /guilsinglleft /guilsinglright /fi /fl
/.notdef /endash /dagger /daggerdbl
- /periodcentered /.notdef /paragraph /bullet
+ /periodcentered /.notdef /paragraph /bullet
/quotesinglbase /quotedblbase /quotedblright /guillemotright
- /ellipsis /perthousand /.notdef /questiondown
+ /ellipsis /perthousand /.notdef /questiondown
% \30x
/.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
diff --git a/gs/Resource/Init/gs_sym_e.ps b/gs/Resource/Init/gs_sym_e.ps
index 113d1df47..0f207d206 100644
--- a/gs/Resource/Init/gs_sym_e.ps
+++ b/gs/Resource/Init/gs_sym_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1991, 1994, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -24,60 +24,60 @@ ifelse
StandardEncoding 0 32 getinterval aload pop % /.notdef
% \040
/space /exclam /universal /numbersign
- /existential /percent /ampersand /suchthat
+ /existential /percent /ampersand /suchthat
/parenleft /parenright /asteriskmath /plus
- /comma /minus /period /slash
+ /comma /minus /period /slash
/zero /one /two /three
- /four /five /six /seven
+ /four /five /six /seven
/eight /nine /colon /semicolon
- /less /equal /greater /question
+ /less /equal /greater /question
% \100
/congruent /Alpha /Beta /Chi
- /Delta /Epsilon /Phi /Gamma
+ /Delta /Epsilon /Phi /Gamma
/Eta /Iota /theta1 /Kappa
- /Lambda /Mu /Nu /Omicron
+ /Lambda /Mu /Nu /Omicron
/Pi /Theta /Rho /Sigma
- /Tau /Upsilon /sigma1 /Omega
+ /Tau /Upsilon /sigma1 /Omega
/Xi /Psi /Zeta /bracketleft
- /therefore /bracketright /perpendicular /underscore
+ /therefore /bracketright /perpendicular /underscore
% \140
/radicalex /alpha /beta /chi
- /delta /epsilon /phi /gamma
+ /delta /epsilon /phi /gamma
/eta /iota /phi1 /kappa
- /lambda /mu /nu /omicron
+ /lambda /mu /nu /omicron
/pi /theta /rho /sigma
- /tau /upsilon /omega1 /omega
+ /tau /upsilon /omega1 /omega
/xi /psi /zeta /braceleft
- /bar /braceright /similar /.notdef
+ /bar /braceright /similar /.notdef
% \200
StandardEncoding 0 32 getinterval aload pop % /.notdef
% \240
/Euro /Upsilon1 /minute /lessequal
- /fraction /infinity /florin /club
+ /fraction /infinity /florin /club
/diamond /heart /spade /arrowboth
- /arrowleft /arrowup /arrowright /arrowdown
+ /arrowleft /arrowup /arrowright /arrowdown
/degree /plusminus /second /greaterequal
- /multiply /proportional /partialdiff /bullet
+ /multiply /proportional /partialdiff /bullet
/divide /notequal /equivalence /approxequal
- /ellipsis /arrowvertex /arrowhorizex /carriagereturn
+ /ellipsis /arrowvertex /arrowhorizex /carriagereturn
% \300
/aleph /Ifraktur /Rfraktur /weierstrass
- /circlemultiply /circleplus /emptyset /intersection
+ /circlemultiply /circleplus /emptyset /intersection
/union /propersuperset /reflexsuperset /notsubset
- /propersubset /reflexsubset /element /notelement
+ /propersubset /reflexsubset /element /notelement
/angle /gradient /registerserif /copyrightserif
- /trademarkserif /product /radical /dotmath
+ /trademarkserif /product /radical /dotmath
/logicalnot /logicaland /logicalor /arrowdblboth
- /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown
+ /arrowdblleft /arrowdblup /arrowdblright /arrowdbldown
% \340
/lozenge /angleleft /registersans /copyrightsans
- /trademarksans /summation /parenlefttp /parenleftex
+ /trademarksans /summation /parenlefttp /parenleftex
/parenleftbt /bracketlefttp /bracketleftex /bracketleftbt
- /bracelefttp /braceleftmid /braceleftbt /braceex
+ /bracelefttp /braceleftmid /braceleftbt /braceex
/.notdef /angleright /integral /integraltp
- /integralex /integralbt /parenrighttp /parenrightex
+ /integralex /integralbt /parenrighttp /parenrightex
/parenrightbt /bracketrighttp /bracketrightex /bracketrightbt
- /bracerighttp /bracerightmid /bracerightbt /.notdef
+ /bracerighttp /bracerightmid /bracerightbt /.notdef
256 packedarray .defineencoding
2 SymbolEncoding .registerencoding
exec
diff --git a/gs/Resource/Init/gs_trap.ps b/gs/Resource/Init/gs_trap.ps
index 968173b74..913b35613 100644
--- a/gs/Resource/Init/gs_trap.ps
+++ b/gs/Resource/Init/gs_trap.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -32,7 +32,7 @@ languagelevel dup 2 .max .setlanguagelevel
/settrapparams dup { % <paramdict> settrapparams -
/.trapparams .uservar dup length dict .copydict
dup 2 index {
- % Stack: paramdict olddict olddict key value
+ % Stack: paramdict olddict olddict key value
2 index 2 index known { put dup } { pop pop } ifelse
} forall pop
dup .settrapparams % Let the operator check parameter validity.
@@ -57,7 +57,7 @@ languagelevel dup 2 .max .setlanguagelevel
} bind .makeoperator
/settrapzone dup { % - settrapzone -
- % ****** DUMMY ******
+ % ****** DUMMY ******
newpath
} bind .makeoperator
diff --git a/gs/Resource/Init/gs_ttf.ps b/gs/Resource/Init/gs_ttf.ps
index adec612f1..dbd2c9b5a 100644
--- a/gs/Resource/Init/gs_ttf.ps
+++ b/gs/Resource/Init/gs_ttf.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996-2003 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -46,14 +46,14 @@
2 index 1 index unread
% beginning with binary 0 or 't' (TrueType), or 'O' (OpenType)
dup 0 eq 1 index (O) 0 get eq or exch (t) 0 get eq or {
- % If this is a font at all, it's a TrueType font.
+ % If this is a font at all, it's a TrueType font.
dup /FontType eq {
pop closefile 42 //true
} {
dup /FontName eq { pop .findttfontname } { pop closefile //false } ifelse
} ifelse
} {
- % Not a TrueType font.
+ % Not a TrueType font.
.findnonttfontvalue
} ifelse
} { pop closefile //false } ifelse
@@ -88,10 +88,10 @@
/.loadnonttfontfile /.loadfontfile load def
/.loadfontfile {
dup (1234) .peekstring { //tt_tag_dict exch known } { //false } ifelse {
- % If this is a font at all, it's a TrueType font.
+ % If this is a font at all, it's a TrueType font.
.loadttfont pop
} {
- % Not a TrueType font.
+ % Not a TrueType font.
.loadnonttfontfile
} ifelse
} bind def
@@ -117,7 +117,7 @@ currentdict /tt_tag_dict .undef
/orgXUID AladdinEnterprisesXUID def
/maxstring 32764 def % half the maximum length of a PostScript string,
- % must be a multiple of 4 (for hmtx / loca / vmtx)
+ % must be a multiple of 4 (for hmtx / loca / vmtx)
/.invert_encoding % <array> invert_encoding <dict>
{ dup 256 dict exch
@@ -126,9 +126,9 @@ currentdict /tt_tag_dict .undef
dup /.notdef ne {
exch 2 index 2 index .knownget {
dup type /arraytype eq {
- [ exch aload pop counttomark 2 add -1 roll ]
+ [ exch aload pop counttomark 2 add -1 roll ]
} {
- exch 2 array astore
+ exch 2 array astore
} ifelse
} if 2 index 3 1 roll put
} {
@@ -150,22 +150,22 @@ currentdict /tt_tag_dict .undef
/MacRomanEncoding .findencoding
dup length array copy
<<
- /notequal 173
- /infinity 176
- /lessequal 178
- /greaterequal 179
- /partialdiff 182
- /summation 183
- /product 184
- /pi 185
- /integral 186
- /Omega 189
- /radical 195
- /approxequal 197
- /Delta 198
- /lozenge 215
- /Euro 219
- /apple 240
+ /notequal 173
+ /infinity 176
+ /lessequal 178
+ /greaterequal 179
+ /partialdiff 182
+ /summation 183
+ /product 184
+ /pi 185
+ /integral 186
+ /Omega 189
+ /radical 195
+ /approxequal 197
+ /Delta 198
+ /lozenge 215
+ /Euro 219
+ /apple 240
>> {
TTFDEBUG { (Extend MacRomanEncodingForTrueType for TrueType: ) =only } if
@@ -287,28 +287,28 @@ currentdict /tt_tag_dict .undef
/findname {
TTFDEBUG { (findname: ) print dup =only } if
//false 3 1 roll
- 1 index length 0 gt { % check for zero length name table
+ 1 index length 0 gt { % check for zero length name table
0 1 3 index 2 getu16 1 sub {
- % Stack: false table id index
+ % Stack: false table id index
12 mul 6 add 2 index exch 12 getinterval
dup 6 getu16 2 index eq 1 index 8 getu16 0 ne and {
- % We found the name we want.
- exch pop
- % Stack: false table record
- dup 10 getu16 2 index 4 getu16 add
- 1 index 8 getu16 4 -1 roll 3 1 roll
- 3 copy add 1 index length
- le {
- pop
- getinterval exch
- % Stack: false string record
- % Check for 8- vs. 16-bit characters.
- is2byte { //true } { dup is2byte2 } ifelse { string2to1 } if //true //null 4 -1 roll exit
- } {
- pop pop pop pop
- //false
- exit
- } ifelse
+ % We found the name we want.
+ exch pop
+ % Stack: false table record
+ dup 10 getu16 2 index 4 getu16 add
+ 1 index 8 getu16 4 -1 roll 3 1 roll
+ 3 copy add 1 index length
+ le {
+ pop
+ getinterval exch
+ % Stack: false string record
+ % Check for 8- vs. 16-bit characters.
+ is2byte { //true } { dup is2byte2 } ifelse { string2to1 } if //true //null 4 -1 roll exit
+ } {
+ pop pop pop pop
+ //false
+ exit
+ } ifelse
} if pop
} for
} if
@@ -330,7 +330,7 @@ currentdict /tt_tag_dict .undef
% <string> is2byte2 <bool>
/is2byte2 {
- dup length
+ dup length
dup 2 mod 0 ne {
pop pop //false
} { % s l
@@ -443,33 +443,33 @@ currentdict /tt_tag_dict .undef
/etab exch def
/nseg2 etab 6 getu16a def
14 /endc etab 2 index nseg2 getinterval_from_stringarray def
- % The Apple TrueType documentation omits the 2-byte
- % 'reserved pad' that follows the endCount vector!
+ % The Apple TrueType documentation omits the 2-byte
+ % 'reserved pad' that follows the endCount vector!
2 add
nseg2 add /startc etab 2 index nseg2 getinterval_from_stringarray def
nseg2 add /iddelta etab 2 index nseg2 getinterval_from_stringarray def
nseg2 add /idroff etab 2 index nseg2 getinterval_from_stringarray def
- % The following hack allows us to properly handle
- % idiosyncratic fonts that start at 0xf000:
+ % The following hack allows us to properly handle
+ % idiosyncratic fonts that start at 0xf000:
pop
/firstcode startc 0 getu16a 16#ff00 and dup 16#f000 ne { pop 0 } if def
/putglyph {
glyphs code 3 -1 roll put /code code 1 add def
} bind def
- % Do a first pass to compute the size of the glyphs array.
+ % Do a first pass to compute the size of the glyphs array.
/numcodes 0 def
/glyphs 0 dict def
0 0 2 nseg2 3 sub {
- % Stack: /glyphs numglyphs i2
+ % Stack: /glyphs numglyphs i2
/i2 exch def
/scode startc i2 getu16a def
/ecode endc i2 getu16a def
- scode ecode 1 add gt { % Bug 691326.
+ scode ecode 1 add gt { % Bug 691326.
/ecode scode 1 add def % Acrobat does this contrary to TTF spec that
} if % requires such intervals to be ignored.
numcodes scode firstcode sub
- % Hack for fonts that have only 0x0000 and 0xf000 ranges
+ % Hack for fonts that have only 0x0000 and 0xf000 ranges
%dup 16#e000 ge { 255 and } if
% the previous line is obstructive to CJK fonts, so it was removed
exch sub 0 .max ecode scode sub 1 add add
@@ -477,7 +477,7 @@ currentdict /tt_tag_dict .undef
numcodes add /numcodes exch def
} for pop
- % Now fill in the array.
+ % Now fill in the array.
/numcodes 0 def /code 0 def
0 2 nseg2 3 sub {
/i2 exch def
@@ -486,27 +486,27 @@ currentdict /tt_tag_dict .undef
scode ecode 1 add gt { /ecode scode 1 add def } if % Bug 691326. See above.
numcodes scode firstcode sub
- % Hack for fonts that have only 0x0000 and 0xf000 ranges
+ % Hack for fonts that have only 0x0000 and 0xf000 ranges
%dup 16#e000 ge { 255 and } if
% the previous line is obstructive to CJK fonts, so it was removed
exch sub 0 .max dup /code exch code exch add def
ecode scode sub 1 add add numcodes add /numcodes exch def
/delta iddelta i2 gets16a def
TTFDEBUG {
- (scode=) print scode =only
- ( ecode=) print ecode =only
- ( delta=) print delta =only
- ( droff=) print idroff i2 getu16 =
+ (scode=) print scode =only
+ ( ecode=) print ecode =only
+ ( delta=) print delta =only
+ ( droff=) print idroff i2 getu16 =
} if
idroff i2 getu16a dup 0 eq {
- pop scode delta add 65535 and 1 ecode delta add 65535 and
- { putglyph } for
+ pop scode delta add 65535 and 1 ecode delta add 65535 and
+ { putglyph } for
} { % The +2 is for the 'reserved pad'.
/gloff exch 14 nseg2 3 mul add 2 add i2 add add def
0 1 ecode scode sub {
- 2 mul gloff add etab exch getu16a
- dup 0 ne { delta add 65535 and } if putglyph
- } for
+ 2 mul gloff add etab exch getu16a
+ dup 0 ne { delta add 65535 and } if putglyph
+ } for
} ifelse
} for glyphs /glyphs //null def % for GC
} bind
@@ -514,9 +514,9 @@ currentdict /tt_tag_dict .undef
dup 6 getu16a /firstcode exch def
dup 8 getu16a /ng exch def
ng dict
- dup
- % Stack: tab dict dict
- % Fill elements firstcode .. firstcode+nvalue-1 with glyph values
+ dup
+ % Stack: tab dict dict
+ % Fill elements firstcode .. firstcode+nvalue-1 with glyph values
0 1 ng 1 sub {
dup firstcode add exch
2 mul 10 add 4 index exch getu16a 3 copy put pop pop
@@ -558,7 +558,7 @@ currentdict /tt_tag_dict .undef
2 index type /stringtype eq {
getinterval
} {
- dup 65535 le {
+ dup 65535 le {
string exch 0 % [] s o p
4 3 roll { % s o p Si
dup length % s o p Si lSi
@@ -585,8 +585,8 @@ currentdict /tt_tag_dict .undef
{
dup 0 eq {
pop pop pop exit
- } if
- 3 copy
+ } if
+ 3 copy
dup 65535 ge {
pop 65535
} if
@@ -604,7 +604,7 @@ currentdict /tt_tag_dict .undef
/string_array_size % <array|string> string_array_size <int>
{ dup type /stringtype eq {
length
- } {
+ } {
0 exch { length add } forall
} ifelse
} bind def
@@ -628,14 +628,14 @@ currentdict /tt_tag_dict .undef
/postpos glyphnames def
/total_length postglyphs //string_array_size exec def
numglyphs array 0 1 numglyphs 1 sub {
- postpos total_length ge {
+ postpos total_length ge {
% Fill the rest with .notdef
1 numglyphs 1 sub { 1 index exch /.notdef put } for
exit
} if
- % No name available, /postnames will be defined as an empty
- % array and the glyph won't get a name attached.
- postglyphs postpos //get_from_stringarray exec
+ % No name available, /postnames will be defined as an empty
+ % array and the glyph won't get a name attached.
+ postglyphs postpos //get_from_stringarray exec
postglyphs postpos 1 add 2 index
2 copy add total_length gt {
TTFDEBUG { (post table ends in the middle of the entry.) print flush } if
@@ -645,7 +645,7 @@ currentdict /tt_tag_dict .undef
exit
} if
//getinterval_from_stringarray exec cvn
- exch postpos add 1 add /postpos exch def
+ exch postpos add 1 add /postpos exch def
2 index 3 1 roll
put
} for
@@ -680,31 +680,31 @@ currentdict /tt_tag_dict .undef
} if
numglyphs array 0 1 numglyphs 1 sub {
- dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec
- dup 0 get 8 bitshift exch 1 get add dup 258 lt {
- MacGlyphEncoding exch get
- } {
- dup 32768 ge {
- % According to the published TrueType spec, such values are
- % "reserved for future use", but at least some PDF files
- % produced by the Adobe PDF library contain entries with a
- % value of 16#ffff.
- pop /.notdef
- } {
- % Get the name for this glyph
- 258 sub dup postnames length ge {
- TTFDEBUG { ( *** warning: glyph index past end of 'post' table) = flush } if
- pop pop
- exit
- } if
- postnames exch get
- % At least some of Microsoft's TrueType fonts use incorrect
- % (Adobe-incompatible) names for some glyphs.
- % Correct for this here.
- postremap 1 index .knownget { exch pop } if
- } ifelse
- } ifelse
- 2 index 3 1 roll put
+ dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec
+ dup 0 get 8 bitshift exch 1 get add dup 258 lt {
+ MacGlyphEncoding exch get
+ } {
+ dup 32768 ge {
+ % According to the published TrueType spec, such values are
+ % "reserved for future use", but at least some PDF files
+ % produced by the Adobe PDF library contain entries with a
+ % value of 16#ffff.
+ pop /.notdef
+ } {
+ % Get the name for this glyph
+ 258 sub dup postnames length ge {
+ TTFDEBUG { ( *** warning: glyph index past end of 'post' table) = flush } if
+ pop pop
+ exit
+ } if
+ postnames exch get
+ % At least some of Microsoft's TrueType fonts use incorrect
+ % (Adobe-incompatible) names for some glyphs.
+ % Correct for this here.
+ postremap 1 index .knownget { exch pop } if
+ } ifelse
+ } ifelse
+ 2 index 3 1 roll put
} for
.broken_post {
@@ -731,7 +731,7 @@ currentdict /tt_tag_dict .undef
% Note that each table must have an even length, because of a strange
% Adobe requirement that each sfnts entry have even length.
/readtables mark
- % Ordinary tables
+ % Ordinary tables
(head) //call.readtable
(hhea) 1 index
(maxp) 1 index
@@ -739,14 +739,14 @@ currentdict /tt_tag_dict .undef
(OS/2) 1 index
(post) //call.readbigtable
(vhea) //call.readtable
- % Big tables
+ % Big tables
(cmap) //call.readbigtable
(GSUB) //call.readbigtable
(glyf) //call.readbigtable
(loca) 1 index
(hmtx) 1 index
(vmtx) 1 index
- % Tables only needed for embedding in PDF files
+ % Tables only needed for embedding in PDF files
(cvt ) //call.readtable
(fpgm) 1 index
(prep) 1 index
@@ -771,12 +771,12 @@ def
% <file> <length> .readtable <string>
/.readtable {
dup dup 1 and add string
- % Stack: f len str
+ % Stack: f len str
dup 0 4 -1 roll getinterval
- % Stack: f str str1
- % Because of the absurd PostScript specification that gives an
- % error for reading into an empty string, we have to check for
- % this explicitly here.
+ % Stack: f str str1
+ % Because of the absurd PostScript specification that gives an
+ % error for reading into an empty string, we have to check for
+ % this explicitly here.
3 -1 roll exch
dup () ne { readstring } if pop pop
} bind def
@@ -789,7 +789,7 @@ def
} {
currentuserparams /VMReclaim get -2 vmreclaim
[ 4 2 roll {
- % Stack: mark ... f left
+ % Stack: mark ... f left
dup maxstring le { exit } if
1 index maxstring string readstring pop 3 1 roll maxstring sub
} loop .readtable ]
@@ -850,7 +850,7 @@ end readonly def % .loadttfontdict
% Peek because table counter may be incorrect.
/tables f offsets 4 getu16 16 mul string .peekstring pop def
/tabdict tables length 16 idiv dict def
- % tabs = tables we want to keep, sorted by file position.
+ % tabs = tables we want to keep, sorted by file position.
/tabs [ 0 16 tables length 1 sub {
tables exch 16 getinterval
TTFDEBUG { dup .printtab } if
@@ -864,8 +864,8 @@ end readonly def % .loadttfontdict
} for ] {
exch 8 getu32 exch 8 getu32 lt
} .sort def
- % In certain malformed TrueType fonts, tables overlap.
- % Truncate tables if necessary.
+ % In certain malformed TrueType fonts, tables overlap.
+ % Truncate tables if necessary.
0 1 tabs length 2 sub {
dup tabs exch get exch 1 add tabs exch get
1 index 8 getu32 2 index 12 getu32 add
@@ -902,8 +902,8 @@ mark
tabdict tname () put
} {
8 sfpos putu32
- % Skip data between the end of the previous table and
- % the beginning of this one, if any.
+ % Skip data between the end of the previous table and
+ % the beginning of this one, if any.
tpos fpos gt {
load_stripped {
% 'setfileposition' is faster for skipping a big data.
@@ -915,7 +915,7 @@ mark
} if
f tlen readtables_ tname get exec
tabdict tname 3 -1 roll put
- % Round up the table length to an even value.
+ % Round up the table length to an even value.
/sfpos sfpos tlen dup 1 and add add def
} ifelse
/fpos fpos tlen add def
@@ -937,10 +937,10 @@ mark
/.makesfnts {
.readttdata
/head tabdict /head get def
- /post tabdict /post .knownget {
- dup 0 get /post_first_part exch def
- } {
- //null
+ /post tabdict /post .knownget {
+ dup 0 get /post_first_part exch def
+ } {
+ //null
} ifelse def
load_stripped not {
/locatable tabdict /loca get def
@@ -991,9 +991,9 @@ mark
} {
postformats first_post_string 0 getu32 .knownget {
TTFDEBUG {
- (post: format ) print
- first_post_string
- dup 0 getu16 =only (,) print 2 getu16 = flush
+ (post: format ) print
+ first_post_string
+ dup 0 getu16 =only (,) print 2 getu16 = flush
} if
post exch exec
} {
@@ -1012,7 +1012,7 @@ mark
/FontBBox [ 36 2 42 { head exch gets16 upem div } for ]
nextxuid
tabdict /name .knownget {
- % Find the names from the 'name' table.
+ % Find the names from the 'name' table.
/names exch def
/FontName names 6 findname not { names 4 findname not { curxuid 16#ffffffff and 16 32 string cvrs } if } if
/fontname 1 index def
@@ -1022,12 +1022,12 @@ mark
names 4 findname { /FullName exch } if
names 5 findname { /Version exch } if
} {
- % No name table, fabricate a FontName.
+ % No name table, fabricate a FontName.
/FontName curxuid 16#ffffffff and 16 32 string cvrs
/fontname 1 index def
/FontInfo mark
} ifelse
- % Stack: ... /FontInfo mark key1 value1 ...
+ % Stack: ... /FontInfo mark key1 value1 ...
post //null ne {
/ItalicAngle first_post_string 4 gets32 65536.0 div
/isFixedPitch first_post_string 12 getu32 0 ne
@@ -1050,9 +1050,9 @@ mark
% Defines cmapsub, cmaptab
/.pickcmap_with_no_xlatmap {
tabdict /cmap get
- % The Apple cmap format is no help in determining the encoding.
- % Look for a Microsoft table. If we can't find one,
- % just use the first table, whatever it is.
+ % The Apple cmap format is no help in determining the encoding.
+ % Look for a Microsoft table. If we can't find one,
+ % just use the first table, whatever it is.
dup 4 8 getinterval_from_stringarray exch % () [] % the default
0 1 2 index 2 getu16a 1 sub { % () [] i
8 mul 4 add 1 index exch 8 getinterval_from_stringarray % () [] ()
@@ -1062,7 +1062,7 @@ mark
} if
dup 0 getu16 3 eq { exch 3 -1 roll pop exit } if pop
} for
- % Stack: subentry table
+ % Stack: subentry table
/cmapsub 2 index def % () []
exch 4 getu32 1 index string_array_size 1 index sub getinterval_from_stringarray
/cmaptab exch def
@@ -1077,7 +1077,7 @@ mark
/.pickcmap_with_xlatmap cvx /configurationerror signalerror
} if
//false
- .xlatmap_dict /TrueType get
+ .xlatmap_dict /TrueType get
dup length 2 sub 0 exch 2 exch { % bool [] i
2 copy get % bool [] i ()
(.) search { % bool [] i post match pre
@@ -1126,7 +1126,7 @@ mark
1 index { exit } if
} for % bool []
pop % bool
- not {
+ not {
QUIET not { (True Type font doesn't contain a charset listed in gs/lib/xlatmap.) = } if
/.pickcmap_with_xlatmap cvx /invalidfont signalerror
} if %
@@ -1139,9 +1139,9 @@ mark
% a disk True Type font files, and use load_stripped
% to check this regime. We would like to do so
% while emulating a Type 42, but first the old code
- % about handling them to be changed
+ % about handling them to be changed
% with adding a handling of a Decoding.
- % fixme : A correct way to fix this is to implenent
+ % fixme : A correct way to fix this is to implenent
% the Type 42 emulation with gs_fntem.ps .
% Also note that PDF embedded fonts probably don't need a xlatmap -
% see PDF spec, "Encodings for True Type fonts".
@@ -1163,194 +1163,194 @@ mark
% See: http://partners.adobe.com/asn/developer/typeforum/unicodegn.html
/postalias mark
/pi1 /pi /plusinus /plusminus
- /Acyrillic /afii10017 /Becyrillic /afii10018
- /Cdot /Cdotaccent /Checyrillic /afii10041
- /Dcroat /Dslash /Decyrillic /afii10021
- /Delta /increment /Djecyrillic /afii10051
- /Dzecyrillic /afii10054 /Dzhecyrillic /afii10145
- /Ecyrillic /afii10053 /Edot /Edotaccent
- /Efcyrillic /afii10038 /Elcyrillic /afii10029
- /Emcyrillic /afii10030 /Encyrillic /afii10031
- /Ercyrillic /afii10034 /Ereversedcyrillic /afii10047
- /Escyrillic /afii10035 /Euro /euro
- /Fitacyrillic /afii10147 /Gcedilla /Gcommaaccent
- /Gdot /Gdotaccent /Gecyrillic /afii10020
- /Gheupturncyrillic /afii10050 /Gjecyrillic /afii10052
- /H18533 /blackcircle /H18543 /blacksmallsquare
- /H18551 /whitesmallsquare /H22073 /whitesquare
- /Hardsigncyrillic /afii10044 /IAcyrillic /afii10049
- /IUcyrillic /afii10048 /Icyrillic /afii10055
- /Idot /Idotaccent /Iecyrillic /afii10022
- /Iicyrillic /afii10026 /Iishortcyrillic /afii10027
- /Iocyrillic /afii10023 /Izhitsacyrillic /afii10148
- /Jecyrillic /afii10057 /Kacyrillic /afii10028
- /Kcedilla /Kcommaaccent /Khacyrillic /afii10039
- /Kjecyrillic /afii10061 /Lcedilla /Lcommaaccent
- /Ldot /Ldotaccent /Ljecyrillic /afii10058
- /Ncedilla /Ncommaaccent /Njecyrillic /afii10059
- /Ocyrillic /afii10032 /Odblacute /Ohungarumlaut
- /Ohm /Omega /Oslashacute /Ostrokeacute
- /Pecyrillic /afii10033 /Rcedilla /Rcommaaccent
- /Shacyrillic /afii10042 /Shchacyrillic /afii10043
- /Softsigncyrillic /afii10046 /Tcedilla /Tcommaaccent
- /Tecyrillic /afii10036 /Tsecyrillic /afii10040
- /Tshecyrillic /afii10060 /Ucyrillic /afii10037
- /Udblacute /Uhungarumlaut /Upsilon1 /Upsilonhooksymbol
- /Ushortcyrillic /afii10062 /Vecyrillic /afii10019
- /Yatcyrillic /afii10146 /Yericyrillic /afii10045
- /Yicyrillic /afii10056 /Zdot /Zdotaccent
- /Zecyrillic /afii10025 /Zhecyrillic /afii10024
- /acutecmb /acutecomb /acyrillic /afii10065
- /afii00208 /horizontalbar /afii08941 /lira
- /afii10066 /becyrillic /afii10067 /vecyrillic
- /afii10068 /gecyrillic /afii10069 /decyrillic
- /afii10070 /iecyrillic /afii10071 /iocyrillic
- /afii10072 /zhecyrillic /afii10073 /zecyrillic
- /afii10074 /iicyrillic /afii10075 /iishortcyrillic
- /afii10076 /kacyrillic /afii10077 /elcyrillic
- /afii10078 /emcyrillic /afii10079 /encyrillic
- /afii10080 /ocyrillic /afii10081 /pecyrillic
- /afii10082 /ercyrillic /afii10083 /escyrillic
- /afii10084 /tecyrillic /afii10085 /ucyrillic
- /afii10086 /efcyrillic /afii10087 /khacyrillic
- /afii10088 /tsecyrillic /afii10089 /checyrillic
- /afii10090 /shacyrillic /afii10091 /shchacyrillic
- /afii10092 /hardsigncyrillic /afii10093 /yericyrillic
- /afii10094 /softsigncyrillic /afii10095 /ereversedcyrillic
- /afii10096 /iucyrillic /afii10097 /iacyrillic
- /afii10098 /gheupturncyrillic /afii10099 /djecyrillic
- /afii10100 /gjecyrillic /afii10101 /ecyrillic
- /afii10102 /dzecyrillic /afii10103 /icyrillic
- /afii10104 /yicyrillic /afii10105 /jecyrillic
- /afii10106 /ljecyrillic /afii10107 /njecyrillic
- /afii10108 /tshecyrillic /afii10109 /kjecyrillic
- /afii10110 /ushortcyrillic /afii10193 /dzhecyrillic
- /afii10194 /yatcyrillic /afii10195 /fitacyrillic
- /afii10196 /izhitsacyrillic /afii10846 /schwacyrillic
- /afii57381 /percentarabic /afii57388 /commaarabic
- /afii57392 /zeroarabic /afii57393 /onearabic
- /afii57394 /twoarabic /afii57395 /threearabic
- /afii57396 /fourarabic /afii57397 /fivearabic
- /afii57398 /sixarabic /afii57399 /sevenarabic
- /afii57400 /eightarabic /afii57401 /ninearabic
- /afii57403 /semicolonarabic /afii57407 /questionarabic
- /afii57409 /hamzaarabic /afii57410 /alefmaddaabovearabic
- /afii57411 /alefhamzaabovearabic /afii57412 /wawhamzaabovearabic
- /afii57413 /alefhamzabelowarabic /afii57414 /yehhamzaabovearabic
- /afii57415 /alefarabic /afii57416 /beharabic
- /afii57417 /tehmarbutaarabic /afii57418 /teharabic
- /afii57419 /theharabic /afii57420 /jeemarabic
- /afii57421 /haharabic /afii57422 /khaharabic
- /afii57423 /dalarabic /afii57424 /thalarabic
- /afii57425 /reharabic /afii57426 /zainarabic
- /afii57427 /seenarabic /afii57428 /sheenarabic
- /afii57429 /sadarabic /afii57430 /dadarabic
- /afii57431 /taharabic /afii57432 /zaharabic
- /afii57433 /ainarabic /afii57434 /ghainarabic
- /afii57440 /tatweelarabic /afii57441 /feharabic
- /afii57442 /qafarabic /afii57443 /kafarabic
- /afii57444 /lamarabic /afii57445 /meemarabic
- /afii57446 /noonarabic /afii57448 /wawarabic
- /afii57449 /alefmaksuraarabic /afii57450 /yeharabic
- /afii57451 /fathatanarabic /afii57452 /dammatanarabic
- /afii57453 /kasratanarabic /afii57454 /fathaarabic
- /afii57455 /dammaarabic /afii57456 /kasraarabic
- /afii57457 /shaddaarabic /afii57458 /sukunarabic
- /afii57470 /heharabic /afii57505 /veharabic
- /afii57506 /peharabic /afii57507 /tcheharabic
- /afii57508 /jeharabic /afii57509 /gafarabic
- /afii57511 /tteharabic /afii57512 /ddalarabic
- /afii57513 /rreharabic /afii57514 /noonghunnaarabic
- /afii57519 /yehbarreearabic /afii57636 /newsheqelsign
- /afii57645 /maqafhebrew /afii57658 /sofpasuqhebrew
- /afii57664 /alef /afii57665 /bet
- /afii57666 /gimel /afii57667 /dalet
- /afii57668 /he /afii57669 /vav
- /afii57670 /zayin /afii57671 /het
- /afii57672 /tet /afii57673 /yod
- /afii57674 /finalkaf /afii57675 /kaf
- /afii57676 /lamed /afii57677 /finalmem
- /afii57678 /mem /afii57679 /finalnun
- /afii57680 /nun /afii57681 /samekh
- /afii57682 /ayin /afii57683 /finalpe
- /afii57684 /pe /afii57685 /finaltsadi
- /afii57686 /tsadi /afii57687 /qof
- /afii57688 /resh /afii57689 /shin
- /afii57690 /tav /afii57694 /shinshindot
- /afii57695 /shinsindot /afii57700 /vavholam
- /afii57705 /doubleyodpatah /afii57716 /vavvavhebrew
- /afii57717 /vavyodhebrew /afii57718 /yodyodhebrew
- /afii57723 /vavdagesh /afii57793 /hiriq
- /afii57794 /tsere /afii57795 /segol
- /afii57796 /qubuts /afii57797 /qamats
- /afii57798 /patah /afii57799 /sheva
- /afii57800 /hatafpatah /afii57801 /hatafsegol
- /afii57802 /hatafqamats /afii57803 /sindothebrew
- /afii57804 /shindothebrew /afii57806 /holam
- /afii57807 /dagesh /afii57839 /siluqhebrew
- /afii57841 /rafe /afii57842 /paseqhebrew
- /afii57929 /apostrophemod /afii61248 /careof
- /afii61289 /lsquare /afii61352 /numero
- /afii61664 /zerowidthnonjoiner /afii63167 /asteriskarabic
- /afii64937 /commareversedmod /alefmaksurainitialarabic /yehinitialarabic
- /alefmaksuramedialarabic /yehmedialarabic /approximatelyequal /congruent
- /arrowdblboth /dblarrowleft /arrowdblleft /arrowleftdbl
- /arrowdblright /dblarrowright /arrowupdnbse /arrowupdownbase
- /bar /verticalbar /betdagesh /betdageshhebrew
- /blackdownpointingtriangle /triagdn /blackleftpointingpointer /triaglf
- /blackrectangle /filledrect /blackrightpointingpointer /triagrt
- /blacksmilingface /invsmileface /blacksquare /filledbox
- /blackuppointingtriangle /triagup /bulletinverse /invbullet
- /cdot /cdotaccent /circle /whitecircle
- /circlemultiply /timescircle /circleplus /pluscircle
- /club /clubsuitblack /colonmonetary /colonsign
- /compass /sun /daletdagesh /daletdageshhebrew
- /dargahebrew /dargalefthebrew /dbllowline /underscoredbl
- /dcroat /dmacron /decimalseparatorarabic /decimalseparatorpersian
- /dialytikatonos /dieresistonos /dkshade /shadedark
- /dotbelowcmb /dotbelowcomb /edot /edotaccent
- /eighthnotebeamed /musicalnotedbl /etnahtafoukhhebrew /etnahtahebrew
- /existential /thereexists /female /venus
- /finalkafdagesh /finalkafdageshhebrew /forall /universal
- /gcedilla /gcommaaccent /gdot /gdotaccent
- /gimeldagesh /gimeldageshhebrew /gradient /nabla
- /gravecmb /gravecomb /haaltonearabic /hehaltonearabic
- /heart /heartsuitblack /hedagesh /hedageshhebrew
- /hehfinalalttwoarabic /hehfinalarabic /hookabovecomb /hookcmb
- /ilde /tilde /integralbottom /integralbt
- /integraltop /integraltp /invcircle /whitecircleinverse
- /kafdagesh /kafdageshhebrew /kcedilla /kcommaaccent
- /lameddagesh /lameddageshhebrew /lcedilla /lcommaaccent
- /ldot /ldotaccent /logicalnotreversed /revlogicalnot
- /longs /slong /ltshade /shadelight
- /macron /overscore /mahapakhhebrew /mahapakhlefthebrew
- /male /mars /memdagesh /memdageshhebrew
- /merkhahebrew /merkhalefthebrew /merkhakefulahebrew /merkhakefulalefthebrew
- /middot /periodcentered /mu /mu1
- /munahhebrew /munahlefthebrew /napostrophe /quoterightn
- /nbspace /nonbreakingspace /ncedilla /ncommaaccent
- /notelement /notelementof /nundagesh /nundageshhebrew
- /odblacute /ohungarumlaut /omega1 /pisymbolgreek
- /openbullet /whitebullet /orthogonal /rightangle
- /oslashacute /ostrokeacute /pedagesh /pedageshhebrew
- /phi1 /phisymbolgreek /propersubset /subset
- /propersuperset /superset /qofdagesh /qofdageshhebrew
- /quoteleftreversed /quotereversed /rcedilla /rcommaaccent
- /reflexsubset /subsetorequal /reflexsuperset /supersetorequal
- /reviahebrew /reviamugrashhebrew /samekhdagesh /samekhdageshhebrew
- /sfthyphen /softhyphen /shade /shademedium
- /sheqel /sheqelhebrew /shindagesh /shindageshhebrew
- /shindageshshindot /shindageshshindothebrew /shindageshsindot /shindageshsindothebrew
- /sigma1 /sigmafinal /similar /tildeoperator
- /smileface /whitesmilingface /space /spacehackarabic
- /spade /spadesuitblack /tavdages /tavdagesh
- /tcedilla /tcommaaccent /tetdagesh /tetdageshhebrew
- /tevirhebrew /tevirlefthebrew /theta1 /thetasymbolgreek
- /thousandsseparatorarabic /thousandsseparatorpersian /tildecmb /tildecomb
- /tipehahebrew /tipehalefthebrew /tsadidagesh /tsadidageshhebrew
- /twodotenleader /twodotleader /udblacute /uhungarumlaut
- /yerahbenyomohebrew /yerahbenyomolefthebrew /yoddagesh /yoddageshhebrew
- /zayindagesh /zayindageshhebrew /zdot /zdotaccent
+ /Acyrillic /afii10017 /Becyrillic /afii10018
+ /Cdot /Cdotaccent /Checyrillic /afii10041
+ /Dcroat /Dslash /Decyrillic /afii10021
+ /Delta /increment /Djecyrillic /afii10051
+ /Dzecyrillic /afii10054 /Dzhecyrillic /afii10145
+ /Ecyrillic /afii10053 /Edot /Edotaccent
+ /Efcyrillic /afii10038 /Elcyrillic /afii10029
+ /Emcyrillic /afii10030 /Encyrillic /afii10031
+ /Ercyrillic /afii10034 /Ereversedcyrillic /afii10047
+ /Escyrillic /afii10035 /Euro /euro
+ /Fitacyrillic /afii10147 /Gcedilla /Gcommaaccent
+ /Gdot /Gdotaccent /Gecyrillic /afii10020
+ /Gheupturncyrillic /afii10050 /Gjecyrillic /afii10052
+ /H18533 /blackcircle /H18543 /blacksmallsquare
+ /H18551 /whitesmallsquare /H22073 /whitesquare
+ /Hardsigncyrillic /afii10044 /IAcyrillic /afii10049
+ /IUcyrillic /afii10048 /Icyrillic /afii10055
+ /Idot /Idotaccent /Iecyrillic /afii10022
+ /Iicyrillic /afii10026 /Iishortcyrillic /afii10027
+ /Iocyrillic /afii10023 /Izhitsacyrillic /afii10148
+ /Jecyrillic /afii10057 /Kacyrillic /afii10028
+ /Kcedilla /Kcommaaccent /Khacyrillic /afii10039
+ /Kjecyrillic /afii10061 /Lcedilla /Lcommaaccent
+ /Ldot /Ldotaccent /Ljecyrillic /afii10058
+ /Ncedilla /Ncommaaccent /Njecyrillic /afii10059
+ /Ocyrillic /afii10032 /Odblacute /Ohungarumlaut
+ /Ohm /Omega /Oslashacute /Ostrokeacute
+ /Pecyrillic /afii10033 /Rcedilla /Rcommaaccent
+ /Shacyrillic /afii10042 /Shchacyrillic /afii10043
+ /Softsigncyrillic /afii10046 /Tcedilla /Tcommaaccent
+ /Tecyrillic /afii10036 /Tsecyrillic /afii10040
+ /Tshecyrillic /afii10060 /Ucyrillic /afii10037
+ /Udblacute /Uhungarumlaut /Upsilon1 /Upsilonhooksymbol
+ /Ushortcyrillic /afii10062 /Vecyrillic /afii10019
+ /Yatcyrillic /afii10146 /Yericyrillic /afii10045
+ /Yicyrillic /afii10056 /Zdot /Zdotaccent
+ /Zecyrillic /afii10025 /Zhecyrillic /afii10024
+ /acutecmb /acutecomb /acyrillic /afii10065
+ /afii00208 /horizontalbar /afii08941 /lira
+ /afii10066 /becyrillic /afii10067 /vecyrillic
+ /afii10068 /gecyrillic /afii10069 /decyrillic
+ /afii10070 /iecyrillic /afii10071 /iocyrillic
+ /afii10072 /zhecyrillic /afii10073 /zecyrillic
+ /afii10074 /iicyrillic /afii10075 /iishortcyrillic
+ /afii10076 /kacyrillic /afii10077 /elcyrillic
+ /afii10078 /emcyrillic /afii10079 /encyrillic
+ /afii10080 /ocyrillic /afii10081 /pecyrillic
+ /afii10082 /ercyrillic /afii10083 /escyrillic
+ /afii10084 /tecyrillic /afii10085 /ucyrillic
+ /afii10086 /efcyrillic /afii10087 /khacyrillic
+ /afii10088 /tsecyrillic /afii10089 /checyrillic
+ /afii10090 /shacyrillic /afii10091 /shchacyrillic
+ /afii10092 /hardsigncyrillic /afii10093 /yericyrillic
+ /afii10094 /softsigncyrillic /afii10095 /ereversedcyrillic
+ /afii10096 /iucyrillic /afii10097 /iacyrillic
+ /afii10098 /gheupturncyrillic /afii10099 /djecyrillic
+ /afii10100 /gjecyrillic /afii10101 /ecyrillic
+ /afii10102 /dzecyrillic /afii10103 /icyrillic
+ /afii10104 /yicyrillic /afii10105 /jecyrillic
+ /afii10106 /ljecyrillic /afii10107 /njecyrillic
+ /afii10108 /tshecyrillic /afii10109 /kjecyrillic
+ /afii10110 /ushortcyrillic /afii10193 /dzhecyrillic
+ /afii10194 /yatcyrillic /afii10195 /fitacyrillic
+ /afii10196 /izhitsacyrillic /afii10846 /schwacyrillic
+ /afii57381 /percentarabic /afii57388 /commaarabic
+ /afii57392 /zeroarabic /afii57393 /onearabic
+ /afii57394 /twoarabic /afii57395 /threearabic
+ /afii57396 /fourarabic /afii57397 /fivearabic
+ /afii57398 /sixarabic /afii57399 /sevenarabic
+ /afii57400 /eightarabic /afii57401 /ninearabic
+ /afii57403 /semicolonarabic /afii57407 /questionarabic
+ /afii57409 /hamzaarabic /afii57410 /alefmaddaabovearabic
+ /afii57411 /alefhamzaabovearabic /afii57412 /wawhamzaabovearabic
+ /afii57413 /alefhamzabelowarabic /afii57414 /yehhamzaabovearabic
+ /afii57415 /alefarabic /afii57416 /beharabic
+ /afii57417 /tehmarbutaarabic /afii57418 /teharabic
+ /afii57419 /theharabic /afii57420 /jeemarabic
+ /afii57421 /haharabic /afii57422 /khaharabic
+ /afii57423 /dalarabic /afii57424 /thalarabic
+ /afii57425 /reharabic /afii57426 /zainarabic
+ /afii57427 /seenarabic /afii57428 /sheenarabic
+ /afii57429 /sadarabic /afii57430 /dadarabic
+ /afii57431 /taharabic /afii57432 /zaharabic
+ /afii57433 /ainarabic /afii57434 /ghainarabic
+ /afii57440 /tatweelarabic /afii57441 /feharabic
+ /afii57442 /qafarabic /afii57443 /kafarabic
+ /afii57444 /lamarabic /afii57445 /meemarabic
+ /afii57446 /noonarabic /afii57448 /wawarabic
+ /afii57449 /alefmaksuraarabic /afii57450 /yeharabic
+ /afii57451 /fathatanarabic /afii57452 /dammatanarabic
+ /afii57453 /kasratanarabic /afii57454 /fathaarabic
+ /afii57455 /dammaarabic /afii57456 /kasraarabic
+ /afii57457 /shaddaarabic /afii57458 /sukunarabic
+ /afii57470 /heharabic /afii57505 /veharabic
+ /afii57506 /peharabic /afii57507 /tcheharabic
+ /afii57508 /jeharabic /afii57509 /gafarabic
+ /afii57511 /tteharabic /afii57512 /ddalarabic
+ /afii57513 /rreharabic /afii57514 /noonghunnaarabic
+ /afii57519 /yehbarreearabic /afii57636 /newsheqelsign
+ /afii57645 /maqafhebrew /afii57658 /sofpasuqhebrew
+ /afii57664 /alef /afii57665 /bet
+ /afii57666 /gimel /afii57667 /dalet
+ /afii57668 /he /afii57669 /vav
+ /afii57670 /zayin /afii57671 /het
+ /afii57672 /tet /afii57673 /yod
+ /afii57674 /finalkaf /afii57675 /kaf
+ /afii57676 /lamed /afii57677 /finalmem
+ /afii57678 /mem /afii57679 /finalnun
+ /afii57680 /nun /afii57681 /samekh
+ /afii57682 /ayin /afii57683 /finalpe
+ /afii57684 /pe /afii57685 /finaltsadi
+ /afii57686 /tsadi /afii57687 /qof
+ /afii57688 /resh /afii57689 /shin
+ /afii57690 /tav /afii57694 /shinshindot
+ /afii57695 /shinsindot /afii57700 /vavholam
+ /afii57705 /doubleyodpatah /afii57716 /vavvavhebrew
+ /afii57717 /vavyodhebrew /afii57718 /yodyodhebrew
+ /afii57723 /vavdagesh /afii57793 /hiriq
+ /afii57794 /tsere /afii57795 /segol
+ /afii57796 /qubuts /afii57797 /qamats
+ /afii57798 /patah /afii57799 /sheva
+ /afii57800 /hatafpatah /afii57801 /hatafsegol
+ /afii57802 /hatafqamats /afii57803 /sindothebrew
+ /afii57804 /shindothebrew /afii57806 /holam
+ /afii57807 /dagesh /afii57839 /siluqhebrew
+ /afii57841 /rafe /afii57842 /paseqhebrew
+ /afii57929 /apostrophemod /afii61248 /careof
+ /afii61289 /lsquare /afii61352 /numero
+ /afii61664 /zerowidthnonjoiner /afii63167 /asteriskarabic
+ /afii64937 /commareversedmod /alefmaksurainitialarabic /yehinitialarabic
+ /alefmaksuramedialarabic /yehmedialarabic /approximatelyequal /congruent
+ /arrowdblboth /dblarrowleft /arrowdblleft /arrowleftdbl
+ /arrowdblright /dblarrowright /arrowupdnbse /arrowupdownbase
+ /bar /verticalbar /betdagesh /betdageshhebrew
+ /blackdownpointingtriangle /triagdn /blackleftpointingpointer /triaglf
+ /blackrectangle /filledrect /blackrightpointingpointer /triagrt
+ /blacksmilingface /invsmileface /blacksquare /filledbox
+ /blackuppointingtriangle /triagup /bulletinverse /invbullet
+ /cdot /cdotaccent /circle /whitecircle
+ /circlemultiply /timescircle /circleplus /pluscircle
+ /club /clubsuitblack /colonmonetary /colonsign
+ /compass /sun /daletdagesh /daletdageshhebrew
+ /dargahebrew /dargalefthebrew /dbllowline /underscoredbl
+ /dcroat /dmacron /decimalseparatorarabic /decimalseparatorpersian
+ /dialytikatonos /dieresistonos /dkshade /shadedark
+ /dotbelowcmb /dotbelowcomb /edot /edotaccent
+ /eighthnotebeamed /musicalnotedbl /etnahtafoukhhebrew /etnahtahebrew
+ /existential /thereexists /female /venus
+ /finalkafdagesh /finalkafdageshhebrew /forall /universal
+ /gcedilla /gcommaaccent /gdot /gdotaccent
+ /gimeldagesh /gimeldageshhebrew /gradient /nabla
+ /gravecmb /gravecomb /haaltonearabic /hehaltonearabic
+ /heart /heartsuitblack /hedagesh /hedageshhebrew
+ /hehfinalalttwoarabic /hehfinalarabic /hookabovecomb /hookcmb
+ /ilde /tilde /integralbottom /integralbt
+ /integraltop /integraltp /invcircle /whitecircleinverse
+ /kafdagesh /kafdageshhebrew /kcedilla /kcommaaccent
+ /lameddagesh /lameddageshhebrew /lcedilla /lcommaaccent
+ /ldot /ldotaccent /logicalnotreversed /revlogicalnot
+ /longs /slong /ltshade /shadelight
+ /macron /overscore /mahapakhhebrew /mahapakhlefthebrew
+ /male /mars /memdagesh /memdageshhebrew
+ /merkhahebrew /merkhalefthebrew /merkhakefulahebrew /merkhakefulalefthebrew
+ /middot /periodcentered /mu /mu1
+ /munahhebrew /munahlefthebrew /napostrophe /quoterightn
+ /nbspace /nonbreakingspace /ncedilla /ncommaaccent
+ /notelement /notelementof /nundagesh /nundageshhebrew
+ /odblacute /ohungarumlaut /omega1 /pisymbolgreek
+ /openbullet /whitebullet /orthogonal /rightangle
+ /oslashacute /ostrokeacute /pedagesh /pedageshhebrew
+ /phi1 /phisymbolgreek /propersubset /subset
+ /propersuperset /superset /qofdagesh /qofdageshhebrew
+ /quoteleftreversed /quotereversed /rcedilla /rcommaaccent
+ /reflexsubset /subsetorequal /reflexsuperset /supersetorequal
+ /reviahebrew /reviamugrashhebrew /samekhdagesh /samekhdageshhebrew
+ /sfthyphen /softhyphen /shade /shademedium
+ /sheqel /sheqelhebrew /shindagesh /shindageshhebrew
+ /shindageshshindot /shindageshshindothebrew /shindageshsindot /shindageshsindothebrew
+ /sigma1 /sigmafinal /similar /tildeoperator
+ /smileface /whitesmilingface /space /spacehackarabic
+ /spade /spadesuitblack /tavdages /tavdagesh
+ /tcedilla /tcommaaccent /tetdagesh /tetdageshhebrew
+ /tevirhebrew /tevirlefthebrew /theta1 /thetasymbolgreek
+ /thousandsseparatorarabic /thousandsseparatorpersian /tildecmb /tildecomb
+ /tipehahebrew /tipehalefthebrew /tsadidagesh /tsadidageshhebrew
+ /twodotenleader /twodotleader /udblacute /uhungarumlaut
+ /yerahbenyomohebrew /yerahbenyomolefthebrew /yoddagesh /yoddageshhebrew
+ /zayindagesh /zayindageshhebrew /zdot /zdotaccent
.dicttomark readonly def
% - .charkeys /CharStrings <charstrings> /Encoding <encoding>
@@ -1359,8 +1359,8 @@ mark
TTFDEBUG {
(glyphencoding: length=) print glyphencoding dup length = === flush
} if
- % Hack: if there is no usable post table but the cmap uses
- % the Microsoft Unicode encoding, use ISOLatin1Encoding.
+ % Hack: if there is no usable post table but the cmap uses
+ % the Microsoft Unicode encoding, use ISOLatin1Encoding.
% if 'post' presents, .charkeys computes (with dropping minor details) :
% CharStrings = glyphencoding^-1
% Encoding = cmap*glyphencoding
@@ -1368,7 +1368,7 @@ mark
% Otherwise .charkeys must compute (with dropping same details) :
% CharStrings = glyphencoding^-1 * cmap
% Encoding = glyphencoding
- % because glyphencoding is stubbed with an encoding,
+ % because glyphencoding is stubbed with an encoding,
% which maps char codes to glyph names.
glyphencoding length 0 eq {
/have_post //false def
@@ -1382,8 +1382,8 @@ mark
} {
/have_post //true def
} ifelse
- % If necessary, fabricate additional glyphencoding entries
- % to cover all of loca
+ % If necessary, fabricate additional glyphencoding entries
+ % to cover all of loca
glyphencoding length numloca lt {
/glyphencoding numloca array
glyphencoding length dup 1 sub 0 1 3 2 roll {
@@ -1397,16 +1397,16 @@ mark
def
} if
/cmapa cmaptab cmaparray def
- % Some badly designed Chinese fonts have a post table
- % in which all glyphs other than 0 are named .null.
- % Use CharStrings to keep track of the reverse map from
- % names to glyphs, and don't let any name be used for
- % more than one glyph.
+ % Some badly designed Chinese fonts have a post table
+ % in which all glyphs other than 0 are named .null.
+ % Use CharStrings to keep track of the reverse map from
+ % names to glyphs, and don't let any name be used for
+ % more than one glyph.
/CharStrings glyphencoding dup length 1 add dict % +1 for .notdef
0 1 3 index length 1 sub {
- % Stack: glyphencoding dict index
- 2 index 1 index get
- have_post not {
+ % Stack: glyphencoding dict index
+ 2 index 1 index get
+ have_post not {
exch
cmapa exch .knownget not {
0 % a stub for a while. Must skip the entry.
@@ -1416,15 +1416,15 @@ mark
2 index 1 index known
{ % The same name maps to more than one glyph. Change the name.
% No special treatment for /.notdef glyph. Bug 689408.
- pop dup .nname 3 index 2 index 2 index put
+ pop dup .nname 3 index 2 index 2 index put
2 index exch 3 -1 roll put
} {
2 index exch 3 -1 roll put % unique name
} ifelse
} for exch pop
- % If there is no .notdef entry, map it to glyph 0.
+ % If there is no .notdef entry, map it to glyph 0.
dup /.notdef known not { dup /.notdef 0 put } if
- TTFDEBUG {
+ TTFDEBUG {
(CharStrings:)= dup { exch =string cvs print ( ) print //== exec } forall
} if
//postalias {
@@ -1435,11 +1435,11 @@ mark
pop pop pop % both names known or neither known
} {
% Stack: CharStrings(dict) /name1 /name2 name1_known(bool)
- { exch } if % /name1 known -- we need it on top
+ { exch } if % /name1 known -- we need it on top
% Stack: CharStrings(dict) /alias_name /known_name
TTFDEBUG { (setting alias: ) print 1 index ==only ( to be the same as glyph: ) print dup //== exec } if
2 index exch get 2 index 3 1 roll put
- } ifelse
+ } ifelse
} forall
readonly
/Encoding [
@@ -1490,12 +1490,12 @@ currentdict /postalias undef
/.fill_identity_cmap { % () v
1 index length 2 sub % () v n-2
0 2 3 2 roll { % () v 0 2 n-1
- 3 copy exch % () v i () i v
+ 3 copy exch % () v i () i v
-8 bitshift % () v i () i v>>8
put % () v i
3 copy 1 add % () v i () v i+1
exch 255 and % () v i () i+1 v&255
- put % () v i
+ put % () v i
pop 1 add % () v+1
} for
pop
@@ -1506,14 +1506,14 @@ currentdict /postalias undef
dup begin
/CIDFontName fontname def
/CIDFontType 2 def
- /CIDSystemInfo mark
+ /CIDSystemInfo mark
/Registry (Adobe)
/Ordering (Japan1) % adhoc
/Supplement 0
.dicttomark def
/CharStrings mark /.notdef 0 .dicttomark def
- % The cmap isn't of any use even if it is present.
- % Just construct an identity CIDMap covering all the glyphs.
+ % The cmap isn't of any use even if it is present.
+ % Just construct an identity CIDMap covering all the glyphs.
/CIDCount numloca % Wrong if a CIDFontType2 embedded into PDF with a non-Identity CIDToGIDMap.
def % processCIDToGIDMap may replace.
@@ -1539,12 +1539,12 @@ currentdict /postalias undef
exch
//false 0 .loadttfonttables
.makesfnts
- % CIDFontType2 fonts don't have a cmap: they are indexed by CID.
+ % CIDFontType2 fonts don't have a cmap: they are indexed by CID.
mark
.ttkeys
.dicttomark dup % convert keys to dict and copy dict
3 -1 roll % Bring PDF substitute name to top of stack
-
+
dup
/fontname exch def
/FontName exch put % replace any definition of /FontName
@@ -1565,7 +1565,7 @@ currentdict /postalias undef
/file_table_pos file_table_pos
/Decoding Decoding
.dicttomark
- end end
+ end end
} bind def
% ---------------- PDF TrueType font loading ---------------- %
@@ -1578,17 +1578,17 @@ currentdict /postalias undef
% <plat+enc> .findcmap false
/.findcmap {
//false exch tabdict /cmap get
- % Some fonts have multiple cmaps with the same platform and
- % encoding. Use the first one we find.
+ % Some fonts have multiple cmaps with the same platform and
+ % encoding. Use the first one we find.
0 1 2 index 2 getu16a 1 sub {
- % Stack: false plat+enc cmap index
+ % Stack: false plat+enc cmap index
8 mul 4 add 1 index exch 8 getinterval_from_stringarray
dup 0 4 getinterval 3 index eq {
4 getu32 1 index exch 1 index string_array_size 1 index sub getinterval_from_stringarray
4 -1 roll not 4 2 roll exit
} if pop
} for
- % Stack: false plat+enc cmap || subtable true plat+enc cmap
+ % Stack: false plat+enc cmap || subtable true plat+enc cmap
pop pop
} bind def
@@ -1615,7 +1615,7 @@ currentdict /postalias undef
{
/.GS_extended_SymbolEncoding 256 array
//.symbol_list {
- exch 2 index 3 1 roll put
+ exch 2 index 3 1 roll put
} forall
.defineencoding
} bind exec
@@ -1626,7 +1626,7 @@ currentdict /postalias undef
dup 48 ge exch
dup 57 le exch
dup 65 ge exch
- 70 le and
+ 70 le and
3 1 roll
and or
} bind def
@@ -1636,11 +1636,11 @@ currentdict /postalias undef
/.addglyph { % <dict> <name> <glyph#> .addglyph -
1 index .namestring % d n g s
- dup length 7 eq {
+ dup length 7 eq {
% Bug688467.ps doesn't work if the uniXXXX mapping is allowed with any cmap.
% Allow it with cmap 3.1 only.
- currentdict /.allow_uniXXXX_glyph_names .knownget not { //false } if
- } { //false
+ currentdict /.allow_uniXXXX_glyph_names .knownget not { //false } if
+ } { //false
} ifelse % d n g s b
{
% An undocumented Adobe feature (not sure) :
@@ -1658,7 +1658,7 @@ currentdict /postalias undef
dup 4 1 getinterval .hexdigits exch search pop length exch pop exch pop 8 bitshift exch
dup 5 1 getinterval .hexdigits exch search pop length exch pop exch pop 4 bitshift exch
dup 6 1 getinterval .hexdigits exch search pop length exch pop exch pop exch pop
- add add add
+ add add add
cmapencoding exch .knownget not { 0 } if
dup 0 eq //.popfex if
@@ -1745,7 +1745,7 @@ currentdict /postalias undef
% - .pdfcharkeys /CharStrings <charstrings> /Encoding <encoding>
/.pdfcharkeys {
- % The following algorithms are per the PDF 1.7 Reference.
+ % The following algorithms are per the PDF 1.7 Reference.
TTFDEBUG { (.pdfcharkeys beg) = } if
is_symbolic {
<00030000> .findcmap { //true } { <00010000> .findcmap } ifelse {
@@ -1760,10 +1760,10 @@ currentdict /postalias undef
% prebuilt_encoding otherwise try the 3,0 cmap.
prebuilt_encoding //null ne {
//false prebuilt_encoding { % false means no missing glyphs
- 4 index exch known not { pop //true exit } if
+ 4 index exch known not { pop //true exit } if
} forall
{
- ( **** Warning: Encoding derived from 'post' is incomplete.\n) pdfformaterror
+ ( **** Warning: Encoding derived from 'post' is incomplete.\n) pdfformaterror
} if
} if
} ifelse
@@ -1778,7 +1778,7 @@ currentdict /postalias undef
% is replaced by UCS2 charcode from AdobeGlyphList. Otherwise it is left
% as in /prebuilt_encoding[]. /.pdfmapchars should dredge them.
- /.allow_uniXXXX_glyph_names //true def
+ /.allow_uniXXXX_glyph_names //true def
AdobeGlyphList prebuilt_encoding .invert_encoding dup { % <<AGL>> <<pbe>> <glyphname> <pbecode>
pop % <<AGL>> <<pbe>> <glyphname>
TTFDEBUG { (check glypname /) print dup =only flush } if
@@ -1798,16 +1798,16 @@ currentdict /postalias undef
} {
% Likely this branch is now obsolete.
TTFDEBUG { (Using cmap 3.1 for non-symbolic.) = } if
- AdobeGlyphList .pdfmapchars
+ AdobeGlyphList .pdfmapchars
/Encoding /WinAnsiEncoding .findencoding
- % WinAnsiEncoding is just a stub here.
+ % WinAnsiEncoding is just a stub here.
% It will be replaced with one from font resource,
% because PDF spec requires it.
} ifelse
} {
<00010000> .findcmap {
TTFDEBUG { (Using cmap 1.0 for non-symbolic.) = } if
- .romanmacdict .pdfmapchars
+ .romanmacdict .pdfmapchars
/Encoding
prebuilt_encoding //null ne {
prebuilt_encoding
@@ -1816,7 +1816,7 @@ currentdict /postalias undef
} ifelse
} {
% Apply the default algorithm for using the 'post'.
- .charkeys
+ .charkeys
% But use PDF encoding when available.
prebuilt_encoding //null ne {
pop prebuilt_encoding
diff --git a/gs/Resource/Init/gs_typ32.ps b/gs/Resource/Init/gs_typ32.ps
index 132ea14d2..720f60bd8 100644
--- a/gs/Resource/Init/gs_typ32.ps
+++ b/gs/Resource/Init/gs_typ32.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1997 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -27,30 +27,30 @@ languagelevel dup 2 .max .setlanguagelevel
systemdict /.makeglyph32 .undef
/addglyph { % ([wx wy llx lly urx ury] |
- % [w0x w0y llx lly urx ury w1x w1y vx vy])
- % <bitmap> <cid> <type32font> addglyph -
+ % [w0x w0y llx lly urx ury w1x w1y vx vy])
+ % <bitmap> <cid> <type32font> addglyph -
1 index dup 2 index .removeglyphs
22 string .makeglyph32
- % Stack: metrics bitmap cid font metstr
+ % Stack: metrics bitmap cid font metstr
3 index () ne {
- % Use G4 encoding to compress the bitmap.
- % Define a string large enough to hold the metrics,
- % an uncompressed bitmap (worst case = 5x expansion),
- % and the 2 RTC codes (3 bytes).
+ % Use G4 encoding to compress the bitmap.
+ % Define a string large enough to hold the metrics,
+ % an uncompressed bitmap (worst case = 5x expansion),
+ % and the 2 RTC codes (3 bytes).
dup length 4 index length 5 mul add 10 add
65535 .min string
- % Stack: metrics bitmap cid font metstr buffer
+ % Stack: metrics bitmap cid font metstr buffer
dup 0 3 index putinterval
dup 2 index length 1 index length 1 index sub getinterval
- % Stack: metrics bitmap cid font metstr buffer bitbuf
+ % Stack: metrics bitmap cid font metstr buffer bitbuf
mark /Columns 8 index dup 4 get exch 2 get sub
/Rows 10 index dup 5 get exch 3 get sub
/K -1 /EndOfBlock //true /BlackIs1 //true
.dicttomark /CCITTFaxEncode filter
- % Stack: metrics bitmap cid font metstr buffer filter
+ % Stack: metrics bitmap cid font metstr buffer filter
dup 6 index writestring closefile
- % Find the end of the data by scanning backwards for the RTC.
- % There are 2 RTCs x 12 bits = 3 bytes to remove.
+ % Find the end of the data by scanning backwards for the RTC.
+ % There are 2 RTCs x 12 bits = 3 bytes to remove.
{
dup dup length 1 sub get 0 ne { exit } if
0 1 index length 1 sub getinterval
@@ -72,7 +72,7 @@ systemdict /.removeglyphs .undef
/removeglyphs { % <cid_min> <cid_max> <type32font> .removeglyphs -
3 copy .removeglyphs
dup /CharStrings get dup {
- % Stack: cidmin cidmax font CharStrings cid bitmap
+ % Stack: cidmin cidmax font CharStrings cid bitmap
pop dup 5 index ge { dup 4 index le { 2 copy undef } if } if pop
} forall pop pop pop pop
} obind
@@ -95,7 +95,7 @@ end % .cidfonttypes
% The name %Type32BuildGlyph is known to the interpreter.
(%Type32BuildGlyph) cvn { % <font> <cid> %Type32BuildGlyph -
1 index /CharStrings get
- % Stack: font cid CharStrings
+ % Stack: font cid CharStrings
dup 2 index .knownget {
exch pop
} {
@@ -104,22 +104,22 @@ end % .cidfonttypes
.getshowoperator /invalidfont signalerror
} if
} ifelse
- % Stack: font cid cstr
+ % Stack: font cid cstr
dup //.getmetrics32 % use // because of .undef below
dup 14 gt {
8 index 8 index 13 3 roll setcachedevice2
} {
4 index 4 index 9 3 roll setcachedevice
} ifelse
- % Stack: font cid cstr w h nmetrics llx lly
+ % Stack: font cid cstr w h nmetrics llx lly
6 -1 roll 4 -1 roll 1 index length 1 index sub getinterval
- % Stack: font cid w h llx lly bitstr
+ % Stack: font cid w h llx lly bitstr
dup () eq {
pop pop pop
} {
mark /Columns 6 index /Rows 7 index /K -1 /EndOfBlock //false /BlackIs1 //true
.dicttomark /CCITTFaxDecode filter 4 index 4 index //true
- % Stack: font cid w h llx lly filter w h //true
+ % Stack: font cid w h llx lly filter w h //true
[ 1 0 0 1 11 -2 roll exch neg exch neg ] 5 -1 roll imagemask
} ifelse
pop pop pop pop
diff --git a/gs/Resource/Init/gs_typ42.ps b/gs/Resource/Init/gs_typ42.ps
index 13eb3794f..51f6f7148 100644
--- a/gs/Resource/Init/gs_typ42.ps
+++ b/gs/Resource/Init/gs_typ42.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -32,11 +32,11 @@
dup CharStrings exch .knownget not
{ 2 copy eq { exch pop /.notdef exch } if
QUIET not
- { (Substituting .notdef for ) print
- =string cvs print ( in the font ) print
- 1 index /FontName get = flush
- }
- { pop }
+ { (Substituting .notdef for ) print
+ =string cvs print ( in the font ) print
+ 1 index /FontName get = flush
+ }
+ { pop }
ifelse
/.notdef CharStrings /.notdef get
} if
@@ -44,19 +44,17 @@
} bind def
% Register the font type for definefont.
-buildfontdict 42
+buildfontdict 42
{ % check for bogus sfnts -- this happens in Genoa FTS 421-01.ps
dup /sfnts get 0 get length 14 lt { % smallest valid sfnts is 14 bytes
% HACK: Add a BuildGlyph and make this a Type 3 font instead
dup /FontType 3 put
dup /BuildGlyph {
- 1 index /CharStrings get exch 2 copy known not { pop /.notdef } if get exec
+ 1 index /CharStrings get exch 2 copy known not { pop /.notdef } if get exec
} bind put
//.buildfont3 exec
} {
systemdict /.buildfont42 get exec
} ifelse
- } bind
+ } bind
put
-
-
diff --git a/gs/Resource/Init/gs_type1.ps b/gs/Resource/Init/gs_type1.ps
index 49b4bca7d..6d3f5c33f 100644
--- a/gs/Resource/Init/gs_type1.ps
+++ b/gs/Resource/Init/gs_type1.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -75,7 +75,7 @@
} {
pop pop
} ifelse
- } ifelse
+ } ifelse
} forall
pop pop pop
@@ -91,16 +91,16 @@ ifelse
/.loadfontfile % <file> .loadfontfile -
{ mark exch
DISKFONTS { .loadfontdict begin } if
- % In order to load fonts reliably, we should push systemdict
- % here. However, Ed Taft says that Adobe implementations
- % push userdict and nothing else!
- % We really would just like systemdict on the stack,
- % but fonts produced by Fontographer require a writable dictionary.
- % However, we can't use any of the other well-known dictionaries
- % (such as userdict), since the whole point of pushing systemdict
- % is to make sure that nothing important has been redefined.
+ % In order to load fonts reliably, we should push systemdict
+ % here. However, Ed Taft says that Adobe implementations
+ % push userdict and nothing else!
+ % We really would just like systemdict on the stack,
+ % but fonts produced by Fontographer require a writable dictionary.
+ % However, we can't use any of the other well-known dictionaries
+ % (such as userdict), since the whole point of pushing systemdict
+ % is to make sure that nothing important has been redefined.
/userdict .systemvar begin
- % We can't just use `run', because we want to check for .PFB files.
+ % We can't just use `run', because we want to check for .PFB files.
currentpacking
{ //false setpacking .loadfont1 //true setpacking }
{ .loadfont1 }
@@ -115,25 +115,25 @@ ifelse
.dicttomark readonly def
/.loadfont1 { % <file> .loadfont1 <errorflag>
{ % We would like to use `false /PFBDecode filter',
- % but this occasionally produces a whitespace character as
- % the first of an eexec section, so we can't do it.
- % Also, since the real input file never reaches EOF if we are using
- % a PFBDecode filter (the filter stops just after reading the last
- % character), we must explicitly close the real file in this case.
- % Since the file might leave garbage on the operand stack,
- % we have to create a procedure to close the file reliably.
+ % but this occasionally produces a whitespace character as
+ % the first of an eexec section, so we can't do it.
+ % Also, since the real input file never reaches EOF if we are using
+ % a PFBDecode filter (the filter stops just after reading the last
+ % character), we must explicitly close the real file in this case.
+ % Since the file might leave garbage on the operand stack,
+ % we have to create a procedure to close the file reliably.
dup read not { -1 } if
2 copy unread 16#80 eq {
- dup //closesourcedict //true /PFBDecode filter cvx
- exch .currentresourcefile eq {
- dup /.execasresource .systemvar
- } {
- {exec}
- } ifelse
- 2 index cvlit
- /closefile .systemvar 3 .execn
+ dup //closesourcedict //true /PFBDecode filter cvx
+ exch .currentresourcefile eq {
+ dup /.execasresource .systemvar
+ } {
+ {exec}
+ } ifelse
+ 2 index cvlit
+ /closefile .systemvar 3 .execn
} {
- cvx exec
+ cvx exec
} ifelse
} stopped
} bind def
@@ -153,16 +153,16 @@ currentdict /closesourcedict .undef
} bind def
% Note: this procedure is used for both Type 1 and Type 2 fonts.
/.type1build { % <font> <code|name> <name> .type1build
- % <font> <code|name> <name> <charstring>
+ % <font> <code|name> <name> <charstring>
2 index begin
dup CharStrings exch .knownget not {
2 copy eq { exch pop /.notdef exch } if
QUIET not
- { (Substituting .notdef for ) print
- =string cvs print ( in the font ) print
- 1 index /FontName get = flush
- }
- { pop }
+ { (Substituting .notdef for ) print
+ =string cvs print ( in the font ) print
+ 1 index /FontName get = flush
+ }
+ { pop }
ifelse
/.notdef CharStrings /.notdef get
} if
@@ -176,21 +176,21 @@ currentdict /closesourcedict .undef
% a Type 1 font on the fly, since we aren't currently prepared to parse the
% dictionary any other way.
/CCRun { % <font> <code|name> <charstring> CCRun -
- % <font> <code|name> <charstring> <Private> CCRun -
+ % <font> <code|name> <charstring> <Private> CCRun -
dup type /dicttype eq {
dup 4 index /Private .knownget { ne } { pop //true } ifelse {
- % The Private dictionary was supplied, and is different
- % from the Private dictionary of the font. Fabricate a
- % Type 1 font with this Private dictionary. Most of the
- % font entries are arbitrary or not needed.
+ % The Private dictionary was supplied, and is different
+ % from the Private dictionary of the font. Fabricate a
+ % Type 1 font with this Private dictionary. Most of the
+ % font entries are arbitrary or not needed.
.currentglobal //false .setglobal 10 dict exch .setglobal begin
- /Private exch def
- /FontType 1 def
- /FontMatrix 3 index /FontMatrix get def
- /Encoding 3 index /Encoding .knownget not { StandardEncoding } if def
- /FontBBox 3 index /FontBBox .knownget not { {0 0 0 0} } if def
- /PaintType 0 def
- /CharStrings 1 dict dup /.notdef () put def
+ /Private exch def
+ /FontType 1 def
+ /FontMatrix 3 index /FontMatrix get def
+ /Encoding 3 index /Encoding .knownget not { StandardEncoding } if def
+ /FontBBox 3 index /FontBBox .knownget not { {0 0 0 0} } if def
+ /PaintType 0 def
+ /CharStrings 1 dict dup /.notdef () put def
3 -1 roll pop () currentdict end .buildfont1 exch pop 3 1 roll
} {
pop
@@ -216,7 +216,7 @@ currentdict /closesourcedict .undef
} if
2 copy /WeightVector exch .forceput
.setweightvector
-} .bind executeonly def
+} .bind executeonly def
end
% Register the font types for definefont.
diff --git a/gs/Resource/Init/gs_wan_e.ps b/gs/Resource/Init/gs_wan_e.ps
index c1ba17111..6a8b27f32 100644
--- a/gs/Resource/Init/gs_wan_e.ps
+++ b/gs/Resource/Init/gs_wan_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1996, 1997, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -29,16 +29,16 @@ ISOLatin1Encoding 46 50 getinterval aload pop
ISOLatin1Encoding 97 30 getinterval aload pop
/bullet
% \20x
- % NOTE: /Euro, /Zcaron, and /zcaron are new for PDF 1.3.
- % We may have to take them out for backward compatibility.
+ % NOTE: /Euro, /Zcaron, and /zcaron are new for PDF 1.3.
+ % We may have to take them out for backward compatibility.
/Euro /bullet /quotesinglbase /florin
- /quotedblbase /ellipsis /dagger /daggerdbl
+ /quotedblbase /ellipsis /dagger /daggerdbl
/circumflex /perthousand /Scaron /guilsinglleft
- /OE /bullet /Zcaron /bullet
+ /OE /bullet /Zcaron /bullet
/bullet /quoteleft /quoteright /quotedblleft
- /quotedblright /bullet /endash /emdash
+ /quotedblright /bullet /endash /emdash
/tilde /trademark /scaron /guilsinglright
- /oe /bullet /zcaron /Ydieresis
+ /oe /bullet /zcaron /Ydieresis
ISOLatin1Encoding 160 96 getinterval aload pop
256 packedarray
4 1 index .registerencoding
diff --git a/gs/Resource/Init/pdf_base.ps b/gs/Resource/Init/pdf_base.ps
index 9cb830d67..22b52cae7 100644
--- a/gs/Resource/Init/pdf_base.ps
+++ b/gs/Resource/Init/pdf_base.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994-2006 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -86,7 +86,7 @@ pdfdict begin
/name#escape % <post> <(#)> <pre> name#escape <string>
{ exch pop
1 index 2 () /SubFileDecode filter dup (x) readhexstring
- % Stack: post pre stream char t/f
+ % Stack: post pre stream char t/f
not { % tolerate, but complain about bad syntax
pop closefile (#) concatstrings exch
( **** Warning: Invalid hex following '#' name escape, using literal '#' in name.\n)
@@ -104,7 +104,7 @@ pdfdict begin
/.pdftokenerror { % <count> <opdict> <errtoken> .pdftokenerror -
BXlevel 0 le {
( **** Unknown operator: ') pdfformaterror
- dup =string cvs pdfformaterror
+ dup =string cvs pdfformaterror
% Attempt a retry scan of the element after changing to PDFScanInvNum
<< /PDFScanInvNum //true >> setuserparams
=string cvs
@@ -133,20 +133,20 @@ pdfdict begin
PDFSTEP {
pdfdict /PDFtokencount 2 copy .knownget { 1 add } { 1 } ifelse .forceput
PDFSTEPcount 1 gt {
- pdfdict /PDFSTEPcount PDFSTEPcount 1 sub .forceput
+ pdfdict /PDFSTEPcount PDFSTEPcount 1 sub .forceput
} {
dup ==only
- ( step # ) print PDFtokencount =only
- ( ? ) print flush 1 //false .outputpage
- (%stdin) (r) file 255 string readline {
- token {
+ ( step # ) print PDFtokencount =only
+ ( ? ) print flush 1 //false .outputpage
+ (%stdin) (r) file 255 string readline {
+ token {
exch pop pdfdict /PDFSTEPcount 3 -1 roll .forceput
- } {
- pdfdict /PDFSTEPcount 1 .forceput
- } ifelse % token
- } {
- pop /PDFSTEP //false def % EOF on stdin
- } ifelse % readline
+ } {
+ pdfdict /PDFSTEPcount 1 .forceput
+ } ifelse % token
+ } {
+ pop /PDFSTEP //false def % EOF on stdin
+ } ifelse % readline
} ifelse % PDFSTEPcount > 1
} {
dup ==only () = flush
@@ -155,14 +155,14 @@ pdfdict begin
2 copy .knownget {
exch pop exch pop exch pop exec
} {
- % Normally, true, false, and null would appear in opdict
- % and be treated as "operators". However, there is a
- % special fast case in the PostScript interpreter for names
- % that are defined in, and only in, systemdict and/or
- % userdict: putting these three names in the PDF dictionaries
- % destroys this property for them, slowing down their
- % interpretation in all PostScript code. Therefore, we
- % check for them explicitly here instead.
+ % Normally, true, false, and null would appear in opdict
+ % and be treated as "operators". However, there is a
+ % special fast case in the PostScript interpreter for names
+ % that are defined in, and only in, systemdict and/or
+ % userdict: putting these three names in the PDF dictionaries
+ % destroys this property for them, slowing down their
+ % interpretation in all PostScript code. Therefore, we
+ % check for them explicitly here instead.
dup dup dup /true eq exch /false eq or exch /null eq or {
exch pop exch pop //systemdict exch get
} {
@@ -180,8 +180,8 @@ pdfdict begin
/PDFScanRules_true << /PDFScanRules //true >> def
/PDFScanRules_null << /PDFScanRules //null >> def
/.pdfrun { % <file> <opdict> .pdfrun -
- % Construct a procedure with the stack depth, file and opdict
- % bound into it.
+ % Construct a procedure with the stack depth, file and opdict
+ % bound into it.
1 index cvlit count 2 sub 3 1 roll mark
/PDFScanRules .getuserparam //null eq {
//PDFScanRules_true { setuserparams } 0 get % force PDF scanning mode
@@ -197,18 +197,18 @@ pdfdict begin
//false
} if {
dup type /nametype eq {
- dup xcheck {
- .pdfexectoken
- } {
- .pdffixname
- exch pop exch pop PDFDEBUG {
+ dup xcheck {
+ .pdfexectoken
+ } {
+ .pdffixname
+ exch pop exch pop PDFDEBUG {
PDFSTEPcount 1 le {
dup ==only ( ) print flush
} if
} if
- } ifelse
+ } ifelse
} {
- exch pop exch pop PDFDEBUG {
+ exch pop exch pop PDFDEBUG {
PDFSTEPcount 1 le {
dup ==only ( ) print flush
} if
@@ -264,8 +264,8 @@ pdfdict begin
.dicttomark def
/token_nofail { % <file|string> token_nofail false
- % <file> token_nofail <token> true
- % <string> token_nofail <post> <token> true
+ % <file> token_nofail <token> true
+ % <string> token_nofail <post> <token> true
dup type /filetype eq {
{ dup ( ) .peekstring not { ({) } if
//token_nofail_dict exch .knownget not {
@@ -330,10 +330,10 @@ currentdict /token_nofail_dict .undef
} bind def
/lgrowto { % <lseq> <newlength> lgrowto <lseq'>
dup //lsubmask add //lnshift bitshift dup 3 index length gt {
- % Add more sub-arrays. Start by completing the last existing one.
- % Stack: lseq newlen newtoplen
+ % Add more sub-arrays. Start by completing the last existing one.
+ % Stack: lseq newlen newtoplen
3 -1 roll dup llength 1 sub //lsubmask or 1 add lgrowto
- % Stack: newlen newtoplen lseq
+ % Stack: newlen newtoplen lseq
[ exch aload pop
counttomark 2 add -1 roll % newtoplen
counttomark sub { dup 0 0 getinterval lsublen growto } repeat
@@ -341,10 +341,10 @@ currentdict /token_nofail_dict .undef
} {
pop
} ifelse
- % Expand the last sub-array.
+ % Expand the last sub-array.
1 sub //lsubmask and 1 add
exch dup dup length 1 sub 2 copy
- % Stack: newsublen lseq lseq len-1 lseq len-1
+ % Stack: newsublen lseq lseq len-1 lseq len-1
get 5 -1 roll growto put
} bind def
/lforall { % <lseq> <proc> lforall -
@@ -416,16 +416,16 @@ currentdict /token_nofail_dict .undef
% (see below), we need both an xcheck and a type check to determine
% whether an object has been resolved.
/resolved? { % <object#> resolved? <value> true
- % <object#> resolved? false
+ % <object#> resolved? false
Objects 1 index lget dup xcheck { % Check if executable
dup type /integertype eq { % Check if an integer
- % Check whether the object is in GlobalObjects.
+ % Check whether the object is in GlobalObjects.
pop IsGlobal 1 index lget 0 eq { % 0 --> Not in GlabalObjects
- pop //false % The object is not resolved
+ pop //false % The object is not resolved
} { % The object is in GlobalObjects
- % Update Objects from GlobalObjects
- PDFDEBUG { (%Global=>local: ) print dup //== exec } if
- GlobalObjects 1 index get dup Objects 4 1 roll lput //true
+ % Update Objects from GlobalObjects
+ PDFDEBUG { (%Global=>local: ) print dup //== exec } if
+ GlobalObjects 1 index get dup Objects 4 1 roll lput //true
} ifelse
} { % Else object is executable but not integer
exch pop //true % Therefore must be executable dict. (stream)
@@ -436,10 +436,10 @@ currentdict /token_nofail_dict .undef
} bind def
/oforce /exec load def
/oget { % <array> <index> oget <object>
- % <dict> <key> oget <object>
- % Before release 6.20, this procedure stored the resolved
- % object back into the referring slot. In order to support
- % PDF linearization, we no longer do this.
+ % <dict> <key> oget <object>
+ % Before release 6.20, this procedure stored the resolved
+ % object back into the referring slot. In order to support
+ % PDF linearization, we no longer do this.
get oforce
} bind def
@@ -452,20 +452,20 @@ currentdict /token_nofail_dict .undef
} bind def
/oforce_recursive { % <any> oforce_recursive <any>
- dup type dup /arraytype eq exch /packedarraytype eq or {
+ dup type dup /arraytype eq exch /packedarraytype eq or {
dup rcheck { % protect tint transform functions, etc.
oforce % but dereference {1 0 R}
dup type dup /arraytype eq exch /packedarraytype eq or {
[ exch { oforce_recursive } forall ]
} {
dup type /dicttype eq {
- << exch { oforce_recursive exch oforce exch } forall >>
+ << exch { oforce_recursive exch oforce exch } forall >>
} if
} ifelse
} if
} {
dup type /dicttype eq {
- << exch { oforce_recursive exch oforce exch } forall >>
+ << exch { oforce_recursive exch oforce exch } forall >>
} if
} ifelse
} bind def
@@ -473,8 +473,8 @@ currentdict /token_nofail_dict .undef
% A null value in a dictionary is equivalent to an omitted key;
% we must check for this specially.
/knownoget { % <dict> <key> knownoget <value> true
- % <dict> <key> knownoget false
- % See oget above regarding this procedure.
+ % <dict> <key> knownoget false
+ % See oget above regarding this procedure.
.knownget {
oforce dup //null eq { pop //false } { //true } ifelse
} {
@@ -487,19 +487,17 @@ currentdict /token_nofail_dict .undef
.knownget { oforce //null ne } { //false } ifelse
} bind def
-
/knownogetdict { % <dict> <key> knownogetdict <dict> true
- % <dict> <key> knownogetdict false
+ % <dict> <key> knownogetdict false
//knownoget exec dup {
1 index type /dicttype ne { pop pop //false } if
} if
} bind def
-
% PDF 1.1 defines a 'foreign file reference', but not its meaning.
% Per the specification, we convert these to nulls.
/F { % <file#> <object#> <generation#> F <object>
- % Some PDF 1.1 files use F as a synonym for f!
+ % Some PDF 1.1 files use F as a synonym for f!
.pdfcount 3 lt { f } { pop pop pop //null } ifelse
} bind def
@@ -512,15 +510,15 @@ currentdict /token_nofail_dict .undef
} { % Else not a match ...
QUIET not { % Create warning message if not QUIET
Generations 2 index lget 0 eq { % Check if object is free ...
- ( **** Warning: reference to free object: )
+ ( **** Warning: reference to free object: )
2 index =string cvs concatstrings ( ) concatstrings % put obj #
exch =string cvs concatstrings ( R\n) concatstrings % put gen #
} {
- ( **** Warning: wrong generation: )
+ ( **** Warning: wrong generation: )
2 index =string cvs concatstrings ( ) concatstrings % put obj #
exch =string cvs concatstrings % put gen #
- (, xref gen#: ) concatstrings 1 index Generations % put xref gen #
- exch lget 1 sub =string cvs concatstrings (\n) concatstrings
+ (, xref gen#: ) concatstrings 1 index Generations % put xref gen #
+ exch lget 1 sub =string cvs concatstrings (\n) concatstrings
} ifelse
pdfformaterror % Output warning message
} { % Else QUIET ...
@@ -549,14 +547,14 @@ currentdict /token_nofail_dict .undef
/endobj { % <object#> <generation#> <object> endobj <object>
3 1 roll
- % Read the xref entry if we haven't yet done so.
- % This is only needed for generation # checking.
+ % Read the xref entry if we haven't yet done so.
+ % This is only needed for generation # checking.
1 index resolved? {
pop
} if
checkgeneration {
- % The only global objects we bother to save are
- % (resource) dictionaries.
+ % The only global objects we bother to save are
+ % (resource) dictionaries.
1 index dup gcheck exch type /dicttype eq and {
PDFDEBUG { (%Local=>global: ) print dup //== exec } if
GlobalObjects 1 index 3 index put
@@ -589,24 +587,24 @@ currentdict /token_nofail_dict .undef
1 index /N get % Save number of objects onto the stack
2 index //false resolvestream % Convert stream dict into a stream
/ReusableStreamDecode filter % We need to be able to position stream
- % Objectstreams begin with list of object numbers and locations
- % Create two arrays to hold object numbers and stream location
+ % Objectstreams begin with list of object numbers and locations
+ % Create two arrays to hold object numbers and stream location
1 index array % Array for holding object number
2 index array % Array for holding stream object location
- % Get the object numbers and locations.
+ % Get the object numbers and locations.
0 1 5 index 1 sub { % Loop and collect obj # and locations
- % Stack: objstreamdict First N objectstream [obj#] [loc] index
+ % Stack: objstreamdict First N objectstream [obj#] [loc] index
2 index 1 index % Setup to put obj# into object number array
5 index token pop put % Get stream, then get obj# and put into array
1 index 1 index % Setup to put object loc into location array
5 index token pop put % Get stream, get obj loc and put into array
pop % Remove loop index
} for
- % Create a bytestring big enough for reading any object data
- % Scan for the size of the largest object
+ % Create a bytestring big enough for reading any object data
+ % Scan for the size of the largest object
0 0 % Init max object size and previous location
2 index { % Loop through all object locations
- % Stack: ... maxsize prevloc currentloc
+ % Stack: ... maxsize prevloc currentloc
dup 4 1 roll % Save copy of object location into stack
exch sub % Object size = currentloc - prevloc
.max % Determine maximum object size
@@ -614,26 +612,26 @@ currentdict /token_nofail_dict .undef
} forall
pop % Remove previous location
.bigstring % Create bytestring based upon max obj size
- % Move to the start of the object data
+ % Move to the start of the object data
3 index 6 index % Get objectstream and start of first object
setfileposition % Move to the start of the data
- % Read the data for all objects except the last. We do
- % not know the size of the last object so we need to treat
- % it as a special case.
+ % Read the data for all objects except the last. We do
+ % not know the size of the last object so we need to treat
+ % it as a special case.
0 1 6 index 2 sub {
dup 4 index exch get % Get our current object number
- % Stack: objstreamdict First N objectstream [obj#] [loc]
- % bytestring loopindex object#
+ % Stack: objstreamdict First N objectstream [obj#] [loc]
+ % bytestring loopindex object#
dup resolved? { % If we already have this object
- (yyy) = pstack (yyy) = flush xxx
+ (yyy) = pstack (yyy) = flush xxx
pop pop % Remove object and object number
1 add 2 index exch get % Get location of next object
6 index add 6 index exch % Form location of next object and get stream
setfileposition % Move to the start of the next object data
} { % Else this is a new object ...
- % We are going to create a string for reading the object
+ % We are going to create a string for reading the object
2 index 0 % use our working string
- % Determine the size of the object
+ % Determine the size of the object
5 index 4 index 1 add get % Get location of the next object
6 index 5 index get % Get location of this object
sub % Size of object = next loc - this loc
@@ -646,10 +644,10 @@ currentdict /token_nofail_dict .undef
} ifelse
} for
pop pop % Remove our working string and loc array
- % Now read the last object in the object stream. Since it
- % is the last object, we can use the original stream and
- % terminate when we hit the end of the stream
- % Stack: objstreamdict First N objectstream [obj#]
+ % Now read the last object in the object stream. Since it
+ % is the last object, we can use the original stream and
+ % terminate when we hit the end of the stream
+ % Stack: objstreamdict First N objectstream [obj#]
2 index 1 sub get % Get our current object number
dup resolved? not { % If we do not already have this object
exch % Get our object stream
@@ -674,24 +672,24 @@ currentdict /token_nofail_dict .undef
dup /N get % Save number of objects onto the stack
1 index //false resolvestream % Convert stream dict into a stream
/ReusableStreamDecode filter % We need to be able to position stream
- % Objectstreams begin with list of object numbers and locations
+ % Objectstreams begin with list of object numbers and locations
1 index array % Create array for holding object number
- % Get the object numbers
+ % Get the object numbers
0 1 4 index 1 sub { % Loop and collect obj numbers
- % Stack: strm# objstreamdict N PDFDEBUG objectstream [obj#] loopindex
+ % Stack: strm# objstreamdict N PDFDEBUG objectstream [obj#] loopindex
1 index 1 index % Setup to put obj# into object number array
4 index token pop put % Get stream, then get obj# and put into array
2 index token pop pop pop % Get stream, get obj loc and clear stack
} for
- % Move to the start of the object data
+ % Move to the start of the object data
1 index 4 index /First get % Get objectstream and start of first object
setfileposition % Move to the start of the data
- % We disable PDFDEBUG while reading the data stream. We will
- % print the data later
+ % We disable PDFDEBUG while reading the data stream. We will
+ % print the data later
PDFDEBUG { //no_debug_dict begin } if
- % Read the data for all objects. We check to see if we get
- % the number of objects that we expect.
- % Stack: strm# objstreamdict N objectstream [obj#] PDFDEBUG
+ % Read the data for all objects. We check to see if we get
+ % the number of objects that we expect.
+ % Stack: strm# objstreamdict N objectstream [obj#] PDFDEBUG
mark 3 -1 roll % Get objectstream
count 4 index add % Determine stack depth with objects
3 1 roll
@@ -700,13 +698,13 @@ currentdict /token_nofail_dict .undef
( **** Incorrect object count in object stream.\n) pdfformaterror
/resolveobjectstream cvx /rangecheck signalerror
} if
- % We have the object data
+ % We have the object data
counttomark array astore % Put objects into an array
exch pop exch pop % Remove mark and count
currentdict //no_debug_dict eq { end } if % Restore debug context
- % Save the objects into Objects
+ % Save the objects into Objects
0 1 2 index length 1 sub { % Loop through all objects
- % Stack: strm# objstreamdict N [obj#] [objects] loopindex
+ % Stack: strm# objstreamdict N [obj#] [objects] loopindex
dup 3 index exch get % Get our current object number
% Stack: strm# objstreamdict N [obj#] [objects] loopindex obj#
dup ObjectStream exch lget 7 index eq {
@@ -755,7 +753,7 @@ currentdict /no_debug_dict undef
} if
1 index 0 lt {
( **** Considering object with a negative number as null.\n) pdfformaterror
- pop pop //null
+ pop pop //null
} {
1 index resolved? { % If object has already been resolved ...
exch pop exch pop % then clear stack and return object
@@ -796,7 +794,7 @@ currentdict /no_debug_dict undef
exch PDFfile exch setfileposition % Return to original file position
} ifelse
} ifelse
-} bind def
+} bind def
% ================================ Streams ================================ %
@@ -836,15 +834,15 @@ currentdict /no_debug_dict undef
PDFfile read pop
dup 13 eq {
% If there had been a \n, token would have advanced over it
- % thus, if the terminator was \r, we have a format error!
- ( **** Warning: stream operator not terminated by valid EOL.\n) pdfformaterror
- pop % fileposition is OK (just past the \r).
+ % thus, if the terminator was \r, we have a format error!
+ ( **** Warning: stream operator not terminated by valid EOL.\n) pdfformaterror
+ pop % fileposition is OK (just past the \r).
} {
% Otherwise, scan past \n
{ 10 eq { exit } if
PDFfile read pop
} loop
- } ifelse
+ } ifelse
dup /FilePosition PDFfile fileposition put
PDFDEBUG {
PDFSTEPcount 1 le {
@@ -855,18 +853,18 @@ currentdict /no_debug_dict undef
% Some (bad) PDf files have invalid stream lengths. This causes problems
% if we reposition beyond the end of the file. So we compare the given
% length to number of bytes left in the file.
- dup /Length oget
+ dup /Length oget
dup PDFfile bytesavailable lt { % compare to to bytes left in file
PDFfile fileposition % reposition to the end of stream
add PDFfile exch setfileposition
} {
pop % bad stream length - do not reposition.
- % This will force a length warning below
+ % This will force a length warning below
} ifelse
} {
pop
- % We're already reading from a stream, which we can't reposition.
- % Capture the sub-stream contents in a string.
+ % We're already reading from a stream, which we can't reposition.
+ % Capture the sub-stream contents in a string.
dup /Length oget string PDFsource exch readstring
not {
( **** Warning: Unexpected EOF in stream!\n) pdfformaterror
@@ -880,7 +878,7 @@ currentdict /no_debug_dict undef
( **** Warning: stream missing 'endstream'.\n) pdfformaterror
pop /endstream % fake a valid endstream
} if
- /endstream ne {
+ /endstream ne {
( **** Warning: stream Length incorrect.\n) pdfformaterror
dup /Length undef % prevent the use of the incorrect length.
cvx endobj exit % exit from .pdfrun now.
@@ -906,30 +904,30 @@ currentdict /no_debug_dict undef
% Extract and apply filters.
/filterparms { % <dict> <DPkey> <Fkey> filterparms
- % <dict> <parms> <filternames>
+ % <dict> <parms> <filternames>
2 index exch knownoget {
oforce_recursive
exch 2 index exch knownoget {
- % Both filters and parameters.
+ % Both filters and parameters.
oforce_recursive
exch dup type /nametype eq {
- 1 array astore exch
- dup type /arraytype ne { 1 array astore } if exch
+ 1 array astore exch
+ dup type /arraytype ne { 1 array astore } if exch
} if
} {
- % Filters, but no parameters.
+ % Filters, but no parameters.
//null exch
dup type /nametype eq { 1 array astore } if
} ifelse
} {
- % No filters: ignore parameters, if any.
+ % No filters: ignore parameters, if any.
pop //null { }
} ifelse
} bind def
/filtername { % <filtername> filtername <filtername'>
//unabbrevfilterdict 1 index .knownget { exch pop } if
dup /Filter resourcestatus { pop pop } {
- Repaired exch % this error is not the creator's fault
+ Repaired exch % this error is not the creator's fault
( **** ERROR: Unable to process ) pdfformaterror
64 string cvs pdfformaterror
( data. Page will be missing data.\n) pdfformaterror
@@ -1000,18 +998,18 @@ currentdict /pdf_rules_dict undef
/jpxparmfix { % <streamdict> <readdata?> jpxparmfix <streamdict <readdata?>
1 index /Filter .knownget
{ /JPXDecode eq % we only need to do this for JPXDecode filters
- % TODO: handle filter arrays
+ % TODO: handle filter arrays
{
- 1 index /ColorSpace knownoget {
- 2 index /DecodeParms knownoget {
- % insert in the existing DecodeParms dict
- /ColorSpace 3 -1 roll put
- }{
- 1 dict % need to create a custom DecodeParms dict
- dup /ColorSpace 4 -1 roll put
- 2 index exch /DecodeParms exch put
- } ifelse
- } if
+ 1 index /ColorSpace knownoget {
+ 2 index /DecodeParms knownoget {
+ % insert in the existing DecodeParms dict
+ /ColorSpace 3 -1 roll put
+ }{
+ 1 dict % need to create a custom DecodeParms dict
+ dup /ColorSpace 4 -1 roll put
+ 2 index exch /DecodeParms exch put
+ } ifelse
+ } if
} if
} if
} bind def
@@ -1026,10 +1024,10 @@ currentdict /pdf_rules_dict undef
/resolvestream { % <streamdict> <readdata?> resolvestream <stream>
jpxparmfix
1 index /F knownoget {
- % This stream is stored on an external file.
+ % This stream is stored on an external file.
(r) file 3 -1 roll
/FDecodeParms /FFilter filterparms
- % Stack: readdata? file dict parms filternames
+ % Stack: readdata? file dict parms filternames
4 -1 roll exch
pdf_decrypt_stream
applyfilters
@@ -1041,14 +1039,14 @@ currentdict /pdf_rules_dict undef
dup /FilePosition .knownget {
1 index /File get exch setfileposition
} if
- % Stack: readdata? dict
+ % Stack: readdata? dict
/DecodeParms /Filter filterparms
- % Stack: readdata? dict parms filternames
+ % Stack: readdata? dict parms filternames
2 index /File get exch
- % Stack: readdata? dict parms file/string filternames
+ % Stack: readdata? dict parms file/string filternames
dup length 0 eq {
- % All the PDF filters have EOD markers, but in this case
- % there is no specified filter.
+ % All the PDF filters have EOD markers, but in this case
+ % there is no specified filter.
exch dup type /filetype eq 5 index or {
% Use length for any files or reading data from any source.
3 index /Length knownoget not { 0 } if
@@ -1069,7 +1067,7 @@ currentdict /pdf_rules_dict undef
} ifelse
} ifelse
} ifelse
- % Stack: readdata? dict file
+ % Stack: readdata? dict file
exch pop exch pop
} bind def
@@ -1096,18 +1094,18 @@ currentdict /pdf_rules_dict undef
pop pop pop //null
} {
dup length -1 bitshift 2 copy oget
- % Stack: key leafkey kids mid kids[mid]
+ % Stack: key leafkey kids mid kids[mid]
dup /Limits oget aload pop
- % Stack: key leafkey kids mid kids[mid] min max
+ % Stack: key leafkey kids mid kids[mid] min max
6 index lt {
pop pop
1 add 1 index length 1 index sub getinterval .branchget
} {
5 index gt {
- pop
- 0 exch getinterval .branchget
+ pop
+ 0 exch getinterval .branchget
} {
- exch pop exch pop .treeget
+ exch pop exch pop .treeget
} ifelse
} ifelse
} ifelse
@@ -1119,7 +1117,7 @@ currentdict /pdf_rules_dict undef
exch pop
} {
dup length -1 bitshift -2 and 2 copy oget
- % Stack: key pairs mid pairs[mid]
+ % Stack: key pairs mid pairs[mid]
3 index gt { 0 exch } { 1 index length 1 index sub } ifelse
getinterval .leafget
} ifelse
diff --git a/gs/Resource/Init/pdf_cslayer.ps b/gs/Resource/Init/pdf_cslayer.ps
index b9ffb2d05..15487a274 100644
--- a/gs/Resource/Init/pdf_cslayer.ps
+++ b/gs/Resource/Init/pdf_cslayer.ps
@@ -11,9 +11,9 @@
% San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
%
% $Id$
-%
+%
% Layer data extraction from Illustator CS2/CS3 files
-%
+%
.languagelevel dup 2 .max .setlanguagelevel
.currentglobal //true .setglobal
@@ -56,7 +56,7 @@
dup /Print knownoget { /PrintState knownoget { /OFF ne } { //true } ifelse } { //true } ifelse
/BDC_Printed exch def
pop % Usage dict
-
+
dup /Intent knownoget {
dup type /nametype eq {
/Design eq
diff --git a/gs/Resource/Init/pdf_draw.ps b/gs/Resource/Init/pdf_draw.ps
index b0ae903de..f533e434e 100644
--- a/gs/Resource/Init/pdf_draw.ps
+++ b/gs/Resource/Init/pdf_draw.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -79,12 +79,12 @@ pdfdict begin
dup /Order 2 copy knownoget { put } { pop pop } ifelse
dup /Encode 2 copy knownoget { put } { pop pop } ifelse
dup /Decode 2 copy knownoget { put } { pop pop } ifelse
-
- % Don't lose our place in PDFfile.
+
+ % Don't lose our place in PDFfile.
PDFfile fileposition exch
dup //true resolvestream
- % The stream isn't positionable, so read all the data now.
- % Stack: filepos fndict stream
+ % The stream isn't positionable, so read all the data now.
+ % Stack: filepos fndict stream
1 index /Range get length 2 idiv 2 index /BitsPerSample get mul
2 index /Size get { mul } forall
7 add 8 idiv
@@ -94,7 +94,7 @@ pdfdict begin
1 index exch () /SubFileDecode filter /ReusableStreamDecode filter
} ifelse
exch closefile
- % Stack: filepos fndict data
+ % Stack: filepos fndict data
exch dup /DataSource 4 -1 roll put
exch PDFfile exch setfileposition
} bdef
@@ -127,7 +127,7 @@ pdfdict begin
exch token {
/rangecheck cvx signalerror
} if
- % Use .bind to avoid idiom recognition.
+ % Use .bind to avoid idiom recognition.
.bind
1 index /Function 3 -1 roll put
exch PDFfile exch setfileposition
@@ -178,7 +178,7 @@ pdfdict begin
/resolveshading { % <shadingstream> resolveshading <shading>
dup /.shading_dict .knownget {
- exch pop
+ exch pop
dup /ShadingType get 4 ge {
dup /DataSource get 0 setfileposition
} if
@@ -190,16 +190,16 @@ pdfdict begin
} forall .dicttomark
dup /ShadingType get 4 ge {
dup dup //true resolvestream
- % Make a reusable stream so that the shading doesn't
- % reposition PDFfile at unexpected times.
+ % Make a reusable stream so that the shading doesn't
+ % reposition PDFfile at unexpected times.
/ReusableStreamDecode filter /DataSource exch put
- } if
+ } if
exch PDFfile exch setfileposition
dup 3 1 roll /.shading_dict exch put
} ifelse
} bdef
/resolvesh { % <shname> resolvesh <shading>
- % <shname> resolvesh <null>
+ % <shname> resolvesh <null>
Page /Shading rget {
resolveshading
} {
@@ -212,7 +212,7 @@ pdfdict begin
/spotfunctions mark
/Round {
abs exch abs 2 copy add 1 le {
- dup mul exch dup mul add 1 exch sub
+ dup mul exch dup mul add 1 exch sub
} {
1 sub dup mul exch 1 sub dup mul add 1 sub
} ifelse
@@ -222,9 +222,9 @@ pdfdict begin
dup mul exch dup mul add 1 exch sub
} {
2 copy add 1.23 le {
- .85 mul add 1 exch sub
+ .85 mul add 1 exch sub
} {
- 1 sub dup mul exch 1 sub dup mul add 1 sub
+ 1 sub dup mul exch 1 sub dup mul add 1 sub
} ifelse
} ifelse
} bind
@@ -233,10 +233,10 @@ pdfdict begin
pop dup mul exch .75 div dup mul add 4 div 1 exch sub
} {
dup 1 gt {
- pop 1 exch sub dup mul exch 1 exch sub
- .75 div dup mul add 4 div 1 sub
+ pop 1 exch sub dup mul exch 1 exch sub
+ .75 div dup mul add 4 div 1 sub
} {
- .5 exch sub exch pop exch pop
+ .5 exch sub exch pop exch pop
} ifelse
} ifelse
} bind
@@ -255,7 +255,7 @@ pdfdict begin
/InvertedDoubleDot { 2 {360 mul sin 2 div exch } repeat add neg } bind
/SimpleDot { dup mul exch dup mul add 1 exch sub } bind
/InvertedSimpleDot { dup mul exch dup mul add 1 sub } bind
- /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind
+ /CosineDot { 180 mul cos exch 180 mul cos add 2 div } bind
/Double { exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add } bind
/InvertedDouble {
exch 2 div exch 2 { 360 mul sin 2 div exch } repeat add neg
@@ -267,11 +267,11 @@ pdfdict begin
oforce
1 index /SpotFunction eq {
dup type /nametype eq
- { //spotfunctions exch get } { resolvefnproc }
+ { //spotfunctions exch get } { resolvefnproc }
ifelse
} {
1 index /TransferFunction eq {
- resolveidfnproc
+ resolveidfnproc
} if
} ifelse
} forall .dicttomark
@@ -321,18 +321,18 @@ currentdict /.resolveht6 undef
/cmmatrix matrix def
drawopdict begin
- % Graphics state stack
+ % Graphics state stack
/q { q } def
/Q { Q } def
- % Graphics state setting
+ % Graphics state setting
/cm { //cmmatrix astore
- .getpath
+ .getpath
exch concat
newpath { exec } forall
- % If inside a BT/ET block, we need to update the TextSaveMatrix
- currentdict /TextSaveMatrix .knownget {
- //cmmatrix exch dup concatmatrix pop
- } if
+ % If inside a BT/ET block, we need to update the TextSaveMatrix
+ currentdict /TextSaveMatrix .knownget {
+ //cmmatrix exch dup concatmatrix pop
+ } if
} bdef
/i { 1 .min setflat } bdef
@@ -363,10 +363,10 @@ end
/gsparamdict mark
/SA { setstrokeadjust }
/OP { 1 index /op known not { dup op } if OP }
- % The PDF 1.3 specification says that the name /Default is only
- % recognized for {BG,UCR,TR}2. However, PDF 1.3 files produced
- % by Adobe Acrobat Distiller 4.0 for Windows use the name /Default
- % with the older keys, so we have to implement this.
+ % The PDF 1.3 specification says that the name /Default is only
+ % recognized for {BG,UCR,TR}2. However, PDF 1.3 files produced
+ % by Adobe Acrobat Distiller 4.0 for Windows use the name /Default
+ % with the older keys, so we have to implement this.
/BG { 1 index /BG2 known { pop } { gsbg } ifelse }
/UCR { 1 index /UCR2 known { pop } { gsucr } ifelse }
/TR { 1 index /TR2 known { pop } { gstr } ifelse }
@@ -400,7 +400,7 @@ end
% HTP may be present even if this isn't a DPS interpreter.
dup sethalftonephases .swapcolors sethalftonephases .swapcolors
}
- % PDF 1.3
+ % PDF 1.3
% The font is an indirect reference, not a resource name
/Font { aload pop exch oforce resourcefont exch Tf }
/LW { setlinewidth }
@@ -416,11 +416,11 @@ end
/TR2 { gstr }
/FL { 1 .min setflat }
/SM {
- % SM may be present even if this is only a Level 2 interpreter.
+ % SM may be present even if this is only a Level 2 interpreter.
/setsmoothness where { pop setsmoothness } { pop } ifelse
}
- % PDF 1.4
- % All of these require the "transparency" feature in the interpreter.
+ % PDF 1.4
+ % All of these require the "transparency" feature in the interpreter.
/ca { ca }
/CA { CA }
/SMask { gssmask }
@@ -430,8 +430,8 @@ end
.dicttomark readonly def
/gs { % <gsres> gs -
Page /ExtGState rget {
- % We keep the dictionary on the stack during the forall so that
- % keys that interact with each other have access to it.
+ % We keep the dictionary on the stack during the forall so that
+ % keys that interact with each other have access to it.
dup {
oforce exch gsparamdict exch .knownget { exec } { pop } ifelse
} forall pop
@@ -445,11 +445,11 @@ end
dup /None eq 1 index //null eq or PDFusingtransparency not or {
pop //null exit
} if
- % Preprocess the SMask value into a parameter dictionary for
- % .begintransparencymaskgroup, with added /BBox and /Draw keys.
+ % Preprocess the SMask value into a parameter dictionary for
+ % .begintransparencymaskgroup, with added /BBox and /Draw keys.
mark exch % Stack: mark smaskdict
dup /S oget /Subtype exch 3 2 roll
- % Stack: mark ... smaskdict
+ % Stack: mark ... smaskdict
dup /BC knownoget {
dup /Background exch 4 2 roll
1 index /G oget /Group knownoget not {
@@ -459,8 +459,8 @@ end
} if
gsave //nodict begin
/CS knownoget {
- resolvecolorspace dup setgcolorspace csput
- } if
+ resolvecolorspace dup setgcolorspace csput
+ } if
aload pop setcolor [ currentgray ]
end grestore
/GrayBackground exch 3 2 roll
@@ -471,7 +471,7 @@ end
} {
resolvefnproc /TransferFunction exch 3 2 roll
} ifelse
- } if
+ } if
dup /G oget dup /BBox oget /BBox exch 4 2 roll
% Because we don't execute the group form stream until we find
% out whether we're actually going to draw through it, we need
@@ -526,7 +526,7 @@ def
% We can't simply set the group's gstate here because
% we can't use gsave/grestore. So we actually set it
- % in .execgroup. But the matrix needs set here for
+ % in .execgroup. But the matrix needs set here for
% .begintransparencymaskgroup to correctly work.
% It might seem we should also set the colorspace
% in case the group doesn't have one, *but* empirical
@@ -536,11 +536,11 @@ def
1 index /GroupMat .knownget { setmatrix } if
PDFfile fileposition 4 1 roll
- % We have to select the group's color space so that the
- % background color will be interpreted correctly.
- % [save/restore]DefaultCS make sure that the SMask logic sees
- % the Device* spaces, not CIEBased* that UseCIEColor may have
- % established.
+ % We have to select the group's color space so that the
+ % background color will be interpreted correctly.
+ % [save/restore]DefaultCS make sure that the SMask logic sees
+ % the Device* spaces, not CIEBased* that UseCIEColor may have
+ % established.
//false .setuseciecolor % SMask gets processed without UseCIEColor
dup /Group oget /CS knownoget {
resolvecolorspace dup setgcolorspace csput
@@ -560,7 +560,7 @@ def
} stopped {
.discardtransparencymask stop
} if
- PDFfile exch setfileposition
+ PDFfile exch setfileposition
.setuseciecolor setcolorspace setcolor
setmatrix
end % restore colorspace, color and ExtGState (end)
@@ -571,7 +571,7 @@ def
pdfemptycount 3 1 roll
/pdfemptycount count 3 sub store
gsave //nodict begin
-
+
% We have to set the gstate correctly for lazy evaluation of a softmask group.
% we also must preserve the color(space) as setup in .execmaskgroup.
% This stuff must be done here, as .execmaskgroup can't use gsave/grestore to
@@ -588,7 +588,7 @@ def
1 .setopacityalpha 1 .setshapealpha
1 CA 1 ca
/Compatible .setblendmode
- % Execute the body of the Form, similar to DoForm.
+ % Execute the body of the Form, similar to DoForm.
pdfopdict .pdfruncontext
end grestore
/pdfemptycount exch store
@@ -600,7 +600,7 @@ def
dup /I knownoget { /Isolated exch 3 2 roll } if
dup /K knownoget { /Knockout exch 3 2 roll } if
pop .dicttomark
- % Stack: bbox paramdict
+ % Stack: bbox paramdict
exch aload pop
.begintransparencygroup
} bdef
@@ -609,7 +609,7 @@ def
% Form XObject dictionary includes a Group key. See .paintform below.
/.paintgroupform { % <resdict> <stream> <formdict> .paintgroupform -
dup /Group oget exch /BBox oget
- % Stack: resdict stream groupdict bbox
+ % Stack: resdict stream groupdict bbox
.beginformgroup {
.execgroup
} stopped {
@@ -619,20 +619,20 @@ def
% Make an ImageType 103 (soft-masked) image.
/makesoftmaskimage { % <datasource> <imagemask> <SMask> makesoftmaskimage
- % <datasource> <imagemask>, updates currentdict =
- % imagedict
- % See the ImageType 3 case of makemaskimage below.
- % SMask is a stream, another Image XObject.
- % Stack: datasource imagemask(false) smaskstreamdict
+ % <datasource> <imagemask>, updates currentdict =
+ % imagedict
+ % See the ImageType 3 case of makemaskimage below.
+ % SMask is a stream, another Image XObject.
+ % Stack: datasource imagemask(false) smaskstreamdict
PDFfile fileposition exch
dup /Matte knownoget { /Matte exch def } if
dup length dict makeimagedict pop
- % In order to prevent the two data sources from being
- % aliased, we need to make at least one a reusable stream.
- % We pick the mask, since it's smaller (in case we need to
- % read all its data now).
- % Stack: datasource imagemask(false) savedpos
- % maskdict is currentdict
+ % In order to prevent the two data sources from being
+ % aliased, we need to make at least one a reusable stream.
+ % We pick the mask, since it's smaller (in case we need to
+ % read all its data now).
+ % Stack: datasource imagemask(false) savedpos
+ % maskdict is currentdict
/DataSource DataSource mark
/Intent 1
/AsyncRead //true
@@ -684,12 +684,12 @@ currentdict end readonly def
dup 1 get % Get colorspace dictionary
dup /Alternate .knownget { % Check for alternate color space
oforce resolvecolorspace /Alternate exch put % resolve and replace
- } {
+ } {
pop % remove colorspace dictionary
} ifelse
} bdef
-/csrdict 13 dict begin
+/csrdict 13 dict begin
/DeviceGray { } bdef
/DeviceRGB { } bdef
/DeviceCMYK { } bdef
@@ -728,85 +728,85 @@ currentdict end readonly def
dup length 4 gt { % Check for attributes dict
dup dup 4 oget % devn_array devn_array attr_dict
dup /Colorants knownoget % Check for Colorants Dict
- { % Create a new attribute dict with only a Colorants dict entry.
- % Resolve all of the Colorant dict entries. This is needed
- % to prevent a conflict if we attempt to resolve the tint
- % transform functions of the Colorant color spaces multiple
- % times.
- exch pop % Remove old attributes dict
- << exch % Start new attributes dict
- % Build new Colorants dict with resolved entries
- << exch { oforce resolvecolorspace } forall >>
- /Colorants exch >> % Finish new attributes dict
- } if
+ { % Create a new attribute dict with only a Colorants dict entry.
+ % Resolve all of the Colorant dict entries. This is needed
+ % to prevent a conflict if we attempt to resolve the tint
+ % transform functions of the Colorant color spaces multiple
+ % times.
+ exch pop % Remove old attributes dict
+ << exch % Start new attributes dict
+ % Build new Colorants dict with resolved entries
+ << exch { oforce resolvecolorspace } forall >>
+ /Colorants exch >> % Finish new attributes dict
+ } if
4 exch put % Put resolved or new attributes dict
} if
} bdef
/Indexed {
aload pop 3 -1 roll oforce resolvecolorspace
- % Stack: /Indexed hival lookup basespace
- % If the underlying space is a Lab space, we must scale
- % the output of the lookup table as part of DecodeABC.
+ % Stack: /Indexed hival lookup basespace
+ % If the underlying space is a Lab space, we must scale
+ % the output of the lookup table as part of DecodeABC.
dup dup type /arraytype eq { 0 get } if /CIEBasedABC eq {
dup 1 get /DecodeLMN known {
- 1 get dup length dict copy
- begin /DecodeABC [ 0 2 4 {
- RangeABC 1 index 1 add get RangeABC 2 index get sub /mul load
- RangeABC 3 index get /add load
- DecodeABC 6 -1 roll 2 idiv get [ 6 1 roll aload pop ] cvx
- } for ] def
- /RangeABC //01_3 def
- currentdict end /CIEBasedABC exch 2 array astore
+ 1 get dup length dict copy
+ begin /DecodeABC [ 0 2 4 {
+ RangeABC 1 index 1 add get RangeABC 2 index get sub /mul load
+ RangeABC 3 index get /add load
+ DecodeABC 6 -1 roll 2 idiv get [ 6 1 roll aload pop ] cvx
+ } for ] def
+ /RangeABC //01_3 def
+ currentdict end /CIEBasedABC exch 2 array astore
} if
} if
3 1 roll
oforce dup type /stringtype ne {
- % Get the steram length and save it
- dup /Length get dup type /packedarraytype eq {
- % Length is an indirect reference, resolve it.
- exec
- }if
- 6 1 roll
- % The color lookup table is a stream.
- % Get its contents. Don't lose our place in PDFfile.
- % Stack: Length /Indexed basespace hival lookup
- PDFfile fileposition 5 1 roll //true resolvestream
- % Stack: Length filepos /Indexed basespace hival lookupstream
- 1 index 1 add
- % Stack: Length filepos /Indexed basespace hival lookupstream len
- 3 index
- dup dup type /arraytype eq { 0 get } if
- //csncompdict exch get exec mul
- % Bring length of stream to top and copy
- 8 -1 roll dup
- % copy calculated string length
- 2 index
- gt {
- % If stream length greater, use it
- exch pop
- }{
- % otherwise use calculated length
- pop
- } ifelse
- string dup 3 1 roll readstring pop % the string is padded with 0s
+ % Get the steram length and save it
+ dup /Length get dup type /packedarraytype eq {
+ % Length is an indirect reference, resolve it.
+ exec
+ }if
+ 6 1 roll
+ % The color lookup table is a stream.
+ % Get its contents. Don't lose our place in PDFfile.
+ % Stack: Length /Indexed basespace hival lookup
+ PDFfile fileposition 5 1 roll //true resolvestream
+ % Stack: Length filepos /Indexed basespace hival lookupstream
+ 1 index 1 add
+ % Stack: Length filepos /Indexed basespace hival lookupstream len
+ 3 index
+ dup dup type /arraytype eq { 0 get } if
+ //csncompdict exch get exec mul
+ % Bring length of stream to top and copy
+ 8 -1 roll dup
+ % copy calculated string length
+ 2 index
+ gt {
+ % If stream length greater, use it
+ exch pop
+ }{
+ % otherwise use calculated length
+ pop
+ } ifelse
+ string dup 3 1 roll readstring pop % the string is padded with 0s
length 1 index length lt {
( **** Warning: Short look-up table in the Indexed color space was padded with 0's.\n)
pdfformaterror
} if
- % Stack: filepos /Indexed basespace hival table table'
- 5 -1 roll PDFfile exch setfileposition
+ % Stack: filepos /Indexed basespace hival table table'
+ 5 -1 roll PDFfile exch setfileposition
}
if 4 array astore
- % Replace the PDFColorSpace with the Indexed space if needed.
+ % Replace the PDFColorSpace with the Indexed space if needed.
dup 1 get
dup type /arraytype eq {
dup length 2 ge {
- dup 1 get type /dicttype eq {
- dup 1 get /PDFColorSpace known {
- dup 1 get /PDFColorSpace 3 index put
- } if
- } if
+ dup 1 get type /dicttype eq {
+ dup 1 get /PDFColorSpace known {
+ dup 1 get /PDFColorSpace 3 index put
+ } if
+ } if
} if
} if pop
} bdef
@@ -815,14 +815,14 @@ currentdict end readonly def
( **** Warning: The name /Indexed cannot be abbreviated to /I in the color space\n)
pdfformaterror
dup 0 /Indexed put
- //Indexed exec
+ //Indexed exec
} bdef
/Pattern {
dup type /nametype ne {
dup length 1 gt {
- 1 oget resolvecolorspace
- /Pattern exch 2 array astore
+ 1 oget resolvecolorspace
+ /Pattern exch 2 array astore
} if
} if
} bdef
@@ -830,7 +830,7 @@ currentdict end readonly def
currentdict end readonly def
/cssubst { % <csname> cssubst <cspace'> true
- % <csname> cssubst false
+ % <csname> cssubst false
dup resolvecolorspace
dup 1 index ne { exch pop //true } { pop pop //false } ifelse
} bdef
@@ -873,17 +873,17 @@ currentdict end readonly def
currentdict /ICCBased-resolve undef
/scresolve { % <c0> ... scresolve <multi>
- % We can't really make sc[n] and SC[N] work, because
- % the color space information isn't available at
- % conversion time; so we hack it by assuming that
- % all the operands on the stack are used, and that
- % if the top operand is a name, it's a Pattern resource.
+ % We can't really make sc[n] and SC[N] work, because
+ % the color space information isn't available at
+ % conversion time; so we hack it by assuming that
+ % all the operands on the stack are used, and that
+ % if the top operand is a name, it's a Pattern resource.
dup type /nametype eq
{ Page /Pattern rget { resolvepattern } { //null } ifelse }
if
dup type /dicttype eq {
- % Check the PaintType, if any (shading patterns don't
- % have one).
+ % Check the PaintType, if any (shading patterns don't
+ % have one).
dup /PaintType knownoget { 2 eq } { //false } ifelse
} {
.pdfcount 1 gt
@@ -907,13 +907,13 @@ currentdict /ICCBased-resolve undef
pdfemptycount countdictstack
/pdfemptycount count 3 sub def 4 2 roll
%
- % Stack: ... <old emptycount> <dictcount> <patdict> <resdict>
+ % Stack: ... <old emptycount> <dictcount> <patdict> <resdict>
% |
% New empty count points here -----+
exch //false resolvestream pdfopdict .pdfruncontext
- countdictstack exch sub dup 0 gt {
+ countdictstack exch sub dup 0 gt {
( **** Warning: Pattern stream has unbalanced q/Q operators \(too many q's\)\n)
pdfformaterror
{ Q } repeat
@@ -930,12 +930,12 @@ currentdict /ICCBased-resolve undef
} bdef
/resolvepattern { % <patternstreamdict> resolvepattern <patterndict>
- % Don't do the resolvestream now: just capture the data
- % from the file if necessary.
+ % Don't do the resolvestream now: just capture the data
+ % from the file if necessary.
dup length dict copy
dup /FilePosition .knownget {
1 index /File get dup fileposition 3 1 roll
- % Stack: dict savepos pos file
+ % Stack: dict savepos pos file
dup 3 -1 roll setfileposition
dup 3 index /Length knownoget {
dup 65535 le {
@@ -950,7 +950,7 @@ currentdict /ICCBased-resolve undef
} {
0 (endstream) /SubFileDecode filter /ReusableStreamDecode filter
} ifelse
- % Stack: dict savepos file string
+ % Stack: dict savepos file string
3 1 roll exch setfileposition
1 index /File 3 -1 roll put
dup /FilePosition undef
@@ -959,7 +959,7 @@ currentdict /ICCBased-resolve undef
resolveshading 1 index /Shading 3 -1 roll put
} if
dup /PaintProc [
- % Bind the resource dictionary into the PaintProc.
+ % Bind the resource dictionary into the PaintProc.
2 index /Resources knownoget { oforce } { 0 dict } ifelse
/.pdfpaintproc cvx
] cvx put
@@ -1057,7 +1057,7 @@ currentdict /ignore_color_op undef
% ---------------- Paths ---------------- %
drawopdict begin
- % Path construction
+ % Path construction
/m { moveto } bind 0 get def
/l { lineto } bind 0 get def
/c { curveto } bind 0 get def
@@ -1068,7 +1068,7 @@ drawopdict begin
closepath
} bdef
/h { closepath } bind 0 get def
- % Path painting and clipping
+ % Path painting and clipping
/n { n } def
/S { S } def
/s { s } def
@@ -1082,10 +1082,10 @@ drawopdict begin
/W* { W* } def
/sh {
OFFlevels length 0 eq {
- setfillstate resolvesh
- gsave 0 .setoverprintmode
+ setfillstate resolvesh
+ gsave 0 .setoverprintmode
dup /.shading .knownget {
- exch
+ exch
pop
} {
dup
@@ -1138,15 +1138,15 @@ end
Printed {
dup /Alternates knownoget {
{
- dup /DefaultForPrinting knownoget {
- {
- /Image oget exch pop exit
- } {
- pop
- } ifelse
- } {
- pop
- } ifelse
+ dup /DefaultForPrinting knownoget {
+ {
+ /Image oget exch pop exit
+ } {
+ pop
+ } ifelse
+ } {
+ pop
+ } ifelse
} forall
} if
} if
@@ -1173,7 +1173,7 @@ end
% 21 % ROMMRGB
% 24 % e-sYCC
.dicttomark readonly def
-
+
% Process jp2 blocks (aka boxes). All procedures have the signature
% <file> <length> -> ... <file> <flush_length>
/jp2_tag_dict 10 dict begin
@@ -1188,8 +1188,8 @@ end
/JPXComponents 1 index 8 getu16 % file len-14 (14) /JPXComponents NC
def % file len-14 (14)
10 get 16#7F and 1 add
- dup 12 eq { pop 16 } if
- /BitsPerComponent exch def % file len-14
+ dup 12 eq { pop 16 } if
+ /BitsPerComponent exch def % file len-14
} bdef
/colr {
@@ -1198,7 +1198,7 @@ end
1 index (123) readstring pop % file len-3 (3)
0 get dup 1 eq {
pop 4 sub % file len-7
- 1 index (1234) readstring pop % file len-16 (4)
+ 1 index (1234) readstring pop % file len-16 (4)
0 getu32 % file len-16 enum
//jp2_csp_dict exch .knownget {
exec /ColorSpace exch def % file len-7
@@ -1241,7 +1241,6 @@ end
currentdict end readonly def
-
% Parse jp2 file format to get color space and image depth info.
% <file> get_jp2_csp -
/get_jp2_csp {
@@ -1262,12 +1261,12 @@ currentdict end readonly def
} {
8 sub
} ifelse
- } ifelse % f (TBox) LBox-8..16
+ } ifelse % f (TBox) LBox-8..16
PDFDEBUG {
2 copy 2 packedarray //== exec % f (TBox) LBox-8..16
} if
-
+
//jp2_tag_dict 3 -1 roll .knownget {
exec
} if % f flush
@@ -1301,7 +1300,7 @@ currentdict /jp2_csp_dict .undef
dup type /arraytype eq {
[ exch { oforce } forall
dup //null eq { pop 1 dict } if
- ]
+ ]
dup dup length 1 sub get % <resdict> <key> <value> [] <<>>
} {
dup length 1 add dict copy dup % <resdict> <key> <value> <<>> <<>>
@@ -1342,38 +1341,38 @@ currentdict /jp2_csp_dict .undef
} bdef
/makeimagedict { % <resdict> <newdict> makeimagedict <imagemask?>
- % On return, newdict' is currentdict
+ % On return, newdict' is currentdict
begin
/Width 2 copy oget def
/Height 2 copy oget def
- % Handle missing BitsPerComponent later.
+ % Handle missing BitsPerComponent later.
/BitsPerComponent 2 copy knownoget { def } { pop } ifelse
/Interpolate 2 copy knownoget { def } { pop } ifelse
makeimagekeys
} bdef
/makeimagekeys { % <resdict> makeimagekeys <imagemask>
- % newdict is currentdict
- % Assumes Width, Height, BPC, Interpolate already copied.
+ % newdict is currentdict
+ % Assumes Width, Height, BPC, Interpolate already copied.
/ImageType 1 def
/ImageMatrix Width 0 0
- % Handle 0-height images specially.
+ % Handle 0-height images specially.
Height dup 0 eq { pop 1 } if neg 0 1 index neg
6 array astore def
dup /ImageMask knownoget dup { and } if {
- % Image mask
- % Decode is required for the PostScript image operators.
+ % Image mask
+ % Decode is required for the PostScript image operators.
% AI8 writes bogus decode array [0 1 0 0 0 0 0 0]
/Decode 2 copy knownoget { 0 2 getinterval } { //01_1 } ifelse def
- % BitsPerComponent is optional for masks.
+ % BitsPerComponent is optional for masks.
/BitsPerComponent 2 copy known { pop } { 1 def } ifelse
- % Even though we're going to read data,
- % pass false to resolvestream so that
- % it doesn't try to use Length (which may not be present).
+ % Even though we're going to read data,
+ % pass false to resolvestream so that
+ % it doesn't try to use Length (which may not be present).
//false resolvestream /DataSource exch def
//true
} {
- % Opaque image
+ % Opaque image
dup /Filter knownoget {
dup type /arraytype eq {
dup length
@@ -1387,7 +1386,7 @@ currentdict /jp2_csp_dict .undef
} {
//false
} ifelse { % /JPXDecode tricks
- dup /ColorSpace oknown
+ dup /ColorSpace oknown
1 index /BitsPerComponent oknown and not {
% JPXDecode filters can omit the /ColorSpace and /BitsPerComponent
% keys, in which case the interpreter must retrieve this information
@@ -1495,9 +1494,9 @@ currentdict /jp2_csp_dict .undef
} ifelse % fi JPX tricks
- % Even though we're going to read data,
- % pass false to resolvestream so that
- % it doesn't try to use Length (which may not be present).
+ % Even though we're going to read data,
+ % pass false to resolvestream so that
+ % it doesn't try to use Length (which may not be present).
//false resolvestream /DataSource exch def
//false
} ifelse
@@ -1513,8 +1512,8 @@ currentdict /last-ditch-bpc-csp undef
makeimagedict doimagesmask
} bdef
/makemaskimage { % <datasource> <imagemask> <Mask> makemaskimage
- % <datasource> <imagemask>, updates currentdict =
- % imagedict
+ % <datasource> <imagemask>, updates currentdict =
+ % imagedict
dup type /arraytype eq {
/ImageType 4 def
% Check that every element of the Mask is an integer.
@@ -1530,8 +1529,8 @@ currentdict /last-ditch-bpc-csp undef
[ exch { 0.5 add cvi } forall ] % following AR4, 5, 6 implementation
} if
} if
- % Check elements of array are within 0::(2**BitsPerComponent)-1
- % This is a PostScript error, but AR ignores Mask in that case
+ % Check elements of array are within 0::(2**BitsPerComponent)-1
+ % This is a PostScript error, but AR ignores Mask in that case
1 BitsPerComponent bitshift 1 sub //false 2 index {
% stack: max_value result_bool value
dup 0 lt exch 3 index gt or or
@@ -1542,16 +1541,16 @@ currentdict /last-ditch-bpc-csp undef
} if
/MaskColor exch def
} {
- % Mask is a stream, another Image XObject.
- % Stack: datasource imagemask(false) maskstreamdict
+ % Mask is a stream, another Image XObject.
+ % Stack: datasource imagemask(false) maskstreamdict
PDFfile fileposition exch
dup length dict makeimagedict pop
- % In order to prevent the two data sources from being
- % aliased, we need to make at least one a reusable stream.
- % We pick the mask, since it's smaller (in case we need to
- % read all its data now).
- % Stack: datasource imagemask(false) savedpos
- % maskdict is currentdict
+ % In order to prevent the two data sources from being
+ % aliased, we need to make at least one a reusable stream.
+ % We pick the mask, since it's smaller (in case we need to
+ % read all its data now).
+ % Stack: datasource imagemask(false) savedpos
+ % maskdict is currentdict
/DataSource DataSource mark
/Intent 1
/AsyncRead //true
@@ -1574,10 +1573,10 @@ currentdict /last-ditch-bpc-csp undef
//false
} ifelse
{ % We are doing transparency and SMask is present in the image
- % stack: <imagemask> <SMask>
+ % stack: <imagemask> <SMask>
currentdevice 1 dict dup /PreserveSMask dup put .getdeviceparams
dup type /booleantype eq not {cleartomark false}{3 1 roll cleartomark}ifelse
-% currentdevice .devicename /pdfwrite eq
+% currentdevice .devicename /pdfwrite eq
{
pop % pdfwrite will process SMask directly during 'doimage'
} {
@@ -1593,8 +1592,8 @@ currentdict /last-ditch-bpc-csp undef
PDFfile exch setfileposition
0 .endtransparencymask
} ifelse
- << /Subtype /Group /Isolated //true
- /.image_with_SMask //true % pdfwrite needs : see gs/src/ztrans.c, gs/src/gdevpdft.c
+ << /Subtype /Group /Isolated //true
+ /.image_with_SMask //true % pdfwrite needs : see gs/src/ztrans.c, gs/src/gdevpdft.c
>> 0 0 1 1 .begintransparencygroup
doimage
.endtransparencygroup
@@ -1637,23 +1636,23 @@ currentdict /last-ditch-bpc-csp undef
} if
/doimage { % <imagemask> doimage -
- % imagedict is currentdict, gets popped from dstack
+ % imagedict is currentdict, gets popped from dstack
DataSource exch
PDFusingtransparency
currentdevice 1 dict dup /PreserveSMask dup put .getdeviceparams
dup type /booleantype eq not {cleartomark false}{3 1 roll cleartomark}ifelse not
-% currentdevice .devicename /pdfwrite ne
- {
+% currentdevice .devicename /pdfwrite ne
+ {
% This is a temporary workaround for the bug 689080,
% which is done under a rush of 8.63 release.
% The purpose is to disable a conversion of an image with soft mask
% into a Type 103 image, which currently allocates a full mask buffer
% before writing clist.
% With this workaround the Matte color is not working (ignored).
- is_big_mask not
+ is_big_mask not
} {
//true % pdfwrite doesn't need the workaround explained above,
- % and cannot work with it.
+ % and cannot work with it.
} ifelse
and {
currentdict /SMask knownoget
@@ -1666,7 +1665,7 @@ currentdict /last-ditch-bpc-csp undef
makemaskimage
} if
} ifelse
- % Stack: datasource imagemask
+ % Stack: datasource imagemask
{ currentdict end setfillstate { imagemask } }
{ ColorSpace setgcolorspace currentdict end setfillblend { image } }
ifelse
@@ -1682,8 +1681,8 @@ currentdict /last-ditch-bpc-csp undef
pdfformaterror
} ifelse
} if
- % Close the input stream, unless it is PDFfile or
- % PDFsource.
+ % Close the input stream, unless it is PDFfile or
+ % PDFsource.
dup dup PDFfile eq exch PDFsource eq or { pop } { closefile } ifelse
} bdef
@@ -1745,7 +1744,7 @@ currentdict /_dops_save undef
pop
} ifelse
} forall
- } bdef
+ } bdef
/AnyOn {
//false exch {
oforce dup type /dicttype eq {
@@ -1763,7 +1762,6 @@ currentdict /_dops_save undef
} bdef
currentdict end readonly def
-
% Check whether OCG or OCMD is visible
% <dict> oc-is-visible <bool>
/ocg-is-visible {
@@ -1772,7 +1770,7 @@ currentdict end readonly def
dup /OCGs knownoget not { {} } if % OC OCGs
dup type /dicttype eq { 1 array astore } if
//true 1 index { //null eq and } forall {
- pop pop //true % all nulls => show
+ pop pop //true % all nulls => show
} {
exch /P knownoget not { /AnyOn } if % OCGs P
//ocg_pocs exch get exec % bool
@@ -1789,7 +1787,7 @@ drawopdict begin
/Do { % /Name
setfillblend
PDFfile fileposition exch % pos /Name
- dup Page /XObject rget {
+ dup Page /XObject rget {
exch pop % pos obj
OFFlevels length 0 eq {
dup /OC knownoget { ocg-is-visible } { //true } ifelse
@@ -1807,7 +1805,7 @@ drawopdict begin
} {
% This should cause an error, but Acrobat Reader can
% continue, so we do too.
- ( **** Undefined XObject resource: )
+ ( **** Undefined XObject resource: )
exch =string cvs concatstrings (\n) concatstrings
pdfformaterror
} ifelse
@@ -1873,15 +1871,15 @@ drawopdict begin
7 add 8 idiv Height mul
DataSource exch () /SubFileDecode filter flushfile
end
- } ifelse
- % The Adobe documentation says that the data following ID
- % consists of "lines", and some PDF files (specifically, some files
- % produced by PCL2PDF from Visual Software) contain garbage bytes
- % between the last byte of valid data and an EOL.
+ } ifelse
+ % The Adobe documentation says that the data following ID
+ % consists of "lines", and some PDF files (specifically, some files
+ % produced by PCL2PDF from Visual Software) contain garbage bytes
+ % between the last byte of valid data and an EOL.
% Some files (PDFOUT v3.8d by GenText) have EI immediately following
% the stream. Some have no EOL and garbage bytes.
% Sometimes (bug 690300) CCITTDecode filter consumes 'E' in 'EI'.
- % Therefore, we search for <start>I<sp|end> or <start|sp>EI<sp|end>
+ % Therefore, we search for <start>I<sp|end> or <start|sp>EI<sp|end>
PDFsource read not {
/ID cvx /syntaxerror signalerror
} if
@@ -1911,7 +1909,7 @@ currentdict /is_space_dict undef
% ================================ Text ================================ %
drawopdict begin
- % Text control
+ % Text control
/BT { BT } def
/ET { ET } def
/Tc { Tc } def
@@ -1920,12 +1918,12 @@ drawopdict begin
/Ts { Ts } def
/Tw { Tw } def
/Tz { Tz } def
- % Text positioning
+ % Text positioning
/Td { Td } def
/TD { TD } def
/Tm { Tm } def
/T* { T* } def
- % Text painting
+ % Text painting
/Tj { Tj } def
/' { ' } def
/" { " } def
@@ -2006,13 +2004,13 @@ end
dup /BS knownoget {
dup type /dicttype ne % <annot> <border> <bad?>
} {
- dup /Border oget
+ dup /Border oget
dup type /arraytype eq {
dup length 3 lt
} {
//true
} ifelse % <annot> [border] <bad?>
- } ifelse {
+ } ifelse {
( **** Warning: Wrong annotation border object, no border is drawn.\n)
pdfformaterror
pop { 0 0 0 }
@@ -2067,7 +2065,7 @@ end
32 and 0 eq exch pop % not NoView
} ifelse
} {
- pop pop //false % Hidden
+ pop pop //false % Hidden
} ifelse
} bdef
@@ -2109,7 +2107,7 @@ end
/File 1 index /V fget not { () } if length
2 index /DA fget not { () } if length add
500 add 65535 .min string dup 3 1 roll def
- /NullEncode filter % <annot> file
+ /NullEncode filter % <annot> file
dup (BT ) writestring
1 index /DA fget not { () } if
@@ -2148,43 +2146,43 @@ end
} if
//false
[/N /R /D] {
- % stack: scalex scaley annot appearance false key
+ % stack: scalex scaley annot appearance false key
2 index exch knownogetdict {
- exch not exit
+ exch not exit
} if
} forall
- % stack: scalex scaley annot appearance value true
- % stack: scalex scaley annot appearance false
+ % stack: scalex scaley annot appearance value true
+ % stack: scalex scaley annot appearance false
dup {
pop exch pop
- % Acrobat Distiller produces files in which this Form
- % XObject lacks Type and Subtype keys. This is illegal,
- % but Acrobat Reader accepts it. The only way we can
- % tell whether this is a Form or a set of sub-appearances
- % is by testing for the stream Length or File key.
+ % Acrobat Distiller produces files in which this Form
+ % XObject lacks Type and Subtype keys. This is illegal,
+ % but Acrobat Reader accepts it. The only way we can
+ % tell whether this is a Form or a set of sub-appearances
+ % is by testing for the stream Length or File key.
% If the stream lacks Length key, try File key.
dup /Length known 1 index /File known or {
- % If this is a form then simply use it
+ % If this is a form then simply use it
//true
} {
1 index /AS knownoget not {
- % If we do not have AS then use any appearance
- { exch pop oforce exit } forall //true
- } {
- % Stack: annot Ndict AS
- % Get the specified appearance. If no appearance, then
- % display nothing - set stack = false.
- knownoget
+ % If we do not have AS then use any appearance
+ { exch pop oforce exit } forall //true
+ } {
+ % Stack: annot Ndict AS
+ % Get the specified appearance. If no appearance, then
+ % display nothing - set stack = false.
+ knownoget
} ifelse
} ifelse
} {
exch pop % discard useless AP dictionary
} ifelse
- % Stack: scalex scaley annot appearance true
- % Stack: scalex scaley annot false
+ % Stack: scalex scaley annot appearance true
+ % Stack: scalex scaley annot false
{
- % Draw appearance
+ % Draw appearance
% Initialize graphic following "7.4.4 Appearance Streams"
q graphicsbeginpage textbeginpage
1 index annotrect pop pop translate
@@ -2230,13 +2228,13 @@ end
dup /FT fget {
/Tx eq {
% Stack: scalex scaley annot
- dup /V oknown {
+ dup /V oknown {
dup /DA fget {
pop
make_tx_da
3 copy drawwidget
} if
- } if
+ } if
} if
} if
} if
@@ -2254,25 +2252,25 @@ currentdict /set_bc_color undef
pop dup annotrect 4 2 roll pop pop % get width height size in user space
3 -1 roll /AP knownoget {
/N knownogetdict {
- dup /Matrix knownoget not { {1 0 0 1 0 0} } if
- exch /BBox knownoget { % x y {matrix} [box]
+ dup /Matrix knownoget not { {1 0 0 1 0 0} } if
+ exch /BBox knownoget { % x y {matrix} [box]
exch .bbox_transform % x y x0 y0 x1 y1
3 -1 roll sub % x y x0 x1 y1-y0
- 3 1 roll exch sub % x y y1-y0 x1-x0
+ 3 1 roll exch sub % x y y1-y0 x1-x0
2 copy mul 0 eq {
( **** Warning: /BBox has zero width or height, which is not allowed.\n)
pdfformaterror
pop pop pop pop 1 1 % zero size -- revert to unity scaling
- } {
- 3 1 roll div % x x1-x0 y/(y1-y0)
+ } {
+ 3 1 roll div % x x1-x0 y/(y1-y0)
3 1 roll div % y/(y1-y0) x/(x1-x0)
exch % x/(x1-x0) y/(y1-y0)
} ifelse
- } {
- pop pop pop 1 1 % default to unity scaling
- } ifelse % if we have /BBox
+ } {
+ pop pop pop 1 1 % default to unity scaling
+ } ifelse % if we have /BBox
} {
- pop pop 1 1
+ pop pop 1 1
} ifelse % if we have /N
} {
pop pop 1 1
@@ -2287,7 +2285,7 @@ currentdict /set_bc_color undef
% Draw an annotation.
/drawannottypes 20 dict begin
- % x0 y0 x1 y1 x2 y2 x3 y3 -> x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
+ % x0 y0 x1 y1 x2 y2 x3 y3 -> x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
/quadpoints2basis {
8 { oforce 8 1 roll } repeat
@@ -2301,7 +2299,7 @@ currentdict /set_bc_color undef
2 index 1 index eq {
3 index 2 index gt {
4 2 roll
- } if
+ } if
} {
2 index 1 index gt {
4 2 roll
@@ -2318,7 +2316,7 @@ currentdict /set_bc_color undef
% * (x2,y2) * (x3,y3)
% |
% |
- % *------------*->
+ % *------------*->
% (x0,y0) (x1,y1)
pop pop % x0 y0 x1 y1 x2 y2
@@ -2326,8 +2324,8 @@ currentdict /set_bc_color undef
5 index sub exch % x0 y0 x1 y1 x2-x0 y2-y0
4 2 roll
4 index sub exch % x0 y0 x2-x0 y2-y0 y1-y0 x1
- 5 index sub exch % x0 y0 x2-x0 y2-y0 x1-x0 y1-y0
- 4 2 roll % x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
+ 5 index sub exch % x0 y0 x2-x0 y2-y0 x1-x0 y1-y0
+ 4 2 roll % x0 y0 x1-x0 y1-y0 x2-x0 y2-y0
} bdef
/Link { % <annot> -> <false>
@@ -2347,7 +2345,7 @@ currentdict /set_bc_color undef
3 index annotrect pop pop translate
scale
/InkList knownoget {
- { oforce
+ { oforce
mark exch { oforce } forall
.pdfinkpath
stroke
@@ -2483,13 +2481,13 @@ currentdict /set_bc_color undef
1 index 72 div 1 index 72 div translate % the line in the box is 1/72 up
2 copy dup mul exch dup mul add sqrt % x1-x0 y1-y0 x2-x0 y2-y0 |p2|
4 index dup mul 4 index dup mul add sqrt % x1-x0 y1-y0 x2-x0 y2-y0 |p2| |p1|
- dup 0 gt 2 index 0 gt and {
- div % x1-x0 y1-y0 x2-x0 y2-y0 |p2|/|p1|=p12
+ dup 0 gt 2 index 0 gt and {
+ div % x1-x0 y1-y0 x2-x0 y2-y0 |p2|/|p1|=p12
dup 1 exch div 4 mul 1 add cvi exch 6 2 roll % cnt p12 x1-x0 y1-y0 x2-x0 y2-y0
4 2 roll % cnt p12 x2-x0 y2-y0 x1-x0 y1-y0
4 index mul exch 4 index mul exch % cnt p12 x2-x0 y2-y0 (x1-x0)*p12 (y1-y0)*p12
4 2 roll 0 0 6 array astore concat % cnt p12
- 1 40 div 1 72 div scale
+ 1 40 div 1 72 div scale
pop % cnt
0 0 moveto
1 setlinecap
@@ -2498,7 +2496,7 @@ currentdict /set_bc_color undef
{
5 10 lineto
10 0 lineto
- 10 0 translate
+ 10 0 translate
} repeat
stroke
} {
@@ -2540,15 +2538,15 @@ currentdict /set_bc_color undef
//false
} ifelse
} bdef
-
+
/frame {
{ 255 div } forall setrgbcolor
-95 -25 translate
2 190 atan rotate
{
6 0 moveto
- 190 0 190 6 6 arct
- 190 47 184 47 6 arct
+ 190 0 190 6 6 arct
+ 190 47 184 47 6 arct
0 47 0 41 6 arct
0 0 6 0 6 arct
closepath
@@ -2566,7 +2564,7 @@ currentdict /set_bc_color undef
} bdef
% (text) y h -> -
- /text {
+ /text {
/Times-Bold findfont exch scalefont setfont % (text) y
gsave
0 0 moveto
@@ -2577,7 +2575,7 @@ currentdict /set_bc_color undef
gsave 1 -1 rmoveto 0.75 setgray dup show grestore
show
} bdef
-
+
/red <ef4023> readonly def
/green <3fae49> readonly def
/blue <0072bc> readonly def
@@ -2656,7 +2654,7 @@ currentdict /set_bc_color undef
4 2 roll % dx dy x0 y0
2 index 2 div add exch
3 index 2 div add exch translate % dx dy
-
+
50 div exch 190 div .min dup scale
/Name knownoget not { /Draft } if
@@ -2745,7 +2743,7 @@ currentdict /drawannottypes undef
/File 1000 string dup 3 1 roll def
/Length 0 def
% <acroform> <field> <annot> (string)
- /NullEncode filter % <acroform> <field> <annot> file
+ /NullEncode filter % <acroform> <field> <annot> file
dup (BT ) writestring
2 index /DA pget not { () } if
@@ -2825,7 +2823,7 @@ currentdict end def
dup /Fields knownoget {
{ oforce draw_form_field } forall
} if
- pop
+ pop
} bdef
currentdict /draw_terminal_field_dict undef
diff --git a/gs/Resource/Init/pdf_font.ps b/gs/Resource/Init/pdf_font.ps
index a3d6e5540..cbf98cc5a 100644
--- a/gs/Resource/Init/pdf_font.ps
+++ b/gs/Resource/Init/pdf_font.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -52,7 +52,7 @@ pdfdict begin
% Apply a list of differences to an Encoding.
% Note that the differences may cause the array to grow.
/updateencoding { % <encoding|null> <differences> updateencoding <enc'>
- % Calculate the length of the result.
+ % Calculate the length of the result.
% in case the incoming Encoding is null, use .notdefEncoding
exch dup //null eq { pop .notdefEncoding } if
0 0 3 index {
@@ -63,7 +63,7 @@ pdfdict begin
} forall
pop 1 index length .max array dup 0 4 -1 roll putinterval
exch 0 exch {
- % Stack: enc' code element
+ % Stack: enc' code element
dup type /nametype ne
{ exch pop oforce }
{ 3 copy put pop 1 add }
@@ -92,7 +92,7 @@ pdfdict begin
% some buggy applications that rely on this, we do the same.
//good_encoding_names 1 index known {
- exch /BaseFont knownoget not { 0 } if
+ exch /BaseFont knownoget not { 0 } if
% Ignore named encodings for known symbolic fonts. See bug 690135.
//known_symbolic_fonts exch known {
pop
@@ -105,22 +105,22 @@ pdfdict begin
}
{ exch pop
dup type /arraytype eq
- { exch pop
- ( **** Warning: Encoding is an array, not name or dictionary.\n) pdfformaterror
- }
- { dup /BaseEncoding knownoget
- { dup / eq
- { pop
- ( **** Warning: Ignoring bad BaseEncoding name.\n) pdfformaterror
- % as found in a PDF file from J.D.Edwards OneWorld (B7333), bug 687786
- }
- { findencoding 3 -1 roll pop exch }
- ifelse
- }
- if
- /Differences knownoget { updateencoding } if
- }
- ifelse
+ { exch pop
+ ( **** Warning: Encoding is an array, not name or dictionary.\n) pdfformaterror
+ }
+ { dup /BaseEncoding knownoget
+ { dup / eq
+ { pop
+ ( **** Warning: Ignoring bad BaseEncoding name.\n) pdfformaterror
+ % as found in a PDF file from J.D.Edwards OneWorld (B7333), bug 687786
+ }
+ { findencoding 3 -1 roll pop exch }
+ ifelse
+ }
+ if
+ /Differences knownoget { updateencoding } if
+ }
+ ifelse
}
ifelse
} {
@@ -136,11 +136,11 @@ currentdict /known_symbolic_fonts undef
/checkGlyphNames2Unicode % <dict> checkGlyphNames2Unicode -
{
PDFDEBUG {
- dup /FontInfo .knownget {
- /GlyphNames2Unicode .knownget {
+ dup /FontInfo .knownget {
+ /GlyphNames2Unicode .knownget {
(Has GlyphNames2Unicode) =
- pop % { exch //== exec //== exec} forall
- } if
+ pop % { exch //== exec //== exec} forall
+ } if
} if
} if
pop
@@ -156,12 +156,12 @@ currentdict /known_symbolic_fonts undef
% Get the (possibly modified) encoding of a font.
/getfontencoding { % <font-resource> <font> getfontencoding
- % <font-resource> <font> <Encoding|null>
+ % <font-resource> <font> <Encoding|null>
% Ignore encoding when TrueType is requested
% and loaded from an embedded stream.
% All other cases are left unchanged.
dup /FontType get 42 eq 1 index /PathLoad known not and
- 2 index /Subtype get /TrueType eq and {
+ 2 index /Subtype get /TrueType eq and {
//null
} {
1 index /Encoding known {
@@ -180,18 +180,18 @@ currentdict /known_symbolic_fonts undef
/match_in_diff % <Differences> <index> <glyphname> match_in_diff <bool>
{ //false 4 1 roll 0 4 -1 roll % stack: false index glyphname at_index==0 Differences
{ exch 1 index type /nametype ne {
- % stack: false index glyphname Diff_element at_index
+ % stack: false index glyphname Diff_element at_index
pop % Diff_element is new at_index
} {
- % stack: false index glyphname Diff_element at_index
+ % stack: false index glyphname Diff_element at_index
exch 2 index eq {
- % stack: false index glyphname at_index
- dup 3 index eq {
+ % stack: false index glyphname at_index
+ dup 3 index eq {
//true 5 1 roll % stack: true false index glyphname at_index
pop exit
} if
} if
- 1 add % at_index++ stack: false index glyphname at_index'
+ 1 add % at_index++ stack: false index glyphname at_index'
} ifelse
} forall
% stack: true false index glyphname
@@ -199,7 +199,7 @@ currentdict /known_symbolic_fonts undef
pop pop pop
} bdef
-/unique_name { % <dict> </root> unique_name </unique>
+/unique_name { % <dict> </root> unique_name </unique>
%
% Note : this function interacts with pdf_write_encoding in src/gdevpdtw.c
% and with copied_drop_extension_glyphs in src\gxfcopy.c
@@ -220,7 +220,7 @@ currentdict /known_symbolic_fonts undef
} for
exch pop cvn % /root0
} bdef
-
+
% Get the metrics of a font, if specified.
/getfontmetrics { % <font-resource> <font> <Encoding|null> getfontmetrics
% <font-resource> <font> <Encoding|null>
@@ -242,20 +242,20 @@ currentdict /known_symbolic_fonts undef
% by scaling the Widths if necessary.
0.001 2 index /FontMatrix get 0 get
dup 0 eq {
- % FontMatrix.xx == 0, so we cannot scale down by xx.
- % - FontMatrix[0] == 0 implies either FontMatrix[1] <> 0 or
- % FontMatrix cannot be inverted. In the 1st case we have
- % FontMatrixNonHV == true and will render text with cshow + xshow.
- % In the 2nd case, metrics in the PDF Font object cannot be enforced
- % [by altering metrics in PS glyph space].
- % HACK:
- % - we scale down by FontMatrix[1];
- % - given the format of Metrics entries we use, wy = 0 in glyph space;
- % - as a result, the cshow procedure receives as wy the value we
- % need for wx (all of this in PS user space).
- pop
- 2 index /FontMatrix get 1 get
- dup 0 eq { pop 1 } if % sorry, no way to enforce PDF metrics by altering the font
+ % FontMatrix.xx == 0, so we cannot scale down by xx.
+ % - FontMatrix[0] == 0 implies either FontMatrix[1] <> 0 or
+ % FontMatrix cannot be inverted. In the 1st case we have
+ % FontMatrixNonHV == true and will render text with cshow + xshow.
+ % In the 2nd case, metrics in the PDF Font object cannot be enforced
+ % [by altering metrics in PS glyph space].
+ % HACK:
+ % - we scale down by FontMatrix[1];
+ % - given the format of Metrics entries we use, wy = 0 in glyph space;
+ % - as a result, the cshow procedure receives as wy the value we
+ % need for wx (all of this in PS user space).
+ pop
+ 2 index /FontMatrix get 1 get
+ dup 0 eq { pop 1 } if % sorry, no way to enforce PDF metrics by altering the font
} if
div
% Stack: font font-res mscale
@@ -274,12 +274,12 @@ currentdict /known_symbolic_fonts undef
} if
1 index /FontDescriptor knownoget {
- /MissingWidth knownoget not { 0 } if
- }
- { 1000
- }
+ /MissingWidth knownoget not { 0 } if
+ }
+ { 1000
+ }
ifelse /MissingWidth exch def
-
+
Widths length LastChar FirstChar sub le {
( **** Warning: Font Widths array size is smaller than character range.\n)
pdfformaterror
@@ -287,7 +287,7 @@ currentdict /known_symbolic_fonts undef
} if
FirstChar
- 0 Encoding
+ 0 Encoding
{ % Stack: font font-res mscale first-char index charname
1 index FirstChar lt { MissingWidth } {
@@ -297,7 +297,7 @@ currentdict /known_symbolic_fonts undef
% Stack: font font-res mscale first-char index charname width
4 index mul
% The following 'loop' is only context for 'exit'.
- {
+ {
% Work around a bug in pdfTeX, which can generate Encoding
% vectors containing nulls :
1 index //null eq { exit } if
@@ -308,9 +308,9 @@ currentdict /known_symbolic_fonts undef
} ifelse {
% Two or more Encoding elements refer same glyph name,
% and Widths specify different wihts for it.
- % Since a Postscript font can't have different
- % Metrics for same glyph name,
- % we generate an unique name, and create a new
+ % Since a Postscript font can't have different
+ % Metrics for same glyph name,
+ % we generate an unique name, and create a new
% Charstrings entry with same glyph value.
GlyphMap //null eq {
/Encoding Encoding dup length array copy def
@@ -360,16 +360,16 @@ currentdict /unique_name undef
currentdict /match_in_diff undef
/ToUnicodeCMapReader 3 dict begin
- /defineresource % <name> <dict> <cat-name> defineresource <dict>
+ /defineresource % <name> <dict> <cat-name> defineresource <dict>
{
- pop
+ pop
dup userdict exch /.lastToUnicode exch put
exch pop
} bind def
- /CIDSystemInfo
- {
+ /CIDSystemInfo
+ {
( **** Warning: ToUnicode CMap has invalid syntax near CIDSystemInfo.\n) pdfformaterror
- /CIDSystemInfo
+ /CIDSystemInfo
} bind def % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
/CMapName
{
@@ -391,14 +391,14 @@ currentdict end readonly def
{
{ //true
} {
- currentdict gcheck {
+ currentdict gcheck {
dup gcheck not
} {
//false
} ifelse
} ifelse
- { currentglobal currentdict gcheck setglobal
- exch dup length string copy exch
+ { currentglobal currentdict gcheck setglobal
+ exch dup length string copy exch
setglobal
} if
def
@@ -412,7 +412,7 @@ currentdict end readonly def
3 2 roll begin
/.CodeMapData get % About the data format see gs_cmap.ps, the comment after "CMap operators".
1 get % code maps
- {
+ {
PDFDEBUG {
dup //== exec
} if
@@ -440,7 +440,7 @@ currentdict end readonly def
4 index exch get
} if
} if % e [] i (values) cid|name
- exch
+ exch
PDFDEBUG {
( defined single: ) print 1 index =string cvs print ( ) print dup //== exec
} if
@@ -450,7 +450,7 @@ currentdict end readonly def
% A range. % e [] i offset key_size value_size (keys) (values)
dup length string copy % protect the original string from modifications below.
0 4 index 2 mul 3 index length 1 sub { % e [] i offset key_size value_size (keys) (values) j
- 2 index 1 index 6 index getinterval
+ 2 index 1 index 6 index getinterval
string2number % e [] i offset key_size value_size (keys) (values) j keyL
PDFDEBUG {
( keyL=) print dup =string cvs print
@@ -493,11 +493,11 @@ currentdict end readonly def
/.processToUnicode % <font-resource> <font-dict> <encoding|null> .processToUnicode -
{
- % Currently pdfwrite is only device which can handle GlyphNames2Unicoide to
+ % Currently pdfwrite is only device which can handle GlyphNames2Unicoide to
% generate a ToUnicode CMaps. So don't bother with other devices.
currentdevice 1 dict dup /WantsToUnicode dup put .getdeviceparams
dup type /booleantype eq not {cleartomark false}{3 1 roll cleartomark}ifelse
-% currentdevice .devicename /pdfwrite eq
+% currentdevice .devicename /pdfwrite eq
{
PDFDEBUG {
(.processToUnicode beg) =
@@ -527,7 +527,7 @@ currentdict end readonly def
/CMapType 2 def
mark exch % emulate 'begincodespacerange'
0 (endcmap) /SubFileDecode filter cvx /begincmap cvx exch 2 .execn
- endcmap
+ endcmap
userdict /.lastToUnicode currentdict put
end end end
@@ -594,7 +594,6 @@ currentdict end readonly def
% ---------------- Utilities ---------------- %
-
/.pdforigfontcache_g 20 dict def
currentglobal //false setglobal
systemdict /.pdforigfontcache_l 20 dict .forceput
@@ -608,7 +607,7 @@ setglobal
dup .pdforigfontcache_l exch .knownget {
exch pop
} {
- dup findfont dup
+ dup findfont dup
dup gcheck { //.pdforigfontcache_g } { .pdforigfontcache_l } ifelse
% Stack : font_name font font cache
4 2 roll .growput
@@ -645,22 +644,22 @@ setglobal
/defaultfontname /Helvetica
.dicttomark readonly def
/pdffindfont { % <font-resource> <fontname> pdffindfont <font>
- % If the font isn't available, synthesize one based on
- % its descriptor.
+ % If the font isn't available, synthesize one based on
+ % its descriptor.
dup /Font resourcestatus {
pop pop pdffindcachedfont
} {
1 index /FontDescriptor knownoget {
- % Stack: font-res fontname fontdesc
+ % Stack: font-res fontname fontdesc
dup /Flags oget
dup 16#40 and -6 bitshift % 1, oblique/italic
1 index 16#40000 and -17 bitshift add % 2, bold
exch 16#2 and 2 bitshift add % 8, serif
- % We should look at the fixed flag, too.
- % Stack: font-res fontname fontdesc properties
+ % We should look at the fixed flag, too.
+ % Stack: font-res fontname fontdesc properties
% Even though /FontName is a required key in FontDescriptor dict
- % (As of the PDF 1.4 Reference Manual), In the case of missing
+ % (As of the PDF 1.4 Reference Manual), In the case of missing
% /FontName key, we substitue /BaseFont for the value of /FontName.
% Yet another case of broken PDF's that Adobe Reader accepts.
1 index dup /FontName known {
@@ -677,45 +676,45 @@ setglobal
} ifelse
.remove_font_name_prefix
exch
- % Analyzes font name and extract "Bold" and "Narrow" properties
- % which are not described by the FontDescriptor Flags.
+ % Analyzes font name and extract "Bold" and "Narrow" properties
+ % which are not described by the FontDescriptor Flags.
0 2 index .fontnameproperties 6 and or
- % Rebind the default font name to Helvetica so that
- % fonts with no properties are handled correctly.
+ % Rebind the default font name to Helvetica so that
+ % fonts with no properties are handled correctly.
//.pdfdfndict begin .substitutefontname end
- % Stack: font-res fontname fontdesc substname|null
+ % Stack: font-res fontname fontdesc substname|null
Fontmap 1 index known not {
- % No available good substitution, use the standard one.
- pop 1 index .substitutefont
+ % No available good substitution, use the standard one.
+ pop 1 index .substitutefont
} if
dup 3 index ne QUIET not and {
- (Substituting font ) print dup =only
- ( for ) print 2 index =only (.) = flush
+ (Substituting font ) print dup =only
+ ( for ) print 2 index =only (.) = flush
} if
pdffindcachedfont
- % Stack: font-res fontname fontdesc font
- % If this is a small-caps font, replace the CharString
- % entries for a..z.
+ % Stack: font-res fontname fontdesc font
+ % If this is a small-caps font, replace the CharString
+ % entries for a..z.
exch /Flags oget 16#20000 and 0 ne {
- //true .copyfontdict
- dup /CharStrings 2 copy get dup length dict .copydict
- % stack: font-res fontname font font /CharStrings CharStringsdict
- 5 index /FirstChar get 97 .max
- 6 index /LastChar get 122 .min 1 exch {
- % Stack: font-res fontname font' font' /CharStrings charstrings code
- % Note that this only remaps a-z, not accented characters.
- 6 index /Widths oget 1 index 8 index /FirstChar get sub oget
- 1 string dup 0 5 -1 roll put
- % Stack: font-res font' font' /CharStrings charstrings code
- % width (x)
- 2 index exch dup cvn exch
- dup 0 2 copy get 32 sub put 4 -1 roll {
- % Stack: operand (X) width
- 0 setcharwidth exch pop
- currentfont /FontMatrix get matrix invertmatrix concat
- 0.7 dup scale 0 0 moveto show
- } /exec cvx 4 packedarray cvx put
- } for put
+ //true .copyfontdict
+ dup /CharStrings 2 copy get dup length dict .copydict
+ % stack: font-res fontname font font /CharStrings CharStringsdict
+ 5 index /FirstChar get 97 .max
+ 6 index /LastChar get 122 .min 1 exch {
+ % Stack: font-res fontname font' font' /CharStrings charstrings code
+ % Note that this only remaps a-z, not accented characters.
+ 6 index /Widths oget 1 index 8 index /FirstChar get sub oget
+ 1 string dup 0 5 -1 roll put
+ % Stack: font-res font' font' /CharStrings charstrings code
+ % width (x)
+ 2 index exch dup cvn exch
+ dup 0 2 copy get 32 sub put 4 -1 roll {
+ % Stack: operand (X) width
+ 0 setcharwidth exch pop
+ currentfont /FontMatrix get matrix invertmatrix concat
+ 0.7 dup scale 0 0 moveto show
+ } /exec cvx 4 packedarray cvx put
+ } for put
} if
dup /FontName get 2 index ne {
//true .copyfontdict
@@ -723,7 +722,7 @@ setglobal
} if
exch pop .completefont
} {
- % No descriptor available, use the default algorithm.
+ % No descriptor available, use the default algorithm.
pdffindcachedfont
} ifelse
} ifelse
@@ -765,7 +764,7 @@ setglobal
/WMode
/Encoding
/FontBBox
- /UniqueID
+ /UniqueID
/XUID
/PaintType
/StrokeWidth
@@ -823,7 +822,7 @@ setglobal
currentdict end readonly def
/eexec {
- % Assume the font dictionary is directly below the file on the stack
+ % Assume the font dictionary is directly below the file on the stack
count 0 gt { /topFontDict 2 index cvlit store } if
//eexec_pdf_param_dict /eexecDecode filter
@@ -888,12 +887,12 @@ currentdict /eexec_pdf_param_dict .undef
exch {
//false /PFBDecode filter % pos res file'
} if
- % Some buggy embedded fonts leave extra junk on the stack,
- % so we have to make a closure that records the stack depth
- % in a fail-safe way. This code also removes the mark when
+ % Some buggy embedded fonts leave extra junk on the stack,
+ % so we have to make a closure that records the stack depth
+ % in a fail-safe way. This code also removes the mark when
% the implied cleartomark is not executed, i.e. Length3 == 0.
% Also restore dictstack depth.
- %
+ %
//systemdict begin
//readtype1dict dup length 5 add dict copy begin % pos res file'
/file-position 4 -1 roll def % res file'
@@ -914,16 +913,16 @@ currentdict /eexec_pdf_param_dict .undef
/buildType3 { % <Type3-font-resource> buildType3 <font>
8 dict begin
/FontType 3 def
- % If the font does not contain a Resources entry, then we use
- % the resources from our current context. Page 391 of the PDF
- % 1.6 spec says that the Resources dict is optional and if not
- % present then we should use the Resources for the page.
- % However we have a test file (687989) which uses a Type3 font
- % inside a form XObject and the desired Resources are in the
- % XObject dict and not in the Page dict. So we are going to
- % the parent object to find resources instead of only going to
- % the page dict when a font does not specify its required
- % resources.
+ % If the font does not contain a Resources entry, then we use
+ % the resources from our current context. Page 391 of the PDF
+ % 1.6 spec says that the Resources dict is optional and if not
+ % present then we should use the Resources for the page.
+ % However we have a test file (687989) which uses a Type3 font
+ % inside a form XObject and the desired Resources are in the
+ % XObject dict and not in the Page dict. So we are going to
+ % the parent object to find resources instead of only going to
+ % the page dict when a font does not specify its required
+ % resources.
/Resources 1 index /Resources knownoget {
oforce
} {
@@ -939,18 +938,18 @@ currentdict /eexec_pdf_param_dict .undef
} if
/FontName 1 index /Name knownoget not { /PDFType3Untitled } if def
/Encoding .notdefEncoding 2 index getencoding def
- % We have to define BuildChar rather than BuildGlyph:
- % there is no PDF equivalent of glyphshow, and we need
- % the character code to access the Widths.
+ % We have to define BuildChar rather than BuildGlyph:
+ % there is no PDF equivalent of glyphshow, and we need
+ % the character code to access the Widths.
/BuildChar {
- % Stack: font charcode
+ % Stack: font charcode
1 index begin 3 dict begin
/Font 3 -1 roll def /CharCode 1 index def
Encoding exch get CharProcs exch knownoget {
{ //false resolvestream
- % Stack: filepos stream
- % Don't let setgcolor set the color inside the BuildGlyph
- % procedure, because this causes an /undefined error.
+ % Stack: filepos stream
+ % Don't let setgcolor set the color inside the BuildGlyph
+ % procedure, because this causes an /undefined error.
q //null /FillColor gput //null /StrokeColor gput
Font /Resources get exch pdfopdict .pdfruncontext
Q
@@ -1023,7 +1022,7 @@ currentdict /eexec_pdf_param_dict .undef
1 index exch
PDFfile fileposition 3 1 roll
//true resolvestream readfontfilter
- % Stack: filepos fontres stream
+ % Stack: filepos fontres stream
1 index /CIDSystemInfo oknown {
1 index /Subtype knownoget {
/CIDFontType2 ne {
@@ -1036,9 +1035,9 @@ currentdict /eexec_pdf_param_dict .undef
1 index /BaseFont get % Use the BaseFont name for the font. Otherwise we
% would use the name table, or a manufactured name.
.loadttcidfont
- % Stack: filepos fontres cidfont
+ % Stack: filepos fontres cidfont
} {
- % filepos fontres stream
+ % filepos fontres stream
1 index /FontDescriptor oget
/Flags get 4 and 0 ne {
//true % symbolic
@@ -1049,7 +1048,7 @@ currentdict /eexec_pdf_param_dict .undef
//null
} {
StandardEncoding
- 3 index getencoding
+ 3 index getencoding
} ifelse % filepos fontres stream is_symbolic Encoding
dup 4 index exch % filepos fontres stream is_symbolic Encoding fontres Encoding
/prebuilt_encoding exch put % filepos fontres stream is_symbolic Encoding
@@ -1057,7 +1056,7 @@ currentdict /eexec_pdf_param_dict .undef
} ifelse
exch pop
PDFfile 3 -1 roll setfileposition
- % Ignore both the Encoding and the Widths.
+ % Ignore both the Encoding and the Widths.
exch pop
} bdef
@@ -1085,14 +1084,14 @@ currentdict /eexec_pdf_param_dict .undef
/CMapVersion 1 def
/CMapType 1 def
%WMode (see above)
- % The PDF documentation says that these CMaps map CIDs
- % "1 to 65,536". This is a misprint for 0 to 65,535.
+ % The PDF documentation says that these CMaps map CIDs
+ % "1 to 65,536". This is a misprint for 0 to 65,535.
1 begincodespacerange
- % <0001> <00ff> <0100> <ffff>
+ % <0001> <00ff> <0100> <ffff>
<0000> <ffff>
endcodespacerange
1 begincidrange
- % <0001> <00ff> 1 <0100> <ffff> 256
+ % <0001> <00ff> 1 <0100> <ffff> 256
<0000> <ffff> 0
endcidrange
endcmap
@@ -1104,16 +1103,16 @@ currentdict /eexec_pdf_param_dict .undef
} bdef
/CMap_read_dict 3 dict begin
- /defineresource % <name> <dict> <cat-name> defineresource <dict>
+ /defineresource % <name> <dict> <cat-name> defineresource <dict>
{
- pop
+ pop
/.last_CMap_def 1 index store
exch pop
} bdef
- /CIDSystemInfo
- {
+ /CIDSystemInfo
+ {
( **** Warning: CMap has invalid syntax near CIDSystemInfo.\n) pdfformaterror
- /CIDSystemInfo
+ /CIDSystemInfo
} bdef % A work around a bug in Altona.Page_3.2002-09-27.pdf - a slash is missed.
/CMapName
{
@@ -1127,7 +1126,7 @@ currentdict end readonly def
% Following Acrobat we ignore everything outside
% begincodespacerange .. endcmap.
/read_CMap { % <name> <1> <stream> read_CMap <CMap>
- % <2> <stream> read_CMap <CMap>
+ % <2> <stream> read_CMap <CMap>
dup 0 (begincodespacerange) /SubFileDecode filter flushfile
//CMap_read_dict begin
@@ -1137,7 +1136,7 @@ currentdict end readonly def
/CMapType 3 -1 roll def
mark exch % emulate 'begincodespacerange'
0 (endcmap) /SubFileDecode filter cvx /begincmap cvx exch 2 .execn
- endcmap
+ endcmap
/.last_CMap_def load
{ currentdict end //CMap_read_dict eq { exit } if } loop
@@ -1154,10 +1153,10 @@ currentdict /CMap_read_dict undef
1 index /Encoding oget
dup type /nametype eq {
dup /CMap resourcestatus {
- pop pop /CMap findresource
+ pop pop /CMap findresource
} {
- knownCMaps 1 index .knownget
- { exch pop exec } { /undefined signalerror } ifelse
+ knownCMaps 1 index .knownget
+ { exch pop exec } { /undefined signalerror } ifelse
} ifelse
} {
PDFfile fileposition exch
@@ -1170,12 +1169,12 @@ currentdict /CMap_read_dict undef
3 index /DescendantFonts oget { exec resourcefont } forall
] % subfonts
.composefontdict % composefont must insert FontInfo dictionary - see gs_cmap.ps .
- % Stack: fontres name font
+ % Stack: fontres name font
3 copy exch pop //null .processToUnicode
exch pop .completefont % Stack: fontres font
1 index /FontMatrix knownoget {
dup aload pop //true {0 0 1 0 0 1} {3 -1 roll eq and} forall {
- 1 index exch makefont exch /FontName get exch
+ 1 index exch makefont exch /FontName get exch
exch pop .completefont
} {
pop
@@ -1200,7 +1199,7 @@ currentdict /CMap_read_dict undef
dup /FID undef
dup /UniqueID undef
dup /XUID undef
- % Insert the widths into the font.
+ % Insert the widths into the font.
% Stack: pdfresource newfont
@@ -1245,7 +1244,7 @@ currentdict /CMap_read_dict undef
%
% for detail of the metrics list format in PDF,
% refer PDF Ref. p.317 "Glyph Metrics in CIDFonts".
- %
+ %
% format of single entry in internal expression
%
% [
@@ -1304,7 +1303,7 @@ currentdict /CMap_read_dict undef
exch
{
- {
+ {
dup 0 get {} forall % Stack: <cid> <entry> <cid_0> <cid_1>
3 index lt { pop pop //false exit } if
2 index exch sub dup 0 lt { pop pop //false exit } if
@@ -1316,11 +1315,10 @@ currentdict /CMap_read_dict undef
dup type /arraytype eq { exch pop //true } { pop //false } ifelse
} def
-
% Apply the [D]W[2] metrics to a character before displaying.
/CIDWProc { % <w0x> <w0y> <llx> <lly> <urx> <ury>
- % <w1x> <w1y> <vx> <vy> <cid> <font> CIDWproc
- % <w0x'> ... <vy'>
+ % <w1x> <w1y> <vx> <vy> <cid> <font> CIDWproc
+ % <w0x'> ... <vy'>
begin % push <font> to currentdict
% <w1x> <w1y> <vx> <vy> won't be used and replaced, discard now
5 1 roll pop pop pop pop
@@ -1331,11 +1329,11 @@ currentdict /CMap_read_dict undef
% if the currentfont is a CIDFontType 0 CIDFont,
% we need FDArray font's FontMatrix too
FontType 9 eq {
- currentdict 2 index .type9mapcid
- % <w0x> <w0y> <llx> <lly> <urx> <ury> <cid> <FontMatrix> (charstring) <FDArray#>
- exch pop currentdict /FDArray get exch get /FontMatrix get
- % <w0x> <w0y> <llx> <lly> <urx> <ury> <cid> <FontMatrix> <FontMatrix2>
- matrix concatmatrix
+ currentdict 2 index .type9mapcid
+ % <w0x> <w0y> <llx> <lly> <urx> <ury> <cid> <FontMatrix> (charstring) <FDArray#>
+ exch pop currentdict /FDArray get exch get /FontMatrix get
+ % <w0x> <w0y> <llx> <lly> <urx> <ury> <cid> <FontMatrix> <FontMatrix2>
+ matrix concatmatrix
} if
% preserve this FontMatrix at bottom of the stack
8 1 roll
@@ -1403,7 +1401,7 @@ currentdict /CMap_read_dict undef
% Stack: <FontMatrix> <w0x'> <w0y'> <llx> <lly> <urx> <ury>
% <w1x'> { [<vy'> <w1y'>] | [<w1y'> <vx'> <vy'>] }
dup length 2 eq { % this is DW2
- aload pop
+ aload pop
exch 8 index 2 div % <vx'> = <w0x'> / 2
exch
} { % assume W2
@@ -1415,8 +1413,8 @@ currentdict /CMap_read_dict undef
10 -2 roll
% Stack: <FontMatrix> <llx> <lly> <urx> <ury> <w1x'> <w1y'> <vx'> <vy'> <w0x'> <w0y'>
3 {
- 10 index idtransform exch 1000 div exch 1000 div
- 6 2 roll
+ 10 index idtransform exch 1000 div exch 1000 div
+ 6 2 roll
} repeat
10 2 roll
% Stack: <FontMatrix> <w0x'> <w0y'> <llx> <lly> <urx> <ury> <w1x'> <w1y'> <vx'> <vy'>
@@ -1507,7 +1505,7 @@ currentdict /CMap_read_dict undef
exit
} if
QUIET not {
- (Can't find CID font ") print dup =string cvs print (".) =
+ (Can't find CID font ") print dup =string cvs print (".) =
} if
pop
@@ -1520,11 +1518,11 @@ currentdict /CMap_read_dict undef
} if
exch pop
dup /CIDFont resourcestatus {
- pop pop /CIDFont findresource exit
+ pop pop /CIDFont findresource exit
} if
QUIET not {
- (The substitute CID font ") print dup =string cvs print
- (" is not provided either. Will exit with error.) =
+ (The substitute CID font ") print dup =string cvs print
+ (" is not provided either. Will exit with error.) =
} if
/findresource cvx /undefined signalerror
} loop
@@ -1545,19 +1543,19 @@ currentdict /CMap_read_dict undef
pop
} {
//true resolvestream
- % Stack: filepos fontres font mapstream
- % Can't know the length of the decompressed stream, so allocate a big buffer...
+ % Stack: filepos fontres font mapstream
+ % Can't know the length of the decompressed stream, so allocate a big buffer...
dup 65534 string readstring {
- % Length exceeded max string size, use an array of two strings
- 1 index 65534 string readstring pop % maybe a null string - not important.
- 2 array astore
- % Stack: filepos fontres font mapstream array
- dup 1 get length 65534 add
+ % Length exceeded max string size, use an array of two strings
+ 1 index 65534 string readstring pop % maybe a null string - not important.
+ 2 array astore
+ % Stack: filepos fontres font mapstream array
+ dup 1 get length 65534 add
} {
dup length
} ifelse
2 idiv
- % Stack: filepos fontres font mapstream array/string CIDCount
+ % Stack: filepos fontres font mapstream array/string CIDCount
3 index exch /CIDCount exch put
exch closefile exch
dup /CIDMap 4 -1 roll put
@@ -1588,9 +1586,9 @@ currentdict /CMap_read_dict undef
1 index exch
PDFfile fileposition 3 1 roll
dup //true resolvestream dup readfontfilter
- % Stack: pos resource streamdict stream filter
+ % Stack: pos resource streamdict stream filter
3 index /FontDescriptor oget /FontName oget
- 1 index
+ 1 index
/FontSetInit /ProcSet findresource begin //true //false ReadData
{ exch pop exit } forall
7 1 roll
@@ -1603,16 +1601,16 @@ currentdict /CMap_read_dict undef
/readCIDFontType0C { % <font-resource> <stream-dict> readCIDFontType0C <font>
PDFfile fileposition 3 1 roll
dup //true resolvestream dup readfontfilter
- % Stack: pos resource streamdict stream filter
+ % Stack: pos resource streamdict stream filter
3 index /FontDescriptor oget /FontName oget
- 1 index
+ 1 index
/FontSetInit /ProcSet findresource begin //true //true ReadData pop
closefile closefile pop
PDFfile 3 -1 roll setfileposition
- % Some broken Adobe software produces PDF files in which
- % the FontName of the CFF font and the FontName in the
- % FontDescriptor don't match the BaseFont in the font.
- % Use the FontName, rather than the BaseFont, here.
+ % Some broken Adobe software produces PDF files in which
+ % the FontName of the CFF font and the FontName in the
+ % FontDescriptor don't match the BaseFont in the font.
+ % Use the FontName, rather than the BaseFont, here.
dup /FontDescriptor oget /FontName oget /CIDFont findresource
addCIDmetrics dup /CIDFontName get exch /CIDFont defineresource
} bdef
@@ -1726,18 +1724,18 @@ currentdict /CMap_read_dict undef
/font_tag_dict 13 dict begin
% When the font stream is absent or cannot be read we load the font by the name.
- /no_stream
- { pop pop
+ /no_stream
+ { pop pop
run-fonttypeproc
} bdef
- /bad_stream
+ /bad_stream
{ ( **** Warning: Error reading font stream, loading font by the name\n)
pdfformaterror
//no_stream exec
} bdef
- <8001> % PFB
+ <8001> % PFB
{ dup /PFB //true put
exch pop readtype1
} bdef
@@ -1754,7 +1752,7 @@ currentdict /CMap_read_dict undef
} {
readType1C
} ifelse
- } 6 bndef
+ } 6 bndef
<00010000> (true) (typ1) (ttcf) % TrueType OpenType
{ exch pop readtruetype
@@ -1765,7 +1763,6 @@ currentdict /CMap_read_dict undef
readOTTOfont
} bdef
-
currentdict end readonly def
currentdict /bndef undef
@@ -1773,9 +1770,9 @@ currentdict /bndef undef
{ dup /PSFont .knownget dup {
pop /FID knownoget dup { pop type /fonttype eq } if
} if {
- /PSFont get
+ /PSFont get
} {
-
+
% In the event we have a Type 0 dictionary with a spurious
% FontDescriptor object, remove it here to prevent confusion
% later on.
@@ -1795,7 +1792,7 @@ currentdict /bndef undef
% font-res font-res font-desc /key
2 index 1 index .knownget {
4 1 roll pop pop pop % font-res obj
- } {
+ } {
4 1 roll % /key font-res font-res font-desc
dup /FontFile knownoget not {
@@ -1807,11 +1804,11 @@ currentdict /bndef undef
} if
% /key res res desc stream
dup //null ne {
- PDFfile fileposition
+ PDFfile fileposition
mark {
2 index //true resolvestream dup
4 string readstring pop
- exch closefile
+ exch closefile
} stopped {
cleartomark /bad_stream
} {
@@ -1821,20 +1818,20 @@ currentdict /bndef undef
dup length 4 lt { pop /bad_stream } if
} {
/no_stream
- } ifelse
- % /key res res desc stream tag
+ } ifelse
+ % /key res res desc stream tag
//font_tag_dict 1 index known not {
dup 0 2 getinterval <8001> eq {
0 2 getinterval % /key res res desc stream pfb_tag
- } {
+ } {
(12345678>\n) dup /ASCIIHexEncode filter dup 4 -1 roll writestring closefile
( **** Warning: unrecognized font file starts with <) exch concatstrings
- pdfformaterror
- /no_stream % /key res res desc stream unknown_tag
- } ifelse
- } if
- //font_tag_dict exch get % /key res res desc stream {proc}
+ pdfformaterror
+ /no_stream % /key res res desc stream unknown_tag
+ } ifelse
+ } if
+ //font_tag_dict exch get % /key res res desc stream {proc}
{ stopped } 0 get % /key res res desc stream {proc} --stopped--
count % /key res res desc stream {proc} --stopped-- #
countdictstack % /key res res desc stream {proc} --stopped-- # ##
@@ -1882,7 +1879,7 @@ drawopdict begin
.adjustcharwidth setcharwidth
} bdef
/d1 {
- 2 copy % ... llx lly urx ury | urx ury
+ 2 copy % ... llx lly urx ury | urx ury
0 ne exch 0 ne % ... llx lly urx ury | ury!=0 urx!=0
3 index 6 index eq and % ... llx lly urx ury | ury!=0 (urx!=0 && llx==urx)
exch 2 index 5 index eq and or { % ... llx lly urx ury | (urx!=0 && llx==urx) || (ury!=0 && lly==ury)
diff --git a/gs/Resource/Init/pdf_main.ps b/gs/Resource/Init/pdf_main.ps
index 0c6cc0e2d..b9335cbd0 100644
--- a/gs/Resource/Init/pdf_main.ps
+++ b/gs/Resource/Init/pdf_main.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,7 +30,7 @@ pdfdict begin
/.writepdfmarks { % - .writepdfmarks <bool>
currentdevice //.writepdfmarkdict .getdeviceparams
mark eq { //false } { pop pop //true } ifelse
- systemdict /DOPDFMARKS known or
+ systemdict /DOPDFMARKS known or
} bind def
% For simplicity, we use a single interpretation dictionary for all
@@ -43,11 +43,11 @@ pdfdict begin
/obj { ( **** Warning: Content stream is not terminated by 'endstream'.\n)
pdfformaterror pop pop exit
} bind
- % PDF 1.1 operators
+ % PDF 1.1 operators
/BX { /BXlevel BXlevel 1 add store } bind
/EX { /BXlevel BXlevel 1 sub store } bind
/PS { cvx exec } bind
- % PDF 1.2 operators
+ % PDF 1.2 operators
/BMC {
/BMClevel BMClevel 1 add store
pop
@@ -110,54 +110,54 @@ systemdict begin
} loop
exch pop
{
- % Appletalk PAP sends short strings with %! header expecting a response.
+ % Appletalk PAP sends short strings with %! header expecting a response.
% 'gv' swallows the %!PS line, then sends DSC comments beginning with %%
% and also waits for a response. The following avoids those hangs.
dup 2 string .peekstring pop dup (%!) eq exch (%%) eq or {
cvx .runps
} {
dup 1023 string .peekstring pop dup length 400 ge {
- % "1024 string" exceeds current %stdin buffer
- % Valid PDF file cannot be smaller than 400 bytes.
- (%PDF-) search {
- 3 1 roll pop pop
- dup (%!PS) search not {
- length 0 ne {
- 1 index exch readstring pop pop
- (%stderr) (w) file dup
- ( **** Warning: File has some garbage before %PDF- .\n)
- writestring flushfile
- } {
- pop
- } ifelse
- dup (%stdin) (r) file eq {
- % Copy PDF from stdin to temporary file then run it.
- //null (w+) /.tempfile .systemvar exec exch 3 1 roll
- % stack: tempname stdin tempfile
- 64000 string
- {
- % stack: tempname stdin tempfile string
- 2 index 1 index readstring
- exch 3 index exch writestring
- not { exit } if
- }
- loop
- pop exch closefile
- % stack: tempname tempfile
- dup 0 setfileposition
- dup runpdf
- closefile deletefile
- } {
- runpdf
- } ifelse
- } {
- pop pop pop pop cvx .runps % (%!PS) found first
- } ifelse
- } {
- pop cvx .runps % (%PDF-) not found
- } ifelse
- } {
- pop cvx .runps % too short for PDF
+ % "1024 string" exceeds current %stdin buffer
+ % Valid PDF file cannot be smaller than 400 bytes.
+ (%PDF-) search {
+ 3 1 roll pop pop
+ dup (%!PS) search not {
+ length 0 ne {
+ 1 index exch readstring pop pop
+ (%stderr) (w) file dup
+ ( **** Warning: File has some garbage before %PDF- .\n)
+ writestring flushfile
+ } {
+ pop
+ } ifelse
+ dup (%stdin) (r) file eq {
+ % Copy PDF from stdin to temporary file then run it.
+ //null (w+) /.tempfile .systemvar exec exch 3 1 roll
+ % stack: tempname stdin tempfile
+ 64000 string
+ {
+ % stack: tempname stdin tempfile string
+ 2 index 1 index readstring
+ exch 3 index exch writestring
+ not { exit } if
+ }
+ loop
+ pop exch closefile
+ % stack: tempname tempfile
+ dup 0 setfileposition
+ dup runpdf
+ closefile deletefile
+ } {
+ runpdf
+ } ifelse
+ } {
+ pop pop pop pop cvx .runps % (%!PS) found first
+ } ifelse
+ } {
+ pop cvx .runps % (%PDF-) not found
+ } ifelse
+ } {
+ pop cvx .runps % too short for PDF
} ifelse
} ifelse
} {
@@ -166,13 +166,12 @@ systemdict begin
} bind odef
currentdict /runpdfstring .undef
-
-/runpdfbegin { % <file> runpdfbegin -
+/runpdfbegin { % <file> runpdfbegin -
userdict begin
- % It turns out that the PDF interpreter uses memory more
- % effectively if it is run under at least one level of save.
- % This is counter-intuitive, and we don't understand why it happens,
- % but the improvement is significant.
+ % It turns out that the PDF interpreter uses memory more
+ % effectively if it is run under at least one level of save.
+ % This is counter-intuitive, and we don't understand why it happens,
+ % but the improvement is significant.
/PDFTopSave save def
0 setobjectformat
/Page# //null def
@@ -185,7 +184,7 @@ currentdict /runpdfstring .undef
} bind def
/runpdfpagerange { % - runpdfpagerange <firstpage#> <lastpage#>
- /FirstPage where
+ /FirstPage where
{ pop FirstPage dup pdfpagecount gt
{ (\nRequested FirstPage is greater than the number of pages in the file: ) print
pdfpagecount = flush
@@ -207,7 +206,7 @@ currentdict /runpdfstring .undef
/dopdfpages { % firstpage# lastpage# dopdfpages -
<< /PDFScanRules //true >> setuserparams % set scanning rules for PDF vs. PS
- << /RenderTTNotdef systemdict
+ << /RenderTTNotdef systemdict
/RENDERTTNOTDEF get >> setuserparams % Should we render TT /.notdef
1 exch
{ dup /Page# exch store
@@ -228,7 +227,6 @@ currentdict /runpdfstring .undef
2 vmreclaim % couldn't hurt
} bind def
-
% Copy stream to an external temporary file and
% return the file name as PS name.
/copy_embedded_file {
@@ -251,7 +249,7 @@ currentdict /runpdfstring .undef
3 1 roll % (name) file strm (buf) bool file (data)
writestring % (name) file strm (buf) bool
not { exit } if
- } loop
+ } loop
pop closefile % (name) file
closefile % (name)
cvn % /name
@@ -260,7 +258,6 @@ currentdict /runpdfstring .undef
} ifelse
} bind def
-
% Copy selected subfiles to temporary files and return the file names
% as a PostScript names to protect them from restore.
% Currently, all PDF files in the Portfolio are extracted and returned.
@@ -343,9 +340,9 @@ pdfdict begin
/traileropdict mark
(<<) cvn { /dictlevelcount dictlevelcount 1 add store mark } bind
(>>) cvn { { .dicttomark } stopped {
- ( **** File has unbalanced >> in trailer.\n) pdfformaterror
+ ( **** File has unbalanced >> in trailer.\n) pdfformaterror
} if
- /dictlevelcount dictlevelcount 1 sub def
+ /dictlevelcount dictlevelcount 1 sub def
dictlevelcount 0 eq { exit } if
} bind
([) cvn { mark } bind % ditto
@@ -386,12 +383,12 @@ pdfdict begin
} if
} if
pop % remove last
- % This section might be adding new objects:
- % ensure that Objects and Generations are big enough.
- % stack: <err count> <first obj> <entry count>
+ % This section might be adding new objects:
+ % ensure that Objects and Generations are big enough.
+ % stack: <err count> <first obj> <entry count>
2 copy add growPDFobjects
{ % stack: <err count> <obj num>
- % Read xref line
+ % Read xref line
PDFfile 20 string readstring pop % always read 20 chars.
token pop % object position
exch token pop % generation #
@@ -399,24 +396,24 @@ pdfdict begin
exch % stack: <err count> <obj#> <loc> <gen#> <tag> <remainder of line>
dup length 0 ne {
% check to make sure trailing garbage is just white space
- dup { 32 gt { 5 -1 roll 1 add 5 1 roll } if } forall % bump error count on garbage
+ dup { 32 gt { 5 -1 roll 1 add 5 1 roll } if } forall % bump error count on garbage
} if
pop % Stack: <err count> <obj#> <loc> <gen#> <tag>
dup /n eq { % xref line tag is /n
- pop % pop dup of line tag
+ pop % pop dup of line tag
1 index 0 eq {
( **** Warning: considering '0000000000 XXXXX n' as a free entry.\n)
pdfformaterror
} {
0 3 1 roll % Set ObjectStream object number = 0
- //false setxrefentry % Save xref entry, don't change existing entries
- 3 -1 roll pop % Remove ObjectStream object onumber
+ //false setxrefentry % Save xref entry, don't change existing entries
+ 3 -1 roll pop % Remove ObjectStream object onumber
} ifelse
}
{ % xref line tag was not /n
- /f ne % verify that the tag was /f
+ /f ne % verify that the tag was /f
{ /setxrefentry cvx /syntaxerror signalerror
- } if
+ } if
} ifelse
pop pop % pop <obj location> and <gen num>
% stack: <err count> <obj num>
@@ -437,7 +434,7 @@ pdfdict begin
/xrefopdict mark
(<<) cvn { /dictlevelcount dictlevelcount 1 add def mark } bind
(>>) cvn { .dicttomark /dictlevelcount dictlevelcount 1 sub def
- dictlevelcount 0 eq { exit} if } bind
+ dictlevelcount 0 eq { exit} if } bind
([) cvn { mark } bind % ditto
(]) cvn dup load
% /true true % see .pdfexectoken in pdf_base.ps
@@ -465,7 +462,7 @@ pdfdict begin
% (loc: ) print 1 index pdfstring cvs print ( ) print
% (gen: ) print dup === flush
} bind % Do nothing for free xref entries
- % XRef entry type 1 - normal or n type xref entry
+ % XRef entry type 1 - normal or n type xref entry
{ % field 2 = obj loc, field 3 = gen num
% (normal ) print
% (obj num: ) print 2 index pdfstring cvs print ( ) print
@@ -475,7 +472,7 @@ pdfdict begin
//false setxrefentry
3 -1 roll pop % remove stream number
} bind
- % XRef entry type 2 - compressed object type xref entry
+ % XRef entry type 2 - compressed object type xref entry
{ % field 2 = object stream num, field 3 = index into object stream
% (Compressed objects: ) print
% (obj num: ) print 2 index pdfstring cvs print ( ) print
@@ -491,45 +488,45 @@ pdfdict begin
/readpdf15xref % <pos> readpdf15xref <trailerdict>
{
PDFfile exch setfileposition % move to start of object
- % Get object number, revision, and 'obj' and discard
+ % Get object number, revision, and 'obj' and discard
PDFfile token pop pop
PDFfile token pop pop
PDFfile token pop pop
- % Get the XRef dicitionary
+ % Get the XRef dicitionary
/dictlevelcount 0 def PDFfile xrefopdict .pdfrun
- % Verify that we have an XRef dictionary
+ % Verify that we have an XRef dictionary
dup /Type get /XRef ne {
/readpdf15xref cvx /syntaxerror signalerror
} if
- % Ensure that we we have room in the objects array, etc.
+ % Ensure that we we have room in the objects array, etc.
dup /Size get growPDFobjects
- % Create a stream for the XRef data
+ % Create a stream for the XRef data
PDFfile token pop pop % Skip over 'stream'
dup stream //false resolvestream
- % Stack: <XRefdict> <xref stream>
- % The Index array defines the ranges of object numbers in the
- % XRef stream. Each value pair is consists of starting object
- % number and the count of consecutive objects.
- % Get the Index array, if present
+ % Stack: <XRefdict> <xref stream>
+ % The Index array defines the ranges of object numbers in the
+ % XRef stream. Each value pair is consists of starting object
+ % number and the count of consecutive objects.
+ % Get the Index array, if present
1 index /Index .knownget not { % If no Index array ...
[ 0 3 index /Size get ] % Default = [ 0 Size ]
} if
- % Loop through the Index array
+ % Loop through the Index array
0 2 2 index length 1 sub {
- % Get start and end of object range
+ % Get start and end of object range
2 copy get % Start of the range
dup 3 index 3 index 1 add get % Number of entries in range
- % Loop through the range of object numbers
+ % Loop through the range of object numbers
add 1 sub 1 exch { % Form end of range, set increment = 1
- % Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
- % Get xref parameters. Note: The number of bytes for each parameter
- % is defined by the entries in the W array.
+ % Stack: <Xrefdict> <xref stream> <Index array> <pair loc> <obj num>
+ % Get xref parameters. Note: The number of bytes for each parameter
+ % is defined by the entries in the W array.
4 index /W get aload pop % Get W array values
- % The first field indicates type of entry. Get first field value.
- % If the num. of bytes for field 1 is 0 then default field value is 1
+ % The first field indicates type of entry. Get first field value.
+ % If the num. of bytes for field 1 is 0 then default field value is 1
3 -1 roll dup 0 eq { pop 1 } { 6 index exch getintn } ifelse
- % Get the handler for the xref entry type. We will execute the
- % handler after we get the other two field values.
+ % Get the handler for the xref entry type. We will execute the
+ % handler after we get the other two field values.
xref15entryhandlers exch get
3 -1 roll 6 index exch getintn % Get second field
3 -1 roll 6 index exch getintn % Get third field
@@ -554,23 +551,23 @@ pdfdict begin
/readxref cvx /invalidaccess signalerror
} if
setfileposition
- % In some PDF files, this position actually points to
- % white space before the xref line. Skip over this here.
+ % In some PDF files, this position actually points to
+ % white space before the xref line. Skip over this here.
{
PDFfile fileposition PDFfile read pop 32 gt { exit } if pop
} loop
dup % Make copy of the file position (before last char was read).
PDFfile exch setfileposition
- % The PDF specification says that the 'xref' must be on a line
- % by itself. The code here formerly used readline and linene to
- % check this. However, Acrobat Reader only requires the line to
- % begin with 'xref', and there are enough applications producing
- % non-compliant PDF files that we have to do this too.
+ % The PDF specification says that the 'xref' must be on a line
+ % by itself. The code here formerly used readline and linene to
+ % check this. However, Acrobat Reader only requires the line to
+ % begin with 'xref', and there are enough applications producing
+ % non-compliant PDF files that we have to do this too.
PDFfile pdfstring 0 4 getinterval readstring pop
(xref) eq
{
readorigxref % 'xref' -> original xref table
- % if hybrid-reference PDF, also fetch the entries
+ % if hybrid-reference PDF, also fetch the entries
% found in the XRef stream pointed by /XRefStm
dup /XRefStm knownoget {
readpdf15xref pop
@@ -582,21 +579,21 @@ pdfdict begin
% Open a PDF file and read the header, trailer, and cross-reference.
/pdfopen { % <file> pdfopen <dict>
- % Color space substitution in PDF is handled somewhat differently
- % than in PostScript. A given device color space will be substituted
- % if the corresponding "Default..." entry exists in the Page's
- % Resource dictionary (which might be inhereted); there is no
- % UseCIEColor to enable/disable color mapping.
- %
- % This behavior is achieved by always setting UseCIEColor to true
- % in the page device dictionary. If the value of this parameter was
- % originally false (i.e.: the output device does not perform color
- % space substitution by default), the instances DefaultGray,
- % DefaultRGB, and DefaultCMYK of the (local) ColorSpace category
- % are redefined to be DeviceGray, DeviceRGB, and DeviceCMYK,
- % respectively. This is not done if UseCIEColor is true by default,
- % as in that case color substitution is presumably desired even
- % if the file does not request it.
+ % Color space substitution in PDF is handled somewhat differently
+ % than in PostScript. A given device color space will be substituted
+ % if the corresponding "Default..." entry exists in the Page's
+ % Resource dictionary (which might be inhereted); there is no
+ % UseCIEColor to enable/disable color mapping.
+ %
+ % This behavior is achieved by always setting UseCIEColor to true
+ % in the page device dictionary. If the value of this parameter was
+ % originally false (i.e.: the output device does not perform color
+ % space substitution by default), the instances DefaultGray,
+ % DefaultRGB, and DefaultCMYK of the (local) ColorSpace category
+ % are redefined to be DeviceGray, DeviceRGB, and DeviceCMYK,
+ % respectively. This is not done if UseCIEColor is true by default,
+ % as in that case color substitution is presumably desired even
+ % if the file does not request it.
currentpagedevice /UseCIEColor .knownget dup { pop } if not
{ .currentglobal //false .setglobal
/DefaultGray { /DeviceGray } cvlit /ColorSpace defineresource pop
@@ -613,10 +610,10 @@ pdfdict begin
/process_trailer_attrs { % - process_trailer_attrs -
writeoutputintents
.writepdfmarks {
- % Copy bookmarks (outline) to the output.
+ % Copy bookmarks (outline) to the output.
Trailer /Root oget /Outlines knownoget {
/First knownoget {
- { dup writeoutline /Next knownoget not { exit } if } loop
+ { dup writeoutline /Next knownoget not { exit } if } loop
} if
} if
} if % end .writepdfmarks
@@ -629,7 +626,7 @@ pdfdict begin
/D knownoget {
dup /BaseState knownoget { /OFF eq } { //false } ifelse {
( **** Warning: Default viewing OC config dictionary has /BaseState /OFF\n)
- pdfformaterror
+ pdfformaterror
1 index {
oforce dup type /dicttype eq {
/OFF 0 put
@@ -669,7 +666,7 @@ pdfdict begin
{ oforce
link_widget_annots
pop
- } forall
+ } forall
} if
pop
} {
@@ -684,48 +681,48 @@ pdfdict begin
{ PDFfilelen
1 1 Objects llength 1 sub % stack: filesize 1 1 <number of objects - 1>
{ % Check if the object is free (i.e. not used). The values in
- % Generations is the generation number plus 1. If the value in
- % Generations is zero then the object is free.
- % Stack: <filesize> <obj num>
+ % Generations is the generation number plus 1. If the value in
+ % Generations is zero then the object is free.
+ % Stack: <filesize> <obj num>
Generations 1 index lget % Get the genration number
0 ne { % Skip if object number is free
ObjectStream 1 index lget % Check if object is in objectstream
0 eq { % We only check objects not in an objectstream
{ % Use stop context since we may get an error if object is invalid
dup Objects exch lget % Get the object location
- PDFoffset add dup 3 index ge % Compare object location to file size
- { pop //true } % Rebuild if location not in file
- { PDFfile exch setfileposition % Go to the object location
- //true % Stack: <filesize> <obj num> <true>
- PDFfile token pop % Read object number from file
- 2 index eq { % Verify object number
- PDFfile token pop % Read generation number from file
- Generations 3 index % Get specified generaton number
- lget 1 sub % Gen numbs are stored with 1 added.
- eq { % Verify generation number
- PDFfile token pop
- /obj eq { % Verify 'obj' text
- pop //false % We have valid object, do not rebuild
- } if
- } if
- } if
- } ifelse
- } .internalstopped
- { //true } if % If we stop then we need to rebuild
- % Stack: <filesize> <obj num> <need rebuild flag>
- {
- ( **** Warning: File has an invalid xref entry: )
- pdfformaterror
- pdfstring cvs pdfformaterror
- (. Rebuilding xref table.\n) pdfformaterror
- search_objects
- exit
- } if % If the entry is invalid
+ PDFoffset add dup 3 index ge % Compare object location to file size
+ { pop //true } % Rebuild if location not in file
+ { PDFfile exch setfileposition % Go to the object location
+ //true % Stack: <filesize> <obj num> <true>
+ PDFfile token pop % Read object number from file
+ 2 index eq { % Verify object number
+ PDFfile token pop % Read generation number from file
+ Generations 3 index % Get specified generaton number
+ lget 1 sub % Gen numbs are stored with 1 added.
+ eq { % Verify generation number
+ PDFfile token pop
+ /obj eq { % Verify 'obj' text
+ pop //false % We have valid object, do not rebuild
+ } if
+ } if
+ } if
+ } ifelse
+ } .internalstopped
+ { //true } if % If we stop then we need to rebuild
+ % Stack: <filesize> <obj num> <need rebuild flag>
+ {
+ ( **** Warning: File has an invalid xref entry: )
+ pdfformaterror
+ pdfstring cvs pdfformaterror
+ (. Rebuilding xref table.\n) pdfformaterror
+ search_objects
+ exit
+ } if % If the entry is invalid
} {
- % The object is in an object stream. We currently do not rebuild
- % objects in an object stream. So If we find one, then abort the
- % verification of the xref table entries.
- pop exit % Pop object number and then exit loop
+ % The object is in an object stream. We currently do not rebuild
+ % objects in an object stream. So If we find one, then abort the
+ % verification of the xref table entries.
+ pop exit % Pop object number and then exit loop
} ifelse % If not in an object stream
} if % If object entry is not free
pop % Remove object number
@@ -734,7 +731,7 @@ pdfdict begin
} bind odef
/pdfopencache { % - pdfopencache -
- % Create and initialize some caches.
+ % Create and initialize some caches.
/PageCount pdfpagecount def
/PageNumbers PageCount 65534 .min dict def
/PageIndex PageCount 65534 .min array def
@@ -746,7 +743,7 @@ pdfdict begin
/LocalResources 0 dict def
/DefaultQstate //null def % establish binding
/Printed where { pop } {
- % Guess whether the output device is a printer.
+ % Guess whether the output device is a printer.
/Printed currentpagedevice /OutputFile known def
} ifelse
/PSLevel1 where { pop } { /PSLevel1 //false def } ifelse
@@ -783,7 +780,7 @@ pdfdict begin
} loop
/PDFversion exch def
- % Read the last cross-reference table.
+ % Read the last cross-reference table.
count /pdfemptycount exch def
/Trailer << >> def % Initialize to an emptry dict.
{ initPDFobjects findxref readxref } .internalstopped {
@@ -791,16 +788,16 @@ pdfdict begin
search_trailer % Search for the primary trailer
} {
/Trailer exch def % Save trailer dict after first xref table
- % Read any previous cross-reference tables. When we are done,
- % verify that the entries in the xref tables are valid if NoVerifyXref
- % is not defined.
+ % Read any previous cross-reference tables. When we are done,
+ % verify that the entries in the xref tables are valid if NoVerifyXref
+ % is not defined.
Trailer
{ /Prev knownoget not { % If no previous xref table then ...
/NoVerifyXref where { pop } { verify_xref } ifelse exit
} if
{ readxref } .internalstopped {
recover_xref_data % Read failed. Attempt to recover xref data.
- exit % Exit loop since recover gets all obj data.
+ exit % Exit loop since recover gets all obj data.
} if % If readxref stopped
% The PDF spec. says that each trailer dict should contain the required
% entries. However we have seen a PDF file that only has a Prev entry in
@@ -840,7 +837,7 @@ pdfdict begin
-1
{ 1 index dup 0 (startxref) /SubFileDecode filter flushfile
bytesavailable 9 lt { exit } if
- pop dup fileposition
+ pop dup fileposition
} loop
} bind def
@@ -854,7 +851,7 @@ pdfdict begin
/findxref { % - findxref <xrefpos>
PDFfile dup dup dup 0 setfileposition bytesavailable
dup /PDFfilelen exch def
- % Find the last %%EOF string (within 1024 bytes)
+ % Find the last %%EOF string (within 1024 bytes)
1024 sub PDFoffset .max
setfileposition find-startxref % file pos|-1 % search the last 1024 bytes
dup 0 le {
@@ -867,7 +864,7 @@ pdfdict begin
} if
} if
2 copy setfileposition
- pop token not { //null } if
+ pop token not { //null } if
dup type /integertype ne {
( **** Error: invalid token after startxref.\n) pdfformaterror
/findxref cvx /syntaxerror signalerror
@@ -899,11 +896,11 @@ pdfdict begin
pop
} {
( **** The file was produced by: \n **** >>>> ) stderrprint
- % Handle a Unicode Producer.
+ % Handle a Unicode Producer.
(\376\377) anchorsearch {
pop dup length 2 idiv string 0 1 2 index length 1 sub {
- % Stack: origstr newstr i
- 1 index exch 3 index 1 index 2 mul 1 add get put
+ % Stack: origstr newstr i
+ 1 index exch 3 index 1 index 2 mul 1 add get put
} for exch pop
} if
stderrprint
@@ -917,8 +914,8 @@ pdfdict begin
(\n **** Embedded font uses undefined procedure\(s\): ) stderrprint
UndefProcList {
exch .namestring stderrprint ( ) stderrprint
- =string cvs stderrprint ( times, ) stderrprint
- } forall
+ =string cvs stderrprint ( times, ) stderrprint
+ } forall
(\n) stderrprint
} if
} bind def
@@ -942,7 +939,7 @@ pdfdict begin
0 2 index /First knownoget
{ { exch 1 add exch /Next knownoget not { exit } if } loop }
if
- % stack: dict mark count
+ % stack: dict mark count
dup 0 eq
{ pop 1 index }
{ 2 index /Count knownoget { 0 lt { neg } if } if
@@ -992,19 +989,19 @@ pdfdict begin
% Get a (possibly inherited) attribute of a page.
/pget % <pagedict> <key> pget <value> -true-
- % <pagedict> <key> pget -false-
+ % <pagedict> <key> pget -false-
{
2 copy knownoget
{ exch pop exch pop //true }
{ exch /Parent knownoget
{ exch pget }
- % finally see if the key is (misplaced) in the Root Catalog dict
+ % finally see if the key is (misplaced) in the Root Catalog dict
{ dup Trailer /Root oget exch knownoget dup {
- 3 -1 roll ( **** Warning: The /) pdfformaterror 50 string cvs pdfformaterror
- ( key is missing from the Page tree.\n) pdfformaterror
+ 3 -1 roll ( **** Warning: The /) pdfformaterror 50 string cvs pdfformaterror
+ ( key is missing from the Page tree.\n) pdfformaterror
}
- { exch pop }
- ifelse
+ { exch pop }
+ ifelse
}
ifelse
}
@@ -1013,7 +1010,7 @@ pdfdict begin
% Get the value of a resource on a given page.
/rget { % <resname> <pagedict> <restype> rget <value> -true-
- % <resname> <pagedict> <restype> rget -false-
+ % <resname> <pagedict> <restype> rget -false-
LocalResources 1 index knownoget {
dup type /dicttype eq {
3 index knownoget
@@ -1057,14 +1054,14 @@ pdfdict begin
{ Trailer /Root oget /Pages oget
dup /Count knownoget {
dup 0 le {
- pop
+ pop
dup /Kids knownoget {
pop
( **** Warning: Invalid Page count.\n) pdfformaterror
% find the last page and use that as the Count
1 1 999999999 {
dup pdffindpage?
- exch pop
+ exch pop
//null eq { exit } { pop } ifelse
} for
1 sub % decrement to last page that we were able to find
@@ -1085,14 +1082,14 @@ pdfdict begin
} {
( **** Warning: Page count not found; assuming 1.\n)
pdfformaterror
- pop 1
+ pop 1
} ifelse
} ifelse
} bind def
% Check for loops in the 'page tree' but accept an acyclic graph.
% - verify_page_tree -
-/verify_page_tree {
+/verify_page_tree {
Trailer /Root oget /Pages oget
10 dict begin
/verify_page_tree_recursive {
@@ -1113,23 +1110,23 @@ pdfdict begin
} bind def
/pdffindpage? { % <int> pdffindpage? 1 null (page not found)
- % <int> pdffindpage? 1 noderef (page found)
- % <int> pdffindpage? 0 null (Error: page not found)
+ % <int> pdffindpage? 1 noderef (page found)
+ % <int> pdffindpage? 0 null (Error: page not found)
Trailer /Root oget /Pages get
{ % We should be able to tell when we reach a leaf
- % by finding a Type unequal to /Pages. Unfortunately,
- % some files distributed by Adobe lack the Type key
- % in some of the Pages nodes! Instead, we check for Kids.
+ % by finding a Type unequal to /Pages. Unfortunately,
+ % some files distributed by Adobe lack the Type key
+ % in some of the Pages nodes! Instead, we check for Kids.
dup oforce /Kids knownoget not { exit } if
exch pop //null
0 1 3 index length 1 sub {
2 index exch get
- dup oforce dup /Kids known { /Count oget } { pop 1 } ifelse
- % Stack: index kids null noderef count
- dup 5 index ge { pop exch pop exit } if
- 5 -1 roll exch sub 4 1 roll pop
+ dup oforce dup /Kids known { /Count oget } { pop 1 } ifelse
+ % Stack: index kids null noderef count
+ dup 5 index ge { pop exch pop exit } if
+ 5 -1 roll exch sub 4 1 roll pop
} for exch pop
- % Stack: index null|noderef
+ % Stack: index null|noderef
dup //null eq { pop pop 1 //null exit } if
} loop
} bind def
@@ -1138,7 +1135,7 @@ pdfdict begin
% The first page is numbered 1.
/pdffindpageref { % <int> pdffindpage <objref>
dup pdffindpage?
- % Stack: index countleft noderef
+ % Stack: index countleft noderef
1 index 1 ne { pop pop /pdffindpage cvx /rangecheck signalerror } if
exch pop
PageIndex 2 index 1 sub 65533 .min 2 index oforce put
@@ -1219,13 +1216,13 @@ pdfdict begin
} {
dup type /stringtype eq {
Trailer /Root oget /Names knownoget {
- /Dests knownoget {
- exch nameoget
- } {
- pop //null
- } ifelse
+ /Dests knownoget {
+ exch nameoget
+ } {
+ pop //null
+ } ifelse
} {
- pop //null
+ pop //null
} ifelse
} if
} ifelse
@@ -1236,54 +1233,54 @@ pdfdict begin
/viewdestprocs 8 dict dup begin
/Fit { exch pop exch pop } bind def
/FitH {
- aload pop
- 0 4 -1 roll 1 and 0 eq { exch } if
- 4 -1 roll transform exch pop
- 2 array astore
+ aload pop
+ 0 4 -1 roll 1 and 0 eq { exch } if
+ 4 -1 roll transform exch pop
+ 2 array astore
} bind def
/FitV {
- aload pop
- 0 4 -1 roll 1 and 0 ne { exch } if
- 4 -1 roll transform pop
- 2 array astore
+ aload pop
+ 0 4 -1 roll 1 and 0 ne { exch } if
+ 4 -1 roll transform pop
+ 2 array astore
} bind def
/FitB /Fit load def
/FitBH /FitH load def
/FitBV /FitV load def
/XYZ {
- aload pop
- 3 1 roll
- 2 copy 7 -1 roll 1 and 0 ne { exch } if 4 2 roll % odd rotation switches x<->y
- 2 { dup //null eq { pop 0 } if exch } repeat % replace nulls with 0
- 7 -1 roll transform % transform coordinates
- 2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back
- 3 -1 roll
- 4 array astore
+ aload pop
+ 3 1 roll
+ 2 copy 7 -1 roll 1 and 0 ne { exch } if 4 2 roll % odd rotation switches x<->y
+ 2 { dup //null eq { pop 0 } if exch } repeat % replace nulls with 0
+ 7 -1 roll transform % transform coordinates
+ 2 { 3 -1 roll //null eq { pop //null } if exch } repeat % put the nulls back
+ 3 -1 roll
+ 4 array astore
} bind def
/FitR {
- exch pop
- aload pop
- 2 { 5 index transform 4 2 roll } repeat normrect_elems
- 5 array astore
- exch pop
+ exch pop
+ aload pop
+ 2 { 5 index transform 4 2 roll } repeat normrect_elems
+ 5 array astore
+ exch pop
} bind def
end readonly def
/linkdest { % <link|outline> linkdest
- % ([/Page <n>] /View <view> | ) <link|outline>
+ % ([/Page <n>] /View <view> | ) <link|outline>
dup /Dest knownoget
{ resolvedest
dup type /dicttype eq { /D knownoget not { //null } if } if
dup //null eq
{ pop }
{ dup 0 oget
- //false % don't have a page# and transformation matrix (yet)
- 1 index type /dicttype eq {
- 1 index /Type knownoget {
+ //false % don't have a page# and transformation matrix (yet)
+ 1 index type /dicttype eq {
+ 1 index /Type knownoget {
/Page eq {
- pop % the "false" flag
- dup pdf_cached_PDF2PS_matrix exch
- dup /Rotate pget not { 0 } if 90 idiv exch
+ pop % the "false" flag
+ dup pdf_cached_PDF2PS_matrix exch
+ dup /Rotate pget not { 0 } if 90 idiv exch
pdfpagenumber
/FirstPage where {pop dup FirstPage lt {/rangecheck signalerror} if} if
/LastPage where {pop dup LastPage gt {/rangecheck signalerror} if} if
@@ -1291,18 +1288,18 @@ end readonly def
} if
} if
} if
- % stack: <link|outline> <dest> ( <PDF2PS_matrix> <rot> <page#> true | <page> false )
- {
- /Page exch 6 2 roll
- % stack: [/Page <page#>] <link|outline> <dest> <PDF2PS_matrix> <rot>
- 3 -1 roll dup length 1 sub 1 exch getinterval /View 4 1 roll
- % stack: [/Page <page#>] <link|outline> /View <PDF2PS_matrix> <rot> <view>
- //viewdestprocs 1 index 0 get get exec
- 3 -1 roll
- } {
- pop
- dup length 1 sub 1 exch getinterval /View exch 3 -1 roll
- } ifelse
+ % stack: <link|outline> <dest> ( <PDF2PS_matrix> <rot> <page#> true | <page> false )
+ {
+ /Page exch 6 2 roll
+ % stack: [/Page <page#>] <link|outline> <dest> <PDF2PS_matrix> <rot>
+ 3 -1 roll dup length 1 sub 1 exch getinterval /View 4 1 roll
+ % stack: [/Page <page#>] <link|outline> /View <PDF2PS_matrix> <rot> <view>
+ //viewdestprocs 1 index 0 get get exec
+ 3 -1 roll
+ } {
+ pop
+ dup length 1 sub 1 exch getinterval /View exch 3 -1 roll
+ } ifelse
}
ifelse
}
@@ -1347,10 +1344,10 @@ end readonly def
3 2 roll
} {
dup /D knownoget {
- exch pop exch dup length dict copy dup /Dest 4 -1 roll put
+ exch pop exch dup length dict copy dup /Dest 4 -1 roll put
} {
- /N knownoget { % Assume /S /Named
- namedactions exch .knownget {
+ /N knownoget { % Assume /S /Named
+ namedactions exch .knownget {
exec {
pop
( **** Warning: Ignoring a named action pointing out of the document page range.\n)
@@ -1359,7 +1356,7 @@ end readonly def
/Page exch 3 -1 roll
} ifelse
} if
- } if
+ } if
} ifelse
} ifelse
} if
@@ -1374,8 +1371,8 @@ end readonly def
% **** implemented in one of those three procedures.
/pdfshowpage % <pagedict> pdfshowpage -
{ dup /Page exch store
- pdfshowpage_init
- pdfshowpage_setpage
+ pdfshowpage_init
+ pdfshowpage_setpage
pdfshowpage_finish
} bind def
@@ -1414,11 +1411,11 @@ end readonly def
} {
oforce_elems % <<pdict>> /SomeBox x0 y0 x1 y1
6 -1 roll get_media_box { % /SomeBox x0 y0 x1 y1 [MediaBox]
- aload pop % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1
+ aload pop % /SomeBox x0 y0 x1 y1 X0 Y0 X1 Y1
5 -1 roll .min exch % /SomeBox x0 y0 x1 X0 Y0 mY1 X1
5 -1 roll .min exch % /SomeBox x0 y0 X0 Y0 mX1 mY1
4 2 roll % /SomeBox x0 y0 mX1 mY1 X0 Y0
- 5 -1 roll .max exch % /SomeBox x0 mX1 mY1 mY0 X0
+ 5 -1 roll .max exch % /SomeBox x0 mX1 mY1 mY0 X0
5 -1 roll .max exch % /SomeBox mX1 mY1 mX0 mY0
4 2 roll % /SomeBox mX0 mY0 mX1 mY1
} {
@@ -1448,9 +1445,9 @@ end readonly def
2 copy ne {
% rotate the .HWMargins
2 copy lt {
- 6 2 roll 4 -1 roll 6 -2 roll
+ 6 2 roll 4 -1 roll 6 -2 roll
} {
- 6 2 roll 4 1 roll 6 -2 roll
+ 6 2 roll 4 1 roll 6 -2 roll
} ifelse
% rotate the page dimensions
exch
@@ -1461,10 +1458,10 @@ end readonly def
PDFDEBUG { ( Translate up by [ ) print 3 index =print (, ) print 2 index =print ( ]) = flush } if
3 index 3 index translate % move origin up to imageable area
2 index sub exch 3 index sub exch 4 2 roll pop pop
- % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable
+ % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable
2 index aload pop 2 index sub exch 3 index sub exch 4 2 roll pop pop
5 index /Rotate pget not { 0 } if 90 idiv 1 and 0 ne { exch } if
- % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable XBox YBox
+ % stack: savedCTM <pdfpagedict> [Box] XImageable YImageable XBox YBox
3 -1 roll exch div 3 1 roll div .min
PDFDEBUG { ( Scale by ) print dup = flush } if
} {
@@ -1518,14 +1515,14 @@ currentdict /PDF2PS_matrix_key undef
/pdfshowpage_setpage { % <pagedict> pdfshowpage_setpage <pagedict>
6 dict begin % for setpagedevice
- % Stack: pdfpagedict
+ % Stack: pdfpagedict
% UseCIEColor is always true for PDF; see the comment in runpdf above
/UseCIEColor //true def
/Orientation 0 def
currentpagedevice
- % Stack: pdfpagedict currentpagedevicedict
- 1 index get_any_box
- % Stack: pdfpagedict currentpagedevicedict /BoxName [box]
+ % Stack: pdfpagedict currentpagedevicedict
+ 1 index get_any_box
+ % Stack: pdfpagedict currentpagedevicedict /BoxName [box]
oforce_elems normrect_elems fix_empty_rect_elems boxrect 4 2 roll pop pop
3 index /Rotate pget not { 0 } if 90 idiv 1 and 0 ne { exch } if
% stack: pdfpagedict currentpagedevicedict boxwidth boxheight
@@ -1555,23 +1552,23 @@ currentdict /PDF2PS_matrix_key undef
% The clist logic may need to adjust the size of bands.
1 index pageusestransparency /PageUsesTransparency exch def
dup /Install .knownget {
- % Don't let the Install procedure get more deeply
- % nested after every page.
+ % Don't let the Install procedure get more deeply
+ % nested after every page.
dup type dup /arraytype eq exch /packedarraytype eq or {
- dup length 4 eq {
- dup 2 get /.pdfshowpage_Install load eq {
- 1 get 0 get % previous procedure
- } if
- } if
+ dup length 4 eq {
+ dup 2 get /.pdfshowpage_Install load eq {
+ 1 get 0 get % previous procedure
+ } if
+ } if
} if
} {
{ }
} ifelse 1 array astore
2 index exch /.pdfshowpage_Install load /exec load
4 packedarray cvx
- % Stack: pagedict currentpagedict installproc
+ % Stack: pagedict currentpagedict installproc
/Install exch def
- % Stack: pagedict currentpagedict
+ % Stack: pagedict currentpagedict
pop currentdict end setpagedevice
} bind def
@@ -1601,7 +1598,7 @@ currentdict /PDF2PS_matrix_key undef
.writepdfmarks {
- % Copy the crop box.
+ % Copy the crop box.
dup /CropBox pget {
% .pdfshowpage_Install transforms the user space -
% do same here with the CropBox.
@@ -1612,7 +1609,7 @@ currentdict /PDF2PS_matrix_key undef
/PAGE pdfmark
} if
- % Copy annotations and links.
+ % Copy annotations and links.
dup /Annots knownoget {
0 1 2 index length 1 sub
{ 1 index exch oget
@@ -1627,14 +1624,14 @@ currentdict /PDF2PS_matrix_key undef
} if % end .writepdfmarks
- % Display the actual page contents.
+ % Display the actual page contents.
8 dict begin
/BXlevel 0 def
/BMClevel 0 def
/OFFlevels 0 dict def
/BGDefault currentblackgeneration def
/UCRDefault currentundercolorremoval def
- %****** DOESN'T HANDLE COLOR TRANSFER YET ******
+ %****** DOESN'T HANDLE COLOR TRANSFER YET ******
/TRDefault currenttransfer def
matrix currentmatrix 2 dict
2 index /CropBox pget {
@@ -1645,8 +1642,8 @@ currentdict /PDF2PS_matrix_key undef
/DefaultQstate qstate store
count 1 sub /pdfemptycount exch store
- % If the page uses any transparency features, show it within
- % a transparency group.
+ % If the page uses any transparency features, show it within
+ % a transparency group.
dup pageusestransparency dup /PDFusingtransparency exch def {
% Show the page within a PDF 1.4 device filter.
0 .pushpdf14devicefilter {
@@ -1654,22 +1651,22 @@ currentdict /PDF2PS_matrix_key undef
% If the page has a Group, enclose contents in transparency group.
% (Adobe Tech Note 5407, sec 9.2)
dup /Group knownoget {
- 1 index /CropBox pget {
+ 1 index /CropBox pget {
/CropBox exch
} {
- 1 index get_media_box pop /MediaBox exch
- } ifelse
+ 1 index get_media_box pop /MediaBox exch
+ } ifelse
oforce_elems normrect_elems fix_empty_rect_elems 4 array astore .beginformgroup {
- showpagecontents
- } stopped {
- .discardtransparencygroup stop
- } if .endtransparencygroup
+ showpagecontents
+ } stopped {
+ .discardtransparencygroup stop
+ } if .endtransparencygroup
} {
- showpagecontents
+ showpagecontents
} ifelse
} stopped {
% todo: discard
- .poppdf14devicefilter
+ .poppdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
stop
} if .poppdf14devicefilter
@@ -1687,7 +1684,7 @@ currentdict /PDF2PS_matrix_key undef
<< /PageSpotColors -1 >> .setpagedevice
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
- countdictstack PDFdictstackcount sub dup 0 ne {
+ countdictstack PDFdictstackcount sub dup 0 ne {
( **** Warning: File has unbalanced q/Q operators \(too many q's\)\n)
pdfformaterror
{ end } repeat
@@ -1736,7 +1733,7 @@ currentdict /PDF2PS_matrix_key undef
} bind def
/processcolorspace { % - processcolorspace <colorspace>
- % The following is per the PLRM3.
+ % The following is per the PLRM3.
currentdevice 1 dict dup /ProcessColorModel dup put .getdeviceparams
exch pop exch pop
dup type /nametype ne { cvn } if
@@ -1776,7 +1773,7 @@ currentdict /PDF2PS_matrix_key undef
pop % bug 692050
} {
{ % establish loop context
- dup /BM knownoget {
+ dup /BM knownoget {
dup /Normal ne exch /Compatible ne and { pop not exit } if
} if
dup /ca knownoget { 1 ne { pop not exit } if } if
@@ -1790,7 +1787,7 @@ currentdict /PDF2PS_matrix_key undef
% Check if transparency is used in a Pattern
/patternusestransparency { % <Pattern dict> patternusestransparency <bool>
NOTRANSPARENCY
- { pop //false }
+ { pop //false }
{ //false exch % Assume no transparency
{
4 dict 1 index resourceusestransparency { pop not exit } if
@@ -1801,7 +1798,6 @@ currentdict /PDF2PS_matrix_key undef
ifelse
} bind def
-
% Check the Resources of a page or Form. Check for loops in the resource chain.
/resourceusestransparency { % <dict> <dict> resourceusestransparency <bool>
{ % Use loop to provide an exitable context.
@@ -1835,18 +1831,18 @@ currentdict /PDF2PS_matrix_key undef
dup type dup /dicttype eq exch /arraytype eq or {
//false exch
{ {
- exch pop oforce dup /Subtype get
- dup /Image eq {
+ exch pop oforce dup /Subtype get
+ dup /Image eq {
1 index /SMask oknown { pop pop not exit } if
1 index /SMaskInData knownoget {
0 ne { pop pop not exit } if
} if
} if
- /Form eq {
- 3 index exch resourceusestransparency { not exit } if
- } {
- pop
- } ifelse
+ /Form eq {
+ 3 index exch resourceusestransparency { not exit } if
+ } {
+ pop
+ } ifelse
} forall
dup { exit } if
} big-res-forall
@@ -1906,8 +1902,8 @@ currentdict /PDF2PS_matrix_key undef
} {
% Stack: <spotcolordict> <colorspace> <colorspacetype>
dup /Separation eq exch /DeviceN eq or {
- dup 1 oget dup type /arraytype eq {
- { oforce 2 index putspotcolor } forall
+ dup 1 oget dup type /arraytype eq {
+ { oforce 2 index putspotcolor } forall
} {
2 index putspotcolor
} ifelse
@@ -1918,7 +1914,7 @@ currentdict /PDF2PS_matrix_key undef
} bind def
% Enumerate resource dictionary or an array of dictionaries
-% <object> <proc> big-res-forall -
+% <object> <proc> big-res-forall -
/big-res-forall {
1 index type /dicttype eq { 0 get } if
forall
@@ -1953,7 +1949,7 @@ currentdict /PDF2PS_matrix_key undef
} if
/XObject knownoget {
dup type dup /dicttype eq exch /arraytype eq or {
- { { exch pop oforce
+ { { exch pop oforce
dup //null ne {
dup /Subtype get /Form eq { resourcespotcolors } { pop } ifelse
} {
@@ -1982,7 +1978,7 @@ currentdict /PDF2PS_matrix_key undef
resourcespotcolors
} if % If normal appearance streamknown
} if % If AP dict known
- } {
+ } {
pop
} ifelse
} forall
@@ -2001,7 +1997,7 @@ currentdict /PDF2PS_matrix_key undef
% Create a dict to hold spot color names.
0 dict exch
% Create a dict to be used to check for reference loops.
- 4 dict exch
+ 4 dict exch
% Check for color spaces in the Resources
resourcespotcolors
% Also check for color spaces in the annotations.
@@ -2081,31 +2077,31 @@ bind def
{ % process all output profiles present
oforce
dup length dict .copydict
- dup /DestOutputProfile knownoget {
- PDFfile fileposition exch
- mark exch { oforce } forall .dicttomark
- //true resolvestream
- [ { counttomark 1 add index
- 64000 string readstring
- not { exit } if
- } loop
- ] exch closefile
- 0 1 index { length add } forall .bytestring
- 0 3 2 roll {
- 3 copy putinterval
- length add
- } forall pop
- exch PDFfile exch setfileposition
- 1 index /DestOutputProfile 3 2 roll put
- } if
- % Convert to string array because it's easier for the device
- [ 1 index /OutputCondition knownoget not { () } if
- 2 index /OutputConditionIdentifier knownoget not { () } if
- 3 index /RegistryName knownoget not { () } if
- 4 index /Info knownoget not { () } if
- 5 index /DestOutputProfile knownoget not { () } if
- ]
- [ /OutputIntent 3 2 roll .pdfputparams pop pop
+ dup /DestOutputProfile knownoget {
+ PDFfile fileposition exch
+ mark exch { oforce } forall .dicttomark
+ //true resolvestream
+ [ { counttomark 1 add index
+ 64000 string readstring
+ not { exit } if
+ } loop
+ ] exch closefile
+ 0 1 index { length add } forall .bytestring
+ 0 3 2 roll {
+ 3 copy putinterval
+ length add
+ } forall pop
+ exch PDFfile exch setfileposition
+ 1 index /DestOutputProfile 3 2 roll put
+ } if
+ % Convert to string array because it's easier for the device
+ [ 1 index /OutputCondition knownoget not { () } if
+ 2 index /OutputConditionIdentifier knownoget not { () } if
+ 3 index /RegistryName knownoget not { () } if
+ 4 index /Info knownoget not { () } if
+ 5 index /DestOutputProfile knownoget not { () } if
+ ]
+ [ /OutputIntent 3 2 roll .pdfputparams pop pop
pop % done with this OutputIntent dictionary
} forall
} {
diff --git a/gs/Resource/Init/pdf_ops.ps b/gs/Resource/Init/pdf_ops.ps
index ad9ee7db3..3d9bf90bc 100644
--- a/gs/Resource/Init/pdf_ops.ps
+++ b/gs/Resource/Init/pdf_ops.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -216,7 +216,7 @@ nodict readonly pop
pop //cspattern //nullpattern matrix makepattern
} {
//nullpattern matrix makepattern 1 index 1 get csset
- % Stack: patternspace nullpattern basecolor basespace
+ % Stack: patternspace nullpattern basecolor basespace
pop [ 3 1 roll dup type /arraytype eq { aload pop } if
counttomark -1 roll ] cvx
} ifelse
@@ -296,9 +296,9 @@ nodict readonly pop
} {
1 .setshapealpha exch .setopacityalpha 0
} ifelse
- % Set the soft mask by rendering the XObject. Doing this every time
- % is obviously very inefficient; we'll improve it later.
- .settransparencymask
+ % Set the soft mask by rendering the XObject. Doing this every time
+ % is obviously very inefficient; we'll improve it later.
+ .settransparencymask
} {
pop pop
} ifelse
@@ -371,7 +371,7 @@ nodict readonly pop
} ifelse
} if
- % Associate pattern instance with the default qstate for the context.
+ % Associate pattern instance with the default qstate for the context.
% A single pattren object can be reused in several contexts.
dup DefaultQstate .knownget {
exch pop
@@ -459,23 +459,23 @@ end def
/B {
OFFlevels length 0 eq {
- PDFusingtransparency {
- % knockout trans group around the filled and stroked object
- mark
- /Isolated //true /Knockout //true
- .dicttomark
- % strokepath will return empty path (no currentpoint) if nothing is stroked
- gsave { strokepath pathbbox } stopped grestore not {
- 1 .setopacityalpha
- .begintransparencygroup
- gsave setfillstate fill grestore
- setstrokestate .swapcolors /stroke fsexec .swapcolors
- .endtransparencygroup
- } { newpath pop } ifelse
- } {
- gsave setfillstate fill grestore
- setstrokestate .swapcolors /stroke fsexec .swapcolors
- } ifelse
+ PDFusingtransparency {
+ % knockout trans group around the filled and stroked object
+ mark
+ /Isolated //true /Knockout //true
+ .dicttomark
+ % strokepath will return empty path (no currentpoint) if nothing is stroked
+ gsave { strokepath pathbbox } stopped grestore not {
+ 1 .setopacityalpha
+ .begintransparencygroup
+ gsave setfillstate fill grestore
+ setstrokestate .swapcolors /stroke fsexec .swapcolors
+ .endtransparencygroup
+ } { newpath pop } ifelse
+ } {
+ gsave setfillstate fill grestore
+ setstrokestate .swapcolors /stroke fsexec .swapcolors
+ } ifelse
} {
newpath
} ifelse
@@ -485,23 +485,23 @@ end def
/B* {
OFFlevels length 0 eq {
- PDFusingtransparency {
- % knockout trans group around the filled and stroked object
- mark
- /Isolated //true /Knockout //true
- .dicttomark
- % strokepath will return empty path (no currentpoint) if nothing is stroked
- gsave { strokepath pathbbox } stopped grestore not {
+ PDFusingtransparency {
+ % knockout trans group around the filled and stroked object
+ mark
+ /Isolated //true /Knockout //true
+ .dicttomark
+ % strokepath will return empty path (no currentpoint) if nothing is stroked
+ gsave { strokepath pathbbox } stopped grestore not {
1 .setopacityalpha
- .begintransparencygroup
- gsave setfillstate eofill grestore
- setstrokestate .swapcolors /stroke fsexec .swapcolors
- .endtransparencygroup
- } { newpath pop } ifelse
- } {
- gsave setfillstate eofill grestore
- setstrokestate .swapcolors /stroke fsexec .swapcolors
- } ifelse
+ .begintransparencygroup
+ gsave setfillstate eofill grestore
+ setstrokestate .swapcolors /stroke fsexec .swapcolors
+ .endtransparencygroup
+ } { newpath pop } ifelse
+ } {
+ gsave setfillstate eofill grestore
+ setstrokestate .swapcolors /stroke fsexec .swapcolors
+ } ifelse
} {
newpath
} ifelse
@@ -551,18 +551,18 @@ end readonly def
TextFont dup //null eq { pop } { setfont } ifelse
} bdef
/settextstate {
- % The text state can be set even outside BT/ET.
+ % The text state can be set even outside BT/ET.
currentdict /TextSaveMatrix known {
TextSaveMatrix setmatrix settextmatrix
} if
} bdef
/settextposition {
- % Update the TextMatrix translation.
+ % Update the TextMatrix translation.
gsave TextSaveMatrix setmatrix
currentpoint TextRise sub TextMatrix 4 2 getinterval astore pop
- % We would like to do "grestore currentpoint translate"
- % here, but some PDF files set a singular text matrix
- % (0 0 0 0 <x> <y> Tm), so we can't do this.
+ % We would like to do "grestore currentpoint translate"
+ % here, but some PDF files set a singular text matrix
+ % (0 0 0 0 <x> <y> Tm), so we can't do this.
TextTempMatrix identmatrix setmatrix currentpoint
grestore
TextTempMatrix currentmatrix 4 2 getinterval astore pop
@@ -606,37 +606,37 @@ end readonly def
% Worker procedure for testing a single font matrix
/?FontMatrixNonHV { % ?horz <<fontdict>> -- ?horz ?nonhv
/FontMatrix .knownget {
- 1 index { 1 } { 2 } ifelse get 0 ne
+ 1 index { 1 } { 2 } ifelse get 0 ne
} {
- //false
+ //false
} ifelse
} bdef
% Worker procedure for recursive checking of font matrices
/?FontMatrixNonHV { % {self} ?horz <<font>> -- {self} ?horz ?nonhv
2 copy //?FontMatrixNonHV exec { % check the font's own FontMatrix
- pop pop //true
+ pop pop //true
} {
- % look for descendents/ components
- pop % {self} ?horz <<font>>
- dup /FontType get
- dup 0 eq { % Type 0: look into FDepVector
- pop /FDepVector get 2 index % {self} ?horz [fonts..] {testproc}
- } {
- 9 eq { % Type 9 (CIDFontType 0): check FDArray
- /FDArray get //?FontMatrixNonHV
- } { % all others: nothing more to check
- pop {} {}
- } ifelse
- } ifelse
- %stack: {self} ?horz [fonts..] {testproc}
- //false 5 2 roll { % {testproc} false {self} ?horz <<subfont>>
- 4 index exec {
- 4 -1 roll pop //true 4 1 roll
- exit
- } if
- } forall
- %stack: {testproc} ?nonhv {self} ?horz
- 4 2 roll exch pop
+ % look for descendents/ components
+ pop % {self} ?horz <<font>>
+ dup /FontType get
+ dup 0 eq { % Type 0: look into FDepVector
+ pop /FDepVector get 2 index % {self} ?horz [fonts..] {testproc}
+ } {
+ 9 eq { % Type 9 (CIDFontType 0): check FDArray
+ /FDArray get //?FontMatrixNonHV
+ } { % all others: nothing more to check
+ pop {} {}
+ } ifelse
+ } ifelse
+ %stack: {self} ?horz [fonts..] {testproc}
+ //false 5 2 roll { % {testproc} false {self} ?horz <<subfont>>
+ 4 index exec {
+ 4 -1 roll pop //true 4 1 roll
+ exit
+ } if
+ } forall
+ %stack: {testproc} ?nonhv {self} ?horz
+ 4 2 roll exch pop
} ifelse
} bdef
% Main procedure
@@ -678,12 +678,12 @@ end readonly def
{ 1 index /FID known
1 index { 2 index /UniqueID known or 2 index /XUID known or } if
{ % We add 1 to the length just in case the original
- % didn't have a FID.
+ % didn't have a FID.
exch dup length 1 add dict exch
{ % Stack: changed newfont key value
- 1 index /FID eq 4 index
- { 2 index /UniqueID eq or 2 index /XUID eq or }
- if not { 3 copy put } if pop pop
+ 1 index /FID eq 4 index
+ { 2 index /UniqueID eq or 2 index /XUID eq or }
+ if not { 3 copy put } if pop pop
}
forall exch
}
@@ -694,7 +694,7 @@ end readonly def
% Return a possibly updated font, and a flag to indicate whether
% the font was actually copied.
/.updatefontmetrics { % <font> <Metrics|null> .updatefontmetrics
- % <font'> <copied>
+ % <font'> <copied>
dup //null ne {
exch //true .copyfontdict dup /Metrics 4 -1 roll put //true
} {
@@ -703,7 +703,7 @@ end readonly def
} bdef
/.updatefontencoding { % <font> <Encoding|null> .updatefontencoding
- % <font'> <copied>
+ % <font'> <copied>
dup //null ne { dup 2 index /Encoding get ne } { //false } ifelse {
exch //false .copyfontdict dup /Encoding 4 -1 roll put //true
} {
@@ -772,9 +772,9 @@ end readonly def
} bind def
/textrenderingprocs [ % (0 is handled specially)
- % Painting-only modes
+ % Painting-only modes
{ tf } { tS } { tB } { tn }
- % Clipping modes
+ % Clipping modes
{ gsave tf grestore tW }
{ gsave tS grestore tW }
{ gsave tB grestore tW }
@@ -782,104 +782,104 @@ end readonly def
] readonly def
/pdfwrite_textrenderingprocs [
- % Tr 0 - Fill
- { setfillstate show } bind
- % Tr 1 - Stroke
- { currentlinewidth exch setstrokestate
+ % Tr 0 - Fill
+ { setfillstate show } bind
+ % Tr 1 - Stroke
+ { currentlinewidth exch setstrokestate
% Need to set the stroke width to a value which gives the correct
% width under pdfwrite. Pdfwrite uses (in text mode) an identity
% CTM, so we need to calculate the stroke width which would result
- % if the CTM had been unity.
- currentlinewidth dup
- matrix defaultmatrix idtransform TextSaveMatrix dtransform
- 2 copy eq {
+ % if the CTM had been unity.
+ currentlinewidth dup
+ matrix defaultmatrix idtransform TextSaveMatrix dtransform
+ 2 copy eq {
pop
}{
- % non-square scaling reduces to Text matrix in pdfwrite , so
+ % non-square scaling reduces to Text matrix in pdfwrite , so
% we can ignore it. (wrong answer, but consistent)
pop pop currentlinewidth
}ifelse setlinewidth
.swapcolors show .swapcolors setlinewidth} bind
- % Tr 2 - Fill then Stroke
- { gsave 0 .settextrenderingmode
- setfillstate dup show currentpoint 3 -1 roll
- grestore gsave setstrokestate
- //false charpath
+ % Tr 2 - Fill then Stroke
+ { gsave 0 .settextrenderingmode
+ setfillstate dup show currentpoint 3 -1 roll
+ grestore gsave setstrokestate
+ //false charpath
% We need to make sure the matrix used for the stroke
- % and therefore stroke width does not include the
+ % and therefore stroke width does not include the
% Text Matrix Tm.
TextSaveMatrix setmatrix
.swapcolors
- stroke
+ stroke
.swapcolors
- grestore moveto
- } bind
- % Tr 3 - Neither fill nor stroke
- { setfillstate show } bind
- % Tr 4 - Fill, add to clip
- { gsave 0 .settextrenderingmode
- setfillstate dup show grestore //true charpath } bind
- % Tr 5 - Stroke, add to clip
- { gsave 1 .settextrenderingmode
- setstrokestate dup .swapcolors show .swapcolors grestore
- //true charpath } bind
- % Tr 6 - Fill, stroke, add to clip
- { gsave 0 .settextrenderingmode
- setfillstate dup show grestore gsave dup
- setstrokestate //false charpath
+ grestore moveto
+ } bind
+ % Tr 3 - Neither fill nor stroke
+ { setfillstate show } bind
+ % Tr 4 - Fill, add to clip
+ { gsave 0 .settextrenderingmode
+ setfillstate dup show grestore //true charpath } bind
+ % Tr 5 - Stroke, add to clip
+ { gsave 1 .settextrenderingmode
+ setstrokestate dup .swapcolors show .swapcolors grestore
+ //true charpath } bind
+ % Tr 6 - Fill, stroke, add to clip
+ { gsave 0 .settextrenderingmode
+ setfillstate dup show grestore gsave dup
+ setstrokestate //false charpath
% We need to make sure the matrix used for the stroke
- % and therefore stroke width does not include the
+ % and therefore stroke width does not include the
% Text Matrix Tm.
TextSaveMatrix setmatrix
.swapcolors
- stroke .swapcolors grestore
- //true charpath } bind
- % Tr 7 - Add to clip
- { //true charpath } bind
+ stroke .swapcolors grestore
+ //true charpath } bind
+ % Tr 7 - Add to clip
+ { //true charpath } bind
] readonly def
/setshowstate
{ WordSpacing 0 eq TextSpacing 0 eq and FontMatrixNonHV not and
- {
+ {
% Check to see if the current device supports Tr
currentdevice 1 dict dup /PreserveTrMode dup put .getdeviceparams
dup type /booleantype eq not {cleartomark //false}{3 1 roll cleartomark}ifelse
- {
- pdfwrite_textrenderingprocs TextRenderingMode get
- }
- {
- TextRenderingMode 0 eq {
- { setfillstate show }
- } {
- TextRenderingMode 3 eq {
- % Some PDF files execute 'tm' with a singular matrix,
- % and then use the text rendering mode 3.
- % The graphics library currently cannot handle text
- % operations when the CTM is singular.
- % Work around this here.
- {
- matrix currentmatrix dup dup
- dup 0 get 0 eq 1 index 1 get 0 eq and {
- dup dup 2 get 0 eq { 0 }{ 1 } ifelse 1 put
- } if
- dup 2 get 0 eq 1 index 3 get 0 eq and {
- dup dup 1 get 0 eq { 3 }{ 2 } ifelse 1 put
- } if
- setmatrix
- 2 index setfillstate show % Tr was set to graphic state.
- setmatrix
- % now set the currentpoint using the original matrix
- gsave
- setmatrix
- //false charpath currentpoint newpath
- grestore
- moveto
- }
- } {
- { //false charpath textrenderingprocs TextRenderingMode get exec }
- } ifelse
- } ifelse
- } ifelse
+ {
+ pdfwrite_textrenderingprocs TextRenderingMode get
+ }
+ {
+ TextRenderingMode 0 eq {
+ { setfillstate show }
+ } {
+ TextRenderingMode 3 eq {
+ % Some PDF files execute 'tm' with a singular matrix,
+ % and then use the text rendering mode 3.
+ % The graphics library currently cannot handle text
+ % operations when the CTM is singular.
+ % Work around this here.
+ {
+ matrix currentmatrix dup dup
+ dup 0 get 0 eq 1 index 1 get 0 eq and {
+ dup dup 2 get 0 eq { 0 }{ 1 } ifelse 1 put
+ } if
+ dup 2 get 0 eq 1 index 3 get 0 eq and {
+ dup dup 1 get 0 eq { 3 }{ 2 } ifelse 1 put
+ } if
+ setmatrix
+ 2 index setfillstate show % Tr was set to graphic state.
+ setmatrix
+ % now set the currentpoint using the original matrix
+ gsave
+ setmatrix
+ //false charpath currentpoint newpath
+ grestore
+ moveto
+ }
+ } {
+ { //false charpath textrenderingprocs TextRenderingMode get exec }
+ } ifelse
+ } ifelse
+ } ifelse
}
{ TextRenderingMode 0 eq TextRenderingMode 3 eq or
% Tr was set to graphic state.
@@ -888,55 +888,55 @@ end readonly def
setfillstate
[ TextSpacing WordSpacing 3 index
{ % str [... weach wword c undef|ythis xthis|undef
- exch % will be removed, unless FontMatrix.xx/yy == 0 (FontMatrixNonHV already true)
+ exch % will be removed, unless FontMatrix.xx/yy == 0 (FontMatrixNonHV already true)
Vexch pop % str [... weach wword c wthis
3 index add exch 32 eq {1 index add} if % str [... weach wword w
3 1 roll % str [... w weach wword
}
% for the "exch" removed or not below, see comment in pdf_font.ps::getfontmetrics
- currentfont /FontMatrix get 0 3 Vexch pop get 0 ne {
- 1 1 index length 1 sub getinterval cvx
- } if
- cshow pop pop ]
+ currentfont /FontMatrix get 0 3 Vexch pop get 0 ne {
+ 1 1 index length 1 sub getinterval cvx
+ } if
+ cshow pop pop ]
{ xshow } { yshow } Vexch pop exec
}
} {
WordSpacing 0 eq
{ { setfillstate TextSpacing 0 Vexch 3 -1 roll ashow } }
- { TextSpacing 0 eq
+ { TextSpacing 0 eq
{ { setfillstate WordSpacing 0 Vexch 32 4 -1 roll widthshow } }
{ { setfillstate WordSpacing 0 Vexch 32
TextSpacing 0 Vexch 6 -1 roll awidthshow } }
- ifelse
- }
- ifelse
+ ifelse
+ }
+ ifelse
} ifelse
}
{ { WordSpacing TextSpacing
- % Implement the combination of t3 and false charpath.
- % Note that we must use cshow for this, because we
- % can't parse multi-byte strings any other way.
- % Stack: string wword wchar
- {
- exch % will be removed, unless FontMatrixNonHV && FontMatrix.xx/yy == 0
- % Stack: str wword wchar ccode xthis ythis
- Vexch pop currentpoint 6 3 roll
- % Stack: str wthis xorig yorig wword wchar ccode
- (x) dup 0 3 index put //false charpath
+ % Implement the combination of t3 and false charpath.
+ % Note that we must use cshow for this, because we
+ % can't parse multi-byte strings any other way.
+ % Stack: string wword wchar
+ {
+ exch % will be removed, unless FontMatrixNonHV && FontMatrix.xx/yy == 0
+ % Stack: str wword wchar ccode xthis ythis
+ Vexch pop currentpoint 6 3 roll
+ % Stack: str wthis xorig yorig wword wchar ccode
+ (x) dup 0 3 index put //false charpath
3 copy 32 eq { add } { exch pop } ifelse
- % Stack: str wthis xorig yorig wword wchar ccode wextra
+ % Stack: str wthis xorig yorig wword wchar ccode wextra
7 -3 roll moveto add
0 Vexch rmoveto pop
- }
+ }
% for the "exch" removed or not below, see comment in pdf_font.ps::getfontmetrics
- FontMatrixNonHV dup not exch {
- currentfont /FontMatrix get 0 3 Vexch pop get 0 ne
- } if {
- 1 1 index length 1 sub getinterval cvx
- } if
- 4 -1 roll cshow pop pop
- textrenderingprocs TextRenderingMode get exec
- }
+ FontMatrixNonHV dup not exch {
+ currentfont /FontMatrix get 0 3 Vexch pop get 0 ne
+ } if {
+ 1 1 index length 1 sub getinterval cvx
+ } if
+ 4 -1 roll cshow pop pop
+ textrenderingprocs TextRenderingMode get exec
+ }
}
ifelse
}
@@ -989,20 +989,20 @@ end readonly def
% Handle transparency the same as /B operator
/tB {
PDFusingtransparency {
- % knockout trans group around the filled and stroked object
- mark
- /Isolated //true /Knockout //true
- .dicttomark
- 1 .setopacityalpha
- % While text will always have a currentpoint, strokepath seems to mess with it.
- % we get the currentpoint, then use moveto to restore it for pathbbox
- gsave currentpoint strokepath moveto pathbbox grestore
- .begintransparencygroup
- gsave tf grestore tS
- .endtransparencygroup
- } {
- gsave tf grestore tS
- } ifelse
+ % knockout trans group around the filled and stroked object
+ mark
+ /Isolated //true /Knockout //true
+ .dicttomark
+ 1 .setopacityalpha
+ % While text will always have a currentpoint, strokepath seems to mess with it.
+ % we get the currentpoint, then use moveto to restore it for pathbbox
+ gsave currentpoint strokepath moveto pathbbox grestore
+ .begintransparencygroup
+ gsave tf grestore tS
+ .endtransparencygroup
+ } {
+ gsave tf grestore tS
+ } ifelse
} bdef
% This does the wrong thing if there have been multiple text operations
@@ -1022,7 +1022,7 @@ end readonly def
} {
4 index 16#1000000 and 0 ne { % comb
8 { pop } repeat (Combed form fields are not yet implemented.) =
- } { % plain text
+ } { % plain text
3 1 roll sub add 2 div % MaxLen (V) Ff Q dx (dy-yy+desc)/2
0 exch moveto % MaxLen (V) Ff Q dx
1 index 0 ne {
diff --git a/gs/Resource/Init/pdf_rbld.ps b/gs/Resource/Init/pdf_rbld.ps
index d272d3dc9..31167bc2c 100644
--- a/gs/Resource/Init/pdf_rbld.ps
+++ b/gs/Resource/Init/pdf_rbld.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2002 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -41,41 +41,41 @@
pdfformaterror
pop 0
} if
- % We store generation numbers as value + 1
- % We reserve 0 to indicate an free xref entry
+ % We store generation numbers as value + 1
+ % We reserve 0 to indicate an free xref entry
1 add % increment generation number
- % To save space, generations numbers are stored in a lstring unless we
- % find a generation number greater than 255. If so then transfer to
- % an larray.
+ % To save space, generations numbers are stored in a lstring unless we
+ % find a generation number greater than 255. If so then transfer to
+ % an larray.
dup 255 gt {
Generations ltype /stringtype eq { % Convert Generations to an larray.
larray Generations llength lgrowto dup % Create new larray
0 1 2 index llength 1 sub { % Copy from old lstring to new larray
- Generations 1 index lget lput dup
+ Generations 1 index lget lput dup
} for
pop
/Generations exch store % Save new Generations larray
} if
} if
- % Verify that the new values are for a new object. If the current
- % entry is null then we have a new entry.
+ % Verify that the new values are for a new object. If the current
+ % entry is null then we have a new entry.
Objects 4 index lget //null eq {
ObjectStream 4 index 4 index cvx lput % Save ObjectStream object number
Objects 4 index 3 index cvx lput % Save object location
Generations 4 index 2 index lput % Save geenration number
} {
- % Verify that the new entry has at least as high a generaton number
- % We accept equal entry number because we have found PDF files in
- % which there are multiple objects with the same object and entry
- % numbers. The normal xref logic only accepts the first such
- % entry that it finds. However the 'rebuild PDF' logic can find
- % both such entries. The correct one is usually the last one.
+ % Verify that the new entry has at least as high a generaton number
+ % We accept equal entry number because we have found PDF files in
+ % which there are multiple objects with the same object and entry
+ % numbers. The normal xref logic only accepts the first such
+ % entry that it finds. However the 'rebuild PDF' logic can find
+ % both such entries. The correct one is usually the last one.
Generations 4 index lget 1 index le {
ObjectStream 4 index 4 index cvx lput % Save ObjectStream object number
Objects 4 index 3 index cvx lput % Save object location
Generations 4 index 2 index lput % Save geenration number
} if
- % Set error flag if we have equal object and generation numbers
+ % Set error flag if we have equal object and generation numbers
Generations 4 index lget 1 index eq { /dup_obj_gen_num //true def } if
} 8 -1 roll { ifelse } { pop if } ifelse % Run 'else' only when rebuilding.
} bind def
@@ -118,7 +118,7 @@
% Allocate space for post_eof_count to be bound into procedures below.
/post_eof_count 0 def
-
+
% We want the location of the trailer dictionary at the start of file.
% First we will find the xref. Then we will skip over the xref entries
% to the trailer.
@@ -157,7 +157,7 @@
PDFfile 0 setfileposition
PDFfile bytesavailable post_eof_count sub % location of end of data
dup 65535 .min % block size to read
- % stack: <file end pos> <block size>
+ % stack: <file end pos> <block size>
% move file position to the start of the block
2 copy sub PDFfile exch setfileposition
% read block of data
@@ -168,7 +168,7 @@
{ search not { exit } if pop } loop
% determine where the trailer is in the file
% trailer loc = end loc - remaing string length
- length sub
+ length sub
} {
pop pop 0
} ifelse
@@ -199,12 +199,12 @@
dup string 0 1 4 -1 roll 1 sub { 2 copy PDFfile read pop put pop } for
% search for last occurance of 'startxref'
//false % Assume that startxref not present
- exch (startxref) {
+ exch (startxref) {
search not { exit } if % Exit loop when no more startxref's
pop 3 -1 roll pop //true 3 1 roll % Idicate that we have found starxref
} loop
exch % Exch last string and 'found' flag
- {
+ {
% determine where the startxref is in the file
% 'startxref' loc = end loc - remaing string length - 9 bytes
length sub 9 sub
@@ -237,10 +237,10 @@
% contain some garbage. This routine checks how much. We then ignore this
% stuff when we are scanning for objects.
/determine_post_eof_count % - determine_post_eof_count <count>
-{ % Position to read block of data from the end of the file.
+{ % Position to read block of data from the end of the file.
PDFfilelen % size of file
dup 4096 .min % file_size block_size
- dup 3 1 roll sub % block_size file_size-block_size
+ dup 3 1 roll sub % block_size file_size-block_size
PDFfile exch setfileposition % block_size
string PDFfile exch readstring pop % ()
@@ -253,7 +253,7 @@
% Now search for %%EO or try to read a number after 'startxref'.
(%%EO) search {
- pop pop
+ pop pop
} {
% Look for a number after startxref
{ dup token { pop exch pop } if
@@ -262,7 +262,7 @@
length
} {
% Can't even find startxref, assume it's all objects
- pop 0
+ pop 0
} ifelse
} bind def
@@ -304,18 +304,18 @@
/integertype typed_token { % get obj number
/integertype typed_token { % get ref number
/nametype typed_token { % get 'obj' text
- pop % pop remaining string
- /obj eq { % verify name is 'obj'
- % make sure we have room in the arrays. We work in increments
- % of 20 each time we increase the size.
- 1 index 20 add 20 idiv 20 mul
- growPDFobjects
- % save xref parameters into ObjectStream, Objects and Generations
- 1 index 0 % rearrange parms for setxrefentry
- 4 index PDFoffset sub 3 index
- //true setxrefentry % save parameters
- pop pop pop pop % clear parameters
- } if % check if name is 'obj'
+ pop % pop remaining string
+ /obj eq { % verify name is 'obj'
+ % make sure we have room in the arrays. We work in increments
+ % of 20 each time we increase the size.
+ 1 index 20 add 20 idiv 20 mul
+ growPDFobjects
+ % save xref parameters into ObjectStream, Objects and Generations
+ 1 index 0 % rearrange parms for setxrefentry
+ 4 index PDFoffset sub 3 index
+ //true setxrefentry % save parameters
+ pop pop pop pop % clear parameters
+ } if % check if name is 'obj'
} if % check if we got 'obj" string
pop % remove ref number
} if % check if we got ref number
diff --git a/gs/Resource/Init/pdf_sec.ps b/gs/Resource/Init/pdf_sec.ps
index d30b847a9..e19149b94 100644
--- a/gs/Resource/Init/pdf_sec.ps
+++ b/gs/Resource/Init/pdf_sec.ps
@@ -15,8 +15,8 @@
% New versions of GS require explicit checks for /true, /false, and /null
% in .decpdfrun. This fix is backward-compatible.
-% Modified by Raph Levien and Ralph Giles to use the new C
-% implementations of md5 and arcfour in ghostscript 7.01, and to
+% Modified by Raph Levien and Ralph Giles to use the new C
+% implementations of md5 and arcfour in ghostscript 7.01, and to
% be compatible with PDF 1.4 128-bit encryption.
% Modified by Ralph Giles for PDF 1.6 AES encryption.
@@ -98,7 +98,6 @@ pdfdict begin
//false exch { 128 ge { pop //true exit } if } forall
} bind def
-
/pdf_padding_string
<28bf4e5e4e758a41 64004e56fffa0108
2e2e00b6d0683e80 2f0ca9fe6453697a>
@@ -154,7 +153,7 @@ def
()
( **** ID key in the trailer is required for encrypted files.\n) pdfformaterror
} ifelse
- 3 { concatstrings } repeat
+ 3 { concatstrings } repeat
% We will finish step 5 after possibly including step 6.
% The following only executed for /R equal to 3 or more
@@ -437,7 +436,7 @@ def
% iconv nor the Windows MultiByteToWideChar function, then we
% won't have the .locale_to_utf8 operator to convert passwords
% from the locale character set to UTF-8.
- %
+ %
% It's not a huge problem if you're missing either or both of
% these. ASCII passwords will work fine regardless, and even
% Unicode passwords will often be okay.
@@ -493,7 +492,7 @@ def
FileKey length 5 add string
dup 0 FileKey putinterval
exch
- % stack: gen# string obj#
+ % stack: gen# string obj#
2 copy 255 and FileKey length exch put
2 copy -8 bitshift 255 and FileKey length 1 add exch put
2 copy -16 bitshift 255 and FileKey length 2 add exch put
@@ -533,75 +532,75 @@ def
{ .pdftoken not { (%%EOF) cvn cvx } if
dup xcheck
{ PDFDEBUG { dup //== exec flush } if
- 3 -1 roll pop
- 2 copy .knownget
- { exch pop exch pop exec
+ 3 -1 roll pop
+ 2 copy .knownget
+ { exch pop exch pop exec
}
- { exch pop
+ { exch pop
dup /true eq
{ pop //true
}
{ dup /false eq
- { pop //false
+ { pop //false
}
{ dup /null eq
{ pop //null
}
- { ( **** Unknown operator: )
- exch =string cvs concatstrings (\n) concatstrings
- pdfformaterror
+ { ( **** Unknown operator: )
+ exch =string cvs concatstrings (\n) concatstrings
+ pdfformaterror
}
ifelse
}
ifelse
}
ifelse
- }
- ifelse
+ }
+ ifelse
}
{ exch pop PDFDEBUG { dup ==only ( ) print flush } if
- dup type /stringtype eq
+ dup type /stringtype eq
{
- % Check if we have encrypted strings R>=4 allows for
- % selection of encryption on streams and strings
+ % Check if we have encrypted strings R>=4 allows for
+ % selection of encryption on streams and strings
Trailer /Encrypt oget % Get encryption dictionary
dup /R oget 4 lt % only >=4 has selectable
{ % R < 4 --> arc4 strings
- pop 1 index arc4decode % Decrypt string
- PDFDEBUG { (%Decrypted: ) print dup //== exec flush } if
+ pop 1 index arc4decode % Decrypt string
+ PDFDEBUG { (%Decrypted: ) print dup //== exec flush } if
} { % Else R >= 4
- /StrF knownoget % Get StrF (if present)
- { % If StrF is present ...
- dup /Identity eq not % Check if StrF != Identity
- { /StdCF eq
- { Trailer /Encrypt oget /CF knownoget {
+ /StrF knownoget % Get StrF (if present)
+ { % If StrF is present ...
+ dup /Identity eq not % Check if StrF != Identity
+ { /StdCF eq
+ { Trailer /Encrypt oget /CF knownoget {
/StdCF oget /CFM oget
dup /AESV2 eq exch /AESV3 eq or
} {
//false
} ifelse { % Decrypt string
- 1 index aesdecode
+ 1 index aesdecode
} {
1 index arc4decode
} ifelse
- }
- { 1 index arc4decode }
- ifelse % If StrF != StdCF
- PDFDEBUG { (%Decrypted: ) print dup //== exec flush } if
- }
- { pop }
- ifelse % If StrF != identity
- }
- if % If StrF is known
- }
- ifelse % Ifelse R < 4
- } {
+ }
+ { 1 index arc4decode }
+ ifelse % If StrF != StdCF
+ PDFDEBUG { (%Decrypted: ) print dup //== exec flush } if
+ }
+ { pop }
+ ifelse % If StrF != identity
+ }
+ if % If StrF is known
+ }
+ ifelse % Ifelse R < 4
+ } {
dup type /nametype eq {
.pdffixname
} if
}
ifelse
- exch pop
+ exch pop
}
ifelse
}
@@ -612,7 +611,7 @@ def
//PDFScanRules_null { setuserparams } 0 get % reset PDF scannig mode if it was off
} if
/PDFsource PDFsource
- { store { stop } if } aload pop .packtomark cvx
+ { store { stop } if } aload pop .packtomark cvx
/PDFsource 3 -1 roll store exec
} bind def
currentdict /PDFScanRules_true undef
@@ -625,55 +624,55 @@ currentdict /PDFScanRules_null undef
2 copy computeobjkey dup 4 1 roll
PDFfile exch resolveopdict .decpdfrun
dup dup dup 5 2 roll
- % stack: object object key object object
+ % stack: object object key object object
{ % Use loop to provide an exitable context.
xcheck exch type /dicttype eq and % Check if executable dictionary
not { % If object is not ...
pop pop % ignore object
exit % Exit 'loop' context
} if % If not possible stream
- % Starting with PDF 1.4 (R = 3), there are some extra features
- % which control encryption of streams. The EncryptMetadata entry
- % in the Encrypt dict controls the encryption of metadata streams.
+ % Starting with PDF 1.4 (R = 3), there are some extra features
+ % which control encryption of streams. The EncryptMetadata entry
+ % in the Encrypt dict controls the encryption of metadata streams.
Trailer /Encrypt oget % Get encryption dictionary
dup /R oget dup 3 lt % Only PDF 1.4 and higher has options
{ % R < 3 --> all streams encrypted
pop pop /StreamKey exch put % Insert StreamKey in dictionary
- exit % Exit 'loop' context
+ exit % Exit 'loop' context
} if
- % Check EncryptMeta. stack: object object key Encrypt R
+ % Check EncryptMeta. stack: object object key Encrypt R
exch dup /EncryptMetadata knownoget % Get EncryptMetadata (if present)
not { //true } if % If not present default = true
not % Check if EncryptMetadata = false
{ % if false we need to check the stream type
- 3 index /Type knownoget % Get stream type (if present)
- not { //null } if % If type not present use fake name
- /Metadata eq % Check if the type is Metadata
+ 3 index /Type knownoget % Get stream type (if present)
+ not { //null } if % If type not present use fake name
+ /Metadata eq % Check if the type is Metadata
{ pop pop pop pop % Type == Metadata --> no encryption
- exit % Exit 'loop' context
+ exit % Exit 'loop' context
} if
} if
- % PDF 1.5 encryption (R == 4) has selectable encryption handlers. If
- % this is not PDF 1.5 encryption (R < 4) then we are done checking and
- % we need to decrypt the stream. stack: object object key R Encrypt
+ % PDF 1.5 encryption (R == 4) has selectable encryption handlers. If
+ % this is not PDF 1.5 encryption (R < 4) then we are done checking and
+ % we need to decrypt the stream. stack: object object key R Encrypt
exch 4 lt % Check for less than PDF 1.5
{ pop /StreamKey exch put % Insert StreamKey in dictionary
- exit % Exit 'loop' context
+ exit % Exit 'loop' context
} if
- % Check if the stream encryption handler (StmF) == Identity.
+ % Check if the stream encryption handler (StmF) == Identity.
PDFDEBUG {
- Trailer /Encrypt oget /CF knownoget {
+ Trailer /Encrypt oget /CF knownoget {
/StdCF oget /CFM oget
- (Encrypt StmF is StdCF with CFM ) print =
+ (Encrypt StmF is StdCF with CFM ) print =
} if
} if
/StmF knownoget % Get StmF (if present)
not { /Identity } if % If StmF not present default = Identity
/Identity eq % Check if StmF == Identity
{ pop pop % Identity --> no encryption
- exit % Exit 'loop' context
+ exit % Exit 'loop' context
} if
- % If we get here then we need to decrypt the stream.
+ % If we get here then we need to decrypt the stream.
/StreamKey exch put % Insert StreamKey into dictionary
exit % Exit 'loop' context, never loop
} loop % End of loop exitable context
@@ -688,20 +687,20 @@ currentdict /PDFScanRules_null undef
/pdf_decrypt_stream
{ 3 index /StreamKey known % Check if the file is encrypted
{
- exch
- % Stack: readdata? dict parms filternames file/string
+ exch
+ % Stack: readdata? dict parms filternames file/string
3 index /StreamKey get
Trailer /Encrypt oget
dup /StmF knownoget
{ % stack: key Encrypt StmF
- exch /CF knownoget {
- exch oget /CFM oget % stack: key StmF-CFM
- dup /AESV2 eq exch /AESV3 eq or
+ exch /CF knownoget {
+ exch oget /CFM oget % stack: key StmF-CFM
+ dup /AESV2 eq exch /AESV3 eq or
} { pop //false } ifelse
- { aesdecodefilter } % install the requested filter
- { arc4decodefilter }
- ifelse
- }
+ { aesdecodefilter } % install the requested filter
+ { arc4decodefilter }
+ ifelse
+ }
{ pop arc4decodefilter } % fallback for no StmF
ifelse
exch
diff --git a/gs/base/ConvertUTF.c b/gs/base/ConvertUTF.c
index 0472964fd..0b1bfc910 100644
--- a/gs/base/ConvertUTF.c
+++ b/gs/base/ConvertUTF.c
@@ -1,8 +1,8 @@
/*
* Copyright 2001-2004 Unicode, Inc.
- *
+ *
* Disclaimer
- *
+ *
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
@@ -10,9 +10,9 @@
* purchased on magnetic or optical media from Unicode, Inc., the
* sole remedy for any claim will be exchange of defective media
* within 90 days of receipt.
- *
+ *
* Limitations on Rights to Redistribute This Code
- *
+ *
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form
@@ -22,17 +22,16 @@
/* $Id$*/
-
/* ---------------------------------------------------------------------
Conversions between UTF32, UTF-16, and UTF-8. Source code file.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
Sept 2001: fixed const & error conditions per
- mods suggested by S. Parent & A. Lillich.
+ mods suggested by S. Parent & A. Lillich.
June 2002: Tim Dodd added detection and handling of incomplete
- source sequences, enhanced error detection, added casts
- to eliminate compiler warnings.
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
July 2003: slight mods to back out aggressive FFFE detection.
Jan 2004: updated switches in from-UTF8 conversions.
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
@@ -41,7 +40,6 @@
------------------------------------------------------------------------ */
-
#include "ConvertUTF.h"
#ifdef CVTUTF_DEBUG
#include <stdio.h>
@@ -62,46 +60,46 @@ static const UTF32 halfMask = 0x3FFUL;
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF16 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- if (target >= targetEnd) {
- result = targetExhausted; break;
- }
- ch = *source++;
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_LEGAL_UTF32) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- --source; /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
+ UTF32 ch;
+ if (target >= targetEnd) {
+ result = targetExhausted; break;
+ }
+ ch = *source++;
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_LEGAL_UTF32) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ --source; /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -111,48 +109,48 @@ ConversionResult ConvertUTF32toUTF16 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF32 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF32* target = *targetStart;
UTF32 ch, ch2;
while (source < sourceEnd) {
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- if (target >= targetEnd) {
- source = oldSource; /* Back up source pointer! */
- result = targetExhausted; break;
- }
- *target++ = ch;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ if (target >= targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ *target++ = ch;
}
*sourceStart = source;
*targetStart = target;
@@ -190,8 +188,8 @@ static const char trailingBytesForUTF8[256] = {
* This table contains as many values as there might be trailing bytes
* in a UTF-8 sequence.
*/
-static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
@@ -215,67 +213,67 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- UTF32 ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /* Figure out how many bytes the result will require */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- source = oldSource; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -300,19 +298,19 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
const UTF8 *srcptr = source+length;
switch (length) {
default: return false;
- /* Everything else falls through when "true"... */
+ /* Everything else falls through when "true"... */
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
- switch (*source) {
- /* no fall-through in this inner switch */
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
- default: if (a < 0x80) return false;
- }
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
}
@@ -329,7 +327,7 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
int length = trailingBytesForUTF8[*source]+1;
if (source+length > sourceEnd) {
- return false;
+ return false;
}
return isLegalUTF8(source, length);
}
@@ -337,70 +335,70 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_UTF16) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- source -= (extraBytesToRead+1); /* return to the start */
- break; /* Bail out; shouldn't continue */
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead+1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -410,50 +408,50 @@ ConversionResult ConvertUTF8toUTF16 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- ch = *source++;
- if (flags == strictConversion ) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /*
- * Figure out how many bytes the result will require. Turn any
- * illegally large UTF32 things (> Plane 17) into replacement chars.
- */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- result = sourceIllegal;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- --source; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion ) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -463,59 +461,59 @@ ConversionResult ConvertUTF32toUTF8 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF32 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF32* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6;
- case 4: ch += *source++; ch <<= 6;
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up the source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_LEGAL_UTF32) {
- /*
- * UTF-16 surrogate values are illegal in UTF-32, and anything
- * over Plane 17 (> 0x10FFFF) is illegal.
- */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = ch;
- }
- } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
- result = sourceIllegal;
- *target++ = UNI_REPLACEMENT_CHAR;
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6;
+ case 4: ch += *source++; ch <<= 6;
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up the source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -528,14 +526,14 @@ ConversionResult ConvertUTF8toUTF32 (
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
- {
- int tmpBytesToRead = extraBytesToRead+1;
- do {
- ch += *source++;
- --tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
- } while (tmpBytesToRead > 0);
- }
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
In UTF-8 writing code, the switches on "bytesToWrite" are
similarly unrolled loops.
diff --git a/gs/base/ConvertUTF.h b/gs/base/ConvertUTF.h
index ed23fb28f..24ad173b0 100644
--- a/gs/base/ConvertUTF.h
+++ b/gs/base/ConvertUTF.h
@@ -1,8 +1,8 @@
/*
* Copyright 2001-2004 Unicode, Inc.
- *
+ *
* Disclaimer
- *
+ *
* This source code is provided as is by Unicode, Inc. No claims are
* made as to fitness for any particular purpose. No warranties of any
* kind are expressed or implied. The recipient agrees to determine
@@ -10,9 +10,9 @@
* purchased on magnetic or optical media from Unicode, Inc., the
* sole remedy for any claim will be exchange of defective media
* within 90 days of receipt.
- *
+ *
* Limitations on Rights to Redistribute This Code
- *
+ *
* Unicode, Inc. hereby grants the right to freely use the information
* supplied in this file in the creation of products supporting the
* Unicode Standard, and to make copies of this file in any form
@@ -38,7 +38,7 @@
Each routine converts the text between *sourceStart and sourceEnd,
putting the result into the buffer between *targetStart and
- targetEnd. Note: the end pointers are *after* the last item: e.g.
+ targetEnd. Note: the end pointers are *after* the last item: e.g.
*(sourceEnd - 1) is the last item.
The return result indicates whether the conversion was successful,
@@ -50,12 +50,12 @@
the respective buffers.
Input parameters:
- sourceStart - pointer to a pointer to the source buffer.
- The contents of this are modified on return so that
- it points at the next thing to be converted.
- targetStart - similarly, pointer to pointer to the target buffer.
- sourceEnd, targetEnd - respectively pointers to the ends of the
- two buffers, for overflow checking only.
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
These conversion functions take a ConversionFlags argument. When this
flag is set to strict, both irregular sequences and isolated surrogates
@@ -72,15 +72,15 @@
they constitute an error.
Output parameters:
- The value "sourceIllegal" is returned from some routines if the input
- sequence is malformed. When "sourceIllegal" is returned, the source
- value will point to the illegal value that caused the problem. E.g.,
- in UTF-8 when a sequence is malformed, it points to the start of the
- malformed sequence.
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
- Fixes & updates, Sept 2001.
+ Fixes & updates, Sept 2001.
------------------------------------------------------------------------ */
@@ -105,15 +105,15 @@ typedef unsigned char Boolean; /* 0 or 1 */
#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
typedef enum {
- conversionOK, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted, /* insuff. room in target for conversion */
- sourceIllegal /* source sequence is illegal/malformed */
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
} ConversionResult;
typedef enum {
- strictConversion = 0,
- lenientConversion
+ strictConversion = 0,
+ lenientConversion
} ConversionFlags;
/* This is for C++ and does no harm in C */
@@ -122,28 +122,28 @@ extern "C" {
#endif
ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+
ConversionResult ConvertUTF8toUTF32 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+
ConversionResult ConvertUTF16toUTF32 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
ConversionResult ConvertUTF32toUTF16 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
diff --git a/gs/base/aes.c b/gs/base/aes.c
index 05b8d6a22..712538f4a 100644
--- a/gs/base/aes.c
+++ b/gs/base/aes.c
@@ -1086,7 +1086,6 @@ int aes_self_test( int verbose )
printf( "passed\n" );
}
-
if( verbose != 0 )
printf( "\n" );
diff --git a/gs/base/aes.h b/gs/base/aes.h
index e2b192a57..c0bfd830d 100644
--- a/gs/base/aes.h
+++ b/gs/base/aes.h
@@ -62,7 +62,7 @@ extern "C" {
* \param keysize must be 128, 192 or 256
*/
void aes_setkey_enc( aes_context *ctx, const unsigned char *key,
- int keysize );
+ int keysize );
/**
* \brief AES key schedule (decryption)
@@ -72,7 +72,7 @@ void aes_setkey_enc( aes_context *ctx, const unsigned char *key,
* \param keysize must be 128, 192 or 256
*/
void aes_setkey_dec( aes_context *ctx, const unsigned char *key,
- int keysize );
+ int keysize );
/**
* \brief AES-ECB block encryption/decryption
diff --git a/gs/base/assert_.h b/gs/base/assert_.h
index 8800a1f9f..aeb4b2912 100644
--- a/gs/base/assert_.h
+++ b/gs/base/assert_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/ctype_.h b/gs/base/ctype_.h
index 35984a6cf..d10c69dae 100644
--- a/gs/base/ctype_.h
+++ b/gs/base/ctype_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/dirent_.h b/gs/base/dirent_.h
index 2c89ab080..8a6eade81 100644
--- a/gs/base/dirent_.h
+++ b/gs/base/dirent_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/dos_.h b/gs/base/dos_.h
index 637407091..c63481253 100644
--- a/gs/base/dos_.h
+++ b/gs/base/dos_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/echogs.c b/gs/base/echogs.c
index 42ce44503..d40bbbe25 100644
--- a/gs/base/echogs.c
+++ b/gs/base/echogs.c
@@ -105,217 +105,217 @@ main(int argc, char *argv[])
int nargs = argc - 1;
if (nargs > 0 && !strcmp(*argp, "-e")) {
- if (nargs < 2)
- return 1;
- extn = argp[1];
- argp += 2, nargs -= 2;
+ if (nargs < 2)
+ return 1;
+ extn = argp[1];
+ argp += 2, nargs -= 2;
}
if (nargs > 0 && (*argp)[0] == '-' &&
- ((*argp)[1] == 'w' || (*argp)[1] == 'a')
- ) {
- size_t len = strlen(*argp);
- int i;
+ ((*argp)[1] == 'w' || (*argp)[1] == 'a')
+ ) {
+ size_t len = strlen(*argp);
+ int i;
- if (len > 4)
- return 1;
- for (i = 1; i < nargs; i++)
- if (argp[i][0] != '-')
- break;
- if (i == nargs)
- return 1;
- fnparam = argp[i];
- strcpy(fmode, *argp + 1);
- strcpy(fname, fnparam);
- strcat(fname, extn);
- if (fmode[len - 2] == '-') {
- /*
- * The referents of argp are actually const, but they can't be
- * declared that way, so we have to make a writable constant.
- */
- static char dash[2] = { '-', 0 };
+ if (len > 4)
+ return 1;
+ for (i = 1; i < nargs; i++)
+ if (argp[i][0] != '-')
+ break;
+ if (i == nargs)
+ return 1;
+ fnparam = argp[i];
+ strcpy(fmode, *argp + 1);
+ strcpy(fname, fnparam);
+ strcat(fname, extn);
+ if (fmode[len - 2] == '-') {
+ /*
+ * The referents of argp are actually const, but they can't be
+ * declared that way, so we have to make a writable constant.
+ */
+ static char dash[2] = { '-', 0 };
- fmode[len - 2] = 0;
- argp[i] = dash;
- argp++, nargs--;
- } else {
- for (; i > 1; i--)
- argp[i] = argp[i - 1];
- argp += 2, nargs -= 2;
- }
+ fmode[len - 2] = 0;
+ argp[i] = dash;
+ argp++, nargs--;
+ } else {
+ for (; i > 1; i--)
+ argp[i] = argp[i - 1];
+ argp += 2, nargs -= 2;
+ }
} else
- strcpy(fname, "");
+ strcpy(fname, "");
if (nargs > 0 && !strcmp(*argp, "-h")) {
- eputc = hputc, eputs = hputs;
- argp++, nargs--;
+ eputc = hputc, eputs = hputs;
+ argp++, nargs--;
}
if (nargs > 0 && !strcmp(*argp, "-n")) {
- newline = 0;
- argp++, nargs--;
+ newline = 0;
+ argp++, nargs--;
}
if (strlen(fname) != 0) {
- out = fopen(fname, fmode);
- if (out == 0)
- return 1;
+ out = fopen(fname, fmode);
+ if (out == 0)
+ return 1;
}
while (1) {
- char *arg;
+ char *arg;
- if (interact) {
- if (fgets(line, LINESIZE, in) == NULL) {
- interact = 0;
- if (in != stdin)
- fclose(in);
- continue;
- }
- /* Remove the terminating \n. */
- line[strlen(line) - 1] = 0;
- arg = line;
- } else {
- if (nargs == 0)
- break;
- arg = *argp;
- argp++, nargs--;
- }
- if (sw == 0 && arg[0] == '-') {
- char chr = arg[1];
+ if (interact) {
+ if (fgets(line, LINESIZE, in) == NULL) {
+ interact = 0;
+ if (in != stdin)
+ fclose(in);
+ continue;
+ }
+ /* Remove the terminating \n. */
+ line[strlen(line) - 1] = 0;
+ arg = line;
+ } else {
+ if (nargs == 0)
+ break;
+ arg = *argp;
+ argp++, nargs--;
+ }
+ if (sw == 0 && arg[0] == '-') {
+ char chr = arg[1];
- sp = 0;
- swc:switch (chr) {
- case 'l': /* literal string, then -s */
- chr = 'Q';
- /* falls through */
- case 'q': /* literal string */
- case 'Q': /* literal string, then -s */
- if (arg[2] != 0) {
- (*eputs) (arg + 2, out);
- if (chr == 'Q')
- (*eputc) (' ', out);
- break;
- }
- /* falls through */
- case 'r': /* read from a file */
- case 'R':
- case 'u': /* upper-case string */
- case 'x': /* hex string */
- sw = chr;
- break;
- case 's': /* write a space */
- (*eputc) (' ', out);
- break;
- case 'i': /* read interactively */
- interact = 1;
- in = stdin;
- break;
- case 'b': /* insert base file name */
- case 'B':
- arg = fnparam + strlen(fnparam);
- while (arg > fnparam &&
- (isalnum(arg[-1]) || arg[-1] == '_'))
- --arg;
- (*eputs) (arg, out);
- break;
- case 'd': /* insert date/time */
- case 'D':
- {
- time_t t;
- char str[26];
+ sp = 0;
+ swc:switch (chr) {
+ case 'l': /* literal string, then -s */
+ chr = 'Q';
+ /* falls through */
+ case 'q': /* literal string */
+ case 'Q': /* literal string, then -s */
+ if (arg[2] != 0) {
+ (*eputs) (arg + 2, out);
+ if (chr == 'Q')
+ (*eputc) (' ', out);
+ break;
+ }
+ /* falls through */
+ case 'r': /* read from a file */
+ case 'R':
+ case 'u': /* upper-case string */
+ case 'x': /* hex string */
+ sw = chr;
+ break;
+ case 's': /* write a space */
+ (*eputc) (' ', out);
+ break;
+ case 'i': /* read interactively */
+ interact = 1;
+ in = stdin;
+ break;
+ case 'b': /* insert base file name */
+ case 'B':
+ arg = fnparam + strlen(fnparam);
+ while (arg > fnparam &&
+ (isalnum(arg[-1]) || arg[-1] == '_'))
+ --arg;
+ (*eputs) (arg, out);
+ break;
+ case 'd': /* insert date/time */
+ case 'D':
+ {
+ time_t t;
+ char str[26];
- time(&t);
- strcpy(str, ctime(&t));
- str[24] = 0; /* remove \n */
- (*eputs) (str, out);
- } break;
- case 'f': /* insert file name */
- case 'F':
- (*eputs) (fnparam, out);
- break;
- case 'X': /* treat literals as hex */
- hexx = 1;
- break;
- case '+': /* upper-case command */
- if (arg[1]) {
- ++arg;
- chr = toupper(arg[1]);
- goto swc;
- }
- /* falls through */
- case 0: /* just '-' */
- sw = '-';
- break;
- }
- } else
- switch (sw) {
- case 0:
- case '-':
- if (hexx)
- goto xx;
- if (sp)
- (*eputc) (' ', out);
- (*eputs) (arg, out);
- sp = 1;
- break;
- case 'q':
- sw = 0;
- (*eputs) (arg, out);
- break;
- case 'Q':
- sw = 0;
- (*eputs) (arg, out);
- (*eputc) (' ', out);
- break;
- case 'r':
- sw = 0;
- in = fopen(arg, "r");
- if (in == NULL)
- exit(exit_FAILED);
- interact = 1;
- break;
- case 'R':
- sw = 0;
- in = fopen(arg, "r");
- if (in == NULL)
- exit(exit_FAILED);
- while (fread(line, 1, 1, in) > 0)
- (*eputc) (line[0], out);
- fclose(in);
- break;
- case 'u':
- {
- char *up;
+ time(&t);
+ strcpy(str, ctime(&t));
+ str[24] = 0; /* remove \n */
+ (*eputs) (str, out);
+ } break;
+ case 'f': /* insert file name */
+ case 'F':
+ (*eputs) (fnparam, out);
+ break;
+ case 'X': /* treat literals as hex */
+ hexx = 1;
+ break;
+ case '+': /* upper-case command */
+ if (arg[1]) {
+ ++arg;
+ chr = toupper(arg[1]);
+ goto swc;
+ }
+ /* falls through */
+ case 0: /* just '-' */
+ sw = '-';
+ break;
+ }
+ } else
+ switch (sw) {
+ case 0:
+ case '-':
+ if (hexx)
+ goto xx;
+ if (sp)
+ (*eputc) (' ', out);
+ (*eputs) (arg, out);
+ sp = 1;
+ break;
+ case 'q':
+ sw = 0;
+ (*eputs) (arg, out);
+ break;
+ case 'Q':
+ sw = 0;
+ (*eputs) (arg, out);
+ (*eputc) (' ', out);
+ break;
+ case 'r':
+ sw = 0;
+ in = fopen(arg, "r");
+ if (in == NULL)
+ exit(exit_FAILED);
+ interact = 1;
+ break;
+ case 'R':
+ sw = 0;
+ in = fopen(arg, "r");
+ if (in == NULL)
+ exit(exit_FAILED);
+ while (fread(line, 1, 1, in) > 0)
+ (*eputc) (line[0], out);
+ fclose(in);
+ break;
+ case 'u':
+ {
+ char *up;
- for (up = arg; *up; up++)
- (*eputc) (toupper(*up), out);
- }
- sw = 0;
- break;
- case 'x':
- xx:{
- char *xp;
- unsigned int xchr = 1;
+ for (up = arg; *up; up++)
+ (*eputc) (toupper(*up), out);
+ }
+ sw = 0;
+ break;
+ case 'x':
+ xx:{
+ char *xp;
+ unsigned int xchr = 1;
- for (xp = arg; *xp; xp++) {
- char ch = *xp;
+ for (xp = arg; *xp; xp++) {
+ char ch = *xp;
- if (!isxdigit(ch))
- return 1;
- xchr <<= 4;
- xchr += (isdigit(ch) ? ch - '0' :
- (isupper(ch) ? tolower(ch) : ch)
- - 'a' + 10);
- if (xchr >= 0x100) {
- (*eputc) (xchr & 0xff, out);
- xchr = 1;
- }
- }
- }
- sw = 0;
- break;
- }
+ if (!isxdigit(ch))
+ return 1;
+ xchr <<= 4;
+ xchr += (isdigit(ch) ? ch - '0' :
+ (isupper(ch) ? tolower(ch) : ch)
+ - 'a' + 10);
+ if (xchr >= 0x100) {
+ (*eputc) (xchr & 0xff, out);
+ xchr = 1;
+ }
+ }
+ }
+ sw = 0;
+ break;
+ }
}
if (newline)
- (*eputc) ('\n', out);
+ (*eputc) ('\n', out);
if (out != stdout)
- fclose(out);
+ fclose(out);
return exit_OK;
}
@@ -334,6 +334,6 @@ static int
hputs(const char *str, FILE * out)
{
while (*str)
- hputc(*str++ & 0xff, out);
+ hputc(*str++ & 0xff, out);
return 0;
}
diff --git a/gs/base/errno_.h b/gs/base/errno_.h
index 37f3b0bfa..90d6f46ea 100644
--- a/gs/base/errno_.h
+++ b/gs/base/errno_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/errors.h b/gs/base/errors.h
index 30855089d..f26cf5768 100644
--- a/gs/base/errors.h
+++ b/gs/base/errors.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,7 +16,7 @@
# define errors_INCLUDED
/* This file used to contain error codes for the Ghostscript client api.
- * It has been renamed ierrors.h to reduce the risk of namespace collision
+ * It has been renamed ierrors.h to reduce the risk of namespace collision
* and to be consistent with iapi.h.
*/
diff --git a/gs/base/fcntl_.h b/gs/base/fcntl_.h
index a5eddb0cc..4ced01abf 100644
--- a/gs/base/fcntl_.h
+++ b/gs/base/fcntl_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gconf.c b/gs/base/gconf.c
index 95ceac278..291a2bce2 100644
--- a/gs/base/gconf.c
+++ b/gs/base/gconf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -91,7 +91,7 @@ static const gs_composite_type_t *const gx_compositor_list[] = {
static const gx_device *gx_device_list[1024] = {
/* as shared library are adding drivers here, so removed constness */
#include "gconf.h"
- 0
+ 0
};
#undef device2_
#undef device_
@@ -168,18 +168,18 @@ gs_find_compositor(int comp_id)
extern_gs_lib_device_list();
int
gs_lib_device_list(const gx_device * const **plist,
- gs_memory_struct_type_t ** pst)
+ gs_memory_struct_type_t ** pst)
{
int i;
if (plist != 0)
- *plist = gx_device_list;
+ *plist = gx_device_list;
if (pst != 0)
- *pst = NULL;
+ *pst = NULL;
for (i = 0; i < countof(gx_device_list) - 1; ++i)
if (!gx_device_list[i])
- break;
+ break;
return i;
}
diff --git a/gs/base/gconf.h b/gs/base/gconf.h
index 7234d097f..5e09a1933 100644
--- a/gs/base/gconf.h
+++ b/gs/base/gconf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdebug.h b/gs/base/gdebug.h
index 37b046d68..86052abd7 100644
--- a/gs/base/gdebug.h
+++ b/gs/base/gdebug.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -105,9 +105,9 @@ extern FILE *gs_debug_out;
/* Debugging support procedures in gsmisc.c */
void debug_dump_bytes(const byte * from, const byte * to,
- const char *msg);
+ const char *msg);
void debug_dump_bitmap(const byte * from, uint raster, uint height,
- const char *msg);
+ const char *msg);
void debug_print_string(const byte * str, uint len);
void debug_print_string_hex(const byte * str, uint len);
diff --git a/gs/base/gdev3852.c b/gs/base/gdev3852.c
index acf0e7352..33d1d8faa 100644
--- a/gs/base/gdev3852.c
+++ b/gs/base/gdev3852.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,8 +18,8 @@ This driver program created by Kevin M. Gift <kgift@draper.com> in Sept. 1992.
Modified 3/93 to correct bug in cnt_2prn size.
Modified 3/93 to dimension page back to 8.5, which seems to
work better than the actual page width of 7.6, ie. it uses
- the full printing width of the printer.
- It was modeled after the V2.4.1 HP Paintjet driver (gdevpjet.c)
+ the full printing width of the printer.
+ It was modeled after the V2.4.1 HP Paintjet driver (gdevpjet.c)
Modified by L. Peter Deutsch <ghost@aladdin.com> 1999-01-10 to remove _ss
modifiers inappropriately copied from other code.
*/
@@ -44,12 +44,11 @@ static gx_device_procs jetp3852_procs =
gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
const gx_device_printer far_data gs_jetp3852_device =
prn_device(jetp3852_procs, "jetp3852",
- 86, /* width_10ths, 8.6" (?) */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.0, 0, 0.0, 0, /* left, bottom, right, top margins */
- 3, jetp3852_print_page);
-
+ 86, /* width_10ths, 8.6" (?) */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.0, 0, 0.0, 0, /* left, bottom, right, top margins */
+ 3, jetp3852_print_page);
/* ------ Internal routines ------ */
@@ -60,125 +59,125 @@ jetp3852_print_page(gx_device_printer *pdev, FILE *prn_stream)
#define DATA_SIZE (LINE_SIZE * 8)
unsigned int cnt_2prn;
- unsigned int count,tempcnt;
- unsigned char vtp,cntc1,cntc2;
- int line_size_color_plane;
-
- byte data[DATA_SIZE];
- byte plane_data[LINE_SIZE * 3];
-
- /* Set initial condition for printer */
- fputs("\033@",prn_stream);
-
- /* Send each scan line in turn */
- { int lnum;
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- int num_blank_lines = 0;
- for ( lnum = 0; lnum < pdev->height; lnum++ )
- { byte *end_data = data + line_size;
- gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
- /* Remove trailing 0s. */
- while ( end_data > data && end_data[-1] == 0 )
- end_data--;
- if ( end_data == data )
- { /* Blank line */
- num_blank_lines++;
- }
- else
- { int i;
- byte *odp;
- byte *row;
-
- /* Pad with 0s to fill out the last */
- /* block of 8 bytes. */
- memset(end_data, 0, 7);
-
- /* Transpose the data to get pixel planes. */
- for ( i = 0, odp = plane_data; i < DATA_SIZE;
- i += 8, odp++
- )
- { /* The following is for 16-bit machines */
+ unsigned int count,tempcnt;
+ unsigned char vtp,cntc1,cntc2;
+ int line_size_color_plane;
+
+ byte data[DATA_SIZE];
+ byte plane_data[LINE_SIZE * 3];
+
+ /* Set initial condition for printer */
+ fputs("\033@",prn_stream);
+
+ /* Send each scan line in turn */
+ { int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int num_blank_lines = 0;
+ for ( lnum = 0; lnum < pdev->height; lnum++ )
+ { byte *end_data = data + line_size;
+ gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data == data )
+ { /* Blank line */
+ num_blank_lines++;
+ }
+ else
+ { int i;
+ byte *odp;
+ byte *row;
+
+ /* Pad with 0s to fill out the last */
+ /* block of 8 bytes. */
+ memset(end_data, 0, 7);
+
+ /* Transpose the data to get pixel planes. */
+ for ( i = 0, odp = plane_data; i < DATA_SIZE;
+ i += 8, odp++
+ )
+ { /* The following is for 16-bit machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static ulong spr40[8] = spread3(0x40);
- static ulong spr8[8] = spread3(8);
- static ulong spr2[8] = spread3(2);
- register byte *dp = data + i;
- register ulong pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr8[dp[3]] << 1) +
- (spr8[dp[4]]) +
- (spr8[dp[5]] >> 1) +
- (spr2[dp[6]]) +
- (spr2[dp[7]] >> 1);
- odp[0] = (byte)(pword >> 16);
- odp[LINE_SIZE] = (byte)(pword >> 8);
- odp[LINE_SIZE*2] = (byte)(pword);
- }
- /* Skip blank lines if any */
- if ( num_blank_lines > 0 )
- {
- if (lnum == 0)
- { /* Skip down the page from the top */
- /* set line spacing = 1/8 inch */
- fputs("\0330",prn_stream);
- /* Set vertical tab */
- vtp = (num_blank_lines / 8);
- fprintf(prn_stream,"\033B%c\000",vtp);
- /* Do vertical tab */
- fputs("\013",prn_stream);
- num_blank_lines = 0;
- }
- else
- { /* Do "dot skips" */
- while(num_blank_lines > 255)
- {
- fputs("\033e\377",prn_stream);
- num_blank_lines -= 255;
- }
- vtp = num_blank_lines;
- fprintf(prn_stream,"\033e%c",vtp);
- num_blank_lines = 0;
- }
- }
-
- /* Transfer raster graphics in the order R, G, B. */
- /* Apparently it is stored in B, G, R */
- /* Calculate the amount of data to send by what */
- /* Ghostscript tells us the scan line_size in (bytes) */
-
- count = line_size / 3;
- line_size_color_plane = count / 3;
- cnt_2prn = line_size_color_plane * 3 + 5;
- tempcnt = cnt_2prn;
- cntc1 = (tempcnt & 0xFF00) >> 8;
- cntc2 = (tempcnt & 0x00FF);
- fprintf(prn_stream, "\033[O%c%c\200\037",cntc2,cntc1);
- fputc('\000',prn_stream);
- fputs("\124\124",prn_stream);
-
- for ( row = plane_data + LINE_SIZE * 2, i = 0;
- i < 3; row -= LINE_SIZE, i++ )
- { int jj;
- byte ctemp;
- odp = row;
- /* Complement bytes */
- for (jj=0; jj< line_size_color_plane; jj++)
- { ctemp = *odp;
- *odp++ = ~ctemp;
- }
- fwrite(row, sizeof(byte),
- line_size_color_plane, prn_stream);
- }
- }
- }
- }
-
- /* eject page */
- fputs("\014", prn_stream);
-
- return 0;
+ static ulong spr40[8] = spread3(0x40);
+ static ulong spr8[8] = spread3(8);
+ static ulong spr2[8] = spread3(2);
+ register byte *dp = data + i;
+ register ulong pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr8[dp[3]] << 1) +
+ (spr8[dp[4]]) +
+ (spr8[dp[5]] >> 1) +
+ (spr2[dp[6]]) +
+ (spr2[dp[7]] >> 1);
+ odp[0] = (byte)(pword >> 16);
+ odp[LINE_SIZE] = (byte)(pword >> 8);
+ odp[LINE_SIZE*2] = (byte)(pword);
+ }
+ /* Skip blank lines if any */
+ if ( num_blank_lines > 0 )
+ {
+ if (lnum == 0)
+ { /* Skip down the page from the top */
+ /* set line spacing = 1/8 inch */
+ fputs("\0330",prn_stream);
+ /* Set vertical tab */
+ vtp = (num_blank_lines / 8);
+ fprintf(prn_stream,"\033B%c\000",vtp);
+ /* Do vertical tab */
+ fputs("\013",prn_stream);
+ num_blank_lines = 0;
+ }
+ else
+ { /* Do "dot skips" */
+ while(num_blank_lines > 255)
+ {
+ fputs("\033e\377",prn_stream);
+ num_blank_lines -= 255;
+ }
+ vtp = num_blank_lines;
+ fprintf(prn_stream,"\033e%c",vtp);
+ num_blank_lines = 0;
+ }
+ }
+
+ /* Transfer raster graphics in the order R, G, B. */
+ /* Apparently it is stored in B, G, R */
+ /* Calculate the amount of data to send by what */
+ /* Ghostscript tells us the scan line_size in (bytes) */
+
+ count = line_size / 3;
+ line_size_color_plane = count / 3;
+ cnt_2prn = line_size_color_plane * 3 + 5;
+ tempcnt = cnt_2prn;
+ cntc1 = (tempcnt & 0xFF00) >> 8;
+ cntc2 = (tempcnt & 0x00FF);
+ fprintf(prn_stream, "\033[O%c%c\200\037",cntc2,cntc1);
+ fputc('\000',prn_stream);
+ fputs("\124\124",prn_stream);
+
+ for ( row = plane_data + LINE_SIZE * 2, i = 0;
+ i < 3; row -= LINE_SIZE, i++ )
+ { int jj;
+ byte ctemp;
+ odp = row;
+ /* Complement bytes */
+ for (jj=0; jj< line_size_color_plane; jj++)
+ { ctemp = *odp;
+ *odp++ = ~ctemp;
+ }
+ fwrite(row, sizeof(byte),
+ line_size_color_plane, prn_stream);
+ }
+ }
+ }
+ }
+
+ /* eject page */
+ fputs("\014", prn_stream);
+
+ return 0;
}
diff --git a/gs/base/gdev3b1.c b/gs/base/gdev3b1.c
index 604e01159..43268657a 100644
--- a/gs/base/gdev3b1.c
+++ b/gs/base/gdev3b1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -146,29 +146,29 @@ att3b1_open(gx_device *dev)
#endif
if (att3b1dev->fd >= 0) {
- close(att3b1dev->fd);
- att3b1dev->fd = -1;
+ close(att3b1dev->fd);
+ att3b1dev->fd = -1;
}
if (att3b1dev->screen != NULL) {
- gs_free(dev->memory, (char *)att3b1dev->screen,
- att3b1dev->screen_size, 1, "att3b1_open");
- att3b1dev->screen = 0;
- att3b1dev->screen_size = 0;
+ gs_free(dev->memory, (char *)att3b1dev->screen,
+ att3b1dev->screen_size, 1, "att3b1_open");
+ att3b1dev->screen = 0;
+ att3b1dev->screen_size = 0;
}
att3b1dev->fd = open("/dev/tty", 2);
if (att3b1dev->fd < 0) {
- lprintf1("att3b1_open: open /dev/tty failed [%d]\n", errno);
- return_error(gs_error_ioerror);
+ lprintf1("att3b1_open: open /dev/tty failed [%d]\n", errno);
+ return_error(gs_error_ioerror);
}
/* Verify that /dev/tty is associated with a console window. */
if (ioctl(att3b1dev->fd, WIOCGETD, &uw) < 0) {
- lprintf1("att3b1_open: can not obtain window data [%d]\n", errno);
- lprintf("att3b1_open: the att3b1 device requires a console window\n");
- att3b1_close(dev);
- return_error(gs_error_ioerror);
+ lprintf1("att3b1_open: can not obtain window data [%d]\n", errno);
+ lprintf("att3b1_open: the att3b1 device requires a console window\n");
+ att3b1_close(dev);
+ return_error(gs_error_ioerror);
}
/* we need an even number of bytes per line */
@@ -176,10 +176,10 @@ att3b1_open(gx_device *dev)
att3b1dev->screen_size = att3b1dev->line_size * att3b1dev->height;
att3b1dev->screen =
- (uchar *)gs_malloc(dev->memory, att3b1dev->screen_size, 1, "att3b1_open");
+ (uchar *)gs_malloc(dev->memory, att3b1dev->screen_size, 1, "att3b1_open");
if (att3b1dev->screen == NULL) {
- att3b1_close(dev);
- return_error(gs_error_VMerror);
+ att3b1_close(dev);
+ return_error(gs_error_VMerror);
}
att3b1dev->page_num = 1;
@@ -197,15 +197,15 @@ int
att3b1_close(gx_device *dev)
{
if (att3b1dev->fd >= 0) {
- close(att3b1dev->fd);
- att3b1dev->fd = -1;
+ close(att3b1dev->fd);
+ att3b1dev->fd = -1;
}
if (att3b1dev->screen != NULL) {
- gs_free(dev->memory, (char *)att3b1dev->screen,
- att3b1dev->screen_size, 1, "att3b1_close");
- att3b1dev->screen = 0;
- att3b1dev->screen_size = 0;
+ gs_free(dev->memory, (char *)att3b1dev->screen,
+ att3b1dev->screen_size, 1, "att3b1_close");
+ att3b1dev->screen = 0;
+ att3b1dev->screen_size = 0;
}
return 0;
@@ -227,7 +227,7 @@ att3b1_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
/* following fit_fill, we can assume x, y, w, h are unsigned. */
p = (ushort *)&att3b1dev->screen[(ushort)y*att3b1dev->line_size] +
- (uint)x/16;
+ (uint)x/16;
o = (uint)x % 16;
b = 16 - o;
wl = ((uint)w < b) ? (uint)w : b;
@@ -237,32 +237,32 @@ att3b1_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
maskr = masks[wr];
if (colour == 0) {
- maskl = ~maskl;
- maskr = ~maskr;
- while (h-- > 0) {
- q = p;
- w2 = w;
- *q++ &= maskl;
- while (w2 >= 16) {
- *q++ = 0;
- w2 -= 16;
- }
- *q &= maskr;
- p += (att3b1dev->line_size / 2);
- }
+ maskl = ~maskl;
+ maskr = ~maskr;
+ while (h-- > 0) {
+ q = p;
+ w2 = w;
+ *q++ &= maskl;
+ while (w2 >= 16) {
+ *q++ = 0;
+ w2 -= 16;
+ }
+ *q &= maskr;
+ p += (att3b1dev->line_size / 2);
+ }
}
else {
- while (h-- > 0) {
- q = p;
- w2 = w;
- *q++ |= maskl;
- while (w2 >= 16) {
- *q++ = 0xffff;
- w2 -= 16;
- }
- *q |= maskr;
- p += (att3b1dev->line_size / 2);
- }
+ while (h-- > 0) {
+ q = p;
+ w2 = w;
+ *q++ |= maskl;
+ while (w2 >= 16) {
+ *q++ = 0xffff;
+ w2 -= 16;
+ }
+ *q |= maskr;
+ p += (att3b1dev->line_size / 2);
+ }
}
return 0;
@@ -278,9 +278,9 @@ att3b1_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
int
att3b1_copy_mono(gx_device *dev, const uchar *data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height,
- gx_color_index colour0, gx_color_index colour1)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height,
+ gx_color_index colour0, gx_color_index colour1)
{
const ushort *src_p, *src_q;
ushort *dst_p, *dst_q;
@@ -293,7 +293,7 @@ att3b1_copy_mono(gx_device *dev, const uchar *data,
#endif
if (colour1 == colour0) /* vacuous case */
- return att3b1_fill_rectangle(dev, x, y, width, height, colour0);
+ return att3b1_fill_rectangle(dev, x, y, width, height, colour0);
fit_copy(dev, data, data_x, raster, id, x, y, width, height);
@@ -308,81 +308,81 @@ att3b1_copy_mono(gx_device *dev, const uchar *data,
src_b = 16 - src_o;
dst_p = (ushort *)&att3b1dev->screen[(ushort)y*att3b1dev->line_size] +
- (uint)x/16;
+ (uint)x/16;
dst_o = (uint)x % 16;
dst_b = 16 - dst_o;
op = (int)colour0 * 3 + (int)colour1 + 4;
while (height-- > 0) {
- w2 = width;
- src_q = src_p;
- dst_q = dst_p;
-
- while (w2 > 0) {
- w1 = (w2 < 16) ? w2 : 16;
- mask = masks[w1];
- /*
- * We are assuming that the bitmap "data" is typically aligned.
- * Thus the test for this special case is typically a win over
- * a 16-bit shift.
- */
- if (src_o == 0)
- bits = *src_q++;
- else {
- bits = *((ulong *)src_q) >> src_b;
- bits &= 0xffff;
- src_q++;
- }
- if (w1 <= 8)
- bits = reverse_bits[bits>>8];
- else
- bits = (reverse_bits[bits&0xff] << 8) | reverse_bits[bits>>8];
- /*
- * While the input bit map is assumed to be typically aligned, we
- * assume that the place in the image is not. Thus we don't
- * separate out the aligned case. Doing so would cost a test,
- * and only reduce the average shift by about 1.
- */
- p = (ulong *)dst_q;
- switch(op) {
- case 1: /* not src and dst */
- bits = ~(bits & mask);
- rotate(bits,dst_b);
- *p &= bits;
- break;
- case 2: /* src or dst */
- bits = bits & mask;
- rotate(bits,dst_b);
- *p |= bits;
- break;
- case 3: /* src and dst */
- bits = bits | ~mask;
- rotate(bits,dst_b);
- *p &= bits;
- break;
- case 5: /* src */
- rotate(bits,dst_b);
- rotate(mask,dst_b);
- *p = (*p & ~mask) | (bits & mask);
- break;
- case 6: /* not src or dst */
- bits = ~bits & mask;
- rotate(bits,dst_b);
- *p |= bits;
- break;
- case 7: /* not src */
- rotate(bits,dst_b);
- rotate(mask,dst_b);
- *p = (*p & ~mask) | (~bits & mask);
- break;
- }
- dst_q++;
- w2 -= w1;
- }
-
- src_p += (raster / 2);
- dst_p += (att3b1dev->line_size / 2);
+ w2 = width;
+ src_q = src_p;
+ dst_q = dst_p;
+
+ while (w2 > 0) {
+ w1 = (w2 < 16) ? w2 : 16;
+ mask = masks[w1];
+ /*
+ * We are assuming that the bitmap "data" is typically aligned.
+ * Thus the test for this special case is typically a win over
+ * a 16-bit shift.
+ */
+ if (src_o == 0)
+ bits = *src_q++;
+ else {
+ bits = *((ulong *)src_q) >> src_b;
+ bits &= 0xffff;
+ src_q++;
+ }
+ if (w1 <= 8)
+ bits = reverse_bits[bits>>8];
+ else
+ bits = (reverse_bits[bits&0xff] << 8) | reverse_bits[bits>>8];
+ /*
+ * While the input bit map is assumed to be typically aligned, we
+ * assume that the place in the image is not. Thus we don't
+ * separate out the aligned case. Doing so would cost a test,
+ * and only reduce the average shift by about 1.
+ */
+ p = (ulong *)dst_q;
+ switch(op) {
+ case 1: /* not src and dst */
+ bits = ~(bits & mask);
+ rotate(bits,dst_b);
+ *p &= bits;
+ break;
+ case 2: /* src or dst */
+ bits = bits & mask;
+ rotate(bits,dst_b);
+ *p |= bits;
+ break;
+ case 3: /* src and dst */
+ bits = bits | ~mask;
+ rotate(bits,dst_b);
+ *p &= bits;
+ break;
+ case 5: /* src */
+ rotate(bits,dst_b);
+ rotate(mask,dst_b);
+ *p = (*p & ~mask) | (bits & mask);
+ break;
+ case 6: /* not src or dst */
+ bits = ~bits & mask;
+ rotate(bits,dst_b);
+ *p |= bits;
+ break;
+ case 7: /* not src */
+ rotate(bits,dst_b);
+ rotate(mask,dst_b);
+ *p = (*p & ~mask) | (~bits & mask);
+ break;
+ }
+ dst_q++;
+ w2 -= w1;
+ }
+
+ src_p += (raster / 2);
+ dst_p += (att3b1dev->line_size / 2);
}
return 0;
@@ -416,8 +416,8 @@ do_help(gx_device *dev)
/* write help screen */
for (i=0; i < sizeof(help_msg)/sizeof(help_msg[0]); ++i) {
- write(att3b1dev->fd, help_msg[i], strlen(help_msg[i]));
- write(att3b1dev->fd, "\n", 1);
+ write(att3b1dev->fd, help_msg[i], strlen(help_msg[i]));
+ write(att3b1dev->fd, "\n", 1);
}
ut.ut_num = WTXTSLK1;
strcpy(ut.ut_text, "Press any key to continue");
@@ -456,10 +456,10 @@ att3b1_do_output_page(gx_device *dev, int num_copies, int flush)
*/
if (ioctl(att3b1dev->fd, WIOCGETD, &uw) < 0) {
- lprintf1("att3b1_output_page: window WIOCGETD ioctl failed [%d]\n",
- errno);
- att3b1_close(dev);
- return_error(gs_error_ioerror);
+ lprintf1("att3b1_output_page: window WIOCGETD ioctl failed [%d]\n",
+ errno);
+ att3b1_close(dev);
+ return_error(gs_error_ioerror);
}
/*
@@ -470,8 +470,8 @@ att3b1_do_output_page(gx_device *dev, int num_copies, int flush)
uflags = uw.uw_uflags;
if (!(uflags & NBORDER)) {
- uw.uw_uflags = BORDHSCROLL | BORDVSCROLL | BORDHELP | BORDCANCEL;
- ioctl(att3b1dev->fd, WIOCSETD, &uw);
+ uw.uw_uflags = BORDHSCROLL | BORDVSCROLL | BORDHELP | BORDCANCEL;
+ ioctl(att3b1dev->fd, WIOCSETD, &uw);
}
ut_orig.ut_num = WTXTSLK1;
@@ -503,9 +503,9 @@ att3b1_do_output_page(gx_device *dev, int num_copies, int flush)
ioctl(att3b1dev->fd, TCSETAF, &new);
screen_width = (uw.uw_width < att3b1dev->width) ? uw.uw_width
- : att3b1dev->width;
+ : att3b1dev->width;
screen_height = (uw.uw_height < att3b1dev->height) ? uw.uw_height
- : att3b1dev->height;
+ : att3b1dev->height;
write(att3b1dev->fd, "\033[2J", 4);
@@ -523,174 +523,173 @@ att3b1_do_output_page(gx_device *dev, int num_copies, int flush)
yorigin = def_yorigin;
while (1) {
- /* Things go bad if ur_srcx >= 2048 */
- ur.ur_srcbase = (ushort *)att3b1dev->screen + (xorigin >> 4);
- ur.ur_srcx = xorigin & 15;
- ur.ur_srcy = yorigin;
-
- if (ioctl(att3b1dev->fd, WIOCRASTOP, &ur) < 0) {
- lprintf1(
- "att3b1_output_page: window WIOCRASTOP ioctl failed [%d]\n",
- errno);
- error = gs_error_ioerror;
- }
-
- ut.ut_num = WTXTSLK1;
- sprintf(ut.ut_text,
- "%s %d, top right (%d,%d), size (%d,%d), press '?' for help.",
- flush ? "Showpage" : "Copypage", att3b1dev->page_num, xorigin, yorigin,
- att3b1dev->width, att3b1dev->height);
- ioctl(att3b1dev->fd, WIOCSETTEXT, &ut);
-
- ch = error ? 'q' : getKeyboard(dev);
-
- switch(ch) {
- case 'h':
- xorigin -= ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
- break;
-
- case 'k':
- yorigin -= ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
- break;
-
- case 'l':
- xorigin += ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
- break;
-
- case 'j':
- yorigin += ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
- break;
-
- case 'H':
- xorigin = 0;
- break;
-
- case 'K':
- yorigin = 0;
- break;
-
- case 'L':
- xorigin = att3b1dev->width - screen_width;
- break;
-
- case 'J':
- yorigin = att3b1dev->height - screen_height;
- break;
-
- case '<':
- xorigin -= 1;
- break;
-
- case '>':
- xorigin += 1;
- break;
-
- case '^':
- yorigin -= 1;
- break;
-
- case '_':
- yorigin += 1;
- break;
-
-
- case '\025': /* control-U */
- yorigin -= screen_height/2;
- break;
-
- case '\004': /* control-D */
- yorigin += screen_height/2;
- break;
-
- case '\002': /* control-B */
- yorigin -= screen_height;
- break;
-
- case '\006': /* control-F */
- yorigin += screen_height;
- break;
-
- case '\f':
- case 'r' :
- case '\022': /* control-R */
- xorigin = def_xorigin;
- yorigin = def_yorigin;
- break;
-
- case 'c': /* centre horizontally */
- xorigin = (att3b1dev->width - screen_width) / 2;
- break;
-
- case 'C': /* centre vertically */
- yorigin = (att3b1dev->height - screen_height) / 2;
- break;
-
- case '=':
- def_xorigin = xorigin;
- def_yorigin = yorigin;
- break;
-
- case 'I':
- for (p = (ushort *)att3b1dev->screen;
- p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
- *p = ~ *p;
- inverted = !inverted;
- break;
-
- case '?':
- do_help(dev);
- break;
-
- case -1:
- error = gs_error_ioerror;
- /* fall through, for cleanup */
-
- case 'q':
- case 'x':
- case '\003': /* control-C */
- case 'n':
- case 'f':
- case ' ':
- case '\n':
- case '\r':
- if (flush)
- att3b1dev->page_num++;
- else if (inverted) /* restore inverted image for copypage */
- for (p = (ushort *)att3b1dev->screen;
- p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
- *p = ~ *p;
- if (!(uflags & NBORDER)) {
- ioctl(att3b1dev->fd, WIOCGETD, &uw); /*window may have moved*/
- uw.uw_uflags = uflags;
- ioctl(att3b1dev->fd, WIOCSETD, &uw);
- }
- ur.ur_srcbase = save_image;
- ur.ur_srcwidth = WINWIDTH / 8;
- ur.ur_width = uw.uw_width;
- ur.ur_height = uw.uw_height;
- ur.ur_srcx = 0;
- ur.ur_srcy = 0;
- ioctl(att3b1dev->fd, WIOCRASTOP, &ur);
- ioctl(att3b1dev->fd, WIOCSETTEXT, &ut_orig);
- ioctl(att3b1dev->fd, TCSETAF, &old);
- write(att3b1dev->fd, "\033[=0C", 5);
-
- if (error) {
- att3b1_close(dev);
- return_error(error);
- }
- else
- return 0;
- }
-
- if (xorigin >= att3b1dev->width - screen_width)
- xorigin = att3b1dev->width - screen_width;
- if (xorigin < 0)
- xorigin = 0;
- if (yorigin >= att3b1dev->height - screen_height)
- yorigin = att3b1dev->height - screen_height;
- if (yorigin < 0)
- yorigin = 0;
+ /* Things go bad if ur_srcx >= 2048 */
+ ur.ur_srcbase = (ushort *)att3b1dev->screen + (xorigin >> 4);
+ ur.ur_srcx = xorigin & 15;
+ ur.ur_srcy = yorigin;
+
+ if (ioctl(att3b1dev->fd, WIOCRASTOP, &ur) < 0) {
+ lprintf1(
+ "att3b1_output_page: window WIOCRASTOP ioctl failed [%d]\n",
+ errno);
+ error = gs_error_ioerror;
+ }
+
+ ut.ut_num = WTXTSLK1;
+ sprintf(ut.ut_text,
+ "%s %d, top right (%d,%d), size (%d,%d), press '?' for help.",
+ flush ? "Showpage" : "Copypage", att3b1dev->page_num, xorigin, yorigin,
+ att3b1dev->width, att3b1dev->height);
+ ioctl(att3b1dev->fd, WIOCSETTEXT, &ut);
+
+ ch = error ? 'q' : getKeyboard(dev);
+
+ switch(ch) {
+ case 'h':
+ xorigin -= ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
+ break;
+
+ case 'k':
+ yorigin -= ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
+ break;
+
+ case 'l':
+ xorigin += ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
+ break;
+
+ case 'j':
+ yorigin += ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
+ break;
+
+ case 'H':
+ xorigin = 0;
+ break;
+
+ case 'K':
+ yorigin = 0;
+ break;
+
+ case 'L':
+ xorigin = att3b1dev->width - screen_width;
+ break;
+
+ case 'J':
+ yorigin = att3b1dev->height - screen_height;
+ break;
+
+ case '<':
+ xorigin -= 1;
+ break;
+
+ case '>':
+ xorigin += 1;
+ break;
+
+ case '^':
+ yorigin -= 1;
+ break;
+
+ case '_':
+ yorigin += 1;
+ break;
+
+ case '\025': /* control-U */
+ yorigin -= screen_height/2;
+ break;
+
+ case '\004': /* control-D */
+ yorigin += screen_height/2;
+ break;
+
+ case '\002': /* control-B */
+ yorigin -= screen_height;
+ break;
+
+ case '\006': /* control-F */
+ yorigin += screen_height;
+ break;
+
+ case '\f':
+ case 'r' :
+ case '\022': /* control-R */
+ xorigin = def_xorigin;
+ yorigin = def_yorigin;
+ break;
+
+ case 'c': /* centre horizontally */
+ xorigin = (att3b1dev->width - screen_width) / 2;
+ break;
+
+ case 'C': /* centre vertically */
+ yorigin = (att3b1dev->height - screen_height) / 2;
+ break;
+
+ case '=':
+ def_xorigin = xorigin;
+ def_yorigin = yorigin;
+ break;
+
+ case 'I':
+ for (p = (ushort *)att3b1dev->screen;
+ p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
+ *p = ~ *p;
+ inverted = !inverted;
+ break;
+
+ case '?':
+ do_help(dev);
+ break;
+
+ case -1:
+ error = gs_error_ioerror;
+ /* fall through, for cleanup */
+
+ case 'q':
+ case 'x':
+ case '\003': /* control-C */
+ case 'n':
+ case 'f':
+ case ' ':
+ case '\n':
+ case '\r':
+ if (flush)
+ att3b1dev->page_num++;
+ else if (inverted) /* restore inverted image for copypage */
+ for (p = (ushort *)att3b1dev->screen;
+ p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
+ *p = ~ *p;
+ if (!(uflags & NBORDER)) {
+ ioctl(att3b1dev->fd, WIOCGETD, &uw); /*window may have moved*/
+ uw.uw_uflags = uflags;
+ ioctl(att3b1dev->fd, WIOCSETD, &uw);
+ }
+ ur.ur_srcbase = save_image;
+ ur.ur_srcwidth = WINWIDTH / 8;
+ ur.ur_width = uw.uw_width;
+ ur.ur_height = uw.uw_height;
+ ur.ur_srcx = 0;
+ ur.ur_srcy = 0;
+ ioctl(att3b1dev->fd, WIOCRASTOP, &ur);
+ ioctl(att3b1dev->fd, WIOCSETTEXT, &ut_orig);
+ ioctl(att3b1dev->fd, TCSETAF, &old);
+ write(att3b1dev->fd, "\033[=0C", 5);
+
+ if (error) {
+ att3b1_close(dev);
+ return_error(error);
+ }
+ else
+ return 0;
+ }
+
+ if (xorigin >= att3b1dev->width - screen_width)
+ xorigin = att3b1dev->width - screen_width;
+ if (xorigin < 0)
+ xorigin = 0;
+ if (yorigin >= att3b1dev->height - screen_height)
+ yorigin = att3b1dev->height - screen_height;
+ if (yorigin < 0)
+ yorigin = 0;
}
}
int
@@ -699,7 +698,7 @@ att3b1_output_page(gx_device *dev, int num_copies, int flush)
int code = att3b1_do_output_page(dev, num_copies, flush);
if (code >= 0)
- code = gx_finish_output_page(dev, num_copies, flush);
+ code = gx_finish_output_page(dev, num_copies, flush);
return code;
}
@@ -711,11 +710,11 @@ get_char(gx_device *dev)
count = read(att3b1dev->fd, &ch, 1);
if (count == 0)
- return 'q';
+ return 'q';
else if (count < 0)
- return -1;
+ return -1;
else
- return ch;
+ return ch;
}
static int
@@ -726,7 +725,7 @@ getKeyboard(gx_device *dev)
ch = get_char(dev);
if (ch != '\033')
- return ch;
+ return ch;
/*
* If the char is escape, interpret the escape sequence and return
@@ -739,55 +738,55 @@ getKeyboard(gx_device *dev)
switch (get_char(dev)) {
case '[':
- switch(get_char(dev)) {
- case 'A': /* up arrow */
- return 'k';
- case 'T': /* shift up arrow (roll up) */
- return '\025';
- case 'B': /* down arrow */
- return 'j';
- case 'S': /* shift down arrow (roll down) */
- return '\004';
- case 'C': /* right arrow */
- return 'l';
- case 'D': /* left arrow */
- return 'h';
- case 'H': /* home */
- return 'r';
- case 'U': /* page down */
- return '\006';
- case 'V': /* page up */
- return '\002';
- }
- break;
+ switch(get_char(dev)) {
+ case 'A': /* up arrow */
+ return 'k';
+ case 'T': /* shift up arrow (roll up) */
+ return '\025';
+ case 'B': /* down arrow */
+ return 'j';
+ case 'S': /* shift down arrow (roll down) */
+ return '\004';
+ case 'C': /* right arrow */
+ return 'l';
+ case 'D': /* left arrow */
+ return 'h';
+ case 'H': /* home */
+ return 'r';
+ case 'U': /* page down */
+ return '\006';
+ case 'V': /* page up */
+ return '\002';
+ }
+ break;
case 'O':
- switch(get_char(dev)) {
- case 'm': /* help */
- case 'M': /* shift help */
- return '?';
- case 'k': /* exit */
- case 'K': /* shift exit */
- case 'w': /* cancl */
- case 'W': /* shift cancl */
- return 'q';
- }
- break;
+ switch(get_char(dev)) {
+ case 'm': /* help */
+ case 'M': /* shift help */
+ return '?';
+ case 'k': /* exit */
+ case 'K': /* shift exit */
+ case 'w': /* cancl */
+ case 'W': /* shift cancl */
+ return 'q';
+ }
+ break;
case 'N':
- switch(get_char(dev)) {
- case 'h': /* next */
- return 'f';
- case 'i': /* mark */
- return '=';
- case 'L': /* shift right arrow */
- return 'l';
- case 'K': /* shift left arrow */
- return 'h';
- }
- break;
+ switch(get_char(dev)) {
+ case 'h': /* next */
+ return 'f';
+ case 'i': /* mark */
+ return '=';
+ case 'L': /* shift right arrow */
+ return 'l';
+ case 'K': /* shift left arrow */
+ return 'h';
+ }
+ break;
case '9': /* Beg */
- return 'K';
+ return 'K';
case '0': /* End */
- return 'J';
+ return 'J';
}
return '\0';
}
diff --git a/gs/base/gdev4081.c b/gs/base/gdev4081.c
index 1b0642d70..f57781ce4 100644
--- a/gs/base/gdev4081.c
+++ b/gs/base/gdev4081.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,69 +21,68 @@
static dev_proc_print_page(r4081_print_page);
const gx_device_printer far_data gs_r4081_device =
prn_device(prn_std_procs, "r4081",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.25, 0.16, 0.25, 0.16, /* margins */
- 1, r4081_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.25, 0.16, 0.25, 0.16, /* margins */
+ 1, r4081_print_page);
/* ------ Internal routines ------ */
-
/* Send the page to the printer. */
static int
r4081_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- int out_size = ((pdev->width + 7) & -8) ;
- byte *out = (byte *)gs_malloc(pdev->memory, out_size, 1, "r4081_print_page(out)");
- int lnum = 0;
- int last = pdev->height;
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int out_size = ((pdev->width + 7) & -8) ;
+ byte *out = (byte *)gs_malloc(pdev->memory, out_size, 1, "r4081_print_page(out)");
+ int lnum = 0;
+ int last = pdev->height;
- /* Check allocations */
- if ( out == 0 )
- { if ( out )
- gs_free(pdev->memory, (char *)out, out_size, 1,
- "r4081_print_page(out)");
- return -1;
- }
+ /* Check allocations */
+ if ( out == 0 )
+ { if ( out )
+ gs_free(pdev->memory, (char *)out, out_size, 1,
+ "r4081_print_page(out)");
+ return -1;
+ }
- /* find the first line which has something to print */
- while ( lnum < last )
- {
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
- if ( out[0] != 0 ||
- memcmp((char *)out, (char *)out+1, line_size-1)
- )
- break;
- lnum ++;
- }
+ /* find the first line which has something to print */
+ while ( lnum < last )
+ {
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ if ( out[0] != 0 ||
+ memcmp((char *)out, (char *)out+1, line_size-1)
+ )
+ break;
+ lnum ++;
+ }
- /* find the last line which has something to print */
- while (last > lnum) {
- gdev_prn_copy_scan_lines(pdev, last-1, (byte *)out, line_size);
- if ( out[0] != 0 ||
- memcmp((char *)out, (char *)out+1, line_size-1)
- )
- break;
- last --;
- }
+ /* find the last line which has something to print */
+ while (last > lnum) {
+ gdev_prn_copy_scan_lines(pdev, last-1, (byte *)out, line_size);
+ if ( out[0] != 0 ||
+ memcmp((char *)out, (char *)out+1, line_size-1)
+ )
+ break;
+ last --;
+ }
- /* Initialize the printer and set the starting position. */
- fprintf(prn_stream,"\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
- out_size, last-lnum, (lnum+1)*720/Y_DPI);
+ /* Initialize the printer and set the starting position. */
+ fprintf(prn_stream,"\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
+ out_size, last-lnum, (lnum+1)*720/Y_DPI);
- /* Print lines of graphics */
- while ( lnum < last )
- {
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
- fwrite(out, sizeof(char), line_size, prn_stream);
- lnum ++;
- }
+ /* Print lines of graphics */
+ while ( lnum < last )
+ {
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ fwrite(out, sizeof(char), line_size, prn_stream);
+ lnum ++;
+ }
- /* Eject the page and reinitialize the printer */
- fputs("\f\033\rP", prn_stream);
+ /* Eject the page and reinitialize the printer */
+ fputs("\f\033\rP", prn_stream);
- gs_free(pdev->memory, (char *)out, out_size, 1, "r4081_print_page(out)");
- return 0;
+ gs_free(pdev->memory, (char *)out, out_size, 1, "r4081_print_page(out)");
+ return 0;
}
diff --git a/gs/base/gdev4693.c b/gs/base/gdev4693.c
index 025de8470..118da2405 100644
--- a/gs/base/gdev4693.c
+++ b/gs/base/gdev4693.c
@@ -24,14 +24,14 @@ static dev_proc_map_rgb_color(gdev_t4693d_map_rgb_color);
static dev_proc_map_color_rgb(gdev_t4693d_map_color_rgb);
static gx_device_procs t4693d_procs =
- prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gdev_t4693d_map_rgb_color, gdev_t4693d_map_color_rgb);
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ gdev_t4693d_map_rgb_color, gdev_t4693d_map_color_rgb);
#define t4693d_prn_device(name,depth,max_rgb) {prn_device_body( \
- gx_device_printer,t4693d_procs,name, \
- WIDTH_10THS, HEIGHT_10THS, X_DPI, Y_DPI, 0.25, 0.25, 0.25, 0.25, \
- 3,depth,max_rgb,max_rgb,max_rgb + 1,max_rgb + 1, \
- t4693d_print_page)}
+ gx_device_printer,t4693d_procs,name, \
+ WIDTH_10THS, HEIGHT_10THS, X_DPI, Y_DPI, 0.25, 0.25, 0.25, 0.25, \
+ 3,depth,max_rgb,max_rgb,max_rgb + 1,max_rgb + 1, \
+ t4693d_print_page)}
const gx_device_printer gs_t4693d2_device = t4693d_prn_device("t4693d2",8, 3);
const gx_device_printer gs_t4693d4_device = t4693d_prn_device("t4693d4",16, 15);
@@ -40,139 +40,139 @@ const gx_device_printer gs_t4693d8_device = t4693d_prn_device("t4693d8",24, 255)
static gx_color_index
gdev_t4693d_map_rgb_color(gx_device *dev, const gx_color_value cv[])
{
- ushort bitspercolor = prn_dev->color_info.depth / 3;
- ulong max_value = (1 << bitspercolor) - 1;
+ ushort bitspercolor = prn_dev->color_info.depth / 3;
+ ulong max_value = (1 << bitspercolor) - 1;
gx_color_value r, g, b;
r = cv[0]; g = cv[1]; b = cv[2];
- if (bitspercolor == 5) {
- bitspercolor--;
- max_value = (1 << bitspercolor) - 1;
- }
+ if (bitspercolor == 5) {
+ bitspercolor--;
+ max_value = (1 << bitspercolor) - 1;
+ }
- return ((r*max_value/gx_max_color_value) << (bitspercolor*2)) +
- ((g*max_value/gx_max_color_value) << bitspercolor) +
- (b*max_value/gx_max_color_value);
+ return ((r*max_value/gx_max_color_value) << (bitspercolor*2)) +
+ ((g*max_value/gx_max_color_value) << bitspercolor) +
+ (b*max_value/gx_max_color_value);
}
static int
gdev_t4693d_map_color_rgb(gx_device *dev, gx_color_index color, ushort prgb[3])
{
ushort bitspercolor = prn_dev->color_info.depth / 3;
- ulong max_value = (1 << bitspercolor) - 1;
+ ulong max_value = (1 << bitspercolor) - 1;
- if (bitspercolor == 5) {
- bitspercolor--;
- max_value = (1 << bitspercolor) - 1;
- }
+ if (bitspercolor == 5) {
+ bitspercolor--;
+ max_value = (1 << bitspercolor) - 1;
+ }
- prgb[0] = (color >> (bitspercolor*2)) * gx_max_color_value / max_value;
- prgb[1] = ((color >> bitspercolor) & max_value) * gx_max_color_value / max_value;
- prgb[2] = (color & max_value) * gx_max_color_value / max_value;
- return(0);
+ prgb[0] = (color >> (bitspercolor*2)) * gx_max_color_value / max_value;
+ prgb[1] = ((color >> bitspercolor) & max_value) * gx_max_color_value / max_value;
+ prgb[2] = (color & max_value) * gx_max_color_value / max_value;
+ return(0);
}
static int
t4693d_print_page(gx_device_printer *dev, FILE *ps_stream)
{
- char header[32];
- int depth = prn_dev->color_info.depth;
- int line_size = gdev_mem_bytes_per_scan_line(prn_dev);
- byte *data = (byte *)gs_malloc(dev->memory, line_size, 1, "t4693d_print_page");
- char *p;
- ushort data_size = line_size/prn_dev->width;
- int checksum;
- int lnum;
- int i;
+ char header[32];
+ int depth = prn_dev->color_info.depth;
+ int line_size = gdev_mem_bytes_per_scan_line(prn_dev);
+ byte *data = (byte *)gs_malloc(dev->memory, line_size, 1, "t4693d_print_page");
+ char *p;
+ ushort data_size = line_size/prn_dev->width;
+ int checksum;
+ int lnum;
+ int i;
#if !arch_is_big_endian
- byte swap;
+ byte swap;
#endif
- if (data == 0) return_error(gs_error_VMerror);
- /* build header. */
- p = header;
- *p++ = (char)0x14; /* Print request */
- *p++ = (char)0xc0|20; /* Length of header */
- *p++ = (char)0xc0 | ((prn_dev->width >> 6)&0x3f);
- *p++ = (char)0x80 | (prn_dev->width&0x3f);
- *p++ = (char)0xc0 | ((prn_dev->height >> 6)&0x3f);
- *p++ = (char)0x80 | (prn_dev->height&0x3f);
- *p++ = (char)0xc1; /* Handshake */
- *p++ = (char)0xc0; /* Get number of prints from printer. */
- *p++ = (char)0xc0; /* Get pixel shape from printer. */
- *p++ = (char)(depth == 8) ? 0xcb : (depth == 16) ? 0xcc : 0xcd;
- *p++ = (char)0xc1; /* Pixel-data order 1. */
- *p++ = (char)0xc3; /* Interpolate to maximum size. */
- *p++ = (char)0xc3; /* Full color range 1. */
- *p++ = (char)0xc0; /* Color conversion from printer. */
- *p++ = (char)0xc0; /* Color manipulation from printer. */
- *p++ = (char)0xc0; /* B/W inversion from printer. */
- *p++ = (char)0xc3; /* Portrait mode centered. */
- *p++ = (char)0xc9; /* Use printer default for media and printing. */
- *p++ = (char)0x95;
- *p++ = (char)0x81;
-
- for (checksum = 0, i = 0; &header[i] != p; i++)
- checksum += header[i];
-
- *p++ = ((checksum%128)&0x7f) | 0x80;
- *p = 0x02; /* end of line. */
- /* write header */
- if (fwrite(header,1,22,ps_stream) != 22) {
- errprintf(dev->memory, "Could not write header (t4693d).\n");
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
-
- for (lnum = 0; lnum < prn_dev->height; lnum++) {
- gdev_prn_copy_scan_lines(prn_dev,lnum,data,line_size);
-
- for (i = 0; i < line_size; i += data_size) {
-
- switch (depth) {
- case 8:
- data[i] &= 0x3f;
- break;
- case 16:
+ if (data == 0) return_error(gs_error_VMerror);
+ /* build header. */
+ p = header;
+ *p++ = (char)0x14; /* Print request */
+ *p++ = (char)0xc0|20; /* Length of header */
+ *p++ = (char)0xc0 | ((prn_dev->width >> 6)&0x3f);
+ *p++ = (char)0x80 | (prn_dev->width&0x3f);
+ *p++ = (char)0xc0 | ((prn_dev->height >> 6)&0x3f);
+ *p++ = (char)0x80 | (prn_dev->height&0x3f);
+ *p++ = (char)0xc1; /* Handshake */
+ *p++ = (char)0xc0; /* Get number of prints from printer. */
+ *p++ = (char)0xc0; /* Get pixel shape from printer. */
+ *p++ = (char)(depth == 8) ? 0xcb : (depth == 16) ? 0xcc : 0xcd;
+ *p++ = (char)0xc1; /* Pixel-data order 1. */
+ *p++ = (char)0xc3; /* Interpolate to maximum size. */
+ *p++ = (char)0xc3; /* Full color range 1. */
+ *p++ = (char)0xc0; /* Color conversion from printer. */
+ *p++ = (char)0xc0; /* Color manipulation from printer. */
+ *p++ = (char)0xc0; /* B/W inversion from printer. */
+ *p++ = (char)0xc3; /* Portrait mode centered. */
+ *p++ = (char)0xc9; /* Use printer default for media and printing. */
+ *p++ = (char)0x95;
+ *p++ = (char)0x81;
+
+ for (checksum = 0, i = 0; &header[i] != p; i++)
+ checksum += header[i];
+
+ *p++ = ((checksum%128)&0x7f) | 0x80;
+ *p = 0x02; /* end of line. */
+ /* write header */
+ if (fwrite(header,1,22,ps_stream) != 22) {
+ errprintf(dev->memory, "Could not write header (t4693d).\n");
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ for (lnum = 0; lnum < prn_dev->height; lnum++) {
+ gdev_prn_copy_scan_lines(prn_dev,lnum,data,line_size);
+
+ for (i = 0; i < line_size; i += data_size) {
+
+ switch (depth) {
+ case 8:
+ data[i] &= 0x3f;
+ break;
+ case 16:
#if arch_is_big_endian
- data[i] &= 0x0f;
+ data[i] &= 0x0f;
#else
- swap = data[i];
- data[i] = data[i + 1]&0x0f;
- data[i + 1] = swap;
+ swap = data[i];
+ data[i] = data[i + 1]&0x0f;
+ data[i + 1] = swap;
#endif
- break;
- case 24:
- break;
- default:
- errprintf(dev->memory,"Bad depth (%d) t4693d.\n",depth);
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_rangecheck);
- }
-
- if (fwrite(&data[i],1,data_size,ps_stream) != data_size) {
- errprintf(dev->memory,"Could not write pixel (t4693d).\n");
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
-
- }
-
- if (fputc(0x02,ps_stream) != 0x02) {
- errprintf(dev->memory,"Could not write EOL (t4693d).\n");
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
-
- }
-
- if (fputc(0x01,ps_stream) != 0x01) {
- errprintf(dev->memory,"Could not write EOT (t4693d).\n");
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
-
- gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
- return(0);
+ break;
+ case 24:
+ break;
+ default:
+ errprintf(dev->memory,"Bad depth (%d) t4693d.\n",depth);
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_rangecheck);
+ }
+
+ if (fwrite(&data[i],1,data_size,ps_stream) != data_size) {
+ errprintf(dev->memory,"Could not write pixel (t4693d).\n");
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ }
+
+ if (fputc(0x02,ps_stream) != 0x02) {
+ errprintf(dev->memory,"Could not write EOL (t4693d).\n");
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ }
+
+ if (fputc(0x01,ps_stream) != 0x01) {
+ errprintf(dev->memory,"Could not write EOT (t4693d).\n");
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ gs_free(dev->memory, data, line_size, 1, "t4693d_print_page");
+ return(0);
}
diff --git a/gs/base/gdev8510.c b/gs/base/gdev8510.c
index a66467d0e..8a9e2ab30 100644
--- a/gs/base/gdev8510.c
+++ b/gs/base/gdev8510.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,18 +22,18 @@
/* The device descriptor */
static dev_proc_print_page(m8510_print_page);
const gx_device_printer far_data gs_m8510_device =
- prn_device(prn_std_procs, "m8510",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, /* x_dpi */
- 144, /* y_dpi */
- 0,0,0.5,0, /* left, bottom, right, and top margins */
- 1, m8510_print_page);
+ prn_device(prn_std_procs, "m8510",
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, /* x_dpi */
+ 144, /* y_dpi */
+ 0,0,0.5,0, /* left, bottom, right, and top margins */
+ 1, m8510_print_page);
/* ------ forward declarations ------ */
static void m8510_output_run(gx_device_printer *pdev,
- byte *out, int pass, FILE *prn_stream);
+ byte *out, int pass, FILE *prn_stream);
/* ------ internal routines ------ */
@@ -41,97 +41,97 @@ static void m8510_output_run(gx_device_printer *pdev,
static int
m8510_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- byte *in1 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in1)");
- byte *in2 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in2)");
- byte *out = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(out)");
- int lnum = 0;
- int code = 0;
- byte *inp, *in_end, *outp;
- int i;
-
- if (in1 == 0 || in2 == 0 || out == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
- }
-
- /*
- * Initialize the printer.
- * NLQ mode, proportional print (160x144 dpi).
- * and 16/144" linefeeds.
- */
- fwrite("\033m2\033P\033T16", 1, 9, prn_stream);
-
- /* Transfer pixels to printer */
- while ( lnum < pdev->height ) {
- /* get a raster */
- for (i = 7; i >= 0; i--) {
- gdev_prn_copy_scan_lines(pdev, lnum, &in1[i*line_size], line_size);
- lnum++;
- gdev_prn_copy_scan_lines(pdev, lnum, &in2[i*line_size], line_size);
- lnum++;
- }
-
- /* Transpose the 1st pass of data. */
- in_end = in1 + line_size;
- for (inp = in1, outp = out; inp < in_end; inp++, outp += 8)
- gdev_prn_transpose_8x8(inp, line_size, outp, 1);
-
- /* send the 1st line */
- m8510_output_run(pdev, out, 0, prn_stream);
-
- /* Transpose the 2nd pass of data. */
- in_end = in2 + line_size;
- for (inp = in2, outp = out; inp < in_end; inp++, outp += 8)
- gdev_prn_transpose_8x8(inp, line_size, outp, 1);
-
- /* send the 2nd line */
- m8510_output_run(pdev, out, 1, prn_stream);
- }
-
- /* reset the printer. */
- fwrite("\033c1", 1, 3, prn_stream);
- fflush(prn_stream);
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte *in1 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in1)");
+ byte *in2 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in2)");
+ byte *out = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(out)");
+ int lnum = 0;
+ int code = 0;
+ byte *inp, *in_end, *outp;
+ int i;
+
+ if (in1 == 0 || in2 == 0 || out == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
+ }
+
+ /*
+ * Initialize the printer.
+ * NLQ mode, proportional print (160x144 dpi).
+ * and 16/144" linefeeds.
+ */
+ fwrite("\033m2\033P\033T16", 1, 9, prn_stream);
+
+ /* Transfer pixels to printer */
+ while ( lnum < pdev->height ) {
+ /* get a raster */
+ for (i = 7; i >= 0; i--) {
+ gdev_prn_copy_scan_lines(pdev, lnum, &in1[i*line_size], line_size);
+ lnum++;
+ gdev_prn_copy_scan_lines(pdev, lnum, &in2[i*line_size], line_size);
+ lnum++;
+ }
+
+ /* Transpose the 1st pass of data. */
+ in_end = in1 + line_size;
+ for (inp = in1, outp = out; inp < in_end; inp++, outp += 8)
+ gdev_prn_transpose_8x8(inp, line_size, outp, 1);
+
+ /* send the 1st line */
+ m8510_output_run(pdev, out, 0, prn_stream);
+
+ /* Transpose the 2nd pass of data. */
+ in_end = in2 + line_size;
+ for (inp = in2, outp = out; inp < in_end; inp++, outp += 8)
+ gdev_prn_transpose_8x8(inp, line_size, outp, 1);
+
+ /* send the 2nd line */
+ m8510_output_run(pdev, out, 1, prn_stream);
+ }
+
+ /* reset the printer. */
+ fwrite("\033c1", 1, 3, prn_stream);
+ fflush(prn_stream);
out:;
- if (out) gs_free(pdev->memory, (char *) out, 8, line_size, "m8510_print_page(out)");
- if (in2) gs_free(pdev->memory, (char *) in2, 8, line_size, "m8510_print_page(in2)");
- if (in1) gs_free(pdev->memory, (char *) in1, 8, line_size, "m8510_print_page(in1)");
+ if (out) gs_free(pdev->memory, (char *) out, 8, line_size, "m8510_print_page(out)");
+ if (in2) gs_free(pdev->memory, (char *) in2, 8, line_size, "m8510_print_page(in2)");
+ if (in1) gs_free(pdev->memory, (char *) in1, 8, line_size, "m8510_print_page(in1)");
- return code;
+ return code;
}
static void
m8510_output_run(gx_device_printer *pdev,
- byte *out, int pass, FILE *prn_stream)
+ byte *out, int pass, FILE *prn_stream)
{
- byte *out_end = out + pdev->width;
- char tmp[10];
- int count;
-
- /*
- * Remove trailing 0s.
- * out must be a multiple of 8 bytes.
- */
- while (out_end > out
- && out_end[-1] == 0
- && out_end[-2] == 0
- && out_end[-3] == 0
- && out_end[-4] == 0
- && out_end[-5] == 0
- && out_end[-6] == 0
- && out_end[-7] == 0
- && out_end[-8] == 0)
- out_end -= 8;
-
- /* Transfer the line of data. */
- count = out_end - out;
- if (count) {
- sprintf(tmp, "\033g%03d", count/8);
- fwrite(tmp, 1, 5, prn_stream);
- fwrite(out, 1, count, prn_stream);
- fwrite("\r", 1, 1, prn_stream);
- }
-
- if (pass) fwrite("\n", 1, 1, prn_stream);
+ byte *out_end = out + pdev->width;
+ char tmp[10];
+ int count;
+
+ /*
+ * Remove trailing 0s.
+ * out must be a multiple of 8 bytes.
+ */
+ while (out_end > out
+ && out_end[-1] == 0
+ && out_end[-2] == 0
+ && out_end[-3] == 0
+ && out_end[-4] == 0
+ && out_end[-5] == 0
+ && out_end[-6] == 0
+ && out_end[-7] == 0
+ && out_end[-8] == 0)
+ out_end -= 8;
+
+ /* Transfer the line of data. */
+ count = out_end - out;
+ if (count) {
+ sprintf(tmp, "\033g%03d", count/8);
+ fwrite(tmp, 1, 5, prn_stream);
+ fwrite(out, 1, count, prn_stream);
+ fwrite("\r", 1, 1, prn_stream);
+ }
+
+ if (pass) fwrite("\n", 1, 1, prn_stream);
}
diff --git a/gs/base/gdev8bcm.c b/gs/base/gdev8bcm.c
index 874338fc3..689413821 100644
--- a/gs/base/gdev8bcm.c
+++ b/gs/base/gdev8bcm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,34 +25,34 @@ gx_8bit_map_init(gx_8bit_color_map * pcm, int max_count)
pcm->count = 0;
pcm->max_count = max_count;
for (i = 0; i < gx_8bit_map_size; i++)
- pcm->map[i].rgb = gx_8bit_no_rgb;
+ pcm->map[i].rgb = gx_8bit_no_rgb;
}
/* Look up a color in an 8-bit color map. */
/* Return <0 if not found. */
int
gx_8bit_map_rgb_color(const gx_8bit_color_map * pcm, gx_color_value r,
- gx_color_value g, gx_color_value b)
+ gx_color_value g, gx_color_value b)
{
ushort rgb = gx_8bit_rgb_key(r, g, b);
const gx_8bit_map_entry *pme =
&pcm->map[(rgb * gx_8bit_map_spreader) % gx_8bit_map_size];
for (;; pme++) {
- if (pme->rgb == rgb)
- return pme->index;
- else if (pme->rgb == gx_8bit_no_rgb)
- break;
+ if (pme->rgb == rgb)
+ return pme->index;
+ else if (pme->rgb == gx_8bit_no_rgb)
+ break;
}
if (pme != &pcm->map[gx_8bit_map_size])
- return pme - &pcm->map[gx_8bit_map_size];
+ return pme - &pcm->map[gx_8bit_map_size];
/* We ran off the end; wrap around and continue. */
pme = &pcm->map[0];
for (;; pme++) {
- if (pme->rgb == rgb)
- return pme->index;
- else if (pme->rgb == gx_8bit_no_rgb)
- return pme - &pcm->map[gx_8bit_map_size];
+ if (pme->rgb == rgb)
+ return pme->index;
+ else if (pme->rgb == gx_8bit_no_rgb)
+ return pme - &pcm->map[gx_8bit_map_size];
}
}
@@ -60,16 +60,16 @@ gx_8bit_map_rgb_color(const gx_8bit_color_map * pcm, gx_color_value r,
/* and return its index. Return <0 if the map is full. */
int
gx_8bit_add_rgb_color(gx_8bit_color_map * pcm, gx_color_value r,
- gx_color_value g, gx_color_value b)
+ gx_color_value g, gx_color_value b)
{
int index;
gx_8bit_map_entry *pme;
if (gx_8bit_map_is_full(pcm))
- return -1;
+ return -1;
index = gx_8bit_map_rgb_color(pcm, r, g, b);
if (index >= 0) /* shouldn't happen */
- return index;
+ return index;
pme = &pcm->map[-index];
pme->rgb = gx_8bit_rgb_key(r, g, b);
return (pme->index = pcm->count++);
diff --git a/gs/base/gdev8bcm.h b/gs/base/gdev8bcm.h
index a320c81af..20ec9bdc7 100644
--- a/gs/base/gdev8bcm.h
+++ b/gs/base/gdev8bcm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,7 +53,7 @@ void gx_8bit_map_init(gx_8bit_color_map *, int);
/* Look up a color in an 8-bit color map. */
/* Return -1 if not found. */
int gx_8bit_map_rgb_color(const gx_8bit_color_map *, gx_color_value,
- gx_color_value, gx_color_value);
+ gx_color_value, gx_color_value);
/* Test whether an 8-bit color map has room for more entries. */
#define gx_8bit_map_is_full(pcm)\
@@ -62,6 +62,6 @@ int gx_8bit_map_rgb_color(const gx_8bit_color_map *, gx_color_value,
/* Add a color to an 8-bit color map. */
/* Return -1 if the map is full. */
int gx_8bit_add_rgb_color(gx_8bit_color_map *, gx_color_value,
- gx_color_value, gx_color_value);
+ gx_color_value, gx_color_value);
#endif /* gdev8bcm_INCLUDED */
diff --git a/gs/base/gdevabuf.c b/gs/base/gdevabuf.c
index 1991d0b48..513a88ff5 100644
--- a/gs/base/gdevabuf.c
+++ b/gs/base/gdevabuf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,10 +39,10 @@ static dev_proc_copy_alpha(mem_alpha_copy_alpha);
void
gs_make_mem_alpha_device(gx_device_memory * adev, gs_memory_t * mem,
- gx_device * target, int alpha_bits)
+ gx_device * target, int alpha_bits)
{
gs_make_mem_device(adev, gdev_mem_device_for_bits(alpha_bits),
- mem, 0, target);
+ mem, 0, target);
/* This is a black-and-white device ... */
adev->color_info = gdev_mem_device_for_bits(1)->color_info;
/* ... but it has multiple bits per pixel ... */
@@ -62,20 +62,20 @@ mem_alpha_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_index color = gx_forward_map_rgb_color(dev, cv);
return (color == 0 || color == gx_no_color_index ? color :
- (gx_color_index) ((1 << mdev->log2_alpha_bits) - 1));
+ (gx_color_index) ((1 << mdev->log2_alpha_bits) - 1));
}
static int
mem_alpha_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
return
- gx_forward_map_color_rgb(dev,
- (color == 0 ? color : (gx_color_index) 1),
- prgb);
+ gx_forward_map_color_rgb(dev,
+ (color == 0 ? color : (gx_color_index) 1),
+ prgb);
}
static gx_color_index
mem_alpha_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
- gx_color_value g, gx_color_value b, gx_color_value alpha)
+ gx_color_value g, gx_color_value b, gx_color_value alpha)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
gx_color_index color;
@@ -85,20 +85,20 @@ mem_alpha_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
color = gx_forward_map_rgb_color(dev, cv);
return (color == 0 || color == gx_no_color_index ? color :
- (gx_color_index) (alpha >> (gx_color_value_bits -
- mdev->log2_alpha_bits)));
+ (gx_color_index) (alpha >> (gx_color_value_bits -
+ mdev->log2_alpha_bits)));
}
/* Implement alpha copying. */
static int
mem_alpha_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{ /* Just use copy_color. */
return (color == 0 ?
- (*dev_proc(dev, fill_rectangle)) (dev, x, y, width, height,
- color) :
- (*dev_proc(dev, copy_color)) (dev, data, data_x, raster, id,
- x, y, width, height));
+ (*dev_proc(dev, fill_rectangle)) (dev, x, y, width, height,
+ color) :
+ (*dev_proc(dev, copy_color)) (dev, data, data_x, raster, id,
+ x, y, width, height));
}
/* ================ Alpha-buffer device ================ */
@@ -146,17 +146,17 @@ static dev_proc_get_clipping_box(mem_abuf_get_clipping_box);
/* The device descriptor. */
static const gx_device_memory mem_alpha_buffer_device =
mem_device("image(alpha buffer)", 0, 1,
- gx_forward_map_rgb_color, gx_forward_map_color_rgb,
- mem_abuf_copy_mono, gx_default_copy_color, mem_abuf_fill_rectangle,
- gx_no_strip_copy_rop);
+ gx_forward_map_rgb_color, gx_forward_map_color_rgb,
+ mem_abuf_copy_mono, gx_default_copy_color, mem_abuf_fill_rectangle,
+ gx_no_strip_copy_rop);
/* Make an alpha-buffer memory device. */
/* We use abuf instead of alpha_buffer because */
/* gcc under VMS only retains 23 characters of procedure names. */
void
gs_make_mem_abuf_device(gx_device_memory * adev, gs_memory_t * mem,
- gx_device * target, const gs_log2_scale_point * pscale,
- int alpha_bits, int mapped_x)
+ gx_device * target, const gs_log2_scale_point * pscale,
+ int alpha_bits, int mapped_x)
{
gs_make_mem_device(adev, &mem_alpha_buffer_device, mem, 0, target);
adev->max_fill_band = 1 << pscale->y;
@@ -167,7 +167,7 @@ gs_make_mem_abuf_device(gx_device_memory * adev, gs_memory_t * mem,
set_dev_proc(adev, get_clipping_box, mem_abuf_get_clipping_box);
adev->color_info.anti_alias.text_bits =
adev->color_info.anti_alias.graphics_bits =
- alpha_bits;
+ alpha_bits;
}
/* Test whether a device is an alpha-buffering device. */
@@ -195,35 +195,35 @@ abuf_flush_block(gx_device_memory * adev, int y)
byte *bits;
if (buffer_y >= adev->height)
- buffer_y -= adev->height;
+ buffer_y -= adev->height;
bits = scan_line_base(adev, buffer_y);
{ /*
- * Many bits are typically zero. Save time by computing
- * an accurate X bounding box before compressing.
- * Unfortunately, in order to deal with alpha nibble swapping
- * (see gsbitops.c), we can't expand the box only to pixel
- * boundaries:
- int alpha_mask = -1 << adev->log2_alpha_bits;
- * Instead, we must expand it to byte boundaries,
- */
- int alpha_mask = ~7;
- gs_int_rect bbox;
- int width;
-
- bits_bounding_box(bits, block_height, adev->raster, &bbox);
- bbox.p.x &= alpha_mask;
- bbox.q.x = (bbox.q.x + ~alpha_mask) & alpha_mask;
- width = bbox.q.x - bbox.p.x;
- bits_compress_scaled(bits, bbox.p.x, width, block_height,
- adev->raster, bits, draster, &adev->log2_scale,
- adev->log2_alpha_bits);
- return (*dev_proc(target, copy_alpha)) (target,
- bits, 0, draster, gx_no_bitmap_id,
- (adev->mapped_x + bbox.p.x) >>
- adev->log2_scale.x,
- y >> adev->log2_scale.y,
- width >> adev->log2_scale.x, 1,
- adev->save_color, alpha_bits);
+ * Many bits are typically zero. Save time by computing
+ * an accurate X bounding box before compressing.
+ * Unfortunately, in order to deal with alpha nibble swapping
+ * (see gsbitops.c), we can't expand the box only to pixel
+ * boundaries:
+ int alpha_mask = -1 << adev->log2_alpha_bits;
+ * Instead, we must expand it to byte boundaries,
+ */
+ int alpha_mask = ~7;
+ gs_int_rect bbox;
+ int width;
+
+ bits_bounding_box(bits, block_height, adev->raster, &bbox);
+ bbox.p.x &= alpha_mask;
+ bbox.q.x = (bbox.q.x + ~alpha_mask) & alpha_mask;
+ width = bbox.q.x - bbox.p.x;
+ bits_compress_scaled(bits, bbox.p.x, width, block_height,
+ adev->raster, bits, draster, &adev->log2_scale,
+ adev->log2_alpha_bits);
+ return (*dev_proc(target, copy_alpha)) (target,
+ bits, 0, draster, gx_no_bitmap_id,
+ (adev->mapped_x + bbox.p.x) >>
+ adev->log2_scale.x,
+ y >> adev->log2_scale.y,
+ width >> adev->log2_scale.x, 1,
+ adev->save_color, alpha_bits);
}
}
/* Flush the entire buffer. */
@@ -234,8 +234,8 @@ abuf_flush(gx_device_memory * adev)
int block_height = 1 << adev->log2_scale.y;
for (y = 0; y < adev->mapped_height; y += block_height)
- if ((code = abuf_flush_block(adev, adev->mapped_y + y)) < 0)
- return code;
+ if ((code = abuf_flush_block(adev, adev->mapped_y + y)) < 0)
+ return code;
adev->mapped_height = adev->mapped_start = 0;
return 0;
}
@@ -248,7 +248,7 @@ mem_abuf_close(gx_device * dev)
int code = abuf_flush(mdev);
if (code < 0)
- return code;
+ return code;
return mem_close(dev);
}
@@ -269,10 +269,10 @@ y_transfer_init(y_transfer * pyt, gx_device * dev, int ty, int th)
int bh = 1 << mdev->log2_scale.y;
if (ty < mdev->mapped_y || ty > mdev->mapped_y + mdev->mapped_height) {
- abuf_flush(mdev);
- mdev->mapped_y = ty & -bh;
- mdev->mapped_height = bh;
- memset(scan_line_base(mdev, 0), 0, bh * mdev->raster);
+ abuf_flush(mdev);
+ mdev->mapped_y = ty & -bh;
+ mdev->mapped_height = bh;
+ memset(scan_line_base(mdev, 0), 0, bh * mdev->raster);
}
pyt->y_next = ty;
pyt->height_left = th;
@@ -293,37 +293,37 @@ y_transfer_next(y_transfer * pyt, gx_device * dev)
int tby, tbh;
if (ty == my + mh) { /* Add a new block at my1. */
- if (mh == mdev->height) {
- int code = abuf_flush_block(mdev, my);
-
- if (code < 0)
- return code;
- mdev->mapped_y = my += bh;
- if ((mdev->mapped_start = ms += bh) == mh)
- mdev->mapped_start = ms = 0;
- } else { /* Because we currently never extend backwards, */
- /* we know we can't wrap around in this case. */
- mdev->mapped_height = mh += bh;
- }
- memset(scan_line_base(mdev, (ms == 0 ? mh : ms) - bh),
- 0, bh * mdev->raster);
+ if (mh == mdev->height) {
+ int code = abuf_flush_block(mdev, my);
+
+ if (code < 0)
+ return code;
+ mdev->mapped_y = my += bh;
+ if ((mdev->mapped_start = ms += bh) == mh)
+ mdev->mapped_start = ms = 0;
+ } else { /* Because we currently never extend backwards, */
+ /* we know we can't wrap around in this case. */
+ mdev->mapped_height = mh += bh;
+ }
+ memset(scan_line_base(mdev, (ms == 0 ? mh : ms) - bh),
+ 0, bh * mdev->raster);
}
/* Now we know that my <= ty < my + mh. */
tby = ty - my + ms;
if (tby < mdev->height) {
- tbh = mdev->height - ms;
- if (tbh > mh)
- tbh = mh;
- tbh -= tby - ms;
+ tbh = mdev->height - ms;
+ if (tbh > mh)
+ tbh = mh;
+ tbh -= tby - ms;
} else { /* wrap around */
- tby -= mdev->height;
- tbh = ms + mh - dev->height - tby;
+ tby -= mdev->height;
+ tbh = ms + mh - dev->height - tby;
}
if_debug7('V',
- "[V]abuf: my=%d, mh=%d, ms=%d, ty=%d, th=%d, tby=%d, tbh=%d\n",
- my, mh, ms, ty, th, tby, tbh);
+ "[V]abuf: my=%d, mh=%d, ms=%d, ty=%d, th=%d, tby=%d, tbh=%d\n",
+ my, mh, ms, ty, th, tby, tbh);
if (tbh > th)
- tbh = th;
+ tbh = th;
pyt->height_left = th - tbh;
pyt->transfer_y = tby;
pyt->transfer_height = tbh;
@@ -333,30 +333,30 @@ y_transfer_next(y_transfer * pyt, gx_device * dev)
/* Copy a monobit image. */
static int
mem_abuf_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
y_transfer yt;
if (zero != gx_no_color_index || one == gx_no_color_index)
- return_error(gs_error_undefinedresult);
+ return_error(gs_error_undefinedresult);
x -= mdev->mapped_x;
fit_copy_xyw(dev, base, sourcex, sraster, id, x, y, w, h); /* don't limit h */
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
mdev->save_color = one;
y_transfer_init(&yt, dev, y, h);
while (yt.height_left > 0) {
- int code = y_transfer_next(&yt, dev);
-
- if (code < 0)
- return code;
- (*dev_proc(&mem_mono_device, copy_mono)) (dev,
- base + (yt.y_next - y) * sraster,
- sourcex, sraster, gx_no_bitmap_id,
- x, yt.transfer_y, w, yt.transfer_height,
- gx_no_color_index, (gx_color_index) 1);
+ int code = y_transfer_next(&yt, dev);
+
+ if (code < 0)
+ return code;
+ (*dev_proc(&mem_mono_device, copy_mono)) (dev,
+ base + (yt.y_next - y) * sraster,
+ sourcex, sraster, gx_no_bitmap_id,
+ x, yt.transfer_y, w, yt.transfer_height,
+ gx_no_color_index, (gx_color_index) 1);
}
return 0;
}
@@ -364,7 +364,7 @@ mem_abuf_copy_mono(gx_device * dev,
/* Fill a rectangle. */
static int
mem_abuf_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
y_transfer yt;
@@ -376,13 +376,13 @@ mem_abuf_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
mdev->save_color = color;
y_transfer_init(&yt, dev, y, h);
while (yt.height_left > 0) {
- int code = y_transfer_next(&yt, dev);
+ int code = y_transfer_next(&yt, dev);
- if (code < 0)
- return code;
- (*dev_proc(&mem_mono_device, fill_rectangle)) (dev,
- x, yt.transfer_y, w, yt.transfer_height,
- (gx_color_index) 1);
+ if (code < 0)
+ return code;
+ (*dev_proc(&mem_mono_device, fill_rectangle)) (dev,
+ x, yt.transfer_y, w, yt.transfer_height,
+ (gx_color_index) 1);
}
return 0;
}
@@ -412,10 +412,9 @@ alpha_buffer_bits(gs_state * pgs)
dev = gs_currentdevice_inline(pgs);
if (gs_device_is_abuf(dev)) {
- /* We're already writing into an alpha buffer. */
- return 0;
+ /* We're already writing into an alpha buffer. */
+ return 0;
}
return (*dev_proc(dev, get_alpha_bits))
- (dev, (pgs->in_cachedevice ? go_text : go_graphics));
+ (dev, (pgs->in_cachedevice ? go_text : go_graphics));
}
-
diff --git a/gs/base/gdevadmp.c b/gs/base/gdevadmp.c
index e374b6b5c..0d48fd477 100644
--- a/gs/base/gdevadmp.c
+++ b/gs/base/gdevadmp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,7 +14,7 @@
/*
* Apple DMP / Imagewriter driver
*
- * This is a modification of Mark Wedel's Apple DMP and
+ * This is a modification of Mark Wedel's Apple DMP and
* Jonathan Luckey's Imagewriter II driver to
* support the Imagewriter LQ's higher resolution (320x216):
* appledmp: 120dpi x 72dpi is still supported (yuck)
@@ -45,7 +45,7 @@
* the formfeed will skip a whole page. As a work around, I reverse
* the paper about a 1.5 inches at the end of the page before the
* formfeed to make it think its on the 'right' page. bah. hack!
- *
+ *
* This is my first attempt to work with gs, so your milage may vary
*
* Jonathan Luckey (luckey@rtfm.mlb.fl.us)
@@ -106,7 +106,6 @@
* Dot Matrix Code by Mark Wedel (master@cats.ucsc.edu)
*/
-
#include "gdevprn.h"
/* The device descriptors */
@@ -115,42 +114,38 @@ static dev_proc_print_page(dmp_print_page);
/* Standard DMP device */
const gx_device_printer far_data gs_appledmp_device =
prn_device(prn_std_procs, "appledmp",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 120, 72, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
-
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 120, 72, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* lowrez Imagewriter device */
const gx_device_printer far_data gs_iwlo_device =
prn_device(prn_std_procs, "iwlo",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, 72, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
-
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, 72, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* hirez Imagewriter device */
const gx_device_printer far_data gs_iwhi_device =
prn_device(prn_std_procs, "iwhi",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, 144, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
-
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, 144, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* LQ hirez Imagewriter device */
const gx_device_printer far_data gs_iwlq_device =
prn_device(prn_std_procs, "iwlq",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 320, 216,
- 0, 0, 0.5, 0, /* margins */
- 1, dmp_print_page);
-
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 320, 216,
+ 0, 0, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* ------ Internal routines ------ */
@@ -162,73 +157,73 @@ prn_device(prn_std_procs, "iwlq",
/* Send the page to the printer. */
static int
dmp_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
- int dev_type;
-
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- /* Note that in_size is a multiple of 8. */
- int in_size = line_size * 8;
-
- byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf1)");
- byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf2)");
- byte *prn = (byte *)gs_malloc(pdev->memory, 3*in_size, 1, "dmp_print_page(prn)");
-
- byte *in = buf1;
- byte *out = buf2;
- int lnum = 0;
-
- /* Check allocations */
- if ( buf1 == 0 || buf2 == 0 || prn == 0 )
- {
- if ( buf1 )
- gs_free(pdev->memory, (char *)buf1, in_size, 1,
- "dmp_print_page(buf1)");
- if ( buf2 )
- gs_free(pdev->memory, (char *)buf2, in_size, 1,
- "dmp_print_page(buf2)");
- if ( prn )
- gs_free(pdev->memory, (char *)prn, in_size, 1,
- "dmp_print_page(prn)");
- return_error(gs_error_VMerror);
- }
-
- if ( pdev->y_pixels_per_inch == 216 )
- dev_type = IWLQ;
- else if ( pdev->y_pixels_per_inch == 144 )
- dev_type = IWHI;
- else if ( pdev->x_pixels_per_inch == 160 )
- dev_type = IWLO;
- else
- dev_type = DMP;
-
- /* Initialize the printer and reset the margins. */
-
- fputs("\r\n\033>\033T16", prn_stream);
-
- switch(dev_type)
- {
- case IWLQ:
- fputs("\033P\033a3", prn_stream);
- break;
- case IWHI:
- case IWLO:
- fputs("\033P", prn_stream);
- break;
- case DMP:
- default:
- fputs("\033q", prn_stream);
- break;
- }
-
- /* Print lines of graphics */
- while ( lnum < pdev->height )
- {
- byte *inp;
- byte *in_end;
- byte *out_end;
- int lcnt,ltmp;
- int count, passes;
- byte *prn_blk, *prn_end, *prn_tmp;
+{
+ int dev_type;
+
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* Note that in_size is a multiple of 8. */
+ int in_size = line_size * 8;
+
+ byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf2)");
+ byte *prn = (byte *)gs_malloc(pdev->memory, 3*in_size, 1, "dmp_print_page(prn)");
+
+ byte *in = buf1;
+ byte *out = buf2;
+ int lnum = 0;
+
+ /* Check allocations */
+ if ( buf1 == 0 || buf2 == 0 || prn == 0 )
+ {
+ if ( buf1 )
+ gs_free(pdev->memory, (char *)buf1, in_size, 1,
+ "dmp_print_page(buf1)");
+ if ( buf2 )
+ gs_free(pdev->memory, (char *)buf2, in_size, 1,
+ "dmp_print_page(buf2)");
+ if ( prn )
+ gs_free(pdev->memory, (char *)prn, in_size, 1,
+ "dmp_print_page(prn)");
+ return_error(gs_error_VMerror);
+ }
+
+ if ( pdev->y_pixels_per_inch == 216 )
+ dev_type = IWLQ;
+ else if ( pdev->y_pixels_per_inch == 144 )
+ dev_type = IWHI;
+ else if ( pdev->x_pixels_per_inch == 160 )
+ dev_type = IWLO;
+ else
+ dev_type = DMP;
+
+ /* Initialize the printer and reset the margins. */
+
+ fputs("\r\n\033>\033T16", prn_stream);
+
+ switch(dev_type)
+ {
+ case IWLQ:
+ fputs("\033P\033a3", prn_stream);
+ break;
+ case IWHI:
+ case IWLO:
+ fputs("\033P", prn_stream);
+ break;
+ case DMP:
+ default:
+ fputs("\033q", prn_stream);
+ break;
+ }
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ int lcnt,ltmp;
+ int count, passes;
+ byte *prn_blk, *prn_end, *prn_tmp;
/* The apple DMP printer seems to be odd in that the bit order on
* each line is reverse what might be expected. Meaning, an
@@ -237,168 +232,168 @@ dmp_print_page(gx_device_printer *pdev, FILE *prn_stream)
* scan line in reverse order.
*/
- switch (dev_type)
- {
- case IWLQ: passes = 3; break;
- case IWHI: passes = 2; break;
- case IWLO:
- case DMP:
- default: passes = 1; break;
- }
-
- for (count = 0; count < passes; count++)
- {
- for (lcnt=0; lcnt<8; lcnt++)
- {
- switch(dev_type)
- {
- case IWLQ: ltmp = lcnt + 8*count; break;
- case IWHI: ltmp = 2*lcnt + count; break;
- case IWLO:
- case DMP:
- default: ltmp = lcnt; break;
- }
-
- if ((lnum+ltmp)>pdev->height)
- memset(in+lcnt*line_size,0,line_size);
- else
- gdev_prn_copy_scan_lines(pdev,
- lnum+ltmp, in + line_size*(7 - lcnt),
- line_size);
- }
-
- out_end = out;
- inp = in;
- in_end = inp + line_size;
- for ( ; inp < in_end; inp++, out_end += 8 )
- {
- gdev_prn_transpose_8x8(inp, line_size,
- out_end, 1);
- }
-
- out_end = out;
-
- switch (dev_type)
- {
- case IWLQ: prn_end = prn + count; break;
- case IWHI: prn_end = prn + in_size*count; break;
- case IWLO:
- case DMP:
- default: prn_end = prn; break;
- }
-
- while ( (int)(out_end-out) < in_size)
- {
- *prn_end = *(out_end++);
- if ((dev_type) == IWLQ) prn_end += 3;
- else prn_end++;
- }
- }
-
- switch (dev_type)
- {
- case IWLQ:
- prn_blk = prn;
- prn_end = prn_blk + in_size * 3;
- while (prn_end > prn && prn_end[-1] == 0 &&
- prn_end[-2] == 0 && prn_end[-3] == 0)
- {
- prn_end -= 3;
- }
- while (prn_blk < prn_end && prn_blk[0] == 0 &&
- prn_blk[1] == 0 && prn_blk[2] == 0)
- {
- prn_blk += 3;
- }
- if (prn_end != prn_blk)
- {
- if ((prn_blk - prn) > 7)
- fprintf(prn_stream,"\033U%04d%c%c%c",
- (int)((prn_blk - prn)/3),
- 0, 0, 0);
- else
- prn_blk = prn;
- fprintf(prn_stream,"\033C%04d",
- (int)((prn_end - prn_blk)/3));
- fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
- prn_stream);
- }
- break;
- case IWHI:
- for (count = 0; count < 2; count++)
- {
- prn_blk = prn_tmp = prn + in_size*count;
- prn_end = prn_blk + in_size;
- while (prn_end > prn_blk && prn_end[-1] == 0)
- prn_end--;
- while (prn_blk < prn_end && prn_blk[0] == 0)
- prn_blk++;
- if (prn_end != prn_blk)
- {
- if ((prn_blk - prn_tmp) > 7)
- fprintf(prn_stream,
- "\033V%04d%c",
- (int)(prn_blk-prn_tmp),
- 0);
- else
- prn_blk = prn_tmp;
- fprintf(prn_stream,"\033G%04d",
- (int)(prn_end - prn_blk));
- fwrite(prn_blk, 1,
- (int)(prn_end - prn_blk),
- prn_stream);
- }
- if (!count) fputs("\033T01\r\n",prn_stream);
- }
- fputs("\033T15",prn_stream);
- break;
- case IWLO:
- case DMP:
- default:
- prn_blk = prn;
- prn_end = prn_blk + in_size;
- while (prn_end > prn_blk && prn_end[-1] == 0)
- prn_end--;
- while (prn_blk < prn_end && prn_blk[0] == 0)
- prn_blk++;
- if (prn_end != prn_blk)
- {
- if ((prn_blk - prn) > 7)
- fprintf(prn_stream,"\033V%04d%c",
- (int)(prn_blk - prn), 0);
- else
- prn_blk = prn;
- fprintf(prn_stream,"\033G%04d",
- (int)(prn_end - prn_blk));
- fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
- prn_stream);
- }
- break;
- }
-
- fputs("\r\n",prn_stream);
-
- switch (dev_type)
- {
- case IWLQ: lnum += 24 ; break;
- case IWHI: lnum += 16 ; break;
- case IWLO:
- case DMP:
- default: lnum += 8 ; break;
- }
- }
-
- /* ImageWriter will skip a whole page if too close to end */
- /* so skip back more than an inch */
- if ( !(dev_type == DMP) )
- fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
-
- /* Formfeed and Reset printer */
- fputs("\033T16\f\033<\033B\033E", prn_stream);
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)prn, in_size, 1, "dmp_print_page(prn)");
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "dmp_print_page(buf2)");
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "dmp_print_page(buf1)");
- return 0;
+ switch (dev_type)
+ {
+ case IWLQ: passes = 3; break;
+ case IWHI: passes = 2; break;
+ case IWLO:
+ case DMP:
+ default: passes = 1; break;
+ }
+
+ for (count = 0; count < passes; count++)
+ {
+ for (lcnt=0; lcnt<8; lcnt++)
+ {
+ switch(dev_type)
+ {
+ case IWLQ: ltmp = lcnt + 8*count; break;
+ case IWHI: ltmp = 2*lcnt + count; break;
+ case IWLO:
+ case DMP:
+ default: ltmp = lcnt; break;
+ }
+
+ if ((lnum+ltmp)>pdev->height)
+ memset(in+lcnt*line_size,0,line_size);
+ else
+ gdev_prn_copy_scan_lines(pdev,
+ lnum+ltmp, in + line_size*(7 - lcnt),
+ line_size);
+ }
+
+ out_end = out;
+ inp = in;
+ in_end = inp + line_size;
+ for ( ; inp < in_end; inp++, out_end += 8 )
+ {
+ gdev_prn_transpose_8x8(inp, line_size,
+ out_end, 1);
+ }
+
+ out_end = out;
+
+ switch (dev_type)
+ {
+ case IWLQ: prn_end = prn + count; break;
+ case IWHI: prn_end = prn + in_size*count; break;
+ case IWLO:
+ case DMP:
+ default: prn_end = prn; break;
+ }
+
+ while ( (int)(out_end-out) < in_size)
+ {
+ *prn_end = *(out_end++);
+ if ((dev_type) == IWLQ) prn_end += 3;
+ else prn_end++;
+ }
+ }
+
+ switch (dev_type)
+ {
+ case IWLQ:
+ prn_blk = prn;
+ prn_end = prn_blk + in_size * 3;
+ while (prn_end > prn && prn_end[-1] == 0 &&
+ prn_end[-2] == 0 && prn_end[-3] == 0)
+ {
+ prn_end -= 3;
+ }
+ while (prn_blk < prn_end && prn_blk[0] == 0 &&
+ prn_blk[1] == 0 && prn_blk[2] == 0)
+ {
+ prn_blk += 3;
+ }
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn) > 7)
+ fprintf(prn_stream,"\033U%04d%c%c%c",
+ (int)((prn_blk - prn)/3),
+ 0, 0, 0);
+ else
+ prn_blk = prn;
+ fprintf(prn_stream,"\033C%04d",
+ (int)((prn_end - prn_blk)/3));
+ fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ break;
+ case IWHI:
+ for (count = 0; count < 2; count++)
+ {
+ prn_blk = prn_tmp = prn + in_size*count;
+ prn_end = prn_blk + in_size;
+ while (prn_end > prn_blk && prn_end[-1] == 0)
+ prn_end--;
+ while (prn_blk < prn_end && prn_blk[0] == 0)
+ prn_blk++;
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn_tmp) > 7)
+ fprintf(prn_stream,
+ "\033V%04d%c",
+ (int)(prn_blk-prn_tmp),
+ 0);
+ else
+ prn_blk = prn_tmp;
+ fprintf(prn_stream,"\033G%04d",
+ (int)(prn_end - prn_blk));
+ fwrite(prn_blk, 1,
+ (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ if (!count) fputs("\033T01\r\n",prn_stream);
+ }
+ fputs("\033T15",prn_stream);
+ break;
+ case IWLO:
+ case DMP:
+ default:
+ prn_blk = prn;
+ prn_end = prn_blk + in_size;
+ while (prn_end > prn_blk && prn_end[-1] == 0)
+ prn_end--;
+ while (prn_blk < prn_end && prn_blk[0] == 0)
+ prn_blk++;
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn) > 7)
+ fprintf(prn_stream,"\033V%04d%c",
+ (int)(prn_blk - prn), 0);
+ else
+ prn_blk = prn;
+ fprintf(prn_stream,"\033G%04d",
+ (int)(prn_end - prn_blk));
+ fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ break;
+ }
+
+ fputs("\r\n",prn_stream);
+
+ switch (dev_type)
+ {
+ case IWLQ: lnum += 24 ; break;
+ case IWHI: lnum += 16 ; break;
+ case IWLO:
+ case DMP:
+ default: lnum += 8 ; break;
+ }
+ }
+
+ /* ImageWriter will skip a whole page if too close to end */
+ /* so skip back more than an inch */
+ if ( !(dev_type == DMP) )
+ fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
+
+ /* Formfeed and Reset printer */
+ fputs("\033T16\f\033<\033B\033E", prn_stream);
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)prn, in_size, 1, "dmp_print_page(prn)");
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "dmp_print_page(buf2)");
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "dmp_print_page(buf1)");
+ return 0;
}
diff --git a/gs/base/gdevatx.c b/gs/base/gdevatx.c
index 5e7b101f4..4b6ba888c 100644
--- a/gs/base/gdevatx.c
+++ b/gs/base/gdevatx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,19 +39,19 @@ static dev_proc_print_page(atx38_print_page);
#define ATX_DEVICE(dname, w10, h10, dpi, lrm, btm, print_page)\
prn_device_margins(prn_std_procs, dname, w10, h10, dpi, dpi, 0, 0,\
- lrm, btm, lrm, btm, 1, print_page)
+ lrm, btm, lrm, btm, 1, print_page)
const gx_device_printer gs_atx23_device = /* real width = 576 pixels */
ATX_DEVICE("atx23", 28 /* 2.84" */, 35 /* (minimum) */,
- 203, 0.25, 0.125, atx23_print_page);
+ 203, 0.25, 0.125, atx23_print_page);
const gx_device_printer gs_atx24_device = /* real width = 832 pixels */
ATX_DEVICE("atx24", 41 /* 4.1" */, 35 /* (minimum) */,
- 203, 0.193, 0.125, atx24_print_page);
+ 203, 0.193, 0.125, atx24_print_page);
const gx_device_printer gs_atx38_device = /* real width = 2400 pixels */
ATX_DEVICE("atx38", 80 /* 8.0" */, 35 /* (minimum) */,
- 300, 0.25, 0.125, atx38_print_page);
+ 300, 0.25, 0.125, atx38_print_page);
/* Output a printer command with a 2-byte, little-endian numeric argument. */
static void
@@ -83,35 +83,35 @@ atx_compress(const byte *in_buf, int in_size, byte *out_buf, int out_size)
int pair_count;
if (in_size < MIN_IN_SIZE_TO_COMPRESS)
- return -1; /* not worth compressing */
+ return -1; /* not worth compressing */
/* Start a new segment. */
New_Segment:
if (in == in_end) /* end of input data */
- return out - out_buf;
+ return out - out_buf;
if (out == out_end) /* output buffer full */
- return -1;
+ return -1;
out_command = out;
out += 2;
if (in[1] == in[0]) { /* start compressed segment */
- /* out[-2] will be compressed segment command */
- out[-1] = in[0];
- pair_count = 1;
- goto Scan_Compressed_Pair;
+ /* out[-2] will be compressed segment command */
+ out[-1] = in[0];
+ pair_count = 1;
+ goto Scan_Compressed_Pair;
} else { /* start uncompressed segment */
- out[-2] = UNCOMPRESSED_SEGMENT_COMMAND;
- /* out[-1] will be pair count */
- pair_count = 0;
- goto Scan_Uncompressed_Pair;
+ out[-2] = UNCOMPRESSED_SEGMENT_COMMAND;
+ /* out[-1] will be pair count */
+ pair_count = 0;
+ goto Scan_Uncompressed_Pair;
}
/* Scan compressed data. */
Scan_Compressed:
if (pair_count == MAX_COMPRESSED_SEGMENT_PAIRS ||
- in == in_end || in[0] != in[-1] || in[1] != in[0]
- ) { /* end the segment */
- out_command[0] = COMPRESSED_SEGMENT_COMMAND + pair_count;
- goto New_Segment;
+ in == in_end || in[0] != in[-1] || in[1] != in[0]
+ ) { /* end the segment */
+ out_command[0] = COMPRESSED_SEGMENT_COMMAND + pair_count;
+ goto New_Segment;
}
++pair_count;
Scan_Compressed_Pair:
@@ -121,20 +121,20 @@ atx_compress(const byte *in_buf, int in_size, byte *out_buf, int out_size)
/* Scan uncompressed data. */
Scan_Uncompressed:
if (pair_count == MAX_UNCOMPRESSED_SEGMENT_PAIRS ||
- in == in_end || in[1] == in[0]
- ) { /* end the segment */
- out_command[1] = pair_count;
- goto New_Segment;
+ in == in_end || in[1] == in[0]
+ ) { /* end the segment */
+ out_command[1] = pair_count;
+ goto New_Segment;
}
Scan_Uncompressed_Pair:
if (out == out_end) /* output buffer full */
- return -1;
+ return -1;
out[0] = in[0], out[1] = in[1];
in += 2;
out += 2;
++pair_count;
goto Scan_Uncompressed;
-
+
}
/* Send the page to the printer. */
@@ -143,7 +143,7 @@ atx_print_page(gx_device_printer *pdev, FILE *f, int max_width_bytes)
{
/*
* The page length command uses 16 bits to represent the length in
- * units of 0.01", so the maximum representable page length is
+ * units of 0.01", so the maximum representable page length is
* 655.35", including the unprintable top and bottom margins.
* Compute the maximum height of the printable area in pixels.
*/
@@ -151,7 +151,7 @@ atx_print_page(gx_device_printer *pdev, FILE *f, int max_width_bytes)
int max_height = (int)(pdev->HWResolution[1] * 655 - top_bottom_skip);
int height = min(pdev->height, max_height);
int page_length_100ths =
- (int)ceil((height / pdev->HWResolution[1] + top_bottom_skip) * 100);
+ (int)ceil((height / pdev->HWResolution[1] + top_bottom_skip) * 100);
gs_memory_t *mem = pdev->memory;
int raster = gx_device_raster((gx_device *)pdev, true);
byte *buf;
@@ -166,63 +166,63 @@ atx_print_page(gx_device_printer *pdev, FILE *f, int max_width_bytes)
/* Enforce a minimum 3" page length. */
if (page_length_100ths < 300)
- page_length_100ths = 300;
+ page_length_100ths = 300;
buf = gs_alloc_bytes(mem, raster, "atx_print_page(buf)");
compressed = gs_alloc_bytes(mem, compressed_raster,
- "atx_print_page(compressed)");
+ "atx_print_page(compressed)");
if (buf == 0 || compressed == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
fput_atx_command(f, ATX_SET_PAGE_LENGTH, page_length_100ths);
for (blank_lines = 0, lnum = 0; lnum < height; ++lnum) {
- byte *row;
- byte *end;
- int count;
-
- gdev_prn_get_bits(pdev, lnum, buf, &row);
- /* Find the end of the non-blank data. */
- for (end = row + raster; end > row && end[-1] == 0 && end[-2] == 0; )
- end -= 2;
- if (end == row) { /* blank line */
- ++blank_lines;
- continue;
- }
- if (blank_lines) { /* skip vertically */
- fput_atx_command(f, ATX_VERTICAL_TAB, blank_lines + 1);
- blank_lines = 0;
- }
- /* Truncate the line to the maximum printable width. */
- if (end - row > max_width_bytes)
- end = row + max_width_bytes;
- count = atx_compress(row, end - row, compressed, compressed_raster);
- if (count >= 0) { /* compressed line */
- /*
- * Note that since compressed_raster can't exceed 510, count
- * can't exceed 510 either.
- */
- fputs(ATX_COMPRESSED_DATA, f);
- fputc(count / 2, f);
- fwrite(compressed, 1, count, f);
- } else { /* uncompressed line */
- int num_bytes = end - row;
-
- fput_atx_command(f, ATX_UNCOMPRESSED_DATA, num_bytes);
- fwrite(row, 1, num_bytes, f);
- }
+ byte *row;
+ byte *end;
+ int count;
+
+ gdev_prn_get_bits(pdev, lnum, buf, &row);
+ /* Find the end of the non-blank data. */
+ for (end = row + raster; end > row && end[-1] == 0 && end[-2] == 0; )
+ end -= 2;
+ if (end == row) { /* blank line */
+ ++blank_lines;
+ continue;
+ }
+ if (blank_lines) { /* skip vertically */
+ fput_atx_command(f, ATX_VERTICAL_TAB, blank_lines + 1);
+ blank_lines = 0;
+ }
+ /* Truncate the line to the maximum printable width. */
+ if (end - row > max_width_bytes)
+ end = row + max_width_bytes;
+ count = atx_compress(row, end - row, compressed, compressed_raster);
+ if (count >= 0) { /* compressed line */
+ /*
+ * Note that since compressed_raster can't exceed 510, count
+ * can't exceed 510 either.
+ */
+ fputs(ATX_COMPRESSED_DATA, f);
+ fputc(count / 2, f);
+ fwrite(compressed, 1, count, f);
+ } else { /* uncompressed line */
+ int num_bytes = end - row;
+
+ fput_atx_command(f, ATX_UNCOMPRESSED_DATA, num_bytes);
+ fwrite(row, 1, num_bytes, f);
+ }
}
#if 0 /**************** MAY NOT BE NEEDED ****************/
/* Enforce the minimum page length, and skip any final blank lines. */
{
- int paper_length = (int)(pdev->HWResolution[1] * 3 + 0.5);
- int printed_length = height - blank_lines;
-
- if (height > paper_length)
- paper_length = height;
- if (printed_length < paper_length)
- fput_atx_command(f, ATX_VERTICAL_TAB,
- paper_length - printed_length + 1);
+ int paper_length = (int)(pdev->HWResolution[1] * 3 + 0.5);
+ int printed_length = height - blank_lines;
+
+ if (height > paper_length)
+ paper_length = height;
+ if (printed_length < paper_length)
+ fput_atx_command(f, ATX_VERTICAL_TAB,
+ paper_length - printed_length + 1);
}
#endif
diff --git a/gs/base/gdevbbox.c b/gs/base/gdevbbox.c
index c354f967c..bc061c8fb 100644
--- a/gs/base/gdevbbox.c
+++ b/gs/base/gdevbbox.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -80,9 +80,9 @@ gx_device_bbox gs_bbox_device =
* Define the device as 8-bit gray scale to avoid computing halftones.
*/
std_device_dci_body(gx_device_bbox, 0, "bbox",
- MAX_COORD, MAX_COORD,
- MAX_RESOLUTION, MAX_RESOLUTION,
- 1, 8, 255, 0, 256, 1),
+ MAX_COORD, MAX_COORD,
+ MAX_RESOLUTION, MAX_RESOLUTION,
+ 1, 8, 255, 0, 256, 1),
{bbox_open_device,
gx_upright_get_initial_matrix,
NULL, /* sync_output */
@@ -189,19 +189,19 @@ bbox_default_add_rect(void *pdata, fixed x0, fixed y0, fixed x1, fixed y1)
gs_fixed_rect *const pr = &bdev->bbox;
if (x0 < pr->p.x)
- pr->p.x = x0;
+ pr->p.x = x0;
if (y0 < pr->p.y)
- pr->p.y = y0;
+ pr->p.y = y0;
if (x1 > pr->q.x)
- pr->q.x = x1;
+ pr->q.x = x1;
if (y1 > pr->q.y)
- pr->q.y = y1;
+ pr->q.y = y1;
}
#define BBOX_ADD_RECT(bdev, x0, y0, x1, y1)\
bdev->box_procs.add_rect(bdev->box_proc_data, x0, y0, x1, y1)
#define BBOX_ADD_INT_RECT(bdev, x0, y0, x1, y1)\
BBOX_ADD_RECT(bdev, int2fixed(x0), int2fixed(y0), int2fixed(x1),\
- int2fixed(y1))
+ int2fixed(y1))
bool
bbox_default_in_rect(const void *pdata, const gs_fixed_rect *pbox)
@@ -227,12 +227,12 @@ bbox_copy_params(gx_device_bbox * bdev, bool remap_colors)
gx_device *tdev = bdev->target;
if (tdev != 0)
- gx_device_copy_params((gx_device *)bdev, tdev);
+ gx_device_copy_params((gx_device *)bdev, tdev);
if (remap_colors) {
- bdev->black = gx_device_black((gx_device *)bdev);
- bdev->white = gx_device_white((gx_device *)bdev);
- bdev->transparent =
- (bdev->white_is_opaque ? gx_no_color_index : bdev->white);
+ bdev->black = gx_device_black((gx_device *)bdev);
+ bdev->white = gx_device_white((gx_device *)bdev);
+ bdev->transparent =
+ (bdev->white_is_opaque ? gx_no_color_index : bdev->white);
}
}
@@ -246,16 +246,16 @@ bbox_close_device(gx_device * dev)
gx_device *tdev = bdev->target;
if (bdev->box_procs.init_box != box_procs_default.init_box) {
- /*
- * This device was created as a wrapper for a compositor.
- * Just free the devices.
- */
- int code = (tdev && bdev->forward_open_close ? gs_closedevice(tdev) : 0);
-
- gs_free_object(dev->memory, dev, "bbox_close_device(composite)");
- return code;
+ /*
+ * This device was created as a wrapper for a compositor.
+ * Just free the devices.
+ */
+ int code = (tdev && bdev->forward_open_close ? gs_closedevice(tdev) : 0);
+
+ gs_free_object(dev->memory, dev, "bbox_close_device(composite)");
+ return code;
} else {
- return (tdev && bdev->forward_open_close ? gs_closedevice(tdev) : 0);
+ return (tdev && bdev->forward_open_close ? gs_closedevice(tdev) : 0);
}
}
@@ -264,28 +264,28 @@ void
gx_device_bbox_init(gx_device_bbox * dev, gx_device * target, gs_memory_t *mem)
{
gx_device_init((gx_device *) dev, (const gx_device *)&gs_bbox_device,
- (target ? target->memory : mem), true);
+ (target ? target->memory : mem), true);
if (target) {
gx_device_forward_fill_in_procs((gx_device_forward *) dev);
- set_dev_proc(dev, get_initial_matrix, gx_forward_get_initial_matrix);
- set_dev_proc(dev, map_rgb_color, gx_forward_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_forward_map_color_rgb);
- set_dev_proc(dev, map_cmyk_color, gx_forward_map_cmyk_color);
- set_dev_proc(dev, map_rgb_alpha_color, gx_forward_map_rgb_alpha_color);
- set_dev_proc(dev, get_color_mapping_procs, gx_forward_get_color_mapping_procs);
- set_dev_proc(dev, get_color_comp_index, gx_forward_get_color_comp_index);
- set_dev_proc(dev, encode_color, gx_forward_encode_color);
- set_dev_proc(dev, decode_color, gx_forward_decode_color);
- set_dev_proc(dev, dev_spec_op, gx_forward_dev_spec_op);
- set_dev_proc(dev, fill_rectangle_hl_color, gx_forward_fill_rectangle_hl_color);
- set_dev_proc(dev, include_color_space, gx_forward_include_color_space);
- set_dev_proc(dev, update_spot_equivalent_colors,
- gx_forward_update_spot_equivalent_colors);
- set_dev_proc(dev, get_page_device, gx_forward_get_page_device);
- set_dev_proc(dev, ret_devn_params, gx_forward_ret_devn_params);
- gx_device_set_target((gx_device_forward *)dev, target);
+ set_dev_proc(dev, get_initial_matrix, gx_forward_get_initial_matrix);
+ set_dev_proc(dev, map_rgb_color, gx_forward_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_forward_map_color_rgb);
+ set_dev_proc(dev, map_cmyk_color, gx_forward_map_cmyk_color);
+ set_dev_proc(dev, map_rgb_alpha_color, gx_forward_map_rgb_alpha_color);
+ set_dev_proc(dev, get_color_mapping_procs, gx_forward_get_color_mapping_procs);
+ set_dev_proc(dev, get_color_comp_index, gx_forward_get_color_comp_index);
+ set_dev_proc(dev, encode_color, gx_forward_encode_color);
+ set_dev_proc(dev, decode_color, gx_forward_decode_color);
+ set_dev_proc(dev, dev_spec_op, gx_forward_dev_spec_op);
+ set_dev_proc(dev, fill_rectangle_hl_color, gx_forward_fill_rectangle_hl_color);
+ set_dev_proc(dev, include_color_space, gx_forward_include_color_space);
+ set_dev_proc(dev, update_spot_equivalent_colors,
+ gx_forward_update_spot_equivalent_colors);
+ set_dev_proc(dev, get_page_device, gx_forward_get_page_device);
+ set_dev_proc(dev, ret_devn_params, gx_forward_ret_devn_params);
+ gx_device_set_target((gx_device_forward *)dev, target);
} else {
- gx_device_fill_in_procs((gx_device *)dev);
+ gx_device_fill_in_procs((gx_device *)dev);
gx_device_forward_fill_in_procs((gx_device_forward *) dev);
}
dev->box_procs = box_procs_default;
@@ -307,7 +307,7 @@ gx_device_bbox_set_white_opaque(gx_device_bbox *bdev, bool white_is_opaque)
{
bdev->white_is_opaque = white_is_opaque;
bdev->transparent =
- (bdev->white_is_opaque ? gx_no_color_index : bdev->white);
+ (bdev->white_is_opaque ? gx_no_color_index : bdev->white);
}
/* Release a bounding box device. */
@@ -326,18 +326,18 @@ gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox)
BBOX_GET_BOX(dev, &bbox);
if (bbox.p.x > bbox.q.x || bbox.p.y > bbox.q.y) {
- /* Nothing has been written on this page. */
- pbbox->p.x = pbbox->p.y = pbbox->q.x = pbbox->q.y = 0;
+ /* Nothing has been written on this page. */
+ pbbox->p.x = pbbox->p.y = pbbox->q.x = pbbox->q.y = 0;
} else {
- gs_rect dbox;
- gs_matrix mat;
-
- dbox.p.x = fixed2float(bbox.p.x);
- dbox.p.y = fixed2float(bbox.p.y);
- dbox.q.x = fixed2float(bbox.q.x);
- dbox.q.y = fixed2float(bbox.q.y);
- gs_deviceinitialmatrix((gx_device *)dev, &mat);
- gs_bbox_transform_inverse(&dbox, &mat, pbbox);
+ gs_rect dbox;
+ gs_matrix mat;
+
+ dbox.p.x = fixed2float(bbox.p.x);
+ dbox.p.y = fixed2float(bbox.p.y);
+ dbox.q.x = fixed2float(bbox.q.x);
+ dbox.q.y = fixed2float(bbox.q.y);
+ gs_deviceinitialmatrix((gx_device *)dev, &mat);
+ gs_bbox_transform_inverse(&dbox, &mat, pbbox);
}
}
@@ -347,20 +347,20 @@ bbox_open_device(gx_device * dev)
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
if (bdev->free_standing) {
- gx_device_forward_fill_in_procs((gx_device_forward *) dev);
- bdev->box_procs = box_procs_default;
- bdev->box_proc_data = bdev;
+ gx_device_forward_fill_in_procs((gx_device_forward *) dev);
+ bdev->box_procs = box_procs_default;
+ bdev->box_proc_data = bdev;
}
if (bdev->box_procs.init_box == box_procs_default.init_box)
- BBOX_INIT_BOX(bdev);
+ BBOX_INIT_BOX(bdev);
/* gx_forward_open_device doesn't exist */
{
- gx_device *tdev = bdev->target;
- int code =
- (tdev && bdev->forward_open_close ? gs_opendevice(tdev) : 0);
+ gx_device *tdev = bdev->target;
+ int code =
+ (tdev && bdev->forward_open_close ? gs_opendevice(tdev) : 0);
- bbox_copy_params(bdev, true);
- return code;
+ bbox_copy_params(bdev, true);
+ return code;
}
}
@@ -370,17 +370,17 @@ bbox_output_page(gx_device * dev, int num_copies, int flush)
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
if (bdev->free_standing) {
- /*
- * This is a free-standing device. Print the page bounding box.
- */
- gs_rect bbox;
-
- gx_device_bbox_bbox(bdev, &bbox);
- dlprintf4("%%%%BoundingBox: %d %d %d %d\n",
- (int)floor(bbox.p.x), (int)floor(bbox.p.y),
- (int)ceil(bbox.q.x), (int)ceil(bbox.q.y));
- dlprintf4("%%%%HiResBoundingBox: %f %f %f %f\n",
- bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
+ /*
+ * This is a free-standing device. Print the page bounding box.
+ */
+ gs_rect bbox;
+
+ gx_device_bbox_bbox(bdev, &bbox);
+ dlprintf4("%%%%BoundingBox: %d %d %d %d\n",
+ (int)floor(bbox.p.x), (int)floor(bbox.p.y),
+ (int)ceil(bbox.q.x), (int)ceil(bbox.q.y));
+ dlprintf4("%%%%HiResBoundingBox: %f %f %f %f\n",
+ bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
}
return gx_forward_output_page(dev, num_copies, flush);
}
@@ -389,50 +389,50 @@ bbox_output_page(gx_device * dev, int num_copies, int flush)
static int
bbox_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
gx_device *tdev = bdev->target;
/* gx_forward_fill_rectangle doesn't exist */
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, fill_rectangle)(tdev, x, y, w, h, color));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, fill_rectangle)(tdev, x, y, w, h, color));
if (color != bdev->transparent)
- BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
+ BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
}
static int
bbox_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* gx_forward_copy_mono doesn't exist */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, copy_mono)
- (tdev, data, dx, raster, id, x, y, w, h, zero, one));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, copy_mono)
+ (tdev, data, dx, raster, id, x, y, w, h, zero, one));
if ((one != gx_no_color_index && one != bdev->transparent) ||
- (zero != gx_no_color_index && zero != bdev->transparent)
- )
- BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
+ (zero != gx_no_color_index && zero != bdev->transparent)
+ )
+ BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
}
static int
bbox_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* gx_forward_copy_color doesn't exist */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, copy_color)
- (tdev, data, dx, raster, id, x, y, w, h));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, copy_color)
+ (tdev, data, dx, raster, id, x, y, w, h));
BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
@@ -440,16 +440,16 @@ bbox_copy_color(gx_device * dev, const byte * data,
static int
bbox_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* gx_forward_copy_alpha doesn't exist */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, copy_alpha)
- (tdev, data, data_x, raster, id, x, y, w, h, color, depth));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, copy_alpha)
+ (tdev, data, data_x, raster, id, x, y, w, h, color, depth));
BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
@@ -458,37 +458,37 @@ bbox_copy_alpha(gx_device * dev, const byte * data, int data_x,
static int
bbox_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* Skip the call if there is no target. */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, strip_tile_rectangle)
- (tdev, tiles, x, y, w, h, color0, color1, px, py));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, strip_tile_rectangle)
+ (tdev, tiles, x, y, w, h, color0, color1, px, py));
BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
}
static int
bbox_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster,
- gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int w, int h,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster,
+ gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int w, int h,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* gx_forward_strip_copy_rop doesn't exist */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, strip_copy_rop)
- (tdev, sdata, sourcex, sraster, id, scolors,
- textures, tcolors, x, y, w, h, phase_x, phase_y, lop));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, strip_copy_rop)
+ (tdev, sdata, sourcex, sraster, id, scolors,
+ textures, tcolors, x, y, w, h, phase_x, phase_y, lop));
BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
return code;
@@ -507,15 +507,15 @@ bbox_get_params(gx_device * dev, gs_param_list * plist)
float bbox[4];
if (code < 0)
- return code;
+ return code;
/*
* We might be calling get_params before the device has been
* initialized: in this case, box_proc_data = 0.
*/
if (bdev->box_proc_data == 0)
- fbox = bdev->bbox;
+ fbox = bdev->bbox;
else
- BBOX_GET_BOX(bdev, &fbox);
+ BBOX_GET_BOX(bdev, &fbox);
bbox[0] = fixed2float(fbox.p.x);
bbox[1] = fixed2float(fbox.p.y);
bbox[2] = fixed2float(fbox.q.x);
@@ -542,38 +542,38 @@ bbox_put_params(gx_device * dev, gs_param_list * plist)
gs_param_float_array bba;
code = param_read_float_array(plist, (param_name = "PageBoundingBox"),
- &bba);
+ &bba);
switch (code) {
- case 0:
- if (bba.size != 4) {
- ecode = gs_note_error(gs_error_rangecheck);
- goto e;
- }
- break;
- default:
- ecode = code;
- e:param_signal_error(plist, param_name, ecode);
- case 1:
- bba.data = 0;
+ case 0:
+ if (bba.size != 4) {
+ ecode = gs_note_error(gs_error_rangecheck);
+ goto e;
+ }
+ break;
+ default:
+ ecode = code;
+ e:param_signal_error(plist, param_name, ecode);
+ case 1:
+ bba.data = 0;
}
switch (code = param_read_bool(plist, (param_name = "WhiteIsOpaque"), &white_is_opaque)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
case 1:
- break;
+ break;
}
code = gx_forward_put_params(dev, plist);
if (ecode < 0)
- code = ecode;
+ code = ecode;
if (code >= 0) {
if( bba.data != 0) {
- BBOX_INIT_BOX(bdev);
- BBOX_ADD_RECT(bdev, float2fixed(bba.data[0]), float2fixed(bba.data[1]),
- float2fixed(bba.data[2]), float2fixed(bba.data[3]));
+ BBOX_INIT_BOX(bdev);
+ BBOX_ADD_RECT(bdev, float2fixed(bba.data[0]), float2fixed(bba.data[1]),
+ float2fixed(bba.data[2]), float2fixed(bba.data[3]));
}
bdev->white_is_opaque = white_is_opaque;
}
@@ -587,152 +587,152 @@ static fixed
edge_x_at_y(const gs_fixed_edge * edge, fixed y)
{
return fixed_mult_quo(edge->end.x - edge->start.x,
- y - edge->start.y,
- edge->end.y - edge->start.y) + edge->start.x;
+ y - edge->start.y,
+ edge->end.y - edge->start.y) + edge->start.x;
}
static int
bbox_fill_trapezoid(gx_device * dev,
- const gs_fixed_edge * left, const gs_fixed_edge * right,
- fixed ybot, fixed ytop, bool swap_axes,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ const gs_fixed_edge * left, const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* Skip the call if there is no target. */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, fill_trapezoid)
- (tdev, left, right, ybot, ytop, swap_axes, pdevc, lop));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, fill_trapezoid)
+ (tdev, left, right, ybot, ytop, swap_axes, pdevc, lop));
if (!GX_DC_IS_TRANSPARENT(pdevc, bdev)) {
- fixed x0l =
- (left->start.y == ybot ? left->start.x :
- edge_x_at_y(left, ybot));
- fixed x1l =
- (left->end.y == ytop ? left->end.x :
- edge_x_at_y(left, ytop));
- fixed x0r =
- (right->start.y == ybot ? right->start.x :
- edge_x_at_y(right, ybot));
- fixed x1r =
- (right->end.y == ytop ? right->end.x :
- edge_x_at_y(right, ytop));
- fixed xminl = min(x0l, x1l), xmaxl = max(x0l, x1l);
- fixed xminr = min(x0r, x1r), xmaxr = max(x0r, x1r);
- fixed x0 = min(xminl, xminr), x1 = max(xmaxl, xmaxr);
-
- if (swap_axes)
- BBOX_ADD_RECT(bdev, ybot, x0, ytop, x1);
- else
- BBOX_ADD_RECT(bdev, x0, ybot, x1, ytop);
+ fixed x0l =
+ (left->start.y == ybot ? left->start.x :
+ edge_x_at_y(left, ybot));
+ fixed x1l =
+ (left->end.y == ytop ? left->end.x :
+ edge_x_at_y(left, ytop));
+ fixed x0r =
+ (right->start.y == ybot ? right->start.x :
+ edge_x_at_y(right, ybot));
+ fixed x1r =
+ (right->end.y == ytop ? right->end.x :
+ edge_x_at_y(right, ytop));
+ fixed xminl = min(x0l, x1l), xmaxl = max(x0l, x1l);
+ fixed xminr = min(x0r, x1r), xmaxr = max(x0r, x1r);
+ fixed x0 = min(xminl, xminr), x1 = max(xmaxl, xmaxr);
+
+ if (swap_axes)
+ BBOX_ADD_RECT(bdev, ybot, x0, ytop, x1);
+ else
+ BBOX_ADD_RECT(bdev, x0, ybot, x1, ytop);
}
return code;
}
static int
bbox_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay,
- fixed bx, fixed by, const gx_device_color * pdevc,
- gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay,
+ fixed bx, fixed by, const gx_device_color * pdevc,
+ gs_logical_operation_t lop)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* Skip the call if there is no target. */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, fill_parallelogram)
- (tdev, px, py, ax, ay, bx, by, pdevc, lop));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, fill_parallelogram)
+ (tdev, px, py, ax, ay, bx, by, pdevc, lop));
if (!GX_DC_IS_TRANSPARENT(pdevc, bdev)) {
- fixed xmin, ymin, xmax, ymax;
+ fixed xmin, ymin, xmax, ymax;
- /* bbox_add_rect requires points in correct order. */
+ /* bbox_add_rect requires points in correct order. */
#define SET_MIN_MAX(vmin, vmax, av, bv)\
BEGIN\
if (av <= 0) {\
- if (bv <= 0)\
- vmin = av + bv, vmax = 0;\
- else\
- vmin = av, vmax = bv;\
+ if (bv <= 0)\
+ vmin = av + bv, vmax = 0;\
+ else\
+ vmin = av, vmax = bv;\
} else if (bv <= 0)\
- vmin = bv, vmax = av;\
+ vmin = bv, vmax = av;\
else\
- vmin = 0, vmax = av + bv;\
+ vmin = 0, vmax = av + bv;\
END
- SET_MIN_MAX(xmin, xmax, ax, bx);
- SET_MIN_MAX(ymin, ymax, ay, by);
+ SET_MIN_MAX(xmin, xmax, ax, bx);
+ SET_MIN_MAX(ymin, ymax, ay, by);
#undef SET_MIN_MAX
- BBOX_ADD_RECT(bdev, px + xmin, py + ymin, px + xmax, py + ymax);
+ BBOX_ADD_RECT(bdev, px + xmin, py + ymin, px + xmax, py + ymax);
}
return code;
}
static int
bbox_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* Skip the call if there is no target. */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, fill_triangle)
- (tdev, px, py, ax, ay, bx, by, pdevc, lop));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, fill_triangle)
+ (tdev, px, py, ax, ay, bx, by, pdevc, lop));
if (!GX_DC_IS_TRANSPARENT(pdevc, bdev)) {
- fixed xmin, ymin, xmax, ymax;
+ fixed xmin, ymin, xmax, ymax;
- /* bbox_add_rect requires points in correct order. */
+ /* bbox_add_rect requires points in correct order. */
#define SET_MIN_MAX(vmin, vmax, av, bv)\
BEGIN\
if (av <= 0) {\
- if (bv <= 0)\
- vmin = min(av, bv), vmax = 0;\
- else\
- vmin = av, vmax = bv;\
+ if (bv <= 0)\
+ vmin = min(av, bv), vmax = 0;\
+ else\
+ vmin = av, vmax = bv;\
} else if (bv <= 0)\
- vmin = bv, vmax = av;\
+ vmin = bv, vmax = av;\
else\
- vmin = 0, vmax = max(av, bv);\
+ vmin = 0, vmax = max(av, bv);\
END
- SET_MIN_MAX(xmin, xmax, ax, bx);
- SET_MIN_MAX(ymin, ymax, ay, by);
+ SET_MIN_MAX(xmin, xmax, ax, bx);
+ SET_MIN_MAX(ymin, ymax, ay, by);
#undef SET_MIN_MAX
- BBOX_ADD_RECT(bdev, px + xmin, py + ymin, px + xmax, py + ymax);
+ BBOX_ADD_RECT(bdev, px + xmin, py + ymin, px + xmax, py + ymax);
}
return code;
}
static int
bbox_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_device_color * pdevc, gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_device_color * pdevc, gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
/* Skip the call if there is no target. */
gx_device *tdev = bdev->target;
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, draw_thin_line)
- (tdev, fx0, fy0, fx1, fy0, pdevc, lop, adjustx, adjusty));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, draw_thin_line)
+ (tdev, fx0, fy0, fx1, fy0, pdevc, lop, adjustx, adjusty));
if (!GX_DC_IS_TRANSPARENT(pdevc, bdev)) {
- fixed xmin, ymin, xmax, ymax;
+ fixed xmin, ymin, xmax, ymax;
- /* bbox_add_rect requires points in correct order. */
+ /* bbox_add_rect requires points in correct order. */
#define SET_MIN_MAX(vmin, vmax, av, bv)\
BEGIN\
if (av < bv)\
- vmin = av, vmax = bv;\
+ vmin = av, vmax = bv;\
else\
- vmin = bv, vmax = av;\
+ vmin = bv, vmax = av;\
END
- SET_MIN_MAX(xmin, xmax, fx0, fx1);
- SET_MIN_MAX(ymin, ymax, fy0, fy1);
+ SET_MIN_MAX(xmin, xmax, fx0, fx1);
+ SET_MIN_MAX(ymin, ymax, fy0, fy1);
#undef SET_MIN_MAX
- BBOX_ADD_RECT(bdev, xmin, ymin, xmax, ymax);
+ BBOX_ADD_RECT(bdev, xmin, ymin, xmax, ymax);
}
return code;
}
@@ -745,166 +745,166 @@ bbox_draw_thin_line(gx_device * dev,
static int
bbox_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_fill_params * params, const gx_device_color * pdevc,
- const gx_clip_path * pcpath)
+ const gx_fill_params * params, const gx_device_color * pdevc,
+ const gx_clip_path * pcpath)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
gx_device *tdev = bdev->target;
dev_proc_fill_path((*fill_path)) =
- (tdev == 0 ? dev_proc(&gs_null_device, fill_path) :
- dev_proc(tdev, fill_path));
+ (tdev == 0 ? dev_proc(&gs_null_device, fill_path) :
+ dev_proc(tdev, fill_path));
int code;
if (ppath == NULL) {
- /* A special handling of shfill with no path. */
- gs_fixed_rect ibox;
- gs_fixed_point adjust;
-
- if (pcpath == NULL)
- return 0;
- gx_cpath_inner_box(pcpath, &ibox);
- adjust = params->adjust;
- adjust_box(&ibox, adjust);
- BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
- return 0;
+ /* A special handling of shfill with no path. */
+ gs_fixed_rect ibox;
+ gs_fixed_point adjust;
+
+ if (pcpath == NULL)
+ return 0;
+ gx_cpath_inner_box(pcpath, &ibox);
+ adjust = params->adjust;
+ adjust_box(&ibox, adjust);
+ BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
+ return 0;
} else if (!GX_DC_IS_TRANSPARENT(pdevc, bdev) && !gx_path_is_void(ppath)) {
- gs_fixed_rect ibox;
- gs_fixed_point adjust;
-
- if (gx_path_bbox(ppath, &ibox) < 0)
- return 0;
- adjust = params->adjust;
- adjust_box(&ibox, adjust);
- /*
- * If the path lies within the already accumulated box, just draw
- * on the target.
- */
- if (BBOX_IN_RECT(bdev, &ibox))
- return fill_path(tdev, pis, ppath, params, pdevc, pcpath);
- /*
- * If the target uses the default algorithm, just draw on the
- * bbox device.
- */
- if (tdev != 0 && fill_path == gx_default_fill_path)
- return fill_path(dev, pis, ppath, params, pdevc, pcpath);
- /* Draw on the target now. */
- code = fill_path(tdev, pis, ppath, params, pdevc, pcpath);
- if (code < 0)
- return code;
- if (pcpath != NULL &&
- !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
- ibox.q.x, ibox.q.y)
- ) {
- /*
- * Let the target do the drawing, but break down the
- * fill path into pieces for computing the bounding box.
- */
- gx_drawing_color devc;
-
- set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
- bdev->target = NULL;
- code = gx_default_fill_path(dev, pis, ppath, params, &devc, pcpath);
- bdev->target = tdev;
- } else { /* Just use the path bounding box. */
- BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
- }
- return code;
+ gs_fixed_rect ibox;
+ gs_fixed_point adjust;
+
+ if (gx_path_bbox(ppath, &ibox) < 0)
+ return 0;
+ adjust = params->adjust;
+ adjust_box(&ibox, adjust);
+ /*
+ * If the path lies within the already accumulated box, just draw
+ * on the target.
+ */
+ if (BBOX_IN_RECT(bdev, &ibox))
+ return fill_path(tdev, pis, ppath, params, pdevc, pcpath);
+ /*
+ * If the target uses the default algorithm, just draw on the
+ * bbox device.
+ */
+ if (tdev != 0 && fill_path == gx_default_fill_path)
+ return fill_path(dev, pis, ppath, params, pdevc, pcpath);
+ /* Draw on the target now. */
+ code = fill_path(tdev, pis, ppath, params, pdevc, pcpath);
+ if (code < 0)
+ return code;
+ if (pcpath != NULL &&
+ !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
+ ibox.q.x, ibox.q.y)
+ ) {
+ /*
+ * Let the target do the drawing, but break down the
+ * fill path into pieces for computing the bounding box.
+ */
+ gx_drawing_color devc;
+
+ set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
+ bdev->target = NULL;
+ code = gx_default_fill_path(dev, pis, ppath, params, &devc, pcpath);
+ bdev->target = tdev;
+ } else { /* Just use the path bounding box. */
+ BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
+ }
+ return code;
} else
- return fill_path(tdev, pis, ppath, params, pdevc, pcpath);
+ return fill_path(tdev, pis, ppath, params, pdevc, pcpath);
}
static int
bbox_stroke_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_stroke_params * params,
- const gx_drawing_color * pdevc, const gx_clip_path * pcpath)
+ const gx_stroke_params * params,
+ const gx_drawing_color * pdevc, const gx_clip_path * pcpath)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
gx_device *tdev = bdev->target;
/* Skip the call if there is no target. */
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, stroke_path)(tdev, pis, ppath, params, pdevc, pcpath));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, stroke_path)(tdev, pis, ppath, params, pdevc, pcpath));
if (!GX_DC_IS_TRANSPARENT(pdevc, bdev)) {
- gs_fixed_rect ibox;
- gs_fixed_point expand;
-
- if (gx_stroke_path_expansion(pis, ppath, &expand) == 0 &&
- gx_path_bbox(ppath, &ibox) >= 0
- ) {
- /* The fast result is exact. */
- adjust_box(&ibox, expand);
- } else {
- /*
- * The result is not exact. Compute an exact result using
- * strokepath.
- */
- gx_path *spath = gx_path_alloc(pis->memory, "bbox_stroke_path");
- int code = 0;
-
- if (spath)
- code = gx_imager_stroke_add(ppath, spath, dev, pis);
- else
- code = -1;
- if (code >= 0)
- code = gx_path_bbox(spath, &ibox);
- if (code < 0) {
- ibox.p.x = ibox.p.y = min_fixed;
- ibox.q.x = ibox.q.y = max_fixed;
- }
- if (spath)
- gx_path_free(spath, "bbox_stroke_path");
- }
- if (pcpath != NULL &&
- !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
- ibox.q.x, ibox.q.y)
- ) {
- /* Let the target do the drawing, but break down the */
- /* fill path into pieces for computing the bounding box. */
- gx_drawing_color devc;
-
- set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
- bdev->target = NULL;
- gx_default_stroke_path(dev, pis, ppath, params, &devc, pcpath);
- bdev->target = tdev;
- } else {
- /* Just use the path bounding box. */
- BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
- }
+ gs_fixed_rect ibox;
+ gs_fixed_point expand;
+
+ if (gx_stroke_path_expansion(pis, ppath, &expand) == 0 &&
+ gx_path_bbox(ppath, &ibox) >= 0
+ ) {
+ /* The fast result is exact. */
+ adjust_box(&ibox, expand);
+ } else {
+ /*
+ * The result is not exact. Compute an exact result using
+ * strokepath.
+ */
+ gx_path *spath = gx_path_alloc(pis->memory, "bbox_stroke_path");
+ int code = 0;
+
+ if (spath)
+ code = gx_imager_stroke_add(ppath, spath, dev, pis);
+ else
+ code = -1;
+ if (code >= 0)
+ code = gx_path_bbox(spath, &ibox);
+ if (code < 0) {
+ ibox.p.x = ibox.p.y = min_fixed;
+ ibox.q.x = ibox.q.y = max_fixed;
+ }
+ if (spath)
+ gx_path_free(spath, "bbox_stroke_path");
+ }
+ if (pcpath != NULL &&
+ !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
+ ibox.q.x, ibox.q.y)
+ ) {
+ /* Let the target do the drawing, but break down the */
+ /* fill path into pieces for computing the bounding box. */
+ gx_drawing_color devc;
+
+ set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
+ bdev->target = NULL;
+ gx_default_stroke_path(dev, pis, ppath, params, &devc, pcpath);
+ bdev->target = tdev;
+ } else {
+ /* Just use the path bounding box. */
+ BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
+ }
}
return code;
}
static int
bbox_fill_mask(gx_device * dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
gx_device *tdev = bdev->target;
/* Skip the call if there is no target. */
int code =
- (tdev == 0 ? 0 :
- dev_proc(tdev, fill_mask)
- (tdev, data, dx, raster, id, x, y, w, h,
- pdcolor, depth, lop, pcpath));
+ (tdev == 0 ? 0 :
+ dev_proc(tdev, fill_mask)
+ (tdev, data, dx, raster, id, x, y, w, h,
+ pdcolor, depth, lop, pcpath));
if (pcpath != NULL &&
- !gx_cpath_includes_rectangle(pcpath, int2fixed(x), int2fixed(y),
- int2fixed(x + w),
- int2fixed(y + h))
- ) {
- /* Let the target do the drawing, but break down the */
- /* image into pieces for computing the bounding box. */
- bdev->target = NULL;
- gx_default_fill_mask(dev, data, dx, raster, id, x, y, w, h,
- pdcolor, depth, lop, pcpath);
- bdev->target = tdev;
+ !gx_cpath_includes_rectangle(pcpath, int2fixed(x), int2fixed(y),
+ int2fixed(x + w),
+ int2fixed(y + h))
+ ) {
+ /* Let the target do the drawing, but break down the */
+ /* image into pieces for computing the bounding box. */
+ bdev->target = NULL;
+ gx_default_fill_mask(dev, data, dx, raster, id, x, y, w, h,
+ pdcolor, depth, lop, pcpath);
+ bdev->target = tdev;
} else {
- /* Just use the mask bounding box. */
- BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
+ /* Just use the mask bounding box. */
+ BBOX_ADD_INT_RECT(bdev, x, y, x + w, y + h);
}
return code;
}
@@ -936,42 +936,42 @@ static const gx_image_enum_procs_t bbox_image_enum_procs = {
static int
bbox_image_begin(const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_clip_path * pcpath, gs_memory_t * memory,
- bbox_image_enum ** ppbe)
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_clip_path * pcpath, gs_memory_t * memory,
+ bbox_image_enum ** ppbe)
{
int code;
gs_matrix mat;
bbox_image_enum *pbe;
if (pmat == 0)
- pmat = &ctm_only(pis);
+ pmat = &ctm_only(pis);
if ((code = gs_matrix_invert(&pic->ImageMatrix, &mat)) < 0 ||
- (code = gs_matrix_multiply(&mat, pmat, &mat)) < 0
- )
- return code;
+ (code = gs_matrix_multiply(&mat, pmat, &mat)) < 0
+ )
+ return code;
pbe = gs_alloc_struct(memory, bbox_image_enum, &st_bbox_image_enum,
- "bbox_image_begin");
+ "bbox_image_begin");
if (pbe == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pbe->memory = memory;
pbe->matrix = mat;
pbe->pcpath = pcpath;
pbe->target_info = 0; /* in case no target */
pbe->params_are_const = false; /* check the first time */
if (prect) {
- pbe->x0 = prect->p.x, pbe->x1 = prect->q.x;
- pbe->y = prect->p.y, pbe->height = prect->q.y - prect->p.y;
+ pbe->x0 = prect->p.x, pbe->x1 = prect->q.x;
+ pbe->y = prect->p.y, pbe->height = prect->q.y - prect->p.y;
} else {
- gs_int_point size;
- int code = (*pic->type->source_size) (pis, pic, &size);
-
- if (code < 0) {
- gs_free_object(memory, pbe, "bbox_image_begin");
- return code;
- }
- pbe->x0 = 0, pbe->x1 = size.x;
- pbe->y = 0, pbe->height = size.y;
+ gs_int_point size;
+ int code = (*pic->type->source_size) (pis, pic, &size);
+
+ if (code < 0) {
+ gs_free_object(memory, pbe, "bbox_image_begin");
+ return code;
+ }
+ pbe->x0 = 0, pbe->x1 = size.x;
+ pbe->y = 0, pbe->height = size.y;
}
*ppbe = pbe;
return 0;
@@ -984,62 +984,62 @@ bbox_image_copy_target_info(bbox_image_enum * pbe)
pbe->num_planes = target_info->num_planes;
memcpy(pbe->plane_depths, target_info->plane_depths,
- pbe->num_planes * sizeof(pbe->plane_depths[0]));
+ pbe->num_planes * sizeof(pbe->plane_depths[0]));
memcpy(pbe->plane_widths, target_info->plane_widths,
- pbe->num_planes * sizeof(pbe->plane_widths[0]));
+ pbe->num_planes * sizeof(pbe->plane_widths[0]));
}
static int
bbox_begin_typed_image(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
bbox_image_enum *pbe;
int code =
- bbox_image_begin(pis, pmat, pic, prect, pcpath, memory, &pbe);
+ bbox_image_begin(pis, pmat, pic, prect, pcpath, memory, &pbe);
if (code < 0)
- return code;
+ return code;
/*
* If there is no target, we still have to call default_begin_image
* to get the correct num_planes and plane_depths.
*/
{
- gx_device_bbox *const bdev = (gx_device_bbox *) dev;
- gx_device *tdev = bdev->target;
- dev_proc_begin_typed_image((*begin_typed_image));
- byte wanted[GS_IMAGE_MAX_COMPONENTS];
-
- if (tdev == 0) {
- tdev = dev;
- begin_typed_image = gx_default_begin_typed_image;
- } else {
- begin_typed_image = dev_proc(tdev, begin_typed_image);
- }
- code = (*begin_typed_image)
- (tdev, pis, pmat, pic, prect, pdcolor, pcpath, memory,
- &pbe->target_info);
- if (code) {
- bbox_image_end_image((gx_image_enum_common_t *)pbe, false);
- return code;
- }
- /*
- * We fill in num_planes and plane_depths later. format is
- * irrelevant. NOTE: we assume that if begin_typed_image returned
- * 0, the image is a data image.
- */
- code = gx_image_enum_common_init((gx_image_enum_common_t *) pbe,
- (const gs_data_image_t *)pic,
- &bbox_image_enum_procs, dev,
- 0, gs_image_format_chunky);
- if (code < 0)
- return code;
- bbox_image_copy_target_info(pbe);
- pbe->params_are_const =
- gx_image_planes_wanted(pbe->target_info, wanted);
+ gx_device_bbox *const bdev = (gx_device_bbox *) dev;
+ gx_device *tdev = bdev->target;
+ dev_proc_begin_typed_image((*begin_typed_image));
+ byte wanted[GS_IMAGE_MAX_COMPONENTS];
+
+ if (tdev == 0) {
+ tdev = dev;
+ begin_typed_image = gx_default_begin_typed_image;
+ } else {
+ begin_typed_image = dev_proc(tdev, begin_typed_image);
+ }
+ code = (*begin_typed_image)
+ (tdev, pis, pmat, pic, prect, pdcolor, pcpath, memory,
+ &pbe->target_info);
+ if (code) {
+ bbox_image_end_image((gx_image_enum_common_t *)pbe, false);
+ return code;
+ }
+ /*
+ * We fill in num_planes and plane_depths later. format is
+ * irrelevant. NOTE: we assume that if begin_typed_image returned
+ * 0, the image is a data image.
+ */
+ code = gx_image_enum_common_init((gx_image_enum_common_t *) pbe,
+ (const gs_data_image_t *)pic,
+ &bbox_image_enum_procs, dev,
+ 0, gs_image_format_chunky);
+ if (code < 0)
+ return code;
+ bbox_image_copy_target_info(pbe);
+ pbe->params_are_const =
+ gx_image_planes_wanted(pbe->target_info, wanted);
}
*pinfo = (gx_image_enum_common_t *) pbe;
return 0;
@@ -1047,8 +1047,8 @@ bbox_begin_typed_image(gx_device * dev,
static int
bbox_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_device *dev = info->dev;
gx_device_bbox *const bdev = (gx_device_bbox *)dev;
@@ -1061,9 +1061,9 @@ bbox_image_plane_data(gx_image_enum_common_t * info,
int code;
code = gx_image_plane_data_rows(pbe->target_info, planes, height,
- rows_used);
+ rows_used);
if (code != 1 && !pbe->params_are_const)
- bbox_image_copy_target_info(pbe);
+ bbox_image_copy_target_info(pbe);
sbox.p.x = pbe->x0;
sbox.p.y = pbe->y;
sbox.q.x = pbe->x1;
@@ -1075,31 +1075,31 @@ bbox_image_plane_data(gx_image_enum_common_t * info,
ibox.q.x = float2fixed(dbox.q.x);
ibox.q.y = float2fixed(dbox.q.y);
if (pcpath != NULL &&
- !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
- ibox.q.x, ibox.q.y)
- ) {
- /* Let the target do the drawing, but drive two triangles */
- /* through the clipping path to get an accurate bounding box. */
- gx_device_clip cdev;
- gx_drawing_color devc;
- fixed x0 = float2fixed(corners[0].x), y0 = float2fixed(corners[0].y);
- fixed bx2 = float2fixed(corners[2].x) - x0, by2 = float2fixed(corners[2].y) - y0;
-
- gx_make_clip_device_on_stack(&cdev, pcpath, dev);
- set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
- bdev->target = NULL;
- gx_default_fill_triangle((gx_device *) & cdev, x0, y0,
- float2fixed(corners[1].x) - x0,
- float2fixed(corners[1].y) - y0,
- bx2, by2, &devc, lop_default);
- gx_default_fill_triangle((gx_device *) & cdev, x0, y0,
- float2fixed(corners[3].x) - x0,
- float2fixed(corners[3].y) - y0,
- bx2, by2, &devc, lop_default);
- bdev->target = tdev;
+ !gx_cpath_includes_rectangle(pcpath, ibox.p.x, ibox.p.y,
+ ibox.q.x, ibox.q.y)
+ ) {
+ /* Let the target do the drawing, but drive two triangles */
+ /* through the clipping path to get an accurate bounding box. */
+ gx_device_clip cdev;
+ gx_drawing_color devc;
+ fixed x0 = float2fixed(corners[0].x), y0 = float2fixed(corners[0].y);
+ fixed bx2 = float2fixed(corners[2].x) - x0, by2 = float2fixed(corners[2].y) - y0;
+
+ gx_make_clip_device_on_stack(&cdev, pcpath, dev);
+ set_nonclient_dev_color(&devc, bdev->black); /* any non-white color will do */
+ bdev->target = NULL;
+ gx_default_fill_triangle((gx_device *) & cdev, x0, y0,
+ float2fixed(corners[1].x) - x0,
+ float2fixed(corners[1].y) - y0,
+ bx2, by2, &devc, lop_default);
+ gx_default_fill_triangle((gx_device *) & cdev, x0, y0,
+ float2fixed(corners[3].x) - x0,
+ float2fixed(corners[3].y) - y0,
+ bx2, by2, &devc, lop_default);
+ bdev->target = tdev;
} else {
- /* Just use the bounding box. */
- BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
+ /* Just use the bounding box. */
+ BBOX_ADD_RECT(bdev, ibox.p.x, ibox.p.y, ibox.q.x, ibox.q.y);
}
return code;
}
@@ -1131,7 +1131,7 @@ bbox_image_planes_wanted(const gx_image_enum_common_t * info, byte *wanted)
{
/* This is only used if target_info != 0. */
const bbox_image_enum *pbe = (const bbox_image_enum *)info;
-
+
return gx_image_planes_wanted(pbe->target_info, wanted);
}
@@ -1172,8 +1172,8 @@ static const gx_device_bbox_procs_t box_procs_forward = {
static int
bbox_create_compositor(gx_device * dev,
- gx_device ** pcdev, const gs_composite_t * pcte,
- gs_imager_state * pis, gs_memory_t * memory, gx_device *cindev)
+ gx_device ** pcdev, const gs_composite_t * pcte,
+ gs_imager_state * pis, gs_memory_t * memory, gx_device *cindev)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
gx_device *target = bdev->target;
@@ -1183,8 +1183,8 @@ bbox_create_compositor(gx_device * dev,
* so don't bother with actually compositing.
*/
if (target == 0) {
- *pcdev = dev;
- return 0;
+ *pcdev = dev;
+ return 0;
}
/*
* Create a compositor for the target, and then wrap another
@@ -1192,29 +1192,29 @@ bbox_create_compositor(gx_device * dev,
* box in the same place.
*/
{
- gx_device *temp_cdev;
- gx_device_bbox *bbcdev;
- int code = (*dev_proc(target, create_compositor))
- (target, &temp_cdev, pcte, pis, memory, cindev);
-
- /* If the target did not create a new compositor then we are done. */
- if (code < 0 || target == temp_cdev) {
- *pcdev = dev;
- return code;
- }
- bbcdev = gs_alloc_struct_immovable(memory, gx_device_bbox,
- &st_device_bbox,
- "bbox_create_compositor");
- if (bbcdev == 0) {
- (*dev_proc(temp_cdev, close_device)) (temp_cdev);
- return_error(gs_error_VMerror);
- }
- gx_device_bbox_init(bbcdev, target, memory);
- gx_device_set_target((gx_device_forward *)bbcdev, temp_cdev);
- bbcdev->box_procs = box_procs_forward;
- bbcdev->box_proc_data = bdev;
- *pcdev = (gx_device *) bbcdev;
- return 0;
+ gx_device *temp_cdev;
+ gx_device_bbox *bbcdev;
+ int code = (*dev_proc(target, create_compositor))
+ (target, &temp_cdev, pcte, pis, memory, cindev);
+
+ /* If the target did not create a new compositor then we are done. */
+ if (code < 0 || target == temp_cdev) {
+ *pcdev = dev;
+ return code;
+ }
+ bbcdev = gs_alloc_struct_immovable(memory, gx_device_bbox,
+ &st_device_bbox,
+ "bbox_create_compositor");
+ if (bbcdev == 0) {
+ (*dev_proc(temp_cdev, close_device)) (temp_cdev);
+ return_error(gs_error_VMerror);
+ }
+ gx_device_bbox_init(bbcdev, target, memory);
+ gx_device_set_target((gx_device_forward *)bbcdev, temp_cdev);
+ bbcdev->box_procs = box_procs_forward;
+ bbcdev->box_proc_data = bdev;
+ *pcdev = (gx_device *) bbcdev;
+ return 0;
}
}
@@ -1222,14 +1222,14 @@ bbox_create_compositor(gx_device * dev,
static int
bbox_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gs_text_enum_t ** ppenum)
{
gx_device_bbox *const bdev = (gx_device_bbox *) dev;
int code = gx_default_text_begin(dev, pis, text, font, path, pdcolor,
- pcpath, memory, ppenum);
+ pcpath, memory, ppenum);
if (bdev->target != NULL) {
/* See note on imaging_dev in gxtext.h */
@@ -1249,6 +1249,6 @@ int bbox_fillpage(gx_device *dev, gs_imager_state * pis, gx_device_color *pdevc)
BBOX_INIT_BOX(bdev);
if (tdev == NULL)
- return 0;
+ return 0;
return dev_proc(tdev, fillpage)(tdev, pis, pdevc);
}
diff --git a/gs/base/gdevbbox.h b/gs/base/gdevbbox.h
index f73b0f995..7f49c3047 100644
--- a/gs/base/gdevbbox.h
+++ b/gs/base/gdevbbox.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -95,16 +95,16 @@ dev_bbox_proc_add_rect(bbox_default_add_rect);
dev_bbox_proc_in_rect(bbox_default_in_rect);
#define gx_device_bbox_common\
- gx_device_forward_common;\
- bool free_standing;\
- bool forward_open_close;\
- gx_device_bbox_procs_t box_procs;\
- void *box_proc_data;\
- bool white_is_opaque;\
- /* The following are updated dynamically. */\
- gs_fixed_rect bbox;\
- gx_color_index black, white;\
- gx_color_index transparent /* white or gx_no_color_index */
+ gx_device_forward_common;\
+ bool free_standing;\
+ bool forward_open_close;\
+ gx_device_bbox_procs_t box_procs;\
+ void *box_proc_data;\
+ bool white_is_opaque;\
+ /* The following are updated dynamically. */\
+ gs_fixed_rect bbox;\
+ gx_color_index black, white;\
+ gx_color_index transparent /* white or gx_no_color_index */
typedef struct gx_device_bbox_s gx_device_bbox;
#define gx_device_bbox_common_initial(fs, foc, wio)\
0 /* target */,\
@@ -125,11 +125,11 @@ void gx_device_bbox_init(gx_device_bbox * dev, gx_device * target, gs_memory_t *
/* Set whether a bounding box device propagates open/close to its target. */
void gx_device_bbox_fwd_open_close(gx_device_bbox * dev,
- bool forward_open_close);
+ bool forward_open_close);
/* Set whether a bounding box device considers white to be opaque. */
void gx_device_bbox_set_white_opaque(gx_device_bbox *dev,
- bool white_is_opaque);
+ bool white_is_opaque);
/* Read back the bounding box in 1/72" units. */
void gx_device_bbox_bbox(gx_device_bbox * dev, gs_rect * pbbox);
diff --git a/gs/base/gdevbit.c b/gs/base/gdevbit.c
index 71e9bb554..4d6e4f949 100644
--- a/gs/base/gdevbit.c
+++ b/gs/base/gdevbit.c
@@ -23,7 +23,6 @@
#include "gdevdcrd.h"
#include "gsutil.h" /* for bittags hack */
-
/* Define the device parameters. */
#ifndef X_DPI
# define X_DPI 72
@@ -51,58 +50,58 @@ static dev_proc_put_image(bit_put_image);
#define bit_procs(encode_color)\
{ gdev_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page,\
- gdev_prn_close,\
- encode_color, /* map_rgb_color */\
- bit_map_color_rgb, /* map_color_rgb */\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- bit_get_params,\
- bit_put_params,\
- encode_color, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- NULL, /* get_color_mapping_procs */\
- NULL, /* get_color_comp_index */\
- encode_color, /* encode_color */\
- bit_map_color_rgb /* decode_color */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ encode_color, /* map_rgb_color */\
+ bit_map_color_rgb, /* map_color_rgb */\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ bit_get_params,\
+ bit_put_params,\
+ encode_color, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ NULL, /* get_color_mapping_procs */\
+ NULL, /* get_color_comp_index */\
+ encode_color, /* encode_color */\
+ bit_map_color_rgb /* decode_color */\
}
/*
@@ -114,7 +113,7 @@ static dev_proc_put_image(bit_put_image);
* parameter, which alters dev->num_components.
*/
#define REAL_NUM_COMPONENTS(dev) (dev->dname[3] == 'c' ? 4 : \
- dev->dname[3] == 'r' ? 3 : 1)
+ dev->dname[3] == 'r' ? 3 : 1)
struct gx_device_bit_s {
gx_device_common;
gx_prn_device_common;
@@ -126,34 +125,34 @@ static const gx_device_procs bitmono_procs =
bit_procs(bit_mono_map_color);
const gx_device_bit gs_bit_device =
{prn_device_body(gx_device_bit, bitmono_procs, "bit",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, 1, 1, 0, 2, 1, bit_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, 1, 1, 0, 2, 1, bit_print_page)
};
static const gx_device_procs bitrgb_procs =
bit_procs(gx_default_rgb_map_rgb_color);
const gx_device_bit gs_bitrgb_device =
{prn_device_body(gx_device_bit, bitrgb_procs, "bitrgb",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 4, 1, 1, 2, 2, bit_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 4, 1, 1, 2, 2, bit_print_page)
};
static const gx_device_procs bitcmyk_procs =
bit_procs(bit_map_cmyk_color);
const gx_device_bit gs_bitcmyk_device =
{prn_device_body(gx_device_bit, bitcmyk_procs, "bitcmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 4, 4, 1, 1, 2, 2, bit_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 4, 4, 1, 1, 2, 2, bit_print_page)
};
static const gx_device_procs bitrgbtags_procs =
- {
+ {
gdev_prn_open, /* open_device */
gx_default_get_initial_matrix, /* initial_matrix */
((void *)0), /* sync_output */
@@ -207,18 +206,18 @@ static const gx_device_procs bitrgbtags_procs =
((void *)0), /* get_color_comp_index */
bittag_rgb_map_rgb_color, /* encode_color */
bittag_map_color_rgb, /* decode_color */
- ((void *)0), /* pattern_manage */
- ((void *)0), /* fill_rectangle_hl_color */
- ((void *)0), /* include_color_space */
- ((void *)0), /* fill_linear_color_scanline */
- ((void *)0), /* fill_linear_color_trapezoid */
- ((void *)0), /* fill_linear_color_triangle */
- ((void *)0), /* update_spot_equivalent_colors */
- ((void *)0), /* ret_devn_params */
- ((void *)0), /* fillpage */
- ((void *)0), /* push_transparency_state */
- ((void *)0), /* pop_transparency_state */
- bit_put_image /* put_image */
+ ((void *)0), /* pattern_manage */
+ ((void *)0), /* fill_rectangle_hl_color */
+ ((void *)0), /* include_color_space */
+ ((void *)0), /* fill_linear_color_scanline */
+ ((void *)0), /* fill_linear_color_trapezoid */
+ ((void *)0), /* fill_linear_color_triangle */
+ ((void *)0), /* update_spot_equivalent_colors */
+ ((void *)0), /* ret_devn_params */
+ ((void *)0), /* fillpage */
+ ((void *)0), /* push_transparency_state */
+ ((void *)0), /* pop_transparency_state */
+ bit_put_image /* put_image */
};
const gx_device_bit gs_bitrgbtags_device =
@@ -238,7 +237,7 @@ const gx_device_bit gs_bitrgbtags_device =
3, /* max_components */
3, /* num_components */
GX_CINFO_POLARITY_ADDITIVE, /* polarity */
- 32, /* depth */
+ 32, /* depth */
GX_CINFO_COMP_NO_INDEX, /* gray index */
255 , /* max_gray */
255 , /* max_colors */
@@ -246,28 +245,28 @@ const gx_device_bit gs_bitrgbtags_device =
256 , /* dither colors */
{ 1, 1 } , /* antialiasing */
GX_CINFO_UNKNOWN_SEP_LIN, /* sep and linear */
- { 16, 8, 0, 0 } , /* comp shift */
- { 8, 8, 8, 8 } , /* comp bits */
- { 0xFF0000, 0x00FF00, 0x0000FF } , /* comp mask */
+ { 16, 8, 0, 0 } , /* comp shift */
+ { 8, 8, 8, 8 } , /* comp bits */
+ { 0xFF0000, 0x00FF00, 0x0000FF } , /* comp mask */
( "DeviceRGBT" ), /* color model name */
GX_CINFO_OPMODE_UNKNOWN , /* overprint mode */
0 /* process comps */
},
- {
+ {
((gx_color_index)(~0)),
- ((gx_color_index)(~0))
+ ((gx_color_index)(~0))
},
(int)((float)(85) * (X_DPI) / 10 + 0.5),
(int)((float)(110) * (Y_DPI) / 10 + 0.5),
0,
- {
+ {
(float)(((((int)((float)(85) * (X_DPI) / 10 + 0.5)) * 72.0 + 0.5) - 0.5) / (X_DPI)) ,
(float)(((((int)((float)(110) * (Y_DPI) / 10 + 0.5)) * 72.0 + 0.5) - 0.5) / (Y_DPI)) },
{
0,
0,
0,
- 0
+ 0
} ,
0 ,
{ X_DPI, Y_DPI } ,
@@ -285,12 +284,12 @@ const gx_device_bit gs_bitrgbtags_device =
0 ,
0 ,
0 ,
- 0,
- 0,
- {false},
- 0,
- 0,
- {
+ 0,
+ 0,
+ {false},
+ 0,
+ 0,
+ {
gx_default_install,
gx_default_begin_page,
gx_default_end_page
@@ -308,7 +307,7 @@ const gx_device_bit gs_bitrgbtags_device =
gx_default_open_render_device,
gx_default_close_render_device,
gx_default_buffer_page },
- {
+ {
PRN_MAX_BITMAP,
PRN_BUFFER_SPACE,
{ 0, 0, 0 },
@@ -341,7 +340,7 @@ cmyk_cs_to_rgb_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
static void
private_rgb_cs_to_rgb_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
out[0] = r;
out[1] = g;
@@ -354,7 +353,6 @@ gray_cs_to_rgb_cm(gx_device * dev, frac gray, frac out[])
out[0] = out[1] = out[2] = gray;
}
-
static const gx_cm_color_map_procs bittag_DeviceRGB_procs = {
gray_cs_to_rgb_cm, private_rgb_cs_to_rgb_cm, cmyk_cs_to_rgb_cm
};
@@ -420,11 +418,11 @@ bit_forcemono_map_rgb_color(gx_device * dev, const gx_color_value cv[])
red = cv[0]; green = cv[1]; blue = cv[2];
gray = red;
if ((red != green) || (green != blue))
- gray = (red * (unsigned long)lum_red_weight +
- green * (unsigned long)lum_green_weight +
- blue * (unsigned long)lum_blue_weight +
- (lum_all_weights / 2))
- / lum_all_weights;
+ gray = (red * (unsigned long)lum_red_weight +
+ green * (unsigned long)lum_green_weight +
+ blue * (unsigned long)lum_blue_weight +
+ (lum_all_weights / 2))
+ / lum_all_weights;
color = (gx_max_color_value - gray) >> drop; /* color is in K channel */
return color;
@@ -444,39 +442,39 @@ bit_map_color_rgb(gx_device * dev, gx_color_index color, gx_color_value cv[4])
#define cvalue(c) ((gx_color_value)((ulong)(c) * gx_max_color_value / mask))
switch (ncomp) {
- case 1: /* gray */
- cv[0] = cv[1] = cv[2] =
- (depth == 1 ? (color ? 0 : gx_max_color_value) :
- cvalue(color));
- break;
- case 3: /* RGB */
- {
- gx_color_index cshift = color;
-
- cv[2] = cvalue(cshift & mask);
- cshift >>= bpc;
- cv[1] = cvalue(cshift & mask);
- cv[0] = cvalue(cshift >> bpc);
- }
- break;
- case 4: /* CMYK */
- /* Map CMYK back to RGB. */
- {
- gx_color_index cshift = color;
- uint c, m, y, k;
-
- k = cshift & mask;
- cshift >>= bpc;
- y = cshift & mask;
- cshift >>= bpc;
- m = cshift & mask;
- c = cshift >> bpc;
- /* We use our improved conversion rule.... */
- cv[0] = cvalue((mask - c) * (mask - k) / mask);
- cv[1] = cvalue((mask - m) * (mask - k) / mask);
- cv[2] = cvalue((mask - y) * (mask - k) / mask);
- }
- break;
+ case 1: /* gray */
+ cv[0] = cv[1] = cv[2] =
+ (depth == 1 ? (color ? 0 : gx_max_color_value) :
+ cvalue(color));
+ break;
+ case 3: /* RGB */
+ {
+ gx_color_index cshift = color;
+
+ cv[2] = cvalue(cshift & mask);
+ cshift >>= bpc;
+ cv[1] = cvalue(cshift & mask);
+ cv[0] = cvalue(cshift >> bpc);
+ }
+ break;
+ case 4: /* CMYK */
+ /* Map CMYK back to RGB. */
+ {
+ gx_color_index cshift = color;
+ uint c, m, y, k;
+
+ k = cshift & mask;
+ cshift >>= bpc;
+ y = cshift & mask;
+ cshift >>= bpc;
+ m = cshift & mask;
+ c = cshift >> bpc;
+ /* We use our improved conversion rule.... */
+ cv[0] = cvalue((mask - c) * (mask - k) / mask);
+ cv[1] = cvalue((mask - m) * (mask - k) / mask);
+ cv[2] = cvalue((mask - y) * (mask - k) / mask);
+ }
+ break;
}
return 0;
#undef cvalue
@@ -490,7 +488,7 @@ bit_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
int drop = sizeof(gx_color_value) * 8 - bpc;
gx_color_index color =
(((((((gx_color_index) cv[0] >> drop) << bpc) +
- (cv[1] >> drop)) << bpc) +
+ (cv[1] >> drop)) << bpc) +
(cv[2] >> drop)) << bpc) +
(cv[3] >> drop);
@@ -525,15 +523,15 @@ bit_get_params(gx_device * pdev, gs_param_list * plist)
ecode = gdev_prn_get_params(pdev, plist);
code = sample_device_crd_get_params(pdev, plist, "CRDDefault");
if (code < 0)
- ecode = code;
+ ecode = code;
if ((code = param_write_int(plist, "ForceMono", &forcemono)) < 0) {
- ecode = code;
+ ecode = code;
}
if ((code = param_write_int(plist, "FirstLine", &((gx_device_bit *)pdev)->FirstLine)) < 0) {
- ecode = code;
+ ecode = code;
}
if ((code = param_write_int(plist, "LastLine", &((gx_device_bit *)pdev)->LastLine)) < 0) {
- ecode = code;
+ ecode = code;
}
/* Restore the working num_components */
@@ -555,10 +553,10 @@ bit_put_params(gx_device * pdev, gs_param_list * plist)
int ecode = 0;
int code;
static const byte depths[4][16] = {
- {1, 2, 0, 4, 8, 0, 0, 8, 0, 0, 0, 16, 0, 0, 0, 16},
- {0},
- {4, 8, 0, 16, 16, 0, 0, 24, 0, 0, 0, 40, 0, 0, 0, 48},
- {4, 8, 0, 16, 32, 0, 0, 32, 0, 0, 0, 48, 0, 0, 0, 64}
+ {1, 2, 0, 4, 8, 0, 0, 8, 0, 0, 0, 16, 0, 0, 0, 16},
+ {0},
+ {4, 8, 0, 16, 16, 0, 0, 24, 0, 0, 0, 40, 0, 0, 0, 48},
+ {4, 8, 0, 16, 32, 0, 0, 32, 0, 0, 0, 48, 0, 0, 0, 64}
};
const char *vname;
int FirstLine = ((gx_device_bit *)pdev)->FirstLine;
@@ -571,71 +569,71 @@ bit_put_params(gx_device * pdev, gs_param_list * plist)
pdev->color_info.num_components = real_ncomps;
if ((code = param_read_int(plist, (vname = "GrayValues"), &v)) != 1 ||
- (code = param_read_int(plist, (vname = "RedValues"), &v)) != 1 ||
- (code = param_read_int(plist, (vname = "GreenValues"), &v)) != 1 ||
- (code = param_read_int(plist, (vname = "BlueValues"), &v)) != 1
- ) {
- if (code < 0)
- ecode = code;
- else
- switch (v) {
- case 2: bpc = 1; break;
- case 4: bpc = 2; break;
- case 16: bpc = 4; break;
- case 32: bpc = 5; break;
- case 256: bpc = 8; break;
- case 4096: bpc = 12; break;
- case 65536: bpc = 16; break;
- default:
- param_signal_error(plist, vname,
- ecode = gs_error_rangecheck);
- }
+ (code = param_read_int(plist, (vname = "RedValues"), &v)) != 1 ||
+ (code = param_read_int(plist, (vname = "GreenValues"), &v)) != 1 ||
+ (code = param_read_int(plist, (vname = "BlueValues"), &v)) != 1
+ ) {
+ if (code < 0)
+ ecode = code;
+ else
+ switch (v) {
+ case 2: bpc = 1; break;
+ case 4: bpc = 2; break;
+ case 16: bpc = 4; break;
+ case 32: bpc = 5; break;
+ case 256: bpc = 8; break;
+ case 4096: bpc = 12; break;
+ case 65536: bpc = 16; break;
+ default:
+ param_signal_error(plist, vname,
+ ecode = gs_error_rangecheck);
+ }
}
switch (code = param_read_int(plist, (vname = "ForceMono"), &v)) {
case 0:
- if (v == 1) {
- ncomps = 1;
- break;
- }
- else if (v == 0) {
- ncomps = real_ncomps;
- break;
- }
- code = gs_error_rangecheck;
+ if (v == 1) {
+ ncomps = 1;
+ break;
+ }
+ else if (v == 0) {
+ ncomps = real_ncomps;
+ break;
+ }
+ code = gs_error_rangecheck;
default:
- ecode = code;
- param_signal_error(plist, vname, ecode);
+ ecode = code;
+ param_signal_error(plist, vname, ecode);
case 1:
- break;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
switch (code = param_read_int(plist, (vname = "FirstLine"), &v)) {
case 0:
FirstLine = v;
- break;
+ break;
default:
- ecode = code;
- param_signal_error(plist, vname, ecode);
+ ecode = code;
+ param_signal_error(plist, vname, ecode);
case 1:
- break;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
switch (code = param_read_int(plist, (vname = "LastLine"), &v)) {
case 0:
LastLine = v;
- break;
+ break;
default:
- ecode = code;
- param_signal_error(plist, vname, ecode);
+ ecode = code;
+ param_signal_error(plist, vname, ecode);
case 1:
- break;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
/*
* Save the color_info in case gdev_prn_put_params fails, and for
@@ -644,30 +642,30 @@ bit_put_params(gx_device * pdev, gs_param_list * plist)
save_info = pdev->color_info;
pdev->color_info.depth = depths[real_ncomps - 1][bpc - 1];
pdev->color_info.max_gray = pdev->color_info.max_color =
- (pdev->color_info.dither_grays =
- pdev->color_info.dither_colors =
- (1 << bpc)) - 1;
+ (pdev->color_info.dither_grays =
+ pdev->color_info.dither_colors =
+ (1 << bpc)) - 1;
ecode = gdev_prn_put_params(pdev, plist);
if (ecode < 0) {
- pdev->color_info = save_info;
- return ecode;
+ pdev->color_info = save_info;
+ return ecode;
}
/* Now restore/change num_components. This is done after other */
/* processing since it is used in gx_default_put_params */
pdev->color_info.num_components = ncomps;
if (pdev->color_info.depth != save_info.depth ||
- pdev->color_info.num_components != save_info.num_components
- ) {
- gs_closedevice(pdev);
+ pdev->color_info.num_components != save_info.num_components
+ ) {
+ gs_closedevice(pdev);
}
/* Reset the map_cmyk_color procedure if appropriate. */
if (dev_proc(pdev, map_cmyk_color) == cmyk_1bit_map_cmyk_color ||
- dev_proc(pdev, map_cmyk_color) == cmyk_8bit_map_cmyk_color ||
- dev_proc(pdev, map_cmyk_color) == bit_map_cmyk_color) {
- set_dev_proc(pdev, map_cmyk_color,
- pdev->color_info.depth == 4 ? cmyk_1bit_map_cmyk_color :
- pdev->color_info.depth == 32 ? cmyk_8bit_map_cmyk_color :
- bit_map_cmyk_color);
+ dev_proc(pdev, map_cmyk_color) == cmyk_8bit_map_cmyk_color ||
+ dev_proc(pdev, map_cmyk_color) == bit_map_cmyk_color) {
+ set_dev_proc(pdev, map_cmyk_color,
+ pdev->color_info.depth == 4 ? cmyk_1bit_map_cmyk_color :
+ pdev->color_info.depth == 32 ? cmyk_8bit_map_cmyk_color :
+ bit_map_cmyk_color);
}
/* Reset the separable and linear shift, masks, bits. */
set_linear_color_bits_mask_shift(pdev);
@@ -688,20 +686,20 @@ bit_print_page(gx_device_printer * pdev, FILE * prn_stream)
byte *data;
int nul = !strcmp(pdev->fname, "nul") || !strcmp(pdev->fname, "/dev/null");
int lnum = ((gx_device_bit *)pdev)->FirstLine >= pdev->height ? pdev->height - 1 :
- ((gx_device_bit *)pdev)->FirstLine;
+ ((gx_device_bit *)pdev)->FirstLine;
int bottom = ((gx_device_bit *)pdev)->LastLine >= pdev->height ? pdev->height - 1 :
- ((gx_device_bit *)pdev)->LastLine;
+ ((gx_device_bit *)pdev)->LastLine;
int line_count = any_abs(bottom - lnum);
int i, step = lnum > bottom ? -1 : 1;
if (in == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if ((lnum == 0) && (bottom == 0))
- line_count = pdev->height - 1; /* default when LastLine == 0, FirstLine == 0 */
+ line_count = pdev->height - 1; /* default when LastLine == 0, FirstLine == 0 */
for (i = 0; i <= line_count; i++, lnum += step) {
- gdev_prn_get_bits(pdev, lnum, in, &data);
- if (!nul)
- fwrite(data, 1, line_size, prn_stream);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
+ if (!nul)
+ fwrite(data, 1, line_size, prn_stream);
}
gs_free_object(pdev->memory, in, "bit_print_page(in)");
return 0;
@@ -719,30 +717,30 @@ bittags_print_page(gx_device_printer * pdev, FILE * prn_stream)
byte *data;
int nul = !strcmp(pdev->fname, "nul") || !strcmp(pdev->fname, "/dev/null");
int lnum = ((gx_device_bit *)pdev)->FirstLine >= pdev->height ? pdev->height - 1 :
- ((gx_device_bit *)pdev)->FirstLine;
+ ((gx_device_bit *)pdev)->FirstLine;
int bottom = ((gx_device_bit *)pdev)->LastLine >= pdev->height ? pdev->height - 1 :
- ((gx_device_bit *)pdev)->LastLine;
+ ((gx_device_bit *)pdev)->LastLine;
int line_count = any_abs(bottom - lnum);
int i, step = lnum > bottom ? -1 : 1;
if (in == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
fprintf(prn_stream, "P6\n%d %d\n255\n", pdev->width, pdev->height);
if ((lnum == 0) && (bottom == 0))
- line_count = pdev->height - 1; /* default when LastLine == 0, FirstLine == 0 */
+ line_count = pdev->height - 1; /* default when LastLine == 0, FirstLine == 0 */
for (i = 0; i <= line_count; i++, lnum += step) {
- gdev_prn_get_bits(pdev, lnum, in, &data);
- if (!nul)
- fwrite(data, 1, line_size, prn_stream);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
+ if (!nul)
+ fwrite(data, 1, line_size, prn_stream);
}
gs_free_object(pdev->memory, in, "bit_print_page(in)");
return 0;
}
static int
-bit_put_image(gx_device *pdev, const byte *buffer, int num_chan, int xstart,
- int ystart, int width, int height, int row_stride,
+bit_put_image(gx_device *pdev, const byte *buffer, int num_chan, int xstart,
+ int ystart, int width, int height, int row_stride,
int plane_stride, int alpha_plane_index, int tag_plane_index)
{
gx_device_memory *pmemdev = (gx_device_memory *)pdev;
@@ -768,11 +766,11 @@ bit_put_image(gx_device *pdev, const byte *buffer, int num_chan, int xstart,
des_position = y * pmemdev->raster + xstart * 4;
for ( x = xstart; x < xend; x++ ) {
/* Tag data first, then RGB */
- buffer_prn[des_position] =
+ buffer_prn[des_position] =
buffer[src_position + tag_plane_index * plane_stride];
des_position += 1;
for ( k = 0; k < 3; k++) {
- buffer_prn[des_position] =
+ buffer_prn[des_position] =
buffer[src_position + k * plane_stride];
des_position += 1;
}
diff --git a/gs/base/gdevbj10.c b/gs/base/gdevbj10.c
index 22d501a1e..4c6e2f367 100644
--- a/gs/base/gdevbj10.c
+++ b/gs/base/gdevbj10.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@
* for A4 paper, both are 3.4mm (0.13").
*
* The bottom margin requires a bit of care. The image is printed
- * as strips, each about 3.4mm wide. We can only attain the bottom
+ * as strips, each about 3.4mm wide. We can only attain the bottom
* margin if the final strip coincides with it. Note that each strip
* is generated using only 48 of the available 64 jets, and the absence
* of those bottom 16 jets makes our bottom margin, in effect, about
@@ -109,12 +109,12 @@ static gx_device_procs prn_bj200_procs =
const gx_device_printer far_data gs_bj200_device =
prn_device(prn_bj200_procs, "bj200",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0, 0, 0, 0, /* margins filled in by bj200_open */
- 1, bj10e_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0, 0, 0, 0, /* margins filled in by bj200_open */
+ 1, bj10e_print_page);
/*
* (<simon@pogner.demon.co.uk>, aka <sjwright@cix.compulink.co.uk>):
@@ -144,12 +144,12 @@ static gx_device_procs prn_bj10e_procs =
const gx_device_printer far_data gs_bj10e_device =
prn_device(prn_bj10e_procs, "bj10e",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0,0,0,0, /* margins */
- 1, bj10e_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, bj10e_print_page);
/*
* Notes on the BJ10e/BJ200 command set.
@@ -160,7 +160,7 @@ K) has 2 bytes which can override the DIP switches -- these are the last 2
bytes. Several bits are listed as "reserved" -- one or more may possibly
affect the sheet feeder. The first is referred to as <P1>, with the
following meaning:
- 1 0
+ 1 0
bit 7 ignore/process P1 ignore process
bit 6 reserved
bit 5 alarm disabled enabled
@@ -171,7 +171,7 @@ bit 1 style for zero slashed not slashed
bit 0 character set set 2 set 1
The last byte is <P2>, with the following meaning:
- 1 0
+ 1 0
bit 7 ignore/process P2 ignore process
bit 6 code page 850 437
bit 5 reserved
@@ -187,8 +187,8 @@ length). The sequence ESC 5 <n> controls automatic CR -- if <n> is 0x00,
it is turned off (CR only) and if <n> is 0x01, it is turned on (CR + LF).
So we do following: Change the initialization string to so that the last 2
of the 9 bytes are \200 rather than \000. Then add
- |* Turn off automatic carriage return, otherwise we get line feeds. *|
- fwrite("\0335\000", 1, 3, prn_stream);
+ |* Turn off automatic carriage return, otherwise we get line feeds. *|
+ fwrite("\0335\000", 1, 3, prn_stream);
after the initialization. (Actually, instead of setting the last 2 bytes
to \200, we suppress them altogether by changing the byte count from \004
to \002 (the byte count is the 4th (low 8 bits) and 5th (high 8 bits) bytes
@@ -202,245 +202,245 @@ in the initialization sequence).)
static int
bj200_open(gx_device *pdev)
{
- /* Change the margins according to the paper size.
- The top and bottom margins don't seem to depend on the
- page length, but on the paper handling mechanism;
- The side margins do depend on the paper width, as the
- printer centres the 8" print line on the page. */
-
- static const float a4_margins[4] =
- { (float)BJ200_A4_SIDE_MARGIN, (float)BJ200_BOTTOM_MARGIN,
- (float)BJ200_A4_SIDE_MARGIN, (float)BJ200_TOP_MARGIN
- };
- static const float letter_margins[4] =
- { (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ200_BOTTOM_MARGIN,
- (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ200_TOP_MARGIN
- };
-
- gx_device_set_margins(pdev,
- (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
- a4_margins : letter_margins),
- true);
- return gdev_prn_open(pdev);
+ /* Change the margins according to the paper size.
+ The top and bottom margins don't seem to depend on the
+ page length, but on the paper handling mechanism;
+ The side margins do depend on the paper width, as the
+ printer centres the 8" print line on the page. */
+
+ static const float a4_margins[4] =
+ { (float)BJ200_A4_SIDE_MARGIN, (float)BJ200_BOTTOM_MARGIN,
+ (float)BJ200_A4_SIDE_MARGIN, (float)BJ200_TOP_MARGIN
+ };
+ static const float letter_margins[4] =
+ { (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ200_BOTTOM_MARGIN,
+ (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ200_TOP_MARGIN
+ };
+
+ gx_device_set_margins(pdev,
+ (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
+ a4_margins : letter_margins),
+ true);
+ return gdev_prn_open(pdev);
}
static int
bj10e_open(gx_device *pdev)
{
/* See bj200_open() */
- static const float a4_margins[4] =
- { (float)BJ200_A4_SIDE_MARGIN, (float)BJ10E_BOTTOM_MARGIN,
- (float)BJ200_A4_SIDE_MARGIN, (float)BJ10E_TOP_MARGIN
- };
- static const float letter_margins[4] =
- { (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ10E_BOTTOM_MARGIN,
- (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ10E_TOP_MARGIN
- };
-
- gx_device_set_margins(pdev,
- (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
- a4_margins : letter_margins),
- true);
- return gdev_prn_open(pdev);
+ static const float a4_margins[4] =
+ { (float)BJ200_A4_SIDE_MARGIN, (float)BJ10E_BOTTOM_MARGIN,
+ (float)BJ200_A4_SIDE_MARGIN, (float)BJ10E_TOP_MARGIN
+ };
+ static const float letter_margins[4] =
+ { (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ10E_BOTTOM_MARGIN,
+ (float)BJ200_LETTER_SIDE_MARGIN, (float)BJ10E_TOP_MARGIN
+ };
+
+ gx_device_set_margins(pdev,
+ (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
+ a4_margins : letter_margins),
+ true);
+ return gdev_prn_open(pdev);
}
/* Send the page to the printer. */
static int
bj10e_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size = gx_device_raster((gx_device *)pdev, 0);
- int xres = (int)pdev->x_pixels_per_inch;
- int yres = (int)pdev->y_pixels_per_inch;
- int mode = (yres == 180 ?
- (xres == 180 ? 11 : 12) :
- (xres == 180 ? 14 : 16));
- int bytes_per_column = (yres == 180) ? 3 : 6;
- int bits_per_column = bytes_per_column * 8;
- int skip_unit = bytes_per_column * 3;
- byte *in = (byte *)gs_malloc(pdev->memory, 8, line_size, "bj10e_print_page(in)");
- byte *out = (byte *)gs_malloc(pdev->memory, bits_per_column, line_size, "bj10e_print_page(out)");
- int lnum = 0;
- int skip = 0;
- int code = 0;
- int last_row = dev_print_scan_lines(pdev);
- int limit = last_row - bits_per_column;
-
- if ( in == 0 || out == 0 )
- { code = gs_note_error(gs_error_VMerror);
- goto fin;
- }
-
- /* Initialize the printer. */
+ int xres = (int)pdev->x_pixels_per_inch;
+ int yres = (int)pdev->y_pixels_per_inch;
+ int mode = (yres == 180 ?
+ (xres == 180 ? 11 : 12) :
+ (xres == 180 ? 14 : 16));
+ int bytes_per_column = (yres == 180) ? 3 : 6;
+ int bits_per_column = bytes_per_column * 8;
+ int skip_unit = bytes_per_column * 3;
+ byte *in = (byte *)gs_malloc(pdev->memory, 8, line_size, "bj10e_print_page(in)");
+ byte *out = (byte *)gs_malloc(pdev->memory, bits_per_column, line_size, "bj10e_print_page(out)");
+ int lnum = 0;
+ int skip = 0;
+ int code = 0;
+ int last_row = dev_print_scan_lines(pdev);
+ int limit = last_row - bits_per_column;
+
+ if ( in == 0 || out == 0 )
+ { code = gs_note_error(gs_error_VMerror);
+ goto fin;
+ }
+
+ /* Initialize the printer. */
#ifdef USE_FACTORY_DEFAULTS
- /* Check for U.S. letter vs. A4 paper. */
- fwrite(( pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
- "\033[K\002\000\000\044" /*A4--DIP switch defaults*/ :
- "\033[K\002\000\004\044" /*letter--factory defaults*/ ),
- 1, 7, prn_stream);
+ /* Check for U.S. letter vs. A4 paper. */
+ fwrite(( pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
+ "\033[K\002\000\000\044" /*A4--DIP switch defaults*/ :
+ "\033[K\002\000\004\044" /*letter--factory defaults*/ ),
+ 1, 7, prn_stream);
#else
- fwrite("\033[K\002\000\000\044", 1, 7, prn_stream);
+ fwrite("\033[K\002\000\000\044", 1, 7, prn_stream);
#endif
- /* Turn off automatic carriage return, otherwise we get line feeds. */
- fwrite("\0335\000", 1, 3, prn_stream);
-
- /* Set vertical spacing. */
- fwrite("\033[\\\004\000\000\000", 1, 7, prn_stream);
- fputc(yres & 0xff, prn_stream);
- fputc(yres >> 8, prn_stream);
-
- /* Set the page length. This is the printable length, in inches. */
- fwrite("\033C\000", 1, 3, prn_stream);
- fputc((last_row + yres - 1)/yres, prn_stream);
-
- /* Transfer pixels to printer. The last row we can print is defined
- by "last_row". Only the bottom of the print head can print at the
- bottom margin, and so we align the final printing pass. The print
- head is kept from moving below "limit", which is exactly one pass
- above the bottom margin. Once it reaches this limit, we make our
- final printing pass of a full "bits_per_column" rows. */
- while ( lnum < last_row )
- {
- byte *in_data;
- byte *in_end = in + line_size;
- byte *out_beg = out;
- byte *out_end = out + bytes_per_column * pdev->width;
- byte *outl = out;
- int bnum;
-
- /* Copy 1 scan line and test for all zero. */
- code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if ( code < 0 ) goto xit;
- /* The mem... or str... functions should be faster than */
- /* the following code, but all systems seem to implement */
- /* them so badly that this code is faster. */
- { register const long *zip = (const long *)in_data;
- register int zcnt = line_size;
- register const byte *zipb;
- for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
- { if ( zip[0] | zip[1] | zip[2] | zip[3] )
- goto notz;
- }
- zipb = (const byte *)zip;
- while ( --zcnt >= 0 )
- {
- if ( *zipb++ )
- goto notz;
- }
- /* Line is all zero, skip */
- lnum++;
- skip++;
- continue;
+ /* Turn off automatic carriage return, otherwise we get line feeds. */
+ fwrite("\0335\000", 1, 3, prn_stream);
+
+ /* Set vertical spacing. */
+ fwrite("\033[\\\004\000\000\000", 1, 7, prn_stream);
+ fputc(yres & 0xff, prn_stream);
+ fputc(yres >> 8, prn_stream);
+
+ /* Set the page length. This is the printable length, in inches. */
+ fwrite("\033C\000", 1, 3, prn_stream);
+ fputc((last_row + yres - 1)/yres, prn_stream);
+
+ /* Transfer pixels to printer. The last row we can print is defined
+ by "last_row". Only the bottom of the print head can print at the
+ bottom margin, and so we align the final printing pass. The print
+ head is kept from moving below "limit", which is exactly one pass
+ above the bottom margin. Once it reaches this limit, we make our
+ final printing pass of a full "bits_per_column" rows. */
+ while ( lnum < last_row )
+ {
+ byte *in_data;
+ byte *in_end = in + line_size;
+ byte *out_beg = out;
+ byte *out_end = out + bytes_per_column * pdev->width;
+ byte *outl = out;
+ int bnum;
+
+ /* Copy 1 scan line and test for all zero. */
+ code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( code < 0 ) goto xit;
+ /* The mem... or str... functions should be faster than */
+ /* the following code, but all systems seem to implement */
+ /* them so badly that this code is faster. */
+ { register const long *zip = (const long *)in_data;
+ register int zcnt = line_size;
+ register const byte *zipb;
+ for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
+ { if ( zip[0] | zip[1] | zip[2] | zip[3] )
+ goto notz;
+ }
+ zipb = (const byte *)zip;
+ while ( --zcnt >= 0 )
+ {
+ if ( *zipb++ )
+ goto notz;
+ }
+ /* Line is all zero, skip */
+ lnum++;
+ skip++;
+ continue;
notz: ;
- }
-
- /* Vertical tab to the appropriate position. Note here that
- we make sure we don't move below limit. */
- if ( lnum > limit )
- { skip -= (lnum - limit);
- lnum = limit;
- }
- while ( skip > 255 )
- { fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if ( skip )
- fprintf(prn_stream, "\033J%c", skip);
-
- /* If we've printed as far as "limit", then reset "limit"
- to "last_row" for the final printing pass. */
- if ( lnum == limit )
- limit = last_row;
- skip = 0;
-
- /* Transpose in blocks of 8 scan lines. */
- for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
- { int lcnt = min(8, limit - lnum);
- byte *inp = in;
- byte *outp = outl;
- lcnt = gdev_prn_copy_scan_lines(pdev,
- lnum, in, lcnt * line_size);
- if ( lcnt < 0 )
- { code = lcnt;
- goto xit;
- }
- if ( lcnt < 8 )
- memset(in + lcnt * line_size, 0,
- (8 - lcnt) * line_size);
- for ( ; inp < in_end; inp++, outp += bits_per_column )
- { gdev_prn_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- }
- outl++;
- lnum += lcnt;
- skip += lcnt;
- }
-
- /* Send the bits to the printer. We alternate horizontal
- skips with the data. The horizontal skips are in units
- of 1/120 inches, so we look at the data in groups of
- 3 columns, since 3/360 = 1/120, and 3/180 = 2/120. */
- outl = out;
- do
- { int count;
- int n;
- byte *out_ptr;
-
- /* First look for blank groups of columns. */
- while(outl < out_end)
- { n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while ( --count >= 0 )
- { if ( *out_ptr++ )
- break;
- }
- if ( count >= 0 )
- break;
- else
- outl = out_ptr;
- }
- if (outl >= out_end)
- break;
- if (outl > out_beg)
- { count = (outl - out_beg) / skip_unit;
- if ( xres == 180 ) count <<= 1;
- fprintf(prn_stream, "\033d%c%c",
- count & 0xff, count >> 8);
- }
-
- /* Next look for non-blank groups of columns. */
- out_beg = outl;
- outl += n;
- while(outl < out_end)
- { n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while ( --count >= 0 )
- { if ( *out_ptr++ )
- break;
- }
- if ( count < 0 )
- break;
- else
- outl += n;
- }
- count = outl - out_beg + 1;
- fprintf(prn_stream, "\033[g%c%c%c",
- count & 0xff, count >> 8, mode);
- fwrite(out_beg, 1, count - 1, prn_stream);
- out_beg = outl;
- outl += n;
- }
- while ( out_beg < out_end );
-
- fputc('\r', prn_stream);
- }
-
- /* Eject the page */
+ }
+
+ /* Vertical tab to the appropriate position. Note here that
+ we make sure we don't move below limit. */
+ if ( lnum > limit )
+ { skip -= (lnum - limit);
+ lnum = limit;
+ }
+ while ( skip > 255 )
+ { fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ fprintf(prn_stream, "\033J%c", skip);
+
+ /* If we've printed as far as "limit", then reset "limit"
+ to "last_row" for the final printing pass. */
+ if ( lnum == limit )
+ limit = last_row;
+ skip = 0;
+
+ /* Transpose in blocks of 8 scan lines. */
+ for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
+ { int lcnt = min(8, limit - lnum);
+ byte *inp = in;
+ byte *outp = outl;
+ lcnt = gdev_prn_copy_scan_lines(pdev,
+ lnum, in, lcnt * line_size);
+ if ( lcnt < 0 )
+ { code = lcnt;
+ goto xit;
+ }
+ if ( lcnt < 8 )
+ memset(in + lcnt * line_size, 0,
+ (8 - lcnt) * line_size);
+ for ( ; inp < in_end; inp++, outp += bits_per_column )
+ { gdev_prn_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ }
+ outl++;
+ lnum += lcnt;
+ skip += lcnt;
+ }
+
+ /* Send the bits to the printer. We alternate horizontal
+ skips with the data. The horizontal skips are in units
+ of 1/120 inches, so we look at the data in groups of
+ 3 columns, since 3/360 = 1/120, and 3/180 = 2/120. */
+ outl = out;
+ do
+ { int count;
+ int n;
+ byte *out_ptr;
+
+ /* First look for blank groups of columns. */
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count >= 0 )
+ break;
+ else
+ outl = out_ptr;
+ }
+ if (outl >= out_end)
+ break;
+ if (outl > out_beg)
+ { count = (outl - out_beg) / skip_unit;
+ if ( xres == 180 ) count <<= 1;
+ fprintf(prn_stream, "\033d%c%c",
+ count & 0xff, count >> 8);
+ }
+
+ /* Next look for non-blank groups of columns. */
+ out_beg = outl;
+ outl += n;
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count < 0 )
+ break;
+ else
+ outl += n;
+ }
+ count = outl - out_beg + 1;
+ fprintf(prn_stream, "\033[g%c%c%c",
+ count & 0xff, count >> 8, mode);
+ fwrite(out_beg, 1, count - 1, prn_stream);
+ out_beg = outl;
+ outl += n;
+ }
+ while ( out_beg < out_end );
+
+ fputc('\r', prn_stream);
+ }
+
+ /* Eject the page */
xit: fputc(014, prn_stream); /* form feed */
- fflush(prn_stream);
+ fflush(prn_stream);
fin: if ( out != 0 )
- gs_free(pdev->memory, (char *)out, bits_per_column, line_size,
- "bj10e_print_page(out)");
- if ( in != 0 )
- gs_free(pdev->memory, (char *)in, 8, line_size, "bj10e_print_page(in)");
- return code;
+ gs_free(pdev->memory, (char *)out, bits_per_column, line_size,
+ "bj10e_print_page(out)");
+ if ( in != 0 )
+ gs_free(pdev->memory, (char *)in, 8, line_size, "bj10e_print_page(in)");
+ return code;
}
diff --git a/gs/base/gdevbjc.h b/gs/base/gdevbjc.h
index d0bcc2afe..6eaf8a1f5 100644
--- a/gs/base/gdevbjc.h
+++ b/gs/base/gdevbjc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevbjcl.c b/gs/base/gdevbjcl.c
index 3b66ae497..83ef3d74a 100644
--- a/gs/base/gdevbjcl.c
+++ b/gs/base/gdevbjcl.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -105,14 +105,14 @@ bjc_put_print_method_short(stream *s, bjc_print_color_short_t color)
}
void
bjc_put_print_method(stream *s, bjc_print_color_t color,
- bjc_print_media_t media, bjc_print_quality_t quality,
- bjc_black_density_t density)
+ bjc_print_media_t media, bjc_print_quality_t quality,
+ bjc_black_density_t density)
{
bjc_put_command(s, 'c', 2 + (density != 0));
spputc(s, 0x10 | color);
spputc(s, (media << 4) | quality);
if (density)
- spputc(s, density << 4);
+ spputc(s, density << 4);
}
/* Set raster resolution (ESC ( d <count> <y_res> [<x_res>]) */
@@ -120,10 +120,10 @@ void
bjc_put_raster_resolution(stream *s, int x_resolution, int y_resolution)
{
if (x_resolution == y_resolution) {
- bjc_put_command(s, 'd', 2);
+ bjc_put_command(s, 'd', 2);
} else {
- bjc_put_command(s, 'd', 4);
- bjc_put_hi_lo(s, y_resolution);
+ bjc_put_command(s, 'd', 4);
+ bjc_put_hi_lo(s, y_resolution);
}
bjc_put_hi_lo(s, x_resolution);
}
@@ -152,7 +152,7 @@ bjc_put_page_margins(stream *s, int length, int lm, int rm, int top)
/* Set media supply method (ESC * l <count> <parm1> <parm2>) */
void
bjc_put_media_supply(stream *s, bjc_media_supply_t supply,
- bjc_media_type_t type)
+ bjc_media_type_t type)
{
bjc_put_command(s, 'l', 2);
spputc(s, 0x10 | supply);
@@ -162,7 +162,7 @@ bjc_put_media_supply(stream *s, bjc_media_supply_t supply,
/* Identify ink cartridge (ESC ( m <count> <type>) */
void
bjc_put_identify_cartridge(stream *s,
- bjc_identify_cartridge_command_t command)
+ bjc_identify_cartridge_command_t command)
{
bjc_put_command(s, 'm', 1);
spputc(s, command);
@@ -171,7 +171,7 @@ bjc_put_identify_cartridge(stream *s,
/* CMYK raster image (ESC ( A <count> <color>) */
void
bjc_put_cmyk_image(stream *s, bjc_cmyk_image_component_t component,
- const byte *data, int count)
+ const byte *data, int count)
{
bjc_put_command(s, 'A', count + 1);
spputc(s, component);
@@ -209,7 +209,7 @@ bjc_put_extended_margins(stream *s, int length, int lm, int rm, int top)
/* Set image format (ESC ( t <count> <depth> <format> <ink>) */
void
bjc_put_image_format(stream *s, int depth, bjc_image_format_t format,
- bjc_ink_system_t ink)
+ bjc_ink_system_t ink)
{
bjc_put_command(s, 't', 3);
diff --git a/gs/base/gdevbjcl.h b/gs/base/gdevbjcl.h
index 8661dc823..b6161970c 100644
--- a/gs/base/gdevbjcl.h
+++ b/gs/base/gdevbjcl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -238,9 +238,9 @@ typedef enum {
BJC_BLACK_DENSITY_HIGH = 0x1
} bjc_black_density_t;
void bjc_put_print_method(stream *s, bjc_print_color_t color,
- bjc_print_media_t media,
- bjc_print_quality_t quality,
- bjc_black_density_t density);
+ bjc_print_media_t media,
+ bjc_print_quality_t quality,
+ bjc_black_density_t density);
typedef enum {
/* 70, 4000, 4550, 4650 */
BJC_70_PRINT_COLOR_SHORT_FINE = 0x0, /* also 0x1, 0x2 */
@@ -300,7 +300,7 @@ typedef enum {
BJC_MEDIA_TYPE_BANNER = 0xd
} bjc_media_type_t;
void bjc_put_media_supply(stream *s, bjc_media_supply_t supply,
- bjc_media_type_t type);
+ bjc_media_type_t type);
/* Identify ink cartridge */
typedef enum {
@@ -308,7 +308,7 @@ typedef enum {
BJC_IDENTIFY_CARTRIDGE_REQUEST = 0x1
} bjc_identify_cartridge_command_t;
void bjc_put_identify_cartridge(stream *s,
- bjc_identify_cartridge_command_t command);
+ bjc_identify_cartridge_command_t command);
/*
* Page commands.
@@ -317,12 +317,12 @@ void bjc_put_identify_cartridge(stream *s,
/* Set page margins */
/* Left margin is 1-origin; margins are both from left edge; indent <= 8 */
void bjc_put_page_margins(stream *s, int length10ths, int lm10ths,
- int rm10ths, int indent60ths);
+ int rm10ths, int indent60ths);
/* Set extended margins */
/* All values are 0-origin; margins are both from left edge; indent <= 8 */
void bjc_put_extended_margins(stream *s, int length60ths, int lm60ths,
- int rm60ths, int indent60ths);
+ int rm60ths, int indent60ths);
/* Page ID */
/* 0 <= id <= 127 */
@@ -354,7 +354,7 @@ typedef enum {
BJC_CMYK_IMAGE_BLACK = 'K',
} bjc_cmyk_image_component_t;
void bjc_put_cmyk_image(stream *s, bjc_cmyk_image_component_t component,
- const byte *data, int count);
+ const byte *data, int count);
/* Move by raster lines */
/* Distance must be a multiple of the raster resolution */
@@ -379,8 +379,8 @@ typedef enum {
BJC_INK_SYSTEM_PHOTO_DVM = 0x0a /* drop volume modulation */
} bjc_ink_system_t;
void bjc_put_image_format(stream *s, int depth,
- bjc_image_format_t format,
- bjc_ink_system_t ink);
+ bjc_image_format_t format,
+ bjc_ink_system_t ink);
/* 4550 only */
void bjc_put_photo_image(stream *s, bool photo);
diff --git a/gs/base/gdevbmp.c b/gs/base/gdevbmp.c
index 81ab12742..996ac65cd 100644
--- a/gs/base/gdevbmp.c
+++ b/gs/base/gdevbmp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,23 +25,23 @@ static dev_proc_print_page(bmp_cmyk_print_page);
const gx_device_printer gs_bmpmono_device =
prn_device(prn_std_procs, "bmpmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, bmp_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, bmp_print_page);
/* 8-bit (SuperVGA-style) grayscale . */
/* (Uses a fixed palette of 256 gray levels.) */
static const gx_device_procs bmpgray_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
const gx_device_printer gs_bmpgray_device = {
prn_device_body(gx_device_printer, bmpgray_procs, "bmpgray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, 8, 255, 0, 256, 0, bmp_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, 8, 255, 0, 256, 0, bmp_print_page)
};
/* 1-bit-per-plane separated CMYK color. */
@@ -57,10 +57,10 @@ static const gx_device_procs bmpsep1_procs = {
};
const gx_device_printer gs_bmpsep1_device = {
prn_device_body(gx_device_printer, bmpsep1_procs, "bmpsep1",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 4, 4, 1, 1, 2, 2, bmp_cmyk_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 4, 4, 1, 1, 2, 2, bmp_cmyk_print_page)
};
/* 8-bit-per-plane separated CMYK color. */
@@ -70,23 +70,23 @@ static const gx_device_procs bmpsep8_procs = {
};
const gx_device_printer gs_bmpsep8_device = {
prn_device_body(gx_device_printer, bmpsep8_procs, "bmpsep8",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 4, 32, 255, 255, 256, 256, bmp_cmyk_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 4, 32, 255, 255, 256, 256, bmp_cmyk_print_page)
};
/* 4-bit planar (EGA/VGA-style) color. */
static const gx_device_procs bmp16_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
+ pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
const gx_device_printer gs_bmp16_device = {
prn_device_body(gx_device_printer, bmp16_procs, "bmp16",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 4, 1, 1, 2, 2, bmp_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 4, 1, 1, 2, 2, bmp_print_page)
};
/* 8-bit (SuperVGA-style) color. */
@@ -94,26 +94,26 @@ const gx_device_printer gs_bmp16_device = {
static const gx_device_procs bmp256_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
+ pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
const gx_device_printer gs_bmp256_device = {
- prn_device_body(gx_device_printer, bmp256_procs, "bmp256",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 8, 5, 5, 6, 6, bmp_print_page)
+ prn_device_body(gx_device_printer, bmp256_procs, "bmp256",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 8, 5, 5, 6, 6, bmp_print_page)
};
/* 24-bit color. */
static const gx_device_procs bmp16m_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- bmp_map_16m_rgb_color, bmp_map_16m_color_rgb);
+ bmp_map_16m_rgb_color, bmp_map_16m_color_rgb);
const gx_device_printer gs_bmp16m_device =
prn_device(bmp16m_procs, "bmp16m",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 24, bmp_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 24, bmp_print_page);
/* 32-bit CMYK color (outside the BMP specification). */
@@ -122,10 +122,10 @@ static const gx_device_procs bmp32b_procs = {
};
const gx_device_printer gs_bmp32b_device =
prn_device(bmp32b_procs, "bmp32b",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 32, bmp_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 32, bmp_print_page);
/* ------ Private definitions ------ */
@@ -142,21 +142,21 @@ bmp_print_page(gx_device_printer * pdev, FILE * file)
int code; /* return code */
if (row == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(row+raster, 0, bmp_raster - raster); /* clear the padding bytes */
/* Write the file header. */
code = write_bmp_header(pdev, file);
if (code < 0)
- goto done;
+ goto done;
/* Write the contents of the image. */
/* BMP files want the image in bottom-to-top order! */
for (y = pdev->height - 1; y >= 0; y--) {
- gdev_prn_copy_scan_lines(pdev, y, row, raster);
- fwrite((const char *)row, bmp_raster, 1, file);
+ gdev_prn_copy_scan_lines(pdev, y, row, raster);
+ fwrite((const char *)row, bmp_raster, 1, file);
}
done:
@@ -180,33 +180,33 @@ bmp_cmyk_print_page(gx_device_printer * pdev, FILE * file)
int plane;
if (row == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(row+raster, 0, bmp_raster - raster); /* clear the padding bytes */
-
+
for (plane = 0; plane <= 3; ++plane) {
- gx_render_plane_t render_plane;
+ gx_render_plane_t render_plane;
- /* Write the page header. */
+ /* Write the page header. */
- code = write_bmp_separated_header(pdev, file);
- if (code < 0)
- break;
+ code = write_bmp_separated_header(pdev, file);
+ if (code < 0)
+ break;
- /* Write the contents of the image. */
- /* BMP files want the image in bottom-to-top order! */
+ /* Write the contents of the image. */
+ /* BMP files want the image in bottom-to-top order! */
- gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
- for (y = pdev->height - 1; y >= 0; y--) {
- byte *actual_data;
- uint actual_raster;
+ gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
+ for (y = pdev->height - 1; y >= 0; y--) {
+ byte *actual_data;
+ uint actual_raster;
- code = gdev_prn_get_lines(pdev, y, 1, row, bmp_raster,
- &actual_data, &actual_raster,
- &render_plane);
- if (code < 0)
- goto done;
- fwrite((const char *)actual_data, bmp_raster, 1, file);
- }
+ code = gdev_prn_get_lines(pdev, y, 1, row, bmp_raster,
+ &actual_data, &actual_raster,
+ &render_plane);
+ if (code < 0)
+ goto done;
+ fwrite((const char *)actual_data, bmp_raster, 1, file);
+ }
}
done:
diff --git a/gs/base/gdevbmp.h b/gs/base/gdevbmp.h
index f075b681f..28b1a1537 100644
--- a/gs/base/gdevbmp.h
+++ b/gs/base/gdevbmp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevbmpa.c b/gs/base/gdevbmpa.c
index 588101f64..48ad56bdc 100644
--- a/gs/base/gdevbmpa.c
+++ b/gs/base/gdevbmpa.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@
/*
* The original version of this driver was restricted to producing a single
* page per file. If for some reason you want to reinstate this
- * restriction, uncomment the next line.
+ * restriction, uncomment the next line.
* NOTE: Even though the logic for multi-page files is straightforward,
* it results in a file that most programs that process BMP format cannot
* handle. Most programs will only display the first page.
@@ -81,10 +81,10 @@ static const gx_device_procs bmpamono_procs =
prn_procs(bmpa_writer_open, gdev_prn_output_page, gdev_prn_close);
const gx_device_async gs_bmpamono_device =
async_device(bmpamono_procs, "bmpamono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 1, default_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 1, default_print_page);
/* 1-bit-per-plane separated CMYK color. */
@@ -96,28 +96,28 @@ const gx_device_async gs_bmpamono_device =
static const gx_device_procs bmpasep1_procs = {
bmpa_cmyk_procs(bmpa_cmyk_writer_open, cmyk_1bit_map_color_rgb,
- cmyk_1bit_map_cmyk_color)
+ cmyk_1bit_map_cmyk_color)
};
const gx_device_async gs_bmpasep1_device = {
prn_device_body(gx_device_async, bmpasep1_procs, "bmpasep1",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 4, 4, 1, 1, 2, 2, default_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 4, 4, 1, 1, 2, 2, default_print_page)
};
/* 8-bit-per-plane separated CMYK color. */
static const gx_device_procs bmpasep8_procs = {
bmpa_cmyk_procs(bmpa_cmyk_writer_open, cmyk_8bit_map_color_rgb,
- cmyk_8bit_map_cmyk_color)
+ cmyk_8bit_map_cmyk_color)
};
const gx_device_async gs_bmpasep8_device = {
prn_device_body(gx_device_async, bmpasep8_procs, "bmpasep8",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 4, 32, 255, 255, 256, 256, default_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 4, 32, 255, 255, 256, 256, default_print_page)
};
/* 4-bit (EGA/VGA-style) color. */
@@ -127,10 +127,10 @@ static const gx_device_procs bmpa16_procs =
pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
const gx_device_async gs_bmpa16_device =
async_device(bmpa16_procs, "bmpa16",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 4, default_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 4, default_print_page);
/* 8-bit (SuperVGA-style) color. */
/* (Uses a fixed palette of 3,3,2 bits.) */
@@ -140,10 +140,10 @@ static const gx_device_procs bmpa256_procs =
pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
const gx_device_async gs_bmpa256_device =
async_device(bmpa256_procs, "bmpa256",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 8, default_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 8, default_print_page);
/* 24-bit color. */
@@ -152,23 +152,23 @@ static const gx_device_procs bmpa16m_procs =
bmp_map_16m_rgb_color, bmp_map_16m_color_rgb);
const gx_device_async gs_bmpa16m_device =
async_device(bmpa16m_procs, "bmpa16m",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 24, default_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 24, default_print_page);
/* 32-bit CMYK color (outside the BMP specification). */
static const gx_device_procs bmpa32b_procs = {
bmpa_cmyk_procs(bmpa_writer_open, gx_default_map_color_rgb,
- gx_default_cmyk_map_cmyk_color)
+ gx_default_cmyk_map_cmyk_color)
};
const gx_device_async gs_bmpa32b_device =
async_device(bmpa32b_procs, "bmpa32b",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 32, default_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 32, default_print_page);
/* --------- Forward declarations ---------- */
@@ -179,8 +179,8 @@ static void bmpa_reader_thread(void *);
/* Writer's open procedure */
static int
bmpa_open_writer(gx_device *pdev /* Driver instance to open */,
- dev_proc_print_page_copies((*reader_print_page_copies)),
- prn_dev_proc_buffer_page((*reader_buffer_page)))
+ dev_proc_print_page_copies((*reader_print_page_copies)),
+ prn_dev_proc_buffer_page((*reader_buffer_page)))
{
gx_device_async * const pwdev = (gx_device_async *)pdev;
int max_width;
@@ -193,15 +193,15 @@ bmpa_open_writer(gx_device *pdev /* Driver instance to open */,
* there are no convenient macros for setting them up in static template.
*/
init_async_render_procs(pwdev, bmpa_reader_start_render_thread,
- reader_buffer_page,
- reader_print_page_copies);
+ reader_buffer_page,
+ reader_print_page_copies);
set_dev_proc(pdev, get_params, bmpa_get_params); /* because not all device-init macros allow this to be defined */
set_dev_proc(pdev, put_params, bmpa_put_params); /* ibid. */
set_dev_proc(pdev, get_hardware_params, bmpa_get_hardware_params);
set_dev_proc(pdev, output_page, bmpa_reader_output_page); /* hack */
pwdev->printer_procs.get_space_params = bmpa_get_space_params;
pwdev->printer_procs.open_render_device =
- bmpa_reader_open_render_device; /* Included for tutorial value */
+ bmpa_reader_open_render_device; /* Included for tutorial value */
/*
* Determine MAXIMUM parameters this device will have to support over
@@ -214,25 +214,25 @@ bmpa_open_writer(gx_device *pdev /* Driver instance to open */,
/* Set to planar buffering mode if appropriate. */
if (pwdev->UsePlanarBuffer)
- gdev_prn_set_procs_planar(pdev);
+ gdev_prn_set_procs_planar(pdev);
/* Special writer open routine for async interpretation */
/* Starts render thread */
return gdev_prn_async_write_open((gx_device_printer *)pdev,
- max_raster, min_band_height,
- max_src_image_row);
+ max_raster, min_band_height,
+ max_src_image_row);
}
static int
bmpa_writer_open(gx_device *pdev /* Driver instance to open */)
{
return bmpa_open_writer(pdev, bmpa_reader_print_page_copies,
- bmpa_reader_buffer_page);
+ bmpa_reader_buffer_page);
}
static int
bmpa_cmyk_writer_open(gx_device *pdev /* Driver instance to open */)
{
return bmpa_open_writer(pdev, bmpa_cmyk_reader_print_copies,
- bmpa_cmyk_reader_buffer_page);
+ bmpa_cmyk_reader_buffer_page);
}
/* -------------- Renderer instance procedures ----------*/
@@ -240,11 +240,11 @@ bmpa_cmyk_writer_open(gx_device *pdev /* Driver instance to open */)
/* Forward declarations */
static int
bmpa_reader_buffer_planes(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies, int first_plane,
- int last_plane, int raster);
+ int num_copies, int first_plane,
+ int last_plane, int raster);
/* Thread to do rendering, started by bmpa_reader_start_render_thread */
-static void
+static void
bmpa_reader_thread(void *params)
{
gdev_prn_async_render_thread((gdev_prn_start_render_params *)params);
@@ -279,18 +279,18 @@ bmpa_reader_output_page(gx_device *pdev, int num_copies, int flush)
* we need to seek back & forth to support partial rendering.
*/
if ( num_copies > 0 || !flush ) {
- int code = gdev_prn_open_printer_positionable(pdev, 1, 1);
+ int code = gdev_prn_open_printer_positionable(pdev, 1, 1);
- if ( code < 0 )
- return code;
+ if ( code < 0 )
+ return code;
}
return gdev_prn_output_page(pdev, num_copies, flush);
}
static int
bmpa_reader_print_planes(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies, int first_plane, int last_plane,
- int raster)
+ int num_copies, int first_plane, int last_plane,
+ int raster)
{
gx_device_async * const prdev = (gx_device_async *)pdev;
/* BMP scan lines are padded to 32 bits. */
@@ -303,56 +303,56 @@ bmpa_reader_print_planes(gx_device_printer *pdev, FILE *prn_stream,
/* If there's data in buffer, need to process w/overlays */
if (prdev->buffered_page_exists) {
- code = bmpa_reader_buffer_planes(pdev, prn_stream, num_copies,
- first_plane, last_plane, raster);
- goto done;
+ code = bmpa_reader_buffer_planes(pdev, prn_stream, num_copies,
+ first_plane, last_plane, raster);
+ goto done;
}
#ifdef SINGLE_PAGE
/* BMP format is single page, so discard all but 1st printable page */
/* Since the OutputFile may have a %d, we use ftell to determine if */
/* this is a zero length file, which is legal to write */
if (ftell(prn_stream) != 0)
- return 0;
+ return 0;
#endif
row = gs_alloc_bytes(pdev->memory, bmp_raster, "bmp file buffer");
if (row == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (plane = first_plane; plane <= last_plane; ++plane) {
- gx_render_plane_t render_plane;
-
- /* Write header & seek to its end */
- code =
- (first_plane < 0 ? write_bmp_header(pdev, prn_stream) :
- write_bmp_separated_header(pdev, prn_stream));
- if (code < 0)
- goto done;
- /* Save the file offset where data begins */
- if ((prdev->file_offset_to_data[plane - first_plane] =
- ftell(prn_stream)) == -1L) {
- code = gs_note_error(gs_error_ioerror);
- goto done;
- }
-
- /*
- * Write out the bands top to bottom. Finish the job even if
- * num_copies == 0, to avoid invalid output file.
- */
- if (plane >= 0)
- gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
- for (y = prdev->height - 1; y >= 0; y--) {
- uint actual_raster;
-
- code = gdev_prn_get_lines(pdev, y, 1, row, bmp_raster,
- &raster_data, &actual_raster,
- (plane < 0 ? NULL : &render_plane));
- if (code < 0)
- goto done;
- if (fwrite((const char *)raster_data, actual_raster, 1, prn_stream) < 1) {
- code = gs_error_ioerror;
- goto done;
- }
- }
+ gx_render_plane_t render_plane;
+
+ /* Write header & seek to its end */
+ code =
+ (first_plane < 0 ? write_bmp_header(pdev, prn_stream) :
+ write_bmp_separated_header(pdev, prn_stream));
+ if (code < 0)
+ goto done;
+ /* Save the file offset where data begins */
+ if ((prdev->file_offset_to_data[plane - first_plane] =
+ ftell(prn_stream)) == -1L) {
+ code = gs_note_error(gs_error_ioerror);
+ goto done;
+ }
+
+ /*
+ * Write out the bands top to bottom. Finish the job even if
+ * num_copies == 0, to avoid invalid output file.
+ */
+ if (plane >= 0)
+ gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
+ for (y = prdev->height - 1; y >= 0; y--) {
+ uint actual_raster;
+
+ code = gdev_prn_get_lines(pdev, y, 1, row, bmp_raster,
+ &raster_data, &actual_raster,
+ (plane < 0 ? NULL : &render_plane));
+ if (code < 0)
+ goto done;
+ if (fwrite((const char *)raster_data, actual_raster, 1, prn_stream) < 1) {
+ code = gs_error_ioerror;
+ goto done;
+ }
+ }
}
done:
gs_free_object(pdev->memory, row, "bmp file buffer");
@@ -361,10 +361,10 @@ done:
}
static int
bmpa_reader_print_page_copies(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{
return bmpa_reader_print_planes(pdev, prn_stream, num_copies, -1, -1,
- gdev_prn_raster(pdev));
+ gdev_prn_raster(pdev));
}
static int
bmpa_cmyk_plane_raster(gx_device_printer *pdev)
@@ -373,16 +373,16 @@ bmpa_cmyk_plane_raster(gx_device_printer *pdev)
}
static int
bmpa_cmyk_reader_print_copies(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{
return bmpa_reader_print_planes(pdev, prn_stream, num_copies, 0, 3,
- bmpa_cmyk_plane_raster(pdev));
+ bmpa_cmyk_plane_raster(pdev));
}
/* Buffer a (partial) rasterized page & optionally print result multiple times. */
static int
bmpa_reader_buffer_planes(gx_device_printer *pdev, FILE *file, int num_copies,
- int first_plane, int last_plane, int raster)
+ int first_plane, int last_plane, int raster)
{
gx_device_async * const prdev = (gx_device_async *)pdev;
gx_device * const dev = (gx_device *)pdev;
@@ -390,9 +390,9 @@ bmpa_reader_buffer_planes(gx_device_printer *pdev, FILE *file, int num_copies,
/* If there's no data in buffer, no need to do any overlays */
if (!prdev->buffered_page_exists) {
- code = bmpa_reader_print_planes(pdev, file, num_copies,
- first_plane, last_plane, raster);
- goto done;
+ code = bmpa_reader_print_planes(pdev, file, num_copies,
+ first_plane, last_plane, raster);
+ goto done;
}
/*
@@ -412,106 +412,106 @@ bmpa_reader_buffer_planes(gx_device_printer *pdev, FILE *file, int num_copies,
*/
{
- byte *raster_data;
- gx_device_clist_reader *const crdev =
- (gx_device_clist_reader *)pdev;
- int raster = gx_device_raster(dev, 1);
- int padding = -raster & 3; /* BMP scan lines are padded to 32 bits. */
- int bmp_raster = raster + padding;
- int plane;
-
- /*
- * Get the address of the renderer's band buffer. In the future,
- * it will be possible to suppress the allocation of this buffer,
- * and to use only buffers provided the driver itself (e.g., a
- * hardware buffer).
- */
- if (!pdev->buffer_space) {
- /* Not banding. Can't happen. */
- code = gs_note_error(gs_error_Fatal);
- goto done;
- }
- raster_data = crdev->data;
-
- for (plane = first_plane; plane <= last_plane; ++plane) {
- gx_render_plane_t render_plane;
- gx_device *bdev;
- int y, band_base_line;
-
- /* Seek to beginning of data portion of file */
- if (fseek(file, prdev->file_offset_to_data[plane - first_plane],
- SEEK_SET)) {
- code = gs_note_error(gs_error_ioerror);
- goto done;
- }
-
- if (plane >= 0)
- gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
- else
- render_plane.index = -1;
-
- /* Set up the buffer device. */
- code = gdev_create_buf_device(crdev->buf_procs.create_buf_device,
- &bdev, crdev->target, 0, &render_plane,
- dev->memory, NULL);
- if (code < 0)
- goto done;
-
- /*
- * Iterate thru bands from top to bottom. As noted above, we
- * do this an entire band at a time for efficiency.
- */
- for (y = dev->height - 1; y >= 0; y = band_base_line - 1) {
- int band_height =
- dev_proc(dev, get_band)(dev, y, &band_base_line);
- int line;
- gs_int_rect band_rect;
-
- /* Set up the buffer device for this band. */
- code = crdev->buf_procs.setup_buf_device
- (bdev, raster_data, bmp_raster, NULL, 0, band_height,
- band_height);
- if (code < 0)
- goto done;
-
- /* Fill in the buffer with a band from the BMP file. */
- /* Need to do this backward since BMP is top to bottom. */
- for (line = band_height - 1; line >= 0; --line)
- if (fread(raster_data + line * bmp_raster,
- raster, 1, file) < 1 ||
- fseek(file, padding, SEEK_CUR)
- ) {
- code = gs_note_error(gs_error_ioerror);
- goto done;
- }
-
- /* Continue rendering on top of the existing bits. */
- band_rect.p.x = 0;
- band_rect.p.y = band_base_line;
- band_rect.q.x = pdev->width;
- band_rect.q.y = band_base_line + band_height;
- if ((code = clist_render_rectangle((gx_device_clist *)pdev,
- &band_rect, bdev,
- &render_plane, false)) < 0)
- goto done;
-
- /* Rewind & write out the updated buffer. */
- if (fseek(file, -bmp_raster * band_height, SEEK_CUR)) {
- code = gs_note_error(gs_error_ioerror);
- goto done;
- }
- for (line = band_height - 1; line >= 0; --line) {
- if (fwrite(raster_data + line * bmp_raster,
- bmp_raster, 1, file) < 1 ||
- fseek(file, padding, SEEK_CUR)
- ) {
- code = gs_note_error(gs_error_ioerror);
- goto done;
- }
- }
- }
- crdev->buf_procs.destroy_buf_device(bdev);
- }
+ byte *raster_data;
+ gx_device_clist_reader *const crdev =
+ (gx_device_clist_reader *)pdev;
+ int raster = gx_device_raster(dev, 1);
+ int padding = -raster & 3; /* BMP scan lines are padded to 32 bits. */
+ int bmp_raster = raster + padding;
+ int plane;
+
+ /*
+ * Get the address of the renderer's band buffer. In the future,
+ * it will be possible to suppress the allocation of this buffer,
+ * and to use only buffers provided the driver itself (e.g., a
+ * hardware buffer).
+ */
+ if (!pdev->buffer_space) {
+ /* Not banding. Can't happen. */
+ code = gs_note_error(gs_error_Fatal);
+ goto done;
+ }
+ raster_data = crdev->data;
+
+ for (plane = first_plane; plane <= last_plane; ++plane) {
+ gx_render_plane_t render_plane;
+ gx_device *bdev;
+ int y, band_base_line;
+
+ /* Seek to beginning of data portion of file */
+ if (fseek(file, prdev->file_offset_to_data[plane - first_plane],
+ SEEK_SET)) {
+ code = gs_note_error(gs_error_ioerror);
+ goto done;
+ }
+
+ if (plane >= 0)
+ gx_render_plane_init(&render_plane, (gx_device *)pdev, plane);
+ else
+ render_plane.index = -1;
+
+ /* Set up the buffer device. */
+ code = gdev_create_buf_device(crdev->buf_procs.create_buf_device,
+ &bdev, crdev->target, 0, &render_plane,
+ dev->memory, NULL);
+ if (code < 0)
+ goto done;
+
+ /*
+ * Iterate thru bands from top to bottom. As noted above, we
+ * do this an entire band at a time for efficiency.
+ */
+ for (y = dev->height - 1; y >= 0; y = band_base_line - 1) {
+ int band_height =
+ dev_proc(dev, get_band)(dev, y, &band_base_line);
+ int line;
+ gs_int_rect band_rect;
+
+ /* Set up the buffer device for this band. */
+ code = crdev->buf_procs.setup_buf_device
+ (bdev, raster_data, bmp_raster, NULL, 0, band_height,
+ band_height);
+ if (code < 0)
+ goto done;
+
+ /* Fill in the buffer with a band from the BMP file. */
+ /* Need to do this backward since BMP is top to bottom. */
+ for (line = band_height - 1; line >= 0; --line)
+ if (fread(raster_data + line * bmp_raster,
+ raster, 1, file) < 1 ||
+ fseek(file, padding, SEEK_CUR)
+ ) {
+ code = gs_note_error(gs_error_ioerror);
+ goto done;
+ }
+
+ /* Continue rendering on top of the existing bits. */
+ band_rect.p.x = 0;
+ band_rect.p.y = band_base_line;
+ band_rect.q.x = pdev->width;
+ band_rect.q.y = band_base_line + band_height;
+ if ((code = clist_render_rectangle((gx_device_clist *)pdev,
+ &band_rect, bdev,
+ &render_plane, false)) < 0)
+ goto done;
+
+ /* Rewind & write out the updated buffer. */
+ if (fseek(file, -bmp_raster * band_height, SEEK_CUR)) {
+ code = gs_note_error(gs_error_ioerror);
+ goto done;
+ }
+ for (line = band_height - 1; line >= 0; --line) {
+ if (fwrite(raster_data + line * bmp_raster,
+ bmp_raster, 1, file) < 1 ||
+ fseek(file, padding, SEEK_CUR)
+ ) {
+ code = gs_note_error(gs_error_ioerror);
+ goto done;
+ }
+ }
+ }
+ crdev->buf_procs.destroy_buf_device(bdev);
+ }
}
done:
@@ -520,17 +520,17 @@ bmpa_reader_buffer_planes(gx_device_printer *pdev, FILE *file, int num_copies,
}
static int
bmpa_reader_buffer_page(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{
return bmpa_reader_buffer_planes(pdev, prn_stream, num_copies, -1, -1,
- gdev_prn_raster(pdev));
+ gdev_prn_raster(pdev));
}
static int
bmpa_cmyk_reader_buffer_page(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{
return bmpa_reader_buffer_planes(pdev, prn_stream, num_copies, 0, 3,
- bmpa_cmyk_plane_raster(pdev));
+ bmpa_cmyk_plane_raster(pdev));
}
/*------------ Procedures common to writer & renderer -------- */
@@ -598,7 +598,7 @@ bmpa_get_space_params(const gx_device_printer *pdev,
*
* The moral of the story is that you should never make a band
* so small that its buffer limits the command buffer excessively.
- * Again, Max image row bytes = band buffer size - # bands * 72.
+ * Again, Max image row bytes = band buffer size - # bands * 72.
*
* In the overlapped case, everything is exactly as above, except that
* two identical devices, each with an identical buffer, are allocated:
@@ -632,7 +632,7 @@ bmpa_get_space_params(const gx_device_printer *pdev,
* Note: per the comments in gxclmem.c, the banding logic will perform
* better with 1MB or better for the command list.
*/
-
+
/* This will give us a very "ungenerous" buffer. */
/* Here, my arbitrary rule for min image row is: twice the dest width */
/* in full CMYK. */
@@ -641,21 +641,21 @@ bmpa_get_space_params(const gx_device_printer *pdev,
const int tile_cache_space = 50 * 1024;
const int min_image_rows = 2;
int min_row_space =
- min_image_rows * ( 4 * ( pdev->width + sizeof(int) - 1 ) );
+ min_image_rows * ( 4 * ( pdev->width + sizeof(int) - 1 ) );
int min_band_height = max(1, pdev->height / 100); /* make bands >= 1% of total */
space_params->band.BandWidth = pdev->width;
space_params->band.BandHeight = min_band_height;
gdev_mem_data_size( (const gx_device_memory *)pdev, space_params->band.BandWidth,
- space_params->band.BandHeight, &render_space );
+ space_params->band.BandHeight, &render_space );
/* need to include minimal writer requirements to satisfy rasterizer init */
writer_space = /* add 5K slop for good measure */
- 5000 + (72 + 8) * ( (pdev->height / space_params->band.BandHeight) + 1 );
+ 5000 + (72 + 8) * ( (pdev->height / space_params->band.BandHeight) + 1 );
space_params->band.BandBufferSpace =
- max(render_space, writer_space) + tile_cache_space;
+ max(render_space, writer_space) + tile_cache_space;
space_params->BufferSpace =
- max(render_space, writer_space + min_row_space) + tile_cache_space;
+ max(render_space, writer_space + min_row_space) + tile_cache_space;
/**************** HACK HACK HACK ****************/
/* Override this computation to force reader & writer to match */
space_params->BufferSpace = space_params->band.BandBufferSpace;
@@ -700,10 +700,10 @@ bmpa_get_hardware_params(gx_device *dev, gs_param_list *plist)
int code = 0;
if ( param_requested(plist, test_name) ) {
- gs_param_string param_str;
+ gs_param_string param_str;
- param_string_from_string(param_str, test_value); /* value must be persistent to use this macro */
- code = param_write_string(plist, test_name, &param_str);
+ param_string_from_string(param_str, test_value); /* value must be persistent to use this macro */
+ code = param_write_string(plist, test_name, &param_str);
}
return code;
}
diff --git a/gs/base/gdevbmpc.c b/gs/base/gdevbmpc.c
index b2e6721cf..bf9557811 100644
--- a/gs/base/gdevbmpc.c
+++ b/gs/base/gdevbmpc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ typedef ulong dword;
# define BMP_ASSIGN_WORD(a,v) a = ((v) >> 8) + ((v) << 8)
# define BMP_ASSIGN_DWORD(a,v)\
a = ((v) >> 24) + (((v) >> 8) & 0xff00L) +\
- (((dword)(v) << 8) & 0xff0000L) + ((dword)(v) << 24)
+ (((dword)(v) << 8) & 0xff0000L) + ((dword)(v) << 24)
#else
# define BMP_ASSIGN_WORD(a,v) a = (v)
# define BMP_ASSIGN_DWORD(a,v) a = (v)
@@ -91,8 +91,8 @@ typedef struct bmp_quad_s {
/* Write the BMP file header. */
static int
write_bmp_depth_header(gx_device_printer *pdev, FILE *file, int depth,
- const byte *palette /* [4 << depth] */,
- int raster)
+ const byte *palette /* [4 << depth] */,
+ int raster)
{
/* BMP scan lines are padded to 32 bits. */
ulong bmp_raster = raster + (-raster & 3);
@@ -104,54 +104,54 @@ write_bmp_depth_header(gx_device_printer *pdev, FILE *file, int depth,
fputc('B', file);
fputc('M', file);
{
- bmp_file_header fhdr;
-
- BMP_ASSIGN_DWORD(fhdr.size,
- sizeof_bmp_file_header +
- sizeof(bmp_info_header) + quads +
- bmp_raster * height);
- BMP_ASSIGN_WORD(fhdr.reserved1, 0);
- BMP_ASSIGN_WORD(fhdr.reserved2, 0);
- BMP_ASSIGN_DWORD(fhdr.offBits,
- sizeof_bmp_file_header +
- sizeof(bmp_info_header) + quads);
- if (fwrite((const char *)&fhdr, 1, sizeof(fhdr), file) != sizeof(fhdr))
- return_error(gs_error_ioerror);
+ bmp_file_header fhdr;
+
+ BMP_ASSIGN_DWORD(fhdr.size,
+ sizeof_bmp_file_header +
+ sizeof(bmp_info_header) + quads +
+ bmp_raster * height);
+ BMP_ASSIGN_WORD(fhdr.reserved1, 0);
+ BMP_ASSIGN_WORD(fhdr.reserved2, 0);
+ BMP_ASSIGN_DWORD(fhdr.offBits,
+ sizeof_bmp_file_header +
+ sizeof(bmp_info_header) + quads);
+ if (fwrite((const char *)&fhdr, 1, sizeof(fhdr), file) != sizeof(fhdr))
+ return_error(gs_error_ioerror);
}
/* Write the info header. */
{
- bmp_info_header ihdr;
-
- BMP_ASSIGN_DWORD(ihdr.size, sizeof(ihdr));
- BMP_ASSIGN_DWORD(ihdr.width, pdev->width);
- BMP_ASSIGN_DWORD(ihdr.height, height);
- BMP_ASSIGN_WORD(ihdr.planes, 1);
- BMP_ASSIGN_WORD(ihdr.bitCount, depth);
- BMP_ASSIGN_DWORD(ihdr.compression, 0);
- BMP_ASSIGN_DWORD(ihdr.sizeImage, bmp_raster * height);
- /*
- * Earlier versions of this driver set the PelsPerMeter values
- * to zero. At a user's request, we now set them correctly,
- * but we suspect this will cause problems other places.
- */
+ bmp_info_header ihdr;
+
+ BMP_ASSIGN_DWORD(ihdr.size, sizeof(ihdr));
+ BMP_ASSIGN_DWORD(ihdr.width, pdev->width);
+ BMP_ASSIGN_DWORD(ihdr.height, height);
+ BMP_ASSIGN_WORD(ihdr.planes, 1);
+ BMP_ASSIGN_WORD(ihdr.bitCount, depth);
+ BMP_ASSIGN_DWORD(ihdr.compression, 0);
+ BMP_ASSIGN_DWORD(ihdr.sizeImage, bmp_raster * height);
+ /*
+ * Earlier versions of this driver set the PelsPerMeter values
+ * to zero. At a user's request, we now set them correctly,
+ * but we suspect this will cause problems other places.
+ */
#define INCHES_PER_METER (100 /*cm/meter*/ / 2.54 /*cm/inch*/)
- BMP_ASSIGN_DWORD(ihdr.xPelsPerMeter,
- (dword)(pdev->x_pixels_per_inch * INCHES_PER_METER + 0.5));
- BMP_ASSIGN_DWORD(ihdr.yPelsPerMeter,
- (dword)(pdev->y_pixels_per_inch * INCHES_PER_METER + 0.5));
+ BMP_ASSIGN_DWORD(ihdr.xPelsPerMeter,
+ (dword)(pdev->x_pixels_per_inch * INCHES_PER_METER + 0.5));
+ BMP_ASSIGN_DWORD(ihdr.yPelsPerMeter,
+ (dword)(pdev->y_pixels_per_inch * INCHES_PER_METER + 0.5));
#undef INCHES_PER_METER
- BMP_ASSIGN_DWORD(ihdr.clrUsed, 0);
- BMP_ASSIGN_DWORD(ihdr.clrImportant, 0);
- if (fwrite((const char *)&ihdr, 1, sizeof(ihdr), file) != sizeof(ihdr))
- return_error(gs_error_ioerror);
+ BMP_ASSIGN_DWORD(ihdr.clrUsed, 0);
+ BMP_ASSIGN_DWORD(ihdr.clrImportant, 0);
+ if (fwrite((const char *)&ihdr, 1, sizeof(ihdr), file) != sizeof(ihdr))
+ return_error(gs_error_ioerror);
}
/* Write the palette. */
if (depth <= 8)
- fwrite(palette, sizeof(bmp_quad), 1 << depth, file);
+ fwrite(palette, sizeof(bmp_quad), 1 << depth, file);
return 0;
}
@@ -164,25 +164,25 @@ write_bmp_header(gx_device_printer *pdev, FILE *file)
bmp_quad palette[256];
if (depth <= 8) {
- int i;
- gx_color_value rgb[3];
- bmp_quad q;
-
- q.reserved = 0;
- for (i = 0; i != 1 << depth; i++) {
- /* Note that the use of map_color_rgb is deprecated in
- favor of decode_color. This should work, though, because
- backwards compatibility is preserved. */
- (*dev_proc(pdev, map_color_rgb))((gx_device *)pdev,
- (gx_color_index)i, rgb);
- q.red = gx_color_value_to_byte(rgb[0]);
- q.green = gx_color_value_to_byte(rgb[1]);
- q.blue = gx_color_value_to_byte(rgb[2]);
- palette[i] = q;
- }
+ int i;
+ gx_color_value rgb[3];
+ bmp_quad q;
+
+ q.reserved = 0;
+ for (i = 0; i != 1 << depth; i++) {
+ /* Note that the use of map_color_rgb is deprecated in
+ favor of decode_color. This should work, though, because
+ backwards compatibility is preserved. */
+ (*dev_proc(pdev, map_color_rgb))((gx_device *)pdev,
+ (gx_color_index)i, rgb);
+ q.red = gx_color_value_to_byte(rgb[0]);
+ q.green = gx_color_value_to_byte(rgb[1]);
+ q.blue = gx_color_value_to_byte(rgb[2]);
+ palette[i] = q;
+ }
}
return write_bmp_depth_header(pdev, file, depth, (const byte *)palette,
- gdev_prn_raster(pdev));
+ gdev_prn_raster(pdev));
}
/* Write a BMP header for separated CMYK output. */
@@ -197,13 +197,13 @@ write_bmp_separated_header(gx_device_printer *pdev, FILE *file)
q.reserved = 0;
for (i = 0; i < 1 << plane_depth; i++) {
- q.red = q.green = q.blue =
- 255 - i * 255 / ((1 << plane_depth) - 1);
- palette[i] = q;
+ q.red = q.green = q.blue =
+ 255 - i * 255 / ((1 << plane_depth) - 1);
+ palette[i] = q;
}
return write_bmp_depth_header(pdev, file, plane_depth,
- (const byte *)palette,
- (pdev->width*plane_depth + 7) >> 3);
+ (const byte *)palette,
+ (pdev->width*plane_depth + 7) >> 3);
}
/* 24-bit color mappers (taken from gdevmem2.c). */
@@ -217,14 +217,14 @@ bmp_map_16m_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value r, g, b;
r = cv[0]; g = cv[1]; b = cv[2];
return gx_color_value_to_byte(r) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- ((ulong) gx_color_value_to_byte(b) << 16);
+ ((uint) gx_color_value_to_byte(g) << 8) +
+ ((ulong) gx_color_value_to_byte(b) << 16);
}
/* Map a color index to a r-g-b color. */
int
bmp_map_16m_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
prgb[2] = gx_color_value_from_byte(color >> 16);
prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
diff --git a/gs/base/gdevccr.c b/gs/base/gdevccr.c
index a35392764..39780d00d 100644
--- a/gs/base/gdevccr.c
+++ b/gs/base/gdevccr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,24 +24,23 @@
#define CCNEWPASS(p) putc(0x0c, p)
#define CCEMPTYLINE(p) putc(0x0a, p)
#define CCLINESTART(len,p) do{ putc(0x1b,p);putc(0x4b,p);putc(len>>8,p); \
- putc(len&0xff,p);} while(0)
+ putc(len&0xff,p);} while(0)
#define CPASS (0)
#define MPASS (1)
#define YPASS (2)
#define NPASS (3)
-
typedef struct cmyrow_s
- {
- int current;
+ {
+ int current;
int _cmylen[NPASS];
- int is_used;
- char cname[4];
- char mname[4];
- char yname[4];
+ int is_used;
+ char cname[4];
+ char mname[4];
+ char yname[4];
unsigned char *_cmybuf[NPASS];
- } cmyrow;
+ } cmyrow;
#define clen _cmylen[CPASS]
#define mlen _cmylen[MPASS]
@@ -60,8 +59,8 @@ static void write_cpass(cmyrow *buf, int rows, int pass, FILE * pstream);
static void free_rb_line( gs_memory_t *mem, cmyrow *rbuf, int rows, int cols);
struct gx_device_ccr_s {
- gx_device_common;
- gx_prn_device_common;
+ gx_device_common;
+ gx_prn_device_common;
/* optional parameters */
};
typedef struct gx_device_ccr_s gx_device_ccr;
@@ -81,29 +80,28 @@ typedef struct gx_device_ccr_s gx_device_ccr;
/* Macro for generating ccr device descriptors. */
#define ccr_prn_device(procs, dev_name, margin, num_comp, depth, max_gray, max_rgb, print_page)\
{ prn_device_body(gx_device_ccr, procs, dev_name,\
- DEFAULT_WIDTH_10THS_A3, DEFAULT_HEIGHT_10THS_A3, X_DPI, Y_DPI,\
- margin, margin, margin, margin,\
- num_comp, depth, max_gray, max_rgb, max_gray + 1, max_rgb + 1,\
- print_page)\
+ DEFAULT_WIDTH_10THS_A3, DEFAULT_HEIGHT_10THS_A3, X_DPI, Y_DPI,\
+ margin, margin, margin, margin,\
+ num_comp, depth, max_gray, max_rgb, max_gray + 1, max_rgb + 1,\
+ print_page)\
}
/* For CCR, we need our own color mapping procedures. */
static dev_proc_map_rgb_color(ccr_map_rgb_color);
static dev_proc_map_color_rgb(ccr_map_color_rgb);
-
/* And of course we need our own print-page routine. */
static dev_proc_print_page(ccr_print_page);
/* The device procedures */
static gx_device_procs ccr_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- ccr_map_rgb_color, ccr_map_color_rgb);
+ ccr_map_rgb_color, ccr_map_color_rgb);
/* The device descriptors themselves */
gx_device_ccr far_data gs_ccr_device =
ccr_prn_device(ccr_procs, "ccr", 0.2, 3, 8, 1, 1,
- ccr_print_page);
+ ccr_print_page);
/* ------ Color mapping routines ------ */
/* map an rgb color to a ccr cmy bitmap */
@@ -122,7 +120,7 @@ ccr_map_rgb_color(gx_device *pdev, const ushort cv[])
return r<<2 | g<<1 | b;
}
-/* map an ccr cmy bitmap to a rgb color */
+/* map an ccr cmy bitmap to a rgb color */
static int
ccr_map_color_rgb(gx_device *pdev, gx_color_index color, ushort rgb[3])
{
@@ -133,7 +131,6 @@ ccr_map_color_rgb(gx_device *pdev, gx_color_index color, ushort rgb[3])
}
/* ------ print page routine ------ */
-
static int
ccr_print_page(gx_device_printer *pdev, FILE *pstream)
{
@@ -148,7 +145,7 @@ ccr_print_page(gx_device_printer *pdev, FILE *pstream)
if((in = (byte *)gs_malloc(pdev->memory, line_size, 1, "gsline")) == NULL)
return_error(gs_error_VMerror);
-
+
if(alloc_rb( pdev->memory, &linebuf, lnum))
{
gs_free(pdev->memory, in, line_size, 1, "gsline");
@@ -158,29 +155,29 @@ ccr_print_page(gx_device_printer *pdev, FILE *pstream)
for ( l = 0; l < lnum; l++ )
{ gdev_prn_get_bits(pdev, l, in, &data);
if(alloc_line(pdev->memory, &linebuf[l], pixnum))
- {
- gs_free(pdev->memory, in, line_size, 1, "gsline");
- free_rb_line( pdev->memory, linebuf, lnum, pixnum );
- return_error(gs_error_VMerror);
- }
+ {
+ gs_free(pdev->memory, in, line_size, 1, "gsline");
+ free_rb_line( pdev->memory, linebuf, lnum, pixnum );
+ return_error(gs_error_VMerror);
+ }
for ( p=0; p< pixnum; p+=8)
- {
- c=m=y=0;
+ {
+ c=m=y=0;
for(b=0; b<8; b++)
- {
+ {
c <<= 1; m <<= 1; y <<= 1;
- if(p+b < pixnum)
- cmy = *data;
- else
- cmy = 0;
+ if(p+b < pixnum)
+ cmy = *data;
+ else
+ cmy = 0;
c |= cmy>>2;
- m |= (cmy>>1) & 0x1;
- y |= cmy & 0x1;
- data++;
- }
- add_cmy8(&linebuf[l], c, m, y);
- }
+ m |= (cmy>>1) & 0x1;
+ y |= cmy & 0x1;
+ data++;
+ }
+ add_cmy8(&linebuf[l], c, m, y);
+ }
}
CCFILESTART(pstream);
write_cpass(linebuf, lnum, YPASS, pstream);
@@ -188,18 +185,16 @@ CCNEWPASS(pstream);
write_cpass(linebuf, lnum, MPASS, pstream);
CCNEWPASS(pstream);
write_cpass(linebuf, lnum, CPASS, pstream);
-CCFILEEND(pstream);
+CCFILEEND(pstream);
-/* clean up */
+/* clean up */
gs_free(pdev->memory, in, line_size, 1, "gsline");
free_rb_line( pdev->memory, linebuf, lnum, pixnum );
return 0;
}
-
/* ------ Internal routines ------ */
-
static int alloc_rb( gs_memory_t *mem, cmyrow **rb, int rows)
{
*rb = (cmyrow*) gs_malloc(mem, rows, sizeof(cmyrow), "rb");
@@ -209,12 +204,12 @@ static int alloc_rb( gs_memory_t *mem, cmyrow **rb, int rows)
{
int r;
for(r=0; r<rows; r++)
- {
- sprintf((*rb)[r].cname, "C%02x", r);
- sprintf((*rb)[r].mname, "M%02x", r);
- sprintf((*rb)[r].yname, "Y%02x", r);
- (*rb)[r].is_used=0;
- }
+ {
+ sprintf((*rb)[r].cname, "C%02x", r);
+ sprintf((*rb)[r].mname, "M%02x", r);
+ sprintf((*rb)[r].yname, "Y%02x", r);
+ (*rb)[r].is_used=0;
+ }
return 0;
}
}
@@ -261,10 +256,10 @@ static void write_cpass(cmyrow *buf, int rows, int pass, FILE * pstream)
{
len=buf[row].cmylen[pass];
if(len == 0)
- CCEMPTYLINE(pstream);
+ CCEMPTYLINE(pstream);
else
- {
- CCLINESTART(len,pstream);
+ {
+ CCLINESTART(len,pstream);
fwrite( buf[row].cmybuf[pass], len, 1, pstream);
}
}
@@ -277,14 +272,14 @@ static void free_rb_line( gs_memory_t *mem, cmyrow *rbuf, int rows, int cols)
for(i=0; i<rows; i++)
{
if(rbuf[i].is_used)
- {
+ {
gs_free(mem, rbuf[i].cbuf, cols, 1, rbuf[i].cname);
- gs_free(mem, rbuf[i].mbuf, cols, 1, rbuf[i].mname);
- gs_free(mem, rbuf[i].ybuf, cols, 1, rbuf[i].yname);
- rbuf[i].is_used = 0;
- }
+ gs_free(mem, rbuf[i].mbuf, cols, 1, rbuf[i].mname);
+ gs_free(mem, rbuf[i].ybuf, cols, 1, rbuf[i].yname);
+ rbuf[i].is_used = 0;
+ }
else
- break;
+ break;
}
gs_free( mem, rbuf, rows, sizeof(cmyrow), "rb");
return;
diff --git a/gs/base/gdevcdj.c b/gs/base/gdevcdj.c
index 6a1f7d55f..9ddc440ba 100644
--- a/gs/base/gdevcdj.c
+++ b/gs/base/gdevcdj.c
@@ -151,27 +151,27 @@
switch ( ncode = pread(plist, (oname = pname), &pa) )\
{\
case 0:\
- if ( pa.size != psize )\
- code = gs_error_rangecheck;\
- else {
+ if ( pa.size != psize )\
+ code = gs_error_rangecheck;\
+ else {
/* The body of the processing code goes here. */
/* If it succeeds, it should do a 'break'; */
/* if it fails, it should set ecode and fall through. */
#define END_PARAM(pa, e)\
- }\
- goto e;\
+ }\
+ goto e;\
default:\
- code = ncode;\
+ code = ncode;\
e: param_signal_error(plist, oname, code);\
case 1:\
- pa.data = 0; /* mark as not filled */\
+ pa.data = 0; /* mark as not filled */\
}
static int cdj_param_check_bytes(gs_param_list *, gs_param_name, const byte *, uint, bool);
static int cdj_param_check_float(gs_param_list *, gs_param_name, floatp, bool);
#define cdj_param_check_string(plist, pname, str, is_defined)\
cdj_param_check_bytes(plist, pname, (const byte *)(str), strlen(str),\
- is_defined)
+ is_defined)
/*
* Drivers stuff.
@@ -204,9 +204,9 @@ static int cdj_param_check_float(gs_param_list *, gs_param_name, floatp, bool);
*
*/
#define ESC_P_MARGINS_LETTER (float)0.134, (float)(0.276+0.2), \
- (float)(0.366+0.01), (float)0.335
+ (float)(0.366+0.01), (float)0.335
#define ESC_P_MARGINS_A4 (float)0.134, (float)(0.276+0.2), \
- (float)(0.166+0.01), (float)0.335
+ (float)(0.166+0.01), (float)0.335
/* Define bits-per-pixel for generic drivers - default is 24-bit mode */
#ifndef BITSPERPIXEL
@@ -222,11 +222,9 @@ static int cdj_param_check_float(gs_param_list *, gs_param_name, floatp, bool);
#define W size_of(word)
#define I size_of(int)
-
#define invert_word(v)\
((v) >> 24) + (((v) >> 8) & 0xff00L) +\
- (((word)(v) << 8) & 0xff0000L) + ((word)(v) << 24)
-
+ (((word)(v) << 8) & 0xff0000L) + ((word)(v) << 24)
/* Printer types */
#define DJ500C 0
@@ -296,30 +294,30 @@ static dev_proc_put_params(bjc_put_params);
#define gx_prn_colour_device_common \
gx_prn_device_common; \
short cmyk; /* 0: not CMYK-capable, > 0: printing CMYK, */ \
- /* < 0 : CMYK-capable, not printing CMYK */ \
+ /* < 0 : CMYK-capable, not printing CMYK */ \
uint default_depth; /* Used only for CMYK-capable printers now. */ \
uint correction
typedef struct gx_device_cdj_s gx_device_cdj;
struct gx_device_cdj_s {
- gx_device_common;
- gx_prn_colour_device_common;
- int shingling; /* Interlaced, multi-pass printing */
- int depletion; /* 'Intelligent' dot-removal */
+ gx_device_common;
+ gx_prn_colour_device_common;
+ int shingling; /* Interlaced, multi-pass printing */
+ int depletion; /* 'Intelligent' dot-removal */
};
typedef struct gx_device_pjxl_s gx_device_pjxl;
struct gx_device_pjxl_s {
- gx_device_common;
- gx_prn_colour_device_common;
- int printqual; /* Mechanical print quality */
- int rendertype; /* Driver or printer dithering control */
+ gx_device_common;
+ gx_prn_colour_device_common;
+ int printqual; /* Mechanical print quality */
+ int rendertype; /* Driver or printer dithering control */
};
typedef struct gx_device_hp_s gx_device_hp;
struct gx_device_hp_s {
- gx_device_common;
- gx_prn_colour_device_common;
+ gx_device_common;
+ gx_prn_colour_device_common;
};
typedef struct gx_device_hp_s gx_device_pj;
@@ -338,8 +336,8 @@ typedef struct gx_device_bjc800_s gx_device_bjc;
bool ditheringType; /* Do dithering */ \
int colorComponents; /* The number of *desired* color comps */ \
int printColors /* 0: Transparent, \
- 1: C, 2: M, 4: Y, 7: K (Color decomp). \
- if > 8, print in black ink. */
+ 1: C, 2: M, 4: Y, 7: K (Color decomp). \
+ if > 8, print in black ink. */
typedef struct {
bjc_params_common;
@@ -361,11 +359,11 @@ typedef bjc_params bjc800_params;
struct gx_device_bjc600_s {
gx_bjc_device_common;
- bjc600_params bjc_p;
+ bjc600_params bjc_p;
};
struct gx_device_bjc800_s {
gx_bjc_device_common;
- bjc800_params bjc_p;
+ bjc800_params bjc_p;
};
typedef struct {
@@ -454,77 +452,77 @@ typedef struct {
}
#define hp_colour_procs(proc_colour_open, proc_get_params, proc_put_params) {\
- proc_colour_open,\
- gx_default_get_initial_matrix,\
- gx_default_sync_output,\
- gdev_prn_output_page,\
- gdev_prn_close,\
- gdev_pcl_map_rgb_color,\
- gdev_pcl_map_color_rgb,\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- gx_default_get_bits,\
- proc_get_params,\
- proc_put_params\
+ proc_colour_open,\
+ gx_default_get_initial_matrix,\
+ gx_default_sync_output,\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ gdev_pcl_map_rgb_color,\
+ gdev_pcl_map_color_rgb,\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ gx_default_get_bits,\
+ proc_get_params,\
+ proc_put_params\
}
#define cmyk_colour_procs(proc_colour_open, proc_get_params, proc_put_params) {\
- proc_colour_open,\
- gx_default_get_initial_matrix,\
- gx_default_sync_output,\
- gdev_prn_output_page,\
- gdev_prn_close,\
- NULL /* map_rgb_color */,\
- NULL /* map_color_rgb */,\
- NULL /* fill_rectangle */,\
- NULL /* tile_rectangle */,\
- NULL /* copy_mono */,\
- NULL /* copy_color */,\
- NULL /* draw_line */,\
- gx_default_get_bits,\
- proc_get_params,\
- proc_put_params,\
+ proc_colour_open,\
+ gx_default_get_initial_matrix,\
+ gx_default_sync_output,\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ NULL /* map_rgb_color */,\
+ NULL /* map_color_rgb */,\
+ NULL /* fill_rectangle */,\
+ NULL /* tile_rectangle */,\
+ NULL /* copy_mono */,\
+ NULL /* copy_color */,\
+ NULL /* draw_line */,\
+ gx_default_get_bits,\
+ proc_get_params,\
+ proc_put_params,\
gdev_cmyk_map_cmyk_color,\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- NULL, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- NULL, /* get_color_mapping_procs */\
- NULL, /* get_color_comp_index */\
- gdev_cmyk_map_cmyk_color, /* encode_color */\
- gdev_cmyk_map_color_cmyk /* decode_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ NULL, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ NULL, /* get_color_mapping_procs */\
+ NULL, /* get_color_comp_index */\
+ gdev_cmyk_map_cmyk_color, /* encode_color */\
+ gdev_cmyk_map_color_cmyk /* decode_color */\
}
static gx_device_procs cdj500_procs =
@@ -564,23 +562,23 @@ hp_colour_procs(escp_open, ep_get_params, ep_put_params);
gx_device_cdj far_data gs_cdjmono_device =
cdj_device(cdj500_procs, "cdjmono", 300, 300, 1,
- dj500c_print_page, 4, 0, 1);
+ dj500c_print_page, 4, 0, 1);
gx_device_cdj far_data gs_cdeskjet_device =
cdj_device(cdj500_procs, "cdeskjet", 300, 300, 3,
- dj500c_print_page, 4, 2, 1);
+ dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdjcolor_device =
cdj_device(cdj500_procs, "cdjcolor", 300, 300, 24,
- dj500c_print_page, 4, 2, 1);
+ dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdj500_device =
cdj_device(cdj500_procs, "cdj500", 300, 300, BITSPERPIXEL,
- dj500c_print_page, 4, 2, 1);
+ dj500c_print_page, 4, 2, 1);
gx_device_cdj far_data gs_cdj550_device =
cdj_device(cdj550_procs, "cdj550", 300, 300, BITSPERPIXEL,
- dj550c_print_page, 0, 2, 1);
+ dj550c_print_page, 0, 2, 1);
#ifdef USE_CDJ550_CMYK
gx_device_cdj far_data gs_cdj550cmyk_device = {
@@ -591,69 +589,69 @@ gx_device_cdj far_data gs_cdj550cmyk_device = {
gx_device_cdj far_data gs_picty180_device =
cdj_device(cdj550_procs, "picty180", 300, 300, BITSPERPIXEL,
- picty180_print_page, 0, 2, 1);
+ picty180_print_page, 0, 2, 1);
gx_device_cdj far_data gs_dj505j_device =
cdj_device(dj505j_procs, "dj505j", 300, 300, 1,
- dj505j_print_page, 4, 0, 1);
+ dj505j_print_page, 4, 0, 1);
gx_device_pj far_data gs_declj250_device =
pj_device(pj_procs, "declj250", 180, 180, BITSPERPIXEL,
- declj250_print_page);
+ declj250_print_page);
gx_device_cdj far_data gs_dnj650c_device =
cdj_device(dnj650c_procs, "dnj650c", 300, 300, BITSPERPIXEL,
- dnj650c_print_page, 0, 2, 1);
+ dnj650c_print_page, 0, 2, 1);
gx_device_cdj far_data gs_lj4dith_device =
cdj_device(lj4dith_procs, "lj4dith", 600, 600, 8,
- lj4dith_print_page, 4, 0, 1);
+ lj4dith_print_page, 4, 0, 1);
gx_device_cdj far_data gs_lj4dithp_device =
cdj_device(lj4dith_procs, "lj4dithp", 600, 600, 8,
- lj4dithp_print_page, 4, 0, 1);
+ lj4dithp_print_page, 4, 0, 1);
gx_device_pj far_data gs_pj_device =
pj_device(pj_procs, "pj", 180, 180, BITSPERPIXEL,
- pj_print_page);
+ pj_print_page);
gx_device_pjxl far_data gs_pjxl_device =
pjxl_device(pjxl_procs, "pjxl", 180, 180, BITSPERPIXEL,
- pjxl_print_page, 0, 0);
+ pjxl_print_page, 0, 0);
gx_device_pjxl far_data gs_pjxl300_device =
pjxl_device(pjxl300_procs, "pjxl300", 300, 300, BITSPERPIXEL,
- pjxl300_print_page, 0, 0);
+ pjxl300_print_page, 0, 0);
gx_device_cdj far_data gs_escp_device =
cdj_device(escp_procs, "escp", 360, 360, 8,
- escp_print_page, 0, 0, 1);
+ escp_print_page, 0, 0, 1);
gx_device_cdj far_data gs_escpc_device =
cdj_device(escp_procs, "escpc", 360, 360, 24,
- escp_print_page, 0, 0, 1);
+ escp_print_page, 0, 0, 1);
/* Args of bjc drivers are manualFeed, mediaType, printQuality, printColor,
mediaWeight_isSet, mediaWeight, (monochromePrint) */
gx_device_bjc600 far_data gs_bjc600_device =
bjc600_device(
- bjc_procs,
+ bjc_procs,
BJC_BJC600,
BJC600_DEFAULT_RESOLUTION,
BJC600_DEFAULT_RESOLUTION,
BJC600_DEFAULT_BITSPERPIXEL,
- bjc_print_page,
+ bjc_print_page,
BJC600,
- BJC600_DEFAULT_MANUALFEED,
- BJC600_DEFAULT_MEDIATYPE,
- BJC600_DEFAULT_SETMEDIAWEIGHT,
- BJC600_DEFAULT_MEDIAWEIGHT,
- BJC600_DEFAULT_PRINTQUALITY,
- BJC600_DEFAULT_DITHERINGTYPE,
- BJC600_DEFAULT_COLORCOMPONENTS,
- BJC600_DEFAULT_PRINTCOLORS,
- BJC600_DEFAULT_MONOCHROMEPRINT);
+ BJC600_DEFAULT_MANUALFEED,
+ BJC600_DEFAULT_MEDIATYPE,
+ BJC600_DEFAULT_SETMEDIAWEIGHT,
+ BJC600_DEFAULT_MEDIAWEIGHT,
+ BJC600_DEFAULT_PRINTQUALITY,
+ BJC600_DEFAULT_DITHERINGTYPE,
+ BJC600_DEFAULT_COLORCOMPONENTS,
+ BJC600_DEFAULT_PRINTCOLORS,
+ BJC600_DEFAULT_MONOCHROMEPRINT);
gx_device_bjc800 far_data gs_bjc800_device =
bjc800_device(
@@ -662,16 +660,16 @@ gx_device_bjc800 far_data gs_bjc800_device =
BJC800_DEFAULT_RESOLUTION,
BJC800_DEFAULT_RESOLUTION,
BJC800_DEFAULT_BITSPERPIXEL,
- bjc_print_page,
+ bjc_print_page,
BJC800,
- BJC800_DEFAULT_MANUALFEED,
- BJC800_DEFAULT_MEDIATYPE,
- BJC800_DEFAULT_SETMEDIAWEIGHT,
- BJC800_DEFAULT_MEDIAWEIGHT,
- BJC800_DEFAULT_PRINTQUALITY,
- BJC800_DEFAULT_DITHERINGTYPE,
- BJC600_DEFAULT_COLORCOMPONENTS,
- BJC800_DEFAULT_PRINTCOLORS);
+ BJC800_DEFAULT_MANUALFEED,
+ BJC800_DEFAULT_MEDIATYPE,
+ BJC800_DEFAULT_SETMEDIAWEIGHT,
+ BJC800_DEFAULT_MEDIAWEIGHT,
+ BJC800_DEFAULT_PRINTQUALITY,
+ BJC800_DEFAULT_DITHERINGTYPE,
+ BJC600_DEFAULT_COLORCOMPONENTS,
+ BJC800_DEFAULT_PRINTCOLORS);
/* Forward references */
static int gdev_pcl_mode1compress(const byte *, const byte *, byte *);
@@ -773,19 +771,19 @@ hp_colour_open(gx_device *pdev, int ptype)
/* Set up colour params if put_params has not already done so */
if (pdev->color_info.num_components == 0)
{ int code = cdj_set_bpp(pdev, pdev->color_info.depth,
- pdev->color_info.num_components);
- if ( code < 0 )
- return code;
+ pdev->color_info.num_components);
+ if ( code < 0 )
+ return code;
}
switch (ptype) {
case DJ500C:
case DJ550C:
m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 :
- dj_letter);
+ dj_letter);
break;
case DJ505J:
- m = pdev->color_info.num_components > 1 ? dj_505jc : dj_505j;
+ m = pdev->color_info.num_components > 1 ? dj_505jc : dj_505j;
break;
case DNJ650C:
m = dnj_all;
@@ -800,29 +798,29 @@ hp_colour_open(gx_device *pdev, int ptype)
break;
case ESC_P:
m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? ep_a4 :
- ep_letter);
+ ep_letter);
break;
case BJC600:
case BJC800:
switch (gdev_pcl_paper_size(pdev)) {
- case PAPER_SIZE_LEGAL:
- case PAPER_SIZE_LETTER:
- m = bjc_letter;
- break;
+ case PAPER_SIZE_LEGAL:
+ case PAPER_SIZE_LETTER:
+ m = bjc_letter;
+ break;
- case PAPER_SIZE_A0:
- case PAPER_SIZE_A1:
- case PAPER_SIZE_A3:
- m = bjc_a3;
- break;
+ case PAPER_SIZE_A0:
+ case PAPER_SIZE_A1:
+ case PAPER_SIZE_A3:
+ m = bjc_a3;
+ break;
- default:
- m = bjc_a4;
+ default:
+ m = bjc_a4;
}
#ifndef USE_FIXED_MARGINS
if (ptype == BJC800) {
- ((float *) m)[1] = (float)BJC_HARD_LOWER_LIMIT;
+ ((float *) m)[1] = (float)BJC_HARD_LOWER_LIMIT;
}
#endif
@@ -830,9 +828,9 @@ hp_colour_open(gx_device *pdev, int ptype)
#ifdef BJC_DEFAULT_CENTEREDAREA
if (m[3] < m[1]) {
- ((float *) m)[3] = m[1]; /* Top margin = bottom one. */
+ ((float *) m)[3] = m[1]; /* Top margin = bottom one. */
} else {
- ((float *) m)[1] = m[3]; /* Bottom margin = top one. */
+ ((float *) m)[1] = m[3]; /* Bottom margin = top one. */
}
#endif
@@ -847,16 +845,16 @@ hp_colour_open(gx_device *pdev, int ptype)
*/
/**/ {
- float *bjcm = (float *) m;
+ float *bjcm = (float *) m;
- byte pdimen = (byte)
- (pdev->height / pdev->y_pixels_per_inch * 10.
- - bjcm[3] * 10. - bjcm[1] * 10. + .5) + 1;
- do {
- --pdimen;
- bjcm[1] = pdev->height / pdev->y_pixels_per_inch
- - bjcm[3] - (float) pdimen / 10.;
- } while (bjcm[1] < BJC_LOWER_LIMIT);
+ byte pdimen = (byte)
+ (pdev->height / pdev->y_pixels_per_inch * 10.
+ - bjcm[3] * 10. - bjcm[1] * 10. + .5) + 1;
+ do {
+ --pdimen;
+ bjcm[1] = pdev->height / pdev->y_pixels_per_inch
+ - bjcm[3] - (float) pdimen / 10.;
+ } while (bjcm[1] < BJC_LOWER_LIMIT);
}
break;
@@ -873,40 +871,40 @@ hp_colour_open(gx_device *pdev, int ptype)
static int
cdj_get_params(gx_device *pdev, gs_param_list *plist)
{ int code = gdev_prn_get_params(pdev, plist);
- if ( code < 0 ||
- (code = param_write_int(plist, "BlackCorrect", (int *)&cdj->correction)) < 0 ||
- (code = param_write_int(plist, "Shingling", &cdj->shingling)) < 0 ||
- (code = param_write_int(plist, "Depletion", &cdj->depletion)) < 0
- )
- return code;
+ if ( code < 0 ||
+ (code = param_write_int(plist, "BlackCorrect", (int *)&cdj->correction)) < 0 ||
+ (code = param_write_int(plist, "Shingling", &cdj->shingling)) < 0 ||
+ (code = param_write_int(plist, "Depletion", &cdj->depletion)) < 0
+ )
+ return code;
- return code;
+ return code;
}
/* Put parameters. */
static int
cdj_put_params(gx_device *pdev, gs_param_list *plist)
{ int correction = cdj->correction;
- int shingling = cdj->shingling;
- int depletion = cdj->depletion;
- int bpp = 0;
- int code = 0;
+ int shingling = cdj->shingling;
+ int depletion = cdj->depletion;
+ int bpp = 0;
+ int code = 0;
- code = cdj_put_param_int(plist, "BlackCorrect", &correction, 0, 9, code);
- code = cdj_put_param_int(plist, "Shingling", &shingling, 0, 2, code);
- code = cdj_put_param_int(plist, "Depletion", &depletion, 1, 3, code);
- code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
+ code = cdj_put_param_int(plist, "BlackCorrect", &correction, 0, 9, code);
+ code = cdj_put_param_int(plist, "Shingling", &shingling, 0, 2, code);
+ code = cdj_put_param_int(plist, "Depletion", &depletion, 1, 3, code);
+ code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
- if ( code < 0 )
- return code;
- code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
- if ( code < 0 )
- return code;
+ if ( code < 0 )
+ return code;
+ code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
+ if ( code < 0 )
+ return code;
- cdj->correction = correction;
- cdj->shingling = shingling;
- cdj->depletion = depletion;
- return 0;
+ cdj->correction = correction;
+ cdj->shingling = shingling;
+ cdj->depletion = depletion;
+ return 0;
}
/* Added parameters for PaintJet XL and PaintJet XL300 */
@@ -917,43 +915,43 @@ cdj_put_params(gx_device *pdev, gs_param_list *plist)
static int
pjxl_get_params(gx_device *pdev, gs_param_list *plist)
{ int code = gdev_prn_get_params(pdev, plist);
- if ( code < 0 ||
- (code = param_write_int(plist, "PrintQuality", &pjxl->printqual)) < 0 ||
- (code = param_write_int(plist, "RenderType", &pjxl->rendertype)) < 0
- )
- return code;
+ if ( code < 0 ||
+ (code = param_write_int(plist, "PrintQuality", &pjxl->printqual)) < 0 ||
+ (code = param_write_int(plist, "RenderType", &pjxl->rendertype)) < 0
+ )
+ return code;
- return code;
+ return code;
}
/* Put parameters. */
static int
pjxl_put_params(gx_device *pdev, gs_param_list *plist)
{ int printqual = pjxl->printqual;
- int rendertype = pjxl->rendertype;
- int bpp = 0, real_bpp = 0;
- int code = 0;
-
- code = cdj_put_param_int(plist, "PrintQuality", &printqual, -1, 1, code);
- code = cdj_put_param_int(plist, "RenderType", &rendertype, 0, 10, code);
- code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
-
- if ( code < 0 )
- return code;
- real_bpp = bpp;
- if ( rendertype > 0 )
- { /* If printer is doing the dithering, we must have a
- * true-colour mode, ie. 16 or 24 bits per pixel */
- if ( bpp > 0 && bpp < 16 )
- real_bpp = 24;
- }
- code = cdj_put_param_bpp(pdev, plist, bpp, real_bpp, 0);
- if ( code < 0 )
- return code;
-
- pjxl->printqual = printqual;
- pjxl->rendertype = rendertype;
- return 0;
+ int rendertype = pjxl->rendertype;
+ int bpp = 0, real_bpp = 0;
+ int code = 0;
+
+ code = cdj_put_param_int(plist, "PrintQuality", &printqual, -1, 1, code);
+ code = cdj_put_param_int(plist, "RenderType", &rendertype, 0, 10, code);
+ code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
+
+ if ( code < 0 )
+ return code;
+ real_bpp = bpp;
+ if ( rendertype > 0 )
+ { /* If printer is doing the dithering, we must have a
+ * true-colour mode, ie. 16 or 24 bits per pixel */
+ if ( bpp > 0 && bpp < 16 )
+ real_bpp = 24;
+ }
+ code = cdj_put_param_bpp(pdev, plist, bpp, real_bpp, 0);
+ if ( code < 0 )
+ return code;
+
+ pjxl->printqual = printqual;
+ pjxl->rendertype = rendertype;
+ return 0;
}
/* Added parameters for PaintJet */
@@ -963,11 +961,11 @@ pjxl_put_params(gx_device *pdev, gs_param_list *plist)
static int
pj_put_params(gx_device *pdev, gs_param_list *plist)
{ int bpp = 0;
- int code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, 0);
+ int code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, 0);
- if ( code < 0 )
- return code;
- return cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
+ if ( code < 0 )
+ return code;
+ return cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
}
static stringParamDescription bjc_processColorsStrings[] = {
@@ -1021,8 +1019,8 @@ bjc_get_params(gx_device *pdev, gs_param_list *plist)
if (code < 0) return_error(code);
if ((ncode = param_write_bool(plist, BJC_OPTION_MANUALFEED,
- &bjcparams.manualFeed)) < 0) {
- code = ncode;
+ &bjcparams.manualFeed)) < 0) {
+ code = ncode;
}
code = get_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
@@ -1030,56 +1028,56 @@ bjc_get_params(gx_device *pdev, gs_param_list *plist)
code = get_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
(bjc->ptype == BJC800 ? bjc800_printQualityStrings :
- bjc600_printQualityStrings), bjcparams.printQuality,
- true, code);
+ bjc600_printQualityStrings), bjcparams.printQuality,
+ true, code);
code = get_param_string(plist, (unsigned char *)BJC_OPTION_DITHERINGTYPE, &dithering,
bjc_ditheringTypeStrings, bjcparams.ditheringType, true, code);
if ((ncode = param_write_int(plist, BJC_OPTION_PRINTCOLORS,
- &bjcparams.printColors)) < 0) {
- code = ncode;
+ &bjcparams.printColors)) < 0) {
+ code = ncode;
}
if ((ncode = (bjcparams.mediaWeight_isSet ?
- param_write_int(plist, BJC_OPTION_MEDIAWEIGHT,
- &bjcparams.mediaWeight) :
- param_write_null(plist, BJC_OPTION_MEDIAWEIGHT))) < 0) {
- code = ncode;
+ param_write_int(plist, BJC_OPTION_MEDIAWEIGHT,
+ &bjcparams.mediaWeight) :
+ param_write_null(plist, BJC_OPTION_MEDIAWEIGHT))) < 0) {
+ code = ncode;
}
if (bjc->ptype != BJC800) {
- if ((ncode = param_write_bool(plist, BJC_OPTION_MONOCHROMEPRINT,
- &bjc600params.monochromePrint)) < 0) {
- code = ncode;
- }
+ if ((ncode = param_write_bool(plist, BJC_OPTION_MONOCHROMEPRINT,
+ &bjc600params.monochromePrint)) < 0) {
+ code = ncode;
+ }
}
/**/ {
- float version;
- gs_param_string versionString;
+ float version;
+ gs_param_string versionString;
- bool bTrue = true;
+ bool bTrue = true;
- version = bjcversion(pdev);
- versionString.data = (byte *)bjcversionstring(pdev);
+ version = bjcversion(pdev);
+ versionString.data = (byte *)bjcversionstring(pdev);
- versionString.size = strlen((char *)versionString.data);
- versionString.persistent = true;
+ versionString.size = strlen((char *)versionString.data);
+ versionString.persistent = true;
- if ((ncode = param_write_float(plist, BJC_DEVINFO_VERSION,
- &version)) < 0) {
- code = ncode;
- }
- if ((ncode = param_write_string(plist, BJC_DEVINFO_VERSIONSTRING,
- &versionString)) < 0) {
- code = ncode;
- }
+ if ((ncode = param_write_float(plist, BJC_DEVINFO_VERSION,
+ &version)) < 0) {
+ code = ncode;
+ }
+ if ((ncode = param_write_string(plist, BJC_DEVINFO_VERSIONSTRING,
+ &versionString)) < 0) {
+ code = ncode;
+ }
- if ((ncode = param_write_bool(plist, BJC_DEVINFO_OUTPUTFACEUP,
- &bTrue)) < 0) {
- code = ncode;
- }
+ if ((ncode = param_write_bool(plist, BJC_DEVINFO_OUTPUTFACEUP,
+ &bTrue)) < 0) {
+ code = ncode;
+ }
}
return code;
@@ -1112,86 +1110,86 @@ bjc_put_params(gx_device *pdev, gs_param_list *plist)
gs_param_float_array hwra;
if (bjc->ptype != BJC800) {
- new600Params = bjc600params;
- params = (bjc_params*) &new600Params;
+ new600Params = bjc600params;
+ params = (bjc_params*) &new600Params;
} else {
- new800Params = bjc800params;
- params = (bjc_params*) &new800Params;
+ new800Params = bjc800params;
+ params = (bjc_params*) &new800Params;
}
if ((code = cdj_put_param_int(plist, "BitsPerPixel",
- &bpp, 1, 32, code)) != 1) {
+ &bpp, 1, 32, code)) != 1) {
bpp = pdev->color_info.depth;
}
if ((code = put_param_string(plist, (unsigned char *)"ProcessColorModel",
- &pprocesscolors, bjc_processColorsStrings, &ccomps, code)) != 1) {
+ &pprocesscolors, bjc_processColorsStrings, &ccomps, code)) != 1) {
ccomps = pdev->color_info.num_components;
}
if ((ncode = param_read_bool(plist, oname = BJC_OPTION_MANUALFEED,
- &params->manualFeed)) < 0) {
- param_signal_error(plist, oname, code = ncode);
+ &params->manualFeed)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
}
code = put_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
bjc_mediaTypeStrings, &params->mediaType, code);
code = cdj_put_param_int(plist, BJC_OPTION_PRINTCOLORS,
- &params->printColors, 0, 15, code);
+ &params->printColors, 0, 15, code);
code = put_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
- (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
- bjc600_printQualityStrings), &params->printQuality, code);
+ (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
+ bjc600_printQualityStrings), &params->printQuality, code);
code = put_param_string(plist, (unsigned char *)BJC_OPTION_DITHERINGTYPE, &dithering,
bjc_ditheringTypeStrings, &params->ditheringType, code);
switch (ncode = param_read_int(plist,
- oname = BJC_OPTION_MEDIAWEIGHT, &params->mediaWeight)) {
- case 0:
- if (params->mediaWeight <= 0) {
- ncode = gs_error_rangecheck;
- } else {
- params->mediaWeight_isSet = 1;
- break;
- }
- goto mwe;
-
- default:
- if ((ncode = param_read_null(plist, oname)) == 0) {
- params->mediaWeight_isSet = 0;
- break;
- }
+ oname = BJC_OPTION_MEDIAWEIGHT, &params->mediaWeight)) {
+ case 0:
+ if (params->mediaWeight <= 0) {
+ ncode = gs_error_rangecheck;
+ } else {
+ params->mediaWeight_isSet = 1;
+ break;
+ }
+ goto mwe;
+
+ default:
+ if ((ncode = param_read_null(plist, oname)) == 0) {
+ params->mediaWeight_isSet = 0;
+ break;
+ }
mwe: param_signal_error(plist, oname, code = ncode);
- case 1:
- break;
+ case 1:
+ break;
}
if (bjc->ptype != BJC800) {
- bjc600_params* params600 = (bjc600_params*) params;
- if ((ncode = param_read_bool(plist,
- oname = BJC_OPTION_MONOCHROMEPRINT,
- &params600->monochromePrint)) < 0) {
- param_signal_error(plist, oname, code = ncode);
- }
+ bjc600_params* params600 = (bjc600_params*) params;
+ if ((ncode = param_read_bool(plist,
+ oname = BJC_OPTION_MONOCHROMEPRINT,
+ &params600->monochromePrint)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
+ }
}
if ((ncode = cdj_param_check_float(plist, BJC_DEVINFO_VERSION,
- bjcversion(pdev), true)) < 0) {
- code = ncode;
+ bjcversion(pdev), true)) < 0) {
+ code = ncode;
}
if ((ncode = cdj_param_check_string(plist, BJC_DEVINFO_VERSIONSTRING,
- bjcversionstring(pdev), true)) < 0) {
- code = ncode;
+ bjcversionstring(pdev), true)) < 0) {
+ code = ncode;
}
if ((ncode = param_read_bool(plist, oname = BJC_DEVINFO_OUTPUTFACEUP,
- &aBool)) < 0) {
- param_signal_error(plist, oname, code = ncode);
+ &aBool)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
} else if (aBool != true) {
- param_signal_error(plist, oname, code = ncode = gs_error_rangecheck);
+ param_signal_error(plist, oname, code = ncode = gs_error_rangecheck);
}
/* Check for invalid resolution. The array macros are taken from
@@ -1199,62 +1197,62 @@ mwe: param_signal_error(plist, oname, code = ncode);
of param_name, code and ecode respectively. */
BEGIN_ARRAY_PARAM(param_read_float_array, "HWResolution", hwra, 2, hwre)
- if ( hwra.data[0] <= 0 || hwra.data[1] <= 0 ||
- hwra.data[0] != hwra.data[1] )
- ncode = gs_error_rangecheck;
- else {
+ if ( hwra.data[0] <= 0 || hwra.data[1] <= 0 ||
+ hwra.data[0] != hwra.data[1] )
+ ncode = gs_error_rangecheck;
+ else {
#ifdef BJC_STRICT
- if (hwra.data[0] != BJC_RESOLUTION_LOW &&
- hwra.data[0] != BJC_RESOLUTION_NORMAL &&
- hwra.data[0] != BJC_RESOLUTION_HIGH) {
- ncode = gs_error_rangecheck;
- }
+ if (hwra.data[0] != BJC_RESOLUTION_LOW &&
+ hwra.data[0] != BJC_RESOLUTION_NORMAL &&
+ hwra.data[0] != BJC_RESOLUTION_HIGH) {
+ ncode = gs_error_rangecheck;
+ }
#else
- /* A small hack for checking resolution without logarithms. */
+ /* A small hack for checking resolution without logarithms. */
- /**/ {
- int n;
+ /**/ {
+ int n;
- for (n = 0; n < 8 * sizeof(n) / BJC_RESOLUTION_BASE; ++n) {
- float res = (float)(BJC_RESOLUTION_BASE * (1 << n));
+ for (n = 0; n < 8 * sizeof(n) / BJC_RESOLUTION_BASE; ++n) {
+ float res = (float)(BJC_RESOLUTION_BASE * (1 << n));
- if (res == hwra.data[0]) break;
+ if (res == hwra.data[0]) break;
- if (res > hwra.data[0]) {
- ncode = gs_error_rangecheck;
- }
- }
+ if (res > hwra.data[0]) {
+ ncode = gs_error_rangecheck;
+ }
+ }
- if (n == 8 * sizeof(n)) {
- ncode = gs_error_rangecheck;
- }
- }
+ if (n == 8 * sizeof(n)) {
+ ncode = gs_error_rangecheck;
+ }
+ }
#endif
- if (ncode < 0) {
- code = ncode;
- } else {
- break;
- }
- }
+ if (ncode < 0) {
+ code = ncode;
+ } else {
+ break;
+ }
+ }
END_PARAM(hwra, hwre)
if ((ncode = cdj_put_param_bpp(pdev, plist, bpp, bpp, ccomps)) < 0) {
- code = ncode;
+ code = ncode;
}
if (code < 0)
- return code;
+ return code;
if (bpp == 1) {
- params->ditheringType = BJC_DITHER_NONE;
+ params->ditheringType = BJC_DITHER_NONE;
}
/* Write values that did change */
if (bjc->ptype != BJC800) {
- bjc600params = new600Params;
+ bjc600params = new600Params;
} else {
- bjc800params = new800Params;
+ bjc800params = new800Params;
}
return code;
@@ -1387,14 +1385,14 @@ bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
#define C 8
#define FSdither(inP, out, errP, Err, Bit, Offset, Element)\
- oldErr = Err;\
- Err = (errP[Element] + ((Err * 7 + C) >> 4) + ((int)inP[Element] << SHIFT));\
- if (Err > THRESHOLD) {\
- out |= Bit;\
- Err -= MAXVALUE;\
- }\
- errP[Element + Offset] += ((Err * 3 + C) >> 4);\
- errP[Element] = ((Err * 5 + oldErr + C) >> 4);
+ oldErr = Err;\
+ Err = (errP[Element] + ((Err * 7 + C) >> 4) + ((int)inP[Element] << SHIFT));\
+ if (Err > THRESHOLD) {\
+ out |= Bit;\
+ Err -= MAXVALUE;\
+ }\
+ errP[Element + Offset] += ((Err * 3 + C) >> 4);\
+ errP[Element] = ((Err * 5 + oldErr + C) >> 4);
/* Here we rely on compiler optimisation to remove lines of the form
* (if (1 >= 4) {...}, ie. the constant boolean expressions */
@@ -1409,51 +1407,51 @@ bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
{\
if (scan == 0) { /* going_up */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int oldErr;\
- bitmask = 0x80;\
- for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
- if (n >= 4) {\
- FSdither(dp, k, ep, kErr, bitmask, -n, 0);\
- }\
- if (n >= 3) {\
- FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
- FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
- }\
- FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
- dp += n, ep += n;\
- }\
- if (n >= 4)\
- *kP++ = k;\
- if (n >= 3) {\
- *cP++ = c;\
+ byte c, y, m, k, bitmask;\
+ int oldErr;\
+ bitmask = 0x80;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
+ if (n >= 4) {\
+ FSdither(dp, k, ep, kErr, bitmask, -n, 0);\
+ }\
+ if (n >= 3) {\
+ FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
+ FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
+ }\
+ FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
+ dp += n, ep += n;\
+ }\
+ if (n >= 4)\
+ *kP++ = k;\
+ if (n >= 3) {\
+ *cP++ = c;\
*mP++ = m;\
- }\
- *yP++ = y;\
+ }\
+ *yP++ = y;\
}\
} else { /* going_down */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int oldErr;\
- bitmask = 0x01;\
- for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
+ byte c, y, m, k, bitmask;\
+ int oldErr;\
+ bitmask = 0x01;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
dp -= n, ep -= n;\
- FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
- if (n >= 3) {\
- FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
- FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
- }\
- if (n >= 4) {\
- FSdither(dp, k, ep, kErr, bitmask, n, 0);\
- }\
- }\
- *--yP = y;\
- if (n >= 3)\
- { *--mP = m;\
- *--cP = c;\
- }\
- if (n >= 4)\
- *--kP = k;\
+ FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
+ if (n >= 3) {\
+ FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
+ FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
+ }\
+ if (n >= 4) {\
+ FSdither(dp, k, ep, kErr, bitmask, n, 0);\
+ }\
+ }\
+ *--yP = y;\
+ if (n >= 3)\
+ { *--mP = m;\
+ *--cP = c;\
+ }\
+ if (n >= 4)\
+ *--kP = k;\
}\
}\
}
@@ -1464,67 +1462,67 @@ bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
{\
if (scan == 0) { /* going_up */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int oldErr;\
- bitmask = 0x80;\
- for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
- if (n >= 4) {\
- if (*dp) {\
- FSdither(dp, k, ep, kErr, bitmask, -n, 0);\
- cErr = mErr = yErr = 0;\
- } else {\
- FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
- FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
- FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
- }\
- } else {\
- if (n >= 3) {\
- FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
- FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
- }\
- FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
- }\
- dp += n, ep += n;\
- }\
- if (n >= 4)\
- *kP++ = k;\
- if (n >= 3) {\
- *cP++ = c;\
+ byte c, y, m, k, bitmask;\
+ int oldErr;\
+ bitmask = 0x80;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
+ if (n >= 4) {\
+ if (*dp) {\
+ FSdither(dp, k, ep, kErr, bitmask, -n, 0);\
+ cErr = mErr = yErr = 0;\
+ } else {\
+ FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
+ FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
+ FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
+ }\
+ } else {\
+ if (n >= 3) {\
+ FSdither(dp, c, ep, cErr, bitmask, -n, n - 3);\
+ FSdither(dp, m, ep, mErr, bitmask, -n, n - 2);\
+ }\
+ FSdither(dp, y, ep, yErr, bitmask, -n, n - 1);\
+ }\
+ dp += n, ep += n;\
+ }\
+ if (n >= 4)\
+ *kP++ = k;\
+ if (n >= 3) {\
+ *cP++ = c;\
*mP++ = m;\
- }\
- *yP++ = y;\
+ }\
+ *yP++ = y;\
}\
} else { /* going_down */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int oldErr;\
- bitmask = 0x01;\
- for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
+ byte c, y, m, k, bitmask;\
+ int oldErr;\
+ bitmask = 0x01;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
dp -= n, ep -= n;\
- if (n >= 4) {\
+ if (n >= 4) {\
if (*dp) {\
- FSdither(dp, k, ep, kErr, bitmask, n, 0);\
- cErr = mErr = yErr = 0;\
- } else {\
- FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
- FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
- FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
- }\
- } else {\
- FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
- if (n >= 3) {\
- FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
- FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
- }\
- }\
- }\
- *--yP = y;\
- if (n >= 3)\
- { *--mP = m;\
- *--cP = c;\
- }\
- if (n >= 4)\
- *--kP = k;\
+ FSdither(dp, k, ep, kErr, bitmask, n, 0);\
+ cErr = mErr = yErr = 0;\
+ } else {\
+ FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
+ FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
+ FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
+ }\
+ } else {\
+ FSdither(dp, y, ep, yErr, bitmask, n, n - 1);\
+ if (n >= 3) {\
+ FSdither(dp, m, ep, mErr, bitmask, n, n - 2);\
+ FSdither(dp, c, ep, cErr, bitmask, n, n - 3);\
+ }\
+ }\
+ }\
+ *--yP = y;\
+ if (n >= 3)\
+ { *--mP = m;\
+ *--cP = c;\
+ }\
+ if (n >= 4)\
+ *--kP = k;\
}\
}\
}
@@ -1542,49 +1540,49 @@ bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
{\
if (scan == 0) { /* going_up */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- bitmask = 0x80;\
- for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
- if (n >= 4) {\
- CPbit(dp, k, bitmask, 0);\
- } \
+ byte c, y, m, k, bitmask;\
+ bitmask = 0x80;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask >>= 1) {\
+ if (n >= 4) {\
+ CPbit(dp, k, bitmask, 0);\
+ } \
if (n >= 3) {\
- CPbit(dp, c, bitmask, n - 3);\
- CPbit(dp, m, bitmask, n - 2);\
- }\
- CPbit(dp, y, bitmask, n - 1);\
- dp += n, ep += n;\
- }\
- if (n >= 4)\
- *kP++ = k;\
- if (n >= 3) {\
- *cP++ = c;\
+ CPbit(dp, c, bitmask, n - 3);\
+ CPbit(dp, m, bitmask, n - 2);\
+ }\
+ CPbit(dp, y, bitmask, n - 1);\
+ dp += n, ep += n;\
+ }\
+ if (n >= 4)\
+ *kP++ = k;\
+ if (n >= 3) {\
+ *cP++ = c;\
*mP++ = m;\
- }\
- *yP++ = y;\
+ }\
+ *yP++ = y;\
}\
} else { /* going_down */\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- bitmask = 0x01;\
- for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
+ byte c, y, m, k, bitmask;\
+ bitmask = 0x01;\
+ for (c = m = y = k = 0; bitmask != 0; bitmask <<= 1) {\
dp -= n, ep -= n;\
- if (n >= 4) {\
+ if (n >= 4) {\
CPbit(dp, k, bitmask, 0);\
- }\
- if (n >= 3) {\
- CPbit(dp, m, bitmask, n - 2);\
- CPbit(dp, c, bitmask, n - 3);\
- }\
- CPbit(dp, y, bitmask, n - 1);\
- }\
- *--yP = y;\
- if (n >= 3)\
- { *--mP = m;\
- *--cP = c;\
- }\
- if (n >= 4)\
- *--kP = k;\
+ }\
+ if (n >= 3) {\
+ CPbit(dp, m, bitmask, n - 2);\
+ CPbit(dp, c, bitmask, n - 3);\
+ }\
+ CPbit(dp, y, bitmask, n - 1);\
+ }\
+ *--yP = y;\
+ if (n >= 3)\
+ { *--mP = m;\
+ *--cP = c;\
+ }\
+ if (n >= 4)\
+ *--kP = k;\
}\
}\
}
@@ -1598,7 +1596,6 @@ bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* To calculate buffer size as next greater multiple of both parameter and W */
#define calc_buffsize(a, b) (((((a) + ((b) * W) - 1) / ((b) * W))) * W)
-
/*
* Miscellaneous functions for Canon BJC-600 printers in raster command mode.
*/
@@ -1616,7 +1613,6 @@ bjc_cmd(byte cmd, int argsize, byte* arg, gx_device_printer* pdev,
return 0;
}
-
static int
bjc_raster_cmd_sub(char c, int rastsize, byte* data, FILE* f)
{
@@ -1634,29 +1630,29 @@ bjc_raster_cmd(int c_id, int rastsize, byte* data, gx_device_printer* pdev,
FILE* f)
{
if (bjcparams.printColors == BJC_COLOR_ALLBLACK) {
- bjc_raster_cmd_sub('K', rastsize, data, f);
+ bjc_raster_cmd_sub('K', rastsize, data, f);
} else if (pdev->color_info.num_components == 1) {
- if (bjcparams.printColors & BJC_COLOR_BLACK) {
- bjc_raster_cmd_sub('K', rastsize, data, f);
- } else {
- if (bjcparams.printColors & BJC_COLOR_YELLOW)
- bjc_raster_cmd_sub('Y', rastsize, data, f);
- if (bjcparams.printColors & BJC_COLOR_MAGENTA)
- bjc_raster_cmd_sub('M', rastsize, data, f);
- if (bjcparams.printColors & BJC_COLOR_CYAN)
- bjc_raster_cmd_sub('C', rastsize, data, f);
- }
+ if (bjcparams.printColors & BJC_COLOR_BLACK) {
+ bjc_raster_cmd_sub('K', rastsize, data, f);
+ } else {
+ if (bjcparams.printColors & BJC_COLOR_YELLOW)
+ bjc_raster_cmd_sub('Y', rastsize, data, f);
+ if (bjcparams.printColors & BJC_COLOR_MAGENTA)
+ bjc_raster_cmd_sub('M', rastsize, data, f);
+ if (bjcparams.printColors & BJC_COLOR_CYAN)
+ bjc_raster_cmd_sub('C', rastsize, data, f);
+ }
}else { /* Color decomposition */
- static byte ymckCodes[] = {
- BJC_COLOR_YELLOW,
- BJC_COLOR_MAGENTA,
- BJC_COLOR_CYAN,
- BJC_COLOR_BLACK,
- };
-
- if (bjcparams.printColors & (int) ymckCodes[c_id]) {
- bjc_raster_cmd_sub("YMCK"[c_id], rastsize, data, f);
- }
+ static byte ymckCodes[] = {
+ BJC_COLOR_YELLOW,
+ BJC_COLOR_MAGENTA,
+ BJC_COLOR_CYAN,
+ BJC_COLOR_BLACK,
+ };
+
+ if (bjcparams.printColors & (int) ymckCodes[c_id]) {
+ bjc_raster_cmd_sub("YMCK"[c_id], rastsize, data, f);
+ }
}
return 0;
@@ -1679,13 +1675,13 @@ bjc_init_page(gx_device_printer* pdev, FILE* f)
margins for big papers. */
switch (bjc->ptype) {
- case BJC800:
- if (pagemargins[2] > 114) pagemargins[2] = 114;
- break;
+ case BJC800:
+ if (pagemargins[2] > 114) pagemargins[2] = 114;
+ break;
- default:
- if (pagemargins[2] > 80) pagemargins[2] = 80;
- break;
+ default:
+ if (pagemargins[2] > 80) pagemargins[2] = 80;
+ break;
}
/* Initialize resolution argument. */
@@ -1730,32 +1726,32 @@ bjc_init_page(gx_device_printer* pdev, FILE* f)
#else
if (0) {
#endif
- byte printmode[2];
+ byte printmode[2];
- printmode[0] = bjcparams.printQuality;
+ printmode[0] = bjcparams.printQuality;
- /* Modes not used are 3 (CN, Color Normal) and 2 (TP+ (?)) */
+ /* Modes not used are 3 (CN, Color Normal) and 2 (TP+ (?)) */
- switch (bjcparams.printQuality) {
- case BJC_QUALITY_DRAFT:
- printmode[0] = 4; /* Draft */
- break;
- }
+ switch (bjcparams.printQuality) {
+ case BJC_QUALITY_DRAFT:
+ printmode[0] = 4; /* Draft */
+ break;
+ }
- printmode[1] = (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
- bjc800thickpaper());
+ printmode[1] = (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
+ bjc800thickpaper());
- bjc_cmd('c', 2, printmode, pdev, f);
+ bjc_cmd('c', 2, printmode, pdev, f);
} else /* BJC600 */ {
- byte printmeth[3];
+ byte printmeth[3];
- printmeth[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
- printmeth[1] = (bjcparams.mediaType << 4) + bjcparams.printQuality;
- printmeth[2] = (bjcparams.printQuality == BJC_QUALITY_HIGH ?
- 0x10 : 0) + (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
- bjc600thickpaper());
+ printmeth[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
+ printmeth[1] = (bjcparams.mediaType << 4) + bjcparams.printQuality;
+ printmeth[2] = (bjcparams.printQuality == BJC_QUALITY_HIGH ?
+ 0x10 : 0) + (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
+ bjc600thickpaper());
- bjc_cmd('c', 3, printmeth, pdev, f);
+ bjc_cmd('c', 3, printmeth, pdev, f);
}
/* Set raster resolution */
@@ -1769,11 +1765,11 @@ static int
bjc_v_skip(int n, gx_device_printer* pdev, FILE* f)
{
if (n) {
- fputs("\033(e", f);
- putc(2, f);
- putc(0, f);
- putc(n / 256, f);
- putc(n % 256, f);
+ fputs("\033(e", f);
+ putc(2, f);
+ putc(0, f);
+ putc(n / 256, f);
+ putc(n % 256, f);
}
return 0;
@@ -1799,7 +1795,6 @@ bjc_compress(const byte *row, const byte *end_row, byte *compressed)
register const byte *exam = row;
register byte *cptr = compressed; /* output pointer into compressed bytes */
-
while ( exam < end_row ) {
/* Search ahead in the input looking for a run */
/* of at least 4 identical bytes. */
@@ -1812,11 +1807,10 @@ bjc_compress(const byte *row, const byte *end_row, byte *compressed)
while ( exam < end_row ) {
test2 = *++exam;
if ( test == test2 )
- break;
+ break;
test = test2;
}
-
/* Find out how long the run is */
end_dis = exam - 1;
if ( exam == end_row ) { /* no run */
@@ -1827,12 +1821,10 @@ bjc_compress(const byte *row, const byte *end_row, byte *compressed)
while ( next < end_row && *next == test ) next++;
}
-
/* Now [compr..end_dis) should be encoded as dissimilar, */
/* and [end_dis..next) should be encoded as similar. */
/* Note that either of these ranges may be empty. */
-
for ( ; ; ) { /* Encode up to 128 dissimilar bytes */
uint count = end_dis - compr; /* uint for faster switch */
switch ( count ) { /* Use memcpy only if it's worthwhile. */
@@ -1842,32 +1834,31 @@ bjc_compress(const byte *row, const byte *end_row, byte *compressed)
case 3: cptr[3] = compr[2];
case 2: cptr[2] = compr[1];
case 1: cptr[1] = compr[0];
- *cptr = count - 1;
- cptr += count + 1;
+ *cptr = count - 1;
+ cptr += count + 1;
case 0: /* all done */
- break;
+ break;
default:
- if ( count > 128 ) count = 128;
- *cptr++ = count - 1;
- memcpy(cptr, compr, count);
- cptr += count, compr += count;
- continue;
+ if ( count > 128 ) count = 128;
+ *cptr++ = count - 1;
+ memcpy(cptr, compr, count);
+ cptr += count, compr += count;
+ continue;
}
break;
}
-
{ /* Encode up to 128 similar bytes. */
/* Note that count may be <0 at end of row. */
int count = next - end_dis;
if (next < end_row || test != 0)
- while ( count > 0 ) {
+ while ( count > 0 ) {
- int this = (count > 128 ? 128 : count);
- *cptr++ = 257 - this;
- *cptr++ = (byte)test;
- count -= this;
- }
+ int this = (count > 128 ? 128 : count);
+ *cptr++ = 257 - this;
+ *cptr++ = (byte)test;
+ count -= this;
+ }
exam = next;
}
}
@@ -1892,18 +1883,15 @@ typedef struct {
const gs_memory_t *mem;
} ep_globals;
-
#define row_bytes (img_rows / 8)
#define min_rows (32) /* for optimization of text image printing */
-
static int
ep_print_image(FILE *prn_stream, ep_globals *eg, char cmd, byte *data, int size)
{
int i, real_rows;
static const char color[4] = {4,1,2,0};
-
switch (cmd) {
case 3: /* Black */
case 2: /* Cyan */
@@ -1930,7 +1918,6 @@ ep_print_image(FILE *prn_stream, ep_globals *eg, char cmd, byte *data, int size)
case 'F': /* flush print buffer */
if (!eg->ln_idx) return 0; /* The end of the page. */
-
/* before print the image, perform vertical skip. */
while (eg->vskip1 >= (255*2)) {
fputs("\033J\377", prn_stream); /* n/180in. feeding */
@@ -1945,7 +1932,6 @@ ep_print_image(FILE *prn_stream, ep_globals *eg, char cmd, byte *data, int size)
fputs("\033|J", prn_stream); putc(0, prn_stream); putc(eg->vskip1, prn_stream);
}
-
/* Optimize the number of nozzles to be used. */
if (eg->ln_idx > 56) { /* use 64 nozzles */
real_rows = 64;
@@ -1957,74 +1943,65 @@ ep_print_image(FILE *prn_stream, ep_globals *eg, char cmd, byte *data, int size)
real_rows = 32;
}
-
for (i = 0; i < eg->num_comps; i++) {
int lnum, hskip, print_size, img_rows;
byte *p0, *p1, *p2, *p3;
byte *inp, *inbuf, *outp, *outbuf;
-
img_rows = real_rows; /* Note that this img_rows is not the one in
- * the globals struct. */
+ * the globals struct. */
outbuf = eg->print_buf;
-
/* Transpose raster image for serial printer image */
for (lnum=0; lnum < img_rows; lnum+=8, outbuf++) {
- inbuf = inp = eg->raster_buf[i][lnum];
- for (outp = outbuf; inp < inbuf+eg->plane_size; inp++, outp += img_rows) {
- memflip8x8(inp, eg->plane_size, outp, row_bytes);
- }
+ inbuf = inp = eg->raster_buf[i][lnum];
+ for (outp = outbuf; inp < inbuf+eg->plane_size; inp++, outp += img_rows) {
+ memflip8x8(inp, eg->plane_size, outp, row_bytes);
+ }
}
-
/* Set color */
if (eg->num_comps == 1) {
- /* Don't set color (to enable user setting). */
- putc('\015', prn_stream);
+ /* Don't set color (to enable user setting). */
+ putc('\015', prn_stream);
} else {
- /* set color to one of CMYK. */
- fputs("\015\033r", prn_stream);
- putc(color[i], prn_stream);
+ /* set color to one of CMYK. */
+ fputs("\015\033r", prn_stream);
+ putc(color[i], prn_stream);
}
-
*(outp = eg->print_buf + eg->plane_size * img_rows) = 1; /* sentinel */
-
p0 = p3 = eg->print_buf;
-
/* print image p0 to p1 and h skip p1 to p2 if p2<outp,
* then make p0=p2 and continue */
while (p0 < outp) {
- static const word zeros[8] = {0,0,0,0,0,0,0,0};
-
-
- if (p3 < outp) {
- /* p1 is the head of running zeros. */
- /* note that h skip unit is 1/180inch */
- for (p1 = p3; !memcmp(p3, zeros, row_bytes*2); p3 += row_bytes*2);
- /* p2 is the head of non zero image. */
- p2 = p3;
- redo:
- for (p3 += row_bytes; memcmp(p3, zeros, row_bytes); p3 += row_bytes);
- if (p3 < outp && memcmp(p3+row_bytes, zeros, row_bytes)) goto redo;
- } else p1 = p2 = outp;
-
-
- if (p0 < p1) { /* print the image between p0 and p1 */
- print_size = ((p1 < outp) ? p1 : outp) - p0;
- fputs("\033|B", prn_stream); putc(img_rows, prn_stream);
- fputshort(print_size, prn_stream);
- fwrite(p0, sizeof(byte), print_size, prn_stream);
- }
- if (p1 < p2) { /* skip running zeros from p1 to p2 */
- hskip = (((p2 < outp) ? p2 : outp) - p1) / row_bytes / 2;
- fputs("\033\\", prn_stream);
- fputshort(hskip, prn_stream);
- }
- p0 = p2;
+ static const word zeros[8] = {0,0,0,0,0,0,0,0};
+
+ if (p3 < outp) {
+ /* p1 is the head of running zeros. */
+ /* note that h skip unit is 1/180inch */
+ for (p1 = p3; !memcmp(p3, zeros, row_bytes*2); p3 += row_bytes*2);
+ /* p2 is the head of non zero image. */
+ p2 = p3;
+ redo:
+ for (p3 += row_bytes; memcmp(p3, zeros, row_bytes); p3 += row_bytes);
+ if (p3 < outp && memcmp(p3+row_bytes, zeros, row_bytes)) goto redo;
+ } else p1 = p2 = outp;
+
+ if (p0 < p1) { /* print the image between p0 and p1 */
+ print_size = ((p1 < outp) ? p1 : outp) - p0;
+ fputs("\033|B", prn_stream); putc(img_rows, prn_stream);
+ fputshort(print_size, prn_stream);
+ fwrite(p0, sizeof(byte), print_size, prn_stream);
+ }
+ if (p1 < p2) { /* skip running zeros from p1 to p2 */
+ hskip = (((p2 < outp) ? p2 : outp) - p1) / row_bytes / 2;
+ fputs("\033\\", prn_stream);
+ fputshort(hskip, prn_stream);
+ }
+ p0 = p2;
}
}
return ep_print_image(prn_stream, eg, 'R', 0, eg->vskip2 + eg->ln_idx);
@@ -2039,11 +2016,9 @@ ep_print_image(FILE *prn_stream, ep_globals *eg, char cmd, byte *data, int size)
return 1;
}
-
/* NOT REACHED */
}
-
/* Send the page to the printer. Compress each scan line. */
static int
hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
@@ -2092,13 +2067,13 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
case PJXL180:
if (pjxl->rendertype > 0) {
if (bits_per_pixel < 16)
- pjxl->rendertype = 0;
+ pjxl->rendertype = 0;
else {
- /* Control codes for CID sequence */
- cid_string = (bits_per_pixel == 16) ? CONFIG_16BIT : CONFIG_24BIT;
- /* Pretend we're a monobit device so we send the data out unchanged */
- bits_per_pixel = storage_bpp = expanded_bpp = 1;
- num_comps = 1;
+ /* Control codes for CID sequence */
+ cid_string = (bits_per_pixel == 16) ? CONFIG_16BIT : CONFIG_24BIT;
+ /* Pretend we're a monobit device so we send the data out unchanged */
+ bits_per_pixel = storage_bpp = expanded_bpp = 1;
+ num_comps = 1;
}
}
break;
@@ -2106,7 +2081,7 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
if (cprn_device->cmyk <= 0) {
if (storage_bpp == 8 && num_comps >= 3)
- bits_per_pixel = expanded_bpp = 3; /* Only 3 bits of each byte used */
+ bits_per_pixel = expanded_bpp = 3; /* Only 3 bits of each byte used */
}
plane_size = calc_buffsize(line_size, storage_bpp);
@@ -2122,17 +2097,17 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
num_comps * 8; /* 8, 24 or 32 bits */
if (cprn_device->cmyk > 0) { /* Use CMYK dithering algorithm. */
- errbuff_size = 4 * (5 + 1 + 1 + line_size + 1 + 2) * I;
+ errbuff_size = 4 * (5 + 1 + 1 + line_size + 1 + 2) * I;
} else { /* Use original (RGB) dithering. */
- errbuff_size = /* 4n extra values for line ends */
- calc_buffsize((plane_size * expanded_bpp + num_comps * 4) * I, 1);
+ errbuff_size = /* 4n extra values for line ends */
+ calc_buffsize((plane_size * expanded_bpp + num_comps * 4) * I, 1);
}
}
databuff_size = plane_size * storage_bpp;
storage_size_words = ((plane_size + plane_size) * num_comps +
- databuff_size + errbuff_size + outbuff_size) / W;
+ databuff_size + errbuff_size + outbuff_size) / W;
storage = (ulong *) gs_malloc(pdev->memory, storage_size_words, W, "hp_colour_print_page");
eg.storage_size_words = (plane_size * (num_comps + 1)) / W * eg.img_rows
@@ -2187,8 +2162,8 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
}
for (i = 0; i < num_comps; i++) {
for (j = 0; j < eg.img_rows; j++) {
- eg.raster_buf[i][j] = ep_p;
- ep_p += plane_size;
+ eg.raster_buf[i][j] = ep_p;
+ ep_p += plane_size;
}
/* Make a sentinel and align to word size. */
eg.print_buf = (byte *)((word)(ep_p + sizeof(word)) & ~(sizeof(word)-1));
@@ -2205,9 +2180,9 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
bjc_init_page(pdev, prn_stream);
} else {
if (ptype == LJ4DITH) {
- fputs("\033*rB", prn_stream);
+ fputs("\033*rB", prn_stream);
} else {
- fputs("\033*rbC", prn_stream); /* End raster graphics */
+ fputs("\033*rbC", prn_stream); /* End raster graphics */
}
fprintf(prn_stream, "\033*t%dR", (int)x_dpi);
/* Set resolution */
@@ -2270,23 +2245,23 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
fprintf (prn_stream, "\033%%0B"); /* Enter HPGL/2 mode */
fprintf (prn_stream, "BP5,1"); /* Turn off autorotation */
fprintf (prn_stream, "PS%d,%d",
- (int)((pdev->height/pdev->y_pixels_per_inch)*1016),
- (int)((pdev->width/pdev->x_pixels_per_inch)*1016)); /* Set length/width of page */
+ (int)((pdev->height/pdev->y_pixels_per_inch)*1016),
+ (int)((pdev->width/pdev->x_pixels_per_inch)*1016)); /* Set length/width of page */
fprintf (prn_stream, "PU"); /* Pen up */
fprintf (prn_stream, "PA%d,%d", 0, 0); /* Move pen to upper-left */
fprintf (prn_stream, "\033%%1A"); /* Enter HP-RTL mode */
fprintf (prn_stream, "\033&a1N"); /* No negative motion - allow plotting
- while receiving */
+ while receiving */
if (pdev->x_pixels_per_inch == 600)
fprintf (prn_stream, "\033*t600R"); /* request 600dpi via HP RTL */
{ static const char temp[] = {
033, '*', 'v', '6', 'W',
- 000 /* color model */,
- 000 /* pixel encoding mode */,
- 003 /* number of bits per index */,
- 010 /* bits red */,
- 010 /* bits green */,
- 010 /* bits blue */
+ 000 /* color model */,
+ 000 /* pixel encoding mode */,
+ 003 /* number of bits per index */,
+ 010 /* bits red */,
+ 010 /* bits green */,
+ 010 /* bits blue */
};
fwrite (temp, 1, sizeof(temp), prn_stream);
}
@@ -2414,40 +2389,40 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
word rmask = ~(word) 0 << ((-pdev->width * storage_bpp) & (W * 8 - 1));
lend = pdev->height -
- (int)((dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi);
+ (int)((dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi);
switch (ptype) {
- case BJC600:
- case BJC800:
- start_rows = BJC_HEAD_ROWS;
- break;
+ case BJC600:
+ case BJC800:
+ start_rows = BJC_HEAD_ROWS;
+ break;
- /* Inhibit blank line printing for RGB-only printers, since in
- * this case 'blank' means black! Also disabled for XL300 due to
- * an obscure bug in the printer's firmware */
+ /* Inhibit blank line printing for RGB-only printers, since in
+ * this case 'blank' means black! Also disabled for XL300 due to
+ * an obscure bug in the printer's firmware */
- case PJ180:
- case PJXL180:
- case PJXL300:
- start_rows = -1;
- break;
+ case PJ180:
+ case PJXL180:
+ case PJXL300:
+ start_rows = -1;
+ break;
- default:
- start_rows = (num_comps == 1) ? HEAD_ROWS_MONO - 1 :
- HEAD_ROWS_COLOUR - 1;
- break;
+ default:
+ start_rows = (num_comps == 1) ? HEAD_ROWS_MONO - 1 :
+ HEAD_ROWS_COLOUR - 1;
+ break;
}
cErr = mErr = yErr = kErr = 0;
if (bits_per_pixel > 4) { /* Randomly seed initial error buffer */
if (cprn_device->cmyk > 0 && expanded_bpp == 32) {
- bjc_fscmyk(data, plane_data, errors, plane_size, -1);
+ bjc_fscmyk(data, plane_data, errors, plane_size, -1);
} else {
- int *ep = errors[0];
- for (i = 0; i < databuff_size; i++) {
- *ep++ = RANDOM;
- }
+ int *ep = errors[0];
+ for (i = 0; i < databuff_size; i++) {
+ *ep++ = RANDOM;
+ }
}
}
@@ -2463,189 +2438,189 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
/* Remove trailing 0s. */
while (end_data > data_words && end_data[-1] == 0)
- end_data--;
+ end_data--;
if (ptype != DNJ650C) /* DesignJet can't skip blank lines ? ? */
- if (end_data == data_words) { /* Blank line */
- num_blank_lines++;
- continue;
- }
+ if (end_data == data_words) { /* Blank line */
+ num_blank_lines++;
+ continue;
+ }
/* Skip blank lines if any */
if (num_blank_lines > 0) {
if (ptype == DJ505J) {
fprintf(prn_stream,"\033_Y%c%c",
num_blank_lines & 0xff, (num_blank_lines >> 8) & 0xff);
- } else if (ptype == ESC_P) {
- ep_print_image(prn_stream, &eg, 'B', 0, num_blank_lines);
- } else if (ptype == BJC600 || ptype == BJC800) {
- bjc_v_skip(num_blank_lines, pdev, prn_stream);
- } else if (num_blank_lines < this_pass) {
- /* Moving down from current position
- * causes head motion on the DeskJets, so
- * if the number of lines is within the
- * current pass of the print head, we're
- * better off printing blanks. */
- this_pass -= num_blank_lines;
- if (combined_escapes) {
- fputc('y', prn_stream); /* Clear current and seed rows */
- for (; num_blank_lines; num_blank_lines--)
- fputc('w', prn_stream);
- } else {
+ } else if (ptype == ESC_P) {
+ ep_print_image(prn_stream, &eg, 'B', 0, num_blank_lines);
+ } else if (ptype == BJC600 || ptype == BJC800) {
+ bjc_v_skip(num_blank_lines, pdev, prn_stream);
+ } else if (num_blank_lines < this_pass) {
+ /* Moving down from current position
+ * causes head motion on the DeskJets, so
+ * if the number of lines is within the
+ * current pass of the print head, we're
+ * better off printing blanks. */
+ this_pass -= num_blank_lines;
+ if (combined_escapes) {
+ fputc('y', prn_stream); /* Clear current and seed rows */
+ for (; num_blank_lines; num_blank_lines--)
+ fputc('w', prn_stream);
+ } else {
#if 0
/**************** The following code has been proposed ****************/
/**************** as a replacement: ****************/
- fputs("\033*b1Y", prn_stream); /* Clear current and seed rows */
- if ( num_blank_lines > 1 )
- fprintf(prn_stream, "\033*b%dY", num_blank_lines - 1);
- num_blank_lines = 0;
+ fputs("\033*b1Y", prn_stream); /* Clear current and seed rows */
+ if ( num_blank_lines > 1 )
+ fprintf(prn_stream, "\033*b%dY", num_blank_lines - 1);
+ num_blank_lines = 0;
#else
- fputs("\033*bY", prn_stream); /* Clear current and seed rows */
- if (ptype == DNJ650C) {
- fprintf (prn_stream, "\033*b%dY", num_blank_lines);
- num_blank_lines = 0;
- }
- else {
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*bW", prn_stream);
- }
+ fputs("\033*bY", prn_stream); /* Clear current and seed rows */
+ if (ptype == DNJ650C) {
+ fprintf (prn_stream, "\033*b%dY", num_blank_lines);
+ num_blank_lines = 0;
+ }
+ else {
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*bW", prn_stream);
+ }
#endif
- }
- } else {
- if (combined_escapes)
- fprintf(prn_stream, "%dy", num_blank_lines);
- else
- fprintf(prn_stream, "\033*b%dY", num_blank_lines);
- }
- memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
- num_blank_lines = 0;
- this_pass = start_rows;
+ }
+ } else {
+ if (combined_escapes)
+ fprintf(prn_stream, "%dy", num_blank_lines);
+ else
+ fprintf(prn_stream, "\033*b%dY", num_blank_lines);
+ }
+ memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
+ num_blank_lines = 0;
+ this_pass = start_rows;
}
{ /* Printing non-blank lines */
- register byte *kP = plane_data[scan + 2][3];
- register byte *cP = plane_data[scan + 2][2];
- register byte *mP = plane_data[scan + 2][1];
- register byte *yP = plane_data[scan + 2][0];
- register byte *dp = data[scan + 2];
- register int *ep = errors[scan];
- int zero_row_count;
- int i, j;
- byte *odp;
-
- if (this_pass)
- this_pass--;
- else
- this_pass = start_rows;
-
- if (expanded_bpp > bits_per_pixel) { /* Expand line if required */
- cdj_expand_line(data_words, line_size,
- cprn_device->cmyk,
- bits_per_pixel, expanded_bpp);
- }
-
- /* In colour modes, we have some bit-shuffling to do before
- * we can print the data; in FS mode we also have the
- * dithering to take care of. */
- switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
- case 3:
- /* Transpose the data to get pixel planes. */
- for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
- i += 8, odp++) { /* The following is for 16-bit
- * machines */
+ register byte *kP = plane_data[scan + 2][3];
+ register byte *cP = plane_data[scan + 2][2];
+ register byte *mP = plane_data[scan + 2][1];
+ register byte *yP = plane_data[scan + 2][0];
+ register byte *dp = data[scan + 2];
+ register int *ep = errors[scan];
+ int zero_row_count;
+ int i, j;
+ byte *odp;
+
+ if (this_pass)
+ this_pass--;
+ else
+ this_pass = start_rows;
+
+ if (expanded_bpp > bits_per_pixel) { /* Expand line if required */
+ cdj_expand_line(data_words, line_size,
+ cprn_device->cmyk,
+ bits_per_pixel, expanded_bpp);
+ }
+
+ /* In colour modes, we have some bit-shuffling to do before
+ * we can print the data; in FS mode we also have the
+ * dithering to take care of. */
+ switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
+ case 3:
+ /* Transpose the data to get pixel planes. */
+ for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
+ i += 8, odp++) { /* The following is for 16-bit
+ * machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static ulong spr40[8] = spread3(0x40);
- static ulong spr08[8] = spread3(8);
- static ulong spr02[8] = spread3(2);
- register byte *dp = data[scan] + i;
- register ulong pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr08[dp[3]] << 1) +
- (spr08[dp[4]]) +
- (spr08[dp[5]] >> 1) +
- (spr02[dp[6]]) +
- (spr02[dp[7]] >> 1);
- odp[0] = (byte) (pword >> 16);
- odp[plane_size] = (byte) (pword >> 8);
- odp[plane_size * 2] = (byte) (pword);
- }
- break;
-
- case 8:
- switch (ptype) {
- case BJC600:
- case BJC800:
- if (bjcparams.ditheringType == BJC_DITHER_NONE) {
- COPYline(scan, i, j, plane_size, cP, mP, yP, kP, 1);
- break;
- }
-
- default:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 1);
- }
- break;
- case 24:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 3);
- break;
- case 32:
- if (cprn_device->cmyk > 0) {
- bjc_fscmyk(data, plane_data, errors, plane_size, scan);
- } else {
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 4);
- }
- break;
-
- } /* switch(expanded_bpp) */
-
- /* Make sure all black is in the k plane */
-
- if (num_comps == 4 && (cprn_device->cmyk <= 0 || expanded_bpp != 32)) {
- register word *kp = (word *)plane_data[scan][3];
- register word *cp = (word *)plane_data[scan][2];
- register word *mp = (word *)plane_data[scan][1];
- register word *yp = (word *)plane_data[scan][0];
- if (bits_per_pixel > 4) { /* Done as 4 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *cp & *mp & *yp;
- *kp++ |= bits;
- bits = ~bits;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
- } else { /* This has really been done as 3 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *cp & *mp & *yp;
- *kp++ = bits;
- bits = ~bits;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
- }
- }
-
- /* Transfer raster graphics in the order (K), C, M, Y */
-
- for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
- int output_plane = 1;
- int out_count = 0;
-
- switch (ptype) {
- case DJ500C: /* Always compress using mode 9 */
- case DJ550C:
- out_count = gdev_pcl_mode9compress(plane_size,
- plane_data[scan][i],
- plane_data[1 - scan][i],
- out_data);
-
- /* This optimisation allows early termination of the
- * row, but this doesn't work correctly in an alternating
- * mode 2 / mode 3 regime, so we only use it with mode 9
- * compression */
+ static ulong spr40[8] = spread3(0x40);
+ static ulong spr08[8] = spread3(8);
+ static ulong spr02[8] = spread3(2);
+ register byte *dp = data[scan] + i;
+ register ulong pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr08[dp[3]] << 1) +
+ (spr08[dp[4]]) +
+ (spr08[dp[5]] >> 1) +
+ (spr02[dp[6]]) +
+ (spr02[dp[7]] >> 1);
+ odp[0] = (byte) (pword >> 16);
+ odp[plane_size] = (byte) (pword >> 8);
+ odp[plane_size * 2] = (byte) (pword);
+ }
+ break;
+
+ case 8:
+ switch (ptype) {
+ case BJC600:
+ case BJC800:
+ if (bjcparams.ditheringType == BJC_DITHER_NONE) {
+ COPYline(scan, i, j, plane_size, cP, mP, yP, kP, 1);
+ break;
+ }
+
+ default:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 1);
+ }
+ break;
+ case 24:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 3);
+ break;
+ case 32:
+ if (cprn_device->cmyk > 0) {
+ bjc_fscmyk(data, plane_data, errors, plane_size, scan);
+ } else {
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 4);
+ }
+ break;
+
+ } /* switch(expanded_bpp) */
+
+ /* Make sure all black is in the k plane */
+
+ if (num_comps == 4 && (cprn_device->cmyk <= 0 || expanded_bpp != 32)) {
+ register word *kp = (word *)plane_data[scan][3];
+ register word *cp = (word *)plane_data[scan][2];
+ register word *mp = (word *)plane_data[scan][1];
+ register word *yp = (word *)plane_data[scan][0];
+ if (bits_per_pixel > 4) { /* Done as 4 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *cp & *mp & *yp;
+ *kp++ |= bits;
+ bits = ~bits;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
+ } else { /* This has really been done as 3 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *cp & *mp & *yp;
+ *kp++ = bits;
+ bits = ~bits;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
+ }
+ }
+
+ /* Transfer raster graphics in the order (K), C, M, Y */
+
+ for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
+ int output_plane = 1;
+ int out_count = 0;
+
+ switch (ptype) {
+ case DJ500C: /* Always compress using mode 9 */
+ case DJ550C:
+ out_count = gdev_pcl_mode9compress(plane_size,
+ plane_data[scan][i],
+ plane_data[1 - scan][i],
+ out_data);
+
+ /* This optimisation allows early termination of the
+ * row, but this doesn't work correctly in an alternating
+ * mode 2 / mode 3 regime, so we only use it with mode 9
+ * compression */
if (out_count == 0)
{ output_plane = 0; /* No further output for this plane */
if (i == 0)
@@ -2657,105 +2632,105 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
{ for (; zero_row_count; zero_row_count--)
fputc('v', prn_stream);
}
- break;
- case DJ505J:
- out_count = gdev_pcl_mode1compress((const byte *)
- plane_data[scan][i],
- (const byte *)
- plane_data[scan][i] + plane_size - 1,
- out_data);
- break;
- case PJ180:
- case DNJ650C:
- if (num_comps > 1)
- { word *wp = (word *)plane_data[scan][i];
- for (j = 0; j < plane_size / W; j++, wp++)
- *wp = ~*wp;
- }
- out_count = gdev_pcl_mode1compress((const byte *)
- plane_data[scan][i],
- (const byte *)
- plane_data[scan][i] + plane_size - 1,
- out_data);
- break;
- case PJXL180: /* Need to invert data as CMY not supported */
- if (num_comps > 1)
- { word *wp = (word *)plane_data[scan][i];
- for (j = 0; j < plane_size / W; j++, wp++)
- *wp = ~*wp;
- }
- /* fall through .. */
- case PJXL300: /* Compression modes 2 and 3 are both
- * available. Try both and see which one
- * produces the least output data. */
- case LJ4DITH:
- { const byte *plane = plane_data[scan][i];
- byte *prev_plane = plane_data[1 - scan][i];
- const word *row = (word *)plane;
- const word *end_row = row + plane_size/W;
- int count2 = gdev_pcl_mode2compress(row, end_row, out_row_alt);
- int count3 = gdev_pcl_mode3compress(plane_size, plane, prev_plane, out_row);
- int penalty = combined_escapes ? strlen("#m") : strlen("\033*b#M");
- int penalty2 = (compression == 2 ? 0 : penalty);
- int penalty3 = (compression == 3 ? 0 : penalty);
-
- if (count3 + penalty3 < count2 + penalty2)
- { if ( compression != 3 ) {
- if (combined_escapes)
- fputs("3m", prn_stream);
- else
- fputs("\033*b3M", prn_stream);
- compression = 3;
- }
- out_data = out_row;
- out_count = count3;
- }
- else
- { if ( compression != 2 ) {
- if (combined_escapes)
- fputs("2m", prn_stream);
- else
- fputs("\033*b2M", prn_stream);
- compression = 2;
- }
- out_data = out_row_alt;
- out_count = count2;
- }
- }
- break;
- case BJC600:
- case BJC800:
- { const byte *plane = (byte *)plane_data[scan][i];
- int count2 = bjc_compress(plane, plane + plane_size, out_row_alt);
-
- out_data = out_row_alt;
- out_count = count2;
- }
- break;
- }
- if (output_plane) {
+ break;
+ case DJ505J:
+ out_count = gdev_pcl_mode1compress((const byte *)
+ plane_data[scan][i],
+ (const byte *)
+ plane_data[scan][i] + plane_size - 1,
+ out_data);
+ break;
+ case PJ180:
+ case DNJ650C:
+ if (num_comps > 1)
+ { word *wp = (word *)plane_data[scan][i];
+ for (j = 0; j < plane_size / W; j++, wp++)
+ *wp = ~*wp;
+ }
+ out_count = gdev_pcl_mode1compress((const byte *)
+ plane_data[scan][i],
+ (const byte *)
+ plane_data[scan][i] + plane_size - 1,
+ out_data);
+ break;
+ case PJXL180: /* Need to invert data as CMY not supported */
+ if (num_comps > 1)
+ { word *wp = (word *)plane_data[scan][i];
+ for (j = 0; j < plane_size / W; j++, wp++)
+ *wp = ~*wp;
+ }
+ /* fall through .. */
+ case PJXL300: /* Compression modes 2 and 3 are both
+ * available. Try both and see which one
+ * produces the least output data. */
+ case LJ4DITH:
+ { const byte *plane = plane_data[scan][i];
+ byte *prev_plane = plane_data[1 - scan][i];
+ const word *row = (word *)plane;
+ const word *end_row = row + plane_size/W;
+ int count2 = gdev_pcl_mode2compress(row, end_row, out_row_alt);
+ int count3 = gdev_pcl_mode3compress(plane_size, plane, prev_plane, out_row);
+ int penalty = combined_escapes ? strlen("#m") : strlen("\033*b#M");
+ int penalty2 = (compression == 2 ? 0 : penalty);
+ int penalty3 = (compression == 3 ? 0 : penalty);
+
+ if (count3 + penalty3 < count2 + penalty2)
+ { if ( compression != 3 ) {
+ if (combined_escapes)
+ fputs("3m", prn_stream);
+ else
+ fputs("\033*b3M", prn_stream);
+ compression = 3;
+ }
+ out_data = out_row;
+ out_count = count3;
+ }
+ else
+ { if ( compression != 2 ) {
+ if (combined_escapes)
+ fputs("2m", prn_stream);
+ else
+ fputs("\033*b2M", prn_stream);
+ compression = 2;
+ }
+ out_data = out_row_alt;
+ out_count = count2;
+ }
+ }
+ break;
+ case BJC600:
+ case BJC800:
+ { const byte *plane = (byte *)plane_data[scan][i];
+ int count2 = bjc_compress(plane, plane + plane_size, out_row_alt);
+
+ out_data = out_row_alt;
+ out_count = count2;
+ }
+ break;
+ }
+ if (output_plane) {
if (ptype == DJ505J)
- fprintf(prn_stream, "\033_%c%c%c",
- "WVVV"[i], out_count & 0xff, (out_count >> 8) & 0xff);
- else if (combined_escapes)
- fprintf(prn_stream, "%d%c", out_count, "wvvv"[i]);
- else if (ptype == BJC600 || ptype == BJC800) {
- if (out_count)
- bjc_raster_cmd(num_comps == 1 ? 3 : i,
- out_count, out_data, pdev, prn_stream);
- if (i == 0) bjc_v_skip(1, pdev, prn_stream);
- } else if (ptype == ESC_P)
- ep_print_image(prn_stream, &eg, (char)i, plane_data[scan][i], plane_size);
- else
- fprintf(prn_stream, "\033*b%d%c", out_count, "WVVV"[i]);
- if (ptype < ESC_P)
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
- }
-
- } /* Transfer Raster Graphics ... */
- if (ptype == ESC_P)
- ep_print_image(prn_stream, &eg, 'I', 0, 0); /* increment line index */
- scan = 1 - scan; /* toggle scan direction */
+ fprintf(prn_stream, "\033_%c%c%c",
+ "WVVV"[i], out_count & 0xff, (out_count >> 8) & 0xff);
+ else if (combined_escapes)
+ fprintf(prn_stream, "%d%c", out_count, "wvvv"[i]);
+ else if (ptype == BJC600 || ptype == BJC800) {
+ if (out_count)
+ bjc_raster_cmd(num_comps == 1 ? 3 : i,
+ out_count, out_data, pdev, prn_stream);
+ if (i == 0) bjc_v_skip(1, pdev, prn_stream);
+ } else if (ptype == ESC_P)
+ ep_print_image(prn_stream, &eg, (char)i, plane_data[scan][i], plane_size);
+ else
+ fprintf(prn_stream, "\033*b%d%c", out_count, "WVVV"[i]);
+ if (ptype < ESC_P)
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ }
+
+ } /* Transfer Raster Graphics ... */
+ if (ptype == ESC_P)
+ ep_print_image(prn_stream, &eg, 'I', 0, 0); /* increment line index */
+ scan = 1 - scan; /* toggle scan direction */
} /* Printing non-blank lines */
} /* for lnum ... */
} /* send each scan line in turn */
@@ -2807,21 +2782,21 @@ hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
static int
gdev_pcl_mode1compress(const byte *row, const byte *end_row, byte *compressed)
{ register const byte *in = row;
- register byte *out = compressed;
- while ( in < end_row )
+ register byte *out = compressed;
+ while ( in < end_row )
{ byte test = *in++;
- const byte *run = in;
- while ( in < end_row && *in == test ) in++;
- /* Note that in - run + 1 is the repetition count. */
- while ( in - run > 255 )
+ const byte *run = in;
+ while ( in < end_row && *in == test ) in++;
+ /* Note that in - run + 1 is the repetition count. */
+ while ( in - run > 255 )
{ *out++ = 255;
- *out++ = test;
- run += 256;
+ *out++ = test;
+ run += 256;
}
- *out++ = in - run;
- *out++ = test;
+ *out++ = in - run;
+ *out++ = test;
}
- return out - compressed;
+ return out - compressed;
}
/*
@@ -2857,17 +2832,17 @@ gdev_cmyk_map_cmyk_color(gx_device* pdev, const gx_color_value cv[])
gx_color_index color;
cyan = cv[0]; magenta = cv[1]; yellow = cv[2]; black = cv[3];
switch (pdev->color_info.depth) {
- case 1:
- color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0;
- break;
+ case 1:
+ color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0;
+ break;
- default: {
- int nbits = pdev->color_info.depth;
+ default: {
+ int nbits = pdev->color_info.depth;
- color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
- nbits >> 2);
- }
+ color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
+ nbits >> 2);
+ }
}
return color;
@@ -2913,31 +2888,31 @@ static int
gdev_cmyk_map_color_cmyk(gx_device *pdev, gx_color_index color, gx_color_value prgb[3])
{
switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = gx_max_color_value * (1 - color);
- break;
+ case 1:
+ prgb[0] = gx_max_color_value * (1 - color);
+ break;
- case 8:
- if (pdev->color_info.num_components == 1) {
- gx_color_value value = (gx_color_value) color ^ 0xff;
+ case 8:
+ if (pdev->color_info.num_components == 1) {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = (value << 8) + value;
+ prgb[0] = (value << 8) + value;
- break;
- }
+ break;
+ }
- default: {
- unsigned long bcyan, bmagenta, byellow, black;
- int nbits = pdev->color_info.depth;
+ default: {
+ unsigned long bcyan, bmagenta, byellow, black;
+ int nbits = pdev->color_info.depth;
- gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
- nbits >> 2);
+ gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
+ nbits >> 2);
- prgb[0] = bcyan;
- prgb[1] = bmagenta;
- prgb[2] = byellow;
- prgb[3] = black;
- }
+ prgb[0] = bcyan;
+ prgb[1] = bmagenta;
+ prgb[2] = byellow;
+ prgb[3] = black;
+ }
}
return 0;
@@ -2959,7 +2934,7 @@ gdev_cmyk_map_color_cmyk(gx_device *pdev, gx_color_index color, gx_color_value p
register byte cv = c_v, mv = m_v, yv = y_v, kv; \
\
kv = (cv > mv ? mv : cv); \
- kv = (yv > k ? k : y); \
+ kv = (yv > k ? k : y); \
y = yv - kv; m = mv - kv; c = cv -kv; k = kv; \
} while (0)
@@ -2985,43 +2960,43 @@ gdev_pcl_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
maxval = c >= m ? (c >= y ? c : y) : (m >= y ? m : y);
if (maxval > 0) {
- minval = c <= m ? (c <= y ? c : y) : (m <= y? m : y);
- range = maxval - minval;
+ minval = c <= m ? (c <= y ? c : y) : (m <= y? m : y);
+ range = maxval - minval;
#define shift (gx_color_value_bits - 12)
- c = ((c >> shift) * (range + (maxval * correction))) /
- ((maxval * (correction + 1)) >> shift);
+ c = ((c >> shift) * (range + (maxval * correction))) /
+ ((maxval * (correction + 1)) >> shift);
}
}
switch (pdev->color_info.depth) {
case 1:
return ((c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index)1 : (gx_color_index)0);
+ (gx_color_index)1 : (gx_color_index)0);
case 8:
if (pdev->color_info.num_components >= 3)
#define gx_color_value_to_1bit(cv) ((cv) >> (gx_color_value_bits - 1))
- return (gx_color_value_to_1bit(c) +
- (gx_color_value_to_1bit(m) << 1) +
- (gx_color_value_to_1bit(y) << 2));
+ return (gx_color_value_to_1bit(c) +
+ (gx_color_value_to_1bit(m) << 1) +
+ (gx_color_value_to_1bit(y) << 2));
else
#define red_weight 306
#define green_weight 601
#define blue_weight 117
- return ((((ulong)c * red_weight +
- (ulong)m * green_weight +
- (ulong)y * blue_weight)
- >> (gx_color_value_bits + 2)));
+ return ((((ulong)c * red_weight +
+ (ulong)m * green_weight +
+ (ulong)y * blue_weight)
+ >> (gx_color_value_bits + 2)));
case 16:
#define gx_color_value_to_5bits(cv) ((cv) >> (gx_color_value_bits - 5))
#define gx_color_value_to_6bits(cv) ((cv) >> (gx_color_value_bits - 6))
return (gx_color_value_to_5bits(y) +
- (gx_color_value_to_6bits(m) << 5) +
- (gx_color_value_to_5bits(c) << 11));
+ (gx_color_value_to_6bits(m) << 5) +
+ (gx_color_value_to_5bits(c) << 11));
case 24:
return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong)gx_color_value_to_byte(c) << 16));
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong)gx_color_value_to_byte(c) << 16));
case 32:
{ return ((c == m && c == y) ? ((ulong)gx_color_value_to_byte(c) << 24)
: (gx_color_value_to_byte(y) +
@@ -3036,7 +3011,7 @@ gdev_pcl_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
/* Map a color index to a r-g-b color. */
static int
gdev_pcl_map_color_rgb(gx_device *pdev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
/* For the moment, we simply ignore any black correction */
switch (pdev->color_info.depth) {
@@ -3045,27 +3020,27 @@ gdev_pcl_map_color_rgb(gx_device *pdev, gx_color_index color,
break;
case 8:
if (pdev->color_info.num_components >= 3)
- { gx_color_value c = (gx_color_value)color ^ 7;
- prgb[0] = -(c & 1);
- prgb[1] = -((c >> 1) & 1);
- prgb[2] = -(c >> 2);
- }
+ { gx_color_value c = (gx_color_value)color ^ 7;
+ prgb[0] = -(c & 1);
+ prgb[1] = -((c >> 1) & 1);
+ prgb[2] = -(c >> 2);
+ }
else
- { gx_color_value value = (gx_color_value)color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- }
+ { gx_color_value value = (gx_color_value)color ^ 0xff;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ }
break;
case 16:
{ gx_color_value c = (gx_color_value)color ^ 0xffff;
ushort value = c >> 11;
prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
+ (value >> 4)) >> (16 - gx_color_value_bits);
value = (c >> 6) & 0x3f;
prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
+ >> (16 - gx_color_value_bits);
value = c & 0x1f;
prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
+ (value >> 4)) >> (16 - gx_color_value_bits);
}
break;
case 24:
@@ -3113,99 +3088,99 @@ cdj_expand_line(word *line, int linesize, short cmyk, int bpp, int ebpp)
if (cmyk > 0) {
if (bpp == 8) {
- in = start + endline;
- out = start + (endline *= 2);
+ in = start + endline;
+ out = start + (endline *= 2);
- while (in > start) {
- register byte b0;
- register byte bs0, bs1, bs2, bs3;
+ while (in > start) {
+ register byte b0;
+ register byte bs0, bs1, bs2, bs3;
- b0 = *--in;
+ b0 = *--in;
- bs0 = b0 & 0x03;
- bs1 = (b0 >> 2) & 0x03;
- bs2 = (b0 >> 4) & 0x03;
- bs3 = (b0 >> 6) & 0x03;
+ bs0 = b0 & 0x03;
+ bs1 = (b0 >> 2) & 0x03;
+ bs2 = (b0 >> 4) & 0x03;
+ bs3 = (b0 >> 6) & 0x03;
- *--out = (bs0 << 2) + bs0 + (bs1 << 6) + (bs1 << 4);
- *--out = (bs2 << 2) + bs2 + (bs3 << 6) + (bs3 << 4);
- }
+ *--out = (bs0 << 2) + bs0 + (bs1 << 6) + (bs1 << 4);
+ *--out = (bs2 << 2) + bs2 + (bs3 << 6) + (bs3 << 4);
+ }
}
if (bpp == 24) {
- endline = (endline + 2) / 3;
+ endline = (endline + 2) / 3;
- in = start + endline * 3;
- out = start + endline * 4;
+ in = start + endline * 3;
+ out = start + endline * 4;
- while (in > start) {
- register byte b0, b1, b2;
+ while (in > start) {
+ register byte b0, b1, b2;
- b0 = *--in;
- b1 = *--in;
- b2 = *--in;
+ b0 = *--in;
+ b1 = *--in;
+ b2 = *--in;
- *--out = (b0 << 2) + ((b0 >> 4) & 0x03);
- *--out = ((b1 & 0x0f) << 4) + ((b0 >> 6) << 2)
- + ((b1 >> 2) & 0x03);
- *--out = ((b2 & 0x03) << 6) + ((b1 >> 4) << 2) + (b2 & 0x03);
- *--out = (b2 & 0xfc) + ((b2 >> 6) & 0x03);
- }
+ *--out = (b0 << 2) + ((b0 >> 4) & 0x03);
+ *--out = ((b1 & 0x0f) << 4) + ((b0 >> 6) << 2)
+ + ((b1 >> 2) & 0x03);
+ *--out = ((b2 & 0x03) << 6) + ((b1 >> 4) << 2) + (b2 & 0x03);
+ *--out = (b2 & 0xfc) + ((b2 >> 6) & 0x03);
+ }
} else if (ebpp == 32) {
- endline = (endline + 1) / 2;
+ endline = (endline + 1) / 2;
- in = start + endline * 2;
- out = start + (endline *= 4);
+ in = start + endline * 2;
+ out = start + (endline *= 4);
- while (in > start) {
- register byte b0, b1;
+ while (in > start) {
+ register byte b0, b1;
- b0 = *--in;
- b1 = *--in;
+ b0 = *--in;
+ b1 = *--in;
- *--out = (b0 << 4) + ((b0 >> 4) & 0x07);
- *--out = (b0 & 0xf0) + ((b0 >> 4) & 0xf);
- *--out = (b1 << 4) + ((b1 >> 4) & 0x0f);
- *--out = (b1 & 0xf0) + ((b1 >> 4) & 0xf);
- }
+ *--out = (b0 << 4) + ((b0 >> 4) & 0x07);
+ *--out = (b0 & 0xf0) + ((b0 >> 4) & 0xf);
+ *--out = (b1 << 4) + ((b1 >> 4) & 0x0f);
+ *--out = (b1 & 0xf0) + ((b1 >> 4) & 0xf);
+ }
}
} else /* cmyk > 0 */ {
if (bpp == 16) /* 16 to 24 (cmy) if required */
- { register byte b0, b1;
- endline = ((endline + 1) / 2);
- in = start + endline * 2;
- out = start + (endline *= 3);
-
- while (in > start)
- { b0 = *--in;
- b1 = *--in;
- *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
- *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
- *--out = (b1 & 0xf8) + (b1 >> 5);
- }
- }
+ { register byte b0, b1;
+ endline = ((endline + 1) / 2);
+ in = start + endline * 2;
+ out = start + (endline *= 3);
+
+ while (in > start)
+ { b0 = *--in;
+ b1 = *--in;
+ *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
+ *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
+ *--out = (b1 & 0xf8) + (b1 >> 5);
+ }
+ }
if (ebpp == 32) /* 24/32 (cmy) to 32 (cmyk) if required */
- { register byte c, m, y;
- endline = ((endline + 2) / 3);
- in = start + endline * 3;
- out = start + endline * 4;
-
- while (in > start)
- {
- y = *--in;
- m = *--in;
- c = *--in;
-
- if (c == y && c == m) {
- *--out = 0, *--out = 0, *--out = 0;
- *--out = c;
- } else {
- *--out = y, *--out = m, *--out = c;
- *--out = 0;
- }
- }
- }
+ { register byte c, m, y;
+ endline = ((endline + 2) / 3);
+ in = start + endline * 3;
+ out = start + endline * 4;
+
+ while (in > start)
+ {
+ y = *--in;
+ m = *--in;
+ c = *--in;
+
+ if (c == y && c == m) {
+ *--out = 0, *--out = 0, *--out = 0;
+ *--out = c;
+ } else {
+ *--out = y, *--out = m, *--out = c;
+ *--out = 0;
+ }
+ }
+ }
}
}
@@ -3213,18 +3188,18 @@ static int
cdj_put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue,
int minval, int maxval, int ecode)
{ int code, value;
- switch ( code = param_read_int(plist, pname, &value) )
- {
- default:
- return code;
- case 1:
- return ecode;
- case 0:
- if ( value < minval || value > maxval )
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
- }
+ switch ( code = param_read_int(plist, pname, &value) )
+ {
+ default:
+ return code;
+ case 1:
+ return ecode;
+ case 0:
+ if ( value < minval || value > maxval )
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
+ }
}
static int
@@ -3233,34 +3208,34 @@ cdj_set_bpp(gx_device *pdev, int bpp, int ccomps)
if (ccomps && bpp == 0) {
if (cprn_device->cmyk) {
- switch (ccomps) {
- default:
- return gs_error_rangecheck;
- /*NOTREACHED*/
- break;
-
- case 1:
- bpp = 1;
- break;
-
- case 3:
- bpp = 24;
- break;
-
- case 4:
- switch (ci->depth) {
- case 8:
- case 16:
- case 24:
- case 32:
- break;
-
- default:
- bpp = cprn_device->default_depth;
- break;
- }
- break;
- }
+ switch (ccomps) {
+ default:
+ return gs_error_rangecheck;
+ /*NOTREACHED*/
+ break;
+
+ case 1:
+ bpp = 1;
+ break;
+
+ case 3:
+ bpp = 24;
+ break;
+
+ case 4:
+ switch (ci->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
+ bpp = cprn_device->default_depth;
+ break;
+ }
+ break;
+ }
}
}
@@ -3285,79 +3260,78 @@ cdj_set_bpp(gx_device *pdev, int bpp, int ccomps)
{
case 16:
case 32:
- if (cprn_device->cmyk && ccomps && ccomps != 4) goto bppe;
- break;
+ if (cprn_device->cmyk && ccomps && ccomps != 4) goto bppe;
+ break;
case 24:
if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
- break;
+ break;
} else if (ccomps == 1) {
- goto bppe;
+ goto bppe;
} else {
- /* 3 components 24 bpp printing for CMYK device. */
+ /* 3 components 24 bpp printing for CMYK device. */
- cprn_device->cmyk = -1;
+ cprn_device->cmyk = -1;
}
break;
case 8:
- if (cprn_device->cmyk) {
- if (ccomps) {
- if (ccomps == 3) {
- cprn_device->cmyk = -1;
- bpp = 3;
- } else if (ccomps != 1 && ccomps != 4) {
- goto bppe;
- }
- }
- if (ccomps != 1) break;
- } else {
- break;
- }
+ if (cprn_device->cmyk) {
+ if (ccomps) {
+ if (ccomps == 3) {
+ cprn_device->cmyk = -1;
+ bpp = 3;
+ } else if (ccomps != 1 && ccomps != 4) {
+ goto bppe;
+ }
+ }
+ if (ccomps != 1) break;
+ } else {
+ break;
+ }
case 1:
if (ccomps != 1) goto bppe;
if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
}
break;
case 3:
- if (!cprn_device->cmyk) {
- break;
- }
+ if (!cprn_device->cmyk) {
+ break;
+ }
default:
bppe: return gs_error_rangecheck;
}
-
if (cprn_device->cmyk == -1) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
- if (pdev->is_open) {
- int code; /* Return code */
- gdev_prn_space_params sp; /* Space parameter data */
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
+ if (pdev->is_open) {
+ int code; /* Return code */
+ gdev_prn_space_params sp; /* Space parameter data */
- /* Reallocate memory for device */
- sp = ((gx_device_printer *)pdev)->space_params;
+ /* Reallocate memory for device */
+ sp = ((gx_device_printer *)pdev)->space_params;
- if ((code = gdev_prn_reallocate_memory(pdev, &sp, pdev->width,
- pdev->height)) < 0)
- return (code);
- }
+ if ((code = gdev_prn_reallocate_memory(pdev, &sp, pdev->width,
+ pdev->height)) < 0)
+ return (code);
+ }
}
switch (ccomps) {
@@ -3365,42 +3339,42 @@ bppe: return gs_error_rangecheck;
break;
case 1:
- if (bpp != 1 && bpp != 8) goto cce;
- break;
+ if (bpp != 1 && bpp != 8) goto cce;
+ break;
case 4:
- if (cprn_device->cmyk) {
- if (bpp >= 8) break;
- }
+ if (cprn_device->cmyk) {
+ if (bpp >= 8) break;
+ }
case 3:
- if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
- || bpp == 24 || bpp == 32) {
- break;
- }
+ if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
+ || bpp == 24 || bpp == 32) {
+ break;
+ }
cce: default: return gs_error_rangecheck;
}
if (cprn_device->cmyk) {
if (cprn_device->cmyk > 0) {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
} else {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
}
if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
- bpp = bpp < 8 ? 8 : bpp;
+ bpp = bpp < 8 ? 8 : bpp;
}
ci->max_color = (1 << (bpp >> 2)) - 1;
ci->max_gray = (bpp >= 8 ? 255 : 1);
if (ci->num_components == 1) {
- ci->dither_grays = (bpp >= 8 ? 256 : 2);
- ci->dither_colors = (bpp >= 8 ? 256 : bpp > 1 ? 2 : 0);
+ ci->dither_grays = (bpp >= 8 ? 256 : 2);
+ ci->dither_colors = (bpp >= 8 ? 256 : bpp > 1 ? 2 : 0);
} else {
- ci->dither_grays = (bpp > 8 ? 256 : 2);
- ci->dither_colors = (bpp > 8 ? 256 : bpp > 1 ? 2 : 0);
+ ci->dither_grays = (bpp > 8 ? 256 : 2);
+ ci->dither_colors = (bpp > 8 ? 256 : bpp > 1 ? 2 : 0);
}
} else {
ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
@@ -3424,39 +3398,39 @@ static int
cdj_put_param_bpp(gx_device *pdev, gs_param_list *plist, int new_bpp,
int real_bpp, int ccomps)
{
- if (new_bpp == 0 && ccomps == 0)
- return gdev_prn_put_params(pdev, plist);
- else
- {
- gx_device_color_info save_info;
- int save_bpp;
- int code;
-
- save_info = pdev->color_info;
- save_bpp = save_info.depth;
+ if (new_bpp == 0 && ccomps == 0)
+ return gdev_prn_put_params(pdev, plist);
+ else
+ {
+ gx_device_color_info save_info;
+ int save_bpp;
+ int code;
+
+ save_info = pdev->color_info;
+ save_bpp = save_info.depth;
#define save_ccomps save_info.num_components
- if ( save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
- save_bpp = 3;
- code = cdj_set_bpp(pdev, real_bpp, ccomps);
- if ( code < 0 ) {
- param_signal_error(plist, "BitsPerPixel", code);
- param_signal_error(plist, "ProcessColorModel", code);
- return code;
- }
- pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
- code = gdev_prn_put_params(pdev, plist);
- if ( code < 0 )
- { cdj_set_bpp(pdev, save_bpp, save_ccomps);
- return code;
- }
- cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
- if ((cdj->color_info.depth != save_bpp ||
- (ccomps != 0 && ccomps != save_ccomps))
- && pdev->is_open )
- return gs_closedevice(pdev);
- return 0;
+ if ( save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
+ save_bpp = 3;
+ code = cdj_set_bpp(pdev, real_bpp, ccomps);
+ if ( code < 0 ) {
+ param_signal_error(plist, "BitsPerPixel", code);
+ param_signal_error(plist, "ProcessColorModel", code);
+ return code;
+ }
+ pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
+ code = gdev_prn_put_params(pdev, plist);
+ if ( code < 0 )
+ { cdj_set_bpp(pdev, save_bpp, save_ccomps);
+ return code;
+ }
+ cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
+ if ((cdj->color_info.depth != save_bpp ||
+ (ccomps != 0 && ccomps != save_ccomps))
+ && pdev->is_open )
+ return gs_closedevice(pdev);
+ return 0;
#undef save_ccomps
- }
+ }
}
/* This returns either the number of pixels in a scan line, or the number
@@ -3478,9 +3452,9 @@ paramValueToString(const stringParamDescription* params, int value)
{
for (; params->p_name; ++params) {
- if (params->p_value == value) {
- return (const byte *)params->p_name;
- }
+ if (params->p_value == value) {
+ return (const byte *)params->p_name;
+ }
}
return (const byte*) 0;
@@ -3492,11 +3466,11 @@ paramStringValue(const stringParamDescription* params,
{
for (; params->p_name; ++params) {
- if (strncmp(params->p_name, (char *)name, namelen) == 0 &&
- params->p_name[namelen] == 0) {
- *value = params->p_value;
- return 1;
- }
+ if (strncmp(params->p_name, (char *)name, namelen) == 0 &&
+ params->p_name[namelen] == 0) {
+ *value = params->p_value;
+ return 1;
+ }
}
return 0;
@@ -3511,18 +3485,18 @@ put_param_string(gs_param_list* plist,
int ncode;
if ((ncode = param_read_string(plist, (char *)pname, pstring)) < 0) {
- param_signal_error(plist, (char *)pname, code = ncode);
+ param_signal_error(plist, (char *)pname, code = ncode);
} else if (ncode == 1) {
- pstring->data = 0, pstring->size = 0;
+ pstring->data = 0, pstring->size = 0;
} else {
- int value = 0;
+ int value = 0;
- if (paramStringValue(params, pstring->data, pstring->size,
+ if (paramStringValue(params, pstring->data, pstring->size,
&value) == 0) {
- param_signal_error(plist, (char *)pname, code = gs_error_rangecheck);
- } else {
- *pvalue = value;
- }
+ param_signal_error(plist, (char *)pname, code = gs_error_rangecheck);
+ } else {
+ *pvalue = value;
+ }
}
return code;
@@ -3539,14 +3513,14 @@ get_param_string(gs_param_list* plist,
pstring->data = paramValueToString(params, pvalue);
if (pstring->data == (byte*) 0) {
- param_signal_error(plist, (char *)pname, ncode = gs_error_unknownerror);
+ param_signal_error(plist, (char *)pname, ncode = gs_error_unknownerror);
} else {
pstring->size = strlen((char *)pstring->data);
- pstring->persistent = persist;
+ pstring->persistent = persist;
}
if ((ncode = param_write_string(plist, (char *)pname, pstring)) < 0) {
- code = ncode;
+ code = ncode;
}
return code;
@@ -3559,7 +3533,7 @@ get_param_string(gs_param_list* plist,
static int
cdj_param_check_bytes(gs_param_list *plist, gs_param_name pname,
- const byte *str, uint size, bool is_defined)
+ const byte *str, uint size, bool is_defined)
{ int code;
gs_param_string new_value;
switch ( code = param_read_string(plist, pname, &new_value) )
@@ -3586,7 +3560,7 @@ e: param_signal_error(plist, pname, code);
static int
cdj_param_check_float(gs_param_list *plist, gs_param_name pname, floatp fval,
- bool is_defined)
+ bool is_defined)
{ int code;
float new_value;
switch ( code = param_read_float(plist, pname, &new_value) )
@@ -3722,16 +3696,16 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
for(i = 0; i < 4; ++i) {
int j;
float maxv = 1.0;
- /*KGHorig
+ /*KGHorig
if((sd->stc.xfer[i].size < 1) || (sd->stc.xfer[i].data == NULL)) {
maxv = 1.0;
} else {
maxv = 1.0/255.0;
for(j = 0; j < sd->stc.xfer[i].size; ++j)
if(maxv < sd->stc.xfer[i].data[j])
- maxv = sd->stc.xfer[i].data[j];
+ maxv = sd->stc.xfer[i].data[j];
}
- */
+ */
CMYK_THRESHOLD(i) = (int)(127.0 / maxv + 0.5);
SPOTSIZE(i) = ((int) CMYK_THRESHOLD(i)<<1)+1;
j = CMYK_THRESHOLD(i); /* Maximum Error-Value */
@@ -3755,10 +3729,10 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
for(p = 0; p < NPIXEL; ++p) {
for(i = 0; i < 4; ++i) {
- /*KHGOrig
+ /*KHGOrig
if(sd->stc.flags & STCDFLAG0) v = 0;
- */
- if (0) v = 0; /* Must provide a default for that. */
+ */
+ if (0) v = 0; /* Must provide a default for that. */
else v = (rand() % SPOTSIZE(i)) - CMYK_THRESHOLD(i);
FSdiffuse(v,errv[i],errc[i],errv[i-4]);
}
@@ -3805,24 +3779,24 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
if(DIRECTION < 0) { /* scan == 0, run backward */
w = NPIXEL;
- in = inplanes[2] + 4 * (NPIXEL - 1);
+ in = inplanes[2] + 4 * (NPIXEL - 1);
errv += (w-1)<<2;
dir = -4;
- /*KGHorig
+ /*KGHorig
if(w > 8) for(p = 0; p < 4; ++p) out[p] += (w-1)>>3;
- */
- thedir = -1;
- for (p = 0; p < 4; ++p) {
- out[p] += plane_size - 1;
- }
+ */
+ thedir = -1;
+ for (p = 0; p < 4; ++p) {
+ out[p] += plane_size - 1;
+ }
} else { /* run forward */
w = 1;
- in = inplanes[3] - 4 * NPIXEL;
+ in = inplanes[3] - 4 * NPIXEL;
dir = 4;
- thedir = 1;
- for (p = 0; p < 4; ++p) {
- out[p] -= plane_size;
- }
+ thedir = 1;
+ for (p = 0; p < 4; ++p) {
+ out[p] -= plane_size;
+ }
} /* run backward/forward */
/*KGHorig
@@ -3886,7 +3860,7 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
if ((kv+CMYK_THRESHOLD(3)) < 0) kv = -CMYK_THRESHOLD(0);
FSdiffuse(kv,errv[3],kerr,errv[3-dir]);
}
- }
+ }
} else {
@@ -3908,16 +3882,16 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
*/
bit = dir > 0 ? (bit>>1) : (bit<<1);
if(bit == 0) {
- /*KGHorig
+ /*KGHorig
if(((*out[0] = pixel[0]) != 0) && (width[0] < w)) width[0] = w;
if(((*out[1] = pixel[1]) != 0) && (width[1] < w)) width[1] = w;
if(((*out[2] = pixel[2]) != 0) && (width[2] < w)) width[2] = w;
if(((*out[3] = pixel[3]) != 0) && (width[3] < w)) width[3] = w;
- */
- *out[0] = pixel[0];
- *out[1] = pixel[1];
- *out[2] = pixel[2];
- *out[3] = pixel[3];
+ */
+ *out[0] = pixel[0];
+ *out[1] = pixel[1];
+ *out[2] = pixel[2];
+ *out[3] = pixel[3];
out[0] += thedir; out[1] += thedir;
out[2] += thedir; out[3] += thedir;
pixel[0] = pixel[1] = pixel[2] = pixel[3] = 0;
@@ -3927,7 +3901,7 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
w += dir>>2;
}
- in += dir;
+ in += dir;
errv += dir;
} /* loop over pixels */
@@ -3947,4 +3921,3 @@ bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
return 0;
}
-
diff --git a/gs/base/gdevcfax.c b/gs/base/gdevcfax.c
index 524f83355..2b2e961a0 100644
--- a/gs/base/gdevcfax.c
+++ b/gs/base/gdevcfax.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,18 +16,18 @@
#include "strimpl.h"
#include "scfx.h"
#include "gdevfax.h"
-
+
/* The device descriptor */
static dev_proc_print_page(cfax_print_page);
static dev_proc_close_device(cfax_prn_close);
/* Define procedures for cfax. For sff multipage documents */
/* a special close procedure is required because sff needs */
-/* an additional "end of document" signature after the last */
+/* an additional "end of document" signature after the last */
/* "end page" signature */
static const gx_device_procs gdev_cfax_std_procs =
prn_params_procs(gdev_prn_open, gdev_prn_output_page, cfax_prn_close,
- gdev_fax_get_params, gdev_fax_put_params);
+ gdev_fax_get_params, gdev_fax_put_params);
const gx_device_fax gs_cfax_device = {
FAX_DEVICE_BODY(gx_device_fax, gdev_cfax_std_procs, "cfax", cfax_print_page)
@@ -98,8 +98,8 @@ cfax_doc_end(FILE * file)
/* Send the page to the printer. */
static int
cfax_stream_print_page_width(gx_device_printer * pdev, FILE * prn_stream,
- const stream_template * temp, stream_state * ss,
- int width)
+ const stream_template * temp, stream_state * ss,
+ int width)
{
gs_memory_t *mem = pdev->memory;
int code = 0;
@@ -124,52 +124,52 @@ cfax_stream_print_page_width(gx_device_printer * pdev, FILE * prn_stream,
ss->memory = mem;
/* Allocate the buffers. */
- in = gs_alloc_bytes(mem, temp->min_in_size + max_size + 1,
- "cfax_stream_print_page(in)");
+ in = gs_alloc_bytes(mem, temp->min_in_size + max_size + 1,
+ "cfax_stream_print_page(in)");
#define OUT_SIZE 1000
out = gs_alloc_bytes(mem, OUT_SIZE, "cfax_stream_print_page(out)");
if (in == 0 || out == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
- /* Process the image */
+ /* Process the image */
for (lnum = 0; lnum < pdev->height; lnum++) {
- /* Initialize read and write pointer each time, because they're getting modified */
- r.ptr = in - 1;
- r.limit = in + col_size;
- w.ptr = out - 1;
- w.limit = w.ptr + OUT_SIZE;
- /* Decoder must encode line for line, so init it for each line */
- code = (*temp->init) (ss);
- if (code < 0)
- return_error(gs_error_limitcheck);
- /* Now, get the bits and encode them */
- gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if (col_size > in_size) {
- memset(in + in_size , 0, col_size - in_size);
+ /* Initialize read and write pointer each time, because they're getting modified */
+ r.ptr = in - 1;
+ r.limit = in + col_size;
+ w.ptr = out - 1;
+ w.limit = w.ptr + OUT_SIZE;
+ /* Decoder must encode line for line, so init it for each line */
+ code = (*temp->init) (ss);
+ if (code < 0)
+ return_error(gs_error_limitcheck);
+ /* Now, get the bits and encode them */
+ gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ if (col_size > in_size) {
+ memset(in + in_size , 0, col_size - in_size);
+ }
+ code = (*temp->process) (ss, &r, &w, 1 /* always last line */);
+ nbytes = w.ptr - out + 1;
+ if (!nul) {
+ if (nbytes > 0) {
+ if (nbytes < 217) {
+ cfax_byte(nbytes, prn_stream);
+ for (i = 0; i < nbytes; i++)
+ cfax_byte(out[i], prn_stream);
+ } else {
+ cfax_byte(0, prn_stream);
+ cfax_word(nbytes, prn_stream);
+ for (i = 0; i < nbytes; i++)
+ cfax_byte(out[i], prn_stream);
+ }
+ } else {
+ cfax_byte(218, prn_stream);
+ }
}
- code = (*temp->process) (ss, &r, &w, 1 /* always last line */);
- nbytes = w.ptr - out + 1;
- if (!nul) {
- if (nbytes > 0) {
- if (nbytes < 217) {
- cfax_byte(nbytes, prn_stream);
- for (i = 0; i < nbytes; i++)
- cfax_byte(out[i], prn_stream);
- } else {
- cfax_byte(0, prn_stream);
- cfax_word(nbytes, prn_stream);
- for (i = 0; i < nbytes; i++)
- cfax_byte(out[i], prn_stream);
- }
- } else {
- cfax_byte(218, prn_stream);
- }
- }
- if (temp->release != 0)
- (*temp->release) (ss);
+ if (temp->release != 0)
+ (*temp->release) (ss);
}
#undef OUT_SIZE
@@ -188,7 +188,7 @@ cfax_begin_page(gx_device_printer * pdev, FILE * fp, int width)
pdev->width = width;
if (gdev_prn_file_is_new(pdev)) {
- cfax_doc_hdr(fp);
+ cfax_doc_hdr(fp);
}
cfax_page_hdr(pdev, fp);
@@ -211,7 +211,7 @@ cfax_print_page(gx_device_printer * pdev, FILE * prn_stream)
state.K = 0;
cfax_begin_page(pdev, prn_stream, state.Columns);
- code = cfax_stream_print_page_width(pdev, prn_stream,
+ code = cfax_stream_print_page_width(pdev, prn_stream,
&s_CFE_template, (stream_state *) &state, state.Columns);
return code;
}
diff --git a/gs/base/gdevcgm.c b/gs/base/gdevcgm.c
index eee9721e6..6eca73549 100644
--- a/gs/base/gdevcgm.c
+++ b/gs/base/gdevcgm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,9 +23,9 @@
#include "gdevpccm.h"
/**************** Future optimizations:
- Do tile_rectangle with pattern
- Keep track of painted area,
- do masked copy_mono with cell array if possible
+ Do tile_rectangle with pattern
+ Keep track of painted area,
+ do masked copy_mono with cell array if possible
****************/
typedef struct gx_device_cgm_s {
@@ -38,8 +38,8 @@ typedef struct gx_device_cgm_s {
/* GC descriptor */
gs_private_st_suffix_add1_final(st_device_cgm, gx_device_cgm,
- "gx_device_cgm", device_cgm_enum_ptrs, device_cgm_reloc_ptrs,
- gx_device_finalize, st_device, st);
+ "gx_device_cgm", device_cgm_enum_ptrs, device_cgm_reloc_ptrs,
+ gx_device_finalize, st_device, st);
/* Device procedures */
static dev_proc_open_device(cgm_open);
@@ -63,40 +63,40 @@ static dev_proc_put_params(cgm_put_params);
/* very concerned about performance. */
#define cgm_device(dname, depth, max_value, dither, map_rgb_color, map_color_rgb)\
{ std_device_color_stype_body(gx_device_cgm, 0, dname, &st_device_cgm,\
- 850, 1100, 100, 100, depth, max_value, dither),\
- { cgm_open,\
- NULL, /* get_initial_matrix */\
- NULL, /* sync_output */\
- cgm_output_page,\
- cgm_close,\
- map_rgb_color,\
- map_color_rgb,\
- cgm_fill_rectangle,\
- cgm_tile_rectangle,\
- cgm_copy_mono,\
- cgm_copy_color,\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- cgm_get_params,\
- cgm_put_params\
- },\
- { 0 }, /* fname */\
- 0, /* file */\
- 0, /* st */\
- 0 /*false*/ /* in_picture */\
+ 850, 1100, 100, 100, depth, max_value, dither),\
+ { cgm_open,\
+ NULL, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ cgm_output_page,\
+ cgm_close,\
+ map_rgb_color,\
+ map_color_rgb,\
+ cgm_fill_rectangle,\
+ cgm_tile_rectangle,\
+ cgm_copy_mono,\
+ cgm_copy_color,\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ cgm_get_params,\
+ cgm_put_params\
+ },\
+ { 0 }, /* fname */\
+ 0, /* file */\
+ 0, /* st */\
+ 0 /*false*/ /* in_picture */\
}
gx_device_cgm gs_cgmmono_device =
cgm_device("cgmmono", 1, 1, 2,
- gx_default_map_rgb_color, gx_default_w_b_map_color_rgb);
+ gx_default_map_rgb_color, gx_default_w_b_map_color_rgb);
gx_device_cgm gs_cgm8_device =
cgm_device("cgm8", 8, 5, 6,
- pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
+ pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
gx_device_cgm gs_cgm24_device =
cgm_device("cgm24", 24, 255, 255,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
/* Define allocator procedures for the CGM library. */
static void *
@@ -121,13 +121,13 @@ static int
cgm_error_code(cgm_result result)
{
switch (result) {
- default:
- case cgm_result_wrong_state:
- return gs_error_unknownerror;
- case cgm_result_out_of_range:
- return gs_error_rangecheck;
- case cgm_result_io_error:
- return gs_error_ioerror;
+ default:
+ case cgm_result_wrong_state:
+ return gs_error_unknownerror;
+ case cgm_result_out_of_range:
+ return gs_error_rangecheck;
+ case cgm_result_io_error:
+ return gs_error_ioerror;
}
}
#define check_result(result)\
@@ -148,13 +148,13 @@ cgm_open(gx_device * dev)
cdev->file = fopen(cdev->fname, "wb");
if (cdev->file == 0)
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
cal.private_data = cdev;
cal.alloc = cgm_gs_alloc;
cal.free = cgm_gs_free;
cdev->st = cgm_initialize(cdev->file, &cal);
if (cdev->st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
result = cgm_BEGIN_METAFILE(cdev->st, "", 0);
check_result(result);
meta.metafile_version = 1;
@@ -166,16 +166,16 @@ cgm_open(gx_device * dev)
meta.color_index_precision = 8;
meta.maximum_color_index = (1L << cdev->color_info.depth) - 1;
meta.metafile_element_list = elements,
- meta.metafile_element_list_count = countof(elements) / 2;
+ meta.metafile_element_list_count = countof(elements) / 2;
result = cgm_set_metafile_elements(cdev->st, &meta,
- cgm_set_METAFILE_VERSION |
- cgm_set_VDC_TYPE |
- cgm_set_INTEGER_PRECISION |
- cgm_set_INDEX_PRECISION |
- cgm_set_COLOR_PRECISION |
- cgm_set_COLOR_INDEX_PRECISION |
- cgm_set_MAXIMUM_COLOR_INDEX |
- cgm_set_METAFILE_ELEMENT_LIST);
+ cgm_set_METAFILE_VERSION |
+ cgm_set_VDC_TYPE |
+ cgm_set_INTEGER_PRECISION |
+ cgm_set_INDEX_PRECISION |
+ cgm_set_COLOR_PRECISION |
+ cgm_set_COLOR_INDEX_PRECISION |
+ cgm_set_MAXIMUM_COLOR_INDEX |
+ cgm_set_METAFILE_ELEMENT_LIST);
check_result(result);
cdev->in_picture = false;
return 0;
@@ -188,11 +188,11 @@ cgm_output_page(gx_device * dev, int num_copies, int flush)
gx_device_cgm *cdev = (gx_device_cgm *) dev;
if (cdev->in_picture) {
- cgm_result result = cgm_END_PICTURE(cdev->st);
+ cgm_result result = cgm_END_PICTURE(cdev->st);
- check_result(result);
- cdev->in_picture = false;
- return gx_finish_output_page(dev, num_copies, flush);
+ check_result(result);
+ cdev->in_picture = false;
+ return gx_finish_output_page(dev, num_copies, flush);
}
return 0;
}
@@ -206,7 +206,7 @@ cgm_close(gx_device * dev)
cgm_result result;
if (code < 0)
- return code;
+ return code;
result = cgm_END_METAFILE(cdev->st);
check_result(result);
result = cgm_terminate(cdev->st);
@@ -226,10 +226,10 @@ cgm_get_params(gx_device * dev, gs_param_list * plist)
gs_param_string ofns;
if (code < 0)
- return code;
+ return code;
ofns.data = (const byte *)cdev->fname,
- ofns.size = strlen(cdev->fname),
- ofns.persistent = false;
+ ofns.size = strlen(cdev->fname),
+ ofns.persistent = false;
return param_write_string(plist, "OutputFile", &ofns);
}
@@ -244,42 +244,42 @@ cgm_put_params(gx_device * dev, gs_param_list * plist)
gs_param_string ofs;
switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofs)) {
- case 0:
- if (dev->LockSafetyParams &&
- bytes_compare(ofs.data, ofs.size,
- (const byte *)cdev->fname, strlen(cdev->fname))) {
- ecode = gs_note_error(gs_error_invalidaccess);
- goto ofe;
- }
- if (ofs.size >= gp_file_name_sizeof)
- ecode = gs_error_limitcheck;
- else
- break;
- goto ofe;
- default:
- ecode = code;
- ofe:param_signal_error(plist, param_name, ecode);
- case 1:
- ofs.data = 0;
- break;
+ case 0:
+ if (dev->LockSafetyParams &&
+ bytes_compare(ofs.data, ofs.size,
+ (const byte *)cdev->fname, strlen(cdev->fname))) {
+ ecode = gs_note_error(gs_error_invalidaccess);
+ goto ofe;
+ }
+ if (ofs.size >= gp_file_name_sizeof)
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto ofe;
+ default:
+ ecode = code;
+ ofe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ ofs.data = 0;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gx_default_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
if (ofs.data != 0) { /* Close the file if it's open. */
- if (cdev->file != 0) {
- fclose(cdev->file);
- cdev->file = 0;
- }
- memcpy(cdev->fname, ofs.data, ofs.size);
- cdev->fname[ofs.size] = 0;
- cdev->file = fopen(cdev->fname, "wb");
- if (cdev->file == 0)
- return_error(gs_error_ioerror);
+ if (cdev->file != 0) {
+ fclose(cdev->file);
+ cdev->file = 0;
+ }
+ memcpy(cdev->fname, ofs.data, ofs.size);
+ cdev->fname[ofs.size] = 0;
+ cdev->file = fopen(cdev->fname, "wb");
+ if (cdev->file == 0)
+ return_error(gs_error_ioerror);
}
return 0;
}
@@ -316,48 +316,48 @@ cgm_begin_picture(gx_device_cgm * cdev)
check_result(result);
pic.scaling_mode = cgm_scaling_abstract;
pic.color_selection_mode =
- (cdev->color_info.depth <= 8 ?
- cgm_color_selection_indexed :
- cgm_color_selection_direct);
+ (cdev->color_info.depth <= 8 ?
+ cgm_color_selection_indexed :
+ cgm_color_selection_direct);
pic.line_width_specification_mode = cgm_line_marker_absolute;
pic.edge_width_specification_mode = cgm_line_marker_absolute;
cgm_set_rect(pic.vdc_extent, 0, 0, cdev->width, cdev->height);
result = cgm_set_picture_elements(cdev->st, &pic,
- cgm_set_SCALING_MODE |
- cgm_set_COLOR_SELECTION_MODE |
- cgm_set_LINE_WIDTH_SPECIFICATION_MODE |
- cgm_set_EDGE_WIDTH_SPECIFICATION_MODE |
- cgm_set_VDC_EXTENT);
+ cgm_set_SCALING_MODE |
+ cgm_set_COLOR_SELECTION_MODE |
+ cgm_set_LINE_WIDTH_SPECIFICATION_MODE |
+ cgm_set_EDGE_WIDTH_SPECIFICATION_MODE |
+ cgm_set_VDC_EXTENT);
check_result(result);
result = cgm_BEGIN_PICTURE_BODY(cdev->st);
check_result(result);
result = cgm_VDC_INTEGER_PRECISION(cdev->st,
- (cdev->width <= 0x7fff &&
- cdev->height <= 0x7fff ?
- 16 : sizeof(cdev->width) * 8));
+ (cdev->width <= 0x7fff &&
+ cdev->height <= 0x7fff ?
+ 16 : sizeof(cdev->width) * 8));
check_result(result);
edge.absolute.integer = 0;
result = cgm_EDGE_WIDTH(cdev->st, &edge);
check_result(result);
if (cdev->color_info.depth <= 8) {
- cgm_color colors[256];
- int i;
-
- for (i = 0; i < (1 << cdev->color_info.depth); i++) {
- gx_color_value rgb[3];
-
- (*dev_proc(cdev, map_color_rgb)) ((gx_device *) cdev,
- (gx_color_index) i, rgb);
- colors[i].rgb.r =
- rgb[0] >> (gx_color_value_bits - 8);
- colors[i].rgb.g =
- rgb[1] >> (gx_color_value_bits - 8);
- colors[i].rgb.b =
- rgb[2] >> (gx_color_value_bits - 8);
- }
- result = cgm_COLOR_TABLE(cdev->st, 0, colors,
- 1 << cdev->color_info.depth);
- check_result(result);
+ cgm_color colors[256];
+ int i;
+
+ for (i = 0; i < (1 << cdev->color_info.depth); i++) {
+ gx_color_value rgb[3];
+
+ (*dev_proc(cdev, map_color_rgb)) ((gx_device *) cdev,
+ (gx_color_index) i, rgb);
+ colors[i].rgb.r =
+ rgb[0] >> (gx_color_value_bits - 8);
+ colors[i].rgb.g =
+ rgb[1] >> (gx_color_value_bits - 8);
+ colors[i].rgb.b =
+ rgb[2] >> (gx_color_value_bits - 8);
+ }
+ result = cgm_COLOR_TABLE(cdev->st, 0, colors,
+ 1 << cdev->color_info.depth);
+ check_result(result);
}
cdev->in_picture = true;
return 0;
@@ -366,34 +366,34 @@ cgm_begin_picture(gx_device_cgm * cdev)
/* Convert a gx_color_index to a CGM color. */
static void
cgm_color_from_color_index(cgm_color * pcc, const gx_device_cgm * cdev,
- gx_color_index color)
+ gx_color_index color)
{
if (cdev->color_info.depth <= 8)
- pcc->index = color;
+ pcc->index = color;
else {
- pcc->rgb.r = color >> 16;
- pcc->rgb.g = (color >> 8) & 255;
- pcc->rgb.b = color & 255;
+ pcc->rgb.r = color >> 16;
+ pcc->rgb.g = (color >> 8) & 255;
+ pcc->rgb.b = color & 255;
}
}
/* Fill a rectangle. */
static int
cgm_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_cgm *cdev = (gx_device_cgm *) dev;
cgm_color fill_color;
cgm_point points[2];
cgm_result result;
-
+
fit_fill(dev, x, y, w, h);
if (!cdev->in_picture) { /* Check for erasepage. */
- gx_color_value blank[3] = {gx_max_color_value, gx_max_color_value,
- gx_max_color_value};
- if (color == (*dev_proc(dev, encode_color)) (dev, blank))
- return 0;
- cgm_begin_picture(cdev);
+ gx_color_value blank[3] = {gx_max_color_value, gx_max_color_value,
+ gx_max_color_value};
+ if (color == (*dev_proc(dev, encode_color)) (dev, blank))
+ return 0;
+ cgm_begin_picture(cdev);
}
cgm_color_from_color_index(&fill_color, cdev, color);
result = cgm_FILL_COLOR(cdev->st, &fill_color);
@@ -410,8 +410,8 @@ cgm_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Tile a rectangle. We should do this with a pattern if possible. */
static int
cgm_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one,
- int px, int py)
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one,
+ int px, int py)
{
}
#endif
@@ -425,8 +425,8 @@ cgm_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
/* for the case where we don't know the background color or it isn't white. */
static int
cgm_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_cgm *cdev = (gx_device_cgm *) dev;
@@ -438,33 +438,33 @@ cgm_copy_mono(gx_device * dev,
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
begin_picture(cdev);
if (zero == 0 && one == 1 && cdev->color_info.depth == 1) {
- cgm_point pqr[3];
+ cgm_point pqr[3];
- cgm_set_cell_points(pqr, x, y, w, h);
- result = cgm_CELL_ARRAY(cdev->st, pqr, w, h, 1,
- cgm_cell_mode_packed,
- base, sourcex, raster);
- check_result(result);
+ cgm_set_cell_points(pqr, x, y, w, h);
+ result = cgm_CELL_ARRAY(cdev->st, pqr, w, h, 1,
+ cgm_cell_mode_packed,
+ base, sourcex, raster);
+ check_result(result);
} else {
- result = cgm_INTERIOR_STYLE(cdev->st, cgm_interior_style_solid);
- check_result(result);
- for (iy = 0; iy < h; iy++)
- for (ix = 0; ix < w; ix++) {
- int px = ix + sourcex;
- const byte *pixel = &base[iy * raster + (px >> 3)];
- byte mask = 0x80 >> (px & 7);
- gx_color_index color = (*pixel & mask ? one : zero);
-
- if (color != gx_no_color_index) {
- cgm_color fill_color;
- cgm_point points[2];
-
- cgm_color_from_color_index(&fill_color, cdev, color);
- cgm_set_rect(points, x, y, 1, 1);
- result = cgm_RECTANGLE(cdev->st, &points[0], &points[1]);
- check_result(result);
- }
- }
+ result = cgm_INTERIOR_STYLE(cdev->st, cgm_interior_style_solid);
+ check_result(result);
+ for (iy = 0; iy < h; iy++)
+ for (ix = 0; ix < w; ix++) {
+ int px = ix + sourcex;
+ const byte *pixel = &base[iy * raster + (px >> 3)];
+ byte mask = 0x80 >> (px & 7);
+ gx_color_index color = (*pixel & mask ? one : zero);
+
+ if (color != gx_no_color_index) {
+ cgm_color fill_color;
+ cgm_point points[2];
+
+ cgm_color_from_color_index(&fill_color, cdev, color);
+ cgm_set_rect(points, x, y, 1, 1);
+ result = cgm_RECTANGLE(cdev->st, &points[0], &points[1]);
+ check_result(result);
+ }
+ }
}
return 0;
}
@@ -472,8 +472,8 @@ cgm_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
cgm_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_cgm *cdev = (gx_device_cgm *) dev;
int depth = cdev->color_info.depth;
@@ -482,14 +482,14 @@ cgm_copy_color(gx_device * dev,
cgm_result result;
if (depth == 1)
- return cgm_copy_mono(dev, base, sourcex, raster, id,
- x, y, w, h,
- (gx_color_index) 0, (gx_color_index) 1);
+ return cgm_copy_mono(dev, base, sourcex, raster, id,
+ x, y, w, h,
+ (gx_color_index) 0, (gx_color_index) 1);
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
begin_picture(cdev);
cgm_set_cell_points(pqr, x, y, w, h);
result = cgm_CELL_ARRAY(cdev->st, pqr, w, h, 0, cgm_cell_mode_packed,
- base, source_bit, raster);
+ base, source_bit, raster);
check_result(result);
return 0;
}
diff --git a/gs/base/gdevcgml.c b/gs/base/gdevcgml.c
index 6373f3231..005e2e4af 100644
--- a/gs/base/gdevcgml.c
+++ b/gs/base/gdevcgml.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -76,7 +76,7 @@ cgm_initialize(FILE * file, const cgm_allocator * cal)
cgm_state *st = (*cal->alloc) (cal->private_data, sizeof(cgm_state));
if (st == 0)
- return 0;
+ return 0;
st->file = file;
st->allocator = *cal;
/* Initialize metafile elements. */
@@ -139,7 +139,7 @@ cgm_initialize(FILE * file, const cgm_allocator * cal)
/* pattern_size */
/* color_table */
memset(st->source_flags, (byte) cgm_aspect_source_individual,
- sizeof(st->source_flags));
+ sizeof(st->source_flags));
return st;
}
@@ -165,87 +165,87 @@ cgm_result
cgm_set_metafile_elements(cgm_state * st, const cgm_metafile_elements * meta, long mask)
{
if ((mask & cgm_set_METAFILE_VERSION)) {
- OP(METAFILE_VERSION);
- I(meta->metafile_version);
- END_OP;
- st->metafile.metafile_version = meta->metafile_version;
+ OP(METAFILE_VERSION);
+ I(meta->metafile_version);
+ END_OP;
+ st->metafile.metafile_version = meta->metafile_version;
}
if ((mask & cgm_set_METAFILE_DESCRIPTION)) {
- OP(METAFILE_DESCRIPTION);
- S(meta->metafile_description.chars, meta->metafile_description.length);
- END_OP;
- st->metafile.metafile_description = meta->metafile_description;
+ OP(METAFILE_DESCRIPTION);
+ S(meta->metafile_description.chars, meta->metafile_description.length);
+ END_OP;
+ st->metafile.metafile_description = meta->metafile_description;
}
if ((mask & cgm_set_VDC_TYPE)) {
- OP(VDC_TYPE);
- E(meta->vdc_type);
- END_OP;
- st->metafile.vdc_type = meta->vdc_type;
+ OP(VDC_TYPE);
+ E(meta->vdc_type);
+ END_OP;
+ st->metafile.vdc_type = meta->vdc_type;
}
if ((mask & cgm_set_INTEGER_PRECISION)) {
- OP(INTEGER_PRECISION);
- I(meta->integer_precision);
- END_OP;
- st->metafile.integer_precision = meta->integer_precision;
+ OP(INTEGER_PRECISION);
+ I(meta->integer_precision);
+ END_OP;
+ st->metafile.integer_precision = meta->integer_precision;
}
if ((mask & cgm_set_REAL_PRECISION)) {
- OP(REAL_PRECISION);
- put_real_precision(st, &meta->real_precision);
- END_OP;
- st->metafile.real_precision = meta->real_precision;
+ OP(REAL_PRECISION);
+ put_real_precision(st, &meta->real_precision);
+ END_OP;
+ st->metafile.real_precision = meta->real_precision;
}
if ((mask & cgm_set_INDEX_PRECISION)) {
- OP(INDEX_PRECISION);
- I(meta->index_precision);
- END_OP;
- st->metafile.index_precision = meta->index_precision;
+ OP(INDEX_PRECISION);
+ I(meta->index_precision);
+ END_OP;
+ st->metafile.index_precision = meta->index_precision;
}
if ((mask & cgm_set_COLOR_PRECISION)) {
- OP(COLOR_PRECISION);
- I(meta->color_precision);
- END_OP;
- st->metafile.color_index_precision = meta->color_index_precision;
+ OP(COLOR_PRECISION);
+ I(meta->color_precision);
+ END_OP;
+ st->metafile.color_index_precision = meta->color_index_precision;
}
if ((mask & cgm_set_COLOR_INDEX_PRECISION)) {
- OP(COLOR_INDEX_PRECISION);
- I(meta->color_index_precision);
- END_OP;
- st->metafile.color_index_precision = meta->color_index_precision;
+ OP(COLOR_INDEX_PRECISION);
+ I(meta->color_index_precision);
+ END_OP;
+ st->metafile.color_index_precision = meta->color_index_precision;
}
if ((mask & cgm_set_MAXIMUM_COLOR_INDEX)) {
- OP(MAXIMUM_COLOR_INDEX);
- CI(meta->maximum_color_index);
- END_OP;
- st->metafile.maximum_color_index = meta->maximum_color_index;
+ OP(MAXIMUM_COLOR_INDEX);
+ CI(meta->maximum_color_index);
+ END_OP;
+ st->metafile.maximum_color_index = meta->maximum_color_index;
}
if ((mask & cgm_set_METAFILE_ELEMENT_LIST)) {
- int i;
- const int *p;
-
- OP(METAFILE_ELEMENT_LIST);
- for (i = 0, p = meta->metafile_element_list;
- i < meta->metafile_element_list_count;
- i++, p += 2
- ) {
- I(p[0]);
- I(p[1]);
- }
- END_OP;
- st->metafile.metafile_element_list =
- meta->metafile_element_list;
- st->metafile.metafile_element_list_count =
- meta->metafile_element_list_count;
+ int i;
+ const int *p;
+
+ OP(METAFILE_ELEMENT_LIST);
+ for (i = 0, p = meta->metafile_element_list;
+ i < meta->metafile_element_list_count;
+ i++, p += 2
+ ) {
+ I(p[0]);
+ I(p[1]);
+ }
+ END_OP;
+ st->metafile.metafile_element_list =
+ meta->metafile_element_list;
+ st->metafile.metafile_element_list_count =
+ meta->metafile_element_list_count;
}
/* element list */
if ((mask & cgm_set_FONT_LIST)) {
- int i;
-
- OP(FONT_LIST);
- for (i = 0; i < meta->font_list_count; ++i)
- S(meta->font_list[i].chars, meta->font_list[i].length);
- END_OP;
- st->metafile.font_list = meta->font_list;
- st->metafile.font_list_count = meta->font_list_count;
+ int i;
+
+ OP(FONT_LIST);
+ for (i = 0; i < meta->font_list_count; ++i)
+ S(meta->font_list[i].chars, meta->font_list[i].length);
+ END_OP;
+ st->metafile.font_list = meta->font_list;
+ st->metafile.font_list_count = meta->font_list_count;
}
/* character set list */
/* character coding announcer */
@@ -273,50 +273,50 @@ cgm_result
cgm_set_picture_elements(cgm_state * st, const cgm_picture_elements * pic, long mask)
{
if ((mask & cgm_set_SCALING_MODE)) {
- OP(SCALING_MODE);
- E(pic->scaling_mode);
- R(pic->scale_factor);
- st->picture.scaling_mode = pic->scaling_mode;
- st->picture.scale_factor = pic->scale_factor;
- END_OP;
+ OP(SCALING_MODE);
+ E(pic->scaling_mode);
+ R(pic->scale_factor);
+ st->picture.scaling_mode = pic->scaling_mode;
+ st->picture.scale_factor = pic->scale_factor;
+ END_OP;
}
if ((mask & cgm_set_COLOR_SELECTION_MODE)) {
- OP(COLOR_SELECTION_MODE);
- E(pic->color_selection_mode);
- END_OP;
- st->picture.color_selection_mode = pic->color_selection_mode;
+ OP(COLOR_SELECTION_MODE);
+ E(pic->color_selection_mode);
+ END_OP;
+ st->picture.color_selection_mode = pic->color_selection_mode;
}
if ((mask & cgm_set_LINE_WIDTH_SPECIFICATION_MODE)) {
- OP(LINE_WIDTH_SPECIFICATION_MODE);
- E(pic->line_width_specification_mode);
- END_OP;
- st->picture.line_width_specification_mode = pic->line_width_specification_mode;
+ OP(LINE_WIDTH_SPECIFICATION_MODE);
+ E(pic->line_width_specification_mode);
+ END_OP;
+ st->picture.line_width_specification_mode = pic->line_width_specification_mode;
}
if ((mask & cgm_set_MARKER_SIZE_SPECIFICATION_MODE)) {
- OP(MARKER_SIZE_SPECIFICATION_MODE);
- E(pic->marker_size_specification_mode);
- END_OP;
- st->picture.marker_size_specification_mode = pic->marker_size_specification_mode;
+ OP(MARKER_SIZE_SPECIFICATION_MODE);
+ E(pic->marker_size_specification_mode);
+ END_OP;
+ st->picture.marker_size_specification_mode = pic->marker_size_specification_mode;
}
if ((mask & cgm_set_EDGE_WIDTH_SPECIFICATION_MODE)) {
- OP(EDGE_WIDTH_SPECIFICATION_MODE);
- E(pic->edge_width_specification_mode);
- END_OP;
- st->picture.edge_width_specification_mode = pic->edge_width_specification_mode;
+ OP(EDGE_WIDTH_SPECIFICATION_MODE);
+ E(pic->edge_width_specification_mode);
+ END_OP;
+ st->picture.edge_width_specification_mode = pic->edge_width_specification_mode;
}
if ((mask & cgm_set_VDC_EXTENT)) {
- OP(VDC_EXTENT);
- P(&pic->vdc_extent[0]);
- P(&pic->vdc_extent[1]);
- END_OP;
- st->picture.vdc_extent[0] = pic->vdc_extent[0];
- st->picture.vdc_extent[1] = pic->vdc_extent[1];
+ OP(VDC_EXTENT);
+ P(&pic->vdc_extent[0]);
+ P(&pic->vdc_extent[1]);
+ END_OP;
+ st->picture.vdc_extent[0] = pic->vdc_extent[0];
+ st->picture.vdc_extent[1] = pic->vdc_extent[1];
}
if ((mask & cgm_set_BACKGROUND_COLOR)) {
- OP(BACKGROUND_COLOR);
- CD(&pic->background_color.rgb);
- DONE;
- st->picture.background_color = pic->background_color;
+ OP(BACKGROUND_COLOR);
+ CD(&pic->background_color.rgb);
+ DONE;
+ st->picture.background_color = pic->background_color;
}
return st->result;
}
@@ -341,12 +341,12 @@ cgm_result
cgm_VDC_INTEGER_PRECISION(cgm_state * st, int precision)
{
if (st->vdc_integer_precision != precision) {
- OP(VDC_INTEGER_PRECISION);
- I(precision);
- st->vdc_integer_precision = precision;
- DONE;
+ OP(VDC_INTEGER_PRECISION);
+ I(precision);
+ st->vdc_integer_precision = precision;
+ DONE;
} else
- return cgm_result_ok;
+ return cgm_result_ok;
}
cgm_result
@@ -467,8 +467,8 @@ cgm_POLYGON_SET(cgm_state * st, const cgm_polygon_edge * vertices, int count)
OP(POLYGON);
for (i = 0; i < count; ++i) {
- P(&vertices[i].vertex);
- E(vertices[i].edge_out);
+ P(&vertices[i].vertex);
+ E(vertices[i].edge_out);
}
DONE;
}
@@ -493,30 +493,30 @@ cgm_CELL_ARRAY(cgm_state * st, const cgm_point * pqr /*[3] */ , cgm_int nx, cgm_
I(local_color_precision);
E(mode);
if (precision == 0)
- precision = (st->picture.color_selection_mode ==
- cgm_color_selection_indexed ?
- st->metafile.color_index_precision :
- st->metafile.color_precision);
+ precision = (st->picture.color_selection_mode ==
+ cgm_color_selection_indexed ?
+ st->metafile.color_index_precision :
+ st->metafile.color_precision);
bits_per_pixel =
- (st->picture.color_selection_mode == cgm_color_selection_indexed ?
- precision : precision * 3);
+ (st->picture.color_selection_mode == cgm_color_selection_indexed ?
+ precision : precision * 3);
row_bytes = (bits_per_pixel * nx + 7) >> 3;
for (y = 0; y < ny; y++, row += raster) {
- if (bit == 0)
- put_bytes(st, row, row_bytes);
- else {
- uint i;
-
- for (i = 0; i < row_bytes; i++) {
- byte b = (row[i] << bit) +
- (row[i + 1] >> (8 - bit));
-
- put_byte(st, b);
- }
- }
- if ((row_bytes & 1)) {
- put_byte(st, 0);
- }
+ if (bit == 0)
+ put_bytes(st, row, row_bytes);
+ else {
+ uint i;
+
+ for (i = 0; i < row_bytes; i++) {
+ byte b = (row[i] << bit) +
+ (row[i + 1] >> (8 - bit));
+
+ put_byte(st, b);
+ }
+ }
+ if ((row_bytes & 1)) {
+ put_byte(st, 0);
+ }
}
DONE;
}
@@ -922,20 +922,20 @@ cgm_COLOR_TABLE(cgm_state * st, cgm_int index, const cgm_color * values, int cou
OP(COLOR_TABLE);
CI(index);
for (i = 0; i < count; ++i)
- CD(&values[i].rgb);
+ CD(&values[i].rgb);
DONE;
}
-cgm_result
+cgm_result
cgm_ASPECT_SOURCE_FLAGS(cgm_state * st, const cgm_aspect_source_flag * flags, int count)
{
int i;
OP(ASPECT_SOURCE_FLAGS);
for (i = 0; i < count; ++i) {
- E(flags[i].type);
- E(flags[i].source);
- st->source_flags[flags[i].type] = (byte) flags[i].source;
+ E(flags[i].type);
+ E(flags[i].source);
+ st->source_flags[flags[i].type] = (byte) flags[i].source;
}
DONE;
}
@@ -964,32 +964,32 @@ write_command(cgm_state * st, bool last)
int count = st->command_count;
if (st->command_first) {
- if (count <= 34) {
- command[2] = command[0];
- command[3] = command[1] + count - 4;
- command += 2, count -= 2;
- } else {
- int pcount = count - 4;
-
- command[1] |= 31;
- command[2] = (byte) (pcount >> 8);
- if (!last)
- command[2] |= 0x80;
- command[3] = (byte) pcount;
- }
- st->command_first = false;
+ if (count <= 34) {
+ command[2] = command[0];
+ command[3] = command[1] + count - 4;
+ command += 2, count -= 2;
+ } else {
+ int pcount = count - 4;
+
+ command[1] |= 31;
+ command[2] = (byte) (pcount >> 8);
+ if (!last)
+ command[2] |= 0x80;
+ command[3] = (byte) pcount;
+ }
+ st->command_first = false;
} else {
- int pcount = count - 2;
+ int pcount = count - 2;
- command[0] = (byte) (pcount >> 8);
- if (!last)
- command[0] |= 0x80;
- command[1] = (byte) pcount;
+ command[0] = (byte) (pcount >> 8);
+ if (!last)
+ command[0] |= 0x80;
+ command[1] = (byte) pcount;
}
fwrite(command, sizeof(byte), count + (count & 1), st->file);
st->command_count = 2; /* leave room for extension header */
if (ferror(st->file))
- st->result = cgm_result_io_error;
+ st->result = cgm_result_io_error;
}
/* End a command. */
@@ -1005,14 +1005,14 @@ static void
put_int(cgm_state * st, cgm_int value, int precision)
{
switch (precision) {
- case 32:
- put_byte(st, value >> 24);
- case 24:
- put_byte(st, value >> 16);
- case 16:
- put_byte(st, value >> 8);
- case 8:
- put_byte(st, value);
+ case 32:
+ put_byte(st, value >> 24);
+ case 24:
+ put_byte(st, value >> 16);
+ case 16:
+ put_byte(st, value >> 8);
+ case 8:
+ put_byte(st, value);
}
}
@@ -1022,24 +1022,24 @@ put_real(cgm_state * st, cgm_real value, const cgm_precision * pr)
{
if (pr->representation == cgm_representation_floating) {
} else { /* Casting to integer simply discards the fraction, */
- /* so we need to be careful with negative values. */
- long whole = (long)value;
- double fpart;
-
- if (value < whole)
- --whole;
- fpart = value - whole;
- put_int(st, whole, pr->exponent_or_whole_width);
- if (pr->fraction_width == 16) {
- uint fraction = (uint) (fpart * (1.0 * 0x10000));
-
- put_int(st, fraction, 16);
- } else { /* pr->fraction_width == 32 */
- ulong fraction =
- (ulong) (fpart * (1.0 * 0x10000 * 0x10000));
-
- put_int(st, fraction, 32);
- }
+ /* so we need to be careful with negative values. */
+ long whole = (long)value;
+ double fpart;
+
+ if (value < whole)
+ --whole;
+ fpart = value - whole;
+ put_int(st, whole, pr->exponent_or_whole_width);
+ if (pr->fraction_width == 16) {
+ uint fraction = (uint) (fpart * (1.0 * 0x10000));
+
+ put_int(st, fraction, 16);
+ } else { /* pr->fraction_width == 32 */
+ ulong fraction =
+ (ulong) (fpart * (1.0 * 0x10000 * 0x10000));
+
+ put_int(st, fraction, 32);
+ }
}
}
@@ -1057,20 +1057,20 @@ static void
put_vdc(cgm_state * st, const cgm_vdc * pvdc)
{
if (st->metafile.vdc_type == cgm_vdc_integer)
- put_int(st, pvdc->integer, st->vdc_integer_precision);
+ put_int(st, pvdc->integer, st->vdc_integer_precision);
else
- put_real(st, pvdc->real, &st->vdc_real_precision);
+ put_real(st, pvdc->real, &st->vdc_real_precision);
}
/* Put a VDC or a real. */
static void
put_vdc_r(cgm_state * st, const cgm_line_marker_extent * extent,
- cgm_line_marker_specification_mode mode)
+ cgm_line_marker_specification_mode mode)
{
if (mode == cgm_line_marker_absolute)
- VDC(&extent->absolute);
+ VDC(&extent->absolute);
else
- R(extent->scaled);
+ R(extent->scaled);
}
/* Put a point (pair of VDCs). */
@@ -1078,11 +1078,11 @@ static void
put_point(cgm_state * st, const cgm_point * ppt)
{
if (st->metafile.vdc_type == cgm_vdc_integer) {
- put_int(st, ppt->integer.x, st->vdc_integer_precision);
- put_int(st, ppt->integer.y, st->vdc_integer_precision);
+ put_int(st, ppt->integer.x, st->vdc_integer_precision);
+ put_int(st, ppt->integer.y, st->vdc_integer_precision);
} else {
- put_real(st, ppt->real.x, &st->vdc_real_precision);
- put_real(st, ppt->real.y, &st->vdc_real_precision);
+ put_real(st, ppt->real.x, &st->vdc_real_precision);
+ put_real(st, ppt->real.y, &st->vdc_real_precision);
}
}
@@ -1093,7 +1093,7 @@ put_points(cgm_state * st, const cgm_point * ppt, int count)
int i;
for (i = 0; i < count; i++)
- P(ppt + i);
+ P(ppt + i);
}
/* Put bytes. */
@@ -1103,11 +1103,11 @@ put_bytes(cgm_state * st, const byte * data, uint length)
int count;
while (length > (count = command_max_count - st->command_count)) {
- memcpy(st->command + st->command_count, data, count);
- st->command_count += count;
- write_command(st, false);
- data += count;
- length -= count;
+ memcpy(st->command + st->command_count, data, count);
+ st->command_count += count;
+ write_command(st, false);
+ data += count;
+ length -= count;
}
memcpy(st->command + st->command_count, data, length);
st->command_count += length;
@@ -1120,13 +1120,13 @@ put_string(cgm_state * st, const char *data, uint length)
/* mechanism for commands and the mechanism for strings */
/* are orthogonal; we take this interpretation. */
if (length >= 255) {
- put_byte(st, 255);
- while (length > 32767) {
- put_int(st, 65535, 2);
- put_bytes(st, (const byte *)data, 32767);
- data += 32767;
- length -= 32767;
- }
+ put_byte(st, 255);
+ while (length > 32767) {
+ put_int(st, 65535, 2);
+ put_bytes(st, (const byte *)data, 32767);
+ data += 32767;
+ length -= 32767;
+ }
}
put_byte(st, length);
put_bytes(st, (const byte *)data, length);
@@ -1137,9 +1137,9 @@ static void
put_color(cgm_state * st, const cgm_color * color)
{
if (st->picture.color_selection_mode == cgm_color_selection_indexed)
- CI(color->index);
+ CI(color->index);
else
- CD(&color->rgb);
+ CD(&color->rgb);
}
/* Put an RGB value. */
diff --git a/gs/base/gdevcgml.h b/gs/base/gdevcgml.h
index f61c18380..b11f0946e 100644
--- a/gs/base/gdevcgml.h
+++ b/gs/base/gdevcgml.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -104,7 +104,7 @@ typedef enum {
} cgm_clip_indicator;
typedef struct cgm_precision_s {
enum {
- cgm_representation_floating, cgm_representation_fixed
+ cgm_representation_floating, cgm_representation_fixed
} representation;
int exponent_or_whole_width;
int fraction_width;
@@ -273,7 +273,7 @@ typedef struct cgm_metafile_elements_s {
cgm_result
cgm_BEGIN_METAFILE(cgm_state *, const char *, uint),
cgm_set_metafile_elements(cgm_state *,
- const cgm_metafile_elements *, long),
+ const cgm_metafile_elements *, long),
cgm_END_METAFILE(cgm_state *);
/* ---------------- Picture elements ---------------- */
@@ -300,7 +300,7 @@ typedef struct cgm_picture_elements_s {
cgm_result
cgm_BEGIN_PICTURE(cgm_state *, const char *, uint),
cgm_set_picture_elements(cgm_state *,
- const cgm_picture_elements *, long),
+ const cgm_picture_elements *, long),
cgm_BEGIN_PICTURE_BODY(cgm_state *),
cgm_END_PICTURE(cgm_state *);
@@ -322,39 +322,39 @@ cgm_result
cgm_POLYMARKER(cgm_state *, const cgm_point *, int),
cgm_TEXT(cgm_state *, const cgm_point *, bool, const char *, uint),
cgm_RESTRICTED_TEXT(cgm_state *, const cgm_vdc *, const cgm_vdc *,
- const cgm_point *, bool, const char *, uint),
+ const cgm_point *, bool, const char *, uint),
cgm_APPEND_TEXT(cgm_state *, bool, const char *, uint),
cgm_POLYGON(cgm_state *, const cgm_point *, int),
cgm_POLYGON_SET(cgm_state *, const cgm_polygon_edge *, int),
cgm_CELL_ARRAY(cgm_state *, const cgm_point * /*[3] */ , cgm_int,
- cgm_int, cgm_int, cgm_cell_representation_mode,
- const byte *, uint, uint),
+ cgm_int, cgm_int, cgm_cell_representation_mode,
+ const byte *, uint, uint),
cgm_RECTANGLE(cgm_state *, const cgm_point *, const cgm_point *),
cgm_CIRCLE(cgm_state *, const cgm_point *, const cgm_vdc *),
cgm_CIRCULAR_ARC_3_POINT(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *),
+ const cgm_point *, const cgm_point *),
cgm_CIRCULAR_ARC_3_POINT_CLOSE(cgm_state *, const cgm_point *,
- const cgm_point *,
- const cgm_point *, cgm_arc_closure),
+ const cgm_point *,
+ const cgm_point *, cgm_arc_closure),
cgm_CIRCULAR_ARC_CENTER(cgm_state *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *),
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *),
cgm_CIRCULAR_ARC_CENTER_CLOSE(cgm_state *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, cgm_arc_closure),
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, cgm_arc_closure),
cgm_ELLIPSE(cgm_state *, const cgm_point *, const cgm_point *,
- const cgm_point *),
+ const cgm_point *),
cgm_ELLIPTICAL_ARC(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *),
+ const cgm_point *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *),
cgm_ELLIPTICAL_ARC_CLOSE(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- cgm_arc_closure);
+ const cgm_point *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ cgm_arc_closure);
/* ---------------- Attribute elements ---------------- */
@@ -375,11 +375,11 @@ cgm_result
cgm_TEXT_COLOR(cgm_state *, const cgm_color *),
cgm_CHARACTER_HEIGHT(cgm_state *, const cgm_vdc *),
cgm_CHARACTER_ORIENTATION(cgm_state *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *),
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *),
cgm_TEXT_PATH(cgm_state *, cgm_text_path),
cgm_TEXT_ALIGNMENT(cgm_state *, cgm_text_alignment_horizontal,
- cgm_text_alignment_vertical, cgm_real, cgm_real),
+ cgm_text_alignment_vertical, cgm_real, cgm_real),
cgm_CHARACTER_SET_INDEX(cgm_state *, cgm_int),
/* The following should be cgm_ALTERNATE_..., but the VAX DEC C */
/* compiler gives an error for names longer than 31 characters. */
@@ -397,7 +397,7 @@ cgm_result
cgm_FILL_REFERENCE_POINT(cgm_state *, const cgm_point *),
/* PATTERN_TABLE */
cgm_PATTERN_SIZE(cgm_state *, const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *),
+ const cgm_vdc *, const cgm_vdc *),
cgm_COLOR_TABLE(cgm_state *, cgm_int, const cgm_color *, int),
cgm_ASPECT_SOURCE_FLAGS(cgm_state *, const cgm_aspect_source_flag *, int);
diff --git a/gs/base/gdevcgmx.h b/gs/base/gdevcgmx.h
index 6cfb72c6b..270141f05 100644
--- a/gs/base/gdevcgmx.h
+++ b/gs/base/gdevcgmx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -123,7 +123,7 @@ typedef enum {
} cgm_op_index;
/* Define the state of the CGM writer. */
- /*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */
+ /*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */
struct cgm_state_s {
/* The following are set at initialization time. */
FILE *file;
diff --git a/gs/base/gdevcif.c b/gs/base/gdevcif.c
index 624ae7a7b..f6fb2f4ae 100644
--- a/gs/base/gdevcif.c
+++ b/gs/base/gdevcif.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,7 +14,7 @@
/*
CIF output driver
- The `Fake bitmapped device to estimate rendering time'
+ The `Fake bitmapped device to estimate rendering time'
slightly modified to produce CIF files from PostScript.
So anyone can put a nice logo free on its chip!
Frederic Petrot, petrot@masi.ibp.fr */
@@ -33,37 +33,37 @@
static dev_proc_print_page(cif_print_page);
const gx_device_printer far_data gs_cif_device =
prn_device(prn_std_procs, "cif",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0,
- 1, cif_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0,
+ 1, cif_print_page);
/* Send the page to the output. */
static int
cif_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- int lnum;
- byte *in = (byte *)gs_malloc(pdev->memory, line_size, 1, "cif_print_page(in)");
- char *s;
- int scanline, scanbyte;
- int length, start; /* length is the number of successive 1 bits, */
- /* start is the set of 1 bit start position */
+ int lnum;
+ byte *in = (byte *)gs_malloc(pdev->memory, line_size, 1, "cif_print_page(in)");
+ char *s;
+ int scanline, scanbyte;
+ int length, start; /* length is the number of successive 1 bits, */
+ /* start is the set of 1 bit start position */
- if (in == 0)
- return_error(gs_error_VMerror);
+ if (in == 0)
+ return_error(gs_error_VMerror);
- if ((s = strchr(pdev->fname, '.')) == NULL)
- length = strlen(pdev->fname) + 1;
- else
- length = s - pdev->fname;
- s = (char *)gs_malloc(pdev->memory, length, sizeof(char), "cif_print_page(s)");
+ if ((s = strchr(pdev->fname, '.')) == NULL)
+ length = strlen(pdev->fname) + 1;
+ else
+ length = s - pdev->fname;
+ s = (char *)gs_malloc(pdev->memory, length, sizeof(char), "cif_print_page(s)");
- strncpy(s, pdev->fname, length);
- *(s + length) = '\0';
- fprintf(prn_stream, "DS1 25 1;\n9 %s;\nLCP;\n", s);
- gs_free(pdev->memory, s, length, 1, "cif_print_page(s)");
+ strncpy(s, pdev->fname, length);
+ *(s + length) = '\0';
+ fprintf(prn_stream, "DS1 25 1;\n9 %s;\nLCP;\n", s);
+ gs_free(pdev->memory, s, length, 1, "cif_print_page(s)");
- for (lnum = 0; lnum < pdev->height; lnum++) {
+ for (lnum = 0; lnum < pdev->height; lnum++) {
gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
length = 0;
for (scanline = 0; scanline < line_size; scanline++)
@@ -89,7 +89,7 @@ cif_print_page(gx_device_printer *pdev, FILE *prn_stream)
}
#endif
}
- fprintf(prn_stream, "DF;\nC1;\nE\n");
- gs_free(pdev->memory, in, line_size, 1, "cif_print_page(in)");
- return 0;
+ fprintf(prn_stream, "DF;\nC1;\nE\n");
+ gs_free(pdev->memory, in, line_size, 1, "cif_print_page(in)");
+ return 0;
}
diff --git a/gs/base/gdevclj.c b/gs/base/gdevclj.c
index 7644a59bc..361c06eff 100644
--- a/gs/base/gdevclj.c
+++ b/gs/base/gdevclj.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,9 +22,9 @@
typedef struct gx_device_clj_s gx_device_clj;
struct gx_device_clj_s {
- gx_device_common;
- gx_prn_device_common;
- bool rotated;
+ gx_device_common;
+ gx_prn_device_common;
+ bool rotated;
};
#define pclj ((gx_device_clj *)pdev)
@@ -101,12 +101,10 @@ static const clj_paper_size clj_paper_sizes[] = {
*/
static const float supported_resolutions[] = { 75.0, 100.0, 150.0, 300.0 };
-
/* indicate the maximum supported resolution and scan-line length (pts) */
#define CLJ_MAX_RES 300.0
#define CLJ_MAX_SCANLINE (12.0 * 72.0)
-
/*
* Determine a requested resolution pair is supported.
*/
@@ -184,15 +182,15 @@ clj_get_initial_matrix( gx_device *pdev, gs_matrix *pmat)
/* This shouldn't be possible since clj_put_params rejects */
/* unknown media sizes. */
if (psize == 0) {
- pmat->xx = fs_res;
- pmat->xy = 0.0;
- pmat->yx = 0.0;
- pmat->yy = -ss_res;
- pmat->tx = 0.0;
- pmat->ty = pdev->MediaSize[1] * ss_res;
- return;
+ pmat->xx = fs_res;
+ pmat->xy = 0.0;
+ pmat->yx = 0.0;
+ pmat->yy = -ss_res;
+ pmat->tx = 0.0;
+ pmat->ty = pdev->MediaSize[1] * ss_res;
+ return;
}
-
+
if (pclj->rotated) {
pmat->xx = 0.0;
pmat->xy = ss_res;
@@ -225,18 +223,18 @@ clj_get_params(gx_device *pdev, gs_param_list *plist)
code = gdev_begin_input_media(plist, &mdict, countof(clj_paper_sizes));
if (code < 0)
- ecode = code;
+ ecode = code;
else {
- for (i = 0; i < countof(clj_paper_sizes); ++i) {
- code = gdev_write_input_page_size(i, &mdict,
- clj_paper_sizes[i].width,
- clj_paper_sizes[i].height);
- if (code < 0)
- ecode = code;
- }
- code = gdev_end_input_media(plist, &mdict);
- if (code < 0)
- ecode = code;
+ for (i = 0; i < countof(clj_paper_sizes); ++i) {
+ code = gdev_write_input_page_size(i, &mdict,
+ clj_paper_sizes[i].width,
+ clj_paper_sizes[i].height);
+ if (code < 0)
+ ecode = code;
+ }
+ code = gdev_end_input_media(plist, &mdict);
+ if (code < 0)
+ ecode = code;
}
return ecode;
}
@@ -255,20 +253,20 @@ clj_media_size(float mediasize[2], gs_param_list *plist)
int have_pagesize = 0;
if ( (param_read_float_array(plist, "HWResolution", &fres) == 0) &&
- !is_supported_resolution(fres.data) )
+ !is_supported_resolution(fres.data) )
return_error(gs_error_rangecheck);
if ( (param_read_float_array(plist, "PageSize", &fsize) == 0) ||
(param_read_float_array(plist, ".MediaSize", &fsize) == 0) ) {
- mediasize[0] = fsize.data[0];
- mediasize[1] = fsize.data[1];
- have_pagesize = 1;
+ mediasize[0] = fsize.data[0];
+ mediasize[1] = fsize.data[1];
+ have_pagesize = 1;
}
if (param_read_int_array(plist, "HWSize", &hwsize) == 0) {
mediasize[0] = ((float)hwsize.data[0]) * 72 / fres.data[0];
mediasize[1] = ((float)hwsize.data[1]) * 72 / fres.data[1];
- have_pagesize = 1;
+ have_pagesize = 1;
}
return have_pagesize;
@@ -289,10 +287,10 @@ clj_put_params(
int have_pagesize = clj_media_size(mediasize, plist);
if (have_pagesize < 0)
- return have_pagesize;
+ return have_pagesize;
if (have_pagesize) {
- if (get_paper_size(mediasize, &rotate) == 0 || rotate)
- return_error(gs_error_rangecheck);
+ if (get_paper_size(mediasize, &rotate) == 0 || rotate)
+ return_error(gs_error_rangecheck);
}
return gdev_prn_put_params(pdev, plist);
}
@@ -434,17 +432,16 @@ clj_print_page(
cdata[1] = cdata[0] + clsize;
cdata[2] = cdata[1] + clsize;
-
/* Imageable area is without the margins. Note that the actual rotation
* of page size into pdev->width & height has been done. We just use
* rotate to access the correct offsets. */
if (pclj->rotated) {
- imageable_width = pdev->width - (2 * psize->offsets.x) * fs_res;
- imageable_height = pdev->height - (2 * psize->offsets.y) * ss_res;
+ imageable_width = pdev->width - (2 * psize->offsets.x) * fs_res;
+ imageable_height = pdev->height - (2 * psize->offsets.y) * ss_res;
}
else {
- imageable_width = pdev->width - (2 * psize->offsets.y) * ss_res;
- imageable_height = pdev->height - (2 * psize->offsets.x) * fs_res;
+ imageable_width = pdev->width - (2 * psize->offsets.y) * ss_res;
+ imageable_height = pdev->height - (2 * psize->offsets.x) * fs_res;
}
/* start the page. The pcl origin (0, 150 dots by default, y
@@ -455,7 +452,7 @@ clj_print_page(
fprintf( prn_stream,
"\033E\033&u300D\033&l%da1x%dO\033*p0x0y+50x-100Y\033*t%dR"
#ifdef USE_FAST_MODE
- "\033*r-3U"
+ "\033*r-3U"
#else
"\033*v6W\001\002\003\001\001\001"
#endif
@@ -473,8 +470,8 @@ clj_print_page(
gdev_prn_copy_scan_lines(pdev, i, data, lsize);
- /* The 'lsize' bytes of data have the blank margin area at the end due */
- /* to the 'initial_matrix' offsets that are applied. */
+ /* The 'lsize' bytes of data have the blank margin area at the end due */
+ /* to the 'initial_matrix' offsets that are applied. */
pack_and_compress_scanline(data, imageable_width, cdata, clen);
if ((clen[0] == 0) && (clen[1] == 0) && (clen[2] == 0))
++blank_lines;
@@ -578,14 +575,14 @@ clj_pr_get_params( gx_device *pdev, gs_param_list *plist )
/* First un-rotate the MediaSize, etc. if we were in a rotated mode */
if (pclj->rotated) {
float ftmp;
- int itmp;
-
- ftmp = pdev->MediaSize[0];
- pdev->MediaSize[0] = pdev->MediaSize[1];
- pdev->MediaSize[1] = ftmp;
- itmp = pdev->width;
- pdev->width = pdev->height;
- pdev->height = itmp;
+ int itmp;
+
+ ftmp = pdev->MediaSize[0];
+ pdev->MediaSize[0] = pdev->MediaSize[1];
+ pdev->MediaSize[1] = ftmp;
+ itmp = pdev->width;
+ pdev->width = pdev->height;
+ pdev->height = itmp;
}
/* process the parameter list */
@@ -594,14 +591,14 @@ clj_pr_get_params( gx_device *pdev, gs_param_list *plist )
/* Now re-rotate the page size if needed */
if (pclj->rotated) {
float ftmp;
- int itmp;
-
- ftmp = pdev->MediaSize[0];
- pdev->MediaSize[0] = pdev->MediaSize[1];
- pdev->MediaSize[1] = ftmp;
- itmp = pdev->width;
- pdev->width = pdev->height;
- pdev->height = itmp;
+ int itmp;
+
+ ftmp = pdev->MediaSize[0];
+ pdev->MediaSize[0] = pdev->MediaSize[1];
+ pdev->MediaSize[1] = ftmp;
+ itmp = pdev->width;
+ pdev->width = pdev->height;
+ pdev->height = itmp;
}
return code;
@@ -626,39 +623,39 @@ clj_pr_put_params(
int have_pagesize = clj_media_size(mediasize, plist);
if (have_pagesize < 0)
- return have_pagesize;
+ return have_pagesize;
if (have_pagesize) {
- if (get_paper_size(mediasize, &rotate) == 0)
- return_error(gs_error_rangecheck);
- if (rotate) {
- /* We need to rotate the requested page size, so synthesize a new */
- /* parameter list in front of the requestor's list to force the */
- /* rotated page size. */
- gs_param_float_array pf_array;
- gs_c_param_list alist;
- float ftmp = mediasize[0];
-
- mediasize[0] = mediasize[1];
- mediasize[1] = ftmp;
- pf_array.data = mediasize;
- pf_array.size = 2;
- pf_array.persistent = false;
-
- gs_c_param_list_write(&alist, pdev->memory);
- code = param_write_float_array((gs_param_list *)&alist, ".MediaSize", &pf_array);
- gs_c_param_list_read(&alist);
-
- /* stick this synthesized parameter on the front of the existing list */
- gs_c_param_list_set_target(&alist, plist);
- if ((code = gdev_prn_put_params(pdev, (gs_param_list *)&alist)) >= 0)
- pclj->rotated = true;
- gs_c_param_list_release(&alist);
- } else {
- if ((code = gdev_prn_put_params(pdev, plist)) >= 0)
- pclj->rotated = false;
- }
- } else
- code = gdev_prn_put_params(pdev, plist);
+ if (get_paper_size(mediasize, &rotate) == 0)
+ return_error(gs_error_rangecheck);
+ if (rotate) {
+ /* We need to rotate the requested page size, so synthesize a new */
+ /* parameter list in front of the requestor's list to force the */
+ /* rotated page size. */
+ gs_param_float_array pf_array;
+ gs_c_param_list alist;
+ float ftmp = mediasize[0];
+
+ mediasize[0] = mediasize[1];
+ mediasize[1] = ftmp;
+ pf_array.data = mediasize;
+ pf_array.size = 2;
+ pf_array.persistent = false;
+
+ gs_c_param_list_write(&alist, pdev->memory);
+ code = param_write_float_array((gs_param_list *)&alist, ".MediaSize", &pf_array);
+ gs_c_param_list_read(&alist);
+
+ /* stick this synthesized parameter on the front of the existing list */
+ gs_c_param_list_set_target(&alist, plist);
+ if ((code = gdev_prn_put_params(pdev, (gs_param_list *)&alist)) >= 0)
+ pclj->rotated = true;
+ gs_c_param_list_release(&alist);
+ } else {
+ if ((code = gdev_prn_put_params(pdev, plist)) >= 0)
+ pclj->rotated = false;
+ }
+ } else
+ code = gdev_prn_put_params(pdev, plist);
return code;
}
diff --git a/gs/base/gdevcljc.c b/gs/base/gdevcljc.c
index 22d674ec6..4480b9f2b 100644
--- a/gs/base/gdevcljc.c
+++ b/gs/base/gdevcljc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,14 +40,14 @@ cljc_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* allocate memory for the raw data and compressed data. */
if (((data = gs_alloc_bytes(mem, raster, "cljc_print_page(data)")) == 0) ||
- ((cdata = gs_alloc_bytes(mem, worst_case_comp_size, "cljc_print_page(cdata)")) == 0) ||
- ((prow = gs_alloc_bytes(mem, worst_case_comp_size, "cljc_print_page(prow)")) == 0)) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ ((cdata = gs_alloc_bytes(mem, worst_case_comp_size, "cljc_print_page(cdata)")) == 0) ||
+ ((prow = gs_alloc_bytes(mem, worst_case_comp_size, "cljc_print_page(prow)")) == 0)) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
/* send a reset and the the paper definition */
fprintf(prn_stream, "\033E\033&u300D\033&l%dA",
- gdev_pcl_paper_size((gx_device *) pdev));
+ gdev_pcl_paper_size((gx_device *) pdev));
/* turn off source and pattern transparency */
fprintf(prn_stream, "\033*v1N\033*v1O");
/* set color render mode and the requested resolution */
@@ -62,14 +62,14 @@ cljc_print_page(gx_device_printer * pdev, FILE * prn_stream)
memset(prow, 0, worst_case_comp_size);
/* process each scanline */
for (i = 0; i < pdev->height; i++) {
- int compressed_size;
+ int compressed_size;
- code = gdev_prn_copy_scan_lines(pdev, i, (byte *) data, raster);
- if (code < 0)
- break;
- compressed_size = gdev_pcl_mode3compress(raster, data, prow, cdata);
- fprintf(prn_stream, "\033*b%dW", compressed_size);
- fwrite(cdata, sizeof(byte), compressed_size, prn_stream);
+ code = gdev_prn_copy_scan_lines(pdev, i, (byte *) data, raster);
+ if (code < 0)
+ break;
+ compressed_size = gdev_pcl_mode3compress(raster, data, prow, cdata);
+ fprintf(prn_stream, "\033*b%dW", compressed_size);
+ fwrite(cdata, sizeof(byte), compressed_size, prn_stream);
}
/* PCL will take care of blank lines at the end */
fputs("\033*rC\f", prn_stream);
@@ -83,15 +83,15 @@ out:
/* CLJ device methods */
static gx_device_procs cljc_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
/* the CLJ device */
const gx_device_printer gs_cljet5c_device =
{
prn_device_body(gx_device_printer, cljc_procs, "cljet5c",
- 85, 110, X_DPI, Y_DPI,
- 0.167, 0.167,
- 0.167, 0.167,
- 3, 24, 255, 255, 256, 256,
- cljc_print_page)
+ 85, 110, X_DPI, Y_DPI,
+ 0.167, 0.167,
+ 0.167, 0.167,
+ 3, 24, 255, 255, 256, 256,
+ cljc_print_page)
};
diff --git a/gs/base/gdevcp50.c b/gs/base/gdevcp50.c
index 1a1b5f1d1..825080854 100644
--- a/gs/base/gdevcp50.c
+++ b/gs/base/gdevcp50.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@
#define FIRST_COLUMN 180
/* The value of X_DPI and Y_DPI is gained by experiment */
-#define X_DPI 154 /* pixels per inch */
+#define X_DPI 154 /* pixels per inch */
#define Y_DPI 187 /* pixels per inch */
/* The device descriptor */
@@ -50,57 +50,55 @@ static gx_device_procs cp50_procs =
const gx_device_printer far_data gs_cp50_device =
prn_device(cp50_procs, "cp50",
- 39, /* width_10ths, 100mm */
- 59, /* height_10ths,150mm */
- X_DPI, Y_DPI,
- 0.39, 0.91, 0.43, 0.75, /* margins */
- 24, cp50_print_page);
+ 39, /* width_10ths, 100mm */
+ 59, /* height_10ths,150mm */
+ X_DPI, Y_DPI,
+ 0.39, 0.91, 0.43, 0.75, /* margins */
+ 24, cp50_print_page);
int copies;
/* ------ Internal routines ------ */
-
/* Send the page to the printer. */
static int
cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- byte *out = (byte *)gs_malloc(pdev->memory, line_size, 1, "cp50_print_page(out)");
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte *out = (byte *)gs_malloc(pdev->memory, line_size, 1, "cp50_print_page(out)");
byte *r_plane = (byte *)gs_malloc(pdev->memory, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(r_plane)");
byte *g_plane = (byte *)gs_malloc(pdev->memory, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(g_plane)");
byte *b_plane = (byte *)gs_malloc(pdev->memory, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(b_plane)");
byte *t_plane = (byte *)gs_malloc(pdev->memory, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(t_plane)");
- int lnum = FIRST_LINE;
- int last = LAST_LINE;
+ int lnum = FIRST_LINE;
+ int last = LAST_LINE;
int lines = X_PIXEL;
byte hi_lines, lo_lines;
byte num_copies;
int i,j;
-
/*fprintf(prn_stream, "%d,%d,%d,", pdev->width, pdev->height, line_size);*/
- /* Check allocations */
- if ( out == 0 || r_plane == 0 || g_plane == 0 || b_plane == 0 ||
+ /* Check allocations */
+ if ( out == 0 || r_plane == 0 || g_plane == 0 || b_plane == 0 ||
t_plane == 0)
- { if ( out )
- gs_free(pdev->memory, (char *)out, line_size, 1,
- "cp50_print_page(out)");
+ { if ( out )
+ gs_free(pdev->memory, (char *)out, line_size, 1,
+ "cp50_print_page(out)");
if (r_plane)
gs_free(pdev->memory, (char *)r_plane, X_PIXEL*Y_PIXEL, 1,
"cp50_print_page(r_plane)");
- if (g_plane)
- gs_free(pdev->memory, (char *)g_plane, X_PIXEL*Y_PIXEL, 1,
+ if (g_plane)
+ gs_free(pdev->memory, (char *)g_plane, X_PIXEL*Y_PIXEL, 1,
"cp50_print_page(g_plane)");
- if (b_plane)
- gs_free(pdev->memory, (char *)b_plane, X_PIXEL*Y_PIXEL, 1,
+ if (b_plane)
+ gs_free(pdev->memory, (char *)b_plane, X_PIXEL*Y_PIXEL, 1,
"cp50_print_page(b_plane)");
if (t_plane)
- gs_free(pdev->memory, (char *)t_plane, X_PIXEL*Y_PIXEL, 1,
+ gs_free(pdev->memory, (char *)t_plane, X_PIXEL*Y_PIXEL, 1,
"cp50_print_page(t_plane)");
- return -1;
- }
+ return -1;
+ }
/* set each plane as white */
memset(r_plane, -1, X_PIXEL*Y_PIXEL);
@@ -108,8 +106,8 @@ cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
memset(b_plane, -1, X_PIXEL*Y_PIXEL);
memset(t_plane, -1, X_PIXEL*Y_PIXEL);
- /* Initialize the printer */ /* see programmer manual for CP50 */
- fprintf(prn_stream,"\033\101");
+ /* Initialize the printer */ /* see programmer manual for CP50 */
+ fprintf(prn_stream,"\033\101");
fprintf(prn_stream,"\033\106\010\001");
fprintf(prn_stream,"\033\106\010\003");
@@ -127,12 +125,12 @@ cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
fwrite(&lo_lines, sizeof(char), 1, prn_stream);
fprintf(prn_stream,"\001"); /* dummy */
- /* Print lines of graphics */
- while ( lnum <= last )
- {
+ /* Print lines of graphics */
+ while ( lnum <= last )
+ {
int i, col;
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
- /*fwrite(out, sizeof(char), line_size, prn_stream);*/
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ /*fwrite(out, sizeof(char), line_size, prn_stream);*/
for(i=0; i<X_PIXEL; i++)
{
col = (lnum-FIRST_LINE) * X_PIXEL + i;
@@ -140,8 +138,8 @@ cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
g_plane[col] = out[i*3+1+FIRST_COLUMN];
b_plane[col] = out[i*3+2+FIRST_COLUMN];
}
- lnum ++;
- }
+ lnum ++;
+ }
/* rotate each plane and download it */
for(i=0;i<X_PIXEL;i++)
@@ -151,25 +149,24 @@ cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
for(i=0;i<X_PIXEL;i++)
for(j=Y_PIXEL-1;j>=0;j--)
- t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = g_plane[i+j*X_PIXEL];
+ t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = g_plane[i+j*X_PIXEL];
fwrite(t_plane, sizeof(char), X_PIXEL*Y_PIXEL, prn_stream);
for(i=0;i<X_PIXEL;i++)
for(j=Y_PIXEL-1;j>=0;j--)
- t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = b_plane[i+j*X_PIXEL];
+ t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = b_plane[i+j*X_PIXEL];
fwrite(t_plane, sizeof(char), X_PIXEL*Y_PIXEL, prn_stream);
-
- gs_free(pdev->memory, (char *)out, line_size, 1, "cp50_print_page(out)");
+ gs_free(pdev->memory, (char *)out, line_size, 1, "cp50_print_page(out)");
gs_free(pdev->memory, (char *)r_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(r_plane)");
gs_free(pdev->memory, (char *)g_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(g_plane)");
gs_free(pdev->memory, (char *)b_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(b_plane)");
gs_free(pdev->memory, (char *)t_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(t_plane)");
- return 0;
+ return 0;
}
-static int
+static int
cp50_output_page(gx_device *pdev, int num_copies, int flush)
{ int code, outcode, closecode;
@@ -187,21 +184,20 @@ cp50_output_page(gx_device *pdev, int num_copies, int flush)
if ( ppdev->buffer_space ) /* reinitialize clist for writing */
code = (*gs_clist_device_procs.output_page)(pdev, num_copies, flush);
-
+
if ( outcode < 0 ) return outcode;
if ( closecode < 0 ) return closecode;
if ( code < 0 ) return code;
return gx_finish_output_page(pdev, num_copies, flush);
}
-
/* 24-bit color mappers (taken from gdevmem2.c). */
/* Note that Windows expects RGB values in the order B,G,R. */
-
+
/* Map a r-g-b color to a color index. */
static gx_color_index
cp50_rgb_color(gx_device *dev, const gx_color_value cv[])
-{
+{
gx_color_value red, green, blue;
red = cv[0]; green = cv[1]; blue = cv[2];
@@ -209,7 +205,7 @@ cp50_rgb_color(gx_device *dev, const gx_color_value cv[])
((uint)gx_color_value_to_byte(green) << 8) +
gx_color_value_to_byte(blue);
}
-
+
/* Map a color index to a r-g-b color. */
static int
cp50_color_rgb(gx_device *dev, gx_color_index color,
diff --git a/gs/base/gdevcslw.c b/gs/base/gdevcslw.c
index cb04ae292..7c88d2c97 100644
--- a/gs/base/gdevcslw.c
+++ b/gs/base/gdevcslw.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,17 +29,17 @@ static dev_proc_print_page(coslw_print_page);
const gx_device_printer gs_coslw2p_device =
prn_device(prn_std_procs, "coslw2p",
- 200, 400, /* 2 inches wide */
- 128, 128, /* 5 dots per mm */
- 0, 0, 0, 0,
- 1, coslw_print_page);
+ 200, 400, /* 2 inches wide */
+ 128, 128, /* 5 dots per mm */
+ 0, 0, 0, 0,
+ 1, coslw_print_page);
const gx_device_printer gs_coslwxl_device =
prn_device(prn_std_procs, "coslwxl",
- 200, 400, /* 2 inches wide */
- 204, 204, /* 8 dots per mm */
- 0, 0, 0, 0,
- 1, coslw_print_page);
+ 200, 400, /* 2 inches wide */
+ 204, 204, /* 8 dots per mm */
+ 0, 0, 0, 0,
+ 1, coslw_print_page);
/* ------ Internal routines ------ */
@@ -51,7 +51,7 @@ coslw_print_page(gx_device_printer * pdev, FILE * prn_stream)
int line_size_words = (line_size + W - 1) / W;
uint storage_size_words = line_size_words * 8; /* data, out_row, out_row_alt, prev_row */
word *storage = (ulong *) gs_malloc(pdev->memory, storage_size_words, W,
- "coslw_print_page");
+ "coslw_print_page");
word *data_words;
#define data ((byte *)data_words)
@@ -63,7 +63,7 @@ coslw_print_page(gx_device_printer * pdev, FILE * prn_stream)
int code = 0;
if (storage == 0) /* can't allocate working area */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
data_words = storage;
/* Clear temp storage */
@@ -79,58 +79,58 @@ coslw_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* Send each scan line in turn */
{
- int lnum;
- int num_blank_lines = 0;
- word rmask = ~(word) 0 << (-pdev->width & (W * 8 - 1));
-
- /* Transfer raster graphics. */
- for (lnum = 0; lnum < num_rows; lnum++) {
- register word *end_data =
- data_words + line_size_words;
-
- code = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *) data, line_size);
- if (code < 0)
- break;
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while (end_data > data_words && end_data[-1] == 0)
- end_data--;
- if (end_data == data_words) { /* Blank line */
- num_blank_lines++;
- continue;
- }
-
- /* We've reached a non-blank line. */
- /* Put out a spacing command if necessary. */
- while (num_blank_lines > 0)
- {
- int this_blank = 255;
- if (num_blank_lines < this_blank)
- this_blank = num_blank_lines;
- fprintf(prn_stream, "\033f\001%c", this_blank);
- num_blank_lines -= this_blank;
- }
-
- /* Perhaps add compression here later? */
- out_data = data;
- out_count = (byte *) end_data - data;
-
- /* For 2 inch model, max width is 56 bytes */
- if (out_count > 56)
- out_count = 56;
- /* Possible change the bytes per line */
- if (bytes_per_line != out_count)
- {
- fprintf(prn_stream, "\033D%c", out_count);
- bytes_per_line = out_count;
- }
-
- /* Transfer the data */
- fputs("\026", prn_stream);
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
- }
+ int lnum;
+ int num_blank_lines = 0;
+ word rmask = ~(word) 0 << (-pdev->width & (W * 8 - 1));
+
+ /* Transfer raster graphics. */
+ for (lnum = 0; lnum < num_rows; lnum++) {
+ register word *end_data =
+ data_words + line_size_words;
+
+ code = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *) data, line_size);
+ if (code < 0)
+ break;
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while (end_data > data_words && end_data[-1] == 0)
+ end_data--;
+ if (end_data == data_words) { /* Blank line */
+ num_blank_lines++;
+ continue;
+ }
+
+ /* We've reached a non-blank line. */
+ /* Put out a spacing command if necessary. */
+ while (num_blank_lines > 0)
+ {
+ int this_blank = 255;
+ if (num_blank_lines < this_blank)
+ this_blank = num_blank_lines;
+ fprintf(prn_stream, "\033f\001%c", this_blank);
+ num_blank_lines -= this_blank;
+ }
+
+ /* Perhaps add compression here later? */
+ out_data = data;
+ out_count = (byte *) end_data - data;
+
+ /* For 2 inch model, max width is 56 bytes */
+ if (out_count > 56)
+ out_count = 56;
+ /* Possible change the bytes per line */
+ if (bytes_per_line != out_count)
+ {
+ fprintf(prn_stream, "\033D%c", out_count);
+ bytes_per_line = out_count;
+ }
+
+ /* Transfer the data */
+ fputs("\026", prn_stream);
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ }
}
/* eject page */
diff --git a/gs/base/gdevdbit.c b/gs/base/gdevdbit.c
index eaa4b21f5..28c844e09 100644
--- a/gs/base/gdevdbit.c
+++ b/gs/base/gdevdbit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,61 +30,61 @@
int
gx_default_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{
gx_strip_bitmap tiles;
*(gx_tile_bitmap *) & tiles = *tile;
tiles.shift = tiles.rep_shift = 0;
return (*dev_proc(dev, strip_tile_rectangle))
- (dev, &tiles, x, y, w, h, color0, color1, px, py);
+ (dev, &tiles, x, y, w, h, color0, color1, px, py);
}
/* Implement copy_mono by filling lots of small rectangles. */
/* This is very inefficient, but it works as a default. */
int
gx_default_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
bool invert;
gx_color_index color;
gx_device_color devc;
-
- if (!data)
- return gs_throw_code(gs_error_unknownerror);
+
+ if (!data)
+ return gs_throw_code(gs_error_unknownerror);
fit_copy(dev, data, dx, raster, id, x, y, w, h);
- if (!data)
- return gs_throw_code(gs_error_unknownerror);
+ if (!data)
+ return gs_throw_code(gs_error_unknownerror);
if (one != gx_no_color_index) {
- invert = false;
- color = one;
- if (zero != gx_no_color_index) {
- int code = (*dev_proc(dev, fill_rectangle))
- (dev, x, y, w, h, zero);
-
- if (code < 0)
- return code;
- }
+ invert = false;
+ color = one;
+ if (zero != gx_no_color_index) {
+ int code = (*dev_proc(dev, fill_rectangle))
+ (dev, x, y, w, h, zero);
+
+ if (code < 0)
+ return code;
+ }
} else {
- invert = true;
- color = zero;
+ invert = true;
+ color = zero;
}
- if (!data)
- return gs_throw_code(gs_error_unknownerror);
+ if (!data)
+ return gs_throw_code(gs_error_unknownerror);
set_nonclient_dev_color(&devc, color);
- if (!data)
- return gs_throw_code(gs_error_unknownerror);
+ if (!data)
+ return gs_throw_code(gs_error_unknownerror);
return gx_dc_default_fill_masked
- (&devc, data, dx, raster, id, x, y, w, h, dev, rop3_T, invert);
+ (&devc, data, dx, raster, id, x, y, w, h, dev, rop3_T, invert);
}
/* Implement copy_color by filling lots of small rectangles. */
/* This is very inefficient, but it works as a default. */
int
gx_default_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
int depth = dev->color_info.depth;
byte mask;
@@ -94,177 +94,177 @@ gx_default_copy_color(gx_device * dev, const byte * data,
int iy;
if (depth == 1)
- return (*dev_proc(dev, copy_mono)) (dev, data, dx, raster, id,
- x, y, w, h,
- (gx_color_index) 0, (gx_color_index) 1);
+ return (*dev_proc(dev, copy_mono)) (dev, data, dx, raster, id,
+ x, y, w, h,
+ (gx_color_index) 0, (gx_color_index) 1);
fit_copy(dev, data, dx, raster, id, x, y, w, h);
fill = dev_proc(dev, fill_rectangle);
mask = (byte) ((1 << depth) - 1);
for (row = data, iy = 0; iy < h; row += raster, ++iy) {
- int ix;
- gx_color_index c0 = gx_no_color_index;
- const byte *ptr = row + ((dx * depth) >> 3);
- int i0;
-
- for (i0 = ix = 0; ix < w; ++ix) {
- gx_color_index color;
-
- if (depth >= 8) {
- color = *ptr++;
- switch (depth) {
- case 64:
- color = (color << 8) + *ptr++;
- case 56:
- color = (color << 8) + *ptr++;
- case 48:
- color = (color << 8) + *ptr++;
- case 40:
- color = (color << 8) + *ptr++;
- case 32:
- color = (color << 8) + *ptr++;
- case 24:
- color = (color << 8) + *ptr++;
- case 16:
- color = (color << 8) + *ptr++;
- }
- } else {
- uint dbit = (-(ix + dx + 1) * depth) & 7;
-
- color = (*ptr >> dbit) & mask;
- if (dbit == 0)
- ptr++;
- }
- if (color != c0) {
- if (ix > i0) {
- int code = (*fill)
- (dev, i0 + x, iy + y, ix - i0, 1, c0);
-
- if (code < 0)
- return code;
- }
- c0 = color;
- i0 = ix;
- }
- }
- if (ix > i0) {
- int code = (*fill) (dev, i0 + x, iy + y, ix - i0, 1, c0);
-
- if (code < 0)
- return code;
- }
+ int ix;
+ gx_color_index c0 = gx_no_color_index;
+ const byte *ptr = row + ((dx * depth) >> 3);
+ int i0;
+
+ for (i0 = ix = 0; ix < w; ++ix) {
+ gx_color_index color;
+
+ if (depth >= 8) {
+ color = *ptr++;
+ switch (depth) {
+ case 64:
+ color = (color << 8) + *ptr++;
+ case 56:
+ color = (color << 8) + *ptr++;
+ case 48:
+ color = (color << 8) + *ptr++;
+ case 40:
+ color = (color << 8) + *ptr++;
+ case 32:
+ color = (color << 8) + *ptr++;
+ case 24:
+ color = (color << 8) + *ptr++;
+ case 16:
+ color = (color << 8) + *ptr++;
+ }
+ } else {
+ uint dbit = (-(ix + dx + 1) * depth) & 7;
+
+ color = (*ptr >> dbit) & mask;
+ if (dbit == 0)
+ ptr++;
+ }
+ if (color != c0) {
+ if (ix > i0) {
+ int code = (*fill)
+ (dev, i0 + x, iy + y, ix - i0, 1, c0);
+
+ if (code < 0)
+ return code;
+ }
+ c0 = color;
+ i0 = ix;
+ }
+ }
+ if (ix > i0) {
+ int code = (*fill) (dev, i0 + x, iy + y, ix - i0, 1, c0);
+
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
int
gx_no_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{
return_error(gs_error_unknownerror);
}
int
gx_default_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{ /* This might be called with depth = 1.... */
if (depth == 1)
- return (*dev_proc(dev, copy_mono)) (dev, data, data_x, raster, id,
- x, y, width, height,
- gx_no_color_index, color);
+ return (*dev_proc(dev, copy_mono)) (dev, data, data_x, raster, id,
+ x, y, width, height,
+ gx_no_color_index, color);
/*
* Simulate alpha by weighted averaging of RGB values.
* This is very slow, but functionally correct.
*/
{
- const byte *row;
- gs_memory_t *mem = dev->memory;
- int bpp = dev->color_info.depth;
- int ncomps = dev->color_info.num_components;
- uint in_size = gx_device_raster(dev, false);
- byte *lin;
- uint out_size;
- byte *lout;
- int code = 0;
- gx_color_value color_cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int ry;
-
- fit_copy(dev, data, data_x, raster, id, x, y, width, height);
- row = data;
- out_size = bitmap_raster(width * bpp);
- lin = gs_alloc_bytes(mem, in_size, "copy_alpha(lin)");
- lout = gs_alloc_bytes(mem, out_size, "copy_alpha(lout)");
- if (lin == 0 || lout == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
- }
- (*dev_proc(dev, decode_color)) (dev, color, color_cv);
- for (ry = y; ry < y + height; row += raster, ++ry) {
- byte *line;
- int sx, rx;
-
- DECLARE_LINE_ACCUM_COPY(lout, bpp, x);
-
- code = (*dev_proc(dev, get_bits)) (dev, ry, lin, &line);
- if (code < 0)
- break;
- for (sx = data_x, rx = x; sx < data_x + width; ++sx, ++rx) {
- gx_color_index previous = gx_no_color_index;
- gx_color_index composite;
- int alpha2, alpha;
-
- if (depth == 2) /* map 0 - 3 to 0 - 15 */
- alpha = ((row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
- else
- alpha2 = row[sx >> 1],
- alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
- blend:if (alpha == 15) { /* Just write the new color. */
- composite = color;
- } else {
- if (previous == gx_no_color_index) { /* Extract the old color. */
- if (bpp < 8) {
- const uint bit = rx * bpp;
- const byte *src = line + (bit >> 3);
-
- previous =
- (*src >> (8 - ((bit & 7) + bpp))) &
- ((1 << bpp) - 1);
- } else {
- const byte *src = line + (rx * (bpp >> 3));
-
- previous = 0;
- switch (bpp >> 3) {
- case 8:
- previous += (gx_color_index) * src++
- << sample_bound_shift(previous, 56);
- case 7:
- previous += (gx_color_index) * src++
- << sample_bound_shift(previous, 48);
- case 6:
- previous += (gx_color_index) * src++
- << sample_bound_shift(previous, 40);
- case 5:
- previous += (gx_color_index) * src++
- << sample_bound_shift(previous, 32);
- case 4:
- previous += (gx_color_index) * src++ << 24;
- case 3:
- previous += (gx_color_index) * src++ << 16;
- case 2:
- previous += (gx_color_index) * src++ << 8;
- case 1:
- previous += *src++;
- }
- }
- }
- if (alpha == 0) { /* Just write the old color. */
- composite = previous;
- } else { /* Blend values. */
- gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int i;
-
- (*dev_proc(dev, decode_color)) (dev, previous, cv);
+ const byte *row;
+ gs_memory_t *mem = dev->memory;
+ int bpp = dev->color_info.depth;
+ int ncomps = dev->color_info.num_components;
+ uint in_size = gx_device_raster(dev, false);
+ byte *lin;
+ uint out_size;
+ byte *lout;
+ int code = 0;
+ gx_color_value color_cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int ry;
+
+ fit_copy(dev, data, data_x, raster, id, x, y, width, height);
+ row = data;
+ out_size = bitmap_raster(width * bpp);
+ lin = gs_alloc_bytes(mem, in_size, "copy_alpha(lin)");
+ lout = gs_alloc_bytes(mem, out_size, "copy_alpha(lout)");
+ if (lin == 0 || lout == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
+ }
+ (*dev_proc(dev, decode_color)) (dev, color, color_cv);
+ for (ry = y; ry < y + height; row += raster, ++ry) {
+ byte *line;
+ int sx, rx;
+
+ DECLARE_LINE_ACCUM_COPY(lout, bpp, x);
+
+ code = (*dev_proc(dev, get_bits)) (dev, ry, lin, &line);
+ if (code < 0)
+ break;
+ for (sx = data_x, rx = x; sx < data_x + width; ++sx, ++rx) {
+ gx_color_index previous = gx_no_color_index;
+ gx_color_index composite;
+ int alpha2, alpha;
+
+ if (depth == 2) /* map 0 - 3 to 0 - 15 */
+ alpha = ((row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
+ else
+ alpha2 = row[sx >> 1],
+ alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
+ blend:if (alpha == 15) { /* Just write the new color. */
+ composite = color;
+ } else {
+ if (previous == gx_no_color_index) { /* Extract the old color. */
+ if (bpp < 8) {
+ const uint bit = rx * bpp;
+ const byte *src = line + (bit >> 3);
+
+ previous =
+ (*src >> (8 - ((bit & 7) + bpp))) &
+ ((1 << bpp) - 1);
+ } else {
+ const byte *src = line + (rx * (bpp >> 3));
+
+ previous = 0;
+ switch (bpp >> 3) {
+ case 8:
+ previous += (gx_color_index) * src++
+ << sample_bound_shift(previous, 56);
+ case 7:
+ previous += (gx_color_index) * src++
+ << sample_bound_shift(previous, 48);
+ case 6:
+ previous += (gx_color_index) * src++
+ << sample_bound_shift(previous, 40);
+ case 5:
+ previous += (gx_color_index) * src++
+ << sample_bound_shift(previous, 32);
+ case 4:
+ previous += (gx_color_index) * src++ << 24;
+ case 3:
+ previous += (gx_color_index) * src++ << 16;
+ case 2:
+ previous += (gx_color_index) * src++ << 8;
+ case 1:
+ previous += *src++;
+ }
+ }
+ }
+ if (alpha == 0) { /* Just write the old color. */
+ composite = previous;
+ } else { /* Blend values. */
+ gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int i;
+
+ (*dev_proc(dev, decode_color)) (dev, previous, cv);
#if ARCH_INTS_ARE_SHORT
# define b_int long
#else
@@ -272,72 +272,72 @@ gx_default_copy_alpha(gx_device * dev, const byte * data, int data_x,
#endif
#define make_shade(old, clr, alpha, amax) \
(old) + (((b_int)(clr) - (b_int)(old)) * (alpha) / (amax))
- for (i=0; i<ncomps; i++)
- cv[i] = make_shade(cv[i], color_cv[i], alpha, 15);
+ for (i=0; i<ncomps; i++)
+ cv[i] = make_shade(cv[i], color_cv[i], alpha, 15);
#undef b_int
#undef make_shade
- composite =
- (*dev_proc(dev, encode_color)) (dev, cv);
- if (composite == gx_no_color_index) { /* The device can't represent this color. */
- /* Move the alpha value towards 0 or 1. */
- if (alpha == 7) /* move 1/2 towards 1 */
- ++alpha;
- alpha = (alpha & 8) | (alpha >> 1);
- goto blend;
- }
- }
- }
- LINE_ACCUM(composite, bpp);
- }
- LINE_ACCUM_COPY(dev, lout, bpp, x, rx, out_size, ry);
- }
+ composite =
+ (*dev_proc(dev, encode_color)) (dev, cv);
+ if (composite == gx_no_color_index) { /* The device can't represent this color. */
+ /* Move the alpha value towards 0 or 1. */
+ if (alpha == 7) /* move 1/2 towards 1 */
+ ++alpha;
+ alpha = (alpha & 8) | (alpha >> 1);
+ goto blend;
+ }
+ }
+ }
+ LINE_ACCUM(composite, bpp);
+ }
+ LINE_ACCUM_COPY(dev, lout, bpp, x, rx, out_size, ry);
+ }
out:gs_free_object(mem, lout, "copy_alpha(lout)");
- gs_free_object(mem, lin, "copy_alpha(lin)");
- return code;
+ gs_free_object(mem, lin, "copy_alpha(lin)");
+ return code;
}
}
int
gx_no_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_tile_bitmap * texture, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_unknownerror); /* not implemented */
}
int
gx_default_fill_mask(gx_device * orig_dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device *dev;
gx_device_clip cdev;
if (pcpath != 0) {
- gx_make_clip_device_on_stack(&cdev, pcpath, orig_dev);
- dev = (gx_device *) & cdev;
+ gx_make_clip_device_on_stack(&cdev, pcpath, orig_dev);
+ dev = (gx_device *) & cdev;
} else
- dev = orig_dev;
+ dev = orig_dev;
if (depth > 1) {
- /****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
- return (*dev_proc(dev, copy_alpha))
- (dev, data, dx, raster, id, x, y, w, h,
- gx_dc_pure_color(pdcolor), depth);
+ /****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
+ return (*dev_proc(dev, copy_alpha))
+ (dev, data, dx, raster, id, x, y, w, h,
+ gx_dc_pure_color(pdcolor), depth);
} else
return pdcolor->type->fill_masked(pdcolor, data, dx, raster, id,
- x, y, w, h, dev, lop, false);
+ x, y, w, h, dev, lop, false);
}
/* Default implementation of strip_tile_rectangle */
int
gx_default_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{ /* Fill the rectangle in chunks. */
int width = tiles->size.x;
int height = tiles->size.y;
@@ -348,73 +348,73 @@ gx_default_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
gs_id tile_id = tiles->id;
if (rwidth == 0 || rheight == 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
fit_fill_xy(dev, x, y, w, h);
#ifdef DEBUG
if (gs_debug_c('t')) {
- int ptx, pty;
- const byte *ptp = tiles->data;
-
- dlprintf4("[t]tile %dx%d raster=%d id=%lu;",
- tiles->size.x, tiles->size.y, tiles->raster, tiles->id);
- dlprintf6(" x,y=%d,%d w,h=%d,%d p=%d,%d\n",
- x, y, w, h, px, py);
- dlputs("");
- for (pty = 0; pty < tiles->size.y; pty++) {
- dprintf(" ");
- for (ptx = 0; ptx < tiles->raster; ptx++)
- dprintf1("%3x", *ptp++);
- }
- dputc('\n');
+ int ptx, pty;
+ const byte *ptp = tiles->data;
+
+ dlprintf4("[t]tile %dx%d raster=%d id=%lu;",
+ tiles->size.x, tiles->size.y, tiles->raster, tiles->id);
+ dlprintf6(" x,y=%d,%d w,h=%d,%d p=%d,%d\n",
+ x, y, w, h, px, py);
+ dlputs("");
+ for (pty = 0; pty < tiles->size.y; pty++) {
+ dprintf(" ");
+ for (ptx = 0; ptx < tiles->raster; ptx++)
+ dprintf1("%3x", *ptp++);
+ }
+ dputc('\n');
}
#endif
if (dev_proc(dev, tile_rectangle) != gx_default_tile_rectangle) {
- if (shift == 0) { /*
- * Temporarily patch the tile_rectangle procedure in the
- * device so we don't get into a recursion loop if the
- * device has a tile_rectangle procedure that conditionally
- * calls the strip_tile_rectangle procedure.
- */
- dev_proc_tile_rectangle((*tile_proc)) =
- dev_proc(dev, tile_rectangle);
- int code;
-
- set_dev_proc(dev, tile_rectangle, gx_default_tile_rectangle);
- code = (*tile_proc)
- (dev, (const gx_tile_bitmap *)tiles, x, y, w, h,
- color0, color1, px, py);
- set_dev_proc(dev, tile_rectangle, tile_proc);
- return code;
- }
- /* We should probably optimize this case too, for the benefit */
- /* of window systems, but we don't yet. */
+ if (shift == 0) { /*
+ * Temporarily patch the tile_rectangle procedure in the
+ * device so we don't get into a recursion loop if the
+ * device has a tile_rectangle procedure that conditionally
+ * calls the strip_tile_rectangle procedure.
+ */
+ dev_proc_tile_rectangle((*tile_proc)) =
+ dev_proc(dev, tile_rectangle);
+ int code;
+
+ set_dev_proc(dev, tile_rectangle, gx_default_tile_rectangle);
+ code = (*tile_proc)
+ (dev, (const gx_tile_bitmap *)tiles, x, y, w, h,
+ color0, color1, px, py);
+ set_dev_proc(dev, tile_rectangle, tile_proc);
+ return code;
+ }
+ /* We should probably optimize this case too, for the benefit */
+ /* of window systems, but we don't yet. */
} { /*
- * Note: we can't do the following computations until after
- * the fit_fill_xy.
- */
- int xoff =
- (shift == 0 ? px :
- px + (y + py) / rheight * tiles->rep_shift);
- int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
- (x + xoff) & (rwidth - 1) :
- (x + xoff) % rwidth);
- int ry = ((rheight & (rheight - 1)) == 0 ? /* power of 2 */
- (y + py) & (rheight - 1) :
- (y + py) % rheight);
- int icw = width - irx;
- int ch = height - ry;
- byte *row = tiles->data + ry * raster;
-
- dev_proc_copy_mono((*proc_mono));
- dev_proc_copy_color((*proc_color));
- int code;
-
- if (color0 == gx_no_color_index && color1 == gx_no_color_index)
- proc_color = dev_proc(dev, copy_color), proc_mono = 0;
- else
- proc_color = 0, proc_mono = dev_proc(dev, copy_mono);
+ * Note: we can't do the following computations until after
+ * the fit_fill_xy.
+ */
+ int xoff =
+ (shift == 0 ? px :
+ px + (y + py) / rheight * tiles->rep_shift);
+ int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
+ (x + xoff) & (rwidth - 1) :
+ (x + xoff) % rwidth);
+ int ry = ((rheight & (rheight - 1)) == 0 ? /* power of 2 */
+ (y + py) & (rheight - 1) :
+ (y + py) % rheight);
+ int icw = width - irx;
+ int ch = height - ry;
+ byte *row = tiles->data + ry * raster;
+
+ dev_proc_copy_mono((*proc_mono));
+ dev_proc_copy_color((*proc_color));
+ int code;
+
+ if (color0 == gx_no_color_index && color1 == gx_no_color_index)
+ proc_color = dev_proc(dev, copy_color), proc_mono = 0;
+ else
+ proc_color = 0, proc_mono = dev_proc(dev, copy_mono);
#define real_copy_tile(srcx, tx, ty, tw, th, id)\
code =\
@@ -426,82 +426,82 @@ gx_default_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
#ifdef DEBUG
#define copy_tile(srcx, tx, ty, tw, th, tid)\
if_debug6('t', " copy id=%lu sx=%d => x=%d y=%d w=%d h=%d\n",\
- tid, srcx, tx, ty, tw, th);\
+ tid, srcx, tx, ty, tw, th);\
real_copy_tile(srcx, tx, ty, tw, th, tid)
#else
#define copy_tile(srcx, tx, ty, tw, th, id)\
real_copy_tile(srcx, tx, ty, tw, th, id)
#endif
- if (ch >= h) { /* Shallow operation */
- if (icw >= w) { /* Just one (partial) tile to transfer. */
- copy_tile(irx, x, y, w, h,
- (w == width && h == height ? tile_id :
- gs_no_bitmap_id));
- } else {
- int ex = x + w;
- int fex = ex - width;
- int cx = x + icw;
- ulong id = (h == height ? tile_id : gs_no_bitmap_id);
-
- copy_tile(irx, x, y, icw, h, gs_no_bitmap_id);
- while (cx <= fex) {
- copy_tile(0, cx, y, width, h, id);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, cx, y, ex - cx, h, gs_no_bitmap_id);
- }
- }
- } else if (icw >= w && shift == 0) {
- /* Narrow operation, no shift */
- int ey = y + h;
- int fey = ey - height;
- int cy = y + ch;
- ulong id = (w == width ? tile_id : gs_no_bitmap_id);
-
- copy_tile(irx, x, y, w, ch, (ch == height ? id : gs_no_bitmap_id));
- row = tiles->data;
- do {
- ch = (cy > fey ? ey - cy : height);
- copy_tile(irx, x, cy, w, ch,
- (ch == height ? id : gs_no_bitmap_id));
- }
- while ((cy += ch) < ey);
- } else {
- /* Full operation. If shift != 0, some scan lines */
- /* may be narrow. We could test shift == 0 in advance */
- /* and use a slightly faster loop, but right now */
- /* we don't bother. */
- int ex = x + w, ey = y + h;
- int fex = ex - width, fey = ey - height;
- int cx, cy;
-
- for (cy = y;;) {
- ulong id = (ch == height ? tile_id : gs_no_bitmap_id);
-
- if (icw >= w) {
- copy_tile(irx, x, cy, w, ch,
- (w == width ? id : gs_no_bitmap_id));
- } else {
- copy_tile(irx, x, cy, icw, ch, gs_no_bitmap_id);
- cx = x + icw;
- while (cx <= fex) {
- copy_tile(0, cx, cy, width, ch, id);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, cx, cy, ex - cx, ch, gs_no_bitmap_id);
- }
- }
- if ((cy += ch) >= ey)
- break;
- ch = (cy > fey ? ey - cy : height);
- if ((irx += shift) >= rwidth)
- irx -= rwidth;
- icw = width - irx;
- row = tiles->data;
- }
- }
+ if (ch >= h) { /* Shallow operation */
+ if (icw >= w) { /* Just one (partial) tile to transfer. */
+ copy_tile(irx, x, y, w, h,
+ (w == width && h == height ? tile_id :
+ gs_no_bitmap_id));
+ } else {
+ int ex = x + w;
+ int fex = ex - width;
+ int cx = x + icw;
+ ulong id = (h == height ? tile_id : gs_no_bitmap_id);
+
+ copy_tile(irx, x, y, icw, h, gs_no_bitmap_id);
+ while (cx <= fex) {
+ copy_tile(0, cx, y, width, h, id);
+ cx += width;
+ }
+ if (cx < ex) {
+ copy_tile(0, cx, y, ex - cx, h, gs_no_bitmap_id);
+ }
+ }
+ } else if (icw >= w && shift == 0) {
+ /* Narrow operation, no shift */
+ int ey = y + h;
+ int fey = ey - height;
+ int cy = y + ch;
+ ulong id = (w == width ? tile_id : gs_no_bitmap_id);
+
+ copy_tile(irx, x, y, w, ch, (ch == height ? id : gs_no_bitmap_id));
+ row = tiles->data;
+ do {
+ ch = (cy > fey ? ey - cy : height);
+ copy_tile(irx, x, cy, w, ch,
+ (ch == height ? id : gs_no_bitmap_id));
+ }
+ while ((cy += ch) < ey);
+ } else {
+ /* Full operation. If shift != 0, some scan lines */
+ /* may be narrow. We could test shift == 0 in advance */
+ /* and use a slightly faster loop, but right now */
+ /* we don't bother. */
+ int ex = x + w, ey = y + h;
+ int fex = ex - width, fey = ey - height;
+ int cx, cy;
+
+ for (cy = y;;) {
+ ulong id = (ch == height ? tile_id : gs_no_bitmap_id);
+
+ if (icw >= w) {
+ copy_tile(irx, x, cy, w, ch,
+ (w == width ? id : gs_no_bitmap_id));
+ } else {
+ copy_tile(irx, x, cy, icw, ch, gs_no_bitmap_id);
+ cx = x + icw;
+ while (cx <= fex) {
+ copy_tile(0, cx, cy, width, ch, id);
+ cx += width;
+ }
+ if (cx < ex) {
+ copy_tile(0, cx, cy, ex - cx, ch, gs_no_bitmap_id);
+ }
+ }
+ if ((cy += ch) >= ey)
+ break;
+ ch = (cy > fey ? ey - cy : height);
+ if ((irx += shift) >= rwidth)
+ irx -= rwidth;
+ icw = width - irx;
+ row = tiles->data;
+ }
+ }
#undef copy_tile
#undef real_copy_tile
}
@@ -510,11 +510,11 @@ gx_default_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int
gx_no_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_unknownerror); /* not implemented */
}
@@ -529,8 +529,8 @@ gx_no_strip_copy_rop(gx_device * dev,
*/
int
gx_copy_mono_unaligned(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
uint offset = ALIGNMENT_MOD(data, align_bitmap_mod);
@@ -542,29 +542,29 @@ gx_copy_mono_unaligned(gx_device * dev, const byte * data,
/* Adjust the raster. */
if (!step) { /* No adjustment needed. */
- return (*copy_mono) (dev, data, dx, raster, id,
- x, y, w, h, zero, one);
+ return (*copy_mono) (dev, data, dx, raster, id,
+ x, y, w, h, zero, one);
}
/* Do the transfer one scan line at a time. */
{
- const byte *p = data;
- int d = dx;
- int code = 0;
- int i;
-
- for (i = 0; i < h && code >= 0;
- ++i, p += raster - step, d += step << 3
- )
- code = (*copy_mono) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, w, 1, zero, one);
- return code;
+ const byte *p = data;
+ int d = dx;
+ int code = 0;
+ int i;
+
+ for (i = 0; i < h && code >= 0;
+ ++i, p += raster - step, d += step << 3
+ )
+ code = (*copy_mono) (dev, p, d, raster, gx_no_bitmap_id,
+ x, y + i, w, 1, zero, one);
+ return code;
}
}
int
gx_copy_color_unaligned(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height)
{
dev_proc_copy_color((*copy_color)) = dev_proc(dev, copy_color);
int depth = dev->color_info.depth;
@@ -581,37 +581,37 @@ gx_copy_color_unaligned(gx_device * dev, const byte * data,
* the new value of offset will be M*B + R.
*/
if (depth == 24)
- offset += (offset % 3) *
- (align_bitmap_mod * (3 - (align_bitmap_mod % 3)));
+ offset += (offset % 3) *
+ (align_bitmap_mod * (3 - (align_bitmap_mod % 3)));
data -= offset;
data_x += (offset << 3) / depth;
/* Adjust the raster. */
if (!step) { /* No adjustment needed. */
- return (*copy_color) (dev, data, data_x, raster, id,
- x, y, width, height);
+ return (*copy_color) (dev, data, data_x, raster, id,
+ x, y, width, height);
}
/* Do the transfer one scan line at a time. */
{
- const byte *p = data;
- int d = data_x;
- int dstep = (step << 3) / depth;
- int code = 0;
- int i;
-
- for (i = 0; i < height && code >= 0;
- ++i, p += raster - step, d += dstep
- )
- code = (*copy_color) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, width, 1);
- return code;
+ const byte *p = data;
+ int d = data_x;
+ int dstep = (step << 3) / depth;
+ int code = 0;
+ int i;
+
+ for (i = 0; i < height && code >= 0;
+ ++i, p += raster - step, d += dstep
+ )
+ code = (*copy_color) (dev, p, d, raster, gx_no_bitmap_id,
+ x, y + i, width, 1);
+ return code;
}
}
int
gx_copy_alpha_unaligned(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{
dev_proc_copy_alpha((*copy_alpha)) = dev_proc(dev, copy_alpha);
uint offset = (uint) (data - (const byte *)0) & (align_bitmap_mod - 1);
@@ -623,22 +623,22 @@ gx_copy_alpha_unaligned(gx_device * dev, const byte * data, int data_x,
/* Adjust the raster. */
if (!step) { /* No adjustment needed. */
- return (*copy_alpha) (dev, data, data_x, raster, id,
- x, y, width, height, color, depth);
+ return (*copy_alpha) (dev, data, data_x, raster, id,
+ x, y, width, height, color, depth);
}
/* Do the transfer one scan line at a time. */
{
- const byte *p = data;
- int d = data_x;
- int dstep = (step << 3) / depth;
- int code = 0;
- int i;
-
- for (i = 0; i < height && code >= 0;
- ++i, p += raster - step, d += dstep
- )
- code = (*copy_alpha) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, width, 1, color, depth);
- return code;
+ const byte *p = data;
+ int d = data_x;
+ int dstep = (step << 3) / depth;
+ int code = 0;
+ int i;
+
+ for (i = 0; i < height && code >= 0;
+ ++i, p += raster - step, d += dstep
+ )
+ code = (*copy_alpha) (dev, p, d, raster, gx_no_bitmap_id,
+ x, y + i, width, 1, color, depth);
+ return code;
}
}
diff --git a/gs/base/gdevdcrd.c b/gs/base/gdevdcrd.c
index f15749acb..1fcbfaeec 100644
--- a/gs/base/gdevdcrd.c
+++ b/gs/base/gdevdcrd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ static const gs_range3 bit_RangePQR = {
static const float dent_PQR = 1.0;
static int
bit_TransformPQR_proc(int index, floatp in, const gs_cie_wbsd * pwbsd,
- gs_cie_render * pcrd, float *out)
+ gs_cie_render * pcrd, float *out)
{
*out = DENT(in, dent_PQR);
return 0;
@@ -105,68 +105,68 @@ static const gs_cie_render_table_t bit_RenderTable = { /* dummy */
*/
int
sample_device_crd_get_params(gx_device *pdev, gs_param_list *plist,
- const char *crd_param_name)
+ const char *crd_param_name)
{
int ecode = 0;
if (param_requested(plist, "CRDName") > 0) {
- gs_param_string cns;
- int code;
+ gs_param_string cns;
+ int code;
- cns.data = (const byte *)crd_param_name;
- cns.size = strlen(crd_param_name);
- cns.persistent = true;
- code = param_write_string(plist, "CRDName", &cns);
- if (code < 0)
- ecode = code;
+ cns.data = (const byte *)crd_param_name;
+ cns.size = strlen(crd_param_name);
+ cns.persistent = true;
+ code = param_write_string(plist, "CRDName", &cns);
+ if (code < 0)
+ ecode = code;
}
if (param_requested(plist, crd_param_name) > 0) {
- gs_cie_render *pcrd;
- int code = gs_cie_render1_build(&pcrd, pdev->memory,
- "sample_device_crd_get_params");
- if (code >= 0) {
- gs_cie_transform_proc3 tpqr;
+ gs_cie_render *pcrd;
+ int code = gs_cie_render1_build(&pcrd, pdev->memory,
+ "sample_device_crd_get_params");
+ if (code >= 0) {
+ gs_cie_transform_proc3 tpqr;
- tpqr = bit_TransformPQR;
- tpqr.driver_name = pdev->dname;
- code = gs_cie_render1_initialize(pdev->memory, pcrd, NULL,
- &bit_WhitePoint, NULL /*BlackPoint*/,
- NULL /*MatrixPQR*/, &bit_RangePQR, &tpqr,
- NULL /*MatrixLMN*/, &bit_EncodeLMN, &bit_RangeLMN,
- &bit_MatrixABC, &bit_EncodeABC, NULL /*RangeABC*/,
- &bit_RenderTable);
- if (code >= 0) {
- code = param_write_cie_render1(plist, crd_param_name, pcrd,
- pdev->memory);
- }
- rc_decrement(pcrd, "sample_device_crd_get_params"); /* release */
- }
- if (code < 0)
- ecode = code;
+ tpqr = bit_TransformPQR;
+ tpqr.driver_name = pdev->dname;
+ code = gs_cie_render1_initialize(pdev->memory, pcrd, NULL,
+ &bit_WhitePoint, NULL /*BlackPoint*/,
+ NULL /*MatrixPQR*/, &bit_RangePQR, &tpqr,
+ NULL /*MatrixLMN*/, &bit_EncodeLMN, &bit_RangeLMN,
+ &bit_MatrixABC, &bit_EncodeABC, NULL /*RangeABC*/,
+ &bit_RenderTable);
+ if (code >= 0) {
+ code = param_write_cie_render1(plist, crd_param_name, pcrd,
+ pdev->memory);
+ }
+ rc_decrement(pcrd, "sample_device_crd_get_params"); /* release */
+ }
+ if (code < 0)
+ ecode = code;
}
if (param_requested(plist, bit_TransformPQR.proc_name) > 0) {
- /*
- * We definitely do not recommend the following use of a static
- * to hold the address: this is a shortcut.
- */
- gs_cie_transform_proc my_proc = bit_TransformPQR_proc;
- byte *my_addr = gs_alloc_string(pdev->memory, sizeof(my_proc),
- "sd_crd_get_params(proc)");
- int code;
+ /*
+ * We definitely do not recommend the following use of a static
+ * to hold the address: this is a shortcut.
+ */
+ gs_cie_transform_proc my_proc = bit_TransformPQR_proc;
+ byte *my_addr = gs_alloc_string(pdev->memory, sizeof(my_proc),
+ "sd_crd_get_params(proc)");
+ int code;
- if (my_addr == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- gs_param_string as;
+ if (my_addr == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ gs_param_string as;
- memcpy(my_addr, &my_proc, sizeof(my_proc));
- as.data = my_addr;
- as.size = sizeof(my_proc);
- as.persistent = true;
- code = param_write_string(plist, bit_TransformPQR.proc_name, &as);
- }
- if (code < 0)
- ecode = code;
+ memcpy(my_addr, &my_proc, sizeof(my_proc));
+ as.data = my_addr;
+ as.size = sizeof(my_proc);
+ as.persistent = true;
+ code = param_write_string(plist, bit_TransformPQR.proc_name, &as);
+ }
+ if (code < 0)
+ ecode = code;
}
return ecode;
}
diff --git a/gs/base/gdevdcrd.h b/gs/base/gdevdcrd.h
index 36011b9c8..068ef57c8 100644
--- a/gs/base/gdevdcrd.h
+++ b/gs/base/gdevdcrd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,6 +18,6 @@
/* Implement get_params for a sample device CRD. */
int sample_device_crd_get_params(gx_device *pdev, gs_param_list *plist,
- const char *crd_param_name);
+ const char *crd_param_name);
#endif /* gdevdcrd_INCLUDED */
diff --git a/gs/base/gdevddrw.c b/gs/base/gdevddrw.c
index b8cd2df23..fa3acfe02 100644
--- a/gs/base/gdevddrw.c
+++ b/gs/base/gdevddrw.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,57 +53,55 @@ fixed_mult_rem(fixed a, fixed b, fixed c)
* the left and right edges during the Bresenham loop.
*/
typedef struct trap_line_s {
- /*
- * h is the y extent of the line (edge.end.y - edge.start.y).
- * We know h > 0.
- */
+ /*
+ * h is the y extent of the line (edge.end.y - edge.start.y).
+ * We know h > 0.
+ */
fixed h;
- /*
- * The dx/dy ratio for the line is di + df/h.
- * (The quotient refers to the l.s.b. of di, not fixed_1.)
- * We know 0 <= df < h.
- */
+ /*
+ * The dx/dy ratio for the line is di + df/h.
+ * (The quotient refers to the l.s.b. of di, not fixed_1.)
+ * We know 0 <= df < h.
+ */
int di;
fixed df;
- /*
- * The intersection of the line with a scan line is x + xf/h + 1.
- * (The 1 refers to the least significant bit of x, not fixed_1;
- * similarly, the quotient refers to the l.s.b. of x.)
- * We know -h <= xf < 0.
- *
- * This rational value preciselly represents the mathematical line
- * (with no machine arithmetic error).
- *
- * Note that the fractional part is negative to simplify
- * some conditions in the Bresenham algorithm.
- * Due to that some expressions are inobvious.
- * We believe that it's a kind of archaic
- * for the modern hyperthreading architecture,
- * we still keep it because the code passed a huge testing
- * on various platforms.
- */
+ /*
+ * The intersection of the line with a scan line is x + xf/h + 1.
+ * (The 1 refers to the least significant bit of x, not fixed_1;
+ * similarly, the quotient refers to the l.s.b. of x.)
+ * We know -h <= xf < 0.
+ *
+ * This rational value preciselly represents the mathematical line
+ * (with no machine arithmetic error).
+ *
+ * Note that the fractional part is negative to simplify
+ * some conditions in the Bresenham algorithm.
+ * Due to that some expressions are inobvious.
+ * We believe that it's a kind of archaic
+ * for the modern hyperthreading architecture,
+ * we still keep it because the code passed a huge testing
+ * on various platforms.
+ */
fixed x, xf;
- /*
- * We increment (x,xf) by (ldi,ldf) after each scan line.
- * (ldi,ldf) is just (di,df) converted to fixed point.
- * We know 0 <= ldf < h.
- */
+ /*
+ * We increment (x,xf) by (ldi,ldf) after each scan line.
+ * (ldi,ldf) is just (di,df) converted to fixed point.
+ * We know 0 <= ldf < h.
+ */
fixed ldi, ldf;
} trap_line;
-
/*
* The linear color trapezoid fill algorithm uses trap_color structures to keep track of
* the color change during the Bresenham loop.
*/
typedef struct trap_gradient_s {
- frac31 *c; /* integer part of the color in frac32 units. */
- int32_t *f; /* the fraction part numerator */
- int32_t *num; /* the gradient numerator */
- int32_t den; /* color gradient denominator */
+ frac31 *c; /* integer part of the color in frac32 units. */
+ int32_t *f; /* the fraction part numerator */
+ int32_t *num; /* the gradient numerator */
+ int32_t den; /* color gradient denominator */
} trap_gradient;
-
/*
* Compute the di and df members of a trap_line structure. The x extent
* (edge.end.x - edge.start.x) is a parameter; the y extent (h member)
@@ -116,21 +114,21 @@ compute_dx(trap_line *tl, fixed xd, fixed ys)
int di;
if (xd >= 0) {
- if (xd < h)
- tl->di = 0, tl->df = xd;
- else {
- tl->di = di = (int)(xd / h);
- tl->df = xd - di * h;
- tl->x += ys * di;
- }
+ if (xd < h)
+ tl->di = 0, tl->df = xd;
+ else {
+ tl->di = di = (int)(xd / h);
+ tl->df = xd - di * h;
+ tl->x += ys * di;
+ }
} else {
- if ((tl->df = xd + h) >= 0 /* xd >= -h */)
- tl->di = -1, tl->x -= ys;
- else {
- tl->di = di = (int)((xd + 1) / h - 1);
- tl->df = xd - di * h;
- tl->x += ys * di;
- }
+ if ((tl->df = xd + h) >= 0 /* xd >= -h */)
+ tl->di = -1, tl->x -= ys;
+ else {
+ tl->di = di = (int)((xd + 1) / h - 1);
+ tl->df = xd - di * h;
+ tl->x += ys * di;
+ }
}
}
@@ -145,56 +143,56 @@ compute_ldx(trap_line *tl, fixed ys)
fixed h = tl->h;
if ( df < YMULT_LIMIT ) {
- if ( df == 0 ) /* vertical edge, worth checking for */
- tl->ldi = int2fixed(di), tl->ldf = 0, tl->xf = -h;
- else {
- tl->ldi = int2fixed(di) + int2fixed(df) / h;
- tl->ldf = int2fixed(df) % h;
- tl->xf =
- (ys < fixed_1 ? ys * df % h : fixed_mult_rem(ys, df, h)) - h;
- }
+ if ( df == 0 ) /* vertical edge, worth checking for */
+ tl->ldi = int2fixed(di), tl->ldf = 0, tl->xf = -h;
+ else {
+ tl->ldi = int2fixed(di) + int2fixed(df) / h;
+ tl->ldf = int2fixed(df) % h;
+ tl->xf =
+ (ys < fixed_1 ? ys * df % h : fixed_mult_rem(ys, df, h)) - h;
+ }
}
else {
- tl->ldi = int2fixed(di) + fixed_mult_quo(fixed_1, df, h);
- tl->ldf = fixed_mult_rem(fixed_1, df, h);
- tl->xf = fixed_mult_rem(ys, df, h) - h;
+ tl->ldi = int2fixed(di) + fixed_mult_quo(fixed_1, df, h);
+ tl->ldf = fixed_mult_rem(fixed_1, df, h);
+ tl->xf = fixed_mult_rem(ys, df, h) - h;
}
}
static inline int
init_gradient(trap_gradient *g, const gs_fill_attributes *fa,
- const gs_linear_color_edge *e, const gs_linear_color_edge *e1,
- const trap_line *l, fixed ybot, int num_components)
+ const gs_linear_color_edge *e, const gs_linear_color_edge *e1,
+ const trap_line *l, fixed ybot, int num_components)
{
int i;
int64_t c;
int32_t d;
if (e->c1 == NULL || e->c0 == NULL)
- g->den = 0; /* A wedge - the color is axial along another edge. */
+ g->den = 0; /* A wedge - the color is axial along another edge. */
else {
- bool ends_from_fa = (e1->c1 == NULL || e1->c0 == NULL);
-
- if (ends_from_fa)
- g->den = fa->yend - fa->ystart;
- else {
- g->den = e->end.y - e->start.y;
- if (g->den != l->h)
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- for (i = 0; i < num_components; i++) {
- g->num[i] = e->c1[i] - e->c0[i];
- c = (int64_t)g->num[i] * (uint32_t)(ybot -
- (ends_from_fa ? fa->ystart : e->start.y));
- d = (int32_t)(c / g->den);
- g->c[i] = e->c0[i] + d;
- c -= (int64_t)d * g->den;
- if (c < 0) {
- g->c[i]--;
- c += g->den;
- }
- g->f[i] = (int32_t)c;
- }
+ bool ends_from_fa = (e1->c1 == NULL || e1->c0 == NULL);
+
+ if (ends_from_fa)
+ g->den = fa->yend - fa->ystart;
+ else {
+ g->den = e->end.y - e->start.y;
+ if (g->den != l->h)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ for (i = 0; i < num_components; i++) {
+ g->num[i] = e->c1[i] - e->c0[i];
+ c = (int64_t)g->num[i] * (uint32_t)(ybot -
+ (ends_from_fa ? fa->ystart : e->start.y));
+ d = (int32_t)(c / g->den);
+ g->c[i] = e->c0[i] + d;
+ c -= (int64_t)d * g->den;
+ if (c < 0) {
+ g->c[i]--;
+ c += g->den;
+ }
+ g->f[i] = (int32_t)c;
+ }
}
return 0;
}
@@ -205,53 +203,52 @@ step_gradient(trap_gradient *g, int num_components)
int i;
if (g->den == 0)
- return;
+ return;
for (i = 0; i < num_components; i++) {
- int64_t fc = g->f[i] + (int64_t)g->num[i] * fixed_1;
- int32_t fc32;
-
- g->c[i] += (int32_t)(fc / g->den);
- fc32 = (int32_t)(fc - fc / g->den * g->den);
- if (fc32 < 0) {
- fc32 += g->den;
- g->c[i]--;
- }
- g->f[i] = fc32;
+ int64_t fc = g->f[i] + (int64_t)g->num[i] * fixed_1;
+ int32_t fc32;
+
+ g->c[i] += (int32_t)(fc / g->den);
+ fc32 = (int32_t)(fc - fc / g->den * g->den);
+ if (fc32 < 0) {
+ fc32 += g->den;
+ g->c[i]--;
+ }
+ g->f[i] = fc32;
}
}
static inline bool
check_gradient_overflow(const gs_linear_color_edge *le, const gs_linear_color_edge *re,
- int num_components)
+ int num_components)
{
if (le->c1 == NULL || re->c1 == NULL) {
- /* A wedge doesn't use a gradient by X. */
- return false;
+ /* A wedge doesn't use a gradient by X. */
+ return false;
} else {
- /* Check whether set_x_gradient, fill_linear_color_scanline can overflow.
-
- dev_proc(dev, fill_linear_color_scanline) can perform its computation in 32-bit fractions,
- so we assume it never overflows. Devices which implement it with no this
- assumption must implement the check in gx_default_fill_linear_color_trapezoid,
- gx_default_fill_linear_color_triangle with a function other than this one.
-
- Since set_x_gradient perform computations in int64_t, which provides 63 bits
- while multiplying a 32-bits color value to a coordinate,
- we must restrict the X span with 63 - 32 = 31 bits.
- */
- int32_t xl = min(le->start.x, le->end.x);
- int32_t xr = min(re->start.x, re->end.x);
- /* The pixel span boundaries : */
- return arith_rshift_1(xr) - arith_rshift_1(xl) >= 0x3FFFFFFE;
+ /* Check whether set_x_gradient, fill_linear_color_scanline can overflow.
+
+ dev_proc(dev, fill_linear_color_scanline) can perform its computation in 32-bit fractions,
+ so we assume it never overflows. Devices which implement it with no this
+ assumption must implement the check in gx_default_fill_linear_color_trapezoid,
+ gx_default_fill_linear_color_triangle with a function other than this one.
+
+ Since set_x_gradient perform computations in int64_t, which provides 63 bits
+ while multiplying a 32-bits color value to a coordinate,
+ we must restrict the X span with 63 - 32 = 31 bits.
+ */
+ int32_t xl = min(le->start.x, le->end.x);
+ int32_t xr = min(re->start.x, re->end.x);
+ /* The pixel span boundaries : */
+ return arith_rshift_1(xr) - arith_rshift_1(xl) >= 0x3FFFFFFE;
}
}
-
static inline int
-set_x_gradient_nowedge(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *rg,
- const trap_line *l, const trap_line *r, int il, int ir, int num_components)
+set_x_gradient_nowedge(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *rg,
+ const trap_line *l, const trap_line *r, int il, int ir, int num_components)
{
- /* Ignoring the ending coordinats fractions,
+ /* Ignoring the ending coordinats fractions,
so the gridient is slightly shifted to the left (in <1 'fixed' unit). */
int32_t xl = l->x - (l->xf == -l->h ? 1 : 0) - fixed_half; /* Revert the GX_FILL_TRAPEZOID shift. */
int32_t xr = r->x - (r->xf == -r->h ? 1 : 0) - fixed_half; /* Revert the GX_FILL_TRAPEZOID shift. */
@@ -261,10 +258,10 @@ set_x_gradient_nowedge(trap_gradient *xg, const trap_gradient *lg, const trap_gr
int i;
# ifdef DEBUG
- if (arith_rshift_1(xr) - arith_rshift_1(xl) >= 0x3FFFFFFE) /* Can overflow ? */
- return_error(gs_error_unregistered); /* Must not happen. */
+ if (arith_rshift_1(xr) - arith_rshift_1(xl) >= 0x3FFFFFFE) /* Can overflow ? */
+ return_error(gs_error_unregistered); /* Must not happen. */
# endif
- /* We cannot compute the color of the 'ir' pixel
+ /* We cannot compute the color of the 'ir' pixel
because it can overflow 'c1' due to the pixel ir center
may be greater that r->x .
Therefore we base the proportion on the pixel index ir-1 (see comment to 'x1').
@@ -272,49 +269,49 @@ set_x_gradient_nowedge(trap_gradient *xg, const trap_gradient *lg, const trap_gr
*/
xg->den = fixed2int(x1 - x0);
if (xg->den <= 0) {
- /* The span contains a single pixel, will construct a degenerate gradient. */
- xg->den = 1; /* Safety (against zerodivide). */
+ /* The span contains a single pixel, will construct a degenerate gradient. */
+ xg->den = 1; /* Safety (against zerodivide). */
}
for (i = 0; i < num_components; i++) {
- /* Ignoring the ending colors fractions,
- so the color gets a slightly smaller value
- (in <1 'frac31' unit), but it's not important due to
- the further conversion to [0, 1 << cinfo->comp_bits[j]],
- which drops the fraction anyway. */
- int32_t cl = lg->c[i];
- int32_t cr = rg->c[i];
- int32_t c0 = (int32_t)(cl + ((int64_t)cr - cl) * (x0 - xl) / (xr - xl));
- int32_t c1 = (int32_t)(cl + ((int64_t)cr - cl) * (x1 - xl) / (xr - xl));
-
- xg->c[i] = c0;
- xg->f[i] = 0; /* Insufficient bits to compute it better.
- The color so the color gets a slightly smaller value
- (in <1 'frac31' unit), but it's not important due to
- the further conversion to [0, 1 << cinfo->comp_bits[j]],
- which drops the fraction anyway.
- So setting 0 appears pretty good and fast. */
- xg->num[i] = c1 - c0;
+ /* Ignoring the ending colors fractions,
+ so the color gets a slightly smaller value
+ (in <1 'frac31' unit), but it's not important due to
+ the further conversion to [0, 1 << cinfo->comp_bits[j]],
+ which drops the fraction anyway. */
+ int32_t cl = lg->c[i];
+ int32_t cr = rg->c[i];
+ int32_t c0 = (int32_t)(cl + ((int64_t)cr - cl) * (x0 - xl) / (xr - xl));
+ int32_t c1 = (int32_t)(cl + ((int64_t)cr - cl) * (x1 - xl) / (xr - xl));
+
+ xg->c[i] = c0;
+ xg->f[i] = 0; /* Insufficient bits to compute it better.
+ The color so the color gets a slightly smaller value
+ (in <1 'frac31' unit), but it's not important due to
+ the further conversion to [0, 1 << cinfo->comp_bits[j]],
+ which drops the fraction anyway.
+ So setting 0 appears pretty good and fast. */
+ xg->num[i] = c1 - c0;
}
return 0;
}
static inline int
-set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *rg,
- const trap_line *l, const trap_line *r, int il, int ir, int num_components)
+set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *rg,
+ const trap_line *l, const trap_line *r, int il, int ir, int num_components)
{
if (lg->den == 0 || rg->den == 0) {
- /* A wedge doesn't use a gradient by X. */
- int i;
-
- xg->den = 1;
- for (i = 0; i < num_components; i++) {
- xg->c[i] = (lg->den == 0 ? rg->c[i] : lg->c[i]);
- xg->f[i] = 0; /* Compatible to set_x_gradient_nowedge. */
- xg->num[i] = 0;
- }
- return 0;
+ /* A wedge doesn't use a gradient by X. */
+ int i;
+
+ xg->den = 1;
+ for (i = 0; i < num_components; i++) {
+ xg->c[i] = (lg->den == 0 ? rg->c[i] : lg->c[i]);
+ xg->f[i] = 0; /* Compatible to set_x_gradient_nowedge. */
+ xg->num[i] = 0;
+ }
+ return 0;
} else
- return set_x_gradient_nowedge(xg, lg, rg, l, r, il, ir, num_components);
+ return set_x_gradient_nowedge(xg, lg, rg, l, r, il, ir, num_components);
}
/*
@@ -333,7 +330,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 1
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -343,7 +340,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 0
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -353,7 +350,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 1
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -363,7 +360,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 0
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -373,7 +370,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 1
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -383,7 +380,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 0
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -401,7 +398,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 1
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -411,7 +408,7 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#define FILL_DIRECT 1
#include "gxdtfill.h"
#undef GX_FILL_TRAPEZOID
-#undef CONTIGUOUS_FILL
+#undef CONTIGUOUS_FILL
#undef SWAP_AXES
#undef FILL_DIRECT
@@ -419,7 +416,6 @@ set_x_gradient(trap_gradient *xg, const trap_gradient *lg, const trap_gradient *
#undef LINEAR_COLOR
#undef FILL_ATTRS
-
int
gx_default_fill_trapezoid(gx_device * dev, const gs_fixed_edge * left,
const gs_fixed_edge * right, fixed ybot, fixed ytop, bool swap_axes,
@@ -428,15 +424,15 @@ gx_default_fill_trapezoid(gx_device * dev, const gs_fixed_edge * left,
bool fill_direct = color_writes_pure(pdevc, lop);
if (swap_axes) {
- if (fill_direct)
- return gx_fill_trapezoid_as_fd(dev, left, right, ybot, ytop, 0, pdevc, lop);
- else
- return gx_fill_trapezoid_as_nd(dev, left, right, ybot, ytop, 0, pdevc, lop);
+ if (fill_direct)
+ return gx_fill_trapezoid_as_fd(dev, left, right, ybot, ytop, 0, pdevc, lop);
+ else
+ return gx_fill_trapezoid_as_nd(dev, left, right, ybot, ytop, 0, pdevc, lop);
} else {
- if (fill_direct)
- return gx_fill_trapezoid_ns_fd(dev, left, right, ybot, ytop, 0, pdevc, lop);
- else
- return gx_fill_trapezoid_ns_nd(dev, left, right, ybot, ytop, 0, pdevc, lop);
+ if (fill_direct)
+ return gx_fill_trapezoid_ns_fd(dev, left, right, ybot, ytop, 0, pdevc, lop);
+ else
+ return gx_fill_trapezoid_ns_nd(dev, left, right, ybot, ytop, 0, pdevc, lop);
}
}
@@ -447,25 +443,24 @@ middle_frac31_color(frac31 *c, const frac31 *c0, const frac31 *c2, int num_compo
int i;
for (i = 0; i < num_components; i++)
- c[i] = (int32_t)(((uint32_t)c0[i] + (uint32_t)c2[i]) >> 1);
+ c[i] = (int32_t)(((uint32_t)c0[i] + (uint32_t)c2[i]) >> 1);
}
static inline int
fill_linear_color_trapezoid_nocheck(gx_device *dev, const gs_fill_attributes *fa,
- const gs_linear_color_edge *le, const gs_linear_color_edge *re)
+ const gs_linear_color_edge *le, const gs_linear_color_edge *re)
{
fixed y02 = max(le->start.y, re->start.y), ymin = max(y02, fa->clip->p.y);
fixed y13 = min(le->end.y, re->end.y), ymax = min(y13, fa->clip->q.y);
int code;
- code = (fa->swap_axes ? gx_fill_trapezoid_as_lc : gx_fill_trapezoid_ns_lc)(dev,
- le, re, ymin, ymax, 0, NULL, fa);
+ code = (fa->swap_axes ? gx_fill_trapezoid_as_lc : gx_fill_trapezoid_ns_lc)(dev,
+ le, re, ymin, ymax, 0, NULL, fa);
if (code < 0)
- return code;
+ return code;
return !code;
}
-
/* Fill a trapezoid with a linear color.
[p0 : p1] - left edge, from bottom to top.
[p2 : p3] - right edge, from bottom to top.
@@ -473,20 +468,20 @@ fill_linear_color_trapezoid_nocheck(gx_device *dev, const gs_fill_attributes *fa
This implemetation actually handles a bilinear color,
in which the generatrix keeps a parallelizm to the X axis.
- In general a bilinear function doesn't keep the generatrix parallelizm,
+ In general a bilinear function doesn't keep the generatrix parallelizm,
so the caller must decompose/approximate such functions.
- Return values :
+ Return values :
1 - success;
0 - Too big. The area isn't filled. The client must decompose the area.
<0 - error.
*/
-int
+int
gx_default_fill_linear_color_trapezoid(gx_device *dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2, const gs_fixed_point *p3,
- const frac31 *c0, const frac31 *c1,
- const frac31 *c2, const frac31 *c3)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2, const gs_fixed_point *p3,
+ const frac31 *c0, const frac31 *c1,
+ const frac31 *c2, const frac31 *c3)
{
gs_linear_color_edge le, re;
int num_components = dev->color_info.num_components;
@@ -506,20 +501,20 @@ gx_default_fill_linear_color_trapezoid(gx_device *dev, const gs_fill_attributes
return fill_linear_color_trapezoid_nocheck(dev, fa, &le, &re);
}
-static inline int
+static inline int
fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2,
- const frac31 *c0, const frac31 *c1, const frac31 *c2)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2,
+ const frac31 *c0, const frac31 *c1, const frac31 *c2)
{ /* p0 must be the lowest vertex. */
int code;
gs_linear_color_edge e0, e1, e2;
int num_components = dev->color_info.num_components;
if (p0->y == p1->y)
- return gx_default_fill_linear_color_trapezoid(dev, fa, p0, p2, p1, p2, c0, c2, c1, c2);
+ return gx_default_fill_linear_color_trapezoid(dev, fa, p0, p2, p1, p2, c0, c2, c1, c2);
if (p1->y == p2->y)
- return gx_default_fill_linear_color_trapezoid(dev, fa, p0, p2, p0, p1, c0, c2, c0, c1);
+ return gx_default_fill_linear_color_trapezoid(dev, fa, p0, p2, p0, p1, c0, c2, c0, c1);
e0.start = *p0;
e0.end = *p2;
e0.c0 = c0;
@@ -531,61 +526,61 @@ fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa,
e1.c1 = c1;
e1.clip_x = fa->clip->q.x;
if (p0->y < p1->y && p1->y < p2->y) {
- e2.start = *p1;
- e2.end = *p2;
- e2.c0 = c1;
- e2.c1 = c2;
- e2.clip_x = fa->clip->q.x;
- if (check_gradient_overflow(&e0, &e1, num_components))
- return 0;
- if (check_gradient_overflow(&e0, &e2, num_components))
- return 0;
- code = fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e1);
- if (code <= 0) /* Sic! */
- return code;
- return fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e2);
+ e2.start = *p1;
+ e2.end = *p2;
+ e2.c0 = c1;
+ e2.c1 = c2;
+ e2.clip_x = fa->clip->q.x;
+ if (check_gradient_overflow(&e0, &e1, num_components))
+ return 0;
+ if (check_gradient_overflow(&e0, &e2, num_components))
+ return 0;
+ code = fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e1);
+ if (code <= 0) /* Sic! */
+ return code;
+ return fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e2);
} else { /* p0->y < p2->y && p2->y < p1->y */
- e2.start = *p2;
- e2.end = *p1;
- e2.c0 = c2;
- e2.c1 = c1;
- e2.clip_x = fa->clip->q.x;
- if (check_gradient_overflow(&e0, &e1, num_components))
- return 0;
- if (check_gradient_overflow(&e2, &e1, num_components))
- return 0;
- code = fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e1);
- if (code <= 0) /* Sic! */
- return code;
- return fill_linear_color_trapezoid_nocheck(dev, fa, &e2, &e1);
+ e2.start = *p2;
+ e2.end = *p1;
+ e2.c0 = c2;
+ e2.c1 = c1;
+ e2.clip_x = fa->clip->q.x;
+ if (check_gradient_overflow(&e0, &e1, num_components))
+ return 0;
+ if (check_gradient_overflow(&e2, &e1, num_components))
+ return 0;
+ code = fill_linear_color_trapezoid_nocheck(dev, fa, &e0, &e1);
+ if (code <= 0) /* Sic! */
+ return code;
+ return fill_linear_color_trapezoid_nocheck(dev, fa, &e2, &e1);
}
}
/* Fill a triangle with a linear color. */
-int
+int
gx_default_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2,
- const frac31 *c0, const frac31 *c1, const frac31 *c2)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2,
+ const frac31 *c0, const frac31 *c1, const frac31 *c2)
{
fixed dx1 = p1->x - p0->x, dy1 = p1->y - p0->y;
fixed dx2 = p2->x - p0->x, dy2 = p2->y - p0->y;
-
+
if ((int64_t)dx1 * dy2 < (int64_t)dx2 * dy1) {
- const gs_fixed_point *p = p1;
- const frac31 *c = c1;
-
- p1 = p2;
- p2 = p;
- c1 = c2;
- c2 = c;
+ const gs_fixed_point *p = p1;
+ const frac31 *c = c1;
+
+ p1 = p2;
+ p2 = p;
+ c1 = c2;
+ c2 = c;
}
if (p0->y <= p1->y && p0->y <= p2->y)
- return fill_linear_color_triangle(dev, fa, p0, p1, p2, c0, c1, c2);
+ return fill_linear_color_triangle(dev, fa, p0, p1, p2, c0, c1, c2);
if (p1->y <= p0->y && p1->y <= p2->y)
- return fill_linear_color_triangle(dev, fa, p1, p2, p0, c1, c2, c0);
+ return fill_linear_color_triangle(dev, fa, p1, p2, p0, c1, c2, c0);
else
- return fill_linear_color_triangle(dev, fa, p2, p0, p1, c2, c0, c1);
+ return fill_linear_color_triangle(dev, fa, p2, p0, p1, c2, c0, c1);
}
/* Fill a parallelogram whose points are p, p+a, p+b, and p+a+b. */
@@ -593,8 +588,8 @@ gx_default_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *
/* We must be very careful to follow the center-of-pixel rule in all cases. */
int
gx_default_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
fixed t;
fixed qx, qy, ym;
@@ -604,13 +599,13 @@ gx_default_fill_parallelogram(gx_device * dev,
/* Make a special fast check for rectangles. */
if (PARALLELOGRAM_IS_RECT(ax, ay, bx, by)) {
- gs_int_rect r;
+ gs_int_rect r;
- INT_RECT_FROM_PARALLELOGRAM(&r, px, py, ax, ay, bx, by);
- vd_rect(int2fixed(r.p.x), int2fixed(r.p.y), int2fixed(r.q.x), int2fixed(r.q.y),
- 1, (int)pdevc->colors.pure);
- return gx_fill_rectangle_device_rop(r.p.x, r.p.y, r.q.x - r.p.x,
- r.q.y - r.p.y, pdevc, dev, lop);
+ INT_RECT_FROM_PARALLELOGRAM(&r, px, py, ax, ay, bx, by);
+ vd_rect(int2fixed(r.p.x), int2fixed(r.p.y), int2fixed(r.q.x), int2fixed(r.q.y),
+ 1, (int)pdevc->colors.pure);
+ return gx_fill_rectangle_device_rop(r.p.x, r.p.y, r.q.x - r.p.x,
+ r.q.y - r.p.y, pdevc, dev, lop);
}
/*
* Not a rectangle. Ensure that the 'a' line is to the left of
@@ -619,24 +614,24 @@ gx_default_fill_parallelogram(gx_device * dev,
*/
/* Ensure ay >= 0, by >= 0. */
if (ay < 0)
- px += ax, py += ay, ax = -ax, ay = -ay;
+ px += ax, py += ay, ax = -ax, ay = -ay;
if (by < 0)
- px += bx, py += by, bx = -bx, by = -by;
+ px += bx, py += by, bx = -bx, by = -by;
qx = px + ax + bx;
if ((ax ^ bx) < 0) { /* In this case, the test ax <= bx is sufficient. */
- if (ax > bx)
- SWAP(ax, bx, t), SWAP(ay, by, t);
+ if (ax > bx)
+ SWAP(ax, bx, t), SWAP(ay, by, t);
} else { /*
- * Compare the slopes. We know that ay >= 0, by >= 0,
- * and ax and bx have the same sign; the lines are in the
- * correct order iff
- * ay/ax >= by/bx, or
- * ay*bx >= by*ax
- * Eventually we can probably find a better way to test this,
- * without using floating point.
- */
- if ((double)ay * bx < (double)by * ax)
- SWAP(ax, bx, t), SWAP(ay, by, t);
+ * Compare the slopes. We know that ay >= 0, by >= 0,
+ * and ax and bx have the same sign; the lines are in the
+ * correct order iff
+ * ay/ax >= by/bx, or
+ * ay*bx >= by*ax
+ * Eventually we can probably find a better way to test this,
+ * without using floating point.
+ */
+ if ((double)ay * bx < (double)by * ax)
+ SWAP(ax, bx, t), SWAP(ay, by, t);
}
fill_trapezoid = dev_proc(dev, fill_trapezoid);
qy = py + ay + by;
@@ -649,47 +644,47 @@ gx_default_fill_parallelogram(gx_device * dev,
#define ROUNDED_SAME(p1, p2)\
(fixed_pixround(p1) == fixed_pixround(p2))
if (ay < by) {
- if (!ROUNDED_SAME(py, left.end.y)) {
- code = (*fill_trapezoid) (dev, &left, &right, py, left.end.y,
- false, pdevc, lop);
- if (code < 0)
- return code;
- }
- left.start = left.end;
- left.end.x = qx, left.end.y = qy;
- ym = right.end.y;
- if (!ROUNDED_SAME(left.start.y, ym)) {
- code = (*fill_trapezoid) (dev, &left, &right, left.start.y, ym,
- false, pdevc, lop);
- if (code < 0)
- return code;
- }
- right.start = right.end;
- right.end.x = qx, right.end.y = qy;
+ if (!ROUNDED_SAME(py, left.end.y)) {
+ code = (*fill_trapezoid) (dev, &left, &right, py, left.end.y,
+ false, pdevc, lop);
+ if (code < 0)
+ return code;
+ }
+ left.start = left.end;
+ left.end.x = qx, left.end.y = qy;
+ ym = right.end.y;
+ if (!ROUNDED_SAME(left.start.y, ym)) {
+ code = (*fill_trapezoid) (dev, &left, &right, left.start.y, ym,
+ false, pdevc, lop);
+ if (code < 0)
+ return code;
+ }
+ right.start = right.end;
+ right.end.x = qx, right.end.y = qy;
} else {
- if (!ROUNDED_SAME(py, right.end.y)) {
- code = (*fill_trapezoid) (dev, &left, &right, py, right.end.y,
- false, pdevc, lop);
- if (code < 0)
- return code;
- }
- right.start = right.end;
- right.end.x = qx, right.end.y = qy;
- ym = left.end.y;
- if (!ROUNDED_SAME(right.start.y, ym)) {
- code = (*fill_trapezoid) (dev, &left, &right, right.start.y, ym,
- false, pdevc, lop);
- if (code < 0)
- return code;
- }
- left.start = left.end;
- left.end.x = qx, left.end.y = qy;
+ if (!ROUNDED_SAME(py, right.end.y)) {
+ code = (*fill_trapezoid) (dev, &left, &right, py, right.end.y,
+ false, pdevc, lop);
+ if (code < 0)
+ return code;
+ }
+ right.start = right.end;
+ right.end.x = qx, right.end.y = qy;
+ ym = left.end.y;
+ if (!ROUNDED_SAME(right.start.y, ym)) {
+ code = (*fill_trapezoid) (dev, &left, &right, right.start.y, ym,
+ false, pdevc, lop);
+ if (code < 0)
+ return code;
+ }
+ left.start = left.end;
+ left.end.x = qx, left.end.y = qy;
}
if (!ROUNDED_SAME(ym, qy))
- return (*fill_trapezoid) (dev, &left, &right, ym, qy,
- false, pdevc, lop);
+ return (*fill_trapezoid) (dev, &left, &right, ym, qy,
+ false, pdevc, lop);
else
- return 0;
+ return 0;
#undef ROUNDED_SAME
}
@@ -697,25 +692,25 @@ gx_default_fill_parallelogram(gx_device * dev,
/* We should swap axes to get best accuracy, but we don't. */
int
gx_default_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
fixed t;
fixed ym;
dev_proc_fill_trapezoid((*fill_trapezoid)) =
- dev_proc(dev, fill_trapezoid);
+ dev_proc(dev, fill_trapezoid);
gs_fixed_edge left, right;
int code;
/* Ensure ay >= 0, by >= 0. */
if (ay < 0)
- px += ax, py += ay, bx -= ax, by -= ay, ax = -ax, ay = -ay;
+ px += ax, py += ay, bx -= ax, by -= ay, ax = -ax, ay = -ay;
if (by < 0)
- px += bx, py += by, ax -= bx, ay -= by, bx = -bx, by = -by;
+ px += bx, py += by, ax -= bx, ay -= by, bx = -bx, by = -by;
/* Ensure ay <= by. */
if (ay > by)
- SWAP(ax, bx, t), SWAP(ay, by, t);
+ SWAP(ax, bx, t), SWAP(ay, by, t);
/*
* Make a special check for a flat bottom or top,
* which we can handle with a single call on fill_trapezoid.
@@ -723,61 +718,61 @@ gx_default_fill_triangle(gx_device * dev,
left.start.x = right.start.x = px;
left.start.y = right.start.y = py;
if (ay == 0) {
- /* Flat top */
- if (ax < 0)
- left.start.x = px + ax;
- else
- right.start.x = px + ax;
- left.end.x = right.end.x = px + bx;
- left.end.y = right.end.y = py + by;
- ym = py;
+ /* Flat top */
+ if (ax < 0)
+ left.start.x = px + ax;
+ else
+ right.start.x = px + ax;
+ left.end.x = right.end.x = px + bx;
+ left.end.y = right.end.y = py + by;
+ ym = py;
} else if (ay == by) {
- /* Flat bottom */
- if (ax < bx)
- left.end.x = px + ax, right.end.x = px + bx;
- else
- left.end.x = px + bx, right.end.x = px + ax;
- left.end.y = right.end.y = py + by;
- ym = py;
+ /* Flat bottom */
+ if (ax < bx)
+ left.end.x = px + ax, right.end.x = px + bx;
+ else
+ left.end.x = px + bx, right.end.x = px + ax;
+ left.end.y = right.end.y = py + by;
+ ym = py;
} else {
- ym = py + ay;
- if (fixed_mult_quo(bx, ay, by) < ax) {
- /* The 'b' line is to the left of the 'a' line. */
- left.end.x = px + bx, left.end.y = py + by;
- right.end.x = px + ax, right.end.y = py + ay;
- code = (*fill_trapezoid) (dev, &left, &right, py, ym,
- false, pdevc, lop);
- right.start = right.end;
- right.end = left.end;
- } else {
- /* The 'a' line is to the left of the 'b' line. */
- left.end.x = px + ax, left.end.y = py + ay;
- right.end.x = px + bx, right.end.y = py + by;
- code = (*fill_trapezoid) (dev, &left, &right, py, ym,
- false, pdevc, lop);
- left.start = left.end;
- left.end = right.end;
- }
- if (code < 0)
- return code;
+ ym = py + ay;
+ if (fixed_mult_quo(bx, ay, by) < ax) {
+ /* The 'b' line is to the left of the 'a' line. */
+ left.end.x = px + bx, left.end.y = py + by;
+ right.end.x = px + ax, right.end.y = py + ay;
+ code = (*fill_trapezoid) (dev, &left, &right, py, ym,
+ false, pdevc, lop);
+ right.start = right.end;
+ right.end = left.end;
+ } else {
+ /* The 'a' line is to the left of the 'b' line. */
+ left.end.x = px + ax, left.end.y = py + ay;
+ right.end.x = px + bx, right.end.y = py + by;
+ code = (*fill_trapezoid) (dev, &left, &right, py, ym,
+ false, pdevc, lop);
+ left.start = left.end;
+ left.end = right.end;
+ }
+ if (code < 0)
+ return code;
}
return (*fill_trapezoid) (dev, &left, &right, ym, right.end.y,
- false, pdevc, lop);
+ false, pdevc, lop);
}
/* Draw a one-pixel-wide line. */
int
gx_default_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_device_color * pdevc, gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_device_color * pdevc, gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
int ix, iy, itox, itoy;
fixed tf;
int epsilon;
-
+
return_if_interrupt(dev->memory);
-
+
/* This function was updated in revision 10391 to fix problems with
* mispositioned thin lines. This introduced a regression (see bug
* 691030). The code was then reworked to behave in what we believe is
@@ -794,53 +789,53 @@ gx_default_draw_thin_line(gx_device * dev,
*
* It is hoped that this difference in behaviour will be short lived.
*/
-
+
epsilon = ((adjustx | adjusty) == 0 ? fixed_epsilon : 0);
-
+
{
- fixed h = fy1 - fy0;
- fixed w = fx1 - fx0;
- fixed tf;
- bool swap_axes;
- gs_fixed_edge left, right;
+ fixed h = fy1 - fy0;
+ fixed w = fx1 - fx0;
+ fixed tf;
+ bool swap_axes;
+ gs_fixed_edge left, right;
- if ((w < 0 ? -w : w) <= (h < 0 ? -h : h)) {
+ if ((w < 0 ? -w : w) <= (h < 0 ? -h : h)) {
/* A "mostly-vertical" line */
- if (h < 0)
- SWAP(fx0, fx1, tf), SWAP(fy0, fy1, tf),
- h = -h;
- /* So we are plotting a trapezoid with horizontal thin edges.
- * Check for whether a triangular extension area on the end
- * covers an additional pixel centre. */
- {
- int deltay = int2fixed(fixed2int_var(fy1)) + fixed_half -fy1;
- int deltax = int2fixed(fixed2int_var(fx1)) + fixed_half -fx1;
+ if (h < 0)
+ SWAP(fx0, fx1, tf), SWAP(fy0, fy1, tf),
+ h = -h;
+ /* So we are plotting a trapezoid with horizontal thin edges.
+ * Check for whether a triangular extension area on the end
+ * covers an additional pixel centre. */
+ {
+ int deltay = int2fixed(fixed2int_var(fy1)) + fixed_half -fy1;
+ int deltax = int2fixed(fixed2int_var(fx1)) + fixed_half -fx1;
if (deltax < 0) deltax=-deltax;
- if ((deltay > 0) && (deltay <= fixed_half) &&
- (deltay+deltax <= fixed_half))
+ if ((deltay > 0) && (deltay <= fixed_half) &&
+ (deltay+deltax <= fixed_half))
{
int c = gx_fill_rectangle_device_rop(fixed2int_var(fx1),
fixed2int_var(fy1),
1,1,pdevc,dev,lop);
if (c < 0) return c;
}
- }
- {
- int deltay = int2fixed(fixed2int_var(fy0)) + fixed_half -fy0;
- int deltax = int2fixed(fixed2int_var(fx0)) + fixed_half -fx0;
+ }
+ {
+ int deltay = int2fixed(fixed2int_var(fy0)) + fixed_half -fy0;
+ int deltax = int2fixed(fixed2int_var(fx0)) + fixed_half -fx0;
if (deltax < 0) deltax=-deltax;
- if ((deltay < 0) && (deltay >= -fixed_half) &&
- (-deltay+deltax <= fixed_half))
+ if ((deltay < 0) && (deltay >= -fixed_half) &&
+ (-deltay+deltax <= fixed_half))
{
int c = gx_fill_rectangle_device_rop(fixed2int_var(fx0),
fixed2int_var(fy0),
1,1,pdevc,dev,lop);
if (c < 0) return c;
}
- }
- /* Can we treat it as a vertical rectangle? */
+ }
+ /* Can we treat it as a vertical rectangle? */
ix = fixed2int_var(fx0-epsilon);
itox = fixed2int_var(fx1-epsilon);
if (itox == ix) {
@@ -858,49 +853,49 @@ gx_default_draw_thin_line(gx_device * dev,
return gx_fill_rectangle_device_rop(ix, iy, 1, itoy,
pdevc, dev, lop);
}
- left.start.x = fx0 - fixed_half + fixed_epsilon - epsilon;
- right.start.x = left.start.x + fixed_1;
- left.end.x = fx1 - fixed_half + fixed_epsilon - epsilon;
- right.end.x = left.end.x + fixed_1;
- left.start.y = right.start.y = fy0;
- left.end.y = right.end.y = fy1;
- swap_axes = false;
- } else {
+ left.start.x = fx0 - fixed_half + fixed_epsilon - epsilon;
+ right.start.x = left.start.x + fixed_1;
+ left.end.x = fx1 - fixed_half + fixed_epsilon - epsilon;
+ right.end.x = left.end.x + fixed_1;
+ left.start.y = right.start.y = fy0;
+ left.end.y = right.end.y = fy1;
+ swap_axes = false;
+ } else {
/* A "mostly-horizontal" line */
- if (w < 0)
- SWAP(fx0, fx1, tf), SWAP(fy0, fy1, tf),
- w = -w;
- /* So we are plotting a trapezoid with vertical thin edges
- * Check for whether a triangular extension area on the end
- * covers an additional pixel centre. */
- {
- int deltax = int2fixed(fixed2int_var(fx1)) + fixed_half -fx1;
- int deltay = int2fixed(fixed2int_var(fy1)) + fixed_half -fy1;
+ if (w < 0)
+ SWAP(fx0, fx1, tf), SWAP(fy0, fy1, tf),
+ w = -w;
+ /* So we are plotting a trapezoid with vertical thin edges
+ * Check for whether a triangular extension area on the end
+ * covers an additional pixel centre. */
+ {
+ int deltax = int2fixed(fixed2int_var(fx1)) + fixed_half -fx1;
+ int deltay = int2fixed(fixed2int_var(fy1)) + fixed_half -fy1;
if (deltay < 0) deltay=-deltay;
- if ((deltax > 0) && (deltax <= fixed_half) &&
- (deltax+deltay <= fixed_half))
+ if ((deltax > 0) && (deltax <= fixed_half) &&
+ (deltax+deltay <= fixed_half))
{
int c = gx_fill_rectangle_device_rop(fixed2int_var(fx1),
fixed2int_var(fy1),
1,1,pdevc,dev,lop);
if (c < 0) return c;
}
- }
- {
- int deltax = int2fixed(fixed2int_var(fx0)) + fixed_half -fx0;
- int deltay = int2fixed(fixed2int_var(fy0)) + fixed_half -fy0;
+ }
+ {
+ int deltax = int2fixed(fixed2int_var(fx0)) + fixed_half -fx0;
+ int deltay = int2fixed(fixed2int_var(fy0)) + fixed_half -fy0;
if (deltay < 0) deltay=-deltay;
- if ((deltax < 0) && (deltax >= -fixed_half) &&
- (-deltax+deltay <= fixed_half))
+ if ((deltax < 0) && (deltax >= -fixed_half) &&
+ (-deltax+deltay <= fixed_half))
{
int c = gx_fill_rectangle_device_rop(fixed2int_var(fx0),
fixed2int_var(fy0),
1,1,pdevc,dev,lop);
if (c < 0) return c;
}
- }
+ }
/* Can we treat this as a horizontal rectangle? */
iy = fixed2int_var(fy0 - epsilon);
itoy = fixed2int_var(fy1 - epsilon);
@@ -918,24 +913,24 @@ gx_default_draw_thin_line(gx_device * dev,
return gx_fill_rectangle_device_rop(ix, iy, itox, 1,
pdevc, dev, lop);
}
- left.start.x = fy0 - fixed_half + fixed_epsilon - epsilon;
- right.start.x = left.start.x + fixed_1;
- left.end.x = fy1 - fixed_half + fixed_epsilon - epsilon;
- right.end.x = left.end.x + fixed_1;
- left.start.y = right.start.y = fx0;
- left.end.y = right.end.y = fx1;
- swap_axes = true;
- }
- return (*dev_proc(dev, fill_trapezoid)) (dev, &left, &right,
- left.start.y, left.end.y,
- swap_axes, pdevc, lop);
+ left.start.x = fy0 - fixed_half + fixed_epsilon - epsilon;
+ right.start.x = left.start.x + fixed_1;
+ left.end.x = fy1 - fixed_half + fixed_epsilon - epsilon;
+ right.end.x = left.end.x + fixed_1;
+ left.start.y = right.start.y = fx0;
+ left.end.y = right.end.y = fx1;
+ swap_axes = true;
+ }
+ return (*dev_proc(dev, fill_trapezoid)) (dev, &left, &right,
+ left.start.y, left.end.y,
+ swap_axes, pdevc, lop);
}
}
/* Stub out the obsolete procedure. */
int
gx_default_draw_line(gx_device * dev,
- int x0, int y0, int x1, int y1, gx_color_index color)
+ int x0, int y0, int x1, int y1, gx_color_index color)
{
return -1;
}
@@ -945,7 +940,7 @@ gx_default_draw_line(gx_device * dev,
/* GC structures for image enumerator */
public_st_gx_image_enum_common();
-static
+static
ENUM_PTRS_WITH(image_enum_common_enum_ptrs, gx_image_enum_common_t *eptr)
return 0;
case 0: return ENUM_OBJ(gx_device_enum_ptr(eptr->dev));
@@ -964,19 +959,19 @@ RELOC_PTRS_END
*/
static int
gx_no_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
return -1;
}
int
gx_default_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
/*
* Hand off to begin_typed_image, being careful to avoid a
@@ -992,57 +987,57 @@ gx_default_begin_image(gx_device * dev,
set_dev_proc(dev, begin_image, gx_no_begin_image);
if (pim->format == format)
- ptim = pim;
+ ptim = pim;
else {
- image = *pim;
- image.format = format;
- ptim = &image;
+ image = *pim;
+ image.format = format;
+ ptim = &image;
}
code = (*dev_proc(dev, begin_typed_image))
- (dev, pis, NULL, (const gs_image_common_t *)ptim, prect, pdcolor,
- pcpath, memory, pinfo);
+ (dev, pis, NULL, (const gs_image_common_t *)ptim, prect, pdcolor,
+ pcpath, memory, pinfo);
set_dev_proc(dev, begin_image, save_begin_image);
return code;
}
int
gx_default_begin_typed_image(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
-{
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+{
/* Processing an image object operation */
if (pis != NULL) /* Null can happen when generating image3 mask */
gs_set_object_tag(pis, GS_IMAGE_TAG);
/* If this is an ImageType 1 image using the imager's CTM,
- * defer to begin_image.
- */
+ * defer to begin_image.
+ */
if (pic->type->begin_typed_image == gx_begin_image1) {
- const gs_image_t *pim = (const gs_image_t *)pic;
-
- if (pmat == 0 ||
- (pis != 0 && !memcmp(pmat, &ctm_only(pis), sizeof(*pmat)))
- ) {
- int code = (*dev_proc(dev, begin_image))
- (dev, pis, pim, pim->format, prect, pdcolor,
- pcpath, memory, pinfo);
-
- if (code >= 0)
- return code;
- }
+ const gs_image_t *pim = (const gs_image_t *)pic;
+
+ if (pmat == 0 ||
+ (pis != 0 && !memcmp(pmat, &ctm_only(pis), sizeof(*pmat)))
+ ) {
+ int code = (*dev_proc(dev, begin_image))
+ (dev, pis, pim, pim->format, prect, pdcolor,
+ pcpath, memory, pinfo);
+
+ if (code >= 0)
+ return code;
+ }
}
return (*pic->type->begin_typed_image)
- (dev, pis, pmat, pic, prect, pdcolor, pcpath, memory, pinfo);
+ (dev, pis, pmat, pic, prect, pdcolor, pcpath, memory, pinfo);
}
/* Backward compatibility for obsolete driver procedures. */
int
gx_default_image_data(gx_device *dev, gx_image_enum_common_t * info,
- const byte ** plane_data,
- int data_x, uint raster, int height)
+ const byte ** plane_data,
+ int data_x, uint raster, int height)
{
int code;
@@ -1058,7 +1053,7 @@ gx_default_image_data(gx_device *dev, gx_image_enum_common_t * info,
int
gx_default_end_image(gx_device *dev, gx_image_enum_common_t * info,
- bool draw_last)
+ bool draw_last)
{
return gx_image_end(info, draw_last);
}
@@ -1072,15 +1067,15 @@ gx_default_fillpage(gx_device *dev, gs_imager_state * pis, gx_device_color *pdev
/* Fill the page directly, ignoring clipping. */
/* Use the default RasterOp. */
if (hl_color_available) {
- gs_fixed_rect rect;
+ gs_fixed_rect rect;
- rect.p.x = rect.p.y = 0;
- rect.q.x = int2fixed(dev->width);
- rect.q.y = int2fixed(dev->height);
- code = dev_proc(dev, fill_rectangle_hl_color)(dev,
- &rect, (const gs_imager_state *)pis, pdevc, NULL);
+ rect.p.x = rect.p.y = 0;
+ rect.q.x = int2fixed(dev->width);
+ rect.q.y = int2fixed(dev->height);
+ code = dev_proc(dev, fill_rectangle_hl_color)(dev,
+ &rect, (const gs_imager_state *)pis, pdevc, NULL);
}
if (!hl_color_available || code == gs_error_rangecheck)
- code = gx_fill_rectangle_device_rop(0, 0, dev->width, dev->height, pdevc, dev, lop_default);
+ code = gx_fill_rectangle_device_rop(0, 0, dev->width, dev->height, pdevc, dev, lop_default);
return code;
}
diff --git a/gs/base/gdevddrw.h b/gs/base/gdevddrw.h
index e6a8c5fa0..41e43894e 100644
--- a/gs/base/gdevddrw.h
+++ b/gs/base/gdevddrw.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,4 +30,3 @@ int gx_fill_trapezoid_cf_nd(gx_device * dev, const gs_fixed_edge * left,
const gx_device_color * pdevc, gs_logical_operation_t lop);
#endif /* gdevddrw_INCLUDED */
-
diff --git a/gs/base/gdevdevn.c b/gs/base/gdevdevn.c
index c3491fd50..fa857f98b 100644
--- a/gs/base/gdevdevn.c
+++ b/gs/base/gdevdevn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,7 @@ gray_cs_to_devn_cm(gx_device * dev, int * map, frac gray, frac out[])
/* Convert an RGB color space to DeviceN colorants. */
void
rgb_cs_to_devn_cm(gx_device * dev, int * map,
- const gs_imager_state *pis, frac r, frac g, frac b, frac out[])
+ const gs_imager_state *pis, frac r, frac g, frac b, frac out[])
{
int i = dev->color_info.num_components - 1;
frac cmyk[4];
@@ -69,7 +69,7 @@ rgb_cs_to_devn_cm(gx_device * dev, int * map,
/* Convert a CMYK color space to DeviceN colorants. */
void
cmyk_cs_to_devn_cm(gx_device * dev, int * map,
- frac c, frac m, frac y, frac k, frac out[])
+ frac c, frac m, frac y, frac k, frac out[])
{
int i = dev->color_info.num_components - 1;
@@ -102,21 +102,21 @@ int
bpc_to_depth(int ncomp, int bpc)
{
static const byte depths[4][8] = {
- {1, 2, 0, 4, 8, 0, 0, 8},
- {2, 4, 0, 8, 16, 0, 0, 16},
- {4, 8, 0, 16, 16, 0, 0, 24},
- {4, 8, 0, 16, 32, 0, 0, 32}
+ {1, 2, 0, 4, 8, 0, 0, 8},
+ {2, 4, 0, 8, 16, 0, 0, 16},
+ {4, 8, 0, 16, 16, 0, 0, 24},
+ {4, 8, 0, 16, 32, 0, 0, 32}
};
if (ncomp <=4 && bpc <= 8)
return depths[ncomp -1][bpc-1];
else
- return (ncomp * bpc + 7) & 0xf8;
+ return (ncomp * bpc + 7) & 0xf8;
}
#define compare_color_names(name, name_size, str, str_size) \
(name_size == str_size && \
- (strncmp((const char *)name, (const char *)str, name_size) == 0))
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
/*
* This routine will check if a name matches any item in a list of process
@@ -124,17 +124,17 @@ bpc_to_depth(int ncomp, int bpc)
*/
static bool
check_process_color_names(fixed_colorant_names_list plist,
- const gs_param_string * pstring)
+ const gs_param_string * pstring)
{
if (plist) {
uint size = pstring->size;
-
- while( *plist) {
- if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
- return true;
- }
- plist++;
- }
+
+ while( *plist) {
+ if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
+ return true;
+ }
+ plist++;
+ }
}
return false;
}
@@ -154,8 +154,8 @@ check_process_color_names(fixed_colorant_names_list plist,
*/
int
check_pcm_and_separation_names(const gx_device * dev,
- const gs_devn_params * pparams, const char * pname,
- int name_size, int component_type)
+ const gs_devn_params * pparams, const char * pname,
+ int name_size, int component_type)
{
fixed_colorant_name * pcolor = pparams->std_colorant_names;
int color_component_number = 0;
@@ -163,26 +163,26 @@ check_pcm_and_separation_names(const gx_device * dev,
/* Check if the component is in the process color model list. */
if (pcolor) {
- while( *pcolor) {
- if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
- return color_component_number;
- pcolor++;
- color_component_number++;
- }
+ while( *pcolor) {
+ if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
+ return color_component_number;
+ pcolor++;
+ color_component_number++;
+ }
}
/* Check if the component is in the separation names list. */
{
- const gs_separations * separations = &pparams->separations;
- int num_spot = separations->num_separations;
-
- for (i=0; i<num_spot; i++) {
- if (compare_color_names((const char *)separations->names[i].data,
- separations->names[i].size, pname, name_size)) {
- return color_component_number;
- }
- color_component_number++;
- }
+ const gs_separations * separations = &pparams->separations;
+ int num_spot = separations->num_separations;
+
+ for (i=0; i<num_spot; i++) {
+ if (compare_color_names((const char *)separations->names[i].data,
+ separations->names[i].size, pname, name_size)) {
+ return color_component_number;
+ }
+ color_component_number++;
+ }
}
return -1;
@@ -190,7 +190,7 @@ check_pcm_and_separation_names(const gx_device * dev,
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -210,9 +210,9 @@ check_pcm_and_separation_names(const gx_device * dev,
*/
int
devn_get_color_comp_index(gx_device * dev, gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pequiv_colors,
- const char * pname, int name_size, int component_type,
- int auto_spot_colors)
+ equivalent_cmyk_color_params * pequiv_colors,
+ const char * pname, int name_size, int component_type,
+ int auto_spot_colors)
{
int num_order = pdevn_params->num_separation_order_names;
int color_component_number = 0;
@@ -223,25 +223,25 @@ devn_get_color_comp_index(gx_device * dev, gs_devn_params * pdevn_params,
* or in the SeparationNames list.
*/
color_component_number = check_pcm_and_separation_names(dev, pdevn_params,
- pname, name_size, component_type);
+ pname, name_size, component_type);
/* If we have a valid component */
if (color_component_number >= 0) {
/* Check if the component is in the separation order map. */
if (num_order)
- color_component_number =
- pdevn_params->separation_order_map[color_component_number];
- else
- /*
- * We can have more spot colors than we can image. We simply
- * ignore the component (i.e. treat it the same as we would
- * treat a component that is not in the separation order map).
- * Note: Most device do not allow more spot colors than we can
- * image. (See the options for auto_spot_color in gdevdevn.h.)
- */
- if (color_component_number >= dev->color_info.num_components)
- color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
-
+ color_component_number =
+ pdevn_params->separation_order_map[color_component_number];
+ else
+ /*
+ * We can have more spot colors than we can image. We simply
+ * ignore the component (i.e. treat it the same as we would
+ * treat a component that is not in the separation order map).
+ * Note: Most device do not allow more spot colors than we can
+ * image. (See the options for auto_spot_color in gdevdevn.h.)
+ */
+ if (color_component_number >= dev->color_info.num_components)
+ color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
+
return color_component_number;
}
/*
@@ -251,38 +251,38 @@ devn_get_color_comp_index(gx_device * dev, gs_devn_params * pdevn_params,
* already have our complete list of desired spot colorants.
*/
if (component_type != SEPARATION_NAME ||
- auto_spot_colors == NO_AUTO_SPOT_COLORS ||
- pdevn_params->num_separation_order_names != 0)
- return -1; /* Do not add --> indicate colorant unknown. */
+ auto_spot_colors == NO_AUTO_SPOT_COLORS ||
+ pdevn_params->num_separation_order_names != 0)
+ return -1; /* Do not add --> indicate colorant unknown. */
/*
* Check if we have room for another spot colorant.
*/
if (auto_spot_colors == ENABLE_AUTO_SPOT_COLORS)
- max_spot_colors = dev->color_info.num_components -
- pdevn_params->num_std_colorant_names;
+ max_spot_colors = dev->color_info.num_components -
+ pdevn_params->num_std_colorant_names;
if (pdevn_params->separations.num_separations < max_spot_colors) {
- byte * sep_name;
- gs_separations * separations = &pdevn_params->separations;
- int sep_num = separations->num_separations++;
-
- /* We have a new spot colorant - put in stable memory to avoid "restore" */
- sep_name = gs_alloc_bytes(dev->memory->stable_memory,
- name_size, "devn_get_color_comp_index");
- memcpy(sep_name, pname, name_size);
- separations->names[sep_num].size = name_size;
- separations->names[sep_num].data = sep_name;
- color_component_number = sep_num + pdevn_params->num_std_colorant_names;
- if (color_component_number >= dev->color_info.num_components)
- color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
- else
- pdevn_params->separation_order_map[color_component_number] =
- color_component_number;
-
- if (pequiv_colors != NULL) {
- /* Indicate that we need to find equivalent CMYK color. */
- pequiv_colors->color[sep_num].color_info_valid = false;
- pequiv_colors->all_color_info_valid = false;
- }
+ byte * sep_name;
+ gs_separations * separations = &pdevn_params->separations;
+ int sep_num = separations->num_separations++;
+
+ /* We have a new spot colorant - put in stable memory to avoid "restore" */
+ sep_name = gs_alloc_bytes(dev->memory->stable_memory,
+ name_size, "devn_get_color_comp_index");
+ memcpy(sep_name, pname, name_size);
+ separations->names[sep_num].size = name_size;
+ separations->names[sep_num].data = sep_name;
+ color_component_number = sep_num + pdevn_params->num_std_colorant_names;
+ if (color_component_number >= dev->color_info.num_components)
+ color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
+ else
+ pdevn_params->separation_order_map[color_component_number] =
+ color_component_number;
+
+ if (pequiv_colors != NULL) {
+ /* Indicate that we need to find equivalent CMYK color. */
+ pequiv_colors->color[sep_num].color_info_valid = false;
+ pequiv_colors->all_color_info_valid = false;
+ }
}
return color_component_number;
@@ -305,11 +305,11 @@ devn_get_params(gx_device * pdev, gs_param_list * plist,
set_param_array(sona, NULL, 0);
if ( (code = sample_device_crd_get_params(pdev, plist, "CRDDefault")) < 0 ||
- (code =
- param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
- (code = param_write_name_array(plist, "SeparationOrder", &sona)) < 0 ||
- (code = param_write_bool(plist, "Separations", &seprs)) < 0)
- return code;
+ (code =
+ param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
+ (code = param_write_name_array(plist, "SeparationOrder", &sona)) < 0 ||
+ (code = param_write_bool(plist, "Separations", &seprs)) < 0)
+ return code;
return 0;
}
@@ -319,21 +319,21 @@ devn_get_params(gx_device * pdev, gs_param_list * plist,
BEGIN\
switch (code = pread(plist, (param_name = pname), &(pa))) {\
case 0:\
- if ((pa).size != psize) {\
- ecode = gs_note_error(gs_error_rangecheck);\
- (pa).data = 0; /* mark as not filled */\
- } else
+ if ((pa).size != psize) {\
+ ecode = gs_note_error(gs_error_rangecheck);\
+ (pa).data = 0; /* mark as not filled */\
+ } else
#define END_ARRAY_PARAM(pa, e)\
- goto e;\
+ goto e;\
default:\
- ecode = code;\
+ ecode = code;\
e: param_signal_error(plist, param_name, ecode);\
case 1:\
- (pa).data = 0; /* mark as not filled */\
+ (pa).data = 0; /* mark as not filled */\
}\
END
-/*
+/*
* Utility routine for handling DeviceN related parameters. This routine
* may modify the color_info, devn_params, and the equiv_cmyk_colors fields.
*
@@ -357,178 +357,178 @@ devn_put_params(gx_device * pdev, gs_param_list * plist,
/* Get the SeparationOrder names */
BEGIN_ARRAY_PARAM(param_read_name_array, "SeparationOrder",
- sona, sona.size, sone)
+ sona, sona.size, sone)
{
- break;
+ break;
} END_ARRAY_PARAM(sona, sone);
if (sona.data != 0 && sona.size > GX_DEVICE_COLOR_MAX_COMPONENTS)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Get the SeparationColorNames */
BEGIN_ARRAY_PARAM(param_read_name_array, "SeparationColorNames",
- scna, scna.size, scne)
+ scna, scna.size, scne)
{
- break;
+ break;
} END_ARRAY_PARAM(scna, scne);
if (scna.data != 0 && scna.size > GX_DEVICE_MAX_SEPARATIONS)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Separations are only valid with a subrtractive color model */
if (pdev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE) {
/*
* Process the SeparationColorNames. Remove any names that already
- * match the process color model colorant names for the device.
+ * match the process color model colorant names for the device.
*/
if (scna.data != 0) {
- int i;
- int num_names = scna.size;
- fixed_colorant_names_list pcomp_names =
- pdevn_params->std_colorant_names;
-
- for (i = num_spot = 0; i < num_names; i++) {
- /* Verify that the name is not one of our process colorants */
- if (!check_process_color_names(pcomp_names, &scna.data[i])) {
- byte * sep_name;
- int name_size = scna.data[i].size;
-
- /* We have a new separation */
- sep_name = (byte *)gs_alloc_bytes(pdev->memory,
- name_size, "devicen_put_params_no_sep_order");
- memcpy(sep_name, scna.data[i].data, name_size);
- pdevn_params->separations.names[num_spot].size = name_size;
- pdevn_params->separations.names[num_spot].data = sep_name;
- if (pequiv_colors != NULL) {
- /* Indicate that we need to find equivalent CMYK color. */
- pequiv_colors->color[num_spot].color_info_valid = false;
- pequiv_colors->all_color_info_valid = false;
- }
- num_spot++;
- }
- }
- pdevn_params->separations.num_separations = num_spot;
- num_spot_changed = true;
- for (i = 0; i < num_spot + npcmcolors; i++)
- pdevn_params->separation_order_map[i] = i;
+ int i;
+ int num_names = scna.size;
+ fixed_colorant_names_list pcomp_names =
+ pdevn_params->std_colorant_names;
+
+ for (i = num_spot = 0; i < num_names; i++) {
+ /* Verify that the name is not one of our process colorants */
+ if (!check_process_color_names(pcomp_names, &scna.data[i])) {
+ byte * sep_name;
+ int name_size = scna.data[i].size;
+
+ /* We have a new separation */
+ sep_name = (byte *)gs_alloc_bytes(pdev->memory,
+ name_size, "devicen_put_params_no_sep_order");
+ memcpy(sep_name, scna.data[i].data, name_size);
+ pdevn_params->separations.names[num_spot].size = name_size;
+ pdevn_params->separations.names[num_spot].data = sep_name;
+ if (pequiv_colors != NULL) {
+ /* Indicate that we need to find equivalent CMYK color. */
+ pequiv_colors->color[num_spot].color_info_valid = false;
+ pequiv_colors->all_color_info_valid = false;
+ }
+ num_spot++;
+ }
+ }
+ pdevn_params->separations.num_separations = num_spot;
+ num_spot_changed = true;
+ for (i = 0; i < num_spot + npcmcolors; i++)
+ pdevn_params->separation_order_map[i] = i;
}
/*
* Process the SeparationOrder names.
*/
if (sona.data != 0) {
- int i, comp_num;
-
- num_order = sona.size;
- for (i = 0; i < num_spot + npcmcolors; i++)
- pdevn_params->separation_order_map[i] =
- GX_DEVICE_COLOR_MAX_COMPONENTS;
- for (i = 0; i < num_order; i++) {
- /*
- * Check if names match either the process color model or
- * SeparationColorNames. If not then error.
- */
- if ((comp_num = check_pcm_and_separation_names(pdev, pdevn_params,
- (const char *)sona.data[i].data, sona.data[i].size, 0)) < 0) {
- return_error(gs_error_rangecheck);
- }
- pdevn_params->separation_order_map[comp_num] = i;
- }
+ int i, comp_num;
+
+ num_order = sona.size;
+ for (i = 0; i < num_spot + npcmcolors; i++)
+ pdevn_params->separation_order_map[i] =
+ GX_DEVICE_COLOR_MAX_COMPONENTS;
+ for (i = 0; i < num_order; i++) {
+ /*
+ * Check if names match either the process color model or
+ * SeparationColorNames. If not then error.
+ */
+ if ((comp_num = check_pcm_and_separation_names(pdev, pdevn_params,
+ (const char *)sona.data[i].data, sona.data[i].size, 0)) < 0) {
+ return_error(gs_error_rangecheck);
+ }
+ pdevn_params->separation_order_map[comp_num] = i;
+ }
}
/*
* Adobe says that MaxSeparations is supposed to be 'read only'
- * however we use this to allow the specification of the maximum
- * number of separations. Memory is allocated for the specified
- * number of separations. This allows us to then accept separation
- * colors in color spaces even if they we not specified at the start
- * of the image file.
+ * however we use this to allow the specification of the maximum
+ * number of separations. Memory is allocated for the specified
+ * number of separations. This allows us to then accept separation
+ * colors in color spaces even if they we not specified at the start
+ * of the image file.
*/
code = param_read_int(plist, param_name = "MaxSeparations", &max_sep);
switch (code) {
default:
- param_signal_error(plist, param_name, code);
+ param_signal_error(plist, param_name, code);
case 1:
- break;
+ break;
case 0:
- if (max_sep < 1 || max_sep > GX_DEVICE_COLOR_MAX_COMPONENTS)
- return_error(gs_error_rangecheck);
+ if (max_sep < 1 || max_sep > GX_DEVICE_COLOR_MAX_COMPONENTS)
+ return_error(gs_error_rangecheck);
}
/*
* The PDF interpreter scans the resources for pages to try to
- * determine the number of spot colors. (Unfortuneately there is
- * no way to determine the number of spot colors for a PS page
- * except to interpret the entire page.) The spot color count for
- * a PDF page may be high since there may be spot colors in a PDF
- * page's resources that are not used. However this does give us
- * an upper limit on the number of spot colors. A value of -1
- * indicates that the number of spot colors in unknown (a PS file).
+ * determine the number of spot colors. (Unfortuneately there is
+ * no way to determine the number of spot colors for a PS page
+ * except to interpret the entire page.) The spot color count for
+ * a PDF page may be high since there may be spot colors in a PDF
+ * page's resources that are not used. However this does give us
+ * an upper limit on the number of spot colors. A value of -1
+ * indicates that the number of spot colors in unknown (a PS file).
*/
code = param_read_int(plist, param_name = "PageSpotColors",
- &page_spot_colors);
+ &page_spot_colors);
switch (code) {
default:
- param_signal_error(plist, param_name, code);
+ param_signal_error(plist, param_name, code);
case 1:
- break;
+ break;
case 0:
- if (page_spot_colors < -1)
- return_error(gs_error_rangecheck);
- if (page_spot_colors > GX_DEVICE_COLOR_MAX_COMPONENTS - MAX_DEVICE_PROCESS_COLORS)
- page_spot_colors = GX_DEVICE_COLOR_MAX_COMPONENTS - MAX_DEVICE_PROCESS_COLORS;
+ if (page_spot_colors < -1)
+ return_error(gs_error_rangecheck);
+ if (page_spot_colors > GX_DEVICE_COLOR_MAX_COMPONENTS - MAX_DEVICE_PROCESS_COLORS)
+ page_spot_colors = GX_DEVICE_COLOR_MAX_COMPONENTS - MAX_DEVICE_PROCESS_COLORS;
/* Need to leave room for the process colors in GX_DEVICE_COLOR_MAX_COMPONENTS */
}
- /*
+ /*
* The DeviceN device can have zero components if nothing has been
- * specified. This causes some problems so force at least one
- * component until something is specified.
+ * specified. This causes some problems so force at least one
+ * component until something is specified.
*/
if (!pdev->color_info.num_components)
- pdev->color_info.num_components = 1;
- /*
- * Update the number of device components if we have changes in
- * SeparationColorNames, SeparationOrder, or MaxSeparations.
- */
- if (num_spot_changed || pdevn_params->max_separations != max_sep ||
- pdevn_params->num_separation_order_names != num_order ||
- pdevn_params->page_spot_colors != page_spot_colors) {
- pdevn_params->separations.num_separations = num_spot;
- pdevn_params->num_separation_order_names = num_order;
- pdevn_params->max_separations = max_sep;
- pdevn_params->page_spot_colors = page_spot_colors;
- if (max_sep != 0)
- pdev->color_info.max_components = max_sep;
- /*
- * If we have SeparationOrder specified then the number of
- * components is given by the number of names in the list.
- * Otherwise check if the MaxSeparations parameter has specified
- * a value. If so then use that value, otherwise use the number
- * of ProcessColorModel components plus the number of
- * SeparationColorNames is used.
- */
+ pdev->color_info.num_components = 1;
+ /*
+ * Update the number of device components if we have changes in
+ * SeparationColorNames, SeparationOrder, or MaxSeparations.
+ */
+ if (num_spot_changed || pdevn_params->max_separations != max_sep ||
+ pdevn_params->num_separation_order_names != num_order ||
+ pdevn_params->page_spot_colors != page_spot_colors) {
+ pdevn_params->separations.num_separations = num_spot;
+ pdevn_params->num_separation_order_names = num_order;
+ pdevn_params->max_separations = max_sep;
+ pdevn_params->page_spot_colors = page_spot_colors;
+ if (max_sep != 0)
+ pdev->color_info.max_components = max_sep;
+ /*
+ * If we have SeparationOrder specified then the number of
+ * components is given by the number of names in the list.
+ * Otherwise check if the MaxSeparations parameter has specified
+ * a value. If so then use that value, otherwise use the number
+ * of ProcessColorModel components plus the number of
+ * SeparationColorNames is used.
+ */
pdev->color_info.num_components = (num_order)
- ? num_order
- : (pdevn_params->max_separations)
- ? pdevn_params->max_separations
- : (page_spot_colors >= 0)
- ? npcmcolors + num_spot + page_spot_colors
- : pdev->color_info.max_components;
+ ? num_order
+ : (pdevn_params->max_separations)
+ ? pdevn_params->max_separations
+ : (page_spot_colors >= 0)
+ ? npcmcolors + num_spot + page_spot_colors
+ : pdev->color_info.max_components;
if (pdev->color_info.num_components >
- pdev->color_info.max_components)
+ pdev->color_info.max_components)
pdev->color_info.num_components =
- pdev->color_info.max_components;
+ pdev->color_info.max_components;
#if !USE_COMPRESSED_ENCODING
- /*
- * See earlier comment about the depth and non compressed
- * pixel encoding.
- */
- pdev->color_info.depth = bpc_to_depth(pdev->color_info.num_components,
- pdevn_params->bitspercomponent);
+ /*
+ * See earlier comment about the depth and non compressed
+ * pixel encoding.
+ */
+ pdev->color_info.depth = bpc_to_depth(pdev->color_info.num_components,
+ pdevn_params->bitspercomponent);
#endif
- }
+ }
}
return code;
}
/* A self referencing function to copy the color list */
static int
-copy_color_list(compressed_color_list_t *src_color_list,
+copy_color_list(compressed_color_list_t *src_color_list,
compressed_color_list_t *des_color_list, gs_memory_t *memory)
{
int k;
@@ -536,22 +536,22 @@ copy_color_list(compressed_color_list_t *src_color_list,
if (num_sub_levels > 0) {
for (k = 0; k < num_sub_levels; k++) {
- des_color_list->u.sub_level_ptrs[k] =
+ des_color_list->u.sub_level_ptrs[k] =
alloc_compressed_color_list_elem(memory,
des_color_list->level_num_comp - 1);
if (des_color_list->u.sub_level_ptrs[k] == NULL) {
return gs_rethrow(-1, "copy_color_list allocation error");
}
- des_color_list->u.sub_level_ptrs[k]->first_bit_map =
+ des_color_list->u.sub_level_ptrs[k]->first_bit_map =
src_color_list->u.sub_level_ptrs[k]->first_bit_map;
- des_color_list->u.sub_level_ptrs[k]->num_sub_level_ptrs =
+ des_color_list->u.sub_level_ptrs[k]->num_sub_level_ptrs =
src_color_list->u.sub_level_ptrs[k]->num_sub_level_ptrs;
- copy_color_list(src_color_list->u.sub_level_ptrs[k],
+ copy_color_list(src_color_list->u.sub_level_ptrs[k],
des_color_list->u.sub_level_ptrs[k], memory);
}
} else {
/* Allocate and copy the data */
- memcpy(&(des_color_list->u.comp_data[0]),
+ memcpy(&(des_color_list->u.comp_data[0]),
&(src_color_list->u.comp_data[0]),
size_of(comp_bit_map_list_t)*NUM_ENCODE_LIST_ITEMS);
}
@@ -569,18 +569,18 @@ devn_free_params(gx_device *thread_cdev)
if (devn_params == NULL) return;
for (k = 0; k < devn_params->separations.num_separations; k++) {
- gs_free_object(thread_cdev->memory,
+ gs_free_object(thread_cdev->memory,
devn_params->separations.names[k].data,
"devn_free_params");
}
- free_compressed_color_list(thread_cdev->memory,
+ free_compressed_color_list(thread_cdev->memory,
devn_params->compressed_color_list);
for (k = 0; k < devn_params->pdf14_separations.num_separations; k++) {
- gs_free_object(thread_cdev->memory,
+ gs_free_object(thread_cdev->memory,
devn_params->pdf14_separations.names[k].data,
"devn_free_params");
}
- free_compressed_color_list(thread_cdev->memory,
+ free_compressed_color_list(thread_cdev->memory,
devn_params->pdf14_compressed_color_list);
}
@@ -600,34 +600,34 @@ devn_copy_params(gx_device * psrcdev, gx_device * pdesdev)
/* First the easy items */
des_devn_params->bitspercomponent = src_devn_params->bitspercomponent;
des_devn_params->max_separations = src_devn_params->max_separations;
- des_devn_params->num_separation_order_names =
+ des_devn_params->num_separation_order_names =
src_devn_params->num_separation_order_names;
- des_devn_params->num_std_colorant_names =
+ des_devn_params->num_std_colorant_names =
src_devn_params->num_std_colorant_names;
des_devn_params->page_spot_colors = src_devn_params->page_spot_colors;
des_devn_params->std_colorant_names = src_devn_params->std_colorant_names;
- des_devn_params->separations.num_separations
- = src_devn_params->separations.num_separations;
+ des_devn_params->separations.num_separations
+ = src_devn_params->separations.num_separations;
/* Now the more complex structures */
/* Spot color names */
for (k = 0; k < des_devn_params->separations.num_separations; k++) {
byte * sep_name;
int name_size = src_devn_params->separations.names[k].size;
- sep_name = (byte *)gs_alloc_bytes(pdesdev->memory->stable_memory,
+ sep_name = (byte *)gs_alloc_bytes(pdesdev->memory->stable_memory,
name_size, "devn_copy_params");
memcpy(sep_name, src_devn_params->separations.names[k].data, name_size);
des_devn_params->separations.names[k].size = name_size;
des_devn_params->separations.names[k].data = sep_name;
}
/* Order map */
- memcpy(des_devn_params->separation_order_map,
+ memcpy(des_devn_params->separation_order_map,
src_devn_params->separation_order_map, sizeof(gs_separation_map));
- /* Compressed color list. A messy structure that has a union that
+ /* Compressed color list. A messy structure that has a union that
includes a linked list item */
src_color_list = src_devn_params->compressed_color_list;
if (src_color_list != NULL) {
/* Take care of the initial one. Others are done recursively */
- des_color_list = alloc_compressed_color_list_elem(pdesdev->memory,
+ des_color_list = alloc_compressed_color_list_elem(pdesdev->memory,
TOP_ENCODED_LEVEL);
des_color_list->first_bit_map = src_color_list->first_bit_map;
des_color_list->num_sub_level_ptrs = src_color_list->num_sub_level_ptrs;
@@ -637,14 +637,14 @@ devn_copy_params(gx_device * psrcdev, gx_device * pdesdev)
des_devn_params->compressed_color_list = NULL;
}
/* Handle the PDF14 items if they are there */
- des_devn_params->pdf14_separations.num_separations
- = src_devn_params->pdf14_separations.num_separations;
+ des_devn_params->pdf14_separations.num_separations
+ = src_devn_params->pdf14_separations.num_separations;
for (k = 0; k < des_devn_params->pdf14_separations.num_separations; k++) {
byte * sep_name;
int name_size = src_devn_params->pdf14_separations.names[k].size;
- sep_name = (byte *)gs_alloc_bytes(pdesdev->memory->stable_memory,
+ sep_name = (byte *)gs_alloc_bytes(pdesdev->memory->stable_memory,
name_size, "devn_copy_params");
- memcpy(sep_name, src_devn_params->pdf14_separations.names[k].data,
+ memcpy(sep_name, src_devn_params->pdf14_separations.names[k].data,
name_size);
des_devn_params->pdf14_separations.names[k].size = name_size;
des_devn_params->pdf14_separations.names[k].data = sep_name;
@@ -652,7 +652,7 @@ devn_copy_params(gx_device * psrcdev, gx_device * pdesdev)
src_color_list = src_devn_params->pdf14_compressed_color_list;
if (src_color_list != NULL) {
/* Take care of the initial one. Others are done recursively */
- des_color_list = alloc_compressed_color_list_elem(pdesdev->memory,
+ des_color_list = alloc_compressed_color_list_elem(pdesdev->memory,
TOP_ENCODED_LEVEL);
des_color_list->first_bit_map = src_color_list->first_bit_map;
des_color_list->num_sub_level_ptrs = src_color_list->num_sub_level_ptrs;
@@ -690,23 +690,23 @@ devn_printer_put_params(gx_device * pdev, gs_param_list * plist,
/* If we have an error then restore original data. */
if (code < 0) {
- pdev->color_info = save_info;
- *pdevn_params = saved_devn_params;
- if (pequiv_colors != NULL)
- *pequiv_colors = saved_equiv_colors;
- return code;
+ pdev->color_info = save_info;
+ *pdevn_params = saved_devn_params;
+ if (pequiv_colors != NULL)
+ *pequiv_colors = saved_equiv_colors;
+ return code;
}
/* If anything changed, then close the device, etc. */
if (memcmp(&pdev->color_info, &save_info, sizeof(gx_device_color_info)) ||
- memcmp(pdevn_params, &saved_devn_params,
- sizeof(gs_devn_params)) ||
- (pequiv_colors != NULL &&
- memcmp(pequiv_colors, &saved_equiv_colors,
- sizeof(equivalent_cmyk_color_params)))) {
- gs_closedevice(pdev);
+ memcmp(pdevn_params, &saved_devn_params,
+ sizeof(gs_devn_params)) ||
+ (pequiv_colors != NULL &&
+ memcmp(pequiv_colors, &saved_equiv_colors,
+ sizeof(equivalent_cmyk_color_params)))) {
+ gs_closedevice(pdev);
/* Reset the sparable and linear shift, masks, bits. */
- set_linear_color_bits_mask_shift(pdev);
+ set_linear_color_bits_mask_shift(pdev);
}
/*
* Also check for parameters which are being passed from the PDF 1.4
@@ -732,11 +732,11 @@ devn_printer_put_params(gx_device * pdev, gs_param_list * plist,
*/
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(compressed_color_list_enum_ptrs, compressed_color_list_t *plist)
{
if (index < plist->num_sub_level_ptrs)
- ENUM_RETURN(plist->u.sub_level_ptrs[index]);
+ ENUM_RETURN(plist->u.sub_level_ptrs[index]);
return 0;
}
ENUM_PTRS_END
@@ -746,14 +746,14 @@ static RELOC_PTRS_WITH(compressed_color_list_reloc_ptrs, compressed_color_list_t
int i;
for (i = 0; i < plist->num_sub_level_ptrs; i++) {
- RELOC_PTR(compressed_color_list_t, u.sub_level_ptrs[i]);
+ RELOC_PTR(compressed_color_list_t, u.sub_level_ptrs[i]);
}
}
RELOC_PTRS_END
gs_private_st_composite(st_compressed_color_list, compressed_color_list_t,
- "encode color list", compressed_color_list_enum_ptrs,
- compressed_color_list_reloc_ptrs);
+ "encode color list", compressed_color_list_enum_ptrs,
+ compressed_color_list_reloc_ptrs);
/*
* A routine for debugging the encoded color colorant list. This routine
* dumps the contents of the list.
@@ -765,35 +765,35 @@ print_compressed_color_list(compressed_color_list_t * pcomp_list, int num_comp)
comp_bit_map_list_t * pcomp_bit_map;
if (pcomp_list == NULL)
- return;
+ return;
/* Indent our print out for sub levels */
for (i = TOP_ENCODED_LEVEL - pcomp_list->level_num_comp; i > 0; i--)
- dlprintf(" ");
+ dlprintf(" ");
dlprintf1("List level = %d\n", pcomp_list->level_num_comp);
/*
* Print the colorant bit maps for this level.
*/
for (i = NUM_ENCODE_LIST_ITEMS - 1; i >= pcomp_list->first_bit_map; i--) {
- pcomp_bit_map = &(pcomp_list->u.comp_data[i]);
+ pcomp_bit_map = &(pcomp_list->u.comp_data[i]);
/* Indent our print out for sub levels */
for (j = TOP_ENCODED_LEVEL - pcomp_list->level_num_comp; j > 0; j--)
- dlprintf(" ");
+ dlprintf(" ");
dlprintf4("%3d%4d%4d %d ", i, pcomp_bit_map->num_comp,
- pcomp_bit_map->num_non_solid_comp, pcomp_bit_map->solid_not_100);
- for (comp_num = num_comp - 1; comp_num >= 0; comp_num--) {
- comp = colorant_present(pcomp_bit_map, colorants, comp_num);
+ pcomp_bit_map->num_non_solid_comp, pcomp_bit_map->solid_not_100);
+ for (comp_num = num_comp - 1; comp_num >= 0; comp_num--) {
+ comp = colorant_present(pcomp_bit_map, colorants, comp_num);
dlprintf1("%d", comp);
- if ((comp_num & 7) == 0) /* Separate into groups of 8 bits */
+ if ((comp_num & 7) == 0) /* Separate into groups of 8 bits */
dlprintf(" ");
- }
+ }
dlprintf(" ");
- for (comp_num = num_comp - 1; comp_num >= 0; comp_num--) {
- comp = colorant_present(pcomp_bit_map, solid_colorants, comp_num);
+ for (comp_num = num_comp - 1; comp_num >= 0; comp_num--) {
+ comp = colorant_present(pcomp_bit_map, solid_colorants, comp_num);
dlprintf1("%d", comp);
- if ((comp_num & 7) == 0) /* Separate into groups of 8 bits */
+ if ((comp_num & 7) == 0) /* Separate into groups of 8 bits */
dlprintf(" ");
- }
+ }
dlprintf("\n");
}
@@ -809,17 +809,17 @@ print_compressed_color_list(compressed_color_list_t * pcomp_list, int num_comp)
/*
* Allocate an list level element for our encode color list.
*/
-compressed_color_list_t *
+compressed_color_list_t *
alloc_compressed_color_list_elem(gs_memory_t * mem, int num_comps)
{
compressed_color_list_t * plist =
- gs_alloc_struct(mem->stable_memory, compressed_color_list_t,
+ gs_alloc_struct(mem->stable_memory, compressed_color_list_t,
&st_compressed_color_list, "alloc_compressed_color_list");
if (plist != NULL) {
- /* Initialize the data in the element. */
- memset(plist, 0, size_of(*plist));
- plist->level_num_comp = num_comps;
- plist->first_bit_map = NUM_ENCODE_LIST_ITEMS;
+ /* Initialize the data in the element. */
+ memset(plist, 0, size_of(*plist));
+ plist->level_num_comp = num_comps;
+ plist->first_bit_map = NUM_ENCODE_LIST_ITEMS;
}
return plist;
}
@@ -829,18 +829,18 @@ alloc_compressed_color_list_elem(gs_memory_t * mem, int num_comps)
*/
void
free_compressed_color_list(gs_memory_t * mem,
- compressed_color_list_t * pcomp_list)
+ compressed_color_list_t * pcomp_list)
{
int i;
if (pcomp_list == NULL)
- return;
+ return;
/* Discard the sub levels. */
/* Allocation for this object is done in stable memory. Make sure
that is done here too */
for (i = 0; i < pcomp_list->num_sub_level_ptrs; i++)
- free_compressed_color_list(mem->stable_memory,
+ free_compressed_color_list(mem->stable_memory,
pcomp_list->u.sub_level_ptrs[i]);
gs_free_object(mem->stable_memory, pcomp_list, "free_compressed_color_list");
return;
@@ -851,14 +851,14 @@ free_compressed_color_list(gs_memory_t * mem,
*/
void
free_separation_names(gs_memory_t * mem,
- gs_separations * pseparation)
+ gs_separations * pseparation)
{
int i;
/* Discard the sub levels. */
for (i = 0; i < pseparation->num_separations; i++)
gs_free_object(mem->stable_memory, pseparation->names[i].data,
- "free_separation_names");
+ "free_separation_names");
pseparation->num_separations = 0;
return;
}
@@ -869,8 +869,8 @@ free_separation_names(gs_memory_t * mem,
*/
static bool
sub_level_add_compressed_color_list(gs_memory_t * mem,
- comp_bit_map_list_t * pnew_comp_bit_map,
- compressed_color_list_t * pcomp_list, gx_color_index * plist_index)
+ comp_bit_map_list_t * pnew_comp_bit_map,
+ compressed_color_list_t * pcomp_list, gx_color_index * plist_index)
{
int i, entry_num;
int num_non_solid_comp = pnew_comp_bit_map->num_non_solid_comp;
@@ -881,29 +881,29 @@ sub_level_add_compressed_color_list(gs_memory_t * mem,
* then add the bit map to this level (if we have room).
*/
if (num_non_solid_comp >= pcomp_list->level_num_comp) {
- entry_num = pcomp_list->first_bit_map - 1;
-
- if (entry_num > pcomp_list->num_sub_level_ptrs) {
- memcpy(&(pcomp_list->u.comp_data[entry_num]), pnew_comp_bit_map,
- size_of(comp_bit_map_list_t));
- pcomp_list->first_bit_map = entry_num;
- *plist_index =
- ((gx_color_index) entry_num) << (NUM_GX_COLOR_INDEX_BITS - 8);
- return true;
- }
- return false;
+ entry_num = pcomp_list->first_bit_map - 1;
+
+ if (entry_num > pcomp_list->num_sub_level_ptrs) {
+ memcpy(&(pcomp_list->u.comp_data[entry_num]), pnew_comp_bit_map,
+ size_of(comp_bit_map_list_t));
+ pcomp_list->first_bit_map = entry_num;
+ *plist_index =
+ ((gx_color_index) entry_num) << (NUM_GX_COLOR_INDEX_BITS - 8);
+ return true;
+ }
+ return false;
}
/*
* Try to insert the bit map into the sub levels.
*/
for (i = 0; i < pcomp_list->num_sub_level_ptrs; i++) {
- status = sub_level_add_compressed_color_list(mem, pnew_comp_bit_map,
- pcomp_list->u.sub_level_ptrs[i], plist_index);
- if (status) {
- *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
- + (*plist_index >> 8);
- return true;
- }
+ status = sub_level_add_compressed_color_list(mem, pnew_comp_bit_map,
+ pcomp_list->u.sub_level_ptrs[i], plist_index);
+ if (status) {
+ *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
+ + (*plist_index >> 8);
+ return true;
+ }
}
/*
* If we did not add this bit map into a sub level then create a new sub
@@ -911,18 +911,18 @@ sub_level_add_compressed_color_list(gs_memory_t * mem,
*/
entry_num = pcomp_list->num_sub_level_ptrs;
if (entry_num < pcomp_list->first_bit_map) {
- pcomp_list->u.sub_level_ptrs[entry_num] =
- alloc_compressed_color_list_elem(mem, pcomp_list->level_num_comp - 1);
- if (pcomp_list->u.sub_level_ptrs[entry_num] != NULL) {
- pcomp_list->num_sub_level_ptrs++;
- status = sub_level_add_compressed_color_list(mem, pnew_comp_bit_map,
- pcomp_list->u.sub_level_ptrs[entry_num], plist_index);
- if (status) {
- *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
- + (*plist_index >> 8);
- return true;
- }
- }
+ pcomp_list->u.sub_level_ptrs[entry_num] =
+ alloc_compressed_color_list_elem(mem, pcomp_list->level_num_comp - 1);
+ if (pcomp_list->u.sub_level_ptrs[entry_num] != NULL) {
+ pcomp_list->num_sub_level_ptrs++;
+ status = sub_level_add_compressed_color_list(mem, pnew_comp_bit_map,
+ pcomp_list->u.sub_level_ptrs[entry_num], plist_index);
+ if (status) {
+ *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
+ + (*plist_index >> 8);
+ return true;
+ }
+ }
}
/*
* If we get to here then there was no space available in this list element.
@@ -944,8 +944,8 @@ sub_level_add_compressed_color_list(gs_memory_t * mem,
*/
static bool
add_compressed_color_list(gs_memory_t * mem,
- comp_bit_map_list_t * pnew_comp_bit_map,
- compressed_color_list_t * pcomp_list, gx_color_index * plist_index)
+ comp_bit_map_list_t * pnew_comp_bit_map,
+ compressed_color_list_t * pcomp_list, gx_color_index * plist_index)
{
int num_comp = pnew_comp_bit_map->num_comp;
int num_non_solid = pnew_comp_bit_map->num_non_solid_comp;
@@ -957,31 +957,31 @@ add_compressed_color_list(gs_memory_t * mem,
* the solid colorants to using the non solid encodings.
*/
while (num_non_solid < MIN_ENCODED_COMPONENTS && num_solid > 0) {
- if (colorant_present(pnew_comp_bit_map, solid_colorants, comp_num)) {
- clear_colorant_present(pnew_comp_bit_map,
- solid_colorants, comp_num);
- num_solid--;
- num_non_solid++;
- }
- comp_num++;
+ if (colorant_present(pnew_comp_bit_map, solid_colorants, comp_num)) {
+ clear_colorant_present(pnew_comp_bit_map,
+ solid_colorants, comp_num);
+ num_solid--;
+ num_non_solid++;
+ }
+ comp_num++;
}
if (num_non_solid < MIN_ENCODED_COMPONENTS) {
/*
- * For small numbers of colorants, we add more colorants to try to
- * create an entry that can be used for more situations.
+ * For small numbers of colorants, we add more colorants to try to
+ * create an entry that can be used for more situations.
*/
- for (comp_num = 0; num_comp < MIN_ENCODED_COMPONENTS; comp_num++) {
- if ((colorant_present(pnew_comp_bit_map, colorants, comp_num)) == 0) {
- set_colorant_present(pnew_comp_bit_map, colorants, comp_num);
- num_non_solid++;
- num_comp++;
- }
- }
+ for (comp_num = 0; num_comp < MIN_ENCODED_COMPONENTS; comp_num++) {
+ if ((colorant_present(pnew_comp_bit_map, colorants, comp_num)) == 0) {
+ set_colorant_present(pnew_comp_bit_map, colorants, comp_num);
+ num_non_solid++;
+ num_comp++;
+ }
+ }
}
pnew_comp_bit_map->num_comp = num_comp;
pnew_comp_bit_map->num_non_solid_comp = num_non_solid;
return sub_level_add_compressed_color_list(mem, pnew_comp_bit_map,
- pcomp_list, plist_index);
+ pcomp_list, plist_index);
}
/*
@@ -991,14 +991,14 @@ add_compressed_color_list(gs_memory_t * mem,
* colors (or less) and no process colors. These are placed at the start of
* the list to minimize the add and search times for these common situations.
*/
-static compressed_color_list_t *
+static compressed_color_list_t *
init_compressed_color_list(gs_memory_t *mem)
{
/*
* Create our first list element.
*/
compressed_color_list_t * plist =
- alloc_compressed_color_list_elem(mem, TOP_ENCODED_LEVEL);
+ alloc_compressed_color_list_elem(mem, TOP_ENCODED_LEVEL);
/*
* Add a first colorant bit map to the list. This bit map covers the first
@@ -1006,34 +1006,34 @@ init_compressed_color_list(gs_memory_t *mem)
* first three spot colors. This bit map should handle many situations.
*/
if (plist != NULL) {
- int comp_num;
+ int comp_num;
comp_bit_map_list_t comp_bit_map;
- gx_color_index temp;
+ gx_color_index temp;
/*
* Add a first colorant bit map to the list. This bit map covers the
- * first TOP_ENCODED_LEVEL colorants. Typically this covers CMYK plus
- * the first three spot colors. This bit map should handle many
- * situations.
+ * first TOP_ENCODED_LEVEL colorants. Typically this covers CMYK plus
+ * the first three spot colors. This bit map should handle many
+ * situations.
*/
- memset(&comp_bit_map, 0, size_of(comp_bit_map));
- for (comp_num = 0; comp_num < TOP_ENCODED_LEVEL; comp_num++)
- set_colorant_present(&comp_bit_map, colorants, comp_num);
- comp_bit_map.num_comp =
- comp_bit_map.num_non_solid_comp = TOP_ENCODED_LEVEL;
- add_compressed_color_list(mem, &comp_bit_map, plist, &temp);
+ memset(&comp_bit_map, 0, size_of(comp_bit_map));
+ for (comp_num = 0; comp_num < TOP_ENCODED_LEVEL; comp_num++)
+ set_colorant_present(&comp_bit_map, colorants, comp_num);
+ comp_bit_map.num_comp =
+ comp_bit_map.num_non_solid_comp = TOP_ENCODED_LEVEL;
+ add_compressed_color_list(mem, &comp_bit_map, plist, &temp);
/*
* Add a second colorant bit map to the list. This bit map covers the
- * first TOP_ENCODED_LEVEL colorants after the first four colorants.
- * Typically this covers the first seven spot colors. This bit map is
- * being placed to cover images that use only spot colors.
+ * first TOP_ENCODED_LEVEL colorants after the first four colorants.
+ * Typically this covers the first seven spot colors. This bit map is
+ * being placed to cover images that use only spot colors.
*/
- memset(&comp_bit_map, 0, size_of(comp_bit_map));
- for (comp_num = 4; comp_num < TOP_ENCODED_LEVEL + 4; comp_num++)
- set_colorant_present(&comp_bit_map, colorants, comp_num);
- comp_bit_map.num_comp =
- comp_bit_map.num_non_solid_comp = TOP_ENCODED_LEVEL;
- add_compressed_color_list(mem, &comp_bit_map, plist, &temp);
+ memset(&comp_bit_map, 0, size_of(comp_bit_map));
+ for (comp_num = 4; comp_num < TOP_ENCODED_LEVEL + 4; comp_num++)
+ set_colorant_present(&comp_bit_map, colorants, comp_num);
+ comp_bit_map.num_comp =
+ comp_bit_map.num_non_solid_comp = TOP_ENCODED_LEVEL;
+ add_compressed_color_list(mem, &comp_bit_map, plist, &temp);
}
return plist;
}
@@ -1046,21 +1046,21 @@ init_compressed_color_list(gs_memory_t *mem)
* must fit into a gx_color_index value.
*/
int num_comp_bits[MAX_ENCODED_COMPONENTS + 1] = {
- 8, /* 0 colorants - not used */
- 8, /* 1 colorants */
- 8, /* 2 colorants */
- 8, /* 3 colorants */
- 8, /* 4 colorants */
- 8, /* 5 colorants */
- 8, /* 6 colorants */
- 8, /* 7 colorants */
- 7, /* 8 colorants */
- 6, /* 9 colorants */
- 5, /* 10 colorants */
- 5, /* 11 colorants */
- 4, /* 12 colorants */
- 4, /* 13 colorants */
- 4 /* 14 colorants */
+ 8, /* 0 colorants - not used */
+ 8, /* 1 colorants */
+ 8, /* 2 colorants */
+ 8, /* 3 colorants */
+ 8, /* 4 colorants */
+ 8, /* 5 colorants */
+ 8, /* 6 colorants */
+ 8, /* 7 colorants */
+ 7, /* 8 colorants */
+ 6, /* 9 colorants */
+ 5, /* 10 colorants */
+ 5, /* 11 colorants */
+ 4, /* 12 colorants */
+ 4, /* 13 colorants */
+ 4 /* 14 colorants */
};
/*
@@ -1074,21 +1074,21 @@ int num_comp_bits[MAX_ENCODED_COMPONENTS + 1] = {
((gx_max_color_value << 8) + 0xff) / ((1 << num_bits) - 1)
int comp_bit_factor[MAX_ENCODED_COMPONENTS + 1] = {
- gx_color_value_factor(8), /* 0 colorants (8 bits) */
- gx_color_value_factor(8), /* 1 colorants (8 bits) */
- gx_color_value_factor(8), /* 2 colorants (8 bits) */
- gx_color_value_factor(8), /* 3 colorants (8 bits) */
- gx_color_value_factor(8), /* 4 colorants (8 bits) */
- gx_color_value_factor(8), /* 5 colorants (8 bits) */
- gx_color_value_factor(8), /* 6 colorants (8 bits) */
- gx_color_value_factor(8), /* 7 colorants (8 bits) */
- gx_color_value_factor(7), /* 8 colorants (7 bits) */
- gx_color_value_factor(6), /* 9 colorants (6 bits) */
- gx_color_value_factor(5), /* 10 colorants (5 bits) */
- gx_color_value_factor(5), /* 11 colorants (5 bits) */
- gx_color_value_factor(4), /* 12 colorants (4 bits) */
- gx_color_value_factor(4), /* 13 colorants (4 bits) */
- gx_color_value_factor(4) /* 14 colorants (4 bits) */
+ gx_color_value_factor(8), /* 0 colorants (8 bits) */
+ gx_color_value_factor(8), /* 1 colorants (8 bits) */
+ gx_color_value_factor(8), /* 2 colorants (8 bits) */
+ gx_color_value_factor(8), /* 3 colorants (8 bits) */
+ gx_color_value_factor(8), /* 4 colorants (8 bits) */
+ gx_color_value_factor(8), /* 5 colorants (8 bits) */
+ gx_color_value_factor(8), /* 6 colorants (8 bits) */
+ gx_color_value_factor(8), /* 7 colorants (8 bits) */
+ gx_color_value_factor(7), /* 8 colorants (7 bits) */
+ gx_color_value_factor(6), /* 9 colorants (6 bits) */
+ gx_color_value_factor(5), /* 10 colorants (5 bits) */
+ gx_color_value_factor(5), /* 11 colorants (5 bits) */
+ gx_color_value_factor(4), /* 12 colorants (4 bits) */
+ gx_color_value_factor(4), /* 13 colorants (4 bits) */
+ gx_color_value_factor(4) /* 14 colorants (4 bits) */
};
#undef gx_color_value_factor
@@ -1109,8 +1109,8 @@ int comp_bit_factor[MAX_ENCODED_COMPONENTS + 1] = {
*/
static bool
search_compressed_color_list(int num_comp, compressed_color_list_t * pcomp_list,
- comp_bit_map_list_t * pnew_comp_bit_map, gx_color_index * plist_index,
- comp_bit_map_list_t * * pcomp_bit_map)
+ comp_bit_map_list_t * pnew_comp_bit_map, gx_color_index * plist_index,
+ comp_bit_map_list_t * * pcomp_bit_map)
{
int i;
#if DEVN_ENCODE_COLOR_USING_BIT_MAP_ARRAY
@@ -1123,60 +1123,60 @@ search_compressed_color_list(int num_comp, compressed_color_list_t * pcomp_list,
*/
#if DEVN_ENCODE_COLOR_USING_BIT_MAP_ARRAY
num_bit_map_elem = (num_comp + BITS_PER_COMP_BIT_MAP_ELEM - 1) /
- BITS_PER_COMP_BIT_MAP_ELEM;
+ BITS_PER_COMP_BIT_MAP_ELEM;
#endif
for (i = NUM_ENCODE_LIST_ITEMS - 1; i >= pcomp_list->first_bit_map; i--) {
- *pcomp_bit_map = &(pcomp_list->u.comp_data[i]);
- /*
- * Do not try to match if one entry uses a 'solid' set of colorants
- * that is not really solid (i.e. not 100%) and the other is. It is
- * possible to work if different but it would make some of the logic
- * more difficult.
- */
- if (pnew_comp_bit_map->solid_not_100 !=
- (*pcomp_bit_map)->solid_not_100)
- continue;
+ *pcomp_bit_map = &(pcomp_list->u.comp_data[i]);
+ /*
+ * Do not try to match if one entry uses a 'solid' set of colorants
+ * that is not really solid (i.e. not 100%) and the other is. It is
+ * possible to work if different but it would make some of the logic
+ * more difficult.
+ */
+ if (pnew_comp_bit_map->solid_not_100 !=
+ (*pcomp_bit_map)->solid_not_100)
+ continue;
/*
* It is a match if the new colorant bit map is a subset of the one
- * in the list and the solid colorants for new map is a super set of
- * the solid colorants for the one in the list. I.e. we can use
- * the non solid part of the entry for either zero or solid colorants.
+ * in the list and the solid colorants for new map is a super set of
+ * the solid colorants for the one in the list. I.e. we can use
+ * the non solid part of the entry for either zero or solid colorants.
*/
#if DEVN_ENCODE_COLOR_USING_BIT_MAP_ARRAY
- for (j = 0; j < num_bit_map_elem; j++) {
- if ((pnew_comp_bit_map->colorants[j] &
- (*pcomp_bit_map)->colorants[j]) !=
- pnew_comp_bit_map->colorants[j])
- break; /* No match if a colorant is missing. */
- if ((pnew_comp_bit_map->solid_colorants[j] &
- (*pcomp_bit_map)->solid_colorants[j]) !=
- (*pcomp_bit_map)->solid_colorants[j])
- break; /* No match if extra solid colorants */
- }
- if (j == num_bit_map_elem) {
+ for (j = 0; j < num_bit_map_elem; j++) {
+ if ((pnew_comp_bit_map->colorants[j] &
+ (*pcomp_bit_map)->colorants[j]) !=
+ pnew_comp_bit_map->colorants[j])
+ break; /* No match if a colorant is missing. */
+ if ((pnew_comp_bit_map->solid_colorants[j] &
+ (*pcomp_bit_map)->solid_colorants[j]) !=
+ (*pcomp_bit_map)->solid_colorants[j])
+ break; /* No match if extra solid colorants */
+ }
+ if (j == num_bit_map_elem) {
#else
- if (((pnew_comp_bit_map->colorants &
- (*pcomp_bit_map)->colorants) ==
- pnew_comp_bit_map->colorants) &&
- ((pnew_comp_bit_map->solid_colorants &
- (*pcomp_bit_map)->solid_colorants) ==
- (*pcomp_bit_map)->solid_colorants)) {
+ if (((pnew_comp_bit_map->colorants &
+ (*pcomp_bit_map)->colorants) ==
+ pnew_comp_bit_map->colorants) &&
+ ((pnew_comp_bit_map->solid_colorants &
+ (*pcomp_bit_map)->solid_colorants) ==
+ (*pcomp_bit_map)->solid_colorants)) {
#endif
- /*
- * To prevent possible loss of accuracy, ignore matches in which the
- * packing will use fewer bits in the encoded colorant values than
- * is possible for the given number of colorants.
- */
- if (num_comp_bits[pnew_comp_bit_map->num_comp] >
- num_comp_bits[(*pcomp_bit_map)->num_comp])
- break;
- /*
- * We have a match. Put our object number into the top eight
- * bits of the encoded gx_color_index and exit.
- */
- *plist_index = ((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8);
- return true;
- }
+ /*
+ * To prevent possible loss of accuracy, ignore matches in which the
+ * packing will use fewer bits in the encoded colorant values than
+ * is possible for the given number of colorants.
+ */
+ if (num_comp_bits[pnew_comp_bit_map->num_comp] >
+ num_comp_bits[(*pcomp_bit_map)->num_comp])
+ break;
+ /*
+ * We have a match. Put our object number into the top eight
+ * bits of the encoded gx_color_index and exit.
+ */
+ *plist_index = ((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8);
+ return true;
+ }
}
/*
@@ -1184,21 +1184,21 @@ search_compressed_color_list(int num_comp, compressed_color_list_t * pcomp_list,
* can find a match.
*/
if (pcomp_list->level_num_comp <= pnew_comp_bit_map->num_non_solid_comp)
- return false; /* Exit if not enough colorants in the sub levels */
+ return false; /* Exit if not enough colorants in the sub levels */
for (i = 0; i < pcomp_list->num_sub_level_ptrs; i++) {
- found = search_compressed_color_list(num_comp,
- pcomp_list->u.sub_level_ptrs[i],
- pnew_comp_bit_map, plist_index, pcomp_bit_map);
- if (found) {
- /*
- * We have a match. Combine the encode index for the sub level
- * with our index for this level.
- */
- *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
- + (*plist_index >> 8);
- return true;
- }
+ found = search_compressed_color_list(num_comp,
+ pcomp_list->u.sub_level_ptrs[i],
+ pnew_comp_bit_map, plist_index, pcomp_bit_map);
+ if (found) {
+ /*
+ * We have a match. Combine the encode index for the sub level
+ * with our index for this level.
+ */
+ *plist_index = (((gx_color_index) i) << (NUM_GX_COLOR_INDEX_BITS - 8))
+ + (*plist_index >> 8);
+ return true;
+ }
}
return false;
}
@@ -1256,7 +1256,7 @@ search_compressed_color_list(int num_comp, compressed_color_list_t * pcomp_list,
*/
gx_color_index
devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
- gs_devn_params * pdevn_params)
+ gs_devn_params * pdevn_params)
{
int num_comp = pdev->color_info.num_components;
int comp_num, comp_count = 0, solid_comp_count = 0, bit_pos = 0;
@@ -1275,15 +1275,15 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
*/
for (comp_num = 0; comp_num < num_comp; comp_num++) {
if (colors[comp_num] > color_resolution) {
- set_colorant_present(&new_comp_bit_map, colorants, comp_num);
- comp_count++;
- /* Check if the color is solid */
+ set_colorant_present(&new_comp_bit_map, colorants, comp_num);
+ comp_count++;
+ /* Check if the color is solid */
if (colors[comp_num] > (gx_max_color_value - color_resolution)) {
- set_colorant_present(&new_comp_bit_map,
- solid_colorants, comp_num);
- solid_comp_count++;
- }
- }
+ set_colorant_present(&new_comp_bit_map,
+ solid_colorants, comp_num);
+ solid_comp_count++;
+ }
+ }
}
new_comp_bit_map.num_comp = comp_count;
new_comp_bit_map.num_non_solid_comp = comp_count - solid_comp_count;
@@ -1293,44 +1293,44 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
* colorant value.
*/
if (new_comp_bit_map.num_non_solid_comp > TOP_ENCODED_LEVEL &&
- solid_comp_count < (comp_count / 2)) {
- short group_size[(gx_max_color_value / STD_ENCODED_VALUE) + 1] = {0};
- int value, largest_group_size = 0;
+ solid_comp_count < (comp_count / 2)) {
+ short group_size[(gx_max_color_value / STD_ENCODED_VALUE) + 1] = {0};
+ int value, largest_group_size = 0;
- /* Scan to determine the size of the largest group */
+ /* Scan to determine the size of the largest group */
for (comp_num = 0; comp_num < num_comp; comp_num++) {
value = colors[comp_num] / STD_ENCODED_VALUE;
- group_size[value]++;
- if (group_size[value] > largest_group_size) {
- largest_group_size = group_size[value];
- group = value;
- }
+ group_size[value]++;
+ if (group_size[value] > largest_group_size) {
+ largest_group_size = group_size[value];
+ group = value;
+ }
}
- /*
- * If using this group instead of the solid colorants will improve
- * our situation, then switch to using this group.
- */
- if (largest_group_size > (solid_comp_count + 1) &&
- (comp_count - largest_group_size) < MAX_ENCODED_COMPONENTS) {
- /* Setup the colorant description to use this group */
- memset(&(new_comp_bit_map.solid_colorants), 0,
- size_of(comp_bit_map_t));
+ /*
+ * If using this group instead of the solid colorants will improve
+ * our situation, then switch to using this group.
+ */
+ if (largest_group_size > (solid_comp_count + 1) &&
+ (comp_count - largest_group_size) < MAX_ENCODED_COMPONENTS) {
+ /* Setup the colorant description to use this group */
+ memset(&(new_comp_bit_map.solid_colorants), 0,
+ size_of(comp_bit_map_t));
for (comp_num = 0; comp_num < num_comp; comp_num++) {
value = colors[comp_num] / STD_ENCODED_VALUE;
- if (value == group) {
- set_colorant_present(&new_comp_bit_map,
- solid_colorants, comp_num);
- }
+ if (value == group) {
+ set_colorant_present(&new_comp_bit_map,
+ solid_colorants, comp_num);
+ }
}
- new_comp_bit_map.solid_not_100 = true;
- new_comp_bit_map.num_non_solid_comp =
- comp_count - largest_group_size + 1;
- }
+ new_comp_bit_map.solid_not_100 = true;
+ new_comp_bit_map.num_non_solid_comp =
+ comp_count - largest_group_size + 1;
+ }
}
/* Our encoding scheme cannot handle too many non solid colorants. */
if (new_comp_bit_map.num_non_solid_comp > MAX_ENCODED_COMPONENTS)
- return NON_ENCODEABLE_COLOR;
+ return NON_ENCODEABLE_COLOR;
/*
* We keep a list of which colorant combinations we have used. Make
@@ -1339,9 +1339,9 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
*/
if (pdevn_params->compressed_color_list == NULL) {
pdevn_params->compressed_color_list =
- init_compressed_color_list(pdev->memory->stable_memory);
+ init_compressed_color_list(pdev->memory->stable_memory);
if (pdevn_params->compressed_color_list == NULL)
- return NON_ENCODEABLE_COLOR; /* Unable to initialize list */
+ return NON_ENCODEABLE_COLOR; /* Unable to initialize list */
}
/*
@@ -1350,23 +1350,23 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
* non zero colorants.
*/
found = search_compressed_color_list(num_comp,
- pdevn_params->compressed_color_list,
- &new_comp_bit_map, &list_index, &pbit_map);
+ pdevn_params->compressed_color_list,
+ &new_comp_bit_map, &list_index, &pbit_map);
/*
* If our new colorant list was not found then add it to our encode color
* list. This needs to be in stable_memory to be immune to 'restore'.
*/
if (!found) {
- added = add_compressed_color_list(pdev->memory->stable_memory,
- &new_comp_bit_map,
- pdevn_params->compressed_color_list,
- &list_index);
- if (!added)
- return NON_ENCODEABLE_COLOR;
- pbit_map = &new_comp_bit_map;
+ added = add_compressed_color_list(pdev->memory->stable_memory,
+ &new_comp_bit_map,
+ pdevn_params->compressed_color_list,
+ &list_index);
+ if (!added)
+ return NON_ENCODEABLE_COLOR;
+ pbit_map = &new_comp_bit_map;
}
-
+
/*
* Form the encoded color gx_color_index value. This is a combination
* of the bits that encode which colorants are used (non zero) and the
@@ -1375,16 +1375,16 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
bit_count = num_comp_bits[pbit_map->num_non_solid_comp];
bit_shift = sizeof(gx_color_value) * 8 - bit_count;
if (pbit_map->solid_not_100) {
- color = group >> (8 - bit_count);
- bit_pos += bit_count;
+ color = group >> (8 - bit_count);
+ bit_pos += bit_count;
}
for (comp_num = 0; comp_num < num_comp; comp_num++) {
- if (colorant_present(pbit_map, colorants, comp_num) &&
- !colorant_present(pbit_map, solid_colorants, comp_num)) {
- color |=
- ((gx_color_index)(colors[comp_num] >> bit_shift)) << bit_pos;
- bit_pos += bit_count;
- }
+ if (colorant_present(pbit_map, colorants, comp_num) &&
+ !colorant_present(pbit_map, solid_colorants, comp_num)) {
+ color |=
+ ((gx_color_index)(colors[comp_num] >> bit_shift)) << bit_pos;
+ bit_pos += bit_count;
+ }
}
color |= list_index;
/*
@@ -1392,9 +1392,9 @@ devn_encode_compressed_color(gx_device *pdev, const gx_color_value colors[],
* values.
*/
if (color == NON_ENCODEABLE_COLOR)
- color -= 1;
+ color -= 1;
else if (color == gx_no_color_index)
- color -= 2;
+ color -= 2;
return color;
}
@@ -1412,9 +1412,9 @@ find_bit_map(gx_color_index index, compressed_color_list_t * pcomp_list)
* this level then we need to go down another level.
*/
while (loc < pcomp_list->num_sub_level_ptrs) {
- pcomp_list = pcomp_list->u.sub_level_ptrs[loc];
- index <<= 8;
- loc = (int)(index >> (NUM_GX_COLOR_INDEX_BITS - 8));
+ pcomp_list = pcomp_list->u.sub_level_ptrs[loc];
+ index <<= 8;
+ loc = (int)(index >> (NUM_GX_COLOR_INDEX_BITS - 8));
}
return &(pcomp_list->u.comp_data[loc]);
}
@@ -1429,7 +1429,7 @@ find_bit_map(gx_color_index index, compressed_color_list_t * pcomp_list)
*/
int
devn_decode_compressed_color(gx_device * dev, gx_color_index color,
- gx_color_value * out, gs_devn_params * pdevn_params)
+ gx_color_value * out, gs_devn_params * pdevn_params)
{
int comp_num = 0;
int factor, bit_count, bit_mask;
@@ -1452,25 +1452,24 @@ devn_decode_compressed_color(gx_device * dev, gx_color_index color,
bit_mask = (1 << bit_count) - 1;
factor = comp_bit_factor[pbitmap->num_non_solid_comp];
if (pbitmap->solid_not_100) {
- solid_color = (factor * ((int)color & bit_mask)) >> 8;
- color >>= bit_count;
+ solid_color = (factor * ((int)color & bit_mask)) >> 8;
+ color >>= bit_count;
}
for (; comp_num < ncomp; comp_num++) {
- if (colorant_present(pbitmap, colorants, comp_num)) {
- if (colorant_present(pbitmap, solid_colorants, comp_num))
+ if (colorant_present(pbitmap, colorants, comp_num)) {
+ if (colorant_present(pbitmap, solid_colorants, comp_num))
out[comp_num] = solid_color;
- else {
+ else {
out[comp_num] = (factor * ((int)color & bit_mask)) >> 8;
- color >>= bit_count;
- }
- }
- else
+ color >>= bit_count;
+ }
+ }
+ else
out[comp_num] = 0;
}
return 0;
}
-
/*
* Unpack a row of 'compressed color' values. These values are encoded as
* described for the devn_encode_compressed_color routine.
@@ -1486,7 +1485,7 @@ devn_decode_compressed_color(gx_device * dev, gx_color_index color,
*/
int
devn_unpack_row(gx_device * dev, int num_comp, gs_devn_params * pdevn_params,
- int width, byte * in, byte * out)
+ int width, byte * in, byte * out)
{
int i, comp_num, pixel_num;
@@ -1499,9 +1498,9 @@ devn_unpack_row(gx_device * dev, int num_comp, gs_devn_params * pdevn_params,
* the number of actual device components.
*/
for (pixel_num = 0; pixel_num < width; pixel_num++) {
- for (i = 0; i < num_comp; i++)
- *out++ = *in++;
- in += bytes_pp - num_comp;
+ for (i = 0; i < num_comp; i++)
+ *out++ = *in++;
+ in += bytes_pp - num_comp;
}
return 0;
}
@@ -1513,50 +1512,49 @@ devn_unpack_row(gx_device * dev, int num_comp, gs_devn_params * pdevn_params,
gx_color_value solid_color = gx_max_color_value;
for (pixel_num = 0; pixel_num < width; pixel_num++) {
- /*
- * Get the encoded color value.
- */
- color = ((gx_color_index)(*in++)) << (NUM_GX_COLOR_INDEX_BITS - 8);
- for (i = NUM_GX_COLOR_INDEX_BITS - 16; i >= 0; i -= 8)
- color |= ((gx_color_index)(*in++)) << i;
+ /*
+ * Get the encoded color value.
+ */
+ color = ((gx_color_index)(*in++)) << (NUM_GX_COLOR_INDEX_BITS - 8);
+ for (i = NUM_GX_COLOR_INDEX_BITS - 16; i >= 0; i -= 8)
+ color |= ((gx_color_index)(*in++)) << i;
/*
* Set all colorants to zero if we get a non encodeable color.
*/
if (color == NON_ENCODEABLE_COLOR) {
for (comp_num = 0; comp_num < num_comp; comp_num++)
*out++ = 0;
- non_encodeable_count++;
+ non_encodeable_count++;
}
- else {
- pbitmap = find_bit_map(color,
- pdevn_params->compressed_color_list);
- bit_count = num_comp_bits[pbitmap->num_non_solid_comp];
- bit_mask = (1 << bit_count) - 1;
- factor = comp_bit_factor[pbitmap->num_non_solid_comp];
- if (pbitmap->solid_not_100) {
- solid_color = (factor * ((int)color & bit_mask)) >> 8;
- color >>= bit_count;
- }
+ else {
+ pbitmap = find_bit_map(color,
+ pdevn_params->compressed_color_list);
+ bit_count = num_comp_bits[pbitmap->num_non_solid_comp];
+ bit_mask = (1 << bit_count) - 1;
+ factor = comp_bit_factor[pbitmap->num_non_solid_comp];
+ if (pbitmap->solid_not_100) {
+ solid_color = (factor * ((int)color & bit_mask)) >> 8;
+ color >>= bit_count;
+ }
for (comp_num = 0; comp_num < num_comp; comp_num++) {
- if (colorant_present(pbitmap, colorants, comp_num)) {
- if (colorant_present(pbitmap,
- solid_colorants, comp_num))
- *out++ = solid_color >> 8;
- else {
- *out++ = (factor * ((int)color & bit_mask)) >> 16;
- color >>= bit_count;
- }
- }
- else
- *out++ = 0;
- }
+ if (colorant_present(pbitmap, colorants, comp_num)) {
+ if (colorant_present(pbitmap,
+ solid_colorants, comp_num))
+ *out++ = solid_color >> 8;
+ else {
+ *out++ = (factor * ((int)color & bit_mask)) >> 16;
+ color >>= bit_count;
+ }
+ }
+ else
+ *out++ = 0;
+ }
}
}
return non_encodeable_count;
}
}
-
/* ***************** The spotcmyk and devicen devices ***************** */
/* Define the device parameters. */
@@ -1589,13 +1587,13 @@ typedef struct spotcmyk_device_s {
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(spotcmyk_device_enum_ptrs, spotcmyk_device *pdev)
{
if (index < pdev->devn_params.separations.num_separations)
- ENUM_RETURN(pdev->devn_params.separations.names[index].data);
+ ENUM_RETURN(pdev->devn_params.separations.names[index].data);
ENUM_PREFIX(st_device_printer,
- pdev->devn_params.separations.num_separations);
+ pdev->devn_params.separations.num_separations);
}
ENUM_PTRS_END
@@ -1603,11 +1601,11 @@ static RELOC_PTRS_WITH(spotcmyk_device_reloc_ptrs, spotcmyk_device *pdev)
{
RELOC_PREFIX(st_device_printer);
{
- int i;
+ int i;
- for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
- RELOC_PTR(spotcmyk_device, devn_params.separations.names[i].data);
- }
+ for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
+ RELOC_PTR(spotcmyk_device, devn_params.separations.names[i].data);
+ }
}
}
RELOC_PTRS_END
@@ -1630,89 +1628,88 @@ gs_private_st_composite_final(st_spotcmyk_device, spotcmyk_device,
*/
#define device_procs(get_color_mapping_procs)\
{ spotcmyk_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page, /* output_page */\
- gdev_prn_close, /* close */\
- NULL, /* map_rgb_color - not used */\
- NULL, /* map_color_rgb - not used */\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- spotcmyk_get_params, /* get_params */\
- spotcmyk_put_params, /* put_params */\
- NULL, /* map_cmyk_color - not used */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- spotcmyk_get_color_comp_index, /* get_color_comp_index */\
- spotcmyk_encode_color, /* encode_color */\
- spotcmyk_decode_color, /* decode_color */\
- NULL, /* pattern_manage */\
- NULL /* fill_rectangle_hl_color */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page, /* output_page */\
+ gdev_prn_close, /* close */\
+ NULL, /* map_rgb_color - not used */\
+ NULL, /* map_color_rgb - not used */\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ spotcmyk_get_params, /* get_params */\
+ spotcmyk_put_params, /* put_params */\
+ NULL, /* map_cmyk_color - not used */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ spotcmyk_get_color_comp_index, /* get_color_comp_index */\
+ spotcmyk_encode_color, /* encode_color */\
+ spotcmyk_decode_color, /* decode_color */\
+ NULL, /* pattern_manage */\
+ NULL /* fill_rectangle_hl_color */\
}
fixed_colorant_name DeviceCMYKComponents[] = {
- "Cyan",
- "Magenta",
- "Yellow",
- "Black",
- 0 /* List terminator */
+ "Cyan",
+ "Magenta",
+ "Yellow",
+ "Black",
+ 0 /* List terminator */
};
-
#define spotcmyk_device_body(procs, dname, ncomp, pol, depth, mg, mc, cn)\
std_device_full_body_type_extended(spotcmyk_device, &procs, dname,\
- &st_spotcmyk_device,\
- (int)((long)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10),\
- (int)((long)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10),\
- X_DPI, Y_DPI,\
- GX_DEVICE_COLOR_MAX_COMPONENTS, /* MaxComponents */\
- ncomp, /* NumComp */\
- pol, /* Polarity */\
- depth, 0, /* Depth, GrayIndex */\
- mg, mc, /* MaxGray, MaxColor */\
- mg + 1, mc + 1, /* DitherGray, DitherColor */\
- GX_CINFO_SEP_LIN, /* Linear & Separable */\
- cn, /* Process color model name */\
- 0, 0, /* offsets */\
- 0, 0, 0, 0 /* margins */\
- ),\
- prn_device_body_rest_(spotcmyk_print_page)
+ &st_spotcmyk_device,\
+ (int)((long)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10),\
+ (int)((long)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10),\
+ X_DPI, Y_DPI,\
+ GX_DEVICE_COLOR_MAX_COMPONENTS, /* MaxComponents */\
+ ncomp, /* NumComp */\
+ pol, /* Polarity */\
+ depth, 0, /* Depth, GrayIndex */\
+ mg, mc, /* MaxGray, MaxColor */\
+ mg + 1, mc + 1, /* DitherGray, DitherColor */\
+ GX_CINFO_SEP_LIN, /* Linear & Separable */\
+ cn, /* Process color model name */\
+ 0, 0, /* offsets */\
+ 0, 0, 0, 0 /* margins */\
+ ),\
+ prn_device_body_rest_(spotcmyk_print_page)
/*
* Example device with CMYK and spot color support
@@ -1720,7 +1717,7 @@ fixed_colorant_name DeviceCMYKComponents[] = {
static const gx_device_procs spot_cmyk_procs = device_procs(get_spotcmyk_color_mapping_procs);
const spotcmyk_device gs_spotcmyk_device =
-{
+{
spotcmyk_device_body(spot_cmyk_procs, "spotcmyk", 4, GX_CINFO_POLARITY_SUBTRACTIVE, 4, 1, 1, "DeviceCMYK"),
/* DeviceN device specific parameters */
{ 1, /* Bits per color - must match ncomp, depth, etc. above */
@@ -1740,7 +1737,7 @@ const spotcmyk_device gs_spotcmyk_device =
static const gx_device_procs devicen_procs = device_procs(get_devicen_color_mapping_procs);
const spotcmyk_device gs_devicen_device =
-{
+{
spotcmyk_device_body(devicen_procs, "devicen", 4, GX_CINFO_POLARITY_SUBTRACTIVE, 32, 255, 255, "DeviceCMYK"),
/* DeviceN device specific parameters */
{ 8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -1777,7 +1774,7 @@ gray_cs_to_spotcmyk_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotcmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
int * map = ((spotcmyk_device *) dev)->devn_params.separation_order_map;
@@ -1810,7 +1807,6 @@ get_devicen_color_mapping_procs(const gx_device * dev)
return &spotCMYK_procs;
}
-
/*
* Encode a list of colorant values into a gx_color_index_value.
*/
@@ -1824,7 +1820,7 @@ spotcmyk_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
+ color <<= bpc;
color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
@@ -1844,7 +1840,7 @@ spotcmyk_decode_color(gx_device * dev, gx_color_index color, gx_color_value * ou
for (; i<ncomp; i++) {
out[ncomp - i - 1] = (gx_color_value)((color & mask) << drop);
- color >>= bpc;
+ color >>= bpc;
}
return 0;
}
@@ -1856,9 +1852,9 @@ spotcmyk_get_params(gx_device * pdev, gs_param_list * plist)
int code = gdev_prn_get_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
return devn_get_params(pdev, plist,
- &(((spotcmyk_device *)pdev)->devn_params), NULL);
+ &(((spotcmyk_device *)pdev)->devn_params), NULL);
}
/* Set parameters. */
@@ -1866,12 +1862,12 @@ static int
spotcmyk_put_params(gx_device * pdev, gs_param_list * plist)
{
return devn_printer_put_params(pdev, plist,
- &(((spotcmyk_device *)pdev)->devn_params), NULL);
+ &(((spotcmyk_device *)pdev)->devn_params), NULL);
}
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -1885,14 +1881,13 @@ spotcmyk_put_params(gx_device * pdev, gs_param_list * plist)
*/
static int
spotcmyk_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
return devn_get_color_comp_index(dev,
- &(((spotcmyk_device *)dev)->devn_params), NULL,
- pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
+ &(((spotcmyk_device *)dev)->devn_params), NULL,
+ pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
}
-
/*
* This routine will extract a specified set of bits from a buffer and pack
* them into a given buffer.
@@ -1911,7 +1906,7 @@ spotcmyk_get_color_comp_index(gx_device * dev, const char * pname,
*/
int
repack_data(byte * source, byte * dest, int depth, int first_bit,
- int bit_width, int npixel)
+ int bit_width, int npixel)
{
int in_nbyte = depth >> 3; /* Number of bytes per input pixel */
int out_nbyte = bit_width >> 3; /* Number of bytes per output pixel */
@@ -1927,52 +1922,52 @@ repack_data(byte * source, byte * dest, int depth, int first_bit,
mask = (mask << bit_width) - 1;
for (i=0; i<npixel; i++) {
/* Get the pixel data */
- if (!in_nbyte) { /* Multiple pixels per byte */
- data = *source;
- data >>= in_byte_loc;
- in_byte_loc -= depth;
- if (in_byte_loc < 0) { /* If finished with byte */
- in_byte_loc = in_bit_start;
- source++;
- }
- }
- else { /* One or more bytes per pixel */
- data = *source++;
- for (j=1; j<in_nbyte; j++)
- data = (data << 8) + *source++;
- }
- data >>= first_bit;
- data &= mask;
-
- /* Put the output data */
- if (!out_nbyte) { /* Multiple pixels per byte */
- temp = (byte)(*out & ~(mask << out_byte_loc));
- *out = (byte)(temp | (data << out_byte_loc));
- out_byte_loc -= bit_width;
- if (out_byte_loc < 0) { /* If finished with byte */
- out_byte_loc = out_bit_start;
- out++;
- }
- }
- else { /* One or more bytes per pixel */
- *out++ = (byte)(data >> ((out_nbyte - 1) * 8));
- for (j=1; j<out_nbyte; j++) {
- *out++ = (byte)(data >> ((out_nbyte - 1 - j) * 8));
- }
- }
+ if (!in_nbyte) { /* Multiple pixels per byte */
+ data = *source;
+ data >>= in_byte_loc;
+ in_byte_loc -= depth;
+ if (in_byte_loc < 0) { /* If finished with byte */
+ in_byte_loc = in_bit_start;
+ source++;
+ }
+ }
+ else { /* One or more bytes per pixel */
+ data = *source++;
+ for (j=1; j<in_nbyte; j++)
+ data = (data << 8) + *source++;
+ }
+ data >>= first_bit;
+ data &= mask;
+
+ /* Put the output data */
+ if (!out_nbyte) { /* Multiple pixels per byte */
+ temp = (byte)(*out & ~(mask << out_byte_loc));
+ *out = (byte)(temp | (data << out_byte_loc));
+ out_byte_loc -= bit_width;
+ if (out_byte_loc < 0) { /* If finished with byte */
+ out_byte_loc = out_bit_start;
+ out++;
+ }
+ }
+ else { /* One or more bytes per pixel */
+ *out++ = (byte)(data >> ((out_nbyte - 1) * 8));
+ for (j=1; j<out_nbyte; j++) {
+ *out++ = (byte)(data >> ((out_nbyte - 1 - j) * 8));
+ }
+ }
}
/* Return the number of bytes in the destination buffer. */
if (out_byte_loc != out_bit_start) { /* If partially filled last byte */
- *out = *out & ((~0) << out_byte_loc); /* Mask unused part of last byte */
- out++;
+ *out = *out & ((~0) << out_byte_loc); /* Mask unused part of last byte */
+ out++;
}
length = out - dest;
return length;
}
static int devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
- int bpc, int pcmlinelength);
-/*
+ int bpc, int pcmlinelength);
+/*
* This is an example print page routine for a DeviceN device. This routine
* will handle a DeviceN, a CMYK with spot colors, or an RGB process color model.
*
@@ -1980,7 +1975,7 @@ static int devn_write_pcx_file(gx_device_printer * pdev, char * filename, int nc
* RGB or CMYK then a bit image file is created which contains the data for the
* process color model data. This data is put into the given file stream.
* I.e. into the output file specified by the user. This file is not created
- * for the DeviceN process color model. A separate bit image file is created
+ * for the DeviceN process color model. A separate bit image file is created
* is created for the data for each of the given spot colors. The names for
* these files are created by taking the given output file name and appending
* "sn" (where n is the spot color number 0 to ...) to the output file name.
@@ -2025,8 +2020,8 @@ spotcmyk_print_page(gx_device_printer * pdev, FILE * prn_stream)
char spotname[gp_file_name_sizeof];
if (in == NULL || buf == NULL) {
- code = gs_error_VMerror;
- goto prn_done;
+ code = gs_error_VMerror;
+ goto prn_done;
}
/*
* Check if the SeparationOrder list has changed the order of the process
@@ -2034,66 +2029,64 @@ spotcmyk_print_page(gx_device_printer * pdev, FILE * prn_stream)
* are spot colors.
*/
for (i = 0; i < npcmcolors; i++)
- if (pdevn->devn_params.separation_order_map[i] != i)
- break;
+ if (pdevn->devn_params.separation_order_map[i] != i)
+ break;
if (i < npcmcolors || ncomp < npcmcolors) {
- nspot = ncomp;
- npcmcolors = 0;
+ nspot = ncomp;
+ npcmcolors = 0;
}
/* Open the output files for the spot colors */
for(i = 0; i < nspot; i++) {
- sprintf(spotname, "%ss%d", pdevn->fname, i);
+ sprintf(spotname, "%ss%d", pdevn->fname, i);
spot_file[i] = fopen(spotname, "wb");
- if (spot_file[i] == NULL) {
- code = gs_error_VMerror;
- goto prn_done;
- }
+ if (spot_file[i] == NULL) {
+ code = gs_error_VMerror;
+ goto prn_done;
+ }
}
-
/* Now create the output bit image files */
for (; lnum < bottom; ++lnum) {
- gdev_prn_get_bits(pdev, lnum, in, &data);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
/* Now put the pcm data into the output file */
- if (npcmcolors) {
- first_bit = bpc * (ncomp - npcmcolors);
- pcmlinelength = repack_data(data, buf, depth, first_bit, bpc * npcmcolors, width);
- fwrite(buf, 1, pcmlinelength, prn_stream);
- }
- /* Put spot color data into the output files */
+ if (npcmcolors) {
+ first_bit = bpc * (ncomp - npcmcolors);
+ pcmlinelength = repack_data(data, buf, depth, first_bit, bpc * npcmcolors, width);
+ fwrite(buf, 1, pcmlinelength, prn_stream);
+ }
+ /* Put spot color data into the output files */
for (i = 0; i < nspot; i++) {
- first_bit = bpc * (nspot - 1 - i);
- linelength[i] = repack_data(data, buf, depth, first_bit, bpc, width);
- fwrite(buf, 1, linelength[i], spot_file[i]);
+ first_bit = bpc * (nspot - 1 - i);
+ linelength[i] = repack_data(data, buf, depth, first_bit, bpc, width);
+ fwrite(buf, 1, linelength[i], spot_file[i]);
}
}
/* Close the bit image files */
for(i = 0; i < nspot; i++) {
fclose(spot_file[i]);
- spot_file[i] = NULL;
+ spot_file[i] = NULL;
}
/* Now convert the bit image files into PCX files */
if (npcmcolors) {
- code = devn_write_pcx_file(pdev, (char *) &pdevn->fname,
- npcmcolors, bpc, pcmlinelength);
- if (code < 0)
- return code;
+ code = devn_write_pcx_file(pdev, (char *) &pdevn->fname,
+ npcmcolors, bpc, pcmlinelength);
+ if (code < 0)
+ return code;
}
for(i = 0; i < nspot; i++) {
- sprintf(spotname, "%ss%d", pdevn->fname, i);
- code = devn_write_pcx_file(pdev, spotname, 1, bpc, linelength[i]);
- if (code < 0)
- return code;
+ sprintf(spotname, "%ss%d", pdevn->fname, i);
+ code = devn_write_pcx_file(pdev, spotname, 1, bpc, linelength[i]);
+ if (code < 0)
+ return code;
}
-
/* Clean up and exit */
prn_done:
for(i = 0; i < nspot; i++) {
- if (spot_file[i] != NULL)
+ if (spot_file[i] != NULL)
fclose(spot_file[i]);
}
if (in != NULL)
@@ -2166,7 +2159,6 @@ static const pcx_header pcx_header_prototype =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
-
/* Forward declarations */
static void devn_pcx_write_rle(const byte *, const byte *, int, FILE *);
static int devn_pcx_write_page(gx_device_printer * pdev, FILE * infile,
@@ -2188,7 +2180,6 @@ static const byte pcx_ega_palette[16 * 3] =
0xff, 0x55, 0x55, 0xff, 0x55, 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff
};
-
/*
* This routine will set up the revision and palatte for the output
* file.
@@ -2207,95 +2198,95 @@ static bool
devn_setup_pcx_header(gx_device_printer * pdev, pcx_header * phdr, int num_planes, int bits_per_plane)
{
bool planar = true; /* Invalid cases could cause an indeterminizm. */
-
+
*phdr = pcx_header_prototype;
phdr->bpp = bits_per_plane;
phdr->nplanes = num_planes;
switch (num_planes) {
case 1:
- switch (bits_per_plane) {
- case 1:
- phdr->version = version_2_8_with_palette;
- assign_ushort(phdr->palinfo, palinfo_gray);
- memcpy((byte *) phdr->palette, "\000\000\000\377\377\377", 6);
- planar = false;
- break;
- case 2: /* Not defined */
- break;
- case 4:
- phdr->version = version_2_8_with_palette;
- memcpy((byte *) phdr->palette, pcx_ega_palette, sizeof(pcx_ega_palette));
- planar = true;
- break;
- case 5: /* Not defined */
- break;
- case 8:
- phdr->version = version_3_0;
- assign_ushort(phdr->palinfo, palinfo_gray);
- planar = false;
- break;
- case 16: /* Not defined */
- break;
- }
- break;
- case 2:
- switch (bits_per_plane) {
- case 1: /* Not defined */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8: /* Not defined */
- break;
- case 16: /* Not defined */
- break;
- }
- break;
- case 3:
- switch (bits_per_plane) {
- case 1: /* Not defined */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8:
- phdr->version = version_3_0;
- assign_ushort(phdr->palinfo, palinfo_color);
- planar = true;
- break;
- case 16: /* Not defined */
- break;
- }
- break;
- case 4:
- switch (bits_per_plane) {
- case 1:
- phdr->version = 2;
- memcpy((byte *) phdr->palette, pcx_cmyk_palette,
- sizeof(pcx_cmyk_palette));
- planar = false;
- phdr->bpp = 4;
- phdr->nplanes = 1;
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8: /* Not defined */
- break;
- case 16: /* Not defined */
- break;
- }
- break;
+ switch (bits_per_plane) {
+ case 1:
+ phdr->version = version_2_8_with_palette;
+ assign_ushort(phdr->palinfo, palinfo_gray);
+ memcpy((byte *) phdr->palette, "\000\000\000\377\377\377", 6);
+ planar = false;
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4:
+ phdr->version = version_2_8_with_palette;
+ memcpy((byte *) phdr->palette, pcx_ega_palette, sizeof(pcx_ega_palette));
+ planar = true;
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8:
+ phdr->version = version_3_0;
+ assign_ushort(phdr->palinfo, palinfo_gray);
+ planar = false;
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 2:
+ switch (bits_per_plane) {
+ case 1: /* Not defined */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8: /* Not defined */
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 3:
+ switch (bits_per_plane) {
+ case 1: /* Not defined */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8:
+ phdr->version = version_3_0;
+ assign_ushort(phdr->palinfo, palinfo_color);
+ planar = true;
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 4:
+ switch (bits_per_plane) {
+ case 1:
+ phdr->version = 2;
+ memcpy((byte *) phdr->palette, pcx_cmyk_palette,
+ sizeof(pcx_cmyk_palette));
+ planar = false;
+ phdr->bpp = 4;
+ phdr->nplanes = 1;
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8: /* Not defined */
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
}
return planar;
}
@@ -2308,12 +2299,12 @@ pc_write_mono_palette(gx_device * dev, uint max_index, FILE * file)
gx_color_value rgb[3];
for (i = 0; i < max_index; i++) {
- rgb[0] = rgb[1] = rgb[2] = i << 8;
- for (c = 0; c < 3; c++) {
- byte b = gx_color_value_to_byte(rgb[c]);
+ rgb[0] = rgb[1] = rgb[2] = i << 8;
+ for (c = 0; c < 3; c++) {
+ byte b = gx_color_value_to_byte(rgb[c]);
- fputc(b, file);
- }
+ fputc(b, file);
+ }
}
return 0;
}
@@ -2336,70 +2327,70 @@ devn_finish_pcx_file(gx_device_printer * pdev, FILE * file, pcx_header * header,
{
switch (num_planes) {
case 1:
- switch (bits_per_plane) {
- case 1: /* Do nothing */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Do nothing */
- break;
- case 5: /* Not defined */
- break;
- case 8:
- fputc(0x0c, file);
- return pc_write_mono_palette((gx_device *) pdev, 256, file);
- case 16: /* Not defined */
- break;
- }
- break;
- case 2:
- switch (bits_per_plane) {
- case 1: /* Not defined */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8: /* Not defined */
- break;
- case 16: /* Not defined */
- break;
- }
- break;
- case 3:
- switch (bits_per_plane) {
- case 1: /* Not defined */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8: /* Do nothing */
- break;
- case 16: /* Not defined */
- break;
- }
- break;
- case 4:
- switch (bits_per_plane) {
- case 1: /* Do nothing */
- break;
- case 2: /* Not defined */
- break;
- case 4: /* Not defined */
- break;
- case 5: /* Not defined */
- break;
- case 8: /* Not defined */
- break;
- case 16: /* Not defined */
- break;
- }
- break;
+ switch (bits_per_plane) {
+ case 1: /* Do nothing */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Do nothing */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8:
+ fputc(0x0c, file);
+ return pc_write_mono_palette((gx_device *) pdev, 256, file);
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 2:
+ switch (bits_per_plane) {
+ case 1: /* Not defined */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8: /* Not defined */
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 3:
+ switch (bits_per_plane) {
+ case 1: /* Not defined */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8: /* Do nothing */
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
+ case 4:
+ switch (bits_per_plane) {
+ case 1: /* Do nothing */
+ break;
+ case 2: /* Not defined */
+ break;
+ case 4: /* Not defined */
+ break;
+ case 5: /* Not defined */
+ break;
+ case 8: /* Not defined */
+ break;
+ case 16: /* Not defined */
+ break;
+ }
+ break;
}
return 0;
}
@@ -2407,7 +2398,7 @@ devn_finish_pcx_file(gx_device_printer * pdev, FILE * file, pcx_header * header,
/* Send the page to the printer. */
static int
devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
- int bpc, int linesize)
+ int bpc, int linesize)
{
pcx_header header;
int code;
@@ -2419,12 +2410,12 @@ devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
in = fopen(filename, "rb");
if (!in)
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
sprintf(outname, "%s.pcx", filename);
out = fopen(outname, "wb");
if (!out) {
- fclose(in);
- return_error(gs_error_invalidfileaccess);
+ fclose(in);
+ return_error(gs_error_invalidfileaccess);
}
planar = devn_setup_pcx_header(pdev, &header, ncomp, bpc);
@@ -2442,7 +2433,7 @@ devn_write_pcx_file(gx_device_printer * pdev, char * filename, int ncomp,
/* The caller has set header->bpp, nplanes, and palette. */
static int
devn_pcx_write_page(gx_device_printer * pdev, FILE * infile, int linesize, FILE * outfile,
- pcx_header * phdr, bool planar, int depth)
+ pcx_header * phdr, bool planar, int depth)
{
int raster = linesize;
uint rsize = ROUND_UP((pdev->width * phdr->bpp + 7) >> 3, 2); /* PCX format requires even */
@@ -2454,7 +2445,7 @@ devn_pcx_write_page(gx_device_printer * pdev, FILE * infile, int linesize, FILE
int code = 0; /* return code */
if (line == 0) /* can't allocate line buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Fill in the other variable entries in the header struct. */
@@ -2463,81 +2454,81 @@ devn_pcx_write_page(gx_device_printer * pdev, FILE * infile, int linesize, FILE
assign_ushort(phdr->hres, (int)pdev->x_pixels_per_inch);
assign_ushort(phdr->vres, (int)pdev->y_pixels_per_inch);
assign_ushort(phdr->bpl, (planar || depth == 1 ? rsize :
- raster + (raster & 1)));
+ raster + (raster & 1)));
/* Write the header. */
if (fwrite((const char *)phdr, 1, 128, outfile) < 128) {
- code = gs_error_ioerror;
- goto pcx_done;
+ code = gs_error_ioerror;
+ goto pcx_done;
}
/* Write the contents of the image. */
for (y = 0; y < height; y++) {
- byte *row = line;
- byte *end;
-
- code = fread(line, sizeof(byte), linesize, infile);
- if (code < 0)
- break;
- end = row + raster;
- if (!planar) { /* Just write the bits. */
- if (raster & 1) { /* Round to even, with predictable padding. */
- *end = end[-1];
- ++end;
- }
- devn_pcx_write_rle(row, end, 1, outfile);
- } else
- switch (depth) {
-
- case 4:
- {
- byte *pend = plane + rsize;
- int shift;
-
- for (shift = 0; shift < 4; shift++) {
- register byte *from, *to;
- register int bright = 1 << shift;
- register int bleft = bright << 4;
-
- for (from = row, to = plane;
- from < end; from += 4
- ) {
- *to++ =
- (from[0] & bleft ? 0x80 : 0) |
- (from[0] & bright ? 0x40 : 0) |
- (from[1] & bleft ? 0x20 : 0) |
- (from[1] & bright ? 0x10 : 0) |
- (from[2] & bleft ? 0x08 : 0) |
- (from[2] & bright ? 0x04 : 0) |
- (from[3] & bleft ? 0x02 : 0) |
- (from[3] & bright ? 0x01 : 0);
- }
- /* We might be one byte short of rsize. */
- if (to < pend)
- *to = to[-1];
- devn_pcx_write_rle(plane, pend, 1, outfile);
- }
- }
- break;
-
- case 24:
- {
- int pnum;
-
- for (pnum = 0; pnum < 3; ++pnum) {
- devn_pcx_write_rle(row + pnum, row + raster, 3, outfile);
- if (pdev->width & 1)
- fputc(0, outfile); /* pad to even */
- }
- }
- break;
-
- default:
- code = gs_note_error(gs_error_rangecheck);
- goto pcx_done;
-
- }
- code = 0;
+ byte *row = line;
+ byte *end;
+
+ code = fread(line, sizeof(byte), linesize, infile);
+ if (code < 0)
+ break;
+ end = row + raster;
+ if (!planar) { /* Just write the bits. */
+ if (raster & 1) { /* Round to even, with predictable padding. */
+ *end = end[-1];
+ ++end;
+ }
+ devn_pcx_write_rle(row, end, 1, outfile);
+ } else
+ switch (depth) {
+
+ case 4:
+ {
+ byte *pend = plane + rsize;
+ int shift;
+
+ for (shift = 0; shift < 4; shift++) {
+ register byte *from, *to;
+ register int bright = 1 << shift;
+ register int bleft = bright << 4;
+
+ for (from = row, to = plane;
+ from < end; from += 4
+ ) {
+ *to++ =
+ (from[0] & bleft ? 0x80 : 0) |
+ (from[0] & bright ? 0x40 : 0) |
+ (from[1] & bleft ? 0x20 : 0) |
+ (from[1] & bright ? 0x10 : 0) |
+ (from[2] & bleft ? 0x08 : 0) |
+ (from[2] & bright ? 0x04 : 0) |
+ (from[3] & bleft ? 0x02 : 0) |
+ (from[3] & bright ? 0x01 : 0);
+ }
+ /* We might be one byte short of rsize. */
+ if (to < pend)
+ *to = to[-1];
+ devn_pcx_write_rle(plane, pend, 1, outfile);
+ }
+ }
+ break;
+
+ case 24:
+ {
+ int pnum;
+
+ for (pnum = 0; pnum < 3; ++pnum) {
+ devn_pcx_write_rle(row + pnum, row + raster, 3, outfile);
+ if (pdev->width & 1)
+ fputc(0, outfile); /* pad to even */
+ }
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_rangecheck);
+ goto pcx_done;
+
+ }
+ code = 0;
}
pcx_done:
@@ -2560,27 +2551,27 @@ devn_pcx_write_rle(const byte * from, const byte * end, int step, FILE * file)
int max_run = step * MAX_RUN_COUNT;
while (from < end) {
- byte data = *from;
-
- from += step;
- if (data != *from || from == end) {
- if (data >= 0xc0)
- putc(0xc1, file);
- } else {
- const byte *start = from;
-
- while ((from < end) && (*from == data))
- from += step;
- /* Now (from - start) / step + 1 is the run length. */
- while (from - start >= max_run) {
- putc(0xc0 + MAX_RUN_COUNT, file);
- putc(data, file);
- start += max_run;
- }
- if (from > start || data >= 0xc0)
- putc((from - start) / step + 0xc1, file);
- }
- putc(data, file);
+ byte data = *from;
+
+ from += step;
+ if (data != *from || from == end) {
+ if (data >= 0xc0)
+ putc(0xc1, file);
+ } else {
+ const byte *start = from;
+
+ while ((from < end) && (*from == data))
+ from += step;
+ /* Now (from - start) / step + 1 is the run length. */
+ while (from - start >= max_run) {
+ putc(0xc0 + MAX_RUN_COUNT, file);
+ putc(data, file);
+ start += max_run;
+ }
+ if (from > start || data >= 0xc0)
+ putc((from - start) / step + 0xc1, file);
+ }
+ putc(data, file);
}
#undef MAX_RUN_COUNT
}
diff --git a/gs/base/gdevdevn.h b/gs/base/gdevdevn.h
index 77fdd630d..a75738092 100644
--- a/gs/base/gdevdevn.h
+++ b/gs/base/gdevdevn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -157,10 +157,10 @@ extern fixed_colorant_name DeviceCMYKComponents[];
void gray_cs_to_devn_cm(gx_device * dev, int * map, frac gray, frac out[]);
void rgb_cs_to_devn_cm(gx_device * dev, int * map,
- const gs_imager_state *pis, frac r, frac g, frac b, frac out[]);
+ const gs_imager_state *pis, frac r, frac g, frac b, frac out[]);
void cmyk_cs_to_devn_cm(gx_device * dev, int * map,
- frac c, frac m, frac y, frac k, frac out[]);
+ frac c, frac m, frac y, frac k, frac out[]);
/*
* Possible values for the 'auto_spot_colors' parameter.
@@ -185,7 +185,7 @@ void cmyk_cs_to_devn_cm(gx_device * dev, int * map,
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color colorants.
+ * that are available amoung the current device's color colorants.
*
* Parameters:
* dev - pointer to device data structure.
@@ -211,8 +211,8 @@ int devn_get_color_comp_index(gx_device * dev,
/* Utility routine for getting DeviceN parameters */
int devn_get_params(gx_device * pdev, gs_param_list * plist,
- gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pequiv_colors);
+ gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pequiv_colors);
/*
* Utility routine for handling DeviceN related parameters. This routine
@@ -224,10 +224,10 @@ int devn_get_params(gx_device * pdev, gs_param_list * plist,
* optional (it should be NULL if this feature is not used by the device).
*/
int devn_printer_put_params(gx_device * pdev, gs_param_list * plist,
- gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pequiv_colors);
+ gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pequiv_colors);
-/*
+/*
* Utility routine for handling DeviceN related parameters. This routine
* may modify the color_info, devn_params, and the * equiv_colors fields.
* The pointer to the equivalent_cmyk_color_params is optional (it should be
@@ -237,8 +237,8 @@ int devn_printer_put_params(gx_device * pdev, gs_param_list * plist,
* is left to the caller.
*/
int devn_put_params(gx_device * pdev, gs_param_list * plist,
- gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pequiv_colors);
+ gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pequiv_colors);
/*
* This routine will check to see if the color component name match those
@@ -254,28 +254,28 @@ int devn_put_params(gx_device * pdev, gs_param_list * plist,
* number if the name is found. It returns a negative value if not found.
*/
int check_pcm_and_separation_names(const gx_device * dev,
- const gs_devn_params * pparams, const char * pname,
- int name_size, int component_type);
+ const gs_devn_params * pparams, const char * pname,
+ int name_size, int component_type);
-/*
- * This routine copies over the gs_devn_params from one device to another.
- This is needed when we launch multi-threaded rendering for separation
- devices
+/*
+ * This routine copies over the gs_devn_params from one device to another.
+ This is needed when we launch multi-threaded rendering for separation
+ devices
*
* Parameters :
* psrcdev - pointer to source device.
* pdesdev - pointer to destination device.
- *
+ *
* Returns 0 if all allocations were fine.
*/
int devn_copy_params(gx_device * psrcdev, gx_device * pdesdev);
-/*
- * This routine frees the gs_devn_params objects
+/*
+ * This routine frees the gs_devn_params objects
*
* Parameters :
* dev - pointer to device.
- *
+ *
*/
void devn_free_params(gx_device *dev);
@@ -296,7 +296,7 @@ void devn_free_params(gx_device *dev);
* Data in dest.
*/
int repack_data(byte * source, byte * dest, int depth, int first_bit,
- int bit_width, int npixel);
+ int bit_width, int npixel);
/*
* This utility routine calculates the number of bits required to store
@@ -313,7 +313,6 @@ int repack_data(byte * source, byte * dest, int depth, int first_bit,
*/
int bpc_to_depth(int ncomp, int bpc);
-
/*
* We are encoding color values into a gx_color_index value. This is being
* done to allow more than eight 8 bit colorant values to be stored inside
@@ -405,19 +404,19 @@ typedef gx_color_index comp_bit_map_t;
#define COMP_BIT_MAP_SIZE \
((GX_DEVICE_COLOR_MAX_COMPONENTS + COMP_BIT_MAP_ELEM_MASK) / \
- BITS_PER_COMP_BIT_MAP_ELEM)
+ BITS_PER_COMP_BIT_MAP_ELEM)
/* Bit map list of colorants in the gx_color_index value */
typedef comp_bit_map_elem_t comp_bit_map_t[COMP_BIT_MAP_SIZE];
#define set_colorant_present(pbit_map, comp_list, comp_num)\
(pbit_map)->comp_list[comp_num / BITS_PER_COMP_BIT_MAP_ELEM] |=\
- (1 << (comp_num & COMP_BIT_MAP_ELEM_MASK))
+ (1 << (comp_num & COMP_BIT_MAP_ELEM_MASK))
#define clear_colorant_present(pbit_map, comp_list, comp_num)\
(pbit_map)->comp_list[comp_num / BITS_PER_COMP_BIT_MAP_ELEM] &=\
- ~(1 << (comp_num & COMP_BIT_MAP_ELEM_MASK))
+ ~(1 << (comp_num & COMP_BIT_MAP_ELEM_MASK))
#define colorant_present(pbit_map, comp_list, comp_num)\
((pbit_map)->comp_list[comp_num / BITS_PER_COMP_BIT_MAP_ELEM] >>\
- ((comp_num & COMP_BIT_MAP_ELEM_MASK)) & 1)
+ ((comp_num & COMP_BIT_MAP_ELEM_MASK)) & 1)
/*
* The compare bit map soutine is too complex for s simple macro.
* So it is comditionally compiled using this switch.
@@ -468,8 +467,8 @@ typedef struct compressed_color_list_s {
* bit map but not both.
*/
union {
- struct compressed_color_list_s * sub_level_ptrs[NUM_ENCODE_LIST_ITEMS];
- comp_bit_map_list_t comp_data[NUM_ENCODE_LIST_ITEMS];
+ struct compressed_color_list_s * sub_level_ptrs[NUM_ENCODE_LIST_ITEMS];
+ comp_bit_map_list_t comp_data[NUM_ENCODE_LIST_ITEMS];
} u;
} compressed_color_list_t;
@@ -487,7 +486,7 @@ typedef struct compressed_color_list_s {
* value.
*/
gx_color_index devn_encode_compressed_color(gx_device *pdev,
- const gx_color_value colors[], gs_devn_params * pdevn_params);
+ const gx_color_value colors[], gs_devn_params * pdevn_params);
/*
* Decode a gx_color_index value back to a list of colorant values. This
@@ -499,7 +498,7 @@ gx_color_index devn_encode_compressed_color(gx_device *pdev,
* value.
*/
int devn_decode_compressed_color(gx_device * dev, gx_color_index color,
- gx_color_value * out, gs_devn_params * pdevn_params);
+ gx_color_value * out, gs_devn_params * pdevn_params);
/*
* Unpack a row of 'encoded color' values. These values are encoded as
@@ -512,19 +511,19 @@ int devn_decode_compressed_color(gx_device * dev, gx_color_index color,
* about how we encode the color information into a gx_color_index value.
*/
int devn_unpack_row(gx_device * dev, int num_comp, gs_devn_params * pdevn_params,
- int width, byte * in, byte * out);
+ int width, byte * in, byte * out);
/*
* Find the bit map for given bit map index.
*/
comp_bit_map_list_t * find_bit_map(gx_color_index index,
- compressed_color_list_t * pcomp_list);
+ compressed_color_list_t * pcomp_list);
/*
* Allocate an list level element for our encode color list.
*/
compressed_color_list_t * alloc_compressed_color_list_elem(gs_memory_t * mem,
- int num_comps);
+ int num_comps);
/*
* The elements of this array contain the number of bits used to encode a color
@@ -557,7 +556,7 @@ void print_compressed_color_list(compressed_color_list_t * pcomp_list, int num_c
* Free the elements of a compressed color list.
*/
void free_compressed_color_list(gs_memory_t * mem,
- compressed_color_list_t * pcomp_list);
+ compressed_color_list_t * pcomp_list);
/*
* Free a set of separation names
diff --git a/gs/base/gdevdfax.c b/gs/base/gdevdfax.c
index 903810583..f3f99179e 100644
--- a/gs/base/gdevdfax.c
+++ b/gs/base/gdevdfax.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,10 +32,10 @@ static dev_proc_open_device(dfax_prn_open);
static dev_proc_print_page(dfax_print_page);
struct gx_device_dfax_s {
- gx_device_common;
- gx_prn_device_common;
- long pageno;
- uint iwidth; /* width of image data in pixels */
+ gx_device_common;
+ gx_prn_device_common;
+ long pageno;
+ uint iwidth; /* width of image data in pixels */
};
typedef struct gx_device_dfax_s gx_device_dfax;
@@ -44,18 +44,18 @@ static gx_device_procs dfax_procs =
gx_device_dfax far_data gs_dfaxlow_device =
{ prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxlow",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI/2,
- 0,0,0,0, /* margins */
- 1, dfax_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI/2,
+ 0,0,0,0, /* margins */
+ 1, dfax_print_page)
};
gx_device_dfax far_data gs_dfaxhigh_device =
{ prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxhigh",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 1, dfax_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 1, dfax_print_page)
};
#define dfdev ((gx_device_dfax *)dev)
@@ -64,39 +64,39 @@ gx_device_dfax far_data gs_dfaxhigh_device =
static int
dfax_prn_open(gx_device *dev)
{ dfdev->pageno = 0;
- return gdev_fax_open(dev);
+ return gdev_fax_open(dev);
}
/* Print a DigiFAX page. */
static int
dfax_print_page(gx_device_printer *dev, FILE *prn_stream)
{ stream_CFE_state state;
- static char hdr[64] = "\000PC Research, Inc\000\000\000\000\000\000";
- int code;
-
- gdev_fax_init_state(&state, (gx_device_fax *)dev);
- state.EndOfLine = true;
- state.EncodedByteAlign = true;
-
- /* Start a page: write the header */
- hdr[24] = 0; hdr[28] = 1;
- hdr[26] = ++dfdev->pageno; hdr[27] = dfdev->pageno >> 8;
- if (dev->y_pixels_per_inch == Y_DPI)
- { hdr[45] = 0x40; hdr[29] = 1; } /* high res */
- else
- { hdr[45] = hdr[29] = 0; } /* low res */
- fseek(prn_stream, 0, SEEK_END);
- fwrite(hdr, sizeof(hdr), 1, prn_stream);
-
- /* Write the page */
- code = gdev_fax_print_page(dev, prn_stream, &state);
-
- /* Fixup page count */
- fseek(prn_stream, 24L, SEEK_SET);
- hdr[24] = dfdev->pageno; hdr[25] = dfdev->pageno >> 8;
- fwrite(hdr+24, 2, 1, prn_stream);
-
- return code;
+ static char hdr[64] = "\000PC Research, Inc\000\000\000\000\000\000";
+ int code;
+
+ gdev_fax_init_state(&state, (gx_device_fax *)dev);
+ state.EndOfLine = true;
+ state.EncodedByteAlign = true;
+
+ /* Start a page: write the header */
+ hdr[24] = 0; hdr[28] = 1;
+ hdr[26] = ++dfdev->pageno; hdr[27] = dfdev->pageno >> 8;
+ if (dev->y_pixels_per_inch == Y_DPI)
+ { hdr[45] = 0x40; hdr[29] = 1; } /* high res */
+ else
+ { hdr[45] = hdr[29] = 0; } /* low res */
+ fseek(prn_stream, 0, SEEK_END);
+ fwrite(hdr, sizeof(hdr), 1, prn_stream);
+
+ /* Write the page */
+ code = gdev_fax_print_page(dev, prn_stream, &state);
+
+ /* Fixup page count */
+ fseek(prn_stream, 24L, SEEK_SET);
+ hdr[24] = dfdev->pageno; hdr[25] = dfdev->pageno >> 8;
+ fwrite(hdr+24, 2, 1, prn_stream);
+
+ return code;
}
#undef dfdev
diff --git a/gs/base/gdevdflt.c b/gs/base/gdevdflt.c
index ffb0e9e82..b45ee6108 100644
--- a/gs/base/gdevdflt.c
+++ b/gs/base/gdevdflt.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,6 @@ set_cinfo_polarity(gx_device * dev, gx_color_polarity_t new_polarity)
dev->color_info.polarity = new_polarity;
}
-
static gx_color_index
(*get_encode_color(gx_device *dev))(gx_device *, const gx_color_value *)
{
@@ -54,11 +53,11 @@ static gx_color_index
/* use encode_color if it has been provided */
if ((encode_proc = dev_proc(dev, encode_color)) == 0) {
- if (dev->color_info.num_components == 1 &&
- dev_proc(dev, map_rgb_color) != 0) {
- set_cinfo_polarity(dev, GX_CINFO_POLARITY_ADDITIVE);
- encode_proc = gx_backwards_compatible_gray_encode;
- } else if ( (dev->color_info.num_components == 3 ) &&
+ if (dev->color_info.num_components == 1 &&
+ dev_proc(dev, map_rgb_color) != 0) {
+ set_cinfo_polarity(dev, GX_CINFO_POLARITY_ADDITIVE);
+ encode_proc = gx_backwards_compatible_gray_encode;
+ } else if ( (dev->color_info.num_components == 3 ) &&
(encode_proc = dev_proc(dev, map_rgb_color)) != 0 )
set_cinfo_polarity(dev, GX_CINFO_POLARITY_ADDITIVE);
else if ( dev->color_info.num_components == 4 &&
@@ -236,7 +235,7 @@ gx_default_cmyk_decode_color(
{
/* The device may have been determined to be 'separable'. */
if (dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN)
- return gx_default_decode_color(dev, color, cv);
+ return gx_default_decode_color(dev, color, cv);
else {
int i, code = dev_proc(dev, map_color_rgb)(dev, color, cv);
gx_color_value min_val = gx_max_color_value;
@@ -289,7 +288,7 @@ static int
if (is_like_DeviceRGB(dev))
return dev_proc(dev, map_color_rgb);
- /* If separable ande linear then use default */
+ /* If separable ande linear then use default */
if ( dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN )
return &gx_default_decode_color;
@@ -352,7 +351,7 @@ set_linear_color_bits_mask_shift(gx_device * dev)
#define comp_shift (dev->color_info.comp_shift)
comp_shift[num_components - 1] = 0;
for ( i = num_components - 1 - 1; i >= 0; i-- ) {
- comp_shift[i] = comp_shift[i + 1] +
+ comp_shift[i] = comp_shift[i + 1] +
( i == gray_index ? ilog2(max_gray + 1) : ilog2(max_color + 1) );
}
for ( i = 0; i < num_components; i++ ) {
@@ -405,10 +404,10 @@ check_device_separable(gx_device * dev)
/* If this is already known then we do not need to do anything. */
if (pinfo->separable_and_linear != GX_CINFO_UNKNOWN_SEP_LIN)
- return;
+ return;
/* If there is not an encode_color_routine then we cannot proceed. */
if (dev_proc(dev, encode_color) == NULL)
- return;
+ return;
/*
* If these values do not check then we should have an error. However
* we do not know what to do so we are simply exitting and hoping that
@@ -416,10 +415,10 @@ check_device_separable(gx_device * dev)
*/
if (pinfo->gray_index < num_components &&
(!pinfo->dither_grays || pinfo->dither_grays != (pinfo->max_gray + 1)))
- return;
+ return;
if ((num_components > 1 || pinfo->gray_index != 0) &&
- (!pinfo->dither_colors || pinfo->dither_colors != (pinfo->max_color + 1)))
- return;
+ (!pinfo->dither_colors || pinfo->dither_colors != (pinfo->max_color + 1)))
+ return;
/*
* If dither_grays or dither_colors is not a power of two then we assume
* that the device is not separable. In theory this not a requirement
@@ -427,57 +426,57 @@ check_device_separable(gx_device * dev)
* This assumption also makes the logic in the next section easier.
*/
if (!is_power_of_two(pinfo->dither_grays)
- || !is_power_of_two(pinfo->dither_colors))
- return;
+ || !is_power_of_two(pinfo->dither_colors))
+ return;
/*
* Use the encode_color routine to try to verify that the device is
* separable and to determine the shift count, etc. for each colorant.
- */
+ */
color_index = dev_proc(dev, encode_color)(dev, colorants);
if (color_index != 0)
- return; /* Exit if zero colorants produce a non zero index */
+ return; /* Exit if zero colorants produce a non zero index */
for (i = 0; i < num_components; i++) {
- /* Check this colorant = max with all others = 0 */
+ /* Check this colorant = max with all others = 0 */
for (j = 0; j < num_components; j++)
- colorants[j] = 0;
- colorants[i] = gx_max_color_value;
- color_index = dev_proc(dev, encode_color)(dev, colorants);
- if (color_index == 0) /* If no bits then we have a problem */
- return;
- if (color_index & current_bits) /* Check for overlapping bits */
- return;
- current_bits |= color_index;
- comp_mask[i] = color_index;
- /* Determine the shift count for the colorant */
- for (j = 0; (color_index & 1) == 0 && color_index != 0; j++)
- color_index >>= 1;
- comp_shift[i] = j;
- /* Determine the bit count for the colorant */
- for (j = 0; color_index != 0; j++) {
- if ((color_index & 1) == 0) /* check for non-consecutive bits */
- return;
- color_index >>= 1;
- }
- comp_bits[i] = j;
- /*
- * We could verify that the bit count matches the dither_grays or
- * dither_colors values, but this is not really required unless we
- * are halftoning. Thus we are allowing for non equal colorant sizes.
- */
- /* Check for overlap with other colorant if they are all maxed */
+ colorants[j] = 0;
+ colorants[i] = gx_max_color_value;
+ color_index = dev_proc(dev, encode_color)(dev, colorants);
+ if (color_index == 0) /* If no bits then we have a problem */
+ return;
+ if (color_index & current_bits) /* Check for overlapping bits */
+ return;
+ current_bits |= color_index;
+ comp_mask[i] = color_index;
+ /* Determine the shift count for the colorant */
+ for (j = 0; (color_index & 1) == 0 && color_index != 0; j++)
+ color_index >>= 1;
+ comp_shift[i] = j;
+ /* Determine the bit count for the colorant */
+ for (j = 0; color_index != 0; j++) {
+ if ((color_index & 1) == 0) /* check for non-consecutive bits */
+ return;
+ color_index >>= 1;
+ }
+ comp_bits[i] = j;
+ /*
+ * We could verify that the bit count matches the dither_grays or
+ * dither_colors values, but this is not really required unless we
+ * are halftoning. Thus we are allowing for non equal colorant sizes.
+ */
+ /* Check for overlap with other colorant if they are all maxed */
for (j = 0; j < num_components; j++)
- colorants[j] = gx_max_color_value;
- colorants[i] = 0;
- color_index = dev_proc(dev, encode_color)(dev, colorants);
- if (color_index & comp_mask[i]) /* Check for overlapping bits */
- return;
+ colorants[j] = gx_max_color_value;
+ colorants[i] = 0;
+ color_index = dev_proc(dev, encode_color)(dev, colorants);
+ if (color_index & comp_mask[i]) /* Check for overlapping bits */
+ return;
}
/* If we get to here then the device is very likely to be separable. */
pinfo->separable_and_linear = GX_CINFO_SEP_LIN;
for (i = 0; i < num_components; i++) {
- pinfo->comp_shift[i] = comp_shift[i];
- pinfo->comp_bits[i] = comp_bits[i];
- pinfo->comp_mask[i] = comp_mask[i];
+ pinfo->comp_shift[i] = comp_shift[i];
+ pinfo->comp_bits[i] = comp_bits[i];
+ pinfo->comp_mask[i] = comp_mask[i];
}
/*
* The 'gray_index' value allows one colorant to have a different number
@@ -487,11 +486,11 @@ check_device_separable(gx_device * dev)
* and dither_grays to 1. This is not valid so ignore this case.
*/
for (i = 0; i < num_components; i++) {
- int dither = 1 << comp_bits[i];
+ int dither = 1 << comp_bits[i];
- if (pinfo->dither_grays != 1 && dither == pinfo->dither_grays) {
- pinfo->gray_index = i;
- break;
+ if (pinfo->dither_grays != 1 && dither == pinfo->dither_grays) {
+ pinfo->gray_index = i;
+ break;
}
}
}
@@ -542,16 +541,16 @@ gx_device_fill_in_procs(register gx_device * dev)
#ifdef DEBUG
# define CHECK_NON_DEFAULT(proc, default, procname)\
BEGIN\
- if ( dev_proc(dev, proc) != NULL && dev_proc(dev, proc) != default )\
- dprintf2("**** Warning: device %s implements obsolete procedure %s\n",\
- dev->dname, procname);\
+ if ( dev_proc(dev, proc) != NULL && dev_proc(dev, proc) != default )\
+ dprintf2("**** Warning: device %s implements obsolete procedure %s\n",\
+ dev->dname, procname);\
END
#else
# define CHECK_NON_DEFAULT(proc, default, procname)\
DO_NOTHING
#endif
CHECK_NON_DEFAULT(get_alpha_bits, gx_default_get_alpha_bits,
- "get_alpha_bits");
+ "get_alpha_bits");
set_dev_proc(dev, get_alpha_bits, gx_default_get_alpha_bits);
CHECK_NON_DEFAULT(image_data, gx_default_image_data, "image_data");
set_dev_proc(dev, image_data, gx_default_image_data);
@@ -571,9 +570,9 @@ gx_device_fill_in_procs(register gx_device * dev)
set_dev_proc(dev, encode_color, get_encode_color(dev));
if (dev->color_info.num_components == 3)
- set_dev_proc(dev, map_rgb_color, dev_proc(dev, encode_color));
+ set_dev_proc(dev, map_rgb_color, dev_proc(dev, encode_color));
if (dev->color_info.num_components == 4)
- set_dev_proc(dev, map_cmyk_color, dev_proc(dev, encode_color));
+ set_dev_proc(dev, map_cmyk_color, dev_proc(dev, encode_color));
if ( dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN ) {
fill_dev_proc(dev, encode_color, gx_default_encode_color);
@@ -596,25 +595,25 @@ gx_device_fill_in_procs(register gx_device * dev)
*/
switch (dev->color_info.num_components) {
case 1: /* DeviceGray or DeviceInvertGray */
- if (dev_proc(dev, get_color_mapping_procs) == NULL) {
- /*
- * If not gray then the device must provide the color
- * mapping procs.
- */
- if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) {
- fill_dev_proc( dev,
+ if (dev_proc(dev, get_color_mapping_procs) == NULL) {
+ /*
+ * If not gray then the device must provide the color
+ * mapping procs.
+ */
+ if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) {
+ fill_dev_proc( dev,
get_color_mapping_procs,
gx_default_DevGray_get_color_mapping_procs );
} else
- fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
- }
+ fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
+ }
fill_dev_proc( dev,
get_color_comp_index,
gx_default_DevGray_get_color_comp_index );
break;
case 3:
- if (dev_proc(dev, get_color_mapping_procs) == NULL) {
+ if (dev_proc(dev, get_color_mapping_procs) == NULL) {
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) {
fill_dev_proc( dev,
get_color_mapping_procs,
@@ -623,9 +622,9 @@ gx_device_fill_in_procs(register gx_device * dev)
get_color_comp_index,
gx_default_DevRGB_get_color_comp_index );
} else {
- fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
- fill_dev_proc(dev, get_color_comp_index, gx_error_get_color_comp_index);
- }
+ fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
+ fill_dev_proc(dev, get_color_comp_index, gx_error_get_color_comp_index);
+ }
}
break;
@@ -634,10 +633,10 @@ gx_device_fill_in_procs(register gx_device * dev)
fill_dev_proc(dev, get_color_comp_index, gx_default_DevCMYK_get_color_comp_index);
break;
default: /* Unknown color model - set error handlers */
- if (dev_proc(dev, get_color_mapping_procs) == NULL) {
- fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
- fill_dev_proc(dev, get_color_comp_index, gx_error_get_color_comp_index);
- }
+ if (dev_proc(dev, get_color_mapping_procs) == NULL) {
+ fill_dev_proc(dev, get_color_mapping_procs, gx_error_get_color_mapping_procs);
+ fill_dev_proc(dev, get_color_comp_index, gx_error_get_color_comp_index);
+ }
}
set_dev_proc(dev, decode_color, get_decode_color(dev));
@@ -651,10 +650,10 @@ gx_device_fill_in_procs(register gx_device * dev)
* explicit check until this information is explicitly required.
*/
if ( dev->color_info.opmode == GX_CINFO_OPMODE_UNKNOWN &&
- (dev->color_info.num_components < 4 ||
+ (dev->color_info.num_components < 4 ||
dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE ||
dev->color_info.gray_index == GX_CINFO_COMP_NO_INDEX ) )
- dev->color_info.opmode = GX_CINFO_OPMODE_NOT;
+ dev->color_info.opmode = GX_CINFO_OPMODE_NOT;
fill_dev_proc(dev, fill_rectangle_hl_color, gx_default_fill_rectangle_hl_color);
fill_dev_proc(dev, include_color_space, gx_default_include_color_space);
@@ -722,8 +721,8 @@ gx_default_get_initial_matrix(gx_device * dev, register gs_matrix * pmat)
pmat->yy = -ss_res;
pmat->tx = 0;
pmat->ty = (float)dev->height;
- /****** tx/y is WRONG for devices with ******/
- /****** arbitrary initial matrix ******/
+ /****** tx/y is WRONG for devices with ******/
+ /****** arbitrary initial matrix ******/
break;
}
}
@@ -754,7 +753,7 @@ gx_default_output_page(gx_device * dev, int num_copies, int flush)
int code = dev_proc(dev, sync_output)(dev);
if (code >= 0)
- code = gx_finish_output_page(dev, num_copies, flush);
+ code = gx_finish_output_page(dev, num_copies, flush);
return code;
}
@@ -791,7 +790,7 @@ int
gx_default_get_alpha_bits(gx_device * dev, graphics_object_type type)
{
return (type == go_text ? dev->color_info.anti_alias.text_bits :
- dev->color_info.anti_alias.graphics_bits);
+ dev->color_info.anti_alias.graphics_bits);
}
int
@@ -819,25 +818,25 @@ gx_get_largest_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
int
gx_no_create_compositor(gx_device * dev, gx_device ** pcdev,
- const gs_composite_t * pcte,
- gs_imager_state * pis, gs_memory_t * memory,
+ const gs_composite_t * pcte,
+ gs_imager_state * pis, gs_memory_t * memory,
gx_device *cdev)
{
return_error(gs_error_unknownerror); /* not implemented */
}
int
gx_default_create_compositor(gx_device * dev, gx_device ** pcdev,
- const gs_composite_t * pcte,
- gs_imager_state * pis, gs_memory_t * memory,
+ const gs_composite_t * pcte,
+ gs_imager_state * pis, gs_memory_t * memory,
gx_device *cdev)
{
return pcte->type->procs.create_default_compositor
- (pcte, pcdev, dev, pis, memory);
+ (pcte, pcdev, dev, pis, memory);
}
int
gx_null_create_compositor(gx_device * dev, gx_device ** pcdev,
- const gs_composite_t * pcte,
- gs_imager_state * pis, gs_memory_t * memory,
+ const gs_composite_t * pcte,
+ gs_imager_state * pis, gs_memory_t * memory,
gx_device *cdev)
{
*pcdev = dev;
@@ -848,7 +847,7 @@ gx_null_create_compositor(gx_device * dev, gx_device ** pcdev,
* Default handler for creating a compositor device when writing the clist. */
int
gx_default_composite_clist_write_update(const gs_composite_t *pcte, gx_device * dev,
- gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem)
+ gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem)
{
*pcdev = dev; /* Do nothing -> return the same device */
return 0;
@@ -862,7 +861,7 @@ gx_default_composite_adjust_ctm(gs_composite_t *pcte, int x0, int y0, gs_imager_
}
/*
- * Default check for closing compositor.
+ * Default check for closing compositor.
*/
int
gx_default_composite_is_closing(const gs_composite_t *this, gs_composite_t **pcte, gx_device *dev)
@@ -885,7 +884,7 @@ gx_default_composite_is_friendly(const gs_composite_t *this, byte cmd0, byte cmd
*/
int
gx_default_composite_clist_read_update(gs_composite_t *pxcte, gx_device * cdev,
- gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem)
+ gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem)
{
return 0; /* Do nothing */
}
@@ -930,8 +929,8 @@ gx_default_dev_spec_op(gx_device *pdev, int dev_spec_op, void *data, int size)
}
int
-gx_default_fill_rectangle_hl_color(gx_device *pdev,
- const gs_fixed_rect *rect,
+gx_default_fill_rectangle_hl_color(gx_device *pdev,
+ const gs_fixed_rect *rect,
const gs_imager_state *pis, const gx_drawing_color *pdcolor,
const gx_clip_path *pcpath)
{
@@ -939,8 +938,8 @@ gx_default_fill_rectangle_hl_color(gx_device *pdev,
}
int
-gx_default_include_color_space(gx_device *pdev, gs_color_space *cspace,
- const byte *res_name, int name_length)
+gx_default_include_color_space(gx_device *pdev, gs_color_space *cspace,
+ const byte *res_name, int name_length)
{
return 0;
}
diff --git a/gs/base/gdevdgbr.c b/gs/base/gdevdgbr.c
index 6c1f41b84..f8fad2489 100644
--- a/gs/base/gdevdgbr.c
+++ b/gs/base/gdevdgbr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,9 +30,9 @@ gx_no_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
int
gx_default_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
{ /*
- * Hand off to get_bits_rectangle, being careful to avoid a
- * possible recursion loop.
- */
+ * Hand off to get_bits_rectangle, being careful to avoid a
+ * possible recursion loop.
+ */
dev_proc_get_bits((*save_get_bits)) = dev_proc(dev, get_bits);
gs_int_rect rect;
gs_get_bits_params_t params;
@@ -41,18 +41,18 @@ gx_default_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
rect.p.x = 0, rect.p.y = y;
rect.q.x = dev->width, rect.q.y = y + 1;
params.options =
- (actual_data ? GB_RETURN_POINTER : 0) | GB_RETURN_COPY |
- (GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_RASTER_STANDARD |
+ (actual_data ? GB_RETURN_POINTER : 0) | GB_RETURN_COPY |
+ (GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_RASTER_STANDARD |
/* No depth specified, we always use native colors. */
- GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE);
+ GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE);
params.x_offset = 0;
params.raster = bitmap_raster(dev->width * dev->color_info.depth);
params.data[0] = data;
set_dev_proc(dev, get_bits, gx_no_get_bits);
code = (*dev_proc(dev, get_bits_rectangle))
- (dev, &rect, &params, NULL);
+ (dev, &rect, &params, NULL);
if (actual_data)
- *actual_data = params.data[0];
+ *actual_data = params.data[0];
set_dev_proc(dev, get_bits, save_get_bits);
return code;
}
@@ -63,35 +63,35 @@ gx_default_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
*/
static bool
requested_includes_stored(const gx_device *dev,
- const gs_get_bits_params_t *requested,
- const gs_get_bits_params_t *stored)
+ const gs_get_bits_params_t *requested,
+ const gs_get_bits_params_t *stored)
{
gs_get_bits_options_t both = requested->options & stored->options;
if (!(both & GB_PACKING_ALL))
- return false;
+ return false;
if (stored->options & GB_SELECT_PLANES) {
- /*
- * The device only provides a subset of the planes.
- * Make sure it provides all the requested ones.
- */
- int i;
- int n = (stored->options & GB_PACKING_BIT_PLANAR ?
- dev->color_info.depth : dev->color_info.num_components);
-
- if (!(requested->options & GB_SELECT_PLANES) ||
- !(both & (GB_PACKING_PLANAR || GB_PACKING_BIT_PLANAR))
- )
- return false;
- for (i = 0; i < n; ++i)
- if (requested->data[i] && !stored->data[i])
- return false;
+ /*
+ * The device only provides a subset of the planes.
+ * Make sure it provides all the requested ones.
+ */
+ int i;
+ int n = (stored->options & GB_PACKING_BIT_PLANAR ?
+ dev->color_info.depth : dev->color_info.num_components);
+
+ if (!(requested->options & GB_SELECT_PLANES) ||
+ !(both & (GB_PACKING_PLANAR || GB_PACKING_BIT_PLANAR))
+ )
+ return false;
+ for (i = 0; i < n; ++i)
+ if (requested->data[i] && !stored->data[i])
+ return false;
}
if (both & GB_COLORS_NATIVE)
- return true;
+ return true;
if (both & GB_COLORS_STANDARD_ALL) {
- if ((both & GB_ALPHA_ALL) && (both & GB_DEPTH_ALL))
- return true;
+ if ((both & GB_ALPHA_ALL) && (both & GB_DEPTH_ALL))
+ return true;
}
return false;
}
@@ -104,17 +104,17 @@ requested_includes_stored(const gx_device *dev,
*/
int
gx_get_bits_return_pointer(gx_device * dev, int x, int h,
- gs_get_bits_params_t *params,
- const gs_get_bits_params_t *stored,
- byte * stored_base)
+ gs_get_bits_params_t *params,
+ const gs_get_bits_params_t *stored,
+ byte * stored_base)
{
gs_get_bits_options_t options = params->options;
gs_get_bits_options_t both = options & stored->options;
if (!(options & GB_RETURN_POINTER) ||
- !requested_includes_stored(dev, params, stored)
- )
- return -1;
+ !requested_includes_stored(dev, params, stored)
+ )
+ return -1;
/*
* See whether we can return the bits in place. Note that even if
* OFFSET_ANY isn't set, x_offset and x don't have to be equal: their
@@ -123,79 +123,79 @@ gx_get_bits_return_pointer(gx_device * dev, int x, int h,
* byte alignment is always required) if ALIGN_ANY is set.
*/
{
- int depth = dev->color_info.depth;
- /*
- * For PLANAR devices, we assume that each plane consists of
- * depth/num_components bits. This is wrong in general, but if
- * the device wants something else, it should implement
- * get_bits_rectangle itself.
- */
- uint dev_raster =
- (both & GB_PACKING_CHUNKY ?
- gx_device_raster(dev, true) :
- both & GB_PACKING_PLANAR ?
- bitmap_raster(dev->color_info.depth /
- dev->color_info.num_components * dev->width) :
- both & GB_PACKING_BIT_PLANAR ?
- bitmap_raster(dev->width) :
- 0 /* not possible */);
- uint raster =
- (options & (GB_RASTER_STANDARD | GB_RASTER_ANY) ? dev_raster :
- params->raster);
- byte *base;
-
- if (h <= 1 || raster == dev_raster) {
- int x_offset =
- (options & GB_OFFSET_ANY ? x :
- options & GB_OFFSET_0 ? 0 : params->x_offset);
-
- if (x_offset == x) {
- base = stored_base;
- params->x_offset = x;
- } else {
- uint align_mod =
- (options & GB_ALIGN_ANY ? 8 : align_bitmap_mod * 8);
- int bit_offset = x - x_offset;
- int bytes;
-
- if (bit_offset & (align_mod - 1))
- return -1; /* can't align */
- if (depth & (depth - 1)) {
- /* step = lcm(depth, align_mod) */
- int step = depth / igcd(depth, align_mod) * align_mod;
-
- bytes = bit_offset / step * step;
- } else {
- /* Use a faster algorithm if depth is a power of 2. */
- bytes = bit_offset & (-depth & -(int)align_mod);
- }
- base = stored_base + arith_rshift(bytes, 3);
- params->x_offset = (bit_offset - bytes) / depth;
- }
- params->options =
- GB_ALIGN_STANDARD | GB_RETURN_POINTER | GB_RASTER_STANDARD |
- (stored->options & ~GB_PACKING_ALL) /*see below for PACKING*/ |
- (params->x_offset == 0 ? GB_OFFSET_0 : GB_OFFSET_SPECIFIED);
- if (both & GB_PACKING_CHUNKY) {
- params->options |= GB_PACKING_CHUNKY;
- params->data[0] = base;
- } else {
- int n =
- (stored->options & GB_PACKING_BIT_PLANAR ?
- (params->options |= GB_PACKING_BIT_PLANAR,
- dev->color_info.depth) :
- (params->options |= GB_PACKING_PLANAR,
- dev->color_info.num_components));
- int i;
-
- for (i = 0; i < n; ++i)
- if (!(both & GB_SELECT_PLANES) || stored->data[i] != 0) {
- params->data[i] = base;
- base += dev_raster * dev->height;
- }
- }
- return 0;
- }
+ int depth = dev->color_info.depth;
+ /*
+ * For PLANAR devices, we assume that each plane consists of
+ * depth/num_components bits. This is wrong in general, but if
+ * the device wants something else, it should implement
+ * get_bits_rectangle itself.
+ */
+ uint dev_raster =
+ (both & GB_PACKING_CHUNKY ?
+ gx_device_raster(dev, true) :
+ both & GB_PACKING_PLANAR ?
+ bitmap_raster(dev->color_info.depth /
+ dev->color_info.num_components * dev->width) :
+ both & GB_PACKING_BIT_PLANAR ?
+ bitmap_raster(dev->width) :
+ 0 /* not possible */);
+ uint raster =
+ (options & (GB_RASTER_STANDARD | GB_RASTER_ANY) ? dev_raster :
+ params->raster);
+ byte *base;
+
+ if (h <= 1 || raster == dev_raster) {
+ int x_offset =
+ (options & GB_OFFSET_ANY ? x :
+ options & GB_OFFSET_0 ? 0 : params->x_offset);
+
+ if (x_offset == x) {
+ base = stored_base;
+ params->x_offset = x;
+ } else {
+ uint align_mod =
+ (options & GB_ALIGN_ANY ? 8 : align_bitmap_mod * 8);
+ int bit_offset = x - x_offset;
+ int bytes;
+
+ if (bit_offset & (align_mod - 1))
+ return -1; /* can't align */
+ if (depth & (depth - 1)) {
+ /* step = lcm(depth, align_mod) */
+ int step = depth / igcd(depth, align_mod) * align_mod;
+
+ bytes = bit_offset / step * step;
+ } else {
+ /* Use a faster algorithm if depth is a power of 2. */
+ bytes = bit_offset & (-depth & -(int)align_mod);
+ }
+ base = stored_base + arith_rshift(bytes, 3);
+ params->x_offset = (bit_offset - bytes) / depth;
+ }
+ params->options =
+ GB_ALIGN_STANDARD | GB_RETURN_POINTER | GB_RASTER_STANDARD |
+ (stored->options & ~GB_PACKING_ALL) /*see below for PACKING*/ |
+ (params->x_offset == 0 ? GB_OFFSET_0 : GB_OFFSET_SPECIFIED);
+ if (both & GB_PACKING_CHUNKY) {
+ params->options |= GB_PACKING_CHUNKY;
+ params->data[0] = base;
+ } else {
+ int n =
+ (stored->options & GB_PACKING_BIT_PLANAR ?
+ (params->options |= GB_PACKING_BIT_PLANAR,
+ dev->color_info.depth) :
+ (params->options |= GB_PACKING_PLANAR,
+ dev->color_info.num_components));
+ int i;
+
+ for (i = 0; i < n; ++i)
+ if (!(both & GB_SELECT_PLANES) || stored->data[i] != 0) {
+ params->data[i] = base;
+ base += dev_raster * dev->height;
+ }
+ }
+ return 0;
+ }
}
return -1;
}
@@ -206,27 +206,27 @@ gx_get_bits_return_pointer(gx_device * dev, int x, int h,
*/
static void
gx_get_bits_copy_cmyk_1bit(byte *dest_line, uint dest_raster,
- const byte *src_line, uint src_raster,
- int src_bit, int w, int h)
+ const byte *src_line, uint src_raster,
+ int src_bit, int w, int h)
{
for (; h > 0; dest_line += dest_raster, src_line += src_raster, --h) {
- const byte *src = src_line;
- byte *dest = dest_line;
- bool hi = (src_bit & 4) != 0; /* last nibble processed was hi */
- int i;
-
- for (i = w; i > 0; dest += 3, --i) {
- uint pixel =
- ((hi = !hi)? *src >> 4 : *src++ & 0xf);
-
- if (pixel & 1)
- dest[0] = dest[1] = dest[2] = 0;
- else {
- dest[0] = (byte)((pixel >> 3) - 1);
- dest[1] = (byte)(((pixel >> 2) & 1) - 1);
- dest[2] = (byte)(((pixel >> 1) & 1) - 1);
- }
- }
+ const byte *src = src_line;
+ byte *dest = dest_line;
+ bool hi = (src_bit & 4) != 0; /* last nibble processed was hi */
+ int i;
+
+ for (i = w; i > 0; dest += 3, --i) {
+ uint pixel =
+ ((hi = !hi)? *src >> 4 : *src++ & 0xf);
+
+ if (pixel & 1)
+ dest[0] = dest[1] = dest[2] = 0;
+ else {
+ dest[0] = (byte)((pixel >> 3) - 1);
+ dest[1] = (byte)(((pixel >> 2) & 1) - 1);
+ dest[2] = (byte)(((pixel >> 1) & 1) - 1);
+ }
+ }
}
}
@@ -249,20 +249,20 @@ gx_get_bits_copy_cmyk_1bit(byte *dest_line, uint dest_raster,
*/
static int
gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster,
- int x_offset, uint raster),
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster,
+ int x_offset, uint raster),
gx_get_bits_native_to_std(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster,
- int x_offset, uint raster, uint std_raster);
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster,
+ int x_offset, uint raster, uint std_raster);
int
gx_get_bits_copy(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster)
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster)
{
gs_get_bits_options_t options = params->options;
gs_get_bits_options_t stored_options = stored->options;
@@ -286,110 +286,110 @@ gx_get_bits_copy(gx_device * dev, int x, int w, int h,
* include GB_COLORS_NATIVE.
*/
if ((~options & GB_RETURN_COPY) ||
- !(options & (GB_OFFSET_0 | GB_OFFSET_SPECIFIED)) ||
- !(options & (GB_RASTER_STANDARD | GB_RASTER_SPECIFIED))
- )
- return_error(gs_error_rangecheck);
+ !(options & (GB_OFFSET_0 | GB_OFFSET_SPECIFIED)) ||
+ !(options & (GB_RASTER_STANDARD | GB_RASTER_SPECIFIED))
+ )
+ return_error(gs_error_rangecheck);
if (options & GB_PACKING_CHUNKY) {
- byte *data = params->data[0];
- int end_bit = (x_offset + w) * depth;
- uint std_raster =
- (options & GB_ALIGN_STANDARD ? bitmap_raster(end_bit) :
- (end_bit + 7) >> 3);
- uint raster =
- (options & GB_RASTER_STANDARD ? std_raster : params->raster);
- int dest_bit_x = x_offset * depth;
- int skew = bit_x - dest_bit_x;
-
- /*
- * If the bit positions line up, use bytes_copy_rectangle.
- * Since bytes_copy_rectangle doesn't require alignment,
- * the bit positions only have to match within a byte,
- * not within align_bitmap_mod bytes.
- */
- if (!(skew & 7) && direct_copy) {
- int bit_w = w * depth;
-
- bytes_copy_rectangle(data + (dest_bit_x >> 3), raster,
- src + (bit_x >> 3), dev_raster,
- ((bit_x + bit_w + 7) >> 3) - (bit_x >> 3), h);
- } else if (direct_copy) {
- /*
- * Use the logic already in mem_mono_copy_mono to copy the
- * bits to the destination. We do this one line at a time,
- * to avoid having to allocate a line pointer table.
- */
- gx_device_memory tdev;
- byte *line_ptr = data;
- int bit_w = w * depth;
-
- tdev.line_ptrs = &tdev.base;
- for (; h > 0; line_ptr += raster, src += dev_raster, --h) {
- /* Make sure the destination is aligned. */
- int align = ALIGNMENT_MOD(line_ptr, align_bitmap_mod);
-
- tdev.base = line_ptr - align;
- /* set up parameters required by copy_mono's fit_copy */
- tdev.width = dest_bit_x + (align << 3) + bit_w;
- tdev.height = 1;
- (*dev_proc(&mem_mono_device, copy_mono))
- ((gx_device *) & tdev, src, bit_x, dev_raster, gx_no_bitmap_id,
- dest_bit_x + (align << 3), 0, bit_w, 1,
- (gx_color_index) 0, (gx_color_index) 1);
- }
- } else if (options & ~stored_options & GB_COLORS_NATIVE) {
- /* Convert standard colors to native. */
- code = gx_get_bits_std_to_native(dev, x, w, h, params, stored,
- src_base, dev_raster,
- x_offset, raster);
- options = params->options;
- } else {
- /* Convert native colors to standard. */
- code = gx_get_bits_native_to_std(dev, x, w, h, params, stored,
- src_base, dev_raster,
- x_offset, raster, std_raster);
- options = params->options;
- }
- params->options =
- (options & (GB_COLORS_ALL | GB_ALPHA_ALL)) | GB_PACKING_CHUNKY |
- (options & GB_COLORS_NATIVE ? 0 : options & GB_DEPTH_ALL) |
- (options & GB_ALIGN_STANDARD ? GB_ALIGN_STANDARD : GB_ALIGN_ANY) |
- GB_RETURN_COPY |
- (x_offset == 0 ? GB_OFFSET_0 : GB_OFFSET_SPECIFIED) |
- (raster == std_raster ? GB_RASTER_STANDARD : GB_RASTER_SPECIFIED);
+ byte *data = params->data[0];
+ int end_bit = (x_offset + w) * depth;
+ uint std_raster =
+ (options & GB_ALIGN_STANDARD ? bitmap_raster(end_bit) :
+ (end_bit + 7) >> 3);
+ uint raster =
+ (options & GB_RASTER_STANDARD ? std_raster : params->raster);
+ int dest_bit_x = x_offset * depth;
+ int skew = bit_x - dest_bit_x;
+
+ /*
+ * If the bit positions line up, use bytes_copy_rectangle.
+ * Since bytes_copy_rectangle doesn't require alignment,
+ * the bit positions only have to match within a byte,
+ * not within align_bitmap_mod bytes.
+ */
+ if (!(skew & 7) && direct_copy) {
+ int bit_w = w * depth;
+
+ bytes_copy_rectangle(data + (dest_bit_x >> 3), raster,
+ src + (bit_x >> 3), dev_raster,
+ ((bit_x + bit_w + 7) >> 3) - (bit_x >> 3), h);
+ } else if (direct_copy) {
+ /*
+ * Use the logic already in mem_mono_copy_mono to copy the
+ * bits to the destination. We do this one line at a time,
+ * to avoid having to allocate a line pointer table.
+ */
+ gx_device_memory tdev;
+ byte *line_ptr = data;
+ int bit_w = w * depth;
+
+ tdev.line_ptrs = &tdev.base;
+ for (; h > 0; line_ptr += raster, src += dev_raster, --h) {
+ /* Make sure the destination is aligned. */
+ int align = ALIGNMENT_MOD(line_ptr, align_bitmap_mod);
+
+ tdev.base = line_ptr - align;
+ /* set up parameters required by copy_mono's fit_copy */
+ tdev.width = dest_bit_x + (align << 3) + bit_w;
+ tdev.height = 1;
+ (*dev_proc(&mem_mono_device, copy_mono))
+ ((gx_device *) & tdev, src, bit_x, dev_raster, gx_no_bitmap_id,
+ dest_bit_x + (align << 3), 0, bit_w, 1,
+ (gx_color_index) 0, (gx_color_index) 1);
+ }
+ } else if (options & ~stored_options & GB_COLORS_NATIVE) {
+ /* Convert standard colors to native. */
+ code = gx_get_bits_std_to_native(dev, x, w, h, params, stored,
+ src_base, dev_raster,
+ x_offset, raster);
+ options = params->options;
+ } else {
+ /* Convert native colors to standard. */
+ code = gx_get_bits_native_to_std(dev, x, w, h, params, stored,
+ src_base, dev_raster,
+ x_offset, raster, std_raster);
+ options = params->options;
+ }
+ params->options =
+ (options & (GB_COLORS_ALL | GB_ALPHA_ALL)) | GB_PACKING_CHUNKY |
+ (options & GB_COLORS_NATIVE ? 0 : options & GB_DEPTH_ALL) |
+ (options & GB_ALIGN_STANDARD ? GB_ALIGN_STANDARD : GB_ALIGN_ANY) |
+ GB_RETURN_COPY |
+ (x_offset == 0 ? GB_OFFSET_0 : GB_OFFSET_SPECIFIED) |
+ (raster == std_raster ? GB_RASTER_STANDARD : GB_RASTER_SPECIFIED);
} else if (!(~options &
- (GB_PACKING_PLANAR | GB_SELECT_PLANES | GB_ALIGN_STANDARD)) &&
- (stored_options & GB_PACKING_CHUNKY) &&
- ((options & stored_options) & GB_COLORS_NATIVE)
- ) {
- int num_planes = dev->color_info.num_components;
- int dest_depth = depth / num_planes;
- bits_plane_t source, dest;
- int plane = -1;
- int i;
-
- /* Make sure only one plane is being requested. */
- for (i = 0; i < num_planes; ++i)
- if (params->data[i] != 0) {
- if (plane >= 0)
- return_error(gs_error_rangecheck); /* > 1 plane */
- plane = i;
- }
- source.data.read = src_base;
- source.raster = dev_raster;
- source.depth = depth;
- source.x = x;
- dest.data.write = params->data[plane];
- dest.raster =
- (options & GB_RASTER_STANDARD ?
- bitmap_raster((x_offset + w) * dest_depth) : params->raster);
- dest.depth = dest_depth;
- dest.x = x_offset;
- return bits_extract_plane(&dest, &source,
- (num_planes - 1 - plane) * dest_depth,
- w, h);
+ (GB_PACKING_PLANAR | GB_SELECT_PLANES | GB_ALIGN_STANDARD)) &&
+ (stored_options & GB_PACKING_CHUNKY) &&
+ ((options & stored_options) & GB_COLORS_NATIVE)
+ ) {
+ int num_planes = dev->color_info.num_components;
+ int dest_depth = depth / num_planes;
+ bits_plane_t source, dest;
+ int plane = -1;
+ int i;
+
+ /* Make sure only one plane is being requested. */
+ for (i = 0; i < num_planes; ++i)
+ if (params->data[i] != 0) {
+ if (plane >= 0)
+ return_error(gs_error_rangecheck); /* > 1 plane */
+ plane = i;
+ }
+ source.data.read = src_base;
+ source.raster = dev_raster;
+ source.depth = depth;
+ source.x = x;
+ dest.data.write = params->data[plane];
+ dest.raster =
+ (options & GB_RASTER_STANDARD ?
+ bitmap_raster((x_offset + w) * dest_depth) : params->raster);
+ dest.depth = dest_depth;
+ dest.x = x_offset;
+ return bits_extract_plane(&dest, &source,
+ (num_planes - 1 - plane) * dest_depth,
+ w, h);
} else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return code;
}
@@ -399,20 +399,20 @@ gx_get_bits_copy(gx_device * dev, int x, int w, int h,
*/
static int
gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster,
- int x_offset, uint raster)
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster,
+ int x_offset, uint raster)
{
int depth = dev->color_info.depth;
int dest_bit_offset = x_offset * depth;
byte *dest_line = params->data[0] + (dest_bit_offset >> 3);
int ncolors =
- (stored->options & GB_COLORS_RGB ? 3 :
- stored->options & GB_COLORS_CMYK ? 4 :
- stored->options & GB_COLORS_GRAY ? 1 : -1);
+ (stored->options & GB_COLORS_RGB ? 3 :
+ stored->options & GB_COLORS_CMYK ? 4 :
+ stored->options & GB_COLORS_GRAY ? 1 : -1);
int ncomp = ncolors +
- ((stored->options & (GB_ALPHA_FIRST | GB_ALPHA_LAST)) != 0);
+ ((stored->options & (GB_ALPHA_FIRST | GB_ALPHA_LAST)) != 0);
int src_depth = GB_OPTIONS_DEPTH(stored->options);
int src_bit_offset = x * src_depth * ncomp;
const byte *src_line = src_base + (src_bit_offset >> 3);
@@ -422,12 +422,12 @@ gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
params->options &= ~GB_COLORS_ALL | GB_COLORS_NATIVE;
for (; h > 0; dest_line += raster, src_line += dev_raster, --h) {
- int i;
+ int i;
- sample_load_declare_setup(src, sbit, src_line,
- src_bit_offset & 7, src_depth);
- sample_store_declare_setup(dest, dbit, dbyte, dest_line,
- dest_bit_offset & 7, depth);
+ sample_load_declare_setup(src, sbit, src_line,
+ src_bit_offset & 7, src_depth);
+ sample_store_declare_setup(dest, dbit, dbyte, dest_line,
+ dest_bit_offset & 7, depth);
#define v2frac(value) ((long)(value) * frac_1 / src_max)
@@ -490,7 +490,7 @@ gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
}
sample_store_next_any(pixel, dest, dbit, depth, dbyte);
}
- sample_store_flush(dest, dbit, depth, dbyte);
+ sample_store_flush(dest, dbit, depth, dbyte);
}
return 0;
}
@@ -500,117 +500,117 @@ gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
*/
static int
gx_get_bits_native_to_std(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster,
- int x_offset, uint raster, uint std_raster)
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster,
+ int x_offset, uint raster, uint std_raster)
{
int depth = dev->color_info.depth;
int src_bit_offset = x * depth;
const byte *src_line = src_base + (src_bit_offset >> 3);
gs_get_bits_options_t options = params->options;
int ncomp =
- (options & (GB_ALPHA_FIRST | GB_ALPHA_LAST) ? 4 : 3);
+ (options & (GB_ALPHA_FIRST | GB_ALPHA_LAST) ? 4 : 3);
byte *dest_line = params->data[0] + x_offset * ncomp;
byte *mapped[16];
int dest_bytes;
int i;
if (!(options & GB_DEPTH_8)) {
- /*
- * We don't support general depths yet, or conversion between
- * different formats. Punt.
- */
- return_error(gs_error_rangecheck);
+ /*
+ * We don't support general depths yet, or conversion between
+ * different formats. Punt.
+ */
+ return_error(gs_error_rangecheck);
}
/* Pick the representation that's most likely to be useful. */
if (options & GB_COLORS_RGB)
- params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_RGB,
- dest_bytes = 3;
+ params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_RGB,
+ dest_bytes = 3;
else if (options & GB_COLORS_CMYK)
- params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_CMYK,
- dest_bytes = 4;
+ params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_CMYK,
+ dest_bytes = 4;
else if (options & GB_COLORS_GRAY)
- params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_GRAY,
- dest_bytes = 1;
+ params->options = options &= ~GB_COLORS_STANDARD_ALL | GB_COLORS_GRAY,
+ dest_bytes = 1;
else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Recompute the destination raster based on the color space. */
if (options & GB_RASTER_STANDARD) {
- uint end_byte = (x_offset + w) * dest_bytes;
+ uint end_byte = (x_offset + w) * dest_bytes;
- raster = std_raster =
- (options & GB_ALIGN_STANDARD ?
- bitmap_raster(end_byte << 3) : end_byte);
+ raster = std_raster =
+ (options & GB_ALIGN_STANDARD ?
+ bitmap_raster(end_byte << 3) : end_byte);
}
/* Check for the one special case we care about, namely that we have a
* device that uses cmyk_1bit_map_cmyk_color, or equivalent. We do not
* check function pointers directly, as this is defeated by forwarding
* devices, but rather use a dev_spec_op. */
if (((options & (GB_COLORS_RGB | GB_ALPHA_FIRST | GB_ALPHA_LAST))
- == GB_COLORS_RGB) &&
- (dev_proc(dev, dev_spec_op)(dev, gxdso_is_std_cmyk_1bit, NULL, 0) > 0)) {
- gx_get_bits_copy_cmyk_1bit(dest_line, raster,
- src_line, dev_raster,
- src_bit_offset & 7, w, h);
- return 0;
+ == GB_COLORS_RGB) &&
+ (dev_proc(dev, dev_spec_op)(dev, gxdso_is_std_cmyk_1bit, NULL, 0) > 0)) {
+ gx_get_bits_copy_cmyk_1bit(dest_line, raster,
+ src_line, dev_raster,
+ src_bit_offset & 7, w, h);
+ return 0;
}
if (options & (GB_ALPHA_FIRST | GB_ALPHA_LAST))
- ++dest_bytes;
+ ++dest_bytes;
/* Clear the color translation cache. */
for (i = (depth > 4 ? 16 : 1 << depth); --i >= 0; )
- mapped[i] = 0;
+ mapped[i] = 0;
for (; h > 0; dest_line += raster, src_line += dev_raster, --h) {
- sample_load_declare_setup(src, bit, src_line,
- src_bit_offset & 7, depth);
- byte *dest = dest_line;
-
- for (i = 0; i < w; ++i) {
- gx_color_index pixel = 0;
- gx_color_value rgba[4];
-
- sample_load_next_any(pixel, src, bit, depth);
- if (pixel < 16) {
- if (mapped[pixel]) {
- /* Use the value from the cache. */
- memcpy(dest, mapped[pixel], dest_bytes);
- dest += dest_bytes;
- continue;
- }
- mapped[pixel] = dest;
- }
- (*dev_proc(dev, map_color_rgb_alpha)) (dev, pixel, rgba);
- if (options & GB_ALPHA_FIRST)
- *dest++ = gx_color_value_to_byte(rgba[3]);
- /* Convert to the requested color space. */
- if (options & GB_COLORS_RGB) {
- dest[0] = gx_color_value_to_byte(rgba[0]);
- dest[1] = gx_color_value_to_byte(rgba[1]);
- dest[2] = gx_color_value_to_byte(rgba[2]);
- dest += 3;
- } else if (options & GB_COLORS_CMYK) {
- /* Use the standard RGB to CMYK algorithm, */
- /* with maximum black generation and undercolor removal. */
- gx_color_value white = max(rgba[0], max(rgba[1], rgba[2]));
-
- dest[0] = gx_color_value_to_byte(white - rgba[0]);
- dest[1] = gx_color_value_to_byte(white - rgba[1]);
- dest[2] = gx_color_value_to_byte(white - rgba[2]);
- dest[3] = gx_color_value_to_byte(gx_max_color_value - white);
- dest += 4;
- } else { /* GB_COLORS_GRAY */
- /* Use the standard RGB to Gray algorithm. */
- *dest++ = gx_color_value_to_byte(
- ((rgba[0] * (ulong) lum_red_weight) +
- (rgba[1] * (ulong) lum_green_weight) +
- (rgba[2] * (ulong) lum_blue_weight) +
- (lum_all_weights / 2))
- / lum_all_weights);
- }
- if (options & GB_ALPHA_LAST)
- *dest++ = gx_color_value_to_byte(rgba[3]);
- }
+ sample_load_declare_setup(src, bit, src_line,
+ src_bit_offset & 7, depth);
+ byte *dest = dest_line;
+
+ for (i = 0; i < w; ++i) {
+ gx_color_index pixel = 0;
+ gx_color_value rgba[4];
+
+ sample_load_next_any(pixel, src, bit, depth);
+ if (pixel < 16) {
+ if (mapped[pixel]) {
+ /* Use the value from the cache. */
+ memcpy(dest, mapped[pixel], dest_bytes);
+ dest += dest_bytes;
+ continue;
+ }
+ mapped[pixel] = dest;
+ }
+ (*dev_proc(dev, map_color_rgb_alpha)) (dev, pixel, rgba);
+ if (options & GB_ALPHA_FIRST)
+ *dest++ = gx_color_value_to_byte(rgba[3]);
+ /* Convert to the requested color space. */
+ if (options & GB_COLORS_RGB) {
+ dest[0] = gx_color_value_to_byte(rgba[0]);
+ dest[1] = gx_color_value_to_byte(rgba[1]);
+ dest[2] = gx_color_value_to_byte(rgba[2]);
+ dest += 3;
+ } else if (options & GB_COLORS_CMYK) {
+ /* Use the standard RGB to CMYK algorithm, */
+ /* with maximum black generation and undercolor removal. */
+ gx_color_value white = max(rgba[0], max(rgba[1], rgba[2]));
+
+ dest[0] = gx_color_value_to_byte(white - rgba[0]);
+ dest[1] = gx_color_value_to_byte(white - rgba[1]);
+ dest[2] = gx_color_value_to_byte(white - rgba[2]);
+ dest[3] = gx_color_value_to_byte(gx_max_color_value - white);
+ dest += 4;
+ } else { /* GB_COLORS_GRAY */
+ /* Use the standard RGB to Gray algorithm. */
+ *dest++ = gx_color_value_to_byte(
+ ((rgba[0] * (ulong) lum_red_weight) +
+ (rgba[1] * (ulong) lum_green_weight) +
+ (rgba[2] * (ulong) lum_blue_weight) +
+ (lum_all_weights / 2))
+ / lum_all_weights);
+ }
+ if (options & GB_ALPHA_LAST)
+ *dest++ = gx_color_value_to_byte(rgba[3]);
+ }
}
return 0;
}
@@ -619,17 +619,17 @@ gx_get_bits_native_to_std(gx_device * dev, int x, int w, int h,
int
gx_no_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
return_error(gs_error_unknownerror);
}
int
gx_default_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
dev_proc_get_bits_rectangle((*save_get_bits_rectangle)) =
- dev_proc(dev, get_bits_rectangle);
+ dev_proc(dev, get_bits_rectangle);
int depth = dev->color_info.depth;
uint min_raster = (dev->width * depth + 7) >> 3;
gs_get_bits_options_t options = params->options;
@@ -646,136 +646,134 @@ gx_default_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
* of this, it must handle partial scan lines.
*/
if (prect->q.y == prect->p.y + 1 &&
- !(~options &
- (GB_RETURN_COPY | GB_PACKING_CHUNKY | GB_COLORS_NATIVE)) &&
- (options & (GB_ALIGN_STANDARD | GB_ALIGN_ANY)) &&
- ((options & (GB_OFFSET_0 | GB_OFFSET_ANY)) ||
- ((options & GB_OFFSET_SPECIFIED) && params->x_offset == 0)) &&
- ((options & (GB_RASTER_STANDARD | GB_RASTER_ANY)) ||
- ((options & GB_RASTER_SPECIFIED) &&
- params->raster >= min_raster)) &&
- unread == NULL
- ) {
- byte *data = params->data[0];
- byte *row = data;
-
- if (!(prect->p.x == 0 && prect->q.x == dev->width)) {
- /* Allocate an intermediate row buffer. */
- row = gs_alloc_bytes(dev->memory, min_raster,
- "gx_default_get_bits_rectangle");
-
- if (row == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto ret;
- }
- }
- code = (*dev_proc(dev, get_bits)) (dev, prect->p.y, row,
- (params->options & GB_RETURN_POINTER) ? &params->data[0]
- : NULL );
- if (code >= 0) {
- if (row != data) {
- if (prect->p.x == 0 && params->data[0] != row
- && params->options & GB_RETURN_POINTER) {
- /*
- * get_bits returned an appropriate pointer: we can
- * avoid doing any copying.
- */
- DO_NOTHING;
- } else {
- /* Copy the partial row into the supplied buffer. */
- int width_bits = (prect->q.x - prect->p.x) * depth;
- gx_device_memory tdev;
-
- tdev.width = width_bits;
- tdev.height = 1;
- tdev.line_ptrs = &tdev.base;
- tdev.base = data;
+ !(~options &
+ (GB_RETURN_COPY | GB_PACKING_CHUNKY | GB_COLORS_NATIVE)) &&
+ (options & (GB_ALIGN_STANDARD | GB_ALIGN_ANY)) &&
+ ((options & (GB_OFFSET_0 | GB_OFFSET_ANY)) ||
+ ((options & GB_OFFSET_SPECIFIED) && params->x_offset == 0)) &&
+ ((options & (GB_RASTER_STANDARD | GB_RASTER_ANY)) ||
+ ((options & GB_RASTER_SPECIFIED) &&
+ params->raster >= min_raster)) &&
+ unread == NULL
+ ) {
+ byte *data = params->data[0];
+ byte *row = data;
+
+ if (!(prect->p.x == 0 && prect->q.x == dev->width)) {
+ /* Allocate an intermediate row buffer. */
+ row = gs_alloc_bytes(dev->memory, min_raster,
+ "gx_default_get_bits_rectangle");
+
+ if (row == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto ret;
+ }
+ }
+ code = (*dev_proc(dev, get_bits)) (dev, prect->p.y, row,
+ (params->options & GB_RETURN_POINTER) ? &params->data[0]
+ : NULL );
+ if (code >= 0) {
+ if (row != data) {
+ if (prect->p.x == 0 && params->data[0] != row
+ && params->options & GB_RETURN_POINTER) {
+ /*
+ * get_bits returned an appropriate pointer: we can
+ * avoid doing any copying.
+ */
+ DO_NOTHING;
+ } else {
+ /* Copy the partial row into the supplied buffer. */
+ int width_bits = (prect->q.x - prect->p.x) * depth;
+ gx_device_memory tdev;
+
+ tdev.width = width_bits;
+ tdev.height = 1;
+ tdev.line_ptrs = &tdev.base;
+ tdev.base = data;
tdev.raster = bitmap_raster(width_bits);
code = (*dev_proc(&mem_mono_device, copy_mono))
- ((gx_device *) & tdev,
+ ((gx_device *) & tdev,
(params->options & GB_RETURN_POINTER) ? params->data[0] : row,
prect->p.x * depth,
- min_raster, gx_no_bitmap_id, 0, 0, width_bits, 1,
- (gx_color_index) 0, (gx_color_index) 1);
- params->data[0] = data;
- }
- gs_free_object(dev->memory, row,
- "gx_default_get_bits_rectangle");
- }
- params->options =
- GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_PACKING_CHUNKY |
- GB_ALPHA_NONE | GB_COLORS_NATIVE | GB_RASTER_STANDARD |
- (params->data[0] == data ? GB_RETURN_COPY : GB_RETURN_POINTER);
- goto ret;
- }
+ min_raster, gx_no_bitmap_id, 0, 0, width_bits, 1,
+ (gx_color_index) 0, (gx_color_index) 1);
+ params->data[0] = data;
+ }
+ gs_free_object(dev->memory, row,
+ "gx_default_get_bits_rectangle");
+ }
+ params->options =
+ GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_PACKING_CHUNKY |
+ GB_ALPHA_NONE | GB_COLORS_NATIVE | GB_RASTER_STANDARD |
+ (params->data[0] == data ? GB_RETURN_COPY : GB_RETURN_POINTER);
+ goto ret;
+ }
} {
- /* Do the transfer row-by-row using a buffer. */
- int x = prect->p.x, w = prect->q.x - x;
- int bits_per_pixel = depth;
- byte *row;
-
- if (options & GB_COLORS_STANDARD_ALL) {
- /*
- * Make sure the row buffer can hold the standard color
- * representation, in case the device decides to use it.
- */
- int bpc = GB_OPTIONS_MAX_DEPTH(options);
- int nc =
- (options & GB_COLORS_CMYK ? 4 :
- options & GB_COLORS_RGB ? 3 : 1) +
- (options & (GB_ALPHA_ALL - GB_ALPHA_NONE) ? 1 : 0);
- int bpp = bpc * nc;
-
- if (bpp > bits_per_pixel)
- bits_per_pixel = bpp;
- }
- row = gs_alloc_bytes(dev->memory, (bits_per_pixel * w + 7) >> 3,
- "gx_default_get_bits_rectangle");
- if (row == 0) {
- code = gs_note_error(gs_error_VMerror);
- } else {
- uint dev_raster = gx_device_raster(dev, true);
- uint raster =
- (options & GB_RASTER_SPECIFIED ? params->raster :
- options & GB_ALIGN_STANDARD ? bitmap_raster(depth * w) :
- (depth * w + 7) >> 3);
- gs_int_rect rect;
- gs_get_bits_params_t copy_params;
- gs_get_bits_options_t copy_options =
- (GB_ALIGN_STANDARD | GB_ALIGN_ANY) |
- (GB_RETURN_COPY | GB_RETURN_POINTER) |
- (GB_OFFSET_0 | GB_OFFSET_ANY) |
- (GB_RASTER_STANDARD | GB_RASTER_ANY) | GB_PACKING_CHUNKY |
- GB_COLORS_NATIVE | (options & (GB_DEPTH_ALL | GB_COLORS_ALL)) |
- GB_ALPHA_ALL;
- byte *dest = params->data[0];
- int y;
-
- rect.p.x = x, rect.q.x = x + w;
- code = 0;
- for (y = prect->p.y; y < prect->q.y; ++y) {
- rect.p.y = y, rect.q.y = y + 1;
- copy_params.options = copy_options;
- copy_params.data[0] = row;
- code = (*save_get_bits_rectangle)
- (dev, &rect, &copy_params, NULL);
- if (code < 0)
- break;
- if (copy_params.options & GB_OFFSET_0)
- copy_params.x_offset = 0;
- params->data[0] = dest + (y - prect->p.y) * raster;
- code = gx_get_bits_copy(dev, copy_params.x_offset, w, 1,
- params, &copy_params,
- copy_params.data[0], dev_raster);
- if (code < 0)
- break;
- }
- gs_free_object(dev->memory, row, "gx_default_get_bits_rectangle");
- params->data[0] = dest;
- }
+ /* Do the transfer row-by-row using a buffer. */
+ int x = prect->p.x, w = prect->q.x - x;
+ int bits_per_pixel = depth;
+ byte *row;
+
+ if (options & GB_COLORS_STANDARD_ALL) {
+ /*
+ * Make sure the row buffer can hold the standard color
+ * representation, in case the device decides to use it.
+ */
+ int bpc = GB_OPTIONS_MAX_DEPTH(options);
+ int nc =
+ (options & GB_COLORS_CMYK ? 4 :
+ options & GB_COLORS_RGB ? 3 : 1) +
+ (options & (GB_ALPHA_ALL - GB_ALPHA_NONE) ? 1 : 0);
+ int bpp = bpc * nc;
+
+ if (bpp > bits_per_pixel)
+ bits_per_pixel = bpp;
+ }
+ row = gs_alloc_bytes(dev->memory, (bits_per_pixel * w + 7) >> 3,
+ "gx_default_get_bits_rectangle");
+ if (row == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ } else {
+ uint dev_raster = gx_device_raster(dev, true);
+ uint raster =
+ (options & GB_RASTER_SPECIFIED ? params->raster :
+ options & GB_ALIGN_STANDARD ? bitmap_raster(depth * w) :
+ (depth * w + 7) >> 3);
+ gs_int_rect rect;
+ gs_get_bits_params_t copy_params;
+ gs_get_bits_options_t copy_options =
+ (GB_ALIGN_STANDARD | GB_ALIGN_ANY) |
+ (GB_RETURN_COPY | GB_RETURN_POINTER) |
+ (GB_OFFSET_0 | GB_OFFSET_ANY) |
+ (GB_RASTER_STANDARD | GB_RASTER_ANY) | GB_PACKING_CHUNKY |
+ GB_COLORS_NATIVE | (options & (GB_DEPTH_ALL | GB_COLORS_ALL)) |
+ GB_ALPHA_ALL;
+ byte *dest = params->data[0];
+ int y;
+
+ rect.p.x = x, rect.q.x = x + w;
+ code = 0;
+ for (y = prect->p.y; y < prect->q.y; ++y) {
+ rect.p.y = y, rect.q.y = y + 1;
+ copy_params.options = copy_options;
+ copy_params.data[0] = row;
+ code = (*save_get_bits_rectangle)
+ (dev, &rect, &copy_params, NULL);
+ if (code < 0)
+ break;
+ if (copy_params.options & GB_OFFSET_0)
+ copy_params.x_offset = 0;
+ params->data[0] = dest + (y - prect->p.y) * raster;
+ code = gx_get_bits_copy(dev, copy_params.x_offset, w, 1,
+ params, &copy_params,
+ copy_params.data[0], dev_raster);
+ if (code < 0)
+ break;
+ }
+ gs_free_object(dev->memory, row, "gx_default_get_bits_rectangle");
+ params->data[0] = dest;
+ }
}
ret:set_dev_proc(dev, get_bits_rectangle, save_get_bits_rectangle);
return (code < 0 ? code : 0);
}
-
-
diff --git a/gs/base/gdevdjet.c b/gs/base/gdevdjet.c
index e1bdcc1b9..14f69a45e 100644
--- a/gs/base/gdevdjet.c
+++ b/gs/base/gdevdjet.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -114,11 +114,11 @@ static dev_proc_put_params(hpjet_put_params);
static const gx_device_procs prn_hp_procs =
prn_params_procs(hpjet_open, gdev_prn_output_page, hpjet_close,
- hpjet_get_params, hpjet_put_params);
+ hpjet_get_params, hpjet_put_params);
static gx_device_procs prn_ljet4pjl_procs =
prn_params_procs(hpjet_open, gdev_prn_output_page, ljet4pjl_close,
- gdev_prn_get_params, gdev_prn_put_params);
+ gdev_prn_get_params, gdev_prn_put_params);
typedef struct gx_device_hpjet_s gx_device_hpjet;
@@ -140,94 +140,94 @@ struct gx_device_hpjet_s {
const gx_device_hpjet gs_deskjet_device =
HPJET_DEVICE(prn_hp_procs, "deskjet",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins filled in by hpjet_open */
- 1, djet_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins filled in by hpjet_open */
+ 1, djet_print_page_copies);
const gx_device_hpjet gs_djet500_device =
HPJET_DEVICE(prn_hp_procs, "djet500",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins filled in by hpjet_open */
- 1, djet500_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins filled in by hpjet_open */
+ 1, djet500_print_page_copies);
const gx_device_hpjet gs_fs600_device =
HPJET_DEVICE(prn_hp_procs, "fs600",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI2, Y_DPI2,
- 0.23, 0.0, 0.23, 0.04, /* margins */
- 1, fs600_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI2, Y_DPI2,
+ 0.23, 0.0, 0.23, 0.04, /* margins */
+ 1, fs600_print_page_copies);
const gx_device_hpjet gs_laserjet_device =
HPJET_DEVICE(prn_hp_procs, "laserjet",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.05, 0.25, 0.55, 0.25, /* margins */
- 1, ljet_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.05, 0.25, 0.55, 0.25, /* margins */
+ 1, ljet_print_page_copies);
const gx_device_hpjet gs_ljetplus_device =
HPJET_DEVICE(prn_hp_procs, "ljetplus",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.05, 0.25, 0.55, 0.25, /* margins */
- 1, ljetplus_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.05, 0.25, 0.55, 0.25, /* margins */
+ 1, ljetplus_print_page_copies);
const gx_device_hpjet gs_ljet2p_device =
HPJET_DEVICE(prn_hp_procs, "ljet2p",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.25, 0.25, 0.25, 0.0, /* margins */
- 1, ljet2p_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.25, 0.25, 0.25, 0.0, /* margins */
+ 1, ljet2p_print_page_copies);
const gx_device_hpjet gs_ljet3_device =
HPJET_DEVICE(prn_hp_procs, "ljet3",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.20, 0.25, 0.25, 0.25, /* margins */
- 1, ljet3_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.20, 0.25, 0.25, 0.25, /* margins */
+ 1, ljet3_print_page_copies);
const gx_device_hpjet gs_ljet3d_device =
HPJET_DEVICE(prn_hp_procs, "ljet3d",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.20, 0.25, 0.25, 0.25, /* margins */
- 1, ljet3d_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.20, 0.25, 0.25, 0.25, /* margins */
+ 1, ljet3d_print_page_copies);
const gx_device_hpjet gs_ljet4_device =
HPJET_DEVICE(prn_hp_procs, "ljet4",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI2, Y_DPI2,
- 0, 0, 0, 0, /* margins */
- 1, ljet4_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI2, Y_DPI2,
+ 0, 0, 0, 0, /* margins */
+ 1, ljet4_print_page_copies);
const gx_device_hpjet gs_ljet4d_device =
HPJET_DEVICE(prn_hp_procs, "ljet4d",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI2, Y_DPI2,
- 0, 0, 0, 0, /* margins */
- 1, ljet4d_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI2, Y_DPI2,
+ 0, 0, 0, 0, /* margins */
+ 1, ljet4d_print_page_copies);
const gx_device_hpjet gs_lp2563_device =
HPJET_DEVICE(prn_hp_procs, "lp2563",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, lp2563_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, lp2563_print_page_copies);
const gx_device_hpjet gs_oce9050_device =
HPJET_DEVICE(prn_hp_procs, "oce9050",
- 24 * 10, 24 * 10, /* 24 inch roll (can print 32" also) */
- 400, 400, /* 400 dpi */
- 0, 0, 0, 0, /* margins */
- 1, oce9050_print_page_copies);
+ 24 * 10, 24 * 10, /* 24 inch roll (can print 32" also) */
+ 400, 400, /* 400 dpi */
+ 0, 0, 0, 0, /* margins */
+ 1, oce9050_print_page_copies);
const gx_device_printer gs_ljet4pjl_device =
prn_device_copies(prn_ljet4pjl_procs, "ljet4pjl",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI2, Y_DPI2,
- 0, 0, 0, 0, /* margins */
- 1, ljet4pjl_print_page_copies);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI2, Y_DPI2,
+ 0, 0, 0, 0, /* margins */
+ 1, ljet4pjl_print_page_copies);
/* Open the printer, adjusting the margins if necessary. */
static int
@@ -238,35 +238,35 @@ hpjet_open(gx_device * pdev)
bool move_origin = true;
if (ppdev->printer_procs.print_page_copies == djet_print_page_copies ||
- ppdev->printer_procs.print_page_copies == djet500_print_page_copies
- ) {
- static const float m_a4[4] =
- {DESKJET_MARGINS_A4};
- static const float m_letter[4] =
- {DESKJET_MARGINS_LETTER};
-
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
- m_letter);
+ ppdev->printer_procs.print_page_copies == djet500_print_page_copies
+ ) {
+ static const float m_a4[4] =
+ {DESKJET_MARGINS_A4};
+ static const float m_letter[4] =
+ {DESKJET_MARGINS_LETTER};
+
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
+ m_letter);
} else if (ppdev->printer_procs.print_page_copies == oce9050_print_page_copies ||
- ppdev->printer_procs.print_page_copies == lp2563_print_page_copies
- );
+ ppdev->printer_procs.print_page_copies == lp2563_print_page_copies
+ );
else { /* LaserJet */
- static const float m_a4[4] =
- {LASERJET_MARGINS_A4};
- static const float m_letter[4] =
- {LASERJET_MARGINS_LETTER};
-
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
- m_letter);
- move_origin = false;
+ static const float m_a4[4] =
+ {LASERJET_MARGINS_A4};
+ static const float m_letter[4] =
+ {LASERJET_MARGINS_LETTER};
+
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
+ m_letter);
+ move_origin = false;
}
if (m != 0)
- gx_device_set_margins(pdev, m, move_origin);
+ gx_device_set_margins(pdev, m, move_origin);
/* If this is a LJIIID, enable Duplex. */
if (ppdev->printer_procs.print_page_copies == ljet3d_print_page_copies)
- ppdev->Duplex = true, ppdev->Duplex_set = 0;
+ ppdev->Duplex = true, ppdev->Duplex_set = 0;
if (ppdev->printer_procs.print_page_copies == ljet4d_print_page_copies)
- ppdev->Duplex = true, ppdev->Duplex_set = 0;
+ ppdev->Duplex = true, ppdev->Duplex_set = 0;
return gdev_prn_open(pdev);
}
@@ -279,12 +279,12 @@ hpjet_close(gx_device * pdev)
int code = gdev_prn_open_printer(pdev, 1);
if (code < 0)
- return code;
+ return code;
if (ppdev->PageCount > 0) {
- if (ppdev->Duplex_set >= 0 && ppdev->Duplex)
- fputs("\033&l0H", ppdev->file);
+ if (ppdev->Duplex_set >= 0 && ppdev->Duplex)
+ fputs("\033&l0H", ppdev->file);
- fputs("\033E", ppdev->file);
+ fputs("\033E", ppdev->file);
}
return gdev_prn_close(pdev);
@@ -297,7 +297,7 @@ ljet4pjl_close(gx_device *pdev)
int code = gdev_prn_open_printer(pdev, 1);
if (code < 0)
- return code;
+ return code;
if ( ppdev->Duplex_set >= 0 && ppdev->Duplex ) {
gdev_prn_open_printer(pdev, 1);
fputs("\033&l0H", ppdev->file) ;
@@ -319,41 +319,41 @@ hpjet_make_init(gx_device_printer *pdev, char *buf, const char *str)
if (dev->ManualFeed_set && dev->ManualFeed) paper_source = 2;
else if (dev->MediaPosition_set && dev->MediaPosition >= 0)
- paper_source = dev->MediaPosition;
+ paper_source = dev->MediaPosition;
if (paper_source >= 0)
- sprintf(buf, "%s\033&l%dH", str, paper_source);
+ sprintf(buf, "%s\033&l%dH", str, paper_source);
else
- sprintf(buf, "%s", str);
+ sprintf(buf, "%s", str);
}
/* The DeskJet can compress (mode 2) */
static int
djet_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033&k1W\033*b2M");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_DJ_FEATURES, init, init, false);
+ 300, PCL_DJ_FEATURES, init, init, false);
}
/* The DeskJet500 can compress (modes 2&3) */
static int
djet500_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033&k1W");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_DJ500_FEATURES, init, init, false);
+ 300, PCL_DJ500_FEATURES, init, init, false);
}
/* The Kyocera FS-600 laser printer (and perhaps other printers */
/* which use the PeerlessPrint5 firmware) doesn't handle */
/* ESC&l#u and ESC&l#Z correctly. */
static int
fs600_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int dots_per_inch = (int)pdev->y_pixels_per_inch;
char base_init[60];
@@ -362,59 +362,59 @@ fs600_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
sprintf(base_init, "\033*r0F\033&u%dD", dots_per_inch);
hpjet_make_init(pdev, init, base_init);
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- dots_per_inch, PCL_FS600_FEATURES,
- init, init, false);
+ dots_per_inch, PCL_FS600_FEATURES,
+ init, init, false);
}
/* The LaserJet series II can't compress */
static int
ljet_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033*b0M");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LJ_FEATURES, init, init, false);
+ 300, PCL_LJ_FEATURES, init, init, false);
}
/* The LaserJet Plus can't compress */
static int
ljetplus_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033*b0M");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LJplus_FEATURES, init, init, false);
+ 300, PCL_LJplus_FEATURES, init, init, false);
}
/* LaserJet series IIp & IId compress (mode 2) */
/* but don't support *p+ or *b vertical spacing. */
static int
ljet2p_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033*r0F\033*b2M");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LJ2p_FEATURES, init, init, false);
+ 300, PCL_LJ2p_FEATURES, init, init, false);
}
/* All LaserJet series IIIs (III,IIId,IIIp,IIIsi) compress (modes 2&3) */
/* They also need their coordinate system translated slightly. */
static int
ljet3_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033&l-180u36Z\033*r0F");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LJ3_FEATURES, init, init, false);
+ 300, PCL_LJ3_FEATURES, init, init, false);
}
/* LaserJet IIId is same as LaserJet III, except for duplex */
static int
ljet3d_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
char even_init[80];
@@ -425,14 +425,14 @@ ljet3d_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
hpjet_make_init(pdev, init, "\033&l-180u36Z\033*r0F");
sprintf(even_init, "\033&l180u36Z\033*r0F");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LJ3D_FEATURES, init, even_init, tumble);
+ 300, PCL_LJ3D_FEATURES, init, even_init, tumble);
}
/* LaserJet 4 series compresses, and it needs a special sequence to */
/* allow it to specify coordinates at 600 dpi. */
/* It too needs its coordinate system translated slightly. */
static int
ljet4_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int dots_per_inch = (int)pdev->y_pixels_per_inch;
char base_init[60];
@@ -442,12 +442,12 @@ ljet4_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
hpjet_make_init(pdev, init, base_init);
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- dots_per_inch, PCL_LJ4_FEATURES,
- init, init, false);
+ dots_per_inch, PCL_LJ4_FEATURES,
+ init, init, false);
}
static int
ljet4d_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int dots_per_inch = (int)pdev->y_pixels_per_inch;
char base_init[60];
@@ -474,22 +474,22 @@ ljet4d_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
hpjet_make_init(pdev, init, base_init);
sprintf(even_init, "\033&l180u36Z\033*r0F\033&u%dD", dots_per_inch);
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- dots_per_inch, PCL_LJ4D_FEATURES,
- init,even_init,tumble);
+ dots_per_inch, PCL_LJ4D_FEATURES,
+ init,even_init,tumble);
}
-
+
/* LaserJet 4 series compresses, and it needs a special sequence to */
/* allow it to specify coordinates at 600 dpi. */
/* It too needs its coordinate system translated slightly. */
static int
ljet4pjl_print_page_copies(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{ int dots_per_inch = (int)pdev->y_pixels_per_inch;
- char real_init[60];
+ char real_init[60];
- sprintf(real_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
- return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- dots_per_inch, PCL_LJ4PJL_FEATURES,
+ sprintf(real_init, "\033&l-180u36Z\033*r0F\033&u%dD", dots_per_inch);
+ return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
+ dots_per_inch, PCL_LJ4PJL_FEATURES,
real_init, real_init, false);
}
@@ -497,19 +497,19 @@ ljet4pjl_print_page_copies(gx_device_printer *pdev, FILE *prn_stream,
/* and doesn't support *p+ or *b vertical spacing. */
static int
lp2563_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
char init[80];
hpjet_make_init(pdev, init, "\033*b0M");
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 300, PCL_LP2563B_FEATURES, init, init, false);
+ 300, PCL_LP2563B_FEATURES, init, init, false);
}
/* The Oce line printer has TIFF compression */
/* and doesn't support *p+ or *b vertical spacing. */
static int
oce9050_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int code;
char init[80];
@@ -523,15 +523,15 @@ oce9050_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
hpjet_make_init(pdev, init, "\033*b0M");
code = dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- 400, PCL_OCE9050_FEATURES, init, init, false);
+ 400, PCL_OCE9050_FEATURES, init, init, false);
/* Return to HPGL/2 mode. */
fputs("\033%1B", prn_stream); /* Enter HPGL/2 mode */
if (code == 0) {
- fputs("PU", prn_stream); /* Pen Up */
- fputs("SP0", prn_stream); /* Pen Select */
- fputs("PG;", prn_stream); /* Advance Full Page */
- fputs("\033E", prn_stream); /* Reset */
+ fputs("PU", prn_stream); /* Pen Up */
+ fputs("SP0", prn_stream); /* Pen Select */
+ fputs("PG;", prn_stream); /* Advance Full Page */
+ fputs("\033E", prn_stream); /* Reset */
}
return code;
}
@@ -544,14 +544,14 @@ hpjet_get_params(gx_device *pdev, gs_param_list *plist)
if (code >= 0)
{
- code = param_write_bool(plist, "ManualFeed", &dev->ManualFeed);
+ code = param_write_bool(plist, "ManualFeed", &dev->ManualFeed);
}
if (code >= 0)
{
- code = param_write_int(plist, "MediaPosition", &dev->MediaPosition);
+ code = param_write_int(plist, "MediaPosition", &dev->MediaPosition);
}
if (code >=0)
- code = param_write_bool(plist, "Tumble", &dev->Tumble);
+ code = param_write_bool(plist, "Tumble", &dev->Tumble);
return code;
}
@@ -569,13 +569,13 @@ hpjet_put_params(gx_device *pdev, gs_param_list *plist)
code = param_read_bool(plist, "ManualFeed", &ManualFeed);
if (code == 0) ManualFeed_set = true;
if (code >= 0) {
- code = param_read_int(plist, "MediaPosition", &MediaPosition);
- if (code == 0) MediaPosition_set = true;
- else if (code < 0) {
- if (param_read_null(plist, "MediaPosition") == 0) {
- code = 0;
- }
- }
+ code = param_read_int(plist, "MediaPosition", &MediaPosition);
+ if (code == 0) MediaPosition_set = true;
+ else if (code < 0) {
+ if (param_read_null(plist, "MediaPosition") == 0) {
+ code = 0;
+ }
+ }
}
if (code>=0)
{
@@ -584,18 +584,18 @@ hpjet_put_params(gx_device *pdev, gs_param_list *plist)
}
if (code >= 0)
- code = gdev_prn_put_params(pdev, plist);
+ code = gdev_prn_put_params(pdev, plist);
if (code >= 0) {
dev->Tumble=Tumble;
- if (ManualFeed_set) {
- dev->ManualFeed = ManualFeed;
- dev->ManualFeed_set = true;
- }
- if (MediaPosition_set) {
- dev->MediaPosition = MediaPosition;
- dev->MediaPosition_set = true;
- }
+ if (ManualFeed_set) {
+ dev->ManualFeed = ManualFeed;
+ dev->ManualFeed_set = true;
+ }
+ if (MediaPosition_set) {
+ dev->MediaPosition = MediaPosition;
+ dev->MediaPosition_set = true;
+ }
}
return code;
diff --git a/gs/base/gdevdjtc.c b/gs/base/gdevdjtc.c
index ef19cafd1..4f1650511 100644
--- a/gs/base/gdevdjtc.c
+++ b/gs/base/gdevdjtc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,12 +20,12 @@
*** Note: this driver was contributed by a user, Alfred Kayser:
*** please contact AKayser@et.tudelft.nl if you have questions.
***/
-
+
#ifndef SHINGLING /* Interlaced, multi-pass printing */
#define SHINGLING 1 /* 0 = none, 1 = 50%, 2 = 25%, 2 is best & slowest */
#endif
-#ifndef DEPLETION /* 'Intelligent' dot-removal */
+#ifndef DEPLETION /* 'Intelligent' dot-removal */
#define DEPLETION 1 /* 0 = none, 1 = 25%, 2 = 50%, 1 best for graphics? */
#endif /* Use 0 for transparencies */
@@ -76,64 +76,64 @@ djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
/* select the most compressed mode available & clear tmp storage */
/* put printer in known state */
fputs("\033E",fprn);
-
+
/* ends raster graphics to set raster graphics resolution */
fputs("\033*rbC", fprn); /* was \033*rB */
/* set raster graphics resolution -- 300 dpi */
- fputs("\033*t300R", fprn);
-
- /* A4, skip perf, def. paper tray */
- fputs("\033&l26a0l1H", fprn);
+ fputs("\033*t300R", fprn);
+
+ /* A4, skip perf, def. paper tray */
+ fputs("\033&l26a0l1H", fprn);
/* RGB Mode */
- fputs("\033*r3U", fprn);
-
+ fputs("\033*r3U", fprn);
+
/* set depletion level */
fprintf(fprn, "\033*o%dD", DEPLETION);
-
+
/* set shingling level */
fprintf(fprn, "\033*o%dQ", SHINGLING);
-
+
/* move to top left of page & set current position */
fputs("\033*p0x0Y", fprn); /* cursor pos: 0,0 */
-
+
fputs("\033*b2M", fprn); /* mode 2 compression for now */
-
+
fputs("\033*r0A", fprn); /* start graf. left */
-
+
/* Send each scan line in turn */
{ int lnum;
- int num_blank_lines = 0;
- int lineSize = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- if (lineSize>bitSize)
- {
+ int num_blank_lines = 0;
+ int lineSize = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ if (lineSize>bitSize)
+ {
if (bitData) free(bitData);
bitSize=lineSize;
bitData=(byte*)malloc(bitSize+16);
- }
- for (lnum=0; lnum<pdev->height; lnum++)
- {
+ }
+ for (lnum=0; lnum<pdev->height; lnum++)
+ {
byte *endData;
-
+
gdev_prn_copy_scan_lines(pdev, lnum, bitData, lineSize);
/* Remove trailing 0s. */
endData = bitData + lineSize;
while ( (endData>bitData) && (endData[-1] == 0) )
- endData--;
+ endData--;
if (endData == bitData)
- num_blank_lines++;
+ num_blank_lines++;
else
{ int count, k, i, lineLen;
- /* Pad with 0s to fill out the last */
- /* block of 8 bytes. */
- memset(endData, 0, 7);
-
- lineLen=((endData-bitData)+7)/8; /* Round to next 8multiple */
- if (planeSize<lineLen)
- {
+ /* Pad with 0s to fill out the last */
+ /* block of 8 bytes. */
+ memset(endData, 0, 7);
+
+ lineLen=((endData-bitData)+7)/8; /* Round to next 8multiple */
+ if (planeSize<lineLen)
+ {
if (plane1) free(plane1);
if (plane2) free(plane2);
if (plane3) free(plane3);
@@ -141,53 +141,53 @@ djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
plane1=(byte*)malloc(planeSize+8);
plane2=(byte*)malloc(planeSize+8);
plane3=(byte*)malloc(planeSize+8);
- }
- /* Transpose the data to get pixel planes. */
- for (k=i=0; k<lineLen; i+=8, k++)
- {
+ }
+ /* Transpose the data to get pixel planes. */
+ for (k=i=0; k<lineLen; i+=8, k++)
+ {
register ushort t, c;
-
+
/* Three smaller loops are better optimizable and use less
vars, so most of them can be in registers even on pc's */
for (c=t=0;t<8;t++)
- c = (c<<1) | (bitData[t+i]&4);
+ c = (c<<1) | (bitData[t+i]&4);
plane3[k] = ~(byte)(c>>2);
for (c=t=0;t<8;t++)
- c = (c<<1) | (bitData[t+i]&2);
+ c = (c<<1) | (bitData[t+i]&2);
plane2[k] = ~(byte)(c>>1);
for (c=t=0;t<8;t++)
- c = (c<<1) | (bitData[t+i]&1);
+ c = (c<<1) | (bitData[t+i]&1);
plane1[k] = ~(byte)(c);
- }
+ }
- /* Skip blank lines if any */
- if (num_blank_lines > 0)
- { /* move down from current position */
+ /* Skip blank lines if any */
+ if (num_blank_lines > 0)
+ { /* move down from current position */
fprintf(fprn, "\033*b%dY", num_blank_lines);
num_blank_lines = 0;
- }
+ }
- /* Transfer raster graphics */
- /* in the order R, G, B. */
- /* lineLen is at least bitSize/8, so bitData can easily be used to store
+ /* Transfer raster graphics */
+ /* in the order R, G, B. */
+ /* lineLen is at least bitSize/8, so bitData can easily be used to store
lineLen of bytes */
- /* P.s. mode9 compression is akward(??) to use, because the lineLenght's
+ /* P.s. mode9 compression is akward(??) to use, because the lineLenght's
are different, so we are stuck with mode 2, which is good enough */
-
- /* set the line width */
- fprintf(fprn, "\033*r%dS", lineLen*8);
-
- count = mode2compress(plane1, plane1 + lineLen, bitData);
- fprintf(fprn, "\033*b%dV", count);
- fwrite(bitData, sizeof(byte), count, fprn);
- count = mode2compress(plane2, plane2 + lineLen, bitData);
- fprintf(fprn, "\033*b%dV", count);
- fwrite(bitData, sizeof(byte), count, fprn);
- count = mode2compress(plane3, plane3 + lineLen, bitData);
- fprintf(fprn, "\033*b%dW", count);
- fwrite(bitData, sizeof(byte), count, fprn);
+
+ /* set the line width */
+ fprintf(fprn, "\033*r%dS", lineLen*8);
+
+ count = mode2compress(plane1, plane1 + lineLen, bitData);
+ fprintf(fprn, "\033*b%dV", count);
+ fwrite(bitData, sizeof(byte), count, fprn);
+ count = mode2compress(plane2, plane2 + lineLen, bitData);
+ fprintf(fprn, "\033*b%dV", count);
+ fwrite(bitData, sizeof(byte), count, fprn);
+ count = mode2compress(plane3, plane3 + lineLen, bitData);
+ fprintf(fprn, "\033*b%dW", count);
+ fwrite(bitData, sizeof(byte), count, fprn);
}
- }
+ }
}
/* end raster graphics */
fputs("\033*rbC", fprn); /* was \033*rB */
@@ -195,10 +195,10 @@ djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
/* put printer in known state */
fputs("\033E",fprn);
-
+
/* eject page */
- fputs("\033&l0H", fprn);
-
+ fputs("\033&l0H", fprn);
+
/* release allocated memory */
if (bitData) free(bitData);
if (plane1) free(plane1);
@@ -208,7 +208,6 @@ djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
return 0;
}
-
/*
* Mode 2 Row compression routine for the HP DeskJet & LaserJet IIp.
* Compresses data from row up to end_row, storing the result
@@ -223,7 +222,7 @@ djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
static int
mode2compress(byte *row, byte *end_row, byte *compressed)
-{
+{
register byte *exam; /* word being examined in the row to compress */
register byte *cptr = compressed; /* output pointer into compressed bytes */
int i, count, len;
@@ -231,40 +230,40 @@ mode2compress(byte *row, byte *end_row, byte *compressed)
exam = row;
while (1)
- {
- test = *exam++;
- /* Advance exam until test==*exam or exam==end_row */
- while ((test != *exam) && (exam < end_row))
- test = *exam++;
- /* row points to start of differing bytes,
- exam points to start of consequtive series
+ {
+ test = *exam++;
+ /* Advance exam until test==*exam or exam==end_row */
+ while ((test != *exam) && (exam < end_row))
+ test = *exam++;
+ /* row points to start of differing bytes,
+ exam points to start of consequtive series
or to end of row */
- if (exam<end_row) exam--;
- len=exam-row;
- while (len>0)
- {
+ if (exam<end_row) exam--;
+ len=exam-row;
+ while (len>0)
+ {
count=len;
if (count>127) count=127;
- *cptr++=count-1;
+ *cptr++=count-1;
for (i=0;i<count;i++) *cptr++ = *row++;
len-=count;
- }
- if (exam>=end_row) break; /* done */
- exam++; /* skip first same byte */
- while ((test == *exam) && (exam < end_row)) /* skip all same bytes */
+ }
+ if (exam>=end_row) break; /* done */
+ exam++; /* skip first same byte */
+ while ((test == *exam) && (exam < end_row)) /* skip all same bytes */
exam++;
- /* exam points now first different word or to end of data */
- len = exam-row;
- while (len>0)
- {
+ /* exam points now first different word or to end of data */
+ len = exam-row;
+ while (len>0)
+ {
count=len;
if (count>127) count=127;
*cptr++=(257-count);
- *cptr++=test;
+ *cptr++=test;
len-=count;
- }
- if (exam>=end_row) break; /* end of data */
- row = exam; /* row points to first dissimular byte */
- }
+ }
+ if (exam>=end_row) break; /* end of data */
+ row = exam; /* row points to first dissimular byte */
+ }
return (cptr-compressed);
}
diff --git a/gs/base/gdevdljm.c b/gs/base/gdevdljm.c
index 1f5535580..63514731f 100644
--- a/gs/base/gdevdljm.c
+++ b/gs/base/gdevdljm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,25 +44,25 @@
/* Send a page to the printer. */
int
dljet_mono_print_page(gx_device_printer * pdev, FILE * prn_stream,
- int dots_per_inch, int features, const char *page_init)
+ int dots_per_inch, int features, const char *page_init)
{
return dljet_mono_print_page_copies(pdev, prn_stream, 1, dots_per_inch,
- features, page_init, page_init, false);
+ features, page_init, page_init, false);
}
int
dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies, int dots_per_inch, int features,
- const char *odd_page_init, const char *even_page_init, bool tumble)
+ int num_copies, int dots_per_inch, int features,
+ const char *odd_page_init, const char *even_page_init, bool tumble)
{
int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
int line_size_words = (line_size + W - 1) / W;
uint storage_size_words = line_size_words * 8; /* data, out_row, out_row_alt, prev_row */
word *storage;
word
- *data_words,
- *out_row_words,
- *out_row_alt_words,
- *prev_row_words;
+ *data_words,
+ *out_row_words,
+ *out_row_alt_words,
+ *prev_row_words;
#define data ((byte *)data_words)
#define out_row ((byte *)out_row_words)
#define out_row_alt ((byte *)out_row_alt_words)
@@ -85,12 +85,12 @@ dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
bool dupset = pdev->Duplex_set >= 0;
if (num_copies != 1 && !(features & PCL_CAN_PRINT_COPIES))
- return gx_default_print_page_copies(pdev, prn_stream, num_copies);
+ return gx_default_print_page_copies(pdev, prn_stream, num_copies);
storage =
- (ulong *)gs_alloc_byte_array(pdev->memory, storage_size_words, W,
- "hpjet_print_page");
+ (ulong *)gs_alloc_byte_array(pdev->memory, storage_size_words, W,
+ "hpjet_print_page");
if (storage == 0) /* can't allocate working area */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
data_words = storage;
out_row_words = data_words + (line_size_words * 2);
out_row_alt_words = out_row_words + (line_size_words * 2);
@@ -100,27 +100,27 @@ dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
/* Initialize printer. */
if (pdev->PageCount == 0) {
- if (features & HACK__IS_A_LJET4PJL) {
- fputs("\033%-12345X@PJL\r\n@PJL ENTER LANGUAGE = PCL\r\n",
- prn_stream);
- }
- fputs("\033E", prn_stream); /* reset printer */
- /* If the printer supports it, set the paper size */
- /* based on the actual requested size. */
- if (features & PCL_CAN_SET_PAPER_SIZE) {
- fprintf(prn_stream, "\033&l%dA", paper_size);
- }
- /* If printer can duplex, set duplex mode appropriately. */
- if (features & PCL_HAS_DUPLEX) {
- if (dupset && dup && !tumble)
- fputs("\033&l1S", prn_stream);
+ if (features & HACK__IS_A_LJET4PJL) {
+ fputs("\033%-12345X@PJL\r\n@PJL ENTER LANGUAGE = PCL\r\n",
+ prn_stream);
+ }
+ fputs("\033E", prn_stream); /* reset printer */
+ /* If the printer supports it, set the paper size */
+ /* based on the actual requested size. */
+ if (features & PCL_CAN_SET_PAPER_SIZE) {
+ fprintf(prn_stream, "\033&l%dA", paper_size);
+ }
+ /* If printer can duplex, set duplex mode appropriately. */
+ if (features & PCL_HAS_DUPLEX) {
+ if (dupset && dup && !tumble)
+ fputs("\033&l1S", prn_stream);
else if (dupset && dup && tumble)
- fputs("\033&l2S", prn_stream);
- else if (dupset && !dup)
- fputs("\033&l0S", prn_stream);
- else /* default to duplex for this printer */
- fputs("\033&l1S", prn_stream);
- }
+ fputs("\033&l2S", prn_stream);
+ else if (dupset && !dup)
+ fputs("\033&l0S", prn_stream);
+ else /* default to duplex for this printer */
+ fputs("\033&l1S", prn_stream);
+ }
}
/* Put out per-page initialization. */
/*
@@ -134,25 +134,25 @@ dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
in simplex mode we set this parameters for each page,
in duplex mode we set this parameters for each odd page
*/
-
+
if ((features & PCL_HAS_DUPLEX) && dupset && dup) {
/* We are printing duplex, so change margins as needed */
if ((pdev->PageCount%2)==0) {
- if (features & PCL_CAN_SET_PAPER_SIZE) {
- fprintf(prn_stream, "\033&l%dA", paper_size);
- }
+ if (features & PCL_CAN_SET_PAPER_SIZE) {
+ fprintf(prn_stream, "\033&l%dA", paper_size);
+ }
fputs("\033&l0o0l0E", prn_stream);
fputs(odd_page_init, prn_stream);
} else
fputs(even_page_init, prn_stream);
} else {
- if (features & PCL_CAN_SET_PAPER_SIZE){
- fprintf(prn_stream, "\033&l%dA", paper_size);
- }
+ if (features & PCL_CAN_SET_PAPER_SIZE){
+ fprintf(prn_stream, "\033&l%dA", paper_size);
+ }
fputs("\033&l0o0l0E", prn_stream);
fputs(odd_page_init, prn_stream);
}
-
+
fprintf(prn_stream, "\033&l%dX", num_copies); /* # of copies */
/* End raster graphics, position cursor at top. */
@@ -161,8 +161,8 @@ dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
/* The DeskJet and DeskJet Plus reset everything upon */
/* receiving \033*rB, so we must reinitialize graphics mode. */
if (features & PCL_END_GRAPHICS_DOES_RESET) {
- fputs(odd_page_init, prn_stream); /* Assume this does the right thing */
- fprintf(prn_stream, "\033&l%dX", num_copies); /* # of copies */
+ fputs(odd_page_init, prn_stream); /* Assume this does the right thing */
+ fprintf(prn_stream, "\033&l%dX", num_copies); /* # of copies */
}
/* Set resolution. */
@@ -170,147 +170,147 @@ dljet_mono_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
/* Send each scan line in turn */
{
- int lnum;
- int num_blank_lines = 0;
- word rmask = ~(word) 0 << (-pdev->width & (W * 8 - 1));
+ int lnum;
+ int num_blank_lines = 0;
+ word rmask = ~(word) 0 << (-pdev->width & (W * 8 - 1));
- /* Transfer raster graphics. */
- for (lnum = 0; lnum < num_rows; lnum++) {
- register word *end_data =
- data_words + line_size_words;
+ /* Transfer raster graphics. */
+ for (lnum = 0; lnum < num_rows; lnum++) {
+ register word *end_data =
+ data_words + line_size_words;
- code = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *) data, line_size);
- if (code < 0)
- break;
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while (end_data > data_words && end_data[-1] == 0)
- end_data--;
- if (end_data == data_words) { /* Blank line */
- num_blank_lines++;
- continue;
- }
- /* We've reached a non-blank line. */
- /* Put out a spacing command if necessary. */
- if (num_blank_lines == lnum) {
- /* We're at the top of a page. */
- if (features & PCL_ANY_SPACING) {
- if (num_blank_lines > 0)
- fprintf(prn_stream, "\033*p+%dY",
- num_blank_lines * y_dots_per_pixel);
- /* Start raster graphics. */
- fputs("\033*r1A", prn_stream);
- } else if (features & PCL_MODE_3_COMPRESSION) {
- /* Start raster graphics. */
- fputs("\033*r1A", prn_stream);
+ code = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *) data, line_size);
+ if (code < 0)
+ break;
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while (end_data > data_words && end_data[-1] == 0)
+ end_data--;
+ if (end_data == data_words) { /* Blank line */
+ num_blank_lines++;
+ continue;
+ }
+ /* We've reached a non-blank line. */
+ /* Put out a spacing command if necessary. */
+ if (num_blank_lines == lnum) {
+ /* We're at the top of a page. */
+ if (features & PCL_ANY_SPACING) {
+ if (num_blank_lines > 0)
+ fprintf(prn_stream, "\033*p+%dY",
+ num_blank_lines * y_dots_per_pixel);
+ /* Start raster graphics. */
+ fputs("\033*r1A", prn_stream);
+ } else if (features & PCL_MODE_3_COMPRESSION) {
+ /* Start raster graphics. */
+ fputs("\033*r1A", prn_stream);
#if 1 /* don't waste paper */
- if (num_blank_lines > 0)
- fputs("\033*b0W", prn_stream);
- num_blank_lines = 0;
+ if (num_blank_lines > 0)
+ fputs("\033*b0W", prn_stream);
+ num_blank_lines = 0;
#else
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*b0W", prn_stream);
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*b0W", prn_stream);
#endif
- } else {
- /* Start raster graphics. */
- fputs("\033*r1A", prn_stream);
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*bW", prn_stream);
- }
- }
- /* Skip blank lines if any */
- else if (num_blank_lines != 0) {
- /*
- * Moving down from current position causes head motion
- * on the DeskJet, so if the number of lines is small,
- * we're better off printing blanks.
- */
- /*
- * For Canon LBP4i and some others, <ESC>*b<n>Y doesn't
- * properly clear the seed row if we are in compression mode
- * 3.
- */
- if ((num_blank_lines < MIN_SKIP_LINES && compression != 3) ||
- !(features & PCL_ANY_SPACING)
- ) {
- bool mode_3ns =
- (features & PCL_MODE_3_COMPRESSION) &&
- !(features & PCL_ANY_SPACING);
+ } else {
+ /* Start raster graphics. */
+ fputs("\033*r1A", prn_stream);
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*bW", prn_stream);
+ }
+ }
+ /* Skip blank lines if any */
+ else if (num_blank_lines != 0) {
+ /*
+ * Moving down from current position causes head motion
+ * on the DeskJet, so if the number of lines is small,
+ * we're better off printing blanks.
+ */
+ /*
+ * For Canon LBP4i and some others, <ESC>*b<n>Y doesn't
+ * properly clear the seed row if we are in compression mode
+ * 3.
+ */
+ if ((num_blank_lines < MIN_SKIP_LINES && compression != 3) ||
+ !(features & PCL_ANY_SPACING)
+ ) {
+ bool mode_3ns =
+ (features & PCL_MODE_3_COMPRESSION) &&
+ !(features & PCL_ANY_SPACING);
- if (mode_3ns && compression != 2) {
- /* Switch to mode 2 */
- fputs(from3to2, prn_stream);
- compression = 2;
- }
- if (features & PCL_MODE_3_COMPRESSION) {
- /* Must clear the seed row. */
- fputs("\033*b1Y", prn_stream);
- num_blank_lines--;
- }
- if (mode_3ns) {
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*b0W", prn_stream);
- } else {
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*bW", prn_stream);
- }
- } else if (features & PCL3_SPACING) {
- fprintf(prn_stream, "\033*p+%dY",
- num_blank_lines * y_dots_per_pixel);
- } else {
- fprintf(prn_stream, "\033*b%dY",
- num_blank_lines);
- }
- /* Clear the seed row (only matters for */
- /* mode 3 compression). */
- memset(prev_row, 0, line_size);
- }
- num_blank_lines = 0;
+ if (mode_3ns && compression != 2) {
+ /* Switch to mode 2 */
+ fputs(from3to2, prn_stream);
+ compression = 2;
+ }
+ if (features & PCL_MODE_3_COMPRESSION) {
+ /* Must clear the seed row. */
+ fputs("\033*b1Y", prn_stream);
+ num_blank_lines--;
+ }
+ if (mode_3ns) {
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*b0W", prn_stream);
+ } else {
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*bW", prn_stream);
+ }
+ } else if (features & PCL3_SPACING) {
+ fprintf(prn_stream, "\033*p+%dY",
+ num_blank_lines * y_dots_per_pixel);
+ } else {
+ fprintf(prn_stream, "\033*b%dY",
+ num_blank_lines);
+ }
+ /* Clear the seed row (only matters for */
+ /* mode 3 compression). */
+ memset(prev_row, 0, line_size);
+ }
+ num_blank_lines = 0;
- /* Choose the best compression mode */
- /* for this particular line. */
- if (features & PCL_MODE_3_COMPRESSION) {
- /* Compression modes 2 and 3 are both */
- /* available. Try both and see which one */
- /* produces the least output data. */
- int count3 = gdev_pcl_mode3compress(line_size, data,
- prev_row, out_row);
- int count2 = gdev_pcl_mode2compress(data_words, end_data,
- out_row_alt);
- int penalty3 =
- (compression == 3 ? 0 : penalty_from2to3);
- int penalty2 =
- (compression == 2 ? 0 : penalty_from3to2);
+ /* Choose the best compression mode */
+ /* for this particular line. */
+ if (features & PCL_MODE_3_COMPRESSION) {
+ /* Compression modes 2 and 3 are both */
+ /* available. Try both and see which one */
+ /* produces the least output data. */
+ int count3 = gdev_pcl_mode3compress(line_size, data,
+ prev_row, out_row);
+ int count2 = gdev_pcl_mode2compress(data_words, end_data,
+ out_row_alt);
+ int penalty3 =
+ (compression == 3 ? 0 : penalty_from2to3);
+ int penalty2 =
+ (compression == 2 ? 0 : penalty_from3to2);
- if (count3 + penalty3 < count2 + penalty2) {
- if (compression != 3)
- fputs(from2to3, prn_stream);
- compression = 3;
- out_data = out_row;
- out_count = count3;
- } else {
- if (compression != 2)
- fputs(from3to2, prn_stream);
- compression = 2;
- out_data = out_row_alt;
- out_count = count2;
- }
- } else if (features & PCL_MODE_2_COMPRESSION) {
- out_data = out_row;
- out_count = gdev_pcl_mode2compress(data_words, end_data,
- out_row);
- } else {
- out_data = data;
- out_count = (byte *) end_data - data;
- }
+ if (count3 + penalty3 < count2 + penalty2) {
+ if (compression != 3)
+ fputs(from2to3, prn_stream);
+ compression = 3;
+ out_data = out_row;
+ out_count = count3;
+ } else {
+ if (compression != 2)
+ fputs(from3to2, prn_stream);
+ compression = 2;
+ out_data = out_row_alt;
+ out_count = count2;
+ }
+ } else if (features & PCL_MODE_2_COMPRESSION) {
+ out_data = out_row;
+ out_count = gdev_pcl_mode2compress(data_words, end_data,
+ out_row);
+ } else {
+ out_data = data;
+ out_count = (byte *) end_data - data;
+ }
- /* Transfer the data */
- fprintf(prn_stream, "\033*b%dW", out_count);
- fwrite(out_data, sizeof(byte), out_count,
- prn_stream);
- }
+ /* Transfer the data */
+ fprintf(prn_stream, "\033*b%dW", out_count);
+ fwrite(out_data, sizeof(byte), out_count,
+ prn_stream);
+ }
}
/* end raster graphics and eject page */
diff --git a/gs/base/gdevdljm.h b/gs/base/gdevdljm.h
index 3fc136989..1a7031487 100644
--- a/gs/base/gdevdljm.h
+++ b/gs/base/gdevdljm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,9 +41,9 @@
/* Individual printer properties. Any subset of these may be included. */
#define PCL_MODE_2_COMPRESSION 8 /* compression mode 2 supported */
- /* (PCL 4) */
+ /* (PCL 4) */
#define PCL_MODE_3_COMPRESSION 16 /* compression modes 2 & 3 supported */
- /* (PCL 5) */
+ /* (PCL 5) */
#define PCL_END_GRAPHICS_DOES_RESET 32 /* <esc>*rB resets all parameters */
#define PCL_HAS_DUPLEX 64 /* <esc>&l<duplex>S supported */
#define PCL_CAN_SET_PAPER_SIZE 128 /* <esc>&l<sizecode>A supported */
@@ -108,7 +108,6 @@
(PCL_MODE3 |\
PCL_CAN_SET_PAPER_SIZE | PCL_CAN_PRINT_COPIES | HACK__IS_A_LJET4PJL)
-
/* H-P LaserJet 4d */
#define PCL_LJ4D_FEATURES\
(PCL_MODE3 |\
@@ -128,21 +127,21 @@
/* Send a page to the printer. */
int dljet_mono_print_page(
- gx_device_printer * pdev, /* from device-specific _print_page */
- FILE * prn_stream, /* ibid. */
- int dots_per_inch, /* may be a multiple of y resolution */
- int features, /* as defined above */
- const char *page_init /* page initialization string */
- );
+ gx_device_printer * pdev, /* from device-specific _print_page */
+ FILE * prn_stream, /* ibid. */
+ int dots_per_inch, /* may be a multiple of y resolution */
+ int features, /* as defined above */
+ const char *page_init /* page initialization string */
+ );
int dljet_mono_print_page_copies(
- gx_device_printer * pdev,
- FILE * prn_stream,
- int num_copies,
- int dots_per_inch,
- int features,
- const char *odd_page_init,
+ gx_device_printer * pdev,
+ FILE * prn_stream,
+ int num_copies,
+ int dots_per_inch,
+ int features,
+ const char *odd_page_init,
const char *even_page_init,
bool tumble
- );
+ );
#endif /* gdevdljm_INCLUDED */
diff --git a/gs/base/gdevdm24.c b/gs/base/gdevdm24.c
index 1343ab1ff..2ca7d585a 100644
--- a/gs/base/gdevdm24.c
+++ b/gs/base/gdevdm24.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -13,7 +13,7 @@
/* $Id$*/
/* High-res 24Dot-matrix printer driver */
-/* Supported printers
+/* Supported printers
* NEC P6 and similar, implemented by Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de)
* Epson LQ850, implemented by Christian Felsch (felsch@tu-harburg.d400.de)
*/
@@ -24,21 +24,20 @@
static dev_proc_print_page (necp6_print_page);
const gx_device_printer far_data gs_necp6_device =
prn_device (prn_std_procs, "necp6",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 360, 360,
- 0, 0, 0.5, 0, /* margins */
- 1, necp6_print_page);
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 360, 360,
+ 0, 0, 0.5, 0, /* margins */
+ 1, necp6_print_page);
/* Driver for Epson LQ850 */
/* I've tested this driver on a BJ300 with LQ850 emulation and there it produce correct 360x360dpi output. */
static dev_proc_print_page (lq850_print_page);
const gx_device_printer gs_lq850_device =
prn_device (prn_std_procs, "lq850",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 360, 360,
- 0, 0, 0.5, 0, /* margins */
- 1, lq850_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 360, 360,
+ 0, 0, 0.5, 0, /* margins */
+ 1, lq850_print_page);
/* ------ Internal routines ------ */
@@ -69,16 +68,16 @@ dot24_print_page (gx_device_printer *pdev, FILE *prn_stream, char *init_string,
if (in == 0 || out == 0)
{
if (out)
- gs_free (pdev->memory, (char *) out, out_size, 1, "dot24_print_page (out)");
+ gs_free (pdev->memory, (char *) out, out_size, 1, "dot24_print_page (out)");
if (in)
- gs_free (pdev->memory, (char *) in, in_size, 1, "dot24_print_page (in)");
+ gs_free (pdev->memory, (char *) in, in_size, 1, "dot24_print_page (in)");
return_error (gs_error_VMerror);
}
/* Initialize the printer and reset the margins. */
fwrite (init_string, init_len - 1, sizeof (char), prn_stream);
fputc ((int) (pdev->width / pdev->x_pixels_per_inch * 10) + 2,
- prn_stream);
+ prn_stream);
/* Print lines of graphics */
while (lnum < pdev->height)
@@ -93,127 +92,127 @@ dot24_print_page (gx_device_printer *pdev, FILE *prn_stream, char *init_string,
/* Copy 1 scan line and test for all zero. */
gdev_prn_copy_scan_lines (pdev, lnum, in, line_size);
if (in[0] == 0
- && !memcmp ((char *) in, (char *) in + 1, line_size - 1))
- {
- lnum++;
- skip += 2 - y_high;
- continue;
- }
+ && !memcmp ((char *) in, (char *) in + 1, line_size - 1))
+ {
+ lnum++;
+ skip += 2 - y_high;
+ continue;
+ }
/* Vertical tab to the appropriate position. */
while ((skip >> 1) > 255)
- {
- fputs ("\033J\377", prn_stream);
- skip -= 255 * 2;
- }
+ {
+ fputs ("\033J\377", prn_stream);
+ skip -= 255 * 2;
+ }
if (skip)
- {
- if (skip >> 1)
- fprintf (prn_stream, "\033J%c", skip >> 1);
- if (skip & 1)
- fputc ('\n', prn_stream);
- }
+ {
+ if (skip >> 1)
+ fprintf (prn_stream, "\033J%c", skip >> 1);
+ if (skip & 1)
+ fputc ('\n', prn_stream);
+ }
/* Copy the rest of the scan lines. */
if (y_high)
- {
- inp = in + line_size;
- for (lcnt = 1; lcnt < 24; lcnt++, inp += line_size)
- if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2, inp,
- line_size))
- {
- memset (inp, 0, (24 - lcnt) * line_size);
- break;
- }
- inp = in + line_size * 24;
- for (lcnt = 0; lcnt < 24; lcnt++, inp += line_size)
- if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2 + 1, inp,
- line_size))
- {
- memset (inp, 0, (24 - lcnt) * line_size);
- break;
- }
- }
+ {
+ inp = in + line_size;
+ for (lcnt = 1; lcnt < 24; lcnt++, inp += line_size)
+ if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2, inp,
+ line_size))
+ {
+ memset (inp, 0, (24 - lcnt) * line_size);
+ break;
+ }
+ inp = in + line_size * 24;
+ for (lcnt = 0; lcnt < 24; lcnt++, inp += line_size)
+ if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2 + 1, inp,
+ line_size))
+ {
+ memset (inp, 0, (24 - lcnt) * line_size);
+ break;
+ }
+ }
else
- {
- lcnt = 1 + gdev_prn_copy_scan_lines (pdev, lnum + 1, in + line_size,
- in_size - line_size);
- if (lcnt < 24)
- /* Pad with lines of zeros. */
- memset (in + lcnt * line_size, 0, in_size - lcnt * line_size);
- }
+ {
+ lcnt = 1 + gdev_prn_copy_scan_lines (pdev, lnum + 1, in + line_size,
+ in_size - line_size);
+ if (lcnt < 24)
+ /* Pad with lines of zeros. */
+ memset (in + lcnt * line_size, 0, in_size - lcnt * line_size);
+ }
for (ypass = 0; ypass < y_passes; ypass++)
- {
- out_end = out;
- inp = in;
- if (ypass)
- inp += line_size * 24;
- in_end = inp + line_size;
-
- for (; inp < in_end; inp++, out_end += 24)
- {
- memflip8x8 (inp, line_size, out_end, 3);
- memflip8x8 (inp + line_size * 8, line_size, out_end + 1, 3);
- memflip8x8 (inp + line_size * 16, line_size, out_end + 2, 3);
- }
- /* Remove trailing 0s. */
- while (out_end - 3 >= out && out_end[-1] == 0
- && out_end[-2] == 0 && out_end[-3] == 0)
- out_end -= 3;
-
- for (out_blk = outp = out; outp < out_end;)
- {
- /* Skip a run of leading 0s. */
- /* At least 10 are needed to make tabbing worth it. */
-
- if (outp[0] == 0 && outp + 12 <= out_end
- && outp[1] == 0 && outp[2] == 0
- && outp[3] == 0 && outp[4] == 0 && outp[5] == 0
- && outp[6] == 0 && outp[7] == 0 && outp[8] == 0
- && outp[9] == 0 && outp[10] == 0 && outp[11] == 0)
- {
- byte *zp = outp;
- int tpos;
- byte *newp;
- outp += 12;
- while (outp + 3 <= out_end
- && outp[0] == 0 && outp[1] == 0 && outp[2] == 0)
- outp += 3;
- tpos = (outp - out) / bytes_per_space;
- newp = out + tpos * bytes_per_space;
- if (newp > zp + 10)
- {
- /* Output preceding bit data. */
- /* only false at beginning of line */
- if (zp > out_blk)
- {
- if (x_high)
- dot24_improve_bitmap (out_blk, (int) (zp - out_blk));
- dot24_output_run (out_blk, (int) (zp - out_blk),
- x_high, prn_stream);
- }
- /* Tab over to the appropriate position. */
- fprintf (prn_stream, "\033D%c%c\t", tpos, 0);
- out_blk = outp = newp;
- }
- }
- else
- outp += 3;
- }
- if (outp > out_blk)
- {
- if (x_high)
- dot24_improve_bitmap (out_blk, (int) (outp - out_blk));
- dot24_output_run (out_blk, (int) (outp - out_blk), x_high,
- prn_stream);
- }
-
- fputc ('\r', prn_stream);
- if (ypass < y_passes - 1)
- fputc ('\n', prn_stream);
- }
+ {
+ out_end = out;
+ inp = in;
+ if (ypass)
+ inp += line_size * 24;
+ in_end = inp + line_size;
+
+ for (; inp < in_end; inp++, out_end += 24)
+ {
+ memflip8x8 (inp, line_size, out_end, 3);
+ memflip8x8 (inp + line_size * 8, line_size, out_end + 1, 3);
+ memflip8x8 (inp + line_size * 16, line_size, out_end + 2, 3);
+ }
+ /* Remove trailing 0s. */
+ while (out_end - 3 >= out && out_end[-1] == 0
+ && out_end[-2] == 0 && out_end[-3] == 0)
+ out_end -= 3;
+
+ for (out_blk = outp = out; outp < out_end;)
+ {
+ /* Skip a run of leading 0s. */
+ /* At least 10 are needed to make tabbing worth it. */
+
+ if (outp[0] == 0 && outp + 12 <= out_end
+ && outp[1] == 0 && outp[2] == 0
+ && outp[3] == 0 && outp[4] == 0 && outp[5] == 0
+ && outp[6] == 0 && outp[7] == 0 && outp[8] == 0
+ && outp[9] == 0 && outp[10] == 0 && outp[11] == 0)
+ {
+ byte *zp = outp;
+ int tpos;
+ byte *newp;
+ outp += 12;
+ while (outp + 3 <= out_end
+ && outp[0] == 0 && outp[1] == 0 && outp[2] == 0)
+ outp += 3;
+ tpos = (outp - out) / bytes_per_space;
+ newp = out + tpos * bytes_per_space;
+ if (newp > zp + 10)
+ {
+ /* Output preceding bit data. */
+ /* only false at beginning of line */
+ if (zp > out_blk)
+ {
+ if (x_high)
+ dot24_improve_bitmap (out_blk, (int) (zp - out_blk));
+ dot24_output_run (out_blk, (int) (zp - out_blk),
+ x_high, prn_stream);
+ }
+ /* Tab over to the appropriate position. */
+ fprintf (prn_stream, "\033D%c%c\t", tpos, 0);
+ out_blk = outp = newp;
+ }
+ }
+ else
+ outp += 3;
+ }
+ if (outp > out_blk)
+ {
+ if (x_high)
+ dot24_improve_bitmap (out_blk, (int) (outp - out_blk));
+ dot24_output_run (out_blk, (int) (outp - out_blk), x_high,
+ prn_stream);
+ }
+
+ fputc ('\r', prn_stream);
+ if (ypass < y_passes - 1)
+ fputc ('\n', prn_stream);
+ }
skip = 48 - y_high;
lnum += bits_per_column;
}
@@ -251,32 +250,29 @@ dot24_improve_bitmap (byte *data, int count)
register byte *p = data + 6;
for (i = 6; i < count; i += 3, p += 3)
- {
- p[-6] &= ~(~p[0] & p[-3]);
- p[-5] &= ~(~p[1] & p[-2]);
- p[-4] &= ~(~p[2] & p[-1]);
- }
+ {
+ p[-6] &= ~(~p[0] & p[-3]);
+ p[-5] &= ~(~p[1] & p[-2]);
+ p[-4] &= ~(~p[2] & p[-1]);
+ }
p[-6] &= ~p[-3];
p[-5] &= ~p[-2];
p[-4] &= ~p[-1];
}
-
static int
necp6_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
char necp6_init_string [] = "\033@\033P\033l\000\r\034\063\001\033Q";
-
+
return dot24_print_page(pdev, prn_stream, necp6_init_string, sizeof(necp6_init_string));
}
-
static int
lq850_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
char lq850_init_string [] = "\033@\033P\033l\000\r\033\053\001\033Q";
-
+
return dot24_print_page(pdev, prn_stream, lq850_init_string, sizeof(lq850_init_string));
}
-
diff --git a/gs/base/gdevdsha.c b/gs/base/gdevdsha.c
index a1a8eba8c..a72cff418 100644
--- a/gs/base/gdevdsha.c
+++ b/gs/base/gdevdsha.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,10 +19,10 @@
#include "gxcindex.h"
#include "vdtrace.h"
-int
+int
gx_default_fill_linear_color_scanline(gx_device *dev, const gs_fill_attributes *fa,
- int i0, int j, int w,
- const frac31 *c0, const int32_t *c0f, const int32_t *cg_num, int32_t cg_den)
+ int i0, int j, int w,
+ const frac31 *c0, const int32_t *c0f, const int32_t *cg_num, int32_t cg_den)
{
/* This default implementation decomposes the area into constant color rectangles.
Devices may supply optimized implementations with
@@ -39,124 +39,123 @@ gx_default_fill_linear_color_scanline(gx_device *dev, const gs_fill_attributes *
int si, ei, di, code;
if (j < fixed2int(fa->clip->p.y) ||
- j > fixed2int_ceiling(fa->clip->q.y)) /* Must be compatible to the clipping logic. */
- return 0;
+ j > fixed2int_ceiling(fa->clip->q.y)) /* Must be compatible to the clipping logic. */
+ return 0;
for (k = 0; k < n; k++) {
- int shift = cinfo->comp_shift[k];
- int bits = cinfo->comp_bits[k];
+ int shift = cinfo->comp_shift[k];
+ int bits = cinfo->comp_bits[k];
- c[k] = c0[k];
- f[k] = c0f[k];
- ci0 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
+ c[k] = c0[k];
+ f[k] = c0f[k];
+ ci0 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
}
for (i = i0 + 1, di = 1; i < i1; i += di) {
- if (di == 1) {
- /* Advance colors by 1 pixel. */
- ci1 = 0;
- for (k = 0; k < n; k++) {
- int shift = cinfo->comp_shift[k];
- int bits = cinfo->comp_bits[k];
+ if (di == 1) {
+ /* Advance colors by 1 pixel. */
+ ci1 = 0;
+ for (k = 0; k < n; k++) {
+ int shift = cinfo->comp_shift[k];
+ int bits = cinfo->comp_bits[k];
- if (cg_num[k]) {
- int32_t m = f[k] + cg_num[k];
+ if (cg_num[k]) {
+ int32_t m = f[k] + cg_num[k];
- c[k] += m / cg_den;
- m -= m / cg_den * cg_den;
- if (m < 0) {
- c[k]--;
- m += cg_den;
- }
- f[k] = m;
- }
- ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
- }
- } else {
- /* Advance colors by di pixels. */
- ci1 = 0;
- for (k = 0; k < n; k++) {
- int shift = cinfo->comp_shift[k];
- int bits = cinfo->comp_bits[k];
+ c[k] += m / cg_den;
+ m -= m / cg_den * cg_den;
+ if (m < 0) {
+ c[k]--;
+ m += cg_den;
+ }
+ f[k] = m;
+ }
+ ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
+ }
+ } else {
+ /* Advance colors by di pixels. */
+ ci1 = 0;
+ for (k = 0; k < n; k++) {
+ int shift = cinfo->comp_shift[k];
+ int bits = cinfo->comp_bits[k];
- if (cg_num[k]) {
- int64_t M = f[k] + (int64_t)cg_num[k] * di;
- int32_t m;
+ if (cg_num[k]) {
+ int64_t M = f[k] + (int64_t)cg_num[k] * di;
+ int32_t m;
- c[k] += (frac31)(M / cg_den);
- m = (int32_t)(M - M / cg_den * cg_den);
- if (m < 0) {
- c[k]--;
- m += cg_den;
- }
- f[k] = m;
- }
- ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
- }
- }
- if (ci1 != ci0) {
- si = max(bi, fixed2int(fa->clip->p.x)); /* Must be compatible to the clipping logic. */
- ei = min(i, fixed2int_ceiling(fa->clip->q.x)); /* Must be compatible to the clipping logic. */
- if (si < ei) {
- if (fa->swap_axes) {
- vd_rect(int2fixed(j), int2fixed(si), int2fixed(j + 1), int2fixed(ei), 1, (ulong)ci0);
- code = dev_proc(dev, fill_rectangle)(dev, j, si, 1, ei - si, ci0);
- } else {
- vd_rect(int2fixed(si), int2fixed(j), int2fixed(ei), int2fixed(j + 1), 1, (ulong)ci0);
- code = dev_proc(dev, fill_rectangle)(dev, si, j, ei - si, 1, ci0);
- }
- if (code < 0)
- return code;
- }
- bi = i;
- ci0 = ci1;
- di = 1;
- } else if (i == i1) {
- i++;
- break;
- } else {
- /* Compute a color change pixel analitically. */
- di = i1 - i;
- for (k = 0; k < n; k++) {
- int32_t a;
- int64_t x;
- frac31 v = 1 << (31 - cinfo->comp_bits[k]); /* Color index precision in frac31. */
- frac31 u = c[k] & (v - 1);
+ c[k] += (frac31)(M / cg_den);
+ m = (int32_t)(M - M / cg_den * cg_den);
+ if (m < 0) {
+ c[k]--;
+ m += cg_den;
+ }
+ f[k] = m;
+ }
+ ci1 |= (gx_color_index)(c[k] >> (sizeof(c[k]) * 8 - 1 - bits)) << shift;
+ }
+ }
+ if (ci1 != ci0) {
+ si = max(bi, fixed2int(fa->clip->p.x)); /* Must be compatible to the clipping logic. */
+ ei = min(i, fixed2int_ceiling(fa->clip->q.x)); /* Must be compatible to the clipping logic. */
+ if (si < ei) {
+ if (fa->swap_axes) {
+ vd_rect(int2fixed(j), int2fixed(si), int2fixed(j + 1), int2fixed(ei), 1, (ulong)ci0);
+ code = dev_proc(dev, fill_rectangle)(dev, j, si, 1, ei - si, ci0);
+ } else {
+ vd_rect(int2fixed(si), int2fixed(j), int2fixed(ei), int2fixed(j + 1), 1, (ulong)ci0);
+ code = dev_proc(dev, fill_rectangle)(dev, si, j, ei - si, 1, ci0);
+ }
+ if (code < 0)
+ return code;
+ }
+ bi = i;
+ ci0 = ci1;
+ di = 1;
+ } else if (i == i1) {
+ i++;
+ break;
+ } else {
+ /* Compute a color change pixel analitically. */
+ di = i1 - i;
+ for (k = 0; k < n; k++) {
+ int32_t a;
+ int64_t x;
+ frac31 v = 1 << (31 - cinfo->comp_bits[k]); /* Color index precision in frac31. */
+ frac31 u = c[k] & (v - 1);
- if (cg_num[k] == 0) {
- /* No change. */
- continue;
- } if (cg_num[k] > 0) {
- /* Solve[(f[k] + cg_num[k]*x)/cg_den == v - u, x] */
- a = v - u;
- } else {
- /* Solve[(f[k] + cg_num[k]*x)/cg_den == - u - 1, x] */
- a = -u - 1;
- }
- x = ((int64_t)a * cg_den - f[k]) / cg_num[k];
- if (i + x >= i1)
- continue;
- else if (x < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- else if (di > (int)x) {
- di = (int)x;
- if (di <= 1) {
- di = 1;
- break;
- }
- }
- }
- }
+ if (cg_num[k] == 0) {
+ /* No change. */
+ continue;
+ } if (cg_num[k] > 0) {
+ /* Solve[(f[k] + cg_num[k]*x)/cg_den == v - u, x] */
+ a = v - u;
+ } else {
+ /* Solve[(f[k] + cg_num[k]*x)/cg_den == - u - 1, x] */
+ a = -u - 1;
+ }
+ x = ((int64_t)a * cg_den - f[k]) / cg_num[k];
+ if (i + x >= i1)
+ continue;
+ else if (x < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ else if (di > (int)x) {
+ di = (int)x;
+ if (di <= 1) {
+ di = 1;
+ break;
+ }
+ }
+ }
+ }
}
si = max(bi, fixed2int(fa->clip->p.x)); /* Must be compatible to the clipping logic. */
ei = min(i, fixed2int_ceiling(fa->clip->q.x)); /* Must be compatible to the clipping logic. */
if (si < ei) {
- if (fa->swap_axes) {
- vd_rect(int2fixed(j), int2fixed(si), int2fixed(j + 1), int2fixed(ei), 1, (ulong)ci0);
- return dev_proc(dev, fill_rectangle)(dev, j, si, 1, ei - si, ci0);
- } else {
- vd_rect(int2fixed(si), int2fixed(j), int2fixed(ei), int2fixed(j + 1), 1, (ulong)ci0);
- return dev_proc(dev, fill_rectangle)(dev, si, j, ei - si, 1, ci0);
- }
+ if (fa->swap_axes) {
+ vd_rect(int2fixed(j), int2fixed(si), int2fixed(j + 1), int2fixed(ei), 1, (ulong)ci0);
+ return dev_proc(dev, fill_rectangle)(dev, j, si, 1, ei - si, ci0);
+ } else {
+ vd_rect(int2fixed(si), int2fixed(j), int2fixed(ei), int2fixed(j + 1), 1, (ulong)ci0);
+ return dev_proc(dev, fill_rectangle)(dev, si, j, ei - si, 1, ci0);
+ }
}
return 0;
}
-
diff --git a/gs/base/gdevdsp.c b/gs/base/gdevdsp.c
index e94a0aff1..884427c6c 100644
--- a/gs/base/gdevdsp.c
+++ b/gs/base/gdevdsp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,13 +19,13 @@
* by Russell Lang, Ghostgum Software Pty Ltd
*
* This device is intended to be used for displays when
- * Ghostscript is loaded as a DLL/shared library/static library.
- * It is intended to work for Windows, OS/2, Linux, Mac OS 9 and
+ * Ghostscript is loaded as a DLL/shared library/static library.
+ * It is intended to work for Windows, OS/2, Linux, Mac OS 9 and
* hopefully others.
*
- * Before this device is opened, the address of a structure must
+ * Before this device is opened, the address of a structure must
* be provided using gsapi_set_display_callback(minst, callback);
- * This structure contains callback functions to notify the
+ * This structure contains callback functions to notify the
* caller when the device is opened, closed, resized, showpage etc.
* The structure is defined in gdevdsp.h.
*
@@ -91,7 +91,6 @@ static dev_proc_decode_color(display_separation_decode_color);
static dev_proc_update_spot_equivalent_colors(display_update_spot_equivalent_colors);
static dev_proc_ret_devn_params(display_ret_devn_params);
-
static const gx_device_procs display_procs =
{
display_open,
@@ -161,25 +160,25 @@ static const gx_device_procs display_procs =
/* GC descriptor */
public_st_device_display();
-static
+static
ENUM_PTRS_WITH(display_enum_ptrs, gx_device_display *ddev)
if (index == 0) {
- if (ddev->mdev) {
- return ENUM_OBJ(gx_device_enum_ptr((gx_device *)ddev->mdev));
- }
- return 0;
+ if (ddev->mdev) {
+ return ENUM_OBJ(gx_device_enum_ptr((gx_device *)ddev->mdev));
+ }
+ return 0;
}
else if (index-1 < ddev->devn_params.separations.num_separations)
ENUM_RETURN(ddev->devn_params.separations.names[index-1].data);
else
- return 0;
+ return 0;
ENUM_PTRS_END
-static
+static
RELOC_PTRS_WITH(display_reloc_ptrs, gx_device_display *ddev)
if (ddev->mdev) {
- ddev->mdev = (gx_device_memory *)
- gx_device_reloc_ptr((gx_device *)ddev->mdev, gcst);
+ ddev->mdev = (gx_device_memory *)
+ gx_device_reloc_ptr((gx_device *)ddev->mdev, gcst);
}
{ int i;
for (i = 0; i < ddev->devn_params.separations.num_separations; ++i) {
@@ -188,13 +187,12 @@ RELOC_PTRS_WITH(display_reloc_ptrs, gx_device_display *ddev)
}
RELOC_PTRS_END
-
const gx_device_display gs_display_device =
{
std_device_std_body_type(gx_device_display, &display_procs, "display",
- &st_device_display,
- INITIAL_WIDTH, INITIAL_HEIGHT,
- INITIAL_RESOLUTION, INITIAL_RESOLUTION),
+ &st_device_display,
+ INITIAL_WIDTH, INITIAL_HEIGHT,
+ INITIAL_RESOLUTION, INITIAL_RESOLUTION),
{0}, /* std_procs */
NULL, /* mdev */
NULL, /* callback */
@@ -217,8 +215,6 @@ const gx_device_display gs_display_device =
{ true } /* equivalent CMYK colors for spot colors */
};
-
-
/* prototypes for internal procedures */
static int display_check_structure(gx_device_display *dev);
static void display_free_bitmap(gx_device_display * dev);
@@ -242,45 +238,45 @@ display_open(gx_device * dev)
/* Allow device to be opened "disabled" without a callback. */
/* The callback will be set later and the device re-opened. */
if (ddev->callback == NULL)
- return 0;
+ return 0;
/* Make sure we have been passed a valid callback structure. */
if ((ccode = display_check_structure(ddev)) < 0)
- return_error(ccode);
+ return_error(ccode);
/* set color info */
if ((ccode = display_set_color_format(ddev, ddev->nFormat)) < 0)
- return_error(ccode);
+ return_error(ccode);
/* Tell caller that the device is open. */
/* This is always the first callback */
ccode = (*(ddev->callback->display_open))(ddev->pHandle, dev);
if (ccode < 0)
- return_error(ccode);
+ return_error(ccode);
/* Tell caller the proposed device parameters */
ccode = (*(ddev->callback->display_presize)) (ddev->pHandle, dev,
- dev->width, dev->height, display_raster(ddev), ddev->nFormat);
+ dev->width, dev->height, display_raster(ddev), ddev->nFormat);
if (ccode < 0) {
- (*(ddev->callback->display_close))(ddev->pHandle, dev);
- return_error(ccode);
+ (*(ddev->callback->display_close))(ddev->pHandle, dev);
+ return_error(ccode);
}
/* allocate the image */
ccode = display_alloc_bitmap(ddev, dev);
if (ccode < 0) {
- (*(ddev->callback->display_close))(ddev->pHandle, dev);
- return_error(ccode);
+ (*(ddev->callback->display_close))(ddev->pHandle, dev);
+ return_error(ccode);
}
/* Tell caller the device parameters */
ccode = (*(ddev->callback->display_size)) (ddev->pHandle, dev,
- dev->width, dev->height, display_raster(ddev), ddev->nFormat,
- ddev->mdev->base);
+ dev->width, dev->height, display_raster(ddev), ddev->nFormat,
+ ddev->mdev->base);
if (ccode < 0) {
- display_free_bitmap(ddev);
- (*(ddev->callback->display_close))(ddev->pHandle, dev);
- return_error(ccode);
+ display_free_bitmap(ddev);
+ (*(ddev->callback->display_close))(ddev->pHandle, dev);
+ return_error(ccode);
}
return 0;
@@ -291,9 +287,9 @@ display_get_initial_matrix(gx_device * dev, gs_matrix * pmat)
{
gx_device_display *ddev = (gx_device_display *) dev;
if ((ddev->nFormat & DISPLAY_FIRSTROW_MASK) == DISPLAY_TOPFIRST)
- gx_default_get_initial_matrix(dev, pmat);
+ gx_default_get_initial_matrix(dev, pmat);
else
- gx_upright_get_initial_matrix(dev, pmat); /* Windows / OS/2 */
+ gx_upright_get_initial_matrix(dev, pmat); /* Windows / OS/2 */
}
/* Update the display. */
@@ -302,7 +298,7 @@ display_sync_output(gx_device * dev)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
+ return 0;
display_set_separations(ddev);
(*(ddev->callback->display_sync))(ddev->pHandle, dev);
@@ -317,14 +313,14 @@ display_output_page(gx_device * dev, int copies, int flush)
gx_device_display *ddev = (gx_device_display *) dev;
int code;
if (ddev->callback == NULL)
- return 0;
+ return 0;
display_set_separations(ddev);
code = (*(ddev->callback->display_page))
- (ddev->pHandle, dev, copies, flush);
+ (ddev->pHandle, dev, copies, flush);
if (code >= 0)
- code = gx_finish_output_page(dev, copies, flush);
+ code = gx_finish_output_page(dev, copies, flush);
return code;
}
@@ -334,7 +330,7 @@ display_close(gx_device * dev)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
+ return 0;
/* Tell caller that device is about to be closed. */
(*(ddev->callback->display_preclose))(ddev->pHandle, dev);
@@ -369,7 +365,7 @@ display_map_rgb_color_device4(gx_device * dev, const gx_color_value cv[])
/* Map a color code to r-g-b. */
static int
display_map_color_rgb_device4(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
pc_4bit_map_color_rgb(dev, color, prgb);
return 0;
@@ -387,59 +383,58 @@ display_encode_color_device8(gx_device * dev, const gx_color_value cv[])
gx_color_value b = cv[2];
gx_color_value k = cv[3]; /* 0 = black */
if ((r == 0) && (g == 0) && (b == 0)) {
- k = ((k >> (gx_color_value_bits - 6)) + 1) >> 1;
- if (k > 0x1f)
- k = 0x1f;
- return (k + 0x40);
+ k = ((k >> (gx_color_value_bits - 6)) + 1) >> 1;
+ if (k > 0x1f)
+ k = 0x1f;
+ return (k + 0x40);
}
if (k > 0) {
- /* The RGB->RGBK color mapping shouldn't generate this. */
- r = ((r+k) > gx_max_color_value) ? gx_max_color_value :
- (gx_color_value)(r+k);
- g = ((g+k) > gx_max_color_value) ? gx_max_color_value :
- (gx_color_value)(g+k);
- b = ((b+k) > gx_max_color_value) ? gx_max_color_value :
- (gx_color_value)(b+k);
+ /* The RGB->RGBK color mapping shouldn't generate this. */
+ r = ((r+k) > gx_max_color_value) ? gx_max_color_value :
+ (gx_color_value)(r+k);
+ g = ((g+k) > gx_max_color_value) ? gx_max_color_value :
+ (gx_color_value)(g+k);
+ b = ((b+k) > gx_max_color_value) ? gx_max_color_value :
+ (gx_color_value)(b+k);
}
r = ((r >> (gx_color_value_bits - 3)) + 1) >> 1;
if (r > 0x3)
- r = 0x3;
+ r = 0x3;
g = ((g >> (gx_color_value_bits - 3)) + 1) >> 1;
if (g > 0x3)
- g = 0x3;
+ g = 0x3;
b = ((b >> (gx_color_value_bits - 3)) + 1) >> 1;
if (b > 0x3)
- b = 0x3;
+ b = 0x3;
return (r << 4) + (g << 2) + b;
}
/* Map a color code to r-g-b-k. */
static int
display_decode_color_device8(gx_device * dev, gx_color_index color,
- gx_color_value prgb[4])
+ gx_color_value prgb[4])
{
gx_color_value one;
/* palette of 96 colors */
/* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
if (color < 64) {
- one = (gx_color_value) (gx_max_color_value / 3);
- prgb[0] = (gx_color_value) (((color >> 4) & 3) * one);
- prgb[1] = (gx_color_value) (((color >> 2) & 3) * one);
- prgb[2] = (gx_color_value) (((color) & 3) * one);
- prgb[3] = 0;
+ one = (gx_color_value) (gx_max_color_value / 3);
+ prgb[0] = (gx_color_value) (((color >> 4) & 3) * one);
+ prgb[1] = (gx_color_value) (((color >> 2) & 3) * one);
+ prgb[2] = (gx_color_value) (((color) & 3) * one);
+ prgb[3] = 0;
}
else if (color < 96) {
- one = (gx_color_value) (gx_max_color_value / 31);
- prgb[0] = prgb[1] = prgb[2] = 0;
- prgb[3] = (gx_color_value) ((color & 0x1f) * one);
+ one = (gx_color_value) (gx_max_color_value / 31);
+ prgb[0] = prgb[1] = prgb[2] = 0;
+ prgb[3] = (gx_color_value) ((color & 0x1f) * one);
}
else {
- prgb[0] = prgb[1] = prgb[2] = prgb[3] = 0;
+ prgb[0] = prgb[1] = prgb[2] = prgb[3] = 0;
}
return 0;
}
-
/* DISPLAY_COLORS_NATIVE, 16bit/pixel */
/* Map a r-g-b color to a color code */
static gx_color_index
@@ -450,111 +445,108 @@ display_map_rgb_color_device16(gx_device * dev, const gx_color_value cv[])
gx_color_value g = cv[1];
gx_color_value b = cv[2];
if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555)
- /* byte0=0RRRRRGG byte1=GGGBBBBB */
- return ((r >> (gx_color_value_bits - 5)) << 10) +
- ((g >> (gx_color_value_bits - 5)) << 5) +
- (b >> (gx_color_value_bits - 5));
- else
- /* byte0=RRRRRGGG byte1=GGGBBBBB */
- return ((r >> (gx_color_value_bits - 5)) << 11) +
- ((g >> (gx_color_value_bits - 6)) << 5) +
- (b >> (gx_color_value_bits - 5));
+ if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555)
+ /* byte0=0RRRRRGG byte1=GGGBBBBB */
+ return ((r >> (gx_color_value_bits - 5)) << 10) +
+ ((g >> (gx_color_value_bits - 5)) << 5) +
+ (b >> (gx_color_value_bits - 5));
+ else
+ /* byte0=RRRRRGGG byte1=GGGBBBBB */
+ return ((r >> (gx_color_value_bits - 5)) << 11) +
+ ((g >> (gx_color_value_bits - 6)) << 5) +
+ (b >> (gx_color_value_bits - 5));
}
if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555)
- /* byte0=GGGBBBBB byte1=0RRRRRGG */
- return ((r >> (gx_color_value_bits - 5)) << 2) +
- (((g >> (gx_color_value_bits - 5)) & 0x7) << 13) +
- (((g >> (gx_color_value_bits - 5)) & 0x18) >> 3) +
- ((b >> (gx_color_value_bits - 5)) << 8);
+ /* byte0=GGGBBBBB byte1=0RRRRRGG */
+ return ((r >> (gx_color_value_bits - 5)) << 2) +
+ (((g >> (gx_color_value_bits - 5)) & 0x7) << 13) +
+ (((g >> (gx_color_value_bits - 5)) & 0x18) >> 3) +
+ ((b >> (gx_color_value_bits - 5)) << 8);
/* byte0=GGGBBBBB byte1=RRRRRGGG */
return ((r >> (gx_color_value_bits - 5)) << 3) +
- (((g >> (gx_color_value_bits - 6)) & 0x7) << 13) +
- (((g >> (gx_color_value_bits - 6)) & 0x38) >> 3) +
- ((b >> (gx_color_value_bits - 5)) << 8);
+ (((g >> (gx_color_value_bits - 6)) & 0x7) << 13) +
+ (((g >> (gx_color_value_bits - 6)) & 0x38) >> 3) +
+ ((b >> (gx_color_value_bits - 5)) << 8);
}
-
-
/* Map a color code to r-g-b. */
static int
display_map_color_rgb_device16(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_device_display *ddev = (gx_device_display *) dev;
ushort value;
if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
- /* byte0=0RRRRRGG byte1=GGGBBBBB */
- value = (ushort) (color >> 10);
- prgb[0] = (gx_color_value)
- (((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits));
- value = (ushort) ((color >> 5) & 0x1f);
- prgb[1] = (gx_color_value)
- (((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits));
- value = (ushort) (color & 0x1f);
- prgb[2] = (gx_color_value)
- (((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits));
- }
- else {
- /* byte0=RRRRRGGG byte1=GGGBBBBB */
- value = (ushort) (color >> 11);
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (ushort) ((color >> 5) & 0x3f);
- prgb[1] = (gx_color_value)
- ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
- value = (ushort) (color & 0x1f);
- prgb[2] = (gx_color_value)
- ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- }
+ if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
+ /* byte0=0RRRRRGG byte1=GGGBBBBB */
+ value = (ushort) (color >> 10);
+ prgb[0] = (gx_color_value)
+ (((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits));
+ value = (ushort) ((color >> 5) & 0x1f);
+ prgb[1] = (gx_color_value)
+ (((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits));
+ value = (ushort) (color & 0x1f);
+ prgb[2] = (gx_color_value)
+ (((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits));
+ }
+ else {
+ /* byte0=RRRRRGGG byte1=GGGBBBBB */
+ value = (ushort) (color >> 11);
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (ushort) ((color >> 5) & 0x3f);
+ prgb[1] = (gx_color_value)
+ ((value << 10) + (value << 4) + (value >> 2))
+ >> (16 - gx_color_value_bits);
+ value = (ushort) (color & 0x1f);
+ prgb[2] = (gx_color_value)
+ ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ }
}
else {
- if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
- /* byte0=GGGBBBBB byte1=0RRRRRGG */
- value = (ushort) ((color >> 2) & 0x1f);
- prgb[0] = (gx_color_value)
- ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (ushort)
- (((color << 3) & 0x18) + ((color >> 13) & 0x7));
- prgb[1] = (gx_color_value)
- ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (ushort) ((color >> 8) & 0x1f);
- prgb[2] = (gx_color_value)
- ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- }
- else {
- /* byte0=GGGBBBBB byte1=RRRRRGGG */
- value = (ushort) ((color >> 3) & 0x1f);
- prgb[0] = (gx_color_value)
- (((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits));
- value = (ushort)
- (((color << 3) & 0x38) + ((color >> 13) & 0x7));
- prgb[1] = (gx_color_value)
- (((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits));
- value = (ushort) ((color >> 8) & 0x1f);
- prgb[2] = (gx_color_value)
- (((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits));
- }
+ if ((ddev->nFormat & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
+ /* byte0=GGGBBBBB byte1=0RRRRRGG */
+ value = (ushort) ((color >> 2) & 0x1f);
+ prgb[0] = (gx_color_value)
+ ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (ushort)
+ (((color << 3) & 0x18) + ((color >> 13) & 0x7));
+ prgb[1] = (gx_color_value)
+ ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (ushort) ((color >> 8) & 0x1f);
+ prgb[2] = (gx_color_value)
+ ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ }
+ else {
+ /* byte0=GGGBBBBB byte1=RRRRRGGG */
+ value = (ushort) ((color >> 3) & 0x1f);
+ prgb[0] = (gx_color_value)
+ (((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits));
+ value = (ushort)
+ (((color << 3) & 0x38) + ((color >> 13) & 0x7));
+ prgb[1] = (gx_color_value)
+ (((value << 10) + (value << 4) + (value >> 2))
+ >> (16 - gx_color_value_bits));
+ value = (ushort) ((color >> 8) & 0x1f);
+ prgb[2] = (gx_color_value)
+ (((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits));
+ }
}
return 0;
}
-
/* Map a r-g-b color to a color code */
static gx_color_index
display_map_rgb_color_rgb(gx_device * dev, const gx_color_value cv[])
@@ -571,26 +563,26 @@ display_map_rgb_color_rgb(gx_device * dev, const gx_color_value cv[])
blue = b >> drop;
switch (ddev->nFormat & DISPLAY_ALPHA_MASK) {
- case DISPLAY_ALPHA_NONE:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
+ case DISPLAY_ALPHA_NONE:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
gx_color_value rgb[3];
rgb[0] = r; rgb[1] = g; rgb[2] = b;
- return gx_default_rgb_map_rgb_color(dev, rgb); /* RGB */
+ return gx_default_rgb_map_rgb_color(dev, rgb); /* RGB */
}
- else
- return (blue<<16) + (green<<8) + red; /* BGR */
- case DISPLAY_ALPHA_FIRST:
- case DISPLAY_UNUSED_FIRST:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
- return ((gx_color_index)red<<16) + (green<<8) + blue; /* xRGB */
- else
- return ((gx_color_index)blue<<16) + (green<<8) + red; /* xBGR */
- case DISPLAY_ALPHA_LAST:
- case DISPLAY_UNUSED_LAST:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
- return ((gx_color_index)red<<24) + (green<<16) + (blue<<8); /* RGBx */
- else
- return ((gx_color_index)blue<<24) + (green<<16) + (red<<8); /* BGRx */
+ else
+ return (blue<<16) + (green<<8) + red; /* BGR */
+ case DISPLAY_ALPHA_FIRST:
+ case DISPLAY_UNUSED_FIRST:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
+ return ((gx_color_index)red<<16) + (green<<8) + blue; /* xRGB */
+ else
+ return ((gx_color_index)blue<<16) + (green<<8) + red; /* xBGR */
+ case DISPLAY_ALPHA_LAST:
+ case DISPLAY_UNUSED_LAST:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
+ return ((gx_color_index)red<<24) + (green<<16) + (blue<<8); /* RGBx */
+ else
+ return ((gx_color_index)blue<<24) + (green<<16) + (red<<8); /* BGRx */
}
return 0;
}
@@ -598,82 +590,82 @@ display_map_rgb_color_rgb(gx_device * dev, const gx_color_value cv[])
/* Map a color code to r-g-b. */
static int
display_map_color_rgb_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_device_display *ddev = (gx_device_display *) dev;
uint bits_per_color = 8;
uint color_mask;
-
+
color_mask = (1 << bits_per_color) - 1;
switch (ddev->nFormat & DISPLAY_ALPHA_MASK) {
- case DISPLAY_ALPHA_NONE:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
- return gx_default_rgb_map_color_rgb(dev, color, prgb); /* RGB */
- else {
- /* BGR */
- prgb[0] = (gx_color_value) (((color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[1] = (gx_color_value)
- (((color >> bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[2] = (gx_color_value)
- (((color >> 2*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- }
- break;
- case DISPLAY_ALPHA_FIRST:
- case DISPLAY_UNUSED_FIRST:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- /* xRGB */
- prgb[0] = (gx_color_value)
- (((color >> 2*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[1] = (gx_color_value)
- (((color >> bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[2] = (gx_color_value) (((color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- }
- else {
- /* xBGR */
- prgb[0] = (gx_color_value)
- (((color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[1] = (gx_color_value)
- (((color >> bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[2] = (gx_color_value)
- (((color >> 2*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- }
- break;
- case DISPLAY_ALPHA_LAST:
- case DISPLAY_UNUSED_LAST:
- if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- /* RGBx */
- prgb[0] = (gx_color_value)
- (((color >> 3*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[1] = (gx_color_value)
- (((color >> 2*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[2] = (gx_color_value)
- (((color >> bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- }
- else {
- /* BGRx */
- prgb[0] = (gx_color_value)
- (((color >> bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[1] = (gx_color_value)
- (((color >> 2*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- prgb[2] = (gx_color_value)
- (((color >> 3*bits_per_color) & color_mask) *
- (ulong) gx_max_color_value / color_mask);
- }
+ case DISPLAY_ALPHA_NONE:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
+ return gx_default_rgb_map_color_rgb(dev, color, prgb); /* RGB */
+ else {
+ /* BGR */
+ prgb[0] = (gx_color_value) (((color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[1] = (gx_color_value)
+ (((color >> bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[2] = (gx_color_value)
+ (((color >> 2*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ }
+ break;
+ case DISPLAY_ALPHA_FIRST:
+ case DISPLAY_UNUSED_FIRST:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
+ /* xRGB */
+ prgb[0] = (gx_color_value)
+ (((color >> 2*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[1] = (gx_color_value)
+ (((color >> bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[2] = (gx_color_value) (((color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ }
+ else {
+ /* xBGR */
+ prgb[0] = (gx_color_value)
+ (((color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[1] = (gx_color_value)
+ (((color >> bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[2] = (gx_color_value)
+ (((color >> 2*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ }
+ break;
+ case DISPLAY_ALPHA_LAST:
+ case DISPLAY_UNUSED_LAST:
+ if ((ddev->nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
+ /* RGBx */
+ prgb[0] = (gx_color_value)
+ (((color >> 3*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[1] = (gx_color_value)
+ (((color >> 2*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[2] = (gx_color_value)
+ (((color >> bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ }
+ else {
+ /* BGRx */
+ prgb[0] = (gx_color_value)
+ (((color >> bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[1] = (gx_color_value)
+ (((color >> 2*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ prgb[2] = (gx_color_value)
+ (((color >> 3*bits_per_color) & color_mask) *
+ (ulong) gx_max_color_value / color_mask);
+ }
}
return 0;
}
@@ -693,7 +685,7 @@ display_map_rgb_color_bgr24(gx_device * dev, const gx_color_value cv[])
/* Map a color code to r-g-b. */
static int
display_map_color_rgb_bgr24(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
prgb[0] = gx_color_value_from_byte(color & 0xff);
prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
@@ -704,48 +696,48 @@ display_map_color_rgb_bgr24(gx_device * dev, gx_color_index color,
/* Fill a rectangle */
static int
display_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
- dev_proc(ddev->mdev, fill_rectangle)((gx_device *)ddev->mdev,
- x, y, w, h, color);
+ return 0;
+ dev_proc(ddev->mdev, fill_rectangle)((gx_device *)ddev->mdev,
+ x, y, w, h, color);
if (ddev->callback->display_update)
- (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
+ (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
return 0;
}
/* Copy a monochrome bitmap */
static int
display_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
- dev_proc(ddev->mdev, copy_mono)((gx_device *)ddev->mdev,
- base, sourcex, raster, id, x, y, w, h, zero, one);
+ return 0;
+ dev_proc(ddev->mdev, copy_mono)((gx_device *)ddev->mdev,
+ base, sourcex, raster, id, x, y, w, h, zero, one);
if (ddev->callback->display_update)
- (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
+ (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
return 0;
}
/* Copy a color pixel map */
static int
display_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
- dev_proc(ddev->mdev, copy_color)((gx_device *)ddev->mdev,
- base, sourcex, raster, id, x, y, w, h);
+ return 0;
+ dev_proc(ddev->mdev, copy_color)((gx_device *)ddev->mdev,
+ base, sourcex, raster, id, x, y, w, h);
if (ddev->callback->display_update)
- (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
+ (*(ddev->callback->display_update))(ddev->pHandle, dev, x, y, w, h);
return 0;
}
@@ -754,9 +746,9 @@ display_get_bits(gx_device * dev, int y, byte * str, byte ** actual_data)
{
gx_device_display *ddev = (gx_device_display *) dev;
if (ddev->callback == NULL)
- return 0;
- return dev_proc(ddev->mdev, get_bits)((gx_device *)ddev->mdev,
- y, str, actual_data);
+ return 0;
+ return dev_proc(ddev->mdev, get_bits)((gx_device *)ddev->mdev,
+ y, str, actual_data);
}
static int
@@ -770,36 +762,36 @@ display_get_params(gx_device * dev, gs_param_list * plist)
int i = 0;
size_t dptr;
char buf[64];
-
+
idx = ((int)sizeof(size_t)) * 8 - 4;
buf[i++] = '1';
buf[i++] = '6';
buf[i++] = '#';
dptr = (size_t)(ddev->pHandle);
while (idx >= 0) {
- val = (int)(dptr >> idx) & 0xf;
+ val = (int)(dptr >> idx) & 0xf;
if (val <= 9)
- buf[i++] = '0' + val;
- else
- buf[i++] = 'a' - 10 + val;
- idx -= 4;
+ buf[i++] = '0' + val;
+ else
+ buf[i++] = 'a' - 10 + val;
+ idx -= 4;
}
buf[i] = '\0';
-
+
param_string_from_transient_string(dhandle, buf);
code = gx_default_get_params(dev, plist);
(void)(code < 0 ||
- (code = param_write_string(plist,
- "DisplayHandle", &dhandle)) < 0 ||
- (code = param_write_int(plist,
- "DisplayFormat", &ddev->nFormat)) < 0 ||
- (code = param_write_float(plist,
- "DisplayResolution", &ddev->HWResolution[1])) < 0);
+ (code = param_write_string(plist,
+ "DisplayHandle", &dhandle)) < 0 ||
+ (code = param_write_int(plist,
+ "DisplayFormat", &ddev->nFormat)) < 0 ||
+ (code = param_write_float(plist,
+ "DisplayResolution", &ddev->HWResolution[1])) < 0);
if (code >= 0 &&
- (ddev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION)
- code = devn_get_params(dev, plist, &ddev->devn_params,
- &ddev->equiv_cmyk_colors);
+ (ddev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION)
+ code = devn_get_params(dev, plist, &ddev->devn_params,
+ &ddev->equiv_cmyk_colors);
return code;
}
@@ -836,213 +828,212 @@ display_put_params(gx_device * dev, gs_param_list * plist)
/* Handle extra parameters */
switch (code = param_read_int(plist, "DisplayFormat", &format)) {
- case 0:
- if (dev->is_open) {
- if (ddev->nFormat != format)
- ecode = gs_error_rangecheck;
- else
- break;
- }
- else {
- code = display_set_color_format(ddev, format);
- if (code < 0)
- ecode = code;
- else
- break;
- }
- goto cfe;
- default:
- ecode = code;
- cfe:param_signal_error(plist, "DisplayFormat", ecode);
- case 1:
- break;
+ case 0:
+ if (dev->is_open) {
+ if (ddev->nFormat != format)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ }
+ else {
+ code = display_set_color_format(ddev, format);
+ if (code < 0)
+ ecode = code;
+ else
+ break;
+ }
+ goto cfe;
+ default:
+ ecode = code;
+ cfe:param_signal_error(plist, "DisplayFormat", ecode);
+ case 1:
+ break;
}
/* 64-bit systems need to use DisplayHandle as a string */
switch (code = param_read_string(plist, "DisplayHandle", &dh)) {
- case 0:
- found_string_handle = 1;
- break;
- default:
- if ((code == gs_error_typecheck) && (sizeof(size_t) <= 4)) {
- /* 32-bit systems can use the older long type */
- switch (code = param_read_long(plist, "DisplayHandle",
- (long *)(&handle))) {
- case 0:
- if (dev->is_open) {
- if (ddev->pHandle != handle)
- ecode = gs_error_rangecheck;
- else
- break;
- }
- else {
- ddev->pHandle = handle;
- break;
- }
- goto hdle;
- default:
- ecode = code;
- hdle:param_signal_error(plist, "DisplayHandle", ecode);
- case 1:
- break;
- }
- break;
- }
- ecode = code;
- param_signal_error(plist, "DisplayHandle", ecode);
- /* fall through */
- case 1:
- dh.data = 0;
- break;
+ case 0:
+ found_string_handle = 1;
+ break;
+ default:
+ if ((code == gs_error_typecheck) && (sizeof(size_t) <= 4)) {
+ /* 32-bit systems can use the older long type */
+ switch (code = param_read_long(plist, "DisplayHandle",
+ (long *)(&handle))) {
+ case 0:
+ if (dev->is_open) {
+ if (ddev->pHandle != handle)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ }
+ else {
+ ddev->pHandle = handle;
+ break;
+ }
+ goto hdle;
+ default:
+ ecode = code;
+ hdle:param_signal_error(plist, "DisplayHandle", ecode);
+ case 1:
+ break;
+ }
+ break;
+ }
+ ecode = code;
+ param_signal_error(plist, "DisplayHandle", ecode);
+ /* fall through */
+ case 1:
+ dh.data = 0;
+ break;
}
if (found_string_handle) {
- /*
- * Convert from a string to a pointer.
- * It is assumed that size_t has the same size as a pointer.
- * Allow formats (1234), (10#1234) or (16#04d2).
- */
- size_t ptr = 0;
- int i;
- int base = 10;
- int val;
- code = 0;
- for (i=0; i<dh.size; i++) {
- val = dh.data[i];
- if ((val >= '0') && (val <= '9'))
- val = val - '0';
- else if ((val >= 'A') && (val <= 'F'))
- val = val - 'A' + 10;
- else if ((val >= 'a') && (val <= 'f'))
- val = val - 'a' + 10;
- else if (val == '#') {
- base = (int)ptr;
- ptr = 0;
- if ((base != 10) && (base != 16)) {
- code = gs_error_rangecheck;
- break;
- }
- continue;
- }
- else {
- code = gs_error_rangecheck;
- break;
- }
-
- if (base == 10)
- ptr = ptr * 10 + val;
- else if (base == 16)
- ptr = ptr * 16 + val;
- else {
- code = gs_error_rangecheck;
- break;
- }
- }
- if (code == 0) {
- if (dev->is_open) {
- if (ddev->pHandle != (void *)ptr)
- code = gs_error_rangecheck;
- }
- else
- ddev->pHandle = (void *)ptr;
- }
- if (code < 0) {
- ecode = code;
- param_signal_error(plist, "DisplayHandle", ecode);
- }
+ /*
+ * Convert from a string to a pointer.
+ * It is assumed that size_t has the same size as a pointer.
+ * Allow formats (1234), (10#1234) or (16#04d2).
+ */
+ size_t ptr = 0;
+ int i;
+ int base = 10;
+ int val;
+ code = 0;
+ for (i=0; i<dh.size; i++) {
+ val = dh.data[i];
+ if ((val >= '0') && (val <= '9'))
+ val = val - '0';
+ else if ((val >= 'A') && (val <= 'F'))
+ val = val - 'A' + 10;
+ else if ((val >= 'a') && (val <= 'f'))
+ val = val - 'a' + 10;
+ else if (val == '#') {
+ base = (int)ptr;
+ ptr = 0;
+ if ((base != 10) && (base != 16)) {
+ code = gs_error_rangecheck;
+ break;
+ }
+ continue;
+ }
+ else {
+ code = gs_error_rangecheck;
+ break;
+ }
+
+ if (base == 10)
+ ptr = ptr * 10 + val;
+ else if (base == 16)
+ ptr = ptr * 16 + val;
+ else {
+ code = gs_error_rangecheck;
+ break;
+ }
+ }
+ if (code == 0) {
+ if (dev->is_open) {
+ if (ddev->pHandle != (void *)ptr)
+ code = gs_error_rangecheck;
+ }
+ else
+ ddev->pHandle = (void *)ptr;
+ }
+ if (code < 0) {
+ ecode = code;
+ param_signal_error(plist, "DisplayHandle", ecode);
+ }
}
- /*
+ /*
* Set the initial display resolution.
- * If HWResolution is explicitly set, e.g. using -rDPI on the
+ * If HWResolution is explicitly set, e.g. using -rDPI on the
* command line, then use that. Otherwise, use DisplayResolution
* which is typically set by the client to the display
* logical resolution. Once either of these have been
* used, ignore all further DisplayResolution parameters.
*/
if (param_read_float_array(plist, "HWResolution", &hwra) == 0)
- ddev->HWResolution_set = 1;
+ ddev->HWResolution_set = 1;
switch (code = param_read_float(plist, "DisplayResolution", &dispres)) {
- case 0:
- if (!ddev->HWResolution_set) {
- gx_device_set_resolution(dev, dispres, dispres);
- ddev->HWResolution_set = 1;
- }
- break;
- default:
- ecode = code;
- param_signal_error(plist, "DisplayResolution", ecode);
- case 1:
- break;
+ case 0:
+ if (!ddev->HWResolution_set) {
+ gx_device_set_resolution(dev, dispres, dispres);
+ ddev->HWResolution_set = 1;
+ }
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, "DisplayResolution", ecode);
+ case 1:
+ break;
}
if (ecode >= 0 &&
- (ddev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION) {
- /* Use utility routine to handle devn parameters */
- ecode = devn_put_params(dev, plist, pdevn_params, pequiv_colors);
- /*
- * Setting MaxSeparations changes color_info.depth in
- * devn_put_params, but we always use 64bpp,
- * so reset it to the the correct value.
- */
- dev->color_info.depth = arch_sizeof_color_index * 8;
+ (ddev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION) {
+ /* Use utility routine to handle devn parameters */
+ ecode = devn_put_params(dev, plist, pdevn_params, pequiv_colors);
+ /*
+ * Setting MaxSeparations changes color_info.depth in
+ * devn_put_params, but we always use 64bpp,
+ * so reset it to the the correct value.
+ */
+ dev->color_info.depth = arch_sizeof_color_index * 8;
}
if (ecode >= 0) {
- /* Prevent gx_default_put_params from closing the device. */
- dev->is_open = false;
- ecode = gx_default_put_params(dev, plist);
- dev->is_open = is_open;
+ /* Prevent gx_default_put_params from closing the device. */
+ dev->is_open = false;
+ ecode = gx_default_put_params(dev, plist);
+ dev->is_open = is_open;
}
if (ecode < 0) {
- /* If we have an error then restore original data. */
- *pdevn_params = saved_devn_params;
- *pequiv_colors = saved_equiv_colors;
- if (format != old_format)
- display_set_color_format(ddev, old_format);
- ddev->pHandle = old_handle;
- dev->width = old_width;
- dev->height = old_height;
- return ecode;
+ /* If we have an error then restore original data. */
+ *pdevn_params = saved_devn_params;
+ *pequiv_colors = saved_equiv_colors;
+ if (format != old_format)
+ display_set_color_format(ddev, old_format);
+ ddev->pHandle = old_handle;
+ dev->width = old_width;
+ dev->height = old_height;
+ return ecode;
}
-
if ( is_open && ddev->callback &&
- ((old_width != dev->width) || (old_height != dev->height)) ) {
- /* We can resize this device while it is open, but we cannot
- * change the color format or handle.
- */
- /* Tell caller we are about to change the device parameters */
- if ((*ddev->callback->display_presize)(ddev->pHandle, dev,
- dev->width, dev->height, display_raster(ddev),
- ddev->nFormat) < 0) {
- /* caller won't let us change the size */
- /* restore parameters then return an error */
- *pdevn_params = saved_devn_params;
- *pequiv_colors = saved_equiv_colors;
- display_set_color_format(ddev, old_format);
- ddev->nFormat = old_format;
- ddev->pHandle = old_handle;
- dev->width = old_width;
- dev->height = old_height;
- return_error(gs_error_rangecheck);
- }
-
- display_free_bitmap(ddev);
-
- code = display_alloc_bitmap(ddev, dev);
- if (code < 0) {
- /* No bitmap, so tell the caller it is zero size */
- (*ddev->callback->display_size)(ddev->pHandle, dev,
- 0, 0, 0, ddev->nFormat, NULL);
- return_error(code);
+ ((old_width != dev->width) || (old_height != dev->height)) ) {
+ /* We can resize this device while it is open, but we cannot
+ * change the color format or handle.
+ */
+ /* Tell caller we are about to change the device parameters */
+ if ((*ddev->callback->display_presize)(ddev->pHandle, dev,
+ dev->width, dev->height, display_raster(ddev),
+ ddev->nFormat) < 0) {
+ /* caller won't let us change the size */
+ /* restore parameters then return an error */
+ *pdevn_params = saved_devn_params;
+ *pequiv_colors = saved_equiv_colors;
+ display_set_color_format(ddev, old_format);
+ ddev->nFormat = old_format;
+ ddev->pHandle = old_handle;
+ dev->width = old_width;
+ dev->height = old_height;
+ return_error(gs_error_rangecheck);
}
-
- /* tell caller about the new size */
- if ((*ddev->callback->display_size)(ddev->pHandle, dev,
- dev->width, dev->height, display_raster(ddev),
- ddev->nFormat, ddev->mdev->base) < 0)
- return_error(gs_error_rangecheck);
+
+ display_free_bitmap(ddev);
+
+ code = display_alloc_bitmap(ddev, dev);
+ if (code < 0) {
+ /* No bitmap, so tell the caller it is zero size */
+ (*ddev->callback->display_size)(ddev->pHandle, dev,
+ 0, 0, 0, ddev->nFormat, NULL);
+ return_error(code);
+ }
+
+ /* tell caller about the new size */
+ if ((*ddev->callback->display_size)(ddev->pHandle, dev,
+ dev->width, dev->height, display_raster(ddev),
+ ddev->nFormat, ddev->mdev->base) < 0)
+ return_error(gs_error_rangecheck);
}
return 0;
@@ -1079,7 +1070,7 @@ display_separation_gray_cs_to_cmyk_cm(gx_device * dev, frac gray, frac out[])
}
static void
-display_separation_rgb_cs_to_cmyk_cm(gx_device * dev,
+display_separation_rgb_cs_to_cmyk_cm(gx_device * dev,
const gs_imager_state *pis, frac r, frac g, frac b, frac out[])
{
int * map =
@@ -1089,7 +1080,7 @@ display_separation_rgb_cs_to_cmyk_cm(gx_device * dev,
}
static void
-display_separation_cmyk_cs_to_cmyk_cm(gx_device * dev,
+display_separation_cmyk_cs_to_cmyk_cm(gx_device * dev,
frac c, frac m, frac y, frac k, frac out[])
{
int * map =
@@ -1099,8 +1090,8 @@ display_separation_cmyk_cs_to_cmyk_cm(gx_device * dev,
}
static const gx_cm_color_map_procs display_separation_cm_procs = {
- display_separation_gray_cs_to_cmyk_cm,
- display_separation_rgb_cs_to_cmyk_cm,
+ display_separation_gray_cs_to_cmyk_cm,
+ display_separation_rgb_cs_to_cmyk_cm,
display_separation_cmyk_cs_to_cmyk_cm
};
@@ -1110,7 +1101,6 @@ display_separation_get_color_mapping_procs(const gx_device * dev)
return &display_separation_cm_procs;
}
-
/*
* Encode a list of colorant values into a gx_color_index_value.
*/
@@ -1124,11 +1114,11 @@ display_separation_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
- color |= (colors[i] >> drop);
+ color <<= bpc;
+ color |= (colors[i] >> drop);
}
if (bpc*ncomp < arch_sizeof_color_index * 8)
- color <<= (arch_sizeof_color_index * 8 - ncomp * bpc);
+ color <<= (arch_sizeof_color_index * 8 - ncomp * bpc);
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -1136,7 +1126,7 @@ display_separation_encode_color(gx_device *dev, const gx_color_value colors[])
* Decode a gx_color_index value back to a list of colorant values.
*/
static int
-display_separation_decode_color(gx_device * dev, gx_color_index color,
+display_separation_decode_color(gx_device * dev, gx_color_index color,
gx_color_value * out)
{
int bpc = ((gx_device_display *)dev)->devn_params.bitspercomponent;
@@ -1146,10 +1136,10 @@ display_separation_decode_color(gx_device * dev, gx_color_index color,
int ncomp = dev->color_info.num_components;
if (bpc*ncomp < arch_sizeof_color_index * 8)
- color >>= (arch_sizeof_color_index * 8 - ncomp * bpc);
+ color >>= (arch_sizeof_color_index * 8 - ncomp * bpc);
for (; i<ncomp; i++) {
- out[ncomp - i - 1] = (gx_color_value) ((color & mask) << drop);
- color >>= bpc;
+ out[ncomp - i - 1] = (gx_color_value) ((color & mask) << drop);
+ color >>= bpc;
}
return 0;
}
@@ -1164,7 +1154,7 @@ display_update_spot_equivalent_colors(gx_device * dev, const gs_state * pgs)
if ((ddev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION)
update_spot_equivalent_cmyk_colors(dev, pgs,
- &ddev->devn_params, &ddev->equiv_cmyk_colors);
+ &ddev->devn_params, &ddev->equiv_cmyk_colors);
return 0;
}
@@ -1181,7 +1171,7 @@ display_ret_devn_params(gx_device * dev)
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -1194,16 +1184,15 @@ display_ret_devn_params(gx_device * dev)
* It returns a negative value if not found.
*/
static int
-display_separation_get_color_comp_index(gx_device * dev,
+display_separation_get_color_comp_index(gx_device * dev,
const char * pname, int name_size, int component_type)
{
return devn_get_color_comp_index(dev,
- &(((gx_device_display *)dev)->devn_params),
- &(((gx_device_display *)dev)->equiv_cmyk_colors),
- pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
+ &(((gx_device_display *)dev)->devn_params),
+ &(((gx_device_display *)dev)->equiv_cmyk_colors),
+ pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
}
-
/* ------ Internal routines ------ */
/* Make sure we have been given a valid structure */
@@ -1211,37 +1200,37 @@ display_separation_get_color_comp_index(gx_device * dev,
static int display_check_structure(gx_device_display *ddev)
{
if (ddev->callback == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (ddev->callback->size == sizeof(struct display_callback_v1_s)) {
- /* Original V1 structure */
- if (ddev->callback->version_major != DISPLAY_VERSION_MAJOR_V1)
- return_error(gs_error_rangecheck);
+ /* Original V1 structure */
+ if (ddev->callback->version_major != DISPLAY_VERSION_MAJOR_V1)
+ return_error(gs_error_rangecheck);
- /* complain if caller asks for newer features */
- if (ddev->callback->version_minor > DISPLAY_VERSION_MINOR_V1)
- return_error(gs_error_rangecheck);
+ /* complain if caller asks for newer features */
+ if (ddev->callback->version_minor > DISPLAY_VERSION_MINOR_V1)
+ return_error(gs_error_rangecheck);
}
else {
- /* V2 structure with added display_separation callback */
- if (ddev->callback->size != sizeof(display_callback))
- return_error(gs_error_rangecheck);
+ /* V2 structure with added display_separation callback */
+ if (ddev->callback->size != sizeof(display_callback))
+ return_error(gs_error_rangecheck);
- if (ddev->callback->version_major != DISPLAY_VERSION_MAJOR)
- return_error(gs_error_rangecheck);
+ if (ddev->callback->version_major != DISPLAY_VERSION_MAJOR)
+ return_error(gs_error_rangecheck);
- /* complain if caller asks for newer features */
- if (ddev->callback->version_minor > DISPLAY_VERSION_MINOR)
- return_error(gs_error_rangecheck);
+ /* complain if caller asks for newer features */
+ if (ddev->callback->version_minor > DISPLAY_VERSION_MINOR)
+ return_error(gs_error_rangecheck);
}
if ((ddev->callback->display_open == NULL) ||
- (ddev->callback->display_close == NULL) ||
- (ddev->callback->display_presize == NULL) ||
- (ddev->callback->display_size == NULL) ||
- (ddev->callback->display_sync == NULL) ||
- (ddev->callback->display_page == NULL))
- return_error(gs_error_rangecheck);
+ (ddev->callback->display_close == NULL) ||
+ (ddev->callback->display_presize == NULL) ||
+ (ddev->callback->display_size == NULL) ||
+ (ddev->callback->display_sync == NULL) ||
+ (ddev->callback->display_page == NULL))
+ return_error(gs_error_rangecheck);
/* Don't test display_update, display_memalloc or display_memfree
* since these may be NULL if not provided.
@@ -1256,54 +1245,54 @@ static void
display_free_bitmap(gx_device_display * ddev)
{
if (ddev->callback == NULL)
- return;
+ return;
if (ddev->pBitmap) {
- if (ddev->callback->display_memalloc
- && ddev->callback->display_memfree
- && ddev->pBitmap) {
- (*ddev->callback->display_memfree)(ddev->pHandle, ddev,
- ddev->pBitmap);
- }
- else {
- gs_free_object(ddev->memory->non_gc_memory,
- ddev->pBitmap, "display_free_bitmap");
- }
- ddev->pBitmap = NULL;
- if (ddev->mdev)
- ddev->mdev->base = NULL;
+ if (ddev->callback->display_memalloc
+ && ddev->callback->display_memfree
+ && ddev->pBitmap) {
+ (*ddev->callback->display_memfree)(ddev->pHandle, ddev,
+ ddev->pBitmap);
+ }
+ else {
+ gs_free_object(ddev->memory->non_gc_memory,
+ ddev->pBitmap, "display_free_bitmap");
+ }
+ ddev->pBitmap = NULL;
+ if (ddev->mdev)
+ ddev->mdev->base = NULL;
}
if (ddev->mdev) {
- dev_proc(ddev->mdev, close_device)((gx_device *)ddev->mdev);
+ dev_proc(ddev->mdev, close_device)((gx_device *)ddev->mdev);
gx_device_retain((gx_device *)(ddev->mdev), false);
- ddev->mdev = NULL;
+ ddev->mdev = NULL;
}
}
/* calculate byte length of a row */
-static int
+static int
display_raster(gx_device_display *dev)
{
int align = 0;
int bytewidth = dev->width * dev->color_info.depth/8;
switch (dev->nFormat & DISPLAY_ROW_ALIGN_MASK) {
- case DISPLAY_ROW_ALIGN_4:
- align = 4;
- break;
- case DISPLAY_ROW_ALIGN_8:
- align = 8;
- break;
- case DISPLAY_ROW_ALIGN_16:
- align = 16;
- break;
- case DISPLAY_ROW_ALIGN_32:
- align = 32;
- break;
- case DISPLAY_ROW_ALIGN_64:
- align = 64;
- break;
+ case DISPLAY_ROW_ALIGN_4:
+ align = 4;
+ break;
+ case DISPLAY_ROW_ALIGN_8:
+ align = 8;
+ break;
+ case DISPLAY_ROW_ALIGN_16:
+ align = 16;
+ break;
+ case DISPLAY_ROW_ALIGN_32:
+ align = 32;
+ break;
+ case DISPLAY_ROW_ALIGN_64:
+ align = 64;
+ break;
}
if (align < ARCH_ALIGN_PTR_MOD)
- align = ARCH_ALIGN_PTR_MOD;
+ align = ARCH_ALIGN_PTR_MOD;
align -= 1;
bytewidth = (bytewidth + align) & (~align);
return bytewidth;
@@ -1316,7 +1305,7 @@ display_alloc_bitmap(gx_device_display * ddev, gx_device * param_dev)
int ccode;
const gx_device_memory *mdproto;
if (ddev->callback == NULL)
- return 0;
+ return 0;
/* free old bitmap (if any) */
display_free_bitmap(ddev);
@@ -1324,22 +1313,22 @@ display_alloc_bitmap(gx_device_display * ddev, gx_device * param_dev)
/* allocate a memory device for rendering */
mdproto = gdev_mem_device_for_bits(ddev->color_info.depth);
if (mdproto == 0)
- return_error(gs_error_rangecheck);
-
- ddev->mdev = gs_alloc_struct(gs_memory_stable(ddev->memory),
- gx_device_memory, &st_device_memory, "display_memory_device");
+ return_error(gs_error_rangecheck);
+
+ ddev->mdev = gs_alloc_struct(gs_memory_stable(ddev->memory),
+ gx_device_memory, &st_device_memory, "display_memory_device");
if (ddev->mdev == 0)
return_error(gs_error_VMerror);
- gs_make_mem_device(ddev->mdev, mdproto, gs_memory_stable(ddev->memory),
- 0, (gx_device *) NULL);
+ gs_make_mem_device(ddev->mdev, mdproto, gs_memory_stable(ddev->memory),
+ 0, (gx_device *) NULL);
check_device_separable((gx_device *)(ddev->mdev));
gx_device_fill_in_procs((gx_device *)(ddev->mdev));
/* Mark the memory device as retained. When the bitmap is closed,
* we will clear this and the memory device will be then be freed.
*/
gx_device_retain((gx_device *)(ddev->mdev), true);
-
+
/* Memory device width may be larger than device width
* if row alignment is not 4.
*/
@@ -1352,24 +1341,24 @@ display_alloc_bitmap(gx_device_display * ddev, gx_device * param_dev)
*/
ddev->mdev->line_pointer_memory = ddev->mdev->memory;
if (gdev_mem_bits_size(ddev->mdev, ddev->mdev->width, ddev->mdev->height,
- &(ddev->ulBitmapSize)) < 0)
- return_error(gs_error_VMerror);
+ &(ddev->ulBitmapSize)) < 0)
+ return_error(gs_error_VMerror);
/* allocate bitmap using an allocator not subject to GC */
- if (ddev->callback->display_memalloc
- && ddev->callback->display_memfree) {
- ddev->pBitmap = (*ddev->callback->display_memalloc)(ddev->pHandle,
- ddev, ddev->ulBitmapSize);
+ if (ddev->callback->display_memalloc
+ && ddev->callback->display_memfree) {
+ ddev->pBitmap = (*ddev->callback->display_memalloc)(ddev->pHandle,
+ ddev, ddev->ulBitmapSize);
}
else {
- ddev->pBitmap = gs_alloc_byte_array_immovable(ddev->memory->non_gc_memory,
- (uint)ddev->ulBitmapSize, 1, "display_alloc_bitmap");
+ ddev->pBitmap = gs_alloc_byte_array_immovable(ddev->memory->non_gc_memory,
+ (uint)ddev->ulBitmapSize, 1, "display_alloc_bitmap");
}
if (ddev->pBitmap == NULL) {
- ddev->mdev->width = 0;
- ddev->mdev->height = 0;
- return_error(gs_error_VMerror);
+ ddev->mdev->width = 0;
+ ddev->mdev->height = 0;
+ return_error(gs_error_VMerror);
}
ddev->mdev->base = (byte *) ddev->pBitmap;
@@ -1377,16 +1366,16 @@ display_alloc_bitmap(gx_device_display * ddev, gx_device * param_dev)
ccode = dev_proc(ddev->mdev, open_device)((gx_device *)ddev->mdev);
if (ccode < 0)
- display_free_bitmap(ddev);
+ display_free_bitmap(ddev);
/* erase bitmap - before display gets redrawn */
if (ccode == 0) {
- int i;
+ int i;
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- for (i=0; i<GX_DEVICE_COLOR_MAX_COMPONENTS; i++)
- cv[i] = (ddev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
- ? gx_max_color_value : 0;
- dev_proc(ddev, fill_rectangle)((gx_device *)ddev,
+ for (i=0; i<GX_DEVICE_COLOR_MAX_COMPONENTS; i++)
+ cv[i] = (ddev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
+ ? gx_max_color_value : 0;
+ dev_proc(ddev, fill_rectangle)((gx_device *)ddev,
0, 0, ddev->width, ddev->height,
ddev->procs.encode_color((gx_device *)ddev, cv));
}
@@ -1394,75 +1383,75 @@ display_alloc_bitmap(gx_device_display * ddev, gx_device * param_dev)
return ccode;
}
-static int
+static int
display_set_separations(gx_device_display *dev)
{
if (((dev->nFormat & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION) &&
- (dev->callback->version_major > DISPLAY_VERSION_MAJOR_V1) &&
- (dev->callback->display_separation != NULL)) {
- /* Tell the client about the separation to composite mapping */
- char name[64];
- int num_spot = dev->devn_params.separations.num_separations;
- int num_std_colorants = dev->devn_params.num_std_colorant_names;
- int num_comp = num_std_colorants + num_spot;
+ (dev->callback->version_major > DISPLAY_VERSION_MAJOR_V1) &&
+ (dev->callback->display_separation != NULL)) {
+ /* Tell the client about the separation to composite mapping */
+ char name[64];
+ int num_spot = dev->devn_params.separations.num_separations;
+ int num_std_colorants = dev->devn_params.num_std_colorant_names;
+ int num_comp = num_std_colorants + num_spot;
int comp_map[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int comp_num;
- int sep_num;
- int sep_name_size;
- unsigned int c, m, y, k;
-
- /* Map the separation numbers to component numbers */
- memset(comp_map, 0, sizeof(comp_map));
- for (sep_num = 0; sep_num < num_comp; sep_num++) {
- comp_num = dev->devn_params.separation_order_map[sep_num];
- if (comp_num >= 0 && comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS)
- comp_map[comp_num] = sep_num;
- }
- /* For each component, tell the client the separation mapping */
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- c = y = m = k = 0;
- sep_num = comp_map[comp_num];
- /* Get the CMYK equivalent */
- if (sep_num < dev->devn_params.num_std_colorant_names) {
- sep_name_size =
- strlen(dev->devn_params.std_colorant_names[sep_num]);
- if (sep_name_size > sizeof(name)-2)
- sep_name_size = sizeof(name)-1;
- memcpy(name, dev->devn_params.std_colorant_names[sep_num],
- sep_name_size);
- name[sep_name_size] = '\0';
- switch (sep_num) {
- case 0: c = 65535; break;
- case 1: m = 65535; break;
- case 2: y = 65535; break;
- case 3: k = 65535; break;
- }
- }
- else {
- sep_num -= dev->devn_params.num_std_colorant_names;
- sep_name_size =
- dev->devn_params.separations.names[sep_num].size;
- if (sep_name_size > sizeof(name)-2)
- sep_name_size = sizeof(name)-1;
- memcpy(name, dev->devn_params.separations.names[sep_num].data,
- sep_name_size);
- name[sep_name_size] = '\0';
- if (dev->equiv_cmyk_colors.color[sep_num].color_info_valid) {
- c = dev->equiv_cmyk_colors.color[sep_num].c
- * 65535 / frac_1;
- m = dev->equiv_cmyk_colors.color[sep_num].m
- * 65535 / frac_1;
- y = dev->equiv_cmyk_colors.color[sep_num].y
- * 65535 / frac_1;
- k = dev->equiv_cmyk_colors.color[sep_num].k
- * 65535 / frac_1;
- }
- }
- (*dev->callback->display_separation)(dev->pHandle, dev,
- comp_num, name,
- (unsigned short)c, (unsigned short)m,
- (unsigned short)y, (unsigned short)k);
- }
+ int comp_num;
+ int sep_num;
+ int sep_name_size;
+ unsigned int c, m, y, k;
+
+ /* Map the separation numbers to component numbers */
+ memset(comp_map, 0, sizeof(comp_map));
+ for (sep_num = 0; sep_num < num_comp; sep_num++) {
+ comp_num = dev->devn_params.separation_order_map[sep_num];
+ if (comp_num >= 0 && comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS)
+ comp_map[comp_num] = sep_num;
+ }
+ /* For each component, tell the client the separation mapping */
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ c = y = m = k = 0;
+ sep_num = comp_map[comp_num];
+ /* Get the CMYK equivalent */
+ if (sep_num < dev->devn_params.num_std_colorant_names) {
+ sep_name_size =
+ strlen(dev->devn_params.std_colorant_names[sep_num]);
+ if (sep_name_size > sizeof(name)-2)
+ sep_name_size = sizeof(name)-1;
+ memcpy(name, dev->devn_params.std_colorant_names[sep_num],
+ sep_name_size);
+ name[sep_name_size] = '\0';
+ switch (sep_num) {
+ case 0: c = 65535; break;
+ case 1: m = 65535; break;
+ case 2: y = 65535; break;
+ case 3: k = 65535; break;
+ }
+ }
+ else {
+ sep_num -= dev->devn_params.num_std_colorant_names;
+ sep_name_size =
+ dev->devn_params.separations.names[sep_num].size;
+ if (sep_name_size > sizeof(name)-2)
+ sep_name_size = sizeof(name)-1;
+ memcpy(name, dev->devn_params.separations.names[sep_num].data,
+ sep_name_size);
+ name[sep_name_size] = '\0';
+ if (dev->equiv_cmyk_colors.color[sep_num].color_info_valid) {
+ c = dev->equiv_cmyk_colors.color[sep_num].c
+ * 65535 / frac_1;
+ m = dev->equiv_cmyk_colors.color[sep_num].m
+ * 65535 / frac_1;
+ y = dev->equiv_cmyk_colors.color[sep_num].y
+ * 65535 / frac_1;
+ k = dev->equiv_cmyk_colors.color[sep_num].k
+ * 65535 / frac_1;
+ }
+ }
+ (*dev->callback->display_separation)(dev->pHandle, dev,
+ comp_num, name,
+ (unsigned short)c, (unsigned short)m,
+ (unsigned short)y, (unsigned short)k);
+ }
}
return 0;
}
@@ -1480,7 +1469,7 @@ typedef enum DISPLAY_MODEL_e {
* structure (except for the anti alias info).
*/
static void
-set_color_info(gx_device_color_info * pdci, DISPLAY_MODEL model,
+set_color_info(gx_device_color_info * pdci, DISPLAY_MODEL model,
int nc, int depth, int maxgray, int maxcolor)
{
pdci->num_components = pdci->max_components = nc;
@@ -1492,33 +1481,33 @@ set_color_info(gx_device_color_info * pdci, DISPLAY_MODEL model,
pdci->dither_colors = maxcolor + 1;
pdci->separable_and_linear = GX_CINFO_UNKNOWN_SEP_LIN;
switch (model) {
- case DISPLAY_MODEL_GRAY:
- pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
- pdci->cm_name = "DeviceGray";
- pdci->gray_index = 0;
- break;
- case DISPLAY_MODEL_RGB:
- pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
- pdci->cm_name = "DeviceRGB";
- pdci->gray_index = GX_CINFO_COMP_NO_INDEX;
- break;
- case DISPLAY_MODEL_RGBK:
- pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
- pdci->cm_name = "DeviceRGBK";
- pdci->gray_index = 3;
- break;
- case DISPLAY_MODEL_CMYK:
- pdci->polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
- pdci->cm_name = "DeviceCMYK";
- pdci->gray_index = 3;
- break;
- default:
- case DISPLAY_MODEL_SEP:
- /* Anything else is separations */
- pdci->polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
- pdci->cm_name = "DeviceCMYK";
- pdci->gray_index = GX_CINFO_COMP_NO_INDEX; /* may not have K */
- break;
+ case DISPLAY_MODEL_GRAY:
+ pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
+ pdci->cm_name = "DeviceGray";
+ pdci->gray_index = 0;
+ break;
+ case DISPLAY_MODEL_RGB:
+ pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
+ pdci->cm_name = "DeviceRGB";
+ pdci->gray_index = GX_CINFO_COMP_NO_INDEX;
+ break;
+ case DISPLAY_MODEL_RGBK:
+ pdci->polarity = GX_CINFO_POLARITY_ADDITIVE;
+ pdci->cm_name = "DeviceRGBK";
+ pdci->gray_index = 3;
+ break;
+ case DISPLAY_MODEL_CMYK:
+ pdci->polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ pdci->cm_name = "DeviceCMYK";
+ pdci->gray_index = 3;
+ break;
+ default:
+ case DISPLAY_MODEL_SEP:
+ /* Anything else is separations */
+ pdci->polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ pdci->cm_name = "DeviceCMYK";
+ pdci->gray_index = GX_CINFO_COMP_NO_INDEX; /* may not have K */
+ break;
}
}
@@ -1527,11 +1516,11 @@ set_color_info(gx_device_color_info * pdci, DISPLAY_MODEL model,
* device. The display device can change its setup.
*/
static void
-set_color_procs(gx_device * pdev,
- dev_t_proc_encode_color((*encode_color), gx_device),
- dev_t_proc_decode_color((*decode_color), gx_device),
- dev_t_proc_get_color_mapping_procs((*get_color_mapping_procs), gx_device),
- dev_t_proc_get_color_comp_index((*get_color_comp_index), gx_device))
+set_color_procs(gx_device * pdev,
+ dev_t_proc_encode_color((*encode_color), gx_device),
+ dev_t_proc_decode_color((*decode_color), gx_device),
+ dev_t_proc_get_color_mapping_procs((*get_color_mapping_procs), gx_device),
+ dev_t_proc_get_color_comp_index((*get_color_comp_index), gx_device))
{
#if 0 /* These procs are no longer used */
pdev->procs.map_rgb_color = encode_color;
@@ -1548,13 +1537,13 @@ set_color_procs(gx_device * pdev,
* device. This routine is used when the display device is Gray.
*/
static void
-set_gray_color_procs(gx_device * pdev,
- dev_t_proc_encode_color((*encode_color), gx_device),
- dev_t_proc_decode_color((*decode_color), gx_device))
+set_gray_color_procs(gx_device * pdev,
+ dev_t_proc_encode_color((*encode_color), gx_device),
+ dev_t_proc_decode_color((*decode_color), gx_device))
{
set_color_procs(pdev, encode_color, decode_color,
- gx_default_DevGray_get_color_mapping_procs,
- gx_default_DevGray_get_color_comp_index);
+ gx_default_DevGray_get_color_mapping_procs,
+ gx_default_DevGray_get_color_comp_index);
}
/*
@@ -1562,13 +1551,13 @@ set_gray_color_procs(gx_device * pdev,
* device. This routine is used when the display device is RGB.
*/
static void
-set_rgb_color_procs(gx_device * pdev,
- dev_t_proc_encode_color((*encode_color), gx_device),
- dev_t_proc_decode_color((*decode_color), gx_device))
+set_rgb_color_procs(gx_device * pdev,
+ dev_t_proc_encode_color((*encode_color), gx_device),
+ dev_t_proc_decode_color((*decode_color), gx_device))
{
set_color_procs(pdev, encode_color, decode_color,
- gx_default_DevRGB_get_color_mapping_procs,
- gx_default_DevRGB_get_color_comp_index);
+ gx_default_DevRGB_get_color_mapping_procs,
+ gx_default_DevRGB_get_color_comp_index);
}
/*
@@ -1576,13 +1565,13 @@ set_rgb_color_procs(gx_device * pdev,
* device. This routine is used when the display device is RGBK.
*/
static void
-set_rgbk_color_procs(gx_device * pdev,
- dev_t_proc_encode_color((*encode_color), gx_device),
- dev_t_proc_decode_color((*decode_color), gx_device))
+set_rgbk_color_procs(gx_device * pdev,
+ dev_t_proc_encode_color((*encode_color), gx_device),
+ dev_t_proc_decode_color((*decode_color), gx_device))
{
set_color_procs(pdev, encode_color, decode_color,
- gx_default_DevRGBK_get_color_mapping_procs,
- gx_default_DevRGBK_get_color_comp_index);
+ gx_default_DevRGBK_get_color_mapping_procs,
+ gx_default_DevRGBK_get_color_comp_index);
}
/*
@@ -1590,13 +1579,13 @@ set_rgbk_color_procs(gx_device * pdev,
* device. This routine is used when the display device is CMYK.
*/
static void
-set_cmyk_color_procs(gx_device * pdev,
- dev_t_proc_encode_color((*encode_color), gx_device),
- dev_t_proc_decode_color((*decode_color), gx_device))
+set_cmyk_color_procs(gx_device * pdev,
+ dev_t_proc_encode_color((*encode_color), gx_device),
+ dev_t_proc_decode_color((*decode_color), gx_device))
{
set_color_procs(pdev, encode_color, decode_color,
- gx_default_DevCMYK_get_color_mapping_procs,
- gx_default_DevCMYK_get_color_comp_index);
+ gx_default_DevCMYK_get_color_mapping_procs,
+ gx_default_DevCMYK_get_color_comp_index);
}
/* Set the color_info and mapping functions for this instance of the device */
@@ -1611,170 +1600,170 @@ display_set_color_format(gx_device_display *ddev, int nFormat)
int align;
switch (nFormat & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- bpc = 1;
- break;
- case DISPLAY_DEPTH_2:
- bpc = 2;
- break;
- case DISPLAY_DEPTH_4:
- bpc = 4;
- break;
- case DISPLAY_DEPTH_8:
- bpc = 8;
- break;
- case DISPLAY_DEPTH_12:
- bpc = 12;
- break;
- case DISPLAY_DEPTH_16:
- bpc = 16;
- break;
- default:
- return_error(gs_error_rangecheck);
+ case DISPLAY_DEPTH_1:
+ bpc = 1;
+ break;
+ case DISPLAY_DEPTH_2:
+ bpc = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ bpc = 4;
+ break;
+ case DISPLAY_DEPTH_8:
+ bpc = 8;
+ break;
+ case DISPLAY_DEPTH_12:
+ bpc = 12;
+ break;
+ case DISPLAY_DEPTH_16:
+ bpc = 16;
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
maxvalue = (1 << bpc) - 1;
ddev->devn_params.bitspercomponent = bpc;
switch (ddev->nFormat & DISPLAY_ROW_ALIGN_MASK) {
- case DISPLAY_ROW_ALIGN_DEFAULT:
- align = ARCH_ALIGN_PTR_MOD;
- break;
- case DISPLAY_ROW_ALIGN_4:
- align = 4;
- break;
- case DISPLAY_ROW_ALIGN_8:
- align = 8;
- break;
- case DISPLAY_ROW_ALIGN_16:
- align = 16;
- break;
- case DISPLAY_ROW_ALIGN_32:
- align = 32;
- break;
- case DISPLAY_ROW_ALIGN_64:
- align = 64;
- break;
- default:
- align = 0; /* not permitted */
+ case DISPLAY_ROW_ALIGN_DEFAULT:
+ align = ARCH_ALIGN_PTR_MOD;
+ break;
+ case DISPLAY_ROW_ALIGN_4:
+ align = 4;
+ break;
+ case DISPLAY_ROW_ALIGN_8:
+ align = 8;
+ break;
+ case DISPLAY_ROW_ALIGN_16:
+ align = 16;
+ break;
+ case DISPLAY_ROW_ALIGN_32:
+ align = 32;
+ break;
+ case DISPLAY_ROW_ALIGN_64:
+ align = 64;
+ break;
+ default:
+ align = 0; /* not permitted */
}
if (align < ARCH_ALIGN_PTR_MOD)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
switch (ddev->nFormat & DISPLAY_ALPHA_MASK) {
- case DISPLAY_ALPHA_FIRST:
- case DISPLAY_ALPHA_LAST:
- /* Not implemented and unlikely to ever be implemented
- * because they would interact with linear_and_separable
- */
- return_error(gs_error_rangecheck);
+ case DISPLAY_ALPHA_FIRST:
+ case DISPLAY_ALPHA_LAST:
+ /* Not implemented and unlikely to ever be implemented
+ * because they would interact with linear_and_separable
+ */
+ return_error(gs_error_rangecheck);
}
switch (nFormat & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (nFormat & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- /* 1bit/pixel, black is 1, white is 0 */
- set_color_info(&dci, DISPLAY_MODEL_GRAY, 1, 1, 1, 0);
+ case DISPLAY_COLORS_NATIVE:
+ switch (nFormat & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ /* 1bit/pixel, black is 1, white is 0 */
+ set_color_info(&dci, DISPLAY_MODEL_GRAY, 1, 1, 1, 0);
dci.separable_and_linear = GX_CINFO_SEP_LIN_NONE;
- set_gray_color_procs(pdev, gx_b_w_gray_encode,
- gx_default_b_w_map_color_rgb);
- break;
- case DISPLAY_DEPTH_4:
- /* 4bit/pixel VGA color */
- set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 4, 3, 2);
+ set_gray_color_procs(pdev, gx_b_w_gray_encode,
+ gx_default_b_w_map_color_rgb);
+ break;
+ case DISPLAY_DEPTH_4:
+ /* 4bit/pixel VGA color */
+ set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 4, 3, 2);
dci.separable_and_linear = GX_CINFO_SEP_LIN_NONE;
- set_rgb_color_procs(pdev, display_map_rgb_color_device4,
- display_map_color_rgb_device4);
- break;
- case DISPLAY_DEPTH_8:
- /* 8bit/pixel 96 color palette */
- set_color_info(&dci, DISPLAY_MODEL_RGBK, 4, 8, 31, 3);
+ set_rgb_color_procs(pdev, display_map_rgb_color_device4,
+ display_map_color_rgb_device4);
+ break;
+ case DISPLAY_DEPTH_8:
+ /* 8bit/pixel 96 color palette */
+ set_color_info(&dci, DISPLAY_MODEL_RGBK, 4, 8, 31, 3);
dci.separable_and_linear = GX_CINFO_SEP_LIN_NONE;
- set_rgbk_color_procs(pdev, display_encode_color_device8,
- display_decode_color_device8);
- break;
- case DISPLAY_DEPTH_16:
- /* Windows 16-bit display */
- /* Is maxgray = maxcolor = 63 correct? */
- if ((ddev->nFormat & DISPLAY_555_MASK)
- == DISPLAY_NATIVE_555)
- set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 16, 31, 31);
- else
- set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 16, 63, 63);
- set_rgb_color_procs(pdev, display_map_rgb_color_device16,
- display_map_color_rgb_device16);
- break;
- default:
- return_error(gs_error_rangecheck);
- }
- dci.gray_index = GX_CINFO_COMP_NO_INDEX;
- break;
- case DISPLAY_COLORS_GRAY:
- set_color_info(&dci, DISPLAY_MODEL_GRAY, 1, bpc, maxvalue, 0);
- if (bpc == 1)
- set_gray_color_procs(pdev, gx_default_gray_encode,
- gx_default_w_b_map_color_rgb);
- else
- set_gray_color_procs(pdev, gx_default_gray_encode,
- gx_default_gray_map_color_rgb);
- break;
- case DISPLAY_COLORS_RGB:
- if ((nFormat & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)
- bpp = bpc * 3;
- else
- bpp = bpc * 4;
- set_color_info(&dci, DISPLAY_MODEL_RGB, 3, bpp, maxvalue, maxvalue);
- if (((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((nFormat & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)) {
- if ((nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
- set_rgb_color_procs(pdev, gx_default_rgb_map_rgb_color,
- gx_default_rgb_map_color_rgb);
- else
- set_rgb_color_procs(pdev, display_map_rgb_color_bgr24,
- display_map_color_rgb_bgr24);
- }
- else {
- /* slower flexible functions for alpha/unused component */
- set_rgb_color_procs(pdev, display_map_rgb_color_rgb,
- display_map_color_rgb_rgb);
- }
- break;
- case DISPLAY_COLORS_CMYK:
- bpp = bpc * 4;
- set_color_info(&dci, DISPLAY_MODEL_CMYK, 4, bpp, maxvalue, maxvalue);
- if ((nFormat & DISPLAY_ALPHA_MASK) != DISPLAY_ALPHA_NONE)
- return_error(gs_error_rangecheck);
- if ((nFormat & DISPLAY_ENDIAN_MASK) != DISPLAY_BIGENDIAN)
- return_error(gs_error_rangecheck);
-
- if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1)
- set_cmyk_color_procs(pdev, cmyk_1bit_map_cmyk_color,
- cmyk_1bit_map_color_cmyk);
- else if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
- set_cmyk_color_procs(pdev, cmyk_8bit_map_cmyk_color,
- cmyk_8bit_map_color_cmyk);
- else
- return_error(gs_error_rangecheck);
- break;
- case DISPLAY_COLORS_SEPARATION:
- if ((nFormat & DISPLAY_ENDIAN_MASK) != DISPLAY_BIGENDIAN)
- return_error(gs_error_rangecheck);
- bpp = arch_sizeof_color_index * 8;
- set_color_info(&dci, DISPLAY_MODEL_SEP, bpp/bpc, bpp,
- maxvalue, maxvalue);
- if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) {
- ddev->devn_params.bitspercomponent = bpc;
- set_color_procs(pdev,
- display_separation_encode_color,
- display_separation_decode_color,
- display_separation_get_color_mapping_procs,
- display_separation_get_color_comp_index);
- }
- else
- return_error(gs_error_rangecheck);
- break;
- default:
- return_error(gs_error_rangecheck);
+ set_rgbk_color_procs(pdev, display_encode_color_device8,
+ display_decode_color_device8);
+ break;
+ case DISPLAY_DEPTH_16:
+ /* Windows 16-bit display */
+ /* Is maxgray = maxcolor = 63 correct? */
+ if ((ddev->nFormat & DISPLAY_555_MASK)
+ == DISPLAY_NATIVE_555)
+ set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 16, 31, 31);
+ else
+ set_color_info(&dci, DISPLAY_MODEL_RGB, 3, 16, 63, 63);
+ set_rgb_color_procs(pdev, display_map_rgb_color_device16,
+ display_map_color_rgb_device16);
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
+ dci.gray_index = GX_CINFO_COMP_NO_INDEX;
+ break;
+ case DISPLAY_COLORS_GRAY:
+ set_color_info(&dci, DISPLAY_MODEL_GRAY, 1, bpc, maxvalue, 0);
+ if (bpc == 1)
+ set_gray_color_procs(pdev, gx_default_gray_encode,
+ gx_default_w_b_map_color_rgb);
+ else
+ set_gray_color_procs(pdev, gx_default_gray_encode,
+ gx_default_gray_map_color_rgb);
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ((nFormat & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)
+ bpp = bpc * 3;
+ else
+ bpp = bpc * 4;
+ set_color_info(&dci, DISPLAY_MODEL_RGB, 3, bpp, maxvalue, maxvalue);
+ if (((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((nFormat & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)) {
+ if ((nFormat & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN)
+ set_rgb_color_procs(pdev, gx_default_rgb_map_rgb_color,
+ gx_default_rgb_map_color_rgb);
+ else
+ set_rgb_color_procs(pdev, display_map_rgb_color_bgr24,
+ display_map_color_rgb_bgr24);
+ }
+ else {
+ /* slower flexible functions for alpha/unused component */
+ set_rgb_color_procs(pdev, display_map_rgb_color_rgb,
+ display_map_color_rgb_rgb);
+ }
+ break;
+ case DISPLAY_COLORS_CMYK:
+ bpp = bpc * 4;
+ set_color_info(&dci, DISPLAY_MODEL_CMYK, 4, bpp, maxvalue, maxvalue);
+ if ((nFormat & DISPLAY_ALPHA_MASK) != DISPLAY_ALPHA_NONE)
+ return_error(gs_error_rangecheck);
+ if ((nFormat & DISPLAY_ENDIAN_MASK) != DISPLAY_BIGENDIAN)
+ return_error(gs_error_rangecheck);
+
+ if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1)
+ set_cmyk_color_procs(pdev, cmyk_1bit_map_cmyk_color,
+ cmyk_1bit_map_color_cmyk);
+ else if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
+ set_cmyk_color_procs(pdev, cmyk_8bit_map_cmyk_color,
+ cmyk_8bit_map_color_cmyk);
+ else
+ return_error(gs_error_rangecheck);
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ if ((nFormat & DISPLAY_ENDIAN_MASK) != DISPLAY_BIGENDIAN)
+ return_error(gs_error_rangecheck);
+ bpp = arch_sizeof_color_index * 8;
+ set_color_info(&dci, DISPLAY_MODEL_SEP, bpp/bpc, bpp,
+ maxvalue, maxvalue);
+ if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) {
+ ddev->devn_params.bitspercomponent = bpc;
+ set_color_procs(pdev,
+ display_separation_encode_color,
+ display_separation_decode_color,
+ display_separation_get_color_mapping_procs,
+ display_separation_get_color_comp_index);
+ }
+ else
+ return_error(gs_error_rangecheck);
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
/* restore old anti_alias info */
@@ -1782,25 +1771,25 @@ display_set_color_format(gx_device_display *ddev, int nFormat)
ddev->color_info = dci;
check_device_separable(pdev);
switch (nFormat & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
- if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1)
- ddev->color_info.gray_index = 0;
- else if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
- ddev->color_info.gray_index = 3;
- break;
- case DISPLAY_COLORS_RGB:
- ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
- break;
- case DISPLAY_COLORS_GRAY:
- ddev->color_info.gray_index = 0;
- break;
- case DISPLAY_COLORS_CMYK:
- ddev->color_info.gray_index = 3;
- break;
- case DISPLAY_COLORS_SEPARATION:
- ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
- break;
+ case DISPLAY_COLORS_NATIVE:
+ ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
+ if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1)
+ ddev->color_info.gray_index = 0;
+ else if ((nFormat & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
+ ddev->color_info.gray_index = 3;
+ break;
+ case DISPLAY_COLORS_RGB:
+ ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
+ break;
+ case DISPLAY_COLORS_GRAY:
+ ddev->color_info.gray_index = 0;
+ break;
+ case DISPLAY_COLORS_CMYK:
+ ddev->color_info.gray_index = 3;
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ ddev->color_info.gray_index = GX_CINFO_COMP_NO_INDEX;
+ break;
}
ddev->nFormat = nFormat;
@@ -1818,64 +1807,64 @@ struct test_mode_s {
test_mode test_modes[] = {
{"1bit/pixel native, black is 1, Windows",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"4bit/pixel native, Windows VGA 16 color palette",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_4 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_4 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"8bit/pixel native, Windows SVGA 96 color palette",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"16bit/pixel native, Windows BGR555",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_16 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_16 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST | DISPLAY_NATIVE_555},
{"16bit/pixel native, Windows BGR565",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_16 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_16 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST | DISPLAY_NATIVE_565},
{"1bit/pixel gray, black is 0, topfirst",
- DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
+ DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
DISPLAY_BIGENDIAN | DISPLAY_TOPFIRST},
{"4bit/pixel gray, bottom first",
- DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_4 |
+ DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_4 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"8bit/pixel gray, bottom first",
- DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_GRAY | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"24bit/pixel color, bottom first, Windows BGR24",
- DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"24bit/pixel color, bottom first, RGB24",
- DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"24bit/pixel color, top first, GdkRgb RGB24",
- DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_TOPFIRST},
{"32bit/pixel color, top first, Macintosh xRGB",
- DISPLAY_COLORS_RGB | DISPLAY_UNUSED_FIRST | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_UNUSED_FIRST | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_TOPFIRST},
{"32bit/pixel color, bottom first, xBGR",
- DISPLAY_COLORS_RGB | DISPLAY_UNUSED_FIRST | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_UNUSED_FIRST | DISPLAY_DEPTH_8 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"32bit/pixel color, bottom first, Windows BGRx",
- DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | DISPLAY_DEPTH_8 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST},
{"32bit/pixel color, bottom first, RGBx",
- DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"32bit/pixel CMYK, bottom first",
- DISPLAY_COLORS_CMYK | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_CMYK | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"64bit/pixel separations, bottom first",
- DISPLAY_COLORS_SEPARATIONS | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_SEPARATIONS | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"4bit/pixel CMYK, bottom first",
- DISPLAY_COLORS_CMYK | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
+ DISPLAY_COLORS_CMYK | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST},
{"1bit/pixel native, black is 1, 8 byte alignment",
- DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
+ DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_1 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST | DISPLAY_ROW_ALIGN_8},
{"24bit/pixel color, bottom first, BGR24, 64 byte alignment",
- DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST | DISPLAY_ROW_ALIGN_64}
};
@@ -1887,23 +1876,23 @@ test(int index)
system(buf);
}
-int main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
int i;
int dotest = 0;
if (argc >=2) {
- if (strcmp(argv[1], "-t") == 0)
- dotest = 1;
- else {
- fprintf(stdout, "To show modes: disp\nTo run test: disp -t\n");
- return 1;
- }
+ if (strcmp(argv[1], "-t") == 0)
+ dotest = 1;
+ else {
+ fprintf(stdout, "To show modes: disp\nTo run test: disp -t\n");
+ return 1;
+ }
}
for (i=0; i < sizeof(test_modes)/sizeof(test_mode); i++) {
- fprintf(stdout, "16#%x or %d: %s\n", test_modes[i].format,
- test_modes[i].format, test_modes[i].name);
- if (dotest)
- test(i);
+ fprintf(stdout, "16#%x or %d: %s\n", test_modes[i].format,
+ test_modes[i].format, test_modes[i].name);
+ if (dotest)
+ test(i);
}
return 0;
}
diff --git a/gs/base/gdevdsp.h b/gs/base/gdevdsp.h
index 8273fd0b2..d852d39be 100644
--- a/gs/base/gdevdsp.h
+++ b/gs/base/gdevdsp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,7 +50,7 @@
* - after preclose
* If opening the device fails, you might see the following:
* open, presize, memalloc, memfree, close
- *
+ *
*/
#define DISPLAY_VERSION_MAJOR 2
@@ -82,8 +82,8 @@ typedef enum {
} DISPLAY_FORMAT_ALPHA;
#define DISPLAY_ALPHA_MASK 0x00f0L
-/* Define the depth per component for DISPLAY_COLORS_GRAY,
- * DISPLAY_COLORS_RGB and DISPLAY_COLORS_CMYK,
+/* Define the depth per component for DISPLAY_COLORS_GRAY,
+ * DISPLAY_COLORS_RGB and DISPLAY_COLORS_CMYK,
* or the depth per pixel for DISPLAY_COLORS_NATIVE
* DISPLAY_DEPTH_2 and DISPLAY_DEPTH_12 have not been tested.
*/
@@ -99,8 +99,7 @@ typedef enum {
} DISPLAY_FORMAT_DEPTH;
#define DISPLAY_DEPTH_MASK 0xff00L
-
-/* Define whether Red/Cyan should come first,
+/* Define whether Red/Cyan should come first,
* or whether Blue/Black should come first
*/
typedef enum {
@@ -116,7 +115,6 @@ typedef enum {
} DISPLAY_FORMAT_FIRSTROW;
#define DISPLAY_FIRSTROW_MASK 0x00020000L
-
/* Define whether packing RGB in 16-bits should use 555
* or 565 (extra bit for green)
*/
@@ -128,8 +126,8 @@ typedef enum {
/* Define the row alignment, which must be equal to or greater than
* the size of a pointer.
- * The default (DISPLAY_ROW_ALIGN_DEFAULT) is the size of a pointer,
- * 4 bytes (DISPLAY_ROW_ALIGN_4) on 32-bit systems or 8 bytes
+ * The default (DISPLAY_ROW_ALIGN_DEFAULT) is the size of a pointer,
+ * 4 bytes (DISPLAY_ROW_ALIGN_4) on 32-bit systems or 8 bytes
* (DISPLAY_ROW_ALIGN_8) on 64-bit systems.
*/
typedef enum {
@@ -144,14 +142,13 @@ typedef enum {
} DISPLAY_FORMAT_ROW_ALIGN;
#define DISPLAY_ROW_ALIGN_MASK 0x00700000L
-
#ifndef display_callback_DEFINED
#define display_callback_DEFINED
typedef struct display_callback_s display_callback;
#endif
/*
- * Note that for Windows, the display callback functions are
+ * Note that for Windows, the display callback functions are
* cdecl, not stdcall. This differs from those in iapi.h.
*/
@@ -187,12 +184,12 @@ struct display_callback_s {
/* Resize will only occur if this function returns 0. */
/* raster is byte count of a row. */
int (*display_presize)(void *handle, void *device,
- int width, int height, int raster, unsigned int format);
-
+ int width, int height, int raster, unsigned int format);
+
/* Device has been resized. */
/* New pointer to raster returned in pimage */
- int (*display_size)(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage);
+ int (*display_size)(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage);
/* flushpage */
int (*display_sync)(void *handle, void *device);
@@ -206,14 +203,14 @@ struct display_callback_s {
* progressive update of the display.
* This function pointer may be set to NULL if not required.
*/
- int (*display_update)(void *handle, void *device, int x, int y,
- int w, int h);
+ int (*display_update)(void *handle, void *device, int x, int y,
+ int w, int h);
/* Allocate memory for bitmap */
/* This is provided in case you need to create memory in a special
- * way, e.g. shared. If this is NULL, the Ghostscript memory device
+ * way, e.g. shared. If this is NULL, the Ghostscript memory device
* allocates the bitmap. This will only called to allocate the
- * image buffer. The first row will be placed at the address
+ * image buffer. The first row will be placed at the address
* returned by display_memalloc.
*/
void *(*display_memalloc)(void *handle, void *device, unsigned long size);
@@ -221,7 +218,7 @@ struct display_callback_s {
/* Free memory for bitmap */
/* If this is NULL, the Ghostscript memory device will free the bitmap */
int (*display_memfree)(void *handle, void *device, void *mem);
-
+
/* Added in V2 */
/* When using separation color space (DISPLAY_COLORS_SEPARATION),
* give a mapping for one separation component.
@@ -236,9 +233,9 @@ struct display_callback_s {
* This function pointer may be set to NULL if not required.
*/
int (*display_separation)(void *handle, void *device,
- int component, const char *component_name,
- unsigned short c, unsigned short m,
- unsigned short y, unsigned short k);
+ int component, const char *component_name,
+ unsigned short c, unsigned short m,
+ unsigned short y, unsigned short k);
};
/* This is the V1 structure, before separation format was added */
@@ -250,13 +247,13 @@ struct display_callback_v1_s {
int (*display_preclose)(void *handle, void *device);
int (*display_close)(void *handle, void *device);
int (*display_presize)(void *handle, void *device,
- int width, int height, int raster, unsigned int format);
- int (*display_size)(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage);
+ int width, int height, int raster, unsigned int format);
+ int (*display_size)(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage);
int (*display_sync)(void *handle, void *device);
int (*display_page)(void *handle, void *device, int copies, int flush);
- int (*display_update)(void *handle, void *device, int x, int y,
- int w, int h);
+ int (*display_update)(void *handle, void *device, int x, int y,
+ int w, int h);
void *(*display_memalloc)(void *handle, void *device, unsigned long size);
int (*display_memfree)(void *handle, void *device, void *mem);
};
diff --git a/gs/base/gdevdsp2.h b/gs/base/gdevdsp2.h
index 8869a8aa8..5cfd925ab 100644
--- a/gs/base/gdevdsp2.h
+++ b/gs/base/gdevdsp2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,13 +19,13 @@
typedef struct gx_device_display_s gx_device_display;
#define gx_device_display_common\
- gx_device_memory *mdev;\
- display_callback *callback;\
- void *pHandle;\
- int nFormat;\
- void *pBitmap;\
- unsigned long ulBitmapSize;\
- int HWResolution_set;\
+ gx_device_memory *mdev;\
+ display_callback *callback;\
+ void *pHandle;\
+ int nFormat;\
+ void *pBitmap;\
+ unsigned long ulBitmapSize;\
+ int HWResolution_set;\
gs_devn_params devn_params;\
equivalent_cmyk_color_params equiv_cmyk_colors
diff --git a/gs/base/gdevemap.c b/gs/base/gdevemap.c
index 2970eafec..cd7e1542c 100644
--- a/gs/base/gdevemap.c
+++ b/gs/base/gdevemap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevepsc.c b/gs/base/gdevepsc.c
index f7bf4f0c8..ab24cf0c5 100644
--- a/gs/base/gdevepsc.c
+++ b/gs/base/gdevepsc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
*
* The values of X_DPI and Y_DPI may be set at compile time:
* see gdevs.mak.
- *
+ *
* At some time in the future, we could simulate 24-bit output on
* 9-pin printers by using fractional vertical positioning;
* we could even implement an X_DPI=360 mode by using the
@@ -63,9 +63,9 @@
** the ESC-r n value
*/
static char rgb_color[2][2][2] = {
- {{BLACK, VIOLET}, {GREEN, CYAN}},
- {{RED, MAGENTA}, {YELLOW, WHITE}}
- };
+ {{BLACK, VIOLET}, {GREEN, CYAN}},
+ {{RED, MAGENTA}, {YELLOW, WHITE}}
+ };
/* Map an RGB color to a printer color. */
#define cv_shift (sizeof(gx_color_value) * 8 - 1)
@@ -76,12 +76,12 @@ epson_map_rgb_color(gx_device *dev, const gx_color_value cv[])
gx_color_value r = cv[0];
gx_color_value g = cv[1];
gx_color_value b = cv[2];
-
+
if (gx_device_has_color(dev))
/* use ^7 so WHITE is 0 for internal calculations */
- return (gx_color_index)rgb_color[r >> cv_shift][g >> cv_shift][b >> cv_shift] ^ 7;
+ return (gx_color_index)rgb_color[r >> cv_shift][g >> cv_shift][b >> cv_shift] ^ 7;
else
- return gx_default_map_rgb_color(dev, cv);
+ return gx_default_map_rgb_color(dev, cv);
}
/* Map the printer color back to RGB. */
@@ -91,28 +91,28 @@ epson_map_color_rgb(gx_device *dev, gx_color_index color,
{
#define c1 gx_max_color_value
if (gx_device_has_color(dev))
- switch ((ushort)color ^ 7)
- {
- case BLACK:
- prgb[0] = 0; prgb[1] = 0; prgb[2] = 0; break;
- case VIOLET:
- prgb[0] = 0; prgb[1] = 0; prgb[2] = c1; break;
- case GREEN:
- prgb[0] = 0; prgb[1] = c1; prgb[2] = 0; break;
- case CYAN:
- prgb[0] = 0; prgb[1] = c1; prgb[2] = c1; break;
- case RED:
- prgb[0] = c1; prgb[1] = 0; prgb[2] = 0; break;
- case MAGENTA:
- prgb[0] = c1; prgb[1] = 0; prgb[2] = c1; break;
- case YELLOW:
- prgb[0] = c1; prgb[1] = c1; prgb[2] = 0; break;
- case WHITE:
- prgb[0] = c1; prgb[1] = c1; prgb[2] = c1; break;
- }
- else
- return gx_default_map_color_rgb(dev, color, prgb);
- return 0;
+ switch ((ushort)color ^ 7)
+ {
+ case BLACK:
+ prgb[0] = 0; prgb[1] = 0; prgb[2] = 0; break;
+ case VIOLET:
+ prgb[0] = 0; prgb[1] = 0; prgb[2] = c1; break;
+ case GREEN:
+ prgb[0] = 0; prgb[1] = c1; prgb[2] = 0; break;
+ case CYAN:
+ prgb[0] = 0; prgb[1] = c1; prgb[2] = c1; break;
+ case RED:
+ prgb[0] = c1; prgb[1] = 0; prgb[2] = 0; break;
+ case MAGENTA:
+ prgb[0] = c1; prgb[1] = 0; prgb[2] = c1; break;
+ case YELLOW:
+ prgb[0] = c1; prgb[1] = c1; prgb[2] = 0; break;
+ case WHITE:
+ prgb[0] = c1; prgb[1] = c1; prgb[2] = c1; break;
+ }
+ else
+ return gx_default_map_color_rgb(dev, color, prgb);
+ return 0;
}
/* The device descriptor */
@@ -120,14 +120,14 @@ static dev_proc_print_page(epsc_print_page);
static gx_device_procs epson_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- epson_map_rgb_color, epson_map_color_rgb);
+ epson_map_rgb_color, epson_map_color_rgb);
const gx_device_printer far_data gs_epsonc_device =
prn_device(epson_procs, "epsonc",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0.25, 0, /* margins */
- 3, epsc_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0.25, 0, /* margins */
+ 3, epsc_print_page);
/* ------ Internal routines ------ */
@@ -139,102 +139,102 @@ static void epsc_output_run(byte *, int, int, char, FILE *, int);
static int
epsc_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ static int graphics_modes_9[5] =
- { -1, 0 /*60*/, 1 /*120*/, -1, DD+3 /*240*/
- };
- static int graphics_modes_24[7] =
- { -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
- -1, -1, DD+40 /*360*/
- };
- int y_24pin = pdev->y_pixels_per_inch > 72;
- int y_mult = (y_24pin ? 3 : 1);
- int line_size = (pdev->width + 7) >> 3; /* always mono */
- int in_size = line_size * (8 * y_mult);
- byte *in = (byte *)gs_malloc(pdev->memory, in_size+1, 1, "epsc_print_page(in)");
- int out_size = ((pdev->width + 7) & -8) * y_mult;
- byte *out = (byte *)gs_malloc(pdev->memory, out_size+1, 1, "epsc_print_page(out)");
- int x_dpi = (int)pdev->x_pixels_per_inch;
- char start_graphics = (char)
- ((y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60]);
- int first_pass = (start_graphics & DD ? 1 : 0);
- int last_pass = first_pass * 2;
- int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
- int bytes_per_space = dots_per_space * y_mult;
- int skip = 0, lnum = 0, pass;
+ { -1, 0 /*60*/, 1 /*120*/, -1, DD+3 /*240*/
+ };
+ static int graphics_modes_24[7] =
+ { -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
+ -1, -1, DD+40 /*360*/
+ };
+ int y_24pin = pdev->y_pixels_per_inch > 72;
+ int y_mult = (y_24pin ? 3 : 1);
+ int line_size = (pdev->width + 7) >> 3; /* always mono */
+ int in_size = line_size * (8 * y_mult);
+ byte *in = (byte *)gs_malloc(pdev->memory, in_size+1, 1, "epsc_print_page(in)");
+ int out_size = ((pdev->width + 7) & -8) * y_mult;
+ byte *out = (byte *)gs_malloc(pdev->memory, out_size+1, 1, "epsc_print_page(out)");
+ int x_dpi = (int)pdev->x_pixels_per_inch;
+ char start_graphics = (char)
+ ((y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60]);
+ int first_pass = (start_graphics & DD ? 1 : 0);
+ int last_pass = first_pass * 2;
+ int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
+ int bytes_per_space = dots_per_space * y_mult;
+ int skip = 0, lnum = 0, pass;
/* declare color buffer and related vars */
- byte *color_in;
- int color_line_size, color_in_size;
- int spare_bits = (pdev->width % 8); /* left over bits to go to margin */
- int whole_bits = pdev->width - spare_bits;
+ byte *color_in;
+ int color_line_size, color_in_size;
+ int spare_bits = (pdev->width % 8); /* left over bits to go to margin */
+ int whole_bits = pdev->width - spare_bits;
- /* Check allocations */
- if ( in == 0 || out == 0 )
- { if ( in ) gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
- if ( out ) gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
- return -1;
- }
+ /* Check allocations */
+ if ( in == 0 || out == 0 )
+ { if ( in ) gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
+ if ( out ) gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
+ return -1;
+ }
- /* Initialize the printer and reset the margins. */
- fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream);
+ /* Initialize the printer and reset the margins. */
+ fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream);
/* Create color buffer */
- if (gx_device_has_color(pdev))
- {
- color_line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- color_in_size = color_line_size * (8 * y_mult);
- if((color_in = (byte *)gs_malloc(pdev->memory, color_in_size+1, 1,
- "epsc_print_page(color)")) == 0)
- {
- gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
- gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
- return(-1);
- }
- }
- else
- {
- color_in = in;
- color_in_size = in_size;
- color_line_size = line_size;
- }
-
- /* Print lines of graphics */
- while ( lnum < pdev->height )
- {
- int lcnt;
- byte *nextcolor = NULL; /* position where next color appears */
- byte *nextmono = NULL; /* position to map next color */
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_copy_scan_lines(pdev, lnum, color_in, color_line_size);
-
- if ( color_in[0] == 0 &&
- !memcmp((char *)color_in, (char *)color_in + 1, color_line_size - 1)
- )
- { lnum++;
- skip += 3 / y_mult;
- continue;
- }
-
- /* Vertical tab to the appropriate position. */
- while ( skip > 255 )
- { fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if ( skip )
- fprintf(prn_stream, "\033J%c", skip);
-
- /* Copy the rest of the scan lines. */
- lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1,
- color_in + color_line_size, color_in_size - color_line_size);
-
- if ( lcnt < 8 * y_mult )
- {
- memset((char *)(color_in + lcnt * color_line_size), 0,
- color_in_size - lcnt * color_line_size);
- if (gx_device_has_color(pdev)) /* clear the work buffer */
- memset((char *)(in + lcnt * line_size), 0,
- in_size - lcnt * line_size);
- }
-
+ if (gx_device_has_color(pdev))
+ {
+ color_line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ color_in_size = color_line_size * (8 * y_mult);
+ if((color_in = (byte *)gs_malloc(pdev->memory, color_in_size+1, 1,
+ "epsc_print_page(color)")) == 0)
+ {
+ gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
+ gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
+ return(-1);
+ }
+ }
+ else
+ {
+ color_in = in;
+ color_in_size = in_size;
+ color_line_size = line_size;
+ }
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ int lcnt;
+ byte *nextcolor = NULL; /* position where next color appears */
+ byte *nextmono = NULL; /* position to map next color */
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_copy_scan_lines(pdev, lnum, color_in, color_line_size);
+
+ if ( color_in[0] == 0 &&
+ !memcmp((char *)color_in, (char *)color_in + 1, color_line_size - 1)
+ )
+ { lnum++;
+ skip += 3 / y_mult;
+ continue;
+ }
+
+ /* Vertical tab to the appropriate position. */
+ while ( skip > 255 )
+ { fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ fprintf(prn_stream, "\033J%c", skip);
+
+ /* Copy the rest of the scan lines. */
+ lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1,
+ color_in + color_line_size, color_in_size - color_line_size);
+
+ if ( lcnt < 8 * y_mult )
+ {
+ memset((char *)(color_in + lcnt * color_line_size), 0,
+ color_in_size - lcnt * color_line_size);
+ if (gx_device_has_color(pdev)) /* clear the work buffer */
+ memset((char *)(in + lcnt * line_size), 0,
+ in_size - lcnt * line_size);
+ }
+
/*
** We need to create a normal epson scan line from our color scan line
** We do this by setting a bit in the "in" buffer if the pixel byte is set
@@ -244,180 +244,179 @@ epsc_print_page(gx_device_printer *pdev, FILE *prn_stream)
** In the future, we should make the passes so as to maximize the
** life of the color ribbon (i.e. go lightest to darkest).
*/
- do
- {
- byte *inp = in;
- byte *in_end = in + line_size;
- byte *out_end = out;
- byte *out_blk;
- register byte *outp;
-
- if (gx_device_has_color(pdev))
- {
- register int i,j;
- register byte *outbuf, *realbuf;
- byte current_color;
- int end_next_bits = whole_bits;
- int lastbits;
-
+ do
+ {
+ byte *inp = in;
+ byte *in_end = in + line_size;
+ byte *out_end = out;
+ byte *out_blk;
+ register byte *outp;
+
+ if (gx_device_has_color(pdev))
+ {
+ register int i,j;
+ register byte *outbuf, *realbuf;
+ byte current_color;
+ int end_next_bits = whole_bits;
+ int lastbits;
+
/* Move to the point in the scanline that has a new color */
- if (nextcolor)
- {
- realbuf = nextcolor;
- outbuf = nextmono;
- memset((char *)in, 0, (nextmono - in));
- i = nextcolor - color_in;
- nextcolor = NULL;
- end_next_bits = (i / color_line_size) * color_line_size
- + whole_bits;
- }
- else
- {
- i = 0;
- realbuf = color_in;
- outbuf = in;
- nextcolor = NULL;
- }
+ if (nextcolor)
+ {
+ realbuf = nextcolor;
+ outbuf = nextmono;
+ memset((char *)in, 0, (nextmono - in));
+ i = nextcolor - color_in;
+ nextcolor = NULL;
+ end_next_bits = (i / color_line_size) * color_line_size
+ + whole_bits;
+ }
+ else
+ {
+ i = 0;
+ realbuf = color_in;
+ outbuf = in;
+ nextcolor = NULL;
+ }
/* move thru the color buffer, turning on the appropriate
** bit in the "mono" buffer", setting pointers to the next
** color and changing the color output of the epson
*/
- for (current_color = 0; i <= color_in_size && outbuf < in + in_size; outbuf++)
- {
+ for (current_color = 0; i <= color_in_size && outbuf < in + in_size; outbuf++)
+ {
/* Remember, line_size is rounded up to next whole byte
** whereas color_line_size is the proper length
** We only want to set the proper bits in the last line_size byte.
*/
- if (spare_bits && i == end_next_bits)
- {
- end_next_bits = whole_bits + i + spare_bits;
- lastbits = 8 - spare_bits;
- }
- else
- lastbits = 0;
-
- for (*outbuf = 0, j = 8; --j >= lastbits && i <= color_in_size;
- realbuf++,i++)
- {
- if (*realbuf)
- {
- if (current_color > 0)
- {
- if (*realbuf == current_color)
- {
- *outbuf |= 1 << j;
- *realbuf = 0; /* throw this byte away */
- }
- /* save this location for next pass */
- else if (nextcolor == NULL)
- {
- nextcolor = realbuf - (7 - j);
- nextmono = outbuf;
- }
- }
- else
- {
- *outbuf |= 1 << j;
- current_color = *realbuf; /* set color */
- *realbuf = 0;
- }
- }
- }
- }
- *outbuf = 0; /* zero the end, for safe keeping */
+ if (spare_bits && i == end_next_bits)
+ {
+ end_next_bits = whole_bits + i + spare_bits;
+ lastbits = 8 - spare_bits;
+ }
+ else
+ lastbits = 0;
+
+ for (*outbuf = 0, j = 8; --j >= lastbits && i <= color_in_size;
+ realbuf++,i++)
+ {
+ if (*realbuf)
+ {
+ if (current_color > 0)
+ {
+ if (*realbuf == current_color)
+ {
+ *outbuf |= 1 << j;
+ *realbuf = 0; /* throw this byte away */
+ }
+ /* save this location for next pass */
+ else if (nextcolor == NULL)
+ {
+ nextcolor = realbuf - (7 - j);
+ nextmono = outbuf;
+ }
+ }
+ else
+ {
+ *outbuf |= 1 << j;
+ current_color = *realbuf; /* set color */
+ *realbuf = 0;
+ }
+ }
+ }
+ }
+ *outbuf = 0; /* zero the end, for safe keeping */
/* Change color on the EPSON, current_color must be set
** but lets check anyway
*/
- if (current_color)
- fprintf(prn_stream,"\033r%d",current_color ^ 7);
- }
-
- /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
- /* because that's how the printer wants the data. */
- /* If we are in a 24-pin mode, we have to transpose */
- /* groups of 3 lines at a time. */
-
- if ( y_24pin )
- { for ( ; inp < in_end; inp++, out_end += 24 )
- { gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
- gdev_prn_transpose_8x8(inp + line_size * 8, line_size, out_end + 1, 3);
- gdev_prn_transpose_8x8(inp + line_size * 16, line_size, out_end + 2, 3);
- }
- /* Remove trailing 0s. */
- while ( out_end > out && out_end[-1] == 0 &&
- out_end[-2] == 0 && out_end[-3] == 0
- )
- out_end -= 3;
- }
- else
- { for ( ; inp < in_end; inp++, out_end += 8 )
- { gdev_prn_transpose_8x8(inp, line_size, out_end, 1);
- }
- /* Remove trailing 0s. */
- while ( out_end > out && out_end[-1] == 0 )
- out_end--;
- }
-
- for ( pass = first_pass; pass <= last_pass; pass++ )
- {
- for ( out_blk = outp = out; outp < out_end; )
- { /* Skip a run of leading 0s. */
- /* At least 10 are needed to make tabbing worth it. */
- /* We do everything by 3's to avoid having to make */
- /* different cases for 9- and 24-pin. */
-
- if ( *outp == 0 && outp + 12 <= out_end &&
- outp[1] == 0 && outp[2] == 0 &&
- (outp[3] | outp[4] | outp[5]) == 0 &&
- (outp[6] | outp[7] | outp[8]) == 0 &&
- (outp[9] | outp[10] | outp[11]) == 0
- )
- { byte *zp = outp;
- int tpos;
- byte *newp;
- outp += 12;
- while ( outp + 3 <= out_end && *outp == 0 &&
- outp[1] == 0 && outp[2] == 0
- )
- outp += 3;
- tpos = (outp - out) / bytes_per_space;
- newp = out + tpos * bytes_per_space;
- if ( newp > zp + 10 )
- { /* Output preceding bit data. */
- if ( zp > out_blk ) /* only false at */
- /* beginning of line */
- epsc_output_run(out_blk, (int)(zp - out_blk),
- y_mult, start_graphics,
- prn_stream, pass);
- /* Tab over to the appropriate position. */
- fprintf(prn_stream, "\033D%c%c\t", tpos, 0);
- out_blk = outp = newp;
- }
- }
- else
- outp += y_mult;
- }
- if ( outp > out_blk )
- epsc_output_run(out_blk, (int)(outp - out_blk),
- y_mult, start_graphics,
- prn_stream, pass);
-
- fputc('\r', prn_stream);
- }
- } while (nextcolor);
- skip = 24;
- lnum += 8 * y_mult;
- }
-
- /* Eject the page and reinitialize the printer */
- fputs("\f\033@", prn_stream);
-
-
- gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
- gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
- if (gx_device_has_color(pdev))
- gs_free(pdev->memory, (char *)color_in, color_in_size+1, 1, "epsc_print_page(rin)");
- return 0;
+ if (current_color)
+ fprintf(prn_stream,"\033r%d",current_color ^ 7);
+ }
+
+ /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
+ /* because that's how the printer wants the data. */
+ /* If we are in a 24-pin mode, we have to transpose */
+ /* groups of 3 lines at a time. */
+
+ if ( y_24pin )
+ { for ( ; inp < in_end; inp++, out_end += 24 )
+ { gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 8, line_size, out_end + 1, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 16, line_size, out_end + 2, 3);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 &&
+ out_end[-2] == 0 && out_end[-3] == 0
+ )
+ out_end -= 3;
+ }
+ else
+ { for ( ; inp < in_end; inp++, out_end += 8 )
+ { gdev_prn_transpose_8x8(inp, line_size, out_end, 1);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 )
+ out_end--;
+ }
+
+ for ( pass = first_pass; pass <= last_pass; pass++ )
+ {
+ for ( out_blk = outp = out; outp < out_end; )
+ { /* Skip a run of leading 0s. */
+ /* At least 10 are needed to make tabbing worth it. */
+ /* We do everything by 3's to avoid having to make */
+ /* different cases for 9- and 24-pin. */
+
+ if ( *outp == 0 && outp + 12 <= out_end &&
+ outp[1] == 0 && outp[2] == 0 &&
+ (outp[3] | outp[4] | outp[5]) == 0 &&
+ (outp[6] | outp[7] | outp[8]) == 0 &&
+ (outp[9] | outp[10] | outp[11]) == 0
+ )
+ { byte *zp = outp;
+ int tpos;
+ byte *newp;
+ outp += 12;
+ while ( outp + 3 <= out_end && *outp == 0 &&
+ outp[1] == 0 && outp[2] == 0
+ )
+ outp += 3;
+ tpos = (outp - out) / bytes_per_space;
+ newp = out + tpos * bytes_per_space;
+ if ( newp > zp + 10 )
+ { /* Output preceding bit data. */
+ if ( zp > out_blk ) /* only false at */
+ /* beginning of line */
+ epsc_output_run(out_blk, (int)(zp - out_blk),
+ y_mult, start_graphics,
+ prn_stream, pass);
+ /* Tab over to the appropriate position. */
+ fprintf(prn_stream, "\033D%c%c\t", tpos, 0);
+ out_blk = outp = newp;
+ }
+ }
+ else
+ outp += y_mult;
+ }
+ if ( outp > out_blk )
+ epsc_output_run(out_blk, (int)(outp - out_blk),
+ y_mult, start_graphics,
+ prn_stream, pass);
+
+ fputc('\r', prn_stream);
+ }
+ } while (nextcolor);
+ skip = 24;
+ lnum += 8 * y_mult;
+ }
+
+ /* Eject the page and reinitialize the printer */
+ fputs("\f\033@", prn_stream);
+
+ gs_free(pdev->memory, (char *)out, out_size+1, 1, "epsc_print_page(out)");
+ gs_free(pdev->memory, (char *)in, in_size+1, 1, "epsc_print_page(in)");
+ if (gx_device_has_color(pdev))
+ gs_free(pdev->memory, (char *)color_in, color_in_size+1, 1, "epsc_print_page(rin)");
+ return 0;
}
/* Output a single graphics command. */
@@ -426,26 +425,26 @@ static void
epsc_output_run(byte *data, int count, int y_mult,
char start_graphics, FILE *prn_stream, int pass)
{ int xcount = count / y_mult;
- fputc(033, prn_stream);
- if ( !(start_graphics & ~3) )
- { fputc("KLYZ"[(int)start_graphics], prn_stream);
- }
- else
- { fputc('*', prn_stream);
- fputc(start_graphics & ~DD, prn_stream);
- }
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- if ( !pass )
- fwrite((char *)data, 1, count, prn_stream);
- else
- { /* Only write every other column of y_mult bytes. */
- int which = pass;
- byte *dp = data;
- register int i, j;
- for ( i = 0; i < xcount; i++, which++ )
- for ( j = 0; j < y_mult; j++, dp++ )
- { putc(((which & 1) ? *dp : 0), prn_stream);
- }
- }
+ fputc(033, prn_stream);
+ if ( !(start_graphics & ~3) )
+ { fputc("KLYZ"[(int)start_graphics], prn_stream);
+ }
+ else
+ { fputc('*', prn_stream);
+ fputc(start_graphics & ~DD, prn_stream);
+ }
+ fputc(xcount & 0xff, prn_stream);
+ fputc(xcount >> 8, prn_stream);
+ if ( !pass )
+ fwrite((char *)data, 1, count, prn_stream);
+ else
+ { /* Only write every other column of y_mult bytes. */
+ int which = pass;
+ byte *dp = data;
+ register int i, j;
+ for ( i = 0; i < xcount; i++, which++ )
+ for ( j = 0; j < y_mult; j++, dp++ )
+ { putc(((which & 1) ? *dp : 0), prn_stream);
+ }
+ }
}
diff --git a/gs/base/gdevepsn.c b/gs/base/gdevepsn.c
index b8c8bed52..bf045af1f 100644
--- a/gs/base/gdevepsn.c
+++ b/gs/base/gdevepsn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,7 +21,7 @@
* interleaved in multiple passes to produce high vertical resolution at
* the expense of several passes of the print head. 'eps9mid' is a special
* mode for 9 pin printers too, scan lines are interleaved but with next
- * vertical line. 'ibmpro' is for the IBM ProPrinter, which has slightly
+ * vertical line. 'ibmpro' is for the IBM ProPrinter, which has slightly
* (but only slightly) different control codes.
*
* Thanks to:
@@ -93,42 +93,41 @@
/* The device descriptors */
static dev_proc_print_page(epson_print_page);
-static dev_proc_print_page(eps9mid_print_page);
+static dev_proc_print_page(eps9mid_print_page);
static dev_proc_print_page(eps9high_print_page);
static dev_proc_print_page(ibmpro_print_page);
/* Standard Epson device */
const gx_device_printer far_data gs_epson_device =
prn_device(prn_std_procs, "epson",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.25, 0.02, 0.25, 0.4, /* margins */
- 1, epson_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.25, 0.02, 0.25, 0.4, /* margins */
+ 1, epson_print_page);
/* Mid-res (interleaved, 1 pass per line) 9-pin device */
-const gx_device_printer far_data gs_eps9mid_device =
+const gx_device_printer far_data gs_eps9mid_device =
prn_device(prn_std_procs, "eps9mid",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, 3*Y_BASERES,
- 0.2, 0.0, 0, 0.0, /* margins */
- 1, eps9mid_print_page);
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, 3*Y_BASERES,
+ 0.2, 0.0, 0, 0.0, /* margins */
+ 1, eps9mid_print_page);
/* High-res (interleaved) 9-pin device */
-const gx_device_printer far_data gs_eps9high_device =
+const gx_device_printer far_data gs_eps9high_device =
prn_device(prn_std_procs, "eps9high",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, 3*Y_BASERES,
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, eps9high_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, 3*Y_BASERES,
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, eps9high_print_page);
/* IBM ProPrinter device */
const gx_device_printer far_data gs_ibmpro_device =
prn_device(prn_std_procs, "ibmpro",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, ibmpro_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, ibmpro_print_page);
/* ------ Driver procedures ------ */
@@ -141,258 +140,258 @@ static int
eps_print_page(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
const char *init_string, int init_length, const char *end_string,
int archaic, int tab_hiccup)
-{
- static const char graphics_modes_9[5] =
- {
- -1, 0 /*60*/, 1 /*120*/, 7 /*180*/, DD+3 /*240*/
- };
-
- static const char graphics_modes_24[7] =
- {
- -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
- DD+35 /*240*/, -1, DD+40 /*360*/
- };
-
- int y_24pin = (y_9pin_high ? 0 : pdev->y_pixels_per_inch > 72);
- int in_y_mult = ((y_24pin | y_9pin_high) ? 3 : 1);
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- /* Note that in_size is a multiple of 8. */
- int in_size = line_size * (8 * in_y_mult);
- byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf1)");
- byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
- int out_y_mult = (y_24pin ? 3 : 1);
- int x_dpi = (int)pdev->x_pixels_per_inch;
- char start_graphics =
- (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
- int first_pass = (start_graphics & DD ? 1 : 0);
- int last_pass = first_pass * (y_9pin_high == 2 ? 1 : 2);
- int y_passes = (y_9pin_high ? 3 : 1);
- int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
- int bytes_per_space = dots_per_space * out_y_mult;
- int tab_min_pixels = x_dpi * MIN_TAB_10THS / 10;
- int skip = 0, lnum = 0, pass, ypass;
-
- /* Check allocations */
- if ( buf1 == 0 || buf2 == 0 )
- { if ( buf1 )
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
- if ( buf2 )
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
- return_error(gs_error_VMerror);
- }
-
- /* Initialize the printer and reset the margins. */
- fwrite(init_string, 1, init_length, prn_stream);
- if ( init_string[init_length - 1] == 'Q' )
- fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
- prn_stream);
-
- /* Calculate the minimum tab distance. */
- if ( tab_min_pixels < max(MIN_TAB_PIXELS, 3) )
- tab_min_pixels = max(MIN_TAB_PIXELS, 3);
- tab_min_pixels -= tab_min_pixels % 3; /* simplify life */
-
- /* Print lines of graphics */
- while ( lnum < pdev->height )
- {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *out_end;
- byte *out_blk;
- register byte *outp;
- int lcnt;
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if ( in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
- )
- {
- lnum++;
- skip += 3 / in_y_mult;
- continue;
- }
-
- /* Vertical tab to the appropriate position. */
- while ( skip > 255 )
- {
- fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if ( skip )
- {
- fprintf(prn_stream, "\033J%c", skip);
- }
-
- /* Copy the the scan lines. */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if ( lcnt < 8 * in_y_mult )
- { /* Pad with lines of zeros. */
- memset(in + lcnt * line_size, 0,
- in_size - lcnt * line_size);
- }
-
- if ( y_9pin_high == 2 )
- { /* Force printing of every dot in one pass */
- /* by reducing vertical resolution */
- /* (ORing with the next line of data). */
- /* This is necessary because some Epson compatibles */
- /* can't print neighboring dots. */
- int i;
- for ( i = 0; i < line_size * in_y_mult; ++i )
- in_data[i] |= in_data[i + line_size];
- }
-
- if ( y_9pin_high )
- { /* Shuffle the scan lines */
- byte *p;
- int i;
- static const char index[] =
- { 0, 8, 16, 1, 9, 17,
- 2, 10, 18, 3, 11, 19,
- 4, 12, 20, 5, 13, 21,
- 6, 14, 22, 7, 15, 23
- };
-
- for ( i = 0; i < 24; i++ )
- {
- memcpy(out+(index[i]*line_size),
- in+(i*line_size), line_size);
- }
- p = in;
- in = out;
- out = p;
- }
-
- for ( ypass = 0; ypass < y_passes; ypass++ )
- {
- for ( pass = first_pass; pass <= last_pass; pass++ )
- {
- /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
- /* because that's how the printer wants the data. */
- /* If we are in a 24-pin mode, we have to transpose */
- /* groups of 3 lines at a time. */
-
- if ( pass == first_pass )
- {
- out_end = out;
- inp = in;
- in_end = inp + line_size;
-
- if ( y_24pin )
- {
- for ( ; inp < in_end; inp++, out_end += 24 )
- {
- gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
- gdev_prn_transpose_8x8(inp + line_size * 8,
- line_size, out_end + 1, 3);
- gdev_prn_transpose_8x8(inp + line_size * 16,
- line_size, out_end + 2, 3);
- }
- /* Remove trailing 0s. */
- while ( out_end > out && out_end[-1] == 0 &&
- out_end[-2] == 0 && out_end[-3] == 0)
- {
- out_end -= 3;
- }
- }
- else
- {
- for ( ; inp < in_end; inp++, out_end += 8 )
- {
- gdev_prn_transpose_8x8(inp + (ypass * 8*line_size),
- line_size, out_end, 1);
- }
- /* Remove trailing 0s. */
- while ( out_end > out && out_end[-1] == 0 )
- {
- out_end--;
- }
- }
- }
-
- for ( out_blk = outp = out; outp < out_end; )
- {
- /* Skip a run of leading 0s. At least */
- /* tab_min_pixels are needed to make tabbing */
- /* worth it. We do everything by 3's to */
- /* avoid having to make different cases */
- /* for 9- and 24-pin. */
- if ( !archaic &&
- *outp == 0 && out_end - outp >= tab_min_pixels &&
- (outp[1] | outp[2]) == 0 &&
- !memcmp((char *)outp, (char *)outp + 3,
- tab_min_pixels - 3)
- )
- {
- byte *zp = outp;
- int tpos;
- byte *newp;
-
- outp += tab_min_pixels;
- while ( outp + 3 <= out_end &&
- *outp == 0 &&
- outp[1] == 0 && outp[2] == 0 )
- {
- outp += 3;
- }
- tpos = (outp - out) / bytes_per_space;
- newp = out + tpos * bytes_per_space;
- if ( newp > zp + 10 )
- {
- /* Output preceding bit data.*/
- if ( zp > out_blk )
- {
- /* only false at beginning of line */
- eps_output_run(out_blk, (int)(zp - out_blk),
- out_y_mult, start_graphics,
- prn_stream,
- (y_9pin_high == 2 ?
- (1 + ypass) & 1 : pass));
- }
- /* Tab over to the appropriate position. */
- if ( tab_hiccup )
- fputs("\010 ", prn_stream); /* bksp, space */
- /* The following statement is broken up */
- /* to work around a bug in emx/gcc. */
- fprintf(prn_stream, "\033D%c", tpos);
- fputc(0, prn_stream);
- fputc('\t', prn_stream);
- out_blk = outp = newp;
- }
- }
- else
- {
- outp += out_y_mult;
- }
- }
- if ( outp > out_blk )
- {
- eps_output_run(out_blk, (int)(outp - out_blk),
- out_y_mult, start_graphics,
- prn_stream,
- (y_9pin_high == 2 ? (1 + ypass) & 1 : pass));
- }
-
- fputc('\r', prn_stream);
- }
- if ( ypass < y_passes - 1 )
- fputs("\033J\001", prn_stream);
- }
- skip = 24 - y_passes + 1; /* no skip on last Y pass */
- lnum += 8 * in_y_mult;
- }
-
- /* Eject the page and reinitialize the printer */
- fputs(end_string, prn_stream);
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
- return 0;
+{
+ static const char graphics_modes_9[5] =
+ {
+ -1, 0 /*60*/, 1 /*120*/, 7 /*180*/, DD+3 /*240*/
+ };
+
+ static const char graphics_modes_24[7] =
+ {
+ -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
+ DD+35 /*240*/, -1, DD+40 /*360*/
+ };
+
+ int y_24pin = (y_9pin_high ? 0 : pdev->y_pixels_per_inch > 72);
+ int in_y_mult = ((y_24pin | y_9pin_high) ? 3 : 1);
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* Note that in_size is a multiple of 8. */
+ int in_size = line_size * (8 * in_y_mult);
+ byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
+ int out_y_mult = (y_24pin ? 3 : 1);
+ int x_dpi = (int)pdev->x_pixels_per_inch;
+ char start_graphics =
+ (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
+ int first_pass = (start_graphics & DD ? 1 : 0);
+ int last_pass = first_pass * (y_9pin_high == 2 ? 1 : 2);
+ int y_passes = (y_9pin_high ? 3 : 1);
+ int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
+ int bytes_per_space = dots_per_space * out_y_mult;
+ int tab_min_pixels = x_dpi * MIN_TAB_10THS / 10;
+ int skip = 0, lnum = 0, pass, ypass;
+
+ /* Check allocations */
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
+ if ( buf2 )
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
+ return_error(gs_error_VMerror);
+ }
+
+ /* Initialize the printer and reset the margins. */
+ fwrite(init_string, 1, init_length, prn_stream);
+ if ( init_string[init_length - 1] == 'Q' )
+ fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
+ prn_stream);
+
+ /* Calculate the minimum tab distance. */
+ if ( tab_min_pixels < max(MIN_TAB_PIXELS, 3) )
+ tab_min_pixels = max(MIN_TAB_PIXELS, 3);
+ tab_min_pixels -= tab_min_pixels % 3; /* simplify life */
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ byte *out_blk;
+ register byte *outp;
+ int lcnt;
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
+ )
+ {
+ lnum++;
+ skip += 3 / in_y_mult;
+ continue;
+ }
+
+ /* Vertical tab to the appropriate position. */
+ while ( skip > 255 )
+ {
+ fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ {
+ fprintf(prn_stream, "\033J%c", skip);
+ }
+
+ /* Copy the the scan lines. */
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ if ( lcnt < 8 * in_y_mult )
+ { /* Pad with lines of zeros. */
+ memset(in + lcnt * line_size, 0,
+ in_size - lcnt * line_size);
+ }
+
+ if ( y_9pin_high == 2 )
+ { /* Force printing of every dot in one pass */
+ /* by reducing vertical resolution */
+ /* (ORing with the next line of data). */
+ /* This is necessary because some Epson compatibles */
+ /* can't print neighboring dots. */
+ int i;
+ for ( i = 0; i < line_size * in_y_mult; ++i )
+ in_data[i] |= in_data[i + line_size];
+ }
+
+ if ( y_9pin_high )
+ { /* Shuffle the scan lines */
+ byte *p;
+ int i;
+ static const char index[] =
+ { 0, 8, 16, 1, 9, 17,
+ 2, 10, 18, 3, 11, 19,
+ 4, 12, 20, 5, 13, 21,
+ 6, 14, 22, 7, 15, 23
+ };
+
+ for ( i = 0; i < 24; i++ )
+ {
+ memcpy(out+(index[i]*line_size),
+ in+(i*line_size), line_size);
+ }
+ p = in;
+ in = out;
+ out = p;
+ }
+
+ for ( ypass = 0; ypass < y_passes; ypass++ )
+ {
+ for ( pass = first_pass; pass <= last_pass; pass++ )
+ {
+ /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
+ /* because that's how the printer wants the data. */
+ /* If we are in a 24-pin mode, we have to transpose */
+ /* groups of 3 lines at a time. */
+
+ if ( pass == first_pass )
+ {
+ out_end = out;
+ inp = in;
+ in_end = inp + line_size;
+
+ if ( y_24pin )
+ {
+ for ( ; inp < in_end; inp++, out_end += 24 )
+ {
+ gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 8,
+ line_size, out_end + 1, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 16,
+ line_size, out_end + 2, 3);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 &&
+ out_end[-2] == 0 && out_end[-3] == 0)
+ {
+ out_end -= 3;
+ }
+ }
+ else
+ {
+ for ( ; inp < in_end; inp++, out_end += 8 )
+ {
+ gdev_prn_transpose_8x8(inp + (ypass * 8*line_size),
+ line_size, out_end, 1);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 )
+ {
+ out_end--;
+ }
+ }
+ }
+
+ for ( out_blk = outp = out; outp < out_end; )
+ {
+ /* Skip a run of leading 0s. At least */
+ /* tab_min_pixels are needed to make tabbing */
+ /* worth it. We do everything by 3's to */
+ /* avoid having to make different cases */
+ /* for 9- and 24-pin. */
+ if ( !archaic &&
+ *outp == 0 && out_end - outp >= tab_min_pixels &&
+ (outp[1] | outp[2]) == 0 &&
+ !memcmp((char *)outp, (char *)outp + 3,
+ tab_min_pixels - 3)
+ )
+ {
+ byte *zp = outp;
+ int tpos;
+ byte *newp;
+
+ outp += tab_min_pixels;
+ while ( outp + 3 <= out_end &&
+ *outp == 0 &&
+ outp[1] == 0 && outp[2] == 0 )
+ {
+ outp += 3;
+ }
+ tpos = (outp - out) / bytes_per_space;
+ newp = out + tpos * bytes_per_space;
+ if ( newp > zp + 10 )
+ {
+ /* Output preceding bit data.*/
+ if ( zp > out_blk )
+ {
+ /* only false at beginning of line */
+ eps_output_run(out_blk, (int)(zp - out_blk),
+ out_y_mult, start_graphics,
+ prn_stream,
+ (y_9pin_high == 2 ?
+ (1 + ypass) & 1 : pass));
+ }
+ /* Tab over to the appropriate position. */
+ if ( tab_hiccup )
+ fputs("\010 ", prn_stream); /* bksp, space */
+ /* The following statement is broken up */
+ /* to work around a bug in emx/gcc. */
+ fprintf(prn_stream, "\033D%c", tpos);
+ fputc(0, prn_stream);
+ fputc('\t', prn_stream);
+ out_blk = outp = newp;
+ }
+ }
+ else
+ {
+ outp += out_y_mult;
+ }
+ }
+ if ( outp > out_blk )
+ {
+ eps_output_run(out_blk, (int)(outp - out_blk),
+ out_y_mult, start_graphics,
+ prn_stream,
+ (y_9pin_high == 2 ? (1 + ypass) & 1 : pass));
+ }
+
+ fputc('\r', prn_stream);
+ }
+ if ( ypass < y_passes - 1 )
+ fputs("\033J\001", prn_stream);
+ }
+ skip = 24 - y_passes + 1; /* no skip on last Y pass */
+ lnum += 8 * in_y_mult;
+ }
+
+ /* Eject the page and reinitialize the printer */
+ fputs(end_string, prn_stream);
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
+ return 0;
}
/* Output a single graphics command. */
@@ -400,40 +399,40 @@ eps_print_page(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
static void
eps_output_run(byte *data, int count, int y_mult,
char start_graphics, FILE *prn_stream, int pass)
-{
- int xcount = count / y_mult;
-
- fputc(033, prn_stream);
- if ( !(start_graphics & ~3) )
- {
- fputc("KLYZ"[(int)start_graphics], prn_stream);
- }
- else
- {
- fputc('*', prn_stream);
- fputc(start_graphics & ~DD, prn_stream);
- }
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- if ( !pass )
- {
- fwrite(data, 1, count, prn_stream);
- }
- else
- {
- /* Only write every other column of y_mult bytes. */
- int which = pass;
- register byte *dp = data;
- register int i, j;
-
- for ( i = 0; i < xcount; i++, which++ )
- {
- for ( j = 0; j < y_mult; j++, dp++ )
- {
- putc(((which & 1) ? *dp : 0), prn_stream);
- }
- }
- }
+{
+ int xcount = count / y_mult;
+
+ fputc(033, prn_stream);
+ if ( !(start_graphics & ~3) )
+ {
+ fputc("KLYZ"[(int)start_graphics], prn_stream);
+ }
+ else
+ {
+ fputc('*', prn_stream);
+ fputc(start_graphics & ~DD, prn_stream);
+ }
+ fputc(xcount & 0xff, prn_stream);
+ fputc(xcount >> 8, prn_stream);
+ if ( !pass )
+ {
+ fwrite(data, 1, count, prn_stream);
+ }
+ else
+ {
+ /* Only write every other column of y_mult bytes. */
+ int which = pass;
+ register byte *dp = data;
+ register int i, j;
+
+ for ( i = 0; i < xcount; i++, which++ )
+ {
+ for ( j = 0; j < y_mult; j++, dp++ )
+ {
+ putc(((which & 1) ? *dp : 0), prn_stream);
+ }
+ }
+ }
}
/* The print_page procedures are here, to avoid a forward reference. */
@@ -447,34 +446,34 @@ eps_output_run(byte *data, int count, int y_mult,
#define ESC 0x1b
static const char eps_init_string[] = {
#if ARCHAIC
- ESC, '@', 022 /*^R*/, ESC, 'Q'
+ ESC, '@', 022 /*^R*/, ESC, 'Q'
#else
- ESC, '@', ESC, 'P', ESC, 'l', 0, '\r', ESC, 'Q'
+ ESC, '@', ESC, 'P', ESC, 'l', 0, '\r', ESC, 'Q'
#endif
};
static int
epson_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 0, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 0, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
static int
eps9high_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 1, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 1, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
static int
eps9mid_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 2, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 2, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
static int
@@ -486,10 +485,10 @@ ibmpro_print_page(gx_device_printer *pdev, FILE *prn_stream)
* interpreting first characters as literal text.
*/
#define DC1 0x11
- static const char ibmpro_init_string[] = {
- DC1, ESC, '3', 0x30
- };
+ static const char ibmpro_init_string[] = {
+ DC1, ESC, '3', 0x30
+ };
#undef DC1
- return eps_print_page(pdev, prn_stream, 0, ibmpro_init_string,
- sizeof(ibmpro_init_string), "\f", 1, 0);
+ return eps_print_page(pdev, prn_stream, 0, ibmpro_init_string,
+ sizeof(ibmpro_init_string), "\f", 1, 0);
}
diff --git a/gs/base/gdevescp.c b/gs/base/gdevescp.c
index 5a7a79446..5506386b4 100644
--- a/gs/base/gdevescp.c
+++ b/gs/base/gdevescp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -86,94 +86,94 @@ static dev_proc_print_page(escp2_print_page);
/* Stylus 800 device */
const gx_device_printer far_data gs_st800_device =
prn_device(prn_std_procs, "st800",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- STYLUS_L_MARGIN, STYLUS_B_MARGIN, STYLUS_R_MARGIN, STYLUS_T_MARGIN,
- 1, escp2_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ STYLUS_L_MARGIN, STYLUS_B_MARGIN, STYLUS_R_MARGIN, STYLUS_T_MARGIN,
+ 1, escp2_print_page);
/* AP3250 device */
const gx_device_printer far_data gs_ap3250_device =
prn_device(prn_std_procs, "ap3250",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- AP3250_L_MARGIN, AP3250_B_MARGIN, AP3250_R_MARGIN, AP3250_T_MARGIN,
- 1, escp2_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ AP3250_L_MARGIN, AP3250_B_MARGIN, AP3250_R_MARGIN, AP3250_T_MARGIN,
+ 1, escp2_print_page);
/* ------ Internal routines ------ */
/* Send the page to the printer. */
static int
escp2_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
- int line_size = gdev_prn_raster((gx_device_printer *)pdev);
- int band_size = 24; /* 1, 8, or 24 */
- int in_size = line_size * band_size;
-
- byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "escp2_print_page(buf1)");
- byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "escp2_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
-
- int skip, lnum, top, bottom, left, width;
- int auto_feed = 1;
- int count, i;
-
- /*
- ** Check for valid resolution:
- **
- ** XDPI YDPI
- ** 360 360
- ** 360 180
- ** 180 180
- */
-
- if( !( (pdev->x_pixels_per_inch == 180 &&
- pdev->y_pixels_per_inch == 180) ||
- (pdev->x_pixels_per_inch == 360 &&
- (pdev->y_pixels_per_inch == 360 ||
- pdev->y_pixels_per_inch == 180) )) )
- return_error(gs_error_rangecheck);
-
- /*
- ** Check buffer allocations:
- */
-
- if ( buf1 == 0 || buf2 == 0 )
- { if ( buf1 )
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "escp2_print_page(buf1)");
- if ( buf2 )
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "escp2_print_page(buf2)");
- return_error(gs_error_VMerror);
- }
-
- /*
- ** Reset printer, enter graphics mode:
- */
-
- fwrite("\033@\033(G\001\000\001", 1, 8, prn_stream);
+{
+ int line_size = gdev_prn_raster((gx_device_printer *)pdev);
+ int band_size = 24; /* 1, 8, or 24 */
+ int in_size = line_size * band_size;
+
+ byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "escp2_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "escp2_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
+
+ int skip, lnum, top, bottom, left, width;
+ int auto_feed = 1;
+ int count, i;
+
+ /*
+ ** Check for valid resolution:
+ **
+ ** XDPI YDPI
+ ** 360 360
+ ** 360 180
+ ** 180 180
+ */
+
+ if( !( (pdev->x_pixels_per_inch == 180 &&
+ pdev->y_pixels_per_inch == 180) ||
+ (pdev->x_pixels_per_inch == 360 &&
+ (pdev->y_pixels_per_inch == 360 ||
+ pdev->y_pixels_per_inch == 180) )) )
+ return_error(gs_error_rangecheck);
+
+ /*
+ ** Check buffer allocations:
+ */
+
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "escp2_print_page(buf1)");
+ if ( buf2 )
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "escp2_print_page(buf2)");
+ return_error(gs_error_VMerror);
+ }
+
+ /*
+ ** Reset printer, enter graphics mode:
+ */
+
+ fwrite("\033@\033(G\001\000\001", 1, 8, prn_stream);
#ifdef A4
- /*
- ** After reset, the Stylus is set up for US letter paper.
- ** We need to set the page size appropriately for A4 paper.
- ** For some bizarre reason the ESC/P2 language wants the bottom
- ** margin measured from the *top* of the page:
- */
-
- fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
- 1, 22, prn_stream);
+ /*
+ ** After reset, the Stylus is set up for US letter paper.
+ ** We need to set the page size appropriately for A4 paper.
+ ** For some bizarre reason the ESC/P2 language wants the bottom
+ ** margin measured from the *top* of the page:
+ */
+
+ fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
+ 1, 22, prn_stream);
#endif
- /*
- ** Set the line spacing to match the band height:
- */
+ /*
+ ** Set the line spacing to match the band height:
+ */
- if( pdev->y_pixels_per_inch == 360 )
- fwrite("\033(U\001\0\012\033+\030", 1, 9, prn_stream);
- else
- fwrite("\033(U\001\0\024\033+\060", 1, 9, prn_stream);
+ if( pdev->y_pixels_per_inch == 360 )
+ fwrite("\033(U\001\0\012\033+\030", 1, 9, prn_stream);
+ else
+ fwrite("\033(U\001\0\024\033+\060", 1, 9, prn_stream);
/*
** If the printer has automatic page feeding, then the paper
@@ -187,8 +187,8 @@ escp2_print_page(gx_device_printer *pdev, FILE *prn_stream)
if( auto_feed ) {
top = (int)(dev_t_margin(pdev) * pdev->y_pixels_per_inch);
- bottom = (int)(pdev->height -
- dev_b_margin(pdev) * pdev->y_pixels_per_inch);
+ bottom = (int)(pdev->height -
+ dev_b_margin(pdev) * pdev->y_pixels_per_inch);
} else {
top = 0;
bottom = pdev->height;
@@ -202,209 +202,209 @@ escp2_print_page(gx_device_printer *pdev, FILE *prn_stream)
width = ((pdev->width - (int)(dev_r_margin(pdev) * pdev->x_pixels_per_inch)) >> 3) - left;
- /*
- ** Print the page:
- */
-
- for ( lnum = top, skip = 0 ; lnum < bottom ; )
- {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *outp;
- register byte *p, *q;
- int lcnt;
-
- /*
- ** Check buffer for 0 data. We can't do this mid-band
- */
-
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- while ( in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
- lnum < bottom )
- {
- lnum++;
- skip++;
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- }
-
- if(lnum == bottom ) break; /* finished with this page */
-
- /*
- ** Skip blank lines if we need to:
- */
-
- if( skip ) {
- fwrite("\033(v\002\000", 1, 5, prn_stream);
- fputc(skip & 0xff, prn_stream);
- fputc(skip >> 8, prn_stream);
- skip = 0;
- }
-
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
-
- /*
- ** Check to see if we don't have enough data to fill an entire
- ** band. Padding here seems to work (the printer doesn't jump
- ** to the next (blank) page), although the ideal behaviour
- ** would probably be to reduce the band height.
- **
- ** Pad with nulls:
- */
-
- if( lcnt < band_size )
- memset(in + lcnt * line_size, 0, in_size - lcnt * line_size);
-
- /*
- ** Now we have a band of data: try to compress it:
- */
-
- for( outp = out, i = 0 ; i < band_size ; i++ ) {
-
- /*
- ** Take margins into account:
- */
-
- inp = in + i * line_size + left;
- in_end = inp + width;
-
- /*
- ** walk through input buffer, looking for repeated data:
- ** Since we need more than 2 repeats to make the compression
- ** worth it, we can compare pairs, since it doesn't matter if we
- **
- */
-
- for( p = inp, q = inp + 1 ; q < in_end ; ) {
-
- if( *p != *q ) {
-
- p += 2;
- q += 2;
-
- } else {
-
- /*
- ** Check behind us, just in case:
- */
-
- if( p > inp && *p == *(p-1) )
- p--;
-
- /*
- ** walk forward, looking for matches:
- */
-
- for( q++ ; *q == *p && q < in_end ; q++ ) {
- if( (q-p) >= 128 ) {
- if( p > inp ) {
- count = p - inp;
- while( count > 128 ) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
- *outp++ = (char) (count - 1); /* count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- *outp++ = '\201'; /* Repeat 128 times */
- *outp++ = *p;
- p += 128;
- inp = p;
- }
- }
-
- if( (q - p) > 2 ) { /* output this sequence */
- if( p > inp ) {
- count = p - inp;
- while( count > 128 ) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
- *outp++ = (char) (count - 1); /* byte count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- count = q - p;
- *outp++ = (char) (256 - count + 1);
- *outp++ = *p;
- p += count;
- inp = p;
- } else /* add to non-repeating data list */
- p = q;
- if( q < in_end )
- q++;
- }
- }
-
- /*
- ** copy remaining part of line:
- */
-
- if( inp < in_end ) {
-
- count = in_end - inp;
-
- /*
- ** If we've had a long run of varying data followed by a
- ** sequence of repeated data and then hit the end of line,
- ** it's possible to get data counts > 128.
- */
-
- while( count > 128 ) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
-
- *outp++ = (char) (count - 1); /* byte count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- }
-
- /*
- ** Output data:
- */
-
- fwrite("\033.\001", 1, 3, prn_stream);
-
- if(pdev->y_pixels_per_inch == 360)
- fputc('\012', prn_stream);
- else
- fputc('\024', prn_stream);
-
- if(pdev->x_pixels_per_inch == 360)
- fputc('\012', prn_stream);
- else
- fputc('\024', prn_stream);
-
- fputc(band_size, prn_stream);
-
- fputc((width << 3) & 0xff, prn_stream);
- fputc( width >> 5, prn_stream);
-
- fwrite(out, 1, (outp - out), prn_stream);
-
- fwrite("\r\n", 1, 2, prn_stream);
- lnum += band_size;
- }
-
- /* Eject the page and reinitialize the printer */
-
- fputs("\f\033@", prn_stream);
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "escp2_print_page(buf2)");
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "escp2_print_page(buf1)");
- return 0;
+ /*
+ ** Print the page:
+ */
+
+ for ( lnum = top, skip = 0 ; lnum < bottom ; )
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *outp;
+ register byte *p, *q;
+ int lcnt;
+
+ /*
+ ** Check buffer for 0 data. We can't do this mid-band
+ */
+
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ while ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
+ lnum < bottom )
+ {
+ lnum++;
+ skip++;
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ }
+
+ if(lnum == bottom ) break; /* finished with this page */
+
+ /*
+ ** Skip blank lines if we need to:
+ */
+
+ if( skip ) {
+ fwrite("\033(v\002\000", 1, 5, prn_stream);
+ fputc(skip & 0xff, prn_stream);
+ fputc(skip >> 8, prn_stream);
+ skip = 0;
+ }
+
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+
+ /*
+ ** Check to see if we don't have enough data to fill an entire
+ ** band. Padding here seems to work (the printer doesn't jump
+ ** to the next (blank) page), although the ideal behaviour
+ ** would probably be to reduce the band height.
+ **
+ ** Pad with nulls:
+ */
+
+ if( lcnt < band_size )
+ memset(in + lcnt * line_size, 0, in_size - lcnt * line_size);
+
+ /*
+ ** Now we have a band of data: try to compress it:
+ */
+
+ for( outp = out, i = 0 ; i < band_size ; i++ ) {
+
+ /*
+ ** Take margins into account:
+ */
+
+ inp = in + i * line_size + left;
+ in_end = inp + width;
+
+ /*
+ ** walk through input buffer, looking for repeated data:
+ ** Since we need more than 2 repeats to make the compression
+ ** worth it, we can compare pairs, since it doesn't matter if we
+ **
+ */
+
+ for( p = inp, q = inp + 1 ; q < in_end ; ) {
+
+ if( *p != *q ) {
+
+ p += 2;
+ q += 2;
+
+ } else {
+
+ /*
+ ** Check behind us, just in case:
+ */
+
+ if( p > inp && *p == *(p-1) )
+ p--;
+
+ /*
+ ** walk forward, looking for matches:
+ */
+
+ for( q++ ; *q == *p && q < in_end ; q++ ) {
+ if( (q-p) >= 128 ) {
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+ *outp++ = (char) (count - 1); /* count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ *outp++ = '\201'; /* Repeat 128 times */
+ *outp++ = *p;
+ p += 128;
+ inp = p;
+ }
+ }
+
+ if( (q - p) > 2 ) { /* output this sequence */
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+ *outp++ = (char) (count - 1); /* byte count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ count = q - p;
+ *outp++ = (char) (256 - count + 1);
+ *outp++ = *p;
+ p += count;
+ inp = p;
+ } else /* add to non-repeating data list */
+ p = q;
+ if( q < in_end )
+ q++;
+ }
+ }
+
+ /*
+ ** copy remaining part of line:
+ */
+
+ if( inp < in_end ) {
+
+ count = in_end - inp;
+
+ /*
+ ** If we've had a long run of varying data followed by a
+ ** sequence of repeated data and then hit the end of line,
+ ** it's possible to get data counts > 128.
+ */
+
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+
+ *outp++ = (char) (count - 1); /* byte count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ }
+
+ /*
+ ** Output data:
+ */
+
+ fwrite("\033.\001", 1, 3, prn_stream);
+
+ if(pdev->y_pixels_per_inch == 360)
+ fputc('\012', prn_stream);
+ else
+ fputc('\024', prn_stream);
+
+ if(pdev->x_pixels_per_inch == 360)
+ fputc('\012', prn_stream);
+ else
+ fputc('\024', prn_stream);
+
+ fputc(band_size, prn_stream);
+
+ fputc((width << 3) & 0xff, prn_stream);
+ fputc( width >> 5, prn_stream);
+
+ fwrite(out, 1, (outp - out), prn_stream);
+
+ fwrite("\r\n", 1, 2, prn_stream);
+ lnum += band_size;
+ }
+
+ /* Eject the page and reinitialize the printer */
+
+ fputs("\f\033@", prn_stream);
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "escp2_print_page(buf2)");
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "escp2_print_page(buf1)");
+ return 0;
}
diff --git a/gs/base/gdevevga.c b/gs/base/gdevevga.c
index 31b1da586..da7731502 100644
--- a/gs/base/gdevevga.c
+++ b/gs/base/gdevevga.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,14 +44,14 @@ pcfb_get_state(pcfb_bios_state * pbs)
regs.h.bh = 0;
int86(0x10, &regs, &regs);
switch (regs.rshort.cx) {
- case 0x08:
- pbs->text_font = 0x1112;
- break; /* 8 x 8 */
- case 0x10:
- pbs->text_font = 0x1114;
- break; /* 8 x 16 */
- default:
- pbs->text_font = 0x1111; /* 8 x 14 */
+ case 0x08:
+ pbs->text_font = 0x1112;
+ break; /* 8 x 8 */
+ case 0x10:
+ pbs->text_font = 0x1114;
+ break; /* 8 x 16 */
+ default:
+ pbs->text_font = 0x1111; /* 8 x 14 */
}
regs.h.ah = 0x8;
regs.h.bh = pbs->text_page;
@@ -61,16 +61,16 @@ pcfb_get_state(pcfb_bios_state * pbs)
regs.rshort.ax = 0x1a00;
int86(0x10, &regs, &regs);
if (regs.h.al == 0x1a && regs.h.bl == 0x8) {
- regs.rshort.ax = 0x1008;
- int86(0x10, &regs, &regs);
- pbs->border_color = regs.h.bh;
+ regs.rshort.ax = 0x1008;
+ int86(0x10, &regs, &regs);
+ pbs->border_color = regs.h.bh;
}
if (pbs->display_mode != 3) {
- pbs->display_mode = 3;
- pbs->text_font = 0x1112;
- pbs->text_cursor_mode = 0x0607;
- pbs->text_attribute = 7;
- pbs->text_page = 0;
+ pbs->display_mode = 3;
+ pbs->text_font = 0x1112;
+ pbs->text_cursor_mode = 0x0607;
+ pbs->text_attribute = 7;
+ pbs->text_page = 0;
}
}
diff --git a/gs/base/gdevfax.c b/gs/base/gdevfax.c
index 1988c7a98..333a3ac27 100644
--- a/gs/base/gdevfax.c
+++ b/gs/base/gdevfax.c
@@ -33,7 +33,6 @@ const gx_device_procs gdev_fax_std_procs =
FAX_DEVICE_BODY(gx_device_fax, gdev_fax_std_procs, dname, print_page)\
}
-
const gx_device_fax gs_faxg3_device =
FAX_DEVICE("faxg3", faxg3_print_page);
diff --git a/gs/base/gdevfax.h b/gs/base/gdevfax.h
index 6621b6507..2ef76f0a8 100644
--- a/gs/base/gdevfax.h
+++ b/gs/base/gdevfax.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,10 +33,10 @@ typedef struct gx_device_fax_s {
#define FAX_DEVICE_BODY(dtype, procs, dname, print_page)\
prn_device_std_body(dtype, procs, dname,\
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
- X_DPI, Y_DPI,\
- 0, 0, 0, 0, /* margins */\
- 1, print_page),\
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
+ X_DPI, Y_DPI,\
+ 0, 0, 0, 0, /* margins */\
+ 1, print_page),\
1, /* AdjustWidth */\
0 /* MinFeatureSize */
@@ -51,12 +51,12 @@ extern const gx_device_procs gdev_fax_std_procs;
/* Other procedures */
void gdev_fax_init_state(stream_CFE_state *ss, const gx_device_fax *fdev);
void gdev_fax_init_fax_state(stream_CFE_state *ss,
- const gx_device_fax *fdev);
+ const gx_device_fax *fdev);
int gdev_fax_print_strip(gx_device_printer * pdev, FILE * prn_stream,
- const stream_template * temp, stream_state * ss,
- int width, int row_first,
- int row_end /* last + 1 */);
+ const stream_template * temp, stream_state * ss,
+ int width, int row_first,
+ int row_end /* last + 1 */);
int gdev_fax_print_page(gx_device_printer *pdev, FILE *prn_stream,
- stream_CFE_state *ss);
+ stream_CFE_state *ss);
#endif /* gdevfax_INCLUDED */
diff --git a/gs/base/gdevherc.c b/gs/base/gdevherc.c
index 9c12cad3e..b8a1b6d2e 100644
--- a/gs/base/gdevherc.c
+++ b/gs/base/gdevherc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,7 @@ typedef union REGS registers;
/* Procedures */
- /* See gxdevice.h for the definitions of the procedures. */
+ /* See gxdevice.h for the definitions of the procedures. */
dev_proc_open_device(herc_open);
dev_proc_close_device(herc_close);
@@ -58,31 +58,30 @@ dev_proc_copy_color(herc_copy_color);
/* The device descriptor */
static gx_device_procs herc_procs = {
- herc_open,
- gx_default_get_initial_matrix,
- gx_default_sync_output,
- gx_default_output_page,
- herc_close,
- gx_default_map_rgb_color,
- gx_default_map_color_rgb,
- herc_fill_rectangle,
- gx_default_tile_rectangle,
- herc_copy_mono,
- herc_copy_color
+ herc_open,
+ gx_default_get_initial_matrix,
+ gx_default_sync_output,
+ gx_default_output_page,
+ herc_close,
+ gx_default_map_rgb_color,
+ gx_default_map_color_rgb,
+ herc_fill_rectangle,
+ gx_default_tile_rectangle,
+ herc_copy_mono,
+ herc_copy_color
};
gx_device far_data gs_herc_device = {
- std_device_std_body(gx_device, &herc_procs, "herc",
- screen_size_x, screen_size_y,
- /* The following parameters map an appropriate fraction of */
- /* the screen to a full-page coordinate space. */
- /* This may or may not be what is desired! */
- (screen_size_y * aspect_ratio) / PAGE_HEIGHT_INCHES, /* x dpi */
- screen_size_y / PAGE_HEIGHT_INCHES /* y dpi */
- )
+ std_device_std_body(gx_device, &herc_procs, "herc",
+ screen_size_x, screen_size_y,
+ /* The following parameters map an appropriate fraction of */
+ /* the screen to a full-page coordinate space. */
+ /* This may or may not be what is desired! */
+ (screen_size_y * aspect_ratio) / PAGE_HEIGHT_INCHES, /* x dpi */
+ screen_size_y / PAGE_HEIGHT_INCHES /* y dpi */
+ )
};
-
/* Forward declarations */
static int herc_get_mode(void);
static void herc_set_mode(int);
@@ -94,7 +93,7 @@ static int herc_save_mode = -1;
int
herc_close(gx_device *dev)
{ if ( herc_save_mode >= 0 ) herc_set_mode(herc_save_mode);
- return 0;
+ return 0;
}
/* ------ Internal routines ------ */
@@ -103,21 +102,20 @@ herc_close(gx_device *dev)
static int
herc_get_mode(void)
{ registers regs;
- regs.h.ah = 0xf;
- int86(0x10, &regs, &regs);
- return regs.h.al;
+ regs.h.ah = 0xf;
+ int86(0x10, &regs, &regs);
+ return regs.h.al;
}
/* Set the device mode */
static void
herc_set_mode(int mode)
{ registers regs;
- regs.h.ah = 0;
- regs.h.al = mode;
- int86(0x10, &regs, &regs);
+ regs.h.ah = 0;
+ regs.h.al = mode;
+ int86(0x10, &regs, &regs);
}
-
/****************************************************************/
/* Hercules graphics card functions */
/* */
@@ -126,36 +124,34 @@ herc_set_mode(int mode)
/* --rewritten for MSC 5.1 on 02/18/91 by Phillip Conrad */
/****************************************************************/
-
static const char paramg[12] = {0x35, 0x2d, 0x2e, 0x07, 0x5b, 0x02,
- 0x57, 0x57, 0x02, 0x03, 0x00, 0x00};
+ 0x57, 0x57, 0x02, 0x03, 0x00, 0x00};
/* (Never used)
static const char paramt[12] = {0x61, 0x50, 0x52, 0x0f, 0x19, 0x06,
- 0x19, 0x19, 0x02, 0x0d, 0x0b, 0x0c};
+ 0x19, 0x19, 0x02, 0x0d, 0x0b, 0x0c};
*/
/* Type and macro for frame buffer pointers. */
/*** Intimately tied to the 80x86 (x<2) addressing architecture. ***/
-typedef byte far *fb_ptr;
+typedef byte far *fb_ptr;
# define mk_fb_ptr(x, y)\
(fb_ptr)((regen) + ((0x2000 * ((y) % 4) + (90 * ((y) >> 2))) + ((int)(x) >> 3)))
-
/* Structure for operation parameters. */
/* Note that this structure is known to assembly code. */
/* Not all parameters are used for every operation. */
typedef struct rop_params_s {
- fb_ptr dest; /* pointer to frame buffer */
- int draster; /* raster of frame buffer */
- const byte far *src; /* pointer to source data */
- int sraster; /* source raster */
- int width; /* width in bytes */
- int height; /* height in scan lines */
- int shift; /* amount to right shift source */
- int invert; /* 0 or -1 to invert source */
- int data; /* data for fill */
- int x_pos; /*>>added--2/24/91 */
- int y_pos;
+ fb_ptr dest; /* pointer to frame buffer */
+ int draster; /* raster of frame buffer */
+ const byte far *src; /* pointer to source data */
+ int sraster; /* source raster */
+ int width; /* width in bytes */
+ int height; /* height in scan lines */
+ int shift; /* amount to right shift source */
+ int invert; /* 0 or -1 to invert source */
+ int data; /* data for fill */
+ int x_pos; /*>>added--2/24/91 */
+ int y_pos;
} rop_params;
/* Define the device port and register numbers, and the regen map base */
@@ -168,27 +164,26 @@ typedef struct rop_params_s {
#define regen 0xa0000000L
#endif
-
/* Initialize the display for Hercules graphics mode */
int
herc_open(gx_device *dev)
{ int i;
- if ( herc_save_mode < 0 ) herc_save_mode = herc_get_mode();
+ if ( herc_save_mode < 0 ) herc_save_mode = herc_get_mode();
/* herc_set_mode(graphics_video_mode); */
- outportb(graph_config,3);
- for(i=0;i<sizeof(paramg);i++)
- {
- outport2(seq_addr,i,paramg[i]);
-
- }
- outportb(graph_mode,0x0a); /* set page 0 */
- for(i=0;i<0x3FFFL;i++) /* clear the screen */
- {
- int far *loc = (int far *)( regen +(2L*i));
- *loc = 0;
- }
-
- return 0;
+ outportb(graph_config,3);
+ for(i=0;i<sizeof(paramg);i++)
+ {
+ outport2(seq_addr,i,paramg[i]);
+
+ }
+ outportb(graph_mode,0x0a); /* set page 0 */
+ for(i=0;i<0x3FFFL;i++) /* clear the screen */
+ {
+ int far *loc = (int far *)( regen +(2L*i));
+ *loc = 0;
+ }
+
+ return 0;
}
/* Macro for testing bit-inclusion */
@@ -203,29 +198,29 @@ herc_copy_mono(gx_device *dev,
{ rop_params params;
#define czero (int)izero
#define cone (int)ione
- int dleft, sleft, count;
- int invert, zmask, omask;
- byte mask, rmask;
-
- if ( cone == czero ) /* vacuous case */
- return herc_fill_rectangle(dev, x, y, w, h, izero);
-
- /* clip */
- fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
- params.dest = mk_fb_ptr(x, y);
- params.draster = raster_x;
- params.src = base + (sourcex >> 3);
- params.sraster = raster;
- params.height = h;
- params.shift = (x - sourcex) & 7;
- params.y_pos = y;
- params.x_pos = x;
- params.width = w;
-
- if(czero > cone) params.invert = -1;
-
- /* Macros for writing partial bytes. */
- /* bits has already been inverted by xor'ing with invert. */
+ int dleft, sleft, count;
+ int invert, zmask, omask;
+ byte mask, rmask;
+
+ if ( cone == czero ) /* vacuous case */
+ return herc_fill_rectangle(dev, x, y, w, h, izero);
+
+ /* clip */
+ fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
+ params.dest = mk_fb_ptr(x, y);
+ params.draster = raster_x;
+ params.src = base + (sourcex >> 3);
+ params.sraster = raster;
+ params.height = h;
+ params.shift = (x - sourcex) & 7;
+ params.y_pos = y;
+ params.x_pos = x;
+ params.width = w;
+
+ if(czero > cone) params.invert = -1;
+
+ /* Macros for writing partial bytes. */
+ /* bits has already been inverted by xor'ing with invert. */
#define write_byte_masked(ptr, bits, mask)\
*ptr = ((bits | ~mask | zmask) & (*ptr | (bits & mask & omask)))
@@ -233,126 +228,126 @@ herc_copy_mono(gx_device *dev,
#define write_byte(ptr, bits)\
*ptr = ((bits | zmask) & (*ptr | (bits & omask)))
- invert = (czero == 1 || cone == 0 ? -1 : 0);
+ invert = (czero == 1 || cone == 0 ? -1 : 0);
/* invert = (czero == 1 || cone == 1 ? -1 : 0); */
- zmask = (czero == 0 || cone == 0 ? 0 : -1);
- omask = (czero == 1 || cone == 1 ? -1 : 0);
+ zmask = (czero == 0 || cone == 0 ? 0 : -1);
+ omask = (czero == 1 || cone == 1 ? -1 : 0);
#undef czero
#undef cone
- /* Actually copy the bits. */
-
- sleft = 8 - (sourcex & 7);
- dleft = 8 - (x & 7);
- mask = 0xff >> (8 - dleft);
- count = w;
- if ( w < dleft )
- mask -= mask >> w,
- rmask = 0;
- else
- rmask = 0xff00 >> ((w - dleft) & 7);
-
- if (sleft == dleft) /* optimize the aligned case */
- {
- w -= dleft;
- while ( --h >= 0 )
- {
- register const byte *bptr = params.src;
- register byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
- register int bits = *bptr ^ invert; /* first partial byte */
-
- count = w;
-
- write_byte_masked(optr, bits, mask);
-
- /* Do full bytes. */
-
- while ((count -= 8) >= 0)
- {
- bits = *++bptr ^ invert;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos,params.y_pos);
- write_byte(optr, bits);
- }
- /* Do last byte */
-
- if (count > -8)
- {
- bits = *++bptr ^ invert;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos,params.y_pos);
- write_byte_masked(optr, bits, rmask);
- }
+ /* Actually copy the bits. */
+
+ sleft = 8 - (sourcex & 7);
+ dleft = 8 - (x & 7);
+ mask = 0xff >> (8 - dleft);
+ count = w;
+ if ( w < dleft )
+ mask -= mask >> w,
+ rmask = 0;
+ else
+ rmask = 0xff00 >> ((w - dleft) & 7);
+
+ if (sleft == dleft) /* optimize the aligned case */
+ {
+ w -= dleft;
+ while ( --h >= 0 )
+ {
+ register const byte *bptr = params.src;
+ register byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ register int bits = *bptr ^ invert; /* first partial byte */
+
+ count = w;
+
+ write_byte_masked(optr, bits, mask);
+
+ /* Do full bytes. */
+
+ while ((count -= 8) >= 0)
+ {
+ bits = *++bptr ^ invert;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ write_byte(optr, bits);
+ }
+ /* Do last byte */
+
+ if (count > -8)
+ {
+ bits = *++bptr ^ invert;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ write_byte_masked(optr, bits, rmask);
+ }
/* dest += BPL; */
- params.y_pos++;
- params.x_pos = x;
- params.src += raster;
- }
- }
- else
- {
- int skew = (sleft - dleft) & 7;
- int cskew = 8 - skew;
-
- while (--h >= 0)
- {
- const byte *bptr = params.src;
- byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
- register int bits;
-
- count = w;
-
- /* Do the first partial byte */
-
- if (sleft >= dleft)
- {
- bits = *bptr >> skew;
- }
- else /* ( sleft < dleft ) */
- {
- bits = *bptr++ << cskew;
- if (count > sleft)
- bits += *bptr >> skew;
- }
- bits ^= invert;
- write_byte_masked(optr, bits, mask);
- count -= dleft;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos,params.y_pos);
-
- /* Do full bytes. */
-
- while ( count >= 8 )
- {
- bits = *bptr++ << cskew;
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte(optr, bits);
- count -= 8;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos,params.y_pos);
- }
-
- /* Do last byte */
-
- if (count > 0)
- {
- bits = *bptr++ << cskew;
- if (count > skew)
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte_masked(optr, bits, rmask);
- }
+ params.y_pos++;
+ params.x_pos = x;
+ params.src += raster;
+ }
+ }
+ else
+ {
+ int skew = (sleft - dleft) & 7;
+ int cskew = 8 - skew;
+
+ while (--h >= 0)
+ {
+ const byte *bptr = params.src;
+ byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ register int bits;
+
+ count = w;
+
+ /* Do the first partial byte */
+
+ if (sleft >= dleft)
+ {
+ bits = *bptr >> skew;
+ }
+ else /* ( sleft < dleft ) */
+ {
+ bits = *bptr++ << cskew;
+ if (count > sleft)
+ bits += *bptr >> skew;
+ }
+ bits ^= invert;
+ write_byte_masked(optr, bits, mask);
+ count -= dleft;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+
+ /* Do full bytes. */
+
+ while ( count >= 8 )
+ {
+ bits = *bptr++ << cskew;
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte(optr, bits);
+ count -= 8;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ }
+
+ /* Do last byte */
+
+ if (count > 0)
+ {
+ bits = *bptr++ << cskew;
+ if (count > skew)
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte_masked(optr, bits, rmask);
+ }
/* dest += BPL;
- line += raster;
+ line += raster;
*/
- params.y_pos++;
- params.x_pos = x;
- params.src += raster;
- }
- }
- return 0;
+ params.y_pos++;
+ params.x_pos = x;
+ params.src += raster;
+ }
+ }
+ return 0;
}
/* Copy a color pixelmap. This is just like a bitmap, */
@@ -361,7 +356,7 @@ herc_copy_color(gx_device *dev,
const byte *base, int sourcex, int raster, gx_bitmap_id id,
int x, int y, int w, int h)
{ return herc_copy_mono(dev, base, sourcex, raster, id,
- x, y, w, h,(gx_color_index)0, (gx_color_index)1);
+ x, y, w, h,(gx_color_index)0, (gx_color_index)1);
}
# define mk_fb_yptr(x, y)\
@@ -373,104 +368,104 @@ herc_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
gx_color_index color)
{ rop_params params;
- int x2, y2, xlen;
- byte led, red, d;
- byte far *ptr;
- int xloc;
-
- fit_fill(dev, x, y, w, h);
-
- params.dest = mk_fb_ptr(x, y);
- params.y_pos = y;
- params.x_pos = x;
-
- x2 = x + w - 1;
- y2 = y + h - 1;
-
- xlen = (x2 >> 3) - (x >> 3) - 1;
- led = 0xff >> (x & 7);
- red = 0xff << (7 - (x2 & 7));
-
- ptr = mk_fb_ptr(x,y);
-
- if (color)
- {
- /* here to set pixels */
-
- if (xlen == -1)
- {
- /* special for rectangles that fit in a byte */
-
- d = led & red;
- for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
- {
- *ptr |= d;
- params.y_pos++;
- }
- return 0;
- }
-
- /* normal fill */
-
- xloc = params.x_pos >> 3;
- for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
- { register int x_count = xlen;
- register byte far *p = ptr;
- *p |= led;
+ int x2, y2, xlen;
+ byte led, red, d;
+ byte far *ptr;
+ int xloc;
+
+ fit_fill(dev, x, y, w, h);
+
+ params.dest = mk_fb_ptr(x, y);
+ params.y_pos = y;
+ params.x_pos = x;
+
+ x2 = x + w - 1;
+ y2 = y + h - 1;
+
+ xlen = (x2 >> 3) - (x >> 3) - 1;
+ led = 0xff >> (x & 7);
+ red = 0xff << (7 - (x2 & 7));
+
+ ptr = mk_fb_ptr(x,y);
+
+ if (color)
+ {
+ /* here to set pixels */
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led & red;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ {
+ *ptr |= d;
+ params.y_pos++;
+ }
+ return 0;
+ }
+
+ /* normal fill */
+
+ xloc = params.x_pos >> 3;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ { register int x_count = xlen;
+ register byte far *p = ptr;
+ *p |= led;
/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc,params.y_pos);
- while ( x_count-- ) {
- *p = 0xff;
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ while ( x_count-- ) {
+ *p = 0xff;
/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc,params.y_pos);
- }
- *p |= red;
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ }
+ *p |= red;
/* params.x_pos = x; */
- xloc = params.x_pos >> 3;
- params.y_pos++;
- }
- }
-
- /* here to clear pixels */
-
- led = ~led;
- red = ~red;
-
- if (xlen == -1)
- {
- /* special for rectangles that fit in a byte */
-
- d = led | red;
- for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
- {
- *ptr &= d;
- params.y_pos++;
- }
- return 0;
- }
-
- /* normal fill */
-
- xloc = x >> 3;
- for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
- { register int x_count = xlen;
- register byte far *p = ptr;
- *p &= led;
+ xloc = params.x_pos >> 3;
+ params.y_pos++;
+ }
+ }
+
+ /* here to clear pixels */
+
+ led = ~led;
+ red = ~red;
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led | red;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ {
+ *ptr &= d;
+ params.y_pos++;
+ }
+ return 0;
+ }
+
+ /* normal fill */
+
+ xloc = x >> 3;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ { register int x_count = xlen;
+ register byte far *p = ptr;
+ *p &= led;
/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc,params.y_pos);
- while ( x_count-- ) {
- *p = 0x00;
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ while ( x_count-- ) {
+ *p = 0x00;
/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc,params.y_pos);
- }
- *p &= red;
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ }
+ *p &= red;
/* params.x_pos = x; */
- xloc = params.x_pos >> 3;
- params.y_pos++;
- }
- return 0;
+ xloc = params.x_pos >> 3;
+ params.y_pos++;
+ }
+ return 0;
}
diff --git a/gs/base/gdevhit.c b/gs/base/gdevhit.c
index 303bd0ebb..93b5c8cad 100644
--- a/gs/base/gdevhit.c
+++ b/gs/base/gdevhit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@ const int gs_hit_detected = gs_error_hit_detected;
static dev_proc_fill_rectangle(hit_fill_rectangle);
const gx_device gs_hit_device = {
std_device_std_body(gx_device, 0, "hit detector",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{NULL, /* open_device */
NULL, /* get_initial_matrix */
NULL, /* sync_output */
@@ -78,9 +78,9 @@ const gx_device gs_hit_device = {
/* Test for a hit when filling a rectangle. */
static int
hit_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
if (w > 0 && h > 0)
- return_error(gs_error_hit_detected);
+ return_error(gs_error_hit_detected);
return 0;
}
diff --git a/gs/base/gdevhl7x.c b/gs/base/gdevhl7x.c
index 3038c669e..ea3a92192 100644
--- a/gs/base/gdevhl7x.c
+++ b/gs/base/gdevhl7x.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,26 +56,26 @@
* real world.
%!
- newpath
- 0 0 moveto 144 72 lineto 72 144 lineto
- closepath fill stroke 0 0 moveto 144 144 lineto stroke
+ newpath
+ 0 0 moveto 144 72 lineto 72 144 lineto
+ closepath fill stroke 0 0 moveto 144 144 lineto stroke
- 595.27 841.88 moveto 451.27 769.88 lineto 523.27 697.88 lineto
- closepath fill stroke 595.27 841.88 moveto 451.27 697.88 lineto stroke
+ 595.27 841.88 moveto 451.27 769.88 lineto 523.27 697.88 lineto
+ closepath fill stroke 595.27 841.88 moveto 451.27 697.88 lineto stroke
- 0 841.88 moveto 144 769.88 lineto 72 697.88 lineto
- closepath fill stroke 0 841.88 moveto 144 697.88 lineto stroke
+ 0 841.88 moveto 144 769.88 lineto 72 697.88 lineto
+ closepath fill stroke 0 841.88 moveto 144 697.88 lineto stroke
- 595.27 0 moveto 451.27 72 lineto 523.27 144 lineto
- closepath fill stroke 595.27 0 moveto 451.27 144 lineto stroke
+ 595.27 0 moveto 451.27 72 lineto 523.27 144 lineto
+ closepath fill stroke 595.27 0 moveto 451.27 144 lineto stroke
- /Helvetica findfont
- 14 scalefont setfont
- 100 600 moveto
- (This is an A4 testpage. The arrows should point exactly to the) show
- 100 580 moveto
- (corners and the margins should match those given in gdev*.c) show
- showpage
+ /Helvetica findfont
+ 14 scalefont setfont
+ 100 600 moveto
+ (This is an A4 testpage. The arrows should point exactly to the) show
+ 100 580 moveto
+ (corners and the margins should match those given in gdev*.c) show
+ showpage
*/
@@ -89,8 +89,6 @@ typedef struct {
typedef unsigned char Byte; /* Rep. of elementary data unit */
-
-
/*
* Definition of a Helper structure to handle a list of commands
*/
@@ -101,14 +99,14 @@ typedef struct {
} ByteList;
-/*
+/*
* Type for representing a summary of the previous lines
*
*/
typedef struct {
short previousSize;
- Byte previousData[1500]; /* Size bigger than any possible line */
+ Byte previousData[1500]; /* Size bigger than any possible line */
short nbBlankLines;
short nbLinesSent;
short pageWidth;
@@ -117,8 +115,6 @@ typedef struct {
short resolution;
} Summary;
-
-
/* Constants */
/* We need a boolean : true , we got it from gdevprn.h */
@@ -128,33 +124,29 @@ static const int DumpFinished = 0;
static const int DumpContinue = 1;
static const int HL7X0_LENGTH = 5; /* Length of a command to tell the size of the data to be sent to the printer*/
static void makeCommandsForSequence(Byte * pSource,
- short length,
- ByteList * pCommandList,
- short offset,
- Byte * pCommandCount,
- short rest);
+ short length,
+ ByteList * pCommandList,
+ short offset,
+ Byte * pCommandCount,
+ short rest);
/* Auxiliary Functions */
-
-
static int dumpPage(gx_device_printer * pSource,
- Byte * pLineTmp,
- ByteList * pCommandList,
- Summary * pSummary
- );
+ Byte * pLineTmp,
+ ByteList * pCommandList,
+ Summary * pSummary
+ );
static void initSummary(Summary * s,short pw, short ph, short resolution);
static void resetPreviousData(Summary * s);
static void makeFullLine( Byte * pCurrentLine,
- Byte * pPreviousLine,
- short lineWidth,
- ByteList * commandsList,
- short horizontalOffset
- );
-
-
+ Byte * pPreviousLine,
+ short lineWidth,
+ ByteList * commandsList,
+ short horizontalOffset
+ );
/*
* Initialize a list of Bytes structure
@@ -173,11 +165,6 @@ static void dumpToPrinter(ByteList * list,FILE * printStream);
static int hl7x0_print_page(gx_device_printer *, FILE *, int, int, ByteList *);
-
-
-
-
-
/* Define the default, maximum resolutions. */
#ifdef X_DPI
# define X_DPI2 X_DPI
@@ -192,7 +179,6 @@ static int hl7x0_print_page(gx_device_printer *, FILE *, int, int, ByteList *);
# define Y_DPI2 600
#endif
-
#define LETTER_WIDTH 5100
#define LEFT_MARGIN 30
/* The following table is not actually used.... */
@@ -222,12 +208,10 @@ static const PaperFormat tableOfFormats[] = {
/* 21 L A4Long */ { 4783, 2480 }
};
-
/* Compute the maximum length of a compressed line */
static short MaxLineLength(short resolution){
return (((156 * resolution / 150 ) * 5 )/4) + 8;
-}
-
+}
/* Margins are left, bottom, right, top. */
/* Quotation from original gdevdjet.c */
@@ -239,14 +223,11 @@ return (((156 * resolution / 150 ) * 5 )/4) + 8;
* Somebody should check for letter sized paper. I left it at 0.07".
*/
-
/* The A4 margins are almost good */
/* The one for Letter are those of the gdevdjet.c file... */
#define HL7X0_MARGINS_A4 0.1, 0.15, 0.07, 0.05
#define HL7X0_MARGINS_LETTER 0.275, 0.20, 0.25, 0.07
-
-
/* We round up the LINE_SIZE to a multiple of a ulong for faster scanning. */
#define W sizeof(word)
@@ -255,55 +236,46 @@ return (((156 * resolution / 150 ) * 5 )/4) + 8;
#define HL720 0
#define HL730 0 /* No difference */
-
-
-
/* The device descriptors */
static dev_proc_open_device(hl7x0_open);
static dev_proc_close_device(hl7x0_close);
static dev_proc_print_page(hl720_print_page);
static dev_proc_print_page(hl730_print_page);
-
-
static const gx_device_procs prn_hl_procs =
prn_params_procs(hl7x0_open, gdev_prn_output_page, hl7x0_close,
- gdev_prn_get_params, gdev_prn_put_params);
-
+ gdev_prn_get_params, gdev_prn_put_params);
const gx_device_printer far_data gs_hl7x0_device =
prn_device(prn_hl_procs, "hl7x0",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins filled in by hl7x0_open */
- 1, hl720_print_page); /* The hl720 and hl730 can both use the same print method */
-
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins filled in by hl7x0_open */
+ 1, hl720_print_page); /* The hl720 and hl730 can both use the same print method */
/* Open the printer, adjusting the margins if necessary. */
-static int
+static int
hl7x0_open(gx_device *pdev)
{ /* Change the margins if necessary. */
- static const float m_a4[4] = { HL7X0_MARGINS_A4 };
- static const float m_letter[4] = { HL7X0_MARGINS_LETTER };
- const float *m =
- (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 : m_letter);
+ static const float m_a4[4] = { HL7X0_MARGINS_A4 };
+ static const float m_letter[4] = { HL7X0_MARGINS_LETTER };
+ const float *m =
+ (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 : m_letter);
- gx_device_set_margins(pdev, m, true);
- return gdev_prn_open(pdev);
+ gx_device_set_margins(pdev, m, true);
+ return gdev_prn_open(pdev);
}
-
/* The orders sent are those provided in the Brother DOS example */
-static int
+static int
hl7x0_close(gx_device *pdev)
{
gx_device_printer *const ppdev = (gx_device_printer *)pdev;
int code = gdev_prn_open_printer(pdev, 1);
if (code < 0)
- return code;
+ return code;
fputs("@N@N@N@N@X", ppdev->file) ;
return gdev_prn_close_printer(pdev);
}
@@ -314,27 +286,27 @@ hl7x0_close(gx_device *pdev)
static int
hl720_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- Byte prefix[] ={
+ Byte prefix[] ={
0x1B,'%','-','1','2','3','4','5','X'
,'@','P','J','L',0x0A /* set PJL mode */
,'@','P','J','L',' ','E','N','T','E','R',' '
,'L','A','N','G','U','A','G','E'
,' ','=',' ','H','B','P',0x0A /* set GDI Printer mode */
- ,'@','L', 0x0
+ ,'@','L', 0x0
};
- ByteList initCommand;
- int x_dpi = pdev->x_pixels_per_inch;
- initByteList(&initCommand,
- prefix, /* Array */
- sizeof(prefix), /* Total size */
- sizeof(prefix) - 1); /* Leave one byte free since*/
- /* we need to add the following order at the end */
- addByte(&initCommand, (Byte) ((((600/x_dpi) >> 1) \
- | (((600/x_dpi) >> 1) << 2))));
- /* Put the value of the used resolution into the init string */
-
- return hl7x0_print_page(pdev, prn_stream, HL720, 300,
- &initCommand);
+ ByteList initCommand;
+ int x_dpi = pdev->x_pixels_per_inch;
+ initByteList(&initCommand,
+ prefix, /* Array */
+ sizeof(prefix), /* Total size */
+ sizeof(prefix) - 1); /* Leave one byte free since*/
+ /* we need to add the following order at the end */
+ addByte(&initCommand, (Byte) ((((600/x_dpi) >> 1) \
+ | (((600/x_dpi) >> 1) << 2))));
+ /* Put the value of the used resolution into the init string */
+
+ return hl7x0_print_page(pdev, prn_stream, HL720, 300,
+ &initCommand);
}
/* The HL 730 can compress */
static int
@@ -344,11 +316,11 @@ hl730_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* Send the page to the printer. For speed, compress each scan line, */
/* since computer-to-printer communication time is often a bottleneck. */
-static int
+static int
hl7x0_print_page(gx_device_printer *pdev, FILE *printStream, int ptype,
int dots_per_inch, ByteList *initCommand)
{
- /* UTILE*/
+ /* UTILE*/
/* Command for a formFeed (we can't use strings because of the zeroes...)*/
Byte FormFeed[] = {'@','G',0x00,0x00,0x01,0xFF,'@','F'};
ByteList formFeedCommand;
@@ -358,59 +330,57 @@ hl7x0_print_page(gx_device_printer *pdev, FILE *printStream, int ptype,
/* int y_dpi = pdev->y_pixels_per_inch; */
int num_rows = dev_print_scan_lines(pdev);
int result;
- int sizeOfBuffer = MaxLineLength(x_dpi) + 30;
- Byte * storage = (Byte *) gs_malloc(pdev->memory,
- sizeOfBuffer + line_size,
- 1,
- "hl7x0_print_page");
- /* bool dup = pdev->Duplex; */
- /* bool dupset = pdev->Duplex_set >= 0; */
- Summary pageSummary;
- ByteList commandsBuffer;
- initSummary(&pageSummary,
- line_size,
- num_rows,
- x_dpi);
- if ( storage == 0 ) /* can't allocate working area */
- return_error(gs_error_VMerror);
- initByteList(&commandsBuffer, storage, sizeOfBuffer,0 );
- /* PLUS A MOI */
- if ( pdev->PageCount == 0 )
- {
- /* Put out init string before first page. */
- dumpToPrinter(initCommand, printStream); /* send init to printer */
-
- }
-
- do {
- result = dumpPage(pdev,
- storage + sizeOfBuffer, /* The line buffer is after the dump buffer */
- &commandsBuffer,
- &pageSummary);
- dumpToPrinter(&commandsBuffer,printStream);
-
- } while (result == DumpContinue);
-
-
- /* end raster graphics and eject page */
- initByteList(&formFeedCommand,
- FormFeed, /* Array */
- sizeof(FormFeed), /* Size in bytes */
- sizeof(FormFeed)); /* First free byte */
- dumpToPrinter(&formFeedCommand, printStream);
-
- /* free temporary storage */
- gs_free(pdev->memory, (char *)storage, storage_size_words, 1, "hl7X0_print_page");
-
- return 0; /* If we reach this line, it means there was no error */
+ int sizeOfBuffer = MaxLineLength(x_dpi) + 30;
+ Byte * storage = (Byte *) gs_malloc(pdev->memory,
+ sizeOfBuffer + line_size,
+ 1,
+ "hl7x0_print_page");
+ /* bool dup = pdev->Duplex; */
+ /* bool dupset = pdev->Duplex_set >= 0; */
+ Summary pageSummary;
+ ByteList commandsBuffer;
+ initSummary(&pageSummary,
+ line_size,
+ num_rows,
+ x_dpi);
+ if ( storage == 0 ) /* can't allocate working area */
+ return_error(gs_error_VMerror);
+ initByteList(&commandsBuffer, storage, sizeOfBuffer,0 );
+ /* PLUS A MOI */
+ if ( pdev->PageCount == 0 )
+ {
+ /* Put out init string before first page. */
+ dumpToPrinter(initCommand, printStream); /* send init to printer */
+
+ }
+
+ do {
+ result = dumpPage(pdev,
+ storage + sizeOfBuffer, /* The line buffer is after the dump buffer */
+ &commandsBuffer,
+ &pageSummary);
+ dumpToPrinter(&commandsBuffer,printStream);
+
+ } while (result == DumpContinue);
+
+ /* end raster graphics and eject page */
+ initByteList(&formFeedCommand,
+ FormFeed, /* Array */
+ sizeof(FormFeed), /* Size in bytes */
+ sizeof(FormFeed)); /* First free byte */
+ dumpToPrinter(&formFeedCommand, printStream);
+
+ /* free temporary storage */
+ gs_free(pdev->memory, (char *)storage, storage_size_words, 1, "hl7X0_print_page");
+
+ return 0; /* If we reach this line, it means there was no error */
}
/*
- * Useful auxiliary declarations
+ * Useful auxiliary declarations
*
*/
-
static short stripTrailingBlanks(Byte * line, short length){
short positionOfFirstZero = length - 1;
while (positionOfFirstZero > 0) {
@@ -426,7 +396,7 @@ static short stripTrailingBlanks(Byte * line, short length){
* Changed the horizontalOffset function 1/17/00 Ross Martin.
* ross@ross.interwrx.com or martin@walnut.eas.asu.edu
*
- * The equation used to muliply pixWidth by resolution/600
+ * The equation used to muliply pixWidth by resolution/600
* also. This didn't work right at resolution 300; it caused
* landscape pages produced by a2ps to be half off the
* page, when they were not at 600dpi or on other
@@ -435,17 +405,15 @@ static short stripTrailingBlanks(Byte * line, short length){
* and works correctly at 600dpi and 300dpi.
*/
static short horizontalOffset(short pixWidth,
- short pixOffset,
- short resolution){
-return (((LETTER_WIDTH * resolution/600 - pixWidth) + pixOffset * 2) + 7) / 8;
-
-}
-
+ short pixOffset,
+ short resolution){
+return (((LETTER_WIDTH * resolution/600 - pixWidth) + pixOffset * 2) + 7) / 8;
+}
/*
* First values in a Summary
- */
+ */
static void initSummary(Summary * s,short pw, short ph, short resolution){
s->previousSize = -1 ;
s->nbBlankLines = 1;
@@ -463,35 +431,34 @@ static void resetPreviousData(Summary * s){
memset(s->previousData,0,s->pageWidth);
}
-
/*
* dumpPage :
*
*/
static int dumpPage(gx_device_printer * pSource,
- Byte * pLineTmp,
- ByteList * pCommandList,
- Summary * pSummary
- ){
+ Byte * pLineTmp,
+ ByteList * pCommandList,
+ Summary * pSummary
+ ){
/* Declarations */
- Byte * pSaveCommandStart;
+ Byte * pSaveCommandStart;
short lineNB;
short usefulLength;
short tmpLength;
/* Initializations */
/* Make room for size of commands buffer */
- pSaveCommandStart = currentPosition(pCommandList);
+ pSaveCommandStart = currentPosition(pCommandList);
addNBytes(pCommandList,0,HL7X0_LENGTH);
/* pSource += pSummary->nbLinesSent * pSummary->pageWidth;*/
/* Process all possible Lines */
- for (lineNB = pSummary->nbLinesSent /*ERROR? + nbBlankLines */ ;
+ for (lineNB = pSummary->nbLinesSent /*ERROR? + nbBlankLines */ ;
lineNB < pSummary->pageHeight ; lineNB ++ ) {
/* Fetch the line and put it into the buffer */
gdev_prn_copy_scan_lines(pSource,
- lineNB,
- pLineTmp,
- pSummary->pageWidth);
+ lineNB,
+ pLineTmp,
+ pSummary->pageWidth);
usefulLength = stripTrailingBlanks(pLineTmp,pSummary->pageWidth);
if (usefulLength != 0) {
@@ -499,73 +466,73 @@ static int dumpPage(gx_device_printer * pSource,
/* The line is not blank */
/* Get rid of the precedent blank lines */
if (pSummary->nbBlankLines != 0) {
- if ( isThereEnoughRoom( pCommandList, pSummary->nbBlankLines ) ) {
+ if ( isThereEnoughRoom( pCommandList, pSummary->nbBlankLines ) ) {
- addNBytes(pCommandList,0xff,pSummary->nbBlankLines);
- pSummary->nbBlankLines = 0;
+ addNBytes(pCommandList,0xff,pSummary->nbBlankLines);
+ pSummary->nbBlankLines = 0;
- }
- else {
+ }
+ else {
- short availableRoom = roomLeft(pCommandList);
- addNBytes(pCommandList,0xff,availableRoom);
- pSummary->nbBlankLines -= availableRoom;
+ short availableRoom = roomLeft(pCommandList);
+ addNBytes(pCommandList,0xff,availableRoom);
+ pSummary->nbBlankLines -= availableRoom;
- break ; /* We have no more room */
+ break ; /* We have no more room */
- }
+ }
- resetPreviousData(pSummary); /* Make sure there are zeroes for the previous line */
- pSummary->previousSize = 0; /* The previous line was empty */
+ resetPreviousData(pSummary); /* Make sure there are zeroes for the previous line */
+ pSummary->previousSize = 0; /* The previous line was empty */
}
/* Deal with the current line */
if (!isThereEnoughRoom(pCommandList,MaxLineLength(pSummary->resolution))){
- break; /* We can process this line */
+ break; /* We can process this line */
}
if (pSummary->previousSize > usefulLength){
- tmpLength = pSummary->previousSize;
+ tmpLength = pSummary->previousSize;
}
else {
- tmpLength = usefulLength;
+ tmpLength = usefulLength;
}
if (pSummary->previousSize == -1 ) {/* This is the first line */
- Byte *save = currentPosition(pCommandList);
- addByte(pCommandList,0); /* One byte for the number of commands */
+ Byte *save = currentPosition(pCommandList);
+ addByte(pCommandList,0); /* One byte for the number of commands */
- makeCommandsForSequence(pLineTmp,
- tmpLength,
- pCommandList,
- pSummary->horizontalOffset,
- save,
- 0);
+ makeCommandsForSequence(pLineTmp,
+ tmpLength,
+ pCommandList,
+ pSummary->horizontalOffset,
+ save,
+ 0);
}
else { /*There is a previous line */
- makeFullLine(pLineTmp,
- pSummary->previousData,
- tmpLength,
- pCommandList,
- pSummary->horizontalOffset);
+ makeFullLine(pLineTmp,
+ pSummary->previousData,
+ tmpLength,
+ pCommandList,
+ pSummary->horizontalOffset);
}
/* The present line will soon be considered as "previous" */
pSummary->previousSize = tmpLength;
- /* Update the data representing the line will soon be the "previous line" */
+ /* Update the data representing the line will soon be the "previous line" */
memcpy(pSummary->previousData,pLineTmp,tmpLength);
}
- else { /* the current line is blank */
+ else { /* the current line is blank */
pSummary->nbBlankLines++;
}
/* And one more line */
- pSummary->nbLinesSent ++;
+ pSummary->nbLinesSent ++;
}
-
+
if (pCommandList->current > HL7X0_LENGTH){
short size = pCommandList->current - HL7X0_LENGTH;
*(pSaveCommandStart++) = '@';
@@ -584,24 +551,21 @@ static int dumpPage(gx_device_printer * pSource,
return DumpContinue;
}
}
-
/*
- * makeFullLine :
+ * makeFullLine :
* process an arbitrary line for which a former line is available
- * The line will be split in sequences that are different from the
+ * The line will be split in sequences that are different from the
* corresponding ones of the previous line. These sequences will be processed
* by makeCommandsOfSequence.
*/
-
-
static void makeFullLine( Byte * pCurrentLine,
- Byte * pPreviousLine,
- short lineWidth,
- ByteList * commandsList,
- short horizontalOffset
- ){
+ Byte * pPreviousLine,
+ short lineWidth,
+ ByteList * commandsList,
+ short horizontalOffset
+ ){
/* Declarations */
Byte *pPreviousTmp;
Byte *pCurrentTmp;
@@ -622,18 +586,18 @@ static void makeFullLine( Byte * pCurrentLine,
/*******************/
/* Initializations */
/*******************/
-
+
pNumberOfCommands = currentPosition(commandsList); /* Keep a pointer to the number of commands */
addByte(commandsList,0); /* At the moment there are 0 commands */
-
+
pPreviousTmp = pPreviousLine;
- pCurrentTmp = pCurrentLine;
+ pCurrentTmp = pCurrentLine;
/* Build vector of differences with a Xor */
for (loopCounter = lineWidth ; 0 < loopCounter ; loopCounter -- )
*pPreviousTmp++ ^= *pCurrentTmp++;
-
+
/* Find sequences that are different from the corresponding (i.e. vertically aligned)
* one of the previous line. Make commands for them.
*/
@@ -672,22 +636,22 @@ static void makeFullLine( Byte * pCurrentLine,
/* Count and skip bytes that are not "new" */
while (true) {
if (remainingWidth == 0) /* There is nothing left to do */
- {
- return;
- }
+ {
+ return;
+ }
if (*pStartOfSequence != 0)
- break;
+ break;
pStartOfSequence ++;
horizontalOffset ++; /* the offset takes count of the bytes that are not "new" */
--remainingWidth;
}
#endif
-
+
pPreviousTmp = pStartOfSequence + 1; /* The sequence contains at least this byte */
- --remainingWidth;
-
+ --remainingWidth;
+
/* Find the end of the sequence of "new" bytes */
-
+
#ifdef USE_POSSIBLY_FLAWED_COMPRESSION
while (remainingWidth != 0 && *pPreviousTmp != 0) {
++pPreviousTmp; /* Enlarge the sequence Of new bytes */
@@ -699,14 +663,14 @@ static void makeFullLine( Byte * pCurrentLine,
#endif
makeCommandsForSequence(pCurrentLine + (pStartOfSequence - pPreviousLine),
- pPreviousTmp - pStartOfSequence,
- commandsList,
- horizontalOffset,
- pNumberOfCommands,
- remainingWidth);
+ pPreviousTmp - pStartOfSequence,
+ commandsList,
+ horizontalOffset,
+ pNumberOfCommands,
+ remainingWidth);
if (*pNumberOfCommands == 0xfe /* If the number of commands has reached the maximum value */
- || /* or */
- remainingWidth == 0 ) /* There is nothing left to process */
+ || /* or */
+ remainingWidth == 0 ) /* There is nothing left to process */
{
return;
}
@@ -715,29 +679,23 @@ static void makeFullLine( Byte * pCurrentLine,
horizontalOffset = 1;
--remainingWidth;
} /* End of While */
-
-
-
} /* End of makeFullLine */
-
-
-/*
- * Declarations of functions that are defined further in the file
+/*
+ * Declarations of functions that are defined further in the file
*/
static void makeSequenceWithoutRepeat(
- Byte * pSequence,
- short lengthOfSequence,
- ByteList * pCommandList,
- short offset );
+ Byte * pSequence,
+ short lengthOfSequence,
+ ByteList * pCommandList,
+ short offset );
static void makeSequenceWithRepeat(
- Byte * pSequence,
- short lengthOfSequence,
- ByteList * pCommandList,
- short offset );
-
+ Byte * pSequence,
+ short lengthOfSequence,
+ ByteList * pCommandList,
+ short offset );
/*
* makeCommandsForSequence :
@@ -745,11 +703,11 @@ static void makeSequenceWithRepeat(
*/
static void makeCommandsForSequence(Byte * pSource,
- short length,
- ByteList * pCommandList,
- short offset,
- Byte * pNumberOfCommands,
- short rest) {
+ short length,
+ ByteList * pCommandList,
+ short offset,
+ Byte * pNumberOfCommands,
+ short rest) {
/* Declarations */
Byte * pStartOfSequence;
Byte * pEndOfSequence;
@@ -757,38 +715,38 @@ static void makeCommandsForSequence(Byte * pSource,
pStartOfSequence = pSource;
pEndOfSequence = pStartOfSequence + 1;
- /*
- * Process the whole "new" Sequence that is divided into
+ /*
+ * Process the whole "new" Sequence that is divided into
* repetitive and non-repetitive sequences.
- */
+ */
while (true) {
-
- /* If we have already stored too many commands, make one last command with
- * everything that is left in the line and return.
+
+ /* If we have already stored too many commands, make one last command with
+ * everything that is left in the line and return.
*/
if (*pNumberOfCommands == 0xfd) {
makeSequenceWithoutRepeat(pStartOfSequence,
- 1 + remainingLength + rest,
- pCommandList,
- offset);
+ 1 + remainingLength + rest,
+ pCommandList,
+ offset);
++*pNumberOfCommands;
return;
}
-
+
/* Start with a sub-sequence without byte-repetition */
while (true) {
- /* If we have completed the last subsequence */
+ /* If we have completed the last subsequence */
if (remainingLength == 0) {
- makeSequenceWithoutRepeat(pStartOfSequence,
- pEndOfSequence - pStartOfSequence,
- pCommandList,
- offset);
- ++*pNumberOfCommands;
- return;
+ makeSequenceWithoutRepeat(pStartOfSequence,
+ pEndOfSequence - pStartOfSequence,
+ pCommandList,
+ offset);
+ ++*pNumberOfCommands;
+ return;
}
/* If we have discovered a repetition */
if (*pEndOfSequence == *(pEndOfSequence - 1)) {
- break;
+ break;
}
++ pEndOfSequence; /* The subsequence is bigger*/
--remainingLength;
@@ -796,84 +754,77 @@ static void makeCommandsForSequence(Byte * pSource,
/* If this is a sequence without repetition */
if (pStartOfSequence != pEndOfSequence - 1) {
makeSequenceWithoutRepeat(pStartOfSequence,
- (pEndOfSequence - 1) - pStartOfSequence,
- pCommandList,
- offset);
+ (pEndOfSequence - 1) - pStartOfSequence,
+ pCommandList,
+ offset);
++*pNumberOfCommands;
offset = 0;
pStartOfSequence = pEndOfSequence - 1;
-
+
/* If we have too many commands */
if (*pNumberOfCommands == 0xfd) {
- makeSequenceWithoutRepeat(pStartOfSequence,
- 1 + remainingLength + rest,
- pCommandList,
- offset);
- ++*pNumberOfCommands;
- return;
+ makeSequenceWithoutRepeat(pStartOfSequence,
+ 1 + remainingLength + rest,
+ pCommandList,
+ offset);
+ ++*pNumberOfCommands;
+ return;
}
} /* End If */
-
- /*
- * Process a subsequence that repeats the same byte
+
+ /*
+ * Process a subsequence that repeats the same byte
*/
while (true) {
/* If there is nothing left to process */
if (remainingLength == 0) {
- makeSequenceWithRepeat(pStartOfSequence,
- pEndOfSequence - pStartOfSequence,
- pCommandList,
- offset);
- ++*pNumberOfCommands;
- return;
+ makeSequenceWithRepeat(pStartOfSequence,
+ pEndOfSequence - pStartOfSequence,
+ pCommandList,
+ offset);
+ ++*pNumberOfCommands;
+ return;
}
/* If we find a different byte */
if (*pEndOfSequence != *pStartOfSequence){
- break;
+ break;
}
++pEndOfSequence; /* The subsequence is yet bigger */
--remainingLength;
} /* End of While */
makeSequenceWithRepeat(pStartOfSequence,
- pEndOfSequence - pStartOfSequence,
- pCommandList,
- offset);
+ pEndOfSequence - pStartOfSequence,
+ pCommandList,
+ offset);
++*pNumberOfCommands;
offset = 0; /* The relative offset between two subsequences is 0 */
pStartOfSequence = pEndOfSequence ++ ; /* we loop again from the end of this subsequence */
--remainingLength;
-
- } /* End of While */
-
-} /* End makeCommandsForSequence */
-
-
-
-
-
+ } /* End of While */
+} /* End makeCommandsForSequence */
/*
* makeSequenceWithoutRepeat
*/
static void makeSequenceWithoutRepeat(
- Byte * pSequence,
- short lengthOfSequence,
- ByteList * pCommandList,
- short offset ){
+ Byte * pSequence,
+ short lengthOfSequence,
+ ByteList * pCommandList,
+ short offset ){
/*
- * Constant definitions
+ * Constant definitions
*/
static const short MAX_OFFSET = 15;
static const short POSITION_OF_OFFSET = 3;
static const short MAX_LENGTH = 7;
-
+
Byte tmpFirstByte = 0;
Byte * pSaveFirstByte;
short reducedLength = lengthOfSequence - 1; /* Length is alway higher than 1
- Therefore a reduced value is stored
- */
+ Therefore a reduced value is stored
+ */
/* Initialization */
pSaveFirstByte = currentPosition(pCommandList);
@@ -895,7 +846,7 @@ static void makeSequenceWithoutRepeat(
else
tmpFirstByte |= reducedLength ;
/* Add a copy of the source sequence */
-
+
addArray(pCommandList, pSequence, lengthOfSequence);
/* Store the computed value of the first byte */
@@ -905,28 +856,26 @@ static void makeSequenceWithoutRepeat(
return ;
} /* End of makeSequenceWithoutRepeat */
-
-
/*
* makeSequenceWithRepeat
*/
static void makeSequenceWithRepeat(
- Byte * pSequence,
- short lengthOfSequence,
- ByteList * pCommandList,
- short offset ){
+ Byte * pSequence,
+ short lengthOfSequence,
+ ByteList * pCommandList,
+ short offset ){
/*
- * Constant definitions
+ * Constant definitions
*/
static const short MAX_OFFSET = 3;
static const short POSITION_OF_OFFSET = 5;
static const short MAX_LENGTH = 31;
-
- Byte tmpFirstByte = 0x80;
+
+ Byte tmpFirstByte = 0x80;
Byte * pSaveFirstByte;
short reducedLength = lengthOfSequence - 2; /* Length is always higher than 2
- Therefore a reduced value is stored
- */
+ Therefore a reduced value is stored
+ */
/* Initialization */
pSaveFirstByte = currentPosition(pCommandList);
@@ -948,7 +897,7 @@ static void makeSequenceWithRepeat(
else
tmpFirstByte |= reducedLength ;
/* Add a copy the byte that is repeated throughout the sequence */
-
+
addByte(pCommandList, *pSequence );
/* Store the computed value of the first byte */
@@ -958,9 +907,6 @@ static void makeSequenceWithRepeat(
return ;
} /* End of makeSequenceWithRepeat*/
-
-
-
/*
* Initialize a list of Bytes structure
*/
@@ -980,7 +926,6 @@ static void addByte(ByteList *list,Byte value ) {
errprintf_nomem("Could not add byte to command\n");
}
-
/*
* Add a copy of an array to a list of Bytes
*/
@@ -991,12 +936,11 @@ static void addArray(ByteList *list, Byte *source, short nb){
memcpy(list->data + list->current, source , (size_t) nb);
list->current += nb;
}
- else
+ else
errprintf_nomem("Could not add byte array to command\n");
}
-
-/*
+/*
* Add N bytes to a list of Bytes
*/
@@ -1006,11 +950,11 @@ static void addNBytes(ByteList * list, Byte value, short nb){
{
for (i = list->current ; i < (list->current + nb) ; i++)
{
- list->data[i] = value;
+ list->data[i] = value;
}
list->current += nb;
}
- else
+ else
errprintf_nomem("Could not add %d bytes to command\n",nb);
}
@@ -1031,7 +975,7 @@ static Byte * currentPosition(ByteList * list) {
static void addCodedNumber(ByteList * list, short number){
short q = number / 0xff;
short r = number % 0xff;
-
+
addNBytes(list, 0xff, q);
addByte(list,r);
@@ -1046,7 +990,7 @@ static int isThereEnoughRoom(ByteList * list, short biggest){
return ((list->maxSize-list->current) >= biggest);
}
/*
- * Tell how much room is left
+ * Tell how much room is left
*/
static short roomLeft(ByteList * list){
return list->maxSize - list->current;
diff --git a/gs/base/gdevifno.c b/gs/base/gdevifno.c
index 9d206abda..12d45ab4d 100644
--- a/gs/base/gdevifno.c
+++ b/gs/base/gdevifno.c
@@ -37,13 +37,13 @@ typedef struct Rectangle Rectangle;
typedef struct Point Point;
struct Point {
- int x;
- int y;
+ int x;
+ int y;
};
struct Rectangle {
- Point min;
- Point max;
+ Point min;
+ Point max;
};
static const Point ZP = { 0, 0 };
@@ -65,14 +65,14 @@ static dev_proc_close_device(inferno_close);
static dev_proc_print_page(inferno_print_page);
typedef struct inferno_device_s {
- gx_device_common;
- gx_prn_device_common;
- int ldepth;
- int lastldepth;
- int color, gray;
- int cmapcall;
- int nbits;
- ulong *p9color; /* index blue most sig, red least sig */
+ gx_device_common;
+ gx_prn_device_common;
+ int ldepth;
+ int lastldepth;
+ int color, gray;
+ int cmapcall;
+ int nbits;
+ ulong *p9color; /* index blue most sig, red least sig */
} inferno_device;
/* structure descriptor for the garbage collector */
@@ -83,24 +83,23 @@ gs_private_st_suffix_add1_final(st_inferno_device, inferno_device,
gx_device_finalize, st_device_printer, p9color);
static const gx_device_procs inferno_procs =
- prn_color_params_procs(inferno_open, gdev_prn_output_page, inferno_close,
- inferno_rgb2cmap, inferno_cmap2rgb,
- gdev_prn_get_params, gdev_prn_put_params);
-
+ prn_color_params_procs(inferno_open, gdev_prn_output_page, inferno_close,
+ inferno_rgb2cmap, inferno_cmap2rgb,
+ gdev_prn_get_params, gdev_prn_put_params);
inferno_device far_data gs_inferno_device =
{ prn_device_stype_body(inferno_device, inferno_procs, "inferno",
- &st_inferno_device,
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0,0,0,0, /* margins */
- 3, /* 3 = RGB, 1 = gray, 4 = CMYK */
- 16, /* # of bits per pixel -- 16 is easier to handle than 12 */
- 255, /* # of distinct gray levels. >=31 to fool gs into asking us*/
- 255, /* # of distinct color levels. >= 31 to fool gs */
- 0, /* dither gray ramp size. hopefully not used */
- 0, /* dither color ramp size. hopefully not used */
- inferno_print_page)
+ &st_inferno_device,
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 3, /* 3 = RGB, 1 = gray, 4 = CMYK */
+ 16, /* # of bits per pixel -- 16 is easier to handle than 12 */
+ 255, /* # of distinct gray levels. >=31 to fool gs into asking us*/
+ 255, /* # of distinct color levels. >= 31 to fool gs */
+ 0, /* dither gray ramp size. hopefully not used */
+ 0, /* dither color ramp size. hopefully not used */
+ inferno_print_page)
};
/*
@@ -109,80 +108,80 @@ inferno_device far_data gs_inferno_device =
*/
static gx_color_index
inferno_rgb2cmap(gx_device *dev, const gx_color_value cv[]) {
- int shift;
- inferno_device *bdev = (inferno_device*) dev;
- int nbits = bdev->nbits;
- int mask = (1<<nbits)-1;
- gx_color_value red, green, blue;
-
- red = cv[0]; green = cv[1]; blue = cv[2];
- /* make the colors the size we want */
- if(gx_color_value_bits > nbits) {
- shift = gx_color_value_bits - nbits;
- red >>= shift;
- green >>= shift;
- blue >>= shift;
- } else if(gx_color_value_bits < nbits) {
- shift = nbits - gx_color_value_bits;
- red <<= shift;
- green <<= shift;
- blue <<= shift;
- }
-
- /* mask them off to be just nbits */
- red &= mask;
- green &= mask;
- blue &= mask;
-
- /*
- * we keep track of what ldepth bitmap this is by watching
- * what colors gs asks for.
- *
- * one catch: sometimes print_page gets called more than one
- * per page (for multiple copies) without cmap calls inbetween.
- * if bdev->cmapcall is 0 when print_page gets called, it uses
- * the ldepth of the last page.
- */
- if(red == green && green == blue && red != 0 && red != mask) {
- if(red == 5 || red == 10) {
- if(bdev->ldepth < 1)
- bdev->ldepth = 1;
- } else {
- if(bdev->ldepth < 2)
- bdev->ldepth = 2;
- }
- } else
- bdev->ldepth = 3;
-
- bdev->cmapcall = 1;
- return ((((blue<<4)|green)<<4)|red);
+ int shift;
+ inferno_device *bdev = (inferno_device*) dev;
+ int nbits = bdev->nbits;
+ int mask = (1<<nbits)-1;
+ gx_color_value red, green, blue;
+
+ red = cv[0]; green = cv[1]; blue = cv[2];
+ /* make the colors the size we want */
+ if(gx_color_value_bits > nbits) {
+ shift = gx_color_value_bits - nbits;
+ red >>= shift;
+ green >>= shift;
+ blue >>= shift;
+ } else if(gx_color_value_bits < nbits) {
+ shift = nbits - gx_color_value_bits;
+ red <<= shift;
+ green <<= shift;
+ blue <<= shift;
+ }
+
+ /* mask them off to be just nbits */
+ red &= mask;
+ green &= mask;
+ blue &= mask;
+
+ /*
+ * we keep track of what ldepth bitmap this is by watching
+ * what colors gs asks for.
+ *
+ * one catch: sometimes print_page gets called more than one
+ * per page (for multiple copies) without cmap calls inbetween.
+ * if bdev->cmapcall is 0 when print_page gets called, it uses
+ * the ldepth of the last page.
+ */
+ if(red == green && green == blue && red != 0 && red != mask) {
+ if(red == 5 || red == 10) {
+ if(bdev->ldepth < 1)
+ bdev->ldepth = 1;
+ } else {
+ if(bdev->ldepth < 2)
+ bdev->ldepth = 2;
+ }
+ } else
+ bdev->ldepth = 3;
+
+ bdev->cmapcall = 1;
+ return ((((blue<<4)|green)<<4)|red);
}
static int
inferno_cmap2rgb(gx_device *dev, gx_color_index color,
gx_color_value rgb[3]) {
- int shift, i;
- inferno_device *bdev = (inferno_device*) dev;
- int nbits = bdev->nbits;
- int mask = (1<<nbits)-1;
-
- if(color < 0 || color > 255)
- return_error(gs_error_rangecheck);
-
- rgb[2] = (color >> (2*nbits)) & mask;
- rgb[1] = (color >> nbits) & mask;
- rgb[0] = color & mask;
- if(gx_color_value_bits > nbits) {
- shift = gx_color_value_bits - nbits;
- for(i=0; i<3; i++)
- rgb[i] <<= shift;
- } else if(gx_color_value_bits < nbits) {
- shift = nbits - gx_color_value_bits;
- for(i=0; i<3; i++)
- rgb[i] >>= shift;
- }
-
- return 0;
+ int shift, i;
+ inferno_device *bdev = (inferno_device*) dev;
+ int nbits = bdev->nbits;
+ int mask = (1<<nbits)-1;
+
+ if(color < 0 || color > 255)
+ return_error(gs_error_rangecheck);
+
+ rgb[2] = (color >> (2*nbits)) & mask;
+ rgb[1] = (color >> nbits) & mask;
+ rgb[0] = color & mask;
+ if(gx_color_value_bits > nbits) {
+ shift = gx_color_value_bits - nbits;
+ for(i=0; i<3; i++)
+ rgb[i] <<= shift;
+ } else if(gx_color_value_bits < nbits) {
+ shift = nbits - gx_color_value_bits;
+ for(i=0; i<3; i++)
+ rgb[i] >>= shift;
+ }
+
+ return 0;
}
/*
@@ -202,31 +201,30 @@ inferno_cmap2rgb(gx_device *dev, gx_color_index color,
void init_p9color(ulong *p9color) /* init at run time since p9color[] is so big */
{
- int r, g, b, o;
- ulong* cur = p9color;
- for (b=0; b<16; b++) {
- for (g=0; g<16; g++) {
- int m0 = (b>g) ? b : g;
- for (r=0; r<16; r++) {
- int V, M, rM, gM, bM, m;
- int m1 = (r>m0) ? r : m0;
- V=m1&3; M=(m1-V)<<1;
- if (m1==0) m1=1;
- m = m1 << 3;
- rM=r*M; gM=g*M; bM=b*M;
- *cur = 0;
- for (o=7*m1; o>0; o-=2*m1) {
- int rr=(rM+o)/m, gg=(gM+o)/m, bb=(bM+o)/m;
- int ij = (rr<<6) + (V<<4) + ((V-rr+(gg<<2)+bb)&15);
- *cur = (*cur << 8) + 255-ij;
- }
- cur++;
- }
- }
- }
+ int r, g, b, o;
+ ulong* cur = p9color;
+ for (b=0; b<16; b++) {
+ for (g=0; g<16; g++) {
+ int m0 = (b>g) ? b : g;
+ for (r=0; r<16; r++) {
+ int V, M, rM, gM, bM, m;
+ int m1 = (r>m0) ? r : m0;
+ V=m1&3; M=(m1-V)<<1;
+ if (m1==0) m1=1;
+ m = m1 << 3;
+ rM=r*M; gM=g*M; bM=b*M;
+ *cur = 0;
+ for (o=7*m1; o>0; o-=2*m1) {
+ int rr=(rM+o)/m, gg=(gM+o)/m, bb=(bM+o)/m;
+ int ij = (rr<<6) + (V<<4) + ((V-rr+(gg<<2)+bb)&15);
+ *cur = (*cur << 8) + 255-ij;
+ }
+ cur++;
+ }
+ }
+ }
}
-
/*
* inferno_open() is supposed to initialize the device.
* there's not much to do.
@@ -234,17 +232,17 @@ void init_p9color(ulong *p9color) /* init at run time since p9color[] is so big
static int
inferno_open(gx_device *dev)
{
- inferno_device *bdev = (inferno_device*) dev;
- bdev->color = bdev->gray = 0;
- bdev->cmapcall = 0;
- bdev->ldepth = 3;
- bdev->nbits = 4; /* 4 bits per color per pixel (12 bpp, then we dither) */
- /* if you change this, change the entry in gs_inferno_device */
- bdev->p9color = (ulong *)gs_alloc_bytes(bdev->memory, p9color_size, "plan 9 colour cube");
- if (bdev->p9color == NULL)
- return_error(gs_error_VMerror);
- init_p9color(bdev->p9color);
- return gdev_prn_open(dev);
+ inferno_device *bdev = (inferno_device*) dev;
+ bdev->color = bdev->gray = 0;
+ bdev->cmapcall = 0;
+ bdev->ldepth = 3;
+ bdev->nbits = 4; /* 4 bits per color per pixel (12 bpp, then we dither) */
+ /* if you change this, change the entry in gs_inferno_device */
+ bdev->p9color = (ulong *)gs_alloc_bytes(bdev->memory, p9color_size, "plan 9 colour cube");
+ if (bdev->p9color == NULL)
+ return_error(gs_error_VMerror);
+ init_p9color(bdev->p9color);
+ return gdev_prn_open(dev);
}
/*
@@ -254,15 +252,15 @@ inferno_open(gx_device *dev)
static int
inferno_close(gx_device *dev)
{
- inferno_device *bdev = (inferno_device*) dev;
- int code;
+ inferno_device *bdev = (inferno_device*) dev;
+ int code;
- gs_free_object(dev->memory, bdev->p9color, "plan 9 colour cube");
+ gs_free_object(dev->memory, bdev->p9color, "plan 9 colour cube");
- code = gdev_prn_close(dev);
- if(code < 0)
- return_error(code);
- return 0;
+ code = gdev_prn_close(dev);
+ if(code < 0)
+ return_error(code);
+ return 0;
}
/*
@@ -273,111 +271,111 @@ inferno_close(gx_device *dev)
static int
inferno_print_page(gx_device_printer *pdev, FILE *f)
{
- uchar *buf;
- uchar *p;
- WImage *w;
- int bpl, y;
- int x, xmod;
- int ldepth;
- int ppb[] = {8, 4, 2, 1}; /* pixels per byte */
- int bpp[] = {1, 2, 4, 8}; /* bits per pixel */
- int gsbpl;
- ulong u;
- ushort us;
-
- inferno_device *bdev = (inferno_device *) pdev;
- Rectangle r;
-
- gsbpl = gdev_prn_raster(pdev);
- if(gsbpl > 16384) { /* == 8192 dots across */
- errprintf(pdev->memory, "bitmap far too wide for inferno\n");
- return_error(gs_error_Fatal);
- }
-
- if(bdev->cmapcall) {
- bdev->lastldepth = bdev->ldepth;
- bdev->ldepth = 0;
- bdev->cmapcall = 0;
- }
- ldepth = bdev->lastldepth;
-
- r.min = ZP;
- r.max.x = pdev->width;
- r.max.y = pdev->height;
- bpl = bytesperline(r, ldepth);
- w = initwriteimage(f, r, ldepth, bdev->memory);
- if(w == nil) {
- errprintf(pdev->memory, "initwriteimage failed\n");
- return_error(gs_error_Fatal);
- }
-
- buf = gs_alloc_bytes(bdev->memory, gsbpl, "inferno line buffer");
- if(buf == NULL) {
- errprintf(pdev->memory, "couldn't allocate line buffer\n");
- return_error(gs_error_VMerror);
- }
-
- /*
- * i wonder if it is faster to put the switch around the for loops
- * to save all the ldepth lookups.
- */
- for(y=0; y<pdev->height; y++) {
- gdev_prn_get_bits(pdev, y, buf, &p);
- for(x=0; x<pdev->width; x++) {
- us = (p[2*x]<<8) | p[2*x+1];
- switch(ldepth) {
- case 3:
- if(0){
- int r, g, b;
- r = us & 0xf;
- g = (us>>4)&0xf;
- b = (us>>8)&0xf;
- r<<=4;
- g<<=4;
- b<<=4;
- p[x] = rgb2cmap(r,g,b);
- }
- if(1){
- u = bdev->p9color[us];
- /* the ulong in p9color is a 2x2 matrix. pull the entry
- * u[x%2][y%2], more or less.
- */
- p[x] = u >> (8*((y%2)+2*(x%2)));
- }
- break;
- case 2:
- us = ~us;
- if((x%2) == 0)
- p[x/2] = us & 0xf;
- else
- p[x/2] = (p[x/2]<<4)|(us&0xf);
- break;
- case 0:
- us = ~us;
- if((x%8) == 0)
- p[x/8] = us & 0x1;
- else
- p[x/8] = (p[x/8]<<1)|(us&0x1);
- break;
- }
- }
-
- /* pad last byte over if we didn't fill it */
- xmod = pdev->width % ppb[ldepth];
- if(xmod)
- p[(x-1)/ppb[ldepth]] <<= ((ppb[ldepth]-xmod)*bpp[ldepth]);
- if(writeimageblock(w, p, bpl, bdev->memory) == ERROR) {
- gs_free_object(bdev->memory, buf, "inferno line buffer");
- /* w leaks here */
- return_error(gs_error_Fatal);
- }
- }
- gs_free_object(bdev->memory, buf, "inferno line buffer");
- if(writeimageblock(w, nil, 0, bdev->memory) == ERROR) {
- return_error(gs_error_Fatal);
- }
-
- return 0;
+ uchar *buf;
+ uchar *p;
+ WImage *w;
+ int bpl, y;
+ int x, xmod;
+ int ldepth;
+ int ppb[] = {8, 4, 2, 1}; /* pixels per byte */
+ int bpp[] = {1, 2, 4, 8}; /* bits per pixel */
+ int gsbpl;
+ ulong u;
+ ushort us;
+
+ inferno_device *bdev = (inferno_device *) pdev;
+ Rectangle r;
+
+ gsbpl = gdev_prn_raster(pdev);
+ if(gsbpl > 16384) { /* == 8192 dots across */
+ errprintf(pdev->memory, "bitmap far too wide for inferno\n");
+ return_error(gs_error_Fatal);
+ }
+
+ if(bdev->cmapcall) {
+ bdev->lastldepth = bdev->ldepth;
+ bdev->ldepth = 0;
+ bdev->cmapcall = 0;
+ }
+ ldepth = bdev->lastldepth;
+
+ r.min = ZP;
+ r.max.x = pdev->width;
+ r.max.y = pdev->height;
+ bpl = bytesperline(r, ldepth);
+ w = initwriteimage(f, r, ldepth, bdev->memory);
+ if(w == nil) {
+ errprintf(pdev->memory, "initwriteimage failed\n");
+ return_error(gs_error_Fatal);
+ }
+
+ buf = gs_alloc_bytes(bdev->memory, gsbpl, "inferno line buffer");
+ if(buf == NULL) {
+ errprintf(pdev->memory, "couldn't allocate line buffer\n");
+ return_error(gs_error_VMerror);
+ }
+
+ /*
+ * i wonder if it is faster to put the switch around the for loops
+ * to save all the ldepth lookups.
+ */
+ for(y=0; y<pdev->height; y++) {
+ gdev_prn_get_bits(pdev, y, buf, &p);
+ for(x=0; x<pdev->width; x++) {
+ us = (p[2*x]<<8) | p[2*x+1];
+ switch(ldepth) {
+ case 3:
+ if(0){
+ int r, g, b;
+ r = us & 0xf;
+ g = (us>>4)&0xf;
+ b = (us>>8)&0xf;
+ r<<=4;
+ g<<=4;
+ b<<=4;
+ p[x] = rgb2cmap(r,g,b);
+ }
+ if(1){
+ u = bdev->p9color[us];
+ /* the ulong in p9color is a 2x2 matrix. pull the entry
+ * u[x%2][y%2], more or less.
+ */
+ p[x] = u >> (8*((y%2)+2*(x%2)));
+ }
+ break;
+ case 2:
+ us = ~us;
+ if((x%2) == 0)
+ p[x/2] = us & 0xf;
+ else
+ p[x/2] = (p[x/2]<<4)|(us&0xf);
+ break;
+ case 0:
+ us = ~us;
+ if((x%8) == 0)
+ p[x/8] = us & 0x1;
+ else
+ p[x/8] = (p[x/8]<<1)|(us&0x1);
+ break;
+ }
+ }
+
+ /* pad last byte over if we didn't fill it */
+ xmod = pdev->width % ppb[ldepth];
+ if(xmod)
+ p[(x-1)/ppb[ldepth]] <<= ((ppb[ldepth]-xmod)*bpp[ldepth]);
+ if(writeimageblock(w, p, bpl, bdev->memory) == ERROR) {
+ gs_free_object(bdev->memory, buf, "inferno line buffer");
+ /* w leaks here */
+ return_error(gs_error_Fatal);
+ }
+ }
+ gs_free_object(bdev->memory, buf, "inferno line buffer");
+ if(writeimageblock(w, nil, 0, bdev->memory) == ERROR) {
+ return_error(gs_error_Fatal);
+ }
+
+ return 0;
}
/*
@@ -405,130 +403,130 @@ typedef struct Dump Dump;
typedef struct Hlist Hlist;
struct Hlist{
- ulong p;
- Hlist *next, *prev;
+ ulong p;
+ Hlist *next, *prev;
};
struct Dump {
- int ndump;
- uchar *dumpbuf;
- uchar buf[1+NDUMP];
+ int ndump;
+ uchar *dumpbuf;
+ uchar buf[1+NDUMP];
};
struct WImage {
- FILE *f;
-
- /* image attributes */
- Rectangle origr, r;
- int bpl;
-
- /* output buffer */
- uchar outbuf[NCBLOCK], *outp, *eout, *loutp;
-
- /* sliding input window */
- /*
- * ibase is the pointer to where the beginning of
- * the input "is" in memory. whenever we "slide" the
- * buffer N bytes, what we are actually doing is
- * decrementing ibase by N.
- * the ulongs in the Hlist structures are just
- * pointers relative to ibase.
- */
- uchar *inbuf; /* inbuf should be at least NMEM+NRUN+NMATCH long */
- uchar *ibase;
- int minbuf; /* size of inbuf (malloc'ed bytes) */
- int ninbuf; /* size of inbuf (filled bytes) */
- ulong line; /* the beginning of the line we are currently encoding,
- * relative to inbuf (NOT relative to ibase) */
-
- /* raw dump buffer */
- Dump dump;
-
- /* hash tables */
- Hlist hash[NHASH];
- Hlist chain[NMEM], *cp;
- int h;
- int needhash;
+ FILE *f;
+
+ /* image attributes */
+ Rectangle origr, r;
+ int bpl;
+
+ /* output buffer */
+ uchar outbuf[NCBLOCK], *outp, *eout, *loutp;
+
+ /* sliding input window */
+ /*
+ * ibase is the pointer to where the beginning of
+ * the input "is" in memory. whenever we "slide" the
+ * buffer N bytes, what we are actually doing is
+ * decrementing ibase by N.
+ * the ulongs in the Hlist structures are just
+ * pointers relative to ibase.
+ */
+ uchar *inbuf; /* inbuf should be at least NMEM+NRUN+NMATCH long */
+ uchar *ibase;
+ int minbuf; /* size of inbuf (malloc'ed bytes) */
+ int ninbuf; /* size of inbuf (filled bytes) */
+ ulong line; /* the beginning of the line we are currently encoding,
+ * relative to inbuf (NOT relative to ibase) */
+
+ /* raw dump buffer */
+ Dump dump;
+
+ /* hash tables */
+ Hlist hash[NHASH];
+ Hlist chain[NMEM], *cp;
+ int h;
+ int needhash;
};
static void
zerohash(WImage *w)
{
- memset(w->hash, 0, sizeof(w->hash));
- memset(w->chain, 0, sizeof(w->chain));
- w->cp=w->chain;
- w->needhash = 1;
+ memset(w->hash, 0, sizeof(w->hash));
+ memset(w->chain, 0, sizeof(w->chain));
+ w->cp=w->chain;
+ w->needhash = 1;
}
static int
addbuf(WImage *w, uchar *buf, int nbuf)
{
- int n;
- if(buf == nil || w->outp+nbuf > w->eout) {
- if(w->loutp==w->outbuf){ /* can't really happen -- we checked line length above */
- errprintf_nomem("buffer too small for line\n");
- return ERROR;
- }
- n=w->loutp-w->outbuf;
- fprintf(w->f, "%11d %11d ", w->r.max.y, n);
- fwrite(w->outbuf, 1, n, w->f);
- w->r.min.y=w->r.max.y;
- w->outp=w->outbuf;
- w->loutp=w->outbuf;
- zerohash(w);
- return -1;
- }
-
- memmove(w->outp, buf, nbuf);
- w->outp += nbuf;
- return nbuf;
+ int n;
+ if(buf == nil || w->outp+nbuf > w->eout) {
+ if(w->loutp==w->outbuf){ /* can't really happen -- we checked line length above */
+ errprintf_nomem("buffer too small for line\n");
+ return ERROR;
+ }
+ n=w->loutp-w->outbuf;
+ fprintf(w->f, "%11d %11d ", w->r.max.y, n);
+ fwrite(w->outbuf, 1, n, w->f);
+ w->r.min.y=w->r.max.y;
+ w->outp=w->outbuf;
+ w->loutp=w->outbuf;
+ zerohash(w);
+ return -1;
+ }
+
+ memmove(w->outp, buf, nbuf);
+ w->outp += nbuf;
+ return nbuf;
}
/* return 0 on success, -1 if buffer is full */
static int
flushdump(WImage *w)
{
- int n = w->dump.ndump;
-
- if(n == 0)
- return 0;
-
- w->dump.buf[0] = 0x80|(n-1);
- if((n=addbuf(w, w->dump.buf, n+1)) == ERROR)
- return ERROR;
- if(n < 0)
- return -1;
- w->dump.ndump = 0;
- return 0;
+ int n = w->dump.ndump;
+
+ if(n == 0)
+ return 0;
+
+ w->dump.buf[0] = 0x80|(n-1);
+ if((n=addbuf(w, w->dump.buf, n+1)) == ERROR)
+ return ERROR;
+ if(n < 0)
+ return -1;
+ w->dump.ndump = 0;
+ return 0;
}
static void
updatehash(WImage *w, uchar *p, uchar *ep)
{
- uchar *q;
- Hlist *cp;
- Hlist *hash;
- int h;
-
- hash = w->hash;
- cp = w->cp;
- h = w->h;
- for(q=p; q<ep; q++) {
- if(cp->prev)
- cp->prev->next = cp->next;
- cp->next = hash[h].next;
- cp->prev = &hash[h];
- cp->prev->next = cp;
- if(cp->next)
- cp->next->prev = cp;
- cp->p = q - w->ibase;
- if(++cp == w->chain+NMEM)
- cp = w->chain;
- if(&q[NMATCH] < &w->inbuf[w->ninbuf])
- h = hupdate(h, q[NMATCH]);
- }
- w->cp = cp;
- w->h = h;
+ uchar *q;
+ Hlist *cp;
+ Hlist *hash;
+ int h;
+
+ hash = w->hash;
+ cp = w->cp;
+ h = w->h;
+ for(q=p; q<ep; q++) {
+ if(cp->prev)
+ cp->prev->next = cp->next;
+ cp->next = hash[h].next;
+ cp->prev = &hash[h];
+ cp->prev->next = cp;
+ if(cp->next)
+ cp->next->prev = cp;
+ cp->p = q - w->ibase;
+ if(++cp == w->chain+NMEM)
+ cp = w->chain;
+ if(&q[NMATCH] < &w->inbuf[w->ninbuf])
+ h = hupdate(h, q[NMATCH]);
+ }
+ w->cp = cp;
+ w->h = h;
}
/*
@@ -542,192 +540,192 @@ updatehash(WImage *w, uchar *p, uchar *ep)
static int
gobbleline(WImage *w)
{
- int runlen, n, offs;
- uchar *eline, *es, *best, *p, *s, *t;
- Hlist *hp;
- uchar buf[2];
- int rv;
-
- if(w->needhash) {
- w->h = 0;
- for(n=0; n!=NMATCH; n++)
- w->h = hupdate(w->h, w->inbuf[w->line+n]);
- w->needhash = 0;
- }
- w->dump.ndump=0;
- eline=w->inbuf+w->line+w->bpl;
- for(p=w->inbuf+w->line;p!=eline;){
- es = (eline < p+NRUN) ? eline : p+NRUN;
-
- best=nil;
- runlen=0;
- /* hash table lookup */
- for(hp=w->hash[w->h].next;hp;hp=hp->next){
- /*
- * the next block is an optimization of
- * for(s=p, t=w->ibase+hp->p; s<es && *s == *t; s++, t++)
- * ;
- */
-
- { uchar *ss, *tt;
- s = p+runlen;
- t = w->ibase+hp->p+runlen;
- for(ss=s, tt=t; ss>=p && *ss == *tt; ss--, tt--)
- ;
- if(ss < p)
- while(s<es && *s == *t)
- s++, t++;
- }
-
- n = s-p;
-
- if(n > runlen) {
- runlen = n;
- best = w->ibase+hp->p;
- if(p+runlen == es)
- break;
- }
- }
-
- /*
- * if we didn't find a long enough run, append to
- * the raw dump buffer
- */
- if(runlen<NMATCH){
- if(w->dump.ndump==NDUMP) {
- if((rv = flushdump(w)) == ERROR)
- return ERROR;
- if(rv < 0)
- return 0;
- }
- w->dump.dumpbuf[w->dump.ndump++]=*p;
- runlen=1;
- }else{
- /*
- * otherwise, assuming the dump buffer is empty,
- * add the compressed rep.
- */
- if((rv = flushdump(w)) == ERROR)
- return ERROR;
- if(rv < 0)
- return 0;
- offs=p-best-1;
- buf[0] = ((runlen-NMATCH)<<2)|(offs>>8);
- buf[1] = offs&0xff;
- if(addbuf(w, buf, 2) < 0)
- return 0;
- }
-
- /*
- * add to hash tables what we just encoded
- */
- updatehash(w, p, p+runlen);
- p += runlen;
- }
-
- if((rv = flushdump(w)) == ERROR)
- return ERROR;
- if(rv < 0)
- return 0;
- w->line += w->bpl;
- w->loutp=w->outp;
- w->r.max.y++;
- return w->bpl;
+ int runlen, n, offs;
+ uchar *eline, *es, *best, *p, *s, *t;
+ Hlist *hp;
+ uchar buf[2];
+ int rv;
+
+ if(w->needhash) {
+ w->h = 0;
+ for(n=0; n!=NMATCH; n++)
+ w->h = hupdate(w->h, w->inbuf[w->line+n]);
+ w->needhash = 0;
+ }
+ w->dump.ndump=0;
+ eline=w->inbuf+w->line+w->bpl;
+ for(p=w->inbuf+w->line;p!=eline;){
+ es = (eline < p+NRUN) ? eline : p+NRUN;
+
+ best=nil;
+ runlen=0;
+ /* hash table lookup */
+ for(hp=w->hash[w->h].next;hp;hp=hp->next){
+ /*
+ * the next block is an optimization of
+ * for(s=p, t=w->ibase+hp->p; s<es && *s == *t; s++, t++)
+ * ;
+ */
+
+ { uchar *ss, *tt;
+ s = p+runlen;
+ t = w->ibase+hp->p+runlen;
+ for(ss=s, tt=t; ss>=p && *ss == *tt; ss--, tt--)
+ ;
+ if(ss < p)
+ while(s<es && *s == *t)
+ s++, t++;
+ }
+
+ n = s-p;
+
+ if(n > runlen) {
+ runlen = n;
+ best = w->ibase+hp->p;
+ if(p+runlen == es)
+ break;
+ }
+ }
+
+ /*
+ * if we didn't find a long enough run, append to
+ * the raw dump buffer
+ */
+ if(runlen<NMATCH){
+ if(w->dump.ndump==NDUMP) {
+ if((rv = flushdump(w)) == ERROR)
+ return ERROR;
+ if(rv < 0)
+ return 0;
+ }
+ w->dump.dumpbuf[w->dump.ndump++]=*p;
+ runlen=1;
+ }else{
+ /*
+ * otherwise, assuming the dump buffer is empty,
+ * add the compressed rep.
+ */
+ if((rv = flushdump(w)) == ERROR)
+ return ERROR;
+ if(rv < 0)
+ return 0;
+ offs=p-best-1;
+ buf[0] = ((runlen-NMATCH)<<2)|(offs>>8);
+ buf[1] = offs&0xff;
+ if(addbuf(w, buf, 2) < 0)
+ return 0;
+ }
+
+ /*
+ * add to hash tables what we just encoded
+ */
+ updatehash(w, p, p+runlen);
+ p += runlen;
+ }
+
+ if((rv = flushdump(w)) == ERROR)
+ return ERROR;
+ if(rv < 0)
+ return 0;
+ w->line += w->bpl;
+ w->loutp=w->outp;
+ w->r.max.y++;
+ return w->bpl;
}
static uchar*
shiftwindow(WImage *w, uchar *data, uchar *edata)
{
- int n, m;
-
- /* shift window over */
- if(w->line > NMEM) {
- n = w->line-NMEM;
- memmove(w->inbuf, w->inbuf+n, w->ninbuf-n);
- w->line -= n;
- w->ibase -= n;
- w->ninbuf -= n;
- }
-
- /* fill right with data if available */
- if(w->minbuf > w->ninbuf && edata > data) {
- m = w->minbuf - w->ninbuf;
- if(edata-data < m)
- m = edata-data;
- memmove(w->inbuf+w->ninbuf, data, m);
- data += m;
- w->ninbuf += m;
- }
-
- return data;
+ int n, m;
+
+ /* shift window over */
+ if(w->line > NMEM) {
+ n = w->line-NMEM;
+ memmove(w->inbuf, w->inbuf+n, w->ninbuf-n);
+ w->line -= n;
+ w->ibase -= n;
+ w->ninbuf -= n;
+ }
+
+ /* fill right with data if available */
+ if(w->minbuf > w->ninbuf && edata > data) {
+ m = w->minbuf - w->ninbuf;
+ if(edata-data < m)
+ m = edata-data;
+ memmove(w->inbuf+w->ninbuf, data, m);
+ data += m;
+ w->ninbuf += m;
+ }
+
+ return data;
}
static WImage*
initwriteimage(FILE *f, Rectangle r, int ldepth, gs_memory_t *mem)
{
- WImage *w;
- int n, bpl;
-
- bpl = bytesperline(r, ldepth);
- if(r.max.y <= r.min.y || r.max.x <= r.min.x || bpl <= 0) {
- errprintf(mem, "bad rectangle, ldepth");
- return nil;
- }
-
- n = NMEM+NMATCH+NRUN+bpl*2;
- w = (WImage*)gs_alloc_bytes(mem, n+sizeof(*w), "inferno image");
- if(w == nil)
- return nil;
- w->inbuf = (uchar*) &w[1];
- w->ibase = w->inbuf;
- w->line = 0;
- w->minbuf = n;
- w->ninbuf = 0;
- w->origr = r;
- w->r = r;
- w->r.max.y = w->r.min.y;
- w->eout = w->outbuf+sizeof(w->outbuf);
- w->outp = w->loutp = w->outbuf;
- w->bpl = bpl;
- w->f = f;
- w->dump.dumpbuf = w->dump.buf+1;
- w->dump.ndump = 0;
- zerohash(w);
-
- fprintf(f, "compressed\n%11d %11d %11d %11d %11d ",
- ldepth, r.min.x, r.min.y, r.max.x, r.max.y);
- return w;
+ WImage *w;
+ int n, bpl;
+
+ bpl = bytesperline(r, ldepth);
+ if(r.max.y <= r.min.y || r.max.x <= r.min.x || bpl <= 0) {
+ errprintf(mem, "bad rectangle, ldepth");
+ return nil;
+ }
+
+ n = NMEM+NMATCH+NRUN+bpl*2;
+ w = (WImage*)gs_alloc_bytes(mem, n+sizeof(*w), "inferno image");
+ if(w == nil)
+ return nil;
+ w->inbuf = (uchar*) &w[1];
+ w->ibase = w->inbuf;
+ w->line = 0;
+ w->minbuf = n;
+ w->ninbuf = 0;
+ w->origr = r;
+ w->r = r;
+ w->r.max.y = w->r.min.y;
+ w->eout = w->outbuf+sizeof(w->outbuf);
+ w->outp = w->loutp = w->outbuf;
+ w->bpl = bpl;
+ w->f = f;
+ w->dump.dumpbuf = w->dump.buf+1;
+ w->dump.ndump = 0;
+ zerohash(w);
+
+ fprintf(f, "compressed\n%11d %11d %11d %11d %11d ",
+ ldepth, r.min.x, r.min.y, r.max.x, r.max.y);
+ return w;
}
static int
writeimageblock(WImage *w, uchar *data, int ndata, gs_memory_t *mem)
{
- uchar *edata;
-
- if(data == nil) { /* end of data, flush everything */
- while(w->line < w->ninbuf)
- if(gobbleline(w) == ERROR)
- return ERROR;
- addbuf(w, nil, 0);
- if(w->r.min.y != w->origr.max.y) {
- errprintf(mem, "not enough data supplied to writeimage\n");
- }
- gs_free_object(mem, w, "inferno image");
- return 0;
- }
-
- edata = data+ndata;
- data = shiftwindow(w, data, edata);
- while(w->ninbuf >= w->line+w->bpl+NMATCH) {
- if(gobbleline(w) == ERROR)
- return ERROR;
- data = shiftwindow(w, data, edata);
- }
- if(data != edata) {
- fprintf(w->f, "data != edata. uh oh\n");
- return ERROR; /* can't happen */
- }
- return 0;
+ uchar *edata;
+
+ if(data == nil) { /* end of data, flush everything */
+ while(w->line < w->ninbuf)
+ if(gobbleline(w) == ERROR)
+ return ERROR;
+ addbuf(w, nil, 0);
+ if(w->r.min.y != w->origr.max.y) {
+ errprintf(mem, "not enough data supplied to writeimage\n");
+ }
+ gs_free_object(mem, w, "inferno image");
+ return 0;
+ }
+
+ edata = data+ndata;
+ data = shiftwindow(w, data, edata);
+ while(w->ninbuf >= w->line+w->bpl+NMATCH) {
+ if(gobbleline(w) == ERROR)
+ return ERROR;
+ data = shiftwindow(w, data, edata);
+ }
+ if(data != edata) {
+ fprintf(w->f, "data != edata. uh oh\n");
+ return ERROR; /* can't happen */
+ }
+ return 0;
}
/*
@@ -736,48 +734,48 @@ writeimageblock(WImage *w, uchar *data, int ndata, gs_memory_t *mem)
static int
bytesperline(Rectangle r, int ld)
{
- ulong ws, l, t;
- int bits = 8;
-
- ws = bits>>ld; /* pixels per unit */
- if(r.min.x >= 0){
- l = (r.max.x+ws-1)/ws;
- l -= r.min.x/ws;
- }else{ /* make positive before divide */
- t = (-r.min.x)+ws-1;
- t = (t/ws)*ws;
- l = (t+r.max.x+ws-1)/ws;
- }
- return l;
+ ulong ws, l, t;
+ int bits = 8;
+
+ ws = bits>>ld; /* pixels per unit */
+ if(r.min.x >= 0){
+ l = (r.max.x+ws-1)/ws;
+ l -= r.min.x/ws;
+ }else{ /* make positive before divide */
+ t = (-r.min.x)+ws-1;
+ t = (t/ws)*ws;
+ l = (t+r.max.x+ws-1)/ws;
+ }
+ return l;
}
static int
rgb2cmap(int cr, int cg, int cb)
{
- int r, g, b, v, cv;
-
- if(cr < 0)
- cr = 0;
- else if(cr > 255)
- cr = 255;
- if(cg < 0)
- cg = 0;
- else if(cg > 255)
- cg = 255;
- if(cb < 0)
- cb = 0;
- else if(cb > 255)
- cb = 255;
- r = cr>>6;
- g = cg>>6;
- b = cb>>6;
- cv = cr;
- if(cg > cv)
- cv = cg;
- if(cb > cv)
- cv = cb;
- v = (cv>>4)&3;
- return 255-((((r<<2)+v)<<4)+(((g<<2)+b+v-r)&15));
+ int r, g, b, v, cv;
+
+ if(cr < 0)
+ cr = 0;
+ else if(cr > 255)
+ cr = 255;
+ if(cg < 0)
+ cg = 0;
+ else if(cg > 255)
+ cg = 255;
+ if(cb < 0)
+ cb = 0;
+ else if(cb > 255)
+ cb = 255;
+ r = cr>>6;
+ g = cg>>6;
+ b = cb>>6;
+ cv = cr;
+ if(cg > cv)
+ cv = cg;
+ if(cb > cv)
+ cv = cb;
+ v = (cv>>4)&3;
+ return 255-((((r<<2)+v)<<4)+(((g<<2)+b+v-r)&15));
}
/*
@@ -786,30 +784,29 @@ rgb2cmap(int cr, int cg, int cb)
static long
cmap2rgb(int c)
{
- int j, num, den, r, g, b, v, rgb;
-
- c = 255-c;
- r = c>>6;
- v = (c>>4)&3;
- j = (c-v+r)&15;
- g = j>>2;
- b = j&3;
- den=r;
- if(g>den)
- den=g;
- if(b>den)
- den=b;
- if(den==0) {
- v *= 17;
- rgb = (v<<16)|(v<<8)|v;
- }
- else{
- num=17*(4*den+v);
- rgb = ((r*num/den)<<16)|((g*num/den)<<8)|(b*num/den);
- }
- return rgb;
+ int j, num, den, r, g, b, v, rgb;
+
+ c = 255-c;
+ r = c>>6;
+ v = (c>>4)&3;
+ j = (c-v+r)&15;
+ g = j>>2;
+ b = j&3;
+ den=r;
+ if(g>den)
+ den=g;
+ if(b>den)
+ den=b;
+ if(den==0) {
+ v *= 17;
+ rgb = (v<<16)|(v<<8)|v;
+ }
+ else{
+ num=17*(4*den+v);
+ rgb = ((r*num/den)<<16)|((g*num/den)<<8)|(b*num/den);
+ }
+ return rgb;
}
*
*
*/
-
diff --git a/gs/base/gdevijs.c b/gs/base/gdevijs.c
index 20b7afbc0..a5ed238f7 100644
--- a/gs/base/gdevijs.c
+++ b/gs/base/gdevijs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,12 +16,12 @@
* Intended to work with any IJS compliant inkjet driver, including
* hpijs 1.0 and later, an IJS-enhanced gimp-print driver, and
* the IJS Windows GDI server (ijsmswin.exe).
- *
+ *
* DRAFT
*
* WARNING: The ijs server can be selected on the gs command line
* which is a security risk, since any program can be run.
- * You should use -dSAFER which sets .LockSafetyParams to true
+ * You should use -dSAFER which sets .LockSafetyParams to true
* before opening this device.
*
* 11/26/03 David Suffield (gdevijs-krgb-1.0.patch)
@@ -35,15 +35,15 @@
* 2. Fixed z-order issue with colored text on black rectangle.
*
* 02/22/06 David Suffield (gdevijs-krgb-1.2.patch)
- * 1. Fixed krgb buffer overflow issue with out-of-band data in fill_rectangle and copy_mono.
+ * 1. Fixed krgb buffer overflow issue with out-of-band data in fill_rectangle and copy_mono.
* This buffer overflow condition occurred with fullbleed print jobs that had k-band images.
* 2. Added Dan Coby (artifex) fix for gsijs_read_string_malloc gs_free *str memory leak.
*
* 06/02/06 David Suffield (gdevijs-krgb-1.3.patch)
- * 1. Revisited the krgb buffer overflow issue with out-of-band data in fill_rectangle and
- * copy_mono. Changed the fill_rectangle and copy_mono to an inner loop buffer check
+ * 1. Revisited the krgb buffer overflow issue with out-of-band data in fill_rectangle and
+ * copy_mono. Changed the fill_rectangle and copy_mono to an inner loop buffer check
* instead of a outer loop x/y extent check.
- * 2. As requested by Ralph Giles, added K 1-bit and 8-bit support for krgb, but only 1-bit is
+ * 2. As requested by Ralph Giles, added K 1-bit and 8-bit support for krgb, but only 1-bit is
* implemented for now.
*
* KRGB definition:
@@ -76,9 +76,9 @@
/* This should go into gdevprn.h, or, better yet, gdevprn should
acquire an API for changing resolution. */
int gdev_prn_maybe_realloc_memory(gx_device_printer *pdev,
- gdev_prn_space_params *old_space,
- int old_width, int old_height,
- bool old_page_uses_transparency);
+ gdev_prn_space_params *old_space,
+ int old_width, int old_height,
+ bool old_page_uses_transparency);
/* Device procedures */
@@ -99,50 +99,50 @@ static dev_proc_fill_path(gsijs_fill_path);
static dev_proc_stroke_path(gsijs_stroke_path);
static const gx_device_procs gsijs_procs = {
- gsijs_open,
- NULL, /* get_initial_matrix */
- NULL, /* sync_output */
- gsijs_output_page,
- gsijs_close,
- gx_default_rgb_map_rgb_color,
- gx_default_rgb_map_color_rgb,
- NULL, /* fill_rectangle */
- NULL, /* tile_rectangle */
- NULL, /* copy_mono */
- NULL, /* copy_color */
- NULL, /* draw_line */
- NULL, /* get_bits */
- gsijs_get_params,
- gsijs_put_params,
- NULL, /* map_cmyk_color */
- NULL, /* get_xfont_procs */
- NULL, /* get_xfont_device */
- NULL, /* map_rgb_alpha_color */
- gx_page_device_get_page_device,
- NULL, /* get_alpha_bits */
- NULL, /* copy_alpha */
- NULL, /* get_band */
- NULL, /* copy_rop */
- NULL, /* fill_path */
- NULL, /* stroke_path */
- NULL, /* fill_mask */
- NULL, /* fill_trapezoid */
- NULL, /* fill_parallelogram */
- NULL, /* fill_triangle */
- NULL, /* draw_thin_line */
- NULL, /* begin_image */
- NULL, /* image_data */
- NULL, /* end_image */
- NULL, /* strip_tile_rectangle */
- NULL, /* strip_copy_rop, */
- NULL, /* get_clipping_box */
- NULL, /* begin_typed_image */
- NULL, /* get_bits_rectangle */
- NULL, /* map_color_rgb_alpha */
- NULL, /* create_compositor */
- NULL, /* get_hardware_params */
- NULL, /* text_begin */
- gsijs_finish_copydevice
+ gsijs_open,
+ NULL, /* get_initial_matrix */
+ NULL, /* sync_output */
+ gsijs_output_page,
+ gsijs_close,
+ gx_default_rgb_map_rgb_color,
+ gx_default_rgb_map_color_rgb,
+ NULL, /* fill_rectangle */
+ NULL, /* tile_rectangle */
+ NULL, /* copy_mono */
+ NULL, /* copy_color */
+ NULL, /* draw_line */
+ NULL, /* get_bits */
+ gsijs_get_params,
+ gsijs_put_params,
+ NULL, /* map_cmyk_color */
+ NULL, /* get_xfont_procs */
+ NULL, /* get_xfont_device */
+ NULL, /* map_rgb_alpha_color */
+ gx_page_device_get_page_device,
+ NULL, /* get_alpha_bits */
+ NULL, /* copy_alpha */
+ NULL, /* get_band */
+ NULL, /* copy_rop */
+ NULL, /* fill_path */
+ NULL, /* stroke_path */
+ NULL, /* fill_mask */
+ NULL, /* fill_trapezoid */
+ NULL, /* fill_parallelogram */
+ NULL, /* fill_triangle */
+ NULL, /* draw_thin_line */
+ NULL, /* begin_image */
+ NULL, /* image_data */
+ NULL, /* end_image */
+ NULL, /* strip_tile_rectangle */
+ NULL, /* strip_copy_rop, */
+ NULL, /* get_clipping_box */
+ NULL, /* begin_typed_image */
+ NULL, /* get_bits_rectangle */
+ NULL, /* map_color_rgb_alpha */
+ NULL, /* create_compositor */
+ NULL, /* get_hardware_params */
+ NULL, /* text_begin */
+ gsijs_finish_copydevice
};
typedef struct gx_device_ijs_s gx_device_ijs;
@@ -188,10 +188,10 @@ struct gx_device_ijs_s {
gx_device_ijs gs_ijs_device =
{
prn_device_std_body(gx_device_ijs, gsijs_procs, "ijs",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- DEFAULT_DPI, DEFAULT_DPI,
- 0, 0, 0, 0,
- 24 /* depth */, NULL /* print page */),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ DEFAULT_DPI, DEFAULT_DPI,
+ 0, 0, 0, 0,
+ 24 /* depth */, NULL /* print page */),
FALSE, /* IjsUseOutputFD */
"", /* IjsServer */
NULL, /* ColorSpace */
@@ -217,15 +217,14 @@ gx_device_ijs gs_ijs_device =
NULL /* k_band buffer */
};
-
static int gsijs_client_set_param(gx_device_ijs *ijsdev, const char *key,
const char *value);
static int gsijs_set_color_format(gx_device_ijs *ijsdev);
-static int gsijs_read_int(gs_param_list *plist, gs_param_name pname,
+static int gsijs_read_int(gs_param_list *plist, gs_param_name pname,
int *pval, int min_value, int max_value, bool only_when_closed);
-static int gsijs_read_bool(gs_param_list *plist, gs_param_name pname,
+static int gsijs_read_bool(gs_param_list *plist, gs_param_name pname,
bool *pval, bool only_when_closed);
-static int gsijs_read_string(gs_param_list * plist, gs_param_name pname,
+static int gsijs_read_string(gs_param_list * plist, gs_param_name pname,
char * str, uint size, bool safety, bool only_when_closed);
/**************************************************************************/
@@ -252,7 +251,7 @@ static int gsijs_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
if (!ijsdev)
return 0; /* no forward device, bug?? */
- if (ijsdev->krgb_mode && ijsdev->k_path && y >= 0 && x >= 0)
+ if (ijsdev->krgb_mode && ijsdev->k_path && y >= 0 && x >= 0)
{
int raster = (ijsdev->k_width+7) >> 3;
register unsigned char *dest;
@@ -276,7 +275,7 @@ static int gsijs_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Note x,y orgin 0,0 is stored first byte 0 left to right. */
if (color==0x0)
- {
+ {
/* Color is black, store in k plane band instead of regular band. */
for (j=0; j<h; j++)
{
@@ -286,7 +285,7 @@ static int gsijs_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
if (p >= beg && p <= end)
*p |= xmask[(dest_start_bit+i)&7];
}
- dest+=raster;
+ dest+=raster;
}
return 0;
}
@@ -301,7 +300,7 @@ static int gsijs_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
if (p >= beg && p <= end)
*p &= ~xmask[(dest_start_bit+i)&7];
}
- dest+=raster;
+ dest+=raster;
}
}
}
@@ -319,7 +318,7 @@ static int gsijs_copy_mono(gx_device * dev, const byte * data,
return 0; /* no forward device, bug?? */
/* if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) */
- if (ijsdev->krgb_mode && ijsdev->k_path)
+ if (ijsdev->krgb_mode && ijsdev->k_path)
{
/* Store in k plane band instead of regular band. */
int raster = (ijsdev->k_width+7) >> 3; /* raster width in bytes, byte aligned */
@@ -332,7 +331,7 @@ static int gsijs_copy_mono(gx_device * dev, const byte * data,
unsigned char *beg = ijsdev->k_band;
unsigned char *end = ijsdev->k_band+ijsdev->k_band_size;
unsigned char *p;
-
+
if (h <= 0 || w <= 0)
return 0;
@@ -381,7 +380,7 @@ static int gsijs_copy_mono(gx_device * dev, const byte * data,
scan+=draster;
dest+=raster;
}
- }
+ }
}
return (*ijsdev->prn_procs.copy_mono)(dev, data, dx, draster, id, x, y, w, height, zero, one);
@@ -460,11 +459,11 @@ static int gsijs_get_bits(gx_device_printer * pdev, int y, byte * str, byte ** a
int band_number = y/band_height;
int raster = (ijsdev->k_width+7) >> 3; /* raster width in bytes, byte aligned */
int y1=raster*(y-(band_height*band_number));
-
+
if (y1 == 0)
{
/* First raster for band, clear k_band. Banding playback occurs on first raster. */
- memset(ijsdev->k_band, 0, ijsdev->k_band_size);
+ memset(ijsdev->k_band, 0, ijsdev->k_band_size);
}
return gdev_prn_get_bits(pdev, y, str, actual_data); /* get raster from regular band */
@@ -478,7 +477,7 @@ static int gsijs_k_get_bits(gx_device_printer * pdev, int y, byte ** actual_data
int band_number = y/band_height;
int raster = (ijsdev->k_width+7) >> 3; /* raster width in bytes, byte aligned */
int y1=raster*(y-(band_height*band_number));
-
+
*actual_data = ijsdev->k_band+y1;
return 0;
@@ -526,7 +525,7 @@ gsijs_set_krgb_mode(gx_device_ijs *ijsdev)
if (strstr(buf, "KRGB") != NULL)
{
ijsdev->krgb_mode = 1; /* yes KRGB is supported */
- ijsdev->k_bits = 1; /* KRGB = 1x8x8x8 */
+ ijsdev->k_bits = 1; /* KRGB = 1x8x8x8 */
}
else if (strstr(buf, "KxRGB") != NULL)
{
@@ -534,7 +533,7 @@ gsijs_set_krgb_mode(gx_device_ijs *ijsdev)
ijsdev->k_bits = 8; /* KRGB = 8x8x8x8 */
}
- return 0;
+ return 0;
}
/* ------ Private definitions ------ */
@@ -547,29 +546,29 @@ gsijs_parse_wxh (const char *val, int size, double *pw, double *ph)
int i;
for (i = 0; i < size; i++)
- if (val[i] == 'x')
- break;
+ if (val[i] == 'x')
+ break;
if (i + 1 >= size)
- return IJS_ESYNTAX;
+ return IJS_ESYNTAX;
if (i >= sizeof(buf))
- return IJS_EBUF;
+ return IJS_EBUF;
memcpy (buf, val, i);
buf[i] = 0;
*pw = strtod (buf, &tail);
if (tail == buf)
- return IJS_ESYNTAX;
+ return IJS_ESYNTAX;
if (size - i > sizeof(buf))
- return IJS_EBUF;
+ return IJS_EBUF;
memcpy (buf, val + i + 1, size - i - 1);
buf[size - i - 1] = 0;
*ph = strtod (buf, &tail);
if (tail == buf)
- return IJS_ESYNTAX;
+ return IJS_ESYNTAX;
return 0;
}
@@ -588,38 +587,38 @@ gsijs_set_generic_params(gx_device_ijs *ijsdev)
/* Split IjsParams into separate parameters and send to ijs server */
value = NULL;
for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
- char ch = ijsdev->IjsParams[j];
- if (ch == '\\') {
- j++;
- buf[i++] = ijsdev->IjsParams[j];
- }
- else {
- if (ch == '=') {
- buf[i++] = '\0';
- value = &buf[i];
- }
- else
- buf[i++] = ch;
- if (ch == ',') {
- buf[i-1] = '\0';
- if (value)
- gsijs_client_set_param(ijsdev, buf, value);
- i = 0;
- value = NULL;
- }
- }
+ char ch = ijsdev->IjsParams[j];
+ if (ch == '\\') {
+ j++;
+ buf[i++] = ijsdev->IjsParams[j];
+ }
+ else {
+ if (ch == '=') {
+ buf[i++] = '\0';
+ value = &buf[i];
+ }
+ else
+ buf[i++] = ch;
+ if (ch == ',') {
+ buf[i-1] = '\0';
+ if (value)
+ gsijs_client_set_param(ijsdev, buf, value);
+ i = 0;
+ value = NULL;
+ }
+ }
}
if (value)
- code = gsijs_client_set_param(ijsdev, buf, value);
+ code = gsijs_client_set_param(ijsdev, buf, value);
if (code == 0 && ijsdev->Duplex_set) {
- code = gsijs_client_set_param(ijsdev, "PS:Duplex",
- ijsdev->Duplex ? "true" : "false");
+ code = gsijs_client_set_param(ijsdev, "PS:Duplex",
+ ijsdev->Duplex ? "true" : "false");
}
if (code == 0 && ijsdev->IjsTumble_set) {
- code = gsijs_client_set_param(ijsdev, "PS:Tumble",
- ijsdev->IjsTumble ? "true" :
- "false");
+ code = gsijs_client_set_param(ijsdev, "PS:Tumble",
+ ijsdev->IjsTumble ? "true" :
+ "false");
}
return code;
}
@@ -638,86 +637,86 @@ gsijs_set_margin_params(gx_device_ijs *ijsdev)
/* Split IjsParams into separate parameters and send to ijs server */
value = NULL;
for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
- char ch = ijsdev->IjsParams[j];
- if (ch == '\\') {
- j++;
- buf[i++] = ijsdev->IjsParams[j];
- }
- else {
- if (ch == '=') {
- buf[i++] = '\0';
- value = &buf[i];
- }
- else
- buf[i++] = ch;
- if (ch == ',') {
- buf[i-1] = '\0';
- if (value)
- gsijs_client_set_param(ijsdev, buf, value);
- i = 0;
- value = NULL;
- }
- }
+ char ch = ijsdev->IjsParams[j];
+ if (ch == '\\') {
+ j++;
+ buf[i++] = ijsdev->IjsParams[j];
+ }
+ else {
+ if (ch == '=') {
+ buf[i++] = '\0';
+ value = &buf[i];
+ }
+ else
+ buf[i++] = ch;
+ if (ch == ',') {
+ buf[i-1] = '\0';
+ if (value)
+ gsijs_client_set_param(ijsdev, buf, value);
+ i = 0;
+ value = NULL;
+ }
+ }
}
if (value)
- code = gsijs_client_set_param(ijsdev, buf, value);
+ code = gsijs_client_set_param(ijsdev, buf, value);
if (code == 0 && ijsdev->Duplex_set) {
- code = gsijs_client_set_param(ijsdev, "Duplex",
- ijsdev->Duplex ? "true" : "false");
+ code = gsijs_client_set_param(ijsdev, "Duplex",
+ ijsdev->Duplex ? "true" : "false");
}
if (code == 0 && ijsdev->IjsTumble_set) {
- code = gsijs_client_set_param(ijsdev, "Tumble",
- ijsdev->IjsTumble ? "true" :
- "false");
+ code = gsijs_client_set_param(ijsdev, "Tumble",
+ ijsdev->IjsTumble ? "true" :
+ "false");
}
if (code == 0) {
- sprintf (buf, "%gx%g", ijsdev->MediaSize[0] * (1.0 / 72),
- ijsdev->MediaSize[1] * (1.0 / 72));
- code = ijs_client_set_param(ijsdev->ctx, 0, "PaperSize",
- buf, strlen(buf));
+ sprintf (buf, "%gx%g", ijsdev->MediaSize[0] * (1.0 / 72),
+ ijsdev->MediaSize[1] * (1.0 / 72));
+ code = ijs_client_set_param(ijsdev->ctx, 0, "PaperSize",
+ buf, strlen(buf));
}
if (code == 0) {
- double printable_width, printable_height;
- double printable_left, printable_top;
- float m[4];
-
- code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableArea",
- buf, sizeof(buf));
- if (code == IJS_EUNKPARAM)
- /* IJS server doesn't support margin negotiations.
- That's ok. */
- return 0;
- else if (code >= 0) {
- code = gsijs_parse_wxh (buf, code,
- &printable_width, &printable_height);
- }
-
- if (code == 0) {
- code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableTopLeft",
- buf, sizeof(buf));
- if (code == IJS_EUNKPARAM)
- return 0;
- else if (code >= 0) {
- code = gsijs_parse_wxh(buf, code,
- &printable_left, &printable_top);
- }
- }
-
- if (code == 0) {
- m[0] = printable_left;
- m[3] = printable_top;
- m[2] = ijsdev->MediaSize[0] * (1.0 / 72) -
- printable_left - printable_width;
- m[1] = ijsdev->MediaSize[1] * (1.0 / 72) -
- printable_top - printable_height;
- gx_device_set_margins((gx_device *)ijsdev, m, true);
- sprintf (buf, "%gx%g", printable_left, printable_top);
- code = ijs_client_set_param(ijsdev->ctx, 0, "TopLeft",
- buf, strlen(buf));
- }
+ double printable_width, printable_height;
+ double printable_left, printable_top;
+ float m[4];
+
+ code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableArea",
+ buf, sizeof(buf));
+ if (code == IJS_EUNKPARAM)
+ /* IJS server doesn't support margin negotiations.
+ That's ok. */
+ return 0;
+ else if (code >= 0) {
+ code = gsijs_parse_wxh (buf, code,
+ &printable_width, &printable_height);
+ }
+
+ if (code == 0) {
+ code = ijs_client_get_param(ijsdev->ctx, 0, "PrintableTopLeft",
+ buf, sizeof(buf));
+ if (code == IJS_EUNKPARAM)
+ return 0;
+ else if (code >= 0) {
+ code = gsijs_parse_wxh(buf, code,
+ &printable_left, &printable_top);
+ }
+ }
+
+ if (code == 0) {
+ m[0] = printable_left;
+ m[3] = printable_top;
+ m[2] = ijsdev->MediaSize[0] * (1.0 / 72) -
+ printable_left - printable_width;
+ m[1] = ijsdev->MediaSize[1] * (1.0 / 72) -
+ printable_top - printable_height;
+ gx_device_set_margins((gx_device *)ijsdev, m, true);
+ sprintf (buf, "%gx%g", printable_left, printable_top);
+ code = ijs_client_set_param(ijsdev->ctx, 0, "TopLeft",
+ buf, strlen(buf));
+ }
}
return code;
@@ -747,47 +746,47 @@ gsijs_set_resolution(gx_device_ijs *ijsdev)
bool save_is_open = ijsdev->is_open;
if (ijsdev->HWResolution[0] != DEFAULT_DPI ||
- ijsdev->HWResolution[1] != DEFAULT_DPI) {
- /* Resolution has been set on command line. */
- return 0;
+ ijsdev->HWResolution[1] != DEFAULT_DPI) {
+ /* Resolution has been set on command line. */
+ return 0;
}
code = ijs_client_get_param(ijsdev->ctx, 0, "Dpi",
- buf, sizeof(buf));
+ buf, sizeof(buf));
if (code >= 0) {
- int i;
-
- for (i = 0; i < code; i++)
- if (buf[i] == 'x')
- break;
- if (i == code) {
- char *tail;
-
- if (i == sizeof(buf))
- code = IJS_EBUF;
- buf[i] = 0;
- x_dpi = y_dpi = strtod (buf, &tail);
- if (tail == buf)
- code = IJS_ESYNTAX;
- } else {
- double x, y;
-
- code = gsijs_parse_wxh(buf, code, &x, &y);
- x_dpi = x;
- y_dpi = y;
- }
+ int i;
+
+ for (i = 0; i < code; i++)
+ if (buf[i] == 'x')
+ break;
+ if (i == code) {
+ char *tail;
+
+ if (i == sizeof(buf))
+ code = IJS_EBUF;
+ buf[i] = 0;
+ x_dpi = y_dpi = strtod (buf, &tail);
+ if (tail == buf)
+ code = IJS_ESYNTAX;
+ } else {
+ double x, y;
+
+ code = gsijs_parse_wxh(buf, code, &x, &y);
+ x_dpi = x;
+ y_dpi = y;
+ }
}
if (code < 0) {
- x_dpi = 72.0;
- y_dpi = 72.0;
+ x_dpi = 72.0;
+ y_dpi = 72.0;
}
gx_device_set_resolution((gx_device *)ijsdev, x_dpi, y_dpi);
ijsdev->is_open = true;
code = gdev_prn_maybe_realloc_memory((gx_device_printer *)ijsdev,
- &ijsdev->space_params, width, height,
- ijsdev->page_uses_transparency);
+ &ijsdev->space_params, width, height,
+ ijsdev->page_uses_transparency);
ijsdev->is_open = save_is_open;
return code;
}
@@ -803,8 +802,8 @@ gsijs_open(gx_device *dev)
int fd = -1;
if (strlen(ijsdev->IjsServer) == 0) {
- emprintf(dev->memory, "ijs server not specified\n");
- return gs_note_error(gs_error_ioerror);
+ emprintf(dev->memory, "ijs server not specified\n");
+ return gs_note_error(gs_error_ioerror);
}
ijsdev->space_params.banding_type = BandingAlways; /* always force banding */
@@ -824,13 +823,13 @@ gsijs_open(gx_device *dev)
code = gdev_prn_open(dev);
if (code < 0)
- return code;
+ return code;
if (use_outputfd) {
- /* Note: dup() may not be portable to all interesting IJS
- platforms. In that case, this branch should be #ifdef'ed out.
- */
- fd = dup(fileno(ijsdev->file));
+ /* Note: dup() may not be portable to all interesting IJS
+ platforms. In that case, this branch should be #ifdef'ed out.
+ */
+ fd = dup(fileno(ijsdev->file));
}
/* WARNING: Ghostscript should be run with -dSAFER to stop
@@ -838,53 +837,53 @@ gsijs_open(gx_device *dev)
*/
ijsdev->ctx = ijs_invoke_server(ijsdev->IjsServer);
if (ijsdev->ctx == (IjsClientCtx *)NULL) {
- emprintf1(ijsdev->memory,
+ emprintf1(ijsdev->memory,
"Can't start ijs server \042%s\042\n", ijsdev->IjsServer);
- return gs_note_error(gs_error_ioerror);
+ return gs_note_error(gs_error_ioerror);
}
ijsdev->ijs_version = ijs_client_get_version (ijsdev->ctx);
if (ijs_client_open(ijsdev->ctx) < 0) {
- emprintf(ijsdev->memory, "Can't open ijs\n");
- return gs_note_error(gs_error_ioerror);
+ emprintf(ijsdev->memory, "Can't open ijs\n");
+ return gs_note_error(gs_error_ioerror);
}
if (ijs_client_begin_job(ijsdev->ctx, 0) < 0) {
- emprintf(ijsdev->memory, "Can't begin ijs job 0\n");
- ijs_client_close(ijsdev->ctx);
- return gs_note_error(gs_error_ioerror);
+ emprintf(ijsdev->memory, "Can't begin ijs job 0\n");
+ ijs_client_close(ijsdev->ctx);
+ return gs_note_error(gs_error_ioerror);
}
if (use_outputfd) {
- /* Note: dup() may not be portable to all interesting IJS
- platforms. In that case, this branch should be #ifdef'ed out.
- */
- sprintf(buf, "%d", fd);
- ijs_client_set_param(ijsdev->ctx, 0, "OutputFD", buf, strlen(buf));
- close(fd);
+ /* Note: dup() may not be portable to all interesting IJS
+ platforms. In that case, this branch should be #ifdef'ed out.
+ */
+ sprintf(buf, "%d", fd);
+ ijs_client_set_param(ijsdev->ctx, 0, "OutputFD", buf, strlen(buf));
+ close(fd);
} else {
- ijs_client_set_param(ijsdev->ctx, 0, "OutputFile",
- ijsdev->fname, strlen(ijsdev->fname));
+ ijs_client_set_param(ijsdev->ctx, 0, "OutputFile",
+ ijsdev->fname, strlen(ijsdev->fname));
}
if (code >= 0 && ijsdev->DeviceManufacturer)
- code = ijs_client_set_param(ijsdev->ctx, 0, "DeviceManufacturer",
- ijsdev->DeviceManufacturer,
- strlen(ijsdev->DeviceManufacturer));
+ code = ijs_client_set_param(ijsdev->ctx, 0, "DeviceManufacturer",
+ ijsdev->DeviceManufacturer,
+ strlen(ijsdev->DeviceManufacturer));
if (code >= 0 && ijsdev->DeviceModel)
- code = ijs_client_set_param(ijsdev->ctx, 0, "DeviceModel",
- ijsdev->DeviceModel,
- strlen(ijsdev->DeviceModel));
+ code = ijs_client_set_param(ijsdev->ctx, 0, "DeviceModel",
+ ijsdev->DeviceModel,
+ strlen(ijsdev->DeviceModel));
if (code >= 0)
- code = gsijs_set_generic_params(ijsdev);
+ code = gsijs_set_generic_params(ijsdev);
if (code >= 0)
- code = gsijs_set_resolution(ijsdev);
+ code = gsijs_set_resolution(ijsdev);
if (code >= 0)
- code = gsijs_set_margin_params(ijsdev);
+ code = gsijs_set_margin_params(ijsdev);
if (code >= 0)
code = gsijs_set_krgb_mode(ijsdev);
@@ -903,12 +902,12 @@ gsijs_finish_copydevice(gx_device *dev, const gx_device *from_dev)
code = gx_default_finish_copydevice(dev, from_dev);
if(code < 0)
return code;
-
+
if (!ijsdev->ColorSpace) {
- ijsdev->ColorSpace = gs_malloc(ijsdev->memory, sizeof(rgb), 1,
- "gsijs_finish_copydevice");
+ ijsdev->ColorSpace = gs_malloc(ijsdev->memory, sizeof(rgb), 1,
+ "gsijs_finish_copydevice");
if (!ijsdev->ColorSpace)
- return gs_note_error(gs_error_VMerror);
+ return gs_note_error(gs_error_VMerror);
ijsdev->ColorSpace_size = sizeof(rgb);
memcpy(ijsdev->ColorSpace, rgb, sizeof(rgb));
}
@@ -930,17 +929,17 @@ gsijs_close(gx_device *dev)
code = gdev_prn_close(dev);
if (ijsdev->IjsParams)
- gs_free(dev->memory, ijsdev->IjsParams,
- ijsdev->IjsParams_size, 1, "gsijs_read_string_malloc");
+ gs_free(dev->memory, ijsdev->IjsParams,
+ ijsdev->IjsParams_size, 1, "gsijs_read_string_malloc");
if (ijsdev->ColorSpace)
- gs_free(dev->memory, ijsdev->ColorSpace,
- ijsdev->ColorSpace_size, 1, "gsijs_read_string_malloc");
+ gs_free(dev->memory, ijsdev->ColorSpace,
+ ijsdev->ColorSpace_size, 1, "gsijs_read_string_malloc");
if (ijsdev->DeviceManufacturer)
- gs_free(dev->memory, ijsdev->DeviceManufacturer,
- ijsdev->DeviceManufacturer_size, 1, "gsijs_read_string_malloc");
+ gs_free(dev->memory, ijsdev->DeviceManufacturer,
+ ijsdev->DeviceManufacturer_size, 1, "gsijs_read_string_malloc");
if (ijsdev->DeviceModel)
- gs_free(dev->memory, ijsdev->DeviceModel,
- ijsdev->DeviceModel_size, 1, "gsijs_read_string_malloc");
+ gs_free(dev->memory, ijsdev->DeviceModel,
+ ijsdev->DeviceModel_size, 1, "gsijs_read_string_malloc");
ijsdev->IjsParams = NULL;
ijsdev->IjsParams_size = 0;
ijsdev->DeviceManufacturer = NULL;
@@ -969,7 +968,7 @@ gsijs_raster_width(gx_device *pdev)
return min(width, end);
}
-/* Print a page. Don't use normal printer gdev_prn_output_page
+/* Print a page. Don't use normal printer gdev_prn_output_page
* because it opens the output file.
*/
static int
@@ -993,12 +992,12 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
int i, y;
if ((data = gs_alloc_bytes(pdev->memory, raster, "gsijs_output_page"))
- == (unsigned char *)NULL)
+ == (unsigned char *)NULL)
return gs_note_error(gs_error_VMerror);
/* Determine bitmap width and height */
ijs_height = gdev_prn_print_scan_lines(dev);
- ijs_width = gsijs_raster_width(dev);
+ ijs_width = gsijs_raster_width(dev);
row_bytes = (ijs_width * pdev->color_info.depth + 7) >> 3;
@@ -1010,7 +1009,7 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
/* Create banding buffer for k plane. */
ijsdev->k_width = ijs_width;
- ijsdev->k_band_size = band_height * k_row_bytes;
+ ijsdev->k_band_size = band_height * k_row_bytes;
if ((ijsdev->k_band = gs_malloc(pdev->memory, ijsdev->k_band_size, 1, "gsijs_output_page")) == (unsigned char *)NULL)
return gs_note_error(gs_error_VMerror);
}
@@ -1022,8 +1021,8 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
gsijs_client_set_param(ijsdev, "BitsPerSample", buf);
/* This needs to become more sophisticated for DeviceN. */
- strcpy(buf, (n_chan == 4) ? "DeviceCMYK" :
- ((n_chan == 3) ? (krgb_mode ? ((k_bits == 1) ? "KRGB" : "KxRGB") : "DeviceRGB") : "DeviceGray"));
+ strcpy(buf, (n_chan == 4) ? "DeviceCMYK" :
+ ((n_chan == 3) ? (krgb_mode ? ((k_bits == 1) ? "KRGB" : "KxRGB") : "DeviceRGB") : "DeviceGray"));
gsijs_client_set_param(ijsdev, "ColorSpace", buf);
sprintf(buf, "%d", ijs_width);
@@ -1046,11 +1045,11 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
#endif
for (i=0; i<num_copies; i++) {
- unsigned char *actual_data;
- ijs_client_begin_cmd (ijsdev->ctx, IJS_CMD_BEGIN_PAGE);
- status = ijs_client_send_cmd_wait(ijsdev->ctx);
+ unsigned char *actual_data;
+ ijs_client_begin_cmd (ijsdev->ctx, IJS_CMD_BEGIN_PAGE);
+ status = ijs_client_send_cmd_wait(ijsdev->ctx);
- for (y = 0; y < ijs_height; y++) {
+ for (y = 0; y < ijs_height; y++) {
if (krgb_mode)
code = gsijs_get_bits(pdev, y, data, &actual_data);
else
@@ -1074,10 +1073,10 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
status = ijs_client_send_data_wait(ijsdev->ctx, 0, (char *)actual_data, k_row_bytes);
if (status)
break;
- }
- }
- ijs_client_begin_cmd(ijsdev->ctx, IJS_CMD_END_PAGE);
- status = ijs_client_send_cmd_wait(ijsdev->ctx);
+ }
+ }
+ ijs_client_begin_cmd(ijsdev->ctx, IJS_CMD_END_PAGE);
+ status = ijs_client_send_cmd_wait(ijsdev->ctx);
}
#ifdef KRGB_DEBUG
@@ -1091,23 +1090,21 @@ gsijs_output_page(gx_device *dev, int num_copies, int flush)
gs_free_object(pdev->memory, data, "gsijs_output_page");
endcode = (pdev->buffer_space && !pdev->is_async_renderer ?
- clist_finish_page(dev, flush) : 0);
-
+ clist_finish_page(dev, flush) : 0);
if (endcode < 0)
- return endcode;
+ return endcode;
if (code < 0)
- return endcode;
+ return endcode;
if (status < 0)
- return gs_note_error(gs_error_ioerror);
+ return gs_note_error(gs_error_ioerror);
code = gx_finish_output_page(dev, num_copies, flush);
return code;
}
-
/**************************************************************************/
/* Get device parameters */
@@ -1119,51 +1116,51 @@ gsijs_get_params(gx_device *dev, gs_param_list *plist)
int code = gdev_prn_get_params(dev, plist);
if (code >= 0) {
- param_string_from_transient_string(gps, ijsdev->IjsServer);
- code = param_write_string(plist, "IjsServer", &gps);
+ param_string_from_transient_string(gps, ijsdev->IjsServer);
+ code = param_write_string(plist, "IjsServer", &gps);
}
if (code >= 0) {
- if (ijsdev->DeviceManufacturer) {
- param_string_from_transient_string(gps,
- ijsdev->DeviceManufacturer);
- code = param_write_string(plist, "DeviceManufacturer", &gps);
- } else {
- code = param_write_null(plist, "DeviceManufacturer");
- }
+ if (ijsdev->DeviceManufacturer) {
+ param_string_from_transient_string(gps,
+ ijsdev->DeviceManufacturer);
+ code = param_write_string(plist, "DeviceManufacturer", &gps);
+ } else {
+ code = param_write_null(plist, "DeviceManufacturer");
+ }
}
if (code >= 0) {
- if (ijsdev->DeviceModel) {
- param_string_from_transient_string(gps, ijsdev->DeviceModel);
- code = param_write_string(plist, "DeviceModel", &gps);
- } else {
- code = param_write_null(plist, "DeviceModel");
- }
+ if (ijsdev->DeviceModel) {
+ param_string_from_transient_string(gps, ijsdev->DeviceModel);
+ code = param_write_string(plist, "DeviceModel", &gps);
+ } else {
+ code = param_write_null(plist, "DeviceModel");
+ }
}
if (code >= 0) {
- if (ijsdev->IjsParams) {
- param_string_from_transient_string(gps, ijsdev->IjsParams);
- code = param_write_string(plist, "IjsParams", &gps);
- } else {
- code = param_write_null(plist, "IjsParams");
- }
+ if (ijsdev->IjsParams) {
+ param_string_from_transient_string(gps, ijsdev->IjsParams);
+ code = param_write_string(plist, "IjsParams", &gps);
+ } else {
+ code = param_write_null(plist, "IjsParams");
+ }
}
if (code >= 0)
- code = param_write_int(plist, "BitsPerSample", &ijsdev->BitsPerSample);
+ code = param_write_int(plist, "BitsPerSample", &ijsdev->BitsPerSample);
if (code >= 0)
- code = param_write_bool(plist, "IjsUseOutputFD",
- &ijsdev->IjsUseOutputFD);
+ code = param_write_bool(plist, "IjsUseOutputFD",
+ &ijsdev->IjsUseOutputFD);
if (code >= 0) {
- if (ijsdev->IjsTumble_set) {
- code = param_write_bool(plist, "Tumble", &ijsdev->IjsTumble);
- } else {
- code = param_write_null(plist, "Tumble");
- }
+ if (ijsdev->IjsTumble_set) {
+ code = param_write_bool(plist, "Tumble", &ijsdev->IjsTumble);
+ } else {
+ code = param_write_null(plist, "Tumble");
+ }
}
return code;
@@ -1177,49 +1174,49 @@ gsijs_read_int(gs_param_list *plist, gs_param_name pname, int *pval,
int new_value;
switch (code = param_read_int(plist, pname, &new_value)) {
- case 0:
- if (only_when_closed && (new_value != *pval)) {
- code = gs_error_rangecheck;
- goto e;
- }
- if ((new_value >= min_value) && (new_value <= max_value)) {
- *pval = new_value;
- break;
- }
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e:param_signal_error(plist, pname, code);
- case 1:
- ;
+ case 0:
+ if (only_when_closed && (new_value != *pval)) {
+ code = gs_error_rangecheck;
+ goto e;
+ }
+ if ((new_value >= min_value) && (new_value <= max_value)) {
+ *pval = new_value;
+ break;
+ }
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if (param_read_null(plist, pname) == 0)
+ return 1;
+ e:param_signal_error(plist, pname, code);
+ case 1:
+ ;
}
return code;
}
static int
gsijs_read_bool(gs_param_list *plist, gs_param_name pname, bool *pval,
- bool only_when_closed)
+ bool only_when_closed)
{
int code = 0;
bool new_value;
switch (code = param_read_bool(plist, pname, &new_value)) {
- case 0:
- if (only_when_closed && (new_value != *pval)) {
- code = gs_error_rangecheck;
- goto e;
- }
- *pval = new_value;
- break;
- default:
- if (param_read_null(plist, pname) == 0) {
- return 1;
- }
- e:param_signal_error(plist, pname, code);
- case 1:
- ;
+ case 0:
+ if (only_when_closed && (new_value != *pval)) {
+ code = gs_error_rangecheck;
+ goto e;
+ }
+ *pval = new_value;
+ break;
+ default:
+ if (param_read_null(plist, pname) == 0) {
+ return 1;
+ }
+ e:param_signal_error(plist, pname, code);
+ case 1:
+ ;
}
return code;
}
@@ -1234,21 +1231,21 @@ gsijs_read_string(gs_param_list *plist, gs_param_name pname, char *str,
switch (code = param_read_string(plist, pname, &new_value)) {
case 0:
- differs = bytes_compare(new_value.data, new_value.size,
- (const byte *)str, strlen(str));
- if (safety && differs) {
- code = gs_error_invalidaccess;
- goto e;
- }
- if (only_when_closed && differs) {
- code = gs_error_rangecheck;
- goto e;
- }
+ differs = bytes_compare(new_value.data, new_value.size,
+ (const byte *)str, strlen(str));
+ if (safety && differs) {
+ code = gs_error_invalidaccess;
+ goto e;
+ }
+ if (only_when_closed && differs) {
+ code = gs_error_rangecheck;
+ goto e;
+ }
if (new_value.size < size) {
- strncpy(str, (const char *)new_value.data, new_value.size);
- str[new_value.size+1] = '\0';
+ strncpy(str, (const char *)new_value.data, new_value.size);
+ str[new_value.size+1] = '\0';
break;
- }
+ }
code = gs_note_error(gs_error_rangecheck);
goto e;
default:
@@ -1271,30 +1268,30 @@ gsijs_read_string_malloc(gs_param_list *plist, gs_param_name pname, char **str,
switch (code = param_read_string(plist, pname, &new_value)) {
case 0:
- differs = bytes_compare(new_value.data, new_value.size,
- (const byte *)(*str ? *str : ""),
- *str ? strlen(*str) : 0);
- if (only_when_closed && differs) {
- code = gs_error_rangecheck;
- goto e;
- }
- if (new_value.size + 1 != *size) {
- if (*str)
- gs_free(plist->memory, *str, *size, 1,
- "gsijs_read_string_malloc");
- *str = NULL;
- *size = 0;
- }
- if (*str == NULL)
- *str = gs_malloc(plist->memory, new_value.size + 1, 1,
- "gsijs_read_string_malloc");
- if (*str == NULL) {
+ differs = bytes_compare(new_value.data, new_value.size,
+ (const byte *)(*str ? *str : ""),
+ *str ? strlen(*str) : 0);
+ if (only_when_closed && differs) {
+ code = gs_error_rangecheck;
+ goto e;
+ }
+ if (new_value.size + 1 != *size) {
+ if (*str)
+ gs_free(plist->memory, *str, *size, 1,
+ "gsijs_read_string_malloc");
+ *str = NULL;
+ *size = 0;
+ }
+ if (*str == NULL)
+ *str = gs_malloc(plist->memory, new_value.size + 1, 1,
+ "gsijs_read_string_malloc");
+ if (*str == NULL) {
code = gs_note_error(gs_error_VMerror);
goto e;
- }
- *size = new_value.size + 1;
- strncpy(*str, (const char *)new_value.data, new_value.size);
- (*str)[new_value.size] = '\0';
+ }
+ *size = new_value.size + 1;
+ strncpy(*str, (const char *)new_value.data, new_value.size);
+ (*str)[new_value.size] = '\0';
break;
default:
if (param_read_null(plist, pname) == 0)
@@ -1306,7 +1303,6 @@ gsijs_read_string_malloc(gs_param_list *plist, gs_param_name pname, char **str,
return code;
}
-
static int
gsijs_put_params(gx_device *dev, gs_param_list *plist)
{
@@ -1320,8 +1316,8 @@ gsijs_put_params(gx_device *dev, gs_param_list *plist)
the device has been opened, which is when the -DDuplex
command line is processed. */
if (ijsdev->Duplex_set < 0) {
- ijsdev->Duplex = 1;
- ijsdev->Duplex_set = 0;
+ ijsdev->Duplex = 1;
+ ijsdev->Duplex_set = 0;
}
/* If a parameter must not be changed after the device is open,
@@ -1329,57 +1325,57 @@ gsijs_put_params(gx_device *dev, gs_param_list *plist)
* If a parameter may be changed at any time, it is false.
*/
if (code >= 0)
- code = gsijs_read_string(plist, "IjsServer",
- ijsdev->IjsServer, sizeof(ijsdev->IjsServer),
- dev->LockSafetyParams, is_open);
+ code = gsijs_read_string(plist, "IjsServer",
+ ijsdev->IjsServer, sizeof(ijsdev->IjsServer),
+ dev->LockSafetyParams, is_open);
if (code >= 0)
- code = gsijs_read_string_malloc(plist, "DeviceManufacturer",
- &ijsdev->DeviceManufacturer, &ijsdev->DeviceManufacturer_size,
- is_open);
+ code = gsijs_read_string_malloc(plist, "DeviceManufacturer",
+ &ijsdev->DeviceManufacturer, &ijsdev->DeviceManufacturer_size,
+ is_open);
if (code >= 0)
- code = gsijs_read_string_malloc(plist, "DeviceModel",
- &ijsdev->DeviceModel, &ijsdev->DeviceModel_size,
- is_open);
+ code = gsijs_read_string_malloc(plist, "DeviceModel",
+ &ijsdev->DeviceModel, &ijsdev->DeviceModel_size,
+ is_open);
if (code >= 0)
- code = gsijs_read_string_malloc(plist, "IjsParams",
- &(ijsdev->IjsParams), &(ijsdev->IjsParams_size), is_open);
+ code = gsijs_read_string_malloc(plist, "IjsParams",
+ &(ijsdev->IjsParams), &(ijsdev->IjsParams_size), is_open);
if (code >= 0)
- code = gsijs_read_int(plist, "BitsPerSample", &ijsdev->BitsPerSample,
- 1, 16, is_open);
+ code = gsijs_read_int(plist, "BitsPerSample", &ijsdev->BitsPerSample,
+ 1, 16, is_open);
if (code >= 0)
- code = gsijs_read_bool(plist, "IjsUseOutputFD",
- &ijsdev->IjsUseOutputFD, is_open);
+ code = gsijs_read_bool(plist, "IjsUseOutputFD",
+ &ijsdev->IjsUseOutputFD, is_open);
if (code >= 0) {
- code = gsijs_read_string_malloc(plist, "ProcessColorModel",
- &ijsdev->ColorSpace, &ijsdev->ColorSpace_size, is_open);
+ code = gsijs_read_string_malloc(plist, "ProcessColorModel",
+ &ijsdev->ColorSpace, &ijsdev->ColorSpace_size, is_open);
}
if (code >= 0) {
- code = gsijs_read_bool(plist, "Tumble", &ijsdev->IjsTumble, false);
- if (code == 0)
- ijsdev->IjsTumble_set = true;
+ code = gsijs_read_bool(plist, "Tumble", &ijsdev->IjsTumble, false);
+ if (code == 0)
+ ijsdev->IjsTumble_set = true;
}
if (code >= 0)
- code = gsijs_set_color_format(ijsdev);
+ code = gsijs_set_color_format(ijsdev);
if (code >= 0)
- code = gdev_prn_put_params(dev, plist);
+ code = gdev_prn_put_params(dev, plist);
if (code >= 0 && is_open) {
- code = gsijs_set_generic_params(ijsdev);
- if (code >= 0)
- code = gsijs_set_margin_params(ijsdev);
- if (code < 0)
- return gs_note_error(gs_error_ioerror);
+ code = gsijs_set_generic_params(ijsdev);
+ if (code >= 0)
+ code = gsijs_set_margin_params(ijsdev);
+ if (code < 0)
+ return gs_note_error(gs_error_ioerror);
}
-
+
return code;
}
@@ -1387,10 +1383,10 @@ static int
gsijs_client_set_param(gx_device_ijs *ijsdev, const char *key,
const char *value)
{
- int code = ijs_client_set_param(ijsdev->ctx, 0 /* job id */,
- key, value, strlen(value));
+ int code = ijs_client_set_param(ijsdev->ctx, 0 /* job id */,
+ key, value, strlen(value));
if (code < 0)
- dprintf2("ijs: Can't set parameter %s=%s\n", key, value);
+ dprintf2("ijs: Can't set parameter %s=%s\n", key, value);
return code;
}
@@ -1404,39 +1400,39 @@ gsijs_set_color_format(gx_device_ijs *ijsdev)
const char *ColorSpace = ijsdev->ColorSpace;
if (ColorSpace == NULL)
- ColorSpace = "DeviceRGB";
+ ColorSpace = "DeviceRGB";
if (!strcmp (ColorSpace, "DeviceGray")) {
- components = 1;
- if (bpc == 1) {
- ijsdev->procs.map_rgb_color = gx_default_w_b_map_rgb_color;
- ijsdev->procs.map_color_rgb = gx_default_w_b_map_color_rgb;
- } else {
- ijsdev->procs.map_rgb_color = gx_default_gray_map_rgb_color;
- ijsdev->procs.map_color_rgb = gx_default_gray_map_color_rgb;
- }
- ijsdev->procs.encode_color = gx_default_gray_fast_encode;
- ijsdev->procs.decode_color = gx_default_decode_color;
- dci.polarity = GX_CINFO_POLARITY_ADDITIVE;
- dci.gray_index = 0;
+ components = 1;
+ if (bpc == 1) {
+ ijsdev->procs.map_rgb_color = gx_default_w_b_map_rgb_color;
+ ijsdev->procs.map_color_rgb = gx_default_w_b_map_color_rgb;
+ } else {
+ ijsdev->procs.map_rgb_color = gx_default_gray_map_rgb_color;
+ ijsdev->procs.map_color_rgb = gx_default_gray_map_color_rgb;
+ }
+ ijsdev->procs.encode_color = gx_default_gray_fast_encode;
+ ijsdev->procs.decode_color = gx_default_decode_color;
+ dci.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ dci.gray_index = 0;
} else if (!strcmp (ColorSpace, "DeviceRGB")) {
- components = 3;
- ijsdev->procs.map_rgb_color = gx_default_rgb_map_rgb_color;
- ijsdev->procs.map_color_rgb = gx_default_rgb_map_color_rgb;
- ijsdev->procs.encode_color = gx_default_rgb_map_rgb_color;
- ijsdev->procs.decode_color = gx_default_rgb_map_color_rgb;
- dci.polarity = GX_CINFO_POLARITY_ADDITIVE;
- dci.gray_index = GX_CINFO_COMP_NO_INDEX;
+ components = 3;
+ ijsdev->procs.map_rgb_color = gx_default_rgb_map_rgb_color;
+ ijsdev->procs.map_color_rgb = gx_default_rgb_map_color_rgb;
+ ijsdev->procs.encode_color = gx_default_rgb_map_rgb_color;
+ ijsdev->procs.decode_color = gx_default_rgb_map_color_rgb;
+ dci.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ dci.gray_index = GX_CINFO_COMP_NO_INDEX;
} else if (!strcmp (ColorSpace, "DeviceCMYK")) {
- components = 4;
- ijsdev->procs.map_cmyk_color = cmyk_8bit_map_cmyk_color;
- ijsdev->procs.map_color_rgb = cmyk_8bit_map_color_rgb;
- ijsdev->procs.encode_color = cmyk_8bit_map_cmyk_color;
- ijsdev->procs.decode_color = gx_default_decode_color;
- dci.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
- dci.gray_index = 3;
+ components = 4;
+ ijsdev->procs.map_cmyk_color = cmyk_8bit_map_cmyk_color;
+ ijsdev->procs.map_color_rgb = cmyk_8bit_map_color_rgb;
+ ijsdev->procs.encode_color = cmyk_8bit_map_cmyk_color;
+ ijsdev->procs.decode_color = gx_default_decode_color;
+ dci.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ dci.gray_index = 3;
} else {
- return -1;
+ return -1;
}
maxvalue = (1 << bpc) - 1;
@@ -1450,7 +1446,7 @@ gsijs_set_color_format(gx_device_ijs *ijsdev)
dci.separable_and_linear = GX_CINFO_SEP_LIN;
dci.cm_name = ColorSpace;
-
+
ijsdev->color_info = dci;
set_linear_color_bits_mask_shift((gx_device *)ijsdev);
diff --git a/gs/base/gdevimdi.c b/gs/base/gdevimdi.c
index 0a6522c5b..97587706f 100644
--- a/gs/base/gdevimdi.c
+++ b/gs/base/gdevimdi.c
@@ -1,12 +1,12 @@
/* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
-
+
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
-
+
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -82,10 +82,10 @@ static const gx_device_procs imdi_procs =
const gx_device_imdi gs_imdi_device =
{
prn_device_body(gx_device_imdi, imdi_procs, "imdi",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* Margins */
- 3, 24, 255, 255, 256, 256, imdi_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* Margins */
+ 3, 24, 255, 255, 256, 256, imdi_print_page)
};
static double incurve(void *ctx, int ch, double val)
@@ -111,35 +111,33 @@ imdi_open_device(gx_device *dev)
/* Open and read profile */
- idev->icc_link_profile = gsicc_get_profile_handle_file(LINK_ICC_NAME,
+ idev->icc_link_profile = gsicc_get_profile_handle_file(LINK_ICC_NAME,
strlen(LINK_ICC_NAME), dev->memory);
if (idev->icc_link_profile == NULL)
return gs_throw(-1, "Could not create link profile for imdi device");
if (idev->icc_link_profile->num_comps != 3)
- return gs_throw1(-1, "profile must have 3 input channels. got %d.",
+ return gs_throw1(-1, "profile must have 3 input channels. got %d.",
idev->icc_link_profile->num_comps);
if (idev->icc_link_profile->num_comps_out != 4)
- return gs_throw1(-1, "profile must have 4 output channels. got %d.",
+ return gs_throw1(-1, "profile must have 4 output channels. got %d.",
idev->icc_link_profile->num_comps_out);
-
rendering_params.black_point_comp = false;
rendering_params.object_type = GS_DEVICE_DOESNT_SUPPORT_TAGS; /* Already rendered */
rendering_params.rendering_intent = gsPERCEPTUAL;
-
- idev->icc_link = gscms_get_link(idev->icc_link_profile,
+
+ idev->icc_link = gscms_get_link(idev->icc_link_profile,
NULL, &rendering_params);
if (!idev->icc_link)
- return gs_throw(-1, "could not create ICC link handle");
+ return gs_throw(-1, "could not create ICC link handle");
return gdev_prn_open(dev);
}
-
/*
* Close device and clean up ICC structures.
*/
@@ -155,7 +153,6 @@ imdi_close_device(gx_device *dev)
return gdev_prn_close(dev);
}
-
/*
* Output the page raster.
*/
@@ -193,20 +190,20 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
for (k = 0; k < 4; k++)
{
- char name[256];
+ char name[256];
- sprintf(name, "%s.%c.pgm", pdev->fname, "cmyk"[k]);
+ sprintf(name, "%s.%c.pgm", pdev->fname, "cmyk"[k]);
- dprintf1("output file: %s\n", name);
+ dprintf1("output file: %s\n", name);
- fp[k] = fopen(name, "wb");
- if (!fp[k])
- {
- code = gs_throw2(-1, "could not open file: %s (%s)", name, strerror(errno));
- goto cleanup;
- }
+ fp[k] = fopen(name, "wb");
+ if (!fp[k])
+ {
+ code = gs_throw2(-1, "could not open file: %s (%s)", name, strerror(errno));
+ goto cleanup;
+ }
- fprintf(fp[k], "P5\n%d %d\n255\n", pdev->width, pdev->height);
+ fprintf(fp[k], "P5\n%d %d\n255\n", pdev->width, pdev->height);
}
/*
@@ -218,8 +215,8 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
srcbuffer = gs_malloc(pdev->memory, srcstride, 1, "imdi_print_page(srcbuffer)");
if (!srcbuffer)
{
- code = gs_throw1(-1, "outofmem: src buffer %d", srcstride);
- goto cleanup;
+ code = gs_throw1(-1, "outofmem: src buffer %d", srcstride);
+ goto cleanup;
}
dstplanes = 4;
@@ -227,8 +224,8 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
dstbuffer = gs_malloc(pdev->memory, dststride, 1, "imdi_print_page(dstbuffer)");
if (!dstbuffer)
{
- code = gs_throw1(-1, "outofmem: dst buffer %d", dststride);
- goto cleanup;
+ code = gs_throw1(-1, "outofmem: dst buffer %d", dststride);
+ goto cleanup;
}
/*
@@ -237,66 +234,66 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
for (y = 0; y < pdev->height; y++)
{
- gdev_prn_get_bits(pdev, y, srcbuffer, &srcdata);
+ gdev_prn_get_bits(pdev, y, srcbuffer, &srcdata);
- /* write rgb to original output file */
- fwrite(srcdata, 1, srcstride, prn_stream);
+ /* write rgb to original output file */
+ fwrite(srcdata, 1, srcstride, prn_stream);
#if 1 /* Collect runlengths */
- {
- void *inp[1];
- void *outp[1];
- int sx, ex;
- int w = pdev->width;
+ {
+ void *inp[1];
+ void *outp[1];
+ int sx, ex;
+ int w = pdev->width;
- sx = ex = 0;
+ sx = ex = 0;
- while (sx < w)
- {
- inp[0] = srcdata + sx * 3;
- outp[0] = dstbuffer + sx * 4;
+ while (sx < w)
+ {
+ inp[0] = srcdata + sx * 3;
+ outp[0] = dstbuffer + sx * 4;
- while (ex < w &&
- srcdata[ex * 3 + 0] == srcdata[sx * 3 + 0] &&
- srcdata[ex * 3 + 1] == srcdata[sx * 3 + 1] &&
- srcdata[ex * 3 + 2] == srcdata[sx * 3 + 2])
- {
- ex ++;
- }
+ while (ex < w &&
+ srcdata[ex * 3 + 0] == srcdata[sx * 3 + 0] &&
+ srcdata[ex * 3 + 1] == srcdata[sx * 3 + 1] &&
+ srcdata[ex * 3 + 2] == srcdata[sx * 3 + 2])
+ {
+ ex ++;
+ }
- /* same-run */
- if (ex - sx > 1)
- {
- nsame ++; lsame += ex - sx;
+ /* same-run */
+ if (ex - sx > 1)
+ {
+ nsame ++; lsame += ex - sx;
/* Transform the color */
gscms_transform_color(idev->icc_link, inp,
outp, 1, NULL);
- for (x = sx + 1; x < ex; x++)
- {
- dstbuffer[x * 4 + 0] = dstbuffer[sx * 4 + 0];
- dstbuffer[x * 4 + 1] = dstbuffer[sx * 4 + 1];
- dstbuffer[x * 4 + 2] = dstbuffer[sx * 4 + 2];
- dstbuffer[x * 4 + 3] = dstbuffer[sx * 4 + 3];
- }
- }
-
- /* diff-run */
- else
- {
- ndiff ++;
-
- while (ex < w &&
- srcdata[ex * 3 + 0] != srcdata[ex * 3 - 3] &&
- srcdata[ex * 3 + 1] != srcdata[ex * 3 - 2] &&
- srcdata[ex * 3 + 2] != srcdata[ex * 3 - 1])
- {
- ex ++;
- }
-
- ldiff += ex - sx;
+ for (x = sx + 1; x < ex; x++)
+ {
+ dstbuffer[x * 4 + 0] = dstbuffer[sx * 4 + 0];
+ dstbuffer[x * 4 + 1] = dstbuffer[sx * 4 + 1];
+ dstbuffer[x * 4 + 2] = dstbuffer[sx * 4 + 2];
+ dstbuffer[x * 4 + 3] = dstbuffer[sx * 4 + 3];
+ }
+ }
+
+ /* diff-run */
+ else
+ {
+ ndiff ++;
+
+ while (ex < w &&
+ srcdata[ex * 3 + 0] != srcdata[ex * 3 - 3] &&
+ srcdata[ex * 3 + 1] != srcdata[ex * 3 - 2] &&
+ srcdata[ex * 3 + 2] != srcdata[ex * 3 - 1])
+ {
+ ex ++;
+ }
+
+ ldiff += ex - sx;
/* This needs to be done more efficiently */
@@ -311,20 +308,20 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
gscms_transform_color_buffer(idev->icc_link, &input_buff_desc,
&output_buff_desc, inp, outp);
- }
+ }
- sx = ex;
- }
- }
+ sx = ex;
+ }
+ }
#endif
#if 0 /* Call IMDI for entire scanline */
- void *inp[1];
- void *outp[1];
+ void *inp[1];
+ void *outp[1];
- inp[0] = srcdata;
- outp[0] = dstbuffer;
+ inp[0] = srcdata;
+ outp[0] = dstbuffer;
gsicc_init_buffer(&input_buff_desc, 3, 1,
false, false, false, 0, width*3,
@@ -337,66 +334,62 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
gscms_transform_color_buffer(idev->icc_link, &input_buff_desc,
&output_buff_desc, inp, outp);
-
-
#if 0
- /* output planar data to auxiliary output files */
- for (x = 0; x < pdev->width; x++)
- for (k = 0; k < 4; k++)
- putc(dstbuffer[x * 4 + k], fp[k]);
+ /* output planar data to auxiliary output files */
+ for (x = 0; x < pdev->width; x++)
+ for (k = 0; k < 4; k++)
+ putc(dstbuffer[x * 4 + k], fp[k]);
#endif
#endif
#if 0 /* Call IMDI for every pixel */
- for (x = 0; x < pdev->width; x++)
- {
- void *inp[1];
- void *outp[1];
+ for (x = 0; x < pdev->width; x++)
+ {
+ void *inp[1];
+ void *outp[1];
- inp[0] = srcdata + x * 3;
- outp[0] = dstbuffer + x * 4;
+ inp[0] = srcdata + x * 3;
+ outp[0] = dstbuffer + x * 4;
/* Transform the color */
gscms_transform_color(idev->icc_link, inp,
outp, 1, NULL);
-
- /* output planar data to auxiliary output files */
- for (k = 0; k < 4; k++)
- putc(dstbuffer[x * 4 + k], fp[k]);
- }
+ /* output planar data to auxiliary output files */
+ for (k = 0; k < 4; k++)
+ putc(dstbuffer[x * 4 + k], fp[k]);
+ }
#endif
#if 0 /* Slow but accurate every pixel */
- for (x = 0; x < pdev->width; x++)
- {
- srcpixel[0] = srcdata[x * 3 + 0] / 255.0;
- srcpixel[1] = srcdata[x * 3 + 1] / 255.0;
- srcpixel[2] = srcdata[x * 3 + 2] / 255.0;
-
- code = idev->luo->lookup(idev->luo, dstpixel, srcpixel);
- if (code > 1)
- {
- code = gs_throw1(-1, "icc lookup failed: %s", idev->icco->err);
- goto cleanup;
- }
-
- dstbuffer[x * 4 + 0] = dstpixel[0] * 255 + 0.5;
- dstbuffer[x * 4 + 1] = dstpixel[1] * 255 + 0.5;
- dstbuffer[x * 4 + 2] = dstpixel[2] * 255 + 0.5;
- dstbuffer[x * 4 + 3] = dstpixel[3] * 255 + 0.5;
-
- /* output planar data to auxiliary output files */
- for (k = 0; k < 4; k++)
- putc(dstbuffer[x * 4 + k], fp[k]);
- }
+ for (x = 0; x < pdev->width; x++)
+ {
+ srcpixel[0] = srcdata[x * 3 + 0] / 255.0;
+ srcpixel[1] = srcdata[x * 3 + 1] / 255.0;
+ srcpixel[2] = srcdata[x * 3 + 2] / 255.0;
+
+ code = idev->luo->lookup(idev->luo, dstpixel, srcpixel);
+ if (code > 1)
+ {
+ code = gs_throw1(-1, "icc lookup failed: %s", idev->icco->err);
+ goto cleanup;
+ }
+
+ dstbuffer[x * 4 + 0] = dstpixel[0] * 255 + 0.5;
+ dstbuffer[x * 4 + 1] = dstpixel[1] * 255 + 0.5;
+ dstbuffer[x * 4 + 2] = dstpixel[2] * 255 + 0.5;
+ dstbuffer[x * 4 + 3] = dstpixel[3] * 255 + 0.5;
+
+ /* output planar data to auxiliary output files */
+ for (k = 0; k < 4; k++)
+ putc(dstbuffer[x * 4 + k], fp[k]);
+ }
#endif
}
dprintf4("same=%d/%d diff=%d/%d\n", lsame, nsame, ldiff, ndiff);
-
/*
* Cleanup memory and files.
*/
@@ -404,15 +397,14 @@ imdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
cleanup:
for (k = 0; k < 4; k++)
- if (fp[k])
- fclose(fp[k]);
+ if (fp[k])
+ fclose(fp[k]);
if (dstbuffer)
- gs_free(pdev->memory, dstbuffer, dststride, 1, "imdi_print_page(dstbuffer)");
+ gs_free(pdev->memory, dstbuffer, dststride, 1, "imdi_print_page(dstbuffer)");
if (srcbuffer)
- gs_free(pdev->memory, srcbuffer, srcstride, 1, "imdi_print_page(srcbuffer)");
+ gs_free(pdev->memory, srcbuffer, srcstride, 1, "imdi_print_page(srcbuffer)");
return code;
}
-
diff --git a/gs/base/gdevimgn.c b/gs/base/gdevimgn.c
index dda26e9bb..2f4ab26d7 100644
--- a/gs/base/gdevimgn.c
+++ b/gs/base/gdevimgn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -9,7 +9,7 @@
license. Refer to licensing information at http://www.artifex.com/
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
-*/
+*/
/* $Id$*/
/*
* Imagen ImPRESS printer driver - version 1.4
@@ -19,7 +19,7 @@
/* Written by Alan Millar (AMillar@bolis.sf-bay.org) August 4 1992.
Basic bitmap dump. */
-/* Updated by Alan Millar Sept 21 1992. Added resolution handling
+/* Updated by Alan Millar Sept 21 1992. Added resolution handling
for 75, 150, and 300 dpi. */
/* Updated by Alan Millar June 05 1993. General cleanup for
beta test release. */
@@ -27,18 +27,18 @@
output into single imPress document. Quote fewer special
chars in byte stream mode. imPress document header options
can be set from environment variable IMPRESSHEADER */
-/* Updated by Alan Millar July 04 1993. v1.4.
+/* Updated by Alan Millar July 04 1993. v1.4.
New makefile option USE_BYTE_STREAM instead of changing source.
Swatch output redone to eliminate ALL blank swatches (swatchMap).
Buffer copying changed to multi-byte operations (BIGTYPE).
Page margins and A4 paper settings fixed, at least for Canon CX.
*/
-/* -------------------------------------------------------- */
-/* Instructions:
+/* -------------------------------------------------------- */
+/* Instructions:
- Add "imagen.dev" to DEVICE_DEVS in the makefile. For example:
- DEVICE_DEVS2=laserjet.dev imagen.dev
+ DEVICE_DEVS2=laserjet.dev imagen.dev
- Include or exclude USE_BYTE_STREAM in makefile as appropriate
If you are compiling on Unix, re-run "tar_cat" to update the makefile
@@ -49,7 +49,7 @@
- At run time, specify any imPress document options in
the IMPRESSHEADER environment variable.
*/
-
+
/* -------------------------------------------------------- */
/* Hardware/software combinations tested:
- ImageStation IP3 8/300 with parallel byte-stream interface,
@@ -59,28 +59,28 @@
*/
/* -------------------------------------------------------- */
/* Bugs/Enhancements:
- - Driver does not use any Impress language features for
+ - Driver does not use any Impress language features for
drawing lines/arcs
- Driver does not use resident or downloadable fonts.
- Buffer output instead of system call for each byte?
*/
-
-/* -------------------------------------------------------- */
-#include "gdevprn.h"
-#include "gxobj.h"
+
+/* -------------------------------------------------------- */
+#include "gdevprn.h"
+#include "gxobj.h"
/* #include <stdio.h> should not be used in drivers */
#include <stdlib.h>
-
-/* -------------------------------------------------------- */
+
+/* -------------------------------------------------------- */
/* Working Constants */
/* Byte stream quoting: convert special characters to hex.
Specify by including/excluding -DUSE_BYTE_STREAM in makefile.
This should match printer's hardware interface configuration.
- If printer interface is serial with sequenced-packet-protocol
+ If printer interface is serial with sequenced-packet-protocol
spooler software (ImageStation config# 11 = 01), then don't use it.
Imagen "ipr" spooler software should not use byte stream.
- If printer interface is Centronics parallel byte stream,
+ If printer interface is Centronics parallel byte stream,
(ImageStation config# 11 = 03), then use byte stream. */
#ifdef USE_BYTE_STREAM
@@ -93,7 +93,7 @@
Only needed when using byte stream */
#define QUOTE_CHAR (char) 0x02
/* Byte stream end-of-file character (ImageStation config# 14). */
-#define EOF_CHAR (char) 0x04
+#define EOF_CHAR (char) 0x04
/* Other special characters to quote. Put them here if spooler or
hardware uses flow control, etc. If not needed, set to
a redundant value such as EOF_CHAR */
@@ -102,39 +102,39 @@
#define EXTRA_QUOTE3 EOF_CHAR
#define EXTRA_QUOTE4 EOF_CHAR
-/* -------------------------------------------------------- */
-/* imPress header default options.
+/* -------------------------------------------------------- */
+/* imPress header default options.
Can be overridden at run-time with IMPRESSHEADER env variable */
#define IMPRESSHEADER "jobheader onerror, prerasterization off"
-/* -------------------------------------------------------- */
+/* -------------------------------------------------------- */
#define CANON_CX
-/* Printer engine max resolution. 300 for Canon CX models such as
- ImageStation IP3. Others (240?) unverified */
+/* Printer engine max resolution. 300 for Canon CX models such as
+ ImageStation IP3. Others (240?) unverified */
#ifdef CANON_CX
-# define MAX_DPI 300
+# define MAX_DPI 300
#endif
#ifndef MAX_DPI
-# define MAX_DPI 300
+# define MAX_DPI 300
#endif
-/* Determine imPress scaling factor from GS resolution.
- Magnify can be 0, 1, or 2.
- 0 = MAX_DPI, 1 = MAX_DPI / 2, 2 = MAX_DPI / 4
+/* Determine imPress scaling factor from GS resolution.
+ Magnify can be 0, 1, or 2.
+ 0 = MAX_DPI, 1 = MAX_DPI / 2, 2 = MAX_DPI / 4
Assuming MAX_DPI is 300, you can specify -r75 or -r150
- or -r300 on the GS command line */
+ or -r300 on the GS command line */
#define getMagnification ( \
( pdev->x_pixels_per_inch > (MAX_DPI >> 1) ) ? 0 : \
( pdev->x_pixels_per_inch > (MAX_DPI >> 2) ) ? 1 : \
2 )
-
-/* Page dimensions from gdevprn.h - specify -DA4 in makefile for A4 paper */
+
+/* Page dimensions from gdevprn.h - specify -DA4 in makefile for A4 paper */
#define WIDTH_10THS DEFAULT_WIDTH_10THS
#define HEIGHT_10THS DEFAULT_HEIGHT_10THS
-
+
/* Width in inches of unprintable edge of paper. May need fine tuning.
Canon CX engine in ImageStation IP3 8/300 will only print 8 inches
wide on any paper size. May vary for other engines */
@@ -149,28 +149,27 @@
#ifndef MARG_R
# define MARG_R 0.2
#endif
-#define MARG_T 0.1
-#define MARG_B 0.2
-
+#define MARG_T 0.1
+#define MARG_B 0.2
/* Flag for displaying debug messages at run-time. Higher
- number = higher detail */
+ number = higher detail */
#define IM_DEBUG 0
#define DebugMsg(Level,P1,P2) if (Level<=IM_DEBUG) {errprintf_nomem(P1,P2 );}
-/*-------------------------------------------*/
- /* Impress bitmaps are made up of 32x32 bit swatches.
+/*-------------------------------------------*/
+ /* Impress bitmaps are made up of 32x32 bit swatches.
A swatch is four bytes (32 bits) wide by 32 bytes high,
totalling 128 bytes. */
#define HorzBytesPerSw 4
#define HorzBitsPerSw (HorzBytesPerSw * 8)
#define VertBytesPerSw 32
#define TotalBytesPerSw (HorzBytesPerSw * VertBytesPerSw)
-
-/*-------------------------------------------*/
-/* Attempt at optimization to something faster than byte-by-byte copying.
- imPress swatches are 4 bytes wide, so type must align on a 4-byte
- boundary. Swatch interleaving restricts the copy to 4 bytes in a row.
+
+/*-------------------------------------------*/
+/* Attempt at optimization to something faster than byte-by-byte copying.
+ imPress swatches are 4 bytes wide, so type must align on a 4-byte
+ boundary. Swatch interleaving restricts the copy to 4 bytes in a row.
Type must be numeric where value is zero when all bytes in it are zero. */
#if arch_sizeof_long == 4
# define BIGTYPE unsigned long int
@@ -189,93 +188,93 @@
#define BIGSIZE ( sizeof( BIGTYPE ) )
-/*-------------------------------------------*/
-/* IMAGEN imPress Command opcodes */
-/* from DVIIMP.C */
-#define iSP 128 /* advance one space */
-#define iSP1 129 /* advance one space + 1 pixel */
-#define iMPLUS 131 /* Move one pixel forward */
-#define iMMINUS 132 /* Move one pixel back */
-#define iMMOVE 133 /* Move in main advance direction */
-#define iSMOVE 134 /* Move in secondary advance direction */
-
-#define iABS_H 135 /* Move to H position */
-#define iREL_H 136 /* Move in H direction */
-#define iABS_V 137 /* Move to V position */
-#define iREL_V 138 /* Move in V direction */
-
-#define iCRLF 197 /* move to beginning of next line */
-
-#define iSET_HV_SYSTEM 205 /* Define new coordinate system */
-#define iSET_ADV_DIRS 206 /* Define advance directions */
-
-#define iPAGE 213 /* Set H and V to 0 */
-#define iENDPAGE 219 /* print the current page */
-
-#define iBITMAP 235 /* Print a full bitmap */
-#define iSET_MAGNIFICATION 236
- /* magnify the page by 1, 2, 4 */
-#define iNOOP 254 /* no operation */
-#define iEOF 255 /* end of impress document */
-
-/*-------------------------------------------*/
-/*-------------------------------------------*/
-/* The device descriptor */
-
-static dev_proc_print_page(imagen_print_page);
+/*-------------------------------------------*/
+/* IMAGEN imPress Command opcodes */
+/* from DVIIMP.C */
+#define iSP 128 /* advance one space */
+#define iSP1 129 /* advance one space + 1 pixel */
+#define iMPLUS 131 /* Move one pixel forward */
+#define iMMINUS 132 /* Move one pixel back */
+#define iMMOVE 133 /* Move in main advance direction */
+#define iSMOVE 134 /* Move in secondary advance direction */
+
+#define iABS_H 135 /* Move to H position */
+#define iREL_H 136 /* Move in H direction */
+#define iABS_V 137 /* Move to V position */
+#define iREL_V 138 /* Move in V direction */
+
+#define iCRLF 197 /* move to beginning of next line */
+
+#define iSET_HV_SYSTEM 205 /* Define new coordinate system */
+#define iSET_ADV_DIRS 206 /* Define advance directions */
+
+#define iPAGE 213 /* Set H and V to 0 */
+#define iENDPAGE 219 /* print the current page */
+
+#define iBITMAP 235 /* Print a full bitmap */
+#define iSET_MAGNIFICATION 236
+ /* magnify the page by 1, 2, 4 */
+#define iNOOP 254 /* no operation */
+#define iEOF 255 /* end of impress document */
+
+/*-------------------------------------------*/
+/*-------------------------------------------*/
+/* The device descriptor */
+
+static dev_proc_print_page(imagen_print_page);
static dev_proc_open_device(imagen_prn_open);
static dev_proc_close_device(imagen_prn_close);
gx_device_procs imagen_procs =
- prn_procs(imagen_prn_open, gdev_prn_output_page, imagen_prn_close);
+ prn_procs(imagen_prn_open, gdev_prn_output_page, imagen_prn_close);
#define ppdev ((gx_device_printer *)pdev)
-/*-------------------------------------------*/
-const gx_device_printer far_data gs_imagen_device =
+/*-------------------------------------------*/
+const gx_device_printer far_data gs_imagen_device =
prn_device(/*prn_std_procs*/ imagen_procs,
- "imagen",
- WIDTH_10THS,
- HEIGHT_10THS,
- MAX_DPI, /* x_dpi */
- MAX_DPI, /* y_dpi */
- MARG_L,MARG_R,MARG_T,MARG_B, /* margins */
- 1, imagen_print_page);
-
-/*-------------------------------------------*/
-
-/*-------------------------------------------*/
-static void
-iWrite(FILE *Out, byte Val)
-{ /* iWrite */
- const char *hexList = "0123456789ABCDEF";
-
+ "imagen",
+ WIDTH_10THS,
+ HEIGHT_10THS,
+ MAX_DPI, /* x_dpi */
+ MAX_DPI, /* y_dpi */
+ MARG_L,MARG_R,MARG_T,MARG_B, /* margins */
+ 1, imagen_print_page);
+
+/*-------------------------------------------*/
+
+/*-------------------------------------------*/
+static void
+iWrite(FILE *Out, byte Val)
+{ /* iWrite */
+ const char *hexList = "0123456789ABCDEF";
+
/* if we are doing byte-stream, quote characters that would otherwise
match EOF and QUOTE itself, or other special chars */
/* Imagen quoting takes one character and writes out the QUOTE
character followed by the hex digits of the quoted character */
- if (BYTE_STREAM &&
+ if (BYTE_STREAM &&
( Val == QUOTE_CHAR || Val == EOF_CHAR
|| Val == EXTRA_QUOTE1 || Val == EXTRA_QUOTE2
- || Val == EXTRA_QUOTE3 || Val == EXTRA_QUOTE4 ) ) {
- fputc (QUOTE_CHAR, Out);
- fputc ((char) hexList[Val / 0x10], Out);
- fputc ((char) hexList[Val % 0x10], Out);
- } else { /* quoted char */
+ || Val == EXTRA_QUOTE3 || Val == EXTRA_QUOTE4 ) ) {
+ fputc (QUOTE_CHAR, Out);
+ fputc ((char) hexList[Val / 0x10], Out);
+ fputc ((char) hexList[Val % 0x10], Out);
+ } else { /* quoted char */
/* Not doing quoting, just send it out */
- fputc(Val, Out);
- } /* quoted char */
-} /* iWrite */
-
-/* Write out 16bit, high byte first */
-static void
-iWrite2(FILE *Out, int Val)
-{ /* iWrite2 */
- iWrite(Out,(byte) (Val >> 8) & 0x00FF );
- iWrite(Out,(byte) Val & 0x00FF );
-} /* iWrite2 */
-
-/* --------------------------------------------------------- */
+ fputc(Val, Out);
+ } /* quoted char */
+} /* iWrite */
+
+/* Write out 16bit, high byte first */
+static void
+iWrite2(FILE *Out, int Val)
+{ /* iWrite2 */
+ iWrite(Out,(byte) (Val >> 8) & 0x00FF );
+ iWrite(Out,(byte) Val & 0x00FF );
+} /* iWrite2 */
+
+/* --------------------------------------------------------- */
static int
imagen_prn_open(gx_device *pdev)
@@ -302,8 +301,8 @@ imagen_prn_open(gx_device *pdev)
impHeader = IMPRESSHEADER ;
} /* if impHeader */
- fprintf(ppdev->file,"@document(language impress, %s)",impHeader);
-
+ fprintf(ppdev->file,"@document(language impress, %s)",impHeader);
+
code = gdev_prn_close_printer(pdev);
if ( code < 0 ) return code;
@@ -325,16 +324,16 @@ imagen_prn_close(gx_device *pdev)
if ( code < 0 ) return code;
/* Write imPress end of document marker */
- iWrite(ppdev->file,iEOF);
+ iWrite(ppdev->file,iEOF);
/* And byte stream end of file */
- if (BYTE_STREAM) {
+ if (BYTE_STREAM) {
/* DON'T use iWrite because actual EOF should not be quoted! */
- fputc(EOF_CHAR,ppdev->file);
- } /* if byte stream */
+ fputc(EOF_CHAR,ppdev->file);
+ } /* if byte stream */
fflush(ppdev->file);
-
+
code = gdev_prn_close_printer(pdev);
if ( code < 0 ) return code;
@@ -345,35 +344,35 @@ imagen_prn_close(gx_device *pdev)
return(code);
} /* imagen_prn_close */
-/*-------------------------------------------*/
-/* Send the page to the printer. */
-static int
-imagen_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+/*-------------------------------------------*/
+/* Send the page to the printer. */
+static int
+imagen_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
const int align_size = obj_align_round((line_size/BIGSIZE)+1);
/* input buffer: one line of bytes rasterized by gs */
- byte *in = (byte *)gs_malloc(pdev->memory, BIGSIZE, align_size, "imagen_print_page(in)");
+ byte *in = (byte *)gs_malloc(pdev->memory, BIGSIZE, align_size, "imagen_print_page(in)");
/* output buffer: 32 lines, interleaved into imPress swatches */
- byte *out;
- /* working pointer into output buffer */
- byte *swatch;
+ byte *out;
+ /* working pointer into output buffer */
+ byte *swatch;
byte *temp;
/* map of which swatches in a row are completely blank, or are non-blank */
byte *swatchMap;
/* starting line number on page of a row of swatches */
- int lnum ;
+ int lnum ;
/* line number within a row of swatches */
- int swatchLine;
+ int swatchLine;
/* ending line number of row of swatches */
- int lastLine;
+ int lastLine;
/* how many swatches can fit on a row */
- int swatchCount;
+ int swatchCount;
/* index into row of non-blank swatch */
- int startSwatch;
- int endSwatch;
+ int startSwatch;
+ int endSwatch;
/* Scaling factor for resolution */
- int Magnify;
+ int Magnify;
/* page totals */
int totalBlankSwatches;
int totalGreySwatches;
@@ -385,175 +384,175 @@ imagen_print_page(gx_device_printer *pdev, FILE *prn_stream)
DebugMsg(1,"%s\n","Start of imagen_print_page");
/* ----------------------------------------- */
- Magnify = getMagnification ;
-
- /* Impress bitmaps are made up of 32x32 bit swatches.
- A swatch is four bytes wide by 32 bytes high.
- See how many swatches will fit horizontally. */
-
- swatchCount = (line_size + HorzBytesPerSw - 1) / HorzBytesPerSw;
+ Magnify = getMagnification ;
+
+ /* Impress bitmaps are made up of 32x32 bit swatches.
+ A swatch is four bytes wide by 32 bytes high.
+ See how many swatches will fit horizontally. */
+
+ swatchCount = (line_size + HorzBytesPerSw - 1) / HorzBytesPerSw;
totalBlankSwatches = 0 ;
totalGreySwatches = 0 ;
DebugMsg(2,"Swatch count = %d\n",swatchCount);
DebugMsg(2,"Line size = %d\n",line_size );
- out = (byte *)gs_malloc(pdev->memory, TotalBytesPerSw , swatchCount + 1,
- "imagen_print_page(out)");
+ out = (byte *)gs_malloc(pdev->memory, TotalBytesPerSw , swatchCount + 1,
+ "imagen_print_page(out)");
swatchMap = (byte *)gs_malloc(pdev->memory, BIGSIZE,swatchCount / BIGSIZE + 1,
- "imagen_print_page(swatchMap)" );
-
- if ( in == 0 || out == 0 )
- return -1;
-
- /* Initialize the page */
- iWrite(prn_stream,iPAGE);
-
+ "imagen_print_page(swatchMap)" );
+
+ if ( in == 0 || out == 0 )
+ return -1;
+
+ /* Initialize the page */
+ iWrite(prn_stream,iPAGE);
+
/* Tell ImPress what resolution we will be using */
- iWrite(prn_stream,iSET_MAGNIFICATION);
- iWrite(prn_stream,Magnify);
-
+ iWrite(prn_stream,iSET_MAGNIFICATION);
+ iWrite(prn_stream,Magnify);
+
/*------------------------------------------------------*/
- /* main loop down page */
+ /* main loop down page */
lnum = 0;
- while (lnum <= pdev->height) {
-
- /* erase swatch map. */
- for (swatch = swatchMap; swatch < swatchMap + swatchCount ;
- swatch += BIGSIZE ) {
- * (BIGTYPE *)swatch = (BIGTYPE) 0;
- } /* for */
-
- /* get scan lines to fill swatches */
- swatchLine = 0;
- lastLine = VertBytesPerSw - 1;
+ while (lnum <= pdev->height) {
+
+ /* erase swatch map. */
+ for (swatch = swatchMap; swatch < swatchMap + swatchCount ;
+ swatch += BIGSIZE ) {
+ * (BIGTYPE *)swatch = (BIGTYPE) 0;
+ } /* for */
+
+ /* get scan lines to fill swatches */
+ swatchLine = 0;
+ lastLine = VertBytesPerSw - 1;
/* Check if we don't have a full-height row of swatches at end of page */
if (lnum + lastLine > pdev->height ) {
/* back up last row so it overlaps with previous. Not a problem
- on a laser printer, because the overlapping part will be identical */
- lnum = pdev->height - lastLine ;
+ on a laser printer, because the overlapping part will be identical */
+ lnum = pdev->height - lastLine ;
}; /* not full height */
-
+
DebugMsg (3,"lnum = %d \n",lnum);
/* ------------------------------------------------------- */
- /* get 32 lines and interleave into a row of swatches */
- for (swatchLine = 0 ; swatchLine <= lastLine; swatchLine++) {
+ /* get 32 lines and interleave into a row of swatches */
+ for (swatchLine = 0 ; swatchLine <= lastLine; swatchLine++) {
/* blank out end of buffer for BIGSIZE overlap */
for (temp = in + line_size; temp < in + align_size*BIGSIZE; temp++){
- *temp = 0;
+ *temp = 0;
} /* for temp */
- /* get one line */
- gdev_prn_copy_scan_lines(pdev, lnum + swatchLine, in, line_size);
+ /* get one line */
+ gdev_prn_copy_scan_lines(pdev, lnum + swatchLine, in, line_size);
DebugMsg(5,"Got scan line %d ", lnum + swatchLine);
- DebugMsg(5,"line %d \n", swatchLine);
-
- /* interleave scan line into swatch buffer */
- /* a swatch is a 4 byte * 32 byte square. Swatches are placed
- next to each other. The first scan line maps into the first
- four bytes of the first swatch, then the first four of the second
- swatch, etc.
- To get this on the page:
- A1 A1 A1 A1 B1 B1 B1 B1 C1 C1 C1 C1
- A2 A2 A2 A2 B2 B2 B2 B2 C2 C2 C2 C2
- ...
- A32 A32 A32 A32 B32 B32 B32 B32 C32 C32 C32 C32
- You have to send it as:
- A1 A1 A1 A1 A2 ... A32 B1 B1 .. B32 C1 C1 ... C32 */
-
- /* set initial offset into swatch buffer based on which
- line in the swatch we are processing */
- swatch = out + swatchLine * HorzBytesPerSw;
+ DebugMsg(5,"line %d \n", swatchLine);
+
+ /* interleave scan line into swatch buffer */
+ /* a swatch is a 4 byte * 32 byte square. Swatches are placed
+ next to each other. The first scan line maps into the first
+ four bytes of the first swatch, then the first four of the second
+ swatch, etc.
+ To get this on the page:
+ A1 A1 A1 A1 B1 B1 B1 B1 C1 C1 C1 C1
+ A2 A2 A2 A2 B2 B2 B2 B2 C2 C2 C2 C2
+ ...
+ A32 A32 A32 A32 B32 B32 B32 B32 C32 C32 C32 C32
+ You have to send it as:
+ A1 A1 A1 A1 A2 ... A32 B1 B1 .. B32 C1 C1 ... C32 */
+
+ /* set initial offset into swatch buffer based on which
+ line in the swatch we are processing */
+ swatch = out + swatchLine * HorzBytesPerSw;
DebugMsg(5,"offset: swatch = %d \n",(int) (swatch - out) );
- temp = in;
- while ( temp < in + line_size ) {
- /* copy multi-byte to swatch buffer */
- * (BIGTYPE *)swatch = * (BIGTYPE *)temp;
- if ( * (BIGTYPE *)temp ) {
- /* mark map if not blank */
- swatchMap[(swatch - out)/TotalBytesPerSw] = (byte) 1 ;
- } /* if not zero */
-
- temp += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
- swatch += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
-
- /* if we copied four bytes, skip to next swatch */
- if ( ((temp - in) % HorzBytesPerSw ) == 0 ) {
- swatch += (TotalBytesPerSw - HorzBytesPerSw) ;
- } /* if need to skip */
- } /* while < line_size */
-
- } /* for swatchLine */
-
+ temp = in;
+ while ( temp < in + line_size ) {
+ /* copy multi-byte to swatch buffer */
+ * (BIGTYPE *)swatch = * (BIGTYPE *)temp;
+ if ( * (BIGTYPE *)temp ) {
+ /* mark map if not blank */
+ swatchMap[(swatch - out)/TotalBytesPerSw] = (byte) 1 ;
+ } /* if not zero */
+
+ temp += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
+ swatch += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
+
+ /* if we copied four bytes, skip to next swatch */
+ if ( ((temp - in) % HorzBytesPerSw ) == 0 ) {
+ swatch += (TotalBytesPerSw - HorzBytesPerSw) ;
+ } /* if need to skip */
+ } /* while < line_size */
+
+ } /* for swatchLine */
+
/* ------------------------------------------------- */
- /* we now have full swatches. */
- /* Send to printer */
-
+ /* we now have full swatches. */
+ /* Send to printer */
+
/* go through swatch map to find non-blank swatches.
- Skip over completely blank swatches */
+ Skip over completely blank swatches */
startSwatch = 0;
while (startSwatch < swatchCount ) {
if (swatchMap[startSwatch] == 0 ) {
- /* skip blank swatch */
- DebugMsg(6,"Skip blank %d \n",startSwatch);
- totalBlankSwatches++;
- startSwatch++;
+ /* skip blank swatch */
+ DebugMsg(6,"Skip blank %d \n",startSwatch);
+ totalBlankSwatches++;
+ startSwatch++;
} else { /* if swatch == 0 */
- /* we hit a non-blank swatch. */
- totalGreySwatches++;
-
- /* See how many there are in a row */
- endSwatch = startSwatch;
- while ( (endSwatch < swatchCount) && swatchMap[endSwatch] ) {
- endSwatch++;
- totalGreySwatches++;
- } /* while */
- /* endSwatch is one past last non-blank swatch */
- DebugMsg(6,"Grey swatches %d ",startSwatch);
- DebugMsg(6,"until %d \n",endSwatch);
-
- /* vertical position: scan line, shifted for magnification */
- iWrite(prn_stream, iABS_V);
- iWrite2(prn_stream, lnum << Magnify);
-
- /* horizontal position = swatch number * 32 bits/swatch */
- iWrite(prn_stream,iABS_H);
- iWrite2(prn_stream, startSwatch * HorzBitsPerSw << Magnify );
- iWrite(prn_stream,iBITMAP); /* start bitmap */
- iWrite(prn_stream,0x07); /* bit OR with page */
- iWrite(prn_stream,(endSwatch - startSwatch)); /* horizontal
- number of swatches */
- iWrite(prn_stream, 1) ; /* vertical number of swatches */
- /* write out swatch buffer */
- for (swatch = out + startSwatch * TotalBytesPerSw;
- swatch < out + endSwatch * TotalBytesPerSw; swatch++) {
- iWrite(prn_stream,*swatch);
- } /* for swatch */
-
- /* swatches have been printed, see if there are still
- more in this row */
- startSwatch = endSwatch;
+ /* we hit a non-blank swatch. */
+ totalGreySwatches++;
+
+ /* See how many there are in a row */
+ endSwatch = startSwatch;
+ while ( (endSwatch < swatchCount) && swatchMap[endSwatch] ) {
+ endSwatch++;
+ totalGreySwatches++;
+ } /* while */
+ /* endSwatch is one past last non-blank swatch */
+ DebugMsg(6,"Grey swatches %d ",startSwatch);
+ DebugMsg(6,"until %d \n",endSwatch);
+
+ /* vertical position: scan line, shifted for magnification */
+ iWrite(prn_stream, iABS_V);
+ iWrite2(prn_stream, lnum << Magnify);
+
+ /* horizontal position = swatch number * 32 bits/swatch */
+ iWrite(prn_stream,iABS_H);
+ iWrite2(prn_stream, startSwatch * HorzBitsPerSw << Magnify );
+ iWrite(prn_stream,iBITMAP); /* start bitmap */
+ iWrite(prn_stream,0x07); /* bit OR with page */
+ iWrite(prn_stream,(endSwatch - startSwatch)); /* horizontal
+ number of swatches */
+ iWrite(prn_stream, 1) ; /* vertical number of swatches */
+ /* write out swatch buffer */
+ for (swatch = out + startSwatch * TotalBytesPerSw;
+ swatch < out + endSwatch * TotalBytesPerSw; swatch++) {
+ iWrite(prn_stream,*swatch);
+ } /* for swatch */
+
+ /* swatches have been printed, see if there are still
+ more in this row */
+ startSwatch = endSwatch;
} /* if swatch == 0 */
} /* while startSwatch */
-
+
/* Whole row of swatches is done. Go on to next row of swatches */
- lnum += lastLine + 1;
-
- } /* while lnum */
-
- /* Eject the page */
- iWrite(prn_stream,iENDPAGE);
-
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)out, TotalBytesPerSw, swatchCount+1, "imagen_print_page(out)");
+ lnum += lastLine + 1;
+
+ } /* while lnum */
+
+ /* Eject the page */
+ iWrite(prn_stream,iENDPAGE);
+
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)out, TotalBytesPerSw, swatchCount+1, "imagen_print_page(out)");
gs_free(pdev->memory, (char *)swatchMap, BIGSIZE, swatchCount / BIGSIZE + 1,
- "imagen_print_page(swatchMap)" );
+ "imagen_print_page(swatchMap)" );
gs_free(pdev->memory, (char *)in, BIGSIZE, align_size, "imagen_print_page(in)");
/* ----------------------------------------- */
@@ -562,6 +561,6 @@ imagen_print_page(gx_device_printer *pdev, FILE *prn_stream)
DebugMsg(1,"%s\n","End of imagen_print_page");
/* ----------------------------------------- */
- return 0;
-
-} /* imagen_print_page */
+ return 0;
+
+} /* imagen_print_page */
diff --git a/gs/base/gdevjbig2.c b/gs/base/gdevjbig2.c
index 5daa67f76..f730fe3e6 100644
--- a/gs/base/gdevjbig2.c
+++ b/gs/base/gdevjbig2.c
@@ -19,7 +19,6 @@
#include "strimpl.h"
#include "sjbig2_luratech.h"
-
/* Structure for the JBIG2-writing device. */
typedef struct gx_device_jbig2_s {
gx_device_common;
@@ -45,11 +44,10 @@ static dev_proc_print_page(jbig2_print_page);
const gx_device_printer gs_gdevjbig2_device =
prn_device(prn_std_procs, "jbig2",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* resolution */
- 0, 0, 0, 0, /* margins */
- 1, jbig2_print_page);
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* resolution */
+ 0, 0, 0, 0, /* margins */
+ 1, jbig2_print_page);
/* Send the page to the file. */
static int
@@ -69,46 +67,46 @@ jbig2_print_page(gx_device_printer * pdev, FILE * prn_stream)
stream fstrm, cstrm;
if (in == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
/* Create the jbig2encode state. */
s_init_state((stream_state *)&state, &s_jbig2encode_template, 0);
if (state.template->set_defaults)
- (*state.template->set_defaults) ((stream_state *) & state);
+ (*state.template->set_defaults) ((stream_state *) & state);
state.width = jdev->width;
state.height = jdev->height;
/* Set up the streams. */
fbuf_size = max(512 /* arbitrary */ , state.template->min_out_size);
jbuf_size = state.template->min_in_size;
if ((fbuf = gs_alloc_bytes(mem, fbuf_size, "jbig2_print_page(fbuf)")) == 0 ||
- (jbuf = gs_alloc_bytes(mem, jbuf_size, "jbig2_print_page(jbuf)")) == 0
- ) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ (jbuf = gs_alloc_bytes(mem, jbuf_size, "jbig2_print_page(jbuf)")) == 0
+ ) {
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
s_init(&fstrm, mem);
swrite_file(&fstrm, prn_stream, fbuf, fbuf_size);
s_init(&cstrm, mem);
s_std_init(&cstrm, jbuf, jbuf_size, &s_filter_write_procs,
- s_mode_write);
+ s_mode_write);
cstrm.state = (stream_state *) & state;
cstrm.procs.process = state.template->process;
cstrm.strm = &fstrm;
if (state.template->init)
- (*state.template->init) (cstrm.state);
+ (*state.template->init) (cstrm.state);
/* Copy the data to the output. */
for (lnum = 0; lnum < jdev->height; ++lnum) {
- byte *data;
- uint ignore_used;
+ byte *data;
+ uint ignore_used;
if (cstrm.end_status) {
- code = gs_note_error(gs_error_ioerror);
+ code = gs_note_error(gs_error_ioerror);
goto done;
}
- gdev_prn_get_bits(pdev, lnum, in, &data);
- sputs(&cstrm, data, state.stride, &ignore_used);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
+ sputs(&cstrm, data, state.stride, &ignore_used);
}
/* Wrap up. */
diff --git a/gs/base/gdevjpeg.c b/gs/base/gdevjpeg.c
index 8c176135c..635a0121a 100644
--- a/gs/base/gdevjpeg.c
+++ b/gs/base/gdevjpeg.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,9 +27,9 @@ typedef struct gx_device_jpeg_s {
/* Additional parameters */
int JPEGQ; /* quality on IJG scale */
float QFactor; /* quality per DCTEncode conventions */
- /* JPEGQ overrides QFactor if both are specified. */
+ /* JPEGQ overrides QFactor if both are specified. */
- /** 1.0 default 2.0 is twice as big
+ /** 1.0 default 2.0 is twice as big
*/
gs_point ViewScale;
@@ -85,12 +85,12 @@ static const gx_device_procs jpeg_procs =
const gx_device_jpeg gs_jpeg_device =
{prn_device_std_body(gx_device_jpeg, jpeg_procs, "jpeg",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, 0, 0, 0, 0, 24, jpeg_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, 0, 0, 0, 0, 24, jpeg_print_page),
0, /* JPEGQ: 0 indicates not specified */
0.0, /* QFactor: 0 indicates not specified */
- { 1.0, 1.0 }, /* ViewScale 1 to 1 */
- { 0.0, 0.0 } /* translation 0 */
+ { 1.0, 1.0 }, /* ViewScale 1 to 1 */
+ { 0.0, 0.0 } /* translation 0 */
};
/* 8-bit gray */
@@ -121,62 +121,61 @@ static const gx_device_procs jpeggray_procs =
const gx_device_jpeg gs_jpeggray_device =
{prn_device_body(gx_device_jpeg, jpeggray_procs, "jpeggray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, 0, 0, 0, 0,
- 1, 8, 255, 0, 256, 0,
- jpeg_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, 0, 0, 0, 0,
+ 1, 8, 255, 0, 256, 0,
+ jpeg_print_page),
0, /* JPEGQ: 0 indicates not specified */
0.0, /* QFactor: 0 indicates not specified */
- { 1.0, 1.0 }, /* ViewScale 1 to 1 */
- { 0.0, 0.0 } /* translation 0 */
+ { 1.0, 1.0 }, /* ViewScale 1 to 1 */
+ { 0.0, 0.0 } /* translation 0 */
};
/* 32-bit CMYK */
static const gx_device_procs jpegcmyk_procs =
{ gdev_prn_open,
- gx_default_get_initial_matrix,
- NULL, /* sync_output */
- gdev_prn_output_page,
- gdev_prn_close,
- NULL,
+ gx_default_get_initial_matrix,
+ NULL, /* sync_output */
+ gdev_prn_output_page,
+ gdev_prn_close,
+ NULL,
jpegcmyk_map_color_rgb,
- NULL, /* fill_rectangle */
- NULL, /* tile_rectangle */
- NULL, /* copy_mono */
- NULL, /* copy_color */
- NULL, /* draw_line */
- NULL, /* get_bits */
- jpeg_get_params,
- jpeg_put_params,
- jpegcmyk_map_cmyk_color,
- NULL, /* get_xfont_procs */
- NULL, /* get_xfont_device */
- NULL, /* map_rgb_alpha_color */
- gx_page_device_get_page_device /* get_page_device */
+ NULL, /* fill_rectangle */
+ NULL, /* tile_rectangle */
+ NULL, /* copy_mono */
+ NULL, /* copy_color */
+ NULL, /* draw_line */
+ NULL, /* get_bits */
+ jpeg_get_params,
+ jpeg_put_params,
+ jpegcmyk_map_cmyk_color,
+ NULL, /* get_xfont_procs */
+ NULL, /* get_xfont_device */
+ NULL, /* map_rgb_alpha_color */
+ gx_page_device_get_page_device /* get_page_device */
};
const gx_device_jpeg gs_jpegcmyk_device =
{prn_device_std_body(gx_device_jpeg, jpegcmyk_procs, "jpegcmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, 0, 0, 0, 0, 32, jpeg_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, 0, 0, 0, 0, 32, jpeg_print_page),
0, /* JPEGQ: 0 indicates not specified */
0.0, /* QFactor: 0 indicates not specified */
- { 1.0, 1.0 }, /* ViewScale 1 to 1 */
- { 0.0, 0.0 } /* translation 0 */
+ { 1.0, 1.0 }, /* ViewScale 1 to 1 */
+ { 0.0, 0.0 } /* translation 0 */
};
-
/* Apparently Adobe Photoshop and some other applications that */
/* accept JPEG CMYK images expect color values to be inverted. */
static int
jpegcmyk_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
int
- not_k = color & 0xff,
- r = not_k - ~(color >> 24),
- g = not_k - ~((color >> 16) & 0xff),
- b = not_k - ~((color >> 8) & 0xff);
+ not_k = color & 0xff,
+ r = not_k - ~(color >> 24),
+ g = not_k - ~((color >> 16) & 0xff),
+ b = not_k - ~((color >> 8) & 0xff);
prgb[0] = (r < 0 ? 0 : gx_color_value_from_byte(r));
prgb[1] = (g < 0 ? 0 : gx_color_value_from_byte(g));
@@ -192,7 +191,7 @@ jpegcmyk_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
((uint)gx_color_value_to_byte(cv[2]) << 8) +
((uint)gx_color_value_to_byte(cv[1]) << 16) +
((uint)gx_color_value_to_byte(cv[0]) << 24));
-
+
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -205,24 +204,24 @@ jpeg_get_params(gx_device * dev, gs_param_list * plist)
int ecode;
float float2double;
if (code < 0)
- return code;
+ return code;
if ((ecode = param_write_int(plist, "JPEGQ", &jdev->JPEGQ)) < 0)
- code = ecode;
+ code = ecode;
if ((ecode = param_write_float(plist, "QFactor", &jdev->QFactor)) < 0)
- code = ecode;
+ code = ecode;
float2double = jdev->ViewScale.x;
if ((ecode = param_write_float(plist, "ViewScaleX", &float2double)) < 0)
- code = ecode;
+ code = ecode;
float2double = jdev->ViewScale.y;
if ((ecode = param_write_float(plist, "ViewScaleY", &float2double)) < 0)
- code = ecode;
+ code = ecode;
float2double = jdev->ViewTrans.x;
if ((ecode = param_write_float(plist, "ViewTransX", &float2double)) < 0)
- code = ecode;
+ code = ecode;
float2double = jdev->ViewTrans.y;
if ((ecode = param_write_float(plist, "ViewTransY", &float2double)) < 0)
- code = ecode;
+ code = ecode;
return code;
}
@@ -240,82 +239,81 @@ jpeg_put_params(gx_device * dev, gs_param_list * plist)
float fparam;
switch (code = param_read_int(plist, (param_name = "JPEGQ"), &jq)) {
- case 0:
- if (jq < 0 || jq > 100)
- ecode = gs_error_limitcheck;
- else
- break;
- goto jqe;
- default:
- ecode = code;
- jqe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 0:
+ if (jq < 0 || jq > 100)
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto jqe;
+ default:
+ ecode = code;
+ jqe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
switch (code = param_read_float(plist, (param_name = "QFactor"), &qf)) {
- case 0:
- if (qf < 0.0 || qf > 1.0e6)
- ecode = gs_error_limitcheck;
- else
- break;
- goto qfe;
- default:
- ecode = code;
- qfe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 0:
+ if (qf < 0.0 || qf > 1.0e6)
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto qfe;
+ default:
+ ecode = code;
+ qfe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
-
code = param_read_float(plist, (param_name = "ViewScaleX"), &fparam);
if ( code == 0 ) {
- if (fparam < 1.0)
- param_signal_error(plist, param_name, gs_error_limitcheck);
- else
- jdev->ViewScale.x = fparam;
+ if (fparam < 1.0)
+ param_signal_error(plist, param_name, gs_error_limitcheck);
+ else
+ jdev->ViewScale.x = fparam;
}
else if ( code < 1 ) {
- ecode = code;
- param_signal_error(plist, param_name, code);
+ ecode = code;
+ param_signal_error(plist, param_name, code);
}
code = param_read_float(plist, (param_name = "ViewScaleY"), &fparam);
if ( code == 0 ) {
- if (fparam < 1.0)
- param_signal_error(plist, param_name, gs_error_limitcheck);
- else
- jdev->ViewScale.y = fparam;
+ if (fparam < 1.0)
+ param_signal_error(plist, param_name, gs_error_limitcheck);
+ else
+ jdev->ViewScale.y = fparam;
}
else if ( code < 1 ) {
- ecode = code;
- param_signal_error(plist, param_name, code);
+ ecode = code;
+ param_signal_error(plist, param_name, code);
}
- /* pixels in desired dpi, auto negative ( moves up and left ) */
+ /* pixels in desired dpi, auto negative ( moves up and left ) */
code = param_read_float(plist, (param_name = "ViewTransX"), &fparam);
if ( code == 0 ) {
- jdev->ViewTrans.x = fparam;
+ jdev->ViewTrans.x = fparam;
}
else if ( code < 1 ) {
- ecode = code;
- param_signal_error(plist, param_name, code);
+ ecode = code;
+ param_signal_error(plist, param_name, code);
}
code = param_read_float(plist, (param_name = "ViewTransY"), &fparam);
if ( code == 0 ) {
- jdev->ViewTrans.y = fparam;
+ jdev->ViewTrans.y = fparam;
}
else if ( code < 1 ) {
- ecode = code;
- param_signal_error(plist, param_name, code);
- }
+ ecode = code;
+ param_signal_error(plist, param_name, code);
+ }
code = gdev_prn_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
if (ecode < 0)
- return ecode;
+ return ecode;
jdev->JPEGQ = jq;
jdev->QFactor = qf;
@@ -325,7 +323,7 @@ jpeg_put_params(gx_device * dev, gs_param_list * plist)
/******************************************************************
This device supports translation and scaling.
-0123456
+0123456
0PPPPPPP 0 is origin
PPPPPPPP 1 is x1,y1 (2,2)
@@ -334,17 +332,17 @@ PPvvvvPP v is viewport, P is original page
PPvvvvPP
PPPPPP2P
PPPPPPPP
-
-Given a view port in pixels starting at x1,y1
+
+Given a view port in pixels starting at x1,y1
where x1 < width, y1 < height in pixels
-ViewScaleX = desired Resolution / HWResolution ; 1.0 default
+ViewScaleX = desired Resolution / HWResolution ; 1.0 default
ViewScaleY = desired Resolution / HWResolution
-HWResolutionX = desired dpi at 1:1 scaling ; 72dpi default
+HWResolutionX = desired dpi at 1:1 scaling ; 72dpi default
HWResolutionY = desired dpi at 1:1 scaling
-ViewTransX = x1 * ViewScaleX ; 0.0 default
+ViewTransX = x1 * ViewScaleX ; 0.0 default
ViewTransY = y1 * ViewScaleY
if initial matrix multiplies ViewScaleX in then translation is limited to
@@ -356,8 +354,8 @@ static void
jpeg_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
{
gx_device_jpeg *pdev = (gx_device_jpeg *)dev;
- floatp fs_res = (dev->HWResolution[0] / 72.0) * pdev->ViewScale.x;
- floatp ss_res = (dev->HWResolution[1] / 72.0) * pdev->ViewScale.y;
+ floatp fs_res = (dev->HWResolution[0] / 72.0) * pdev->ViewScale.x;
+ floatp ss_res = (dev->HWResolution[1] / 72.0) * pdev->ViewScale.y;
/* NB this device has no paper margins */
@@ -419,15 +417,15 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
stream fstrm, jstrm;
if (jcdp == 0 || in == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
/* Create the DCT encoder state. */
jcdp->template = s_DCTE_template;
s_init_state((stream_state *)&state, &jcdp->template, 0);
if (state.template->set_defaults) {
state.memory = mem;
- (*state.template->set_defaults) ((stream_state *) & state);
+ (*state.template->set_defaults) ((stream_state *) & state);
state.memory = NULL;
}
state.QFactor = 1.0; /* disable quality adjustment in zfdcte.c */
@@ -440,37 +438,37 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
state.data.compress = jcdp;
jcdp->memory = state.jpeg_memory = mem;
if ((code = gs_jpeg_create_compress(&state)) < 0)
- goto fail;
+ goto fail;
jcdp->cinfo.image_width = pdev->width;
jcdp->cinfo.image_height = pdev->height;
switch (pdev->color_info.depth) {
- case 32:
- jcdp->cinfo.input_components = 4;
- jcdp->cinfo.in_color_space = JCS_CMYK;
- break;
- case 24:
- jcdp->cinfo.input_components = 3;
- jcdp->cinfo.in_color_space = JCS_RGB;
- break;
- case 8:
- jcdp->cinfo.input_components = 1;
- jcdp->cinfo.in_color_space = JCS_GRAYSCALE;
- break;
+ case 32:
+ jcdp->cinfo.input_components = 4;
+ jcdp->cinfo.in_color_space = JCS_CMYK;
+ break;
+ case 24:
+ jcdp->cinfo.input_components = 3;
+ jcdp->cinfo.in_color_space = JCS_RGB;
+ break;
+ case 8:
+ jcdp->cinfo.input_components = 1;
+ jcdp->cinfo.in_color_space = JCS_GRAYSCALE;
+ break;
}
/* Set compression parameters. */
if ((code = gs_jpeg_set_defaults(&state)) < 0)
- goto done;
+ goto done;
if (jdev->JPEGQ > 0) {
- code = gs_jpeg_set_quality(&state, jdev->JPEGQ, TRUE);
- if (code < 0)
- goto done;
+ code = gs_jpeg_set_quality(&state, jdev->JPEGQ, TRUE);
+ if (code < 0)
+ goto done;
} else if (jdev->QFactor > 0.0) {
- code = gs_jpeg_set_linear_quality(&state,
- (int)(min(jdev->QFactor, 100.0)
- * 100.0 + 0.5),
- TRUE);
- if (code < 0)
- goto done;
+ code = gs_jpeg_set_linear_quality(&state,
+ (int)(min(jdev->QFactor, 100.0)
+ * 100.0 + 0.5),
+ TRUE);
+ if (code < 0)
+ goto done;
}
jcdp->cinfo.restart_interval = 0;
jcdp->cinfo.density_unit = 1; /* dots/inch (no #define or enum) */
@@ -479,44 +477,44 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* Create the filter. */
/* Make sure we get at least a full scan line of input. */
state.scan_line_size = jcdp->cinfo.input_components *
- jcdp->cinfo.image_width;
+ jcdp->cinfo.image_width;
jcdp->template.min_in_size =
- max(s_DCTE_template.min_in_size, state.scan_line_size);
+ max(s_DCTE_template.min_in_size, state.scan_line_size);
/* Make sure we can write the user markers in a single go. */
jcdp->template.min_out_size =
- max(s_DCTE_template.min_out_size, state.Markers.size);
+ max(s_DCTE_template.min_out_size, state.Markers.size);
/* Set up the streams. */
fbuf_size = max(512 /* arbitrary */ , jcdp->template.min_out_size);
jbuf_size = jcdp->template.min_in_size;
if ((fbuf = gs_alloc_bytes(mem, fbuf_size, "jpeg_print_page(fbuf)")) == 0 ||
- (jbuf = gs_alloc_bytes(mem, jbuf_size, "jpeg_print_page(jbuf)")) == 0
- ) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ (jbuf = gs_alloc_bytes(mem, jbuf_size, "jpeg_print_page(jbuf)")) == 0
+ ) {
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
s_init(&fstrm, mem);
swrite_file(&fstrm, prn_stream, fbuf, fbuf_size);
s_init(&jstrm, mem);
s_std_init(&jstrm, jbuf, jbuf_size, &s_filter_write_procs,
- s_mode_write);
+ s_mode_write);
jstrm.state = (stream_state *) & state;
jstrm.procs.process = state.template->process;
jstrm.strm = &fstrm;
if (state.template->init)
- (*state.template->init) (jstrm.state);
+ (*state.template->init) (jstrm.state);
/* Copy the data to the output. */
for (lnum = 0; lnum < pdev->height; ++lnum) {
- byte *data;
- uint ignore_used;
+ byte *data;
+ uint ignore_used;
if (jstrm.end_status) {
- code = gs_note_error(gs_error_ioerror);
+ code = gs_note_error(gs_error_ioerror);
goto done;
}
- gdev_prn_get_bits(pdev, lnum, in, &data);
- sputs(&jstrm, data, state.scan_line_size, &ignore_used);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
+ sputs(&jstrm, data, state.scan_line_size, &ignore_used);
}
/* Wrap up. */
@@ -527,12 +525,12 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
gs_free_object(mem, jbuf, "jpeg_print_page(jbuf)");
gs_free_object(mem, fbuf, "jpeg_print_page(fbuf)");
if (jcdp)
- gs_jpeg_destroy(&state); /* frees *jcdp */
+ gs_jpeg_destroy(&state); /* frees *jcdp */
gs_free_object(mem, in, "jpeg_print_page(in)");
return code;
fail:
if (jcdp)
- gs_free_object(mem, jcdp, "jpeg_print_page(jpeg_compress_data)");
+ gs_free_object(mem, jcdp, "jpeg_print_page(jpeg_compress_data)");
gs_free_object(mem, in, "jpeg_print_page(in)");
return code;
}
diff --git a/gs/base/gdevjpx.c b/gs/base/gdevjpx.c
index 54486ee0e..d7b4d4177 100644
--- a/gs/base/gdevjpx.c
+++ b/gs/base/gdevjpx.c
@@ -19,7 +19,6 @@
#include "strimpl.h"
#include "sjpx_luratech.h"
-
/* Structure for the JPX-writing device. */
typedef struct gx_device_jpx_s {
gx_device_common;
@@ -44,35 +43,35 @@ static dev_proc_print_page(jpx_print_page);
/* 24 bit RGB default */
static const gx_device_procs jpxrgb_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color,
- gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color,
+ gx_default_rgb_map_color_rgb);
const gx_device_printer gs_jpxrgb_device = {
prn_device_std_body(gx_device_jpx, jpxrgb_procs, "jpx",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* resolution */
- 0, 0, 0, 0, /* margins */
- 24, /* bits per pixel */
- jpx_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* resolution */
+ 0, 0, 0, 0, /* margins */
+ 24, /* bits per pixel */
+ jpx_print_page)
};
/* 8 bit Grayscale */
static const gx_device_procs jpxgray_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color,
- gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color,
+ gx_default_gray_map_color_rgb);
const gx_device_printer gs_jpxgray_device = {
prn_device_body(gx_device_jpx, jpxgray_procs, "jpxgray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* resolution */
- 0, 0, 0, 0, /* margins */
- 1, 8, 255, 0, 256, 0, /* components, depth and min/max values */
- jpx_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* resolution */
+ 0, 0, 0, 0, /* margins */
+ 1, 8, 255, 0, 256, 0, /* components, depth and min/max values */
+ jpx_print_page)
};
/* 32 bit CMKY */
static dev_proc_map_color_rgb(jpx_cmyk_map_color_rgb);
static dev_proc_map_cmyk_color(jpx_cmyk_map_cmyk_color);
-static const gx_device_procs jpxcmyk_procs =
+static const gx_device_procs jpxcmyk_procs =
{ gdev_prn_open,
gx_default_get_initial_matrix,
NULL, /* sync_output */
@@ -86,7 +85,7 @@ static const gx_device_procs jpxcmyk_procs =
NULL, /* copy_color */
NULL, /* draw_line */
NULL, /* get_bits */
- gdev_prn_get_params,
+ gdev_prn_get_params,
gdev_prn_put_params,
jpx_cmyk_map_cmyk_color,
NULL, /* get_xfont_procs */
@@ -96,14 +95,14 @@ static const gx_device_procs jpxcmyk_procs =
};
const gx_device_printer gs_jpxcmyk_device = {
prn_device_std_body(gx_device_jpx, jpxcmyk_procs, "jpxcmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* resolution */
- 0, 0, 0, 0, /* margins */
- 32, /* bits per pixel */
- jpx_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* resolution */
+ 0, 0, 0, 0, /* margins */
+ 32, /* bits per pixel */
+ jpx_print_page)
};
-/* private color conversion routines;
+/* private color conversion routines;
we don't seem to have defaults for cmyk. */
static int
jpx_cmyk_map_color_rgb(gx_device * dev, gx_color_index color,
@@ -132,7 +131,6 @@ jpx_cmyk_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
return (color == gx_no_color_index ? color ^ 1 : color);
}
-
/* Send the page to the file. */
static int
jpx_print_page(gx_device_printer * pdev, FILE * prn_stream)
@@ -151,23 +149,23 @@ jpx_print_page(gx_device_printer * pdev, FILE * prn_stream)
stream fstrm, cstrm;
if (in == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
/* Create the jpx encoder state. */
s_init_state((stream_state *)&state, &s_jpxe_template, 0);
if (state.template->set_defaults)
- (*state.template->set_defaults) ((stream_state *) & state);
+ (*state.template->set_defaults) ((stream_state *) & state);
state.width = jdev->width;
state.height = jdev->height;
switch (jdev->color_info.depth) {
- case 32: state.colorspace = gs_jpx_cs_cmyk; break;
- case 24: state.colorspace = gs_jpx_cs_rgb; break;
- case 8: state.colorspace = gs_jpx_cs_gray; break;
- default:
- state.colorspace = gs_jpx_cs_gray; /* safest option */
- dlprintf1("unexpected color_info depth %d\n",
- jdev->color_info.depth);
+ case 32: state.colorspace = gs_jpx_cs_cmyk; break;
+ case 24: state.colorspace = gs_jpx_cs_rgb; break;
+ case 8: state.colorspace = gs_jpx_cs_gray; break;
+ default:
+ state.colorspace = gs_jpx_cs_gray; /* safest option */
+ dlprintf1("unexpected color_info depth %d\n",
+ jdev->color_info.depth);
}
state.bpc = 8; /* currently only 8 bits per component is supported */
@@ -180,33 +178,33 @@ jpx_print_page(gx_device_printer * pdev, FILE * prn_stream)
fbuf_size = max(512 /* arbitrary */ , state.template->min_out_size);
jbuf_size = state.template->min_in_size;
if ((fbuf = gs_alloc_bytes(mem, fbuf_size, "jpx_print_page(fbuf)")) == 0 ||
- (jbuf = gs_alloc_bytes(mem, jbuf_size, "jpx_print_page(jbuf)")) == 0
- ) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ (jbuf = gs_alloc_bytes(mem, jbuf_size, "jpx_print_page(jbuf)")) == 0
+ ) {
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
s_init(&fstrm, mem);
swrite_file(&fstrm, prn_stream, fbuf, fbuf_size);
s_init(&cstrm, mem);
s_std_init(&cstrm, jbuf, jbuf_size, &s_filter_write_procs,
- s_mode_write);
+ s_mode_write);
cstrm.state = (stream_state *) & state;
cstrm.procs.process = state.template->process;
cstrm.strm = &fstrm;
if (state.template->init)
- (*state.template->init) (cstrm.state);
+ (*state.template->init) (cstrm.state);
/* Copy the data to the output. */
for (lnum = 0; lnum < jdev->height; ++lnum) {
- byte *data;
- uint ignore_used;
+ byte *data;
+ uint ignore_used;
if (cstrm.end_status) {
- code = gs_note_error(gs_error_ioerror);
+ code = gs_note_error(gs_error_ioerror);
goto done;
}
- gdev_prn_get_bits(pdev, lnum, in, &data);
- sputs(&cstrm, data, state.stride, &ignore_used);
+ gdev_prn_get_bits(pdev, lnum, in, &data);
+ sputs(&cstrm, data, state.stride, &ignore_used);
}
/* Wrap up. */
diff --git a/gs/base/gdevl256.c b/gs/base/gdevl256.c
index b16bf76f8..5df90381f 100644
--- a/gs/base/gdevl256.c
+++ b/gs/base/gdevl256.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,8 +19,8 @@
try my very best, but i have some work to do.
Ludger Kunz | ____________|Tel.: 02371/566-230
- FernUniversitaet Hagen| /| / / \ |FAX: 02371/52212
- Lehrgebiet ES | / |/ /_ \ |EMAIL:
+ FernUniversitaet Hagen| /| / / \ |FAX: 02371/52212
+ Lehrgebiet ES | / |/ /_ \ |EMAIL:
Frauenstuhlweg 31 | / |\ / \ |ludger.kunz@fernuni-hagen.de
58644 Iserlohn |/___|_\/_______\|
*/
@@ -54,7 +54,6 @@ static dc_entry dynamic_colors[dc_hash_size + 1];
#define YSIZE 11.7 /*11.69 */
#endif
-
/* The device descriptor */
typedef struct gx_device_lvga256 {
gx_device_common;
@@ -90,9 +89,9 @@ static gx_device_procs lvga256_procs =
gx_device_lvga256 far_data gs_lvga256_device =
{std_device_color_body(gx_device_lvga256, &lvga256_procs, "lvga256",
- 0, 0, /* width and height are set in lvga256_open */
- 1, 1, /* density is set in lvga256_open */
- /*dci_color( */ 8, 31, 4 /*) */ )
+ 0, 0, /* width and height are set in lvga256_open */
+ 1, 1, /* density is set in lvga256_open */
+ /*dci_color( */ 8, 31, 4 /*) */ )
};
/* Open the LINUX driver for graphics mode */
@@ -105,7 +104,7 @@ lvga256_open(gx_device * dev)
vga_init();
vgamode = vga_getdefaultmode();
if (vgamode == -1)
- vgamode = G320x200x256;
+ vgamode = G320x200x256;
vga_setmode(vgamode);
gl_setcontextvga(vgamode);
width = vga_getxdim();
@@ -114,14 +113,14 @@ lvga256_open(gx_device * dev)
dev->x_pixels_per_inch = dev->y_pixels_per_inch;
gx_device_set_width_height(dev, width, height);
{
- int c;
+ int c;
- for (c = 0; c < 64; c++) {
- static const byte c2[10] =
- {0, 42, 0, 0, 0, 0, 0, 0, 21, 63};
+ for (c = 0; c < 64; c++) {
+ static const byte c2[10] =
+ {0, 42, 0, 0, 0, 0, 0, 0, 21, 63};
- gl_setpalettecolor(c, c2[(c >> 2) & 9], c2[(c >> 1) & 9], c2[c & 9]);
- }
+ gl_setpalettecolor(c, c2[(c >> 2) & 9], c2[(c >> 1) & 9], c2[c & 9]);
+ }
}
/* Initialize the dynamic color table. */
memset(dynamic_colors, 0, (dc_hash_size + 1) * sizeof(dc_entry));
@@ -162,37 +161,37 @@ lvga256_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Check for a color on the cube. */
if (cx < 64)
- return (gx_color_index) cx;
+ return (gx_color_index) cx;
/* Not on the cube, check the dynamic color table. */
rgb = (r5 << 10) + (g5 << 5) + b5;
for (pdc = &dynamic_colors[rgb % dc_hash_size]; pdc->rgb != 0; pdc++) {
- if (pdc->rgb == rgb)
- return (gx_color_index) (pdc->index);
+ if (pdc->rgb == rgb)
+ return (gx_color_index) (pdc->index);
}
if (pdc == &dynamic_colors[dc_hash_size]) { /* Wraparound */
- for (pdc = &dynamic_colors[0]; pdc->rgb != 0; pdc++) {
- if (pdc->rgb == rgb)
- return (gx_color_index) (pdc->index);
- }
+ for (pdc = &dynamic_colors[0]; pdc->rgb != 0; pdc++) {
+ if (pdc->rgb == rgb)
+ return (gx_color_index) (pdc->index);
+ }
}
if (next_dc_index == 256) { /* No space left, report failure. */
- return gx_no_color_index;
+ return gx_no_color_index;
}
/* Not on the cube, and not in the dynamic table. */
/* Put in the dynamic table if space available. */
{
- int i = next_dc_index++;
+ int i = next_dc_index++;
- pdc->rgb = rgb;
- pdc->index = i;
- gl_setpalettecolor(i, cv_bits(r, 6), cv_bits(g, 6), cv_bits(b, 6));
- return (gx_color_index) i;
+ pdc->rgb = rgb;
+ pdc->index = i;
+ gl_setpalettecolor(i, cv_bits(r, 6), cv_bits(g, 6), cv_bits(b, 6));
+ return (gx_color_index) i;
}
}
int
lvga256_map_color_rgb(gx_device * dev, gx_color_index color,
- unsigned short prgb[3])
+ unsigned short prgb[3])
{
/* gl_getpalettecolor (color,(int *)&prgb[0],(int *)&prgb[1],(int *)&prgb[2]); */
prgb[0] = gx_max_color_value;
@@ -205,9 +204,9 @@ lvga256_map_color_rgb(gx_device * dev, gx_color_index color,
/* Color = gx_no_color_index means transparent (no effect on the image). */
int
lvga256_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
const byte *ptr_line = base + (sourcex >> 3);
int left_bit = 0x80 >> (sourcex & 7);
@@ -217,33 +216,33 @@ lvga256_copy_mono(gx_device * dev,
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- color = (int)one;
+ if (one == gx_no_color_index)
+ return 0;
+ color = (int)one;
} else {
- if (one == gx_no_color_index) {
- color = (int)zero;
- invert = -1;
- } else { /* Pre-clear the rectangle to zero */
- gl_fillbox(x, y, w, h, 0);
- color = (int)one;
- }
+ if (one == gx_no_color_index) {
+ color = (int)zero;
+ invert = -1;
+ } else { /* Pre-clear the rectangle to zero */
+ gl_fillbox(x, y, w, h, 0);
+ color = (int)one;
+ }
}
while (h--) { /* for each line */
- const byte *ptr_source = ptr_line;
- register int dest_x = x;
- register int bit = left_bit;
-
- while (dest_x < end_x) { /* for each bit in the line */
- if ((*ptr_source ^ invert) & bit) {
- gl_setpixel(dest_x, dest_y, color);
- }
- dest_x++;
- if ((bit >>= 1) == 0)
- bit = 0x80, ptr_source++;
- }
- dest_y++;
- ptr_line += raster;
+ const byte *ptr_source = ptr_line;
+ register int dest_x = x;
+ register int bit = left_bit;
+
+ while (dest_x < end_x) { /* for each bit in the line */
+ if ((*ptr_source ^ invert) & bit) {
+ gl_setpixel(dest_x, dest_y, color);
+ }
+ dest_x++;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, ptr_source++;
+ }
+ dest_y++;
+ ptr_line += raster;
}
return 0;
}
@@ -252,18 +251,18 @@ lvga256_copy_mono(gx_device * dev,
/* each pixel takes 4 bits instead of 1 when device driver has color. */
int
lvga256_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (gx_device_has_color(dev)) { /* color device, four bits per pixel */
- const byte *line = base + sourcex;
+ const byte *line = base + sourcex;
- gl_putbox(x, y, w, h, line);
+ gl_putbox(x, y, w, h, line);
} else { /* monochrome device: one bit per pixel */
- /* bit map is the same as lvga256_copy_mono: one bit per pixel */
- lvga256_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
- (gx_color_index) 0, (gx_color_index) 255);
+ /* bit map is the same as lvga256_copy_mono: one bit per pixel */
+ lvga256_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
+ (gx_color_index) 0, (gx_color_index) 255);
}
return 0;
}
@@ -271,7 +270,7 @@ lvga256_copy_color(gx_device * dev,
/* Fill a rectangle. */
int
lvga256_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
fit_fill(dev, x, y, w, h);
gl_fillbox(x, y, w, h, color);
@@ -285,11 +284,11 @@ lvga256_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
int
lvga256_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone,
- int px, int py)
+ int px, int py)
{
if (czero != gx_no_color_index && cone != gx_no_color_index) {
- lvga256_fill_rectangle(dev, x, y, w, h, czero);
- czero = gx_no_color_index;
+ lvga256_fill_rectangle(dev, x, y, w, h, czero);
+ czero = gx_no_color_index;
}
return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone, px, py);
}
@@ -297,7 +296,7 @@ lvga256_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
/* Draw a line */
int
lvga256_draw_line(gx_device * dev, int x0, int y0, int x1, int y1,
- gx_color_index color)
+ gx_color_index color)
{
gl_line(x0, y0, x1, y1, color);
return 0;
diff --git a/gs/base/gdevl31s.c b/gs/base/gdevl31s.c
index 2b14535c7..08fc69353 100644
--- a/gs/base/gdevl31s.c
+++ b/gs/base/gdevl31s.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,17 +31,17 @@
/* order matters! 0 1 2 3 4 5 6 7 8 */
const char *media[10] = {"a4", "letter", "legal", "com10", "c5", "dl", "b5", "monarch", "executive", 0};
const int height[2][10] = {{3447, 3240, 4140, 5587, 2644, 5083, 2975, 4387, 3090, 0},
- {6894, 6480, 8280, 11167, 5288, 10159, 5950, 8767, 6180, 0}};
+ {6894, 6480, 8280, 11167, 5288, 10159, 5950, 8767, 6180, 0}};
const int width[2] = {2528,
- 5056};
+ 5056};
#define LARGEST_MEDIUM 2 /* legal */
/* These codes correspond to sequences of pixels with the same color.
* After the code for a sequence < 64 pixels the color changes.
- * After the code for a sequence with 64 pixels the previous color continues. */
+ * After the code for a sequence with 64 pixels the previous color continues. */
static struct {
- uint bits;
- uint length; /* number of valid bits */
+ uint bits;
+ uint length; /* number of valid bits */
} code[2][65] =
/* White */
{{{0x0ac, 8}, {0x038, 6}, {0x00e, 4}, {0x001, 4}, {0x00d, 4}, {0x003, 4}, {0x007, 4}, {0x00f, 4},
@@ -62,7 +62,7 @@ static struct {
{0x360, 12}, {0xb60, 12}, {0x5b0, 12}, {0xdb0, 12}, {0x2a0, 12}, {0xaa0, 12}, {0x6a0, 12}, {0xea0, 12},
{0x260, 12}, {0xa60, 12}, {0x4a0, 12}, {0xca0, 12}, {0x240, 12}, {0xec0, 12}, {0x1c0, 12}, {0xe40, 12},
{0x140, 12}, {0x1a0, 12}, {0x9a0, 12}, {0xd40, 12}, {0x340, 12}, {0x5a0, 12}, {0x660, 12}, {0xe60, 12},
- {0x3c0, 10}}};
+ {0x3c0, 10}}};
/* Define the default, maximum resolutions. */
#ifndef X_DPI
@@ -76,19 +76,19 @@ static struct {
static dev_proc_print_page_copies(lj3100sw_print_page_copies);
static dev_proc_close_device(lj3100sw_close);
-static gx_device_procs prn_lj3100sw_procs =
+static gx_device_procs prn_lj3100sw_procs =
prn_params_procs(gdev_prn_open, gdev_prn_output_page, lj3100sw_close,
- gdev_prn_get_params, gdev_prn_put_params);
+ gdev_prn_get_params, gdev_prn_put_params);
/* workaround to emulate the missing prn_device_margins_copies macro */
#define gx_default_print_page_copies lj3100sw_print_page_copies
gx_device_printer far_data gs_lj3100sw_device =
prn_device_margins/*_copies*/(prn_lj3100sw_procs, "lj3100sw",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- XCORRECTION, YCORRECTION,
- 0.25, 0.2, 0.25, 0.2,
- 1, 0 /* lj3100sw_print_page_copies */);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ XCORRECTION, YCORRECTION,
+ 0.25, 0.2, 0.25, 0.2,
+ 1, 0 /* lj3100sw_print_page_copies */);
#undef gx_default_print_page_copies
#define ppdev ((gx_device_printer *)pdev)
@@ -98,181 +98,181 @@ gx_device_printer far_data gs_lj3100sw_device =
static void
lj3100sw_output_section_header(FILE *prn_stream, int type, int arg1, int arg2)
{
- fputc(type & 0xff, prn_stream);
- fputc(type >> 8 & 0xff, prn_stream);
- fputc(arg1 & 0xff, prn_stream);
- fputc(arg1 >> 8 & 0xff, prn_stream);
- fputc(arg2 & 0xff, prn_stream);
- fputc(arg2 >> 8 & 0xff, prn_stream);
+ fputc(type & 0xff, prn_stream);
+ fputc(type >> 8 & 0xff, prn_stream);
+ fputc(arg1 & 0xff, prn_stream);
+ fputc(arg1 >> 8 & 0xff, prn_stream);
+ fputc(arg2 & 0xff, prn_stream);
+ fputc(arg2 >> 8 & 0xff, prn_stream);
}
static void
lj3100sw_flush_buffer(FILE *prn_stream, char *buffer, char **pptr)
{
- int size = *pptr - buffer;
- if (size) {
- lj3100sw_output_section_header(prn_stream, 0, size, 0);
- fwrite(buffer, 1, size, prn_stream);
- *pptr = buffer;
- }
+ int size = *pptr - buffer;
+ if (size) {
+ lj3100sw_output_section_header(prn_stream, 0, size, 0);
+ fwrite(buffer, 1, size, prn_stream);
+ *pptr = buffer;
+ }
}
static void
lj3100sw_output_data_byte(FILE *prn_stream, char *buffer, char **pptr, int val)
{
- if (*pptr >= buffer + BUFFERSIZE)
- lj3100sw_flush_buffer(prn_stream, buffer, pptr);
- *(*pptr)++ = val;
+ if (*pptr >= buffer + BUFFERSIZE)
+ lj3100sw_flush_buffer(prn_stream, buffer, pptr);
+ *(*pptr)++ = val;
}
static void
lj3100sw_output_repeated_data_bytes(FILE *prn_stream, char *buffer, char **pptr, int val, int num)
{
- int size;
- while (num) {
- if (*pptr >= buffer + BUFFERSIZE)
- lj3100sw_flush_buffer(prn_stream, buffer, pptr);
- size = min(num, buffer + BUFFERSIZE - *pptr);
- memset(*pptr, val, size);
- *pptr += size;
- num -= size;
- }
+ int size;
+ while (num) {
+ if (*pptr >= buffer + BUFFERSIZE)
+ lj3100sw_flush_buffer(prn_stream, buffer, pptr);
+ size = min(num, buffer + BUFFERSIZE - *pptr);
+ memset(*pptr, val, size);
+ *pptr += size;
+ num -= size;
+ }
}
static void
lj3100sw_output_newline(FILE *prn_stream, char *buffer, char **pptr)
{
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
}
static void
lj3100sw_output_empty_line(FILE *prn_stream, char *buffer, char **pptr, bool high_resolution)
{
- if (high_resolution) {
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x0f);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x78);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0xac);
- } else {
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x87);
- lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x0d);
- }
+ if (high_resolution) {
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x0f);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x78);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0xac);
+ } else {
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x80);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x87);
+ lj3100sw_output_data_byte(prn_stream, buffer, pptr, 0x0d);
+ }
}
static int
lj3100sw_print_page_copies(gx_device_printer *pdev, FILE *prn_stream, int num_copies /* ignored */)
{
- int i, j;
- char buffer[BUFFERSIZE], *ptr = buffer;
- int medium_index = select_medium(pdev, media, LARGEST_MEDIUM);
- bool high_resolution = (pdev->x_pixels_per_inch > 300);
- int printer_height = height[high_resolution ? 1 : 0][medium_index];
- int printer_width = width[high_resolution ? 1 : 0];
- int paper_height = pdev->height;
- int paper_width = pdev->width;
- int line_size = gdev_prn_raster(pdev);
- gs_memory_t *mem = pdev->memory;
- byte *in = (byte *)gs_malloc(mem, line_size, 1, "lj3100sw_print_page");
- byte *data;
- if (in == 0)
- return_error(gs_error_VMerror);
- if (gdev_prn_file_is_new(pdev)) {
- lj3100sw_output_section_header(prn_stream, 1, 0, 0);
- lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0x1b, 12);
- ptr += sprintf(ptr, "\r\nBD");
- lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0, 5520);
- ptr += sprintf(ptr, "%s\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n",
- "NJ",
- "PQ", -1,
- "RE", high_resolution ? 6 : 2,
- "SL", printer_width,
- "LM", 0,
- "PS", medium_index,
- "PC", 0);
- lj3100sw_flush_buffer(prn_stream, buffer, &ptr);
- }
+ int i, j;
+ char buffer[BUFFERSIZE], *ptr = buffer;
+ int medium_index = select_medium(pdev, media, LARGEST_MEDIUM);
+ bool high_resolution = (pdev->x_pixels_per_inch > 300);
+ int printer_height = height[high_resolution ? 1 : 0][medium_index];
+ int printer_width = width[high_resolution ? 1 : 0];
+ int paper_height = pdev->height;
+ int paper_width = pdev->width;
+ int line_size = gdev_prn_raster(pdev);
+ gs_memory_t *mem = pdev->memory;
+ byte *in = (byte *)gs_malloc(mem, line_size, 1, "lj3100sw_print_page");
+ byte *data;
+ if (in == 0)
+ return_error(gs_error_VMerror);
+ if (gdev_prn_file_is_new(pdev)) {
+ lj3100sw_output_section_header(prn_stream, 1, 0, 0);
+ lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0x1b, 12);
+ ptr += sprintf(ptr, "\r\nBD");
+ lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0, 5520);
+ ptr += sprintf(ptr, "%s\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n%s %d\r\n",
+ "NJ",
+ "PQ", -1,
+ "RE", high_resolution ? 6 : 2,
+ "SL", printer_width,
+ "LM", 0,
+ "PS", medium_index,
+ "PC", 0);
+ lj3100sw_flush_buffer(prn_stream, buffer, &ptr);
+ }
- lj3100sw_output_section_header(prn_stream, 3, ppdev->NumCopies, 0);
- ptr += sprintf(ptr, "%s %d\r\n%s\r\n",
- "CM", 1,
- "PD");
- *ptr++ = 0;
- lj3100sw_output_newline(prn_stream, buffer, &ptr);
+ lj3100sw_output_section_header(prn_stream, 3, ppdev->NumCopies, 0);
+ ptr += sprintf(ptr, "%s %d\r\n%s\r\n",
+ "CM", 1,
+ "PD");
+ *ptr++ = 0;
+ lj3100sw_output_newline(prn_stream, buffer, &ptr);
- for (i = 0; i < printer_height; i++) {
- if (i < paper_height) {
- int color = 0; /* white */
- int count = 0;
- int bit_index = 0;
- uint tmp = 0;
- gdev_prn_get_bits(pdev, i, in, &data);
- for (j = 0; j <= printer_width; j++) {
- int xoffset = (printer_width - paper_width) / 2;
- int newcolor = 0;
- if (j >= xoffset && j < xoffset + paper_width)
- newcolor = (data[(j - xoffset) / 8] >> (7 - (j - xoffset) % 8)) & 1;
- if (j == printer_width)
- newcolor = !color; /* force output */
- if (newcolor == color)
- count++;
- else if (count == printer_width && color == 0) /* implies j == printer_width */
- lj3100sw_output_empty_line(prn_stream, buffer, &ptr, high_resolution);
- else /* print a sequence of pixels with a uniform color */
- while (newcolor != color) {
- int size = min(count, 64);
- tmp |= code[color][size].bits << bit_index;
- bit_index += code[color][size].length;
- while (bit_index >= 8) {
- lj3100sw_output_data_byte(prn_stream, buffer, &ptr, tmp & 0xff);
- tmp >>= 8;
- bit_index -= 8;
- }
- if (size == 64)
- count -= 64;
- else {
- color = newcolor;
- count = 1;
- }
- }
- }
- if (bit_index)
- lj3100sw_output_data_byte(prn_stream, buffer, &ptr, tmp & 0xff);
- }
- else
- lj3100sw_output_empty_line(prn_stream, buffer, &ptr, high_resolution);
- lj3100sw_output_newline(prn_stream, buffer, &ptr);
- }
+ for (i = 0; i < printer_height; i++) {
+ if (i < paper_height) {
+ int color = 0; /* white */
+ int count = 0;
+ int bit_index = 0;
+ uint tmp = 0;
+ gdev_prn_get_bits(pdev, i, in, &data);
+ for (j = 0; j <= printer_width; j++) {
+ int xoffset = (printer_width - paper_width) / 2;
+ int newcolor = 0;
+ if (j >= xoffset && j < xoffset + paper_width)
+ newcolor = (data[(j - xoffset) / 8] >> (7 - (j - xoffset) % 8)) & 1;
+ if (j == printer_width)
+ newcolor = !color; /* force output */
+ if (newcolor == color)
+ count++;
+ else if (count == printer_width && color == 0) /* implies j == printer_width */
+ lj3100sw_output_empty_line(prn_stream, buffer, &ptr, high_resolution);
+ else /* print a sequence of pixels with a uniform color */
+ while (newcolor != color) {
+ int size = min(count, 64);
+ tmp |= code[color][size].bits << bit_index;
+ bit_index += code[color][size].length;
+ while (bit_index >= 8) {
+ lj3100sw_output_data_byte(prn_stream, buffer, &ptr, tmp & 0xff);
+ tmp >>= 8;
+ bit_index -= 8;
+ }
+ if (size == 64)
+ count -= 64;
+ else {
+ color = newcolor;
+ count = 1;
+ }
+ }
+ }
+ if (bit_index)
+ lj3100sw_output_data_byte(prn_stream, buffer, &ptr, tmp & 0xff);
+ }
+ else
+ lj3100sw_output_empty_line(prn_stream, buffer, &ptr, high_resolution);
+ lj3100sw_output_newline(prn_stream, buffer, &ptr);
+ }
- for (i = 0; i < 3; i++ ) {
- lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x00);
- lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x08);
- lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x80);
- }
- lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0, 520);
- lj3100sw_flush_buffer(prn_stream, buffer, &ptr);
+ for (i = 0; i < 3; i++ ) {
+ lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x00);
+ lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x08);
+ lj3100sw_output_data_byte(prn_stream, buffer, &ptr, 0x80);
+ }
+ lj3100sw_output_repeated_data_bytes(prn_stream, buffer, &ptr, 0, 520);
+ lj3100sw_flush_buffer(prn_stream, buffer, &ptr);
- lj3100sw_output_section_header(prn_stream, 4, 0, 0);
- for (i = 0; i < 4 * ppdev->NumCopies; i++)
- lj3100sw_output_section_header(prn_stream, 54, 0, 0);
+ lj3100sw_output_section_header(prn_stream, 4, 0, 0);
+ for (i = 0; i < 4 * ppdev->NumCopies; i++)
+ lj3100sw_output_section_header(prn_stream, 54, 0, 0);
- gs_free(mem, (char *)in, line_size, 1, "lj3100sw_print_page");
- return 0;
+ gs_free(mem, (char *)in, line_size, 1, "lj3100sw_print_page");
+ return 0;
}
static int
lj3100sw_close(gx_device *pdev)
{
- int i;
- FILE *prn_stream = ((gx_device_printer *)pdev)->file;
+ int i;
+ FILE *prn_stream = ((gx_device_printer *)pdev)->file;
- lj3100sw_output_section_header(prn_stream, 0, 4, 0);
- fputs("XX\r\n", prn_stream);
- for (i = 0; i < 4 * ppdev->NumCopies; i++)
- lj3100sw_output_section_header(prn_stream, 54, 0, 0);
- lj3100sw_output_section_header(prn_stream, 2, 0, 0);
+ lj3100sw_output_section_header(prn_stream, 0, 4, 0);
+ fputs("XX\r\n", prn_stream);
+ for (i = 0; i < 4 * ppdev->NumCopies; i++)
+ lj3100sw_output_section_header(prn_stream, 54, 0, 0);
+ lj3100sw_output_section_header(prn_stream, 2, 0, 0);
- return gdev_prn_close(pdev);
+ return gdev_prn_close(pdev);
}
diff --git a/gs/base/gdevlbp8.c b/gs/base/gdevlbp8.c
index 56dbaea2e..9a5daa6d1 100644
--- a/gs/base/gdevlbp8.c
+++ b/gs/base/gdevlbp8.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,15 +14,15 @@
/* Canon LBP-8II and LIPS III driver */
#include "gdevprn.h"
-/*
+/*
Modifications:
2.2.97 Lauri Paatero
Changed CSI command into ESC [. DCS commands may still need to be changed
(to ESC P).
4.9.96 Lauri Paatero
- Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
+ Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
in upper left corner.
- Now using relative addressing for vertical addressing. This avoids
+ Now using relative addressing for vertical addressing. This avoids
problems
when printing to paper with wrong size.
18.6.96 Lauri Paatero, lauri.paatero@paatero.pp.fi
@@ -36,7 +36,6 @@ problems
LIPS III driver: Kenji Okamoto (okamoto@okamoto.cias.osakafu-u.ac.jp)
*/
-
#define X_DPI 300
#define Y_DPI 300
#define LINE_SIZE ((X_DPI * 85 / 10 + 7) / 8) /* bytes per line */
@@ -49,19 +48,19 @@ static dev_proc_print_page(lips3_print_page);
const gx_device_printer far_data gs_lbp8_device =
prn_device(prn_std_procs, "lbp8",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
- 1, lbp8_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
+ 1, lbp8_print_page);
#ifdef NOCONTRIB
const gx_device_printer far_data gs_lips3_device =
prn_device(prn_std_procs, "lips3",
- 82, /* width_10ths, 8.3" */
- 117, /* height_10ths, 11.7" */
- X_DPI, Y_DPI,
- 0.16, 0.27, 0.23, 0.27, /* margins */
- 1, lips3_print_page);
+ 82, /* width_10ths, 8.3" */
+ 117, /* height_10ths, 11.7" */
+ X_DPI, Y_DPI,
+ 0.16, 0.27, 0.23, 0.27, /* margins */
+ 1, lips3_print_page);
#endif
/* ------ Internal routines ------ */
@@ -77,7 +76,7 @@ static const char lbp8_init[] = {
ESC, '[', '1', '4', 'p', /* select page type (A4) */
ESC, '[', '1', '1', 'h', /* set mode */
ESC, '[', '7', ' ', 'I', /* select unit size (300dpi)*/
- ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
+ ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
};
#ifdef NOCONTRIB
@@ -103,97 +102,97 @@ static const char lips3_end[] = {
static int
can_print_page(gx_device_printer *pdev, FILE *prn_stream,
const char *init, int init_size, const char *end, int end_size)
-{
- char data[LINE_SIZE*2];
- char *out_data;
- int last_line_nro = 0;
-
- fwrite(init, init_size, 1, prn_stream); /* initialize */
-
- /* Send each scan line in turn */
- {
- int lnum;
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- byte rmask = (byte)(0xff << (-pdev->width & 7));
-
- for ( lnum = 0; lnum < pdev->height; lnum++ ) {
- char *end_data = data + LINE_SIZE;
- gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while ( end_data > data && end_data[-1] == 0 )
- end_data--;
- if ( end_data != data ) {
- int num_cols = 0;
- int out_count;
- int zero_count;
- out_data = data;
-
- /* move down */
- fprintf(prn_stream, "%c[%de",
- ESC, lnum-last_line_nro );
- last_line_nro = lnum;
-
- while (out_data < end_data) {
- /* Remove leading 0s*/
- while(out_data < end_data && *out_data == 0) {
- num_cols += 8;
+{
+ char data[LINE_SIZE*2];
+ char *out_data;
+ int last_line_nro = 0;
+
+ fwrite(init, init_size, 1, prn_stream); /* initialize */
+
+ /* Send each scan line in turn */
+ {
+ int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte rmask = (byte)(0xff << (-pdev->width & 7));
+
+ for ( lnum = 0; lnum < pdev->height; lnum++ ) {
+ char *end_data = data + LINE_SIZE;
+ gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data != data ) {
+ int num_cols = 0;
+ int out_count;
+ int zero_count;
+ out_data = data;
+
+ /* move down */
+ fprintf(prn_stream, "%c[%de",
+ ESC, lnum-last_line_nro );
+ last_line_nro = lnum;
+
+ while (out_data < end_data) {
+ /* Remove leading 0s*/
+ while(out_data < end_data && *out_data == 0) {
+ num_cols += 8;
out_data++;
}
- out_count = end_data - out_data;
- zero_count = 0;
-
- /* if there is a lot data, find if there is sequence of zeros */
- if (out_count>22) {
-
- out_count = 1;
-
- while(out_data+out_count+zero_count < end_data) {
- if (out_data[zero_count+out_count] != 0) {
- out_count += 1+zero_count;
- zero_count = 0;
- }
- else {
- zero_count++;
- if (zero_count>20)
- break;
- }
- }
-
- }
-
- if (out_count==0)
- break;
-
- /* move down and across*/
- fprintf(prn_stream, "%c[%d`",
- ESC, num_cols );
- /* transfer raster graphic command */
- fprintf(prn_stream, "%c[%d;%d;300;.r",
- ESC, out_count, out_count);
-
- /* send the row */
- fwrite(out_data, sizeof(char),
+ out_count = end_data - out_data;
+ zero_count = 0;
+
+ /* if there is a lot data, find if there is sequence of zeros */
+ if (out_count>22) {
+
+ out_count = 1;
+
+ while(out_data+out_count+zero_count < end_data) {
+ if (out_data[zero_count+out_count] != 0) {
+ out_count += 1+zero_count;
+ zero_count = 0;
+ }
+ else {
+ zero_count++;
+ if (zero_count>20)
+ break;
+ }
+ }
+
+ }
+
+ if (out_count==0)
+ break;
+
+ /* move down and across*/
+ fprintf(prn_stream, "%c[%d`",
+ ESC, num_cols );
+ /* transfer raster graphic command */
+ fprintf(prn_stream, "%c[%d;%d;300;.r",
+ ESC, out_count, out_count);
+
+ /* send the row */
+ fwrite(out_data, sizeof(char),
out_count, prn_stream);
- out_data += out_count+zero_count;
- num_cols += 8*(out_count+zero_count);
- }
- }
- }
- }
+ out_data += out_count+zero_count;
+ num_cols += 8*(out_count+zero_count);
+ }
+ }
+ }
+ }
- /* eject page */
- fprintf(prn_stream, "%c=", ESC);
+ /* eject page */
+ fprintf(prn_stream, "%c=", ESC);
- /* terminate */
- if (end != NULL)
- (void)fwrite(end, end_size, 1, prn_stream);
+ /* terminate */
+ if (end != NULL)
+ (void)fwrite(end, end_size, 1, prn_stream);
- return 0;
+ return 0;
}
/* Print an LBP-8 page. */
@@ -201,7 +200,7 @@ static int
lbp8_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
return can_print_page(pdev, prn_stream, lbp8_init, sizeof(lbp8_init),
- NULL, 0);
+ NULL, 0);
}
#ifdef NOCONTRIB
@@ -209,6 +208,6 @@ lbp8_print_page(gx_device_printer *pdev, FILE *prn_stream)
static int
lips3_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ return can_print_page(pdev, prn_stream, lips3_init, sizeof(lips3_init),
- lips3_end, sizeof(lips3_end));
+ lips3_end, sizeof(lips3_end));
}
#endif
diff --git a/gs/base/gdevlj56.c b/gs/base/gdevlj56.c
index 81a4fa38c..3e736d8f9 100644
--- a/gs/base/gdevlj56.c
+++ b/gs/base/gdevlj56.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,22 +44,22 @@ prn_procs(ljet5_open, gdev_prn_output_page, ljet5_close);
const gx_device_printer gs_lj5mono_device =
prn_device(ljet5_procs, "lj5mono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 1, ljet5_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0,
+ 1, ljet5_print_page);
static const gx_device_procs lj5gray_procs =
prn_color_procs(ljet5_open, gdev_prn_output_page, ljet5_close,
- gx_default_gray_map_rgb_color,
- gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color,
+ gx_default_gray_map_color_rgb);
const gx_device_printer gs_lj5gray_device = {
prn_device_body(gx_device_printer, lj5gray_procs, "lj5gray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 1, 8, 255, 0, 256, 1, ljet5_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0,
+ 1, 8, 255, 0, 256, 1, ljet5_print_page)
};
/* Open the printer, writing the stream header. */
@@ -69,20 +69,20 @@ ljet5_open(gx_device * pdev)
int code = gdev_prn_open(pdev);
if (code < 0)
- return code;
+ return code;
code = gdev_prn_open_printer(pdev, true);
if (code < 0)
- return code;
+ return code;
{
- gx_device_printer *const ppdev = (gx_device_printer *)pdev;
- stream fs;
- stream *const s = &fs;
- byte buf[50]; /* arbitrary */
-
- s_init(s, pdev->memory);
- swrite_file(s, ppdev->file, buf, sizeof(buf));
- px_write_file_header(s, pdev);
- sflush(s); /* don't close */
+ gx_device_printer *const ppdev = (gx_device_printer *)pdev;
+ stream fs;
+ stream *const s = &fs;
+ byte buf[50]; /* arbitrary */
+
+ s_init(s, pdev->memory);
+ swrite_file(s, ppdev->file, buf, sizeof(buf));
+ px_write_file_header(s, pdev);
+ sflush(s); /* don't close */
}
return 0;
}
@@ -95,7 +95,7 @@ ljet5_close(gx_device * pdev)
int code = gdev_prn_open_printer(pdev, true);
if (code < 0)
- return code;
+ return code;
px_write_file_trailer(ppdev->file);
return gdev_prn_close(pdev);
}
@@ -117,84 +117,84 @@ ljet5_print_page(gx_device_printer * pdev, FILE * prn_stream)
byte buf[200]; /* arbitrary */
if (line == 0 || out == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
s_init(s, mem);
swrite_file(s, prn_stream, buf, sizeof(buf));
/* Write the page header. */
{
- static const byte page_header[] = {
- pxtBeginPage,
- DUSP(0, 0), DA(pxaPoint),
- pxtSetCursor
- };
- static const byte mono_header[] = {
- DUB(eGray), DA(pxaColorSpace),
- DUB(e8Bit), DA(pxaPaletteDepth),
- pxt_ubyte_array, pxt_ubyte, 2, 0xff, 0x00, DA(pxaPaletteData),
- pxtSetColorSpace
- };
- static const byte gray_header[] = {
- DUB(eGray), DA(pxaColorSpace),
- pxtSetColorSpace
- };
-
- px_write_page_header(s, (gx_device *)pdev);
- px_write_select_media(s, (gx_device *)pdev, NULL, NULL, 0, false, false);
- PX_PUT_LIT(s, page_header);
- if (pdev->color_info.depth == 1)
- PX_PUT_LIT(s, mono_header);
- else
- PX_PUT_LIT(s, gray_header);
+ static const byte page_header[] = {
+ pxtBeginPage,
+ DUSP(0, 0), DA(pxaPoint),
+ pxtSetCursor
+ };
+ static const byte mono_header[] = {
+ DUB(eGray), DA(pxaColorSpace),
+ DUB(e8Bit), DA(pxaPaletteDepth),
+ pxt_ubyte_array, pxt_ubyte, 2, 0xff, 0x00, DA(pxaPaletteData),
+ pxtSetColorSpace
+ };
+ static const byte gray_header[] = {
+ DUB(eGray), DA(pxaColorSpace),
+ pxtSetColorSpace
+ };
+
+ px_write_page_header(s, (gx_device *)pdev);
+ px_write_select_media(s, (gx_device *)pdev, NULL, NULL, 0, false, false);
+ PX_PUT_LIT(s, page_header);
+ if (pdev->color_info.depth == 1)
+ PX_PUT_LIT(s, mono_header);
+ else
+ PX_PUT_LIT(s, gray_header);
}
/* Write the image header. */
{
- static const byte mono_image_header[] = {
- DA(pxaDestinationSize),
- DUB(eIndexedPixel), DA(pxaColorMapping),
- DUB(e1Bit), DA(pxaColorDepth),
- pxtBeginImage
- };
- static const byte gray_image_header[] = {
- DA(pxaDestinationSize),
- DUB(eDirectPixel), DA(pxaColorMapping),
- DUB(e8Bit), DA(pxaColorDepth),
- pxtBeginImage
- };
-
- px_put_us(s, pdev->width);
- px_put_a(s, pxaSourceWidth);
- px_put_us(s, pdev->height);
- px_put_a(s, pxaSourceHeight);
- px_put_usp(s, pdev->width, pdev->height);
- if (pdev->color_info.depth == 1)
- PX_PUT_LIT(s, mono_image_header);
- else
- PX_PUT_LIT(s, gray_image_header);
+ static const byte mono_image_header[] = {
+ DA(pxaDestinationSize),
+ DUB(eIndexedPixel), DA(pxaColorMapping),
+ DUB(e1Bit), DA(pxaColorDepth),
+ pxtBeginImage
+ };
+ static const byte gray_image_header[] = {
+ DA(pxaDestinationSize),
+ DUB(eDirectPixel), DA(pxaColorMapping),
+ DUB(e8Bit), DA(pxaColorDepth),
+ pxtBeginImage
+ };
+
+ px_put_us(s, pdev->width);
+ px_put_a(s, pxaSourceWidth);
+ px_put_us(s, pdev->height);
+ px_put_a(s, pxaSourceHeight);
+ px_put_usp(s, pdev->width, pdev->height);
+ if (pdev->color_info.depth == 1)
+ PX_PUT_LIT(s, mono_image_header);
+ else
+ PX_PUT_LIT(s, gray_image_header);
}
/* Write the image data, compressing each line. */
for (lnum = 0; lnum < pdev->height; ++lnum) {
- int ncompr;
- static const byte line_header[] = {
- DA(pxaStartLine),
- DUS(1), DA(pxaBlockHeight),
- DUB(eRLECompression), DA(pxaCompressMode),
- pxtReadImage
- };
-
- code = gdev_prn_copy_scan_lines(pdev, lnum, (byte *) line, line_size);
- if (code < 0)
- goto fin;
- px_put_us(s, lnum);
- PX_PUT_LIT(s, line_header);
- ncompr = gdev_pcl_mode2compress_padded(line, line + line_size_words,
- out, true);
- px_put_data_length(s, ncompr);
- px_put_bytes(s, out, ncompr);
+ int ncompr;
+ static const byte line_header[] = {
+ DA(pxaStartLine),
+ DUS(1), DA(pxaBlockHeight),
+ DUB(eRLECompression), DA(pxaCompressMode),
+ pxtReadImage
+ };
+
+ code = gdev_prn_copy_scan_lines(pdev, lnum, (byte *) line, line_size);
+ if (code < 0)
+ goto fin;
+ px_put_us(s, lnum);
+ PX_PUT_LIT(s, line_header);
+ ncompr = gdev_pcl_mode2compress_padded(line, line + line_size_words,
+ out, true);
+ px_put_data_length(s, ncompr);
+ px_put_bytes(s, out, ncompr);
}
/* Finish up. */
diff --git a/gs/base/gdevlp8k.c b/gs/base/gdevlp8k.c
index 7bb98c7d8..163cb63e3 100644
--- a/gs/base/gdevlp8k.c
+++ b/gs/base/gdevlp8k.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,29 +30,27 @@ encourage me to do it. (The only available in our laboratory "Operation
guide" in Japanese does not contain any information about it. And LP-8000
driver for Japanese Windows does not support this mode either.)
-
-The output data format is the following.
+The output data format is the following.
1. Initialization string, pretty long and sophisticated, I don't know why it
-was necessary.
+was necessary.
2. Data bits for each line. The most general format includes both starting X
and Y values as well as data type (simple or compressed).
3. Termination string.
-
- DATA FORMATS
+ DATA FORMATS
1. A simple (non-compressed) data format. By evident reasons it is NOT
SUPPORTED by the driver and is discussed here just as a starting point for
the future explanations. "\035" here is an alias for 0x1d ESC-character :
-"\035" "Starting X point in ASCII format" "X"
+"\035" "Starting X point in ASCII format" "X"
"\035" "Starting Y point in ASCII format" "Y"
-"\035" "Number of data BYTES for this printer line in ASCII format" ";"
-"Number of POINTS to print in this line (equals to the
-(Number of BYTES)*8)" ";"
+"\035" "Number of data BYTES for this printer line in ASCII format" ";"
+"Number of POINTS to print in this line (equals to the
+(Number of BYTES)*8)" ";"
"1;obi{I" "data BYTES for this line in BINARY format"
Both X and Y printer coordinates are 60 pixels shifted from the corresponding
@@ -61,17 +59,17 @@ example, 1 inch left margin requires the value of 300 - 60 = 240 for
starting X printer coordinate. Similar, 1.5 inch top margin requires Y
values to start from 300*1.5 - 60 = 390.
-The shortest possible abbreviation for the simple data format string is
+The shortest possible abbreviation for the simple data format string is
-"\035" "Starting Y point in ASCII format" "Y"
+"\035" "Starting Y point in ASCII format" "Y"
"\035" "Number of data BYTES for this printer line in ASCII format" ";"
-"Number of POINTS to print in this line (equals to the
-(Number of BYTES)*8)" ";"
+"Number of POINTS to print in this line (equals to the
+(Number of BYTES)*8)" ";"
"1;obi{I" "data BYTES for this line in BINARY format"
In this case the value of the starting X point is assumed to be equal to
that for the previous line.
-
+
An example of the data output for 2 printer lines
"\035"315X"\035"240Y"\035"2;16;1;obi{I"0ff0""\035"241Y"\035"3;24;1;obi{I"0f000f"
@@ -87,10 +85,10 @@ finally 4 black points.
General description is as follows.
-"\035" "Starting X point in ASCII format" "X"
+"\035" "Starting X point in ASCII format" "X"
"\035" "Starting Y point in ASCII format" "Y"
-"\035" "3bcI"
-"\035" "Total number of compressed BYTES in ASCII format" ";"
+"\035" "3bcI"
+"\035" "Total number of compressed BYTES in ASCII format" ";"
"Number of POINTS to print in this line" ";"
"1;obi{I" "compressed data BYTES for this line in BINARY format"
"\035" "0bcI"
@@ -100,11 +98,11 @@ of the compressed data format, respectively. As in the discussed above case
of a non-compressed data format, the shortest abbreviation has the form of
"\035" "Starting Y point in ASCII format" "Y"
-"\035" "Total number of compressed BYTES in ASCII format" ";"
+"\035" "Total number of compressed BYTES in ASCII format" ";"
"Number of POINTS to print in this line" ";"
"1;obi{I" "compressed data BYTES for this line in BINARY format"
-COMPRESSED DATA BYTES FORMAT has the form of
+COMPRESSED DATA BYTES FORMAT has the form of
"d1 d2 d3 d4 d4 count_d4 d5 d6 d6 count_d6 ... d(n-1) d(n-1) count_d(n-1) dn"
@@ -118,7 +116,7 @@ bytes somewhere in the data stream, they MUST follow by zero.
Example of 2 compressed data strings.
"\035"105X"\035"320Y"\035"3bcI"\035"3;2048;1;obi{I"0000fe"
-"\035"105X"\035"321Y"\035"11;2048;1;obi{I"0000021fffffe5fc000011"
+"\035"105X"\035"321Y"\035"11;2048;1;obi{I"0000021fffffe5fc000011"
The first one containing 3 bytes of compressed data will result in empty
(zero) line of 2048 blank points started from X=105, Y=320. The second one
@@ -131,7 +129,6 @@ the byte boundary. I did it for the sake of simplicity. One more argument in
favor of this step is that the error of positioning does not exceed (7 /
300) inches or (7 / 118) cm, that is 0.6 mm, which is negligible, I guess.
-
ADDITIONAL INFORMATION
It is also possible to use LP-8000 printer with 180x180 DPI resolution as an
@@ -140,7 +137,7 @@ the value 0x30 in static const char ibmpro_init_string[]. Decimal 36
fixes the 1,5 times elongation along the vertical axis. It is also
recommended to choose the appropriate values for all margins. In my case it
was 0.2, 0.6, 0, 0.3 in the device descriptor instead of the 0.2, 0.95, 0,
-1.0
+1.0
Nevertheless, typical Latex file looked so ugly after printing in this mode,
that I preferred to spend several days for hacking the format of the Japanese
@@ -148,21 +145,20 @@ Windows printer output for 300 DPI resolution and create my own driver.
Any suggestions, corrections, critical comments, etc. are welcome!
-Oleg Fat'yanov <faty1@rlem.titech.ac.jp>
+Oleg Fat'yanov <faty1@rlem.titech.ac.jp>
*/
-
#include "gdevprn.h"
#ifndef X_DPI
#define X_DPI 300
#endif
-
+
#ifndef Y_DPI
#define Y_DPI 300
#endif
-
+
#define L_MARGIN 0.25
#define B_MARGIN 0.25
#define R_MARGIN 0.25
@@ -172,175 +168,169 @@ static dev_proc_print_page(lp8000_print_page);
gx_device_printer far_data gs_lp8000_device =
prn_device(prn_std_procs, "lp8000",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- L_MARGIN, B_MARGIN, R_MARGIN, T_MARGIN,
- 1, lp8000_print_page);
-
-
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ L_MARGIN, B_MARGIN, R_MARGIN, T_MARGIN,
+ 1, lp8000_print_page);
+
static int
lp8000_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
int in_size = line_size;
-
- byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "lp8000_print_page(buf1)");
+
+ byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "lp8000_print_page(buf1)");
byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "lp8000_print_page(buf2)");
byte *in = buf1;
byte *out = buf2;
-
+
int lnum, top, bottom, left, width;
int count, left1, left2, left0;
-/* Check memory allocations */
-
+/* Check memory allocations */
+
if ( buf1 == 0 || buf2 == 0 )
{ if ( buf1 )
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
-
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
+
if ( buf2 )
gs_free(pdev->memory, (char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
-
+
return_error(gs_error_VMerror);
- }
+ }
/* Initialize the printer */
-
- fwrite("\033\001@EJL \n",1,8,prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
- fwrite("\035rhE\033\001@EJL \n",1,12,prn_stream);
- fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
- fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
- fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
- fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
- fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
- fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
- fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
- fwrite("\0351cmE\0350alfP",1,11,prn_stream);
- fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
- fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
- fwrite("\0351;0;100spE\0352owE",1,16,prn_stream);
-
-/* Here the common part of the initialization string ends */
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\035rhE\033\001@EJL \n",1,12,prn_stream);
+ fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
+ fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
+ fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
+ fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
+ fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
+ fwrite("\0351cmE\0350alfP",1,11,prn_stream);
+ fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
+ fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
+ fwrite("\0351;0;100spE\0352owE",1,16,prn_stream);
+
+/* Here the common part of the initialization string ends */
/* Calculate the PRINTER_LEFT_MARGIN = device_left_margin - 60 adjusted to
the byte boundary. Save this value for future comparison and set the
starting X value of the printer line.
*/
- left1 = (int) (L_MARGIN * pdev->x_pixels_per_inch) - 60;
- left1 = (left1 >> 3) << 3;
- left0 = left1;
+ left1 = (int) (L_MARGIN * pdev->x_pixels_per_inch) - 60;
+ left1 = (left1 >> 3) << 3;
+ left0 = left1;
- fwrite("\035",1,1,prn_stream);
+ fwrite("\035",1,1,prn_stream);
fprintf(prn_stream,"%d",left1);
fwrite("X",1,1,prn_stream);
-
- /* Set the compressed data format */
+
+ /* Set the compressed data format */
fwrite("\0353bcI",1,5,prn_stream);
-
- top = T_MARGIN * pdev->y_pixels_per_inch;
+
+ top = T_MARGIN * pdev->y_pixels_per_inch;
bottom = pdev->height - B_MARGIN * pdev->y_pixels_per_inch;
-
- left = ( (int) (L_MARGIN * pdev->x_pixels_per_inch) ) >> 3 ;
- width = ((pdev->width - (int)(R_MARGIN * pdev->x_pixels_per_inch)) >> 3) - left;
-
- /*
- ** Print the page:
- */
- for ( lnum = top; lnum < bottom ; )
+ left = ( (int) (L_MARGIN * pdev->x_pixels_per_inch) ) >> 3 ;
+ width = ((pdev->width - (int)(R_MARGIN * pdev->x_pixels_per_inch)) >> 3) - left;
+ /*
+ ** Print the page:
+ */
- {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *outp;
- register byte *p, *q;
- int lcnt;
+ for ( lnum = top; lnum < bottom ; )
- /*
- ** Check buffer for 0 data.
- */
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *outp;
+ register byte *p, *q;
+ int lcnt;
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- while ( in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
- lnum < bottom )
- {
- lnum++;
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- }
+ /*
+ ** Check buffer for 0 data.
+ */
- if(lnum == bottom ) break;
- /* finished with this page */
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ while ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
+ lnum < bottom )
+ {
+ lnum++;
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ }
+ if(lnum == bottom ) break;
+ /* finished with this page */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- inp = in + left;
- in_end = inp + width;
+ inp = in + left;
+ in_end = inp + width;
/* Remove trailing 0s form the scan line data */
- while (in_end > inp && in_end[-1] == 0)
- {
- in_end--;
- }
-
+ while (in_end > inp && in_end[-1] == 0)
+ {
+ in_end--;
+ }
+
/* Remove leading 0s form the scan line data */
-
- for(left2 = 0; inp < in_end && inp[0] == 0; inp++,left2++);
-/* Recalculate starting X value */
-
- left2 = left1 + (left2 << 3);
+ for(left2 = 0; inp < in_end && inp[0] == 0; inp++,left2++);
+/* Recalculate starting X value */
+ left2 = left1 + (left2 << 3);
/* Compress non-zero data for this line*/
- outp = out;
+ outp = out;
for( p = inp, q = inp + 1 ; q < in_end ; )
- {
- if( *p != *q++ )
- {
- /*
- Copy non-repeated bytes
- to the output buffer
- */
- *outp++ = *p++;
- }
- else
- {
- for (count = 2; ( *p == *q ) && (q < in_end); q++, count++);
-
- /*
- Copy repeated bytes and counts to the output buffer.
- As long as count is <= 255, additional step is necessary
- for a long repeated sequence
- */
-
- while (count > 257)
- {
- *outp++ = *p;
- *outp++ = *p;
- *outp++ = 255;
- p += 257;
- count -=257;
- }
- *outp++ = *p;
- *outp++ = *p;
- *outp++ = count - 2;
- p += count;
- q = p+1;
- }
- }
+ {
+ if( *p != *q++ )
+ {
+ /*
+ Copy non-repeated bytes
+ to the output buffer
+ */
+ *outp++ = *p++;
+ }
+ else
+ {
+ for (count = 2; ( *p == *q ) && (q < in_end); q++, count++);
+
+ /*
+ Copy repeated bytes and counts to the output buffer.
+ As long as count is <= 255, additional step is necessary
+ for a long repeated sequence
+ */
+
+ while (count > 257)
+ {
+ *outp++ = *p;
+ *outp++ = *p;
+ *outp++ = 255;
+ p += 257;
+ count -=257;
+ }
+ *outp++ = *p;
+ *outp++ = *p;
+ *outp++ = count - 2;
+ p += count;
+ q = p+1;
+ }
+ }
/* The next line is necessary just in case of a single non-repeated byte at
the end of the input buffer */
@@ -348,59 +338,58 @@ the end of the input buffer */
if (p == (in_end - 1)) *outp++ = *p;
/* End of the compression procedure */
-
/* Set a new value of the starting X point, if necessary */
if (left2 != left0)
- {
- left0 = left2;
- fwrite("\035",1,1,prn_stream);
+ {
+ left0 = left2;
+ fwrite("\035",1,1,prn_stream);
fprintf(prn_stream,"%d",left2);
fwrite("X",1,1,prn_stream);
}
-/* Output the data string to the printer.
+/* Output the data string to the printer.
Y coordinate of the printer equals (lnum - 60)
-*/
+*/
fwrite("\035",1,1,prn_stream);
fprintf(prn_stream,"%d",lnum-60);
fwrite("Y\035",1,2,prn_stream);
fprintf(prn_stream,"%d;",(outp - out));
- fprintf(prn_stream,"%d;",(in_end - inp) << 3);
- fwrite("1;0bi{I",1,7,prn_stream);
- fwrite(out,1,(outp - out),prn_stream);
-
+ fprintf(prn_stream,"%d;",(in_end - inp) << 3);
+ fwrite("1;0bi{I",1,7,prn_stream);
+ fwrite(out,1,(outp - out),prn_stream);
+
lnum++;
-
+
}
/* Send the termination string */
- fwrite("\0350bcI",1,5,prn_stream);
- fwrite("\0351coO",1,5,prn_stream);
- fwrite("\035rhE",1,4,prn_stream);
-
+ fwrite("\0350bcI",1,5,prn_stream);
+ fwrite("\0351coO",1,5,prn_stream);
+ fwrite("\035rhE",1,4,prn_stream);
+
fwrite("\033\001@EJL \n",1,8,prn_stream);
- fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
- fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
- fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
- fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
- fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
- fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
- fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
- fwrite("\0351cmE\0350alfP",1,11,prn_stream);
- fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
- fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
- fwrite("\035rhE",1,4,prn_stream);
- fwrite("\033\001@EJL \n",1,8,prn_stream);
- fwrite("\033\001@EJL \n",1,8,prn_stream);
-
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
- return 0;
+ fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
+ fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
+ fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
+ fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
+ fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
+ fwrite("\0351cmE\0350alfP",1,11,prn_stream);
+ fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
+ fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
+ fwrite("\035rhE",1,4,prn_stream);
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
+ return 0;
}
diff --git a/gs/base/gdevlxm.c b/gs/base/gdevlxm.c
index 3fb016ecc..f5a0d6022 100644
--- a/gs/base/gdevlxm.c
+++ b/gs/base/gdevlxm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ static dev_proc_get_params(lxm_get_params);
static dev_proc_put_params(lxm_put_params);
/* set up dispatch table. I follow gdevdjet in using gdev_prn_output_page */
-static const gx_device_procs lxm5700m_procs =
+static const gx_device_procs lxm5700m_procs =
prn_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
lxm_get_params, lxm_put_params);
@@ -53,10 +53,10 @@ typedef struct lxm_device_s { /* a sub-class of gx_device_printer */
/* Standard lxm5700m device */
lxm_device far_data gs_lxm5700m_device = {
prn_device_std_body(lxm_device, lxm5700m_procs, "lxm5700m",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 600, 600, /* x dpi, y dpi */
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, lxm5700m_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 600, 600, /* x dpi, y dpi */
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, lxm5700m_print_page),
16 /* default headSeparation value */
};
@@ -94,33 +94,32 @@ lxm_device far_data gs_lxm5700m_device = {
/*
* various output shorthands
*/
-
+
#define init1() \
- top(), \
- 0xA5,0, 3, 0x40,4,5, \
- 0xA5,0, 3, 0x40,4,6, \
- 0xA5,0, 3, 0x40,4,7, \
- 0xA5,0, 3, 0x40,4,8, \
- 0xA5,0, 4, 0x40,0xe0,0x0b, 3
+ top(), \
+ 0xA5,0, 3, 0x40,4,5, \
+ 0xA5,0, 3, 0x40,4,6, \
+ 0xA5,0, 3, 0x40,4,7, \
+ 0xA5,0, 3, 0x40,4,8, \
+ 0xA5,0, 4, 0x40,0xe0,0x0b, 3
#define init2() \
- 0xA5,0, 11, 0x40,0xe0,0x41, 0,0,0,0,0,0,0, 2, \
- 0xA5,0, 6, 0x40, 5, 0,0,0x80,0 \
+ 0xA5,0, 11, 0x40,0xe0,0x41, 0,0,0,0,0,0,0, 2, \
+ 0xA5,0, 6, 0x40, 5, 0,0,0x80,0 \
#define init3() \
- 0x1b,'*', 7,0x73,0x30, \
- 0x1b,'*', 'm', 0, 0x14, 3, 0x84, 2, 0, 1, 0xf4, \
- 0x1b,'*', 7,0x63, \
- 0x1b,'*', 'm', 0, 0x42, 0, 0, \
- 0xA5,0, 5, 0x40,0xe0,0x80, 8, 7, \
- 0x1b,'*', 'm', 0, 0x40, 0x15, 7, 0x0f, 0x0f \
+ 0x1b,'*', 7,0x73,0x30, \
+ 0x1b,'*', 'm', 0, 0x14, 3, 0x84, 2, 0, 1, 0xf4, \
+ 0x1b,'*', 7,0x63, \
+ 0x1b,'*', 'm', 0, 0x42, 0, 0, \
+ 0xA5,0, 5, 0x40,0xe0,0x80, 8, 7, \
+ 0x1b,'*', 'm', 0, 0x40, 0x15, 7, 0x0f, 0x0f \
#define top() \
- 0xA5,0, 6, 0x40, 3,3,0xc0,0x0f,0x0f \
+ 0xA5,0, 6, 0x40, 3,3,0xc0,0x0f,0x0f \
#define fin() \
- 0x1b,'*', 7, 0x65 \
-
+ 0x1b,'*', 7, 0x65 \
#define outByte(b) putc(b, prn_stream)
@@ -133,225 +132,223 @@ lxm_device far_data gs_lxm5700m_device = {
/* height of printhead in pixels */
#define swipeHeight 208
/* number of shorts described by each column directory */
-#define directorySize 13
+#define directorySize 13
/* ------ Driver procedures ------ */
-
/* Send the page to the printer. */
static int
lxm5700m_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
+{
int lnum,minX, maxX, i, l, highestX, leastX, extent;
int direction = RIGHTWARD;
int lastY = 0;
-
+
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
/* Note that in_size is a multiple of 8. */
int in_size = line_size * (swipeHeight);
int swipeBuf_size = in_size;
byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "lxm_print_page(buf1)");
byte *swipeBuf =
- (byte *)gs_malloc(pdev->memory, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");
+ (byte *)gs_malloc(pdev->memory, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");
byte *in = buf1;
/* Check allocations */
if ( buf1 == 0 || swipeBuf == 0 ) {
- if ( buf1 )
+ if ( buf1 )
quit_ignomiously: /* and a goto into an if statement is pretty ignomious! */
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "lxm_print_page(buf1)");
- if ( swipeBuf )
- gs_free(pdev->memory, (char *)swipeBuf, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");
- return_error(gs_error_VMerror);
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "lxm_print_page(buf1)");
+ if ( swipeBuf )
+ gs_free(pdev->memory, (char *)swipeBuf, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");
+ return_error(gs_error_VMerror);
}
{ /* Initialize the printer and reset the margins. */
- static const char init_string[] = {
- init1(),
- init2(),
- init3()
- };
- fwrite(init_string, 1, sizeof(init_string), prn_stream);
+ static const char init_string[] = {
+ init1(),
+ init2(),
+ init3()
+ };
+ fwrite(init_string, 1, sizeof(init_string), prn_stream);
}
/* Print lines of graphics */
for (lnum=0; lnum < pdev->height-swipeHeight ; ) { /* increment in body */
- byte *in_data;
- register byte *outp;
- int lcnt;
-
- { /* test for blank scan lines. We maintain the */
- /* loop invariant lnum <pdev->height, but modify lnum */
- int l;
-
- for (l=lnum; l<pdev->height; l++) {
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_get_bits(pdev, l, in, &in_data);
- if ( in_data[0] != 0 ||
- memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
- ) {
- break;
- }
- }/* end for l */
-
- /* now l is the next non-blank scan line */
- if (l >= pdev->height) {/* if there are no more bits on this page */
- lnum = l;
- break; /* end the loop and eject the page*/
- }
-
- /* leave room for following swipe to reinforce these bits */
- if (l-lnum > overLap) lnum = l - overLap;
-
- /* if the first non-blank near bottom of page */
- if (lnum >=pdev->height - swipeHeight) {
- /* don't move the printhead over empty air*/
- lnum = pdev->height - swipeHeight;
- }
- }
-
-
- /* Copy the the scan lines. */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if ( lcnt < swipeHeight ) {
- /* Pad with lines of zeros. */
- memset(in + lcnt * line_size, 0,
- in_size - lcnt * line_size);
- }
-
- /* compute right and left margin for this swipe */
- minX = line_size;
- maxX = 0;
- for (l=0; l<swipeHeight; l++) {/* for each line of swipe */
- for (i=0; i<minX; i++) {/* look for left-most non-zero byte*/
- if (in[l*line_size+i] !=0) {
- minX = i;
- break;
- }
- }
- for (i=line_size-1; i>=maxX; i--) {/* look for right-most */
- if (in[l*line_size+i] !=0) {
- maxX = i;
- break;
- }
- }
- }
- minX = (minX&(-2)); /* truncate to even */
- maxX = (maxX+3)&-2; /* raise to even */
-
- highestX = maxX*8-1;
- leastX = minX*8;
- extent = highestX -leastX +1;
-
- outp = swipeBuf;
-
- /* macro, not fcn call. Space penalty is modest, speed helps */
+ byte *in_data;
+ register byte *outp;
+ int lcnt;
+
+ { /* test for blank scan lines. We maintain the */
+ /* loop invariant lnum <pdev->height, but modify lnum */
+ int l;
+
+ for (l=lnum; l<pdev->height; l++) {
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_get_bits(pdev, l, in, &in_data);
+ if ( in_data[0] != 0 ||
+ memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
+ ) {
+ break;
+ }
+ }/* end for l */
+
+ /* now l is the next non-blank scan line */
+ if (l >= pdev->height) {/* if there are no more bits on this page */
+ lnum = l;
+ break; /* end the loop and eject the page*/
+ }
+
+ /* leave room for following swipe to reinforce these bits */
+ if (l-lnum > overLap) lnum = l - overLap;
+
+ /* if the first non-blank near bottom of page */
+ if (lnum >=pdev->height - swipeHeight) {
+ /* don't move the printhead over empty air*/
+ lnum = pdev->height - swipeHeight;
+ }
+ }
+
+ /* Copy the the scan lines. */
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ if ( lcnt < swipeHeight ) {
+ /* Pad with lines of zeros. */
+ memset(in + lcnt * line_size, 0,
+ in_size - lcnt * line_size);
+ }
+
+ /* compute right and left margin for this swipe */
+ minX = line_size;
+ maxX = 0;
+ for (l=0; l<swipeHeight; l++) {/* for each line of swipe */
+ for (i=0; i<minX; i++) {/* look for left-most non-zero byte*/
+ if (in[l*line_size+i] !=0) {
+ minX = i;
+ break;
+ }
+ }
+ for (i=line_size-1; i>=maxX; i--) {/* look for right-most */
+ if (in[l*line_size+i] !=0) {
+ maxX = i;
+ break;
+ }
+ }
+ }
+ minX = (minX&(-2)); /* truncate to even */
+ maxX = (maxX+3)&-2; /* raise to even */
+
+ highestX = maxX*8-1;
+ leastX = minX*8;
+ extent = highestX -leastX +1;
+
+ outp = swipeBuf;
+
+ /* macro, not fcn call. Space penalty is modest, speed helps */
#define buffer_store(x) if(outp-swipeBuf>=swipeBuf_size) {\
- gs_free(pdev->memory, (char *)swipeBuf, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");\
- swipeBuf_size*=2;\
- swipeBuf = (byte *)gs_malloc(pdev->memory, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");\
- if (swipeBuf == 0) goto quit_ignomiously;\
- break;}\
- else *outp++ = (x)
-
- {/* work out the bytes to store for this swipe*/
-
- int sx, sxBy8, sxMask;
- int words[directorySize];
- bool f, sum;
- int retval=0;
- int j,c,y;
- int j1,c1;
- int i,b,x, directory ;
-
- /* want to set up pointers for (upto two) stripes covered by the output*/
-
- /* now for each column covered by output: */
- for (x=leastX; x<=highestX; x++) {
- for (i=0; i<directorySize; i++) {
- words[i] = 0;
- }
- directory = 0x2000; /* empty directory != 0 */
-
- /* prime loops: make comparisons here */
- switch (direction) {
- case(RIGHTWARD):
- sx = (x&1)==1 ? x : x-(((lxm_device*)pdev)->headSeparation);
- j1 = (x&1); /* even if x even, odd if x odd */
- break;
- default: /* shouldn't happen ... but compilation checks */
- case(LEFTWARD):
- sx = (x&1)==0 ? x : x-((lxm_device*)pdev)->headSeparation;
- j1 = 1-(x&1); /* odd if x even, even if x odd */
- }
- c1 = 0x8000 >> j1;
-
- sxBy8 = sx/8;
- sxMask = 0x80>>(sx%8);
-
- /* loop through all the swipeHeight bits of this column */
- for (i = 0, b=1, y= sxBy8+j1*line_size; i < directorySize; i++,b<<=1) {
- sum = false;
- for (j=j1,c=c1 /*,y=i*16*line_size+sxBy8*/; j<16; j+=2, y+=2*line_size, c>>=2) {
- f = (in[y]&sxMask);
- if (f) {
- words[i] |= c;
- sum |= f;
- }
- }
- if (!sum) directory |=b;
- }
- retval+=2;
- buffer_store(directory>>8); buffer_store(directory&0xff);
- if (directory != 0x3fff) {
- for (i=0; i<directorySize; i++) {
- if (words[i] !=0) {
- buffer_store(words[i]>>8) ; buffer_store(words[i]&0xff);
- retval += 2;
- }
- }
- }
- }
+ gs_free(pdev->memory, (char *)swipeBuf, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");\
+ swipeBuf_size*=2;\
+ swipeBuf = (byte *)gs_malloc(pdev->memory, swipeBuf_size, 1, "lxm_print_page(swipeBuf)");\
+ if (swipeBuf == 0) goto quit_ignomiously;\
+ break;}\
+ else *outp++ = (x)
+
+ {/* work out the bytes to store for this swipe*/
+
+ int sx, sxBy8, sxMask;
+ int words[directorySize];
+ bool f, sum;
+ int retval=0;
+ int j,c,y;
+ int j1,c1;
+ int i,b,x, directory ;
+
+ /* want to set up pointers for (upto two) stripes covered by the output*/
+
+ /* now for each column covered by output: */
+ for (x=leastX; x<=highestX; x++) {
+ for (i=0; i<directorySize; i++) {
+ words[i] = 0;
+ }
+ directory = 0x2000; /* empty directory != 0 */
+
+ /* prime loops: make comparisons here */
+ switch (direction) {
+ case(RIGHTWARD):
+ sx = (x&1)==1 ? x : x-(((lxm_device*)pdev)->headSeparation);
+ j1 = (x&1); /* even if x even, odd if x odd */
+ break;
+ default: /* shouldn't happen ... but compilation checks */
+ case(LEFTWARD):
+ sx = (x&1)==0 ? x : x-((lxm_device*)pdev)->headSeparation;
+ j1 = 1-(x&1); /* odd if x even, even if x odd */
+ }
+ c1 = 0x8000 >> j1;
+
+ sxBy8 = sx/8;
+ sxMask = 0x80>>(sx%8);
+
+ /* loop through all the swipeHeight bits of this column */
+ for (i = 0, b=1, y= sxBy8+j1*line_size; i < directorySize; i++,b<<=1) {
+ sum = false;
+ for (j=j1,c=c1 /*,y=i*16*line_size+sxBy8*/; j<16; j+=2, y+=2*line_size, c>>=2) {
+ f = (in[y]&sxMask);
+ if (f) {
+ words[i] |= c;
+ sum |= f;
+ }
+ }
+ if (!sum) directory |=b;
+ }
+ retval+=2;
+ buffer_store(directory>>8); buffer_store(directory&0xff);
+ if (directory != 0x3fff) {
+ for (i=0; i<directorySize; i++) {
+ if (words[i] !=0) {
+ buffer_store(words[i]>>8) ; buffer_store(words[i]&0xff);
+ retval += 2;
+ }
+ }
+ }
+ }
#undef buffer_store
- }
- {/* now write out header, then buffered bits */
- int leastY = lnum;
-
- /* compute size of swipe, needed for header */
- int sz = 0x1a + outp - swipeBuf;
-
- /* put out header*/
- int deltaY = 2*(leastY - lastY); /* vert coordinates here are 1200 dpi */
- lastY = leastY;
- outByte(0x1b); outByte('*'); outByte(3);
- outByte(deltaY>>8); outByte(deltaY&0xff);
- outByte(0x1b); outByte('*'); outByte(4); outByte(0); outByte(0);
- outByte(sz>>8); outByte(sz&0xff); outByte(0); outByte(3);
- outByte(1); outByte(1); outByte(0x1a);
- outByte(0);
- outByte(extent>>8); outByte(extent&0xff);
- outByte(leastX>>8); outByte(leastX&0xff);
- outByte(highestX>>8); outByte(highestX&0xff);
- outByte(0); outByte(0);
- outByte(0x22); outByte(0x33); outByte(0x44);
- outByte(0x55); outByte(1);
- /* put out bytes */
- fwrite(swipeBuf,1,outp-swipeBuf,prn_stream);
- }
- lnum += overLap;
- direction ^= 1;
+ }
+ {/* now write out header, then buffered bits */
+ int leastY = lnum;
+
+ /* compute size of swipe, needed for header */
+ int sz = 0x1a + outp - swipeBuf;
+
+ /* put out header*/
+ int deltaY = 2*(leastY - lastY); /* vert coordinates here are 1200 dpi */
+ lastY = leastY;
+ outByte(0x1b); outByte('*'); outByte(3);
+ outByte(deltaY>>8); outByte(deltaY&0xff);
+ outByte(0x1b); outByte('*'); outByte(4); outByte(0); outByte(0);
+ outByte(sz>>8); outByte(sz&0xff); outByte(0); outByte(3);
+ outByte(1); outByte(1); outByte(0x1a);
+ outByte(0);
+ outByte(extent>>8); outByte(extent&0xff);
+ outByte(leastX>>8); outByte(leastX&0xff);
+ outByte(highestX>>8); outByte(highestX&0xff);
+ outByte(0); outByte(0);
+ outByte(0x22); outByte(0x33); outByte(0x44);
+ outByte(0x55); outByte(1);
+ /* put out bytes */
+ fwrite(swipeBuf,1,outp-swipeBuf,prn_stream);
+ }
+ lnum += overLap;
+ direction ^= 1;
}/* ends the loop for swipes of the print head.*/
/* Eject the page and reinitialize the printer */
{
- static const char bottom[] = {
- fin() /*, looks like I can get away with only this much ...
- init1(),
- init3(),
- fin() ,
- top(),
- fin() */
- };
- fwrite(bottom, 1, sizeof(bottom), prn_stream);
+ static const char bottom[] = {
+ fin() /*, looks like I can get away with only this much ...
+ init1(),
+ init3(),
+ fin() ,
+ top(),
+ fin() */
+ };
+ fwrite(bottom, 1, sizeof(bottom), prn_stream);
}
fflush(prn_stream);
@@ -360,11 +357,11 @@ quit_ignomiously: /* and a goto into an if statement is pretty ignomious! */
return 0;
}
-/*
- * There are a number of parameters which can differ between ink cartridges.
+/*
+ * There are a number of parameters which can differ between ink cartridges.
* The Windows driver asks you to recalibrate every time you load a new
* cartridge.
- * most of the parameters adjusted there relate to color, and so this
+ * most of the parameters adjusted there relate to color, and so this
* monotone driver doesn't need them. However, the Lexmark 5700 black
* cartridge has two columns of dots, separated by about 16 pixels.
* This `head separation' distance can vary between cartridges, so
@@ -382,15 +379,15 @@ quit_ignomiously: /* and a goto into an if statement is pretty ignomious! */
static int
lxm_get_params(gx_device *pdev, gs_param_list *plist)
-{
+{
lxm_device* const ldev = (lxm_device*)pdev;
int code = gdev_prn_get_params(pdev, plist);
if ( code < 0 ) return code;
- code = param_write_int(plist,
- "HeadSeparation",
- (int *)&(ldev->headSeparation));
-
+ code = param_write_int(plist,
+ "HeadSeparation",
+ (int *)&(ldev->headSeparation));
+
return code;
}
@@ -404,7 +401,7 @@ lxm_put_params(gx_device *pdev, gs_param_list *plist)
int code = param_read_int(plist, "HeadSeparation", &trialHeadSeparation);
if ( trialHeadSeparation < 1 || trialHeadSeparation > 32 )
- param_signal_error(plist, "HeadSeparation", gs_error_rangecheck);
+ param_signal_error(plist, "HeadSeparation", gs_error_rangecheck);
/* looks like param_signal_error is not expected to return */
ecode = gdev_prn_put_params(pdev, plist); /* call super class put_params */
if ( code < 0 ) return code;
diff --git a/gs/base/gdevm1.c b/gs/base/gdevm1.c
index a499a3eba..b10baf791 100644
--- a/gs/base/gdevm1.c
+++ b/gs/base/gdevm1.c
@@ -56,11 +56,11 @@
int
mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
int sourcex,uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
+ const gx_color_index * scolors,
const gx_strip_bitmap * textures,
const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y,
gs_logical_operation_t lop)
{
gx_device_memory *mdev = (gx_device_memory *) dev;
@@ -78,35 +78,35 @@ mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
/* Modify the raster operation according to the source palette. */
if (scolors != 0) { /* Source with palette. */
- switch ((int)((scolors[1] << 1) + scolors[0])) {
- case 0:
- rop = rop3_know_S_0(rop);
- break;
- case 1:
- rop = rop3_invert_S(rop);
- break;
- case 2:
- break;
- case 3:
- rop = rop3_know_S_1(rop);
- break;
- }
+ switch ((int)((scolors[1] << 1) + scolors[0])) {
+ case 0:
+ rop = rop3_know_S_0(rop);
+ break;
+ case 1:
+ rop = rop3_invert_S(rop);
+ break;
+ case 2:
+ break;
+ case 3:
+ rop = rop3_know_S_1(rop);
+ break;
+ }
}
/* Modify the raster operation according to the texture palette. */
if (tcolors != 0) { /* Texture with palette. */
- switch ((int)((tcolors[1] << 1) + tcolors[0])) {
- case 0:
- rop = rop3_know_T_0(rop);
- break;
- case 1:
- rop = rop3_invert_T(rop);
- break;
- case 2:
- break;
- case 3:
- rop = rop3_know_T_1(rop);
- break;
- }
+ switch ((int)((tcolors[1] << 1) + tcolors[0])) {
+ case 0:
+ rop = rop3_know_T_0(rop);
+ break;
+ case 1:
+ rop = rop3_invert_T(rop);
+ break;
+ case 2:
+ break;
+ case 3:
+ rop = rop3_know_T_1(rop);
+ break;
+ }
}
/* Handle constant source and/or texture, and other special cases. */
{
@@ -114,107 +114,107 @@ mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
gx_color_index color0, color1;
#endif
- switch (rop_usage_table[rop]) {
+ switch (rop_usage_table[rop]) {
case rop_usage_none:
#ifndef DO_FILL_RECT_BY_COPY_ROP /* Fill rect calls us - don't call it */
- /* We're just filling with a constant. */
- return (*dev_proc(dev, fill_rectangle))
- (dev, x, y, width, height, (gx_color_index) (rop & 1));
+ /* We're just filling with a constant. */
+ return (*dev_proc(dev, fill_rectangle))
+ (dev, x, y, width, height, (gx_color_index) (rop & 1));
#else
break;
#endif
case rop_usage_D:
- /* This is either D (no-op) or ~D. */
- if (rop == rop3_D)
- return 0;
- /* Code no_S inline, then finish with no_T. */
- fit_fill(dev, x, y, width, height);
- sdata = scan_line_base(mdev, 0);
- sourcex = x;
- sraster = 0;
- goto no_T;
- case rop_usage_S:
+ /* This is either D (no-op) or ~D. */
+ if (rop == rop3_D)
+ return 0;
+ /* Code no_S inline, then finish with no_T. */
+ fit_fill(dev, x, y, width, height);
+ sdata = scan_line_base(mdev, 0);
+ sourcex = x;
+ sraster = 0;
+ goto no_T;
+ case rop_usage_S:
#ifndef DO_COPY_MONO_BY_COPY_ROP /* Copy mono is calling us, don't call it! */
- /* This is either S or ~S, which copy_mono can handle. */
- if (rop == rop3_S)
- color0 = 0, color1 = 1;
- else
- color0 = 1, color1 = 0;
- do_copy:return (*dev_proc(dev, copy_mono))
- (dev, sdata, sourcex, sraster, id, x, y, width, height,
- color0, color1);
+ /* This is either S or ~S, which copy_mono can handle. */
+ if (rop == rop3_S)
+ color0 = 0, color1 = 1;
+ else
+ color0 = 1, color1 = 0;
+ do_copy:return (*dev_proc(dev, copy_mono))
+ (dev, sdata, sourcex, sraster, id, x, y, width, height,
+ color0, color1);
#else
- fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
+ fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
break;
#endif
- case rop_usage_DS:
+ case rop_usage_DS:
#ifndef DO_COPY_MONO_BY_COPY_ROP /* Copy mono is calling us, don't call it! */
- /* This might be a case that copy_mono can handle. */
+ /* This might be a case that copy_mono can handle. */
#define copy_case(c0, c1) color0 = c0, color1 = c1; goto do_copy;
- switch ((uint) rop) { /* cast shuts up picky compilers */
- case rop3_D & rop3_not(rop3_S):
- copy_case(gx_no_color_index, 0);
- case rop3_D | rop3_S:
- copy_case(gx_no_color_index, 1);
- case rop3_D & rop3_S:
- copy_case(0, gx_no_color_index);
- case rop3_D | rop3_not(rop3_S):
- copy_case(1, gx_no_color_index);
- default:;
- }
+ switch ((uint) rop) { /* cast shuts up picky compilers */
+ case rop3_D & rop3_not(rop3_S):
+ copy_case(gx_no_color_index, 0);
+ case rop3_D | rop3_S:
+ copy_case(gx_no_color_index, 1);
+ case rop3_D & rop3_S:
+ copy_case(0, gx_no_color_index);
+ case rop3_D | rop3_not(rop3_S):
+ copy_case(1, gx_no_color_index);
+ default:;
+ }
#undef copy_case
#endif
- fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
- no_T: /* Texture is not used; textures may be garbage. */
- no_texture.data = scan_line_base(mdev, 0); /* arbitrary */
- no_texture.raster = 0;
- no_texture.size.x = width;
- no_texture.size.y = height;
- no_texture.rep_width = no_texture.rep_height = 1;
- no_texture.rep_shift = no_texture.shift = 0;
- textures = &no_texture;
- break;
- case rop_usage_T:
+ fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
+ no_T: /* Texture is not used; textures may be garbage. */
+ no_texture.data = scan_line_base(mdev, 0); /* arbitrary */
+ no_texture.raster = 0;
+ no_texture.size.x = width;
+ no_texture.size.y = height;
+ no_texture.rep_width = no_texture.rep_height = 1;
+ no_texture.rep_shift = no_texture.shift = 0;
+ textures = &no_texture;
+ break;
+ case rop_usage_T:
#ifndef DO_TILE_RECT_BY_COPY_ROP /* Tile rect calls us - don't call it! */
- /* This is either T or ~T, which tile_rectangle can handle. */
- if (rop == rop3_T)
- color0 = 0, color1 = 1;
- else
- color0 = 1, color1 = 0;
- do_tile:return (*dev_proc(dev, strip_tile_rectangle))
- (dev, textures, x, y, width, height, color0, color1,
- phase_x, phase_y);
+ /* This is either T or ~T, which tile_rectangle can handle. */
+ if (rop == rop3_T)
+ color0 = 0, color1 = 1;
+ else
+ color0 = 1, color1 = 0;
+ do_tile:return (*dev_proc(dev, strip_tile_rectangle))
+ (dev, textures, x, y, width, height, color0, color1,
+ phase_x, phase_y);
#else
fit_fill(dev, x, y, width, height);
- break;
+ break;
#endif
case rop_usage_DT:
#ifndef DO_TILE_RECT_BY_COPY_ROP /* Tile rect calls us - don't call it! */
- /* This might be a case that tile_rectangle can handle. */
+ /* This might be a case that tile_rectangle can handle. */
#define tile_case(c0, c1) color0 = c0, color1 = c1; goto do_tile;
- switch ((uint) rop) { /* cast shuts up picky compilers */
- case rop3_D & rop3_not(rop3_T):
- tile_case(gx_no_color_index, 0);
- case rop3_D | rop3_T:
- tile_case(gx_no_color_index, 1);
- case rop3_D & rop3_T:
- tile_case(0, gx_no_color_index);
- case rop3_D | rop3_not(rop3_T):
- tile_case(1, gx_no_color_index);
- default:;
- }
+ switch ((uint) rop) { /* cast shuts up picky compilers */
+ case rop3_D & rop3_not(rop3_T):
+ tile_case(gx_no_color_index, 0);
+ case rop3_D | rop3_T:
+ tile_case(gx_no_color_index, 1);
+ case rop3_D & rop3_T:
+ tile_case(0, gx_no_color_index);
+ case rop3_D | rop3_not(rop3_T):
+ tile_case(1, gx_no_color_index);
+ default:;
+ }
#undef tile_case
#endif
fit_fill(dev, x, y, width, height);
- /* Source is not used; sdata et al may be garbage. */
- sdata = mdev->base; /* arbitrary, as long as all */
- /* accesses are valid */
- sourcex = x; /* guarantee no source skew */
- sraster = 0;
- break;
- default: /* rop_usage_[D]ST */
- fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
- }
+ /* Source is not used; sdata et al may be garbage. */
+ sdata = mdev->base; /* arbitrary, as long as all */
+ /* accesses are valid */
+ sourcex = x; /* guarantee no source skew */
+ sraster = 0;
+ break;
+ default: /* rop_usage_[D]ST */
+ fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
+ }
}
#ifdef DEBUG
@@ -234,72 +234,72 @@ mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
/* Loop over scan lines. */
for (; line_count-- > 0; drow += draster, srow += sraster, ++ty) {
- int sx = sourcex;
- int dx = x;
- int w = width;
- const byte *trow = (textures == NULL ? 0 :
+ int sx = sourcex;
+ int dx = x;
+ int w = width;
+ const byte *trow = (textures == NULL ? 0 :
textures->data + (ty % textures->rep_height) * traster);
int xoff = (textures ? x_offset(phase_x, ty, textures) : 0);
- int nw;
+ int nw;
/* Loop over (horizontal) copies of the tile. */
- for (; w > 0; sx += nw, dx += nw, w -= nw) {
+ for (; w > 0; sx += nw, dx += nw, w -= nw) {
#ifndef USE_ROP_RUN
int dbit = dx & 7;
- int sbit = sx & 7;
- int sskew = sbit - dbit;
- int tx = (dx + xoff) % textures->rep_width;
- int tbit = tx & 7;
- int tskew = tbit - dbit;
- int left = nw = min(w, textures->size.x - tx);
- byte lmask = 0xff >> dbit;
- byte rmask = 0xff << (~(dbit + nw - 1) & 7);
- byte mask = lmask;
- int nx = 8 - dbit;
- byte *dptr = drow + (dx >> 3);
- const byte *sptr = srow + (sx >> 3);
- const byte *tptr = trow + (tx >> 3);
+ int sbit = sx & 7;
+ int sskew = sbit - dbit;
+ int tx = (dx + xoff) % textures->rep_width;
+ int tbit = tx & 7;
+ int tskew = tbit - dbit;
+ int left = nw = min(w, textures->size.x - tx);
+ byte lmask = 0xff >> dbit;
+ byte rmask = 0xff << (~(dbit + nw - 1) & 7);
+ byte mask = lmask;
+ int nx = 8 - dbit;
+ byte *dptr = drow + (dx >> 3);
+ const byte *sptr = srow + (sx >> 3);
+ const byte *tptr = trow + (tx >> 3);
if (sskew < 0)
- --sptr, sskew += 8;
- if (tskew < 0)
- --tptr, tskew += 8;
- for (; left > 0;
- left -= nx, mask = 0xff, nx = 8,
- ++dptr, ++sptr, ++tptr
- ) {
- byte dbyte = *dptr;
+ --sptr, sskew += 8;
+ if (tskew < 0)
+ --tptr, tskew += 8;
+ for (; left > 0;
+ left -= nx, mask = 0xff, nx = 8,
+ ++dptr, ++sptr, ++tptr
+ ) {
+ byte dbyte = *dptr;
#define fetch1(ptr, skew)\
(skew ? (ptr[0] << skew) + (ptr[1] >> (8 - skew)) : *ptr)
- byte sbyte = fetch1(sptr, sskew);
- byte tbyte = fetch1(tptr, tskew);
+ byte sbyte = fetch1(sptr, sskew);
+ byte tbyte = fetch1(tptr, tskew);
#undef fetch1
- byte result =
- (*rop_proc_table[rop]) (dbyte, sbyte, tbyte);
-
- if (left <= nx)
- mask &= rmask;
- *dptr = (mask == 0xff ? result :
- (result & mask) | (dbyte & ~mask));
- }
+ byte result =
+ (*rop_proc_table[rop]) (dbyte, sbyte, tbyte);
+
+ if (left <= nx)
+ mask &= rmask;
+ *dptr = (mask == 0xff ? result :
+ (result & mask) | (dbyte & ~mask));
+ }
#else
int dbit = dx & 7;
- int sbit = sx & 7;
+ int sbit = sx & 7;
int tx = (textures ? (dx + xoff) % textures->rep_width : 0);
- int tbit = tx & 7;
+ int tbit = tx & 7;
int left = nw = (textures ? min(w, textures->size.x - tx) : w);
- byte *dptr = drow + (dx >> 3);
- const byte *sptr = srow + (sx >> 3);
- const byte *tptr = trow + (tx >> 3);
+ byte *dptr = drow + (dx >> 3);
+ const byte *sptr = srow + (sx >> 3);
+ const byte *tptr = trow + (tx >> 3);
#ifdef COMPARE_AND_CONTRAST
- int sskew = sbit - dbit;
- int tskew = tbit - dbit;
- byte lmask = 0xff >> dbit;
- byte rmask = 0xff << (~(dbit + nw - 1) & 7);
- byte mask = lmask;
- int nx = 8 - dbit;
+ int sskew = sbit - dbit;
+ int tskew = tbit - dbit;
+ byte lmask = 0xff >> dbit;
+ byte rmask = 0xff << (~(dbit + nw - 1) & 7);
+ byte mask = lmask;
+ int nx = 8 - dbit;
static byte testbuffer[4096];
byte *start = dptr-2;
@@ -314,29 +314,29 @@ mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
eprintf5("rop=%x dbit=%d sbit=%d tbit=%d left=%d\n", rop, dbit, sbit, tbit, left);
rop_run_subbyte(&ropper, testbuffer+2, dbit, left);
if (sskew < 0)
- --sptr, sskew += 8;
- if (tskew < 0)
- --tptr, tskew += 8;
- for (; left > 0;
- left -= nx, mask = 0xff, nx = 8,
- ++dptr, ++sptr, ++tptr
- ) {
- byte dbyte = *dptr;
+ --sptr, sskew += 8;
+ if (tskew < 0)
+ --tptr, tskew += 8;
+ for (; left > 0;
+ left -= nx, mask = 0xff, nx = 8,
+ ++dptr, ++sptr, ++tptr
+ ) {
+ byte dbyte = *dptr;
#define fetch1(ptr, skew)\
(skew ? (ptr[0] << skew) + (ptr[1] >> (8 - skew)) : *ptr)
- byte sbyte = fetch1(sptr, sskew);
- byte tbyte = fetch1(tptr, tskew);
+ byte sbyte = fetch1(sptr, sskew);
+ byte tbyte = fetch1(tptr, tskew);
#undef fetch1
- byte result =
- (*rop_proc_table[rop]) (dbyte, sbyte, tbyte);
-
- if (left <= nx)
- mask &= rmask;
- *dptr = (mask == 0xff ? result :
- (result & mask) | (dbyte & ~mask));
- }
+ byte result =
+ (*rop_proc_table[rop]) (dbyte, sbyte, tbyte);
+
+ if (left <= nx)
+ mask &= rmask;
+ *dptr = (mask == 0xff ? result :
+ (result & mask) | (dbyte & ~mask));
+ }
if (memcmp(testbuffer, start, bytelen) != 0)
eprintf("Different! Shoulda put a breakpoint on it.\n");
#endif
@@ -349,8 +349,8 @@ mem_mono_strip_copy_rop_dev(gx_device * dev, const byte * sdata,
#endif
#ifdef DEBUG
if (gs_debug_c('B'))
- debug_dump_bitmap(scan_line_base(mdev, y), mdev->raster,
- height, "final dest bits");
+ debug_dump_bitmap(scan_line_base(mdev, y), mdev->raster,
+ height, "final dest bits");
#endif
return 0;
}
@@ -400,9 +400,9 @@ mem_mono_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
#ifdef DO_FILL_RECT_BY_COPY_ROP
return mem_mono_strip_copy_rop(dev, NULL, 0, 0, gx_no_bitmap_id, NULL,
- NULL, NULL,
- x, y, w, h, 0, 0,
- (color ? rop3_1 : rop3_0));
+ NULL, NULL,
+ x, y, w, h, 0, 0,
+ (color ? rop3_1 : rop3_0));
#else
fit_fill(dev, x, y, w, h);
bits_fill_rectangle(scan_line_base(mdev, y), x, mdev->raster,
@@ -539,12 +539,12 @@ mem_mono_copy_mono(gx_device * dev,
#ifdef DO_COPY_MONO_BY_COPY_ROP
return mem_mono_strip_copy_rop_dev(dev, source_data, source_x, source_raster,
- id, NULL, NULL, NULL,
- x, y, w, h, 0, 0,
- ((color0 == gx_no_color_index ? rop3_D :
- color0 == 0 ? rop3_0 : rop3_1) & ~rop3_S) |
- ((color1 == gx_no_color_index ? rop3_D :
- color1 == 0 ? rop3_0 : rop3_1) & rop3_S));
+ id, NULL, NULL, NULL,
+ x, y, w, h, 0, 0,
+ ((color0 == gx_no_color_index ? rop3_D :
+ color0 == 0 ? rop3_0 : rop3_1) & ~rop3_S) |
+ ((color1 == gx_no_color_index ? rop3_D :
+ color1 == 0 ? rop3_0 : rop3_1) & rop3_S));
#else /* !DO_COPY_MONO_BY_COPY_ROP */
gx_device_memory * const mdev = (gx_device_memory *)dev;
register const byte *bptr; /* actually chunk * */
@@ -789,19 +789,19 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
{
#ifdef DO_TILE_RECT_BY_COPY_ROP
gs_logical_operation_t rop = ((color0 == gx_no_color_index ? rop3_D :
- color0 == 0 ? rop3_0 : rop3_1) & ~rop3_T) |
- ((color1 == gx_no_color_index ? rop3_D :
- color1 == 0 ? rop3_0 : rop3_1) & rop3_T);
+ color0 == 0 ? rop3_0 : rop3_1) & ~rop3_T) |
+ ((color1 == gx_no_color_index ? rop3_D :
+ color1 == 0 ? rop3_0 : rop3_1) & rop3_T);
/* If color0 == gx_no_color_index && color1 == gx_no_color_index then
* we have a color pixmap, not a bitmap, so we want to use copy_color,
* rather than copy_mono. This case gives us rop == 0xAA (no change). */
- if (rop == 0xAA)
+ if (rop == 0xAA)
return gx_default_strip_tile_rectangle(dev, tiles, tx, y, tw, th,
color0, color1, px, py);
return mem_mono_strip_copy_rop_dev(dev, NULL, 0, 0, tiles->id, NULL,
tiles, NULL,
- tx, y, tw, th, px, py, rop);
+ tx, y, tw, th, px, py, rop);
#else /* !USE_COPY_ROP */
gx_device_memory * const mdev = (gx_device_memory *)dev;
register uint invert;
diff --git a/gs/base/gdevm16.c b/gs/base/gdevm16.c
index b47bbf51c..097c97f80 100644
--- a/gs/base/gdevm16.c
+++ b/gs/base/gdevm16.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,34 +31,34 @@ declare_mem_procs(mem_true16_copy_mono, mem_true16_copy_color, mem_true16_fill_r
/* The device descriptor. */
const gx_device_memory mem_true16_device =
mem_device("image16", 16, 0,
- mem_true16_map_rgb_color, mem_true16_map_color_rgb,
- mem_true16_copy_mono, mem_true16_copy_color,
- mem_true16_fill_rectangle, mem_default_strip_copy_rop);
+ mem_true16_map_rgb_color, mem_true16_map_color_rgb,
+ mem_true16_copy_mono, mem_true16_copy_color,
+ mem_true16_fill_rectangle, mem_default_strip_copy_rop);
/* Map a r-g-b color to a color index. */
static gx_color_index
mem_true16_map_rgb_color(gx_device * dev, const gx_color_value cv[])
{
return ((cv[0] >> (gx_color_value_bits - 5)) << 11) +
- ((cv[1] >> (gx_color_value_bits - 6)) << 5) +
- (cv[2] >> (gx_color_value_bits - 5));
+ ((cv[1] >> (gx_color_value_bits - 6)) << 5) +
+ (cv[2] >> (gx_color_value_bits - 5));
}
/* Map a color index to a r-g-b color. */
static int
mem_true16_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
ushort value = color >> 11;
prgb[0] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4))
- >> (16 - gx_color_value_bits);
+ >> (16 - gx_color_value_bits);
value = (color >> 5) & 0x3f;
prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
+ >> (16 - gx_color_value_bits);
value = color & 0x1f;
prgb[2] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4))
- >> (16 - gx_color_value_bits);
+ >> (16 - gx_color_value_bits);
return 0;
}
@@ -69,7 +69,7 @@ mem_true16_map_color_rgb(gx_device * dev, gx_color_index color,
/* Fill a rectangle with a color. */
static int
mem_true16_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
#if arch_is_big_endian
@@ -82,28 +82,28 @@ mem_true16_fill_rectangle(gx_device * dev,
fit_fill(dev, x, y, w, h);
setup_rect(dest);
if (w == 1) {
- while (h-- > 0) {
- *(ushort *)dest = color16;
- inc_ptr(dest, draster);
- }
+ while (h-- > 0) {
+ *(ushort *)dest = color16;
+ inc_ptr(dest, draster);
+ }
} else if ((color16 >> 8) == (color16 & 0xff)) {
- bytes_fill_rectangle(scan_line_base(mdev, y) + (x << 1), draster,
- (byte)color, w << 1, h);
+ bytes_fill_rectangle(scan_line_base(mdev, y) + (x << 1), draster,
+ (byte)color, w << 1, h);
} else {
- while (h-- > 0) {
- ushort *pptr = (ushort *) dest;
- int cnt = w;
-
- for (; cnt >= 4; pptr += 4, cnt -= 4)
- pptr[3] = pptr[2] = pptr[1] = pptr[0] = color16;
- switch (cnt) {
- case 3: pptr[2] = color16;
- case 2: pptr[1] = color16;
- case 1: pptr[0] = color16;
- case 0: DO_NOTHING;
- }
- inc_ptr(dest, draster);
- }
+ while (h-- > 0) {
+ ushort *pptr = (ushort *) dest;
+ int cnt = w;
+
+ for (; cnt >= 4; pptr += 4, cnt -= 4)
+ pptr[3] = pptr[2] = pptr[1] = pptr[0] = color16;
+ switch (cnt) {
+ case 3: pptr[2] = color16;
+ case 2: pptr[1] = color16;
+ case 1: pptr[0] = color16;
+ case 0: DO_NOTHING;
+ }
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -111,9 +111,9 @@ mem_true16_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true16_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster,
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
#if arch_is_big_endian
@@ -132,27 +132,27 @@ mem_true16_copy_mono(gx_device * dev,
line = base + (sourcex >> 3);
first_bit = 0x80 >> (sourcex & 7);
while (h-- > 0) {
- register ushort *pptr = (ushort *) dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- *pptr = one16;
- } else {
- if (zero != gx_no_color_index)
- *pptr = zero16;
- }
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- pptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
+ register ushort *pptr = (ushort *) dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ *pptr = one16;
+ } else {
+ if (zero != gx_no_color_index)
+ *pptr = zero16;
+ }
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ pptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
}
return 0;
}
@@ -160,8 +160,8 @@ mem_true16_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true16_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
diff --git a/gs/base/gdevm2.c b/gs/base/gdevm2.c
index 85558bee2..c6517cb25 100644
--- a/gs/base/gdevm2.c
+++ b/gs/base/gdevm2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,9 +30,9 @@ declare_mem_procs(mem_mapped2_copy_mono, mem_mapped2_copy_color, mem_mapped2_fil
/* The device descriptor. */
const gx_device_memory mem_mapped2_device =
mem_device("image2", 2, 0,
- mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
- mem_mapped2_copy_mono, mem_mapped2_copy_color,
- mem_mapped2_fill_rectangle, mem_gray_strip_copy_rop);
+ mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
+ mem_mapped2_copy_mono, mem_mapped2_copy_color,
+ mem_mapped2_fill_rectangle, mem_gray_strip_copy_rop);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -46,22 +46,22 @@ static const mono_fill_chunk tile_patterns[4] = {
/* Fill a rectangle with a color. */
static int
mem_mapped2_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
fit_fill(dev, x, y, w, h);
bits_fill_rectangle(scan_line_base(mdev, y), x << 1, mdev->raster,
- tile_patterns[color], w << 1, h);
+ tile_patterns[color], w << 1, h);
return 0;
}
/* Copy a bitmap. */
static int
mem_mapped2_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster,
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -81,64 +81,64 @@ mem_mapped2_copy_mono(gx_device * dev,
left_mask = lmask[x & 3];
right_mask = ~lmask[(x + w) & 3];
if ((x & 3) + w <= 3)
- left_mask = right_mask = left_mask | right_mask;
+ left_mask = right_mask = left_mask | right_mask;
b0 = btab[zero & 3];
b1 = btab[one & 3];
bxor = b0 ^ b1;
while (h-- > 0) {
- register byte *pptr = (byte *) dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- register byte mask = first_mask;
- int count = w;
-
- /* We have 4 cases, of which only 2 really matter. */
- if (one != gx_no_color_index) {
- if (zero != gx_no_color_index) { /* Copying an opaque bitmap. */
- byte data = (*pptr & left_mask) | (b0 & ~left_mask);
-
- for ( ; ; ) {
- if (sbyte & bit)
- data ^= bxor & mask;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- if ((mask >>= 2) == 0)
- mask = 0xc0, *pptr++ = data, data = b0;
- if (--count <= 0)
- break;
- }
- if (mask != 0xc0)
- *pptr =
- (*pptr & right_mask) | (data & ~right_mask);
- } else { /* Filling a mask. */
- for ( ; ; ) {
- if (sbyte & bit)
- *pptr = (*pptr & ~mask) + (b1 & mask);
- if (--count <= 0)
- break;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- if ((mask >>= 2) == 0)
- mask = 0xc0, pptr++;
- }
- }
- } else { /* Some other case. */
- for ( ; ; ) {
- if (!(sbyte & bit)) {
- if (zero != gx_no_color_index)
- *pptr = (*pptr & ~mask) + (b0 & mask);
- }
- if (--count <= 0)
- break;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- if ((mask >>= 2) == 0)
- mask = 0xc0, pptr++;
- }
- }
- line += sraster;
- inc_ptr(dest, draster);
+ register byte *pptr = (byte *) dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ register byte mask = first_mask;
+ int count = w;
+
+ /* We have 4 cases, of which only 2 really matter. */
+ if (one != gx_no_color_index) {
+ if (zero != gx_no_color_index) { /* Copying an opaque bitmap. */
+ byte data = (*pptr & left_mask) | (b0 & ~left_mask);
+
+ for ( ; ; ) {
+ if (sbyte & bit)
+ data ^= bxor & mask;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ if ((mask >>= 2) == 0)
+ mask = 0xc0, *pptr++ = data, data = b0;
+ if (--count <= 0)
+ break;
+ }
+ if (mask != 0xc0)
+ *pptr =
+ (*pptr & right_mask) | (data & ~right_mask);
+ } else { /* Filling a mask. */
+ for ( ; ; ) {
+ if (sbyte & bit)
+ *pptr = (*pptr & ~mask) + (b1 & mask);
+ if (--count <= 0)
+ break;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ if ((mask >>= 2) == 0)
+ mask = 0xc0, pptr++;
+ }
+ }
+ } else { /* Some other case. */
+ for ( ; ; ) {
+ if (!(sbyte & bit)) {
+ if (zero != gx_no_color_index)
+ *pptr = (*pptr & ~mask) + (b0 & mask);
+ }
+ if (--count <= 0)
+ break;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ if ((mask >>= 2) == 0)
+ mask = 0xc0, pptr++;
+ }
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
}
return 0;
}
@@ -146,8 +146,8 @@ mem_mapped2_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_mapped2_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster,
- gx_bitmap_id id, int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster,
+ gx_bitmap_id id, int x, int y, int w, int h)
{
int code;
@@ -156,8 +156,8 @@ mem_mapped2_copy_color(gx_device * dev,
/* Patch the width in the device temporarily. */
dev->width <<= 1;
code = (*dev_proc(&mem_mono_device, copy_mono))
- (dev, base, sourcex << 1, sraster, id,
- x << 1, y, w << 1, h, (gx_color_index) 0, (gx_color_index) 1);
+ (dev, base, sourcex << 1, sraster, id,
+ x << 1, y, w << 1, h, (gx_color_index) 0, (gx_color_index) 1);
/* Restore the correct width. */
dev->width >>= 1;
return code;
@@ -176,16 +176,16 @@ declare_mem_procs(mem2_word_copy_mono, mem2_word_copy_color, mem2_word_fill_rect
/* Here is the device descriptor. */
const gx_device_memory mem_mapped2_word_device =
mem_full_device("image2w", 2, 0, mem_open,
- mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
- mem2_word_copy_mono, mem2_word_copy_color,
- mem2_word_fill_rectangle, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop,
- mem_word_get_bits_rectangle);
+ mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
+ mem2_word_copy_mono, mem2_word_copy_color,
+ mem2_word_fill_rectangle, gx_default_map_cmyk_color,
+ gx_default_strip_tile_rectangle, gx_no_strip_copy_rop,
+ mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem2_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -196,7 +196,7 @@ mem2_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
raster = mdev->raster;
mem_swap_byte_rect(base, raster, x << 1, w << 1, h, true);
bits_fill_rectangle(base, x << 1, raster,
- tile_patterns[color], w << 1, h);
+ tile_patterns[color], w << 1, h);
mem_swap_byte_rect(base, raster, x << 1, w << 1, h, true);
return 0;
}
@@ -204,9 +204,9 @@ mem2_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem2_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster,
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -219,7 +219,7 @@ mem2_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x << 1, w << 1, h, store);
mem_mapped2_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x << 1, w << 1, h, false);
return 0;
}
@@ -227,8 +227,8 @@ mem2_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem2_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster,
- gx_bitmap_id id, int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster,
+ gx_bitmap_id id, int x, int y, int w, int h)
{
int code;
@@ -237,8 +237,8 @@ mem2_word_copy_color(gx_device * dev,
/* Patch the width in the device temporarily. */
dev->width <<= 1;
code = (*dev_proc(&mem_mono_word_device, copy_mono))
- (dev, base, sourcex << 1, sraster, id,
- x << 1, y, w << 1, h, (gx_color_index) 0, (gx_color_index) 1);
+ (dev, base, sourcex << 1, sraster, id,
+ x << 1, y, w << 1, h, (gx_color_index) 0, (gx_color_index) 1);
/* Restore the correct width. */
dev->width >>= 1;
return code;
diff --git a/gs/base/gdevm24.c b/gs/base/gdevm24.c
index 8d17bcd20..1425a6203 100644
--- a/gs/base/gdevm24.c
+++ b/gs/base/gdevm24.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,8 +35,8 @@
#ifdef DEBUG
struct stats_mem24_s {
long
- fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
- fprevc[257];
+ fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
+ fprevc[257];
double ftotal;
} stats_mem24;
static int prev_count = 0;
@@ -46,7 +46,6 @@ static uint prev_colors[256];
# define INCR(v) DO_NOTHING
#endif
-
/* ================ Standard (byte-oriented) device ================ */
#undef chunk
@@ -59,11 +58,11 @@ static dev_proc_copy_alpha(mem_true24_copy_alpha);
/* The device descriptor. */
const gx_device_memory mem_true24_device =
mem_full_alpha_device("image24", 24, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true24_copy_mono, mem_true24_copy_color, mem_true24_fill_rectangle,
- gx_default_map_cmyk_color, mem_true24_copy_alpha,
- gx_default_strip_tile_rectangle, mem_true24_strip_copy_rop,
- mem_get_bits_rectangle);
+ gx_default_map_cmyk_color, mem_true24_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_true24_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -71,37 +70,37 @@ mem_full_alpha_device("image24", 24, 0, mem_open,
/* Unpack a color into its bytes. */
#define declare_unpack_color(r, g, b, color)\
- byte r = (byte)(color >> 16);\
- byte g = (byte)((uint)color >> 8);\
- byte b = (byte)color
+ byte r = (byte)(color >> 16);\
+ byte g = (byte)((uint)color >> 8);\
+ byte b = (byte)color
/* Put a 24-bit color into the bitmap. */
#define put3(ptr, r, g, b)\
- (ptr)[0] = r, (ptr)[1] = g, (ptr)[2] = b
+ (ptr)[0] = r, (ptr)[1] = g, (ptr)[2] = b
/* Put 4 bytes of color into the bitmap. */
#define putw(ptr, wxyz)\
- *(bits32 *)(ptr) = (wxyz)
+ *(bits32 *)(ptr) = (wxyz)
/* Load the 3-word 24-bit-color cache. */
/* Free variables: [m]dev, rgbr, gbrg, brgb. */
#if arch_is_big_endian
# define set_color24_cache(crgb, r, g, b)\
- mdev->color24.rgbr = rgbr = ((bits32)(crgb) << 8) | (r),\
- mdev->color24.gbrg = gbrg = (rgbr << 8) | (g),\
- mdev->color24.brgb = brgb = (gbrg << 8) | (b),\
- mdev->color24.rgb = (crgb)
+ mdev->color24.rgbr = rgbr = ((bits32)(crgb) << 8) | (r),\
+ mdev->color24.gbrg = gbrg = (rgbr << 8) | (g),\
+ mdev->color24.brgb = brgb = (gbrg << 8) | (b),\
+ mdev->color24.rgb = (crgb)
#else
# define set_color24_cache(crgb, r, g, b)\
- mdev->color24.rgbr = rgbr =\
- ((bits32)(r) << 24) | ((bits32)(b) << 16) |\
- ((bits16)(g) << 8) | (r),\
- mdev->color24.brgb = brgb = (rgbr << 8) | (b),\
- mdev->color24.gbrg = gbrg = (brgb << 8) | (g),\
- mdev->color24.rgb = (crgb)
+ mdev->color24.rgbr = rgbr =\
+ ((bits32)(r) << 24) | ((bits32)(b) << 16) |\
+ ((bits16)(g) << 8) | (r),\
+ mdev->color24.brgb = brgb = (rgbr << 8) | (b),\
+ mdev->color24.gbrg = gbrg = (brgb << 8) | (g),\
+ mdev->color24.rgb = (crgb)
#endif
/* Fill a rectangle with a color. */
static int
mem_true24_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
declare_unpack_color(r, g, b, color);
@@ -119,222 +118,222 @@ mem_true24_fill_rectangle(gx_device * dev,
stats_mem24.ftotal += w;
#endif
if (w >= 5) {
- if (h <= 0)
- return 0;
- INCR(fwide);
- setup_rect(dest);
- if (r == g && r == b) {
+ if (h <= 0)
+ return 0;
+ INCR(fwide);
+ setup_rect(dest);
+ if (r == g && r == b) {
#ifndef USE_MEMSET
- /* We think we can do better than the library's memset.... */
- int bcntm7 = w * 3 - 7;
- register bits32 cword = color | (color << 24);
-
- INCR(fgray[min(w, 100)]);
- while (h-- > 0) {
- register byte *pptr = dest;
- byte *limit = pptr + bcntm7;
-
- /* We want to store full words, but we have to */
- /* guarantee that they are word-aligned. */
- switch (x & 3) {
- case 3:
- *pptr++ = (byte) cword;
- case 2:
- *pptr++ = (byte) cword;
- case 1:
- *pptr++ = (byte) cword;
- case 0:;
- }
- /* Even with w = 5, we always store at least */
- /* 3 full words, regardless of the starting x. */
- *(bits32 *) pptr =
- ((bits32 *) pptr)[1] =
- ((bits32 *) pptr)[2] = cword;
- pptr += 12;
- while (pptr < limit) {
- *(bits32 *) pptr =
- ((bits32 *) pptr)[1] = cword;
- pptr += 8;
- }
- switch ((int)(pptr - limit)) {
- case 0:
- pptr[6] = (byte) cword;
- case 1:
- pptr[5] = (byte) cword;
- case 2:
- pptr[4] = (byte) cword;
- case 3:
- *(bits32 *) pptr = cword;
- break;
- case 4:
- pptr[2] = (byte) cword;
- case 5:
- pptr[1] = (byte) cword;
- case 6:
- pptr[0] = (byte) cword;
- case 7:;
- }
- inc_ptr(dest, draster);
- }
+ /* We think we can do better than the library's memset.... */
+ int bcntm7 = w * 3 - 7;
+ register bits32 cword = color | (color << 24);
+
+ INCR(fgray[min(w, 100)]);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ byte *limit = pptr + bcntm7;
+
+ /* We want to store full words, but we have to */
+ /* guarantee that they are word-aligned. */
+ switch (x & 3) {
+ case 3:
+ *pptr++ = (byte) cword;
+ case 2:
+ *pptr++ = (byte) cword;
+ case 1:
+ *pptr++ = (byte) cword;
+ case 0:;
+ }
+ /* Even with w = 5, we always store at least */
+ /* 3 full words, regardless of the starting x. */
+ *(bits32 *) pptr =
+ ((bits32 *) pptr)[1] =
+ ((bits32 *) pptr)[2] = cword;
+ pptr += 12;
+ while (pptr < limit) {
+ *(bits32 *) pptr =
+ ((bits32 *) pptr)[1] = cword;
+ pptr += 8;
+ }
+ switch ((int)(pptr - limit)) {
+ case 0:
+ pptr[6] = (byte) cword;
+ case 1:
+ pptr[5] = (byte) cword;
+ case 2:
+ pptr[4] = (byte) cword;
+ case 3:
+ *(bits32 *) pptr = cword;
+ break;
+ case 4:
+ pptr[2] = (byte) cword;
+ case 5:
+ pptr[1] = (byte) cword;
+ case 6:
+ pptr[0] = (byte) cword;
+ case 7:;
+ }
+ inc_ptr(dest, draster);
+ }
#else
- int bcnt = w * 3;
+ int bcnt = w * 3;
- INCR(fgray[min(w, 100)]);
- while (h-- > 0) {
- memset(dest, r, bcnt);
- inc_ptr(dest, draster);
- }
+ INCR(fgray[min(w, 100)]);
+ while (h-- > 0) {
+ memset(dest, r, bcnt);
+ inc_ptr(dest, draster);
+ }
#endif
- } else {
- int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
- bits32 rgbr, gbrg, brgb;
-
- if (mdev->color24.rgb == color) {
- rgbr = mdev->color24.rgbr;
- gbrg = mdev->color24.gbrg;
- brgb = mdev->color24.brgb;
- } else {
- INCR(fsetc);
- set_color24_cache(color, r, g, b);
- }
+ } else {
+ int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
+ bits32 rgbr, gbrg, brgb;
+
+ if (mdev->color24.rgb == color) {
+ rgbr = mdev->color24.rgbr;
+ gbrg = mdev->color24.gbrg;
+ brgb = mdev->color24.brgb;
+ } else {
+ INCR(fsetc);
+ set_color24_cache(color, r, g, b);
+ }
#ifdef DEBUG
- {
- int ci;
- for (ci = 0; ci < prev_count; ++ci)
- if (prev_colors[ci] == color)
- break;
- INCR(fprevc[ci]);
- if (ci == prev_count) {
- if (ci < countof(prev_colors))
- ++prev_count;
- else
- --ci;
- }
- if (ci)
- memmove(&prev_colors[1], &prev_colors[0],
- ci * sizeof(prev_colors[0]));
- prev_colors[0] = color;
- }
+ {
+ int ci;
+ for (ci = 0; ci < prev_count; ++ci)
+ if (prev_colors[ci] == color)
+ break;
+ INCR(fprevc[ci]);
+ if (ci == prev_count) {
+ if (ci < countof(prev_colors))
+ ++prev_count;
+ else
+ --ci;
+ }
+ if (ci)
+ memmove(&prev_colors[1], &prev_colors[0],
+ ci * sizeof(prev_colors[0]));
+ prev_colors[0] = color;
+ }
#endif
- INCR(fcolor[min(w, 100)]);
- while (h-- > 0) {
- register byte *pptr = dest;
- int w1 = ww;
-
- switch (x3) {
- case 1:
- put3(pptr, r, g, b);
- pptr += 3;
- break;
- case 2:
- pptr[0] = r;
- pptr[1] = g;
- putw(pptr + 2, brgb);
- pptr += 6;
- break;
- case 3:
- pptr[0] = r;
- putw(pptr + 1, gbrg);
- putw(pptr + 5, brgb);
- pptr += 9;
- break;
- case 0:
- ;
- }
+ INCR(fcolor[min(w, 100)]);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ int w1 = ww;
+
+ switch (x3) {
+ case 1:
+ put3(pptr, r, g, b);
+ pptr += 3;
+ break;
+ case 2:
+ pptr[0] = r;
+ pptr[1] = g;
+ putw(pptr + 2, brgb);
+ pptr += 6;
+ break;
+ case 3:
+ pptr[0] = r;
+ putw(pptr + 1, gbrg);
+ putw(pptr + 5, brgb);
+ pptr += 9;
+ break;
+ case 0:
+ ;
+ }
#ifdef USE_MEMCPY
- /*
- * For very wide fills, it's most efficient to fill a few
- * pixels and then use memcpy to fill the rest.
- */
- if (w1 > 16) {
+ /*
+ * For very wide fills, it's most efficient to fill a few
+ * pixels and then use memcpy to fill the rest.
+ */
+ if (w1 > 16) {
#define PUTW4(ptr, w)\
BEGIN\
putw(ptr, w); putw((ptr)+12, w); putw((ptr)+24, w); putw((ptr)+36, w);\
END
- PUTW4(pptr, rgbr);
- PUTW4(pptr + 4, gbrg);
- PUTW4(pptr + 8, brgb);
+ PUTW4(pptr, rgbr);
+ PUTW4(pptr + 4, gbrg);
+ PUTW4(pptr + 8, brgb);
#undef PUTW4
- if (w1 > 64) {
- memcpy(pptr + 48, pptr, 48);
- memcpy(pptr + 96, pptr, 96);
- for (pptr += 192; (w1 -= 64) >= 64; pptr += 192)
- memcpy(pptr, pptr - 192, 192);
- } else
- pptr += 48;
- for (; (w1 -= 16) >= 16; pptr += 48)
- memcpy(pptr, pptr - 48, 48);
- }
+ if (w1 > 64) {
+ memcpy(pptr + 48, pptr, 48);
+ memcpy(pptr + 96, pptr, 96);
+ for (pptr += 192; (w1 -= 64) >= 64; pptr += 192)
+ memcpy(pptr, pptr - 192, 192);
+ } else
+ pptr += 48;
+ for (; (w1 -= 16) >= 16; pptr += 48)
+ memcpy(pptr, pptr - 48, 48);
+ }
#endif
- while (w1 >= 4) {
- putw(pptr, rgbr);
- putw(pptr + 4, gbrg);
- putw(pptr + 8, brgb);
- pptr += 12;
- w1 -= 4;
- }
- switch (w1) {
- case 1:
- put3(pptr, r, g, b);
- break;
- case 2:
- putw(pptr, rgbr);
- pptr[4] = g;
- pptr[5] = b;
- break;
- case 3:
- putw(pptr, rgbr);
- putw(pptr + 4, gbrg);
- pptr[8] = b;
- break;
- case 0:
- ;
- }
- inc_ptr(dest, draster);
- }
- }
+ while (w1 >= 4) {
+ putw(pptr, rgbr);
+ putw(pptr + 4, gbrg);
+ putw(pptr + 8, brgb);
+ pptr += 12;
+ w1 -= 4;
+ }
+ switch (w1) {
+ case 1:
+ put3(pptr, r, g, b);
+ break;
+ case 2:
+ putw(pptr, rgbr);
+ pptr[4] = g;
+ pptr[5] = b;
+ break;
+ case 3:
+ putw(pptr, rgbr);
+ putw(pptr + 4, gbrg);
+ pptr[8] = b;
+ break;
+ case 0:
+ ;
+ }
+ inc_ptr(dest, draster);
+ }
+ }
} else if (h > 0) { /* w < 5 */
- INCR(fnarrow[max(w, 0)]);
- setup_rect(dest);
- switch (w) {
- case 4:
- do {
- dest[9] = dest[6] = dest[3] = dest[0] = r;
- dest[10] = dest[7] = dest[4] = dest[1] = g;
- dest[11] = dest[8] = dest[5] = dest[2] = b;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 3:
- do {
- dest[6] = dest[3] = dest[0] = r;
- dest[7] = dest[4] = dest[1] = g;
- dest[8] = dest[5] = dest[2] = b;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 2:
- do {
- dest[3] = dest[0] = r;
- dest[4] = dest[1] = g;
- dest[5] = dest[2] = b;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 1:
- do {
- dest[0] = r, dest[1] = g, dest[2] = b;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 0:
- default:
- ;
- }
+ INCR(fnarrow[max(w, 0)]);
+ setup_rect(dest);
+ switch (w) {
+ case 4:
+ do {
+ dest[9] = dest[6] = dest[3] = dest[0] = r;
+ dest[10] = dest[7] = dest[4] = dest[1] = g;
+ dest[11] = dest[8] = dest[5] = dest[2] = b;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 3:
+ do {
+ dest[6] = dest[3] = dest[0] = r;
+ dest[7] = dest[4] = dest[1] = g;
+ dest[8] = dest[5] = dest[2] = b;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 2:
+ do {
+ dest[3] = dest[0] = r;
+ dest[4] = dest[1] = g;
+ dest[5] = dest[2] = b;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 1:
+ do {
+ dest[0] = r, dest[1] = g, dest[2] = b;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 0:
+ default:
+ ;
+ }
}
return 0;
}
@@ -342,8 +341,8 @@ mem_true24_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true24_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -358,104 +357,104 @@ mem_true24_copy_mono(gx_device * dev,
sbit = sourcex & 7;
first_bit = 0x80 >> sbit;
if (zero != gx_no_color_index) { /* Loop for halftones or inverted masks */
- /* (never used). */
- declare_unpack_color(r0, g0, b0, zero);
- declare_unpack_color(r1, g1, b1, one);
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index) {
- put3(pptr, r1, g1, b1);
- vd_pixel(int2fixed((pptr - mdev->line_ptrs[y]) / 3), int2fixed(y), RGB(r1, g1, b1));
- }
- } else {
- put3(pptr, r0, g0, b0);
- vd_pixel(int2fixed((pptr - mdev->line_ptrs[y]) / 3), int2fixed(y), RGB(r0, g0, b0));
- }
- pptr += 3;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* (never used). */
+ declare_unpack_color(r0, g0, b0, zero);
+ declare_unpack_color(r1, g1, b1, one);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index) {
+ put3(pptr, r1, g1, b1);
+ vd_pixel(int2fixed((pptr - mdev->line_ptrs[y]) / 3), int2fixed(y), RGB(r1, g1, b1));
+ }
+ } else {
+ put3(pptr, r0, g0, b0);
+ vd_pixel(int2fixed((pptr - mdev->line_ptrs[y]) / 3), int2fixed(y), RGB(r0, g0, b0));
+ }
+ pptr += 3;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else if (one != gx_no_color_index) { /* Loop for character and pattern masks. */
- /* This is used heavily. */
- declare_unpack_color(r1, g1, b1, one);
- int first_mask = first_bit << 1;
- int first_count, first_skip;
-
- if (sbit + w > 8)
- first_mask -= 1,
- first_count = 8 - sbit;
- else
- first_mask -= first_mask >> w,
- first_count = w;
- first_skip = first_count * 3;
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++ & first_mask;
- int count = w - first_count;
-
- if (sbyte) {
- register int bit = first_bit;
-
- do {
- if (sbyte & bit)
- put3(pptr, r1, g1, b1);
- pptr += 3;
- }
- while ((bit >>= 1) & first_mask);
- } else
- pptr += first_skip;
- while (count >= 8) {
- sbyte = *sptr++;
- if (sbyte & 0xf0) {
- if (sbyte & 0x80)
- put3(pptr, r1, g1, b1);
- if (sbyte & 0x40)
- put3(pptr + 3, r1, g1, b1);
- if (sbyte & 0x20)
- put3(pptr + 6, r1, g1, b1);
- if (sbyte & 0x10)
- put3(pptr + 9, r1, g1, b1);
- }
- if (sbyte & 0xf) {
- if (sbyte & 8)
- put3(pptr + 12, r1, g1, b1);
- if (sbyte & 4)
- put3(pptr + 15, r1, g1, b1);
- if (sbyte & 2)
- put3(pptr + 18, r1, g1, b1);
- if (sbyte & 1)
- put3(pptr + 21, r1, g1, b1);
- }
- pptr += 24;
- count -= 8;
- }
- if (count > 0) {
- register int bit = 0x80;
-
- sbyte = *sptr++;
- do {
- if (sbyte & bit)
- put3(pptr, r1, g1, b1);
- pptr += 3;
- bit >>= 1;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* This is used heavily. */
+ declare_unpack_color(r1, g1, b1, one);
+ int first_mask = first_bit << 1;
+ int first_count, first_skip;
+
+ if (sbit + w > 8)
+ first_mask -= 1,
+ first_count = 8 - sbit;
+ else
+ first_mask -= first_mask >> w,
+ first_count = w;
+ first_skip = first_count * 3;
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ & first_mask;
+ int count = w - first_count;
+
+ if (sbyte) {
+ register int bit = first_bit;
+
+ do {
+ if (sbyte & bit)
+ put3(pptr, r1, g1, b1);
+ pptr += 3;
+ }
+ while ((bit >>= 1) & first_mask);
+ } else
+ pptr += first_skip;
+ while (count >= 8) {
+ sbyte = *sptr++;
+ if (sbyte & 0xf0) {
+ if (sbyte & 0x80)
+ put3(pptr, r1, g1, b1);
+ if (sbyte & 0x40)
+ put3(pptr + 3, r1, g1, b1);
+ if (sbyte & 0x20)
+ put3(pptr + 6, r1, g1, b1);
+ if (sbyte & 0x10)
+ put3(pptr + 9, r1, g1, b1);
+ }
+ if (sbyte & 0xf) {
+ if (sbyte & 8)
+ put3(pptr + 12, r1, g1, b1);
+ if (sbyte & 4)
+ put3(pptr + 15, r1, g1, b1);
+ if (sbyte & 2)
+ put3(pptr + 18, r1, g1, b1);
+ if (sbyte & 1)
+ put3(pptr + 21, r1, g1, b1);
+ }
+ pptr += 24;
+ count -= 8;
+ }
+ if (count > 0) {
+ register int bit = 0x80;
+
+ sbyte = *sptr++;
+ do {
+ if (sbyte & bit)
+ put3(pptr, r1, g1, b1);
+ pptr += 3;
+ bit >>= 1;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -463,8 +462,8 @@ mem_true24_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true24_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -477,8 +476,8 @@ mem_true24_copy_color(gx_device * dev,
/* Copy an alpha map. */
static int
mem_true24_copy_alpha(gx_device * dev, const byte * base, int sourcex,
- int sraster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int sraster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -490,31 +489,31 @@ mem_true24_copy_alpha(gx_device * dev, const byte * base, int sourcex,
setup_rect(dest);
line = base;
while (h-- > 0) {
- register byte *pptr = dest;
- int sx;
-
- for (sx = sourcex; sx < sourcex + w; ++sx, pptr += 3) {
- int alpha2, alpha;
-
- if (depth == 2) /* map 0 - 3 to 0 - 15 */
- alpha =
- ((line[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
- else
- alpha2 = line[sx >> 1],
- alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
- if (alpha == 15) { /* Just write the new color. */
- put3(pptr, r, g, b);
- } else if (alpha != 0) { /* Blend RGB values. */
+ register byte *pptr = dest;
+ int sx;
+
+ for (sx = sourcex; sx < sourcex + w; ++sx, pptr += 3) {
+ int alpha2, alpha;
+
+ if (depth == 2) /* map 0 - 3 to 0 - 15 */
+ alpha =
+ ((line[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
+ else
+ alpha2 = line[sx >> 1],
+ alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
+ if (alpha == 15) { /* Just write the new color. */
+ put3(pptr, r, g, b);
+ } else if (alpha != 0) { /* Blend RGB values. */
#define make_shade(old, clr, alpha, amax) \
(old) + (((int)(clr) - (int)(old)) * (alpha) / (amax))
- pptr[0] = make_shade(pptr[0], r, alpha, 15);
- pptr[1] = make_shade(pptr[1], g, alpha, 15);
- pptr[2] = make_shade(pptr[2], b, alpha, 15);
+ pptr[0] = make_shade(pptr[0], r, alpha, 15);
+ pptr[1] = make_shade(pptr[1], g, alpha, 15);
+ pptr[2] = make_shade(pptr[2], b, alpha, 15);
#undef make_shade
- }
- }
- line += sraster;
- inc_ptr(dest, draster);
+ }
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
}
return 0;
}
@@ -532,15 +531,15 @@ declare_mem_procs(mem24_word_copy_mono, mem24_word_copy_color, mem24_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true24_word_device =
mem_full_device("image24w", 24, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem24_word_copy_mono, mem24_word_copy_color, mem24_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem24_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -558,8 +557,8 @@ mem24_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem24_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -572,7 +571,7 @@ mem24_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x * 24, w * 24, h, store);
mem_true24_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x * 24, w * 24, h, false);
return 0;
}
@@ -580,8 +579,8 @@ mem24_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem24_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -592,7 +591,7 @@ mem24_word_copy_color(gx_device * dev,
raster = mdev->raster;
mem_swap_byte_rect(row, raster, x * 24, w * 24, h, true);
bytes_copy_rectangle(row + x * 3, raster, base + sourcex * 3, sraster,
- w * 3, h);
+ w * 3, h);
mem_swap_byte_rect(row, raster, x * 24, w * 24, h, false);
return 0;
}
diff --git a/gs/base/gdevm32.c b/gs/base/gdevm32.c
index cf77d5eb3..b19f64fd5 100644
--- a/gs/base/gdevm32.c
+++ b/gs/base/gdevm32.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,10 +29,10 @@ declare_mem_procs(mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_r
/* The device descriptor. */
const gx_device_memory mem_true32_device =
mem_full_device("image32", 24, 8, mem_open,
- gx_default_map_rgb_color, gx_default_map_color_rgb,
+ gx_default_map_rgb_color, gx_default_map_color_rgb,
mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_rectangle,
- gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
- mem_default_strip_copy_rop, mem_get_bits_rectangle);
+ gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
+ mem_default_strip_copy_rop, mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -51,7 +51,7 @@ mem_full_device("image32", 24, 8, mem_open,
/* Fill a rectangle with a color. */
static int
mem_true32_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
bits32 a_color;
@@ -62,61 +62,61 @@ mem_true32_fill_rectangle(gx_device * dev,
a_color = arrange_bytes(color);
setup_rect(dest);
if (w <= 4)
- switch (w) {
- /*case 0: *//* not possible */
+ switch (w) {
+ /*case 0: *//* not possible */
#define dest32 ((bits32 *)dest)
- case 1:
- do {
- dest32[0] = a_color;
- inc_ptr(dest, draster);
- }
- while (--h > 0);
- break;
- case 2:
- do {
- dest32[1] = dest32[0] = a_color;
- inc_ptr(dest, draster);
- }
- while (--h > 0);
- break;
- case 3:
- do {
- dest32[2] = dest32[1] = dest32[0] = a_color;
- inc_ptr(dest, draster);
- }
- while (--h > 0);
- break;
- case 4:
- do {
- dest32[3] = dest32[2] = dest32[1] = dest32[0] = a_color;
- inc_ptr(dest, draster);
- }
- while (--h > 0);
- break;
- default: /* not possible */
- ;
+ case 1:
+ do {
+ dest32[0] = a_color;
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
+ break;
+ case 2:
+ do {
+ dest32[1] = dest32[0] = a_color;
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
+ break;
+ case 3:
+ do {
+ dest32[2] = dest32[1] = dest32[0] = a_color;
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
+ break;
+ case 4:
+ do {
+ dest32[3] = dest32[2] = dest32[1] = dest32[0] = a_color;
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
+ break;
+ default: /* not possible */
+ ;
} else if (a_color == 0)
- do {
- memset(dest, 0, w << 2);
- inc_ptr(dest, draster);
- }
- while (--h > 0);
+ do {
+ memset(dest, 0, w << 2);
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
else
- do {
- bits32 *pptr = dest32;
- int cnt = w;
+ do {
+ bits32 *pptr = dest32;
+ int cnt = w;
- do {
- pptr[3] = pptr[2] = pptr[1] = pptr[0] = a_color;
- pptr += 4;
- }
- while ((cnt -= 4) > 4);
- do {
- *pptr++ = a_color;
- } while (--cnt > 0);
- inc_ptr(dest, draster);
- }
- while (--h > 0);
+ do {
+ pptr[3] = pptr[2] = pptr[1] = pptr[0] = a_color;
+ pptr += 4;
+ }
+ while ((cnt -= 4) > 4);
+ do {
+ *pptr++ = a_color;
+ } while (--cnt > 0);
+ inc_ptr(dest, draster);
+ }
+ while (--h > 0);
#undef dest32
return 0;
}
@@ -124,8 +124,8 @@ mem_true32_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true32_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
bits32 a_zero = arrange_bytes(zero);
@@ -137,82 +137,82 @@ mem_true32_copy_mono(gx_device * dev,
setup_rect(dest);
line = base + (sourcex >> 3);
if (zero == gx_no_color_index) {
- int first_bit = sourcex & 7;
- int w_first = min(w, 8 - first_bit);
- int w_rest = w - w_first;
+ int first_bit = sourcex & 7;
+ int w_first = min(w, 8 - first_bit);
+ int w_rest = w - w_first;
- if (one == gx_no_color_index)
- return 0;
- /*
- * There are no halftones, so this case -- characters --
- * is the only common one.
- */
- while (h-- > 0) {
- bits32 *pptr = (bits32 *) dest;
- const byte *sptr = line;
- int sbyte = (*sptr++ << first_bit) & 0xff;
- int count = w_first;
+ if (one == gx_no_color_index)
+ return 0;
+ /*
+ * There are no halftones, so this case -- characters --
+ * is the only common one.
+ */
+ while (h-- > 0) {
+ bits32 *pptr = (bits32 *) dest;
+ const byte *sptr = line;
+ int sbyte = (*sptr++ << first_bit) & 0xff;
+ int count = w_first;
- if (sbyte)
- do {
- if (sbyte & 0x80)
- *pptr = a_one;
- sbyte <<= 1;
- pptr++;
- }
- while (--count > 0);
- else
- pptr += count;
- for (count = w_rest; count >= 8; count -= 8, pptr += 8) {
- sbyte = *sptr++;
- if (sbyte) {
- if (sbyte & 0x80) pptr[0] = a_one;
- if (sbyte & 0x40) pptr[1] = a_one;
- if (sbyte & 0x20) pptr[2] = a_one;
- if (sbyte & 0x10) pptr[3] = a_one;
- if (sbyte & 0x08) pptr[4] = a_one;
- if (sbyte & 0x04) pptr[5] = a_one;
- if (sbyte & 0x02) pptr[6] = a_one;
- if (sbyte & 0x01) pptr[7] = a_one;
- }
- }
- if (count) {
- sbyte = *sptr;
- do {
- if (sbyte & 0x80)
- *pptr = a_one;
- sbyte <<= 1;
- pptr++;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ if (sbyte)
+ do {
+ if (sbyte & 0x80)
+ *pptr = a_one;
+ sbyte <<= 1;
+ pptr++;
+ }
+ while (--count > 0);
+ else
+ pptr += count;
+ for (count = w_rest; count >= 8; count -= 8, pptr += 8) {
+ sbyte = *sptr++;
+ if (sbyte) {
+ if (sbyte & 0x80) pptr[0] = a_one;
+ if (sbyte & 0x40) pptr[1] = a_one;
+ if (sbyte & 0x20) pptr[2] = a_one;
+ if (sbyte & 0x10) pptr[3] = a_one;
+ if (sbyte & 0x08) pptr[4] = a_one;
+ if (sbyte & 0x04) pptr[5] = a_one;
+ if (sbyte & 0x02) pptr[6] = a_one;
+ if (sbyte & 0x01) pptr[7] = a_one;
+ }
+ }
+ if (count) {
+ sbyte = *sptr;
+ do {
+ if (sbyte & 0x80)
+ *pptr = a_one;
+ sbyte <<= 1;
+ pptr++;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else { /* zero != gx_no_color_index */
- int first_bit = 0x80 >> (sourcex & 7);
+ int first_bit = 0x80 >> (sourcex & 7);
- while (h-- > 0) {
- bits32 *pptr = (bits32 *) dest;
- const byte *sptr = line;
- int sbyte = *sptr++;
- int bit = first_bit;
- int count = w;
+ while (h-- > 0) {
+ bits32 *pptr = (bits32 *) dest;
+ const byte *sptr = line;
+ int sbyte = *sptr++;
+ int bit = first_bit;
+ int count = w;
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- *pptr = a_one;
- } else
- *pptr = a_zero;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- pptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ *pptr = a_one;
+ } else
+ *pptr = a_zero;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ pptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -220,8 +220,8 @@ mem_true32_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true32_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -243,36 +243,36 @@ declare_mem_procs(mem32_word_copy_mono, mem32_word_copy_color, mem32_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true32_word_device =
mem_full_device("image32w", 24, 8, mem_open,
- gx_default_map_rgb_color, gx_default_map_color_rgb,
+ gx_default_map_rgb_color, gx_default_map_color_rgb,
mem32_word_copy_mono, mem32_word_copy_color, mem32_word_fill_rectangle,
- gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem32_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
return mem_true32_fill_rectangle(dev, x, y, w, h,
- color_swap_bytes(color));
+ color_swap_bytes(color));
}
/* Copy a bitmap. */
static int
mem32_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
return mem_true32_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, color_swap_bytes(zero),
- color_swap_bytes(one));
+ x, y, w, h, color_swap_bytes(zero),
+ color_swap_bytes(one));
}
/* Copy a color bitmap. */
static int
mem32_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -282,7 +282,7 @@ mem32_word_copy_color(gx_device * dev,
row = scan_line_base(mdev, y);
raster = mdev->raster;
bytes_copy_rectangle(row + (x << 2), raster, base + (sourcex << 2),
- sraster, w << 2, h);
+ sraster, w << 2, h);
mem_swap_byte_rect(row, raster, x << 5, w << 5, h, false);
return 0;
}
diff --git a/gs/base/gdevm4.c b/gs/base/gdevm4.c
index 59fa8c74a..13b8d7b5e 100644
--- a/gs/base/gdevm4.c
+++ b/gs/base/gdevm4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,9 +30,9 @@ declare_mem_procs(mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fil
/* The device descriptor. */
const gx_device_memory mem_mapped4_device =
mem_device("image4", 3, 1,
- mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
+ mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fill_rectangle,
- mem_gray_strip_copy_rop);
+ mem_gray_strip_copy_rop);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -46,25 +46,24 @@ static const mono_fill_chunk tile_patterns[16] =
fpat(0xcc), fpat(0xdd), fpat(0xee), fpat(0xff)
};
-
/* Fill a rectangle with a color. */
static int
mem_mapped4_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
fit_fill(dev, x, y, w, h);
bits_fill_rectangle(scan_line_base(mdev, y), x << 2, mdev->raster,
- tile_patterns[color], w << 2, h);
+ tile_patterns[color], w << 2, h);
return 0;
}
/* Copy a bitmap. */
static int
mem_mapped4_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -76,130 +75,130 @@ mem_mapped4_copy_mono(gx_device * dev,
line = base + (sourcex >> 3);
/* Divide into opaque and masked cases. */
if (one == gx_no_color_index) {
- if (zero == gx_no_color_index)
- return 0; /* nothing to do */
- invert = 0xff;
- bb = ((byte) zero << 4) | (byte) zero;
+ if (zero == gx_no_color_index)
+ return 0; /* nothing to do */
+ invert = 0xff;
+ bb = ((byte) zero << 4) | (byte) zero;
} else if (zero == gx_no_color_index) {
- invert = 0;
- bb = ((byte) one << 4) | (byte) one;
+ invert = 0;
+ bb = ((byte) one << 4) | (byte) one;
} else {
- /* Opaque case. */
- int shift = ~(sourcex ^ x) & 1;
- byte oz[4];
+ /* Opaque case. */
+ int shift = ~(sourcex ^ x) & 1;
+ byte oz[4];
- oz[0] = (byte)((zero << 4) | zero);
- oz[1] = (byte)((zero << 4) | one);
- oz[2] = (byte)((one << 4) | zero);
- oz[3] = (byte)((one << 4) | one);
- do {
- register byte *dptr = (byte *) dest;
- const byte *sptr = line;
- register uint sbyte = *sptr++;
- register int sbit = ~sourcex & 7;
- int count = w;
+ oz[0] = (byte)((zero << 4) | zero);
+ oz[1] = (byte)((zero << 4) | one);
+ oz[2] = (byte)((one << 4) | zero);
+ oz[3] = (byte)((one << 4) | one);
+ do {
+ register byte *dptr = (byte *) dest;
+ const byte *sptr = line;
+ register uint sbyte = *sptr++;
+ register int sbit = ~sourcex & 7;
+ int count = w;
- /*
- * If the first source bit corresponds to an odd X in the
- * destination, process it now.
- */
- if (x & 1) {
- *dptr = (*dptr & 0xf0) |
- ((sbyte >> sbit) & 1 ? one : zero);
- --count; /* may now be 0 */
- if (--sbit < 0)
- sbit = 7, sbyte = *sptr++;
- ++dptr;
- }
- /*
- * Now we know the next destination X is even. We want to
- * process 2 source bits at a time from now on, so set things up
- * properly depending on whether the next source X (bit) is even
- * or odd. In both even and odd cases, the active source bits
- * are in bits 8..1 of sbyte.
- */
- sbyte <<= shift;
- sbit += shift - 1;
- /*
- * Now bit # sbit+1 is the most significant unprocessed bit
- * in sbyte. -1 <= sbit <= 7; sbit is odd.
- * Note that if sbit = -1, all of sbyte has been processed.
- *
- * Continue processing pairs of bits in the first source byte.
- */
- while (count >= 2 && sbit >= 0) {
- *dptr++ = oz[(sbyte >> sbit) & 3];
- sbit -= 2, count -= 2;
- }
- /*
- * Now sbit = -1 iff we have processed the entire first source
- * byte.
- *
- * Process full source bytes.
- */
- if (shift) {
- sbyte >>= 1; /* in case count < 8 */
- for (; count >= 8; dptr += 4, count -= 8) {
- sbyte = *sptr++;
- dptr[0] = oz[sbyte >> 6];
- dptr[1] = oz[(sbyte >> 4) & 3];
- dptr[2] = oz[(sbyte >> 2) & 3];
- dptr[3] = oz[sbyte & 3];
- }
- sbyte <<= 1;
- } else {
- for (; count >= 8; dptr += 4, count -= 8) {
- sbyte = (sbyte << 8) | *sptr++;
- dptr[0] = oz[(sbyte >> 7) & 3];
- dptr[1] = oz[(sbyte >> 5) & 3];
- dptr[2] = oz[(sbyte >> 3) & 3];
- dptr[3] = oz[(sbyte >> 1) & 3];
- }
- }
- if (!count)
- continue;
- /*
- * Process pairs of bits in the final source byte. Note that
- * if sbit > 0, this is still the first source byte (the
- * full-byte loop wasn't executed).
- */
- if (sbit < 0) {
- sbyte = (sbyte << 8) | (*sptr << shift);
- sbit = 7;
- }
- while (count >= 2) {
- *dptr++ = oz[(sbyte >> sbit) & 3];
- sbit -= 2, count -= 2;
- }
- /*
- * If the final source bit corresponds to an even X value,
- * process it now.
- */
- if (count) {
- *dptr = (*dptr & 0x0f) |
- (((sbyte >> sbit) & 2 ? one : zero) << 4);
- }
- } while ((line += sraster, inc_ptr(dest, draster), --h) > 0);
- return 0;
+ /*
+ * If the first source bit corresponds to an odd X in the
+ * destination, process it now.
+ */
+ if (x & 1) {
+ *dptr = (*dptr & 0xf0) |
+ ((sbyte >> sbit) & 1 ? one : zero);
+ --count; /* may now be 0 */
+ if (--sbit < 0)
+ sbit = 7, sbyte = *sptr++;
+ ++dptr;
+ }
+ /*
+ * Now we know the next destination X is even. We want to
+ * process 2 source bits at a time from now on, so set things up
+ * properly depending on whether the next source X (bit) is even
+ * or odd. In both even and odd cases, the active source bits
+ * are in bits 8..1 of sbyte.
+ */
+ sbyte <<= shift;
+ sbit += shift - 1;
+ /*
+ * Now bit # sbit+1 is the most significant unprocessed bit
+ * in sbyte. -1 <= sbit <= 7; sbit is odd.
+ * Note that if sbit = -1, all of sbyte has been processed.
+ *
+ * Continue processing pairs of bits in the first source byte.
+ */
+ while (count >= 2 && sbit >= 0) {
+ *dptr++ = oz[(sbyte >> sbit) & 3];
+ sbit -= 2, count -= 2;
+ }
+ /*
+ * Now sbit = -1 iff we have processed the entire first source
+ * byte.
+ *
+ * Process full source bytes.
+ */
+ if (shift) {
+ sbyte >>= 1; /* in case count < 8 */
+ for (; count >= 8; dptr += 4, count -= 8) {
+ sbyte = *sptr++;
+ dptr[0] = oz[sbyte >> 6];
+ dptr[1] = oz[(sbyte >> 4) & 3];
+ dptr[2] = oz[(sbyte >> 2) & 3];
+ dptr[3] = oz[sbyte & 3];
+ }
+ sbyte <<= 1;
+ } else {
+ for (; count >= 8; dptr += 4, count -= 8) {
+ sbyte = (sbyte << 8) | *sptr++;
+ dptr[0] = oz[(sbyte >> 7) & 3];
+ dptr[1] = oz[(sbyte >> 5) & 3];
+ dptr[2] = oz[(sbyte >> 3) & 3];
+ dptr[3] = oz[(sbyte >> 1) & 3];
+ }
+ }
+ if (!count)
+ continue;
+ /*
+ * Process pairs of bits in the final source byte. Note that
+ * if sbit > 0, this is still the first source byte (the
+ * full-byte loop wasn't executed).
+ */
+ if (sbit < 0) {
+ sbyte = (sbyte << 8) | (*sptr << shift);
+ sbit = 7;
+ }
+ while (count >= 2) {
+ *dptr++ = oz[(sbyte >> sbit) & 3];
+ sbit -= 2, count -= 2;
+ }
+ /*
+ * If the final source bit corresponds to an even X value,
+ * process it now.
+ */
+ if (count) {
+ *dptr = (*dptr & 0x0f) |
+ (((sbyte >> sbit) & 2 ? one : zero) << 4);
+ }
+ } while ((line += sraster, inc_ptr(dest, draster), --h) > 0);
+ return 0;
}
/* Masked case. */
do {
- register byte *dptr = (byte *) dest;
- const byte *sptr = line;
- register int sbyte = *sptr++ ^ invert;
- register int sbit = 0x80 >> (sourcex & 7);
- register byte mask = (x & 1 ? 0x0f : 0xf0);
- int count = w;
+ register byte *dptr = (byte *) dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ ^ invert;
+ register int sbit = 0x80 >> (sourcex & 7);
+ register byte mask = (x & 1 ? 0x0f : 0xf0);
+ int count = w;
- do {
- if (sbyte & sbit)
- *dptr = (*dptr & ~mask) | (bb & mask);
- if ((sbit >>= 1) == 0)
- sbit = 0x80, sbyte = *sptr++ ^ invert;
- dptr += (mask = ~mask) >> 7;
- } while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
+ do {
+ if (sbyte & sbit)
+ *dptr = (*dptr & ~mask) | (bb & mask);
+ if ((sbit >>= 1) == 0)
+ sbit = 0x80, sbyte = *sptr++ ^ invert;
+ dptr += (mask = ~mask) >> 7;
+ } while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
} while (--h > 0);
return 0;
}
@@ -207,8 +206,8 @@ mem_mapped4_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_mapped4_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
/* Use monobit copy_mono. */
int code;
@@ -216,8 +215,8 @@ mem_mapped4_copy_color(gx_device * dev,
/* Patch the width in the device temporarily. */
dev->width <<= 2;
code = (*dev_proc(&mem_mono_device, copy_mono))
- (dev, base, sourcex << 2, sraster, id,
- x << 2, y, w << 2, h, (gx_color_index) 0, (gx_color_index) 1);
+ (dev, base, sourcex << 2, sraster, id,
+ x << 2, y, w << 2, h, (gx_color_index) 0, (gx_color_index) 1);
/* Restore the correct width. */
dev->width >>= 2;
return code;
@@ -236,15 +235,15 @@ declare_mem_procs(mem4_word_copy_mono, mem4_word_copy_color, mem4_word_fill_rect
/* Here is the device descriptor. */
const gx_device_memory mem_mapped4_word_device =
mem_full_device("image4w", 4, 0, mem_open,
- mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
- mem4_word_copy_mono, mem4_word_copy_color, mem4_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
+ mem4_word_copy_mono, mem4_word_copy_color, mem4_word_fill_rectangle,
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem4_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -255,7 +254,7 @@ mem4_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
raster = mdev->raster;
mem_swap_byte_rect(base, raster, x << 2, w << 2, h, true);
bits_fill_rectangle(base, x << 2, raster,
- tile_patterns[color], w << 2, h);
+ tile_patterns[color], w << 2, h);
mem_swap_byte_rect(base, raster, x << 2, w << 2, h, true);
return 0;
}
@@ -263,8 +262,8 @@ mem4_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem4_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -277,7 +276,7 @@ mem4_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x << 2, w << 2, h, store);
mem_mapped4_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x << 2, w << 2, h, false);
return 0;
}
@@ -285,8 +284,8 @@ mem4_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem4_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
int code;
@@ -295,8 +294,8 @@ mem4_word_copy_color(gx_device * dev,
/* Patch the width in the device temporarily. */
dev->width <<= 2;
code = (*dev_proc(&mem_mono_word_device, copy_mono))
- (dev, base, sourcex << 2, sraster, id,
- x << 2, y, w << 2, h, (gx_color_index) 0, (gx_color_index) 1);
+ (dev, base, sourcex << 2, sraster, id,
+ x << 2, y, w << 2, h, (gx_color_index) 0, (gx_color_index) 1);
/* Restore the correct width. */
dev->width >>= 2;
return code;
diff --git a/gs/base/gdevm40.c b/gs/base/gdevm40.c
index a36c34eb8..0126f63ed 100644
--- a/gs/base/gdevm40.c
+++ b/gs/base/gdevm40.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,8 +22,8 @@
#ifdef DEBUG
struct stats_mem40_s {
long
- fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
- fprevc[257];
+ fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
+ fprevc[257];
double ftotal;
} stats_mem40;
static int prev_count = 0;
@@ -33,7 +33,6 @@ static gx_color_index prev_colors[256];
# define INCR(v) DO_NOTHING
#endif
-
/* ================ Standard (byte-oriented) device ================ */
#undef chunk
@@ -46,11 +45,11 @@ declare_mem_procs(mem_true40_copy_mono, mem_true40_copy_color, mem_true40_fill_r
/* The device descriptor. */
const gx_device_memory mem_true40_device =
mem_full_alpha_device("image40", 40, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true40_copy_mono, mem_true40_copy_color, mem_true40_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_copy_alpha,
- gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
- mem_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -58,43 +57,43 @@ mem_full_alpha_device("image40", 40, 0, mem_open,
/* Unpack a color into its bytes. */
#define declare_unpack_color(a, b, c, d, e, color)\
- byte a = (byte)((color >> 16) >> 16);\
- byte b = (byte)((uint)color >> 24);\
- byte c = (byte)((uint)color >> 16);\
- byte d = (byte)((uint)color >> 8);\
- byte e = (byte)color
+ byte a = (byte)((color >> 16) >> 16);\
+ byte b = (byte)((uint)color >> 24);\
+ byte c = (byte)((uint)color >> 16);\
+ byte d = (byte)((uint)color >> 8);\
+ byte e = (byte)color
/* Put a 40-bit color into the bitmap. */
#define put5(ptr, a, b, c, d, e)\
- (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e
+ (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e
/* Put 4 bytes of color into the bitmap. */
#define putw(ptr, wxyz)\
- *(bits32 *)(ptr) = (wxyz)
+ *(bits32 *)(ptr) = (wxyz)
/* Load the 5-word 40-bit-color cache. */
/* Free variables: [m]dev, abcd, bcde, cdea, deab, earc. */
#if arch_is_big_endian
# define set_color40_cache(color, a, b, c, d, e)\
- mdev->color40.abcd = abcd = (color) >> 8, \
- mdev->color40.bcde = bcde = (abcd << 8) | (e),\
- mdev->color40.cdea = cdea = (bcde << 8) | (a),\
- mdev->color40.deab = deab = (cdea << 8) | (b),\
- mdev->color40.eabc = eabc = (deab << 8) | (c),\
- mdev->color40.abcde = (color)
+ mdev->color40.abcd = abcd = (color) >> 8, \
+ mdev->color40.bcde = bcde = (abcd << 8) | (e),\
+ mdev->color40.cdea = cdea = (bcde << 8) | (a),\
+ mdev->color40.deab = deab = (cdea << 8) | (b),\
+ mdev->color40.eabc = eabc = (deab << 8) | (c),\
+ mdev->color40.abcde = (color)
#else
# define set_color40_cache(color, a, b, c, d, e)\
- mdev->color40.abcd = abcd =\
- ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
- ((bits16)(b) << 8) | (a),\
- mdev->color40.eabc = eabc = (abcd << 8) | (e),\
- mdev->color40.deab = deab = (eabc << 8) | (d),\
- mdev->color40.cdea = cdea = (deab << 8) | (c),\
- mdev->color40.bcde = bcde = (cdea << 8) | (b),\
- mdev->color40.abcde = (color)
+ mdev->color40.abcd = abcd =\
+ ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
+ ((bits16)(b) << 8) | (a),\
+ mdev->color40.eabc = eabc = (abcd << 8) | (e),\
+ mdev->color40.deab = deab = (eabc << 8) | (d),\
+ mdev->color40.cdea = cdea = (deab << 8) | (c),\
+ mdev->color40.bcde = bcde = (cdea << 8) | (b),\
+ mdev->color40.abcde = (color)
#endif
/* Fill a rectangle with a color. */
static int
mem_true40_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
declare_unpack_color(a, b, c, d, e, color);
@@ -111,164 +110,164 @@ mem_true40_fill_rectangle(gx_device * dev,
stats_mem40.ftotal += w;
#endif
if (w >= 5) {
- if (h <= 0)
- return 0;
- INCR(fwide);
- setup_rect(dest);
- if (a == b && b == c && c == d && d == e) {
- int bcnt = w * PIXEL_SIZE;
-
- INCR(fgray[min(w, 100)]);
- while (h-- > 0) {
- memset(dest, a, bcnt);
- inc_ptr(dest, draster);
- }
- } else {
- int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
- bits32 abcd, bcde, cdea, deab, eabc;
-
- if (mdev->color40.abcde == color) {
- abcd = mdev->color40.abcd;
- bcde = mdev->color40.bcde;
- cdea = mdev->color40.cdea;
- deab = mdev->color40.deab;
- eabc = mdev->color40.eabc;
- } else {
- INCR(fsetc);
- set_color40_cache(color, a, b, c, d, e);
- }
+ if (h <= 0)
+ return 0;
+ INCR(fwide);
+ setup_rect(dest);
+ if (a == b && b == c && c == d && d == e) {
+ int bcnt = w * PIXEL_SIZE;
+
+ INCR(fgray[min(w, 100)]);
+ while (h-- > 0) {
+ memset(dest, a, bcnt);
+ inc_ptr(dest, draster);
+ }
+ } else {
+ int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
+ bits32 abcd, bcde, cdea, deab, eabc;
+
+ if (mdev->color40.abcde == color) {
+ abcd = mdev->color40.abcd;
+ bcde = mdev->color40.bcde;
+ cdea = mdev->color40.cdea;
+ deab = mdev->color40.deab;
+ eabc = mdev->color40.eabc;
+ } else {
+ INCR(fsetc);
+ set_color40_cache(color, a, b, c, d, e);
+ }
#ifdef DEBUG
- {
- int ci;
- for (ci = 0; ci < prev_count; ++ci)
- if (prev_colors[ci] == color)
- break;
- INCR(fprevc[ci]);
- if (ci == prev_count) {
- if (ci < countof(prev_colors))
- ++prev_count;
- else
- --ci;
- }
- if (ci) {
- memmove(&prev_colors[1], &prev_colors[0],
- ci * sizeof(prev_colors[0]));
- prev_colors[0] = color;
- }
- }
+ {
+ int ci;
+ for (ci = 0; ci < prev_count; ++ci)
+ if (prev_colors[ci] == color)
+ break;
+ INCR(fprevc[ci]);
+ if (ci == prev_count) {
+ if (ci < countof(prev_colors))
+ ++prev_count;
+ else
+ --ci;
+ }
+ if (ci) {
+ memmove(&prev_colors[1], &prev_colors[0],
+ ci * sizeof(prev_colors[0]));
+ prev_colors[0] = color;
+ }
+ }
#endif
- INCR(fcolor[min(w, 100)]);
- while (h-- > 0) {
- register byte *pptr = dest;
- int w1 = ww;
-
- switch (x3) {
- case 1:
- pptr[0] = a;
- putw(pptr + 1, bcde);
- pptr += PIXEL_SIZE;
- break;
- case 2:
- pptr[0] = a;
- pptr[1] = b;
- putw(pptr + 2, cdea);
- putw(pptr + 6, bcde);
- pptr += 2 * PIXEL_SIZE;
- break;
- case 3:
- pptr[0] = a;
- pptr[1] = b;
- pptr[2] = c;
- putw(pptr + 3, deab);
- putw(pptr + 7, cdea);
- putw(pptr + 11, bcde);
- pptr += 3 * PIXEL_SIZE;
- break;
- case 0:
- ;
- }
- while (w1 >= 4) {
- putw(pptr, abcd);
- putw(pptr + 4, eabc);
- putw(pptr + 8, deab);
- putw(pptr + 12, cdea);
- putw(pptr + 16, bcde);
- pptr += 4 * PIXEL_SIZE;
- w1 -= 4;
- }
- switch (w1) {
- case 1:
- putw(pptr, abcd);
- pptr[4] = e;
- break;
- case 2:
- putw(pptr, abcd);
- putw(pptr + 4, eabc);
- pptr[8] = d;
- pptr[9] = e;
- break;
- case 3:
- putw(pptr, abcd);
- putw(pptr + 4, eabc);
- putw(pptr + 8, deab);
- pptr[12] = c;
- pptr[13] = d;
- pptr[14] = e;
- break;
- case 0:
- ;
- }
- inc_ptr(dest, draster);
- }
- }
+ INCR(fcolor[min(w, 100)]);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ int w1 = ww;
+
+ switch (x3) {
+ case 1:
+ pptr[0] = a;
+ putw(pptr + 1, bcde);
+ pptr += PIXEL_SIZE;
+ break;
+ case 2:
+ pptr[0] = a;
+ pptr[1] = b;
+ putw(pptr + 2, cdea);
+ putw(pptr + 6, bcde);
+ pptr += 2 * PIXEL_SIZE;
+ break;
+ case 3:
+ pptr[0] = a;
+ pptr[1] = b;
+ pptr[2] = c;
+ putw(pptr + 3, deab);
+ putw(pptr + 7, cdea);
+ putw(pptr + 11, bcde);
+ pptr += 3 * PIXEL_SIZE;
+ break;
+ case 0:
+ ;
+ }
+ while (w1 >= 4) {
+ putw(pptr, abcd);
+ putw(pptr + 4, eabc);
+ putw(pptr + 8, deab);
+ putw(pptr + 12, cdea);
+ putw(pptr + 16, bcde);
+ pptr += 4 * PIXEL_SIZE;
+ w1 -= 4;
+ }
+ switch (w1) {
+ case 1:
+ putw(pptr, abcd);
+ pptr[4] = e;
+ break;
+ case 2:
+ putw(pptr, abcd);
+ putw(pptr + 4, eabc);
+ pptr[8] = d;
+ pptr[9] = e;
+ break;
+ case 3:
+ putw(pptr, abcd);
+ putw(pptr + 4, eabc);
+ putw(pptr + 8, deab);
+ pptr[12] = c;
+ pptr[13] = d;
+ pptr[14] = e;
+ break;
+ case 0:
+ ;
+ }
+ inc_ptr(dest, draster);
+ }
+ }
} else if (h > 0) { /* w < 5 */
- INCR(fnarrow[max(w, 0)]);
- setup_rect(dest);
- switch (w) {
- case 4:
- do {
- dest[15] = dest[10] = dest[5] = dest[0] = a;
- dest[16] = dest[11] = dest[6] = dest[1] = b;
- dest[17] = dest[12] = dest[7] = dest[2] = c;
- dest[18] = dest[13] = dest[8] = dest[3] = d;
- dest[19] = dest[14] = dest[9] = dest[4] = e;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 3:
- do {
- dest[10] = dest[5] = dest[0] = a;
- dest[11] = dest[6] = dest[1] = b;
- dest[12] = dest[7] = dest[2] = c;
- dest[13] = dest[8] = dest[3] = d;
- dest[14] = dest[9] = dest[4] = e;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 2:
- do {
- dest[5] = dest[0] = a;
- dest[6] = dest[1] = b;
- dest[7] = dest[2] = c;
- dest[8] = dest[3] = d;
- dest[9] = dest[4] = e;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 1:
- do {
- dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d; dest[4] = e;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 0:
- default:
- ;
- }
+ INCR(fnarrow[max(w, 0)]);
+ setup_rect(dest);
+ switch (w) {
+ case 4:
+ do {
+ dest[15] = dest[10] = dest[5] = dest[0] = a;
+ dest[16] = dest[11] = dest[6] = dest[1] = b;
+ dest[17] = dest[12] = dest[7] = dest[2] = c;
+ dest[18] = dest[13] = dest[8] = dest[3] = d;
+ dest[19] = dest[14] = dest[9] = dest[4] = e;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 3:
+ do {
+ dest[10] = dest[5] = dest[0] = a;
+ dest[11] = dest[6] = dest[1] = b;
+ dest[12] = dest[7] = dest[2] = c;
+ dest[13] = dest[8] = dest[3] = d;
+ dest[14] = dest[9] = dest[4] = e;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 2:
+ do {
+ dest[5] = dest[0] = a;
+ dest[6] = dest[1] = b;
+ dest[7] = dest[2] = c;
+ dest[8] = dest[3] = d;
+ dest[9] = dest[4] = e;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 1:
+ do {
+ dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d; dest[4] = e;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 0:
+ default:
+ ;
+ }
}
return 0;
}
@@ -276,8 +275,8 @@ mem_true40_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true40_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -292,100 +291,100 @@ mem_true40_copy_mono(gx_device * dev,
sbit = sourcex & 7;
first_bit = 0x80 >> sbit;
if (zero != gx_no_color_index) { /* Loop for halftones or inverted masks */
- /* (never used). */
- declare_unpack_color(a0, b0, c0, d0, e0, zero);
- declare_unpack_color(a1, b1, c1, d1, e1, one);
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- put5(pptr, a1, b1, c1, d1, e1);
- } else
- put5(pptr, a0, b0, c0, d0, e0);
- pptr += PIXEL_SIZE;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* (never used). */
+ declare_unpack_color(a0, b0, c0, d0, e0, zero);
+ declare_unpack_color(a1, b1, c1, d1, e1, one);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ put5(pptr, a1, b1, c1, d1, e1);
+ } else
+ put5(pptr, a0, b0, c0, d0, e0);
+ pptr += PIXEL_SIZE;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else if (one != gx_no_color_index) { /* Loop for character and pattern masks. */
- /* This is used heavily. */
- declare_unpack_color(a1, b1, c1, d1, e1, one);
- int first_mask = first_bit << 1;
- int first_count, first_skip;
-
- if (sbit + w > 8)
- first_mask -= 1,
- first_count = 8 - sbit;
- else
- first_mask -= first_mask >> w,
- first_count = w;
- first_skip = first_count * PIXEL_SIZE;
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++ & first_mask;
- int count = w - first_count;
-
- if (sbyte) {
- register int bit = first_bit;
-
- do {
- if (sbyte & bit)
- put5(pptr, a1, b1, c1, d1, e1);
- pptr += PIXEL_SIZE;
- }
- while ((bit >>= 1) & first_mask);
- } else
- pptr += first_skip;
- while (count >= 8) {
- sbyte = *sptr++;
- if (sbyte & 0xf0) {
- if (sbyte & 0x80)
- put5(pptr, a1, b1, c1, d1, e1);
- if (sbyte & 0x40)
- put5(pptr + 5, a1, b1, c1, d1, e1);
- if (sbyte & 0x20)
- put5(pptr + 10, a1, b1, c1, d1, e1);
- if (sbyte & 0x10)
- put5(pptr + 15, a1, b1, c1, d1, e1);
- }
- if (sbyte & 0xf) {
- if (sbyte & 8)
- put5(pptr + 20, a1, b1, c1, d1, e1);
- if (sbyte & 4)
- put5(pptr + 25, a1, b1, c1, d1, e1);
- if (sbyte & 2)
- put5(pptr + 30, a1, b1, c1, d1, e1);
- if (sbyte & 1)
- put5(pptr + 35, a1, b1, c1, d1, e1);
- }
- pptr += 8 * PIXEL_SIZE;
- count -= 8;
- }
- if (count > 0) {
- register int bit = 0x80;
-
- sbyte = *sptr++;
- do {
- if (sbyte & bit)
- put5(pptr, a1, b1, c1, d1, e1);
- pptr += PIXEL_SIZE;
- bit >>= 1;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* This is used heavily. */
+ declare_unpack_color(a1, b1, c1, d1, e1, one);
+ int first_mask = first_bit << 1;
+ int first_count, first_skip;
+
+ if (sbit + w > 8)
+ first_mask -= 1,
+ first_count = 8 - sbit;
+ else
+ first_mask -= first_mask >> w,
+ first_count = w;
+ first_skip = first_count * PIXEL_SIZE;
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ & first_mask;
+ int count = w - first_count;
+
+ if (sbyte) {
+ register int bit = first_bit;
+
+ do {
+ if (sbyte & bit)
+ put5(pptr, a1, b1, c1, d1, e1);
+ pptr += PIXEL_SIZE;
+ }
+ while ((bit >>= 1) & first_mask);
+ } else
+ pptr += first_skip;
+ while (count >= 8) {
+ sbyte = *sptr++;
+ if (sbyte & 0xf0) {
+ if (sbyte & 0x80)
+ put5(pptr, a1, b1, c1, d1, e1);
+ if (sbyte & 0x40)
+ put5(pptr + 5, a1, b1, c1, d1, e1);
+ if (sbyte & 0x20)
+ put5(pptr + 10, a1, b1, c1, d1, e1);
+ if (sbyte & 0x10)
+ put5(pptr + 15, a1, b1, c1, d1, e1);
+ }
+ if (sbyte & 0xf) {
+ if (sbyte & 8)
+ put5(pptr + 20, a1, b1, c1, d1, e1);
+ if (sbyte & 4)
+ put5(pptr + 25, a1, b1, c1, d1, e1);
+ if (sbyte & 2)
+ put5(pptr + 30, a1, b1, c1, d1, e1);
+ if (sbyte & 1)
+ put5(pptr + 35, a1, b1, c1, d1, e1);
+ }
+ pptr += 8 * PIXEL_SIZE;
+ count -= 8;
+ }
+ if (count > 0) {
+ register int bit = 0x80;
+
+ sbyte = *sptr++;
+ do {
+ if (sbyte & bit)
+ put5(pptr, a1, b1, c1, d1, e1);
+ pptr += PIXEL_SIZE;
+ bit >>= 1;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -393,8 +392,8 @@ mem_true40_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true40_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -416,15 +415,15 @@ declare_mem_procs(mem40_word_copy_mono, mem40_word_copy_color, mem40_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true40_word_device =
mem_full_device("image40w", 40, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem40_word_copy_mono, mem40_word_copy_color, mem40_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem40_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -442,8 +441,8 @@ mem40_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem40_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -456,7 +455,7 @@ mem40_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x * 40, w * 40, h, store);
mem_true40_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x * 40, w * 40, h, false);
return 0;
}
@@ -464,8 +463,8 @@ mem40_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem40_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -476,7 +475,7 @@ mem40_word_copy_color(gx_device * dev,
raster = mdev->raster;
mem_swap_byte_rect(row, raster, x * 40, w * 40, h, true);
bytes_copy_rectangle(row + x * PIXEL_SIZE, raster, base + sourcex * PIXEL_SIZE,
- sraster, w * PIXEL_SIZE, h);
+ sraster, w * PIXEL_SIZE, h);
mem_swap_byte_rect(row, raster, x * 40, w * 40, h, false);
return 0;
}
diff --git a/gs/base/gdevm48.c b/gs/base/gdevm48.c
index b87dfa203..f06b7e737 100644
--- a/gs/base/gdevm48.c
+++ b/gs/base/gdevm48.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,8 +22,8 @@
#ifdef DEBUG
struct stats_mem48_s {
long
- fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
- fprevc[257];
+ fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
+ fprevc[257];
double ftotal;
} stats_mem48;
static int prev_count = 0;
@@ -33,7 +33,6 @@ static gx_color_index prev_colors[256];
# define INCR(v) DO_NOTHING
#endif
-
/* ================ Standard (byte-oriented) device ================ */
#undef chunk
@@ -46,11 +45,11 @@ declare_mem_procs(mem_true48_copy_mono, mem_true48_copy_color, mem_true48_fill_r
/* The device descriptor. */
const gx_device_memory mem_true48_device =
mem_full_alpha_device("image48", 48, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true48_copy_mono, mem_true48_copy_color, mem_true48_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_copy_alpha,
- gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
- mem_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -58,40 +57,40 @@ mem_full_alpha_device("image48", 48, 0, mem_open,
/* Unpack a color into its bytes. */
#define declare_unpack_color(a, b, c, d, e, f, color)\
- byte a = (byte)((color >> 24) >> 16);\
- byte b = (byte)((color >> 16) >> 16);\
- byte c = (byte)((uint)color >> 24);\
- byte d = (byte)((uint)color >> 16);\
- byte e = (byte)((uint)color >> 8);\
- byte f = (byte)color
+ byte a = (byte)((color >> 24) >> 16);\
+ byte b = (byte)((color >> 16) >> 16);\
+ byte c = (byte)((uint)color >> 24);\
+ byte d = (byte)((uint)color >> 16);\
+ byte e = (byte)((uint)color >> 8);\
+ byte f = (byte)color
/* Put a 48-bit color into the bitmap. */
#define put6(ptr, a, b, c, d, e, f)\
- (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e, (ptr)[5] = f
+ (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e, (ptr)[5] = f
/* Put 4 bytes of color into the bitmap. */
#define putw(ptr, wxyz)\
- *(bits32 *)(ptr) = (wxyz)
+ *(bits32 *)(ptr) = (wxyz)
/* Load the 3-word 48-bit-color cache. */
/* Free variables: [m]dev, abcd, bcde, cdea, deab, earc. */
#if arch_is_big_endian
# define set_color48_cache(color, a, b, c, d, e, f)\
- mdev->color48.abcd = abcd = (color) >> 16, \
- mdev->color48.cdef = cdef = (abcd << 16) | ((e) <<8) | (f),\
- mdev->color48.efab = efab = (cdef << 16) | ((a) <<8) | (b),\
- mdev->color48.abcdef = (color)
+ mdev->color48.abcd = abcd = (color) >> 16, \
+ mdev->color48.cdef = cdef = (abcd << 16) | ((e) <<8) | (f),\
+ mdev->color48.efab = efab = (cdef << 16) | ((a) <<8) | (b),\
+ mdev->color48.abcdef = (color)
#else
# define set_color48_cache(color, a, b, c, d, e, f)\
- mdev->color48.abcd = abcd =\
- ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
- ((bits16)(b) << 8) | (a),\
- mdev->color48.efab = efab = (abcd << 16) | ((f) <<8) | (e),\
- mdev->color48.cdef = cdef = (efab << 16) | ((d) <<8) | (c),\
- mdev->color48.abcdef = (color)
+ mdev->color48.abcd = abcd =\
+ ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
+ ((bits16)(b) << 8) | (a),\
+ mdev->color48.efab = efab = (abcd << 16) | ((f) <<8) | (e),\
+ mdev->color48.cdef = cdef = (efab << 16) | ((d) <<8) | (c),\
+ mdev->color48.abcdef = (color)
#endif
/* Fill a rectangle with a color. */
static int
mem_true48_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
declare_unpack_color(a, b, c, d, e, f, color);
@@ -108,136 +107,136 @@ mem_true48_fill_rectangle(gx_device * dev,
stats_mem48.ftotal += w;
#endif
if (w >= 5) {
- if (h <= 0)
- return 0;
- INCR(fwide);
- setup_rect(dest);
- if (a == b && b == c && c == d && d == e && e == f) {
- int bcnt = w * PIXEL_SIZE;
-
- INCR(fgray[min(w, 100)]);
- while (h-- > 0) {
- memset(dest, a, bcnt);
- inc_ptr(dest, draster);
- }
- } else {
- int x1 = -x & 1, ww = w - x1; /* we know ww >= 4 */
- bits32 abcd, cdef, efab;
-
- if (mdev->color48.abcdef == color) {
- abcd = mdev->color48.abcd;
- cdef = mdev->color48.cdef;
- efab = mdev->color48.efab;
- } else {
- INCR(fsetc);
- set_color48_cache(color, a, b, c, d, e, f);
- }
+ if (h <= 0)
+ return 0;
+ INCR(fwide);
+ setup_rect(dest);
+ if (a == b && b == c && c == d && d == e && e == f) {
+ int bcnt = w * PIXEL_SIZE;
+
+ INCR(fgray[min(w, 100)]);
+ while (h-- > 0) {
+ memset(dest, a, bcnt);
+ inc_ptr(dest, draster);
+ }
+ } else {
+ int x1 = -x & 1, ww = w - x1; /* we know ww >= 4 */
+ bits32 abcd, cdef, efab;
+
+ if (mdev->color48.abcdef == color) {
+ abcd = mdev->color48.abcd;
+ cdef = mdev->color48.cdef;
+ efab = mdev->color48.efab;
+ } else {
+ INCR(fsetc);
+ set_color48_cache(color, a, b, c, d, e, f);
+ }
#ifdef DEBUG
- {
- int ci;
- for (ci = 0; ci < prev_count; ++ci)
- if (prev_colors[ci] == color)
- break;
- INCR(fprevc[ci]);
- if (ci == prev_count) {
- if (ci < countof(prev_colors))
- ++prev_count;
- else
- --ci;
- }
- if (ci) {
- memmove(&prev_colors[1], &prev_colors[0],
- ci * sizeof(prev_colors[0]));
- prev_colors[0] = color;
- }
- }
+ {
+ int ci;
+ for (ci = 0; ci < prev_count; ++ci)
+ if (prev_colors[ci] == color)
+ break;
+ INCR(fprevc[ci]);
+ if (ci == prev_count) {
+ if (ci < countof(prev_colors))
+ ++prev_count;
+ else
+ --ci;
+ }
+ if (ci) {
+ memmove(&prev_colors[1], &prev_colors[0],
+ ci * sizeof(prev_colors[0]));
+ prev_colors[0] = color;
+ }
+ }
#endif
- INCR(fcolor[min(w, 100)]);
- while (h-- > 0) {
- register byte *pptr = dest;
- int w1 = ww;
-
- switch (x1) {
- case 1:
- pptr[0] = a;
- pptr[1] = b;
- putw(pptr + 2, cdef);
- pptr += PIXEL_SIZE;
- break;
- case 0:
- ;
- }
- while (w1 >= 2) {
- putw(pptr, abcd);
- putw(pptr + 4, efab);
- putw(pptr + 8, cdef);
- pptr += 2 * PIXEL_SIZE;
- w1 -= 2;
- }
- switch (w1) {
- case 1:
- putw(pptr, abcd);
- pptr[4] = e;
- pptr[5] = f;
- break;
- case 0:
- ;
- }
- inc_ptr(dest, draster);
- }
- }
+ INCR(fcolor[min(w, 100)]);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ int w1 = ww;
+
+ switch (x1) {
+ case 1:
+ pptr[0] = a;
+ pptr[1] = b;
+ putw(pptr + 2, cdef);
+ pptr += PIXEL_SIZE;
+ break;
+ case 0:
+ ;
+ }
+ while (w1 >= 2) {
+ putw(pptr, abcd);
+ putw(pptr + 4, efab);
+ putw(pptr + 8, cdef);
+ pptr += 2 * PIXEL_SIZE;
+ w1 -= 2;
+ }
+ switch (w1) {
+ case 1:
+ putw(pptr, abcd);
+ pptr[4] = e;
+ pptr[5] = f;
+ break;
+ case 0:
+ ;
+ }
+ inc_ptr(dest, draster);
+ }
+ }
} else if (h > 0) { /* w < 5 */
- INCR(fnarrow[max(w, 0)]);
- setup_rect(dest);
- switch (w) {
- case 4:
- do {
- dest[18] = dest[12] = dest[6] = dest[0] = a;
- dest[19] = dest[13] = dest[7] = dest[1] = b;
- dest[20] = dest[14] = dest[8] = dest[2] = c;
- dest[21] = dest[15] = dest[9] = dest[3] = d;
- dest[22] = dest[16] = dest[10] = dest[4] = e;
- dest[23] = dest[17] = dest[11] = dest[5] = f;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 3:
- do {
- dest[12] = dest[6] = dest[0] = a;
- dest[13] = dest[7] = dest[1] = b;
- dest[14] = dest[8] = dest[2] = c;
- dest[15] = dest[9] = dest[3] = d;
- dest[16] = dest[10] = dest[4] = e;
- dest[17] = dest[11] = dest[5] = f;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 2:
- do {
- dest[6] = dest[0] = a;
- dest[7] = dest[1] = b;
- dest[8] = dest[2] = c;
- dest[9] = dest[3] = d;
- dest[10] = dest[4] = e;
- dest[11] = dest[5] = f;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 1:
- do {
- dest[0] = a; dest[1] = b; dest[2] = c;
- dest[3] = d; dest[4] = e; dest[5] = f;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 0:
- default:
- ;
- }
+ INCR(fnarrow[max(w, 0)]);
+ setup_rect(dest);
+ switch (w) {
+ case 4:
+ do {
+ dest[18] = dest[12] = dest[6] = dest[0] = a;
+ dest[19] = dest[13] = dest[7] = dest[1] = b;
+ dest[20] = dest[14] = dest[8] = dest[2] = c;
+ dest[21] = dest[15] = dest[9] = dest[3] = d;
+ dest[22] = dest[16] = dest[10] = dest[4] = e;
+ dest[23] = dest[17] = dest[11] = dest[5] = f;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 3:
+ do {
+ dest[12] = dest[6] = dest[0] = a;
+ dest[13] = dest[7] = dest[1] = b;
+ dest[14] = dest[8] = dest[2] = c;
+ dest[15] = dest[9] = dest[3] = d;
+ dest[16] = dest[10] = dest[4] = e;
+ dest[17] = dest[11] = dest[5] = f;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 2:
+ do {
+ dest[6] = dest[0] = a;
+ dest[7] = dest[1] = b;
+ dest[8] = dest[2] = c;
+ dest[9] = dest[3] = d;
+ dest[10] = dest[4] = e;
+ dest[11] = dest[5] = f;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 1:
+ do {
+ dest[0] = a; dest[1] = b; dest[2] = c;
+ dest[3] = d; dest[4] = e; dest[5] = f;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 0:
+ default:
+ ;
+ }
}
return 0;
}
@@ -245,8 +244,8 @@ mem_true48_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true48_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -261,100 +260,100 @@ mem_true48_copy_mono(gx_device * dev,
sbit = sourcex & 7;
first_bit = 0x80 >> sbit;
if (zero != gx_no_color_index) { /* Loop for halftones or inverted masks */
- /* (never used). */
- declare_unpack_color(a0, b0, c0, d0, e0, f0, zero);
- declare_unpack_color(a1, b1, c1, d1, e1, f1, one);
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- put6(pptr, a1, b1, c1, d1, e1, f1);
- } else
- put6(pptr, a0, b0, c0, d0, e0, f0);
- pptr += PIXEL_SIZE;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* (never used). */
+ declare_unpack_color(a0, b0, c0, d0, e0, f0, zero);
+ declare_unpack_color(a1, b1, c1, d1, e1, f1, one);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ put6(pptr, a1, b1, c1, d1, e1, f1);
+ } else
+ put6(pptr, a0, b0, c0, d0, e0, f0);
+ pptr += PIXEL_SIZE;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else if (one != gx_no_color_index) { /* Loop for character and pattern masks. */
- /* This is used heavily. */
- declare_unpack_color(a1, b1, c1, d1, e1, f1, one);
- int first_mask = first_bit << 1;
- int first_count, first_skip;
-
- if (sbit + w > 8)
- first_mask -= 1,
- first_count = 8 - sbit;
- else
- first_mask -= first_mask >> w,
- first_count = w;
- first_skip = first_count * PIXEL_SIZE;
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++ & first_mask;
- int count = w - first_count;
-
- if (sbyte) {
- register int bit = first_bit;
-
- do {
- if (sbyte & bit)
- put6(pptr, a1, b1, c1, d1, e1, f1);
- pptr += PIXEL_SIZE;
- }
- while ((bit >>= 1) & first_mask);
- } else
- pptr += first_skip;
- while (count >= 8) {
- sbyte = *sptr++;
- if (sbyte & 0xf0) {
- if (sbyte & 0x80)
- put6(pptr, a1, b1, c1, d1, e1, f1);
- if (sbyte & 0x40)
- put6(pptr + 6, a1, b1, c1, d1, e1, f1);
- if (sbyte & 0x20)
- put6(pptr + 12, a1, b1, c1, d1, e1, f1);
- if (sbyte & 0x10)
- put6(pptr + 18, a1, b1, c1, d1, e1, f1);
- }
- if (sbyte & 0xf) {
- if (sbyte & 8)
- put6(pptr + 24, a1, b1, c1, d1, e1, f1);
- if (sbyte & 4)
- put6(pptr + 30, a1, b1, c1, d1, e1, f1);
- if (sbyte & 2)
- put6(pptr + 36, a1, b1, c1, d1, e1, f1);
- if (sbyte & 1)
- put6(pptr + 42, a1, b1, c1, d1, e1, f1);
- }
- pptr += 8 * PIXEL_SIZE;
- count -= 8;
- }
- if (count > 0) {
- register int bit = 0x80;
-
- sbyte = *sptr++;
- do {
- if (sbyte & bit)
- put6(pptr, a1, b1, c1, d1, e1, f1);
- pptr += PIXEL_SIZE;
- bit >>= 1;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* This is used heavily. */
+ declare_unpack_color(a1, b1, c1, d1, e1, f1, one);
+ int first_mask = first_bit << 1;
+ int first_count, first_skip;
+
+ if (sbit + w > 8)
+ first_mask -= 1,
+ first_count = 8 - sbit;
+ else
+ first_mask -= first_mask >> w,
+ first_count = w;
+ first_skip = first_count * PIXEL_SIZE;
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ & first_mask;
+ int count = w - first_count;
+
+ if (sbyte) {
+ register int bit = first_bit;
+
+ do {
+ if (sbyte & bit)
+ put6(pptr, a1, b1, c1, d1, e1, f1);
+ pptr += PIXEL_SIZE;
+ }
+ while ((bit >>= 1) & first_mask);
+ } else
+ pptr += first_skip;
+ while (count >= 8) {
+ sbyte = *sptr++;
+ if (sbyte & 0xf0) {
+ if (sbyte & 0x80)
+ put6(pptr, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 0x40)
+ put6(pptr + 6, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 0x20)
+ put6(pptr + 12, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 0x10)
+ put6(pptr + 18, a1, b1, c1, d1, e1, f1);
+ }
+ if (sbyte & 0xf) {
+ if (sbyte & 8)
+ put6(pptr + 24, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 4)
+ put6(pptr + 30, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 2)
+ put6(pptr + 36, a1, b1, c1, d1, e1, f1);
+ if (sbyte & 1)
+ put6(pptr + 42, a1, b1, c1, d1, e1, f1);
+ }
+ pptr += 8 * PIXEL_SIZE;
+ count -= 8;
+ }
+ if (count > 0) {
+ register int bit = 0x80;
+
+ sbyte = *sptr++;
+ do {
+ if (sbyte & bit)
+ put6(pptr, a1, b1, c1, d1, e1, f1);
+ pptr += PIXEL_SIZE;
+ bit >>= 1;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -362,8 +361,8 @@ mem_true48_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true48_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -385,15 +384,15 @@ declare_mem_procs(mem48_word_copy_mono, mem48_word_copy_color, mem48_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true48_word_device =
mem_full_device("image48w", 48, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem48_word_copy_mono, mem48_word_copy_color, mem48_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem48_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -411,8 +410,8 @@ mem48_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem48_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -425,7 +424,7 @@ mem48_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x * 48, w * 48, h, store);
mem_true48_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x * 48, w * 48, h, false);
return 0;
}
@@ -433,8 +432,8 @@ mem48_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem48_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -445,7 +444,7 @@ mem48_word_copy_color(gx_device * dev,
raster = mdev->raster;
mem_swap_byte_rect(row, raster, x * 48, w * 48, h, true);
bytes_copy_rectangle(row + x * PIXEL_SIZE, raster, base + sourcex * PIXEL_SIZE,
- sraster, w * PIXEL_SIZE, h);
+ sraster, w * PIXEL_SIZE, h);
mem_swap_byte_rect(row, raster, x * 48, w * 48, h, false);
return 0;
}
diff --git a/gs/base/gdevm56.c b/gs/base/gdevm56.c
index 1b48c41b3..51d237056 100644
--- a/gs/base/gdevm56.c
+++ b/gs/base/gdevm56.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,8 +22,8 @@
#ifdef DEBUG
struct stats_mem56_s {
long
- fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
- fprevc[257];
+ fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
+ fprevc[257];
double ftotal;
} stats_mem56;
static int prev_count;
@@ -33,7 +33,6 @@ static gx_color_index prev_colors[256];
# define INCR(v) DO_NOTHING
#endif
-
/* ================ Standard (byte-oriented) device ================ */
#undef chunk
@@ -46,11 +45,11 @@ declare_mem_procs(mem_true56_copy_mono, mem_true56_copy_color, mem_true56_fill_r
/* The device descriptor. */
const gx_device_memory mem_true56_device =
mem_full_alpha_device("image56", 56, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true56_copy_mono, mem_true56_copy_color, mem_true56_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_copy_alpha,
- gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
- mem_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -58,50 +57,50 @@ mem_full_alpha_device("image56", 56, 0, mem_open,
/* Unpack a color into its bytes. */
#define declare_unpack_color(a, b, c, d, e, f, g, color)\
- byte a = (byte)((color >> 24) >> 24);\
- byte b = (byte)((color >> 24) >> 16);\
- byte c = (byte)((color >> 16) >> 16);\
- byte d = (byte)((uint)color >> 24);\
- byte e = (byte)((uint)color >> 16);\
- byte f = (byte)((uint)color >> 8);\
- byte g = (byte)color
+ byte a = (byte)((color >> 24) >> 24);\
+ byte b = (byte)((color >> 24) >> 16);\
+ byte c = (byte)((color >> 16) >> 16);\
+ byte d = (byte)((uint)color >> 24);\
+ byte e = (byte)((uint)color >> 16);\
+ byte f = (byte)((uint)color >> 8);\
+ byte g = (byte)color
/* Put a 56-bit color into the bitmap. */
#define put7(ptr, a, b, c, d, e, f, g)\
- (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e, \
- (ptr)[5] = f, (ptr)[6] = g
+ (ptr)[0] = a, (ptr)[1] = b, (ptr)[2] = c, (ptr)[3] = d, (ptr)[4] = e, \
+ (ptr)[5] = f, (ptr)[6] = g
/* Put 4 bytes of color into the bitmap. */
#define putw(ptr, wxyz)\
- *(bits32 *)(ptr) = (wxyz)
+ *(bits32 *)(ptr) = (wxyz)
/* Load the 7-word 56-bit-color cache. */
/* Free variables: [m]dev, abcd, bcde, cdea, deab, earc. */
#if arch_is_big_endian
# define set_color56_cache(color, a, b, c, d, e, f, g)\
- mdev->color56.abcd = abcd = (color) >> 24, \
- mdev->color56.bcde = bcde = (abcd << 8) | (e),\
- mdev->color56.cdef = cdef = (bcde << 8) | (f),\
- mdev->color56.defg = defg = (cdef << 8) | (g),\
- mdev->color56.efga = efga = (defg << 8) | (a),\
- mdev->color56.fgab = fgab = (efga << 8) | (b),\
- mdev->color56.gabc = gabc = (fgab << 8) | (c),\
- mdev->color56.abcdefg = (color)
+ mdev->color56.abcd = abcd = (color) >> 24, \
+ mdev->color56.bcde = bcde = (abcd << 8) | (e),\
+ mdev->color56.cdef = cdef = (bcde << 8) | (f),\
+ mdev->color56.defg = defg = (cdef << 8) | (g),\
+ mdev->color56.efga = efga = (defg << 8) | (a),\
+ mdev->color56.fgab = fgab = (efga << 8) | (b),\
+ mdev->color56.gabc = gabc = (fgab << 8) | (c),\
+ mdev->color56.abcdefg = (color)
#else
# define set_color56_cache(color, a, b, c, d, e, f, g)\
- mdev->color56.abcd = abcd =\
- ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
- ((bits16)(b) << 8) | (a),\
- mdev->color56.gabc = gabc = (abcd << 8) | (g),\
- mdev->color56.fgab = fgab = (gabc << 8) | (f),\
- mdev->color56.efga = efga = (fgab << 8) | (e),\
- mdev->color56.defg = defg = (efga << 8) | (d),\
- mdev->color56.cdef = cdef = (defg << 8) | (c),\
- mdev->color56.bcde = bcde = (cdef << 8) | (b),\
- mdev->color56.abcdefg = (color)
+ mdev->color56.abcd = abcd =\
+ ((bits32)(d) << 24) | ((bits32)(c) << 16) |\
+ ((bits16)(b) << 8) | (a),\
+ mdev->color56.gabc = gabc = (abcd << 8) | (g),\
+ mdev->color56.fgab = fgab = (gabc << 8) | (f),\
+ mdev->color56.efga = efga = (fgab << 8) | (e),\
+ mdev->color56.defg = defg = (efga << 8) | (d),\
+ mdev->color56.cdef = cdef = (defg << 8) | (c),\
+ mdev->color56.bcde = bcde = (cdef << 8) | (b),\
+ mdev->color56.abcdefg = (color)
#endif
/* Fill a rectangle with a color. */
static int
mem_true56_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
declare_unpack_color(a, b, c, d, e, f, g, color);
@@ -118,181 +117,181 @@ mem_true56_fill_rectangle(gx_device * dev,
stats_mem56.ftotal += w;
#endif
if (w >= 5) {
- if (h <= 0)
- return 0;
- INCR(fwide);
- setup_rect(dest);
- if (a == b && b == c && c == d && d == e && e == f && f == g) {
- int bcnt = w * PIXEL_SIZE;
-
- INCR(fgray[min(w, 100)]);
- while (h-- > 0) {
- memset(dest, a, bcnt);
- inc_ptr(dest, draster);
- }
- } else {
- int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
- bits32 abcd, bcde, cdef, defg, efga, fgab, gabc;
-
- if (mdev->color56.abcdefg == color) {
- abcd = mdev->color56.abcd;
- bcde = mdev->color56.bcde;
- cdef = mdev->color56.cdef;
- defg = mdev->color56.defg;
- efga = mdev->color56.efga;
- fgab = mdev->color56.fgab;
- gabc = mdev->color56.gabc;
- } else {
- INCR(fsetc);
- set_color56_cache(color, a, b, c, d, e, f, g);
- }
+ if (h <= 0)
+ return 0;
+ INCR(fwide);
+ setup_rect(dest);
+ if (a == b && b == c && c == d && d == e && e == f && f == g) {
+ int bcnt = w * PIXEL_SIZE;
+
+ INCR(fgray[min(w, 100)]);
+ while (h-- > 0) {
+ memset(dest, a, bcnt);
+ inc_ptr(dest, draster);
+ }
+ } else {
+ int x3 = -x & 3, ww = w - x3; /* we know ww >= 2 */
+ bits32 abcd, bcde, cdef, defg, efga, fgab, gabc;
+
+ if (mdev->color56.abcdefg == color) {
+ abcd = mdev->color56.abcd;
+ bcde = mdev->color56.bcde;
+ cdef = mdev->color56.cdef;
+ defg = mdev->color56.defg;
+ efga = mdev->color56.efga;
+ fgab = mdev->color56.fgab;
+ gabc = mdev->color56.gabc;
+ } else {
+ INCR(fsetc);
+ set_color56_cache(color, a, b, c, d, e, f, g);
+ }
#ifdef DEBUG
- {
- int ci;
- for (ci = 0; ci < prev_count; ++ci)
- if (prev_colors[ci] == color)
- break;
- INCR(fprevc[ci]);
- if (ci == prev_count) {
- if (ci < countof(prev_colors))
- ++prev_count;
- else
- --ci;
- }
- if (ci) {
- memmove(&prev_colors[1], &prev_colors[0],
- ci * sizeof(prev_colors[0]));
- prev_colors[0] = color;
- }
- }
+ {
+ int ci;
+ for (ci = 0; ci < prev_count; ++ci)
+ if (prev_colors[ci] == color)
+ break;
+ INCR(fprevc[ci]);
+ if (ci == prev_count) {
+ if (ci < countof(prev_colors))
+ ++prev_count;
+ else
+ --ci;
+ }
+ if (ci) {
+ memmove(&prev_colors[1], &prev_colors[0],
+ ci * sizeof(prev_colors[0]));
+ prev_colors[0] = color;
+ }
+ }
#endif
- INCR(fcolor[min(w, 100)]);
- while (h-- > 0) {
- register byte *pptr = dest;
- int w1 = ww;
-
- switch (x3) {
- case 1:
- pptr[0] = a;
- pptr[1] = b;
- pptr[2] = c;
- putw(pptr + 3, defg);
- pptr += PIXEL_SIZE;
- break;
- case 2:
- pptr[0] = a;
- pptr[1] = b;
- putw(pptr + 2, cdef);
- putw(pptr + 6, gabc);
- putw(pptr + 10, defg);
- pptr += 2 * PIXEL_SIZE;
- break;
- case 3:
- pptr[0] = a;
- putw(pptr + 1, bcde);
- putw(pptr + 5, fgab);
- putw(pptr + 9, cdef);
- putw(pptr + 13, gabc);
- putw(pptr + 17, defg);
- pptr += 3 * PIXEL_SIZE;
- break;
- case 0:
- ;
- }
- while (w1 >= 4) {
- putw(pptr, abcd);
- putw(pptr + 4, efga);
- putw(pptr + 8, bcde);
- putw(pptr + 12, fgab);
- putw(pptr + 16, cdef);
- putw(pptr + 20, gabc);
- putw(pptr + 24, defg);
- pptr += 4 * PIXEL_SIZE;
- w1 -= 4;
- }
- switch (w1) {
- case 1:
- putw(pptr, abcd);
- pptr[4] = e;
- pptr[5] = f;
- pptr[6] = g;
- break;
- case 2:
- putw(pptr, abcd);
- putw(pptr + 4, efga);
- putw(pptr + 8, bcde);
- pptr[12] = f;
- pptr[13] = g;
- break;
- case 3:
- putw(pptr, abcd);
- putw(pptr + 4, efga);
- putw(pptr + 8, bcde);
- putw(pptr + 12, fgab);
- putw(pptr + 16, cdef);
- pptr[20] = g;
- break;
- case 0:
- ;
- }
- inc_ptr(dest, draster);
- }
- }
+ INCR(fcolor[min(w, 100)]);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ int w1 = ww;
+
+ switch (x3) {
+ case 1:
+ pptr[0] = a;
+ pptr[1] = b;
+ pptr[2] = c;
+ putw(pptr + 3, defg);
+ pptr += PIXEL_SIZE;
+ break;
+ case 2:
+ pptr[0] = a;
+ pptr[1] = b;
+ putw(pptr + 2, cdef);
+ putw(pptr + 6, gabc);
+ putw(pptr + 10, defg);
+ pptr += 2 * PIXEL_SIZE;
+ break;
+ case 3:
+ pptr[0] = a;
+ putw(pptr + 1, bcde);
+ putw(pptr + 5, fgab);
+ putw(pptr + 9, cdef);
+ putw(pptr + 13, gabc);
+ putw(pptr + 17, defg);
+ pptr += 3 * PIXEL_SIZE;
+ break;
+ case 0:
+ ;
+ }
+ while (w1 >= 4) {
+ putw(pptr, abcd);
+ putw(pptr + 4, efga);
+ putw(pptr + 8, bcde);
+ putw(pptr + 12, fgab);
+ putw(pptr + 16, cdef);
+ putw(pptr + 20, gabc);
+ putw(pptr + 24, defg);
+ pptr += 4 * PIXEL_SIZE;
+ w1 -= 4;
+ }
+ switch (w1) {
+ case 1:
+ putw(pptr, abcd);
+ pptr[4] = e;
+ pptr[5] = f;
+ pptr[6] = g;
+ break;
+ case 2:
+ putw(pptr, abcd);
+ putw(pptr + 4, efga);
+ putw(pptr + 8, bcde);
+ pptr[12] = f;
+ pptr[13] = g;
+ break;
+ case 3:
+ putw(pptr, abcd);
+ putw(pptr + 4, efga);
+ putw(pptr + 8, bcde);
+ putw(pptr + 12, fgab);
+ putw(pptr + 16, cdef);
+ pptr[20] = g;
+ break;
+ case 0:
+ ;
+ }
+ inc_ptr(dest, draster);
+ }
+ }
} else if (h > 0) { /* w < 5 */
- INCR(fnarrow[max(w, 0)]);
- setup_rect(dest);
- switch (w) {
- case 4:
- do {
- dest[21] = dest[14] = dest[7] = dest[0] = a;
- dest[22] = dest[15] = dest[8] = dest[1] = b;
- dest[23] = dest[16] = dest[9] = dest[2] = c;
- dest[24] = dest[17] = dest[10] = dest[3] = d;
- dest[25] = dest[18] = dest[11] = dest[4] = e;
- dest[26] = dest[19] = dest[12] = dest[5] = f;
- dest[27] = dest[20] = dest[13] = dest[6] = g;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 3:
- do {
- dest[14] = dest[7] = dest[0] = a;
- dest[15] = dest[8] = dest[1] = b;
- dest[16] = dest[9] = dest[2] = c;
- dest[17] = dest[10] = dest[3] = d;
- dest[18] = dest[11] = dest[4] = e;
- dest[19] = dest[12] = dest[5] = f;
- dest[20] = dest[13] = dest[6] = g;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 2:
- do {
- dest[7] = dest[0] = a;
- dest[8] = dest[1] = b;
- dest[9] = dest[2] = c;
- dest[10] = dest[3] = d;
- dest[11] = dest[4] = e;
- dest[12] = dest[5] = f;
- dest[13] = dest[6] = g;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 1:
- do {
- dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d;
- dest[4] = e; dest[5] = f; dest[6] = g;
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 0:
- default:
- ;
- }
+ INCR(fnarrow[max(w, 0)]);
+ setup_rect(dest);
+ switch (w) {
+ case 4:
+ do {
+ dest[21] = dest[14] = dest[7] = dest[0] = a;
+ dest[22] = dest[15] = dest[8] = dest[1] = b;
+ dest[23] = dest[16] = dest[9] = dest[2] = c;
+ dest[24] = dest[17] = dest[10] = dest[3] = d;
+ dest[25] = dest[18] = dest[11] = dest[4] = e;
+ dest[26] = dest[19] = dest[12] = dest[5] = f;
+ dest[27] = dest[20] = dest[13] = dest[6] = g;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 3:
+ do {
+ dest[14] = dest[7] = dest[0] = a;
+ dest[15] = dest[8] = dest[1] = b;
+ dest[16] = dest[9] = dest[2] = c;
+ dest[17] = dest[10] = dest[3] = d;
+ dest[18] = dest[11] = dest[4] = e;
+ dest[19] = dest[12] = dest[5] = f;
+ dest[20] = dest[13] = dest[6] = g;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 2:
+ do {
+ dest[7] = dest[0] = a;
+ dest[8] = dest[1] = b;
+ dest[9] = dest[2] = c;
+ dest[10] = dest[3] = d;
+ dest[11] = dest[4] = e;
+ dest[12] = dest[5] = f;
+ dest[13] = dest[6] = g;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 1:
+ do {
+ dest[0] = a; dest[1] = b; dest[2] = c; dest[3] = d;
+ dest[4] = e; dest[5] = f; dest[6] = g;
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 0:
+ default:
+ ;
+ }
}
return 0;
}
@@ -300,8 +299,8 @@ mem_true56_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true56_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -316,100 +315,100 @@ mem_true56_copy_mono(gx_device * dev,
sbit = sourcex & 7;
first_bit = 0x80 >> sbit;
if (zero != gx_no_color_index) { /* Loop for halftones or inverted masks */
- /* (never used). */
- declare_unpack_color(a0, b0, c0, d0, e0, f0, g0, zero);
- declare_unpack_color(a1, b1, c1, d1, e1, f1, g1, one);
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- put7(pptr, a1, b1, c1, d1, e1, f1, g1);
- } else
- put7(pptr, a0, b0, c0, d0, e0, f0, g0);
- pptr += PIXEL_SIZE;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* (never used). */
+ declare_unpack_color(a0, b0, c0, d0, e0, f0, g0, zero);
+ declare_unpack_color(a1, b1, c1, d1, e1, f1, g1, one);
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ put7(pptr, a1, b1, c1, d1, e1, f1, g1);
+ } else
+ put7(pptr, a0, b0, c0, d0, e0, f0, g0);
+ pptr += PIXEL_SIZE;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else if (one != gx_no_color_index) { /* Loop for character and pattern masks. */
- /* This is used heavily. */
- declare_unpack_color(a1, b1, c1, d1, e1, f1, g1, one);
- int first_mask = first_bit << 1;
- int first_count, first_skip;
-
- if (sbit + w > 8)
- first_mask -= 1,
- first_count = 8 - sbit;
- else
- first_mask -= first_mask >> w,
- first_count = w;
- first_skip = first_count * PIXEL_SIZE;
- while (h-- > 0) {
- register byte *pptr = dest;
- const byte *sptr = line;
- register int sbyte = *sptr++ & first_mask;
- int count = w - first_count;
-
- if (sbyte) {
- register int bit = first_bit;
-
- do {
- if (sbyte & bit)
- put7(pptr, a1, b1, c1, d1, e1, f1, g1);
- pptr += PIXEL_SIZE;
- }
- while ((bit >>= 1) & first_mask);
- } else
- pptr += first_skip;
- while (count >= 8) {
- sbyte = *sptr++;
- if (sbyte & 0xf0) {
- if (sbyte & 0x80)
- put7(pptr, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 0x40)
- put7(pptr + 7, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 0x20)
- put7(pptr + 14, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 0x10)
- put7(pptr + 21, a1, b1, c1, d1, e1, f1, g1);
- }
- if (sbyte & 0xf) {
- if (sbyte & 8)
- put7(pptr + 28, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 4)
- put7(pptr + 35, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 2)
- put7(pptr + 42, a1, b1, c1, d1, e1, f1, g1);
- if (sbyte & 1)
- put7(pptr + 49, a1, b1, c1, d1, e1, f1, g1);
- }
- pptr += 8 * PIXEL_SIZE;
- count -= 8;
- }
- if (count > 0) {
- register int bit = 0x80;
-
- sbyte = *sptr++;
- do {
- if (sbyte & bit)
- put7(pptr, a1, b1, c1, d1, e1, f1, g1);
- pptr += PIXEL_SIZE;
- bit >>= 1;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* This is used heavily. */
+ declare_unpack_color(a1, b1, c1, d1, e1, f1, g1, one);
+ int first_mask = first_bit << 1;
+ int first_count, first_skip;
+
+ if (sbit + w > 8)
+ first_mask -= 1,
+ first_count = 8 - sbit;
+ else
+ first_mask -= first_mask >> w,
+ first_count = w;
+ first_skip = first_count * PIXEL_SIZE;
+ while (h-- > 0) {
+ register byte *pptr = dest;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ & first_mask;
+ int count = w - first_count;
+
+ if (sbyte) {
+ register int bit = first_bit;
+
+ do {
+ if (sbyte & bit)
+ put7(pptr, a1, b1, c1, d1, e1, f1, g1);
+ pptr += PIXEL_SIZE;
+ }
+ while ((bit >>= 1) & first_mask);
+ } else
+ pptr += first_skip;
+ while (count >= 8) {
+ sbyte = *sptr++;
+ if (sbyte & 0xf0) {
+ if (sbyte & 0x80)
+ put7(pptr, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 0x40)
+ put7(pptr + 7, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 0x20)
+ put7(pptr + 14, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 0x10)
+ put7(pptr + 21, a1, b1, c1, d1, e1, f1, g1);
+ }
+ if (sbyte & 0xf) {
+ if (sbyte & 8)
+ put7(pptr + 28, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 4)
+ put7(pptr + 35, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 2)
+ put7(pptr + 42, a1, b1, c1, d1, e1, f1, g1);
+ if (sbyte & 1)
+ put7(pptr + 49, a1, b1, c1, d1, e1, f1, g1);
+ }
+ pptr += 8 * PIXEL_SIZE;
+ count -= 8;
+ }
+ if (count > 0) {
+ register int bit = 0x80;
+
+ sbyte = *sptr++;
+ do {
+ if (sbyte & bit)
+ put7(pptr, a1, b1, c1, d1, e1, f1, g1);
+ pptr += PIXEL_SIZE;
+ bit >>= 1;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -417,8 +416,8 @@ mem_true56_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true56_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -440,15 +439,15 @@ declare_mem_procs(mem56_word_copy_mono, mem56_word_copy_color, mem56_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true56_word_device =
mem_full_device("image56w", 56, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem56_word_copy_mono, mem56_word_copy_color, mem56_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem56_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -466,8 +465,8 @@ mem56_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem56_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -480,7 +479,7 @@ mem56_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x * 56, w * 56, h, store);
mem_true56_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x * 56, w * 56, h, false);
return 0;
}
@@ -488,8 +487,8 @@ mem56_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem56_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -500,7 +499,7 @@ mem56_word_copy_color(gx_device * dev,
raster = mdev->raster;
mem_swap_byte_rect(row, raster, x * 56, w * 56, h, true);
bytes_copy_rectangle(row + x * PIXEL_SIZE, raster, base + sourcex * PIXEL_SIZE,
- sraster, w * PIXEL_SIZE, h);
+ sraster, w * PIXEL_SIZE, h);
mem_swap_byte_rect(row, raster, x * 56, w * 56, h, false);
return 0;
}
diff --git a/gs/base/gdevm64.c b/gs/base/gdevm64.c
index fe1fb7f61..a913f99e7 100644
--- a/gs/base/gdevm64.c
+++ b/gs/base/gdevm64.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,8 +22,8 @@
#ifdef DEBUG
struct stats_mem64_s {
long
- fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
- fprevc[257];
+ fill, fwide, fgray[101], fsetc, fcolor[101], fnarrow[5],
+ fprevc[257];
double ftotal;
} stats_mem64;
static int prev_count = 0;
@@ -33,7 +33,6 @@ static gx_color_index prev_colors[256];
# define INCR(v) DO_NOTHING
#endif
-
/* ================ Standard (byte-oriented) device ================ */
#undef chunk
@@ -46,11 +45,11 @@ declare_mem_procs(mem_true64_copy_mono, mem_true64_copy_color, mem_true64_fill_r
/* The device descriptor. */
const gx_device_memory mem_true64_device =
mem_full_alpha_device("image64", 64, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true64_copy_mono, mem_true64_copy_color, mem_true64_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_copy_alpha,
- gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
- mem_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_default_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -58,31 +57,31 @@ mem_full_alpha_device("image64", 64, 0, mem_open,
/* Put a 64-bit color into the bitmap. */
#define put8(ptr, abcd, efgh)\
- (ptr)[0] = abcd, (ptr)[1] = efgh
+ (ptr)[0] = abcd, (ptr)[1] = efgh
/* Free variables: [m]dev, abcd, degh. */
#if arch_is_big_endian
/* Unpack a color into 32 bit chunks. */
# define declare_unpack_color(abcd, efgh, color)\
- bits32 abcd = (bits32)((color) >> 32);\
- bits32 efgh = (bits32)(color)
+ bits32 abcd = (bits32)((color) >> 32);\
+ bits32 efgh = (bits32)(color)
#else
/* Unpack a color into 32 bit chunks. */
# define declare_unpack_color(abcd, efgh, color)\
- bits32 abcd = (bits32)((0x000000ff & (((color) >> 28) >> 28)) |\
- (0x0000ff00 & (((color) >> 24) >> 16)) |\
- (0x00ff0000 & ((color) >> 24)) |\
- (0xff000000 & ((color) >> 8)));\
- bits32 efgh = (bits32)((0x000000ff & ((color) >> 24)) |\
- (0x0000ff00 & ((color) >> 8)) |\
- (0x00ff0000 & ((color) << 8)) |\
- (0xff000000 & ((color) << 24)))
+ bits32 abcd = (bits32)((0x000000ff & (((color) >> 28) >> 28)) |\
+ (0x0000ff00 & (((color) >> 24) >> 16)) |\
+ (0x00ff0000 & ((color) >> 24)) |\
+ (0xff000000 & ((color) >> 8)));\
+ bits32 efgh = (bits32)((0x000000ff & ((color) >> 24)) |\
+ (0x0000ff00 & ((color) >> 8)) |\
+ (0x00ff0000 & ((color) << 8)) |\
+ (0xff000000 & ((color) << 24)))
#endif
#define dest32 ((bits32 *)dest)
/* Fill a rectangle with a color. */
static int
mem_true64_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
declare_scan_ptr(dest);
@@ -99,103 +98,103 @@ mem_true64_fill_rectangle(gx_device * dev,
stats_mem64.ftotal += w;
#endif
if (h <= 0)
- return 0;
+ return 0;
if (w >= 5) {
- INCR(fwide);
- setup_rect(dest);
+ INCR(fwide);
+ setup_rect(dest);
#ifdef DEBUG
- {
- int ci;
- for (ci = 0; ci < prev_count; ++ci)
- if (prev_colors[ci] == color)
- break;
- INCR(fprevc[ci]);
- if (ci == prev_count) {
- if (ci < countof(prev_colors))
- ++prev_count;
- else
- --ci;
- }
- if (ci) {
- memmove(&prev_colors[1], &prev_colors[0],
- ci * sizeof(prev_colors[0]));
- prev_colors[0] = color;
- }
- }
+ {
+ int ci;
+ for (ci = 0; ci < prev_count; ++ci)
+ if (prev_colors[ci] == color)
+ break;
+ INCR(fprevc[ci]);
+ if (ci == prev_count) {
+ if (ci < countof(prev_colors))
+ ++prev_count;
+ else
+ --ci;
+ }
+ if (ci) {
+ memmove(&prev_colors[1], &prev_colors[0],
+ ci * sizeof(prev_colors[0]));
+ prev_colors[0] = color;
+ }
+ }
#endif
- INCR(fcolor[min(w, 100)]);
- while (h-- > 0) {
- register bits32 *pptr = dest32;
- int w1 = w;
-
- while (w1 >= 4) {
- put8(pptr, abcd, efgh);
- put8(pptr + 2, abcd, efgh);
- put8(pptr + 4, abcd, efgh);
- put8(pptr + 6, abcd, efgh);
- pptr += 4 * PIXEL_SIZE;
- w1 -= 4;
- }
- switch (w1) {
- case 1:
- put8(pptr, abcd, efgh);
- break;
- case 2:
- put8(pptr, abcd, efgh);
- put8(pptr + 2, abcd, efgh);
- break;
- case 3:
- put8(pptr, abcd, efgh);
- put8(pptr + 2, abcd, efgh);
- put8(pptr + 4, abcd, efgh);
- break;
- case 0:
- ;
- }
- inc_ptr(dest, draster);
- }
+ INCR(fcolor[min(w, 100)]);
+ while (h-- > 0) {
+ register bits32 *pptr = dest32;
+ int w1 = w;
+
+ while (w1 >= 4) {
+ put8(pptr, abcd, efgh);
+ put8(pptr + 2, abcd, efgh);
+ put8(pptr + 4, abcd, efgh);
+ put8(pptr + 6, abcd, efgh);
+ pptr += 4 * PIXEL_SIZE;
+ w1 -= 4;
+ }
+ switch (w1) {
+ case 1:
+ put8(pptr, abcd, efgh);
+ break;
+ case 2:
+ put8(pptr, abcd, efgh);
+ put8(pptr + 2, abcd, efgh);
+ break;
+ case 3:
+ put8(pptr, abcd, efgh);
+ put8(pptr + 2, abcd, efgh);
+ put8(pptr + 4, abcd, efgh);
+ break;
+ case 0:
+ ;
+ }
+ inc_ptr(dest, draster);
+ }
} else { /* w < 5 */
- INCR(fnarrow[max(w, 0)]);
- setup_rect(dest);
- switch (w) {
- case 4:
- do {
- put8(dest32, abcd, efgh);
- put8(dest32 + 2, abcd, efgh);
- put8(dest32 + 4, abcd, efgh);
- put8(dest32 + 6, abcd, efgh);
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 3:
- do {
- put8(dest32, abcd, efgh);
- put8(dest32 + 2, abcd, efgh);
- put8(dest32 + 4, abcd, efgh);
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 2:
- do {
- put8(dest32, abcd, efgh);
- put8(dest32 + 2, abcd, efgh);
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 1:
- do {
- put8(dest32, abcd, efgh);
- inc_ptr(dest, draster);
- }
- while (--h);
- break;
- case 0:
- default:
- ;
- }
+ INCR(fnarrow[max(w, 0)]);
+ setup_rect(dest);
+ switch (w) {
+ case 4:
+ do {
+ put8(dest32, abcd, efgh);
+ put8(dest32 + 2, abcd, efgh);
+ put8(dest32 + 4, abcd, efgh);
+ put8(dest32 + 6, abcd, efgh);
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 3:
+ do {
+ put8(dest32, abcd, efgh);
+ put8(dest32 + 2, abcd, efgh);
+ put8(dest32 + 4, abcd, efgh);
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 2:
+ do {
+ put8(dest32, abcd, efgh);
+ put8(dest32 + 2, abcd, efgh);
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 1:
+ do {
+ put8(dest32, abcd, efgh);
+ inc_ptr(dest, draster);
+ }
+ while (--h);
+ break;
+ case 0:
+ default:
+ ;
+ }
}
return 0;
}
@@ -203,8 +202,8 @@ mem_true64_fill_rectangle(gx_device * dev,
/* Copy a monochrome bitmap. */
static int
mem_true64_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *line;
@@ -219,100 +218,100 @@ mem_true64_copy_mono(gx_device * dev,
sbit = sourcex & 7;
first_bit = 0x80 >> sbit;
if (zero != gx_no_color_index) { /* Loop for halftones or inverted masks */
- /* (never used). */
- declare_unpack_color(abcd0, efgh0, zero);
- declare_unpack_color(abcd1, efgh1, one);
- while (h-- > 0) {
- register bits32 *pptr = dest32;
- const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- int count = w;
-
- do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- put8(pptr, abcd1, efgh1);
- } else
- put8(pptr, abcd0, efgh0);
- pptr += PIXEL_SIZE;
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- }
- while (--count > 0);
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* (never used). */
+ declare_unpack_color(abcd0, efgh0, zero);
+ declare_unpack_color(abcd1, efgh1, one);
+ while (h-- > 0) {
+ register bits32 *pptr = dest32;
+ const byte *sptr = line;
+ register int sbyte = *sptr++;
+ register int bit = first_bit;
+ int count = w;
+
+ do {
+ if (sbyte & bit) {
+ if (one != gx_no_color_index)
+ put8(pptr, abcd1, efgh1);
+ } else
+ put8(pptr, abcd0, efgh0);
+ pptr += PIXEL_SIZE;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, sbyte = *sptr++;
+ }
+ while (--count > 0);
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
} else if (one != gx_no_color_index) { /* Loop for character and pattern masks. */
- /* This is used heavily. */
- declare_unpack_color(abcd1, efgh1, one);
- int first_mask = first_bit << 1;
- int first_count, first_skip;
-
- if (sbit + w > 8)
- first_mask -= 1,
- first_count = 8 - sbit;
- else
- first_mask -= first_mask >> w,
- first_count = w;
- first_skip = first_count * PIXEL_SIZE;
- while (h-- > 0) {
- register bits32 *pptr = dest32;
- const byte *sptr = line;
- register int sbyte = *sptr++ & first_mask;
- int count = w - first_count;
-
- if (sbyte) {
- register int bit = first_bit;
-
- do {
- if (sbyte & bit)
- put8(pptr, abcd1, efgh1);
- pptr += PIXEL_SIZE;
- }
- while ((bit >>= 1) & first_mask);
- } else
- pptr += first_skip;
- while (count >= 8) {
- sbyte = *sptr++;
- if (sbyte & 0xf0) {
- if (sbyte & 0x80)
- put8(pptr, abcd1, efgh1);
- if (sbyte & 0x40)
- put8(pptr + 2, abcd1, efgh1);
- if (sbyte & 0x20)
- put8(pptr + 4, abcd1, efgh1);
- if (sbyte & 0x10)
- put8(pptr + 6, abcd1, efgh1);
- }
- if (sbyte & 0xf) {
- if (sbyte & 8)
- put8(pptr + 8, abcd1, efgh1);
- if (sbyte & 4)
- put8(pptr + 10, abcd1, efgh1);
- if (sbyte & 2)
- put8(pptr + 12, abcd1, efgh1);
- if (sbyte & 1)
- put8(pptr + 14, abcd1, efgh1);
- }
- pptr += 8 * PIXEL_SIZE;
- count -= 8;
- }
- if (count > 0) {
- register int bit = 0x80;
-
- sbyte = *sptr++;
- do {
- if (sbyte & bit)
- put8(pptr, abcd1, efgh1);
- pptr += PIXEL_SIZE;
- bit >>= 1;
- }
- while (--count > 0);
- }
- line += sraster;
- inc_ptr(dest, draster);
- }
+ /* This is used heavily. */
+ declare_unpack_color(abcd1, efgh1, one);
+ int first_mask = first_bit << 1;
+ int first_count, first_skip;
+
+ if (sbit + w > 8)
+ first_mask -= 1,
+ first_count = 8 - sbit;
+ else
+ first_mask -= first_mask >> w,
+ first_count = w;
+ first_skip = first_count * PIXEL_SIZE;
+ while (h-- > 0) {
+ register bits32 *pptr = dest32;
+ const byte *sptr = line;
+ register int sbyte = *sptr++ & first_mask;
+ int count = w - first_count;
+
+ if (sbyte) {
+ register int bit = first_bit;
+
+ do {
+ if (sbyte & bit)
+ put8(pptr, abcd1, efgh1);
+ pptr += PIXEL_SIZE;
+ }
+ while ((bit >>= 1) & first_mask);
+ } else
+ pptr += first_skip;
+ while (count >= 8) {
+ sbyte = *sptr++;
+ if (sbyte & 0xf0) {
+ if (sbyte & 0x80)
+ put8(pptr, abcd1, efgh1);
+ if (sbyte & 0x40)
+ put8(pptr + 2, abcd1, efgh1);
+ if (sbyte & 0x20)
+ put8(pptr + 4, abcd1, efgh1);
+ if (sbyte & 0x10)
+ put8(pptr + 6, abcd1, efgh1);
+ }
+ if (sbyte & 0xf) {
+ if (sbyte & 8)
+ put8(pptr + 8, abcd1, efgh1);
+ if (sbyte & 4)
+ put8(pptr + 10, abcd1, efgh1);
+ if (sbyte & 2)
+ put8(pptr + 12, abcd1, efgh1);
+ if (sbyte & 1)
+ put8(pptr + 14, abcd1, efgh1);
+ }
+ pptr += 8 * PIXEL_SIZE;
+ count -= 8;
+ }
+ if (count > 0) {
+ register int bit = 0x80;
+
+ sbyte = *sptr++;
+ do {
+ if (sbyte & bit)
+ put8(pptr, abcd1, efgh1);
+ pptr += PIXEL_SIZE;
+ bit >>= 1;
+ }
+ while (--count > 0);
+ }
+ line += sraster;
+ inc_ptr(dest, draster);
+ }
}
return 0;
}
@@ -320,8 +319,8 @@ mem_true64_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem_true64_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
@@ -343,15 +342,15 @@ declare_mem_procs(mem64_word_copy_mono, mem64_word_copy_color, mem64_word_fill_r
/* Here is the device descriptor. */
const gx_device_memory mem_true64_word_device =
mem_full_device("image64w", 64, 0, mem_open,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem64_word_copy_mono, mem64_word_copy_color, mem64_word_fill_rectangle,
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
- gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
static int
mem64_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *base;
@@ -369,8 +368,8 @@ mem64_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
static int
mem64_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -383,7 +382,7 @@ mem64_word_copy_mono(gx_device * dev,
store = (zero != gx_no_color_index && one != gx_no_color_index);
mem_swap_byte_rect(row, raster, x * 64, w * 64, h, store);
mem_true64_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
mem_swap_byte_rect(row, raster, x * 64, w * 64, h, false);
return 0;
}
@@ -391,8 +390,8 @@ mem64_word_copy_mono(gx_device * dev,
/* Copy a color bitmap. */
static int
mem64_word_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *row;
@@ -403,7 +402,7 @@ mem64_word_copy_color(gx_device * dev,
raster = mdev->raster;
mem_swap_byte_rect(row, raster, x * 64, w * 64, h, true);
bytes_copy_rectangle(row + x * PIXEL_SIZE, raster, base + sourcex * PIXEL_SIZE,
- sraster, w * PIXEL_SIZE, h);
+ sraster, w * PIXEL_SIZE, h);
mem_swap_byte_rect(row, raster, x * 64, w * 64, h, false);
return 0;
}
diff --git a/gs/base/gdevmac.c b/gs/base/gdevmac.c
index 2366bc928..dfa184db2 100644
--- a/gs/base/gdevmac.c
+++ b/gs/base/gdevmac.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,698 +15,659 @@
/* MacOS bitmap output device. This code is superceeded by
the newer gsapi_* interface and the DISPLAY device. Please
use that instead. See doc/API.htm for more information */
-
+
#include "gdevmac.h"
#include "gsparam.h"
#include "gsdll.h"
-
-
/* The device descriptor */
gx_device_procs gs_mac_procs = {
- mac_open, /* open_device */
- mac_get_initial_matrix, /* get_initial_matrix */
- mac_sync_output, /* sync_output */
- mac_output_page, /* output_page */
- mac_close, /* close_device */
- gx_default_rgb_map_rgb_color, /* map_rgb_color */
- gx_default_rgb_map_color_rgb, /* map_color_rgb */
- mac_fill_rectangle, /* fill_rectangle */
- NULL, /* tile_rectangle */
- mac_copy_mono, /* copy_mono */
- NULL,// mac_copy_color, /* copy_color */
- mac_draw_line, /* draw_line */
- NULL, /* get_bits */
- mac_get_params, /* get_params */
- mac_put_params, /* put_params */
- NULL, /* map_cmyk_color */
- mac_get_xfont_procs, /* get_xfont_procs */
- NULL, /* get_xfont_device */
- NULL, /* map_rgb_alpha_color */
- gx_page_device_get_page_device, /* get_page_device */
- gx_default_get_alpha_bits, /* get_alpha_bits */
- mac_copy_alpha, /* copy_alpha */
- NULL, /* get_band */
- NULL, /* copy_rop */
- NULL, /* fill_path */
- NULL, /* stroke_path */
- NULL, /* fill_mask */
- NULL, /* fill_trapezoid */
- NULL, /* fill_parallelogram */
- NULL, /* fill_triangle */
- NULL, /* draw_thin_line */
- NULL, /* begin_image */
- NULL, /* image_data */
- NULL, /* end_image */
- NULL //mac_strip_tile_rectangle /* strip_tile_rectangle */
+ mac_open, /* open_device */
+ mac_get_initial_matrix, /* get_initial_matrix */
+ mac_sync_output, /* sync_output */
+ mac_output_page, /* output_page */
+ mac_close, /* close_device */
+ gx_default_rgb_map_rgb_color, /* map_rgb_color */
+ gx_default_rgb_map_color_rgb, /* map_color_rgb */
+ mac_fill_rectangle, /* fill_rectangle */
+ NULL, /* tile_rectangle */
+ mac_copy_mono, /* copy_mono */
+ NULL,// mac_copy_color, /* copy_color */
+ mac_draw_line, /* draw_line */
+ NULL, /* get_bits */
+ mac_get_params, /* get_params */
+ mac_put_params, /* put_params */
+ NULL, /* map_cmyk_color */
+ mac_get_xfont_procs, /* get_xfont_procs */
+ NULL, /* get_xfont_device */
+ NULL, /* map_rgb_alpha_color */
+ gx_page_device_get_page_device, /* get_page_device */
+ gx_default_get_alpha_bits, /* get_alpha_bits */
+ mac_copy_alpha, /* copy_alpha */
+ NULL, /* get_band */
+ NULL, /* copy_rop */
+ NULL, /* fill_path */
+ NULL, /* stroke_path */
+ NULL, /* fill_mask */
+ NULL, /* fill_trapezoid */
+ NULL, /* fill_parallelogram */
+ NULL, /* fill_triangle */
+ NULL, /* draw_thin_line */
+ NULL, /* begin_image */
+ NULL, /* image_data */
+ NULL, /* end_image */
+ NULL //mac_strip_tile_rectangle /* strip_tile_rectangle */
};
-
-
/* The instance is public. */
gx_device_macos gs_macos_device = {
- std_device_color_body(gx_device_macos,
- &gs_mac_procs,
- DEV_MAC_NAME,
- DEFAULT_DEV_WIDTH, /* x and y extent (nominal) */
- DEFAULT_DEV_HEIGHT,
- DEFAULT_DEV_DPI, /* x and y density (nominal) */
- DEFAULT_DEV_DPI,
- /*dci_color(*/8, 255, 256/*)*/),
- { 0 }, /* std_procs */
- "", /* Output Filename */
- NULL, /* Output File */
- NULL, /* PicHandle to "draw" into */
- NULL, /* PicPtr */
- false, /* outputPage */
- false, /* use XFont interface (render with local TrueType fonts) */
- -1, /* lastFontFace */
- -1, /* lastFontSize */
- -1, /* lastFontID */
- 0 /* numUsedFonts */
+ std_device_color_body(gx_device_macos,
+ &gs_mac_procs,
+ DEV_MAC_NAME,
+ DEFAULT_DEV_WIDTH, /* x and y extent (nominal) */
+ DEFAULT_DEV_HEIGHT,
+ DEFAULT_DEV_DPI, /* x and y density (nominal) */
+ DEFAULT_DEV_DPI,
+ /*dci_color(*/8, 255, 256/*)*/),
+ { 0 }, /* std_procs */
+ "", /* Output Filename */
+ NULL, /* Output File */
+ NULL, /* PicHandle to "draw" into */
+ NULL, /* PicPtr */
+ false, /* outputPage */
+ false, /* use XFont interface (render with local TrueType fonts) */
+ -1, /* lastFontFace */
+ -1, /* lastFontSize */
+ -1, /* lastFontID */
+ 0 /* numUsedFonts */
};
+static int
+mac_open(register gx_device *dev)
+{
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ static short picHeader[42] = { 0x0000, // picture size
+ 0x0000, 0x0000, 0x0318, 0x0264, // bounding rect at 72dpi
+ 0x0011, 0x02ff, 0x0c00, 0xfffe, 0x0000, // version/header opcodes
+ 0x0048, 0x0000, // best x resolution
+ 0x0048, 0x0000, // best y resolution
+ 0x0000, 0x0000, 0x0318, 0x0264, // optimal src rect at 72dpi
+ 0x0000, // reserved
+ 0x0000, 0x001e, // DefHilite
+ 0x0008, 0x0048, // PenMode
+ 0x001a, 0x0000, 0x0000, 0x0000, // RGBFgCol = Black
+ 0x001b, 0xFFFF, 0xFFFF, 0xFFFF, // RGBBkCol = White
+ 0x0001, 0x000A, // set clipping
+ 0x0000, 0x0000, 0x0318, 0x0264, // clipping rect
+ 0x0032, 0x0000, 0x0000, 0x0318, 0x0264 // erase rect
+ };
+ mac_set_colordepth(dev, mdev->color_info.depth);
-static int
-mac_open(register gx_device *dev)
-{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- static short picHeader[42] = { 0x0000, // picture size
- 0x0000, 0x0000, 0x0318, 0x0264, // bounding rect at 72dpi
- 0x0011, 0x02ff, 0x0c00, 0xfffe, 0x0000, // version/header opcodes
- 0x0048, 0x0000, // best x resolution
- 0x0048, 0x0000, // best y resolution
- 0x0000, 0x0000, 0x0318, 0x0264, // optimal src rect at 72dpi
- 0x0000, // reserved
-
- 0x0000, 0x001e, // DefHilite
- 0x0008, 0x0048, // PenMode
- 0x001a, 0x0000, 0x0000, 0x0000, // RGBFgCol = Black
- 0x001b, 0xFFFF, 0xFFFF, 0xFFFF, // RGBBkCol = White
-
- 0x0001, 0x000A, // set clipping
- 0x0000, 0x0000, 0x0318, 0x0264, // clipping rect
- 0x0032, 0x0000, 0x0000, 0x0318, 0x0264 // erase rect
- };
-
-
- mac_set_colordepth(dev, mdev->color_info.depth);
-
- mdev->numUsedFonts = 0;
- mdev->lastFontFace = -1;
- mdev->lastFontSize = -1;
- mdev->lastFontID = -1;
-
- mdev->pic = (PicHandle) NewHandle(500000);
- if (mdev->pic == 0) // error, not enough memory
- return gs_error_VMerror;
-
- HLockHi((Handle) mdev->pic); // move handle high and lock it
-
- mdev->currPicPos = (short*) *mdev->pic;
- memcpy(mdev->currPicPos, picHeader, 42*2);
- mdev->currPicPos += 42;
-
- // enter correct dimensions and resolutions
- ((short*)(*mdev->pic))[ 3] = mdev->MediaSize[1];
- ((short*)(*mdev->pic))[ 4] = mdev->MediaSize[0];
-
- ((short*)(*mdev->pic))[16] = ((short*)(*mdev->pic))[35] = ((short*)(*mdev->pic))[40] = mdev->height;
- ((short*)(*mdev->pic))[17] = ((short*)(*mdev->pic))[36] = ((short*)(*mdev->pic))[41] = mdev->width;
-
- ((short*)(*mdev->pic))[10] = (((long) X2Fix( mdev->x_pixels_per_inch )) & 0xFFFF0000) >> 16;
- ((short*)(*mdev->pic))[11] = ((long) X2Fix( mdev->x_pixels_per_inch )) & 0x0000FFFF;
- ((short*)(*mdev->pic))[12] = (((long) X2Fix( mdev->y_pixels_per_inch )) & 0xFFFF0000) >> 16;
- ((short*)(*mdev->pic))[13] = ((long) X2Fix( mdev->y_pixels_per_inch )) & 0x0000FFFF;
-
- // finish picture, but dont increment pointer, we want to go on drawing
- *mdev->currPicPos = 0x00ff;
-
- // notify the caller that a new device was opened
- if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 1);
-
- return 0;
-}
+ mdev->numUsedFonts = 0;
+ mdev->lastFontFace = -1;
+ mdev->lastFontSize = -1;
+ mdev->lastFontID = -1;
+ mdev->pic = (PicHandle) NewHandle(500000);
+ if (mdev->pic == 0) // error, not enough memory
+ return gs_error_VMerror;
+ HLockHi((Handle) mdev->pic); // move handle high and lock it
+
+ mdev->currPicPos = (short*) *mdev->pic;
+ memcpy(mdev->currPicPos, picHeader, 42*2);
+ mdev->currPicPos += 42;
+
+ // enter correct dimensions and resolutions
+ ((short*)(*mdev->pic))[ 3] = mdev->MediaSize[1];
+ ((short*)(*mdev->pic))[ 4] = mdev->MediaSize[0];
+
+ ((short*)(*mdev->pic))[16] = ((short*)(*mdev->pic))[35] = ((short*)(*mdev->pic))[40] = mdev->height;
+ ((short*)(*mdev->pic))[17] = ((short*)(*mdev->pic))[36] = ((short*)(*mdev->pic))[41] = mdev->width;
+
+ ((short*)(*mdev->pic))[10] = (((long) X2Fix( mdev->x_pixels_per_inch )) & 0xFFFF0000) >> 16;
+ ((short*)(*mdev->pic))[11] = ((long) X2Fix( mdev->x_pixels_per_inch )) & 0x0000FFFF;
+ ((short*)(*mdev->pic))[12] = (((long) X2Fix( mdev->y_pixels_per_inch )) & 0xFFFF0000) >> 16;
+ ((short*)(*mdev->pic))[13] = ((long) X2Fix( mdev->y_pixels_per_inch )) & 0x0000FFFF;
+
+ // finish picture, but dont increment pointer, we want to go on drawing
+ *mdev->currPicPos = 0x00ff;
+
+ // notify the caller that a new device was opened
+ if (pgsdll_callback)
+ (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 1);
+
+ return 0;
+}
static void
mac_get_initial_matrix(register gx_device *dev, register gs_matrix *pmat)
{
- pmat->xx = dev->x_pixels_per_inch / 72.0;
- pmat->xy = 0;
- pmat->yx = 0;
- pmat->yy = dev->y_pixels_per_inch / -72.0;
- pmat->tx = 0;
- pmat->ty = dev->height;
+ pmat->xx = dev->x_pixels_per_inch / 72.0;
+ pmat->xy = 0;
+ pmat->yx = 0;
+ pmat->yy = dev->y_pixels_per_inch / -72.0;
+ pmat->tx = 0;
+ pmat->ty = dev->height;
}
-
-
/* Make the output appear on the screen. */
int
mac_sync_output(gx_device * dev)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- // finish picture, but dont increment pointer, we want to go on drawing
- *mdev->currPicPos = 0x00ff;
-
- // tell the caller to sync
- if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_SYNC, (char *)mdev, 0);
-
- return (0);
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ // finish picture, but dont increment pointer, we want to go on drawing
+ *mdev->currPicPos = 0x00ff;
+ // tell the caller to sync
+ if (pgsdll_callback)
+ (*pgsdll_callback) (GSDLL_SYNC, (char *)mdev, 0);
+ return (0);
+}
int
mac_output_page(gx_device * dev, int copies, int flush)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
- int code = 0;
-
- mdev->outputPage = true;
-
- if (strcmp(mdev->outputFileName, "")) {
- // save file
- code = mac_save_pict(dev);
- }
-
- // tell the caller that the page is done
- if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_PAGE, (char *)mdev, 0);
-
- gx_finish_output_page(dev, copies, flush);
-
- return code;
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+ int code = 0;
+
+ mdev->outputPage = true;
+
+ if (strcmp(mdev->outputFileName, "")) {
+ // save file
+ code = mac_save_pict(dev);
+ }
+
+ // tell the caller that the page is done
+ if (pgsdll_callback)
+ (*pgsdll_callback) (GSDLL_PAGE, (char *)mdev, 0);
+ gx_finish_output_page(dev, copies, flush);
+
+ return code;
+}
static int
mac_save_pict(gx_device * dev)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
- int code = 0;
- int i;
-
- if (mdev->outputFile == NULL) {
- code = gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile));
- if (code < 0) return code;
- }
-
- for (i=0; i<512; i++) fputc(0, mdev->outputFile);
- fwrite(*(mdev->pic), sizeof(char), ((long) mdev->currPicPos - (long) *mdev->pic + 2), mdev->outputFile);
-
- gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
- mdev->outputFile = NULL;
-
- return code;
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+ int code = 0;
+ int i;
+ if (mdev->outputFile == NULL) {
+ code = gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile));
+ if (code < 0) return code;
+ }
+
+ for (i=0; i<512; i++) fputc(0, mdev->outputFile);
+ fwrite(*(mdev->pic), sizeof(char), ((long) mdev->currPicPos - (long) *mdev->pic + 2), mdev->outputFile);
+
+ gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
+ mdev->outputFile = NULL;
+
+ return code;
+}
/* Close the device. */
static int
mac_close(register gx_device *dev)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- long len;
-
- HUnlock((Handle) mdev->pic); // no more changes in the pict -> unlock handle
- if (strcmp(mdev->outputFileName, "")) {
- DisposeHandle((Handle) mdev->pic);
- gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
- mdev->outputFile = 0;
- } else {
- len = (long)mdev->currPicPos - (long)*mdev->pic;
- SetHandleSize((Handle) mdev->pic, len + 10); // +10 just for the case
- }
-
- // notify the caller that the device was closed
- // it has to dispose the PICT handle when it is ready!
- if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 0);
-
- return 0;
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ long len;
+
+ HUnlock((Handle) mdev->pic); // no more changes in the pict -> unlock handle
+ if (strcmp(mdev->outputFileName, "")) {
+ DisposeHandle((Handle) mdev->pic);
+ gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
+ mdev->outputFile = 0;
+ } else {
+ len = (long)mdev->currPicPos - (long)*mdev->pic;
+ SetHandleSize((Handle) mdev->pic, len + 10); // +10 just for the case
+ }
+
+ // notify the caller that the device was closed
+ // it has to dispose the PICT handle when it is ready!
+ if (pgsdll_callback)
+ (*pgsdll_callback) (GSDLL_DEVICE, (char *)mdev, 0);
+
+ return 0;
}
-
-
/* Fill a rectangle with a color. */
static int
mac_fill_rectangle(register gx_device *dev,
- int x, int y, int w, int h,
- gx_color_index color)
+ int x, int y, int w, int h,
+ gx_color_index color)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- /* ignore a fullpage rect directly after an output_page, this would clear the pict */
- if (mdev->outputPage &&
- (x == 0) && (y == 0) && (w == mdev->width) && (h == mdev->height)) {
- return 0;
- }
-
- CheckMem(1024, 100*1024);
- ResetPage();
-
- GSSetFgCol(dev, mdev->currPicPos, color);
- PICT_fillRect(mdev->currPicPos, x, y, w, h);
-
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ /* ignore a fullpage rect directly after an output_page, this would clear the pict */
+ if (mdev->outputPage &&
+ (x == 0) && (y == 0) && (w == mdev->width) && (h == mdev->height)) {
+ return 0;
+ }
+ CheckMem(1024, 100*1024);
+ ResetPage();
+ GSSetFgCol(dev, mdev->currPicPos, color);
+ PICT_fillRect(mdev->currPicPos, x, y, w, h);
+
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ return 0;
+}
/* Draw a line */
static int
mac_draw_line (register gx_device *dev,
- int x0, int y0,
- int x1, int y1,
- gx_color_index color)
+ int x0, int y0,
+ int x1, int y1,
+ gx_color_index color)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- CheckMem(1024, 100*1024);
- ResetPage();
-
- GSSetFgCol(dev, mdev->currPicPos, color);
- PICT_Line(mdev->currPicPos, x0, y0, x1, y1);
-
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ CheckMem(1024, 100*1024);
+ ResetPage();
+ GSSetFgCol(dev, mdev->currPicPos, color);
+ PICT_Line(mdev->currPicPos, x0, y0, x1, y1);
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ return 0;
+}
/* Copy a monochrome bitmap. */
static int
mac_copy_mono (register gx_device *dev,
- const unsigned char *base, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color_0, gx_color_index color_1)
+ const unsigned char *base, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color_0, gx_color_index color_1)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- int byteCount = raster * h;
- short copyMode;
-
- // this case doesn't change the picture -> return without wasting time
- if (color_0 == gx_no_color_index && color_1 == gx_no_color_index)
- return 0;
-
- fit_copy(dev, base, data_x, raster, id, x, y, w, h);
-
- CheckMem(10*1024 + byteCount*10, 100*1024 + byteCount*10);
- ResetPage();
-
- if (color_0 == gx_no_color_index)
- copyMode = srcOr;
- else if (color_1 == gx_no_color_index)
- copyMode = notSrcBic; // this mode is untested ! (no file found which is using it)
- else
- copyMode = srcCopy;
-
- copyMode += ditherCopy;
-
- GSSetBkCol(dev, mdev->currPicPos, color_0);
- GSSetFgCol(dev, mdev->currPicPos, color_1);
-
- PICTWriteOpcode(mdev->currPicPos, 0x0098);
- PICTWriteInt(mdev->currPicPos, raster);
- PICTWriteRect(mdev->currPicPos, 0, 0, raster*8, h);
- PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
- PICTWriteRect(mdev->currPicPos, x, y, w, h);
- PICTWriteInt(mdev->currPicPos, copyMode);
- PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
-
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
-}
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ int byteCount = raster * h;
+ short copyMode;
+
+ // this case doesn't change the picture -> return without wasting time
+ if (color_0 == gx_no_color_index && color_1 == gx_no_color_index)
+ return 0;
+
+ fit_copy(dev, base, data_x, raster, id, x, y, w, h);
+ CheckMem(10*1024 + byteCount*10, 100*1024 + byteCount*10);
+ ResetPage();
+ if (color_0 == gx_no_color_index)
+ copyMode = srcOr;
+ else if (color_1 == gx_no_color_index)
+ copyMode = notSrcBic; // this mode is untested ! (no file found which is using it)
+ else
+ copyMode = srcCopy;
+
+ copyMode += ditherCopy;
+
+ GSSetBkCol(dev, mdev->currPicPos, color_0);
+ GSSetFgCol(dev, mdev->currPicPos, color_1);
+
+ PICTWriteOpcode(mdev->currPicPos, 0x0098);
+ PICTWriteInt(mdev->currPicPos, raster);
+ PICTWriteRect(mdev->currPicPos, 0, 0, raster*8, h);
+ PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
+ PICTWriteRect(mdev->currPicPos, x, y, w, h);
+ PICTWriteInt(mdev->currPicPos, copyMode);
+ PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
+
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ return 0;
+}
/* Fill a region with a color and apply a per-pixel alpha-value */
/* alpha value is simulated by changed the value to white. Full transparency means white color */
/* that's why this will only work on a fully white background!!!! */
static int
mac_copy_alpha(gx_device *dev, const unsigned char *base, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- ColorSpec *colorTable;
- short copyMode, shade, maxShade = (1 << depth) - 1, byteCount = raster * h;
- gx_color_value rgb[3];
- colorHSV colHSV;
- colorRGB colRGB;
- float saturation, value;
-
- fit_copy(dev, base, data_x, raster, id, x, y, w, h);
-
- CheckMem( byteCount*4 + 200*1024, byteCount*4 + 500*1024 );
- ResetPage();
-
- colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (maxShade+1));
- if (colorTable == NULL)
- return gs_error_VMerror;
-
- (*dev_proc(dev, map_color_rgb))(dev, color, rgb);
- colRGB.red = rgb[0];
- colRGB.green = rgb[1];
- colRGB.blue = rgb[2];
- mac_convert_rgb_hsv(&colRGB, &colHSV);
- saturation = colHSV.s;
- value = colHSV.v;
-
- for (shade=0; shade <= maxShade; shade++) {
- colorTable[shade].value = maxShade - shade;
-
- colHSV.s = saturation * (1.0 - (float)shade/(float)maxShade);
- colHSV.v = value + ((1.0 - value) * (float)shade/(float)maxShade);
-
- mac_convert_hsv_rgb(&colHSV, &colRGB);
- colorTable[shade].rgb.red = colRGB.red;
- colorTable[shade].rgb.green = colRGB.green;
- colorTable[shade].rgb.blue = colRGB.blue;
- }
- copyMode = srcCopy + ditherCopy;
-
- GSSetStdCol(mdev->currPicPos);
-
- if (raster < 8) {
- PICTWriteOpcode(mdev->currPicPos, 0x0090);
- } else {
- PICTWriteOpcode(mdev->currPicPos, 0x0098);
- }
- PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/depth, h, raster, 0, 0,
- X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), depth);
- PICTWriteColorTable(mdev->currPicPos, 0, maxShade+1, colorTable);
- PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
- PICTWriteRect(mdev->currPicPos, x, y, w, h);
- PICTWriteInt(mdev->currPicPos, copyMode);
- PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
-
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- free(colorTable);
-
- return 0;
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ ColorSpec *colorTable;
+ short copyMode, shade, maxShade = (1 << depth) - 1, byteCount = raster * h;
+ gx_color_value rgb[3];
+ colorHSV colHSV;
+ colorRGB colRGB;
+ float saturation, value;
+
+ fit_copy(dev, base, data_x, raster, id, x, y, w, h);
+
+ CheckMem( byteCount*4 + 200*1024, byteCount*4 + 500*1024 );
+ ResetPage();
+
+ colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (maxShade+1));
+ if (colorTable == NULL)
+ return gs_error_VMerror;
+
+ (*dev_proc(dev, map_color_rgb))(dev, color, rgb);
+ colRGB.red = rgb[0];
+ colRGB.green = rgb[1];
+ colRGB.blue = rgb[2];
+ mac_convert_rgb_hsv(&colRGB, &colHSV);
+ saturation = colHSV.s;
+ value = colHSV.v;
+
+ for (shade=0; shade <= maxShade; shade++) {
+ colorTable[shade].value = maxShade - shade;
+
+ colHSV.s = saturation * (1.0 - (float)shade/(float)maxShade);
+ colHSV.v = value + ((1.0 - value) * (float)shade/(float)maxShade);
+
+ mac_convert_hsv_rgb(&colHSV, &colRGB);
+ colorTable[shade].rgb.red = colRGB.red;
+ colorTable[shade].rgb.green = colRGB.green;
+ colorTable[shade].rgb.blue = colRGB.blue;
+ }
+ copyMode = srcCopy + ditherCopy;
+
+ GSSetStdCol(mdev->currPicPos);
+
+ if (raster < 8) {
+ PICTWriteOpcode(mdev->currPicPos, 0x0090);
+ } else {
+ PICTWriteOpcode(mdev->currPicPos, 0x0098);
+ }
+ PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/depth, h, raster, 0, 0,
+ X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), depth);
+ PICTWriteColorTable(mdev->currPicPos, 0, maxShade+1, colorTable);
+ PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
+ PICTWriteRect(mdev->currPicPos, x, y, w, h);
+ PICTWriteInt(mdev->currPicPos, copyMode);
+ PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
+
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ free(colorTable);
+
+ return 0;
}
-
-
void
mac_convert_rgb_hsv(colorRGB *inRGB, colorHSV *HSV)
{
#define NORMALIZE_RGB(col) ((float)col/(float)0xFFFF)
-
- float min = 1.0, temp;
- float r = NORMALIZE_RGB(inRGB->red),
- g = NORMALIZE_RGB(inRGB->green),
- b = NORMALIZE_RGB(inRGB->blue);
-
- HSV->h = 0;
-
- HSV->v = r;
- if (g > HSV->v) HSV->v = g;
- if (b > HSV->v) HSV->v = b;
-
- min = r;
- if (g < min) min = g;
- if (b < min) min = b;
-
- temp = HSV->v - min;
-
- if (HSV->v > 0)
- HSV->s = temp / HSV->v;
- else
- HSV->s = 0;
-
- if (HSV->s > 0) {
- float rd = (HSV->v - r) / temp,
- gd = (HSV->v - g) / temp,
- bd = (HSV->v - b) / temp;
-
- if (HSV->v == r) {
- if (min == g) HSV->h = 5 + bd;
- else HSV->h = 1 - gd;
- } else if (HSV->v == g) {
- if (min == b) HSV->h = 1 + rd;
- else HSV->h = 3 - bd;
- } else {
- if (min == r) HSV->h = 3 + gd;
- else HSV->h = 5 - rd;
- }
-
- if (HSV->h < 6) HSV->h *= 60;
- else HSV->h = 0;
- }
-}
+ float min = 1.0, temp;
+ float r = NORMALIZE_RGB(inRGB->red),
+ g = NORMALIZE_RGB(inRGB->green),
+ b = NORMALIZE_RGB(inRGB->blue);
+
+ HSV->h = 0;
+
+ HSV->v = r;
+ if (g > HSV->v) HSV->v = g;
+ if (b > HSV->v) HSV->v = b;
+
+ min = r;
+ if (g < min) min = g;
+ if (b < min) min = b;
+
+ temp = HSV->v - min;
+
+ if (HSV->v > 0)
+ HSV->s = temp / HSV->v;
+ else
+ HSV->s = 0;
+
+ if (HSV->s > 0) {
+ float rd = (HSV->v - r) / temp,
+ gd = (HSV->v - g) / temp,
+ bd = (HSV->v - b) / temp;
+
+ if (HSV->v == r) {
+ if (min == g) HSV->h = 5 + bd;
+ else HSV->h = 1 - gd;
+ } else if (HSV->v == g) {
+ if (min == b) HSV->h = 1 + rd;
+ else HSV->h = 3 - bd;
+ } else {
+ if (min == r) HSV->h = 3 + gd;
+ else HSV->h = 5 - rd;
+ }
+
+ if (HSV->h < 6) HSV->h *= 60;
+ else HSV->h = 0;
+ }
+}
void
mac_convert_hsv_rgb(colorHSV *inHSV, colorRGB *RGB)
{
- if (inHSV->s == 0) {
- RGB->red = RGB->green = RGB->blue = inHSV->v * 0xFFFF;
- } else {
- float h = inHSV->h / 60;
- int i = trunc(h);
- float fract = h - i;
- unsigned short t1 = (inHSV->v * (1 - inHSV->s)) * 0xFFFF,
- t2 = (inHSV->v * (1 - inHSV->s * fract)) * 0xFFFF,
- t3 = (inHSV->v * (1 - inHSV->s * (1 - fract))) * 0xFFFF,
- v = inHSV->v * 0xFFFF;
-
- switch(i) {
- case 0: RGB->red = v;
- RGB->green = t3;
- RGB->blue = t1;
- break;
-
- case 1: RGB->red = t2;
- RGB->green = v;
- RGB->blue = t1;
- break;
-
- case 2: RGB->red = t1;
- RGB->green = v;
- RGB->blue = t3;
- break;
-
- case 3: RGB->red = t1;
- RGB->green = t2;
- RGB->blue = v;
- break;
-
- case 4: RGB->red = t3;
- RGB->green = t1;
- RGB->blue = v;
- break;
-
- case 5: RGB->red = v;
- RGB->green = t1;
- RGB->blue = t2;
- break;
- }
- }
+ if (inHSV->s == 0) {
+ RGB->red = RGB->green = RGB->blue = inHSV->v * 0xFFFF;
+ } else {
+ float h = inHSV->h / 60;
+ int i = trunc(h);
+ float fract = h - i;
+ unsigned short t1 = (inHSV->v * (1 - inHSV->s)) * 0xFFFF,
+ t2 = (inHSV->v * (1 - inHSV->s * fract)) * 0xFFFF,
+ t3 = (inHSV->v * (1 - inHSV->s * (1 - fract))) * 0xFFFF,
+ v = inHSV->v * 0xFFFF;
+
+ switch(i) {
+ case 0: RGB->red = v;
+ RGB->green = t3;
+ RGB->blue = t1;
+ break;
+
+ case 1: RGB->red = t2;
+ RGB->green = v;
+ RGB->blue = t1;
+ break;
+
+ case 2: RGB->red = t1;
+ RGB->green = v;
+ RGB->blue = t3;
+ break;
+
+ case 3: RGB->red = t1;
+ RGB->green = t2;
+ RGB->blue = v;
+ break;
+
+ case 4: RGB->red = t3;
+ RGB->green = t1;
+ RGB->blue = v;
+ break;
+
+ case 5: RGB->red = v;
+ RGB->green = t1;
+ RGB->blue = t2;
+ break;
+ }
+ }
}
-
-
// set color info and procedures according to pixeldepth
static int
mac_set_colordepth(gx_device *dev, int depth)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
- gx_device_color_info * ci = &mdev->color_info;
-
- if (depth != 1 && depth != 4 && depth != 7 && depth != 8 && depth != 24)
- return gs_error_rangecheck;
-
- mdev->color_info.depth = depth;
- switch (depth)
- {
- case 1: // Black/White
- ci->num_components = 1;
- ci->max_gray = 1; ci->max_color = 0;
- ci->dither_grays = 2; ci->dither_colors = 0;
- set_dev_proc(dev, map_rgb_color, gx_default_b_w_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_b_w_map_color_rgb);
- break;
-
- case 4: // 4Bit-Gray
- ci->num_components = 1;
- ci->max_gray = 15; ci->max_color = 0;
- ci->dither_grays = 16; ci->dither_colors = 0;
- set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb);
- break;
-
- case 7: // 8Bit-Gray
- ci->depth = 7;
- ci->num_components = 1;
- ci->max_gray = 255; ci->max_color = 0;
- ci->dither_grays = 256; ci->dither_colors = 0;
- set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb);
- break;
-
- case 8: // 8Bit-Color
- ci->num_components = 3;
- ci->max_gray = 15; ci->max_color = 5;
- ci->dither_grays = 16; ci->dither_colors = 6;
- set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
- break;
-
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+ gx_device_color_info * ci = &mdev->color_info;
+
+ if (depth != 1 && depth != 4 && depth != 7 && depth != 8 && depth != 24)
+ return gs_error_rangecheck;
+
+ mdev->color_info.depth = depth;
+ switch (depth)
+ {
+ case 1: // Black/White
+ ci->num_components = 1;
+ ci->max_gray = 1; ci->max_color = 0;
+ ci->dither_grays = 2; ci->dither_colors = 0;
+ set_dev_proc(dev, map_rgb_color, gx_default_b_w_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_b_w_map_color_rgb);
+ break;
+
+ case 4: // 4Bit-Gray
+ ci->num_components = 1;
+ ci->max_gray = 15; ci->max_color = 0;
+ ci->dither_grays = 16; ci->dither_colors = 0;
+ set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb);
+ break;
+
+ case 7: // 8Bit-Gray
+ ci->depth = 7;
+ ci->num_components = 1;
+ ci->max_gray = 255; ci->max_color = 0;
+ ci->dither_grays = 256; ci->dither_colors = 0;
+ set_dev_proc(dev, map_rgb_color, gx_default_gray_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_gray_map_color_rgb);
+ break;
+
+ case 8: // 8Bit-Color
+ ci->num_components = 3;
+ ci->max_gray = 15; ci->max_color = 5;
+ ci->dither_grays = 16; ci->dither_colors = 6;
+ set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
+ break;
+
/* case 16: // 16Bit-Color
- ci->num_components = 3;
- ci->max_gray = 255; ci->max_color = 65535;
- ci->dither_grays = 256; ci->dither_colors = 65536;
- set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
- break;
-*/
- case 24: // 24Bit-Color
- ci->num_components = 3;
- ci->max_gray = 255; ci->max_color = 16777215;
- ci->dither_grays = 256; ci->dither_colors = 16777216;
- set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
- set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
- break;
- }
-
- return 0;
+ ci->num_components = 3;
+ ci->max_gray = 255; ci->max_color = 65535;
+ ci->dither_grays = 256; ci->dither_colors = 65536;
+ set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
+ break;
+*/
+ case 24: // 24Bit-Color
+ ci->num_components = 3;
+ ci->max_gray = 255; ci->max_color = 16777215;
+ ci->dither_grays = 256; ci->dither_colors = 16777216;
+ set_dev_proc(dev, map_rgb_color, gx_default_rgb_map_rgb_color);
+ set_dev_proc(dev, map_color_rgb, gx_default_rgb_map_color_rgb);
+ break;
+ }
+
+ return 0;
}
-
static int
mac_put_params(gx_device *dev, gs_param_list *plist)
-{
- gx_device_macos *mdev = (gx_device_macos *)dev;
-
- int isOpen = mdev->is_open;
- int code;
+{
+ gx_device_macos *mdev = (gx_device_macos *)dev;
+
+ int isOpen = mdev->is_open;
+ int code;
bool useXFonts;
- int depth;
+ int depth;
gs_param_string outputFile;
-
- // Get the UseExternalFonts Parameter
- code = param_read_bool(plist, "UseExternalFonts", &useXFonts);
- if (!code)
- mdev->useXFonts = useXFonts;
-
- // Get the BitsPerPixel Parameter
- code = param_read_int(plist, "BitsPerPixel", &depth);
- if (!code) {
- code = mac_set_colordepth(dev, depth);
- if (code)
- param_return_error(plist, "BitsPerPixel", gs_error_rangecheck);
- }
-
- // Get OutputFile
- code = param_read_string(plist, "OutputFile", &outputFile);
- if (code < 0) {
- param_signal_error(plist, "OutputFile", code);
- return code;
- } else if (code == 0) {
-
- if (dev->LockSafetyParams &&
- bytes_compare(outputFile.data, outputFile.size,
- (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) {
- param_signal_error(plist, "OutputFile", gs_error_invalidaccess);
- return gs_error_invalidaccess;
- }
- if (outputFile.size > (gp_file_name_sizeof - 1)) {
- param_signal_error(plist, "OutputFile", gs_error_limitcheck);
- return gs_error_limitcheck;
- }
-
- /* If filename changed, close file. */
- if (outputFile.data != 0 &&
- bytes_compare(outputFile.data, outputFile.size,
- (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) {
- /* Close the file if it's open. */
- if (mdev->outputFile != NULL) {
- gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
- memcpy(mdev->outputFileName, outputFile.data, outputFile.size);
- mdev->outputFileName[outputFile.size] = 0;
- gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile));
- } else {
- memcpy(mdev->outputFileName, outputFile.data, outputFile.size);
- mdev->outputFileName[outputFile.size] = 0;
- }
- }
- }
-
- // Get the Default Parameters
- mdev->is_open = 0;
- code = gx_default_put_params( dev, plist );
- mdev->is_open = isOpen;
-
- return code;
-}
+ // Get the UseExternalFonts Parameter
+ code = param_read_bool(plist, "UseExternalFonts", &useXFonts);
+ if (!code)
+ mdev->useXFonts = useXFonts;
+
+ // Get the BitsPerPixel Parameter
+ code = param_read_int(plist, "BitsPerPixel", &depth);
+ if (!code) {
+ code = mac_set_colordepth(dev, depth);
+ if (code)
+ param_return_error(plist, "BitsPerPixel", gs_error_rangecheck);
+ }
+
+ // Get OutputFile
+ code = param_read_string(plist, "OutputFile", &outputFile);
+ if (code < 0) {
+ param_signal_error(plist, "OutputFile", code);
+ return code;
+ } else if (code == 0) {
+
+ if (dev->LockSafetyParams &&
+ bytes_compare(outputFile.data, outputFile.size,
+ (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) {
+ param_signal_error(plist, "OutputFile", gs_error_invalidaccess);
+ return gs_error_invalidaccess;
+ }
+ if (outputFile.size > (gp_file_name_sizeof - 1)) {
+ param_signal_error(plist, "OutputFile", gs_error_limitcheck);
+ return gs_error_limitcheck;
+ }
+
+ /* If filename changed, close file. */
+ if (outputFile.data != 0 &&
+ bytes_compare(outputFile.data, outputFile.size,
+ (const byte *)mdev->outputFileName, strlen(mdev->outputFileName))) {
+ /* Close the file if it's open. */
+ if (mdev->outputFile != NULL) {
+ gx_device_close_output_file(dev, mdev->outputFileName, mdev->outputFile);
+ memcpy(mdev->outputFileName, outputFile.data, outputFile.size);
+ mdev->outputFileName[outputFile.size] = 0;
+ gx_device_open_output_file(dev, mdev->outputFileName, true, true, &(mdev->outputFile));
+ } else {
+ memcpy(mdev->outputFileName, outputFile.data, outputFile.size);
+ mdev->outputFileName[outputFile.size] = 0;
+ }
+ }
+ }
+
+ // Get the Default Parameters
+ mdev->is_open = 0;
+ code = gx_default_put_params( dev, plist );
+ mdev->is_open = isOpen;
+
+ return code;
+}
static int
mac_get_params(gx_device *dev, gs_param_list *plist)
{
- gx_device_macos *mdev = (gx_device_macos *)dev;
-
- int code;
+ gx_device_macos *mdev = (gx_device_macos *)dev;
+
+ int code;
gs_param_string outputFile;
-
- code = gx_default_get_params(dev, plist);
- if (code < 0)
- return code;
-
- // UseExternalFonts
- code = param_write_bool(plist, "UseExternalFonts", &(mdev->useXFonts));
-
- // color depth
- code = param_write_int(plist, "BitsPerPixel", &(mdev->color_info.depth));
-
- // output file name
- outputFile.data = (const byte *) mdev->outputFileName;
- outputFile.size = strlen(mdev->outputFileName);
- outputFile.persistent = false;
- code = param_write_string(plist, "OutputFile", &outputFile);
-
- return code;
-}
+ code = gx_default_get_params(dev, plist);
+ if (code < 0)
+ return code;
+
+ // UseExternalFonts
+ code = param_write_bool(plist, "UseExternalFonts", &(mdev->useXFonts));
+
+ // color depth
+ code = param_write_int(plist, "BitsPerPixel", &(mdev->color_info.depth));
+ // output file name
+ outputFile.data = (const byte *) mdev->outputFileName;
+ outputFile.size = strlen(mdev->outputFileName);
+ outputFile.persistent = false;
+ code = param_write_string(plist, "OutputFile", &outputFile);
+
+ return code;
+}
/* let the caller get the device PictHandle, he has to draw it to screen */
int GSDLLAPI
gsdll_get_pict(unsigned char *dev, PicHandle *thePict)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- *thePict = mdev->pic;
-
- return 0;
-}
-
-
-
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+ *thePict = mdev->pic;
+ return 0;
+}
/*************************************************************************************/
/*************************************************************************************/
@@ -714,129 +675,114 @@ gsdll_get_pict(unsigned char *dev, PicHandle *thePict)
/*************************************************************************************/
/*************************************************************************************/
-
-
-
#if 0
/* NOT FUNCTIONAL !!! */
/* Copy a color bitmap. */
static int
mac_copy_color (register gx_device *dev,
- const unsigned char *base, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const unsigned char *base, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- int byteCount = raster * h, color;
- gx_color_value rgb[3];
-
- fit_copy(dev, base, data_x, raster, id, x, y, w, h);
-
- CheckMem(10*1024 + byteCount*4, 100*1024 + byteCount*4);
- ResetPage();
-
- GSSetStdCol(mdev->currPicPos); // Sets FgCol to Black and BkCol to White
-
- if (mdev->color_info.depth == 24) {
- PICTWriteOpcode(mdev->currPicPos, 0x009A);
- PICTWriteLong(mdev->currPicPos, 0x000000FF);
- PICTWritePixMap(mdev->currPicPos, 0, 0, raster/4, h, raster, 2, 0,
- X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), 32);
- PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
- PICTWriteRect(mdev->currPicPos, x, y, w, h);
- PICTWriteInt(mdev->currPicPos, srcCopy);
-
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ int byteCount = raster * h, color;
+ gx_color_value rgb[3];
+
+ fit_copy(dev, base, data_x, raster, id, x, y, w, h);
+
+ CheckMem(10*1024 + byteCount*4, 100*1024 + byteCount*4);
+ ResetPage();
+
+ GSSetStdCol(mdev->currPicPos); // Sets FgCol to Black and BkCol to White
+
+ if (mdev->color_info.depth == 24) {
+ PICTWriteOpcode(mdev->currPicPos, 0x009A);
+ PICTWriteLong(mdev->currPicPos, 0x000000FF);
+ PICTWritePixMap(mdev->currPicPos, 0, 0, raster/4, h, raster, 2, 0,
+ X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch), 32);
+ PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
+ PICTWriteRect(mdev->currPicPos, x, y, w, h);
+ PICTWriteInt(mdev->currPicPos, srcCopy);
+
/* memcpy(mdev->currPicPos, base, byteCount);
- (char*)(mdev->currPicPos) += byteCount;*/
-
- {
- short i;
- byteCount = 0;
-
- for (i=0; i<raster/4*h; i++) {
- // PICTWriteByte(mdev->currPicPos, 0x00);
- PICTWriteByte(mdev->currPicPos, 0x00);
- PICTWriteByte(mdev->currPicPos, 0x00);
- PICTWriteByte(mdev->currPicPos, 0x00);
- byteCount += 3;
- }
- }
-
- if (byteCount % 2)
- PICTWriteFillByte(mdev->currPicPos);
-
- } else if (mdev->color_info.depth <= 8) {
- ColorSpec *colorTable;
-
- colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (1 << mdev->color_info.depth));
- for (color=0; color < (1 << mdev->color_info.depth); color++) {
- (*dev_proc(dev, map_color_rgb))(dev, color, rgb);
- colorTable[color].value = color;
- colorTable[color].rgb.red = rgb[0];
- colorTable[color].rgb.green = rgb[1];
- colorTable[color].rgb.blue = rgb[2];
- }
-
- PICTWriteOpcode(mdev->currPicPos, 0x0098);
- PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/mdev->color_info.depth, h, raster, 1, 0,
- X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch),
- mdev->color_info.depth);
- PICTWriteColorTable(mdev->currPicPos, 0, (1 << mdev->color_info.depth), colorTable);
- PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
- PICTWriteRect(mdev->currPicPos, x, y, w, h);
- PICTWriteInt(mdev->currPicPos, srcCopy);
-
- PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
-
- free(colorTable);
- } else {
- gx_default_copy_color( dev, base, data_x, raster, id, x, y, w, h );
- }
-
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
+ (char*)(mdev->currPicPos) += byteCount;*/
+
+ {
+ short i;
+ byteCount = 0;
+
+ for (i=0; i<raster/4*h; i++) {
+ // PICTWriteByte(mdev->currPicPos, 0x00);
+ PICTWriteByte(mdev->currPicPos, 0x00);
+ PICTWriteByte(mdev->currPicPos, 0x00);
+ PICTWriteByte(mdev->currPicPos, 0x00);
+ byteCount += 3;
+ }
+ }
+
+ if (byteCount % 2)
+ PICTWriteFillByte(mdev->currPicPos);
+
+ } else if (mdev->color_info.depth <= 8) {
+ ColorSpec *colorTable;
+
+ colorTable = (ColorSpec*) malloc(sizeof(ColorSpec) * (1 << mdev->color_info.depth));
+ for (color=0; color < (1 << mdev->color_info.depth); color++) {
+ (*dev_proc(dev, map_color_rgb))(dev, color, rgb);
+ colorTable[color].value = color;
+ colorTable[color].rgb.red = rgb[0];
+ colorTable[color].rgb.green = rgb[1];
+ colorTable[color].rgb.blue = rgb[2];
+ }
+
+ PICTWriteOpcode(mdev->currPicPos, 0x0098);
+ PICTWritePixMap(mdev->currPicPos, 0, 0, raster*8/mdev->color_info.depth, h, raster, 1, 0,
+ X2Fix(mdev->x_pixels_per_inch), X2Fix(mdev->y_pixels_per_inch),
+ mdev->color_info.depth);
+ PICTWriteColorTable(mdev->currPicPos, 0, (1 << mdev->color_info.depth), colorTable);
+ PICTWriteRect(mdev->currPicPos, data_x, 0, w, h);
+ PICTWriteRect(mdev->currPicPos, x, y, w, h);
+ PICTWriteInt(mdev->currPicPos, srcCopy);
+
+ PICTWriteDataPackBits(mdev->currPicPos, base, raster, h);
+
+ free(colorTable);
+ } else {
+ gx_default_copy_color( dev, base, data_x, raster, id, x, y, w, h );
+ }
+
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ return 0;
}
#endif
-
-
#if 0
/* tile a rectangle with a bitmap or pixmap */
static int
mac_strip_tile_rectangle(register gx_device *dev, const gx_strip_bitmap *tile,
- int x, int y, int w, int h,
- gx_color_index color_0, gx_color_index color_1,
- int phase_x, int phase_y)
+ int x, int y, int w, int h,
+ gx_color_index color_0, gx_color_index color_1,
+ int phase_x, int phase_y)
{
- gx_device_macos * mdev = (gx_device_macos *)dev;
-
- int byteCount = tile->raster * tile->size.y;
-/*
- // tile is a pixmap
- if (color_0 == gx_no_color_index && color_1 == gx_no_color_index)
- return 0;// gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
-
- if (color_0 != gx_no_color_index && color_1 != gx_no_color_index) {
- // monochrome tiles
- if (phase_x != 0 ||Êphase_y != 0 || tile->shift != 0 ||
- tile->strip_height != 0 ||Êtile->strip_shift != 0) {
- return gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
- }
-
- } else {
- return 0;//gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
- }
+ gx_device_macos * mdev = (gx_device_macos *)dev;
+
+ int byteCount = tile->raster * tile->size.y;
+/*
+ // tile is a pixmap
+ if (color_0 == gx_no_color_index && color_1 == gx_no_color_index)
+ return 0;// gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
+
+ if (color_0 != gx_no_color_index && color_1 != gx_no_color_index) {
+ // monochrome tiles
+ if (phase_x != 0 ||Êphase_y != 0 || tile->shift != 0 ||
+ tile->strip_height != 0 ||Êtile->strip_shift != 0) {
+ return gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
+ }
+
+ } else {
+ return 0;//gx_default_strip_tile_rectangle(dev, tile, x, y, w, h, color_0, color_1, phase_x, phase_y);
+ }
*/
}
-#endif
-
-
-
-
-
-
-
-
-
-
+#endif
diff --git a/gs/base/gdevmac.h b/gs/base/gdevmac.h
index 069565897..e15e58991 100644
--- a/gs/base/gdevmac.h
+++ b/gs/base/gdevmac.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,8 +36,6 @@
#include "gsstruct.h"
#include "gserrors.h"
-
-
/* Default device settings */
#define DEFAULT_PAGE_SIZE_H 8.5
@@ -50,28 +48,26 @@
#define DEFAULT_PAGE_WIDTH (DEFAULT_PAGE_SIZE_H * DEFAULT_PAGE_DPI)
#define DEFAULT_PAGE_HEIGHT (DEFAULT_PAGE_SIZE_V * DEFAULT_PAGE_DPI)
-
/* Define the Macintosh device */
typedef struct gx_device_macos_s
{
- gx_device_common;
- char outputFileName[gp_file_name_sizeof];
- FILE *outputFile;
- PicHandle pic;
- short *currPicPos;
- bool outputPage;
- bool useXFonts;
- FMFontStyle lastFontFace;
- FMFontSize lastFontSize;
- FMFontFamily lastFontID;
- int numUsedFonts;
- FMFontFamily usedFontIDs[256];
+ gx_device_common;
+ char outputFileName[gp_file_name_sizeof];
+ FILE *outputFile;
+ PicHandle pic;
+ short *currPicPos;
+ bool outputPage;
+ bool useXFonts;
+ FMFontStyle lastFontFace;
+ FMFontSize lastFontSize;
+ FMFontFamily lastFontID;
+ int numUsedFonts;
+ FMFontFamily usedFontIDs[256];
} gx_device_macos;
#define DEV_MAC_NAME "macos"
-
/* Device Procedures */
dev_proc_open_device(mac_open);
@@ -96,64 +92,60 @@ static xfont_proc_char_metrics(mac_char_metrics);
static xfont_proc_render_char(mac_render_char);
static xfont_proc_release(mac_release);
-
/* Define a MacOS xfont. */
typedef struct mac_xfont_s mac_xfont;
struct mac_xfont_s {
- gx_xfont_common common;
- gx_device *dev;
- Str255 fontName;
- FMFontFamily fontID;
- FMFontStyle fontFace;
- FMFontSize fontSize;
- int fontEncoding;
- FMetricRec fontMetrics;
+ gx_xfont_common common;
+ gx_device *dev;
+ Str255 fontName;
+ FMFontFamily fontID;
+ FMFontStyle fontFace;
+ FMFontSize fontSize;
+ int fontEncoding;
+ FMetricRec fontMetrics;
};
-
/* Memory handling macros */
#define CheckMem(a,b) \
- { \
- long offset = (long) mdev->currPicPos - (long) *mdev->pic; \
- long len = GetHandleSize((Handle) mdev->pic); \
- if (len - offset < a) { \
- HUnlock((Handle) mdev->pic); \
- SetHandleSize((Handle) mdev->pic, len + b); \
- if (MemError() != noErr) return gs_error_VMerror; \
- HLockHi((Handle) mdev->pic); \
- mdev->currPicPos = (short*) ((long) *mdev->pic + offset); \
- } \
- }
+ { \
+ long offset = (long) mdev->currPicPos - (long) *mdev->pic; \
+ long len = GetHandleSize((Handle) mdev->pic); \
+ if (len - offset < a) { \
+ HUnlock((Handle) mdev->pic); \
+ SetHandleSize((Handle) mdev->pic, len + b); \
+ if (MemError() != noErr) return gs_error_VMerror; \
+ HLockHi((Handle) mdev->pic); \
+ mdev->currPicPos = (short*) ((long) *mdev->pic + offset); \
+ } \
+ }
#define ResetPage() \
- { \
- if (mdev->outputPage) { \
- mdev->outputPage = false; \
- mdev->currPicPos = (short*) *mdev->pic; \
- mdev->currPicPos += 42; /* header len */ \
- mdev->lastFontID = mdev->lastFontSize = mdev->lastFontFace = -1; \
- mdev->numUsedFonts = 0; \
- } \
- }
-
+ { \
+ if (mdev->outputPage) { \
+ mdev->outputPage = false; \
+ mdev->currPicPos = (short*) *mdev->pic; \
+ mdev->currPicPos += 42; /* header len */ \
+ mdev->lastFontID = mdev->lastFontSize = mdev->lastFontFace = -1; \
+ mdev->numUsedFonts = 0; \
+ } \
+ }
/* Other datatypes */
typedef struct {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
+ unsigned short red;
+ unsigned short green;
+ unsigned short blue;
} colorRGB;
typedef struct {
- float h;
- float s;
- float v;
+ float h;
+ float s;
+ float v;
} colorHSV;
-
/* Helper function definitions */
static int mac_save_pict(gx_device * dev);
@@ -161,13 +153,12 @@ static void mac_convert_rgb_hsv(colorRGB *inRGB, colorHSV *HSV);
static void mac_convert_hsv_rgb(colorHSV *inHSV, colorRGB *RGB);
static void mac_find_font_family(ConstStringPtr fname, int len,
- FMFontFamily *fontFamilyID, FMFontStyle *fontFace);
+ FMFontFamily *fontFamilyID, FMFontStyle *fontFace);
static int mac_get_font_encoding(mac_xfont *macxf);
static void mac_get_font_resource(mac_xfont *macxf, ResType *resType, short *resID);
static int mac_set_colordepth(gx_device *dev, int depth);
-
/* additional DLL function definition */
#pragma export on
diff --git a/gs/base/gdevmacpictop.h b/gs/base/gdevmacpictop.h
index 9c6d8c129..10c7a5953 100644
--- a/gs/base/gdevmacpictop.h
+++ b/gs/base/gdevmacpictop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,6 @@
#include <QDOffscreen.h>
-
/************************/
/* PICT data structures */
/************************/
@@ -35,626 +34,615 @@
/* write a PICT opcode */
#define PICTWriteOpcode(ptr, op) PICTWriteInt(ptr, op);
-
/*****************************/
/* QuickDraw data structures */
/*****************************/
/* write a Point structure */
#define PICTWritePoint(ptr, h, v) \
- { \
- PICTWriteInt(ptr, v); /* vertical coordinate */ \
- PICTWriteInt(ptr, h); /* horizontal coordinate */ \
- }
+ { \
+ PICTWriteInt(ptr, v); /* vertical coordinate */ \
+ PICTWriteInt(ptr, h); /* horizontal coordinate */ \
+ }
/* write a Rect structure */
#define PICTWriteRect(ptr, x, y, w, h) \
- { \
- PICTWritePoint(ptr, x, y); /* upper-left corner */ \
- PICTWritePoint(ptr, x+w, y+h); /* lower-right corner */ \
- }
+ { \
+ PICTWritePoint(ptr, x, y); /* upper-left corner */ \
+ PICTWritePoint(ptr, x+w, y+h); /* lower-right corner */ \
+ }
/* write a rectangular Region structure */
#define PICTWriteRegionRectangular(ptr, x, y, w, h) \
- { \
- PICTWriteInt(ptr, 10); /* rgnSize */ \
- PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
- }
+ { \
+ PICTWriteInt(ptr, 10); /* rgnSize */ \
+ PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
+ }
/* write a non-rectangular Region structure */
#define PICTWriteRegion(ptr, x, y, b, h, size, dataptr) \
- { \
- PICTWriteInt(ptr, 10+size); /* rgnSize */ \
- PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
- memcpy(ptr, dataptr, size); /* additional data */ \
- ((char*)(ptr)) += size; \
- }
+ { \
+ PICTWriteInt(ptr, 10+size); /* rgnSize */ \
+ PICTWriteRect(ptr, x, y, w, h); /* rgnBBox */ \
+ memcpy(ptr, dataptr, size); /* additional data */ \
+ ((char*)(ptr)) += size; \
+ }
/* write a pattern */
#define PICTWritePattern(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
- { \
- PICTWriteByte(ptr, byte1); /* pattern */ \
- PICTWriteByte(ptr, byte2); /* pattern */ \
- PICTWriteByte(ptr, byte3); /* pattern */ \
- PICTWriteByte(ptr, byte4); /* pattern */ \
- PICTWriteByte(ptr, byte5); /* pattern */ \
- PICTWriteByte(ptr, byte6); /* pattern */ \
- PICTWriteByte(ptr, byte7); /* pattern */ \
- PICTWriteByte(ptr, byte8); /* pattern */ \
- }
+ { \
+ PICTWriteByte(ptr, byte1); /* pattern */ \
+ PICTWriteByte(ptr, byte2); /* pattern */ \
+ PICTWriteByte(ptr, byte3); /* pattern */ \
+ PICTWriteByte(ptr, byte4); /* pattern */ \
+ PICTWriteByte(ptr, byte5); /* pattern */ \
+ PICTWriteByte(ptr, byte6); /* pattern */ \
+ PICTWriteByte(ptr, byte7); /* pattern */ \
+ PICTWriteByte(ptr, byte8); /* pattern */ \
+ }
/* write a RGBColor structure */
#define PICTWriteRGBColor(ptr, r, g, b) \
- { \
- PICTWriteInt(ptr, r); /* red */ \
- PICTWriteInt(ptr, g); /* green */ \
- PICTWriteInt(ptr, b); /* blue */ \
- }
+ { \
+ PICTWriteInt(ptr, r); /* red */ \
+ PICTWriteInt(ptr, g); /* green */ \
+ PICTWriteInt(ptr, b); /* blue */ \
+ }
/* write a ColorSpec structure */
#define PICTWriteColorSpec(ptr, value, r, g, b) \
- { \
- PICTWriteInt(ptr, value); /* value */ \
- PICTWriteRGBColor(ptr, r, g, b); /* color */ \
- }
+ { \
+ PICTWriteInt(ptr, value); /* value */ \
+ PICTWriteRGBColor(ptr, r, g, b); /* color */ \
+ }
/* write a ColorTable structure */
#define PICTWriteColorTable(ptr, seed, numEntries, cspecarr) \
- { \
- int i; \
- PICTWriteLong(ptr, seed); /* ctSeed */ \
- PICTWriteInt(ptr, 0); /* ctFlags */ \
- PICTWriteInt(ptr, numEntries-1); /* ctSize */ \
- for (i=0; i<numEntries; i++) /* ctTable */ \
- PICTWriteColorSpec(ptr, cspecarr[i].value, \
- cspecarr[i].rgb.red, \
- cspecarr[i].rgb.green, \
- cspecarr[i].rgb.blue); \
- }
+ { \
+ int i; \
+ PICTWriteLong(ptr, seed); /* ctSeed */ \
+ PICTWriteInt(ptr, 0); /* ctFlags */ \
+ PICTWriteInt(ptr, numEntries-1); /* ctSize */ \
+ for (i=0; i<numEntries; i++) /* ctTable */ \
+ PICTWriteColorSpec(ptr, cspecarr[i].value, \
+ cspecarr[i].rgb.red, \
+ cspecarr[i].rgb.green, \
+ cspecarr[i].rgb.blue); \
+ }
/* write a PixMap structure */
#define PICTWritePixMap(ptr, x, y, w, h, rowBytes, \
- packType, packSize, \
- hRes, vRes, pixelSize) \
- { \
- PICTWriteInt(ptr, 0x8000+rowBytes); /* rowBytes */ \
- PICTWriteRect(ptr, x, y, w, h); /* bounds */ \
- PICTWriteInt(ptr, 0); /* pmVersion */ \
- PICTWriteInt(ptr, packType); /* packType */ \
- PICTWriteLong(ptr, (packType ? packSize : 0)); /* packSize */ \
- PICTWriteLong(ptr, hRes); /* hRes */ \
- PICTWriteLong(ptr, vRes); /* vRes */ \
- if (pixelSize < 16) { /* indexed */ \
- PICTWriteInt(ptr, 0); /* pixelType */ \
- PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
- PICTWriteInt(ptr, 1); /* cmpCount */ \
- PICTWriteInt(ptr, pixelSize); /* cmpSize */ \
- } else { /* direct */ \
- PICTWriteInt(ptr, RGBDirect); /* pixelType */ \
- PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
- PICTWriteInt(ptr, 3); /* cmpCount */ \
- PICTWriteInt(ptr, (pixelSize==16 ? 5 : 8)); /* cmpSize */ \
- } \
- PICTWriteLong(ptr, 0); /* planeBytes */ \
- PICTWriteLong(ptr, 0); /* pmTable */ \
- PICTWriteLong(ptr, 0); /* pmReserved */ \
- }
+ packType, packSize, \
+ hRes, vRes, pixelSize) \
+ { \
+ PICTWriteInt(ptr, 0x8000+rowBytes); /* rowBytes */ \
+ PICTWriteRect(ptr, x, y, w, h); /* bounds */ \
+ PICTWriteInt(ptr, 0); /* pmVersion */ \
+ PICTWriteInt(ptr, packType); /* packType */ \
+ PICTWriteLong(ptr, (packType ? packSize : 0)); /* packSize */ \
+ PICTWriteLong(ptr, hRes); /* hRes */ \
+ PICTWriteLong(ptr, vRes); /* vRes */ \
+ if (pixelSize < 16) { /* indexed */ \
+ PICTWriteInt(ptr, 0); /* pixelType */ \
+ PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
+ PICTWriteInt(ptr, 1); /* cmpCount */ \
+ PICTWriteInt(ptr, pixelSize); /* cmpSize */ \
+ } else { /* direct */ \
+ PICTWriteInt(ptr, RGBDirect); /* pixelType */ \
+ PICTWriteInt(ptr, pixelSize); /* pixelSize */ \
+ PICTWriteInt(ptr, 3); /* cmpCount */ \
+ PICTWriteInt(ptr, (pixelSize==16 ? 5 : 8)); /* cmpSize */ \
+ } \
+ PICTWriteLong(ptr, 0); /* planeBytes */ \
+ PICTWriteLong(ptr, 0); /* pmTable */ \
+ PICTWriteLong(ptr, 0); /* pmReserved */ \
+ }
/* write PackBits data */
#define PICTWriteDataPackBits(ptr, base, rowBytes, lines) \
- { \
- short byteCount; \
- if (raster < 8) { /* data uncompressed */ \
- byteCount = rowBytes * lines; \
- memcpy(ptr, base, byteCount); /* bitmap data */ \
- (char*)(ptr) += byteCount; \
- } else { /* raster >= 8 use PackBits compression */ \
- Ptr destBufBegin = (Ptr) malloc(raster + (raster+126)/127), destBuf, \
- srcBuf = (Ptr) base; \
- short i, len; \
- \
- byteCount = 0; \
- for (i=0; i<lines; i++) { \
- destBuf = destBufBegin; \
- PackBits(&srcBuf, &destBuf, rowBytes); \
- len = destBuf - destBufBegin; \
- if (rowBytes > 250) { \
- PICTWriteInt(ptr, len); \
- byteCount += 2; \
- } else { \
- PICTWriteByte(ptr, len); \
- byteCount++; \
- } \
- \
- memcpy(ptr, destBufBegin, len); \
- (char*)(ptr) += len; \
- byteCount += len; \
- } \
- free(destBufBegin); \
- } \
- \
- if (byteCount % 2) \
- PICTWriteFillByte(ptr); \
- }
+ { \
+ short byteCount; \
+ if (raster < 8) { /* data uncompressed */ \
+ byteCount = rowBytes * lines; \
+ memcpy(ptr, base, byteCount); /* bitmap data */ \
+ (char*)(ptr) += byteCount; \
+ } else { /* raster >= 8 use PackBits compression */ \
+ Ptr destBufBegin = (Ptr) malloc(raster + (raster+126)/127), destBuf, \
+ srcBuf = (Ptr) base; \
+ short i, len; \
+ \
+ byteCount = 0; \
+ for (i=0; i<lines; i++) { \
+ destBuf = destBufBegin; \
+ PackBits(&srcBuf, &destBuf, rowBytes); \
+ len = destBuf - destBufBegin; \
+ if (rowBytes > 250) { \
+ PICTWriteInt(ptr, len); \
+ byteCount += 2; \
+ } else { \
+ PICTWriteByte(ptr, len); \
+ byteCount++; \
+ } \
+ \
+ memcpy(ptr, destBufBegin, len); \
+ (char*)(ptr) += len; \
+ byteCount += len; \
+ } \
+ free(destBufBegin); \
+ } \
+ \
+ if (byteCount % 2) \
+ PICTWriteFillByte(ptr); \
+ }
/* write text */
#define PICTWriteText(ptr, textptr /* pascal string*/) \
- { \
- memcpy(ptr, textptr, textptr[0]+1); /* copy string */ \
- (char*)(ptr) += textptr[0]+1; \
- }
-
-
+ { \
+ memcpy(ptr, textptr, textptr[0]+1); /* copy string */ \
+ (char*)(ptr) += textptr[0]+1; \
+ }
/****************/
/* PICT Opcodes */
/****************/
-
#define PICT_NOP(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0000); /* NOP opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0000); /* NOP opcode */ \
+ }
#define PICT_Clip_Rectangular(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
- PICTWriteRegionRectangular(ptr, x, y, w, h); /* clipRgn */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
+ PICTWriteRegionRectangular(ptr, x, y, w, h); /* clipRgn */ \
+ }
#define PICT_Clip(ptr, x, y, w, h, size, dataptr) \
- { \
- PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
- PICTWriteRegion(ptr, x, y, w, h, size, dataptr); /* clipRgn */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0001); /* Clip opcode */ \
+ PICTWriteRegion(ptr, x, y, w, h, size, dataptr); /* clipRgn */ \
+ }
#define PICT_BkPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
- { \
- PICTWriteOpcode(ptr, 0x0002); /* BkPat opcode */ \
- PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
- byte5, byte6, byte7, byte8); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0002); /* BkPat opcode */ \
+ PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
+ byte5, byte6, byte7, byte8); \
+ }
#define PICT_TxFont(ptr, font) \
- { \
- PICTWriteOpcode(ptr, 0x0003); /* TxFont opcode */ \
- PICTWriteInt(ptr, font); /* Font number */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0003); /* TxFont opcode */ \
+ PICTWriteInt(ptr, font); /* Font number */ \
+ }
#define PICT_TxFace(ptr, style) \
- { \
- PICTWriteOpcode(ptr, 0x0004); /* TxFace opcode */ \
- PICTWriteByte(ptr, style); /* Font style */ \
- PICTWriteFillByte(ptr); /* Fill byte */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0004); /* TxFace opcode */ \
+ PICTWriteByte(ptr, style); /* Font style */ \
+ PICTWriteFillByte(ptr); /* Fill byte */ \
+ }
#define PICT_TxMode(ptr, mode) \
- { \
- PICTWriteOpcode(ptr, 0x0005); /* TxMode opcode */ \
- PICTWriteInt(ptr, mode); /* Source mode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0005); /* TxMode opcode */ \
+ PICTWriteInt(ptr, mode); /* Source mode */ \
+ }
#define PICT_PnSize(ptr, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0006); /* PnSize opcode */ \
- PICTWritePoint(w, h); /* Pen size */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0006); /* PnSize opcode */ \
+ PICTWritePoint(w, h); /* Pen size */ \
+ }
#define PICT_PnMode(ptr, mode) \
- { \
- PICTWriteOpcode(ptr, 0x0007); /* PnMode opcode */ \
- PICTWriteInt(ptr, mode); /* Pen mode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0007); /* PnMode opcode */ \
+ PICTWriteInt(ptr, mode); /* Pen mode */ \
+ }
#define PICT_PnPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
- { \
- PICTWriteOpcode(ptr, 0x0009); /* PnPat opcode */ \
- PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
- byte5, byte6, byte7, byte8); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0009); /* PnPat opcode */ \
+ PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
+ byte5, byte6, byte7, byte8); \
+ }
#define PICT_FillPat(ptr, byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8) \
- { \
- PICTWriteOpcode(ptr, 0x000A); /* FillPat opcode */ \
- PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
- byte5, byte6, byte7, byte8); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000A); /* FillPat opcode */ \
+ PICTWritePattern(ptr, byte1, byte2, byte3, byte4, /* Pattern data */ \
+ byte5, byte6, byte7, byte8); \
+ }
#define PICT_OvSize(ptr, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x000B); /* OvSize opcode */ \
- PICTWritePoint(w, h); /* Oval size */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000B); /* OvSize opcode */ \
+ PICTWritePoint(w, h); /* Oval size */ \
+ }
#define PICT_Origin(ptr, dh, dv) \
- { \
- PICTWriteOpcode(ptr, 0x000C); /* Origin opcode */ \
- PICTWriteInt(ptr, dh); /* dh */ \
- PICTWriteInt(ptr, dv); /* dv */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000C); /* Origin opcode */ \
+ PICTWriteInt(ptr, dh); /* dh */ \
+ PICTWriteInt(ptr, dv); /* dv */ \
+ }
#define PICT_TxSize(ptr, size) \
- { \
- PICTWriteOpcode(ptr, 0x000D); /* TxSize opcode */ \
- PICTWriteInt(ptr, size); /* Text Size */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000D); /* TxSize opcode */ \
+ PICTWriteInt(ptr, size); /* Text Size */ \
+ }
#define PICT_FgColor(ptr, color) \
- { \
- PICTWriteOpcode(ptr, 0x000E); /* FgColor opcode */ \
- PICTWriteLong(ptr, color); /* Foreground color */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000E); /* FgColor opcode */ \
+ PICTWriteLong(ptr, color); /* Foreground color */ \
+ }
#define PICT_BkColor(ptr, color) \
- { \
- PICTWriteOpcode(ptr, 0x000F); /* BkColor opcode */ \
- PICTWriteLong(ptr, color); /* Background color */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x000F); /* BkColor opcode */ \
+ PICTWriteLong(ptr, color); /* Background color */ \
+ }
#define PICT_TxRatio(ptr, num, denom) \
- { \
- PICTWriteOpcode(ptr, 0x0010); /* TxRatio opcode */ \
- PICTWritePoint(ptr, num); /* Numerator (Point) */ \
- PICTWritePoint(ptr, denom); /* Denominator (Point) */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0010); /* TxRatio opcode */ \
+ PICTWritePoint(ptr, num); /* Numerator (Point) */ \
+ PICTWritePoint(ptr, denom); /* Denominator (Point) */ \
+ }
#define PICT_VersionOp(ptr, version) \
- { \
- PICTWriteOpcode(ptr, 0x0011); /* VersionOp opcode */ \
- PICTWriteByte(ptr, version); /* Version */ \
- PICTWriteFillByte(ptr); /* Fill byte */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0011); /* VersionOp opcode */ \
+ PICTWriteByte(ptr, version); /* Version */ \
+ PICTWriteFillByte(ptr); /* Fill byte */ \
+ }
#define PICT_RGBFgCol(ptr, r, g, b) \
- { \
- PICTWriteOpcode(ptr, 0x001A); /* RGBFgCol opcode */ \
- PICTWriteRGBColor(ptr, r, g, b); /* Foreground color */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001A); /* RGBFgCol opcode */ \
+ PICTWriteRGBColor(ptr, r, g, b); /* Foreground color */ \
+ }
#define PICT_RGBBkCol(ptr, r, g, b) \
- { \
- PICTWriteOpcode(ptr, 0x001B); /* RGBBkCol opcode */ \
- PICTWriteRGBColor(ptr, r, g, b); /* Background color */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001B); /* RGBBkCol opcode */ \
+ PICTWriteRGBColor(ptr, r, g, b); /* Background color */ \
+ }
#define PICT_HiliteMode(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x001C); /* HiliteMode opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001C); /* HiliteMode opcode */ \
+ }
#define PICT_HiliteColor(ptr, r, g, b) \
- { \
- PICTWriteOpcode(ptr, 0x001D); /* HiliteColor opcode */ \
- PICTWriteRGBColor(ptr, r, g, b); /* Highlight color */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001D); /* HiliteColor opcode */ \
+ PICTWriteRGBColor(ptr, r, g, b); /* Highlight color */ \
+ }
#define PICT_DefHilite(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x001E); /* DefHilite opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001E); /* DefHilite opcode */ \
+ }
#define PICT_OpColor(ptr, r, g, b) \
- { \
- PICTWriteOpcode(ptr, 0x001F); /* OpColor opcode */ \
- PICTWriteRGBColor(ptr, r, g, b); /* Opcolor */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x001F); /* OpColor opcode */ \
+ PICTWriteRGBColor(ptr, r, g, b); /* Opcolor */ \
+ }
#define PICT_Line(ptr, x0, y0, x1, y1) \
- { \
- PICTWriteOpcode(ptr, 0x0020); /* Line opcode */ \
- PICTWritePoint(ptr, x0, y0); /* pnLoc */ \
- PICTWritePoint(ptr, x1, y1); /* newPt */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0020); /* Line opcode */ \
+ PICTWritePoint(ptr, x0, y0); /* pnLoc */ \
+ PICTWritePoint(ptr, x1, y1); /* newPt */ \
+ }
#define PICT_LineFrom(ptr, x, y) \
- { \
- PICTWriteOpcode(ptr, 0x0021); /* LineFrom opcode */ \
- PICTWritePoint(ptr, x, y); /* newPt */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0021); /* LineFrom opcode */ \
+ PICTWritePoint(ptr, x, y); /* newPt */ \
+ }
#define PICT_ShortLine(ptr, x, y, dh, dv) \
- { \
- PICTWriteOpcode(ptr, 0x0022); /* ShortLine opcode */ \
- PICTWritePoint(ptr, x, y); /* pnLoc */ \
- PICTWriteByte(ptr, dh); /* dh */ \
- PICTWriteByte(ptr, dv); /* dv */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0022); /* ShortLine opcode */ \
+ PICTWritePoint(ptr, x, y); /* pnLoc */ \
+ PICTWriteByte(ptr, dh); /* dh */ \
+ PICTWriteByte(ptr, dv); /* dv */ \
+ }
#define PICT_ShortLineFrom(ptr, dh, dv) \
- { \
- PICTWriteOpcode(ptr, 0x0023); /* ShortLineFrom opcode */ \
- PICTWriteByte(ptr, dh); /* dh */ \
- PICTWriteByte(ptr, dv); /* dv */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0023); /* ShortLineFrom opcode */ \
+ PICTWriteByte(ptr, dh); /* dh */ \
+ PICTWriteByte(ptr, dv); /* dv */ \
+ }
#define PICT_LongText(ptr, x, y, textptr /* pascal string */) \
- { \
- PICTWriteOpcode(ptr, 0x0028); /* LongText opcode */ \
- PICTWritePoint(ptr, x, y); /* Point */ \
- PICTWriteText(ptr, textptr); /* text */ \
- if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0028); /* LongText opcode */ \
+ PICTWritePoint(ptr, x, y); /* Point */ \
+ PICTWriteText(ptr, textptr); /* text */ \
+ if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
+ }
#define PICT_DHText(ptr, dh, textptr /* pascal string */) \
- { \
- PICTWriteOpcode(ptr, 0x0029); /* DHText opcode */ \
- PICTWriteByte(ptr, dh); /* dh */ \
- PICTWriteText(ptr, textptr); /* text */ \
- if (textptr[0] % 2) PICTWriteFillByte(ptr); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0029); /* DHText opcode */ \
+ PICTWriteByte(ptr, dh); /* dh */ \
+ PICTWriteText(ptr, textptr); /* text */ \
+ if (textptr[0] % 2) PICTWriteFillByte(ptr); \
+ }
#define PICT_DVText(ptr, dv, textptr /* pascal string */) \
- { \
- PICTWriteOpcode(ptr, 0x002A); /* DVText opcode */ \
- PICTWriteByte(ptr, dv); /* dv */ \
- PICTWriteText(ptr, textptr); /* text */ \
- if (textptr[0] % 2) PICTWriteFillByte(ptr); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x002A); /* DVText opcode */ \
+ PICTWriteByte(ptr, dv); /* dv */ \
+ PICTWriteText(ptr, textptr); /* text */ \
+ if (textptr[0] % 2) PICTWriteFillByte(ptr); \
+ }
#define PICT_DHDVText(ptr, dh, dv, textptr /* pascal string */) \
- { \
- PICTWriteOpcode(ptr, 0x002B); /* DHDVText opcode */ \
- PICTWriteByte(ptr, dh); /* dh */ \
- PICTWriteByte(ptr, dv); /* dv */ \
- PICTWriteText(ptr, textptr); /* text */ \
- if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x002B); /* DHDVText opcode */ \
+ PICTWriteByte(ptr, dh); /* dh */ \
+ PICTWriteByte(ptr, dv); /* dv */ \
+ PICTWriteText(ptr, textptr); /* text */ \
+ if ((textptr[0]+1) % 2) PICTWriteFillByte(ptr); \
+ }
#define PICT_fontName(ptr, id, nameptr /* pascal string */) \
- { \
- PICTWriteOpcode(ptr, 0x002C); /* fontName opcode */ \
- PICTWriteInt(ptr, nameptr[0]+1+2); /* data length */ \
- PICTWriteInt(ptr, id); /* font id */ \
- PICTWriteText(ptr, nameptr); /* text */ \
- if ((nameptr[0]+1) % 2) PICTWriteFillByte(ptr); \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x002C); /* fontName opcode */ \
+ PICTWriteInt(ptr, nameptr[0]+1+2); /* data length */ \
+ PICTWriteInt(ptr, id); /* font id */ \
+ PICTWriteText(ptr, nameptr); /* text */ \
+ if ((nameptr[0]+1) % 2) PICTWriteFillByte(ptr); \
+ }
#define PICT_frameRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0030); /* frameRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0030); /* frameRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_paintRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0031); /* paintRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0031); /* paintRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_eraseRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0032); /* eraseRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0032); /* eraseRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_invertRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0033); /* invertRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0033); /* invertRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_fillRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0034); /* fillRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0034); /* fillRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_frameSameRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0038); /* frameSameRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0038); /* frameSameRect opcode */ \
+ }
#define PICT_paintSameRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0039); /* paintSameRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0039); /* paintSameRect opcode */ \
+ }
#define PICT_eraseSameRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x003A); /* eraseSameRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x003A); /* eraseSameRect opcode */ \
+ }
#define PICT_invertSameRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x003B); /* invertSameRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x003B); /* invertSameRect opcode */ \
+ }
#define PICT_fillSameRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x003C); /* fillSameRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x003C); /* fillSameRect opcode */ \
+ }
#define PICT_frameRRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0040); /* frameRRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0040); /* frameRRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_paintRRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0041); /* paintRRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0041); /* paintRRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_eraseRRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0042); /* eraseRRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0042); /* eraseRRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_invertRRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0043); /* invertRRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0043); /* invertRRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_fillRRect(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0044); /* fillRRect opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0044); /* fillRRect opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_frameSameRRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0048); /* frameSameRRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0048); /* frameSameRRect opcode */ \
+ }
#define PICT_paintSameRRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0049); /* paintSameRRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0049); /* paintSameRRect opcode */ \
+ }
#define PICT_eraseSameRRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x004A); /* eraseSameRRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x004A); /* eraseSameRRect opcode */ \
+ }
#define PICT_invertSameRRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x004B); /* invertSameRRect opcode */\
- }
+ { \
+ PICTWriteOpcode(ptr, 0x004B); /* invertSameRRect opcode */\
+ }
#define PICT_fillSameRRect(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x004C); /* fillSameRRect opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x004C); /* fillSameRRect opcode */ \
+ }
#define PICT_frameOval(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0050); /* frameOval opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0050); /* frameOval opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_paintOval(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0051); /* paintOval opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0051); /* paintOval opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_eraseOval(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0052); /* eraseOval opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0052); /* eraseOval opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_invertOval(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0053); /* invertOval opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0053); /* invertOval opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_fillOval(ptr, x, y, w, h) \
- { \
- PICTWriteOpcode(ptr, 0x0054); /* fillOval opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0054); /* fillOval opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ }
#define PICT_frameSameOval(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0058); /* frameSameOval opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0058); /* frameSameOval opcode */ \
+ }
#define PICT_paintSameOval(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x0059); /* paintSameOval opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0059); /* paintSameOval opcode */ \
+ }
#define PICT_eraseSameOval(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x005A); /* eraseSameOval opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x005A); /* eraseSameOval opcode */ \
+ }
#define PICT_invertSameOval(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x005B); /* invertSameOval opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x005B); /* invertSameOval opcode */ \
+ }
#define PICT_fillSameOval(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x005C); /* fillSameOval opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x005C); /* fillSameOval opcode */ \
+ }
#define PICT_frameArc(ptr, x, y, w, h, startAngle, arcAngle) \
- { \
- PICTWriteOpcode(ptr, 0x0060); /* frameArc opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- PICTWriteInt(ptr, startAngle); /* startAngle */ \
- PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0060); /* frameArc opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ PICTWriteInt(ptr, startAngle); /* startAngle */ \
+ PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
+ }
#define PICT_paintArc(ptr, x, y, w, h, startAngle, arcAngle) \
- { \
- PICTWriteOpcode(ptr, 0x0061); /* paintArc opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- PICTWriteInt(ptr, startAngle); /* startAngle */ \
- PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0061); /* paintArc opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ PICTWriteInt(ptr, startAngle); /* startAngle */ \
+ PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
+ }
#define PICT_eraseArc(ptr, x, y, w, h, startAngle, arcAngle) \
- { \
- PICTWriteOpcode(ptr, 0x0062); /* eraseArc opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- PICTWriteInt(ptr, startAngle); /* startAngle */ \
- PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0062); /* eraseArc opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ PICTWriteInt(ptr, startAngle); /* startAngle */ \
+ PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
+ }
#define PICT_invertArc(ptr, x, y, w, h, startAngle, arcAngle) \
- { \
- PICTWriteOpcode(ptr, 0x0063); /* invertArc opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- PICTWriteInt(ptr, startAngle); /* startAngle */ \
- PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0063); /* invertArc opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ PICTWriteInt(ptr, startAngle); /* startAngle */ \
+ PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
+ }
#define PICT_fillArc(ptr, x, y, w, h, startAngle, arcAngle) \
- { \
- PICTWriteOpcode(ptr, 0x0064); /* fillArc opcode */ \
- PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
- PICTWriteInt(ptr, startAngle); /* startAngle */ \
- PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0064); /* fillArc opcode */ \
+ PICTWriteRect(ptr, x, y, w, h); /* Rectangle */ \
+ PICTWriteInt(ptr, startAngle); /* startAngle */ \
+ PICTWriteInt(ptr, arcAngle); /* arcAngle */ \
+ }
/* use only with rowBytes < 8 !! */
#define PICT_BitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, dataPtr) \
- { \
- PICTWriteOpcode(ptr, 0x0090); /* BitsRect opcode */ \
- PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
- PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
- PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
- PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
- PICTWriteInt(ptr, mode); /* mode */ \
- memcpy(ptr, dataPtr, h0*rowBytes); /* BitMap data */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x0090); /* BitsRect opcode */ \
+ PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
+ PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
+ PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
+ PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
+ PICTWriteInt(ptr, mode); /* mode */ \
+ memcpy(ptr, dataPtr, h0*rowBytes); /* BitMap data */ \
+ }
#define PICT_PackBitsRect_BitMap(ptr, x0, y0, w0, h0, x1, y1, w1, h1, rowBytes, mode, \
- dataPtr, size) \
- { \
- PICTWriteOpcode(ptr, 0x0098); /* PackBitsRect opcode */ \
- PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
- PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
- PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
- PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
- PICTWriteInt(ptr, mode); /* mode */ \
- memcpy(ptr, dataPtr, size); /* BitMap data */ \
- }
+ dataPtr, size) \
+ { \
+ PICTWriteOpcode(ptr, 0x0098); /* PackBitsRect opcode */ \
+ PICTWriteInt(ptr, rowBytes); /* rowBytes */ \
+ PICTWriteRect(ptr, x1, y1, w1, h1); /* bounds x1???? */ \
+ PICTWriteRect(ptr, x0, y0, w0, h0); /* srcRect */ \
+ PICTWriteRect(ptr, x1, y1, w1, h1); /* dstRect */ \
+ PICTWriteInt(ptr, mode); /* mode */ \
+ memcpy(ptr, dataPtr, size); /* BitMap data */ \
+ }
#define PICT_OpEndPic(ptr) \
- { \
- PICTWriteOpcode(ptr, 0x00FF); /* OpEndPic opcode */ \
- }
+ { \
+ PICTWriteOpcode(ptr, 0x00FF); /* OpEndPic opcode */ \
+ }
/* same as PICT_OpEndPic, but doesn't move pointer */
#define PICT_OpEndPicGoOn(ptr) \
- { \
- *(ptr) = 0x00FF; /* OpEndPic opcode */ \
- }
-
-
-
-
-
-
-
+ { \
+ *(ptr) = 0x00FF; /* OpEndPic opcode */ \
+ }
/******************************/
/* ghostscript to PICT macros */
@@ -662,23 +650,23 @@
/* set forground color to black and background color to white */
#define GSSetStdCol(ptr) \
- { \
- PICT_RGBFgCol(ptr, 0x0000, 0x0000, 0x0000); /* black */ \
- PICT_RGBBkCol(ptr, 0xFFFF, 0xFFFF, 0xFFFF); /* white */ \
- }
+ { \
+ PICT_RGBFgCol(ptr, 0x0000, 0x0000, 0x0000); /* black */ \
+ PICT_RGBBkCol(ptr, 0xFFFF, 0xFFFF, 0xFFFF); /* white */ \
+ }
#define GSSetFgCol(dev, ptr, col) \
- { \
- gx_color_value rgb[3]; \
- (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
- PICT_RGBFgCol(ptr, rgb[0], rgb[1], rgb[2]); \
- }
+ { \
+ gx_color_value rgb[3]; \
+ (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
+ PICT_RGBFgCol(ptr, rgb[0], rgb[1], rgb[2]); \
+ }
#define GSSetBkCol(dev, ptr, col) \
- { \
- gx_color_value rgb[3]; \
- (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
- PICT_RGBBkCol(ptr, rgb[0], rgb[1], rgb[2]); \
- }
+ { \
+ gx_color_value rgb[3]; \
+ (*dev_proc(dev, map_color_rgb))(dev, col, rgb); \
+ PICT_RGBBkCol(ptr, rgb[0], rgb[1], rgb[2]); \
+ }
#endif /* gdevmacpictop_INCLUDED */
diff --git a/gs/base/gdevmacttf.h b/gs/base/gdevmacttf.h
index 9316e87d3..46f9242e1 100644
--- a/gs/base/gdevmacttf.h
+++ b/gs/base/gdevmacttf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,48 +16,41 @@
#ifndef gdevmacttf_INCLUDED
# define gdevmacttf_INCLUDED
-
/* Font Directory Component */
typedef struct {
- UInt32 tagName;
- UInt32 checkSum;
- UInt32 offset;
- UInt32 length;
+ UInt32 tagName;
+ UInt32 checkSum;
+ UInt32 offset;
+ UInt32 length;
} TTFontDirComponent;
-
-
/* Font Directory */
typedef struct {
- UInt32 version;
- UInt16 numTables;
- UInt16 searchRange;
- UInt16 entrySelector;
- UInt16 rangeShift;
- TTFontDirComponent components[1]; /* an array of numTables components */
+ UInt32 version;
+ UInt16 numTables;
+ UInt16 searchRange;
+ UInt16 entrySelector;
+ UInt16 rangeShift;
+ TTFontDirComponent components[1]; /* an array of numTables components */
} TTFontDir;
-
-
/* Tag definitions */
#define TTF_FONT_NAMING_TABLE 'name'
-
-
/* Font Naming Table */
typedef struct {
- UInt16 formatSelector;
- UInt16 numNames;
- UInt16 stringAreaOffset;
- UInt16 platformID;
- UInt16 platformSpecificID;
- UInt16 languageID;
- UInt16 nameID;
- UInt16 length;
- UInt16 offset;
+ UInt16 formatSelector;
+ UInt16 numNames;
+ UInt16 stringAreaOffset;
+ UInt16 platformID;
+ UInt16 platformSpecificID;
+ UInt16 languageID;
+ UInt16 nameID;
+ UInt16 length;
+ UInt16 offset;
} TTFontNamingTable;
#endif /* gdevmacttf_INCLUDED */
diff --git a/gs/base/gdevmacxf.c b/gs/base/gdevmacxf.c
index 0e3afd9d7..120120009 100644
--- a/gs/base/gdevmacxf.c
+++ b/gs/base/gdevmacxf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,7 +16,6 @@
#include "gdevmac.h"
#include "gdevmacttf.h"
-
/* if set to 1, new carbon supported FontManager calls are used */
/* if set to 0, old FM calls that are "not recommended" for carbon are used */
/* for now, we'll set it to 0, as classic and carbon targets don't generate link errors, */
@@ -24,12 +23,9 @@
/* In the case that it is set, the classic target should link in FontManager(Lib) */
#define USE_RECOMMENDED_CARBON_FONTMANAGER_CALLS 1
-
-
extern const byte gs_map_std_to_iso[256];
extern const byte gs_map_iso_to_std[256];
-
const byte gs_map_std_to_mac[256] =
{
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
@@ -80,10 +76,6 @@ const byte gs_map_mac_to_iso[256] =
{
};
-
-
-
-
/* The xfont procedure record. */
static const gx_xfont_procs mac_xfont_procs =
@@ -95,13 +87,8 @@ static const gx_xfont_procs mac_xfont_procs =
mac_release
};
-
gs_private_st_dev_ptrs1(st_mac_xfont, mac_xfont, "mac_xfont", mac_xfont_enum_ptrs,
- mac_xfont_reloc_ptrs, dev);
-
-
-
-
+ mac_xfont_reloc_ptrs, dev);
/* Return the xfont procedure record. */
@@ -112,344 +99,326 @@ mac_get_xfont_procs(gx_device *dev)
return &mac_xfont_procs;
}
-
-
/* lookup_font */
static gx_xfont *
mac_lookup_font(gx_device *dev, const byte *fname, uint len,
- int encoding_index, const gs_uid *puid,
- const gs_matrix *pmat, gs_memory_t *mem)
+ int encoding_index, const gs_uid *puid,
+ const gs_matrix *pmat, gs_memory_t *mem)
{
#pragma unused(encoding_index,puid)
- mac_xfont *macxf;
-
- CGrafPort *currentPort;
- int txFont, txSize, txMode;
- StyleField txFace;
- Fixed spExtra;
-
- /* are XFonts enabled? */
- if (((gx_device_macos*) dev)->useXFonts == false)
- return NULL;
-
- /* we can handle only requests from these encodings */
- if (encoding_index != ENCODING_INDEX_MACROMAN && encoding_index != ENCODING_INDEX_ISOLATIN1 &&
- encoding_index != ENCODING_INDEX_STANDARD)
- return NULL;
-
- /* Don't render very small fonts */
- if (fabs(pmat->xx * 1000.0) < 3.0)
- return NULL;
-
- /* Only handle simple cases for now (no transformations). */
- if (fabs(pmat->xy) > 0.0001 || fabs(pmat->yx) > 0.0001 || pmat->xx <= 0)
- return NULL;
-
- /* allocate memory for gx_xfont */
- macxf = gs_alloc_struct(mem, mac_xfont, &st_mac_xfont, "mac_lookup_font");
- if (macxf == NULL) {
- return NULL;
- }
-
- /* set default values */
- macxf->common.procs = &mac_xfont_procs;
- macxf->dev = dev;
-
- /* find the specified font */
- mac_find_font_family(fname, len, &(macxf->fontID), &(macxf->fontFace));
-
- /* no font found */
- if (macxf->fontID == 0)
- return NULL;
-
- FMGetFontFamilyName(macxf->fontID, macxf->fontName);
- macxf->fontSize = (short)(pmat->xx * 1000.0);
- macxf->fontEncoding = mac_get_font_encoding(macxf);
-
- /* we can handle only fonts with these encodings for now (all original Mac fonts have MacRoman encoding!) */
- if (macxf->fontEncoding != ENCODING_INDEX_MACROMAN && macxf->fontEncoding != ENCODING_INDEX_ISOLATIN1)
- return NULL;
-
- /* get font metrics */
-
- /* save current GrafPort's font information */
- GetPort(&((GrafPort*) currentPort));
- txFont = currentPort->txFont;
- txSize = currentPort->txSize;
- txFace = currentPort->txFace;
- txMode = currentPort->txMode;
- spExtra = currentPort->spExtra;
-
- /* set values for measuring */
- TextFont(macxf->fontID);
- TextSize(macxf->fontSize);
- TextFace(macxf->fontFace);
- TextMode(srcOr);
- SpaceExtra(0);
-
- /* measure font */
- FontMetrics(&(macxf->fontMetrics));
-
- /* restore current GrafPort's font information */
- currentPort->txFont = txFont;
- currentPort->txSize = txSize;
- currentPort->txFace = txFace;
- currentPort->txMode = txMode;
- currentPort->spExtra = spExtra;
-
- return (gx_xfont*) macxf;
+ mac_xfont *macxf;
+
+ CGrafPort *currentPort;
+ int txFont, txSize, txMode;
+ StyleField txFace;
+ Fixed spExtra;
+
+ /* are XFonts enabled? */
+ if (((gx_device_macos*) dev)->useXFonts == false)
+ return NULL;
+
+ /* we can handle only requests from these encodings */
+ if (encoding_index != ENCODING_INDEX_MACROMAN && encoding_index != ENCODING_INDEX_ISOLATIN1 &&
+ encoding_index != ENCODING_INDEX_STANDARD)
+ return NULL;
+
+ /* Don't render very small fonts */
+ if (fabs(pmat->xx * 1000.0) < 3.0)
+ return NULL;
+
+ /* Only handle simple cases for now (no transformations). */
+ if (fabs(pmat->xy) > 0.0001 || fabs(pmat->yx) > 0.0001 || pmat->xx <= 0)
+ return NULL;
+
+ /* allocate memory for gx_xfont */
+ macxf = gs_alloc_struct(mem, mac_xfont, &st_mac_xfont, "mac_lookup_font");
+ if (macxf == NULL) {
+ return NULL;
+ }
+
+ /* set default values */
+ macxf->common.procs = &mac_xfont_procs;
+ macxf->dev = dev;
+
+ /* find the specified font */
+ mac_find_font_family(fname, len, &(macxf->fontID), &(macxf->fontFace));
+
+ /* no font found */
+ if (macxf->fontID == 0)
+ return NULL;
+
+ FMGetFontFamilyName(macxf->fontID, macxf->fontName);
+ macxf->fontSize = (short)(pmat->xx * 1000.0);
+ macxf->fontEncoding = mac_get_font_encoding(macxf);
+
+ /* we can handle only fonts with these encodings for now (all original Mac fonts have MacRoman encoding!) */
+ if (macxf->fontEncoding != ENCODING_INDEX_MACROMAN && macxf->fontEncoding != ENCODING_INDEX_ISOLATIN1)
+ return NULL;
+
+ /* get font metrics */
+
+ /* save current GrafPort's font information */
+ GetPort(&((GrafPort*) currentPort));
+ txFont = currentPort->txFont;
+ txSize = currentPort->txSize;
+ txFace = currentPort->txFace;
+ txMode = currentPort->txMode;
+ spExtra = currentPort->spExtra;
+
+ /* set values for measuring */
+ TextFont(macxf->fontID);
+ TextSize(macxf->fontSize);
+ TextFace(macxf->fontFace);
+ TextMode(srcOr);
+ SpaceExtra(0);
+
+ /* measure font */
+ FontMetrics(&(macxf->fontMetrics));
+
+ /* restore current GrafPort's font information */
+ currentPort->txFont = txFont;
+ currentPort->txSize = txSize;
+ currentPort->txFace = txFace;
+ currentPort->txMode = txMode;
+ currentPort->spExtra = spExtra;
+
+ return (gx_xfont*) macxf;
}
-
-
/* char_xglyph */
static gx_xglyph
mac_char_xglyph(gx_xfont *xf, gs_char chr, int encoding_index,
- gs_glyph glyph, const gs_const_string *glyph_name)
+ gs_glyph glyph, const gs_const_string *glyph_name)
{
#pragma unused(glyph_name,glyph)
- mac_xfont * macxf = (mac_xfont*) xf;
-
- /* can't look up names yet */
- if (chr == gs_no_char)
- return gx_no_xglyph;
-
- if (macxf->fontEncoding == ENCODING_INDEX_MACROMAN) {
- switch (encoding_index) {
- case ENCODING_INDEX_MACROMAN: return chr;
- case ENCODING_INDEX_STANDARD: return gs_map_std_to_mac[chr];
- case ENCODING_INDEX_ISOLATIN1: return gs_map_iso_to_mac[chr];
- }
- } else if (macxf->fontEncoding == ENCODING_INDEX_ISOLATIN1) {
- switch (encoding_index) {
- case ENCODING_INDEX_MACROMAN: return gs_map_mac_to_iso[chr];
- case ENCODING_INDEX_STANDARD: return gs_map_std_to_iso[chr];
- case ENCODING_INDEX_ISOLATIN1: return chr;
- }
- }
-
- return gx_no_xglyph;
+ mac_xfont * macxf = (mac_xfont*) xf;
+
+ /* can't look up names yet */
+ if (chr == gs_no_char)
+ return gx_no_xglyph;
+
+ if (macxf->fontEncoding == ENCODING_INDEX_MACROMAN) {
+ switch (encoding_index) {
+ case ENCODING_INDEX_MACROMAN: return chr;
+ case ENCODING_INDEX_STANDARD: return gs_map_std_to_mac[chr];
+ case ENCODING_INDEX_ISOLATIN1: return gs_map_iso_to_mac[chr];
+ }
+ } else if (macxf->fontEncoding == ENCODING_INDEX_ISOLATIN1) {
+ switch (encoding_index) {
+ case ENCODING_INDEX_MACROMAN: return gs_map_mac_to_iso[chr];
+ case ENCODING_INDEX_STANDARD: return gs_map_std_to_iso[chr];
+ case ENCODING_INDEX_ISOLATIN1: return chr;
+ }
+ }
+
+ return gx_no_xglyph;
}
-
-
/* char_metrics */
static int
mac_char_metrics(gx_xfont *xf, gx_xglyph xg, int wmode,
- gs_point *pwidth, gs_int_rect *pbbox)
+ gs_point *pwidth, gs_int_rect *pbbox)
{
#pragma unused(xg)
- mac_xfont * macxf = (mac_xfont*) xf;
-
- if (wmode != 0)
- return gs_error_undefined;
-
- pbbox->p.x = 0;
- pbbox->q.x = Fix2Long(macxf->fontMetrics.widMax);
- pbbox->p.y = -Fix2Long(macxf->fontMetrics.ascent);
- pbbox->q.y = Fix2Long(macxf->fontMetrics.descent);
- pwidth->x = pbbox->q.x;
- pwidth->y = 0.0;
-
- return 0;
-}
+ mac_xfont * macxf = (mac_xfont*) xf;
+ if (wmode != 0)
+ return gs_error_undefined;
+ pbbox->p.x = 0;
+ pbbox->q.x = Fix2Long(macxf->fontMetrics.widMax);
+ pbbox->p.y = -Fix2Long(macxf->fontMetrics.ascent);
+ pbbox->q.y = Fix2Long(macxf->fontMetrics.descent);
+ pwidth->x = pbbox->q.x;
+ pwidth->y = 0.0;
+
+ return 0;
+}
/* render_char */
static int
mac_render_char(gx_xfont *xf, gx_xglyph xg, gx_device *dev,
- int xo, int yo, gx_color_index color, int required)
+ int xo, int yo, gx_color_index color, int required)
{
#pragma unused(dev,required)
- mac_xfont * macxf = (mac_xfont*) xf;
- gx_device_macos * mdev = (gx_device_macos*) macxf->dev;
-
- Str255 character;
- int i, found;
-
- CheckMem(10*1024, 100*1024);
- ResetPage();
-
- character[0] = 1;
- character[1] = xg;
-
- GSSetFgCol(macxf->dev, mdev->currPicPos, color);
-
- found = 0;
- for (i=0; i<mdev->numUsedFonts; i++)
- if (mdev->usedFontIDs[i] == macxf->fontID) found = 1;
-
- if (!found) {
- mdev->usedFontIDs[mdev->numUsedFonts++] = macxf->fontID;
- PICT_fontName(mdev->currPicPos, macxf->fontID, macxf->fontName);
- }
- if (mdev->lastFontID != macxf->fontID) {
- PICT_TxFont(mdev->currPicPos, macxf->fontID);
- mdev->lastFontID = macxf->fontID;
- }
- if (mdev->lastFontSize != macxf->fontSize) {
- PICT_TxSize(mdev->currPicPos, macxf->fontSize);
- mdev->lastFontSize = macxf->fontSize;
- }
- if (mdev->lastFontFace != macxf->fontFace) {
- PICT_TxFace(mdev->currPicPos, macxf->fontFace);
- mdev->lastFontFace = macxf->fontFace;
- }
- PICT_LongText(mdev->currPicPos, xo, yo, character);
- PICT_OpEndPicGoOn(mdev->currPicPos);
-
- return 0;
+ mac_xfont * macxf = (mac_xfont*) xf;
+ gx_device_macos * mdev = (gx_device_macos*) macxf->dev;
+
+ Str255 character;
+ int i, found;
+
+ CheckMem(10*1024, 100*1024);
+ ResetPage();
+
+ character[0] = 1;
+ character[1] = xg;
+
+ GSSetFgCol(macxf->dev, mdev->currPicPos, color);
+
+ found = 0;
+ for (i=0; i<mdev->numUsedFonts; i++)
+ if (mdev->usedFontIDs[i] == macxf->fontID) found = 1;
+
+ if (!found) {
+ mdev->usedFontIDs[mdev->numUsedFonts++] = macxf->fontID;
+ PICT_fontName(mdev->currPicPos, macxf->fontID, macxf->fontName);
+ }
+ if (mdev->lastFontID != macxf->fontID) {
+ PICT_TxFont(mdev->currPicPos, macxf->fontID);
+ mdev->lastFontID = macxf->fontID;
+ }
+ if (mdev->lastFontSize != macxf->fontSize) {
+ PICT_TxSize(mdev->currPicPos, macxf->fontSize);
+ mdev->lastFontSize = macxf->fontSize;
+ }
+ if (mdev->lastFontFace != macxf->fontFace) {
+ PICT_TxFace(mdev->currPicPos, macxf->fontFace);
+ mdev->lastFontFace = macxf->fontFace;
+ }
+ PICT_LongText(mdev->currPicPos, xo, yo, character);
+ PICT_OpEndPicGoOn(mdev->currPicPos);
+
+ return 0;
}
-
-
/* release */
static int
mac_release(gx_xfont *xf, gs_memory_t *mem)
{
- if (mem != NULL)
- gs_free_object(mem, xf, "mac_release");
-
- return 0;
-}
-
+ if (mem != NULL)
+ gs_free_object(mem, xf, "mac_release");
+ return 0;
+}
/* try to extract font family and style from name and find a suitable font */
static void
mac_find_font_family(ConstStringPtr fname, int len, FMFontFamily *fontID, FMFontStyle *fontFace)
{
- char fontNameStr[512];
- char *fontFamilyName;
- char *fontStyleName;
- int i;
-
- *fontID = 0;
- *fontFace = 0;
-
- /* first try the full fontname */
- fontNameStr[0] = len;
- memcpy(fontNameStr+1, fname, len);
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
-
- /* try to find the font without the dashes */
- fontNameStr[0] = len;
- memcpy(fontNameStr+1, fname, len);
- for (i=1; i<=len; i++)
- if (fontNameStr[i] == '-') fontNameStr[i] = ' ';
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
-
- /* we should read some default fontname mappings from a file here */
- if (*fontID > 0) return;
-
- /* try to extract font basename and style names */
- memcpy(fontNameStr, fname, len);
- fontNameStr[len] = 0;
-
- fontFamilyName = strtok(fontNameStr, "- ");
- while ((fontStyleName = strtok(NULL, "- ")) != NULL) {
- if (!strcmp(fontStyleName, "Italic") || !strcmp(fontStyleName, "Oblique") || !strcmp(fontStyleName, "It"))
- *fontFace |= italic;
- if (!strcmp(fontStyleName, "Bold") || !strcmp(fontStyleName, "Bd"))
- *fontFace |= bold;
- if (!strcmp(fontStyleName, "Narrow") || !strcmp(fontStyleName, "Condensed"))
- *fontFace |= condense;
- }
-
- if (fontFamilyName == NULL) {
- return;
- } else {
- Str255 fontName;
-
- fontName[0] = strlen(fontFamilyName);
- strcpy((char*)(fontName+1), fontFamilyName);
- *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
- if (*fontID > 0) return;
- }
+ char fontNameStr[512];
+ char *fontFamilyName;
+ char *fontStyleName;
+ int i;
+
+ *fontID = 0;
+ *fontFace = 0;
+
+ /* first try the full fontname */
+ fontNameStr[0] = len;
+ memcpy(fontNameStr+1, fname, len);
+ *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
+ if (*fontID > 0) return;
+
+ /* try to find the font without the dashes */
+ fontNameStr[0] = len;
+ memcpy(fontNameStr+1, fname, len);
+ for (i=1; i<=len; i++)
+ if (fontNameStr[i] == '-') fontNameStr[i] = ' ';
+ *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
+ if (*fontID > 0) return;
+
+ /* we should read some default fontname mappings from a file here */
+ if (*fontID > 0) return;
+
+ /* try to extract font basename and style names */
+ memcpy(fontNameStr, fname, len);
+ fontNameStr[len] = 0;
+
+ fontFamilyName = strtok(fontNameStr, "- ");
+ while ((fontStyleName = strtok(NULL, "- ")) != NULL) {
+ if (!strcmp(fontStyleName, "Italic") || !strcmp(fontStyleName, "Oblique") || !strcmp(fontStyleName, "It"))
+ *fontFace |= italic;
+ if (!strcmp(fontStyleName, "Bold") || !strcmp(fontStyleName, "Bd"))
+ *fontFace |= bold;
+ if (!strcmp(fontStyleName, "Narrow") || !strcmp(fontStyleName, "Condensed"))
+ *fontFace |= condense;
+ }
+
+ if (fontFamilyName == NULL) {
+ return;
+ } else {
+ Str255 fontName;
+
+ fontName[0] = strlen(fontFamilyName);
+ strcpy((char*)(fontName+1), fontFamilyName);
+ *fontID = FMGetFontFamilyFromName((StringPtr) fontNameStr);
+ if (*fontID > 0) return;
+ }
}
-
-
/* extract a font's platform id (encoding) */
static int
mac_get_font_encoding(mac_xfont *macxf)
{
- int encoding = ENCODING_INDEX_UNKNOWN;
- ResType resType;
- short resID;
-
- mac_get_font_resource(macxf, &resType, &resID);
-
- if (resType == 'sfnt') {
- Handle fontHandle;
- TTFontDir *fontDir;
- TTFontNamingTable *fontNamingTable;
- int i;
-
- /* load resource */
- if ((fontHandle = GetResource(resType, resID)) == NULL)
- return encoding;
- HLock(fontHandle);
-
- /* walk through the font directory and find the font naming table */
- fontDir = (TTFontDir*) *fontHandle;
- if (fontDir != NULL && fontDir->version == 'true') {
- for (i=0; i<fontDir->numTables; i++) {
- if (fontDir->components[i].tagName == TTF_FONT_NAMING_TABLE) {
- fontNamingTable = (TTFontNamingTable*) ((long)(fontDir->components[i].offset) + (long)fontDir);
- switch (fontNamingTable->platformID) {
- //case 0: encoding = ENCODING_INDEX_STANDARD; break; /* Unicode */
- case 1: encoding = ENCODING_INDEX_MACROMAN; break;
- case 2: encoding = ENCODING_INDEX_ISOLATIN1; break;
- //case 3: encoding = ENCODING_INDEX_WINANSI; break;
- }
- break;
- }
- }
- }
-
- HUnlock(fontHandle);
- ReleaseResource(fontHandle);
- }
-
- return encoding;
+ int encoding = ENCODING_INDEX_UNKNOWN;
+ ResType resType;
+ short resID;
+
+ mac_get_font_resource(macxf, &resType, &resID);
+
+ if (resType == 'sfnt') {
+ Handle fontHandle;
+ TTFontDir *fontDir;
+ TTFontNamingTable *fontNamingTable;
+ int i;
+
+ /* load resource */
+ if ((fontHandle = GetResource(resType, resID)) == NULL)
+ return encoding;
+ HLock(fontHandle);
+
+ /* walk through the font directory and find the font naming table */
+ fontDir = (TTFontDir*) *fontHandle;
+ if (fontDir != NULL && fontDir->version == 'true') {
+ for (i=0; i<fontDir->numTables; i++) {
+ if (fontDir->components[i].tagName == TTF_FONT_NAMING_TABLE) {
+ fontNamingTable = (TTFontNamingTable*) ((long)(fontDir->components[i].offset) + (long)fontDir);
+ switch (fontNamingTable->platformID) {
+ //case 0: encoding = ENCODING_INDEX_STANDARD; break; /* Unicode */
+ case 1: encoding = ENCODING_INDEX_MACROMAN; break;
+ case 2: encoding = ENCODING_INDEX_ISOLATIN1; break;
+ //case 3: encoding = ENCODING_INDEX_WINANSI; break;
+ }
+ break;
+ }
+ }
+ }
+
+ HUnlock(fontHandle);
+ ReleaseResource(fontHandle);
+ }
+
+ return encoding;
}
-
-
/* get a handle to a font resource */
static void
mac_get_font_resource(mac_xfont *macxf, ResType *resType, short *resID)
{
- FMInput fontInput = {0, 0, 0, true, 0, {1,1}, {1,1}};
- FMOutputPtr fontOutput;
-
- Str255 resName;
-
- fontInput.family = macxf->fontID;
- fontInput.size = macxf->fontSize;
- fontInput.face = macxf->fontFace;
-
- fontOutput = FMSwapFont(&fontInput);
-
- if (fontOutput == NULL || fontOutput->fontHandle == NULL)
- return;
-
- GetResInfo(fontOutput->fontHandle, resID, resType, resName);
-}
+ FMInput fontInput = {0, 0, 0, true, 0, {1,1}, {1,1}};
+ FMOutputPtr fontOutput;
+ Str255 resName;
+ fontInput.family = macxf->fontID;
+ fontInput.size = macxf->fontSize;
+ fontInput.face = macxf->fontFace;
+
+ fontOutput = FMSwapFont(&fontInput);
+
+ if (fontOutput == NULL || fontOutput->fontHandle == NULL)
+ return;
+
+ GetResInfo(fontOutput->fontHandle, resID, resType, resName);
+}
#if !USE_RECOMMENDED_CARBON_FONTMANAGER_CALLS
/* wrap the old Classic MacOS font manager calls to fake support for the
@@ -458,8 +427,8 @@ mac_get_font_resource(mac_xfont *macxf, ResType *resType, short *resID)
OSStatus
FMGetFontFamilyName(FMFontFamily fontFamilyID, Str255 fontNameStr)
{
- GetFontName(fontFamilyID, fontNameStr);
- return noErr;
+ GetFontName(fontFamilyID, fontNameStr);
+ return noErr;
}
FMFontFamily
diff --git a/gs/base/gdevmeds.c b/gs/base/gdevmeds.c
index 91712b81a..ccad4acae 100644
--- a/gs/base/gdevmeds.c
+++ b/gs/base/gdevmeds.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,64 +27,64 @@
#define TOLERANCE 0.1 CM
static const struct {
- const char* name;
- float width;
- float height;
- float priority;
+ const char* name;
+ float width;
+ float height;
+ float priority;
} media[] = {
#define X(name, width, height) {name, width, height, 1 / (width * height)}
- X("a0", 83.9611 CM, 118.816 CM),
- X("a1", 59.4078 CM, 83.9611 CM),
- X("a2", 41.9806 CM, 59.4078 CM),
- X("a3", 29.7039 CM, 41.9806 CM),
- X("a4", 20.9903 CM, 29.7039 CM),
- X("a5", 14.8519 CM, 20.9903 CM),
- X("a6", 10.4775 CM, 14.8519 CM),
- X("a7", 7.40833 CM, 10.4775 CM),
- X("a8", 5.22111 CM, 7.40833 CM),
- X("a9", 3.70417 CM, 5.22111 CM),
- X("a10", 2.61056 CM, 3.70417 CM),
- X("archA", 9 INCH, 12 INCH),
- X("archB", 12 INCH, 18 INCH),
- X("archC", 18 INCH, 24 INCH),
- X("archD", 24 INCH, 36 INCH),
- X("archE", 36 INCH, 48 INCH),
- X("b0", 100.048 CM, 141.393 CM),
- X("b1", 70.6967 CM, 100.048 CM),
- X("b2", 50.0239 CM, 70.6967 CM),
- X("b3", 35.3483 CM, 50.0239 CM),
- X("b4", 25.0119 CM, 35.3483 CM),
- X("b5", 17.6742 CM, 25.0119 CM),
- X("flsa", 8.5 INCH, 13 INCH),
- X("flse", 8.5 INCH, 13 INCH),
- X("halfletter", 5.5 INCH, 8.5 INCH),
- X("ledger", 17 INCH, 11 INCH),
- X("legal", 8.5 INCH, 14 INCH),
- X("letter", 8.5 INCH, 11 INCH),
- X("note", 7.5 INCH, 10 INCH),
- X("executive", 7.25 INCH, 10.5 INCH),
- X("com10", 4.125 INCH, 9.5 INCH),
- X("dl", 11 CM, 22 CM),
- X("c5", 16.2 CM, 22.9 CM),
- X("monarch", 3.875 INCH, 7.5 INCH)};
+ X("a0", 83.9611 CM, 118.816 CM),
+ X("a1", 59.4078 CM, 83.9611 CM),
+ X("a2", 41.9806 CM, 59.4078 CM),
+ X("a3", 29.7039 CM, 41.9806 CM),
+ X("a4", 20.9903 CM, 29.7039 CM),
+ X("a5", 14.8519 CM, 20.9903 CM),
+ X("a6", 10.4775 CM, 14.8519 CM),
+ X("a7", 7.40833 CM, 10.4775 CM),
+ X("a8", 5.22111 CM, 7.40833 CM),
+ X("a9", 3.70417 CM, 5.22111 CM),
+ X("a10", 2.61056 CM, 3.70417 CM),
+ X("archA", 9 INCH, 12 INCH),
+ X("archB", 12 INCH, 18 INCH),
+ X("archC", 18 INCH, 24 INCH),
+ X("archD", 24 INCH, 36 INCH),
+ X("archE", 36 INCH, 48 INCH),
+ X("b0", 100.048 CM, 141.393 CM),
+ X("b1", 70.6967 CM, 100.048 CM),
+ X("b2", 50.0239 CM, 70.6967 CM),
+ X("b3", 35.3483 CM, 50.0239 CM),
+ X("b4", 25.0119 CM, 35.3483 CM),
+ X("b5", 17.6742 CM, 25.0119 CM),
+ X("flsa", 8.5 INCH, 13 INCH),
+ X("flse", 8.5 INCH, 13 INCH),
+ X("halfletter", 5.5 INCH, 8.5 INCH),
+ X("ledger", 17 INCH, 11 INCH),
+ X("legal", 8.5 INCH, 14 INCH),
+ X("letter", 8.5 INCH, 11 INCH),
+ X("note", 7.5 INCH, 10 INCH),
+ X("executive", 7.25 INCH, 10.5 INCH),
+ X("com10", 4.125 INCH, 9.5 INCH),
+ X("dl", 11 CM, 22 CM),
+ X("c5", 16.2 CM, 22.9 CM),
+ X("monarch", 3.875 INCH, 7.5 INCH)};
int select_medium(gx_device_printer *pdev, const char **available, int default_index)
{
- int i, j, index = default_index;
- float priority = 0;
- float width = pdev->width / pdev->x_pixels_per_inch INCH;
- float height = pdev->height / pdev->y_pixels_per_inch INCH;
+ int i, j, index = default_index;
+ float priority = 0;
+ float width = pdev->width / pdev->x_pixels_per_inch INCH;
+ float height = pdev->height / pdev->y_pixels_per_inch INCH;
- for (i = 0; available[i]; i++) {
- for (j = 0; j < sizeof(media) / sizeof(media[0]); j++) {
- if (!strcmp(available[i], media[j].name) &&
- media[j].width + TOLERANCE > width &&
- media[j].height + TOLERANCE > height &&
- media[j].priority > priority) {
- index = i;
- priority = media[j].priority;
- }
- }
- }
- return index;
+ for (i = 0; available[i]; i++) {
+ for (j = 0; j < sizeof(media) / sizeof(media[0]); j++) {
+ if (!strcmp(available[i], media[j].name) &&
+ media[j].width + TOLERANCE > width &&
+ media[j].height + TOLERANCE > height &&
+ media[j].priority > priority) {
+ index = i;
+ priority = media[j].priority;
+ }
+ }
+ }
+ return index;
}
diff --git a/gs/base/gdevmeds.h b/gs/base/gdevmeds.h
index f4bfeb905..17cfe105f 100644
--- a/gs/base/gdevmeds.h
+++ b/gs/base/gdevmeds.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,6 +19,6 @@
#include "gdevprn.h"
int select_medium(gx_device_printer *pdev, const char **available,
- int default_index);
+ int default_index);
#endif /* gdevmeds_INCLUDED */
diff --git a/gs/base/gdevmem.c b/gs/base/gdevmem.c
index 5e5b1aebc..a55639a3c 100644
--- a/gs/base/gdevmem.c
+++ b/gs/base/gdevmem.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
public_st_device_memory();
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(device_memory_enum_ptrs, gx_device_memory *mptr)
{
return ENUM_USING(st_device_forward, vptr, sizeof(gx_device_forward), index - 3);
@@ -42,18 +42,18 @@ static
RELOC_PTRS_WITH(device_memory_reloc_ptrs, gx_device_memory *mptr)
{
if (!mptr->foreign_bits) {
- byte *base_old = mptr->base;
- long reloc;
- int y;
-
- RELOC_PTR(gx_device_memory, base);
- reloc = base_old - mptr->base;
- for (y = 0; y < mptr->height; y++)
- mptr->line_ptrs[y] -= reloc;
- /* Relocate line_ptrs, which also points into the data area. */
- mptr->line_ptrs = (byte **) ((byte *) mptr->line_ptrs - reloc);
+ byte *base_old = mptr->base;
+ long reloc;
+ int y;
+
+ RELOC_PTR(gx_device_memory, base);
+ reloc = base_old - mptr->base;
+ for (y = 0; y < mptr->height; y++)
+ mptr->line_ptrs[y] -= reloc;
+ /* Relocate line_ptrs, which also points into the data area. */
+ mptr->line_ptrs = (byte **) ((byte *) mptr->line_ptrs - reloc);
} else if (!mptr->foreign_line_pointers) {
- RELOC_PTR(gx_device_memory, line_ptrs);
+ RELOC_PTR(gx_device_memory, line_ptrs);
}
RELOC_CONST_STRING_PTR(gx_device_memory, palette);
RELOC_USING(st_device_forward, vptr, sizeof(gx_device_forward));
@@ -93,7 +93,7 @@ const gx_device_memory *
gdev_mem_device_for_bits(int bits_per_pixel)
{
return ((uint)bits_per_pixel > 64 ? (const gx_device_memory *)0 :
- mem_devices[bits_per_pixel]);
+ mem_devices[bits_per_pixel]);
}
/* Do the same for a word-oriented device. */
static const gx_device_memory *const mem_word_devices[65] = {
@@ -111,7 +111,7 @@ const gx_device_memory *
gdev_mem_word_device_for_bits(int bits_per_pixel)
{
return ((uint)bits_per_pixel > 64 ? (const gx_device_memory *)0 :
- mem_word_devices[bits_per_pixel]);
+ mem_word_devices[bits_per_pixel]);
}
/* Test whether a device is a memory device */
@@ -126,10 +126,10 @@ gs_device_is_memory(const gx_device * dev)
const gx_device_memory *mdproto;
if ((uint)bits_per_pixel > 64)
- return false;
+ return false;
mdproto = mem_devices[bits_per_pixel];
if (mdproto != 0 && dev_proc(dev, draw_thin_line) == dev_proc(mdproto, draw_thin_line))
- return true;
+ return true;
mdproto = mem_word_devices[bits_per_pixel];
return (mdproto != 0 && dev_proc(dev, draw_thin_line) == dev_proc(mdproto, draw_thin_line));
}
@@ -138,46 +138,46 @@ gs_device_is_memory(const gx_device * dev)
/* Note that the default for monobit devices is white = 0, black = 1. */
void
gs_make_mem_device(gx_device_memory * dev, const gx_device_memory * mdproto,
- gs_memory_t * mem, int page_device, gx_device * target)
+ gs_memory_t * mem, int page_device, gx_device * target)
{
gx_device_init((gx_device *) dev, (const gx_device *)mdproto,
- mem, true);
+ mem, true);
dev->stype = &st_device_memory;
switch (page_device) {
- case -1:
- set_dev_proc(dev, get_page_device, gx_default_get_page_device);
- break;
- case 1:
- set_dev_proc(dev, get_page_device, gx_page_device_get_page_device);
- break;
+ case -1:
+ set_dev_proc(dev, get_page_device, gx_default_get_page_device);
+ break;
+ case 1:
+ set_dev_proc(dev, get_page_device, gx_page_device_get_page_device);
+ break;
}
/* Preload the black and white cache. */
if (target == 0) {
- if (dev->color_info.depth == 1) {
- /* The default for black-and-white devices is inverted. */
- dev->cached_colors.black = 1;
- dev->cached_colors.white = 0;
- } else {
- dev->cached_colors.black = 0;
- dev->cached_colors.white = (1 << dev->color_info.depth) - 1;
- }
+ if (dev->color_info.depth == 1) {
+ /* The default for black-and-white devices is inverted. */
+ dev->cached_colors.black = 1;
+ dev->cached_colors.white = 0;
+ } else {
+ dev->cached_colors.black = 0;
+ dev->cached_colors.white = (1 << dev->color_info.depth) - 1;
+ }
} else {
- gx_device_set_target((gx_device_forward *)dev, target);
- /* Forward the color mapping operations to the target. */
- gx_device_forward_color_procs((gx_device_forward *) dev);
- gx_device_copy_color_procs((gx_device *)dev, target);
- dev->cached_colors = target->cached_colors;
+ gx_device_set_target((gx_device_forward *)dev, target);
+ /* Forward the color mapping operations to the target. */
+ gx_device_forward_color_procs((gx_device_forward *) dev);
+ gx_device_copy_color_procs((gx_device *)dev, target);
+ dev->cached_colors = target->cached_colors;
/* Do a copy of put_image since it needs the source buffer */
#define COPY_PROC(p) set_dev_proc(dev, p, target->procs.p)
COPY_PROC(put_image);
#undef COPY_PROC
}
if (dev->color_info.depth == 1) {
- gx_color_value cv[3];
+ gx_color_value cv[3];
cv[0] = cv[1] = cv[2] = 0;
- gdev_mem_mono_set_inverted(dev, (target == 0 ||
- (*dev_proc(dev, map_rgb_color))((gx_device *)dev, cv) != 0));
+ gdev_mem_mono_set_inverted(dev, (target == 0 ||
+ (*dev_proc(dev, map_rgb_color))((gx_device *)dev, cv) != 0));
}
check_device_separable((gx_device *)dev);
gx_device_fill_in_procs((gx_device *)dev);
@@ -189,7 +189,7 @@ gs_make_mem_device(gx_device_memory * dev, const gx_device_memory * mdproto,
int
gs_make_mem_device_with_copydevice(gx_device_memory ** ppdev,
const gx_device_memory * mdproto,
- gs_memory_t * mem,
+ gs_memory_t * mem,
int page_device,
gx_device * target)
{
@@ -198,7 +198,7 @@ gs_make_mem_device_with_copydevice(gx_device_memory ** ppdev,
if (mem == 0)
return -1;
-
+
code = gs_copydevice((gx_device **)&pdev,
(const gx_device *)mdproto,
mem);
@@ -206,36 +206,36 @@ gs_make_mem_device_with_copydevice(gx_device_memory ** ppdev,
return code;
switch (page_device) {
- case -1:
- set_dev_proc(pdev, get_page_device, gx_default_get_page_device);
- break;
- case 1:
- set_dev_proc(pdev, get_page_device, gx_page_device_get_page_device);
- break;
+ case -1:
+ set_dev_proc(pdev, get_page_device, gx_default_get_page_device);
+ break;
+ case 1:
+ set_dev_proc(pdev, get_page_device, gx_page_device_get_page_device);
+ break;
}
/* Preload the black and white cache. */
if (target == 0) {
- if (pdev->color_info.depth == 1) {
- /* The default for black-and-white devices is inverted. */
- pdev->cached_colors.black = 1;
- pdev->cached_colors.white = 0;
- } else {
- pdev->cached_colors.black = 0;
- pdev->cached_colors.white = (1 << pdev->color_info.depth) - 1;
- }
+ if (pdev->color_info.depth == 1) {
+ /* The default for black-and-white devices is inverted. */
+ pdev->cached_colors.black = 1;
+ pdev->cached_colors.white = 0;
+ } else {
+ pdev->cached_colors.black = 0;
+ pdev->cached_colors.white = (1 << pdev->color_info.depth) - 1;
+ }
} else {
- gx_device_set_target((gx_device_forward *)pdev, target);
- /* Forward the color mapping operations to the target. */
- gx_device_forward_color_procs((gx_device_forward *) pdev);
- gx_device_copy_color_procs((gx_device *)pdev, target);
- pdev->cached_colors = target->cached_colors;
+ gx_device_set_target((gx_device_forward *)pdev, target);
+ /* Forward the color mapping operations to the target. */
+ gx_device_forward_color_procs((gx_device_forward *) pdev);
+ gx_device_copy_color_procs((gx_device *)pdev, target);
+ pdev->cached_colors = target->cached_colors;
}
if (pdev->color_info.depth == 1) {
- gx_color_value cv[3];
+ gx_color_value cv[3];
cv[0] = cv[1] = cv[2] = 0;
- gdev_mem_mono_set_inverted(pdev, (target == 0 ||
- (*dev_proc(pdev, map_rgb_color))((gx_device *)pdev, cv) != 0));
+ gdev_mem_mono_set_inverted(pdev, (target == 0 ||
+ (*dev_proc(pdev, map_rgb_color))((gx_device *)pdev, cv) != 0));
}
check_device_separable((gx_device *)pdev);
gx_device_fill_in_procs((gx_device *)pdev);
@@ -244,10 +244,9 @@ gs_make_mem_device_with_copydevice(gx_device_memory ** ppdev,
return 0;
}
-
/* Make a monobit memory device using copydevice */
int
-gs_make_mem_mono_device_with_copydevice(gx_device_memory ** ppdev, gs_memory_t * mem,
+gs_make_mem_mono_device_with_copydevice(gx_device_memory ** ppdev, gs_memory_t * mem,
gx_device * target)
{
int code;
@@ -255,7 +254,7 @@ gs_make_mem_mono_device_with_copydevice(gx_device_memory ** ppdev, gs_memory_t *
if (mem == 0)
return -1;
-
+
code = gs_copydevice((gx_device **)&pdev,
(const gx_device *)&mem_mono_device,
mem);
@@ -271,15 +270,14 @@ gs_make_mem_mono_device_with_copydevice(gx_device_memory ** ppdev, gs_memory_t *
return 0;
}
-
/* Make a monobit memory device. This is never a page device. */
/* Note that white=0, black=1. */
void
gs_make_mem_mono_device(gx_device_memory * dev, gs_memory_t * mem,
- gx_device * target)
+ gx_device * target)
{
gx_device_init((gx_device *)dev, (const gx_device *)&mem_mono_device,
- mem, true);
+ mem, true);
set_dev_proc(dev, get_page_device, gx_default_get_page_device);
gx_device_set_target((gx_device_forward *)dev, target);
gdev_mem_mono_set_inverted(dev, true);
@@ -292,9 +290,9 @@ void
gdev_mem_mono_set_inverted(gx_device_memory * dev, bool black_is_1)
{
if (black_is_1)
- dev->palette = mem_mono_b_w_palette;
+ dev->palette = mem_mono_b_w_palette;
else
- dev->palette = mem_mono_w_b_palette;
+ dev->palette = mem_mono_w_b_palette;
}
/*
@@ -307,7 +305,7 @@ gdev_mem_mono_set_inverted(gx_device_memory * dev, bool black_is_1)
* must pad its scan lines, and then we must pad again for the pointer
* tables (one table per plane).
*
- * Return VMerror if the size exceeds max ulong
+ * Return VMerror if the size exceeds max ulong
*/
int
gdev_mem_bits_size(const gx_device_memory * dev, int width, int height, ulong *psize)
@@ -319,14 +317,14 @@ gdev_mem_bits_size(const gx_device_memory * dev, int width, int height, ulong *p
int pi;
if (num_planes)
- planes = dev->planes;
+ planes = dev->planes;
else
- planes = &plane1, plane1.depth = dev->color_info.depth, num_planes = 1;
+ planes = &plane1, plane1.depth = dev->color_info.depth, num_planes = 1;
for (size = 0, pi = 0; pi < num_planes; ++pi)
- size += bitmap_raster(width * planes[pi].depth);
+ size += bitmap_raster(width * planes[pi].depth);
if (height != 0)
- if (size > (max_ulong - ARCH_ALIGN_PTR_MOD) / (ulong)height)
- return_error(gs_error_VMerror);
+ if (size > (max_ulong - ARCH_ALIGN_PTR_MOD) / (ulong)height)
+ return_error(gs_error_VMerror);
*psize = ROUND_UP(size * height, ARCH_ALIGN_PTR_MOD);
return 0;
}
@@ -335,15 +333,15 @@ gdev_mem_line_ptrs_size(const gx_device_memory * dev, int width, int height)
{
return (ulong)height * sizeof(byte *) * max(dev->num_planes, 1);
}
-int
+int
gdev_mem_data_size(const gx_device_memory * dev, int width, int height, ulong *psize)
{
ulong bits_size;
ulong line_ptrs_size = gdev_mem_line_ptrs_size(dev, width, height);
if (gdev_mem_bits_size(dev, width, height, &bits_size) < 0 ||
- bits_size > max_ulong - line_ptrs_size)
- return_error(gs_error_VMerror);
+ bits_size > max_ulong - line_ptrs_size)
+ return_error(gs_error_VMerror);
*psize = bits_size + line_ptrs_size;
return 0;
}
@@ -353,7 +351,7 @@ gdev_mem_data_size(const gx_device_memory * dev, int width, int height, ulong *p
*/
int
gdev_mem_max_height(const gx_device_memory * dev, int width, ulong size,
- bool page_uses_transparency)
+ bool page_uses_transparency)
{
int height;
ulong max_height;
@@ -364,29 +362,29 @@ gdev_mem_max_height(const gx_device_memory * dev, int width, ulong size,
* If the device is using PDF 1.4 transparency then we will need to
* also allocate image buffers for doing the blending operations.
* We can only estimate the space requirements. However since it
- * is only an estimate, we may exceed our desired buffer space while
- * processing the file.
- */
+ * is only an estimate, we may exceed our desired buffer space while
+ * processing the file.
+ */
max_height = size / (bitmap_raster(width
- * dev->color_info.depth + ESTIMATED_PDF14_ROW_SPACE(width))
- + sizeof(byte *) * max(dev->num_planes, 1));
+ * dev->color_info.depth + ESTIMATED_PDF14_ROW_SPACE(width))
+ + sizeof(byte *) * max(dev->num_planes, 1));
height = (int)min(max_height, max_int);
} else {
- /* For non PDF 1.4 transparency, we can do an exact calculation */
+ /* For non PDF 1.4 transparency, we can do an exact calculation */
max_height = size /
- (bitmap_raster(width * dev->color_info.depth) +
- sizeof(byte *) * max(dev->num_planes, 1));
+ (bitmap_raster(width * dev->color_info.depth) +
+ sizeof(byte *) * max(dev->num_planes, 1));
height = (int)min(max_height, max_int);
/*
* Because of alignment rounding, the just-computed height might
* be too large by a small amount. Adjust it the easy way.
*/
do {
- gdev_mem_data_size(dev, width, height, &data_size);
- if (data_size <= size)
- break;
- --height;
- } while (data_size > size);
+ gdev_mem_data_size(dev, width, height, &data_size);
+ if (data_size <= size)
+ break;
+ --height;
+ } while (data_size > size);
}
return height;
}
@@ -400,7 +398,7 @@ mem_open(gx_device * dev)
/* Check that we aren't trying to open a planar device as chunky. */
if (mdev->num_planes)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gdev_mem_open_scan_lines(mdev, dev->height);
}
int
@@ -410,34 +408,34 @@ gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height)
ulong size;
if (setup_height < 0 || setup_height > mdev->height)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (mdev->bitmap_memory != 0) {
- /* Allocate the data now. */
- if (gdev_mem_bitmap_size(mdev, &size) < 0)
- return_error(gs_error_VMerror);
-
- if ((uint) size != size) /* ulong may be bigger than uint */
- return_error(gs_error_limitcheck);
- mdev->base = gs_alloc_bytes(mdev->bitmap_memory, (uint)size,
- "mem_open");
- if (mdev->base == 0)
- return_error(gs_error_VMerror);
- mdev->foreign_bits = false;
+ /* Allocate the data now. */
+ if (gdev_mem_bitmap_size(mdev, &size) < 0)
+ return_error(gs_error_VMerror);
+
+ if ((uint) size != size) /* ulong may be bigger than uint */
+ return_error(gs_error_limitcheck);
+ mdev->base = gs_alloc_bytes(mdev->bitmap_memory, (uint)size,
+ "mem_open");
+ if (mdev->base == 0)
+ return_error(gs_error_VMerror);
+ mdev->foreign_bits = false;
} else if (mdev->line_pointer_memory != 0) {
- /* Allocate the line pointers now. */
-
- mdev->line_ptrs = (byte **)
- gs_alloc_byte_array(mdev->line_pointer_memory, mdev->height,
- sizeof(byte *) * max(mdev->num_planes, 1),
- "gdev_mem_open_scan_lines");
- if (mdev->line_ptrs == 0)
- return_error(gs_error_VMerror);
- mdev->foreign_line_pointers = false;
- line_pointers_adjacent = false;
+ /* Allocate the line pointers now. */
+
+ mdev->line_ptrs = (byte **)
+ gs_alloc_byte_array(mdev->line_pointer_memory, mdev->height,
+ sizeof(byte *) * max(mdev->num_planes, 1),
+ "gdev_mem_open_scan_lines");
+ if (mdev->line_ptrs == 0)
+ return_error(gs_error_VMerror);
+ mdev->foreign_line_pointers = false;
+ line_pointers_adjacent = false;
}
if (line_pointers_adjacent) {
- gdev_mem_bits_size(mdev, mdev->width, mdev->height, &size);
- mdev->line_ptrs = (byte **)(mdev->base + size);
+ gdev_mem_bits_size(mdev, mdev->width, mdev->height, &size);
+ mdev->line_ptrs = (byte **)(mdev->base + size);
}
mdev->raster = gdev_mem_raster(mdev);
return gdev_mem_set_line_ptrs(mdev, NULL, 0, NULL, setup_height);
@@ -450,40 +448,40 @@ gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height)
*/
int
gdev_mem_set_line_ptrs(gx_device_memory * mdev, byte * base, int raster,
- byte **line_ptrs, int setup_height)
+ byte **line_ptrs, int setup_height)
{
int num_planes = mdev->num_planes;
gx_render_plane_t plane1;
const gx_render_plane_t *planes;
byte **pline =
- (line_ptrs ? (mdev->line_ptrs = line_ptrs) : mdev->line_ptrs);
+ (line_ptrs ? (mdev->line_ptrs = line_ptrs) : mdev->line_ptrs);
byte *data =
- (base ? (mdev->raster = raster, mdev->base = base) :
- (raster = mdev->raster, mdev->base));
+ (base ? (mdev->raster = raster, mdev->base = base) :
+ (raster = mdev->raster, mdev->base));
int pi;
if (num_planes) {
- if (base && !mdev->plane_depth)
- return_error(gs_error_rangecheck);
- planes = mdev->planes;
+ if (base && !mdev->plane_depth)
+ return_error(gs_error_rangecheck);
+ planes = mdev->planes;
} else {
- planes = &plane1;
- plane1.depth = mdev->color_info.depth;
- num_planes = 1;
+ planes = &plane1;
+ plane1.depth = mdev->color_info.depth;
+ num_planes = 1;
}
for (pi = 0; pi < num_planes; ++pi) {
- int raster = bitmap_raster(mdev->width * planes[pi].depth);
- byte **pptr = pline;
- byte **pend = pptr + setup_height;
- byte *scan_line = data;
-
- while (pptr < pend) {
- *pptr++ = scan_line;
- scan_line += raster;
- }
- data += raster * mdev->height;
- pline += setup_height; /* not mdev->height, see gxdevmem.h */
+ int raster = bitmap_raster(mdev->width * planes[pi].depth);
+ byte **pptr = pline;
+ byte **pend = pptr + setup_height;
+ byte *scan_line = data;
+
+ while (pptr < pend) {
+ *pptr++ = scan_line;
+ scan_line += raster;
+ }
+ data += raster * mdev->height;
+ pline += setup_height; /* not mdev->height, see gxdevmem.h */
}
return 0;
@@ -510,16 +508,16 @@ mem_close(gx_device * dev)
gx_device_memory * const mdev = (gx_device_memory *)dev;
if (mdev->bitmap_memory != 0) {
- gs_free_object(mdev->bitmap_memory, mdev->base, "mem_close");
- /*
- * The following assignment is strictly for the benefit of one
- * client that is sloppy about using is_open properly.
- */
- mdev->base = 0;
+ gs_free_object(mdev->bitmap_memory, mdev->base, "mem_close");
+ /*
+ * The following assignment is strictly for the benefit of one
+ * client that is sloppy about using is_open properly.
+ */
+ mdev->base = 0;
} else if (mdev->line_pointer_memory != 0) {
- gs_free_object(mdev->line_pointer_memory, mdev->line_ptrs,
- "mem_close");
- mdev->line_ptrs = 0; /* ibid. */
+ gs_free_object(mdev->line_pointer_memory, mdev->line_ptrs,
+ "mem_close");
+ mdev->line_ptrs = 0; /* ibid. */
}
return 0;
}
@@ -529,47 +527,47 @@ mem_close(gx_device * dev)
#define chunk byte
int
mem_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
gs_get_bits_options_t options = params->options;
int x = prect->p.x, w = prect->q.x - x, y = prect->p.y, h = prect->q.y - y;
if (options == 0) {
- params->options =
- (GB_ALIGN_STANDARD | GB_ALIGN_ANY) |
- (GB_RETURN_COPY | GB_RETURN_POINTER) |
- (GB_OFFSET_0 | GB_OFFSET_SPECIFIED | GB_OFFSET_ANY) |
- (GB_RASTER_STANDARD | GB_RASTER_SPECIFIED | GB_RASTER_ANY) |
- GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE;
- return_error(gs_error_rangecheck);
+ params->options =
+ (GB_ALIGN_STANDARD | GB_ALIGN_ANY) |
+ (GB_RETURN_COPY | GB_RETURN_POINTER) |
+ (GB_OFFSET_0 | GB_OFFSET_SPECIFIED | GB_OFFSET_ANY) |
+ (GB_RASTER_STANDARD | GB_RASTER_SPECIFIED | GB_RASTER_ANY) |
+ GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE;
+ return_error(gs_error_rangecheck);
}
if ((w <= 0) | (h <= 0)) {
- if ((w | h) < 0)
- return_error(gs_error_rangecheck);
- return 0;
+ if ((w | h) < 0)
+ return_error(gs_error_rangecheck);
+ return 0;
}
if (x < 0 || w > dev->width - x ||
- y < 0 || h > dev->height - y
- )
- return_error(gs_error_rangecheck);
+ y < 0 || h > dev->height - y
+ )
+ return_error(gs_error_rangecheck);
{
- gs_get_bits_params_t copy_params;
- byte *base = scan_line_base(mdev, y);
- int code;
-
- copy_params.options =
- GB_COLORS_NATIVE | GB_PACKING_CHUNKY | GB_ALPHA_NONE |
- (mdev->raster ==
- bitmap_raster(mdev->width * mdev->color_info.depth) ?
- GB_RASTER_STANDARD : GB_RASTER_SPECIFIED);
- copy_params.raster = mdev->raster;
- code = gx_get_bits_return_pointer(dev, x, h, params,
- &copy_params, base);
- if (code >= 0)
- return code;
- return gx_get_bits_copy(dev, x, w, h, params, &copy_params, base,
- gx_device_raster(dev, true));
+ gs_get_bits_params_t copy_params;
+ byte *base = scan_line_base(mdev, y);
+ int code;
+
+ copy_params.options =
+ GB_COLORS_NATIVE | GB_PACKING_CHUNKY | GB_ALPHA_NONE |
+ (mdev->raster ==
+ bitmap_raster(mdev->width * mdev->color_info.depth) ?
+ GB_RASTER_STANDARD : GB_RASTER_SPECIFIED);
+ copy_params.raster = mdev->raster;
+ code = gx_get_bits_return_pointer(dev, x, h, params,
+ &copy_params, base);
+ if (code >= 0)
+ return code;
+ return gx_get_bits_copy(dev, x, w, h, params, &copy_params, base,
+ gx_device_raster(dev, true));
}
}
@@ -588,42 +586,42 @@ mem_swap_byte_rect(byte * base, uint raster, int x, int w, int h, bool store)
int xbit = x & 31;
if (store) {
- if (xbit + w > 64) { /* Operation spans multiple words. */
- /* Just swap the words at the left and right edges. */
- if (xbit != 0)
- mem_swap_byte_rect(base, raster, x, 1, h, false);
- x += w - 1;
- xbit = x & 31;
- if (xbit == 31)
- return;
- w = 1;
- }
+ if (xbit + w > 64) { /* Operation spans multiple words. */
+ /* Just swap the words at the left and right edges. */
+ if (xbit != 0)
+ mem_swap_byte_rect(base, raster, x, 1, h, false);
+ x += w - 1;
+ xbit = x & 31;
+ if (xbit == 31)
+ return;
+ w = 1;
+ }
}
/* Swap the entire rectangle (or what's left of it). */
{
- byte *row = base + ((x >> 5) << 2);
- int nw = (xbit + w + 31) >> 5;
- int ny;
-
- for (ny = h; ny > 0; row += raster, --ny) {
- int nx = nw;
- bits32 *pw = (bits32 *) row;
-
- do {
- bits32 w = *pw;
-
- *pw++ = (w >> 24) + ((w >> 8) & 0xff00) +
- ((w & 0xff00) << 8) + (w << 24);
- }
- while (--nx);
- }
+ byte *row = base + ((x >> 5) << 2);
+ int nw = (xbit + w + 31) >> 5;
+ int ny;
+
+ for (ny = h; ny > 0; row += raster, --ny) {
+ int nx = nw;
+ bits32 *pw = (bits32 *) row;
+
+ do {
+ bits32 w = *pw;
+
+ *pw++ = (w >> 24) + ((w >> 8) & 0xff00) +
+ ((w & 0xff00) << 8) + (w << 24);
+ }
+ while (--nx);
+ }
}
}
/* Copy a word-oriented rectangle to the client, swapping bytes as needed. */
int
mem_word_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte *src;
@@ -637,12 +635,12 @@ mem_word_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
fit_fill_xywh(dev, x, y, w, h);
if (w <= 0 || h <= 0) {
- /*
- * It's easiest to just keep going with an empty rectangle.
- * We pass the original rectangle to mem_get_bits_rectangle,
- * so unread will be filled in correctly.
- */
- x = y = w = h = 0;
+ /*
+ * It's easiest to just keep going with an empty rectangle.
+ * We pass the original rectangle to mem_get_bits_rectangle,
+ * so unread will be filled in correctly.
+ */
+ x = y = w = h = 0;
}
bit_x = x * dev->color_info.depth;
bit_w = w * dev->color_info.depth;
@@ -663,59 +661,59 @@ mem_mapped_map_rgb_color(gx_device * dev, const gx_color_value cv[])
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
byte br = gx_color_value_to_byte(cv[0]);
-
+
register const byte *pptr = mdev->palette.data;
int cnt = mdev->palette.size;
const byte *which = 0; /* initialized only to pacify gcc */
int best = 256 * 3;
if (mdev->color_info.num_components != 1) {
- /* not 1 component, assume three */
- /* The comparison is rather simplistic, treating differences in */
- /* all components as equal. Better choices would be 'distance' */
- /* in HLS space or other, but these would be much slower. */
- /* At least exact matches will be found. */
- byte bg = gx_color_value_to_byte(cv[1]);
- byte bb = gx_color_value_to_byte(cv[2]);
-
- while ((cnt -= 3) >= 0) {
- register int diff = *pptr - br;
-
- if (diff < 0)
- diff = -diff;
- if (diff < best) { /* quick rejection */
- int dg = pptr[1] - bg;
-
- if (dg < 0)
- dg = -dg;
- if ((diff += dg) < best) { /* quick rejection */
- int db = pptr[2] - bb;
-
- if (db < 0)
- db = -db;
- if ((diff += db) < best)
- which = pptr, best = diff;
- }
- }
- if (diff == 0) /* can't get any better than 0 diff */
- break;
- pptr += 3;
- }
+ /* not 1 component, assume three */
+ /* The comparison is rather simplistic, treating differences in */
+ /* all components as equal. Better choices would be 'distance' */
+ /* in HLS space or other, but these would be much slower. */
+ /* At least exact matches will be found. */
+ byte bg = gx_color_value_to_byte(cv[1]);
+ byte bb = gx_color_value_to_byte(cv[2]);
+
+ while ((cnt -= 3) >= 0) {
+ register int diff = *pptr - br;
+
+ if (diff < 0)
+ diff = -diff;
+ if (diff < best) { /* quick rejection */
+ int dg = pptr[1] - bg;
+
+ if (dg < 0)
+ dg = -dg;
+ if ((diff += dg) < best) { /* quick rejection */
+ int db = pptr[2] - bb;
+
+ if (db < 0)
+ db = -db;
+ if ((diff += db) < best)
+ which = pptr, best = diff;
+ }
+ }
+ if (diff == 0) /* can't get any better than 0 diff */
+ break;
+ pptr += 3;
+ }
} else {
- /* Gray scale conversion. The palette is made of three equal */
- /* components, so this case is simpler. */
- while ((cnt -= 3) >= 0) {
- register int diff = *pptr - br;
-
- if (diff < 0)
- diff = -diff;
- if (diff < best) { /* quick rejection */
- which = pptr, best = diff;
- }
- if (diff == 0)
- break;
- pptr += 3;
- }
+ /* Gray scale conversion. The palette is made of three equal */
+ /* components, so this case is simpler. */
+ while ((cnt -= 3) >= 0) {
+ register int diff = *pptr - br;
+
+ if (diff < 0)
+ diff = -diff;
+ if (diff < best) { /* quick rejection */
+ which = pptr, best = diff;
+ }
+ if (diff == 0)
+ break;
+ pptr += 3;
+ }
}
return (gx_color_index) ((which - mdev->palette.data) / 3);
}
@@ -723,7 +721,7 @@ mem_mapped_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Map a color index to a r-g-b color for a mapped color memory device. */
int
mem_mapped_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
const byte *pptr = mdev->palette.data + (int)color * 3;
@@ -740,10 +738,10 @@ mem_mapped_map_color_rgb(gx_device * dev, gx_color_index color,
*/
int
mem_draw_thin_line(gx_device *dev, fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_drawing_color *pdcolor,
- gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ const gx_drawing_color *pdcolor,
+ gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
return gx_default_draw_thin_line(dev, fx0, fy0, fx1, fy1, pdcolor, lop,
- adjustx, adjusty);
+ adjustx, adjusty);
}
diff --git a/gs/base/gdevmem.h b/gs/base/gdevmem.h
index e27693ca7..39686cbac 100644
--- a/gs/base/gdevmem.h
+++ b/gs/base/gdevmem.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,16 +55,16 @@
* (not typedef) chunk as either uint or byte.
*/
#define declare_scan_ptr(ptr)\
- DECLARE_SCAN_PTR_VARS(ptr, chunk *, draster)
+ DECLARE_SCAN_PTR_VARS(ptr, chunk *, draster)
#define DECLARE_SCAN_PTR_VARS(ptr, ptype, draster)\
- register ptype ptr;\
- uint draster
+ register ptype ptr;\
+ uint draster
#define setup_rect(ptr)\
- SETUP_RECT_VARS(ptr, chunk *, draster)
+ SETUP_RECT_VARS(ptr, chunk *, draster)
#define SETUP_RECT_VARS(ptr, ptype, draster)\
- draster = mdev->raster;\
- ptr = (ptype)(scan_line_base(mdev, y) +\
- (x_to_byte(x) & -chunk_align_bytes))
+ draster = mdev->raster;\
+ ptr = (ptype)(scan_line_base(mdev, y) +\
+ (x_to_byte(x) & -chunk_align_bytes))
/* ------ Generic macros ------ */
@@ -117,73 +117,73 @@ dev_proc_strip_copy_rop(mem_default_strip_copy_rop);
rgb_depth == 1 ? 1 : (1 << gray_depth) - 1)
#define mem_full_alpha_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, map_cmyk_color, copy_alpha, strip_tile_rectangle, strip_copy_rop, get_bits_rectangle)\
{ std_device_dci_body(gx_device_memory, 0, name,\
- 0, 0, 72, 72,\
- (rgb_depth ? 3 : 0) + (gray_depth ? 1 : 0), /* num_components */\
- rgb_depth + gray_depth, /* depth */\
- max_value_gray(rgb_depth, gray_depth), /* max_gray */\
- max_value_rgb(rgb_depth, gray_depth), /* max_color */\
- max_value_gray(rgb_depth, gray_depth) + 1, /* dither_grays */\
- max_value_rgb(rgb_depth, gray_depth) + 1 /* dither_colors */\
- ),\
- { open, /* differs */\
- mem_get_initial_matrix,\
- gx_default_sync_output,\
- gx_default_output_page,\
- mem_close,\
- map_rgb_color, /* differs */\
- map_color_rgb, /* differs */\
- fill_rectangle, /* differs */\
- gx_default_tile_rectangle,\
- copy_mono, /* differs */\
- copy_color, /* differs */\
- gx_default_draw_line,\
- gx_default_get_bits,\
- gx_default_get_params,\
- gx_default_put_params,\
- map_cmyk_color, /* differs */\
- gx_forward_get_xfont_procs,\
- gx_forward_get_xfont_device,\
- gx_default_map_rgb_alpha_color,\
- gx_forward_get_page_device,\
- gx_default_get_alpha_bits, /* default is no alpha */\
- copy_alpha, /* differs */\
- gx_default_get_band,\
- gx_default_copy_rop,\
- gx_default_fill_path,\
- gx_default_stroke_path,\
- gx_default_fill_mask,\
- gx_default_fill_trapezoid,\
- gx_default_fill_parallelogram,\
- gx_default_fill_triangle,\
- mem_draw_thin_line, /* see above */\
- gx_default_begin_image,\
- gx_default_image_data,\
- gx_default_end_image,\
- strip_tile_rectangle, /* differs */\
- strip_copy_rop, /* differs */\
- gx_default_get_clipping_box,\
- gx_default_begin_typed_image,\
- get_bits_rectangle, /* differs */\
- gx_default_map_color_rgb_alpha,\
- gx_default_create_compositor,\
- gx_default_get_hardware_params,\
- gx_default_text_begin,\
- gx_default_finish_copydevice\
- },\
- 0, /* target */\
- mem_device_init_private /* see gxdevmem.h */\
+ 0, 0, 72, 72,\
+ (rgb_depth ? 3 : 0) + (gray_depth ? 1 : 0), /* num_components */\
+ rgb_depth + gray_depth, /* depth */\
+ max_value_gray(rgb_depth, gray_depth), /* max_gray */\
+ max_value_rgb(rgb_depth, gray_depth), /* max_color */\
+ max_value_gray(rgb_depth, gray_depth) + 1, /* dither_grays */\
+ max_value_rgb(rgb_depth, gray_depth) + 1 /* dither_colors */\
+ ),\
+ { open, /* differs */\
+ mem_get_initial_matrix,\
+ gx_default_sync_output,\
+ gx_default_output_page,\
+ mem_close,\
+ map_rgb_color, /* differs */\
+ map_color_rgb, /* differs */\
+ fill_rectangle, /* differs */\
+ gx_default_tile_rectangle,\
+ copy_mono, /* differs */\
+ copy_color, /* differs */\
+ gx_default_draw_line,\
+ gx_default_get_bits,\
+ gx_default_get_params,\
+ gx_default_put_params,\
+ map_cmyk_color, /* differs */\
+ gx_forward_get_xfont_procs,\
+ gx_forward_get_xfont_device,\
+ gx_default_map_rgb_alpha_color,\
+ gx_forward_get_page_device,\
+ gx_default_get_alpha_bits, /* default is no alpha */\
+ copy_alpha, /* differs */\
+ gx_default_get_band,\
+ gx_default_copy_rop,\
+ gx_default_fill_path,\
+ gx_default_stroke_path,\
+ gx_default_fill_mask,\
+ gx_default_fill_trapezoid,\
+ gx_default_fill_parallelogram,\
+ gx_default_fill_triangle,\
+ mem_draw_thin_line, /* see above */\
+ gx_default_begin_image,\
+ gx_default_image_data,\
+ gx_default_end_image,\
+ strip_tile_rectangle, /* differs */\
+ strip_copy_rop, /* differs */\
+ gx_default_get_clipping_box,\
+ gx_default_begin_typed_image,\
+ get_bits_rectangle, /* differs */\
+ gx_default_map_color_rgb_alpha,\
+ gx_default_create_compositor,\
+ gx_default_get_hardware_params,\
+ gx_default_text_begin,\
+ gx_default_finish_copydevice\
+ },\
+ 0, /* target */\
+ mem_device_init_private /* see gxdevmem.h */\
}
#define mem_full_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, map_cmyk_color, strip_tile_rectangle, strip_copy_rop, get_bits_rectangle)\
mem_full_alpha_device(name, rgb_depth, gray_depth, open, map_rgb_color,\
- map_color_rgb, copy_mono, copy_color, fill_rectangle,\
- map_cmyk_color, gx_default_copy_alpha,\
- strip_tile_rectangle, strip_copy_rop,\
- get_bits_rectangle)
+ map_color_rgb, copy_mono, copy_color, fill_rectangle,\
+ map_cmyk_color, gx_default_copy_alpha,\
+ strip_tile_rectangle, strip_copy_rop,\
+ get_bits_rectangle)
#define mem_device(name, rgb_depth, gray_depth, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, strip_copy_rop)\
mem_full_device(name, rgb_depth, gray_depth, mem_open, map_rgb_color,\
- map_color_rgb, copy_mono, copy_color, fill_rectangle,\
- gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,\
- strip_copy_rop, mem_get_bits_rectangle)
+ map_color_rgb, copy_mono, copy_color, fill_rectangle,\
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,\
+ strip_copy_rop, mem_get_bits_rectangle)
/* Swap a rectangle of bytes, for converting between word- and */
/* byte-oriented representation. */
@@ -192,9 +192,9 @@ void mem_swap_byte_rect(byte *, uint, int, int, int, bool);
/* Copy a rectangle of bytes from a source to a destination. */
#define mem_copy_byte_rect(mdev, base, sourcex, sraster, x, y, w, h)\
bytes_copy_rectangle(scan_line_base(mdev, y) + x_to_byte(x),\
- (mdev)->raster,\
- base + x_to_byte(sourcex), sraster,\
- x_to_byte(w), h)
+ (mdev)->raster,\
+ base + x_to_byte(sourcex), sraster,\
+ x_to_byte(w), h)
/* ------ Implementations ------ */
diff --git a/gs/base/gdevmgr.c b/gs/base/gdevmgr.c
index be4803650..2c836f679 100644
--- a/gs/base/gdevmgr.c
+++ b/gs/base/gdevmgr.c
@@ -18,11 +18,11 @@
/* Structure for MGR devices, which extend the generic printer device. */
struct gx_device_mgr_s {
- gx_device_common;
- gx_prn_device_common;
- /* Add MGR specific variables */
- int mgr_depth;
- /* globals for greymapped printing */
+ gx_device_common;
+ gx_prn_device_common;
+ /* Add MGR specific variables */
+ int mgr_depth;
+ /* globals for greymapped printing */
unsigned char bgreytable[16];
unsigned char bgreybacktable[16];
unsigned char bgrey256table[256];
@@ -44,13 +44,13 @@ static void swap_bwords(unsigned char *, int);
/* Macro for generating MGR device descriptors. */
#define mgr_prn_device(procs, dev_name, num_comp, depth, mgr_depth,\
- max_gray, max_rgb, dither_gray, dither_rgb, print_page)\
+ max_gray, max_rgb, dither_gray, dither_rgb, print_page)\
{ prn_device_body(gx_device_mgr, procs, dev_name,\
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI,\
- 0, 0, 0, 0,\
- num_comp, depth, max_gray, max_rgb, dither_gray, dither_rgb,\
- print_page),\
- mgr_depth\
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI,\
+ 0, 0, 0, 0,\
+ num_comp, depth, max_gray, max_rgb, dither_gray, dither_rgb,\
+ print_page),\
+ mgr_depth\
}
/* For all mgr variants we do some extra things at opening time. */
@@ -67,13 +67,13 @@ static gx_device_procs mgr_procs =
prn_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close);
static gx_device_procs mgrN_procs =
prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
static gx_device_procs cmgr4_procs =
prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
+ pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
static gx_device_procs cmgr8_procs =
prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- mgr_8bit_map_rgb_color, mgr_8bit_map_color_rgb);
+ mgr_8bit_map_rgb_color, mgr_8bit_map_color_rgb);
/* The device descriptors themselves */
gx_device_mgr far_data gs_mgrmono_device =
@@ -93,11 +93,11 @@ gx_device_mgr far_data gs_mgr8_device =
/* Define a "cursor" that keeps track of where we are in the page. */
typedef struct mgr_cursor_s {
- gx_device_mgr *dev;
- int bpp; /* bits per pixel */
- uint line_size; /* bytes per scan line */
- byte *data; /* output row buffer */
- int lnum; /* row within page */
+ gx_device_mgr *dev;
+ int bpp; /* bits per pixel */
+ uint line_size; /* bytes per scan line */
+ byte *data; /* output row buffer */
+ int lnum; /* row within page */
} mgr_cursor;
/* Begin an MGR output page. */
@@ -105,40 +105,40 @@ typedef struct mgr_cursor_s {
static int
mgr_begin_page(gx_device_mgr *bdev, FILE *pstream, mgr_cursor *pcur)
{ struct b_header head;
- uint line_size =
- gdev_prn_raster((gx_device_printer *)bdev) + 3;
- byte *data = (byte *)gs_malloc(bdev->memory, line_size, 1, "mgr_begin_page");
- if ( data == 0 )
- return_error(gs_error_VMerror);
-
- /* Write the header */
- B_PUTHDR8(&head, bdev->width, bdev->height, bdev->mgr_depth);
- fprintf(pstream, "");
- if ( fwrite(&head, 1, sizeof(head), pstream) < sizeof(head) )
- return_error(gs_error_ioerror);
- fflush(pstream);
-
- /* Initialize the cursor. */
- pcur->dev = bdev;
- pcur->bpp = bdev->color_info.depth;
- pcur->line_size = line_size;
- pcur->data = data;
- pcur->lnum = 0;
- return 0;
+ uint line_size =
+ gdev_prn_raster((gx_device_printer *)bdev) + 3;
+ byte *data = (byte *)gs_malloc(bdev->memory, line_size, 1, "mgr_begin_page");
+ if ( data == 0 )
+ return_error(gs_error_VMerror);
+
+ /* Write the header */
+ B_PUTHDR8(&head, bdev->width, bdev->height, bdev->mgr_depth);
+ fprintf(pstream, "");
+ if ( fwrite(&head, 1, sizeof(head), pstream) < sizeof(head) )
+ return_error(gs_error_ioerror);
+ fflush(pstream);
+
+ /* Initialize the cursor. */
+ pcur->dev = bdev;
+ pcur->bpp = bdev->color_info.depth;
+ pcur->line_size = line_size;
+ pcur->data = data;
+ pcur->lnum = 0;
+ return 0;
}
/* Advance to the next row. Return 0 if more, 1 if done. */
static int
mgr_next_row(mgr_cursor *pcur)
{ if ( pcur->lnum >= pcur->dev->height )
- { gs_free(((gx_device_printer *)pcur->dev)->memory,
- (char *)pcur->data, pcur->line_size, 1,
- "mgr_next_row(done)");
- return 1;
- }
- gdev_prn_copy_scan_lines((gx_device_printer *)pcur->dev,
- pcur->lnum++, pcur->data, pcur->line_size);
- return 0;
+ { gs_free(((gx_device_printer *)pcur->dev)->memory,
+ (char *)pcur->data, pcur->line_size, 1,
+ "mgr_next_row(done)");
+ return 1;
+ }
+ gdev_prn_copy_scan_lines((gx_device_printer *)pcur->dev,
+ pcur->lnum++, pcur->data, pcur->line_size);
+ return 0;
}
/* ------ Individual page printing routines ------ */
@@ -149,196 +149,195 @@ mgr_next_row(mgr_cursor *pcur)
static int
mgr_print_page(gx_device_printer *pdev, FILE *pstream)
{ mgr_cursor cur;
- int mgr_wide;
- int code = mgr_begin_page(bdev, pstream, &cur);
- if ( code < 0 ) return code;
+ int mgr_wide;
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
- mgr_wide = bdev->width;
- if (mgr_wide & 7)
- mgr_wide += 8 - (mgr_wide & 7);
+ mgr_wide = bdev->width;
+ if (mgr_wide & 7)
+ mgr_wide += 8 - (mgr_wide & 7);
- while ( !(code = mgr_next_row(&cur)) )
- { if ( fwrite(cur.data, sizeof(char), mgr_wide / 8, pstream) <
+ while ( !(code = mgr_next_row(&cur)) )
+ { if ( fwrite(cur.data, sizeof(char), mgr_wide / 8, pstream) <
mgr_wide / 8)
- return_error(gs_error_ioerror);
- }
- return (code < 0 ? code : 0);
+ return_error(gs_error_ioerror);
+ }
+ return (code < 0 ? code : 0);
}
-
/* Print a gray-mapped page. */
static int
mgrN_print_page(gx_device_printer *pdev, FILE *pstream)
{ mgr_cursor cur;
- int i = 0, j, k, mgr_wide;
- uint mgr_line_size;
- byte *bp, *data = NULL, *dp;
- gx_device_mgr *mgr = (gx_device_mgr *)pdev;
+ int i = 0, j, k, mgr_wide;
+ uint mgr_line_size;
+ byte *bp, *data = NULL, *dp;
+ gx_device_mgr *mgr = (gx_device_mgr *)pdev;
- int code = mgr_begin_page(bdev, pstream, &cur);
- if ( code < 0 ) return code;
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
- mgr_wide = bdev->width;
- if ( bdev->mgr_depth == 2 && mgr_wide & 3 )
+ mgr_wide = bdev->width;
+ if ( bdev->mgr_depth == 2 && mgr_wide & 3 )
mgr_wide += 4 - (mgr_wide & 3);
- if ( bdev->mgr_depth == 4 && mgr_wide & 1 )
+ if ( bdev->mgr_depth == 4 && mgr_wide & 1 )
mgr_wide++;
- mgr_line_size = mgr_wide / ( 8 / bdev->mgr_depth );
+ mgr_line_size = mgr_wide / ( 8 / bdev->mgr_depth );
- if ( bdev->mgr_depth == 4 )
+ if ( bdev->mgr_depth == 4 )
for ( i = 0; i < 16; i++ ) {
- mgr->bgreytable[i] = mgrlut[LUT_BGREY][RGB_RED][i];
- mgr->bgreybacktable[mgr->bgreytable[i]] = i;
+ mgr->bgreytable[i] = mgrlut[LUT_BGREY][RGB_RED][i];
+ mgr->bgreybacktable[mgr->bgreytable[i]] = i;
}
- if ( bdev->mgr_depth == 8 ) {
+ if ( bdev->mgr_depth == 8 ) {
for ( i = 0; i < 16; i++ ) {
- mgr->bgrey256table[i] = mgrlut[LUT_BGREY][RGB_RED][i] << 4;
- mgr->bgrey256backtable[mgr->bgrey256table[i]] = i;
+ mgr->bgrey256table[i] = mgrlut[LUT_BGREY][RGB_RED][i] << 4;
+ mgr->bgrey256backtable[mgr->bgrey256table[i]] = i;
}
for ( i = 16,j = 0; i < 256; i++ ) {
- for ( k = 0; k < 16; k++ )
+ for ( k = 0; k < 16; k++ )
if ( j == mgrlut[LUT_BGREY][RGB_RED][k] << 4 ) {
j++;
break;
}
- mgr->bgrey256table[i] = j;
- mgr->bgrey256backtable[j++] = i;
+ mgr->bgrey256table[i] = j;
+ mgr->bgrey256backtable[j++] = i;
}
- }
-
- if ( bdev->mgr_depth != 8 )
- data = (byte *)gs_malloc(pdev->memory, mgr_line_size, 1, "mgrN_print_page");
-
- while ( !(code = mgr_next_row(&cur)) )
- {
- switch (bdev->mgr_depth) {
- case 2:
- for (i = 0,dp = data,bp = cur.data; i < mgr_line_size; i++) {
- *dp = *(bp++) & 0xc0;
- *dp |= (*(bp++) & 0xc0) >> 2;
- *dp |= (*(bp++) & 0xc0) >> 4;
+ }
+
+ if ( bdev->mgr_depth != 8 )
+ data = (byte *)gs_malloc(pdev->memory, mgr_line_size, 1, "mgrN_print_page");
+
+ while ( !(code = mgr_next_row(&cur)) )
+ {
+ switch (bdev->mgr_depth) {
+ case 2:
+ for (i = 0,dp = data,bp = cur.data; i < mgr_line_size; i++) {
+ *dp = *(bp++) & 0xc0;
+ *dp |= (*(bp++) & 0xc0) >> 2;
+ *dp |= (*(bp++) & 0xc0) >> 4;
*(dp++) |= (*(bp++) & 0xc0) >> 6;
- }
- if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
- return_error(gs_error_ioerror);
- break;
-
- case 4:
- for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
- *dp = mgr->bgreybacktable[*(bp++) >> 4] << 4;
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 4:
+ for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
+ *dp = mgr->bgreybacktable[*(bp++) >> 4] << 4;
*(dp++) |= mgr->bgreybacktable[*(bp++) >> 4];
- }
- if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
- return_error(gs_error_ioerror);
- break;
-
- case 8:
- for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
- *bp = mgr->bgrey256backtable[*bp];
- if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream)
- < mgr_line_size )
- return_error(gs_error_ioerror);
- break;
- }
- }
- if (bdev->mgr_depth != 8)
- gs_free(bdev->memory, (char *)data, mgr_line_size, 1, "mgrN_print_page(done)");
-
- if (bdev->mgr_depth == 2) {
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 8:
+ for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
+ *bp = mgr->bgrey256backtable[*bp];
+ if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream)
+ < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+ }
+ }
+ if (bdev->mgr_depth != 8)
+ gs_free(bdev->memory, (char *)data, mgr_line_size, 1, "mgrN_print_page(done)");
+
+ if (bdev->mgr_depth == 2) {
for (i = 0; i < 4; i++) {
mgr->clut[i].colnum = i;
mgr->clut[i].red = mgr->clut[i].green = mgr->clut[i].blue = clut2mgr(i, 2);
- }
- }
- if (bdev->mgr_depth == 4) {
+ }
+ }
+ if (bdev->mgr_depth == 4) {
for (i = 0; i < 16; i++) {
mgr->clut[i].colnum = i;
mgr->clut[i].red = mgr->clut[i].green = mgr->clut[i].blue = clut2mgr(mgr->bgreytable[i], 4);
- }
- }
- if (bdev->mgr_depth == 8) {
+ }
+ }
+ if (bdev->mgr_depth == 8) {
for (i = 0; i < 256; i++) {
mgr->clut[i].colnum = i;
mgr->clut[i].red = mgr->clut[i].green = mgr->clut[i].blue = clut2mgr(mgr->bgrey256table[i], 8);
- }
- }
+ }
+ }
#if !arch_is_big_endian
- swap_bwords( (unsigned char *) mgr->clut, sizeof( struct nclut ) * i );
+ swap_bwords( (unsigned char *) mgr->clut, sizeof( struct nclut ) * i );
#endif
- if ( fwrite(&mgr->clut, sizeof(struct nclut), i, pstream) < i )
+ if ( fwrite(&mgr->clut, sizeof(struct nclut), i, pstream) < i )
return_error(gs_error_ioerror);
- return (code < 0 ? code : 0);
+ return (code < 0 ? code : 0);
}
/* Print a color page. */
static int
cmgrN_print_page(gx_device_printer *pdev, FILE *pstream)
{ mgr_cursor cur;
- int i = 0, j, mgr_wide, r, g, b, colors8 = 0;
- uint mgr_line_size;
- byte *bp, *data, *dp;
- ushort prgb[3];
- unsigned char table[256], backtable[256];
- gx_device_mgr *mgr = (gx_device_mgr *)pdev;
-
- int code = mgr_begin_page(bdev, pstream, &cur);
- if ( code < 0 ) return code;
-
- mgr_wide = bdev->width;
- if (bdev->mgr_depth == 4 && mgr_wide & 1)
+ int i = 0, j, mgr_wide, r, g, b, colors8 = 0;
+ uint mgr_line_size;
+ byte *bp, *data, *dp;
+ ushort prgb[3];
+ unsigned char table[256], backtable[256];
+ gx_device_mgr *mgr = (gx_device_mgr *)pdev;
+
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
+
+ mgr_wide = bdev->width;
+ if (bdev->mgr_depth == 4 && mgr_wide & 1)
mgr_wide++;
- mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
- data = (byte *)gs_malloc(pdev->memory, mgr_line_size, 1, "cmgrN_print_page");
+ mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
+ data = (byte *)gs_malloc(pdev->memory, mgr_line_size, 1, "cmgrN_print_page");
- if ( bdev->mgr_depth == 8 ) {
+ if ( bdev->mgr_depth == 8 ) {
memset( table, 0, sizeof(table) );
for ( r = 0; r <= 6; r++ )
- for ( g = 0; g <= 6; g++ )
- for ( b = 0; b <= 6; b++ )
- if ( r == g && g == b )
+ for ( g = 0; g <= 6; g++ )
+ for ( b = 0; b <= 6; b++ )
+ if ( r == g && g == b )
table[ r + (256-7) ] = 1;
- else
+ else
table[ (r << 5) + (g << 2) + (b >> 1) ] = 1;
for ( i = j = 0; i < sizeof(table); i++ )
- if ( table[i] == 1 ) {
+ if ( table[i] == 1 ) {
backtable[i] = j;
table[j++] = i;
- }
+ }
colors8 = j;
- }
- while ( !(code = mgr_next_row(&cur)) )
- {
- switch (bdev->mgr_depth) {
- case 4:
- for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
- *dp = *(bp++) << 4;
+ }
+ while ( !(code = mgr_next_row(&cur)) )
+ {
+ switch (bdev->mgr_depth) {
+ case 4:
+ for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
+ *dp = *(bp++) << 4;
*(dp++) |= *(bp++) & 0x0f;
- }
- if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
- return_error(gs_error_ioerror);
- break;
-
- case 8:
- for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
- *bp = backtable[*bp] + MGR_RESERVEDCOLORS;
- if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream) < mgr_line_size )
- return_error(gs_error_ioerror);
- break;
- }
- }
- gs_free(bdev->memory, (char *)data, mgr_line_size, 1, "cmgrN_print_page(done)");
-
- if (bdev->mgr_depth == 4) {
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 8:
+ for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
+ *bp = backtable[*bp] + MGR_RESERVEDCOLORS;
+ if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+ }
+ }
+ gs_free(bdev->memory, (char *)data, mgr_line_size, 1, "cmgrN_print_page(done)");
+
+ if (bdev->mgr_depth == 4) {
for (i = 0; i < 16; i++) {
pc_4bit_map_color_rgb((gx_device *)0, (gx_color_index) i, prgb);
mgr->clut[i].colnum = i;
mgr->clut[i].red = clut2mgr(prgb[0], 16);
mgr->clut[i].green = clut2mgr(prgb[1], 16);
mgr->clut[i].blue = clut2mgr(prgb[2], 16);
- }
- }
- if (bdev->mgr_depth == 8) {
+ }
+ }
+ if (bdev->mgr_depth == 8) {
for (i = 0; i < colors8; i++) {
mgr_8bit_map_color_rgb((gx_device *)0, (gx_color_index)
table[i], prgb);
@@ -346,17 +345,16 @@ cmgrN_print_page(gx_device_printer *pdev, FILE *pstream)
mgr->clut[i].red = clut2mgr(prgb[0], 16);
mgr->clut[i].green = clut2mgr(prgb[1], 16);
mgr->clut[i].blue = clut2mgr(prgb[2], 16);
- }
- }
+ }
+ }
#if !arch_is_big_endian
- swap_bwords( (unsigned char *) mgr->clut, sizeof( struct nclut ) * i );
+ swap_bwords( (unsigned char *) mgr->clut, sizeof( struct nclut ) * i );
#endif
- if ( fwrite(&mgr->clut, sizeof(struct nclut), i, pstream) < i )
+ if ( fwrite(&mgr->clut, sizeof(struct nclut), i, pstream) < i )
return_error(gs_error_ioerror);
- return (code < 0 ? code : 0);
+ return (code < 0 ? code : 0);
}
-
/* Color mapping routines for 8-bit color with a fixed palette */
/* (3 bits of R, 3 bits of G, 2 bits of B). */
/* We have to trade off even spacing of colors along each axis */
@@ -367,38 +365,37 @@ cmgrN_print_page(gx_device_printer *pdev, FILE *pstream)
gx_color_index
mgr_8bit_map_rgb_color(gx_device *dev, const gx_color_value cv[])
{
- uint rv = cv[0] / (gx_max_color_value / 7 + 1);
- uint gv = cv[1] / (gx_max_color_value / 7 + 1);
- uint bv = cv[2] / (gx_max_color_value / 7 + 1);
- return (gx_color_index)
- (rv == gv && gv == bv ? rv + (256-7) :
- (rv << 5) + (gv << 2) + (bv >> 1));
+ uint rv = cv[0] / (gx_max_color_value / 7 + 1);
+ uint gv = cv[1] / (gx_max_color_value / 7 + 1);
+ uint bv = cv[2] / (gx_max_color_value / 7 + 1);
+ return (gx_color_index)
+ (rv == gv && gv == bv ? rv + (256-7) :
+ (rv << 5) + (gv << 2) + (bv >> 1));
}
int
mgr_8bit_map_color_rgb(gx_device *dev, gx_color_index color,
gx_color_value prgb[3])
{ static const gx_color_value ramp[8] =
- { 0, gx_max_color_value / 6, gx_max_color_value / 3,
- gx_max_color_value / 2, 2 * (gx_max_color_value / 3),
- 5 * (gx_max_color_value / 6), gx_max_color_value,
- /* The 8th entry is not actually ever used, */
- /* except to fill out the palette. */
- gx_max_color_value
- };
+ { 0, gx_max_color_value / 6, gx_max_color_value / 3,
+ gx_max_color_value / 2, 2 * (gx_max_color_value / 3),
+ 5 * (gx_max_color_value / 6), gx_max_color_value,
+ /* The 8th entry is not actually ever used, */
+ /* except to fill out the palette. */
+ gx_max_color_value
+ };
#define icolor (uint)color
- if ( icolor >= 256-7 )
- { prgb[0] = prgb[1] = prgb[2] = ramp[icolor - (256-7)];
- }
- else
- { prgb[0] = ramp[(icolor >> 5) & 7];
- prgb[1] = ramp[(icolor >> 2) & 7];
- prgb[2] = ramp[(icolor & 3) << 1];
- }
+ if ( icolor >= 256-7 )
+ { prgb[0] = prgb[1] = prgb[2] = ramp[icolor - (256-7)];
+ }
+ else
+ { prgb[0] = ramp[(icolor >> 5) & 7];
+ prgb[1] = ramp[(icolor >> 2) & 7];
+ prgb[2] = ramp[(icolor & 3) << 1];
+ }
#undef icolor
- return 0;
+ return 0;
}
-
/* convert the 8-bit look-up table into the standard MGR look-up table */
static unsigned int
clut2mgr(
@@ -412,7 +409,6 @@ clut2mgr(
return((v*i)/0x10000);
}
-
/*
* s w a p _ b w o r d s
*/
diff --git a/gs/base/gdevmgr.h b/gs/base/gdevmgr.h
index f62cb34ab..9ff7e9fcd 100644
--- a/gs/base/gdevmgr.h
+++ b/gs/base/gdevmgr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,6 @@
dev_proc_map_rgb_color(mgr_8bit_map_rgb_color);
dev_proc_map_color_rgb(mgr_8bit_map_color_rgb);
-
/* extract from dump.h */
/*
@@ -30,13 +29,13 @@ dev_proc_map_color_rgb(mgr_8bit_map_color_rgb);
*/
#define B_PUTHDR8(hdr, w, h, d) ( \
- (hdr)->magic[0] = 'y', (hdr)->magic[1] = 'z', \
- (hdr)->h_wide = (((w) >> 6) & 0x3f) + ' ', \
- (hdr)->l_wide = ((w) & 0x3f) + ' ', \
- (hdr)->h_high = (((h) >> 6) & 0x3f) + ' ', \
- (hdr)->l_high = ((h) & 0x3f) + ' ', \
- (hdr)->depth = ((d) & 0x3f) + ' ', \
- (hdr)->_reserved = ' ' )
+ (hdr)->magic[0] = 'y', (hdr)->magic[1] = 'z', \
+ (hdr)->h_wide = (((w) >> 6) & 0x3f) + ' ', \
+ (hdr)->l_wide = ((w) & 0x3f) + ' ', \
+ (hdr)->h_high = (((h) >> 6) & 0x3f) + ' ', \
+ (hdr)->l_high = ((h) & 0x3f) + ' ', \
+ (hdr)->depth = ((d) & 0x3f) + ' ', \
+ (hdr)->_reserved = ' ' )
struct b_header {
char magic[2]; /* magics */
@@ -56,7 +55,6 @@ struct nclut {
unsigned short red, green, blue;
} ;
-
/* extract from color.h */
/*
diff --git a/gs/base/gdevmiff.c b/gs/base/gdevmiff.c
index a1e4b39f4..9d4e380a5 100644
--- a/gs/base/gdevmiff.c
+++ b/gs/base/gdevmiff.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,13 +26,13 @@ static dev_proc_print_page(miff24_print_page);
static const gx_device_procs miff24_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
const gx_device_printer gs_miff24_device =
prn_device(miff24_procs, "miff24",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 24, miff24_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 24, miff24_print_page);
/* Print one page in 24-bit RLE direct color format. */
static int
@@ -44,7 +44,7 @@ miff24_print_page(gx_device_printer * pdev, FILE * file)
int code = 0; /* return code */
if (line == 0) /* can't allocate line buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
fputs("id=ImageMagick\n", file);
fputs("class=DirectClass\n", file);
fprintf(file, "columns=%d\n", pdev->width);
@@ -52,27 +52,27 @@ miff24_print_page(gx_device_printer * pdev, FILE * file)
fprintf(file, "rows=%d\n", pdev->height);
fputs(":\n", file);
for (y = 0; y < pdev->height; ++y) {
- byte *row;
- byte *end;
+ byte *row;
+ byte *end;
- code = gdev_prn_get_bits(pdev, y, line, &row);
- if (code < 0)
- break;
- end = row + pdev->width * 3;
- while (row < end) {
- int count = 0;
+ code = gdev_prn_get_bits(pdev, y, line, &row);
+ if (code < 0)
+ break;
+ end = row + pdev->width * 3;
+ while (row < end) {
+ int count = 0;
- while (count < 255 && row < end - 3 &&
- row[0] == row[3] && row[1] == row[4] &&
- row[2] == row[5]
- )
- ++count, row += 3;
- putc(row[0], file);
- putc(row[1], file);
- putc(row[2], file);
- putc(count, file);
- row += 3;
- }
+ while (count < 255 && row < end - 3 &&
+ row[0] == row[3] && row[1] == row[4] &&
+ row[2] == row[5]
+ )
+ ++count, row += 3;
+ putc(row[0], file);
+ putc(row[1], file);
+ putc(row[2], file);
+ putc(count, file);
+ row += 3;
+ }
}
gs_free_object(pdev->memory, line, "miff line buffer");
diff --git a/gs/base/gdevmpla.h b/gs/base/gdevmpla.h
index d5fbd3256..68164c6b4 100644
--- a/gs/base/gdevmpla.h
+++ b/gs/base/gdevmpla.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,6 +37,6 @@
* mdev->color_info.depth.
*/
int gdev_mem_set_planar(gx_device_memory * mdev, int num_planes,
- const gx_render_plane_t *planes /*[num_planes]*/);
+ const gx_render_plane_t *planes /*[num_planes]*/);
#endif /* gdevmpla_INCLUDED */
diff --git a/gs/base/gdevmr1.c b/gs/base/gdevmr1.c
index def18de35..a9da4dda2 100644
--- a/gs/base/gdevmr1.c
+++ b/gs/base/gdevmr1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,11 +35,11 @@
int
mem_mono_strip_copy_rop(gx_device * dev, const byte * sdata,
int sourcex,uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
+ const gx_color_index * scolors,
const gx_strip_bitmap * textures,
const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y,
gs_logical_operation_t lop)
{
gx_device_memory *mdev = (gx_device_memory *) dev;
@@ -51,21 +51,21 @@ mem_mono_strip_copy_rop(gx_device * dev, const byte * sdata,
if (mdev->palette.data == 0) {
gx_color_value cv[3];
cv[0] = cv[1] = cv[2] = 0;
- gdev_mem_mono_set_inverted(mdev,
- (*dev_proc(dev, map_rgb_color))
- (dev, cv) != 0);
+ gdev_mem_mono_set_inverted(mdev,
+ (*dev_proc(dev, map_rgb_color))
+ (dev, cv) != 0);
}
invert = mdev->palette.data[0] != 0;
#ifdef DEBUG
if (gs_debug_c('b'))
- trace_copy_rop("mem_mono_strip_copy_rop",
- dev, sdata, sourcex, sraster,
- id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
+ trace_copy_rop("mem_mono_strip_copy_rop",
+ dev, sdata, sourcex, sraster,
+ id, scolors, textures, tcolors,
+ x, y, width, height, phase_x, phase_y, lop);
if (gs_debug_c('B'))
- debug_dump_bitmap(scan_line_base(mdev, y), mdev->raster,
- height, "initial dest bits");
+ debug_dump_bitmap(scan_line_base(mdev, y), mdev->raster,
+ height, "initial dest bits");
#endif
/*
@@ -77,10 +77,10 @@ mem_mono_strip_copy_rop(gx_device * dev, const byte * sdata,
*/
if (invert)
- rop = byte_reverse_bits[rop] ^ 0xff;
+ rop = byte_reverse_bits[rop] ^ 0xff;
return mem_mono_strip_copy_rop_dev(dev, sdata, sourcex, sraster, id,
- scolors, textures, tcolors, x, y,
- width, height, phase_x, phase_y,
+ scolors, textures, tcolors, x, y,
+ width, height, phase_x, phase_y,
(gs_logical_operation_t)rop);
}
diff --git a/gs/base/gdevmr2n.c b/gs/base/gdevmr2n.c
index 167c27e8e..7716f12db 100644
--- a/gs/base/gdevmr2n.c
+++ b/gs/base/gdevmr2n.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,35 +40,35 @@
*/
static int
mem_gray_rop_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
return -1;
}
static int
mem_gray_rop_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
return -1;
}
static int
mem_gray_rop_strip_tile_rectangle(gx_device * dev,
- const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1,
- int px, int py)
+ const gx_strip_bitmap * tiles,
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1,
+ int px, int py)
{
return -1;
}
int
mem_gray_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_color_index scolors2[2];
const gx_color_index *real_scolors = scolors;
@@ -84,53 +84,53 @@ mem_gray_strip_copy_rop(gx_device * dev,
#ifdef DEBUG
if (gs_debug_c('b'))
- trace_copy_rop("mem_gray_strip_copy_rop",
- dev, sdata, sourcex, sraster,
- id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
+ trace_copy_rop("mem_gray_strip_copy_rop",
+ dev, sdata, sourcex, sraster,
+ id, scolors, textures, tcolors,
+ x, y, width, height, phase_x, phase_y, lop);
#endif
if (gx_device_has_color(dev) ||
- (lop & (lop_S_transparent | lop_T_transparent)) ||
- (scolors && /* must be (0,0) or (max,max) */
- ((scolors[0] | scolors[1]) != 0) &&
- ((scolors[0] & scolors[1]) != max_pixel)) ||
- (tcolors && (tcolors[0] != tcolors[1]))
- ) {
- /* We can't fake it: do it the slow, painful way. */
- return mem_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
- scolors, textures, tcolors,
- x, y, width, height,
- phase_x, phase_y, lop);
+ (lop & (lop_S_transparent | lop_T_transparent)) ||
+ (scolors && /* must be (0,0) or (max,max) */
+ ((scolors[0] | scolors[1]) != 0) &&
+ ((scolors[0] & scolors[1]) != max_pixel)) ||
+ (tcolors && (tcolors[0] != tcolors[1]))
+ ) {
+ /* We can't fake it: do it the slow, painful way. */
+ return mem_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
+ scolors, textures, tcolors,
+ x, y, width, height,
+ phase_x, phase_y, lop);
}
if (scolors) { /* Must be a solid color: see above. */
- scolors2[0] = scolors2[1] = scolors[0] & 1;
- real_scolors = scolors2;
+ scolors2[0] = scolors2[1] = scolors[0] & 1;
+ real_scolors = scolors2;
}
if (textures) {
- texture2 = *textures;
- texture2.size.x <<= log2_depth;
- texture2.rep_width <<= log2_depth;
- texture2.shift <<= log2_depth;
- texture2.rep_shift <<= log2_depth;
- real_texture = &texture2;
+ texture2 = *textures;
+ texture2.size.x <<= log2_depth;
+ texture2.rep_width <<= log2_depth;
+ texture2.shift <<= log2_depth;
+ texture2.rep_shift <<= log2_depth;
+ real_texture = &texture2;
}
if (tcolors) {
- /* For polybit textures with colors other than */
- /* all 0s or all 1s, fabricate the data. */
- if (tcolors[0] != 0 && tcolors[0] != max_pixel) {
- real_tcolors = 0;
- *(byte *) & tdata = (byte) tcolors[0] << (8 - depth);
- texture2.data = (byte *) & tdata;
- texture2.raster = align_bitmap_mod;
- texture2.size.x = texture2.rep_width = depth;
- texture2.size.y = texture2.rep_height = 1;
- texture2.id = gx_no_bitmap_id;
- texture2.shift = texture2.rep_shift = 0;
- real_texture = &texture2;
- } else {
- tcolors2[0] = tcolors2[1] = tcolors[0] & 1;
- real_tcolors = tcolors2;
- }
+ /* For polybit textures with colors other than */
+ /* all 0s or all 1s, fabricate the data. */
+ if (tcolors[0] != 0 && tcolors[0] != max_pixel) {
+ real_tcolors = 0;
+ *(byte *) & tdata = (byte) tcolors[0] << (8 - depth);
+ texture2.data = (byte *) & tdata;
+ texture2.raster = align_bitmap_mod;
+ texture2.size.x = texture2.rep_width = depth;
+ texture2.size.y = texture2.rep_height = 1;
+ texture2.id = gx_no_bitmap_id;
+ texture2.shift = texture2.rep_shift = 0;
+ real_texture = &texture2;
+ } else {
+ tcolors2[0] = tcolors2[1] = tcolors[0] & 1;
+ real_tcolors = tcolors2;
+ }
}
/*
* mem_mono_strip_copy_rop may call fill_rectangle, copy_mono, or
@@ -139,36 +139,36 @@ mem_gray_strip_copy_rop(gx_device * dev,
* an error.
*/
{
- dev_proc_fill_rectangle((*fill_rectangle)) =
- dev_proc(dev, fill_rectangle);
- dev_proc_copy_mono((*copy_mono)) =
- dev_proc(dev, copy_mono);
- dev_proc_strip_tile_rectangle((*strip_tile_rectangle)) =
- dev_proc(dev, strip_tile_rectangle);
+ dev_proc_fill_rectangle((*fill_rectangle)) =
+ dev_proc(dev, fill_rectangle);
+ dev_proc_copy_mono((*copy_mono)) =
+ dev_proc(dev, copy_mono);
+ dev_proc_strip_tile_rectangle((*strip_tile_rectangle)) =
+ dev_proc(dev, strip_tile_rectangle);
- set_dev_proc(dev, fill_rectangle, mem_gray_rop_fill_rectangle);
- set_dev_proc(dev, copy_mono, mem_gray_rop_copy_mono);
- set_dev_proc(dev, strip_tile_rectangle,
- mem_gray_rop_strip_tile_rectangle);
- dev->width <<= log2_depth;
- code = mem_mono_strip_copy_rop(dev, sdata,
- (real_scolors == NULL ?
- sourcex << log2_depth : sourcex),
- sraster, id, real_scolors,
- real_texture, real_tcolors,
- x << log2_depth, y,
- width << log2_depth, height,
- phase_x << log2_depth, phase_y, lop);
- set_dev_proc(dev, fill_rectangle, fill_rectangle);
- set_dev_proc(dev, copy_mono, copy_mono);
- set_dev_proc(dev, strip_tile_rectangle, strip_tile_rectangle);
- dev->width >>= log2_depth;
+ set_dev_proc(dev, fill_rectangle, mem_gray_rop_fill_rectangle);
+ set_dev_proc(dev, copy_mono, mem_gray_rop_copy_mono);
+ set_dev_proc(dev, strip_tile_rectangle,
+ mem_gray_rop_strip_tile_rectangle);
+ dev->width <<= log2_depth;
+ code = mem_mono_strip_copy_rop(dev, sdata,
+ (real_scolors == NULL ?
+ sourcex << log2_depth : sourcex),
+ sraster, id, real_scolors,
+ real_texture, real_tcolors,
+ x << log2_depth, y,
+ width << log2_depth, height,
+ phase_x << log2_depth, phase_y, lop);
+ set_dev_proc(dev, fill_rectangle, fill_rectangle);
+ set_dev_proc(dev, copy_mono, copy_mono);
+ set_dev_proc(dev, strip_tile_rectangle, strip_tile_rectangle);
+ dev->width >>= log2_depth;
}
/* If we punted, use the general procedure. */
if (code < 0)
- return mem_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
- scolors, textures, tcolors,
- x, y, width, height,
- phase_x, phase_y, lop);
+ return mem_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
+ scolors, textures, tcolors,
+ x, y, width, height,
+ phase_x, phase_y, lop);
return code;
}
diff --git a/gs/base/gdevmrop.h b/gs/base/gdevmrop.h
index 950bd2e55..447ec001a 100644
--- a/gs/base/gdevmrop.h
+++ b/gs/base/gdevmrop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,12 +26,12 @@ gs_rop3_t gs_transparent_rop(gs_logical_operation_t lop);
#ifdef DEBUG
/* Trace a [strip_]copy_rop call. */
void trace_copy_rop(const char *cname, gx_device * dev,
- const byte * sdata, int sourcex, uint sraster,
- gx_bitmap_id id, const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop);
+ const byte * sdata, int sourcex, uint sraster,
+ gx_bitmap_id id, const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop);
#endif
/*
@@ -67,13 +67,13 @@ struct gx_device_rop_texture_s {
/* Create a RasterOp source device. */
int gx_alloc_rop_texture_device(gx_device_rop_texture ** prsdev,
- gs_memory_t * mem,
- client_name_t cname);
+ gs_memory_t * mem,
+ client_name_t cname);
/* Initialize a RasterOp source device. */
void gx_make_rop_texture_device(gx_device_rop_texture * rsdev,
- gx_device * target,
- gs_logical_operation_t lop,
- const gx_device_color * texture);
+ gx_device * target,
+ gs_logical_operation_t lop,
+ const gx_device_color * texture);
#endif /* gdevmrop_INCLUDED */
diff --git a/gs/base/gdevmrun.c b/gs/base/gdevmrun.c
index c5433dbd3..36010ece0 100644
--- a/gs/base/gdevmrun.c
+++ b/gs/base/gdevmrun.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -95,7 +95,7 @@ typedef struct const_run_ptr_s {
*/
typedef struct run_line_s {
gx_color_index zero; /* device white if line not initialized, */
- /* gx_no_color_index if initialized */
+ /* gx_no_color_index if initialized */
uint xcur; /* x value at cursor position */
run_ptr rpcur; /* cursor */
run_index free; /* head of free list */
@@ -122,7 +122,7 @@ rp_insert_next(run_ptr *prpc, run *data, run_line *line, run_ptr *prpn)
run *prnew = data + new;
if (new == 0)
- return -1;
+ return -1;
RP_TO_NEXT(*prpc, data, *prpn);
RP_NEXT(*prpc) = new;
RP_PREV(*prpn) = new;
@@ -140,7 +140,7 @@ rp_insert_prev(run_ptr *prpc, run *data, run_line *line, run_ptr *prpp)
run *prnew = data + new;
if (new == 0)
- return -1;
+ return -1;
RP_TO_PREV(*prpc, data, *prpp);
RP_NEXT(*prpp) = new;
RP_PREV(*prpc) = new;
@@ -169,8 +169,8 @@ int
gdev_run_from_mem(gx_device_run *rdev, gx_device_memory *mdev)
{
int runs_per_line =
- (bitmap_raster(mdev->width * mdev->color_info.depth) -
- sizeof(run_line)) / sizeof(run);
+ (bitmap_raster(mdev->width * mdev->color_info.depth) -
+ sizeof(run_line)) / sizeof(run);
/*
* We use the scan lines of the memory device for storing runs. We need
* ceil(width / MAX_RUN_LENGTH) runs to represent a line where all
@@ -182,13 +182,13 @@ gdev_run_from_mem(gx_device_run *rdev, gx_device_memory *mdev)
rdev->md = *mdev;
if (runs_per_line > MAX_RUNS)
- runs_per_line = MAX_RUNS;
+ runs_per_line = MAX_RUNS;
if (runs_per_line < min_runs)
- return 0; /* just use the memory device as-is */
+ return 0; /* just use the memory device as-is */
for (i = 0; i < mdev->height; ++i) {
- run_line *line = RDEV_LINE(rdev, i);
+ run_line *line = RDEV_LINE(rdev, i);
- line->zero = white;
+ line->zero = white;
}
rdev->runs_per_line = runs_per_line;
rdev->umin = 0;
@@ -230,21 +230,21 @@ run_expand(gx_device_run *rdev, int y)
gx_color_index value[MAX_RUNS];
if (line->zero != gx_no_color_index) {
- rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
- 0, y, rdev->md.width, 1, line->zero);
- return 0;
+ rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
+ 0, y, rdev->md.width, 1, line->zero);
+ return 0;
}
/* Copy the runs into local storage to avoid stepping on our own toes. */
for (n = 0, RP_TO_START(rp, data); !RP_AT_END(rp);
- ++n, RP_TO_NEXT(rp, data, rp)
- ) {
- length[n] = RP_LENGTH(rp);
- value[n] = RP_VALUE(rp);
+ ++n, RP_TO_NEXT(rp, data, rp)
+ ) {
+ length[n] = RP_LENGTH(rp);
+ value[n] = RP_VALUE(rp);
}
for (x = 0, n = 0; x < rdev->md.width; x += w, ++n) {
- w = length[n];
- rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
- x, y, w, 1, value[n]);
+ w = length[n];
+ rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
+ x, y, w, 1, value[n]);
}
return 0;
}
@@ -261,97 +261,97 @@ run_standardize(gx_device_run *rdev, int y, int h)
fit_fill_h(&rdev->md, y, h);
ye = y + h;
if (y < rdev->smin) {
- if (ye > rdev->smax1)
- run_standardize(rdev, rdev->smax1, ye - rdev->smax1);
- if (ye < rdev->smin)
- ye = rdev->smin;
- rdev->smin = y;
+ if (ye > rdev->smax1)
+ run_standardize(rdev, rdev->smax1, ye - rdev->smax1);
+ if (ye < rdev->smin)
+ ye = rdev->smin;
+ rdev->smin = y;
} else if (ye > rdev->smax1) {
- if (y > rdev->smax1)
- y = rdev->smax1;
- rdev->smax1 = ye;
+ if (y > rdev->smax1)
+ y = rdev->smax1;
+ rdev->smax1 = ye;
} else
- return 0;
+ return 0;
for (iy = y; iy < ye; ++iy)
- run_expand(rdev, iy);
+ run_expand(rdev, iy);
return 0;
}
/* Trampoline rendering procedures */
static int
run_copy_mono(gx_device * dev, const byte * data, int dx, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, y, h);
return rdev->save_procs.copy_mono((gx_device *)&rdev->md,
- data, dx, raster, id,
- x, y, w, h, zero, one);
+ data, dx, raster, id,
+ x, y, w, h, zero, one);
}
static int
run_copy_color(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, y, h);
return rdev->save_procs.copy_color((gx_device *)&rdev->md,
- data, data_x, raster, id,
- x, y, w, h);
+ data, data_x, raster, id,
+ x, y, w, h);
}
static int
run_copy_alpha(gx_device * dev, const byte * data, int data_x, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, y, h);
return rdev->save_procs.copy_alpha((gx_device *)&rdev->md,
- data, data_x, raster, id,
- x, y, w, h, color, depth);
+ data, data_x, raster, id,
+ x, y, w, h, color, depth);
}
static int
run_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, y, h);
return rdev->save_procs.strip_tile_rectangle((gx_device *)&rdev->md,
- tiles, x, y, w, h,
- color0, color1, px, py);
+ tiles, x, y, w, h,
+ color0, color1, px, py);
}
static int
run_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
- uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int w, int h, int px, int py,
- gs_logical_operation_t lop)
+ uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int w, int h, int px, int py,
+ gs_logical_operation_t lop)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, y, h);
return rdev->save_procs.strip_copy_rop((gx_device *)&rdev->md,
- sdata, sourcex, sraster,
- id, scolors, textures, tcolors,
- x, y, w, h, px, py, lop);
+ sdata, sourcex, sraster,
+ id, scolors, textures, tcolors,
+ x, y, w, h, px, py, lop);
}
static int
run_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect **unread)
+ gs_get_bits_params_t * params, gs_int_rect **unread)
{
gx_device_run *const rdev = (gx_device_run *)dev;
run_standardize(rdev, prect->p.y, prect->q.y - prect->p.y);
return rdev->save_procs.get_bits_rectangle((gx_device *)&rdev->md,
- prect, params, unread);
+ prect, params, unread);
}
/* Finish initializing a line. This is a separate procedure only */
@@ -373,10 +373,10 @@ run_line_initialize(gx_device_run *rdev, int y)
data[1].next = 2;
rcur = data + index;
for (; left > 0; index++, rcur++, left -= MAX_RUN_LENGTH) {
- rcur->length = min(left, MAX_RUN_LENGTH);
- rcur->value = 0;
- rcur->prev = index - 1;
- rcur->next = index + 1;
+ rcur->length = min(left, MAX_RUN_LENGTH);
+ rcur->value = 0;
+ rcur->prev = index - 1;
+ rcur->next = index + 1;
}
rcur->next = 0;
data[0].prev = index - 1;
@@ -385,13 +385,13 @@ run_line_initialize(gx_device_run *rdev, int y)
line->rpcur.index = 2;
line->free = index;
for (; index < rdev->runs_per_line; ++index)
- data[index].next = index + 1;
+ data[index].next = index + 1;
data[index - 1].next = 0;
if (y >= rdev->umin && y < rdev->umax1) {
- if (y > (rdev->umin + rdev->umax1) >> 1)
- rdev->umax1 = y;
- else
- rdev->umin = y + 1;
+ if (y > (rdev->umin + rdev->umax1) >> 1)
+ rdev->umax1 = y;
+ else
+ rdev->umin = y + 1;
}
}
@@ -415,11 +415,11 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
/* Find the run that contains xo. */
if (xo < xc) {
- while (xo < xc)
- RP_TO_PREV(rpc, data, rpc), xc -= RP_LENGTH(rpc);
+ while (xo < xc)
+ RP_TO_PREV(rpc, data, rpc), xc -= RP_LENGTH(rpc);
} else {
- while (xo >= xc + RP_LENGTH(rpc))
- xc += RP_LENGTH(rpc), RP_TO_NEXT(rpc, data, rpc);
+ while (xo >= xc + RP_LENGTH(rpc))
+ xc += RP_LENGTH(rpc), RP_TO_NEXT(rpc, data, rpc);
}
/*
@@ -429,16 +429,16 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
*/
for (; !RP_AT_END(rpc) && RP_VALUE(rpc) == new;
- RP_TO_NEXT(rpc, data, rpc)
- )
- if ((xo = xc += RP_LENGTH(rpc)) >= xe)
- return 0;
+ RP_TO_NEXT(rpc, data, rpc)
+ )
+ if ((xo = xc += RP_LENGTH(rpc)) >= xe)
+ return 0;
x0 = xc, rp0 = rpc;
/* Find the run that contains xe-1. */
while (xe > xc + RP_LENGTH(rpc))
- xc += RP_LENGTH(rpc), RP_TO_NEXT(rpc, data, rpc);
+ xc += RP_LENGTH(rpc), RP_TO_NEXT(rpc, data, rpc);
/*
* Skip runs below xe that already contain the new value.
@@ -447,7 +447,7 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
*/
while (RP_TO_PREV(rpc, data, rpc), RP_VALUE(rpc) == new)
- xe = xc -= RP_LENGTH(rpc);
+ xe = xc -= RP_LENGTH(rpc);
RP_TO_NEXT(rpc, data, rpc);
/*
@@ -462,49 +462,49 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
/* Split off any unaffected prefix of the run at rp0. */
if (x0 < xo) {
- uint diff = xo - x0;
- run_value v0 = RP_VALUE(rp0);
- run_ptr rpp;
-
- RP_TO_PREV(rp0, data, rpp);
- if (RP_VALUE(rpp) == v0 && RP_LENGTH(rpp) + diff <= MAX_RUN_LENGTH)
- RP_LENGTH(rpp) += diff;
- else {
- code = rp_insert_prev(&rp0, data, line, &rpp);
- if (code < 0)
- return code;
- RP_LENGTH(rpp) = diff;
- RP_VALUE(rpp) = v0;
- }
- RP_LENGTH(rp0) -= diff;
+ uint diff = xo - x0;
+ run_value v0 = RP_VALUE(rp0);
+ run_ptr rpp;
+
+ RP_TO_PREV(rp0, data, rpp);
+ if (RP_VALUE(rpp) == v0 && RP_LENGTH(rpp) + diff <= MAX_RUN_LENGTH)
+ RP_LENGTH(rpp) += diff;
+ else {
+ code = rp_insert_prev(&rp0, data, line, &rpp);
+ if (code < 0)
+ return code;
+ RP_LENGTH(rpp) = diff;
+ RP_VALUE(rpp) = v0;
+ }
+ RP_LENGTH(rp0) -= diff;
}
/* Split off any unaffected suffix of the run at rpc. */
x1 = xc + RP_LENGTH(rpc);
if (x1 > xe) {
- uint diff = x1 - xe;
- run_value vc = RP_VALUE(rpc);
- run_ptr rpn;
-
- RP_TO_NEXT(rpc, data, rpn);
- if (RP_VALUE(rpn) == vc && RP_LENGTH(rpn) + diff <= MAX_RUN_LENGTH)
- RP_LENGTH(rpn) += diff;
- else {
- code = rp_insert_next(&rpc, data, line, &rpn);
- if (code < 0)
- return code;
- RP_LENGTH(rpn) = diff;
- RP_VALUE(rpn) = vc;
- }
- RP_LENGTH(rpc) -= diff;
+ uint diff = x1 - xe;
+ run_value vc = RP_VALUE(rpc);
+ run_ptr rpn;
+
+ RP_TO_NEXT(rpc, data, rpn);
+ if (RP_VALUE(rpn) == vc && RP_LENGTH(rpn) + diff <= MAX_RUN_LENGTH)
+ RP_LENGTH(rpn) += diff;
+ else {
+ code = rp_insert_next(&rpc, data, line, &rpn);
+ if (code < 0)
+ return code;
+ RP_LENGTH(rpn) = diff;
+ RP_VALUE(rpn) = vc;
+ }
+ RP_LENGTH(rpc) -= diff;
}
/* Delete all runs from rp0 through rpc. */
RP_TO_PREV(rp0, data, rp0);
while (RP_NEXT(rp0) != RP_NEXT(rpc))
- rp_delete_next(&rp0, data, line);
+ rp_delete_next(&rp0, data, line);
/*
* Finally, insert new runs with the new value.
@@ -515,44 +515,44 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
*/
{
- uint left = xe - xo;
-
- if (xo == x0 && RP_VALUE(rp0) == new &&
- RP_LENGTH(rp0) + left <= MAX_RUN_LENGTH
- )
- RP_LENGTH(rp0) += left;
- else {
- /*
- * If we need more than one run, we divide up the length to
- * create more runs with length less than MAX_RUN_LENGTH in
- * order to improve the chances of a later merge. However,
- * we still guarantee that we won't create more runs than
- * the minimum number required to represent the length.
- */
- run_length len;
-
- if (left <= MAX_RUN_LENGTH)
- len = left;
- else {
- /*len = ceil(left / ceil(left / MAX_RUN_LENGTH))*/
- int pieces = left + (MAX_RUN_LENGTH - 1) / MAX_RUN_LENGTH;
-
- len = (left + pieces - 1) / pieces;
- }
- do {
- run_ptr rpn;
-
- /*
- * The allocation in rp_insert_next can't fail, because
- * we just deleted at least as many runs as we're going
- * to insert.
- */
- rp_insert_next(&rp0, data, line, &rpn);
- RP_LENGTH(rpn) = min(left, len);
- RP_VALUE(rpn) = new;
- }
- while ((left -= len) > 0);
- }
+ uint left = xe - xo;
+
+ if (xo == x0 && RP_VALUE(rp0) == new &&
+ RP_LENGTH(rp0) + left <= MAX_RUN_LENGTH
+ )
+ RP_LENGTH(rp0) += left;
+ else {
+ /*
+ * If we need more than one run, we divide up the length to
+ * create more runs with length less than MAX_RUN_LENGTH in
+ * order to improve the chances of a later merge. However,
+ * we still guarantee that we won't create more runs than
+ * the minimum number required to represent the length.
+ */
+ run_length len;
+
+ if (left <= MAX_RUN_LENGTH)
+ len = left;
+ else {
+ /*len = ceil(left / ceil(left / MAX_RUN_LENGTH))*/
+ int pieces = left + (MAX_RUN_LENGTH - 1) / MAX_RUN_LENGTH;
+
+ len = (left + pieces - 1) / pieces;
+ }
+ do {
+ run_ptr rpn;
+
+ /*
+ * The allocation in rp_insert_next can't fail, because
+ * we just deleted at least as many runs as we're going
+ * to insert.
+ */
+ rp_insert_next(&rp0, data, line, &rpn);
+ RP_LENGTH(rpn) = min(left, len);
+ RP_VALUE(rpn) = new;
+ }
+ while ((left -= len) > 0);
+ }
}
return 0;
@@ -561,7 +561,7 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
/* Replace a rectangle with a new value. */
static int
run_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_run *const rdev = (gx_device_run *)dev;
int xe, ye;
@@ -575,43 +575,42 @@ run_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
* we can skip the entire operation.
*/
if (y >= rdev->umin && ye <= rdev->umax1 &&
- color == RDEV_LINE(rdev, y)->zero
- )
- return 0;
+ color == RDEV_LINE(rdev, y)->zero
+ )
+ return 0;
/*
* Hand off any parts of the operation that fall within the area
* already in standard form.
*/
if (y < rdev->smax1 && ye > rdev->smin) {
- /* Some part of the operation must be handed off. */
- if (y < rdev->smin) {
- run_fill_rectangle(dev, x, y, w, rdev->smin - y, color);
- y = rdev->smin;
- }
- /* Now rdev->smin <= y < ye. */
- rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
- x, y, w, min(ye, rdev->smax1) - y,
- color);
- if (ye <= rdev->smax1)
- return 0;
- y = rdev->smax1;
+ /* Some part of the operation must be handed off. */
+ if (y < rdev->smin) {
+ run_fill_rectangle(dev, x, y, w, rdev->smin - y, color);
+ y = rdev->smin;
+ }
+ /* Now rdev->smin <= y < ye. */
+ rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
+ x, y, w, min(ye, rdev->smax1) - y,
+ color);
+ if (ye <= rdev->smax1)
+ return 0;
+ y = rdev->smax1;
}
xe = x + w;
for (iy = y; iy < ye; ++iy) {
- run_line *line = RDEV_LINE(rdev, iy);
-
- if (color != line->zero) {
- if (line->zero != gx_no_color_index)
- run_line_initialize(rdev, iy);
- if (run_fill_interval(line, x, xe, color) < 0) {
- /* We ran out of runs. Convert to expanded form. */
- run_standardize(rdev, iy, 1);
- rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
- x, iy, w, 1, color);
- }
- }
+ run_line *line = RDEV_LINE(rdev, iy);
+
+ if (color != line->zero) {
+ if (line->zero != gx_no_color_index)
+ run_line_initialize(rdev, iy);
+ if (run_fill_interval(line, x, xe, color) < 0) {
+ /* We ran out of runs. Convert to expanded form. */
+ run_standardize(rdev, iy, 1);
+ rdev->save_procs.fill_rectangle((gx_device *)&rdev->md,
+ x, iy, w, 1, color);
+ }
+ }
}
return 0;
}
-
diff --git a/gs/base/gdevmrun.h b/gs/base/gdevmrun.h
index 0bd73a492..ce70fe2ae 100644
--- a/gs/base/gdevmrun.h
+++ b/gs/base/gdevmrun.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,13 +37,13 @@ typedef struct gx_device_run_s {
* ones, for use with the uncompressed representation.
*/
struct sp_ {
- dev_proc_copy_mono((*copy_mono));
- dev_proc_copy_color((*copy_color));
- dev_proc_fill_rectangle((*fill_rectangle));
- dev_proc_copy_alpha((*copy_alpha));
- dev_proc_strip_tile_rectangle((*strip_tile_rectangle));
- dev_proc_strip_copy_rop((*strip_copy_rop));
- dev_proc_get_bits_rectangle((*get_bits_rectangle));
+ dev_proc_copy_mono((*copy_mono));
+ dev_proc_copy_color((*copy_color));
+ dev_proc_fill_rectangle((*fill_rectangle));
+ dev_proc_copy_alpha((*copy_alpha));
+ dev_proc_strip_tile_rectangle((*strip_tile_rectangle));
+ dev_proc_strip_copy_rop((*strip_copy_rop));
+ dev_proc_get_bits_rectangle((*get_bits_rectangle));
} save_procs;
} gx_device_run;
diff --git a/gs/base/gdevmswn.c b/gs/base/gdevmswn.c
index 1a40d4547..40a342304 100644
--- a/gs/base/gdevmswn.c
+++ b/gs/base/gdevmswn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,41 +39,41 @@ win_open(gx_device * dev)
int code;
if (dev->width == INITIAL_WIDTH)
- dev->width = (int)(8.5 * dev->x_pixels_per_inch);
+ dev->width = (int)(8.5 * dev->x_pixels_per_inch);
if (dev->height == INITIAL_HEIGHT)
- dev->height = (int)(11.0 * dev->y_pixels_per_inch);
+ dev->height = (int)(11.0 * dev->y_pixels_per_inch);
if (wdev->BitsPerPixel == 0) {
- int depth;
-
- /* Set parameters that were unknown before opening device */
- /* Find out if the device supports color */
- /* We recognize 1, 4, 8, 16, 24 bit/pixel devices */
- hdc = GetDC(NULL); /* get hdc for desktop */
- depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
- if (depth > 16) {
- wdev->BitsPerPixel = 24;
- } else if (depth > 8) {
- wdev->BitsPerPixel = 16;
- } else if (depth >= 8) {
- wdev->BitsPerPixel = 8;
- } else if (depth >= 4) {
- wdev->BitsPerPixel = 4;
- } else {
- wdev->BitsPerPixel = 1;
- }
- ReleaseDC(NULL, hdc);
- wdev->mapped_color_flags = 0;
+ int depth;
+
+ /* Set parameters that were unknown before opening device */
+ /* Find out if the device supports color */
+ /* We recognize 1, 4, 8, 16, 24 bit/pixel devices */
+ hdc = GetDC(NULL); /* get hdc for desktop */
+ depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
+ if (depth > 16) {
+ wdev->BitsPerPixel = 24;
+ } else if (depth > 8) {
+ wdev->BitsPerPixel = 16;
+ } else if (depth >= 8) {
+ wdev->BitsPerPixel = 8;
+ } else if (depth >= 4) {
+ wdev->BitsPerPixel = 4;
+ } else {
+ wdev->BitsPerPixel = 1;
+ }
+ ReleaseDC(NULL, hdc);
+ wdev->mapped_color_flags = 0;
}
if ((code = win_set_bits_per_pixel(wdev, wdev->BitsPerPixel)) < 0)
- return code;
+ return code;
if (wdev->nColors > 0) {
- /* create palette for display */
- if ((wdev->limgpalette = win_makepalette(wdev))
- == (LPLOGPALETTE) NULL)
- return win_nomemory();
- wdev->himgpalette = CreatePalette(wdev->limgpalette);
+ /* create palette for display */
+ if ((wdev->limgpalette = win_makepalette(wdev))
+ == (LPLOGPALETTE) NULL)
+ return win_nomemory();
+ wdev->himgpalette = CreatePalette(wdev->limgpalette);
}
return 0;
}
@@ -83,7 +83,7 @@ int
win_sync_output(gx_device * dev)
{
if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_SYNC, (unsigned char *)wdev, 0);
+ (*pgsdll_callback) (GSDLL_SYNC, (unsigned char *)wdev, 0);
return (0);
}
@@ -92,7 +92,7 @@ int
win_output_page(gx_device * dev, int copies, int flush)
{
if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_PAGE, (unsigned char *)wdev, 0);
+ (*pgsdll_callback) (GSDLL_PAGE, (unsigned char *)wdev, 0);
return gx_finish_output_page(dev, copies, flush);;
}
@@ -102,13 +102,13 @@ win_close(gx_device * dev)
{
/* Free resources */
if (wdev->nColors > 0) {
- gs_free(dev->memory,
- wdev->mapped_color_flags, 4096, 1, "win_set_bits_per_pixel");
- DeleteObject(wdev->himgpalette);
- gs_free(dev->memory,
- (char *)(wdev->limgpalette), 1, sizeof(LOGPALETTE) +
- (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
- "win_close");
+ gs_free(dev->memory,
+ wdev->mapped_color_flags, 4096, 1, "win_set_bits_per_pixel");
+ DeleteObject(wdev->himgpalette);
+ gs_free(dev->memory,
+ (char *)(wdev->limgpalette), 1, sizeof(LOGPALETTE) +
+ (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
+ "win_close");
}
return (0);
}
@@ -121,101 +121,101 @@ win_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value g = cv[1];
gx_color_value b = cv[2];
switch (wdev->BitsPerPixel) {
- case 24:
- return (((unsigned long)b >> (gx_color_value_bits - 8)) << 16) +
- (((unsigned long)g >> (gx_color_value_bits - 8)) << 8) +
- (((unsigned long)r >> (gx_color_value_bits - 8)));
- case 16:{
- gx_color_index color = ((r >> (gx_color_value_bits - 5)) << 11) +
- ((g >> (gx_color_value_bits - 6)) << 5) +
- (b >> (gx_color_value_bits - 5));
+ case 24:
+ return (((unsigned long)b >> (gx_color_value_bits - 8)) << 16) +
+ (((unsigned long)g >> (gx_color_value_bits - 8)) << 8) +
+ (((unsigned long)r >> (gx_color_value_bits - 8)));
+ case 16:{
+ gx_color_index color = ((r >> (gx_color_value_bits - 5)) << 11) +
+ ((g >> (gx_color_value_bits - 6)) << 5) +
+ (b >> (gx_color_value_bits - 5));
#if arch_is_big_endian
- ushort color16 = (ushort)color;
+ ushort color16 = (ushort)color;
#else
- ushort color16 = (ushort)((color << 8) | (color >> 8));
+ ushort color16 = (ushort)((color << 8) | (color >> 8));
#endif
- return color16;
- }
- case 15:{
- gx_color_index color = ((r >> (gx_color_value_bits - 5)) << 10) +
- ((g >> (gx_color_value_bits - 5)) << 5) +
- (b >> (gx_color_value_bits - 5));
+ return color16;
+ }
+ case 15:{
+ gx_color_index color = ((r >> (gx_color_value_bits - 5)) << 10) +
+ ((g >> (gx_color_value_bits - 5)) << 5) +
+ (b >> (gx_color_value_bits - 5));
#if arch_is_big_endian
- ushort color15 = (ushort)color;
+ ushort color15 = (ushort)color;
#else
- ushort color15 = (ushort)((color << 8) | (color >> 8));
+ ushort color15 = (ushort)((color << 8) | (color >> 8));
#endif
- return color15;
- }
- case 8:{
- int i;
- LPLOGPALETTE lpal = wdev->limgpalette;
- PALETTEENTRY *pep;
- byte cr, cg, cb;
- int mc_index;
- byte mc_mask;
-
- /* Check for a color in the palette of 64. */
- {
- static const byte pal64[32] =
- {
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1
- };
-
- if (pal64[r >> (gx_color_value_bits - 5)] &&
- pal64[g >> (gx_color_value_bits - 5)] &&
- pal64[b >> (gx_color_value_bits - 5)]
- )
- return (gx_color_index) (
- ((r >> (gx_color_value_bits - 2)) << 4) +
- ((g >> (gx_color_value_bits - 2)) << 2) +
- (b >> (gx_color_value_bits - 2))
- );
- }
-
- /* map colors to 0->255 in 32 steps */
- cr = win_color_value(r);
- cg = win_color_value(g);
- cb = win_color_value(b);
-
- /* Search in palette, skipping the first 64. */
- mc_index = ((cr >> 3) << 7) + ((cg >> 3) << 2) + (cb >> 6);
- mc_mask = 0x80 >> ((cb >> 3) & 7);
- if (wdev->mapped_color_flags[mc_index] & mc_mask)
- for (i = wdev->nColors, pep = &lpal->palPalEntry[i];
- --pep, --i >= 64;
- ) {
- if (cr == pep->peRed &&
- cg == pep->peGreen &&
- cb == pep->peBlue
- )
- return ((gx_color_index) i); /* found it */
- }
- /* next try adding it to palette */
- i = wdev->nColors;
- if (i < 220) { /* allow 36 for windows and other apps */
- LPLOGPALETTE lipal = wdev->limgpalette;
-
- wdev->nColors = i + 1;
-
- DeleteObject(wdev->himgpalette);
- lipal->palPalEntry[i].peFlags = 0;
- lipal->palPalEntry[i].peRed = cr;
- lipal->palPalEntry[i].peGreen = cg;
- lipal->palPalEntry[i].peBlue = cb;
- lipal->palNumEntries = wdev->nColors;
- wdev->himgpalette = CreatePalette(lipal);
-
- wdev->mapped_color_flags[mc_index] |= mc_mask;
- return ((gx_color_index) i); /* return new palette index */
- }
- return (gx_no_color_index); /* not found - dither instead */
- }
- case 4:
- return pc_4bit_map_rgb_color(dev, cv);
+ return color15;
+ }
+ case 8:{
+ int i;
+ LPLOGPALETTE lpal = wdev->limgpalette;
+ PALETTEENTRY *pep;
+ byte cr, cg, cb;
+ int mc_index;
+ byte mc_mask;
+
+ /* Check for a color in the palette of 64. */
+ {
+ static const byte pal64[32] =
+ {
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1
+ };
+
+ if (pal64[r >> (gx_color_value_bits - 5)] &&
+ pal64[g >> (gx_color_value_bits - 5)] &&
+ pal64[b >> (gx_color_value_bits - 5)]
+ )
+ return (gx_color_index) (
+ ((r >> (gx_color_value_bits - 2)) << 4) +
+ ((g >> (gx_color_value_bits - 2)) << 2) +
+ (b >> (gx_color_value_bits - 2))
+ );
+ }
+
+ /* map colors to 0->255 in 32 steps */
+ cr = win_color_value(r);
+ cg = win_color_value(g);
+ cb = win_color_value(b);
+
+ /* Search in palette, skipping the first 64. */
+ mc_index = ((cr >> 3) << 7) + ((cg >> 3) << 2) + (cb >> 6);
+ mc_mask = 0x80 >> ((cb >> 3) & 7);
+ if (wdev->mapped_color_flags[mc_index] & mc_mask)
+ for (i = wdev->nColors, pep = &lpal->palPalEntry[i];
+ --pep, --i >= 64;
+ ) {
+ if (cr == pep->peRed &&
+ cg == pep->peGreen &&
+ cb == pep->peBlue
+ )
+ return ((gx_color_index) i); /* found it */
+ }
+ /* next try adding it to palette */
+ i = wdev->nColors;
+ if (i < 220) { /* allow 36 for windows and other apps */
+ LPLOGPALETTE lipal = wdev->limgpalette;
+
+ wdev->nColors = i + 1;
+
+ DeleteObject(wdev->himgpalette);
+ lipal->palPalEntry[i].peFlags = 0;
+ lipal->palPalEntry[i].peRed = cr;
+ lipal->palPalEntry[i].peGreen = cg;
+ lipal->palPalEntry[i].peBlue = cb;
+ lipal->palNumEntries = wdev->nColors;
+ wdev->himgpalette = CreatePalette(lipal);
+
+ wdev->mapped_color_flags[mc_index] |= mc_mask;
+ return ((gx_color_index) i); /* return new palette index */
+ }
+ return (gx_no_color_index); /* not found - dither instead */
+ }
+ case 4:
+ return pc_4bit_map_rgb_color(dev, cv);
}
return (gx_default_map_rgb_color(dev, cv));
}
@@ -223,48 +223,48 @@ win_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Map a color code to r-g-b. */
int
win_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_color_value one;
ushort value;
switch (wdev->BitsPerPixel) {
- case 24:
- one = (gx_color_value) (gx_max_color_value / 255);
- prgb[0] = ((color) & 255) * one;
- prgb[1] = ((color >> 8) & 255) * one;
- prgb[2] = ((color >> 16) & 255) * one;
- break;
- case 16:
- value = (color >> 11) & 0x1f;
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
- value = (color >> 5) & 0x3f;
- prgb[1] = ((value << 10) + (value << 4) + (value >> 2)) >> (16 - gx_color_value_bits);
- value = (color) & 0x1f;
- prgb[2] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
- break;
- case 15:
- value = (color >> 10) & 0x1f;
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
- value = (color >> 5) & 0x1f;
- prgb[1] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
- value = (color) & 0x1f;
- prgb[2] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
- break;
- case 8:
- if (!dev->is_open)
- return -1;
- one = (gx_color_value) (gx_max_color_value / 255);
- prgb[0] = wdev->limgpalette->palPalEntry[(int)color].peRed * one;
- prgb[1] = wdev->limgpalette->palPalEntry[(int)color].peGreen * one;
- prgb[2] = wdev->limgpalette->palPalEntry[(int)color].peBlue * one;
- break;
- case 4:
- pc_4bit_map_color_rgb(dev, color, prgb);
- break;
- default:
- prgb[0] = prgb[1] = prgb[2] =
- (int)color ? gx_max_color_value : 0;
+ case 24:
+ one = (gx_color_value) (gx_max_color_value / 255);
+ prgb[0] = ((color) & 255) * one;
+ prgb[1] = ((color >> 8) & 255) * one;
+ prgb[2] = ((color >> 16) & 255) * one;
+ break;
+ case 16:
+ value = (color >> 11) & 0x1f;
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (color >> 5) & 0x3f;
+ prgb[1] = ((value << 10) + (value << 4) + (value >> 2)) >> (16 - gx_color_value_bits);
+ value = (color) & 0x1f;
+ prgb[2] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
+ break;
+ case 15:
+ value = (color >> 10) & 0x1f;
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (color >> 5) & 0x1f;
+ prgb[1] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (color) & 0x1f;
+ prgb[2] = ((value << 11) + (value << 6) + (value << 1) + (value >> 4)) >> (16 - gx_color_value_bits);
+ break;
+ case 8:
+ if (!dev->is_open)
+ return -1;
+ one = (gx_color_value) (gx_max_color_value / 255);
+ prgb[0] = wdev->limgpalette->palPalEntry[(int)color].peRed * one;
+ prgb[1] = wdev->limgpalette->palPalEntry[(int)color].peGreen * one;
+ prgb[2] = wdev->limgpalette->palPalEntry[(int)color].peBlue * one;
+ break;
+ case 4:
+ pc_4bit_map_color_rgb(dev, color, prgb);
+ break;
+ default:
+ prgb[0] = prgb[1] = prgb[2] =
+ (int)color ? gx_max_color_value : 0;
}
return 0;
}
@@ -296,62 +296,62 @@ win_put_params(gx_device * dev, gs_param_list * plist)
/* Handle extra parameters */
switch (code = param_read_int(plist, "BitsPerPixel", &bpp)) {
- case 0:
- if (dev->is_open && bpp != old_bpp)
- ecode = gs_error_rangecheck;
- else { /* Don't release existing mapped_color_flags. */
- if (bpp != 8)
- wdev->mapped_color_flags = 0;
- code = win_set_bits_per_pixel(wdev, bpp);
- if (code < 0)
- ecode = code;
- else
- break;
- }
- goto bppe;
- default:
- ecode = code;
- bppe:param_signal_error(plist, "BitsPerPixel", ecode);
- case 1:
- break;
+ case 0:
+ if (dev->is_open && bpp != old_bpp)
+ ecode = gs_error_rangecheck;
+ else { /* Don't release existing mapped_color_flags. */
+ if (bpp != 8)
+ wdev->mapped_color_flags = 0;
+ code = win_set_bits_per_pixel(wdev, bpp);
+ if (code < 0)
+ ecode = code;
+ else
+ break;
+ }
+ goto bppe;
+ default:
+ ecode = code;
+ bppe:param_signal_error(plist, "BitsPerPixel", ecode);
+ case 1:
+ break;
}
if (ecode >= 0) { /* Prevent gx_default_put_params from closing the device. */
- dev->is_open = false;
- ecode = gx_default_put_params(dev, plist);
- dev->is_open = is_open;
+ dev->is_open = false;
+ ecode = gx_default_put_params(dev, plist);
+ dev->is_open = is_open;
}
if (ecode < 0) { /* If we allocated mapped_color_flags, release it. */
- if (wdev->mapped_color_flags != 0 && old_flags == 0)
- gs_free(wdev->memory,
- wdev->mapped_color_flags, 4096, 1,
- "win_put_params");
- wdev->mapped_color_flags = old_flags;
- if (bpp != old_bpp)
- win_set_bits_per_pixel(wdev, old_bpp);
- return ecode;
+ if (wdev->mapped_color_flags != 0 && old_flags == 0)
+ gs_free(wdev->memory,
+ wdev->mapped_color_flags, 4096, 1,
+ "win_put_params");
+ wdev->mapped_color_flags = old_flags;
+ if (bpp != old_bpp)
+ win_set_bits_per_pixel(wdev, old_bpp);
+ return ecode;
}
if (wdev->mapped_color_flags == 0 && old_flags != 0) { /* Release old mapped_color_flags. */
- gs_free(dev->memory,
- old_flags, 4096, 1, "win_put_params");
+ gs_free(dev->memory,
+ old_flags, 4096, 1, "win_put_params");
}
/* Hand off the change to the implementation. */
if (is_open && (bpp != old_bpp ||
- dev->width != width || dev->height != height)
- ) {
- int ccode;
-
- (*wdev->free_bitmap) (wdev);
- ccode = (*wdev->alloc_bitmap) (wdev, (gx_device *) wdev);
- if (ccode < 0) { /* Bad news! Some of the other device parameters */
- /* may have changed. We don't handle this. */
- /* This is ****** WRONG ******. */
- dev->width = width;
- dev->height = height;
- win_set_bits_per_pixel(wdev, old_bpp);
- (*wdev->alloc_bitmap) (wdev, dev);
- return ccode;
- }
+ dev->width != width || dev->height != height)
+ ) {
+ int ccode;
+
+ (*wdev->free_bitmap) (wdev);
+ ccode = (*wdev->alloc_bitmap) (wdev, (gx_device *) wdev);
+ if (ccode < 0) { /* Bad news! Some of the other device parameters */
+ /* may have changed. We don't handle this. */
+ /* This is ****** WRONG ******. */
+ dev->width = width;
+ dev->height = height;
+ win_set_bits_per_pixel(wdev, old_bpp);
+ (*wdev->alloc_bitmap) (wdev, dev);
+ return ccode;
+ }
}
return 0;
}
@@ -360,8 +360,6 @@ win_put_params(gx_device * dev, gs_param_list * plist)
#undef wdev
-
-
/* out of memory error message box */
int
win_nomemory(void)
@@ -370,7 +368,6 @@ win_nomemory(void)
return gs_error_limitcheck;
}
-
LPLOGPALETTE
win_makepalette(gx_device_win * wdev)
{
@@ -378,44 +375,43 @@ win_makepalette(gx_device_win * wdev)
LPLOGPALETTE logpalette;
logpalette = (LPLOGPALETTE) gs_malloc(wdev->memory, 1, sizeof(LOGPALETTE) +
- (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
- "win_makepalette");
+ (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
+ "win_makepalette");
if (logpalette == (LPLOGPALETTE) NULL)
- return (0);
+ return (0);
logpalette->palVersion = 0x300;
logpalette->palNumEntries = wdev->nColors;
for (i = 0; i < wdev->nColors; i++) {
- logpalette->palPalEntry[i].peFlags = 0;
- switch (wdev->nColors) {
- case 64:
- /* colors are rrggbb */
- logpalette->palPalEntry[i].peRed = ((i & 0x30) >> 4) * 85;
- logpalette->palPalEntry[i].peGreen = ((i & 0xC) >> 2) * 85;
- logpalette->palPalEntry[i].peBlue = (i & 3) * 85;
- break;
- case 16:
- /* colors are irgb */
- val = (i & 8 ? 255 : 128);
- logpalette->palPalEntry[i].peRed = i & 4 ? val : 0;
- logpalette->palPalEntry[i].peGreen = i & 2 ? val : 0;
- logpalette->palPalEntry[i].peBlue = i & 1 ? val : 0;
- if (i == 8) { /* light gray */
- logpalette->palPalEntry[i].peRed =
- logpalette->palPalEntry[i].peGreen =
- logpalette->palPalEntry[i].peBlue = 192;
- }
- break;
- case 2:
- logpalette->palPalEntry[i].peRed =
- logpalette->palPalEntry[i].peGreen =
- logpalette->palPalEntry[i].peBlue = (i ? 255 : 0);
- break;
- }
+ logpalette->palPalEntry[i].peFlags = 0;
+ switch (wdev->nColors) {
+ case 64:
+ /* colors are rrggbb */
+ logpalette->palPalEntry[i].peRed = ((i & 0x30) >> 4) * 85;
+ logpalette->palPalEntry[i].peGreen = ((i & 0xC) >> 2) * 85;
+ logpalette->palPalEntry[i].peBlue = (i & 3) * 85;
+ break;
+ case 16:
+ /* colors are irgb */
+ val = (i & 8 ? 255 : 128);
+ logpalette->palPalEntry[i].peRed = i & 4 ? val : 0;
+ logpalette->palPalEntry[i].peGreen = i & 2 ? val : 0;
+ logpalette->palPalEntry[i].peBlue = i & 1 ? val : 0;
+ if (i == 8) { /* light gray */
+ logpalette->palPalEntry[i].peRed =
+ logpalette->palPalEntry[i].peGreen =
+ logpalette->palPalEntry[i].peBlue = 192;
+ }
+ break;
+ case 2:
+ logpalette->palPalEntry[i].peRed =
+ logpalette->palPalEntry[i].peGreen =
+ logpalette->palPalEntry[i].peBlue = (i ? 255 : 0);
+ break;
+ }
}
return (logpalette);
}
-
static int
win_set_bits_per_pixel(gx_device_win * wdev, int bpp)
{
@@ -430,67 +426,67 @@ win_set_bits_per_pixel(gx_device_win * wdev, int bpp)
HDC hdc;
switch (bpp) {
- case 24:
- wdev->color_info = win_24bit_color;
- wdev->nColors = -1;
- break;
- case 16:
- case 15:
- wdev->color_info = win_16bit_color;
- wdev->nColors = -1;
- break;
- case 8:
- /* use 64 static colors and 166 dynamic colors from 8 planes */
- wdev->color_info = win_8bit_color;
- wdev->nColors = 64;
- break;
- case 4:
- hdc = GetDC(NULL);
- if (GetDeviceCaps(hdc, VERTRES) <= 350)
- wdev->color_info = win_ega_color;
- else
- wdev->color_info = win_vga_color;
- ReleaseDC(NULL, hdc);
- wdev->nColors = 16;
- break;
- case 1:
- wdev->color_info = win_mono_color;
- wdev->nColors = 2;
- break;
- default:
- return (gs_error_rangecheck);
+ case 24:
+ wdev->color_info = win_24bit_color;
+ wdev->nColors = -1;
+ break;
+ case 16:
+ case 15:
+ wdev->color_info = win_16bit_color;
+ wdev->nColors = -1;
+ break;
+ case 8:
+ /* use 64 static colors and 166 dynamic colors from 8 planes */
+ wdev->color_info = win_8bit_color;
+ wdev->nColors = 64;
+ break;
+ case 4:
+ hdc = GetDC(NULL);
+ if (GetDeviceCaps(hdc, VERTRES) <= 350)
+ wdev->color_info = win_ega_color;
+ else
+ wdev->color_info = win_vga_color;
+ ReleaseDC(NULL, hdc);
+ wdev->nColors = 16;
+ break;
+ case 1:
+ wdev->color_info = win_mono_color;
+ wdev->nColors = 2;
+ break;
+ default:
+ return (gs_error_rangecheck);
}
wdev->BitsPerPixel = bpp;
/* If necessary, allocate and clear the mapped color flags. */
if (bpp == 8) {
- if (wdev->mapped_color_flags == 0) {
- wdev->mapped_color_flags = gs_malloc(wdev->memory,
- 4096, 1, "win_set_bits_per_pixel");
- if (wdev->mapped_color_flags == 0)
- return_error(gs_error_VMerror);
- }
- memset(wdev->mapped_color_flags, 0, 4096);
+ if (wdev->mapped_color_flags == 0) {
+ wdev->mapped_color_flags = gs_malloc(wdev->memory,
+ 4096, 1, "win_set_bits_per_pixel");
+ if (wdev->mapped_color_flags == 0)
+ return_error(gs_error_VMerror);
+ }
+ memset(wdev->mapped_color_flags, 0, 4096);
} else {
- gs_free(wdev->memory,
- wdev->mapped_color_flags, 4096, 1, "win_set_bits_per_pixel");
- wdev->mapped_color_flags = 0;
+ gs_free(wdev->memory,
+ wdev->mapped_color_flags, 4096, 1, "win_set_bits_per_pixel");
+ wdev->mapped_color_flags = 0;
}
/* copy encode/decode procedures */
wdev->procs.encode_color = wdev->procs.map_rgb_color;
wdev->procs.decode_color = wdev->procs.map_color_rgb;
if (bpp == 1) {
- wdev->procs.get_color_mapping_procs =
- gx_default_DevGray_get_color_mapping_procs;
- wdev->procs.get_color_comp_index =
- gx_default_DevGray_get_color_comp_index;
+ wdev->procs.get_color_mapping_procs =
+ gx_default_DevGray_get_color_mapping_procs;
+ wdev->procs.get_color_comp_index =
+ gx_default_DevGray_get_color_comp_index;
}
else {
- wdev->procs.get_color_mapping_procs =
- gx_default_DevRGB_get_color_mapping_procs;
- wdev->procs.get_color_comp_index =
- gx_default_DevRGB_get_color_comp_index;
+ wdev->procs.get_color_mapping_procs =
+ gx_default_DevRGB_get_color_mapping_procs;
+ wdev->procs.get_color_comp_index =
+ gx_default_DevRGB_get_color_comp_index;
}
/* restore old anti_alias info */
diff --git a/gs/base/gdevmswn.h b/gs/base/gdevmswn.h
index e2418d3ea..87b359a27 100644
--- a/gs/base/gdevmswn.h
+++ b/gs/base/gdevmswn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,15 +64,15 @@ dev_proc_get_alpha_bits(win_get_alpha_bits);
#define win_gsview_sizeof 80
#define gx_device_win_common\
- int BitsPerPixel;\
- int nColors;\
- byte *mapped_color_flags;\
- /* Implementation-specific procedures */\
- win_proc_alloc_bitmap((*alloc_bitmap));\
- win_proc_free_bitmap((*free_bitmap));\
- /* Handles */\
- HPALETTE himgpalette;\
- LPLOGPALETTE limgpalette
+ int BitsPerPixel;\
+ int nColors;\
+ byte *mapped_color_flags;\
+ /* Implementation-specific procedures */\
+ win_proc_alloc_bitmap((*alloc_bitmap));\
+ win_proc_free_bitmap((*free_bitmap));\
+ /* Handles */\
+ HPALETTE himgpalette;\
+ LPLOGPALETTE limgpalette
/* The basic window device */
struct gx_device_win_s {
diff --git a/gs/base/gdevmsxf.c b/gs/base/gdevmsxf.c
index d280f4c12..895704f46 100644
--- a/gs/base/gdevmsxf.c
+++ b/gs/base/gdevmsxf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,7 +59,7 @@ struct win_xfont_s {
};
gs_private_st_dev_ptrs1(st_win_xfont, win_xfont, "win_xfont",
- win_xfont_enum_ptrs, win_xfont_reloc_ptrs, dev);
+ win_xfont_enum_ptrs, win_xfont_reloc_ptrs, dev);
#define wxf ((win_xfont *)xf)
/* Forward references */
@@ -133,8 +133,8 @@ static const font_entry font_names[] =
static int /*bool */ map_logical_font(HDC, win_xfont *);
gx_xfont *
win_lookup_font(gx_device * dev, const byte * fname, uint len,
- int encoding_index, const gs_uid * puid, const gs_matrix * pmat,
- gs_memory_t * mem)
+ int encoding_index, const gs_uid * puid, const gs_matrix * pmat,
+ gs_memory_t * mem)
{
win_xfont f;
win_xfont *wf;
@@ -144,26 +144,26 @@ win_lookup_font(gx_device * dev, const byte * fname, uint len,
/* Only handle simple cases for now. */
if (pmat->xy != 0 || pmat->yx != 0 || pmat->xx <= 0 ||
- fabs(fabs(pmat->yy) - pmat->xx) > 0.00002
- )
- return NULL;
+ fabs(fabs(pmat->yy) - pmat->xx) > 0.00002
+ )
+ return NULL;
f.lf.lfHeight = (long)(pmat->xx * 1000);
/* Don't trust Windows with very small sizes. */
if (f.lf.lfHeight < 6 || f.lf.lfHeight >= 36)
- return NULL;
+ return NULL;
f.lf.lfWidth = 0;
f.lf.lfEscapement = 0;
f.lf.lfOrientation = 0;
f.lf.lfWeight =
- (string_match(fname, len, "*Bold*", 6, NULL) ?
- FW_BOLD : FW_REGULAR);
+ (string_match(fname, len, "*Bold*", 6, NULL) ?
+ FW_BOLD : FW_REGULAR);
f.lf.lfItalic =
- string_match(fname, len, "*Italic*", 8, NULL) ||
- string_match(fname, len, "*Oblique*", 9, NULL);
+ string_match(fname, len, "*Italic*", 8, NULL) ||
+ string_match(fname, len, "*Oblique*", 9, NULL);
f.lf.lfUnderline = 0;
f.lf.lfStrikeOut = 0;
f.lf.lfCharSet =
- (encoding_index == 2 ? SYMBOL_CHARSET : ANSI_CHARSET);
+ (encoding_index == 2 ? SYMBOL_CHARSET : ANSI_CHARSET);
f.lf.lfOutPrecision = OUT_CHARACTER_PRECIS;
f.lf.lfClipPrecision = CLIP_STROKE_PRECIS;
f.lf.lfQuality = PROOF_QUALITY;
@@ -171,35 +171,35 @@ win_lookup_font(gx_device * dev, const byte * fname, uint len,
f.invert_y = pmat->yy >= 0;
hdc = win_get_dc(wdev);
if (hdc == NULL)
- return NULL;
+ return NULL;
for (pfe = font_names; pfe != &font_names[countof(font_names)]; pfe++)
- if (!strncmp(pfe->key, fname, strlen(pfe->key))) { /* Found a match. */
- strcpy(f.lf.lfFaceName, pfe->value);
- f.lf.lfPitchAndFamily = pfe->pitchAndFamily;
- if (map_logical_font(hdc, &f))
- break;
- }
+ if (!strncmp(pfe->key, fname, strlen(pfe->key))) { /* Found a match. */
+ strcpy(f.lf.lfFaceName, pfe->value);
+ f.lf.lfPitchAndFamily = pfe->pitchAndFamily;
+ if (map_logical_font(hdc, &f))
+ break;
+ }
if (f.hFont == 0) { /* No matches in the table, try with the given name. */
- uint len;
-
- memcpy(f.lf.lfFaceName, fname, name_len); /* default */
- for (len = 0; len < name_len; len++)
- if (!isalnum(fname[len]))
- break;
- f.lf.lfFaceName[len] = 0;
- f.lf.lfPitchAndFamily = 0; /* default */
- if (!map_logical_font(hdc, &f)) {
- win_release_dc(wdev, hdc);
- return NULL;
- }
+ uint len;
+
+ memcpy(f.lf.lfFaceName, fname, name_len); /* default */
+ for (len = 0; len < name_len; len++)
+ if (!isalnum(fname[len]))
+ break;
+ f.lf.lfFaceName[len] = 0;
+ f.lf.lfPitchAndFamily = 0; /* default */
+ if (!map_logical_font(hdc, &f)) {
+ win_release_dc(wdev, hdc);
+ return NULL;
+ }
}
GetTextMetrics(hdc, &f.tm);
win_release_dc(wdev, hdc);
f.y_offset = (!f.invert_y ? f.tm.tmAscent : f.tm.tmDescent);
wf = gs_alloc_struct(mem, win_xfont, &st_win_xfont, "win_lookup_font");
if (wf == 0) {
- DeleteObject(f.hFont);
- return NULL;
+ DeleteObject(f.hFont);
+ return NULL;
}
f.common.procs = &win_xfont_procs;
f.dev = wdev;
@@ -214,12 +214,12 @@ map_logical_font(HDC hdc, win_xfont * xf)
xf->hFont = CreateFontIndirect(&xf->lf);
if (xf->hFont == 0)
- return 0;
+ return 0;
/* Check the face name */
SelectObject(hdc, xf->hFont);
GetTextFace(hdc, sizeof(szFaceName), szFaceName);
if (!strncmp(xf->lf.lfFaceName, szFaceName, strlen(xf->lf.lfFaceName)))
- return 1;
+ return 1;
DeleteObject(xf->hFont);
xf->hFont = 0;
return 0;
@@ -228,87 +228,87 @@ map_logical_font(HDC hdc, win_xfont * xf)
/* Convert a character name or index to an xglyph code. */
gx_xglyph
win_char_xglyph(gx_xfont * xf, gs_char chr, int encoding_index,
- gs_glyph glyph, const gs_const_string *glyph_name)
+ gs_glyph glyph, const gs_const_string *glyph_name)
{
if (chr == gs_no_char)
- return gx_no_xglyph; /* can't look up names yet */
+ return gx_no_xglyph; /* can't look up names yet */
if (encoding_index == 0) { /* Map StandardEncoding to ISOLatin1Encoding. */
- /* We lose a couple of characters that exist in both */
- /* StandardEncoding and the Windows OEM encoding but not in */
- /* the ISOLatin1Encoding; we won't worry about this */
- /* for now. */
- chr = gs_map_std_to_iso[chr];
- encoding_index = 1;
+ /* We lose a couple of characters that exist in both */
+ /* StandardEncoding and the Windows OEM encoding but not in */
+ /* the ISOLatin1Encoding; we won't worry about this */
+ /* for now. */
+ chr = gs_map_std_to_iso[chr];
+ encoding_index = 1;
}
if (wxf->hFont == NULL) { /* TEXTMETRICS not filled in yet */
- HDC hdc = win_get_dc(wxf->dev);
- int code;
-
- if (hdc == NULL)
- return gx_no_xglyph;
- code = win_select_font(hdc, wxf);
- win_release_dc(wxf->dev, hdc);
- if (code < 0)
- return gx_no_xglyph;
+ HDC hdc = win_get_dc(wxf->dev);
+ int code;
+
+ if (hdc == NULL)
+ return gx_no_xglyph;
+ code = win_select_font(hdc, wxf);
+ win_release_dc(wxf->dev, hdc);
+ if (code < 0)
+ return gx_no_xglyph;
}
switch (wxf->tm.tmCharSet) {
- case ANSI_CHARSET:
- if (encoding_index == 1 && (chr < 0x7f || chr > 0x9f ||
- chr == 0x91 || chr == 0x92)
- )
- break;
- return gx_no_xglyph;
- case OEM_CHARSET:
- switch (encoding_index) {
- case 1: /* ISOLatin1 */
- chr = gs_map_iso_to_oem[chr];
- break;
- case 2: /* Symbol */
- chr = gs_map_symbol_to_oem[chr];
- break;
- default:
- return gx_no_xglyph;
- }
- break;
- default:
- return gx_no_xglyph;
+ case ANSI_CHARSET:
+ if (encoding_index == 1 && (chr < 0x7f || chr > 0x9f ||
+ chr == 0x91 || chr == 0x92)
+ )
+ break;
+ return gx_no_xglyph;
+ case OEM_CHARSET:
+ switch (encoding_index) {
+ case 1: /* ISOLatin1 */
+ chr = gs_map_iso_to_oem[chr];
+ break;
+ case 2: /* Symbol */
+ chr = gs_map_symbol_to_oem[chr];
+ break;
+ default:
+ return gx_no_xglyph;
+ }
+ break;
+ default:
+ return gx_no_xglyph;
}
return (chr != 0 && chr >= wxf->tm.tmFirstChar &&
- chr <= wxf->tm.tmLastChar ?
- (gx_xglyph) chr : gx_no_xglyph);
+ chr <= wxf->tm.tmLastChar ?
+ (gx_xglyph) chr : gx_no_xglyph);
}
/* Get the metrics for a character. */
int
win_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
- gs_point * pwidth, gs_int_rect * pbbox)
+ gs_point * pwidth, gs_int_rect * pbbox)
{
int code;
HDC hdc;
char chr = (char)xg;
if (wmode != 0)
- return gs_error_undefined;
+ return gs_error_undefined;
hdc = win_get_dc(wxf->dev);
if (hdc == NULL)
- return gs_error_limitcheck;
+ return gs_error_limitcheck;
if ((code = win_select_font(hdc, wxf)) < 0) {
- win_release_dc(wxf->dev, hdc);
- return code;
+ win_release_dc(wxf->dev, hdc);
+ return code;
}
#ifdef __WIN32__
{
- SIZE sz;
+ SIZE sz;
- GetTextExtentPoint(hdc, &chr, 1, &sz);
- pwidth->x = sz.cx;
+ GetTextExtentPoint(hdc, &chr, 1, &sz);
+ pwidth->x = sz.cx;
}
#else
{
- DWORD extent;
+ DWORD extent;
- extent = GetTextExtent(hdc, &chr, 1);
- pwidth->x = LOWORD(extent);
+ extent = GetTextExtent(hdc, &chr, 1);
+ pwidth->x = LOWORD(extent);
}
#endif
win_release_dc(wxf->dev, hdc);
@@ -316,11 +316,11 @@ win_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
pbbox->p.x = 0;
pbbox->q.x = (int)pwidth->x;
if (wxf->invert_y) {
- pbbox->p.y = -wxf->tm.tmDescent;
- pbbox->q.y = wxf->tm.tmAscent;
+ pbbox->p.y = -wxf->tm.tmDescent;
+ pbbox->q.y = wxf->tm.tmAscent;
} else {
- pbbox->p.y = -wxf->tm.tmAscent;
- pbbox->q.y = wxf->tm.tmDescent;
+ pbbox->p.y = -wxf->tm.tmAscent;
+ pbbox->q.y = wxf->tm.tmDescent;
}
return 0;
}
@@ -328,85 +328,85 @@ win_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
/* Render a character. */
int
win_render_char(gx_xfont * xf, gx_xglyph xg, gx_device * dev,
- int xo, int yo, gx_color_index color, int required)
+ int xo, int yo, gx_color_index color, int required)
{
char chr = (char)xg;
int code;
#ifdef NOTUSED /* we don't own any windows so we can no longer do this */
if (dev->dname == gs_mswin_device.dname &&
- wdev->hdctext != NULL && !wxf->invert_y
- ) { /* Display the character directly */
- HDC hdc = wdev->hdctext;
- PALETTEENTRY *pal = &wdev->limgpalette->palPalEntry[color];
-
- if ((code = win_select_font(hdc, wxf)) < 0)
- return code;
- SetTextColor(hdc, RGB(pal->peRed, pal->peGreen, pal->peBlue));
- SetBkMode(hdc, TRANSPARENT);
- TextOut(hdc, xo, yo - wxf->y_offset, &chr, 1);
+ wdev->hdctext != NULL && !wxf->invert_y
+ ) { /* Display the character directly */
+ HDC hdc = wdev->hdctext;
+ PALETTEENTRY *pal = &wdev->limgpalette->palPalEntry[color];
+
+ if ((code = win_select_font(hdc, wxf)) < 0)
+ return code;
+ SetTextColor(hdc, RGB(pal->peRed, pal->peGreen, pal->peBlue));
+ SetBkMode(hdc, TRANSPARENT);
+ TextOut(hdc, xo, yo - wxf->y_offset, &chr, 1);
} else
#endif
if (!required)
- code = -1; /* too hard */
+ code = -1; /* too hard */
else { /* Display on an intermediate bitmap, then copy the bits. */
- gs_point wxy;
- gs_int_rect bbox;
- int w, h, wbm, raster;
- gx_device_win *fdev = wxf->dev;
- HBITMAP hbm;
- byte *bits;
-
- code = (*xf->common.procs->char_metrics) (xf, xg, 0,
- &wxy, &bbox);
- if (code < 0)
- return code;
- w = bbox.q.x - bbox.p.x;
- h = bbox.q.y - bbox.p.y;
- wbm = ROUND_UP(w, align_bitmap_mod * 8);
- raster = wbm >> 3;
- bits = gs_malloc(dev->memory, h, raster, "win_render_char");
- if (bits == 0)
- return gs_error_limitcheck;
- hbm = CreateBitmap(wbm, h, 1, 1, NULL);
- if (hbm == NULL) {
- code = gs_error_limitcheck;
- } else {
- HDC hdcwin = win_get_dc(fdev);
- HDC hdcbit = CreateCompatibleDC(hdcwin);
-
- dev_proc_copy_mono((*copy_mono)) =
- dev_proc(dev, copy_mono);
- int y = yo - wxf->y_offset;
-
- SetMapMode(hdcbit, GetMapMode(hdcwin));
- win_select_font(hdcbit, wxf);
- SelectObject(hdcbit, hbm);
- PatBlt(hdcbit, 0, 0, wbm, h, rop_write_0s);
- SetTextColor(hdcbit, 0xffffffL); /* 1 */
- SetBkMode(hdcbit, TRANSPARENT);
- TextOut(hdcbit, 0, 0, &chr, 1);
- GetBitmapBits(hbm, (DWORD) raster * h, bits);
- DeleteDC(hdcbit);
- win_release_dc(fdev, hdcwin);
- DeleteObject(hbm);
- if (!wxf->invert_y)
- code = (*copy_mono) (dev, bits, 0,
- raster, gx_no_bitmap_id,
- xo, y, w, h,
- gx_no_color_index, color);
- else { /* Copy scan lines in reverse order. */
- int i;
-
- y += h - 1;
- for (i = 0; i < h; i++)
- (*copy_mono) (dev, bits + i * raster,
- 0, raster, gx_no_bitmap_id,
- xo, y - i, w, 1,
- gx_no_color_index, color);
- }
- }
- gs_free(dev->memory, bits, h, raster, "win_render_char");
+ gs_point wxy;
+ gs_int_rect bbox;
+ int w, h, wbm, raster;
+ gx_device_win *fdev = wxf->dev;
+ HBITMAP hbm;
+ byte *bits;
+
+ code = (*xf->common.procs->char_metrics) (xf, xg, 0,
+ &wxy, &bbox);
+ if (code < 0)
+ return code;
+ w = bbox.q.x - bbox.p.x;
+ h = bbox.q.y - bbox.p.y;
+ wbm = ROUND_UP(w, align_bitmap_mod * 8);
+ raster = wbm >> 3;
+ bits = gs_malloc(dev->memory, h, raster, "win_render_char");
+ if (bits == 0)
+ return gs_error_limitcheck;
+ hbm = CreateBitmap(wbm, h, 1, 1, NULL);
+ if (hbm == NULL) {
+ code = gs_error_limitcheck;
+ } else {
+ HDC hdcwin = win_get_dc(fdev);
+ HDC hdcbit = CreateCompatibleDC(hdcwin);
+
+ dev_proc_copy_mono((*copy_mono)) =
+ dev_proc(dev, copy_mono);
+ int y = yo - wxf->y_offset;
+
+ SetMapMode(hdcbit, GetMapMode(hdcwin));
+ win_select_font(hdcbit, wxf);
+ SelectObject(hdcbit, hbm);
+ PatBlt(hdcbit, 0, 0, wbm, h, rop_write_0s);
+ SetTextColor(hdcbit, 0xffffffL); /* 1 */
+ SetBkMode(hdcbit, TRANSPARENT);
+ TextOut(hdcbit, 0, 0, &chr, 1);
+ GetBitmapBits(hbm, (DWORD) raster * h, bits);
+ DeleteDC(hdcbit);
+ win_release_dc(fdev, hdcwin);
+ DeleteObject(hbm);
+ if (!wxf->invert_y)
+ code = (*copy_mono) (dev, bits, 0,
+ raster, gx_no_bitmap_id,
+ xo, y, w, h,
+ gx_no_color_index, color);
+ else { /* Copy scan lines in reverse order. */
+ int i;
+
+ y += h - 1;
+ for (i = 0; i < h; i++)
+ (*copy_mono) (dev, bits + i * raster,
+ 0, raster, gx_no_bitmap_id,
+ xo, y - i, w, 1,
+ gx_no_color_index, color);
+ }
+ }
+ gs_free(dev->memory, bits, h, raster, "win_render_char");
}
return (code < 0 ? code : 0);
}
@@ -416,11 +416,11 @@ static int
win_release(gx_xfont * xf, gs_memory_t * mem)
{
if (wxf->hFont) {
- DeleteObject(wxf->hFont);
- wxf->hFont = 0;
+ DeleteObject(wxf->hFont);
+ wxf->hFont = 0;
}
if (mem != NULL)
- gs_free_object(mem, xf, "win_release");
+ gs_free_object(mem, xf, "win_release");
return 0;
}
@@ -452,10 +452,10 @@ win_select_font(HDC hdc, win_xfont * wxf)
HFONT hFont = wxf->hFont;
if (hFont == NULL) { /* The font was released to free up resources. */
- /* Re-acquire it now. */
- wxf->hFont = CreateFontIndirect(&wxf->lf);
- if (wxf->hFont == NULL)
- return gs_error_limitcheck;
+ /* Re-acquire it now. */
+ wxf->hFont = CreateFontIndirect(&wxf->lf);
+ if (wxf->hFont == NULL)
+ return gs_error_limitcheck;
}
SelectObject(hdc, wxf->hFont);
return 0;
diff --git a/gs/base/gdevn533.c b/gs/base/gdevn533.c
index 3df9ef173..9e82d17f0 100644
--- a/gs/base/gdevn533.c
+++ b/gs/base/gdevn533.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,12 +48,12 @@ static gx_device_procs nwp533_procs =
const gx_device_printer far_data gs_nwp533_device =
prn_device(nwp533_procs, "nwp533",
- PAPER_XDOTS * 10.0 / DPI, /* width_10ths */
- PAPER_YDOTS * 10.0 / DPI, /* height_10ths */
- DPI, /* x_dpi */
- DPI, /* y_dpi */
- 0,0,0,0, /* margins */
- 1, nwp533_print_page);
+ PAPER_XDOTS * 10.0 / DPI, /* width_10ths */
+ PAPER_YDOTS * 10.0 / DPI, /* height_10ths */
+ DPI, /* x_dpi */
+ DPI, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, nwp533_print_page);
/* return True if should retry - False if should quit */
static int
@@ -79,46 +79,46 @@ analyze_error(int printer_file)
{
/* Is there an error */
if(status.stat[0] & (ST0_CALL | ST0_REPRINT_REQ | ST0_WAIT | ST0_PAUSE))
- {
- if(status.stat[1] & ST1_NO_CARTRIGE)/* mispelled? */
- detail = "No cartridge - waiting";
- else if(status.stat[1] & ST1_NO_PAPER)
- detail = "Out of paper - waiting";
- else if(status.stat[1] & ST1_JAM)
- detail = "Paper jam - waiting";
- else if(status.stat[1] & ST1_OPEN)
- detail = "Door open - waiting";
- else if(status.stat[1] & ST1_TEST)
- detail = "Test printing - waiting";
- else {
- waiting = FALSE;
- retry_after_return = FALSE;
-
- if(status.stat[2] & ST2_FIXER)
- detail = "Fixer trouble - quiting";
- else if(status.stat[2] & ST2_SCANNER)
- detail = "Scanner trouble - quiting";
- else if(status.stat[2] & ST2_MOTOR)
- detail = "Scanner motor trouble - quiting";
- else if(status.stat[5] & ST5_NO_TONER)
- detail = "No toner - quiting";
- }
- }
+ {
+ if(status.stat[1] & ST1_NO_CARTRIGE)/* mispelled? */
+ detail = "No cartridge - waiting";
+ else if(status.stat[1] & ST1_NO_PAPER)
+ detail = "Out of paper - waiting";
+ else if(status.stat[1] & ST1_JAM)
+ detail = "Paper jam - waiting";
+ else if(status.stat[1] & ST1_OPEN)
+ detail = "Door open - waiting";
+ else if(status.stat[1] & ST1_TEST)
+ detail = "Test printing - waiting";
+ else {
+ waiting = FALSE;
+ retry_after_return = FALSE;
+
+ if(status.stat[2] & ST2_FIXER)
+ detail = "Fixer trouble - quiting";
+ else if(status.stat[2] & ST2_SCANNER)
+ detail = "Scanner trouble - quiting";
+ else if(status.stat[2] & ST2_MOTOR)
+ detail = "Scanner motor trouble - quiting";
+ else if(status.stat[5] & ST5_NO_TONER)
+ detail = "No toner - quiting";
+ }
+ }
else
- {
- waiting = FALSE;
- }
+ {
+ waiting = FALSE;
+ }
if(detail != NULL && detail != old_detail)
- {
- perror(detail);
- old_detail = detail;
- }
+ {
+ perror(detail);
+ old_detail = detail;
+ }
if(waiting)
- {
- ioctl(1, LBIOCRESET, 0);
- sleep(5);
- ioctl(1, LBIOCSTATUS, &status);
- }
+ {
+ ioctl(1, LBIOCRESET, 0);
+ sleep(5);
+ ioctl(1, LBIOCSTATUS, &status);
+ }
}
while(waiting);
return retry_after_return;
@@ -142,16 +142,16 @@ nwp533_close(gx_device *dev)
if (((gx_device_printer *) dev)->file != NULL)
{
int printer_file;
-
+
printer_file = fileno(((gx_device_printer *) dev)->file);
restart2:
if(ioctl(printer_file, LBIOCSTOP, 0) < 0)
- {
- if(analyze_error(printer_file))
- goto restart2;
- perror("Waiting for device");
- return_error(gs_error_ioerror);
- }
+ {
+ if(analyze_error(printer_file))
+ goto restart2;
+ perror("Waiting for device");
+ return_error(gs_error_ioerror);
+ }
}
return gdev_prn_close(dev);
}
@@ -165,7 +165,7 @@ nwp533_print_page(gx_device_printer *dev, FILE *prn_stream)
byte *in;
int printer_file;
printer_file = fileno(prn_stream);
-
+
if (line_size % 4 != 0)
{
line_size += 4 - (line_size % 4);
@@ -175,26 +175,26 @@ nwp533_print_page(gx_device_printer *dev, FILE *prn_stream)
if(ioctl(printer_file, LBIOCSTOP, 0) < 0)
{
if(analyze_error(printer_file))
- goto restart;
+ goto restart;
perror("Waiting for device");
return_error(gs_error_ioerror);
}
lseek(printer_file, 0, 0);
-
+
for ( lnum = 0; lnum < dev->height; lnum++)
{
gdev_prn_copy_scan_lines(prn_dev, lnum, in, line_size);
if(write(printer_file, in, line_size) != line_size)
- {
- perror("Writting to output");
- return_error(gs_error_ioerror);
- }
+ {
+ perror("Writting to output");
+ return_error(gs_error_ioerror);
+ }
}
retry:
if(ioctl(printer_file, LBIOCSTART, 0) < 0)
{
if(analyze_error(printer_file))
- goto retry;
+ goto retry;
perror("Starting print");
return_error(gs_error_ioerror);
}
diff --git a/gs/base/gdevnfwd.c b/gs/base/gdevnfwd.c
index e6dfb0623..e46485997 100644
--- a/gs/base/gdevnfwd.c
+++ b/gs/base/gdevnfwd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ gx_device_set_target(gx_device_forward *fdev, gx_device *target)
* make it decrement the reference count of the target.
*/
if (target && !fdev->finalize)
- fdev->finalize = gx_device_forward_finalize;
+ fdev->finalize = gx_device_forward_finalize;
/* Assign the profile of the target device to the forward device.
if it has not already been done with a parameter copy */
if (target && fdev->device_icc_profile != target->device_icc_profile) {
@@ -138,10 +138,10 @@ gx_forward_close_device(gx_device * dev)
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
int code = (tdev == 0) ? gx_default_close_device(dev)
- : dev_proc(tdev, close_device)(tdev);
+ : dev_proc(tdev, close_device)(tdev);
if (tdev)
- tdev->is_open = false; /* flag corresponds to the state */
+ tdev->is_open = false; /* flag corresponds to the state */
return code;
}
@@ -152,9 +152,9 @@ gx_forward_get_initial_matrix(gx_device * dev, gs_matrix * pmat)
gx_device *tdev = fdev->target;
if (tdev == 0)
- gx_default_get_initial_matrix(dev, pmat);
+ gx_default_get_initial_matrix(dev, pmat);
else
- dev_proc(tdev, get_initial_matrix)(tdev, pmat);
+ dev_proc(tdev, get_initial_matrix)(tdev, pmat);
}
int
@@ -164,7 +164,7 @@ gx_forward_sync_output(gx_device * dev)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_sync_output(dev) :
- dev_proc(tdev, sync_output)(tdev));
+ dev_proc(tdev, sync_output)(tdev));
}
int
@@ -173,11 +173,11 @@ gx_forward_output_page(gx_device * dev, int num_copies, int flush)
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
int code =
- (tdev == 0 ? gx_default_output_page(dev, num_copies, flush) :
- dev_proc(tdev, output_page)(tdev, num_copies, flush));
+ (tdev == 0 ? gx_default_output_page(dev, num_copies, flush) :
+ dev_proc(tdev, output_page)(tdev, num_copies, flush));
if (code >= 0 && tdev != 0)
- dev->PageCount = tdev->PageCount;
+ dev->PageCount = tdev->PageCount;
return code;
}
@@ -188,87 +188,87 @@ gx_forward_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_error_encode_color(dev, cv) :
- dev_proc(tdev, map_rgb_color)(tdev, cv));
+ dev_proc(tdev, map_rgb_color)(tdev, cv));
}
int
gx_forward_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_map_color_rgb(dev, color, prgb) :
- dev_proc(tdev, map_color_rgb)(tdev, color, prgb));
+ dev_proc(tdev, map_color_rgb)(tdev, color, prgb));
}
int
gx_forward_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
if (tdev == 0)
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
return dev_proc(tdev, fill_rectangle)(tdev, x, y, w, h, color);
}
int
gx_forward_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
- int x, int y, int w, int h, gx_color_index color0,
- gx_color_index color1, int px, int py)
+ int x, int y, int w, int h, gx_color_index color0,
+ gx_color_index color1, int px, int py)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_tile_rectangle((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_tile_rectangle) :
- dev_proc(tdev, tile_rectangle));
+ (tdev == 0 ? (tdev = dev, gx_default_tile_rectangle) :
+ dev_proc(tdev, tile_rectangle));
return proc(tdev, tile, x, y, w, h, color0, color1, px, py);
}
int
gx_forward_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
if (tdev == 0)
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
return dev_proc(tdev, copy_mono)
- (tdev, data, dx, raster, id, x, y, w, h, zero, one);
+ (tdev, data, dx, raster, id, x, y, w, h, zero, one);
}
int
gx_forward_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
if (tdev == 0)
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
return dev_proc(tdev, copy_alpha)
- (tdev, data, data_x, raster, id, x, y, width, height, color, depth);
+ (tdev, data, data_x, raster, id, x, y, width, height, color, depth);
}
int
gx_forward_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
if (tdev == 0)
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
return dev_proc(tdev, copy_color)
- (tdev, data, dx, raster, id, x, y, w, h);
+ (tdev, data, dx, raster, id, x, y, w, h);
}
int
@@ -278,7 +278,7 @@ gx_forward_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_get_bits(dev, y, data, actual_data) :
- dev_proc(tdev, get_bits)(tdev, y, data, actual_data));
+ dev_proc(tdev, get_bits)(tdev, y, data, actual_data));
}
int
@@ -288,7 +288,7 @@ gx_forward_get_params(gx_device * dev, gs_param_list * plist)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_get_params(dev, plist) :
- dev_proc(tdev, get_params)(tdev, plist));
+ dev_proc(tdev, get_params)(tdev, plist));
}
int
@@ -300,14 +300,14 @@ gx_forward_put_params(gx_device * dev, gs_param_list * plist)
int code;
if (tdev == 0)
- return gx_default_put_params(dev, plist);
+ return gx_default_put_params(dev, plist);
was_open = tdev->is_open;
code = dev_proc(tdev, put_params)(tdev, plist);
if (code == 0 && !tdev->is_open) {
- code = was_open ? 1 : 0; /* target device closed */
+ code = was_open ? 1 : 0; /* target device closed */
}
if (code >= 0)
- gx_device_decache_colors(dev);
+ gx_device_decache_colors(dev);
return code;
}
@@ -318,7 +318,7 @@ gx_forward_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_map_cmyk_color(dev, cv) :
- dev_proc(tdev, map_cmyk_color)(tdev, cv));
+ dev_proc(tdev, map_cmyk_color)(tdev, cv));
}
const gx_xfont_procs *
@@ -328,7 +328,7 @@ gx_forward_get_xfont_procs(gx_device * dev)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_get_xfont_procs(dev) :
- dev_proc(tdev, get_xfont_procs)(tdev));
+ dev_proc(tdev, get_xfont_procs)(tdev));
}
gx_device *
@@ -338,20 +338,20 @@ gx_forward_get_xfont_device(gx_device * dev)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_get_xfont_device(dev) :
- dev_proc(tdev, get_xfont_device)(tdev));
+ dev_proc(tdev, get_xfont_device)(tdev));
}
gx_color_index
gx_forward_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
- gx_color_value g, gx_color_value b,
- gx_color_value alpha)
+ gx_color_value g, gx_color_value b,
+ gx_color_value alpha)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
return (tdev == 0 ?
- gx_default_map_rgb_alpha_color(dev, r, g, b, alpha) :
- dev_proc(tdev, map_rgb_alpha_color)(tdev, r, g, b, alpha));
+ gx_default_map_rgb_alpha_color(dev, r, g, b, alpha) :
+ dev_proc(tdev, map_rgb_alpha_color)(tdev, r, g, b, alpha));
}
gx_device *
@@ -362,7 +362,7 @@ gx_forward_get_page_device(gx_device * dev)
gx_device *pdev;
if (tdev == 0)
- return gx_default_get_page_device(dev);
+ return gx_default_get_page_device(dev);
pdev = dev_proc(tdev, get_page_device)(tdev);
return pdev;
}
@@ -374,187 +374,187 @@ gx_forward_get_band(gx_device * dev, int y, int *band_start)
gx_device *tdev = fdev->target;
return (tdev == 0 ?
- gx_default_get_band(dev, y, band_start) :
- dev_proc(tdev, get_band)(tdev, y, band_start));
+ gx_default_get_band(dev, y, band_start) :
+ dev_proc(tdev, get_band)(tdev, y, band_start));
}
int
gx_forward_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster,
- gx_bitmap_id id, const gx_color_index * scolors,
- const gx_tile_bitmap * texture,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster,
+ gx_bitmap_id id, const gx_color_index * scolors,
+ const gx_tile_bitmap * texture,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_copy_rop((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_copy_rop) :
- dev_proc(tdev, copy_rop));
+ (tdev == 0 ? (tdev = dev, gx_default_copy_rop) :
+ dev_proc(tdev, copy_rop));
return proc(tdev, sdata, sourcex, sraster, id, scolors,
- texture, tcolors, x, y, width, height,
- phase_x, phase_y, lop);
+ texture, tcolors, x, y, width, height,
+ phase_x, phase_y, lop);
}
int
gx_forward_fill_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_path((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_path) :
- dev_proc(tdev, fill_path));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_path) :
+ dev_proc(tdev, fill_path));
return proc(tdev, pis, ppath, params, pdcolor, pcpath);
}
int
gx_forward_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_stroke_path((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_stroke_path) :
- dev_proc(tdev, stroke_path));
+ (tdev == 0 ? (tdev = dev, gx_default_stroke_path) :
+ dev_proc(tdev, stroke_path));
return proc(tdev, pis, ppath, params, pdcolor, pcpath);
}
int
gx_forward_fill_mask(gx_device * dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_mask((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_mask) :
- dev_proc(tdev, fill_mask));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_mask) :
+ dev_proc(tdev, fill_mask));
return proc(tdev, data, dx, raster, id, x, y, w, h, pdcolor, depth,
- lop, pcpath);
+ lop, pcpath);
}
int
gx_forward_fill_trapezoid(gx_device * dev,
- const gs_fixed_edge * left,
- const gs_fixed_edge * right,
- fixed ybot, fixed ytop, bool swap_axes,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ const gs_fixed_edge * left,
+ const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_trapezoid((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_trapezoid) :
- dev_proc(tdev, fill_trapezoid));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_trapezoid) :
+ dev_proc(tdev, fill_trapezoid));
return proc(tdev, left, right, ybot, ytop, swap_axes, pdcolor, lop);
}
int
gx_forward_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_parallelogram((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_parallelogram) :
- dev_proc(tdev, fill_parallelogram));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_parallelogram) :
+ dev_proc(tdev, fill_parallelogram));
return proc(tdev, px, py, ax, ay, bx, by, pdcolor, lop);
}
int
gx_forward_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_triangle((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_triangle) :
- dev_proc(tdev, fill_triangle));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_triangle) :
+ dev_proc(tdev, fill_triangle));
return proc(tdev, px, py, ax, ay, bx, by, pdcolor, lop);
}
int
gx_forward_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_drawing_color * pdcolor, gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_draw_thin_line((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_draw_thin_line) :
- dev_proc(tdev, draw_thin_line));
+ (tdev == 0 ? (tdev = dev, gx_default_draw_thin_line) :
+ dev_proc(tdev, draw_thin_line));
return proc(tdev, fx0, fy0, fx1, fy1, pdcolor, lop, adjustx, adjusty);
}
int
gx_forward_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_begin_image((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_begin_image) :
- dev_proc(tdev, begin_image));
+ (tdev == 0 ? (tdev = dev, gx_default_begin_image) :
+ dev_proc(tdev, begin_image));
return proc(tdev, pis, pim, format, prect, pdcolor, pcpath,
- memory, pinfo);
+ memory, pinfo);
}
int
gx_forward_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_strip_tile_rectangle((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_strip_tile_rectangle) :
- dev_proc(tdev, strip_tile_rectangle));
+ (tdev == 0 ? (tdev = dev, gx_default_strip_tile_rectangle) :
+ dev_proc(tdev, strip_tile_rectangle));
return proc(tdev, tiles, x, y, w, h, color0, color1, px, py);
}
int
gx_forward_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
- uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_strip_copy_rop((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_strip_copy_rop) :
- dev_proc(tdev, strip_copy_rop));
+ (tdev == 0 ? (tdev = dev, gx_default_strip_copy_rop) :
+ dev_proc(tdev, strip_copy_rop));
return proc(tdev, sdata, sourcex, sraster, id, scolors,
- textures, tcolors, x, y, width, height,
- phase_x, phase_y, lop);
+ textures, tcolors, x, y, width, height,
+ phase_x, phase_y, lop);
}
void
@@ -564,53 +564,53 @@ gx_forward_get_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
gx_device *tdev = fdev->target;
if (tdev == 0)
- gx_default_get_clipping_box(dev, pbox);
+ gx_default_get_clipping_box(dev, pbox);
else
- dev_proc(tdev, get_clipping_box)(tdev, pbox);
+ dev_proc(tdev, get_clipping_box)(tdev, pbox);
}
int
gx_forward_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix * pmat,
- const gs_image_common_t * pim,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix * pmat,
+ const gs_image_common_t * pim,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory,
+ gx_image_enum_common_t ** pinfo)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_begin_typed_image((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_begin_typed_image) :
- dev_proc(tdev, begin_typed_image));
+ (tdev == 0 ? (tdev = dev, gx_default_begin_typed_image) :
+ dev_proc(tdev, begin_typed_image));
return proc(tdev, pis, pmat, pim, prect, pdcolor, pcpath,
- memory, pinfo);
+ memory, pinfo);
}
int
gx_forward_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_get_bits_rectangle((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_get_bits_rectangle) :
- dev_proc(tdev, get_bits_rectangle));
+ (tdev == 0 ? (tdev = dev, gx_default_get_bits_rectangle) :
+ dev_proc(tdev, get_bits_rectangle));
return proc(tdev, prect, params, unread);
}
int
gx_forward_map_color_rgb_alpha(gx_device * dev, gx_color_index color,
- gx_color_value prgba[4])
+ gx_color_value prgba[4])
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_map_color_rgb_alpha(dev, color, prgba) :
- dev_proc(tdev, map_color_rgb_alpha)(tdev, color, prgba));
+ dev_proc(tdev, map_color_rgb_alpha)(tdev, color, prgba));
}
int
@@ -620,24 +620,24 @@ gx_forward_get_hardware_params(gx_device * dev, gs_param_list * plist)
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_default_get_hardware_params(dev, plist) :
- dev_proc(tdev, get_hardware_params)(tdev, plist));
+ dev_proc(tdev, get_hardware_params)(tdev, plist));
}
int
gx_forward_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * memory,
- gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * memory,
+ gs_text_enum_t ** ppenum)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_text_begin((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_text_begin) :
- dev_proc(tdev, text_begin));
+ (tdev == 0 ? (tdev = dev, gx_default_text_begin) :
+ dev_proc(tdev, text_begin));
return proc(tdev, pis, text, font, path, pdcolor, pcpath,
- memory, ppenum);
+ memory, ppenum);
}
/* Forwarding device color mapping procs. */
@@ -667,7 +667,7 @@ fwd_map_gray_cs(gx_device * dev, frac gray, frac out[])
*/
static void
fwd_map_rgb_cs(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device * const tdev = fdev->target;
@@ -720,22 +720,22 @@ gx_forward_get_color_mapping_procs(const gx_device * dev)
gx_device * tdev = fdev->target;
return (tdev == 0 || dev_proc(tdev, get_color_mapping_procs) == 0
- ? gx_default_DevGray_get_color_mapping_procs(dev)
- : &FwdDevice_cm_map_procs);
+ ? gx_default_DevGray_get_color_mapping_procs(dev)
+ : &FwdDevice_cm_map_procs);
}
int
gx_forward_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
const gx_device_forward * fdev = (const gx_device_forward *)dev;
gx_device *tdev = fdev->target;
- return (tdev == 0
- ? gx_error_get_color_comp_index(dev, pname,
- name_size, component_type)
- : dev_proc(tdev, get_color_comp_index)(tdev, pname,
- name_size, component_type));
+ return (tdev == 0
+ ? gx_error_get_color_comp_index(dev, pname,
+ name_size, component_type)
+ : dev_proc(tdev, get_color_comp_index)(tdev, pname,
+ name_size, component_type));
}
gx_color_index
@@ -745,7 +745,7 @@ gx_forward_encode_color(gx_device * dev, const gx_color_value colors[])
gx_device *tdev = fdev->target;
return (tdev == 0 ? gx_error_encode_color(dev, colors)
- : dev_proc(tdev, encode_color)(tdev, colors));
+ : dev_proc(tdev, encode_color)(tdev, colors));
}
int
@@ -755,9 +755,9 @@ gx_forward_decode_color(gx_device * dev, gx_color_index cindex, gx_color_value c
gx_device *tdev = fdev->target;
if (tdev == 0) /* If no device - just clear the color values */
- memset(colors, 0, sizeof(gx_color_value[GX_DEVICE_COLOR_MAX_COMPONENTS]));
+ memset(colors, 0, sizeof(gx_color_value[GX_DEVICE_COLOR_MAX_COMPONENTS]));
else
- dev_proc(tdev, decode_color)(tdev, cindex, colors);
+ dev_proc(tdev, decode_color)(tdev, cindex, colors);
return 0;
}
@@ -767,95 +767,95 @@ gx_forward_dev_spec_op(gx_device * dev, int dev_spec_op, void *data, int size)
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
- /* Note that clist sets fdev->target == fdev,
+ /* Note that clist sets fdev->target == fdev,
so this function is unapplicable to clist. */
if (tdev == 0) {
- if (dev_spec_op == gxdso_pattern_shfill_doesnt_need_path) {
- return (dev->procs.fill_path == gx_default_fill_path);
- }
+ if (dev_spec_op == gxdso_pattern_shfill_doesnt_need_path) {
+ return (dev->procs.fill_path == gx_default_fill_path);
+ }
} else if (dev_spec_op == gxdso_pattern_handles_clip_path) {
- if (dev->procs.fill_path == gx_default_fill_path)
- return 0;
+ if (dev->procs.fill_path == gx_default_fill_path)
+ return 0;
}
return dev_proc(tdev, dev_spec_op)(tdev, dev_spec_op, data, size);
}
int
-gx_forward_fill_rectangle_hl_color(gx_device *dev,
- const gs_fixed_rect *rect,
+gx_forward_fill_rectangle_hl_color(gx_device *dev,
+ const gs_fixed_rect *rect,
const gs_imager_state *pis, const gx_drawing_color *pdcolor,
const gx_clip_path *pcpath)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
- /* Note that clist sets fdev->target == fdev,
+ /* Note that clist sets fdev->target == fdev,
so this function is unapplicable to clist. */
if (tdev == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else
- return dev_proc(tdev, fill_rectangle_hl_color)(tdev, rect,
- pis, pdcolor, NULL);
+ return dev_proc(tdev, fill_rectangle_hl_color)(tdev, rect,
+ pis, pdcolor, NULL);
}
int
-gx_forward_include_color_space(gx_device *dev, gs_color_space *cspace,
- const byte *res_name, int name_length)
+gx_forward_include_color_space(gx_device *dev, gs_color_space *cspace,
+ const byte *res_name, int name_length)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
- /* Note that clist sets fdev->target == fdev,
+ /* Note that clist sets fdev->target == fdev,
so this function is unapplicable to clist. */
if (tdev == 0)
- return 0;
+ return 0;
else
- return dev_proc(tdev, include_color_space)(tdev, cspace, res_name, name_length);
+ return dev_proc(tdev, include_color_space)(tdev, cspace, res_name, name_length);
}
-int
+int
gx_forward_fill_linear_color_scanline(gx_device *dev, const gs_fill_attributes *fa,
- int i, int j, int w,
- const frac31 *c, const int32_t *addx, const int32_t *mulx, int32_t divx)
+ int i, int j, int w,
+ const frac31 *c, const int32_t *addx, const int32_t *mulx, int32_t divx)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_linear_color_scanline((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_scanline) :
- dev_proc(tdev, fill_linear_color_scanline));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_scanline) :
+ dev_proc(tdev, fill_linear_color_scanline));
return proc(tdev, fa, i, j, w, c, addx, mulx, divx);
}
-int
+int
gx_forward_fill_linear_color_trapezoid(gx_device *dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2, const gs_fixed_point *p3,
- const frac31 *c0, const frac31 *c1,
- const frac31 *c2, const frac31 *c3)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2, const gs_fixed_point *p3,
+ const frac31 *c0, const frac31 *c1,
+ const frac31 *c2, const frac31 *c3)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_linear_color_trapezoid((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_trapezoid) :
- dev_proc(tdev, fill_linear_color_trapezoid));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_trapezoid) :
+ dev_proc(tdev, fill_linear_color_trapezoid));
return proc(tdev, fa, p0, p1, p2, p3, c0, c1, c2, c3);
}
-int
+int
gx_forward_fill_linear_color_triangle(gx_device *dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2,
- const frac31 *c0, const frac31 *c1, const frac31 *c2)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2,
+ const frac31 *c0, const frac31 *c1, const frac31 *c2)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fill_linear_color_triangle((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_triangle) :
- dev_proc(tdev, fill_linear_color_triangle));
+ (tdev == 0 ? (tdev = dev, gx_default_fill_linear_color_triangle) :
+ dev_proc(tdev, fill_linear_color_triangle));
return proc(tdev, fa, p0, p1, p2, c0, c1, c2);
}
-int
+int
gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
@@ -863,33 +863,32 @@ gx_forward_update_spot_equivalent_colors(gx_device *dev, const gs_state * pgs)
int code = 0;
if (tdev != NULL)
- code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs);
+ code = dev_proc(tdev, update_spot_equivalent_colors)(tdev, pgs);
return code;
}
-gs_devn_params *
+gs_devn_params *
gx_forward_ret_devn_params(gx_device *dev)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
if (tdev != NULL)
- return dev_proc(tdev, ret_devn_params)(tdev);
+ return dev_proc(tdev, ret_devn_params)(tdev);
return NULL;
}
-int
+int
gx_forward_fillpage(gx_device *dev, gs_imager_state * pis, gx_device_color *pdevc)
{
gx_device_forward * const fdev = (gx_device_forward *)dev;
gx_device *tdev = fdev->target;
dev_proc_fillpage((*proc)) =
- (tdev == 0 ? (tdev = dev, gx_default_fillpage) :
- dev_proc(tdev, fillpage));
+ (tdev == 0 ? (tdev = dev, gx_default_fillpage) :
+ dev_proc(tdev, fillpage));
return proc(tdev, pis, pdevc);
}
-
/* ---------------- The null device(s) ---------------- */
static dev_proc_get_initial_matrix(gx_forward_upright_get_initial_matrix);
@@ -912,62 +911,62 @@ static dev_proc_decode_color(null_decode_color);
static dev_proc_strip_copy_rop(null_strip_copy_rop);
#define null_procs(get_initial_matrix, get_page_device) {\
- gx_default_open_device,\
- get_initial_matrix, /* differs */\
- gx_default_sync_output,\
- gx_default_output_page,\
- gx_default_close_device,\
- gx_forward_map_rgb_color,\
- gx_forward_map_color_rgb,\
- null_fill_rectangle,\
- gx_default_tile_rectangle,\
- null_copy_mono,\
- null_copy_color,\
- gx_default_draw_line,\
- gx_default_get_bits,\
- gx_forward_get_params,\
- null_put_params,\
- gx_forward_map_cmyk_color,\
- gx_forward_get_xfont_procs,\
- gx_forward_get_xfont_device,\
- gx_forward_map_rgb_alpha_color,\
- get_page_device, /* differs */\
- gx_default_get_alpha_bits,\
- null_copy_alpha,\
- gx_forward_get_band,\
- null_copy_rop,\
- null_fill_path,\
- null_stroke_path,\
- gx_default_fill_mask,\
- null_fill_trapezoid,\
- null_fill_parallelogram,\
- null_fill_triangle,\
- null_draw_thin_line,\
- gx_default_begin_image,\
- gx_default_image_data,\
- gx_default_end_image,\
- gx_default_strip_tile_rectangle,\
- null_strip_copy_rop,\
- gx_default_get_clipping_box,\
- gx_default_begin_typed_image,\
- gx_default_get_bits_rectangle,\
- gx_forward_map_color_rgb_alpha,\
- gx_non_imaging_create_compositor,\
- gx_forward_get_hardware_params,\
- gx_default_text_begin,\
- gx_default_finish_copydevice,\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- gx_default_DevGray_get_color_mapping_procs, /* get_color_mapping_procs */\
- gx_default_DevGray_get_color_comp_index,/* get_color_comp_index */\
- gx_default_gray_fast_encode, /* encode_color */\
- null_decode_color, /* decode_color */\
- NULL, /* pattern_manage */\
- gx_default_fill_rectangle_hl_color,\
- gx_default_include_color_space,\
+ gx_default_open_device,\
+ get_initial_matrix, /* differs */\
+ gx_default_sync_output,\
+ gx_default_output_page,\
+ gx_default_close_device,\
+ gx_forward_map_rgb_color,\
+ gx_forward_map_color_rgb,\
+ null_fill_rectangle,\
+ gx_default_tile_rectangle,\
+ null_copy_mono,\
+ null_copy_color,\
+ gx_default_draw_line,\
+ gx_default_get_bits,\
+ gx_forward_get_params,\
+ null_put_params,\
+ gx_forward_map_cmyk_color,\
+ gx_forward_get_xfont_procs,\
+ gx_forward_get_xfont_device,\
+ gx_forward_map_rgb_alpha_color,\
+ get_page_device, /* differs */\
+ gx_default_get_alpha_bits,\
+ null_copy_alpha,\
+ gx_forward_get_band,\
+ null_copy_rop,\
+ null_fill_path,\
+ null_stroke_path,\
+ gx_default_fill_mask,\
+ null_fill_trapezoid,\
+ null_fill_parallelogram,\
+ null_fill_triangle,\
+ null_draw_thin_line,\
+ gx_default_begin_image,\
+ gx_default_image_data,\
+ gx_default_end_image,\
+ gx_default_strip_tile_rectangle,\
+ null_strip_copy_rop,\
+ gx_default_get_clipping_box,\
+ gx_default_begin_typed_image,\
+ gx_default_get_bits_rectangle,\
+ gx_forward_map_color_rgb_alpha,\
+ gx_non_imaging_create_compositor,\
+ gx_forward_get_hardware_params,\
+ gx_default_text_begin,\
+ gx_default_finish_copydevice,\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ gx_default_DevGray_get_color_mapping_procs, /* get_color_mapping_procs */\
+ gx_default_DevGray_get_color_comp_index,/* get_color_comp_index */\
+ gx_default_gray_fast_encode, /* encode_color */\
+ null_decode_color, /* decode_color */\
+ NULL, /* pattern_manage */\
+ gx_default_fill_rectangle_hl_color,\
+ gx_default_include_color_space,\
NULL, /* fill_line_sl */\
NULL, /* fill_line_tr */\
NULL, /* fill_line_tri */\
@@ -982,7 +981,7 @@ static dev_proc_strip_copy_rop(null_strip_copy_rop);
const gx_device_null gs_null_device = {
std_device_std_body_type_open(gx_device_null, 0, "null", &st_device_null,
- 0, 0, 72, 72),
+ 0, 0, 72, 72),
null_procs(gx_forward_upright_get_initial_matrix, /* upright matrix */
gx_default_get_page_device /* not a page device */ ),
0 /* target */
@@ -990,7 +989,7 @@ const gx_device_null gs_null_device = {
const gx_device_null gs_nullpage_device = {
std_device_std_body_type_open(gx_device_null, 0, "nullpage", &st_device_null,
- 72 /*nominal */ , 72 /*nominal */ , 72, 72),
+ 72 /*nominal */ , 72 /*nominal */ , 72, 72),
null_procs( gx_forward_get_initial_matrix, /* default matrix */
gx_page_device_get_page_device /* a page device */ ),
0 /* target */
@@ -1003,9 +1002,9 @@ gx_forward_upright_get_initial_matrix(gx_device * dev, gs_matrix * pmat)
gx_device *tdev = fdev->target;
if (tdev == 0)
- gx_upright_get_initial_matrix(dev, pmat);
+ gx_upright_get_initial_matrix(dev, pmat);
else
- dev_proc(tdev, get_initial_matrix)(tdev, pmat);
+ dev_proc(tdev, get_initial_matrix)(tdev, pmat);
}
static int
@@ -1017,21 +1016,21 @@ null_decode_color(gx_device * dev, gx_color_index cindex, gx_color_value colors[
static int
null_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
return 0;
}
static int
null_copy_mono(gx_device * dev, const byte * data, int dx, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
return 0;
}
static int
null_copy_color(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height)
{
return 0;
}
@@ -1045,89 +1044,89 @@ null_put_params(gx_device * dev, gs_param_list * plist)
int code = gx_forward_put_params(dev, plist);
if (code < 0 || dev_proc(dev, get_page_device)(dev) == dev)
- return code;
+ return code;
dev->width = dev->height = 0;
return code;
}
static int
null_copy_alpha(gx_device * dev, const byte * data, int data_x, int raster,
- gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{
return 0;
}
static int
null_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_tile_bitmap * texture, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return 0;
}
static int
null_fill_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
return 0;
}
static int
null_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
return 0;
}
static int
null_fill_trapezoid(gx_device * dev,
- const gs_fixed_edge * left, const gs_fixed_edge * right,
- fixed ybot, fixed ytop, bool swap_axes,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ const gs_fixed_edge * left, const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
return 0;
}
static int
null_fill_parallelogram(gx_device * dev, fixed px, fixed py,
- fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
return 0;
}
static int
null_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
return 0;
}
static int
null_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
return 0;
}
static int
null_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
- uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return 0;
}
bool
-fwd_uses_fwd_cmap_procs(gx_device * dev)
+fwd_uses_fwd_cmap_procs(gx_device * dev)
{
const gx_cm_color_map_procs *pprocs;
@@ -1150,4 +1149,4 @@ fwd_get_target_cmap_procs(gx_device * dev)
pprocs = fwd_get_target_cmap_procs(tdev);
}
return pprocs;
-} \ No newline at end of file
+}
diff --git a/gs/base/gdevo182.c b/gs/base/gdevo182.c
index 45a5becfd..1cc521a01 100644
--- a/gs/base/gdevo182.c
+++ b/gs/base/gdevo182.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,9 +23,9 @@ alias psp "gs -q -sDEVICE=oki182 -sOutputFile=\|lpr - <\!*"
alias psphigh "gs -q -sDEVICE=oki182 -r144 -sOutputFile=\|lpr - <\!*"
ps. I have my printer DIP switches set to the following (as viewed
- while standing in front of your printer looking down into the
- config access hatch located at the top of your printer
- in the centre back).
+ while standing in front of your printer looking down into the
+ config access hatch located at the top of your printer
+ in the centre back).
Upper Upper Bottom
Left Right (at right)
@@ -63,12 +63,12 @@ static dev_proc_print_page(oki_print_page);
const gx_device_printer far_data gs_oki182_device =
prn_device(prn_std_procs, "oki182",
- 80, /* width_10ths, 8.0" */
- 110, /* height_10ths, 11" */
- 72, /* x_dpi */
- 72, /* y_dpi */
- 0, 0, 0, 0, /* margins */
- 1, oki_print_page);
+ 80, /* width_10ths, 8.0" */
+ 110, /* height_10ths, 11" */
+ 72, /* x_dpi */
+ 72, /* y_dpi */
+ 0, 0, 0, 0, /* margins */
+ 1, oki_print_page);
/* ------ internal routines ------ */
@@ -89,38 +89,38 @@ const gx_device_printer far_data gs_oki182_device =
static void
oki_transpose(byte *in, byte *out, int scanBits, register int lineSize)
{
- register int bitMask = 0x80;
- register byte *inPtr;
- register byte outByte;
-
- while (scanBits-- > 0) {
-
- inPtr = in;
-
- if (*inPtr & bitMask)
- outByte = 0x81;
- else
- outByte = 0x80;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x02;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x04;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x08;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x10;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x20;
- if (*(inPtr += lineSize) & bitMask)
- outByte += 0x40;
-
- *out++ = outByte;
-
- if ((bitMask >>= 1) == 0) {
- bitMask = 0x80;
- in ++;
- }
- }
+ register int bitMask = 0x80;
+ register byte *inPtr;
+ register byte outByte;
+
+ while (scanBits-- > 0) {
+
+ inPtr = in;
+
+ if (*inPtr & bitMask)
+ outByte = 0x81;
+ else
+ outByte = 0x80;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x02;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x04;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x08;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x10;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x20;
+ if (*(inPtr += lineSize) & bitMask)
+ outByte += 0x40;
+
+ *out++ = outByte;
+
+ if ((bitMask >>= 1) == 0) {
+ bitMask = 0x80;
+ in ++;
+ }
+ }
}
/* This routine tries to compress a sequence of okidata
@@ -142,36 +142,36 @@ oki_transpose(byte *in, byte *out, int scanBits, register int lineSize)
*/
static byte *
oki_compress(byte *in, int origWidth, int highRes,
- int *numSpaces, int *newWidth)
+ int *numSpaces, int *newWidth)
{
- int spaces = 0;
- int columns_per_space = 6;
+ int spaces = 0;
+ int columns_per_space = 6;
- byte *in_end = in + origWidth;
+ byte *in_end = in + origWidth;
- /* remove trailing zeros (which are realy 0x80's) */
- while (in_end > in && in_end[-1] == 0x80)
- in_end --;
+ /* remove trailing zeros (which are realy 0x80's) */
+ while (in_end > in && in_end[-1] == 0x80)
+ in_end --;
- if (highRes)
- columns_per_space = 12;
+ if (highRes)
+ columns_per_space = 12;
- /* remove leading zeros that can be replaced by spaces */
- while(in < in_end && in[0] == 0x80 && memcmp((char *)in,
- (char *)in + 1, columns_per_space - 1) == 0) {
- spaces++;
- in += columns_per_space;
- }
+ /* remove leading zeros that can be replaced by spaces */
+ while(in < in_end && in[0] == 0x80 && memcmp((char *)in,
+ (char *)in + 1, columns_per_space - 1) == 0) {
+ spaces++;
+ in += columns_per_space;
+ }
- *numSpaces = spaces;
+ *numSpaces = spaces;
- /* just in case we compressed this line out of existance */
- if (in_end > in)
- *newWidth = in_end - in;
- else
- *newWidth = 0;
+ /* just in case we compressed this line out of existance */
+ if (in_end > in)
+ *newWidth = in_end - in;
+ else
+ *newWidth = 0;
- return(in);
+ return(in);
}
/* Send the page to the printer. */
@@ -179,127 +179,127 @@ oki_compress(byte *in, int origWidth, int highRes,
static int
oki_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- int highRes = pdev->y_pixels_per_inch > 100;
- int bits_per_column = 7;
- int i, spaces, width;
- int lcnt;
-
- int line_size = gdev_prn_raster((gx_device_printer *)pdev);
-
- byte *in = (byte *)gs_malloc(pdev->memory, 16, line_size, "oki_print_page(in)");
-
- byte *out1 = (byte *)gs_malloc(pdev->memory, 8, line_size, "oki_print_page(out1)");
- byte *out2 = (byte *)gs_malloc(pdev->memory, 8, line_size, "oki_print_page(out2)");
-
- byte *out3;
-
- int lnum = 0;
- int skip = 0;
- int code = 0;
-
- if ( in == 0 || out1 == 0 || out2 == 0)
- { code = gs_error_VMerror;
- gs_note_error(code);
- goto bail;
- }
-
- /* Initialize the printer. */
- /* CAN; 72x72; left margin = 001; disable skip over perforation */
- fwrite("\030\034\033%C001\033%S0", 1, 12, prn_stream);
-
- if (highRes) {
- fwrite("\033R", 1, 2, prn_stream);
- bits_per_column = 14;
- }
-
- /* Transfer pixels to printer */
- while ( lnum < pdev->height ) {
-
- /* Copy 1 scan line and test for all zero. */
- code = gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
- if ( code < 0 )
- goto xit;
-
- /* if line is all zero, skip */
- if ( in[0] == 0 && !memcmp((char *)in, (char *)in + 1,
- line_size - 1)) {
- lnum++;
- if (highRes)
- skip++;
- else
- skip += 2;
- continue;
- }
-
- /* use fine line feed to get to the appropriate position. */
- while ( skip > 127 ) {
- fputs("\033%5\177", prn_stream);
- skip -= 127;
- }
- if ( skip )
- fprintf(prn_stream, "\033%%5%c",
- (char) (skip & 0xff));
- skip = 0;
-
- /* get the rest of the scan lines */
- code = gdev_prn_copy_scan_lines(pdev, lnum + 1,
- in + line_size, (bits_per_column - 1) * line_size);
-
- if ( code < 0 )
- goto xit;
-
- lcnt = code + 1; /* since we already grabbed one line */
-
- if ( lcnt < bits_per_column )
- memset(in + lcnt * line_size, 0,
- (bits_per_column - lcnt) * line_size);
-
- if (highRes) {
- oki_transpose(in, out1, pdev->width, 2 * line_size);
- oki_transpose(in + line_size, out2,
- pdev->width, 2 * line_size);
- } else
- oki_transpose(in, out1, pdev->width, line_size);
-
- out3 = oki_compress(out1, pdev->width, highRes,
- &spaces, &width);
-
- for (i=0; i < spaces; i++)
- putc(' ', prn_stream);
-
- fwrite("\003", 1, 1, prn_stream);
- fwrite(out3, 1, width, prn_stream);
-
- if (highRes) {
- /* exit graphics; carriage return; 1 bit line feed */
- fprintf(prn_stream, "\003\002\015\033%%5%c", (char) 1);
- out3 = oki_compress(out2, pdev->width, highRes,
- &spaces, &width);
- for (i=0; i < spaces; i++)
- putc(' ', prn_stream);
- fwrite("\003", 1, 1, prn_stream);
- fwrite(out3, 1, width, prn_stream);
- fprintf(prn_stream, "\003\002\015\033%%5%c", (char) 13);
- } else
- fwrite("\003\016\003\002", 1, 4, prn_stream);
-
- lnum += bits_per_column;
- }
-
- /* Eject the page */
+ int highRes = pdev->y_pixels_per_inch > 100;
+ int bits_per_column = 7;
+ int i, spaces, width;
+ int lcnt;
+
+ int line_size = gdev_prn_raster((gx_device_printer *)pdev);
+
+ byte *in = (byte *)gs_malloc(pdev->memory, 16, line_size, "oki_print_page(in)");
+
+ byte *out1 = (byte *)gs_malloc(pdev->memory, 8, line_size, "oki_print_page(out1)");
+ byte *out2 = (byte *)gs_malloc(pdev->memory, 8, line_size, "oki_print_page(out2)");
+
+ byte *out3;
+
+ int lnum = 0;
+ int skip = 0;
+ int code = 0;
+
+ if ( in == 0 || out1 == 0 || out2 == 0)
+ { code = gs_error_VMerror;
+ gs_note_error(code);
+ goto bail;
+ }
+
+ /* Initialize the printer. */
+ /* CAN; 72x72; left margin = 001; disable skip over perforation */
+ fwrite("\030\034\033%C001\033%S0", 1, 12, prn_stream);
+
+ if (highRes) {
+ fwrite("\033R", 1, 2, prn_stream);
+ bits_per_column = 14;
+ }
+
+ /* Transfer pixels to printer */
+ while ( lnum < pdev->height ) {
+
+ /* Copy 1 scan line and test for all zero. */
+ code = gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
+ if ( code < 0 )
+ goto xit;
+
+ /* if line is all zero, skip */
+ if ( in[0] == 0 && !memcmp((char *)in, (char *)in + 1,
+ line_size - 1)) {
+ lnum++;
+ if (highRes)
+ skip++;
+ else
+ skip += 2;
+ continue;
+ }
+
+ /* use fine line feed to get to the appropriate position. */
+ while ( skip > 127 ) {
+ fputs("\033%5\177", prn_stream);
+ skip -= 127;
+ }
+ if ( skip )
+ fprintf(prn_stream, "\033%%5%c",
+ (char) (skip & 0xff));
+ skip = 0;
+
+ /* get the rest of the scan lines */
+ code = gdev_prn_copy_scan_lines(pdev, lnum + 1,
+ in + line_size, (bits_per_column - 1) * line_size);
+
+ if ( code < 0 )
+ goto xit;
+
+ lcnt = code + 1; /* since we already grabbed one line */
+
+ if ( lcnt < bits_per_column )
+ memset(in + lcnt * line_size, 0,
+ (bits_per_column - lcnt) * line_size);
+
+ if (highRes) {
+ oki_transpose(in, out1, pdev->width, 2 * line_size);
+ oki_transpose(in + line_size, out2,
+ pdev->width, 2 * line_size);
+ } else
+ oki_transpose(in, out1, pdev->width, line_size);
+
+ out3 = oki_compress(out1, pdev->width, highRes,
+ &spaces, &width);
+
+ for (i=0; i < spaces; i++)
+ putc(' ', prn_stream);
+
+ fwrite("\003", 1, 1, prn_stream);
+ fwrite(out3, 1, width, prn_stream);
+
+ if (highRes) {
+ /* exit graphics; carriage return; 1 bit line feed */
+ fprintf(prn_stream, "\003\002\015\033%%5%c", (char) 1);
+ out3 = oki_compress(out2, pdev->width, highRes,
+ &spaces, &width);
+ for (i=0; i < spaces; i++)
+ putc(' ', prn_stream);
+ fwrite("\003", 1, 1, prn_stream);
+ fwrite(out3, 1, width, prn_stream);
+ fprintf(prn_stream, "\003\002\015\033%%5%c", (char) 13);
+ } else
+ fwrite("\003\016\003\002", 1, 4, prn_stream);
+
+ lnum += bits_per_column;
+ }
+
+ /* Eject the page */
xit:
- fputc(014, prn_stream); /* form feed */
- fflush(prn_stream);
+ fputc(014, prn_stream); /* form feed */
+ fflush(prn_stream);
bail:
- if ( out1 != 0 )
- gs_free(pdev->memory, (char *)out1, 8, line_size, "oki_print_page(out1)");
+ if ( out1 != 0 )
+ gs_free(pdev->memory, (char *)out1, 8, line_size, "oki_print_page(out1)");
- if ( out2 != 0 )
- gs_free(pdev->memory, (char *)out2, 8, line_size, "oki_print_page(out2)");
+ if ( out2 != 0 )
+ gs_free(pdev->memory, (char *)out2, 8, line_size, "oki_print_page(out2)");
- if ( in != 0 )
- gs_free(pdev->memory, (char *)in, 16, line_size, "oki_print_page(in)");
+ if ( in != 0 )
+ gs_free(pdev->memory, (char *)in, 16, line_size, "oki_print_page(in)");
- return code;
+ return code;
}
diff --git a/gs/base/gdevokii.c b/gs/base/gdevokii.c
index eb4360e7a..66d2e136f 100644
--- a/gs/base/gdevokii.c
+++ b/gs/base/gdevokii.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@
* The simple minded accounting used here keep track of when the
* page actually advances assumes the printer starts in a "power on"
* state.
- *
+ *
* Supported resolutions are:
*
* 60x72 60x144
@@ -73,10 +73,10 @@ static dev_proc_print_page(okiibm_print_page);
/* Okidata IBM device */
const gx_device_printer far_data gs_okiibm_device =
prn_device(prn_std_procs, "okiibm",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.25, 0.0, 0.25, 0.0, /* margins */
- 1, okiibm_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.25, 0.0, 0.25, 0.0, /* margins */
+ 1, okiibm_print_page);
/* ------ Internal routines ------ */
@@ -88,165 +88,165 @@ static int
okiibm_print_page1(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
const char *init_string, int init_length,
const char *end_string, int end_length)
-{
- static const char graphics_modes_9[5] =
- {
- -1, 0 /*60*/, 1 /*120*/, -1, 3 /*240*/
- };
-
- int in_y_mult = (y_9pin_high ? 2 : 1);
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- /* Note that in_size is a multiple of 8. */
- int in_size = line_size * (8 * in_y_mult);
- byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "okiibm_print_page(buf1)");
- byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "okiibm_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
- int out_y_mult = 1;
- int x_dpi = pdev->x_pixels_per_inch;
- char start_graphics = graphics_modes_9[x_dpi / 60];
- int first_pass = (start_graphics == 3 ? 1 : 0);
- int last_pass = first_pass * 2;
- int y_passes = (y_9pin_high ? 2 : 1);
- int skip = 0, lnum = 0, pass, ypass;
- int y_step = 0;
-
- /* Check allocations */
- if ( buf1 == 0 || buf2 == 0 )
- { if ( buf1 )
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "okiibm_print_page(buf1)");
- if ( buf2 )
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "okiibm_print_page(buf2)");
- return_error(gs_error_VMerror);
- }
-
- /* Initialize the printer. */
- fwrite(init_string, 1, init_length, prn_stream);
-
- /* Print lines of graphics */
- while ( lnum < pdev->height )
- {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *out_end;
- int lcnt;
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if ( in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
- )
- {
- lnum++;
- skip += 2 / in_y_mult;
- continue;
- }
-
- /*
- * Vertical tab to the appropriate position.
- * The skip count is in 1/144" steps. If total
- * vertical request is not a multiple od 1/72"
- * we need to make sure the page is actually
- * going to advance.
- */
- if ( skip & 1 )
- {
- int n = 1 + (y_step == 0 ? 1 : 0);
- fprintf(prn_stream, "\033J%c", n);
- y_step = (y_step + n) % 3;
- skip -= 1;
- }
- skip = skip / 2 * 3;
- while ( skip > 255 )
- {
- fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if ( skip )
- {
- fprintf(prn_stream, "\033J%c", skip);
- }
-
- /* Copy the the scan lines. */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if ( lcnt < 8 * in_y_mult )
- { /* Pad with lines of zeros. */
- memset(in + lcnt * line_size, 0,
- in_size - lcnt * line_size);
- }
-
- if ( y_9pin_high )
- { /* Shuffle the scan lines */
- byte *p;
- int i;
- static const char index[] =
- { 0, 2, 4, 6, 8, 10, 12, 14,
- 1, 3, 5, 7, 9, 11, 13, 15
- };
- for ( i = 0; i < 16; i++ )
- {
- memcpy( out + (i * line_size),
- in + (index[i] * line_size),
- line_size);
- }
- p = in;
- in = out;
- out = p;
- }
-
- for ( ypass = 0; ypass < y_passes; ypass++ )
- {
- for ( pass = first_pass; pass <= last_pass; pass++ )
- {
- /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
- /* because that's how the printer wants the data. */
-
- if ( pass == first_pass )
- {
- out_end = out;
- inp = in;
- in_end = inp + line_size;
-
- for ( ; inp < in_end; inp++, out_end += 8 )
- {
- gdev_prn_transpose_8x8(inp + (ypass * 8 * line_size),
- line_size, out_end, 1);
- }
- /* Remove trailing 0s. */
- while ( out_end > out && out_end[-1] == 0 )
- {
- out_end--;
- }
- }
-
- /* Transfer whatever is left and print. */
- if ( out_end > out )
- {
- okiibm_output_run(out, (int)(out_end - out),
- out_y_mult, start_graphics,
- prn_stream, pass);
- }
- fputc('\r', prn_stream);
- }
- if ( ypass < y_passes - 1 )
- {
- int n = 1 + (y_step == 0 ? 1 : 0);
- fprintf(prn_stream, "\033J%c", n);
- y_step = (y_step + n) % 3;
- }
- }
- skip = 16 - y_passes + 1; /* no skip on last Y pass */
- lnum += 8 * in_y_mult;
- }
-
- /* Reinitialize the printer. */
- fwrite(end_string, 1, end_length, prn_stream);
- fflush(prn_stream);
-
- gs_free(pdev->memory, (char *)buf2, in_size, 1, "okiibm_print_page(buf2)");
- gs_free(pdev->memory, (char *)buf1, in_size, 1, "okiibm_print_page(buf1)");
- return 0;
+{
+ static const char graphics_modes_9[5] =
+ {
+ -1, 0 /*60*/, 1 /*120*/, -1, 3 /*240*/
+ };
+
+ int in_y_mult = (y_9pin_high ? 2 : 1);
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* Note that in_size is a multiple of 8. */
+ int in_size = line_size * (8 * in_y_mult);
+ byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "okiibm_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "okiibm_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
+ int out_y_mult = 1;
+ int x_dpi = pdev->x_pixels_per_inch;
+ char start_graphics = graphics_modes_9[x_dpi / 60];
+ int first_pass = (start_graphics == 3 ? 1 : 0);
+ int last_pass = first_pass * 2;
+ int y_passes = (y_9pin_high ? 2 : 1);
+ int skip = 0, lnum = 0, pass, ypass;
+ int y_step = 0;
+
+ /* Check allocations */
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "okiibm_print_page(buf1)");
+ if ( buf2 )
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "okiibm_print_page(buf2)");
+ return_error(gs_error_VMerror);
+ }
+
+ /* Initialize the printer. */
+ fwrite(init_string, 1, init_length, prn_stream);
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ int lcnt;
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
+ )
+ {
+ lnum++;
+ skip += 2 / in_y_mult;
+ continue;
+ }
+
+ /*
+ * Vertical tab to the appropriate position.
+ * The skip count is in 1/144" steps. If total
+ * vertical request is not a multiple od 1/72"
+ * we need to make sure the page is actually
+ * going to advance.
+ */
+ if ( skip & 1 )
+ {
+ int n = 1 + (y_step == 0 ? 1 : 0);
+ fprintf(prn_stream, "\033J%c", n);
+ y_step = (y_step + n) % 3;
+ skip -= 1;
+ }
+ skip = skip / 2 * 3;
+ while ( skip > 255 )
+ {
+ fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ {
+ fprintf(prn_stream, "\033J%c", skip);
+ }
+
+ /* Copy the the scan lines. */
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ if ( lcnt < 8 * in_y_mult )
+ { /* Pad with lines of zeros. */
+ memset(in + lcnt * line_size, 0,
+ in_size - lcnt * line_size);
+ }
+
+ if ( y_9pin_high )
+ { /* Shuffle the scan lines */
+ byte *p;
+ int i;
+ static const char index[] =
+ { 0, 2, 4, 6, 8, 10, 12, 14,
+ 1, 3, 5, 7, 9, 11, 13, 15
+ };
+ for ( i = 0; i < 16; i++ )
+ {
+ memcpy( out + (i * line_size),
+ in + (index[i] * line_size),
+ line_size);
+ }
+ p = in;
+ in = out;
+ out = p;
+ }
+
+ for ( ypass = 0; ypass < y_passes; ypass++ )
+ {
+ for ( pass = first_pass; pass <= last_pass; pass++ )
+ {
+ /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
+ /* because that's how the printer wants the data. */
+
+ if ( pass == first_pass )
+ {
+ out_end = out;
+ inp = in;
+ in_end = inp + line_size;
+
+ for ( ; inp < in_end; inp++, out_end += 8 )
+ {
+ gdev_prn_transpose_8x8(inp + (ypass * 8 * line_size),
+ line_size, out_end, 1);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 )
+ {
+ out_end--;
+ }
+ }
+
+ /* Transfer whatever is left and print. */
+ if ( out_end > out )
+ {
+ okiibm_output_run(out, (int)(out_end - out),
+ out_y_mult, start_graphics,
+ prn_stream, pass);
+ }
+ fputc('\r', prn_stream);
+ }
+ if ( ypass < y_passes - 1 )
+ {
+ int n = 1 + (y_step == 0 ? 1 : 0);
+ fprintf(prn_stream, "\033J%c", n);
+ y_step = (y_step + n) % 3;
+ }
+ }
+ skip = 16 - y_passes + 1; /* no skip on last Y pass */
+ lnum += 8 * in_y_mult;
+ }
+
+ /* Reinitialize the printer. */
+ fwrite(end_string, 1, end_length, prn_stream);
+ fflush(prn_stream);
+
+ gs_free(pdev->memory, (char *)buf2, in_size, 1, "okiibm_print_page(buf2)");
+ gs_free(pdev->memory, (char *)buf1, in_size, 1, "okiibm_print_page(buf1)");
+ return 0;
}
/* Output a single graphics command. */
@@ -254,32 +254,32 @@ okiibm_print_page1(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
static void
okiibm_output_run(byte *data, int count, int y_mult,
char start_graphics, FILE *prn_stream, int pass)
-{
- int xcount = count / y_mult;
-
- fputc(033, prn_stream);
- fputc((int)("KLYZ"[start_graphics]), prn_stream);
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- if ( !pass )
- {
- fwrite(data, 1, count, prn_stream);
- }
- else
- {
- /* Only write every other column of y_mult bytes. */
- int which = pass;
- register byte *dp = data;
- register int i, j;
-
- for ( i = 0; i < xcount; i++, which++ )
- {
- for ( j = 0; j < y_mult; j++, dp++ )
- {
- putc(((which & 1) ? *dp : 0), prn_stream);
- }
- }
- }
+{
+ int xcount = count / y_mult;
+
+ fputc(033, prn_stream);
+ fputc((int)("KLYZ"[start_graphics]), prn_stream);
+ fputc(xcount & 0xff, prn_stream);
+ fputc(xcount >> 8, prn_stream);
+ if ( !pass )
+ {
+ fwrite(data, 1, count, prn_stream);
+ }
+ else
+ {
+ /* Only write every other column of y_mult bytes. */
+ int which = pass;
+ register byte *dp = data;
+ register int i, j;
+
+ for ( i = 0; i < xcount; i++, which++ )
+ {
+ for ( j = 0; j < y_mult; j++, dp++ )
+ {
+ putc(((which & 1) ? *dp : 0), prn_stream);
+ }
+ }
+ }
}
/* The print_page procedures are here, to avoid a forward reference. */
@@ -292,30 +292,30 @@ static const char okiibm_two_direct[] = { 0x1b, 0x55, 0x00 };
static int
okiibm_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- char init_string[16], end_string[16];
- int init_length, end_length;
-
- init_length = sizeof(okiibm_init_string);
- memcpy(init_string, okiibm_init_string, init_length);
-
- end_length = sizeof(okiibm_end_string);
- memcpy(end_string, okiibm_end_string, end_length);
-
- if ( pdev->y_pixels_per_inch > 72 &&
- pdev->x_pixels_per_inch > 60 )
- {
- /* Unidirectional printing for the higher resolutions. */
- memcpy( init_string + init_length, okiibm_one_direct,
- sizeof(okiibm_one_direct) );
- init_length += sizeof(okiibm_one_direct);
-
- memcpy( end_string + end_length, okiibm_two_direct,
- sizeof(okiibm_two_direct) );
- end_length += sizeof(okiibm_two_direct);
- }
-
- return okiibm_print_page1( pdev, prn_stream,
- pdev->y_pixels_per_inch > 72 ? 1 : 0,
- init_string, init_length,
- end_string, end_length );
+ char init_string[16], end_string[16];
+ int init_length, end_length;
+
+ init_length = sizeof(okiibm_init_string);
+ memcpy(init_string, okiibm_init_string, init_length);
+
+ end_length = sizeof(okiibm_end_string);
+ memcpy(end_string, okiibm_end_string, end_length);
+
+ if ( pdev->y_pixels_per_inch > 72 &&
+ pdev->x_pixels_per_inch > 60 )
+ {
+ /* Unidirectional printing for the higher resolutions. */
+ memcpy( init_string + init_length, okiibm_one_direct,
+ sizeof(okiibm_one_direct) );
+ init_length += sizeof(okiibm_one_direct);
+
+ memcpy( end_string + end_length, okiibm_two_direct,
+ sizeof(okiibm_two_direct) );
+ end_length += sizeof(okiibm_two_direct);
+ }
+
+ return okiibm_print_page1( pdev, prn_stream,
+ pdev->y_pixels_per_inch > 72 ? 1 : 0,
+ init_string, init_length,
+ end_string, end_length );
}
diff --git a/gs/base/gdevos2p.c b/gs/base/gdevos2p.c
index c54670fc2..016eb422f 100644
--- a/gs/base/gdevos2p.c
+++ b/gs/base/gdevos2p.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -83,9 +83,8 @@ int os2prn_get_printer(OS2QL * ql);
static gx_device_procs os2prn_procs =
prn_color_params_procs(os2prn_open, gdev_prn_output_page, os2prn_close,
- os2prn_map_rgb_color, os2prn_map_color_rgb,
- os2prn_get_params, os2prn_put_params);
-
+ os2prn_map_rgb_color, os2prn_map_color_rgb,
+ os2prn_get_params, os2prn_put_params);
/* The device descriptor */
struct gx_device_os2prn_s {
@@ -105,9 +104,9 @@ struct gx_device_os2prn_s {
gx_device_os2prn far_data gs_os2prn_device =
{
prn_device_std_body(gx_device_os2prn, os2prn_procs, "os2prn",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72, 72,
- 0, 0, 0, 0,
- 0, os2prn_print_page), /* depth = 0 */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72, 72,
+ 0, 0, 0, 0,
+ 0, os2prn_print_page), /* depth = 0 */
0, /* hab */
0, /* hdc */
0, /* hps */
@@ -143,69 +142,69 @@ os2prn_open(gx_device * dev)
oprn = opdev;
if (DosGetInfoBlocks(&pptib, &pppib)) {
- errprintf(dev->memory, "\nos2prn_open: Couldn't get pid\n");
- return gs_error_limitcheck;
+ errprintf(dev->memory, "\nos2prn_open: Couldn't get pid\n");
+ return gs_error_limitcheck;
}
if (pppib->pib_ultype != 3) {
- /* if caller is not PM app */
- errprintf(dev->memory, "os2prn device can only be used from a PM application\n");
- return gs_error_limitcheck;
+ /* if caller is not PM app */
+ errprintf(dev->memory, "os2prn device can only be used from a PM application\n");
+ return gs_error_limitcheck;
}
opdev->hab = WinQueryAnchorBlock(hwndtext);
opdev->newframe = 0;
if (os2prn_get_queue_list(dev->memory, &opdev->ql))
- return gs_error_limitcheck;
+ return gs_error_limitcheck;
if (opdev->queue_name[0] == '\0') {
- /* obtain printer name from filename */
- p = opdev->fname;
- for (i = 0; i < 8; i++) {
- if (prefix[i] == '\\') {
- if ((*p != '\\') && (*p != '/'))
- break;
- } else if (tolower(*p) != prefix[i])
- break;
- p++;
- }
- if (i == 8 && (strlen(p) != 0))
- strcpy(opdev->queue_name, p);
+ /* obtain printer name from filename */
+ p = opdev->fname;
+ for (i = 0; i < 8; i++) {
+ if (prefix[i] == '\\') {
+ if ((*p != '\\') && (*p != '/'))
+ break;
+ } else if (tolower(*p) != prefix[i])
+ break;
+ p++;
+ }
+ if (i == 8 && (strlen(p) != 0))
+ strcpy(opdev->queue_name, p);
}
pprq = NULL;
if (opdev->queue_name[0] != '\0') {
- for (i = 0; i < opdev->ql.nqueues; i++) {
- if (strcmp(opdev->ql.prq[i].pszName, opdev->queue_name) == 0) {
- pprq = &(opdev->ql.prq[i]);
- break;
- }
- }
+ for (i = 0; i < opdev->ql.nqueues; i++) {
+ if (strcmp(opdev->ql.prq[i].pszName, opdev->queue_name) == 0) {
+ pprq = &(opdev->ql.prq[i]);
+ break;
+ }
+ }
} else {
- /* use default queue */
- pprq = &(opdev->ql.prq[opdev->ql.defqueue]);
+ /* use default queue */
+ pprq = &(opdev->ql.prq[opdev->ql.defqueue]);
}
if (pprq == (PRQINFO3 *) NULL) {
- errprintf(opdev->memory, "Invalid os2prn queue name -sOS2QUEUE=\042%s\042\n", opdev->queue_name);
- errprintf(opdev->memory, "Valid device names are:\n");
- for (i = 0; i < opdev->ql.nqueues; i++) {
- errprintf(opdev->memory, " -sOS2QUEUE=\042%s\042\n", opdev->ql.prq[i].pszName);
- }
- return gs_error_rangecheck;
+ errprintf(opdev->memory, "Invalid os2prn queue name -sOS2QUEUE=\042%s\042\n", opdev->queue_name);
+ errprintf(opdev->memory, "Valid device names are:\n");
+ for (i = 0; i < opdev->ql.nqueues; i++) {
+ errprintf(opdev->memory, " -sOS2QUEUE=\042%s\042\n", opdev->ql.prq[i].pszName);
+ }
+ return gs_error_rangecheck;
}
/* open printer device */
memset(&dop, 0, sizeof(dop));
dop.pszLogAddress = pprq->pszName; /* queue name */
p = strchr(pprq->pszDriverName, '.');
if (p != (char *)NULL)
- *p = '\0';
+ *p = '\0';
dop.pszDriverName = pprq->pszDriverName;
dop.pszDataType = "PM_Q_STD";
dop.pdriv = pprq->pDriverData;
opdev->hdc = DevOpenDC(opdev->hab, OD_QUEUED, "*", 9L, (PDEVOPENDATA) & dop, (HDC) NULL);
if (opdev->hdc == DEV_ERROR) {
- ERRORID eid = WinGetLastError(opdev->hab);
+ ERRORID eid = WinGetLastError(opdev->hab);
- errprintf(opdev->memory, "DevOpenDC for printer error 0x%x\n", eid);
- return gs_error_limitcheck;
+ errprintf(opdev->memory, "DevOpenDC for printer error 0x%x\n", eid);
+ return gs_error_limitcheck;
}
os2prn_free_queue_list(dev->memory, &opdev->ql);
@@ -219,9 +218,9 @@ os2prn_open(gx_device * dev)
/* these are returned in millimetres */
nforms = DevQueryHardcopyCaps(opdev->hdc, 0, 0, &hcinfo);
for (i = 0; i < nforms; i++) {
- DevQueryHardcopyCaps(opdev->hdc, i, 1, &hcinfo);
- if (hcinfo.flAttributes & HCAPS_CURRENT)
- break; /* this is the default page size */
+ DevQueryHardcopyCaps(opdev->hdc, i, 1, &hcinfo);
+ if (hcinfo.flAttributes & HCAPS_CURRENT)
+ break; /* this is the default page size */
}
/* GS size is in pixels */
dev->width = hcinfo.cx * caps[0] / 1000;
@@ -242,50 +241,50 @@ os2prn_open(gx_device * dev)
sizlPage.cx = dev->width;
sizlPage.cy = dev->height;
opdev->hps = GpiCreatePS(opdev->hab, opdev->hdc, &sizlPage,
- PU_PELS | GPIF_DEFAULT | GPIT_NORMAL | GPIA_ASSOC);
+ PU_PELS | GPIF_DEFAULT | GPIT_NORMAL | GPIA_ASSOC);
depth = dev->color_info.depth;
if (depth == 0) {
- /* Set parameters that were unknown before opening device */
- /* Find out if the device supports color */
- /* We recognize 1 bit monochrome and 24 bit color devices */
- DevQueryCaps(opdev->hdc, CAPS_COLOR_PLANES, 2, caps);
- /* caps[0] is #color planes, caps[1] is #bits per plane */
- depth = caps[0] * caps[1];
- if (depth > 1)
- depth = 24;
+ /* Set parameters that were unknown before opening device */
+ /* Find out if the device supports color */
+ /* We recognize 1 bit monochrome and 24 bit color devices */
+ DevQueryCaps(opdev->hdc, CAPS_COLOR_PLANES, 2, caps);
+ /* caps[0] is #color planes, caps[1] is #bits per plane */
+ depth = caps[0] * caps[1];
+ if (depth > 1)
+ depth = 24;
}
os2prn_set_bpp(dev, depth);
/* create a memory DC compatible with printer */
opdev->hdcMem = DevOpenDC(opdev->hab, OD_MEMORY, "*", 0L, NULL, opdev->hdc);
if (opdev->hdcMem == DEV_ERROR) {
- ERRORID eid = WinGetLastError(opdev->hab);
+ ERRORID eid = WinGetLastError(opdev->hab);
- errprintf(opdev->memory, "DevOpenDC for memory error 0x%x\n", eid);
- return gs_error_limitcheck;
+ errprintf(opdev->memory, "DevOpenDC for memory error 0x%x\n", eid);
+ return gs_error_limitcheck;
}
sizlPage.cx = dev->width;
sizlPage.cy = dev->height;
opdev->hpsMem = GpiCreatePS(opdev->hab, opdev->hdcMem, &sizlPage,
- PU_PELS | GPIF_DEFAULT | GPIT_NORMAL | GPIA_ASSOC);
+ PU_PELS | GPIF_DEFAULT | GPIT_NORMAL | GPIA_ASSOC);
if (opdev->hpsMem == GPI_ERROR) {
- ERRORID eid = WinGetLastError(opdev->hab);
+ ERRORID eid = WinGetLastError(opdev->hab);
- errprintf(opdev->memory, "GpiCreatePS for memory error 0x%x\n", eid);
- return gs_error_limitcheck;
+ errprintf(opdev->memory, "GpiCreatePS for memory error 0x%x\n", eid);
+ return gs_error_limitcheck;
}
if (DevEscape(opdev->hdc, DEVESC_STARTDOC, (LONG) strlen(gs_product),
- (char *)gs_product, NULL, NULL) == DEVESC_ERROR) {
- ERRORID eid = WinGetLastError(opdev->hab);
+ (char *)gs_product, NULL, NULL) == DEVESC_ERROR) {
+ ERRORID eid = WinGetLastError(opdev->hab);
- errprintf(opdev->memory, "DEVESC_STARTDOC error 0x%x\n", eid);
- return gs_error_limitcheck;
+ errprintf(opdev->memory, "DEVESC_STARTDOC error 0x%x\n", eid);
+ return gs_error_limitcheck;
}
/* gdev_prn_open opens a temporary file which we don't want */
/* so we specify the name now so we can delete it later */
pfile = gp_open_scratch_file(opdev->memory, gp_scratch_file_name_prefix,
- opdev->fname, "wb");
+ opdev->fname, "wb");
fclose(pfile);
code = gdev_prn_open(dev);
@@ -308,9 +307,9 @@ os2prn_close(gx_device * dev)
DevCloseDC(opdev->hdc);
if (opdev->hpsMem != GPI_ERROR)
- GpiDestroyPS(opdev->hpsMem);
+ GpiDestroyPS(opdev->hpsMem);
if (opdev->hdcMem != DEV_ERROR)
- DevCloseDC(opdev->hdcMem);
+ DevCloseDC(opdev->hdcMem);
code = gdev_prn_close(dev);
/* delete unwanted temporary file */
@@ -326,14 +325,12 @@ os2prn_get_params(gx_device * dev, gs_param_list * plist)
gs_param_string qs;
qs.data = opdev->queue_name, qs.size = strlen(qs.data),
- qs.persistent = false;
+ qs.persistent = false;
code < 0 ||
- (code = param_write_string(plist, "OS2QUEUE", &qs)) < 0;
+ (code = param_write_string(plist, "OS2QUEUE", &qs)) < 0;
return code;
}
-
-
/* We implement this ourselves so that we can change BitsPerPixel */
/* before the device is opened */
int
@@ -346,56 +343,54 @@ os2prn_put_params(gx_device * dev, gs_param_list * plist)
/* Handle extra parameters */
switch (code = param_read_string(plist, "OS2QUEUE", &qs)) {
- case 0:
- if (qs.size == strlen(opdev->queue_name) &&
- !memcmp(opdev->queue_name, qs.data, qs.size)
- ) {
- qs.data = 0;
- break;
- }
- if (dev->is_open)
- ecode = gs_error_rangecheck;
- else if (qs.size >= sizeof(opdev->queue_name))
- ecode = gs_error_limitcheck;
- else
- break;
- goto qe;
- default:
- ecode = code;
- qe:param_signal_error(plist, "OS2QUEUE", ecode);
- case 1:
- qs.data = 0;
- break;
+ case 0:
+ if (qs.size == strlen(opdev->queue_name) &&
+ !memcmp(opdev->queue_name, qs.data, qs.size)
+ ) {
+ qs.data = 0;
+ break;
+ }
+ if (dev->is_open)
+ ecode = gs_error_rangecheck;
+ else if (qs.size >= sizeof(opdev->queue_name))
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto qe;
+ default:
+ ecode = code;
+ qe:param_signal_error(plist, "OS2QUEUE", ecode);
+ case 1:
+ qs.data = 0;
+ break;
}
switch (code = param_read_int(plist, "BitsPerPixel", &bpp)) {
- case 0:
- if (dev->is_open)
- ecode = gs_error_rangecheck;
- else { /* change dev->color_info is valid before device is opened */
- os2prn_set_bpp(dev, bpp);
- break;
- }
- goto bppe;
- default:
- ecode = code;
- bppe:param_signal_error(plist, "BitsPerPixel", ecode);
- case 1:
- break;
+ case 0:
+ if (dev->is_open)
+ ecode = gs_error_rangecheck;
+ else { /* change dev->color_info is valid before device is opened */
+ os2prn_set_bpp(dev, bpp);
+ break;
+ }
+ goto bppe;
+ default:
+ ecode = code;
+ bppe:param_signal_error(plist, "BitsPerPixel", ecode);
+ case 1:
+ break;
}
if (ecode >= 0)
- ecode = gdev_prn_put_params(dev, plist);
+ ecode = gdev_prn_put_params(dev, plist);
if ((ecode >= 0) && (qs.data != 0)) {
- memcpy(opdev->queue_name, qs.data, qs.size);
- opdev->queue_name[qs.size] = 0;
+ memcpy(opdev->queue_name, qs.data, qs.size);
+ opdev->queue_name[qs.size] = 0;
}
return ecode;
}
-
-
/* ------ Internal routines ------ */
#undef opdev
@@ -403,10 +398,8 @@ os2prn_put_params(gx_device * dev, gs_param_list * plist)
/************************************************/
-
/* ------ Private definitions ------ */
-
/* new os2prn_print_page routine */
/* Write BMP header to memory, then send bitmap to printer */
@@ -433,18 +426,18 @@ os2prn_print_page(gx_device_printer * pdev, FILE * file)
int yslice;
struct bmi_s {
- BITMAPINFOHEADER2 h;
- RGB2 pal[256];
+ BITMAPINFOHEADER2 h;
+ RGB2 pal[256];
} bmi;
yslice = 65535 / bmp_raster;
bmp_raster_multi = bmp_raster * yslice;
row = (byte *) gs_malloc(pdev->memory, bmp_raster_multi, 1, "bmp file buffer");
if (row == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (opdev->newframe)
- DevEscape(opdev->hdc, DEVESC_NEWFRAME, 0L, NULL, NULL, NULL);
+ DevEscape(opdev->hdc, DEVESC_NEWFRAME, 0L, NULL, NULL, NULL);
opdev->newframe = 1;
/* Write the info header. */
@@ -460,24 +453,24 @@ os2prn_print_page(gx_device_printer * pdev, FILE * file)
/* Write the palette. */
if (depth <= 8) {
- int i;
- gx_color_value rgb[3];
- PRGB2 pq;
-
- bmi.h.cclrUsed = 1 << depth;
- bmi.h.cclrImportant = 1 << depth;
- for (i = 0; i != 1 << depth; i++) {
- (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
- (gx_color_index) i, rgb);
- pq = &bmi.pal[i];
- pq->bRed = gx_color_value_to_byte(rgb[0]);
- pq->bGreen = gx_color_value_to_byte(rgb[1]);
- pq->bBlue = gx_color_value_to_byte(rgb[2]);
- pq->fcOptions = 0;
- }
+ int i;
+ gx_color_value rgb[3];
+ PRGB2 pq;
+
+ bmi.h.cclrUsed = 1 << depth;
+ bmi.h.cclrImportant = 1 << depth;
+ for (i = 0; i != 1 << depth; i++) {
+ (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
+ (gx_color_index) i, rgb);
+ pq = &bmi.pal[i];
+ pq->bRed = gx_color_value_to_byte(rgb[0]);
+ pq->bGreen = gx_color_value_to_byte(rgb[1]);
+ pq->bBlue = gx_color_value_to_byte(rgb[2]);
+ pq->fcOptions = 0;
+ }
} else {
- bmi.h.cclrUsed = 0;
- bmi.h.cclrImportant = 0;
+ bmi.h.cclrUsed = 0;
+ bmi.h.cclrImportant = 0;
}
/* for GpiDrawBits */
@@ -509,45 +502,45 @@ os2prn_print_page(gx_device_printer * pdev, FILE * file)
yend = opdev->clipbox[1];
y = ystart;
while (y > yend) {
- /* create a bitmap for the memory DC */
- hbmp = GpiCreateBitmap(opdev->hpsMem, &bmi.h, 0L, NULL, NULL);
- if (hbmp == GPI_ERROR)
- goto bmp_done;
- hbmr = GpiSetBitmap(opdev->hpsMem, hbmp);
-
- /* copy slice to memory bitmap */
- if (y > yend + yslice)
- lines = yslice;
- else
- lines = y - yend;
- y -= lines;
- for (i = lines - 1; i >= 0; i--)
- gdev_prn_copy_scan_lines(pdev, ystart - 1 - (y + i), row + (bmp_raster * i), raster);
- apts[0].y = 0; /* target */
- apts[1].y = lines;
- apts[3].y = lines - 1; /* source */
- /* copy DIB bitmap to memory bitmap */
- rc = GpiDrawBits(opdev->hpsMem, row, (BITMAPINFO2 *) & bmi, 4, apts,
- (depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
-
- /* copy slice to printer */
- aptsb[0].y = y;
- aptsb[1].y = y + lines;
- aptsb[3].y = lines;
- rc = GpiBitBlt(opdev->hps, opdev->hpsMem, 4, aptsb, ROP_SRCCOPY, BBO_IGNORE);
-
- /* delete bitmap */
- if (hbmr != HBM_ERROR)
- GpiSetBitmap(opdev->hpsMem, (ULONG) 0);
- hbmr = HBM_ERROR;
- if (hbmp != GPI_ERROR)
- GpiDeleteBitmap(hbmp);
- hbmp = GPI_ERROR;
+ /* create a bitmap for the memory DC */
+ hbmp = GpiCreateBitmap(opdev->hpsMem, &bmi.h, 0L, NULL, NULL);
+ if (hbmp == GPI_ERROR)
+ goto bmp_done;
+ hbmr = GpiSetBitmap(opdev->hpsMem, hbmp);
+
+ /* copy slice to memory bitmap */
+ if (y > yend + yslice)
+ lines = yslice;
+ else
+ lines = y - yend;
+ y -= lines;
+ for (i = lines - 1; i >= 0; i--)
+ gdev_prn_copy_scan_lines(pdev, ystart - 1 - (y + i), row + (bmp_raster * i), raster);
+ apts[0].y = 0; /* target */
+ apts[1].y = lines;
+ apts[3].y = lines - 1; /* source */
+ /* copy DIB bitmap to memory bitmap */
+ rc = GpiDrawBits(opdev->hpsMem, row, (BITMAPINFO2 *) & bmi, 4, apts,
+ (depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
+
+ /* copy slice to printer */
+ aptsb[0].y = y;
+ aptsb[1].y = y + lines;
+ aptsb[3].y = lines;
+ rc = GpiBitBlt(opdev->hps, opdev->hpsMem, 4, aptsb, ROP_SRCCOPY, BBO_IGNORE);
+
+ /* delete bitmap */
+ if (hbmr != HBM_ERROR)
+ GpiSetBitmap(opdev->hpsMem, (ULONG) 0);
+ hbmr = HBM_ERROR;
+ if (hbmp != GPI_ERROR)
+ GpiDeleteBitmap(hbmp);
+ hbmp = GPI_ERROR;
}
bmp_done:
if (row)
- gs_free(pdev->memory, (char *)row, bmp_raster_multi, 1, "bmp file buffer");
+ gs_free(pdev->memory, (char *)row, bmp_raster_multi, 1, "bmp file buffer");
return code;
}
@@ -565,14 +558,14 @@ os2prn_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value g = cv[1];
gx_color_value b = cv[2];
return gx_color_value_to_byte(r) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- ((ulong) gx_color_value_to_byte(b) << 16);
+ ((uint) gx_color_value_to_byte(g) << 8) +
+ ((ulong) gx_color_value_to_byte(b) << 16);
}
/* Decode a color index to a r-g-b color. */
static int
os2prn_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
prgb[2] = gx_color_value_from_byte(color >> 16);
prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
@@ -587,21 +580,21 @@ os2prn_set_bpp(gx_device * dev, int depth)
static const gx_device_color_info os2prn_dci_rgb = dci_std_color(24);
static const gx_device_color_info os2prn_dci_mono = dci_black_and_white;
if (depth == 24) {
- dci = os2prn_dci_rgb;
- dev->procs.get_color_mapping_procs = gx_default_DevRGB_get_color_mapping_procs;
- dev->procs.get_color_comp_index = gx_default_DevRGB_get_color_comp_index;
- dev->procs.map_rgb_color = dev->procs.encode_color =
- os2prn_map_rgb_color;
- dev->procs.map_color_rgb = dev->procs.decode_color =
- os2prn_map_color_rgb;
+ dci = os2prn_dci_rgb;
+ dev->procs.get_color_mapping_procs = gx_default_DevRGB_get_color_mapping_procs;
+ dev->procs.get_color_comp_index = gx_default_DevRGB_get_color_comp_index;
+ dev->procs.map_rgb_color = dev->procs.encode_color =
+ os2prn_map_rgb_color;
+ dev->procs.map_color_rgb = dev->procs.decode_color =
+ os2prn_map_color_rgb;
} else { /* default is black and white */
- dci = os2prn_dci_mono;
- dev->procs.get_color_mapping_procs = gx_default_DevGray_get_color_mapping_procs;
- dev->procs.get_color_comp_index = gx_default_DevGray_get_color_comp_index;
- dev->procs.map_rgb_color = dev->procs.encode_color =
- gx_default_b_w_map_rgb_color;
- dev->procs.map_color_rgb = dev->procs.decode_color =
- gx_default_b_w_map_color_rgb;
+ dci = os2prn_dci_mono;
+ dev->procs.get_color_mapping_procs = gx_default_DevGray_get_color_mapping_procs;
+ dev->procs.get_color_comp_index = gx_default_DevGray_get_color_comp_index;
+ dev->procs.map_rgb_color = dev->procs.encode_color =
+ gx_default_b_w_map_rgb_color;
+ dev->procs.map_color_rgb = dev->procs.decode_color =
+ gx_default_b_w_map_color_rgb;
}
/* restore old anti_alias info */
dci.anti_alias = dev->color_info.anti_alias;
@@ -630,42 +623,41 @@ os2prn_get_queue_list(gs_memory_t *mem, OS2QL * ql)
ulLevel = 3L;
pszComputerName = (PSZ) NULL;
splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, 0L, /* cbBuf */
- &cReturned, &cTotal,
- &cbNeeded, NULL);
+ &cReturned, &cTotal,
+ &cbNeeded, NULL);
if (splerr == ERROR_MORE_DATA || splerr == NERR_BufTooSmall) {
- pBuf = gs_malloc(mem, cbNeeded, 1, "OS/2 printer device info buffer");
- ql->prq = (PRQINFO3 *) pBuf;
- if (ql->prq != (PRQINFO3 *) NULL) {
- ql->len = cbNeeded;
- cbBuf = cbNeeded;
- splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, cbBuf,
- &cReturned, &cTotal,
- &cbNeeded, NULL);
- if (splerr == NO_ERROR) {
- /* Set pointer to point to the beginning of the buffer. */
- prq = (PPRQINFO3) pBuf;
- /* cReturned has the count of the number of PRQINFO3 structures. */
- ql->nqueues = cReturned;
- ql->defqueue = 0;
- for (i = 0; i < cReturned; i++) {
- if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
- ql->defqueue = i;
- prq++;
- } /*endfor cReturned */
- }
- }
+ pBuf = gs_malloc(mem, cbNeeded, 1, "OS/2 printer device info buffer");
+ ql->prq = (PRQINFO3 *) pBuf;
+ if (ql->prq != (PRQINFO3 *) NULL) {
+ ql->len = cbNeeded;
+ cbBuf = cbNeeded;
+ splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, cbBuf,
+ &cReturned, &cTotal,
+ &cbNeeded, NULL);
+ if (splerr == NO_ERROR) {
+ /* Set pointer to point to the beginning of the buffer. */
+ prq = (PPRQINFO3) pBuf;
+ /* cReturned has the count of the number of PRQINFO3 structures. */
+ ql->nqueues = cReturned;
+ ql->defqueue = 0;
+ for (i = 0; i < cReturned; i++) {
+ if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
+ ql->defqueue = i;
+ prq++;
+ } /*endfor cReturned */
+ }
+ }
} else {
- /* If we are here we had a bad error code. Print it and some other info. */
- emprintf4(mem,
+ /* If we are here we had a bad error code. Print it and some other info. */
+ emprintf4(mem,
"SplEnumQueue Error=%ld, Total=%ld, Returned=%ld, Needed=%ld\n",
- splerr, cTotal, cReturned, cbNeeded);
+ splerr, cTotal, cReturned, cbNeeded);
}
if (splerr)
- return splerr;
+ return splerr;
return 0;
}
-
static void
os2prn_free_queue_list(gs_memory_t *mem, OS2QL * ql)
{
diff --git a/gs/base/gdevp14.c b/gs/base/gdevp14.c
index 627bb477c..fcbb74d61 100644
--- a/gs/base/gdevp14.c
+++ b/gs/base/gdevp14.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,15 +67,15 @@ unsigned int clist_band_count = 0;
has transparency */
static int
pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath);
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath);
static pdf14_mask_t *pdf14_mask_element_new(gs_memory_t *memory);
-static void pdf14_free_smask_color(pdf14_device * pdev);
-static int compute_group_device_int_rect(pdf14_device *pdev, gs_int_rect *rect,
+static void pdf14_free_smask_color(pdf14_device * pdev);
+static int compute_group_device_int_rect(pdf14_device *pdev, gs_int_rect *rect,
const gs_rect *pbbox, gs_imager_state *pis);
-static int pdf14_clist_update_params(pdf14_clist_device * pdev,
- const gs_imager_state * pis,
- bool crop_blend_params,
+static int pdf14_clist_update_params(pdf14_clist_device * pdev,
+ const gs_imager_state * pis,
+ bool crop_blend_params,
gs_pdf14trans_params_t *group_params);
/* Functions for dealing with soft mask color */
@@ -99,7 +99,7 @@ static int pdf14_increment_smask_color(gs_imager_state * pis, gx_device * dev);
/* Forward prototypes */
void pdf14_cmyk_cs_to_cmyk_cm(gx_device *, frac, frac, frac, frac, frac *);
int gs_pdf14_device_push(gs_memory_t *, gs_imager_state *, gx_device **,
- gx_device *, const gs_pdf14trans_t *);
+ gx_device *, const gs_pdf14trans_t *);
static int pdf14_tile_pattern_fill(gx_device * pdev,
const gs_imager_state * pis, gx_path * ppath,
const gx_fill_params * params,
@@ -108,15 +108,15 @@ static pdf14_mask_t * pdf14_mask_element_new(gs_memory_t * memory);
/* Buffer stack data structure */
gs_private_st_ptrs5(st_pdf14_buf, pdf14_buf, "pdf14_buf",
- pdf14_buf_enum_ptrs, pdf14_buf_reloc_ptrs,
- saved, data, transfer_fn, mask_stack, parent_color_info_procs);
+ pdf14_buf_enum_ptrs, pdf14_buf_reloc_ptrs,
+ saved, data, transfer_fn, mask_stack, parent_color_info_procs);
gs_private_st_ptrs2(st_pdf14_ctx, pdf14_ctx, "pdf14_ctx",
- pdf14_ctx_enum_ptrs, pdf14_ctx_reloc_ptrs,
- stack, mask_stack);
+ pdf14_ctx_enum_ptrs, pdf14_ctx_reloc_ptrs,
+ stack, mask_stack);
gs_private_st_ptrs1(st_pdf14_clr, pdf14_parent_color_t, "pdf14_clr",
- pdf14_clr_enum_ptrs, pdf14_clr_reloc_ptrs, previous);
+ pdf14_clr_enum_ptrs, pdf14_clr_reloc_ptrs, previous);
gs_private_st_ptrs2(st_pdf14_mask, pdf14_mask_t, "pdf_mask",
pdf14_mask_enum_ptrs, pdf14_mask_reloc_ptrs,
@@ -130,7 +130,6 @@ gs_private_st_ptrs1(st_pdf14_smaskcolor, pdf14_smaskcolor_t, "pdf14_smaskcolor",
pdf14_smaskcolor_enum_ptrs, pdf14_smaskcolor_reloc_ptrs,
profiles);
-
/* ------ The device descriptors ------ */
/*
@@ -184,66 +183,66 @@ static const gx_color_map_procs *
#define pdf14_dev_procs(get_color_mapping_procs, get_color_comp_index, encode_color, decode_color) \
{\
- pdf14_open, /* open */\
- NULL, /* get_initial_matrix */\
- NULL, /* sync_output */\
- pdf14_output_page, /* output_page */\
- pdf14_close, /* close */\
- encode_color, /* rgb_map_rgb_color */\
- decode_color, /* gx_default_rgb_map_color_rgb */\
- pdf14_fill_rectangle, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- pdf14_copy_mono, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- NULL, /* get_params */\
- pdf14_put_params, /* put_params */\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- NULL, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- pdf14_copy_alpha, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- pdf14_fill_path, /* fill_path */\
- pdf14_stroke_path, /* stroke_path */\
- pdf14_fill_mask, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop, */\
- NULL, /* get_clipping_box */\
- pdf14_begin_typed_image, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- pdf14_create_compositor, /* create_compositor */\
- NULL, /* get_hardware_params */\
- pdf14_text_begin, /* text_begin */\
- NULL, /* finish_copydevice */\
- pdf14_begin_transparency_group,\
- pdf14_end_transparency_group,\
- pdf14_begin_transparency_mask,\
- pdf14_end_transparency_mask,\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- get_color_comp_index, /* get_color_comp_index */\
- encode_color, /* encode_color */\
- decode_color, /* decode_color */\
- NULL, /* pattern_manage */\
- NULL, /* fill_rectangle_hl_color */\
- NULL, /* include_color_space */\
- NULL, /* fill_linear_color_scanline */\
- NULL, /* fill_linear_color_trapezoid */\
- NULL, /* fill_linear_color_triangle */\
- gx_forward_update_spot_equivalent_colors, /* update spot */\
+ pdf14_open, /* open */\
+ NULL, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ pdf14_output_page, /* output_page */\
+ pdf14_close, /* close */\
+ encode_color, /* rgb_map_rgb_color */\
+ decode_color, /* gx_default_rgb_map_color_rgb */\
+ pdf14_fill_rectangle, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ pdf14_copy_mono, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ NULL, /* get_params */\
+ pdf14_put_params, /* put_params */\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ NULL, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ pdf14_copy_alpha, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ pdf14_fill_path, /* fill_path */\
+ pdf14_stroke_path, /* stroke_path */\
+ pdf14_fill_mask, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop, */\
+ NULL, /* get_clipping_box */\
+ pdf14_begin_typed_image, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ pdf14_create_compositor, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ pdf14_text_begin, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ pdf14_begin_transparency_group,\
+ pdf14_end_transparency_group,\
+ pdf14_begin_transparency_mask,\
+ pdf14_end_transparency_mask,\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ get_color_comp_index, /* get_color_comp_index */\
+ encode_color, /* encode_color */\
+ decode_color, /* decode_color */\
+ NULL, /* pattern_manage */\
+ NULL, /* fill_rectangle_hl_color */\
+ NULL, /* include_color_space */\
+ NULL, /* fill_linear_color_scanline */\
+ NULL, /* fill_linear_color_trapezoid */\
+ NULL, /* fill_linear_color_triangle */\
+ gx_forward_update_spot_equivalent_colors, /* update spot */\
pdf14_ret_devn_params, /* DevN params */\
NULL, /* fill page */\
pdf14_push_transparency_state, /* push_transparency_state */\
@@ -253,66 +252,64 @@ static const gx_color_map_procs *
}
static const gx_device_procs pdf14_Gray_procs =
- pdf14_dev_procs(gx_default_DevGray_get_color_mapping_procs,
- gx_default_DevGray_get_color_comp_index,
- pdf14_encode_color, pdf14_decode_color);
+ pdf14_dev_procs(gx_default_DevGray_get_color_mapping_procs,
+ gx_default_DevGray_get_color_comp_index,
+ pdf14_encode_color, pdf14_decode_color);
static const gx_device_procs pdf14_RGB_procs =
- pdf14_dev_procs(gx_default_DevRGB_get_color_mapping_procs,
- gx_default_DevRGB_get_color_comp_index,
- pdf14_encode_color, pdf14_decode_color);
+ pdf14_dev_procs(gx_default_DevRGB_get_color_mapping_procs,
+ gx_default_DevRGB_get_color_comp_index,
+ pdf14_encode_color, pdf14_decode_color);
static const gx_device_procs pdf14_CMYK_procs =
- pdf14_dev_procs(gx_default_DevCMYK_get_color_mapping_procs,
- gx_default_DevCMYK_get_color_comp_index,
- pdf14_encode_color, pdf14_decode_color);
+ pdf14_dev_procs(gx_default_DevCMYK_get_color_mapping_procs,
+ gx_default_DevCMYK_get_color_comp_index,
+ pdf14_encode_color, pdf14_decode_color);
#if USE_COMPRESSED_ENCODING
static const gx_device_procs pdf14_CMYKspot_procs =
- pdf14_dev_procs(pdf14_cmykspot_get_color_mapping_procs,
- pdf14_cmykspot_get_color_comp_index,
- pdf14_compressed_encode_color, pdf14_compressed_decode_color);
+ pdf14_dev_procs(pdf14_cmykspot_get_color_mapping_procs,
+ pdf14_cmykspot_get_color_comp_index,
+ pdf14_compressed_encode_color, pdf14_compressed_decode_color);
#else
static const gx_device_procs pdf14_CMYKspot_procs =
- pdf14_dev_procs(pdf14_cmykspot_get_color_mapping_procs,
- pdf14_cmykspot_get_color_comp_index,
- pdf14_encode_color, pdf14_decode_color);
+ pdf14_dev_procs(pdf14_cmykspot_get_color_mapping_procs,
+ pdf14_cmykspot_get_color_comp_index,
+ pdf14_encode_color, pdf14_decode_color);
#endif
static const gx_device_procs pdf14_custom_procs =
- pdf14_dev_procs(gx_forward_get_color_mapping_procs,
- gx_forward_get_color_comp_index,
- gx_forward_encode_color,
- gx_forward_decode_color);
+ pdf14_dev_procs(gx_forward_get_color_mapping_procs,
+ gx_forward_get_color_comp_index,
+ gx_forward_encode_color,
+ gx_forward_decode_color);
gs_private_st_composite_use_final(st_pdf14_device, pdf14_device, "pdf14_device",
- pdf14_device_enum_ptrs, pdf14_device_reloc_ptrs,
- gx_device_finalize);
+ pdf14_device_enum_ptrs, pdf14_device_reloc_ptrs,
+ gx_device_finalize);
static int pdf14_put_image(gx_device * dev, gs_imager_state * pis,
- gx_device * target);
+ gx_device * target);
static int pdf14_cmykspot_put_image(gx_device * dev, gs_imager_state * pis,
- gx_device * target);
+ gx_device * target);
static int pdf14_custom_put_image(gx_device * dev, gs_imager_state * pis,
- gx_device * target);
+ gx_device * target);
/* Used to alter device color mapping procs based upon group or softmask color space */
static int pdf14_update_device_color_procs(gx_device *dev,
- gs_transparency_color_t group_color, int64_t icc_hashcode,
- gs_imager_state *pis, cmm_profile_t *iccprofile);
-
+ gs_transparency_color_t group_color, int64_t icc_hashcode,
+ gs_imager_state *pis, cmm_profile_t *iccprofile);
/* Used to alter device color mapping procs based upon group or softmask color space */
/* Uses color procs stack so that it can be used with clist writer */
static int
pdf14_update_device_color_procs_push_c(gx_device *dev,
- gs_transparency_color_t group_color, int64_t icc_hashcode,
- gs_imager_state *pis, cmm_profile_t *iccprofile);
+ gs_transparency_color_t group_color, int64_t icc_hashcode,
+ gs_imager_state *pis, cmm_profile_t *iccprofile);
static int
pdf14_update_device_color_procs_pop_c(gx_device *dev,gs_imager_state *pis);
-
static void pdf14_push_parent_color(gx_device *dev, const gs_imager_state *pis);
static void pdf14_pop_parent_color(gx_device *dev, const gs_imager_state *pis);
@@ -363,9 +360,9 @@ static const pdf14_nonseparable_blending_procs_t custom_blending_procs = {
const pdf14_device gs_pdf14_Gray_device = {
std_device_std_color_full_body_type(pdf14_device, &pdf14_Gray_procs, "pdf14gray",
- &st_pdf14_device,
- XSIZE, YSIZE, X_DPI, Y_DPI, 8,
- 0, 0, 0, 0, 0, 0),
+ &st_pdf14_device,
+ XSIZE, YSIZE, X_DPI, Y_DPI, 8,
+ 0, 0, 0, 0, 0, 0),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -375,8 +372,8 @@ const pdf14_device gs_pdf14_Gray_device = {
const pdf14_device gs_pdf14_RGB_device = {
std_device_color_stype_body(pdf14_device, &pdf14_RGB_procs, "pdf14RGB",
- &st_pdf14_device,
- XSIZE, YSIZE, X_DPI, Y_DPI, 24, 255, 256),
+ &st_pdf14_device,
+ XSIZE, YSIZE, X_DPI, Y_DPI, 24, 255, 256),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -386,8 +383,8 @@ const pdf14_device gs_pdf14_RGB_device = {
const pdf14_device gs_pdf14_CMYK_device = {
std_device_std_color_full_body_type(pdf14_device, &pdf14_CMYK_procs,
- "pdf14cmyk", &st_pdf14_device, XSIZE, YSIZE, X_DPI, Y_DPI, 32,
- 0, 0, 0, 0, 0, 0),
+ "pdf14cmyk", &st_pdf14_device, XSIZE, YSIZE, X_DPI, Y_DPI, 32,
+ 0, 0, 0, 0, 0, 0),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -396,7 +393,7 @@ const pdf14_device gs_pdf14_CMYK_device = {
};
const pdf14_device gs_pdf14_CMYKspot_device = {
- std_device_part1_(pdf14_device, &pdf14_CMYKspot_procs, "pdf14cmykspot",
+ std_device_part1_(pdf14_device, &pdf14_CMYKspot_procs, "pdf14cmykspot",
&st_pdf14_device, open_init_closed),
dci_values(GX_DEVICE_COLOR_MAX_COMPONENTS,64,255,255,256,256),
std_device_part2_(XSIZE, YSIZE, X_DPI, Y_DPI),
@@ -430,7 +427,7 @@ const pdf14_device gs_pdf14_CMYKspot_device = {
* about how to treat these blending modes.
*/
const pdf14_device gs_pdf14_custom_device = {
- std_device_part1_(pdf14_device, &pdf14_custom_procs, "pdf14custom",
+ std_device_part1_(pdf14_device, &pdf14_custom_procs, "pdf14custom",
&st_pdf14_device, open_init_closed),
dci_values(GX_DEVICE_COLOR_MAX_COMPONENTS,64,255,255,256,256),
std_device_part2_(XSIZE, YSIZE, X_DPI, Y_DPI),
@@ -453,15 +450,15 @@ const pdf14_device gs_pdf14_custom_device = {
};
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(pdf14_device_enum_ptrs, pdf14_device *pdev)
{
index -= 5;
if (index < pdev->devn_params.separations.num_separations)
- ENUM_RETURN(pdev->devn_params.separations.names[index].data);
+ ENUM_RETURN(pdev->devn_params.separations.names[index].data);
index -= pdev->devn_params.separations.num_separations;
if (index < pdev->devn_params.pdf14_separations.num_separations)
- ENUM_RETURN(pdev->devn_params.pdf14_separations.names[index].data);
+ ENUM_RETURN(pdev->devn_params.pdf14_separations.names[index].data);
return 0;
}
case 0: return ENUM_OBJ(pdev->ctx);
@@ -474,11 +471,11 @@ ENUM_PTRS_END
static RELOC_PTRS_WITH(pdf14_device_reloc_ptrs, pdf14_device *pdev)
{
{
- int i;
+ int i;
- for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
- RELOC_PTR(pdf14_device, devn_params.separations.names[i].data);
- }
+ for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
+ RELOC_PTR(pdf14_device, devn_params.separations.names[i].data);
+ }
}
RELOC_PTR(pdf14_device, devn_params.compressed_color_list);
RELOC_VAR(pdev->ctx);
@@ -497,14 +494,14 @@ RELOC_PTRS_END
* Return value: Newly allocated buffer, or NULL on failure.
**/
static pdf14_buf *
-pdf14_buf_new(gs_int_rect *rect, bool has_tags, bool has_alpha_g,
+pdf14_buf_new(gs_int_rect *rect, bool has_tags, bool has_alpha_g,
bool has_shape, bool idle, int n_chan, gs_memory_t *memory)
{
- /* Note that alpha_g is the alpha for the GROUP */
- /* This is distinct from the alpha that may also exist */
- /* for the objects within the group. Hence it can introduce */
- /* yet another plane */
+ /* Note that alpha_g is the alpha for the GROUP */
+ /* This is distinct from the alpha that may also exist */
+ /* for the objects within the group. Hence it can introduce */
+ /* yet another plane */
pdf14_buf *result;
pdf14_parent_color_t *new_parent_color;
@@ -519,9 +516,9 @@ pdf14_buf_new(gs_int_rect *rect, bool has_tags, bool has_alpha_g,
return NULL;
result = gs_alloc_struct(memory, pdf14_buf, &st_pdf14_buf,
- "pdf14_buf_new");
+ "pdf14_buf_new");
if (result == NULL)
- return result;
+ return result;
result->saved = NULL;
result->isolated = false;
@@ -538,7 +535,7 @@ pdf14_buf_new(gs_int_rect *rect, bool has_tags, bool has_alpha_g,
result->idle = idle;
result->mask_id = 0;
new_parent_color = gs_alloc_struct(memory, pdf14_parent_color_t, &st_pdf14_clr,
- "pdf14_buf_new");
+ "pdf14_buf_new");
result->parent_color_info_procs = new_parent_color;
result->parent_color_info_procs->get_cmap_procs = NULL;
result->parent_color_info_procs->parent_color_mapping_procs = NULL;
@@ -546,27 +543,27 @@ pdf14_buf_new(gs_int_rect *rect, bool has_tags, bool has_alpha_g,
result->parent_color_info_procs->icc_profile = NULL;
result->parent_color_info_procs->previous = NULL;
result->parent_color_info_procs->encode = NULL;
- result->parent_color_info_procs->decode = NULL;
+ result->parent_color_info_procs->decode = NULL;
if (height <= 0) {
- /* Empty clipping - will skip all drawings. */
- result->planestride = 0;
- result->data = 0;
+ /* Empty clipping - will skip all drawings. */
+ result->planestride = 0;
+ result->data = 0;
} else {
- planestride = rowstride * height;
- result->planestride = planestride;
- result->data = gs_alloc_bytes(memory, planestride * n_planes,
- "pdf14_buf_new");
- if (result->data == NULL) {
- gs_free_object(memory, result, "pdf_buf_new");
- return NULL;
- }
- if (has_alpha_g) {
- int alpha_g_plane = n_chan + (has_shape ? 1 : 0);
- memset (result->data + alpha_g_plane * planestride, 0, planestride);
- }
+ planestride = rowstride * height;
+ result->planestride = planestride;
+ result->data = gs_alloc_bytes(memory, planestride * n_planes,
+ "pdf14_buf_new");
+ if (result->data == NULL) {
+ gs_free_object(memory, result, "pdf_buf_new");
+ return NULL;
+ }
+ if (has_alpha_g) {
+ int alpha_g_plane = n_chan + (has_shape ? 1 : 0);
+ memset (result->data + alpha_g_plane * planestride, 0, planestride);
+ }
if (has_tags) {
int tags_plane = n_chan + (has_shape ? 1 : 0) + (has_alpha_g ? 1 : 0);
- memset (result->data + tags_plane * planestride,
+ memset (result->data + tags_plane * planestride,
GS_UNTOUCHED_TAG, planestride);
}
}
@@ -588,7 +585,6 @@ pdf14_buf_free(pdf14_buf *buf, gs_memory_t *memory)
gs_free_object(memory, buf, "pdf14_buf_free");
}
-
static void
rc_pdf14_maskbuf_free(gs_memory_t * mem, void *ptr_in, client_name_t cname)
{
@@ -607,7 +603,7 @@ pdf14_rcmask_new(gs_memory_t *memory)
pdf14_rcmask_t *result;
result = gs_alloc_struct(memory, pdf14_rcmask_t, &st_pdf14_rcmask,
- "pdf14_maskbuf_new");
+ "pdf14_maskbuf_new");
if ( result == NULL )
return(NULL);
rc_init_free(result, memory, 1, rc_pdf14_maskbuf_free);
@@ -626,22 +622,22 @@ pdf14_ctx_new(gs_int_rect *rect, int n_chan, bool additive, gs_memory_t *memory)
has_tags = (memory->gs_lib_ctx->BITTAG != GS_DEVICE_DOESNT_SUPPORT_TAGS);
result = gs_alloc_struct(memory, pdf14_ctx, &st_pdf14_ctx,
- "pdf14_ctx_new");
+ "pdf14_ctx_new");
if (result == NULL)
- return result;
+ return result;
/* Note: buffer creation expects alpha to be in number of channels */
buf = pdf14_buf_new(rect, has_tags, false, false, false, n_chan+1, memory);
if (buf == NULL) {
- gs_free_object(memory, result, "pdf14_ctx_new");
- return NULL;
+ gs_free_object(memory, result, "pdf14_ctx_new");
+ return NULL;
}
if_debug4('v', "[v]base buf: %d x %d, %d color channels, %d planes \n",
- buf->rect.q.x, buf->rect.q.y, buf->n_chan, buf->n_planes);
+ buf->rect.q.x, buf->rect.q.y, buf->n_chan, buf->n_planes);
if (buf->data != NULL) {
if (buf->has_tags) {
- memset(buf->data, 0, buf->planestride * (buf->n_planes-1));
+ memset(buf->data, 0, buf->planestride * (buf->n_planes-1));
} else {
- memset(buf->data, 0, buf->planestride * buf->n_planes);
+ memset(buf->data, 0, buf->planestride * buf->n_planes);
}
}
buf->saved = NULL;
@@ -663,13 +659,13 @@ pdf14_ctx_free(pdf14_ctx *ctx)
pdf14_buf *buf, *next;
if (ctx->mask_stack) {
- /* A mask was created but was not used in this band. */
+ /* A mask was created but was not used in this band. */
rc_decrement(ctx->mask_stack->rc_mask, "pdf14_ctx_free");
gs_free_object(ctx->memory,ctx->mask_stack,"pdf14_ctx_free");
}
for (buf = ctx->stack; buf != NULL; buf = next) {
- next = buf->saved;
- pdf14_buf_free(buf, ctx->memory);
+ next = buf->saved;
+ pdf14_buf_free(buf, ctx->memory);
}
gs_free_object (ctx->memory, ctx, "pdf14_ctx_free");
}
@@ -686,9 +682,9 @@ pdf14_find_backdrop_buf(pdf14_ctx *ctx)
pdf14_buf *buf = ctx->stack;
while (buf != NULL) {
- if (buf->isolated) return NULL;
- if (!buf->knockout) return buf->saved;
- buf = buf->saved;
+ if (buf->isolated) return NULL;
+ if (!buf->knockout) return buf->saved;
+ buf = buf->saved;
}
/* this really shouldn't happen, as bottom-most buf should be
non-knockout */
@@ -697,10 +693,10 @@ pdf14_find_backdrop_buf(pdf14_ctx *ctx)
static int
pdf14_push_transparency_group(pdf14_ctx *ctx, gs_int_rect *rect,
- bool isolated, bool knockout,
- byte alpha, byte shape,
- gs_blend_mode_t blend_mode, bool idle,
- uint mask_id, int numcomps)
+ bool isolated, bool knockout,
+ byte alpha, byte shape,
+ gs_blend_mode_t blend_mode, bool idle,
+ uint mask_id, int numcomps)
{
pdf14_buf *tos = ctx->stack;
pdf14_buf *buf, *backdrop;
@@ -712,8 +708,8 @@ pdf14_push_transparency_group(pdf14_ctx *ctx, gs_int_rect *rect,
effects, but it still isn't correct. The pixel compositing code
for non-isolated knockout groups gets pretty hairy, which is
why this is here. */
- if (knockout)
- isolated = true;
+ if (knockout)
+ isolated = true;
has_shape = tos->has_shape || tos->knockout;
has_tags = tos->has_tags;
/* We need to create this based upon the size of
@@ -722,43 +718,43 @@ pdf14_push_transparency_group(pdf14_ctx *ctx, gs_int_rect *rect,
/* The second parameter in pdf14_buf_new decides if we should
add a GROUP alpha channel to the buffer. If it is NOT isolated, then this
buffer will be added. If it is isolated, then the buffer will not be added.
- I question the redundancy here of the alpha and the group alpha channel,
+ I question the redundancy here of the alpha and the group alpha channel,
but that will need to be looked at later. */
- buf = pdf14_buf_new(rect, has_tags, !isolated, has_shape, idle,
+ buf = pdf14_buf_new(rect, has_tags, !isolated, has_shape, idle,
numcomps+1, ctx->memory);
if_debug4('v', "[v]base buf: %d x %d, %d color channels, %d planes \n",
- buf->rect.q.x, buf->rect.q.y, buf->n_chan, buf->n_planes);
+ buf->rect.q.x, buf->rect.q.y, buf->n_chan, buf->n_planes);
if (buf == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
buf->isolated = isolated;
buf->knockout = knockout;
buf->alpha = alpha;
buf->shape = shape;
buf->blend_mode = blend_mode;
buf->mask_id = mask_id;
- buf->mask_stack = ctx->mask_stack; /* Save becasuse the group rendering may
+ buf->mask_stack = ctx->mask_stack; /* Save becasuse the group rendering may
set up another (nested) mask. */
- ctx->mask_stack = NULL; /* Clean the mask field for rendering this group.
- See pdf14_pop_transparency_group how to handle it. */
+ ctx->mask_stack = NULL; /* Clean the mask field for rendering this group.
+ See pdf14_pop_transparency_group how to handle it. */
buf->saved = tos;
ctx->stack = buf;
if (buf->data == NULL)
- return 0;
+ return 0;
if (idle)
- return 0;
+ return 0;
backdrop = pdf14_find_backdrop_buf(ctx);
if (backdrop == NULL)
- memset(buf->data, 0, buf->planestride * (buf->n_chan +
- (buf->has_shape ? 1 : 0)));
- else
- pdf14_preserve_backdrop(buf, tos, has_shape);
+ memset(buf->data, 0, buf->planestride * (buf->n_chan +
+ (buf->has_shape ? 1 : 0)));
+ else
+ pdf14_preserve_backdrop(buf, tos, has_shape);
#if RAW_DUMP
-
+
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
+ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
ctx->stack->rowstride, ctx->stack->n_planes,
- ctx->stack->planestride, ctx->stack->rowstride,
+ ctx->stack->planestride, ctx->stack->rowstride,
"TransGroupPush",ctx->stack->data);
global_index++;
@@ -768,7 +764,7 @@ pdf14_push_transparency_group(pdf14_ctx *ctx, gs_int_rect *rect,
static int
pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
- const pdf14_nonseparable_blending_procs_t * pblend_procs,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs,
int curr_num_color_comp, cmm_profile_t *curr_icc_profile, gx_device *dev)
{
pdf14_buf *tos = ctx->stack;
@@ -791,42 +787,42 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
maskbuf = mask_stack->rc_mask->mask_buf;
}
if (nos == NULL)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
y0 = max(tos->rect.p.y, nos->rect.p.y);
y1 = min(tos->rect.q.y, nos->rect.q.y);
x0 = max(tos->rect.p.x, nos->rect.p.x);
x1 = min(tos->rect.q.x, nos->rect.q.x);
if (ctx->mask_stack) {
- /* This can occur when we have a situation where we are ending out of
- a group that has internal to it a soft mask and another group.
- The soft mask left over from the previous trans group pop is put
+ /* This can occur when we have a situation where we are ending out of
+ a group that has internal to it a soft mask and another group.
+ The soft mask left over from the previous trans group pop is put
into ctx->masbuf, since it is still active if another trans group
- push occurs to use it. If one does not occur, but instead we find
- ourselves popping from a parent group, then this softmask is no
+ push occurs to use it. If one does not occur, but instead we find
+ ourselves popping from a parent group, then this softmask is no
longer needed. We will rc_decrement and set it to NULL. */
rc_decrement(ctx->mask_stack->rc_mask, "pdf14_pop_transparency_group");
if (ctx->mask_stack->rc_mask == NULL ){
gs_free_object(ctx->memory, ctx->mask_stack, "pdf14_pop_transparency_group");
}
- ctx->mask_stack = NULL;
+ ctx->mask_stack = NULL;
}
ctx->mask_stack = mask_stack; /* Restore the mask saved by pdf14_push_transparency_group. */
tos->mask_stack = NULL; /* Clean the pointer sinse the mask ownership is now passed to ctx. */
if (tos->idle)
- goto exit;
+ goto exit;
if (maskbuf != NULL && maskbuf->data == NULL && maskbuf->alpha == 255)
- goto exit;
+ goto exit;
if (maskbuf != NULL) {
- y0 = max(y0, maskbuf->rect.p.y);
- y1 = min(y1, maskbuf->rect.q.y);
- x0 = max(x0, maskbuf->rect.p.x);
- x1 = min(x1, maskbuf->rect.q.x);
+ y0 = max(y0, maskbuf->rect.p.y);
+ y1 = min(y1, maskbuf->rect.q.y);
+ x0 = max(x0, maskbuf->rect.p.x);
+ x1 = min(x1, maskbuf->rect.q.x);
}
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
+ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
ctx->stack->rowstride, ctx->stack->n_planes,
- ctx->stack->planestride, ctx->stack->rowstride,
+ ctx->stack->planestride, ctx->stack->rowstride,
"Trans_Group_Pop",ctx->stack->data);
#endif
/* Note currently if a pattern space has transparency, the ICC profile is not used
@@ -837,28 +833,28 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
look at pdf14_begin_transparency_group and pdf14_end_transparency group which
is where all the ICC information is handled. We will return to look at that later */
if ( nos->parent_color_info_procs->icc_profile != NULL ) {
- icc_match = (nos->parent_color_info_procs->icc_profile->hashcode !=
+ icc_match = (nos->parent_color_info_procs->icc_profile->hashcode !=
curr_icc_profile->hashcode);
} else {
/* Let the other tests make the decision if we need to transform */
icc_match = false;
}
- /* If the color spaces are different and we actually did do a swap of
+ /* If the color spaces are different and we actually did do a swap of
the procs for color */
- if ( (nos->parent_color_info_procs->num_components != curr_num_color_comp &&
- nos->parent_color_info_procs->parent_color_mapping_procs != NULL)
+ if ( (nos->parent_color_info_procs->num_components != curr_num_color_comp &&
+ nos->parent_color_info_procs->parent_color_mapping_procs != NULL)
|| icc_match ) {
if (x0 < x1 && y0 < y1) {
/* The NOS blending color space is different than that of the
TOS. It is necessary to transform the TOS buffer data to the
- color space of the NOS prior to doing the pdf14_compose_group
+ color space of the NOS prior to doing the pdf14_compose_group
operation. */
num_noncolor_planes = tos->n_planes - curr_num_color_comp;
num_newcolor_planes = nos->parent_color_info_procs->num_components;
new_num_planes = num_noncolor_planes + num_newcolor_planes;
/* See if we are doing ICC based conversion */
- if (nos->parent_color_info_procs->icc_profile != NULL &&
- curr_icc_profile != NULL) {
+ if (nos->parent_color_info_procs->icc_profile != NULL &&
+ curr_icc_profile != NULL) {
/* Use the ICC color management for buffer color conversion */
/* Define the rendering intents */
rendering_params.black_point_comp = BP_ON;
@@ -869,10 +865,10 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
is due to a call to pop the group from fill_mask when filling
with a mask with transparency. In that case, the parent
and the child will have the same color space anyway */
- icc_link = gsicc_get_link_profile(pis, dev, curr_icc_profile,
+ icc_link = gsicc_get_link_profile(pis, dev, curr_icc_profile,
nos->parent_color_info_procs->icc_profile,
&rendering_params, pis->memory, false);
- /* If the link is the identity, then we don't need to do
+ /* If the link is the identity, then we don't need to do
any color conversions */
if ( !(icc_link->is_identity) ) {
/* Before we do any allocations check if we can get away with
@@ -882,39 +878,39 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
would be best. */
if( num_newcolor_planes != curr_num_color_comp ) {
/* Different size. We will need to allocate */
- new_data_buf = gs_alloc_bytes(ctx->memory,
+ new_data_buf = gs_alloc_bytes(ctx->memory,
tos->planestride*new_num_planes,
- "pdf14_buf_new");
- if (new_data_buf == NULL)
+ "pdf14_buf_new");
+ if (new_data_buf == NULL)
return_error(gs_error_VMerror);
/* Copy over the noncolor planes. */
- memcpy(new_data_buf + tos->planestride * num_newcolor_planes,
- tos->data + tos->planestride * curr_num_color_comp,
+ memcpy(new_data_buf + tos->planestride * num_newcolor_planes,
+ tos->data + tos->planestride * curr_num_color_comp,
tos->planestride * num_noncolor_planes);
} else {
/* In place color conversion! */
new_data_buf = tos->data;
}
/* Set up the buffer descriptors. Note that pdf14 always has
- the alpha channels at the back end (last planes).
- We will just handle that here and let the CMM know
+ the alpha channels at the back end (last planes).
+ We will just handle that here and let the CMM know
nothing about it */
num_rows = tos->rect.q.y - tos->rect.p.y;
num_cols = tos->rect.q.x - tos->rect.p.x;
gsicc_init_buffer(&input_buff_desc, curr_num_color_comp, 1,
false, false, true, tos->planestride, tos->rowstride,
num_rows, num_cols);
- gsicc_init_buffer(&output_buff_desc,
+ gsicc_init_buffer(&output_buff_desc,
nos->parent_color_info_procs->num_components, 1,
- false, false, true, tos->planestride,
+ false, false, true, tos->planestride,
tos->rowstride, num_rows, num_cols);
/* Transform the data. Since the pdf14 device should be
- using RGB, CMYK or Gray buffers, this transform
- does not need to worry about the cmap procs of
+ using RGB, CMYK or Gray buffers, this transform
+ does not need to worry about the cmap procs of
the target device. Those are handled when we do
the pdf14 put image operation */
- gscms_transform_color_buffer(icc_link, &input_buff_desc,
- &output_buff_desc, tos->data,
+ gscms_transform_color_buffer(icc_link, &input_buff_desc,
+ &output_buff_desc, tos->data,
new_data_buf);
}
/* Release the link */
@@ -926,11 +922,11 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
}
} else {
/* Non ICC based transform */
- new_data_buf = gs_alloc_bytes(ctx->memory,
+ new_data_buf = gs_alloc_bytes(ctx->memory,
tos->planestride*new_num_planes,"pdf14_buf_new");
- if (new_data_buf == NULL)
+ if (new_data_buf == NULL)
return_error(gs_error_VMerror);
- gs_transform_color_buffer_generic(tos->data, tos->rowstride,
+ gs_transform_color_buffer_generic(tos->data, tos->rowstride,
tos->planestride,curr_num_color_comp, tos->rect,
new_data_buf, num_newcolor_planes, num_noncolor_planes);
/* Free the old object */
@@ -941,27 +937,27 @@ pdf14_pop_transparency_group(gs_imager_state *pis, pdf14_ctx *ctx,
tos->n_chan = nos->n_chan;
tos->n_planes = nos->n_planes;
#if RAW_DUMP
- /* Dump the current buffer to see what we have. */
- dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
- ctx->stack->rowstride, ctx->stack->n_planes,
- ctx->stack->planestride, ctx->stack->rowstride,
- "Trans_Group_ColorConv",ctx->stack->data);
+ /* Dump the current buffer to see what we have. */
+ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
+ ctx->stack->rowstride, ctx->stack->n_planes,
+ ctx->stack->planestride, ctx->stack->rowstride,
+ "Trans_Group_ColorConv",ctx->stack->data);
#endif
/* compose */
- pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1, nos->n_chan,
- nos->parent_color_info_procs->isadditive,
+ pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1, nos->n_chan,
+ nos->parent_color_info_procs->isadditive,
nos->parent_color_info_procs->parent_blending_procs);
}
} else {
/* Group color spaces are the same. No color conversions needed */
if (x0 < x1 && y0 < y1)
- pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1,nos->n_chan,
+ pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1,nos->n_chan,
ctx->additive, pblend_procs);
}
exit:
ctx->stack = nos;
/* We want to detect the cases where we have luminosity soft masks embedded
- within one another. The "alpha" channel really needs to be merged into
+ within one another. The "alpha" channel really needs to be merged into
the luminosity channel in this case. This will occur during the mask pop */
if (ctx->smask_depth > 0 && maskbuf != NULL) {
/* Set the trigger so that we will blend if not alpha. Since
@@ -981,30 +977,30 @@ exit:
*/
static int
pdf14_push_transparency_mask(pdf14_ctx *ctx, gs_int_rect *rect, byte bg_alpha,
- byte *transfer_fn, bool idle, bool replacing,
- uint mask_id, gs_transparency_mask_subtype_t subtype,
+ byte *transfer_fn, bool idle, bool replacing,
+ uint mask_id, gs_transparency_mask_subtype_t subtype,
int numcomps, int Background_components,
const float Background[],
const float GrayBackground)
{
pdf14_buf *buf;
unsigned char *curr_ptr, gray;
-
- if_debug2('v', "[v]pdf14_push_transparency_mask, idle=%d, replacing=%d\n",
+
+ if_debug2('v', "[v]pdf14_push_transparency_mask, idle=%d, replacing=%d\n",
idle, replacing);
ctx->smask_depth += 1;
/* An optimization to consider is that if the SubType is Alpha
then we really should only be allocating the alpha band and
- only draw with that channel. Current architecture makes that
+ only draw with that channel. Current architecture makes that
a bit tricky. We need to create this based upon the size of
the color space + an alpha channel. NOT the device size
or the previous ctx size */
/* A mask doesnt worry about tags */
- buf = pdf14_buf_new(rect, false, false, false, idle, numcomps+1,
+ buf = pdf14_buf_new(rect, false, false, false, idle, numcomps+1,
ctx->memory);
if (buf == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
buf->alpha = bg_alpha;
/* fill in, but these values aren't really used */
buf->isolated = true;
@@ -1014,10 +1010,10 @@ pdf14_push_transparency_mask(pdf14_ctx *ctx, gs_int_rect *rect, byte bg_alpha,
buf->transfer_fn = transfer_fn;
buf->mask_id = mask_id;
{ /* If replacing=false, we start the mask for an image with SMask.
- In this case the image's SMask temporary replaces the
- mask of the containing group. Save the containing droup's mask
+ In this case the image's SMask temporary replaces the
+ mask of the containing group. Save the containing droup's mask
in buf->mask_stack */
- buf->mask_stack = ctx->mask_stack;
+ buf->mask_stack = ctx->mask_stack;
if (buf->mask_stack){
rc_increment(buf->mask_stack->rc_mask);
}
@@ -1025,37 +1021,37 @@ pdf14_push_transparency_mask(pdf14_ctx *ctx, gs_int_rect *rect, byte bg_alpha,
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
if (ctx->stack->planestride > 0 ){
- dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
+ dump_raw_buffer(ctx->stack->rect.q.y-ctx->stack->rect.p.y,
ctx->stack->rowstride, ctx->stack->n_planes,
- ctx->stack->planestride, ctx->stack->rowstride,
+ ctx->stack->planestride, ctx->stack->rowstride,
"Raw_Buf_PreSmask",ctx->stack->data);
global_index++;
}
#endif
buf->saved = ctx->stack;
ctx->stack = buf;
- /* Soft Mask related information so we know how to
+ /* Soft Mask related information so we know how to
compute luminosity when we pop the soft mask */
buf->SMask_SubType = subtype;
if (buf->data != NULL){
/* We need to initialize it to the BC if it existed */
/* According to the spec, the CS has to be the same */
- /* If the back ground component is black, then don't bother
+ /* If the back ground component is black, then don't bother
with this. Since we are forcing the rendering to gray
- earlier now, go ahead and just use the GrayBackGround color
+ earlier now, go ahead and just use the GrayBackGround color
directly. */
if ( Background_components && GrayBackground != 0.0 ) {
curr_ptr = buf->data;
gray = (unsigned char) (255.0 * GrayBackground);
- memset(curr_ptr, gray, buf->planestride);
+ memset(curr_ptr, gray, buf->planestride);
curr_ptr += buf->planestride;
- /* If we have a background component that was not black, then we
+ /* If we have a background component that was not black, then we
need to set the alpha for this mask as if we had drawn in the
entire soft mask buffer */
- memset(curr_ptr, 255, buf->planestride *(buf->n_chan - 1));
+ memset(curr_ptr, 255, buf->planestride *(buf->n_chan - 1));
} else {
/* Compose mask with opaque background */
- memset(buf->data, 0, buf->planestride * buf->n_chan);
+ memset(buf->data, 0, buf->planestride * buf->n_chan);
}
}
return 0;
@@ -1068,13 +1064,13 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
byte *new_data_buf;
int icc_match;
cmm_profile_t *des_profile = tos->parent_color_info_procs->icc_profile; /* If set, this should be a gray profile */
- cmm_profile_t *src_profile = dev->device_icc_profile;
+ cmm_profile_t *src_profile = dev->device_icc_profile;
gsicc_rendering_param_t rendering_params;
gsicc_link_t *icc_link;
ctx->smask_depth -= 1;
/* icc_match == -1 means old non-icc code.
- icc_match == 0 means use icc code
+ icc_match == 0 means use icc code
icc_match == 1 mean no conversion needed */
if ( des_profile != NULL && src_profile != NULL ) {
icc_match = (des_profile->hashcode == src_profile->hashcode);
@@ -1085,21 +1081,21 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
ctx->stack = tos->saved;
tos->saved = NULL; /* To avoid issues with GC */
if (tos->mask_stack) {
- /* During the soft mask push, the mask_stack was copied (not moved) from
- the ctx to the tos mask_stack. We are done with this now so it is safe to
- just set to NULL. However, before we do that we must perform
- rc decrement to match the increment that occured was made. Also,
- if this is the last ref count of the rc_mask, we should free the
+ /* During the soft mask push, the mask_stack was copied (not moved) from
+ the ctx to the tos mask_stack. We are done with this now so it is safe to
+ just set to NULL. However, before we do that we must perform
+ rc decrement to match the increment that occured was made. Also,
+ if this is the last ref count of the rc_mask, we should free the
buffer now since no other groups need it. */
- rc_decrement(tos->mask_stack->rc_mask,
+ rc_decrement(tos->mask_stack->rc_mask,
"pdf14_pop_transparency_mask(tos->mask_stack->rc_mask)");
if (tos->mask_stack->rc_mask) {
if (tos->mask_stack->rc_mask->rc.ref_count == 1){
- rc_decrement(tos->mask_stack->rc_mask,
+ rc_decrement(tos->mask_stack->rc_mask,
"pdf14_pop_transparency_mask(tos->mask_stack->rc_mask)");
}
}
- tos->mask_stack = NULL;
+ tos->mask_stack = NULL;
}
if (tos->data == NULL ) {
/* This can occur in clist rendering if the soft mask does
@@ -1109,8 +1105,8 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
that was created. Only delete if the alpha value is not
255 */
if (tos->alpha == 255) {
- pdf14_buf_free(tos, ctx->memory);
- ctx->mask_stack = NULL;
+ pdf14_buf_free(tos, ctx->memory);
+ ctx->mask_stack = NULL;
} else {
/* Assign as mask buffer */
ctx->mask_stack = pdf14_mask_element_new(ctx->memory);
@@ -1119,18 +1115,18 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
}
ctx->smask_blend = false; /* just in case */
} else {
- /* If we are already in the source space then there is no reason
+ /* If we are already in the source space then there is no reason
to do the transformation */
/* Lets get this to a monochrome buffer and map it to a luminance only value */
/* This will reduce our memory. We won't reuse the existing one, due */
/* Due to the fact that on certain systems we may have issues recovering */
/* the data after a resize */
- new_data_buf = gs_alloc_bytes(ctx->memory, tos->planestride,
- "pdf14_buf_new");
- if (new_data_buf == NULL)
+ new_data_buf = gs_alloc_bytes(ctx->memory, tos->planestride,
+ "pdf14_buf_new");
+ if (new_data_buf == NULL)
return_error(gs_error_VMerror);
- /* Initialize with 0. Need to do this since in Smask_Luminosity_Mapping
- we won't be filling everything during the remap if it had not been
+ /* Initialize with 0. Need to do this since in Smask_Luminosity_Mapping
+ we won't be filling everything during the remap if it had not been
written into by the PDF14 fill rect */
memset(new_data_buf, 0, tos->planestride);
/* If the subtype was alpha, then just grab the alpha channel now
@@ -1138,14 +1134,14 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
if (tos->SMask_SubType == TRANSPARENCY_MASK_Alpha) {
ctx->smask_blend = false; /* not used in this case */
smask_copy(tos->rect.q.y - tos->rect.p.y,
- tos->rect.q.x - tos->rect.p.x,
- tos->rowstride,
+ tos->rect.q.x - tos->rect.p.x,
+ tos->rowstride,
(tos->data)+tos->planestride, new_data_buf);
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
+ dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
tos->rowstride, tos->n_planes,
- tos->planestride, tos->rowstride,
+ tos->planestride, tos->rowstride,
"SMask_Pop_Alpha(Mask_Plane1)",tos->data);
global_index++;
#endif
@@ -1153,54 +1149,54 @@ pdf14_pop_transparency_mask(pdf14_ctx *ctx, gs_imager_state *pis, gx_device *dev
if ( icc_match == 1 || tos->n_chan == 2) {
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
+ dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
tos->rowstride, tos->n_planes,
- tos->planestride, tos->rowstride,
+ tos->planestride, tos->rowstride,
"SMask_Pop_Lum(Mask_Plane0)",tos->data);
global_index++;
-#endif
+#endif
/* There is no need to color convert. Data is already gray scale.
- We just need to copy the gray plane. However it is
- possible that the soft mask could have a soft mask which
- would end us up with some alpha blending information
+ We just need to copy the gray plane. However it is
+ possible that the soft mask could have a soft mask which
+ would end us up with some alpha blending information
(Bug691803). In fact, according to the spec, the alpha
- blending has to occur. See FTS test fts_26_2601.pdf
+ blending has to occur. See FTS test fts_26_2601.pdf
for an example of this. Softmask buffer is intialized
with BG values. It would be nice to keep track if buffer
ever has a alpha value not 1 so that we could detect and
avoid this blend if not needed. */
- smask_blend(tos->data, tos->rect.q.x - tos->rect.p.x,
- tos->rect.q.y - tos->rect.p.y, tos->rowstride,
+ smask_blend(tos->data, tos->rect.q.x - tos->rect.p.x,
+ tos->rect.q.y - tos->rect.p.y, tos->rowstride,
tos->planestride);
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
+ dump_raw_buffer(tos->rect.q.y-tos->rect.p.y,
tos->rowstride, tos->n_planes,
- tos->planestride, tos->rowstride,
+ tos->planestride, tos->rowstride,
"SMask_Pop_Lum_Post_Blend",tos->data);
global_index++;
-#endif
+#endif
smask_copy(tos->rect.q.y - tos->rect.p.y,
- tos->rect.q.x - tos->rect.p.x,
+ tos->rect.q.x - tos->rect.p.x,
tos->rowstride, tos->data, new_data_buf);
} else {
if ( icc_match == -1 ) {
/* The slow old fashioned way */
smask_luminosity_mapping(tos->rect.q.y - tos->rect.p.y ,
- tos->rect.q.x - tos->rect.p.x,tos->n_chan,
- tos->rowstride, tos->planestride,
- tos->data, new_data_buf, ctx->additive, tos->SMask_SubType);
+ tos->rect.q.x - tos->rect.p.x,tos->n_chan,
+ tos->rowstride, tos->planestride,
+ tos->data, new_data_buf, ctx->additive, tos->SMask_SubType);
} else {
/* ICC case where we use the CMM */
/* Request the ICC link for the transform that we will need to use */
rendering_params.black_point_comp = BP_OFF;
rendering_params.object_type = GS_IMAGE_TAG;
rendering_params.rendering_intent = gsPERCEPTUAL;
- icc_link = gsicc_get_link_profile(pis, dev, des_profile,
+ icc_link = gsicc_get_link_profile(pis, dev, des_profile,
src_profile, &rendering_params, pis->memory, false);
smask_icc(tos->rect.q.y - tos->rect.p.y ,
- tos->rect.q.x - tos->rect.p.x,tos->n_chan,
- tos->rowstride, tos->planestride,
+ tos->rect.q.x - tos->rect.p.x,tos->n_chan,
+ tos->rowstride, tos->planestride,
tos->data, new_data_buf, icc_link);
/* Release the link */
gsicc_release_link(icc_link);
@@ -1227,7 +1223,7 @@ pdf14_mask_element_new(gs_memory_t *memory)
pdf14_mask_t *result;
result = gs_alloc_struct(memory, pdf14_mask_t, &st_pdf14_mask,
- "pdf14_mask_element_new");
+ "pdf14_mask_element_new");
/* Get the reference counted mask */
result->rc_mask = NULL;
result->previous = NULL;
@@ -1241,7 +1237,7 @@ pdf14_push_transparency_state(gx_device *dev, gs_imager_state *pis)
/* We need to push the current soft mask. We need to
be able to recover it if we draw a new one and
then obtain a Q operation ( a pop ) */
-
+
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_ctx *ctx = pdev->ctx;
pdf14_mask_t *new_mask;
@@ -1250,7 +1246,7 @@ pdf14_push_transparency_state(gx_device *dev, gs_imager_state *pis)
/* We need to push the current mask buffer */
/* Allocate a new element for the stack.
Don't do anything if there is no mask present.*/
- if ( ctx->mask_stack != NULL ) {
+ if ( ctx->mask_stack != NULL ) {
new_mask = pdf14_mask_element_new(ctx->memory);
/* Duplicate and make the link */
new_mask->rc_mask = ctx->mask_stack->rc_mask;
@@ -1264,7 +1260,7 @@ static int
pdf14_pop_transparency_state(gx_device *dev, gs_imager_state *pis)
{
- /* Pop the soft mask. It is no longer needed. Likely due to
+ /* Pop the soft mask. It is no longer needed. Likely due to
a Q that has occurred. */
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_ctx *ctx = pdev->ctx;
@@ -1288,7 +1284,7 @@ pdf14_pop_transparency_state(gx_device *dev, gs_imager_state *pis)
if (ctx->stack != NULL && ctx->stack->mask_stack != NULL) {
ctx->stack->mask_stack = ctx->mask_stack;
}
- }
+ }
}
return(0);
}
@@ -1300,15 +1296,15 @@ pdf14_open(gx_device *dev)
gs_int_rect rect;
if_debug2('v', "[v]pdf14_open: width = %d, height = %d\n",
- dev->width, dev->height);
+ dev->width, dev->height);
rect.p.x = 0;
rect.p.y = 0;
rect.q.x = dev->width;
rect.q.y = dev->height;
pdev->ctx = pdf14_ctx_new(&rect, dev->color_info.num_components,
- pdev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE, dev->memory);
+ pdev->color_info.polarity != GX_CINFO_POLARITY_SUBTRACTIVE, dev->memory);
if (pdev->ctx == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pdev->free_devicen = true;
return 0;
}
@@ -1323,11 +1319,10 @@ pdf14_cmykspot_get_color_mapping_procs(const gx_device * dev)
return &pdf14_DeviceCMYKspot_procs;
}
-
/* Used to passed along information about the buffer created by the
pdf14 device. This is used by the pattern accumulator when the
pattern contains transparency */
-int
+int
pdf14_get_buffer_information(const gx_device * dev, gx_pattern_trans_t *transbuff)
{
@@ -1347,7 +1342,7 @@ pdf14_get_buffer_information(const gx_device * dev, gx_pattern_trans_t *transbuf
width = x1 - rect.p.x;
height = y1 - rect.p.y;
if (width <= 0 || height <= 0 || buf->data == NULL)
- return 0;
+ return 0;
transbuff->pdev14 = dev;
transbuff->n_chan = buf->n_chan;
transbuff->planestride = buf->planestride;
@@ -1360,7 +1355,7 @@ pdf14_get_buffer_information(const gx_device * dev, gx_pattern_trans_t *transbuf
#if RAW_DUMP
/* Dump the buffer that should be going into the pattern */;
dump_raw_buffer(height, width, buf->n_chan,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"pdf14_pattern_buff",buf->data);
global_index++;
#endif
@@ -1407,15 +1402,15 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
dump_planar_rgba(pdev->memory, buf);
#endif
if (width <= 0 || height <= 0 || buf->data == NULL)
- return 0;
+ return 0;
buf_ptr = buf->data + rect.p.y * buf->rowstride + rect.p.x;
/* See if the target device has a put_image command. If
yes then see if it can handle the image data directly.
If it cannot, then we will need to use the begin_typed_image
- interface, which cannot pass along tag nor alpha data to
+ interface, which cannot pass along tag nor alpha data to
the target device */
if (target->procs.put_image != NULL) {
- /* See if the target device can handle the data in its current
+ /* See if the target device can handle the data in its current
form with the alpha component */
int alpha_offset = num_comp;
int tag_offset = buf->has_tags ? num_comp+1 : 0;
@@ -1424,13 +1419,13 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
buf->rowstride, buf->planestride,
num_comp,tag_offset);
if (code == 0) {
- /* Device could not handle the alpha data. Go ahead and
+ /* Device could not handle the alpha data. Go ahead and
preblend now. Note that if we do this, and we end up in the
default below, we only need to repack in chunky not blend */
#if RAW_DUMP
/* Dump before and after the blend to make sure we are doing that ok */
dump_raw_buffer(height, width, buf->n_planes,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"pre_final_blend",buf_ptr);
global_index++;
#endif
@@ -1439,7 +1434,7 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
#if RAW_DUMP
/* Dump before and after the blend to make sure we are doing that ok */
dump_raw_buffer(height, width, buf->n_planes,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"post_final_blend",buf_ptr);
global_index++;
clist_band_count++;
@@ -1457,8 +1452,8 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
num_rows_left = height - code;
while (num_rows_left > 0) {
code = dev_proc(target, put_image) (target, buf_ptr, buf->n_planes,
- rect.p.x, rect.p.y+code, width,
- num_rows_left, buf->rowstride,
+ rect.p.x, rect.p.y+code, width,
+ num_rows_left, buf->rowstride,
buf->planestride,
alpha_offset, tag_offset);
num_rows_left = num_rows_left - code;
@@ -1477,24 +1472,24 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
* an image.
*/
switch (num_comp) {
- case 1: /* DeviceGray */
- pcs = gs_cspace_new_DeviceGray(pis->memory);
- break;
- case 3: /* DeviceRGB */
- pcs = gs_cspace_new_DeviceRGB(pis->memory);
- break;
- case 4: /* DeviceCMYK */
- pcs = gs_cspace_new_DeviceCMYK(pis->memory);
- break;
- default: /* Should never occur */
- return_error(gs_error_rangecheck);
- break;
+ case 1: /* DeviceGray */
+ pcs = gs_cspace_new_DeviceGray(pis->memory);
+ break;
+ case 3: /* DeviceRGB */
+ pcs = gs_cspace_new_DeviceRGB(pis->memory);
+ break;
+ case 4: /* DeviceCMYK */
+ pcs = gs_cspace_new_DeviceCMYK(pis->memory);
+ break;
+ default: /* Should never occur */
+ return_error(gs_error_rangecheck);
+ break;
}
if (pcs == NULL)
- return_error(gs_error_VMerror);
- /* Need to set this to avoid color management during the
+ return_error(gs_error_VMerror);
+ /* Need to set this to avoid color management during the
image color render operation. Exception is for the special case
- when the destination was CIELAB. Then we need to convert from
+ when the destination was CIELAB. Then we need to convert from
default RGB to CIELAB in the put image operation. That will happen
here as we should have set the profile for the pdf14 device to RGB
and the target will be CIELAB */
@@ -1513,23 +1508,23 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
ctm_only_writable(pis).tx = (float)rect.p.x;
ctm_only_writable(pis).ty = (float)rect.p.y;
code = dev_proc(target, begin_typed_image) (target,
- pis, NULL,
- (gs_image_common_t *)&image,
- NULL, NULL, NULL,
- pis->memory, &info);
+ pis, NULL,
+ (gs_image_common_t *)&image,
+ NULL, NULL, NULL,
+ pis->memory, &info);
if (code < 0) {
- rc_decrement_only_cs(pcs, "pdf14_put_image");
- return code;
+ rc_decrement_only_cs(pcs, "pdf14_put_image");
+ return code;
}
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
- pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
- pdev->ctx->stack->n_planes,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
+ pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
+ pdev->ctx->stack->n_planes,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"pdF14_putimage",pdev->ctx->stack->data);
dump_raw_buffer(height, width, num_comp+1,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"PDF14_PUTIMAGE_SMALL",buf_ptr);
global_index++;
if (!data_blended) {
@@ -1538,25 +1533,25 @@ pdf14_put_image(gx_device * dev, gs_imager_state * pis, gx_device * target)
#endif
linebuf = gs_alloc_bytes(pdev->memory, width * num_comp, "pdf14_put_image");
for (y = 0; y < height; y++) {
- gx_image_plane_t planes;
- int rows_used,k,x;
+ gx_image_plane_t planes;
+ int rows_used,k,x;
if (data_blended) {
for (x = 0; x < width; x++) {
- for (k = 0; k < num_comp; k++) {
- linebuf[x * num_comp + k] = buf_ptr[x + buf->planestride * k];
- }
+ for (k = 0; k < num_comp; k++) {
+ linebuf[x * num_comp + k] = buf_ptr[x + buf->planestride * k];
+ }
}
} else {
- gx_build_blended_image_row(buf_ptr, y, buf->planestride, width,
+ gx_build_blended_image_row(buf_ptr, y, buf->planestride, width,
num_comp, bg, linebuf);
}
- planes.data = linebuf;
- planes.data_x = 0;
- planes.raster = width * num_comp;
- info->procs->plane_data(info, &planes, 1, &rows_used);
- /* todo: check return value */
- buf_ptr += buf->rowstride;
+ planes.data = linebuf;
+ planes.data_x = 0;
+ planes.raster = width * num_comp;
+ info->procs->plane_data(info, &planes, 1, &rows_used);
+ /* todo: check return value */
+ buf_ptr += buf->rowstride;
}
gs_free_object(pdev->memory, linebuf, "pdf14_put_image");
info->procs->end_image(info, true);
@@ -1603,21 +1598,21 @@ pdf14_cmykspot_put_image(gx_device * dev, gs_imager_state * pis, gx_device * tar
width = x1 - rect.p.x;
height = y1 - rect.p.y;
if (width <= 0 || height <= 0 || buf->data == NULL)
- return 0;
+ return 0;
buf_ptr = buf->data + rect.p.y * buf->rowstride + rect.p.x;
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
- pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
- pdev->ctx->stack->n_planes,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
+ pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
+ pdev->ctx->stack->n_planes,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
"CMYK_SPOT_PUTIMAGE",pdev->ctx->stack->data);
global_index++;
clist_band_count++;
#endif
return gx_put_blended_image_cmykspot(target, buf_ptr, planestride, rowstride,
- rect.p.x, rect.p.y, width, height, num_comp, bg, pseparations);
+ rect.p.x, rect.p.y, width, height, num_comp, bg, pseparations);
}
/**
@@ -1652,12 +1647,12 @@ pdf14_custom_put_image(gx_device * dev, gs_imager_state * pis, gx_device * targe
width = x1 - rect.p.x;
height = y1 - rect.p.y;
if (width <= 0 || height <= 0 || buf->data == NULL)
- return 0;
+ return 0;
buf_ptr = buf->data + rect.p.y * buf->rowstride + rect.p.x;
- return gx_put_blended_image_custom(target, buf_ptr,
- planestride, rowstride,
- x0, y0, width, height, num_comp, bg);
+ return gx_put_blended_image_custom(target, buf_ptr,
+ planestride, rowstride,
+ x0, y0, width, height, num_comp, bg);
}
static int
@@ -1666,8 +1661,8 @@ pdf14_close(gx_device *dev)
pdf14_device *pdev = (pdf14_device *)dev;
if (pdev->ctx) {
- pdf14_ctx_free(pdev->ctx);
- pdev->ctx = NULL;
+ pdf14_ctx_free(pdev->ctx);
+ pdev->ctx = NULL;
}
return 0;
}
@@ -1678,7 +1673,7 @@ pdf14_output_page(gx_device * dev, int num_copies, int flush)
pdf14_device * pdev = (pdf14_device *)dev;
if (pdev->target != NULL)
- return (*dev_proc(pdev->target, output_page)) (pdev->target, num_copies, flush);
+ return (*dev_proc(pdev->target, output_page)) (pdev->target, num_copies, flush);
return 0;
}
@@ -1694,17 +1689,17 @@ pdf14_output_page(gx_device * dev, int num_copies, int flush)
static void
gs_pdf14_device_copy_params(gx_device *dev, const gx_device *target)
{
- COPY_PARAM(width);
- COPY_PARAM(height);
- COPY_ARRAY_PARAM(MediaSize);
- COPY_ARRAY_PARAM(ImagingBBox);
- COPY_PARAM(ImagingBBox_set);
- COPY_ARRAY_PARAM(HWResolution);
- COPY_ARRAY_PARAM(MarginsHWResolution);
- COPY_ARRAY_PARAM(Margins);
- COPY_ARRAY_PARAM(HWMargins);
- COPY_PARAM(PageCount);
- COPY_PARAM(MaxPatternBitmap);
+ COPY_PARAM(width);
+ COPY_PARAM(height);
+ COPY_ARRAY_PARAM(MediaSize);
+ COPY_ARRAY_PARAM(ImagingBBox);
+ COPY_PARAM(ImagingBBox_set);
+ COPY_ARRAY_PARAM(HWResolution);
+ COPY_ARRAY_PARAM(MarginsHWResolution);
+ COPY_ARRAY_PARAM(Margins);
+ COPY_ARRAY_PARAM(HWMargins);
+ COPY_PARAM(PageCount);
+ COPY_PARAM(MaxPatternBitmap);
/* Don't let put params blow away a group color space */
if (dev->device_icc_profile == NULL) {
COPY_PARAM(device_icc_profile);
@@ -1729,13 +1724,13 @@ pdf14_forward_put_params(gx_device * dev, gs_param_list * plist)
int code = 0;
if (tdev != 0 && (code = dev_proc(tdev, put_params)(tdev, plist)) >= 0) {
- gx_device_decache_colors(dev);
- if (!tdev->is_open) {
- code = gs_closedevice(dev);
- if (code == 0)
- code = was_open ? 1 : 0; /* target device closed */
- }
- gx_device_copy_params(dev, tdev);
+ gx_device_decache_colors(dev);
+ if (!tdev->is_open) {
+ code = gs_closedevice(dev);
+ if (code == 0)
+ code = was_open ? 1 : 0; /* target device closed */
+ }
+ gx_device_copy_params(dev, tdev);
}
return code;
}
@@ -1745,7 +1740,7 @@ int put_param_compressed_color_list_elem(gx_device * pdev,
gs_param_list * plist, compressed_color_list_t ** pret_comp_list,
char * keyname, int num_comps);
int put_param_pdf14_spot_names(gx_device * pdev,
- gs_separations * pseparations, gs_param_list * plist);
+ gs_separations * pseparations, gs_param_list * plist);
#define PDF14CompressedColorListParamName "PDF14CompressedColorList"
#define PDF14NumSpotColorsParamName "PDF14NumSpotColors"
@@ -1765,17 +1760,17 @@ pdf14_put_params(gx_device * dev, gs_param_list * plist)
int code = 0;
if (tdev != 0 && (code = dev_proc(tdev, put_params)(tdev, plist)) >= 0) {
- gx_device_decache_colors(dev);
- if (!tdev->is_open) {
- code = gs_closedevice(dev);
- if (code == 0)
- code = was_open ? 1 : 0; /* target device closed */
- }
- gs_pdf14_device_copy_params(dev, tdev);
+ gx_device_decache_colors(dev);
+ if (!tdev->is_open) {
+ code = gs_closedevice(dev);
+ if (code == 0)
+ code = was_open ? 1 : 0; /* target device closed */
+ }
+ gs_pdf14_device_copy_params(dev, tdev);
}
#if 0
put_param_compressed_color_list_elem(pdev, plist, &pret_comp_list,
- PDF14CompressedColorListParamName, TOP_ENCODED_LEVEL);
+ PDF14CompressedColorListParamName, TOP_ENCODED_LEVEL);
put_param_pdf14_spot_names(dev, &pdev->devn_params, plist);
#endif
return code;
@@ -1798,7 +1793,7 @@ pdf14_set_marking_params(gx_device *dev, const gs_imager_state *pis)
pdev->overprint_mode = pis->overprint_mode;
if_debug3('v', "[v]set_marking_params, opacity = %g, shape = %g, bm = %d\n",
- pdev->opacity, pdev->shape, pis->blend_mode);
+ pdev->opacity, pdev->shape, pis->blend_mode);
}
static void
@@ -1838,9 +1833,9 @@ update_lop_for_pdf14(gs_imager_state *pis, const gx_drawing_color *pdcolor)
static int
pdf14_fill_path(gx_device *dev, const gs_imager_state *pis,
- gx_path *ppath, const gx_fill_params *params,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath)
+ gx_path *ppath, const gx_fill_params *params,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath)
{
gs_imager_state new_is = *pis;
int code;
@@ -1848,8 +1843,8 @@ pdf14_fill_path(gx_device *dev, const gs_imager_state *pis,
if (pdcolor != NULL && gx_dc_is_pattern1_color(pdcolor)){
if( gx_pattern1_get_transptr(pdcolor) != NULL){
- /* In this case, we need to push a transparency group
- and tile the pattern color, which is stored in
+ /* In this case, we need to push a transparency group
+ and tile the pattern color, which is stored in
a pdf14 device buffer in the ctile object memember
variable ttrans */
#if RAW_DUMP
@@ -1857,23 +1852,23 @@ pdf14_fill_path(gx_device *dev, const gs_imager_state *pis,
we have do it now */
pdf14_device * ppatdev14 = pdcolor->colors.pattern.p_tile->ttrans->pdev14;
if (ppatdev14 != NULL) { /* can occur during clist reading */
- dump_raw_buffer(ppatdev14->ctx->stack->rect.q.y-ppatdev14->ctx->stack->rect.p.y,
- ppatdev14->ctx->stack->rect.q.x-ppatdev14->ctx->stack->rect.p.x,
- ppatdev14->ctx->stack->n_planes, ppatdev14->ctx->stack->planestride,
- ppatdev14->ctx->stack->rowstride,
+ dump_raw_buffer(ppatdev14->ctx->stack->rect.q.y-ppatdev14->ctx->stack->rect.p.y,
+ ppatdev14->ctx->stack->rect.q.x-ppatdev14->ctx->stack->rect.p.x,
+ ppatdev14->ctx->stack->n_planes, ppatdev14->ctx->stack->planestride,
+ ppatdev14->ctx->stack->rowstride,
"Pattern_Fill",ppatdev14->ctx->stack->data);
global_index++;
} else {
gx_pattern_trans_t *patt_trans = pdcolor->colors.pattern.p_tile->ttrans;
- dump_raw_buffer(patt_trans->rect.q.y-patt_trans->rect.p.y,
- patt_trans->rect.q.x-patt_trans->rect.p.x,
- patt_trans->n_chan,
- patt_trans->planestride, patt_trans->rowstride,
+ dump_raw_buffer(patt_trans->rect.q.y-patt_trans->rect.p.y,
+ patt_trans->rect.q.x-patt_trans->rect.p.x,
+ patt_trans->n_chan,
+ patt_trans->planestride, patt_trans->rowstride,
"Pattern_Fill_clist",patt_trans->transbytes);
global_index++;
}
#endif
- code = pdf14_tile_pattern_fill(dev, &new_is, ppath,
+ code = pdf14_tile_pattern_fill(dev, &new_is, ppath,
params, pdcolor, pcpath);
new_is.trans_device = NULL;
new_is.has_transparency = false;
@@ -1881,8 +1876,8 @@ pdf14_fill_path(gx_device *dev, const gs_imager_state *pis,
}
}
if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor)) {
- pinst =
- (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
+ pinst =
+ (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
pinst->saved->has_transparency = true;
/* The transparency color space operations are driven
by the pdf14 clist writer device. */
@@ -1903,26 +1898,26 @@ pdf14_fill_path(gx_device *dev, const gs_imager_state *pis,
static int
pdf14_stroke_path(gx_device *dev, const gs_imager_state *pis,
- gx_path *ppath, const gx_stroke_params *params,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath)
+ gx_path *ppath, const gx_stroke_params *params,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath)
{
gs_imager_state new_is = *pis;
update_lop_for_pdf14(&new_is, pdcolor);
pdf14_set_marking_params(dev, pis);
return gx_default_stroke_path(dev, &new_is, ppath, params, pdcolor,
- pcpath);
+ pcpath);
}
static int
pdf14_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int aa_raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int aa_raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
/* Because of the way that alpha blending occurs in the pdf14 device,
- we have to take care in doing the copy alpha operation. We could
- end up with some weird renderings if the blend mode is set to
+ we have to take care in doing the copy alpha operation. We could
+ end up with some weird renderings if the blend mode is set to
something odd. What we want is to go ahead and just do our own
blending here and now in the color planes and not mix up the
anti-aliasing blending with any of the transparency group blendings. */
@@ -1959,15 +1954,15 @@ pdf14_copy_alpha(gx_device * dev, const byte * data, int data_x,
byte white[PDF14_MAX_PLANES];
if (buf->data == NULL)
- return 0;
+ return 0;
aa_row = data;
if (has_tags) {
- curr_tag = (color >> (num_comp*8)) & 0xff;
+ curr_tag = (color >> (num_comp*8)) & 0xff;
}
pdev->pdf14_procs->unpack_color(num_comp, color, pdev, src);
src_alpha = src[num_comp] = (byte)floor (255 * pdev->alpha + 0.5);
if (has_shape)
- shape = (byte)floor (255 * pdev->shape + 0.5);
+ shape = (byte)floor (255 * pdev->shape + 0.5);
if (x < buf->rect.p.x) {
w += x - buf->rect.p.x;
x = buf->rect.p.x;
@@ -1983,47 +1978,47 @@ pdf14_copy_alpha(gx_device * dev, const byte * data, int data_x,
if (x + w > buf->bbox.q.x) buf->bbox.q.x = x + w;
if (y + h > buf->bbox.q.y) buf->bbox.q.y = y + h;
line = buf->data + (x - buf->rect.p.x) + (y - buf->rect.p.y) * rowstride;
-
+
memset(&(white[0]), 255, num_comp);
if (pdev->ctx->smask_depth > 0) {
memset(&(white[0]), 0, num_comp);
}
for (j = 0; j < h; ++j, aa_row += aa_raster) {
- dst_ptr = line;
+ dst_ptr = line;
sx = data_x;
- for (i = 0; i < w; ++i, ++sx) {
- /* Complement the components for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst[k] = dst_ptr[k * planestride];
- } else { /* Complement the components for subtractive color spaces */
- for (k = 0; k < num_comp; ++k)
- dst[k] = 255 - dst_ptr[k * planestride];
- dst[num_comp] = dst_ptr[num_comp * planestride];
- }
+ for (i = 0; i < w; ++i, ++sx) {
+ /* Complement the components for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst[k] = dst_ptr[k * planestride];
+ } else { /* Complement the components for subtractive color spaces */
+ for (k = 0; k < num_comp; ++k)
+ dst[k] = 255 - dst_ptr[k * planestride];
+ dst[num_comp] = dst_ptr[num_comp * planestride];
+ }
/* Get the aa alpha from the buffer */
if (depth == 2) { /* map 0 - 3 to 0 - 15 */
alpha_aa = ((aa_row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
} else {
alpha2_aa = aa_row[sx >> 1],
alpha_aa = (sx & 1 ? alpha2_aa & 0xf : alpha2_aa >> 4);
- }
+ }
/* Apply the alpha value if needed, updating our source color
Note that we probably could do this better */
- if (!(alpha_aa == 0 || alpha_aa == 15)) {
+ if (!(alpha_aa == 0 || alpha_aa == 15)) {
if (dst[num_comp] == 0) { /* nothing at destination yet */
- alpha_aa_act = (255 * alpha_aa) / 15;
+ alpha_aa_act = (255 * alpha_aa) / 15;
for (k = 0; k < num_comp; ++k) {
- src_aa[k] = ((float) alpha_aa_act * (float) src[k]
+ src_aa[k] = ((float) alpha_aa_act * (float) src[k]
+ (float) white[k] * (255.0 - (float) alpha_aa_act))/255.0;
}
src_use = &(src_aa[0]);
src_aa[num_comp] = src_alpha;
} else {
- alpha_aa_act = (255 * alpha_aa) / 15;
+ alpha_aa_act = (255 * alpha_aa) / 15;
for (k = 0; k < num_comp; ++k) {
- src_aa[k] = ((float) alpha_aa_act * (float) src[k]
+ src_aa[k] = ((float) alpha_aa_act * (float) src[k]
+ (float) dst[k] * (255.0 - (float) alpha_aa_act))/255.0;
}
src_use = &(src_aa[0]);
@@ -2034,58 +2029,58 @@ pdf14_copy_alpha(gx_device * dev, const byte * data, int data_x,
}
if (alpha_aa != 0) {
/* Then do what ever composing we need to do */
- art_pdf_composite_pixel_alpha_8(dst, src_use, num_comp,
- blend_mode, pdev->blend_procs);
- /* Complement the results for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst_ptr[k * planestride] = dst[k];
- } else {
- if (overprint) {
- for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) {
- if ((comps & 0x1) != 0) {
+ art_pdf_composite_pixel_alpha_8(dst, src_use, num_comp,
+ blend_mode, pdev->blend_procs);
+ /* Complement the results for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst_ptr[k * planestride] = dst[k];
+ } else {
+ if (overprint) {
+ for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) {
+ if ((comps & 0x1) != 0) {
dst_ptr[k * planestride] = 255 - dst[k];
- }
- }
- /* The alpha channel */
- dst_ptr[num_comp * planestride] = dst[num_comp];
+ }
+ }
+ /* The alpha channel */
+ dst_ptr[num_comp * planestride] = dst[num_comp];
} else {
- for (k = 0; k < num_comp; ++k)
- dst_ptr[k * planestride] = 255 - dst[k];
- /* The alpha channel */
+ for (k = 0; k < num_comp; ++k)
+ dst_ptr[k * planestride] = 255 - dst[k];
+ /* The alpha channel */
dst_ptr[num_comp * planestride] = dst[num_comp];
}
}
- if (has_alpha_g) {
- int tmp = (255 - dst_ptr[alpha_g_off]) * (255 - src_alpha) + 0x80;
- dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
- if (has_shape) {
- int tmp = (255 - dst_ptr[shape_off]) * (255 - shape) + 0x80;
- dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
+ if (has_alpha_g) {
+ int tmp = (255 - dst_ptr[alpha_g_off]) * (255 - src_alpha) + 0x80;
+ dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
+ if (has_shape) {
+ int tmp = (255 - dst_ptr[shape_off]) * (255 - shape) + 0x80;
+ dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
if (has_tags) {
/* If alpha is 100% then set to pure path, else or */
- if (dst[num_comp] == 255) {
+ if (dst[num_comp] == 255) {
dst_ptr[tag_off] = curr_tag;
} else {
dst_ptr[tag_off] = ( dst_ptr[tag_off] |curr_tag ) & ~GS_UNTOUCHED_TAG;
}
}
}
- ++dst_ptr;
- }
- line += rowstride;
+ ++dst_ptr;
+ }
+ line += rowstride;
}
return 0;
}
static int
pdf14_fill_mask(gx_device * orig_dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device *dev;
pdf14_device *p14dev = (pdf14_device *)orig_dev;
@@ -2101,9 +2096,9 @@ pdf14_fill_mask(gx_device * orig_dev,
if (pdcolor != NULL && gx_dc_is_pattern1_color(pdcolor)) {
if( gx_pattern1_get_transptr(pdcolor) != NULL) {
ptile = pdcolor->colors.pattern.p_tile;
- /* Set up things in the ptile so that we get the proper
+ /* Set up things in the ptile so that we get the proper
blending etc */
- /* Set the blending procs and the is_additive setting based
+ /* Set the blending procs and the is_additive setting based
upon the number of channels */
if (ptile->ttrans->n_chan-1 < 4) {
ptile->ttrans->blending_procs = &rgb_blending_procs;
@@ -2130,7 +2125,7 @@ pdf14_fill_mask(gx_device * orig_dev,
group_rect.q.y = y + h;
if (!(w <= 0 || h <= 0)) {
code = pdf14_push_transparency_group(p14dev->ctx, &group_rect,
- 1, 0, 255,255, ptile->ttrans->blending_mode, 0, 0,
+ 1, 0, 255,255, ptile->ttrans->blending_mode, 0, 0,
ptile->ttrans->n_chan-1);
/* Fix the reversed bbox. */
p14dev->ctx->stack->bbox.p.x = p14dev->ctx->rect.p.x;
@@ -2140,7 +2135,7 @@ pdf14_fill_mask(gx_device * orig_dev,
/* Set up the output buffer information now that we have
pushed the group */
fill_trans_buffer = new_pattern_trans_buff(p14dev->memory);
- pdf14_get_buffer_information((gx_device *) p14dev,
+ pdf14_get_buffer_information((gx_device *) p14dev,
fill_trans_buffer);
/* Store this in the appropriate place in pdcolor. This
is released later after the mask fill */
@@ -2150,25 +2145,25 @@ pdf14_fill_mask(gx_device * orig_dev,
}
}
if (pcpath != 0) {
- gx_make_clip_device_on_stack(&cdev, pcpath, orig_dev);
- dev = (gx_device *) & cdev;
+ gx_make_clip_device_on_stack(&cdev, pcpath, orig_dev);
+ dev = (gx_device *) & cdev;
} else
- dev = orig_dev;
+ dev = orig_dev;
if (depth > 1) {
- /****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
+ /****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
code = (*dev_proc(dev, copy_alpha))
- (dev, data, dx, raster, id, x, y, w, h,
- gx_dc_pure_color(pdcolor), depth);
+ (dev, data, dx, raster, id, x, y, w, h,
+ gx_dc_pure_color(pdcolor), depth);
} else {
code = pdcolor->type->fill_masked(pdcolor, data, dx, raster, id,
- x, y, w, h, dev, lop, false);
+ x, y, w, h, dev, lop, false);
}
if (has_pattern_trans) {
- code = pdf14_pop_transparency_group(NULL, p14dev->ctx,
- p14dev->blend_procs,
- p14dev->color_info.num_components,
+ code = pdf14_pop_transparency_group(NULL, p14dev->ctx,
+ p14dev->blend_procs,
+ p14dev->color_info.num_components,
p14dev->device_icc_profile, orig_dev);
- gs_free_object(p14dev->memory, ptile->ttrans->fill_trans_buffer,
+ gs_free_object(p14dev->memory, ptile->ttrans->fill_trans_buffer,
"pdf14_fill_mask");
ptile->ttrans->fill_trans_buffer = NULL; /* Avoid GC issues */
}
@@ -2179,8 +2174,8 @@ pdf14_fill_mask(gx_device * orig_dev,
has transparency */
static int
pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
int code = 0;
gs_imager_state *pis_noconst = (gs_imager_state *)pis; /* Break const. */
@@ -2199,14 +2194,14 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
if (pcpath != NULL) {
code = gx_cpath_init_local_shared(&cpath_intersection, pcpath, pdev->memory);
if (code < 0)
- return code;
+ return code;
} else {
(*dev_proc(pdev, get_clipping_box)) (pdev, &clip_box);
gx_cpath_init_local(&cpath_intersection, ppath->memory);
code = gx_cpath_from_rectangle(&cpath_intersection, &clip_box);
}
if (ppath != NULL)
- code = gx_cpath_intersect_with_params(&cpath_intersection, ppath,
+ code = gx_cpath_intersect_with_params(&cpath_intersection, ppath,
params->rule, pis_noconst, params);
/* Now let us push a transparency group into which we are
@@ -2218,7 +2213,7 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
rect.q.x = fixed2int_ceiling(outer_box.q.x);
rect.q.y = fixed2int_ceiling(outer_box.q.y);
- /* The color space of this group must be the same as that of the
+ /* The color space of this group must be the same as that of the
tile. Then when we pop the group, if there is a mismatch between
the tile color space and the current context we will do the proper
conversion. In this way, we ensure that if the tile has any overlapping
@@ -2226,11 +2221,11 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
underlying color space. */
ptile = pdevc->colors.pattern.p_tile;
code = pdf14_push_transparency_group(p14dev->ctx, &rect,
- 1, 0, 255,255,
- pis->blend_mode, 0,
- 0, ptile->ttrans->n_chan-1);
+ 1, 0, 255,255,
+ pis->blend_mode, 0,
+ 0, ptile->ttrans->n_chan-1);
- /* Set the blending procs and the is_additive setting based
+ /* Set the blending procs and the is_additive setting based
upon the number of channels */
if (ptile->ttrans->n_chan-1 < 4){
ptile->ttrans->blending_procs = &rgb_blending_procs;
@@ -2248,7 +2243,7 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
/* First get the buffer that we will be filling */
fill_trans_buffer = new_pattern_trans_buff(pis->memory);
pdf14_get_buffer_information(pdev, fill_trans_buffer);
- /* Set the blending mode in the ptile based upon the current
+ /* Set the blending mode in the ptile based upon the current
setting in the imager state */
ptile->ttrans->blending_mode = pis->blend_mode;
/* fill the rectangles */
@@ -2265,34 +2260,34 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
}
if (cpath_intersection.rect_list->list.head != NULL){
curr_clip_rect = cpath_intersection.rect_list->list.head->next;
- for( k = 0; k< cpath_intersection.rect_list->list.count; k++){
- if_debug5('v', "[v]pdf14_tile_pattern_fill, (%d, %d), %d x %d pat_id %d \n",
- curr_clip_rect->xmin, curr_clip_rect->ymin,
- curr_clip_rect->xmax-curr_clip_rect->xmin,
+ for( k = 0; k< cpath_intersection.rect_list->list.count; k++){
+ if_debug5('v', "[v]pdf14_tile_pattern_fill, (%d, %d), %d x %d pat_id %d \n",
+ curr_clip_rect->xmin, curr_clip_rect->ymin,
+ curr_clip_rect->xmax-curr_clip_rect->xmin,
curr_clip_rect->ymax-curr_clip_rect->ymin, ptile->id);
- ok = gx_trans_pattern_fill_rect(curr_clip_rect->xmin, curr_clip_rect->ymin,
+ ok = gx_trans_pattern_fill_rect(curr_clip_rect->xmin, curr_clip_rect->ymin,
curr_clip_rect->xmax, curr_clip_rect->ymax, ptile, fill_trans_buffer, phase);
curr_clip_rect = curr_clip_rect->next;
}
} else if (cpath_intersection.rect_list->list.count == 1) {
/* The case when there is just a single rect */
- if_debug5('v', "[v]pdf14_tile_pattern_fill, (%d, %d), %d x %d pat_id %d \n",
- cpath_intersection.rect_list->list.single.xmin, cpath_intersection.rect_list->list.single.ymin,
- cpath_intersection.rect_list->list.single.xmax-cpath_intersection.rect_list->list.single.xmin,
- cpath_intersection.rect_list->list.single.ymax-cpath_intersection.rect_list->list.single.ymin,
+ if_debug5('v', "[v]pdf14_tile_pattern_fill, (%d, %d), %d x %d pat_id %d \n",
+ cpath_intersection.rect_list->list.single.xmin, cpath_intersection.rect_list->list.single.ymin,
+ cpath_intersection.rect_list->list.single.xmax-cpath_intersection.rect_list->list.single.xmin,
+ cpath_intersection.rect_list->list.single.ymax-cpath_intersection.rect_list->list.single.ymin,
ptile->id);
- ok = gx_trans_pattern_fill_rect(cpath_intersection.rect_list->list.single.xmin,
- cpath_intersection.rect_list->list.single.ymin,
- cpath_intersection.rect_list->list.single.xmax,
- cpath_intersection.rect_list->list.single.ymax,
+ ok = gx_trans_pattern_fill_rect(cpath_intersection.rect_list->list.single.xmin,
+ cpath_intersection.rect_list->list.single.ymin,
+ cpath_intersection.rect_list->list.single.xmax,
+ cpath_intersection.rect_list->list.single.ymax,
ptile, fill_trans_buffer, phase);
}
/* free our buffer object */
gs_free_object(pis->memory, fill_trans_buffer, "pdf14_tile_pattern_fill");
ptile->ttrans->fill_trans_buffer = NULL; /* Avoid GC issues */
/* pop our transparency group which will force the blending */
- code = pdf14_pop_transparency_group(pis, p14dev->ctx, p14dev->blend_procs,
- p14dev->color_info.num_components,
+ code = pdf14_pop_transparency_group(pis, p14dev->ctx, p14dev->blend_procs,
+ p14dev->color_info.num_components,
p14dev->device_icc_profile, pdev);
}
return(code);
@@ -2302,7 +2297,7 @@ pdf14_tile_pattern_fill(gx_device * pdev, const gs_imager_state * pis,
the final flush, at which time we will pop the group and reset a few items */
static int
pdf14_pattern_trans_render(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
int code;
pdf14_device * p14dev = (pdf14_device *)dev;
@@ -2312,24 +2307,24 @@ pdf14_pattern_trans_render(gx_image_enum * penum, const byte * buffer, int data_
/* Pass along to the original renderer */
code = (ptile->ttrans->image_render)(penum, buffer, data_x, w, h, dev);
- /* On our final time through here, go ahead and pop the transparency
+ /* On our final time through here, go ahead and pop the transparency
group and reset the procs in the device color. And free the fill
trans buffer object */
if ( h == 0 && ptile->trans_group_popped == false) {
if (pis->is_gstate) {
/* Used if we are on clist writing phase. Would only
- occur if we somehow failed in high level clist
+ occur if we somehow failed in high level clist
image writing */
code = gs_end_transparency_group((gs_state *) pis);
} else {
/* Used if we are on clist reading phase. If we had high level
image in clist */
- code = pdf14_pop_transparency_group(NULL, p14dev->ctx, p14dev->blend_procs,
- p14dev->color_info.num_components,
+ code = pdf14_pop_transparency_group(NULL, p14dev->ctx, p14dev->blend_procs,
+ p14dev->color_info.num_components,
p14dev->device_icc_profile, (gx_device *) p14dev);
}
pdcolor->colors.pattern.p_tile->trans_group_popped = true;
- gs_free_object(pis->memory, ptile->ttrans->fill_trans_buffer,
+ gs_free_object(pis->memory, ptile->ttrans->fill_trans_buffer,
"pdf14_pattern_trans_render");
ptile->ttrans->fill_trans_buffer = NULL; /* Avoid GC issues */
}
@@ -2341,11 +2336,11 @@ pdf14_pattern_trans_render(gx_image_enum * penum, const byte * buffer, int data_
and pdf14_clist_begin_type_image */
static int
pdf14_patt_trans_image_fill(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
const gs_image_t *pim = (const gs_image_t *)pic;
pdf14_device * p14dev = (pdf14_device *)dev;
@@ -2357,9 +2352,9 @@ pdf14_patt_trans_image_fill(gx_device * dev, const gs_imager_state * pis,
gx_pattern_trans_t *fill_trans_buffer;
ptile = pdcolor->colors.pattern.p_tile;
- /* Set up things in the ptile so that we get the proper
+ /* Set up things in the ptile so that we get the proper
blending etc */
- /* Set the blending procs and the is_additive setting based
+ /* Set the blending procs and the is_additive setting based
upon the number of channels */
if (ptile->ttrans->n_chan-1 < 4) {
ptile->ttrans->blending_procs = &rgb_blending_procs;
@@ -2368,7 +2363,7 @@ pdf14_patt_trans_image_fill(gx_device * dev, const gs_imager_state * pis,
ptile->ttrans->blending_procs = &cmyk_blending_procs;
ptile->ttrans->is_additive = false;
}
- /* Set the blending mode in the ptile based upon the current
+ /* Set the blending mode in the ptile based upon the current
setting in the imager state */
ptile->ttrans->blending_mode = pis->blend_mode;
/* Based upon if the tiles overlap pick the type of rect
@@ -2383,26 +2378,26 @@ pdf14_patt_trans_image_fill(gx_device * dev, const gs_imager_state * pis,
/* Set the procs so that we use the proper filling method. */
gx_set_pattern_procs_trans((gx_device_color*) pdcolor);
/* Let the imaging stuff get set up */
- code = gx_default_begin_typed_image(dev, pis, pmat, pic,
+ code = gx_default_begin_typed_image(dev, pis, pmat, pic,
prect, pdcolor,pcpath, mem, pinfo);
/* Now Push the group */
- /* First apply the inverse of the image matrix to our
+ /* First apply the inverse of the image matrix to our
image size to get our bounding box. */
bbox_in.p.x = 0;
bbox_in.p.y = 0;
bbox_in.q.x = pim->Width;
bbox_in.q.y = pim->Height;
- code = gs_bbox_transform_inverse(&bbox_in, &(pim->ImageMatrix),
+ code = gs_bbox_transform_inverse(&bbox_in, &(pim->ImageMatrix),
&bbox_out);
if (code < 0) return code;
/* That in turn will get hit by the matrix in the imager state */
- code = compute_group_device_int_rect(p14dev, &group_rect,
+ code = compute_group_device_int_rect(p14dev, &group_rect,
&bbox_out, pis);
if (!(pim->Width == 0 || pim->Height == 0)) {
code = pdf14_push_transparency_group(p14dev->ctx, &group_rect,
- 1, 0, 255,255,
- pis->blend_mode, 0,
- 0, ptile->ttrans->n_chan-1);
+ 1, 0, 255,255,
+ pis->blend_mode, 0,
+ 0, ptile->ttrans->n_chan-1);
/* Fix the reversed bbox. Not clear on why the push group does that */
p14dev->ctx->stack->bbox.p.x = p14dev->ctx->rect.p.x;
p14dev->ctx->stack->bbox.p.y = p14dev->ctx->rect.p.y;
@@ -2426,14 +2421,14 @@ pdf14_patt_trans_image_fill(gx_device * dev, const gs_imager_state * pis,
}
return code;
}
-
+
static int
pdf14_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
const gs_image_t *pim = (const gs_image_t *)pic;
int code;
@@ -2444,18 +2439,18 @@ pdf14_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
if (pdcolor != NULL && gx_dc_is_pattern1_color(pdcolor)) {
if( gx_pattern1_get_transptr(pdcolor) != NULL){
/* If we are in a final run through here for this case then
- go ahead and push the transparency group. Also, update
+ go ahead and push the transparency group. Also, update
the proc for the pattern color so that we used the
appropriate fill operation. Note that the group
- is popped and the proc will be reset when we flush the
- image data. This is handled in a special pdf14 image
+ is popped and the proc will be reset when we flush the
+ image data. This is handled in a special pdf14 image
renderer which will end up installed for this case.
Detect setting of begin_image to gx_no_begin_image.
(final recursive call) */
if (dev->procs.begin_image != gx_default_begin_image) {
code = pdf14_patt_trans_image_fill(dev, pis, pmat, pic,
prect, pdcolor, pcpath, mem,
- pinfo);
+ pinfo);
return code;
}
}
@@ -2463,26 +2458,26 @@ pdf14_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
}
pdf14_set_marking_params(dev, pis);
return gx_default_begin_typed_image(dev, pis, pmat, pic, prect, pdcolor,
- pcpath, mem, pinfo);
+ pcpath, mem, pinfo);
}
static void
pdf14_set_params(gs_imager_state * pis, gx_device * dev,
- const gs_pdf14trans_params_t * pparams)
+ const gs_pdf14trans_params_t * pparams)
{
if_debug0('v', "[v]pdf14_set_params\n");
if (pparams->changed & PDF14_SET_BLEND_MODE)
- pis->blend_mode = pparams->blend_mode;
+ pis->blend_mode = pparams->blend_mode;
if (pparams->changed & PDF14_SET_TEXT_KNOCKOUT)
- pis->text_knockout = pparams->text_knockout;
+ pis->text_knockout = pparams->text_knockout;
if (pparams->changed & PDF14_SET_SHAPE_ALPHA)
- pis->shape.alpha = pparams->shape.alpha;
+ pis->shape.alpha = pparams->shape.alpha;
if (pparams->changed & PDF14_SET_OPACITY_ALPHA)
- pis->opacity.alpha = pparams->opacity.alpha;
+ pis->opacity.alpha = pparams->opacity.alpha;
if (pparams->changed & PDF14_SET_OVERPRINT)
- pis->overprint = pparams->overprint;
+ pis->overprint = pparams->overprint;
if (pparams->changed & PDF14_SET_OVERPRINT_MODE)
- pis->overprint_mode = pparams->overprint_mode;
+ pis->overprint_mode = pparams->overprint_mode;
pdf14_set_marking_params(dev, pis);
}
@@ -2505,9 +2500,9 @@ pdf14_forward_open_device(gx_device * dev)
/* The PDF 1.4 compositing devices must have a target */
if (tdev == 0)
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
if ((code = gs_opendevice(tdev)) >= 0)
- gx_device_copy_params(dev, tdev);
+ gx_device_copy_params(dev, tdev);
return code;
}
@@ -2572,62 +2567,62 @@ pdf14_determine_default_blend_cs(gx_device * pdev)
{
/* If num components is one, just go ahead and use gray. This avoids
issues with additive/subtractive mono color devices */
- if (pdev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE ||
+ if (pdev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE ||
pdev->color_info.num_components == 1)
- /*
- * Note: We do not allow the SeparationOrder device parameter for
- * additive devices. Thus we always have 1 colorant for DeviceGray
- * and 3 colorants for DeviceRGB.
- */
+ /*
+ * Note: We do not allow the SeparationOrder device parameter for
+ * additive devices. Thus we always have 1 colorant for DeviceGray
+ * and 3 colorants for DeviceRGB.
+ */
if (pdev->color_info.num_components == 1)
return PDF14_DeviceGray;
else
return PDF14_DeviceRGB;
else {
- /*
- * Check if the device is CMYK only or CMYK plus spot colors.
- */
- int i, output_comp_num, num_cmyk_used = 0, num_cmyk = 0;
+ /*
+ * Check if the device is CMYK only or CMYK plus spot colors.
+ */
+ int i, output_comp_num, num_cmyk_used = 0, num_cmyk = 0;
#if CUSTOM_BLENDING_MODE == ALWAYS_USE_CUSTOM_BLENDING
- return PDF14_DeviceCustom;
+ return PDF14_DeviceCustom;
#endif
- /*
- * Count the number of CMYK process components supported by the output
- * device.
- */
- for (i = 0; i < 4; i++) {
- const char * pcomp_name = (const char *)DeviceCMYKComponents[i];
-
- output_comp_num = dev_proc(pdev, get_color_comp_index)
- (pdev, pcomp_name, strlen(pcomp_name), NO_COMP_NAME_TYPE);
- if (output_comp_num >= 0) {
- num_cmyk++;
- if (output_comp_num != GX_DEVICE_COLOR_MAX_COMPONENTS)
- num_cmyk_used++;
- }
- }
- /*
- * Check if the device supports only CMYK. Otherewise we assume that
- * the output device supports spot colors. Note: This algorithm can
- * be fooled if the SeparationOrder device parameter is being used by
- * the output device device to only select CMYK.
- */
- if (num_cmyk_used == 4 && pdev->color_info.num_components == 4
- && pdev->color_info.max_components == 4)
- return PDF14_DeviceCMYK;
- /*
- * Check if we should use the 'custom' PDF 1.4 compositor device.
- * This device is only needed for those devices which do not support
- * a basic CMYK process color model.
- */
+ /*
+ * Count the number of CMYK process components supported by the output
+ * device.
+ */
+ for (i = 0; i < 4; i++) {
+ const char * pcomp_name = (const char *)DeviceCMYKComponents[i];
+
+ output_comp_num = dev_proc(pdev, get_color_comp_index)
+ (pdev, pcomp_name, strlen(pcomp_name), NO_COMP_NAME_TYPE);
+ if (output_comp_num >= 0) {
+ num_cmyk++;
+ if (output_comp_num != GX_DEVICE_COLOR_MAX_COMPONENTS)
+ num_cmyk_used++;
+ }
+ }
+ /*
+ * Check if the device supports only CMYK. Otherewise we assume that
+ * the output device supports spot colors. Note: This algorithm can
+ * be fooled if the SeparationOrder device parameter is being used by
+ * the output device device to only select CMYK.
+ */
+ if (num_cmyk_used == 4 && pdev->color_info.num_components == 4
+ && pdev->color_info.max_components == 4)
+ return PDF14_DeviceCMYK;
+ /*
+ * Check if we should use the 'custom' PDF 1.4 compositor device.
+ * This device is only needed for those devices which do not support
+ * a basic CMYK process color model.
+ */
#if CUSTOM_BLENDING_MODE == AUTO_USE_CUSTOM_BLENDING
- if (num_cmyk != 4)
- return PDF14_DeviceCustom;
+ if (num_cmyk != 4)
+ return PDF14_DeviceCustom;
#endif
- /*
- * Otherewise we use a CMYK plus spot colors for blending.
- */
- return PDF14_DeviceCMYKspot;
+ /*
+ * Otherewise we use a CMYK plus spot colors for blending.
+ */
+ return PDF14_DeviceCMYKspot;
}
}
@@ -2639,15 +2634,15 @@ pdf14_determine_default_blend_cs(gx_device * pdev)
*/
static int
get_pdf14_device_proto(gx_device * dev, pdf14_device ** pdevproto,
- pdf14_device * ptempdevproto, gs_imager_state * pis,
- const gs_pdf14trans_t * pdf14pct)
+ pdf14_device * ptempdevproto, gs_imager_state * pis,
+ const gs_pdf14trans_t * pdf14pct)
{
pdf14_default_colorspace_t dev_cs =
- pdf14_determine_default_blend_cs(dev);
+ pdf14_determine_default_blend_cs(dev);
switch (dev_cs) {
- case PDF14_DeviceGray:
- *pdevproto = (pdf14_device *)&gs_pdf14_Gray_device;
+ case PDF14_DeviceGray:
+ *pdevproto = (pdf14_device *)&gs_pdf14_Gray_device;
*ptempdevproto = **pdevproto;
ptempdevproto->color_info.max_components = 1;
ptempdevproto->color_info.num_components = ptempdevproto->color_info.max_components;
@@ -2657,24 +2652,24 @@ get_pdf14_device_proto(gx_device * dev, pdf14_device ** pdevproto,
strcpy(&(ptempdevproto->color_info.icc_profile[0]), dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceRGB:
- *pdevproto = (pdf14_device *)&gs_pdf14_RGB_device;
+ break;
+ case PDF14_DeviceRGB:
+ *pdevproto = (pdf14_device *)&gs_pdf14_RGB_device;
*ptempdevproto = **pdevproto;
/* PDF14 Device should inherent the ICC color info of the parent.
If the parent does not have one, (and it should) then use
the default. The default is also used if we have something
like CIELAB as a destination space. */
- if (dev->color_info.icc_profile == '\0' ||
+ if (dev->color_info.icc_profile == '\0' ||
dev->device_icc_profile->data_cs == gsCIELAB) {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), DEFAULT_RGB_ICC);
} else {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceCMYK:
- *pdevproto = (pdf14_device *)&gs_pdf14_CMYK_device;
+ break;
+ case PDF14_DeviceCMYK:
+ *pdevproto = (pdf14_device *)&gs_pdf14_CMYK_device;
*ptempdevproto = **pdevproto;
if (dev->color_info.icc_profile == '\0') {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), DEFAULT_CMYK_ICC);
@@ -2682,62 +2677,62 @@ get_pdf14_device_proto(gx_device * dev, pdf14_device ** pdevproto,
strcpy(&(ptempdevproto->color_info.icc_profile[0]), dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceCMYKspot:
- *pdevproto = (pdf14_device *)&gs_pdf14_CMYKspot_device;
+ break;
+ case PDF14_DeviceCMYKspot:
+ *pdevproto = (pdf14_device *)&gs_pdf14_CMYKspot_device;
/* Need to figure out how we want to handle the device profile
for this case */
- /*
- * The number of components for the PDF14 device is the sum
- * of the process components and the number of spot colors
- * for the page.
- */
- if (pdf14pct->params.num_spot_colors >= 0) {
- *ptempdevproto = **pdevproto;
- ptempdevproto->devn_params.page_spot_colors =
- pdf14pct->params.num_spot_colors;
- ptempdevproto->color_info.num_components =
- ptempdevproto->devn_params.num_std_colorant_names +
- pdf14pct->params.num_spot_colors;
- if (ptempdevproto->color_info.num_components >
- ptempdevproto->color_info.max_components)
- ptempdevproto->color_info.num_components =
- ptempdevproto->color_info.max_components;
- *pdevproto = ptempdevproto;
- }
+ /*
+ * The number of components for the PDF14 device is the sum
+ * of the process components and the number of spot colors
+ * for the page.
+ */
+ if (pdf14pct->params.num_spot_colors >= 0) {
+ *ptempdevproto = **pdevproto;
+ ptempdevproto->devn_params.page_spot_colors =
+ pdf14pct->params.num_spot_colors;
+ ptempdevproto->color_info.num_components =
+ ptempdevproto->devn_params.num_std_colorant_names +
+ pdf14pct->params.num_spot_colors;
+ if (ptempdevproto->color_info.num_components >
+ ptempdevproto->color_info.max_components)
+ ptempdevproto->color_info.num_components =
+ ptempdevproto->color_info.max_components;
+ *pdevproto = ptempdevproto;
+ }
if (dev->color_info.icc_profile == '\0') {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), DEFAULT_CMYK_ICC);
} else {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), dev->color_info.icc_profile);
}
- break;
- case PDF14_DeviceCustom:
- /*
- * We are using the output device's process color model. The
- * color_info for the PDF 1.4 compositing device needs to match
- * the output device.
- */
- *ptempdevproto = gs_pdf14_custom_device;
- ptempdevproto->color_info = dev->color_info;
+ break;
+ case PDF14_DeviceCustom:
+ /*
+ * We are using the output device's process color model. The
+ * color_info for the PDF 1.4 compositing device needs to match
+ * the output device.
+ */
+ *ptempdevproto = gs_pdf14_custom_device;
+ ptempdevproto->color_info = dev->color_info;
/* The pdf14 device has to be 8 bit continuous tone. Force it */
- ptempdevproto->color_info.depth =
+ ptempdevproto->color_info.depth =
ptempdevproto->color_info.num_components * 8;
- ptempdevproto->color_info.max_gray = 255;
+ ptempdevproto->color_info.max_gray = 255;
ptempdevproto->color_info.max_color = 255;
ptempdevproto->color_info.dither_grays = 256;
ptempdevproto->color_info.dither_colors = 256;
-
+
*pdevproto = ptempdevproto;
if (dev->color_info.icc_profile == '\0') {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
DEFAULT_CMYK_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
- break;
- default: /* Should not occur */
- return_error(gs_error_rangecheck);
+ break;
+ default: /* Should not occur */
+ return_error(gs_error_rangecheck);
}
return 0;
}
@@ -2751,7 +2746,7 @@ get_pdf14_device_proto(gx_device * dev, pdf14_device ** pdevproto,
*/
static int
pdf14_recreate_device(gs_memory_t *mem, gs_imager_state * pis,
- gx_device * dev, const gs_pdf14trans_t * pdf14pct)
+ gx_device * dev, const gs_pdf14trans_t * pdf14pct)
{
pdf14_device * pdev = (pdf14_device *)dev;
gx_device * target = pdev->target;
@@ -2766,9 +2761,9 @@ pdf14_recreate_device(gs_memory_t *mem, gs_imager_state * pis,
* color related info and the device procs to match the prototype.
*/
code = get_pdf14_device_proto(target, &dev_proto,
- &temp_dev_proto, pis, pdf14pct);
+ &temp_dev_proto, pis, pdf14pct);
if (code < 0)
- return code;
+ return code;
pdev->color_info = dev_proto->color_info;
pdev->procs = dev_proto->procs;
dev->static_procs = dev_proto->static_procs;
@@ -2792,53 +2787,53 @@ gx_update_pdf14_compositor(gx_device * pdev, gs_imager_state * pis,
params.idle = pdf14pct->idle;
switch (params.pdf14_op) {
- default: /* Should not occur. */
- break;
- case PDF14_PUSH_DEVICE:
- p14dev->blend_mode = 0;
- p14dev->opacity = p14dev->shape = 0.0;
- pdf14_recreate_device(mem, pis, pdev, pdf14pct);
- break;
- case PDF14_POP_DEVICE:
- if_debug0('v', "[v]gx_update_pdf14_compositor(PDF14_POP_DEVICE)\n");
- pis->get_cmap_procs = p14dev->save_get_cmap_procs;
- gx_set_cmap_procs(pis, p14dev->target);
- /* Send image out raster data to output device */
+ default: /* Should not occur. */
+ break;
+ case PDF14_PUSH_DEVICE:
+ p14dev->blend_mode = 0;
+ p14dev->opacity = p14dev->shape = 0.0;
+ pdf14_recreate_device(mem, pis, pdev, pdf14pct);
+ break;
+ case PDF14_POP_DEVICE:
+ if_debug0('v', "[v]gx_update_pdf14_compositor(PDF14_POP_DEVICE)\n");
+ pis->get_cmap_procs = p14dev->save_get_cmap_procs;
+ gx_set_cmap_procs(pis, p14dev->target);
+ /* Send image out raster data to output device */
{
- /* Make a copy so we can change the ROP */
- gs_imager_state new_is = *pis;
-
- /* We don't use the imager state log_op since this is for the */
- /* clist playback. Putting the image (band in the case of the */
- /* clist) only needs to use the default ROP to copy the data */
- new_is.log_op = rop3_default;
- p14dev->pdf14_procs->put_image(pdev, &new_is, p14dev->target);
- }
+ /* Make a copy so we can change the ROP */
+ gs_imager_state new_is = *pis;
+
+ /* We don't use the imager state log_op since this is for the */
+ /* clist playback. Putting the image (band in the case of the */
+ /* clist) only needs to use the default ROP to copy the data */
+ new_is.log_op = rop3_default;
+ p14dev->pdf14_procs->put_image(pdev, &new_is, p14dev->target);
+ }
/* Before we disable the device release any deviceN structures.
- free_devicen is set if the pdf14 device had inherited its
+ free_devicen is set if the pdf14 device had inherited its
deviceN parameters from the target clist device. In this
case they should not be freed */
if (p14dev->free_devicen) {
devn_free_params(pdev);
}
- pdf14_disable_device(pdev);
- pdf14_close(pdev);
- break;
- case PDF14_BEGIN_TRANS_GROUP:
- code = gx_begin_transparency_group(pis, pdev, &params);
- break;
- case PDF14_END_TRANS_GROUP:
- code = gx_end_transparency_group(pis, pdev);
- break;
- case PDF14_BEGIN_TRANS_MASK:
- code = gx_begin_transparency_mask(pis, pdev, &params);
- break;
- case PDF14_END_TRANS_MASK:
- code = gx_end_transparency_mask(pis, pdev, &params);
- break;
- case PDF14_SET_BLEND_PARAMS:
- pdf14_set_params(pis, pdev, &pdf14pct->params);
- break;
+ pdf14_disable_device(pdev);
+ pdf14_close(pdev);
+ break;
+ case PDF14_BEGIN_TRANS_GROUP:
+ code = gx_begin_transparency_group(pis, pdev, &params);
+ break;
+ case PDF14_END_TRANS_GROUP:
+ code = gx_end_transparency_group(pis, pdev);
+ break;
+ case PDF14_BEGIN_TRANS_MASK:
+ code = gx_begin_transparency_mask(pis, pdev, &params);
+ break;
+ case PDF14_END_TRANS_MASK:
+ code = gx_end_transparency_mask(pis, pdev, &params);
+ break;
+ case PDF14_SET_BLEND_PARAMS:
+ pdf14_set_params(pis, pdev, &pdf14pct->params);
+ break;
case PDF14_PUSH_TRANS_STATE:
code = gx_push_transparency_state(pis, pdev);
break;
@@ -2865,8 +2860,8 @@ gx_update_pdf14_compositor(gx_device * pdev, gs_imager_state * pis,
*/
static int
pdf14_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
- const gs_composite_t * pct, gs_imager_state * pis,
- gs_memory_t * mem, gx_device *cdev)
+ const gs_composite_t * pct, gs_imager_state * pis,
+ gs_memory_t * mem, gx_device *cdev)
{
pdf14_device *pdev = (pdf14_device *)dev;
gx_device * tdev = pdev->target;
@@ -2875,15 +2870,15 @@ pdf14_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
*pcdev = dev;
if (gs_is_pdf14trans_compositor(pct)) {
- const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
+ const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
- if (pdf14pct->params.pdf14_op == PDF14_PUSH_DEVICE)
- return gx_update_pdf14_compositor(dev, pis, pdf14pct, mem);
- return 0;
+ if (pdf14pct->params.pdf14_op == PDF14_PUSH_DEVICE)
+ return gx_update_pdf14_compositor(dev, pis, pdf14pct, mem);
+ return 0;
}
code = dev_proc(tdev, create_compositor)(tdev, &ndev, pct, pis, mem, cdev);
if (code < 0)
- return code;
+ return code;
gx_device_set_target((gx_device_forward *)pdev, ndev);
return 0;
}
@@ -2895,46 +2890,46 @@ pdf14_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
*/
static int
pdf14_create_compositor(gx_device * dev, gx_device * * pcdev,
- const gs_composite_t * pct, gs_imager_state * pis,
- gs_memory_t * mem, gx_device *cdev)
+ const gs_composite_t * pct, gs_imager_state * pis,
+ gs_memory_t * mem, gx_device *cdev)
{
- pdf14_device *p14dev = (pdf14_device *)dev;
- if (gs_is_pdf14trans_compositor(pct)) {
- const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
- *pcdev = dev;
- /* cdev, may be the clist reader device which may contain information that
- we will need related to the ICC color spaces that define transparency
- groups. We want this propogated through all the pdf14 functions. Store
+ pdf14_device *p14dev = (pdf14_device *)dev;
+ if (gs_is_pdf14trans_compositor(pct)) {
+ const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
+ *pcdev = dev;
+ /* cdev, may be the clist reader device which may contain information that
+ we will need related to the ICC color spaces that define transparency
+ groups. We want this propogated through all the pdf14 functions. Store
a pointer to it in the pdf14 device */
p14dev->pclist_device = cdev;
- return gx_update_pdf14_compositor(dev, pis, pdf14pct, mem);
+ return gx_update_pdf14_compositor(dev, pis, pdf14pct, mem);
} else if (gs_is_overprint_compositor(pct)) {
- /* If we had an overprint compositer action, then the
- color components that were drawn should be updated.
- The overprint compositor logic and its interactions
- with the clist is a little odd as it passes uninitialized
- values around a fair amount. Hence the forced assignement here.
- See gx_spot_colors_set_overprint in gscspace for issues... */
- const gs_overprint_t * op_pct = (const gs_overprint_t *) pct;
- if (op_pct->params.retain_any_comps && !op_pct->params.retain_spot_comps) {
+ /* If we had an overprint compositer action, then the
+ color components that were drawn should be updated.
+ The overprint compositor logic and its interactions
+ with the clist is a little odd as it passes uninitialized
+ values around a fair amount. Hence the forced assignement here.
+ See gx_spot_colors_set_overprint in gscspace for issues... */
+ const gs_overprint_t * op_pct = (const gs_overprint_t *) pct;
+ if (op_pct->params.retain_any_comps && !op_pct->params.retain_spot_comps) {
p14dev->drawn_comps = op_pct->params.drawn_comps;
- } else {
- /* Draw everything. If this parameter was not set, clist does
+ } else {
+ /* Draw everything. If this parameter was not set, clist does
not fill it in. */
- p14dev->drawn_comps = ( (gx_color_index) 1 << (p14dev->color_info.num_components)) - (gx_color_index) 1;
- }
- *pcdev = dev;
- return 0;
+ p14dev->drawn_comps = ( (gx_color_index) 1 << (p14dev->color_info.num_components)) - (gx_color_index) 1;
+ }
+ *pcdev = dev;
+ return 0;
} else
- return gx_no_create_compositor(dev, pcdev, pct, pis, mem, cdev);
+ return gx_no_create_compositor(dev, pcdev, pct, pis, mem, cdev);
}
static int
pdf14_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * memory,
- gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * memory,
+ gs_text_enum_t ** ppenum)
{
int code;
gs_text_enum_t *penum;
@@ -2942,9 +2937,9 @@ pdf14_text_begin(gx_device * dev, gs_imager_state * pis,
if_debug0('v', "[v]pdf14_text_begin\n");
pdf14_set_marking_params(dev, pis);
code = gx_default_text_begin(dev, pis, text, font, path, pdcolor, pcpath,
- memory, &penum);
+ memory, &penum);
if (code < 0)
- return code;
+ return code;
*ppenum = (gs_text_enum_t *)penum;
return code;
}
@@ -2954,8 +2949,8 @@ pdf14_text_begin(gx_device * dev, gs_imager_state * pis,
*/
static int
pdf14_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
const byte *sptr;
const byte *line;
@@ -2971,85 +2966,85 @@ pdf14_copy_mono(gx_device * dev,
/* Loop through the height of the specfied area. */
while (h-- > 0) {
- /* Set up for the start of each line of the area. */
- sptr = line;
- sbyte = *sptr++;
- bit = first_bit;
- count = w;
+ /* Set up for the start of each line of the area. */
+ sptr = line;
+ sbyte = *sptr++;
+ bit = first_bit;
+ count = w;
run_length = 0;
- startx = x;
- current_bit = 0;
+ startx = x;
+ current_bit = 0;
current_color = zero;
- /* Loop across each pixel of a line. */
- do {
- bit_value = (sbyte >> bit) & 1;
- if (bit_value == current_bit) {
- /* The value did not change, simply increment our run length */
- run_length++;
- } else {
- /* The value changed, fill the current rectangle. */
- if (run_length != 0) {
- if (current_color != gx_no_color_index) {
- code = (*dev_proc(dev, fill_rectangle))
- (dev, startx, y, run_length, 1, current_color);
- if (code < 0)
- return code;
- }
- startx += run_length;
- }
- run_length = 1;
- current_color = bit_value ? one : zero;
- current_bit = bit_value;
- }
- /* Move to the next input bit. */
- if (bit == 0) {
- bit = 7;
- sbyte = *sptr++;
- }
- else
- bit--;
- } while (--count > 0);
- /* Fill the last rectangle in the line. */
- if (run_length != 0 && current_color != gx_no_color_index) {
- code = (*dev_proc(dev, fill_rectangle))
- (dev, startx, y, run_length, 1, current_color);
- if (code < 0)
- return code;
- }
- /* Move to the next line */
- line += sraster;
- y++;
+ /* Loop across each pixel of a line. */
+ do {
+ bit_value = (sbyte >> bit) & 1;
+ if (bit_value == current_bit) {
+ /* The value did not change, simply increment our run length */
+ run_length++;
+ } else {
+ /* The value changed, fill the current rectangle. */
+ if (run_length != 0) {
+ if (current_color != gx_no_color_index) {
+ code = (*dev_proc(dev, fill_rectangle))
+ (dev, startx, y, run_length, 1, current_color);
+ if (code < 0)
+ return code;
+ }
+ startx += run_length;
+ }
+ run_length = 1;
+ current_color = bit_value ? one : zero;
+ current_bit = bit_value;
+ }
+ /* Move to the next input bit. */
+ if (bit == 0) {
+ bit = 7;
+ sbyte = *sptr++;
+ }
+ else
+ bit--;
+ } while (--count > 0);
+ /* Fill the last rectangle in the line. */
+ if (run_length != 0 && current_color != gx_no_color_index) {
+ code = (*dev_proc(dev, fill_rectangle))
+ (dev, startx, y, run_length, 1, current_color);
+ if (code < 0)
+ return code;
+ }
+ /* Move to the next line */
+ line += sraster;
+ y++;
}
return 0;
}
static int
pdf14_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_buf *buf = pdev->ctx->stack;
fit_fill_xywh(dev, x, y, w, h);
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
if (buf->knockout)
- return pdf14_mark_fill_rectangle_ko_simple(dev, x, y, w, h, color);
+ return pdf14_mark_fill_rectangle_ko_simple(dev, x, y, w, h, color);
else
- return pdf14_mark_fill_rectangle(dev, x, y, w, h, color);
+ return pdf14_mark_fill_rectangle(dev, x, y, w, h, color);
}
-static int
-pdf14_compute_group_device_int_rect(const gs_matrix *ctm,
- const gs_rect *pbbox, gs_int_rect *rect)
+static int
+pdf14_compute_group_device_int_rect(const gs_matrix *ctm,
+ const gs_rect *pbbox, gs_int_rect *rect)
{
gs_rect dev_bbox;
int code;
code = gs_bbox_transform(pbbox, ctm, &dev_bbox);
if (code < 0)
- return code;
+ return code;
rect->p.x = (int)floor(dev_bbox.p.x);
rect->p.y = (int)floor(dev_bbox.p.y);
rect->q.x = (int)ceil(dev_bbox.q.x);
@@ -3058,29 +3053,29 @@ pdf14_compute_group_device_int_rect(const gs_matrix *ctm,
}
static int
-compute_group_device_int_rect(pdf14_device *pdev, gs_int_rect *rect,
+compute_group_device_int_rect(pdf14_device *pdev, gs_int_rect *rect,
const gs_rect *pbbox, gs_imager_state *pis)
{
int code = pdf14_compute_group_device_int_rect(&ctm_only(pis), pbbox, rect);
if (code < 0)
- return code;
+ return code;
rect_intersect(*rect, pdev->ctx->rect);
/* Make sure the rectangle is not anomalous (q < p) -- see gsrect.h */
if (rect->q.x < rect->p.x)
- rect->q.x = rect->p.x;
+ rect->q.x = rect->p.x;
if (rect->q.y < rect->p.y)
- rect->q.y = rect->p.y;
+ rect->q.y = rect->p.y;
return 0;
}
static int
pdf14_begin_transparency_group(gx_device *dev,
- const gs_transparency_group_params_t *ptgp,
- const gs_rect *pbbox,
- gs_imager_state *pis,
- gs_transparency_state_t **ppts,
- gs_memory_t *mem)
+ const gs_transparency_group_params_t *ptgp,
+ const gs_rect *pbbox,
+ gs_imager_state *pis,
+ gs_transparency_state_t **ppts,
+ gs_memory_t *mem)
{
pdf14_device *pdev = (pdf14_device *)dev;
double alpha = pis->opacity.alpha * pis->shape.alpha;
@@ -3092,16 +3087,16 @@ pdf14_begin_transparency_group(gx_device *dev,
gs_transparency_color_t group_color;
cmm_profile_t *curr_profile;
- /* If the target device supports separations, then
- we should should NOT create the group. The exception to this
+ /* If the target device supports separations, then
+ we should should NOT create the group. The exception to this
rule would be if we just popped a transparency mask */
code = compute_group_device_int_rect(pdev, &rect, pbbox, pis);
if (code < 0)
- return code;
+ return code;
if_debug4('v', "[v]pdf14_begin_transparency_group, I = %d, K = %d, alpha = %g, bm = %d\n",
- ptgp->Isolated, ptgp->Knockout, alpha, pis->blend_mode);
+ ptgp->Isolated, ptgp->Knockout, alpha, pis->blend_mode);
/* If the group color is unknown then use the current device profile. Note
that if we have a sep device there may not be a profile */
if (ptgp->group_color == UNKNOWN){
@@ -3113,7 +3108,7 @@ pdf14_begin_transparency_group(gx_device *dev,
group_color_numcomps = pdev->color_info.num_components;
}
/* If we are not going out to a sep device then use
- the ICC color space defined by the device profile
+ the ICC color space defined by the device profile
in the ICC manager. This is reset for each
group push. */
if (group_color_numcomps < 5 ) {
@@ -3121,11 +3116,11 @@ pdf14_begin_transparency_group(gx_device *dev,
curr_profile = dev->device_icc_profile;
} else {
/* We can end up here if we are in
- a deviceN color space and
+ a deviceN color space and
we have a sep output device */
group_color = DEVICEN;
curr_profile = NULL;
- }
+ }
} else {
group_color_numcomps = ptgp->group_color_numcomps;
group_color = ptgp->group_color;
@@ -3136,7 +3131,7 @@ pdf14_begin_transparency_group(gx_device *dev,
if (!sep_target) {
if (curr_profile != NULL) {
/* If the cs is different then force isolation */
- if ( curr_profile->hashcode ==
+ if ( curr_profile->hashcode ==
dev->device_icc_profile->hashcode) {
/* cs same. use parameter setting */
isolated = ptgp->Isolated;
@@ -3155,7 +3150,7 @@ pdf14_begin_transparency_group(gx_device *dev,
isolated = true;
}
}
- code = pdf14_update_device_color_procs(dev, group_color,
+ code = pdf14_update_device_color_procs(dev, group_color,
ptgp->icc_hashcode, pis, curr_profile);
if_debug0('v', "[v]Transparency group color space update\n");
} else {
@@ -3165,20 +3160,20 @@ pdf14_begin_transparency_group(gx_device *dev,
}
if (code < 0)
- return code;
+ return code;
code = pdf14_push_transparency_group(pdev->ctx, &rect,
- isolated, ptgp->Knockout,
- (byte)floor (255 * alpha + 0.5),
- (byte)floor (255 * pis->shape.alpha + 0.5),
- pis->blend_mode, ptgp->idle,
- ptgp->mask_id,group_color_numcomps);
+ isolated, ptgp->Knockout,
+ (byte)floor (255 * alpha + 0.5),
+ (byte)floor (255 * pis->shape.alpha + 0.5),
+ pis->blend_mode, ptgp->idle,
+ ptgp->mask_id,group_color_numcomps);
return code;
}
static int
pdf14_end_transparency_group(gx_device *dev,
- gs_imager_state *pis,
- gs_transparency_state_t **ppts)
+ gs_imager_state *pis,
+ gs_transparency_state_t **ppts)
{
pdf14_device *pdev = (pdf14_device *)dev;
int code;
@@ -3198,19 +3193,19 @@ pdf14_end_transparency_group(gx_device *dev,
* to a mismatch between the parents color space
* and the group blending space */
parent_color = pdev->ctx->stack->parent_color_info_procs;
- if (!(parent_color->parent_color_mapping_procs == NULL &&
- parent_color->parent_color_comp_index == NULL)) {
- pis->get_cmap_procs = parent_color->get_cmap_procs;
- gx_set_cmap_procs(pis, dev);
- pdev->procs.get_color_mapping_procs =
+ if (!(parent_color->parent_color_mapping_procs == NULL &&
+ parent_color->parent_color_comp_index == NULL)) {
+ pis->get_cmap_procs = parent_color->get_cmap_procs;
+ gx_set_cmap_procs(pis, dev);
+ pdev->procs.get_color_mapping_procs =
parent_color->parent_color_mapping_procs;
- pdev->procs.get_color_comp_index =
+ pdev->procs.get_color_comp_index =
parent_color->parent_color_comp_index;
- pdev->color_info.polarity = parent_color->polarity;
- pdev->color_info.num_components = parent_color->num_components;
- pdev->blend_procs = parent_color->parent_blending_procs;
- pdev->ctx->additive = parent_color->isadditive;
- pdev->pdf14_procs = parent_color->unpack_procs;
+ pdev->color_info.polarity = parent_color->polarity;
+ pdev->color_info.num_components = parent_color->num_components;
+ pdev->blend_procs = parent_color->parent_blending_procs;
+ pdev->ctx->additive = parent_color->isadditive;
+ pdev->pdf14_procs = parent_color->unpack_procs;
pdev->color_info.depth = parent_color->depth;
pdev->color_info.max_color = parent_color->max_color;
pdev->color_info.max_gray = parent_color->max_gray;
@@ -3218,9 +3213,9 @@ pdf14_end_transparency_group(gx_device *dev,
GX_DEVICE_COLOR_MAX_COMPONENTS);
memcpy(&(pdev->color_info.comp_shift),&(parent_color->comp_shift),
GX_DEVICE_COLOR_MAX_COMPONENTS);
- parent_color->get_cmap_procs = NULL;
- parent_color->parent_color_comp_index = NULL;
- parent_color->parent_color_mapping_procs = NULL;
+ parent_color->get_cmap_procs = NULL;
+ parent_color->parent_color_comp_index = NULL;
+ parent_color->parent_color_mapping_procs = NULL;
if (parent_color->icc_profile != NULL) {
/* make sure to decrement the device profile. If it was allocated
with the push then it will be freed. */
@@ -3228,7 +3223,7 @@ pdf14_end_transparency_group(gx_device *dev,
dev->device_icc_profile = parent_color->icc_profile;
rc_decrement(parent_color->icc_profile,"pdf14_end_transparency_group");
parent_color->icc_profile = NULL;
- }
+ }
}
vd_release_dc;
return code;
@@ -3236,8 +3231,8 @@ pdf14_end_transparency_group(gx_device *dev,
static int
pdf14_update_device_color_procs(gx_device *dev,
- gs_transparency_color_t group_color,
- int64_t icc_hashcode, gs_imager_state *pis,
+ gs_transparency_color_t group_color,
+ int64_t icc_hashcode, gs_imager_state *pis,
cmm_profile_t *iccprofile)
{
pdf14_device *pdevproto = NULL;
@@ -3252,7 +3247,7 @@ pdf14_update_device_color_procs(gx_device *dev,
byte comp_bits[] = {0,0,0,0};
byte comp_shift[] = {0,0,0,0};
int k;
- bool has_tags = (dev->memory->gs_lib_ctx->BITTAG !=
+ bool has_tags = (dev->memory->gs_lib_ctx->BITTAG !=
GS_DEVICE_DOESNT_SUPPORT_TAGS);
if (pdev->ctx->stack != NULL){
@@ -3263,16 +3258,16 @@ pdf14_update_device_color_procs(gx_device *dev,
}
if_debug0('v', "[v]pdf14_update_device_color_procs\n");
- /* Update the device procs at this stage. Many of the procs are based upon
- the color space of the device. We want to remain in the color space
- defined by the color space of the soft mask or transparency group as
- opposed to the device color space. Later, when we pop the softmask we will
- collapse it to a single band and then compose with it to the device color
- space (or the parent layer space). In the case where we pop an isolated
- transparency group, we will do the blending in the proper color space and
- then transform the data when we pop the group. Remember that only isolated
+ /* Update the device procs at this stage. Many of the procs are based upon
+ the color space of the device. We want to remain in the color space
+ defined by the color space of the soft mask or transparency group as
+ opposed to the device color space. Later, when we pop the softmask we will
+ collapse it to a single band and then compose with it to the device color
+ space (or the parent layer space). In the case where we pop an isolated
+ transparency group, we will do the blending in the proper color space and
+ then transform the data when we pop the group. Remember that only isolated
groups can have color spaces that are different than their parent. */
- parent_color_info->get_cmap_procs = NULL;
+ parent_color_info->get_cmap_procs = NULL;
parent_color_info->parent_color_mapping_procs = NULL;
parent_color_info->parent_color_comp_index = NULL;
switch (group_color) {
@@ -3284,10 +3279,10 @@ pdf14_update_device_color_procs(gx_device *dev,
new_14procs = &gray_pdf14_procs;
new_depth = 8;
comp_bits[0] = 8;
- comp_shift[0] = 0;
+ comp_shift[0] = 0;
break;
- case DEVICE_RGB:
- case CIE_XYZ:
+ case DEVICE_RGB:
+ case CIE_XYZ:
new_polarity = GX_CINFO_POLARITY_ADDITIVE;
new_num_comps = 3;
pdevproto = (pdf14_device *)&gs_pdf14_RGB_device;
@@ -3296,12 +3291,12 @@ pdf14_update_device_color_procs(gx_device *dev,
new_depth = 24;
for (k = 0; k < 3; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (2-k)*8;
+ comp_shift[k] = (2-k)*8;
}
- break;
- case DEVICE_CMYK:
+ break;
+ case DEVICE_CMYK:
new_polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
- new_num_comps = 4;
+ new_num_comps = 4;
pdevproto = (pdf14_device *)&gs_pdf14_CMYK_device;
new_additive = false;
/* This is needed due to the mismatched compressed encode decode
@@ -3314,22 +3309,22 @@ pdf14_update_device_color_procs(gx_device *dev,
new_depth = 32;
for (k = 0; k < 4; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (3-k)*8;
+ comp_shift[k] = (3-k)*8;
}
break;
case ICC:
- /* If we are coming from the clist reader, then we need to get
+ /* If we are coming from the clist reader, then we need to get
the ICC data now */
if (iccprofile == NULL && pdev->pclist_device != NULL) {
- /* Get the serialized data from the clist. Not the whole
+ /* Get the serialized data from the clist. Not the whole
profile. */
pcrdev = (gx_device_clist_reader *)(pdev->pclist_device);
- iccprofile = gsicc_read_serial_icc((gx_device *) pcrdev,
+ iccprofile = gsicc_read_serial_icc((gx_device *) pcrdev,
icc_hashcode);
if (iccprofile == NULL)
return gs_rethrow(-1,"ICC data not found in clist");
/* Keep a pointer to the clist device */
- iccprofile->dev = (gx_device *) pcrdev;
+ iccprofile->dev = (gx_device *) pcrdev;
} else {
/* Go ahead and rc increment right now. This way when
we pop, we will make sure to decrement and avoid a
@@ -3350,14 +3345,14 @@ pdf14_update_device_color_procs(gx_device *dev,
pdevproto = (pdf14_device *)&gs_pdf14_Gray_device;
new_14procs = &gray_pdf14_procs;
comp_bits[0] = 8;
- comp_shift[0] = 0;
+ comp_shift[0] = 0;
break;
case 3:
pdevproto = (pdf14_device *)&gs_pdf14_RGB_device;
new_14procs = &rgb_pdf14_procs;
for (k = 0; k < 3; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (2-k)*8;
+ comp_shift[k] = (2-k)*8;
}
break;
case 4:
@@ -3365,23 +3360,23 @@ pdf14_update_device_color_procs(gx_device *dev,
new_14procs = &cmyk_pdf14_procs;
for (k = 0; k < 4; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (3-k)*8;
+ comp_shift[k] = (3-k)*8;
}
break;
}
break;
- default:
- return_error(gs_error_rangecheck);
- break;
- }
- if_debug2('v', "[v]pdf14_update_device_color_procs,num_components_old = %d num_components_new = %d\n",
+ default:
+ return_error(gs_error_rangecheck);
+ break;
+ }
+ if_debug2('v', "[v]pdf14_update_device_color_procs,num_components_old = %d num_components_new = %d\n",
pdev->color_info.num_components,new_num_comps);
/* Save the old information */
parent_color_info->get_cmap_procs = pis->get_cmap_procs;
- parent_color_info->parent_color_mapping_procs =
+ parent_color_info->parent_color_mapping_procs =
pdev->procs.get_color_mapping_procs;
- parent_color_info->parent_color_comp_index =
+ parent_color_info->parent_color_comp_index =
pdev->procs.get_color_comp_index;
parent_color_info->parent_blending_procs = pdev->blend_procs;
parent_color_info->polarity = pdev->color_info.polarity;
@@ -3397,7 +3392,7 @@ pdf14_update_device_color_procs(gx_device *dev,
parent_color_info->max_gray = pdev->color_info.max_gray;
parent_color_info->encode = pdev->procs.encode_color;
parent_color_info->decode = pdev->procs.decode_color;
- /* Don't increment the space since we are going to remove it from the
+ /* Don't increment the space since we are going to remove it from the
ICC manager anyway. */
if (group_color == ICC && iccprofile != NULL) {
parent_color_info->icc_profile = dev->device_icc_profile;
@@ -3416,14 +3411,14 @@ pdf14_update_device_color_procs(gx_device *dev,
}
pis->get_cmap_procs = pdf14_get_cmap_procs_group;
gx_set_cmap_procs(pis, dev);
- pdev->procs.get_color_mapping_procs =
+ pdev->procs.get_color_mapping_procs =
pdevproto->static_procs->get_color_mapping_procs;
- pdev->procs.get_color_comp_index =
+ pdev->procs.get_color_comp_index =
pdevproto->static_procs->get_color_comp_index;
pdev->blend_procs = pdevproto->blend_procs;
pdev->color_info.polarity = new_polarity;
pdev->color_info.num_components = new_num_comps;
- pdev->ctx->additive = new_additive;
+ pdev->ctx->additive = new_additive;
pdev->pdf14_procs = new_14procs;
if (has_tags) {
new_depth += 8;
@@ -3435,7 +3430,7 @@ pdf14_update_device_color_procs(gx_device *dev,
memcpy(&(pdev->color_info.comp_shift),comp_shift,4);
pdev->color_info.max_color = 255;
pdev->color_info.max_gray = 255;
- /* If the CS was ICC based, we need to update the device ICC profile
+ /* If the CS was ICC based, we need to update the device ICC profile
in the ICC manager, since that is the profile that is used for the
PDF14 device */
if (group_color == ICC && iccprofile != NULL) {
@@ -3448,12 +3443,12 @@ pdf14_update_device_color_procs(gx_device *dev,
return(1); /* Lets us detect that we did do an update */
}
-/* A new version that works with the color_procs stack
+/* A new version that works with the color_procs stack
for transparency groups */
static int
pdf14_update_device_color_procs_push_c(gx_device *dev,
- gs_transparency_color_t group_color, int64_t icc_hashcode,
- gs_imager_state *pis, cmm_profile_t *icc_profile)
+ gs_transparency_color_t group_color, int64_t icc_hashcode,
+ gs_imager_state *pis, cmm_profile_t *icc_profile)
{
pdf14_device *pdevproto;
pdf14_device *pdev = (pdf14_device *)dev;
@@ -3467,27 +3462,27 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
byte comp_bits[] = {0,0,0,0};
byte comp_shift[] = {0,0,0,0};
int k;
- bool has_tags = (dev->memory->gs_lib_ctx->BITTAG !=
+ bool has_tags = (dev->memory->gs_lib_ctx->BITTAG !=
GS_DEVICE_DOESNT_SUPPORT_TAGS);
if (group_color == ICC && icc_profile == NULL) {
- return gs_rethrow(gs_error_undefinedresult,
+ return gs_rethrow(gs_error_undefinedresult,
"Missing ICC data");
}
if_debug0('v', "[v]pdf14_update_device_color_procs_push_c\n");
- /* Check if we need to alter the device procs at this stage. Many of the procs
- are based upon the color space of the device. We want to remain in the
- color space defined by the color space of the soft mask or transparency
- group as opposed to the device color space. Later, when we pop the softmask
- we will collapse it to a single band and then compose with it to the device
- color space (or the parent layer space). In the case where we pop an
+ /* Check if we need to alter the device procs at this stage. Many of the procs
+ are based upon the color space of the device. We want to remain in the
+ color space defined by the color space of the soft mask or transparency
+ group as opposed to the device color space. Later, when we pop the softmask
+ we will collapse it to a single band and then compose with it to the device
+ color space (or the parent layer space). In the case where we pop an
isolated transparency group, we will do the blending in the proper color
- space and then transform the data when we pop the group. Remember that only
+ space and then transform the data when we pop the group. Remember that only
isolated groups can have color spaces that are different than their parent. */
update_color_info = false;
switch (group_color) {
case GRAY_SCALE:
- if (pdev->color_info.num_components != 1){
+ if (pdev->color_info.num_components != 1){
update_color_info = true;
new_polarity = GX_CINFO_POLARITY_ADDITIVE;
new_num_comps = 1;
@@ -3496,12 +3491,12 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
new_14procs = &gray_pdf14_procs;
new_depth = 8;
comp_bits[0] = 8;
- comp_shift[0] = 0;
+ comp_shift[0] = 0;
}
break;
- case DEVICE_RGB:
- case CIE_XYZ:
- if (pdev->color_info.num_components != 3){
+ case DEVICE_RGB:
+ case CIE_XYZ:
+ if (pdev->color_info.num_components != 3){
update_color_info = true;
new_polarity = GX_CINFO_POLARITY_ADDITIVE;
new_num_comps = 3;
@@ -3511,12 +3506,12 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
new_depth = 24;
for (k = 0; k < 3; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (2-k)*8;
+ comp_shift[k] = (2-k)*8;
}
}
- break;
- case DEVICE_CMYK:
- if (pdev->color_info.num_components != 4){
+ break;
+ case DEVICE_CMYK:
+ if (pdev->color_info.num_components != 4){
update_color_info = true;
new_polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
new_num_comps = 4;
@@ -3532,13 +3527,13 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
new_depth = 32;
for (k = 0; k < 4; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (3-k)*8;
+ comp_shift[k] = (3-k)*8;
}
}
break;
case ICC:
/* Check if the profile is different. */
- if (dev->device_icc_profile->hashcode !=
+ if (dev->device_icc_profile->hashcode !=
icc_profile->hashcode) {
update_color_info = true;
new_num_comps = icc_profile->num_comps;
@@ -3550,7 +3545,7 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
pdevproto = (pdf14_device *)&gs_pdf14_Gray_device;
new_14procs = &gray_pdf14_procs;
comp_bits[0] = 8;
- comp_shift[0] = 0;
+ comp_shift[0] = 0;
break;
case 3:
new_polarity = GX_CINFO_POLARITY_ADDITIVE;
@@ -3559,7 +3554,7 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
new_14procs = &rgb_pdf14_procs;
for (k = 0; k < 3; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (2-k)*8;
+ comp_shift[k] = (2-k)*8;
}
break;
case 4:
@@ -3569,31 +3564,31 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
new_14procs = &cmyk_pdf14_procs;
for (k = 0; k < 4; k++) {
comp_bits[k] = 8;
- comp_shift[k] = (3-k)*8;
+ comp_shift[k] = (3-k)*8;
}
break;
- default:
- return gs_rethrow(gs_error_undefinedresult,
+ default:
+ return gs_rethrow(gs_error_undefinedresult,
"ICC Number of colorants illegal");
}
}
break;
- default:
- return_error(gs_error_rangecheck);
- break;
- }
+ default:
+ return_error(gs_error_rangecheck);
+ break;
+ }
if (update_color_info){
if (has_tags) {
new_depth += 8;
}
- if_debug2('v', "[v]pdf14_update_device_color_procs_push_c,num_components_old = %d num_components_new = %d\n",
+ if_debug2('v', "[v]pdf14_update_device_color_procs_push_c,num_components_old = %d num_components_new = %d\n",
pdev->color_info.num_components,new_num_comps);
/* Set new information in the device */
pis->get_cmap_procs = pdf14_get_cmap_procs_group;
gx_set_cmap_procs(pis, dev);
- pdev->procs.get_color_mapping_procs =
+ pdev->procs.get_color_mapping_procs =
pdevproto->static_procs->get_color_mapping_procs;
- pdev->procs.get_color_comp_index =
+ pdev->procs.get_color_comp_index =
pdevproto->static_procs->get_color_comp_index;
pdev->blend_procs = pdevproto->blend_procs;
pdev->color_info.polarity = new_polarity;
@@ -3611,16 +3606,16 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
decode for the pdf14 device to not used compressed color
encoding while in the soft mask. We will just check for gray
and compressed. Note that we probably don't have_tags if we
- are dealing with compressed color. But is is possible so
+ are dealing with compressed color. But is is possible so
we add it in to catch for future use. */
if (pdev->procs.encode_color == pdf14_compressed_encode_color &&
new_num_comps == 1) {
- pdev->procs.decode_color =
+ pdev->procs.decode_color =
pdevproto->static_procs->decode_color;
if (has_tags) {
pdev->procs.encode_color = pdf14_encode_color_tag;
} else {
- pdev->procs.encode_color =
+ pdev->procs.encode_color =
pdevproto->static_procs->encode_color;
}
}
@@ -3636,7 +3631,7 @@ pdf14_update_device_color_procs_push_c(gx_device *dev,
dev->device_icc_profile = icc_profile;
}
if (pdev->ctx) {
- pdev->ctx->additive = new_additive;
+ pdev->ctx->additive = new_additive;
}
return(1); /* Lets us detect that we did do an update */
}
@@ -3654,9 +3649,9 @@ pdf14_update_device_color_procs_pop_c(gx_device *dev,gs_imager_state *pis)
if_debug0('v', "[v]pdf14_update_device_color_procs_pop_c\n");
/* The color procs are always pushed. Simply restore them. */
- if (!(parent_color->parent_color_mapping_procs == NULL &&
+ if (!(parent_color->parent_color_mapping_procs == NULL &&
parent_color->parent_color_comp_index == NULL)) {
- if_debug2('v', "[v]pdf14_update_device_color_procs_pop_c,num_components_old = %d num_components_new = %d\n",
+ if_debug2('v', "[v]pdf14_update_device_color_procs_pop_c,num_components_old = %d num_components_new = %d\n",
pdev->color_info.num_components,parent_color->num_components);
pis->get_cmap_procs = parent_color->get_cmap_procs;
gx_set_cmap_procs(pis, dev);
@@ -3690,7 +3685,7 @@ pdf14_update_device_color_procs_pop_c(gx_device *dev,gs_imager_state *pis)
if (pdev->ctx){
pdev->ctx->additive = parent_color->isadditive;
}
- /* The device profile must be restored. No reference - count is done here
+ /* The device profile must be restored. No reference - count is done here
A match with pdf14_update_device_color_procs_push_c. There functions
are closely integrated with pdf14_pop_parent_color and pdf14_push_parent color.
All four are used only on the clist writer side of the transparency code */
@@ -3702,10 +3697,10 @@ pdf14_update_device_color_procs_pop_c(gx_device *dev,gs_imager_state *pis)
return 0;
}
- /* When a transparency group is pushed, the parent colorprocs are initialized.
- Since the color mapping procs are all based upon the device, we must have
- a nested list based upon the transparency group color space. This nesting
- must be outside the nested ctx structures to allow the nesting for the clist
+ /* When a transparency group is pushed, the parent colorprocs are initialized.
+ Since the color mapping procs are all based upon the device, we must have
+ a nested list based upon the transparency group color space. This nesting
+ must be outside the nested ctx structures to allow the nesting for the clist
writer */
static void
pdf14_push_parent_color(gx_device *dev, const gs_imager_state *pis)
@@ -3716,7 +3711,7 @@ pdf14_push_parent_color(gx_device *dev, const gs_imager_state *pis)
if_debug0('v', "[v]pdf14_push_parent_color\n");
/* Allocate a new one */
- new_parent_color = gs_alloc_struct(dev->memory, pdf14_parent_color_t,
+ new_parent_color = gs_alloc_struct(dev->memory, pdf14_parent_color_t,
&st_pdf14_clr,"pdf14_clr_new");
/* Link to old one */
new_parent_color->previous = pdev->trans_group_parent_cmap_procs;
@@ -3724,9 +3719,9 @@ pdf14_push_parent_color(gx_device *dev, const gs_imager_state *pis)
pdev->trans_group_parent_cmap_procs = new_parent_color;
/* Initialize with values */
new_parent_color->get_cmap_procs = pis->get_cmap_procs;
- new_parent_color->parent_color_mapping_procs =
+ new_parent_color->parent_color_mapping_procs =
pdev->procs.get_color_mapping_procs;
- new_parent_color->parent_color_comp_index =
+ new_parent_color->parent_color_comp_index =
pdev->procs.get_color_comp_index;
new_parent_color->parent_blending_procs = pdev->blend_procs;
new_parent_color->polarity = pdev->color_info.polarity;
@@ -3749,10 +3744,10 @@ pdf14_push_parent_color(gx_device *dev, const gs_imager_state *pis)
new_parent_color->isadditive = pdev->ctx->additive;
}
}
- /* When a transparency group is popped, the parent colorprocs must be restored.
- Since the color mapping procs are all based upon the device, we must have a
- nested list based upon the transparency group color space. This nesting
- must be outside the nested ctx structures to allow the nesting for the
+ /* When a transparency group is popped, the parent colorprocs must be restored.
+ Since the color mapping procs are all based upon the device, we must have a
+ nested list based upon the transparency group color space. This nesting
+ must be outside the nested ctx structures to allow the nesting for the
clist writer */
static void
pdf14_pop_parent_color(gx_device *dev, const gs_imager_state *pis)
@@ -3772,28 +3767,28 @@ pdf14_pop_parent_color(gx_device *dev, const gs_imager_state *pis)
static int
pdf14_begin_transparency_mask(gx_device *dev,
- const gx_transparency_mask_params_t *ptmp,
- const gs_rect *pbbox,
- gs_imager_state *pis,
- gs_transparency_state_t **ppts,
- gs_memory_t *mem)
+ const gx_transparency_mask_params_t *ptmp,
+ const gs_rect *pbbox,
+ gs_imager_state *pis,
+ gs_transparency_state_t **ppts,
+ gs_memory_t *mem)
{
pdf14_device *pdev = (pdf14_device *)dev;
byte bg_alpha = 255;
byte *transfer_fn = (byte *)gs_alloc_bytes(pdev->ctx->memory, 256,
- "pdf14_begin_transparency_mask");
+ "pdf14_begin_transparency_mask");
gs_int_rect rect;
int code;
int group_color_numcomps;
- gs_transparency_color_t group_color;
+ gs_transparency_color_t group_color;
if (transfer_fn == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = compute_group_device_int_rect(pdev, &rect, pbbox, pis);
if (code < 0)
- return code;
+ return code;
if (ptmp->Background_components)
- bg_alpha = (int)(255 * ptmp->GrayBackground + 0.5);
+ bg_alpha = (int)(255 * ptmp->GrayBackground + 0.5);
if_debug1('v', "pdf14_begin_transparency_mask, bg_alpha = %d\n", bg_alpha);
memcpy(transfer_fn, ptmp->transfer_fn, size_of(ptmp->transfer_fn));
/* If the group color is unknown, then we must use the previous group color
@@ -3807,21 +3802,21 @@ pdf14_begin_transparency_mask(gx_device *dev,
group_color_numcomps = pdev->color_info.num_components;
}
switch (group_color_numcomps) {
- case 1:
- group_color = GRAY_SCALE;
+ case 1:
+ group_color = GRAY_SCALE;
break;
- case 3:
- group_color = DEVICE_RGB;
+ case 3:
+ group_color = DEVICE_RGB;
break;
- case 4:
- group_color = DEVICE_CMYK;
+ case 4:
+ group_color = DEVICE_CMYK;
break;
default:
- /* We can end up here if we are in a deviceN color space and
+ /* We can end up here if we are in a deviceN color space and
we have a sep output device */
group_color = DEVICEN;
break;
- }
+ }
} else {
group_color = ptmp->group_color;
group_color_numcomps = ptmp->group_color_numcomps;
@@ -3830,21 +3825,21 @@ pdf14_begin_transparency_mask(gx_device *dev,
fowarding to the target device. */
code = pdf14_update_device_color_procs(dev, group_color, ptmp->icc_hashcode, pis, ptmp->iccprofile);
if (code < 0)
- return code;
+ return code;
/* Note that the soft mask always follows the group color requirements even
when we have a separable device */
return pdf14_push_transparency_mask(pdev->ctx, &rect, bg_alpha,
- transfer_fn, ptmp->idle, ptmp->replacing,
- ptmp->mask_id, ptmp->subtype,
- group_color_numcomps,
- ptmp->Background_components,
+ transfer_fn, ptmp->idle, ptmp->replacing,
+ ptmp->mask_id, ptmp->subtype,
+ group_color_numcomps,
+ ptmp->Background_components,
ptmp->Background,
ptmp->GrayBackground);
}
static int
pdf14_end_transparency_mask(gx_device *dev, gs_imager_state *pis,
- gs_transparency_mask_t **pptm)
+ gs_transparency_mask_t **pptm)
{
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_parent_color_t *parent_color;
@@ -3857,7 +3852,7 @@ pdf14_end_transparency_mask(gx_device *dev, gs_imager_state *pis,
* and the Smask blending space */
if (pdev->ctx->stack != NULL ) {
parent_color = pdev->ctx->stack->parent_color_info_procs;
- if (!(parent_color->parent_color_mapping_procs == NULL &&
+ if (!(parent_color->parent_color_mapping_procs == NULL &&
parent_color->parent_color_comp_index == NULL)) {
pis->get_cmap_procs = parent_color->get_cmap_procs;
gx_set_cmap_procs(pis, dev);
@@ -3894,7 +3889,7 @@ pdf14_end_transparency_mask(gx_device *dev, gs_imager_state *pis,
static int
pdf14_mark_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_buf *buf = pdev->ctx->stack;
@@ -3922,29 +3917,29 @@ pdf14_mark_fill_rectangle(gx_device * dev,
byte src_alpha;
if (buf->data == NULL)
- return 0;
+ return 0;
/* NB: gx_color_index is 4 or 8 bytes */
#if 0
if (sizeof(color) <= sizeof(ulong))
- if_debug8('v', "[v]pdf14_mark_fill_rectangle, (%d, %d), %d x %d color = %lx bm %d, nc %d, overprint %d\n",
- x, y, w, h, (ulong)color, blend_mode, num_chan, overprint);
+ if_debug8('v', "[v]pdf14_mark_fill_rectangle, (%d, %d), %d x %d color = %lx bm %d, nc %d, overprint %d\n",
+ x, y, w, h, (ulong)color, blend_mode, num_chan, overprint);
else
- if_debug9('v', "[v]pdf14_mark_fill_rectangle, (%d, %d), %d x %d color = %08lx%08lx bm %d, nc %d, overprint %d\n",
- x, y, w, h,
- (ulong)(color >> 8*(sizeof(color) - sizeof(ulong))), (ulong)color,
- blend_mode, num_chan, overprint);
+ if_debug9('v', "[v]pdf14_mark_fill_rectangle, (%d, %d), %d x %d color = %08lx%08lx bm %d, nc %d, overprint %d\n",
+ x, y, w, h,
+ (ulong)(color >> 8*(sizeof(color) - sizeof(ulong))), (ulong)color,
+ blend_mode, num_chan, overprint);
#endif
/*
* Unpack the gx_color_index values. Complement the components for subtractive
* color spaces.
*/
if (has_tags) {
- curr_tag = (color >> (num_comp*8)) & 0xff;
+ curr_tag = (color >> (num_comp*8)) & 0xff;
}
pdev->pdf14_procs->unpack_color(num_comp, color, pdev, src);
src_alpha = src[num_comp] = (byte)floor (255 * pdev->alpha + 0.5);
if (has_shape)
- shape = (byte)floor (255 * pdev->shape + 0.5);
+ shape = (byte)floor (255 * pdev->shape + 0.5);
if (x < buf->rect.p.x) {
w += x - buf->rect.p.x;
x = buf->rect.p.x;
@@ -3961,69 +3956,69 @@ pdf14_mark_fill_rectangle(gx_device * dev,
if (y + h > buf->bbox.q.y) buf->bbox.q.y = y + h;
line = buf->data + (x - buf->rect.p.x) + (y - buf->rect.p.y) * rowstride;
for (j = 0; j < h; ++j) {
- dst_ptr = line;
- for (i = 0; i < w; ++i) {
- /* Complement the components for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst[k] = dst_ptr[k * planestride];
- }
- else { /* Complement the components for subtractive color spaces */
- for (k = 0; k < num_comp; ++k)
- dst[k] = 255 - dst_ptr[k * planestride];
- dst[num_comp] = dst_ptr[num_comp * planestride];
- }
- art_pdf_composite_pixel_alpha_8(dst, src, num_comp,
- blend_mode, pdev->blend_procs);
- /* Complement the results for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst_ptr[k * planestride] = dst[k];
- } else {
- if (overprint) {
- for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) {
- if ((comps & 0x1) != 0) {
- dst_ptr[k * planestride] = 255 - dst[k];
- }
- }
- /* The alpha channel */
- dst_ptr[num_comp * planestride] = dst[num_comp];
- } else {
- for (k = 0; k < num_comp; ++k)
- dst_ptr[k * planestride] = 255 - dst[k];
- dst_ptr[num_comp * planestride] = dst[num_comp];
- }
- }
- if (has_alpha_g) {
- int tmp = (255 - dst_ptr[alpha_g_off]) * (255 - src_alpha) + 0x80;
- dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
- if (has_shape) {
- int tmp = (255 - dst_ptr[shape_off]) * (255 - shape) + 0x80;
- dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
+ dst_ptr = line;
+ for (i = 0; i < w; ++i) {
+ /* Complement the components for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst[k] = dst_ptr[k * planestride];
+ }
+ else { /* Complement the components for subtractive color spaces */
+ for (k = 0; k < num_comp; ++k)
+ dst[k] = 255 - dst_ptr[k * planestride];
+ dst[num_comp] = dst_ptr[num_comp * planestride];
+ }
+ art_pdf_composite_pixel_alpha_8(dst, src, num_comp,
+ blend_mode, pdev->blend_procs);
+ /* Complement the results for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst_ptr[k * planestride] = dst[k];
+ } else {
+ if (overprint) {
+ for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) {
+ if ((comps & 0x1) != 0) {
+ dst_ptr[k * planestride] = 255 - dst[k];
+ }
+ }
+ /* The alpha channel */
+ dst_ptr[num_comp * planestride] = dst[num_comp];
+ } else {
+ for (k = 0; k < num_comp; ++k)
+ dst_ptr[k * planestride] = 255 - dst[k];
+ dst_ptr[num_comp * planestride] = dst[num_comp];
+ }
+ }
+ if (has_alpha_g) {
+ int tmp = (255 - dst_ptr[alpha_g_off]) * (255 - src_alpha) + 0x80;
+ dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
+ if (has_shape) {
+ int tmp = (255 - dst_ptr[shape_off]) * (255 - shape) + 0x80;
+ dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
if (has_tags) {
/* If alpha is 100% then set to pure path, else or */
- if (dst[num_comp] == 255) {
+ if (dst[num_comp] == 255) {
dst_ptr[tag_off] = curr_tag;
} else {
dst_ptr[tag_off] = ( dst_ptr[tag_off] |curr_tag ) & ~GS_UNTOUCHED_TAG;
}
}
- ++dst_ptr;
- }
- line += rowstride;
+ ++dst_ptr;
+ }
+ line += rowstride;
}
#if 0
/* #if RAW_DUMP */
/* Dump the current buffer to see what we have. */
-
- if(global_index/10.0 == (int) (global_index/10.0) )
- dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
- pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
- pdev->ctx->stack->n_planes,
- pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
- "Draw_Rect",pdev->ctx->stack->data);
+
+ if(global_index/10.0 == (int) (global_index/10.0) )
+ dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y,
+ pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x,
+ pdev->ctx->stack->n_planes,
+ pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride,
+ "Draw_Rect",pdev->ctx->stack->data);
global_index++;
#endif
@@ -4032,7 +4027,7 @@ pdf14_mark_fill_rectangle(gx_device * dev,
static int
pdf14_mark_fill_rectangle_ko_simple(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
pdf14_device *pdev = (pdf14_device *)dev;
pdf14_buf *buf = pdev->ctx->stack;
@@ -4054,23 +4049,23 @@ pdf14_mark_fill_rectangle_ko_simple(gx_device * dev,
gs_object_tag_type_t curr_tag;
if (buf->data == NULL)
- return 0;
+ return 0;
#if 0
if (sizeof(color) <= sizeof(ulong))
- if_debug6('v', "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %lx, nc %d,\n",
- x, y, w, h, (ulong)color, num_chan);
+ if_debug6('v', "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %lx, nc %d,\n",
+ x, y, w, h, (ulong)color, num_chan);
else
- if_debug7('v', "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %8lx%08lx, nc %d,\n",
- x, y, w, h,
- (ulong)(color >> 8*(sizeof(color) - sizeof(ulong))), (ulong)color,
- num_chan);
+ if_debug7('v', "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %8lx%08lx, nc %d,\n",
+ x, y, w, h,
+ (ulong)(color >> 8*(sizeof(color) - sizeof(ulong))), (ulong)color,
+ num_chan);
#endif
/*
* Unpack the gx_color_index values. Complement the components for subtractive
* color spaces.
*/
if (has_tags) {
- curr_tag = (color >> (num_comp*8)) & 0xff;
+ curr_tag = (color >> (num_comp*8)) & 0xff;
}
pdev->pdf14_procs->unpack_color(num_comp, color, pdev, src);
src[num_comp] = (byte)floor (255 * pdev->alpha + 0.5);
@@ -4093,40 +4088,40 @@ pdf14_mark_fill_rectangle_ko_simple(gx_device * dev,
line = buf->data + (x - buf->rect.p.x) + (y - buf->rect.p.y) * rowstride;
for (j = 0; j < h; ++j) {
- dst_ptr = line;
- for (i = 0; i < w; ++i) {
- /* Complement the components for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst[k] = dst_ptr[k * planestride];
- }
- else {
- for (k = 0; k < num_comp; ++k)
- dst[k] = 255 - dst_ptr[k * planestride];
- dst[num_comp] = dst_ptr[num_comp * planestride];
- }
+ dst_ptr = line;
+ for (i = 0; i < w; ++i) {
+ /* Complement the components for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst[k] = dst_ptr[k * planestride];
+ }
+ else {
+ for (k = 0; k < num_comp; ++k)
+ dst[k] = 255 - dst_ptr[k * planestride];
+ dst[num_comp] = dst_ptr[num_comp * planestride];
+ }
if (has_shape) {
- art_pdf_composite_knockout_simple_8(dst,
- has_shape ? dst_ptr + shape_off : NULL,
- has_tags ? dst_ptr + tag_off : NULL,
+ art_pdf_composite_knockout_simple_8(dst,
+ has_shape ? dst_ptr + shape_off : NULL,
+ has_tags ? dst_ptr + tag_off : NULL,
src, curr_tag, num_comp, 255);
} else {
art_pdf_knockoutisolated_group_8(dst, src, num_comp);
}
- /* ToDo: Review use of shape and opacity above. */
- /* Complement the results for subtractive color spaces */
- if (additive) {
- for (k = 0; k < num_chan; ++k)
- dst_ptr[k * planestride] = dst[k];
- }
- else {
- for (k = 0; k < num_comp; ++k)
- dst_ptr[k * planestride] = 255 - dst[k];
- dst_ptr[num_comp * planestride] = dst[num_comp];
- }
- ++dst_ptr;
- }
- line += rowstride;
+ /* ToDo: Review use of shape and opacity above. */
+ /* Complement the results for subtractive color spaces */
+ if (additive) {
+ for (k = 0; k < num_chan; ++k)
+ dst_ptr[k * planestride] = dst[k];
+ }
+ else {
+ for (k = 0; k < num_comp; ++k)
+ dst_ptr[k * planestride] = 255 - dst[k];
+ dst_ptr[num_comp * planestride] = dst[num_comp];
+ }
+ ++dst_ptr;
+ }
+ line += rowstride;
}
return 0;
}
@@ -4172,28 +4167,28 @@ static const gx_color_map_procs pdf14_cmap_many_group = {
**/
static inline void
map_components_to_colorants(const frac * pcc,
- const gs_devicen_color_map * pcolor_component_map, frac * plist)
+ const gs_devicen_color_map * pcolor_component_map, frac * plist)
{
int i = pcolor_component_map->num_colorants - 1;
int pos;
/* Clear all output colorants first */
for (; i >= 0; i--) {
- plist[i] = frac_0;
+ plist[i] = frac_0;
}
/* Map color components into output list */
for (i = pcolor_component_map->num_components - 1; i >= 0; i--) {
- pos = pcolor_component_map->color_map[i];
- if (pos >= 0)
- plist[pos] = pcc[i];
+ pos = pcolor_component_map->color_map[i];
+ if (pos >= 0)
+ plist[pos] = pcc[i];
}
}
static void
pdf14_cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
- int i,ncomps;
+ int i,ncomps;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_index color;
@@ -4209,19 +4204,19 @@ pdf14_cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_imager_state *
/* map to the color model */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_gray(trans_device, gray, cm_comps);
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
+ cv[i] = frac2cv(cm_comps[i]);
/* encode as a color index */
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
static void
pdf14_cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc,
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- int i,ncomps;
+ int i,ncomps;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_index color;
@@ -4237,19 +4232,19 @@ pdf14_cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc,
/* map to the color model */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_rgb(trans_device, pis, r, g, b, cm_comps);
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
+ cv[i] = frac2cv(cm_comps[i]);
/* encode as a color index */
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
static void
pdf14_cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc,
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- int i,ncomps;
+ int i,ncomps;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_index color;
@@ -4265,17 +4260,17 @@ pdf14_cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc,
/* map to the color model */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_cmyk(trans_device, c, m, y, k, cm_comps);
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
+ cv[i] = frac2cv(cm_comps[i]);
color = dev_proc(trans_device, encode_color)(trans_device, cv);
- if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ if (color != gx_no_color_index)
+ color_set_pure(pdc, color);
}
-/* color mapping for when we have an smask or a isolated transparency group with
+/* color mapping for when we have an smask or a isolated transparency group with
another color space */
static void
pdf14_cmap_gray_direct_group(frac gray, gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
int i, ncomps = dev->color_info.num_components;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
@@ -4283,12 +4278,12 @@ pdf14_cmap_gray_direct_group(frac gray, gx_device_color * pdc, const gs_imager_s
gx_color_index color;
gx_device *trans_device;
- /* We may be coming from the clist writer
+ /* We may be coming from the clist writer
which often forwards us the target device.
If this occurs we actually need to get to
the color space defined by the transparency group
- and we use the operators defined by the transparency device
- to do the job.
+ and we use the operators defined by the transparency device
+ to do the job.
*/
if (pis->trans_device != NULL){
trans_device = pis->trans_device;
@@ -4296,29 +4291,29 @@ pdf14_cmap_gray_direct_group(frac gray, gx_device_color * pdc, const gs_imager_s
trans_device = dev;
}
ncomps = trans_device->color_info.num_components;
- /* If we are doing concretization of colors in an SMask or isolated group
+ /* If we are doing concretization of colors in an SMask or isolated group
then just return the color as is */
if (ncomps == 1 ) {
- cv[0] = frac2cv(gray);
+ cv[0] = frac2cv(gray);
/* encode as a color index */
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
} else {
/* map to the color model */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_gray(trans_device, gray, cm_comps);
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
+ cv[i] = frac2cv(cm_comps[i]);
/* encode as a color index */
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
}
-/* color mapping for when we have an smask or a isolated transparency group with
+/* color mapping for when we have an smask or a isolated transparency group with
another color space */
static void
pdf14_cmap_rgb_direct_group(frac r, frac g, frac b, gx_device_color * pdc,
@@ -4329,10 +4324,10 @@ pdf14_cmap_rgb_direct_group(frac r, frac g, frac b, gx_device_color * pdc,
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_index color;
gx_device *trans_device;
- /* We may be coming from the clist writer which often forwards us the
- target device. If this occurs we actually need to get to the color space
- defined by the transparency group and we use the operators defined by
- the transparency device to do the job.
+ /* We may be coming from the clist writer which often forwards us the
+ target device. If this occurs we actually need to get to the color space
+ defined by the transparency group and we use the operators defined by
+ the transparency device to do the job.
*/
if (pis->trans_device != NULL){
trans_device = pis->trans_device;
@@ -4348,16 +4343,16 @@ pdf14_cmap_rgb_direct_group(frac r, frac g, frac b, gx_device_color * pdc,
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
} else {
/* map to the device color model */
- /* We can end up here, if for example we had a DeviceN color space with a
- CIE based alternate space and a output device that was RGB but a
- blending space that was CMYK. The proper way to solve this is to
- introduce another color space for the graphic state that has its own
- Joint CIE Cache between the source and a CMYK CRD (the transparency
- color space). The problem is that we can only have one CRD, which is
- defined by the output device. We will fix these issues with the ICC
+ /* We can end up here, if for example we had a DeviceN color space with a
+ CIE based alternate space and a output device that was RGB but a
+ blending space that was CMYK. The proper way to solve this is to
+ introduce another color space for the graphic state that has its own
+ Joint CIE Cache between the source and a CMYK CRD (the transparency
+ color space). The problem is that we can only have one CRD, which is
+ defined by the output device. We will fix these issues with the ICC
based color architecture. */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_rgb(trans_device, pis, r, g, b, cm_comps);
for (i = 0; i < ncomps; i++)
@@ -4381,10 +4376,10 @@ pdf14_cmap_cmyk_direct_group(frac c, frac m, frac y, frac k, gx_device_color * p
gx_color_index color;
gx_device *trans_device;
- /* We may be coming from the clist writer which often forwards us the
- target device. If this occurs we actually need to get to the color space
- defined by the transparency group and we use the operators defined by
- the transparency device to do the job.
+ /* We may be coming from the clist writer which often forwards us the
+ target device. If this occurs we actually need to get to the color space
+ defined by the transparency group and we use the operators defined by
+ the transparency device to do the job.
*/
if (pis->trans_device != NULL){
trans_device = pis->trans_device;
@@ -4401,15 +4396,15 @@ pdf14_cmap_cmyk_direct_group(frac c, frac m, frac y, frac k, gx_device_color * p
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
} else {
/* map to the color model */
dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_cmyk(trans_device, c, m, y, k, cm_comps);
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
+ cv[i] = frac2cv(cm_comps[i]);
color = dev_proc(trans_device, encode_color)(trans_device, cv);
- if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ if (color != gx_no_color_index)
+ color_set_pure(pdc, color);
}
}
@@ -4423,9 +4418,9 @@ pdf14_cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color
gx_color_index color;
gx_device *trans_device;
- /* We may be coming from the clist writer which often forwards us the
- target device. If this occurs we actually need to get to the color
- space defined by the transparency group and we use the operators
+ /* We may be coming from the clist writer which often forwards us the
+ target device. If this occurs we actually need to get to the color
+ space defined by the transparency group and we use the operators
defined by the transparency device to do the job. */
if (pis->trans_device != NULL){
trans_device = pis->trans_device;
@@ -4438,25 +4433,25 @@ pdf14_cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color
/* pre-multiply to account for the alpha weighting */
if (alpha != frac_1) {
#ifdef PREMULTIPLY_TOWARDS_WHITE
- frac alpha_bias = frac_1 - alpha;
+ frac alpha_bias = frac_1 - alpha;
#else
- frac alpha_bias = 0;
+ frac alpha_bias = 0;
#endif
- for (i = 0; i < ncomps; i++)
- cm_comps[i] = (frac)((long)cm_comps[i] * alpha) / frac_1 + alpha_bias;
+ for (i = 0; i < ncomps; i++)
+ cm_comps[i] = (frac)((long)cm_comps[i] * alpha) / frac_1 + alpha_bias;
}
for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(cm_comps[i]);
- color = dev_proc(trans_device, encode_color)(trans_device, cv);
+ cv[i] = frac2cv(cm_comps[i]);
+ color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
static void
pdf14_cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
int i, ncomps = dev->color_info.num_components;
bool additive = dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE;
@@ -4466,39 +4461,39 @@ pdf14_cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_st
gx_color_index color;
if (pis->color_component_map.sep_type == SEP_ALL) {
- /*
- * Invert the photometric interpretation for additive
- * color spaces because separations are always subtractive.
- */
- if (additive)
- comp_value = frac_1 - comp_value;
- /* Use the "all" value for all components */
- i = pis->color_component_map.num_colorants - 1;
- for (; i >= 0; i--)
- cm_comps[i] = comp_value;
+ /*
+ * Invert the photometric interpretation for additive
+ * color spaces because separations are always subtractive.
+ */
+ if (additive)
+ comp_value = frac_1 - comp_value;
+ /* Use the "all" value for all components */
+ i = pis->color_component_map.num_colorants - 1;
+ for (; i >= 0; i--)
+ cm_comps[i] = comp_value;
}
else {
- /* map to the color model */
- map_components_to_colorants(&comp_value, &(pis->color_component_map), cm_comps);
+ /* map to the color model */
+ map_components_to_colorants(&comp_value, &(pis->color_component_map), cm_comps);
}
/* apply the transfer function(s); convert to color values */
if (additive)
- for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ for (i = 0; i < ncomps; i++)
+ cv[i] = frac2cv(gx_map_color_frac(pis,
+ cm_comps[i], effective_transfer[i]));
else
- for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ for (i = 0; i < ncomps; i++)
+ cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
/* encode as a color index */
color = dev_proc(dev, encode_color)(dev, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
static void
-pdf14_cmap_devicen_direct(const frac * pcc,
+pdf14_cmap_devicen_direct(const frac * pcc,
gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
gs_color_select_t select)
{
@@ -4508,10 +4503,10 @@ pdf14_cmap_devicen_direct(const frac * pcc,
gx_color_index color;
gx_device *trans_device;
- /* We may be coming from the clist writer which often forwards us the
- target device. If this occurs we actually need to get to the color
- space defined by the transparency group and we use the operators
- defined by the transparency device to do the job.
+ /* We may be coming from the clist writer which often forwards us the
+ target device. If this occurs we actually need to get to the color
+ space defined by the transparency group and we use the operators
+ defined by the transparency device to do the job.
*/
if (pis->trans_device != NULL){
trans_device = pis->trans_device;
@@ -4523,18 +4518,18 @@ pdf14_cmap_devicen_direct(const frac * pcc,
map_components_to_colorants(pcc, &(pis->color_component_map), cm_comps);;
/* apply the transfer function(s); convert to color values */
if (trans_device->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
- for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ for (i = 0; i < ncomps; i++)
+ cv[i] = frac2cv(gx_map_color_frac(pis,
+ cm_comps[i], effective_transfer[i]));
else
- for (i = 0; i < ncomps; i++)
- cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ for (i = 0; i < ncomps; i++)
+ cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
/* encode as a color index */
color = dev_proc(trans_device, encode_color)(trans_device, cv);
/* check if the encoding was successful; we presume failure is rare */
if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ color_set_pure(pdc, color);
}
static bool
@@ -4557,21 +4552,20 @@ pdf14_get_cmap_procs_group(const gs_imager_state *pis, const gx_device * dev)
return &pdf14_cmap_many_group;
}
-
-static int
+static int
pdf14_dev_spec_op(gx_device *pdev, int dev_spec_op,
- void *data, int size)
+ void *data, int size)
{
if (dev_spec_op == gxdso_pattern_shfill_doesnt_need_path)
- return 1;
+ return 1;
if (dev_spec_op == gxdso_is_pdf14_device)
- return 1;
+ return 1;
return gx_default_dev_spec_op(pdev, dev_spec_op, data, size);
}
int
gs_pdf14_device_push(gs_memory_t *mem, gs_imager_state * pis,
- gx_device ** pdev, gx_device * target, const gs_pdf14trans_t * pdf14pct)
+ gx_device ** pdev, gx_device * target, const gs_pdf14trans_t * pdf14pct)
{
pdf14_device * dev_proto;
pdf14_device * p14dev, temp_dev_proto;
@@ -4580,18 +4574,18 @@ gs_pdf14_device_push(gs_memory_t *mem, gs_imager_state * pis,
if_debug0('v', "[v]gs_pdf14_device_push\n");
code = get_pdf14_device_proto(target, &dev_proto,
- &temp_dev_proto, pis, pdf14pct);
+ &temp_dev_proto, pis, pdf14pct);
if (code < 0)
- return code;
+ return code;
code = gs_copydevice((gx_device **) &p14dev,
- (const gx_device *) dev_proto, mem);
+ (const gx_device *) dev_proto, mem);
if (code < 0)
- return code;
+ return code;
gs_pdf14_device_copy_params((gx_device *)p14dev, target);
gx_device_set_target((gx_device_forward *)p14dev, target);
/* If the target profile was CIELAB, then overide with default RGB for
- proper blending. During put_image we will convert from RGB to
- CIELAB. Need to check that we have a default profile, which
+ proper blending. During put_image we will convert from RGB to
+ CIELAB. Need to check that we have a default profile, which
will not be the case if we are coming from the clist reader */
if (target->device_icc_profile->data_cs == gsCIELAB
&& pis->icc_manager->default_rgb != NULL) {
@@ -4623,10 +4617,10 @@ gs_pdf14_device_push(gs_memory_t *mem, gs_imager_state * pis,
p14dev->color_info.anti_alias = target->color_info.anti_alias;
#if RAW_DUMP
/* Dump the current buffer to see what we have. */
- dump_raw_buffer(p14dev->ctx->stack->rect.q.y-p14dev->ctx->stack->rect.p.y,
- p14dev->ctx->stack->rect.q.x-p14dev->ctx->stack->rect.p.x,
- p14dev->ctx->stack->n_planes,
- p14dev->ctx->stack->planestride, p14dev->ctx->stack->rowstride,
+ dump_raw_buffer(p14dev->ctx->stack->rect.q.y-p14dev->ctx->stack->rect.p.y,
+ p14dev->ctx->stack->rect.q.x-p14dev->ctx->stack->rect.p.x,
+ p14dev->ctx->stack->n_planes,
+ p14dev->ctx->stack->planestride, p14dev->ctx->stack->rowstride,
"Device_Push",p14dev->ctx->stack->data);
global_index++;
@@ -4668,8 +4662,8 @@ static const char * pdf14_opcode_names[] = PDF14_OPCODE_NAMES;
#define put_value(dp, value)\
BEGIN\
- memcpy(dp, &value, sizeof(value));\
- dp += sizeof(value);\
+ memcpy(dp, &value, sizeof(value));\
+ dp += sizeof(value);\
END
static inline int
@@ -4686,26 +4680,25 @@ c_pdf14trans_write_ctm(byte **ppbuf, const gs_pdf14trans_params_t *pparams)
pbuf--; /* For cmd_write_ctm. */
code = cmd_write_ctm(&pparams->ctm, pbuf, len);
if (code < 0)
- return code;
+ return code;
pbuf += len + 1;
*ppbuf = pbuf;
return 0;
}
-
/*
* Convert a PDF 1.4 transparency compositor to string form for use by the command
* list device.
*/
static int
-c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
+c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
gx_device_clist_writer *cdev)
{
const gs_pdf14trans_params_t * pparams = &((const gs_pdf14trans_t *)pct)->params;
int need, avail = *psize;
- byte buf[MAX_CLIST_TRANSPARENCY_BUFFER_SIZE]; /* Must be large enough
- to fit the data written below. We don't implement a dynamic check for
- the buffer owerflow, assuming that the consistency is verified in the
+ byte buf[MAX_CLIST_TRANSPARENCY_BUFFER_SIZE]; /* Must be large enough
+ to fit the data written below. We don't implement a dynamic check for
+ the buffer owerflow, assuming that the consistency is verified in the
coding phase. See the definition of MAX_CLIST_TRANSPARENCY_BUFFER_SIZE. */
byte * pbuf = buf;
int opcode = pparams->pdf14_op;
@@ -4717,50 +4710,50 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
*pbuf++ = opcode; /* 1 byte */
switch (opcode) {
- default: /* Should not occur. */
- break;
- case PDF14_PUSH_DEVICE:
- put_value(pbuf, pparams->num_spot_colors);
+ default: /* Should not occur. */
+ break;
+ case PDF14_PUSH_DEVICE:
+ put_value(pbuf, pparams->num_spot_colors);
/* If we happen to be going to a color space like CIELAB then
we are going to do our blending in default RGB and convert
- to CIELAB at the end. To do this, we need to store the
- default RGB profile in the clist so that we can grab it
+ to CIELAB at the end. To do this, we need to store the
+ default RGB profile in the clist so that we can grab it
later on during the clist read back and put image command */
if (cdev->device_icc_profile->data_cs == gsCIELAB) {
/* Get the default RGB profile. Set the device hash code
so that we can extract it during the put_image operation. */
cdev->trans_dev_icc_hash = pparams->iccprofile->hashcode;
- found_icc =
+ found_icc =
clist_icc_searchtable(cdev, pparams->iccprofile->hashcode);
if (!found_icc) {
/* Add it to the table */
- clist_icc_addentry(cdev, pparams->iccprofile->hashcode,
+ clist_icc_addentry(cdev, pparams->iccprofile->hashcode,
pparams->iccprofile);
}
}
break;
- case PDF14_POP_DEVICE:
- code = 0;
- break;
- case PDF14_END_TRANS_GROUP:
- break; /* No data */
- case PDF14_BEGIN_TRANS_GROUP:
- code = c_pdf14trans_write_ctm(&pbuf, pparams);
- if (code < 0)
- return code;
- *pbuf++ = (pparams->Isolated & 1) + ((pparams->Knockout & 1) << 1);
- *pbuf++ = pparams->blend_mode;
- *pbuf++ = pparams->group_color;
- put_value(pbuf, pparams->group_color_numcomps);
- put_value(pbuf, pparams->opacity.alpha);
- put_value(pbuf, pparams->shape.alpha);
- put_value(pbuf, pparams->bbox);
- mask_id = pparams->mask_id;
- put_value(pbuf, pparams->mask_id);
- /* Color space information maybe ICC based
+ case PDF14_POP_DEVICE:
+ code = 0;
+ break;
+ case PDF14_END_TRANS_GROUP:
+ break; /* No data */
+ case PDF14_BEGIN_TRANS_GROUP:
+ code = c_pdf14trans_write_ctm(&pbuf, pparams);
+ if (code < 0)
+ return code;
+ *pbuf++ = (pparams->Isolated & 1) + ((pparams->Knockout & 1) << 1);
+ *pbuf++ = pparams->blend_mode;
+ *pbuf++ = pparams->group_color;
+ put_value(pbuf, pparams->group_color_numcomps);
+ put_value(pbuf, pparams->opacity.alpha);
+ put_value(pbuf, pparams->shape.alpha);
+ put_value(pbuf, pparams->bbox);
+ mask_id = pparams->mask_id;
+ put_value(pbuf, pparams->mask_id);
+ /* Color space information maybe ICC based
in this case we need to store the ICC
profile or the ID if it is cached already */
- if (pparams->group_color == ICC) {
+ if (pparams->group_color == ICC) {
/* Check if it is already in the ICC clist table */
hashcode = pparams->iccprofile->hashcode;
found_icc = clist_icc_searchtable(cdev, hashcode);
@@ -4775,34 +4768,34 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
} else {
put_value(pbuf, hashcode);
}
- break;
- case PDF14_BEGIN_TRANS_MASK:
- code = c_pdf14trans_write_ctm(&pbuf, pparams);
- if (code < 0)
- return code;
- put_value(pbuf, pparams->subtype);
- *pbuf++ = pparams->group_color;
- put_value(pbuf, pparams->group_color_numcomps);
- *pbuf++ = pparams->replacing;
- *pbuf++ = pparams->function_is_identity;
- *pbuf++ = pparams->Background_components;
- put_value(pbuf, pparams->bbox);
- mask_id = pparams->mask_id;
- put_value(pbuf, pparams->mask_id);
- if (pparams->Background_components) {
- const int l = sizeof(pparams->Background[0]) * pparams->Background_components;
-
- memcpy(pbuf, pparams->Background, l);
- pbuf += l;
- memcpy(pbuf, &pparams->GrayBackground, sizeof(pparams->GrayBackground));
- pbuf += sizeof(pparams->GrayBackground);
- }
- if (!pparams->function_is_identity)
- mask_size = sizeof(pparams->transfer_fn);
- /* Color space information may be ICC based
+ break;
+ case PDF14_BEGIN_TRANS_MASK:
+ code = c_pdf14trans_write_ctm(&pbuf, pparams);
+ if (code < 0)
+ return code;
+ put_value(pbuf, pparams->subtype);
+ *pbuf++ = pparams->group_color;
+ put_value(pbuf, pparams->group_color_numcomps);
+ *pbuf++ = pparams->replacing;
+ *pbuf++ = pparams->function_is_identity;
+ *pbuf++ = pparams->Background_components;
+ put_value(pbuf, pparams->bbox);
+ mask_id = pparams->mask_id;
+ put_value(pbuf, pparams->mask_id);
+ if (pparams->Background_components) {
+ const int l = sizeof(pparams->Background[0]) * pparams->Background_components;
+
+ memcpy(pbuf, pparams->Background, l);
+ pbuf += l;
+ memcpy(pbuf, &pparams->GrayBackground, sizeof(pparams->GrayBackground));
+ pbuf += sizeof(pparams->GrayBackground);
+ }
+ if (!pparams->function_is_identity)
+ mask_size = sizeof(pparams->transfer_fn);
+ /* Color space information may be ICC based
in this case we need to store the ICC
profile or the ID if it is cached already */
- if (pparams->group_color == ICC) {
+ if (pparams->group_color == ICC) {
/* Check if it is already in the ICC clist table */
hashcode = pparams->iccprofile->hashcode;
found_icc = clist_icc_searchtable(cdev, hashcode);
@@ -4817,24 +4810,24 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
} else {
put_value(pbuf, hashcode);
}
- break;
- case PDF14_END_TRANS_MASK:
- break;
- case PDF14_SET_BLEND_PARAMS:
- *pbuf++ = pparams->changed;
- if (pparams->changed & PDF14_SET_BLEND_MODE)
- *pbuf++ = pparams->blend_mode;
- if (pparams->changed & PDF14_SET_TEXT_KNOCKOUT)
- *pbuf++ = pparams->text_knockout;
- if (pparams->changed & PDF14_SET_OPACITY_ALPHA)
- put_value(pbuf, pparams->opacity.alpha);
- if (pparams->changed & PDF14_SET_SHAPE_ALPHA)
- put_value(pbuf, pparams->shape.alpha);
- if (pparams->changed & PDF14_SET_OVERPRINT)
- put_value(pbuf, pparams->overprint);
- if (pparams->changed & PDF14_SET_OVERPRINT_MODE)
- put_value(pbuf, pparams->overprint_mode);
- break;
+ break;
+ case PDF14_END_TRANS_MASK:
+ break;
+ case PDF14_SET_BLEND_PARAMS:
+ *pbuf++ = pparams->changed;
+ if (pparams->changed & PDF14_SET_BLEND_MODE)
+ *pbuf++ = pparams->blend_mode;
+ if (pparams->changed & PDF14_SET_TEXT_KNOCKOUT)
+ *pbuf++ = pparams->text_knockout;
+ if (pparams->changed & PDF14_SET_OPACITY_ALPHA)
+ put_value(pbuf, pparams->opacity.alpha);
+ if (pparams->changed & PDF14_SET_SHAPE_ALPHA)
+ put_value(pbuf, pparams->shape.alpha);
+ if (pparams->changed & PDF14_SET_OVERPRINT)
+ put_value(pbuf, pparams->overprint);
+ if (pparams->changed & PDF14_SET_OVERPRINT_MODE)
+ put_value(pbuf, pparams->overprint_mode);
+ break;
case PDF14_PUSH_TRANS_STATE:
break;
case PDF14_POP_TRANS_STATE:
@@ -4851,24 +4844,24 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
need = (pbuf - buf) + mask_size;
*psize = need;
if (need > avail) {
- if (avail)
- return_error(gs_error_rangecheck);
- else
- return gs_error_rangecheck;
+ if (avail)
+ return_error(gs_error_rangecheck);
+ else
+ return gs_error_rangecheck;
}
/* If we are writing more than the maximum ever expected,
* return a rangecheck error.
*/
if ( need + 3 > (MAX_CLIST_COMPOSITOR_SIZE) )
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Copy our serialized data into the output buffer */
memcpy(data, buf, need - mask_size);
if (mask_size) /* Include the transfer mask data if present */
- memcpy(data + need - mask_size, pparams->transfer_fn, mask_size);
+ memcpy(data + need - mask_size, pparams->transfer_fn, mask_size);
if_debug3('v', "[v] c_pdf14trans_write: opcode = %s mask_id=%d need = %d\n",
- pdf14_opcode_names[opcode], mask_id, need);
+ pdf14_opcode_names[opcode], mask_id, need);
return 0;
}
@@ -4876,13 +4869,13 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
/* Function prototypes */
static int gs_create_pdf14trans( gs_composite_t ** ppct,
- const gs_pdf14trans_params_t * pparams,
- gs_memory_t * mem );
+ const gs_pdf14trans_params_t * pparams,
+ gs_memory_t * mem );
#define read_value(dp, value)\
BEGIN\
- memcpy(&value, dp, sizeof(value));\
- dp += sizeof(value);\
+ memcpy(&value, dp, sizeof(value));\
+ dp += sizeof(value);\
END
/*
@@ -4891,130 +4884,130 @@ static int gs_create_pdf14trans( gs_composite_t ** ppct,
*/
static int
c_pdf14trans_read(gs_composite_t * * ppct, const byte * data,
- uint size, gs_memory_t * mem )
+ uint size, gs_memory_t * mem )
{
gs_pdf14trans_params_t params = {0};
const byte * start = data;
int used, code = 0;
if (size < 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Read PDF 1.4 compositor data from the clist */
params.pdf14_op = *data++;
if_debug2('v', "[v] c_pdf14trans_read: opcode = %s avail = %d",
- pdf14_opcode_names[params.pdf14_op], size);
+ pdf14_opcode_names[params.pdf14_op], size);
memset(&params.ctm, 0, sizeof(params.ctm));
switch (params.pdf14_op) {
- default: /* Should not occur. */
- break;
- case PDF14_PUSH_DEVICE:
- read_value(data, params.num_spot_colors);
- break;
- case PDF14_POP_DEVICE:
- code += 0; /* A good place for a breakpoint. */
- break;
- case PDF14_END_TRANS_GROUP:
- code += 0; /* A good place for a breakpoint. */
- break; /* No data */
+ default: /* Should not occur. */
+ break;
+ case PDF14_PUSH_DEVICE:
+ read_value(data, params.num_spot_colors);
+ break;
+ case PDF14_POP_DEVICE:
+ code += 0; /* A good place for a breakpoint. */
+ break;
+ case PDF14_END_TRANS_GROUP:
+ code += 0; /* A good place for a breakpoint. */
+ break; /* No data */
case PDF14_PUSH_TRANS_STATE:
break;
case PDF14_POP_TRANS_STATE:
break;
- case PDF14_BEGIN_TRANS_GROUP:
- /*
- * We are currently not using the bbox or the colorspace so they were
- * not placed in the clist
- */
- data = cmd_read_matrix(&params.ctm, data);
- params.Isolated = (*data) & 1;
- params.Knockout = (*data++ >> 1) & 1;
- params.blend_mode = *data++;
- params.group_color = *data++; /* Trans group color */
+ case PDF14_BEGIN_TRANS_GROUP:
+ /*
+ * We are currently not using the bbox or the colorspace so they were
+ * not placed in the clist
+ */
+ data = cmd_read_matrix(&params.ctm, data);
+ params.Isolated = (*data) & 1;
+ params.Knockout = (*data++ >> 1) & 1;
+ params.blend_mode = *data++;
+ params.group_color = *data++; /* Trans group color */
read_value(data,params.group_color_numcomps); /* color group size */
- read_value(data, params.opacity.alpha);
- read_value(data, params.shape.alpha);
- read_value(data, params.bbox);
- read_value(data, params.mask_id);
+ read_value(data, params.opacity.alpha);
+ read_value(data, params.shape.alpha);
+ read_value(data, params.bbox);
+ read_value(data, params.mask_id);
read_value(data, params.icc_hash);
- break;
- case PDF14_BEGIN_TRANS_MASK:
- /* This is the largest transparency parameter at this time (potentially
- * 1275 bytes in size if Background_components =
- * GS_CLIENT_COLOR_MAX_COMPONENTS and we have a transfer function
- * as well).
- *
- * NOTE:
- * The clist reader must be able to handle this sized device.
- * If any changes are made here the #define MAX_CLIST_COMPOSITOR_SIZE
- * may also need to be changed correspondingly (defined in gstparam.h)
- * Also... if another compositor param should exceed this size, this
- * same condition applies.
- */
- data = cmd_read_matrix(&params.ctm, data);
- read_value(data, params.subtype);
+ break;
+ case PDF14_BEGIN_TRANS_MASK:
+ /* This is the largest transparency parameter at this time (potentially
+ * 1275 bytes in size if Background_components =
+ * GS_CLIENT_COLOR_MAX_COMPONENTS and we have a transfer function
+ * as well).
+ *
+ * NOTE:
+ * The clist reader must be able to handle this sized device.
+ * If any changes are made here the #define MAX_CLIST_COMPOSITOR_SIZE
+ * may also need to be changed correspondingly (defined in gstparam.h)
+ * Also... if another compositor param should exceed this size, this
+ * same condition applies.
+ */
+ data = cmd_read_matrix(&params.ctm, data);
+ read_value(data, params.subtype);
params.group_color = *data++;
- read_value(data, params.group_color_numcomps);
- params.replacing = *data++;
- params.function_is_identity = *data++;
- params.Background_components = *data++;
- read_value(data, params.bbox);
- read_value(data, params.mask_id);
- if (params.Background_components) {
- const int l = sizeof(params.Background[0]) * params.Background_components;
-
- memcpy(params.Background, data, l);
- data += l;
- memcpy(&params.GrayBackground, data, sizeof(params.GrayBackground));
- data += sizeof(params.GrayBackground);
- }
+ read_value(data, params.group_color_numcomps);
+ params.replacing = *data++;
+ params.function_is_identity = *data++;
+ params.Background_components = *data++;
+ read_value(data, params.bbox);
+ read_value(data, params.mask_id);
+ if (params.Background_components) {
+ const int l = sizeof(params.Background[0]) * params.Background_components;
+
+ memcpy(params.Background, data, l);
+ data += l;
+ memcpy(&params.GrayBackground, data, sizeof(params.GrayBackground));
+ data += sizeof(params.GrayBackground);
+ }
read_value(data, params.icc_hash);
- if (params.function_is_identity) {
- int i;
-
- for (i = 0; i < MASK_TRANSFER_FUNCTION_SIZE; i++) {
- params.transfer_fn[i] = (byte)floor(i *
- (255.0 / (MASK_TRANSFER_FUNCTION_SIZE - 1)) + 0.5);
- }
- } else {
- read_value(data, params.transfer_fn);
- }
- break;
- case PDF14_END_TRANS_MASK:
- break;
+ if (params.function_is_identity) {
+ int i;
+
+ for (i = 0; i < MASK_TRANSFER_FUNCTION_SIZE; i++) {
+ params.transfer_fn[i] = (byte)floor(i *
+ (255.0 / (MASK_TRANSFER_FUNCTION_SIZE - 1)) + 0.5);
+ }
+ } else {
+ read_value(data, params.transfer_fn);
+ }
+ break;
+ case PDF14_END_TRANS_MASK:
+ break;
case PDF14_PUSH_SMASK_COLOR:
return 0;
break;
case PDF14_POP_SMASK_COLOR:
return 0;
break;
- case PDF14_SET_BLEND_PARAMS:
- params.changed = *data++;
- if (params.changed & PDF14_SET_BLEND_MODE)
- params.blend_mode = *data++;
- if (params.changed & PDF14_SET_TEXT_KNOCKOUT)
- params.text_knockout = *data++;
- if (params.changed & PDF14_SET_OPACITY_ALPHA)
- read_value(data, params.opacity.alpha);
- if (params.changed & PDF14_SET_SHAPE_ALPHA)
- read_value(data, params.shape.alpha);
- if (params.changed & PDF14_SET_OVERPRINT)
- read_value(data, params.overprint);
- if (params.changed & PDF14_SET_OVERPRINT_MODE)
- read_value(data, params.overprint_mode);
- break;
+ case PDF14_SET_BLEND_PARAMS:
+ params.changed = *data++;
+ if (params.changed & PDF14_SET_BLEND_MODE)
+ params.blend_mode = *data++;
+ if (params.changed & PDF14_SET_TEXT_KNOCKOUT)
+ params.text_knockout = *data++;
+ if (params.changed & PDF14_SET_OPACITY_ALPHA)
+ read_value(data, params.opacity.alpha);
+ if (params.changed & PDF14_SET_SHAPE_ALPHA)
+ read_value(data, params.shape.alpha);
+ if (params.changed & PDF14_SET_OVERPRINT)
+ read_value(data, params.overprint);
+ if (params.changed & PDF14_SET_OVERPRINT_MODE)
+ read_value(data, params.overprint_mode);
+ break;
}
code = gs_create_pdf14trans(ppct, &params, mem);
if (code < 0)
- return code;
+ return code;
used = data - start;
if_debug2('v', " mask_id=%d used = %d\n", params.mask_id, used);
-
+
/* If we read more than the maximum expected, return a rangecheck error */
if ( used + 3 > MAX_CLIST_COMPOSITOR_SIZE )
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else
- return used;
+ return used;
}
/*
@@ -5027,8 +5020,8 @@ c_pdf14trans_adjust_ctm(gs_composite_t * pct0, int x0, int y0, gs_imager_state *
gs_matrix mat = pct->params.ctm;
if_debug6('L', " [%g %g %g %g %g %g]\n",
- mat.xx, mat.xy, mat.yx, mat.yy,
- mat.tx, mat.ty);
+ mat.xx, mat.xy, mat.yx, mat.yy,
+ mat.tx, mat.ty);
mat.tx -= x0;
mat.ty -= y0;
gs_imager_setmatrix(pis, &mat);
@@ -5056,13 +5049,13 @@ c_pdf14trans_create_default_compositor(const gs_composite_t * pct,
* for the PDF 1.4 compositing device.
*/
switch (pdf14pct->params.pdf14_op) {
- case PDF14_PUSH_DEVICE:
- code = gs_pdf14_device_push(mem, pis, &p14dev, tdev, pdf14pct);
- *pp14dev = p14dev;
- break;
- default:
- *pp14dev = tdev;
- break;
+ case PDF14_PUSH_DEVICE:
+ code = gs_pdf14_device_push(mem, pis, &p14dev, tdev, pdf14pct);
+ *pp14dev = p14dev;
+ break;
+ default:
+ *pp14dev = tdev;
+ break;
}
return code;
}
@@ -5077,31 +5070,31 @@ find_opening_op(int opening_op, gs_composite_t **ppcte, int return_code)
gs_composite_t *pcte = *ppcte;
for (;;) {
- if (pcte->type->comp_id == GX_COMPOSITOR_PDF14_TRANS) {
- gs_pdf14trans_t *pct = (gs_pdf14trans_t *)pcte;
- int op = pct->params.pdf14_op;
-
- *ppcte = pcte;
- if (op == opening_op)
- return return_code;
- if (op != PDF14_SET_BLEND_PARAMS) {
- if (opening_op == PDF14_BEGIN_TRANS_MASK)
- return 0;
- if (opening_op == PDF14_BEGIN_TRANS_GROUP) {
- if (op != PDF14_BEGIN_TRANS_MASK && op != PDF14_END_TRANS_MASK)
- return 0;
- }
- if (opening_op == PDF14_PUSH_DEVICE) {
- if (op != PDF14_BEGIN_TRANS_MASK && op != PDF14_END_TRANS_MASK &&
- op != PDF14_BEGIN_TRANS_GROUP && op != PDF14_END_TRANS_GROUP)
- return 0;
- }
- }
- } else
- return 0;
- pcte = pcte->prev;
- if (pcte == NULL)
- return 2; /* Not in queue. */
+ if (pcte->type->comp_id == GX_COMPOSITOR_PDF14_TRANS) {
+ gs_pdf14trans_t *pct = (gs_pdf14trans_t *)pcte;
+ int op = pct->params.pdf14_op;
+
+ *ppcte = pcte;
+ if (op == opening_op)
+ return return_code;
+ if (op != PDF14_SET_BLEND_PARAMS) {
+ if (opening_op == PDF14_BEGIN_TRANS_MASK)
+ return 0;
+ if (opening_op == PDF14_BEGIN_TRANS_GROUP) {
+ if (op != PDF14_BEGIN_TRANS_MASK && op != PDF14_END_TRANS_MASK)
+ return 0;
+ }
+ if (opening_op == PDF14_PUSH_DEVICE) {
+ if (op != PDF14_BEGIN_TRANS_MASK && op != PDF14_END_TRANS_MASK &&
+ op != PDF14_BEGIN_TRANS_GROUP && op != PDF14_END_TRANS_GROUP)
+ return 0;
+ }
+ }
+ } else
+ return 0;
+ pcte = pcte->prev;
+ if (pcte == NULL)
+ return 2; /* Not in queue. */
}
}
@@ -5115,27 +5108,27 @@ find_same_op(const gs_composite_t *composite_action, int my_op, gs_composite_t *
gs_composite_t *pct = *ppcte;
for (;;) {
- if (pct->type->comp_id == GX_COMPOSITOR_PDF14_TRANS) {
- gs_pdf14trans_t *pct_pdf14 = (gs_pdf14trans_t *)pct;
-
- *ppcte = pct;
- if (pct_pdf14->params.pdf14_op != my_op)
- return 0;
- if (pct_pdf14->params.csel == pct0->params.csel) {
+ if (pct->type->comp_id == GX_COMPOSITOR_PDF14_TRANS) {
+ gs_pdf14trans_t *pct_pdf14 = (gs_pdf14trans_t *)pct;
+
+ *ppcte = pct;
+ if (pct_pdf14->params.pdf14_op != my_op)
+ return 0;
+ if (pct_pdf14->params.csel == pct0->params.csel) {
/* If the new parameters completely replace the old ones
then remove the old one from the queu */
if ((pct_pdf14->params.changed & pct0->params.changed) ==
pct_pdf14->params.changed) {
- return 4;
+ return 4;
} else {
return 0;
}
}
- } else
- return 0;
- pct = pct->prev;
- if (pct == NULL)
- return 0; /* Not in queue. */
+ } else
+ return 0;
+ pct = pct->prev;
+ if (pct == NULL)
+ return 0; /* Not in queue. */
}
}
@@ -5143,34 +5136,34 @@ find_same_op(const gs_composite_t *composite_action, int my_op, gs_composite_t *
* Check for closing compositor.
*/
static int
-c_pdf14trans_is_closing(const gs_composite_t * composite_action, gs_composite_t ** ppcte,
+c_pdf14trans_is_closing(const gs_composite_t * composite_action, gs_composite_t ** ppcte,
gx_device *dev)
{
gs_pdf14trans_t *pct0 = (gs_pdf14trans_t *)composite_action;
int op0 = pct0->params.pdf14_op;
switch (op0) {
- default: return_error(gs_error_unregistered); /* Must not happen. */
- case PDF14_PUSH_DEVICE:
- return 0;
- case PDF14_POP_DEVICE:
- if (*ppcte == NULL)
- return 0;
- else {
- int code = find_opening_op(PDF14_PUSH_DEVICE, ppcte, 1);
-
- if (code == 1)
- return 5;
- return code;
- }
- case PDF14_BEGIN_TRANS_GROUP:
- return 0;
- case PDF14_END_TRANS_GROUP:
- if (*ppcte == NULL)
- return 2;
- return find_opening_op(PDF14_BEGIN_TRANS_GROUP, ppcte, 6);
- case PDF14_BEGIN_TRANS_MASK:
- return 0;
+ default: return_error(gs_error_unregistered); /* Must not happen. */
+ case PDF14_PUSH_DEVICE:
+ return 0;
+ case PDF14_POP_DEVICE:
+ if (*ppcte == NULL)
+ return 0;
+ else {
+ int code = find_opening_op(PDF14_PUSH_DEVICE, ppcte, 1);
+
+ if (code == 1)
+ return 5;
+ return code;
+ }
+ case PDF14_BEGIN_TRANS_GROUP:
+ return 0;
+ case PDF14_END_TRANS_GROUP:
+ if (*ppcte == NULL)
+ return 2;
+ return find_opening_op(PDF14_BEGIN_TRANS_GROUP, ppcte, 6);
+ case PDF14_BEGIN_TRANS_MASK:
+ return 0;
case PDF14_PUSH_TRANS_STATE:
return 0;
case PDF14_POP_TRANS_STATE:
@@ -5181,14 +5174,14 @@ c_pdf14trans_is_closing(const gs_composite_t * composite_action, gs_composite_t
case PDF14_POP_SMASK_COLOR:
return 0;
break;
- case PDF14_END_TRANS_MASK:
- if (*ppcte == NULL)
- return 2;
- return find_opening_op(PDF14_BEGIN_TRANS_MASK, ppcte, 6);
- case PDF14_SET_BLEND_PARAMS:
- if (*ppcte == NULL)
- return 0;
- /* hack : ignore csel - here it is always zero : */
+ case PDF14_END_TRANS_MASK:
+ if (*ppcte == NULL)
+ return 2;
+ return find_opening_op(PDF14_BEGIN_TRANS_MASK, ppcte, 6);
+ case PDF14_SET_BLEND_PARAMS:
+ if (*ppcte == NULL)
+ return 0;
+ /* hack : ignore csel - here it is always zero : */
return find_same_op(composite_action, PDF14_SET_BLEND_PARAMS, ppcte);
}
}
@@ -5203,14 +5196,14 @@ c_pdf14trans_is_friendly(const gs_composite_t * composite_action, byte cmd0, byt
int op0 = pct0->params.pdf14_op;
if (op0 == PDF14_PUSH_DEVICE || op0 == PDF14_END_TRANS_GROUP) {
- /* Halftone commands are always passed to the target printer device,
- because transparency buffers are always contone.
- So we're safe to execute them before queued transparency compositors. */
- if (cmd0 == cmd_opv_extend && (cmd1 == cmd_opv_ext_put_halftone ||
- cmd1 == cmd_opv_ext_put_ht_seg))
- return true;
- if (cmd0 == cmd_opv_set_misc && (cmd1 >> 6) == (cmd_set_misc_map >> 6))
- return true;
+ /* Halftone commands are always passed to the target printer device,
+ because transparency buffers are always contone.
+ So we're safe to execute them before queued transparency compositors. */
+ if (cmd0 == cmd_opv_extend && (cmd1 == cmd_opv_ext_put_halftone ||
+ cmd1 == cmd_opv_ext_put_ht_seg))
+ return true;
+ if (cmd0 == cmd_opv_set_misc && (cmd1 >> 6) == (cmd_set_misc_map >> 6))
+ return true;
}
return false;
}
@@ -5226,7 +5219,6 @@ static composite_clist_write_update(c_pdf14trans_clist_write_update);
static composite_clist_read_update(c_pdf14trans_clist_read_update);
static composite_get_cropping_proc(c_pdf14trans_get_cropping);
-
/*
* Methods for the PDF 1.4 transparency compositor
*
@@ -5238,34 +5230,34 @@ static composite_get_cropping_proc(c_pdf14trans_get_cropping);
const gs_composite_type_t gs_composite_pdf14trans_type = {
GX_COMPOSITOR_PDF14_TRANS,
{
- c_pdf14trans_create_default_compositor, /* procs.create_default_compositor */
- c_pdf14trans_equal, /* procs.equal */
- c_pdf14trans_write, /* procs.write */
- c_pdf14trans_read, /* procs.read */
- c_pdf14trans_adjust_ctm, /* procs.adjust_ctm */
- c_pdf14trans_is_closing, /* procs.is_closing */
- c_pdf14trans_is_friendly, /* procs.is_friendly */
- /* Create a PDF 1.4 clist write device */
- c_pdf14trans_clist_write_update, /* procs.composite_clist_write_update */
- c_pdf14trans_clist_read_update, /* procs.composite_clist_reade_update */
- c_pdf14trans_get_cropping /* procs.composite_get_cropping */
+ c_pdf14trans_create_default_compositor, /* procs.create_default_compositor */
+ c_pdf14trans_equal, /* procs.equal */
+ c_pdf14trans_write, /* procs.write */
+ c_pdf14trans_read, /* procs.read */
+ c_pdf14trans_adjust_ctm, /* procs.adjust_ctm */
+ c_pdf14trans_is_closing, /* procs.is_closing */
+ c_pdf14trans_is_friendly, /* procs.is_friendly */
+ /* Create a PDF 1.4 clist write device */
+ c_pdf14trans_clist_write_update, /* procs.composite_clist_write_update */
+ c_pdf14trans_clist_read_update, /* procs.composite_clist_reade_update */
+ c_pdf14trans_get_cropping /* procs.composite_get_cropping */
} /* procs */
};
const gs_composite_type_t gs_composite_pdf14trans_no_clist_writer_type = {
GX_COMPOSITOR_PDF14_TRANS,
{
- c_pdf14trans_create_default_compositor, /* procs.create_default_compositor */
- c_pdf14trans_equal, /* procs.equal */
- c_pdf14trans_write, /* procs.write */
- c_pdf14trans_read, /* procs.read */
- c_pdf14trans_adjust_ctm, /* procs.adjust_ctm */
- c_pdf14trans_is_closing, /* procs.is_closing */
- c_pdf14trans_is_friendly, /* procs.is_friendly */
- /* The PDF 1.4 clist writer already exists, Do not create it. */
- gx_default_composite_clist_write_update, /* procs.composite_clist_write_update */
- c_pdf14trans_clist_read_update, /* procs.composite_clist_reade_update */
- c_pdf14trans_get_cropping /* procs.composite_get_cropping */
+ c_pdf14trans_create_default_compositor, /* procs.create_default_compositor */
+ c_pdf14trans_equal, /* procs.equal */
+ c_pdf14trans_write, /* procs.write */
+ c_pdf14trans_read, /* procs.read */
+ c_pdf14trans_adjust_ctm, /* procs.adjust_ctm */
+ c_pdf14trans_is_closing, /* procs.is_closing */
+ c_pdf14trans_is_friendly, /* procs.is_friendly */
+ /* The PDF 1.4 clist writer already exists, Do not create it. */
+ gx_default_composite_clist_write_update, /* procs.composite_clist_write_update */
+ c_pdf14trans_clist_read_update, /* procs.composite_clist_reade_update */
+ c_pdf14trans_get_cropping /* procs.composite_get_cropping */
} /* procs */
};
@@ -5276,7 +5268,7 @@ int
gs_is_pdf14trans_compositor(const gs_composite_t * pct)
{
return (pct->type == &gs_composite_pdf14trans_type
- || pct->type == &gs_composite_pdf14trans_no_clist_writer_type);
+ || pct->type == &gs_composite_pdf14trans_no_clist_writer_type);
}
/*
@@ -5291,9 +5283,9 @@ gs_create_pdf14trans(
gs_pdf14trans_t * pct;
pct = gs_alloc_struct(mem, gs_pdf14trans_t, &st_pdf14trans,
- "gs_create_pdf14trans");
+ "gs_create_pdf14trans");
if (pct == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pct->type = &gs_composite_pdf14trans_type;
pct->id = gs_next_ids(mem, 1);
pct->params = *pparams;
@@ -5315,7 +5307,7 @@ send_pdf14trans(gs_imager_state * pis, gx_device * dev,
pparams->ctm = ctm_only(pis);
code = gs_create_pdf14trans(&pct, pparams, mem);
if (code < 0)
- return code;
+ return code;
code = dev_proc(dev, create_compositor) (dev, pcdev, pct, pis, mem, NULL);
gs_free_object(pis->memory, pct, "send_pdf14trans");
@@ -5344,70 +5336,70 @@ send_pdf14trans(gs_imager_state * pis, gx_device * dev,
*/
#define pdf14_clist_procs(get_color_mapping_procs, get_color_comp_index,\
- encode_color, decode_color) \
+ encode_color, decode_color) \
{\
- NULL, /* open */\
- gx_forward_get_initial_matrix, /* get_initial_matrix */\
- gx_forward_sync_output, /* sync_output */\
- gx_forward_output_page, /* output_page */\
- gx_forward_close_device, /* close_device */\
- encode_color, /* rgb_map_rgb_color */\
- decode_color, /* map_color_rgb */\
- gx_forward_fill_rectangle, /* fill_rectangle */\
- gx_forward_tile_rectangle, /* tile_rectangle */\
- gx_forward_copy_mono, /* copy_mono */\
- gx_forward_copy_color, /* copy_color */\
- NULL , /* draw_line - obsolete */\
- gx_forward_get_bits, /* get_bits */\
- gx_forward_get_params, /* get_params */\
- pdf14_put_params, /* put_params */\
- encode_color, /* map_cmyk_color */\
- gx_forward_get_xfont_procs, /* get_xfont_procs */\
- gx_forward_get_xfont_device, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_forward_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- gx_forward_copy_alpha, /* copy_alpha */\
- gx_forward_get_band, /* get_band */\
- gx_forward_copy_rop, /* copy_rop */\
- pdf14_clist_fill_path, /* fill_path */\
- pdf14_clist_stroke_path, /* stroke_path */\
- gx_forward_fill_mask, /* fill_mask */\
- gx_forward_fill_trapezoid, /* fill_trapezoid */\
- gx_forward_fill_parallelogram, /* fill_parallelogram */\
- gx_forward_fill_triangle, /* fill_triangle */\
- gx_forward_draw_thin_line, /* draw_thin_line */\
- pdf14_clist_begin_image, /* begin_image */\
- gx_forward_image_data, /* image_data */\
- gx_forward_end_image, /* end_image */\
- gx_forward_strip_tile_rectangle, /* strip_tile_rectangle */\
- gx_forward_strip_copy_rop, /* strip_copy_rop, */\
- gx_forward_get_clipping_box, /* get_clipping_box */\
- pdf14_clist_begin_typed_image, /* begin_typed_image */\
- gx_forward_get_bits_rectangle, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- pdf14_clist_create_compositor, /* create_compositor */\
- gx_forward_get_hardware_params, /* get_hardware_params */\
- pdf14_clist_text_begin, /* text_begin */\
- NULL, /* finish_copydevice */\
- pdf14_begin_transparency_group,\
- pdf14_end_transparency_group,\
- pdf14_begin_transparency_mask,\
- pdf14_end_transparency_mask,\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- get_color_comp_index, /* get_color_comp_index */\
- encode_color, /* encode_color */\
- decode_color, /* decode_color */\
- NULL, /* pattern_manage */\
- NULL, /* fill_rectangle_hl_color */\
- NULL, /* include_color_space */\
- NULL, /* fill_linear_color_scanline */\
- NULL, /* fill_linear_color_trapezoid */\
- NULL, /* fill_linear_color_triangle */\
- gx_forward_update_spot_equivalent_colors, /* update spot */\
- gx_forward_ret_devn_params, /* gx_forward_ret_devn_params */\
- gx_forward_fillpage,\
+ NULL, /* open */\
+ gx_forward_get_initial_matrix, /* get_initial_matrix */\
+ gx_forward_sync_output, /* sync_output */\
+ gx_forward_output_page, /* output_page */\
+ gx_forward_close_device, /* close_device */\
+ encode_color, /* rgb_map_rgb_color */\
+ decode_color, /* map_color_rgb */\
+ gx_forward_fill_rectangle, /* fill_rectangle */\
+ gx_forward_tile_rectangle, /* tile_rectangle */\
+ gx_forward_copy_mono, /* copy_mono */\
+ gx_forward_copy_color, /* copy_color */\
+ NULL , /* draw_line - obsolete */\
+ gx_forward_get_bits, /* get_bits */\
+ gx_forward_get_params, /* get_params */\
+ pdf14_put_params, /* put_params */\
+ encode_color, /* map_cmyk_color */\
+ gx_forward_get_xfont_procs, /* get_xfont_procs */\
+ gx_forward_get_xfont_device, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_forward_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ gx_forward_copy_alpha, /* copy_alpha */\
+ gx_forward_get_band, /* get_band */\
+ gx_forward_copy_rop, /* copy_rop */\
+ pdf14_clist_fill_path, /* fill_path */\
+ pdf14_clist_stroke_path, /* stroke_path */\
+ gx_forward_fill_mask, /* fill_mask */\
+ gx_forward_fill_trapezoid, /* fill_trapezoid */\
+ gx_forward_fill_parallelogram, /* fill_parallelogram */\
+ gx_forward_fill_triangle, /* fill_triangle */\
+ gx_forward_draw_thin_line, /* draw_thin_line */\
+ pdf14_clist_begin_image, /* begin_image */\
+ gx_forward_image_data, /* image_data */\
+ gx_forward_end_image, /* end_image */\
+ gx_forward_strip_tile_rectangle, /* strip_tile_rectangle */\
+ gx_forward_strip_copy_rop, /* strip_copy_rop, */\
+ gx_forward_get_clipping_box, /* get_clipping_box */\
+ pdf14_clist_begin_typed_image, /* begin_typed_image */\
+ gx_forward_get_bits_rectangle, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ pdf14_clist_create_compositor, /* create_compositor */\
+ gx_forward_get_hardware_params, /* get_hardware_params */\
+ pdf14_clist_text_begin, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ pdf14_begin_transparency_group,\
+ pdf14_end_transparency_group,\
+ pdf14_begin_transparency_mask,\
+ pdf14_end_transparency_mask,\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ get_color_comp_index, /* get_color_comp_index */\
+ encode_color, /* encode_color */\
+ decode_color, /* decode_color */\
+ NULL, /* pattern_manage */\
+ NULL, /* fill_rectangle_hl_color */\
+ NULL, /* include_color_space */\
+ NULL, /* fill_linear_color_scanline */\
+ NULL, /* fill_linear_color_trapezoid */\
+ NULL, /* fill_linear_color_triangle */\
+ gx_forward_update_spot_equivalent_colors, /* update spot */\
+ gx_forward_ret_devn_params, /* gx_forward_ret_devn_params */\
+ gx_forward_fillpage,\
pdf14_push_transparency_state,\
pdf14_pop_transparency_state,\
NULL, /* put_image */\
@@ -5423,38 +5415,38 @@ static dev_proc_begin_image(pdf14_clist_begin_image);
static dev_proc_begin_typed_image(pdf14_clist_begin_typed_image);
static const gx_device_procs pdf14_clist_Gray_procs =
- pdf14_clist_procs(gx_default_DevGray_get_color_mapping_procs,
- gx_default_DevGray_get_color_comp_index,
- pdf14_encode_color,
- pdf14_decode_color);
+ pdf14_clist_procs(gx_default_DevGray_get_color_mapping_procs,
+ gx_default_DevGray_get_color_comp_index,
+ pdf14_encode_color,
+ pdf14_decode_color);
static const gx_device_procs pdf14_clist_RGB_procs =
- pdf14_clist_procs(gx_default_DevRGB_get_color_mapping_procs,
- gx_default_DevRGB_get_color_comp_index,
- pdf14_encode_color,
- pdf14_decode_color);
+ pdf14_clist_procs(gx_default_DevRGB_get_color_mapping_procs,
+ gx_default_DevRGB_get_color_comp_index,
+ pdf14_encode_color,
+ pdf14_decode_color);
static const gx_device_procs pdf14_clist_CMYK_procs =
- pdf14_clist_procs(gx_default_DevCMYK_get_color_mapping_procs,
- gx_default_DevCMYK_get_color_comp_index,
- pdf14_encode_color, pdf14_decode_color);
+ pdf14_clist_procs(gx_default_DevCMYK_get_color_mapping_procs,
+ gx_default_DevCMYK_get_color_comp_index,
+ pdf14_encode_color, pdf14_decode_color);
static const gx_device_procs pdf14_clist_CMYKspot_procs =
- pdf14_clist_procs(pdf14_cmykspot_get_color_mapping_procs,
- pdf14_cmykspot_get_color_comp_index,
- pdf14_compressed_encode_color,
- pdf14_compressed_decode_color);
+ pdf14_clist_procs(pdf14_cmykspot_get_color_mapping_procs,
+ pdf14_cmykspot_get_color_comp_index,
+ pdf14_compressed_encode_color,
+ pdf14_compressed_decode_color);
static const gx_device_procs pdf14_clist_custom_procs =
- pdf14_clist_procs(gx_forward_get_color_mapping_procs,
- gx_forward_get_color_comp_index,
- gx_forward_encode_color,
- gx_forward_decode_color);
+ pdf14_clist_procs(gx_forward_get_color_mapping_procs,
+ gx_forward_get_color_comp_index,
+ gx_forward_encode_color,
+ gx_forward_decode_color);
const pdf14_clist_device pdf14_clist_Gray_device = {
std_device_color_stype_body(pdf14_clist_device, &pdf14_clist_Gray_procs,
- "pdf14clistgray", &st_pdf14_device,
- XSIZE, YSIZE, X_DPI, Y_DPI, 8, 255, 256),
+ "pdf14clistgray", &st_pdf14_device,
+ XSIZE, YSIZE, X_DPI, Y_DPI, 8, 255, 256),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -5464,8 +5456,8 @@ const pdf14_clist_device pdf14_clist_Gray_device = {
const pdf14_clist_device pdf14_clist_RGB_device = {
std_device_color_stype_body(pdf14_clist_device, &pdf14_clist_RGB_procs,
- "pdf14clistRGB", &st_pdf14_device,
- XSIZE, YSIZE, X_DPI, Y_DPI, 24, 255, 256),
+ "pdf14clistRGB", &st_pdf14_device,
+ XSIZE, YSIZE, X_DPI, Y_DPI, 24, 255, 256),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -5475,9 +5467,9 @@ const pdf14_clist_device pdf14_clist_RGB_device = {
const pdf14_clist_device pdf14_clist_CMYK_device = {
std_device_std_color_full_body_type(pdf14_clist_device,
- &pdf14_clist_CMYK_procs, "pdf14clistcmyk",
- &st_pdf14_device, XSIZE, YSIZE, X_DPI, Y_DPI, 32,
- 0, 0, 0, 0, 0, 0),
+ &pdf14_clist_CMYK_procs, "pdf14clistcmyk",
+ &st_pdf14_device, XSIZE, YSIZE, X_DPI, Y_DPI, 32,
+ 0, 0, 0, 0, 0, 0),
{ 0 }, /* Procs */
NULL, /* target */
{ 0 }, /* devn_params - not used */
@@ -5529,7 +5521,6 @@ const pdf14_clist_device pdf14_clist_custom_device = {
&custom_blending_procs
};
-
/*
* the PDF 1.4 transparency spec says that color space for blending
* operations can be based upon either a color space specified in the
@@ -5538,17 +5529,17 @@ const pdf14_clist_device pdf14_clist_custom_device = {
*/
static int
get_pdf14_clist_device_proto(gx_device * dev, pdf14_clist_device ** pdevproto,
- pdf14_clist_device * ptempdevproto, gs_imager_state * pis,
- const gs_pdf14trans_t * pdf14pct)
+ pdf14_clist_device * ptempdevproto, gs_imager_state * pis,
+ const gs_pdf14trans_t * pdf14pct)
{
pdf14_default_colorspace_t dev_cs =
- pdf14_determine_default_blend_cs(dev);
+ pdf14_determine_default_blend_cs(dev);
switch (dev_cs) {
- case PDF14_DeviceGray:
- *pdevproto = (pdf14_clist_device *)&pdf14_clist_Gray_device;
- /* We want gray to be single channel. Low level
- initialization of gray device prototype is
+ case PDF14_DeviceGray:
+ *pdevproto = (pdf14_clist_device *)&pdf14_clist_Gray_device;
+ /* We want gray to be single channel. Low level
+ initialization of gray device prototype is
peculiar in that in dci_std_color_num_components
the comment is
"A device is monochrome only if it is bi-level"
@@ -5557,103 +5548,103 @@ get_pdf14_clist_device_proto(gx_device * dev, pdf14_clist_device ** pdevproto,
the prototype intialization here */
*ptempdevproto = **pdevproto;
ptempdevproto->color_info.max_components = 1;
- ptempdevproto->color_info.num_components =
+ ptempdevproto->color_info.num_components =
ptempdevproto->color_info.max_components;
if (dev->color_info.icc_profile == '\0') {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
DEFAULT_GRAY_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceRGB:
- *pdevproto = (pdf14_clist_device *)&pdf14_clist_RGB_device;
+ break;
+ case PDF14_DeviceRGB:
+ *pdevproto = (pdf14_clist_device *)&pdf14_clist_RGB_device;
*ptempdevproto = **pdevproto;
- if (dev->color_info.icc_profile == '\0' ||
+ if (dev->color_info.icc_profile == '\0' ||
dev->device_icc_profile->data_cs == gsCIELAB) {
strcpy(&(ptempdevproto->color_info.icc_profile[0]), DEFAULT_RGB_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceCMYK:
- *pdevproto = (pdf14_clist_device *)&pdf14_clist_CMYK_device;
+ break;
+ case PDF14_DeviceCMYK:
+ *pdevproto = (pdf14_clist_device *)&pdf14_clist_CMYK_device;
*ptempdevproto = **pdevproto;
if (dev->color_info.icc_profile == '\0') {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
DEFAULT_CMYK_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceCMYKspot:
- *pdevproto = (pdf14_clist_device *)&pdf14_clist_CMYKspot_device;
+ break;
+ case PDF14_DeviceCMYKspot:
+ *pdevproto = (pdf14_clist_device *)&pdf14_clist_CMYKspot_device;
*ptempdevproto = **pdevproto;
- /*
- * The number of components for the PDF14 device is the sum
- * of the process components and the number of spot colors
- * for the page.
- */
- if (pdf14pct->params.num_spot_colors >= 0) {
- ptempdevproto->devn_params.page_spot_colors =
- pdf14pct->params.num_spot_colors;
- ptempdevproto->color_info.num_components =
- ptempdevproto->devn_params.num_std_colorant_names +
- pdf14pct->params.num_spot_colors;
- if (ptempdevproto->color_info.num_components >
- ptempdevproto->color_info.max_components)
- ptempdevproto->color_info.num_components =
- ptempdevproto->color_info.max_components;
- }
+ /*
+ * The number of components for the PDF14 device is the sum
+ * of the process components and the number of spot colors
+ * for the page.
+ */
+ if (pdf14pct->params.num_spot_colors >= 0) {
+ ptempdevproto->devn_params.page_spot_colors =
+ pdf14pct->params.num_spot_colors;
+ ptempdevproto->color_info.num_components =
+ ptempdevproto->devn_params.num_std_colorant_names +
+ pdf14pct->params.num_spot_colors;
+ if (ptempdevproto->color_info.num_components >
+ ptempdevproto->color_info.max_components)
+ ptempdevproto->color_info.num_components =
+ ptempdevproto->color_info.max_components;
+ }
if (dev->color_info.icc_profile == '\0') {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
DEFAULT_CMYK_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
*pdevproto = ptempdevproto;
- break;
- case PDF14_DeviceCustom:
- /*
- * We are using the output device's process color model. The
- * color_info for the PDF 1.4 compositing device needs to match
- * the output device.
- */
- *ptempdevproto = pdf14_clist_custom_device;
- ptempdevproto->color_info = dev->color_info;
+ break;
+ case PDF14_DeviceCustom:
+ /*
+ * We are using the output device's process color model. The
+ * color_info for the PDF 1.4 compositing device needs to match
+ * the output device.
+ */
+ *ptempdevproto = pdf14_clist_custom_device;
+ ptempdevproto->color_info = dev->color_info;
/* The pdf14 device has to be 8 bit continuous tone. Force it */
- ptempdevproto->color_info.depth =
+ ptempdevproto->color_info.depth =
ptempdevproto->color_info.num_components * 8;
- ptempdevproto->color_info.max_gray = 255;
+ ptempdevproto->color_info.max_gray = 255;
ptempdevproto->color_info.max_color = 255;
ptempdevproto->color_info.dither_grays = 256;
ptempdevproto->color_info.dither_colors = 256;
if (dev->color_info.icc_profile == '\0') {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
DEFAULT_CMYK_ICC);
} else {
- strcpy(&(ptempdevproto->color_info.icc_profile[0]),
+ strcpy(&(ptempdevproto->color_info.icc_profile[0]),
dev->color_info.icc_profile);
}
- *pdevproto = ptempdevproto;
- break;
- default: /* Should not occur */
- return_error(gs_error_rangecheck);
+ *pdevproto = ptempdevproto;
+ break;
+ default: /* Should not occur */
+ return_error(gs_error_rangecheck);
}
return 0;
}
static int
pdf14_create_clist_device(gs_memory_t *mem, gs_imager_state * pis,
- gx_device ** ppdev, gx_device * target,
- const gs_pdf14trans_t * pdf14pct)
+ gx_device ** ppdev, gx_device * target,
+ const gs_pdf14trans_t * pdf14pct)
{
pdf14_clist_device * dev_proto;
pdf14_clist_device * pdev, temp_dev_proto;
@@ -5662,18 +5653,18 @@ pdf14_create_clist_device(gs_memory_t *mem, gs_imager_state * pis,
if_debug0('v', "[v]pdf14_create_clist_device\n");
code = get_pdf14_clist_device_proto(target, &dev_proto,
- &temp_dev_proto, pis, pdf14pct);
+ &temp_dev_proto, pis, pdf14pct);
if (code < 0)
- return code;
+ return code;
code = gs_copydevice((gx_device **) &pdev,
- (const gx_device *) dev_proto, mem);
+ (const gx_device *) dev_proto, mem);
if (code < 0)
- return code;
- /* If we have a tag device then go ahead and do a special encoder decoder
- for the pdf14 device to make sure we maintain this information in the
- encoded color information. We could use the target device's methods but
- the PDF14 device has to maintain 8 bit color always and we could run
- into other issues if the number of colorants became large. If we need to
+ return code;
+ /* If we have a tag device then go ahead and do a special encoder decoder
+ for the pdf14 device to make sure we maintain this information in the
+ encoded color information. We could use the target device's methods but
+ the PDF14 device has to maintain 8 bit color always and we could run
+ into other issues if the number of colorants became large. If we need to
do compressed color with tags that will be a special project at that time */
if (has_tags) {
pdev->procs.encode_color = pdf14_encode_color_tag;
@@ -5686,7 +5677,7 @@ pdf14_create_clist_device(gs_memory_t *mem, gs_imager_state * pis,
code = dev_proc((gx_device *) pdev, open_device) ((gx_device *) pdev);
pdev->pclist_device = target;
/* If the target profile was CIELAB, then overide with default RGB for
- proper blending. During put_image we will convert from RGB to
+ proper blending. During put_image we will convert from RGB to
CIELAB */
if (target->device_icc_profile->data_cs == gsCIELAB) {
rc_decrement(pdev->device_icc_profile, "pdf14_create_clist_device");
@@ -5709,7 +5700,7 @@ pdf14_create_clist_device(gs_memory_t *mem, gs_imager_state * pis,
*/
static int
pdf14_disable_clist_device(gs_memory_t *mem, gs_imager_state * pis,
- gx_device * dev)
+ gx_device * dev)
{
gx_device_forward * pdev = (gx_device_forward *)dev;
gx_device * target = pdev->target;
@@ -5736,7 +5727,7 @@ pdf14_disable_clist_device(gs_memory_t *mem, gs_imager_state * pis,
*/
static int
pdf14_recreate_clist_device(gs_memory_t *mem, gs_imager_state * pis,
- gx_device * dev, const gs_pdf14trans_t * pdf14pct)
+ gx_device * dev, const gs_pdf14trans_t * pdf14pct)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
gx_device * target = pdev->target;
@@ -5750,9 +5741,9 @@ pdf14_recreate_clist_device(gs_memory_t *mem, gs_imager_state * pis,
* color related info to match the prototype.
*/
code = get_pdf14_clist_device_proto(target, &dev_proto,
- &temp_dev_proto, pis, pdf14pct);
+ &temp_dev_proto, pis, pdf14pct);
if (code < 0)
- return code;
+ return code;
pdev->color_info = dev_proto->color_info;
pdev->procs = dev_proto->procs;
gx_device_fill_in_procs(dev);
@@ -5768,8 +5759,8 @@ pdf14_recreate_clist_device(gs_memory_t *mem, gs_imager_state * pis,
* name. At that point we can release our temp key names.
*/
typedef struct keyname_link_list_s {
- struct keyname_link_list_s * next;
- char * key_name;
+ struct keyname_link_list_s * next;
+ char * key_name;
} keyname_link_list_t;
/*
@@ -5778,8 +5769,8 @@ typedef struct keyname_link_list_s {
* should never be exposed to the GC.
*/
gs_private_st_ptrs2(st_keyname_link_list, keyname_link_list_t,
- "keyname_link_list", keyname_link_list_enum_ptrs,
- keyname_link_list_reloc_ptrs, next, key_name);
+ "keyname_link_list", keyname_link_list_enum_ptrs,
+ keyname_link_list_reloc_ptrs, next, key_name);
/* See comments before the definition of keyname_link_list_t */
static int
@@ -5788,9 +5779,9 @@ free_temp_keyname_list(gs_memory_t * mem, keyname_link_list_t * plist)
keyname_link_list_t * pthis_elem;
while (plist != NULL) {
- pthis_elem = plist;
- plist = plist->next;
- gs_free_object(mem, (byte *)pthis_elem, "free_temp_keyname_list");
+ pthis_elem = plist;
+ plist = plist->next;
+ gs_free_object(mem, (byte *)pthis_elem, "free_temp_keyname_list");
}
return 0;
}
@@ -5798,7 +5789,7 @@ free_temp_keyname_list(gs_memory_t * mem, keyname_link_list_t * plist)
/* Put a data value into our 'string' */
#define put_data(pdata, value, count)\
for(j = 0; j < count; j++)\
- *pdata++ = (byte)((value) >> (j * 8))
+ *pdata++ = (byte)((value) >> (j * 8))
/*
* Convert a compressed color list element into a set of device parameters.
@@ -5810,21 +5801,21 @@ free_temp_keyname_list(gs_memory_t * mem, keyname_link_list_t * plist)
*/
static int
get_param_compressed_color_list_elem(pdf14_clist_device * pdev,
- gs_param_list * plist, compressed_color_list_t * pcomp_list,
- char * keyname, keyname_link_list_t ** pkeyname_list)
+ gs_param_list * plist, compressed_color_list_t * pcomp_list,
+ char * keyname, keyname_link_list_t ** pkeyname_list)
{
int max_list_elem_size =
- 6 + NUM_ENCODE_LIST_ITEMS * sizeof(comp_bit_map_list_t);
+ 6 + NUM_ENCODE_LIST_ITEMS * sizeof(comp_bit_map_list_t);
int code, i, j;
byte * pdata;
gs_param_string str;
if (pcomp_list == NULL) /* Exit if we don not have a list. */
- return 0;
+ return 0;
/* Allocate a string for temp data */
pdata = gs_alloc_bytes(pdev->memory, max_list_elem_size,
- "convert_compressed_color_list_elem");
+ "convert_compressed_color_list_elem");
str.data = (const byte *)pdata;
str.persistent = false;
@@ -5833,47 +5824,47 @@ get_param_compressed_color_list_elem(pdf14_clist_device * pdev,
/* . */
for (i = pcomp_list->first_bit_map; i < NUM_ENCODE_LIST_ITEMS; i++) {
- put_data(pdata, pcomp_list->u.comp_data[i].num_comp, 2);
- put_data(pdata, pcomp_list->u.comp_data[i].num_non_solid_comp, 2);
- put_data(pdata, pcomp_list->u.comp_data[i].solid_not_100, 1);
- put_data(pdata, pcomp_list->u.comp_data[i].colorants,
- sizeof(pcomp_list->u.comp_data[i].colorants));
- if (pcomp_list->u.comp_data[i].num_comp !=
- pcomp_list->u.comp_data[i].num_non_solid_comp) {
- put_data(pdata, pcomp_list->u.comp_data[i].solid_colorants,
- sizeof(pcomp_list->u.comp_data[i].solid_colorants));
- }
+ put_data(pdata, pcomp_list->u.comp_data[i].num_comp, 2);
+ put_data(pdata, pcomp_list->u.comp_data[i].num_non_solid_comp, 2);
+ put_data(pdata, pcomp_list->u.comp_data[i].solid_not_100, 1);
+ put_data(pdata, pcomp_list->u.comp_data[i].colorants,
+ sizeof(pcomp_list->u.comp_data[i].colorants));
+ if (pcomp_list->u.comp_data[i].num_comp !=
+ pcomp_list->u.comp_data[i].num_non_solid_comp) {
+ put_data(pdata, pcomp_list->u.comp_data[i].solid_colorants,
+ sizeof(pcomp_list->u.comp_data[i].solid_colorants));
+ }
}
str.size = pdata - str.data;
code = param_write_string(plist, keyname, &str);
gs_free_object(pdev->memory, (byte *)str.data,
- "convert_compressed_color_list_elem");
+ "convert_compressed_color_list_elem");
/* Convert the sub levels. */
for (i = 0; i < pcomp_list->num_sub_level_ptrs; i++) {
- /*
- * We generate a keyname for the sub level elements based upon
- * the keyname for the current level. See comments before the
- * definition of keyname_link_list_t for comments about the lifetime
- * of the keynames.
- */
- /* Allocate a string for the keyname */
- char * keyname_buf = (char *)gs_alloc_bytes(pdev->memory,
- strlen(keyname) + 10, "convert_compressed_color_list_elem");
- /*
- * Allocate a link list element so we can keep track of the memory
- * allocated to hold the keynames.
- */
- keyname_link_list_t * pkeyname_list_elem =
- gs_alloc_struct(pdev->memory, keyname_link_list_t,
- &st_keyname_link_list, "convert_compressed_color_list_elem");
- pkeyname_list_elem->next = *pkeyname_list;
- pkeyname_list_elem->key_name = keyname_buf;
- *pkeyname_list = pkeyname_list_elem;
- sprintf(keyname_buf, "%s_%d", keyname, i);
- get_param_compressed_color_list_elem(pdev, plist,
- pcomp_list->u.sub_level_ptrs[i], keyname_buf,
- pkeyname_list);
+ /*
+ * We generate a keyname for the sub level elements based upon
+ * the keyname for the current level. See comments before the
+ * definition of keyname_link_list_t for comments about the lifetime
+ * of the keynames.
+ */
+ /* Allocate a string for the keyname */
+ char * keyname_buf = (char *)gs_alloc_bytes(pdev->memory,
+ strlen(keyname) + 10, "convert_compressed_color_list_elem");
+ /*
+ * Allocate a link list element so we can keep track of the memory
+ * allocated to hold the keynames.
+ */
+ keyname_link_list_t * pkeyname_list_elem =
+ gs_alloc_struct(pdev->memory, keyname_link_list_t,
+ &st_keyname_link_list, "convert_compressed_color_list_elem");
+ pkeyname_list_elem->next = *pkeyname_list;
+ pkeyname_list_elem->key_name = keyname_buf;
+ *pkeyname_list = pkeyname_list_elem;
+ sprintf(keyname_buf, "%s_%d", keyname, i);
+ get_param_compressed_color_list_elem(pdev, plist,
+ pcomp_list->u.sub_level_ptrs[i], keyname_buf,
+ pkeyname_list);
}
return 0;
@@ -5885,7 +5876,7 @@ get_param_compressed_color_list_elem(pdf14_clist_device * pdev,
j = count - 1;\
value = pdata[j--];\
for(; j >= 0; j--)\
- value = (value << 8) | pdata[j];\
+ value = (value << 8) | pdata[j];\
pdata += count
/*
@@ -5909,12 +5900,12 @@ put_param_compressed_color_list_elem(gx_device * pdev,
code = param_read_string(plist, keyname, &str);
switch (code) {
case 0:
- break; /* We have the given keyname, continue. */
+ break; /* We have the given keyname, continue. */
default:
- param_signal_error(plist, keyname, code);
+ param_signal_error(plist, keyname, code);
case 1:
- *pret_comp_list = NULL;
- return 0;
+ *pret_comp_list = NULL;
+ return 0;
}
/* Allocate a compressed color list element. */
pdata = (byte *)str.data;
@@ -5924,27 +5915,27 @@ put_param_compressed_color_list_elem(gx_device * pdev,
/* Read the bit maps */
for (i = pcomp_list->first_bit_map; i < NUM_ENCODE_LIST_ITEMS; i++) {
- get_data(pdata, pcomp_list->u.comp_data[i].num_comp, 2);
- get_data(pdata, pcomp_list->u.comp_data[i].num_non_solid_comp, 2);
- get_data(pdata, pcomp_list->u.comp_data[i].solid_not_100, 1);
- get_data(pdata, pcomp_list->u.comp_data[i].colorants,
- sizeof(pcomp_list->u.comp_data[i].colorants));
- if (pcomp_list->u.comp_data[i].num_comp !=
- pcomp_list->u.comp_data[i].num_non_solid_comp) {
- get_data(pdata, pcomp_list->u.comp_data[i].solid_colorants,
- sizeof(pcomp_list->u.comp_data[i].solid_colorants));
- }
+ get_data(pdata, pcomp_list->u.comp_data[i].num_comp, 2);
+ get_data(pdata, pcomp_list->u.comp_data[i].num_non_solid_comp, 2);
+ get_data(pdata, pcomp_list->u.comp_data[i].solid_not_100, 1);
+ get_data(pdata, pcomp_list->u.comp_data[i].colorants,
+ sizeof(pcomp_list->u.comp_data[i].colorants));
+ if (pcomp_list->u.comp_data[i].num_comp !=
+ pcomp_list->u.comp_data[i].num_non_solid_comp) {
+ get_data(pdata, pcomp_list->u.comp_data[i].solid_colorants,
+ sizeof(pcomp_list->u.comp_data[i].solid_colorants));
+ }
}
/* Get the sub levels. */
for (i = 0; i < pcomp_list->num_sub_level_ptrs; i++) {
- char buff[50];
+ char buff[50];
compressed_color_list_t * sub_list_ptr;
- sprintf(buff, "%s_%d", keyname, i);
- put_param_compressed_color_list_elem(pdev, plist,
- &sub_list_ptr, buff, num_comps - 1);
- pcomp_list->u.sub_level_ptrs[i] = sub_list_ptr;
+ sprintf(buff, "%s_%d", keyname, i);
+ put_param_compressed_color_list_elem(pdev, plist,
+ &sub_list_ptr, buff, num_comps - 1);
+ pcomp_list->u.sub_level_ptrs[i] = sub_list_ptr;
}
*pret_comp_list = pcomp_list;
@@ -5972,7 +5963,7 @@ pdf14_ret_devn_params(gx_device *pdev)
*/
static int
get_param_spot_color_names(pdf14_clist_device * pdev,
- gs_param_list * plist, keyname_link_list_t ** pkeyname_list)
+ gs_param_list * plist, keyname_link_list_t ** pkeyname_list)
{
int code, i;
gs_param_string str;
@@ -5980,34 +5971,34 @@ get_param_spot_color_names(pdf14_clist_device * pdev,
int num_spot_colors = separations->num_separations;
if (num_spot_colors == 0)
- return 0;
+ return 0;
code = param_write_int(plist, PDF14NumSpotColorsParamName,
- &num_spot_colors);
+ &num_spot_colors);
for (i = 0; i < num_spot_colors; i++) {
- /*
- * We generate a keyname for the spot color based upon the
- * spot color number. See comments before the definition of
- * keyname_link_list_t for comments about the lifetime of the keynames.
- */
- /* Allocate a string for the keyname */
- char * keyname_buf = (char *)gs_alloc_bytes(pdev->memory,
- strlen("PDF14SpotName_") + 10, "get_param_spot_color_names");
- /*
- * Allocate a link list element so we can keep track of the memory
- * allocated to hold the keynames.
- */
- keyname_link_list_t * pkeyname_list_elem =
- gs_alloc_struct(pdev->memory, keyname_link_list_t,
- &st_keyname_link_list, "get_param_spot_color_names");
- pkeyname_list_elem->next = *pkeyname_list;
- pkeyname_list_elem->key_name = keyname_buf;
- *pkeyname_list = pkeyname_list_elem;
- sprintf(keyname_buf, "PDF14SpotName_%d", i);
- str.size = separations->names[i].size;
- str.data = separations->names[i].data;
- str.persistent = false;
- code = param_write_string(plist, keyname_buf, &str);
+ /*
+ * We generate a keyname for the spot color based upon the
+ * spot color number. See comments before the definition of
+ * keyname_link_list_t for comments about the lifetime of the keynames.
+ */
+ /* Allocate a string for the keyname */
+ char * keyname_buf = (char *)gs_alloc_bytes(pdev->memory,
+ strlen("PDF14SpotName_") + 10, "get_param_spot_color_names");
+ /*
+ * Allocate a link list element so we can keep track of the memory
+ * allocated to hold the keynames.
+ */
+ keyname_link_list_t * pkeyname_list_elem =
+ gs_alloc_struct(pdev->memory, keyname_link_list_t,
+ &st_keyname_link_list, "get_param_spot_color_names");
+ pkeyname_list_elem->next = *pkeyname_list;
+ pkeyname_list_elem->key_name = keyname_buf;
+ *pkeyname_list = pkeyname_list_elem;
+ sprintf(keyname_buf, "PDF14SpotName_%d", i);
+ str.size = separations->names[i].size;
+ str.data = separations->names[i].data;
+ str.persistent = false;
+ code = param_write_string(plist, keyname_buf, &str);
}
return 0;;
}
@@ -6017,44 +6008,44 @@ get_param_spot_color_names(pdf14_clist_device * pdev,
*/
int
put_param_pdf14_spot_names(gx_device * pdev,
- gs_separations * pseparations, gs_param_list * plist)
+ gs_separations * pseparations, gs_param_list * plist)
{
int code, num_spot_colors, i;
gs_param_string str;
/* Check if the given keyname is present. */
code = param_read_int(plist, PDF14NumSpotColorsParamName,
- &num_spot_colors);
+ &num_spot_colors);
switch (code) {
default:
- param_signal_error(plist, PDF14NumSpotColorsParamName, code);
- break;
+ param_signal_error(plist, PDF14NumSpotColorsParamName, code);
+ break;
case 1:
- return 0;
+ return 0;
case 0:
- if (num_spot_colors < 1 ||
- num_spot_colors > GX_DEVICE_COLOR_MAX_COMPONENTS)
- return_error(gs_error_rangecheck);
- for (i = 0; i < num_spot_colors; i++) {
- char buff[20];
- byte * sep_name;
-
- sprintf(buff, "PDF14SpotName_%d", i);
- code = param_read_string(plist, buff, &str);
- switch (code) {
- default:
- param_signal_error(plist, buff, code);
- break;
- case 0:
- sep_name = gs_alloc_bytes(pdev->memory,
- str.size, "put_param_pdf14_spot_names");
- memcpy(sep_name, str.data, str.size);
- pseparations->names[i].size = str.size;
- pseparations->names[i].data = sep_name;
- }
- }
- pseparations->num_separations = num_spot_colors;
- break;
+ if (num_spot_colors < 1 ||
+ num_spot_colors > GX_DEVICE_COLOR_MAX_COMPONENTS)
+ return_error(gs_error_rangecheck);
+ for (i = 0; i < num_spot_colors; i++) {
+ char buff[20];
+ byte * sep_name;
+
+ sprintf(buff, "PDF14SpotName_%d", i);
+ code = param_read_string(plist, buff, &str);
+ switch (code) {
+ default:
+ param_signal_error(plist, buff, code);
+ break;
+ case 0:
+ sep_name = gs_alloc_bytes(pdev->memory,
+ str.size, "put_param_pdf14_spot_names");
+ memcpy(sep_name, str.data, str.size);
+ pseparations->names[i].size = str.size;
+ pseparations->names[i].data = sep_name;
+ }
+ }
+ pseparations->num_separations = num_spot_colors;
+ break;
}
return 0;;
}
@@ -6073,27 +6064,27 @@ pdf14_clist_get_param_compressed_color_list(pdf14_device * p14dev)
* setting permanent_error, which prevents writing to the command list.
*/
if (cldev->permanent_error)
- return cldev->permanent_error;
+ return cldev->permanent_error;
gs_c_param_list_write(&param_list, p14dev->memory);
code = get_param_compressed_color_list_elem(p14dev,
- (gs_param_list *)&param_list,
- p14dev->devn_params.compressed_color_list,
- (char *)PDF14CompressedColorListParamName, &pkeyname_list_head);
+ (gs_param_list *)&param_list,
+ p14dev->devn_params.compressed_color_list,
+ (char *)PDF14CompressedColorListParamName, &pkeyname_list_head);
get_param_spot_color_names(p14dev, (gs_param_list *)&param_list,
- &pkeyname_list_head);
+ &pkeyname_list_head);
if (code >= 0) {
gx_device * tdev = p14dev->target;
- gs_c_param_list_read(&param_list);
+ gs_c_param_list_read(&param_list);
#if 1
- code = dev_proc(tdev, put_params)(tdev, (gs_param_list *)&param_list);
+ code = dev_proc(tdev, put_params)(tdev, (gs_param_list *)&param_list);
#else
- /*
- * This call will put the compressed color list info into the
- * clist. However there are two problems. The info goes into
- * the list at the end of the list.
- */
- code = cmd_put_params(cldev, (gs_param_list *)&param_list );
+ /*
+ * This call will put the compressed color list info into the
+ * clist. However there are two problems. The info goes into
+ * the list at the end of the list.
+ */
+ code = cmd_put_params(cldev, (gs_param_list *)&param_list );
#endif
}
gs_c_param_list_release(&param_list);
@@ -6114,14 +6105,14 @@ pdf14_clist_get_param_compressed_color_list(pdf14_device * p14dev)
*/
int
pdf14_put_devn_params(gx_device * pdev, gs_devn_params * pdevn_params,
- gs_param_list * plist)
+ gs_param_list * plist)
{
int code = put_param_compressed_color_list_elem(pdev, plist,
- &pdevn_params->pdf14_compressed_color_list,
- (char *)PDF14CompressedColorListParamName, TOP_ENCODED_LEVEL);
+ &pdevn_params->pdf14_compressed_color_list,
+ (char *)PDF14CompressedColorListParamName, TOP_ENCODED_LEVEL);
if (code >= 0)
code = put_param_pdf14_spot_names(pdev,
- &pdevn_params->pdf14_separations, plist);
+ &pdevn_params->pdf14_separations, plist);
return code;
}
@@ -6134,7 +6125,7 @@ pdf14_put_devn_params(gx_device * pdev, gs_devn_params * pdevn_params,
*/
static int
pdf14_clist_create_compositor(gx_device * dev, gx_device ** pcdev,
- const gs_composite_t * pct, gs_imager_state * pis, gs_memory_t * mem,
+ const gs_composite_t * pct, gs_imager_state * pis, gs_memory_t * mem,
gx_device *cdev)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
@@ -6143,136 +6134,136 @@ pdf14_clist_create_compositor(gx_device * dev, gx_device ** pcdev,
/* We only handle a few PDF 1.4 transparency operations 4 */
if (gs_is_pdf14trans_compositor(pct)) {
- const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
-
- switch (pdf14pct->params.pdf14_op) {
- case PDF14_PUSH_DEVICE:
- /* Re-activate the PDF 1.4 compositor */
- pdev->saved_target_color_info = pdev->target->color_info;
- pdev->target->color_info = pdev->color_info;
- pdev->saved_target_encode_color = pdev->target->procs.encode_color;
- pdev->saved_target_decode_color = pdev->target->procs.decode_color;
- pdev->target->procs.encode_color = pdev->procs.encode_color =
+ const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
+
+ switch (pdf14pct->params.pdf14_op) {
+ case PDF14_PUSH_DEVICE:
+ /* Re-activate the PDF 1.4 compositor */
+ pdev->saved_target_color_info = pdev->target->color_info;
+ pdev->target->color_info = pdev->color_info;
+ pdev->saved_target_encode_color = pdev->target->procs.encode_color;
+ pdev->saved_target_decode_color = pdev->target->procs.decode_color;
+ pdev->target->procs.encode_color = pdev->procs.encode_color =
pdev->my_encode_color;
- pdev->target->procs.decode_color = pdev->procs.decode_color =
+ pdev->target->procs.decode_color = pdev->procs.decode_color =
pdev->my_decode_color;
- pdev->saved_target_get_color_mapping_procs =
+ pdev->saved_target_get_color_mapping_procs =
pdev->target->procs.get_color_mapping_procs;
- pdev->saved_target_get_color_comp_index =
+ pdev->saved_target_get_color_comp_index =
pdev->target->procs.get_color_comp_index;
- pdev->target->procs.get_color_mapping_procs =
- pdev->procs.get_color_mapping_procs =
+ pdev->target->procs.get_color_mapping_procs =
+ pdev->procs.get_color_mapping_procs =
pdev->my_get_color_mapping_procs;
- pdev->target->procs.get_color_comp_index =
- pdev->procs.get_color_comp_index =
+ pdev->target->procs.get_color_comp_index =
+ pdev->procs.get_color_comp_index =
pdev->my_get_color_comp_index;
- pdev->save_get_cmap_procs = pis->get_cmap_procs;
- pis->get_cmap_procs = pdf14_get_cmap_procs;
- gx_set_cmap_procs(pis, dev);
- code = pdf14_recreate_clist_device(mem, pis, dev, pdf14pct);
- pdev->blend_mode = pdev->text_knockout = 0;
- pdev->opacity = pdev->shape = 0.0;
- if (code < 0)
- return code;
- /*
- * This routine is part of the PDF 1.4 clist write device.
- * Change the compositor procs to not create another since we
- * do not need to create a chain of identical devices.
- */
- {
- gs_composite_t pctemp = *pct;
-
- pctemp.type = &gs_composite_pdf14trans_no_clist_writer_type;
- code = dev_proc(pdev->target, create_compositor)
- (pdev->target, pcdev, &pctemp, pis, mem, cdev);
- *pcdev = dev;
- return code;
- }
- case PDF14_POP_DEVICE:
- /* Restore the color_info for the clist device */
- pdev->target->color_info = pdev->saved_target_color_info;
- pdev->target->procs.encode_color =
+ pdev->save_get_cmap_procs = pis->get_cmap_procs;
+ pis->get_cmap_procs = pdf14_get_cmap_procs;
+ gx_set_cmap_procs(pis, dev);
+ code = pdf14_recreate_clist_device(mem, pis, dev, pdf14pct);
+ pdev->blend_mode = pdev->text_knockout = 0;
+ pdev->opacity = pdev->shape = 0.0;
+ if (code < 0)
+ return code;
+ /*
+ * This routine is part of the PDF 1.4 clist write device.
+ * Change the compositor procs to not create another since we
+ * do not need to create a chain of identical devices.
+ */
+ {
+ gs_composite_t pctemp = *pct;
+
+ pctemp.type = &gs_composite_pdf14trans_no_clist_writer_type;
+ code = dev_proc(pdev->target, create_compositor)
+ (pdev->target, pcdev, &pctemp, pis, mem, cdev);
+ *pcdev = dev;
+ return code;
+ }
+ case PDF14_POP_DEVICE:
+ /* Restore the color_info for the clist device */
+ pdev->target->color_info = pdev->saved_target_color_info;
+ pdev->target->procs.encode_color =
pdev->saved_target_encode_color;
- pdev->target->procs.decode_color =
+ pdev->target->procs.decode_color =
pdev->saved_target_decode_color;
- pdev->target->procs.get_color_mapping_procs =
+ pdev->target->procs.get_color_mapping_procs =
pdev->saved_target_get_color_mapping_procs;
- pdev->target->procs.get_color_comp_index =
+ pdev->target->procs.get_color_comp_index =
pdev->saved_target_get_color_comp_index;
- pis->get_cmap_procs = pdev->save_get_cmap_procs;
- gx_set_cmap_procs(pis, pdev->target);
- /*
- * For spot colors we use a 'compressed encoding' for
- * gx_color_index values. Send the related data struct
- * to the clist.
- */
- pdf14_clist_get_param_compressed_color_list(pdev);
- /* Disable the PDF 1.4 compositor */
- pdf14_disable_clist_device(mem, pis, dev);
- /*
- * Make sure that the transfer funtions, etc. are current.
- */
- code = cmd_put_color_mapping(
- (gx_device_clist_writer *)(pdev->target), pis);
- if (code < 0)
- return code;
- break;
- case PDF14_BEGIN_TRANS_GROUP:
- /*
- * Keep track of any changes made in the blending parameters.
- These need to be written out in the same bands as the group
+ pis->get_cmap_procs = pdev->save_get_cmap_procs;
+ gx_set_cmap_procs(pis, pdev->target);
+ /*
+ * For spot colors we use a 'compressed encoding' for
+ * gx_color_index values. Send the related data struct
+ * to the clist.
+ */
+ pdf14_clist_get_param_compressed_color_list(pdev);
+ /* Disable the PDF 1.4 compositor */
+ pdf14_disable_clist_device(mem, pis, dev);
+ /*
+ * Make sure that the transfer funtions, etc. are current.
+ */
+ code = cmd_put_color_mapping(
+ (gx_device_clist_writer *)(pdev->target), pis);
+ if (code < 0)
+ return code;
+ break;
+ case PDF14_BEGIN_TRANS_GROUP:
+ /*
+ * Keep track of any changes made in the blending parameters.
+ These need to be written out in the same bands as the group
information is written. Hence the passing of the dimensions
for the group. */
- code = pdf14_clist_update_params(pdev, pis, true,
+ code = pdf14_clist_update_params(pdev, pis, true,
&(pdf14pct->params));
- if (pdf14pct->params.Background_components != 0 &&
- pdf14pct->params.Background_components != pdev->color_info.num_components)
- return_error(gs_error_rangecheck);
+ if (pdf14pct->params.Background_components != 0 &&
+ pdf14pct->params.Background_components != pdev->color_info.num_components)
+ return_error(gs_error_rangecheck);
/* We need to update the clist writer device procs based upon the
- the group color space. For simplicity, the list item is
+ the group color space. For simplicity, the list item is
created even if the color space did not change */
/* First store the current ones */
pdf14_push_parent_color(dev, pis);
- /* Now update the device procs. Not
+ /* Now update the device procs. Not
if we have a sep target though */
- sep_target = (strcmp(pdev->dname, "pdf14clistcustom") == 0) ||
+ sep_target = (strcmp(pdev->dname, "pdf14clistcustom") == 0) ||
(strcmp(pdev->dname, "pdf14clistcmykspot") == 0);
if (!sep_target)
code = pdf14_update_device_color_procs_push_c(dev,
pdf14pct->params.group_color,
- pdf14pct->params.icc_hash, pis,
+ pdf14pct->params.icc_hash, pis,
pdf14pct->params.iccprofile);
- break;
- case PDF14_BEGIN_TRANS_MASK:
+ break;
+ case PDF14_BEGIN_TRANS_MASK:
/* We need to update the clist writer device procs based upon the
- the group color space. For simplicity, the list item is created
+ the group color space. For simplicity, the list item is created
even if the color space did not change */
/* First store the current ones */
pdf14_push_parent_color(dev, pis);
/* Now update the device procs */
code = pdf14_update_device_color_procs_push_c(dev,
pdf14pct->params.group_color,
- pdf14pct->params.icc_hash, pis,
+ pdf14pct->params.icc_hash, pis,
pdf14pct->params.iccprofile);
- /* Also, if the BC is a value that may end up as something other
+ /* Also, if the BC is a value that may end up as something other
than transparent. We must use the parent colors bounding box in
- determining the range of bands in which this mask can affect.
+ determining the range of bands in which this mask can affect.
So, if needed change the masks bounding box at this time */
- break;
- /* When we get a trans group pop, we need to update the color mapping
+ break;
+ /* When we get a trans group pop, we need to update the color mapping
procs if it was not a sep device */
- case PDF14_END_TRANS_GROUP:
+ case PDF14_END_TRANS_GROUP:
/* We need to update the clist writer device procs based upon the
the group color space. */
/* First restore our procs */
- sep_target = (strcmp(pdev->dname, "pdf14clistcustom") == 0) ||
+ sep_target = (strcmp(pdev->dname, "pdf14clistcustom") == 0) ||
(strcmp(pdev->dname, "pdf14clistcmykspot") == 0);
if (!sep_target)
code = pdf14_update_device_color_procs_pop_c(dev,pis);
/* We always do this push and pop */
pdf14_pop_parent_color(dev, pis);
break;
- case PDF14_END_TRANS_MASK:
+ case PDF14_END_TRANS_MASK:
/* We need to update the clist writer device procs based upon the
the group color space. */
/* First restore our procs */
@@ -6295,20 +6286,20 @@ pdf14_clist_create_compositor(gx_device * dev, gx_device ** pcdev,
return code; /* Note, this are NOT put in the clist */
break;
case PDF14_SET_BLEND_PARAMS:
- /* If there is a change we go ahead and apply it to the target */
- code = pdf14_clist_update_params(pdev, pis, false,
+ /* If there is a change we go ahead and apply it to the target */
+ code = pdf14_clist_update_params(pdev, pis, false,
&(pdf14pct->params));
*pcdev = dev;
return code;
break;
default:
- break; /* Pass remaining ops to target */
- }
+ break; /* Pass remaining ops to target */
+ }
}
code = dev_proc(pdev->target, create_compositor)
- (pdev->target, pcdev, pct, pis, mem, cdev);
+ (pdev->target, pcdev, pct, pis, mem, cdev);
if (*pcdev != pdev->target)
- gx_device_set_target((gx_device_forward *)pdev, *pcdev);
+ gx_device_set_target((gx_device_forward *)pdev, *pcdev);
*pcdev = dev;
return code;
}
@@ -6323,8 +6314,8 @@ pdf14_clist_create_compositor(gx_device * dev, gx_device ** pcdev,
*/
static int
pdf14_clist_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
- const gs_composite_t * pct, gs_imager_state * pis,
- gs_memory_t * mem, gx_device *cdev)
+ const gs_composite_t * pct, gs_imager_state * pis,
+ gs_memory_t * mem, gx_device *cdev)
{
pdf14_device *pdev = (pdf14_device *)dev;
gx_device * tdev = pdev->target;
@@ -6333,15 +6324,15 @@ pdf14_clist_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
*pcdev = dev;
if (gs_is_pdf14trans_compositor(pct)) {
- const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
+ const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pct;
- if (pdf14pct->params.pdf14_op == PDF14_PUSH_DEVICE)
- return pdf14_clist_create_compositor(dev, &ndev, pct, pis, mem, cdev);
- return 0;
+ if (pdf14pct->params.pdf14_op == PDF14_PUSH_DEVICE)
+ return pdf14_clist_create_compositor(dev, &ndev, pct, pis, mem, cdev);
+ return 0;
}
code = dev_proc(tdev, create_compositor)(tdev, &ndev, pct, pis, mem, cdev);
if (code < 0)
- return code;
+ return code;
gx_device_set_target((gx_device_forward *)pdev, ndev);
return 0;
}
@@ -6352,7 +6343,7 @@ pdf14_clist_forward_create_compositor(gx_device * dev, gx_device * * pcdev,
*/
static int
pdf14_clist_update_params(pdf14_clist_device * pdev, const gs_imager_state * pis,
- bool crop_blend_params,
+ bool crop_blend_params,
gs_pdf14trans_params_t *group_params)
{
gs_pdf14trans_params_t params = { 0 };
@@ -6365,28 +6356,28 @@ pdf14_clist_update_params(pdf14_clist_device * pdev, const gs_imager_state * pis
params.pdf14_op = PDF14_SET_BLEND_PARAMS;
if (pis->blend_mode != pdev->blend_mode) {
- changed |= PDF14_SET_BLEND_MODE;
- params.blend_mode = pdev->blend_mode = pis->blend_mode;
+ changed |= PDF14_SET_BLEND_MODE;
+ params.blend_mode = pdev->blend_mode = pis->blend_mode;
}
if (pis->text_knockout != pdev->text_knockout) {
- changed |= PDF14_SET_TEXT_KNOCKOUT;
- params.text_knockout = pdev->text_knockout = pis->text_knockout;
+ changed |= PDF14_SET_TEXT_KNOCKOUT;
+ params.text_knockout = pdev->text_knockout = pis->text_knockout;
}
if (pis->shape.alpha != pdev->shape) {
- changed |= PDF14_SET_SHAPE_ALPHA;
- params.shape.alpha = pdev->shape = pis->shape.alpha;
+ changed |= PDF14_SET_SHAPE_ALPHA;
+ params.shape.alpha = pdev->shape = pis->shape.alpha;
}
if (pis->opacity.alpha != pdev->opacity) {
- changed |= PDF14_SET_OPACITY_ALPHA;
- params.opacity.alpha = pdev->opacity = pis->opacity.alpha;
+ changed |= PDF14_SET_OPACITY_ALPHA;
+ params.opacity.alpha = pdev->opacity = pis->opacity.alpha;
}
if (pis->overprint != pdev->overprint) {
- changed |= PDF14_SET_OVERPRINT;
- params.overprint = pdev->overprint = pis->overprint;
+ changed |= PDF14_SET_OVERPRINT;
+ params.overprint = pdev->overprint = pis->overprint;
}
if (pis->overprint_mode != pdev->overprint_mode) {
- changed |= PDF14_SET_OVERPRINT_MODE;
- params.overprint_mode = pdev->overprint_mode = pis->overprint_mode;
+ changed |= PDF14_SET_OVERPRINT_MODE;
+ params.overprint_mode = pdev->overprint_mode = pis->overprint_mode;
}
if (crop_blend_params) {
params.ctm = group_params->ctm;
@@ -6402,7 +6393,7 @@ pdf14_clist_update_params(pdf14_clist_device * pdev, const gs_imager_state * pis
code = gs_create_pdf14trans(&pct_new, &params, pis->memory);
if (code < 0) return code;
code = dev_proc(pdev->target, create_compositor)
- (pdev->target, &pcdev, pct_new, pis, pis->memory, NULL);
+ (pdev->target, &pcdev, pct_new, pis, pis->memory, NULL);
gs_free_object(pis->memory, pct_new, "pdf14_clist_update_params");
}
return code;
@@ -6414,9 +6405,9 @@ pdf14_clist_update_params(pdf14_clist_device * pdev, const gs_imager_state * pis
*/
static int
pdf14_clist_fill_path(gx_device *dev, const gs_imager_state *pis,
- gx_path *ppath, const gx_fill_params *params,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath)
+ gx_path *ppath, const gx_fill_params *params,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
gs_imager_state new_is = *pis;
@@ -6433,26 +6424,26 @@ pdf14_clist_fill_path(gx_device *dev, const gs_imager_state *pis,
*/
code = pdf14_clist_update_params(pdev, pis, false, NULL);
if (code < 0)
- return code;
- /* If we are doing a shading fill and we are in a transparency group of a
- different color space, then we do not want to do the shading in the
- device color space. It must occur in the source space. To handle it in
- the device space would require knowing all the nested transparency group
- color space as well as the transparency. Some of the shading code ignores
- this, so we have to pass on the clist_writer device to enable proper
+ return code;
+ /* If we are doing a shading fill and we are in a transparency group of a
+ different color space, then we do not want to do the shading in the
+ device color space. It must occur in the source space. To handle it in
+ the device space would require knowing all the nested transparency group
+ color space as well as the transparency. Some of the shading code ignores
+ this, so we have to pass on the clist_writer device to enable proper
mapping to the transparency group color space. */
/* Right now we only set the trans device if we are in a transparency group
- with a color space different than the output device OR if we have a goofy
- device output profile like CIELAB. In the CIELAB case, the profile for the
+ with a color space different than the output device OR if we have a goofy
+ device output profile like CIELAB. In the CIELAB case, the profile for the
PDF14 device will not match the target device profile */
- cs_change =
- (fdev->target->device_icc_profile->hashcode !=
+ cs_change =
+ (fdev->target->device_icc_profile->hashcode !=
dev->device_icc_profile->hashcode);
if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor) && cs_change) {
- pinst =
- (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
+ pinst =
+ (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
pinst->saved->has_transparency = true;
- /* The transparency color space operations are driven by the pdf14
+ /* The transparency color space operations are driven by the pdf14
clist writer device. */
pinst->saved->trans_device = dev;
}
@@ -6474,9 +6465,9 @@ pdf14_clist_fill_path(gx_device *dev, const gs_imager_state *pis,
*/
static int
pdf14_clist_stroke_path(gx_device *dev, const gs_imager_state *pis,
- gx_path *ppath, const gx_stroke_params *params,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath)
+ gx_path *ppath, const gx_stroke_params *params,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
gs_imager_state new_is = *pis;
@@ -6491,15 +6482,15 @@ pdf14_clist_stroke_path(gx_device *dev, const gs_imager_state *pis,
*/
code = pdf14_clist_update_params(pdev, pis, false, NULL);
if (code < 0)
- return code;
- /* If we are doing a shading stroke and we are in a transparency group of a
- different color space, then we need to get the proper device information
- passed along so that we use the correct color procs and colorinfo about
+ return code;
+ /* If we are doing a shading stroke and we are in a transparency group of a
+ different color space, then we need to get the proper device information
+ passed along so that we use the correct color procs and colorinfo about
the transparency device and not the final target device */
- if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor) &&
+ if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor) &&
pdev->trans_group_parent_cmap_procs != NULL) {
- pinst =
- (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
+ pinst =
+ (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
pinst->saved->has_transparency = true;
/* The transparency color space operations are driven
by the pdf14 clist writer device. */
@@ -6524,10 +6515,10 @@ pdf14_clist_stroke_path(gx_device *dev, const gs_imager_state *pis,
*/
static int
pdf14_clist_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * memory,
- gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * memory,
+ gs_text_enum_t ** ppenum)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
gs_text_enum_t *penum;
@@ -6541,23 +6532,23 @@ pdf14_clist_text_begin(gx_device * dev, gs_imager_state * pis,
*/
code = pdf14_clist_update_params(pdev, pis, false, NULL);
if (code < 0)
- return code;
+ return code;
/* Pass text_begin to the target */
code = gx_forward_text_begin(dev, pis, text, font, path,
- pdcolor, pcpath, memory, &penum);
+ pdcolor, pcpath, memory, &penum);
if (code < 0)
- return code;
+ return code;
*ppenum = (gs_text_enum_t *)penum;
return code;
}
static int
pdf14_clist_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
int code;
@@ -6570,24 +6561,24 @@ pdf14_clist_begin_image(gx_device * dev,
*/
code = pdf14_clist_update_params(pdev, pis, false, NULL);
if (code < 0)
- return code;
+ return code;
/* Pass image to the target */
code = gx_forward_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, memory, pinfo);
+ pdcolor, pcpath, memory, pinfo);
if (code < 0)
return gx_default_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, memory, pinfo);
+ pdcolor, pcpath, memory, pinfo);
else return code;
}
static int
pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
pdf14_clist_device * pdev = (pdf14_clist_device *)dev;
int code = 0;
@@ -6605,7 +6596,7 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
*/
code = pdf14_clist_update_params(pdev, pis, false, NULL);
if (code < 0)
- return code;
+ return code;
/* Pass image to the target */
/* Do a quick change to the imager state so that if we can return with -1 in
case the clist writer cannot handle this image itself. In such a case,
@@ -6622,9 +6613,9 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
if( gx_pattern1_get_transptr(pdcolor) != NULL){
if (dev->procs.begin_image != pdf14_clist_begin_image) {
ptile = pdcolor->colors.pattern.p_tile;
- /* Set up things in the ptile so that we get the proper
+ /* Set up things in the ptile so that we get the proper
blending etc */
- /* Set the blending procs and the is_additive setting based
+ /* Set the blending procs and the is_additive setting based
upon the number of channels */
if (ptile->ttrans->n_chan-1 < 4) {
ptile->ttrans->blending_procs = &rgb_blending_procs;
@@ -6633,21 +6624,21 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
ptile->ttrans->blending_procs = &cmyk_blending_procs;
ptile->ttrans->is_additive = false;
}
- /* Set the blending mode in the ptile based upon the current
+ /* Set the blending mode in the ptile based upon the current
setting in the imager state */
ptile->ttrans->blending_mode = pis->blend_mode;
/* Set the procs so that we use the proper filling method. */
/* Let the imaging stuff get set up */
- code = gx_default_begin_typed_image(dev, pis, pmat, pic,
+ code = gx_default_begin_typed_image(dev, pis, pmat, pic,
prect, pdcolor,pcpath, mem, pinfo);
penum = (gx_image_enum *) *pinfo;
- /* Apply inverse of the image matrix to our
+ /* Apply inverse of the image matrix to our
image size to get our bounding box. */
bbox_in.p.x = 0;
bbox_in.p.y = 0;
bbox_in.q.x = pim->Width;
bbox_in.q.y = pim->Height;
- code = gs_bbox_transform_inverse(&bbox_in, &(pim->ImageMatrix),
+ code = gs_bbox_transform_inverse(&bbox_in, &(pim->ImageMatrix),
&bbox_out);
if (code < 0) return code;
/* Set up a compositor action for pushing the group */
@@ -6662,7 +6653,7 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
tgp.group_color_numcomps = ptile->ttrans->n_chan-1;
tgp.ColorSpace = NULL;
/* This will handle the compositor command */
- gs_begin_transparency_group((gs_state *) pis_noconst, &tgp,
+ gs_begin_transparency_group((gs_state *) pis_noconst, &tgp,
&bbox_out);
ptile->ttrans->image_render = penum->render;
penum->render = &pdf14_pattern_trans_render;
@@ -6677,10 +6668,10 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
/* This basically tries high level images for clist. If that fails
then we do the default */
code = gx_forward_begin_typed_image(dev, pis, pmat,
- pic, prect, pdcolor, pcpath, mem, pinfo);
+ pic, prect, pdcolor, pcpath, mem, pinfo);
if (code < 0){
code = gx_default_begin_typed_image(dev, pis, pmat, pic, prect,
- pdcolor, pcpath, mem, pinfo);
+ pdcolor, pcpath, mem, pinfo);
pis_noconst->has_transparency = false;
pis_noconst->trans_device = NULL;
return code;
@@ -6701,7 +6692,7 @@ pdf14_clist_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
*/
static int
c_pdf14trans_clist_write_update(const gs_composite_t * pcte, gx_device * dev,
- gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem)
+ gx_device ** pcdev, gs_imager_state * pis, gs_memory_t * mem)
{
gx_device_clist_writer * const cdev = &((gx_device_clist *)dev)->writer;
const gs_pdf14trans_t * pdf14pct = (const gs_pdf14trans_t *) pcte;
@@ -6711,110 +6702,110 @@ c_pdf14trans_clist_write_update(const gs_composite_t * pcte, gx_device * dev,
p14dev = (pdf14_clist_device *)(*pcdev);
/* We only handle the push/pop operations */
switch (pdf14pct->params.pdf14_op) {
- case PDF14_PUSH_DEVICE:
- code = pdf14_create_clist_device(mem, pis, pcdev, dev, pdf14pct);
- /*
- * Set the color_info of the clist device to match the compositing
- * device. We will restore it when the compositor is popped.
- * See pdf14_clist_create_compositor for the restore. Do the
- * same with the imager state's get_cmap_procs. We do not want
- * the imager state to use transfer functions on our color values.
- * The transfer functions will be applied at the end after we
- * have done our PDF 1.4 blend operations.
- */
-
- /*
- * Also if the bit depth is not 8 per channel we need to adjust
+ case PDF14_PUSH_DEVICE:
+ code = pdf14_create_clist_device(mem, pis, pcdev, dev, pdf14pct);
+ /*
+ * Set the color_info of the clist device to match the compositing
+ * device. We will restore it when the compositor is popped.
+ * See pdf14_clist_create_compositor for the restore. Do the
+ * same with the imager state's get_cmap_procs. We do not want
+ * the imager state to use transfer functions on our color values.
+ * The transfer functions will be applied at the end after we
+ * have done our PDF 1.4 blend operations.
+ */
+
+ /*
+ * Also if the bit depth is not 8 per channel we need to adjust
* as all the pdf14 compositing code is for 8 bits per channel.
* The clist writer device uses this information to make sure
* the proper bit depth is written. If we are using compressed
* color enconding, the color is written in a gx_color_index
* even for more than 8 components.
- */
- p14dev = (pdf14_clist_device *)(*pcdev);
+ */
+ p14dev = (pdf14_clist_device *)(*pcdev);
if (cdev->clist_color_info.num_components * 8 != cdev->clist_color_info.depth &&
- p14dev->my_encode_color != pdf14_compressed_encode_color) {
+ p14dev->my_encode_color != pdf14_compressed_encode_color) {
int i = (cdev->clist_color_info.num_components);
- i += mem->gs_lib_ctx->BITTAG == GS_DEVICE_DOESNT_SUPPORT_TAGS ? 0 : 1;
- cdev->clist_color_info.depth = 8 * i;
- }
- p14dev->saved_target_color_info = dev->color_info;
- dev->color_info = (*pcdev)->color_info;
+ i += mem->gs_lib_ctx->BITTAG == GS_DEVICE_DOESNT_SUPPORT_TAGS ? 0 : 1;
+ cdev->clist_color_info.depth = 8 * i;
+ }
+ p14dev->saved_target_color_info = dev->color_info;
+ dev->color_info = (*pcdev)->color_info;
/* Make sure that we keep the anti-alias information though */
dev->color_info.anti_alias = p14dev->saved_target_color_info.anti_alias;
p14dev->color_info.anti_alias = dev->color_info.anti_alias;
- p14dev->saved_target_encode_color = dev->procs.encode_color;
- p14dev->saved_target_decode_color = dev->procs.decode_color;
- dev->procs.encode_color = p14dev->procs.encode_color =
+ p14dev->saved_target_encode_color = dev->procs.encode_color;
+ p14dev->saved_target_decode_color = dev->procs.decode_color;
+ dev->procs.encode_color = p14dev->procs.encode_color =
p14dev->my_encode_color;
- dev->procs.decode_color = p14dev->procs.decode_color =
+ dev->procs.decode_color = p14dev->procs.decode_color =
p14dev->my_decode_color;
- p14dev->saved_target_get_color_mapping_procs =
+ p14dev->saved_target_get_color_mapping_procs =
dev->procs.get_color_mapping_procs;
- p14dev->saved_target_get_color_comp_index =
+ p14dev->saved_target_get_color_comp_index =
dev->procs.get_color_comp_index;
- dev->procs.get_color_mapping_procs =
- p14dev->procs.get_color_mapping_procs =
+ dev->procs.get_color_mapping_procs =
+ p14dev->procs.get_color_mapping_procs =
p14dev->my_get_color_mapping_procs;
- dev->procs.get_color_comp_index =
- p14dev->procs.get_color_comp_index =
+ dev->procs.get_color_comp_index =
+ p14dev->procs.get_color_comp_index =
p14dev->my_get_color_comp_index;
- p14dev->save_get_cmap_procs = pis->get_cmap_procs;
- pis->get_cmap_procs = pdf14_get_cmap_procs;
- gx_set_cmap_procs(pis, dev);
- return code;
+ p14dev->save_get_cmap_procs = pis->get_cmap_procs;
+ pis->get_cmap_procs = pdf14_get_cmap_procs;
+ gx_set_cmap_procs(pis, dev);
+ return code;
- case PDF14_POP_DEVICE:
+ case PDF14_POP_DEVICE:
# if 0 /* Disabled because pdf14_clist_create_compositor does so. */
- /*
- * Ensure that the tranfer functions, etc. are current before we
- * dump our transparency image to the output device.
- */
+ /*
+ * Ensure that the tranfer functions, etc. are current before we
+ * dump our transparency image to the output device.
+ */
if (pis->dev_ht)
code = cmd_put_halftone((gx_device_clist_writer *)
(((pdf14_clist_device *)dev)->target), pis->dev_ht);
-# else
- code = 0;
+# else
+ code = 0;
# endif
- code = clist_writer_check_empty_cropping_stack(cdev);
- break;
+ code = clist_writer_check_empty_cropping_stack(cdev);
+ break;
- case PDF14_BEGIN_TRANS_GROUP:
- { /* HACK: store mask_id into our params for subsequent
- calls of c_pdf14trans_write. To do this we must
- break const. */
- gs_pdf14trans_t * pdf14pct_noconst;
+ case PDF14_BEGIN_TRANS_GROUP:
+ { /* HACK: store mask_id into our params for subsequent
+ calls of c_pdf14trans_write. To do this we must
+ break const. */
+ gs_pdf14trans_t * pdf14pct_noconst;
- pdf14pct_noconst = (gs_pdf14trans_t *) pcte;
+ pdf14pct_noconst = (gs_pdf14trans_t *) pcte;
/* What ever the current mask ID is, that is the
softmask group through which this transparency
group must be rendered. Store it now. */
pdf14pct_noconst->params.mask_id = cdev->mask_id;
if_debug1('v', "[v]c_pdf14trans_clist_write_update group mask_id=%d \n", cdev->mask_id);
- }
- break;
- case PDF14_END_TRANS_GROUP:
- code = 0; /* A place for breakpoint. */
- break;
- case PDF14_BEGIN_TRANS_MASK:
+ }
+ break;
+ case PDF14_END_TRANS_GROUP:
+ code = 0; /* A place for breakpoint. */
+ break;
+ case PDF14_BEGIN_TRANS_MASK:
/* A new mask has been started */
cdev->mask_id = ++cdev->mask_id_count;
/* replacing is set everytime that we
have a zpushtransparencymaskgroup */
- { /* HACK: store mask_id into our params for subsequent
- calls of c_pdf14trans_write. To do this we must
- break const. */
- gs_pdf14trans_t * pdf14pct_noconst;
-
- pdf14pct_noconst = (gs_pdf14trans_t *) pcte;
- pdf14pct_noconst->params.mask_id = cdev->mask_id;
- if_debug1('v', "[v]c_pdf14trans_clist_write_update mask mask_id=%d \n", cdev->mask_id);
- }
- break;
- case PDF14_END_TRANS_MASK:
- code = 0; /* A place for breakpoint. */
- break;
+ { /* HACK: store mask_id into our params for subsequent
+ calls of c_pdf14trans_write. To do this we must
+ break const. */
+ gs_pdf14trans_t * pdf14pct_noconst;
+
+ pdf14pct_noconst = (gs_pdf14trans_t *) pcte;
+ pdf14pct_noconst->params.mask_id = cdev->mask_id;
+ if_debug1('v', "[v]c_pdf14trans_clist_write_update mask mask_id=%d \n", cdev->mask_id);
+ }
+ break;
+ case PDF14_END_TRANS_MASK:
+ code = 0; /* A place for breakpoint. */
+ break;
case PDF14_PUSH_TRANS_STATE:
code = 0; /* A place for breakpoint. */
break;
@@ -6827,13 +6818,13 @@ c_pdf14trans_clist_write_update(const gs_composite_t * pcte, gx_device * dev,
case PDF14_POP_SMASK_COLOR:
return 0;
break;
- default:
- break; /* do nothing for remaining ops */
+ default:
+ break; /* do nothing for remaining ops */
}
*pcdev = dev;
if (code < 0)
- return code;
- /* See c_pdf14trans_write, c_pdf14trans_adjust_ctm, and
+ return code;
+ /* See c_pdf14trans_write, c_pdf14trans_adjust_ctm, and
apply_create_compositor. */
code = gs_imager_setmatrix(&cdev->imager_state, &pdf14pct->params.ctm);
/* Wrote an extra ctm. */
@@ -6852,7 +6843,7 @@ c_pdf14trans_clist_write_update(const gs_composite_t * pcte, gx_device * dev,
*/
static int
c_pdf14trans_clist_read_update(gs_composite_t * pcte, gx_device * cdev,
- gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem)
+ gx_device * tdev, gs_imager_state * pis, gs_memory_t * mem)
{
pdf14_device * p14dev = (pdf14_device *)tdev;
gs_pdf14trans_t * pdf14pct = (gs_pdf14trans_t *) pcte;
@@ -6865,54 +6856,54 @@ c_pdf14trans_clist_read_update(gs_composite_t * pcte, gx_device * cdev,
* device.
*/
switch (pdf14pct->params.pdf14_op) {
- case PDF14_PUSH_DEVICE:
-# if 0 /* Disabled because *p14dev has no forwarding methods during the clist playback.
- This code is not executed while clist writing. */
- p14dev->saved_target_color_info = cdev->color_info;
- cdev->color_info = p14dev->color_info;
- */
+ case PDF14_PUSH_DEVICE:
+# if 0 /* Disabled because *p14dev has no forwarding methods during the clist playback.
+ This code is not executed while clist writing. */
+ p14dev->saved_target_color_info = cdev->color_info;
+ cdev->color_info = p14dev->color_info;
+ */
# endif
- /*
- * If we are blending using spot colors (i.e. the output device
- * supports spot colors) then we need to transfer compressed
- * color info from the clist PDF 1.4 compositing reader device
- * to the clist writer PDF 1.4 compositing device.
- * This info was transfered from that device to the output
- * device as a set of device parameters. However the clist
- * reader PDF 1.4 compositing device did not exist when the
- * device parameters were read from the clist. So that info
- * was buffered into the output device.
- */
- pclist_devn_params = dev_proc(cdev, ret_devn_params)(cdev);
- if (pclist_devn_params != NULL) {
- int num_comp = p14dev->color_info.num_components;
- /*
- * The number of components for the PDF14 device is the sum
- * of the process components and the number of spot colors
- * for the page. If the color capabilities of the parent
+ /*
+ * If we are blending using spot colors (i.e. the output device
+ * supports spot colors) then we need to transfer compressed
+ * color info from the clist PDF 1.4 compositing reader device
+ * to the clist writer PDF 1.4 compositing device.
+ * This info was transfered from that device to the output
+ * device as a set of device parameters. However the clist
+ * reader PDF 1.4 compositing device did not exist when the
+ * device parameters were read from the clist. So that info
+ * was buffered into the output device.
+ */
+ pclist_devn_params = dev_proc(cdev, ret_devn_params)(cdev);
+ if (pclist_devn_params != NULL) {
+ int num_comp = p14dev->color_info.num_components;
+ /*
+ * The number of components for the PDF14 device is the sum
+ * of the process components and the number of spot colors
+ * for the page. If the color capabilities of the parent
* device (which coming into this are the same as the p14dev)
- * are smaller than the number of page spot colors then
- * use that for the number of components. Otherwise use
+ * are smaller than the number of page spot colors then
+ * use that for the number of components. Otherwise use
* the page_spot_colors.
- */
- p14dev->devn_params.page_spot_colors =
- pclist_devn_params->page_spot_colors;
+ */
+ p14dev->devn_params.page_spot_colors =
+ pclist_devn_params->page_spot_colors;
if (num_comp < p14dev->devn_params.page_spot_colors + 4 ) {
- p14dev->color_info.num_components = num_comp;
+ p14dev->color_info.num_components = num_comp;
} else {
- p14dev->color_info.num_components =
- p14dev->devn_params.num_std_colorant_names +
- p14dev->devn_params.page_spot_colors;
+ p14dev->color_info.num_components =
+ p14dev->devn_params.num_std_colorant_names +
+ p14dev->devn_params.page_spot_colors;
}
- /* Transfer the data for the compressed color encoding.
+ /* Transfer the data for the compressed color encoding.
But we have to free what may be there before we do this */
devn_free_params((gx_device*) p14dev);
- p14dev->devn_params.compressed_color_list =
- pclist_devn_params->pdf14_compressed_color_list;
- p14dev->devn_params.separations =
- pclist_devn_params->pdf14_separations;
+ p14dev->devn_params.compressed_color_list =
+ pclist_devn_params->pdf14_compressed_color_list;
+ p14dev->devn_params.separations =
+ pclist_devn_params->pdf14_separations;
p14dev->free_devicen = false; /* to avoid freeing the clist ones */
- if (num_comp != p14dev->color_info.num_components) {
+ if (num_comp != p14dev->color_info.num_components) {
/* When the pdf14 device is opened it creates a context
and some soft mask related objects. The push device
compositor action will have already created these but
@@ -6921,36 +6912,36 @@ c_pdf14trans_clist_read_update(gs_composite_t * pcte, gx_device * cdev,
if (p14dev->ctx != NULL) {
pdf14_ctx_free(p14dev->ctx);
}
- dev_proc(tdev, open_device) (tdev);
- }
- }
- /* Check if we need to swap out the ICC profile for the pdf14
+ dev_proc(tdev, open_device) (tdev);
+ }
+ }
+ /* Check if we need to swap out the ICC profile for the pdf14
device. This will occur if our source profile for our device
happens to be something like CIELAB. Then we will blend in
RGB (unless a trans group is specified) */
if (cdev->device_icc_profile->data_cs == gsCIELAB) {
rc_decrement(tdev->device_icc_profile,
"c_pdf14trans_clist_read_update");
- tdev->device_icc_profile = gsicc_read_serial_icc(cdev,
+ tdev->device_icc_profile = gsicc_read_serial_icc(cdev,
pcrdev->trans_dev_icc_hash);
/* Keep a pointer to the clist device */
tdev->device_icc_profile->dev = (gx_device *) cdev;
/* There is a question of how the profile should be ref counted.
- I have a concern that it should be initialized based
+ I have a concern that it should be initialized based
upon the device ref count */
}
- break;
+ break;
- case PDF14_POP_DEVICE:
-# if 0 /* Disabled because *p14dev has no forwarding methods during
- the clist playback. This code is not executed while clist
+ case PDF14_POP_DEVICE:
+# if 0 /* Disabled because *p14dev has no forwarding methods during
+ the clist playback. This code is not executed while clist
writing. */
- cdev->color_info = p14dev->saved_target_color_info;
+ cdev->color_info = p14dev->saved_target_color_info;
# endif
- break;
+ break;
- default:
- break; /* do nothing for remaining ops */
+ default:
+ break; /* do nothing for remaining ops */
}
return 0;
@@ -6960,19 +6951,19 @@ c_pdf14trans_clist_read_update(gs_composite_t * pcte, gx_device * cdev,
* Get cropping for the compositor command.
*/
static int
-c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight,
+c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight,
int cropping_min, int cropping_max)
{
gs_pdf14trans_t * pdf14pct = (gs_pdf14trans_t *) pcte;
switch (pdf14pct->params.pdf14_op) {
- case PDF14_PUSH_DEVICE: return ALLBANDS; /* Applies to all bands. */
- case PDF14_POP_DEVICE: return ALLBANDS; /* Applies to all bands. */
+ case PDF14_PUSH_DEVICE: return ALLBANDS; /* Applies to all bands. */
+ case PDF14_POP_DEVICE: return ALLBANDS; /* Applies to all bands. */
- case PDF14_BEGIN_TRANS_GROUP:
- { gs_int_rect rect;
- int code;
+ case PDF14_BEGIN_TRANS_GROUP:
+ { gs_int_rect rect;
+ int code;
- code = pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
+ code = pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
&pdf14pct->params.bbox, &rect);
/* We have to crop this by the parent object. */
*ry = max(rect.p.y, cropping_min);
@@ -6980,56 +6971,56 @@ c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight,
return PUSHCROP; /* Push cropping. */
}
case PDF14_BEGIN_TRANS_MASK:
- { gs_int_rect rect;
- int code;
+ { gs_int_rect rect;
+ int code;
- code =
- pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
+ code =
+ pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
&pdf14pct->params.bbox, &rect);
- /* We have to crop this by the parent object and worry about the
+ /* We have to crop this by the parent object and worry about the
BC outside the range */
if ( pdf14pct->params.GrayBackground == 1.0 ) {
- /* In this case there will not be a background effect to
- worry about. The mask will not have any effect outside
+ /* In this case there will not be a background effect to
+ worry about. The mask will not have any effect outside
the bounding box. This is NOT the default or common case. */
*ry = max(rect.p.y, cropping_min);
- *rheight = min(rect.q.y, cropping_max) - *ry;
- return PUSHCROP; /* Push cropping. */
+ *rheight = min(rect.q.y, cropping_max) - *ry;
+ return PUSHCROP; /* Push cropping. */
} else {
- /* We need to make the soft mask range as large as the parent
- due to the fact that the background color can have an impact
+ /* We need to make the soft mask range as large as the parent
+ due to the fact that the background color can have an impact
OUTSIDE the bounding box of the soft mask */
*ry = cropping_min;
- *rheight = cropping_max - cropping_min;
- return PUSHCROP; /* Push cropping. */
+ *rheight = cropping_max - cropping_min;
+ return PUSHCROP; /* Push cropping. */
}
- }
- case PDF14_END_TRANS_GROUP: return POPCROP; /* Pop cropping. */
- case PDF14_END_TRANS_MASK: return POPCROP; /* Pop the cropping */
+ }
+ case PDF14_END_TRANS_GROUP: return POPCROP; /* Pop cropping. */
+ case PDF14_END_TRANS_MASK: return POPCROP; /* Pop the cropping */
case PDF14_PUSH_TRANS_STATE: return CURRBANDS;
case PDF14_POP_TRANS_STATE: return CURRBANDS;
- case PDF14_SET_BLEND_PARAMS:
- { gs_int_rect rect;
- int code;
+ case PDF14_SET_BLEND_PARAMS:
+ { gs_int_rect rect;
+ int code;
if (pdf14pct->params.crop_blend_params) {
- code = pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
+ code = pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm,
&pdf14pct->params.bbox, &rect);
/* We have to crop this by the parent object. */
*ry = max(rect.p.y, cropping_min);
*rheight = min(rect.q.y, cropping_max) - *ry;
- return SAMEAS_PUSHCROP_BUTNOPUSH;
- /* A special case were we write out to the same bands as the
- last group, but we will not push a cropping onto the
+ return SAMEAS_PUSHCROP_BUTNOPUSH;
+ /* A special case were we write out to the same bands as the
+ last group, but we will not push a cropping onto the
cropping statck */
} else {
return CURRBANDS;
}
}
- case PDF14_PUSH_SMASK_COLOR: return POPCROP; /* Pop cropping. */
- case PDF14_POP_SMASK_COLOR: return POPCROP; /* Pop the cropping */
+ case PDF14_PUSH_SMASK_COLOR: return POPCROP; /* Pop cropping. */
+ case PDF14_POP_SMASK_COLOR: return POPCROP; /* Pop the cropping */
}
return ALLBANDS;
}
@@ -7038,7 +7029,7 @@ c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight,
* This routine will check to see if the color component name matches those
* that are available amoung the current device's color components. If the
* color name is known to the output device then we add it to the list of
- * colorants for the PDF 1.4 transparency compositor.
+ * colorants for the PDF 1.4 transparency compositor.
*
* Notes: There are currently three different versions of The PDF 1.4
* transparency compositor device. The choice of which one is being used
@@ -7058,38 +7049,38 @@ c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight,
*/
static int
pdf14_cmykspot_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
pdf14_device * pdev = (pdf14_device *) dev;
gx_device * tdev = pdev->target;
gs_devn_params * pdevn_params = &pdev->devn_params;
gs_separations * pseparations = &pdevn_params->separations;
int comp_index;
- dev_proc_get_color_comp_index(*target_get_color_comp_index) =
+ dev_proc_get_color_comp_index(*target_get_color_comp_index) =
dev_proc(tdev, get_color_comp_index);
- /* The pdf14_clist_create_compositor may have set the color procs.
+ /* The pdf14_clist_create_compositor may have set the color procs.
We need the real target procs */
if (target_get_color_comp_index == pdf14_cmykspot_get_color_comp_index)
- target_get_color_comp_index =
+ target_get_color_comp_index =
((pdf14_clist_device *)pdev)->saved_target_get_color_comp_index;
/*
* If this is not a separation name then simply forward it to the target
* device.
*/
if (component_type == NO_COMP_NAME_TYPE)
- return (*target_get_color_comp_index)(tdev, pname, name_size, component_type);
+ return (*target_get_color_comp_index)(tdev, pname, name_size, component_type);
/*
* Check if the component is in either the process color model list
* or in the SeparationNames list.
*/
comp_index = check_pcm_and_separation_names(dev, pdevn_params,
- pname, name_size, component_type);
+ pname, name_size, component_type);
/*
* Return the colorant number if we know this name.
*/
if (comp_index >= 0)
- return comp_index;
+ return comp_index;
/*
* If we do not know this color, check if the output (target) device does.
*/
@@ -7099,27 +7090,27 @@ pdf14_cmykspot_get_color_comp_index(gx_device * dev, const char * pname,
* imaged due to the SeparationOrder device parameter.
*/
if (comp_index < 0 || comp_index == GX_DEVICE_COLOR_MAX_COMPONENTS)
- return comp_index;
+ return comp_index;
/*
* This is a new colorant. Add it to our list of colorants.
*/
if (pseparations->num_separations < GX_DEVICE_COLOR_MAX_COMPONENTS - 1) {
- int sep_num = pseparations->num_separations++;
+ int sep_num = pseparations->num_separations++;
int color_component_number;
- byte * sep_name;
-
- sep_name = gs_alloc_bytes(dev->memory,
- name_size, "pdf14_cmykspot_get_color_comp_index");
- memcpy(sep_name, pname, name_size);
- pseparations->names[sep_num].size = name_size;
- pseparations->names[sep_num].data = sep_name;
- color_component_number = sep_num + pdevn_params->num_std_colorant_names;
- if (color_component_number >= dev->color_info.num_components)
- color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
- else
- pdevn_params->separation_order_map[color_component_number] =
- color_component_number;
+ byte * sep_name;
+
+ sep_name = gs_alloc_bytes(dev->memory,
+ name_size, "pdf14_cmykspot_get_color_comp_index");
+ memcpy(sep_name, pname, name_size);
+ pseparations->names[sep_num].size = name_size;
+ pseparations->names[sep_num].data = sep_name;
+ color_component_number = sep_num + pdevn_params->num_std_colorant_names;
+ if (color_component_number >= dev->color_info.num_components)
+ color_component_number = GX_DEVICE_COLOR_MAX_COMPONENTS;
+ else
+ pdevn_params->separation_order_map[color_component_number] =
+ color_component_number;
return color_component_number;
}
@@ -7129,7 +7120,7 @@ pdf14_cmykspot_get_color_comp_index(gx_device * dev, const char * pname,
/* These functions keep track of when we are dealing with soft masks.
In such a case, we set the default color profiles to ones that ensure
proper soft mask rendering. */
-static int
+static int
pdf14_increment_smask_color(gs_imager_state * pis, gx_device * dev)
{
pdf14_device * pdev = (pdf14_device *) dev;
@@ -7142,13 +7133,13 @@ pdf14_increment_smask_color(gs_imager_state * pis, gx_device * dev)
} else {
/* Allocate and swap out the current profiles. The softmask
profiles should already b in place */
- result = gs_alloc_struct(pdev->memory, pdf14_smaskcolor_t,
- &st_pdf14_smaskcolor,
+ result = gs_alloc_struct(pdev->memory, pdf14_smaskcolor_t,
+ &st_pdf14_smaskcolor,
"pdf14_increment_smask_color");
if (result == NULL ) return(-1);
result->profiles = gsicc_new_iccsmask(pdev->memory);
pdev->smaskcolor = result;
- /* Theoretically there should not be any reason to change ref counts
+ /* Theoretically there should not be any reason to change ref counts
on the profiles for a well-formed PDF with clean soft mask groups.
The only issue could be if the graphic state is popped while we
are still within a softmask group. */
@@ -7168,8 +7159,8 @@ pdf14_decrement_smask_color(gs_imager_state * pis, gx_device * dev)
{
pdf14_device * pdev = (pdf14_device *) dev;
pdf14_smaskcolor_t *smaskcolor = pdev->smaskcolor;
- gsicc_manager_t *icc_manager = pis->icc_manager;
-
+ gsicc_manager_t *icc_manager = pis->icc_manager;
+
if (smaskcolor != NULL) {
smaskcolor->ref_count--;
if (smaskcolor->ref_count == 0) {
@@ -7178,14 +7169,14 @@ pdf14_decrement_smask_color(gs_imager_state * pis, gx_device * dev)
icc_manager->default_gray = smaskcolor->profiles->smask_gray;
icc_manager->default_rgb = smaskcolor->profiles->smask_rgb;
icc_manager->default_cmyk = smaskcolor->profiles->smask_cmyk;
- pdf14_free_smask_color(pdev);
+ pdf14_free_smask_color(pdev);
}
}
return(0);
}
-static void
-pdf14_free_smask_color(pdf14_device * pdev)
+static void
+pdf14_free_smask_color(pdf14_device * pdev)
{
gsicc_smask_t *profiles;
@@ -7193,7 +7184,7 @@ pdf14_free_smask_color(pdf14_device * pdev)
if ( pdev->smaskcolor->profiles != NULL) {
profiles = pdev->smaskcolor->profiles;
/* Do not decrement the softmask enties. They will remain
- in the icc_manager softmask member. They were not
+ in the icc_manager softmask member. They were not
incremented when moved here */
gs_free_object(pdev->memory, pdev->smaskcolor->profiles,
"pdf14_free_smask_color");
@@ -7202,4 +7193,3 @@ pdf14_free_smask_color(pdf14_device * pdev)
pdev->smaskcolor = NULL;
}
}
-
diff --git a/gs/base/gdevp14.h b/gs/base/gdevp14.h
index edca130cb..1cfb2d0ea 100644
--- a/gs/base/gdevp14.h
+++ b/gs/base/gdevp14.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,19 +50,18 @@ typedef struct {
* execution time.
*/
void (* unpack_color)(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out);
+ pdf14_device * p14dev, byte * out);
/*
* This procedure sends the final rasterized transparency data to the
* output device as an image.
*/
int (* put_image)(gx_device * dev,
- gs_imager_state * pis, gx_device * target);
+ gs_imager_state * pis, gx_device * target);
} pdf14_procs_s;
-
typedef pdf14_procs_s pdf14_procs_t;
-/* A stack structure for the softmask buffers.
+/* A stack structure for the softmask buffers.
The mask will be pdf14 buffers that are wrapped
in a refernce counted structure. We need this to
be referenced counted since we need to be able to push
@@ -77,7 +76,7 @@ struct pdf14_rcmask_s {
pdf14_buf *mask_buf;
rc_header rc;
gs_memory_t *memory;
-
+
};
typedef struct pdf14_mask_s pdf14_mask_t;
@@ -87,9 +86,8 @@ struct pdf14_mask_s {
pdf14_rcmask_t *rc_mask;
pdf14_mask_t *previous;
gs_memory_t *memory;
-
-};
+};
/* A structure to hold information
* about the parent color related
@@ -112,11 +110,11 @@ struct pdf14_parent_color_s {
uint max_gray; /* Used to determine if device halftones */
uint max_color; /* Causes issues if these are not maintained */
const gx_color_map_procs *(*get_cmap_procs)(const gs_imager_state *,
- const gx_device *);
+ const gx_device *);
const gx_cm_color_map_procs *(*parent_color_mapping_procs)(const gx_device *);
gx_color_index (*encode)(gx_device *, const gx_color_value value[]);
int (*decode)(gx_device *, gx_color_index, gx_color_value *);
- int (*parent_color_comp_index)(gx_device *, const char *, int, int);
+ int (*parent_color_comp_index)(gx_device *, const char *, int, int);
const pdf14_procs_t * unpack_procs;
const pdf14_nonseparable_blending_procs_t * parent_blending_procs;
cmm_profile_t *icc_profile; /* Opaque to GC. Allocated in non-gc memory */
@@ -175,7 +173,7 @@ struct pdf14_ctx_s {
bool additive;
int n_chan;
int smask_depth; /* used to catch smasks embedded in smasks. bug691803 */
- bool smask_blend;
+ bool smask_blend;
};
#ifndef gs_devn_params_DEFINED
@@ -203,8 +201,6 @@ typedef struct gs_pdf14trans_params_s gs_pdf14trans_params_t;
typedef struct pdf14_device_s pdf14_device;
#endif
-
-
/*
* Define the default post-clist (clist reader) PDF 1.4 compositing device.
* We actually use the same structure for both the clist writer and reader
@@ -230,7 +226,7 @@ typedef struct pdf14_device_s {
gx_device * pclist_device;
bool free_devicen; /* Used to avoid freeing a deviceN parameter from target clist device */
const gx_color_map_procs *(*save_get_cmap_procs)(const gs_imager_state *,
- const gx_device *);
+ const gx_device *);
gx_device_color_info saved_target_color_info;
dev_proc_encode_color(*saved_target_encode_color);
dev_proc_decode_color(*saved_target_decode_color);
@@ -240,7 +236,7 @@ typedef struct pdf14_device_s {
dev_proc_decode_color(*my_decode_color);
dev_proc_get_color_mapping_procs(*my_get_color_mapping_procs);
dev_proc_get_color_comp_index(*my_get_color_comp_index);
-
+
pdf14_parent_color_t *trans_group_parent_cmap_procs;
} pdf14_device_t;
@@ -271,7 +267,7 @@ int send_pdf14trans(gs_imager_state * pis, gx_device * dev,
*/
int
pdf14_put_devn_params(gx_device * pdev, gs_devn_params * pdevn_params,
- gs_param_list * plist);
+ gs_param_list * plist);
/* Used to passed along information about the buffer created by the
pdf14 device. This is used by the pattern accumulator when the
diff --git a/gs/base/gdevp2up.c b/gs/base/gdevp2up.c
index 9f8258568..eba6a5b9d 100644
--- a/gs/base/gdevp2up.c
+++ b/gs/base/gdevp2up.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,13 +45,13 @@ typedef struct gx_device_2up_s {
static const gx_device_procs pcx2up_procs =
prn_color_procs(pcx2up_open, gdev_prn_output_page, gdev_prn_close,
- pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
+ pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
gx_device_2up gs_pcx2up_device =
{prn_device_body(gx_device_2up, pcx2up_procs, "pcx2up",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 8, 5, 5, 6, 6, pcx2up_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 8, 5, 5, 6, 6, pcx2up_print_page)
};
/* Open the device. We reimplement this to force banding with */
@@ -66,7 +66,7 @@ pcx2up_open(gx_device * dev)
save_params = pdev->space_params;
pdev->space_params.MaxBitmap = 0; /* force banding */
pdev->space_params.band.BandWidth =
- dev->width * 2 + (int)(dev->HWResolution[0] * 2.0);
+ dev->width * 2 + (int)(dev->HWResolution[0] * 2.0);
pdev->space_params.band.BandBufferSpace = RENDER_BUFFER_SPACE;
code = gdev_prn_open(dev);
pdev->space_params = save_params;
@@ -83,60 +83,60 @@ pcx2up_print_page(gx_device_printer * pdev, FILE * file)
(const gx_device_printer *)&gs_pcx2up_device;
if (!pdev2->have_odd_page) { /* This is the odd page, just save it. */
- pdev2->have_odd_page = true;
- return gdev_prn_save_page(pdev, &pdev2->odd_page, 1);
+ pdev2->have_odd_page = true;
+ return gdev_prn_save_page(pdev, &pdev2->odd_page, 1);
} else { /* This is the even page, do 2-up output. */
- gx_saved_page even_page;
- gx_placed_page pages[2];
- int x_offset = (int)(pdev->HWResolution[0] * 0.5);
- int code = gdev_prn_save_page(pdev, &even_page, 1);
- int prdev_size = prdev_template->params_size;
- gx_device_printer *prdev;
+ gx_saved_page even_page;
+ gx_placed_page pages[2];
+ int x_offset = (int)(pdev->HWResolution[0] * 0.5);
+ int code = gdev_prn_save_page(pdev, &even_page, 1);
+ int prdev_size = prdev_template->params_size;
+ gx_device_printer *prdev;
#define rdev ((gx_device *)prdev)
- if (code < 0)
- return code;
- /* Create the placed page list. */
- pages[0].page = &pdev2->odd_page;
- pages[0].offset.x = x_offset;
- pages[0].offset.y = 0 /*y_offset */ ;
- pages[1].page = &even_page;
- pages[1].offset.x = pdev->width + x_offset * 3;
- pages[1].offset.y = 0 /*y_offset */ ;
- /* Create and open a device for rendering. */
- prdev = (gx_device_printer *)
- gs_alloc_bytes(pdev->memory, prdev_size,
- "pcx2up_print_page(device)");
- if (prdev == 0)
- return_error(gs_error_VMerror);
- memcpy(prdev, prdev_template, prdev_size);
+ if (code < 0)
+ return code;
+ /* Create the placed page list. */
+ pages[0].page = &pdev2->odd_page;
+ pages[0].offset.x = x_offset;
+ pages[0].offset.y = 0 /*y_offset */ ;
+ pages[1].page = &even_page;
+ pages[1].offset.x = pdev->width + x_offset * 3;
+ pages[1].offset.y = 0 /*y_offset */ ;
+ /* Create and open a device for rendering. */
+ prdev = (gx_device_printer *)
+ gs_alloc_bytes(pdev->memory, prdev_size,
+ "pcx2up_print_page(device)");
+ if (prdev == 0)
+ return_error(gs_error_VMerror);
+ memcpy(prdev, prdev_template, prdev_size);
check_device_separable((gx_device *)rdev);
- gx_device_fill_in_procs(rdev);
- set_dev_proc(prdev, open_device,
- dev_proc(&gs_pcx256_device, open_device));
- prdev->printer_procs.print_page =
- gs_pcx256_device.printer_procs.print_page;
- prdev->space_params.band =
- pages[0].page->info.band_params; /* either one will do */
- prdev->space_params.MaxBitmap = 0;
- prdev->space_params.BufferSpace =
- prdev->space_params.band.BandBufferSpace;
- prdev->width = prdev->space_params.band.BandWidth;
- prdev->OpenOutputFile = false;
- code = (*dev_proc(rdev, open_device)) (rdev);
- if (code < 0)
- return code;
- rdev->is_open = true;
- prdev->file = pdev->file;
- /* Render the pages. */
- code = gdev_prn_render_pages(prdev, pages, 2);
- /* Clean up. */
- if (pdev->file != 0)
- prdev->file = 0; /* don't close it */
- gs_closedevice(rdev);
- pdev2->have_odd_page = false;
- return code;
+ gx_device_fill_in_procs(rdev);
+ set_dev_proc(prdev, open_device,
+ dev_proc(&gs_pcx256_device, open_device));
+ prdev->printer_procs.print_page =
+ gs_pcx256_device.printer_procs.print_page;
+ prdev->space_params.band =
+ pages[0].page->info.band_params; /* either one will do */
+ prdev->space_params.MaxBitmap = 0;
+ prdev->space_params.BufferSpace =
+ prdev->space_params.band.BandBufferSpace;
+ prdev->width = prdev->space_params.band.BandWidth;
+ prdev->OpenOutputFile = false;
+ code = (*dev_proc(rdev, open_device)) (rdev);
+ if (code < 0)
+ return code;
+ rdev->is_open = true;
+ prdev->file = pdev->file;
+ /* Render the pages. */
+ code = gdev_prn_render_pages(prdev, pages, 2);
+ /* Clean up. */
+ if (pdev->file != 0)
+ prdev->file = 0; /* don't close it */
+ gs_closedevice(rdev);
+ pdev2->have_odd_page = false;
+ return code;
#undef rdev
}
}
diff --git a/gs/base/gdevpbm.c b/gs/base/gdevpbm.c
index 1956a0476..735ca8683 100644
--- a/gs/base/gdevpbm.c
+++ b/gs/base/gdevpbm.c
@@ -596,7 +596,6 @@ pnm_begin_typed_image(gx_device *dev,
pdcolor, pcpath, memory, pinfo);
}
-
/* ------ Internal routines ------ */
/* NOP row processing function used when no output */
diff --git a/gs/base/gdevpccm.c b/gs/base/gdevpccm.c
index 3cb9851b4..bdfddb602 100644
--- a/gs/base/gdevpccm.c
+++ b/gs/base/gdevpccm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,13 +36,13 @@ pc_4bit_map_rgb_color(gx_device * dev, const gx_color_value cv[])
color = (cv[2] > (gx_max_color_value/2));
color += (r << 2) + (g << 1);
if (color > 0) /* If the color is not black */
- color += 8; /* Turn on intensity bit */
+ color += 8; /* Turn on intensity bit */
return color;
}
int
pc_4bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
#define icolor (int)color
prgb[0] = (icolor & 4 ? gx_max_color_value : 0);
@@ -70,11 +70,11 @@ pc_8bit_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gv = g / (gx_max_color_value / 6 + 1);
return (gx_color_index)
- (rv * 6 + gv) * 6 + b / (gx_max_color_value / 6 + 1);
+ (rv * 6 + gv) * 6 + b / (gx_max_color_value / 6 + 1);
}
int
pc_8bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
static const gx_color_value ramp6[6] =
{0,
@@ -84,14 +84,14 @@ pc_8bit_map_color_rgb(gx_device * dev, gx_color_index color,
gx_max_color_value - (gx_max_color_value / 5),
gx_max_color_value
};
-
+
#define icolor (uint)color
if (icolor >= 216) {
- prgb[0] = prgb[1] = prgb[2] = 0;
+ prgb[0] = prgb[1] = prgb[2] = 0;
} else {
- prgb[0] = ramp6[icolor / 36];
- prgb[1] = ramp6[(icolor / 6) % 6];
- prgb[2] = ramp6[icolor % 6];
+ prgb[0] = ramp6[icolor / 36];
+ prgb[1] = ramp6[(icolor / 6) % 6];
+ prgb[2] = ramp6[icolor % 6];
}
#undef icolor
return 0;
@@ -105,12 +105,12 @@ pc_write_palette(gx_device * dev, uint max_index, FILE * file)
gx_color_value rgb[3];
for (i = 0; i < max_index; i++) {
- (*dev_proc(dev, map_color_rgb)) (dev, (gx_color_index) i, rgb);
- for (c = 0; c < 3; c++) {
- byte b = rgb[c] >> (gx_color_value_bits - 8);
+ (*dev_proc(dev, map_color_rgb)) (dev, (gx_color_index) i, rgb);
+ for (c = 0; c < 3; c++) {
+ byte b = rgb[c] >> (gx_color_value_bits - 8);
- fputc(b, file);
- }
+ fputc(b, file);
+ }
}
return 0;
}
diff --git a/gs/base/gdevpccm.h b/gs/base/gdevpccm.h
index 6f4019f91..c273b6b49 100644
--- a/gs/base/gdevpccm.h
+++ b/gs/base/gdevpccm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpcfb.c b/gs/base/gdevpcfb.c
index 75c308669..b7f133927 100644
--- a/gs/base/gdevpcfb.c
+++ b/gs/base/gdevpcfb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
#include "gxdevice.h"
#include "gdevpccm.h"
#include "gdevpcfb.h"
-
+
/* We may compile this in a non-segmented environment.... */
#ifndef _ss
#define _ss
@@ -48,26 +48,26 @@ static dev_proc_map_color_rgb(ega01_map_color_rgb);
# endif
#endif
#define ega_std_procs(get_params, put_params)\
- ega_open,\
- NULL, /* get_initial_matrix */\
- NULL, /* sync_output */\
- NULL, /* output_page */\
- ega_close,\
- ega_map_rgb_color,\
- ega_map_color_rgb,\
- ega_fill_rectangle,\
- ega_tile_rectangle,\
- ega_copy_mono,\
- ega_copy_color,\
- NULL, /* draw_line */\
- ega_get_bits,\
- get_params,\
- put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device
+ ega_open,\
+ NULL, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ NULL, /* output_page */\
+ ega_close,\
+ ega_map_rgb_color,\
+ ega_map_color_rgb,\
+ ega_fill_rectangle,\
+ ega_tile_rectangle,\
+ ega_copy_mono,\
+ ega_copy_color,\
+ NULL, /* draw_line */\
+ ega_get_bits,\
+ get_params,\
+ put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device
static const gx_device_procs ega_procs =
{
@@ -82,15 +82,15 @@ static const gx_device_procs svga16_procs =
};
/* All the known instances */
- /* EGA */
+ /* EGA */
gx_device_ega far_data gs_ega_device =
ega_device("ega", ega_procs, 80, 350, 48.0 / 35.0, 0x10);
- /* VGA */
+ /* VGA */
gx_device_ega far_data gs_vga_device =
ega_device("vga", ega_procs, 80, 480, 1.0, 0x12);
- /* Generic SuperVGA, 800x600, 16-color mode */
+ /* Generic SuperVGA, 800x600, 16-color mode */
gx_device_ega far_data gs_svga16_device =
ega_device("svga16", svga16_procs, 100, 600, 1.0, 0x29 /*Tseng */ );
@@ -104,18 +104,18 @@ ega_open(gx_device * dev)
{ /* Adjust the device resolution. */
/* This is a hack, pending refactoring of the put_params machinery. */
switch (fb_dev->video_mode) {
- case 0x10: /* EGA */
- gx_device_adjust_resolution(dev, 640, 350, 1);
- break;
- case 0x12: /* VGA */
- gx_device_adjust_resolution(dev, 640, 480, 1);
- break;
- default: /* 800x600 SuperVGA */
- gx_device_adjust_resolution(dev, 800, 600, 1);
- break;
+ case 0x10: /* EGA */
+ gx_device_adjust_resolution(dev, 640, 350, 1);
+ break;
+ case 0x12: /* VGA */
+ gx_device_adjust_resolution(dev, 640, 480, 1);
+ break;
+ default: /* 800x600 SuperVGA */
+ gx_device_adjust_resolution(dev, 800, 600, 1);
+ break;
}
if (pcfb_save_state.display_mode < 0)
- pcfb_get_state(&pcfb_save_state);
+ pcfb_get_state(&pcfb_save_state);
/* Do implementation-specific initialization */
pcfb_set_signals(dev);
pcfb_set_mode(fb_dev->video_mode);
@@ -128,7 +128,7 @@ int
ega_close(gx_device * dev)
{
if (pcfb_save_state.display_mode >= 0)
- pcfb_set_state(&pcfb_save_state);
+ pcfb_set_state(&pcfb_save_state);
return 0;
}
@@ -139,7 +139,7 @@ svga16_get_params(gx_device * dev, gs_param_list * plist)
int code = gx_default_get_params(dev, plist);
if (code < 0)
- return code;
+ return code;
return param_write_int(plist, "DisplayMode", &fb_dev->video_mode);
}
static int
@@ -151,24 +151,24 @@ svga16_put_params(gx_device * dev, gs_param_list * plist)
const char *param_name;
switch (code = param_read_int(plist, (param_name = "DisplayMode"), &imode)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gx_default_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
if (imode != fb_dev->video_mode) {
- if (dev->is_open)
- gs_closedevice(dev);
- fb_dev->video_mode = imode;
+ if (dev->is_open)
+ gs_closedevice(dev);
+ fb_dev->video_mode = imode;
}
return 0;
}
@@ -194,7 +194,7 @@ ega1_map_rgb_color(gx_device * dev, const gx_color_value cv[])
#define icolor (int)color
static int
ega01_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
#define one (gx_max_color_value / 2 + 1)
prgb[0] = (icolor & 4 ? one : 0);
@@ -234,9 +234,9 @@ memsetcol(rop_ptr rop) /* dest, draster, height, data */
int draster = rop->draster;
while (yc--) {
- byte_discard(*addr);
- *addr = data;
- addr += draster;
+ byte_discard(*addr);
+ *addr = data;
+ addr += draster;
}
}
@@ -247,32 +247,32 @@ memsetrect(rop_ptr rop) /* dest, draster, width, height, data */
int width = rop->width;
if (yc <= 0 || width <= 0)
- return;
+ return;
{
- byte *addr = rop->dest;
- byte data = rop->data;
-
- if (width > 5) { /* use memset */
- int skip = rop->draster;
-
- do {
- memset(addr, data, width);
- addr += skip;
- }
- while (--yc);
- } else { /* avoid the fixed overhead */
- int skip = rop->draster - width;
-
- do {
- int cnt = width;
-
- do {
- *addr++ = data;
- } while (--cnt);
- addr += skip;
- }
- while (--yc);
- }
+ byte *addr = rop->dest;
+ byte data = rop->data;
+
+ if (width > 5) { /* use memset */
+ int skip = rop->draster;
+
+ do {
+ memset(addr, data, width);
+ addr += skip;
+ }
+ while (--yc);
+ } else { /* avoid the fixed overhead */
+ int skip = rop->draster - width;
+
+ do {
+ int cnt = width;
+
+ do {
+ *addr++ = data;
+ } while (--cnt);
+ addr += skip;
+ }
+ while (--yc);
+ }
}
}
@@ -288,9 +288,9 @@ memrwcol(rop_ptr rop) /* dest, draster, src, sraster, height, shift, invert */
int sraster = rop->sraster, draster = rop->draster;
while (yc--) {
- byte_discard(*dp);
- *dp = ((*sp >> shift) + (*sp << (8 - shift))) ^ invert;
- dp += draster, sp += sraster;
+ byte_discard(*dp);
+ *dp = ((*sp >> shift) + (*sp << (8 - shift))) ^ invert;
+ dp += draster, sp += sraster;
}
}
static void
@@ -303,12 +303,12 @@ memrwcol0(rop_ptr rop) /* same except shift = 0 */
int sraster = rop->sraster, draster = rop->draster;
if (yc > 0)
- do {
- byte_discard(*dp);
- *dp = *sp ^ invert;
- dp += draster, sp += sraster;
- }
- while (--yc);
+ do {
+ byte_discard(*dp);
+ *dp = *sp ^ invert;
+ dp += draster, sp += sraster;
+ }
+ while (--yc);
}
static void
@@ -322,9 +322,9 @@ memrwcol2(rop_ptr rop) /* dest, draster, src, sraster, height, shift, invert */
int sraster = rop->sraster, draster = rop->draster;
while (yc--) {
- byte_discard(*dp);
- *dp = ((sp[1] >> shift) + (*sp << (8 - shift))) ^ invert;
- dp += draster, sp += sraster;
+ byte_discard(*dp);
+ *dp = ((sp[1] >> shift) + (*sp << (8 - shift))) ^ invert;
+ dp += draster, sp += sraster;
}
}
@@ -355,7 +355,7 @@ ega_write_dot(gx_device * dev, int x, int y, gx_color_index color)
/* Color = gx_no_color_index means transparent (no effect on the image). */
int
ega_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
int x, int y, int w, int h, gx_color_index izero, gx_color_index ione)
{
rop_params params;
@@ -377,160 +377,160 @@ ega_copy_mono(gx_device * dev,
/* Analyze the 16 possible cases: each of izero and ione may be */
/* 0, 0xf, transparent, or some other color. */
switch (czero) {
- case no_color:
- switch (cone) {
- default: /* (T, other) */
- /* Must do 2 passes */
- other_color = cone;
- save_dest = params.dest;
- /* falls through */
- case 0: /* (T, 0) */
- set_g_function(gf_AND);
- params.invert = -1;
- break;
- case 0xf: /* (T, 0xf) */
- set_g_function(gf_OR);
- params.invert = 0;
- break;
- case no_color: /* (T, T) */
- return 0; /* nothing to do */
- }
- break;
- case 0:
- params.invert = 0;
- switch (cone) {
- default: /* (0, other) */
- set_g_const(0);
- set_g_const_map(cone ^ 0xf);
- /* falls through */
- case 0xf: /* (0, 0xf) */
- break;
- case no_color: /* (0, T) */
- set_g_function(gf_AND);
- break;
- }
- break;
- case 0xf:
- params.invert = -1;
- switch (cone) {
- case 0: /* (0xf, 0) */
- break;
- default: /* (0xf, other) */
- set_g_const(0xf);
- set_g_const_map(cone);
- break;
- case no_color: /* (0xf, T) */
- set_g_function(gf_OR);
- /* falls through */
- }
- break;
- default:
- switch (cone) {
- default: /* (other, not T) */
- if (bit_included_in(czero, cone)) {
- set_g_const(czero);
- set_g_const_map(czero ^ cone ^ 0xf);
- params.invert = 0;
- break;
- } else if (bit_included_in(cone, czero)) {
- set_g_const(cone);
- set_g_const_map(cone ^ czero ^ 0xf);
- params.invert = -1;
- break;
- }
- /* No way around it, fill with one color first. */
- save_dest = params.dest;
- fill_rectangle((rop_ptr) & params, x & 7, w, cone);
- params.dest = save_dest;
- set_g_function(gf_XOR);
- set_s_map(czero ^ cone);
- other_color = -2; /* must reset s_map at end */
- params.invert = -1;
- break;
- case no_color: /* (other, T) */
- /* Must do 2 passes */
- other_color = czero;
- save_dest = params.dest;
- set_g_function(gf_AND);
- params.invert = 0;
- break;
- }
- break;
+ case no_color:
+ switch (cone) {
+ default: /* (T, other) */
+ /* Must do 2 passes */
+ other_color = cone;
+ save_dest = params.dest;
+ /* falls through */
+ case 0: /* (T, 0) */
+ set_g_function(gf_AND);
+ params.invert = -1;
+ break;
+ case 0xf: /* (T, 0xf) */
+ set_g_function(gf_OR);
+ params.invert = 0;
+ break;
+ case no_color: /* (T, T) */
+ return 0; /* nothing to do */
+ }
+ break;
+ case 0:
+ params.invert = 0;
+ switch (cone) {
+ default: /* (0, other) */
+ set_g_const(0);
+ set_g_const_map(cone ^ 0xf);
+ /* falls through */
+ case 0xf: /* (0, 0xf) */
+ break;
+ case no_color: /* (0, T) */
+ set_g_function(gf_AND);
+ break;
+ }
+ break;
+ case 0xf:
+ params.invert = -1;
+ switch (cone) {
+ case 0: /* (0xf, 0) */
+ break;
+ default: /* (0xf, other) */
+ set_g_const(0xf);
+ set_g_const_map(cone);
+ break;
+ case no_color: /* (0xf, T) */
+ set_g_function(gf_OR);
+ /* falls through */
+ }
+ break;
+ default:
+ switch (cone) {
+ default: /* (other, not T) */
+ if (bit_included_in(czero, cone)) {
+ set_g_const(czero);
+ set_g_const_map(czero ^ cone ^ 0xf);
+ params.invert = 0;
+ break;
+ } else if (bit_included_in(cone, czero)) {
+ set_g_const(cone);
+ set_g_const_map(cone ^ czero ^ 0xf);
+ params.invert = -1;
+ break;
+ }
+ /* No way around it, fill with one color first. */
+ save_dest = params.dest;
+ fill_rectangle((rop_ptr) & params, x & 7, w, cone);
+ params.dest = save_dest;
+ set_g_function(gf_XOR);
+ set_s_map(czero ^ cone);
+ other_color = -2; /* must reset s_map at end */
+ params.invert = -1;
+ break;
+ case no_color: /* (other, T) */
+ /* Must do 2 passes */
+ other_color = czero;
+ save_dest = params.dest;
+ set_g_function(gf_AND);
+ params.invert = 0;
+ break;
+ }
+ break;
}
/* Actually copy the bits. */
dleft = 8 - (x & 7);
mask = 0xff >> (8 - dleft);
count = w - dleft;
if (count < 0)
- mask -= mask >> w,
- rmask = 0;
+ mask -= mask >> w,
+ rmask = 0;
else
- rmask = 0xff00 >> (count & 7);
+ rmask = 0xff00 >> (count & 7);
/* params: dest, src, sraster, height, shift, invert */
/* Smashes params.src, params.dest, count. */
copy:set_g_mask(mask);
if (params.shift == 0) { /* optimize the aligned case *//* Do left column */
- memrwcol0((rop_ptr) & params);
- /* Do center */
- if ((count -= 8) >= 0) {
- out_g_mask(0xff);
- do {
- params.src++, params.dest++;
- memrwcol0((rop_ptr) & params);
- }
- while ((count -= 8) >= 0);
- }
- /* Do right column */
- if (rmask) {
- params.src++, params.dest++;
- out_g_mask(rmask);
- memrwcol0((rop_ptr) & params);
- }
+ memrwcol0((rop_ptr) & params);
+ /* Do center */
+ if ((count -= 8) >= 0) {
+ out_g_mask(0xff);
+ do {
+ params.src++, params.dest++;
+ memrwcol0((rop_ptr) & params);
+ }
+ while ((count -= 8) >= 0);
+ }
+ /* Do right column */
+ if (rmask) {
+ params.src++, params.dest++;
+ out_g_mask(rmask);
+ memrwcol0((rop_ptr) & params);
+ }
} else { /* Do left column */
- int sleft = 8 - (sourcex & 7);
-
- if (sleft >= dleft) { /* Source fits in one byte */
- memrwcol((rop_ptr) & params);
- } else if (w <= sleft) { /* Source fits in one byte, thin case */
- memrwcol((rop_ptr) & params);
- goto fin;
- } else {
- memrwcol2((rop_ptr) & params);
- params.src++;
- }
- /* Do center */
- if ((count -= 8) >= 0) {
- out_g_mask(0xff);
- do {
- params.dest++;
- memrwcol2((rop_ptr) & params);
- params.src++;
- }
- while ((count -= 8) >= 0);
- }
- /* Do right column */
- if (rmask) {
- out_g_mask(rmask);
- params.dest++;
- if (count + 8 <= params.shift)
- memrwcol((rop_ptr) & params);
- else
- memrwcol2((rop_ptr) & params);
- }
+ int sleft = 8 - (sourcex & 7);
+
+ if (sleft >= dleft) { /* Source fits in one byte */
+ memrwcol((rop_ptr) & params);
+ } else if (w <= sleft) { /* Source fits in one byte, thin case */
+ memrwcol((rop_ptr) & params);
+ goto fin;
+ } else {
+ memrwcol2((rop_ptr) & params);
+ params.src++;
+ }
+ /* Do center */
+ if ((count -= 8) >= 0) {
+ out_g_mask(0xff);
+ do {
+ params.dest++;
+ memrwcol2((rop_ptr) & params);
+ params.src++;
+ }
+ while ((count -= 8) >= 0);
+ }
+ /* Do right column */
+ if (rmask) {
+ out_g_mask(rmask);
+ params.dest++;
+ if (count + 8 <= params.shift)
+ memrwcol((rop_ptr) & params);
+ else
+ memrwcol2((rop_ptr) & params);
+ }
}
fin:if (other_color != -1) {
- if (other_color >= 0) { /* Do the second pass on (T, other) or (other, T). */
- count = w - dleft;
- params.src = base + (sourcex >> 3);
- params.dest = save_dest;
- params.invert ^= -1;
- set_s_map(other_color);
- set_g_function(gf_OR);
- other_color = -2;
- goto copy;
- } else { /* Finished second pass, restore s_map */
- set_s_map(-1);
- }
+ if (other_color >= 0) { /* Do the second pass on (T, other) or (other, T). */
+ count = w - dleft;
+ params.src = base + (sourcex >> 3);
+ params.dest = save_dest;
+ params.invert ^= -1;
+ set_s_map(other_color);
+ set_g_function(gf_OR);
+ other_color = -2;
+ goto copy;
+ } else { /* Finished second pass, restore s_map */
+ set_s_map(-1);
+ }
}
set_g_function(gf_WRITE);
set_g_const_map(0);
@@ -544,8 +544,8 @@ ega_copy_mono(gx_device * dev,
/* except that each pixel takes 4 bits instead of 1. */
int
ega_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
const byte *line = base + (sourcex >> 1);
unsigned mask = 0x80 >> (x & 7);
@@ -558,33 +558,33 @@ ega_copy_color(gx_device * dev,
set_g_mode(gm_FILL);
select_g_mask();
for (;; px++) {
- const byte *bptr = line;
- fb_ptr fbptr = fb_line;
- int py = h;
-
- out_g_mask(mask);
- if (px & 1) {
- do {
- byte_discard(*fbptr); /* latch frame buffer data */
- *fbptr = *bptr;
- bptr += raster;
- fbptr += fb_raster;
- }
- while (--py);
- line++;
- } else {
- do {
- byte_discard(*fbptr); /* latch frame buffer data */
- *fbptr = *bptr >> 4;
- bptr += raster;
- fbptr += fb_raster;
- }
- while (--py);
- }
- if (!--w)
- break;
- if ((mask >>= 1) == 0)
- mask = 0x80, fb_line++;
+ const byte *bptr = line;
+ fb_ptr fbptr = fb_line;
+ int py = h;
+
+ out_g_mask(mask);
+ if (px & 1) {
+ do {
+ byte_discard(*fbptr); /* latch frame buffer data */
+ *fbptr = *bptr;
+ bptr += raster;
+ fbptr += fb_raster;
+ }
+ while (--py);
+ line++;
+ } else {
+ do {
+ byte_discard(*fbptr); /* latch frame buffer data */
+ *fbptr = *bptr >> 4;
+ bptr += raster;
+ fbptr += fb_raster;
+ }
+ while (--py);
+ }
+ if (!--w)
+ break;
+ if ((mask >>= 1) == 0)
+ mask = 0x80, fb_line++;
}
set_g_mode(gm_DATA);
dot_end();
@@ -594,19 +594,19 @@ ega_copy_color(gx_device * dev,
/* Fill a rectangle. */
int
ega_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
rop_params params;
fit_fill(dev, x, y, w, h);
params.dest = mk_fb_ptr(x, y);
if (h == 1)
- fill_row_only(params.dest, x & 7, w, (int)color);
+ fill_row_only(params.dest, x & 7, w, (int)color);
else {
- params.draster = fb_dev->raster;
- params.height = h;
- fill_rectangle((rop_ptr) & params, x & 7, w, (int)color);
- dot_end();
+ params.draster = fb_dev->raster;
+ params.height = h;
+ fill_rectangle((rop_ptr) & params, x & 7, w, (int)color);
+ dot_end();
}
return 0;
}
@@ -617,7 +617,7 @@ ega_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
int
ega_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone,
- int px, int py)
+ int px, int py)
#define zero (int)czero
#define one (int)cone
{
@@ -635,8 +635,8 @@ ega_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
fit_fill(dev, x, y, w, h);
/* We only handle the easiest cases directly. */
if ((tile->size.x & 7) || one == -1 || zero == -1 || px || py)
- return gx_default_tile_rectangle(dev, tile, x, y, w, h,
- czero, cone, px, py);
+ return gx_default_tile_rectangle(dev, tile, x, y, w, h,
+ czero, cone, px, py);
/* Following is similar to aligned case of copy_mono */
params.dest = mk_fb_ptr(x, y);
params.draster = fb_dev->raster;
@@ -646,114 +646,114 @@ ega_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
/* Set up the graphics registers */
const_bits = (zero ^ one) ^ 0xf;
if (const_bits) {
- set_g_const(zero); /* either color will do */
- set_g_const_map(const_bits);
+ set_g_const(zero); /* either color will do */
+ set_g_const_map(const_bits);
}
if ((maps = zero & ~one) != 0) {
- set_s_map(maps += const_bits);
- params.invert = -1;
- again = one & ~zero;
+ set_s_map(maps += const_bits);
+ params.invert = -1;
+ again = one & ~zero;
} else {
- maps = one & ~zero;
- set_s_map(maps += const_bits);
- params.invert = 0;
- again = 0;
+ maps = one & ~zero;
+ set_s_map(maps += const_bits);
+ params.invert = 0;
+ again = 0;
}
xmod = (x % tile->size.x) >> 3;
width_bytes = tile->size.x >> 3;
mask = 0xff >> xbit;
if (w + xbit <= 8)
- mask -= mask >> w,
- rmask = 0,
- narrow = 1;
+ mask -= mask >> w,
+ rmask = 0,
+ narrow = 1;
else {
- rmask = (0xff00 >> ((w + x) & 7)) & 0xff;
- if (xbit)
- w += xbit - 8;
- else
- mask = 0, --xmod, --params.dest;
- narrow = 0;
+ rmask = (0xff00 >> ((w + x) & 7)) & 0xff;
+ if (xbit)
+ w += xbit - 8;
+ else
+ mask = 0, --xmod, --params.dest;
+ narrow = 0;
}
ymod = y % tile_height;
tile:yleft = tile_height - ymod;
params.src = tile->data + ymod * params.sraster + xmod;
lcount = h;
if (narrow) { /* Optimize narrow case */
- set_g_mask(mask);
- if (lcount > yleft) {
- params.height = yleft;
- memrwcol0((rop_ptr) & params);
- params.dest += yleft * params.draster;
- params.src = tile->data + xmod;
- params.height = tile_height;
- lcount -= yleft;
- while (lcount >= tile_height) {
- memrwcol0((rop_ptr) & params);
- params.dest += tile_height * params.draster;
- lcount -= tile_height;
- }
- }
- if (lcount) {
- params.height = lcount;
- memrwcol0((rop_ptr) & params);
- }
+ set_g_mask(mask);
+ if (lcount > yleft) {
+ params.height = yleft;
+ memrwcol0((rop_ptr) & params);
+ params.dest += yleft * params.draster;
+ params.src = tile->data + xmod;
+ params.height = tile_height;
+ lcount -= yleft;
+ while (lcount >= tile_height) {
+ memrwcol0((rop_ptr) & params);
+ params.dest += tile_height * params.draster;
+ lcount -= tile_height;
+ }
+ }
+ if (lcount) {
+ params.height = lcount;
+ memrwcol0((rop_ptr) & params);
+ }
} else {
- fb_ptr line = params.dest;
- int xpos = width_bytes - xmod;
-
- while (1) {
- int xleft = xpos;
- int count = w;
-
- params.height = (lcount > yleft ? yleft : lcount);
- /* Do first byte, if not a full byte. */
- if (mask) {
- set_g_mask(mask);
- memrwcol0((rop_ptr) & params);
- }
- /* Do full bytes */
- if ((count -= 8) >= 0) {
- set_g_mask(0xff);
- do {
- if (!--xleft)
- xleft = width_bytes,
- params.src -= width_bytes;
- ++params.src, ++params.dest;
- memrwcol0((rop_ptr) & params);
- }
- while ((count -= 8) >= 0);
- }
- /* Do last byte */
- if (rmask) {
- if (!--xleft)
- xleft = width_bytes,
- params.src -= width_bytes;
- set_g_mask(rmask);
- ++params.src, ++params.dest;
- memrwcol0((rop_ptr) & params);
- }
- if ((lcount -= params.height) == 0)
- break;
- params.dest = line += params.height * params.draster;
- params.src = tile->data + xmod;
- yleft = tile_height;
- }
+ fb_ptr line = params.dest;
+ int xpos = width_bytes - xmod;
+
+ while (1) {
+ int xleft = xpos;
+ int count = w;
+
+ params.height = (lcount > yleft ? yleft : lcount);
+ /* Do first byte, if not a full byte. */
+ if (mask) {
+ set_g_mask(mask);
+ memrwcol0((rop_ptr) & params);
+ }
+ /* Do full bytes */
+ if ((count -= 8) >= 0) {
+ set_g_mask(0xff);
+ do {
+ if (!--xleft)
+ xleft = width_bytes,
+ params.src -= width_bytes;
+ ++params.src, ++params.dest;
+ memrwcol0((rop_ptr) & params);
+ }
+ while ((count -= 8) >= 0);
+ }
+ /* Do last byte */
+ if (rmask) {
+ if (!--xleft)
+ xleft = width_bytes,
+ params.src -= width_bytes;
+ set_g_mask(rmask);
+ ++params.src, ++params.dest;
+ memrwcol0((rop_ptr) & params);
+ }
+ if ((lcount -= params.height) == 0)
+ break;
+ params.dest = line += params.height * params.draster;
+ params.src = tile->data + xmod;
+ yleft = tile_height;
+ }
}
/* Now do the second color if needed */
if (again) {
- maps = again + const_bits;
- set_s_map(maps);
- again = 0;
- params.dest = mk_fb_ptr(x, y);
- if (mask == 0)
- params.dest--;
- params.invert = 0;
- goto tile;
+ maps = again + const_bits;
+ set_s_map(maps);
+ again = 0;
+ params.dest = mk_fb_ptr(x, y);
+ if (mask == 0)
+ params.dest--;
+ params.invert = 0;
+ goto tile;
}
if (maps != 0xf)
- set_s_map(-1);
+ set_s_map(-1);
if (const_bits)
- set_g_const_map(0);
+ set_g_const_map(0);
dot_end();
return 0;
}
@@ -788,20 +788,20 @@ ega_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
};
if (y < 0 || y >= dev->height || dev->width > 800)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Read 4 planes into the holding buffer. */
for (i = 0; i < 4; ++i) {
- set_g_read_plane(i);
- memcpy(planes + 100 * i, mk_fb_ptr(0, y), width_bytes);
+ set_g_read_plane(i);
+ memcpy(planes + 100 * i, mk_fb_ptr(0, y), width_bytes);
}
/* Now assemble the final data from the planes. */
for (dest = (bits32 *) data, src = planes, end = src + width_bytes;
- src < end; ++dest, ++src
- )
- *dest = (((((spread8[src[0]] >> 1) | spread8[src[100]]) >> 1) |
- spread8[src[200]]) >> 1) | spread8[src[300]];
+ src < end; ++dest, ++src
+ )
+ *dest = (((((spread8[src[0]] >> 1) | spread8[src[100]]) >> 1) |
+ spread8[src[200]]) >> 1) | spread8[src[300]];
if (actual_data != 0)
- *actual_data = data;
+ *actual_data = data;
return 0;
}
@@ -823,28 +823,28 @@ fill_rectangle(register rop_ptr rop, int bit, int w, int color)
set_g_const_map(0xf);
select_g_mask();
if (bit + w <= 8) { /* Less than one byte */
- out_g_mask(rmask_tab[w] >> bit);
- memsetcol(rop);
+ out_g_mask(rmask_tab[w] >> bit);
+ memsetcol(rop);
} else {
- byte right_mask;
-
- if (bit) {
- out_g_mask(0xff >> bit);
- memsetcol(rop);
- rop->dest++;
- w += bit - 8;
- }
- if (w >= 8) {
- out_g_mask(0xff); /* all bits */
- rop->width = w >> 3;
- memsetrect(rop);
- rop->dest += rop->width;
- w &= 7;
- }
- if ((right_mask = rmask_tab[w]) != 0) {
- out_g_mask(right_mask);
- memsetcol(rop);
- }
+ byte right_mask;
+
+ if (bit) {
+ out_g_mask(0xff >> bit);
+ memsetcol(rop);
+ rop->dest++;
+ w += bit - 8;
+ }
+ if (w >= 8) {
+ out_g_mask(0xff); /* all bits */
+ rop->width = w >> 3;
+ memsetrect(rop);
+ rop->dest += rop->width;
+ w &= 7;
+ }
+ if ((right_mask = rmask_tab[w]) != 0) {
+ out_g_mask(right_mask);
+ memsetcol(rop);
+ }
}
set_g_const_map(0);
}
@@ -857,50 +857,50 @@ fill_row_only(byte * dest, int bit, int w, int color)
/* rop: dest */
{
if (bit + w <= 8) { /* Less than one byte. */
- /* Optimize filling with black or white. */
- switch (color) {
- case 0:
- set_g_mask(rmask_tab[w] >> bit);
- *dest &= color; /* read, then write 0s; */
- /* some compilers optimize &= 0 to a store. */
- out_g_mask(0xff); /* dot_end */
- break;
- case 0xf:
- set_g_mask(rmask_tab[w] >> bit);
- *dest |= 0xff; /* read, then write 1s; */
- /* some compilers optimize &= 0 to a store. */
- out_g_mask(0xff); /* dot_end */
- break;
- default:
- set_g_const(color);
- set_g_const_map(0xf);
- set_g_mask(rmask_tab[w] >> bit);
- r_m_w(dest);
- out_g_mask(0xff); /* dot_end */
- set_g_const_map(0);
- }
+ /* Optimize filling with black or white. */
+ switch (color) {
+ case 0:
+ set_g_mask(rmask_tab[w] >> bit);
+ *dest &= color; /* read, then write 0s; */
+ /* some compilers optimize &= 0 to a store. */
+ out_g_mask(0xff); /* dot_end */
+ break;
+ case 0xf:
+ set_g_mask(rmask_tab[w] >> bit);
+ *dest |= 0xff; /* read, then write 1s; */
+ /* some compilers optimize &= 0 to a store. */
+ out_g_mask(0xff); /* dot_end */
+ break;
+ default:
+ set_g_const(color);
+ set_g_const_map(0xf);
+ set_g_mask(rmask_tab[w] >> bit);
+ r_m_w(dest);
+ out_g_mask(0xff); /* dot_end */
+ set_g_const_map(0);
+ }
} else {
- byte right_mask;
- int byte_count;
-
- set_g_const(color);
- set_g_const_map(0xf);
- select_g_mask();
- if (bit) {
- out_g_mask(0xff >> bit);
- r_m_w(dest);
- dest++;
- w += bit - 8;
- }
- byte_count = w >> 3;
- if ((right_mask = rmask_tab[w & 7]) != 0) {
- out_g_mask(right_mask);
- r_m_w(dest + byte_count);
- }
- out_g_mask(0xff);
- if (byte_count) {
- memset(dest, 0, byte_count); /* data irrelevant */
- }
- set_g_const_map(0);
+ byte right_mask;
+ int byte_count;
+
+ set_g_const(color);
+ set_g_const_map(0xf);
+ select_g_mask();
+ if (bit) {
+ out_g_mask(0xff >> bit);
+ r_m_w(dest);
+ dest++;
+ w += bit - 8;
+ }
+ byte_count = w >> 3;
+ if ((right_mask = rmask_tab[w & 7]) != 0) {
+ out_g_mask(right_mask);
+ r_m_w(dest + byte_count);
+ }
+ out_g_mask(0xff);
+ if (byte_count) {
+ memset(dest, 0, byte_count); /* data irrelevant */
+ }
+ set_g_const_map(0);
}
}
diff --git a/gs/base/gdevpcfb.h b/gs/base/gdevpcfb.h
index d8f811854..00ad46945 100644
--- a/gs/base/gdevpcfb.h
+++ b/gs/base/gdevpcfb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@ typedef union REGS registers;
/* Procedures */
- /* See gxdevice.h for the definitions of the procedures. */
+ /* See gxdevice.h for the definitions of the procedures. */
dev_proc_open_device(ega_open);
dev_proc_close_device(ega_close);
@@ -84,7 +84,7 @@ struct gx_device_ega_s {
(fb_dev->fb_byte_mult == 0 ?\
(fb_ptr)MK_PTR(regen + (y) * (fb_dev->fb_seg_mult), (x) >> 3) :\
(fb_ptr)MK_PTR(regen + ((y) >> 4) * (fb_dev->fb_seg_mult),\
- (((y) & 15) * fb_dev->fb_byte_mult) + ((x) >> 3)))
+ (((y) & 15) * fb_dev->fb_byte_mult) + ((x) >> 3)))
int video_mode;
};
@@ -94,21 +94,21 @@ struct gx_device_ega_s {
/* This may or may not be what is desired! */
#define ega_device(dev_name, procs, fb_raster, screen_height, aspect_ratio, video_mode)\
{ std_device_dci_body(gx_device_ega, &procs, dev_name,\
- fb_raster * 8, screen_height,\
- (screen_height * (aspect_ratio)) / PAGE_HEIGHT_INCHES, /* x dpi */\
- screen_height / PAGE_HEIGHT_INCHES, /* y dpi */\
- (rgb_max ? 3 : 1), /* num_components */\
- 4, /* depth */\
- (rgb_max ? rgb_max : 1), /* max_gray */\
- rgb_max,\
- (rgb_max ? rgb_max + 1 : 2), /* dither_grays */\
- (rgb_max ? rgb_max + 1 : 0) /* dither_colors */\
- ),\
- { 0 }, /* std_procs */\
- fb_raster,\
- (fb_raster & 15 ? fb_raster : fb_raster >> 4),\
- (fb_raster & 15 ? fb_raster : 0),\
- video_mode\
+ fb_raster * 8, screen_height,\
+ (screen_height * (aspect_ratio)) / PAGE_HEIGHT_INCHES, /* x dpi */\
+ screen_height / PAGE_HEIGHT_INCHES, /* y dpi */\
+ (rgb_max ? 3 : 1), /* num_components */\
+ 4, /* depth */\
+ (rgb_max ? rgb_max : 1), /* max_gray */\
+ rgb_max,\
+ (rgb_max ? rgb_max + 1 : 2), /* dither_grays */\
+ (rgb_max ? rgb_max + 1 : 0) /* dither_colors */\
+ ),\
+ { 0 }, /* std_procs */\
+ fb_raster,\
+ (fb_raster & 15 ? fb_raster : fb_raster >> 4),\
+ (fb_raster & 15 ? fb_raster : 0),\
+ video_mode\
}
/* Define the device port and register numbers, and the regen map base */
@@ -143,28 +143,28 @@ struct gx_device_ega_s {
#if defined(M_UNIX) || defined(M_XENIX) || defined(UNIX) || defined(SYSV) || defined(__linux__)
- /* SCO Unix/Xenix, AT&T SVR4, or Linux. */
+ /* SCO Unix/Xenix, AT&T SVR4, or Linux. */
#undef outportb
#if defined(__GNUC__)
- /* Inline assembly version for gcc */
- /* Under SCO, requires installing the gnu assembler as "as" */
-static inline void
+ /* Inline assembly version for gcc */
+ /* Under SCO, requires installing the gnu assembler as "as" */
+static inline void
outportb(int port, int data)
{
__asm__ volatile ("outb %0,%1"::
- "a" ((unsigned char)data),
- "d" ((unsigned short)port));
+ "a" ((unsigned char)data),
+ "d" ((unsigned short)port));
}
-static inline void
+static inline void
outport2(int port, int index, int data)
{
__asm__ volatile ("movb %0,%%ah; movb %1,%%al; outw %%ax,%2"::
- "qmi" ((unsigned char)data),
- "qmi" ((unsigned char)index),
- "d" ((unsigned short)port):
- "eax");
+ "qmi" ((unsigned char)data),
+ "qmi" ((unsigned char)index),
+ "d" ((unsigned short)port):
+ "eax");
}
#else
void outportb(uint, byte);
@@ -181,7 +181,7 @@ extern fb_ptr fb_addr;
#else
- /* MS-DOS */
+ /* MS-DOS */
/* outportb is defined in dos_.h */
#define outport2(port, index, data)\
diff --git a/gs/base/gdevpcl.c b/gs/base/gdevpcl.c
index b74addfe6..fb06fc41e 100644
--- a/gs/base/gdevpcl.c
+++ b/gs/base/gdevpcl.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,10 +52,10 @@ gdev_pcl_paper_size(gx_device * dev)
new_width_difference = w - width_inches; \
new_height_difference = h - height_inches; \
if ((new_width_difference > -0.01) && (new_height_difference > -0.01) && \
- ((width_difference == -1.0) || \
- (new_width_difference < width_difference) || \
- ((new_width_difference == width_difference) && \
- (new_height_difference < height_difference)))) { \
+ ((width_difference == -1.0) || \
+ (new_width_difference < width_difference) || \
+ ((new_width_difference == width_difference) && \
+ (new_height_difference < height_difference)))) { \
width_difference = new_width_difference; \
height_difference = new_height_difference; \
code = c; \
@@ -106,7 +106,7 @@ gdev_pcl_3bit_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Map the printer color back to RGB. */
int
gdev_pcl_3bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
ushort cc = (ushort) color ^ 7;
@@ -132,107 +132,107 @@ gdev_pcl_3bit_map_color_rgb(gx_device * dev, gx_color_index color,
*/
int
gdev_pcl_mode2compress_padded(const word * row, const word * end_row,
- byte * compressed, bool pad)
+ byte * compressed, bool pad)
{
register const word *exam = row; /* word being examined in the row to compress */
register byte *cptr = compressed; /* output pointer into compressed bytes */
while (exam < end_row) { /* Search ahead in the input looking for a run */
- /* of at least 4 identical bytes. */
- const byte *compr = (const byte *)exam;
- const byte *end_dis;
- const word *next;
- register word test = *exam;
-
- while (((test << 8) ^ test) > 0xff) {
- if (++exam >= end_row)
- break;
- test = *exam;
- }
-
- /* Find out how long the run is */
- end_dis = (const byte *)exam;
- if (exam == end_row) { /* no run */
- /* See if any of the last 3 "dissimilar" bytes are 0. */
- if (!pad && end_dis > compr && end_dis[-1] == 0) {
- if (end_dis[-2] != 0)
- end_dis--;
- else if (end_dis[-3] != 0)
- end_dis -= 2;
- else
- end_dis -= 3;
- }
- next = --end_row;
- } else {
- next = exam + 1;
- while (next < end_row && *next == test)
- next++;
- /* See if any of the last 3 "dissimilar" bytes */
- /* are the same as the repeated byte. */
- if (end_dis > compr && end_dis[-1] == (byte) test) {
- if (end_dis[-2] != (byte) test)
- end_dis--;
- else if (end_dis[-3] != (byte) test)
- end_dis -= 2;
- else
- end_dis -= 3;
- }
- }
-
- /* Now [compr..end_dis) should be encoded as dissimilar, */
- /* and [end_dis..next) should be encoded as similar. */
- /* Note that either of these ranges may be empty. */
-
- for (;;) { /* Encode up to 127 dissimilar bytes */
- uint count = end_dis - compr; /* uint for faster switch */
-
- switch (count) { /* Use memcpy only if it's worthwhile. */
- case 6:
- cptr[6] = compr[5];
- case 5:
- cptr[5] = compr[4];
- case 4:
- cptr[4] = compr[3];
- case 3:
- cptr[3] = compr[2];
- case 2:
- cptr[2] = compr[1];
- case 1:
- cptr[1] = compr[0];
- *cptr = count - 1;
- cptr += count + 1;
- case 0: /* all done */
- break;
- default:
- if (count > 127)
- count = 127;
- *cptr++ = count - 1;
- memcpy(cptr, compr, count);
- cptr += count, compr += count;
- continue;
- }
- break;
- }
-
- { /* Encode up to 127 similar bytes. */
- /* Note that count may be <0 at end of row. */
- int count = (const byte *)next - end_dis;
-
- while (count > 0) {
- int this = (count > 127 ? 127 : count);
-
- *cptr++ = 257 - this;
- *cptr++ = (byte) test;
- count -= this;
- }
- exam = next;
- }
+ /* of at least 4 identical bytes. */
+ const byte *compr = (const byte *)exam;
+ const byte *end_dis;
+ const word *next;
+ register word test = *exam;
+
+ while (((test << 8) ^ test) > 0xff) {
+ if (++exam >= end_row)
+ break;
+ test = *exam;
+ }
+
+ /* Find out how long the run is */
+ end_dis = (const byte *)exam;
+ if (exam == end_row) { /* no run */
+ /* See if any of the last 3 "dissimilar" bytes are 0. */
+ if (!pad && end_dis > compr && end_dis[-1] == 0) {
+ if (end_dis[-2] != 0)
+ end_dis--;
+ else if (end_dis[-3] != 0)
+ end_dis -= 2;
+ else
+ end_dis -= 3;
+ }
+ next = --end_row;
+ } else {
+ next = exam + 1;
+ while (next < end_row && *next == test)
+ next++;
+ /* See if any of the last 3 "dissimilar" bytes */
+ /* are the same as the repeated byte. */
+ if (end_dis > compr && end_dis[-1] == (byte) test) {
+ if (end_dis[-2] != (byte) test)
+ end_dis--;
+ else if (end_dis[-3] != (byte) test)
+ end_dis -= 2;
+ else
+ end_dis -= 3;
+ }
+ }
+
+ /* Now [compr..end_dis) should be encoded as dissimilar, */
+ /* and [end_dis..next) should be encoded as similar. */
+ /* Note that either of these ranges may be empty. */
+
+ for (;;) { /* Encode up to 127 dissimilar bytes */
+ uint count = end_dis - compr; /* uint for faster switch */
+
+ switch (count) { /* Use memcpy only if it's worthwhile. */
+ case 6:
+ cptr[6] = compr[5];
+ case 5:
+ cptr[5] = compr[4];
+ case 4:
+ cptr[4] = compr[3];
+ case 3:
+ cptr[3] = compr[2];
+ case 2:
+ cptr[2] = compr[1];
+ case 1:
+ cptr[1] = compr[0];
+ *cptr = count - 1;
+ cptr += count + 1;
+ case 0: /* all done */
+ break;
+ default:
+ if (count > 127)
+ count = 127;
+ *cptr++ = count - 1;
+ memcpy(cptr, compr, count);
+ cptr += count, compr += count;
+ continue;
+ }
+ break;
+ }
+
+ { /* Encode up to 127 similar bytes. */
+ /* Note that count may be <0 at end of row. */
+ int count = (const byte *)next - end_dis;
+
+ while (count > 0) {
+ int this = (count > 127 ? 127 : count);
+
+ *cptr++ = 257 - this;
+ *cptr++ = (byte) test;
+ count -= this;
+ }
+ exam = next;
+ }
}
return (cptr - compressed);
}
int
gdev_pcl_mode2compress(const word * row, const word * end_row,
- byte * compressed)
+ byte * compressed)
{
return gdev_pcl_mode2compress_padded(row, end_row, compressed, false);
}
@@ -253,41 +253,41 @@ gdev_pcl_mode3compress(int bytecount, const byte * current, byte * previous, byt
const byte *end = current + bytecount;
while (cur < end) { /* Detect a maximum run of unchanged bytes. */
- const byte *run = cur;
- register const byte *diff;
- const byte *stop;
- int offset, cbyte;
-
- while (cur < end && *cur == *prev) {
- cur++, prev++;
- }
- if (cur == end)
- break; /* rest of row is unchanged */
- /* Detect a run of up to 8 changed bytes. */
- /* We know that *cur != *prev. */
- diff = cur;
- stop = (end - cur > 8 ? cur + 8 : end);
- do {
- *prev++ = *cur++;
- }
- while (cur < stop && *cur != *prev);
- /* Now [run..diff) are unchanged, and */
- /* [diff..cur) are changed. */
- /* Generate the command byte(s). */
- offset = diff - run;
- cbyte = (cur - diff - 1) << 5;
- if (offset < 31)
- *out++ = cbyte + offset;
- else {
- *out++ = cbyte + 31;
- offset -= 31;
- while (offset >= 255)
- *out++ = 255, offset -= 255;
- *out++ = offset;
- }
- /* Copy the changed data. */
- while (diff < cur)
- *out++ = *diff++;
+ const byte *run = cur;
+ register const byte *diff;
+ const byte *stop;
+ int offset, cbyte;
+
+ while (cur < end && *cur == *prev) {
+ cur++, prev++;
+ }
+ if (cur == end)
+ break; /* rest of row is unchanged */
+ /* Detect a run of up to 8 changed bytes. */
+ /* We know that *cur != *prev. */
+ diff = cur;
+ stop = (end - cur > 8 ? cur + 8 : end);
+ do {
+ *prev++ = *cur++;
+ }
+ while (cur < stop && *cur != *prev);
+ /* Now [run..diff) are unchanged, and */
+ /* [diff..cur) are changed. */
+ /* Generate the command byte(s). */
+ offset = diff - run;
+ cbyte = (cur - diff - 1) << 5;
+ if (offset < 31)
+ *out++ = cbyte + offset;
+ else {
+ *out++ = cbyte + 31;
+ offset -= 31;
+ while (offset >= 255)
+ *out++ = 255, offset -= 255;
+ *out++ = offset;
+ }
+ /* Copy the changed data. */
+ while (diff < cur)
+ *out++ = *diff++;
}
return out - compressed;
}
@@ -301,7 +301,7 @@ gdev_pcl_mode3compress(int bytecount, const byte * current, byte * previous, byt
*/
int
gdev_pcl_mode9compress(int bytecount, const byte *current,
- const byte *previous, byte *compressed)
+ const byte *previous, byte *compressed)
{
register const byte *cur = current;
register const byte *prev = previous;
@@ -309,120 +309,120 @@ gdev_pcl_mode9compress(int bytecount, const byte *current,
const byte *end = current + bytecount;
while (cur < end) { /* Detect a run of unchanged bytes. */
- const byte *run = cur;
- register const byte *diff;
- int offset;
-
- while (cur < end && *cur == *prev) {
- cur++, prev++;
- }
- if (cur == end)
- break; /* rest of row is unchanged */
- /* Detect a run of changed bytes. */
- /* We know that *cur != *prev. */
- diff = cur;
- do {
- prev++;
- cur++;
- }
- while (cur < end && *cur != *prev);
- /* Now [run..diff) are unchanged, and */
- /* [diff..cur) are changed. */
- offset = diff - run;
- {
- const byte *stop_test = cur - 4;
- int dissimilar, similar;
-
- while (diff < cur) {
- const byte *compr = diff;
- const byte *next; /* end of run */
- byte value = 0;
-
- while (diff <= stop_test &&
- ((value = *diff) != diff[1] ||
- value != diff[2] ||
- value != diff[3]))
- diff++;
-
- /* Find out how long the run is */
- if (diff > stop_test) /* no run */
- next = diff = cur;
- else {
- next = diff + 4;
- while (next < cur && *next == value)
- next++;
- }
+ const byte *run = cur;
+ register const byte *diff;
+ int offset;
+
+ while (cur < end && *cur == *prev) {
+ cur++, prev++;
+ }
+ if (cur == end)
+ break; /* rest of row is unchanged */
+ /* Detect a run of changed bytes. */
+ /* We know that *cur != *prev. */
+ diff = cur;
+ do {
+ prev++;
+ cur++;
+ }
+ while (cur < end && *cur != *prev);
+ /* Now [run..diff) are unchanged, and */
+ /* [diff..cur) are changed. */
+ offset = diff - run;
+ {
+ const byte *stop_test = cur - 4;
+ int dissimilar, similar;
+
+ while (diff < cur) {
+ const byte *compr = diff;
+ const byte *next; /* end of run */
+ byte value = 0;
+
+ while (diff <= stop_test &&
+ ((value = *diff) != diff[1] ||
+ value != diff[2] ||
+ value != diff[3]))
+ diff++;
+
+ /* Find out how long the run is */
+ if (diff > stop_test) /* no run */
+ next = diff = cur;
+ else {
+ next = diff + 4;
+ while (next < cur && *next == value)
+ next++;
+ }
#define MAXOFFSETU 15
#define MAXCOUNTU 7
- /* output 'dissimilar' bytes, uncompressed */
- if ((dissimilar = diff - compr)) {
- int temp, i;
-
- if ((temp = --dissimilar) > MAXCOUNTU)
- temp = MAXCOUNTU;
- if (offset < MAXOFFSETU)
- *out++ = (offset << 3) | (byte) temp;
- else {
- *out++ = (MAXOFFSETU << 3) | (byte) temp;
- offset -= MAXOFFSETU;
- while (offset >= 255) {
- *out++ = 255;
- offset -= 255;
- }
- *out++ = offset;
- }
- if (temp == MAXCOUNTU) {
- temp = dissimilar - MAXCOUNTU;
- while (temp >= 255) {
- *out++ = 255;
- temp -= 255;
- }
- *out++ = (byte) temp;
- }
- for (i = 0; i <= dissimilar; i++)
- *out++ = *compr++;
- offset = 0;
- } /* end uncompressed */
+ /* output 'dissimilar' bytes, uncompressed */
+ if ((dissimilar = diff - compr)) {
+ int temp, i;
+
+ if ((temp = --dissimilar) > MAXCOUNTU)
+ temp = MAXCOUNTU;
+ if (offset < MAXOFFSETU)
+ *out++ = (offset << 3) | (byte) temp;
+ else {
+ *out++ = (MAXOFFSETU << 3) | (byte) temp;
+ offset -= MAXOFFSETU;
+ while (offset >= 255) {
+ *out++ = 255;
+ offset -= 255;
+ }
+ *out++ = offset;
+ }
+ if (temp == MAXCOUNTU) {
+ temp = dissimilar - MAXCOUNTU;
+ while (temp >= 255) {
+ *out++ = 255;
+ temp -= 255;
+ }
+ *out++ = (byte) temp;
+ }
+ for (i = 0; i <= dissimilar; i++)
+ *out++ = *compr++;
+ offset = 0;
+ } /* end uncompressed */
#undef MAXOFFSETU
#undef MAXCOUNTU
#define MAXOFFSETC 3
#define MAXCOUNTC 31
- /* output 'similar' bytes, run-length encoded */
- if ((similar = next - diff)) {
- int temp;
-
- if ((temp = (similar -= 2)) > MAXCOUNTC)
- temp = MAXCOUNTC;
- if (offset < MAXOFFSETC)
- *out++ = 0x80 | (offset << 5) | (byte) temp;
- else {
- *out++ = 0x80 | (MAXOFFSETC << 5) | (byte) temp;
- offset -= MAXOFFSETC;
- while (offset >= 255) {
- *out++ = 255;
- offset -= 255;
- }
- *out++ = offset;
- }
- if (temp == MAXCOUNTC) {
- temp = similar - MAXCOUNTC;
- while (temp >= 255) {
- *out++ = 255;
- temp -= 255;
- }
- *out++ = (byte) temp;
- }
- *out++ = value;
- offset = 0;
- } /* end compressed */
+ /* output 'similar' bytes, run-length encoded */
+ if ((similar = next - diff)) {
+ int temp;
+
+ if ((temp = (similar -= 2)) > MAXCOUNTC)
+ temp = MAXCOUNTC;
+ if (offset < MAXOFFSETC)
+ *out++ = 0x80 | (offset << 5) | (byte) temp;
+ else {
+ *out++ = 0x80 | (MAXOFFSETC << 5) | (byte) temp;
+ offset -= MAXOFFSETC;
+ while (offset >= 255) {
+ *out++ = 255;
+ offset -= 255;
+ }
+ *out++ = offset;
+ }
+ if (temp == MAXCOUNTC) {
+ temp = similar - MAXCOUNTC;
+ while (temp >= 255) {
+ *out++ = 255;
+ temp -= 255;
+ }
+ *out++ = (byte) temp;
+ }
+ *out++ = value;
+ offset = 0;
+ } /* end compressed */
#undef MAXOFFSETC
#undef MAXCOUNTC
- diff = next;
- }
- }
+ diff = next;
+ }
+ }
}
return out - compressed;
}
diff --git a/gs/base/gdevpcl.h b/gs/base/gdevpcl.h
index 79886d248..91e873e7c 100644
--- a/gs/base/gdevpcl.h
+++ b/gs/base/gdevpcl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpcx.c b/gs/base/gdevpcx.c
index 944de4620..b2b38d7d7 100644
--- a/gs/base/gdevpcx.c
+++ b/gs/base/gdevpcx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,13 +35,13 @@ static dev_proc_print_page(pcxmono_print_page);
/* Use the default RGB->color map, so we get black=0, white=1. */
static const gx_device_procs pcxmono_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_map_rgb_color, gx_default_map_color_rgb);
+ gx_default_map_rgb_color, gx_default_map_color_rgb);
const gx_device_printer gs_pcxmono_device =
prn_device(pcxmono_procs, "pcxmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, pcxmono_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, pcxmono_print_page);
/* Chunky 8-bit gray scale. */
@@ -49,13 +49,13 @@ static dev_proc_print_page(pcx256_print_page);
static const gx_device_procs pcxgray_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
const gx_device_printer gs_pcxgray_device =
{prn_device_body(gx_device_printer, pcxgray_procs, "pcxgray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, 8, 255, 255, 256, 256, pcx256_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, 8, 255, 255, 256, 256, pcx256_print_page)
};
/* 4-bit planar (EGA/VGA-style) color. */
@@ -64,13 +64,13 @@ static dev_proc_print_page(pcx16_print_page);
static const gx_device_procs pcx16_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
+ pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
const gx_device_printer gs_pcx16_device =
{prn_device_body(gx_device_printer, pcx16_procs, "pcx16",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 4, 1, 1, 2, 2, pcx16_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 4, 1, 1, 2, 2, pcx16_print_page)
};
/* Chunky 8-bit (SuperVGA-style) color. */
@@ -78,13 +78,13 @@ const gx_device_printer gs_pcx16_device =
static const gx_device_procs pcx256_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
+ pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
const gx_device_printer gs_pcx256_device =
{prn_device_body(gx_device_printer, pcx256_procs, "pcx256",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 8, 5, 5, 6, 6, pcx256_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 8, 5, 5, 6, 6, pcx256_print_page)
};
/* 24-bit color, 3 8-bit planes. */
@@ -93,13 +93,13 @@ static dev_proc_print_page(pcx24b_print_page);
static const gx_device_procs pcx24b_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
const gx_device_printer gs_pcx24b_device =
prn_device(pcx24b_procs, "pcx24b",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 24, pcx24b_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 24, pcx24b_print_page);
/* 4-bit chunky CMYK color. */
@@ -130,10 +130,10 @@ static const gx_device_procs pcxcmyk_procs =
};
const gx_device_printer gs_pcxcmyk_device =
{prn_device_body(gx_device_printer, pcxcmyk_procs, "pcxcmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 4, 4, 1, 1, 2, 2, pcxcmyk_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 4, 4, 1, 1, 2, 2, pcxcmyk_print_page)
};
/* ------ Private definitions ------ */
@@ -245,7 +245,7 @@ pcx16_print_page(gx_device_printer * pdev, FILE * file)
header.nplanes = 4;
/* Fill the EGA palette appropriately. */
memcpy((byte *) header.palette, pcx_ega_palette,
- sizeof(pcx_ega_palette));
+ sizeof(pcx_ega_palette));
return pcx_write_page(pdev, file, &header, true);
}
@@ -261,12 +261,12 @@ pcx256_print_page(gx_device_printer * pdev, FILE * file)
header.bpp = 8;
header.nplanes = 1;
assign_ushort(header.palinfo,
- (pdev->color_info.num_components > 1 ?
- palinfo_color : palinfo_gray));
+ (pdev->color_info.num_components > 1 ?
+ palinfo_color : palinfo_gray));
code = pcx_write_page(pdev, file, &header, false);
if (code >= 0) { /* Write out the palette. */
- fputc(0x0c, file);
- code = pc_write_palette((gx_device *) pdev, 256, file);
+ fputc(0x0c, file);
+ code = pc_write_palette((gx_device *) pdev, 256, file);
}
return code;
}
@@ -304,7 +304,7 @@ pcxcmyk_print_page(gx_device_printer * pdev, FILE * file)
header.nplanes = 1;
/* Fill the palette appropriately. */
memcpy((byte *) header.palette, pcx_cmyk_palette,
- sizeof(pcx_cmyk_palette));
+ sizeof(pcx_cmyk_palette));
return pcx_write_page(pdev, file, &header, false);
}
@@ -313,7 +313,7 @@ pcxcmyk_print_page(gx_device_printer * pdev, FILE * file)
/* The caller has set header->bpp, nplanes, and palette. */
static int
pcx_write_page(gx_device_printer * pdev, FILE * file, pcx_header * phdr,
- bool planar)
+ bool planar)
{
int raster = gdev_prn_raster(pdev);
uint rsize = ROUND_UP((pdev->width * phdr->bpp + 7) >> 3, 2); /* PCX format requires even */
@@ -326,7 +326,7 @@ pcx_write_page(gx_device_printer * pdev, FILE * file, pcx_header * phdr,
int code = 0; /* return code */
if (line == 0) /* can't allocate line buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Fill in the other variable entries in the header struct. */
@@ -335,80 +335,80 @@ pcx_write_page(gx_device_printer * pdev, FILE * file, pcx_header * phdr,
assign_ushort(phdr->hres, (int)pdev->x_pixels_per_inch);
assign_ushort(phdr->vres, (int)pdev->y_pixels_per_inch);
assign_ushort(phdr->bpl, (planar || depth == 1 ? rsize :
- raster + (raster & 1)));
+ raster + (raster & 1)));
/* Write the header. */
if (fwrite((const char *)phdr, 1, 128, file) < 128) {
- code = gs_error_ioerror;
- goto pcx_done;
+ code = gs_error_ioerror;
+ goto pcx_done;
}
/* Write the contents of the image. */
for (y = 0; y < height; y++) {
- byte *row;
- byte *end;
-
- code = gdev_prn_get_bits(pdev, y, line, &row);
- if (code < 0)
- break;
- end = row + raster;
- if (!planar) { /* Just write the bits. */
- if (raster & 1) { /* Round to even, with predictable padding. */
- *end = end[-1];
- ++end;
- }
- pcx_write_rle(row, end, 1, file);
- } else
- switch (depth) {
-
- case 4:
- {
- byte *pend = plane + rsize;
- int shift;
-
- for (shift = 0; shift < 4; shift++) {
- register byte *from, *to;
- register int bright = 1 << shift;
- register int bleft = bright << 4;
-
- for (from = row, to = plane;
- from < end; from += 4
- ) {
- *to++ =
- (from[0] & bleft ? 0x80 : 0) |
- (from[0] & bright ? 0x40 : 0) |
- (from[1] & bleft ? 0x20 : 0) |
- (from[1] & bright ? 0x10 : 0) |
- (from[2] & bleft ? 0x08 : 0) |
- (from[2] & bright ? 0x04 : 0) |
- (from[3] & bleft ? 0x02 : 0) |
- (from[3] & bright ? 0x01 : 0);
- }
- /* We might be one byte short of rsize. */
- if (to < pend)
- *to = to[-1];
- pcx_write_rle(plane, pend, 1, file);
- }
- }
- break;
-
- case 24:
- {
- int pnum;
-
- for (pnum = 0; pnum < 3; ++pnum) {
- pcx_write_rle(row + pnum, row + raster, 3, file);
- if (pdev->width & 1)
- fputc(0, file); /* pad to even */
- }
- }
- break;
-
- default:
- code = gs_note_error(gs_error_rangecheck);
- goto pcx_done;
-
- }
+ byte *row;
+ byte *end;
+
+ code = gdev_prn_get_bits(pdev, y, line, &row);
+ if (code < 0)
+ break;
+ end = row + raster;
+ if (!planar) { /* Just write the bits. */
+ if (raster & 1) { /* Round to even, with predictable padding. */
+ *end = end[-1];
+ ++end;
+ }
+ pcx_write_rle(row, end, 1, file);
+ } else
+ switch (depth) {
+
+ case 4:
+ {
+ byte *pend = plane + rsize;
+ int shift;
+
+ for (shift = 0; shift < 4; shift++) {
+ register byte *from, *to;
+ register int bright = 1 << shift;
+ register int bleft = bright << 4;
+
+ for (from = row, to = plane;
+ from < end; from += 4
+ ) {
+ *to++ =
+ (from[0] & bleft ? 0x80 : 0) |
+ (from[0] & bright ? 0x40 : 0) |
+ (from[1] & bleft ? 0x20 : 0) |
+ (from[1] & bright ? 0x10 : 0) |
+ (from[2] & bleft ? 0x08 : 0) |
+ (from[2] & bright ? 0x04 : 0) |
+ (from[3] & bleft ? 0x02 : 0) |
+ (from[3] & bright ? 0x01 : 0);
+ }
+ /* We might be one byte short of rsize. */
+ if (to < pend)
+ *to = to[-1];
+ pcx_write_rle(plane, pend, 1, file);
+ }
+ }
+ break;
+
+ case 24:
+ {
+ int pnum;
+
+ for (pnum = 0; pnum < 3; ++pnum) {
+ pcx_write_rle(row + pnum, row + raster, 3, file);
+ if (pdev->width & 1)
+ fputc(0, file); /* pad to even */
+ }
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_rangecheck);
+ goto pcx_done;
+
+ }
}
pcx_done:
@@ -423,35 +423,35 @@ pcx_write_page(gx_device_printer * pdev, FILE * file, pcx_header * phdr,
static void
pcx_write_rle(const byte * from, const byte * end, int step, FILE * file)
{ /*
- * The PCX format theoretically allows encoding runs of 63
- * identical bytes, but some readers can't handle repetition
- * counts greater than 15.
- */
+ * The PCX format theoretically allows encoding runs of 63
+ * identical bytes, but some readers can't handle repetition
+ * counts greater than 15.
+ */
#define MAX_RUN_COUNT 15
int max_run = step * MAX_RUN_COUNT;
while (from < end) {
- byte data = *from;
-
- from += step;
- if (data != *from || from == end) {
- if (data >= 0xc0)
- putc(0xc1, file);
- } else {
- const byte *start = from;
-
- while ((from < end) && (*from == data))
- from += step;
- /* Now (from - start) / step + 1 is the run length. */
- while (from - start >= max_run) {
- putc(0xc0 + MAX_RUN_COUNT, file);
- putc(data, file);
- start += max_run;
- }
- if (from > start || data >= 0xc0)
- putc((from - start) / step + 0xc1, file);
- }
- putc(data, file);
+ byte data = *from;
+
+ from += step;
+ if (data != *from || from == end) {
+ if (data >= 0xc0)
+ putc(0xc1, file);
+ } else {
+ const byte *start = from;
+
+ while ((from < end) && (*from == data))
+ from += step;
+ /* Now (from - start) / step + 1 is the run length. */
+ while (from - start >= max_run) {
+ putc(0xc0 + MAX_RUN_COUNT, file);
+ putc(data, file);
+ start += max_run;
+ }
+ if (from > start || data >= 0xc0)
+ putc((from - start) / step + 0xc1, file);
+ }
+ putc(data, file);
}
#undef MAX_RUN_COUNT
}
diff --git a/gs/base/gdevpdf.c b/gs/base/gdevpdf.c
index 1d026b22a..120fcbba4 100644
--- a/gs/base/gdevpdf.c
+++ b/gs/base/gdevpdf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,25 +39,25 @@
/* GC descriptors */
private_st_pdf_page();
gs_private_st_element(st_pdf_page_element, pdf_page_t, "pdf_page_t[]",
- pdf_page_elt_enum_ptrs, pdf_page_elt_reloc_ptrs,
- st_pdf_page);
+ pdf_page_elt_enum_ptrs, pdf_page_elt_reloc_ptrs,
+ st_pdf_page);
private_st_device_pdfwrite();
private_st_pdf_substream_save();
private_st_pdf_substream_save_element();
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(device_pdfwrite_enum_ptrs, gx_device_pdf *pdev)
{
index -= gx_device_pdf_num_ptrs + gx_device_pdf_num_param_strings;
if (index < NUM_RESOURCE_TYPES * NUM_RESOURCE_CHAINS)
- ENUM_RETURN(pdev->resources[index / NUM_RESOURCE_CHAINS].chains[index % NUM_RESOURCE_CHAINS]);
+ ENUM_RETURN(pdev->resources[index / NUM_RESOURCE_CHAINS].chains[index % NUM_RESOURCE_CHAINS]);
index -= NUM_RESOURCE_TYPES * NUM_RESOURCE_CHAINS;
if (index <= pdev->outline_depth)
- ENUM_RETURN(pdev->outline_levels[index].first.action);
+ ENUM_RETURN(pdev->outline_levels[index].first.action);
index -= pdev->outline_depth + 1;
if (index <= pdev->outline_depth)
- ENUM_RETURN(pdev->outline_levels[index].last.action);
+ ENUM_RETURN(pdev->outline_levels[index].last.action);
index -= pdev->outline_depth + 1;
ENUM_PREFIX(st_device_psdf, 0);
}
@@ -68,7 +68,7 @@ gx_device_pdf_do_ptrs(e1)
gx_device_pdf_do_param_strings(e1)
#undef e1
#define e1(i,elt) ENUM_STRING_PTR(i + gx_device_pdf_num_ptrs + gx_device_pdf_num_param_strings,\
- gx_device_pdf, elt);
+ gx_device_pdf, elt);
gx_device_pdf_do_const_strings(e1)
#undef e1
ENUM_PTRS_END
@@ -79,21 +79,21 @@ static RELOC_PTRS_WITH(device_pdfwrite_reloc_ptrs, gx_device_pdf *pdev)
gx_device_pdf_do_ptrs(r1)
#undef r1
#define r1(i,elt) RELOC_PARAM_STRING_PTR(gx_device_pdf,elt);
- gx_device_pdf_do_param_strings(r1)
+ gx_device_pdf_do_param_strings(r1)
#undef r1
#define r1(i,elt) RELOC_CONST_STRING_PTR(gx_device_pdf,elt);
- gx_device_pdf_do_const_strings(r1)
+ gx_device_pdf_do_const_strings(r1)
#undef r1
{
- int i, j;
-
- for (i = 0; i < NUM_RESOURCE_TYPES; ++i)
- for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
- RELOC_PTR(gx_device_pdf, resources[i].chains[j]);
- for (i = 0; i <= pdev->outline_depth; ++i) {
- RELOC_PTR(gx_device_pdf, outline_levels[i].first.action);
- RELOC_PTR(gx_device_pdf, outline_levels[i].last.action);
- }
+ int i, j;
+
+ for (i = 0; i < NUM_RESOURCE_TYPES; ++i)
+ for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
+ RELOC_PTR(gx_device_pdf, resources[i].chains[j]);
+ for (i = 0; i <= pdev->outline_depth; ++i) {
+ RELOC_PTR(gx_device_pdf, outline_levels[i].first.action);
+ RELOC_PTR(gx_device_pdf, outline_levels[i].last.action);
+ }
}
}
RELOC_PTRS_END
@@ -159,27 +159,27 @@ pdf_close_temp_file(gx_device_pdf *pdev, pdf_temp_file_t *ptf, int code)
* might not be open if it was finalized before the device was closed.
*/
if (ptf->strm) {
- if (s_is_valid(ptf->strm)) {
- sflush(ptf->strm);
- /* Prevent freeing the stream from closing the file. */
- ptf->strm->file = 0;
- } else
- ptf->file = file = 0; /* file was closed by finalization */
- gs_free_object(pdev->pdf_memory, ptf->strm_buf,
- "pdf_close_temp_file(strm_buf)");
- ptf->strm_buf = 0;
- gs_free_object(pdev->pdf_memory, ptf->strm,
- "pdf_close_temp_file(strm)");
- ptf->strm = 0;
+ if (s_is_valid(ptf->strm)) {
+ sflush(ptf->strm);
+ /* Prevent freeing the stream from closing the file. */
+ ptf->strm->file = 0;
+ } else
+ ptf->file = file = 0; /* file was closed by finalization */
+ gs_free_object(pdev->pdf_memory, ptf->strm_buf,
+ "pdf_close_temp_file(strm_buf)");
+ ptf->strm_buf = 0;
+ gs_free_object(pdev->pdf_memory, ptf->strm,
+ "pdf_close_temp_file(strm)");
+ ptf->strm = 0;
}
if (file) {
- err = ferror(file) | fclose(file);
- unlink(ptf->file_name);
- ptf->file = 0;
+ err = ferror(file) | fclose(file);
+ unlink(ptf->file_name);
+ ptf->file = 0;
}
ptf->save_strm = 0;
return
- (code < 0 ? code : err != 0 ? gs_note_error(gs_error_ioerror) : code);
+ (code < 0 ? code : err != 0 ? gs_note_error(gs_error_ioerror) : code);
}
static int
pdf_close_files(gx_device_pdf * pdev, int code)
@@ -211,7 +211,7 @@ pdf_open_temp_file(gx_device_pdf *pdev, pdf_temp_file_t *ptf)
char fmode[4];
if (strlen(gp_fmode_binary_suffix) > 2)
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
strcpy(fmode, "w+");
strcat(fmode, gp_fmode_binary_suffix);
@@ -220,7 +220,7 @@ pdf_open_temp_file(gx_device_pdf *pdev, pdf_temp_file_t *ptf)
ptf->file_name,
fmode);
if (ptf->file == 0)
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
return 0;
}
static int
@@ -229,17 +229,17 @@ pdf_open_temp_stream(gx_device_pdf *pdev, pdf_temp_file_t *ptf)
int code = pdf_open_temp_file(pdev, ptf);
if (code < 0)
- return code;
+ return code;
ptf->strm = s_alloc(pdev->pdf_memory, "pdf_open_temp_stream(strm)");
if (ptf->strm == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
ptf->strm_buf = gs_alloc_bytes(pdev->pdf_memory, sbuf_size,
- "pdf_open_temp_stream(strm_buf)");
+ "pdf_open_temp_stream(strm_buf)");
if (ptf->strm_buf == 0) {
- gs_free_object(pdev->pdf_memory, ptf->strm,
- "pdf_open_temp_stream(strm)");
- ptf->strm = 0;
- return_error(gs_error_VMerror);
+ gs_free_object(pdev->pdf_memory, ptf->strm,
+ "pdf_open_temp_stream(strm)");
+ ptf->strm = 0;
+ return_error(gs_error_VMerror);
}
swrite_file(ptf->strm, ptf->file, ptf->strm_buf, sbuf_size);
return 0;
@@ -263,11 +263,11 @@ pdf_initialize_ids(gx_device_pdf * pdev)
param_string_from_string(nstr, "{DocInfo}");
pdf_create_named_dict(pdev, &nstr, &pdev->Info, 0L);
{
- char buf[PDF_MAX_PRODUCER];
+ char buf[PDF_MAX_PRODUCER];
- pdf_store_default_Producer(buf);
- cos_dict_put_c_key_string(pdev->Info, "/Producer", (byte *)buf,
- strlen(buf));
+ pdf_store_default_Producer(buf);
+ cos_dict_put_c_key_string(pdev->Info, "/Producer", (byte *)buf,
+ strlen(buf));
}
/*
* Acrobat Distiller sets CreationDate and ModDate to the current
@@ -276,28 +276,28 @@ pdf_initialize_ids(gx_device_pdf * pdev)
*/
{
struct tm tms;
- time_t t;
+ time_t t;
char buf[1+2+4+2+2+2+2+2+1+2+1+2+1+1+1]; /* (D:yyyymmddhhmmssZhh'mm')\0 */
- int timeoffset;
+ int timeoffset;
char timesign;
- time(&t);
- tms = *gmtime(&t);
+ time(&t);
+ tms = *gmtime(&t);
tms.tm_isdst = -1;
- timeoffset = (int)difftime(t, mktime(&tms)); /* tz+dst in seconds */
+ timeoffset = (int)difftime(t, mktime(&tms)); /* tz+dst in seconds */
timesign = (timeoffset == 0 ? 'Z' : timeoffset < 0 ? '-' : '+');
- timeoffset = any_abs(timeoffset) / 60;
+ timeoffset = any_abs(timeoffset) / 60;
tms = *localtime(&t);
- sprintf(buf, "(D:%04d%02d%02d%02d%02d%02d%c%02d\'%02d\')",
- tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
- tms.tm_hour, tms.tm_min, tms.tm_sec,
- timesign, timeoffset / 60, timeoffset % 60);
+ sprintf(buf, "(D:%04d%02d%02d%02d%02d%02d%c%02d\'%02d\')",
+ tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
+ tms.tm_hour, tms.tm_min, tms.tm_sec,
+ timesign, timeoffset / 60, timeoffset % 60);
- cos_dict_put_c_key_string(pdev->Info, "/CreationDate", (byte *)buf,
- strlen(buf));
- cos_dict_put_c_key_string(pdev->Info, "/ModDate", (byte *)buf,
- strlen(buf));
+ cos_dict_put_c_key_string(pdev->Info, "/CreationDate", (byte *)buf,
+ strlen(buf));
+ cos_dict_put_c_key_string(pdev->Info, "/ModDate", (byte *)buf,
+ strlen(buf));
}
/* Allocate the root of the pages tree. */
@@ -311,7 +311,7 @@ pdf_compute_fileID(gx_device_pdf * pdev)
/* We compute a file identifier when beginning a document
to allow its usage with PDF encryption. Due to that,
in contradiction to the Adobe recommendation, our
- ID doesn't depend on the document size.
+ ID doesn't depend on the document size.
*/
gs_memory_t *mem = pdev->pdf_memory;
stream *strm = pdev->strm;
@@ -322,7 +322,7 @@ pdf_compute_fileID(gx_device_pdf * pdev)
uint KeyLength = pdev->KeyLength;
if (s == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pdev->KeyLength = 0; /* Disable encryption. Not so important though. */
gp_get_usertime(secs_ns);
sputs(s, (byte *)secs_ns, sizeof(secs_ns), &ignore);
@@ -332,7 +332,7 @@ pdf_compute_fileID(gx_device_pdf * pdev)
pdev->strm = strm;
pdev->KeyLength = KeyLength;
if (code < 0)
- return code;
+ return code;
sclose(s);
gs_free_object(mem, s, "pdf_compute_fileID");
#if 0
@@ -341,17 +341,17 @@ pdf_compute_fileID(gx_device_pdf * pdev)
return 0;
}
-static const byte pad[32] = { 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
- 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
- 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80,
- 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A};
+static const byte pad[32] = { 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
+ 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
+ 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80,
+ 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A};
static inline void
copy_padded(byte buf[32], gs_param_string *str)
{
memcpy(buf, str->data, min(str->size, 32));
if (32 > str->size)
- memcpy(buf + str->size, pad, 32 - str->size);
+ memcpy(buf + str->size, pad, 32 - str->size);
}
static void
@@ -361,9 +361,9 @@ Adobe_magic_loop_50(byte digest[16], int key_length)
int i;
for (i = 0; i < 50; i++) {
- gs_md5_init(&md5);
- gs_md5_append(&md5, digest, key_length);
- gs_md5_finish(&md5, digest);
+ gs_md5_init(&md5);
+ gs_md5_append(&md5, digest, key_length);
+ gs_md5_finish(&md5, digest);
}
}
@@ -375,10 +375,10 @@ Adobe_magic_loop_19(byte *data, int data_size, const byte *key, int key_size)
int i, j;
for (i = 1; i <= 19; i++) {
- for (j = 0; j < key_size; j++)
- key_buf[j] = key[j] ^ (byte)i;
- s_arcfour_set_key(&sarc4, key_buf, key_size);
- s_arcfour_process_buffer(&sarc4, data, data_size);
+ for (j = 0; j < key_size; j++)
+ key_buf[j] = key[j] ^ (byte)i;
+ s_arcfour_set_key(&sarc4, key_buf, key_size);
+ s_arcfour_process_buffer(&sarc4, data, data_size);
}
}
@@ -390,53 +390,53 @@ pdf_compute_encryption_data(gx_device_pdf * pdev)
stream_arcfour_state sarc4;
if (pdev->PDFX && pdev->KeyLength != 0) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"Encryption is not allowed in a PDF/X doucment.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->KeyLength == 0)
- pdev->KeyLength = 40;
+ pdev->KeyLength = 40;
if (pdev->EncryptionV == 0 && pdev->KeyLength == 40)
- pdev->EncryptionV = 1;
+ pdev->EncryptionV = 1;
if (pdev->EncryptionV == 0 && pdev->KeyLength > 40)
- pdev->EncryptionV = 2;
+ pdev->EncryptionV = 2;
if (pdev->EncryptionV > 1 && pdev->CompatibilityLevel < 1.4) {
- emprintf(pdev->memory, "PDF 1.3 only supports 40 bits keys.\n");
- return_error(gs_error_rangecheck);
+ emprintf(pdev->memory, "PDF 1.3 only supports 40 bits keys.\n");
+ return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR == 0)
- pdev->EncryptionR = 2;
+ pdev->EncryptionR = 2;
if (pdev->EncryptionR < 2 || pdev->EncryptionR > 3) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"Encryption revisions 2 and 3 are only supported.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR > 2 && pdev->CompatibilityLevel < 1.4) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"PDF 1.3 only supports the encryption revision 2.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->KeyLength > 128) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"The maximal length of PDF encryption key is 128 bits.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->KeyLength % 8) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"PDF encryption key length must be a multiple of 8.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->EncryptionR == 2 &&
- ((pdev->Permissions & (0xFFFFFFC3)) != 0xFFFFFFC0)) {
- emprintf(pdev->memory,
+ ((pdev->Permissions & (0xFFFFFFC3)) != 0xFFFFFFC0)) {
+ emprintf(pdev->memory,
"Some of Permissions are not allowed with R=2.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (pdev->EncryptionV == 2 && pdev->EncryptionR == 2 && pdev->KeyLength > 40) {
- emprintf(pdev->memory, "Encryption version 2 revision 2 with "
+ emprintf(pdev->memory, "Encryption version 2 revision 2 with "
"KeyLength > 40 appears incompatible to some viewers. With "
"long keys use revision 3.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
/* Compute O : */
gs_md5_init(&md5);
@@ -444,12 +444,12 @@ pdf_compute_encryption_data(gx_device_pdf * pdev)
gs_md5_append(&md5, buf, sizeof(buf));
gs_md5_finish(&md5, digest);
if (pdev->EncryptionR == 3)
- Adobe_magic_loop_50(digest, pdev->KeyLength / 8);
+ Adobe_magic_loop_50(digest, pdev->KeyLength / 8);
copy_padded(buf, &pdev->UserPassword);
s_arcfour_set_key(&sarc4, digest, pdev->KeyLength / 8);
s_arcfour_process_buffer(&sarc4, buf, sizeof(buf));
if (pdev->EncryptionR == 3)
- Adobe_magic_loop_19(buf, sizeof(buf), digest, pdev->KeyLength / 8);
+ Adobe_magic_loop_19(buf, sizeof(buf), digest, pdev->KeyLength / 8);
memcpy(pdev->EncryptionO, buf, sizeof(pdev->EncryptionO));
/* Compute Key : */
gs_md5_init(&md5);
@@ -462,31 +462,31 @@ pdf_compute_encryption_data(gx_device_pdf * pdev)
t = (byte)(pdev->Permissions >> 24); gs_md5_append(&md5, &t, 1);
gs_md5_append(&md5, pdev->fileID, sizeof(pdev->fileID));
if (pdev->EncryptionR == 3)
- if (!pdev->EncryptMetadata) {
- const byte v[4] = {0xFF, 0xFF, 0xFF, 0xFF};
+ if (!pdev->EncryptMetadata) {
+ const byte v[4] = {0xFF, 0xFF, 0xFF, 0xFF};
- gs_md5_append(&md5, v, 4);
- }
+ gs_md5_append(&md5, v, 4);
+ }
gs_md5_finish(&md5, digest);
if (pdev->EncryptionR == 3)
- Adobe_magic_loop_50(digest, pdev->KeyLength / 8);
+ Adobe_magic_loop_50(digest, pdev->KeyLength / 8);
memcpy(pdev->EncryptionKey, digest, pdev->KeyLength / 8);
/* Compute U : */
if (pdev->EncryptionR == 3) {
- gs_md5_init(&md5);
- gs_md5_append(&md5, pad, sizeof(pad));
- gs_md5_append(&md5, pdev->fileID, sizeof(pdev->fileID));
- gs_md5_finish(&md5, digest);
- s_arcfour_set_key(&sarc4, pdev->EncryptionKey, pdev->KeyLength / 8);
- s_arcfour_process_buffer(&sarc4, digest, sizeof(digest));
- Adobe_magic_loop_19(digest, sizeof(digest), pdev->EncryptionKey, pdev->KeyLength / 8);
- memcpy(pdev->EncryptionU, digest, sizeof(digest));
- memcpy(pdev->EncryptionU + sizeof(digest), pad,
- sizeof(pdev->EncryptionU) - sizeof(digest));
+ gs_md5_init(&md5);
+ gs_md5_append(&md5, pad, sizeof(pad));
+ gs_md5_append(&md5, pdev->fileID, sizeof(pdev->fileID));
+ gs_md5_finish(&md5, digest);
+ s_arcfour_set_key(&sarc4, pdev->EncryptionKey, pdev->KeyLength / 8);
+ s_arcfour_process_buffer(&sarc4, digest, sizeof(digest));
+ Adobe_magic_loop_19(digest, sizeof(digest), pdev->EncryptionKey, pdev->KeyLength / 8);
+ memcpy(pdev->EncryptionU, digest, sizeof(digest));
+ memcpy(pdev->EncryptionU + sizeof(digest), pad,
+ sizeof(pdev->EncryptionU) - sizeof(digest));
} else {
- memcpy(pdev->EncryptionU, pad, sizeof(pdev->EncryptionU));
- s_arcfour_set_key(&sarc4, pdev->EncryptionKey, pdev->KeyLength / 8);
- s_arcfour_process_buffer(&sarc4, pdev->EncryptionU, sizeof(pdev->EncryptionU));
+ memcpy(pdev->EncryptionU, pad, sizeof(pdev->EncryptionU));
+ s_arcfour_set_key(&sarc4, pdev->EncryptionKey, pdev->KeyLength / 8);
+ s_arcfour_process_buffer(&sarc4, pdev->EncryptionU, sizeof(pdev->EncryptionU));
}
return 0;
}
@@ -512,10 +512,10 @@ pdf_set_process_color_model(gx_device_pdf * pdev, int index)
{
const static gx_device_color_info pcm_color_info[] = {
- dci_values(1, 8, 255, 0, 256, 0), /* Gray */
- dci_values(3, 24, 255, 255, 256, 256), /* RGB */
- dci_values(4, 32, 255, 255, 256, 256), /* CMYK */
- dci_values(4, 32, 255, 255, 256, 256) /* Treat DeviceN like CMYK */
+ dci_values(1, 8, 255, 0, 256, 0), /* Gray */
+ dci_values(3, 24, 255, 255, 256, 256), /* RGB */
+ dci_values(4, 32, 255, 255, 256, 256), /* CMYK */
+ dci_values(4, 32, 255, 255, 256, 256) /* Treat DeviceN like CMYK */
};
pdev->pcm_color_info_index = index;
@@ -528,49 +528,49 @@ pdf_set_process_color_model(gx_device_pdf * pdev, int index)
* Particularly it should not change representation of colors.
* Perhaps due to historical reasons the source color information
* sometimes isn't accessible from device methods, and
- * therefore they perform a mapping of colors to
+ * therefore they perform a mapping of colors to
* an output color model. Here we handle some color models,
* which were selected almost due to antique reasons.
*/
switch (index) {
- case 0: /* DeviceGray */
- set_dev_proc(pdev, map_rgb_color, gx_default_gray_map_rgb_color);
- set_dev_proc(pdev, map_color_rgb, gx_default_gray_map_color_rgb);
- set_dev_proc(pdev, map_cmyk_color, NULL);
- set_dev_proc(pdev, get_color_mapping_procs,
- gx_default_DevGray_get_color_mapping_procs);
- set_dev_proc(pdev, get_color_comp_index,
- gx_default_DevGray_get_color_comp_index);
- set_dev_proc(pdev, encode_color, gx_default_gray_encode);
- set_dev_proc(pdev, decode_color, gx_default_decode_color);
- break;
- case 1: /* DeviceRGB */
- set_dev_proc(pdev, map_rgb_color, gx_default_rgb_map_rgb_color);
- set_dev_proc(pdev, map_color_rgb, gx_default_rgb_map_color_rgb);
- set_dev_proc(pdev, map_cmyk_color, NULL);
- set_dev_proc(pdev, get_color_mapping_procs,
- gx_default_DevRGB_get_color_mapping_procs);
- set_dev_proc(pdev, get_color_comp_index,
- gx_default_DevRGB_get_color_comp_index);
- set_dev_proc(pdev, encode_color, gx_default_rgb_map_rgb_color);
- set_dev_proc(pdev, decode_color, gx_default_rgb_map_color_rgb);
- break;
- case 3: /* DeviceN - treat like DeviceCMYK except for cm_name */
- pdev->color_info.cm_name = "DeviceN";
- case 2: /* DeviceCMYK */
- set_dev_proc(pdev, map_rgb_color, NULL);
- set_dev_proc(pdev, map_color_rgb, cmyk_8bit_map_color_rgb);
- /* possible problems with aliassing on next statement */
- set_dev_proc(pdev, map_cmyk_color, cmyk_8bit_map_cmyk_color);
- set_dev_proc(pdev, get_color_mapping_procs,
- gx_default_DevCMYK_get_color_mapping_procs);
- set_dev_proc(pdev, get_color_comp_index,
- gx_default_DevCMYK_get_color_comp_index);
- set_dev_proc(pdev, encode_color, cmyk_8bit_map_cmyk_color);
- set_dev_proc(pdev, decode_color, cmyk_8bit_map_color_rgb);
- break;
- default: /* can't happen - see the call from gdev_pdf_put_params. */
- DO_NOTHING;
+ case 0: /* DeviceGray */
+ set_dev_proc(pdev, map_rgb_color, gx_default_gray_map_rgb_color);
+ set_dev_proc(pdev, map_color_rgb, gx_default_gray_map_color_rgb);
+ set_dev_proc(pdev, map_cmyk_color, NULL);
+ set_dev_proc(pdev, get_color_mapping_procs,
+ gx_default_DevGray_get_color_mapping_procs);
+ set_dev_proc(pdev, get_color_comp_index,
+ gx_default_DevGray_get_color_comp_index);
+ set_dev_proc(pdev, encode_color, gx_default_gray_encode);
+ set_dev_proc(pdev, decode_color, gx_default_decode_color);
+ break;
+ case 1: /* DeviceRGB */
+ set_dev_proc(pdev, map_rgb_color, gx_default_rgb_map_rgb_color);
+ set_dev_proc(pdev, map_color_rgb, gx_default_rgb_map_color_rgb);
+ set_dev_proc(pdev, map_cmyk_color, NULL);
+ set_dev_proc(pdev, get_color_mapping_procs,
+ gx_default_DevRGB_get_color_mapping_procs);
+ set_dev_proc(pdev, get_color_comp_index,
+ gx_default_DevRGB_get_color_comp_index);
+ set_dev_proc(pdev, encode_color, gx_default_rgb_map_rgb_color);
+ set_dev_proc(pdev, decode_color, gx_default_rgb_map_color_rgb);
+ break;
+ case 3: /* DeviceN - treat like DeviceCMYK except for cm_name */
+ pdev->color_info.cm_name = "DeviceN";
+ case 2: /* DeviceCMYK */
+ set_dev_proc(pdev, map_rgb_color, NULL);
+ set_dev_proc(pdev, map_color_rgb, cmyk_8bit_map_color_rgb);
+ /* possible problems with aliassing on next statement */
+ set_dev_proc(pdev, map_cmyk_color, cmyk_8bit_map_cmyk_color);
+ set_dev_proc(pdev, get_color_mapping_procs,
+ gx_default_DevCMYK_get_color_mapping_procs);
+ set_dev_proc(pdev, get_color_comp_index,
+ gx_default_DevCMYK_get_color_comp_index);
+ set_dev_proc(pdev, encode_color, cmyk_8bit_map_cmyk_color);
+ set_dev_proc(pdev, decode_color, cmyk_8bit_map_color_rgb);
+ break;
+ default: /* can't happen - see the call from gdev_pdf_put_params. */
+ DO_NOTHING;
}
}
#ifdef __DECC
@@ -595,20 +595,20 @@ pdf_open(gx_device * dev)
int code;
if ((code = pdf_open_temp_file(pdev, &pdev->xref)) < 0 ||
- (code = pdf_open_temp_stream(pdev, &pdev->asides)) < 0 ||
- (code = pdf_open_temp_stream(pdev, &pdev->streams)) < 0 ||
- (code = pdf_open_temp_stream(pdev, &pdev->pictures)) < 0
- )
- goto fail;
+ (code = pdf_open_temp_stream(pdev, &pdev->asides)) < 0 ||
+ (code = pdf_open_temp_stream(pdev, &pdev->streams)) < 0 ||
+ (code = pdf_open_temp_stream(pdev, &pdev->pictures)) < 0
+ )
+ goto fail;
code = gdev_vector_open_file((gx_device_vector *) pdev, sbuf_size);
if (code < 0)
- goto fail;
+ goto fail;
if (pdev->ComputeDocumentDigest) {
- stream *s = s_MD5C_make_stream(pdev->pdf_memory, pdev->strm);
+ stream *s = s_MD5C_make_stream(pdev->pdf_memory, pdev->strm);
- if (s == NULL)
- return_error(gs_error_VMerror);
- pdev->strm = s;
+ if (s == NULL)
+ return_error(gs_error_VMerror);
+ pdev->strm = s;
}
gdev_vector_init((gx_device_vector *) pdev);
gp_get_realtime(pdev->uuid_time);
@@ -622,53 +622,53 @@ pdf_open(gx_device * dev)
* initialize the named objects dictionary now.
*/
pdev->local_named_objects =
- pdev->global_named_objects =
- cos_dict_alloc(pdev, "pdf_open(global_named_objects)");
+ pdev->global_named_objects =
+ cos_dict_alloc(pdev, "pdf_open(global_named_objects)");
/* Initialize internal structures that don't have IDs. */
pdev->NI_stack = cos_array_alloc(pdev, "pdf_open(NI stack)");
pdev->Namespace_stack = cos_array_alloc(pdev, "pdf_open(Namespace stack)");
pdf_initialize_ids(pdev);
code = pdf_compute_fileID(pdev);
if (code < 0)
- goto fail;
+ goto fail;
if (pdev->OwnerPassword.size > 0) {
- code = pdf_compute_encryption_data(pdev);
- if (code < 0)
- goto fail;
+ code = pdf_compute_encryption_data(pdev);
+ if (code < 0)
+ goto fail;
} else if(pdev->UserPassword.size > 0) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"User password is specified. Need an Owner password or both.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
} else if (pdev->KeyLength) {
- emprintf(pdev->memory,
+ emprintf(pdev->memory,
"Can't accept encryption options without a password.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
/* Now create a new dictionary for the local named objects. */
pdev->local_named_objects =
- cos_dict_alloc(pdev, "pdf_open(local_named_objects)");
+ cos_dict_alloc(pdev, "pdf_open(local_named_objects)");
pdev->outlines_id = 0;
pdev->next_page = 0;
pdev->text = pdf_text_data_alloc(mem);
pdev->sbstack_size = count_of(pdev->vgstack); /* Overestimated a few. */
pdev->sbstack = gs_alloc_struct_array(mem, pdev->sbstack_size, pdf_substream_save,
- &st_pdf_substream_save_element, "pdf_open");
+ &st_pdf_substream_save_element, "pdf_open");
pdev->pages =
- gs_alloc_struct_array(mem, initial_num_pages, pdf_page_t,
- &st_pdf_page_element, "pdf_open(pages)");
+ gs_alloc_struct_array(mem, initial_num_pages, pdf_page_t,
+ &st_pdf_page_element, "pdf_open(pages)");
if (pdev->text == 0 || pdev->pages == 0 || pdev->sbstack == 0) {
- code = gs_error_VMerror;
- goto fail;
+ code = gs_error_VMerror;
+ goto fail;
}
memset(pdev->sbstack, 0, pdev->sbstack_size * sizeof(pdf_substream_save));
memset(pdev->pages, 0, initial_num_pages * sizeof(pdf_page_t));
pdev->num_pages = initial_num_pages;
{
- int i, j;
+ int i, j;
- for (i = 0; i < NUM_RESOURCE_TYPES; ++i)
- for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
- pdev->resources[i].chains[j] = 0;
+ for (i = 0; i < NUM_RESOURCE_TYPES; ++i)
+ for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
+ pdev->resources[i].chains[j] = 0;
}
pdev->outline_levels[0].first.id = 0;
pdev->outline_levels[0].left = max_int;
@@ -702,8 +702,8 @@ pdf_ferror(gx_device_pdf *pdev)
sflush(pdev->streams.strm);
sflush(pdev->pictures.strm);
return ferror(pdev->file) || ferror(pdev->xref.file) ||
- ferror(pdev->asides.file) || ferror(pdev->streams.file) ||
- ferror(pdev->pictures.file);
+ ferror(pdev->asides.file) || ferror(pdev->streams.file) ||
+ ferror(pdev->pictures.file);
}
/* Compute the dominant text orientation of a page. */
@@ -715,10 +715,10 @@ pdf_dominant_rotation(const pdf_text_rotation_t *ptr)
static const int angles[] = { pdf_text_rotation_angle_values };
for (i = 0; i < countof(ptr->counts); ++i) {
- long count = ptr->counts[i];
+ long count = ptr->counts[i];
- if (count > max_count)
- imax = i, max_count = count;
+ if (count > max_count)
+ imax = i, max_count = count;
}
return (imax < 0 ? imax : angles[imax]);
}
@@ -732,69 +732,68 @@ pdf_print_orientation(gx_device_pdf * pdev, pdf_page_t *page)
const pdf_page_dsc_info_t *ppdi;
if (pdev->params.AutoRotatePages == arp_None)
- return; /* Not requested. */
+ return; /* Not requested. */
ppdi = (page != NULL ? &page->dsc_info : &pdev->doc_dsc_info);
/* Determine DSC orientation : */
if (ppdi->viewing_orientation >= 0)
- dsc_orientation = ppdi->viewing_orientation;
+ dsc_orientation = ppdi->viewing_orientation;
else if (ppdi->orientation >= 0)
- dsc_orientation = ppdi->orientation;
+ dsc_orientation = ppdi->orientation;
if ((page == NULL && pdev->params.AutoRotatePages == arp_All) || /* document */
(page != NULL && page->text_rotation.Rotate >= 0) || /* page */
- dsc_orientation >= 0 /* have DSC */) {
- const pdf_text_rotation_t *ptr =
- (page != NULL ? &page->text_rotation : &pdev->text_rotation);
- int angle = -1;
+ dsc_orientation >= 0 /* have DSC */) {
+ const pdf_text_rotation_t *ptr =
+ (page != NULL ? &page->text_rotation : &pdev->text_rotation);
+ int angle = -1;
#define Bug687800
#ifndef Bug687800 /* Bug 687800 together with Bug687489.ps . */
- const gs_point *pbox = &(page != NULL ? page : &pdev->pages[0])->MediaBox;
+ const gs_point *pbox = &(page != NULL ? page : &pdev->pages[0])->MediaBox;
- if (dsc_orientation >= 0 && pbox->x > pbox->y) {
- /* The page is in landscape format. Adjust the rotation accordingly. */
- dsc_orientation ^= 1;
- }
+ if (dsc_orientation >= 0 && pbox->x > pbox->y) {
+ /* The page is in landscape format. Adjust the rotation accordingly. */
+ dsc_orientation ^= 1;
+ }
#endif
- /* Combine DSC rotation with text rotation : */
- if (dsc_orientation == 0) {
- if (ptr->Rotate == 0 || ptr->Rotate == 180)
- angle = ptr->Rotate;
- } else if (dsc_orientation == 1) {
- if (ptr->Rotate == 90 || ptr->Rotate == 270)
- angle = ptr->Rotate;
- else
- angle = 90;
- }
-
- if (angle < 0) {
+ /* Combine DSC rotation with text rotation : */
+ if (dsc_orientation == 0) {
+ if (ptr->Rotate == 0 || ptr->Rotate == 180)
+ angle = ptr->Rotate;
+ } else if (dsc_orientation == 1) {
+ if (ptr->Rotate == 90 || ptr->Rotate == 270)
+ angle = ptr->Rotate;
+ else
+ angle = 90;
+ }
+
+ if (angle < 0) {
#define Bug688793
#ifdef Bug688793
- /* If not combinable, prefer dsc rotation : */
- if (dsc_orientation >= 0)
- angle = dsc_orientation * 90;
- else
- angle = ptr->Rotate;
+ /* If not combinable, prefer dsc rotation : */
+ if (dsc_orientation >= 0)
+ angle = dsc_orientation * 90;
+ else
+ angle = ptr->Rotate;
#else
- /* If not combinable, prefer text rotation : */
- if (ptr->Rotate >= 0)
- angle = ptr->Rotate;
+ /* If not combinable, prefer text rotation : */
+ if (ptr->Rotate >= 0)
+ angle = ptr->Rotate;
#ifdef Bug687800
- else
- angle = dsc_orientation * 90;
+ else
+ angle = dsc_orientation * 90;
#endif
#endif
- }
+ }
- /* If got some, write it out : */
- if (angle >= 0)
- pprintd1(s, "/Rotate %d", angle);
+ /* If got some, write it out : */
+ if (angle >= 0)
+ pprintd1(s, "/Rotate %d", angle);
}
}
-
/* Close the current page. */
static int
pdf_close_page(gx_device_pdf * pdev, int num_copies)
@@ -810,22 +809,22 @@ pdf_close_page(gx_device_pdf * pdev, int num_copies)
code = pdf_open_document(pdev);
if (code < 0)
- return code;
+ return code;
if (pdev->ForOPDFRead && pdev->context == PDF_IN_NONE) {
- /* Must create a context stream for empty pages. */
- code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ /* Must create a context stream for empty pages. */
+ code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
}
pdf_close_contents(pdev, true);
if (!pdev->DoNumCopies)
- num_copies = 1;
+ num_copies = 1;
for(i=0;i<num_copies;i++) {
- bool clear_resource_use = i < num_copies - 1 ? 0 : 1;
+ bool clear_resource_use = i < num_copies - 1 ? 0 : 1;
- page_num = ++(pdev->next_page);
+ page_num = ++(pdev->next_page);
/*
* We can't write the page object or the annotations array yet, because
* later pdfmarks might add elements to them. Write the other objects
@@ -844,73 +843,73 @@ pdf_close_page(gx_device_pdf * pdev, int num_copies)
/* pdf_store_page_resources sets procsets, resource_ids[]. */
code = pdf_store_page_resources(pdev, page, clear_resource_use);
if (code < 0)
- return code;
+ return code;
/* Write the Functions. */
code = pdf_write_resource_objects(pdev, resourceFunction);
if (code < 0)
- return code;
+ return code;
/* Save viewer's memory with cleaning resources. */
if (pdev->MaxViewerMemorySize < 10000000) {
- /* fixme: the condition above and the cleaning algorithm
- may be improved with counting stored resource size
- and creating multiple streams per page. */
-
- if (pdev->ForOPDFRead) {
- pdf_resource_t *pres = pdf_find_resource_by_resource_id(pdev, resourcePage, pdev->contents_id);
-
- if (pres != NULL) {
- code = cos_dict_put_c_strings((cos_dict_t *)pres->object, "/.CleanResources", "/All");
- if (code < 0)
- return code;
- }
- }
- code = pdf_close_text_document(pdev);
- if (code < 0)
- return code;
- code = pdf_write_and_free_all_resource_objects(pdev);
- if (code < 0)
- return code;
- }
+ /* fixme: the condition above and the cleaning algorithm
+ may be improved with counting stored resource size
+ and creating multiple streams per page. */
+
+ if (pdev->ForOPDFRead) {
+ pdf_resource_t *pres = pdf_find_resource_by_resource_id(pdev, resourcePage, pdev->contents_id);
+
+ if (pres != NULL) {
+ code = cos_dict_put_c_strings((cos_dict_t *)pres->object, "/.CleanResources", "/All");
+ if (code < 0)
+ return code;
+ }
+ }
+ code = pdf_close_text_document(pdev);
+ if (code < 0)
+ return code;
+ code = pdf_write_and_free_all_resource_objects(pdev);
+ if (code < 0)
+ return code;
+ }
/* Close use of text on the page. */
pdf_close_text_page(pdev);
- /* Accumulate text rotation. */
+ /* Accumulate text rotation. */
- page->text_rotation.Rotate =
- (pdev->params.AutoRotatePages == arp_PageByPage ?
- pdf_dominant_rotation(&page->text_rotation) : -1);
- {
- int i;
+ page->text_rotation.Rotate =
+ (pdev->params.AutoRotatePages == arp_PageByPage ?
+ pdf_dominant_rotation(&page->text_rotation) : -1);
+ {
+ int i;
- for (i = 0; i < countof(page->text_rotation.counts); ++i)
- pdev->text_rotation.counts[i] += page->text_rotation.counts[i];
- }
+ for (i = 0; i < countof(page->text_rotation.counts); ++i)
+ pdev->text_rotation.counts[i] += page->text_rotation.counts[i];
+ }
- /* Record information from DSC comments. */
+ /* Record information from DSC comments. */
- page->dsc_info = pdev->page_dsc_info;
- if (page->dsc_info.orientation < 0)
- page->dsc_info.orientation = pdev->doc_dsc_info.orientation;
+ page->dsc_info = pdev->page_dsc_info;
+ if (page->dsc_info.orientation < 0)
+ page->dsc_info.orientation = pdev->doc_dsc_info.orientation;
#ifdef Bug688793
- if (page->dsc_info.viewing_orientation < 0)
- page->dsc_info.viewing_orientation =
+ if (page->dsc_info.viewing_orientation < 0)
+ page->dsc_info.viewing_orientation =
pdev->doc_dsc_info.viewing_orientation;
#endif
- if (page->dsc_info.bounding_box.p.x >= page->dsc_info.bounding_box.q.x ||
- page->dsc_info.bounding_box.p.y >= page->dsc_info.bounding_box.q.y
- )
- page->dsc_info.bounding_box = pdev->doc_dsc_info.bounding_box;
+ if (page->dsc_info.bounding_box.p.x >= page->dsc_info.bounding_box.q.x ||
+ page->dsc_info.bounding_box.p.y >= page->dsc_info.bounding_box.q.y
+ )
+ page->dsc_info.bounding_box = pdev->doc_dsc_info.bounding_box;
- /* Finish up. */
+ /* Finish up. */
- if(pdf_ferror(pdev))
- return(gs_note_error(gs_error_ioerror));
+ if(pdf_ferror(pdev))
+ return(gs_note_error(gs_error_ioerror));
}
pdf_reset_page(pdev);
return (pdf_ferror(pdev) ? gs_note_error(gs_error_ioerror) : 0);
@@ -935,100 +934,100 @@ pdf_write_page(gx_device_pdf *pdev, int page_num)
pdf_open_obj(pdev, page_id, resourcePage);
s = pdev->strm;
pprintg2(s, "<</Type/Page/MediaBox [0 0 %g %g]\n",
- mediabox[2], mediabox[3]);
+ mediabox[2], mediabox[3]);
if (pdev->PDFX) {
- const cos_value_t *v_trimbox = cos_dict_find_c_key(page->Page, "/TrimBox");
- floatp trimbox[4] = {0, 0}, bleedbox[4] = {0, 0};
- bool print_bleedbox = false;
-
- trimbox[2] = bleedbox[2] = mediabox[2];
- trimbox[3] = bleedbox[3] = mediabox[3];
- /* Offsets are [left right top bottom] according to the Acrobat 7.0
- distiller parameters manual, 12/7/2004, pp. 102-103. */
- if (v_trimbox != NULL && v_trimbox->value_type == COS_VALUE_SCALAR) {
- const byte *p = v_trimbox->contents.chars.data;
- char buf[100];
- int l = min (v_trimbox->contents.chars.size, sizeof(buf) - 1);
- float temp[4]; /* the type is float for sscanf. */
-
- memcpy(buf, p, l);
- buf[l] = 0;
- if (sscanf(buf, "[ %g %g %g %g ]",
- &temp[0], &temp[1], &temp[2], &temp[3]) == 4) {
- trimbox[0] = temp[0];
- trimbox[1] = temp[1];
- trimbox[2] = temp[2];
- trimbox[3] = temp[3];
- }
- } else if (pdev->PDFXTrimBoxToMediaBoxOffset.size >= 4 &&
- pdev->PDFXTrimBoxToMediaBoxOffset.data[0] >= 0 &&
- pdev->PDFXTrimBoxToMediaBoxOffset.data[1] >= 0 &&
- pdev->PDFXTrimBoxToMediaBoxOffset.data[2] >= 0 &&
- pdev->PDFXTrimBoxToMediaBoxOffset.data[3] >= 0) {
- trimbox[0] = mediabox[0] + pdev->PDFXTrimBoxToMediaBoxOffset.data[0];
- trimbox[1] = mediabox[1] + pdev->PDFXTrimBoxToMediaBoxOffset.data[3];
- trimbox[2] = mediabox[2] - pdev->PDFXTrimBoxToMediaBoxOffset.data[1];
- trimbox[3] = mediabox[3] - pdev->PDFXTrimBoxToMediaBoxOffset.data[2];
- }
- if (pdev->PDFXSetBleedBoxToMediaBox)
- print_bleedbox = true;
- else if (pdev->PDFXBleedBoxToTrimBoxOffset.size >= 4 &&
- pdev->PDFXBleedBoxToTrimBoxOffset.data[0] >= 0 &&
- pdev->PDFXBleedBoxToTrimBoxOffset.data[1] >= 0 &&
- pdev->PDFXBleedBoxToTrimBoxOffset.data[2] >= 0 &&
- pdev->PDFXBleedBoxToTrimBoxOffset.data[3] >= 0) {
- bleedbox[0] = trimbox[0] - pdev->PDFXBleedBoxToTrimBoxOffset.data[0];
- bleedbox[1] = trimbox[1] - pdev->PDFXBleedBoxToTrimBoxOffset.data[3];
- bleedbox[2] = trimbox[2] + pdev->PDFXBleedBoxToTrimBoxOffset.data[1];
- bleedbox[3] = trimbox[3] + pdev->PDFXBleedBoxToTrimBoxOffset.data[2];
- print_bleedbox = true;
- }
- if (cos_dict_find_c_key(page->Page, "/TrimBox") == NULL &&
- cos_dict_find_c_key(page->Page, "/ArtBox") == NULL)
- pprintg4(s, "/TrimBox [%g %g %g %g]\n",
- trimbox[0], trimbox[1], trimbox[2], trimbox[3]);
- if (print_bleedbox &&
- cos_dict_find_c_key(page->Page, "/BleedBox") == NULL)
- pprintg4(s, "/BleedBox [%g %g %g %g]\n",
- bleedbox[0], bleedbox[1], bleedbox[2], bleedbox[3]);
+ const cos_value_t *v_trimbox = cos_dict_find_c_key(page->Page, "/TrimBox");
+ floatp trimbox[4] = {0, 0}, bleedbox[4] = {0, 0};
+ bool print_bleedbox = false;
+
+ trimbox[2] = bleedbox[2] = mediabox[2];
+ trimbox[3] = bleedbox[3] = mediabox[3];
+ /* Offsets are [left right top bottom] according to the Acrobat 7.0
+ distiller parameters manual, 12/7/2004, pp. 102-103. */
+ if (v_trimbox != NULL && v_trimbox->value_type == COS_VALUE_SCALAR) {
+ const byte *p = v_trimbox->contents.chars.data;
+ char buf[100];
+ int l = min (v_trimbox->contents.chars.size, sizeof(buf) - 1);
+ float temp[4]; /* the type is float for sscanf. */
+
+ memcpy(buf, p, l);
+ buf[l] = 0;
+ if (sscanf(buf, "[ %g %g %g %g ]",
+ &temp[0], &temp[1], &temp[2], &temp[3]) == 4) {
+ trimbox[0] = temp[0];
+ trimbox[1] = temp[1];
+ trimbox[2] = temp[2];
+ trimbox[3] = temp[3];
+ }
+ } else if (pdev->PDFXTrimBoxToMediaBoxOffset.size >= 4 &&
+ pdev->PDFXTrimBoxToMediaBoxOffset.data[0] >= 0 &&
+ pdev->PDFXTrimBoxToMediaBoxOffset.data[1] >= 0 &&
+ pdev->PDFXTrimBoxToMediaBoxOffset.data[2] >= 0 &&
+ pdev->PDFXTrimBoxToMediaBoxOffset.data[3] >= 0) {
+ trimbox[0] = mediabox[0] + pdev->PDFXTrimBoxToMediaBoxOffset.data[0];
+ trimbox[1] = mediabox[1] + pdev->PDFXTrimBoxToMediaBoxOffset.data[3];
+ trimbox[2] = mediabox[2] - pdev->PDFXTrimBoxToMediaBoxOffset.data[1];
+ trimbox[3] = mediabox[3] - pdev->PDFXTrimBoxToMediaBoxOffset.data[2];
+ }
+ if (pdev->PDFXSetBleedBoxToMediaBox)
+ print_bleedbox = true;
+ else if (pdev->PDFXBleedBoxToTrimBoxOffset.size >= 4 &&
+ pdev->PDFXBleedBoxToTrimBoxOffset.data[0] >= 0 &&
+ pdev->PDFXBleedBoxToTrimBoxOffset.data[1] >= 0 &&
+ pdev->PDFXBleedBoxToTrimBoxOffset.data[2] >= 0 &&
+ pdev->PDFXBleedBoxToTrimBoxOffset.data[3] >= 0) {
+ bleedbox[0] = trimbox[0] - pdev->PDFXBleedBoxToTrimBoxOffset.data[0];
+ bleedbox[1] = trimbox[1] - pdev->PDFXBleedBoxToTrimBoxOffset.data[3];
+ bleedbox[2] = trimbox[2] + pdev->PDFXBleedBoxToTrimBoxOffset.data[1];
+ bleedbox[3] = trimbox[3] + pdev->PDFXBleedBoxToTrimBoxOffset.data[2];
+ print_bleedbox = true;
+ }
+ if (cos_dict_find_c_key(page->Page, "/TrimBox") == NULL &&
+ cos_dict_find_c_key(page->Page, "/ArtBox") == NULL)
+ pprintg4(s, "/TrimBox [%g %g %g %g]\n",
+ trimbox[0], trimbox[1], trimbox[2], trimbox[3]);
+ if (print_bleedbox &&
+ cos_dict_find_c_key(page->Page, "/BleedBox") == NULL)
+ pprintg4(s, "/BleedBox [%g %g %g %g]\n",
+ bleedbox[0], bleedbox[1], bleedbox[2], bleedbox[3]);
}
pdf_print_orientation(pdev, page);
pprintld1(s, "/Parent %ld 0 R\n", pdev->Pages->id);
if (pdev->ForOPDFRead) {
- if (page->NumCopies_set)
- pprintld1(s, "/NumCopies %ld\n", page->NumCopies);
+ if (page->NumCopies_set)
+ pprintld1(s, "/NumCopies %ld\n", page->NumCopies);
}
if (page->group_id > 0) {
- pprintld1(s, "/Group %ld 0 R\n", page->group_id);
+ pprintld1(s, "/Group %ld 0 R\n", page->group_id);
}
stream_puts(s, "/Resources<</ProcSet[/PDF");
if (page->procsets & ImageB)
- stream_puts(s, " /ImageB");
+ stream_puts(s, " /ImageB");
if (page->procsets & ImageC)
- stream_puts(s, " /ImageC");
+ stream_puts(s, " /ImageC");
if (page->procsets & ImageI)
- stream_puts(s, " /ImageI");
+ stream_puts(s, " /ImageI");
if (page->procsets & Text)
- stream_puts(s, " /Text");
+ stream_puts(s, " /Text");
stream_puts(s, "]\n");
{
- int i;
+ int i;
- for (i = 0; i < countof(page->resource_ids); ++i)
- if (page->resource_ids[i] && pdf_resource_type_names[i]) {
- stream_puts(s, pdf_resource_type_names[i]);
- pprintld1(s, " %ld 0 R\n", page->resource_ids[i]);
- }
+ for (i = 0; i < countof(page->resource_ids); ++i)
+ if (page->resource_ids[i] && pdf_resource_type_names[i]) {
+ stream_puts(s, pdf_resource_type_names[i]);
+ pprintld1(s, " %ld 0 R\n", page->resource_ids[i]);
+ }
}
stream_puts(s, ">>\n");
/* Write the annotations array if any. */
if (page->Annots) {
- stream_puts(s, "/Annots");
- COS_WRITE(page->Annots, pdev);
- COS_FREE(page->Annots, "pdf_write_page(Annots)");
- page->Annots = 0;
+ stream_puts(s, "/Annots");
+ COS_WRITE(page->Annots, pdev);
+ COS_FREE(page->Annots, "pdf_write_page(Annots)");
+ page->Annots = 0;
}
/*
* The PDF documentation allows, and this code formerly emitted,
@@ -1037,7 +1036,7 @@ pdf_write_page(gx_device_pdf *pdev, int page_num)
* Fortunately, the Contents entry is optional.
*/
if (page->contents_id != 0)
- pprintld1(s, "/Contents %ld 0 R\n", page->contents_id);
+ pprintld1(s, "/Contents %ld 0 R\n", page->contents_id);
/* Write any elements stored by pdfmarks. */
@@ -1056,8 +1055,8 @@ pdf_output_page(gx_device * dev, int num_copies, int flush)
int code = pdf_close_page(pdev, num_copies);
return (code < 0 ? code :
- pdf_ferror(pdev) ? gs_note_error(gs_error_ioerror) :
- gx_finish_output_page(dev, num_copies, flush));
+ pdf_ferror(pdev) ? gs_note_error(gs_error_ioerror) :
+ gx_finish_output_page(dev, num_copies, flush));
}
static int find_end_xref_section (gx_device_pdf *pdev, FILE *tfile, int start, int resource_pos)
@@ -1066,21 +1065,21 @@ static int find_end_xref_section (gx_device_pdf *pdev, FILE *tfile, int start, i
fseek(tfile, start_offset, SEEK_SET);
{
- long i, r;
-
- for (i = start; i < pdev->next_id; ++i) {
- ulong pos;
-
- r = fread(&pos, sizeof(pos), 1, tfile);
- if (r != 1)
- return(gs_note_error(gs_error_ioerror));
- if (pos & ASIDES_BASE_POSITION)
- pos += resource_pos - ASIDES_BASE_POSITION;
- pos -= pdev->OPDFRead_procset_length;
- if (pos == 0) {
- return i;
- }
- }
+ long i, r;
+
+ for (i = start; i < pdev->next_id; ++i) {
+ ulong pos;
+
+ r = fread(&pos, sizeof(pos), 1, tfile);
+ if (r != 1)
+ return(gs_note_error(gs_error_ioerror));
+ if (pos & ASIDES_BASE_POSITION)
+ pos += resource_pos - ASIDES_BASE_POSITION;
+ pos -= pdev->OPDFRead_procset_length;
+ if (pos == 0) {
+ return i;
+ }
+ }
}
return pdev->next_id;
}
@@ -1094,18 +1093,18 @@ static int write_xref_section(gx_device_pdf *pdev, FILE *tfile, int start, int e
long i, r;
for (i = start; i < end; ++i) {
- ulong pos;
- char str[21];
-
- r = fread(&pos, sizeof(pos), 1, tfile);
- if (r != 1)
- return(gs_note_error(gs_error_ioerror));
- if (pos & ASIDES_BASE_POSITION)
- pos += resource_pos - ASIDES_BASE_POSITION;
- pos -= pdev->OPDFRead_procset_length;
- sprintf(str, "%010ld 00000 n \n", pos);
- stream_puts(pdev->strm, str);
- }
+ ulong pos;
+ char str[21];
+
+ r = fread(&pos, sizeof(pos), 1, tfile);
+ if (r != 1)
+ return(gs_note_error(gs_error_ioerror));
+ if (pos & ASIDES_BASE_POSITION)
+ pos += resource_pos - ASIDES_BASE_POSITION;
+ pos -= pdev->OPDFRead_procset_length;
+ sprintf(str, "%010ld 00000 n \n", pos);
+ stream_puts(pdev->strm, str);
+ }
}
return 0;
}
@@ -1121,7 +1120,7 @@ pdf_close(gx_device * dev)
long xref;
long resource_pos;
long Catalog_id = pdev->Catalog->id, Info_id = pdev->Info->id,
- Pages_id = pdev->Pages->id, Encrypt_id = 0;
+ Pages_id = pdev->Pages->id, Encrypt_id = 0;
long Threads_id = 0;
bool partial_page = (pdev->contents_id != 0 && pdev->next_page != 0);
int code = 0, code1, start_section, end_section, pagecount=0;
@@ -1134,199 +1133,199 @@ pdf_close(gx_device * dev)
* marks.
*/
if (pdev->next_page == 0) {
- code = pdf_open_page(pdev, PDF_IN_STREAM);
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (pdev->contents_id != 0)
- pdf_close_page(pdev, 1);
+ pdf_close_page(pdev, 1);
/* Write the page objects. */
if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
- for (pagecount = 1; pagecount <= pdev->next_page; ++pagecount)
- pdf_write_page(pdev, pagecount);
+ for (pagecount = 1; pagecount <= pdev->next_page; ++pagecount)
+ pdf_write_page(pdev, pagecount);
}
if (pdev->PrintStatistics)
- pdf_print_resource_statistics(pdev);
+ pdf_print_resource_statistics(pdev);
/* Write the font resources and related resources. */
code1 = pdf_write_resource_objects(pdev, resourceXObject);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_free_resource_objects(pdev, resourceXObject);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_write_resource_objects(pdev, resourceGroup);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_free_resource_objects(pdev, resourceGroup);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_write_resource_objects(pdev, resourceSoftMaskDict);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_free_resource_objects(pdev, resourceSoftMaskDict);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_close_text_document(pdev);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_write_resource_objects(pdev, resourceCMap);
if (code >= 0)
- code = code1;
+ code = code1;
code1 = pdf_free_resource_objects(pdev, resourceCMap);
if (code >= 0)
- code = code1;
+ code = code1;
if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
- if (pdev->ResourcesBeforeUsage)
- pdf_reverse_resource_chain(pdev, resourcePage);
- code1 = pdf_write_resource_objects(pdev, resourcePage);
- if (code >= 0)
- code = code1;
- code1 = pdf_free_resource_objects(pdev, resourcePage);
- if (code >= 0)
- code = code1;
+ if (pdev->ResourcesBeforeUsage)
+ pdf_reverse_resource_chain(pdev, resourcePage);
+ code1 = pdf_write_resource_objects(pdev, resourcePage);
+ if (code >= 0)
+ code = code1;
+ code1 = pdf_free_resource_objects(pdev, resourcePage);
+ if (code >= 0)
+ code = code1;
}
code1 = pdf_free_resource_objects(pdev, resourceOther);
if (code >= 0)
- code = code1;
+ code = code1;
/* Create the Pages tree. */
if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
- pdf_open_obj(pdev, Pages_id, resourcePagesTree);
- s = pdev->strm;
- stream_puts(s, "<< /Type /Pages /Kids [\n");
- /* Omit the last page if it was incomplete. */
- if (partial_page)
- --(pdev->next_page);
- {
- int i;
-
- for (i = 0; i < pdev->next_page; ++i)
- pprintld1(s, "%ld 0 R\n", pdev->pages[i].Page->id);
- }
- pprintd1(s, "] /Count %d\n", pdev->next_page);
-
- /* If the last file was PostScript, its possible that DSC comments might be lying around
+ pdf_open_obj(pdev, Pages_id, resourcePagesTree);
+ s = pdev->strm;
+ stream_puts(s, "<< /Type /Pages /Kids [\n");
+ /* Omit the last page if it was incomplete. */
+ if (partial_page)
+ --(pdev->next_page);
+ {
+ int i;
+
+ for (i = 0; i < pdev->next_page; ++i)
+ pprintld1(s, "%ld 0 R\n", pdev->pages[i].Page->id);
+ }
+ pprintd1(s, "] /Count %d\n", pdev->next_page);
+
+ /* If the last file was PostScript, its possible that DSC comments might be lying around
* and pdf_print_orientation will use that if its present. So make sure we get rid of those
- * before considering the dominant page direction for the Pages tree.
- */
- pdev->doc_dsc_info.viewing_orientation = pdev->doc_dsc_info.orientation = -1;
- pdev->text_rotation.Rotate = pdf_dominant_rotation(&pdev->text_rotation);
- pdf_print_orientation(pdev, NULL);
-
- cos_dict_elements_write(pdev->Pages, pdev);
- stream_puts(s, ">>\n");
- pdf_end_obj(pdev, resourcePagesTree);
-
- /* Close outlines and articles. */
-
- if (pdev->outlines_id != 0) {
- /* depth > 0 is only possible for an incomplete outline tree. */
- while (pdev->outline_depth > 0) {
- code1 = pdfmark_close_outline(pdev);
- if (code >= 0)
- code = code1;
- }
- code = pdfmark_close_outline(pdev);
- if (code >= 0)
- code = code1;
- pdf_open_obj(pdev, pdev->outlines_id, resourceOutline);
- pprintd1(s, "<< /Count %d", pdev->outlines_open);
- pprintld2(s, " /First %ld 0 R /Last %ld 0 R >>\n",
- pdev->outline_levels[0].first.id,
- pdev->outline_levels[0].last.id);
- pdf_end_obj(pdev, resourceOutline);
- }
- if (pdev->articles != 0) {
- pdf_article_t *part;
-
- /* Write the remaining information for each article. */
- for (part = pdev->articles; part != 0; part = part->next)
- pdfmark_write_article(pdev, part);
- }
-
- /* Write named destinations. (We can't free them yet.) */
-
- if (pdev->Dests)
- COS_WRITE_OBJECT(pdev->Dests, pdev, resourceDests);
-
- /* Write the PageLabel array */
- pdfmark_end_pagelabels(pdev);
- if (pdev->PageLabels) {
- COS_WRITE_OBJECT(pdev->PageLabels, pdev, resourceLabels);
- }
-
- /* Write the document metadata. */
- code1 = pdf_document_metadata(pdev);
- if (code >= 0)
- code = code1;
-
- /* Write the Catalog. */
-
- /*
- * The PDF specification requires Threads to be an indirect object.
- * Write the threads now, if any.
- */
- if (pdev->articles != 0) {
- pdf_article_t *part;
-
- Threads_id = pdf_begin_obj(pdev, resourceThread);
- s = pdev->strm;
- stream_puts(s, "[ ");
- while ((part = pdev->articles) != 0) {
- pdev->articles = part->next;
- pprintld1(s, "%ld 0 R\n", part->contents->id);
- COS_FREE(part->contents, "pdf_close(article contents)");
- gs_free_object(mem, part, "pdf_close(article)");
- }
- stream_puts(s, "]\n");
- pdf_end_obj(pdev, resourceThread);
- }
- pdf_open_obj(pdev, Catalog_id, resourceCatalog);
- s = pdev->strm;
- stream_puts(s, "<<");
- pprintld1(s, "/Type /Catalog /Pages %ld 0 R\n", Pages_id);
- if (pdev->outlines_id != 0)
- pprintld1(s, "/Outlines %ld 0 R\n", pdev->outlines_id);
- if (Threads_id)
- pprintld1(s, "/Threads %ld 0 R\n", Threads_id);
- if (pdev->Dests)
- pprintld1(s, "/Dests %ld 0 R\n", pdev->Dests->id);
- if (pdev->PageLabels)
- pprintld1(s, "/PageLabels << /Nums %ld 0 R >>\n",
+ * before considering the dominant page direction for the Pages tree.
+ */
+ pdev->doc_dsc_info.viewing_orientation = pdev->doc_dsc_info.orientation = -1;
+ pdev->text_rotation.Rotate = pdf_dominant_rotation(&pdev->text_rotation);
+ pdf_print_orientation(pdev, NULL);
+
+ cos_dict_elements_write(pdev->Pages, pdev);
+ stream_puts(s, ">>\n");
+ pdf_end_obj(pdev, resourcePagesTree);
+
+ /* Close outlines and articles. */
+
+ if (pdev->outlines_id != 0) {
+ /* depth > 0 is only possible for an incomplete outline tree. */
+ while (pdev->outline_depth > 0) {
+ code1 = pdfmark_close_outline(pdev);
+ if (code >= 0)
+ code = code1;
+ }
+ code = pdfmark_close_outline(pdev);
+ if (code >= 0)
+ code = code1;
+ pdf_open_obj(pdev, pdev->outlines_id, resourceOutline);
+ pprintd1(s, "<< /Count %d", pdev->outlines_open);
+ pprintld2(s, " /First %ld 0 R /Last %ld 0 R >>\n",
+ pdev->outline_levels[0].first.id,
+ pdev->outline_levels[0].last.id);
+ pdf_end_obj(pdev, resourceOutline);
+ }
+ if (pdev->articles != 0) {
+ pdf_article_t *part;
+
+ /* Write the remaining information for each article. */
+ for (part = pdev->articles; part != 0; part = part->next)
+ pdfmark_write_article(pdev, part);
+ }
+
+ /* Write named destinations. (We can't free them yet.) */
+
+ if (pdev->Dests)
+ COS_WRITE_OBJECT(pdev->Dests, pdev, resourceDests);
+
+ /* Write the PageLabel array */
+ pdfmark_end_pagelabels(pdev);
+ if (pdev->PageLabels) {
+ COS_WRITE_OBJECT(pdev->PageLabels, pdev, resourceLabels);
+ }
+
+ /* Write the document metadata. */
+ code1 = pdf_document_metadata(pdev);
+ if (code >= 0)
+ code = code1;
+
+ /* Write the Catalog. */
+
+ /*
+ * The PDF specification requires Threads to be an indirect object.
+ * Write the threads now, if any.
+ */
+ if (pdev->articles != 0) {
+ pdf_article_t *part;
+
+ Threads_id = pdf_begin_obj(pdev, resourceThread);
+ s = pdev->strm;
+ stream_puts(s, "[ ");
+ while ((part = pdev->articles) != 0) {
+ pdev->articles = part->next;
+ pprintld1(s, "%ld 0 R\n", part->contents->id);
+ COS_FREE(part->contents, "pdf_close(article contents)");
+ gs_free_object(mem, part, "pdf_close(article)");
+ }
+ stream_puts(s, "]\n");
+ pdf_end_obj(pdev, resourceThread);
+ }
+ pdf_open_obj(pdev, Catalog_id, resourceCatalog);
+ s = pdev->strm;
+ stream_puts(s, "<<");
+ pprintld1(s, "/Type /Catalog /Pages %ld 0 R\n", Pages_id);
+ if (pdev->outlines_id != 0)
+ pprintld1(s, "/Outlines %ld 0 R\n", pdev->outlines_id);
+ if (Threads_id)
+ pprintld1(s, "/Threads %ld 0 R\n", Threads_id);
+ if (pdev->Dests)
+ pprintld1(s, "/Dests %ld 0 R\n", pdev->Dests->id);
+ if (pdev->PageLabels)
+ pprintld1(s, "/PageLabels << /Nums %ld 0 R >>\n",
pdev->PageLabels->id);
- cos_dict_elements_write(pdev->Catalog, pdev);
- stream_puts(s, ">>\n");
- pdf_end_obj(pdev, resourceCatalog);
- if (pdev->Dests) {
- COS_FREE(pdev->Dests, "pdf_close(Dests)");
- pdev->Dests = 0;
- }
- if (pdev->PageLabels) {
- COS_FREE(pdev->PageLabels, "pdf_close(PageLabels)");
- pdev->PageLabels = 0;
- pdev->PageLabels_current_label = 0;
- }
-
- /* Prevent writing special named objects twice. */
-
- pdev->Catalog->id = 0;
- /*pdev->Info->id = 0;*/ /* Info should get written */
- pdev->Pages->id = 0;
- {
- int i;
-
- for (i = 0; i < pdev->num_pages; ++i)
- if (pdev->pages[i].Page)
- pdev->pages[i].Page->id = 0;
- }
+ cos_dict_elements_write(pdev->Catalog, pdev);
+ stream_puts(s, ">>\n");
+ pdf_end_obj(pdev, resourceCatalog);
+ if (pdev->Dests) {
+ COS_FREE(pdev->Dests, "pdf_close(Dests)");
+ pdev->Dests = 0;
+ }
+ if (pdev->PageLabels) {
+ COS_FREE(pdev->PageLabels, "pdf_close(PageLabels)");
+ pdev->PageLabels = 0;
+ pdev->PageLabels_current_label = 0;
+ }
+
+ /* Prevent writing special named objects twice. */
+
+ pdev->Catalog->id = 0;
+ /*pdev->Info->id = 0;*/ /* Info should get written */
+ pdev->Pages->id = 0;
+ {
+ int i;
+
+ for (i = 0; i < pdev->num_pages; ++i)
+ if (pdev->pages[i].Page)
+ pdev->pages[i].Page->id = 0;
+ }
} else {
- pdev->Info->id = 0; /* Don't write Info dict for DSC PostScript */
+ pdev->Info->id = 0; /* Don't write Info dict for DSC PostScript */
}
/*
* Write the definitions of the named objects.
@@ -1335,17 +1334,17 @@ pdf_close(gx_device * dev)
*/
do {
- cos_dict_objects_write(pdev->local_named_objects, pdev);
+ cos_dict_objects_write(pdev->local_named_objects, pdev);
} while (pdf_pop_namespace(pdev) >= 0);
cos_dict_objects_write(pdev->global_named_objects, pdev);
if (pdev->ForOPDFRead && pdev->ProduceDSC) {
- int pages;
+ int pages;
- for (pages = 0; pages <= pdev->next_page; ++pages)
- ;
+ for (pages = 0; pages <= pdev->next_page; ++pages)
+ ;
- code = ps2write_dsc_header(pdev, pages - 1);
+ code = ps2write_dsc_header(pdev, pages - 1);
}
/* Copy the resources into the main file. */
@@ -1354,125 +1353,125 @@ pdf_close(gx_device * dev)
resource_pos = stell(s);
sflush(pdev->asides.strm);
{
- FILE *rfile = pdev->asides.file;
- long res_end = ftell(rfile);
+ FILE *rfile = pdev->asides.file;
+ long res_end = ftell(rfile);
- fseek(rfile, 0L, SEEK_SET);
- pdf_copy_data(s, rfile, res_end, NULL);
+ fseek(rfile, 0L, SEEK_SET);
+ pdf_copy_data(s, rfile, res_end, NULL);
}
if (pdev->ForOPDFRead && pdev->ProduceDSC) {
- int j;
-
- code = 0;
- pagecount = 1;
-
- /* All resources and procsets written, end the prolog */
- stream_puts(pdev->strm, "%%EndProlog\n");
-
- if (pdev->ResourcesBeforeUsage)
- pdf_reverse_resource_chain(pdev, resourcePage);
- for (j = 0; j < NUM_RESOURCE_CHAINS && code >= 0; ++j) {
- pdf_resource_t *pres = pdev->resources[resourcePage].chains[j];
-
- for (; pres != 0; pres = pres->next)
- if ((!pres->named || pdev->ForOPDFRead)
- && !pres->object->written) {
- pdf_page_t *page = &pdev->pages[pagecount - 1];
-
- pprintd2(pdev->strm, "%%%%Page: %d %d\n",
- pagecount, pagecount);
- pprintd2(pdev->strm, "%%%%PageBoundingBox: 0 0 %d %d\n", (int)page->MediaBox.x, (int)page->MediaBox.y);
- stream_puts(pdev->strm, "%%BeginPageSetup\n");
- stream_puts(pdev->strm, "/pagesave save def\n");
- pdf_write_page(pdev, pagecount++);
- stream_puts(pdev->strm, "%%EndPageSetup\n");
- pprintld1(pdev->strm, "%ld 0 obj\n", pres->object->id);
- code = cos_write(pres->object, pdev, pres->object->id);
- stream_puts(pdev->strm, "endobj\n");
- pres->object->written = true;
- stream_puts(pdev->strm, "pagesave restore\n%%PageTrailer\n");
- }
- }
- code1 = pdf_free_resource_objects(pdev, resourcePage);
- if (code >= 0)
- code = code1;
- stream_puts(pdev->strm, "%%Trailer\n");
- stream_puts(pdev->strm, "%%EOF\n");
+ int j;
+
+ code = 0;
+ pagecount = 1;
+
+ /* All resources and procsets written, end the prolog */
+ stream_puts(pdev->strm, "%%EndProlog\n");
+
+ if (pdev->ResourcesBeforeUsage)
+ pdf_reverse_resource_chain(pdev, resourcePage);
+ for (j = 0; j < NUM_RESOURCE_CHAINS && code >= 0; ++j) {
+ pdf_resource_t *pres = pdev->resources[resourcePage].chains[j];
+
+ for (; pres != 0; pres = pres->next)
+ if ((!pres->named || pdev->ForOPDFRead)
+ && !pres->object->written) {
+ pdf_page_t *page = &pdev->pages[pagecount - 1];
+
+ pprintd2(pdev->strm, "%%%%Page: %d %d\n",
+ pagecount, pagecount);
+ pprintd2(pdev->strm, "%%%%PageBoundingBox: 0 0 %d %d\n", (int)page->MediaBox.x, (int)page->MediaBox.y);
+ stream_puts(pdev->strm, "%%BeginPageSetup\n");
+ stream_puts(pdev->strm, "/pagesave save def\n");
+ pdf_write_page(pdev, pagecount++);
+ stream_puts(pdev->strm, "%%EndPageSetup\n");
+ pprintld1(pdev->strm, "%ld 0 obj\n", pres->object->id);
+ code = cos_write(pres->object, pdev, pres->object->id);
+ stream_puts(pdev->strm, "endobj\n");
+ pres->object->written = true;
+ stream_puts(pdev->strm, "pagesave restore\n%%PageTrailer\n");
+ }
+ }
+ code1 = pdf_free_resource_objects(pdev, resourcePage);
+ if (code >= 0)
+ code = code1;
+ stream_puts(pdev->strm, "%%Trailer\n");
+ stream_puts(pdev->strm, "%%EOF\n");
}
if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
- /* Write Encrypt. */
- if (pdev->OwnerPassword.size > 0) {
- Encrypt_id = pdf_obj_ref(pdev);
-
- pdf_open_obj(pdev, Encrypt_id, resourceEncrypt);
- s = pdev->strm;
- stream_puts(s, "<<");
- stream_puts(s, "/Filter /Standard ");
- pprintld1(s, "/V %ld ", pdev->EncryptionV);
- pprintld1(s, "/Length %ld ", pdev->KeyLength);
- pprintld1(s, "/R %ld ", pdev->EncryptionR);
- pprintld1(s, "/P %ld ", pdev->Permissions);
- stream_puts(s, "/O ");
- pdf_put_string(pdev, pdev->EncryptionO, sizeof(pdev->EncryptionO));
- stream_puts(s, "\n/U ");
- pdf_put_string(pdev, pdev->EncryptionU, sizeof(pdev->EncryptionU));
- stream_puts(s, ">>\n");
- pdf_end_obj(pdev, resourceEncrypt);
- s = pdev->strm;
- }
-
- /* Write the cross-reference section. */
-
- start_section = pdev->FirstObjectNumber;
- end_section = find_end_xref_section(pdev, tfile, start_section, resource_pos);
-
- xref = pdf_stell(pdev) - pdev->OPDFRead_procset_length;
- if (pdev->FirstObjectNumber == 1)
- pprintld1(s, "xref\n0 %ld\n0000000000 65535 f \n",
- end_section);
- else
- pprintld2(s, "xref\n0 1\n0000000000 65535 f \n%ld %ld\n",
- start_section,
- end_section - start_section);
-
- do {
- write_xref_section(pdev, tfile, start_section, end_section, resource_pos);
- if (end_section >= pdev->next_id)
- break;
- start_section = end_section + 1;
- end_section = find_end_xref_section(pdev, tfile, start_section, resource_pos);
- pprintld2(s, "%ld %ld\n", start_section, end_section - start_section);
- } while (1);
-
- /* Write the trailer. */
-
- stream_puts(s, "trailer\n");
- pprintld3(s, "<< /Size %ld /Root %ld 0 R /Info %ld 0 R\n",
- pdev->next_id, Catalog_id, Info_id);
- stream_puts(s, "/ID [");
- psdf_write_string(pdev->strm, pdev->fileID, sizeof(pdev->fileID), 0);
- psdf_write_string(pdev->strm, pdev->fileID, sizeof(pdev->fileID), 0);
- stream_puts(s, "]\n");
- if (pdev->OwnerPassword.size > 0) {
- pprintld1(s, "/Encrypt %ld 0 R ", Encrypt_id);
- }
- stream_puts(s, ">>\n");
- pprintld1(s, "startxref\n%ld\n%%%%EOF\n", xref);
+ /* Write Encrypt. */
+ if (pdev->OwnerPassword.size > 0) {
+ Encrypt_id = pdf_obj_ref(pdev);
+
+ pdf_open_obj(pdev, Encrypt_id, resourceEncrypt);
+ s = pdev->strm;
+ stream_puts(s, "<<");
+ stream_puts(s, "/Filter /Standard ");
+ pprintld1(s, "/V %ld ", pdev->EncryptionV);
+ pprintld1(s, "/Length %ld ", pdev->KeyLength);
+ pprintld1(s, "/R %ld ", pdev->EncryptionR);
+ pprintld1(s, "/P %ld ", pdev->Permissions);
+ stream_puts(s, "/O ");
+ pdf_put_string(pdev, pdev->EncryptionO, sizeof(pdev->EncryptionO));
+ stream_puts(s, "\n/U ");
+ pdf_put_string(pdev, pdev->EncryptionU, sizeof(pdev->EncryptionU));
+ stream_puts(s, ">>\n");
+ pdf_end_obj(pdev, resourceEncrypt);
+ s = pdev->strm;
+ }
+
+ /* Write the cross-reference section. */
+
+ start_section = pdev->FirstObjectNumber;
+ end_section = find_end_xref_section(pdev, tfile, start_section, resource_pos);
+
+ xref = pdf_stell(pdev) - pdev->OPDFRead_procset_length;
+ if (pdev->FirstObjectNumber == 1)
+ pprintld1(s, "xref\n0 %ld\n0000000000 65535 f \n",
+ end_section);
+ else
+ pprintld2(s, "xref\n0 1\n0000000000 65535 f \n%ld %ld\n",
+ start_section,
+ end_section - start_section);
+
+ do {
+ write_xref_section(pdev, tfile, start_section, end_section, resource_pos);
+ if (end_section >= pdev->next_id)
+ break;
+ start_section = end_section + 1;
+ end_section = find_end_xref_section(pdev, tfile, start_section, resource_pos);
+ pprintld2(s, "%ld %ld\n", start_section, end_section - start_section);
+ } while (1);
+
+ /* Write the trailer. */
+
+ stream_puts(s, "trailer\n");
+ pprintld3(s, "<< /Size %ld /Root %ld 0 R /Info %ld 0 R\n",
+ pdev->next_id, Catalog_id, Info_id);
+ stream_puts(s, "/ID [");
+ psdf_write_string(pdev->strm, pdev->fileID, sizeof(pdev->fileID), 0);
+ psdf_write_string(pdev->strm, pdev->fileID, sizeof(pdev->fileID), 0);
+ stream_puts(s, "]\n");
+ if (pdev->OwnerPassword.size > 0) {
+ pprintld1(s, "/Encrypt %ld 0 R ", Encrypt_id);
+ }
+ stream_puts(s, ">>\n");
+ pprintld1(s, "startxref\n%ld\n%%%%EOF\n", xref);
}
/* Release the resource records. */
{
- pdf_resource_t *pres;
- pdf_resource_t *prev;
-
- for (prev = pdev->last_resource; (pres = prev) != 0;) {
- prev = pres->prev;
- gs_free_object(mem, pres, "pdf_resource_t");
- }
- pdev->last_resource = 0;
+ pdf_resource_t *pres;
+ pdf_resource_t *prev;
+
+ for (prev = pdev->last_resource; (pres = prev) != 0;) {
+ prev = pres->prev;
+ gs_free_object(mem, pres, "pdf_resource_t");
+ }
+ pdev->last_resource = 0;
}
/* Free named objects. */
@@ -1493,30 +1492,30 @@ pdf_close(gx_device * dev)
if (pdev->ForOPDFRead && pdev->OPDFReadProcsetPath.size) {
/* pdf_open_dcument could set up filters for entire document.
Removing them now. */
- int status;
-
- if (!pdev->ProduceDSC)
- stream_putc(s, 0x04);
- while (s->strm) {
- s = s->strm;
- }
- status = s_close_filters(&pdev->strm, s);
- if (status < 0 && code == 0)
- code = gs_error_ioerror;
+ int status;
+
+ if (!pdev->ProduceDSC)
+ stream_putc(s, 0x04);
+ while (s->strm) {
+ s = s->strm;
+ }
+ status = s_close_filters(&pdev->strm, s);
+ if (status < 0 && code == 0)
+ code = gs_error_ioerror;
}
code1 = gdev_vector_close_file((gx_device_vector *) pdev);
if (code >= 0)
- code = code1;
+ code = code1;
if (pdev->max_referred_page >= pdev->next_page + 1) {
- /* Note : pdev->max_referred_page counts from 1,
- and pdev->next_page counts from 0. */
- emprintf2(pdev->memory, "ERROR: A pdfmark destination page %d "
+ /* Note : pdev->max_referred_page counts from 1,
+ and pdev->next_page counts from 0. */
+ emprintf2(pdev->memory, "ERROR: A pdfmark destination page %d "
"points beyond the last page %d.\n",
pdev->max_referred_page, pdev->next_page);
#if 0 /* Temporary disabled due to Bug 687686. */
- if (code >= 0)
- code = gs_note_error(gs_error_rangecheck);
+ if (code >= 0)
+ code = gs_note_error(gs_error_rangecheck);
#endif
}
return pdf_close_files(pdev, code);
diff --git a/gs/base/gdevpdfb.c b/gs/base/gdevpdfb.c
index 8d1f55d76..6008cd592 100644
--- a/gs/base/gdevpdfb.c
+++ b/gs/base/gdevpdfb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,9 +48,9 @@ pdf_make_bitmap_image(gs_image_t * pim, int x, int y, int w, int h)
/* 1 means put the image in a resource. */
static int
pdf_copy_mask_data(gx_device_pdf * pdev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gs_image_t *pim, pdf_image_writer *piw,
- int for_pattern)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gs_image_t *pim, pdf_image_writer *piw,
+ int for_pattern)
{
ulong nbytes;
int code;
@@ -63,27 +63,27 @@ pdf_copy_mask_data(gx_device_pdf * pdev, const byte * base, int sourcex,
nbytes = ((ulong)w * h + 7) / 8;
if (for_pattern) {
- /*
- * Patterns must be emitted in order of increasing user Y, i.e.,
- * the opposite of PDF's standard image order.
- */
- row_base = base + (h - 1) * raster;
- row_step = -raster;
- in_line = for_pattern < 0;
+ /*
+ * Patterns must be emitted in order of increasing user Y, i.e.,
+ * the opposite of PDF's standard image order.
+ */
+ row_base = base + (h - 1) * raster;
+ row_step = -raster;
+ in_line = for_pattern < 0;
} else {
- row_base = base;
- row_step = raster;
- in_line = nbytes < pdev->MaxInlineImageSize;
- pdf_put_image_matrix(pdev, &pim->ImageMatrix, 1.0);
- /*
- * Check whether we've already made an XObject resource for this
- * image.
- */
- if (id != gx_no_bitmap_id) {
- piw->pres = pdf_find_resource_by_gs_id(pdev, resourceXObject, id);
- if (piw->pres)
- return 0;
- }
+ row_base = base;
+ row_step = raster;
+ in_line = nbytes < pdev->MaxInlineImageSize;
+ pdf_put_image_matrix(pdev, &pim->ImageMatrix, 1.0);
+ /*
+ * Check whether we've already made an XObject resource for this
+ * image.
+ */
+ if (id != gx_no_bitmap_id) {
+ piw->pres = pdf_find_resource_by_gs_id(pdev, resourceXObject, id);
+ if (piw->pres)
+ return 0;
+ }
}
/*
* We have to be able to control whether to put Pattern images in line,
@@ -91,39 +91,39 @@ pdf_copy_mask_data(gx_device_pdf * pdev, const byte * base, int sourcex,
* middle of writing a Pattern resource.
*/
if (for_pattern < 0)
- stream_puts(pdev->strm, "q ");
+ stream_puts(pdev->strm, "q ");
pdf_image_writer_init(piw);
pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
if ((code = pdf_begin_write_image(pdev, piw, id, w, h, NULL, in_line)) < 0 ||
- (code = psdf_setup_lossless_filters((gx_device_psdf *) pdev,
- &piw->binary[0],
- (gs_pixel_image_t *)pim, in_line)) < 0 ||
- (code = pdf_begin_image_data(pdev, piw, (const gs_pixel_image_t *)pim,
- NULL, 0)) < 0
- )
- return code;
+ (code = psdf_setup_lossless_filters((gx_device_psdf *) pdev,
+ &piw->binary[0],
+ (gs_pixel_image_t *)pim, in_line)) < 0 ||
+ (code = pdf_begin_image_data(pdev, piw, (const gs_pixel_image_t *)pim,
+ NULL, 0)) < 0
+ )
+ return code;
pdf_copy_mask_bits(piw->binary[0].strm, row_base, sourcex, row_step, w, h, 0);
pdf_end_image_binary(pdev, piw, piw->height);
return pdf_end_write_image(pdev, piw);
}
-static void
+static void
set_image_color(gx_device_pdf *pdev, gx_color_index c)
{
pdf_set_pure_color(pdev, c, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands);
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands);
if (!pdev->HaveStrokeColor)
- pdf_set_pure_color(pdev, c, &pdev->saved_stroke_color,
- &pdev->stroke_used_process_color,
- &psdf_set_stroke_color_commands);
+ pdf_set_pure_color(pdev, c, &pdev->saved_stroke_color,
+ &pdev->stroke_used_process_color,
+ &psdf_set_stroke_color_commands);
}
static int
pdf_copy_mono(gx_device_pdf *pdev,
- const byte *base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero,
- gx_color_index one, const gx_clip_path *pcpath)
+ const byte *base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero,
+ gx_color_index one, const gx_clip_path *pcpath)
{
int code;
gs_color_space *pcs = NULL;
@@ -142,145 +142,145 @@ pdf_copy_mono(gx_device_pdf *pdev,
/* Update clipping. */
if (pdf_must_put_clip_path(pdev, pcpath)) {
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- code = pdf_put_clip_path(pdev, pcpath);
- if (code < 0)
- return code;
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ code = pdf_put_clip_path(pdev, pcpath);
+ if (code < 0)
+ return code;
}
/* We have 3 cases: mask, inverse mask, and solid. */
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- /* If a mask has an id, assume it's a character. */
- if (id != gx_no_bitmap_id && sourcex == 0 && show_enum) {
- pdf_char_proc_t *pcp;
+ if (one == gx_no_color_index)
+ return 0;
+ /* If a mask has an id, assume it's a character. */
+ if (id != gx_no_bitmap_id && sourcex == 0 && show_enum) {
+ pdf_char_proc_t *pcp;
- if (show_enum->use_wxy_float)
- pdev->char_width.x = show_enum->wxy_float.x;
- else
- pdev->char_width.x = fixed2float(show_enum->wxy.x);
- pres = pdf_find_resource_by_gs_id(pdev, resourceCharProc, id);
- if (pres == 0) { /* Define the character in an embedded font. */
- gs_image_t_init_mask(&image, false);
- invert = 0xff;
- x_offset = x - (int)show_enum->pis->current_point.x;
- y_offset = y - (int)show_enum->pis->current_point.y;
- x -= x_offset;
- y -= y_offset;
- y -= h;
- pdf_make_bitmap_image(&image, x, y, w, h);
- /*
- * The Y axis of the text matrix is inverted,
- * so we need to negate the Y offset appropriately.
- */
- code = pdf_begin_char_proc(pdev, w, h, 0, y_offset, x_offset, id,
- &pcp, &ipos);
- if (code < 0)
- return code;
- y_offset = -y_offset;
- width = psdf_round(pdev->char_width.x, 100, 10); /* See
- pdf_write_Widths about rounding. We need to provide
- a compatible data for Tj. */
- pprintg1(pdev->strm, "%g ", width);
- pprintd4(pdev->strm, "0 %d %d %d %d d1\n", x_offset, -h + y_offset, w + x_offset, y_offset);
- pprintd4(pdev->strm, "%d 0 0 %d %d %d cm\n", w, h, x_offset,
- -h + y_offset);
- pdf_image_writer_init(&writer);
- code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, true);
- if (code < 0)
- return code;
- pres = (pdf_resource_t *) pcp;
- goto wr;
- } else if (pdev->pte) {
- /* We're under pdf_text_process. It set a high level color. */
- } else
- set_image_color(pdev, one);
- pcp = (pdf_char_proc_t *) pres;
- x -= pdf_charproc_x_offset(pcp);
- y -= pdf_charproc_y_offset(pcp);
- y -= h;
- pdf_make_bitmap_image(&image, x, y, w, h);
- goto rx;
- }
- set_image_color(pdev, one);
- gs_image_t_init_mask(&image, false);
- invert = 0xff;
+ if (show_enum->use_wxy_float)
+ pdev->char_width.x = show_enum->wxy_float.x;
+ else
+ pdev->char_width.x = fixed2float(show_enum->wxy.x);
+ pres = pdf_find_resource_by_gs_id(pdev, resourceCharProc, id);
+ if (pres == 0) { /* Define the character in an embedded font. */
+ gs_image_t_init_mask(&image, false);
+ invert = 0xff;
+ x_offset = x - (int)show_enum->pis->current_point.x;
+ y_offset = y - (int)show_enum->pis->current_point.y;
+ x -= x_offset;
+ y -= y_offset;
+ y -= h;
+ pdf_make_bitmap_image(&image, x, y, w, h);
+ /*
+ * The Y axis of the text matrix is inverted,
+ * so we need to negate the Y offset appropriately.
+ */
+ code = pdf_begin_char_proc(pdev, w, h, 0, y_offset, x_offset, id,
+ &pcp, &ipos);
+ if (code < 0)
+ return code;
+ y_offset = -y_offset;
+ width = psdf_round(pdev->char_width.x, 100, 10); /* See
+ pdf_write_Widths about rounding. We need to provide
+ a compatible data for Tj. */
+ pprintg1(pdev->strm, "%g ", width);
+ pprintd4(pdev->strm, "0 %d %d %d %d d1\n", x_offset, -h + y_offset, w + x_offset, y_offset);
+ pprintd4(pdev->strm, "%d 0 0 %d %d %d cm\n", w, h, x_offset,
+ -h + y_offset);
+ pdf_image_writer_init(&writer);
+ code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, true);
+ if (code < 0)
+ return code;
+ pres = (pdf_resource_t *) pcp;
+ goto wr;
+ } else if (pdev->pte) {
+ /* We're under pdf_text_process. It set a high level color. */
+ } else
+ set_image_color(pdev, one);
+ pcp = (pdf_char_proc_t *) pres;
+ x -= pdf_charproc_x_offset(pcp);
+ y -= pdf_charproc_y_offset(pcp);
+ y -= h;
+ pdf_make_bitmap_image(&image, x, y, w, h);
+ goto rx;
+ }
+ set_image_color(pdev, one);
+ gs_image_t_init_mask(&image, false);
+ invert = 0xff;
} else if (one == gx_no_color_index) {
- gs_image_t_init_mask(&image, false);
- set_image_color(pdev, zero);
+ gs_image_t_init_mask(&image, false);
+ set_image_color(pdev, zero);
} else if (zero == pdev->black && one == pdev->white) {
- pcs = gs_cspace_new_DeviceGray(pdev->memory);
- gs_image_t_init(&image, pcs);
+ pcs = gs_cspace_new_DeviceGray(pdev->memory);
+ gs_image_t_init(&image, pcs);
} else if (zero == pdev->white && one == pdev->black) {
- pcs = gs_cspace_new_DeviceGray(pdev->memory);
- gs_image_t_init(&image, pcs);
- invert = 0xff;
+ pcs = gs_cspace_new_DeviceGray(pdev->memory);
+ gs_image_t_init(&image, pcs);
+ invert = 0xff;
} else {
- /*
- * We think this code is never executed when interpreting PostScript
- * or PDF: the library never uses monobit non-mask images
- * internally, and high-level images don't go through this code.
- * However, we still want the code to work.
- */
- gs_color_space *pcs_base;
- gx_color_index c[2];
- int i, j;
- int ncomp = pdev->color_info.num_components;
- byte *p;
+ /*
+ * We think this code is never executed when interpreting PostScript
+ * or PDF: the library never uses monobit non-mask images
+ * internally, and high-level images don't go through this code.
+ * However, we still want the code to work.
+ */
+ gs_color_space *pcs_base;
+ gx_color_index c[2];
+ int i, j;
+ int ncomp = pdev->color_info.num_components;
+ byte *p;
- code = pdf_cspace_init_Device(pdev->memory, &pcs_base, ncomp);
- if (code < 0)
- return code;
- c[0] = psdf_adjust_color_index((gx_device_vector *)pdev, zero);
- c[1] = psdf_adjust_color_index((gx_device_vector *)pdev, one);
- pcs = gs_cspace_alloc(pdev->memory, &gs_color_space_type_Indexed);
- if (pcs == NULL) {
- rc_decrement_cs(pcs_base, "pdf_copy_mono");
- return_error(gs_error_VMerror);
- }
- pcs->base_space = pcs_base;
- pcs->params.indexed.hival = 1;
- pcs->params.indexed.n_comps = ncomp;
- p = palette;
- for (i = 0; i < 2; ++i)
- for (j = ncomp - 1; j >= 0; --j)
- *p++ = (byte)(c[i] >> (j * 8));
- pcs->params.indexed.lookup.table.data = palette;
- pcs->params.indexed.lookup.table.size = p - palette;
- pcs->params.indexed.use_proc = false;
- gs_image_t_init(&image, pcs);
- image.BitsPerComponent = 1;
+ code = pdf_cspace_init_Device(pdev->memory, &pcs_base, ncomp);
+ if (code < 0)
+ return code;
+ c[0] = psdf_adjust_color_index((gx_device_vector *)pdev, zero);
+ c[1] = psdf_adjust_color_index((gx_device_vector *)pdev, one);
+ pcs = gs_cspace_alloc(pdev->memory, &gs_color_space_type_Indexed);
+ if (pcs == NULL) {
+ rc_decrement_cs(pcs_base, "pdf_copy_mono");
+ return_error(gs_error_VMerror);
+ }
+ pcs->base_space = pcs_base;
+ pcs->params.indexed.hival = 1;
+ pcs->params.indexed.n_comps = ncomp;
+ p = palette;
+ for (i = 0; i < 2; ++i)
+ for (j = ncomp - 1; j >= 0; --j)
+ *p++ = (byte)(c[i] >> (j * 8));
+ pcs->params.indexed.lookup.table.data = palette;
+ pcs->params.indexed.lookup.table.size = p - palette;
+ pcs->params.indexed.use_proc = false;
+ gs_image_t_init(&image, pcs);
+ image.BitsPerComponent = 1;
}
pdf_make_bitmap_image(&image, x, y, w, h);
{
- ulong nbytes = (ulong) ((w + 7) >> 3) * h;
+ ulong nbytes = (ulong) ((w + 7) >> 3) * h;
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- in_line = nbytes < pdev->MaxInlineImageSize;
- if (in_line)
- pdf_put_image_matrix(pdev, &image.ImageMatrix, 1.0);
- pdf_image_writer_init(&writer);
- code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, in_line);
- if (code < 0)
- return code;
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ in_line = nbytes < pdev->MaxInlineImageSize;
+ if (in_line)
+ pdf_put_image_matrix(pdev, &image.ImageMatrix, 1.0);
+ pdf_image_writer_init(&writer);
+ code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, in_line);
+ if (code < 0)
+ return code;
}
wr:
if (image.ImageMask)
- pcsvalue = NULL;
+ pcsvalue = NULL;
else {
- /*
- * We don't have to worry about color space scaling: the color
- * space is always a Device space.
- */
- code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
- &writer.pin->color_spaces, in_line, NULL, 0);
- if (code < 0)
- return code;
- pcsvalue = &cs_value;
+ /*
+ * We don't have to worry about color space scaling: the color
+ * space is always a Device space.
+ */
+ code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
+ &writer.pin->color_spaces, in_line, NULL, 0);
+ if (code < 0)
+ return code;
+ pcsvalue = &cs_value;
}
/*
* There are 3 different cases at this point:
@@ -293,84 +293,84 @@ pdf_copy_mono(gx_device_pdf *pdev,
* that would need to be passed.
*/
if (pres) {
- /*
- * Always use CCITTFax 2-D for character bitmaps. It takes less
- * space to invert the data with Decode than to set BlackIs1.
- */
- float d0 = image.Decode[0];
+ /*
+ * Always use CCITTFax 2-D for character bitmaps. It takes less
+ * space to invert the data with Decode than to set BlackIs1.
+ */
+ float d0 = image.Decode[0];
- image.Decode[0] = image.Decode[1];
- image.Decode[1] = d0;
- psdf_CFE_binary(&writer.binary[0], image.Width, image.Height, true);
- invert ^= 0xff;
+ image.Decode[0] = image.Decode[1];
+ image.Decode[1] = d0;
+ psdf_CFE_binary(&writer.binary[0], image.Width, image.Height, true);
+ invert ^= 0xff;
} else {
- /* Use the Distiller compression parameters. */
- pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
- psdf_setup_image_filters((gx_device_psdf *) pdev, &writer.binary[0],
- (gs_pixel_image_t *)&image, NULL, NULL, true, in_line);
+ /* Use the Distiller compression parameters. */
+ pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
+ psdf_setup_image_filters((gx_device_psdf *) pdev, &writer.binary[0],
+ (gs_pixel_image_t *)&image, NULL, NULL, true, in_line);
}
pdf_begin_image_data(pdev, &writer, (const gs_pixel_image_t *)&image,
- pcsvalue, 0);
+ pcsvalue, 0);
code = pdf_copy_mask_bits(writer.binary[0].strm, base, sourcex, raster,
- w, h, invert);
+ w, h, invert);
if (code < 0)
- return code;
+ return code;
pdf_end_image_binary(pdev, &writer, writer.height);
if (!pres) {
- switch ((code = pdf_end_write_image(pdev, &writer))) {
- default: /* error */
- return code;
- case 1:
- return 0;
- case 0:
- return pdf_do_image(pdev, writer.pres, &image.ImageMatrix,
- true);
- }
+ switch ((code = pdf_end_write_image(pdev, &writer))) {
+ default: /* error */
+ return code;
+ case 1:
+ return 0;
+ case 0:
+ return pdf_do_image(pdev, writer.pres, &image.ImageMatrix,
+ true);
+ }
}
writer.end_string = ""; /* no Q */
switch ((code = pdf_end_write_image(pdev, &writer))) {
default: /* error */
- return code;
+ return code;
case 0: /* not possible */
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
case 1:
- break;
+ break;
}
code = pdf_end_char_proc(pdev, &ipos);
if (code < 0)
- return code;
+ return code;
rx:{
- gs_matrix imat;
+ gs_matrix imat;
- imat = image.ImageMatrix;
- imat.xx /= w;
- imat.xy /= h;
- imat.yx /= w;
- imat.yy /= h;
- return pdf_do_char_image(pdev, (const pdf_char_proc_t *)pres, &imat);
+ imat = image.ImageMatrix;
+ imat.xx /= w;
+ imat.xy /= h;
+ imat.yx /= w;
+ imat.yy /= h;
+ return pdf_do_char_image(pdev, (const pdf_char_proc_t *)pres, &imat);
}
}
int
gdev_pdf_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero,
- gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero,
+ gx_color_index one)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
return pdf_copy_mono(pdev, base, sourcex, raster, id, x, y, w, h,
- zero, one, NULL);
+ zero, one, NULL);
}
/* Copy a color bitmap. for_pattern = -1 means put the image in-line, */
/* 1 means put the image in a resource, 2 means image is a rasterized shading. */
int
pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gs_image_t *pim, pdf_image_writer *piw,
- int for_pattern)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gs_image_t *pim, pdf_image_writer *piw,
+ int for_pattern)
{
int depth = pdev->color_info.depth;
int bytes_per_pixel = depth >> 3;
@@ -383,34 +383,34 @@ pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
bool in_line;
if (code < 0)
- return code; /* can't happen */
+ return code; /* can't happen */
gs_image_t_init(pim, pcs);
pdf_make_bitmap_image(pim, x, y, w, h);
pim->BitsPerComponent = 8;
nbytes = (ulong)w * bytes_per_pixel * h;
if (for_pattern == 1) {
- /*
- * Patterns must be emitted in order of increasing user Y, i.e.,
- * the opposite of PDF's standard image order.
- */
- row_base = base + (h - 1) * raster;
- row_step = -raster;
- in_line = for_pattern < 0;
+ /*
+ * Patterns must be emitted in order of increasing user Y, i.e.,
+ * the opposite of PDF's standard image order.
+ */
+ row_base = base + (h - 1) * raster;
+ row_step = -raster;
+ in_line = for_pattern < 0;
} else {
- row_base = base;
- row_step = raster;
- in_line = nbytes < pdev->MaxInlineImageSize;
- pdf_put_image_matrix(pdev, &pim->ImageMatrix, 1.0);
- /*
- * Check whether we've already made an XObject resource for this
- * image.
- */
- if (id != gx_no_bitmap_id) {
- piw->pres = pdf_find_resource_by_gs_id(pdev, resourceXObject, id);
- if (piw->pres)
- return 0;
- }
+ row_base = base;
+ row_step = raster;
+ in_line = nbytes < pdev->MaxInlineImageSize;
+ pdf_put_image_matrix(pdev, &pim->ImageMatrix, 1.0);
+ /*
+ * Check whether we've already made an XObject resource for this
+ * image.
+ */
+ if (id != gx_no_bitmap_id) {
+ piw->pres = pdf_find_resource_by_gs_id(pdev, resourceXObject, id);
+ if (piw->pres)
+ return 0;
+ }
}
/*
* We have to be able to control whether to put Pattern images in line,
@@ -418,7 +418,7 @@ pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
* middle of writing a Pattern resource.
*/
if (for_pattern < 0)
- stream_puts(pdev->strm, "q ");
+ stream_puts(pdev->strm, "q ");
/*
* We don't have to worry about color space scaling: the color
* space is always a Device space.
@@ -426,222 +426,222 @@ pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
pdf_image_writer_init(piw);
pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
if ((code = pdf_begin_write_image(pdev, piw, id, w, h, NULL, in_line)) < 0 ||
- (code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
- &piw->pin->color_spaces, in_line, NULL, 0)) < 0 ||
- (for_pattern < 2 || nbytes < 512000 ?
- (code = psdf_setup_lossless_filters((gx_device_psdf *) pdev,
- &piw->binary[0], (gs_pixel_image_t *)pim, false)) :
- (code = psdf_setup_image_filters((gx_device_psdf *) pdev,
- &piw->binary[0], (gs_pixel_image_t *)pim, NULL, NULL, false, false))
- ) < 0 ||
- (code = pdf_begin_image_data(pdev, piw, (const gs_pixel_image_t *)pim,
- &cs_value, 0)) < 0
- )
- return code;
+ (code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
+ &piw->pin->color_spaces, in_line, NULL, 0)) < 0 ||
+ (for_pattern < 2 || nbytes < 512000 ?
+ (code = psdf_setup_lossless_filters((gx_device_psdf *) pdev,
+ &piw->binary[0], (gs_pixel_image_t *)pim, false)) :
+ (code = psdf_setup_image_filters((gx_device_psdf *) pdev,
+ &piw->binary[0], (gs_pixel_image_t *)pim, NULL, NULL, false, false))
+ ) < 0 ||
+ (code = pdf_begin_image_data(pdev, piw, (const gs_pixel_image_t *)pim,
+ &cs_value, 0)) < 0
+ )
+ return code;
pdf_copy_color_bits(piw->binary[0].strm, row_base, sourcex, row_step, w, h,
- bytes_per_pixel);
+ bytes_per_pixel);
pdf_end_image_binary(pdev, piw, piw->height);
return pdf_end_write_image(pdev, piw);
}
int
gdev_pdf_copy_color(gx_device * dev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
gs_image_t image;
pdf_image_writer writer;
int code;
-
+
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
/* Make sure we aren't being clipped. */
code = pdf_put_clip_path(pdev, NULL);
if (code < 0)
- return code;
+ return code;
code = pdf_copy_color_data(pdev, base, sourcex, raster, id, x, y, w, h,
- &image, &writer, 0);
+ &image, &writer, 0);
switch (code) {
- default:
- return code; /* error */
- case 1:
- return 0;
- case 0:
- return pdf_do_image(pdev, writer.pres, NULL, true);
+ default:
+ return code; /* error */
+ case 1:
+ return 0;
+ case 0:
+ return pdf_do_image(pdev, writer.pres, NULL, true);
}
}
/* Fill a mask. */
int
gdev_pdf_fill_mask(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
if (width <= 0 || height <= 0)
- return 0;
+ return 0;
if (depth > 1 || (!gx_dc_is_pure(pdcolor) != 0 && !(gx_dc_is_pattern1_color(pdcolor))))
- return gx_default_fill_mask(dev, data, data_x, raster, id,
- x, y, width, height, pdcolor, depth, lop,
- pcpath);
+ return gx_default_fill_mask(dev, data, data_x, raster, id,
+ x, y, width, height, pdcolor, depth, lop,
+ pcpath);
return pdf_copy_mono(pdev, data, data_x, raster, id, x, y, width, height,
- gx_no_color_index, gx_dc_pure_color(pdcolor),
- pcpath);
+ gx_no_color_index, gx_dc_pure_color(pdcolor),
+ pcpath);
}
/* Tile with a bitmap. This is important for pattern fills. */
int
gdev_pdf_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1,
+ int px, int py)
{
gx_device_pdf *const pdev = (gx_device_pdf *) dev;
int tw = tiles->rep_width, th = tiles->rep_height;
double xscale = pdev->HWResolution[0] / 72.0,
- yscale = pdev->HWResolution[1] / 72.0;
+ yscale = pdev->HWResolution[1] / 72.0;
bool mask;
int depth;
int (*copy_data)(gx_device_pdf *, const byte *, int, int,
- gx_bitmap_id, int, int, int, int,
- gs_image_t *, pdf_image_writer *, int);
+ gx_bitmap_id, int, int, int, int,
+ gs_image_t *, pdf_image_writer *, int);
pdf_resource_t *pres;
cos_value_t cs_value;
int code;
if (tiles->id == gx_no_bitmap_id || tiles->shift != 0 ||
- (w < tw && h < th) ||
- color0 != gx_no_color_index
- )
- goto use_default;
+ (w < tw && h < th) ||
+ color0 != gx_no_color_index
+ )
+ goto use_default;
if (color1 != gx_no_color_index) {
- /* This is a mask pattern. */
- mask = true;
- depth = 1;
- copy_data = pdf_copy_mask_data;
- code = pdf_cs_Pattern_uncolored(pdev, &cs_value);
+ /* This is a mask pattern. */
+ mask = true;
+ depth = 1;
+ copy_data = pdf_copy_mask_data;
+ code = pdf_cs_Pattern_uncolored(pdev, &cs_value);
} else {
- /* This is a colored pattern. */
- mask = false;
- depth = pdev->color_info.depth;
- copy_data = pdf_copy_color_data;
- code = pdf_cs_Pattern_colored(pdev, &cs_value);
+ /* This is a colored pattern. */
+ mask = false;
+ depth = pdev->color_info.depth;
+ copy_data = pdf_copy_color_data;
+ code = pdf_cs_Pattern_colored(pdev, &cs_value);
}
if (code < 0)
- goto use_default;
+ goto use_default;
pres = pdf_find_resource_by_gs_id(pdev, resourcePattern, tiles->id);
if (!pres) {
- /* Create the Pattern resource. */
- int code;
- long image_id, length_id, start, end;
- stream *s;
- gs_image_t image;
- pdf_image_writer writer;
- long image_bytes = ((long)tw * depth + 7) / 8 * th;
- bool in_line = image_bytes < pdev->MaxInlineImageSize;
- ulong tile_id =
- (tw == tiles->size.x && th == tiles->size.y ? tiles->id :
- gx_no_bitmap_id);
+ /* Create the Pattern resource. */
+ int code;
+ long image_id, length_id, start, end;
+ stream *s;
+ gs_image_t image;
+ pdf_image_writer writer;
+ long image_bytes = ((long)tw * depth + 7) / 8 * th;
+ bool in_line = image_bytes < pdev->MaxInlineImageSize;
+ ulong tile_id =
+ (tw == tiles->size.x && th == tiles->size.y ? tiles->id :
+ gx_no_bitmap_id);
- if (in_line)
- image_id = 0;
- else if (image_bytes > 65500) {
- /*
- * Acrobat Reader can't handle image Patterns with more than
- * 64K of data. :-(
- */
- goto use_default;
- } else {
- /* Write the image as an XObject resource now. */
- code = copy_data(pdev, tiles->data, 0, tiles->raster,
- tile_id, 0, 0, tw, th, &image, &writer, 1);
- if (code < 0)
- goto use_default;
- image_id = pdf_resource_id(writer.pres);
- }
- code = pdf_begin_resource(pdev, resourcePattern, tiles->id, &pres);
- if (code < 0)
- goto use_default;
- s = pdev->strm;
- pprintd1(s, "/PatternType 1/PaintType %d/TilingType 1/Resources<<\n",
- (mask ? 2 : 1));
- if (image_id)
- pprintld2(s, "/XObject<</R%ld %ld 0 R>>", image_id, image_id);
- pprints1(s, "/ProcSet[/PDF/Image%s]>>\n", (mask ? "B" : "C"));
- /*
- * Because of bugs in Acrobat Reader's Print function, we can't use
- * the natural BBox and Step here: they have to be 1.
- */
- pprintg2(s, "/Matrix[%g 0 0 %g 0 0]", tw / xscale, th / yscale);
- stream_puts(s, "/BBox[0 0 1 1]/XStep 1/YStep 1/Length ");
- if (image_id) {
- char buf[MAX_REF_CHARS + 6 + 1]; /* +6 for /R# Do\n */
+ if (in_line)
+ image_id = 0;
+ else if (image_bytes > 65500) {
+ /*
+ * Acrobat Reader can't handle image Patterns with more than
+ * 64K of data. :-(
+ */
+ goto use_default;
+ } else {
+ /* Write the image as an XObject resource now. */
+ code = copy_data(pdev, tiles->data, 0, tiles->raster,
+ tile_id, 0, 0, tw, th, &image, &writer, 1);
+ if (code < 0)
+ goto use_default;
+ image_id = pdf_resource_id(writer.pres);
+ }
+ code = pdf_begin_resource(pdev, resourcePattern, tiles->id, &pres);
+ if (code < 0)
+ goto use_default;
+ s = pdev->strm;
+ pprintd1(s, "/PatternType 1/PaintType %d/TilingType 1/Resources<<\n",
+ (mask ? 2 : 1));
+ if (image_id)
+ pprintld2(s, "/XObject<</R%ld %ld 0 R>>", image_id, image_id);
+ pprints1(s, "/ProcSet[/PDF/Image%s]>>\n", (mask ? "B" : "C"));
+ /*
+ * Because of bugs in Acrobat Reader's Print function, we can't use
+ * the natural BBox and Step here: they have to be 1.
+ */
+ pprintg2(s, "/Matrix[%g 0 0 %g 0 0]", tw / xscale, th / yscale);
+ stream_puts(s, "/BBox[0 0 1 1]/XStep 1/YStep 1/Length ");
+ if (image_id) {
+ char buf[MAX_REF_CHARS + 6 + 1]; /* +6 for /R# Do\n */
- sprintf(buf, "/R%ld Do\n", image_id);
- pprintd1(s, "%d>>stream\n", strlen(buf));
- if (pdev->PDFA)
- pprints1(s, "%s\nendstream\n", buf);
- else
- pprints1(s, "%sendstream\n", buf);
- pdf_end_resource(pdev, resourcePattern);
- } else {
- length_id = pdf_obj_ref(pdev);
- pprintld1(s, "%ld 0 R>>stream\n", length_id);
- start = pdf_stell(pdev);
- code = copy_data(pdev, tiles->data, 0, tiles->raster,
- tile_id, 0, 0, tw, th, &image, &writer, -1);
- switch (code) {
- default:
- return code; /* error */
- case 1:
- break;
- case 0: /* not possible */
- return_error(gs_error_Fatal);
- }
- end = pdf_stell(pdev);
- stream_puts(s, "\nendstream\n");
- pdf_end_resource(pdev, resourcePattern);
- pdf_open_separate(pdev, length_id, resourceNone);
- pprintld1(pdev->strm, "%ld\n", end - start);
- pdf_end_separate(pdev, resourceNone);
- }
- pres->object->written = true; /* don't write at end of page */
+ sprintf(buf, "/R%ld Do\n", image_id);
+ pprintd1(s, "%d>>stream\n", strlen(buf));
+ if (pdev->PDFA)
+ pprints1(s, "%s\nendstream\n", buf);
+ else
+ pprints1(s, "%sendstream\n", buf);
+ pdf_end_resource(pdev, resourcePattern);
+ } else {
+ length_id = pdf_obj_ref(pdev);
+ pprintld1(s, "%ld 0 R>>stream\n", length_id);
+ start = pdf_stell(pdev);
+ code = copy_data(pdev, tiles->data, 0, tiles->raster,
+ tile_id, 0, 0, tw, th, &image, &writer, -1);
+ switch (code) {
+ default:
+ return code; /* error */
+ case 1:
+ break;
+ case 0: /* not possible */
+ return_error(gs_error_Fatal);
+ }
+ end = pdf_stell(pdev);
+ stream_puts(s, "\nendstream\n");
+ pdf_end_resource(pdev, resourcePattern);
+ pdf_open_separate(pdev, length_id, resourceNone);
+ pprintld1(pdev->strm, "%ld\n", end - start);
+ pdf_end_separate(pdev, resourceNone);
+ }
+ pres->object->written = true; /* don't write at end of page */
}
/* Fill the rectangle with the Pattern. */
{
- int code = pdf_open_page(pdev, PDF_IN_STREAM);
- stream *s;
+ int code = pdf_open_page(pdev, PDF_IN_STREAM);
+ stream *s;
- if (code < 0)
- goto use_default;
- /* Make sure we aren't being clipped. */
- code = pdf_put_clip_path(pdev, NULL);
- if (code < 0)
- return code;
- s = pdev->strm;
- /*
- * Because of bugs in Acrobat Reader's Print function, we can't
- * leave the CTM alone here: we have to reset it to the default.
- */
- pprintg2(s, "q %g 0 0 %g 0 0 cm\n", xscale, yscale);
- cos_value_write(&cs_value, pdev);
- stream_puts(s, " cs");
- if (mask)
- pprintg3(s, " %g %g %g", (int)(color1 >> 16) / 255.0,
- (int)((color1 >> 8) & 0xff) / 255.0,
- (int)(color1 & 0xff) / 255.0);
- pprintld1(s, "/R%ld scn", pdf_resource_id(pres));
- pprintg4(s, " %g %g %g %g re f Q\n",
- x / xscale, y / yscale, w / xscale, h / xscale);
+ if (code < 0)
+ goto use_default;
+ /* Make sure we aren't being clipped. */
+ code = pdf_put_clip_path(pdev, NULL);
+ if (code < 0)
+ return code;
+ s = pdev->strm;
+ /*
+ * Because of bugs in Acrobat Reader's Print function, we can't
+ * leave the CTM alone here: we have to reset it to the default.
+ */
+ pprintg2(s, "q %g 0 0 %g 0 0 cm\n", xscale, yscale);
+ cos_value_write(&cs_value, pdev);
+ stream_puts(s, " cs");
+ if (mask)
+ pprintg3(s, " %g %g %g", (int)(color1 >> 16) / 255.0,
+ (int)((color1 >> 8) & 0xff) / 255.0,
+ (int)(color1 & 0xff) / 255.0);
+ pprintld1(s, "/R%ld scn", pdf_resource_id(pres));
+ pprintg4(s, " %g %g %g %g re f Q\n",
+ x / xscale, y / yscale, w / xscale, h / xscale);
}
return 0;
use_default:
return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
- color0, color1, px, py);
+ color0, color1, px, py);
}
diff --git a/gs/base/gdevpdfb.h b/gs/base/gdevpdfb.h
index 8f47fb45e..7e4a094e1 100644
--- a/gs/base/gdevpdfb.h
+++ b/gs/base/gdevpdfb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,14 +22,13 @@
PDF_FOR_OPDFREAD - an integer 0 (false) or 1 (true).
*/
-
const gx_device_pdf PDF_DEVICE_IDENT =
{std_device_dci_type_body(gx_device_pdf, 0, PDF_DEVICE_NAME,
- &st_device_pdfwrite,
- DEFAULT_WIDTH_10THS * X_DPI / 10,
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,
- X_DPI, Y_DPI,
- 3, 24, 255, 255, 256, 256),
+ &st_device_pdfwrite,
+ DEFAULT_WIDTH_10THS * X_DPI / 10,
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,
+ X_DPI, Y_DPI,
+ 3, 24, 255, 255, 256, 256),
{pdf_open,
gx_upright_get_initial_matrix,
NULL, /* sync_output */
@@ -188,7 +187,7 @@ const gx_device_pdf PDF_DEVICE_IDENT =
1, /* used_mask */
{
{
- {0}}}, /* resources */
+ {0}}}, /* resources */
{0}, /* cs_Patterns */
{0}, /* Identity_ToUnicode_CMaps */
0, /* last_resource */
@@ -196,14 +195,14 @@ const gx_device_pdf PDF_DEVICE_IDENT =
gs_no_id, /* IdentityCIDSystemInfo_id */
{
{
- {0}}}, /* outline_levels */
+ {0}}}, /* outline_levels */
0, /* outline_depth */
0, /* closed_outline_depth */
0, /* outlines_open */
0, /* articles */
0, /* Dests */
{0}, /* fileID */
- {0, 0}, /* uuid_time */
+ {0, 0}, /* uuid_time */
0, /* global_named_objects */
0, /* local_named_objects */
0, /* NI_stack */
@@ -267,4 +266,3 @@ const gx_device_pdf PDF_DEVICE_IDENT =
!PDF_FOR_OPDFREAD, /* PreserveSMask */
!PDF_FOR_OPDFREAD /* PreserveTrMode */
};
-
diff --git a/gs/base/gdevpdfc.c b/gs/base/gdevpdfc.c
index 567387ad1..76c908701 100644
--- a/gs/base/gdevpdfc.c
+++ b/gs/base/gdevpdfc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -91,17 +91,17 @@ public_st_pdf_color_space();
static bool
cie_values_are_exponential(floatp v0, floatp va, floatp vb, floatp k,
- float *pexpt)
+ float *pexpt)
{
double p;
if (fabs(v0) >= 0.001 || fabs(k) < 0.001)
- return false;
+ return false;
if (va == 0 || (va > 0) != (k > 0))
- return false;
+ return false;
p = log(va / k) / log(CC_KEY_A);
if (fabs(vb - k * pow(CC_KEY_B, p)) >= 0.001)
- return false;
+ return false;
*pexpt = p;
return true;
}
@@ -110,10 +110,10 @@ static bool
cie_scalar_cache_is_exponential(const gx_cie_scalar_cache * pc, float *pexpt)
{
return cie_values_are_exponential(pc->floats.values[0],
- pc->floats.values[CC_INDEX_A],
- pc->floats.values[CC_INDEX_B],
- pc->floats.values[CC_INDEX_1],
- pexpt);
+ pc->floats.values[CC_INDEX_A],
+ pc->floats.values[CC_INDEX_B],
+ pc->floats.values[CC_INDEX_1],
+ pexpt);
}
#define CIE_SCALAR3_CACHE_IS_EXPONENTIAL(pca, expts)\
(cie_scalar_cache_is_exponential(&(pca)[0], &(expts).u) &&\
@@ -124,10 +124,10 @@ static bool
cie_vector_cache_is_exponential(const gx_cie_vector_cache * pc, float *pexpt)
{
return cie_values_are_exponential(pc->vecs.values[0].u,
- pc->vecs.values[CC_INDEX_A].u,
- pc->vecs.values[CC_INDEX_B].u,
- pc->vecs.values[CC_INDEX_1].u,
- pexpt);
+ pc->vecs.values[CC_INDEX_A].u,
+ pc->vecs.values[CC_INDEX_B].u,
+ pc->vecs.values[CC_INDEX_1].u,
+ pexpt);
}
#define CIE_VECTOR3_CACHE_IS_EXPONENTIAL(pca, expts)\
(cie_vector_cache_is_exponential(&(pca)[0], &(expts).u) &&\
@@ -147,22 +147,22 @@ static cie_cache_one_step_t
cie_cached_abc_is_one_step(const gs_cie_abc *pcie, const gs_matrix3 **ppmat)
{
/* The order of steps is, DecodeABC, MatrixABC, DecodeLMN, MatrixLMN. */
-
+
if (CIE_CACHE3_IS_IDENTITY(pcie->common.caches.DecodeLMN)) {
- if (pcie->MatrixABC.is_identity) {
- *ppmat = &pcie->common.MatrixLMN;
- return ONE_STEP_ABC;
- }
- if (pcie->common.MatrixLMN.is_identity) {
- *ppmat = &pcie->MatrixABC;
- return ONE_STEP_ABC;
- }
+ if (pcie->MatrixABC.is_identity) {
+ *ppmat = &pcie->common.MatrixLMN;
+ return ONE_STEP_ABC;
+ }
+ if (pcie->common.MatrixLMN.is_identity) {
+ *ppmat = &pcie->MatrixABC;
+ return ONE_STEP_ABC;
+ }
}
if (CIE_CACHE3_IS_IDENTITY(pcie->caches.DecodeABC.caches)) {
- if (pcie->MatrixABC.is_identity) {
- *ppmat = &pcie->common.MatrixLMN;
- return ONE_STEP_LMN;
- }
+ if (pcie->MatrixABC.is_identity) {
+ *ppmat = &pcie->common.MatrixLMN;
+ return ONE_STEP_LMN;
+ }
}
return ONE_STEP_NOT;
}
@@ -175,15 +175,15 @@ cie_scalar_cache_is_lab_lmn(const gs_cie_abc *pcie, int i)
{
double k = CC_KEY(i);
double g = (k >= 6.0 / 29 ? k * k * k :
- (k - 4.0 / 29) * (108.0 / 841));
+ (k - 4.0 / 29) * (108.0 / 841));
#define CC_V(j,i) (pcie->common.caches.DecodeLMN[j].floats.values[i])
#define CC_WP(uvw) (pcie->common.points.WhitePoint.uvw)
-
+
return (fabs(CC_V(0, i) - g * CC_WP(u)) < 0.001 &&
- fabs(CC_V(1, i) - g * CC_WP(v)) < 0.001 &&
- fabs(CC_V(2, i) - g * CC_WP(w)) < 0.001
- );
+ fabs(CC_V(1, i) - g * CC_WP(v)) < 0.001 &&
+ fabs(CC_V(2, i) - g * CC_WP(w)) < 0.001
+ );
#undef CC_V
#undef CC_WP
@@ -194,19 +194,19 @@ cie_vector_cache_is_lab_abc(const gx_cie_vector_cache3_t *pvc, int i)
const gx_cie_vector_cache *const pc3 = pvc->caches;
double k = CC_KEY(i);
double l0 = pc3[0].vecs.params.base,
- l = l0 + k * (pc3[0].vecs.params.limit - l0);
+ l = l0 + k * (pc3[0].vecs.params.limit - l0);
double a0 = pc3[1].vecs.params.base,
- a = a0 + k * (pc3[1].vecs.params.limit - a0);
+ a = a0 + k * (pc3[1].vecs.params.limit - a0);
double b0 = pc3[2].vecs.params.base,
- b = b0 + k * (pc3[2].vecs.params.limit - b0);
+ b = b0 + k * (pc3[2].vecs.params.limit - b0);
return (fabs(cie_cached2float(pc3[0].vecs.values[i].u) -
- (l + 16) / 116) < 0.001 &&
- fabs(cie_cached2float(pc3[1].vecs.values[i].u) -
- a / 500) < 0.001 &&
- fabs(cie_cached2float(pc3[2].vecs.values[i].w) -
- b / -200) < 0.001
- );
+ (l + 16) / 116) < 0.001 &&
+ fabs(cie_cached2float(pc3[1].vecs.values[i].u) -
+ a / 500) < 0.001 &&
+ fabs(cie_cached2float(pc3[2].vecs.values[i].w) -
+ b / -200) < 0.001
+ );
}
static bool
@@ -216,21 +216,21 @@ cie_is_lab(const gs_cie_abc *pcie)
/* Check MatrixABC and MatrixLMN. */
if (!(pcie->MatrixABC.cu.u == 1 && pcie->MatrixABC.cu.v == 1 &&
- pcie->MatrixABC.cu.w == 1 &&
- pcie->MatrixABC.cv.u == 1 && pcie->MatrixABC.cv.v == 0 &&
- pcie->MatrixABC.cv.w == 0 &&
- pcie->MatrixABC.cw.u == 0 && pcie->MatrixABC.cw.v == 0 &&
- pcie->MatrixABC.cw.w == -1 &&
- pcie->common.MatrixLMN.is_identity
- ))
- return false;
+ pcie->MatrixABC.cu.w == 1 &&
+ pcie->MatrixABC.cv.u == 1 && pcie->MatrixABC.cv.v == 0 &&
+ pcie->MatrixABC.cv.w == 0 &&
+ pcie->MatrixABC.cw.u == 0 && pcie->MatrixABC.cw.v == 0 &&
+ pcie->MatrixABC.cw.w == -1 &&
+ pcie->common.MatrixLMN.is_identity
+ ))
+ return false;
/* Check DecodeABC and DecodeLMN. */
for (i = 0; i <= CC_INDEX_1; ++i)
- if (!(cie_vector_cache_is_lab_abc(&pcie->caches.DecodeABC, i) &&
- cie_scalar_cache_is_lab_lmn(pcie, i)
- ))
- return false;
+ if (!(cie_vector_cache_is_lab_abc(&pcie->caches.DecodeABC, i) &&
+ cie_scalar_cache_is_lab_lmn(pcie, i)
+ ))
+ return false;
return true;
}
@@ -245,8 +245,8 @@ cie_ranges_are_0_1(const gs_range *prange, int n)
int i;
for (i = 0; i < n; ++i)
- if (prange[i].rmin != 0 || prange[i].rmax != 1)
- return false;
+ if (prange[i].rmin != 0 || prange[i].rmax != 1)
+ return false;
return true;
}
@@ -259,24 +259,24 @@ cos_array_add_vector3(cos_array_t *pca, const gs_vector3 *pvec)
int code = cos_array_add_real(pca, pvec->u);
if (code >= 0)
- code = cos_array_add_real(pca, pvec->v);
+ code = cos_array_add_real(pca, pvec->v);
if (code >= 0)
- code = cos_array_add_real(pca, pvec->w);
+ code = cos_array_add_real(pca, pvec->w);
return code;
}
static int
cos_dict_put_c_key_vector3(cos_dict_t *pcd, const char *key,
- const gs_vector3 *pvec)
+ const gs_vector3 *pvec)
{
cos_array_t *pca = cos_array_alloc(pcd->pdev, "cos_array_from_vector3");
int code;
if (pca == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = cos_array_add_vector3(pca, pvec);
if (code < 0) {
- COS_FREE(pca, "cos_array_from_vector3");
- return code;
+ COS_FREE(pca, "cos_array_from_vector3");
+ return code;
}
return cos_dict_put_c_key_object(pcd, key, COS_OBJECT(pca));
}
@@ -287,21 +287,21 @@ cos_dict_put_c_key_vector3(cos_dict_t *pcd, const char *key,
*/
int
pdf_finish_cie_space(cos_array_t *pca, cos_dict_t *pcd,
- const gs_cie_common *pciec)
+ const gs_cie_common *pciec)
{
int code = cos_dict_put_c_key_vector3(pcd, "/WhitePoint",
- &pciec->points.WhitePoint);
+ &pciec->points.WhitePoint);
if (code < 0)
- return code;
+ return code;
if (pciec->points.BlackPoint.u != 0 ||
- pciec->points.BlackPoint.v != 0 ||
- pciec->points.BlackPoint.w != 0
- ) {
- code = cos_dict_put_c_key_vector3(pcd, "/BlackPoint",
- &pciec->points.BlackPoint);
- if (code < 0)
- return code;
+ pciec->points.BlackPoint.v != 0 ||
+ pciec->points.BlackPoint.w != 0
+ ) {
+ code = cos_dict_put_c_key_vector3(pcd, "/BlackPoint",
+ &pciec->points.BlackPoint);
+ if (code < 0)
+ return code;
}
return cos_array_add_object(pca, COS_OBJECT(pcd));
}
@@ -322,7 +322,7 @@ const pdf_color_space_names_t pdf_color_space_names_short = {
*/
int
pdf_cspace_init_Device(gs_memory_t *mem, gs_color_space **ppcs,
- int num_components)
+ int num_components)
{
switch (num_components) {
case 1: *ppcs = gs_cspace_new_DeviceGray(mem); break;
@@ -346,7 +346,7 @@ static int pdf_delete_base_space_function(gx_device_pdf *pdev, gs_function_t *pf
}
static int pdf_make_base_space_function(gx_device_pdf *pdev, gs_function_t **pfn,
- int ncomp, float *data_low, float *data_high)
+ int ncomp, float *data_low, float *data_high)
{
gs_function_ElIn_params_t params;
float *ptr1, *ptr2;
@@ -355,13 +355,13 @@ static int pdf_make_base_space_function(gx_device_pdf *pdev, gs_function_t **pfn
ptr1 = (float *)
gs_alloc_byte_array(pdev->memory, 2, sizeof(float), "pdf_make_function(Domain)");
if (ptr1 == 0) {
- return gs_note_error(gs_error_VMerror);
+ return gs_note_error(gs_error_VMerror);
}
ptr2 = (float *)
gs_alloc_byte_array(pdev->memory, 2 * ncomp, sizeof(float), "pdf_make_function(Range)");
if (ptr2 == 0) {
- gs_free_object(pdev->memory, (void *)ptr1, "pdf_make_function(Range)");
- return gs_note_error(gs_error_VMerror);
+ gs_free_object(pdev->memory, (void *)ptr1, "pdf_make_function(Range)");
+ return gs_note_error(gs_error_VMerror);
}
params.m = 1;
params.n = ncomp;
@@ -377,30 +377,30 @@ static int pdf_make_base_space_function(gx_device_pdf *pdev, gs_function_t **pfn
ptr1 = (float *)gs_alloc_byte_array(pdev->memory, ncomp, sizeof(float), "pdf_make_function(C0)");
if (ptr1 == 0) {
- gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function(C0)");
- gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function(C0)");
- return gs_note_error(gs_error_VMerror);
+ gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function(C0)");
+ gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function(C0)");
+ return gs_note_error(gs_error_VMerror);
}
ptr2 = (float *)gs_alloc_byte_array(pdev->memory, ncomp, sizeof(float), "pdf_make_function(C1)");
if (ptr2 == 0) {
- gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function(C1)");
- gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function(C1)");
- gs_free_object(pdev->memory, (void *)ptr1, "pdf_make_function(C1)");
- return gs_note_error(gs_error_VMerror);
+ gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function(C1)");
+ gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function(C1)");
+ gs_free_object(pdev->memory, (void *)ptr1, "pdf_make_function(C1)");
+ return gs_note_error(gs_error_VMerror);
}
for (i=0;i<ncomp;i++) {
- ptr1[i] = data_low[i];
- ptr2[i] = data_high[i];
+ ptr1[i] = data_low[i];
+ ptr2[i] = data_high[i];
}
params.C0 = ptr1;
params.C1 = ptr2;
code = gs_function_ElIn_init(pfn, &params, pdev->memory);
if (code < 0) {
- gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function");
- gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function");
- gs_free_object(pdev->memory, (void *)params.C0, "pdf_make_function");
- gs_free_object(pdev->memory, (void *)params.C1, "pdf_make_function");
+ gs_free_object(pdev->memory, (void *)params.Domain, "pdf_make_function");
+ gs_free_object(pdev->memory, (void *)params.Range, "pdf_make_function");
+ gs_free_object(pdev->memory, (void *)params.C0, "pdf_make_function");
+ gs_free_object(pdev->memory, (void *)params.C1, "pdf_make_function");
}
return code;
}
@@ -414,10 +414,10 @@ static void pdf_SepRGB_ConvertToCMYK (float *in, float *out)
CMYK[3] = 1.0 - in[0];
} else {
if (in[1]<= in[0] && in[1] <= in[2]) {
- CMYK[3] = 1.0 - in[1];
- } else {
- CMYK[3] = 1.0 - in[2];
- }
+ CMYK[3] = 1.0 - in[1];
+ } else {
+ CMYK[3] = 1.0 - in[2];
+ }
}
CMYK[0] = 1.0 - in[0] - CMYK[3];
CMYK[1] = 1.0 - in[1] - CMYK[3];
@@ -435,41 +435,41 @@ static void pdf_SepCMYK_ConvertToRGB (float *in, float *out)
RGB[2] = in[2] + in[4];
if (RGB[0] > 1)
- out[0] = 0.0f;
+ out[0] = 0.0f;
else
- out[0] = 1 - RGB[0];
+ out[0] = 1 - RGB[0];
if (RGB[1] > 1)
- out[1] = 0.0f;
+ out[1] = 0.0f;
else
- out[1] = 1 - RGB[1];
+ out[1] = 1 - RGB[1];
if (RGB[2] > 1)
- out[2] = 0.0f;
+ out[2] = 0.0f;
else
- out[2] = 1 - RGB[2];
+ out[2] = 1 - RGB[2];
}
/* Create a Separation or DeviceN color space (internal). */
static int
pdf_separation_color_space(gx_device_pdf *pdev,
- cos_array_t *pca, const char *csname,
- const cos_value_t *snames,
- const gs_color_space *alt_space,
- const gs_function_t *pfn,
- const pdf_color_space_names_t *pcsn,
- const cos_value_t *v_attributes)
+ cos_array_t *pca, const char *csname,
+ const cos_value_t *snames,
+ const gs_color_space *alt_space,
+ const gs_function_t *pfn,
+ const pdf_color_space_names_t *pcsn,
+ const cos_value_t *v_attributes)
{
cos_value_t v;
const gs_range_t *ranges;
int code, csi;
- /* We need to think about the alternate space. If we are producing
- * PDF/X or PDF/A we can't produce some device spaces, and the code in
+ /* We need to think about the alternate space. If we are producing
+ * PDF/X or PDF/A we can't produce some device spaces, and the code in
* pdf_color_space_named always allows device spaces. We could alter
* that code, but by then we don't know its an Alternate space, and have
* lost the tin transform procedure. So instead we check here.
*/
csi = gs_color_space_get_index(alt_space);
- /* Note that if csi is ICC, check to see if this was one of
+ /* Note that if csi is ICC, check to see if this was one of
the default substitutes that we introduced for DeviceGray,
DeviceRGB or DeviceCMYK. If it is, then just write
the default color. Depending upon the flavor of PDF,
@@ -479,91 +479,91 @@ pdf_separation_color_space(gx_device_pdf *pdev,
if (csi == gs_color_space_index_ICC) {
csi = gsicc_get_default_type(alt_space->cmm_icc_profile_data);
}
- if (csi == gs_color_space_index_DeviceRGB && (pdev->PDFX ||
- (pdev->PDFA && (pdev->pcm_color_info_index == gs_color_space_index_DeviceCMYK)))) {
-
- /* We have a DeviceRGB alternate, but are producing either PDF/X or
- * PDF/A with a DeviceCMYK process color model. So we need to convert
- * the alternate space into CMYK. We do this by evaluating the function
- * at each end of the Separation space (0 and 1), convert the resulting
- * RGB colours into CMYK and create a new function which linearly
- * interpolates between these points.
- */
- gs_function_t *new_pfn = 0;
+ if (csi == gs_color_space_index_DeviceRGB && (pdev->PDFX ||
+ (pdev->PDFA && (pdev->pcm_color_info_index == gs_color_space_index_DeviceCMYK)))) {
+
+ /* We have a DeviceRGB alternate, but are producing either PDF/X or
+ * PDF/A with a DeviceCMYK process color model. So we need to convert
+ * the alternate space into CMYK. We do this by evaluating the function
+ * at each end of the Separation space (0 and 1), convert the resulting
+ * RGB colours into CMYK and create a new function which linearly
+ * interpolates between these points.
+ */
+ gs_function_t *new_pfn = 0;
float in[1] = {0.0f};
- float out_low[4];
- float out_high[4];
-
- code = gs_function_evaluate(pfn, in, out_low);
- if (code < 0)
- return code;
- pdf_SepRGB_ConvertToCMYK((float *)&out_low, (float *)&out_low);
-
- in[0] = 1.0f;
- code = gs_function_evaluate(pfn, in, out_high);
- if (code < 0)
- return code;
- pdf_SepRGB_ConvertToCMYK((float *)&out_high, (float *)&out_high);
-
- code = pdf_make_base_space_function(pdev, &new_pfn, 4, out_low, out_high);
- if (code < 0)
- return code;
- if ((code = cos_array_add(pca, cos_c_string_value(&v, csname))) < 0 ||
- (code = cos_array_add_no_copy(pca, snames)) < 0 ||
- (code = (int)cos_c_string_value(&v, (const char *)pcsn->DeviceCMYK)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (code = pdf_function_scaled(pdev, new_pfn, 0x00, &v)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
- ) {}
- pdf_delete_base_space_function(pdev, new_pfn);
- return code;
+ float out_low[4];
+ float out_high[4];
+
+ code = gs_function_evaluate(pfn, in, out_low);
+ if (code < 0)
+ return code;
+ pdf_SepRGB_ConvertToCMYK((float *)&out_low, (float *)&out_low);
+
+ in[0] = 1.0f;
+ code = gs_function_evaluate(pfn, in, out_high);
+ if (code < 0)
+ return code;
+ pdf_SepRGB_ConvertToCMYK((float *)&out_high, (float *)&out_high);
+
+ code = pdf_make_base_space_function(pdev, &new_pfn, 4, out_low, out_high);
+ if (code < 0)
+ return code;
+ if ((code = cos_array_add(pca, cos_c_string_value(&v, csname))) < 0 ||
+ (code = cos_array_add_no_copy(pca, snames)) < 0 ||
+ (code = (int)cos_c_string_value(&v, (const char *)pcsn->DeviceCMYK)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (code = pdf_function_scaled(pdev, new_pfn, 0x00, &v)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
+ ) {}
+ pdf_delete_base_space_function(pdev, new_pfn);
+ return code;
}
if (csi == gs_color_space_index_DeviceCMYK &&
- (pdev->PDFA && (pdev->pcm_color_info_index == gs_color_space_index_DeviceRGB))) {
- /* We have a DeviceCMYK alternate, but are producingPDF/A with a
- * DeviceRGB process color model. See comment above re DviceRGB.
- */
- gs_function_t *new_pfn = 0;
+ (pdev->PDFA && (pdev->pcm_color_info_index == gs_color_space_index_DeviceRGB))) {
+ /* We have a DeviceCMYK alternate, but are producingPDF/A with a
+ * DeviceRGB process color model. See comment above re DviceRGB.
+ */
+ gs_function_t *new_pfn = 0;
float in[1] = {0.0f};
- float out_low[4];
- float out_high[4];
+ float out_low[4];
+ float out_high[4];
- code = gs_function_evaluate(pfn, in, out_low);
- if (code < 0)
- return code;
- pdf_SepCMYK_ConvertToRGB((float *)&out_low, (float *)&out_low);
+ code = gs_function_evaluate(pfn, in, out_low);
+ if (code < 0)
+ return code;
+ pdf_SepCMYK_ConvertToRGB((float *)&out_low, (float *)&out_low);
in[0] = 1.0f;
- code = gs_function_evaluate(pfn, in, out_high);
- if (code < 0)
- return code;
- pdf_SepCMYK_ConvertToRGB((float *)&out_high, (float *)&out_high);
-
- code = pdf_make_base_space_function(pdev, &new_pfn, 3, out_low, out_high);
- if (code < 0)
- return code;
- if ((code = cos_array_add(pca, cos_c_string_value(&v, csname))) < 0 ||
- (code = cos_array_add_no_copy(pca, snames)) < 0 ||
- (code = (int)cos_c_string_value(&v, pcsn->DeviceRGB)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (code = pdf_function_scaled(pdev, new_pfn, 0x00, &v)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
- ) {}
- pdf_delete_base_space_function(pdev, new_pfn);
- return code;
+ code = gs_function_evaluate(pfn, in, out_high);
+ if (code < 0)
+ return code;
+ pdf_SepCMYK_ConvertToRGB((float *)&out_high, (float *)&out_high);
+
+ code = pdf_make_base_space_function(pdev, &new_pfn, 3, out_low, out_high);
+ if (code < 0)
+ return code;
+ if ((code = cos_array_add(pca, cos_c_string_value(&v, csname))) < 0 ||
+ (code = cos_array_add_no_copy(pca, snames)) < 0 ||
+ (code = (int)cos_c_string_value(&v, pcsn->DeviceRGB)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (code = pdf_function_scaled(pdev, new_pfn, 0x00, &v)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
+ ) {}
+ pdf_delete_base_space_function(pdev, new_pfn);
+ return code;
}
if ((code = cos_array_add(pca, cos_c_string_value(&v, csname))) < 0 ||
- (code = cos_array_add_no_copy(pca, snames)) < 0 ||
- (code = pdf_color_space_named(pdev, &v, &ranges, alt_space, pcsn, false, NULL, 0)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (code = pdf_function_scaled(pdev, pfn, ranges, &v)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0 ||
- (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
- )
- return code;
+ (code = cos_array_add_no_copy(pca, snames)) < 0 ||
+ (code = pdf_color_space_named(pdev, &v, &ranges, alt_space, pcsn, false, NULL, 0)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (code = pdf_function_scaled(pdev, pfn, ranges, &v)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0 ||
+ (v_attributes != NULL ? code = cos_array_add(pca, v_attributes) : 0) < 0
+ )
+ return code;
return 0;
}
@@ -573,7 +573,7 @@ pdf_separation_color_space(gx_device_pdf *pdev,
*/
static int
pdf_indexed_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
- const gs_color_space *pcs, cos_array_t *pca)
+ const gs_color_space *pcs, cos_array_t *pca)
{
const gs_indexed_params *pip = &pcs->params.indexed;
const gs_color_space *base_space = pcs->base_space;
@@ -594,26 +594,26 @@ pdf_indexed_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
/* PDF doesn't support Indexed color spaces with more than 256 entries. */
if (num_entries > 256)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pdev->CompatibilityLevel < 1.3 && !pdev->ForOPDFRead) {
- switch (gs_color_space_get_index(pcs)) {
- case gs_color_space_index_Pattern:
- case gs_color_space_index_Separation:
- case gs_color_space_index_Indexed:
- case gs_color_space_index_DeviceN:
- return_error(gs_error_rangecheck);
- default: DO_NOTHING;
- }
+ switch (gs_color_space_get_index(pcs)) {
+ case gs_color_space_index_Pattern:
+ case gs_color_space_index_Separation:
+ case gs_color_space_index_Indexed:
+ case gs_color_space_index_DeviceN:
+ return_error(gs_error_rangecheck);
+ default: DO_NOTHING;
+ }
}
table = gs_alloc_string(mem, string_size, "pdf_color_space(table)");
palette = gs_alloc_string(mem, table_size, "pdf_color_space(palette)");
if (table == 0 || palette == 0) {
- gs_free_string(mem, palette, table_size,
- "pdf_color_space(palette)");
- gs_free_string(mem, table, string_size,
- "pdf_color_space(table)");
- return_error(gs_error_VMerror);
+ gs_free_string(mem, palette, table_size,
+ "pdf_color_space(palette)");
+ gs_free_string(mem, table, string_size,
+ "pdf_color_space(table)");
+ return_error(gs_error_VMerror);
}
s_init(&s, mem);
swrite_string(&s, table, string_size);
@@ -622,51 +622,51 @@ pdf_indexed_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
s_init_filter(&es, (stream_state *)&st, buf, sizeof(buf), &s);
sputc(&s, '(');
if (pcs->params.indexed.use_proc) {
- gs_client_color cmin, cmax;
- byte *pnext = palette;
- int i, j;
-
- /* Find the legal range for the color components. */
- for (j = 0; j < num_components; ++j)
- cmin.paint.values[j] = (float)min_long,
- cmax.paint.values[j] = (float)max_long;
- gs_color_space_restrict_color(&cmin, base_space);
- gs_color_space_restrict_color(&cmax, base_space);
- /*
- * Compute the palette values, with the legal range for each
- * one mapped to [0 .. 255].
- */
- for (i = 0; i < num_entries; ++i) {
- gs_client_color cc;
-
- gs_cspace_indexed_lookup(pcs, i, &cc);
- for (j = 0; j < num_components; ++j) {
- float v = (cc.paint.values[j] - cmin.paint.values[j])
- * 255 / (cmax.paint.values[j] - cmin.paint.values[j]);
-
- *pnext++ = (v <= 0 ? 0 : v >= 255 ? 255 : (byte)v);
- }
- }
+ gs_client_color cmin, cmax;
+ byte *pnext = palette;
+ int i, j;
+
+ /* Find the legal range for the color components. */
+ for (j = 0; j < num_components; ++j)
+ cmin.paint.values[j] = (float)min_long,
+ cmax.paint.values[j] = (float)max_long;
+ gs_color_space_restrict_color(&cmin, base_space);
+ gs_color_space_restrict_color(&cmax, base_space);
+ /*
+ * Compute the palette values, with the legal range for each
+ * one mapped to [0 .. 255].
+ */
+ for (i = 0; i < num_entries; ++i) {
+ gs_client_color cc;
+
+ gs_cspace_indexed_lookup(pcs, i, &cc);
+ for (j = 0; j < num_components; ++j) {
+ float v = (cc.paint.values[j] - cmin.paint.values[j])
+ * 255 / (cmax.paint.values[j] - cmin.paint.values[j]);
+
+ *pnext++ = (v <= 0 ? 0 : v >= 255 ? 255 : (byte)v);
+ }
+ }
} else
- memcpy(palette, pip->lookup.table.data, table_size);
+ memcpy(palette, pip->lookup.table.data, table_size);
if (gs_color_space_get_index(base_space) ==
- gs_color_space_index_DeviceRGB
- ) {
- /* Check for an all-gray palette3. */
- int i;
-
- for (i = table_size; (i -= 3) >= 0; )
- if (palette[i] != palette[i + 1] ||
- palette[i] != palette[i + 2]
- )
- break;
- if (i < 0) {
- /* Change the color space to DeviceGray. */
- for (i = 0; i < num_entries; ++i)
- palette[i] = palette[i * 3];
- table_size = num_entries;
- base_space = gs_cspace_new_DeviceGray(mem);
- }
+ gs_color_space_index_DeviceRGB
+ ) {
+ /* Check for an all-gray palette3. */
+ int i;
+
+ for (i = table_size; (i -= 3) >= 0; )
+ if (palette[i] != palette[i + 1] ||
+ palette[i] != palette[i + 2]
+ )
+ break;
+ if (i < 0) {
+ /* Change the color space to DeviceGray. */
+ for (i = 0; i < num_entries; ++i)
+ palette[i] = palette[i * 3];
+ table_size = num_entries;
+ base_space = gs_cspace_new_DeviceGray(mem);
+ }
}
stream_write(&es, palette, table_size);
gs_free_string(mem, palette, table_size, "pdf_color_space(palette)");
@@ -674,7 +674,7 @@ pdf_indexed_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
sflush(&s);
string_used = (uint)stell(&s);
table = gs_resize_string(mem, table, string_size, string_used,
- "pdf_color_space(table)");
+ "pdf_color_space(table)");
/*
* Since the array is always referenced by name as a resource
* rather than being written as a value, even for in-line images,
@@ -685,45 +685,44 @@ pdf_indexed_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
* scaled automatically.
*/
if ((code = pdf_color_space_named(pdev, pvalue, NULL, base_space,
- &pdf_color_space_names, false, NULL, 0)) < 0 ||
- (code = cos_array_add(pca,
- cos_c_string_value(&v,
- pdf_color_space_names.Indexed
- /*pcsn->Indexed*/))) < 0 ||
- (code = cos_array_add(pca, pvalue)) < 0 ||
- (code = cos_array_add_int(pca, pip->hival)) < 0 ||
- (code = cos_array_add_no_copy(pca,
- cos_string_value(&v, table,
- string_used))) < 0
- )
- return code;
+ &pdf_color_space_names, false, NULL, 0)) < 0 ||
+ (code = cos_array_add(pca,
+ cos_c_string_value(&v,
+ pdf_color_space_names.Indexed
+ /*pcsn->Indexed*/))) < 0 ||
+ (code = cos_array_add(pca, pvalue)) < 0 ||
+ (code = cos_array_add_int(pca, pip->hival)) < 0 ||
+ (code = cos_array_add_no_copy(pca,
+ cos_string_value(&v, table,
+ string_used))) < 0
+ )
+ return code;
return 0;
}
-/*
- * Find a color space resource by seriialized data.
+/*
+ * Find a color space resource by seriialized data.
*/
static pdf_resource_t *
-pdf_find_cspace_resource(gx_device_pdf *pdev, const byte *serialized, uint serialized_size)
+pdf_find_cspace_resource(gx_device_pdf *pdev, const byte *serialized, uint serialized_size)
{
pdf_resource_t **pchain = pdev->resources[resourceColorSpace].chains;
pdf_resource_t *pres;
int i;
-
+
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next) {
- const pdf_color_space_t *const ppcs =
- (const pdf_color_space_t *)pres;
- if (ppcs->serialized_size != serialized_size)
- continue;
- if (!memcmp(ppcs->serialized, serialized, ppcs->serialized_size))
- return pres;
- }
+ for (pres = pchain[i]; pres != 0; pres = pres->next) {
+ const pdf_color_space_t *const ppcs =
+ (const pdf_color_space_t *)pres;
+ if (ppcs->serialized_size != serialized_size)
+ continue;
+ if (!memcmp(ppcs->serialized, serialized, ppcs->serialized_size))
+ return pres;
+ }
}
return NULL;
}
-
/*
* Create a PDF color space corresponding to a PostScript color space.
* For parameterless color spaces, set *pvalue to a (literal) string with
@@ -738,10 +737,10 @@ pdf_find_cspace_resource(gx_device_pdf *pdev, const byte *serialized, uint seria
*/
int
pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
- const gs_range_t **ppranges,
- const gs_color_space *pcs_in,
- const pdf_color_space_names_t *pcsn,
- bool by_name, const byte *res_name, int name_length)
+ const gs_range_t **ppranges,
+ const gs_color_space *pcs_in,
+ const pdf_color_space_names_t *pcsn,
+ bool by_name, const byte *res_name, int name_length)
{
const gs_color_space *pcs;
gs_color_space_index csi;
@@ -775,11 +774,11 @@ pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
/* Need to create the equivalent object */
gs_colorspace_set_icc_equivalent((gs_color_space *)pcs_in, &islab, pdev->memory);
pcs = pcs_in->icc_equivalent;
- }
+ }
#endif
}
csi = gs_color_space_get_index(pcs);
- /* Note that if csi is ICC, check to see if this was one of
+ /* Note that if csi is ICC, check to see if this was one of
the default substitutes that we introduced for DeviceGray,
DeviceRGB or DeviceCMYK. If it is, then just write
the default color. Depending upon the flavor of PDF,
@@ -790,34 +789,34 @@ pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
csi = gsicc_get_default_type(pcs->cmm_icc_profile_data);
}
if (ppranges)
- *ppranges = 0; /* default */
+ *ppranges = 0; /* default */
switch (csi) {
case gs_color_space_index_DeviceGray:
- cos_c_string_value(pvalue, pcsn->DeviceGray);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceGray);
+ return 0;
case gs_color_space_index_DeviceRGB:
- cos_c_string_value(pvalue, pcsn->DeviceRGB);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceRGB);
+ return 0;
case gs_color_space_index_DeviceCMYK:
- cos_c_string_value(pvalue, pcsn->DeviceCMYK);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceCMYK);
+ return 0;
case gs_color_space_index_Pattern:
- if (!pcs->params.pattern.has_base_space) {
- cos_c_string_value(pvalue, "/Pattern");
- return 0;
- }
- break;
+ if (!pcs->params.pattern.has_base_space) {
+ cos_c_string_value(pvalue, "/Pattern");
+ return 0;
+ }
+ break;
case gs_color_space_index_ICC:
/*
- * Take a special early exit for unrecognized ICCBased color spaces,
- * or for PDF 1.2 output (ICCBased color spaces date from PDF 1.3).
- */
+ * Take a special early exit for unrecognized ICCBased color spaces,
+ * or for PDF 1.2 output (ICCBased color spaces date from PDF 1.3).
+ */
if (pcs->cmm_icc_profile_data == NULL ||
- pdev->CompatibilityLevel < 1.3
- ) {
- if (res_name != NULL)
- return 0; /* Ignore .includecolorspace */
+ pdev->CompatibilityLevel < 1.3
+ ) {
+ if (res_name != NULL)
+ return 0; /* Ignore .includecolorspace */
if (pcs->base_space != NULL) {
return pdf_color_space_named( pdev, pvalue, ppranges,
pcs->base_space,
@@ -826,340 +825,340 @@ pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
/* Base space is NULL, use appropriate device space */
switch( cs_num_components(pcs) ) {
case 1:
- cos_c_string_value(pvalue, pcsn->DeviceGray);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceGray);
+ return 0;
case 3:
- cos_c_string_value(pvalue, pcsn->DeviceRGB);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceRGB);
+ return 0;
case 4:
- cos_c_string_value(pvalue, pcsn->DeviceCMYK);
- return 0;
+ cos_c_string_value(pvalue, pcsn->DeviceCMYK);
+ return 0;
default:
break;
- }
+ }
}
- }
+ }
break;
default:
- break;
+ break;
}
- if (pdev->params.ColorConversionStrategy == ccs_CMYK &&
- csi != gs_color_space_index_DeviceCMYK &&
- csi != gs_color_space_index_DeviceGray &&
- csi != gs_color_space_index_Pattern)
- return_error(gs_error_rangecheck);
- if (pdev->params.ColorConversionStrategy == ccs_sRGB &&
- csi != gs_color_space_index_DeviceRGB &&
- csi != gs_color_space_index_DeviceGray &&
- csi != gs_color_space_index_Pattern)
- return_error(gs_error_rangecheck);
- if (pdev->params.ColorConversionStrategy == ccs_Gray &&
- csi != gs_color_space_index_DeviceGray &&
- csi != gs_color_space_index_Pattern)
- return_error(gs_error_rangecheck);
+ if (pdev->params.ColorConversionStrategy == ccs_CMYK &&
+ csi != gs_color_space_index_DeviceCMYK &&
+ csi != gs_color_space_index_DeviceGray &&
+ csi != gs_color_space_index_Pattern)
+ return_error(gs_error_rangecheck);
+ if (pdev->params.ColorConversionStrategy == ccs_sRGB &&
+ csi != gs_color_space_index_DeviceRGB &&
+ csi != gs_color_space_index_DeviceGray &&
+ csi != gs_color_space_index_Pattern)
+ return_error(gs_error_rangecheck);
+ if (pdev->params.ColorConversionStrategy == ccs_Gray &&
+ csi != gs_color_space_index_DeviceGray &&
+ csi != gs_color_space_index_Pattern)
+ return_error(gs_error_rangecheck);
/* Check whether we already have a PDF object for this color space. */
if (pcs->id != gs_no_id)
- pres = pdf_find_resource_by_gs_id(pdev, resourceColorSpace, pcs->id);
+ pres = pdf_find_resource_by_gs_id(pdev, resourceColorSpace, pcs->id);
if (pres == NULL) {
- stream s;
-
- s_init(&s, pdev->memory);
- swrite_position_only(&s);
- code = cs_serialize(pcs, &s);
- if (code < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- serialized_size = stell(&s);
- sclose(&s);
- if (serialized_size <= sizeof(serialized0))
- serialized = serialized0;
- else {
- serialized = gs_alloc_bytes(pdev->pdf_memory, serialized_size, "pdf_color_space");
- if (serialized == NULL)
- return_error(gs_error_VMerror);
- }
- swrite_string(&s, serialized, serialized_size);
- code = cs_serialize(pcs, &s);
- if (code < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (stell(&s) != serialized_size)
- return_error(gs_error_unregistered); /* Must not happen. */
- sclose(&s);
- pres = pdf_find_cspace_resource(pdev, serialized, serialized_size);
- if (pres != NULL) {
- if (serialized != serialized0)
- gs_free_object(pdev->pdf_memory, serialized, "pdf_color_space");
- serialized = NULL;
- }
+ stream s;
+
+ s_init(&s, pdev->memory);
+ swrite_position_only(&s);
+ code = cs_serialize(pcs, &s);
+ if (code < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ serialized_size = stell(&s);
+ sclose(&s);
+ if (serialized_size <= sizeof(serialized0))
+ serialized = serialized0;
+ else {
+ serialized = gs_alloc_bytes(pdev->pdf_memory, serialized_size, "pdf_color_space");
+ if (serialized == NULL)
+ return_error(gs_error_VMerror);
+ }
+ swrite_string(&s, serialized, serialized_size);
+ code = cs_serialize(pcs, &s);
+ if (code < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (stell(&s) != serialized_size)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ sclose(&s);
+ pres = pdf_find_cspace_resource(pdev, serialized, serialized_size);
+ if (pres != NULL) {
+ if (serialized != serialized0)
+ gs_free_object(pdev->pdf_memory, serialized, "pdf_color_space");
+ serialized = NULL;
+ }
}
if (pres) {
- const pdf_color_space_t *const ppcs =
- (const pdf_color_space_t *)pres;
+ const pdf_color_space_t *const ppcs =
+ (const pdf_color_space_t *)pres;
- if (ppranges != 0 && ppcs->ranges != 0)
- *ppranges = ppcs->ranges;
- pca = (cos_array_t *)pres->object;
- goto ret;
+ if (ppranges != 0 && ppcs->ranges != 0)
+ *ppranges = ppcs->ranges;
+ pca = (cos_array_t *)pres->object;
+ goto ret;
}
/* Space has parameters -- create an array. */
pca = cos_array_alloc(pdev, "pdf_color_space");
if (pca == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
switch (csi) {
case gs_color_space_index_ICC:
- code = pdf_iccbased_color_space(pdev, pvalue, pcs, pca);
+ code = pdf_iccbased_color_space(pdev, pvalue, pcs, pca);
break;
case gs_color_space_index_CIEA: {
- /* Check that we can represent this as a CalGray space. */
- const gs_cie_a *pcie = pcs->params.a;
- bool unitary = cie_ranges_are_0_1(&pcie->RangeA, 1);
- bool identityA = (pcie->MatrixA.u == 1 && pcie->MatrixA.v == 1 &&
- pcie->MatrixA.w == 1);
- gs_vector3 expts;
-
- pciec = (const gs_cie_common *)pcie;
- if (!pcie->common.MatrixLMN.is_identity) {
- code = pdf_convert_cie_space(pdev, pca, pcs, "GRAY", pciec,
- &pcie->RangeA, ONE_STEP_NOT, NULL,
- &ranges);
- break;
- }
- if (unitary && identityA &&
- CIE_CACHE_IS_IDENTITY(&pcie->caches.DecodeA) &&
- CIE_SCALAR3_CACHE_IS_EXPONENTIAL(pcie->common.caches.DecodeLMN, expts) &&
- expts.v == expts.u && expts.w == expts.u
- ) {
- DO_NOTHING;
- } else if (unitary && identityA &&
- CIE_CACHE3_IS_IDENTITY(pcie->common.caches.DecodeLMN) &&
- cie_vector_cache_is_exponential(&pcie->caches.DecodeA, &expts.u)
- ) {
- DO_NOTHING;
- } else {
- code = pdf_convert_cie_space(pdev, pca, pcs, "GRAY", pciec,
- &pcie->RangeA, ONE_STEP_NOT, NULL,
- &ranges);
- break;
- }
- code = cos_array_add(pca, cos_c_string_value(&v, "/CalGray"));
- if (code < 0)
- return code;
- pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
- if (pcd == 0)
- return_error(gs_error_VMerror);
- if (expts.u != 1) {
- code = cos_dict_put_c_key_real(pcd, "/Gamma", expts.u);
- if (code < 0)
- return code;
- }
+ /* Check that we can represent this as a CalGray space. */
+ const gs_cie_a *pcie = pcs->params.a;
+ bool unitary = cie_ranges_are_0_1(&pcie->RangeA, 1);
+ bool identityA = (pcie->MatrixA.u == 1 && pcie->MatrixA.v == 1 &&
+ pcie->MatrixA.w == 1);
+ gs_vector3 expts;
+
+ pciec = (const gs_cie_common *)pcie;
+ if (!pcie->common.MatrixLMN.is_identity) {
+ code = pdf_convert_cie_space(pdev, pca, pcs, "GRAY", pciec,
+ &pcie->RangeA, ONE_STEP_NOT, NULL,
+ &ranges);
+ break;
+ }
+ if (unitary && identityA &&
+ CIE_CACHE_IS_IDENTITY(&pcie->caches.DecodeA) &&
+ CIE_SCALAR3_CACHE_IS_EXPONENTIAL(pcie->common.caches.DecodeLMN, expts) &&
+ expts.v == expts.u && expts.w == expts.u
+ ) {
+ DO_NOTHING;
+ } else if (unitary && identityA &&
+ CIE_CACHE3_IS_IDENTITY(pcie->common.caches.DecodeLMN) &&
+ cie_vector_cache_is_exponential(&pcie->caches.DecodeA, &expts.u)
+ ) {
+ DO_NOTHING;
+ } else {
+ code = pdf_convert_cie_space(pdev, pca, pcs, "GRAY", pciec,
+ &pcie->RangeA, ONE_STEP_NOT, NULL,
+ &ranges);
+ break;
+ }
+ code = cos_array_add(pca, cos_c_string_value(&v, "/CalGray"));
+ if (code < 0)
+ return code;
+ pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
+ if (pcd == 0)
+ return_error(gs_error_VMerror);
+ if (expts.u != 1) {
+ code = cos_dict_put_c_key_real(pcd, "/Gamma", expts.u);
+ if (code < 0)
+ return code;
+ }
}
cal:
/* Finish handling a CIE-based color space (Calxxx or Lab). */
if (code < 0)
- return code;
+ return code;
code = pdf_finish_cie_space(pca, pcd, pciec);
break;
case gs_color_space_index_CIEABC: {
- /* Check that we can represent this as a CalRGB space. */
- const gs_cie_abc *pcie = pcs->params.abc;
- bool unitary = cie_ranges_are_0_1(pcie->RangeABC.ranges, 3);
- gs_vector3 expts;
- const gs_matrix3 *pmat = NULL;
- cie_cache_one_step_t one_step =
- cie_cached_abc_is_one_step(pcie, &pmat);
-
- pciec = (const gs_cie_common *)pcie;
- if (unitary) {
- switch (one_step) {
- case ONE_STEP_ABC:
- if (CIE_VECTOR3_CACHE_IS_EXPONENTIAL(pcie->caches.DecodeABC.caches, expts))
- goto calrgb;
- break;
- case ONE_STEP_LMN:
- if (CIE_SCALAR3_CACHE_IS_EXPONENTIAL(pcie->common.caches.DecodeLMN, expts))
- goto calrgb;
- default:
- break;
- }
- }
- if (cie_is_lab(pcie)) {
- /* Represent this as a Lab space. */
- pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
- if (pcd == 0)
- return_error(gs_error_VMerror);
- code = pdf_put_lab_color_space(pca, pcd, pcie->RangeABC.ranges);
- goto cal;
- } else {
- code = pdf_convert_cie_space(pdev, pca, pcs, "RGB ", pciec,
- pcie->RangeABC.ranges,
- one_step, pmat, &ranges);
- break;
- }
+ /* Check that we can represent this as a CalRGB space. */
+ const gs_cie_abc *pcie = pcs->params.abc;
+ bool unitary = cie_ranges_are_0_1(pcie->RangeABC.ranges, 3);
+ gs_vector3 expts;
+ const gs_matrix3 *pmat = NULL;
+ cie_cache_one_step_t one_step =
+ cie_cached_abc_is_one_step(pcie, &pmat);
+
+ pciec = (const gs_cie_common *)pcie;
+ if (unitary) {
+ switch (one_step) {
+ case ONE_STEP_ABC:
+ if (CIE_VECTOR3_CACHE_IS_EXPONENTIAL(pcie->caches.DecodeABC.caches, expts))
+ goto calrgb;
+ break;
+ case ONE_STEP_LMN:
+ if (CIE_SCALAR3_CACHE_IS_EXPONENTIAL(pcie->common.caches.DecodeLMN, expts))
+ goto calrgb;
+ default:
+ break;
+ }
+ }
+ if (cie_is_lab(pcie)) {
+ /* Represent this as a Lab space. */
+ pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
+ if (pcd == 0)
+ return_error(gs_error_VMerror);
+ code = pdf_put_lab_color_space(pca, pcd, pcie->RangeABC.ranges);
+ goto cal;
+ } else {
+ code = pdf_convert_cie_space(pdev, pca, pcs, "RGB ", pciec,
+ pcie->RangeABC.ranges,
+ one_step, pmat, &ranges);
+ break;
+ }
calrgb:
- code = cos_array_add(pca, cos_c_string_value(&v, "/CalRGB"));
- if (code < 0)
- return code;
- pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
- if (pcd == 0)
- return_error(gs_error_VMerror);
- if (expts.u != 1 || expts.v != 1 || expts.w != 1) {
- code = cos_dict_put_c_key_vector3(pcd, "/Gamma", &expts);
- if (code < 0)
- return code;
- }
- if (!pmat->is_identity) {
- cos_array_t *pcma =
- cos_array_alloc(pdev, "pdf_color_space(Matrix)");
-
- if (pcma == 0)
- return_error(gs_error_VMerror);
- if ((code = cos_array_add_vector3(pcma, &pmat->cu)) < 0 ||
- (code = cos_array_add_vector3(pcma, &pmat->cv)) < 0 ||
- (code = cos_array_add_vector3(pcma, &pmat->cw)) < 0 ||
- (code = cos_dict_put(pcd, (const byte *)"/Matrix", 7,
- COS_OBJECT_VALUE(&v, pcma))) < 0
- )
- return code;
- }
+ code = cos_array_add(pca, cos_c_string_value(&v, "/CalRGB"));
+ if (code < 0)
+ return code;
+ pcd = cos_dict_alloc(pdev, "pdf_color_space(dict)");
+ if (pcd == 0)
+ return_error(gs_error_VMerror);
+ if (expts.u != 1 || expts.v != 1 || expts.w != 1) {
+ code = cos_dict_put_c_key_vector3(pcd, "/Gamma", &expts);
+ if (code < 0)
+ return code;
+ }
+ if (!pmat->is_identity) {
+ cos_array_t *pcma =
+ cos_array_alloc(pdev, "pdf_color_space(Matrix)");
+
+ if (pcma == 0)
+ return_error(gs_error_VMerror);
+ if ((code = cos_array_add_vector3(pcma, &pmat->cu)) < 0 ||
+ (code = cos_array_add_vector3(pcma, &pmat->cv)) < 0 ||
+ (code = cos_array_add_vector3(pcma, &pmat->cw)) < 0 ||
+ (code = cos_dict_put(pcd, (const byte *)"/Matrix", 7,
+ COS_OBJECT_VALUE(&v, pcma))) < 0
+ )
+ return code;
+ }
}
goto cal;
case gs_color_space_index_CIEDEF:
- code = pdf_convert_cie_space(pdev, pca, pcs, "RGB ",
- (const gs_cie_common *)pcs->params.def,
- pcs->params.def->RangeDEF.ranges,
- ONE_STEP_NOT, NULL, &ranges);
- break;
+ code = pdf_convert_cie_space(pdev, pca, pcs, "RGB ",
+ (const gs_cie_common *)pcs->params.def,
+ pcs->params.def->RangeDEF.ranges,
+ ONE_STEP_NOT, NULL, &ranges);
+ break;
case gs_color_space_index_CIEDEFG:
- code = pdf_convert_cie_space(pdev, pca, pcs, "CMYK",
- (const gs_cie_common *)pcs->params.defg,
- pcs->params.defg->RangeDEFG.ranges,
- ONE_STEP_NOT, NULL, &ranges);
- break;
+ code = pdf_convert_cie_space(pdev, pca, pcs, "CMYK",
+ (const gs_cie_common *)pcs->params.defg,
+ pcs->params.defg->RangeDEFG.ranges,
+ ONE_STEP_NOT, NULL, &ranges);
+ break;
case gs_color_space_index_Indexed:
- code = pdf_indexed_color_space(pdev, pvalue, pcs, pca);
- break;
+ code = pdf_indexed_color_space(pdev, pvalue, pcs, pca);
+ break;
case gs_color_space_index_DeviceN:
- if (!pdev->PreserveDeviceN)
- return_error(gs_error_rangecheck);
+ if (!pdev->PreserveDeviceN)
+ return_error(gs_error_rangecheck);
if (pdev->CompatibilityLevel < 1.3)
- return_error(gs_error_rangecheck);
- pfn = gs_cspace_get_devn_function(pcs);
- /****** CURRENTLY WE ONLY HANDLE Functions ******/
- if (pfn == 0)
- return_error(gs_error_rangecheck);
- {
- cos_array_t *psna =
- cos_array_alloc(pdev, "pdf_color_space(DeviceN)");
- int i;
- byte *name_string;
- uint name_string_length;
- cos_value_t v_attriburtes, *va = NULL;
-
- if (psna == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < pcs->params.device_n.num_components; ++i) {
- if ((code = pcs->params.device_n.get_colorname_string(
- pdev->memory,
- pcs->params.device_n.names[i], &name_string,
- &name_string_length)) < 0 ||
- (code = pdf_string_to_cos_name(pdev, name_string,
- name_string_length, &v)) < 0 ||
- (code = cos_array_add_no_copy(psna, &v)) < 0)
- return code;
- }
- COS_OBJECT_VALUE(&v, psna);
- if (pcs->params.device_n.colorants != NULL) {
- cos_dict_t *colorants = cos_dict_alloc(pdev, "pdf_color_space(DeviceN)");
- cos_value_t v_colorants, v_separation, v_colorant_name;
- const gs_device_n_attributes *csa;
- pdf_resource_t *pres_attributes;
-
- if (colorants == NULL)
- return_error(gs_error_VMerror);
- code = pdf_alloc_resource(pdev, resourceOther, 0, &pres_attributes, -1);
- if (code < 0)
- return code;
- cos_become(pres_attributes->object, cos_type_dict);
- COS_OBJECT_VALUE(&v_colorants, colorants);
- code = cos_dict_put((cos_dict_t *)pres_attributes->object,
- (const byte *)"/Colorants", 10, &v_colorants);
- if (code < 0)
- return code;
- for (csa = pcs->params.device_n.colorants; csa != NULL; csa = csa->next) {
- code = pcs->params.device_n.get_colorname_string(pdev->memory,
- csa->colorant_name, &name_string, &name_string_length);
- if (code < 0)
- return code;
- code = pdf_color_space_named(pdev, &v_separation, NULL, csa->cspace, pcsn, false, NULL, 0);
- if (code < 0)
- return code;
- code = pdf_string_to_cos_name(pdev, name_string, name_string_length, &v_colorant_name);
- if (code < 0)
- return code;
- code = cos_dict_put(colorants, v_colorant_name.contents.chars.data,
- v_colorant_name.contents.chars.size, &v_separation);
- if (code < 0)
- return code;
- }
- code = pdf_substitute_resource(pdev, &pres_attributes, resourceOther, NULL, true);
- if (code < 0)
- return code;
- pres_attributes->where_used |= pdev->used_mask;
- va = &v_attriburtes;
- COS_OBJECT_VALUE(va, pres_attributes->object);
- }
- if ((code = pdf_separation_color_space(pdev, pca, "/DeviceN", &v,
- pcs->base_space,
- pfn, &pdf_color_space_names, va)) < 0)
- return code;
- }
- break;
+ return_error(gs_error_rangecheck);
+ pfn = gs_cspace_get_devn_function(pcs);
+ /****** CURRENTLY WE ONLY HANDLE Functions ******/
+ if (pfn == 0)
+ return_error(gs_error_rangecheck);
+ {
+ cos_array_t *psna =
+ cos_array_alloc(pdev, "pdf_color_space(DeviceN)");
+ int i;
+ byte *name_string;
+ uint name_string_length;
+ cos_value_t v_attriburtes, *va = NULL;
+
+ if (psna == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < pcs->params.device_n.num_components; ++i) {
+ if ((code = pcs->params.device_n.get_colorname_string(
+ pdev->memory,
+ pcs->params.device_n.names[i], &name_string,
+ &name_string_length)) < 0 ||
+ (code = pdf_string_to_cos_name(pdev, name_string,
+ name_string_length, &v)) < 0 ||
+ (code = cos_array_add_no_copy(psna, &v)) < 0)
+ return code;
+ }
+ COS_OBJECT_VALUE(&v, psna);
+ if (pcs->params.device_n.colorants != NULL) {
+ cos_dict_t *colorants = cos_dict_alloc(pdev, "pdf_color_space(DeviceN)");
+ cos_value_t v_colorants, v_separation, v_colorant_name;
+ const gs_device_n_attributes *csa;
+ pdf_resource_t *pres_attributes;
+
+ if (colorants == NULL)
+ return_error(gs_error_VMerror);
+ code = pdf_alloc_resource(pdev, resourceOther, 0, &pres_attributes, -1);
+ if (code < 0)
+ return code;
+ cos_become(pres_attributes->object, cos_type_dict);
+ COS_OBJECT_VALUE(&v_colorants, colorants);
+ code = cos_dict_put((cos_dict_t *)pres_attributes->object,
+ (const byte *)"/Colorants", 10, &v_colorants);
+ if (code < 0)
+ return code;
+ for (csa = pcs->params.device_n.colorants; csa != NULL; csa = csa->next) {
+ code = pcs->params.device_n.get_colorname_string(pdev->memory,
+ csa->colorant_name, &name_string, &name_string_length);
+ if (code < 0)
+ return code;
+ code = pdf_color_space_named(pdev, &v_separation, NULL, csa->cspace, pcsn, false, NULL, 0);
+ if (code < 0)
+ return code;
+ code = pdf_string_to_cos_name(pdev, name_string, name_string_length, &v_colorant_name);
+ if (code < 0)
+ return code;
+ code = cos_dict_put(colorants, v_colorant_name.contents.chars.data,
+ v_colorant_name.contents.chars.size, &v_separation);
+ if (code < 0)
+ return code;
+ }
+ code = pdf_substitute_resource(pdev, &pres_attributes, resourceOther, NULL, true);
+ if (code < 0)
+ return code;
+ pres_attributes->where_used |= pdev->used_mask;
+ va = &v_attriburtes;
+ COS_OBJECT_VALUE(va, pres_attributes->object);
+ }
+ if ((code = pdf_separation_color_space(pdev, pca, "/DeviceN", &v,
+ pcs->base_space,
+ pfn, &pdf_color_space_names, va)) < 0)
+ return code;
+ }
+ break;
case gs_color_space_index_Separation:
- if (!pdev->PreserveSeparation)
- return_error(gs_error_rangecheck);
- pfn = gs_cspace_get_sepr_function(pcs);
- /****** CURRENTLY WE ONLY HANDLE Functions ******/
- if (pfn == 0)
- return_error(gs_error_rangecheck);
- {
- byte *name_string;
- uint name_string_length;
- if ((code = pcs->params.separation.get_colorname_string(
- pdev->memory,
- pcs->params.separation.sep_name, &name_string,
- &name_string_length)) < 0 ||
- (code = pdf_string_to_cos_name(pdev, name_string,
- name_string_length, &v)) < 0 ||
- (code = pdf_separation_color_space(pdev, pca, "/Separation", &v,
- pcs->base_space,
- pfn, &pdf_color_space_names, NULL)) < 0)
- return code;
- }
- break;
+ if (!pdev->PreserveSeparation)
+ return_error(gs_error_rangecheck);
+ pfn = gs_cspace_get_sepr_function(pcs);
+ /****** CURRENTLY WE ONLY HANDLE Functions ******/
+ if (pfn == 0)
+ return_error(gs_error_rangecheck);
+ {
+ byte *name_string;
+ uint name_string_length;
+ if ((code = pcs->params.separation.get_colorname_string(
+ pdev->memory,
+ pcs->params.separation.sep_name, &name_string,
+ &name_string_length)) < 0 ||
+ (code = pdf_string_to_cos_name(pdev, name_string,
+ name_string_length, &v)) < 0 ||
+ (code = pdf_separation_color_space(pdev, pca, "/Separation", &v,
+ pcs->base_space,
+ pfn, &pdf_color_space_names, NULL)) < 0)
+ return code;
+ }
+ break;
case gs_color_space_index_Pattern:
- if ((code = pdf_color_space_named(pdev, pvalue, ppranges,
- pcs->base_space,
- &pdf_color_space_names, false, NULL, 0)) < 0 ||
- (code = cos_array_add(pca,
- cos_c_string_value(&v, "/Pattern"))) < 0 ||
- (code = cos_array_add(pca, pvalue)) < 0
- )
- return code;
- break;
+ if ((code = pdf_color_space_named(pdev, pvalue, ppranges,
+ pcs->base_space,
+ &pdf_color_space_names, false, NULL, 0)) < 0 ||
+ (code = cos_array_add(pca,
+ cos_c_string_value(&v, "/Pattern"))) < 0 ||
+ (code = cos_array_add(pca, pvalue)) < 0
+ )
+ return code;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
/*
@@ -1167,63 +1166,63 @@ pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
* by name rather than directly.
*/
{
- pdf_color_space_t *ppcs;
-
- if (code < 0 ||
- (code = pdf_alloc_resource(pdev, resourceColorSpace, pcs->id,
- &pres, -1)) < 0
- ) {
- COS_FREE(pca, "pdf_color_space");
- return code;
- }
- pdf_reserve_object_id(pdev, pres, 0);
- if (res_name != NULL) {
- int l = min(name_length, sizeof(pres->rname) - 1);
-
- memcpy(pres->rname, res_name, l);
- pres->rname[l] = 0;
- }
- ppcs = (pdf_color_space_t *)pres;
- if (serialized == serialized0) {
- serialized = gs_alloc_bytes(pdev->pdf_memory, serialized_size, "pdf_color_space");
- if (serialized == NULL)
- return_error(gs_error_VMerror);
- memcpy(serialized, serialized0, serialized_size);
- }
- ppcs->serialized = serialized;
- ppcs->serialized_size = serialized_size;
- if (ranges) {
- int num_comp = gs_color_space_num_components(pcs);
- gs_range_t *copy_ranges = (gs_range_t *)
- gs_alloc_byte_array(pdev->pdf_memory, num_comp,
- sizeof(gs_range_t), "pdf_color_space");
-
- if (copy_ranges == 0) {
- COS_FREE(pca, "pdf_color_space");
- return_error(gs_error_VMerror);
- }
- memcpy(copy_ranges, ranges, num_comp * sizeof(gs_range_t));
- ppcs->ranges = copy_ranges;
- if (ppranges)
- *ppranges = copy_ranges;
- } else
- ppcs->ranges = 0;
- pca->id = pres->object->id;
- COS_FREE(pres->object, "pdf_color_space");
- pres->object = (cos_object_t *)pca;
- cos_write_object(COS_OBJECT(pca), pdev, resourceColorSpace);
+ pdf_color_space_t *ppcs;
+
+ if (code < 0 ||
+ (code = pdf_alloc_resource(pdev, resourceColorSpace, pcs->id,
+ &pres, -1)) < 0
+ ) {
+ COS_FREE(pca, "pdf_color_space");
+ return code;
+ }
+ pdf_reserve_object_id(pdev, pres, 0);
+ if (res_name != NULL) {
+ int l = min(name_length, sizeof(pres->rname) - 1);
+
+ memcpy(pres->rname, res_name, l);
+ pres->rname[l] = 0;
+ }
+ ppcs = (pdf_color_space_t *)pres;
+ if (serialized == serialized0) {
+ serialized = gs_alloc_bytes(pdev->pdf_memory, serialized_size, "pdf_color_space");
+ if (serialized == NULL)
+ return_error(gs_error_VMerror);
+ memcpy(serialized, serialized0, serialized_size);
+ }
+ ppcs->serialized = serialized;
+ ppcs->serialized_size = serialized_size;
+ if (ranges) {
+ int num_comp = gs_color_space_num_components(pcs);
+ gs_range_t *copy_ranges = (gs_range_t *)
+ gs_alloc_byte_array(pdev->pdf_memory, num_comp,
+ sizeof(gs_range_t), "pdf_color_space");
+
+ if (copy_ranges == 0) {
+ COS_FREE(pca, "pdf_color_space");
+ return_error(gs_error_VMerror);
+ }
+ memcpy(copy_ranges, ranges, num_comp * sizeof(gs_range_t));
+ ppcs->ranges = copy_ranges;
+ if (ppranges)
+ *ppranges = copy_ranges;
+ } else
+ ppcs->ranges = 0;
+ pca->id = pres->object->id;
+ COS_FREE(pres->object, "pdf_color_space");
+ pres->object = (cos_object_t *)pca;
+ cos_write_object(COS_OBJECT(pca), pdev, resourceColorSpace);
}
ret:
if (by_name) {
- /* Return a resource name rather than an object reference. */
- discard(COS_RESOURCE_VALUE(pvalue, pca));
+ /* Return a resource name rather than an object reference. */
+ discard(COS_RESOURCE_VALUE(pvalue, pca));
} else
- discard(COS_OBJECT_VALUE(pvalue, pca));
+ discard(COS_OBJECT_VALUE(pvalue, pca));
if (pres != NULL) {
- pres->where_used |= pdev->used_mask;
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/ColorSpace", pres);
- if (code < 0)
- return code;
+ pres->where_used |= pdev->used_mask;
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/ColorSpace", pres);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -1233,25 +1232,25 @@ pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
/* Create colored and uncolored Pattern color spaces. */
static int
pdf_pattern_space(gx_device_pdf *pdev, cos_value_t *pvalue,
- pdf_resource_t **ppres, const char *cs_name)
+ pdf_resource_t **ppres, const char *cs_name)
{
int code;
if (!*ppres) {
- int code = pdf_begin_resource_body(pdev, resourceColorSpace, gs_no_id,
- ppres);
-
- if (code < 0)
- return code;
- pprints1(pdev->strm, "%s\n", cs_name);
- pdf_end_resource(pdev, resourceColorSpace);
- (*ppres)->object->written = true; /* don't write at end */
- ((pdf_color_space_t *)*ppres)->ranges = 0;
- ((pdf_color_space_t *)*ppres)->serialized = 0;
+ int code = pdf_begin_resource_body(pdev, resourceColorSpace, gs_no_id,
+ ppres);
+
+ if (code < 0)
+ return code;
+ pprints1(pdev->strm, "%s\n", cs_name);
+ pdf_end_resource(pdev, resourceColorSpace);
+ (*ppres)->object->written = true; /* don't write at end */
+ ((pdf_color_space_t *)*ppres)->ranges = 0;
+ ((pdf_color_space_t *)*ppres)->serialized = 0;
}
code = pdf_add_resource(pdev, pdev->substream_Resources, "/ColorSpace", *ppres);
if (code < 0)
- return code;
+ return code;
cos_resource_value(pvalue, (*ppres)->object);
return 0;
}
@@ -1259,7 +1258,7 @@ int
pdf_cs_Pattern_colored(gx_device_pdf *pdev, cos_value_t *pvalue)
{
return pdf_pattern_space(pdev, pvalue, &pdev->cs_Patterns[0],
- "[/Pattern]");
+ "[/Pattern]");
}
int
pdf_cs_Pattern_uncolored(gx_device_pdf *pdev, cos_value_t *pvalue)
@@ -1267,16 +1266,16 @@ pdf_cs_Pattern_uncolored(gx_device_pdf *pdev, cos_value_t *pvalue)
/* Only for process colors. */
int ncomp = pdev->color_info.num_components;
static const char *const pcs_names[5] = {
- 0, "[/Pattern /DeviceGray]", 0, "[/Pattern /DeviceRGB]",
- "[/Pattern /DeviceCMYK]"
+ 0, "[/Pattern /DeviceGray]", 0, "[/Pattern /DeviceRGB]",
+ "[/Pattern /DeviceCMYK]"
};
return pdf_pattern_space(pdev, pvalue, &pdev->cs_Patterns[ncomp],
- pcs_names[ncomp]);
+ pcs_names[ncomp]);
}
int
-pdf_cs_Pattern_uncolored_hl(gx_device_pdf *pdev,
- const gs_color_space *pcs, cos_value_t *pvalue)
+pdf_cs_Pattern_uncolored_hl(gx_device_pdf *pdev,
+ const gs_color_space *pcs, cos_value_t *pvalue)
{
/* Only for high level colors. */
return pdf_color_space_named(pdev, pvalue, NULL, pcs, &pdf_color_space_names, true, NULL, 0);
@@ -1292,15 +1291,15 @@ pdf_color_space_procsets(gx_device_pdf *pdev, const gs_color_space *pcs)
switch (gs_color_space_get_index(pbcs)) {
case gs_color_space_index_DeviceGray:
case gs_color_space_index_CIEA:
- /* We only handle CIEBasedA spaces that map to CalGray. */
- pdev->procsets |= ImageB;
- break;
+ /* We only handle CIEBasedA spaces that map to CalGray. */
+ pdev->procsets |= ImageB;
+ break;
case gs_color_space_index_Indexed:
- pdev->procsets |= ImageI;
- pbcs = pcs->base_space;
- goto csw;
+ pdev->procsets |= ImageI;
+ pbcs = pcs->base_space;
+ goto csw;
default:
- pdev->procsets |= ImageC;
- break;
+ pdev->procsets |= ImageC;
+ break;
}
}
diff --git a/gs/base/gdevpdfc.h b/gs/base/gdevpdfc.h
index fd955fed0..adadd5e01 100644
--- a/gs/base/gdevpdfc.h
+++ b/gs/base/gdevpdfc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ typedef enum {
* Finish creating a CIE-based color space (Calxxx or Lab.)
*/
int pdf_finish_cie_space(cos_array_t *pca, cos_dict_t *pcd,
- const gs_cie_common *pciec);
+ const gs_cie_common *pciec);
/* ------ Exported by gdevpdfk.c for gdevpdfc.c ------ */
@@ -39,21 +39,21 @@ int pdf_finish_cie_space(cos_array_t *pca, cos_dict_t *pcd,
* broken out only for readability.
*/
int pdf_iccbased_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
- const gs_color_space *pcs, cos_array_t *pca);
+ const gs_color_space *pcs, cos_array_t *pca);
/*
* Convert a CIEBased space to Lab or ICCBased.
*/
int pdf_convert_cie_space(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_color_space *pcs, const char *dcsname,
- const gs_cie_common *pciec, const gs_range *prange,
- cie_cache_one_step_t one_step,
- const gs_matrix3 *pmat, const gs_range_t **pprange);
+ const gs_color_space *pcs, const char *dcsname,
+ const gs_cie_common *pciec, const gs_range *prange,
+ cie_cache_one_step_t one_step,
+ const gs_matrix3 *pmat, const gs_range_t **pprange);
/*
* Create a Lab color space object.
*/
int pdf_put_lab_color_space(cos_array_t *pca, cos_dict_t *pcd,
- const gs_range ranges[3] /* only [1] and [2] used */);
+ const gs_range ranges[3] /* only [1] and [2] used */);
#endif /* gdevpdfc_INCLUDED */
diff --git a/gs/base/gdevpdfd.c b/gs/base/gdevpdfd.c
index 4a7f79d00..7fb4d6dd2 100644
--- a/gs/base/gdevpdfd.c
+++ b/gs/base/gdevpdfd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,23 +43,23 @@
/* Fill a rectangle. */
int
gdev_pdf_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
int code;
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
/* Make sure we aren't being clipped. */
code = pdf_put_clip_path(pdev, NULL);
if (code < 0)
- return code;
+ return code;
pdf_set_pure_color(pdev, color, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands);
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands);
if (!pdev->HaveStrokeColor)
- pdev->saved_stroke_color = pdev->saved_fill_color;
+ pdev->saved_stroke_color = pdev->saved_fill_color;
pprintd4(pdev->strm, "%d %d %d %d re f\n", x, y, w, h);
return 0;
}
@@ -76,35 +76,35 @@ pdf_setlinewidth(gx_device_vector * vdev, floatp width)
}
static int
-pdf_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc)
+pdf_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
+ const gx_drawing_color * pdc)
{
return pis != NULL;
}
static int
-pdf_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc)
+pdf_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
+ const gx_drawing_color * pdc)
{
gx_device_pdf *const pdev = (gx_device_pdf *)vdev;
bool hl_color = (*vdev_proc(vdev, can_handle_hl_color)) (vdev, pis, pdc);
const gs_imager_state *pis_for_hl_color = (hl_color ? pis : NULL);
if (!pdev->HaveStrokeColor) {
- /* opdfread.ps assumes same color for stroking and non-stroking operations. */
- int code = pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_stroke_color,
- &pdev->stroke_used_process_color,
- &psdf_set_stroke_color_commands);
- if (code < 0)
- return code;
+ /* opdfread.ps assumes same color for stroking and non-stroking operations. */
+ int code = pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_stroke_color,
+ &pdev->stroke_used_process_color,
+ &psdf_set_stroke_color_commands);
+ if (code < 0)
+ return code;
}
return pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands);
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands);
}
static int
-pdf_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
+pdf_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc)
{
gx_device_pdf *const pdev = (gx_device_pdf *)vdev;
@@ -112,21 +112,21 @@ pdf_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
const gs_imager_state *pis_for_hl_color = (hl_color ? pis : NULL);
if (!pdev->HaveStrokeColor) {
- /* opdfread.ps assumes same color for stroking and non-stroking operations. */
- int code = pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands);
- if (code < 0)
- return code;
+ /* opdfread.ps assumes same color for stroking and non-stroking operations. */
+ int code = pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_fill_color,
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands);
+ if (code < 0)
+ return code;
}
return pdf_set_drawing_color(pdev, pis_for_hl_color, pdc, &pdev->saved_stroke_color,
- &pdev->stroke_used_process_color,
- &psdf_set_stroke_color_commands);
+ &pdev->stroke_used_process_color,
+ &psdf_set_stroke_color_commands);
}
static int
pdf_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1, fixed y1,
- gx_path_type_t type)
+ gx_path_type_t type)
{
gx_device_pdf *pdev = (gx_device_pdf *)vdev;
fixed xmax = int2fixed(32766), ymax = int2fixed(32766);
@@ -139,32 +139,32 @@ pdf_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1, fixed y1,
* stroke width.
*/
if (type & gx_path_type_stroke) {
- double w = vdev->state.line_params.half_width;
- double xw = w * (fabs(vdev->state.ctm.xx) + fabs(vdev->state.ctm.yx));
- int d = float2fixed(xw) + fixed_1;
-
- xmin -= d;
- xmax += d;
- ymin -= d;
- ymax += d;
+ double w = vdev->state.line_params.half_width;
+ double xw = w * (fabs(vdev->state.ctm.xx) + fabs(vdev->state.ctm.yx));
+ int d = float2fixed(xw) + fixed_1;
+
+ xmin -= d;
+ xmax += d;
+ ymin -= d;
+ ymax += d;
}
if (!(type & gx_path_type_clip) &&
- (x0 > xmax || x1 < xmin || y0 > ymax || y1 < ymin ||
- x0 > x1 || y0 > y1)
- )
- return 0; /* nothing to fill or stroke */
+ (x0 > xmax || x1 < xmin || y0 > ymax || y1 < ymin ||
+ x0 > x1 || y0 > y1)
+ )
+ return 0; /* nothing to fill or stroke */
/*
* Clamp coordinates to avoid tripping over Acrobat Reader's limit
* of 32K on user coordinate values.
*/
if (x0 < xmin)
- x0 = xmin;
+ x0 = xmin;
if (x1 > xmax)
- x1 = xmax;
+ x1 = xmax;
if (y0 < ymin)
- y0 = ymin;
+ y0 = ymin;
if (y1 > ymax)
- y1 = ymax;
+ y1 = ymax;
return psdf_dorect(vdev, x0, y0, x1, y1, type);
}
@@ -175,9 +175,9 @@ pdf_endpath(gx_device_vector * vdev, gx_path_type_t type)
}
const gx_device_vector_procs pdf_vector_procs = {
- /* Page management */
+ /* Page management */
NULL,
- /* Imager state */
+ /* Imager state */
pdf_setlinewidth,
psdf_setlinecap,
psdf_setlinejoin,
@@ -185,11 +185,11 @@ const gx_device_vector_procs pdf_vector_procs = {
psdf_setdash,
psdf_setflat,
psdf_setlogop,
- /* Other state */
+ /* Other state */
pdf_can_handle_hl_color,
pdf_setfillcolor,
pdf_setstrokecolor,
- /* Paths */
+ /* Paths */
psdf_dopath,
pdf_dorect,
psdf_beginpath,
@@ -208,15 +208,15 @@ pdf_remember_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
{
/* Used for skipping redundant clip paths. SF bug #624168. */
if (pdev->clip_path != 0) {
- gx_path_free(pdev->clip_path, "pdf clip path");
+ gx_path_free(pdev->clip_path, "pdf clip path");
}
if (pcpath == 0) {
- pdev->clip_path = 0;
- return 0;
+ pdev->clip_path = 0;
+ return 0;
}
pdev->clip_path = gx_path_alloc(pdev->pdf_memory, "pdf clip path");
if (pdev->clip_path == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
return gx_cpath_to_path((gx_clip_path *)pcpath, pdev->clip_path);
}
@@ -231,43 +231,43 @@ pdf_is_same_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
int code, pe_op;
if ((pdev->clip_path != 0) != (pcpath != 0))
- return 0;
+ return 0;
/* Both clip paths are empty, so the same */
if (pdev->clip_path == 0)
- return 1;
+ return 1;
code = gx_path_enum_init(&penum, pdev->clip_path);
if (code < 0)
- return code;
+ return code;
code = gx_cpath_enum_init(&cenum, (gx_clip_path *)pcpath);
if (code < 0)
- return code;
+ return code;
/* This flags a warning in Coverity, uninitialised variable cenum.first_visit */
/* This is because gx_cpath_enum_init doesn't initialise first_visit, but the */
/* variable can be used in enum_next. However, this is not truly used this */
/* way. The enum_init sets the 'state' to 'scan', and the first thing that happens */
/* in enum_next when state is 'scan' is to set first_visit. */
while ((code = gx_cpath_enum_next(&cenum, vs0)) > 0) {
- pe_op = gx_path_enum_next(&penum, vs1);
- if (pe_op < 0)
- return pe_op;
- if (pe_op != code)
- return 0;
- switch (pe_op) {
- case gs_pe_curveto:
- if (vs0[1].x != vs1[1].x || vs0[1].y != vs1[1].y ||
- vs0[2].x != vs1[2].x || vs0[2].y != vs1[2].y)
- return 0;
- case gs_pe_moveto:
- case gs_pe_lineto:
- if (vs0[0].x != vs1[0].x || vs0[0].y != vs1[0].y)
- return 0;
- }
+ pe_op = gx_path_enum_next(&penum, vs1);
+ if (pe_op < 0)
+ return pe_op;
+ if (pe_op != code)
+ return 0;
+ switch (pe_op) {
+ case gs_pe_curveto:
+ if (vs0[1].x != vs1[1].x || vs0[1].y != vs1[1].y ||
+ vs0[2].x != vs1[2].x || vs0[2].y != vs1[2].y)
+ return 0;
+ case gs_pe_moveto:
+ case gs_pe_lineto:
+ if (vs0[0].x != vs1[0].x || vs0[0].y != vs1[0].y)
+ return 0;
+ }
}
if (code < 0)
- return code;
+ return code;
code = gx_path_enum_next(&penum, vs1);
if (code < 0)
- return code;
+ return code;
return (code == 0);
}
@@ -276,44 +276,44 @@ bool
pdf_must_put_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
{
if (pcpath == NULL) {
- if (pdev->clip_path_id == pdev->no_clip_path_id)
- return false;
- } else {
- if (pdev->clip_path_id == pcpath->id)
- return false;
- if (gx_cpath_includes_rectangle(pcpath, fixed_0, fixed_0,
- int2fixed(pdev->width),
- int2fixed(pdev->height)))
- if (pdev->clip_path_id == pdev->no_clip_path_id)
- return false;
- if (pdf_is_same_clip_path(pdev, pcpath) > 0) {
- pdev->clip_path_id = pcpath->id;
- return false;
- }
+ if (pdev->clip_path_id == pdev->no_clip_path_id)
+ return false;
+ } else {
+ if (pdev->clip_path_id == pcpath->id)
+ return false;
+ if (gx_cpath_includes_rectangle(pcpath, fixed_0, fixed_0,
+ int2fixed(pdev->width),
+ int2fixed(pdev->height)))
+ if (pdev->clip_path_id == pdev->no_clip_path_id)
+ return false;
+ if (pdf_is_same_clip_path(pdev, pcpath) > 0) {
+ pdev->clip_path_id = pcpath->id;
+ return false;
+ }
}
return true;
}
/* Put a single element of a clipping path list. */
static int
-pdf_put_clip_path_list_elem(gx_device_pdf * pdev, gx_cpath_path_list *e,
- gs_path_enum *cenum, gdev_vector_dopath_state_t *state,
- gs_fixed_point vs[3])
+pdf_put_clip_path_list_elem(gx_device_pdf * pdev, gx_cpath_path_list *e,
+ gs_path_enum *cenum, gdev_vector_dopath_state_t *state,
+ gs_fixed_point vs[3])
{ /* This recursive function provides a reverse order of the list elements. */
int pe_op;
if (e->next != NULL) {
- int code = pdf_put_clip_path_list_elem(pdev, e->next, cenum, state, vs);
+ int code = pdf_put_clip_path_list_elem(pdev, e->next, cenum, state, vs);
- if (code != 0)
- return code;
+ if (code != 0)
+ return code;
}
gx_path_enum_init(cenum, &e->path);
while ((pe_op = gx_path_enum_next(cenum, vs)) > 0)
- gdev_vector_dopath_segment(state, pe_op, vs);
+ gdev_vector_dopath_segment(state, pe_op, vs);
pprints1(pdev->strm, "%s n\n", (e->rule <= 0 ? "W" : "W*"));
if (pe_op < 0)
- return pe_op;
+ return pe_op;
return 0;
}
@@ -327,28 +327,28 @@ pdf_put_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
/* Check for no update needed. */
if (pcpath == NULL) {
- if (pdev->clip_path_id == pdev->no_clip_path_id)
- return 0;
- new_id = pdev->no_clip_path_id;
+ if (pdev->clip_path_id == pdev->no_clip_path_id)
+ return 0;
+ new_id = pdev->no_clip_path_id;
} else {
- if (pdev->clip_path_id == pcpath->id)
- return 0;
- new_id = pcpath->id;
- if (gx_cpath_includes_rectangle(pcpath, fixed_0, fixed_0,
- int2fixed(pdev->width),
- int2fixed(pdev->height))
- ) {
- if (pdev->clip_path_id == pdev->no_clip_path_id)
- return 0;
- new_id = pdev->no_clip_path_id;
- }
- code = pdf_is_same_clip_path(pdev, pcpath);
- if (code < 0)
- return code;
- if (code) {
- pdev->clip_path_id = new_id;
- return 0;
- }
+ if (pdev->clip_path_id == pcpath->id)
+ return 0;
+ new_id = pcpath->id;
+ if (gx_cpath_includes_rectangle(pcpath, fixed_0, fixed_0,
+ int2fixed(pdev->width),
+ int2fixed(pdev->height))
+ ) {
+ if (pdev->clip_path_id == pdev->no_clip_path_id)
+ return 0;
+ new_id = pdev->no_clip_path_id;
+ }
+ code = pdf_is_same_clip_path(pdev, pcpath);
+ if (code < 0)
+ return code;
+ if (code) {
+ pdev->clip_path_id = new_id;
+ return 0;
+ }
}
/*
* The contents must be open already, so the following will only exit
@@ -356,70 +356,70 @@ pdf_put_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
*/
code = pdf_open_contents(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
/* Use Q to unwind the old clipping path. */
if (pdev->vgstack_depth > pdev->vgstack_bottom) {
- code = pdf_restore_viewer_state(pdev, s);
- if (code < 0)
- return code;
+ code = pdf_restore_viewer_state(pdev, s);
+ if (code < 0)
+ return code;
}
if (new_id != pdev->no_clip_path_id) {
- const gs_fixed_rect *rect = cpath_is_rectangle(pcpath);
-
- /* Use q to allow the new clipping path to unwind. */
- code = pdf_save_viewer_state(pdev, s);
- if (code < 0)
- return code;
- if (rect != NULL) {
- /* Use unrounded coordinates. */
- pprintg4(s, "%g %g %g %g re",
- fixed2float(rect->p.x), fixed2float(rect->p.y),
- fixed2float(rect->q.x - rect->p.x),
- fixed2float(rect->q.y - rect->p.y));
- pprints1(s, " %s n\n", (pcpath->rule <= 0 ? "W" : "W*"));
- } else {
- gdev_vector_dopath_state_t state;
- gs_fixed_point vs[3];
- int pe_op;
-
- gdev_vector_dopath_init(&state, (gx_device_vector *)pdev,
- gx_path_type_fill, NULL);
- if (pcpath->path_list == NULL) {
- /*
- * We think this should be never executed.
- * This obsolete branch writes a clip path intersection
- * as a set of rectangles computed by
- * gx_cpath_intersect_path_slow.
- * Those rectangles use coordinates rounded to pixels,
- * therefore the precision may be unsatisfactory -
- * see Bug 688407.
- */
- gs_cpath_enum cenum;
-
- /*
- * We have to break 'const' here because the clip path
- * enumeration logic uses some internal mark bits.
- * This is very unfortunate, but until we can come up with
- * a better algorithm, it's necessary.
- */
- gx_cpath_enum_init(&cenum, (gx_clip_path *) pcpath);
- while ((pe_op = gx_cpath_enum_next(&cenum, vs)) > 0)
- gdev_vector_dopath_segment(&state, pe_op, vs);
- pprints1(s, "%s n\n", (pcpath->rule <= 0 ? "W" : "W*"));
- if (pe_op < 0)
- return pe_op;
- } else {
- gs_path_enum cenum;
-
- code = pdf_put_clip_path_list_elem(pdev, pcpath->path_list, &cenum, &state, vs);
- if (code < 0)
- return code;
- }
- }
+ const gs_fixed_rect *rect = cpath_is_rectangle(pcpath);
+
+ /* Use q to allow the new clipping path to unwind. */
+ code = pdf_save_viewer_state(pdev, s);
+ if (code < 0)
+ return code;
+ if (rect != NULL) {
+ /* Use unrounded coordinates. */
+ pprintg4(s, "%g %g %g %g re",
+ fixed2float(rect->p.x), fixed2float(rect->p.y),
+ fixed2float(rect->q.x - rect->p.x),
+ fixed2float(rect->q.y - rect->p.y));
+ pprints1(s, " %s n\n", (pcpath->rule <= 0 ? "W" : "W*"));
+ } else {
+ gdev_vector_dopath_state_t state;
+ gs_fixed_point vs[3];
+ int pe_op;
+
+ gdev_vector_dopath_init(&state, (gx_device_vector *)pdev,
+ gx_path_type_fill, NULL);
+ if (pcpath->path_list == NULL) {
+ /*
+ * We think this should be never executed.
+ * This obsolete branch writes a clip path intersection
+ * as a set of rectangles computed by
+ * gx_cpath_intersect_path_slow.
+ * Those rectangles use coordinates rounded to pixels,
+ * therefore the precision may be unsatisfactory -
+ * see Bug 688407.
+ */
+ gs_cpath_enum cenum;
+
+ /*
+ * We have to break 'const' here because the clip path
+ * enumeration logic uses some internal mark bits.
+ * This is very unfortunate, but until we can come up with
+ * a better algorithm, it's necessary.
+ */
+ gx_cpath_enum_init(&cenum, (gx_clip_path *) pcpath);
+ while ((pe_op = gx_cpath_enum_next(&cenum, vs)) > 0)
+ gdev_vector_dopath_segment(&state, pe_op, vs);
+ pprints1(s, "%s n\n", (pcpath->rule <= 0 ? "W" : "W*"));
+ if (pe_op < 0)
+ return pe_op;
+ } else {
+ gs_path_enum cenum;
+
+ code = pdf_put_clip_path_list_elem(pdev, pcpath->path_list, &cenum, &state, vs);
+ if (code < 0)
+ return code;
+ }
+ }
}
pdev->clip_path_id = new_id;
- return pdf_remember_clip_path(pdev,
- (pdev->clip_path_id == pdev->no_clip_path_id ? NULL : pcpath));
+ return pdf_remember_clip_path(pdev,
+ (pdev->clip_path_id == pdev->no_clip_path_id ? NULL : pcpath));
}
/*
@@ -430,22 +430,22 @@ pdf_put_clip_path(gx_device_pdf * pdev, const gx_clip_path * pcpath)
*/
static bool
make_rect_scaling(const gx_device_pdf *pdev, const gs_fixed_rect *bbox,
- floatp prescale, double *pscale)
+ floatp prescale, double *pscale)
{
double bmin, bmax;
bmin = min(bbox->p.x / pdev->scale.x, bbox->p.y / pdev->scale.y) * prescale;
bmax = max(bbox->q.x / pdev->scale.x, bbox->q.y / pdev->scale.y) * prescale;
if (bmin <= int2fixed(-MAX_USER_COORD) ||
- bmax > int2fixed(MAX_USER_COORD)
- ) {
- /* Rescale the path. */
- *pscale = max(bmin / int2fixed(-MAX_USER_COORD),
- bmax / int2fixed(MAX_USER_COORD));
- return true;
+ bmax > int2fixed(MAX_USER_COORD)
+ ) {
+ /* Rescale the path. */
+ *pscale = max(bmin / int2fixed(-MAX_USER_COORD),
+ bmax / int2fixed(MAX_USER_COORD));
+ return true;
} else {
- *pscale = 1;
- return false;
+ *pscale = 1;
+ return false;
}
}
@@ -456,8 +456,8 @@ make_rect_scaling(const gx_device_pdf *pdev, const gs_fixed_rect *bbox,
*/
static int
prepare_fill_with_clip(gx_device_pdf *pdev, const gs_imager_state * pis,
- gs_fixed_rect *box, bool have_path,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ gs_fixed_rect *box, bool have_path,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
bool new_clip;
int code;
@@ -468,23 +468,23 @@ prepare_fill_with_clip(gx_device_pdf *pdev, const gs_imager_state * pis,
if (pcpath) {
gs_fixed_rect cbox;
- gx_cpath_outer_box(pcpath, &cbox);
- if (cbox.p.x >= cbox.q.x || cbox.p.y >= cbox.q.y)
- return 1; /* empty clipping path */
+ gx_cpath_outer_box(pcpath, &cbox);
+ if (cbox.p.x >= cbox.q.x || cbox.p.y >= cbox.q.y)
+ return 1; /* empty clipping path */
*box = cbox;
}
new_clip = pdf_must_put_clip_path(pdev, pcpath);
if (have_path || pdev->context == PDF_IN_NONE || new_clip) {
- if (new_clip)
- code = pdf_unclip(pdev);
- else
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ if (new_clip)
+ code = pdf_unclip(pdev);
+ else
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
}
code = pdf_prepare_fill(pdev, pis);
if (code < 0)
- return code;
+ return code;
return pdf_put_clip_path(pdev, pcpath);
}
@@ -492,26 +492,26 @@ prepare_fill_with_clip(gx_device_pdf *pdev, const gs_imager_state * pis,
public_st_pdf_lcvd_t();
-static int
+static int
lcvd_fill_rectangle_shifted(gx_device *dev, int x, int y, int width, int height, gx_color_index color)
{
pdf_lcvd_t *cvd = (pdf_lcvd_t *)dev;
- return cvd->std_fill_rectangle((gx_device *)&cvd->mdev,
- x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, color);
+ return cvd->std_fill_rectangle((gx_device *)&cvd->mdev,
+ x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, color);
}
-static int
+static int
lcvd_fill_rectangle_shifted2(gx_device *dev, int x, int y, int width, int height, gx_color_index color)
{
pdf_lcvd_t *cvd = (pdf_lcvd_t *)dev;
int code;
- code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
- x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, (gx_color_index)1);
+ code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
+ x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, (gx_color_index)1);
if (code < 0)
- return code;
- return cvd->std_fill_rectangle((gx_device *)&cvd->mdev,
- x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, color);
+ return code;
+ return cvd->std_fill_rectangle((gx_device *)&cvd->mdev,
+ x - cvd->mdev.mapped_x, y - cvd->mdev.mapped_y, width, height, color);
}
static void
lcvd_get_clipping_box_shifted_from_mdev(gx_device *dev, gs_fixed_rect *pbox)
@@ -527,9 +527,9 @@ lcvd_get_clipping_box_shifted_from_mdev(gx_device *dev, gs_fixed_rect *pbox)
pbox->p.y += ofs;
pbox->q.y += ofs;
}
-static int
+static int
lcvd_dev_spec_op(gx_device *pdev1, int dev_spec_op,
- void *data, int size)
+ void *data, int size)
{
switch (dev_spec_op) {
case gxdso_pattern_shading_area:
@@ -545,7 +545,7 @@ lcvd_dev_spec_op(gx_device *pdev1, int dev_spec_op,
}
return gx_default_dev_spec_op(pdev1, dev_spec_op, data, size);
}
-static int
+static int
lcvd_close_device_with_writing(gx_device *pdev)
{
/* Assuming 'mdev' is being closed before 'mask' - see gx_image3_end_image. */
@@ -566,14 +566,14 @@ write_image(gx_device_pdf *pdev, gx_device_memory *mdev, gs_matrix *m)
int code;
if (m != NULL)
- pdf_put_matrix(pdev, NULL, m, " cm\n");
- code = pdf_copy_color_data(pdev, mdev->base, sourcex,
- mdev->raster, gx_no_bitmap_id, 0, 0, mdev->width, mdev->height,
- &image, &writer, 2);
+ pdf_put_matrix(pdev, NULL, m, " cm\n");
+ code = pdf_copy_color_data(pdev, mdev->base, sourcex,
+ mdev->raster, gx_no_bitmap_id, 0, 0, mdev->width, mdev->height,
+ &image, &writer, 2);
if (code == 1)
- code = 0; /* Empty image. */
+ code = 0; /* Empty image. */
else if (code == 0)
- code = pdf_do_image(pdev, writer.pres, NULL, true);
+ code = pdf_do_image(pdev, writer.pres, NULL, true);
return code;
}
static int
@@ -585,14 +585,14 @@ write_mask(gx_device_pdf *pdev, gx_device_memory *mdev, gs_matrix *m)
int code;
if (m != NULL)
- pdf_put_matrix(pdev, NULL, m, " cm\n");
+ pdf_put_matrix(pdev, NULL, m, " cm\n");
pdev->clip_path_id = pdev->no_clip_path_id;
pdev->skip_colors = true;
- code = gdev_pdf_copy_mono((gx_device *)pdev, mdev->base, sourcex,
- mdev->raster, gx_no_bitmap_id, 0, 0, mdev->width, mdev->height,
- gx_no_color_index, (gx_color_index)0);
+ code = gdev_pdf_copy_mono((gx_device *)pdev, mdev->base, sourcex,
+ mdev->raster, gx_no_bitmap_id, 0, 0, mdev->width, mdev->height,
+ gx_no_color_index, (gx_color_index)0);
pdev->clip_path_id = save_clip_id;
- pdev->skip_colors = save_skip_color;
+ pdev->skip_colors = save_skip_color;
return code;
}
@@ -606,66 +606,66 @@ max_subimage_width(int width, byte *base, int x0, long count1, int *x1, long *co
byte *q = base + (x / 8), m = 0x80 >> (x % 8);
for (; x < width; x++) {
- r = !(*q & m);
- if (p != r) {
- if (c >= c1) {
- if (!r)
- goto ex; /* stop before the upgrade. */
- }
- c++;
- }
- p = r;
- m >>= 1;
- if (!m) {
- m = 0x80;
- q++;
- }
+ r = !(*q & m);
+ if (p != r) {
+ if (c >= c1) {
+ if (!r)
+ goto ex; /* stop before the upgrade. */
+ }
+ c++;
+ }
+ p = r;
+ m >>= 1;
+ if (!m) {
+ m = 0x80;
+ q++;
+ }
}
if (p)
- c++; /* Account the last downgrade. */
+ c++; /* Account the last downgrade. */
ex:
*count = c;
*x1 = x;
}
static void
-compute_subimage(int width, int height, int raster, byte *base,
- int x0, int y0, long MaxClipPathSize, int *x1, int *y1)
+compute_subimage(int width, int height, int raster, byte *base,
+ int x0, int y0, long MaxClipPathSize, int *x1, int *y1)
{
/* Returns a semiopen range : [x0:x1)*[y0:y1). */
if (x0 != 0) {
- long count;
+ long count;
- /* A partial single scanline. */
- max_subimage_width(width, base + y0 * raster, x0, MaxClipPathSize / 4, x1, &count);
- *y1 = y0;
+ /* A partial single scanline. */
+ max_subimage_width(width, base + y0 * raster, x0, MaxClipPathSize / 4, x1, &count);
+ *y1 = y0;
} else {
- int xx, y = y0, yy;
- long count, count1 = MaxClipPathSize / 4;
-
- for(; y < height && count1 > 0; ) {
- max_subimage_width(width, base + y * raster, 0, count1, &xx, &count);
- if (xx < width) {
- if (y == y0) {
- /* Partial single scanline. */
- *y1 = y + 1;
- *x1 = xx;
- return;
- } else {
- /* Full lines before this scanline. */
- break;
- }
- }
- count1 -= count;
- yy = y + 1;
- for (; yy < height; yy++)
- if (memcmp(base + raster * y, base + raster * yy, raster))
- break;
- y = yy;
-
- }
- *y1 = y;
- *x1 = width;
+ int xx, y = y0, yy;
+ long count, count1 = MaxClipPathSize / 4;
+
+ for(; y < height && count1 > 0; ) {
+ max_subimage_width(width, base + y * raster, 0, count1, &xx, &count);
+ if (xx < width) {
+ if (y == y0) {
+ /* Partial single scanline. */
+ *y1 = y + 1;
+ *x1 = xx;
+ return;
+ } else {
+ /* Full lines before this scanline. */
+ break;
+ }
+ }
+ count1 -= count;
+ yy = y + 1;
+ for (; yy < height; yy++)
+ if (memcmp(base + raster * y, base + raster * yy, raster))
+ break;
+ y = yy;
+
+ }
+ *y1 = y;
+ *x1 = width;
}
}
@@ -677,64 +677,64 @@ image_line_to_clip(gx_device_pdf *pdev, byte *base, int x0, int x1, int y0, int
long c = 0;
for (;;) {
- /* Look for upgrade : */
- for (; x < x1; x++) {
- if (*q & m)
- break;
- m >>= 1;
- if (!m) {
- m = 0x80;
- q++;
- }
- }
- if (x == x1)
- return c;
- xx = x;
- /* Look for downgrade : */
- for (; x < x1; x++) {
- if (!(*q & m))
- break;
- m >>= 1;
- if (!m) {
- m = 0x80;
- q++;
- }
- }
- /* Found the interval [xx:x). */
- if (!started) {
- stream_puts(pdev->strm, "n\n");
- started = true;
- }
- pprintld2(pdev->strm, "%ld %ld m ", xx, y0);
- pprintld2(pdev->strm, "%ld %ld l ", x, y0);
- pprintld2(pdev->strm, "%ld %ld l ", x, y1);
- pprintld2(pdev->strm, "%ld %ld l h\n", xx, y1);
- c += 4;
+ /* Look for upgrade : */
+ for (; x < x1; x++) {
+ if (*q & m)
+ break;
+ m >>= 1;
+ if (!m) {
+ m = 0x80;
+ q++;
+ }
+ }
+ if (x == x1)
+ return c;
+ xx = x;
+ /* Look for downgrade : */
+ for (; x < x1; x++) {
+ if (!(*q & m))
+ break;
+ m >>= 1;
+ if (!m) {
+ m = 0x80;
+ q++;
+ }
+ }
+ /* Found the interval [xx:x). */
+ if (!started) {
+ stream_puts(pdev->strm, "n\n");
+ started = true;
+ }
+ pprintld2(pdev->strm, "%ld %ld m ", xx, y0);
+ pprintld2(pdev->strm, "%ld %ld l ", x, y0);
+ pprintld2(pdev->strm, "%ld %ld l ", x, y1);
+ pprintld2(pdev->strm, "%ld %ld l h\n", xx, y1);
+ c += 4;
}
return c;
}
static int
-mask_to_clip(gx_device_pdf *pdev, int width, int height,
- int raster, byte *base, int x0, int y0, int x1, int y1)
+mask_to_clip(gx_device_pdf *pdev, int width, int height,
+ int raster, byte *base, int x0, int y0, int x1, int y1)
{
int y, yy, code = 0;
bool has_segments = false;
for (y = y0; y < y1 && code >= 0;) {
- yy = y + 1;
- if (x0 == 0) {
- for (; yy < y1; yy++)
- if (memcmp(base + raster * y, base + raster * yy, raster))
- break;
- }
- code = image_line_to_clip(pdev, base + raster * y, x0, x1, y, yy, has_segments);
- if (code > 0)
- has_segments = true;
- y = yy;
+ yy = y + 1;
+ if (x0 == 0) {
+ for (; yy < y1; yy++)
+ if (memcmp(base + raster * y, base + raster * yy, raster))
+ break;
+ }
+ code = image_line_to_clip(pdev, base + raster * y, x0, x1, y, yy, has_segments);
+ if (code > 0)
+ has_segments = true;
+ y = yy;
}
if (has_segments)
- stream_puts(pdev->strm, "W n\n");
+ stream_puts(pdev->strm, "W n\n");
return code < 0 ? code : has_segments ? 1 : 0;
}
@@ -750,56 +750,56 @@ write_subimage(gx_device_pdf *pdev, gx_device_memory *mdev, int x, int y, int x1
int Y1 = min(mdev->height, y1 + 1);
int code;
- code = pdf_copy_color_data(pdev, mdev->base + mdev->raster * Y, X,
- mdev->raster, gx_no_bitmap_id,
- X, Y, X1 - X, Y1 - Y,
- &image, &writer, 2);
+ code = pdf_copy_color_data(pdev, mdev->base + mdev->raster * Y, X,
+ mdev->raster, gx_no_bitmap_id,
+ X, Y, X1 - X, Y1 - Y,
+ &image, &writer, 2);
if (code < 0)
- return code;
+ return code;
if (!writer.pres)
- return 0; /* inline image. */
+ return 0; /* inline image. */
return pdf_do_image(pdev, writer.pres, NULL, true);
}
-static int
+static int
write_image_with_clip(gx_device_pdf *pdev, pdf_lcvd_t *cvd)
{
int x = 0, y = 0;
int code, code1;
if (cvd->write_matrix)
- pdf_put_matrix(pdev, NULL, &cvd->m, " cm q\n");
+ pdf_put_matrix(pdev, NULL, &cvd->m, " cm q\n");
for(;;) {
- int x1, y1;
-
- compute_subimage(cvd->mask->width, cvd->mask->height,
- cvd->mask->raster, cvd->mask->base,
- x, y, max(pdev->MaxClipPathSize, 100), &x1, &y1);
- code = mask_to_clip(pdev,
- cvd->mask->width, cvd->mask->height,
- cvd->mask->raster, cvd->mask->base,
- x, y, x1, y1);
- if (code < 0)
- return code;
- if (code > 0) {
- code1 = write_subimage(pdev, &cvd->mdev, x, y, x1, y1);
- if (code1 < 0)
- return code1;
- }
- if (x1 >= cvd->mdev.width && y1 >= cvd->mdev.height)
- break;
- if (code > 0)
- stream_puts(pdev->strm, "Q q\n");
- if (x1 == cvd->mask->width) {
- x = 0;
- y = y1;
- } else {
- x = x1;
- y = y1;
- }
+ int x1, y1;
+
+ compute_subimage(cvd->mask->width, cvd->mask->height,
+ cvd->mask->raster, cvd->mask->base,
+ x, y, max(pdev->MaxClipPathSize, 100), &x1, &y1);
+ code = mask_to_clip(pdev,
+ cvd->mask->width, cvd->mask->height,
+ cvd->mask->raster, cvd->mask->base,
+ x, y, x1, y1);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ code1 = write_subimage(pdev, &cvd->mdev, x, y, x1, y1);
+ if (code1 < 0)
+ return code1;
+ }
+ if (x1 >= cvd->mdev.width && y1 >= cvd->mdev.height)
+ break;
+ if (code > 0)
+ stream_puts(pdev->strm, "Q q\n");
+ if (x1 == cvd->mask->width) {
+ x = 0;
+ y = y1;
+ } else {
+ x = x1;
+ y = y1;
+ }
}
if (cvd->write_matrix)
- stream_puts(pdev->strm, "Q\n");
+ stream_puts(pdev->strm, "Q\n");
return 0;
}
@@ -809,66 +809,66 @@ pdf_dump_converted_image(gx_device_pdf *pdev, pdf_lcvd_t *cvd)
int code = 0;
if (!cvd->path_is_empty || cvd->has_background) {
- if (!cvd->has_background)
- stream_puts(pdev->strm, "W n\n");
- code = write_image(pdev, &cvd->mdev, (cvd->write_matrix ? &cvd->m : NULL));
- cvd->path_is_empty = true;
+ if (!cvd->has_background)
+ stream_puts(pdev->strm, "W n\n");
+ code = write_image(pdev, &cvd->mdev, (cvd->write_matrix ? &cvd->m : NULL));
+ cvd->path_is_empty = true;
} else if (!cvd->mask_is_empty && pdev->PatternImagemask) {
- /* Convert to imagemask with a pattern color. */
- /* See also use_image_as_pattern in gdevpdfi.c . */
- gs_imager_state s;
- gs_pattern1_instance_t inst;
- gs_id id = gs_next_ids(cvd->mdev.memory, 1);
- cos_value_t v;
- const pdf_resource_t *pres;
-
- memset(&s, 0, sizeof(s));
- s.ctm.xx = cvd->m.xx;
- s.ctm.xy = cvd->m.xy;
- s.ctm.yx = cvd->m.yx;
- s.ctm.yy = cvd->m.yy;
- s.ctm.tx = cvd->m.tx;
- s.ctm.ty = cvd->m.ty;
- memset(&inst, 0, sizeof(inst));
- inst.saved = (gs_state *)&s; /* HACK : will use s.ctm only. */
- inst.template.PaintType = 1;
- inst.template.TilingType = 1;
- inst.template.BBox.p.x = inst.template.BBox.p.y = 0;
- inst.template.BBox.q.x = cvd->mdev.width;
- inst.template.BBox.q.y = cvd->mdev.height;
- inst.template.XStep = (float)cvd->mdev.width;
- inst.template.YStep = (float)cvd->mdev.height;
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_start_accum, &inst, id);
- if (code >= 0) {
- stream_puts(pdev->strm, "W n\n");
- code = write_image(pdev, &cvd->mdev, NULL);
- }
- pres = pdev->accumulating_substream_resource;
- if (code >= 0)
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_finish_accum, &inst, id);
- if (code >= 0)
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_load, &inst, id);
- if (code >= 0)
- code = pdf_cs_Pattern_colored(pdev, &v);
- if (code >= 0) {
- cos_value_write(&v, pdev);
- pprintld1(pdev->strm, " cs /R%ld scn ", pdf_resource_id(pres));
- }
- if (code >= 0)
- code = write_mask(pdev, cvd->mask, (cvd->write_matrix ? &cvd->m : NULL));
- cvd->mask_is_empty = true;
+ /* Convert to imagemask with a pattern color. */
+ /* See also use_image_as_pattern in gdevpdfi.c . */
+ gs_imager_state s;
+ gs_pattern1_instance_t inst;
+ gs_id id = gs_next_ids(cvd->mdev.memory, 1);
+ cos_value_t v;
+ const pdf_resource_t *pres;
+
+ memset(&s, 0, sizeof(s));
+ s.ctm.xx = cvd->m.xx;
+ s.ctm.xy = cvd->m.xy;
+ s.ctm.yx = cvd->m.yx;
+ s.ctm.yy = cvd->m.yy;
+ s.ctm.tx = cvd->m.tx;
+ s.ctm.ty = cvd->m.ty;
+ memset(&inst, 0, sizeof(inst));
+ inst.saved = (gs_state *)&s; /* HACK : will use s.ctm only. */
+ inst.template.PaintType = 1;
+ inst.template.TilingType = 1;
+ inst.template.BBox.p.x = inst.template.BBox.p.y = 0;
+ inst.template.BBox.q.x = cvd->mdev.width;
+ inst.template.BBox.q.y = cvd->mdev.height;
+ inst.template.XStep = (float)cvd->mdev.width;
+ inst.template.YStep = (float)cvd->mdev.height;
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_start_accum, &inst, id);
+ if (code >= 0) {
+ stream_puts(pdev->strm, "W n\n");
+ code = write_image(pdev, &cvd->mdev, NULL);
+ }
+ pres = pdev->accumulating_substream_resource;
+ if (code >= 0)
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_finish_accum, &inst, id);
+ if (code >= 0)
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_load, &inst, id);
+ if (code >= 0)
+ code = pdf_cs_Pattern_colored(pdev, &v);
+ if (code >= 0) {
+ cos_value_write(&v, pdev);
+ pprintld1(pdev->strm, " cs /R%ld scn ", pdf_resource_id(pres));
+ }
+ if (code >= 0)
+ code = write_mask(pdev, cvd->mask, (cvd->write_matrix ? &cvd->m : NULL));
+ cvd->mask_is_empty = true;
} else if (!cvd->mask_is_empty && !pdev->PatternImagemask) {
- /* Convert to image with a clipping path. */
- stream_puts(pdev->strm, "q\n");
- code = write_image_with_clip(pdev, cvd);
- stream_puts(pdev->strm, "Q\n");
+ /* Convert to image with a clipping path. */
+ stream_puts(pdev->strm, "q\n");
+ code = write_image_with_clip(pdev, cvd);
+ stream_puts(pdev->strm, "Q\n");
}
if (code > 0)
- code = (*dev_proc(&cvd->mdev, fill_rectangle))((gx_device *)&cvd->mdev,
- 0, 0, cvd->mdev.width, cvd->mdev.height, (gx_color_index)0);
+ code = (*dev_proc(&cvd->mdev, fill_rectangle))((gx_device *)&cvd->mdev,
+ 0, 0, cvd->mdev.width, cvd->mdev.height, (gx_color_index)0);
return code;
}
static int
@@ -882,65 +882,65 @@ lcvd_handle_fill_path_as_shading_coverage(gx_device *dev,
int code;
if (cvd->has_background)
- return 0;
+ return 0;
if (gx_path_is_null(ppath)) {
- /* use the mask. */
- if (!cvd->path_is_empty) {
- code = pdf_dump_converted_image(pdev, cvd);
- if (code < 0)
- return code;
- stream_puts(pdev->strm, "Q q\n");
- dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted2;
- }
- if (!cvd->mask_is_clean || !cvd->path_is_empty) {
- code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
- 0, 0, cvd->mask->width, cvd->mask->height, (gx_color_index)0);
- if (code < 0)
- return code;
- cvd->mask_is_clean = true;
- }
- cvd->path_is_empty = true;
- cvd->mask_is_empty = false;
+ /* use the mask. */
+ if (!cvd->path_is_empty) {
+ code = pdf_dump_converted_image(pdev, cvd);
+ if (code < 0)
+ return code;
+ stream_puts(pdev->strm, "Q q\n");
+ dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted2;
+ }
+ if (!cvd->mask_is_clean || !cvd->path_is_empty) {
+ code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
+ 0, 0, cvd->mask->width, cvd->mask->height, (gx_color_index)0);
+ if (code < 0)
+ return code;
+ cvd->mask_is_clean = true;
+ }
+ cvd->path_is_empty = true;
+ cvd->mask_is_empty = false;
} else {
- gs_matrix m;
-
- gs_make_translation(cvd->path_offset.x, cvd->path_offset.y, &m);
- /* use the clipping. */
- if (!cvd->mask_is_empty) {
- code = pdf_dump_converted_image(pdev, cvd);
- if (code < 0)
- return code;
- stream_puts(pdev->strm, "Q q\n");
- dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted;
- cvd->mask_is_empty = true;
- }
- code = gdev_vector_dopath((gx_device_vector *)pdev, ppath,
- gx_path_type_fill | gx_path_type_optimize, &m);
- if (code < 0)
- return code;
- stream_puts(pdev->strm, "h\n");
- cvd->path_is_empty = false;
+ gs_matrix m;
+
+ gs_make_translation(cvd->path_offset.x, cvd->path_offset.y, &m);
+ /* use the clipping. */
+ if (!cvd->mask_is_empty) {
+ code = pdf_dump_converted_image(pdev, cvd);
+ if (code < 0)
+ return code;
+ stream_puts(pdev->strm, "Q q\n");
+ dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted;
+ cvd->mask_is_empty = true;
+ }
+ code = gdev_vector_dopath((gx_device_vector *)pdev, ppath,
+ gx_path_type_fill | gx_path_type_optimize, &m);
+ if (code < 0)
+ return code;
+ stream_puts(pdev->strm, "h\n");
+ cvd->path_is_empty = false;
}
return 0;
}
int
-pdf_setup_masked_image_converter(gx_device_pdf *pdev, gs_memory_t *mem, const gs_matrix *m, pdf_lcvd_t **pcvd,
- bool need_mask, int x, int y, int w, int h, bool write_on_close)
+pdf_setup_masked_image_converter(gx_device_pdf *pdev, gs_memory_t *mem, const gs_matrix *m, pdf_lcvd_t **pcvd,
+ bool need_mask, int x, int y, int w, int h, bool write_on_close)
{
int code;
gx_device_memory *mask = 0;
pdf_lcvd_t *cvd = *pcvd;
if (cvd == NULL) {
- cvd = gs_alloc_struct(mem, pdf_lcvd_t, &st_pdf_lcvd_t, "pdf_setup_masked_image_converter");
- if (cvd == NULL)
- return_error(gs_error_VMerror);
- *pcvd = cvd;
+ cvd = gs_alloc_struct(mem, pdf_lcvd_t, &st_pdf_lcvd_t, "pdf_setup_masked_image_converter");
+ if (cvd == NULL)
+ return_error(gs_error_VMerror);
+ *pcvd = cvd;
}
cvd->pdev = pdev;
gs_make_mem_device(&cvd->mdev, gdev_mem_device_for_bits(pdev->color_info.depth),
- mem, 0, (gx_device *)pdev);
+ mem, 0, (gx_device *)pdev);
cvd->mdev.width = w;
cvd->mdev.height = h;
cvd->mdev.mapped_x = x;
@@ -955,50 +955,50 @@ pdf_setup_masked_image_converter(gx_device_pdf *pdev, gs_memory_t *mem, const gs
cvd->write_matrix = true;
code = (*dev_proc(&cvd->mdev, open_device))((gx_device *)&cvd->mdev);
if (code < 0)
- return code;
- code = (*dev_proc(&cvd->mdev, fill_rectangle))((gx_device *)&cvd->mdev,
- 0, 0, cvd->mdev.width, cvd->mdev.height, (gx_color_index)0);
+ return code;
+ code = (*dev_proc(&cvd->mdev, fill_rectangle))((gx_device *)&cvd->mdev,
+ 0, 0, cvd->mdev.width, cvd->mdev.height, (gx_color_index)0);
if (code < 0)
- return code;
+ return code;
if (need_mask) {
- mask = gs_alloc_struct(mem, gx_device_memory, &st_device_memory, "pdf_setup_masked_image_converter");
- if (mask == NULL)
- return_error(gs_error_VMerror);
- cvd->mask = mask;
- gs_make_mem_mono_device(mask, mem, (gx_device *)pdev);
- mask->width = cvd->mdev.width;
- mask->height = cvd->mdev.height;
- mask->bitmap_memory = mem;
- code = (*dev_proc(mask, open_device))((gx_device *)mask);
- if (code < 0)
- return code;
- if (write_on_close) {
- code = (*dev_proc(mask, fill_rectangle))((gx_device *)mask,
- 0, 0, mask->width, mask->height, (gx_color_index)0);
- if (code < 0)
- return code;
- }
+ mask = gs_alloc_struct(mem, gx_device_memory, &st_device_memory, "pdf_setup_masked_image_converter");
+ if (mask == NULL)
+ return_error(gs_error_VMerror);
+ cvd->mask = mask;
+ gs_make_mem_mono_device(mask, mem, (gx_device *)pdev);
+ mask->width = cvd->mdev.width;
+ mask->height = cvd->mdev.height;
+ mask->bitmap_memory = mem;
+ code = (*dev_proc(mask, open_device))((gx_device *)mask);
+ if (code < 0)
+ return code;
+ if (write_on_close) {
+ code = (*dev_proc(mask, fill_rectangle))((gx_device *)mask,
+ 0, 0, mask->width, mask->height, (gx_color_index)0);
+ if (code < 0)
+ return code;
+ }
}
cvd->std_fill_rectangle = dev_proc(&cvd->mdev, fill_rectangle);
cvd->std_close_device = dev_proc(&cvd->mdev, close_device);
cvd->std_get_clipping_box = dev_proc(&cvd->mdev, get_clipping_box);
if (!write_on_close) {
- /* Type 3 images will write to the mask directly. */
- dev_proc(&cvd->mdev, fill_rectangle) = (need_mask ? lcvd_fill_rectangle_shifted2
- : lcvd_fill_rectangle_shifted);
- dev_proc(&cvd->mdev, get_clipping_box) = lcvd_get_clipping_box_shifted_from_mdev;
+ /* Type 3 images will write to the mask directly. */
+ dev_proc(&cvd->mdev, fill_rectangle) = (need_mask ? lcvd_fill_rectangle_shifted2
+ : lcvd_fill_rectangle_shifted);
+ dev_proc(&cvd->mdev, get_clipping_box) = lcvd_get_clipping_box_shifted_from_mdev;
} else {
- dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted;
- dev_proc(&cvd->mdev, get_clipping_box) = lcvd_get_clipping_box_shifted_from_mdev;
+ dev_proc(&cvd->mdev, fill_rectangle) = lcvd_fill_rectangle_shifted;
+ dev_proc(&cvd->mdev, get_clipping_box) = lcvd_get_clipping_box_shifted_from_mdev;
}
dev_proc(&cvd->mdev, dev_spec_op) = lcvd_dev_spec_op;
dev_proc(&cvd->mdev, fill_path) = lcvd_handle_fill_path_as_shading_coverage;
cvd->m = *m;
if (write_on_close) {
- cvd->mdev.is_open = true;
- if (mask)
- mask->is_open = true;
- dev_proc(&cvd->mdev, close_device) = lcvd_close_device_with_writing;
+ cvd->mdev.is_open = true;
+ if (mask)
+ mask->is_open = true;
+ dev_proc(&cvd->mdev, close_device) = lcvd_close_device_with_writing;
}
return 0;
}
@@ -1008,8 +1008,8 @@ pdf_remove_masked_image_converter(gx_device_pdf *pdev, pdf_lcvd_t *cvd, bool nee
{
(*dev_proc(&cvd->mdev, close_device))((gx_device *)&cvd->mdev);
if (cvd->mask) {
- (*dev_proc(cvd->mask, close_device))((gx_device *)cvd->mask);
- gs_free_object(cvd->mask->memory, cvd->mask, "pdf_remove_masked_image_converter");
+ (*dev_proc(cvd->mask, close_device))((gx_device *)cvd->mask);
+ gs_free_object(cvd->mask->memory, cvd->mask, "pdf_remove_masked_image_converter");
}
}
@@ -1018,8 +1018,8 @@ pdf_remove_masked_image_converter(gx_device_pdf *pdev, pdf_lcvd_t *cvd, bool nee
/* Fill a path. */
int
gdev_pdf_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_fill_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ const gx_fill_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
int code;
@@ -1036,162 +1036,162 @@ gdev_pdf_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath
have_path = !gx_path_is_void(ppath);
if (!have_path && !pdev->vg_initial_set) {
- /* See lib/gs_pdfwr.ps about "initial graphic state". */
- pdf_prepare_initial_viewer_state(pdev, pis);
- pdf_reset_graphics(pdev);
- return 0;
+ /* See lib/gs_pdfwr.ps about "initial graphic state". */
+ pdf_prepare_initial_viewer_state(pdev, pis);
+ pdf_reset_graphics(pdev);
+ return 0;
}
if (have_path) {
- code = gx_path_bbox(ppath, &box);
- if (code < 0)
- return code;
+ code = gx_path_bbox(ppath, &box);
+ if (code < 0)
+ return code;
}
box1 = box;
code = prepare_fill_with_clip(pdev, pis, &box, have_path, pdcolor, pcpath);
if (code == gs_error_rangecheck) {
- /* Fallback to the default implermentation for handling
- a transparency with CompatibilityLevel<=1.3 . */
- return gx_default_fill_path((gx_device *)pdev, pis, ppath, params, pdcolor, pcpath);
+ /* Fallback to the default implermentation for handling
+ a transparency with CompatibilityLevel<=1.3 . */
+ return gx_default_fill_path((gx_device *)pdev, pis, ppath, params, pdcolor, pcpath);
}
if (code < 0)
- return code;
+ return code;
if (code == 1)
- return 0; /* Nothing to paint. */
+ return 0; /* Nothing to paint. */
code = pdf_setfillcolor((gx_device_vector *)pdev, pis, pdcolor);
if (code == gs_error_rangecheck) {
- const bool convert_to_image = (pdev->CompatibilityLevel <= 1.2 &&
- gx_dc_is_pattern2_color(pdcolor));
-
- if (!convert_to_image) {
- /* Fallback to the default implermentation for handling
- a shading with CompatibilityLevel<=1.2 . */
- return gx_default_fill_path(dev, pis, ppath, params, pdcolor, pcpath);
- } else {
- /* Convert a shading into a bitmap
- with CompatibilityLevel<=1.2 . */
- pdf_lcvd_t cvd, *pcvd = &cvd;
- int sx, sy;
- gs_fixed_rect bbox, bbox1;
- bool need_mask = gx_dc_pattern2_can_overlap(pdcolor);
- gs_matrix m, save_ctm = ctm_only(pis), ms, msi, mm;
- gs_int_point rect_size;
- /* double scalex = 1.9, scaley = 1.4; debug purpose only. */
- double scale, scalex, scaley;
- int log2_scale_x = 0, log2_scale_y = 0;
- gx_drawing_color dc = *pdcolor;
- gs_pattern2_instance_t pi = *(gs_pattern2_instance_t *)dc.ccolor.pattern;
- gs_state *pgs = gs_state_copy(pi.saved, gs_state_memory(pi.saved));
-
- if (pgs == NULL)
- return_error(gs_error_VMerror);
- dc.ccolor.pattern = (gs_pattern_instance_t *)&pi;
- pi.saved = pgs;
- code = gx_path_bbox(ppath, &bbox);
- if (code < 0)
- return code;
- rect_intersect(bbox, box);
- code = gx_dc_pattern2_get_bbox(pdcolor, &bbox1);
- if (code < 0)
- return code;
- if (code)
- rect_intersect(bbox, bbox1);
- if (bbox.p.x >= bbox.q.x || bbox.p.y >= bbox.q.y)
- return 0;
- sx = fixed2int(bbox.p.x);
- sy = fixed2int(bbox.p.y);
- gs_make_identity(&m);
- rect_size.x = fixed2int(bbox.q.x + fixed_half) - sx;
- rect_size.y = fixed2int(bbox.q.y + fixed_half) - sy;
- if (rect_size.x == 0 || rect_size.y == 0)
- return 0;
- m.tx = (float)sx;
- m.ty = (float)sy;
- cvd.path_offset.x = sx;
- cvd.path_offset.y = sy;
- scale = (double)rect_size.x * rect_size.y * pdev->color_info.num_components /
- pdev->MaxShadingBitmapSize;
- if (scale > 1) {
- /* This section (together with the call to 'path_scale' below)
- sets up a downscaling when converting the shading into bitmap.
- We used floating point numbers to debug it, but in production
- we prefer to deal only with integers being powers of 2
- in order to avoid possible distorsions when scaling paths.
- */
- log2_scale_x = log2_scale_y = ilog2((int)ceil(sqrt(scale)));
- if ((double)(1 << log2_scale_x) * (1 << log2_scale_y) < scale)
- log2_scale_y++;
- if ((double)(1 << log2_scale_x) * (1 << log2_scale_y) < scale)
- log2_scale_x++;
- scalex = (double)(1 << log2_scale_x);
- scaley = (double)(1 << log2_scale_y);
- rect_size.x = (int)floor(rect_size.x / scalex + 0.5);
- rect_size.y = (int)floor(rect_size.y / scaley + 0.5);
- gs_make_scaling(1.0 / scalex, 1.0 / scaley, &ms);
- gs_make_scaling(scalex, scaley, &msi);
- gs_matrix_multiply(&msi, &m, &m);
- gs_matrix_multiply(&ctm_only(pis), &ms, &mm);
- gs_setmatrix((gs_state *)pis, &mm);
- gs_matrix_multiply(&ctm_only((gs_imager_state *)pgs), &ms, &mm);
- gs_setmatrix((gs_state *)pgs, &mm);
- sx = fixed2int(bbox.p.x / (int)scalex);
- sy = fixed2int(bbox.p.y / (int)scaley);
- cvd.path_offset.x = sx; /* m.tx / scalex */
- cvd.path_offset.y = sy;
- }
- code = pdf_setup_masked_image_converter(pdev, pdev->memory, &m, &pcvd, need_mask, sx, sy,
- rect_size.x, rect_size.y, false);
- pcvd->has_background = gx_dc_pattern2_has_background(pdcolor);
- stream_puts(pdev->strm, "q\n");
- if (code >= 0) {
- code = gdev_vector_dopath((gx_device_vector *)pdev, ppath,
- gx_path_type_clip, NULL);
- if (code >= 0)
- stream_puts(pdev->strm, "W n\n");
- }
- pdf_put_matrix(pdev, NULL, &cvd.m, " cm q\n");
- cvd.write_matrix = false;
- if (code >= 0)
- code = gs_shading_do_fill_rectangle(pi.template.Shading,
- NULL, (gx_device *)&cvd.mdev, (gs_imager_state *)pgs, !pi.shfill);
- if (code >= 0)
- code = pdf_dump_converted_image(pdev, &cvd);
- stream_puts(pdev->strm, "Q Q\n");
- pdf_remove_masked_image_converter(pdev, &cvd, need_mask);
- gs_setmatrix((gs_state *)pis, &save_ctm);
- gs_state_free(pgs);
- return code;
- }
+ const bool convert_to_image = (pdev->CompatibilityLevel <= 1.2 &&
+ gx_dc_is_pattern2_color(pdcolor));
+
+ if (!convert_to_image) {
+ /* Fallback to the default implermentation for handling
+ a shading with CompatibilityLevel<=1.2 . */
+ return gx_default_fill_path(dev, pis, ppath, params, pdcolor, pcpath);
+ } else {
+ /* Convert a shading into a bitmap
+ with CompatibilityLevel<=1.2 . */
+ pdf_lcvd_t cvd, *pcvd = &cvd;
+ int sx, sy;
+ gs_fixed_rect bbox, bbox1;
+ bool need_mask = gx_dc_pattern2_can_overlap(pdcolor);
+ gs_matrix m, save_ctm = ctm_only(pis), ms, msi, mm;
+ gs_int_point rect_size;
+ /* double scalex = 1.9, scaley = 1.4; debug purpose only. */
+ double scale, scalex, scaley;
+ int log2_scale_x = 0, log2_scale_y = 0;
+ gx_drawing_color dc = *pdcolor;
+ gs_pattern2_instance_t pi = *(gs_pattern2_instance_t *)dc.ccolor.pattern;
+ gs_state *pgs = gs_state_copy(pi.saved, gs_state_memory(pi.saved));
+
+ if (pgs == NULL)
+ return_error(gs_error_VMerror);
+ dc.ccolor.pattern = (gs_pattern_instance_t *)&pi;
+ pi.saved = pgs;
+ code = gx_path_bbox(ppath, &bbox);
+ if (code < 0)
+ return code;
+ rect_intersect(bbox, box);
+ code = gx_dc_pattern2_get_bbox(pdcolor, &bbox1);
+ if (code < 0)
+ return code;
+ if (code)
+ rect_intersect(bbox, bbox1);
+ if (bbox.p.x >= bbox.q.x || bbox.p.y >= bbox.q.y)
+ return 0;
+ sx = fixed2int(bbox.p.x);
+ sy = fixed2int(bbox.p.y);
+ gs_make_identity(&m);
+ rect_size.x = fixed2int(bbox.q.x + fixed_half) - sx;
+ rect_size.y = fixed2int(bbox.q.y + fixed_half) - sy;
+ if (rect_size.x == 0 || rect_size.y == 0)
+ return 0;
+ m.tx = (float)sx;
+ m.ty = (float)sy;
+ cvd.path_offset.x = sx;
+ cvd.path_offset.y = sy;
+ scale = (double)rect_size.x * rect_size.y * pdev->color_info.num_components /
+ pdev->MaxShadingBitmapSize;
+ if (scale > 1) {
+ /* This section (together with the call to 'path_scale' below)
+ sets up a downscaling when converting the shading into bitmap.
+ We used floating point numbers to debug it, but in production
+ we prefer to deal only with integers being powers of 2
+ in order to avoid possible distorsions when scaling paths.
+ */
+ log2_scale_x = log2_scale_y = ilog2((int)ceil(sqrt(scale)));
+ if ((double)(1 << log2_scale_x) * (1 << log2_scale_y) < scale)
+ log2_scale_y++;
+ if ((double)(1 << log2_scale_x) * (1 << log2_scale_y) < scale)
+ log2_scale_x++;
+ scalex = (double)(1 << log2_scale_x);
+ scaley = (double)(1 << log2_scale_y);
+ rect_size.x = (int)floor(rect_size.x / scalex + 0.5);
+ rect_size.y = (int)floor(rect_size.y / scaley + 0.5);
+ gs_make_scaling(1.0 / scalex, 1.0 / scaley, &ms);
+ gs_make_scaling(scalex, scaley, &msi);
+ gs_matrix_multiply(&msi, &m, &m);
+ gs_matrix_multiply(&ctm_only(pis), &ms, &mm);
+ gs_setmatrix((gs_state *)pis, &mm);
+ gs_matrix_multiply(&ctm_only((gs_imager_state *)pgs), &ms, &mm);
+ gs_setmatrix((gs_state *)pgs, &mm);
+ sx = fixed2int(bbox.p.x / (int)scalex);
+ sy = fixed2int(bbox.p.y / (int)scaley);
+ cvd.path_offset.x = sx; /* m.tx / scalex */
+ cvd.path_offset.y = sy;
+ }
+ code = pdf_setup_masked_image_converter(pdev, pdev->memory, &m, &pcvd, need_mask, sx, sy,
+ rect_size.x, rect_size.y, false);
+ pcvd->has_background = gx_dc_pattern2_has_background(pdcolor);
+ stream_puts(pdev->strm, "q\n");
+ if (code >= 0) {
+ code = gdev_vector_dopath((gx_device_vector *)pdev, ppath,
+ gx_path_type_clip, NULL);
+ if (code >= 0)
+ stream_puts(pdev->strm, "W n\n");
+ }
+ pdf_put_matrix(pdev, NULL, &cvd.m, " cm q\n");
+ cvd.write_matrix = false;
+ if (code >= 0)
+ code = gs_shading_do_fill_rectangle(pi.template.Shading,
+ NULL, (gx_device *)&cvd.mdev, (gs_imager_state *)pgs, !pi.shfill);
+ if (code >= 0)
+ code = pdf_dump_converted_image(pdev, &cvd);
+ stream_puts(pdev->strm, "Q Q\n");
+ pdf_remove_masked_image_converter(pdev, &cvd, need_mask);
+ gs_setmatrix((gs_state *)pis, &save_ctm);
+ gs_state_free(pgs);
+ return code;
+ }
}
if (code < 0)
- return code;
+ return code;
if (have_path) {
- stream *s = pdev->strm;
- double scale;
- gs_matrix smat;
- gs_matrix *psmat = NULL;
-
- if (pcpath) {
- rect_intersect(box1, box);
- if (box1.p.x > box1.q.x || box1.p.y > box1.q.y)
- return 0; /* outside the clipping path */
- }
- if (params->flatness != pdev->state.flatness) {
- pprintg1(s, "%g i\n", params->flatness);
- pdev->state.flatness = params->flatness;
- }
- if (make_rect_scaling(pdev, &box1, 1.0, &scale)) {
- gs_make_scaling(pdev->scale.x * scale, pdev->scale.y * scale,
- &smat);
+ stream *s = pdev->strm;
+ double scale;
+ gs_matrix smat;
+ gs_matrix *psmat = NULL;
+
+ if (pcpath) {
+ rect_intersect(box1, box);
+ if (box1.p.x > box1.q.x || box1.p.y > box1.q.y)
+ return 0; /* outside the clipping path */
+ }
+ if (params->flatness != pdev->state.flatness) {
+ pprintg1(s, "%g i\n", params->flatness);
+ pdev->state.flatness = params->flatness;
+ }
+ if (make_rect_scaling(pdev, &box1, 1.0, &scale)) {
+ gs_make_scaling(pdev->scale.x * scale, pdev->scale.y * scale,
+ &smat);
pdf_put_matrix(pdev, "q ", &smat, "cm\n");
- psmat = &smat;
- }
- gdev_vector_dopath((gx_device_vector *)pdev, ppath,
- gx_path_type_fill | gx_path_type_optimize,
- psmat);
- stream_puts(s, (params->rule < 0 ? "f\n" : "f*\n"));
- if (psmat)
- stream_puts(s, "Q\n");
+ psmat = &smat;
+ }
+ gdev_vector_dopath((gx_device_vector *)pdev, ppath,
+ gx_path_type_fill | gx_path_type_optimize,
+ psmat);
+ stream_puts(s, (params->rule < 0 ? "f\n" : "f*\n"));
+ if (psmat)
+ stream_puts(s, "Q\n");
}
return 0;
}
@@ -1199,8 +1199,8 @@ gdev_pdf_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath
/* Stroke a path. */
int
gdev_pdf_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
gx_device_pdf *pdev = (gx_device_pdf *) dev;
stream *s;
@@ -1212,55 +1212,55 @@ gdev_pdf_stroke_path(gx_device * dev, const gs_imager_state * pis,
gs_fixed_rect bbox;
if (gx_path_is_void(ppath))
- return 0; /* won't mark the page */
+ return 0; /* won't mark the page */
if (pdf_must_put_clip_path(pdev, pcpath))
- code = pdf_unclip(pdev);
- else if ((pdev->last_charpath_op & TEXT_DO_FALSE_CHARPATH) && ppath->current_subpath &&
- (ppath->last_charpath_segment == ppath->current_subpath->last)) {
- bool hl_color = pdf_can_handle_hl_color((gx_device_vector *)pdev, pis, pdcolor);
- const gs_imager_state *pis_for_hl_color = (hl_color ? pis : NULL);
-
- if (pdf_modify_text_render_mode(pdev->text->text_state, 1)) {
- /* Set the colour for the stroke */
- code = pdf_reset_color(pdev, pis_for_hl_color, pdcolor, &pdev->saved_stroke_color,
- &pdev->stroke_used_process_color, &psdf_set_stroke_color_commands);
- if (code == 0) {
- s = pdev->strm;
- /* Text is emitted scaled so that the CTM is an identity matrix, the line width
- * needs to be scaled to match otherwise we will get the default, or the current
- * width scaled by the CTM before the text, either of which would be wrong.
- */
- scale = 72 / pdev->HWResolution[0];
- scale *= pis->ctm.xx;
- pprintg1(s, "%g w\n", (pis->line_params.half_width * 2) * (float)scale);
- /* Some trickery here. We have altered the colour, text render mode and linewidth,
- * we don't want those to persist. By switching to a stream context we will flush the
- * pending text. This has the beneficial side effect of executing a grestore. So
- * everything works out neatly.
- */
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- return(code);
- }
- }
- /* Can only get here if any of the above steps fail, in which case we proceed to
- * emit the charpath as a normal path, and stroke it.
- */
+ code = pdf_unclip(pdev);
+ else if ((pdev->last_charpath_op & TEXT_DO_FALSE_CHARPATH) && ppath->current_subpath &&
+ (ppath->last_charpath_segment == ppath->current_subpath->last)) {
+ bool hl_color = pdf_can_handle_hl_color((gx_device_vector *)pdev, pis, pdcolor);
+ const gs_imager_state *pis_for_hl_color = (hl_color ? pis : NULL);
+
+ if (pdf_modify_text_render_mode(pdev->text->text_state, 1)) {
+ /* Set the colour for the stroke */
+ code = pdf_reset_color(pdev, pis_for_hl_color, pdcolor, &pdev->saved_stroke_color,
+ &pdev->stroke_used_process_color, &psdf_set_stroke_color_commands);
+ if (code == 0) {
+ s = pdev->strm;
+ /* Text is emitted scaled so that the CTM is an identity matrix, the line width
+ * needs to be scaled to match otherwise we will get the default, or the current
+ * width scaled by the CTM before the text, either of which would be wrong.
+ */
+ scale = 72 / pdev->HWResolution[0];
+ scale *= pis->ctm.xx;
+ pprintg1(s, "%g w\n", (pis->line_params.half_width * 2) * (float)scale);
+ /* Some trickery here. We have altered the colour, text render mode and linewidth,
+ * we don't want those to persist. By switching to a stream context we will flush the
+ * pending text. This has the beneficial side effect of executing a grestore. So
+ * everything works out neatly.
+ */
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ return(code);
+ }
+ }
+ /* Can only get here if any of the above steps fail, in which case we proceed to
+ * emit the charpath as a normal path, and stroke it.
+ */
code = pdf_open_page(pdev, PDF_IN_STREAM);
} else
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
code = pdf_prepare_stroke(pdev, pis);
if (code == gs_error_rangecheck) {
- /* Fallback to the default implermentation for handling
- a transparency with CompatibilityLevel<=1.3 . */
- return gx_default_stroke_path((gx_device *)dev, pis, ppath, params, pdcolor, pcpath);
+ /* Fallback to the default implermentation for handling
+ a transparency with CompatibilityLevel<=1.3 . */
+ return gx_default_stroke_path((gx_device *)dev, pis, ppath, params, pdcolor, pcpath);
}
if (code < 0)
- return code;
+ return code;
code = pdf_put_clip_path(pdev, pcpath);
if (code < 0)
- return code;
+ return code;
/*
* If the CTM is not uniform, stroke width depends on angle.
* We'd like to avoid resetting the CTM, so we check for uniform
@@ -1272,92 +1272,92 @@ gdev_pdf_stroke_path(gx_device * dev, const gs_imager_state * pis,
* the coordinates.
*/
set_ctm = (bool)gdev_vector_stroke_scaling((gx_device_vector *)pdev,
- pis, &scale, &mat);
+ pis, &scale, &mat);
if (set_ctm && ((pis->ctm.xx == 0 && pis->ctm.xy == 0) ||
- (pis->ctm.yx == 0 && pis->ctm.yy == 0))) {
- /* Acrobat Reader 5 and Adobe Reader 6 issues
- the "Wrong operand type" error with matrices, which have 3 zero coefs.
- Besides that, we found that Acrobat Reader 4, Acrobat Reader 5
- and Adobe Reader 6 all store the current path in user space
- and apply CTM in the time of stroking - See the bug 687901.
- Therefore a precise conversion of Postscript to PDF isn't possible in this case.
- Adobe viewers render a line with a constant width instead.
- At last, with set_ctm == true we need the inverse matrix in
- gdev_vector_dopath. Therefore we exclude projection matrices
- (see bug 688363). */
- set_ctm = false;
- scale = fabs(pis->ctm.xx + pis->ctm.xy + pis->ctm.yx + pis->ctm.yy) /* Using the non-zero coeff. */
- / sqrt(2); /* Empirically from Adobe. */
+ (pis->ctm.yx == 0 && pis->ctm.yy == 0))) {
+ /* Acrobat Reader 5 and Adobe Reader 6 issues
+ the "Wrong operand type" error with matrices, which have 3 zero coefs.
+ Besides that, we found that Acrobat Reader 4, Acrobat Reader 5
+ and Adobe Reader 6 all store the current path in user space
+ and apply CTM in the time of stroking - See the bug 687901.
+ Therefore a precise conversion of Postscript to PDF isn't possible in this case.
+ Adobe viewers render a line with a constant width instead.
+ At last, with set_ctm == true we need the inverse matrix in
+ gdev_vector_dopath. Therefore we exclude projection matrices
+ (see bug 688363). */
+ set_ctm = false;
+ scale = fabs(pis->ctm.xx + pis->ctm.xy + pis->ctm.yx + pis->ctm.yy) /* Using the non-zero coeff. */
+ / sqrt(2); /* Empirically from Adobe. */
}
if (set_ctm) {
- /*
- * We want a scaling factor that will bring the largest reasonable
- * user coordinate within bounds. We choose a factor based on the
- * minor axis of the transformation. Thanks to Raph Levien for
- * the following formula.
- */
- double a = mat.xx, b = mat.xy, c = mat.yx, d = mat.yy;
- double u = fabs(a * d - b * c);
- double v = a * a + b * b + c * c + d * d;
- double minor = (sqrt(v + 2 * u) - sqrt(v - 2 * u)) * 0.5;
-
- prescale = (minor == 0 || minor > 1 ? 1 : 1 / minor);
+ /*
+ * We want a scaling factor that will bring the largest reasonable
+ * user coordinate within bounds. We choose a factor based on the
+ * minor axis of the transformation. Thanks to Raph Levien for
+ * the following formula.
+ */
+ double a = mat.xx, b = mat.xy, c = mat.yx, d = mat.yy;
+ double u = fabs(a * d - b * c);
+ double v = a * a + b * b + c * c + d * d;
+ double minor = (sqrt(v + 2 * u) - sqrt(v - 2 * u)) * 0.5;
+
+ prescale = (minor == 0 || minor > 1 ? 1 : 1 / minor);
}
gx_path_bbox(ppath, &bbox);
{
- /* Check whether a painting appears inside the clipping box.
- Doing so after writing the clipping path due to /SP pdfmark
- uses a special hack with painting outside the clipping box
- for synchronizing the clipping path (see lib/gs_pdfwr.ps).
- That hack appeared because there is no way to pass
- the imager state through gdev_pdf_put_params,
- which pdfmark is implemented with.
- */
- gs_fixed_rect clip_box, stroke_bbox = bbox;
- gs_point d0, d1;
- gs_fixed_point p0, p1;
- fixed bbox_expansion_x, bbox_expansion_y;
-
- gs_distance_transform(pis->line_params.half_width, 0, &ctm_only(pis), &d0);
- gs_distance_transform(0, pis->line_params.half_width, &ctm_only(pis), &d1);
- p0.x = float2fixed(any_abs(d0.x));
- p0.y = float2fixed(any_abs(d0.y));
- p1.x = float2fixed(any_abs(d1.x));
- p1.y = float2fixed(any_abs(d1.y));
- bbox_expansion_x = max(p0.x, p1.x) + fixed_1 * 2;
- bbox_expansion_y = max(p0.y, p1.y) + fixed_1 * 2;
- stroke_bbox.p.x -= bbox_expansion_x;
- stroke_bbox.p.y -= bbox_expansion_y;
- stroke_bbox.q.x += bbox_expansion_x;
- stroke_bbox.q.y += bbox_expansion_y;
- gx_cpath_outer_box(pcpath, &clip_box);
- rect_intersect(stroke_bbox, clip_box);
- if (stroke_bbox.q.x < stroke_bbox.p.x || stroke_bbox.q.y < stroke_bbox.p.y)
- return 0;
+ /* Check whether a painting appears inside the clipping box.
+ Doing so after writing the clipping path due to /SP pdfmark
+ uses a special hack with painting outside the clipping box
+ for synchronizing the clipping path (see lib/gs_pdfwr.ps).
+ That hack appeared because there is no way to pass
+ the imager state through gdev_pdf_put_params,
+ which pdfmark is implemented with.
+ */
+ gs_fixed_rect clip_box, stroke_bbox = bbox;
+ gs_point d0, d1;
+ gs_fixed_point p0, p1;
+ fixed bbox_expansion_x, bbox_expansion_y;
+
+ gs_distance_transform(pis->line_params.half_width, 0, &ctm_only(pis), &d0);
+ gs_distance_transform(0, pis->line_params.half_width, &ctm_only(pis), &d1);
+ p0.x = float2fixed(any_abs(d0.x));
+ p0.y = float2fixed(any_abs(d0.y));
+ p1.x = float2fixed(any_abs(d1.x));
+ p1.y = float2fixed(any_abs(d1.y));
+ bbox_expansion_x = max(p0.x, p1.x) + fixed_1 * 2;
+ bbox_expansion_y = max(p0.y, p1.y) + fixed_1 * 2;
+ stroke_bbox.p.x -= bbox_expansion_x;
+ stroke_bbox.p.y -= bbox_expansion_y;
+ stroke_bbox.q.x += bbox_expansion_x;
+ stroke_bbox.q.y += bbox_expansion_y;
+ gx_cpath_outer_box(pcpath, &clip_box);
+ rect_intersect(stroke_bbox, clip_box);
+ if (stroke_bbox.q.x < stroke_bbox.p.x || stroke_bbox.q.y < stroke_bbox.p.y)
+ return 0;
}
if (make_rect_scaling(pdev, &bbox, prescale, &path_scale)) {
- scale /= path_scale;
- if (set_ctm)
- gs_matrix_scale(&mat, path_scale, path_scale, &mat);
- else {
- gs_make_scaling(path_scale, path_scale, &mat);
- set_ctm = true;
- }
+ scale /= path_scale;
+ if (set_ctm)
+ gs_matrix_scale(&mat, path_scale, path_scale, &mat);
+ else {
+ gs_make_scaling(path_scale, path_scale, &mat);
+ set_ctm = true;
+ }
}
code = gdev_vector_prepare_stroke((gx_device_vector *)pdev, pis, params,
- pdcolor, scale);
+ pdcolor, scale);
if (code < 0)
- return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
- pcpath);
+ return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
if (!pdev->HaveStrokeColor)
- pdev->saved_fill_color = pdev->saved_stroke_color;
+ pdev->saved_fill_color = pdev->saved_stroke_color;
if (set_ctm)
- pdf_put_matrix(pdev, "q ", &mat, "cm\n");
+ pdf_put_matrix(pdev, "q ", &mat, "cm\n");
code = gdev_vector_dopath((gx_device_vector *)pdev, ppath,
- gx_path_type_stroke | gx_path_type_optimize,
- (set_ctm ? &mat : (const gs_matrix *)0));
+ gx_path_type_stroke | gx_path_type_optimize,
+ (set_ctm ? &mat : (const gs_matrix *)0));
if (code < 0)
- return code;
+ return code;
s = pdev->strm;
stream_puts(s, (code ? "s" : "S"));
stream_puts(s, (set_ctm ? " Q\n" : "\n"));
@@ -1369,7 +1369,7 @@ gdev_pdf_stroke_path(gx_device * dev, const gs_imager_state * pis,
See gxdevcli.h about return codes.
*/
int
-gdev_pdf_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect,
+gdev_pdf_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect,
const gs_imager_state *pis, const gx_drawing_color *pdcolor,
const gx_clip_path *pcpath)
{
@@ -1379,51 +1379,51 @@ gdev_pdf_fill_rectangle_hl_color(gx_device *dev, const gs_fixed_rect *rect,
double scale;
gs_matrix smat;
gs_matrix *psmat = NULL;
- const bool convert_to_image = (pdev->CompatibilityLevel <= 1.2 &&
- gx_dc_is_pattern2_color(pdcolor));
+ const bool convert_to_image = (pdev->CompatibilityLevel <= 1.2 &&
+ gx_dc_is_pattern2_color(pdcolor));
if (rect->p.x == rect->q.x)
- return 0;
+ return 0;
if (!convert_to_image) {
- code = prepare_fill_with_clip(pdev, pis, &box, true, pdcolor, pcpath);
- if (code < 0)
- return code;
- if (code == 1)
- return 0; /* Nothing to paint. */
- code = pdf_setfillcolor((gx_device_vector *)pdev, pis, pdcolor);
- if (code < 0)
- return code;
- if (pcpath)
- rect_intersect(box1, box);
- if (box1.p.x > box1.q.x || box1.p.y > box1.q.y)
- return 0; /* outside the clipping path */
- if (make_rect_scaling(pdev, &box1, 1.0, &scale)) {
- gs_make_scaling(pdev->scale.x * scale, pdev->scale.y * scale, &smat);
- pdf_put_matrix(pdev, "q ", &smat, "cm\n");
- psmat = &smat;
- }
- pprintg4(pdev->strm, "%g %g %g %g re f\n",
- fixed2float(box1.p.x) / scale, fixed2float(box1.p.y) / scale,
- fixed2float(box1.q.x - box1.p.x) / scale, fixed2float(box1.q.y - box1.p.y) / scale);
- if (psmat)
- stream_puts(pdev->strm, "Q\n");
- return 0;
+ code = prepare_fill_with_clip(pdev, pis, &box, true, pdcolor, pcpath);
+ if (code < 0)
+ return code;
+ if (code == 1)
+ return 0; /* Nothing to paint. */
+ code = pdf_setfillcolor((gx_device_vector *)pdev, pis, pdcolor);
+ if (code < 0)
+ return code;
+ if (pcpath)
+ rect_intersect(box1, box);
+ if (box1.p.x > box1.q.x || box1.p.y > box1.q.y)
+ return 0; /* outside the clipping path */
+ if (make_rect_scaling(pdev, &box1, 1.0, &scale)) {
+ gs_make_scaling(pdev->scale.x * scale, pdev->scale.y * scale, &smat);
+ pdf_put_matrix(pdev, "q ", &smat, "cm\n");
+ psmat = &smat;
+ }
+ pprintg4(pdev->strm, "%g %g %g %g re f\n",
+ fixed2float(box1.p.x) / scale, fixed2float(box1.p.y) / scale,
+ fixed2float(box1.q.x - box1.p.x) / scale, fixed2float(box1.q.y - box1.p.y) / scale);
+ if (psmat)
+ stream_puts(pdev->strm, "Q\n");
+ return 0;
} else {
- gx_fill_params params;
- gx_path path;
+ gx_fill_params params;
+ gx_path path;
- params.rule = 1; /* Not important because the path is a rectange. */
- params.adjust.x = params.adjust.y = 0;
+ params.rule = 1; /* Not important because the path is a rectange. */
+ params.adjust.x = params.adjust.y = 0;
params.flatness = pis->flatness;
- gx_path_init_local(&path, pis->memory);
- code = gx_path_add_rectangle(&path, rect->p.x, rect->p.y, rect->q.x, rect->q.y);
- if (code < 0)
- return code;
- code = gdev_pdf_fill_path(dev, pis, &path, &params, pdcolor, pcpath);
- if (code < 0)
- return code;
- gx_path_free(&path, "gdev_pdf_fill_rectangle_hl_color");
- return code;
+ gx_path_init_local(&path, pis->memory);
+ code = gx_path_add_rectangle(&path, rect->p.x, rect->p.y, rect->q.x, rect->q.y);
+ if (code < 0)
+ return code;
+ code = gdev_pdf_fill_path(dev, pis, &path, &params, pdcolor, pcpath);
+ if (code < 0)
+ return code;
+ gx_path_free(&path, "gdev_pdf_fill_rectangle_hl_color");
+ return code;
}
}
@@ -1435,9 +1435,9 @@ gdev_pdf_fillpage(gx_device *dev, gs_imager_state * pis, gx_device_color *pdevc)
int bottom = (pdev->ResourcesBeforeUsage ? 1 : 0);
if (gx_dc_pure_color(pdevc) == pdev->white && !is_in_page(pdev) && pdev->sbstack_depth <= bottom) {
- /* PDF doesn't need to erase the page if its plain white */
- return 0;
+ /* PDF doesn't need to erase the page if its plain white */
+ return 0;
}
else
- return gx_default_fillpage(dev, pis, pdevc);
+ return gx_default_fillpage(dev, pis, pdevc);
}
diff --git a/gs/base/gdevpdfe.c b/gs/base/gdevpdfe.c
index 2d34d27cc..5bcb00ad3 100644
--- a/gs/base/gdevpdfe.c
+++ b/gs/base/gdevpdfe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,12 +26,11 @@
#include "gdevpdfo.h"
#include "ConvertUTF.h"
-
-static void
+static void
copy_bytes(stream *s, const byte **data, int *data_length, int n)
{
while (n-- && (*data_length)--) {
- stream_putc(s, *((*data)++));
+ stream_putc(s, *((*data)++));
}
}
@@ -43,35 +42,35 @@ pdf_xml_data_write(stream *s, const byte *data, int data_length)
const byte *p = data;
while (l > 0) {
- switch (*p) {
- case '<' : stream_puts(s, "&lt;"); l--; p++; break;
- case '>' : stream_puts(s, "&gt;"); l--; p++; break;
- case '&' : stream_puts(s, "&amp;"); l--; p++; break;
- case '\'': stream_puts(s, "&apos;"); l--; p++; break;
- case '"' : stream_puts(s, "&quot;"); l--; p++; break;
- default:
- if (*p < 32) {
- /* Not allowed in XML. */
- pprintd1(s, "&#%d;", *p);
- l--; p++;
- } else if (*p >= 0x7F && *p <= 0x9f) {
- /* Control characters are discouraged in XML. */
- pprintd1(s, "&#%d;", *p);
- l--; p++;
- } else if ((*p & 0xE0) == 0xC0) {
- /* A 2-byte UTF-8 sequence */
- copy_bytes(s, &p, &l, 2);
- } else if ((*p & 0xF0) == 0xE0) {
- /* A 3-byte UTF-8 sequence */
- copy_bytes(s, &p, &l, 3);
- } else if ((*p & 0xF0) == 0xF0) {
- /* A 4-byte UTF-8 sequence */
- copy_bytes(s, &p, &l, 4);
- } else {
- stream_putc(s, *p);
- l--; p++;
- }
- }
+ switch (*p) {
+ case '<' : stream_puts(s, "&lt;"); l--; p++; break;
+ case '>' : stream_puts(s, "&gt;"); l--; p++; break;
+ case '&' : stream_puts(s, "&amp;"); l--; p++; break;
+ case '\'': stream_puts(s, "&apos;"); l--; p++; break;
+ case '"' : stream_puts(s, "&quot;"); l--; p++; break;
+ default:
+ if (*p < 32) {
+ /* Not allowed in XML. */
+ pprintd1(s, "&#%d;", *p);
+ l--; p++;
+ } else if (*p >= 0x7F && *p <= 0x9f) {
+ /* Control characters are discouraged in XML. */
+ pprintd1(s, "&#%d;", *p);
+ l--; p++;
+ } else if ((*p & 0xE0) == 0xC0) {
+ /* A 2-byte UTF-8 sequence */
+ copy_bytes(s, &p, &l, 2);
+ } else if ((*p & 0xF0) == 0xE0) {
+ /* A 3-byte UTF-8 sequence */
+ copy_bytes(s, &p, &l, 3);
+ } else if ((*p & 0xF0) == 0xF0) {
+ /* A 4-byte UTF-8 sequence */
+ copy_bytes(s, &p, &l, 4);
+ } else {
+ stream_putc(s, *p);
+ l--; p++;
+ }
+ }
}
}
@@ -177,7 +176,6 @@ pdf_xml_copy(stream *s, const char *data)
stream_puts(s, data);
}
-
/* -------------------------------------------- */
static int
@@ -191,8 +189,8 @@ pdf_xmp_time(char *buf, int buf_length)
time(&t);
tms = *localtime(&t);
sprintf(buf1,
- "%04d-%02d-%02d",
- tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday);
+ "%04d-%02d-%02d",
+ tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday);
strncpy(buf, buf1, buf_length);
return strlen(buf);
}
@@ -205,57 +203,57 @@ pdf_xmp_convert_time(char *dt, int dtl, char *buf, int bufl)
int l = dtl;
if (l > bufl)
- l = bufl;
+ l = bufl;
if (dt[0] == 'D' && dt[1] == ':') {
- l -= 2;
- memcpy(buf, dt + 2, l);
+ l -= 2;
+ memcpy(buf, dt + 2, l);
} else
- memcpy(buf, dt, l);
+ memcpy(buf, dt, l);
memcpy(dt, buf, 4); /* year */
if (l <= 4)
- return 4;
+ return 4;
dt[4] = '-';
memcpy(dt + 5, buf + 4, 2); /* month */
if (l <= 6)
- return 7;
+ return 7;
dt[7] = '-';
memcpy(dt + 8, buf + 6, 2); /* day */
if (l <= 8)
- return 10;
+ return 10;
dt[10] = 'T';
memcpy(dt + 11, buf + 8, 2); /* hour */
dt[13] = ':';
memcpy(dt + 14, buf + 10, 2); /* minute */
if (l <= 12) {
- dt[16] = 'Z'; /* Default time zone 0. */
- return 17;
+ dt[16] = 'Z'; /* Default time zone 0. */
+ return 17;
}
dt[16] = ':';
memcpy(dt + 17, buf + 12, 2); /* second */
if (l <= 14) {
- dt[18] = 'Z'; /* Default time zone 0. */
- return 19;
+ dt[18] = 'Z'; /* Default time zone 0. */
+ return 19;
}
dt[19] = buf[14]; /* designator */
if (dt[19] == 'Z')
- return 20;
+ return 20;
if (l <= 15)
- return 20;
+ return 20;
memcpy(dt + 20, buf + 15, 2); /* Time zone hour difference. */
if (l <= 17)
- return 22;
+ return 22;
dt[22] = ':';
/* Skipping '\'' in 'buf'. */
memcpy(dt + 23, buf + 18, 2); /* Time zone hour difference. */
return 25;
}
-
+
int
pdf_get_docinfo_item(gx_device_pdf *pdev, const char *key, char *buf, int buf_length)
{
@@ -263,21 +261,21 @@ pdf_get_docinfo_item(gx_device_pdf *pdev, const char *key, char *buf, int buf_le
int l;
const byte *s;
- if (v != NULL && (v->value_type == COS_VALUE_SCALAR ||
- v->value_type == COS_VALUE_CONST)) {
- if (v->contents.chars.size > 2 && v->contents.chars.data[0] == '(') {
- s = v->contents.chars.data + 1;
- l = v->contents.chars.size - 2;
- } else {
- s = v->contents.chars.data;
- l = v->contents.chars.size;
- }
+ if (v != NULL && (v->value_type == COS_VALUE_SCALAR ||
+ v->value_type == COS_VALUE_CONST)) {
+ if (v->contents.chars.size > 2 && v->contents.chars.data[0] == '(') {
+ s = v->contents.chars.data + 1;
+ l = v->contents.chars.size - 2;
+ } else {
+ s = v->contents.chars.data;
+ l = v->contents.chars.size;
+ }
} else
- return 0;
+ return 0;
if (l < 0)
- l = 0;
+ l = 0;
if (l > buf_length)
- l = buf_length;
+ l = buf_length;
memcpy(buf, s, l);
return l;
}
@@ -289,181 +287,181 @@ decode_escape(const byte *data, int data_length, int *index)
(*index)++; /* skip '\' */
if (*index >= data_length)
- return 0; /* Must_not_happen, because the string is PS encoded. */
+ return 0; /* Must_not_happen, because the string is PS encoded. */
c = data[*index];
switch (c) {
- case '(': return '(';
- case ')': return ')';
- case '\\': return '\\';
- case 'n': return '\n';
- case 'r': return '\r';
- case 't': return '\t';
- case 'b': return '\b';
- case 'f': return '\f';
- default:
- break;
+ case '(': return '(';
+ case ')': return ')';
+ case '\\': return '\\';
+ case 'n': return '\n';
+ case 'r': return '\r';
+ case 't': return '\t';
+ case 'b': return '\b';
+ case 'f': return '\f';
+ default:
+ break;
}
if (c >= '0' && c <= '7') {
- int oct_loop;
- /* octal */
- byte v = c - '0';
-
- /* Octal values should always be three digits, one is consumed above! */
- for (oct_loop = 0;oct_loop < 2; oct_loop++) {
- (*index)++;
- if (*index >= data_length)
- /* Ran out of data, return what we found */
- return v;
- c = data[*index];
- if (c < '0' || c > '7') {
- /* Ran out of numeric data, return what we found */
- /* Need to 'unget' the non-numeric character */
- (*index)--;
- break;
- }
- v = v * 8 + (c - '0');
- }
- return v;
+ int oct_loop;
+ /* octal */
+ byte v = c - '0';
+
+ /* Octal values should always be three digits, one is consumed above! */
+ for (oct_loop = 0;oct_loop < 2; oct_loop++) {
+ (*index)++;
+ if (*index >= data_length)
+ /* Ran out of data, return what we found */
+ return v;
+ c = data[*index];
+ if (c < '0' || c > '7') {
+ /* Ran out of numeric data, return what we found */
+ /* Need to 'unget' the non-numeric character */
+ (*index)--;
+ break;
+ }
+ v = v * 8 + (c - '0');
+ }
+ return v;
}
return c; /* A wrong escapement sequence. */
}
static int
pdf_xmp_write_translated(gx_device_pdf *pdev, stream *s, const byte *data, int data_length,
- void(*write)(stream *s, const byte *data, int data_length))
+ void(*write)(stream *s, const byte *data, int data_length))
{
if (pdev->DSCEncodingToUnicode.data == 0) {
- int i, j=0;
- unsigned char *buf0;
-
- buf0 = (unsigned char *)gs_alloc_bytes(pdev->memory, data_length * sizeof(unsigned char),
- "pdf_xmp_write_translated");
- if (buf0 == NULL)
- return_error(gs_error_VMerror);
- for (i = 0; i < data_length; i++) {
- byte c = data[i];
-
- if (c == '\\')
- c = decode_escape(data, data_length, &i);
- buf0[j] = c;
- j++;
- }
- if (buf0[0] == 0xfe && buf0[1] == 0xff) {
- /* Its a Unicode (UTF-16BE) string, convert to UTF-8 */
- UTF16 *buf0b, U16;
- UTF8 *buf1, *buf1b;
-
- buf1 = (UTF8 *)gs_alloc_bytes(pdev->memory, data_length * sizeof(unsigned char),
- "pdf_xmp_write_translated");
- if (buf1 == NULL)
- return_error(gs_error_VMerror);
- buf1b = buf1;
- /* Skip the Byte Order Mark (0xfe 0xff) */
- buf0b = (UTF16 *)(buf0 + 2);
- /* ConvertUTF16to UTF8 expects a buffer of UTF16s in the local
- * endian-ness, but the data is big-endian. In case this is a little-endian
- * machine, process the buffer from big-endian to whatever is right for this platform.
- */
- for (i = 2; i < j; i+=2) {
- U16 = (buf0[i] << 8) + buf0[i + 1];
- *(buf0b++) = U16;
- }
- buf0b = (UTF16 *)(buf0 + 2);
- switch (ConvertUTF16toUTF8((const UTF16**)&buf0b, (UTF16 *)(buf0 + j),
- &buf1b, buf1 + (data_length * sizeof(unsigned char)), strictConversion)) {
- case conversionOK:
- write(s, buf1, buf1b - buf1);
- gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
- break;
- case sourceExhausted:
- case targetExhausted:
- case sourceIllegal:
- default:
- gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
- return_error(gs_error_rangecheck);
- }
- } else
- write(s, buf0, j);
- gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
- return 0;
+ int i, j=0;
+ unsigned char *buf0;
+
+ buf0 = (unsigned char *)gs_alloc_bytes(pdev->memory, data_length * sizeof(unsigned char),
+ "pdf_xmp_write_translated");
+ if (buf0 == NULL)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < data_length; i++) {
+ byte c = data[i];
+
+ if (c == '\\')
+ c = decode_escape(data, data_length, &i);
+ buf0[j] = c;
+ j++;
+ }
+ if (buf0[0] == 0xfe && buf0[1] == 0xff) {
+ /* Its a Unicode (UTF-16BE) string, convert to UTF-8 */
+ UTF16 *buf0b, U16;
+ UTF8 *buf1, *buf1b;
+
+ buf1 = (UTF8 *)gs_alloc_bytes(pdev->memory, data_length * sizeof(unsigned char),
+ "pdf_xmp_write_translated");
+ if (buf1 == NULL)
+ return_error(gs_error_VMerror);
+ buf1b = buf1;
+ /* Skip the Byte Order Mark (0xfe 0xff) */
+ buf0b = (UTF16 *)(buf0 + 2);
+ /* ConvertUTF16to UTF8 expects a buffer of UTF16s in the local
+ * endian-ness, but the data is big-endian. In case this is a little-endian
+ * machine, process the buffer from big-endian to whatever is right for this platform.
+ */
+ for (i = 2; i < j; i+=2) {
+ U16 = (buf0[i] << 8) + buf0[i + 1];
+ *(buf0b++) = U16;
+ }
+ buf0b = (UTF16 *)(buf0 + 2);
+ switch (ConvertUTF16toUTF8((const UTF16**)&buf0b, (UTF16 *)(buf0 + j),
+ &buf1b, buf1 + (data_length * sizeof(unsigned char)), strictConversion)) {
+ case conversionOK:
+ write(s, buf1, buf1b - buf1);
+ gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
+ break;
+ case sourceExhausted:
+ case targetExhausted:
+ case sourceIllegal:
+ default:
+ gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
+ return_error(gs_error_rangecheck);
+ }
+ } else
+ write(s, buf0, j);
+ gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
+ return 0;
} else {
- UTF16 *buf0;
- const UTF16 *buf0b;
- UTF8 *buf1, *buf1b;
- int i, j = 0;
-
- buf0 = (UTF16 *)gs_alloc_bytes(pdev->memory, data_length * sizeof(UTF16),
- "pdf_xmp_write_translated");
- if (buf0 == NULL)
- return_error(gs_error_VMerror);
- buf1 = (UTF8 *)gs_alloc_bytes(pdev->memory, data_length * 2,
- "pdf_xmp_write_translated");
- if (buf1 == NULL) {
- gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
- return_error(gs_error_VMerror);
- }
- buf0b = buf0;
- buf1b = buf1;
- for (i = 0; i < data_length; i++) {
- byte c = data[i];
- int v;
-
- if (c == '\\')
- c = decode_escape(data, data_length, &i);
- if (c > pdev->DSCEncodingToUnicode.size) {
- gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
- gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
- return_error(gs_error_rangecheck);
- }
-
- v = pdev->DSCEncodingToUnicode.data[c];
- if (v == -1)
- v = '?'; /* Arbitrary. */
- buf0[j] = v;
- j++;
- }
- switch (ConvertUTF16toUTF8(&buf0b, buf0 + j,
- &buf1b, buf1 + data_length * 2, strictConversion)) {
- case conversionOK:
- write(s, buf1, buf1b - buf1);
- break;
- case sourceExhausted:
- case targetExhausted:
- case sourceIllegal:
- default:
- gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
- gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
- return_error(gs_error_rangecheck);
- }
- gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
- gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
- return 0;
+ UTF16 *buf0;
+ const UTF16 *buf0b;
+ UTF8 *buf1, *buf1b;
+ int i, j = 0;
+
+ buf0 = (UTF16 *)gs_alloc_bytes(pdev->memory, data_length * sizeof(UTF16),
+ "pdf_xmp_write_translated");
+ if (buf0 == NULL)
+ return_error(gs_error_VMerror);
+ buf1 = (UTF8 *)gs_alloc_bytes(pdev->memory, data_length * 2,
+ "pdf_xmp_write_translated");
+ if (buf1 == NULL) {
+ gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
+ return_error(gs_error_VMerror);
+ }
+ buf0b = buf0;
+ buf1b = buf1;
+ for (i = 0; i < data_length; i++) {
+ byte c = data[i];
+ int v;
+
+ if (c == '\\')
+ c = decode_escape(data, data_length, &i);
+ if (c > pdev->DSCEncodingToUnicode.size) {
+ gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
+ gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
+ return_error(gs_error_rangecheck);
+ }
+
+ v = pdev->DSCEncodingToUnicode.data[c];
+ if (v == -1)
+ v = '?'; /* Arbitrary. */
+ buf0[j] = v;
+ j++;
+ }
+ switch (ConvertUTF16toUTF8(&buf0b, buf0 + j,
+ &buf1b, buf1 + data_length * 2, strictConversion)) {
+ case conversionOK:
+ write(s, buf1, buf1b - buf1);
+ break;
+ case sourceExhausted:
+ case targetExhausted:
+ case sourceIllegal:
+ default:
+ gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
+ gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
+ return_error(gs_error_rangecheck);
+ }
+ gs_free_object(pdev->memory, buf0, "pdf_xmp_write_translated");
+ gs_free_object(pdev->memory, buf1, "pdf_xmp_write_translated");
+ return 0;
}
}
static int
pdf_xmp_write_docinfo_item(gx_device_pdf *pdev, stream *s, const char *key, const char *default_value,
- void(*write)(stream *s, const byte *data, int data_length))
+ void(*write)(stream *s, const byte *data, int data_length))
{
const cos_value_t *v = cos_dict_find(pdev->Info, (const byte *)key, strlen(key));
- if (v != NULL && (v->value_type == COS_VALUE_SCALAR ||
- v->value_type == COS_VALUE_CONST)) {
- if (v->contents.chars.size > 2 && v->contents.chars.data[0] == '(')
- return pdf_xmp_write_translated(pdev, s, v->contents.chars.data + 1,
- v->contents.chars.size - 2, write);
- else
- return pdf_xmp_write_translated(pdev, s, v->contents.chars.data,
- v->contents.chars.size, write);
+ if (v != NULL && (v->value_type == COS_VALUE_SCALAR ||
+ v->value_type == COS_VALUE_CONST)) {
+ if (v->contents.chars.size > 2 && v->contents.chars.data[0] == '(')
+ return pdf_xmp_write_translated(pdev, s, v->contents.chars.data + 1,
+ v->contents.chars.size - 2, write);
+ else
+ return pdf_xmp_write_translated(pdev, s, v->contents.chars.data,
+ v->contents.chars.size, write);
} else {
- stream_puts(s, default_value);
- return 0;
+ stream_puts(s, default_value);
+ return 0;
}
}
static uint64_t
pdf_uuid_time(gx_device_pdf *pdev)
-{
+{
long *dt = pdev->uuid_time; /* In seconds since Jan. 1, 1980 and fraction in nanoseconds. */
uint64_t t;
@@ -481,12 +479,12 @@ static void writehex(char **p, ulong v, int l)
static const char digit[] = "0123456789abcdef";
for (; i--;)
- *((*p)++) = digit[v >> (i * 4) & 15];
+ *((*p)++) = digit[v >> (i * 4) & 15];
}
static void
pdf_make_uuid(const byte node[6], uint64_t uuid_time, ulong time_seq, char *buf, int buf_length)
-{
+{
char b[40], *p = b;
ulong uuid_time_lo = (ulong)(uuid_time & 0xFFFFFFFF); /* MSVC 7.1.3088 */
ushort uuid_time_md = (ushort)((uuid_time >> 32) & 0xFFFF); /* cannot compile this */
@@ -515,12 +513,12 @@ static int
pdf_make_instance_uuid(gx_device_pdf *pdev, const byte digest[6], char *buf, int buf_length)
{
if (pdev->InstanceUUID.size) {
- int l = min(buf_length - 1, pdev->InstanceUUID.size);
+ int l = min(buf_length - 1, pdev->InstanceUUID.size);
- memcpy(buf, pdev->InstanceUUID.data, l);
- buf[l] = 0;
+ memcpy(buf, pdev->InstanceUUID.data, l);
+ buf[l] = 0;
} else
- pdf_make_uuid(digest, pdf_uuid_time(pdev), pdev->DocumentTimeSeq, buf, buf_length);
+ pdf_make_uuid(digest, pdf_uuid_time(pdev), pdev->DocumentTimeSeq, buf, buf_length);
return 0;
}
@@ -528,12 +526,12 @@ static int
pdf_make_document_uuid(gx_device_pdf *pdev, const byte digest[6], char *buf, int buf_length)
{
if (pdev->DocumentUUID.size) {
- int l = min(buf_length - 1, pdev->DocumentUUID.size);
+ int l = min(buf_length - 1, pdev->DocumentUUID.size);
- memcpy(buf, pdev->DocumentUUID.data, l);
- buf[l] = 0;
+ memcpy(buf, pdev->DocumentUUID.data, l);
+ buf[l] = 0;
} else
- pdf_make_uuid(digest, pdf_uuid_time(pdev), pdev->DocumentTimeSeq, buf, buf_length);
+ pdf_make_uuid(digest, pdf_uuid_time(pdev), pdev->DocumentTimeSeq, buf, buf_length);
return 0;
}
@@ -552,25 +550,25 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
code = pdf_make_instance_uuid(pdev, digest, instance_uuid, sizeof(instance_uuid));
if (code < 0)
- return code;
+ return code;
code = pdf_make_document_uuid(pdev, digest, document_uuid, sizeof(document_uuid));
if (code < 0)
- return code;
+ return code;
/* PDF/A XMP reference recommends setting UUID to empty. If not empty must be a URI */
- if (pdev->PDFA)
- instance_uuid[0] = 0x00;
+ if (pdev->PDFA)
+ instance_uuid[0] = 0x00;
cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time));
if (!cre_date_time_len)
- cre_date_time_len = pdf_xmp_time(cre_date_time, sizeof(cre_date_time));
+ cre_date_time_len = pdf_xmp_time(cre_date_time, sizeof(cre_date_time));
else
- cre_date_time_len = pdf_xmp_convert_time(cre_date_time, cre_date_time_len, date_time_buf, sizeof(date_time_buf));
+ cre_date_time_len = pdf_xmp_convert_time(cre_date_time, cre_date_time_len, date_time_buf, sizeof(date_time_buf));
mod_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", mod_date_time, sizeof(mod_date_time));
if (!mod_date_time_len)
- mod_date_time_len = pdf_xmp_time(mod_date_time, sizeof(mod_date_time));
+ mod_date_time_len = pdf_xmp_time(mod_date_time, sizeof(mod_date_time));
else
- mod_date_time_len = pdf_xmp_convert_time(mod_date_time, mod_date_time_len, date_time_buf, sizeof(date_time_buf));
+ mod_date_time_len = pdf_xmp_convert_time(mod_date_time, mod_date_time_len, date_time_buf, sizeof(date_time_buf));
pdf_xml_ins_beg(s, "xpacket");
pdf_xml_attribute_name(s, "begin");
@@ -582,179 +580,179 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
pdf_xml_copy(s, "<?adobe-xap-filters esc=\"CRLF\"?>\n");
pdf_xml_copy(s, "<x:xmpmeta xmlns:x='adobe:ns:meta/'"
- " x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'>\n");
+ " x:xmptk='XMP toolkit 2.9.1-13, framework 1.6'>\n");
{
- pdf_xml_copy(s, "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' "
- "xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n");
- {
-
- pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
- pdf_xml_attribute_value(s, instance_uuid);
- pdf_xml_attribute_name(s, "xmlns:pdf");
- pdf_xml_attribute_value(s, "http://ns.adobe.com/pdf/1.3/");
-
- if (cos_dict_find(pdev->Info, (const byte *)"/Keywords", 9)) {
- pdf_xml_tag_end(s);
- pdf_xml_tag_open_beg(s, "pdf:Producer");
- pdf_xml_tag_end(s);
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Producer", "UnknownProducer",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- pdf_xml_tag_close(s, "pdf:Producer");
- pdf_xml_newline(s);
-
- pdf_xml_tag_open_beg(s, "pdf:Keywords");
- pdf_xml_tag_end(s);
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Keywords", "Unknown",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- pdf_xml_tag_close(s, "pdf:Keywords");
- pdf_xml_newline(s);
-
- pdf_xml_tag_close(s, "rdf:Description");
- pdf_xml_newline(s);
- } else {
- pdf_xml_attribute_name(s, "pdf:Producer");
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Producer", "UnknownProducer",
- pdf_xml_attribute_value_data);
- if (code < 0)
- return code;
- pdf_xml_tag_end_empty(s);
- pdf_xml_newline(s);
- }
-
- pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
- pdf_xml_attribute_value(s, instance_uuid);
- pdf_xml_attribute_name(s, "xmlns:xmp");
- pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/");
- pdf_xml_tag_end(s);
- {
- pdf_xml_tag_open_beg(s, "xmp:ModifyDate");
- pdf_xml_tag_end(s);
- mod_date_time[mod_date_time_len] = 0x00;
- pdf_xml_copy(s, mod_date_time);
- pdf_xml_tag_close(s, "xmp:ModifyDate");
- pdf_xml_newline(s);
- }
- {
- pdf_xml_tag_open_beg(s, "xmp:CreateDate");
- pdf_xml_tag_end(s);
- cre_date_time[cre_date_time_len] = 0x00;
- pdf_xml_copy(s, cre_date_time);
- pdf_xml_tag_close(s, "xmp:CreateDate");
- pdf_xml_newline(s);
- }
- {
- pdf_xml_tag_open_beg(s, "xmp:CreatorTool");
- pdf_xml_tag_end(s);
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Creator", "UnknownApplication",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- pdf_xml_tag_close(s, "xmp:CreatorTool");
- }
- pdf_xml_tag_close(s, "rdf:Description");
- pdf_xml_newline(s);
-
- pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
- pdf_xml_attribute_value(s, instance_uuid);
- pdf_xml_attribute_name(s, "xmlns:xapMM");
- pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
- pdf_xml_attribute_name(s, "xapMM:DocumentID");
- pdf_xml_attribute_value(s, document_uuid);
- pdf_xml_tag_end_empty(s);
- pdf_xml_newline(s);
-
- pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
- pdf_xml_attribute_value(s, instance_uuid);
- pdf_xml_attribute_name(s, "xmlns:dc");
- pdf_xml_attribute_value(s, "http://purl.org/dc/elements/1.1/");
- pdf_xml_attribute_name(s, "dc:format");
- pdf_xml_attribute_value(s,"application/pdf");
- pdf_xml_tag_end(s);
- {
- pdf_xml_tag_open(s, "dc:title");
- {
- pdf_xml_tag_open(s, "rdf:Alt");
- {
- pdf_xml_tag_open_beg(s, "rdf:li");
- pdf_xml_attribute_name(s, "xml:lang");
- pdf_xml_attribute_value(s, "x-default");
- pdf_xml_tag_end(s);
- {
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Title", "Untitled",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- }
- pdf_xml_tag_close(s, "rdf:li");
- }
- pdf_xml_tag_close(s, "rdf:Alt");
- }
- pdf_xml_tag_close(s, "dc:title");
-
- if (cos_dict_find(pdev->Info, (const byte *)"/Author", 7)) {
- pdf_xml_tag_open(s, "dc:creator");
- { /* According to the PDF/A specification
- "it shall be represented by an ordered Text array of
- length one whose single entry shall consist
- of one or more names". */
- pdf_xml_tag_open(s, "rdf:Seq");
- {
- pdf_xml_tag_open(s, "rdf:li");
- {
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Author", "Unknown",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- }
- pdf_xml_tag_close(s, "rdf:li");
- }
- pdf_xml_tag_close(s, "rdf:Seq");
- }
- pdf_xml_tag_close(s, "dc:creator");
- }
- if (cos_dict_find(pdev->Info, (const byte *)"/Subject", 8)) {
- pdf_xml_tag_open(s, "dc:description");
- {
- pdf_xml_tag_open(s, "rdf:Seq");
- {
- pdf_xml_tag_open(s, "rdf:li");
- {
- code = pdf_xmp_write_docinfo_item(pdev, s, "/Subject", "No Subject",
- pdf_xml_data_write);
- if (code < 0)
- return code;
- }
- pdf_xml_tag_close(s, "rdf:li");
- }
- pdf_xml_tag_close(s, "rdf:Seq");
- }
- pdf_xml_tag_close(s, "dc:description");
- }
- }
- pdf_xml_tag_close(s, "rdf:Description");
- pdf_xml_newline(s);
- if (pdev->PDFA) {
- pdf_xml_tag_open_beg(s, "rdf:Description");
- pdf_xml_attribute_name(s, "rdf:about");
- pdf_xml_attribute_value(s, instance_uuid);
- pdf_xml_attribute_name(s, "xmlns:pdfaid");
- pdf_xml_attribute_value(s, "http://www.aiim.org/pdfa/ns/id/");
- pdf_xml_attribute_name(s, "pdfaid:part");
- pdf_xml_attribute_value(s,"1");
- pdf_xml_attribute_name(s, "pdfaid:conformance");
- pdf_xml_attribute_value(s,"B");
- pdf_xml_tag_end_empty(s);
- }
- }
- pdf_xml_copy(s, "</rdf:RDF>\n");
+ pdf_xml_copy(s, "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' "
+ "xmlns:iX='http://ns.adobe.com/iX/1.0/'>\n");
+ {
+
+ pdf_xml_tag_open_beg(s, "rdf:Description");
+ pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_attribute_value(s, instance_uuid);
+ pdf_xml_attribute_name(s, "xmlns:pdf");
+ pdf_xml_attribute_value(s, "http://ns.adobe.com/pdf/1.3/");
+
+ if (cos_dict_find(pdev->Info, (const byte *)"/Keywords", 9)) {
+ pdf_xml_tag_end(s);
+ pdf_xml_tag_open_beg(s, "pdf:Producer");
+ pdf_xml_tag_end(s);
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Producer", "UnknownProducer",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ pdf_xml_tag_close(s, "pdf:Producer");
+ pdf_xml_newline(s);
+
+ pdf_xml_tag_open_beg(s, "pdf:Keywords");
+ pdf_xml_tag_end(s);
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Keywords", "Unknown",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ pdf_xml_tag_close(s, "pdf:Keywords");
+ pdf_xml_newline(s);
+
+ pdf_xml_tag_close(s, "rdf:Description");
+ pdf_xml_newline(s);
+ } else {
+ pdf_xml_attribute_name(s, "pdf:Producer");
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Producer", "UnknownProducer",
+ pdf_xml_attribute_value_data);
+ if (code < 0)
+ return code;
+ pdf_xml_tag_end_empty(s);
+ pdf_xml_newline(s);
+ }
+
+ pdf_xml_tag_open_beg(s, "rdf:Description");
+ pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_attribute_value(s, instance_uuid);
+ pdf_xml_attribute_name(s, "xmlns:xmp");
+ pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/");
+ pdf_xml_tag_end(s);
+ {
+ pdf_xml_tag_open_beg(s, "xmp:ModifyDate");
+ pdf_xml_tag_end(s);
+ mod_date_time[mod_date_time_len] = 0x00;
+ pdf_xml_copy(s, mod_date_time);
+ pdf_xml_tag_close(s, "xmp:ModifyDate");
+ pdf_xml_newline(s);
+ }
+ {
+ pdf_xml_tag_open_beg(s, "xmp:CreateDate");
+ pdf_xml_tag_end(s);
+ cre_date_time[cre_date_time_len] = 0x00;
+ pdf_xml_copy(s, cre_date_time);
+ pdf_xml_tag_close(s, "xmp:CreateDate");
+ pdf_xml_newline(s);
+ }
+ {
+ pdf_xml_tag_open_beg(s, "xmp:CreatorTool");
+ pdf_xml_tag_end(s);
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Creator", "UnknownApplication",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ pdf_xml_tag_close(s, "xmp:CreatorTool");
+ }
+ pdf_xml_tag_close(s, "rdf:Description");
+ pdf_xml_newline(s);
+
+ pdf_xml_tag_open_beg(s, "rdf:Description");
+ pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_attribute_value(s, instance_uuid);
+ pdf_xml_attribute_name(s, "xmlns:xapMM");
+ pdf_xml_attribute_value(s, "http://ns.adobe.com/xap/1.0/mm/");
+ pdf_xml_attribute_name(s, "xapMM:DocumentID");
+ pdf_xml_attribute_value(s, document_uuid);
+ pdf_xml_tag_end_empty(s);
+ pdf_xml_newline(s);
+
+ pdf_xml_tag_open_beg(s, "rdf:Description");
+ pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_attribute_value(s, instance_uuid);
+ pdf_xml_attribute_name(s, "xmlns:dc");
+ pdf_xml_attribute_value(s, "http://purl.org/dc/elements/1.1/");
+ pdf_xml_attribute_name(s, "dc:format");
+ pdf_xml_attribute_value(s,"application/pdf");
+ pdf_xml_tag_end(s);
+ {
+ pdf_xml_tag_open(s, "dc:title");
+ {
+ pdf_xml_tag_open(s, "rdf:Alt");
+ {
+ pdf_xml_tag_open_beg(s, "rdf:li");
+ pdf_xml_attribute_name(s, "xml:lang");
+ pdf_xml_attribute_value(s, "x-default");
+ pdf_xml_tag_end(s);
+ {
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Title", "Untitled",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ }
+ pdf_xml_tag_close(s, "rdf:li");
+ }
+ pdf_xml_tag_close(s, "rdf:Alt");
+ }
+ pdf_xml_tag_close(s, "dc:title");
+
+ if (cos_dict_find(pdev->Info, (const byte *)"/Author", 7)) {
+ pdf_xml_tag_open(s, "dc:creator");
+ { /* According to the PDF/A specification
+ "it shall be represented by an ordered Text array of
+ length one whose single entry shall consist
+ of one or more names". */
+ pdf_xml_tag_open(s, "rdf:Seq");
+ {
+ pdf_xml_tag_open(s, "rdf:li");
+ {
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Author", "Unknown",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ }
+ pdf_xml_tag_close(s, "rdf:li");
+ }
+ pdf_xml_tag_close(s, "rdf:Seq");
+ }
+ pdf_xml_tag_close(s, "dc:creator");
+ }
+ if (cos_dict_find(pdev->Info, (const byte *)"/Subject", 8)) {
+ pdf_xml_tag_open(s, "dc:description");
+ {
+ pdf_xml_tag_open(s, "rdf:Seq");
+ {
+ pdf_xml_tag_open(s, "rdf:li");
+ {
+ code = pdf_xmp_write_docinfo_item(pdev, s, "/Subject", "No Subject",
+ pdf_xml_data_write);
+ if (code < 0)
+ return code;
+ }
+ pdf_xml_tag_close(s, "rdf:li");
+ }
+ pdf_xml_tag_close(s, "rdf:Seq");
+ }
+ pdf_xml_tag_close(s, "dc:description");
+ }
+ }
+ pdf_xml_tag_close(s, "rdf:Description");
+ pdf_xml_newline(s);
+ if (pdev->PDFA) {
+ pdf_xml_tag_open_beg(s, "rdf:Description");
+ pdf_xml_attribute_name(s, "rdf:about");
+ pdf_xml_attribute_value(s, instance_uuid);
+ pdf_xml_attribute_name(s, "xmlns:pdfaid");
+ pdf_xml_attribute_value(s, "http://www.aiim.org/pdfa/ns/id/");
+ pdf_xml_attribute_name(s, "pdfaid:part");
+ pdf_xml_attribute_value(s,"1");
+ pdf_xml_attribute_name(s, "pdfaid:conformance");
+ pdf_xml_attribute_value(s,"B");
+ pdf_xml_tag_end_empty(s);
+ }
+ }
+ pdf_xml_copy(s, "</rdf:RDF>\n");
}
pdf_xml_copy(s, "</x:xmpmeta>\n");
@@ -766,45 +764,44 @@ pdf_write_document_metadata(gx_device_pdf *pdev, const byte digest[6])
int
pdf_document_metadata(gx_device_pdf *pdev)
-{
+{
if (pdev->CompatibilityLevel < 1.4)
- return 0;
+ return 0;
if (pdev->ParseDSCCommentsForDocInfo || pdev->PreserveEPSInfo) {
- pdf_resource_t *pres;
- char buf[20];
- byte digest[6];
- int code;
- int options = DATA_STREAM_NOT_BINARY;
-
- sflush(pdev->strm);
- s_MD5C_get_digest(pdev->strm, digest, sizeof(digest));
- if (pdev->EncryptMetadata)
- options |= DATA_STREAM_ENCRYPT;
- code = pdf_open_aside(pdev, resourceMetadata, gs_no_id, &pres, true, options);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_string((cos_dict_t *)pres->object, "/Type", (const byte *)"/Metadata", 9);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_string((cos_dict_t *)pres->object, "/Subtype", (const byte *)"/XML", 4);
- if (code < 0)
- return code;
- code = pdf_write_document_metadata(pdev, digest);
- if (code < 0)
- return code;
- code = pdf_close_aside(pdev);
- if (code < 0)
- return code;
- code = COS_WRITE_OBJECT(pres->object, pdev, resourceNone);
- if (code < 0)
- return code;
- sprintf(buf, "%ld 0 R", pres->object->id);
- code = cos_dict_put_c_key_object(pdev->Catalog, "/Metadata", pres->object);
- if (code < 0)
- return code;
+ pdf_resource_t *pres;
+ char buf[20];
+ byte digest[6];
+ int code;
+ int options = DATA_STREAM_NOT_BINARY;
+
+ sflush(pdev->strm);
+ s_MD5C_get_digest(pdev->strm, digest, sizeof(digest));
+ if (pdev->EncryptMetadata)
+ options |= DATA_STREAM_ENCRYPT;
+ code = pdf_open_aside(pdev, resourceMetadata, gs_no_id, &pres, true, options);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_string((cos_dict_t *)pres->object, "/Type", (const byte *)"/Metadata", 9);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_string((cos_dict_t *)pres->object, "/Subtype", (const byte *)"/XML", 4);
+ if (code < 0)
+ return code;
+ code = pdf_write_document_metadata(pdev, digest);
+ if (code < 0)
+ return code;
+ code = pdf_close_aside(pdev);
+ if (code < 0)
+ return code;
+ code = COS_WRITE_OBJECT(pres->object, pdev, resourceNone);
+ if (code < 0)
+ return code;
+ sprintf(buf, "%ld 0 R", pres->object->id);
+ code = cos_dict_put_c_key_object(pdev->Catalog, "/Metadata", pres->object);
+ if (code < 0)
+ return code;
}
return 0;
}
/* -------------------------------------------- */
-
diff --git a/gs/base/gdevpdfg.c b/gs/base/gdevpdfg.c
index ad69f3e6c..3953dc19b 100644
--- a/gs/base/gdevpdfg.c
+++ b/gs/base/gdevpdfg.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,7 +44,7 @@ pdf_save_viewer_state(gx_device_pdf *pdev, stream *s)
const int i = pdev->vgstack_depth;
if (pdev->vgstack_depth >= count_of(pdev->vgstack))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
pdev->vgstack[i].transfer_ids[0] = pdev->transfer_ids[0];
pdev->vgstack[i].transfer_ids[1] = pdev->transfer_ids[1];
pdev->vgstack[i].transfer_ids[2] = pdev->transfer_ids[2];
@@ -69,18 +69,18 @@ pdf_save_viewer_state(gx_device_pdf *pdev, stream *s)
pdev->vgstack[i].saved_stroke_color = pdev->saved_stroke_color;
pdev->vgstack[i].line_params = pdev->state.line_params;
pdev->vgstack[i].line_params.dash.pattern = 0; /* Use pdev->dash_pattern instead. */
- memcpy(pdev->vgstack[i].dash_pattern, pdev->dash_pattern,
- sizeof(pdev->vgstack[i].dash_pattern));
+ memcpy(pdev->vgstack[i].dash_pattern, pdev->dash_pattern,
+ sizeof(pdev->vgstack[i].dash_pattern));
pdev->vgstack_depth++;
if (s)
- stream_puts(s, "q\n");
+ stream_puts(s, "q\n");
return 0;
}
/* Load the viewer's graphic state. */
static void
pdf_load_viewer_state(gx_device_pdf *pdev, pdf_viewer_state *s)
-{
+{
pdev->transfer_ids[0] = s->transfer_ids[0];
pdev->transfer_ids[1] = s->transfer_ids[1];
pdev->transfer_ids[2] = s->transfer_ids[2];
@@ -105,19 +105,18 @@ pdf_load_viewer_state(gx_device_pdf *pdev, pdf_viewer_state *s)
pdev->saved_stroke_color = s->saved_stroke_color;
pdev->state.line_params = s->line_params;
memcpy(pdev->dash_pattern, s->dash_pattern,
- sizeof(s->dash_pattern));
+ sizeof(s->dash_pattern));
}
-
/* Restore the viewer's graphic state. */
int
pdf_restore_viewer_state(gx_device_pdf *pdev, stream *s)
{ const int i = --pdev->vgstack_depth;
if (i < pdev->vgstack_bottom || i < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (s)
- stream_puts(s, "Q\n");
+ stream_puts(s, "Q\n");
pdf_load_viewer_state(pdev, pdev->vgstack + i);
return 0;
}
@@ -125,8 +124,8 @@ pdf_restore_viewer_state(gx_device_pdf *pdev, stream *s)
/* Set initial color. */
void
pdf_set_initial_color(gx_device_pdf * pdev, gx_hl_saved_color *saved_fill_color,
- gx_hl_saved_color *saved_stroke_color,
- bool *fill_used_process_color, bool *stroke_used_process_color)
+ gx_hl_saved_color *saved_stroke_color,
+ bool *fill_used_process_color, bool *stroke_used_process_color)
{
gx_device_color black;
@@ -143,11 +142,11 @@ pdf_set_initial_color(gx_device_pdf * pdev, gx_hl_saved_color *saved_fill_color,
static void
pdf_viewer_state_from_imager_state_aux(pdf_viewer_state *pvs, const gs_imager_state *pis)
{
- pvs->transfer_not_identity =
- (pis->set_transfer.red != NULL ? pis->set_transfer.red->proc != gs_identity_transfer : 0) * 1 +
- (pis->set_transfer.green != NULL ? pis->set_transfer.green->proc != gs_identity_transfer : 0) * 2 +
- (pis->set_transfer.blue != NULL ? pis->set_transfer.blue->proc != gs_identity_transfer : 0) * 4 +
- (pis->set_transfer.gray != NULL ? pis->set_transfer.gray->proc != gs_identity_transfer : 0) * 8;
+ pvs->transfer_not_identity =
+ (pis->set_transfer.red != NULL ? pis->set_transfer.red->proc != gs_identity_transfer : 0) * 1 +
+ (pis->set_transfer.green != NULL ? pis->set_transfer.green->proc != gs_identity_transfer : 0) * 2 +
+ (pis->set_transfer.blue != NULL ? pis->set_transfer.blue->proc != gs_identity_transfer : 0) * 4 +
+ (pis->set_transfer.gray != NULL ? pis->set_transfer.gray->proc != gs_identity_transfer : 0) * 8;
pvs->transfer_ids[0] = (pis->set_transfer.red != NULL ? pis->set_transfer.red->id : 0);
pvs->transfer_ids[1] = (pis->set_transfer.green != NULL ? pis->set_transfer.green->id : 0);
pvs->transfer_ids[2] = (pis->set_transfer.blue != NULL ? pis->set_transfer.blue->id : 0);
@@ -182,8 +181,8 @@ pdf_viewer_state_from_imager_state_aux(pdf_viewer_state *pvs, const gs_imager_st
/* Copy viewer state from images state. */
void
-pdf_viewer_state_from_imager_state(gx_device_pdf * pdev,
- const gs_imager_state *pis, const gx_device_color *pdevc)
+pdf_viewer_state_from_imager_state(gx_device_pdf * pdev,
+ const gs_imager_state *pis, const gx_device_color *pdevc)
{
pdf_viewer_state vs;
@@ -207,7 +206,7 @@ pdf_prepare_initial_viewer_state(gx_device_pdf * pdev, const gs_imager_state *pi
*/
pdf_set_initial_color(pdev, &pdev->vg_initial.saved_fill_color, &pdev->vg_initial.saved_stroke_color,
- &pdev->vg_initial.fill_used_process_color, &pdev->vg_initial.stroke_used_process_color);
+ &pdev->vg_initial.fill_used_process_color, &pdev->vg_initial.stroke_used_process_color);
pdf_viewer_state_from_imager_state_aux(&pdev->vg_initial, pis);
pdev->vg_initial_set = true;
/*
@@ -223,15 +222,15 @@ static void
pdf_reset_graphics_old(gx_device_pdf * pdev)
{
- pdf_set_initial_color(pdev, &pdev->saved_fill_color, &pdev->saved_stroke_color,
- &pdev->fill_used_process_color, &pdev->stroke_used_process_color);
+ pdf_set_initial_color(pdev, &pdev->saved_fill_color, &pdev->saved_stroke_color,
+ &pdev->fill_used_process_color, &pdev->stroke_used_process_color);
pdev->state.flatness = -1;
{
- static const gx_line_params lp_initial = {
- gx_line_params_initial
- };
+ static const gx_line_params lp_initial = {
+ gx_line_params_initial
+ };
- pdev->state.line_params = lp_initial;
+ pdev->state.line_params = lp_initial;
}
pdev->fill_overprint = false;
pdev->stroke_overprint = false;
@@ -243,22 +242,22 @@ void
pdf_reset_graphics(gx_device_pdf * pdev)
{
if (pdev->vg_initial_set)
- pdf_load_viewer_state(pdev, &pdev->vg_initial);
+ pdf_load_viewer_state(pdev, &pdev->vg_initial);
else
- pdf_reset_graphics_old(pdev);
+ pdf_reset_graphics_old(pdev);
pdf_reset_text(pdev);
}
/* Write client color. */
static int
-pdf_write_ccolor(gx_device_pdf * pdev, const gs_imager_state * pis,
- const gs_client_color *pcc)
-{
+pdf_write_ccolor(gx_device_pdf * pdev, const gs_imager_state * pis,
+ const gs_client_color *pcc)
+{
int i, n = gx_hld_get_number_color_components(pis);
pprintg1(pdev->strm, "%g", psdf_round(pcc->paint.values[0], 255, 8));
for (i = 1; i < n; i++) {
- pprintg1(pdev->strm, " %g", psdf_round(pcc->paint.values[i], 255, 8));
+ pprintg1(pdev->strm, " %g", psdf_round(pcc->paint.values[i], 255, 8));
}
return 0;
}
@@ -266,17 +265,17 @@ pdf_write_ccolor(gx_device_pdf * pdev, const gs_imager_state * pis,
static inline bool
is_cspace_allowed_in_strategy(gx_device_pdf * pdev, gs_color_space_index csi)
{
- if (pdev->params.ColorConversionStrategy == ccs_CMYK &&
- csi != gs_color_space_index_DeviceCMYK &&
- csi != gs_color_space_index_DeviceGray)
- return false;
- if (pdev->params.ColorConversionStrategy == ccs_sRGB &&
- csi != gs_color_space_index_DeviceRGB &&
- csi != gs_color_space_index_DeviceGray)
- return false;
- if (pdev->params.ColorConversionStrategy == ccs_Gray &&
- csi != gs_color_space_index_DeviceGray)
- return false;
+ if (pdev->params.ColorConversionStrategy == ccs_CMYK &&
+ csi != gs_color_space_index_DeviceCMYK &&
+ csi != gs_color_space_index_DeviceGray)
+ return false;
+ if (pdev->params.ColorConversionStrategy == ccs_sRGB &&
+ csi != gs_color_space_index_DeviceRGB &&
+ csi != gs_color_space_index_DeviceGray)
+ return false;
+ if (pdev->params.ColorConversionStrategy == ccs_Gray &&
+ csi != gs_color_space_index_DeviceGray)
+ return false;
return true;
}
@@ -291,10 +290,10 @@ is_pattern2_allowed_in_strategy(gx_device_pdf * pdev, const gx_drawing_color *pd
/* Set the fill or stroke color. */
int
-pdf_reset_color(gx_device_pdf * pdev, const gs_imager_state * pis,
- const gx_drawing_color *pdc, gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc)
+pdf_reset_color(gx_device_pdf * pdev, const gs_imager_state * pis,
+ const gx_drawing_color *pdc, gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc)
{
int code = 0;
gx_hl_saved_color temp;
@@ -307,174 +306,174 @@ pdf_reset_color(gx_device_pdf * pdev, const gs_imager_state * pis,
gs_color_space_index csi2;
if (pdev->skip_colors)
- return 0;
+ return 0;
gx_hld_save_color(pis, pdc, &temp);
/* Since pdfwrite never applies halftones and patterns, but monitors
* halftone/pattern IDs separately, we don't need to compare
* halftone/pattern bodies here.
*/
if (gx_hld_saved_color_equal(&temp, psc))
- return 0;
+ return 0;
switch (gx_hld_get_color_space_and_ccolor(pis, pdc, &pcs, &pcc)) {
- case non_pattern_color_space:
+ case non_pattern_color_space:
csi2 = gs_color_space_get_index(pcs);
if (csi2 == gs_color_space_index_ICC) {
csi2 = gsicc_get_default_type(pcs->cmm_icc_profile_data);
}
- switch (csi2) {
- case gs_color_space_index_DeviceGray:
- command = ppscc->setgray;
- break;
- case gs_color_space_index_DeviceRGB:
- if (pdev->params.ColorConversionStrategy == ccs_CMYK)
- goto write_process_color;
- if (pdev->params.ColorConversionStrategy == ccs_Gray)
- goto write_process_color;
- command = ppscc->setrgbcolor;
- break;
- case gs_color_space_index_DeviceCMYK:
- if (pdev->params.ColorConversionStrategy == ccs_sRGB)
- goto write_process_color;
- if (pdev->params.ColorConversionStrategy == ccs_Gray)
- goto write_process_color;
- command = ppscc->setcmykcolor;
- break;
- case gs_color_space_index_Indexed:
- if (pdev->CompatibilityLevel <= 1.2) {
- pcs2 = pcs->base_space;
- csi = gs_color_space_get_index(pcs2);
- if (!is_cspace_allowed_in_strategy(pdev, csi))
- goto write_process_color;
- if (csi == gs_color_space_index_Separation) {
- pcs2 = pcs->base_space;
- goto check_pcs2;
- }
- goto check_pcs2;
- }
- goto scn;
- case gs_color_space_index_Separation:
- if (pdev->CompatibilityLevel <= 1.2) {
- pcs2 = pcs->base_space;
- check_pcs2:
- csi = gs_color_space_get_index(pcs2);
- if (!is_cspace_allowed_in_strategy(pdev, csi))
- goto write_process_color;
- switch(gs_color_space_get_index(pcs2)) {
- case gs_color_space_index_DevicePixel :
- case gs_color_space_index_DeviceN:
- case gs_color_space_index_ICC:
- goto write_process_color;
- default:
- DO_NOTHING;
- }
- }
- goto scn;
- case gs_color_space_index_ICC:
- case gs_color_space_index_DevicePixel:
- case gs_color_space_index_DeviceN:
- if (pdev->CompatibilityLevel <= 1.2)
- goto write_process_color;
- goto scn;
- default :
- if (pdev->params.ColorConversionStrategy == ccs_CMYK)
- goto write_process_color;
- if (pdev->params.ColorConversionStrategy == ccs_sRGB)
- goto write_process_color;
- if (pdev->params.ColorConversionStrategy == ccs_Gray)
- goto write_process_color;
- scn:
- command = ppscc->setcolorn;
- if (!gx_hld_saved_color_same_cspace(&temp, psc)) {
- code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
- &pdf_color_space_names, true, NULL, 0);
- /* fixme : creates redundant PDF objects. */
- if (code == gs_error_rangecheck) {
- /* The color space can't write to PDF. */
- goto write_process_color;
- }
- if (code < 0)
- return code;
- code = cos_value_write(&cs_value, pdev);
- if (code < 0)
- return code;
- pprints1(pdev->strm, " %s\n", ppscc->setcolorspace);
- } else if (*used_process_color)
- goto write_process_color;
- break;
- }
- *used_process_color = false;
- code = pdf_write_ccolor(pdev, pis, pcc);
- if (code < 0)
- return code;
- pprints1(pdev->strm, " %s\n", command);
- break;
- case pattern_color_space:
- { pdf_resource_t *pres;
-
- if (pdc->type == gx_dc_type_pattern)
- code = pdf_put_colored_pattern(pdev, pdc, pcs,
- ppscc, pis->have_pattern_streams, &pres);
- else if (pdc->type == &gx_dc_pure_masked) {
- code = pdf_put_uncolored_pattern(pdev, pdc, pcs,
- ppscc, pis->have_pattern_streams, &pres);
- if (code < 0 || pres == 0)
- return code;
- if (pis->have_pattern_streams)
- code = pdf_write_ccolor(pdev, pis, pcc);
- } else if (pdc->type == &gx_dc_pattern2) {
- if (pdev->CompatibilityLevel <= 1.2)
- return_error(gs_error_rangecheck);
- if (!is_pattern2_allowed_in_strategy(pdev, pdc))
- return_error(gs_error_rangecheck);
- code1 = pdf_put_pattern2(pdev, pdc, ppscc, &pres);
- } else
- return_error(gs_error_rangecheck);
- if (code < 0)
- return code;
- cos_value_write(cos_resource_value(&cs_value, pres->object), pdev);
- pprints1(pdev->strm, " %s\n", ppscc->setcolorn);
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/Pattern", pres);
- if (code < 0)
- return code;
- }
- *used_process_color = false;
- break;
- default: /* must not happen. */
- case use_process_color:
- write_process_color:
- code = psdf_set_color((gx_device_vector *)pdev, pdc, ppscc);
- if (code < 0)
- return code;
- *used_process_color = true;
+ switch (csi2) {
+ case gs_color_space_index_DeviceGray:
+ command = ppscc->setgray;
+ break;
+ case gs_color_space_index_DeviceRGB:
+ if (pdev->params.ColorConversionStrategy == ccs_CMYK)
+ goto write_process_color;
+ if (pdev->params.ColorConversionStrategy == ccs_Gray)
+ goto write_process_color;
+ command = ppscc->setrgbcolor;
+ break;
+ case gs_color_space_index_DeviceCMYK:
+ if (pdev->params.ColorConversionStrategy == ccs_sRGB)
+ goto write_process_color;
+ if (pdev->params.ColorConversionStrategy == ccs_Gray)
+ goto write_process_color;
+ command = ppscc->setcmykcolor;
+ break;
+ case gs_color_space_index_Indexed:
+ if (pdev->CompatibilityLevel <= 1.2) {
+ pcs2 = pcs->base_space;
+ csi = gs_color_space_get_index(pcs2);
+ if (!is_cspace_allowed_in_strategy(pdev, csi))
+ goto write_process_color;
+ if (csi == gs_color_space_index_Separation) {
+ pcs2 = pcs->base_space;
+ goto check_pcs2;
+ }
+ goto check_pcs2;
+ }
+ goto scn;
+ case gs_color_space_index_Separation:
+ if (pdev->CompatibilityLevel <= 1.2) {
+ pcs2 = pcs->base_space;
+ check_pcs2:
+ csi = gs_color_space_get_index(pcs2);
+ if (!is_cspace_allowed_in_strategy(pdev, csi))
+ goto write_process_color;
+ switch(gs_color_space_get_index(pcs2)) {
+ case gs_color_space_index_DevicePixel :
+ case gs_color_space_index_DeviceN:
+ case gs_color_space_index_ICC:
+ goto write_process_color;
+ default:
+ DO_NOTHING;
+ }
+ }
+ goto scn;
+ case gs_color_space_index_ICC:
+ case gs_color_space_index_DevicePixel:
+ case gs_color_space_index_DeviceN:
+ if (pdev->CompatibilityLevel <= 1.2)
+ goto write_process_color;
+ goto scn;
+ default :
+ if (pdev->params.ColorConversionStrategy == ccs_CMYK)
+ goto write_process_color;
+ if (pdev->params.ColorConversionStrategy == ccs_sRGB)
+ goto write_process_color;
+ if (pdev->params.ColorConversionStrategy == ccs_Gray)
+ goto write_process_color;
+ scn:
+ command = ppscc->setcolorn;
+ if (!gx_hld_saved_color_same_cspace(&temp, psc)) {
+ code = pdf_color_space_named(pdev, &cs_value, NULL, pcs,
+ &pdf_color_space_names, true, NULL, 0);
+ /* fixme : creates redundant PDF objects. */
+ if (code == gs_error_rangecheck) {
+ /* The color space can't write to PDF. */
+ goto write_process_color;
+ }
+ if (code < 0)
+ return code;
+ code = cos_value_write(&cs_value, pdev);
+ if (code < 0)
+ return code;
+ pprints1(pdev->strm, " %s\n", ppscc->setcolorspace);
+ } else if (*used_process_color)
+ goto write_process_color;
+ break;
+ }
+ *used_process_color = false;
+ code = pdf_write_ccolor(pdev, pis, pcc);
+ if (code < 0)
+ return code;
+ pprints1(pdev->strm, " %s\n", command);
+ break;
+ case pattern_color_space:
+ { pdf_resource_t *pres;
+
+ if (pdc->type == gx_dc_type_pattern)
+ code = pdf_put_colored_pattern(pdev, pdc, pcs,
+ ppscc, pis->have_pattern_streams, &pres);
+ else if (pdc->type == &gx_dc_pure_masked) {
+ code = pdf_put_uncolored_pattern(pdev, pdc, pcs,
+ ppscc, pis->have_pattern_streams, &pres);
+ if (code < 0 || pres == 0)
+ return code;
+ if (pis->have_pattern_streams)
+ code = pdf_write_ccolor(pdev, pis, pcc);
+ } else if (pdc->type == &gx_dc_pattern2) {
+ if (pdev->CompatibilityLevel <= 1.2)
+ return_error(gs_error_rangecheck);
+ if (!is_pattern2_allowed_in_strategy(pdev, pdc))
+ return_error(gs_error_rangecheck);
+ code1 = pdf_put_pattern2(pdev, pdc, ppscc, &pres);
+ } else
+ return_error(gs_error_rangecheck);
+ if (code < 0)
+ return code;
+ cos_value_write(cos_resource_value(&cs_value, pres->object), pdev);
+ pprints1(pdev->strm, " %s\n", ppscc->setcolorn);
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/Pattern", pres);
+ if (code < 0)
+ return code;
+ }
+ *used_process_color = false;
+ break;
+ default: /* must not happen. */
+ case use_process_color:
+ write_process_color:
+ code = psdf_set_color((gx_device_vector *)pdev, pdc, ppscc);
+ if (code < 0)
+ return code;
+ *used_process_color = true;
}
*psc = temp;
return code1;
}
int
pdf_set_drawing_color(gx_device_pdf * pdev, const gs_imager_state * pis,
- const gx_drawing_color *pdc,
- gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc)
+ const gx_drawing_color *pdc,
+ gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc)
{
gx_hl_saved_color temp;
int code;
- /* This section of code was in pdf_reset_color above, but was moved into this
+ /* This section of code was in pdf_reset_color above, but was moved into this
* routine (and below) in order to isolate the switch to a stream context. This
* now allows us the opportunity to write colours in any context, in particular
* when in a text context, by using pdf_reset_color.
*/
if (pdev->skip_colors)
- return 0;
+ return 0;
gx_hld_save_color(pis, pdc, &temp);
/* Since pdfwrite never applies halftones and patterns, but monitors
* halftone/pattern IDs separately, we don't need to compare
* halftone/pattern bodies here.
*/
if (gx_hld_saved_color_equal(&temp, psc))
- return 0;
+ return 0;
/*
* In principle, we can set colors in either stream or text
* context. However, since we currently enclose all text
@@ -484,15 +483,15 @@ pdf_set_drawing_color(gx_device_pdf * pdev, const gs_imager_state * pis,
*/
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
return pdf_reset_color(pdev, pis, pdc, psc, used_process_color, ppscc);
}
int
pdf_set_pure_color(gx_device_pdf * pdev, gx_color_index color,
- gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc)
+ gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc)
{
gx_drawing_color dcolor;
gx_hl_saved_color temp;
@@ -501,14 +500,14 @@ pdf_set_pure_color(gx_device_pdf * pdev, gx_color_index color,
set_nonclient_dev_color(&dcolor, color);
if (pdev->skip_colors)
- return 0;
+ return 0;
gx_hld_save_color(NULL, &dcolor, &temp);
/* Since pdfwrite never applies halftones and patterns, but monitors
* halftone/pattern IDs separately, we don't need to compare
* halftone/pattern bodies here.
*/
if (gx_hld_saved_color_equal(&temp, psc))
- return 0;
+ return 0;
/*
* In principle, we can set colors in either stream or text
* context. However, since we currently enclose all text
@@ -518,7 +517,7 @@ pdf_set_pure_color(gx_device_pdf * pdev, gx_color_index color,
*/
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
return pdf_reset_color(pdev, NULL, &dcolor, psc, used_process_color, ppscc);
}
@@ -527,14 +526,14 @@ pdf_set_pure_color(gx_device_pdf * pdev, gx_color_index color,
* Convert a string into cos name.
*/
int
-pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
- cos_value_t *pvalue)
+pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
+ cos_value_t *pvalue)
{
- byte *chars = gs_alloc_string(pdev->pdf_memory, len + 1,
+ byte *chars = gs_alloc_string(pdev->pdf_memory, len + 1,
"pdf_string_to_cos_name");
if (chars == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
chars[0] = '/';
memcpy(chars + 1, str, len);
cos_string_value(pvalue, chars, len + 1);
@@ -558,23 +557,23 @@ pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
static data_source_proc_access(transfer_map_access); /* check prototype */
static int
transfer_map_access(const gs_data_source_t *psrc, ulong start, uint length,
- byte *buf, const byte **ptr)
+ byte *buf, const byte **ptr)
{
const gx_transfer_map *map = (const gx_transfer_map *)psrc->data.str.data;
uint i;
if (ptr)
- *ptr = buf;
+ *ptr = buf;
for (i = 0; i < length; ++i)
- buf[i] = frac2byte(map->values[(uint)start + i]);
+ buf[i] = frac2byte(map->values[(uint)start + i]);
return 0;
}
static int
transfer_map_access_signed(const gs_data_source_t *psrc,
- ulong start, uint length,
- byte *buf, const byte **ptr)
+ ulong start, uint length,
+ byte *buf, const byte **ptr)
{
- /* To prevent numeric errors, we need to map 0 to an integer.
+ /* To prevent numeric errors, we need to map 0 to an integer.
* We can't apply a general expression, because Decode isn't accessible here.
* Assuming this works for UCR only.
* Assuming the range of UCR is always [-1, 1].
@@ -585,14 +584,14 @@ transfer_map_access_signed(const gs_data_source_t *psrc,
*ptr = buf;
for (i = 0; i < length; ++i)
- buf[i] = (byte)
- ((frac2float(map->values[(uint)start + i]) + 1) * 127);
+ buf[i] = (byte)
+ ((frac2float(map->values[(uint)start + i]) + 1) * 127);
return 0;
}
static int
pdf_write_transfer_map(gx_device_pdf *pdev, const gx_transfer_map *map,
- int range0, bool check_identity,
- const char *key, char *ids)
+ int range0, bool check_identity,
+ const char *key, char *ids)
{
gs_memory_t *mem = pdev->pdf_memory;
gs_function_Sd_params_t params;
@@ -604,26 +603,26 @@ pdf_write_transfer_map(gx_device_pdf *pdev, const gx_transfer_map *map,
int code;
if (map == 0) {
- *ids = 0; /* no map */
- return 1;
+ *ids = 0; /* no map */
+ return 1;
}
if (check_identity) {
- /* Check for an identity map. */
- int i;
-
- if (map->proc == gs_identity_transfer)
- i = transfer_map_size;
- else
- for (i = 0; i < transfer_map_size; ++i) {
- fixed d = map->values[i] - bits2frac(i, log2_transfer_map_size);
- if (any_abs(d) > fixed_epsilon) /* ignore small noise */
- break;
- }
- if (i == transfer_map_size) {
- strcpy(ids, key);
- strcat(ids, "/Identity");
- return 1;
- }
+ /* Check for an identity map. */
+ int i;
+
+ if (map->proc == gs_identity_transfer)
+ i = transfer_map_size;
+ else
+ for (i = 0; i < transfer_map_size; ++i) {
+ fixed d = map->values[i] - bits2frac(i, log2_transfer_map_size);
+ if (any_abs(d) > fixed_epsilon) /* ignore small noise */
+ break;
+ }
+ if (i == transfer_map_size) {
+ strcpy(ids, key);
+ strcat(ids, "/Identity");
+ return 1;
+ }
}
params.m = 1;
params.Domain = domain01;
@@ -632,41 +631,41 @@ pdf_write_transfer_map(gx_device_pdf *pdev, const gx_transfer_map *map,
params.Range = range01;
params.Order = 1;
params.DataSource.access =
- (range0 < 0 ? transfer_map_access_signed : transfer_map_access);
+ (range0 < 0 ? transfer_map_access_signed : transfer_map_access);
params.DataSource.data.str.data = (const byte *)map; /* bogus */
/* DataSource */
params.BitsPerSample = 8; /* could be 16 */
params.Encode = 0;
if (range01[0] < 0 && range01[1] > 0) {
- /* This works for UCR only.
- * Map 0 to an integer.
- * Rather the range of UCR is always [-1, 1],
- * we prefer a general expression.
- */
- int r0 = (int)( -range01[0] * ((1 << params.BitsPerSample) - 1)
- / (range01[1] - range01[0]) ); /* Round down. */
- float r1 = r0 * range01[1] / -range01[0]; /* r0 + r1 <= (1 << params.BitsPerSample) - 1 */
-
- decode[0] = range01[0];
- decode[1] = range01[0] + (range01[1] - range01[0]) * ((1 << params.BitsPerSample) - 1)
- / (r0 + r1);
- params.Decode = decode;
+ /* This works for UCR only.
+ * Map 0 to an integer.
+ * Rather the range of UCR is always [-1, 1],
+ * we prefer a general expression.
+ */
+ int r0 = (int)( -range01[0] * ((1 << params.BitsPerSample) - 1)
+ / (range01[1] - range01[0]) ); /* Round down. */
+ float r1 = r0 * range01[1] / -range01[0]; /* r0 + r1 <= (1 << params.BitsPerSample) - 1 */
+
+ decode[0] = range01[0];
+ decode[1] = range01[0] + (range01[1] - range01[0]) * ((1 << params.BitsPerSample) - 1)
+ / (r0 + r1);
+ params.Decode = decode;
} else
- params.Decode = 0;
+ params.Decode = 0;
params.Size = &size;
code = gs_function_Sd_init(&pfn, &params, mem);
if (code < 0)
- return code;
+ return code;
code = pdf_write_function(pdev, pfn, &id);
gs_function_free(pfn, false, mem);
if (code < 0)
- return code;
+ return code;
sprintf(ids, "%s%s%ld 0 R", key, (key[0] && key[0] != ' ' ? " " : ""), id);
return 0;
}
static int
pdf_write_transfer(gx_device_pdf *pdev, const gx_transfer_map *map,
- const char *key, char *ids)
+ const char *key, char *ids)
{
return pdf_write_transfer_map(pdev, map, 0, true, key, ids);
}
@@ -703,7 +702,7 @@ ht_Round(floatp xf, floatp yf)
float xabs = fabs(x), yabs = fabs(y);
if (d2f(xabs + yabs) <= 1)
- return d2f(1 - d2f(d2f(x * x) + d2f(y * y)));
+ return d2f(1 - d2f(d2f(x * x) + d2f(y * y)));
xabs -= 1, yabs -= 1;
return d2f(d2f(d2f(xabs * xabs) + d2f(yabs * yabs)) - 1);
}
@@ -714,9 +713,9 @@ ht_Diamond(floatp xf, floatp yf)
float xabs = fabs(x), yabs = fabs(y);
if (d2f(xabs + yabs) <= 0.75)
- return d2f(1 - d2f(d2f(x * x) + d2f(y * y)));
+ return d2f(1 - d2f(d2f(x * x) + d2f(y * y)));
if (d2f(xabs + yabs) <= d2f(1.23))
- return d2f(1 - d2f(d2f(d2f(0.85) * xabs) + yabs));
+ return d2f(1 - d2f(d2f(d2f(0.85) * xabs) + yabs));
xabs -= 1, yabs -= 1;
return d2f(d2f(d2f(xabs * xabs) + d2f(yabs * yabs)) - 1);
}
@@ -733,12 +732,12 @@ ht_Ellipse(floatp xf, floatp yf)
float w = (float)(d2f(d2f(3 * xabs) + d2f(4 * yabs)) - 3);
if (w < 0) {
- yabs /= 0.75;
- return d2f(1 - d2f((d2f(x * x) + d2f(yabs * yabs)) / 4));
+ yabs /= 0.75;
+ return d2f(1 - d2f((d2f(x * x) + d2f(yabs * yabs)) / 4));
}
if (w > 1) {
- xabs = 1 - xabs, yabs = d2f(1 - yabs) / 0.75;
- return d2f(d2f((d2f(xabs * xabs) + d2f(yabs * yabs)) / 4) - 1);
+ xabs = 1 - xabs, yabs = d2f(1 - yabs) / 0.75;
+ return d2f(d2f((d2f(xabs * xabs) + d2f(yabs * yabs)) / 4) - 1);
}
return d2f(0.5 - w);
}
@@ -803,7 +802,7 @@ static const ht_function_t ht_functions[] = {
/* Write each kind of halftone. */
static int
pdf_write_spot_function(gx_device_pdf *pdev, const gx_ht_order *porder,
- long *pid)
+ long *pid)
{
/****** DOESN'T HANDLE STRIP HALFTONES ******/
int w = porder->width, h = porder->height;
@@ -833,12 +832,12 @@ pdf_write_spot_function(gx_device_pdf *pdev, const gx_ht_order *porder,
* simplicity, we always use 16.
*/
if (num_bits > 0x10000)
- /* rangecheck is a 'special case' in gdev_pdf_fill_path, if this error is encountered
- * then it 'falls back' to a different method assuming its handling transparency in an
- * old PDF output version. But if we fail to write the halftone, we want to abort
- * so use limitcheck instead.
- */
- return_error(gs_error_limitcheck);
+ /* rangecheck is a 'special case' in gdev_pdf_fill_path, if this error is encountered
+ * then it 'falls back' to a different method assuming its handling transparency in an
+ * old PDF output version. But if we fail to write the halftone, we want to abort
+ * so use limitcheck instead.
+ */
+ return_error(gs_error_limitcheck);
params.BitsPerSample = 16;
params.Encode = 0;
/*
@@ -853,106 +852,106 @@ pdf_write_spot_function(gx_device_pdf *pdev, const gx_ht_order *porder,
/* Create the (temporary) threshold array. */
values = gs_alloc_byte_array(mem, num_bits, 2, "pdf_write_spot_function");
if (values == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < num_bits; ++i) {
- gs_int_point pt;
- int value;
-
- if ((code = porder->procs->bit_index(porder, i, &pt)) < 0)
- break;
- value = pt.y * w + pt.x;
- /* Always store the values in big-endian order. */
- values[i * 2] = (byte)(value >> 8);
- values[i * 2 + 1] = (byte)value;
+ gs_int_point pt;
+ int value;
+
+ if ((code = porder->procs->bit_index(porder, i, &pt)) < 0)
+ break;
+ value = pt.y * w + pt.x;
+ /* Always store the values in big-endian order. */
+ values[i * 2] = (byte)(value >> 8);
+ values[i * 2 + 1] = (byte)value;
}
data_source_init_bytes(&params.DataSource, (const byte *)values,
- sizeof(*values) * num_bits);
+ sizeof(*values) * num_bits);
if (code >= 0 &&
/* Warning from COverity that params.array_size is uninitialised. Correct */
/* but immeidiately after copying the data Sd_init sets the copied value */
/* to zero, so it is not actually used uninitialised. */
(code = gs_function_Sd_init(&pfn, &params, mem)) >= 0
- ) {
- code = pdf_write_function(pdev, pfn, pid);
- gs_function_free(pfn, false, mem);
+ ) {
+ code = pdf_write_function(pdev, pfn, pid);
+ gs_function_free(pfn, false, mem);
}
gs_free_object(mem, values, "pdf_write_spot_function");
return code;
}
static int
pdf_write_spot_halftone(gx_device_pdf *pdev, const gs_spot_halftone *psht,
- const gx_ht_order *porder, long *pid)
+ const gx_ht_order *porder, long *pid)
{
char trs[17 + MAX_FN_CHARS + 1];
int code = pdf_write_transfer(pdev, porder->transfer, "/TransferFunction",
- trs);
+ trs);
long spot_id;
stream *s;
int i = countof(ht_functions);
gs_memory_t *mem = pdev->pdf_memory;
if (code < 0)
- return code;
+ return code;
/*
* See if we can recognize the spot function, by comparing its sampled
* values against those in the order.
*/
{ gs_screen_enum senum;
- gx_ht_order order;
- int code;
-
- order = *porder;
- code = gs_screen_order_alloc(&order, mem);
- if (code < 0)
- goto notrec;
- for (i = 0; i < countof(ht_functions); ++i) {
- floatp (*spot_proc)(floatp, floatp) = ht_functions[i].proc;
- gs_point pt;
-
- gs_screen_enum_init_memory(&senum, &order, NULL, &psht->screen,
- mem);
- while ((code = gs_screen_currentpoint(&senum, &pt)) == 0 &&
- gs_screen_next(&senum, spot_proc(pt.x, pt.y)) >= 0)
- DO_NOTHING;
- if (code < 0)
- continue;
- /* Compare the bits and levels arrays. */
- if (memcmp(order.levels, porder->levels,
- order.num_levels * sizeof(*order.levels)))
- continue;
- if (memcmp(order.bit_data, porder->bit_data,
- order.num_bits * porder->procs->bit_data_elt_size))
- continue;
- /* We have a match. */
- break;
- }
- gx_ht_order_release(&order, mem, false);
+ gx_ht_order order;
+ int code;
+
+ order = *porder;
+ code = gs_screen_order_alloc(&order, mem);
+ if (code < 0)
+ goto notrec;
+ for (i = 0; i < countof(ht_functions); ++i) {
+ floatp (*spot_proc)(floatp, floatp) = ht_functions[i].proc;
+ gs_point pt;
+
+ gs_screen_enum_init_memory(&senum, &order, NULL, &psht->screen,
+ mem);
+ while ((code = gs_screen_currentpoint(&senum, &pt)) == 0 &&
+ gs_screen_next(&senum, spot_proc(pt.x, pt.y)) >= 0)
+ DO_NOTHING;
+ if (code < 0)
+ continue;
+ /* Compare the bits and levels arrays. */
+ if (memcmp(order.levels, porder->levels,
+ order.num_levels * sizeof(*order.levels)))
+ continue;
+ if (memcmp(order.bit_data, porder->bit_data,
+ order.num_bits * porder->procs->bit_data_elt_size))
+ continue;
+ /* We have a match. */
+ break;
+ }
+ gx_ht_order_release(&order, mem, false);
}
notrec:
if (i == countof(ht_functions)) {
- /* Create and write a Function for the spot function. */
- code = pdf_write_spot_function(pdev, porder, &spot_id);
- if (code < 0)
- return code;
- }
+ /* Create and write a Function for the spot function. */
+ code = pdf_write_spot_function(pdev, porder, &spot_id);
+ if (code < 0)
+ return code;
+ }
*pid = pdf_begin_separate(pdev, resourceHalftone);
s = pdev->strm;
/* Use the original, requested frequency and angle. */
pprintg2(s, "<</Type/Halftone/HalftoneType 1/Frequency %g/Angle %g",
- psht->screen.frequency, psht->screen.angle);
+ psht->screen.frequency, psht->screen.angle);
if (i < countof(ht_functions))
- pprints1(s, "/SpotFunction/%s", ht_functions[i].fname);
+ pprints1(s, "/SpotFunction/%s", ht_functions[i].fname);
else
- pprintld1(s, "/SpotFunction %ld 0 R", spot_id);
+ pprintld1(s, "/SpotFunction %ld 0 R", spot_id);
stream_puts(s, trs);
if (psht->accurate_screens)
- stream_puts(s, "/AccurateScreens true");
+ stream_puts(s, "/AccurateScreens true");
stream_puts(s, ">>\n");
return pdf_end_separate(pdev, resourceHalftone);
}
static int
pdf_write_screen_halftone(gx_device_pdf *pdev, const gs_screen_halftone *psht,
- const gx_ht_order *porder, long *pid)
+ const gx_ht_order *porder, long *pid)
{
gs_spot_halftone spot;
@@ -964,26 +963,26 @@ pdf_write_screen_halftone(gx_device_pdf *pdev, const gs_screen_halftone *psht,
}
static int
pdf_write_colorscreen_halftone(gx_device_pdf *pdev,
- const gs_colorscreen_halftone *pcsht,
- const gx_device_halftone *pdht, long *pid)
+ const gs_colorscreen_halftone *pcsht,
+ const gx_device_halftone *pdht, long *pid)
{
int i;
stream *s;
long ht_ids[4];
for (i = 0; i < pdht->num_comp ; ++i) {
- int code = pdf_write_screen_halftone(pdev, &pcsht->screens.indexed[i],
- &pdht->components[i].corder,
- &ht_ids[i]);
- if (code < 0)
- return code;
+ int code = pdf_write_screen_halftone(pdev, &pcsht->screens.indexed[i],
+ &pdht->components[i].corder,
+ &ht_ids[i]);
+ if (code < 0)
+ return code;
}
*pid = pdf_begin_separate(pdev, resourceHalftone);
s = pdev->strm;
/* Use Black, Gray as the Default unless we are in RGB colormodel */
/* (num_comp < 4) in which case we use Green (arbitrarily) */
pprintld1(s, "<</Type/Halftone/HalftoneType 5/Default %ld 0 R\n",
- pdht->num_comp > 3 ? ht_ids[3] : ht_ids[1]);
+ pdht->num_comp > 3 ? ht_ids[3] : ht_ids[1]);
pprintld2(s, "/Red %ld 0 R/Cyan %ld 0 R", ht_ids[0], ht_ids[0]);
pprintld2(s, "/Green %ld 0 R/Magenta %ld 0 R", ht_ids[1], ht_ids[1]);
pprintld2(s, "/Blue %ld 0 R/Yellow %ld 0 R", ht_ids[2], ht_ids[2]);
@@ -998,104 +997,104 @@ pdf_write_colorscreen_halftone(gx_device_pdf *pdev,
static int
pdf_write_threshold_halftone(gx_device_pdf *pdev,
- const gs_threshold_halftone *ptht,
- const gx_ht_order *porder, long *pid)
+ const gs_threshold_halftone *ptht,
+ const gx_ht_order *porder, long *pid)
{
char trs[17 + MAX_FN_CHARS + 1];
pdf_data_writer_t writer;
int code = pdf_write_transfer(pdev, porder->transfer, "",
- trs);
+ trs);
if (code < 0)
- return code;
- CHECK(pdf_begin_data(pdev, &writer));
+ return code;
+ CHECK(pdf_begin_data(pdev, &writer));
*pid = writer.pres->object->id;
CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/Type", "/Halftone"));
+ "/Type", "/Halftone"));
CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/HalftoneType", "6"));
+ "/HalftoneType", "6"));
CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Width", ptht->width));
+ "/Width", ptht->width));
CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Height", ptht->height));
+ "/Height", ptht->height));
if (*trs != 0)
- CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/TransferFunction", trs));
+ CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
+ "/TransferFunction", trs));
stream_write(writer.binary.strm, ptht->thresholds.data, ptht->thresholds.size);
return pdf_end_data(&writer);
}
static int
pdf_write_threshold2_halftone(gx_device_pdf *pdev,
- const gs_threshold2_halftone *ptht,
- const gx_ht_order *porder, long *pid)
+ const gs_threshold2_halftone *ptht,
+ const gx_ht_order *porder, long *pid)
{
char trs[17 + MAX_FN_CHARS + 1];
stream *s;
pdf_data_writer_t writer;
int code = pdf_write_transfer(pdev, porder->transfer, "/TransferFunction",
- trs);
+ trs);
if (code < 0)
- return code;
- CHECK(pdf_begin_data(pdev, &writer));
+ return code;
+ CHECK(pdf_begin_data(pdev, &writer));
*pid = writer.pres->object->id;
CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/Type", "/Halftone"));
+ "/Type", "/Halftone"));
CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/HalftoneType", "16"));
+ "/HalftoneType", "16"));
CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Width", ptht->width));
+ "/Width", ptht->width));
CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Height", ptht->height));
+ "/Height", ptht->height));
if (ptht->width2 && ptht->height2) {
- CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Width2", ptht->width2));
- CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Height2", ptht->height2));
+ CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
+ "/Width2", ptht->width2));
+ CHECK(cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
+ "/Height2", ptht->height2));
}
if (*trs != 0)
- CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
- "/TransferFunction", trs));
+ CHECK(cos_dict_put_c_strings((cos_dict_t *)writer.pres->object,
+ "/TransferFunction", trs));
s = writer.binary.strm;
if (ptht->bytes_per_sample == 2)
- stream_write(s, ptht->thresholds.data, ptht->thresholds.size);
+ stream_write(s, ptht->thresholds.data, ptht->thresholds.size);
else {
- /* Expand 1-byte to 2-byte samples. */
- int i;
+ /* Expand 1-byte to 2-byte samples. */
+ int i;
- for (i = 0; i < ptht->thresholds.size; ++i) {
- byte b = ptht->thresholds.data[i];
+ for (i = 0; i < ptht->thresholds.size; ++i) {
+ byte b = ptht->thresholds.data[i];
- stream_putc(s, b);
- stream_putc(s, b);
- }
+ stream_putc(s, b);
+ stream_putc(s, b);
+ }
}
return pdf_end_data(&writer);
}
-static int
+static int
pdf_get_halftone_component_index(const gs_multiple_halftone *pmht,
- const gx_device_halftone *pdht,
- int dht_index)
+ const gx_device_halftone *pdht,
+ int dht_index)
{
int j;
for (j = 0; j < pmht->num_comp; j++)
- if (pmht->components[j].comp_number == dht_index)
- break;
- if (j == pmht->num_comp) {
- /* Look for Default. */
- for (j = 0; j < pmht->num_comp; j++)
- if (pmht->components[j].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS)
- break;
- if (j == pmht->num_comp)
- return_error(gs_error_undefined);
+ if (pmht->components[j].comp_number == dht_index)
+ break;
+ if (j == pmht->num_comp) {
+ /* Look for Default. */
+ for (j = 0; j < pmht->num_comp; j++)
+ if (pmht->components[j].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS)
+ break;
+ if (j == pmht->num_comp)
+ return_error(gs_error_undefined);
}
return j;
}
static int
pdf_write_multiple_halftone(gx_device_pdf *pdev,
- const gs_multiple_halftone *pmht,
- const gx_device_halftone *pdht, long *pid)
+ const gs_multiple_halftone *pmht,
+ const gx_device_halftone *pdht, long *pid)
{
stream *s;
int i, code, last_comp = 0;
@@ -1104,83 +1103,83 @@ pdf_write_multiple_halftone(gx_device_pdf *pdev,
bool done_Default = false;
ids = (long *)gs_alloc_byte_array(mem, pmht->num_comp, sizeof(long),
- "pdf_write_multiple_halftone");
+ "pdf_write_multiple_halftone");
if (ids == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < pdht->num_comp; ++i) {
- const gs_halftone_component *phtc;
- const gx_ht_order *porder;
-
- code = pdf_get_halftone_component_index(pmht, pdht, i);
- if (code < 0)
- return code;
- if (pmht->components[code].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
- if (done_Default)
- continue;
- done_Default = true;
- }
- phtc = &pmht->components[code];
- porder = (pdht->components == 0 ? &pdht->order :
- &pdht->components[i].corder);
- switch (phtc->type) {
- case ht_type_spot:
- code = pdf_write_spot_halftone(pdev, &phtc->params.spot,
- porder, &ids[i]);
- break;
- case ht_type_threshold:
- code = pdf_write_threshold_halftone(pdev, &phtc->params.threshold,
- porder, &ids[i]);
- break;
- case ht_type_threshold2:
- code = pdf_write_threshold2_halftone(pdev,
- &phtc->params.threshold2,
- porder, &ids[i]);
- break;
- default:
- code = gs_note_error(gs_error_rangecheck);
- }
- if (code < 0) {
- gs_free_object(mem, ids, "pdf_write_multiple_halftone");
- return code;
- }
+ const gs_halftone_component *phtc;
+ const gx_ht_order *porder;
+
+ code = pdf_get_halftone_component_index(pmht, pdht, i);
+ if (code < 0)
+ return code;
+ if (pmht->components[code].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ if (done_Default)
+ continue;
+ done_Default = true;
+ }
+ phtc = &pmht->components[code];
+ porder = (pdht->components == 0 ? &pdht->order :
+ &pdht->components[i].corder);
+ switch (phtc->type) {
+ case ht_type_spot:
+ code = pdf_write_spot_halftone(pdev, &phtc->params.spot,
+ porder, &ids[i]);
+ break;
+ case ht_type_threshold:
+ code = pdf_write_threshold_halftone(pdev, &phtc->params.threshold,
+ porder, &ids[i]);
+ break;
+ case ht_type_threshold2:
+ code = pdf_write_threshold2_halftone(pdev,
+ &phtc->params.threshold2,
+ porder, &ids[i]);
+ break;
+ default:
+ code = gs_note_error(gs_error_rangecheck);
+ }
+ if (code < 0) {
+ gs_free_object(mem, ids, "pdf_write_multiple_halftone");
+ return code;
+ }
}
*pid = pdf_begin_separate(pdev, resourceHalftone);
s = pdev->strm;
stream_puts(s, "<</Type/Halftone/HalftoneType 5\n");
done_Default = false;
for (i = 0; i < pdht->num_comp; ++i) {
- const gs_halftone_component *phtc;
- byte *str;
- uint len;
- cos_value_t value;
-
- code = pdf_get_halftone_component_index(pmht, pdht, i);
- if (code < 0)
- return code;
- if (pmht->components[code].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
- if (done_Default)
- continue;
- done_Default = true;
- }
- phtc = &pmht->components[code];
- if ((code = pmht->get_colorname_string(pdev->memory, phtc->cname, &str, &len)) < 0 ||
+ const gs_halftone_component *phtc;
+ byte *str;
+ uint len;
+ cos_value_t value;
+
+ code = pdf_get_halftone_component_index(pmht, pdht, i);
+ if (code < 0)
+ return code;
+ if (pmht->components[code].comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ if (done_Default)
+ continue;
+ done_Default = true;
+ }
+ phtc = &pmht->components[code];
+ if ((code = pmht->get_colorname_string(pdev->memory, phtc->cname, &str, &len)) < 0 ||
(code = pdf_string_to_cos_name(pdev, str, len, &value)) < 0)
- return code;
- cos_value_write(&value, pdev);
- gs_free_string(mem, value.contents.chars.data,
- value.contents.chars.size,
- "pdf_write_multiple_halftone");
- pprintld1(s, " %ld 0 R\n", ids[i]);
- last_comp = i;
+ return code;
+ cos_value_write(&value, pdev);
+ gs_free_string(mem, value.contents.chars.data,
+ value.contents.chars.size,
+ "pdf_write_multiple_halftone");
+ pprintld1(s, " %ld 0 R\n", ids[i]);
+ last_comp = i;
}
if (!done_Default) {
- /*
- * BOGUS: Type 5 halftones must contain Default component.
- * Perhaps we have no way to obtain it,
- * because pdht contains ProcessColorModel components only.
- * We copy the last component as Default one.
- */
- pprintld1(s, " /Default %ld 0 R\n", ids[last_comp]);
+ /*
+ * BOGUS: Type 5 halftones must contain Default component.
+ * Perhaps we have no way to obtain it,
+ * because pdht contains ProcessColorModel components only.
+ * We copy the last component as Default one.
+ */
+ pprintld1(s, " /Default %ld 0 R\n", ids[last_comp]);
}
stream_puts(s, ">>\n");
gs_free_object(mem, ids, "pdf_write_multiple_halftone");
@@ -1193,7 +1192,7 @@ pdf_write_multiple_halftone(gx_device_pdf *pdev,
*/
static int
pdf_update_halftone(gx_device_pdf *pdev, const gs_imager_state *pis,
- char *hts)
+ char *hts)
{
const gs_halftone *pht = pis->halftone;
const gx_device_halftone *pdht = pis->dev_ht;
@@ -1202,35 +1201,35 @@ pdf_update_halftone(gx_device_pdf *pdev, const gs_imager_state *pis,
switch (pht->type) {
case ht_type_screen:
- code = pdf_write_screen_halftone(pdev, &pht->params.screen,
- &pdht->components[0].corder, &id);
- break;
+ code = pdf_write_screen_halftone(pdev, &pht->params.screen,
+ &pdht->components[0].corder, &id);
+ break;
case ht_type_colorscreen:
- code = pdf_write_colorscreen_halftone(pdev, &pht->params.colorscreen,
- pdht, &id);
- break;
+ code = pdf_write_colorscreen_halftone(pdev, &pht->params.colorscreen,
+ pdht, &id);
+ break;
case ht_type_spot:
- code = pdf_write_spot_halftone(pdev, &pht->params.spot,
- &pdht->components[0].corder, &id);
- break;
+ code = pdf_write_spot_halftone(pdev, &pht->params.spot,
+ &pdht->components[0].corder, &id);
+ break;
case ht_type_threshold:
- code = pdf_write_threshold_halftone(pdev, &pht->params.threshold,
- &pdht->components[0].corder, &id);
- break;
+ code = pdf_write_threshold_halftone(pdev, &pht->params.threshold,
+ &pdht->components[0].corder, &id);
+ break;
case ht_type_threshold2:
- code = pdf_write_threshold2_halftone(pdev, &pht->params.threshold2,
- &pdht->components[0].corder, &id);
- break;
+ code = pdf_write_threshold2_halftone(pdev, &pht->params.threshold2,
+ &pdht->components[0].corder, &id);
+ break;
case ht_type_multiple:
case ht_type_multiple_colorscreen:
- code = pdf_write_multiple_halftone(pdev, &pht->params.multiple,
- pdht, &id);
- break;
+ code = pdf_write_multiple_halftone(pdev, &pht->params.multiple,
+ pdht, &id);
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (code < 0)
- return code;
+ return code;
sprintf(hts, "%ld 0 R", id);
pdev->halftone_id = pis->dev_ht->id;
return code;
@@ -1251,23 +1250,23 @@ pdf_open_gstate(gx_device_pdf *pdev, pdf_resource_t **ppres)
int code;
if (*ppres)
- return 0;
+ return 0;
/*
* We write gs command only in stream context.
* If we are clipped, and the clip path is about to change,
* the old clipping must be undone before writing gs.
*/
if (pdev->context != PDF_IN_STREAM) {
- /* We apparently use gs_error_interrupt as a request to change context. */
- return gs_error_interrupt;
+ /* We apparently use gs_error_interrupt as a request to change context. */
+ return gs_error_interrupt;
}
code = pdf_alloc_resource(pdev, resourceExtGState, gs_no_id, ppres, -1L);
if (code < 0)
- return code;
+ return code;
cos_become((*ppres)->object, cos_type_dict);
code = cos_dict_put_c_key_string(resource_dict(*ppres), "/Type", (const byte *)"/ExtGState", 10);
if (code < 0)
- return code;
+ return code;
return 0;
}
@@ -1276,19 +1275,19 @@ int
pdf_end_gstate(gx_device_pdf *pdev, pdf_resource_t *pres)
{
if (pres) {
- int code = pdf_substitute_resource(pdev, &pres, resourceExtGState, NULL, true);
-
- if (code < 0)
- return code;
- pres->where_used |= pdev->used_mask;
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/ExtGState", pres);
- if (code < 0)
- return code;
- pprintld1(pdev->strm, "/R%ld gs\n", pdf_resource_id(pres));
- pres->where_used |= pdev->used_mask;
+ int code = pdf_substitute_resource(pdev, &pres, resourceExtGState, NULL, true);
+
+ if (code < 0)
+ return code;
+ pres->where_used |= pdev->used_mask;
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/ExtGState", pres);
+ if (code < 0)
+ return code;
+ pprintld1(pdev->strm, "/R%ld gs\n", pdf_resource_id(pres));
+ pres->where_used |= pdev->used_mask;
}
return 0;
}
@@ -1299,7 +1298,7 @@ pdf_end_gstate(gx_device_pdf *pdev, pdf_resource_t *pres)
*/
static int
pdf_update_transfer(gx_device_pdf *pdev, const gs_imager_state *pis,
- char *trs)
+ char *trs)
{
int i, pi = -1;
bool multiple = false, update = false;
@@ -1311,40 +1310,40 @@ pdf_update_transfer(gx_device_pdf *pdev, const gs_imager_state *pis,
tm[1] = pis->set_transfer.green;
tm[2] = pis->set_transfer.blue;
tm[3] = pis->set_transfer.gray;
- for (i = 0; i < 4; ++i)
- if (tm[i] != NULL) {
- transfer_ids[i] = tm[i]->id;
- if (pdev->transfer_ids[i] != tm[i]->id)
- update = true;
- if (pi != -1 && transfer_ids[i] != transfer_ids[pi])
- multiple = true;
- pi = i;
- } else
- transfer_ids[i] = -1;
+ for (i = 0; i < 4; ++i)
+ if (tm[i] != NULL) {
+ transfer_ids[i] = tm[i]->id;
+ if (pdev->transfer_ids[i] != tm[i]->id)
+ update = true;
+ if (pi != -1 && transfer_ids[i] != transfer_ids[pi])
+ multiple = true;
+ pi = i;
+ } else
+ transfer_ids[i] = -1;
if (update) {
- int mask;
-
- if (!multiple) {
- code = pdf_write_transfer(pdev, tm[pi], "", trs);
- if (code < 0)
- return code;
- mask = code == 0;
- } else {
- strcpy(trs, "[");
- mask = 0;
- for (i = 0; i < 4; ++i)
- if (tm[i] != NULL) {
- code = pdf_write_transfer_map(pdev,
- tm[i],
- 0, true, " ", trs + strlen(trs));
- if (code < 0)
- return code;
- mask |= (code == 0) << i;
- }
- strcat(trs, "]");
- }
- memcpy(pdev->transfer_ids, transfer_ids, sizeof(pdev->transfer_ids));
- pdev->transfer_not_identity = mask;
+ int mask;
+
+ if (!multiple) {
+ code = pdf_write_transfer(pdev, tm[pi], "", trs);
+ if (code < 0)
+ return code;
+ mask = code == 0;
+ } else {
+ strcpy(trs, "[");
+ mask = 0;
+ for (i = 0; i < 4; ++i)
+ if (tm[i] != NULL) {
+ code = pdf_write_transfer_map(pdev,
+ tm[i],
+ 0, true, " ", trs + strlen(trs));
+ if (code < 0)
+ return code;
+ mask |= (code == 0) << i;
+ }
+ strcat(trs, "]");
+ }
+ memcpy(pdev->transfer_ids, transfer_ids, sizeof(pdev->transfer_ids));
+ pdev->transfer_not_identity = mask;
}
return code;
}
@@ -1356,49 +1355,49 @@ pdf_update_transfer(gx_device_pdf *pdev, const gs_imager_state *pis,
*/
static int
pdf_update_alpha(gx_device_pdf *pdev, const gs_imager_state *pis,
- pdf_resource_t **ppres)
+ pdf_resource_t **ppres)
{
bool ais;
floatp alpha;
int code;
if (pdev->state.soft_mask_id != pis->soft_mask_id) {
- char buf[20];
-
- if (pis->soft_mask_id == 0)
- strcpy(buf, "/None");
- else
- sprintf(buf, "%ld 0 R", pis->soft_mask_id);
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_string(resource_dict(*ppres),
- "/SMask", (byte *)buf, strlen(buf));
- if (code < 0)
- return code;
- pdev->state.soft_mask_id = pis->soft_mask_id;
+ char buf[20];
+
+ if (pis->soft_mask_id == 0)
+ strcpy(buf, "/None");
+ else
+ sprintf(buf, "%ld 0 R", pis->soft_mask_id);
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_string(resource_dict(*ppres),
+ "/SMask", (byte *)buf, strlen(buf));
+ if (code < 0)
+ return code;
+ pdev->state.soft_mask_id = pis->soft_mask_id;
}
if (pdev->state.opacity.alpha != pis->opacity.alpha) {
- if (pdev->state.shape.alpha != pis->shape.alpha)
- return_error(gs_error_rangecheck);
- ais = false;
- alpha = pdev->state.opacity.alpha = pis->opacity.alpha;
+ if (pdev->state.shape.alpha != pis->shape.alpha)
+ return_error(gs_error_rangecheck);
+ ais = false;
+ alpha = pdev->state.opacity.alpha = pis->opacity.alpha;
} else if (pdev->state.shape.alpha != pis->shape.alpha) {
- ais = true;
- alpha = pdev->state.shape.alpha = pis->shape.alpha;
+ ais = true;
+ alpha = pdev->state.shape.alpha = pis->shape.alpha;
} else
- return 0;
+ return 0;
code = pdf_open_gstate(pdev, ppres);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_key_bool(resource_dict(*ppres), "/AIS", ais);
if (code < 0)
- return code;
+ return code;
/* we never do the 'both' operations (b, B, b*, B*) so we set both */
/* CA and ca the same so that we stay in sync with state.*.alpha */
code = cos_dict_put_c_key_real(resource_dict(*ppres), "/CA", alpha);
if (code < 0)
- return code;
+ return code;
return cos_dict_put_c_key_real(resource_dict(*ppres), "/ca", alpha);
}
@@ -1407,39 +1406,39 @@ pdf_update_alpha(gx_device_pdf *pdev, const gs_imager_state *pis,
*/
int
pdf_prepare_drawing(gx_device_pdf *pdev, const gs_imager_state *pis,
- pdf_resource_t **ppres)
+ pdf_resource_t **ppres)
{
int code = 0;
int bottom;
if (pdev->CompatibilityLevel >= 1.4) {
- if (pdev->state.blend_mode != pis->blend_mode) {
- static const char *const bm_names[] = { GS_BLEND_MODE_NAMES };
- char buf[20];
-
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- buf[0] = '/';
- strncpy(buf + 1, bm_names[pis->blend_mode], sizeof(buf) - 2);
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/BM", buf);
- if (code < 0)
- return code;
- pdev->state.blend_mode = pis->blend_mode;
- }
- code = pdf_update_alpha(pdev, pis, ppres);
- if (code < 0)
- return code;
+ if (pdev->state.blend_mode != pis->blend_mode) {
+ static const char *const bm_names[] = { GS_BLEND_MODE_NAMES };
+ char buf[20];
+
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ buf[0] = '/';
+ strncpy(buf + 1, bm_names[pis->blend_mode], sizeof(buf) - 2);
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/BM", buf);
+ if (code < 0)
+ return code;
+ pdev->state.blend_mode = pis->blend_mode;
+ }
+ code = pdf_update_alpha(pdev, pis, ppres);
+ if (code < 0)
+ return code;
} else {
- /*
- * If the graphics state calls for any transparency functions,
- * we can't represent them, so return a rangecheck.
- */
- if (pis->opacity.alpha != 1 ||
- pis->shape.alpha != 1 ||
- pis->transparency_stack != 0
- )
- return_error(gs_error_rangecheck);
+ /*
+ * If the graphics state calls for any transparency functions,
+ * we can't represent them, so return a rangecheck.
+ */
+ if (pis->opacity.alpha != 1 ||
+ pis->shape.alpha != 1 ||
+ pis->transparency_stack != 0
+ )
+ return_error(gs_error_rangecheck);
}
/*
* We originally thought the remaining items were only needed for
@@ -1451,120 +1450,120 @@ pdf_prepare_drawing(gx_device_pdf *pdev, const gs_imager_state *pis,
* knockout.
*/
bottom = (pdev->ResourcesBeforeUsage ? 1 : 0);
- /* When ResourcesBeforeUsage != 0, one sbstack element
+ /* When ResourcesBeforeUsage != 0, one sbstack element
appears from the page contents stream. */
if (pdev->sbstack_depth == bottom) {
- gs_int_point phase, dev_phase;
- char hts[5 + MAX_FN_CHARS + 1],
- trs[5 + MAX_FN_CHARS * 4 + 6 + 1],
- bgs[5 + MAX_FN_CHARS + 1],
- ucrs[6 + MAX_FN_CHARS + 1];
-
- hts[0] = trs[0] = bgs[0] = ucrs[0] = 0;
- if (pdev->params.PreserveHalftoneInfo &&
- pdev->halftone_id != pis->dev_ht->id &&
- !pdev->PDFX
- ) {
- code = pdf_update_halftone(pdev, pis, hts);
- if (code < 0)
- return code;
- }
- if (pdev->params.TransferFunctionInfo == tfi_Preserve &&
- !pdev->PDFX && !pdev->PDFA
- ) {
- code = pdf_update_transfer(pdev, pis, trs);
- if (code < 0)
- return code;
- }
- if (pdev->params.UCRandBGInfo == ucrbg_Preserve) {
- if (pdev->black_generation_id != pis->black_generation->id) {
- code = pdf_write_transfer_map(pdev, pis->black_generation,
- 0, false, "", bgs);
- if (code < 0)
- return code;
- pdev->black_generation_id = pis->black_generation->id;
- }
- if (pdev->undercolor_removal_id != pis->undercolor_removal->id) {
- code = pdf_write_transfer_map(pdev, pis->undercolor_removal,
- -1, false, "", ucrs);
- if (code < 0)
- return code;
- pdev->undercolor_removal_id = pis->undercolor_removal->id;
- }
- }
- if (hts[0] || trs[0] || bgs[0] || ucrs[0]) {
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- }
- if (hts[0]) {
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/HT", hts);
- if (code < 0)
- return code;
- }
- if (trs[0]) {
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/TR", trs);
- if (code < 0)
- return code;
- }
- if (bgs[0]) {
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/BG", bgs);
- if (code < 0)
- return code;
- }
- if (ucrs[0]) {
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/UCR", ucrs);
- if (code < 0)
- return code;
- }
- if (!pdev->PDFX) {
- gs_currentscreenphase_pis(pis, &phase, 0);
- gs_currentscreenphase_pis(&pdev->state, &dev_phase, 0);
- if (dev_phase.x != phase.x || dev_phase.y != phase.y) {
- char buf[sizeof(int) * 3 + 5];
-
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- sprintf(buf, "[%d %d]", phase.x, phase.y);
- code = cos_dict_put_string_copy(resource_dict(*ppres), "/HTP", buf);
- if (code < 0)
- return code;
- gx_imager_setscreenphase(&pdev->state, phase.x, phase.y,
- gs_color_select_all);
- }
- }
+ gs_int_point phase, dev_phase;
+ char hts[5 + MAX_FN_CHARS + 1],
+ trs[5 + MAX_FN_CHARS * 4 + 6 + 1],
+ bgs[5 + MAX_FN_CHARS + 1],
+ ucrs[6 + MAX_FN_CHARS + 1];
+
+ hts[0] = trs[0] = bgs[0] = ucrs[0] = 0;
+ if (pdev->params.PreserveHalftoneInfo &&
+ pdev->halftone_id != pis->dev_ht->id &&
+ !pdev->PDFX
+ ) {
+ code = pdf_update_halftone(pdev, pis, hts);
+ if (code < 0)
+ return code;
+ }
+ if (pdev->params.TransferFunctionInfo == tfi_Preserve &&
+ !pdev->PDFX && !pdev->PDFA
+ ) {
+ code = pdf_update_transfer(pdev, pis, trs);
+ if (code < 0)
+ return code;
+ }
+ if (pdev->params.UCRandBGInfo == ucrbg_Preserve) {
+ if (pdev->black_generation_id != pis->black_generation->id) {
+ code = pdf_write_transfer_map(pdev, pis->black_generation,
+ 0, false, "", bgs);
+ if (code < 0)
+ return code;
+ pdev->black_generation_id = pis->black_generation->id;
+ }
+ if (pdev->undercolor_removal_id != pis->undercolor_removal->id) {
+ code = pdf_write_transfer_map(pdev, pis->undercolor_removal,
+ -1, false, "", ucrs);
+ if (code < 0)
+ return code;
+ pdev->undercolor_removal_id = pis->undercolor_removal->id;
+ }
+ }
+ if (hts[0] || trs[0] || bgs[0] || ucrs[0]) {
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ }
+ if (hts[0]) {
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/HT", hts);
+ if (code < 0)
+ return code;
+ }
+ if (trs[0]) {
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/TR", trs);
+ if (code < 0)
+ return code;
+ }
+ if (bgs[0]) {
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/BG", bgs);
+ if (code < 0)
+ return code;
+ }
+ if (ucrs[0]) {
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/UCR", ucrs);
+ if (code < 0)
+ return code;
+ }
+ if (!pdev->PDFX) {
+ gs_currentscreenphase_pis(pis, &phase, 0);
+ gs_currentscreenphase_pis(&pdev->state, &dev_phase, 0);
+ if (dev_phase.x != phase.x || dev_phase.y != phase.y) {
+ char buf[sizeof(int) * 3 + 5];
+
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ sprintf(buf, "[%d %d]", phase.x, phase.y);
+ code = cos_dict_put_string_copy(resource_dict(*ppres), "/HTP", buf);
+ if (code < 0)
+ return code;
+ gx_imager_setscreenphase(&pdev->state, phase.x, phase.y,
+ gs_color_select_all);
+ }
+ }
}
if (pdev->CompatibilityLevel >= 1.3 && pdev->sbstack_depth == bottom) {
- if (pdev->overprint_mode != pdev->params.OPM) {
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_int(resource_dict(*ppres), "/OPM", pdev->params.OPM);
- if (code < 0)
- return code;
- pdev->overprint_mode = pdev->params.OPM;
- }
- if (pdev->state.smoothness != pis->smoothness) {
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_real(resource_dict(*ppres), "/SM", pis->smoothness);
- if (code < 0)
- return code;
- pdev->state.smoothness = pis->smoothness;
- }
- if (pdev->CompatibilityLevel >= 1.4) {
- if (pdev->state.text_knockout != pis->text_knockout) {
- code = pdf_open_gstate(pdev, ppres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_bool(resource_dict(*ppres), "/TK", pis->text_knockout);
- if (code < 0)
- return code;
- pdev->state.text_knockout = pis->text_knockout;
- }
- }
+ if (pdev->overprint_mode != pdev->params.OPM) {
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_int(resource_dict(*ppres), "/OPM", pdev->params.OPM);
+ if (code < 0)
+ return code;
+ pdev->overprint_mode = pdev->params.OPM;
+ }
+ if (pdev->state.smoothness != pis->smoothness) {
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_real(resource_dict(*ppres), "/SM", pis->smoothness);
+ if (code < 0)
+ return code;
+ pdev->state.smoothness = pis->smoothness;
+ }
+ if (pdev->CompatibilityLevel >= 1.4) {
+ if (pdev->state.text_knockout != pis->text_knockout) {
+ code = pdf_open_gstate(pdev, ppres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_bool(resource_dict(*ppres), "/TK", pis->text_knockout);
+ if (code < 0)
+ return code;
+ pdev->state.text_knockout = pis->text_knockout;
+ }
+ }
}
return code;
}
@@ -1577,27 +1576,27 @@ pdf_try_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis)
int code = pdf_prepare_drawing(pdev, pis, &pres);
if (code < 0)
- return code;
+ return code;
/* Update overprint. */
if (pdev->params.PreserveOverprintSettings &&
- (pdev->fill_overprint != pis->overprint ||
- pdev->font3) && !pdev->skip_colors
- ) {
- code = pdf_open_gstate(pdev, &pres);
- if (code < 0)
- return code;
- /* PDF 1.2 only has a single overprint setting. */
- if (pdev->CompatibilityLevel < 1.3) {
- code = cos_dict_put_c_key_bool(resource_dict(pres), "/OP", pis->overprint);
- if (code < 0)
- return code;
- pdev->stroke_overprint = pis->overprint;
- } else {
- code = cos_dict_put_c_key_bool(resource_dict(pres), "/op", pis->overprint);
- if (code < 0)
- return code;
- }
- pdev->fill_overprint = pis->overprint;
+ (pdev->fill_overprint != pis->overprint ||
+ pdev->font3) && !pdev->skip_colors
+ ) {
+ code = pdf_open_gstate(pdev, &pres);
+ if (code < 0)
+ return code;
+ /* PDF 1.2 only has a single overprint setting. */
+ if (pdev->CompatibilityLevel < 1.3) {
+ code = cos_dict_put_c_key_bool(resource_dict(pres), "/OP", pis->overprint);
+ if (code < 0)
+ return code;
+ pdev->stroke_overprint = pis->overprint;
+ } else {
+ code = cos_dict_put_c_key_bool(resource_dict(pres), "/op", pis->overprint);
+ if (code < 0)
+ return code;
+ }
+ pdev->fill_overprint = pis->overprint;
}
return pdf_end_gstate(pdev, pres);
}
@@ -1607,12 +1606,12 @@ pdf_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis)
int code;
if (pdev->context != PDF_IN_STREAM) {
- code = pdf_try_prepare_fill(pdev, pis);
- if (code != gs_error_interrupt) /* See pdf_open_gstate */
- return code;
- code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ code = pdf_try_prepare_fill(pdev, pis);
+ if (code != gs_error_interrupt) /* See pdf_open_gstate */
+ return code;
+ code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
}
return pdf_try_prepare_fill(pdev, pis);
}
@@ -1625,37 +1624,37 @@ pdf_try_prepare_stroke(gx_device_pdf *pdev, const gs_imager_state *pis)
int code = pdf_prepare_drawing(pdev, pis, &pres);
if (code < 0)
- return code;
+ return code;
/* Update overprint, stroke adjustment. */
if (pdev->params.PreserveOverprintSettings &&
- pdev->stroke_overprint != pis->overprint &&
- !pdev->skip_colors
- ) {
- code = pdf_open_gstate(pdev, &pres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_bool(resource_dict(pres), "/OP", pis->overprint);
- if (code < 0)
- return code;
- pdev->stroke_overprint = pis->overprint;
- if (pdev->CompatibilityLevel < 1.3) {
- /* PDF 1.2 only has a single overprint setting. */
- pdev->fill_overprint = pis->overprint;
- } else {
- /* According to PDF>=1.3 spec, OP also sets op,
- if there is no /op in same garphic state object.
- We don't write /op, so monitor the viewer's state here : */
- pdev->fill_overprint = pis->overprint;
- }
+ pdev->stroke_overprint != pis->overprint &&
+ !pdev->skip_colors
+ ) {
+ code = pdf_open_gstate(pdev, &pres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_bool(resource_dict(pres), "/OP", pis->overprint);
+ if (code < 0)
+ return code;
+ pdev->stroke_overprint = pis->overprint;
+ if (pdev->CompatibilityLevel < 1.3) {
+ /* PDF 1.2 only has a single overprint setting. */
+ pdev->fill_overprint = pis->overprint;
+ } else {
+ /* According to PDF>=1.3 spec, OP also sets op,
+ if there is no /op in same garphic state object.
+ We don't write /op, so monitor the viewer's state here : */
+ pdev->fill_overprint = pis->overprint;
+ }
}
if (pdev->state.stroke_adjust != pis->stroke_adjust) {
- code = pdf_open_gstate(pdev, &pres);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_bool(resource_dict(pres), "/SA", pis->stroke_adjust);
- if (code < 0)
- return code;
- pdev->state.stroke_adjust = pis->stroke_adjust;
+ code = pdf_open_gstate(pdev, &pres);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_bool(resource_dict(pres), "/SA", pis->stroke_adjust);
+ if (code < 0)
+ return code;
+ pdev->state.stroke_adjust = pis->stroke_adjust;
}
return pdf_end_gstate(pdev, pres);
}
@@ -1665,12 +1664,12 @@ pdf_prepare_stroke(gx_device_pdf *pdev, const gs_imager_state *pis)
int code;
if (pdev->context != PDF_IN_STREAM) {
- code = pdf_try_prepare_stroke(pdev, pis);
- if (code != gs_error_interrupt) /* See pdf_open_gstate */
- return code;
- code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ code = pdf_try_prepare_stroke(pdev, pis);
+ if (code != gs_error_interrupt) /* See pdf_open_gstate */
+ return code;
+ code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
}
return pdf_try_prepare_stroke(pdev, pis);
}
@@ -1689,14 +1688,13 @@ pdf_prepare_image(gx_device_pdf *pdev, const gs_imager_state *pis)
/* Update the graphics state for an ImageType 1 mask. */
int
pdf_prepare_imagemask(gx_device_pdf *pdev, const gs_imager_state *pis,
- const gx_drawing_color *pdcolor)
+ const gx_drawing_color *pdcolor)
{
int code = pdf_prepare_image(pdev, pis);
if (code < 0)
- return code;
+ return code;
return pdf_set_drawing_color(pdev, pis, pdcolor, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands);
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands);
}
-
diff --git a/gs/base/gdevpdfg.h b/gs/base/gdevpdfg.h
index 984b8b2a7..e66f5fc87 100644
--- a/gs/base/gdevpdfg.h
+++ b/gs/base/gdevpdfg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -88,26 +88,26 @@ int pdf_cspace_init_Device(gs_memory_t *mem, gs_color_space **ppcs, int num_comp
* to the ranges in *ppranges, otherwise set *ppranges to 0.
*/
int pdf_color_space_named(gx_device_pdf *pdev, cos_value_t *pvalue,
- const gs_range_t **ppranges,
- const gs_color_space *pcs,
- const pdf_color_space_names_t *pcsn,
- bool by_name, const byte *res_name, int name_length);
+ const gs_range_t **ppranges,
+ const gs_color_space *pcs,
+ const pdf_color_space_names_t *pcsn,
+ bool by_name, const byte *res_name, int name_length);
/* Create colored and uncolored Pattern color spaces. */
int pdf_cs_Pattern_colored(gx_device_pdf *pdev, cos_value_t *pvalue);
int pdf_cs_Pattern_uncolored(gx_device_pdf *pdev, cos_value_t *pvalue);
-int pdf_cs_Pattern_uncolored_hl(gx_device_pdf *pdev,
- const gs_color_space *pcs, cos_value_t *pvalue);
+int pdf_cs_Pattern_uncolored_hl(gx_device_pdf *pdev,
+ const gs_color_space *pcs, cos_value_t *pvalue);
/* Set the ProcSets bits corresponding to an image color space. */
void pdf_color_space_procsets(gx_device_pdf *pdev,
- const gs_color_space *pcs);
+ const gs_color_space *pcs);
/* ---------------- Exported by gdevpdfg.c ---------------- */
/* Copy viewer state from images state. */
-void pdf_viewer_state_from_imager_state(gx_device_pdf * pdev,
- const gs_imager_state *pis, const gx_device_color *pdevc);
+void pdf_viewer_state_from_imager_state(gx_device_pdf * pdev,
+ const gs_imager_state *pis, const gx_device_color *pdevc);
/* Prepare intitial values for viewer's graphics state parameters. */
void pdf_prepare_initial_viewer_state(gx_device_pdf * pdev, const gs_imager_state *pis);
@@ -117,24 +117,24 @@ void pdf_reset_graphics(gx_device_pdf *pdev);
/* Set initial color. */
void pdf_set_initial_color(gx_device_pdf * pdev, gx_hl_saved_color *saved_fill_color,
- gx_hl_saved_color *saved_stroke_color,
- bool *fill_used_process_color, bool *stroke_used_process_color);
+ gx_hl_saved_color *saved_stroke_color,
+ bool *fill_used_process_color, bool *stroke_used_process_color);
/* Set the fill or stroke color. */
-int pdf_reset_color(gx_device_pdf * pdev, const gs_imager_state * pis,
- const gx_drawing_color *pdc, gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc);
+int pdf_reset_color(gx_device_pdf * pdev, const gs_imager_state * pis,
+ const gx_drawing_color *pdc, gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc);
/* pdecolor is &pdev->fill_color or &pdev->stroke_color. */
int pdf_set_pure_color(gx_device_pdf * pdev, gx_color_index color,
- gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc);
+ gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc);
int pdf_set_drawing_color(gx_device_pdf * pdev, const gs_imager_state * pis,
- const gx_drawing_color *pdc,
- gx_hl_saved_color * psc,
- bool *used_process_color,
- const psdf_set_color_commands_t *ppscc);
+ const gx_drawing_color *pdc,
+ gx_hl_saved_color * psc,
+ bool *used_process_color,
+ const psdf_set_color_commands_t *ppscc);
/*
* Bring the graphics state up to date for a drawing operation.
* (Text uses either fill or stroke.)
@@ -145,7 +145,7 @@ int pdf_prepare_fill(gx_device_pdf *pdev, const gs_imager_state *pis);
int pdf_prepare_stroke(gx_device_pdf *pdev, const gs_imager_state *pis);
int pdf_prepare_image(gx_device_pdf *pdev, const gs_imager_state *pis);
int pdf_prepare_imagemask(gx_device_pdf *pdev, const gs_imager_state *pis,
- const gx_drawing_color *pdcolor);
+ const gx_drawing_color *pdcolor);
int pdf_save_viewer_state(gx_device_pdf *pdev, stream *s);
int pdf_restore_viewer_state(gx_device_pdf *pdev, stream *s);
int pdf_end_gstate(gx_device_pdf *pdev, pdf_resource_t *pres);
@@ -153,8 +153,8 @@ int pdf_end_gstate(gx_device_pdf *pdev, pdf_resource_t *pres);
/*
* Convert a string into cos name.
*/
-int pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
- cos_value_t *pvalue);
+int pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
+ cos_value_t *pvalue);
/* ---------------- Exported by gdevpdfi.c ---------------- */
@@ -199,15 +199,15 @@ extern const pdf_image_names_t pdf_image_names_full, pdf_image_names_short;
/* pdev is used only for updating procsets. */
/* pcsvalue is not used for masks. */
int pdf_put_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
- const gs_pixel_image_t *pic,
- const pdf_image_names_t *pin,
- const cos_value_t *pcsvalue);
+ const gs_pixel_image_t *pic,
+ const pdf_image_names_t *pin,
+ const cos_value_t *pcsvalue);
/* Store filters for an image. */
/* Currently this only saves parameters for CCITTFaxDecode. */
int pdf_put_image_filters(cos_dict_t *pcd, gx_device_pdf *pdev,
- const psdf_binary_writer * pbw,
- const pdf_image_names_t *pin);
+ const psdf_binary_writer * pbw,
+ const pdf_image_names_t *pin);
/* ------ Image writing ------ */
@@ -217,17 +217,17 @@ int pdf_put_image_filters(cos_dict_t *pcd, gx_device_pdf *pdev,
* data_h is the actual number of data rows, which may be less than h.
*/
void pdf_make_bitmap_matrix(gs_matrix * pmat, int x, int y, int w, int h,
- int h_actual);
+ int h_actual);
/* Put out the gsave and matrix for an image. */
void pdf_put_image_matrix(gx_device_pdf * pdev, const gs_matrix * pmat,
- floatp y_scale);
+ floatp y_scale);
/* Put out a reference to an image resource. */
int pdf_do_image_by_id(gx_device_pdf * pdev, double scale,
- const gs_matrix * pimat, bool in_contents, gs_id id);
+ const gs_matrix * pimat, bool in_contents, gs_id id);
int pdf_do_image(gx_device_pdf * pdev, const pdf_resource_t * pres,
- const gs_matrix * pimat, bool in_contents);
+ const gs_matrix * pimat, bool in_contents);
#define pdf_image_writer_num_alt_streams 4
@@ -258,31 +258,31 @@ void pdf_image_writer_init(pdf_image_writer * piw);
* by a NI pdfmark.
*/
int pdf_begin_write_image(gx_device_pdf * pdev, pdf_image_writer * piw,
- gx_bitmap_id id, int w, int h,
- cos_dict_t *pnamed, bool in_line);
+ gx_bitmap_id id, int w, int h,
+ cos_dict_t *pnamed, bool in_line);
/* Begin writing the image data, setting up the dictionary and filters. */
int pdf_begin_image_data(gx_device_pdf * pdev, pdf_image_writer * piw,
- const gs_pixel_image_t * pim,
- const cos_value_t *pcsvalue,
- int alt_writer_index);
+ const gs_pixel_image_t * pim,
+ const cos_value_t *pcsvalue,
+ int alt_writer_index);
/* Copy the data for a mask or monobit bitmap. */
int pdf_copy_mask_bits(stream *s, const byte *base, int sourcex,
- int raster, int w, int h, byte invert);
+ int raster, int w, int h, byte invert);
/* Copy the data for a colored image (device pixels). */
int pdf_copy_color_bits(stream *s, const byte *base, int sourcex,
- int raster, int w, int h, int bytes_per_pixel);
+ int raster, int w, int h, int bytes_per_pixel);
/* Complete image data. */
int
pdf_complete_image_data(gx_device_pdf *pdev, pdf_image_writer *piw, int data_h,
- int width, int bits_per_pixel);
+ int width, int bits_per_pixel);
/* Finish writing the binary image data. */
int pdf_end_image_binary(gx_device_pdf *pdev, pdf_image_writer *piw,
- int data_h);
+ int data_h);
/*
* Finish writing an image. If in-line, write the BI/dict/ID/data/EI and
@@ -295,8 +295,8 @@ int pdf_end_write_image(gx_device_pdf * pdev, pdf_image_writer * piw);
*/
int pdf_make_alt_stream(gx_device_pdf * pdev, psdf_binary_writer * piw);
-/*
- * End binary with choosing image compression.
+/*
+ * End binary with choosing image compression.
*/
int pdf_choose_compression(pdf_image_writer * piw, bool end_binary);
@@ -306,34 +306,34 @@ int pdf_register_charproc_resource(gx_device_pdf *pdev, gs_id id, pdf_resource_t
/* ---------------- Exported by gdevpdfv.c ---------------- */
/* Store pattern 1 parameters to cos dictionary. */
-int pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
- gs_pattern1_instance_t *pinst);
+int pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
+ gs_pattern1_instance_t *pinst);
/* Write a colored Pattern color. */
int pdf_put_colored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const gs_color_space *pcs,
- const psdf_set_color_commands_t *ppscc,
- bool have_pattern_streams, pdf_resource_t **ppres);
+ const gs_color_space *pcs,
+ const psdf_set_color_commands_t *ppscc,
+ bool have_pattern_streams, pdf_resource_t **ppres);
/* Write an uncolored Pattern color. */
int pdf_put_uncolored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const gs_color_space *pcs,
- const psdf_set_color_commands_t *ppscc,
- bool have_pattern_streams, pdf_resource_t **ppres);
+ const gs_color_space *pcs,
+ const psdf_set_color_commands_t *ppscc,
+ bool have_pattern_streams, pdf_resource_t **ppres);
/* Write a PatternType 2 (shading pattern) color. */
int pdf_put_pattern2(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const psdf_set_color_commands_t *ppscc,
- pdf_resource_t **ppres);
+ const psdf_set_color_commands_t *ppscc,
+ pdf_resource_t **ppres);
/* ---------------- Exported by gdevpdfb.c ---------------- */
/* Copy a color bitmap. for_pattern = -1 means put the image in-line, */
/* 1 means put the image in a resource. */
int pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gs_image_t *pim, pdf_image_writer *piw,
- int for_pattern);
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gs_image_t *pim, pdf_image_writer *piw,
+ int for_pattern);
#endif /* gdevpdfg_INCLUDED */
@@ -342,4 +342,3 @@ int pdf_copy_color_data(gx_device_pdf * pdev, const byte * base, int sourcex,
/* Write metadata */
int pdf_document_metadata(gx_device_pdf *pdev);
int pdf_get_docinfo_item(gx_device_pdf *pdev, const char *key, char *buf, int buf_length);
-
diff --git a/gs/base/gdevpdfi.c b/gs/base/gdevpdfi.c
index 3b2d87b85..a2a68aad8 100644
--- a/gs/base/gdevpdfi.c
+++ b/gs/base/gdevpdfi.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -79,16 +79,16 @@ gs_private_st_composite(st_pdf_image_enum, pdf_image_enum, "pdf_image_enum",
/* GC procedures */
static ENUM_PTRS_WITH(pdf_image_enum_enum_ptrs, pdf_image_enum *pie)
if (index < pdf_image_writer_max_ptrs) {
- gs_ptr_type_t ret =
- ENUM_USING(st_pdf_image_writer, &pie->writer, sizeof(pie->writer),
- index);
+ gs_ptr_type_t ret =
+ ENUM_USING(st_pdf_image_writer, &pie->writer, sizeof(pie->writer),
+ index);
- if (ret == 0) /* don't stop early */
- ENUM_RETURN(0);
- return ret;
+ if (ret == 0) /* don't stop early */
+ ENUM_RETURN(0);
+ return ret;
}
return ENUM_USING_PREFIX(st_gx_image_enum_common,
- pdf_image_writer_max_ptrs);
+ pdf_image_writer_max_ptrs);
ENUM_PTRS_END
static RELOC_PTRS_WITH(pdf_image_enum_reloc_ptrs, pdf_image_enum *pie)
{
@@ -119,150 +119,150 @@ static int
color_is_black_or_white(gx_device *dev, const gx_drawing_color *pdcolor)
{
return (!color_is_pure(pdcolor) ? -1 :
- gx_dc_pure_color(pdcolor) == gx_device_black(dev) ? 0 :
- gx_dc_pure_color(pdcolor) == gx_device_white(dev) ? 1 : -1);
+ gx_dc_pure_color(pdcolor) == gx_device_black(dev) ? 0 :
+ gx_dc_pure_color(pdcolor) == gx_device_white(dev) ? 1 : -1);
}
static int
pdf_convert_image4_to_image1(gx_device_pdf *pdev,
- const gs_imager_state *pis,
- const gx_drawing_color *pbcolor,
- const gs_image4_t *pim4, gs_image_t *pim1,
- gx_drawing_color *pdcolor)
+ const gs_imager_state *pis,
+ const gx_drawing_color *pbcolor,
+ const gs_image4_t *pim4, gs_image_t *pim1,
+ gx_drawing_color *pdcolor)
{
- if (pim4->BitsPerComponent == 1 &&
- pim4->ColorSpace->type->num_components == gx_num_components_1 &&
- (pim4->MaskColor_is_range ?
- pim4->MaskColor[0] | pim4->MaskColor[1] :
- pim4->MaskColor[0]) <= 1
- ) {
- gx_device *const dev = (gx_device *)pdev;
- const gs_color_space *pcs = pim4->ColorSpace;
- bool write_1s = !pim4->MaskColor[0];
- gs_client_color cc;
- int code;
-
- /*
- * Prepare the drawing color. (pdf_prepare_imagemask will set it.)
- * This is the other color in the image (the one that isn't the
- * mask key), taking Decode into account.
- */
-
- cc.paint.values[0] = pim4->Decode[(int)write_1s];
- cc.pattern = 0;
- code = pcs->type->remap_color(&cc, pcs, pdcolor, pis, dev,
- gs_color_select_texture);
- if (code < 0)
- return code;
-
- /*
- * The PDF imaging model doesn't support RasterOp. We can convert a
- * Type 4 image to a Type 1 imagemask only if the effective RasterOp
- * passes through the source color unchanged. "Effective" means we
- * take into account CombineWithColor, and whether the source and/or
- * texture are black, white, or neither.
- */
- {
- gs_logical_operation_t lop = pis->log_op;
- int black_or_white = color_is_black_or_white(dev, pdcolor);
-
- switch (black_or_white) {
- case 0: lop = lop_know_S_0(lop); break;
- case 1: lop = lop_know_S_1(lop); break;
- default: DO_NOTHING;
- }
- if (pim4->CombineWithColor)
- switch (color_is_black_or_white(dev, pbcolor)) {
- case 0: lop = lop_know_T_0(lop); break;
- case 1: lop = lop_know_T_1(lop); break;
- default: DO_NOTHING;
- }
- else
- lop = lop_know_T_0(lop);
- switch (lop_rop(lop)) {
- case rop3_0:
- if (black_or_white != 0)
- return -1;
- break;
- case rop3_1:
- if (black_or_white != 1)
- return -1;
- break;
- case rop3_S:
- break;
- default:
- return -1;
- }
- if ((lop & lop_S_transparent) && black_or_white == 1)
- return -1;
- }
-
- /* All conditions are met. Convert to a masked image. */
-
- gs_image_t_init_mask_adjust(pim1, write_1s, false);
+ if (pim4->BitsPerComponent == 1 &&
+ pim4->ColorSpace->type->num_components == gx_num_components_1 &&
+ (pim4->MaskColor_is_range ?
+ pim4->MaskColor[0] | pim4->MaskColor[1] :
+ pim4->MaskColor[0]) <= 1
+ ) {
+ gx_device *const dev = (gx_device *)pdev;
+ const gs_color_space *pcs = pim4->ColorSpace;
+ bool write_1s = !pim4->MaskColor[0];
+ gs_client_color cc;
+ int code;
+
+ /*
+ * Prepare the drawing color. (pdf_prepare_imagemask will set it.)
+ * This is the other color in the image (the one that isn't the
+ * mask key), taking Decode into account.
+ */
+
+ cc.paint.values[0] = pim4->Decode[(int)write_1s];
+ cc.pattern = 0;
+ code = pcs->type->remap_color(&cc, pcs, pdcolor, pis, dev,
+ gs_color_select_texture);
+ if (code < 0)
+ return code;
+
+ /*
+ * The PDF imaging model doesn't support RasterOp. We can convert a
+ * Type 4 image to a Type 1 imagemask only if the effective RasterOp
+ * passes through the source color unchanged. "Effective" means we
+ * take into account CombineWithColor, and whether the source and/or
+ * texture are black, white, or neither.
+ */
+ {
+ gs_logical_operation_t lop = pis->log_op;
+ int black_or_white = color_is_black_or_white(dev, pdcolor);
+
+ switch (black_or_white) {
+ case 0: lop = lop_know_S_0(lop); break;
+ case 1: lop = lop_know_S_1(lop); break;
+ default: DO_NOTHING;
+ }
+ if (pim4->CombineWithColor)
+ switch (color_is_black_or_white(dev, pbcolor)) {
+ case 0: lop = lop_know_T_0(lop); break;
+ case 1: lop = lop_know_T_1(lop); break;
+ default: DO_NOTHING;
+ }
+ else
+ lop = lop_know_T_0(lop);
+ switch (lop_rop(lop)) {
+ case rop3_0:
+ if (black_or_white != 0)
+ return -1;
+ break;
+ case rop3_1:
+ if (black_or_white != 1)
+ return -1;
+ break;
+ case rop3_S:
+ break;
+ default:
+ return -1;
+ }
+ if ((lop & lop_S_transparent) && black_or_white == 1)
+ return -1;
+ }
+
+ /* All conditions are met. Convert to a masked image. */
+
+ gs_image_t_init_mask_adjust(pim1, write_1s, false);
#define COPY_ELEMENT(e) pim1->e = pim4->e
- COPY_ELEMENT(ImageMatrix);
- COPY_ELEMENT(Width);
- COPY_ELEMENT(Height);
- pim1->BitsPerComponent = 1;
- /* not Decode */
- COPY_ELEMENT(Interpolate);
- pim1->format = gs_image_format_chunky; /* BPC = 1, doesn't matter */
+ COPY_ELEMENT(ImageMatrix);
+ COPY_ELEMENT(Width);
+ COPY_ELEMENT(Height);
+ pim1->BitsPerComponent = 1;
+ /* not Decode */
+ COPY_ELEMENT(Interpolate);
+ pim1->format = gs_image_format_chunky; /* BPC = 1, doesn't matter */
#undef COPY_ELEMENT
- return 0;
+ return 0;
}
return -1; /* arbitrary <0 */
}
static int
-pdf_begin_image_data_decoded(gx_device_pdf *pdev, int num_components, const gs_range_t *pranges, int i,
- gs_pixel_image_t *pi, cos_value_t *cs_value, pdf_image_enum *pie)
+pdf_begin_image_data_decoded(gx_device_pdf *pdev, int num_components, const gs_range_t *pranges, int i,
+ gs_pixel_image_t *pi, cos_value_t *cs_value, pdf_image_enum *pie)
{
if (pranges) {
- /* Rescale the Decode values for the image data. */
- const gs_range_t *pr = pranges;
- float *decode = pi->Decode;
- int j;
-
- for (j = 0; j < num_components; ++j, ++pr, decode += 2) {
- double vmin = decode[0], vmax = decode[1];
- double base = pr->rmin, factor = pr->rmax - base;
-
- decode[1] = (vmax - vmin) / factor + (vmin - base);
- decode[0] = vmin - base;
- }
+ /* Rescale the Decode values for the image data. */
+ const gs_range_t *pr = pranges;
+ float *decode = pi->Decode;
+ int j;
+
+ for (j = 0; j < num_components; ++j, ++pr, decode += 2) {
+ double vmin = decode[0], vmax = decode[1];
+ double base = pr->rmin, factor = pr->rmax - base;
+
+ decode[1] = (vmax - vmin) / factor + (vmin - base);
+ decode[0] = vmin - base;
+ }
}
return pdf_begin_image_data(pdev, &pie->writer, pi, cs_value, i);
}
static int
-make_device_color_space(gx_device_pdf *pdev,
- gs_color_space_index output_cspace_index,
- gs_color_space **ppcs)
+make_device_color_space(gx_device_pdf *pdev,
+ gs_color_space_index output_cspace_index,
+ gs_color_space **ppcs)
{
gs_color_space *cs;
gs_memory_t *mem = pdev->v_memory;
switch (output_cspace_index) {
- case gs_color_space_index_DeviceGray:
- cs = gs_cspace_new_DeviceGray(mem);
- break;
- case gs_color_space_index_DeviceRGB:
- cs = gs_cspace_new_DeviceRGB(mem);
- break;
- case gs_color_space_index_DeviceCMYK:
- cs = gs_cspace_new_DeviceCMYK(mem);
- break;
- default:
- /* Notify the user and terminate.
- Don't emit rangecheck becuause it would fall back
- to a default implementation (rasterisation).
- */
- emprintf(mem, "Unsupported ProcessColorModel");
- return_error(gs_error_undefined);
+ case gs_color_space_index_DeviceGray:
+ cs = gs_cspace_new_DeviceGray(mem);
+ break;
+ case gs_color_space_index_DeviceRGB:
+ cs = gs_cspace_new_DeviceRGB(mem);
+ break;
+ case gs_color_space_index_DeviceCMYK:
+ cs = gs_cspace_new_DeviceCMYK(mem);
+ break;
+ default:
+ /* Notify the user and terminate.
+ Don't emit rangecheck becuause it would fall back
+ to a default implementation (rasterisation).
+ */
+ emprintf(mem, "Unsupported ProcessColorModel");
+ return_error(gs_error_undefined);
}
if (cs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
*ppcs = cs;
return 0;
}
@@ -271,10 +271,10 @@ static bool
check_image_color_space(gs_pixel_image_t * pim, gs_color_space_index index)
{
if (pim->ColorSpace->type->index == index)
- return true;
+ return true;
if (pim->ColorSpace->type->index == gs_color_space_index_Indexed)
- if (pim->ColorSpace->base_space->type->index == index)
- return true;
+ if (pim->ColorSpace->base_space->type->index == index)
+ return true;
return false;
}
@@ -311,12 +311,12 @@ static int pdf_begin_typed_image(gx_device_pdf *pdev,
static int
pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo,
- pdf_typed_image_context_t context,
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo,
+ pdf_typed_image_context_t context,
image_union_t *image)
{
cos_dict_t *pnamed = 0;
@@ -342,10 +342,10 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
* stack in sync, even if it turns out we can't handle the image.
*/
{
- cos_value_t ni_value;
+ cos_value_t ni_value;
- if (cos_array_unadd(pdev->NI_stack, &ni_value) >= 0)
- pnamed = (cos_dict_t *)ni_value.contents.object;
+ if (cos_array_unadd(pdev->NI_stack, &ni_value) >= 0)
+ pnamed = (cos_dict_t *)ni_value.contents.object;
}
/* An initialization for pdf_end_and_do_image :
@@ -356,364 +356,364 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
/* Check for the image types we can handle. */
switch (pic->type->index) {
case 1: {
- const gs_image_t *pim1 = (const gs_image_t *)pic;
-
- if (pim1->Alpha != gs_image_alpha_none)
- goto nyi;
- is_mask = pim1->ImageMask;
- if (is_mask) {
- /* If parameters are invalid, use the default implementation. */
- if (!(gx_dc_is_pattern1_color(pdcolor)))
- if (pim1->BitsPerComponent != 1 ||
- !((pim1->Decode[0] == 0.0 && pim1->Decode[1] == 1.0) ||
- (pim1->Decode[0] == 1.0 && pim1->Decode[1] == 0.0))
- )
- goto nyi;
- }
+ const gs_image_t *pim1 = (const gs_image_t *)pic;
+
+ if (pim1->Alpha != gs_image_alpha_none)
+ goto nyi;
+ is_mask = pim1->ImageMask;
+ if (is_mask) {
+ /* If parameters are invalid, use the default implementation. */
+ if (!(gx_dc_is_pattern1_color(pdcolor)))
+ if (pim1->BitsPerComponent != 1 ||
+ !((pim1->Decode[0] == 0.0 && pim1->Decode[1] == 1.0) ||
+ (pim1->Decode[0] == 1.0 && pim1->Decode[1] == 0.0))
+ )
+ goto nyi;
+ }
/* If image is not type 3X and we can write in-line then make it so */
- in_line = context == PDF_IMAGE_DEFAULT &&
- can_write_image_in_line(pdev, pim1);
+ in_line = context == PDF_IMAGE_DEFAULT &&
+ can_write_image_in_line(pdev, pim1);
- image[0].type1 = *pim1;
- break;
+ image[0].type1 = *pim1;
+ break;
}
case 3: {
- const gs_image3_t *pim3 = (const gs_image3_t *)pic;
- gs_image3_t pim3a;
- const gs_image_common_t *pic1 = pic;
- gs_matrix m, mi;
- const gs_matrix *pmat1 = pmat;
-
- pdev->image_mask_is_SMask = false;
- if (pdev->CompatibilityLevel < 1.2)
- goto nyi;
- if (prect && !(prect->p.x == 0 && prect->p.y == 0 &&
- prect->q.x == pim3->Width &&
- prect->q.y == pim3->Height))
- goto nyi;
- if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
- if (pdf_must_put_clip_path(pdev, pcpath))
- code = pdf_unclip(pdev);
- else
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- code = pdf_put_clip_path(pdev, pcpath);
- if (code < 0)
- return code;
- gs_make_identity(&m);
- pmat1 = &m;
- m.tx = floor(pis->ctm.tx + 0.5); /* Round the origin against the image size distorsions */
- m.ty = floor(pis->ctm.ty + 0.5);
- pim3a = *pim3;
- gs_matrix_invert(&pim3a.ImageMatrix, &mi);
- gs_make_identity(&pim3a.ImageMatrix);
- if (pim3a.Width < pim3a.MaskDict.Width && pim3a.Width > 0) {
- int sx = (pim3a.MaskDict.Width + pim3a.Width - 1) / pim3a.Width;
-
- gs_matrix_scale(&mi, 1.0 / sx, 1, &mi);
- gs_matrix_scale(&pim3a.ImageMatrix, 1.0 / sx, 1, &pim3a.ImageMatrix);
- }
- if (pim3a.Height < pim3a.MaskDict.Height && pim3a.Height > 0) {
- int sy = (pim3a.MaskDict.Height + pim3a.Height - 1) / pim3a.Height;
-
- gs_matrix_scale(&mi, 1, 1.0 / sy, &mi);
- gs_matrix_scale(&pim3a.ImageMatrix, 1, 1.0 / sy, &pim3a.ImageMatrix);
- }
- gs_matrix_multiply(&mi, &pim3a.MaskDict.ImageMatrix, &pim3a.MaskDict.ImageMatrix);
- pic1 = (gs_image_common_t *)&pim3a;
- /* Setting pdev->converting_image_matrix to communicate with pdf_image3_make_mcde. */
- gs_matrix_multiply(&mi, &ctm_only(pis), &pdev->converting_image_matrix);
- }
- /*
- * We handle ImageType 3 images in a completely different way:
- * the default implementation sets up the enumerator.
- */
- return gx_begin_image3_generic((gx_device *)pdev, pis, pmat1, pic1,
- prect, pdcolor, pcpath, mem,
- pdf_image3_make_mid,
- pdf_image3_make_mcde, pinfo);
+ const gs_image3_t *pim3 = (const gs_image3_t *)pic;
+ gs_image3_t pim3a;
+ const gs_image_common_t *pic1 = pic;
+ gs_matrix m, mi;
+ const gs_matrix *pmat1 = pmat;
+
+ pdev->image_mask_is_SMask = false;
+ if (pdev->CompatibilityLevel < 1.2)
+ goto nyi;
+ if (prect && !(prect->p.x == 0 && prect->p.y == 0 &&
+ prect->q.x == pim3->Width &&
+ prect->q.y == pim3->Height))
+ goto nyi;
+ if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
+ if (pdf_must_put_clip_path(pdev, pcpath))
+ code = pdf_unclip(pdev);
+ else
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ code = pdf_put_clip_path(pdev, pcpath);
+ if (code < 0)
+ return code;
+ gs_make_identity(&m);
+ pmat1 = &m;
+ m.tx = floor(pis->ctm.tx + 0.5); /* Round the origin against the image size distorsions */
+ m.ty = floor(pis->ctm.ty + 0.5);
+ pim3a = *pim3;
+ gs_matrix_invert(&pim3a.ImageMatrix, &mi);
+ gs_make_identity(&pim3a.ImageMatrix);
+ if (pim3a.Width < pim3a.MaskDict.Width && pim3a.Width > 0) {
+ int sx = (pim3a.MaskDict.Width + pim3a.Width - 1) / pim3a.Width;
+
+ gs_matrix_scale(&mi, 1.0 / sx, 1, &mi);
+ gs_matrix_scale(&pim3a.ImageMatrix, 1.0 / sx, 1, &pim3a.ImageMatrix);
+ }
+ if (pim3a.Height < pim3a.MaskDict.Height && pim3a.Height > 0) {
+ int sy = (pim3a.MaskDict.Height + pim3a.Height - 1) / pim3a.Height;
+
+ gs_matrix_scale(&mi, 1, 1.0 / sy, &mi);
+ gs_matrix_scale(&pim3a.ImageMatrix, 1, 1.0 / sy, &pim3a.ImageMatrix);
+ }
+ gs_matrix_multiply(&mi, &pim3a.MaskDict.ImageMatrix, &pim3a.MaskDict.ImageMatrix);
+ pic1 = (gs_image_common_t *)&pim3a;
+ /* Setting pdev->converting_image_matrix to communicate with pdf_image3_make_mcde. */
+ gs_matrix_multiply(&mi, &ctm_only(pis), &pdev->converting_image_matrix);
+ }
+ /*
+ * We handle ImageType 3 images in a completely different way:
+ * the default implementation sets up the enumerator.
+ */
+ return gx_begin_image3_generic((gx_device *)pdev, pis, pmat1, pic1,
+ prect, pdcolor, pcpath, mem,
+ pdf_image3_make_mid,
+ pdf_image3_make_mcde, pinfo);
}
case IMAGE3X_IMAGETYPE: {
- /* See ImageType3 above for more information. */
- const gs_image3x_t *pim3x = (const gs_image3x_t *)pic;
-
- if (pdev->CompatibilityLevel < 1.4)
- goto nyi;
- if (prect && !(prect->p.x == 0 && prect->p.y == 0 &&
- prect->q.x == pim3x->Width &&
- prect->q.y == pim3x->Height))
- goto nyi;
- pdev->image_mask_is_SMask = true;
- return gx_begin_image3x_generic((gx_device *)pdev, pis, pmat, pic,
- prect, pdcolor, pcpath, mem,
- pdf_image3x_make_mid,
- pdf_image3x_make_mcde, pinfo);
+ /* See ImageType3 above for more information. */
+ const gs_image3x_t *pim3x = (const gs_image3x_t *)pic;
+
+ if (pdev->CompatibilityLevel < 1.4)
+ goto nyi;
+ if (prect && !(prect->p.x == 0 && prect->p.y == 0 &&
+ prect->q.x == pim3x->Width &&
+ prect->q.y == pim3x->Height))
+ goto nyi;
+ pdev->image_mask_is_SMask = true;
+ return gx_begin_image3x_generic((gx_device *)pdev, pis, pmat, pic,
+ prect, pdcolor, pcpath, mem,
+ pdf_image3x_make_mid,
+ pdf_image3x_make_mcde, pinfo);
}
case 4: {
- /* Try to convert the image to a plain masked image. */
- gx_drawing_color icolor;
-
- pdev->image_mask_is_SMask = false;
- if (pdf_convert_image4_to_image1(pdev, pis, pdcolor,
- (const gs_image4_t *)pic,
- &image[0].type1, &icolor) >= 0) {
- gs_state *pgs = (gs_state *)gx_hld_get_gstate_ptr(pis);
-
- if (pgs == NULL)
- return_error(gs_error_unregistered); /* Must not happen. */
-
- /* Undo the pop of the NI stack if necessary. */
- if (pnamed)
- cos_array_add_object(pdev->NI_stack, COS_OBJECT(pnamed));
- /* HACK: temporary patch the color space, to allow
- pdf_prepare_imagemask to write the right color for the imagemask. */
- code = gs_gsave(pgs);
- if (code < 0)
- return code;
- /* {csrc}: const cast warning */
- code = gs_setcolorspace(pgs, ((const gs_image4_t *)pic)->ColorSpace);
- if (code < 0)
- return code;
- code = pdf_begin_typed_image(pdev, pis, pmat,
- (gs_image_common_t *)&image[0].type1,
- prect, &icolor, pcpath, mem,
- pinfo, context);
- if (code < 0)
- return code;
- return gs_grestore(pgs);
- }
- /* No luck. Masked images require PDF 1.3 or higher. */
- if (pdev->CompatibilityLevel < 1.2)
- goto nyi;
- if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
- gs_matrix m, m1, mi;
- gs_image4_t pi4 = *(const gs_image4_t *)pic;
-
- if (pdf_must_put_clip_path(pdev, pcpath))
- code = pdf_unclip(pdev);
- else
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- code = pdf_put_clip_path(pdev, pcpath);
- if (code < 0)
- return code;
- gs_make_identity(&m1);
- gs_matrix_invert(&pic->ImageMatrix, &mi);
- gs_matrix_multiply(&mi, &ctm_only(pis), &m);
- code = pdf_setup_masked_image_converter(pdev, mem, &m, &cvd,
- true, 0, 0, pi4.Width, pi4.Height, false);
- if (code < 0)
- return code;
- cvd->mdev.is_open = true; /* fixme: same as above. */
- cvd->mask->is_open = true; /* fixme: same as above. */
- cvd->mask_is_empty = false;
- code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
- 0, 0, cvd->mask->width, cvd->mask->height, (gx_color_index)0);
- if (code < 0)
- return code;
- gx_device_retain((gx_device *)cvd, true);
- gx_device_retain((gx_device *)cvd->mask, true);
- gs_make_identity(&pi4.ImageMatrix);
- code = gx_default_begin_typed_image((gx_device *)cvd,
- pis, &m1, (gs_image_common_t *)&pi4, prect, pdcolor, NULL, mem, pinfo);
- if (code < 0)
- return code;
- (*pinfo)->procs = &pdf_image_cvd_enum_procs;
- return 0;
- }
- image[0].type4 = *(const gs_image4_t *)pic;
- break;
+ /* Try to convert the image to a plain masked image. */
+ gx_drawing_color icolor;
+
+ pdev->image_mask_is_SMask = false;
+ if (pdf_convert_image4_to_image1(pdev, pis, pdcolor,
+ (const gs_image4_t *)pic,
+ &image[0].type1, &icolor) >= 0) {
+ gs_state *pgs = (gs_state *)gx_hld_get_gstate_ptr(pis);
+
+ if (pgs == NULL)
+ return_error(gs_error_unregistered); /* Must not happen. */
+
+ /* Undo the pop of the NI stack if necessary. */
+ if (pnamed)
+ cos_array_add_object(pdev->NI_stack, COS_OBJECT(pnamed));
+ /* HACK: temporary patch the color space, to allow
+ pdf_prepare_imagemask to write the right color for the imagemask. */
+ code = gs_gsave(pgs);
+ if (code < 0)
+ return code;
+ /* {csrc}: const cast warning */
+ code = gs_setcolorspace(pgs, ((const gs_image4_t *)pic)->ColorSpace);
+ if (code < 0)
+ return code;
+ code = pdf_begin_typed_image(pdev, pis, pmat,
+ (gs_image_common_t *)&image[0].type1,
+ prect, &icolor, pcpath, mem,
+ pinfo, context);
+ if (code < 0)
+ return code;
+ return gs_grestore(pgs);
+ }
+ /* No luck. Masked images require PDF 1.3 or higher. */
+ if (pdev->CompatibilityLevel < 1.2)
+ goto nyi;
+ if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
+ gs_matrix m, m1, mi;
+ gs_image4_t pi4 = *(const gs_image4_t *)pic;
+
+ if (pdf_must_put_clip_path(pdev, pcpath))
+ code = pdf_unclip(pdev);
+ else
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ code = pdf_put_clip_path(pdev, pcpath);
+ if (code < 0)
+ return code;
+ gs_make_identity(&m1);
+ gs_matrix_invert(&pic->ImageMatrix, &mi);
+ gs_matrix_multiply(&mi, &ctm_only(pis), &m);
+ code = pdf_setup_masked_image_converter(pdev, mem, &m, &cvd,
+ true, 0, 0, pi4.Width, pi4.Height, false);
+ if (code < 0)
+ return code;
+ cvd->mdev.is_open = true; /* fixme: same as above. */
+ cvd->mask->is_open = true; /* fixme: same as above. */
+ cvd->mask_is_empty = false;
+ code = (*dev_proc(cvd->mask, fill_rectangle))((gx_device *)cvd->mask,
+ 0, 0, cvd->mask->width, cvd->mask->height, (gx_color_index)0);
+ if (code < 0)
+ return code;
+ gx_device_retain((gx_device *)cvd, true);
+ gx_device_retain((gx_device *)cvd->mask, true);
+ gs_make_identity(&pi4.ImageMatrix);
+ code = gx_default_begin_typed_image((gx_device *)cvd,
+ pis, &m1, (gs_image_common_t *)&pi4, prect, pdcolor, NULL, mem, pinfo);
+ if (code < 0)
+ return code;
+ (*pinfo)->procs = &pdf_image_cvd_enum_procs;
+ return 0;
+ }
+ image[0].type4 = *(const gs_image4_t *)pic;
+ break;
}
default:
- goto nyi;
+ goto nyi;
}
pim = (const gs_pixel_image_t *)pic;
format = pim->format;
switch (format) {
case gs_image_format_chunky:
case gs_image_format_component_planar:
- break;
+ break;
default:
- goto nyi;
+ goto nyi;
}
/* AR5 on Windows doesn't support 0-size images. Skipping. */
if (pim->Width == 0 || pim->Height == 0)
- goto nyi;
+ goto nyi;
/* PDF doesn't support images with more than 8 bits per component. */
if (pim->BitsPerComponent > 8)
- goto nyi;
+ goto nyi;
pcs = pim->ColorSpace;
num_components = (is_mask ? 1 : gs_color_space_num_components(pcs));
if (pdf_must_put_clip_path(pdev, pcpath))
- code = pdf_unclip(pdev);
- else
- code = pdf_open_page(pdev, PDF_IN_STREAM);
+ code = pdf_unclip(pdev);
+ else
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
if (context == PDF_IMAGE_TYPE3_MASK) {
- /*
- * The soft mask for an ImageType 3x image uses a DevicePixel
- * color space, which pdf_color_space() can't handle. Patch it
- * to DeviceGray here.
- */
- /* {csrc} make sure this gets freed */
- pcs = gs_cspace_new_DeviceGray(pdev->memory);
+ /*
+ * The soft mask for an ImageType 3x image uses a DevicePixel
+ * color space, which pdf_color_space() can't handle. Patch it
+ * to DeviceGray here.
+ */
+ /* {csrc} make sure this gets freed */
+ pcs = gs_cspace_new_DeviceGray(pdev->memory);
} else if (is_mask)
- code = pdf_prepare_imagemask(pdev, pis, pdcolor);
+ code = pdf_prepare_imagemask(pdev, pis, pdcolor);
else
- code = pdf_prepare_image(pdev, pis);
+ code = pdf_prepare_image(pdev, pis);
if (code < 0)
- goto nyi;
+ goto nyi;
if (prect)
- rect = *prect;
+ rect = *prect;
else {
- rect.p.x = rect.p.y = 0;
- rect.q.x = pim->Width, rect.q.y = pim->Height;
+ rect.p.x = rect.p.y = 0;
+ rect.q.x = pim->Width, rect.q.y = pim->Height;
}
pie = gs_alloc_struct(mem, pdf_image_enum, &st_pdf_image_enum,
- "pdf_begin_image");
+ "pdf_begin_image");
if (pie == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pie, 0, sizeof(*pie)); /* cleanup entirely for GC to work in all cases. */
*pinfo = (gx_image_enum_common_t *) pie;
gx_image_enum_common_init(*pinfo, (const gs_data_image_t *) pim,
- ((pdev->CompatibilityLevel >= 1.3) ?
- (context == PDF_IMAGE_TYPE3_MASK ?
- &pdf_image_object_enum_procs :
- &pdf_image_enum_procs) :
- context == PDF_IMAGE_TYPE3_MASK ?
- &pdf_image_object_enum_procs :
- context == PDF_IMAGE_TYPE3_DATA ?
- &pdf_image_object_enum_procs2 :
- &pdf_image_enum_procs),
- (gx_device *)pdev, num_components, format);
+ ((pdev->CompatibilityLevel >= 1.3) ?
+ (context == PDF_IMAGE_TYPE3_MASK ?
+ &pdf_image_object_enum_procs :
+ &pdf_image_enum_procs) :
+ context == PDF_IMAGE_TYPE3_MASK ?
+ &pdf_image_object_enum_procs :
+ context == PDF_IMAGE_TYPE3_DATA ?
+ &pdf_image_object_enum_procs2 :
+ &pdf_image_enum_procs),
+ (gx_device *)pdev, num_components, format);
pie->memory = mem;
width = rect.q.x - rect.p.x;
pie->width = width;
height = rect.q.y - rect.p.y;
pie->bits_per_pixel =
- pim->BitsPerComponent * num_components / pie->num_planes;
+ pim->BitsPerComponent * num_components / pie->num_planes;
pie->rows_left = height;
if (pnamed != 0) /* Don't in-line the image if it is named. */
- in_line = false;
+ in_line = false;
else {
double nbytes = (double)(((ulong) pie->width * pie->bits_per_pixel + 7) >> 3) *
- pie->num_planes * pie->rows_left;
-
- in_line &= (nbytes < pdev->MaxInlineImageSize);
+ pie->num_planes * pie->rows_left;
+
+ in_line &= (nbytes < pdev->MaxInlineImageSize);
}
if (rect.p.x != 0 || rect.p.y != 0 ||
- rect.q.x != pim->Width || rect.q.y != pim->Height ||
- (is_mask && pim->CombineWithColor)
- /* Color space setup used to be done here: see SRZB comment below. */
- ) {
- gs_free_object(mem, pie, "pdf_begin_image");
- goto nyi;
+ rect.q.x != pim->Width || rect.q.y != pim->Height ||
+ (is_mask && pim->CombineWithColor)
+ /* Color space setup used to be done here: see SRZB comment below. */
+ ) {
+ gs_free_object(mem, pie, "pdf_begin_image");
+ goto nyi;
}
if (pmat == 0)
- pmat = &ctm_only(pis);
+ pmat = &ctm_only(pis);
{
- gs_matrix mat;
- gs_matrix bmat;
- int code;
-
- pdf_make_bitmap_matrix(&bmat, -rect.p.x, -rect.p.y,
- pim->Width, pim->Height, height);
- if ((code = gs_matrix_invert(&pim->ImageMatrix, &mat)) < 0 ||
- (code = gs_matrix_multiply(&bmat, &mat, &mat)) < 0 ||
- (code = gs_matrix_multiply(&mat, pmat, &pie->mat)) < 0
- ) {
- gs_free_object(mem, pie, "pdf_begin_image");
- return code;
- }
- /* AR3,AR4 show no image when CTM is singular; AR5 reports an error */
- if (pie->mat.xx * pie->mat.yy == pie->mat.xy * pie->mat.yx) {
- gs_free_object(mem, pie, "pdf_begin_image");
- goto nyi;
- }
+ gs_matrix mat;
+ gs_matrix bmat;
+ int code;
+
+ pdf_make_bitmap_matrix(&bmat, -rect.p.x, -rect.p.y,
+ pim->Width, pim->Height, height);
+ if ((code = gs_matrix_invert(&pim->ImageMatrix, &mat)) < 0 ||
+ (code = gs_matrix_multiply(&bmat, &mat, &mat)) < 0 ||
+ (code = gs_matrix_multiply(&mat, pmat, &pie->mat)) < 0
+ ) {
+ gs_free_object(mem, pie, "pdf_begin_image");
+ return code;
+ }
+ /* AR3,AR4 show no image when CTM is singular; AR5 reports an error */
+ if (pie->mat.xx * pie->mat.yy == pie->mat.xy * pie->mat.yx) {
+ gs_free_object(mem, pie, "pdf_begin_image");
+ goto nyi;
+ }
}
code = pdf_put_clip_path(pdev, pcpath);
if (code < 0)
- return code;
+ return code;
pdf_image_writer_init(&pie->writer);
- pie->writer.alt_writer_count = (in_line ||
- (pim->Width <= 64 && pim->Height <= 64) ||
- pdev->transfer_not_identity ? 1 : 2);
+ pie->writer.alt_writer_count = (in_line ||
+ (pim->Width <= 64 && pim->Height <= 64) ||
+ pdev->transfer_not_identity ? 1 : 2);
if (image[0].pixel.ColorSpace != NULL &&
- image[0].pixel.ColorSpace->type->index == gs_color_space_index_Indexed
- && pdev->params.ColorImage.DownsampleType != ds_Subsample)
- pie->writer.alt_writer_count = 1;
+ image[0].pixel.ColorSpace->type->index == gs_color_space_index_Indexed
+ && pdev->params.ColorImage.DownsampleType != ds_Subsample)
+ pie->writer.alt_writer_count = 1;
image[1] = image[0];
names = (in_line ? &pdf_color_space_names_short : &pdf_color_space_names);
if (!is_mask) {
if (psdf_is_converting_image_to_RGB((gx_device_psdf *)pdev, pis, pim)) {
- /* psdf_setup_image_filters may change the color space
- * (in case of pdev->params.ConvertCMYKImagesToRGB == true).
- * Account it here.
- */
- cos_c_string_value(&cs_value, names->DeviceRGB);
+ /* psdf_setup_image_filters may change the color space
+ * (in case of pdev->params.ConvertCMYKImagesToRGB == true).
+ * Account it here.
+ */
+ cos_c_string_value(&cs_value, names->DeviceRGB);
} else {
- code = pdf_color_space_named(pdev, &cs_value, &pranges,
- pcs,
- names, in_line, NULL, 0);
- if (code < 0)
- convert_to_process_colors = true;
+ code = pdf_color_space_named(pdev, &cs_value, &pranges,
+ pcs,
+ names, in_line, NULL, 0);
+ if (code < 0)
+ convert_to_process_colors = true;
}
}
- if (image[0].pixel.ColorSpace != NULL && !(context == PDF_IMAGE_TYPE3_MASK)) {
- /* Not an imagemask. Also not a SMask, we carefully made a Gray space
- * for SMasks above, do not destroy it now!
- */
- if ((pdev->params.ColorConversionStrategy == ccs_Gray &&
- !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray)) ||
- (pdev->params.ColorConversionStrategy == ccs_sRGB &&
- !psdf_is_converting_image_to_RGB((const gx_device_psdf *)pdev, pis, &image[0].pixel) &&
- !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray) &&
- !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceRGB)) ||
- (pdev->params.ColorConversionStrategy == ccs_CMYK &&
- !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray) &&
- !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceCMYK))) {
- /* fixme : as a rudiment of old code,
- the case psdf_is_converting_image_to_RGB
- is handled with the 'cmyk_to_rgb' branch
- in psdf_setup_image_filters. */
- if ((pdev->params.ColorConversionStrategy == ccs_CMYK &&
- strcmp(pdev->color_info.cm_name, "DeviceCMYK")) ||
- (pdev->params.ColorConversionStrategy == ccs_sRGB &&
- strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
- (pdev->params.ColorConversionStrategy == ccs_Gray &&
- strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
- emprintf(pdev->memory, "ColorConversionStrategy isn't "
+ if (image[0].pixel.ColorSpace != NULL && !(context == PDF_IMAGE_TYPE3_MASK)) {
+ /* Not an imagemask. Also not a SMask, we carefully made a Gray space
+ * for SMasks above, do not destroy it now!
+ */
+ if ((pdev->params.ColorConversionStrategy == ccs_Gray &&
+ !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray)) ||
+ (pdev->params.ColorConversionStrategy == ccs_sRGB &&
+ !psdf_is_converting_image_to_RGB((const gx_device_psdf *)pdev, pis, &image[0].pixel) &&
+ !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray) &&
+ !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceRGB)) ||
+ (pdev->params.ColorConversionStrategy == ccs_CMYK &&
+ !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceGray) &&
+ !check_image_color_space(&image[0].pixel, gs_color_space_index_DeviceCMYK))) {
+ /* fixme : as a rudiment of old code,
+ the case psdf_is_converting_image_to_RGB
+ is handled with the 'cmyk_to_rgb' branch
+ in psdf_setup_image_filters. */
+ if ((pdev->params.ColorConversionStrategy == ccs_CMYK &&
+ strcmp(pdev->color_info.cm_name, "DeviceCMYK")) ||
+ (pdev->params.ColorConversionStrategy == ccs_sRGB &&
+ strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
+ (pdev->params.ColorConversionStrategy == ccs_Gray &&
+ strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
+ emprintf(pdev->memory, "ColorConversionStrategy isn't "
"compatible to ProcessColorModel.");
- return_error(gs_error_rangecheck);
- }
- convert_to_process_colors = true;
- }
+ return_error(gs_error_rangecheck);
+ }
+ convert_to_process_colors = true;
+ }
}
if (convert_to_process_colors) {
const char *sname;
- switch (pdev->pcm_color_info_index) {
- case gs_color_space_index_DeviceGray: sname = names->DeviceGray; break;
- case gs_color_space_index_DeviceRGB: sname = names->DeviceRGB; break;
- case gs_color_space_index_DeviceCMYK: sname = names->DeviceCMYK; break;
- default:
- emprintf(pdev->memory, "Unsupported ProcessColorModel.");
- return_error(gs_error_undefined);
- }
- cos_c_string_value(&cs_value, sname);
- pcs_orig = image[0].pixel.ColorSpace;
- code = make_device_color_space(pdev, pdev->pcm_color_info_index, &pcs_device);
- if (code < 0)
- goto fail;
- image[0].pixel.ColorSpace = pcs_device;
+ switch (pdev->pcm_color_info_index) {
+ case gs_color_space_index_DeviceGray: sname = names->DeviceGray; break;
+ case gs_color_space_index_DeviceRGB: sname = names->DeviceRGB; break;
+ case gs_color_space_index_DeviceCMYK: sname = names->DeviceCMYK; break;
+ default:
+ emprintf(pdev->memory, "Unsupported ProcessColorModel.");
+ return_error(gs_error_undefined);
+ }
+ cos_c_string_value(&cs_value, sname);
+ pcs_orig = image[0].pixel.ColorSpace;
+ code = make_device_color_space(pdev, pdev->pcm_color_info_index, &pcs_device);
+ if (code < 0)
+ goto fail;
+ image[0].pixel.ColorSpace = pcs_device;
}
pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
-
+
/* This is rather hacky. the gs_image_pixel_t union has copies of the image
* information, including the ColorSpace, but it does not increment the
* reference counts of the counted objects (teh ColorSpace) when it makes
@@ -728,38 +728,38 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
*/
rc_increment_cs(image[0].pixel.ColorSpace);
if ((pdf_begin_write_image(pdev, &pie->writer, gs_no_id, width,
- height, pnamed, in_line)) < 0 ||
- /*
- * Some regrettable PostScript code (such as LanguageLevel 1 output
- * from Microsoft's PSCRIPT.DLL driver) misuses the transfer
- * function to accomplish the equivalent of indexed color.
- * Downsampling (well, only averaging) or JPEG compression are not
- * compatible with this. Play it safe by using only lossless
- * filters if the transfer function(s) is/are other than the
- * identity.
- */
- ((pie->writer.alt_writer_count == 1 ?
- psdf_setup_lossless_filters((gx_device_psdf *) pdev,
- &pie->writer.binary[0],
- &image[0].pixel, in_line) :
- psdf_setup_image_filters((gx_device_psdf *) pdev,
- &pie->writer.binary[0], &image[0].pixel,
- pmat, pis, true, in_line))) < 0
- ) {
- if (image[0].pixel.ColorSpace == pim->ColorSpace)
- rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
- goto fail;
+ height, pnamed, in_line)) < 0 ||
+ /*
+ * Some regrettable PostScript code (such as LanguageLevel 1 output
+ * from Microsoft's PSCRIPT.DLL driver) misuses the transfer
+ * function to accomplish the equivalent of indexed color.
+ * Downsampling (well, only averaging) or JPEG compression are not
+ * compatible with this. Play it safe by using only lossless
+ * filters if the transfer function(s) is/are other than the
+ * identity.
+ */
+ ((pie->writer.alt_writer_count == 1 ?
+ psdf_setup_lossless_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary[0],
+ &image[0].pixel, in_line) :
+ psdf_setup_image_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary[0], &image[0].pixel,
+ pmat, pis, true, in_line))) < 0
+ ) {
+ if (image[0].pixel.ColorSpace == pim->ColorSpace)
+ rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
+ goto fail;
}
if (image[0].pixel.ColorSpace == pim->ColorSpace)
rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
if (convert_to_process_colors) {
- image[0].pixel.ColorSpace = pcs_orig;
- code = psdf_setup_image_colors_filter(&pie->writer.binary[0],
- (gx_device_psdf *)pdev, &image[0].pixel, pis);
- if (code < 0)
- goto fail;
- image[0].pixel.ColorSpace = pcs_device;
+ image[0].pixel.ColorSpace = pcs_orig;
+ code = psdf_setup_image_colors_filter(&pie->writer.binary[0],
+ (gx_device_psdf *)pdev, &image[0].pixel, pis);
+ if (code < 0)
+ goto fail;
+ image[0].pixel.ColorSpace = pcs_device;
}
/* See the comment above about reference counting of the colour space */
@@ -768,81 +768,81 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
code = pdf_make_alt_stream(pdev, &pie->writer.binary[1]);
if (code)
goto fail;
- if (convert_to_process_colors)
- image[1].pixel.ColorSpace = pcs_device;
- code = psdf_setup_image_filters((gx_device_psdf *) pdev,
- &pie->writer.binary[1], &image[1].pixel,
- pmat, pis, false, in_line);
- if (code == gs_error_rangecheck) {
- /* setup_image_compression rejected the alternative compression. */
- pie->writer.alt_writer_count = 1;
- memset(pie->writer.binary + 1, 0, sizeof(pie->writer.binary[1]));
- memset(pie->writer.binary + 2, 0, sizeof(pie->writer.binary[1]));
- } else if (code) {
- if (image[1].pixel.ColorSpace == pim->ColorSpace)
- rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
- goto fail;
- }
- else if (convert_to_process_colors) {
- image[1].pixel.ColorSpace = pcs_orig;
- code = psdf_setup_image_colors_filter(&pie->writer.binary[1],
- (gx_device_psdf *)pdev, &image[1].pixel, pis);
- if (code < 0) {
- if (image[1].pixel.ColorSpace == pim->ColorSpace)
- rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
- goto fail;
- }
- image[1].pixel.ColorSpace = pcs_device;
- }
+ if (convert_to_process_colors)
+ image[1].pixel.ColorSpace = pcs_device;
+ code = psdf_setup_image_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary[1], &image[1].pixel,
+ pmat, pis, false, in_line);
+ if (code == gs_error_rangecheck) {
+ /* setup_image_compression rejected the alternative compression. */
+ pie->writer.alt_writer_count = 1;
+ memset(pie->writer.binary + 1, 0, sizeof(pie->writer.binary[1]));
+ memset(pie->writer.binary + 2, 0, sizeof(pie->writer.binary[1]));
+ } else if (code) {
+ if (image[1].pixel.ColorSpace == pim->ColorSpace)
+ rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
+ goto fail;
+ }
+ else if (convert_to_process_colors) {
+ image[1].pixel.ColorSpace = pcs_orig;
+ code = psdf_setup_image_colors_filter(&pie->writer.binary[1],
+ (gx_device_psdf *)pdev, &image[1].pixel, pis);
+ if (code < 0) {
+ if (image[1].pixel.ColorSpace == pim->ColorSpace)
+ rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
+ goto fail;
+ }
+ image[1].pixel.ColorSpace = pcs_device;
+ }
}
if (image[1].pixel.ColorSpace == pim->ColorSpace)
rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
for (i = 0; i < pie->writer.alt_writer_count; i++) {
- code = pdf_begin_image_data_decoded(pdev, num_components, pranges, i,
- &image[i].pixel, &cs_value, pie);
- if (code < 0)
- goto fail;
+ code = pdf_begin_image_data_decoded(pdev, num_components, pranges, i,
+ &image[i].pixel, &cs_value, pie);
+ if (code < 0)
+ goto fail;
}
if (pie->writer.alt_writer_count == 2) {
- psdf_setup_compression_chooser(&pie->writer.binary[2],
- (gx_device_psdf *)pdev, pim->Width, pim->Height,
- num_components, pim->BitsPerComponent);
- pie->writer.alt_writer_count = 3;
+ psdf_setup_compression_chooser(&pie->writer.binary[2],
+ (gx_device_psdf *)pdev, pim->Width, pim->Height,
+ num_components, pim->BitsPerComponent);
+ pie->writer.alt_writer_count = 3;
}
if (pic->type->index == 4 && pdev->CompatibilityLevel < 1.3) {
- int i;
-
- /* Create a stream for writing the mask. */
- i = pie->writer.alt_writer_count;
- gs_image_t_init_mask_adjust((gs_image_t *)&image[i].type1, true, false);
- image[i].type1.Width = image[0].pixel.Width;
- image[i].type1.Height = image[0].pixel.Height;
- /* Won't use image[2]. */
- code = pdf_begin_write_image(pdev, &pie->writer, gs_no_id, width,
- height, NULL, false);
+ int i;
+
+ /* Create a stream for writing the mask. */
+ i = pie->writer.alt_writer_count;
+ gs_image_t_init_mask_adjust((gs_image_t *)&image[i].type1, true, false);
+ image[i].type1.Width = image[0].pixel.Width;
+ image[i].type1.Height = image[0].pixel.Height;
+ /* Won't use image[2]. */
+ code = pdf_begin_write_image(pdev, &pie->writer, gs_no_id, width,
+ height, NULL, false);
if (code)
goto fail;
- code = psdf_setup_image_filters((gx_device_psdf *) pdev,
- &pie->writer.binary[i], &image[i].pixel,
- pmat, pis, true, in_line);
- if (code < 0)
- goto fail;
- psdf_setup_image_to_mask_filter(&pie->writer.binary[i],
- (gx_device_psdf *)pdev, pim->Width, pim->Height,
- num_components, pim->BitsPerComponent, image[i].type4.MaskColor);
- code = pdf_begin_image_data_decoded(pdev, num_components, pranges, i,
- &image[i].pixel, &cs_value, pie);
- if (code < 0)
- goto fail;
- ++pie->writer.alt_writer_count;
- /* Note : Possible values for alt_writer_count are 1,2,3, 4.
- 1 means no alternative streams.
- 2 means the main image stream and a mask stream while converting
- an Image Type 4.
- 3 means the main image stream, alternative image compression stream,
- and the compression chooser.
- 4 meams 3 and a mask stream while convertingh an Image Type 4.
+ code = psdf_setup_image_filters((gx_device_psdf *) pdev,
+ &pie->writer.binary[i], &image[i].pixel,
+ pmat, pis, true, in_line);
+ if (code < 0)
+ goto fail;
+ psdf_setup_image_to_mask_filter(&pie->writer.binary[i],
+ (gx_device_psdf *)pdev, pim->Width, pim->Height,
+ num_components, pim->BitsPerComponent, image[i].type4.MaskColor);
+ code = pdf_begin_image_data_decoded(pdev, num_components, pranges, i,
+ &image[i].pixel, &cs_value, pie);
+ if (code < 0)
+ goto fail;
+ ++pie->writer.alt_writer_count;
+ /* Note : Possible values for alt_writer_count are 1,2,3, 4.
+ 1 means no alternative streams.
+ 2 means the main image stream and a mask stream while converting
+ an Image Type 4.
+ 3 means the main image stream, alternative image compression stream,
+ and the compression chooser.
+ 4 meams 3 and a mask stream while convertingh an Image Type 4.
*/
}
return 0;
@@ -851,18 +851,18 @@ pdf_begin_typed_image_impl(gx_device_pdf *pdev, const gs_imager_state * pis,
/* Fall back to the default implementation. */
nyi:
return gx_default_begin_typed_image
- ((gx_device *)pdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
- pinfo);
+ ((gx_device *)pdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ pinfo);
}
static int
pdf_begin_typed_image(gx_device_pdf *pdev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo,
- pdf_typed_image_context_t context)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo,
+ pdf_typed_image_context_t context)
{
int code;
image_union_t *image = (image_union_t *)gs_malloc(mem->non_gc_memory, 4,
@@ -878,15 +878,15 @@ pdf_begin_typed_image(gx_device_pdf *pdev, const gs_imager_state * pis,
int
gdev_pdf_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
return pdf_begin_typed_image((gx_device_pdf *)dev, pis, pmat, pic, prect,
- pdcolor, pcpath, mem, pinfo,
- PDF_IMAGE_DEFAULT);
+ pdcolor, pcpath, mem, pinfo,
+ PDF_IMAGE_DEFAULT);
}
/* ---------------- All images ---------------- */
@@ -894,8 +894,8 @@ gdev_pdf_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
/* Process the next piece of an image. */
static int
pdf_image_plane_data_alt(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used, int alt_writer_index)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used, int alt_writer_index)
{
pdf_image_enum *pie = (pdf_image_enum *) info;
int h = height;
@@ -909,68 +909,68 @@ pdf_image_plane_data_alt(gx_image_enum_common_t * info,
int status = 0;
if (h > pie->rows_left)
- h = pie->rows_left;
+ h = pie->rows_left;
for (y = 0; y < h; ++y) {
- if (nplanes > 1) {
- /*
- * We flip images in blocks, and each block except the last one
- * must contain an integral number of pixels. The easiest way
- * to meet this condition is for all blocks except the last to
- * be a multiple of 3 source bytes (guaranteeing an integral
- * number of 1/2/4/8/12-bit samples), i.e., 3*nplanes flipped
- * bytes. This requires a buffer of at least
- * 3*GS_IMAGE_MAX_COMPONENTS bytes.
- */
- int pi;
- uint count = bcount;
- uint offset = 0;
+ if (nplanes > 1) {
+ /*
+ * We flip images in blocks, and each block except the last one
+ * must contain an integral number of pixels. The easiest way
+ * to meet this condition is for all blocks except the last to
+ * be a multiple of 3 source bytes (guaranteeing an integral
+ * number of 1/2/4/8/12-bit samples), i.e., 3*nplanes flipped
+ * bytes. This requires a buffer of at least
+ * 3*GS_IMAGE_MAX_COMPONENTS bytes.
+ */
+ int pi;
+ uint count = bcount;
+ uint offset = 0;
#define ROW_BYTES max(200 /*arbitrary*/, 3 * GS_IMAGE_MAX_COMPONENTS)
- const byte *bit_planes[GS_IMAGE_MAX_COMPONENTS];
- int block_bytes = ROW_BYTES / (3 * nplanes) * 3;
- byte row[ROW_BYTES];
-
- for (pi = 0; pi < nplanes; ++pi)
- bit_planes[pi] = planes[pi].data + planes[pi].raster * y;
- while (count) {
- uint flip_count;
- uint flipped_count;
-
- if (count >= block_bytes) {
- flip_count = block_bytes;
- flipped_count = block_bytes * nplanes;
- } else {
- flip_count = count;
- flipped_count =
- (width_bits % (block_bytes * 8) * nplanes + 7) >> 3;
- }
- image_flip_planes(row, bit_planes, offset, flip_count,
- nplanes, pie->plane_depths[0]);
- status = sputs(pie->writer.binary[alt_writer_index].strm, row,
- flipped_count, &ignore);
- if (status < 0)
- break;
- offset += flip_count;
- count -= flip_count;
- }
- } else {
- status = sputs(pie->writer.binary[alt_writer_index].strm,
- planes[0].data + planes[0].raster * y, bcount,
- &ignore);
- }
- if (status < 0)
- break;
+ const byte *bit_planes[GS_IMAGE_MAX_COMPONENTS];
+ int block_bytes = ROW_BYTES / (3 * nplanes) * 3;
+ byte row[ROW_BYTES];
+
+ for (pi = 0; pi < nplanes; ++pi)
+ bit_planes[pi] = planes[pi].data + planes[pi].raster * y;
+ while (count) {
+ uint flip_count;
+ uint flipped_count;
+
+ if (count >= block_bytes) {
+ flip_count = block_bytes;
+ flipped_count = block_bytes * nplanes;
+ } else {
+ flip_count = count;
+ flipped_count =
+ (width_bits % (block_bytes * 8) * nplanes + 7) >> 3;
+ }
+ image_flip_planes(row, bit_planes, offset, flip_count,
+ nplanes, pie->plane_depths[0]);
+ status = sputs(pie->writer.binary[alt_writer_index].strm, row,
+ flipped_count, &ignore);
+ if (status < 0)
+ break;
+ offset += flip_count;
+ count -= flip_count;
+ }
+ } else {
+ status = sputs(pie->writer.binary[alt_writer_index].strm,
+ planes[0].data + planes[0].raster * y, bcount,
+ &ignore);
+ }
+ if (status < 0)
+ break;
}
*rows_used = h;
if (status < 0)
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
return !pie->rows_left;
#undef ROW_BYTES
}
static int
pdf_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
pdf_image_enum *pie = (pdf_image_enum *) info;
int i;
@@ -986,8 +986,8 @@ pdf_image_plane_data(gx_image_enum_common_t * info,
}
static int
-use_image_as_pattern(gx_device_pdf *pdev, pdf_resource_t *pres1,
- const gs_matrix *pmat, gs_id id)
+use_image_as_pattern(gx_device_pdf *pdev, pdf_resource_t *pres1,
+ const gs_matrix *pmat, gs_id id)
{ /* See also dump_image in gdevpdfd.c . */
gs_imager_state s;
gs_pattern1_instance_t inst;
@@ -1011,40 +1011,40 @@ use_image_as_pattern(gx_device_pdf *pdev, pdf_resource_t *pres1,
inst.template.BBox.q.y = 1;
inst.template.XStep = 2; /* Set 2 times bigger step against artifacts. */
inst.template.YStep = 2;
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_start_accum, &inst, id);
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_start_accum, &inst, id);
if (code >= 0)
- pprintld1(pdev->strm, "/R%ld Do\n", pdf_resource_id(pres1));
+ pprintld1(pdev->strm, "/R%ld Do\n", pdf_resource_id(pres1));
pres = pdev->accumulating_substream_resource;
if (code >= 0)
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/XObject", pres1);
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/XObject", pres1);
if (code >= 0)
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_finish_accum, &inst, id);
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_finish_accum, &inst, id);
if (code >= 0)
- code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
- gxdso_pattern_load, &inst, id);
+ code = (*dev_proc(pdev, dev_spec_op))((gx_device *)pdev,
+ gxdso_pattern_load, &inst, id);
if (code >= 0) {
- stream_puts(pdev->strm, "q ");
- code = pdf_cs_Pattern_colored(pdev, &v);
+ stream_puts(pdev->strm, "q ");
+ code = pdf_cs_Pattern_colored(pdev, &v);
}
if (code >= 0) {
- cos_value_write(&v, pdev);
- pprintld1(pdev->strm, " cs /R%ld scn ", pdf_resource_id(pres));
+ cos_value_write(&v, pdev);
+ pprintld1(pdev->strm, " cs /R%ld scn ", pdf_resource_id(pres));
}
if (code >= 0) {
- /* The image offset weas broken in gx_begin_image3_generic,
- (see 'origin' in there).
- As a temporary hack use the offset of the image.
- fixme : This isn't generally correct,
- because the mask may be "transpozed" against the image. */
- gs_matrix m = pdev->converting_image_matrix;
-
- m.tx = pmat->tx;
- m.ty = pmat->ty;
- code = pdf_do_image_by_id(pdev, pdev->image_mask_scale,
- &m, true, pdev->image_mask_id);
- stream_puts(pdev->strm, "Q\n");
+ /* The image offset weas broken in gx_begin_image3_generic,
+ (see 'origin' in there).
+ As a temporary hack use the offset of the image.
+ fixme : This isn't generally correct,
+ because the mask may be "transpozed" against the image. */
+ gs_matrix m = pdev->converting_image_matrix;
+
+ m.tx = pmat->tx;
+ m.ty = pmat->ty;
+ code = pdf_do_image_by_id(pdev, pdev->image_mask_scale,
+ &m, true, pdev->image_mask_id);
+ stream_puts(pdev->strm, "Q\n");
}
return code;
}
@@ -1057,44 +1057,44 @@ typedef enum {
/* Close PDF image and do it. */
static int
-pdf_end_and_do_image(gx_device_pdf *pdev, pdf_image_writer *piw,
- const gs_matrix *mat, gs_id ps_bitmap_id, pdf_image_usage_t do_image)
+pdf_end_and_do_image(gx_device_pdf *pdev, pdf_image_writer *piw,
+ const gs_matrix *mat, gs_id ps_bitmap_id, pdf_image_usage_t do_image)
{
int code = pdf_end_write_image(pdev, piw);
pdf_resource_t *pres = piw->pres;
switch (code) {
default:
- return code; /* error */
+ return code; /* error */
case 1:
- code = 0;
- break;
+ code = 0;
+ break;
case 0:
- if (do_image == USE_AS_IMAGE) {
- if (pdev->image_mask_id != gs_no_id) {
- char buf[20];
-
- sprintf(buf, "%ld 0 R", pdev->image_mask_id);
- code = cos_dict_put_string_copy((cos_dict_t *)pres->object,
- pdev->image_mask_is_SMask ? "/SMask" : "/Mask", buf);
- if (code < 0)
- return code;
- }
- if (pdev->image_mask_skip)
- code = 0;
- else
- code = pdf_do_image(pdev, pres, mat, true);
- } else if (do_image == USE_AS_MASK) {
- /* Provide data for pdf_do_image_by_id, which will be called through
- use_image_as_pattern during the next call to this function.
- See pdf_do_image about the meaning of 'scale'. */
- const pdf_x_object_t *const pxo = (const pdf_x_object_t *)pres;
-
- pdev->image_mask_scale = (double)pxo->data_height / pxo->height;
- pdev->image_mask_id = pdf_resource_id(pres);
- pdev->converting_image_matrix = *mat;
- } else if (do_image == USE_AS_PATTERN)
- code = use_image_as_pattern(pdev, pres, mat, ps_bitmap_id);
+ if (do_image == USE_AS_IMAGE) {
+ if (pdev->image_mask_id != gs_no_id) {
+ char buf[20];
+
+ sprintf(buf, "%ld 0 R", pdev->image_mask_id);
+ code = cos_dict_put_string_copy((cos_dict_t *)pres->object,
+ pdev->image_mask_is_SMask ? "/SMask" : "/Mask", buf);
+ if (code < 0)
+ return code;
+ }
+ if (pdev->image_mask_skip)
+ code = 0;
+ else
+ code = pdf_do_image(pdev, pres, mat, true);
+ } else if (do_image == USE_AS_MASK) {
+ /* Provide data for pdf_do_image_by_id, which will be called through
+ use_image_as_pattern during the next call to this function.
+ See pdf_do_image about the meaning of 'scale'. */
+ const pdf_x_object_t *const pxo = (const pdf_x_object_t *)pres;
+
+ pdev->image_mask_scale = (double)pxo->data_height / pxo->height;
+ pdev->image_mask_id = pdf_resource_id(pres);
+ pdev->converting_image_matrix = *mat;
+ } else if (do_image == USE_AS_PATTERN)
+ code = use_image_as_pattern(pdev, pres, mat, ps_bitmap_id);
}
return code;
}
@@ -1102,7 +1102,7 @@ pdf_end_and_do_image(gx_device_pdf *pdev, pdf_image_writer *piw,
/* Clean up by releasing the buffers. */
static int
pdf_image_end_image_data(gx_image_enum_common_t * info, bool draw_last,
- pdf_image_usage_t do_image)
+ pdf_image_usage_t do_image)
{
gx_device_pdf *pdev = (gx_device_pdf *)info->dev;
pdf_image_enum *pie = (pdf_image_enum *)info;
@@ -1111,39 +1111,39 @@ pdf_image_end_image_data(gx_image_enum_common_t * info, bool draw_last,
int code = 0;
if (pie->writer.pres)
- ((pdf_x_object_t *)pie->writer.pres)->data_height = data_height;
+ ((pdf_x_object_t *)pie->writer.pres)->data_height = data_height;
else if (data_height > 0)
- pdf_put_image_matrix(pdev, &pie->mat, (double)data_height / height);
+ pdf_put_image_matrix(pdev, &pie->mat, (double)data_height / height);
if (data_height > 0) {
- code = pdf_complete_image_data(pdev, &pie->writer, data_height,
- pie->width, pie->bits_per_pixel);
- if (code < 0)
- return code;
- code = pdf_end_image_binary(pdev, &pie->writer, data_height);
- /* The call above possibly decreases pie->writer.alt_writer_count in 2. */
- if (code < 0)
- return code;
- if (pie->writer.alt_writer_count == 2) {
- /* We're converting a type 4 image into an imagemask with a pattern color. */
- /* Since the type 3 image writes the mask first, do so here. */
- pdf_image_writer writer = pie->writer;
-
- writer.binary[0] = pie->writer.binary[1];
- writer.pres = pie->writer.pres_mask;
- writer.alt_writer_count = 1;
- memset(&pie->writer.binary[1], 0, sizeof(pie->writer.binary[1]));
- pie->writer.alt_writer_count--; /* For GC. */
- pie->writer.pres_mask = 0; /* For GC. */
- code = pdf_end_image_binary(pdev, &writer, data_height);
- if (code < 0)
- return code;
- code = pdf_end_and_do_image(pdev, &writer, &pie->mat, info->id, USE_AS_MASK);
- if (code < 0)
- return code;
- code = pdf_end_and_do_image(pdev, &pie->writer, &pie->mat, info->id, USE_AS_PATTERN);
- } else
- code = pdf_end_and_do_image(pdev, &pie->writer, &pie->mat, info->id, do_image);
- pie->writer.alt_writer_count--; /* For GC. */
+ code = pdf_complete_image_data(pdev, &pie->writer, data_height,
+ pie->width, pie->bits_per_pixel);
+ if (code < 0)
+ return code;
+ code = pdf_end_image_binary(pdev, &pie->writer, data_height);
+ /* The call above possibly decreases pie->writer.alt_writer_count in 2. */
+ if (code < 0)
+ return code;
+ if (pie->writer.alt_writer_count == 2) {
+ /* We're converting a type 4 image into an imagemask with a pattern color. */
+ /* Since the type 3 image writes the mask first, do so here. */
+ pdf_image_writer writer = pie->writer;
+
+ writer.binary[0] = pie->writer.binary[1];
+ writer.pres = pie->writer.pres_mask;
+ writer.alt_writer_count = 1;
+ memset(&pie->writer.binary[1], 0, sizeof(pie->writer.binary[1]));
+ pie->writer.alt_writer_count--; /* For GC. */
+ pie->writer.pres_mask = 0; /* For GC. */
+ code = pdf_end_image_binary(pdev, &writer, data_height);
+ if (code < 0)
+ return code;
+ code = pdf_end_and_do_image(pdev, &writer, &pie->mat, info->id, USE_AS_MASK);
+ if (code < 0)
+ return code;
+ code = pdf_end_and_do_image(pdev, &pie->writer, &pie->mat, info->id, USE_AS_PATTERN);
+ } else
+ code = pdf_end_and_do_image(pdev, &pie->writer, &pie->mat, info->id, do_image);
+ pie->writer.alt_writer_count--; /* For GC. */
}
gx_image_free_enum(&info);
return code;
@@ -1182,7 +1182,7 @@ pdf_make_mxd(gx_device **pmxdev, gx_device *tdev, gs_memory_t *mem)
int code = gs_copydevice(&fdev, (const gx_device *)&gs_null_device, mem);
if (code < 0)
- return code;
+ return code;
gx_device_set_target((gx_device_forward *)fdev, tdev);
*pmxdev = fdev;
return 0;
@@ -1207,90 +1207,90 @@ pdf_image_end_image_object2(gx_image_enum_common_t * info, bool draw_last)
static dev_proc_begin_typed_image(pdf_mid_begin_typed_image);
static int
pdf_image3_make_mid(gx_device **pmidev, gx_device *dev, int width, int height,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
gx_device_pdf *pdev = (gx_device_pdf *)dev;
if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
- gs_matrix m;
- pdf_lcvd_t *cvd = NULL;
- int code;
-
- gs_make_identity(&m);
- code = pdf_setup_masked_image_converter(pdev, mem, &m, &cvd,
- true, 0, 0, width, height, true);
- if (code < 0)
- return code;
- cvd->mask->target = (gx_device *)cvd; /* Temporary, just to communicate with
- pdf_image3_make_mcde. The latter will reset it. */
- cvd->mask_is_empty = false;
- *pmidev = (gx_device *)cvd->mask;
- return 0;
+ gs_matrix m;
+ pdf_lcvd_t *cvd = NULL;
+ int code;
+
+ gs_make_identity(&m);
+ code = pdf_setup_masked_image_converter(pdev, mem, &m, &cvd,
+ true, 0, 0, width, height, true);
+ if (code < 0)
+ return code;
+ cvd->mask->target = (gx_device *)cvd; /* Temporary, just to communicate with
+ pdf_image3_make_mcde. The latter will reset it. */
+ cvd->mask_is_empty = false;
+ *pmidev = (gx_device *)cvd->mask;
+ return 0;
} else {
- int code = pdf_make_mxd(pmidev, dev, mem);
+ int code = pdf_make_mxd(pmidev, dev, mem);
- if (code < 0)
- return code;
- set_dev_proc(*pmidev, begin_typed_image, pdf_mid_begin_typed_image);
- return 0;
+ if (code < 0)
+ return code;
+ set_dev_proc(*pmidev, begin_typed_image, pdf_mid_begin_typed_image);
+ return 0;
}
}
static int
pdf_mid_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
/* The target of the null device is the pdfwrite device. */
gx_device_pdf *const pdev = (gx_device_pdf *)
- ((gx_device_null *)dev)->target;
+ ((gx_device_null *)dev)->target;
return pdf_begin_typed_image
- (pdev, pis, pmat, pic, prect, pdcolor, pcpath, mem, pinfo,
- PDF_IMAGE_TYPE3_MASK);
+ (pdev, pis, pmat, pic, prect, pdcolor, pcpath, mem, pinfo,
+ PDF_IMAGE_TYPE3_MASK);
}
/* Implement the mask clip device. */
static int
pdf_image3_make_mcde(gx_device *dev, const gs_imager_state *pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect *prect, const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- gx_image_enum_common_t **pinfo,
- gx_device **pmcdev, gx_device *midev,
- gx_image_enum_common_t *pminfo,
- const gs_int_point *origin)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect *prect, const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ gx_image_enum_common_t **pinfo,
+ gx_device **pmcdev, gx_device *midev,
+ gx_image_enum_common_t *pminfo,
+ const gs_int_point *origin)
{
int code;
gx_device_pdf *pdev = (gx_device_pdf *)dev;
if (pdev->CompatibilityLevel < 1.3 && !pdev->PatternImagemask) {
- /* pdf_image3_make_mid must set midev with a pdf_lcvd_t instance.*/
- pdf_lcvd_t *cvd = (pdf_lcvd_t *)((gx_device_memory *)midev)->target;
-
- ((gx_device_memory *)midev)->target = NULL;
- cvd->m = pdev->converting_image_matrix;
- cvd->mdev.mapped_x = origin->x;
- cvd->mdev.mapped_y = origin->y;
- *pmcdev = (gx_device *)&cvd->mdev;
- code = gx_default_begin_typed_image
- ((gx_device *)&cvd->mdev, pis, pmat, pic, prect, pdcolor, NULL, mem,
- pinfo);
- if (code < 0)
- return code;
+ /* pdf_image3_make_mid must set midev with a pdf_lcvd_t instance.*/
+ pdf_lcvd_t *cvd = (pdf_lcvd_t *)((gx_device_memory *)midev)->target;
+
+ ((gx_device_memory *)midev)->target = NULL;
+ cvd->m = pdev->converting_image_matrix;
+ cvd->mdev.mapped_x = origin->x;
+ cvd->mdev.mapped_y = origin->y;
+ *pmcdev = (gx_device *)&cvd->mdev;
+ code = gx_default_begin_typed_image
+ ((gx_device *)&cvd->mdev, pis, pmat, pic, prect, pdcolor, NULL, mem,
+ pinfo);
+ if (code < 0)
+ return code;
} else {
- code = pdf_make_mxd(pmcdev, midev, mem);
- if (code < 0)
- return code;
- code = pdf_begin_typed_image
- ((gx_device_pdf *)dev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
- pinfo, PDF_IMAGE_TYPE3_DATA);
- if (code < 0)
- return code;
+ code = pdf_make_mxd(pmcdev, midev, mem);
+ if (code < 0)
+ return code;
+ code = pdf_begin_typed_image
+ ((gx_device_pdf *)dev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ pinfo, PDF_IMAGE_TYPE3_DATA);
+ if (code < 0)
+ return code;
}
- /* Due to equal image merging, we delay the adding of the "Mask" entry into
- a type 3 image dictionary until the mask is completed.
+ /* Due to equal image merging, we delay the adding of the "Mask" entry into
+ a type 3 image dictionary until the mask is completed.
Will do in pdf_end_and_do_image.*/
return 0;
}
@@ -1300,12 +1300,12 @@ pdf_image3_make_mcde(gx_device *dev, const gs_imager_state *pis,
/* Implement the mask image device. */
static int
pdf_image3x_make_mid(gx_device **pmidev, gx_device *dev, int width, int height,
- int depth, gs_memory_t *mem)
+ int depth, gs_memory_t *mem)
{
int code = pdf_make_mxd(pmidev, dev, mem);
if (code < 0)
- return code;
+ return code;
set_dev_proc(*pmidev, begin_typed_image, pdf_mid_begin_typed_image);
return 0;
}
@@ -1313,15 +1313,15 @@ pdf_image3x_make_mid(gx_device **pmidev, gx_device *dev, int width, int height,
/* Implement the mask clip device. */
static int
pdf_image3x_make_mcde(gx_device *dev, const gs_imager_state *pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect *prect,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- gx_image_enum_common_t **pinfo,
- gx_device **pmcdev, gx_device *midev[2],
- gx_image_enum_common_t *pminfo[2],
- const gs_int_point origin[2],
- const gs_image3x_t *pim)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect *prect,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ gx_image_enum_common_t **pinfo,
+ gx_device **pmcdev, gx_device *midev[2],
+ gx_image_enum_common_t *pminfo[2],
+ const gs_int_point origin[2],
+ const gs_image3x_t *pim)
{
int code;
pdf_image_enum *pmie;
@@ -1329,26 +1329,26 @@ pdf_image3x_make_mcde(gx_device *dev, const gs_imager_state *pis,
const gs_image3x_mask_t *pixm;
if (midev[0]) {
- if (midev[1])
- return_error(gs_error_rangecheck);
- i = 0, pixm = &pim->Opacity;
+ if (midev[1])
+ return_error(gs_error_rangecheck);
+ i = 0, pixm = &pim->Opacity;
} else if (midev[1])
- i = 1, pixm = &pim->Shape;
+ i = 1, pixm = &pim->Shape;
else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = pdf_make_mxd(pmcdev, midev[i], mem);
if (code < 0)
- return code;
+ return code;
code = pdf_begin_typed_image
- ((gx_device_pdf *)dev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
- pinfo, PDF_IMAGE_TYPE3_DATA);
+ ((gx_device_pdf *)dev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ pinfo, PDF_IMAGE_TYPE3_DATA);
if (code < 0)
- return code;
+ return code;
if ((*pinfo)->procs != &pdf_image_enum_procs) {
- /* We couldn't handle the image. Bail out. */
- gx_image_end(*pinfo, false);
- gs_free_object(mem, *pmcdev, "pdf_image3x_make_mcde");
- return_error(gs_error_rangecheck);
+ /* We couldn't handle the image. Bail out. */
+ gx_image_end(*pinfo, false);
+ gs_free_object(mem, *pmcdev, "pdf_image3x_make_mcde");
+ return_error(gs_error_rangecheck);
}
pmie = (pdf_image_enum *)pminfo[i];
/*
@@ -1356,32 +1356,31 @@ pdf_image3x_make_mcde(gx_device *dev, const gs_imager_state *pis,
* the Matte entry to the mask dictionary.
*/
if (pixm->has_Matte) {
- int num_components =
- gs_color_space_num_components(pim->ColorSpace);
-
- code = cos_dict_put_c_key_floats(
- (cos_dict_t *)pmie->writer.pres->object,
- "/Matte", pixm->Matte,
- num_components);
- if (code < 0)
- return code;
+ int num_components =
+ gs_color_space_num_components(pim->ColorSpace);
+
+ code = cos_dict_put_c_key_floats(
+ (cos_dict_t *)pmie->writer.pres->object,
+ "/Matte", pixm->Matte,
+ num_components);
+ if (code < 0)
+ return code;
}
/* Don't put SMask here because pmie->writer.pres->object may be substituted
* after the image stream is accummulated. pdf_end_and_do_image will set
* SMask with the right value. Bug 690345.
- */
+ */
return 0;
}
pdf_resource_t *pdf_substitute_pattern(pdf_resource_t *pres)
{
pdf_pattern_t *ppat = (pdf_pattern_t *)pres;
-
+
return (pdf_resource_t *)(ppat->substitute != 0 ? ppat->substitute : ppat);
}
-
-static int
+static int
check_unsubstituted2(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
{
pdf_pattern_t *ppat0 = (pdf_pattern_t *)pres0;
@@ -1390,7 +1389,7 @@ check_unsubstituted2(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t
return (ppat0->substitute == NULL && ppat1->substitute == NULL);
}
-static int
+static int
check_unsubstituted1(gx_device_pdf * pdev, pdf_resource_t *pres0)
{
pdf_pattern_t *ppat = (pdf_pattern_t *)pres0;
@@ -1404,7 +1403,7 @@ check_unsubstituted1(gx_device_pdf * pdev, pdf_resource_t *pres0)
*/
int
gdev_pdf_dev_spec_op(gx_device *pdev1, int dev_spec_op, void *data, int size)
-{
+{
gx_device_pdf *pdev = (gx_device_pdf *)pdev1;
int code;
pdf_resource_t *pres, *pres1;
@@ -1412,75 +1411,75 @@ gdev_pdf_dev_spec_op(gx_device *pdev1, int dev_spec_op, void *data, int size)
gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)data;
switch (dev_spec_op) {
- case gxdso_pattern_can_accum:
- return 1;
- case gxdso_pattern_start_accum:
- code = pdf_enter_substream(pdev, resourcePattern, id, &pres, false,
- pdev->CompressFonts/* Have no better switch.*/);
- if (code < 0)
- return code;
- pres->rid = id;
- code = pdf_store_pattern1_params(pdev, pres, pinst);
- if (code < 0)
- return code;
- /* Scale the coordinate system, because object handlers assume so. See none_to_stream. */
- pprintg2(pdev->strm, "%g 0 0 %g 0 0 cm\n",
- 72.0 / pdev->HWResolution[0], 72.0 / pdev->HWResolution[1]);
- return 1;
- case gxdso_pattern_finish_accum:
- code = pdf_add_procsets(pdev->substream_Resources, pdev->procsets);
- if (code < 0)
- return code;
- pres = pres1 = pdev->accumulating_substream_resource;
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- if (pdev->substituted_pattern_count > 300 &&
- pdev->substituted_pattern_drop_page != pdev->next_page) { /* arbitrary */
- pdf_drop_resources(pdev, resourcePattern, check_unsubstituted1);
- pdev->substituted_pattern_count = 0;
- pdev->substituted_pattern_drop_page = pdev->next_page;
- }
- code = pdf_find_same_resource(pdev, resourcePattern, &pres, check_unsubstituted2);
- if (code < 0)
- return code;
- if (code > 0) {
- pdf_pattern_t *ppat = (pdf_pattern_t *)pres1;
-
- code = pdf_cancel_resource(pdev, pres1, resourcePattern);
- if (code < 0)
- return code;
- /* Do not remove pres1, because it keeps the substitution. */
- ppat->substitute = (pdf_pattern_t *)pres;
- pres->where_used |= pdev->used_mask;
- pdev->substituted_pattern_count++;
- } else if (pres->object->id < 0)
- pdf_reserve_object_id(pdev, pres, 0);
- return 1;
- case gxdso_pattern_load:
- pres = pdf_find_resource_by_gs_id(pdev, resourcePattern, id);
- if (pres == 0)
- return gs_error_undefined;
- pres = pdf_substitute_pattern(pres);
- pres->where_used |= pdev->used_mask;
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/Pattern", pres);
- if (code < 0)
- return code;
- return 1;
- case gxdso_pattern_shading_area:
- return 0;
- case gxdso_pattern_is_cpath_accum:
- return 0;
- case gxdso_pattern_shfill_doesnt_need_path:
- return 0; /* gdev_pdf_fill_path still does need a path. */
- case gxdso_pattern_handles_clip_path:
- /* This is important when the default implementation of
- of fill_path is called due to a failure in setcolor
- or so, for example when a shading is incorrect.
- The test case is the unfixed (buggy) Genoa test 446-01.ps .
- In this case pdfwrite converts the object into rectangles,
- and the clipping device has to be set up. */
- return 0;
+ case gxdso_pattern_can_accum:
+ return 1;
+ case gxdso_pattern_start_accum:
+ code = pdf_enter_substream(pdev, resourcePattern, id, &pres, false,
+ pdev->CompressFonts/* Have no better switch.*/);
+ if (code < 0)
+ return code;
+ pres->rid = id;
+ code = pdf_store_pattern1_params(pdev, pres, pinst);
+ if (code < 0)
+ return code;
+ /* Scale the coordinate system, because object handlers assume so. See none_to_stream. */
+ pprintg2(pdev->strm, "%g 0 0 %g 0 0 cm\n",
+ 72.0 / pdev->HWResolution[0], 72.0 / pdev->HWResolution[1]);
+ return 1;
+ case gxdso_pattern_finish_accum:
+ code = pdf_add_procsets(pdev->substream_Resources, pdev->procsets);
+ if (code < 0)
+ return code;
+ pres = pres1 = pdev->accumulating_substream_resource;
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ if (pdev->substituted_pattern_count > 300 &&
+ pdev->substituted_pattern_drop_page != pdev->next_page) { /* arbitrary */
+ pdf_drop_resources(pdev, resourcePattern, check_unsubstituted1);
+ pdev->substituted_pattern_count = 0;
+ pdev->substituted_pattern_drop_page = pdev->next_page;
+ }
+ code = pdf_find_same_resource(pdev, resourcePattern, &pres, check_unsubstituted2);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ pdf_pattern_t *ppat = (pdf_pattern_t *)pres1;
+
+ code = pdf_cancel_resource(pdev, pres1, resourcePattern);
+ if (code < 0)
+ return code;
+ /* Do not remove pres1, because it keeps the substitution. */
+ ppat->substitute = (pdf_pattern_t *)pres;
+ pres->where_used |= pdev->used_mask;
+ pdev->substituted_pattern_count++;
+ } else if (pres->object->id < 0)
+ pdf_reserve_object_id(pdev, pres, 0);
+ return 1;
+ case gxdso_pattern_load:
+ pres = pdf_find_resource_by_gs_id(pdev, resourcePattern, id);
+ if (pres == 0)
+ return gs_error_undefined;
+ pres = pdf_substitute_pattern(pres);
+ pres->where_used |= pdev->used_mask;
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/Pattern", pres);
+ if (code < 0)
+ return code;
+ return 1;
+ case gxdso_pattern_shading_area:
+ return 0;
+ case gxdso_pattern_is_cpath_accum:
+ return 0;
+ case gxdso_pattern_shfill_doesnt_need_path:
+ return 0; /* gdev_pdf_fill_path still does need a path. */
+ case gxdso_pattern_handles_clip_path:
+ /* This is important when the default implementation of
+ of fill_path is called due to a failure in setcolor
+ or so, for example when a shading is incorrect.
+ The test case is the unfixed (buggy) Genoa test 446-01.ps .
+ In this case pdfwrite converts the object into rectangles,
+ and the clipping device has to be set up. */
+ return 0;
}
return gx_default_dev_spec_op(pdev1, dev_spec_op, data, size);
}
diff --git a/gs/base/gdevpdfj.c b/gs/base/gdevpdfj.c
index 752aca5db..bb2c8ce96 100644
--- a/gs/base/gdevpdfj.c
+++ b/gs/base/gdevpdfj.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,13 +33,13 @@ public_st_pdf_image_writer();
static ENUM_PTRS_WITH(pdf_image_writer_enum_ptrs, pdf_image_writer *piw)
index -= 4;
if (index < psdf_binary_writer_max_ptrs * piw->alt_writer_count) {
- gs_ptr_type_t ret =
- ENUM_USING(st_psdf_binary_writer, &piw->binary[index / psdf_binary_writer_max_ptrs],
- sizeof(psdf_binary_writer), index % psdf_binary_writer_max_ptrs);
+ gs_ptr_type_t ret =
+ ENUM_USING(st_psdf_binary_writer, &piw->binary[index / psdf_binary_writer_max_ptrs],
+ sizeof(psdf_binary_writer), index % psdf_binary_writer_max_ptrs);
- if (ret == 0) /* don't stop early */
- ENUM_RETURN(0);
- return ret;
+ if (ret == 0) /* don't stop early */
+ ENUM_RETURN(0);
+ return ret;
}
return 0;
case 0: ENUM_RETURN(piw->pres);
@@ -52,8 +52,8 @@ static RELOC_PTRS_WITH(pdf_image_writer_reloc_ptrs, pdf_image_writer *piw)
int i;
for (i = 0; i < piw->alt_writer_count; ++i)
- RELOC_USING(st_psdf_binary_writer, &piw->binary[i],
- sizeof(psdf_binary_writer));
+ RELOC_USING(st_psdf_binary_writer, &piw->binary[i],
+ sizeof(psdf_binary_writer));
RELOC_VAR(piw->pres);
RELOC_VAR(piw->data);
RELOC_VAR(piw->named);
@@ -79,10 +79,10 @@ const pdf_image_names_t pdf_image_names_short = {
/* pcsvalue is not used for masks. */
static int
pdf_put_pixel_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
- const gs_pixel_image_t *pim,
- const gs_color_space *pcs,
- const pdf_image_names_t *pin,
- const cos_value_t *pcsvalue)
+ const gs_pixel_image_t *pim,
+ const gs_color_space *pcs,
+ const pdf_image_names_t *pin,
+ const cos_value_t *pcsvalue)
{
int num_components;
float indexed_decode[2];
@@ -90,116 +90,116 @@ pdf_put_pixel_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
int code;
if (pcs) {
- CHECK(cos_dict_put_c_key(pcd, pin->ColorSpace, pcsvalue));
- pdf_color_space_procsets(pdev, pcs);
- num_components = gs_color_space_num_components(pcs);
- if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed) {
- indexed_decode[0] = 0;
- indexed_decode[1] = (float)((1 << pim->BitsPerComponent) - 1);
- default_decode = indexed_decode;
- }
+ CHECK(cos_dict_put_c_key(pcd, pin->ColorSpace, pcsvalue));
+ pdf_color_space_procsets(pdev, pcs);
+ num_components = gs_color_space_num_components(pcs);
+ if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed) {
+ indexed_decode[0] = 0;
+ indexed_decode[1] = (float)((1 << pim->BitsPerComponent) - 1);
+ default_decode = indexed_decode;
+ }
} else
- num_components = 1;
+ num_components = 1;
CHECK(cos_dict_put_c_key_int(pcd, pin->Width, pim->Width));
CHECK(cos_dict_put_c_key_int(pcd, pin->Height, pim->Height));
CHECK(cos_dict_put_c_key_int(pcd, pin->BitsPerComponent,
- pim->BitsPerComponent));
+ pim->BitsPerComponent));
{
- int i;
-
- for (i = 0; i < num_components * 2; ++i) {
- if (pim->Decode[i] !=
- (default_decode ? default_decode[i] : i & 1)
- )
- break;
- }
- if (i < num_components * 2) {
- cos_array_t *pca =
- cos_array_alloc(pdev, "pdf_put_pixel_image_values(decode)");
-
- if (pca == 0)
- return_error(gs_error_VMerror);
- if (pcs == NULL) {
- /* 269-01.ps sets /Decode[0 100] with a mask image. */
- for (i = 0; i < num_components * 2; ++i)
- CHECK(cos_array_add_real(pca, min(pim->Decode[i], 1)));
- } else {
- for (i = 0; i < num_components * 2; ++i)
- CHECK(cos_array_add_real(pca, pim->Decode[i]));
- }
- CHECK(cos_dict_put_c_key_object(pcd, pin->Decode,
- COS_OBJECT(pca)));
- }
+ int i;
+
+ for (i = 0; i < num_components * 2; ++i) {
+ if (pim->Decode[i] !=
+ (default_decode ? default_decode[i] : i & 1)
+ )
+ break;
+ }
+ if (i < num_components * 2) {
+ cos_array_t *pca =
+ cos_array_alloc(pdev, "pdf_put_pixel_image_values(decode)");
+
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ if (pcs == NULL) {
+ /* 269-01.ps sets /Decode[0 100] with a mask image. */
+ for (i = 0; i < num_components * 2; ++i)
+ CHECK(cos_array_add_real(pca, min(pim->Decode[i], 1)));
+ } else {
+ for (i = 0; i < num_components * 2; ++i)
+ CHECK(cos_array_add_real(pca, pim->Decode[i]));
+ }
+ CHECK(cos_dict_put_c_key_object(pcd, pin->Decode,
+ COS_OBJECT(pca)));
+ }
}
if (pim->Interpolate) {
- if (pdev->PDFA)
- emprintf(pdev->memory,
+ if (pdev->PDFA)
+ emprintf(pdev->memory,
"PDFA doesn't allow images with Interpolate true.\n");
- else
- CHECK(cos_dict_put_c_strings(pcd, pin->Interpolate, "true"));
+ else
+ CHECK(cos_dict_put_c_strings(pcd, pin->Interpolate, "true"));
}
return 0;
}
int
pdf_put_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
- const gs_pixel_image_t *pic,
- const pdf_image_names_t *pin,
- const cos_value_t *pcsvalue)
+ const gs_pixel_image_t *pic,
+ const pdf_image_names_t *pin,
+ const cos_value_t *pcsvalue)
{
const gs_color_space *pcs = pic->ColorSpace;
int code;
switch (pic->type->index) {
case 1: {
- const gs_image1_t *pim = (const gs_image1_t *)pic;
+ const gs_image1_t *pim = (const gs_image1_t *)pic;
- if (pim->ImageMask) {
- CHECK(cos_dict_put_c_strings(pcd, pin->ImageMask, "true"));
- pdev->procsets |= ImageB;
- pcs = NULL;
- }
+ if (pim->ImageMask) {
+ CHECK(cos_dict_put_c_strings(pcd, pin->ImageMask, "true"));
+ pdev->procsets |= ImageB;
+ pcs = NULL;
+ }
}
- break;
+ break;
case 3: {
- /*
- * Clients must treat this as a special case: they must call
- * pdf_put_image_values for the MaskDict separately, and must
- * add the Mask entry to the main image stream (dictionary).
- */
- /*const gs_image3_t *pim = (const gs_image3_t *)pic;*/
-
- /* Masked images are only supported starting in PDF 1.3. */
- if (pdev->CompatibilityLevel < 1.3)
- return_error(gs_error_rangecheck);
+ /*
+ * Clients must treat this as a special case: they must call
+ * pdf_put_image_values for the MaskDict separately, and must
+ * add the Mask entry to the main image stream (dictionary).
+ */
+ /*const gs_image3_t *pim = (const gs_image3_t *)pic;*/
+
+ /* Masked images are only supported starting in PDF 1.3. */
+ if (pdev->CompatibilityLevel < 1.3)
+ return_error(gs_error_rangecheck);
}
- break;
+ break;
case 4: {
- const gs_image4_t *pim = (const gs_image4_t *)pic;
- int num_components = gs_color_space_num_components(pcs);
- cos_array_t *pca;
- int i;
-
- /* Masked images are only supported starting in PDF 1.3. */
- if (pdev->CompatibilityLevel < 1.3)
- break; /* Will convert into an imagemask with a pattern color. */
- pca = cos_array_alloc(pdev, "pdf_put_image_values(mask)");
- if (pca == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < num_components; ++i) {
- int lo, hi;
-
- if (pim->MaskColor_is_range)
- lo = pim->MaskColor[i * 2], hi = pim->MaskColor[i * 2 + 1];
- else
- lo = hi = pim->MaskColor[i];
- CHECK(cos_array_add_int(pca, lo));
- CHECK(cos_array_add_int(pca, hi));
- }
- CHECK(cos_dict_put_c_key_object(pcd, "/Mask", COS_OBJECT(pca)));
+ const gs_image4_t *pim = (const gs_image4_t *)pic;
+ int num_components = gs_color_space_num_components(pcs);
+ cos_array_t *pca;
+ int i;
+
+ /* Masked images are only supported starting in PDF 1.3. */
+ if (pdev->CompatibilityLevel < 1.3)
+ break; /* Will convert into an imagemask with a pattern color. */
+ pca = cos_array_alloc(pdev, "pdf_put_image_values(mask)");
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < num_components; ++i) {
+ int lo, hi;
+
+ if (pim->MaskColor_is_range)
+ lo = pim->MaskColor[i * 2], hi = pim->MaskColor[i * 2 + 1];
+ else
+ lo = hi = pim->MaskColor[i];
+ CHECK(cos_array_add_int(pca, lo));
+ CHECK(cos_array_add_int(pca, hi));
+ }
+ CHECK(cos_dict_put_c_key_object(pcd, "/Mask", COS_OBJECT(pca)));
}
- break;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
return pdf_put_pixel_image_values(pcd, pdev, pic, pcs, pin, pcsvalue);
}
@@ -208,8 +208,8 @@ pdf_put_image_values(cos_dict_t *pcd, gx_device_pdf *pdev,
/* Currently this only saves parameters for CCITTFaxDecode. */
int
pdf_put_image_filters(cos_dict_t *pcd, gx_device_pdf *pdev,
- const psdf_binary_writer * pbw,
- const pdf_image_names_t *pin)
+ const psdf_binary_writer * pbw,
+ const pdf_image_names_t *pin)
{
return pdf_put_filters(pcd, pdev, pbw->strm, &pin->filter_names);
}
@@ -223,7 +223,7 @@ pdf_put_image_filters(cos_dict_t *pcd, gx_device_pdf *pdev,
*/
void
pdf_make_bitmap_matrix(gs_matrix * pmat, int x, int y, int w, int h,
- int h_actual)
+ int h_actual)
{
pmat->xx = (float)w;
pmat->xy = 0;
@@ -239,7 +239,7 @@ pdf_make_bitmap_matrix(gs_matrix * pmat, int x, int y, int w, int h,
*/
void
pdf_put_image_matrix(gx_device_pdf * pdev, const gs_matrix * pmat,
- floatp y_scale)
+ floatp y_scale)
{
gs_matrix imat = {1, 0, 0, 1, 0 ,0};
@@ -251,31 +251,31 @@ pdf_put_image_matrix(gx_device_pdf * pdev, const gs_matrix * pmat,
/* Put out a reference to an image resource. */
int
pdf_do_image_by_id(gx_device_pdf * pdev, double scale,
- const gs_matrix * pimat, bool in_contents, gs_id id)
+ const gs_matrix * pimat, bool in_contents, gs_id id)
{
/* fixme : in_contents is always true (there are no calls with false). */
if (in_contents) {
- int code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ int code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (pimat)
- pdf_put_image_matrix(pdev, pimat, scale);
+ pdf_put_image_matrix(pdev, pimat, scale);
pprintld1(pdev->strm, "/R%ld Do\nQ\n", id);
return 0;
}
int
pdf_do_image(gx_device_pdf * pdev, const pdf_resource_t * pres,
- const gs_matrix * pimat, bool in_contents)
+ const gs_matrix * pimat, bool in_contents)
{
/* fixme : call pdf_do_image_by_id when pimam == NULL. */
double scale = 1;
if (pimat) {
- /* Adjust the matrix to account for short images. */
- const pdf_x_object_t *const pxo = (const pdf_x_object_t *)pres;
- scale = (double)pxo->data_height / pxo->height;
+ /* Adjust the matrix to account for short images. */
+ const pdf_x_object_t *const pxo = (const pdf_x_object_t *)pres;
+ scale = (double)pxo->data_height / pxo->height;
}
return pdf_do_image_by_id(pdev, scale, pimat, in_contents, pdf_resource_id(pres));
}
@@ -297,8 +297,8 @@ pdf_image_writer_init(pdf_image_writer * piw)
*/
int
pdf_begin_write_image(gx_device_pdf * pdev, pdf_image_writer * piw,
- gx_bitmap_id id, int w, int h, cos_dict_t *named,
- bool in_line)
+ gx_bitmap_id id, int w, int h, cos_dict_t *named,
+ bool in_line)
{
/* Patch pdev->strm so the right stream gets into the writer. */
stream *save_strm = pdev->strm;
@@ -308,48 +308,48 @@ pdf_begin_write_image(gx_device_pdf * pdev, pdf_image_writer * piw,
int code;
if (in_line) {
- piw->pres = 0;
- piw->pin = &pdf_image_names_short;
- data = cos_stream_alloc(pdev, "pdf_begin_image_data");
- if (data == 0)
- return_error(gs_error_VMerror);
- piw->end_string = " Q";
- piw->named = 0; /* must have named == 0 */
+ piw->pres = 0;
+ piw->pin = &pdf_image_names_short;
+ data = cos_stream_alloc(pdev, "pdf_begin_image_data");
+ if (data == 0)
+ return_error(gs_error_VMerror);
+ piw->end_string = " Q";
+ piw->named = 0; /* must have named == 0 */
} else {
- pdf_x_object_t *pxo;
- cos_stream_t *pcos;
- pdf_resource_t *pres;
-
- /*
- * Note that if named != 0, there are two objects with the same id
- * while the image is being accumulated: named, and pres->object.
- */
- code = pdf_alloc_resource(pdev, resourceXObject, id, &pres,
- (named ? named->id : -1L));
- if (code < 0)
- return code;
- *(mask ? &piw->pres_mask : &piw->pres) = pres;
- cos_become(pres->object, cos_type_stream);
- pres->rid = id;
- piw->pin = &pdf_image_names_full;
- pxo = (pdf_x_object_t *)pres;
- pcos = (cos_stream_t *)pxo->object;
- CHECK(cos_dict_put_c_strings(cos_stream_dict(pcos), "/Subtype",
- "/Image"));
- pxo->width = w;
- pxo->height = h;
- /* Initialize data_height for the benefit of copy_{mono,color}. */
- pxo->data_height = h;
- data = pcos;
- if (!mask)
- piw->named = named;
+ pdf_x_object_t *pxo;
+ cos_stream_t *pcos;
+ pdf_resource_t *pres;
+
+ /*
+ * Note that if named != 0, there are two objects with the same id
+ * while the image is being accumulated: named, and pres->object.
+ */
+ code = pdf_alloc_resource(pdev, resourceXObject, id, &pres,
+ (named ? named->id : -1L));
+ if (code < 0)
+ return code;
+ *(mask ? &piw->pres_mask : &piw->pres) = pres;
+ cos_become(pres->object, cos_type_stream);
+ pres->rid = id;
+ piw->pin = &pdf_image_names_full;
+ pxo = (pdf_x_object_t *)pres;
+ pcos = (cos_stream_t *)pxo->object;
+ CHECK(cos_dict_put_c_strings(cos_stream_dict(pcos), "/Subtype",
+ "/Image"));
+ pxo->width = w;
+ pxo->height = h;
+ /* Initialize data_height for the benefit of copy_{mono,color}. */
+ pxo->data_height = h;
+ data = pcos;
+ if (!mask)
+ piw->named = named;
}
pdev->strm = pdev->streams.strm;
pdev->strm = cos_write_stream_alloc(data, pdev, "pdf_begin_write_image");
if (pdev->strm == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!mask)
- piw->data = data;
+ piw->data = data;
piw->height = h;
code = psdf_begin_binary((gx_device_psdf *) pdev, &piw->binary[alt_stream_index]);
piw->binary[alt_stream_index].target = NULL; /* We don't need target with cos_write_stream. */
@@ -386,20 +386,20 @@ pdf_make_alt_stream(gx_device_pdf * pdev, psdf_binary_writer * pbw)
/* Begin writing the image data, setting up the dictionary and filters. */
int
pdf_begin_image_data(gx_device_pdf * pdev, pdf_image_writer * piw,
- const gs_pixel_image_t * pim, const cos_value_t *pcsvalue,
- int alt_writer_index)
+ const gs_pixel_image_t * pim, const cos_value_t *pcsvalue,
+ int alt_writer_index)
{
-
+
cos_stream_t *s = cos_stream_from_pipeline(piw->binary[alt_writer_index].strm);
cos_dict_t *pcd = cos_stream_dict(s);
int code = pdf_put_image_values(pcd, pdev, pim, piw->pin, pcsvalue);
if (code >= 0)
- code = pdf_put_image_filters(pcd, pdev, &piw->binary[alt_writer_index], piw->pin);
+ code = pdf_put_image_filters(pcd, pdev, &piw->binary[alt_writer_index], piw->pin);
if (code < 0) {
- if (!piw->pres)
- COS_FREE(piw->data, "pdf_begin_image_data");
- piw->data = 0;
+ if (!piw->pres)
+ COS_FREE(piw->data, "pdf_begin_image_data");
+ piw->data = 0;
}
return code;
}
@@ -407,30 +407,30 @@ pdf_begin_image_data(gx_device_pdf * pdev, pdf_image_writer * piw,
/* Complete image data. */
int
pdf_complete_image_data(gx_device_pdf *pdev, pdf_image_writer *piw, int data_h,
- int width, int bits_per_pixel)
+ int width, int bits_per_pixel)
{
if (data_h != piw->height) {
- if (piw->binary[0].strm->procs.process == s_DCTE_template.process ||
- piw->binary[0].strm->procs.process == s_PNGPE_template.process ) {
- /* Since DCTE and PNGPE can't safely close with incomplete data,
- we add stub data to complete the stream.
- */
- int bytes_per_line = (width * bits_per_pixel + 7) / 8;
- int lines_left = piw->height - data_h;
- byte buf[256];
- const uint lb = sizeof(buf);
- int i, l;
- uint ignore;
-
- memset(buf, 128, lb);
- for (; lines_left; lines_left--)
- for (i = 0; i < piw->alt_writer_count; i++) {
- for (l = bytes_per_line; l > 0; l -= lb)
- if ((sputs(piw->binary[i].strm, buf, min(l, lb),
- &ignore)) < 0)
- return_error(gs_error_ioerror);
- }
- }
+ if (piw->binary[0].strm->procs.process == s_DCTE_template.process ||
+ piw->binary[0].strm->procs.process == s_PNGPE_template.process ) {
+ /* Since DCTE and PNGPE can't safely close with incomplete data,
+ we add stub data to complete the stream.
+ */
+ int bytes_per_line = (width * bits_per_pixel + 7) / 8;
+ int lines_left = piw->height - data_h;
+ byte buf[256];
+ const uint lb = sizeof(buf);
+ int i, l;
+ uint ignore;
+
+ memset(buf, 128, lb);
+ for (; lines_left; lines_left--)
+ for (i = 0; i < piw->alt_writer_count; i++) {
+ for (l = bytes_per_line; l > 0; l -= lb)
+ if ((sputs(piw->binary[i].strm, buf, min(l, lb),
+ &ignore)) < 0)
+ return_error(gs_error_ioerror);
+ }
+ }
}
return 0;
}
@@ -442,35 +442,35 @@ pdf_end_image_binary(gx_device_pdf *pdev, pdf_image_writer *piw, int data_h)
int code, code1 = 0;
if (piw->alt_writer_count > 2)
- code = pdf_choose_compression(piw, true);
+ code = pdf_choose_compression(piw, true);
else
- code = psdf_end_binary(&piw->binary[0]);
+ code = psdf_end_binary(&piw->binary[0]);
/* If the image ended prematurely, update the Height. */
if (data_h != piw->height) {
- char data[255];
- int OutHeight;
- cos_value_t *value;
- value = (cos_value_t *)cos_dict_find(cos_stream_dict(piw->data),
- (const byte *)piw->pin->Height, strlen(piw->pin->Height));
- if (!value || value->contents.chars.size > 255)
- return(gs_error_rangecheck);
- strncpy((char *)&data, (const char *)value->contents.chars.data, value->contents.chars.size);
- data[value->contents.chars.size] = 0x00;
- OutHeight = atoi(data);
- if (OutHeight != piw->height) {
- /* Looks like we are downsampling, so we can't use the number
- * of rows of data actually received, we must divide those by
- * the sampling factor.
- */
- float factor = (float)OutHeight / piw->height;
- OutHeight = (int)(factor * data_h);
- code1 = cos_dict_put_c_key_int(cos_stream_dict(piw->data),
- piw->pin->Height, OutHeight);
- } else {
-
- code1 = cos_dict_put_c_key_int(cos_stream_dict(piw->data),
- piw->pin->Height, data_h);
- }
+ char data[255];
+ int OutHeight;
+ cos_value_t *value;
+ value = (cos_value_t *)cos_dict_find(cos_stream_dict(piw->data),
+ (const byte *)piw->pin->Height, strlen(piw->pin->Height));
+ if (!value || value->contents.chars.size > 255)
+ return(gs_error_rangecheck);
+ strncpy((char *)&data, (const char *)value->contents.chars.data, value->contents.chars.size);
+ data[value->contents.chars.size] = 0x00;
+ OutHeight = atoi(data);
+ if (OutHeight != piw->height) {
+ /* Looks like we are downsampling, so we can't use the number
+ * of rows of data actually received, we must divide those by
+ * the sampling factor.
+ */
+ float factor = (float)OutHeight / piw->height;
+ OutHeight = (int)(factor * data_h);
+ code1 = cos_dict_put_c_key_int(cos_stream_dict(piw->data),
+ piw->pin->Height, OutHeight);
+ } else {
+
+ code1 = cos_dict_put_c_key_int(cos_stream_dict(piw->data),
+ piw->pin->Height, data_h);
+ }
}
return code < 0 ? code : code1;
}
@@ -485,75 +485,75 @@ pdf_end_write_image(gx_device_pdf * pdev, pdf_image_writer * piw)
pdf_resource_t *pres = piw->pres;
if (pres) { /* image resource */
- cos_object_t *const pco = pres->object;
- cos_stream_t *const pcs = (cos_stream_t *)pco;
- cos_dict_t *named = piw->named;
- int code;
-
- if (named) {
- if (pdev->ForOPDFRead) {
- code = cos_dict_put_c_key_bool(named, "/.Global", true);
- if (code < 0)
- return code;
- }
- /*
- * This image was named by NI. Copy any dictionary elements
- * from the named dictionary to the image stream, and then
- * associate the name with the stream.
- */
- code = cos_dict_move_all(cos_stream_dict(pcs), named);
- if (code < 0)
- return code;
- pres->named = true;
- /*
- * We need to make the entry in the name dictionary point to
- * the stream (pcs) rather than the object created by NI (named).
- * Unfortunately, we no longer know what dictionary to use.
- * Instead, overwrite the latter with the former's contents,
- * and change the only relevant pointer.
- */
- *(cos_object_t *)named = *pco;
- pres->object = COS_OBJECT(named);
- } else if (!pres->named) { /* named objects are written at the end */
- if (pdev->DetectDuplicateImages) {
- pdf_x_object_t *pxo = (pdf_x_object_t *)piw->pres;
- int height = pxo->height, width = pxo->width;
-
- code = pdf_substitute_resource(pdev, &piw->pres, resourceXObject, NULL, false);
- if (code < 0)
- return code;
-
- /* These values are related to the image matrix and should *not* be
- * substituted if we found a duplicate image, or the matrix calculation
- * will be incorrect! This only seems to matter for the PCL interpreter.
- */
- pxo = (pdf_x_object_t *)piw->pres;
- pxo->height = height;
- pxo->width = width;
- } else {
- pdf_reserve_object_id(pdev, piw->pres, gs_no_id);
- }
- /* Warning : If the substituted image used alternate streams,
- its space in the pdev->streams.strm file won't be released. */
- piw->pres->where_used |= pdev->used_mask;
- }
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/XObject", piw->pres);
- if (code < 0)
- return code;
- return 0;
+ cos_object_t *const pco = pres->object;
+ cos_stream_t *const pcs = (cos_stream_t *)pco;
+ cos_dict_t *named = piw->named;
+ int code;
+
+ if (named) {
+ if (pdev->ForOPDFRead) {
+ code = cos_dict_put_c_key_bool(named, "/.Global", true);
+ if (code < 0)
+ return code;
+ }
+ /*
+ * This image was named by NI. Copy any dictionary elements
+ * from the named dictionary to the image stream, and then
+ * associate the name with the stream.
+ */
+ code = cos_dict_move_all(cos_stream_dict(pcs), named);
+ if (code < 0)
+ return code;
+ pres->named = true;
+ /*
+ * We need to make the entry in the name dictionary point to
+ * the stream (pcs) rather than the object created by NI (named).
+ * Unfortunately, we no longer know what dictionary to use.
+ * Instead, overwrite the latter with the former's contents,
+ * and change the only relevant pointer.
+ */
+ *(cos_object_t *)named = *pco;
+ pres->object = COS_OBJECT(named);
+ } else if (!pres->named) { /* named objects are written at the end */
+ if (pdev->DetectDuplicateImages) {
+ pdf_x_object_t *pxo = (pdf_x_object_t *)piw->pres;
+ int height = pxo->height, width = pxo->width;
+
+ code = pdf_substitute_resource(pdev, &piw->pres, resourceXObject, NULL, false);
+ if (code < 0)
+ return code;
+
+ /* These values are related to the image matrix and should *not* be
+ * substituted if we found a duplicate image, or the matrix calculation
+ * will be incorrect! This only seems to matter for the PCL interpreter.
+ */
+ pxo = (pdf_x_object_t *)piw->pres;
+ pxo->height = height;
+ pxo->width = width;
+ } else {
+ pdf_reserve_object_id(pdev, piw->pres, gs_no_id);
+ }
+ /* Warning : If the substituted image used alternate streams,
+ its space in the pdev->streams.strm file won't be released. */
+ piw->pres->where_used |= pdev->used_mask;
+ }
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/XObject", piw->pres);
+ if (code < 0)
+ return code;
+ return 0;
} else { /* in-line image */
- stream *s = pdev->strm;
- uint KeyLength = pdev->KeyLength;
-
- stream_puts(s, "BI\n");
- cos_stream_elements_write(piw->data, pdev);
- stream_puts(s, (pdev->binary_ok ? "ID " : "ID\n"));
- pdev->KeyLength = 0; /* Disable encryption for the inline image. */
- cos_stream_contents_write(piw->data, pdev);
- pdev->KeyLength = KeyLength;
- pprints1(s, "\nEI%s\n", piw->end_string);
- COS_FREE(piw->data, "pdf_end_write_image");
- return 1;
+ stream *s = pdev->strm;
+ uint KeyLength = pdev->KeyLength;
+
+ stream_puts(s, "BI\n");
+ cos_stream_elements_write(piw->data, pdev);
+ stream_puts(s, (pdev->binary_ok ? "ID " : "ID\n"));
+ pdev->KeyLength = 0; /* Disable encryption for the inline image. */
+ cos_stream_contents_write(piw->data, pdev);
+ pdev->KeyLength = KeyLength;
+ pprints1(s, "\nEI%s\n", piw->end_string);
+ COS_FREE(piw->data, "pdf_end_write_image");
+ return 1;
}
}
@@ -562,30 +562,30 @@ pdf_end_write_image(gx_device_pdf * pdev, pdf_image_writer * piw)
/* Copy the data for a mask or monobit bitmap. */
int
pdf_copy_mask_bits(stream *s, const byte *base, int sourcex, int raster,
- int w, int h, byte invert)
+ int w, int h, byte invert)
{
int yi;
for (yi = 0; yi < h; ++yi) {
- const byte *data = base + yi * raster + (sourcex >> 3);
- int sbit = sourcex & 7;
-
- if (sbit == 0) {
- int nbytes = (w + 7) >> 3;
- int i;
-
- for (i = 0; i < nbytes; ++data, ++i)
- sputc(s, (byte)(*data ^ invert));
- } else {
- int wleft = w;
- int rbit = 8 - sbit;
-
- for (; wleft + sbit > 8; ++data, wleft -= 8)
- sputc(s, (byte)(((*data << sbit) + (data[1] >> rbit)) ^ invert));
- if (wleft > 0)
- sputc(s, (byte)(((*data << sbit) ^ invert) &
- (byte) (0xff00 >> wleft)));
- }
+ const byte *data = base + yi * raster + (sourcex >> 3);
+ int sbit = sourcex & 7;
+
+ if (sbit == 0) {
+ int nbytes = (w + 7) >> 3;
+ int i;
+
+ for (i = 0; i < nbytes; ++data, ++i)
+ sputc(s, (byte)(*data ^ invert));
+ } else {
+ int wleft = w;
+ int rbit = 8 - sbit;
+
+ for (; wleft + sbit > 8; ++data, wleft -= 8)
+ sputc(s, (byte)(((*data << sbit) + (data[1] >> rbit)) ^ invert));
+ if (wleft > 0)
+ sputc(s, (byte)(((*data << sbit) ^ invert) &
+ (byte) (0xff00 >> wleft)));
+ }
}
return 0;
}
@@ -593,15 +593,15 @@ pdf_copy_mask_bits(stream *s, const byte *base, int sourcex, int raster,
/* Copy the data for a colored image (device pixels). */
int
pdf_copy_color_bits(stream *s, const byte *base, int sourcex, int raster,
- int w, int h, int bytes_per_pixel)
+ int w, int h, int bytes_per_pixel)
{
int yi;
for (yi = 0; yi < h; ++yi) {
- uint ignore;
+ uint ignore;
- sputs(s, base + sourcex * bytes_per_pixel + yi * raster,
- w * bytes_per_pixel, &ignore);
+ sputs(s, base + sourcex * bytes_per_pixel + yi * raster,
+ w * bytes_per_pixel, &ignore);
}
return 0;
}
@@ -621,18 +621,18 @@ pdf_choose_compression_cos(pdf_image_writer *piw, cos_stream_t *s[2], bool force
l1 = cos_stream_length(s[1]);
if ((force && l0 <= l1) || l1 == -1)
- k0 = 1; /* Use Flate if it is not longer. Or if the DCT failed */
+ k0 = 1; /* Use Flate if it is not longer. Or if the DCT failed */
else {
- k0 = s_compr_chooser__get_choice(
- (stream_compr_chooser_state *)piw->binary[2].strm->state, force);
- if (k0 && l0 > 0 && l1 > 0)
- k0--;
- else if (much_bigger__DL(l0, l1))
- k0 = 0;
- else if (much_bigger__DL(l1, l0) || force)
- k0 = 1;
- else
- return;
+ k0 = s_compr_chooser__get_choice(
+ (stream_compr_chooser_state *)piw->binary[2].strm->state, force);
+ if (k0 && l0 > 0 && l1 > 0)
+ k0--;
+ else if (much_bigger__DL(l0, l1))
+ k0 = 0;
+ else if (much_bigger__DL(l1, l0) || force)
+ k0 = 1;
+ else
+ return;
}
k1 = 1 - k0;
s_close_filters(&piw->binary[k0].strm, piw->binary[k0].target);
@@ -646,9 +646,9 @@ pdf_choose_compression_cos(pdf_image_writer *piw, cos_stream_t *s[2], bool force
piw->pres->object = (cos_object_t *)s[k1];
piw->data = s[k1];
if (piw->alt_writer_count > 3) {
- piw->binary[1] = piw->binary[3];
- piw->binary[3].strm = 0; /* for GC */
- piw->binary[3].target = 0;
+ piw->binary[1] = piw->binary[3];
+ piw->binary[3].strm = 0; /* for GC */
+ piw->binary[3].target = 0;
}
piw->alt_writer_count -= 2;
}
@@ -661,14 +661,14 @@ pdf_choose_compression(pdf_image_writer * piw, bool end_binary)
s[0] = cos_stream_from_pipeline(piw->binary[0].strm);
s[1] = cos_stream_from_pipeline(piw->binary[1].strm);
if (end_binary) {
- int status;
-
- status = s_close_filters(&piw->binary[0].strm, piw->binary[0].target);
- if (status < 0)
- return_error(gs_error_ioerror);
- status = s_close_filters(&piw->binary[1].strm, piw->binary[1].target);
- if (status < 0)
- s[1]->length = -1;
+ int status;
+
+ status = s_close_filters(&piw->binary[0].strm, piw->binary[0].target);
+ if (status < 0)
+ return_error(gs_error_ioerror);
+ status = s_close_filters(&piw->binary[1].strm, piw->binary[1].target);
+ if (status < 0)
+ s[1]->length = -1;
}
pdf_choose_compression_cos(piw, s, end_binary);
return 0;
diff --git a/gs/base/gdevpdfk.c b/gs/base/gdevpdfk.c
index 01bf3c1ad..0618e50ea 100644
--- a/gs/base/gdevpdfk.c
+++ b/gs/base/gdevpdfk.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,30 +37,30 @@ pdf_cie_add_ranges(cos_dict_t *pcd, const gs_range *prange, int n, bool clamp)
int code = 0, i;
if (pca == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < n; ++i) {
- floatp rmin = prange[i].rmin, rmax = prange[i].rmax;
-
- if (clamp) {
- if (rmin < 0) rmin = 0;
- if (rmax > 1) rmax = 1;
- }
- if ((code = cos_array_add_real(pca, rmin)) < 0 ||
- (code = cos_array_add_real(pca, rmax)) < 0
- )
- break;
+ floatp rmin = prange[i].rmin, rmax = prange[i].rmax;
+
+ if (clamp) {
+ if (rmin < 0) rmin = 0;
+ if (rmax > 1) rmax = 1;
+ }
+ if ((code = cos_array_add_real(pca, rmin)) < 0 ||
+ (code = cos_array_add_real(pca, rmax)) < 0
+ )
+ break;
}
if (code >= 0)
- code = cos_dict_put_c_key_object(pcd, "/Range", COS_OBJECT(pca));
+ code = cos_dict_put_c_key_object(pcd, "/Range", COS_OBJECT(pca));
if (code < 0)
- COS_FREE(pca, "pdf_cie_add_ranges");
+ COS_FREE(pca, "pdf_cie_add_ranges");
return code;
}
/* Transform a CIEBased color to XYZ. */
static int
cie_to_xyz(const double *in, double out[3], const gs_color_space *pcs,
- const gs_imager_state *pis, const gs_cie_common *pciec)
+ const gs_imager_state *pis, const gs_cie_common *pciec)
{
gs_client_color cc;
frac xyz[3];
@@ -76,10 +76,10 @@ cie_to_xyz(const double *in, double out[3], const gs_color_space *pcs,
dev.device_icc_profile = pcs->cmm_icc_profile_data;
for (i = 0; i < ncomp; ++i)
- cc.paint.values[i] = in[i];
+ cc.paint.values[i] = in[i];
/* The standard concretization makes use of the equivalent ICC profile
- to ensure that all color management is handled by the CMM.
+ to ensure that all color management is handled by the CMM.
Unfortunately, we can't do that here since we have no access to the
icc manager. Also the PDF write outputs have restrictions on the
ICC profiles that can be embedded so we must use this older form.
@@ -133,9 +133,9 @@ static double
lab_g_inverse(double v)
{
if (v >= (6.0 * 6.0 * 6.0) / (29 * 29 * 29))
- return pow(v, 1.0 / 3); /* use cbrt if available? */
+ return pow(v, 1.0 / 3); /* use cbrt if available? */
else
- return (v * (841.0 / 108) + 4.0 / 29);
+ return (v * (841.0 / 108) + 4.0 / 29);
}
static void
xyz_to_lab(const double xyz[3], double lab[3], const gs_cie_common *pciec)
@@ -147,9 +147,9 @@ xyz_to_lab(const double xyz[3], double lab[3], const gs_cie_common *pciec)
L = lab_g_inverse(xyz[1] / pWhitePoint->v) * 116 - 16;
/* Clamp L* to the PDF range [0..100]. */
if (L < 0)
- L = 0;
+ L = 0;
else if (L > 100)
- L = 100;
+ L = 100;
lab[1] = L;
lunit = (L + 16) / 116;
@@ -161,8 +161,8 @@ xyz_to_lab(const double xyz[3], double lab[3], const gs_cie_common *pciec)
/* Create a PDF Lab color space corresponding to a CIEBased color space. */
static int
lab_range(gs_range range_out[3] /* only [1] and [2] used */,
- const gs_color_space *pcs, const gs_cie_common *pciec,
- const gs_range *ranges, gs_memory_t *mem)
+ const gs_color_space *pcs, const gs_cie_common *pciec,
+ const gs_range *ranges, gs_memory_t *mem)
{
/*
* Determine the range of a* and b* by evaluating the color space
@@ -174,23 +174,23 @@ lab_range(gs_range range_out[3] /* only [1] and [2] used */,
int i, j;
if (code < 0)
- return code;
+ return code;
for (j = 1; j < 3; ++j)
- range_out[j].rmin = 1000.0, range_out[j].rmax = -1000.0;
+ range_out[j].rmin = 1000.0, range_out[j].rmax = -1000.0;
for (i = 0; i < 1 << ncomp; ++i) {
- double in[4], xyz[3];
-
- for (j = 0; j < ncomp; ++j)
- in[j] = (i & (1 << j) ? ranges[j].rmax : ranges[j].rmin);
- if (cie_to_xyz(in, xyz, pcs, pis, pciec) >= 0) {
- double lab[3];
-
- xyz_to_lab(xyz, lab, pciec);
- for (j = 1; j < 3; ++j) {
- range_out[j].rmin = min(range_out[j].rmin, lab[j]);
- range_out[j].rmax = max(range_out[j].rmax, lab[j]);
- }
- }
+ double in[4], xyz[3];
+
+ for (j = 0; j < ncomp; ++j)
+ in[j] = (i & (1 << j) ? ranges[j].rmax : ranges[j].rmin);
+ if (cie_to_xyz(in, xyz, pcs, pis, pciec) >= 0) {
+ double lab[3];
+
+ xyz_to_lab(xyz, lab, pciec);
+ for (j = 1; j < 3; ++j) {
+ range_out[j].rmin = min(range_out[j].rmin, lab[j]);
+ range_out[j].rmax = max(range_out[j].rmax, lab[j]);
+ }
+ }
}
gx_cie_to_xyz_free(pis);
return 0;
@@ -201,13 +201,13 @@ lab_range(gs_range range_out[3] /* only [1] and [2] used */,
*/
int
pdf_put_lab_color_space(cos_array_t *pca, cos_dict_t *pcd,
- const gs_range ranges[3] /* only [1] and [2] used */)
+ const gs_range ranges[3] /* only [1] and [2] used */)
{
int code;
cos_value_t v;
if ((code = cos_array_add(pca, cos_c_string_value(&v, "/Lab"))) >= 0)
- code = pdf_cie_add_ranges(pcd, ranges + 1, 2, false);
+ code = pdf_cie_add_ranges(pcd, ranges + 1, 2, false);
return code;
}
@@ -217,8 +217,8 @@ pdf_put_lab_color_space(cos_array_t *pca, cos_dict_t *pcd,
*/
static int
pdf_convert_cie_to_lab(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_color_space *pcs,
- const gs_cie_common *pciec, const gs_range *prange)
+ const gs_color_space *pcs,
+ const gs_cie_common *pciec, const gs_range *prange)
{
cos_dict_t *pcd;
gs_range ranges[3];
@@ -228,12 +228,12 @@ pdf_convert_cie_to_lab(gx_device_pdf *pdev, cos_array_t *pca,
if (1) return_error(gs_error_rangecheck);
pcd = cos_dict_alloc(pdev, "pdf_convert_cie_to_lab(dict)");
if (pcd == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if ((code = lab_range(ranges, pcs, pciec, prange, pdev->pdf_memory)) < 0 ||
- (code = pdf_put_lab_color_space(pca, pcd, ranges)) < 0 ||
- (code = pdf_finish_cie_space(pca, pcd, pciec)) < 0
- )
- COS_FREE(pcd, "pdf_convert_cie_to_lab(dict)");
+ (code = pdf_put_lab_color_space(pca, pcd, ranges)) < 0 ||
+ (code = pdf_finish_cie_space(pca, pcd, pciec)) < 0
+ )
+ COS_FREE(pcd, "pdf_convert_cie_to_lab(dict)");
return code;
}
@@ -245,10 +245,10 @@ pdf_convert_cie_to_lab(gx_device_pdf *pdev, cos_array_t *pca,
*/
static int
pdf_make_iccbased(gx_device_pdf *pdev, cos_array_t *pca, int ncomps,
- const gs_range *prange /*[4]*/,
- const gs_color_space *pcs_alt,
- cos_stream_t **ppcstrm,
- const gs_range_t **pprange /* if scaling is needed */)
+ const gs_range *prange /*[4]*/,
+ const gs_color_space *pcs_alt,
+ cos_stream_t **ppcstrm,
+ const gs_range_t **pprange /* if scaling is needed */)
{
cos_value_t v;
@@ -261,19 +261,19 @@ pdf_make_iccbased(gx_device_pdf *pdev, cos_array_t *pca, int ncomps,
/* Check the ranges. */
if (pprange)
- *pprange = 0;
+ *pprange = 0;
for (i = 0; i < ncomps; ++i) {
- double rmin = prange[i].rmin, rmax = prange[i].rmax;
-
- if (rmin < 0.0 || rmax > 1.0) {
- /* We'll have to scale the inputs. :-( */
- if (pprange == 0)
- return_error(gs_error_rangecheck); /* scaling not allowed */
- *pprange = prange;
- scale_inputs = true;
- }
- else if (rmin > 0.0 || rmax < 1.0)
- std_ranges = false;
+ double rmin = prange[i].rmin, rmax = prange[i].rmax;
+
+ if (rmin < 0.0 || rmax > 1.0) {
+ /* We'll have to scale the inputs. :-( */
+ if (pprange == 0)
+ return_error(gs_error_rangecheck); /* scaling not allowed */
+ *pprange = prange;
+ scale_inputs = true;
+ }
+ else if (rmin > 0.0 || rmax < 1.0)
+ std_ranges = false;
}
/* Range values are a bit tricky to check.
@@ -286,24 +286,24 @@ pdf_make_iccbased(gx_device_pdf *pdev, cos_array_t *pca, int ncomps,
/* ICCBased color spaces are essentially copied to the output. */
if ((code = cos_array_add(pca, cos_c_string_value(&v, "/ICCBased"))) < 0)
- return code;
+ return code;
/* Create a stream for the output. */
if ((pcstrm = cos_stream_alloc(pdev, "pdf_make_iccbased(stream)")) == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
/* Indicate the number of components. */
code = cos_dict_put_c_key_int(cos_stream_dict(pcstrm), "/N", ncomps);
if (code < 0)
- goto fail;
+ goto fail;
/* Indicate the range, if needed. */
if (!std_ranges && !scale_inputs) {
- code = pdf_cie_add_ranges(cos_stream_dict(pcstrm), prange, ncomps, true);
- if (code < 0)
- goto fail;
+ code = pdf_cie_add_ranges(cos_stream_dict(pcstrm), prange, ncomps, true);
+ if (code < 0)
+ goto fail;
}
/* In the new design there may not be a specified alternate color space */
@@ -314,28 +314,28 @@ pdf_make_iccbased(gx_device_pdf *pdev, cos_array_t *pca, int ncomps,
case gs_color_space_index_DeviceGray:
case gs_color_space_index_DeviceRGB:
case gs_color_space_index_DeviceCMYK:
- break; /* implicit (default) */
+ break; /* implicit (default) */
default:
- if ((code = pdf_color_space_named(pdev, &v, NULL, pcs_alt,
- &pdf_color_space_names, false, NULL, 0)) < 0 ||
- (code = cos_dict_put_c_key(cos_stream_dict(pcstrm), "/Alternate",
- &v)) < 0
- )
- goto fail;
+ if ((code = pdf_color_space_named(pdev, &v, NULL, pcs_alt,
+ &pdf_color_space_names, false, NULL, 0)) < 0 ||
+ (code = cos_dict_put_c_key(cos_stream_dict(pcstrm), "/Alternate",
+ &v)) < 0
+ )
+ goto fail;
}
}
/* Wrap up. */
if ((code = cos_array_add_object(pca, COS_OBJECT(pcstrm))) < 0)
- goto fail;
+ goto fail;
*ppcstrm = pcstrm;
return code;
fail:
if (prngca)
- COS_FREE(prngca, "pdf_make_iccbased(Range)");
+ COS_FREE(prngca, "pdf_make_iccbased(Range)");
if (pcstrm)
- COS_FREE(pcstrm, "pdf_make_iccbased(stream)");
+ COS_FREE(pcstrm, "pdf_make_iccbased(stream)");
return code;
}
/*
@@ -365,14 +365,14 @@ struct profile_table_s {
const byte *data;
uint length;
uint data_length; /* may be < length if write != 0 */
- int (*write)(cos_stream_t *, const profile_table_t *, gs_memory_t *,
+ int (*write)(cos_stream_t *, const profile_table_t *, gs_memory_t *,
const gs_cie_common *pciec);
const void *write_data;
const gs_range_t *ranges;
};
static profile_table_t *
add_table(profile_table_t **ppnt, const char *tag, const byte *data,
- uint length)
+ uint length)
{
profile_table_t *pnt = (*ppnt)++;
@@ -398,7 +398,7 @@ set_XYZ(byte bytes[4], floatp value)
}
static void
add_table_xyz3(profile_table_t **ppnt, const char *tag, byte bytes[20],
- const gs_vector3 *pv)
+ const gs_vector3 *pv)
{
memcpy(bytes, "XYZ \000\000\000\000", 8);
set_XYZ(bytes + 8, pv->u);
@@ -412,9 +412,9 @@ set_sample16(byte *p, floatp v)
int value = (int)(v * 65535);
if (value < 0)
- value = 0;
+ value = 0;
else if (value > 65535)
- value = 65535;
+ value = 65535;
p[0] = (byte)(value >> 8);
p[1] = (byte)value;
}
@@ -423,7 +423,7 @@ static int write_trc_abc(cos_stream_t *, const profile_table_t *, gs_memory_t *,
static int write_trc_lmn(cos_stream_t *, const profile_table_t *, gs_memory_t *, const gs_cie_common *);
static profile_table_t *
add_trc(profile_table_t **ppnt, const char *tag, byte bytes[12],
- const gs_cie_common *pciec, cie_cache_one_step_t one_step)
+ const gs_cie_common *pciec, cie_cache_one_step_t one_step)
{
const int count = gx_cie_cache_size;
profile_table_t *pnt;
@@ -451,15 +451,15 @@ cache_arg(int i, int denom, const gs_range_t *range)
double arg = i / (double)denom;
if (range) {
- /* Sample over the range [range->rmin .. range->rmax]. */
- arg = arg * (range->rmax - range->rmin) + range->rmin;
+ /* Sample over the range [range->rmin .. range->rmax]. */
+ arg = arg * (range->rmax - range->rmin) + range->rmin;
}
return arg;
}
static int
write_trc_abc(cos_stream_t *pcstrm, const profile_table_t *pnt,
- gs_memory_t *ignore_mem, const gs_cie_common *unused)
+ gs_memory_t *ignore_mem, const gs_cie_common *unused)
{
/* Write the curve table from DecodeABC. */
const gs_cie_abc *pabc = pnt->write_data;
@@ -470,13 +470,13 @@ write_trc_abc(cos_stream_t *pcstrm, const profile_table_t *pnt,
int i;
for (i = 0; i < gx_cie_cache_size; ++i, p += 2)
- set_sample16(p, proc(cache_arg(i, gx_cie_cache_size - 1, pnt->ranges),
- pabc));
+ set_sample16(p, proc(cache_arg(i, gx_cie_cache_size - 1, pnt->ranges),
+ pabc));
return cos_stream_add_bytes(pcstrm, samples, gx_cie_cache_size * 2);
}
static int
write_trc_lmn(cos_stream_t *pcstrm, const profile_table_t *pnt,
- gs_memory_t *ignore_mem, const gs_cie_common *unused)
+ gs_memory_t *ignore_mem, const gs_cie_common *unused)
{
const gs_cie_common *pciec = pnt->write_data;
int ci = rgb_to_index(pnt);
@@ -487,8 +487,8 @@ write_trc_lmn(cos_stream_t *pcstrm, const profile_table_t *pnt,
/* Write the curve table from DecodeLMN. */
for (i = 0; i < gx_cie_cache_size; ++i, p += 2)
- set_sample16(p, proc(cache_arg(i, gx_cie_cache_size - 1, pnt->ranges),
- pciec));
+ set_sample16(p, proc(cache_arg(i, gx_cie_cache_size - 1, pnt->ranges),
+ pciec));
return cos_stream_add_bytes(pcstrm, samples, gx_cie_cache_size * 2);
}
/* Create and write an a2b0 lookup table. */
@@ -505,20 +505,20 @@ static int write_a2b0(cos_stream_t *, const profile_table_t *, gs_memory_t *,
const gs_cie_common *pciec);
static profile_table_t *
add_a2b0(profile_table_t **ppnt, icc_a2b0_t *pa2b, int ncomps,
- const gs_color_space *pcs)
+ const gs_color_space *pcs)
{
static const byte a2b0_data[sizeof(pa2b->header)] = {
- 'm', 'f', 't', '2', /* type signature */
- 0, 0, 0, 0, /* reserved, 0 */
- 0, /* # of input channels **VARIABLE** */
- 3, /* # of output channels */
- 0, /* # of CLUT points **VARIABLE** */
- 0, /* reserved, padding */
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* matrix column 0 */
- 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, /* matrix column 1 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* matrix column 2 */
- 0, NUM_IN_ENTRIES, /* # of input table entries */
- 0, NUM_OUT_ENTRIES /* # of output table entries */
+ 'm', 'f', 't', '2', /* type signature */
+ 0, 0, 0, 0, /* reserved, 0 */
+ 0, /* # of input channels **VARIABLE** */
+ 3, /* # of output channels */
+ 0, /* # of CLUT points **VARIABLE** */
+ 0, /* reserved, padding */
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* matrix column 0 */
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, /* matrix column 1 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /* matrix column 2 */
+ 0, NUM_IN_ENTRIES, /* # of input table entries */
+ 0, NUM_OUT_ENTRIES /* # of output table entries */
};
int num_points = (int)floor(pow(MAX_CLUT_ENTRIES, 1.0 / ncomps));
profile_table_t *pnt;
@@ -531,11 +531,11 @@ add_a2b0(profile_table_t **ppnt, icc_a2b0_t *pa2b, int ncomps,
pa2b->num_points = num_points;
pa2b->count = (int)pow(num_points, ncomps);
pnt = add_table(ppnt, "A2B0", pa2b->header,
- sizeof(pa2b->header) +
- ncomps * 2 * NUM_IN_ENTRIES + /* in */
- pa2b->count * (3 * 2) + /* clut: XYZ, 16-bit values */
- 3 * 2 * NUM_OUT_ENTRIES /* out */
- );
+ sizeof(pa2b->header) +
+ ncomps * 2 * NUM_IN_ENTRIES + /* in */
+ pa2b->count * (3 * 2) + /* clut: XYZ, 16-bit values */
+ 3 * 2 * NUM_OUT_ENTRIES /* out */
+ );
pnt->data_length = sizeof(pa2b->header); /* only write fixed part */
pnt->write = write_a2b0;
pnt->write_data = pa2b;
@@ -543,7 +543,7 @@ add_a2b0(profile_table_t **ppnt, icc_a2b0_t *pa2b, int ncomps,
}
static int
write_a2b0(cos_stream_t *pcstrm, const profile_table_t *pnt,
- gs_memory_t *mem, const gs_cie_common *pciec)
+ gs_memory_t *mem, const gs_cie_common *pciec)
{
const icc_a2b0_t *pa2b = pnt->write_data;
const gs_color_space *pcs = pa2b->pcs;
@@ -552,7 +552,7 @@ write_a2b0(cos_stream_t *pcstrm, const profile_table_t *pnt,
int i;
#define MAX_NCOMPS 4 /* CIEBasedDEFG */
static const byte v01[MAX_NCOMPS * 2 * 2] = {
- 0,0, 255,255, 0,0, 255,255, 0,0, 255,255, 0,0, 255,255
+ 0,0, 255,255, 0,0, 255,255, 0,0, 255,255, 0,0, 255,255
};
gs_imager_state *pis;
int code;
@@ -560,41 +560,41 @@ write_a2b0(cos_stream_t *pcstrm, const profile_table_t *pnt,
/* Write the input table. */
if ((code = cos_stream_add_bytes(pcstrm, v01, ncomps * 4)) < 0
- )
- return code;
+ )
+ return code;
/* Write the lookup table. */
code = gx_cie_to_xyz_alloc(&pis, pcs, mem);
if (code < 0)
- return code;
+ return code;
for (i = 0; i < pa2b->count; ++i) {
- double in[MAX_NCOMPS], xyz[3];
- byte entry[3 * 2];
- byte *p = entry;
- int n, j;
-
- for (n = i, j = ncomps - 1; j >= 0; --j, n /= num_points)
- in[j] = cache_arg(n % num_points, num_points - 1,
- (pnt->ranges ? pnt->ranges + j : NULL));
- cie_to_xyz(in, xyz, pcs, pis, pciec);
- /*
- * NOTE: Due to an obscure provision of the ICC Profile
- * specification, values in a2b0 lookup tables do *not* represent
- * the range [0 .. 1], but rather the range [0
- * .. MAX_ICC_XYZ_VALUE]. This caused us a lot of grief before we
- * figured it out!
- */
+ double in[MAX_NCOMPS], xyz[3];
+ byte entry[3 * 2];
+ byte *p = entry;
+ int n, j;
+
+ for (n = i, j = ncomps - 1; j >= 0; --j, n /= num_points)
+ in[j] = cache_arg(n % num_points, num_points - 1,
+ (pnt->ranges ? pnt->ranges + j : NULL));
+ cie_to_xyz(in, xyz, pcs, pis, pciec);
+ /*
+ * NOTE: Due to an obscure provision of the ICC Profile
+ * specification, values in a2b0 lookup tables do *not* represent
+ * the range [0 .. 1], but rather the range [0
+ * .. MAX_ICC_XYZ_VALUE]. This caused us a lot of grief before we
+ * figured it out!
+ */
#define MAX_ICC_XYZ_VALUE (1 + 32767.0/32768)
- for (j = 0; j < 3; ++j, p += 2)
- set_sample16(p, xyz[j] / MAX_ICC_XYZ_VALUE);
+ for (j = 0; j < 3; ++j, p += 2)
+ set_sample16(p, xyz[j] / MAX_ICC_XYZ_VALUE);
#undef MAX_ICC_XYZ_VALUE
- if ((code = cos_stream_add_bytes(pcstrm, entry, sizeof(entry))) < 0)
- break;
+ if ((code = cos_stream_add_bytes(pcstrm, entry, sizeof(entry))) < 0)
+ break;
}
gx_cie_to_xyz_free(pis);
if (code < 0)
- return code;
+ return code;
/* Write the output table. */
@@ -603,7 +603,7 @@ write_a2b0(cos_stream_t *pcstrm, const profile_table_t *pnt,
/* XYZ wp mapping for now. Will replace later with Bradford or other */
static void
-adjust_wp(const gs_vector3 *color_in, const gs_vector3 *wp_in,
+adjust_wp(const gs_vector3 *color_in, const gs_vector3 *wp_in,
gs_vector3 *color_out, const gs_vector3 *wp_out)
{
color_out->u = color_in->u * wp_out->u / wp_in->u;
@@ -613,10 +613,10 @@ adjust_wp(const gs_vector3 *color_in, const gs_vector3 *wp_in,
static int
pdf_convert_cie_to_iccbased(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_color_space *pcs, const char *dcsname,
- const gs_cie_common *pciec, const gs_range *prange,
- cie_cache_one_step_t one_step,
- const gs_matrix3 *pmat, const gs_range_t **pprange)
+ const gs_color_space *pcs, const char *dcsname,
+ const gs_cie_common *pciec, const gs_range *prange,
+ cie_cache_one_step_t one_step,
+ const gs_matrix3 *pmat, const gs_range_t **pprange)
{
/*
* We have two options for creating an ICCBased color space to represent
@@ -639,41 +639,41 @@ pdf_convert_cie_to_iccbased(gx_device_pdf *pdev, cos_array_t *pca,
/* Header */
byte header[128];
static const byte header_data[] = {
- 0, 0, 0, 0, /* profile size **VARIABLE** */
- 0, 0, 0, 0, /* CMM type signature */
- 0x02, 0x20, 0, 0, /* profile version number */
- 's', 'c', 'n', 'r', /* profile class signature */
- 0, 0, 0, 0, /* data color space **VARIABLE** */
- 'X', 'Y', 'Z', ' ', /* connection color space */
- 2002 / 256, 2002 % 256, 0, 1, 0, 1, /* date (1/1/2002) */
- 0, 0, 0, 0, 0, 0, /* time */
- 'a', 'c', 's', 'p', /* profile file signature */
- 0, 0, 0, 0, /* primary platform signature */
- 0, 0, 0, 3, /* profile flags (embedded use only) */
- 0, 0, 0, 0, 0, 0, 0, 0, /* device manufacturer */
- 0, 0, 0, 0, /* device model */
- 0, 0, 0, 0, 0, 0, 0, 2 /* device attributes */
- /* Remaining fields are zero or variable. */
- /* [4] */ /* rendering intent */
- /* 3 * [4] */ /* illuminant */
+ 0, 0, 0, 0, /* profile size **VARIABLE** */
+ 0, 0, 0, 0, /* CMM type signature */
+ 0x02, 0x20, 0, 0, /* profile version number */
+ 's', 'c', 'n', 'r', /* profile class signature */
+ 0, 0, 0, 0, /* data color space **VARIABLE** */
+ 'X', 'Y', 'Z', ' ', /* connection color space */
+ 2002 / 256, 2002 % 256, 0, 1, 0, 1, /* date (1/1/2002) */
+ 0, 0, 0, 0, 0, 0, /* time */
+ 'a', 'c', 's', 'p', /* profile file signature */
+ 0, 0, 0, 0, /* primary platform signature */
+ 0, 0, 0, 3, /* profile flags (embedded use only) */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* device manufacturer */
+ 0, 0, 0, 0, /* device model */
+ 0, 0, 0, 0, 0, 0, 0, 2 /* device attributes */
+ /* Remaining fields are zero or variable. */
+ /* [4] */ /* rendering intent */
+ /* 3 * [4] */ /* illuminant */
};
/* Description */
#define DESC_LENGTH 5 /* "adhoc" */
byte desc[12 + DESC_LENGTH + 1 + 11 + 67];
static const byte desc_data[] = {
- 'd', 'e', 's', 'c', /* type signature */
- 0, 0, 0, 0, /* reserved, 0 */
- 0, 0, 0, DESC_LENGTH + 1, /* ASCII description length */
- 'a', 'd', 'h', 'o', 'c', 0, /* ASCII description */
- /* Remaining fields are zero. */
+ 'd', 'e', 's', 'c', /* type signature */
+ 0, 0, 0, 0, /* reserved, 0 */
+ 0, 0, 0, DESC_LENGTH + 1, /* ASCII description length */
+ 'a', 'd', 'h', 'o', 'c', 0, /* ASCII description */
+ /* Remaining fields are zero. */
};
/* White point */
byte wtpt[20];
/* Copyright (useless, but required by icclib) */
static const byte cprt_data[] = {
- 't', 'e', 'x', 't', /* type signature */
- 0, 0, 0, 0, /* reserved, 0 */
- 'n', 'o', 'n', 'e', 0 /* must be null-terminated (!) */
+ 't', 'e', 'x', 't', /* type signature */
+ 0, 0, 0, 0, /* reserved, 0 */
+ 'n', 'o', 'n', 'e', 0 /* must be null-terminated (!) */
};
/* Lookup table */
icc_a2b0_t a2b0;
@@ -693,10 +693,10 @@ pdf_convert_cie_to_iccbased(gx_device_pdf *pdev, cos_array_t *pca,
pdf_cspace_init_Device(pdev->memory, &alt_space, ncomps); /* can't fail */
code = pdf_make_iccbased(pdev, pca, ncomps, prange, alt_space,
- &pcstrm, pprange);
+ &pcstrm, pprange);
rc_decrement_cs(alt_space, "pdf_convert_cie_to_iccbased");
if (code < 0)
- return code;
+ return code;
/* Fill in most of the header, except for the total size. */
@@ -721,69 +721,69 @@ pdf_convert_cie_to_iccbased(gx_device_pdf *pdev, cos_array_t *pca,
/* Use TRC + XYZ if possible, otherwise AToB. */
if ((one_step == ONE_STEP_ABC || one_step == ONE_STEP_LMN) && pmat != 0) {
- /* Use TRC + XYZ. */
- profile_table_t *tr =
- add_trc(&next_table, "rTRC", rTRC, pciec, one_step);
- profile_table_t *tg =
- add_trc(&next_table, "gTRC", gTRC, pciec, one_step);
- profile_table_t *tb =
- add_trc(&next_table, "bTRC", bTRC, pciec, one_step);
-
- if (*pprange) {
- tr->ranges = *pprange;
- tg->ranges = *pprange + 1;
- tb->ranges = *pprange + 2;
- }
+ /* Use TRC + XYZ. */
+ profile_table_t *tr =
+ add_trc(&next_table, "rTRC", rTRC, pciec, one_step);
+ profile_table_t *tg =
+ add_trc(&next_table, "gTRC", gTRC, pciec, one_step);
+ profile_table_t *tb =
+ add_trc(&next_table, "bTRC", bTRC, pciec, one_step);
+
+ if (*pprange) {
+ tr->ranges = *pprange;
+ tg->ranges = *pprange + 1;
+ tb->ranges = *pprange + 2;
+ }
/* These values need to be adjusted to D50. Again
use XYZ wp mapping for now. Later we will add in
the bradford stuff */
adjust_wp(&(pmat->cu), &(pciec->points.WhitePoint), &temp_xyz, &white_d50);
- add_table_xyz3(&next_table, "rXYZ", rXYZ, &temp_xyz);
+ add_table_xyz3(&next_table, "rXYZ", rXYZ, &temp_xyz);
adjust_wp(&(pmat->cv), &(pciec->points.WhitePoint), &temp_xyz, &white_d50);
- add_table_xyz3(&next_table, "gXYZ", gXYZ, &temp_xyz);
+ add_table_xyz3(&next_table, "gXYZ", gXYZ, &temp_xyz);
adjust_wp(&(pmat->cw), &(pciec->points.WhitePoint), &temp_xyz, &white_d50);
- add_table_xyz3(&next_table, "bXYZ", bXYZ, &temp_xyz);
+ add_table_xyz3(&next_table, "bXYZ", bXYZ, &temp_xyz);
} else {
- /* General case, use a lookup table. */
- /* AToB (mft2) */
- profile_table_t *pnt = add_a2b0(&next_table, &a2b0, ncomps, pcs);
+ /* General case, use a lookup table. */
+ /* AToB (mft2) */
+ profile_table_t *pnt = add_a2b0(&next_table, &a2b0, ncomps, pcs);
- pnt->ranges = *pprange;
+ pnt->ranges = *pprange;
}
/* Write the profile. */
{
- byte bytes[4 + MAX_NUM_TABLES * 12];
- int num_tables = next_table - tables;
- int i;
- byte *p;
- uint table_size = 4 + num_tables * 12;
- uint offset = sizeof(header) + table_size;
-
- set_uint32(bytes, next_table - tables);
- for (i = 0, p = bytes + 4; i < num_tables; ++i, p += 12) {
- memcpy(p, tables[i].tag, 4);
- set_uint32(p + 4, offset);
- set_uint32(p + 8, tables[i].length);
- offset += round_up(tables[i].length, 4);
- }
- set_uint32(header, offset);
- if ((code = cos_stream_add_bytes(pcstrm, header, sizeof(header))) < 0 ||
- (code = cos_stream_add_bytes(pcstrm, bytes, table_size)) < 0
- )
- return code;
- for (i = 0; i < num_tables; ++i) {
- uint len = tables[i].data_length;
- static const byte pad[3] = {0, 0, 0};
-
- if ((code = cos_stream_add_bytes(pcstrm, tables[i].data, len)) < 0 ||
- (tables[i].write != 0 &&
- (code = tables[i].write(pcstrm, &tables[i], pdev->pdf_memory, pciec)) < 0) ||
- (code = cos_stream_add_bytes(pcstrm, pad,
- -(int)(tables[i].length) & 3)) < 0
- )
- return code;
- }
+ byte bytes[4 + MAX_NUM_TABLES * 12];
+ int num_tables = next_table - tables;
+ int i;
+ byte *p;
+ uint table_size = 4 + num_tables * 12;
+ uint offset = sizeof(header) + table_size;
+
+ set_uint32(bytes, next_table - tables);
+ for (i = 0, p = bytes + 4; i < num_tables; ++i, p += 12) {
+ memcpy(p, tables[i].tag, 4);
+ set_uint32(p + 4, offset);
+ set_uint32(p + 8, tables[i].length);
+ offset += round_up(tables[i].length, 4);
+ }
+ set_uint32(header, offset);
+ if ((code = cos_stream_add_bytes(pcstrm, header, sizeof(header))) < 0 ||
+ (code = cos_stream_add_bytes(pcstrm, bytes, table_size)) < 0
+ )
+ return code;
+ for (i = 0; i < num_tables; ++i) {
+ uint len = tables[i].data_length;
+ static const byte pad[3] = {0, 0, 0};
+
+ if ((code = cos_stream_add_bytes(pcstrm, tables[i].data, len)) < 0 ||
+ (tables[i].write != 0 &&
+ (code = tables[i].write(pcstrm, &tables[i], pdev->pdf_memory, pciec)) < 0) ||
+ (code = cos_stream_add_bytes(pcstrm, pad,
+ -(int)(tables[i].length) & 3)) < 0
+ )
+ return code;
+ }
}
return pdf_finish_iccbased(pcstrm);
@@ -797,7 +797,7 @@ pdf_convert_cie_to_iccbased(gx_device_pdf *pdev, cos_array_t *pca,
*/
int
pdf_iccbased_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
- const gs_color_space *pcs, cos_array_t *pca)
+ const gs_color_space *pcs, cos_array_t *pca)
{
/*
* This would arise only in a pdf ==> pdf translation, but we
@@ -805,21 +805,21 @@ pdf_iccbased_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
*/
cos_stream_t * pcstrm;
int code =
- pdf_make_iccbased(pdev, pca, pcs->cmm_icc_profile_data->num_comps,
- pcs->cmm_icc_profile_data->Range.ranges,
- pcs->base_space,
- &pcstrm, NULL);
+ pdf_make_iccbased(pdev, pca, pcs->cmm_icc_profile_data->num_comps,
+ pcs->cmm_icc_profile_data->Range.ranges,
+ pcs->base_space,
+ &pcstrm, NULL);
if (code < 0)
- return code;
+ return code;
/* Transfer the buffer data */
- code = cos_stream_add_bytes(pcstrm, pcs->cmm_icc_profile_data->buffer,
+ code = cos_stream_add_bytes(pcstrm, pcs->cmm_icc_profile_data->buffer,
pcs->cmm_icc_profile_data->buffer_size);
if (code >= 0)
- code = pdf_finish_iccbased(pcstrm);
+ code = pdf_finish_iccbased(pcstrm);
/*
* The stream has been added to the array: in case of failure, the
* caller will free the array, so there is no need to free the stream
@@ -831,16 +831,16 @@ pdf_iccbased_color_space(gx_device_pdf *pdev, cos_value_t *pvalue,
/* Convert a CIEBased space to Lab or ICCBased. */
int
pdf_convert_cie_space(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_color_space *pcs, const char *dcsname,
- const gs_cie_common *pciec, const gs_range *prange,
- cie_cache_one_step_t one_step, const gs_matrix3 *pmat,
- const gs_range_t **pprange)
+ const gs_color_space *pcs, const char *dcsname,
+ const gs_cie_common *pciec, const gs_range *prange,
+ cie_cache_one_step_t one_step, const gs_matrix3 *pmat,
+ const gs_range_t **pprange)
{
return (pdev->CompatibilityLevel < 1.3 ?
- /* PDF 1.2 or earlier, use a Lab space. */
- pdf_convert_cie_to_lab(pdev, pca, pcs, pciec, prange) :
- /* PDF 1.3 or later, use an ICCBased space. */
- pdf_convert_cie_to_iccbased(pdev, pca, pcs, dcsname, pciec, prange,
- one_step, pmat, pprange)
- );
+ /* PDF 1.2 or earlier, use a Lab space. */
+ pdf_convert_cie_to_lab(pdev, pca, pcs, pciec, prange) :
+ /* PDF 1.3 or later, use an ICCBased space. */
+ pdf_convert_cie_to_iccbased(pdev, pca, pcs, dcsname, pciec, prange,
+ one_step, pmat, pprange)
+ );
}
diff --git a/gs/base/gdevpdfm.c b/gs/base/gdevpdfm.c
index f335a7f67..8ad76fd6b 100644
--- a/gs/base/gdevpdfm.c
+++ b/gs/base/gdevpdfm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,11 +41,11 @@ private_st_pdf_article();
#define PDFMARK_NAMEABLE 1 /* allows _objdef */
#define PDFMARK_ODD_OK 2 /* OK if odd # of parameters */
#define PDFMARK_KEEP_NAME 4 /* don't substitute reference for name */
- /* in 1st argument */
+ /* in 1st argument */
#define PDFMARK_NO_REFS 8 /* don't substitute references for names */
- /* anywhere */
+ /* anywhere */
#define PDFMARK_TRUECTM 16 /* pass the true CTM to the procedure, */
- /* not the one transformed to reflect the default user space */
+ /* not the one transformed to reflect the default user space */
typedef struct pdfmark_name_s {
const char *mname;
pdfmark_proc((*proc));
@@ -59,7 +59,7 @@ bool
pdf_key_eq(const gs_param_string * pcs, const char *str)
{
return (strlen(str) == pcs->size &&
- !strncmp(str, (const char *)pcs->data, pcs->size));
+ !strncmp(str, (const char *)pcs->data, pcs->size));
}
/* Scan an integer out of a parameter string. */
@@ -71,11 +71,11 @@ pdfmark_scan_int(const gs_param_string * pstr, int *pvalue)
char str[MAX_INT_STR + 1];
if (size > MAX_INT_STR)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
memcpy(str, pstr->data, size);
str[size] = 0;
return (sscanf(str, "%d", pvalue) == 1 ? 0 :
- gs_note_error(gs_error_rangecheck));
+ gs_note_error(gs_error_rangecheck));
#undef MAX_INT_STR
}
@@ -84,15 +84,15 @@ pdfmark_scan_int(const gs_param_string * pstr, int *pvalue)
/* Find a key in a dictionary. */
static bool
pdfmark_find_key(const char *key, const gs_param_string * pairs, uint count,
- gs_param_string * pstr)
+ gs_param_string * pstr)
{
uint i;
for (i = 0; i < count; i += 2)
- if (pdf_key_eq(&pairs[i], key)) {
- *pstr = pairs[i + 1];
- return true;
- }
+ if (pdf_key_eq(&pairs[i], key)) {
+ *pstr = pairs[i + 1];
+ return true;
+ }
pstr->data = 0;
pstr->size = 0;
return false;
@@ -109,13 +109,13 @@ pdfmark_page_number(gx_device_pdf * pdev, const gs_param_string * pnstr)
if (pnstr->data == 0);
else if (pdf_key_eq(pnstr, "/Next"))
- ++page;
+ ++page;
else if (pdf_key_eq(pnstr, "/Prev"))
- --page;
+ --page;
else if (pdfmark_scan_int(pnstr, &page) < 0)
- page = 0;
+ page = 0;
if (pdev->max_referred_page < page)
- pdev->max_referred_page = page;
+ pdev->max_referred_page = page;
return page;
}
@@ -124,36 +124,36 @@ pdfmark_page_number(gx_device_pdf * pdev, const gs_param_string * pnstr)
/* (1 if only one of /Page or /View, 2 if both), <0 if error. */
static int
pdfmark_make_dest(char dstr[MAX_DEST_STRING], gx_device_pdf * pdev,
- const char *Page_key, const char *View_key,
- const gs_param_string * pairs, uint count, uint RequirePage)
+ const char *Page_key, const char *View_key,
+ const gs_param_string * pairs, uint count, uint RequirePage)
{
gs_param_string page_string, view_string;
int present =
- pdfmark_find_key(Page_key, pairs, count, &page_string) +
- pdfmark_find_key(View_key, pairs, count, &view_string);
+ pdfmark_find_key(Page_key, pairs, count, &page_string) +
+ pdfmark_find_key(View_key, pairs, count, &view_string);
int page=0;
gs_param_string action;
int len;
if (present || RequirePage)
- page = pdfmark_page_number(pdev, &page_string);
+ page = pdfmark_page_number(pdev, &page_string);
if (view_string.size == 0)
- param_string_from_string(view_string, "[/XYZ null null null]");
+ param_string_from_string(view_string, "[/XYZ null null null]");
if (page == 0)
- strcpy(dstr, "[null ");
+ strcpy(dstr, "[null ");
else if (pdfmark_find_key("/Action", pairs, count, &action) &&
- pdf_key_eq(&action, "/GoToR")
- )
- sprintf(dstr, "[%d ", page - 1);
+ pdf_key_eq(&action, "/GoToR")
+ )
+ sprintf(dstr, "[%d ", page - 1);
else
- sprintf(dstr, "[%ld 0 R ", pdf_page_id(pdev, page));
+ sprintf(dstr, "[%ld 0 R ", pdf_page_id(pdev, page));
len = strlen(dstr);
if (len + view_string.size > MAX_DEST_STRING)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
if (view_string.data[0] != '[' ||
- view_string.data[view_string.size - 1] != ']'
- )
- return_error(gs_error_rangecheck);
+ view_string.data[view_string.size - 1] != ']'
+ )
+ return_error(gs_error_rangecheck);
memcpy(dstr + len, view_string.data + 1, view_string.size - 1);
dstr[len + view_string.size - 1] = 0;
return present;
@@ -170,7 +170,7 @@ pdfmark_coerce_dest(gs_param_string *dstr, char dest[MAX_DEST_STRING])
uint size = dstr->size;
if (size == 0 || data[0] != '(')
- return 0;
+ return 0;
/****** HANDLE ESCAPES ******/
memcpy(dest, data, size - 1);
dest[0] = '/';
@@ -183,7 +183,7 @@ pdfmark_coerce_dest(gs_param_string *dstr, char dest[MAX_DEST_STRING])
/* Put pairs in a dictionary. */
static int
pdfmark_put_c_pair(cos_dict_t *pcd, const char *key,
- const gs_param_string * pvalue)
+ const gs_param_string * pvalue)
{
return cos_dict_put_c_key_string(pcd, key, pvalue->data, pvalue->size);
}
@@ -191,13 +191,13 @@ static int
pdfmark_put_pair(cos_dict_t *pcd, const gs_param_string * pair)
{
return cos_dict_put_string(pcd, pair->data, pair->size,
- pair[1].data, pair[1].size);
+ pair[1].data, pair[1].size);
}
/* Scan a Rect value. */
static int
pdfmark_scan_rect(gs_rect * prect, const gs_param_string * str,
- const gs_matrix * pctm)
+ const gs_matrix * pctm)
{
uint size = str->size;
double v[4];
@@ -206,13 +206,13 @@ pdfmark_scan_rect(gs_rect * prect, const gs_param_string * str,
int end_check;
if (str->size > MAX_RECT_STRING)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
memcpy(chars, str->data, size);
strcpy(chars + size, " 0");
if (sscanf(chars, "[%lg %lg %lg %lg]%d",
- &v[0], &v[1], &v[2], &v[3], &end_check) != 5
- )
- return_error(gs_error_rangecheck);
+ &v[0], &v[1], &v[2], &v[3], &end_check) != 5
+ )
+ return_error(gs_error_rangecheck);
gs_point_transform(v[0], v[1], pctm, &prect->p);
gs_point_transform(v[2], v[3], pctm, &prect->q);
return 0;
@@ -232,14 +232,14 @@ pdfmark_make_rect(char str[MAX_RECT_STRING], const gs_rect * prect)
s_init(&s, NULL);
swrite_string(&s, (byte *)str, MAX_RECT_STRING - 1);
pprintg4(&s, "[%g %g %g %g]",
- prect->p.x, prect->p.y, prect->q.x, prect->q.y);
+ prect->p.x, prect->p.y, prect->q.x, prect->q.y);
str[stell(&s)] = 0;
}
/* Write a transformed Border value on a stream. */
static int
pdfmark_write_border(stream *s, const gs_param_string *str,
- const gs_matrix *pctm)
+ const gs_matrix *pctm)
{
/*
* We don't preserve the entire CTM in the output, and it isn't clear
@@ -254,11 +254,11 @@ pdfmark_write_border(stream *s, const gs_param_string *str,
const char *next;
if (str->size > MAX_BORDER_STRING)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
memcpy(chars, str->data, size);
chars[size] = 0;
if (sscanf(chars, "[%lg %lg %lg", &bx, &by, &c) != 3)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
gs_distance_transform(bx, by, pctm, &bpt);
gs_distance_transform(0.0, c, pctm, &cpt);
pprintg3(s, "[%g %g %g", fabs(bpt.x), fabs(bpt.y), fabs(cpt.x + cpt.y));
@@ -268,20 +268,20 @@ pdfmark_write_border(stream *s, const gs_param_string *str,
*/
next = strchr(chars + 1, ']');
if (next == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (next[1] != 0) {
- /* Handle a dash array. This is tiresome. */
- double v;
-
- stream_putc(s, '[');
- while (next != 0 && sscanf(++next, "%lg", &v) == 1) {
- gs_point vpt;
-
- gs_distance_transform(0.0, v, pctm, &vpt);
- pprintg1(s, "%g ", fabs(vpt.x + vpt.y));
- next = strchr(next, ' ');
- }
- stream_putc(s, ']');
+ /* Handle a dash array. This is tiresome. */
+ double v;
+
+ stream_putc(s, '[');
+ while (next != 0 && sscanf(++next, "%lg", &v) == 1) {
+ gs_point vpt;
+
+ gs_distance_transform(0.0, v, pctm, &vpt);
+ pprintg1(s, "%g ", fabs(vpt.x + vpt.y));
+ next = strchr(next, ' ');
+ }
+ stream_putc(s, ']');
}
stream_putc(s, ']');
return 0;
@@ -297,40 +297,40 @@ cos_stream_put_c_strings(cos_stream_t *pcs, const char *key, const char *value)
/* Setup pdfmak stream compression. */
static int
setup_pdfmark_stream_compression(gx_device_psdf *pdev0,
- cos_stream_t *pco)
+ cos_stream_t *pco)
{
/* This function is for pdfwrite only. */
gx_device_pdf *pdev = (gx_device_pdf *)pdev0;
gs_memory_t *mem = pdev->pdf_memory;
static const pdf_filter_names_t fnames = {
- PDF_FILTER_NAMES
+ PDF_FILTER_NAMES
};
const stream_template *template =
- (pdev->params.UseFlateCompression &&
- pdev->version >= psdf_version_ll3 ?
- &s_zlibE_template : &s_LZWE_template);
+ (pdev->params.UseFlateCompression &&
+ pdev->version >= psdf_version_ll3 ?
+ &s_zlibE_template : &s_LZWE_template);
stream_state *st;
pco->input_strm = cos_write_stream_alloc(pco, pdev,
- "setup_pdfmark_stream_compression");
+ "setup_pdfmark_stream_compression");
if (pco->input_strm == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!pdev->binary_ok) {
- stream_state *ss = s_alloc_state(mem, s_A85E_template.stype,
- "setup_pdfmark_stream_compression");
- if (ss == 0)
- return_error(gs_error_VMerror);
- if (s_add_filter(&pco->input_strm, &s_A85E_template, ss, mem) == 0) {
- gs_free_object(mem, ss, "setup_image_compression");
- return_error(gs_error_VMerror);
- }
+ stream_state *ss = s_alloc_state(mem, s_A85E_template.stype,
+ "setup_pdfmark_stream_compression");
+ if (ss == 0)
+ return_error(gs_error_VMerror);
+ if (s_add_filter(&pco->input_strm, &s_A85E_template, ss, mem) == 0) {
+ gs_free_object(mem, ss, "setup_image_compression");
+ return_error(gs_error_VMerror);
+ }
}
- st = s_alloc_state(mem, template->stype,
- "setup_pdfmark_stream_compression");
+ st = s_alloc_state(mem, template->stype,
+ "setup_pdfmark_stream_compression");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (template->set_defaults)
- (*template->set_defaults) (st);
+ (*template->set_defaults) (st);
if (s_add_filter(&pco->input_strm, template, st, mem) == 0) {
gs_free_object(mem, st, "setup_image_compression");
return_error(gs_error_VMerror);
@@ -339,61 +339,60 @@ setup_pdfmark_stream_compression(gx_device_psdf *pdev0,
}
static int
-pdfmark_bind_named_object(gx_device_pdf *pdev, const gs_const_string *objname,
- pdf_resource_t **pres)
+pdfmark_bind_named_object(gx_device_pdf *pdev, const gs_const_string *objname,
+ pdf_resource_t **pres)
{
- int code;
+ int code;
if (objname != NULL && objname->size) {
- const cos_value_t *v = cos_dict_find(pdev->local_named_objects, objname->data, objname->size);
-
- if (v != NULL) {
- if (v->value_type == COS_VALUE_OBJECT) {
- if (cos_type(v->contents.object) == &cos_generic_procs) {
- /* The object was referred but not defined.
- Use the old object id.
- The old object stub to be dropped. */
- pdf_reserve_object_id(pdev, *pres, v->contents.object->id);
- } else if (!v->contents.object->written) {
- /* We can't know whether the old object was referred or not.
- Write it out for a consistent result in any case. */
- code = cos_write_object(v->contents.object, pdev, resourceOther);
-
- if (code < 0)
- return code;
- v->contents.object->written = true;
- }
- } else
- return_error(gs_error_rangecheck); /* Must not happen. */
- }
+ const cos_value_t *v = cos_dict_find(pdev->local_named_objects, objname->data, objname->size);
+
+ if (v != NULL) {
+ if (v->value_type == COS_VALUE_OBJECT) {
+ if (cos_type(v->contents.object) == &cos_generic_procs) {
+ /* The object was referred but not defined.
+ Use the old object id.
+ The old object stub to be dropped. */
+ pdf_reserve_object_id(pdev, *pres, v->contents.object->id);
+ } else if (!v->contents.object->written) {
+ /* We can't know whether the old object was referred or not.
+ Write it out for a consistent result in any case. */
+ code = cos_write_object(v->contents.object, pdev, resourceOther);
+
+ if (code < 0)
+ return code;
+ v->contents.object->written = true;
+ }
+ } else
+ return_error(gs_error_rangecheck); /* Must not happen. */
+ }
}
if ((*pres)->object->id == -1) {
- if(objname != NULL && objname->size)
- code = pdf_substitute_resource(pdev, pres, resourceXObject, NULL, false);
- else
- code = pdf_substitute_resource(pdev, pres, resourceXObject, NULL, true);
- (*pres)->where_used |= pdev->used_mask;
- if (code < 0)
- return code;
+ if(objname != NULL && objname->size)
+ code = pdf_substitute_resource(pdev, pres, resourceXObject, NULL, false);
+ else
+ code = pdf_substitute_resource(pdev, pres, resourceXObject, NULL, true);
+ (*pres)->where_used |= pdev->used_mask;
+ if (code < 0)
+ return code;
} else {
- /* Unfortunately we can't apply pdf_substitute_resource,
- because the object may already be referred by its id.
- Redundant objects may happen in this case.
- For better results users should define objects before usage.
- */
+ /* Unfortunately we can't apply pdf_substitute_resource,
+ because the object may already be referred by its id.
+ Redundant objects may happen in this case.
+ For better results users should define objects before usage.
+ */
}
if (objname != NULL && objname->size) {
- cos_value_t value;
+ cos_value_t value;
- code = cos_dict_put(pdev->local_named_objects, objname->data,
- objname->size, cos_object_value(&value, (cos_object_t *)(*pres)->object));
- if (code < 0)
- return code;
+ code = cos_dict_put(pdev->local_named_objects, objname->data,
+ objname->size, cos_object_value(&value, (cos_object_t *)(*pres)->object));
+ if (code < 0)
+ return code;
}
return 0;
}
-
/* ---------------- Miscellaneous pdfmarks ---------------- */
/*
@@ -435,9 +434,9 @@ typedef struct ao_params_s {
} ao_params_t;
static int
pdfmark_put_ao_pairs(gx_device_pdf * pdev, cos_dict_t *pcd,
- const gs_param_string * pairs, uint count,
- const gs_matrix * pctm, ao_params_t * params,
- bool for_outline)
+ const gs_param_string * pairs, uint count,
+ const gs_matrix * pctm, ao_params_t * params,
+ bool for_outline)
{
const gs_param_string *Action = 0;
const gs_param_string *File = 0;
@@ -451,227 +450,227 @@ pdfmark_put_ao_pairs(gx_device_pdf * pdev, cos_dict_t *pcd,
Dest.data = 0;
if (params->subtype)
- param_string_from_string(Subtype, params->subtype);
+ param_string_from_string(Subtype, params->subtype);
else
- Subtype.data = 0;
+ Subtype.data = 0;
for (i = 0; i < count; i += 2) {
- const gs_param_string *pair = &pairs[i];
- long src_pg;
-
- if (pdf_key_eq(pair, "/SrcPg") &&
- sscanf((const char *)pair[1].data, "%ld", &src_pg) == 1
- )
- params->src_pg = src_pg - 1;
- else if (!for_outline && pdf_key_eq(pair, "/Color"))
- pdfmark_put_c_pair(pcd, "/C", pair + 1);
- else if (!for_outline && pdf_key_eq(pair, "/Title"))
- pdfmark_put_c_pair(pcd, "/T", pair + 1);
- else if (pdf_key_eq(pair, "/Action") || pdf_key_eq(pair, "/A"))
- Action = pair;
- /* Previously also catered for '/F', but at the top level (outside an
- * Action dict which is handled below), a /F can only be the Flags for
- * the annotation, not a File or JavaScript action.
- */
- else if (pdf_key_eq(pair, "/File") /* || pdf_key_eq(pair, "/F")*/)
- File = pair;
- else if (pdf_key_eq(pair, "/Dest")) {
- Dest = pair[1];
- coerce_dest = true;
- }
- else if (pdf_key_eq(pair, "/URI")) {
- URI = pair; /* save it for placing into the Action dict */
- }
- else if (pdf_key_eq(pair, "/Page") || pdf_key_eq(pair, "/View")) {
- /* Make a destination even if this is for an outline. */
- if (Dest.data == 0) {
- code = pdfmark_make_dest(dest, params->pdev, "/Page", "/View",
- pairs, count, 0);
- if (code < 0)
- return code;
- param_string_from_string(Dest, dest);
- if (for_outline)
- coerce_dest = false;
- }
- } else if (pdf_key_eq(pair, "/Subtype"))
- Subtype = pair[1];
- /*
- * We also have to replace all occurrences of \n in Contents
- * strings with \r. Unfortunately, they probably have already
- * been converted to \012....
- */
- else if (pdf_key_eq(pair, "/Contents")) {
- byte *cstr;
- uint csize = pair[1].size;
- cos_value_t *pcv;
- uint i, j;
-
- /*
- * Copy the string into value storage, then update it in place.
- */
- pdfmark_put_pair(pcd, pair);
- /* Break const so we can update the (copied) string. */
- pcv = (cos_value_t *)cos_dict_find_c_key(pcd, "/Contents");
- if (pcv == NULL)
- return_error(gs_error_ioerror); /* shouldn't be possible */
- cstr = pcv->contents.chars.data;
- /* Loop invariant: j <= i < csize. */
- for (i = j = 0; i < csize;)
- if (csize - i >= 2 && !memcmp(cstr + i, "\\n", 2) &&
- (i == 0 || cstr[i - 1] != '\\')
- ) {
- cstr[j] = '\\', cstr[j + 1] = 'r';
- i += 2, j += 2;
- } else if (csize - i >= 4 && !memcmp(cstr + i, "\\012", 4) &&
- (i == 0 || cstr[i - 1] != '\\')
- ) {
- cstr[j] = '\\', cstr[j + 1] = 'r';
- i += 4, j += 2;
- } else
- cstr[j++] = cstr[i++];
- if (j != i)
- pcv->contents.chars.data =
- gs_resize_string(pdev->pdf_memory, cstr, csize, j,
- "pdfmark_put_ao_pairs");
- } else if (pdf_key_eq(pair, "/Rect")) {
- gs_rect rect;
- char rstr[MAX_RECT_STRING];
- int code = pdfmark_scan_rect(&rect, pair + 1, pctm);
-
- if (code < 0)
- return code;
- pdfmark_make_rect(rstr, &rect);
- cos_dict_put_c_key_string(pcd, "/Rect", (byte *)rstr,
- strlen(rstr));
- } else if (pdf_key_eq(pair, "/Border")) {
- stream s;
- char bstr[MAX_BORDER_STRING + 1];
- int code;
-
- s_init(&s, NULL);
- swrite_string(&s, (byte *)bstr, MAX_BORDER_STRING + 1);
- code = pdfmark_write_border(&s, pair + 1, pctm);
- if (code < 0)
- return code;
- if (stell(&s) > MAX_BORDER_STRING)
- return_error(gs_error_limitcheck);
- bstr[stell(&s)] = 0;
- cos_dict_put_c_key_string(pcd, "/Border", (byte *)bstr,
- strlen(bstr));
- } else if (for_outline && pdf_key_eq(pair, "/Count"))
- DO_NOTHING;
- else
- pdfmark_put_pair(pcd, pair);
+ const gs_param_string *pair = &pairs[i];
+ long src_pg;
+
+ if (pdf_key_eq(pair, "/SrcPg") &&
+ sscanf((const char *)pair[1].data, "%ld", &src_pg) == 1
+ )
+ params->src_pg = src_pg - 1;
+ else if (!for_outline && pdf_key_eq(pair, "/Color"))
+ pdfmark_put_c_pair(pcd, "/C", pair + 1);
+ else if (!for_outline && pdf_key_eq(pair, "/Title"))
+ pdfmark_put_c_pair(pcd, "/T", pair + 1);
+ else if (pdf_key_eq(pair, "/Action") || pdf_key_eq(pair, "/A"))
+ Action = pair;
+ /* Previously also catered for '/F', but at the top level (outside an
+ * Action dict which is handled below), a /F can only be the Flags for
+ * the annotation, not a File or JavaScript action.
+ */
+ else if (pdf_key_eq(pair, "/File") /* || pdf_key_eq(pair, "/F")*/)
+ File = pair;
+ else if (pdf_key_eq(pair, "/Dest")) {
+ Dest = pair[1];
+ coerce_dest = true;
+ }
+ else if (pdf_key_eq(pair, "/URI")) {
+ URI = pair; /* save it for placing into the Action dict */
+ }
+ else if (pdf_key_eq(pair, "/Page") || pdf_key_eq(pair, "/View")) {
+ /* Make a destination even if this is for an outline. */
+ if (Dest.data == 0) {
+ code = pdfmark_make_dest(dest, params->pdev, "/Page", "/View",
+ pairs, count, 0);
+ if (code < 0)
+ return code;
+ param_string_from_string(Dest, dest);
+ if (for_outline)
+ coerce_dest = false;
+ }
+ } else if (pdf_key_eq(pair, "/Subtype"))
+ Subtype = pair[1];
+ /*
+ * We also have to replace all occurrences of \n in Contents
+ * strings with \r. Unfortunately, they probably have already
+ * been converted to \012....
+ */
+ else if (pdf_key_eq(pair, "/Contents")) {
+ byte *cstr;
+ uint csize = pair[1].size;
+ cos_value_t *pcv;
+ uint i, j;
+
+ /*
+ * Copy the string into value storage, then update it in place.
+ */
+ pdfmark_put_pair(pcd, pair);
+ /* Break const so we can update the (copied) string. */
+ pcv = (cos_value_t *)cos_dict_find_c_key(pcd, "/Contents");
+ if (pcv == NULL)
+ return_error(gs_error_ioerror); /* shouldn't be possible */
+ cstr = pcv->contents.chars.data;
+ /* Loop invariant: j <= i < csize. */
+ for (i = j = 0; i < csize;)
+ if (csize - i >= 2 && !memcmp(cstr + i, "\\n", 2) &&
+ (i == 0 || cstr[i - 1] != '\\')
+ ) {
+ cstr[j] = '\\', cstr[j + 1] = 'r';
+ i += 2, j += 2;
+ } else if (csize - i >= 4 && !memcmp(cstr + i, "\\012", 4) &&
+ (i == 0 || cstr[i - 1] != '\\')
+ ) {
+ cstr[j] = '\\', cstr[j + 1] = 'r';
+ i += 4, j += 2;
+ } else
+ cstr[j++] = cstr[i++];
+ if (j != i)
+ pcv->contents.chars.data =
+ gs_resize_string(pdev->pdf_memory, cstr, csize, j,
+ "pdfmark_put_ao_pairs");
+ } else if (pdf_key_eq(pair, "/Rect")) {
+ gs_rect rect;
+ char rstr[MAX_RECT_STRING];
+ int code = pdfmark_scan_rect(&rect, pair + 1, pctm);
+
+ if (code < 0)
+ return code;
+ pdfmark_make_rect(rstr, &rect);
+ cos_dict_put_c_key_string(pcd, "/Rect", (byte *)rstr,
+ strlen(rstr));
+ } else if (pdf_key_eq(pair, "/Border")) {
+ stream s;
+ char bstr[MAX_BORDER_STRING + 1];
+ int code;
+
+ s_init(&s, NULL);
+ swrite_string(&s, (byte *)bstr, MAX_BORDER_STRING + 1);
+ code = pdfmark_write_border(&s, pair + 1, pctm);
+ if (code < 0)
+ return code;
+ if (stell(&s) > MAX_BORDER_STRING)
+ return_error(gs_error_limitcheck);
+ bstr[stell(&s)] = 0;
+ cos_dict_put_c_key_string(pcd, "/Border", (byte *)bstr,
+ strlen(bstr));
+ } else if (for_outline && pdf_key_eq(pair, "/Count"))
+ DO_NOTHING;
+ else
+ pdfmark_put_pair(pcd, pair);
}
if (!for_outline && pdf_key_eq(&Subtype, "/Link")) {
- if (Action) {
- /* Don't delete the Dest for GoTo or file-GoToR. */
- if (pdf_key_eq(Action + 1, "/GoTo") ||
- (File && pdf_key_eq(Action + 1, "/GoToR"))
- )
- DO_NOTHING;
- else
- Dest.data = 0;
- }
+ if (Action) {
+ /* Don't delete the Dest for GoTo or file-GoToR. */
+ if (pdf_key_eq(Action + 1, "/GoTo") ||
+ (File && pdf_key_eq(Action + 1, "/GoToR"))
+ )
+ DO_NOTHING;
+ else
+ Dest.data = 0;
+ }
}
/* Now handle the deferred keys. */
if (Action) {
- const byte *astr = Action[1].data;
- const uint asize = Action[1].size;
-
- if ((File != 0 || Dest.data != 0 || URI != 0) &&
- (pdf_key_eq(Action + 1, "/Launch") ||
- (pdf_key_eq(Action + 1, "/GoToR") && File) ||
- pdf_key_eq(Action + 1, "/Article"))
- ) {
- cos_dict_t *adict = cos_dict_alloc(pdev, "action dict");
- cos_value_t avalue;
-
- if (adict == 0)
- return_error(gs_error_VMerror);
- if (!for_outline) {
- /* We aren't sure whether this is really needed.... */
- cos_dict_put_c_strings(adict, "/Type", "/Action");
- }
- if (pdf_key_eq(Action + 1, "/Article")) {
- cos_dict_put_c_strings(adict, "/S", "/Thread");
- coerce_dest = false; /* Dest is not a real destination */
- }
- else
- pdfmark_put_c_pair(adict, "/S", Action + 1);
- if (Dest.data) {
- if (coerce_dest)
- pdfmark_coerce_dest(&Dest, dest);
- pdfmark_put_c_pair(adict, "/D", &Dest);
- Dest.data = 0; /* so we don't write it again */
- }
- if (File) {
- pdfmark_put_c_pair(adict, "/F", File + 1);
- File = 0; /* so we don't write it again */
- }
- if (URI) {
- /* Adobe Distiller puts a /URI key from pdfmark into the */
- /* Action dict with /S /URI as Subtype */
- pdfmark_put_pair(adict, URI);
- cos_dict_put_c_strings(adict, "/S", "/URI");
- }
- cos_dict_put(pcd, (const byte *)"/A", 2,
- COS_OBJECT_VALUE(&avalue, adict));
- } else if (asize >= 4 && !memcmp(astr, "<<", 2)) {
- /* Replace occurrences of /Dest, /File, and /Subtype. */
- const byte *scan = astr + 2;
- const byte *end = astr + asize;
- gs_param_string key, value;
- cos_dict_t *adict = cos_dict_alloc(pdev, "action dict");
- cos_value_t avalue;
- int code;
-
- if (adict == 0)
- return_error(gs_error_VMerror);
- if (URI) {
- /* Adobe Distiller puts a /URI key from pdfmark into the */
- /* Action dict with /S /URI as Subtype */
- pdfmark_put_pair(adict, URI);
- cos_dict_put_c_strings(adict, "/S", "/URI");
- }
- while ((code = pdf_scan_token(&scan, end, &key.data)) > 0) {
- key.size = scan - key.data;
- if (key.data[0] != '/' ||
- (code = pdf_scan_token_composite(&scan, end, &value.data)) != 1)
- break;
- value.size = scan - value.data;
- if (pdf_key_eq(&key, "/Dest") || pdf_key_eq(&key, "/D")) {
- param_string_from_string(key, "/D");
- if (value.data[0] == '(') {
- /****** HANDLE ESCAPES ******/
- pdfmark_coerce_dest(&value, dest);
- }
- } else if (pdf_key_eq(&key, "/File"))
- param_string_from_string(key, "/F");
- else if (pdf_key_eq(&key, "/Subtype"))
- param_string_from_string(key, "/S");
- cos_dict_put_string(adict, key.data, key.size,
- value.data, value.size);
- }
- if (code <= 0 || !pdf_key_eq(&key, ">>"))
- return_error(gs_error_rangecheck);
- cos_dict_put(pcd, (const byte *)"/A", 2,
- COS_OBJECT_VALUE(&avalue, adict));
- } else if (pdf_key_eq(Action + 1, "/GoTo"))
- pdfmark_put_pair(pcd, Action);
- else if (Action[1].size < 30) {
- /* Hack: we could substitute names in pdfmark_process,
- now should recognize whether it was done.
- Not a perfect method though.
- Go with it for a while. */
- char buf[30];
- int d0, d1;
-
- memcpy(buf, Action[1].data, Action[1].size);
- buf[Action[1].size] = 0;
- if (sscanf(buf, "%d %d R", &d0, &d1) == 2)
- pdfmark_put_pair(pcd, Action);
- }
+ const byte *astr = Action[1].data;
+ const uint asize = Action[1].size;
+
+ if ((File != 0 || Dest.data != 0 || URI != 0) &&
+ (pdf_key_eq(Action + 1, "/Launch") ||
+ (pdf_key_eq(Action + 1, "/GoToR") && File) ||
+ pdf_key_eq(Action + 1, "/Article"))
+ ) {
+ cos_dict_t *adict = cos_dict_alloc(pdev, "action dict");
+ cos_value_t avalue;
+
+ if (adict == 0)
+ return_error(gs_error_VMerror);
+ if (!for_outline) {
+ /* We aren't sure whether this is really needed.... */
+ cos_dict_put_c_strings(adict, "/Type", "/Action");
+ }
+ if (pdf_key_eq(Action + 1, "/Article")) {
+ cos_dict_put_c_strings(adict, "/S", "/Thread");
+ coerce_dest = false; /* Dest is not a real destination */
+ }
+ else
+ pdfmark_put_c_pair(adict, "/S", Action + 1);
+ if (Dest.data) {
+ if (coerce_dest)
+ pdfmark_coerce_dest(&Dest, dest);
+ pdfmark_put_c_pair(adict, "/D", &Dest);
+ Dest.data = 0; /* so we don't write it again */
+ }
+ if (File) {
+ pdfmark_put_c_pair(adict, "/F", File + 1);
+ File = 0; /* so we don't write it again */
+ }
+ if (URI) {
+ /* Adobe Distiller puts a /URI key from pdfmark into the */
+ /* Action dict with /S /URI as Subtype */
+ pdfmark_put_pair(adict, URI);
+ cos_dict_put_c_strings(adict, "/S", "/URI");
+ }
+ cos_dict_put(pcd, (const byte *)"/A", 2,
+ COS_OBJECT_VALUE(&avalue, adict));
+ } else if (asize >= 4 && !memcmp(astr, "<<", 2)) {
+ /* Replace occurrences of /Dest, /File, and /Subtype. */
+ const byte *scan = astr + 2;
+ const byte *end = astr + asize;
+ gs_param_string key, value;
+ cos_dict_t *adict = cos_dict_alloc(pdev, "action dict");
+ cos_value_t avalue;
+ int code;
+
+ if (adict == 0)
+ return_error(gs_error_VMerror);
+ if (URI) {
+ /* Adobe Distiller puts a /URI key from pdfmark into the */
+ /* Action dict with /S /URI as Subtype */
+ pdfmark_put_pair(adict, URI);
+ cos_dict_put_c_strings(adict, "/S", "/URI");
+ }
+ while ((code = pdf_scan_token(&scan, end, &key.data)) > 0) {
+ key.size = scan - key.data;
+ if (key.data[0] != '/' ||
+ (code = pdf_scan_token_composite(&scan, end, &value.data)) != 1)
+ break;
+ value.size = scan - value.data;
+ if (pdf_key_eq(&key, "/Dest") || pdf_key_eq(&key, "/D")) {
+ param_string_from_string(key, "/D");
+ if (value.data[0] == '(') {
+ /****** HANDLE ESCAPES ******/
+ pdfmark_coerce_dest(&value, dest);
+ }
+ } else if (pdf_key_eq(&key, "/File"))
+ param_string_from_string(key, "/F");
+ else if (pdf_key_eq(&key, "/Subtype"))
+ param_string_from_string(key, "/S");
+ cos_dict_put_string(adict, key.data, key.size,
+ value.data, value.size);
+ }
+ if (code <= 0 || !pdf_key_eq(&key, ">>"))
+ return_error(gs_error_rangecheck);
+ cos_dict_put(pcd, (const byte *)"/A", 2,
+ COS_OBJECT_VALUE(&avalue, adict));
+ } else if (pdf_key_eq(Action + 1, "/GoTo"))
+ pdfmark_put_pair(pcd, Action);
+ else if (Action[1].size < 30) {
+ /* Hack: we could substitute names in pdfmark_process,
+ now should recognize whether it was done.
+ Not a perfect method though.
+ Go with it for a while. */
+ char buf[30];
+ int d0, d1;
+
+ memcpy(buf, Action[1].data, Action[1].size);
+ buf[Action[1].size] = 0;
+ if (sscanf(buf, "%d %d R", &d0, &d1) == 2)
+ pdfmark_put_pair(pcd, Action);
+ }
}
/*
* If we have /Dest or /File without the right kind of action,
@@ -679,30 +678,30 @@ pdfmark_put_ao_pairs(gx_device_pdf * pdev, cos_dict_t *pcd,
* but I'm not sure what else to do.
*/
if (Dest.data) {
- if (coerce_dest)
- pdfmark_coerce_dest(&Dest, dest);
- pdfmark_put_c_pair(pcd, "/Dest", &Dest);
+ if (coerce_dest)
+ pdfmark_coerce_dest(&Dest, dest);
+ pdfmark_put_c_pair(pcd, "/Dest", &Dest);
} else if (for_outline && !Action) {
- /* Make an implicit destination. */
- char dstr[1 + (sizeof(long) * 8 / 3 + 1) + 25 + 1];
- long page_id = pdf_page_id(pdev, pdev->next_page + 1);
+ /* Make an implicit destination. */
+ char dstr[1 + (sizeof(long) * 8 / 3 + 1) + 25 + 1];
+ long page_id = pdf_page_id(pdev, pdev->next_page + 1);
- sprintf(dstr, "[%ld 0 R /XYZ null null null]", page_id);
- cos_dict_put_c_key_string(pcd, "/Dest", (const unsigned char*) dstr,
- strlen(dstr));
+ sprintf(dstr, "[%ld 0 R /XYZ null null null]", page_id);
+ cos_dict_put_c_key_string(pcd, "/Dest", (const unsigned char*) dstr,
+ strlen(dstr));
}
if (File)
- pdfmark_put_pair(pcd, File);
+ pdfmark_put_pair(pcd, File);
if (Subtype.data)
- pdfmark_put_c_pair(pcd, "/Subtype", &Subtype);
+ pdfmark_put_c_pair(pcd, "/Subtype", &Subtype);
return 0;
}
/* Copy an annotation dictionary. */
static int
pdfmark_annot(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string *objname,
- const char *subtype)
+ const gs_matrix * pctm, const gs_param_string *objname,
+ const char *subtype)
{
ao_params_t params;
cos_dict_t *pcd;
@@ -715,89 +714,89 @@ pdfmark_annot(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
* Print flag enabled, so we need to prescan for that here.
*/
if(pdev->PDFA) {
- int i, Flags = 0;
- /* Check all the keys to see if we have a /F (Flags) key/value pair defined */
- for (i = 0; i < count; i += 2) {
- const gs_param_string *pair = &pairs[i];
-
- if (pdf_key_eq(pair, "/F")) {
- code = sscanf((const char *)pair[1].data, "%ld", &Flags);
- if (code != 1)
- emprintf(pdev->memory,
+ int i, Flags = 0;
+ /* Check all the keys to see if we have a /F (Flags) key/value pair defined */
+ for (i = 0; i < count; i += 2) {
+ const gs_param_string *pair = &pairs[i];
+
+ if (pdf_key_eq(pair, "/F")) {
+ code = sscanf((const char *)pair[1].data, "%ld", &Flags);
+ if (code != 1)
+ emprintf(pdev->memory,
"Annotation has an invalid /Flags attribute\n");
- break;
- }
- }
- /* Check the Print flag, PDF/A annotations *must* be set to print */
- if ((Flags & 4) == 0){
- switch (pdev->PDFACompatibilityPolicy) {
- /* Default behaviour matches Adobe Acrobat, warn and continue,
- * output file will not be PDF/A compliant
- */
- case 0:
- emprintf(pdev->memory,
+ break;
+ }
+ }
+ /* Check the Print flag, PDF/A annotations *must* be set to print */
+ if ((Flags & 4) == 0){
+ switch (pdev->PDFACompatibilityPolicy) {
+ /* Default behaviour matches Adobe Acrobat, warn and continue,
+ * output file will not be PDF/A compliant
+ */
+ case 0:
+ emprintf(pdev->memory,
"Annotation set to non-printing,\n not permitted in PDF/A, reverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- /* Since the annotation would break PDF/A compatibility, do not
- * include it, but warn the user that it has been dropped.
- */
- case 1:
- emprintf(pdev->memory,
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ /* Since the annotation would break PDF/A compatibility, do not
+ * include it, but warn the user that it has been dropped.
+ */
+ case 1:
+ emprintf(pdev->memory,
"Annotation set to non-printing,\n not permitted in PDF/A, annotation will not be present in output file\n");
- return 0;
- break;
- case 2:
- emprintf(pdev->memory,
+ return 0;
+ break;
+ case 2:
+ emprintf(pdev->memory,
"Annotation set to non-printing,\n not permitted in PDF/A, aborting conversion\n");
- return gs_error_invalidfont;
- break;
- default:
- emprintf(pdev->memory,
+ return gs_error_invalidfont;
+ break;
+ default:
+ emprintf(pdev->memory,
"Annotation set to non-printing,\n not permitted in PDF/A, unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- }
- }
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ }
+ }
}
params.pdev = pdev;
params.subtype = subtype;
params.src_pg = -1;
code = pdf_make_named_dict(pdev, objname, &pcd, true);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_strings(pcd, "/Type", "/Annot");
if (code < 0)
- return code;
+ return code;
code = pdfmark_put_ao_pairs(pdev, pcd, pairs, count, pctm, &params, false);
if (code < 0)
- return code;
+ return code;
if (params.src_pg >= 0)
- page_index = params.src_pg;
+ page_index = params.src_pg;
if (pdf_page_id(pdev, page_index + 1) <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
annots = pdev->pages[page_index].Annots;
if (annots == 0) {
- annots = cos_array_alloc(pdev, "pdfmark_annot");
- if (annots == 0)
- return_error(gs_error_VMerror);
- pdev->pages[page_index].Annots = annots;
+ annots = cos_array_alloc(pdev, "pdfmark_annot");
+ if (annots == 0)
+ return_error(gs_error_VMerror);
+ pdev->pages[page_index].Annots = annots;
}
if (!objname) {
- /* Write the annotation now. */
- COS_WRITE_OBJECT(pcd, pdev, resourceAnnotation);
- COS_RELEASE(pcd, "pdfmark_annot");
+ /* Write the annotation now. */
+ COS_WRITE_OBJECT(pcd, pdev, resourceAnnotation);
+ COS_RELEASE(pcd, "pdfmark_annot");
}
return cos_array_add(annots,
- cos_object_value(&value, COS_OBJECT(pcd)));
+ cos_object_value(&value, COS_OBJECT(pcd)));
}
/* ANN pdfmark */
static int
pdfmark_ANN(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
return pdfmark_annot(pdev, pairs, count, pctm, objname, "/Text");
}
@@ -805,7 +804,7 @@ pdfmark_ANN(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* LNK pdfmark (obsolescent) */
static int
pdfmark_LNK(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
return pdfmark_annot(pdev, pairs, count, pctm, objname, "/Link");
}
@@ -813,38 +812,38 @@ pdfmark_LNK(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* Write and release one node of the outline tree. */
static int
pdfmark_write_outline(gx_device_pdf * pdev, pdf_outline_node_t * pnode,
- long next_id)
+ long next_id)
{
stream *s;
int code = 0;
pdf_open_separate(pdev, pnode->id, resourceOutline);
if (pnode->action != NULL)
- pnode->action->id = pnode->id;
+ pnode->action->id = pnode->id;
else {
- emprintf1(pdev->memory,
+ emprintf1(pdev->memory,
"pdfmark error: Outline node %ld has no action or destination.\n",
pnode->id);
- code = gs_note_error(gs_error_undefined);
+ code = gs_note_error(gs_error_undefined);
}
s = pdev->strm;
stream_puts(s, "<< ");
if (pnode->action != NULL)
- cos_dict_elements_write(pnode->action, pdev);
+ cos_dict_elements_write(pnode->action, pdev);
if (pnode->count)
- pprintd1(s, "/Count %d ", pnode->count);
+ pprintd1(s, "/Count %d ", pnode->count);
pprintld1(s, "/Parent %ld 0 R\n", pnode->parent_id);
if (pnode->prev_id)
- pprintld1(s, "/Prev %ld 0 R\n", pnode->prev_id);
+ pprintld1(s, "/Prev %ld 0 R\n", pnode->prev_id);
if (next_id)
- pprintld1(s, "/Next %ld 0 R\n", next_id);
+ pprintld1(s, "/Next %ld 0 R\n", next_id);
if (pnode->first_id)
- pprintld2(s, "/First %ld 0 R /Last %ld 0 R\n",
- pnode->first_id, pnode->last_id);
+ pprintld2(s, "/First %ld 0 R /Last %ld 0 R\n",
+ pnode->first_id, pnode->last_id);
stream_puts(s, ">>\n");
pdf_end_separate(pdev, resourceOutline);
if (pnode->action != NULL)
- COS_FREE(pnode->action, "pdfmark_write_outline");
+ COS_FREE(pnode->action, "pdfmark_write_outline");
pnode->action = 0;
return code;
}
@@ -857,10 +856,10 @@ pdfmark_adjust_parent_count(pdf_outline_level_t * plevel)
int count = plevel->last.count;
if (count > 0) {
- if (parent->last.count < 0)
- parent->last.count -= count;
- else
- parent->last.count += count;
+ if (parent->last.count < 0)
+ parent->last.count -= count;
+ else
+ parent->last.count += count;
}
}
@@ -877,15 +876,15 @@ pdfmark_close_outline(gx_device_pdf * pdev)
int code = 0;
if (plevel->last.id) { /* check for incomplete tree */
- code = pdfmark_write_outline(pdev, &plevel->last, 0);
+ code = pdfmark_write_outline(pdev, &plevel->last, 0);
}
if (depth > 0) {
- plevel[-1].last.last_id = plevel->last.id;
- pdfmark_adjust_parent_count(plevel);
- --plevel;
- if (plevel->last.count < 0)
- pdev->closed_outline_depth--;
- pdev->outline_depth--;
+ plevel[-1].last.last_id = plevel->last.id;
+ pdfmark_adjust_parent_count(plevel);
+ --plevel;
+ if (plevel->last.count < 0)
+ pdev->closed_outline_depth--;
+ pdev->outline_depth--;
}
return code;
}
@@ -893,7 +892,7 @@ pdfmark_close_outline(gx_device_pdf * pdev)
/* OUT pdfmark */
static int
pdfmark_OUT(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
int depth = pdev->outline_depth;
pdf_outline_level_t *plevel = &pdev->outline_levels[depth];
@@ -904,61 +903,61 @@ pdfmark_OUT(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
int code;
for (i = 0; i < count; i += 2) {
- const gs_param_string *pair = &pairs[i];
+ const gs_param_string *pair = &pairs[i];
- if (pdf_key_eq(pair, "/Count"))
- pdfmark_scan_int(pair + 1, &sub_count);
+ if (pdf_key_eq(pair, "/Count"))
+ pdfmark_scan_int(pair + 1, &sub_count);
}
if (sub_count != 0 && depth == MAX_OUTLINE_DEPTH - 1)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
node.action = cos_dict_alloc(pdev, "pdfmark_OUT");
if (node.action == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
ao.pdev = pdev;
ao.subtype = 0;
ao.src_pg = -1;
code = pdfmark_put_ao_pairs(pdev, node.action, pairs, count, pctm, &ao,
- true);
+ true);
if (code < 0)
- return code;
+ return code;
if (pdev->outlines_id == 0)
- pdev->outlines_id = pdf_obj_ref(pdev);
+ pdev->outlines_id = pdf_obj_ref(pdev);
node.id = pdf_obj_ref(pdev);
node.parent_id =
- (depth == 0 ? pdev->outlines_id : plevel[-1].last.id);
+ (depth == 0 ? pdev->outlines_id : plevel[-1].last.id);
node.prev_id = plevel->last.id;
node.first_id = node.last_id = 0;
node.count = sub_count;
/* Add this node to the outline at the current level. */
if (plevel->first.id == 0) { /* First node at this level. */
- if (depth > 0)
- plevel[-1].last.first_id = node.id;
- node.prev_id = 0;
- plevel->first = node;
- plevel->first.action = 0; /* never used */
+ if (depth > 0)
+ plevel[-1].last.first_id = node.id;
+ node.prev_id = 0;
+ plevel->first = node;
+ plevel->first.action = 0; /* never used */
} else { /* Write the previous node. */
- if (depth > 0)
- pdfmark_adjust_parent_count(plevel);
- pdfmark_write_outline(pdev, &plevel->last, node.id);
+ if (depth > 0)
+ pdfmark_adjust_parent_count(plevel);
+ pdfmark_write_outline(pdev, &plevel->last, node.id);
}
plevel->last = node;
plevel->left--;
if (!pdev->closed_outline_depth)
- pdev->outlines_open++;
+ pdev->outlines_open++;
/* If this node has sub-nodes, descend one level. */
if (sub_count != 0) {
- pdev->outline_depth++;
- ++plevel;
- plevel->left = (sub_count > 0 ? sub_count : -sub_count);
- plevel->first.id = 0;
- plevel->first.action = plevel->last.action = 0; /* for GC */
- if (sub_count < 0)
- pdev->closed_outline_depth++;
+ pdev->outline_depth++;
+ ++plevel;
+ plevel->left = (sub_count > 0 ? sub_count : -sub_count);
+ plevel->first.id = 0;
+ plevel->first.action = plevel->last.action = 0; /* for GC */
+ if (sub_count < 0)
+ pdev->closed_outline_depth++;
} else {
- while ((depth = pdev->outline_depth) > 0 &&
- pdev->outline_levels[depth].left == 0
- )
- pdfmark_close_outline(pdev);
+ while ((depth = pdev->outline_depth) > 0 &&
+ pdev->outline_levels[depth].left == 0
+ )
+ pdfmark_close_outline(pdev);
}
return 0;
}
@@ -973,9 +972,9 @@ pdfmark_write_bead(gx_device_pdf * pdev, const pdf_bead_t * pbead)
pdf_open_separate(pdev, pbead->id, resourceArticle);
s = pdev->strm;
pprintld3(s, "<</T %ld 0 R/V %ld 0 R/N %ld 0 R",
- pbead->article_id, pbead->prev_id, pbead->next_id);
+ pbead->article_id, pbead->prev_id, pbead->next_id);
if (pbead->page_id != 0)
- pprintld1(s, "/P %ld 0 R", pbead->page_id);
+ pprintld1(s, "/P %ld 0 R", pbead->page_id);
pdfmark_make_rect(rstr, &pbead->rect);
pprints1(s, "/R%s>>\n", rstr);
return pdf_end_separate(pdev, resourceArticle);
@@ -990,13 +989,13 @@ pdfmark_write_article(gx_device_pdf * pdev, const pdf_article_t * part)
art = *part;
if (art.last.id == 0) {
- /* Only one bead in the article. */
- art.first.prev_id = art.first.next_id = art.first.id;
+ /* Only one bead in the article. */
+ art.first.prev_id = art.first.next_id = art.first.id;
} else {
- /* More than one bead in the article. */
- art.first.prev_id = art.last.id;
- art.last.next_id = art.first.id;
- pdfmark_write_bead(pdev, &art.last);
+ /* More than one bead in the article. */
+ art.first.prev_id = art.last.id;
+ art.last.next_id = art.first.id;
+ pdfmark_write_bead(pdev, &art.last);
}
pdfmark_write_bead(pdev, &art.first);
pdf_open_separate(pdev, art.contents->id, resourceArticle);
@@ -1010,7 +1009,7 @@ pdfmark_write_article(gx_device_pdf * pdev, const pdf_article_t * part)
/* ARTICLE pdfmark */
static int
pdfmark_ARTICLE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
gs_memory_t *mem = pdev->pdf_memory;
gs_param_string title;
@@ -1021,45 +1020,45 @@ pdfmark_ARTICLE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
int code;
if (!pdfmark_find_key("/Title", pairs, count, &title) ||
- !pdfmark_find_key("/Rect", pairs, count, &rectstr)
- )
- return_error(gs_error_rangecheck);
+ !pdfmark_find_key("/Rect", pairs, count, &rectstr)
+ )
+ return_error(gs_error_rangecheck);
if ((code = pdfmark_scan_rect(&rect, &rectstr, pctm)) < 0)
- return code;
+ return code;
bead_id = pdf_obj_ref(pdev);
/* Find the article with this title, or create one. */
for (part = pdev->articles; part != 0; part = part->next) {
- const cos_value_t *a_title =
- cos_dict_find_c_key(part->contents, "/Title");
-
- if (a_title != 0 && !COS_VALUE_IS_OBJECT(a_title) &&
- !bytes_compare(a_title->contents.chars.data,
- a_title->contents.chars.size,
- title.data, title.size))
- break;
+ const cos_value_t *a_title =
+ cos_dict_find_c_key(part->contents, "/Title");
+
+ if (a_title != 0 && !COS_VALUE_IS_OBJECT(a_title) &&
+ !bytes_compare(a_title->contents.chars.data,
+ a_title->contents.chars.size,
+ title.data, title.size))
+ break;
}
if (part == 0) { /* Create the article. */
- cos_dict_t *contents =
- cos_dict_alloc(pdev, "pdfmark_ARTICLE(contents)");
-
- if (contents == 0)
- return_error(gs_error_VMerror);
- part = gs_alloc_struct(mem, pdf_article_t, &st_pdf_article,
- "pdfmark_ARTICLE(article)");
- if (part == 0 || contents == 0) {
- gs_free_object(mem, part, "pdfmark_ARTICLE(article)");
- if (contents)
- COS_FREE(contents, "pdfmark_ARTICLE(contents)");
- return_error(gs_error_VMerror);
- }
- contents->id = pdf_obj_ref(pdev);
- part->next = pdev->articles;
- pdev->articles = part;
- cos_dict_put_string(contents, (const byte *)"/Title", 6,
- title.data, title.size);
- part->first.id = part->last.id = 0;
- part->contents = contents;
+ cos_dict_t *contents =
+ cos_dict_alloc(pdev, "pdfmark_ARTICLE(contents)");
+
+ if (contents == 0)
+ return_error(gs_error_VMerror);
+ part = gs_alloc_struct(mem, pdf_article_t, &st_pdf_article,
+ "pdfmark_ARTICLE(article)");
+ if (part == 0 || contents == 0) {
+ gs_free_object(mem, part, "pdfmark_ARTICLE(article)");
+ if (contents)
+ COS_FREE(contents, "pdfmark_ARTICLE(contents)");
+ return_error(gs_error_VMerror);
+ }
+ contents->id = pdf_obj_ref(pdev);
+ part->next = pdev->articles;
+ pdev->articles = part;
+ cos_dict_put_string(contents, (const byte *)"/Title", 6,
+ title.data, title.size);
+ part->first.id = part->last.id = 0;
+ part->contents = contents;
}
/*
* Add the bead to the article. This is similar to what we do for
@@ -1067,11 +1066,11 @@ pdfmark_ARTICLE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
* not View/Dest.
*/
if (part->last.id == 0) {
- part->first.next_id = bead_id;
- part->last.id = part->first.id;
+ part->first.next_id = bead_id;
+ part->last.id = part->first.id;
} else {
- part->last.next_id = bead_id;
- pdfmark_write_bead(pdev, &part->last);
+ part->last.next_id = bead_id;
+ pdfmark_write_bead(pdev, &part->last);
}
part->last.prev_id = part->last.id;
part->last.id = bead_id;
@@ -1079,22 +1078,22 @@ pdfmark_ARTICLE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
part->last.next_id = 0;
part->last.rect = rect;
{
- gs_param_string page_string;
- int page = 0;
- uint i;
-
- pdfmark_find_key("/Page", pairs, count, &page_string);
- page = pdfmark_page_number(pdev, &page_string);
- part->last.page_id = pdf_page_id(pdev, page);
- for (i = 0; i < count; i += 2) {
- if (pdf_key_eq(&pairs[i], "/Rect") || pdf_key_eq(&pairs[i], "/Page"))
- continue;
- pdfmark_put_pair(part->contents, &pairs[i]);
- }
+ gs_param_string page_string;
+ int page = 0;
+ uint i;
+
+ pdfmark_find_key("/Page", pairs, count, &page_string);
+ page = pdfmark_page_number(pdev, &page_string);
+ part->last.page_id = pdf_page_id(pdev, page);
+ for (i = 0; i < count; i += 2) {
+ if (pdf_key_eq(&pairs[i], "/Rect") || pdf_key_eq(&pairs[i], "/Page"))
+ continue;
+ pdfmark_put_pair(part->contents, &pairs[i]);
+ }
}
if (part->first.id == 0) { /* This is the first bead of the article. */
- part->first = part->last;
- part->last.id = 0;
+ part->first = part->last;
+ part->last.id = 0;
}
return 0;
}
@@ -1102,7 +1101,7 @@ pdfmark_ARTICLE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* DEST pdfmark */
static int
pdfmark_DEST(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
int present;
char dest[MAX_DEST_STRING];
@@ -1110,39 +1109,39 @@ pdfmark_DEST(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
cos_value_t value;
if (!pdfmark_find_key("/Dest", pairs, count, &key) ||
- (present =
- pdfmark_make_dest(dest, pdev, "/Page", "/View", pairs, count, 1)) < 0
- )
- return_error(gs_error_rangecheck);
+ (present =
+ pdfmark_make_dest(dest, pdev, "/Page", "/View", pairs, count, 1)) < 0
+ )
+ return_error(gs_error_rangecheck);
cos_string_value(&value, (byte *)dest, strlen(dest));
if (!pdev->Dests) {
- pdev->Dests = cos_dict_alloc(pdev, "pdfmark_DEST(Dests)");
- if (pdev->Dests == 0)
- return_error(gs_error_VMerror);
- pdev->Dests->id = pdf_obj_ref(pdev);
+ pdev->Dests = cos_dict_alloc(pdev, "pdfmark_DEST(Dests)");
+ if (pdev->Dests == 0)
+ return_error(gs_error_VMerror);
+ pdev->Dests->id = pdf_obj_ref(pdev);
}
if (objname || count > (present + 1) * 2) {
- /*
- * Create the destination as a dictionary with a D key, since
- * it has (or, if named, may have) additional key/value pairs.
- */
- cos_dict_t *ddict;
- int i, code;
-
- code = pdf_make_named_dict(pdev, objname, &ddict, false);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_string(ddict, "/D", (byte *)dest,
- strlen(dest));
- for (i = 0; code >= 0 && i < count; i += 2)
- if (!pdf_key_eq(&pairs[i], "/Dest") &&
- !pdf_key_eq(&pairs[i], "/Page") &&
- !pdf_key_eq(&pairs[i], "/View")
- )
- code = pdfmark_put_pair(ddict, &pairs[i]);
- if (code < 0)
- return code;
- COS_OBJECT_VALUE(&value, ddict);
+ /*
+ * Create the destination as a dictionary with a D key, since
+ * it has (or, if named, may have) additional key/value pairs.
+ */
+ cos_dict_t *ddict;
+ int i, code;
+
+ code = pdf_make_named_dict(pdev, objname, &ddict, false);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_string(ddict, "/D", (byte *)dest,
+ strlen(dest));
+ for (i = 0; code >= 0 && i < count; i += 2)
+ if (!pdf_key_eq(&pairs[i], "/Dest") &&
+ !pdf_key_eq(&pairs[i], "/Page") &&
+ !pdf_key_eq(&pairs[i], "/View")
+ )
+ code = pdfmark_put_pair(ddict, &pairs[i]);
+ if (code < 0)
+ return code;
+ COS_OBJECT_VALUE(&value, ddict);
}
return cos_dict_put(pdev->Dests, key.data, key.size, &value);
}
@@ -1152,16 +1151,16 @@ static bool
ps_source_ok(const gs_memory_t *mem, const gs_param_string * psource)
{
if (psource->size >= 2 && psource->data[0] == '(' &&
- psource->data[psource->size - 1] == ')'
- )
- return true;
+ psource->data[psource->size - 1] == ')'
+ )
+ return true;
else {
- int i;
- lprintf("bad PS passthrough: ");
- for (i=0; i<psource->size; i++)
- errprintf(mem, "%c", psource->data[i]);
- errprintf(mem, "\n");
- return false;
+ int i;
+ lprintf("bad PS passthrough: ");
+ for (i=0; i<psource->size; i++)
+ errprintf(mem, "%c", psource->data[i]);
+ errprintf(mem, "\n");
+ return false;
}
}
@@ -1187,20 +1186,20 @@ start_XObject(gx_device_pdf * pdev, bool compress, cos_stream_t **ppcs)
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
- code = pdf_enter_substream(pdev, resourceXObject, gs_no_id, &pres, false,
- pdev->CompressFonts /* Have no better switch*/);
+ return code;
+ code = pdf_enter_substream(pdev, resourceXObject, gs_no_id, &pres, false,
+ pdev->CompressFonts /* Have no better switch*/);
if (code < 0)
- return code;
+ return code;
pdev->accumulating_a_global_object = true;
pcs = (cos_stream_t *)pres->object;
pdev->substream_Resources = cos_dict_alloc(pdev, "start_XObject");
if (!pdev->substream_Resources)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (pdev->ForOPDFRead) {
- code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
- if (code < 0)
- return code;
+ code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
+ if (code < 0)
+ return code;
}
pres->named = true;
pres->where_used = 0; /* initially not used */
@@ -1213,100 +1212,100 @@ start_XObject(gx_device_pdf * pdev, bool compress, cos_stream_t **ppcs)
#define MAX_PS_INLINE 100
static int
pdfmark_PS(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
gs_param_string source;
gs_param_string level1;
if (!pdfmark_find_key("/DataSource", pairs, count, &source) ||
- !ps_source_ok(pdev->memory, &source) ||
- (pdfmark_find_key("/Level1", pairs, count, &level1) &&
- !ps_source_ok(pdev->memory, &level1))
- )
- return_error(gs_error_rangecheck);
+ !ps_source_ok(pdev->memory, &source) ||
+ (pdfmark_find_key("/Level1", pairs, count, &level1) &&
+ !ps_source_ok(pdev->memory, &level1))
+ )
+ return_error(gs_error_rangecheck);
if (level1.data == 0 && source.size <= MAX_PS_INLINE && objname == 0) {
- /* Insert the PostScript code in-line */
- int code = pdf_open_contents(pdev, PDF_IN_STREAM);
- stream *s;
-
- if (code < 0)
- return code;
- s = pdev->strm;
- stream_write(s, source.data, source.size);
- stream_puts(s, " PS\n");
+ /* Insert the PostScript code in-line */
+ int code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ stream *s;
+
+ if (code < 0)
+ return code;
+ s = pdev->strm;
+ stream_write(s, source.data, source.size);
+ stream_puts(s, " PS\n");
} else {
- /* Put the PostScript code in a resource. */
- cos_stream_t *pcs;
- int code;
- gs_id level1_id = gs_no_id;
- pdf_resource_t *pres;
-
- if (level1.data != 0) {
- pdf_resource_t *pres;
-
- code = pdf_enter_substream(pdev,
- resourceXObject,
- gs_no_id, &pres, true,
- pdev->CompressFonts /* Have no better switch*/);
- if (code < 0)
- return code;
- pcs = (cos_stream_t *)pres->object;
- if (pdev->ForOPDFRead && objname != 0) {
- code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
- if (code < 0)
- return code;
- }
- pres->named = (objname != 0);
- pres->where_used = 0;
- pcs->pres = pres;
- DISCARD(pdfmark_write_ps(pdev->strm, &level1));
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- code = cos_write_object(pres->object, pdev, resourceOther);
- if (code < 0)
- return code;
- level1_id = pres->object->id;
- }
- code = start_XObject(pdev, pdev->params.CompressPages, &pcs);
- if (code < 0)
- return code;
- pres = pdev->accumulating_substream_resource;
- code = cos_stream_put_c_strings(pcs, "/Type", "/XObject");
- if (code < 0)
- return code;
- code = cos_stream_put_c_strings(pcs, "/Subtype", "/PS");
- if (code < 0)
- return code;
- if (level1_id != gs_no_id) {
- char r[MAX_DEST_STRING];
-
- sprintf(r, "%ld 0 R", level1_id);
- code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/Level1",
- (byte *)r, strlen(r));
- if (code < 0)
- return code;
- }
- DISCARD(pdfmark_write_ps(pdev->strm, &source));
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- { gs_const_string objname1, *pon = NULL;
-
- if (objname != NULL) {
- objname1.data = objname->data;
- objname1.size = objname->size;
- pon = &objname1;
- }
- code = pdfmark_bind_named_object(pdev, pon, &pres);
- if (code < 0)
- return code;
- }
- code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ /* Put the PostScript code in a resource. */
+ cos_stream_t *pcs;
+ int code;
+ gs_id level1_id = gs_no_id;
+ pdf_resource_t *pres;
+
+ if (level1.data != 0) {
+ pdf_resource_t *pres;
+
+ code = pdf_enter_substream(pdev,
+ resourceXObject,
+ gs_no_id, &pres, true,
+ pdev->CompressFonts /* Have no better switch*/);
+ if (code < 0)
+ return code;
+ pcs = (cos_stream_t *)pres->object;
+ if (pdev->ForOPDFRead && objname != 0) {
+ code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
+ if (code < 0)
+ return code;
+ }
+ pres->named = (objname != 0);
+ pres->where_used = 0;
+ pcs->pres = pres;
+ DISCARD(pdfmark_write_ps(pdev->strm, &level1));
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ code = cos_write_object(pres->object, pdev, resourceOther);
+ if (code < 0)
+ return code;
+ level1_id = pres->object->id;
+ }
+ code = start_XObject(pdev, pdev->params.CompressPages, &pcs);
+ if (code < 0)
+ return code;
+ pres = pdev->accumulating_substream_resource;
+ code = cos_stream_put_c_strings(pcs, "/Type", "/XObject");
+ if (code < 0)
+ return code;
+ code = cos_stream_put_c_strings(pcs, "/Subtype", "/PS");
+ if (code < 0)
+ return code;
+ if (level1_id != gs_no_id) {
+ char r[MAX_DEST_STRING];
+
+ sprintf(r, "%ld 0 R", level1_id);
+ code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/Level1",
+ (byte *)r, strlen(r));
+ if (code < 0)
+ return code;
+ }
+ DISCARD(pdfmark_write_ps(pdev->strm, &source));
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ { gs_const_string objname1, *pon = NULL;
+
+ if (objname != NULL) {
+ objname1.data = objname->data;
+ objname1.size = objname->size;
+ pon = &objname1;
+ }
+ code = pdfmark_bind_named_object(pdev, pon, &pres);
+ if (code < 0)
+ return code;
+ }
+ code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
pcs->pres->where_used |= pdev->used_mask;
- pprintld1(pdev->strm, "/R%ld Do\n", pcs->id);
+ pprintld1(pdev->strm, "/R%ld Do\n", pcs->id);
}
return 0;
}
@@ -1318,16 +1317,16 @@ pdfmark_put_pairs(cos_dict_t *pcd, gs_param_string * pairs, uint count)
int code = 0, i;
if (count & 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; code >= 0 && i < count; i += 2)
- code = pdfmark_put_pair(pcd, pairs + i);
+ code = pdfmark_put_pair(pcd, pairs + i);
return code;
}
/* PAGES pdfmark */
static int
pdfmark_PAGES(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
return pdfmark_put_pairs(pdev->Pages, pairs, count);
}
@@ -1335,16 +1334,16 @@ pdfmark_PAGES(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* PAGE pdfmark */
static int
pdfmark_PAGE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
return pdfmark_put_pairs(pdf_current_page_dict(pdev), pairs, count);
}
-/* Add a page label for the current page. The last label on a page
- * overrides all previous labels for this page. Unlabeled pages will get
+/* Add a page label for the current page. The last label on a page
+ * overrides all previous labels for this page. Unlabeled pages will get
* empty page labels. label == NULL flushes the last label */
-static int
-pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
+static int
+pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
{
cos_value_t value;
cos_dict_t *dict = 0;
@@ -1353,7 +1352,7 @@ pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
/* create label dict (and page label array if not present yet) */
if (label != 0) {
if (!pdev->PageLabels) {
- pdev->PageLabels = cos_array_alloc(pdev,
+ pdev->PageLabels = cos_array_alloc(pdev,
"pdfmark_add_pagelabel(PageLabels)");
if (pdev->PageLabels == 0)
return_error(gs_error_VMerror);
@@ -1371,7 +1370,7 @@ pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
if (dict == 0)
return_error(gs_error_VMerror);
- code = cos_dict_put_c_key(dict, "/P", cos_string_value(&value,
+ code = cos_dict_put_c_key(dict, "/P", cos_string_value(&value,
label->data, label->size));
if (code < 0) {
COS_FREE(dict, "pdfmark_add_pagelabel(dict)");
@@ -1384,28 +1383,28 @@ pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
/* handle current label */
if (pdev->PageLabels_current_label) {
if (code >= 0) {
- code = cos_array_add_int(pdev->PageLabels,
+ code = cos_array_add_int(pdev->PageLabels,
pdev->PageLabels_current_page);
- if (code >= 0)
+ if (code >= 0)
code = cos_array_add(pdev->PageLabels,
- COS_OBJECT_VALUE(&value,
+ COS_OBJECT_VALUE(&value,
pdev->PageLabels_current_label));
}
pdev->PageLabels_current_label = 0;
}
- /* handle unlabled pages between current labeled page and
+ /* handle unlabled pages between current labeled page and
* next labeled page */
if (pdev->PageLabels) {
if (pdev->next_page - pdev->PageLabels_current_page > 1) {
- cos_dict_t *tmp = cos_dict_alloc(pdev,
+ cos_dict_t *tmp = cos_dict_alloc(pdev,
"pdfmark_add_pagelabel(tmp)");
if (tmp == 0)
return_error(gs_error_VMerror);
- code = cos_array_add_int(pdev->PageLabels,
+ code = cos_array_add_int(pdev->PageLabels,
pdev->PageLabels_current_page + 1);
- if (code >= 0)
+ if (code >= 0)
code = cos_array_add(pdev->PageLabels,
COS_OBJECT_VALUE(&value, tmp));
}
@@ -1414,7 +1413,7 @@ pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
/* new current label */
if (pdev->PageLabels_current_label)
- COS_FREE(pdev->PageLabels_current_label,
+ COS_FREE(pdev->PageLabels_current_label,
"pdfmark_add_pagelabel(current_label)");
pdev->PageLabels_current_label = dict;
pdev->PageLabels_current_page = pdev->next_page;
@@ -1423,8 +1422,8 @@ pdfmark_add_pagelabel(gx_device_pdf * pdev, const gs_param_string *label)
}
/* Close the pagelabel numtree.*/
-int
-pdfmark_end_pagelabels(gx_device_pdf * pdev)
+int
+pdfmark_end_pagelabels(gx_device_pdf * pdev)
{
return pdfmark_add_pagelabel(pdev, 0);
}
@@ -1433,13 +1432,13 @@ pdfmark_end_pagelabels(gx_device_pdf * pdev)
/* FIXME: /PlateColor is ignored */
static int
pdfmark_PAGELABEL(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
gs_param_string key;
if (pdev->CompatibilityLevel >= 1.3) {
if (pdfmark_find_key("/Label", pairs, count, &key)) {
- return pdfmark_add_pagelabel(pdev, &key);
+ return pdfmark_add_pagelabel(pdev, &key);
}
}
return 0;
@@ -1448,7 +1447,7 @@ pdfmark_PAGELABEL(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* DOCINFO pdfmark */
static int
pdfmark_DOCINFO(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
/*
* We could use pdfmark_put_pairs(pdev->Info, pairs, count), except
@@ -1460,66 +1459,66 @@ pdfmark_DOCINFO(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
gs_memory_t *mem = pdev->pdf_memory;
if (count & 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; code >= 0 && i < count; i += 2) {
- const gs_param_string *pair = pairs + i;
- gs_param_string alt_pair[2];
- const byte *vdata; /* alt_pair[1].data */
- uint vsize; /* alt_pair[1].size */
- byte *str = 0;
-
- vsize = 0x0badf00d; /* Quiet compiler. */
-
- if (pdf_key_eq(pairs + i, "/Producer")) {
- /*
- * If the string "Distiller" appears anywhere in the Producer,
- * replace the Producer (or the part after a " + ") with our
- * own name.
- */
- string_match_params params;
-
- memcpy(alt_pair, pairs + i, sizeof(alt_pair));
- vdata = alt_pair[1].data;
- vsize = alt_pair[1].size;
- params = string_match_params_default;
- params.ignore_case = true;
- if (string_match(vdata, vsize, (const byte *)"*Distiller*",
- 11, &params) ||
- string_match(vdata, vsize,
- (const byte *)"*\000D\000i\000s\000t\000i\000l\000l\000e\000r*",
- 20, &params)
- ) {
- uint j;
- char buf[PDF_MAX_PRODUCER];
- int len;
-
- for (j = vsize; j > 0 && vdata[--j] != '+'; )
- DO_NOTHING;
- if (vsize - j > 2 && vdata[j] == '+') {
- ++j;
- while (j < vsize && vdata[j] == ' ')
- ++j;
- }
- /*
- * Replace vdata[j .. vsize) with our name. Note that both
- * vdata/vstr and the default producer string are enclosed
- * in ().
- */
- pdf_store_default_Producer(buf);
- len = strlen(buf) - 1;
- str = gs_alloc_string(mem, j + len, "Producer");
- if (str == 0)
- return_error(gs_error_VMerror);
- memcpy(str, vdata, j);
- memcpy(str + j, buf + 1, len);
- alt_pair[1].data = str;
- alt_pair[1].size = vsize = j + len;
- pair = alt_pair;
- }
- }
- code = pdfmark_put_pair(pcd, pair);
- if (str)
- gs_free_string(mem, str, vsize, "Producer");
+ const gs_param_string *pair = pairs + i;
+ gs_param_string alt_pair[2];
+ const byte *vdata; /* alt_pair[1].data */
+ uint vsize; /* alt_pair[1].size */
+ byte *str = 0;
+
+ vsize = 0x0badf00d; /* Quiet compiler. */
+
+ if (pdf_key_eq(pairs + i, "/Producer")) {
+ /*
+ * If the string "Distiller" appears anywhere in the Producer,
+ * replace the Producer (or the part after a " + ") with our
+ * own name.
+ */
+ string_match_params params;
+
+ memcpy(alt_pair, pairs + i, sizeof(alt_pair));
+ vdata = alt_pair[1].data;
+ vsize = alt_pair[1].size;
+ params = string_match_params_default;
+ params.ignore_case = true;
+ if (string_match(vdata, vsize, (const byte *)"*Distiller*",
+ 11, &params) ||
+ string_match(vdata, vsize,
+ (const byte *)"*\000D\000i\000s\000t\000i\000l\000l\000e\000r*",
+ 20, &params)
+ ) {
+ uint j;
+ char buf[PDF_MAX_PRODUCER];
+ int len;
+
+ for (j = vsize; j > 0 && vdata[--j] != '+'; )
+ DO_NOTHING;
+ if (vsize - j > 2 && vdata[j] == '+') {
+ ++j;
+ while (j < vsize && vdata[j] == ' ')
+ ++j;
+ }
+ /*
+ * Replace vdata[j .. vsize) with our name. Note that both
+ * vdata/vstr and the default producer string are enclosed
+ * in ().
+ */
+ pdf_store_default_Producer(buf);
+ len = strlen(buf) - 1;
+ str = gs_alloc_string(mem, j + len, "Producer");
+ if (str == 0)
+ return_error(gs_error_VMerror);
+ memcpy(str, vdata, j);
+ memcpy(str + j, buf + 1, len);
+ alt_pair[1].data = str;
+ alt_pair[1].size = vsize = j + len;
+ pair = alt_pair;
+ }
+ }
+ code = pdfmark_put_pair(pcd, pair);
+ if (str)
+ gs_free_string(mem, str, vsize, "Producer");
}
return code;
}
@@ -1527,26 +1526,26 @@ pdfmark_DOCINFO(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* DOCVIEW pdfmark */
static int
pdfmark_DOCVIEW(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
char dest[MAX_DEST_STRING];
int code = 0;
if (count & 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pdfmark_make_dest(dest, pdev, "/Page", "/View", pairs, count, 0)) {
- int i;
-
- code = cos_dict_put_c_key_string(pdev->Catalog, "/OpenAction",
- (byte *)dest, strlen(dest));
- for (i = 0; code >= 0 && i < count; i += 2)
- if (!(pdf_key_eq(&pairs[i], "/Page") ||
- pdf_key_eq(&pairs[i], "/View"))
- )
- code = pdfmark_put_pair(pdev->Catalog, pairs + i);
- return code;
+ int i;
+
+ code = cos_dict_put_c_key_string(pdev->Catalog, "/OpenAction",
+ (byte *)dest, strlen(dest));
+ for (i = 0; code >= 0 && i < count; i += 2)
+ if (!(pdf_key_eq(&pairs[i], "/Page") ||
+ pdf_key_eq(&pairs[i], "/View"))
+ )
+ code = pdfmark_put_pair(pdev->Catalog, pairs + i);
+ return code;
} else
- return pdfmark_put_pairs(pdev->Catalog, pairs, count);
+ return pdfmark_put_pairs(pdev->Catalog, pairs, count);
}
/* ---------------- Named object pdfmarks ---------------- */
@@ -1554,7 +1553,7 @@ pdfmark_DOCVIEW(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* [ /BBox [llx lly urx ury] /_objdef {obj} /BP pdfmark */
static int
pdfmark_BP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
gs_rect bbox;
cos_stream_t *pcs;
@@ -1566,55 +1565,55 @@ pdfmark_BP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
stream s;
if (objname == 0 || count != 2 || !pdf_key_eq(&pairs[0], "/BBox"))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = gs_matrix_invert(pctm, &ictm);
if (code < 0)
- return code;
+ return code;
if (pairs[1].size > MAX_RECT_STRING)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
memcpy(chars, pairs[1].data, pairs[1].size);
chars[pairs[1].size] = 0;
if (sscanf(chars, "[%lg %lg %lg %lg]",
- &bbox.p.x, &bbox.p.y, &bbox.q.x, &bbox.q.y) != 4)
- return_error(gs_error_rangecheck);
+ &bbox.p.x, &bbox.p.y, &bbox.q.x, &bbox.q.y) != 4)
+ return_error(gs_error_rangecheck);
if ((pdev->used_mask << 1) == 0)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
code = start_XObject(pdev, pdev->params.CompressPages, &pcs);
if (code < 0)
- return code;
+ return code;
{ byte *s = gs_alloc_string(pdev->memory, objname->size, "pdfmark_PS");
-
- if (s == NULL)
- return_error(gs_error_VMerror);
- memcpy(s, objname->data, objname->size);
- pdev->objname.data = s;
- pdev->objname.size = objname->size;
+
+ if (s == NULL)
+ return_error(gs_error_VMerror);
+ memcpy(s, objname->data, objname->size);
+ pdev->objname.data = s;
+ pdev->objname.size = objname->size;
}
pcs->is_graphics = true;
gs_bbox_transform(&bbox, pctm, &bbox);
s_init(&s, NULL);
swrite_string(&s, bbox_str, sizeof(bbox_str));
pprintg4(&s, "[%g %g %g %g]",
- bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
+ bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
bbox_str_len = stell(&s);
swrite_string(&s, matrix_str, sizeof(bbox_str));
pprintg6(&s, "[%g %g %g %g %g %g]",
- ictm.xx, ictm.xy, ictm.yx, ictm.yy, ictm.tx, ictm.ty);
+ ictm.xx, ictm.xy, ictm.yx, ictm.yy, ictm.tx, ictm.ty);
matrix_str_len = stell(&s);
if ((code = cos_stream_put_c_strings(pcs, "/Type", "/XObject")) < 0 ||
- (code = cos_stream_put_c_strings(pcs, "/Subtype", "/Form")) < 0 ||
- (code = cos_stream_put_c_strings(pcs, "/FormType", "1")) < 0 ||
- (code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/BBox",
- bbox_str, bbox_str_len)) < 0 ||
- (code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/Matrix",
- matrix_str, matrix_str_len)) < 0 ||
- (code = cos_dict_put_c_key_object(cos_stream_dict(pcs), "/Resources",
- COS_OBJECT(pdev->substream_Resources))) < 0
- )
- return code;
+ (code = cos_stream_put_c_strings(pcs, "/Subtype", "/Form")) < 0 ||
+ (code = cos_stream_put_c_strings(pcs, "/FormType", "1")) < 0 ||
+ (code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/BBox",
+ bbox_str, bbox_str_len)) < 0 ||
+ (code = cos_dict_put_c_key_string(cos_stream_dict(pcs), "/Matrix",
+ matrix_str, matrix_str_len)) < 0 ||
+ (code = cos_dict_put_c_key_object(cos_stream_dict(pcs), "/Resources",
+ COS_OBJECT(pdev->substream_Resources))) < 0
+ )
+ return code;
/* Don't add to local_named_objects untill the object is created
to prevent pending references, which may appear
- if /PUT pdfmark executes before pdf_substitute_resource in pdfmark_EP
+ if /PUT pdfmark executes before pdf_substitute_resource in pdfmark_EP
drops this object.
*/
return 0;
@@ -1623,7 +1622,7 @@ pdfmark_BP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* [ /EP pdfmark */
static int
pdfmark_EP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
int code;
pdf_resource_t *pres = pdev->accumulating_substream_resource;
@@ -1631,13 +1630,13 @@ pdfmark_EP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
code = pdf_add_procsets(pdev->substream_Resources, pdev->procsets);
if (code < 0)
- return code;
+ return code;
code = pdf_exit_substream(pdev);
if (code < 0)
- return code;
+ return code;
code = pdfmark_bind_named_object(pdev, &objname, &pres);
if (code < 0)
- return 0;
+ return 0;
gs_free_const_string(pdev->memory, objname.data, objname.size, "pdfmark_EP");
return 0;
}
@@ -1645,20 +1644,20 @@ pdfmark_EP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* [ {obj} /SP pdfmark */
static int
pdfmark_SP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco; /* stream */
int code;
if (count != 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_stream, &pco)) < 0)
- return code;
+ return code;
if (pco->is_open || !pco->is_graphics)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = pdf_open_contents(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
pdf_put_matrix(pdev, "q ", pctm, "cm");
pprintld1(pdev->strm, "/R%ld Do Q\n", pco->id);
pco->pres->where_used |= pdev->used_mask;
@@ -1670,7 +1669,7 @@ pdfmark_SP(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* [ /_objdef {stream} /type /stream /OBJ pdfmark */
static int
pdfmark_OBJ(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
cos_type_t cotype;
cos_object_t *pco;
@@ -1678,31 +1677,31 @@ pdfmark_OBJ(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
int code;
if (objname == 0 || count != 2 || !pdf_key_eq(&pairs[0], "/type"))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pdf_key_eq(&pairs[1], "/array"))
- cotype = cos_type_array;
+ cotype = cos_type_array;
else if (pdf_key_eq(&pairs[1], "/dict"))
- cotype = cos_type_dict;
+ cotype = cos_type_dict;
else if ((stream = pdf_key_eq(&pairs[1], "/stream")))
- cotype = cos_type_stream;
+ cotype = cos_type_stream;
else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_make_named(pdev, objname, cotype, &pco, true)) < 0) {
- /*
- * For Distiller compatibility, allows multiple /OBJ pdfmarks with
- * the same name and type, even though the pdfmark specification
- * doesn't say anything about this being legal.
- */
- if (code == gs_error_rangecheck &&
- pdf_refer_named(pdev, objname, &pco) >= 0 &&
- cos_type(pco) == cotype
- )
- return 0; /* already exists, but OK */
- return code;
+ /*
+ * For Distiller compatibility, allows multiple /OBJ pdfmarks with
+ * the same name and type, even though the pdfmark specification
+ * doesn't say anything about this being legal.
+ */
+ if (code == gs_error_rangecheck &&
+ pdf_refer_named(pdev, objname, &pco) >= 0 &&
+ cos_type(pco) == cotype
+ )
+ return 0; /* already exists, but OK */
+ return code;
}
if (stream)
- return setup_pdfmark_stream_compression((gx_device_psdf *)pdev,
- (cos_stream_t *)pco);
+ return setup_pdfmark_stream_compression((gx_device_psdf *)pdev,
+ (cos_stream_t *)pco);
return 0;
}
@@ -1711,24 +1710,24 @@ pdfmark_OBJ(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* Streams are converted to .PUTSTREAM */
static int
pdfmark_PUT(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco;
cos_value_t value;
int code, index;
if (count != 3)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_array, &pco)) < 0)
- return code;
+ return code;
if ((code = pdfmark_scan_int(&pairs[1], &index)) < 0)
- return code;
+ return code;
if (index < 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pco->written)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return cos_array_put((cos_array_t *)pco, index,
- cos_string_value(&value, pairs[2].data, pairs[2].size));
+ cos_string_value(&value, pairs[2].data, pairs[2].size));
}
/* [ {dict} key value ... /.PUTDICT pdfmark */
@@ -1740,97 +1739,97 @@ pdfmark_PUT(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
*/
static int
pdfmark_PUTDICT(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco;
int code;
if ((code = pdf_refer_named(pdev, &pairs[0], &pco)) < 0)
- return code;
+ return code;
if (cos_type(pco) != cos_type_dict && cos_type(pco) != cos_type_stream)
- return_error(gs_error_typecheck);
+ return_error(gs_error_typecheck);
if (pco->written)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return pdfmark_put_pairs((cos_dict_t *)pco, pairs + 1, count - 1);
}
/* [ {stream} string ... /.PUTSTREAM pdfmark */
static int
pdfmark_PUTSTREAM(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco;
int code, i;
uint l;
if (count < 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_stream, &pco)) < 0)
- return code;
+ return code;
if (!pco->is_open)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 1; i < count; ++i)
- if (sputs(pco->input_strm, pairs[i].data, pairs[i].size, &l) != 0)
- return_error(gs_error_ioerror);
+ if (sputs(pco->input_strm, pairs[i].data, pairs[i].size, &l) != 0)
+ return_error(gs_error_ioerror);
if (pco->written)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return code;
}
/* [ {array} value /APPEND pdfmark */
static int
pdfmark_APPEND(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * objname)
+ const gs_matrix * pctm, const gs_param_string * objname)
{
cos_object_t *pco;
cos_value_t value;
int code;
if (count != 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_array, &pco)) < 0)
- return code;
+ return code;
return cos_array_add((cos_array_t *)pco,
- cos_string_value(&value, pairs[1].data, pairs[1].size));
+ cos_string_value(&value, pairs[1].data, pairs[1].size));
}
/* [ {array} index value ... /.PUTINTERVAL pdfmark */
static int
pdfmark_PUTINTERVAL(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco;
cos_value_t value;
int code, index, i;
if (count < 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_array, &pco)) < 0)
- return code;
+ return code;
if ((code = pdfmark_scan_int(&pairs[1], &index)) < 0)
- return code;
+ return code;
if (index < 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 2; code >= 0 && i < count; ++i)
- code = cos_array_put((cos_array_t *)pco, index + i - 2,
- cos_string_value(&value, pairs[i].data, pairs[i].size));
+ code = cos_array_put((cos_array_t *)pco, index + i - 2,
+ cos_string_value(&value, pairs[i].data, pairs[i].size));
return code;
}
/* [ {stream} /CLOSE pdfmark */
static int
pdfmark_CLOSE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
- const gs_matrix * pctm, const gs_param_string * no_objname)
+ const gs_matrix * pctm, const gs_param_string * no_objname)
{
cos_object_t *pco;
int code;
if (count != 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((code = pdf_get_named(pdev, &pairs[0], cos_type_stream, &pco)) < 0)
- return code;
+ return code;
if (!pco->is_open)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Currently we don't do anything special when closing a stream. */
pco->is_open = false;
return 0;
@@ -1839,20 +1838,20 @@ pdfmark_CLOSE(gx_device_pdf * pdev, gs_param_string * pairs, uint count,
/* [ /NamespacePush pdfmark */
static int
pdfmark_NamespacePush(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
if (count != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return pdf_push_namespace(pdev);
}
/* [ /NamespacePop pdfmark */
static int
pdfmark_NamespacePop(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
if (count != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
cos_dict_objects_write(pdev->local_named_objects, pdev);
return pdf_pop_namespace(pdev);
}
@@ -1860,16 +1859,16 @@ pdfmark_NamespacePop(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /_objdef {image} /NI pdfmark */
static int
pdfmark_NI(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
cos_object_t *pco;
int code;
if (objname == 0 || count != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = pdf_make_named(pdev, objname, cos_type_dict, &pco, true);
if (code < 0)
- return code;
+ return code;
return cos_array_add_object(pdev->NI_stack, pco);
}
@@ -1878,7 +1877,7 @@ pdfmark_NI(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ tag /MP pdfmark */
static int
pdfmark_MP(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1886,7 +1885,7 @@ pdfmark_MP(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ tag propdict /DP pdfmark */
static int
pdfmark_DP(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1894,7 +1893,7 @@ pdfmark_DP(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ tag /BMC pdfmark */
static int
pdfmark_BMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1902,7 +1901,7 @@ pdfmark_BMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ tag propdict /BDC pdfmark */
static int
pdfmark_BDC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1910,7 +1909,7 @@ pdfmark_BDC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /EMC pdfmark */
static int
pdfmark_EMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1920,7 +1919,7 @@ pdfmark_EMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ newsubtype1 stdsubtype1 ... /StRoleMap pdfmark */
static int
pdfmark_StRoleMap(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1928,7 +1927,7 @@ pdfmark_StRoleMap(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ class1 {attrobj1} ... /StClassMap pdfmark */
static int
pdfmark_StClassMap(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1940,7 +1939,7 @@ pdfmark_StClassMap(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
*/
static int
pdfmark_StPNE(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1948,7 +1947,7 @@ pdfmark_StPNE(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ [/Title string] [/Open bool] [action_pairs...] /StBookmarkRoot pdfmark */
static int
pdfmark_StBookmarkRoot(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1956,7 +1955,7 @@ pdfmark_StBookmarkRoot(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ [/E {elt}] /StPush pdfmark */
static int
pdfmark_StPush(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1964,7 +1963,7 @@ pdfmark_StPush(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /StPop pdfmark */
static int
pdfmark_StPop(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1972,7 +1971,7 @@ pdfmark_StPop(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /StPopAll pdfmark */
static int
pdfmark_StPopAll(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1980,7 +1979,7 @@ pdfmark_StPopAll(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ [/T tagname] [/At index] /StBMC pdfmark */
static int
pdfmark_StBMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1988,7 +1987,7 @@ pdfmark_StBMC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ [/P propdict] [/T tagname] [/At index] /StBDC pdfmark */
static int
pdfmark_StBDC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -1996,7 +1995,7 @@ pdfmark_StBDC(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /Obj {obj} [/At index] /StOBJ pdfmark */
static int
pdfmark_StOBJ(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -2004,7 +2003,7 @@ pdfmark_StOBJ(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /Obj {obj} /StAttr pdfmark */
static int
pdfmark_StAttr(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -2012,7 +2011,7 @@ pdfmark_StAttr(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /StoreName name /StStore pdfmark */
static int
pdfmark_StStore(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -2020,7 +2019,7 @@ pdfmark_StStore(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
/* [ /StoreName name /StRetrieve pdfmark */
static int
pdfmark_StRetrieve(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
{
return 0; /****** NOT IMPLEMENTED YET ******/
}
@@ -2032,7 +2031,7 @@ pdfmark_StRetrieve(gx_device_pdf *pdev, gs_param_string *pairs, uint count,
*/
static const pdfmark_name mark_names[] =
{
- /* Miscellaneous. */
+ /* Miscellaneous. */
{"ANN", pdfmark_ANN, PDFMARK_NAMEABLE},
{"LNK", pdfmark_LNK, PDFMARK_NAMEABLE},
{"OUT", pdfmark_OUT, 0},
@@ -2044,7 +2043,7 @@ static const pdfmark_name mark_names[] =
{"PAGELABEL", pdfmark_PAGELABEL, 0},
{"DOCINFO", pdfmark_DOCINFO, 0},
{"DOCVIEW", pdfmark_DOCVIEW, 0},
- /* Named objects. */
+ /* Named objects. */
{"BP", pdfmark_BP, PDFMARK_NAMEABLE | PDFMARK_TRUECTM},
{"EP", pdfmark_EP, 0},
{"SP", pdfmark_SP, PDFMARK_ODD_OK | PDFMARK_KEEP_NAME | PDFMARK_TRUECTM},
@@ -2059,13 +2058,13 @@ static const pdfmark_name mark_names[] =
{"NamespacePush", pdfmark_NamespacePush, 0},
{"NamespacePop", pdfmark_NamespacePop, 0},
{"NI", pdfmark_NI, PDFMARK_NAMEABLE},
- /* Marked content. */
+ /* Marked content. */
{"MP", pdfmark_MP, PDFMARK_ODD_OK},
{"DP", pdfmark_DP, 0},
{"BMC", pdfmark_BMC, PDFMARK_ODD_OK},
{"BDC", pdfmark_BDC, 0},
{"EMC", pdfmark_EMC, 0},
- /* Document structure. */
+ /* Document structure. */
{"StRoleMap", pdfmark_StRoleMap, 0},
{"StClassMap", pdfmark_StClassMap, 0},
{"StPNE", pdfmark_StPNE, PDFMARK_NAMEABLE},
@@ -2080,7 +2079,7 @@ static const pdfmark_name mark_names[] =
{"StAttr", pdfmark_StAttr, 0},
{"StStore", pdfmark_StStore, 0},
{"StRetrieve", pdfmark_StRetrieve, 0},
- /* End of list. */
+ /* End of list. */
{0, 0}
};
@@ -2095,89 +2094,89 @@ pdfmark_process(gx_device_pdf * pdev, const gs_param_string_array * pma)
gs_matrix ctm;
const pdfmark_name *pmn;
int code = 0;
-
+
{ int cnt, len = pts[-1].size;
- char buf[200]; /* 6 doubles should fit (%g == -0.14285714285714285e-101 = 25 chars) */
-
- if (len > sizeof(buf) - 1)
- return_error(gs_error_rangecheck);
- memcpy(buf, pts[-1].data, len);
- buf[len] = 0;
- cnt = sscanf(buf, "[%g %g %g %g %g %g]",
- &ctm.xx, &ctm.xy, &ctm.yx, &ctm.yy, &ctm.tx, &ctm.ty);
- if (cnt != 6)
- return_error(gs_error_rangecheck);
+ char buf[200]; /* 6 doubles should fit (%g == -0.14285714285714285e-101 = 25 chars) */
+
+ if (len > sizeof(buf) - 1)
+ return_error(gs_error_rangecheck);
+ memcpy(buf, pts[-1].data, len);
+ buf[len] = 0;
+ cnt = sscanf(buf, "[%g %g %g %g %g %g]",
+ &ctm.xx, &ctm.xy, &ctm.yx, &ctm.yy, &ctm.tx, &ctm.ty);
+ if (cnt != 6)
+ return_error(gs_error_rangecheck);
}
size -= 2; /* remove CTM & pdfmark name */
for (pmn = mark_names; pmn->mname != 0; ++pmn)
- if (pdf_key_eq(pts, pmn->mname)) {
- gs_memory_t *mem = pdev->pdf_memory;
- int odd_ok = (pmn->options & PDFMARK_ODD_OK) != 0;
- gs_param_string *pairs;
- int j;
-
- /*
- * Our coordinate system is scaled so that user space is always
- * default user space. Adjust the CTM to match this, except if this
- * particular pdfmark requires the "true" CTM.
- */
- if (pmn->options & PDFMARK_TRUECTM)
- DO_NOTHING;
- else {
- double xscale = 72.0 / pdev->HWResolution[0],
- yscale = 72.0 / pdev->HWResolution[1];
- ctm.xx *= xscale, ctm.xy *= yscale;
- ctm.yx *= xscale, ctm.yy *= yscale;
- ctm.tx *= xscale, ctm.ty *= yscale;
- }
- if (size & !odd_ok)
- return_error(gs_error_rangecheck);
- if (pmn->options & PDFMARK_NAMEABLE) {
- /* Look for an object name. */
- for (j = 0; j < size; j += 2) {
- if (pdf_key_eq(&data[j], "/_objdef")) {
- objname = &data[j + 1];
- if (!pdf_objname_is_valid(objname->data,
- objname->size)
- )
- return_error(gs_error_rangecheck);
- /* Save the pairs without the name. */
- size -= 2;
- pairs = (gs_param_string *)
- gs_alloc_byte_array(mem, size,
- sizeof(gs_param_string),
- "pdfmark_process(pairs)");
- if (!pairs)
- return_error(gs_error_VMerror);
- memcpy(pairs, data, j * sizeof(*data));
- memcpy(pairs + j, data + j + 2,
- (size - j) * sizeof(*data));
- goto copied;
- }
- }
- }
- /* Save all the pairs. */
- pairs = (gs_param_string *)
- gs_alloc_byte_array(mem, size, sizeof(gs_param_string),
- "pdfmark_process(pairs)");
- if (!pairs)
- return_error(gs_error_VMerror);
- memcpy(pairs, data, size * sizeof(*data));
- copied: /* Substitute object references for names. */
- if (!(pmn->options & PDFMARK_NO_REFS)) {
- for (j = (pmn->options & PDFMARK_KEEP_NAME ? 1 : 1 - odd_ok);
- j < size; j += 2 - odd_ok
- ) {
- code = pdf_replace_names(pdev, &pairs[j], &pairs[j]);
- if (code < 0) {
- gs_free_object(mem, pairs, "pdfmark_process(pairs)");
- return code;
- }
- }
- }
- code = (*pmn->proc) (pdev, pairs, size, &ctm, objname);
- gs_free_object(mem, pairs, "pdfmark_process(pairs)");
- break;
- }
+ if (pdf_key_eq(pts, pmn->mname)) {
+ gs_memory_t *mem = pdev->pdf_memory;
+ int odd_ok = (pmn->options & PDFMARK_ODD_OK) != 0;
+ gs_param_string *pairs;
+ int j;
+
+ /*
+ * Our coordinate system is scaled so that user space is always
+ * default user space. Adjust the CTM to match this, except if this
+ * particular pdfmark requires the "true" CTM.
+ */
+ if (pmn->options & PDFMARK_TRUECTM)
+ DO_NOTHING;
+ else {
+ double xscale = 72.0 / pdev->HWResolution[0],
+ yscale = 72.0 / pdev->HWResolution[1];
+ ctm.xx *= xscale, ctm.xy *= yscale;
+ ctm.yx *= xscale, ctm.yy *= yscale;
+ ctm.tx *= xscale, ctm.ty *= yscale;
+ }
+ if (size & !odd_ok)
+ return_error(gs_error_rangecheck);
+ if (pmn->options & PDFMARK_NAMEABLE) {
+ /* Look for an object name. */
+ for (j = 0; j < size; j += 2) {
+ if (pdf_key_eq(&data[j], "/_objdef")) {
+ objname = &data[j + 1];
+ if (!pdf_objname_is_valid(objname->data,
+ objname->size)
+ )
+ return_error(gs_error_rangecheck);
+ /* Save the pairs without the name. */
+ size -= 2;
+ pairs = (gs_param_string *)
+ gs_alloc_byte_array(mem, size,
+ sizeof(gs_param_string),
+ "pdfmark_process(pairs)");
+ if (!pairs)
+ return_error(gs_error_VMerror);
+ memcpy(pairs, data, j * sizeof(*data));
+ memcpy(pairs + j, data + j + 2,
+ (size - j) * sizeof(*data));
+ goto copied;
+ }
+ }
+ }
+ /* Save all the pairs. */
+ pairs = (gs_param_string *)
+ gs_alloc_byte_array(mem, size, sizeof(gs_param_string),
+ "pdfmark_process(pairs)");
+ if (!pairs)
+ return_error(gs_error_VMerror);
+ memcpy(pairs, data, size * sizeof(*data));
+ copied: /* Substitute object references for names. */
+ if (!(pmn->options & PDFMARK_NO_REFS)) {
+ for (j = (pmn->options & PDFMARK_KEEP_NAME ? 1 : 1 - odd_ok);
+ j < size; j += 2 - odd_ok
+ ) {
+ code = pdf_replace_names(pdev, &pairs[j], &pairs[j]);
+ if (code < 0) {
+ gs_free_object(mem, pairs, "pdfmark_process(pairs)");
+ return code;
+ }
+ }
+ }
+ code = (*pmn->proc) (pdev, pairs, size, &ctm, objname);
+ gs_free_object(mem, pairs, "pdfmark_process(pairs)");
+ break;
+ }
return code;
}
diff --git a/gs/base/gdevpdfo.c b/gs/base/gdevpdfo.c
index 00a82a188..8ce9daefe 100644
--- a/gs/base/gdevpdfo.c
+++ b/gs/base/gdevpdfo.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -93,12 +93,12 @@ ENUM_PTRS_WITH(cos_value_enum_ptrs, cos_value_t *pcv) return 0;
case 0:
switch (pcv->value_type) {
case COS_VALUE_SCALAR:
- return ENUM_STRING(&pcv->contents.chars);
+ return ENUM_STRING(&pcv->contents.chars);
case COS_VALUE_CONST:
- break;
+ break;
case COS_VALUE_OBJECT:
case COS_VALUE_RESOURCE:
- return ENUM_OBJ(pcv->contents.object);
+ return ENUM_OBJ(pcv->contents.object);
}
return 0;
ENUM_PTRS_END
@@ -107,13 +107,13 @@ RELOC_PTRS_WITH(cos_value_reloc_ptrs, cos_value_t *pcv)
{
switch (pcv->value_type) {
case COS_VALUE_SCALAR:
- RELOC_STRING_VAR(pcv->contents.chars);
+ RELOC_STRING_VAR(pcv->contents.chars);
case COS_VALUE_CONST:
- break;
+ break;
case COS_VALUE_OBJECT:
case COS_VALUE_RESOURCE:
- RELOC_VAR(pcv->contents.object);
- break;
+ RELOC_VAR(pcv->contents.object);
+ break;
}
}
RELOC_PTRS_END
@@ -121,9 +121,9 @@ static
ENUM_PTRS_WITH(cos_array_element_enum_ptrs, cos_array_element_t *pcae)
{
return (index < cos_element_num_ptrs ?
- ENUM_USING_PREFIX(st_cos_element, 0) :
- ENUM_USING(st_cos_value, &pcae->value, sizeof(cos_value_t),
- index - cos_element_num_ptrs));
+ ENUM_USING_PREFIX(st_cos_element, 0) :
+ ENUM_USING(st_cos_value, &pcae->value, sizeof(cos_value_t),
+ index - cos_element_num_ptrs));
}
ENUM_PTRS_END
static
@@ -137,11 +137,11 @@ static
ENUM_PTRS_WITH(cos_dict_element_enum_ptrs, cos_dict_element_t *pcde)
{
return (index < cos_element_num_ptrs ?
- ENUM_USING_PREFIX(st_cos_element, 0) :
- (index -= cos_element_num_ptrs) > 0 ?
- ENUM_USING(st_cos_value, &pcde->value, sizeof(cos_value_t),
- index - 1) :
- pcde->owns_key ? ENUM_STRING(&pcde->key) : ENUM_OBJ(NULL));
+ ENUM_USING_PREFIX(st_cos_element, 0) :
+ (index -= cos_element_num_ptrs) > 0 ?
+ ENUM_USING(st_cos_value, &pcde->value, sizeof(cos_value_t),
+ index - 1) :
+ pcde->owns_key ? ENUM_STRING(&pcde->key) : ENUM_OBJ(NULL));
}
ENUM_PTRS_END
static
@@ -149,7 +149,7 @@ RELOC_PTRS_WITH(cos_dict_element_reloc_ptrs, cos_dict_element_t *pcde)
{
RELOC_PREFIX(st_cos_element);
if (pcde->owns_key)
- RELOC_STRING_VAR(pcde->key);
+ RELOC_STRING_VAR(pcde->key);
RELOC_USING(st_cos_value, &pcde->value, sizeof(cos_value_t));
}
RELOC_PTRS_END
@@ -159,22 +159,22 @@ RELOC_PTRS_END
/* Initialize a just-allocated cos object. */
static void
cos_object_init(cos_object_t *pco, gx_device_pdf *pdev,
- const cos_object_procs_t *procs)
+ const cos_object_procs_t *procs)
{
if (pco) {
- pco->cos_procs = procs;
- pco->id = 0;
- pco->elements = 0;
- pco->pieces = 0;
- pco->pdev = pdev;
- pco->pres = 0;
- pco->is_open = true;
- pco->is_graphics = false;
- pco->written = false;
- pco->length = 0;
- pco->input_strm = 0;
- pco->md5_valid = 0;
- memset(&pco->hash, 0x00, 16);
+ pco->cos_procs = procs;
+ pco->id = 0;
+ pco->elements = 0;
+ pco->pieces = 0;
+ pco->pdev = pdev;
+ pco->pres = 0;
+ pco->is_open = true;
+ pco->is_graphics = false;
+ pco->written = false;
+ pco->length = 0;
+ pco->input_strm = 0;
+ pco->md5_valid = 0;
+ memset(&pco->hash, 0x00, 16);
}
}
@@ -190,7 +190,7 @@ int
cos_become(cos_object_t *pco, cos_type_t cotype)
{
if (cos_type(pco) != cos_type_generic)
- return_error(gs_error_typecheck);
+ return_error(gs_error_typecheck);
cos_type(pco) = cotype;
return 0;
}
@@ -226,7 +226,7 @@ cos_write_object(cos_object_t *pco, gx_device_pdf *pdev, pdf_resource_type_t typ
int code;
if (pco->id == 0 || pco->written)
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
pdf_open_separate(pdev, pco->id, type);
code = cos_write(pco, pdev, pco->id);
pdf_end_separate(pdev, type);
@@ -278,64 +278,64 @@ cos_resource_value(cos_value_t *pcv, cos_object_t *pco)
/* Free a value. */
void
cos_value_free(const cos_value_t *pcv, const cos_object_t *pco,
- client_name_t cname)
+ client_name_t cname)
{
switch (pcv->value_type) {
case COS_VALUE_SCALAR:
- gs_free_string(cos_object_memory(pco), pcv->contents.chars.data,
- pcv->contents.chars.size, cname);
+ gs_free_string(cos_object_memory(pco), pcv->contents.chars.data,
+ pcv->contents.chars.size, cname);
case COS_VALUE_CONST:
- break;
+ break;
case COS_VALUE_OBJECT:
- /* Free the object if this is the only reference to it. */
- if (pcv->contents.object != NULL) /* see cos_dict_objects_delete. */
- if (!pcv->contents.object->id)
- cos_free(pcv->contents.object, cname);
+ /* Free the object if this is the only reference to it. */
+ if (pcv->contents.object != NULL) /* see cos_dict_objects_delete. */
+ if (!pcv->contents.object->id)
+ cos_free(pcv->contents.object, cname);
case COS_VALUE_RESOURCE:
- break;
+ break;
}
}
/* Write a value on the output. */
static int
cos_value_write_spaced(const cos_value_t *pcv, gx_device_pdf *pdev,
- bool do_space, gs_id object_id)
+ bool do_space, gs_id object_id)
{
stream *s = pdev->strm;
switch (pcv->value_type) {
case COS_VALUE_SCALAR:
case COS_VALUE_CONST:
- if (do_space)
- switch (pcv->contents.chars.data[0]) {
- case '/': case '(': case '<': break;
- default: stream_putc(s, ' ');
- }
- return pdf_write_value(pdev, pcv->contents.chars.data,
- pcv->contents.chars.size, object_id);
+ if (do_space)
+ switch (pcv->contents.chars.data[0]) {
+ case '/': case '(': case '<': break;
+ default: stream_putc(s, ' ');
+ }
+ return pdf_write_value(pdev, pcv->contents.chars.data,
+ pcv->contents.chars.size, object_id);
case COS_VALUE_RESOURCE:
- pprintld1(s, "/R%ld", pcv->contents.object->id);
- break;
+ pprintld1(s, "/R%ld", pcv->contents.object->id);
+ break;
case COS_VALUE_OBJECT: {
- const cos_object_t *pco = pcv->contents.object;
-
- if (!pco->id) {
- if (do_space &&
- !(pco->cos_procs == cos_type_array ||
- pco->cos_procs == cos_type_dict)
- ) {
- /* Arrays and dictionaries (only) are self-delimiting. */
- stream_putc(s, ' ');
- }
- return cos_write(pco, pdev, object_id);
- }
- if (do_space)
- stream_putc(s, ' ');
- pprintld1(s, "%ld 0 R", pco->id);
- break;
+ const cos_object_t *pco = pcv->contents.object;
+
+ if (!pco->id) {
+ if (do_space &&
+ !(pco->cos_procs == cos_type_array ||
+ pco->cos_procs == cos_type_dict)
+ ) {
+ /* Arrays and dictionaries (only) are self-delimiting. */
+ stream_putc(s, ' ');
+ }
+ return cos_write(pco, pdev, object_id);
+ }
+ if (do_space)
+ stream_putc(s, ' ');
+ pprintld1(s, "%ld 0 R", pco->id);
+ break;
}
default: /* can't happen */
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
}
return 0;
}
@@ -348,18 +348,18 @@ cos_value_write(const cos_value_t *pcv, gx_device_pdf *pdev)
/* Copy a value if necessary for putting into an array or dictionary. */
static int
cos_copy_element_value(cos_value_t *pcv, gs_memory_t *mem,
- const cos_value_t *pvalue, bool copy)
+ const cos_value_t *pvalue, bool copy)
{
*pcv = *pvalue;
if (pvalue->value_type == COS_VALUE_SCALAR && copy) {
- byte *value_data = gs_alloc_string(mem, pvalue->contents.chars.size,
- "cos_copy_element_value");
-
- if (value_data == 0)
- return_error(gs_error_VMerror);
- memcpy(value_data, pvalue->contents.chars.data,
- pvalue->contents.chars.size);
- pcv->contents.chars.data = value_data;
+ byte *value_data = gs_alloc_string(mem, pvalue->contents.chars.size,
+ "cos_copy_element_value");
+
+ if (value_data == 0)
+ return_error(gs_error_VMerror);
+ memcpy(value_data, pvalue->contents.chars.data,
+ pvalue->contents.chars.size);
+ pcv->contents.chars.data = value_data;
}
return 0;
}
@@ -369,26 +369,26 @@ static void
cos_uncopy_element_value(cos_value_t *pcv, gs_memory_t *mem, bool copy)
{
if (pcv->value_type == COS_VALUE_SCALAR && copy)
- gs_free_string(mem, pcv->contents.chars.data, pcv->contents.chars.size,
- "cos_uncopy_element_value");
+ gs_free_string(mem, pcv->contents.chars.data, pcv->contents.chars.size,
+ "cos_uncopy_element_value");
}
static int cos_value_hash(cos_value_t *pcv0, gs_md5_state_t *md5, gs_md5_byte_t *hash, gx_device_pdf *pdev)
{
int code;
switch (pcv0->value_type) {
- case COS_VALUE_SCALAR:
- case COS_VALUE_CONST:
- gs_md5_append(md5, pcv0->contents.chars.data, pcv0->contents.chars.size);
- break;
-
- case COS_VALUE_OBJECT:
- code = pcv0->contents.object->cos_procs->hash(pcv0->contents.object, md5, hash, pdev);
- if (code < 0)
- return code;
- break;
- case COS_VALUE_RESOURCE:
- break;
+ case COS_VALUE_SCALAR:
+ case COS_VALUE_CONST:
+ gs_md5_append(md5, pcv0->contents.chars.data, pcv0->contents.chars.size);
+ break;
+
+ case COS_VALUE_OBJECT:
+ code = pcv0->contents.object->cos_procs->hash(pcv0->contents.object, md5, hash, pdev);
+ if (code < 0)
+ return code;
+ break;
+ case COS_VALUE_RESOURCE:
+ break;
}
return 0;
}
@@ -410,7 +410,7 @@ cos_object_alloc(gx_device_pdf *pdev, client_name_t cname)
{
gs_memory_t *mem = pdev->pdf_memory;
cos_object_t *pco =
- gs_alloc_struct(mem, cos_object_t, &st_cos_object, cname);
+ gs_alloc_struct(mem, cos_object_t, &st_cos_object, cname);
cos_object_init(pco, pdev, &cos_generic_procs);
return pco;
@@ -455,7 +455,7 @@ cos_array_alloc(gx_device_pdf *pdev, client_name_t cname)
{
gs_memory_t *mem = pdev->pdf_memory;
cos_array_t *pca =
- gs_alloc_struct(mem, cos_array_t, &st_cos_object, cname);
+ gs_alloc_struct(mem, cos_array_t, &st_cos_object, cname);
cos_object_init((cos_object_t *)pca, pdev, &cos_array_procs);
return pca;
@@ -463,20 +463,20 @@ cos_array_alloc(gx_device_pdf *pdev, client_name_t cname)
cos_array_t *
cos_array_from_floats(gx_device_pdf *pdev, const float *pf, uint size,
- client_name_t cname)
+ client_name_t cname)
{
cos_array_t *pca = cos_array_alloc(pdev, cname);
uint i;
if (pca == 0)
- return 0;
+ return 0;
for (i = 0; i < size; ++i) {
- int code = cos_array_add_real(pca, pf[i]);
+ int code = cos_array_add_real(pca, pf[i]);
- if (code < 0) {
- COS_FREE(pca, cname);
- return 0;
- }
+ if (code < 0) {
+ COS_FREE(pca, cname);
+ return 0;
+ }
}
return pca;
}
@@ -490,15 +490,15 @@ cos_array_release(cos_object_t *pco, client_name_t cname)
cos_array_element_t *next;
for (cur = pca->elements; cur; cur = next) {
- next = cur->next;
- cos_value_free(&cur->value, pco, cname);
- gs_free_object(mem, cur, cname);
+ next = cur->next;
+ cos_value_free(&cur->value, pco, cname);
+ gs_free_object(mem, cur, cname);
}
pca->elements = 0;
}
static cos_array_element_t *cos_array_reorder(const cos_array_t *pca,
- cos_array_element_t *first);
+ cos_array_element_t *first);
static int
cos_array_write(const cos_object_t *pco, gx_device_pdf *pdev, gs_id object_id)
{
@@ -510,43 +510,43 @@ cos_array_write(const cos_object_t *pco, gx_device_pdf *pdev, gs_id object_id)
stream_puts(s, "[");
for (pcae = first; pcae; ++last_index, pcae = pcae->next) {
- Element_Count++;
-
- if(pdev->PDFA && Element_Count > 8191) {
- switch (pdev->PDFACompatibilityPolicy) {
- case 0:
- emprintf(pdev->memory,
- "Too many entries in array,\n max 8191 in PDF/A, reverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- case 1:
- emprintf(pdev->memory,
+ Element_Count++;
+
+ if(pdev->PDFA && Element_Count > 8191) {
+ switch (pdev->PDFACompatibilityPolicy) {
+ case 0:
+ emprintf(pdev->memory,
+ "Too many entries in array,\n max 8191 in PDF/A, reverting to normal PDF output\n");
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ case 1:
+ emprintf(pdev->memory,
"Too many entries in array,\n max 8191 in PDF/A. Cannot simply elide dictionary, reverting to normal output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- case 2:
- emprintf(pdev->memory,
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ case 2:
+ emprintf(pdev->memory,
"Too many entries in array,\n max 8191 in PDF/A. aborting conversion\n");
- /* Careful here, only certain errors will bubble up
- * through the text processing.
- */
- return gs_error_limitcheck;
- break;
- default:
- emprintf(pdev->memory,
+ /* Careful here, only certain errors will bubble up
+ * through the text processing.
+ */
+ return gs_error_limitcheck;
+ break;
+ default:
+ emprintf(pdev->memory,
"Too many entries in array,\n max 8191 in PDF/A. Unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- }
- }
- if (pcae != first)
- stream_putc(s, '\n');
- for (; pcae->index > last_index; ++last_index)
- stream_puts(s, "null\n");
- cos_value_write_spaced(&pcae->value, pdev, false, object_id);
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ }
+ }
+ if (pcae != first)
+ stream_putc(s, '\n');
+ for (; pcae->index > last_index; ++last_index)
+ stream_puts(s, "null\n");
+ cos_value_write_spaced(&pcae->value, pdev, false, object_id);
}
DISCARD(cos_array_reorder(pca, first));
stream_puts(s, "]");
@@ -563,23 +563,23 @@ cos_array_equal(const cos_object_t *pco0, const cos_object_t *pco1, gx_device_pd
int code;
if (!pca0->md5_valid) {
- gs_md5_init((gs_md5_state_t *)&pca0->md5);
- code = cos_array_hash(pco0, (gs_md5_state_t *)&pca0->md5, (gs_md5_byte_t *)pca0->hash, pdev);
- if (code < 0)
- return code;
- gs_md5_finish((gs_md5_state_t *)&pca0->md5, (gs_md5_byte_t *)pca0->hash);
- ((cos_object_t *)pca0)->md5_valid = true;
+ gs_md5_init((gs_md5_state_t *)&pca0->md5);
+ code = cos_array_hash(pco0, (gs_md5_state_t *)&pca0->md5, (gs_md5_byte_t *)pca0->hash, pdev);
+ if (code < 0)
+ return code;
+ gs_md5_finish((gs_md5_state_t *)&pca0->md5, (gs_md5_byte_t *)pca0->hash);
+ ((cos_object_t *)pca0)->md5_valid = true;
}
if (!pca1->md5_valid) {
- gs_md5_init((gs_md5_state_t *)&pca1->md5);
- code = cos_array_hash(pco1, (gs_md5_state_t *)&pca1->md5, (gs_md5_byte_t *)pca1->hash, pdev);
- if (code < 0)
- return code;
- gs_md5_finish((gs_md5_state_t *)&pca1->md5, (gs_md5_byte_t *)pca1->hash);
- ((cos_object_t *)pca1)->md5_valid = true;
+ gs_md5_init((gs_md5_state_t *)&pca1->md5);
+ code = cos_array_hash(pco1, (gs_md5_state_t *)&pca1->md5, (gs_md5_byte_t *)pca1->hash, pdev);
+ if (code < 0)
+ return code;
+ gs_md5_finish((gs_md5_state_t *)&pca1->md5, (gs_md5_byte_t *)pca1->hash);
+ ((cos_object_t *)pca1)->md5_valid = true;
}
if (memcmp(&pca0->hash, &pca1->hash, 16) != 0)
- return false;
+ return false;
return true;
}
@@ -593,14 +593,13 @@ cos_array_hash(const cos_object_t *pco0, gs_md5_state_t *md5, gs_md5_byte_t *has
int code;
for (pcae0 = first0; pcae0;pcae0 = pcae0->next) {
- code = cos_value_hash(&pcae0->value, md5, hash, pdev);
- if (code < 0)
- return code;
+ code = cos_value_hash(&pcae0->value, md5, hash, pdev);
+ if (code < 0)
+ return code;
}
return 0;
}
-
/* Put/add an element in/to an array. */
int
cos_array_put(cos_array_t *pca, long index, const cos_value_t *pvalue)
@@ -610,9 +609,9 @@ cos_array_put(cos_array_t *pca, long index, const cos_value_t *pvalue)
int code = cos_copy_element_value(&value, mem, pvalue, true);
if (code >= 0) {
- code = cos_array_put_no_copy(pca, index, &value);
- if (code < 0)
- cos_uncopy_element_value(&value, mem, true);
+ code = cos_array_put_no_copy(pca, index, &value);
+ if (code < 0)
+ cos_uncopy_element_value(&value, mem, true);
}
pca->md5_valid = false;
return code;
@@ -626,21 +625,21 @@ cos_array_put_no_copy(cos_array_t *pca, long index, const cos_value_t *pvalue)
cos_array_element_t *next;
while ((next = *ppcae) != 0 && next->index > index)
- ppcae = &next->next;
+ ppcae = &next->next;
if (next && next->index == index) {
- /* We're replacing an existing element. */
- cos_value_free(&next->value, COS_OBJECT(pca),
- "cos_array_put(old value)");
- pcae = next;
+ /* We're replacing an existing element. */
+ cos_value_free(&next->value, COS_OBJECT(pca),
+ "cos_array_put(old value)");
+ pcae = next;
} else {
- /* Create a new element. */
- pcae = gs_alloc_struct(mem, cos_array_element_t, &st_cos_array_element,
- "cos_array_put(element)");
- if (pcae == 0)
- return_error(gs_error_VMerror);
- pcae->index = index;
- pcae->next = next;
- *ppcae = pcae;
+ /* Create a new element. */
+ pcae = gs_alloc_struct(mem, cos_array_element_t, &st_cos_array_element,
+ "cos_array_put(element)");
+ if (pcae == 0)
+ return_error(gs_error_VMerror);
+ pcae->index = index;
+ pcae->next = next;
+ *ppcae = pcae;
}
pcae->value = *pvalue;
pca->md5_valid = false;
@@ -711,9 +710,9 @@ cos_array_unadd(cos_array_t *pca, cos_value_t *pvalue)
cos_array_element_t *pcae = pca->elements;
if (pcae == 0 ||
- pcae->index != (pcae->next == 0 ? 0 : pcae->next->index + 1)
- )
- return_error(gs_error_rangecheck);
+ pcae->index != (pcae->next == 0 ? 0 : pcae->next->index + 1)
+ )
+ return_error(gs_error_rangecheck);
*pvalue = pcae->value;
pca->elements = pcae->next;
gs_free_object(COS_OBJECT_MEMORY(pca), pcae, "cos_array_unadd");
@@ -729,7 +728,7 @@ cos_array_element_first(const cos_array_t *pca)
}
const cos_array_element_t *
cos_array_element_next(const cos_array_element_t *pca, long *pindex,
- const cos_value_t **ppvalue)
+ const cos_value_t **ppvalue)
{
*pindex = pca->index;
*ppvalue = &pca->value;
@@ -750,8 +749,8 @@ cos_array_reorder(const cos_array_t *pca, cos_array_element_t *first)
cos_array_element_t *pcae;
for (pcae = (first ? first : pca->elements), last = NULL; pcae;
- pcae = next)
- next = pcae->next, pcae->next = last, last = pcae;
+ pcae = next)
+ next = pcae->next, pcae->next = last, last = pcae;
return last;
}
@@ -770,7 +769,7 @@ cos_dict_alloc(gx_device_pdf *pdev, client_name_t cname)
{
gs_memory_t *mem = pdev->pdf_memory;
cos_dict_t *pcd =
- gs_alloc_struct(mem, cos_dict_t, &st_cos_object, cname);
+ gs_alloc_struct(mem, cos_dict_t, &st_cos_object, cname);
cos_object_init((cos_object_t *)pcd, pdev, &cos_dict_procs);
return pcd;
@@ -778,13 +777,13 @@ cos_dict_alloc(gx_device_pdf *pdev, client_name_t cname)
static void
cos_dict_element_free(cos_dict_t *pcd, cos_dict_element_t *pcde,
- client_name_t cname)
+ client_name_t cname)
{
gs_memory_t *mem = COS_OBJECT_MEMORY(pcd);
cos_value_free(&pcde->value, COS_OBJECT(pcd), cname);
if (pcde->owns_key)
- gs_free_string(mem, pcde->key.data, pcde->key.size, cname);
+ gs_free_string(mem, pcde->key.data, pcde->key.size, cname);
gs_free_object(mem, pcde, cname);
}
@@ -796,8 +795,8 @@ cos_dict_release(cos_object_t *pco, client_name_t cname)
cos_dict_element_t *next;
for (cur = pcd->elements; cur; cur = next) {
- next = cur->next;
- cos_dict_element_free(pcd, cur, cname);
+ next = cur->next;
+ cos_dict_element_free(pcd, cur, cname);
}
pcd->elements = 0;
}
@@ -805,63 +804,63 @@ cos_dict_release(cos_object_t *pco, client_name_t cname)
/* Write the elements of a dictionary. */
static int
cos_elements_write(stream *s, const cos_dict_element_t *pcde,
- gx_device_pdf *pdev, bool do_space, gs_id object_id)
+ gx_device_pdf *pdev, bool do_space, gs_id object_id)
{
int Element_Count = 0;
if (pcde) {
- /* Temporarily replace the output stream in pdev. */
- stream *save = pdev->strm;
-
- pdev->strm = s;
- for (;;) {
- gs_id object_id1 = (pdev->NoEncrypt.size == 0 ||
- bytes_compare(pdev->NoEncrypt.data, pdev->NoEncrypt.size,
- pcde->key.data, pcde->key.size)
- ? object_id : (gs_id)-1);
-
- Element_Count++;
-
- if(pdev->PDFA && Element_Count > 4095) {
- switch (pdev->PDFACompatibilityPolicy) {
- case 0:
- emprintf(pdev->memory,
+ /* Temporarily replace the output stream in pdev. */
+ stream *save = pdev->strm;
+
+ pdev->strm = s;
+ for (;;) {
+ gs_id object_id1 = (pdev->NoEncrypt.size == 0 ||
+ bytes_compare(pdev->NoEncrypt.data, pdev->NoEncrypt.size,
+ pcde->key.data, pcde->key.size)
+ ? object_id : (gs_id)-1);
+
+ Element_Count++;
+
+ if(pdev->PDFA && Element_Count > 4095) {
+ switch (pdev->PDFACompatibilityPolicy) {
+ case 0:
+ emprintf(pdev->memory,
"Too many entries in dictionary,\n max 4095 in PDF/A, reverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- case 1:
- emprintf(pdev->memory,
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ case 1:
+ emprintf(pdev->memory,
"Too many entries in dictionary,\n max 4095 in PDF/A. Cannot simply elide dictionary, reverting to normal output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- case 2:
- emprintf(pdev->memory,
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ case 2:
+ emprintf(pdev->memory,
"Too many entries in dictionary,\n max 4095 in PDF/A. aborting conversion\n");
- /* Careful here, only certain errors will bubble up
- * through the text processing.
- */
- return gs_error_limitcheck;
- break;
- default:
- emprintf(pdev->memory,
+ /* Careful here, only certain errors will bubble up
+ * through the text processing.
+ */
+ return gs_error_limitcheck;
+ break;
+ default:
+ emprintf(pdev->memory,
"Too many entries in dictionary,\n max 4095 in PDF/A. Unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- }
- }
-
- pdf_write_value(pdev, pcde->key.data, pcde->key.size, object_id1);
- cos_value_write_spaced(&pcde->value, pdev, true, object_id1);
- pcde = pcde->next;
- if (pcde || do_space)
- stream_putc(s, '\n');
- if (!pcde)
- break;
- }
- pdev->strm = save;
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ }
+ }
+
+ pdf_write_value(pdev, pcde->key.data, pcde->key.size, object_id1);
+ cos_value_write_spaced(&pcde->value, pdev, true, object_id1);
+ pcde = pcde->next;
+ if (pcde || do_space)
+ stream_putc(s, '\n');
+ if (!pcde)
+ break;
+ }
+ pdev->strm = save;
}
return 0;
}
@@ -892,10 +891,10 @@ cos_dict_objects_write(const cos_dict_t *pcd, gx_device_pdf *pdev)
const cos_dict_element_t *pcde = pcd->elements;
for (; pcde; pcde = pcde->next)
- if (COS_VALUE_IS_OBJECT(&pcde->value) &&
- pcde->value.contents.object->id &&
- !pcde->value.contents.object->written /* ForOPDFRead only. */)
- cos_write_object(pcde->value.contents.object, pdev, resourceOther);
+ if (COS_VALUE_IS_OBJECT(&pcde->value) &&
+ pcde->value.contents.object->id &&
+ !pcde->value.contents.object->written /* ForOPDFRead only. */)
+ cos_write_object(pcde->value.contents.object, pdev, resourceOther);
return 0;
}
int
@@ -909,15 +908,15 @@ cos_dict_objects_delete(cos_dict_t *pcd)
* free them.
*/
for (; pcde; pcde = pcde->next) {
- if (pcde->value.contents.object) {
- cos_dict_element_t *pcde1 = pcde->next;
-
- for (; pcde1; pcde1 = pcde1->next)
- if (pcde->value.contents.object == pcde1->value.contents.object)
- pcde1->value.contents.object = NULL;
- pcde->value.contents.object->id = 0;
- }
- }
+ if (pcde->value.contents.object) {
+ cos_dict_element_t *pcde1 = pcde->next;
+
+ for (; pcde1; pcde1 = pcde1->next)
+ if (pcde->value.contents.object == pcde1->value.contents.object)
+ pcde1->value.contents.object = NULL;
+ pcde->value.contents.object->id = 0;
+ }
+ }
return 0;
}
@@ -928,7 +927,7 @@ cos_dict_objects_delete(cos_dict_t *pcd)
#define DICT_COPY_ALL (DICT_COPY_KEY | DICT_COPY_VALUE | DICT_FREE_KEY)
static int
cos_dict_put_copy(cos_dict_t *pcd, const byte *key_data, uint key_size,
- const cos_value_t *pvalue, int flags)
+ const cos_value_t *pvalue, int flags)
{
gs_memory_t *mem = COS_OBJECT_MEMORY(pcd);
cos_dict_element_t **ppcde = &pcd->elements;
@@ -938,63 +937,63 @@ cos_dict_put_copy(cos_dict_t *pcd, const byte *key_data, uint key_size,
int code;
while ((next = *ppcde) != 0 &&
- bytes_compare(next->key.data, next->key.size, key_data, key_size)
- )
- ppcde = &next->next;
+ bytes_compare(next->key.data, next->key.size, key_data, key_size)
+ )
+ ppcde = &next->next;
if (next) {
- /* We're replacing an existing element. */
- if ((pvalue->value_type == COS_VALUE_SCALAR ||
- pvalue->value_type == COS_VALUE_CONST) &&
- pvalue->value_type == next->value.value_type &&
- !bytes_compare(pvalue->contents.chars.data, pvalue->contents.chars.size,
- next->value.contents.chars.data, next->value.contents.chars.size))
- return 0; /* Same as old value. */
- if ((pvalue->value_type == COS_VALUE_OBJECT ||
- pvalue->value_type == COS_VALUE_RESOURCE) &&
- pvalue->value_type == next->value.value_type &&
- pvalue->contents.object == next->value.contents.object)
- return 0; /* Same as old value. */
- code = cos_copy_element_value(&value, mem, pvalue,
- (flags & DICT_COPY_VALUE) != 0);
- if (code < 0)
- return code;
- if (flags & DICT_FREE_KEY)
- gs_free_const_string(mem, key_data, key_size,
- "cos_dict_put(new key)");
- cos_value_free(&next->value, COS_OBJECT(pcd),
- "cos_dict_put(old value)");
- pcde = next;
+ /* We're replacing an existing element. */
+ if ((pvalue->value_type == COS_VALUE_SCALAR ||
+ pvalue->value_type == COS_VALUE_CONST) &&
+ pvalue->value_type == next->value.value_type &&
+ !bytes_compare(pvalue->contents.chars.data, pvalue->contents.chars.size,
+ next->value.contents.chars.data, next->value.contents.chars.size))
+ return 0; /* Same as old value. */
+ if ((pvalue->value_type == COS_VALUE_OBJECT ||
+ pvalue->value_type == COS_VALUE_RESOURCE) &&
+ pvalue->value_type == next->value.value_type &&
+ pvalue->contents.object == next->value.contents.object)
+ return 0; /* Same as old value. */
+ code = cos_copy_element_value(&value, mem, pvalue,
+ (flags & DICT_COPY_VALUE) != 0);
+ if (code < 0)
+ return code;
+ if (flags & DICT_FREE_KEY)
+ gs_free_const_string(mem, key_data, key_size,
+ "cos_dict_put(new key)");
+ cos_value_free(&next->value, COS_OBJECT(pcd),
+ "cos_dict_put(old value)");
+ pcde = next;
} else {
- /* Create a new element. */
- byte *copied_key_data;
-
- if (flags & DICT_COPY_KEY) {
- copied_key_data = gs_alloc_string(mem, key_size,
- "cos_dict_put(key)");
- if (copied_key_data == 0)
- return_error(gs_error_VMerror);
- memcpy(copied_key_data, key_data, key_size);
- } else
- copied_key_data = (byte *)key_data; /* OK to break const */
- pcde = gs_alloc_struct(mem, cos_dict_element_t, &st_cos_dict_element,
- "cos_dict_put(element)");
- code = cos_copy_element_value(&value, mem, pvalue,
- (flags & DICT_COPY_VALUE) != 0);
- if (pcde == 0 || code < 0) {
- if (code >= 0)
- cos_uncopy_element_value(&value, mem,
- (flags & DICT_COPY_VALUE) != 0);
- gs_free_object(mem, pcde, "cos_dict_put(element)");
- if (flags & DICT_COPY_KEY)
- gs_free_string(mem, copied_key_data, key_size,
- "cos_dict_put(key)");
- return (code < 0 ? code : gs_note_error(gs_error_VMerror));
- }
- pcde->key.data = copied_key_data;
- pcde->key.size = key_size;
- pcde->owns_key = (flags & DICT_FREE_KEY) != 0;
- pcde->next = next;
- *ppcde = pcde;
+ /* Create a new element. */
+ byte *copied_key_data;
+
+ if (flags & DICT_COPY_KEY) {
+ copied_key_data = gs_alloc_string(mem, key_size,
+ "cos_dict_put(key)");
+ if (copied_key_data == 0)
+ return_error(gs_error_VMerror);
+ memcpy(copied_key_data, key_data, key_size);
+ } else
+ copied_key_data = (byte *)key_data; /* OK to break const */
+ pcde = gs_alloc_struct(mem, cos_dict_element_t, &st_cos_dict_element,
+ "cos_dict_put(element)");
+ code = cos_copy_element_value(&value, mem, pvalue,
+ (flags & DICT_COPY_VALUE) != 0);
+ if (pcde == 0 || code < 0) {
+ if (code >= 0)
+ cos_uncopy_element_value(&value, mem,
+ (flags & DICT_COPY_VALUE) != 0);
+ gs_free_object(mem, pcde, "cos_dict_put(element)");
+ if (flags & DICT_COPY_KEY)
+ gs_free_string(mem, copied_key_data, key_size,
+ "cos_dict_put(key)");
+ return (code < 0 ? code : gs_note_error(gs_error_VMerror));
+ }
+ pcde->key.data = copied_key_data;
+ pcde->key.size = key_size;
+ pcde->owns_key = (flags & DICT_FREE_KEY) != 0;
+ pcde->next = next;
+ *ppcde = pcde;
}
pcde->value = value;
pcd->md5_valid = false;
@@ -1002,26 +1001,26 @@ cos_dict_put_copy(cos_dict_t *pcd, const byte *key_data, uint key_size,
}
int
cos_dict_put(cos_dict_t *pcd, const byte *key_data, uint key_size,
- const cos_value_t *pvalue)
+ const cos_value_t *pvalue)
{
return cos_dict_put_copy(pcd, key_data, key_size, pvalue, DICT_COPY_ALL);
}
int
cos_dict_put_no_copy(cos_dict_t *pcd, const byte *key_data, uint key_size,
- const cos_value_t *pvalue)
+ const cos_value_t *pvalue)
{
return cos_dict_put_copy(pcd, key_data, key_size, pvalue,
- DICT_COPY_KEY | DICT_FREE_KEY);
+ DICT_COPY_KEY | DICT_FREE_KEY);
}
int
cos_dict_put_c_key(cos_dict_t *pcd, const char *key, const cos_value_t *pvalue)
{
return cos_dict_put_copy(pcd, (const byte *)key, strlen(key), pvalue,
- DICT_COPY_VALUE);
+ DICT_COPY_VALUE);
}
int
cos_dict_put_c_key_string(cos_dict_t *pcd, const char *key,
- const byte *data, uint size)
+ const byte *data, uint size)
{
cos_value_t value;
@@ -1039,9 +1038,9 @@ cos_dict_put_c_key_int(cos_dict_t *pcd, const char *key, int value)
int
cos_dict_put_c_key_bool(cos_dict_t *pcd, const char *key, bool value)
{
- return cos_dict_put_c_key_string(pcd, key,
- (const byte *)(value ? "true" : "false"),
- (value ? 4 : 5));
+ return cos_dict_put_c_key_string(pcd, key,
+ (const byte *)(value ? "true" : "false"),
+ (value ? 4 : 5));
}
int
cos_dict_put_c_key_real(cos_dict_t *pcd, const char *key, floatp value)
@@ -1056,17 +1055,17 @@ cos_dict_put_c_key_real(cos_dict_t *pcd, const char *key, floatp value)
}
int
cos_dict_put_c_key_floats(cos_dict_t *pcd, const char *key, const float *pf,
- uint size)
+ uint size)
{
cos_array_t *pca = cos_array_from_floats(pcd->pdev, pf, size,
- "cos_dict_put_c_key_floats");
+ "cos_dict_put_c_key_floats");
int code;
if (pca == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = cos_dict_put_c_key_object(pcd, key, COS_OBJECT(pca));
if (code < 0)
- COS_FREE(pca, "cos_dict_put_c_key_floats");
+ COS_FREE(pca, "cos_dict_put_c_key_floats");
return code;
}
int
@@ -1078,12 +1077,12 @@ cos_dict_put_c_key_object(cos_dict_t *pcd, const char *key, cos_object_t *pco)
}
int
cos_dict_put_string(cos_dict_t *pcd, const byte *key_data, uint key_size,
- const byte *value_data, uint value_size)
+ const byte *value_data, uint value_size)
{
cos_value_t cvalue;
return cos_dict_put(pcd, key_data, key_size,
- cos_string_value(&cvalue, value_data, value_size));
+ cos_string_value(&cvalue, value_data, value_size));
}
int
cos_dict_put_string_copy(cos_dict_t *pcd, const char *key, const char *value)
@@ -1106,17 +1105,17 @@ cos_dict_move_all(cos_dict_t *pcdto, cos_dict_t *pcdfrom)
cos_dict_element_t *head = pcdto->elements;
while (pcde) {
- cos_dict_element_t *next = pcde->next;
-
- if (cos_dict_find(pcdto, pcde->key.data, pcde->key.size)) {
- /* Free the element, which has been superseded. */
- cos_dict_element_free(pcdfrom, pcde, "cos_dict_move_all_from");
- } else {
- /* Move the element. */
- pcde->next = head;
- head = pcde;
- }
- pcde = next;
+ cos_dict_element_t *next = pcde->next;
+
+ if (cos_dict_find(pcdto, pcde->key.data, pcde->key.size)) {
+ /* Free the element, which has been superseded. */
+ cos_dict_element_free(pcdfrom, pcde, "cos_dict_move_all_from");
+ } else {
+ /* Move the element. */
+ pcde->next = head;
+ head = pcde;
+ }
+ pcde = next;
}
pcdto->elements = head;
pcdfrom->elements = 0;
@@ -1131,8 +1130,8 @@ cos_dict_find(const cos_dict_t *pcd, const byte *key_data, uint key_size)
cos_dict_element_t *pcde = pcd->elements;
for (; pcde; pcde = pcde->next)
- if (!bytes_compare(key_data, key_size, pcde->key.data, pcde->key.size))
- return &pcde->value;
+ if (!bytes_compare(key_data, key_size, pcde->key.data, pcde->key.size))
+ return &pcde->value;
return 0;
}
const cos_value_t *
@@ -1147,8 +1146,8 @@ int cos_dict_hash(const cos_object_t *pco0, gs_md5_state_t *md5, gs_md5_byte_t *
cos_dict_element_t *pcde0 = dict->elements;
for (; pcde0; pcde0 = pcde0->next) {
- gs_md5_append(md5, pcde0->key.data, pcde0->key.size);
- cos_value_hash(&pcde0->value, md5, hash, pdev);
+ gs_md5_append(md5, pcde0->key.data, pcde0->key.size);
+ cos_value_hash(&pcde0->value, md5, hash, pdev);
}
return 0;
}
@@ -1160,39 +1159,39 @@ cos_dict_equal(const cos_object_t *pco0, const cos_object_t *pco1, gx_device_pdf
int code = 0;
if (!pco0->md5_valid) {
- gs_md5_init((gs_md5_state_t *)&pco0->md5);
- code = cos_dict_hash(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)pco0->hash, pdev);
- if (code < 0)
- return code;
- gs_md5_finish((gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)pco0->hash);
- ((cos_object_t *)pco0)->md5_valid = true;
+ gs_md5_init((gs_md5_state_t *)&pco0->md5);
+ code = cos_dict_hash(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)pco0->hash, pdev);
+ if (code < 0)
+ return code;
+ gs_md5_finish((gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)pco0->hash);
+ ((cos_object_t *)pco0)->md5_valid = true;
}
if (!pco1->md5_valid) {
- gs_md5_init((gs_md5_state_t *)&pco1->md5);
- code = cos_dict_hash(pco1, (gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)pco1->hash, pdev);
- if (code < 0)
- return code;
- gs_md5_finish((gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)pco1->hash);
- ((cos_object_t *)pco1)->md5_valid = true;
+ gs_md5_init((gs_md5_state_t *)&pco1->md5);
+ code = cos_dict_hash(pco1, (gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)pco1->hash, pdev);
+ if (code < 0)
+ return code;
+ gs_md5_finish((gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)pco1->hash);
+ ((cos_object_t *)pco1)->md5_valid = true;
}
if (memcmp(&pco0->hash, &pco1->hash, 16) != 0)
- return false;
+ return false;
return true;
}
/* Process all entries in a dictionary. */
int
-cos_dict_forall(const cos_dict_t *pcd, void *client_data,
- int (*proc)(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v))
+cos_dict_forall(const cos_dict_t *pcd, void *client_data,
+ int (*proc)(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v))
{
cos_dict_element_t *pcde = pcd->elements;
for (; pcde; pcde = pcde->next) {
- int code = proc(client_data, pcde->key.data, pcde->key.size, &pcde->value);
+ int code = proc(client_data, pcde->key.data, pcde->key.size, &pcde->value);
- if (code != 0)
- return code;
+ if (code != 0)
+ return code;
}
return 0;
}
@@ -1211,10 +1210,10 @@ static const gs_param_list_procs cos_param_list_writer_procs = {
};
static int
cos_param_put_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
cos_param_list_writer_t *const pclist =
- (cos_param_list_writer_t *)plist;
+ (cos_param_list_writer_t *)plist;
gx_device_pdf *pdev = pclist->pcd->pdev;
gs_memory_t *mem = pclist->memory;
cos_value_t value;
@@ -1224,65 +1223,65 @@ cos_param_put_typed(gs_param_list * plist, gs_param_name pkey,
int code;
if (key_len > sizeof(key_chars) - 1)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
switch (pvalue->type) {
default: {
- param_printer_params_t ppp;
- printer_param_list_t pplist;
- stream s;
- int len, skip;
- byte *str;
+ param_printer_params_t ppp;
+ printer_param_list_t pplist;
+ stream s;
+ int len, skip;
+ byte *str;
- s_init(&s, NULL);
+ s_init(&s, NULL);
ppp = param_printer_params_default;
- ppp.prefix = ppp.suffix = ppp.item_prefix = ppp.item_suffix = 0;
- ppp.print_ok = pclist->print_ok;
- s_init_param_printer(&pplist, &ppp, &s);
- swrite_position_only(&s);
- param_write_typed((gs_param_list *)&pplist, "", pvalue);
- len = stell(&s);
- str = gs_alloc_string(mem, len, "cos_param_put(string)");
- if (str == 0)
- return_error(gs_error_VMerror);
- swrite_string(&s, str, len);
- param_write_typed((gs_param_list *)&pplist, "", pvalue);
- /*
- * The string starts with an initial / or /<space>, which
- * we need to remove.
- */
- skip = (str[1] == ' ' ? 2 : 1);
- memmove(str, str + skip, len - skip);
- str = gs_resize_string(mem, str, len, len - skip,
- "cos_param_put(string)");
- cos_string_value(&value, str, len - skip);
+ ppp.prefix = ppp.suffix = ppp.item_prefix = ppp.item_suffix = 0;
+ ppp.print_ok = pclist->print_ok;
+ s_init_param_printer(&pplist, &ppp, &s);
+ swrite_position_only(&s);
+ param_write_typed((gs_param_list *)&pplist, "", pvalue);
+ len = stell(&s);
+ str = gs_alloc_string(mem, len, "cos_param_put(string)");
+ if (str == 0)
+ return_error(gs_error_VMerror);
+ swrite_string(&s, str, len);
+ param_write_typed((gs_param_list *)&pplist, "", pvalue);
+ /*
+ * The string starts with an initial / or /<space>, which
+ * we need to remove.
+ */
+ skip = (str[1] == ' ' ? 2 : 1);
+ memmove(str, str + skip, len - skip);
+ str = gs_resize_string(mem, str, len, len - skip,
+ "cos_param_put(string)");
+ cos_string_value(&value, str, len - skip);
}
- break;
+ break;
case gs_param_type_int_array: {
- uint i;
+ uint i;
- pca = cos_array_alloc(pdev, "cos_param_put(array)");
- if (pca == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < pvalue->value.ia.size; ++i)
- CHECK(cos_array_add_int(pca, pvalue->value.ia.data[i]));
+ pca = cos_array_alloc(pdev, "cos_param_put(array)");
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < pvalue->value.ia.size; ++i)
+ CHECK(cos_array_add_int(pca, pvalue->value.ia.data[i]));
}
av:
- cos_object_value(&value, COS_OBJECT(pca));
- break;
+ cos_object_value(&value, COS_OBJECT(pca));
+ break;
case gs_param_type_float_array: {
- uint i;
+ uint i;
- pca = cos_array_alloc(pdev, "cos_param_put(array)");
- if (pca == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < pvalue->value.ia.size; ++i)
- CHECK(cos_array_add_real(pca, pvalue->value.fa.data[i]));
+ pca = cos_array_alloc(pdev, "cos_param_put(array)");
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < pvalue->value.ia.size; ++i)
+ CHECK(cos_array_add_real(pca, pvalue->value.fa.data[i]));
}
- goto av;
+ goto av;
case gs_param_type_string_array:
case gs_param_type_name_array:
- /****** NYI ******/
- return_error(gs_error_typecheck);
+ /****** NYI ******/
+ return_error(gs_error_typecheck);
}
memcpy(key_chars + 1, pkey, key_len);
key_chars[0] = '/';
@@ -1291,10 +1290,10 @@ cos_param_put_typed(gs_param_list * plist, gs_param_name pkey,
int
cos_param_list_writer_init(cos_param_list_writer_t *pclist, cos_dict_t *pcd,
- int print_ok)
+ int print_ok)
{
gs_param_list_init((gs_param_list *)pclist, &cos_param_list_writer_procs,
- COS_OBJECT_MEMORY(pcd));
+ COS_OBJECT_MEMORY(pcd));
pclist->pcd = pcd;
pclist->print_ok = print_ok;
return 0;
@@ -1315,7 +1314,7 @@ cos_stream_alloc(gx_device_pdf *pdev, client_name_t cname)
{
gs_memory_t *mem = pdev->pdf_memory;
cos_stream_t *pcs =
- gs_alloc_struct(mem, cos_stream_t, &st_cos_object, cname);
+ gs_alloc_struct(mem, cos_stream_t, &st_cos_object, cname);
cos_object_init((cos_object_t *)pcs, pdev, &cos_stream_procs);
return pcs;
@@ -1330,8 +1329,8 @@ cos_stream_release(cos_object_t *pco, client_name_t cname)
cos_stream_piece_t *next;
for (cur = pcs->pieces; cur; cur = next) {
- next = cur->next;
- gs_free_object(mem, cur, cname);
+ next = cur->next;
+ gs_free_object(mem, cur, cname);
}
pcs->pieces = 0;
cos_dict_release(pco, cname);
@@ -1347,19 +1346,19 @@ static int hash_cos_stream(const cos_object_t *pco0, gs_md5_state_t *md5, gs_md5
int result;
if (!pcsp)
- return -1;
+ return -1;
gs_md5_init(md5);
while(pcsp) {
- ptr = gs_malloc(pdev->memory, sizeof (byte), pcsp->size, "hash_cos_stream");
- fseek(sfile, pcsp->position, SEEK_SET);
- if (fread(ptr, 1, pcsp->size, sfile) != pcsp->size) {
- result = gs_note_error(gs_error_ioerror);
- return result;
- }
- gs_md5_append(md5, ptr, pcsp->size);
- gs_free(pdev->memory, ptr, sizeof (byte), pcsp->size, "hash_cos_stream");
- pcsp = pcsp->next;
+ ptr = gs_malloc(pdev->memory, sizeof (byte), pcsp->size, "hash_cos_stream");
+ fseek(sfile, pcsp->position, SEEK_SET);
+ if (fread(ptr, 1, pcsp->size, sfile) != pcsp->size) {
+ result = gs_note_error(gs_error_ioerror);
+ return result;
+ }
+ gs_md5_append(md5, ptr, pcsp->size);
+ gs_free(pdev->memory, ptr, sizeof (byte), pcsp->size, "hash_cos_stream");
+ pcsp = pcsp->next;
}
fseek(sfile, position_save, SEEK_SET);
gs_md5_finish(md5, (gs_md5_byte_t *)hash);
@@ -1371,17 +1370,16 @@ static int cos_stream_hash(const cos_object_t *pco0, gs_md5_state_t *md5, gs_md5
cos_stream_t *pcs0 = (cos_stream_t *)pco0;
int code;
if (!pco0->stream_md5_valid) {
- code = hash_cos_stream(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)&pco0->stream_hash, pdev);
- if (code < 0)
- return false;
- pcs0->stream_md5_valid = 1;
+ code = hash_cos_stream(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)&pco0->stream_hash, pdev);
+ if (code < 0)
+ return false;
+ pcs0->stream_md5_valid = 1;
}
gs_md5_append(md5, (byte *)&pco0->stream_hash, sizeof(pco0->stream_hash));
code = cos_dict_hash(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)pco0->hash, pdev);
return code;
}
-
static int
cos_stream_equal(const cos_object_t *pco0, const cos_object_t *pco1, gx_device_pdf *pdev)
{
@@ -1390,24 +1388,24 @@ cos_stream_equal(const cos_object_t *pco0, const cos_object_t *pco1, gx_device_p
int code;
if (!pco0->stream_md5_valid) {
- code = cos_stream_hash(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)&pco0->stream_hash, pdev);
- if (code < 0)
- return false;
- pcs0->stream_md5_valid = 1;
+ code = cos_stream_hash(pco0, (gs_md5_state_t *)&pco0->md5, (gs_md5_byte_t *)&pco0->stream_hash, pdev);
+ if (code < 0)
+ return false;
+ pcs0->stream_md5_valid = 1;
}
if (!pco1->stream_md5_valid) {
- code = cos_stream_hash(pco1, (gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)&pco1->stream_hash, pdev);
- if (code < 0)
- return false;
- pcs1->stream_md5_valid = 1;
+ code = cos_stream_hash(pco1, (gs_md5_state_t *)&pco1->md5, (gs_md5_byte_t *)&pco1->stream_hash, pdev);
+ if (code < 0)
+ return false;
+ pcs1->stream_md5_valid = 1;
}
if (memcmp(&pcs0->stream_hash, &pcs1->stream_hash, 16) != 0)
- return false;
+ return false;
code = cos_dict_equal(pco0, pco1, pdev);
if (code < 0)
- return code;
+ return code;
if (!code)
- return false;
+ return false;
return true;
}
@@ -1441,30 +1439,30 @@ cos_stream_contents_write(const cos_stream_t *pcs, gx_device_pdf *pdev)
stream_arcfour_state sarc4, *ss = NULL;
if (pdev->KeyLength) {
- code = pdf_encrypt_init(pdev, pcs->id, &sarc4);
- if (code < 0)
- return code;
- ss = &sarc4;
+ code = pdf_encrypt_init(pdev, pcs->id, &sarc4);
+ if (code < 0)
+ return code;
+ ss = &sarc4;
}
sflush(s);
sflush(pdev->streams.strm);
/* Reverse the elements temporarily. */
for (pcsp = pcs->pieces, last = NULL; pcsp; pcsp = next)
- next = pcsp->next, pcsp->next = last, last = pcsp;
+ next = pcsp->next, pcsp->next = last, last = pcsp;
for (pcsp = last, code = 0; pcsp && code >= 0; pcsp = pcsp->next) {
- if (same_file)
- pdf_copy_data_safe(s, sfile, pcsp->position, pcsp->size);
- else {
- end_pos = ftell(sfile);
- fseek(sfile, pcsp->position, SEEK_SET);
- pdf_copy_data(s, sfile, pcsp->size, ss);
- fseek(sfile, end_pos, SEEK_SET);
- }
+ if (same_file)
+ pdf_copy_data_safe(s, sfile, pcsp->position, pcsp->size);
+ else {
+ end_pos = ftell(sfile);
+ fseek(sfile, pcsp->position, SEEK_SET);
+ pdf_copy_data(s, sfile, pcsp->size, ss);
+ fseek(sfile, end_pos, SEEK_SET);
+ }
}
/* Reverse the elements back. */
for (pcsp = last, last = NULL; pcsp; pcsp = next)
- next = pcsp->next, pcsp->next = last, last = pcsp;
+ next = pcsp->next, pcsp->next = last, last = pcsp;
return code;
}
@@ -1477,13 +1475,13 @@ cos_stream_write(const cos_object_t *pco, gx_device_pdf *pdev, gs_id object_id)
int code;
if (pcs->input_strm != NULL) {
- stream *s = pco->input_strm;
- int status = s_close_filters(&s, NULL);
+ stream *s = pco->input_strm;
+ int status = s_close_filters(&s, NULL);
- if (status < 0)
- return_error(gs_error_ioerror);
- /* We have to break const here to clear the input_strm. */
- ((cos_object_t *)pco)->input_strm = 0;
+ if (status < 0)
+ return_error(gs_error_ioerror);
+ /* We have to break const here to clear the input_strm. */
+ ((cos_object_t *)pco)->input_strm = 0;
}
stream_puts(s, "<<");
cos_elements_write(s, pcs->elements, pdev, false, object_id);
@@ -1513,19 +1511,19 @@ cos_stream_add(cos_stream_t *pcs, uint size)
/* Check for consecutive writing -- just an optimization. */
if (prev != 0 && prev->position + prev->size + size == position) {
- prev->size += size;
+ prev->size += size;
} else {
- gs_memory_t *mem = pdev->pdf_memory;
- cos_stream_piece_t *pcsp =
- gs_alloc_struct(mem, cos_stream_piece_t, &st_cos_stream_piece,
- "cos_stream_add");
-
- if (pcsp == 0)
- return_error(gs_error_VMerror);
- pcsp->position = position - size;
- pcsp->size = size;
- pcsp->next = pcs->pieces;
- pcs->pieces = pcsp;
+ gs_memory_t *mem = pdev->pdf_memory;
+ cos_stream_piece_t *pcsp =
+ gs_alloc_struct(mem, cos_stream_piece_t, &st_cos_stream_piece,
+ "cos_stream_add");
+
+ if (pcsp == 0)
+ return_error(gs_error_VMerror);
+ pcsp->position = position - size;
+ pcsp->size = size;
+ pcsp->next = pcs->pieces;
+ pcs->pieces = pcsp;
}
pcs->length += size;
return 0;
@@ -1549,15 +1547,15 @@ cos_stream_add_stream_contents(cos_stream_t *pcs, stream *s)
int status = sseek(s, 0);
if (status < 0)
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
do {
- status = sgets(s, sbuff, sizeof(sbuff), &cnt);
+ status = sgets(s, sbuff, sizeof(sbuff), &cnt);
- if (cnt == 0) {
- if (status == EOFC)
- break;
- return_error(gs_error_ioerror);
- }
+ if (cnt == 0) {
+ if (status == EOFC)
+ break;
+ return_error(gs_error_ioerror);
+ }
} while ((code = cos_stream_add_bytes(pcs, sbuff, cnt)) >= 0);
return code;
}
@@ -1573,16 +1571,16 @@ cos_stream_release_pieces(cos_stream_t *pcs)
gs_memory_t *mem = cos_object_memory((cos_object_t *)pcs);
while (pcs->pieces != NULL &&
- position == pcs->pieces->position + pcs->pieces->size) {
- cos_stream_piece_t *p = pcs->pieces;
+ position == pcs->pieces->position + pcs->pieces->size) {
+ cos_stream_piece_t *p = pcs->pieces;
- position -= p->size;
- pcs->pieces = p->next;
- gs_free_object(mem, p, "cos_stream_release_pieces");
+ position -= p->size;
+ pcs->pieces = p->next;
+ gs_free_object(mem, p, "cos_stream_release_pieces");
}
if (position0 != position)
- if (sseek(s, position) < 0)
- return_error(gs_error_ioerror);
+ if (sseek(s, position) < 0)
+ return_error(gs_error_ioerror);
return 0;
}
@@ -1597,13 +1595,13 @@ typedef struct cos_write_stream_state_s {
stream *target; /* use this instead of strm */
} cos_write_stream_state_t;
gs_private_st_suffix_add4(st_cos_write_stream_state, cos_write_stream_state_t,
- "cos_write_stream_state_t",
- cos_ws_state_enum_ptrs, cos_ws_state_reloc_ptrs,
- st_stream_state, pcs, pdev, s, target);
+ "cos_write_stream_state_t",
+ cos_ws_state_enum_ptrs, cos_ws_state_reloc_ptrs,
+ st_stream_state, pcs, pdev, s, target);
static int
cos_write_stream_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
uint count = pr->limit - pr->ptr;
cos_write_stream_state_t *ss = (cos_write_stream_state_t *)st;
@@ -1641,17 +1639,17 @@ static const stream_template cos_write_stream_template = {
};
stream *
cos_write_stream_alloc(cos_stream_t *pcs, gx_device_pdf *pdev,
- client_name_t cname)
+ client_name_t cname)
{
gs_memory_t *mem = pdev->pdf_memory;
stream *s = s_alloc(mem, cname);
cos_write_stream_state_t *ss = (cos_write_stream_state_t *)
- s_alloc_state(mem, &st_cos_write_stream_state, cname);
+ s_alloc_state(mem, &st_cos_write_stream_state, cname);
#define CWS_BUF_SIZE 512 /* arbitrary */
byte *buf = gs_alloc_bytes(mem, CWS_BUF_SIZE, cname);
if (s == 0 || ss == 0 || buf == 0)
- goto fail;
+ goto fail;
ss->template = &cos_write_stream_template;
ss->pcs = pcs;
ss->pcs->stream_md5_valid = 0;
@@ -1678,7 +1676,7 @@ cos_stream_from_pipeline(stream *s)
cos_write_stream_state_t *ss;
while(s->procs.process != cos_s_procs.process)
- s = s->strm;
+ s = s->strm;
ss = (cos_write_stream_state_t *)s->state;
return ss->pcs;
}
@@ -1688,7 +1686,6 @@ stream *
cos_write_stream_from_pipeline(stream *s)
{
while(s->procs.process != cos_s_procs.process)
- s = s->strm;
+ s = s->strm;
return s;
}
-
diff --git a/gs/base/gdevpdfo.h b/gs/base/gdevpdfo.h
index 3597625d8..98f8c3433 100644
--- a/gs/base/gdevpdfo.h
+++ b/gs/base/gdevpdfo.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -68,19 +68,19 @@ typedef struct cos_stream_piece_s cos_stream_piece_t;
#define cos_proc_release(proc)\
void proc(cos_object_t *pco, client_name_t cname)
- cos_proc_release((*release));
+ cos_proc_release((*release));
#define cos_proc_write(proc)\
int proc(const cos_object_t *pco, gx_device_pdf *pdev, gs_id object_id)
- cos_proc_write((*write));
+ cos_proc_write((*write));
#define cos_proc_equal(proc)\
int proc(const cos_object_t *pco0, const cos_object_t *pco1, gx_device_pdf *pdev)
- cos_proc_equal((*equal));
+ cos_proc_equal((*equal));
#define cos_proc_hash(proc)\
int proc(const cos_object_t *pco0, gs_md5_state_t *md5, gs_md5_byte_t *hash, gx_device_pdf *pdev)
- cos_proc_hash((*hash));
+ cos_proc_hash((*hash));
} /*cos_object_procs_t*/;
/*typedef const cos_object_procs_t *cos_type_t;*/
@@ -156,8 +156,8 @@ typedef enum {
struct cos_value_s {
cos_value_type_t value_type;
union vc_ {
- gs_string chars; /* SCALAR, CONST */
- cos_object_t *object; /* OBJECT, RESOURCE */
+ gs_string chars; /* SCALAR, CONST */
+ cos_object_t *object; /* OBJECT, RESOURCE */
} contents;
};
#define private_st_cos_value() /* in gdevpdfo.c */\
@@ -198,7 +198,7 @@ extern const cos_object_procs_t cos_stream_procs;
cos_object_t *cos_object_alloc(gx_device_pdf *, client_name_t);
cos_array_t *cos_array_alloc(gx_device_pdf *, client_name_t);
cos_array_t *cos_array_from_floats(gx_device_pdf *, const float *, uint,
- client_name_t);
+ client_name_t);
cos_dict_t *cos_dict_alloc(gx_device_pdf *, client_name_t);
cos_stream_t *cos_stream_alloc(gx_device_pdf *, client_name_t);
@@ -247,7 +247,7 @@ int cos_array_unadd(cos_array_t *, cos_value_t *);
/* dict */
int cos_dict_put(cos_dict_t *, const byte *, uint, const cos_value_t *);
int cos_dict_put_no_copy(cos_dict_t *, const byte *, uint,
- const cos_value_t *);
+ const cos_value_t *);
int cos_dict_put_c_key(cos_dict_t *, const char *, const cos_value_t *);
int cos_dict_put_c_key_string(cos_dict_t *, const char *, const byte *, uint);
int cos_dict_put_c_key_int(cos_dict_t *, const char *, int);
@@ -284,14 +284,14 @@ const cos_array_element_t *
cos_array_element_first(const cos_array_t *);
const cos_array_element_t *
cos_array_element_next(const cos_array_element_t *, long *,
- const cos_value_t **);
+ const cos_value_t **);
/* Look up a key in a dictionary. */
const cos_value_t *cos_dict_find(const cos_dict_t *, const byte *, uint);
const cos_value_t *cos_dict_find_c_key(const cos_dict_t *, const char *);
/* Process all entries in a dictionary. */
-int cos_dict_forall(const cos_dict_t *pcd, void *client_data,
- int (*proc)(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v));
+int cos_dict_forall(const cos_dict_t *pcd, void *client_data,
+ int (*proc)(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v));
/* Set up a parameter list that writes into a Cos dictionary. */
typedef struct cos_param_list_writer_s {
@@ -300,12 +300,12 @@ typedef struct cos_param_list_writer_s {
int print_ok;
} cos_param_list_writer_t;
int cos_param_list_writer_init(cos_param_list_writer_t *, cos_dict_t *,
- int print_ok);
+ int print_ok);
/* Create a stream that writes into a Cos stream. */
/* Closing the stream will free it. */
stream *cos_write_stream_alloc(cos_stream_t *pcs, gx_device_pdf *pdev,
- client_name_t cname);
+ client_name_t cname);
/* Get cos stream from pipeline. */
cos_stream_t * cos_stream_from_pipeline(stream *s);
diff --git a/gs/base/gdevpdfp.c b/gs/base/gdevpdfp.c
index 93664ba8d..853dd93ac 100644
--- a/gs/base/gdevpdfp.c
+++ b/gs/base/gdevpdfp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,13 +35,13 @@
* DSC - processed in this file
*/
static int pdf_dsc_process(gx_device_pdf * pdev,
- const gs_param_string_array * pma);
+ const gs_param_string_array * pma);
static const int CoreDistVersion = 5000; /* Distiller 5.0 */
static const gs_param_item_t pdf_param_items[] = {
#define pi(key, type, memb) { key, type, offset_of(gx_device_pdf, memb) }
- /* Acrobat Distiller 4 parameters */
+ /* Acrobat Distiller 4 parameters */
/*
* EndPage and StartPage are renamed because EndPage collides with
@@ -60,11 +60,11 @@ static const gs_param_item_t pdf_param_items[] = {
pi("PreserveCopyPage", gs_param_type_bool, PreserveCopyPage),
pi("UsePrologue", gs_param_type_bool, UsePrologue),
- /* Acrobat Distiller 5 parameters */
+ /* Acrobat Distiller 5 parameters */
pi("OffOptimizations", gs_param_type_int, OffOptimizations),
- /* Ghostscript-specific parameters */
+ /* Ghostscript-specific parameters */
pi("ReAssignCharacters", gs_param_type_bool, ReAssignCharacters),
pi("ReEncodeCharacters", gs_param_type_bool, ReEncodeCharacters),
@@ -74,7 +74,7 @@ static const gs_param_item_t pdf_param_items[] = {
pi("MaxInlineImageSize", gs_param_type_long, MaxInlineImageSize),
pi("DSCEncodingToUnicode", gs_param_type_int_array, DSCEncodingToUnicode),
- /* PDF Encryption */
+ /* PDF Encryption */
pi("OwnerPassword", gs_param_type_string, OwnerPassword),
pi("UserPassword", gs_param_type_string, UserPassword),
pi("KeyLength", gs_param_type_int, KeyLength),
@@ -82,7 +82,7 @@ static const gs_param_item_t pdf_param_items[] = {
pi("EncryptionR", gs_param_type_int, EncryptionR),
pi("NoEncrypt", gs_param_type_string, NoEncrypt),
- /* Target viewer capabilities (Ghostscript-specific) */
+ /* Target viewer capabilities (Ghostscript-specific) */
/* pi("ForOPDFRead", gs_param_type_bool, ForOPDFRead), pdfwrite-only */
pi("ProduceDSC", gs_param_type_bool, ProduceDSC),
pi("PatternImagemask", gs_param_type_bool, PatternImagemask),
@@ -125,7 +125,7 @@ static const gs_param_item_t pdf_param_items[] = {
#undef pi
gs_param_item_end
};
-
+
/*
Notes on implementing the remaining Distiller functionality
===========================================================
@@ -211,17 +211,17 @@ gdev_pdf_get_params(gx_device * dev, gs_param_list * plist)
pdev->ParamCompatibilityLevel = cl;
code = gdev_psdf_get_params(dev, plist);
if (code < 0 ||
- (code = param_write_int(plist, "CoreDistVersion", &cdv)) < 0 ||
- (code = param_write_float(plist, "CompatibilityLevel", &cl)) < 0 ||
- (pdev->is_ps2write && (code = param_write_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
- (!pdev->is_ps2write && (code = param_write_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0) ||
- /* Indicate that we can process pdfmark and DSC. */
- (param_requested(plist, "pdfmark") > 0 &&
- (code = param_write_null(plist, "pdfmark")) < 0) ||
- (param_requested(plist, "DSC") > 0 &&
- (code = param_write_null(plist, "DSC")) < 0) ||
- (code = gs_param_write_items(plist, pdev, NULL, pdf_param_items)) < 0
- )
+ (code = param_write_int(plist, "CoreDistVersion", &cdv)) < 0 ||
+ (code = param_write_float(plist, "CompatibilityLevel", &cl)) < 0 ||
+ (pdev->is_ps2write && (code = param_write_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
+ (!pdev->is_ps2write && (code = param_write_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0) ||
+ /* Indicate that we can process pdfmark and DSC. */
+ (param_requested(plist, "pdfmark") > 0 &&
+ (code = param_write_null(plist, "pdfmark")) < 0) ||
+ (param_requested(plist, "DSC") > 0 &&
+ (code = param_write_null(plist, "DSC")) < 0) ||
+ (code = gs_param_write_items(plist, pdev, NULL, pdf_param_items)) < 0
+ )
{}
return code;
}
@@ -238,7 +238,7 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
bool locked = pdev->params.LockDistillerParams;
gs_param_name param_name;
enum psdf_color_conversion_strategy save_ccs = pdev->params.ColorConversionStrategy;
-
+
pdev->pdf_memory = gs_memory_stable(pdev->memory);
/*
* If this is a pseudo-parameter (pdfmark or DSC),
@@ -246,43 +246,43 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
*/
{
- gs_param_string_array ppa;
-
- code = param_read_string_array(plist, (param_name = "pdfmark"), &ppa);
- switch (code) {
- case 0:
- code = pdf_open_document(pdev);
- if (code < 0)
- return code;
- code = pdfmark_process(pdev, &ppa);
- if (code >= 0)
- return code;
- /* falls through for errors */
- default:
- param_signal_error(plist, param_name, code);
- return code;
- case 1:
- break;
- }
-
- code = param_read_string_array(plist, (param_name = "DSC"), &ppa);
- switch (code) {
- case 0:
- code = pdf_open_document(pdev);
- if (code < 0)
- return code;
- code = pdf_dsc_process(pdev, &ppa);
- if (code >= 0)
- return code;
- /* falls through for errors */
- default:
- param_signal_error(plist, param_name, code);
- return code;
- case 1:
- break;
- }
+ gs_param_string_array ppa;
+
+ code = param_read_string_array(plist, (param_name = "pdfmark"), &ppa);
+ switch (code) {
+ case 0:
+ code = pdf_open_document(pdev);
+ if (code < 0)
+ return code;
+ code = pdfmark_process(pdev, &ppa);
+ if (code >= 0)
+ return code;
+ /* falls through for errors */
+ default:
+ param_signal_error(plist, param_name, code);
+ return code;
+ case 1:
+ break;
+ }
+
+ code = param_read_string_array(plist, (param_name = "DSC"), &ppa);
+ switch (code) {
+ case 0:
+ code = pdf_open_document(pdev);
+ if (code < 0)
+ return code;
+ code = pdf_dsc_process(pdev, &ppa);
+ if (code >= 0)
+ return code;
+ /* falls through for errors */
+ default:
+ param_signal_error(plist, param_name, code);
+ return code;
+ case 1:
+ break;
+ }
}
-
+
/*
* Check for LockDistillerParams before doing anything else.
* If LockDistillerParams is true and is not being set to false,
@@ -292,124 +292,124 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
*/
ecode = code = param_read_bool(plist, "LockDistillerParams", &locked);
if (ecode < 0)
- param_signal_error(plist, param_name, ecode);
-
+ param_signal_error(plist, param_name, ecode);
+
if (!(locked && pdev->params.LockDistillerParams)) {
- /* General parameters. */
-
- {
- int efo = 1;
-
- ecode = param_put_int(plist, (param_name = ".EmbedFontObjects"), &efo, ecode);
- if (ecode < 0)
- param_signal_error(plist, param_name, ecode);
- if (efo != 1)
- param_signal_error(plist, param_name, ecode = gs_error_rangecheck);
- }
- {
- int cdv = CoreDistVersion;
-
- ecode = param_put_int(plist, (param_name = "CoreDistVersion"), &cdv, ecode);
- if (ecode < 0)
- return gs_note_error(ecode);
- if (cdv != CoreDistVersion)
- param_signal_error(plist, param_name, ecode = gs_error_rangecheck);
- }
-
- switch (code = param_read_float(plist, (param_name = "CompatibilityLevel"), &cl)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- /*
- * Must be 1.2, 1.3, 1.4, or 1.5. Per Adobe documentation, substitute
- * the nearest achievable value.
- */
- if (cl < (float)1.15)
- cl = (float)1.1;
- else if (cl < (float)1.25)
- cl = (float)1.2;
- else if (cl < (float)1.35)
- cl = (float)1.3;
- else if (cl < (float)1.45)
- cl = (float)1.4;
- else if (cl < (float)1.55)
- cl = (float)1.5;
- else if (cl < (float)1.65)
- cl = (float)1.6;
- else
- cl = (float)1.7;
- case 1:
- break;
- }
- { /* HACK : gs_param_list_s::memory is documented in gsparam.h as
- "for allocating coerced arrays". Not sure why zputdeviceparams
- sets it to the current memory space, while the device
- assumes to store them in the device's memory space.
- As a hackish workaround we temporary replace it here.
- Doing so because we don't want to change the global code now
- because we're unable to test it with all devices.
- Bug 688531 "Segmentation fault running pdfwrite from 219-01.ps".
-
- This solution to be reconsidered after fixing
- the bug 688533 "zputdeviceparams specifies a wrong memory space.".
- */
- gs_memory_t *mem = plist->memory;
-
- plist->memory = pdev->pdf_memory;
- code = gs_param_read_items(plist, pdev, pdf_param_items);
- if (code < 0 ||
- (pdev->is_ps2write && (code = param_read_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
- (!pdev->is_ps2write && (code = param_read_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0)
- ){
- }
- plist->memory = mem;
- }
- if (code < 0)
- ecode = code;
- {
- /*
- * Setting FirstObjectNumber is only legal if the file
- * has just been opened and nothing has been written,
- * or if we are setting it to the same value.
- */
- long fon = pdev->FirstObjectNumber;
-
- if (fon != save_dev->FirstObjectNumber) {
- if (fon <= 0 || fon > 0x7fff0000 ||
- (pdev->next_id != 0 &&
- pdev->next_id !=
- save_dev->FirstObjectNumber + pdf_num_initial_ids)
- ) {
- ecode = gs_error_rangecheck;
- param_signal_error(plist, "FirstObjectNumber", ecode);
- }
- }
- }
- {
- /*
- * Set ProcessColorModel now, because gx_default_put_params checks
- * it.
- */
- static const char *const pcm_names[] = {
- "DeviceGray", "DeviceRGB", "DeviceCMYK", "DeviceN", 0
- };
- int pcm = -1;
-
- ecode = param_put_enum(plist, "ProcessColorModel", &pcm,
- pcm_names, ecode);
- if (pcm >= 0) {
- pdf_set_process_color_model(pdev, pcm);
- pdf_set_initial_color(pdev, &pdev->saved_fill_color, &pdev->saved_stroke_color,
- &pdev->fill_used_process_color, &pdev->stroke_used_process_color);
- }
- }
+ /* General parameters. */
+
+ {
+ int efo = 1;
+
+ ecode = param_put_int(plist, (param_name = ".EmbedFontObjects"), &efo, ecode);
+ if (ecode < 0)
+ param_signal_error(plist, param_name, ecode);
+ if (efo != 1)
+ param_signal_error(plist, param_name, ecode = gs_error_rangecheck);
+ }
+ {
+ int cdv = CoreDistVersion;
+
+ ecode = param_put_int(plist, (param_name = "CoreDistVersion"), &cdv, ecode);
+ if (ecode < 0)
+ return gs_note_error(ecode);
+ if (cdv != CoreDistVersion)
+ param_signal_error(plist, param_name, ecode = gs_error_rangecheck);
+ }
+
+ switch (code = param_read_float(plist, (param_name = "CompatibilityLevel"), &cl)) {
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ /*
+ * Must be 1.2, 1.3, 1.4, or 1.5. Per Adobe documentation, substitute
+ * the nearest achievable value.
+ */
+ if (cl < (float)1.15)
+ cl = (float)1.1;
+ else if (cl < (float)1.25)
+ cl = (float)1.2;
+ else if (cl < (float)1.35)
+ cl = (float)1.3;
+ else if (cl < (float)1.45)
+ cl = (float)1.4;
+ else if (cl < (float)1.55)
+ cl = (float)1.5;
+ else if (cl < (float)1.65)
+ cl = (float)1.6;
+ else
+ cl = (float)1.7;
+ case 1:
+ break;
+ }
+ { /* HACK : gs_param_list_s::memory is documented in gsparam.h as
+ "for allocating coerced arrays". Not sure why zputdeviceparams
+ sets it to the current memory space, while the device
+ assumes to store them in the device's memory space.
+ As a hackish workaround we temporary replace it here.
+ Doing so because we don't want to change the global code now
+ because we're unable to test it with all devices.
+ Bug 688531 "Segmentation fault running pdfwrite from 219-01.ps".
+
+ This solution to be reconsidered after fixing
+ the bug 688533 "zputdeviceparams specifies a wrong memory space.".
+ */
+ gs_memory_t *mem = plist->memory;
+
+ plist->memory = pdev->pdf_memory;
+ code = gs_param_read_items(plist, pdev, pdf_param_items);
+ if (code < 0 ||
+ (pdev->is_ps2write && (code = param_read_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
+ (!pdev->is_ps2write && (code = param_read_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0)
+ ){
+ }
+ plist->memory = mem;
+ }
+ if (code < 0)
+ ecode = code;
+ {
+ /*
+ * Setting FirstObjectNumber is only legal if the file
+ * has just been opened and nothing has been written,
+ * or if we are setting it to the same value.
+ */
+ long fon = pdev->FirstObjectNumber;
+
+ if (fon != save_dev->FirstObjectNumber) {
+ if (fon <= 0 || fon > 0x7fff0000 ||
+ (pdev->next_id != 0 &&
+ pdev->next_id !=
+ save_dev->FirstObjectNumber + pdf_num_initial_ids)
+ ) {
+ ecode = gs_error_rangecheck;
+ param_signal_error(plist, "FirstObjectNumber", ecode);
+ }
+ }
+ }
+ {
+ /*
+ * Set ProcessColorModel now, because gx_default_put_params checks
+ * it.
+ */
+ static const char *const pcm_names[] = {
+ "DeviceGray", "DeviceRGB", "DeviceCMYK", "DeviceN", 0
+ };
+ int pcm = -1;
+
+ ecode = param_put_enum(plist, "ProcessColorModel", &pcm,
+ pcm_names, ecode);
+ if (pcm >= 0) {
+ pdf_set_process_color_model(pdev, pcm);
+ pdf_set_initial_color(pdev, &pdev->saved_fill_color, &pdev->saved_stroke_color,
+ &pdev->fill_used_process_color, &pdev->stroke_used_process_color);
+ }
+ }
}
if (ecode < 0)
- goto fail;
+ goto fail;
if (pdev->is_ps2write && (code = param_read_bool(plist, "ProduceDSC", &pdev->ProduceDSC)) < 0) {
- param_signal_error(plist, param_name, code);
+ param_signal_error(plist, param_name, code);
}
/* PDFA and PDFX are stored in the page device dictionary and therefore
@@ -420,125 +420,125 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
* device dictionary, so we use this rather clunky method.
*/
if(pdev->PDFA && pdev->AbortPDFAX)
- pdev->PDFA = false;
+ pdev->PDFA = false;
if(pdev->PDFX && pdev->AbortPDFAX)
- pdev->PDFX = false;
+ pdev->PDFX = false;
if (pdev->PDFX && pdev->PDFA) {
- ecode = gs_note_error(gs_error_rangecheck);
- param_signal_error(plist, "PDFA", ecode);
- goto fail;
+ ecode = gs_note_error(gs_error_rangecheck);
+ param_signal_error(plist, "PDFA", ecode);
+ goto fail;
}
if (pdev->PDFX && pdev->ForOPDFRead) {
- ecode = gs_note_error(gs_error_rangecheck);
- param_signal_error(plist, "PDFX", ecode);
- goto fail;
+ ecode = gs_note_error(gs_error_rangecheck);
+ param_signal_error(plist, "PDFX", ecode);
+ goto fail;
}
if (pdev->PDFA && pdev->ForOPDFRead) {
- ecode = gs_note_error(gs_error_rangecheck);
- param_signal_error(plist, "PDFA", ecode);
- goto fail;
+ ecode = gs_note_error(gs_error_rangecheck);
+ param_signal_error(plist, "PDFA", ecode);
+ goto fail;
}
if (pdev->PDFA)
- pdev->HaveTransparency = false;
+ pdev->HaveTransparency = false;
/*
* We have to set version to the new value, because the set of
* legal parameter values for psdf_put_params varies according to
* the version.
*/
if (pdev->PDFX)
- cl = (float)1.3; /* Instead pdev->CompatibilityLevel = 1.2; - see below. */
+ cl = (float)1.3; /* Instead pdev->CompatibilityLevel = 1.2; - see below. */
if (pdev->PDFA && cl < 1.4)
- cl = (float)1.4;
+ cl = (float)1.4;
pdev->version = (cl < 1.2 ? psdf_version_level2 : psdf_version_ll3);
if (pdev->ForOPDFRead) {
- pdev->ResourcesBeforeUsage = true;
- pdev->HaveCFF = false;
- pdev->HavePDFWidths = false;
- pdev->HaveStrokeColor = false;
- cl = (float)1.2; /* Instead pdev->CompatibilityLevel = 1.2; - see below. */
- pdev->MaxInlineImageSize = max_long; /* Save printer's RAM from saving temporary image data.
- Immediate images doen't need buffering. */
- pdev->version = psdf_version_level2;
+ pdev->ResourcesBeforeUsage = true;
+ pdev->HaveCFF = false;
+ pdev->HavePDFWidths = false;
+ pdev->HaveStrokeColor = false;
+ cl = (float)1.2; /* Instead pdev->CompatibilityLevel = 1.2; - see below. */
+ pdev->MaxInlineImageSize = max_long; /* Save printer's RAM from saving temporary image data.
+ Immediate images doen't need buffering. */
+ pdev->version = psdf_version_level2;
} else {
- pdev->ResourcesBeforeUsage = false;
- pdev->HaveCFF = true;
- pdev->HavePDFWidths = true;
- pdev->HaveStrokeColor = true;
+ pdev->ResourcesBeforeUsage = false;
+ pdev->HaveCFF = true;
+ pdev->HavePDFWidths = true;
+ pdev->HaveStrokeColor = true;
}
pdev->ParamCompatibilityLevel = cl;
if (cl < 1.2) {
- pdev->HaveCFF = false;
+ pdev->HaveCFF = false;
}
ecode = gdev_psdf_put_params(dev, plist);
if (ecode < 0)
- goto fail;
+ goto fail;
if ((pdev->params.ColorConversionStrategy == ccs_CMYK &&
- strcmp(pdev->color_info.cm_name, "DeviceCMYK")) ||
- (pdev->params.ColorConversionStrategy == ccs_sRGB &&
- strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
- (pdev->params.ColorConversionStrategy == ccs_Gray &&
- strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
- emprintf(pdev->memory,
+ strcmp(pdev->color_info.cm_name, "DeviceCMYK")) ||
+ (pdev->params.ColorConversionStrategy == ccs_sRGB &&
+ strcmp(pdev->color_info.cm_name, "DeviceRGB")) ||
+ (pdev->params.ColorConversionStrategy == ccs_Gray &&
+ strcmp(pdev->color_info.cm_name, "DeviceGray"))) {
+ emprintf(pdev->memory,
"ColorConversionStrategy is incompatible to ProcessColorModel.\n");
- ecode = gs_note_error(gs_error_rangecheck);
- pdev->params.ColorConversionStrategy = save_ccs;
+ ecode = gs_note_error(gs_error_rangecheck);
+ pdev->params.ColorConversionStrategy = save_ccs;
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceIndependentColor) {
- if (!pdev->UseCIEColor) {
- emprintf(pdev->memory,
+ if (!pdev->UseCIEColor) {
+ emprintf(pdev->memory,
"Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
- ecode = gs_note_error(gs_error_rangecheck);
- pdev->UseCIEColor = true;
- }
+ ecode = gs_note_error(gs_error_rangecheck);
+ pdev->UseCIEColor = true;
+ }
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceIndependentColorForImages) {
- if (!pdev->UseCIEColor) {
- emprintf(pdev->memory,
+ if (!pdev->UseCIEColor) {
+ emprintf(pdev->memory,
"UseDeviceDependentColorForImages is not supported. Use UseDeviceIndependentColor.\n");
- pdev->params.ColorConversionStrategy = ccs_UseDeviceIndependentColor;
- if (!pdev->UseCIEColor) {
- emprintf(pdev->memory,
+ pdev->params.ColorConversionStrategy = ccs_UseDeviceIndependentColor;
+ if (!pdev->UseCIEColor) {
+ emprintf(pdev->memory,
"Set UseCIEColor for UseDeviceIndependentColor to work properly.\n");
- ecode = gs_note_error(gs_error_rangecheck);
- pdev->UseCIEColor = true;
- }
- }
+ ecode = gs_note_error(gs_error_rangecheck);
+ pdev->UseCIEColor = true;
+ }
+ }
}
if (pdev->params.ColorConversionStrategy == ccs_UseDeviceDependentColor) {
- if (!strcmp(pdev->color_info.cm_name, "DeviceCMYK")) {
- emprintf(pdev->memory,
+ if (!strcmp(pdev->color_info.cm_name, "DeviceCMYK")) {
+ emprintf(pdev->memory,
"Replacing the deprecated device parameter value UseDeviceDependentColor with CMYK.\n");
- pdev->params.ColorConversionStrategy = ccs_CMYK;
- } else if (!strcmp(pdev->color_info.cm_name, "DeviceRGB")) {
- emprintf(pdev->memory,
+ pdev->params.ColorConversionStrategy = ccs_CMYK;
+ } else if (!strcmp(pdev->color_info.cm_name, "DeviceRGB")) {
+ emprintf(pdev->memory,
"Replacing the deprecated device parameter value UseDeviceDependentColor with sRGB.\n");
- pdev->params.ColorConversionStrategy = ccs_sRGB;
- } else {
- emprintf(pdev->memory,
+ pdev->params.ColorConversionStrategy = ccs_sRGB;
+ } else {
+ emprintf(pdev->memory,
"Replacing the deprecated device parameter value UseDeviceDependentColor with Gray.\n");
- pdev->params.ColorConversionStrategy = ccs_Gray;
- }
+ pdev->params.ColorConversionStrategy = ccs_Gray;
+ }
}
if (cl < 1.5 && pdev->params.ColorImage.Filter != NULL &&
- !strcmp(pdev->params.ColorImage.Filter, "JPXEncode")) {
- emprintf(pdev->memory,
+ !strcmp(pdev->params.ColorImage.Filter, "JPXEncode")) {
+ emprintf(pdev->memory,
"JPXEncode requires CompatibilityLevel >= 1.5 .\n");
- ecode = gs_note_error(gs_error_rangecheck);
+ ecode = gs_note_error(gs_error_rangecheck);
}
if (cl < 1.5 && pdev->params.GrayImage.Filter != NULL &&
- !strcmp(pdev->params.GrayImage.Filter, "JPXEncode")) {
- emprintf(pdev->memory,
+ !strcmp(pdev->params.GrayImage.Filter, "JPXEncode")) {
+ emprintf(pdev->memory,
"JPXEncode requires CompatibilityLevel >= 1.5 .\n");
- ecode = gs_note_error(gs_error_rangecheck);
+ ecode = gs_note_error(gs_error_rangecheck);
}
if (cl < 1.4 && pdev->params.MonoImage.Filter != NULL &&
- !strcmp(pdev->params.MonoImage.Filter, "JBIG2Encode")) {
- emprintf(pdev->memory,
+ !strcmp(pdev->params.MonoImage.Filter, "JBIG2Encode")) {
+ emprintf(pdev->memory,
"JBIG2Encode requires CompatibilityLevel >= 1.4 .\n");
- ecode = gs_note_error(gs_error_rangecheck);
+ ecode = gs_note_error(gs_error_rangecheck);
}
if (pdev->HaveTrueTypes && pdev->version == psdf_version_level2) {
- pdev->version = psdf_version_level2_with_TT ;
+ pdev->version = psdf_version_level2_with_TT ;
}
/*
* Acrobat Reader doesn't handle user-space coordinates larger than
@@ -551,34 +551,34 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
#define MAX_EXTENT ((int)(MAX_USER_COORD * 0.9))
/* Changing resolution or page size requires closing the device, */
if (dev->height > MAX_EXTENT || dev->width > MAX_EXTENT) {
- double factor =
- max(dev->height / (double)MAX_EXTENT,
- dev->width / (double)MAX_EXTENT);
+ double factor =
+ max(dev->height / (double)MAX_EXTENT,
+ dev->width / (double)MAX_EXTENT);
- gx_device_set_resolution(dev, dev->HWResolution[0] / factor,
- dev->HWResolution[1] / factor);
+ gx_device_set_resolution(dev, dev->HWResolution[0] / factor,
+ dev->HWResolution[1] / factor);
}
#undef MAX_EXTENT
if (pdev->FirstObjectNumber != save_dev->FirstObjectNumber) {
- if (pdev->xref.file != 0) {
- fseek(pdev->xref.file, 0L, SEEK_SET);
- pdf_initialize_ids(pdev);
- }
+ if (pdev->xref.file != 0) {
+ fseek(pdev->xref.file, 0L, SEEK_SET);
+ pdf_initialize_ids(pdev);
+ }
}
/* Handle the float/double mismatch. */
pdev->CompatibilityLevel = (int)(cl * 10 + 0.5) / 10.0;
- if(pdev->OwnerPassword.size != save_dev->OwnerPassword.size ||
- (pdev->OwnerPassword.size != 0 &&
- memcmp(pdev->OwnerPassword.data, save_dev->OwnerPassword.data,
- pdev->OwnerPassword.size) != 0)) {
- if (pdev->is_open) {
- if (pdev->PageCount == 0) {
- gs_closedevice((gx_device *)save_dev);
- return 0;
- }
- else
- emprintf(pdev->memory, "Owner Password changed mid-job, ignoring.\n");
- }
+ if(pdev->OwnerPassword.size != save_dev->OwnerPassword.size ||
+ (pdev->OwnerPassword.size != 0 &&
+ memcmp(pdev->OwnerPassword.data, save_dev->OwnerPassword.data,
+ pdev->OwnerPassword.size) != 0)) {
+ if (pdev->is_open) {
+ if (pdev->PageCount == 0) {
+ gs_closedevice((gx_device *)save_dev);
+ return 0;
+ }
+ else
+ emprintf(pdev->memory, "Owner Password changed mid-job, ignoring.\n");
+ }
}
return 0;
fail:
@@ -588,14 +588,14 @@ gdev_pdf_put_params_impl(gx_device * dev, const gx_device_pdf * save_dev, gs_par
pdev->saved_fill_color = save_dev->saved_fill_color;
pdev->saved_stroke_color = save_dev->saved_fill_color;
{
- const gs_param_item_t *ppi = pdf_param_items;
-
- for (; ppi->key; ++ppi)
- memcpy((char *)pdev + ppi->offset,
- (char *)save_dev + ppi->offset,
- gs_param_type_sizes[ppi->type]);
- pdev->ForOPDFRead = save_dev->ForOPDFRead;
- pdev->OPDFReadProcsetPath = save_dev->OPDFReadProcsetPath;
+ const gs_param_item_t *ppi = pdf_param_items;
+
+ for (; ppi->key; ++ppi)
+ memcpy((char *)pdev + ppi->offset,
+ (char *)save_dev + ppi->offset,
+ gs_param_type_sizes[ppi->type]);
+ pdev->ForOPDFRead = save_dev->ForOPDFRead;
+ pdev->OPDFReadProcsetPath = save_dev->OPDFReadProcsetPath;
}
return ecode;
}
@@ -636,102 +636,102 @@ pdf_dsc_process(gx_device_pdf * pdev, const gs_param_string_array * pma)
* ParseDSCComentsForDocInfo or PreserveEPSInfo is true.
*/
if (!pdev->ParseDSCComments)
- return 0;
+ return 0;
for (i = 0; i + 1 < pma->size && code >= 0; i += 2) {
- const gs_param_string *pkey = &pma->data[i];
- const gs_param_string *pvalue = &pma->data[i + 1];
- const char *key;
- int code;
-
- /*
- * %%For, %%Creator, and %%Title are recognized only if either
- * ParseDSCCommentsForDocInfo or PreserveEPSInfo is true.
- * The other DSC comments are always recognized.
- *
- * Acrobat Distiller sets CreationDate and ModDate to the current
- * time, not the value of %%CreationDate. We think this is wrong,
- * but we do the same -- we ignore %%CreationDate here.
- */
-
- if (pdf_key_eq(pkey, "Creator"))
- key = "/Creator";
- else if (pdf_key_eq(pkey, "Title"))
- key = "/Title";
- else if (pdf_key_eq(pkey, "For"))
- key = "/Author";
- else {
- pdf_page_dsc_info_t *ppdi;
+ const gs_param_string *pkey = &pma->data[i];
+ const gs_param_string *pvalue = &pma->data[i + 1];
+ const char *key;
+ int code;
+
+ /*
+ * %%For, %%Creator, and %%Title are recognized only if either
+ * ParseDSCCommentsForDocInfo or PreserveEPSInfo is true.
+ * The other DSC comments are always recognized.
+ *
+ * Acrobat Distiller sets CreationDate and ModDate to the current
+ * time, not the value of %%CreationDate. We think this is wrong,
+ * but we do the same -- we ignore %%CreationDate here.
+ */
+
+ if (pdf_key_eq(pkey, "Creator"))
+ key = "/Creator";
+ else if (pdf_key_eq(pkey, "Title"))
+ key = "/Title";
+ else if (pdf_key_eq(pkey, "For"))
+ key = "/Author";
+ else {
+ pdf_page_dsc_info_t *ppdi;
char scan_buf[200]; /* arbitrary */
- if ((ppdi = &pdev->doc_dsc_info,
- pdf_key_eq(pkey, "Orientation")) ||
- (ppdi = &pdev->page_dsc_info,
- pdf_key_eq(pkey, "PageOrientation"))
- ) {
- if (pvalue->size == 1 && pvalue->data[0] >= '0' &&
- pvalue->data[0] <= '3'
- )
- ppdi->orientation = pvalue->data[0] - '0';
- else
- ppdi->orientation = -1;
- } else if ((ppdi = &pdev->doc_dsc_info,
- pdf_key_eq(pkey, "ViewingOrientation")) ||
- (ppdi = &pdev->page_dsc_info,
- pdf_key_eq(pkey, "PageViewingOrientation"))
- ) {
- gs_matrix mat;
- int orient;
-
- if(pvalue->size >= sizeof(scan_buf) - 1)
- continue; /* error */
+ if ((ppdi = &pdev->doc_dsc_info,
+ pdf_key_eq(pkey, "Orientation")) ||
+ (ppdi = &pdev->page_dsc_info,
+ pdf_key_eq(pkey, "PageOrientation"))
+ ) {
+ if (pvalue->size == 1 && pvalue->data[0] >= '0' &&
+ pvalue->data[0] <= '3'
+ )
+ ppdi->orientation = pvalue->data[0] - '0';
+ else
+ ppdi->orientation = -1;
+ } else if ((ppdi = &pdev->doc_dsc_info,
+ pdf_key_eq(pkey, "ViewingOrientation")) ||
+ (ppdi = &pdev->page_dsc_info,
+ pdf_key_eq(pkey, "PageViewingOrientation"))
+ ) {
+ gs_matrix mat;
+ int orient;
+
+ if(pvalue->size >= sizeof(scan_buf) - 1)
+ continue; /* error */
memcpy(scan_buf, pvalue->data, pvalue->size);
scan_buf[pvalue->size] = 0;
if (sscanf(scan_buf, "[%g %g %g %g]",
- &mat.xx, &mat.xy, &mat.yx, &mat.yy) != 4
- )
- continue; /* error */
- for (orient = 0; orient < 4; ++orient) {
- if (mat.xx == 1 && mat.xy == 0 && mat.yx == 0 && mat.yy == 1)
- break;
- gs_matrix_rotate(&mat, -90.0, &mat);
- }
- if (orient == 4) /* error */
- orient = -1;
- ppdi->viewing_orientation = orient;
- } else {
- gs_rect box;
-
- if (pdf_key_eq(pkey, "EPSF")) {
- pdev->is_EPS = (pvalue->size >= 1 && pvalue->data[0] != '0');
- continue;
- }
- /*
- * We only parse the BoundingBox for the sake of
- * AutoPositionEPSFiles.
- */
- if (pdf_key_eq(pkey, "BoundingBox"))
- ppdi = &pdev->doc_dsc_info;
- else if (pdf_key_eq(pkey, "PageBoundingBox"))
- ppdi = &pdev->page_dsc_info;
- else
- continue;
- if(pvalue->size >= sizeof(scan_buf) - 1)
- continue; /* error */
+ &mat.xx, &mat.xy, &mat.yx, &mat.yy) != 4
+ )
+ continue; /* error */
+ for (orient = 0; orient < 4; ++orient) {
+ if (mat.xx == 1 && mat.xy == 0 && mat.yx == 0 && mat.yy == 1)
+ break;
+ gs_matrix_rotate(&mat, -90.0, &mat);
+ }
+ if (orient == 4) /* error */
+ orient = -1;
+ ppdi->viewing_orientation = orient;
+ } else {
+ gs_rect box;
+
+ if (pdf_key_eq(pkey, "EPSF")) {
+ pdev->is_EPS = (pvalue->size >= 1 && pvalue->data[0] != '0');
+ continue;
+ }
+ /*
+ * We only parse the BoundingBox for the sake of
+ * AutoPositionEPSFiles.
+ */
+ if (pdf_key_eq(pkey, "BoundingBox"))
+ ppdi = &pdev->doc_dsc_info;
+ else if (pdf_key_eq(pkey, "PageBoundingBox"))
+ ppdi = &pdev->page_dsc_info;
+ else
+ continue;
+ if(pvalue->size >= sizeof(scan_buf) - 1)
+ continue; /* error */
memcpy(scan_buf, pvalue->data, pvalue->size);
scan_buf[pvalue->size] = 0;
- if (sscanf(scan_buf, "[%lg %lg %lg %lg]",
- &box.p.x, &box.p.y, &box.q.x, &box.q.y) != 4
- )
- continue; /* error */
- ppdi->bounding_box = box;
- }
- continue;
- }
-
- if (pdev->ParseDSCCommentsForDocInfo || pdev->PreserveEPSInfo)
- code = cos_dict_put_c_key_string(pdev->Info, key,
- pvalue->data, pvalue->size);
+ if (sscanf(scan_buf, "[%lg %lg %lg %lg]",
+ &box.p.x, &box.p.y, &box.q.x, &box.q.y) != 4
+ )
+ continue; /* error */
+ ppdi->bounding_box = box;
+ }
+ continue;
+ }
+
+ if (pdev->ParseDSCCommentsForDocInfo || pdev->PreserveEPSInfo)
+ code = cos_dict_put_c_key_string(pdev->Info, key,
+ pvalue->data, pvalue->size);
}
return code;
}
diff --git a/gs/base/gdevpdfr.c b/gs/base/gdevpdfr.c
index 15b80f3cf..dac0c38a3 100644
--- a/gs/base/gdevpdfr.c
+++ b/gs/base/gdevpdfr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ bool
pdf_objname_is_valid(const byte *data, uint size)
{
return (size >= 2 && data[0] == '{' &&
- (const byte *)memchr(data, '}', size) == data + size - 1);
+ (const byte *)memchr(data, '}', size) == data + size - 1);
}
/*
@@ -41,19 +41,19 @@ pdf_objname_is_valid(const byte *data, uint size)
*/
int
pdf_find_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_object_t **ppco)
+ cos_object_t **ppco)
{
const cos_value_t *pvalue;
if (!pdf_objname_is_valid(pname->data, pname->size))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if ((pvalue = cos_dict_find(pdev->local_named_objects, pname->data,
- pname->size)) != 0 ||
- (pvalue = cos_dict_find(pdev->global_named_objects, pname->data,
- pname->size)) != 0
- ) {
- *ppco = pvalue->contents.object;
- return 0;
+ pname->size)) != 0 ||
+ (pvalue = cos_dict_find(pdev->global_named_objects, pname->data,
+ pname->size)) != 0
+ ) {
+ *ppco = pvalue->contents.object;
+ return 0;
}
return_error(gs_error_undefined);
}
@@ -65,31 +65,31 @@ pdf_find_named(gx_device_pdf * pdev, const gs_param_string * pname,
*/
int
pdf_create_named(gx_device_pdf *pdev, const gs_param_string *pname,
- cos_type_t cotype, cos_object_t **ppco, long id)
+ cos_type_t cotype, cos_object_t **ppco, long id)
{
cos_object_t *pco;
cos_value_t value;
*ppco = pco = cos_object_alloc(pdev, "pdf_create_named");
if (pco == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pco->id =
- (id == -1 ? 0L : id == 0 ? pdf_obj_ref(pdev) : id);
+ (id == -1 ? 0L : id == 0 ? pdf_obj_ref(pdev) : id);
if (pname) {
- int code = cos_dict_put(pdev->local_named_objects, pname->data,
- pname->size, cos_object_value(&value, pco));
+ int code = cos_dict_put(pdev->local_named_objects, pname->data,
+ pname->size, cos_object_value(&value, pco));
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (cotype != cos_type_generic)
- cos_become(pco, cotype);
+ cos_become(pco, cotype);
*ppco = pco;
return 0;
}
int
pdf_create_named_dict(gx_device_pdf *pdev, const gs_param_string *pname,
- cos_dict_t **ppcd, long id)
+ cos_dict_t **ppcd, long id)
{
cos_object_t *pco;
int code = pdf_create_named(pdev, pname, cos_type_dict, &pco, id);
@@ -106,7 +106,7 @@ pdf_create_named_dict(gx_device_pdf *pdev, const gs_param_string *pname,
*/
int
pdf_refer_named(gx_device_pdf * pdev, const gs_param_string * pname_orig,
- cos_object_t **ppco)
+ cos_object_t **ppco)
{
const gs_param_string *pname = pname_orig;
int code = pdf_find_named(pdev, pname, ppco);
@@ -115,7 +115,7 @@ pdf_refer_named(gx_device_pdf * pdev, const gs_param_string * pname_orig,
int page_number;
if (code != gs_error_undefined)
- return code;
+ return code;
/*
* Check for a predefined name. Map ThisPage, PrevPage, and NextPage
* to the appropriate Page<#> name.
@@ -123,30 +123,30 @@ pdf_refer_named(gx_device_pdf * pdev, const gs_param_string * pname_orig,
if (pname->size >= 7 && pname->size < sizeof(page_name_chars)) {
memcpy(page_name_chars, pname->data, pname->size);
page_name_chars[pname->size] = 0;
- if (sscanf(page_name_chars, "{Page%d}", &page_number) == 1)
- goto cpage;
+ if (sscanf(page_name_chars, "{Page%d}", &page_number) == 1)
+ goto cpage;
}
if (pdf_key_eq(pname, "{ThisPage}"))
- page_number = pdev->next_page + 1;
+ page_number = pdev->next_page + 1;
else if (pdf_key_eq(pname, "{NextPage}"))
- page_number = pdev->next_page + 2;
+ page_number = pdev->next_page + 2;
else if (pdf_key_eq(pname, "{PrevPage}"))
- page_number = pdev->next_page;
+ page_number = pdev->next_page;
else {
- code = pdf_create_named(pdev, pname, cos_type_generic, ppco, 0L);
- return (code < 0 ? code : 1);
+ code = pdf_create_named(pdev, pname, cos_type_generic, ppco, 0L);
+ return (code < 0 ? code : 1);
}
if (page_number <= 0)
- return code;
+ return code;
sprintf(page_name_chars, "{Page%d}", page_number);
param_string_from_string(pnstr, page_name_chars);
pname = &pnstr;
code = pdf_find_named(pdev, pname, ppco);
if (code != gs_error_undefined)
- return code;
+ return code;
cpage:
if (pdf_page_id(pdev, page_number) <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
*ppco = COS_OBJECT(pdev->pages[page_number - 1].Page);
return 0;
}
@@ -159,30 +159,30 @@ pdf_refer_named(gx_device_pdf * pdev, const gs_param_string * pname_orig,
*/
int
pdf_make_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_type_t cotype, cos_object_t **ppco, bool assign_id)
+ cos_type_t cotype, cos_object_t **ppco, bool assign_id)
{
if (pname) {
- int code = pdf_refer_named(pdev, pname, ppco);
- cos_object_t *pco = *ppco;
-
- if (code < 0)
- return code;
- if (cos_type(pco) != cos_type_generic)
- return_error(gs_error_rangecheck);
- if (assign_id && pco->id == 0)
- pco->id = pdf_obj_ref(pdev);
- cos_become(pco, cotype);
- return code;
+ int code = pdf_refer_named(pdev, pname, ppco);
+ cos_object_t *pco = *ppco;
+
+ if (code < 0)
+ return code;
+ if (cos_type(pco) != cos_type_generic)
+ return_error(gs_error_rangecheck);
+ if (assign_id && pco->id == 0)
+ pco->id = pdf_obj_ref(pdev);
+ cos_become(pco, cotype);
+ return code;
} else {
- int code = pdf_create_named(pdev, pname, cotype, ppco,
- (assign_id ? 0L : -1L));
+ int code = pdf_create_named(pdev, pname, cotype, ppco,
+ (assign_id ? 0L : -1L));
- return (code < 0 ? code : 1);
+ return (code < 0 ? code : 1);
}
}
int
pdf_make_named_dict(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_dict_t **ppcd, bool assign_id)
+ cos_dict_t **ppcd, bool assign_id)
{
cos_object_t *pco;
int code = pdf_make_named(pdev, pname, cos_type_dict, &pco, assign_id);
@@ -198,14 +198,14 @@ pdf_make_named_dict(gx_device_pdf * pdev, const gs_param_string * pname,
*/
int
pdf_get_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_type_t cotype, cos_object_t **ppco)
+ cos_type_t cotype, cos_object_t **ppco)
{
int code = pdf_refer_named(pdev, pname, ppco);
if (code < 0)
- return code;
+ return code;
if (cos_type(*ppco) != cotype)
- return_error(gs_error_typecheck);
+ return_error(gs_error_typecheck);
return code;
}
@@ -217,19 +217,19 @@ int
pdf_push_namespace(gx_device_pdf *pdev)
{
int code = cos_array_add_object(pdev->Namespace_stack,
- COS_OBJECT(pdev->local_named_objects));
+ COS_OBJECT(pdev->local_named_objects));
cos_dict_t *pcd =
- cos_dict_alloc(pdev, "pdf_push_namespace(local_named_objects)");
+ cos_dict_alloc(pdev, "pdf_push_namespace(local_named_objects)");
cos_array_t *pca =
- cos_array_alloc(pdev, "pdf_push_namespace(NI_stack)");
+ cos_array_alloc(pdev, "pdf_push_namespace(NI_stack)");
if (code < 0 ||
- (code = cos_array_add_object(pdev->Namespace_stack,
- COS_OBJECT(pdev->NI_stack))) < 0
- )
- return code;
+ (code = cos_array_add_object(pdev->Namespace_stack,
+ COS_OBJECT(pdev->NI_stack))) < 0
+ )
+ return code;
if (pcd == 0 || pca == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pdev->local_named_objects = pcd;
pdev->NI_stack = pca;
return 0;
@@ -244,13 +244,13 @@ pdf_pop_namespace(gx_device_pdf *pdev)
{
cos_value_t nis_value, lno_value;
int code = cos_array_unadd(pdev->Namespace_stack, &nis_value);
-
+
if (code < 0 ||
- (code = cos_array_unadd(pdev->Namespace_stack, &lno_value)) < 0
- )
- return code;
+ (code = cos_array_unadd(pdev->Namespace_stack, &lno_value)) < 0
+ )
+ return code;
COS_FREE(pdev->local_named_objects,
- "pdf_pop_namespace(local_named_objects)");
+ "pdf_pop_namespace(local_named_objects)");
pdev->local_named_objects = (cos_dict_t *)lno_value.contents.object;
COS_FREE(pdev->NI_stack, "pdf_pop_namespace(NI_stack)");
pdev->NI_stack = (cos_array_t *)nis_value.contents.object;
@@ -279,79 +279,79 @@ pdf_scan_token(const byte **pscan, const byte * end, const byte **ptoken)
const byte *p = *pscan;
while (p < end && scan_char_decoder[*p] == ctype_space) {
- ++p;
- if (p[-1] == 0 && p + 1 < end && *p == 0 && p[1] == '/') {
- /* Special handling for names delimited by a null character. */
- *ptoken = ++p;
- while (*p != 0)
- if (++p >= end)
- return_error(gs_error_syntaxerror); /* no terminator */
- *pscan = p;
- return 1;
- }
+ ++p;
+ if (p[-1] == 0 && p + 1 < end && *p == 0 && p[1] == '/') {
+ /* Special handling for names delimited by a null character. */
+ *ptoken = ++p;
+ while (*p != 0)
+ if (++p >= end)
+ return_error(gs_error_syntaxerror); /* no terminator */
+ *pscan = p;
+ return 1;
+ }
}
*ptoken = p;
if (p >= end) {
- *pscan = p;
- return 0;
+ *pscan = p;
+ return 0;
}
switch (*p) {
case '%':
case ')':
- return_error(gs_error_syntaxerror);
+ return_error(gs_error_syntaxerror);
case '(': {
- /* Skip over the string. */
- byte buf[50]; /* size is arbitrary */
- stream_cursor_read r;
- stream_cursor_write w;
- stream_PSSD_state ss;
- int status;
-
- s_PSSD_init((stream_state *)&ss);
- r.ptr = p; /* skip the '(' */
- r.limit = end - 1;
- w.limit = buf + sizeof(buf) - 1;
- do {
- /* One picky compiler complains if we initialize to buf - 1. */
- w.ptr = buf; w.ptr--;
- status = (*s_PSSD_template.process)
- ((stream_state *) & ss, &r, &w, true);
- }
- while (status == 1);
- *pscan = r.ptr + 1;
- return 1;
+ /* Skip over the string. */
+ byte buf[50]; /* size is arbitrary */
+ stream_cursor_read r;
+ stream_cursor_write w;
+ stream_PSSD_state ss;
+ int status;
+
+ s_PSSD_init((stream_state *)&ss);
+ r.ptr = p; /* skip the '(' */
+ r.limit = end - 1;
+ w.limit = buf + sizeof(buf) - 1;
+ do {
+ /* One picky compiler complains if we initialize to buf - 1. */
+ w.ptr = buf; w.ptr--;
+ status = (*s_PSSD_template.process)
+ ((stream_state *) & ss, &r, &w, true);
+ }
+ while (status == 1);
+ *pscan = r.ptr + 1;
+ return 1;
}
case '<':
- if (end - p < 2)
- return_error(gs_error_syntaxerror);
- if (p[1] != '<') {
- /*
- * We need the cast because some compilers declare memchar as
- * returning a char * rather than a void *.
- */
- p = (const byte *)memchr(p + 1, '>', end - p - 1);
- if (p == 0)
- return_error(gs_error_syntaxerror);
- }
- goto m2;
+ if (end - p < 2)
+ return_error(gs_error_syntaxerror);
+ if (p[1] != '<') {
+ /*
+ * We need the cast because some compilers declare memchar as
+ * returning a char * rather than a void *.
+ */
+ p = (const byte *)memchr(p + 1, '>', end - p - 1);
+ if (p == 0)
+ return_error(gs_error_syntaxerror);
+ }
+ goto m2;
case '>':
- if (end - p < 2 || p[1] != '>')
- return_error(gs_error_syntaxerror);
+ if (end - p < 2 || p[1] != '>')
+ return_error(gs_error_syntaxerror);
m2: *pscan = p + 2;
- return 1;
+ return 1;
case '[': case ']': case '{': case '}':
- *pscan = p + 1;
- return 1;
+ *pscan = p + 1;
+ return 1;
case '/':
- ++p;
+ ++p;
default:
- break;
+ break;
}
while (p < end && scan_char_decoder[*p] <= ctype_name)
- ++p;
+ ++p;
*pscan = p;
if (p == *ptoken) /* no chars scanned, i.e., not ctype_name */
- return_error(gs_error_syntaxerror);
+ return_error(gs_error_syntaxerror);
return 1;
}
/*
@@ -360,7 +360,7 @@ m2: *pscan = p + 2;
*/
int
pdf_scan_token_composite(const byte **pscan, const byte * end,
- const byte **ptoken_orig)
+ const byte **ptoken_orig)
{
int level = 0;
const byte *ignore_token;
@@ -368,19 +368,19 @@ pdf_scan_token_composite(const byte **pscan, const byte * end,
int code;
do {
- code = pdf_scan_token(pscan, end, ptoken);
- if (code <= 0)
- return (code < 0 || level == 0 ? code :
- gs_note_error(gs_error_syntaxerror));
- switch (**ptoken) {
- case '<': case '[': case '{':
- ++level; break;
- case '>': case ']': case '}':
- if (level == 0)
- return_error(gs_error_syntaxerror);
- --level; break;
- }
- ptoken = &ignore_token;
+ code = pdf_scan_token(pscan, end, ptoken);
+ if (code <= 0)
+ return (code < 0 || level == 0 ? code :
+ gs_note_error(gs_error_syntaxerror));
+ switch (**ptoken) {
+ case '<': case '[': case '{':
+ ++level; break;
+ case '>': case ']': case '}':
+ if (level == 0)
+ return_error(gs_error_syntaxerror);
+ --level; break;
+ }
+ ptoken = &ignore_token;
} while (level);
return code;
}
@@ -388,7 +388,7 @@ pdf_scan_token_composite(const byte **pscan, const byte * end,
/* Replace object names with object references in a (parameter) string. */
static const byte *
pdfmark_next_object(const byte * scan, const byte * end, const byte **pname,
- cos_object_t **ppco, gx_device_pdf * pdev)
+ cos_object_t **ppco, gx_device_pdf * pdev)
{
/*
* Starting at scan, find the next object reference, set *pname
@@ -400,38 +400,38 @@ pdfmark_next_object(const byte * scan, const byte * end, const byte **pname,
int code;
while ((code = pdf_scan_token(&scan, end, pname)) != 0) {
- gs_param_string sname;
-
- if (code < 0) {
- ++scan;
- continue;
- }
- if (**pname != '{')
- continue;
- /* Back up over the { and rescan as a single token. */
- scan = *pname;
- code = pdf_scan_token_composite(&scan, end, pname);
- if (code < 0) {
- ++scan;
- continue;
- }
- sname.data = *pname;
- sname.size = scan - sname.data;
- /*
- * Forward references are allowed. If there is an error,
- * simply retain the name as a literal string.
- */
- code = pdf_refer_named(pdev, &sname, ppco);
- if (code < 0)
- continue;
- return scan;
+ gs_param_string sname;
+
+ if (code < 0) {
+ ++scan;
+ continue;
+ }
+ if (**pname != '{')
+ continue;
+ /* Back up over the { and rescan as a single token. */
+ scan = *pname;
+ code = pdf_scan_token_composite(&scan, end, pname);
+ if (code < 0) {
+ ++scan;
+ continue;
+ }
+ sname.data = *pname;
+ sname.size = scan - sname.data;
+ /*
+ * Forward references are allowed. If there is an error,
+ * simply retain the name as a literal string.
+ */
+ code = pdf_refer_named(pdev, &sname, ppco);
+ if (code < 0)
+ continue;
+ return scan;
}
*ppco = 0;
return end;
}
int
pdf_replace_names(gx_device_pdf * pdev, const gs_param_string * from,
- gs_param_string * to)
+ gs_param_string * to)
{
const byte *start = from->data;
const byte *end = start + from->size;
@@ -444,46 +444,46 @@ pdf_replace_names(gx_device_pdf * pdev, const gs_param_string * from,
/* Do a first pass to compute the length of the result. */
for (scan = start; scan < end;) {
- const byte *sname;
- const byte *next =
- pdfmark_next_object(scan, end, &sname, &pco, pdev);
-
- size += sname - scan;
- if (pco) {
- sprintf(ref, " %ld 0 R ", pco->id);
- size += strlen(ref);
- }
- scan = next;
- any |= next != sname;
+ const byte *sname;
+ const byte *next =
+ pdfmark_next_object(scan, end, &sname, &pco, pdev);
+
+ size += sname - scan;
+ if (pco) {
+ sprintf(ref, " %ld 0 R ", pco->id);
+ size += strlen(ref);
+ }
+ scan = next;
+ any |= next != sname;
}
to->persistent = true; /* ??? */
if (!any) {
- to->data = start;
- to->size = size;
- return 0;
+ to->data = start;
+ to->size = size;
+ return 0;
}
sto = gs_alloc_bytes(pdev->pdf_memory, size, "pdf_replace_names");
if (sto == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
to->data = sto;
to->size = size;
/* Do a second pass to do the actual substitutions. */
for (scan = start; scan < end;) {
- const byte *sname;
- const byte *next =
- pdfmark_next_object(scan, end, &sname, &pco, pdev);
- uint copy = sname - scan;
- int rlen;
-
- memcpy(sto, scan, copy);
- sto += copy;
- if (pco) {
- sprintf(ref, " %ld 0 R ", pco->id);
- rlen = strlen(ref);
- memcpy(sto, ref, rlen);
- sto += rlen;
- }
- scan = next;
+ const byte *sname;
+ const byte *next =
+ pdfmark_next_object(scan, end, &sname, &pco, pdev);
+ uint copy = sname - scan;
+ int rlen;
+
+ memcpy(sto, scan, copy);
+ sto += copy;
+ if (pco) {
+ sprintf(ref, " %ld 0 R ", pco->id);
+ rlen = strlen(ref);
+ memcpy(sto, ref, rlen);
+ sto += rlen;
+ }
+ scan = next;
}
return 0;
}
diff --git a/gs/base/gdevpdft.c b/gs/base/gdevpdft.c
index 554185e60..a528172fb 100644
--- a/gs/base/gdevpdft.c
+++ b/gs/base/gdevpdft.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,37 +34,37 @@ pdf_make_soft_mask_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * ppa
/* Fixme : merge redundant objects. */
code = pdf_alloc_resource(pdev, resourceSoftMaskDict, gs_no_id, &pres_soft_mask_dict, -1);
if (code < 0)
- return code;
+ return code;
cos_become(pres_soft_mask_dict->object, cos_type_dict);
pdev->pres_soft_mask_dict = pres_soft_mask_dict;
soft_mask_dict = (cos_dict_t *)pres_soft_mask_dict->object;
- code = cos_dict_put_c_key_string(soft_mask_dict, "/S",
- pparams->subtype == TRANSPARENCY_MASK_Alpha ? (byte *)"/Alpha" : (byte *)"/Luminosity",
- pparams->subtype == TRANSPARENCY_MASK_Alpha ? 6 : 11);
+ code = cos_dict_put_c_key_string(soft_mask_dict, "/S",
+ pparams->subtype == TRANSPARENCY_MASK_Alpha ? (byte *)"/Alpha" : (byte *)"/Luminosity",
+ pparams->subtype == TRANSPARENCY_MASK_Alpha ? 6 : 11);
if (code < 0)
- return code;
+ return code;
if (pparams->Background_components) {
- cos_array_t *Background;
-
- Background = cos_array_from_floats(pdev, pparams->Background,
- pparams->Background_components, "pdf_write_soft_mask_dict");
- if (Background == NULL)
- return_error(gs_error_VMerror);
- code = cos_dict_put_c_key_object(soft_mask_dict, "/BC", (cos_object_t *)Background);
- if (code < 0)
- return code;
+ cos_array_t *Background;
+
+ Background = cos_array_from_floats(pdev, pparams->Background,
+ pparams->Background_components, "pdf_write_soft_mask_dict");
+ if (Background == NULL)
+ return_error(gs_error_VMerror);
+ code = cos_dict_put_c_key_object(soft_mask_dict, "/BC", (cos_object_t *)Background);
+ if (code < 0)
+ return code;
}
if (pparams->transfer_function != NULL) {
- long id;
- char buf[20];
-
- code = pdf_write_function(pdev, pparams->transfer_function, &id);
- if (code < 0)
- return code;
- sprintf(buf, " %ld 0 R", id);
- code = cos_dict_put_c_key_string(soft_mask_dict, "/TR", (const byte *)buf, strlen(buf));
- if (code < 0)
- return code;
+ long id;
+ char buf[20];
+
+ code = pdf_write_function(pdev, pparams->transfer_function, &id);
+ if (code < 0)
+ return code;
+ sprintf(buf, " %ld 0 R", id);
+ code = cos_dict_put_c_key_string(soft_mask_dict, "/TR", (const byte *)buf, strlen(buf));
+ if (code < 0)
+ return code;
}
return 0;
@@ -72,7 +72,7 @@ pdf_make_soft_mask_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * ppa
static int
pdf_make_group_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * pparams,
- const gs_imager_state * pis, cos_dict_t **pdict)
+ const gs_imager_state * pis, cos_dict_t **pdict)
{
pdf_resource_t *pres_group;
cos_dict_t *group_dict;
@@ -82,45 +82,45 @@ pdf_make_group_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * pparams
code = pdf_alloc_resource(pdev, resourceGroup, gs_no_id, &pres_group, -1);
if (code < 0)
- return code;
+ return code;
cos_become(pres_group->object, cos_type_dict);
group_dict = (cos_dict_t *)pres_group->object;
code = cos_dict_put_c_key_string(group_dict, "/Type", (const byte *)"/Group", 6);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_key_string(group_dict, "/S", (const byte *)"/Transparency", 13);
if (code < 0)
- return code;
+ return code;
if (pparams->Isolated) {
- code = cos_dict_put_c_key_bool(group_dict, "/I", true);
- if (code < 0)
- return code;
+ code = cos_dict_put_c_key_bool(group_dict, "/I", true);
+ if (code < 0)
+ return code;
}
if (pparams->Knockout) {
- code = cos_dict_put_c_key_bool(group_dict, "/K", true);
- if (code < 0)
- return code;
+ code = cos_dict_put_c_key_bool(group_dict, "/K", true);
+ if (code < 0)
+ return code;
}
- /* Note that we should not add in the graphic state
- color space for the group color if there was not
+ /* Note that we should not add in the graphic state
+ color space for the group color if there was not
a group color specified.
In this case, the parent group is inherited from
the previous group or the device color space */
if (gstate != NULL && pparams->group_color != UNKNOWN) {
- const gs_color_space *cs = gs_currentcolorspace_inline(gstate);
-
- code = pdf_color_space_named(pdev, &cs_value, NULL, cs,
- &pdf_color_space_names, false, NULL, 0);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key(group_dict, "/CS", &cs_value);
- if (code < 0)
- return code;
+ const gs_color_space *cs = gs_currentcolorspace_inline(gstate);
+
+ code = pdf_color_space_named(pdev, &cs_value, NULL, cs,
+ &pdf_color_space_names, false, NULL, 0);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key(group_dict, "/CS", &cs_value);
+ if (code < 0)
+ return code;
}
group_dict = NULL; /* The next line invalidates it. */
code = pdf_substitute_resource(pdev, &pres_group, resourceGroup, NULL, false);
if (code < 0)
- return code;
+ return code;
pres_group->where_used |= pdev->used_mask;
*pdict = (cos_dict_t *)pres_group->object;
return 0;
@@ -128,46 +128,45 @@ pdf_make_group_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * pparams
static int
pdf_make_form_dict(gx_device_pdf * pdev, const gs_pdf14trans_params_t * pparams,
- const gs_imager_state * pis,
- const cos_dict_t *group_dict, cos_dict_t *form_dict)
+ const gs_imager_state * pis,
+ const cos_dict_t *group_dict, cos_dict_t *form_dict)
{
cos_array_t *bbox_array;
float bbox[4];
gs_rect bbox_rect;
int code;
-
code = gs_bbox_transform(&pparams->bbox, &ctm_only(pis), &bbox_rect);
if (code < 0)
- return code;
+ return code;
bbox[0] = bbox_rect.p.x;
bbox[1] = bbox_rect.p.y;
bbox[2] = bbox_rect.q.x;
bbox[3] = bbox_rect.q.y;
code = cos_dict_put_c_key_string(form_dict, "/Type", (const byte *)"/XObject", 8);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_key_string(form_dict, "/Subtype", (const byte *)"/Form", 5);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_key_int(form_dict, "/FormType", 1);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_c_key_string(form_dict, "/Matrix", (const byte *)"[1 0 0 1 0 0]", 13);
if (code < 0)
- return code;
+ return code;
bbox_array = cos_array_from_floats(pdev, bbox, 4, "pdf_begin_transparency_group");
if (bbox_array == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = cos_dict_put_c_key_object(form_dict, "/BBox", (cos_object_t *)bbox_array);
if (code < 0)
- return code;
+ return code;
return cos_dict_put_c_key_object(form_dict, "/Group", (cos_object_t *)group_dict);
}
-static int
+static int
pdf_begin_transparency_group(gs_imager_state * pis, gx_device_pdf * pdev,
- const gs_pdf14trans_params_t * pparams)
+ const gs_pdf14trans_params_t * pparams)
{
cos_dict_t *group_dict;
bool in_page = is_in_page(pdev);
@@ -175,206 +174,206 @@ pdf_begin_transparency_group(gs_imager_state * pis, gx_device_pdf * pdev,
int code;
if (gstate == NULL)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = pdf_make_group_dict(pdev, pparams, pis, &group_dict);
if (code < 0)
- return code;
+ return code;
code = pdf_open_page(pdev, PDF_IN_STREAM);
if (code < 0)
- return code;
+ return code;
if (pdf_must_put_clip_path(pdev, gstate->clip_path)) {
- code = pdf_put_clip_path(pdev, gstate->clip_path);
- if (code < 0)
- return code;
+ code = pdf_put_clip_path(pdev, gstate->clip_path);
+ if (code < 0)
+ return code;
}
pdev->image_with_SMask = false;
- if (!in_page)
- pdev->pages[pdev->next_page].group_id = group_dict->id;
+ if (!in_page)
+ pdev->pages[pdev->next_page].group_id = group_dict->id;
else if (pparams->image_with_SMask) {
- /* An internal group for the image implementation.
- See doimagesmask in gs/lib/pdf_draw.ps .
- Just set a flag for skipping pdf_end_transparency_group. */
- pdev->image_with_SMask = true;
+ /* An internal group for the image implementation.
+ See doimagesmask in gs/lib/pdf_draw.ps .
+ Just set a flag for skipping pdf_end_transparency_group. */
+ pdev->image_with_SMask = true;
} else {
- pdf_resource_t *pres, *pres_gstate = NULL;
-
- code = pdf_prepare_drawing(pdev, pis, &pres_gstate);
- if (code < 0)
- return code;
- code = pdf_end_gstate(pdev, pres_gstate);
- if (code < 0)
- return code;
- code = pdf_enter_substream(pdev, resourceXObject,
- gs_no_id, &pres, false, pdev->params.CompressPages);
- if (code < 0)
- return code;
- pdev->FormDepth++;
- return pdf_make_form_dict(pdev, pparams, pis, group_dict, (cos_dict_t *)pres->object);
+ pdf_resource_t *pres, *pres_gstate = NULL;
+
+ code = pdf_prepare_drawing(pdev, pis, &pres_gstate);
+ if (code < 0)
+ return code;
+ code = pdf_end_gstate(pdev, pres_gstate);
+ if (code < 0)
+ return code;
+ code = pdf_enter_substream(pdev, resourceXObject,
+ gs_no_id, &pres, false, pdev->params.CompressPages);
+ if (code < 0)
+ return code;
+ pdev->FormDepth++;
+ return pdf_make_form_dict(pdev, pparams, pis, group_dict, (cos_dict_t *)pres->object);
}
pdev->FormDepth++;
return 0;
}
-static int
+static int
pdf_end_transparency_group(gs_imager_state * pis, gx_device_pdf * pdev)
{
int bottom = (pdev->ResourcesBeforeUsage ? 1 : 0);
pdev->FormDepth--;
- if (!is_in_page(pdev))
- return 0; /* corresponds to check in pdf_begin_transparency_group */
+ if (!is_in_page(pdev))
+ return 0; /* corresponds to check in pdf_begin_transparency_group */
if (pdev->image_with_SMask) {
- /* An internal group for the image implementation.
- See pdf_begin_transparency_group. */
- pdev->image_with_SMask = 0;
- return 0;
+ /* An internal group for the image implementation.
+ See pdf_begin_transparency_group. */
+ pdev->image_with_SMask = 0;
+ return 0;
} else if (pdev->sbstack_depth == bottom) {
- /* We're closing the page group. */
- if (pdev->pages[pdev->next_page].group_id == 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- return 0;
+ /* We're closing the page group. */
+ if (pdev->pages[pdev->next_page].group_id == 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ return 0;
} else {
- pdf_resource_t *pres = pdev->accumulating_substream_resource;
- int code;
- uint ignore;
-
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- code = pdf_substitute_resource(pdev, &pres, resourceXObject, NULL, false);
- if (code < 0)
- return code;
- /* We need to update the 'where_used' field, in case we substituted a resource */
- pres->where_used |= pdev->used_mask;
- sputc(pdev->strm,'/');
- sputs(pdev->strm, (const byte *)pres->rname, strlen(pres->rname), &ignore);
- sputs(pdev->strm, (const byte *)" Do\n", 4, &ignore);
- return 0;
+ pdf_resource_t *pres = pdev->accumulating_substream_resource;
+ int code;
+ uint ignore;
+
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ code = pdf_substitute_resource(pdev, &pres, resourceXObject, NULL, false);
+ if (code < 0)
+ return code;
+ /* We need to update the 'where_used' field, in case we substituted a resource */
+ pres->where_used |= pdev->used_mask;
+ sputc(pdev->strm,'/');
+ sputs(pdev->strm, (const byte *)pres->rname, strlen(pres->rname), &ignore);
+ sputs(pdev->strm, (const byte *)" Do\n", 4, &ignore);
+ return 0;
}
}
-static int
+static int
pdf_begin_transparency_mask(gs_imager_state * pis, gx_device_pdf * pdev,
- const gs_pdf14trans_params_t * pparams)
+ const gs_pdf14trans_params_t * pparams)
{
if (pparams->mask_is_image) {
- /* HACK :
- The control comes here when
- the PDF interpreter will make the PS interpreter
- to interprete the mask for filling the transparency buffer
- with an SMask image.
- Since we handle Type 3 images as a high level objects,
- we don't install the transparency buffer here
- and need to skip the image enumeration for the SMask.
- However we have no right method for skipping
- an image enumeration due to possible side effect
- of the image data proc in Postscript language.
- Therefore we do enumerate the image mask and accumulate
- it as a PDF stream, but don't create a reference to it.
- Later it will be enumerated once again as a part of SMask-ed image,
- and the pdfwrite image handler will recognize duplicated images
- and won't create the second stream for same image.
-
- We could make a special workaround for
- skipping mask images either in the graphics library or
- in the PS code of the PDF interpreter,
- but we don't want to complicate things now.
- The performance leak for the second enumeration
- shouldn't be harmful.
-
- So now just set a flag for pdf_end_and_do_image.
- */
- pdev->image_mask_skip = true;
- return 0;
+ /* HACK :
+ The control comes here when
+ the PDF interpreter will make the PS interpreter
+ to interprete the mask for filling the transparency buffer
+ with an SMask image.
+ Since we handle Type 3 images as a high level objects,
+ we don't install the transparency buffer here
+ and need to skip the image enumeration for the SMask.
+ However we have no right method for skipping
+ an image enumeration due to possible side effect
+ of the image data proc in Postscript language.
+ Therefore we do enumerate the image mask and accumulate
+ it as a PDF stream, but don't create a reference to it.
+ Later it will be enumerated once again as a part of SMask-ed image,
+ and the pdfwrite image handler will recognize duplicated images
+ and won't create the second stream for same image.
+
+ We could make a special workaround for
+ skipping mask images either in the graphics library or
+ in the PS code of the PDF interpreter,
+ but we don't want to complicate things now.
+ The performance leak for the second enumeration
+ shouldn't be harmful.
+
+ So now just set a flag for pdf_end_and_do_image.
+ */
+ pdev->image_mask_skip = true;
+ return 0;
} else {
- int code;
-
- code = pdf_make_soft_mask_dict(pdev, pparams);
- if (code < 0)
- return code;
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- return pdf_begin_transparency_group(pis, pdev, pparams);
+ int code;
+
+ code = pdf_make_soft_mask_dict(pdev, pparams);
+ if (code < 0)
+ return code;
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ if (code < 0)
+ return code;
+ return pdf_begin_transparency_group(pis, pdev, pparams);
}
}
-static int
+static int
pdf_end_transparency_mask(gs_imager_state * pis, gx_device_pdf * pdev,
- const gs_pdf14trans_params_t * pparams)
+ const gs_pdf14trans_params_t * pparams)
{
- if (pdev->image_mask_skip)
- pdev->image_mask_skip = false;
+ if (pdev->image_mask_skip)
+ pdev->image_mask_skip = false;
else {
- pdf_resource_t *pres = pdev->accumulating_substream_resource;
- int code;
- char buf[20];
-
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- code = pdf_substitute_resource(pdev, &pres, resourceXObject, NULL, false);
- if (code < 0)
- return 0;
- /* We need to update the 'where_used' field, in case we substituted a resource */
- pres->where_used |= pdev->used_mask;
- sprintf(buf, "%ld 0 R", pdf_resource_id(pres));
- code = cos_dict_put_c_key_string((cos_dict_t *)pdev->pres_soft_mask_dict->object,
- "/G", (const byte *)buf, strlen(buf));
- if (code < 0)
- return code;
- code = pdf_substitute_resource(pdev, &pdev->pres_soft_mask_dict,
- resourceSoftMaskDict, NULL, false);
- if (code < 0)
- return code;
- pdev->pres_soft_mask_dict->where_used |= pdev->used_mask;
- pis->soft_mask_id = pdev->pres_soft_mask_dict->object->id;
- pdev->pres_soft_mask_dict = NULL;
- /* We called pdf_start_trnasparency_group (see pdf_begin_transparency_mask
- * above) but we don't call pdf_end_transparency_group, so we must reduce
- * the FormDepth ourselves.
- */
- pdev->FormDepth--;
+ pdf_resource_t *pres = pdev->accumulating_substream_resource;
+ int code;
+ char buf[20];
+
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ code = pdf_substitute_resource(pdev, &pres, resourceXObject, NULL, false);
+ if (code < 0)
+ return 0;
+ /* We need to update the 'where_used' field, in case we substituted a resource */
+ pres->where_used |= pdev->used_mask;
+ sprintf(buf, "%ld 0 R", pdf_resource_id(pres));
+ code = cos_dict_put_c_key_string((cos_dict_t *)pdev->pres_soft_mask_dict->object,
+ "/G", (const byte *)buf, strlen(buf));
+ if (code < 0)
+ return code;
+ code = pdf_substitute_resource(pdev, &pdev->pres_soft_mask_dict,
+ resourceSoftMaskDict, NULL, false);
+ if (code < 0)
+ return code;
+ pdev->pres_soft_mask_dict->where_used |= pdev->used_mask;
+ pis->soft_mask_id = pdev->pres_soft_mask_dict->object->id;
+ pdev->pres_soft_mask_dict = NULL;
+ /* We called pdf_start_trnasparency_group (see pdf_begin_transparency_mask
+ * above) but we don't call pdf_end_transparency_group, so we must reduce
+ * the FormDepth ourselves.
+ */
+ pdev->FormDepth--;
}
return 0;
}
static int
pdf_set_blend_params(gs_imager_state * pis, gx_device_pdf * dev,
- const gs_pdf14trans_params_t * pparams)
+ const gs_pdf14trans_params_t * pparams)
{
return 0;
}
-int
+int
gdev_pdf_create_compositor(gx_device *dev,
gx_device **pcdev, const gs_composite_t *pct,
gs_imager_state *pis, gs_memory_t *memory, gx_device *cdev)
{
gx_device_pdf *pdev = (gx_device_pdf *)dev;
-
+
if (pdev->HaveTransparency && pdev->CompatibilityLevel >= 1.4 &&
- pct->type->comp_id == GX_COMPOSITOR_PDF14_TRANS &&
- !pdev->PDFA) {
- gs_pdf14trans_t *pcte = (gs_pdf14trans_t *)pct;
- gs_pdf14trans_params_t *params = &pcte->params;
-
- *pcdev = dev;
- switch(params->pdf14_op) {
- case PDF14_PUSH_DEVICE:
- return 0;
- case PDF14_POP_DEVICE:
- return 0;
- case PDF14_BEGIN_TRANS_GROUP:
- return pdf_begin_transparency_group(pis, pdev, params);
- case PDF14_END_TRANS_GROUP:
- return pdf_end_transparency_group(pis, pdev);
- case PDF14_BEGIN_TRANS_MASK:
- return pdf_begin_transparency_mask(pis, pdev, params);
- case PDF14_END_TRANS_MASK:
- return pdf_end_transparency_mask(pis, pdev, params);
- case PDF14_SET_BLEND_PARAMS:
- return pdf_set_blend_params(pis, pdev, params);
+ pct->type->comp_id == GX_COMPOSITOR_PDF14_TRANS &&
+ !pdev->PDFA) {
+ gs_pdf14trans_t *pcte = (gs_pdf14trans_t *)pct;
+ gs_pdf14trans_params_t *params = &pcte->params;
+
+ *pcdev = dev;
+ switch(params->pdf14_op) {
+ case PDF14_PUSH_DEVICE:
+ return 0;
+ case PDF14_POP_DEVICE:
+ return 0;
+ case PDF14_BEGIN_TRANS_GROUP:
+ return pdf_begin_transparency_group(pis, pdev, params);
+ case PDF14_END_TRANS_GROUP:
+ return pdf_end_transparency_group(pis, pdev);
+ case PDF14_BEGIN_TRANS_MASK:
+ return pdf_begin_transparency_mask(pis, pdev, params);
+ case PDF14_END_TRANS_MASK:
+ return pdf_end_transparency_mask(pis, pdev, params);
+ case PDF14_SET_BLEND_PARAMS:
+ return pdf_set_blend_params(pis, pdev, params);
case PDF14_PUSH_TRANS_STATE:
return 0;
case PDF14_POP_TRANS_STATE:
@@ -384,10 +383,10 @@ gdev_pdf_create_compositor(gx_device *dev,
case PDF14_POP_SMASK_COLOR:
return 0;
- default :
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- return 0;
+ default :
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ return 0;
}
return psdf_create_compositor(dev, pcdev, pct, pis, memory, cdev);
}
@@ -395,7 +394,7 @@ gdev_pdf_create_compositor(gx_device *dev,
/* We're not sure why the folllowing device methods are never called.
Stub them for a while. */
-int
+int
gdev_pdf_begin_transparency_group(gx_device *dev,
const gs_transparency_group_params_t *ptgp,
const gs_rect *pbbox,
diff --git a/gs/base/gdevpdfu.c b/gs/base/gdevpdfu.c
index 47a6c698c..305fefba9 100644
--- a/gs/base/gdevpdfu.c
+++ b/gs/base/gdevpdfu.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -98,15 +98,15 @@ doit(char *line, bool intact)
int in_string = 0;
if (intact)
- return str;
+ return str;
while (*str == ' ' || *str == '\t') /* strip leading whitespace */
- ++str;
+ ++str;
if (*str == 0) /* all whitespace */
- return NULL;
+ return NULL;
if (!strncmp(str, "%END", 4)) /* keep these for .skipeof */
- return str;
+ return str;
if (str[0] == '%') /* comment line */
- return NULL;
+ return NULL;
/*
* Copy the string over itself removing:
* - All comments not within string literals;
@@ -115,48 +115,47 @@ doit(char *line, bool intact)
* - Whitespace after ')' '>'.
*/
for (to = from = str; (*to = *from) != 0; ++from, ++to) {
- switch (*from) {
- case '%':
- if (!in_string)
- break;
- continue;
- case ' ':
- case '\t':
- if (to > str && !in_string && strchr(" \t>[]{})", to[-1]))
- --to;
- continue;
- case '(':
- case '<':
- case '/':
- case '[':
- case ']':
- case '{':
- case '}':
- if (to > str && !in_string && strchr(" \t", to[-1]))
- *--to = *from;
+ switch (*from) {
+ case '%':
+ if (!in_string)
+ break;
+ continue;
+ case ' ':
+ case '\t':
+ if (to > str && !in_string && strchr(" \t>[]{})", to[-1]))
+ --to;
+ continue;
+ case '(':
+ case '<':
+ case '/':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ if (to > str && !in_string && strchr(" \t", to[-1]))
+ *--to = *from;
if (*from == '(')
++in_string;
- continue;
- case ')':
- --in_string;
- continue;
- case '\\':
- if (from[1] == '\\' || from[1] == '(' || from[1] == ')')
- *++to = *++from;
- continue;
- default:
- continue;
- }
- break;
+ continue;
+ case ')':
+ --in_string;
+ continue;
+ case '\\':
+ if (from[1] == '\\' || from[1] == '(' || from[1] == ')')
+ *++to = *++from;
+ continue;
+ default:
+ continue;
+ }
+ break;
}
/* Strip trailing whitespace. */
while (to > str && (to[-1] == ' ' || to[-1] == '\t'))
- --to;
+ --to;
*to = 0;
return str;
}
-
static int
copy_ps_file_stripping_all(stream *s, const char *fname, bool HaveTrueTypes)
{
@@ -167,68 +166,68 @@ copy_ps_file_stripping_all(stream *s, const char *fname, bool HaveTrueTypes)
f = sfopen(fname, "rb", s->memory);
if (f == NULL)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
n = sfread(buf, 1, m, f);
buf[n] = 0;
do {
- if (*q == '\r' || *q == '\n') {
- q++;
- continue;
- }
- p = strchr(q, '\r');
- if (p == NULL)
- p = strchr(q, '\n');
- if (p == NULL) {
- if (n < m)
- p = buf + n;
- else {
- strcpy(buf, q);
- l = strlen(buf);
- m = sizeof(buf) - 1 - l;
- if (!m) {
- sfclose(f);
- emprintf1(s->memory,
+ if (*q == '\r' || *q == '\n') {
+ q++;
+ continue;
+ }
+ p = strchr(q, '\r');
+ if (p == NULL)
+ p = strchr(q, '\n');
+ if (p == NULL) {
+ if (n < m)
+ p = buf + n;
+ else {
+ strcpy(buf, q);
+ l = strlen(buf);
+ m = sizeof(buf) - 1 - l;
+ if (!m) {
+ sfclose(f);
+ emprintf1(s->memory,
"The procset %s contains a too long line.",
fname);
- return_error(gs_error_ioerror);
- }
- n = sfread(buf + l, 1, m, f);
- n += l;
- m += l;
- buf[n] = 0;
- q = buf;
- continue;
- }
- }
- *p = 0;
- if (q[0] == '%')
- l = 0;
- else {
- q = doit(q, false);
- if (q == NULL)
- l = 0;
- else
- l = strlen(q);
- }
- if (l) {
- if (!HaveTrueTypes && !strcmp("%%beg TrueType", q))
- skipping = true;
- if (!skipping) {
- outl += l + 1;
- if (outl > 100) {
- q[l] = '\r';
- outl = 0;
- } else
- q[l] = ' ';
- stream_write(s, q, l + 1);
- }
- if (!HaveTrueTypes && !strcmp("%%end TrueType", q))
- skipping = false;
- }
- q = p + 1;
+ return_error(gs_error_ioerror);
+ }
+ n = sfread(buf + l, 1, m, f);
+ n += l;
+ m += l;
+ buf[n] = 0;
+ q = buf;
+ continue;
+ }
+ }
+ *p = 0;
+ if (q[0] == '%')
+ l = 0;
+ else {
+ q = doit(q, false);
+ if (q == NULL)
+ l = 0;
+ else
+ l = strlen(q);
+ }
+ if (l) {
+ if (!HaveTrueTypes && !strcmp("%%beg TrueType", q))
+ skipping = true;
+ if (!skipping) {
+ outl += l + 1;
+ if (outl > 100) {
+ q[l] = '\r';
+ outl = 0;
+ } else
+ q[l] = ' ';
+ stream_write(s, q, l + 1);
+ }
+ if (!HaveTrueTypes && !strcmp("%%end TrueType", q))
+ skipping = false;
+ }
+ q = p + 1;
} while (n == m || q < buf + n);
if (outl)
- stream_write(s, "\r", 1);
+ stream_write(s, "\r", 1);
sfclose(f);
return 0;
}
@@ -243,68 +242,68 @@ copy_ps_file_strip_comments(stream *s, const char *fname, bool HaveTrueTypes)
f = sfopen(fname, "rb", s->memory);
if (f == NULL)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
n = sfread(buf, 1, m, f);
buf[n] = 0;
do {
- if (*q == '\r' || *q == '\n') {
- q++;
- continue;
- }
- p = strchr(q, '\r');
- if (p == NULL)
- p = strchr(q, '\n');
- if (p == NULL) {
- if (n < m)
- p = buf + n;
- else {
- strcpy(buf, q);
- l = strlen(buf);
- m = sizeof(buf) - 1 - l;
- if (!m) {
- sfclose(f);
- emprintf1(s->memory,
+ if (*q == '\r' || *q == '\n') {
+ q++;
+ continue;
+ }
+ p = strchr(q, '\r');
+ if (p == NULL)
+ p = strchr(q, '\n');
+ if (p == NULL) {
+ if (n < m)
+ p = buf + n;
+ else {
+ strcpy(buf, q);
+ l = strlen(buf);
+ m = sizeof(buf) - 1 - l;
+ if (!m) {
+ sfclose(f);
+ emprintf1(s->memory,
"The procset %s contains a too long line.",
fname);
- return_error(gs_error_ioerror);
- }
- n = sfread(buf + l, 1, m, f);
- n += l;
- m += l;
- buf[n] = 0;
- q = buf;
- continue;
- }
- }
- *p = 0;
- if (q[0] == '%')
- l = 0;
- else {
- q = doit(q, false);
- if (q == NULL)
- l = 0;
- else
- l = strlen(q);
- }
- if (l) {
- if (!HaveTrueTypes && !strcmp("%%beg TrueType", q))
- skipping = true;
- if (!skipping) {
- outl += l + 1;
- if (outl > 100) {
- q[l] = '\n';
- outl = 0;
- } else
- q[l] = '\n';
- stream_write(s, q, l + 1);
- }
- if (!HaveTrueTypes && !strcmp("%%end TrueType", q))
- skipping = false;
- }
- q = p + 1;
+ return_error(gs_error_ioerror);
+ }
+ n = sfread(buf + l, 1, m, f);
+ n += l;
+ m += l;
+ buf[n] = 0;
+ q = buf;
+ continue;
+ }
+ }
+ *p = 0;
+ if (q[0] == '%')
+ l = 0;
+ else {
+ q = doit(q, false);
+ if (q == NULL)
+ l = 0;
+ else
+ l = strlen(q);
+ }
+ if (l) {
+ if (!HaveTrueTypes && !strcmp("%%beg TrueType", q))
+ skipping = true;
+ if (!skipping) {
+ outl += l + 1;
+ if (outl > 100) {
+ q[l] = '\n';
+ outl = 0;
+ } else
+ q[l] = '\n';
+ stream_write(s, q, l + 1);
+ }
+ if (!HaveTrueTypes && !strcmp("%%end TrueType", q))
+ skipping = false;
+ }
+ q = p + 1;
} while (n == m || q < buf + n);
if (outl)
- stream_write(s, "\r", 1);
+ stream_write(s, "\r", 1);
sfclose(f);
return 0;
}
@@ -315,10 +314,10 @@ static int write_opdfread(stream *s)
int index = 0;
do {
- if (opdfread_ps[index] == 0x00)
- break;
- stream_write(s, opdfread_ps[index], strlen(opdfread_ps[index]));
- index++;
+ if (opdfread_ps[index] == 0x00)
+ break;
+ stream_write(s, opdfread_ps[index], strlen(opdfread_ps[index]));
+ index++;
} while (1);
return 0;
}
@@ -328,28 +327,28 @@ static int write_tt_encodings(stream *s, bool HaveTrueTypes)
int index = 0;
do {
- if (gs_mro_e_ps[index] == 0x00)
- break;
- stream_write(s, gs_mro_e_ps[index], strlen(gs_mro_e_ps[index]));
- index++;
+ if (gs_mro_e_ps[index] == 0x00)
+ break;
+ stream_write(s, gs_mro_e_ps[index], strlen(gs_mro_e_ps[index]));
+ index++;
} while (1);
if (HaveTrueTypes) {
- index = 0;
- do {
- if (gs_agl_ps[index] == 0x00)
- break;
- stream_write(s, gs_agl_ps[index], strlen(gs_agl_ps[index]));
- index++;
- } while (1);
-
- index = 0;
- do {
- if (gs_mgl_e_ps[index] == 0x00)
- break;
- stream_write(s, gs_mgl_e_ps[index], strlen(gs_mgl_e_ps[index]));
- index++;
- } while (1);
+ index = 0;
+ do {
+ if (gs_agl_ps[index] == 0x00)
+ break;
+ stream_write(s, gs_agl_ps[index], strlen(gs_agl_ps[index]));
+ index++;
+ } while (1);
+
+ index = 0;
+ do {
+ if (gs_mgl_e_ps[index] == 0x00)
+ break;
+ stream_write(s, gs_mgl_e_ps[index], strlen(gs_mgl_e_ps[index]));
+ index++;
+ } while (1);
}
return 0;
}
@@ -364,49 +363,49 @@ copy_procsets(stream *s, const gs_param_string *path, bool HaveTrueTypes, bool s
const char *tt_encs[] = {"gs_agl.ps", "gs_mgl_e.ps"};
if (p != NULL) {
- for (;; i++) {
- const byte *c = memchr(p, gp_file_name_list_separator, e - p);
- int k = 0; /* Initializing against a compiler warning only. */
-
- if (c == NULL)
- c = e;
- l = c - p;
- if (l > 0) {
- if (l > sizeof(fname) - 1)
- return_error(gs_error_limitcheck);
- memcpy(fname, p, l);
- fname[l] = 0;
- if (!HaveTrueTypes) {
- for (k = count_of(tt_encs) - 1; k >= 0; k--) {
- int L = strlen(tt_encs[k]);
-
- if (!strcmp(fname + strlen(fname) - L, tt_encs[k]))
- break;
- }
- }
- if (HaveTrueTypes || k < 0) {
- if (stripping)
- code = copy_ps_file_stripping_all(s, fname, HaveTrueTypes);
- else
- code = copy_ps_file_strip_comments(s, fname, HaveTrueTypes);
- if (code < 0)
- return code;
- }
- }
- if (c == e)
- break;
- p = c + 1;
- }
+ for (;; i++) {
+ const byte *c = memchr(p, gp_file_name_list_separator, e - p);
+ int k = 0; /* Initializing against a compiler warning only. */
+
+ if (c == NULL)
+ c = e;
+ l = c - p;
+ if (l > 0) {
+ if (l > sizeof(fname) - 1)
+ return_error(gs_error_limitcheck);
+ memcpy(fname, p, l);
+ fname[l] = 0;
+ if (!HaveTrueTypes) {
+ for (k = count_of(tt_encs) - 1; k >= 0; k--) {
+ int L = strlen(tt_encs[k]);
+
+ if (!strcmp(fname + strlen(fname) - L, tt_encs[k]))
+ break;
+ }
+ }
+ if (HaveTrueTypes || k < 0) {
+ if (stripping)
+ code = copy_ps_file_stripping_all(s, fname, HaveTrueTypes);
+ else
+ code = copy_ps_file_strip_comments(s, fname, HaveTrueTypes);
+ if (code < 0)
+ return code;
+ }
+ }
+ if (c == e)
+ break;
+ p = c + 1;
+ }
}
if (!i)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
return 0;
#else
int code;
code = write_opdfread(s);
if (code < 0)
- return code;
+ return code;
code = write_tt_encodings(s, HaveTrueTypes);
return code;
@@ -420,12 +419,12 @@ encode(stream **s, const stream_template *t, gs_memory_t *mem)
stream_state *st = s_alloc_state(mem, t->stype, "pdf_open_document.encode");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (t->set_defaults)
- t->set_defaults(st);
+ t->set_defaults(st);
if (s_add_filter(s, t, st, mem) == 0) {
- gs_free_object(mem, st, "pdf_open_document.encode");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, st, "pdf_open_document.encode");
+ return_error(gs_error_VMerror);
}
return 0;
}
@@ -438,54 +437,54 @@ int ps2write_dsc_header(gx_device_pdf * pdev, int pages)
if (pdev->ForOPDFRead) {
char cre_date_time[41];
- int code, status, cre_date_time_len;
- char BBox[256];
- int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5);
- int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5);
-
- stream_write(s, (byte *)"%!PS-Adobe-3.0\n", 15);
- sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
- stream_write(s, (byte *)BBox, strlen(BBox));
- cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time) - 1);
- cre_date_time[cre_date_time_len] = 0;
+ int code, status, cre_date_time_len;
+ char BBox[256];
+ int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5);
+ int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5);
+
+ stream_write(s, (byte *)"%!PS-Adobe-3.0\n", 15);
+ sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ cre_date_time_len = pdf_get_docinfo_item(pdev, "/CreationDate", cre_date_time, sizeof(cre_date_time) - 1);
+ cre_date_time[cre_date_time_len] = 0;
sprintf(BBox, "%%%%Creator: %s %d (%s)\n", gs_product, (int)gs_revision,
- pdev->dname);
- stream_write(s, (byte *)BBox, strlen(BBox));
- stream_puts(s, "%%LanguageLevel: 2\n");
- sprintf(BBox, "%%%%CreationDate: %s\n", cre_date_time);
- stream_write(s, (byte *)BBox, strlen(BBox));
- sprintf(BBox, "%%%%Pages: %d\n", pages);
- stream_write(s, (byte *)BBox, strlen(BBox));
- sprintf(BBox, "%%%%EndComments\n");
- stream_write(s, (byte *)BBox, strlen(BBox));
- sprintf(BBox, "%%%%BeginProlog\n");
- stream_write(s, (byte *)BBox, strlen(BBox));
- if (pdev->params.CompressPages) {
- /* When CompressEntireFile is true and ASCII85EncodePages is false,
- the ASCII85Encode filter is applied, rather one may expect the opposite.
- Keeping it so due to no demand for this mode.
- A right implementation should compute the length of the compressed procset,
- write out an invocation of SubFileDecode filter, and write the length to
- there assuming the output file is positionable. */
- stream_write(s, (byte *)"currentfile /ASCII85Decode filter /LZWDecode filter cvx exec\n", 61);
- code = encode(&s, &s_A85E_template, pdev->pdf_memory);
- if (code < 0)
- return code;
- code = encode(&s, &s_LZWE_template, pdev->pdf_memory);
- if (code < 0)
- return code;
- }
- stream_puts(s, "/DSC_OPDFREAD true def\n");
- stream_puts(s, "/SetPageSize true def\n");
-
- code = copy_procsets(s, &pdev->OPDFReadProcsetPath, pdev->HaveTrueTypes, false);
- if (code < 0)
- return code;
- status = s_close_filters(&s, pdev->strm);
- if (status < 0)
- return_error(gs_error_ioerror);
- stream_puts(s, "\n");
- pdev->OPDFRead_procset_length = stell(s);
+ pdev->dname);
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ stream_puts(s, "%%LanguageLevel: 2\n");
+ sprintf(BBox, "%%%%CreationDate: %s\n", cre_date_time);
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ sprintf(BBox, "%%%%Pages: %d\n", pages);
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ sprintf(BBox, "%%%%EndComments\n");
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ sprintf(BBox, "%%%%BeginProlog\n");
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ if (pdev->params.CompressPages) {
+ /* When CompressEntireFile is true and ASCII85EncodePages is false,
+ the ASCII85Encode filter is applied, rather one may expect the opposite.
+ Keeping it so due to no demand for this mode.
+ A right implementation should compute the length of the compressed procset,
+ write out an invocation of SubFileDecode filter, and write the length to
+ there assuming the output file is positionable. */
+ stream_write(s, (byte *)"currentfile /ASCII85Decode filter /LZWDecode filter cvx exec\n", 61);
+ code = encode(&s, &s_A85E_template, pdev->pdf_memory);
+ if (code < 0)
+ return code;
+ code = encode(&s, &s_LZWE_template, pdev->pdf_memory);
+ if (code < 0)
+ return code;
+ }
+ stream_puts(s, "/DSC_OPDFREAD true def\n");
+ stream_puts(s, "/SetPageSize true def\n");
+
+ code = copy_procsets(s, &pdev->OPDFReadProcsetPath, pdev->HaveTrueTypes, false);
+ if (code < 0)
+ return code;
+ status = s_close_filters(&s, pdev->strm);
+ if (status < 0)
+ return_error(gs_error_ioerror);
+ stream_puts(s, "\n");
+ pdev->OPDFRead_procset_length = stell(s);
}
return 0;
}
@@ -495,63 +494,63 @@ int
pdf_open_document(gx_device_pdf * pdev)
{
if (!is_in_page(pdev) && pdf_stell(pdev) == 0) {
- stream *s = pdev->strm;
- int level = (int)(pdev->CompatibilityLevel * 10 + 0.5);
-
- pdev->binary_ok = !pdev->params.ASCII85EncodePages;
- if (pdev->ForOPDFRead && pdev->OPDFReadProcsetPath.size) {
- int code, status;
- char BBox[256];
- int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5);
- int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5);
-
- if (pdev->ProduceDSC)
- pdev->CompressEntireFile = 0;
- else {
- stream_write(s, (byte *)"%!\r", 3);
- sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
- stream_write(s, (byte *)BBox, strlen(BBox));
- if (pdev->params.CompressPages || pdev->CompressEntireFile) {
- /* When CompressEntireFile is true and ASCII85EncodePages is false,
- the ASCII85Encode filter is applied, rather one may expect the opposite.
- Keeping it so due to no demand for this mode.
- A right implementation should compute the length of the compressed procset,
- write out an invocation of SubFileDecode filter, and write the length to
- there assuming the output file is positionable. */
- stream_write(s, (byte *)"currentfile /ASCII85Decode filter /LZWDecode filter cvx exec\n", 61);
- code = encode(&s, &s_A85E_template, pdev->pdf_memory);
- if (code < 0)
- return code;
- code = encode(&s, &s_LZWE_template, pdev->pdf_memory);
- if (code < 0)
- return code;
- }
- stream_puts(s, "/DSC_OPDFREAD false def\n");
- code = copy_procsets(s, &pdev->OPDFReadProcsetPath, pdev->HaveTrueTypes, true);
- if (code < 0)
- return code;
- if (!pdev->CompressEntireFile) {
- status = s_close_filters(&s, pdev->strm);
- if (status < 0)
- return_error(gs_error_ioerror);
- } else
- pdev->strm = s;
- if(pdev->SetPageSize)
- stream_puts(s, "/SetPageSize true def\n");
- if(pdev->RotatePages)
- stream_puts(s, "/RotatePages true def\n");
- if(pdev->FitPages)
- stream_puts(s, "/FitPages true def\n");
- if(pdev->CenterPages)
- stream_puts(s, "/CenterPages true def\n");
- pdev->OPDFRead_procset_length = stell(s);
- }
- }
- if (!(pdev->ForOPDFRead)) {
- pprintd2(s, "%%PDF-%d.%d\n", level / 10, level % 10);
- if (pdev->binary_ok)
- stream_puts(s, "%\307\354\217\242\n");
- }
+ stream *s = pdev->strm;
+ int level = (int)(pdev->CompatibilityLevel * 10 + 0.5);
+
+ pdev->binary_ok = !pdev->params.ASCII85EncodePages;
+ if (pdev->ForOPDFRead && pdev->OPDFReadProcsetPath.size) {
+ int code, status;
+ char BBox[256];
+ int width = (int)(pdev->width * 72.0 / pdev->HWResolution[0] + 0.5);
+ int height = (int)(pdev->height * 72.0 / pdev->HWResolution[1] + 0.5);
+
+ if (pdev->ProduceDSC)
+ pdev->CompressEntireFile = 0;
+ else {
+ stream_write(s, (byte *)"%!\r", 3);
+ sprintf(BBox, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
+ stream_write(s, (byte *)BBox, strlen(BBox));
+ if (pdev->params.CompressPages || pdev->CompressEntireFile) {
+ /* When CompressEntireFile is true and ASCII85EncodePages is false,
+ the ASCII85Encode filter is applied, rather one may expect the opposite.
+ Keeping it so due to no demand for this mode.
+ A right implementation should compute the length of the compressed procset,
+ write out an invocation of SubFileDecode filter, and write the length to
+ there assuming the output file is positionable. */
+ stream_write(s, (byte *)"currentfile /ASCII85Decode filter /LZWDecode filter cvx exec\n", 61);
+ code = encode(&s, &s_A85E_template, pdev->pdf_memory);
+ if (code < 0)
+ return code;
+ code = encode(&s, &s_LZWE_template, pdev->pdf_memory);
+ if (code < 0)
+ return code;
+ }
+ stream_puts(s, "/DSC_OPDFREAD false def\n");
+ code = copy_procsets(s, &pdev->OPDFReadProcsetPath, pdev->HaveTrueTypes, true);
+ if (code < 0)
+ return code;
+ if (!pdev->CompressEntireFile) {
+ status = s_close_filters(&s, pdev->strm);
+ if (status < 0)
+ return_error(gs_error_ioerror);
+ } else
+ pdev->strm = s;
+ if(pdev->SetPageSize)
+ stream_puts(s, "/SetPageSize true def\n");
+ if(pdev->RotatePages)
+ stream_puts(s, "/RotatePages true def\n");
+ if(pdev->FitPages)
+ stream_puts(s, "/FitPages true def\n");
+ if(pdev->CenterPages)
+ stream_puts(s, "/CenterPages true def\n");
+ pdev->OPDFRead_procset_length = stell(s);
+ }
+ }
+ if (!(pdev->ForOPDFRead)) {
+ pprintd2(s, "%%PDF-%d.%d\n", level / 10, level % 10);
+ if (pdev->binary_ok)
+ stream_puts(s, "%\307\354\217\242\n");
+ }
}
/*
* Determine the compression method. Currently this does nothing.
@@ -563,9 +562,9 @@ pdf_open_document(gx_device_pdf * pdev)
* and always use Flate compression.
*/
if (!pdev->params.CompressPages)
- pdev->compression = pdf_compress_none;
+ pdev->compression = pdf_compress_none;
else
- pdev->compression = pdf_compress_Flate;
+ pdev->compression = pdf_compress_Flate;
return 0;
}
@@ -592,21 +591,21 @@ pdf_stell(gx_device_pdf * pdev)
long pos = stell(s);
if (s == pdev->asides.strm)
- pos += ASIDES_BASE_POSITION;
+ pos += ASIDES_BASE_POSITION;
return pos;
}
-/* Allocate an ID for a future object.
- * pdf_obj_ref below allocates an object and assigns it a position assuming
- * it will be written at the current location in the PDF file. But we want
- * some way to notice when writing the PDF file if some kinds of objects have
+/* Allocate an ID for a future object.
+ * pdf_obj_ref below allocates an object and assigns it a position assuming
+ * it will be written at the current location in the PDF file. But we want
+ * some way to notice when writing the PDF file if some kinds of objects have
* never been written out (eg pages allocated for /Dest targets). Setting the
* position to 0 is good, because we always write the header, which is 15
* bytes. However, pdf_obj_ref is so wisely used its no longer possible to
* tell whether writing the object out has been deferred (in which case the
* pos is updated by pdf_open_obj) or not. Adding this function to allow us
* to create an object whose writing is definitely deferred, in which case
- * we know it will be updated later. This allows setting the pos to 0,
+ * we know it will be updated later. This allows setting the pos to 0,
* and we can detect that when writing the xref, and set the object to
* 'unused'.
*/
@@ -637,131 +636,131 @@ pdf_open_obj(gx_device_pdf * pdev, long id, pdf_resource_type_t type)
stream *s = pdev->strm;
if (id <= 0) {
- id = pdf_obj_ref(pdev);
+ id = pdf_obj_ref(pdev);
} else {
- long pos = pdf_stell(pdev);
- FILE *tfile = pdev->xref.file;
- long tpos = ftell(tfile);
-
- fseek(tfile, (id - pdev->FirstObjectNumber) * sizeof(pos),
- SEEK_SET);
- fwrite(&pos, sizeof(pos), 1, tfile);
- fseek(tfile, tpos, SEEK_SET);
+ long pos = pdf_stell(pdev);
+ FILE *tfile = pdev->xref.file;
+ long tpos = ftell(tfile);
+
+ fseek(tfile, (id - pdev->FirstObjectNumber) * sizeof(pos),
+ SEEK_SET);
+ fwrite(&pos, sizeof(pos), 1, tfile);
+ fseek(tfile, tpos, SEEK_SET);
}
if (pdev->ForOPDFRead && pdev->ProduceDSC) {
- switch(type) {
- case resourceNone:
- /* Used when outputting usage of a previously defined resource
- * Does not want comments around its use
- */
- break;
- case resourcePage:
- /* We *don't* want resource comments around pages */
- break;
- case resourceColorSpace:
- pprintld1(s, "%%%%BeginResource: file (PDF Color Space obj_%ld)\n", id);
- break;
- case resourceExtGState:
- pprintld1(s, "%%%%BeginResource: file (PDF Extended Graphics State obj_%ld)\n", id);
- break;
- case resourcePattern:
- pprintld1(s, "%%%%BeginResource: pattern (PDF Pattern obj_%ld)\n", id);
- break;
- case resourceShading:
- pprintld1(s, "%%%%BeginResource: file (PDF Shading obj_%ld)\n", id);
- break;
- case resourceCIDFont:
- case resourceFont:
- /* Ought to write the font name here */
- pprintld1(s, "%%%%BeginResource: font (PDF Font obj_%ld)\n", id);
- break;
- case resourceCharProc:
- pprintld1(s, "%%%%BeginResource: file (PDF CharProc obj_%ld)\n", id);
- break;
- case resourceCMap:
- pprintld1(s, "%%%%BeginResource: file (PDF CMap obj_%ld)\n", id);
- break;
- case resourceFontDescriptor:
- pprintld1(s, "%%%%BeginResource: file (PDF FontDescriptor obj_%ld)\n", id);
- break;
- case resourceGroup:
- pprintld1(s, "%%%%BeginResource: file (PDF Group obj_%ld)\n", id);
- break;
- case resourceFunction:
- pprintld1(s, "%%%%BeginResource: file (PDF Function obj_%ld)\n", id);
- break;
- case resourceEncoding:
- pprintld1(s, "%%%%BeginResource: encoding (PDF Encoding obj_%ld)\n", id);
- break;
- case resourceCIDSystemInfo:
- pprintld1(s, "%%%%BeginResource: file (PDF CIDSystemInfo obj_%ld)\n", id);
- break;
- case resourceHalftone:
- pprintld1(s, "%%%%BeginResource: file (PDF Halftone obj_%ld)\n", id);
- break;
- case resourceLength:
- pprintld1(s, "%%%%BeginResource: file (PDF Length obj_%ld)\n", id);
- break;
- case resourceSoftMaskDict:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF SoftMask obj_%ld)\n", id);
- break;
- case resourceXObject:
- /* This should not be possible, we write these inline */
- pprintld1(s, "%%%%BeginResource: file (PDF XObject obj_%ld)\n", id);
- break;
- case resourceStream:
- /* Possibly we should not add comments to this type */
- pprintld1(s, "%%%%BeginResource: file (PDF stream obj_%ld)\n", id);
- break;
- case resourceOutline:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Outline obj_%ld)\n", id);
- break;
- case resourceArticle:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Article obj_%ld)\n", id);
- break;
- case resourceDests:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Dests obj_%ld)\n", id);
- break;
- case resourceLabels:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Page Labels obj_%ld)\n", id);
- break;
- case resourceThread:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Thread obj_%ld)\n", id);
- break;
- case resourceCatalog:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Catalog obj_%ld)\n", id);
- break;
- case resourceEncrypt:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Encryption obj_%ld)\n", id);
- break;
- case resourcePagesTree:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Pages Tree obj_%ld)\n", id);
- break;
- case resourceMetadata:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Metadata obj_%ld)\n", id);
- break;
- case resourceICC:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF ICC Profile obj_%ld)\n", id);
- break;
- case resourceAnnotation:
- /* This should not be possible, not valid in PostScript */
- pprintld1(s, "%%%%BeginResource: file (PDF Annotation obj_%ld)\n", id);
- break;
- default:
- pprintld1(s, "%%%%BeginResource: file (PDF object obj_%ld)\n", id);
- break;
- }
+ switch(type) {
+ case resourceNone:
+ /* Used when outputting usage of a previously defined resource
+ * Does not want comments around its use
+ */
+ break;
+ case resourcePage:
+ /* We *don't* want resource comments around pages */
+ break;
+ case resourceColorSpace:
+ pprintld1(s, "%%%%BeginResource: file (PDF Color Space obj_%ld)\n", id);
+ break;
+ case resourceExtGState:
+ pprintld1(s, "%%%%BeginResource: file (PDF Extended Graphics State obj_%ld)\n", id);
+ break;
+ case resourcePattern:
+ pprintld1(s, "%%%%BeginResource: pattern (PDF Pattern obj_%ld)\n", id);
+ break;
+ case resourceShading:
+ pprintld1(s, "%%%%BeginResource: file (PDF Shading obj_%ld)\n", id);
+ break;
+ case resourceCIDFont:
+ case resourceFont:
+ /* Ought to write the font name here */
+ pprintld1(s, "%%%%BeginResource: font (PDF Font obj_%ld)\n", id);
+ break;
+ case resourceCharProc:
+ pprintld1(s, "%%%%BeginResource: file (PDF CharProc obj_%ld)\n", id);
+ break;
+ case resourceCMap:
+ pprintld1(s, "%%%%BeginResource: file (PDF CMap obj_%ld)\n", id);
+ break;
+ case resourceFontDescriptor:
+ pprintld1(s, "%%%%BeginResource: file (PDF FontDescriptor obj_%ld)\n", id);
+ break;
+ case resourceGroup:
+ pprintld1(s, "%%%%BeginResource: file (PDF Group obj_%ld)\n", id);
+ break;
+ case resourceFunction:
+ pprintld1(s, "%%%%BeginResource: file (PDF Function obj_%ld)\n", id);
+ break;
+ case resourceEncoding:
+ pprintld1(s, "%%%%BeginResource: encoding (PDF Encoding obj_%ld)\n", id);
+ break;
+ case resourceCIDSystemInfo:
+ pprintld1(s, "%%%%BeginResource: file (PDF CIDSystemInfo obj_%ld)\n", id);
+ break;
+ case resourceHalftone:
+ pprintld1(s, "%%%%BeginResource: file (PDF Halftone obj_%ld)\n", id);
+ break;
+ case resourceLength:
+ pprintld1(s, "%%%%BeginResource: file (PDF Length obj_%ld)\n", id);
+ break;
+ case resourceSoftMaskDict:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF SoftMask obj_%ld)\n", id);
+ break;
+ case resourceXObject:
+ /* This should not be possible, we write these inline */
+ pprintld1(s, "%%%%BeginResource: file (PDF XObject obj_%ld)\n", id);
+ break;
+ case resourceStream:
+ /* Possibly we should not add comments to this type */
+ pprintld1(s, "%%%%BeginResource: file (PDF stream obj_%ld)\n", id);
+ break;
+ case resourceOutline:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Outline obj_%ld)\n", id);
+ break;
+ case resourceArticle:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Article obj_%ld)\n", id);
+ break;
+ case resourceDests:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Dests obj_%ld)\n", id);
+ break;
+ case resourceLabels:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Page Labels obj_%ld)\n", id);
+ break;
+ case resourceThread:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Thread obj_%ld)\n", id);
+ break;
+ case resourceCatalog:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Catalog obj_%ld)\n", id);
+ break;
+ case resourceEncrypt:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Encryption obj_%ld)\n", id);
+ break;
+ case resourcePagesTree:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Pages Tree obj_%ld)\n", id);
+ break;
+ case resourceMetadata:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Metadata obj_%ld)\n", id);
+ break;
+ case resourceICC:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF ICC Profile obj_%ld)\n", id);
+ break;
+ case resourceAnnotation:
+ /* This should not be possible, not valid in PostScript */
+ pprintld1(s, "%%%%BeginResource: file (PDF Annotation obj_%ld)\n", id);
+ break;
+ default:
+ pprintld1(s, "%%%%BeginResource: file (PDF object obj_%ld)\n", id);
+ break;
+ }
}
pprintld1(s, "%ld 0 obj\n", id);
return id;
@@ -778,13 +777,13 @@ pdf_end_obj(gx_device_pdf * pdev, pdf_resource_type_t type)
{
stream_puts(pdev->strm, "endobj\n");
if (pdev->ForOPDFRead && pdev->ProduceDSC) {
- switch(type) {
- case resourcePage:
- break;
- default:
- stream_puts(pdev->strm, "%%EndResource\n");
- break;
- }
+ switch(type) {
+ case resourcePage:
+ break;
+ default:
+ stream_puts(pdev->strm, "%%EndResource\n");
+ break;
+ }
}
return 0;
}
@@ -832,7 +831,6 @@ pdf_encrypt_init(const gx_device_pdf * pdev, gs_id object_id, stream_arcfour_sta
return s_arcfour_set_key(psarc4, key, pdf_object_key(pdev, object_id, key));
}
-
/* Add the encryption filter. */
int
pdf_begin_encrypt(gx_device_pdf * pdev, stream **s, gs_id object_id)
@@ -843,17 +841,17 @@ pdf_begin_encrypt(gx_device_pdf * pdev, stream **s, gs_id object_id)
int code, keylength;
if (!pdev->KeyLength)
- return 0;
+ return 0;
keylength = pdf_object_key(pdev, object_id, key);
- ss = gs_alloc_struct(mem, stream_arcfour_state,
- s_arcfour_template.stype, "psdf_encrypt");
+ ss = gs_alloc_struct(mem, stream_arcfour_state,
+ s_arcfour_template.stype, "psdf_encrypt");
if (ss == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = s_arcfour_set_key(ss, key, keylength);
if (code < 0)
- return code;
+ return code;
if (s_add_filter(s, &s_arcfour_template, (stream_state *)ss, mem) == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
return 0;
/* IMPORTANT NOTE :
We don't encrypt streams written into temporary files,
@@ -869,13 +867,13 @@ void
pdf_end_encrypt(gx_device_pdf * pdev)
{
if (pdev->KeyLength) {
- stream *s = pdev->strm;
- stream *fs = s->strm;
+ stream *s = pdev->strm;
+ stream *fs = s->strm;
- sclose(s);
- gs_free_object(pdev->pdf_memory, s->cbuf, "encrypt buffer");
- gs_free_object(pdev->pdf_memory, s, "encrypt stream");
- pdev->strm = fs;
+ sclose(s);
+ gs_free_object(pdev->pdf_memory, s->cbuf, "encrypt buffer");
+ gs_free_object(pdev->pdf_memory, s, "encrypt stream");
+ pdev->strm = fs;
}
}
@@ -887,80 +885,80 @@ none_to_stream(gx_device_pdf * pdev)
int code;
if (pdev->contents_id != 0)
- return_error(gs_error_Fatal); /* only 1 contents per page */
+ return_error(gs_error_Fatal); /* only 1 contents per page */
pdev->compression_at_page_start = pdev->compression;
if (pdev->ResourcesBeforeUsage) {
- pdf_resource_t *pres;
-
- code = pdf_enter_substream(pdev, resourcePage, gs_no_id, &pres,
- true, pdev->params.CompressPages);
- if (code < 0)
- return code;
- pdev->contents_id = pres->object->id;
- pdev->contents_length_id = gs_no_id; /* inapplicable */
- pdev->contents_pos = -1; /* inapplicable */
- s = pdev->strm;
+ pdf_resource_t *pres;
+
+ code = pdf_enter_substream(pdev, resourcePage, gs_no_id, &pres,
+ true, pdev->params.CompressPages);
+ if (code < 0)
+ return code;
+ pdev->contents_id = pres->object->id;
+ pdev->contents_length_id = gs_no_id; /* inapplicable */
+ pdev->contents_pos = -1; /* inapplicable */
+ s = pdev->strm;
} else {
- pdev->contents_id = pdf_begin_obj(pdev, resourceStream);
- pdev->contents_length_id = pdf_obj_ref(pdev);
- s = pdev->strm;
- pprintld1(s, "<</Length %ld 0 R", pdev->contents_length_id);
- if (pdev->compression == pdf_compress_Flate) {
- if (pdev->binary_ok)
- pprints1(s, "/Filter /%s", compression_filter_name);
- else
- pprints1(s, "/Filter [/ASCII85Decode /%s]", compression_filter_name);
- }
- stream_puts(s, ">>\nstream\n");
- pdev->contents_pos = pdf_stell(pdev);
- code = pdf_begin_encrypt(pdev, &s, pdev->contents_id);
- if (code < 0)
- return code;
- pdev->strm = s;
- if (pdev->compression == pdf_compress_Flate) { /* Set up the Flate filter. */
- const stream_template *template;
- stream *es;
- byte *buf;
- compression_filter_state *st;
-
- if (!pdev->binary_ok) { /* Set up the A85 filter */
- const stream_template *template = &s_A85E_template;
- stream *as = s_alloc(pdev->pdf_memory, "PDF contents stream");
- byte *buf = gs_alloc_bytes(pdev->pdf_memory, sbuf_size,
- "PDF contents buffer");
- stream_A85E_state *ast = gs_alloc_struct(pdev->pdf_memory, stream_A85E_state,
- template->stype, "PDF contents state");
- if (as == 0 || ast == 0 || buf == 0)
- return_error(gs_error_VMerror);
- s_std_init(as, buf, sbuf_size, &s_filter_write_procs,
- s_mode_write);
- ast->memory = pdev->pdf_memory;
- ast->template = template;
- as->state = (stream_state *) ast;
- as->procs.process = template->process;
- as->strm = s;
- (*template->init) ((stream_state *) ast);
- pdev->strm = s = as;
- }
- template = &compression_filter_template;
- es = s_alloc(pdev->pdf_memory, "PDF compression stream");
- buf = gs_alloc_bytes(pdev->pdf_memory, sbuf_size,
- "PDF compression buffer");
- st = gs_alloc_struct(pdev->pdf_memory, compression_filter_state,
- template->stype, "PDF compression state");
- if (es == 0 || st == 0 || buf == 0)
- return_error(gs_error_VMerror);
- s_std_init(es, buf, sbuf_size, &s_filter_write_procs,
- s_mode_write);
- st->memory = pdev->pdf_memory;
- st->template = template;
- es->state = (stream_state *) st;
- es->procs.process = template->process;
- es->strm = s;
- (*template->set_defaults) ((stream_state *) st);
- (*template->init) ((stream_state *) st);
- pdev->strm = s = es;
- }
+ pdev->contents_id = pdf_begin_obj(pdev, resourceStream);
+ pdev->contents_length_id = pdf_obj_ref(pdev);
+ s = pdev->strm;
+ pprintld1(s, "<</Length %ld 0 R", pdev->contents_length_id);
+ if (pdev->compression == pdf_compress_Flate) {
+ if (pdev->binary_ok)
+ pprints1(s, "/Filter /%s", compression_filter_name);
+ else
+ pprints1(s, "/Filter [/ASCII85Decode /%s]", compression_filter_name);
+ }
+ stream_puts(s, ">>\nstream\n");
+ pdev->contents_pos = pdf_stell(pdev);
+ code = pdf_begin_encrypt(pdev, &s, pdev->contents_id);
+ if (code < 0)
+ return code;
+ pdev->strm = s;
+ if (pdev->compression == pdf_compress_Flate) { /* Set up the Flate filter. */
+ const stream_template *template;
+ stream *es;
+ byte *buf;
+ compression_filter_state *st;
+
+ if (!pdev->binary_ok) { /* Set up the A85 filter */
+ const stream_template *template = &s_A85E_template;
+ stream *as = s_alloc(pdev->pdf_memory, "PDF contents stream");
+ byte *buf = gs_alloc_bytes(pdev->pdf_memory, sbuf_size,
+ "PDF contents buffer");
+ stream_A85E_state *ast = gs_alloc_struct(pdev->pdf_memory, stream_A85E_state,
+ template->stype, "PDF contents state");
+ if (as == 0 || ast == 0 || buf == 0)
+ return_error(gs_error_VMerror);
+ s_std_init(as, buf, sbuf_size, &s_filter_write_procs,
+ s_mode_write);
+ ast->memory = pdev->pdf_memory;
+ ast->template = template;
+ as->state = (stream_state *) ast;
+ as->procs.process = template->process;
+ as->strm = s;
+ (*template->init) ((stream_state *) ast);
+ pdev->strm = s = as;
+ }
+ template = &compression_filter_template;
+ es = s_alloc(pdev->pdf_memory, "PDF compression stream");
+ buf = gs_alloc_bytes(pdev->pdf_memory, sbuf_size,
+ "PDF compression buffer");
+ st = gs_alloc_struct(pdev->pdf_memory, compression_filter_state,
+ template->stype, "PDF compression state");
+ if (es == 0 || st == 0 || buf == 0)
+ return_error(gs_error_VMerror);
+ s_std_init(es, buf, sbuf_size, &s_filter_write_procs,
+ s_mode_write);
+ st->memory = pdev->pdf_memory;
+ st->template = template;
+ es->state = (stream_state *) st;
+ es->procs.process = template->process;
+ es->strm = s;
+ (*template->set_defaults) ((stream_state *) st);
+ (*template->init) ((stream_state *) st);
+ pdev->strm = s = es;
+ }
}
/*
* Scale the coordinate system. Use an extra level of q/Q for the
@@ -968,15 +966,15 @@ none_to_stream(gx_device_pdf * pdev)
* stream restores the CTM.
*/
pprintg2(s, "q %g 0 0 %g 0 0 cm\n",
- 72.0 / pdev->HWResolution[0], 72.0 / pdev->HWResolution[1]);
+ 72.0 / pdev->HWResolution[0], 72.0 / pdev->HWResolution[1]);
if (pdev->CompatibilityLevel >= 1.3) {
- /* Set the default rendering intent. */
- if (pdev->params.DefaultRenderingIntent != ri_Default) {
- static const char *const ri_names[] = { psdf_ri_names };
+ /* Set the default rendering intent. */
+ if (pdev->params.DefaultRenderingIntent != ri_Default) {
+ static const char *const ri_names[] = { psdf_ri_names };
- pprints1(s, "/%s ri\n",
- ri_names[(int)pdev->params.DefaultRenderingIntent]);
- }
+ pprints1(s, "/%s ri\n",
+ ri_names[(int)pdev->params.DefaultRenderingIntent]);
+ }
}
pdev->AR4_save_bug = false;
return PDF_IN_STREAM;
@@ -997,9 +995,9 @@ stream_to_text(gx_device_pdf * pdev)
*/
code = pdf_save_viewer_state(pdev, pdev->strm);
if (code < 0)
- return 0;
+ return 0;
pprintg2(pdev->strm, "%g 0 0 %g 0 0 cm BT\n",
- pdev->HWResolution[0] / 72.0, pdev->HWResolution[1] / 72.0);
+ pdev->HWResolution[0] / 72.0, pdev->HWResolution[1] / 72.0);
pdev->procsets |= Text;
code = pdf_from_stream_to_text(pdev);
return (code < 0 ? code : PDF_IN_TEXT);
@@ -1021,7 +1019,7 @@ text_to_stream(gx_device_pdf * pdev)
stream_puts(pdev->strm, "ET\n");
code = pdf_restore_viewer_state(pdev, pdev->strm);
if (code < 0)
- return code;
+ return code;
pdf_reset_text(pdev); /* because of Q */
return PDF_IN_STREAM;
}
@@ -1034,41 +1032,41 @@ stream_to_none(gx_device_pdf * pdev)
int code;
if (pdev->ResourcesBeforeUsage) {
- int code = pdf_exit_substream(pdev);
+ int code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
} else {
- if (pdev->vgstack_depth) {
- code = pdf_restore_viewer_state(pdev, s);
- if (code < 0)
- return code;
- }
- if (pdev->compression_at_page_start == pdf_compress_Flate) { /* Terminate the filters. */
- stream *fs = s->strm;
-
- if (!pdev->binary_ok) {
- sclose(s); /* Terminate the ASCII85 filter. */
- gs_free_object(pdev->pdf_memory, s->cbuf, "A85E contents buffer");
- gs_free_object(pdev->pdf_memory, s, "A85E contents stream");
- pdev->strm = s = fs;
- fs = s->strm;
- }
- sclose(s); /* Next terminate the compression filter */
- gs_free_object(pdev->pdf_memory, s->cbuf, "zlib buffer");
- gs_free_object(pdev->pdf_memory, s, "zlib stream");
- pdev->strm = fs;
- }
- pdf_end_encrypt(pdev);
- s = pdev->strm;
- length = pdf_stell(pdev) - pdev->contents_pos;
- if (pdev->PDFA)
- stream_puts(s, "\n");
- stream_puts(s, "endstream\n");
- pdf_end_obj(pdev, resourceStream);
- pdf_open_obj(pdev, pdev->contents_length_id, resourceLength);
- pprintld1(s, "%ld\n", length);
- pdf_end_obj(pdev, resourceLength);
+ if (pdev->vgstack_depth) {
+ code = pdf_restore_viewer_state(pdev, s);
+ if (code < 0)
+ return code;
+ }
+ if (pdev->compression_at_page_start == pdf_compress_Flate) { /* Terminate the filters. */
+ stream *fs = s->strm;
+
+ if (!pdev->binary_ok) {
+ sclose(s); /* Terminate the ASCII85 filter. */
+ gs_free_object(pdev->pdf_memory, s->cbuf, "A85E contents buffer");
+ gs_free_object(pdev->pdf_memory, s, "A85E contents stream");
+ pdev->strm = s = fs;
+ fs = s->strm;
+ }
+ sclose(s); /* Next terminate the compression filter */
+ gs_free_object(pdev->pdf_memory, s->cbuf, "zlib buffer");
+ gs_free_object(pdev->pdf_memory, s, "zlib stream");
+ pdev->strm = fs;
+ }
+ pdf_end_encrypt(pdev);
+ s = pdev->strm;
+ length = pdf_stell(pdev) - pdev->contents_pos;
+ if (pdev->PDFA)
+ stream_puts(s, "\n");
+ stream_puts(s, "endstream\n");
+ pdf_end_obj(pdev, resourceStream);
+ pdf_open_obj(pdev, pdev->contents_length_id, resourceLength);
+ pprintld1(s, "%ld\n", length);
+ pdf_end_obj(pdev, resourceLength);
}
return PDF_IN_NONE;
}
@@ -1080,11 +1078,11 @@ pdf_open_contents(gx_device_pdf * pdev, pdf_context_t context)
int (*proc) (gx_device_pdf *);
while ((proc = context_procs[pdev->context][context]) != 0) {
- int code = (*proc) (pdev);
+ int code = (*proc) (pdev);
- if (code < 0)
- return code;
- pdev->context = (pdf_context_t) code;
+ if (code < 0)
+ return code;
+ pdev->context = (pdf_context_t) code;
}
pdev->context = context;
return 0;
@@ -1095,14 +1093,14 @@ int
pdf_close_contents(gx_device_pdf * pdev, bool last)
{
if (pdev->context == PDF_IN_NONE)
- return 0;
+ return 0;
if (last) { /* Exit from the clipping path gsave. */
- int code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ int code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
- stream_puts(pdev->strm, "Q\n"); /* See none_to_stream. */
- pdf_close_text_contents(pdev);
+ if (code < 0)
+ return code;
+ stream_puts(pdev->strm, "Q\n"); /* See none_to_stream. */
+ pdf_close_text_contents(pdev);
}
return pdf_open_contents(pdev, PDF_IN_NONE);
}
@@ -1124,12 +1122,12 @@ pdf_cancel_resource(gx_device_pdf * pdev, pdf_resource_t *pres, pdf_resource_typ
/* fixme : remove *pres from resource chain. */
pres->where_used = 0;
pres->object->written = true;
- if (rtype == resourceXObject || rtype == resourceCharProc || rtype == resourceOther
- || rtype > NUM_RESOURCE_TYPES) {
- int code = cos_stream_release_pieces((cos_stream_t *)pres->object);
+ if (rtype == resourceXObject || rtype == resourceCharProc || rtype == resourceOther
+ || rtype > NUM_RESOURCE_TYPES) {
+ int code = cos_stream_release_pieces((cos_stream_t *)pres->object);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
cos_release(pres->object, "pdf_cancel_resource");
return 0;
@@ -1145,79 +1143,78 @@ pdf_forget_resource(gx_device_pdf * pdev, pdf_resource_t *pres1, pdf_resource_ty
int i;
for (; (pres = *pprev) != 0; pprev = &pres->prev)
- if (pres == pres1) {
- *pprev = pres->prev;
- break;
- }
+ if (pres == pres1) {
+ *pprev = pres->prev;
+ break;
+ }
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- pprev = pchain + i;
- for (; (pres = *pprev) != 0; pprev = &pres->next)
- if (pres == pres1) {
- *pprev = pres->next;
- COS_RELEASE(pres->object, "pdf_forget_resource");
- gs_free_object(pdev->pdf_memory, pres->object, "pdf_forget_resource");
- gs_free_object(pdev->pdf_memory, pres, "pdf_forget_resource");
- break;
- }
+ pprev = pchain + i;
+ for (; (pres = *pprev) != 0; pprev = &pres->next)
+ if (pres == pres1) {
+ *pprev = pres->next;
+ COS_RELEASE(pres->object, "pdf_forget_resource");
+ gs_free_object(pdev->pdf_memory, pres->object, "pdf_forget_resource");
+ gs_free_object(pdev->pdf_memory, pres, "pdf_forget_resource");
+ break;
+ }
}
}
-static int
+static int
nocheck(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
{
return 1;
}
-
/* Substitute a resource with a same one. */
int
-pdf_substitute_resource(gx_device_pdf *pdev, pdf_resource_t **ppres,
- pdf_resource_type_t rtype,
- int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1),
- bool write)
+pdf_substitute_resource(gx_device_pdf *pdev, pdf_resource_t **ppres,
+ pdf_resource_type_t rtype,
+ int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1),
+ bool write)
{
pdf_resource_t *pres1 = *ppres;
int code;
code = pdf_find_same_resource(pdev, rtype, ppres, (eq ? eq : nocheck));
if (code < 0)
- return code;
+ return code;
if (code != 0) {
- code = pdf_cancel_resource(pdev, (pdf_resource_t *)pres1, rtype);
- if (code < 0)
- return code;
- pdf_forget_resource(pdev, pres1, rtype);
- return 0;
+ code = pdf_cancel_resource(pdev, (pdf_resource_t *)pres1, rtype);
+ if (code < 0)
+ return code;
+ pdf_forget_resource(pdev, pres1, rtype);
+ return 0;
} else {
- pdf_reserve_object_id(pdev, pres1, gs_no_id);
- if (write) {
- code = cos_write_object(pres1->object, pdev, rtype);
- if (code < 0)
- return code;
- pres1->object->written = 1;
- }
- return 1;
+ pdf_reserve_object_id(pdev, pres1, gs_no_id);
+ if (write) {
+ code = cos_write_object(pres1->object, pdev, rtype);
+ if (code < 0)
+ return code;
+ pres1->object->written = 1;
+ }
+ return 1;
}
}
/* Find a resource of a given type by gs_id. */
pdf_resource_t *
pdf_find_resource_by_gs_id(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- gs_id rid)
+ gs_id rid)
{
pdf_resource_t **pchain = PDF_RESOURCE_CHAIN(pdev, rtype, rid);
pdf_resource_t **pprev = pchain;
pdf_resource_t *pres;
for (; (pres = *pprev) != 0; pprev = &pres->next)
- if (pres->rid == rid) {
- if (pprev != pchain) {
- *pprev = pres->next;
- pres->next = *pchain;
- *pchain = pres;
- }
- return pres;
- }
+ if (pres->rid == rid) {
+ if (pprev != pchain) {
+ *pprev = pres->next;
+ pres->next = *pchain;
+ *pchain = pres;
+ }
+ return pres;
+ }
return 0;
}
@@ -1228,57 +1225,56 @@ pdf_find_resource_by_resource_id(gx_device_pdf * pdev, pdf_resource_type_t rtype
pdf_resource_t **pchain = pdev->resources[rtype].chains;
pdf_resource_t *pres;
int i;
-
+
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next) {
- if (pres->object->id == id)
- return pres;
- }
+ for (pres = pchain[i]; pres != 0; pres = pres->next) {
+ if (pres->object->id == id)
+ return pres;
+ }
}
return 0;
}
-
/* Find same resource. */
int
pdf_find_same_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, pdf_resource_t **ppres,
- int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1))
+ int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1))
{
pdf_resource_t **pchain = pdev->resources[rtype].chains;
pdf_resource_t *pres;
cos_object_t *pco0 = (*ppres)->object;
int i;
-
+
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next) {
- if (*ppres != pres) {
- int code;
- cos_object_t *pco1 = pres->object;
-
- if (cos_type(pco0) != cos_type(pco1))
- continue; /* don't compare different types */
- code = pco0->cos_procs->equal(pco0, pco1, pdev);
- if (code < 0)
- return code;
- if (code > 0) {
- code = eq(pdev, *ppres, pres);
- if (code < 0)
- return code;
- if (code > 0) {
- *ppres = pres;
- return 1;
- }
- }
- }
- }
+ for (pres = pchain[i]; pres != 0; pres = pres->next) {
+ if (*ppres != pres) {
+ int code;
+ cos_object_t *pco1 = pres->object;
+
+ if (cos_type(pco0) != cos_type(pco1))
+ continue; /* don't compare different types */
+ code = pco0->cos_procs->equal(pco0, pco1, pdev);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ code = eq(pdev, *ppres, pres);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ *ppres = pres;
+ return 1;
+ }
+ }
+ }
+ }
}
return 0;
}
/* Drop resources by a condition. */
void
-pdf_drop_resources(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- int (*cond)(gx_device_pdf * pdev, pdf_resource_t *pres))
+pdf_drop_resources(gx_device_pdf * pdev, pdf_resource_type_t rtype,
+ int (*cond)(gx_device_pdf * pdev, pdf_resource_t *pres))
{
pdf_resource_t **pchain = pdev->resources[rtype].chains;
pdf_resource_t **pprev;
@@ -1286,24 +1282,24 @@ pdf_drop_resources(gx_device_pdf * pdev, pdf_resource_type_t rtype,
int i;
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- pprev = pchain + i;
- for (; (pres = *pprev) != 0; ) {
- if (cond(pdev, pres)) {
- *pprev = pres->next;
- pres->next = pres; /* A temporary mark - see below */
- } else
- pprev = &pres->next;
- }
+ pprev = pchain + i;
+ for (; (pres = *pprev) != 0; ) {
+ if (cond(pdev, pres)) {
+ *pprev = pres->next;
+ pres->next = pres; /* A temporary mark - see below */
+ } else
+ pprev = &pres->next;
+ }
}
pprev = &pdev->last_resource;
for (; (pres = *pprev) != 0; )
- if (pres->next == pres) {
- *pprev = pres->prev;
- COS_RELEASE(pres->object, "pdf_drop_resources");
- gs_free_object(pdev->pdf_memory, pres->object, "pdf_drop_resources");
- gs_free_object(pdev->pdf_memory, pres, "pdf_drop_resources");
- } else
- pprev = &pres->prev;
+ if (pres->next == pres) {
+ *pprev = pres->prev;
+ COS_RELEASE(pres->object, "pdf_drop_resources");
+ gs_free_object(pdev->pdf_memory, pres->object, "pdf_drop_resources");
+ gs_free_object(pdev->pdf_memory, pres, "pdf_drop_resources");
+ } else
+ pprev = &pres->prev;
}
/* Print resource statistics. */
@@ -1314,20 +1310,19 @@ pdf_print_resource_statistics(gx_device_pdf * pdev)
int rtype;
for (rtype = 0; rtype < NUM_RESOURCE_TYPES; rtype++) {
- pdf_resource_t **pchain = pdev->resources[rtype].chains;
- pdf_resource_t *pres;
- const char *name = pdf_resource_type_names[rtype];
- int i, n = 0;
-
- for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next, n++);
- }
- dprintf3("Resource type %d (%s) has %d instances.\n", rtype,
- (name ? name : ""), n);
+ pdf_resource_t **pchain = pdev->resources[rtype].chains;
+ pdf_resource_t *pres;
+ const char *name = pdf_resource_type_names[rtype];
+ int i, n = 0;
+
+ for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
+ for (pres = pchain[i]; pres != 0; pres = pres->next, n++);
+ }
+ dprintf3("Resource type %d (%s) has %d instances.\n", rtype,
+ (name ? name : ""), n);
}
}
-
/* Begin an object logically separate from the contents. */
long
pdf_open_separate(gx_device_pdf * pdev, long id, pdf_resource_type_t type)
@@ -1335,7 +1330,7 @@ pdf_open_separate(gx_device_pdf * pdev, long id, pdf_resource_type_t type)
int code;
code = pdf_open_document(pdev);
if (code < 0)
- return code;
+ return code;
pdev->asides.save_strm = pdev->strm;
pdev->strm = pdev->asides.strm;
return pdf_open_obj(pdev, id, type);
@@ -1356,28 +1351,28 @@ pdf_reserve_object_id(gx_device_pdf * pdev, pdf_resource_t *pres, long id)
/* Begin an aside (resource, annotation, ...). */
int
pdf_alloc_aside(gx_device_pdf * pdev, pdf_resource_t ** plist,
- const gs_memory_struct_type_t * pst, pdf_resource_t **ppres,
- long id)
+ const gs_memory_struct_type_t * pst, pdf_resource_t **ppres,
+ long id)
{
pdf_resource_t *pres;
cos_object_t *object;
if (pst == NULL)
- pst = &st_pdf_resource;
+ pst = &st_pdf_resource;
pres = gs_alloc_struct(pdev->pdf_memory, pdf_resource_t, pst,
- "pdf_alloc_aside(resource)");
+ "pdf_alloc_aside(resource)");
if (pres == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
object = cos_object_alloc(pdev, "pdf_alloc_aside(object)");
if (object == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pres + 1, 0, pst->ssize - sizeof(*pres));
pres->object = object;
if (id < 0) {
- object->id = -1L;
- pres->rname[0] = 0;
+ object->id = -1L;
+ pres->rname[0] = 0;
} else
- pdf_reserve_object_id(pdev, pres, id);
+ pdf_reserve_object_id(pdev, pres, id);
pres->next = *plist;
pres->rid = 0;
*plist = pres;
@@ -1391,49 +1386,49 @@ pdf_alloc_aside(gx_device_pdf * pdev, pdf_resource_t ** plist,
}
int
pdf_begin_aside(gx_device_pdf * pdev, pdf_resource_t ** plist,
- const gs_memory_struct_type_t * pst, pdf_resource_t ** ppres,
- pdf_resource_type_t type)
+ const gs_memory_struct_type_t * pst, pdf_resource_t ** ppres,
+ pdf_resource_type_t type)
{
long id = pdf_begin_separate(pdev, type);
if (id < 0)
- return (int)id;
+ return (int)id;
return pdf_alloc_aside(pdev, plist, pst, ppres, id);
}
/* Begin a resource of a given type. */
int
pdf_begin_resource_body(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- gs_id rid, pdf_resource_t ** ppres)
+ gs_id rid, pdf_resource_t ** ppres)
{
int code;
-
+
if (rtype > NUM_RESOURCE_TYPES)
- rtype = resourceOther;
+ rtype = resourceOther;
code = pdf_begin_aside(pdev, PDF_RESOURCE_CHAIN(pdev, rtype, rid),
- pdf_resource_type_structs[rtype], ppres, rtype);
+ pdf_resource_type_structs[rtype], ppres, rtype);
if (code >= 0)
- (*ppres)->rid = rid;
+ (*ppres)->rid = rid;
return code;
}
int
pdf_begin_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, gs_id rid,
- pdf_resource_t ** ppres)
+ pdf_resource_t ** ppres)
{
int code;
if (rtype > NUM_RESOURCE_TYPES)
- rtype = resourceOther;
-
+ rtype = resourceOther;
+
code = pdf_begin_resource_body(pdev, rtype, rid, ppres);
if (code >= 0 && pdf_resource_type_names[rtype] != 0) {
- stream *s = pdev->strm;
+ stream *s = pdev->strm;
- pprints1(s, "<</Type%s", pdf_resource_type_names[rtype]);
- pprintld1(s, "/Name/R%ld", (*ppres)->object->id);
+ pprints1(s, "<</Type%s", pdf_resource_type_names[rtype]);
+ pprintld1(s, "/Name/R%ld", (*ppres)->object->id);
}
return code;
}
@@ -1441,18 +1436,18 @@ pdf_begin_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, gs_id rid,
/* Allocate a resource, but don't open the stream. */
int
pdf_alloc_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, gs_id rid,
- pdf_resource_t ** ppres, long id)
+ pdf_resource_t ** ppres, long id)
{
int code;
-
+
if (rtype > NUM_RESOURCE_TYPES)
- rtype = resourceOther;
+ rtype = resourceOther;
code = pdf_alloc_aside(pdev, PDF_RESOURCE_CHAIN(pdev, rtype, rid),
- pdf_resource_type_structs[rtype], ppres, id);
+ pdf_resource_type_structs[rtype], ppres, id);
if (code >= 0)
- (*ppres)->rid = rid;
+ (*ppres)->rid = rid;
return code;
}
@@ -1486,7 +1481,6 @@ pdf_end_resource(gx_device_pdf * pdev, pdf_resource_type_t type)
return pdf_end_aside(pdev, type);
}
-
/*
* Write the Cos objects for resources local to a content stream. Formerly,
* this procedure also freed such objects, but this doesn't work, because
@@ -1498,13 +1492,13 @@ pdf_write_resource_objects(gx_device_pdf *pdev, pdf_resource_type_t rtype)
int j, code = 0;
for (j = 0; j < NUM_RESOURCE_CHAINS && code >= 0; ++j) {
- pdf_resource_t *pres = pdev->resources[rtype].chains[j];
+ pdf_resource_t *pres = pdev->resources[rtype].chains[j];
- for (; pres != 0; pres = pres->next)
- if ((!pres->named || pdev->ForOPDFRead)
- && !pres->object->written) {
- code = cos_write_object(pres->object, pdev, rtype);
- }
+ for (; pres != 0; pres = pres->next)
+ if ((!pres->named || pdev->ForOPDFRead)
+ && !pres->object->written) {
+ code = cos_write_object(pres->object, pdev, rtype);
+ }
}
return code;
}
@@ -1521,21 +1515,20 @@ pdf_reverse_resource_chain(gx_device_pdf *pdev, pdf_resource_type_t rtype)
pdf_resource_t *pres1, *pres0 = pres, *pres2;
if (pres == NULL)
- return;
+ return;
pres1 = pres->next;
for (;;) {
- if (pres1 == NULL)
- break;
- pres2 = pres1->next;
- pres1->next = pres;
- pres = pres1;
- pres1 = pres2;
+ if (pres1 == NULL)
+ break;
+ pres2 = pres1->next;
+ pres1->next = pres;
+ pres = pres1;
+ pres1 = pres2;
}
pres0->next = NULL;
pdev->resources[rtype].chains[0] = pres;
}
-
/*
* Free unnamed Cos objects for resources local to a content stream,
* since they can't be used again.
@@ -1546,18 +1539,18 @@ pdf_free_resource_objects(gx_device_pdf *pdev, pdf_resource_type_t rtype)
int j;
for (j = 0; j < NUM_RESOURCE_CHAINS; ++j) {
- pdf_resource_t **prev = &pdev->resources[rtype].chains[j];
- pdf_resource_t *pres;
-
- while ((pres = *prev) != 0) {
- if (pres->named) { /* named, don't free */
- prev = &pres->next;
- } else {
- cos_free(pres->object, "pdf_free_resource_objects");
- pres->object = 0;
- *prev = pres->next;
- }
- }
+ pdf_resource_t **prev = &pdev->resources[rtype].chains[j];
+ pdf_resource_t *pres;
+
+ while ((pres = *prev) != 0) {
+ if (pres->named) { /* named, don't free */
+ prev = &pres->next;
+ } else {
+ cos_free(pres->object, "pdf_free_resource_objects");
+ pres->object = 0;
+ *prev = pres->next;
+ }
+ }
}
return 0;
}
@@ -1570,18 +1563,18 @@ pdf_write_and_free_all_resource_objects(gx_device_pdf *pdev)
int i, code = 0, code1;
for (i = 0; i < NUM_RESOURCE_TYPES; ++i) {
- code1 = pdf_write_resource_objects(pdev, i);
- if (code >= 0)
- code = code1;
+ code1 = pdf_write_resource_objects(pdev, i);
+ if (code >= 0)
+ code = code1;
}
code1 = pdf_finish_resources(pdev, resourceFontDescriptor,
- pdf_release_FontDescriptor_components);
+ pdf_release_FontDescriptor_components);
if (code >= 0)
- code = code1;
+ code = code1;
for (i = 0; i < NUM_RESOURCE_TYPES; ++i) {
- code1 = pdf_free_resource_objects(pdev, i);
- if (code >= 0)
- code = code1;
+ code1 = pdf_free_resource_objects(pdev, i);
+ if (code >= 0)
+ code = code1;
}
return code;
}
@@ -1598,39 +1591,39 @@ pdf_store_page_resources(gx_device_pdf *pdev, pdf_page_t *page, bool clear_usage
/* Write any resource dictionaries. */
for (i = 0; i <= resourceFont; ++i) {
- stream *s = 0;
- int j;
-
- if (i == resourceOther || i > NUM_RESOURCE_TYPES)
- continue;
- page->resource_ids[i] = 0;
- for (j = 0; j < NUM_RESOURCE_CHAINS; ++j) {
- pdf_resource_t *pres = pdev->resources[i].chains[j];
-
- for (; pres != 0; pres = pres->next) {
- if (pres->where_used & pdev->used_mask) {
- long id = pdf_resource_id(pres);
-
- if (id == -1L)
- continue;
- if (s == 0) {
- page->resource_ids[i] = pdf_begin_separate(pdev, i);
- s = pdev->strm;
- stream_puts(s, "<<");
- }
- pprints1(s, "/%s\n", pres->rname);
- pprintld1(s, "%ld 0 R", id);
- if (clear_usage)
- pres->where_used -= pdev->used_mask;
- }
- }
- }
- if (s) {
- stream_puts(s, ">>\n");
- pdf_end_separate(pdev, i);
- if (i != resourceFont)
- pdf_write_resource_objects(pdev, i);
- }
+ stream *s = 0;
+ int j;
+
+ if (i == resourceOther || i > NUM_RESOURCE_TYPES)
+ continue;
+ page->resource_ids[i] = 0;
+ for (j = 0; j < NUM_RESOURCE_CHAINS; ++j) {
+ pdf_resource_t *pres = pdev->resources[i].chains[j];
+
+ for (; pres != 0; pres = pres->next) {
+ if (pres->where_used & pdev->used_mask) {
+ long id = pdf_resource_id(pres);
+
+ if (id == -1L)
+ continue;
+ if (s == 0) {
+ page->resource_ids[i] = pdf_begin_separate(pdev, i);
+ s = pdev->strm;
+ stream_puts(s, "<<");
+ }
+ pprints1(s, "/%s\n", pres->rname);
+ pprintld1(s, "%ld 0 R", id);
+ if (clear_usage)
+ pres->where_used -= pdev->used_mask;
+ }
+ }
+ }
+ if (s) {
+ stream_puts(s, ">>\n");
+ pdf_end_separate(pdev, i);
+ if (i != resourceFont)
+ pdf_write_resource_objects(pdev, i);
+ }
}
page->procsets = pdev->procsets;
return 0;
@@ -1642,45 +1635,44 @@ pdf_copy_data(stream *s, FILE *file, long count, stream_arcfour_state *ss)
{
long r, left = count, code;
byte buf[sbuf_size];
-
+
while (left > 0) {
- uint copy = min(left, sbuf_size);
-
- r = fread(buf, 1, copy, file);
- if (r < 1) {
- code = gs_note_error(gs_error_ioerror);
- return;
- }
- if (ss)
- s_arcfour_process_buffer(ss, buf, copy);
- stream_write(s, buf, copy);
- left -= copy;
+ uint copy = min(left, sbuf_size);
+
+ r = fread(buf, 1, copy, file);
+ if (r < 1) {
+ code = gs_note_error(gs_error_ioerror);
+ return;
+ }
+ if (ss)
+ s_arcfour_process_buffer(ss, buf, copy);
+ stream_write(s, buf, copy);
+ left -= copy;
}
}
-
-/* Copy data from a temporary file to a stream,
+/* Copy data from a temporary file to a stream,
which may be targetted to the same file. */
void
pdf_copy_data_safe(stream *s, FILE *file, long position, long count)
-{
+{
long r, left = count, code;
while (left > 0) {
- byte buf[sbuf_size];
- long copy = min(left, (long)sbuf_size);
- long end_pos = ftell(file);
-
- fseek(file, position + count - left, SEEK_SET);
- r = fread(buf, 1, copy, file);
- if (r < 1) {
- code = gs_note_error(gs_error_ioerror);
- return;
- }
- fseek(file, end_pos, SEEK_SET);
- stream_write(s, buf, copy);
- sflush(s);
- left -= copy;
+ byte buf[sbuf_size];
+ long copy = min(left, (long)sbuf_size);
+ long end_pos = ftell(file);
+
+ fseek(file, position + count - left, SEEK_SET);
+ r = fread(buf, 1, copy, file);
+ if (r < 1) {
+ code = gs_note_error(gs_error_ioerror);
+ return;
+ }
+ fseek(file, end_pos, SEEK_SET);
+ stream_write(s, buf, copy);
+ sflush(s);
+ left -= copy;
}
}
@@ -1694,25 +1686,25 @@ pdf_page_id(gx_device_pdf * pdev, int page_num)
cos_dict_t *Page;
if (page_num < 1)
- return 0;
+ return 0;
if (page_num >= pdev->num_pages) { /* Grow the pages array. */
- uint new_num_pages =
- max(page_num + 10, pdev->num_pages << 1);
- pdf_page_t *new_pages =
- gs_resize_object(pdev->pdf_memory, pdev->pages, new_num_pages,
- "pdf_page_id(resize pages)");
-
- if (new_pages == 0)
- return 0;
- memset(&new_pages[pdev->num_pages], 0,
- (new_num_pages - pdev->num_pages) * sizeof(pdf_page_t));
- pdev->pages = new_pages;
- pdev->num_pages = new_num_pages;
+ uint new_num_pages =
+ max(page_num + 10, pdev->num_pages << 1);
+ pdf_page_t *new_pages =
+ gs_resize_object(pdev->pdf_memory, pdev->pages, new_num_pages,
+ "pdf_page_id(resize pages)");
+
+ if (new_pages == 0)
+ return 0;
+ memset(&new_pages[pdev->num_pages], 0,
+ (new_num_pages - pdev->num_pages) * sizeof(pdf_page_t));
+ pdev->pages = new_pages;
+ pdev->num_pages = new_num_pages;
}
if ((Page = pdev->pages[page_num - 1].Page) == 0) {
- pdev->pages[page_num - 1].Page = Page =
- cos_dict_alloc(pdev, "pdf_page_id");
- Page->id = pdf_obj_forward_ref(pdev);
+ pdev->pages[page_num - 1].Page = Page =
+ cos_dict_alloc(pdev, "pdf_page_id");
+ Page->id = pdf_obj_forward_ref(pdev);
}
return Page->id;
}
@@ -1729,7 +1721,7 @@ cos_dict_t *
pdf_current_page_dict(gx_device_pdf *pdev)
{
if (pdf_page_id(pdev, pdev->next_page + 1) <= 0)
- return 0;
+ return 0;
return pdev->pages[pdev->next_page].Page;
}
@@ -1738,10 +1730,10 @@ int
pdf_write_saved_string(gx_device_pdf * pdev, gs_string * pstr)
{
if (pstr->data != 0) {
- stream_write(pdev->strm, pstr->data, pstr->size);
- gs_free_string(pdev->pdf_memory, pstr->data, pstr->size,
- "pdf_write_saved_string");
- pstr->data = 0;
+ stream_write(pdev->strm, pstr->data, pstr->size);
+ gs_free_string(pdev->pdf_memory, pstr->data, pstr->size,
+ "pdf_write_saved_string");
+ pstr->data = 0;
}
return 0;
}
@@ -1751,53 +1743,51 @@ int
pdf_open_page(gx_device_pdf * pdev, pdf_context_t context)
{
if (!is_in_page(pdev)) {
- int code;
+ int code;
- if (pdf_page_id(pdev, pdev->next_page + 1) == 0)
- return_error(gs_error_VMerror);
- code = pdf_open_document(pdev);
- if (code < 0)
- return code;
+ if (pdf_page_id(pdev, pdev->next_page + 1) == 0)
+ return_error(gs_error_VMerror);
+ code = pdf_open_document(pdev);
+ if (code < 0)
+ return code;
}
/* Note that context may be PDF_IN_NONE here. */
return pdf_open_contents(pdev, context);
}
-
/* Go to the unclipped stream context. */
int
pdf_unclip(gx_device_pdf * pdev)
{
const int bottom = (pdev->ResourcesBeforeUsage ? 1 : 0);
- /* When ResourcesBeforeUsage != 0, one sbstack element
+ /* When ResourcesBeforeUsage != 0, one sbstack element
appears from the page contents stream. */
if (pdev->sbstack_depth <= bottom) {
- int code = pdf_open_page(pdev, PDF_IN_STREAM);
+ int code = pdf_open_page(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (pdev->context > PDF_IN_STREAM) {
- int code = pdf_open_contents(pdev, PDF_IN_STREAM);
+ int code = pdf_open_contents(pdev, PDF_IN_STREAM);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (pdev->vgstack_depth > pdev->vgstack_bottom) {
- int code = pdf_restore_viewer_state(pdev, pdev->strm);
-
- if (code < 0)
- return code;
- code = pdf_remember_clip_path(pdev, NULL);
- if (code < 0)
- return code;
- pdev->clip_path_id = pdev->no_clip_path_id;
+ int code = pdf_restore_viewer_state(pdev, pdev->strm);
+
+ if (code < 0)
+ return code;
+ code = pdf_remember_clip_path(pdev, NULL);
+ if (code < 0)
+ return code;
+ pdev->clip_path_id = pdev->no_clip_path_id;
}
return 0;
}
-
/* ------ Miscellaneous output ------ */
/* Generate the default Producer string. */
@@ -1805,24 +1795,24 @@ void
pdf_store_default_Producer(char buf[PDF_MAX_PRODUCER])
{
if ((gs_revision % 100) == 0)
- sprintf(buf, "(%s %1.1f)", gs_product, gs_revision / 100.0);
+ sprintf(buf, "(%s %1.1f)", gs_product, gs_revision / 100.0);
else
- sprintf(buf, "(%s %1.2f)", gs_product, gs_revision / 100.0);
+ sprintf(buf, "(%s %1.2f)", gs_product, gs_revision / 100.0);
}
/* Write matrix values. */
void
pdf_put_matrix(gx_device_pdf * pdev, const char *before,
- const gs_matrix * pmat, const char *after)
+ const gs_matrix * pmat, const char *after)
{
stream *s = pdev->strm;
if (before)
- stream_puts(s, before);
+ stream_puts(s, before);
pprintg6(s, "%g %g %g %g %g %g ",
- pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
+ pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
if (after)
- stream_puts(s, after);
+ stream_puts(s, after);
}
/*
@@ -1837,29 +1827,29 @@ pdf_put_name_chars_1_2(stream *s, const byte *nstr, uint size)
uint i;
for (i = 0; i < size; ++i) {
- uint c = nstr[i];
- char hex[4];
-
- switch (c) {
- default:
- if (c >= 0x21 && c <= 0x7e) {
- stream_putc(s, (byte)c);
- break;
- }
- /* falls through */
- case '#':
- case '%':
- case '(': case ')':
- case '<': case '>':
- case '[': case ']':
- case '{': case '}':
- case '/':
- sprintf(hex, "#%02x", c);
- stream_puts(s, hex);
- break;
- case 0:
- stream_puts(s, "BnZr"); /* arbitrary */
- }
+ uint c = nstr[i];
+ char hex[4];
+
+ switch (c) {
+ default:
+ if (c >= 0x21 && c <= 0x7e) {
+ stream_putc(s, (byte)c);
+ break;
+ }
+ /* falls through */
+ case '#':
+ case '%':
+ case '(': case ')':
+ case '<': case '>':
+ case '[': case ']':
+ case '{': case '}':
+ case '/':
+ sprintf(hex, "#%02x", c);
+ stream_puts(s, hex);
+ break;
+ case 0:
+ stream_puts(s, "BnZr"); /* arbitrary */
+ }
}
return 0;
}
@@ -1891,9 +1881,9 @@ pdf_encrypt_encoded_string(const gx_device_pdf *pdev, const byte *str, uint size
stream_arcfour_state sarc4;
if (pdf_encrypt_init(pdev, object_id, &sarc4) < 0) {
- /* The interface can't pass an error. */
- stream_write(pdev->strm, str, size);
- return size;
+ /* The interface can't pass an error. */
+ stream_write(pdev->strm, str, size);
+ return size;
}
s_init(&sinp, NULL);
sread_string(&sinp, str + 1, size);
@@ -1906,19 +1896,19 @@ pdf_encrypt_encoded_string(const gx_device_pdf *pdev, const byte *str, uint size
s_init_filter(&sout, &so, bufo, sizeof(bufo), pdev->strm);
stream_putc(pdev->strm, '(');
for (;;) {
- uint n;
- int code = sgets(&sstr, buf, sizeof(buf), &n);
-
- if (n > 0) {
- s_arcfour_process_buffer(&sarc4, buf, n);
- stream_write(&sout, buf, n);
- }
- if (code == EOFC)
- break;
- if (code < 0 || n < sizeof(buf)) {
- /* The interface can't pass an error. */
- break;
- }
+ uint n;
+ int code = sgets(&sstr, buf, sizeof(buf), &n);
+
+ if (n > 0) {
+ s_arcfour_process_buffer(&sarc4, buf, n);
+ stream_write(&sout, buf, n);
+ }
+ if (code == EOFC)
+ break;
+ if (code < 0 || n < sizeof(buf)) {
+ /* The interface can't pass an error. */
+ break;
+ }
}
sclose(&sout); /* Writes ')'. */
return stell(&sinp) + 1;
@@ -1929,56 +1919,56 @@ static int
pdf_put_encoded_string(const gx_device_pdf *pdev, const byte *str, uint size, gs_id object_id)
{
if (!pdev->KeyLength || object_id == (gs_id)-1) {
- stream_write(pdev->strm, str, size);
- return 0;
+ stream_write(pdev->strm, str, size);
+ return 0;
} else
- return pdf_encrypt_encoded_string(pdev, str, size, object_id);
+ return pdf_encrypt_encoded_string(pdev, str, size, object_id);
}
/* Write an encoded string with possible encryption. */
static int
pdf_put_encoded_string_as_hex(const gx_device_pdf *pdev, const byte *str, uint size, gs_id object_id)
{
if (!pdev->KeyLength || object_id == (gs_id)-1) {
- int i, oct, width = 0;
- char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
- if (pdev->ForOPDFRead && pdev->ProduceDSC)
- stream_write(pdev->strm, "\n", 1);
- stream_write(pdev->strm, "<", 1);
- width++;
- for (i = 1; i < size - 1; i++) {
- if (str[i] == '\\') {
- if (str[i + 1] >= '0' && str[i + 1] <= '9') {
- oct = (str[i+1] - 0x30) * 64;
- oct += (str[i+2] - 0x30) *8;
- oct += str[i+3] - 0x30;
- i+=3;
- } else {
- oct = str[++i];
- }
- if (width > 252 && pdev->ForOPDFRead && pdev->ProduceDSC) {
- stream_write(pdev->strm, "\n", 1);
- width = 0;
- }
- stream_write(pdev->strm, &hex[(oct & 0xf0) >> 4], 1);
- stream_write(pdev->strm, &hex[oct & 0x0f], 1);
- width += 2;
- } else {
- if (width > 252 && pdev->ForOPDFRead && pdev->ProduceDSC) {
- stream_write(pdev->strm, "\n", 1);
- width = 0;
- }
- stream_write(pdev->strm, &hex[(str[i] & 0xf0) >> 4], 1);
- stream_write(pdev->strm, &hex[str[i] & 0x0f], 1);
- width += 2;
- }
- }
- stream_write(pdev->strm, ">", 1);
- if (pdev->ForOPDFRead && pdev->ProduceDSC)
- stream_write(pdev->strm, "\n", 1);
+ int i, oct, width = 0;
+ char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+
+ if (pdev->ForOPDFRead && pdev->ProduceDSC)
+ stream_write(pdev->strm, "\n", 1);
+ stream_write(pdev->strm, "<", 1);
+ width++;
+ for (i = 1; i < size - 1; i++) {
+ if (str[i] == '\\') {
+ if (str[i + 1] >= '0' && str[i + 1] <= '9') {
+ oct = (str[i+1] - 0x30) * 64;
+ oct += (str[i+2] - 0x30) *8;
+ oct += str[i+3] - 0x30;
+ i+=3;
+ } else {
+ oct = str[++i];
+ }
+ if (width > 252 && pdev->ForOPDFRead && pdev->ProduceDSC) {
+ stream_write(pdev->strm, "\n", 1);
+ width = 0;
+ }
+ stream_write(pdev->strm, &hex[(oct & 0xf0) >> 4], 1);
+ stream_write(pdev->strm, &hex[oct & 0x0f], 1);
+ width += 2;
+ } else {
+ if (width > 252 && pdev->ForOPDFRead && pdev->ProduceDSC) {
+ stream_write(pdev->strm, "\n", 1);
+ width = 0;
+ }
+ stream_write(pdev->strm, &hex[(str[i] & 0xf0) >> 4], 1);
+ stream_write(pdev->strm, &hex[str[i] & 0x0f], 1);
+ width += 2;
+ }
+ }
+ stream_write(pdev->strm, ">", 1);
+ if (pdev->ForOPDFRead && pdev->ProduceDSC)
+ stream_write(pdev->strm, "\n", 1);
return 0;
} else
- return pdf_encrypt_encoded_string(pdev, str, size, object_id);
+ return pdf_encrypt_encoded_string(pdev, str, size, object_id);
}
/* Write an encoded hexadecimal string with possible encryption. */
@@ -2001,16 +1991,16 @@ static int
pdf_scan_item(const gx_device_pdf * pdev, const byte * p, uint l, gs_id object_id)
{
const byte *q = p;
- int n = l;
+ int n = l;
if (*q == ' ' || *q == 't' || *q == '\r' || *q == '\n')
- return (l > 0 ? 1 : 0);
+ return (l > 0 ? 1 : 0);
for (q++, n--; n; q++, n--) {
- if (*q == ' ' || *q == 't' || *q == '\r' || *q == '\n')
- return q - p;
- if (*q == '/' || *q == '[' || *q == ']' || *q == '{' || *q == '}' || *q == '(' || *q == '<')
- return q - p;
- /* Note : immediate names are not allowed in PDF. */
+ if (*q == ' ' || *q == 't' || *q == '\r' || *q == '\n')
+ return q - p;
+ if (*q == '/' || *q == '[' || *q == ']' || *q == '{' || *q == '}' || *q == '(' || *q == '<')
+ return q - p;
+ /* Note : immediate names are not allowed in PDF. */
}
return l;
}
@@ -2020,61 +2010,61 @@ static int
pdf_put_composite(const gx_device_pdf * pdev, const byte * vstr, uint size, gs_id object_id)
{
if (!pdev->KeyLength || object_id == (gs_id)-1) {
- if (pdev->ForOPDFRead && pdev->ProduceDSC) {
- stream_putc(pdev->strm, (byte)'\n');
- if (size > 255) {
- const byte *start, *p, *end, *save;
- int width = 0;
-
- end = vstr + size;
- start = p = vstr;
- while (p < end) {
- if(*p == '\r' || *p == '\n') {
- width = 0;
- p++;
- continue;
- }
- if (width > 254) {
- save = p;
- /* search backwards for a point to split */
- while (p > start) {
- if (*p == '/' || *p == '[' || *p == '{' || *p == '(' || *p == ' ') {
- stream_write(pdev->strm, start, p - start);
- stream_putc(pdev->strm, (byte)'\n');
- start = p;
- }
- else p--;
- }
- if (p == start) {
- stream_write(pdev->strm, start, save - start);
- stream_putc(pdev->strm, (byte)'\n');
- start = save;
- }
- } else {
- width++;
- p++;
- }
- }
- } else {
- stream_write(pdev->strm, vstr, size);
- }
- } else {
- stream_write(pdev->strm, vstr, size);
- }
+ if (pdev->ForOPDFRead && pdev->ProduceDSC) {
+ stream_putc(pdev->strm, (byte)'\n');
+ if (size > 255) {
+ const byte *start, *p, *end, *save;
+ int width = 0;
+
+ end = vstr + size;
+ start = p = vstr;
+ while (p < end) {
+ if(*p == '\r' || *p == '\n') {
+ width = 0;
+ p++;
+ continue;
+ }
+ if (width > 254) {
+ save = p;
+ /* search backwards for a point to split */
+ while (p > start) {
+ if (*p == '/' || *p == '[' || *p == '{' || *p == '(' || *p == ' ') {
+ stream_write(pdev->strm, start, p - start);
+ stream_putc(pdev->strm, (byte)'\n');
+ start = p;
+ }
+ else p--;
+ }
+ if (p == start) {
+ stream_write(pdev->strm, start, save - start);
+ stream_putc(pdev->strm, (byte)'\n');
+ start = save;
+ }
+ } else {
+ width++;
+ p++;
+ }
+ }
+ } else {
+ stream_write(pdev->strm, vstr, size);
+ }
+ } else {
+ stream_write(pdev->strm, vstr, size);
+ }
} else {
- const byte *p = vstr;
- int l = size, n;
-
- for (;l > 0 ;) {
- if (*p == '(')
- n = pdf_encrypt_encoded_string(pdev, p, l, object_id);
- else {
- n = pdf_scan_item(pdev, p, l, object_id);
- stream_write(pdev->strm, p, n);
- }
- l -= n;
- p += n;
- }
+ const byte *p = vstr;
+ int l = size, n;
+
+ for (;l > 0 ;) {
+ if (*p == '(')
+ n = pdf_encrypt_encoded_string(pdev, p, l, object_id);
+ else {
+ n = pdf_scan_item(pdev, p, l, object_id);
+ stream_write(pdev->strm, p, n);
+ }
+ l -= n;
+ p += n;
+ }
}
return 0;
}
@@ -2088,7 +2078,7 @@ int
pdf_put_string(const gx_device_pdf * pdev, const byte * str, uint size)
{
psdf_write_string(pdev->strm, str, size,
- (pdev->binary_ok ? PRINT_BINARY_OK : 0));
+ (pdev->binary_ok ? PRINT_BINARY_OK : 0));
return 0;
}
@@ -2097,21 +2087,21 @@ int
pdf_write_value(const gx_device_pdf * pdev, const byte * vstr, uint size, gs_id object_id)
{
if (size > 0 && vstr[0] == '/')
- return pdf_put_name(pdev, vstr + 1, size - 1);
+ return pdf_put_name(pdev, vstr + 1, size - 1);
else if (size > 3 && vstr[0] == 0 && vstr[1] == 0 && vstr[size - 1] == 0)
- return pdf_put_name(pdev, vstr + 3, size - 4);
+ return pdf_put_name(pdev, vstr + 3, size - 4);
else if (size > 1 && (vstr[0] == '[' || vstr[0] == '{'))
- return pdf_put_composite(pdev, vstr, size, object_id);
+ return pdf_put_composite(pdev, vstr, size, object_id);
else if (size > 2 && vstr[0] == '<' && vstr[1] == '<')
- return pdf_put_composite(pdev, vstr, size, object_id);
+ return pdf_put_composite(pdev, vstr, size, object_id);
else if (size > 1 && vstr[0] == '(') {
- if (pdev->ForOPDFRead)
- return pdf_put_encoded_string_as_hex(pdev, vstr, size, object_id);
- else
- return pdf_put_encoded_string(pdev, vstr, size, object_id);
+ if (pdev->ForOPDFRead)
+ return pdf_put_encoded_string_as_hex(pdev, vstr, size, object_id);
+ else
+ return pdf_put_encoded_string(pdev, vstr, size, object_id);
}
else if (size > 1 && vstr[0] == '<')
- return pdf_put_encoded_hex_string(pdev, vstr, size, object_id);
+ return pdf_put_encoded_hex_string(pdev, vstr, size, object_id);
stream_write(pdev->strm, vstr, size);
return 0;
}
@@ -2120,7 +2110,7 @@ pdf_write_value(const gx_device_pdf * pdev, const byte * vstr, uint size, gs_id
/* Currently this only saves parameters for CCITTFaxDecode. */
int
pdf_put_filters(cos_dict_t *pcd, gx_device_pdf *pdev, stream *s,
- const pdf_filter_names_t *pfn)
+ const pdf_filter_names_t *pfn)
{
const char *filter_name = 0;
bool binary_ok = true;
@@ -2129,98 +2119,98 @@ pdf_put_filters(cos_dict_t *pcd, gx_device_pdf *pdev, stream *s,
int code;
for (; fs != 0; fs = fs->strm) {
- const stream_state *st = fs->state;
- const stream_template *template = st->template;
+ const stream_state *st = fs->state;
+ const stream_template *template = st->template;
#define TEMPLATE_IS(atemp)\
(template->process == (atemp).process)
- if (TEMPLATE_IS(s_A85E_template))
- binary_ok = false;
- else if (TEMPLATE_IS(s_CFE_template)) {
- cos_param_list_writer_t writer;
- stream_CF_state cfs;
-
- decode_parms =
- cos_dict_alloc(pdev, "pdf_put_image_filters(decode_parms)");
- if (decode_parms == 0)
- return_error(gs_error_VMerror);
- CHECK(cos_param_list_writer_init(&writer, decode_parms, 0));
- /*
- * If EndOfBlock is true, we mustn't write a Rows value.
- * This is a hack....
- */
- cfs = *(const stream_CF_state *)st;
- if (cfs.EndOfBlock)
- cfs.Rows = 0;
- CHECK(s_CF_get_params((gs_param_list *)&writer, &cfs, false));
- filter_name = pfn->CCITTFaxDecode;
- } else if (TEMPLATE_IS(s_DCTE_template))
- filter_name = pfn->DCTDecode;
- else if (TEMPLATE_IS(s_zlibE_template))
- filter_name = pfn->FlateDecode;
- else if (TEMPLATE_IS(s_LZWE_template))
- filter_name = pfn->LZWDecode;
+ if (TEMPLATE_IS(s_A85E_template))
+ binary_ok = false;
+ else if (TEMPLATE_IS(s_CFE_template)) {
+ cos_param_list_writer_t writer;
+ stream_CF_state cfs;
+
+ decode_parms =
+ cos_dict_alloc(pdev, "pdf_put_image_filters(decode_parms)");
+ if (decode_parms == 0)
+ return_error(gs_error_VMerror);
+ CHECK(cos_param_list_writer_init(&writer, decode_parms, 0));
+ /*
+ * If EndOfBlock is true, we mustn't write a Rows value.
+ * This is a hack....
+ */
+ cfs = *(const stream_CF_state *)st;
+ if (cfs.EndOfBlock)
+ cfs.Rows = 0;
+ CHECK(s_CF_get_params((gs_param_list *)&writer, &cfs, false));
+ filter_name = pfn->CCITTFaxDecode;
+ } else if (TEMPLATE_IS(s_DCTE_template))
+ filter_name = pfn->DCTDecode;
+ else if (TEMPLATE_IS(s_zlibE_template))
+ filter_name = pfn->FlateDecode;
+ else if (TEMPLATE_IS(s_LZWE_template))
+ filter_name = pfn->LZWDecode;
#ifdef USE_LDF_JB2
- else if (TEMPLATE_IS(s_jbig2encode_template))
- filter_name = pfn->JBIG2Decode;
+ else if (TEMPLATE_IS(s_jbig2encode_template))
+ filter_name = pfn->JBIG2Decode;
#endif
#ifdef USE_LWF_JP2
- else if (TEMPLATE_IS(s_jpxe_template))
- filter_name = pfn->JPXDecode;
+ else if (TEMPLATE_IS(s_jpxe_template))
+ filter_name = pfn->JPXDecode;
#endif
- else if (TEMPLATE_IS(s_PNGPE_template)) {
- /* This is a predictor for FlateDecode or LZWEncode. */
- const stream_PNGP_state *const ss =
- (const stream_PNGP_state *)st;
-
- decode_parms =
- cos_dict_alloc(pdev, "pdf_put_image_filters(decode_parms)");
- if (decode_parms == 0)
- return_error(gs_error_VMerror);
- CHECK(cos_dict_put_c_key_int(decode_parms, "/Predictor",
- ss->Predictor));
- CHECK(cos_dict_put_c_key_int(decode_parms, "/Columns",
- ss->Columns));
- if (ss->Colors != 1)
- CHECK(cos_dict_put_c_key_int(decode_parms, "/Colors",
- ss->Colors));
- if (ss->BitsPerComponent != 8)
- CHECK(cos_dict_put_c_key_int(decode_parms,
- "/BitsPerComponent",
- ss->BitsPerComponent));
- } else if (TEMPLATE_IS(s_RLE_template))
- filter_name = pfn->RunLengthDecode;
+ else if (TEMPLATE_IS(s_PNGPE_template)) {
+ /* This is a predictor for FlateDecode or LZWEncode. */
+ const stream_PNGP_state *const ss =
+ (const stream_PNGP_state *)st;
+
+ decode_parms =
+ cos_dict_alloc(pdev, "pdf_put_image_filters(decode_parms)");
+ if (decode_parms == 0)
+ return_error(gs_error_VMerror);
+ CHECK(cos_dict_put_c_key_int(decode_parms, "/Predictor",
+ ss->Predictor));
+ CHECK(cos_dict_put_c_key_int(decode_parms, "/Columns",
+ ss->Columns));
+ if (ss->Colors != 1)
+ CHECK(cos_dict_put_c_key_int(decode_parms, "/Colors",
+ ss->Colors));
+ if (ss->BitsPerComponent != 8)
+ CHECK(cos_dict_put_c_key_int(decode_parms,
+ "/BitsPerComponent",
+ ss->BitsPerComponent));
+ } else if (TEMPLATE_IS(s_RLE_template))
+ filter_name = pfn->RunLengthDecode;
#undef TEMPLATE_IS
}
if (filter_name) {
- if (binary_ok) {
- CHECK(cos_dict_put_c_strings(pcd, pfn->Filter, filter_name));
- if (decode_parms)
- CHECK(cos_dict_put_c_key_object(pcd, pfn->DecodeParms,
- COS_OBJECT(decode_parms)));
- } else {
- cos_array_t *pca =
- cos_array_alloc(pdev, "pdf_put_image_filters(Filters)");
-
- if (pca == 0)
- return_error(gs_error_VMerror);
- CHECK(cos_array_add_c_string(pca, pfn->ASCII85Decode));
- CHECK(cos_array_add_c_string(pca, filter_name));
- CHECK(cos_dict_put_c_key_object(pcd, pfn->Filter,
- COS_OBJECT(pca)));
- if (decode_parms) {
- pca = cos_array_alloc(pdev,
- "pdf_put_image_filters(DecodeParms)");
- if (pca == 0)
- return_error(gs_error_VMerror);
- CHECK(cos_array_add_c_string(pca, "null"));
- CHECK(cos_array_add_object(pca, COS_OBJECT(decode_parms)));
- CHECK(cos_dict_put_c_key_object(pcd, pfn->DecodeParms,
- COS_OBJECT(pca)));
- }
- }
+ if (binary_ok) {
+ CHECK(cos_dict_put_c_strings(pcd, pfn->Filter, filter_name));
+ if (decode_parms)
+ CHECK(cos_dict_put_c_key_object(pcd, pfn->DecodeParms,
+ COS_OBJECT(decode_parms)));
+ } else {
+ cos_array_t *pca =
+ cos_array_alloc(pdev, "pdf_put_image_filters(Filters)");
+
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ CHECK(cos_array_add_c_string(pca, pfn->ASCII85Decode));
+ CHECK(cos_array_add_c_string(pca, filter_name));
+ CHECK(cos_dict_put_c_key_object(pcd, pfn->Filter,
+ COS_OBJECT(pca)));
+ if (decode_parms) {
+ pca = cos_array_alloc(pdev,
+ "pdf_put_image_filters(DecodeParms)");
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ CHECK(cos_array_add_c_string(pca, "null"));
+ CHECK(cos_array_add_object(pca, COS_OBJECT(decode_parms)));
+ CHECK(cos_dict_put_c_key_object(pcd, pfn->DecodeParms,
+ COS_OBJECT(pca)));
+ }
+ }
} else if (!binary_ok)
- CHECK(cos_dict_put_c_strings(pcd, pfn->Filter, pfn->ASCII85Decode));
+ CHECK(cos_dict_put_c_strings(pcd, pfn->Filter, pfn->ASCII85Decode));
return 0;
}
@@ -2228,15 +2218,15 @@ pdf_put_filters(cos_dict_t *pcd, gx_device_pdf *pdev, stream *s,
static int
pdf_flate_binary(gx_device_pdf *pdev, psdf_binary_writer *pbw)
{
- const stream_template *template = (pdev->CompatibilityLevel < 1.3 ?
- &s_LZWE_template : &s_zlibE_template);
+ const stream_template *template = (pdev->CompatibilityLevel < 1.3 ?
+ &s_LZWE_template : &s_zlibE_template);
stream_state *st = s_alloc_state(pdev->pdf_memory, template->stype,
- "pdf_write_function");
+ "pdf_write_function");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (template->set_defaults)
- template->set_defaults(st);
+ template->set_defaults(st);
return psdf_encode_binary(pbw, template, st);
}
@@ -2248,68 +2238,68 @@ int
pdf_begin_data(gx_device_pdf *pdev, pdf_data_writer_t *pdw)
{
return pdf_begin_data_stream(pdev, pdw,
- DATA_STREAM_BINARY | DATA_STREAM_COMPRESS, 0);
+ DATA_STREAM_BINARY | DATA_STREAM_COMPRESS, 0);
}
int
pdf_append_data_stream_filters(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
- int orig_options, gs_id object_id)
+ int orig_options, gs_id object_id)
{
stream *s = pdev->strm;
int options = orig_options;
#define USE_ASCII85 1
#define USE_FLATE 2
static const char *const fnames[4] = {
- "", "/Filter/ASCII85Decode", "/Filter/FlateDecode",
- "/Filter[/ASCII85Decode/FlateDecode]"
+ "", "/Filter/ASCII85Decode", "/Filter/FlateDecode",
+ "/Filter[/ASCII85Decode/FlateDecode]"
};
static const char *const fnames1_2[4] = {
- "", "/Filter/ASCII85Decode", "/Filter/LZWDecode",
- "/Filter[/ASCII85Decode/LZWDecode]"
+ "", "/Filter/ASCII85Decode", "/Filter/LZWDecode",
+ "/Filter[/ASCII85Decode/LZWDecode]"
};
int filters = 0;
int code;
if (options & DATA_STREAM_COMPRESS) {
- filters |= USE_FLATE;
- options |= DATA_STREAM_BINARY;
+ filters |= USE_FLATE;
+ options |= DATA_STREAM_BINARY;
}
if ((options & DATA_STREAM_BINARY) && !pdev->binary_ok)
- filters |= USE_ASCII85;
+ filters |= USE_ASCII85;
if (!(options & DATA_STREAM_NOLENGTH)) {
- stream_puts(s, (pdev->CompatibilityLevel < 1.3 ?
- fnames1_2[filters] : fnames[filters]));
- if (pdev->ResourcesBeforeUsage) {
- pdw->length_pos = stell(s) + 8;
- stream_puts(s, "/Length >>stream\n");
- pdw->length_id = -1;
- } else {
- pdw->length_pos = -1;
- pdw->length_id = pdf_obj_ref(pdev);
- pprintld1(s, "/Length %ld 0 R>>stream\n", pdw->length_id);
- }
+ stream_puts(s, (pdev->CompatibilityLevel < 1.3 ?
+ fnames1_2[filters] : fnames[filters]));
+ if (pdev->ResourcesBeforeUsage) {
+ pdw->length_pos = stell(s) + 8;
+ stream_puts(s, "/Length >>stream\n");
+ pdw->length_id = -1;
+ } else {
+ pdw->length_pos = -1;
+ pdw->length_id = pdf_obj_ref(pdev);
+ pprintld1(s, "/Length %ld 0 R>>stream\n", pdw->length_id);
+ }
}
if (options & DATA_STREAM_ENCRYPT) {
- code = pdf_begin_encrypt(pdev, &s, object_id);
- if (code < 0)
- return code;
- pdev->strm = s;
- pdw->encrypted = true;
+ code = pdf_begin_encrypt(pdev, &s, object_id);
+ if (code < 0)
+ return code;
+ pdev->strm = s;
+ pdw->encrypted = true;
} else
- pdw->encrypted = false;
+ pdw->encrypted = false;
if (options & DATA_STREAM_BINARY) {
- code = psdf_begin_binary((gx_device_psdf *)pdev, &pdw->binary);
- if (code < 0)
- return code;
+ code = psdf_begin_binary((gx_device_psdf *)pdev, &pdw->binary);
+ if (code < 0)
+ return code;
} else {
- code = 0;
- pdw->binary.target = pdev->strm;
- pdw->binary.dev = (gx_device_psdf *)pdev;
- pdw->binary.strm = pdev->strm;
+ code = 0;
+ pdw->binary.target = pdev->strm;
+ pdw->binary.dev = (gx_device_psdf *)pdev;
+ pdw->binary.strm = pdev->strm;
}
pdw->start = stell(s);
if (filters & USE_FLATE)
- code = pdf_flate_binary(pdev, &pdw->binary);
+ code = pdf_flate_binary(pdev, &pdw->binary);
return code;
#undef USE_ASCII85
#undef USE_FLATE
@@ -2317,7 +2307,7 @@ pdf_append_data_stream_filters(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
int
pdf_begin_data_stream(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
- int options, gs_id object_id)
+ int options, gs_id object_id)
{ int code;
/* object_id is an unused rudiment from the old code,
when the encription was applied when creating the stream.
@@ -2326,10 +2316,10 @@ pdf_begin_data_stream(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
pdw->binary.target = pdev->strm;
pdw->binary.dev = (gx_device_psdf *)pdev;
pdw->binary.strm = 0; /* for GC in case of failure */
- code = pdf_open_aside(pdev, resourceNone, gs_no_id, &pdw->pres, !object_id,
- options);
+ code = pdf_open_aside(pdev, resourceNone, gs_no_id, &pdw->pres, !object_id,
+ options);
if (object_id != 0)
- pdf_reserve_object_id(pdev, pdw->pres, object_id);
+ pdf_reserve_object_id(pdev, pdw->pres, object_id);
pdw->binary.strm = pdev->strm;
return code;
}
@@ -2341,57 +2331,57 @@ pdf_end_data(pdf_data_writer_t *pdw)
code = pdf_close_aside(pdw->pdev);
if (code < 0)
- return code;
+ return code;
code = COS_WRITE_OBJECT(pdw->pres->object, pdw->pdev, resourceNone);
if (code < 0)
- return code;
+ return code;
return 0;
}
/* Create a Function object. */
static int pdf_function_array(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_function_info_t *pinfo);
+ const gs_function_info_t *pinfo);
int
pdf_function_scaled(gx_device_pdf *pdev, const gs_function_t *pfn,
- const gs_range_t *pranges, cos_value_t *pvalue)
+ const gs_range_t *pranges, cos_value_t *pvalue)
{
if (pranges == NULL)
- return pdf_function(pdev, pfn, pvalue);
+ return pdf_function(pdev, pfn, pvalue);
{
- /*
- * Create a temporary scaled function. Note that the ranges
- * represent the inverse scaling from what gs_function_make_scaled
- * expects.
- */
- gs_memory_t *mem = pdev->pdf_memory;
- gs_function_t *psfn;
- gs_range_t *ranges = (gs_range_t *)
- gs_alloc_byte_array(mem, pfn->params.n, sizeof(gs_range_t),
- "pdf_function_scaled");
- int i, code;
-
- if (ranges == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < pfn->params.n; ++i) {
- double rbase = pranges[i].rmin;
- double rdiff = pranges[i].rmax - rbase;
- double invbase = -rbase / rdiff;
-
- ranges[i].rmin = invbase;
- ranges[i].rmax = invbase + 1.0 / rdiff;
- }
- code = gs_function_make_scaled(pfn, &psfn, ranges, mem);
- if (code >= 0) {
- code = pdf_function(pdev, psfn, pvalue);
- gs_function_free(psfn, true, mem);
- }
- gs_free_object(mem, ranges, "pdf_function_scaled");
- return code;
+ /*
+ * Create a temporary scaled function. Note that the ranges
+ * represent the inverse scaling from what gs_function_make_scaled
+ * expects.
+ */
+ gs_memory_t *mem = pdev->pdf_memory;
+ gs_function_t *psfn;
+ gs_range_t *ranges = (gs_range_t *)
+ gs_alloc_byte_array(mem, pfn->params.n, sizeof(gs_range_t),
+ "pdf_function_scaled");
+ int i, code;
+
+ if (ranges == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < pfn->params.n; ++i) {
+ double rbase = pranges[i].rmin;
+ double rdiff = pranges[i].rmax - rbase;
+ double invbase = -rbase / rdiff;
+
+ ranges[i].rmin = invbase;
+ ranges[i].rmax = invbase + 1.0 / rdiff;
+ }
+ code = gs_function_make_scaled(pfn, &psfn, ranges, mem);
+ if (code >= 0) {
+ code = pdf_function(pdev, psfn, pvalue);
+ gs_function_free(psfn, true, mem);
+ }
+ gs_free_object(mem, ranges, "pdf_function_scaled");
+ return code;
}
}
static int
pdf_function_aux(gx_device_pdf *pdev, const gs_function_t *pfn,
- pdf_resource_t **ppres)
+ pdf_resource_t **ppres)
{
gs_function_info_t info;
cos_param_list_writer_t rlist;
@@ -2401,91 +2391,91 @@ pdf_function_aux(gx_device_pdf *pdev, const gs_function_t *pfn,
int code = pdf_alloc_resource(pdev, resourceFunction, gs_no_id, &pres, -1);
if (code < 0) {
- *ppres = 0;
- return code;
+ *ppres = 0;
+ return code;
}
*ppres = pres;
pcfn = pres->object;
gs_function_get_info(pfn, &info);
if (FunctionType(pfn) == function_type_ArrayedOutput) {
- /*
- * Arrayed Output Functions are used internally to represent
- * Shading Function entries that are arrays of Functions.
- * They require special handling.
- */
- cos_array_t *pca;
-
- cos_become(pcfn, cos_type_array);
- pca = (cos_array_t *)pcfn;
- return pdf_function_array(pdev, pca, &info);
+ /*
+ * Arrayed Output Functions are used internally to represent
+ * Shading Function entries that are arrays of Functions.
+ * They require special handling.
+ */
+ cos_array_t *pca;
+
+ cos_become(pcfn, cos_type_array);
+ pca = (cos_array_t *)pcfn;
+ return pdf_function_array(pdev, pca, &info);
}
if (info.DataSource != 0) {
- psdf_binary_writer writer;
- stream *save = pdev->strm;
- cos_stream_t *pcos;
- stream *s;
-
- cos_become(pcfn, cos_type_stream);
- pcos = (cos_stream_t *)pcfn;
- pcd = cos_stream_dict(pcos);
- s = cos_write_stream_alloc(pcos, pdev, "pdf_function");
- if (s == 0)
- return_error(gs_error_VMerror);
- pdev->strm = s;
- code = psdf_begin_binary((gx_device_psdf *)pdev, &writer);
- if (code >= 0 && info.data_size > 30 /* 30 is arbitrary */
- )
- code = pdf_flate_binary(pdev, &writer);
- if (code >= 0) {
- static const pdf_filter_names_t fnames = {
- PDF_FILTER_NAMES
- };
-
- code = pdf_put_filters(pcd, pdev, writer.strm, &fnames);
- }
- if (code >= 0) {
- byte buf[100]; /* arbitrary */
- ulong pos;
- uint count;
- const byte *ptr;
-
- for (pos = 0; pos < info.data_size; pos += count) {
- count = min(sizeof(buf), info.data_size - pos);
- data_source_access_only(info.DataSource, pos, count, buf,
- &ptr);
- stream_write(writer.strm, ptr, count);
- }
- code = psdf_end_binary(&writer);
- sclose(s);
- }
- pdev->strm = save;
- if (code < 0)
- return code;
+ psdf_binary_writer writer;
+ stream *save = pdev->strm;
+ cos_stream_t *pcos;
+ stream *s;
+
+ cos_become(pcfn, cos_type_stream);
+ pcos = (cos_stream_t *)pcfn;
+ pcd = cos_stream_dict(pcos);
+ s = cos_write_stream_alloc(pcos, pdev, "pdf_function");
+ if (s == 0)
+ return_error(gs_error_VMerror);
+ pdev->strm = s;
+ code = psdf_begin_binary((gx_device_psdf *)pdev, &writer);
+ if (code >= 0 && info.data_size > 30 /* 30 is arbitrary */
+ )
+ code = pdf_flate_binary(pdev, &writer);
+ if (code >= 0) {
+ static const pdf_filter_names_t fnames = {
+ PDF_FILTER_NAMES
+ };
+
+ code = pdf_put_filters(pcd, pdev, writer.strm, &fnames);
+ }
+ if (code >= 0) {
+ byte buf[100]; /* arbitrary */
+ ulong pos;
+ uint count;
+ const byte *ptr;
+
+ for (pos = 0; pos < info.data_size; pos += count) {
+ count = min(sizeof(buf), info.data_size - pos);
+ data_source_access_only(info.DataSource, pos, count, buf,
+ &ptr);
+ stream_write(writer.strm, ptr, count);
+ }
+ code = psdf_end_binary(&writer);
+ sclose(s);
+ }
+ pdev->strm = save;
+ if (code < 0)
+ return code;
} else {
- cos_become(pcfn, cos_type_dict);
- pcd = (cos_dict_t *)pcfn;
+ cos_become(pcfn, cos_type_dict);
+ pcd = (cos_dict_t *)pcfn;
}
if (info.Functions != 0) {
- cos_array_t *functions =
- cos_array_alloc(pdev, "pdf_function(Functions)");
- cos_value_t v;
-
- if (functions == 0)
- return_error(gs_error_VMerror);
- if ((code = pdf_function_array(pdev, functions, &info)) < 0 ||
- (code = cos_dict_put_c_key(pcd, "/Functions",
- COS_OBJECT_VALUE(&v, functions))) < 0
- ) {
- COS_FREE(functions, "pdf_function(Functions)");
- return code;
- }
+ cos_array_t *functions =
+ cos_array_alloc(pdev, "pdf_function(Functions)");
+ cos_value_t v;
+
+ if (functions == 0)
+ return_error(gs_error_VMerror);
+ if ((code = pdf_function_array(pdev, functions, &info)) < 0 ||
+ (code = cos_dict_put_c_key(pcd, "/Functions",
+ COS_OBJECT_VALUE(&v, functions))) < 0
+ ) {
+ COS_FREE(functions, "pdf_function(Functions)");
+ return code;
+ }
}
code = cos_param_list_writer_init(&rlist, pcd, PRINT_BINARY_OK);
if (code < 0)
- return code;
+ return code;
return gs_function_get_params(pfn, (gs_param_list *)&rlist);
}
-static int
+static int
functions_equal(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
{
return true;
@@ -2497,31 +2487,30 @@ pdf_function(gx_device_pdf *pdev, const gs_function_t *pfn, cos_value_t *pvalue)
int code = pdf_function_aux(pdev, pfn, &pres);
if (code < 0)
- return code;
+ return code;
code = pdf_substitute_resource(pdev, &pres, resourceFunction, functions_equal, false);
if (code < 0)
- return code;
+ return code;
pres->where_used |= pdev->used_mask;
COS_OBJECT_VALUE(pvalue, pres->object);
return 0;
}
static int pdf_function_array(gx_device_pdf *pdev, cos_array_t *pca,
- const gs_function_info_t *pinfo)
+ const gs_function_info_t *pinfo)
{
int i, code = 0;
cos_value_t v;
for (i = 0; i < pinfo->num_Functions; ++i) {
- if ((code = pdf_function(pdev, pinfo->Functions[i], &v)) < 0 ||
- (code = cos_array_add(pca, &v)) < 0
- ) {
- break;
- }
+ if ((code = pdf_function(pdev, pinfo->Functions[i], &v)) < 0 ||
+ (code = cos_array_add(pca, &v)) < 0
+ ) {
+ break;
+ }
}
return code;
}
-
/* Write a Function object. */
int
pdf_write_function(gx_device_pdf *pdev, const gs_function_t *pfn, long *pid)
@@ -2530,7 +2519,7 @@ pdf_write_function(gx_device_pdf *pdev, const gs_function_t *pfn, long *pid)
int code = pdf_function(pdev, pfn, &value);
if (code < 0)
- return code;
+ return code;
*pid = value.contents.object->id;
return 0;
}
@@ -2545,12 +2534,12 @@ pdf_write_font_bbox(gx_device_pdf *pdev, const gs_int_rect *pbox)
* happens when the font contains only space characters.
* Small bbox causes AR 4 to display a hairline. So we use
* the full BBox.
- */
+ */
int x = pbox->q.x + ((pbox->p.x == pbox->q.x) ? 1000 : 0);
int y = pbox->q.y + ((pbox->p.y == pbox->q.y) ? 1000 : 0);
pprintd4(s, "/FontBBox[%d %d %d %d]",
- pbox->p.x, pbox->p.y, x, y);
+ pbox->p.x, pbox->p.y, x, y);
return 0;
}
@@ -2564,11 +2553,11 @@ pdf_write_font_bbox_float(gx_device_pdf *pdev, const gs_rect *pbox)
* happens when the font contains only space characters.
* Small bbox causes AR 4 to display a hairline. So we use
* the full BBox.
- */
+ */
float x = pbox->q.x + ((pbox->p.x == pbox->q.x) ? 1000 : 0);
float y = pbox->q.y + ((pbox->p.y == pbox->q.y) ? 1000 : 0);
pprintg4(s, "/FontBBox[%g %g %g %g]",
- pbox->p.x, pbox->p.y, x, y);
+ pbox->p.x, pbox->p.y, x, y);
return 0;
}
diff --git a/gs/base/gdevpdfv.c b/gs/base/gdevpdfv.c
index 37143c99f..420802c55 100644
--- a/gs/base/gdevpdfv.c
+++ b/gs/base/gdevpdfv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -89,33 +89,33 @@ tile_size(const gx_strip_bitmap *tile, int depth)
}
static bool
tile_size_ok(const gx_device_pdf *pdev, const gx_color_tile *p_tile,
- const gx_color_tile *m_tile)
+ const gx_color_tile *m_tile)
{
/*
* Acrobat Reader can't handle image Patterns with more than
* 64K of data. :-(
*/
uint p_size =
- (p_tile == 0 ? 0 : tile_size(&p_tile->tbits, p_tile->depth));
+ (p_tile == 0 ? 0 : tile_size(&p_tile->tbits, p_tile->depth));
uint m_size =
- (m_tile == 0 ? 0 : tile_size(&m_tile->tmask, 1));
+ (m_tile == 0 ? 0 : tile_size(&m_tile->tmask, 1));
/* The image limit only applies to Acrobat versions less than 5
* (PDF 1.4).
*/
if (pdev->CompatibilityLevel < 1.4)
- return (max(p_size, m_size) <= 65500);
+ return (max(p_size, m_size) <= 65500);
else
- return 1;
+ return 1;
}
static int
pdf_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const gx_color_tile *p_tile, const gx_color_tile *m_tile,
- cos_stream_t *pcs_image, pdf_resource_t **ppres)
+ const gx_color_tile *p_tile, const gx_color_tile *m_tile,
+ cos_stream_t *pcs_image, pdf_resource_t **ppres)
{
pdf_resource_t *pres;
int code = pdf_alloc_resource(pdev, resourcePattern, pdc->mask.id, ppres,
- 0L);
+ 0L);
cos_stream_t *pcos;
cos_dict_t *pcd;
cos_dict_t *pcd_Resources = cos_dict_alloc(pdev, "pdf_pattern(Resources)");
@@ -126,21 +126,21 @@ pdf_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
gs_matrix smat;
if (code < 0)
- return code;
+ return code;
if (!tile_size_ok(pdev, p_tile, m_tile))
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
/*
* We currently can't handle Patterns whose X/Y step isn't parallel
* to the coordinate axes.
*/
if (is_xxyy(&tile->step_matrix))
- step.x = tile->step_matrix.xx, step.y = tile->step_matrix.yy;
+ step.x = tile->step_matrix.xx, step.y = tile->step_matrix.yy;
else if (is_xyyx(&tile->step_matrix))
- step.x = tile->step_matrix.yx, step.y = tile->step_matrix.xy;
+ step.x = tile->step_matrix.yx, step.y = tile->step_matrix.xy;
else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pcd_Resources == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gs_make_identity(&smat);
smat.xx = btile->rep_width / (pdev->HWResolution[0] / 72.0);
smat.yy = btile->rep_height / (pdev->HWResolution[1] / 72.0);
@@ -148,56 +148,56 @@ pdf_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
smat.ty = tile->step_matrix.ty / (pdev->HWResolution[1] / 72.0);
pres = *ppres;
{
- cos_dict_t *pcd_XObject = cos_dict_alloc(pdev, "pdf_pattern(XObject)");
- char key[MAX_REF_CHARS + 3];
- cos_value_t v;
-
- if (pcd_XObject == 0)
- return_error(gs_error_VMerror);
- sprintf(key, "/R%ld", pcs_image->id);
- COS_OBJECT_VALUE(&v, pcs_image);
- if ((code = cos_dict_put(pcd_XObject, (byte *)key, strlen(key), &v)) < 0 ||
- (code = cos_dict_put_c_key_object(pcd_Resources, "/XObject",
- COS_OBJECT(pcd_XObject))) < 0
- )
- return code;
+ cos_dict_t *pcd_XObject = cos_dict_alloc(pdev, "pdf_pattern(XObject)");
+ char key[MAX_REF_CHARS + 3];
+ cos_value_t v;
+
+ if (pcd_XObject == 0)
+ return_error(gs_error_VMerror);
+ sprintf(key, "/R%ld", pcs_image->id);
+ COS_OBJECT_VALUE(&v, pcs_image);
+ if ((code = cos_dict_put(pcd_XObject, (byte *)key, strlen(key), &v)) < 0 ||
+ (code = cos_dict_put_c_key_object(pcd_Resources, "/XObject",
+ COS_OBJECT(pcd_XObject))) < 0
+ )
+ return code;
}
if ((code = cos_dict_put_c_strings(pcd_Resources, "/ProcSet",
- (mask ? "[/PDF/ImageB]" :
- "[/PDF/ImageC]"))) < 0)
- return code;
+ (mask ? "[/PDF/ImageB]" :
+ "[/PDF/ImageC]"))) < 0)
+ return code;
cos_become(pres->object, cos_type_stream);
pcos = (cos_stream_t *)pres->object;
pcd = cos_stream_dict(pcos);
if ((code = cos_dict_put_c_key_int(pcd, "/PatternType", 1)) < 0 ||
- (code = cos_dict_put_c_key_int(pcd, "/PaintType",
- (mask ? 2 : 1))) < 0 ||
- (code = cos_dict_put_c_key_int(pcd, "/TilingType",
- tile->tiling_type)) < 0 ||
- (code = cos_dict_put_c_key_object(pcd, "/Resources",
- COS_OBJECT(pcd_Resources))) < 0 ||
- (code = cos_dict_put_c_strings(pcd, "/BBox", "[0 0 1 1]")) < 0 ||
- (code = cos_dict_put_matrix(pcd, "/Matrix", &smat)) < 0 ||
- (code = cos_dict_put_c_key_real(pcd, "/XStep", step.x / btile->rep_width)) < 0 ||
- (code = cos_dict_put_c_key_real(pcd, "/YStep", step.y / btile->rep_height)) < 0
- ) {
- return code;
+ (code = cos_dict_put_c_key_int(pcd, "/PaintType",
+ (mask ? 2 : 1))) < 0 ||
+ (code = cos_dict_put_c_key_int(pcd, "/TilingType",
+ tile->tiling_type)) < 0 ||
+ (code = cos_dict_put_c_key_object(pcd, "/Resources",
+ COS_OBJECT(pcd_Resources))) < 0 ||
+ (code = cos_dict_put_c_strings(pcd, "/BBox", "[0 0 1 1]")) < 0 ||
+ (code = cos_dict_put_matrix(pcd, "/Matrix", &smat)) < 0 ||
+ (code = cos_dict_put_c_key_real(pcd, "/XStep", step.x / btile->rep_width)) < 0 ||
+ (code = cos_dict_put_c_key_real(pcd, "/YStep", step.y / btile->rep_height)) < 0
+ ) {
+ return code;
}
{
- char buf[MAX_REF_CHARS + 6 + 1]; /* +6 for /R# Do\n */
+ char buf[MAX_REF_CHARS + 6 + 1]; /* +6 for /R# Do\n */
- sprintf(buf, "/R%ld Do\n", pcs_image->id);
- cos_stream_add_bytes(pcos, (const byte *)buf, strlen(buf));
+ sprintf(buf, "/R%ld Do\n", pcs_image->id);
+ cos_stream_add_bytes(pcos, (const byte *)buf, strlen(buf));
}
return 0;
}
/* Store pattern 1 parameters to cos dictionary. */
-int
-pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
- gs_pattern1_instance_t *pinst)
+int
+pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
+ gs_pattern1_instance_t *pinst)
{
gs_pattern1_template_t *t = &pinst->template;
gs_matrix smat2 = ctm_only((gs_imager_state *)pinst->saved), smat;
@@ -209,13 +209,13 @@ pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
int code;
if (pcd == NULL || pcd_Resources == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pdev->substream_Resources = pcd_Resources;
bbox[0] = t->BBox.p.x;
bbox[1] = t->BBox.p.y;
bbox[2] = t->BBox.q.x;
bbox[3] = t->BBox.q.y;
- /* The graphics library assumes a shifted origin to provide
+ /* The graphics library assumes a shifted origin to provide
positive bitmap pixel indices. Compensate it now. */
smat2.tx += pinst->step_matrix.tx;
smat2.ty += pinst->step_matrix.ty;
@@ -227,34 +227,34 @@ pdf_store_pattern1_params(gx_device_pdf *pdev, pdf_resource_t *pres,
* first form, and therefore we do *not* remove the resolution scaling.
*/
if (pdev->FormDepth <= 1) {
- gs_matrix scaled;
+ gs_matrix scaled;
- gs_make_scaling(1 / scale_x, 1 / scale_y, &scaled);
- gs_matrix_multiply(&smat2, &scaled, &smat);
+ gs_make_scaling(1 / scale_x, 1 / scale_y, &scaled);
+ gs_matrix_multiply(&smat2, &scaled, &smat);
} else {
- smat = smat2;
+ smat = smat2;
}
if (any_abs(smat.tx) < 0.0001) /* Noise. */
- smat.tx = 0;
+ smat.tx = 0;
if (any_abs(smat.ty) < 0.0001)
- smat.ty = 0;
+ smat.ty = 0;
code = cos_dict_put_c_strings(pcd, "/Type", "/Pattern");
if (code >= 0)
- code = cos_dict_put_c_key_int(pcd, "/PatternType", 1);
+ code = cos_dict_put_c_key_int(pcd, "/PatternType", 1);
if (code >= 0)
- code = cos_dict_put_c_key_int(pcd, "/PaintType", t->PaintType);
+ code = cos_dict_put_c_key_int(pcd, "/PaintType", t->PaintType);
if (code >= 0)
- code = cos_dict_put_c_key_int(pcd, "/TilingType", t->TilingType);
+ code = cos_dict_put_c_key_int(pcd, "/TilingType", t->TilingType);
if (code >= 0)
- code = cos_dict_put_c_key_floats(pcd, "/BBox", bbox, 4);
+ code = cos_dict_put_c_key_floats(pcd, "/BBox", bbox, 4);
if (code >= 0)
- code = cos_dict_put_matrix(pcd, "/Matrix", &smat);
+ code = cos_dict_put_matrix(pcd, "/Matrix", &smat);
if (code >= 0)
- code = cos_dict_put_c_key_real(pcd, "/XStep", t->XStep);
+ code = cos_dict_put_c_key_real(pcd, "/XStep", t->XStep);
if (code >= 0)
- code = cos_dict_put_c_key_real(pcd, "/YStep", t->YStep);
+ code = cos_dict_put_c_key_real(pcd, "/YStep", t->YStep);
if (code >= 0)
- code = cos_dict_put_c_key_object(pcd, "/Resources", COS_OBJECT(pcd_Resources));
+ code = cos_dict_put_c_key_object(pcd, "/Resources", COS_OBJECT(pcd_Resources));
pdev->skip_colors = (t->PaintType == 2);
return code;
}
@@ -270,7 +270,7 @@ pdf_set_pattern_image(gs_data_image_t *pic, const gx_strip_bitmap *tile)
/* Write the mask for a Pattern (colored or uncolored). */
static int
pdf_put_pattern_mask(gx_device_pdf *pdev, const gx_color_tile *m_tile,
- cos_stream_t **ppcs_mask)
+ cos_stream_t **ppcs_mask)
{
int w = m_tile->tmask.rep_width, h = m_tile->tmask.rep_height;
gs_image1_t image;
@@ -281,17 +281,17 @@ pdf_put_pattern_mask(gx_device_pdf *pdev, const gx_color_tile *m_tile,
pdf_set_pattern_image((gs_data_image_t *)&image, &m_tile->tmask);
pdf_image_writer_init(&writer);
if ((code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, false)) < 0 ||
- (pdev->params.MonoImage.Encode &&
- (code = psdf_CFE_binary(&writer.binary[0], w, h, true)) < 0) ||
- (code = pdf_begin_image_data(pdev, &writer, (const gs_pixel_image_t *)&image, NULL, 0)) < 0
- )
- return code;
+ (pdev->params.MonoImage.Encode &&
+ (code = psdf_CFE_binary(&writer.binary[0], w, h, true)) < 0) ||
+ (code = pdf_begin_image_data(pdev, &writer, (const gs_pixel_image_t *)&image, NULL, 0)) < 0
+ )
+ return code;
/* Pattern masks are specified in device coordinates, so invert Y. */
if ((code = pdf_copy_mask_bits(writer.binary[0].strm, m_tile->tmask.data + (h - 1) * m_tile->tmask.raster, 0, -m_tile->tmask.raster, w, h, 0)) < 0 ||
- (code = pdf_end_image_binary(pdev, &writer, h)) < 0 ||
- (code = pdf_end_write_image(pdev, &writer)) < 0
- )
- return code;
+ (code = pdf_end_image_binary(pdev, &writer, h)) < 0 ||
+ (code = pdf_end_write_image(pdev, &writer)) < 0
+ )
+ return code;
*ppcs_mask = (cos_stream_t *)writer.pres->object;
return 0;
}
@@ -299,68 +299,68 @@ pdf_put_pattern_mask(gx_device_pdf *pdev, const gx_color_tile *m_tile,
/* Write an uncolored Pattern color. */
int
pdf_put_uncolored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const gs_color_space *pcs,
- const psdf_set_color_commands_t *ppscc,
- bool have_pattern_streams, pdf_resource_t **ppres)
+ const gs_color_space *pcs,
+ const psdf_set_color_commands_t *ppscc,
+ bool have_pattern_streams, pdf_resource_t **ppres)
{
const gx_color_tile *m_tile = pdc->mask.m_tile;
gx_drawing_color dc_pure;
if (!have_pattern_streams && m_tile == 0) {
- /*
- * If m_tile == 0, this uncolored Pattern is all 1's,
- * equivalent to a pure color.
- */
- *ppres = 0;
- set_nonclient_dev_color(&dc_pure, gx_dc_pure_color(pdc));
- return psdf_set_color((gx_device_vector *)pdev, &dc_pure, ppscc);
+ /*
+ * If m_tile == 0, this uncolored Pattern is all 1's,
+ * equivalent to a pure color.
+ */
+ *ppres = 0;
+ set_nonclient_dev_color(&dc_pure, gx_dc_pure_color(pdc));
+ return psdf_set_color((gx_device_vector *)pdev, &dc_pure, ppscc);
} else {
- cos_value_t v;
- stream *s = pdev->strm;
- int code;
- cos_stream_t *pcs_image;
- static const psdf_set_color_commands_t no_scc = {0, 0, 0};
-
- if (!tile_size_ok(pdev, NULL, m_tile))
- return_error(gs_error_limitcheck);
- if (!have_pattern_streams) {
- if ((code = pdf_cs_Pattern_uncolored(pdev, &v)) < 0 ||
- (code = pdf_put_pattern_mask(pdev, m_tile, &pcs_image)) < 0 ||
- (code = pdf_pattern(pdev, pdc, NULL, m_tile, pcs_image, ppres)) < 0
- )
- return code;
- } else {
- code = pdf_cs_Pattern_uncolored_hl(pdev, pcs, &v);
- if (code < 0)
- return code;
- *ppres = pdf_find_resource_by_gs_id(pdev, resourcePattern, pdc->mask.id);
- *ppres = pdf_substitute_pattern(*ppres);
- if (!pdev->AR4_save_bug && pdev->CompatibilityLevel <= 1.3) {
- /* We reconnized AR4 behavior as reserving "q Q" stack elements
- * on demand. It looks as processing a pattern stream
- * with PaintType 1 AR4 replaces the topmost stack element
- * instead allocating a new one, if it was not previousely allocated.
- * AR 5 doesn't have this bug. Working around the AR4 bug here.
- */
- stream_puts(pdev->strm, "q q Q Q\n");
- pdev->AR4_save_bug = true;
- }
- (*ppres)->where_used |= pdev->used_mask;
- }
- cos_value_write(&v, pdev);
- pprints1(s, " %s ", ppscc->setcolorspace);
- if (have_pattern_streams)
- return 0;
- set_nonclient_dev_color(&dc_pure, gx_dc_pure_color(pdc));
- return psdf_set_color((gx_device_vector *)pdev, &dc_pure, &no_scc);
+ cos_value_t v;
+ stream *s = pdev->strm;
+ int code;
+ cos_stream_t *pcs_image;
+ static const psdf_set_color_commands_t no_scc = {0, 0, 0};
+
+ if (!tile_size_ok(pdev, NULL, m_tile))
+ return_error(gs_error_limitcheck);
+ if (!have_pattern_streams) {
+ if ((code = pdf_cs_Pattern_uncolored(pdev, &v)) < 0 ||
+ (code = pdf_put_pattern_mask(pdev, m_tile, &pcs_image)) < 0 ||
+ (code = pdf_pattern(pdev, pdc, NULL, m_tile, pcs_image, ppres)) < 0
+ )
+ return code;
+ } else {
+ code = pdf_cs_Pattern_uncolored_hl(pdev, pcs, &v);
+ if (code < 0)
+ return code;
+ *ppres = pdf_find_resource_by_gs_id(pdev, resourcePattern, pdc->mask.id);
+ *ppres = pdf_substitute_pattern(*ppres);
+ if (!pdev->AR4_save_bug && pdev->CompatibilityLevel <= 1.3) {
+ /* We reconnized AR4 behavior as reserving "q Q" stack elements
+ * on demand. It looks as processing a pattern stream
+ * with PaintType 1 AR4 replaces the topmost stack element
+ * instead allocating a new one, if it was not previousely allocated.
+ * AR 5 doesn't have this bug. Working around the AR4 bug here.
+ */
+ stream_puts(pdev->strm, "q q Q Q\n");
+ pdev->AR4_save_bug = true;
+ }
+ (*ppres)->where_used |= pdev->used_mask;
+ }
+ cos_value_write(&v, pdev);
+ pprints1(s, " %s ", ppscc->setcolorspace);
+ if (have_pattern_streams)
+ return 0;
+ set_nonclient_dev_color(&dc_pure, gx_dc_pure_color(pdc));
+ return psdf_set_color((gx_device_vector *)pdev, &dc_pure, &no_scc);
}
}
int
pdf_put_colored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const gs_color_space *pcs,
- const psdf_set_color_commands_t *ppscc,
- bool have_pattern_streams, pdf_resource_t **ppres)
+ const gs_color_space *pcs,
+ const psdf_set_color_commands_t *ppscc,
+ bool have_pattern_streams, pdf_resource_t **ppres)
{
const gx_color_tile *p_tile = pdc->colors.pattern.p_tile;
gs_color_space *pcs_Device;
@@ -373,119 +373,119 @@ pdf_put_colored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
int w = p_tile->tbits.rep_width, h = p_tile->tbits.rep_height;
if (!have_pattern_streams) {
- /*
- * NOTE: We assume here that the color space of the cached Pattern
- * is the same as the native color space of the device. This will
- * have to change in the future!
- */
- /*
- * Check whether this colored pattern is actually a masked pure color,
- * by testing whether all the colored pixels have the same color.
- */
- m_tile = pdc->mask.m_tile;
- if (m_tile) {
- if (p_tile && !(p_tile->depth & 7) && p_tile->depth <= arch_sizeof_color_index * 8) {
- int depth_bytes = p_tile->depth >> 3;
- int width = p_tile->tbits.rep_width;
- int skip = p_tile->tbits.raster -
- p_tile->tbits.rep_width * depth_bytes;
- const byte *bp;
- const byte *mp;
- int i, j, k;
- gx_color_index color = 0; /* init is arbitrary if not empty */
- bool first = true;
-
- for (i = 0, bp = p_tile->tbits.data, mp = p_tile->tmask.data;
- i < p_tile->tbits.rep_height;
- ++i, bp += skip, mp += p_tile->tmask.raster) {
-
- for (j = 0; j < width; ++j) {
- if (mp[j >> 3] & (0x80 >> (j & 7))) {
- gx_color_index ci = 0;
-
- for (k = 0; k < depth_bytes; ++k)
- ci = (ci << 8) + *bp++;
- if (first)
- color = ci, first = false;
- else if (ci != color)
- goto not_pure;
- } else
- bp += depth_bytes;
- }
- }
- {
- /* Set the color, then handle as an uncolored pattern. */
- gx_drawing_color dcolor;
-
- dcolor = *pdc;
- dcolor.colors.pure = color;
- return pdf_put_uncolored_pattern(pdev, &dcolor, pcs, ppscc,
- have_pattern_streams, ppres);
- }
- not_pure:
- DO_NOTHING; /* required by MSVC */
- }
- if (pdev->CompatibilityLevel < 1.3) {
- /* Masked images are only supported starting in PDF 1.3. */
- return_error(gs_error_rangecheck);
- }
- }
- /* Acrobat Reader has a size limit for image Patterns. */
- if (!tile_size_ok(pdev, p_tile, m_tile))
- return_error(gs_error_limitcheck);
+ /*
+ * NOTE: We assume here that the color space of the cached Pattern
+ * is the same as the native color space of the device. This will
+ * have to change in the future!
+ */
+ /*
+ * Check whether this colored pattern is actually a masked pure color,
+ * by testing whether all the colored pixels have the same color.
+ */
+ m_tile = pdc->mask.m_tile;
+ if (m_tile) {
+ if (p_tile && !(p_tile->depth & 7) && p_tile->depth <= arch_sizeof_color_index * 8) {
+ int depth_bytes = p_tile->depth >> 3;
+ int width = p_tile->tbits.rep_width;
+ int skip = p_tile->tbits.raster -
+ p_tile->tbits.rep_width * depth_bytes;
+ const byte *bp;
+ const byte *mp;
+ int i, j, k;
+ gx_color_index color = 0; /* init is arbitrary if not empty */
+ bool first = true;
+
+ for (i = 0, bp = p_tile->tbits.data, mp = p_tile->tmask.data;
+ i < p_tile->tbits.rep_height;
+ ++i, bp += skip, mp += p_tile->tmask.raster) {
+
+ for (j = 0; j < width; ++j) {
+ if (mp[j >> 3] & (0x80 >> (j & 7))) {
+ gx_color_index ci = 0;
+
+ for (k = 0; k < depth_bytes; ++k)
+ ci = (ci << 8) + *bp++;
+ if (first)
+ color = ci, first = false;
+ else if (ci != color)
+ goto not_pure;
+ } else
+ bp += depth_bytes;
+ }
+ }
+ {
+ /* Set the color, then handle as an uncolored pattern. */
+ gx_drawing_color dcolor;
+
+ dcolor = *pdc;
+ dcolor.colors.pure = color;
+ return pdf_put_uncolored_pattern(pdev, &dcolor, pcs, ppscc,
+ have_pattern_streams, ppres);
+ }
+ not_pure:
+ DO_NOTHING; /* required by MSVC */
+ }
+ if (pdev->CompatibilityLevel < 1.3) {
+ /* Masked images are only supported starting in PDF 1.3. */
+ return_error(gs_error_rangecheck);
+ }
+ }
+ /* Acrobat Reader has a size limit for image Patterns. */
+ if (!tile_size_ok(pdev, p_tile, m_tile))
+ return_error(gs_error_limitcheck);
}
code = pdf_cs_Pattern_colored(pdev, &v);
if (code < 0)
- return code;
+ return code;
pdf_cspace_init_Device(pdev->memory, &pcs_Device, pdev->color_info.num_components);
/*
* We don't have to worry about color space scaling: the color
* space is always a Device space.
*/
code = pdf_color_space_named(pdev, &cs_value, NULL, pcs_Device,
- &pdf_color_space_names, true, NULL, 0);
+ &pdf_color_space_names, true, NULL, 0);
if (code < 0)
- return code;
+ return code;
if (!have_pattern_streams) {
- cos_stream_t *pcs_mask = 0;
- cos_stream_t *pcs_image;
-
- gs_image_t_init_adjust(&image, pcs_Device, false);
- image.BitsPerComponent = 8;
- pdf_set_pattern_image((gs_data_image_t *)&image, &p_tile->tbits);
- if (m_tile) {
- if ((code = pdf_put_pattern_mask(pdev, m_tile, &pcs_mask)) < 0)
- return code;
- }
- pdf_image_writer_init(&writer);
- pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
- if ((code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, false)) < 0 ||
- (code = psdf_setup_lossless_filters((gx_device_psdf *)pdev,
- &writer.binary[0],
- (gs_pixel_image_t *)&image, false)) < 0 ||
- (code = pdf_begin_image_data(pdev, &writer, (const gs_pixel_image_t *)&image, &cs_value, 0)) < 0
- )
- return code;
- /* Pattern masks are specified in device coordinates, so invert Y. */
- if ((code = pdf_copy_color_bits(writer.binary[0].strm, p_tile->tbits.data + (h - 1) * p_tile->tbits.raster, 0, -p_tile->tbits.raster, w, h, pdev->color_info.depth >> 3)) < 0 ||
- (code = pdf_end_image_binary(pdev, &writer, h)) < 0
- )
- return code;
- pcs_image = (cos_stream_t *)writer.pres->object;
- if ((pcs_mask != 0 &&
- (code = cos_dict_put_c_key_object(cos_stream_dict(pcs_image), "/Mask",
- COS_OBJECT(pcs_mask))) < 0) ||
- (code = pdf_end_write_image(pdev, &writer)) < 0
- )
- return code;
- pcs_image = (cos_stream_t *)writer.pres->object; /* pdf_end_write_image may change it. */
- code = pdf_pattern(pdev, pdc, p_tile, m_tile, pcs_image, ppres);
- if (code < 0)
- return code;
+ cos_stream_t *pcs_mask = 0;
+ cos_stream_t *pcs_image;
+
+ gs_image_t_init_adjust(&image, pcs_Device, false);
+ image.BitsPerComponent = 8;
+ pdf_set_pattern_image((gs_data_image_t *)&image, &p_tile->tbits);
+ if (m_tile) {
+ if ((code = pdf_put_pattern_mask(pdev, m_tile, &pcs_mask)) < 0)
+ return code;
+ }
+ pdf_image_writer_init(&writer);
+ pdev->ParamCompatibilityLevel = pdev->CompatibilityLevel;
+ if ((code = pdf_begin_write_image(pdev, &writer, gs_no_id, w, h, NULL, false)) < 0 ||
+ (code = psdf_setup_lossless_filters((gx_device_psdf *)pdev,
+ &writer.binary[0],
+ (gs_pixel_image_t *)&image, false)) < 0 ||
+ (code = pdf_begin_image_data(pdev, &writer, (const gs_pixel_image_t *)&image, &cs_value, 0)) < 0
+ )
+ return code;
+ /* Pattern masks are specified in device coordinates, so invert Y. */
+ if ((code = pdf_copy_color_bits(writer.binary[0].strm, p_tile->tbits.data + (h - 1) * p_tile->tbits.raster, 0, -p_tile->tbits.raster, w, h, pdev->color_info.depth >> 3)) < 0 ||
+ (code = pdf_end_image_binary(pdev, &writer, h)) < 0
+ )
+ return code;
+ pcs_image = (cos_stream_t *)writer.pres->object;
+ if ((pcs_mask != 0 &&
+ (code = cos_dict_put_c_key_object(cos_stream_dict(pcs_image), "/Mask",
+ COS_OBJECT(pcs_mask))) < 0) ||
+ (code = pdf_end_write_image(pdev, &writer)) < 0
+ )
+ return code;
+ pcs_image = (cos_stream_t *)writer.pres->object; /* pdf_end_write_image may change it. */
+ code = pdf_pattern(pdev, pdc, p_tile, m_tile, pcs_image, ppres);
+ if (code < 0)
+ return code;
} else {
- *ppres = pdf_find_resource_by_gs_id(pdev, resourcePattern, p_tile->id);
- *ppres = pdf_substitute_pattern(*ppres);
- (*ppres)->where_used |= pdev->used_mask;
+ *ppres = pdf_find_resource_by_gs_id(pdev, resourcePattern, p_tile->id);
+ *ppres = pdf_substitute_pattern(*ppres);
+ (*ppres)->where_used |= pdev->used_mask;
}
/* pcs_Device will leak (picked up by GC in PS) on error, but we'll
tolerate that for now. */
@@ -495,13 +495,12 @@ pdf_put_colored_pattern(gx_device_pdf *pdev, const gx_drawing_color *pdc,
return 0;
}
-
/* ---------------- PatternType 2 colors ---------------- */
/* Write parameters common to all Shadings. */
static int
pdf_put_shading_common(cos_dict_t *pscd, const gs_shading_t *psh,
- bool shfill, const gs_range_t **ppranges)
+ bool shfill, const gs_range_t **ppranges)
{
gs_shading_type_t type = ShadingType(psh);
const gs_color_space *pcs = psh->params.ColorSpace;
@@ -509,31 +508,31 @@ pdf_put_shading_common(cos_dict_t *pscd, const gs_shading_t *psh,
cos_value_t cs_value;
if (code < 0 ||
- (psh->params.AntiAlias &&
- (code = cos_dict_put_c_strings(pscd, "/AntiAlias", "true")) < 0) ||
- (code = pdf_color_space_named(pscd->pdev, &cs_value, ppranges, pcs,
- &pdf_color_space_names, false, NULL, 0)) < 0 ||
- (code = cos_dict_put_c_key(pscd, "/ColorSpace", &cs_value)) < 0
- )
- return code;
+ (psh->params.AntiAlias &&
+ (code = cos_dict_put_c_strings(pscd, "/AntiAlias", "true")) < 0) ||
+ (code = pdf_color_space_named(pscd->pdev, &cs_value, ppranges, pcs,
+ &pdf_color_space_names, false, NULL, 0)) < 0 ||
+ (code = cos_dict_put_c_key(pscd, "/ColorSpace", &cs_value)) < 0
+ )
+ return code;
if (psh->params.Background && !shfill) {
- /****** SCALE Background ******/
- code = cos_dict_put_c_key_floats(pscd, "/Background",
- psh->params.Background->paint.values,
- gs_color_space_num_components(pcs));
- if (code < 0)
- return code;
+ /****** SCALE Background ******/
+ code = cos_dict_put_c_key_floats(pscd, "/Background",
+ psh->params.Background->paint.values,
+ gs_color_space_num_components(pcs));
+ if (code < 0)
+ return code;
}
if (psh->params.have_BBox) {
- float bbox[4];
-
- bbox[0] = psh->params.BBox.p.x;
- bbox[1] = psh->params.BBox.p.y;
- bbox[2] = psh->params.BBox.q.x;
- bbox[3] = psh->params.BBox.q.y;
- code = cos_dict_put_c_key_floats(pscd, "/BBox", bbox, 4);
- if (code < 0)
- return code;
+ float bbox[4];
+
+ bbox[0] = psh->params.BBox.p.x;
+ bbox[1] = psh->params.BBox.p.y;
+ bbox[2] = psh->params.BBox.q.x;
+ bbox[3] = psh->params.BBox.q.y;
+ code = cos_dict_put_c_key_floats(pscd, "/BBox", bbox, 4);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -541,15 +540,15 @@ pdf_put_shading_common(cos_dict_t *pscd, const gs_shading_t *psh,
/* Write an optional Function parameter. */
static int
pdf_put_shading_Function(cos_dict_t *pscd, const gs_function_t *pfn,
- const gs_range_t *pranges)
+ const gs_range_t *pranges)
{
int code = 0;
if (pfn != 0) {
- cos_value_t fn_value;
+ cos_value_t fn_value;
- if ((code = pdf_function_scaled(pscd->pdev, pfn, pranges, &fn_value)) >= 0)
- code = cos_dict_put_c_key(pscd, "/Function", &fn_value);
+ if ((code = pdf_function_scaled(pscd->pdev, pfn, pranges, &fn_value)) >= 0)
+ code = cos_dict_put_c_key(pscd, "/Function", &fn_value);
}
return code;
}
@@ -557,28 +556,28 @@ pdf_put_shading_Function(cos_dict_t *pscd, const gs_function_t *pfn,
/* Write a linear (Axial / Radial) Shading. */
static int
pdf_put_linear_shading(cos_dict_t *pscd, const float *Coords,
- int num_coords, const float *Domain /*[2]*/,
- const gs_function_t *Function,
- const bool *Extend /*[2]*/,
- const gs_range_t *pranges)
+ int num_coords, const float *Domain /*[2]*/,
+ const gs_function_t *Function,
+ const bool *Extend /*[2]*/,
+ const gs_range_t *pranges)
{
int code = cos_dict_put_c_key_floats(pscd, "/Coords", Coords, num_coords);
if (code < 0 ||
- ((Domain[0] != 0 || Domain[1] != 1) &&
- (code = cos_dict_put_c_key_floats(pscd, "/Domain", Domain, 2)) < 0) ||
- (code = pdf_put_shading_Function(pscd, Function, pranges)) < 0
- )
- return code;
+ ((Domain[0] != 0 || Domain[1] != 1) &&
+ (code = cos_dict_put_c_key_floats(pscd, "/Domain", Domain, 2)) < 0) ||
+ (code = pdf_put_shading_Function(pscd, Function, pranges)) < 0
+ )
+ return code;
if (Extend[0] | Extend[1]) {
- char extend_str[1 + 5 + 1 + 5 + 1 + 1]; /* [bool bool] */
-
- sprintf(extend_str, "[%s %s]",
- (Extend[0] ? "true" : "false"),
- (Extend[1] ? "true" : "false"));
- code = cos_dict_put_c_key_string(pscd, "/Extend",
- (const byte *)extend_str,
- strlen(extend_str));
+ char extend_str[1 + 5 + 1 + 5 + 1 + 1]; /* [bool bool] */
+
+ sprintf(extend_str, "[%s %s]",
+ (Extend[0] ? "true" : "false"),
+ (Extend[1] ? "true" : "false"));
+ code = cos_dict_put_c_key_string(pscd, "/Extend",
+ (const byte *)extend_str,
+ strlen(extend_str));
}
return code;
}
@@ -587,40 +586,40 @@ pdf_put_linear_shading(cos_dict_t *pscd, const float *Coords,
/* (Single-use procedure for readability.) */
static int
pdf_put_scalar_shading(cos_dict_t *pscd, const gs_shading_t *psh,
- const gs_range_t *pranges)
+ const gs_range_t *pranges)
{
int code;
switch (ShadingType(psh)) {
case shading_type_Function_based: {
- const gs_shading_Fb_params_t *const params =
- (const gs_shading_Fb_params_t *)&psh->params;
-
- if ((code = cos_dict_put_c_key_floats(pscd, "/Domain", params->Domain, 4)) < 0 ||
- (code = pdf_put_shading_Function(pscd, params->Function, pranges)) < 0 ||
- (code = cos_dict_put_matrix(pscd, "/Matrix", &params->Matrix)) < 0
- )
- return code;
- return 0;
+ const gs_shading_Fb_params_t *const params =
+ (const gs_shading_Fb_params_t *)&psh->params;
+
+ if ((code = cos_dict_put_c_key_floats(pscd, "/Domain", params->Domain, 4)) < 0 ||
+ (code = pdf_put_shading_Function(pscd, params->Function, pranges)) < 0 ||
+ (code = cos_dict_put_matrix(pscd, "/Matrix", &params->Matrix)) < 0
+ )
+ return code;
+ return 0;
}
case shading_type_Axial: {
- const gs_shading_A_params_t *const params =
- (const gs_shading_A_params_t *)&psh->params;
+ const gs_shading_A_params_t *const params =
+ (const gs_shading_A_params_t *)&psh->params;
- return pdf_put_linear_shading(pscd, params->Coords, 4,
- params->Domain, params->Function,
- params->Extend, pranges);
+ return pdf_put_linear_shading(pscd, params->Coords, 4,
+ params->Domain, params->Function,
+ params->Extend, pranges);
}
case shading_type_Radial: {
- const gs_shading_R_params_t *const params =
- (const gs_shading_R_params_t *)&psh->params;
+ const gs_shading_R_params_t *const params =
+ (const gs_shading_R_params_t *)&psh->params;
- return pdf_put_linear_shading(pscd, params->Coords, 6,
- params->Domain, params->Function,
- params->Extend, pranges);
+ return pdf_put_linear_shading(pscd, params->Coords, 6,
+ params->Domain, params->Function,
+ params->Extend, pranges);
}
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
}
@@ -631,7 +630,7 @@ pdf_array_add_real2(cos_array_t *pca, floatp lower, floatp upper)
int code = cos_array_add_real(pca, lower);
if (code >= 0)
- code = cos_array_add_real(pca, upper);
+ code = cos_array_add_real(pca, upper);
return code;
}
@@ -652,13 +651,13 @@ put_clamped(byte *p, floatp v, int num_bytes)
int i, shift;
if (v <= -limit)
- i = -limit + 1;
+ i = -limit + 1;
else if (v >= limit)
- i = limit - 1;
+ i = limit - 1;
else
- i = (int)v;
+ i = (int)v;
for (shift = (num_bytes - 1) * 8; shift >= 0; shift -= 8)
- *p++ = (byte)(i >> shift);
+ *p++ = (byte)(i >> shift);
}
static inline void
put_clamped_coord(byte *p, floatp v, int num_bytes)
@@ -671,7 +670,7 @@ put_clamped_coord(byte *p, floatp v, int num_bytes)
/* scaling is as defined below. */
static int
put_float_mesh_data(cos_stream_t *pscs, shade_coord_stream_t *cs,
- int flag, const pdf_mesh_data_params_t *pmdp)
+ int flag, const pdf_mesh_data_params_t *pmdp)
{
int num_points = pmdp->num_points;
byte b[1 + (3 + 3) * 16]; /* flag + x + y or c */
@@ -682,45 +681,45 @@ put_float_mesh_data(cos_stream_t *pscs, shade_coord_stream_t *cs,
b[0] = (byte)flag; /* may be -1 */
if ((code = shade_next_coords(cs, pts, num_points)) < 0)
- return code;
+ return code;
for (i = 0; i < num_points; ++i) {
- put_clamped_coord(b + 1 + i * 6, fixed2float(pts[i].x), 3);
- put_clamped_coord(b + 4 + i * 6, fixed2float(pts[i].y), 3);
+ put_clamped_coord(b + 1 + i * 6, fixed2float(pts[i].x), 3);
+ put_clamped_coord(b + 4 + i * 6, fixed2float(pts[i].y), 3);
}
if ((code = cos_stream_add_bytes(pscs, b + (flag < 0),
- (flag >= 0) + num_points * 6)) < 0)
- return code;
+ (flag >= 0) + num_points * 6)) < 0)
+ return code;
for (i = 0; i < pmdp->num_components; ++i) {
- float c;
- double v;
-
- cs->get_decoded(cs, 0, NULL, &c);
- if (pmdp->is_indexed)
- v = ENCODE_MESH_COLOR_INDEX(c);
- else {
- /*
- * We don't rescale stream data values, only the Decode ranges.
- * (We do have to rescale data values from an array, unless
- * they are the input parameter for a Function.)
- * This makes everything come out as it should.
- */
- double vmin, vmax;
-
- if (domain)
- vmin = domain[2 * i], vmax = domain[2 * i + 1];
- else
- vmin = 0.0, vmax = 1.0;
- if (pranges) {
- double base = pranges[i].rmin, factor = pranges[i].rmax - base;
-
- vmin = vmin * factor + base;
- vmax = vmax * factor + base;
- }
- v = ENCODE_MESH_COMPONENT(c, vmin, vmax);
- }
- put_clamped(b, v, 2);
- if ((code = cos_stream_add_bytes(pscs, b, 2)) < 0)
- return code;
+ float c;
+ double v;
+
+ cs->get_decoded(cs, 0, NULL, &c);
+ if (pmdp->is_indexed)
+ v = ENCODE_MESH_COLOR_INDEX(c);
+ else {
+ /*
+ * We don't rescale stream data values, only the Decode ranges.
+ * (We do have to rescale data values from an array, unless
+ * they are the input parameter for a Function.)
+ * This makes everything come out as it should.
+ */
+ double vmin, vmax;
+
+ if (domain)
+ vmin = domain[2 * i], vmax = domain[2 * i + 1];
+ else
+ vmin = 0.0, vmax = 1.0;
+ if (pranges) {
+ double base = pranges[i].rmin, factor = pranges[i].rmax - base;
+
+ vmin = vmin * factor + base;
+ vmax = vmax * factor + base;
+ }
+ v = ENCODE_MESH_COMPONENT(c, vmin, vmax);
+ }
+ put_clamped(b, v, 2);
+ if ((code = cos_stream_add_bytes(pscs, b, 2)) < 0)
+ return code;
}
return 0;
}
@@ -728,12 +727,12 @@ put_float_mesh_data(cos_stream_t *pscs, shade_coord_stream_t *cs,
/* Write a mesh Shading. */
static int
pdf_put_mesh_shading(cos_stream_t *pscs, const gs_shading_t *psh,
- const gs_range_t *pranges)
+ const gs_range_t *pranges)
{
cos_dict_t *const pscd = cos_stream_dict(pscs);
gs_color_space *pcs = psh->params.ColorSpace;
const gs_shading_mesh_params_t *const pmp =
- (const gs_shading_mesh_params_t *)&psh->params;
+ (const gs_shading_mesh_params_t *)&psh->params;
int code, code1;
int bits_per_coordinate, bits_per_component, bits_per_flag;
int num_comp;
@@ -744,166 +743,166 @@ pdf_put_mesh_shading(cos_stream_t *pscs, const gs_shading_t *psh,
int flag;
if (pmp->Function) {
- data_params.Domain = 0;
- num_comp = 1;
+ data_params.Domain = 0;
+ num_comp = 1;
} else {
- data_params.Domain = (pmp->Decode != 0 ? pmp->Decode + 4 : NULL);
- num_comp = gs_color_space_num_components(pcs);
+ data_params.Domain = (pmp->Decode != 0 ? pmp->Decode + 4 : NULL);
+ num_comp = gs_color_space_num_components(pcs);
}
data_params.ranges = pranges;
/* Write parameters common to all mesh Shadings. */
shade_next_init(&cs, pmp, NULL);
if (from_array) {
- cos_array_t *pca = cos_array_alloc(pscd->pdev, "pdf_put_mesh_shading");
- int i;
-
- if (pca == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < 2; ++i)
- if ((code = pdf_array_add_real2(pca, MIN_MESH_COORDINATE,
- MAX_MESH_COORDINATE)) < 0)
- return code;
- data_params.is_indexed = false;
- if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed) {
- data_params.is_indexed = true;
- if ((code = pdf_array_add_real2(pca, MIN_MESH_COLOR_INDEX,
- MAX_MESH_COLOR_INDEX)) < 0)
- return code;
- } else {
- for (i = 0; i < num_comp; ++i) {
- double rmin, rmax;
-
- if (pmp->Function || pranges || data_params.Domain == 0)
- rmin = 0.0, rmax = 1.0;
- else
- rmin = data_params.Domain[2 * i],
- rmax = data_params.Domain[2 * i + 1];
- if ((code =
- pdf_array_add_real2(pca, rmin, rmax)) < 0)
- return code;
- }
- }
- code = cos_dict_put_c_key_object(pscd, "/Decode", COS_OBJECT(pca));
- if (code < 0)
- return code;
- bits_per_coordinate = 24;
- bits_per_component = 16;
- bits_per_flag = 8;
- gs_make_identity((gs_matrix *)&ctm_ident);
- ctm_ident.tx_fixed = ctm_ident.ty_fixed = 0;
+ cos_array_t *pca = cos_array_alloc(pscd->pdev, "pdf_put_mesh_shading");
+ int i;
+
+ if (pca == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < 2; ++i)
+ if ((code = pdf_array_add_real2(pca, MIN_MESH_COORDINATE,
+ MAX_MESH_COORDINATE)) < 0)
+ return code;
+ data_params.is_indexed = false;
+ if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed) {
+ data_params.is_indexed = true;
+ if ((code = pdf_array_add_real2(pca, MIN_MESH_COLOR_INDEX,
+ MAX_MESH_COLOR_INDEX)) < 0)
+ return code;
+ } else {
+ for (i = 0; i < num_comp; ++i) {
+ double rmin, rmax;
+
+ if (pmp->Function || pranges || data_params.Domain == 0)
+ rmin = 0.0, rmax = 1.0;
+ else
+ rmin = data_params.Domain[2 * i],
+ rmax = data_params.Domain[2 * i + 1];
+ if ((code =
+ pdf_array_add_real2(pca, rmin, rmax)) < 0)
+ return code;
+ }
+ }
+ code = cos_dict_put_c_key_object(pscd, "/Decode", COS_OBJECT(pca));
+ if (code < 0)
+ return code;
+ bits_per_coordinate = 24;
+ bits_per_component = 16;
+ bits_per_flag = 8;
+ gs_make_identity((gs_matrix *)&ctm_ident);
+ ctm_ident.tx_fixed = ctm_ident.ty_fixed = 0;
ctm_ident.txy_fixed_valid = true;
- cs.pctm = &ctm_ident;
- if (pmp->Function)
- data_params.ranges = 0; /* don't scale function parameter */
+ cs.pctm = &ctm_ident;
+ if (pmp->Function)
+ data_params.ranges = 0; /* don't scale function parameter */
} else {
- /****** SCALE Decode ******/
- code = cos_dict_put_c_key_floats(pscd, "/Decode", pmp->Decode,
- 4 + num_comp * 2);
- if (code >= 0)
- code = cos_stream_add_stream_contents(pscs, cs.s);
- bits_per_coordinate = pmp->BitsPerCoordinate;
- bits_per_component = pmp->BitsPerComponent;
- bits_per_flag = -1;
+ /****** SCALE Decode ******/
+ code = cos_dict_put_c_key_floats(pscd, "/Decode", pmp->Decode,
+ 4 + num_comp * 2);
+ if (code >= 0)
+ code = cos_stream_add_stream_contents(pscs, cs.s);
+ bits_per_coordinate = pmp->BitsPerCoordinate;
+ bits_per_component = pmp->BitsPerComponent;
+ bits_per_flag = -1;
}
if (code < 0 ||
- (code = pdf_put_shading_Function(pscd, pmp->Function, pranges)) < 0 ||
- (code = cos_dict_put_c_key_int(pscd, "/BitsPerCoordinate",
- bits_per_coordinate)) < 0 ||
- (code = cos_dict_put_c_key_int(pscd, "/BitsPerComponent",
- bits_per_component)) < 0
- )
- return code;
+ (code = pdf_put_shading_Function(pscd, pmp->Function, pranges)) < 0 ||
+ (code = cos_dict_put_c_key_int(pscd, "/BitsPerCoordinate",
+ bits_per_coordinate)) < 0 ||
+ (code = cos_dict_put_c_key_int(pscd, "/BitsPerComponent",
+ bits_per_component)) < 0
+ )
+ return code;
switch (ShadingType(psh)) {
case shading_type_Free_form_Gouraud_triangle: {
- const gs_shading_FfGt_params_t *const params =
- (const gs_shading_FfGt_params_t *)pmp;
-
- data_params.num_points = 1;
- data_params.num_components = num_comp;
- if (from_array) {
- while ((flag = shade_next_flag(&cs, 0)) >= 0)
- if ((code = put_float_mesh_data(pscs, &cs, flag,
- &data_params)) < 0)
- return code;
- if (!seofp(cs.s))
- code = gs_note_error(gs_error_rangecheck);
- }
- if (bits_per_flag < 0)
- bits_per_flag = params->BitsPerFlag;
- break;
+ const gs_shading_FfGt_params_t *const params =
+ (const gs_shading_FfGt_params_t *)pmp;
+
+ data_params.num_points = 1;
+ data_params.num_components = num_comp;
+ if (from_array) {
+ while ((flag = shade_next_flag(&cs, 0)) >= 0)
+ if ((code = put_float_mesh_data(pscs, &cs, flag,
+ &data_params)) < 0)
+ return code;
+ if (!seofp(cs.s))
+ code = gs_note_error(gs_error_rangecheck);
+ }
+ if (bits_per_flag < 0)
+ bits_per_flag = params->BitsPerFlag;
+ break;
}
case shading_type_Lattice_form_Gouraud_triangle: {
- const gs_shading_LfGt_params_t *const params =
- (const gs_shading_LfGt_params_t *)pmp;
-
- data_params.num_points = 1;
- data_params.num_components = num_comp;
- if (from_array)
- while (!seofp(cs.s))
- if ((code = put_float_mesh_data(pscs, &cs, -1,
- &data_params)) < 0)
- return code;
- code = cos_dict_put_c_key_int(pscd, "/VerticesPerRow",
- params->VerticesPerRow);
- return code;
+ const gs_shading_LfGt_params_t *const params =
+ (const gs_shading_LfGt_params_t *)pmp;
+
+ data_params.num_points = 1;
+ data_params.num_components = num_comp;
+ if (from_array)
+ while (!seofp(cs.s))
+ if ((code = put_float_mesh_data(pscs, &cs, -1,
+ &data_params)) < 0)
+ return code;
+ code = cos_dict_put_c_key_int(pscd, "/VerticesPerRow",
+ params->VerticesPerRow);
+ return code;
}
case shading_type_Coons_patch: {
- const gs_shading_Cp_params_t *const params =
- (const gs_shading_Cp_params_t *)pmp;
-
- if (from_array) {
- while ((flag = shade_next_flag(&cs, 0)) >= 0) {
- data_params.num_points = (flag == 0 ? 12 : 8);
- data_params.num_components = num_comp * (flag == 0 ? 4 : 2);
- if ((code = put_float_mesh_data(pscs, &cs, flag,
- &data_params)) < 0)
- return code;
- }
- if (!seofp(cs.s))
- code = gs_note_error(gs_error_rangecheck);
- }
- if (bits_per_flag < 0)
- bits_per_flag = params->BitsPerFlag;
- break;
+ const gs_shading_Cp_params_t *const params =
+ (const gs_shading_Cp_params_t *)pmp;
+
+ if (from_array) {
+ while ((flag = shade_next_flag(&cs, 0)) >= 0) {
+ data_params.num_points = (flag == 0 ? 12 : 8);
+ data_params.num_components = num_comp * (flag == 0 ? 4 : 2);
+ if ((code = put_float_mesh_data(pscs, &cs, flag,
+ &data_params)) < 0)
+ return code;
+ }
+ if (!seofp(cs.s))
+ code = gs_note_error(gs_error_rangecheck);
+ }
+ if (bits_per_flag < 0)
+ bits_per_flag = params->BitsPerFlag;
+ break;
}
case shading_type_Tensor_product_patch: {
- const gs_shading_Tpp_params_t *const params =
- (const gs_shading_Tpp_params_t *)pmp;
-
- if (from_array) {
- while ((flag = shade_next_flag(&cs, 0)) >= 0) {
- data_params.num_points = (flag == 0 ? 16 : 12);
- data_params.num_components = num_comp * (flag == 0 ? 4 : 2);
- if ((code = put_float_mesh_data(pscs, &cs, flag,
- &data_params)) < 0)
- return code;
- }
- if (!seofp(cs.s))
- code = gs_note_error(gs_error_rangecheck);
- }
- if (bits_per_flag < 0)
- bits_per_flag = params->BitsPerFlag;
- break;
+ const gs_shading_Tpp_params_t *const params =
+ (const gs_shading_Tpp_params_t *)pmp;
+
+ if (from_array) {
+ while ((flag = shade_next_flag(&cs, 0)) >= 0) {
+ data_params.num_points = (flag == 0 ? 16 : 12);
+ data_params.num_components = num_comp * (flag == 0 ? 4 : 2);
+ if ((code = put_float_mesh_data(pscs, &cs, flag,
+ &data_params)) < 0)
+ return code;
+ }
+ if (!seofp(cs.s))
+ code = gs_note_error(gs_error_rangecheck);
+ }
+ if (bits_per_flag < 0)
+ bits_per_flag = params->BitsPerFlag;
+ break;
}
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
code1 = cos_dict_put_c_key_int(pscd, "/BitsPerFlag", bits_per_flag);
if (code1 < 0)
- return code;
+ return code;
return code;
}
/* Write a PatternType 2 (shading pattern) color. */
int
pdf_put_pattern2(gx_device_pdf *pdev, const gx_drawing_color *pdc,
- const psdf_set_color_commands_t *ppscc,
- pdf_resource_t **ppres)
+ const psdf_set_color_commands_t *ppscc,
+ pdf_resource_t **ppres)
{
const gs_pattern2_instance_t *pinst =
- (gs_pattern2_instance_t *)pdc->ccolor.pattern;
+ (gs_pattern2_instance_t *)pdc->ccolor.pattern;
const gs_shading_t *psh = pinst->template.Shading;
cos_value_t v;
pdf_resource_t *pres;
@@ -916,29 +915,29 @@ pdf_put_pattern2(gx_device_pdf *pdev, const gx_drawing_color *pdc,
gs_matrix smat;
if (code < 0)
- return code;
+ return code;
code = pdf_alloc_resource(pdev, resourcePattern, gs_no_id, ppres, 0L);
if (code < 0)
- return code;
+ return code;
pres = *ppres;
cos_become(pres->object, cos_type_dict);
pcd = (cos_dict_t *)pres->object;
code = pdf_alloc_resource(pdev, resourceShading, gs_no_id, &psres, 0L);
if (code < 0)
- return code;
+ return code;
psco = psres->object;
if (ShadingType(psh) >= 4) {
- /* Shading has an associated data stream. */
- cos_become(psco, cos_type_stream);
- code = pdf_put_shading_common(cos_stream_dict((cos_stream_t *)psco),
- psh, pinst->shfill, &pranges);
- if (code >= 0)
- code1 = pdf_put_mesh_shading((cos_stream_t *)psco, psh, pranges);
+ /* Shading has an associated data stream. */
+ cos_become(psco, cos_type_stream);
+ code = pdf_put_shading_common(cos_stream_dict((cos_stream_t *)psco),
+ psh, pinst->shfill, &pranges);
+ if (code >= 0)
+ code1 = pdf_put_mesh_shading((cos_stream_t *)psco, psh, pranges);
} else {
- cos_become(psco, cos_type_dict);
- code = pdf_put_shading_common((cos_dict_t *)psco, psh, pinst->shfill, &pranges);
- if (code >= 0)
- code = pdf_put_scalar_shading((cos_dict_t *)psco, psh, pranges);
+ cos_become(psco, cos_type_dict);
+ code = pdf_put_shading_common((cos_dict_t *)psco, psh, pinst->shfill, &pranges);
+ if (code >= 0)
+ code = pdf_put_scalar_shading((cos_dict_t *)psco, psh, pranges);
}
/*
* In PDF, the Matrix is the transformation from the pattern space to
@@ -949,22 +948,22 @@ pdf_put_pattern2(gx_device_pdf *pdev, const gx_drawing_color *pdc,
*/
gs_currentmatrix(pinst->saved, &smat);
{
- double xscale = 1.0, yscale = 1.0;
- if (pdev->FormDepth <= 1) {
- xscale = 72.0 / pdev->HWResolution[0];
- yscale = 72.0 / pdev->HWResolution[1];
- }
-
- smat.xx *= xscale, smat.yx *= xscale, smat.tx *= xscale;
- smat.xy *= yscale, smat.yy *= yscale, smat.ty *= yscale;
+ double xscale = 1.0, yscale = 1.0;
+ if (pdev->FormDepth <= 1) {
+ xscale = 72.0 / pdev->HWResolution[0];
+ yscale = 72.0 / pdev->HWResolution[1];
+ }
+
+ smat.xx *= xscale, smat.yx *= xscale, smat.tx *= xscale;
+ smat.xy *= yscale, smat.yy *= yscale, smat.ty *= yscale;
}
if (code < 0 ||
- (code = cos_dict_put_c_key_int(pcd, "/PatternType", 2)) < 0 ||
- (code = cos_dict_put_c_key_object(pcd, "/Shading", psco)) < 0 ||
- (code = cos_dict_put_matrix(pcd, "/Matrix", &smat)) < 0
- /****** ExtGState ******/
- )
- return code;
+ (code = cos_dict_put_c_key_int(pcd, "/PatternType", 2)) < 0 ||
+ (code = cos_dict_put_c_key_object(pcd, "/Shading", psco)) < 0 ||
+ (code = cos_dict_put_matrix(pcd, "/Matrix", &smat)) < 0
+ /****** ExtGState ******/
+ )
+ return code;
cos_value_write(&v, pdev);
pprints1(pdev->strm, " %s", ppscc->setcolorspace);
return code1;
@@ -980,5 +979,5 @@ gdev_pdf_include_color_space(gx_device *dev, gs_color_space *cspace, const byte
cos_value_t cs_value;
return pdf_color_space_named(pdev, &cs_value, NULL, cspace,
- &pdf_color_space_names, true, res_name, name_length);
+ &pdf_color_space_names, true, res_name, name_length);
}
diff --git a/gs/base/gdevpdfx.h b/gs/base/gdevpdfx.h
index 229a57b7c..bd3c1b5a9 100644
--- a/gs/base/gdevpdfx.h
+++ b/gs/base/gdevpdfx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,6 @@
#define FINE_GLYPH_USAGE 1 /* Old code = 0, new code = 1 */
-
/* ---------------- Acrobat limitations ---------------- */
/*
@@ -86,7 +85,6 @@ typedef struct pdf_text_state_s pdf_text_state_t;
typedef struct pdf_char_glyph_pairs_s pdf_char_glyph_pairs_t;
#endif
-
/* ---------------- Resources ---------------- */
typedef enum {
@@ -99,10 +97,10 @@ typedef enum {
resourcePattern,
resourceShading,
resourceXObject,
- resourceOther, /* Anything else that needs to be stored for a time.
- * Can be any of the types defined below NUM_RESOURCE_TYPES
- * but this is the type used to identify the object.
- */
+ resourceOther, /* Anything else that needs to be stored for a time.
+ * Can be any of the types defined below NUM_RESOURCE_TYPES
+ * but this is the type used to identify the object.
+ */
resourceFont,
/*
* Internally used (pseudo-)resources.
@@ -136,10 +134,10 @@ typedef enum {
resourceMetadata,
resourceICC,
resourceAnnotation,
- resourceNone /* Special, used when this isn't a resource at all
- * eg when we execute a resource we've just written, such as
- * a Pattern.
- */
+ resourceNone /* Special, used when this isn't a resource at all
+ * eg when we execute a resource we've just written, such as
+ * a Pattern.
+ */
} pdf_resource_type_t;
#define PDF_RESOURCE_TYPE_NAMES\
@@ -352,9 +350,9 @@ struct pdf_font_cache_elem_s {
#define private_st_pdf_font_cache_elem()\
gs_private_st_ptrs5(st_pdf_font_cache_elem, pdf_font_cache_elem_t,\
- "pdf_font_cache_elem_t", pdf_font_cache_elem_enum,\
- pdf_font_cache_elem_reloc, next, pdfont,\
- glyph_usage, real_widths, pdev)
+ "pdf_font_cache_elem_t", pdf_font_cache_elem_enum,\
+ pdf_font_cache_elem_reloc, next, pdfont,\
+ glyph_usage, real_widths, pdev)
/*
* pdf_viewer_state tracks the graphic state of a viewer,
@@ -411,9 +409,9 @@ typedef struct pdf_substream_save_s {
#define private_st_pdf_substream_save()\
gs_private_st_strings1_ptrs7(st_pdf_substream_save, pdf_substream_save,\
- "pdf_substream_save", pdf_substream_save_enum,\
- pdf_substream_save_reloc, objname, text_state, clip_path, strm, \
- substream_Resources, font3, accumulating_substream_resource, pres_soft_mask_dict)
+ "pdf_substream_save", pdf_substream_save_enum,\
+ pdf_substream_save_reloc, objname, text_state, clip_path, strm, \
+ substream_Resources, font3, accumulating_substream_resource, pres_soft_mask_dict)
#define private_st_pdf_substream_save_element()\
gs_private_st_element(st_pdf_substream_save_element, pdf_substream_save,\
"pdf_substream_save[]", pdf_substream_save_elt_enum_ptrs,\
@@ -425,7 +423,6 @@ typedef enum {
pdf_compress_Flate
} pdf_compression_type;
-
/* Define the device structure. */
struct gx_device_pdf_s {
gx_device_psdf_common;
@@ -466,17 +463,17 @@ struct gx_device_pdf_s {
bool HaveStrokeColor; /* PS2WRITE only. */
bool ProduceDSC; /* PS2WRITE only. */
bool HaveTransparency;
- bool PatternImagemask; /* The target viewer|printer handles imagemask
- with pattern color. */
+ bool PatternImagemask; /* The target viewer|printer handles imagemask
+ with pattern color. */
bool PDFX; /* Generate PDF/X */
bool PDFA; /* Generate PDF/A */
bool AbortPDFAX; /* Abort generation of PDFA or X, produce regular PDF */
long MaxClipPathSize; /* The maximal number of elements of a clipping path
- that the target viewer|printer can handle. */
+ that the target viewer|printer can handle. */
long MaxViewerMemorySize;
- long MaxShadingBitmapSize; /* The maximal number of bytes in
- a bitmap representation of a shading.
- (Bigger shadings to be downsampled). */
+ long MaxShadingBitmapSize; /* The maximal number of bytes in
+ a bitmap representation of a shading.
+ (Bigger shadings to be downsampled). */
long MaxInlineImageSize;
gs_param_int_array DSCEncodingToUnicode;
/* Encryption parameters */
@@ -599,11 +596,11 @@ struct gx_device_pdf_s {
*/
cos_array_t *Namespace_stack;
pdf_font_cache_elem_t *font_cache;
- /*
- * char_width is used by pdf_text_set_cache to communicate
- * with assign_char_code around gdev_pdf_fill_mask.
+ /*
+ * char_width is used by pdf_text_set_cache to communicate
+ * with assign_char_code around gdev_pdf_fill_mask.
*/
- gs_point char_width;
+ gs_point char_width;
/*
* We need a stable copy of clipping path to prevent writing
* redundant clipping paths when PS document generates such ones.
@@ -624,7 +621,7 @@ struct gx_device_pdf_s {
* It's life time terminates on garbager invocation.
*/
gs_text_enum_t *pte;
- /*
+ /*
* The viewer's graphic state stack.
* We restrict its length with the strongest PDF spec limitation.
* Usually 5 levels is enough, but patterns and charprocs may be nested recursively.
@@ -642,7 +639,7 @@ struct gx_device_pdf_s {
/* Temporary workaround. The only way to get forms out of pdfwrite at present
* is via a transparency group or mask operation. Ordinarily we don't care
- * much about forms, but Patterns within forms need to be scaled to the
+ * much about forms, but Patterns within forms need to be scaled to the
* CTM of the Pattern, not the default page co-ordinate system. We use
* this value to know if we are nested inside a form or not. If we are
* we don't undo the resolution co-ordinate transform.
@@ -657,18 +654,18 @@ struct gx_device_pdf_s {
pdf_resource_t *font3; /* The owner of the accumulated charstring. */
pdf_resource_t *accumulating_substream_resource;
gs_matrix_fixed charproc_ctm;
- bool charproc_just_accumulated; /* A flag for controlling
- the glyph variation recognition.
- Used only with uncached charprocs. */
+ bool charproc_just_accumulated; /* A flag for controlling
+ the glyph variation recognition.
+ Used only with uncached charprocs. */
bool accumulating_a_global_object; /* ps2write only.
- Accumulating a global object (such as a named Form,
- so that resources used in it must also be global.
- Important for viewers with small memory,
- which drops resources per page. */
- const pdf_char_glyph_pairs_t *cgp; /* A temporary pointer
- for pdf_is_same_charproc1.
- Must be NULL when the garbager is invoked,
- because it points from global to local memory. */
+ Accumulating a global object (such as a named Form,
+ so that resources used in it must also be global.
+ Important for viewers with small memory,
+ which drops resources per page. */
+ const pdf_char_glyph_pairs_t *cgp; /* A temporary pointer
+ for pdf_is_same_charproc1.
+ Must be NULL when the garbager is invoked,
+ because it points from global to local memory. */
int substituted_pattern_count;
int substituted_pattern_drop_page;
/* Temporary data for use_image_as_pattern,
@@ -854,60 +851,58 @@ void pdf_reserve_object_id(gx_device_pdf * pdev, pdf_resource_t *ppres, long id)
/* Begin an aside (resource, annotation, ...). */
int pdf_alloc_aside(gx_device_pdf * pdev, pdf_resource_t ** plist,
- const gs_memory_struct_type_t * pst, pdf_resource_t **ppres,
- long id);
+ const gs_memory_struct_type_t * pst, pdf_resource_t **ppres,
+ long id);
/* Begin an aside (resource, annotation, ...). */
int pdf_begin_aside(gx_device_pdf * pdev, pdf_resource_t **plist,
- const gs_memory_struct_type_t * pst,
- pdf_resource_t **ppres, pdf_resource_type_t type);
+ const gs_memory_struct_type_t * pst,
+ pdf_resource_t **ppres, pdf_resource_type_t type);
/* Begin a resource of a given type. */
int pdf_begin_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- gs_id rid, pdf_resource_t **ppres);
+ gs_id rid, pdf_resource_t **ppres);
/* Begin a resource body of a given type. */
int pdf_begin_resource_body(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- gs_id rid, pdf_resource_t **ppres);
+ gs_id rid, pdf_resource_t **ppres);
/* Allocate a resource, but don't open the stream. */
int pdf_alloc_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- gs_id rid, pdf_resource_t **ppres, long id);
+ gs_id rid, pdf_resource_t **ppres, long id);
/* Find same resource. */
-int pdf_find_same_resource(gx_device_pdf * pdev,
- pdf_resource_type_t rtype, pdf_resource_t **ppres,
- int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1));
-
+int pdf_find_same_resource(gx_device_pdf * pdev,
+ pdf_resource_type_t rtype, pdf_resource_t **ppres,
+ int (*eq)(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1));
/* Find resource by resource id. */
-pdf_resource_t *pdf_find_resource_by_resource_id(gx_device_pdf * pdev,
- pdf_resource_type_t rtype, gs_id id);
+pdf_resource_t *pdf_find_resource_by_resource_id(gx_device_pdf * pdev,
+ pdf_resource_type_t rtype, gs_id id);
/* Find a resource of a given type by gs_id. */
pdf_resource_t *pdf_find_resource_by_gs_id(gx_device_pdf * pdev,
- pdf_resource_type_t rtype,
- gs_id rid);
+ pdf_resource_type_t rtype,
+ gs_id rid);
-void pdf_drop_resources(gx_device_pdf * pdev, pdf_resource_type_t rtype,
- int (*cond)(gx_device_pdf * pdev, pdf_resource_t *pres));
+void pdf_drop_resources(gx_device_pdf * pdev, pdf_resource_type_t rtype,
+ int (*cond)(gx_device_pdf * pdev, pdf_resource_t *pres));
/* Print resource statistics. */
void pdf_print_resource_statistics(gx_device_pdf * pdev);
-
/* Cancel a resource (do not write it into PDF). */
-int pdf_cancel_resource(gx_device_pdf * pdev, pdf_resource_t *pres,
- pdf_resource_type_t rtype);
+int pdf_cancel_resource(gx_device_pdf * pdev, pdf_resource_t *pres,
+ pdf_resource_type_t rtype);
/* Remove a resource. */
-void pdf_forget_resource(gx_device_pdf * pdev, pdf_resource_t *pres1,
- pdf_resource_type_t rtype);
+void pdf_forget_resource(gx_device_pdf * pdev, pdf_resource_t *pres1,
+ pdf_resource_type_t rtype);
/* Substitute a resource with a same one. */
-int pdf_substitute_resource(gx_device_pdf *pdev, pdf_resource_t **ppres,
- pdf_resource_type_t rtype,
- int (*eq)(gx_device_pdf *pdev, pdf_resource_t *pres0, pdf_resource_t *pres1),
- bool write);
+int pdf_substitute_resource(gx_device_pdf *pdev, pdf_resource_t **ppres,
+ pdf_resource_type_t rtype,
+ int (*eq)(gx_device_pdf *pdev, pdf_resource_t *pres0, pdf_resource_t *pres1),
+ bool write);
/* Get the object id of a resource. */
long pdf_resource_id(const pdf_resource_t *pres);
@@ -959,7 +954,6 @@ void pdf_end_encrypt(gx_device_pdf * pdev);
/* Initialize encryption. */
int pdf_encrypt_init(const gx_device_pdf * pdev, gs_id object_id, stream_arcfour_state *psarc4);
-
/* ------ Pages ------ */
/* Get or assign the ID for a page. */
@@ -1016,13 +1010,11 @@ typedef struct pdf_lcvd_s {
pdf_lcvd_t_reloc_ptrs, st_device_memory, mask, pdev)
#define pdf_lcvd_t_max_ptrs (gx_device_memory_max_ptrs + 2)
-
-int pdf_setup_masked_image_converter(gx_device_pdf *pdev, gs_memory_t *mem, const gs_matrix *m, pdf_lcvd_t **pcvd,
- bool need_mask, int x, int y, int w, int h, bool write_on_close);
+int pdf_setup_masked_image_converter(gx_device_pdf *pdev, gs_memory_t *mem, const gs_matrix *m, pdf_lcvd_t **pcvd,
+ bool need_mask, int x, int y, int w, int h, bool write_on_close);
int pdf_dump_converted_image(gx_device_pdf *pdev, pdf_lcvd_t *cvd);
void pdf_remove_masked_image_converter(gx_device_pdf *pdev, pdf_lcvd_t *cvd, bool need_mask);
-
/* ------ Miscellaneous output ------ */
#define PDF_MAX_PRODUCER 200 /* adhoc */
@@ -1052,14 +1044,14 @@ typedef struct pdf_filter_names_s {
/* Write matrix values. */
void pdf_put_matrix(gx_device_pdf *pdev, const char *before,
- const gs_matrix *pmat, const char *after);
+ const gs_matrix *pmat, const char *after);
/* Write a name, with escapes for unusual characters. */
typedef int (*pdf_put_name_chars_proc_t)(stream *, const byte *, uint);
pdf_put_name_chars_proc_t
pdf_put_name_chars_proc(const gx_device_pdf *pdev);
int pdf_put_name_chars(const gx_device_pdf *pdev, const byte *nstr,
- uint size);
+ uint size);
int pdf_put_name(const gx_device_pdf *pdev, const byte *nstr, uint size);
/* Write a string in its shortest form ( () or <> ). */
@@ -1070,7 +1062,7 @@ int pdf_write_value(const gx_device_pdf *pdev, const byte *vstr, uint size, gs_i
/* Store filters for a stream. */
int pdf_put_filters(cos_dict_t *pcd, gx_device_pdf *pdev, stream *s,
- const pdf_filter_names_t *pfn);
+ const pdf_filter_names_t *pfn);
/* Define a possibly encoded and compressed data stream. */
typedef struct pdf_data_writer_s {
@@ -1092,9 +1084,9 @@ typedef struct pdf_data_writer_s {
#define DATA_STREAM_NOLENGTH 4 /* Skip the length reference and filter names writing. */
#define DATA_STREAM_ENCRYPT 8 /* Encrypt data. */
int pdf_begin_data_stream(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
- int options, gs_id object_id);
+ int options, gs_id object_id);
int pdf_append_data_stream_filters(gx_device_pdf *pdev, pdf_data_writer_t *pdw,
- int orig_options, gs_id object_id);
+ int orig_options, gs_id object_id);
/* begin_data = begin_data_binary with both options = true. */
int pdf_begin_data(gx_device_pdf *pdev, pdf_data_writer_t *pdw);
@@ -1118,13 +1110,13 @@ typedef struct gs_function_s gs_function_t;
# define gs_function_DEFINED
#endif
int pdf_function(gx_device_pdf *pdev, const gs_function_t *pfn,
- cos_value_t *pvalue);
+ cos_value_t *pvalue);
int pdf_function_scaled(gx_device_pdf *pdev, const gs_function_t *pfn,
- const gs_range_t *pranges, cos_value_t *pvalue);
+ const gs_range_t *pranges, cos_value_t *pvalue);
/* Write a Function object, returning its object ID. */
int pdf_write_function(gx_device_pdf *pdev, const gs_function_t *pfn,
- long *pid);
+ long *pid);
/* ------ Fonts ------ */
@@ -1140,7 +1132,7 @@ int pdf_write_font_bbox_float(gx_device_pdf *pdev, const gs_rect *pbox);
*/
#define pdfmark_proc(proc)\
int proc(gx_device_pdf *pdev, gs_param_string *pairs, uint count,\
- const gs_matrix *pctm, const gs_param_string *objname)
+ const gs_matrix *pctm, const gs_param_string *objname)
/* Compare a C string and a gs_param_string. */
bool pdf_key_eq(const gs_param_string * pcs, const char *str);
@@ -1170,16 +1162,16 @@ bool pdf_objname_is_valid(const byte *data, uint size);
* e_undefined if no object by that name exists.
*/
int pdf_find_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_object_t **ppco);
+ cos_object_t **ppco);
/*
* Create a named object. id = -1L means do not assign an id. pname = 0
* means just create the object, do not name it.
*/
int pdf_create_named(gx_device_pdf *pdev, const gs_param_string *pname,
- cos_type_t cotype, cos_object_t **ppco, long id);
+ cos_type_t cotype, cos_object_t **ppco, long id);
int pdf_create_named_dict(gx_device_pdf *pdev, const gs_param_string *pname,
- cos_dict_t **ppcd, long id);
+ cos_dict_t **ppcd, long id);
/*
* Look up a named object as for pdf_find_named. If the object does not
@@ -1188,7 +1180,7 @@ int pdf_create_named_dict(gx_device_pdf *pdev, const gs_param_string *pname,
* generic object) and return 1.
*/
int pdf_refer_named(gx_device_pdf *pdev, const gs_param_string *pname,
- cos_object_t **ppco);
+ cos_object_t **ppco);
/*
* Look up a named object as for pdf_refer_named. If the object already
@@ -1198,9 +1190,9 @@ int pdf_refer_named(gx_device_pdf *pdev, const gs_param_string *pname,
* pname = 0 is allowed: in this case, simply create the object.
*/
int pdf_make_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_type_t cotype, cos_object_t **ppco, bool assign_id);
+ cos_type_t cotype, cos_object_t **ppco, bool assign_id);
int pdf_make_named_dict(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_dict_t **ppcd, bool assign_id);
+ cos_dict_t **ppcd, bool assign_id);
/*
* Look up a named object as for pdf_refer_named. If the object does not
@@ -1208,7 +1200,7 @@ int pdf_make_named_dict(gx_device_pdf * pdev, const gs_param_string * pname,
* exists has the wrong type, return e_typecheck.
*/
int pdf_get_named(gx_device_pdf * pdev, const gs_param_string * pname,
- cos_type_t cotype, cos_object_t **ppco);
+ cos_type_t cotype, cos_object_t **ppco);
/*
* Push the current local namespace onto the namespace stack, and reset it
@@ -1235,11 +1227,11 @@ int pdf_scan_token(const byte **pscan, const byte * end, const byte **ptoken);
* single tokens.
*/
int pdf_scan_token_composite(const byte **pscan, const byte * end,
- const byte **ptoken);
+ const byte **ptoken);
/* Replace object names with object references in a (parameter) string. */
int pdf_replace_names(gx_device_pdf *pdev, const gs_param_string *from,
- gs_param_string *to);
+ gs_param_string *to);
/* ================ Text module procedures ================ */
@@ -1271,34 +1263,34 @@ int pdf_char_image_y_offset(const gx_device_pdf *pdev, int x, int y, int h);
/* Begin a CharProc for an embedded (bitmap) font. */
int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
- int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
- pdf_stream_position_t * ppos);
+ int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
+ pdf_stream_position_t * ppos);
/* End a CharProc. */
int pdf_end_char_proc(gx_device_pdf * pdev, pdf_stream_position_t * ppos);
/* Put out a reference to an image as a character in an embedded font. */
int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
- const gs_matrix * pimat);
+ const gs_matrix * pimat);
/* Start charproc accumulation for a Type 3 font. */
int pdf_start_charproc_accum(gx_device_pdf *pdev);
/* Install charproc accumulator for a Type 3 font. */
int pdf_set_charproc_attrs(gx_device_pdf *pdev, gs_font *font, const double *pw, int narg,
- gs_text_cache_control_t control, gs_char ch);
+ gs_text_cache_control_t control, gs_char ch);
/* Complete charproc accumulation for aType 3 font. */
-int pdf_end_charproc_accum(gx_device_pdf *pdev, gs_font *font, const pdf_char_glyph_pairs_t *cgp,
- gs_glyph glyph, gs_char output_char_code, const gs_const_string *gnstr);
+int pdf_end_charproc_accum(gx_device_pdf *pdev, gs_font *font, const pdf_char_glyph_pairs_t *cgp,
+ gs_glyph glyph, gs_char output_char_code, const gs_const_string *gnstr);
/* Open a stream object in the temporary file. */
-int pdf_open_aside(gx_device_pdf *pdev, pdf_resource_type_t rtype,
- gs_id id, pdf_resource_t **ppres, bool reserve_object_id, int options);
+int pdf_open_aside(gx_device_pdf *pdev, pdf_resource_type_t rtype,
+ gs_id id, pdf_resource_t **ppres, bool reserve_object_id, int options);
/* Close a stream object in the temporary file. */
int pdf_close_aside(gx_device_pdf *pdev);
/* Enter the substream accumulation mode. */
-int pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
- gs_id id, pdf_resource_t **ppres, bool reserve_object_id, bool compress);
+int pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
+ gs_id id, pdf_resource_t **ppres, bool reserve_object_id, bool compress);
/* Exit the substream accumulation mode. */
int pdf_exit_substream(gx_device_pdf *pdev);
@@ -1307,7 +1299,6 @@ int pdf_add_procsets(cos_dict_t *pcd, pdf_procset_t procsets);
/* Add a resource to substream Resources. */
int pdf_add_resource(gx_device_pdf *pdev, cos_dict_t *pcd, const char *key, pdf_resource_t *pres);
-
/* For gdevpdfu.c */
int pdf_from_stream_to_text(gx_device_pdf *pdev);
diff --git a/gs/base/gdevpdt.c b/gs/base/gdevpdt.c
index 913799761..6794b5f06 100644
--- a/gs/base/gdevpdt.c
+++ b/gs/base/gdevpdt.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,18 +32,18 @@ pdf_text_data_t *
pdf_text_data_alloc(gs_memory_t *mem)
{
pdf_text_data_t *ptd =
- gs_alloc_struct(mem, pdf_text_data_t, &st_pdf_text_data,
- "pdf_text_data_alloc");
+ gs_alloc_struct(mem, pdf_text_data_t, &st_pdf_text_data,
+ "pdf_text_data_alloc");
pdf_outline_fonts_t *pofs = pdf_outline_fonts_alloc(mem);
pdf_bitmap_fonts_t *pbfs = pdf_bitmap_fonts_alloc(mem);
pdf_text_state_t *pts = pdf_text_state_alloc(mem);
if (pts == 0 || pbfs == 0 || pofs == 0 || ptd == 0) {
- gs_free_object(mem, pts, "pdf_text_data_alloc");
- gs_free_object(mem, pbfs, "pdf_text_data_alloc");
- gs_free_object(mem, pofs, "pdf_text_data_alloc");
- gs_free_object(mem, ptd, "pdf_text_data_alloc");
- return 0;
+ gs_free_object(mem, pts, "pdf_text_data_alloc");
+ gs_free_object(mem, pbfs, "pdf_text_data_alloc");
+ gs_free_object(mem, pofs, "pdf_text_data_alloc");
+ gs_free_object(mem, ptd, "pdf_text_data_alloc");
+ return 0;
}
memset(ptd, 0, sizeof(*ptd));
ptd->outline_fonts = pofs;
diff --git a/gs/base/gdevpdt.h b/gs/base/gdevpdt.h
index d58de5f8f..f49271db7 100644
--- a/gs/base/gdevpdt.h
+++ b/gs/base/gdevpdt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -87,15 +87,15 @@ int pdf_char_image_y_offset(const gx_device_pdf *pdev, int x, int y, int h);/* g
/* Begin a CharProc for an embedded (bitmap) font. */
int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
- int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
- pdf_stream_position_t * ppos); /* gdevpdti.h */
+ int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
+ pdf_stream_position_t * ppos); /* gdevpdti.h */
/* End a CharProc. */
int pdf_end_char_proc(gx_device_pdf * pdev,
- pdf_stream_position_t * ppos); /* gdevpdti.h */
+ pdf_stream_position_t * ppos); /* gdevpdti.h */
/* Put out a reference to an image as a character in an embedded font. */
int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
- const gs_matrix * pimat); /* gdevpdti.h */
+ const gs_matrix * pimat); /* gdevpdti.h */
#endif /* gdevpdt_INCLUDED */
diff --git a/gs/base/gdevpdtb.c b/gs/base/gdevpdtb.c
index 1a755c49a..9a4214268 100644
--- a/gs/base/gdevpdtb.c
+++ b/gs/base/gdevpdtb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,7 @@
private_st_pdf_base_font();
gs_private_st_basic(st_pdf_base_font, pdf_base_font_t, "pdf_base_font_t",\
- pdf_base_font_ptrs, pdf_base_font_data);
+ pdf_base_font_ptrs, pdf_base_font_data);
#define SUBSET_PREFIX_SIZE 7 /* XXXXXX+ */
@@ -55,10 +55,10 @@ pdf_has_subset_prefix(const byte *str, uint size)
int i;
if (size < SUBSET_PREFIX_SIZE || str[SUBSET_PREFIX_SIZE - 1] != '+')
- return false;
+ return false;
for (i = 0; i < SUBSET_PREFIX_SIZE - 1; ++i)
- if ((uint)(str[i] - 'A') >= 26)
- return false;
+ if ((uint)(str[i] - 'A') >= 26)
+ return false;
return true;
}
@@ -76,25 +76,25 @@ pdf_add_subset_prefix(const gx_device_pdf *pdev, gs_string *pstr, byte *used, in
{
uint size = pstr->size;
byte *data = gs_resize_string(pdev->pdf_memory, pstr->data, size,
- size + SUBSET_PREFIX_SIZE,
- "pdf_add_subset_prefix");
+ size + SUBSET_PREFIX_SIZE,
+ "pdf_add_subset_prefix");
int len = (count + 7) / 8;
int len0 = len & ~(sizeof(ushort) - 1);
ulong v = 0;
int i;
if (data == 0)
- return_error(gs_error_VMerror);
-
+ return_error(gs_error_VMerror);
+
/* Hash the 'used' array. */
for (i = 0; i < len0; i += sizeof(ushort))
- v = hash(v, i, *(ushort *)(used + i));
+ v = hash(v, i, *(ushort *)(used + i));
for (; i < len; i++)
v = hash(v, i, used[i]);
memmove(data + SUBSET_PREFIX_SIZE, data, size);
for (i = 0; i < SUBSET_PREFIX_SIZE - 1; ++i, v /= 26)
- data[i] = 'A' + (v % 26);
+ data[i] = 'A' + (v % 26);
data[SUBSET_PREFIX_SIZE - 1] = '+';
pstr->data = data;
pstr->size = size + SUBSET_PREFIX_SIZE;
@@ -120,157 +120,157 @@ pdf_end_fontfile(gx_device_pdf *pdev, pdf_data_writer_t *pdw)
*/
int
pdf_base_font_alloc(gx_device_pdf *pdev, pdf_base_font_t **ppbfont,
- gs_font_base *font, const gs_matrix *orig_matrix,
- bool is_standard)
+ gs_font_base *font, const gs_matrix *orig_matrix,
+ bool is_standard)
{
gs_memory_t *mem = pdev->pdf_memory;
gs_font *copied;
gs_font *complete;
pdf_base_font_t *pbfont =
- gs_alloc_struct(mem, pdf_base_font_t,
- &st_pdf_base_font, "pdf_base_font_alloc");
+ gs_alloc_struct(mem, pdf_base_font_t,
+ &st_pdf_base_font, "pdf_base_font_alloc");
const gs_font_name *pfname = &font->font_name;
gs_const_string font_name;
char fnbuf[2*sizeof(long) + 3]; /* .F########\0 */
int code, reserve_glyphs = -1;
if (pbfont == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pbfont, 0, sizeof(*pbfont));
switch (font->FontType) {
case ft_encrypted:
case ft_encrypted2:
- {
- int index, count;
- gs_glyph glyph;
-
- for (index = 0, count = 0;
- (font->procs.enumerate_glyph((gs_font *)font, &index,
- GLYPH_SPACE_NAME, &glyph),
- index != 0);
- )
- ++count;
- pbfont->num_glyphs = count;
- pbfont->do_subset = (is_standard ? DO_SUBSET_NO : DO_SUBSET_UNKNOWN);
- }
- /* If we find an excessively large type 1 font we won't be able to emit
- * a complete copy. Instead we will emit multiple subsets. Detect that here
- * and only reserve enough space in the font copy for the maximum subset
- * glyphs, 257.
- * This also prevents us making a 'complete' copy of the font below. NB the
- * value 2048 is merely a guess, intended to prevent copying very large fonts.
- */
- if(pbfont->num_glyphs > 2048 && !is_standard) {
- reserve_glyphs = 257;
- if(pbfont->do_subset != DO_SUBSET_NO){
- char buf[gs_font_name_max + 1];
- int l = min(font->font_name.size, sizeof(buf) - 1);
-
- memcpy(buf, font->font_name.chars, l);
- buf[l] = 0;
- emprintf1(pdev->memory,
+ {
+ int index, count;
+ gs_glyph glyph;
+
+ for (index = 0, count = 0;
+ (font->procs.enumerate_glyph((gs_font *)font, &index,
+ GLYPH_SPACE_NAME, &glyph),
+ index != 0);
+ )
+ ++count;
+ pbfont->num_glyphs = count;
+ pbfont->do_subset = (is_standard ? DO_SUBSET_NO : DO_SUBSET_UNKNOWN);
+ }
+ /* If we find an excessively large type 1 font we won't be able to emit
+ * a complete copy. Instead we will emit multiple subsets. Detect that here
+ * and only reserve enough space in the font copy for the maximum subset
+ * glyphs, 257.
+ * This also prevents us making a 'complete' copy of the font below. NB the
+ * value 2048 is merely a guess, intended to prevent copying very large fonts.
+ */
+ if(pbfont->num_glyphs > 2048 && !is_standard) {
+ reserve_glyphs = 257;
+ if(pbfont->do_subset != DO_SUBSET_NO){
+ char buf[gs_font_name_max + 1];
+ int l = min(font->font_name.size, sizeof(buf) - 1);
+
+ memcpy(buf, font->font_name.chars, l);
+ buf[l] = 0;
+ emprintf1(pdev->memory,
"Can't embed the complete font %s as it is too large, embedding a subset.\n",
buf);
- }
- }
- break;
+ }
+ }
+ break;
case ft_TrueType:
- pbfont->num_glyphs = ((gs_font_type42 *)font)->data.trueNumGlyphs;
- pbfont->do_subset =
- (pbfont->num_glyphs <= MAX_NO_SUBSET_GLYPHS ?
- DO_SUBSET_UNKNOWN : DO_SUBSET_YES);
- break;
+ pbfont->num_glyphs = ((gs_font_type42 *)font)->data.trueNumGlyphs;
+ pbfont->do_subset =
+ (pbfont->num_glyphs <= MAX_NO_SUBSET_GLYPHS ?
+ DO_SUBSET_UNKNOWN : DO_SUBSET_YES);
+ break;
case ft_CID_encrypted:
- pbfont->num_glyphs = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
- goto cid;
+ pbfont->num_glyphs = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
+ goto cid;
case ft_CID_TrueType:
- pbfont->num_glyphs = ((gs_font_cid2 *)font)->cidata.common.CIDCount;
+ pbfont->num_glyphs = ((gs_font_cid2 *)font)->cidata.common.CIDCount;
cid:
- pbfont->do_subset = DO_SUBSET_YES;
- pbfont->CIDSet =
- gs_alloc_bytes(mem, (pbfont->num_glyphs + 7) / 8,
- "pdf_base_font_alloc(CIDSet)");
- if (pbfont->CIDSet == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
- }
- memset(pbfont->CIDSet, 0, (pbfont->num_glyphs + 7) / 8);
- break;
+ pbfont->do_subset = DO_SUBSET_YES;
+ pbfont->CIDSet =
+ gs_alloc_bytes(mem, (pbfont->num_glyphs + 7) / 8,
+ "pdf_base_font_alloc(CIDSet)");
+ if (pbfont->CIDSet == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
+ }
+ memset(pbfont->CIDSet, 0, (pbfont->num_glyphs + 7) / 8);
+ break;
default:
- code = gs_note_error(gs_error_rangecheck);
- goto fail;
+ code = gs_note_error(gs_error_rangecheck);
+ goto fail;
}
code = gs_copy_font((gs_font *)font, orig_matrix, mem, &copied, reserve_glyphs);
if (code < 0)
- goto fail;
+ goto fail;
{
- /*
- * Adobe Technical Note # 5012 "The Type 42 Font Format Specification" says :
- *
- * There is a known bug in the TrueType rasterizer included in versions of the
- * PostScript interpreter previous to version 2013. The problem is that the
- * translation components of the FontMatrix, as used as an argument to the
- * definefont or makefont operators, are ignored. Translation of user space is
- * not affected by this bug.
- *
- * Besides that, we found that Adobe Acrobat Reader 4 and 5 ignore
- * FontMatrix.ty .
- */
- copied->FontMatrix.tx = copied->FontMatrix.ty = 0;
+ /*
+ * Adobe Technical Note # 5012 "The Type 42 Font Format Specification" says :
+ *
+ * There is a known bug in the TrueType rasterizer included in versions of the
+ * PostScript interpreter previous to version 2013. The problem is that the
+ * translation components of the FontMatrix, as used as an argument to the
+ * definefont or makefont operators, are ignored. Translation of user space is
+ * not affected by this bug.
+ *
+ * Besides that, we found that Adobe Acrobat Reader 4 and 5 ignore
+ * FontMatrix.ty .
+ */
+ copied->FontMatrix.tx = copied->FontMatrix.ty = 0;
}
if (pbfont->do_subset != DO_SUBSET_YES && reserve_glyphs == -1) {
- /* The only possibly non-subsetted fonts are Type 1/2 and Type 42. */
- if (is_standard)
- complete = copied;
- else {
- code = gs_copy_font((gs_font *)font, &font->FontMatrix, mem, &complete, -1);
- if (code < 0)
- goto fail;
- }
- code = gs_copy_font_complete((gs_font *)font, complete);
- if (code < 0 && pbfont->do_subset == DO_SUBSET_NO) {
- char buf[gs_font_name_max + 1];
- int l = min(copied->font_name.size, sizeof(buf) - 1);
-
- memcpy(buf, copied->font_name.chars, l);
- buf[l] = 0;
- emprintf1(pdev->memory,
+ /* The only possibly non-subsetted fonts are Type 1/2 and Type 42. */
+ if (is_standard)
+ complete = copied;
+ else {
+ code = gs_copy_font((gs_font *)font, &font->FontMatrix, mem, &complete, -1);
+ if (code < 0)
+ goto fail;
+ }
+ code = gs_copy_font_complete((gs_font *)font, complete);
+ if (code < 0 && pbfont->do_subset == DO_SUBSET_NO) {
+ char buf[gs_font_name_max + 1];
+ int l = min(copied->font_name.size, sizeof(buf) - 1);
+
+ memcpy(buf, copied->font_name.chars, l);
+ buf[l] = 0;
+ emprintf1(pdev->memory,
"Can't embed the complete font %s due to font error.\n",
buf);
- goto fail;
- }
- if (code < 0) {
- /* A font error happened, but it may be caused by a glyph,
- which is not used in the document. Continue with subsetting the font.
- If the failed glyph will be used in the document,
- another error will hgappen when the glyph is used.
- */
- complete = copied;
- }
+ goto fail;
+ }
+ if (code < 0) {
+ /* A font error happened, but it may be caused by a glyph,
+ which is not used in the document. Continue with subsetting the font.
+ If the failed glyph will be used in the document,
+ another error will hgappen when the glyph is used.
+ */
+ complete = copied;
+ }
} else
- complete = copied;
+ complete = copied;
pbfont->copied = (gs_font_base *)copied;
pbfont->complete = (gs_font_base *)complete;
pbfont->is_standard = is_standard;
if (pfname->size > 0) {
- font_name.data = pfname->chars;
- font_name.size = pfname->size;
- while (pdf_has_subset_prefix(font_name.data, font_name.size)) {
- /* Strip off an existing subset prefix. */
- font_name.data += SUBSET_PREFIX_SIZE;
- font_name.size -= SUBSET_PREFIX_SIZE;
- }
+ font_name.data = pfname->chars;
+ font_name.size = pfname->size;
+ while (pdf_has_subset_prefix(font_name.data, font_name.size)) {
+ /* Strip off an existing subset prefix. */
+ font_name.data += SUBSET_PREFIX_SIZE;
+ font_name.size -= SUBSET_PREFIX_SIZE;
+ }
} else {
- sprintf(fnbuf, ".F%lx", (ulong)copied);
- font_name.data = (byte *)fnbuf;
- font_name.size = strlen(fnbuf);
+ sprintf(fnbuf, ".F%lx", (ulong)copied);
+ font_name.data = (byte *)fnbuf;
+ font_name.size = strlen(fnbuf);
}
pbfont->font_name.data =
- gs_alloc_string(mem, font_name.size, "pdf_base_font_alloc(font_name)");
+ gs_alloc_string(mem, font_name.size, "pdf_base_font_alloc(font_name)");
if (pbfont->font_name.data == 0)
- goto fail;
+ goto fail;
memcpy(pbfont->font_name.data, font_name.data, font_name.size);
pbfont->font_name.size = font_name.size;
*ppbfont = pbfont;
@@ -327,21 +327,21 @@ pdf_base_font_drop_complete(pdf_base_font_t *pbfont)
*/
int
pdf_base_font_copy_glyph(pdf_base_font_t *pbfont, gs_glyph glyph,
- gs_font_base *font)
+ gs_font_base *font)
{
int code =
- gs_copy_glyph_options((gs_font *)font, glyph,
- (gs_font *)pbfont->copied,
- (pbfont->is_standard ? COPY_GLYPH_NO_NEW : 0));
+ gs_copy_glyph_options((gs_font *)font, glyph,
+ (gs_font *)pbfont->copied,
+ (pbfont->is_standard ? COPY_GLYPH_NO_NEW : 0));
if (code < 0)
- return code;
+ return code;
if (pbfont->CIDSet != 0 &&
- (uint)(glyph - GS_MIN_CID_GLYPH) < pbfont->num_glyphs
- ) {
- uint cid = glyph - GS_MIN_CID_GLYPH;
+ (uint)(glyph - GS_MIN_CID_GLYPH) < pbfont->num_glyphs
+ ) {
+ uint cid = glyph - GS_MIN_CID_GLYPH;
- pbfont->CIDSet[cid >> 3] |= 0x80 >> (cid & 7);
+ pbfont->CIDSet[cid >> 3] |= 0x80 >> (cid & 7);
}
return 0;
}
@@ -359,30 +359,30 @@ pdf_do_subset_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont, gs_id rid)
* to subset the font.
*/
if (pbfont->do_subset == DO_SUBSET_UNKNOWN) {
- int max_pct = pdev->params.MaxSubsetPct;
- bool do_subset = pdev->params.SubsetFonts && max_pct > 0;
-
- if (do_subset && max_pct < 100) {
- /* We want to subset iff used <= total * MaxSubsetPct / 100. */
- do_subset = false;
- if (max_pct > 0) {
- int max_subset_used = pbfont->num_glyphs * max_pct / 100;
- int used, index;
- gs_glyph ignore_glyph;
-
- do_subset = true;
- for (index = 0, used = 0;
- (copied->procs.enumerate_glyph((gs_font *)copied,
- &index, GLYPH_SPACE_INDEX,
- &ignore_glyph), index != 0);
- )
- if (++used > max_subset_used) {
- do_subset = false;
- break;
- }
- }
- }
- pbfont->do_subset = (do_subset ? DO_SUBSET_YES : DO_SUBSET_NO);
+ int max_pct = pdev->params.MaxSubsetPct;
+ bool do_subset = pdev->params.SubsetFonts && max_pct > 0;
+
+ if (do_subset && max_pct < 100) {
+ /* We want to subset iff used <= total * MaxSubsetPct / 100. */
+ do_subset = false;
+ if (max_pct > 0) {
+ int max_subset_used = pbfont->num_glyphs * max_pct / 100;
+ int used, index;
+ gs_glyph ignore_glyph;
+
+ do_subset = true;
+ for (index = 0, used = 0;
+ (copied->procs.enumerate_glyph((gs_font *)copied,
+ &index, GLYPH_SPACE_INDEX,
+ &ignore_glyph), index != 0);
+ )
+ if (++used > max_subset_used) {
+ do_subset = false;
+ break;
+ }
+ }
+ }
+ pbfont->do_subset = (do_subset ? DO_SUBSET_YES : DO_SUBSET_NO);
}
return (pbfont->do_subset == DO_SUBSET_YES);
}
@@ -399,13 +399,13 @@ pdf_write_FontFile_entry(gx_device_pdf *pdev, pdf_base_font_t *pbfont)
switch (pbfont->copied->FontType) {
case ft_TrueType:
case ft_CID_TrueType:
- FontFile_key = "/FontFile2";
- break;
+ FontFile_key = "/FontFile2";
+ break;
default: /* Type 1/2, CIDFontType 0 */
- if (pdev->ResourcesBeforeUsage)
- FontFile_key = "/FontFile";
- else
- FontFile_key = "/FontFile3";
+ if (pdev->ResourcesBeforeUsage)
+ FontFile_key = "/FontFile";
+ else
+ FontFile_key = "/FontFile3";
}
stream_puts(s, FontFile_key);
pprintld1(s, " %ld 0 R", pbfont->FontFile->id);
@@ -438,23 +438,23 @@ pdf_adjust_font_name(gx_device_pdf *pdev, long id, pdf_base_font_t *pbfont)
* remove the suffix.
*/
for (i = size;
- i > 0 && isxdigit(chars[i - 1]);
- --i)
- DO_NOTHING;
+ i > 0 && isxdigit(chars[i - 1]);
+ --i)
+ DO_NOTHING;
if (i < size && i > 0 && chars[i - 1] == SUFFIX_CHAR) {
- do {
- --i;
- } while (i > 0 && chars[i - 1] == SUFFIX_CHAR);
- size = i + 1;
+ do {
+ --i;
+ } while (i > 0 && chars[i - 1] == SUFFIX_CHAR);
+ size = i + 1;
}
/* Create a unique name. */
sprintf(suffix, "%c%lx", SUFFIX_CHAR, id);
suffix_size = strlen(suffix);
data = gs_resize_string(pdev->pdf_memory, chars, size,
- size + suffix_size,
- "pdf_adjust_font_name");
+ size + suffix_size,
+ "pdf_adjust_font_name");
if (data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(data + size, (const byte *)suffix, suffix_size);
pbfont->font_name.data = data;
pbfont->font_name.size = size + suffix_size;
@@ -467,48 +467,48 @@ pdf_adjust_font_name(gx_device_pdf *pdev, long id, pdf_base_font_t *pbfont)
*/
int
pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont, font_type FontType,
- gs_int_rect *FontBBox, gs_id rid, cos_dict_t **ppcd)
+ gs_int_rect *FontBBox, gs_id rid, cos_dict_t **ppcd)
{
bool do_subset = pdf_do_subset_font(pdev, pbfont, rid);
gs_font_base *out_font =
- (do_subset || pbfont->complete == NULL ? pbfont->copied : pbfont->complete);
+ (do_subset || pbfont->complete == NULL ? pbfont->copied : pbfont->complete);
gs_const_string fnstr;
pdf_data_writer_t writer;
byte digest[6] = {0,0,0,0,0,0};
int code;
if (pbfont->written)
- return 0; /* already written */
+ return 0; /* already written */
code = copied_order_font((gs_font *)out_font);
if (code < 0)
- return code;
- code = pdf_begin_data_stream(pdev, &writer, DATA_STREAM_BINARY |
- /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
- See comment in pdf_begin_encrypt. */
- (pdev->CompressFonts ?
- DATA_STREAM_COMPRESS : 0), 0);
+ return code;
+ code = pdf_begin_data_stream(pdev, &writer, DATA_STREAM_BINARY |
+ /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
+ See comment in pdf_begin_encrypt. */
+ (pdev->CompressFonts ?
+ DATA_STREAM_COMPRESS : 0), 0);
if (code < 0)
- return code;
+ return code;
if (pdev->PDFA) {
- stream *s = s_MD5C_make_stream(pdev->pdf_memory, writer.binary.strm);
+ stream *s = s_MD5C_make_stream(pdev->pdf_memory, writer.binary.strm);
- if (s == NULL)
- return_error(gs_error_VMerror);
- writer.binary.strm = s;
+ if (s == NULL)
+ return_error(gs_error_VMerror);
+ writer.binary.strm = s;
}
if (pdev->CompatibilityLevel == 1.2 &&
- !do_subset && !pbfont->is_standard ) {
- /*
- * Due to a bug in Acrobat Reader 3, we need to generate
- * unique font names, except base 14 fonts being not embedded.
- * To recognize base 14 fonts here we used the knowledge
- * that pbfont->is_standard is true for base 14 fonts only.
- * Note that subsetted fonts already have an unique name
- * due to subset prefix.
- */
- int code = pdf_adjust_font_name(pdev, writer.pres->object->id, pbfont);
- if (code < 0)
- return code;
+ !do_subset && !pbfont->is_standard ) {
+ /*
+ * Due to a bug in Acrobat Reader 3, we need to generate
+ * unique font names, except base 14 fonts being not embedded.
+ * To recognize base 14 fonts here we used the knowledge
+ * that pbfont->is_standard is true for base 14 fonts only.
+ * Note that subsetted fonts already have an unique name
+ * due to subset prefix.
+ */
+ int code = pdf_adjust_font_name(pdev, writer.pres->object->id, pbfont);
+ if (code < 0)
+ return code;
}
fnstr.data = pbfont->font_name.data;
fnstr.size = pbfont->font_name.size;
@@ -516,128 +516,128 @@ pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont, font_type
switch (FontType) {
case ft_composite:
- /* Nothing to embed -- the descendant fonts do it all. */
- code = 0;
- break;
+ /* Nothing to embed -- the descendant fonts do it all. */
+ code = 0;
+ break;
case ft_encrypted2:
- if (!pdev->HaveCFF) {
- /* Must convert to Type 1 charstrings. */
- return_error(gs_error_unregistered); /* Not implemented yet. */
- }
+ if (!pdev->HaveCFF) {
+ /* Must convert to Type 1 charstrings. */
+ return_error(gs_error_unregistered); /* Not implemented yet. */
+ }
case ft_encrypted:
- if (pdev->HavePDFWidths) {
- code = copied_drop_extension_glyphs((gs_font *)out_font);
- if (code < 0)
- return code;
- }
- if (!pdev->HaveCFF) {
- /* Write the type 1 font with no converting to CFF. */
- int lengths[3];
-
- code = psf_write_type1_font(writer.binary.strm,
- (gs_font_type1 *)out_font,
- WRITE_TYPE1_WITH_LENIV |
- WRITE_TYPE1_EEXEC | WRITE_TYPE1_EEXEC_PAD,
- NULL, 0, &fnstr, lengths);
- if (lengths[0] > 0) {
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Length1", lengths[0]);
- }
- if (lengths[1] > 0) {
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Length2", lengths[1]);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
- "/Length3", lengths[2]);
- }
- } else {
- /*
- * Since we only support PDF 1.2 and later, always write Type 1
- * fonts as Type1C (Type 2). Acrobat Reader apparently doesn't
- * accept CFF fonts with Type 1 CharStrings, so we need to convert
- * them. Also remove lenIV, so Type 2 fonts will compress better.
- */
+ if (pdev->HavePDFWidths) {
+ code = copied_drop_extension_glyphs((gs_font *)out_font);
+ if (code < 0)
+ return code;
+ }
+ if (!pdev->HaveCFF) {
+ /* Write the type 1 font with no converting to CFF. */
+ int lengths[3];
+
+ code = psf_write_type1_font(writer.binary.strm,
+ (gs_font_type1 *)out_font,
+ WRITE_TYPE1_WITH_LENIV |
+ WRITE_TYPE1_EEXEC | WRITE_TYPE1_EEXEC_PAD,
+ NULL, 0, &fnstr, lengths);
+ if (lengths[0] > 0) {
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
+ "/Length1", lengths[0]);
+ }
+ if (lengths[1] > 0) {
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
+ "/Length2", lengths[1]);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object,
+ "/Length3", lengths[2]);
+ }
+ } else {
+ /*
+ * Since we only support PDF 1.2 and later, always write Type 1
+ * fonts as Type1C (Type 2). Acrobat Reader apparently doesn't
+ * accept CFF fonts with Type 1 CharStrings, so we need to convert
+ * them. Also remove lenIV, so Type 2 fonts will compress better.
+ */
#define TYPE2_OPTIONS (WRITE_TYPE2_NO_LENIV | WRITE_TYPE2_CHARSTRINGS)
- code = cos_dict_put_string_copy((cos_dict_t *)writer.pres->object, "/Subtype", "/Type1C");
- if (code < 0)
- return code;
- code = psf_write_type2_font(writer.binary.strm,
- (gs_font_type1 *)out_font,
- TYPE2_OPTIONS |
- (pdev->CompatibilityLevel < 1.3 ? WRITE_TYPE2_AR3 : 0),
- NULL, 0, &fnstr, FontBBox);
- }
- goto finish;
+ code = cos_dict_put_string_copy((cos_dict_t *)writer.pres->object, "/Subtype", "/Type1C");
+ if (code < 0)
+ return code;
+ code = psf_write_type2_font(writer.binary.strm,
+ (gs_font_type1 *)out_font,
+ TYPE2_OPTIONS |
+ (pdev->CompatibilityLevel < 1.3 ? WRITE_TYPE2_AR3 : 0),
+ NULL, 0, &fnstr, FontBBox);
+ }
+ goto finish;
case ft_TrueType: {
- gs_font_type42 *const pfont = (gs_font_type42 *)out_font;
+ gs_font_type42 *const pfont = (gs_font_type42 *)out_font;
#define TRUETYPE_OPTIONS (WRITE_TRUETYPE_NAME | WRITE_TRUETYPE_HVMTX)
- /* Acrobat Reader 3 doesn't handle cmap format 6 correctly. */
- const int options = TRUETYPE_OPTIONS |
- (pdev->PDFA ? WRITE_TRUETYPE_UNICODE_CMAP : 0) |
- (pdev->CompatibilityLevel <= 1.2 ?
- WRITE_TRUETYPE_NO_TRIMMED_TABLE : 0) |
- /* Generate a cmap only for incrementally downloaded fonts
- and for subsetted fonts. */
- (pfont->data.numGlyphs != pfont->data.trueNumGlyphs ||
- pbfont->do_subset == DO_SUBSET_YES ?
- WRITE_TRUETYPE_CMAP : 0);
- stream poss;
-
- if (pdev->HavePDFWidths) {
- code = copied_drop_extension_glyphs((gs_font *)out_font);
- if (code < 0)
- return code;
- }
- s_init(&poss, pdev->memory);
- swrite_position_only(&poss);
- code = psf_write_truetype_font(&poss, pfont, options, NULL, 0, &fnstr);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object, "/Length1", stell(&poss));
- if (code < 0)
- return code;
- code = psf_write_truetype_font(writer.binary.strm, pfont,
- options, NULL, 0, &fnstr);
- goto finish;
+ /* Acrobat Reader 3 doesn't handle cmap format 6 correctly. */
+ const int options = TRUETYPE_OPTIONS |
+ (pdev->PDFA ? WRITE_TRUETYPE_UNICODE_CMAP : 0) |
+ (pdev->CompatibilityLevel <= 1.2 ?
+ WRITE_TRUETYPE_NO_TRIMMED_TABLE : 0) |
+ /* Generate a cmap only for incrementally downloaded fonts
+ and for subsetted fonts. */
+ (pfont->data.numGlyphs != pfont->data.trueNumGlyphs ||
+ pbfont->do_subset == DO_SUBSET_YES ?
+ WRITE_TRUETYPE_CMAP : 0);
+ stream poss;
+
+ if (pdev->HavePDFWidths) {
+ code = copied_drop_extension_glyphs((gs_font *)out_font);
+ if (code < 0)
+ return code;
+ }
+ s_init(&poss, pdev->memory);
+ swrite_position_only(&poss);
+ code = psf_write_truetype_font(&poss, pfont, options, NULL, 0, &fnstr);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_int((cos_dict_t *)writer.pres->object, "/Length1", stell(&poss));
+ if (code < 0)
+ return code;
+ code = psf_write_truetype_font(writer.binary.strm, pfont,
+ options, NULL, 0, &fnstr);
+ goto finish;
}
case ft_CID_encrypted:
- code = cos_dict_put_string_copy((cos_dict_t *)writer.pres->object, "/Subtype", "/CIDFontType0C");
- if (code < 0)
- return code;
- code = psf_write_cid0_font(writer.binary.strm,
- (gs_font_cid0 *)out_font, TYPE2_OPTIONS,
- NULL, 0, &fnstr);
- goto finish;
+ code = cos_dict_put_string_copy((cos_dict_t *)writer.pres->object, "/Subtype", "/CIDFontType0C");
+ if (code < 0)
+ return code;
+ code = psf_write_cid0_font(writer.binary.strm,
+ (gs_font_cid0 *)out_font, TYPE2_OPTIONS,
+ NULL, 0, &fnstr);
+ goto finish;
case ft_CID_TrueType:
- /* CIDFontType 2 fonts don't use cmap, name, OS/2, or post. */
+ /* CIDFontType 2 fonts don't use cmap, name, OS/2, or post. */
#define CID2_OPTIONS WRITE_TRUETYPE_HVMTX
- code = psf_write_cid2_font(writer.binary.strm,
- (gs_font_cid2 *)out_font,
- CID2_OPTIONS, NULL, 0, &fnstr);
+ code = psf_write_cid2_font(writer.binary.strm,
+ (gs_font_cid2 *)out_font,
+ CID2_OPTIONS, NULL, 0, &fnstr);
finish:
- if (pdev->PDFA) {
- sflush(writer.binary.strm);
- s_MD5C_get_digest(writer.binary.strm, digest, sizeof(digest));
- }
- *ppcd = (cos_dict_t *)writer.pres->object;
- if (code < 0) {
- pdf_end_fontfile(pdev, &writer);
- return code;
- }
- code = pdf_end_fontfile(pdev, &writer);
- break;
+ if (pdev->PDFA) {
+ sflush(writer.binary.strm);
+ s_MD5C_get_digest(writer.binary.strm, digest, sizeof(digest));
+ }
+ *ppcd = (cos_dict_t *)writer.pres->object;
+ if (code < 0) {
+ pdf_end_fontfile(pdev, &writer);
+ return code;
+ }
+ code = pdf_end_fontfile(pdev, &writer);
+ break;
default:
- code = gs_note_error(gs_error_rangecheck);
+ code = gs_note_error(gs_error_rangecheck);
}
pbfont->written = true;
@@ -657,18 +657,18 @@ pdf_write_CharSet(gx_device_pdf *pdev, pdf_base_font_t *pbfont)
stream_puts(s, "(");
for (index = 0;
- (font->procs.enumerate_glyph((gs_font *)font, &index,
- GLYPH_SPACE_NAME, &glyph),
- index != 0);
- ) {
- gs_const_string gstr;
- int code = font->procs.glyph_name((gs_font *)font, glyph, &gstr);
-
- /* Don't include .notdef. */
- if (code >= 0 &&
- bytes_compare(gstr.data, gstr.size, (const byte *)".notdef", 7)
- )
- pdf_put_name(pdev, gstr.data, gstr.size);
+ (font->procs.enumerate_glyph((gs_font *)font, &index,
+ GLYPH_SPACE_NAME, &glyph),
+ index != 0);
+ ) {
+ gs_const_string gstr;
+ int code = font->procs.glyph_name((gs_font *)font, glyph, &gstr);
+
+ /* Don't include .notdef. */
+ if (code >= 0 &&
+ bytes_compare(gstr.data, gstr.size, (const byte *)".notdef", 7)
+ )
+ pdf_put_name(pdev, gstr.data, gstr.size);
}
stream_puts(s, ")");
return 0;
@@ -679,22 +679,22 @@ pdf_write_CharSet(gx_device_pdf *pdev, pdf_base_font_t *pbfont)
*/
int
pdf_write_CIDSet(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
- long *pcidset_id)
+ long *pcidset_id)
{
pdf_data_writer_t writer;
int code;
code = pdf_begin_data_stream(pdev, &writer,
- DATA_STREAM_BINARY |
- (pdev->CompressFonts ? DATA_STREAM_COMPRESS : 0),
- gs_no_id);
+ DATA_STREAM_BINARY |
+ (pdev->CompressFonts ? DATA_STREAM_COMPRESS : 0),
+ gs_no_id);
if (code < 0)
- return code;
+ return code;
stream_write(writer.binary.strm, pbfont->CIDSet,
- (pbfont->num_glyphs + 7) / 8);
+ (pbfont->num_glyphs + 7) / 8);
code = pdf_end_data(&writer);
if (code < 0)
- return code;
+ return code;
*pcidset_id = pdf_resource_id(writer.pres);
return 0;
}
diff --git a/gs/base/gdevpdtb.h b/gs/base/gdevpdtb.h
index a3d29c04e..ef292d44a 100644
--- a/gs/base/gdevpdtb.h
+++ b/gs/base/gdevpdtb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -71,8 +71,8 @@ typedef struct pdf_base_font_s pdf_base_font_t;
* a complete one, and adding glyphs or Encoding entries is not allowed.
*/
int pdf_base_font_alloc(gx_device_pdf *pdev, pdf_base_font_t **ppbfont,
- gs_font_base *font, const gs_matrix *orig_matrix,
- bool is_standard);
+ gs_font_base *font, const gs_matrix *orig_matrix,
+ bool is_standard);
/*
* Return a reference to the name of a base font. This name is guaranteed
@@ -104,7 +104,7 @@ void pdf_base_font_drop_complete(pdf_base_font_t *pbfont);
* will be the same.)
*/
int pdf_base_font_copy_glyph(pdf_base_font_t *pbfont, gs_glyph glyph,
- gs_font_base *font);
+ gs_font_base *font);
/*
* Determine whether a font is a subset font by examining the name.
@@ -114,14 +114,14 @@ bool pdf_has_subset_prefix(const byte *str, uint size);
/*
* Add the XXXXXX+ prefix for a subset font.
*/
-int pdf_add_subset_prefix(const gx_device_pdf *pdev, gs_string *pstr,
- byte *used, int count);
+int pdf_add_subset_prefix(const gx_device_pdf *pdev, gs_string *pstr,
+ byte *used, int count);
/*
* Determine whether a copied font should be subsetted.
*/
-bool pdf_do_subset_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
- gs_id rid);
+bool pdf_do_subset_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
+ gs_id rid);
/*
* Write the FontFile entry for an embedded font, /FontFile<n> # # R.
@@ -132,7 +132,7 @@ int pdf_write_FontFile_entry(gx_device_pdf *pdev, pdf_base_font_t *pbfont);
* Write an embedded font, possibly subsetted.
*/
int pdf_write_embedded_font(gx_device_pdf *pdev, pdf_base_font_t *pbfont, font_type FontType,
- gs_int_rect *FontBBox, gs_id rid, cos_dict_t **ppcd);
+ gs_int_rect *FontBBox, gs_id rid, cos_dict_t **ppcd);
/*
* Write the CharSet data for a subsetted font, as a PDF string.
@@ -143,7 +143,7 @@ int pdf_write_CharSet(gx_device_pdf *pdev, pdf_base_font_t *pbfont);
* Write the CIDSet object for a subsetted CIDFont.
*/
int pdf_write_CIDSet(gx_device_pdf *pdev, pdf_base_font_t *pbfont,
- long *pcidset_id);
+ long *pcidset_id);
/*
* Check whether a base font is standard.
diff --git a/gs/base/gdevpdtc.c b/gs/base/gdevpdtc.c
index 257f46077..4c3682643 100644
--- a/gs/base/gdevpdtc.c
+++ b/gs/base/gdevpdtc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,17 +53,17 @@ process_composite_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
str.data = buf;
if (return_width) {
- code = gx_path_current_point(penum->path, &penum->origin);
- if (code < 0)
- return code;
+ code = gx_path_current_point(penum->path, &penum->origin);
+ if (code < 0)
+ return code;
}
if (pte->text.operation &
- (TEXT_FROM_ANY - (TEXT_FROM_STRING | TEXT_FROM_BYTES))
- )
- return_error(gs_error_rangecheck);
+ (TEXT_FROM_ANY - (TEXT_FROM_STRING | TEXT_FROM_BYTES))
+ )
+ return_error(gs_error_rangecheck);
if (pte->text.operation & TEXT_INTERVENE) {
- /* Not implemented. (PostScript doesn't even allow this case.) */
- return_error(gs_error_rangecheck);
+ /* Not implemented. (PostScript doesn't even allow this case.) */
+ return_error(gs_error_rangecheck);
}
total_width.x = total_width.y = 0;
curr = *penum;
@@ -72,105 +72,105 @@ process_composite_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
out.current_font = 0;
/* Scan runs of characters in the same leaf font. */
for ( ; ; ) {
- int font_code;
- gs_font *new_font = 0;
-
- gs_text_enum_copy_dynamic((gs_text_enum_t *)&out,
- (gs_text_enum_t *)&curr, false);
- for (;;) {
- gs_glyph glyph;
-
- gs_text_enum_copy_dynamic((gs_text_enum_t *)&prev,
- (gs_text_enum_t *)&curr, false);
- font_code = pte->orig_font->procs.next_char_glyph
- ((gs_text_enum_t *)&curr, &chr, &glyph);
- /*
- * We check for a font change by comparing the current
- * font, rather than testing the return code, because
- * it makes the control structure a little simpler.
- */
- switch (font_code) {
- case 0: /* no font change */
- case 1: /* font change */
- curr.returned.current_char = chr;
- char_code = gx_current_char((gs_text_enum_t *)&curr);
- new_font = curr.fstack.items[curr.fstack.depth].font;
- if (new_font != prev_font)
- break;
- if (chr != (byte)chr) /* probably can't happen */
- return_error(gs_error_rangecheck);
- if (buf_index >= bsize)
- return_error(gs_error_unregistered); /* Must not happen. */
- buf[buf_index] = (byte)chr;
- buf_index++;
- prev_font = new_font;
- psmat = &curr.fstack.items[curr.fstack.depth - 1].font->FontMatrix;
- if ((pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) &&
- pte->text.space.s_char == char_code)
- space_char = chr;
- continue;
- case 2: /* end of string */
- break;
- default: /* error */
- return font_code;
- }
- break;
- }
- str.size = buf_index;
- if (buf_index) {
- /* buf_index == 0 is only possible the very first time. */
- /*
- * The FontMatrix of leaf descendant fonts is not updated
- * by scalefont. Compute the effective FontMatrix now.
- */
- gs_matrix fmat;
-
- /* set up the base font : */
- out.fstack.depth = 0;
- out.fstack.items[out.fstack.depth].font = out.current_font = prev_font;
- pte->current_font = prev_font;
-
- /* Provide the decoded space character : */
- out.text.space.s_char = space_char;
-
- gs_matrix_multiply(&prev_font->FontMatrix, psmat, &fmat);
- out.index = 0; /* Note : we don't reset out.xy_index here. */
- code = pdf_process_string_aux(&out, &str, NULL, &fmat, &text_state);
- if (code < 0)
- return code;
- curr.xy_index = out.xy_index; /* pdf_encode_process_string advanced it. */
- if (out.index < str.size) {
- gs_glyph glyph;
-
- /* Advance *pte exactly for out.index chars,
- because above we stored bytes into buf. */
- while (out.index--)
- pte->orig_font->procs.next_char_glyph(pte, &chr, &glyph);
- font_code = 2; /* force exiting the loop */
- } else {
- /* advance *pte past the current substring */
- gs_text_enum_copy_dynamic(pte, (gs_text_enum_t *)&prev, true);
- }
- pte->xy_index = out.xy_index;
- if (return_width) {
- pte->returned.total_width.x = total_width.x +=
- out.returned.total_width.x;
- pte->returned.total_width.y = total_width.y +=
- out.returned.total_width.y;
- }
- pdf_text_release_cgp(penum);
- }
- if (font_code == 2)
- break;
- buf[0] = (byte)chr;
- buf_index = 1;
- space_char = ((pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) &&
- pte->text.space.s_char == char_code ? chr : ~0);
- psmat = &curr.fstack.items[curr.fstack.depth - 1].font->FontMatrix;
- prev_font = new_font;
+ int font_code;
+ gs_font *new_font = 0;
+
+ gs_text_enum_copy_dynamic((gs_text_enum_t *)&out,
+ (gs_text_enum_t *)&curr, false);
+ for (;;) {
+ gs_glyph glyph;
+
+ gs_text_enum_copy_dynamic((gs_text_enum_t *)&prev,
+ (gs_text_enum_t *)&curr, false);
+ font_code = pte->orig_font->procs.next_char_glyph
+ ((gs_text_enum_t *)&curr, &chr, &glyph);
+ /*
+ * We check for a font change by comparing the current
+ * font, rather than testing the return code, because
+ * it makes the control structure a little simpler.
+ */
+ switch (font_code) {
+ case 0: /* no font change */
+ case 1: /* font change */
+ curr.returned.current_char = chr;
+ char_code = gx_current_char((gs_text_enum_t *)&curr);
+ new_font = curr.fstack.items[curr.fstack.depth].font;
+ if (new_font != prev_font)
+ break;
+ if (chr != (byte)chr) /* probably can't happen */
+ return_error(gs_error_rangecheck);
+ if (buf_index >= bsize)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ buf[buf_index] = (byte)chr;
+ buf_index++;
+ prev_font = new_font;
+ psmat = &curr.fstack.items[curr.fstack.depth - 1].font->FontMatrix;
+ if ((pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) &&
+ pte->text.space.s_char == char_code)
+ space_char = chr;
+ continue;
+ case 2: /* end of string */
+ break;
+ default: /* error */
+ return font_code;
+ }
+ break;
+ }
+ str.size = buf_index;
+ if (buf_index) {
+ /* buf_index == 0 is only possible the very first time. */
+ /*
+ * The FontMatrix of leaf descendant fonts is not updated
+ * by scalefont. Compute the effective FontMatrix now.
+ */
+ gs_matrix fmat;
+
+ /* set up the base font : */
+ out.fstack.depth = 0;
+ out.fstack.items[out.fstack.depth].font = out.current_font = prev_font;
+ pte->current_font = prev_font;
+
+ /* Provide the decoded space character : */
+ out.text.space.s_char = space_char;
+
+ gs_matrix_multiply(&prev_font->FontMatrix, psmat, &fmat);
+ out.index = 0; /* Note : we don't reset out.xy_index here. */
+ code = pdf_process_string_aux(&out, &str, NULL, &fmat, &text_state);
+ if (code < 0)
+ return code;
+ curr.xy_index = out.xy_index; /* pdf_encode_process_string advanced it. */
+ if (out.index < str.size) {
+ gs_glyph glyph;
+
+ /* Advance *pte exactly for out.index chars,
+ because above we stored bytes into buf. */
+ while (out.index--)
+ pte->orig_font->procs.next_char_glyph(pte, &chr, &glyph);
+ font_code = 2; /* force exiting the loop */
+ } else {
+ /* advance *pte past the current substring */
+ gs_text_enum_copy_dynamic(pte, (gs_text_enum_t *)&prev, true);
+ }
+ pte->xy_index = out.xy_index;
+ if (return_width) {
+ pte->returned.total_width.x = total_width.x +=
+ out.returned.total_width.x;
+ pte->returned.total_width.y = total_width.y +=
+ out.returned.total_width.y;
+ }
+ pdf_text_release_cgp(penum);
+ }
+ if (font_code == 2)
+ break;
+ buf[0] = (byte)chr;
+ buf_index = 1;
+ space_char = ((pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) &&
+ pte->text.space.s_char == char_code ? chr : ~0);
+ psmat = &curr.fstack.items[curr.fstack.depth - 1].font->FontMatrix;
+ prev_font = new_font;
}
if (!return_width)
- return 0;
+ return 0;
return pdf_shift_text_currentpoint(penum, &total_width);
}
@@ -184,8 +184,7 @@ static const char *const standard_cmap_names[] = {
"UniGB-UTF16-H", "UniGB-UTF16-V",
-
- "GBKp-EUC-H", "GBKp-EUC-V",
+ "GBKp-EUC-H", "GBKp-EUC-V",
"HKscs-B5-H", "HKscs-B5-V",
"UniCNS-UTF16-H", "UniCNS-UTF16-V",
"UniJIS-UTF16-H", "UniJIS-UTF16-V",
@@ -219,7 +218,7 @@ static const char *const standard_cmap_names[] = {
"GB-EUC-H", "GB-EUC-V",
"GBpc-EUC-H"
-
+
"B5pc-H", "B5pc-V",
"ETen-B5-H", "ETen-B5-V",
"CNS-EUC-H", "CNS-EUC-V",
@@ -241,102 +240,102 @@ static const char *const standard_cmap_names[] = {
};
static int
-attach_cmap_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
- const gs_cmap_t *pcmap, int font_index_only)
+attach_cmap_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
+ const gs_cmap_t *pcmap, int font_index_only)
{
const char *const *pcmn =
- standard_cmap_names +
- (pdev->CompatibilityLevel < 1.3 ? END_PDF13_CMAP_NAMES_INDEX :
- pdev->CompatibilityLevel < 1.4 ? END_PDF14_CMAP_NAMES_INDEX :
- pdev->CompatibilityLevel < 1.5 ? END_PDF15_CMAP_NAMES_INDEX : 0);
+ standard_cmap_names +
+ (pdev->CompatibilityLevel < 1.3 ? END_PDF13_CMAP_NAMES_INDEX :
+ pdev->CompatibilityLevel < 1.4 ? END_PDF14_CMAP_NAMES_INDEX :
+ pdev->CompatibilityLevel < 1.5 ? END_PDF15_CMAP_NAMES_INDEX : 0);
bool is_identity = false;
pdf_resource_t *pcmres = 0; /* CMap */
int code;
/* Make sure cmap names is properly initialised. Silences Coverity warning */
if (!pcmn)
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
/*
* If the CMap isn't standard, write it out if necessary.
*/
for (; *pcmn != 0; ++pcmn)
- if (pcmap->CMapName.size == strlen(*pcmn) &&
- !memcmp(*pcmn, pcmap->CMapName.data, pcmap->CMapName.size))
- break;
+ if (pcmap->CMapName.size == strlen(*pcmn) &&
+ !memcmp(*pcmn, pcmap->CMapName.data, pcmap->CMapName.size))
+ break;
if (*pcmn == 0) {
- /*
- * PScript5.dll Version 5.2 creates identity CMaps with
- * instandard name. Check this specially here
- * and later replace with a standard name.
- * This is a temporary fix for SF bug #615994 "CMAP is corrupt".
- */
- is_identity = gs_cmap_is_identity(pcmap, font_index_only);
+ /*
+ * PScript5.dll Version 5.2 creates identity CMaps with
+ * instandard name. Check this specially here
+ * and later replace with a standard name.
+ * This is a temporary fix for SF bug #615994 "CMAP is corrupt".
+ */
+ is_identity = gs_cmap_is_identity(pcmap, font_index_only);
}
if (*pcmn == 0 && !is_identity) { /* not standard */
- pcmres = pdf_find_resource_by_gs_id(pdev, resourceCMap, pcmap->id + font_index_only);
- if (pcmres == 0) {
- /* Create and write the CMap object. */
- code = pdf_cmap_alloc(pdev, pcmap, &pcmres, font_index_only);
- if (code < 0)
- return code;
- }
+ pcmres = pdf_find_resource_by_gs_id(pdev, resourceCMap, pcmap->id + font_index_only);
+ if (pcmres == 0) {
+ /* Create and write the CMap object. */
+ code = pdf_cmap_alloc(pdev, pcmap, &pcmres, font_index_only);
+ if (code < 0)
+ return code;
+ }
}
if (pcmap->from_Unicode) {
- gs_cmap_ranges_enum_t renum;
-
- gs_cmap_ranges_enum_init(pcmap, &renum);
- if (gs_cmap_enum_next_range(&renum) == 0 && renum.range.size == 2 &&
- gs_cmap_enum_next_range(&renum) == 1) {
- /*
- * Exactly one code space range, of size 2. Add an identity
- * ToUnicode CMap.
- */
- if (!pdev->Identity_ToUnicode_CMaps[pcmap->WMode]) {
- /* Create and write an identity ToUnicode CMap now. */
- gs_cmap_t *pidcmap;
-
- code = gs_cmap_create_char_identity(&pidcmap, 2, pcmap->WMode,
- pdev->memory);
- if (code < 0)
- return code;
- pidcmap->CMapType = 2; /* per PDF Reference */
- pidcmap->ToUnicode = true;
- code = pdf_cmap_alloc(pdev, pidcmap,
- &pdev->Identity_ToUnicode_CMaps[pcmap->WMode], -1);
- if (code < 0)
- return code;
- }
- pdfont->res_ToUnicode = pdev->Identity_ToUnicode_CMaps[pcmap->WMode];
- }
+ gs_cmap_ranges_enum_t renum;
+
+ gs_cmap_ranges_enum_init(pcmap, &renum);
+ if (gs_cmap_enum_next_range(&renum) == 0 && renum.range.size == 2 &&
+ gs_cmap_enum_next_range(&renum) == 1) {
+ /*
+ * Exactly one code space range, of size 2. Add an identity
+ * ToUnicode CMap.
+ */
+ if (!pdev->Identity_ToUnicode_CMaps[pcmap->WMode]) {
+ /* Create and write an identity ToUnicode CMap now. */
+ gs_cmap_t *pidcmap;
+
+ code = gs_cmap_create_char_identity(&pidcmap, 2, pcmap->WMode,
+ pdev->memory);
+ if (code < 0)
+ return code;
+ pidcmap->CMapType = 2; /* per PDF Reference */
+ pidcmap->ToUnicode = true;
+ code = pdf_cmap_alloc(pdev, pidcmap,
+ &pdev->Identity_ToUnicode_CMaps[pcmap->WMode], -1);
+ if (code < 0)
+ return code;
+ }
+ pdfont->res_ToUnicode = pdev->Identity_ToUnicode_CMaps[pcmap->WMode];
+ }
}
if (pcmres || is_identity) {
- uint size = pcmap->CMapName.size;
- byte *chars = gs_alloc_string(pdev->pdf_memory, size,
- "pdf_font_resource_t(CMapName)");
-
- if (chars == 0)
- return_error(gs_error_VMerror);
- memcpy(chars, pcmap->CMapName.data, size);
- if (is_identity)
- strcpy(pdfont->u.type0.Encoding_name,
- (pcmap->WMode ? "/Identity-V" : "/Identity-H"));
- else
- sprintf(pdfont->u.type0.Encoding_name, "%ld 0 R",
- pdf_resource_id(pcmres));
- pdfont->u.type0.CMapName.data = chars;
- pdfont->u.type0.CMapName.size = size;
+ uint size = pcmap->CMapName.size;
+ byte *chars = gs_alloc_string(pdev->pdf_memory, size,
+ "pdf_font_resource_t(CMapName)");
+
+ if (chars == 0)
+ return_error(gs_error_VMerror);
+ memcpy(chars, pcmap->CMapName.data, size);
+ if (is_identity)
+ strcpy(pdfont->u.type0.Encoding_name,
+ (pcmap->WMode ? "/Identity-V" : "/Identity-H"));
+ else
+ sprintf(pdfont->u.type0.Encoding_name, "%ld 0 R",
+ pdf_resource_id(pcmres));
+ pdfont->u.type0.CMapName.data = chars;
+ pdfont->u.type0.CMapName.size = size;
} else {
- if (!*pcmn)
- /* Should not be possible, if *pcmn is NULL then either
- * is_identity is true or we create pcmres.
- */
- return_error(gs_error_invalidfont);
-
- sprintf(pdfont->u.type0.Encoding_name, "/%s", *pcmn);
- pdfont->u.type0.CMapName.data = (const byte *)*pcmn;
- pdfont->u.type0.CMapName.size = strlen(*pcmn);
- pdfont->u.type0.cmap_is_standard = true;
+ if (!*pcmn)
+ /* Should not be possible, if *pcmn is NULL then either
+ * is_identity is true or we create pcmres.
+ */
+ return_error(gs_error_invalidfont);
+
+ sprintf(pdfont->u.type0.Encoding_name, "/%s", *pcmn);
+ pdfont->u.type0.CMapName.data = (const byte *)*pcmn;
+ pdfont->u.type0.CMapName.size = strlen(*pcmn);
+ pdfont->u.type0.cmap_is_standard = true;
}
pdfont->u.type0.WMode = pcmap->WMode;
return 0;
@@ -366,376 +365,376 @@ scan_cmap_text(pdf_text_enum_t *pte, void *vbuf)
p.unused_offset = 0;
pte->returned.total_width.x = pte->returned.total_width.y = 0;;
for (;;) {
- uint break_index, break_xy_index;
- uint font_index = 0x7badf00d;
- gs_const_string str;
- pdf_text_process_state_t text_state;
- pdf_font_resource_t *pdsubf;
- gs_font *subfont = NULL;
- gs_point wxy;
- bool font_change = 0;
-
- code = gx_path_current_point(pte->path, &pte->origin);
- if (code < 0)
- return code;
+ uint break_index, break_xy_index;
+ uint font_index = 0x7badf00d;
+ gs_const_string str;
+ pdf_text_process_state_t text_state;
+ pdf_font_resource_t *pdsubf;
+ gs_font *subfont = NULL;
+ gs_point wxy;
+ bool font_change = 0;
+
+ code = gx_path_current_point(pte->path, &pte->origin);
+ if (code < 0)
+ return code;
do {
- gs_char chr;
- gs_glyph glyph;
- pdf_font_descriptor_t *pfd;
- byte *glyph_usage;
- double *real_widths, *w, *v, *w0;
- int char_cache_size, width_cache_size;
- gs_char cid;
-
- break_index = scan.index;
- break_xy_index = scan.xy_index;
- code = font->procs.next_char_glyph(&scan, &chr, &glyph);
- if (code == 2) { /* end of string */
- done = true;
- break;
- }
- if (code < 0)
- return code;
- subfont = scan.fstack.items[scan.fstack.depth].font;
- font_index = scan.fstack.items[scan.fstack.depth - 1].index;
- scan.xy_index++;
- if (glyph == GS_NO_GLYPH)
- glyph = GS_MIN_CID_GLYPH;
- cid = glyph - GS_MIN_CID_GLYPH;
- switch (subfont->FontType) {
- case ft_encrypted:
- case ft_encrypted2:{
- if (glyph == GS_MIN_CID_GLYPH) {
- glyph = subfont->procs.encode_char(subfont, chr, GLYPH_SPACE_NAME);
- }
- type1_glyphs[num_type1_glyphs] = glyph;
- num_type1_glyphs++;
- break;
- }
- case ft_CID_encrypted:
- case ft_CID_TrueType: {
- p.s[0].glyph = glyph;
- p.s[0].chr = cid;
- code = pdf_obtain_cidfont_resource(pdev, subfont, &pdsubf, &p);
- if (code < 0)
- return code;
- break;
- }
- case ft_user_defined: {
- gs_string str1;
-
- str1.data = NULL;
- str1.size = 0;
- pte->current_font = subfont;
- code = pdf_obtain_font_resource(pte, &str1, &pdsubf);
- if (code < 0)
- return code;
- cid = pdf_find_glyph(pdsubf, glyph);
- if (cid == GS_NO_CHAR) {
- code = pdf_make_font3_resource(pdev, subfont, &pdsubf);
- if (code < 0)
- return code;
- code = pdf_attach_font_resource(pdev, subfont, pdsubf);
- if (code < 0)
- return code;
- cid = 0;
- }
- break;
- }
- default:
- /* An unsupported case, fall back to default implementation. */
- return_error(gs_error_rangecheck);
- }
- code = pdf_attached_font_resource(pdev, (gs_font *)subfont, &pdsubf,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
- if (code < 0)
- return code;
- if (break_index > start_index && pdev->charproc_just_accumulated)
- break;
- if (subfont->FontType == ft_user_defined &&
- (break_index > start_index || !pdev->charproc_just_accumulated) &&
- !(pdsubf->u.simple.s.type3.cached[cid >> 3] & (0x80 >> (cid & 7)))) {
- pte->current_font = subfont;
- return gs_error_undefined;
- }
- if (subfont->FontType == ft_encrypted || subfont->FontType == ft_encrypted2) {
- font_change = (subfont != subfont0 && subfont0 != NULL);
- if (font_change) {
- saved_subfont = subfont;
- subfont = subfont0;
- num_type1_glyphs--;
- }
- } else
- font_change = (pdsubf != pdsubf0 && pdsubf0 != NULL);
- if (!font_change) {
- pdsubf0 = pdsubf;
- font_index0 = font_index;
- subfont0 = subfont;
- }
- if (subfont->FontType != ft_encrypted && subfont->FontType != ft_encrypted2) {
- pfd = pdsubf->FontDescriptor;
- code = pdf_resize_resource_arrays(pdev, pdsubf, cid + 1);
- if (code < 0)
- return code;
- if (subfont->FontType == ft_CID_encrypted || subfont->FontType == ft_CID_TrueType) {
- if (cid >=width_cache_size) {
- /* fixme: we add the CID=0 glyph as CID=cid glyph to the output font.
- Really it must not add and leave the CID undefined. */
- cid = 0; /* notdef. */
- }
- }
- if (cid >= char_cache_size || cid >= width_cache_size)
- return_error(gs_error_unregistered); /* Must not happen */
- if (pdsubf->FontType == ft_user_defined || pdsubf->FontType == ft_encrypted ||
- pdsubf->FontType == ft_encrypted2) {
- } else {
- pdf_font_resource_t *pdfont;
- bool notdef_subst = false;
-
- code = pdf_obtain_cidfont_widths_arrays(pdev, pdsubf, wmode, &w, &w0, &v);
- if (code < 0)
- return code;
- code = pdf_obtain_parent_type0_font_resource(pdev, pdsubf, font_index,
- &font->data.CMap->CMapName, &pdfont);
- if (code < 0)
- return code;
- if (pdf_is_CID_font(subfont)) {
- if (subfont->procs.decode_glyph((gs_font *)subfont, glyph, -1) != GS_NO_CHAR) {
- /* Since PScript5.dll creates GlyphNames2Unicode with character codes
- instead CIDs, and with the WinCharSetFFFF-H2 CMap
- character codes appears different than CIDs (Bug 687954),
- pass the character code intead the CID. */
- code = pdf_add_ToUnicode(pdev, subfont, pdfont,
- chr + GS_MIN_CID_GLYPH, chr, NULL);
- } else {
- /* If we interpret a PDF document, ToUnicode
- CMap may be attached to the Type 0 font. */
- code = pdf_add_ToUnicode(pdev, pte->orig_font, pdfont,
- chr + GS_MIN_CID_GLYPH, chr, NULL);
- }
- } else
- code = pdf_add_ToUnicode(pdev, subfont, pdfont, glyph, cid, NULL);
- if (code < 0)
- return code;
- /* We can't check pdsubf->used[cid >> 3] here,
- because it mixed data for different values of WMode.
- Perhaps pdf_font_used_glyph returns fast with reused glyphs.
- */
- code = pdf_font_used_glyph(pfd, glyph, (gs_font_base *)subfont);
- if (code == gs_error_rangecheck) {
- if (!(pdsubf->used[cid >> 3] & (0x80 >> (cid & 7)))) {
- char buf[gs_font_name_max + 1];
- int l = min(sizeof(buf) - 1, subfont->font_name.size);
-
- memcpy(buf, subfont->font_name.chars, l);
- buf[l] = 0;
- emprintf3(pdev->memory,
- "Missing glyph CID=%d, glyph=%04x in the font %s . The output PDF may fail with some viewers.\n",
- (int)cid,
+ gs_char chr;
+ gs_glyph glyph;
+ pdf_font_descriptor_t *pfd;
+ byte *glyph_usage;
+ double *real_widths, *w, *v, *w0;
+ int char_cache_size, width_cache_size;
+ gs_char cid;
+
+ break_index = scan.index;
+ break_xy_index = scan.xy_index;
+ code = font->procs.next_char_glyph(&scan, &chr, &glyph);
+ if (code == 2) { /* end of string */
+ done = true;
+ break;
+ }
+ if (code < 0)
+ return code;
+ subfont = scan.fstack.items[scan.fstack.depth].font;
+ font_index = scan.fstack.items[scan.fstack.depth - 1].index;
+ scan.xy_index++;
+ if (glyph == GS_NO_GLYPH)
+ glyph = GS_MIN_CID_GLYPH;
+ cid = glyph - GS_MIN_CID_GLYPH;
+ switch (subfont->FontType) {
+ case ft_encrypted:
+ case ft_encrypted2:{
+ if (glyph == GS_MIN_CID_GLYPH) {
+ glyph = subfont->procs.encode_char(subfont, chr, GLYPH_SPACE_NAME);
+ }
+ type1_glyphs[num_type1_glyphs] = glyph;
+ num_type1_glyphs++;
+ break;
+ }
+ case ft_CID_encrypted:
+ case ft_CID_TrueType: {
+ p.s[0].glyph = glyph;
+ p.s[0].chr = cid;
+ code = pdf_obtain_cidfont_resource(pdev, subfont, &pdsubf, &p);
+ if (code < 0)
+ return code;
+ break;
+ }
+ case ft_user_defined: {
+ gs_string str1;
+
+ str1.data = NULL;
+ str1.size = 0;
+ pte->current_font = subfont;
+ code = pdf_obtain_font_resource(pte, &str1, &pdsubf);
+ if (code < 0)
+ return code;
+ cid = pdf_find_glyph(pdsubf, glyph);
+ if (cid == GS_NO_CHAR) {
+ code = pdf_make_font3_resource(pdev, subfont, &pdsubf);
+ if (code < 0)
+ return code;
+ code = pdf_attach_font_resource(pdev, subfont, pdsubf);
+ if (code < 0)
+ return code;
+ cid = 0;
+ }
+ break;
+ }
+ default:
+ /* An unsupported case, fall back to default implementation. */
+ return_error(gs_error_rangecheck);
+ }
+ code = pdf_attached_font_resource(pdev, (gs_font *)subfont, &pdsubf,
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ if (code < 0)
+ return code;
+ if (break_index > start_index && pdev->charproc_just_accumulated)
+ break;
+ if (subfont->FontType == ft_user_defined &&
+ (break_index > start_index || !pdev->charproc_just_accumulated) &&
+ !(pdsubf->u.simple.s.type3.cached[cid >> 3] & (0x80 >> (cid & 7)))) {
+ pte->current_font = subfont;
+ return gs_error_undefined;
+ }
+ if (subfont->FontType == ft_encrypted || subfont->FontType == ft_encrypted2) {
+ font_change = (subfont != subfont0 && subfont0 != NULL);
+ if (font_change) {
+ saved_subfont = subfont;
+ subfont = subfont0;
+ num_type1_glyphs--;
+ }
+ } else
+ font_change = (pdsubf != pdsubf0 && pdsubf0 != NULL);
+ if (!font_change) {
+ pdsubf0 = pdsubf;
+ font_index0 = font_index;
+ subfont0 = subfont;
+ }
+ if (subfont->FontType != ft_encrypted && subfont->FontType != ft_encrypted2) {
+ pfd = pdsubf->FontDescriptor;
+ code = pdf_resize_resource_arrays(pdev, pdsubf, cid + 1);
+ if (code < 0)
+ return code;
+ if (subfont->FontType == ft_CID_encrypted || subfont->FontType == ft_CID_TrueType) {
+ if (cid >=width_cache_size) {
+ /* fixme: we add the CID=0 glyph as CID=cid glyph to the output font.
+ Really it must not add and leave the CID undefined. */
+ cid = 0; /* notdef. */
+ }
+ }
+ if (cid >= char_cache_size || cid >= width_cache_size)
+ return_error(gs_error_unregistered); /* Must not happen */
+ if (pdsubf->FontType == ft_user_defined || pdsubf->FontType == ft_encrypted ||
+ pdsubf->FontType == ft_encrypted2) {
+ } else {
+ pdf_font_resource_t *pdfont;
+ bool notdef_subst = false;
+
+ code = pdf_obtain_cidfont_widths_arrays(pdev, pdsubf, wmode, &w, &w0, &v);
+ if (code < 0)
+ return code;
+ code = pdf_obtain_parent_type0_font_resource(pdev, pdsubf, font_index,
+ &font->data.CMap->CMapName, &pdfont);
+ if (code < 0)
+ return code;
+ if (pdf_is_CID_font(subfont)) {
+ if (subfont->procs.decode_glyph((gs_font *)subfont, glyph, -1) != GS_NO_CHAR) {
+ /* Since PScript5.dll creates GlyphNames2Unicode with character codes
+ instead CIDs, and with the WinCharSetFFFF-H2 CMap
+ character codes appears different than CIDs (Bug 687954),
+ pass the character code intead the CID. */
+ code = pdf_add_ToUnicode(pdev, subfont, pdfont,
+ chr + GS_MIN_CID_GLYPH, chr, NULL);
+ } else {
+ /* If we interpret a PDF document, ToUnicode
+ CMap may be attached to the Type 0 font. */
+ code = pdf_add_ToUnicode(pdev, pte->orig_font, pdfont,
+ chr + GS_MIN_CID_GLYPH, chr, NULL);
+ }
+ } else
+ code = pdf_add_ToUnicode(pdev, subfont, pdfont, glyph, cid, NULL);
+ if (code < 0)
+ return code;
+ /* We can't check pdsubf->used[cid >> 3] here,
+ because it mixed data for different values of WMode.
+ Perhaps pdf_font_used_glyph returns fast with reused glyphs.
+ */
+ code = pdf_font_used_glyph(pfd, glyph, (gs_font_base *)subfont);
+ if (code == gs_error_rangecheck) {
+ if (!(pdsubf->used[cid >> 3] & (0x80 >> (cid & 7)))) {
+ char buf[gs_font_name_max + 1];
+ int l = min(sizeof(buf) - 1, subfont->font_name.size);
+
+ memcpy(buf, subfont->font_name.chars, l);
+ buf[l] = 0;
+ emprintf3(pdev->memory,
+ "Missing glyph CID=%d, glyph=%04x in the font %s . The output PDF may fail with some viewers.\n",
+ (int)cid,
(unsigned int)(glyph - GS_MIN_CID_GLYPH),
buf);
- pdsubf->used[cid >> 3] |= 0x80 >> (cid & 7);
- }
- cid = 0, code = 1; /* undefined glyph. */
- notdef_subst = true;
- /* If this is the first use of CID=0, get its width */
- if (pdsubf->Widths[cid] == 0) {
- pdf_glyph_widths_t widths;
-
- code = pdf_glyph_widths(pdsubf, wmode, glyph, (gs_font *)subfont, &widths,
- pte->cdevproc_callout ? pte->cdevproc_result : NULL);
- }
- } else if (code < 0)
- return code;
- if ((code == 0 /* just copied */ || pdsubf->Widths[cid] == 0) && !notdef_subst) {
- pdf_glyph_widths_t widths;
-
- code = pdf_glyph_widths(pdsubf, wmode, glyph, (gs_font *)subfont, &widths,
- pte->cdevproc_callout ? pte->cdevproc_result : NULL);
- if (code < 0)
- return code;
- if (code == TEXT_PROCESS_CDEVPROC) {
- pte->returned.current_glyph = glyph;
- pte->current_font = subfont;
- rcode = TEXT_PROCESS_CDEVPROC;
- break;
- }
- if (code == 0) { /* OK to cache */
- if (cid > pdsubf->count)
- return_error(gs_error_unregistered); /* Must not happen. */
- w[cid] = widths.Width.w;
- if (v != NULL) {
- v[cid * 2 + 0] = widths.Width.v.x;
- v[cid * 2 + 1] = widths.Width.v.y;
- }
- real_widths[cid] = widths.real_width.w;
- }
- if (wmode) {
- /* Since AR5 use W or DW to compute the x-coordinate of
- v-vector, comupte and store the glyph width for WMode 0. */
- /* fixme : skip computing real_width here. */
- code = pdf_glyph_widths(pdsubf, 0, glyph, (gs_font *)subfont, &widths,
- pte->cdevproc_callout ? pte->cdevproc_result : NULL);
- if (code < 0)
- return code;
- w0[cid] = widths.Width.w;
- }
- if (pdsubf->u.cidfont.CIDToGIDMap != 0) {
- gs_font_cid2 *subfont2 = (gs_font_cid2 *)subfont;
-
- pdsubf->u.cidfont.CIDToGIDMap[cid] =
- subfont2->cidata.CIDMap_proc(subfont2, glyph);
- }
- }
- if (wmode)
- pdsubf->u.cidfont.used2[cid >> 3] |= 0x80 >> (cid & 7);
- }
- pdsubf->used[cid >> 3] |= 0x80 >> (cid & 7);
- }
- if (pte->cdevproc_callout) {
- /* Only handle a single character because its width is stored
- into pte->cdevproc_result, and process_text_modify_width neds it.
+ pdsubf->used[cid >> 3] |= 0x80 >> (cid & 7);
+ }
+ cid = 0, code = 1; /* undefined glyph. */
+ notdef_subst = true;
+ /* If this is the first use of CID=0, get its width */
+ if (pdsubf->Widths[cid] == 0) {
+ pdf_glyph_widths_t widths;
+
+ code = pdf_glyph_widths(pdsubf, wmode, glyph, (gs_font *)subfont, &widths,
+ pte->cdevproc_callout ? pte->cdevproc_result : NULL);
+ }
+ } else if (code < 0)
+ return code;
+ if ((code == 0 /* just copied */ || pdsubf->Widths[cid] == 0) && !notdef_subst) {
+ pdf_glyph_widths_t widths;
+
+ code = pdf_glyph_widths(pdsubf, wmode, glyph, (gs_font *)subfont, &widths,
+ pte->cdevproc_callout ? pte->cdevproc_result : NULL);
+ if (code < 0)
+ return code;
+ if (code == TEXT_PROCESS_CDEVPROC) {
+ pte->returned.current_glyph = glyph;
+ pte->current_font = subfont;
+ rcode = TEXT_PROCESS_CDEVPROC;
+ break;
+ }
+ if (code == 0) { /* OK to cache */
+ if (cid > pdsubf->count)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ w[cid] = widths.Width.w;
+ if (v != NULL) {
+ v[cid * 2 + 0] = widths.Width.v.x;
+ v[cid * 2 + 1] = widths.Width.v.y;
+ }
+ real_widths[cid] = widths.real_width.w;
+ }
+ if (wmode) {
+ /* Since AR5 use W or DW to compute the x-coordinate of
+ v-vector, comupte and store the glyph width for WMode 0. */
+ /* fixme : skip computing real_width here. */
+ code = pdf_glyph_widths(pdsubf, 0, glyph, (gs_font *)subfont, &widths,
+ pte->cdevproc_callout ? pte->cdevproc_result : NULL);
+ if (code < 0)
+ return code;
+ w0[cid] = widths.Width.w;
+ }
+ if (pdsubf->u.cidfont.CIDToGIDMap != 0) {
+ gs_font_cid2 *subfont2 = (gs_font_cid2 *)subfont;
+
+ pdsubf->u.cidfont.CIDToGIDMap[cid] =
+ subfont2->cidata.CIDMap_proc(subfont2, glyph);
+ }
+ }
+ if (wmode)
+ pdsubf->u.cidfont.used2[cid >> 3] |= 0x80 >> (cid & 7);
+ }
+ pdsubf->used[cid >> 3] |= 0x80 >> (cid & 7);
+ }
+ if (pte->cdevproc_callout) {
+ /* Only handle a single character because its width is stored
+ into pte->cdevproc_result, and process_text_modify_width neds it.
fixme: next time take from w, v, real_widths. */
- break_index = scan.index;
- break_xy_index = scan.xy_index;
- break;
- }
- } while (!font_change);
- if (break_index > index) {
- pdf_font_resource_t *pdfont;
- gs_matrix m3;
- int xy_index_step = (!(pte->text.operation & TEXT_REPLACE_WIDTHS) ? 0 :
- pte->text.x_widths == pte->text.y_widths ? 2 : 1);
- gs_text_params_t save_text;
-
- if (!subfont && num_type1_glyphs != 0)
- subfont = subfont0;
- if (subfont && (subfont->FontType == ft_encrypted || subfont->FontType == ft_encrypted2)) {
- int save_op = pte->text.operation;
- gs_font *save_font = pte->current_font;
- const gs_glyph *save_data = pte->text.data.glyphs;
-
- pte->current_font = subfont;
- pte->text.operation |= TEXT_FROM_GLYPHS;
- pte->text.data.glyphs = type1_glyphs;
- str.data = ((const byte *)vbuf) + ((pte->text.size - pte->index) * sizeof(gs_glyph));
- str.size = num_type1_glyphs;
- code = pdf_obtain_font_resource_unencoded(pte, (const gs_string *)&str, &pdsubf0,
- type1_glyphs);
- if (code < 0) {
- /* Replace the modified values, fall back to default implementation
- * (type 3 bitmap image font)
- */
- pte->current_font = save_font;
- pte->text.operation |= save_op;
- pte->text.data.glyphs = save_data;
- return(code);
- }
- memcpy((void *)scan.text.data.bytes, (void *)str.data, str.size);
- str.data = scan.text.data.bytes;
- pdsubf = pdsubf0;
- pte->text.operation = save_op;
- }
- pte->current_font = subfont0;
- if (!subfont0 || !pdsubf0)
- /* This should be impossible */
- return_error(gs_error_invalidfont);
-
- code = gs_matrix_multiply(&subfont0->FontMatrix, &font->FontMatrix, &m3);
- /* We thought that it should be gs_matrix_multiply(&font->FontMatrix, &subfont0->FontMatrix, &m3); */
- if (code < 0)
- return code;
- if (pdsubf0->FontType == ft_user_defined || pdsubf->FontType == ft_encrypted ||
- pdsubf->FontType == ft_encrypted2)
- pdfont = pdsubf0;
- else {
- code = pdf_obtain_parent_type0_font_resource(pdev, pdsubf0, font_index0,
- &font->data.CMap->CMapName, &pdfont);
- if (code < 0)
- return code;
- if (!pdfont->u.type0.Encoding_name[0]) {
- /*
- * If pdfont->u.type0.Encoding_name is set,
- * a CMap resource is already attached.
- * See attach_cmap_resource.
- */
- code = attach_cmap_resource(pdev, pdfont, font->data.CMap, font_index0);
- if (code < 0)
- return code;
- }
- }
- pdf_set_text_wmode(pdev, font->WMode);
- code = pdf_update_text_state(&text_state, (pdf_text_enum_t *)pte, pdfont, &m3);
- if (code < 0)
- return code;
- /* process_text_modify_width breaks text parameters.
- We would like to improve it someday.
- Now save them locally and restore after the call. */
- save_text = pte->text;
- if (subfont && (subfont->FontType != ft_encrypted &&
- subfont->FontType != ft_encrypted2)) {
- /* If we are a type 1 descendant, we already sorted this out above */
- str.data = scan.text.data.bytes + index;
- str.size = break_index - index;
- }
- if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
- if (pte->text.x_widths != NULL)
- pte->text.x_widths += xy_index * xy_index_step;
- if (pte->text.y_widths != NULL)
- pte->text.y_widths += xy_index * xy_index_step;
- }
- pte->xy_index = 0;
- if (subfont && (subfont->FontType == ft_encrypted ||
- subfont->FontType == ft_encrypted2)) {
- gs_font *f = pte->orig_font;
-
- adjust_first_last_char(pdfont, (byte *)str.data, str.size);
-
- /* Make sure we use the descendant font, not the original type 0 ! */
- pte->orig_font = subfont;
- code = process_text_modify_width((pdf_text_enum_t *)pte,
- (gs_font *)subfont, &text_state, &str, &wxy, type1_glyphs, false);
- if (code < 0)
- return(code);
- if(font_change) {
- type1_glyphs[0] = type1_glyphs[num_type1_glyphs];
- num_type1_glyphs = 1;
- subfont = saved_subfont;
- } else {
- num_type1_glyphs = 0;
- }
- pte->orig_font = f;
- } else {
- code = process_text_modify_width((pdf_text_enum_t *)pte, (gs_font *)font,
- &text_state, &str, &wxy, NULL, true);
- }
- if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
- if (pte->text.x_widths != NULL)
- pte->text.x_widths -= xy_index * xy_index_step;
- if (pte->text.y_widths != NULL)
- pte->text.y_widths -= xy_index * xy_index_step;
- }
- pte->text = save_text;
- pte->cdevproc_callout = false;
- if (code < 0) {
- pte->index = index;
- pte->xy_index = xy_index;
- return code;
- }
- pte->index = break_index;
- pte->xy_index = break_xy_index;
- code = pdf_shift_text_currentpoint(pte, &wxy);
- if (code < 0)
- return code;
- }
- pdf_text_release_cgp(pte);
- index = break_index;
- xy_index = break_xy_index;
- if (done || rcode != 0)
- break;
- pdsubf0 = pdsubf;
- font_index0 = font_index;
- subfont0 = subfont;
+ break_index = scan.index;
+ break_xy_index = scan.xy_index;
+ break;
+ }
+ } while (!font_change);
+ if (break_index > index) {
+ pdf_font_resource_t *pdfont;
+ gs_matrix m3;
+ int xy_index_step = (!(pte->text.operation & TEXT_REPLACE_WIDTHS) ? 0 :
+ pte->text.x_widths == pte->text.y_widths ? 2 : 1);
+ gs_text_params_t save_text;
+
+ if (!subfont && num_type1_glyphs != 0)
+ subfont = subfont0;
+ if (subfont && (subfont->FontType == ft_encrypted || subfont->FontType == ft_encrypted2)) {
+ int save_op = pte->text.operation;
+ gs_font *save_font = pte->current_font;
+ const gs_glyph *save_data = pte->text.data.glyphs;
+
+ pte->current_font = subfont;
+ pte->text.operation |= TEXT_FROM_GLYPHS;
+ pte->text.data.glyphs = type1_glyphs;
+ str.data = ((const byte *)vbuf) + ((pte->text.size - pte->index) * sizeof(gs_glyph));
+ str.size = num_type1_glyphs;
+ code = pdf_obtain_font_resource_unencoded(pte, (const gs_string *)&str, &pdsubf0,
+ type1_glyphs);
+ if (code < 0) {
+ /* Replace the modified values, fall back to default implementation
+ * (type 3 bitmap image font)
+ */
+ pte->current_font = save_font;
+ pte->text.operation |= save_op;
+ pte->text.data.glyphs = save_data;
+ return(code);
+ }
+ memcpy((void *)scan.text.data.bytes, (void *)str.data, str.size);
+ str.data = scan.text.data.bytes;
+ pdsubf = pdsubf0;
+ pte->text.operation = save_op;
+ }
+ pte->current_font = subfont0;
+ if (!subfont0 || !pdsubf0)
+ /* This should be impossible */
+ return_error(gs_error_invalidfont);
+
+ code = gs_matrix_multiply(&subfont0->FontMatrix, &font->FontMatrix, &m3);
+ /* We thought that it should be gs_matrix_multiply(&font->FontMatrix, &subfont0->FontMatrix, &m3); */
+ if (code < 0)
+ return code;
+ if (pdsubf0->FontType == ft_user_defined || pdsubf->FontType == ft_encrypted ||
+ pdsubf->FontType == ft_encrypted2)
+ pdfont = pdsubf0;
+ else {
+ code = pdf_obtain_parent_type0_font_resource(pdev, pdsubf0, font_index0,
+ &font->data.CMap->CMapName, &pdfont);
+ if (code < 0)
+ return code;
+ if (!pdfont->u.type0.Encoding_name[0]) {
+ /*
+ * If pdfont->u.type0.Encoding_name is set,
+ * a CMap resource is already attached.
+ * See attach_cmap_resource.
+ */
+ code = attach_cmap_resource(pdev, pdfont, font->data.CMap, font_index0);
+ if (code < 0)
+ return code;
+ }
+ }
+ pdf_set_text_wmode(pdev, font->WMode);
+ code = pdf_update_text_state(&text_state, (pdf_text_enum_t *)pte, pdfont, &m3);
+ if (code < 0)
+ return code;
+ /* process_text_modify_width breaks text parameters.
+ We would like to improve it someday.
+ Now save them locally and restore after the call. */
+ save_text = pte->text;
+ if (subfont && (subfont->FontType != ft_encrypted &&
+ subfont->FontType != ft_encrypted2)) {
+ /* If we are a type 1 descendant, we already sorted this out above */
+ str.data = scan.text.data.bytes + index;
+ str.size = break_index - index;
+ }
+ if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
+ if (pte->text.x_widths != NULL)
+ pte->text.x_widths += xy_index * xy_index_step;
+ if (pte->text.y_widths != NULL)
+ pte->text.y_widths += xy_index * xy_index_step;
+ }
+ pte->xy_index = 0;
+ if (subfont && (subfont->FontType == ft_encrypted ||
+ subfont->FontType == ft_encrypted2)) {
+ gs_font *f = pte->orig_font;
+
+ adjust_first_last_char(pdfont, (byte *)str.data, str.size);
+
+ /* Make sure we use the descendant font, not the original type 0 ! */
+ pte->orig_font = subfont;
+ code = process_text_modify_width((pdf_text_enum_t *)pte,
+ (gs_font *)subfont, &text_state, &str, &wxy, type1_glyphs, false);
+ if (code < 0)
+ return(code);
+ if(font_change) {
+ type1_glyphs[0] = type1_glyphs[num_type1_glyphs];
+ num_type1_glyphs = 1;
+ subfont = saved_subfont;
+ } else {
+ num_type1_glyphs = 0;
+ }
+ pte->orig_font = f;
+ } else {
+ code = process_text_modify_width((pdf_text_enum_t *)pte, (gs_font *)font,
+ &text_state, &str, &wxy, NULL, true);
+ }
+ if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
+ if (pte->text.x_widths != NULL)
+ pte->text.x_widths -= xy_index * xy_index_step;
+ if (pte->text.y_widths != NULL)
+ pte->text.y_widths -= xy_index * xy_index_step;
+ }
+ pte->text = save_text;
+ pte->cdevproc_callout = false;
+ if (code < 0) {
+ pte->index = index;
+ pte->xy_index = xy_index;
+ return code;
+ }
+ pte->index = break_index;
+ pte->xy_index = break_xy_index;
+ code = pdf_shift_text_currentpoint(pte, &wxy);
+ if (code < 0)
+ return code;
+ }
+ pdf_text_release_cgp(pte);
+ index = break_index;
+ xy_index = break_xy_index;
+ if (done || rcode != 0)
+ break;
+ pdsubf0 = pdsubf;
+ font_index0 = font_index;
+ subfont0 = subfont;
}
pte->index = index;
pte->xy_index = xy_index;
@@ -749,18 +748,18 @@ process_cmap_text(gs_text_enum_t *penum, void *vbuf, uint bsize)
pdf_text_enum_t *pte = (pdf_text_enum_t *)penum;
if (pte->text.operation &
- (TEXT_FROM_ANY - (TEXT_FROM_STRING | TEXT_FROM_BYTES))
- )
- return_error(gs_error_rangecheck);
+ (TEXT_FROM_ANY - (TEXT_FROM_STRING | TEXT_FROM_BYTES))
+ )
+ return_error(gs_error_rangecheck);
if (pte->text.operation & TEXT_INTERVENE) {
- /* Not implemented. (PostScript doesn't allow TEXT_INTERVENE.) */
- return_error(gs_error_rangecheck);
+ /* Not implemented. (PostScript doesn't allow TEXT_INTERVENE.) */
+ return_error(gs_error_rangecheck);
}
code = scan_cmap_text(pte, vbuf);
if (code == TEXT_PROCESS_CDEVPROC)
- pte->cdevproc_callout = true;
+ pte->cdevproc_callout = true;
else
- pte->cdevproc_callout = false;
+ pte->cdevproc_callout = false;
return code;
}
@@ -785,16 +784,16 @@ process_cid_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
int code;
if (operation & TEXT_FROM_GLYPHS) {
- glyphs = pte->text.data.glyphs;
- size = pte->text.size - pte->index;
+ glyphs = pte->text.data.glyphs;
+ size = pte->text.size - pte->index;
} else if (operation & TEXT_FROM_SINGLE_GLYPH) {
- glyphs = &pte->text.data.d_glyph;
- size = 1;
+ glyphs = &pte->text.data.d_glyph;
+ size = 1;
} else if (operation & TEXT_FROM_STRING) {
- glyphs = &pte->outer_CID;
- size = 1;
+ glyphs = &pte->outer_CID;
+ size = 1;
} else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/*
* PDF doesn't support glyphshow directly: we need to create a Type 0
@@ -803,25 +802,25 @@ process_cid_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
* but this would require a different CMap.)
*/
if (bsize < size * 2)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
{
- int i;
- byte *pchars = vbuf;
+ int i;
+ byte *pchars = vbuf;
- for (i = 0; i < size; ++i) {
- ulong gnum = glyphs[i] - GS_MIN_CID_GLYPH;
+ for (i = 0; i < size; ++i) {
+ ulong gnum = glyphs[i] - GS_MIN_CID_GLYPH;
- if (gnum & ~0xffffL)
- return_error(gs_error_rangecheck);
- *pchars++ = (byte)(gnum >> 8);
- *pchars++ = (byte)gnum;
- }
+ if (gnum & ~0xffffL)
+ return_error(gs_error_rangecheck);
+ *pchars++ = (byte)(gnum >> 8);
+ *pchars++ = (byte)gnum;
+ }
}
/* Find the original (unscaled) version of this font. */
for (font = scaled_font; font->base != font; )
- font = font->base;
+ font = font->base;
/* Compute the scaling matrix. */
gs_matrix_invert(&font->FontMatrix, &scale_matrix);
gs_matrix_multiply(&scale_matrix, &scaled_font->FontMatrix, &scale_matrix);
@@ -830,19 +829,19 @@ process_cid_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
code = pdf_obtain_font_resource(penum, NULL, &pdsubf);
if (code < 0)
- return code;
+ return code;
/* Create the CMap and Type 0 font if they don't exist already. */
if (pdsubf->u.cidfont.glyphshow_font_id != 0)
- font0 = (gs_font_type0 *)gs_find_font_by_id(font->dir,
- pdsubf->u.cidfont.glyphshow_font_id, &scaled_font->FontMatrix);
+ font0 = (gs_font_type0 *)gs_find_font_by_id(font->dir,
+ pdsubf->u.cidfont.glyphshow_font_id, &scaled_font->FontMatrix);
if (font0 == NULL) {
- code = gs_font_type0_from_cidfont(&font0, font, font->WMode,
- &scale_matrix, font->memory);
- if (code < 0)
- return code;
- pdsubf->u.cidfont.glyphshow_font_id = font0->id;
+ code = gs_font_type0_from_cidfont(&font0, font, font->WMode,
+ &scale_matrix, font->memory);
+ if (code < 0)
+ return code;
+ pdsubf->u.cidfont.glyphshow_font_id = font0->id;
}
/* Now handle the glyphshow as a show in the Type 0 font. */
diff --git a/gs/base/gdevpdtd.c b/gs/base/gdevpdtd.c
index 3965162c5..641ca88ab 100644
--- a/gs/base/gdevpdtd.c
+++ b/gs/base/gdevpdtd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -104,9 +104,9 @@ struct pdf_font_descriptor_s {
font_type FontType; /* (copied from base_font) */
bool embed;
struct cid_ { /* (CIDFonts only) */
- cos_dict_t *Style;
- char Lang[3]; /* 2 chars + \0 */
- cos_dict_t *FD; /* value = COS_VALUE_RESOURCE */
+ cos_dict_t *Style;
+ char Lang[3]; /* 2 chars + \0 */
+ cos_dict_t *FD; /* value = COS_VALUE_RESOURCE */
} cid;
};
/*
@@ -155,7 +155,7 @@ pdf_font_descriptor_common_id(const pdf_font_descriptor_common_t *pfdc)
/* Write the common part of a FontDescriptor, aside from the final >>. */
static int
write_FontDescriptor_common(gx_device_pdf *pdev,
- const pdf_font_descriptor_common_t *pfd)
+ const pdf_font_descriptor_common_t *pfd)
{
stream *s;
int code;
@@ -173,38 +173,38 @@ write_FontDescriptor_common(gx_device_pdf *pdev,
if (code >= 0) {
#define DESC_INT(str, memb)\
{str, gs_param_type_int, offset_of(pdf_font_descriptor_common_t, values.memb)}
- static const gs_param_item_t required_items[] = {
- DESC_INT("Ascent", Ascent),
- DESC_INT("CapHeight", CapHeight),
- DESC_INT("Descent", Descent),
- DESC_INT("ItalicAngle", ItalicAngle),
- DESC_INT("StemV", StemV),
- gs_param_item_end
- };
- static const gs_param_item_t optional_items[] = {
- DESC_INT("AvgWidth", AvgWidth),
- DESC_INT("Leading", Leading),
- DESC_INT("MaxWidth", MaxWidth),
- DESC_INT("MissingWidth", MissingWidth),
- DESC_INT("StemH", StemH),
- DESC_INT("XHeight", XHeight),
- gs_param_item_end
- };
+ static const gs_param_item_t required_items[] = {
+ DESC_INT("Ascent", Ascent),
+ DESC_INT("CapHeight", CapHeight),
+ DESC_INT("Descent", Descent),
+ DESC_INT("ItalicAngle", ItalicAngle),
+ DESC_INT("StemV", StemV),
+ gs_param_item_end
+ };
+ static const gs_param_item_t optional_items[] = {
+ DESC_INT("AvgWidth", AvgWidth),
+ DESC_INT("Leading", Leading),
+ DESC_INT("MaxWidth", MaxWidth),
+ DESC_INT("MissingWidth", MissingWidth),
+ DESC_INT("StemH", StemH),
+ DESC_INT("XHeight", XHeight),
+ gs_param_item_end
+ };
#undef DESC_INT
- int Flags = pfd->values.Flags;
- pdf_font_descriptor_t defaults;
-
- code = param_write_int(plist, "Flags", &Flags);
- if (code < 0)
- return code;
- code = gs_param_write_items(plist, pfd, NULL, required_items);
- if (code < 0)
- return code;
- memset(&defaults, 0, sizeof(defaults));
- code = gs_param_write_items(plist, pfd, &defaults, optional_items);
- if (code < 0)
- return code;
- s_release_param_printer(&rlist);
+ int Flags = pfd->values.Flags;
+ pdf_font_descriptor_t defaults;
+
+ code = param_write_int(plist, "Flags", &Flags);
+ if (code < 0)
+ return code;
+ code = gs_param_write_items(plist, pfd, NULL, required_items);
+ if (code < 0)
+ return code;
+ memset(&defaults, 0, sizeof(defaults));
+ code = gs_param_write_items(plist, pfd, &defaults, optional_items);
+ if (code < 0)
+ return code;
+ s_release_param_printer(&rlist);
}
return 0;
}
@@ -217,25 +217,25 @@ write_FontDescriptor_common(gx_device_pdf *pdev,
*/
int
pdf_font_descriptor_alloc(gx_device_pdf *pdev, pdf_font_descriptor_t **ppfd,
- gs_font_base *font, bool embed)
+ gs_font_base *font, bool embed)
{
pdf_font_descriptor_t *pfd;
pdf_base_font_t *pbfont;
- int code = pdf_base_font_alloc(pdev, &pbfont, font,
- (font->orig_FontMatrix.xx == 0 && font->orig_FontMatrix.xy == 0
- ? &font->FontMatrix : &font->orig_FontMatrix), false);
+ int code = pdf_base_font_alloc(pdev, &pbfont, font,
+ (font->orig_FontMatrix.xx == 0 && font->orig_FontMatrix.xy == 0
+ ? &font->FontMatrix : &font->orig_FontMatrix), false);
if (code < 0)
- return code;
+ return code;
code = pdf_alloc_resource(pdev, resourceFontDescriptor,
- font->id, (pdf_resource_t **)&pfd, -1L);
+ font->id, (pdf_resource_t **)&pfd, -1L);
if (code < 0) {
- gs_free_object(pdev->pdf_memory, pbfont,
- "pdf_font_descriptor_alloc(base_font)");
- return code;
+ gs_free_object(pdev->pdf_memory, pbfont,
+ "pdf_font_descriptor_alloc(base_font)");
+ return code;
}
memset(&pfd->common.values, 0,
- sizeof(*pfd) - offset_of(pdf_font_descriptor_t, common.values));
+ sizeof(*pfd) - offset_of(pdf_font_descriptor_t, common.values));
pfd->base_font = pbfont;
pfd->FontType = font->FontType;
pfd->embed = embed;
@@ -320,7 +320,7 @@ gs_string *pdf_font_descriptor_base_name(const pdf_font_descriptor_t *pfd)
*/
int
pdf_font_used_glyph(pdf_font_descriptor_t *pfd, gs_glyph glyph,
- gs_font_base *font)
+ gs_font_base *font)
{
return pdf_base_font_copy_glyph(pfd->base_font, glyph, font);
}
@@ -334,7 +334,7 @@ pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
int index;
int wmode = bfont->WMode;
int members = (GLYPH_INFO_WIDTH0 << wmode) |
- GLYPH_INFO_BBOX | GLYPH_INFO_NUM_PIECES;
+ GLYPH_INFO_BBOX | GLYPH_INFO_NUM_PIECES;
pdf_font_descriptor_values_t desc;
gs_matrix smat;
gs_matrix *pmat = NULL;
@@ -345,7 +345,7 @@ pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
int cap_height = 0;
gs_rect bbox_colon, bbox_period, bbox_I;
bool is_cid = (bfont->FontType == ft_CID_encrypted ||
- bfont->FontType == ft_CID_TrueType);
+ bfont->FontType == ft_CID_TrueType);
bool have_colon = false, have_period = false, have_I = false;
int code;
@@ -354,18 +354,18 @@ pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
memset(&bbox_I, 0, sizeof(bbox_I)); /* quiet gcc warnings. */
memset(&desc, 0, sizeof(desc));
if (is_cid && bfont->FontBBox.p.x != bfont->FontBBox.q.x &&
- bfont->FontBBox.p.y != bfont->FontBBox.q.y) {
- int scale = (bfont->FontType == ft_TrueType || bfont->FontType == ft_CID_TrueType ? 1000 : 1);
-
- desc.FontBBox.p.x = (int)(bfont->FontBBox.p.x * scale);
- desc.FontBBox.p.y = (int)(bfont->FontBBox.p.y * scale);
- desc.FontBBox.q.x = (int)(bfont->FontBBox.q.x * scale);
- desc.FontBBox.q.y = (int)(bfont->FontBBox.q.y * scale);
- desc.Ascent = desc.FontBBox.q.y;
- members &= ~GLYPH_INFO_BBOX;
+ bfont->FontBBox.p.y != bfont->FontBBox.q.y) {
+ int scale = (bfont->FontType == ft_TrueType || bfont->FontType == ft_CID_TrueType ? 1000 : 1);
+
+ desc.FontBBox.p.x = (int)(bfont->FontBBox.p.x * scale);
+ desc.FontBBox.p.y = (int)(bfont->FontBBox.p.y * scale);
+ desc.FontBBox.q.x = (int)(bfont->FontBBox.q.x * scale);
+ desc.FontBBox.q.y = (int)(bfont->FontBBox.q.y * scale);
+ desc.Ascent = desc.FontBBox.q.y;
+ members &= ~GLYPH_INFO_BBOX;
} else {
- desc.FontBBox.p.x = desc.FontBBox.p.y = max_int;
- desc.FontBBox.q.x = desc.FontBBox.q.y = min_int;
+ desc.FontBBox.p.x = desc.FontBBox.p.y = max_int;
+ desc.FontBBox.q.x = desc.FontBBox.q.y = min_int;
}
/*
* Embedded TrueType fonts use a 1000-unit character space, but the
@@ -374,23 +374,23 @@ pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
switch (bfont->FontType) {
case ft_TrueType:
case ft_CID_TrueType:
- gs_make_scaling(1000.0, 1000.0, &smat);
- pmat = &smat;
- /* Type 3 fonts may use a FontMatrix in PDF, so we don't
- * need to deal with non-standard matrices
- */
+ gs_make_scaling(1000.0, 1000.0, &smat);
+ pmat = &smat;
+ /* Type 3 fonts may use a FontMatrix in PDF, so we don't
+ * need to deal with non-standard matrices
+ */
case ft_user_defined:
- break;
- /* Other font types may use a non-standard (not 1000x1000) design grid
- * The FontMatrix is used to map to the unit square. However PDF files
- * don't allow FontMatrix entries, all fonts are nominally 1000x1000.
- * If we have a font with a non-standard matrix we must account for that
- * here by scaling the font outline.
- */
- default:
- gs_matrix_scale(&bfont->FontMatrix, 1000.0, 1000.0, &smat);
- pmat = &smat;
- break;
+ break;
+ /* Other font types may use a non-standard (not 1000x1000) design grid
+ * The FontMatrix is used to map to the unit square. However PDF files
+ * don't allow FontMatrix entries, all fonts are nominally 1000x1000.
+ * If we have a font with a non-standard matrix we must account for that
+ * here by scaling the font outline.
+ */
+ default:
+ gs_matrix_scale(&bfont->FontMatrix, 1000.0, 1000.0, &smat);
+ pmat = &smat;
+ break;
}
/*
@@ -403,177 +403,177 @@ pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
*/
notdef = GS_NO_GLYPH;
for (index = 0;
- (bfont->procs.enumerate_glyph((gs_font *)bfont, &index,
- (is_cid ? GLYPH_SPACE_INDEX : GLYPH_SPACE_NAME), &glyph)) >= 0 &&
- index != 0;
- ) {
- gs_glyph_info_t info;
- gs_const_string gname;
- gs_glyph glyph_known_enc;
- gs_char position=0;
-
- code = bfont->procs.glyph_info((gs_font *)bfont, glyph, pmat, members, &info);
- if (code == gs_error_VMerror)
- return code;
- if (code < 0) {
- /*
- * Since this function may be indirtectly called from gx_device_finalize,
- * we are unable to propagate error code to the interpreter.
- * Therefore we skip it here hoping that few errors can be
- * recovered by the integration through entire glyph set.
- */
- continue;
- }
- if (members & GLYPH_INFO_BBOX) {
- /* rect_merge(desc.FontBBox, info.bbox); Expanding due to type cast :*/
- if (info.bbox.p.x < desc.FontBBox.p.x) desc.FontBBox.p.x = (int)info.bbox.p.x;
- if (info.bbox.q.x > desc.FontBBox.q.x) desc.FontBBox.q.x = (int)info.bbox.q.x;
- if (info.bbox.p.y < desc.FontBBox.p.y) desc.FontBBox.p.y = (int)info.bbox.p.y;
- if (info.bbox.q.y > desc.FontBBox.q.y) desc.FontBBox.q.y = (int)info.bbox.q.y;
- if (!info.num_pieces)
- desc.Ascent = max(desc.Ascent, (int)info.bbox.q.y);
- }
- if (notdef == GS_NO_GLYPH && gs_font_glyph_is_notdef(bfont, glyph)) {
- notdef = glyph;
- desc.MissingWidth = (int)info.width[wmode].x;
- }
- if (info.width[wmode].y != 0)
- fixed_width = min_int;
- else if (fixed_width == 0)
- fixed_width = (int)info.width[wmode].x;
- else if (info.width[wmode].x != fixed_width)
- fixed_width = min_int;
- if (desc.Flags & FONT_IS_SYMBOLIC)
- continue; /* skip Roman-only computation */
- if (is_cid)
- continue;
- code = bfont->procs.glyph_name((gs_font *)bfont, glyph, &gname);
- if (code < 0) {
- /* If we fail to get the glyph name, best assume this is a symbolic font */
- desc.Flags |= FONT_IS_SYMBOLIC;
- continue;
- }
- /* See if the glyph name is in any of the known encodings */
+ (bfont->procs.enumerate_glyph((gs_font *)bfont, &index,
+ (is_cid ? GLYPH_SPACE_INDEX : GLYPH_SPACE_NAME), &glyph)) >= 0 &&
+ index != 0;
+ ) {
+ gs_glyph_info_t info;
+ gs_const_string gname;
+ gs_glyph glyph_known_enc;
+ gs_char position=0;
+
+ code = bfont->procs.glyph_info((gs_font *)bfont, glyph, pmat, members, &info);
+ if (code == gs_error_VMerror)
+ return code;
+ if (code < 0) {
+ /*
+ * Since this function may be indirtectly called from gx_device_finalize,
+ * we are unable to propagate error code to the interpreter.
+ * Therefore we skip it here hoping that few errors can be
+ * recovered by the integration through entire glyph set.
+ */
+ continue;
+ }
+ if (members & GLYPH_INFO_BBOX) {
+ /* rect_merge(desc.FontBBox, info.bbox); Expanding due to type cast :*/
+ if (info.bbox.p.x < desc.FontBBox.p.x) desc.FontBBox.p.x = (int)info.bbox.p.x;
+ if (info.bbox.q.x > desc.FontBBox.q.x) desc.FontBBox.q.x = (int)info.bbox.q.x;
+ if (info.bbox.p.y < desc.FontBBox.p.y) desc.FontBBox.p.y = (int)info.bbox.p.y;
+ if (info.bbox.q.y > desc.FontBBox.q.y) desc.FontBBox.q.y = (int)info.bbox.q.y;
+ if (!info.num_pieces)
+ desc.Ascent = max(desc.Ascent, (int)info.bbox.q.y);
+ }
+ if (notdef == GS_NO_GLYPH && gs_font_glyph_is_notdef(bfont, glyph)) {
+ notdef = glyph;
+ desc.MissingWidth = (int)info.width[wmode].x;
+ }
+ if (info.width[wmode].y != 0)
+ fixed_width = min_int;
+ else if (fixed_width == 0)
+ fixed_width = (int)info.width[wmode].x;
+ else if (info.width[wmode].x != fixed_width)
+ fixed_width = min_int;
+ if (desc.Flags & FONT_IS_SYMBOLIC)
+ continue; /* skip Roman-only computation */
+ if (is_cid)
+ continue;
+ code = bfont->procs.glyph_name((gs_font *)bfont, glyph, &gname);
+ if (code < 0) {
+ /* If we fail to get the glyph name, best assume this is a symbolic font */
+ desc.Flags |= FONT_IS_SYMBOLIC;
+ continue;
+ }
+ /* See if the glyph name is in any of the known encodings */
glyph_known_enc = gs_c_name_glyph(gname.data, gname.size);
- if (glyph_known_enc == gs_no_glyph) {
- desc.Flags |= FONT_IS_SYMBOLIC;
- continue;
- }
- /* Finally check if the encoded glyph is in Standard Encoding */
- /* gs_c_decode always fails to find .notdef, its always present so
- * don't worry about it
- */
- if(strncmp(".notdef", (const char *)gname.data, gname.size)) {
- position = gs_c_decode(glyph_known_enc, 0);
- if (position == GS_NO_CHAR) {
- desc.Flags |= FONT_IS_SYMBOLIC;
- continue;
- }
- }
+ if (glyph_known_enc == gs_no_glyph) {
+ desc.Flags |= FONT_IS_SYMBOLIC;
+ continue;
+ }
+ /* Finally check if the encoded glyph is in Standard Encoding */
+ /* gs_c_decode always fails to find .notdef, its always present so
+ * don't worry about it
+ */
+ if(strncmp(".notdef", (const char *)gname.data, gname.size)) {
+ position = gs_c_decode(glyph_known_enc, 0);
+ if (position == GS_NO_CHAR) {
+ desc.Flags |= FONT_IS_SYMBOLIC;
+ continue;
+ }
+ }
switch (gname.size) {
- case 5:
- if (!memcmp(gname.data, "colon", 5))
- bbox_colon = info.bbox, have_colon = true;
- continue;
- case 6:
- if (!memcmp(gname.data, "period", 6))
- bbox_period = info.bbox, have_period = true;
- continue;
- case 1:
- break;
- default:
- continue;
- }
-
- if (gname.data[0] >= 'A' && gname.data[0] <= 'Z') {
- cap_height = max(cap_height, (int)info.bbox.q.y);
- if (gname.data[0] == 'I')
- bbox_I = info.bbox, have_I = true;
- } else if (gname.data[0] >= 'a' && gname.data[0] <= 'z') {
- int y0 = (int)(info.bbox.p.y), y1 = (int)(info.bbox.q.y);
-
- small_present = true;
- switch (gname.data[0]) {
- case 'b': case 'd': case 'f': case 'h':
- case 'k': case 'l': case 't': /* ascender */
- small_height = max(small_height, y1);
- case 'i': /* anomalous ascent */
- break;
- case 'j': /* descender with anomalous ascent */
- small_descent = min(small_descent, y0);
- break;
- case 'g': case 'p': case 'q': case 'y': /* descender */
- small_descent = min(small_descent, y0);
- default: /* no ascender or descender */
- x_height = max(x_height, y1);
- }
- }
+ case 5:
+ if (!memcmp(gname.data, "colon", 5))
+ bbox_colon = info.bbox, have_colon = true;
+ continue;
+ case 6:
+ if (!memcmp(gname.data, "period", 6))
+ bbox_period = info.bbox, have_period = true;
+ continue;
+ case 1:
+ break;
+ default:
+ continue;
+ }
+
+ if (gname.data[0] >= 'A' && gname.data[0] <= 'Z') {
+ cap_height = max(cap_height, (int)info.bbox.q.y);
+ if (gname.data[0] == 'I')
+ bbox_I = info.bbox, have_I = true;
+ } else if (gname.data[0] >= 'a' && gname.data[0] <= 'z') {
+ int y0 = (int)(info.bbox.p.y), y1 = (int)(info.bbox.q.y);
+
+ small_present = true;
+ switch (gname.data[0]) {
+ case 'b': case 'd': case 'f': case 'h':
+ case 'k': case 'l': case 't': /* ascender */
+ small_height = max(small_height, y1);
+ case 'i': /* anomalous ascent */
+ break;
+ case 'j': /* descender with anomalous ascent */
+ small_descent = min(small_descent, y0);
+ break;
+ case 'g': case 'p': case 'q': case 'y': /* descender */
+ small_descent = min(small_descent, y0);
+ default: /* no ascender or descender */
+ x_height = max(x_height, y1);
+ }
+ }
}
if (!(desc.Flags & FONT_IS_SYMBOLIC)) {
- desc.Flags |= FONT_IS_ADOBE_ROMAN; /* required if not symbolic */
- desc.XHeight = (int)x_height;
- if (!small_present && (!pdev->PDFA || bfont->FontType != ft_TrueType))
- desc.Flags |= FONT_IS_ALL_CAPS;
- desc.CapHeight = cap_height;
- /*
- * Look at various glyphs to determine ItalicAngle, StemV,
- * SERIF, SCRIPT, and ITALIC.
- */
- if (have_colon && have_period) {
- /* Calculate the dominant angle. */
- int angle =
- (int)(atan2((bbox_colon.q.y - bbox_colon.p.y) -
- (bbox_period.q.y - bbox_period.p.y),
- (bbox_colon.q.x - bbox_colon.p.x) -
- (bbox_period.q.x - bbox_period.p.x)) *
- radians_to_degrees) - 90;
-
- /* Normalize to [-90..90]. */
- while (angle > 90)
- angle -= 180;
- while (angle < -90)
- angle += 180;
- if (angle < -30)
- angle = -30;
- else if (angle > 30)
- angle = 30;
- /*
- * For script or embellished fonts, we can get an angle that is
- * slightly off from zero even for non-italic fonts.
- * Compensate for this now.
- */
- if (angle <= 2 && angle >= -2)
- angle = 0;
- desc.ItalicAngle = angle;
- }
- if (desc.ItalicAngle)
- desc.Flags |= FONT_IS_ITALIC;
- if (have_I) {
- double wdot = bbox_period.q.x - bbox_period.p.x;
- double wcolon = bbox_I.q.x - bbox_I.p.x;
- double wI = bbox_period.q.x - bbox_period.p.x;
-
- desc.StemV = (int)wdot;
- if (wI > wcolon * 2.5 || wI > (bbox_period.q.y - bbox_period.p.y) * 0.25)
- desc.Flags |= FONT_IS_SERIF;
- }
+ desc.Flags |= FONT_IS_ADOBE_ROMAN; /* required if not symbolic */
+ desc.XHeight = (int)x_height;
+ if (!small_present && (!pdev->PDFA || bfont->FontType != ft_TrueType))
+ desc.Flags |= FONT_IS_ALL_CAPS;
+ desc.CapHeight = cap_height;
+ /*
+ * Look at various glyphs to determine ItalicAngle, StemV,
+ * SERIF, SCRIPT, and ITALIC.
+ */
+ if (have_colon && have_period) {
+ /* Calculate the dominant angle. */
+ int angle =
+ (int)(atan2((bbox_colon.q.y - bbox_colon.p.y) -
+ (bbox_period.q.y - bbox_period.p.y),
+ (bbox_colon.q.x - bbox_colon.p.x) -
+ (bbox_period.q.x - bbox_period.p.x)) *
+ radians_to_degrees) - 90;
+
+ /* Normalize to [-90..90]. */
+ while (angle > 90)
+ angle -= 180;
+ while (angle < -90)
+ angle += 180;
+ if (angle < -30)
+ angle = -30;
+ else if (angle > 30)
+ angle = 30;
+ /*
+ * For script or embellished fonts, we can get an angle that is
+ * slightly off from zero even for non-italic fonts.
+ * Compensate for this now.
+ */
+ if (angle <= 2 && angle >= -2)
+ angle = 0;
+ desc.ItalicAngle = angle;
+ }
+ if (desc.ItalicAngle)
+ desc.Flags |= FONT_IS_ITALIC;
+ if (have_I) {
+ double wdot = bbox_period.q.x - bbox_period.p.x;
+ double wcolon = bbox_I.q.x - bbox_I.p.x;
+ double wI = bbox_period.q.x - bbox_period.p.x;
+
+ desc.StemV = (int)wdot;
+ if (wI > wcolon * 2.5 || wI > (bbox_period.q.y - bbox_period.p.y) * 0.25)
+ desc.Flags |= FONT_IS_SERIF;
+ }
}
if (desc.Ascent == 0)
- desc.Ascent = desc.FontBBox.q.y;
+ desc.Ascent = desc.FontBBox.q.y;
desc.Descent = desc.FontBBox.p.y;
if (!(desc.Flags & (FONT_IS_SYMBOLIC | FONT_IS_ALL_CAPS)) &&
- (small_descent > desc.Descent / 3 || desc.XHeight > small_height * 0.9) &&
- (!pdev->PDFA || bfont->FontType != ft_TrueType)
- )
- desc.Flags |= FONT_IS_SMALL_CAPS;
+ (small_descent > desc.Descent / 3 || desc.XHeight > small_height * 0.9) &&
+ (!pdev->PDFA || bfont->FontType != ft_TrueType)
+ )
+ desc.Flags |= FONT_IS_SMALL_CAPS;
if (fixed_width > 0 && (!pdev->PDFA || bfont->FontType != ft_TrueType)) {
- desc.Flags |= FONT_IS_FIXED_WIDTH;
- desc.AvgWidth = desc.MaxWidth = desc.MissingWidth = fixed_width;
+ desc.Flags |= FONT_IS_FIXED_WIDTH;
+ desc.AvgWidth = desc.MaxWidth = desc.MissingWidth = fixed_width;
}
if (desc.CapHeight == 0)
- desc.CapHeight = desc.Ascent;
+ desc.CapHeight = desc.Ascent;
if (desc.StemV == 0)
- desc.StemV = (int)(desc.FontBBox.q.x * 0.15);
+ desc.StemV = (int)(desc.FontBBox.q.x * 0.15);
pfd->common.values = desc;
return 0;
}
@@ -589,15 +589,15 @@ pdf_finish_FontDescriptor(gx_device_pdf *pdev, pdf_resource_t *pres)
int code = 0;
cos_dict_t *pcd = 0;
if (pfd->common.object->id == -1)
- return 0;
+ return 0;
if (!pfd->common.object->written &&
- (code = pdf_compute_font_descriptor(pdev, pfd)) >= 0 &&
- (!pfd->embed ||
- (code = pdf_write_embedded_font(pdev, pfd->base_font,
- pfd->FontType,
- &pfd->common.values.FontBBox,
- pfd->common.rid, &pcd)) >= 0)
- ) {
+ (code = pdf_compute_font_descriptor(pdev, pfd)) >= 0 &&
+ (!pfd->embed ||
+ (code = pdf_write_embedded_font(pdev, pfd->base_font,
+ pfd->FontType,
+ &pfd->common.values.FontBBox,
+ pfd->common.rid, &pcd)) >= 0)
+ ) {
pdf_set_FontFile_object(pfd->base_font, pcd);
}
return code;
@@ -614,76 +614,76 @@ pdf_write_FontDescriptor(gx_device_pdf *pdev, pdf_resource_t *pres)
stream *s;
if (pfd->common.object->written)
- return 0;
+ return 0;
if (pfd->common.object->id == -1)
- return 0;
+ return 0;
/* If this is a CIDFont subset, write the CIDSet now. */
switch (ftype) {
case ft_CID_encrypted:
case ft_CID_TrueType:
- if (pdf_do_subset_font(pdev, pfd->base_font, pfd->common.rid)) {
- code = pdf_write_CIDSet(pdev, pfd->base_font, &cidset_id);
- if (code < 0)
- return code;
- }
+ if (pdf_do_subset_font(pdev, pfd->base_font, pfd->common.rid)) {
+ code = pdf_write_CIDSet(pdev, pfd->base_font, &cidset_id);
+ if (code < 0)
+ return code;
+ }
default:
- break;
+ break;
}
{
- /*
- * Hack: make all embedded subset TrueType fonts "symbolic" to
- * work around undocumented assumptions in Acrobat Reader.
- */
- pdf_font_descriptor_common_t fd;
-
- fd = pfd->common;
- if (pfd->embed && pfd->FontType == ft_TrueType /*&& !pdev->PDFA*/ &&
- pdf_do_subset_font(pdev, pfd->base_font, pfd->common.rid)
- )
- fd.values.Flags =
- (fd.values.Flags & ~(FONT_IS_ADOBE_ROMAN)) | FONT_IS_SYMBOLIC;
- code = write_FontDescriptor_common(pdev, &fd);
+ /*
+ * Hack: make all embedded subset TrueType fonts "symbolic" to
+ * work around undocumented assumptions in Acrobat Reader.
+ */
+ pdf_font_descriptor_common_t fd;
+
+ fd = pfd->common;
+ if (pfd->embed && pfd->FontType == ft_TrueType /*&& !pdev->PDFA*/ &&
+ pdf_do_subset_font(pdev, pfd->base_font, pfd->common.rid)
+ )
+ fd.values.Flags =
+ (fd.values.Flags & ~(FONT_IS_ADOBE_ROMAN)) | FONT_IS_SYMBOLIC;
+ code = write_FontDescriptor_common(pdev, &fd);
}
if (code < 0)
- return code;
+ return code;
s = pdev->strm;
if (cidset_id != 0)
- pprintld1(s, "/CIDSet %ld 0 R\n", cidset_id);
+ pprintld1(s, "/CIDSet %ld 0 R\n", cidset_id);
else if (pdf_do_subset_font(pdev, pfd->base_font, pfd->common.rid) &&
- (ftype == ft_encrypted || ftype == ft_encrypted2)
- ) {
- stream_puts(s, "/CharSet");
- code = pdf_write_CharSet(pdev, pfd->base_font);
- if (code < 0)
- return code;
+ (ftype == ft_encrypted || ftype == ft_encrypted2)
+ ) {
+ stream_puts(s, "/CharSet");
+ code = pdf_write_CharSet(pdev, pfd->base_font);
+ if (code < 0)
+ return code;
}
if (pfd->embed) {
- code = pdf_write_FontFile_entry(pdev, pfd->base_font);
- if (code < 0)
- return code;
+ code = pdf_write_FontFile_entry(pdev, pfd->base_font);
+ if (code < 0)
+ return code;
}
if (pfd->cid.Style) {
- stream_puts(s, "/Style");
- COS_WRITE(pfd->cid.Style, pdev);
+ stream_puts(s, "/Style");
+ COS_WRITE(pfd->cid.Style, pdev);
}
if (pfd->cid.Lang[0]) {
- pprints1(s, "/Lang(%s)", pfd->cid.Lang);
+ pprints1(s, "/Lang(%s)", pfd->cid.Lang);
}
if (pfd->cid.FD) {
- stream_puts(s, "/FD");
- COS_WRITE(pfd->cid.FD, pdev);
+ stream_puts(s, "/FD");
+ COS_WRITE(pfd->cid.FD, pdev);
}
stream_puts(s, ">>\n");
pdf_end_separate(pdev, resourceFontDescriptor);
pfd->common.object->written = true;
{ const cos_object_t *pco = (const cos_object_t *)pdf_get_FontFile_object(pfd->base_font);
- if (pco != NULL) {
- code = COS_WRITE_OBJECT(pco, pdev, resourceNone);
- if (code < 0)
- return code;
- }
+ if (pco != NULL) {
+ code = COS_WRITE_OBJECT(pco, pdev, resourceNone);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
@@ -705,18 +705,18 @@ pdf_release_FontDescriptor_components(gx_device_pdf *pdev, pdf_resource_t *pres)
/*
* Mark a FontDescriptor used in a text.
*/
-int
+int
pdf_mark_font_descriptor_used(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
{
if (pfd != NULL && pfd->common.object->id == -1)
- pdf_reserve_object_id(pdev, (pdf_resource_t *)&pfd->common, 0);
+ pdf_reserve_object_id(pdev, (pdf_resource_t *)&pfd->common, 0);
return 0;
}
/*
* Convert True Type font descriptor into CID font descriptor for PDF/A.
*/
-int
+int
pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
{
pdf_font_descriptor_t *pfd = pdfont->FontDescriptor;
@@ -732,23 +732,23 @@ pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_t *p
pfd->FontType = ft_CID_TrueType;
pdfont->u.simple.Encoding = NULL; /* Drop due to overlapping against a garbager problem. */
- pbfont->CIDSet = gs_alloc_bytes(pdev->pdf_memory, length_CIDSet,
- "pdf_convert_truetype_font_descriptor");
+ pbfont->CIDSet = gs_alloc_bytes(pdev->pdf_memory, length_CIDSet,
+ "pdf_convert_truetype_font_descriptor");
if (pbfont->CIDSet == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pbfont->CIDSet, 0, length_CIDSet);
- pdfont->u.cidfont.CIDToGIDMap = (ushort *)gs_alloc_bytes(pdev->pdf_memory,
- length_CIDToGIDMap, "pdf_convert_truetype_font_descriptor");
+ pdfont->u.cidfont.CIDToGIDMap = (ushort *)gs_alloc_bytes(pdev->pdf_memory,
+ length_CIDToGIDMap, "pdf_convert_truetype_font_descriptor");
if (pdfont->u.cidfont.CIDToGIDMap == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pdfont->u.cidfont.CIDToGIDMap, 0, length_CIDToGIDMap);
for (ch = FirstChar; ch <= LastChar; ch++) {
- if (Encoding[ch].glyph != GS_NO_GLYPH) {
- gs_glyph glyph = pfont->procs.encode_char(pfont, ch, GLYPH_SPACE_INDEX);
+ if (Encoding[ch].glyph != GS_NO_GLYPH) {
+ gs_glyph glyph = pfont->procs.encode_char(pfont, ch, GLYPH_SPACE_INDEX);
- pbfont->CIDSet[ch / 8] |= 0x80 >> (ch % 8);
- pdfont->u.cidfont.CIDToGIDMap[ch] = glyph - GS_MIN_GLYPH_INDEX;
- }
+ pbfont->CIDSet[ch / 8] |= 0x80 >> (ch % 8);
+ pdfont->u.cidfont.CIDToGIDMap[ch] = glyph - GS_MIN_GLYPH_INDEX;
+ }
}
pdfont->u.cidfont.Widths2 = NULL;
pdfont->u.cidfont.used2 = NULL;
@@ -759,15 +759,15 @@ pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_t *p
int mark_font_descriptor_symbolic(const pdf_font_resource_t *pdfont)
{
pdf_font_descriptor_values_t *desc;
-
+
if(!pdfont || !pdfont->FontDescriptor)
- return 0;
+ return 0;
desc = &pdfont->FontDescriptor->common.values;
if (!(desc->Flags & FONT_IS_SYMBOLIC)) {
- desc->Flags |= FONT_IS_SYMBOLIC;
- desc->Flags &= ~FONT_IS_ADOBE_ROMAN;
+ desc->Flags |= FONT_IS_SYMBOLIC;
+ desc->Flags &= ~FONT_IS_ADOBE_ROMAN;
}
return 1;
}
diff --git a/gs/base/gdevpdtd.h b/gs/base/gdevpdtd.h
index fa7d818d4..cf810b06e 100644
--- a/gs/base/gdevpdtd.h
+++ b/gs/base/gdevpdtd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,8 +65,8 @@ typedef struct pdf_font_descriptor_s pdf_font_descriptor_t;
* gs_font.
*/
int pdf_font_descriptor_alloc(gx_device_pdf *pdev,
- pdf_font_descriptor_t **ppfd,
- gs_font_base *font, bool embed);
+ pdf_font_descriptor_t **ppfd,
+ gs_font_base *font, bool embed);
/*
* Get the object ID of a FontDescriptor.
@@ -116,7 +116,7 @@ gs_string *pdf_font_descriptor_base_name(const pdf_font_descriptor_t *pfd);
* new glyph, 1 if it was already copied.
*/
int pdf_font_used_glyph(pdf_font_descriptor_t *pfd, gs_glyph glyph,
- gs_font_base *font);
+ gs_font_base *font);
/*
* Compute the FontDescriptor metrics for a font.
@@ -128,16 +128,16 @@ int pdf_compute_font_descriptor(gx_device_pdf *pdev, pdf_font_descriptor_t *pfd)
* writing the associated embedded font if any.
*/
int pdf_finish_FontDescriptor(gx_device_pdf *pdev,
- pdf_resource_t *pfd);
+ pdf_resource_t *pfd);
int pdf_finish_resources(gx_device_pdf *pdev, pdf_resource_type_t type,
- int (*finish_proc)(gx_device_pdf *,
- pdf_resource_t *));
+ int (*finish_proc)(gx_device_pdf *,
+ pdf_resource_t *));
/*
* Write a FontDescriptor.
*/
int pdf_write_FontDescriptor(gx_device_pdf *pdev,
- pdf_resource_t *pfd);
+ pdf_resource_t *pfd);
/*
* Release a FontDescriptor components.
diff --git a/gs/base/gdevpdte.c b/gs/base/gdevpdte.c
index e4620c363..fb3ce75b6 100644
--- a/gs/base/gdevpdte.c
+++ b/gs/base/gdevpdte.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,21 +36,21 @@
#include "gdevpdtt.h"
static int pdf_char_widths(gx_device_pdf *const pdev,
- pdf_font_resource_t *pdfont, int ch,
- gs_font_base *font,
- pdf_glyph_widths_t *pwidths /* may be NULL */);
+ pdf_font_resource_t *pdfont, int ch,
+ gs_font_base *font,
+ pdf_glyph_widths_t *pwidths /* may be NULL */);
static int pdf_process_string(pdf_text_enum_t *penum, gs_string *pstr,
- const gs_matrix *pfmat,
- pdf_text_process_state_t *ppts,
- const gs_glyph *gdata);
+ const gs_matrix *pfmat,
+ pdf_text_process_state_t *ppts,
+ const gs_glyph *gdata);
/*
* Process a string with a simple gs_font.
*/
int
pdf_process_string_aux(pdf_text_enum_t *penum, gs_string *pstr,
- const gs_glyph *gdata, const gs_matrix *pfmat,
- pdf_text_process_state_t *ppts)
+ const gs_glyph *gdata, const gs_matrix *pfmat,
+ pdf_text_process_state_t *ppts)
{
gs_font_base *font = (gs_font_base *)penum->current_font;
@@ -59,80 +59,80 @@ pdf_process_string_aux(pdf_text_enum_t *penum, gs_string *pstr,
case ft_encrypted:
case ft_encrypted2:
case ft_user_defined:
- break;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
return pdf_process_string(penum, pstr, pfmat, ppts, gdata);
}
-/*
+/*
* Add char code pair to ToUnicode CMap,
* creating the CMap on neccessity.
*/
int
-pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfont,
- gs_glyph glyph, gs_char ch, const gs_const_string *gnstr)
+pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfont,
+ gs_glyph glyph, gs_char ch, const gs_const_string *gnstr)
{ int code;
gs_char unicode;
if (glyph == GS_NO_GLYPH)
- return 0;
+ return 0;
unicode = font->procs.decode_glyph((gs_font *)font, glyph, ch);
if (unicode == GS_NO_CHAR && gnstr != NULL && gnstr->size == 7) {
- if (!memcmp(gnstr->data, "uni", 3)) {
- static const char *hexdigits = "0123456789ABCDEF";
- char *d0 = strchr(hexdigits, gnstr->data[3]);
- char *d1 = strchr(hexdigits, gnstr->data[4]);
- char *d2 = strchr(hexdigits, gnstr->data[5]);
- char *d3 = strchr(hexdigits, gnstr->data[6]);
-
- if (d0 != NULL && d1 != NULL && d2 != NULL && d3 != NULL)
- unicode = ((d0 - hexdigits) << 12) + ((d1 - hexdigits) << 8) +
- ((d2 - hexdigits) << 4 ) + (d3 - hexdigits);
- }
+ if (!memcmp(gnstr->data, "uni", 3)) {
+ static const char *hexdigits = "0123456789ABCDEF";
+ char *d0 = strchr(hexdigits, gnstr->data[3]);
+ char *d1 = strchr(hexdigits, gnstr->data[4]);
+ char *d2 = strchr(hexdigits, gnstr->data[5]);
+ char *d3 = strchr(hexdigits, gnstr->data[6]);
+
+ if (d0 != NULL && d1 != NULL && d2 != NULL && d3 != NULL)
+ unicode = ((d0 - hexdigits) << 12) + ((d1 - hexdigits) << 8) +
+ ((d2 - hexdigits) << 4 ) + (d3 - hexdigits);
+ }
}
if (unicode != GS_NO_CHAR) {
- if (pdfont->cmap_ToUnicode == NULL) {
- /* ToUnicode CMaps are always encoded with two byte keys. See
- * Technical Note 5411, 'ToUnicode Mapping File Tutorial'
- * page 3.
- */
- /* Unfortunately, the above is not true. See the PDF Reference (version 1.7
- * p 472 'ToUnicode CMaps'. Even that documentation is incorrect as it
- * describes codespaceranges, in fact for Acrobat this is irrelevant,
- * but the bfranges must be one byte for simple fonts. By altering the
- * key size for CID fonts we can write both consistently correct.
- */
- uint num_codes = 256, key_size = 1;
-
- if (font->FontType == ft_CID_encrypted) {
- gs_font_cid0 *pfcid = (gs_font_cid0 *)font;
-
- num_codes = pfcid->cidata.common.CIDCount;
- key_size = 2;
- } else if (font->FontType == ft_CID_TrueType) {
- key_size = 2;
+ if (pdfont->cmap_ToUnicode == NULL) {
+ /* ToUnicode CMaps are always encoded with two byte keys. See
+ * Technical Note 5411, 'ToUnicode Mapping File Tutorial'
+ * page 3.
+ */
+ /* Unfortunately, the above is not true. See the PDF Reference (version 1.7
+ * p 472 'ToUnicode CMaps'. Even that documentation is incorrect as it
+ * describes codespaceranges, in fact for Acrobat this is irrelevant,
+ * but the bfranges must be one byte for simple fonts. By altering the
+ * key size for CID fonts we can write both consistently correct.
+ */
+ uint num_codes = 256, key_size = 1;
+
+ if (font->FontType == ft_CID_encrypted) {
+ gs_font_cid0 *pfcid = (gs_font_cid0 *)font;
+
+ num_codes = pfcid->cidata.common.CIDCount;
+ key_size = 2;
+ } else if (font->FontType == ft_CID_TrueType) {
+ key_size = 2;
#if 0
- gs_font_cid2 *pfcid = (gs_font_cid2 *)font;
+ gs_font_cid2 *pfcid = (gs_font_cid2 *)font;
- num_codes = pfcid->cidata.common.CIDCount;
+ num_codes = pfcid->cidata.common.CIDCount;
#else
- /* Since PScript5.dll creates GlyphNames2Unicode with character codes
- instead CIDs, and with the WinCharSetFFFF-H2 CMap
- character codes appears from the range 0-0xFFFF (Bug 687954),
- we must use the maximal character code value for the ToUnicode
- code count. */
- num_codes = 65536;
+ /* Since PScript5.dll creates GlyphNames2Unicode with character codes
+ instead CIDs, and with the WinCharSetFFFF-H2 CMap
+ character codes appears from the range 0-0xFFFF (Bug 687954),
+ we must use the maximal character code value for the ToUnicode
+ code count. */
+ num_codes = 65536;
#endif
- }
- code = gs_cmap_ToUnicode_alloc(pdev->pdf_memory, pdfont->rid, num_codes, key_size,
- &pdfont->cmap_ToUnicode);
- if (code < 0)
- return code;
- }
- if (pdfont->cmap_ToUnicode != NULL)
- gs_cmap_ToUnicode_add_pair(pdfont->cmap_ToUnicode, ch, unicode);
+ }
+ code = gs_cmap_ToUnicode_alloc(pdev->pdf_memory, pdfont->rid, num_codes, key_size,
+ &pdfont->cmap_ToUnicode);
+ if (code < 0)
+ return code;
+ }
+ if (pdfont->cmap_ToUnicode != NULL)
+ gs_cmap_ToUnicode_add_pair(pdfont->cmap_ToUnicode, ch, unicode);
}
return 0;
}
@@ -142,19 +142,19 @@ typedef struct {
pdf_resource_type_t rtype;
} pdf_resource_enum_data_t;
-static int
+static int
process_resources2(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v)
{
pdf_resource_enum_data_t *data = (pdf_resource_enum_data_t *)client_data;
pdf_resource_t *pres = pdf_find_resource_by_resource_id(data->pdev, data->rtype, v->contents.object->id);
if (pres == NULL)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
pres->where_used |= data->pdev->used_mask;
return 0;
}
-static int
+static int
process_resources1(void *client_data, const byte *key_data, uint key_size, const cos_value_t *v)
{
pdf_resource_enum_data_t *data = (pdf_resource_enum_data_t *)client_data;
@@ -162,11 +162,11 @@ process_resources1(void *client_data, const byte *key_data, uint key_size, const
int i;
for (i = 0; i < count_of(rn); i++) {
- if (rn[i] != NULL && !bytes_compare((const byte *)rn[i], strlen(rn[i]), key_data, key_size))
- break;
+ if (rn[i] != NULL && !bytes_compare((const byte *)rn[i], strlen(rn[i]), key_data, key_size))
+ break;
}
if (i >= count_of(rn))
- return 0;
+ return 0;
data->rtype = i;
return cos_dict_forall((cos_dict_t *)v->contents.object, data, process_resources2);
}
@@ -175,18 +175,18 @@ process_resources1(void *client_data, const byte *key_data, uint key_size, const
* Register charproc fonts with the page or substream.
*/
int
-pdf_used_charproc_resources(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
+pdf_used_charproc_resources(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
{
if (pdfont->where_used & pdev->used_mask)
- return 0;
+ return 0;
pdfont->where_used |= pdev->used_mask;
if (pdev->CompatibilityLevel >= 1.2)
- return 0;
+ return 0;
if (pdfont->FontType == ft_user_defined) {
- pdf_resource_enum_data_t data;
+ pdf_resource_enum_data_t data;
- data.pdev = pdev;
- return cos_dict_forall(pdfont->u.simple.s.type3.Resources, &data, process_resources1);
+ data.pdev = pdev;
+ return cos_dict_forall(pdfont->u.simple.s.type3.Resources, &data, process_resources1);
}
return 0;
}
@@ -201,7 +201,7 @@ pdf_used_charproc_resources(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
*/
static int
pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfont,
- gs_char ch, const gs_glyph *gdata)
+ gs_char ch, const gs_glyph *gdata)
{
gs_font_base *cfont, *ccfont;
int code;
@@ -218,107 +218,107 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_
ccfont = pdf_font_resource_font(pdfont, true);
pet = &pdfont->u.simple.Encoding[ch];
glyph = (gdata == NULL ? font->procs.encode_char(font, ch, GLYPH_SPACE_NAME)
- : *gdata);
+ : *gdata);
if (glyph == GS_NO_GLYPH || glyph == pet->glyph)
- return 0;
+ return 0;
if (pet->glyph != GS_NO_GLYPH) { /* encoding conflict */
- return_error(gs_error_rangecheck);
- /* Must not happen because pdf_obtain_font_resource
- * checks for encoding compatibility.
- */
+ return_error(gs_error_rangecheck);
+ /* Must not happen because pdf_obtain_font_resource
+ * checks for encoding compatibility.
+ */
}
code = font->procs.glyph_name(font, glyph, &gnstr);
if (code < 0)
- return code; /* can't get name of glyph */
+ return code; /* can't get name of glyph */
if (font->FontType != ft_user_defined) {
- /* The standard 14 fonts don't have a FontDescriptor. */
- code = (pdfont->base_font != 0 ?
- pdf_base_font_copy_glyph(pdfont->base_font, glyph, (gs_font_base *)font) :
- pdf_font_used_glyph(pdfont->FontDescriptor, glyph, (gs_font_base *)font));
- if (code < 0 && code != gs_error_undefined)
- return code;
- if (code == gs_error_undefined) {
- if (pdev->PDFA || pdev->PDFX) {
- switch (pdev->PDFACompatibilityPolicy) {
- case 0:
- emprintf(pdev->memory,
+ /* The standard 14 fonts don't have a FontDescriptor. */
+ code = (pdfont->base_font != 0 ?
+ pdf_base_font_copy_glyph(pdfont->base_font, glyph, (gs_font_base *)font) :
+ pdf_font_used_glyph(pdfont->FontDescriptor, glyph, (gs_font_base *)font));
+ if (code < 0 && code != gs_error_undefined)
+ return code;
+ if (code == gs_error_undefined) {
+ if (pdev->PDFA || pdev->PDFX) {
+ switch (pdev->PDFACompatibilityPolicy) {
+ case 0:
+ emprintf(pdev->memory,
"Requested glyph not present in source font,\n not permitted in PDF/A, reverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- case 1:
- emprintf(pdev->memory,
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ case 1:
+ emprintf(pdev->memory,
"Requested glyph not present in source font,\n not permitted in PDF/A, glyph will not be present in output file\n\n");
- /* Returning an error causees text processing to try and
- * handle the glyph by rendering to a bitmap instead of
- * as a glyph in a font. This will eliminate the problem
- * and the fiel should appear the same as the original.
- */
- return gs_error_unknownerror;
- break;
- case 2:
- emprintf(pdev->memory,
+ /* Returning an error causees text processing to try and
+ * handle the glyph by rendering to a bitmap instead of
+ * as a glyph in a font. This will eliminate the problem
+ * and the fiel should appear the same as the original.
+ */
+ return gs_error_unknownerror;
+ break;
+ case 2:
+ emprintf(pdev->memory,
"Requested glyph not present in source font,\n not permitted in PDF/A, aborting conversion\n");
- /* Careful here, only certain errors will bubble up
- * through the text processing.
- */
- return gs_error_invalidfont;
- break;
- default:
- emprintf(pdev->memory,
+ /* Careful here, only certain errors will bubble up
+ * through the text processing.
+ */
+ return gs_error_invalidfont;
+ break;
+ default:
+ emprintf(pdev->memory,
"Requested glyph not present in source font,\n not permitted in PDF/A, unrecognised PDFACompatibilityLevel,\nreverting to normal PDF output\n");
- pdev->AbortPDFAX = true;
- pdev->PDFA = false;
- break;
- }
- }
- /* PS font has no such glyph. */
- if (bytes_compare(gnstr.data, gnstr.size, (const byte *)".notdef", 7)) {
- pet->glyph = glyph;
- pet->str = gnstr;
- pet->is_difference = true;
- }
- } else if (pdfont->base_font == NULL && ccfont != NULL &&
- (gs_copy_glyph_options(font, glyph, (gs_font *)ccfont, COPY_GLYPH_NO_NEW) != 1 ||
- gs_copied_font_add_encoding((gs_font *)ccfont, ch, glyph) < 0)) {
- /*
- * The "complete" copy of the font appears incomplete
- * due to incrementally added glyphs. Drop the "complete"
- * copy now and continue with subset font only.
- *
- * Note that we need to add the glyph to the encoding of the
- * "complete" font, because "PPI-ProPag 2.6.1.4 (archivePg)"
- * creates multiple font copies with reduced encodings
- * (we believe it is poorly designed),
- * and we can merge the copies back to a single font (see Bug 686875).
- * We also check whether the encoding is compatible.
- * It must be compatible here due to the pdf_obtain_font_resource
- * and ccfont logics, but we want to ensure for safety reason.
- */
- ccfont = NULL;
- pdf_font_descriptor_drop_complete_font(pdfont->FontDescriptor);
- }
- /*
- * We arbitrarily allow the first encoded character in a given
- * position to determine the encoding associated with the copied
- * font.
- */
- copied_glyph = cfont->procs.encode_char((gs_font *)cfont, ch,
- GLYPH_SPACE_NAME);
- if (glyph != copied_glyph &&
- gs_copied_font_add_encoding((gs_font *)cfont, ch, glyph) < 0
- )
- pet->is_difference = true;
- pdfont->used[ch >> 3] |= 0x80 >> (ch & 7);
- }
+ pdev->AbortPDFAX = true;
+ pdev->PDFA = false;
+ break;
+ }
+ }
+ /* PS font has no such glyph. */
+ if (bytes_compare(gnstr.data, gnstr.size, (const byte *)".notdef", 7)) {
+ pet->glyph = glyph;
+ pet->str = gnstr;
+ pet->is_difference = true;
+ }
+ } else if (pdfont->base_font == NULL && ccfont != NULL &&
+ (gs_copy_glyph_options(font, glyph, (gs_font *)ccfont, COPY_GLYPH_NO_NEW) != 1 ||
+ gs_copied_font_add_encoding((gs_font *)ccfont, ch, glyph) < 0)) {
+ /*
+ * The "complete" copy of the font appears incomplete
+ * due to incrementally added glyphs. Drop the "complete"
+ * copy now and continue with subset font only.
+ *
+ * Note that we need to add the glyph to the encoding of the
+ * "complete" font, because "PPI-ProPag 2.6.1.4 (archivePg)"
+ * creates multiple font copies with reduced encodings
+ * (we believe it is poorly designed),
+ * and we can merge the copies back to a single font (see Bug 686875).
+ * We also check whether the encoding is compatible.
+ * It must be compatible here due to the pdf_obtain_font_resource
+ * and ccfont logics, but we want to ensure for safety reason.
+ */
+ ccfont = NULL;
+ pdf_font_descriptor_drop_complete_font(pdfont->FontDescriptor);
+ }
+ /*
+ * We arbitrarily allow the first encoded character in a given
+ * position to determine the encoding associated with the copied
+ * font.
+ */
+ copied_glyph = cfont->procs.encode_char((gs_font *)cfont, ch,
+ GLYPH_SPACE_NAME);
+ if (glyph != copied_glyph &&
+ gs_copied_font_add_encoding((gs_font *)cfont, ch, glyph) < 0
+ )
+ pet->is_difference = true;
+ pdfont->used[ch >> 3] |= 0x80 >> (ch & 7);
+ }
/*
- * We always generate ToUnicode for simple fonts, because
- * we can't detemine in advance, which glyphs the font actually uses.
- * The decision about writing it out is deferred until pdf_write_font_resource.
- */
+ * We always generate ToUnicode for simple fonts, because
+ * we can't detemine in advance, which glyphs the font actually uses.
+ * The decision about writing it out is deferred until pdf_write_font_resource.
+ */
code = pdf_add_ToUnicode(pdev, font, pdfont, glyph, ch, &gnstr);
if (code < 0)
- return code;
+ return code;
pet->glyph = glyph;
pet->str = gnstr;
return 0;
@@ -329,14 +329,14 @@ pdf_encode_string_element(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_
*/
static int
process_text_estimate_bbox(pdf_text_enum_t *pte, gs_font_base *font,
- const gs_const_string *pstr,
- const gs_matrix *pfmat,
- gs_rect *text_bbox, gs_point *pdpt)
+ const gs_const_string *pstr,
+ const gs_matrix *pfmat,
+ gs_rect *text_bbox, gs_point *pdpt)
{
int i;
int space_char =
- (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
- pte->text.space.s_char : -1);
+ (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
+ pte->text.space.s_char : -1);
int WMode = font->WMode;
int code = 0;
gs_point total = {0, 0};
@@ -345,69 +345,69 @@ process_text_estimate_bbox(pdf_text_enum_t *pte, gs_font_base *font,
int xy_index = pte->xy_index;
if (font->FontBBox.p.x == font->FontBBox.q.x ||
- font->FontBBox.p.y == font->FontBBox.q.y)
- return_error(gs_error_undefined);
+ font->FontBBox.p.y == font->FontBBox.q.y)
+ return_error(gs_error_undefined);
code = gx_path_current_point(pte->path, &origin);
if (code < 0)
- return code;
+ return code;
m = ctm_only(pte->pis);
m.tx = fixed2float(origin.x);
m.ty = fixed2float(origin.y);
gs_matrix_multiply(pfmat, &m, &m);
for (i = 0; i < pstr->size; ++i) {
- byte c = pstr->data[i];
- gs_rect bbox;
- gs_point wanted, tpt, p0, p1, p2, p3;
- gs_glyph glyph = font->procs.encode_char((gs_font *)font, c,
- GLYPH_SPACE_NAME);
- gs_glyph_info_t info;
- int code;
-
- if (glyph == gs_no_glyph)
- return_error (gs_error_invalidfont);
-
- code = font->procs.glyph_info((gs_font *)font, glyph, NULL,
- GLYPH_INFO_WIDTH0 << WMode,
- &info);
-
- if (code < 0)
- return code;
- gs_point_transform(font->FontBBox.p.x, font->FontBBox.p.y, &m, &p0);
- gs_point_transform(font->FontBBox.p.x, font->FontBBox.q.y, &m, &p1);
- gs_point_transform(font->FontBBox.q.x, font->FontBBox.p.y, &m, &p2);
- gs_point_transform(font->FontBBox.q.x, font->FontBBox.q.y, &m, &p3);
- bbox.p.x = min(min(p0.x, p1.x), min(p1.x, p2.x)) + total.x;
- bbox.p.y = min(min(p0.y, p1.y), min(p1.y, p2.y)) + total.y;
- bbox.q.x = max(max(p0.x, p1.x), max(p1.x, p2.x)) + total.x;
- bbox.q.y = max(max(p0.y, p1.y), max(p1.y, p2.y)) + total.y;
- if (i == 0)
- *text_bbox = bbox;
- else
- rect_merge(*text_bbox, bbox);
- if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
- gs_text_replaced_width(&pte->text, xy_index++, &tpt);
- gs_distance_transform(tpt.x, tpt.y, &ctm_only(pte->pis), &wanted);
- } else {
- gs_distance_transform(info.width[WMode].x,
- info.width[WMode].y,
- &m, &wanted);
- if (pte->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
- gs_distance_transform(pte->text.delta_all.x,
- pte->text.delta_all.y,
- &ctm_only(pte->pis), &tpt);
- wanted.x += tpt.x;
- wanted.y += tpt.y;
- }
- if (pstr->data[i] == space_char && pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
- gs_distance_transform(pte->text.delta_space.x,
- pte->text.delta_space.y,
- &ctm_only(pte->pis), &tpt);
- wanted.x += tpt.x;
- wanted.y += tpt.y;
- }
- }
- total.x += wanted.x;
- total.y += wanted.y;
+ byte c = pstr->data[i];
+ gs_rect bbox;
+ gs_point wanted, tpt, p0, p1, p2, p3;
+ gs_glyph glyph = font->procs.encode_char((gs_font *)font, c,
+ GLYPH_SPACE_NAME);
+ gs_glyph_info_t info;
+ int code;
+
+ if (glyph == gs_no_glyph)
+ return_error (gs_error_invalidfont);
+
+ code = font->procs.glyph_info((gs_font *)font, glyph, NULL,
+ GLYPH_INFO_WIDTH0 << WMode,
+ &info);
+
+ if (code < 0)
+ return code;
+ gs_point_transform(font->FontBBox.p.x, font->FontBBox.p.y, &m, &p0);
+ gs_point_transform(font->FontBBox.p.x, font->FontBBox.q.y, &m, &p1);
+ gs_point_transform(font->FontBBox.q.x, font->FontBBox.p.y, &m, &p2);
+ gs_point_transform(font->FontBBox.q.x, font->FontBBox.q.y, &m, &p3);
+ bbox.p.x = min(min(p0.x, p1.x), min(p1.x, p2.x)) + total.x;
+ bbox.p.y = min(min(p0.y, p1.y), min(p1.y, p2.y)) + total.y;
+ bbox.q.x = max(max(p0.x, p1.x), max(p1.x, p2.x)) + total.x;
+ bbox.q.y = max(max(p0.y, p1.y), max(p1.y, p2.y)) + total.y;
+ if (i == 0)
+ *text_bbox = bbox;
+ else
+ rect_merge(*text_bbox, bbox);
+ if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
+ gs_text_replaced_width(&pte->text, xy_index++, &tpt);
+ gs_distance_transform(tpt.x, tpt.y, &ctm_only(pte->pis), &wanted);
+ } else {
+ gs_distance_transform(info.width[WMode].x,
+ info.width[WMode].y,
+ &m, &wanted);
+ if (pte->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
+ gs_distance_transform(pte->text.delta_all.x,
+ pte->text.delta_all.y,
+ &ctm_only(pte->pis), &tpt);
+ wanted.x += tpt.x;
+ wanted.y += tpt.y;
+ }
+ if (pstr->data[i] == space_char && pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
+ gs_distance_transform(pte->text.delta_space.x,
+ pte->text.delta_space.y,
+ &ctm_only(pte->pis), &tpt);
+ wanted.x += tpt.x;
+ wanted.y += tpt.y;
+ }
+ }
+ total.x += wanted.x;
+ total.y += wanted.y;
}
*pdpt = total;
return 0;
@@ -419,12 +419,12 @@ adjust_first_last_char(pdf_font_resource_t *pdfont, byte *str, int size)
int i;
for (i = 0; i < size; ++i) {
- int chr = str[i];
+ int chr = str[i];
- if (chr < pdfont->u.simple.FirstChar)
- pdfont->u.simple.FirstChar = chr;
- if (chr > pdfont->u.simple.LastChar)
- pdfont->u.simple.LastChar = chr;
+ if (chr < pdfont->u.simple.FirstChar)
+ pdfont->u.simple.FirstChar = chr;
+ if (chr > pdfont->u.simple.LastChar)
+ pdfont->u.simple.LastChar = chr;
}
}
@@ -435,13 +435,13 @@ pdf_shift_text_currentpoint(pdf_text_enum_t *penum, gs_point *wpt)
extern_st(st_gs_state);
if (gs_object_type(penum->dev->memory, penum->pis) != &st_gs_state) {
- /* Probably never happens. Not sure though. */
- return_error(gs_error_unregistered);
+ /* Probably never happens. Not sure though. */
+ return_error(gs_error_unregistered);
}
pgs = (gs_state *)penum->pis;
return gs_moveto_aux(penum->pis, gx_current_path(pgs),
- fixed2float(penum->origin.x) + wpt->x,
- fixed2float(penum->origin.y) + wpt->y);
+ fixed2float(penum->origin.x) + wpt->x,
+ fixed2float(penum->origin.y) + wpt->y);
}
/*
@@ -455,14 +455,14 @@ pdf_shift_text_currentpoint(pdf_text_enum_t *penum, gs_point *wpt)
* glyph metrics, but this font's Encoding is not used.
*/
static int process_text_return_width(const pdf_text_enum_t *pte,
- gs_font_base *font,
- pdf_text_process_state_t *ppts,
- const gs_const_string *pstr, const gs_glyph *gdata,
- gs_point *pdpt, int *accepted);
+ gs_font_base *font,
+ pdf_text_process_state_t *ppts,
+ const gs_const_string *pstr, const gs_glyph *gdata,
+ gs_point *pdpt, int *accepted);
static int
pdf_process_string(pdf_text_enum_t *penum, gs_string *pstr,
- const gs_matrix *pfmat,
- pdf_text_process_state_t *ppts, const gs_glyph *gdata)
+ const gs_matrix *pfmat,
+ pdf_text_process_state_t *ppts, const gs_glyph *gdata)
{
gx_device_pdf *const pdev = (gx_device_pdf *)penum->dev;
gs_font_base *font = (gs_font_base *)penum->current_font;
@@ -474,43 +474,43 @@ pdf_process_string(pdf_text_enum_t *penum, gs_string *pstr,
code = pdf_obtain_font_resource(penum, pstr, &pdfont);
if (code < 0)
- return code;
+ return code;
if (pfmat == 0)
- pfmat = &font->FontMatrix;
+ pfmat = &font->FontMatrix;
if (text->operation & TEXT_RETURN_WIDTH) {
- code = gx_path_current_point(penum->path, &penum->origin);
- if (code < 0)
- return code;
+ code = gx_path_current_point(penum->path, &penum->origin);
+ if (code < 0)
+ return code;
}
if (text->size == 0)
- return 0;
+ return 0;
if (penum->pis->text_rendering_mode != 3 && !(text->operation & TEXT_DO_NONE)) {
- /*
- * Acrobat Reader can't handle text with huge coordinates,
- * so skip the text if it is outside the clip bbox
- * (Note : it ever fails with type 3 fonts).
- */
- gs_rect text_bbox = {{0, 0}, {0, 0}};
-
- code = process_text_estimate_bbox(penum, font, (gs_const_string *)pstr, pfmat,
- &text_bbox, &width_pt);
- if (code == 0) {
- gs_fixed_rect clip_bbox;
- gs_rect rect;
-
- gx_cpath_outer_box(penum->pcpath, &clip_bbox);
- rect.p.x = fixed2float(clip_bbox.p.x);
- rect.p.y = fixed2float(clip_bbox.p.y);
- rect.q.x = fixed2float(clip_bbox.q.x);
- rect.q.y = fixed2float(clip_bbox.q.y);
- rect_intersect(rect, text_bbox);
- if (rect.p.x > rect.q.x || rect.p.y > rect.q.y) {
- penum->index += pstr->size;
- goto finish;
- }
- }
+ /*
+ * Acrobat Reader can't handle text with huge coordinates,
+ * so skip the text if it is outside the clip bbox
+ * (Note : it ever fails with type 3 fonts).
+ */
+ gs_rect text_bbox = {{0, 0}, {0, 0}};
+
+ code = process_text_estimate_bbox(penum, font, (gs_const_string *)pstr, pfmat,
+ &text_bbox, &width_pt);
+ if (code == 0) {
+ gs_fixed_rect clip_bbox;
+ gs_rect rect;
+
+ gx_cpath_outer_box(penum->pcpath, &clip_bbox);
+ rect.p.x = fixed2float(clip_bbox.p.x);
+ rect.p.y = fixed2float(clip_bbox.p.y);
+ rect.q.x = fixed2float(clip_bbox.q.x);
+ rect.q.y = fixed2float(clip_bbox.q.y);
+ rect_intersect(rect, text_bbox);
+ if (rect.p.x > rect.q.x || rect.p.y > rect.q.y) {
+ penum->index += pstr->size;
+ goto finish;
+ }
+ }
} else {
- /* We have no penum->pcpath. */
+ /* We have no penum->pcpath. */
}
/*
@@ -519,108 +519,108 @@ pdf_process_string(pdf_text_enum_t *penum, gs_string *pstr,
*/
code = pdf_update_text_state(ppts, penum, pdfont, pfmat);
if (code > 0) {
- /* Try not to emulate ADD_TO_WIDTH if we don't have to. */
- if (code & TEXT_ADD_TO_SPACE_WIDTH) {
- if (!memchr(pstr->data, penum->text.space.s_char, pstr->size))
- code &= ~TEXT_ADD_TO_SPACE_WIDTH;
- }
+ /* Try not to emulate ADD_TO_WIDTH if we don't have to. */
+ if (code & TEXT_ADD_TO_SPACE_WIDTH) {
+ if (!memchr(pstr->data, penum->text.space.s_char, pstr->size))
+ code &= ~TEXT_ADD_TO_SPACE_WIDTH;
+ }
}
if (code < 0)
- return code;
+ return code;
mask = code;
if (text->operation & TEXT_REPLACE_WIDTHS)
- mask |= TEXT_REPLACE_WIDTHS;
+ mask |= TEXT_REPLACE_WIDTHS;
/*
* The only operations left to handle are TEXT_DO_DRAW and
* TEXT_RETURN_WIDTH.
*/
if (mask == 0) {
- /*
- * If any character has real_width != Width, we have to process
- * the string character-by-character. process_text_return_width
- * will tell us what we need to know.
- */
- if (!(text->operation & (TEXT_DO_DRAW | TEXT_RETURN_WIDTH)))
- return 0;
- code = process_text_return_width(penum, font, ppts,
- (gs_const_string *)pstr, gdata,
- &width_pt, &accepted);
- if (code < 0)
- return code;
- if (code == 0) {
- /* No characters with redefined widths -- the fast case. */
- if (text->operation & TEXT_DO_DRAW || penum->pis->text_rendering_mode == 3) {
- code = pdf_append_chars(pdev, pstr->data, accepted,
- width_pt.x, width_pt.y, false);
- if (code < 0)
- return code;
- adjust_first_last_char(pdfont, pstr->data, accepted);
- penum->index += accepted;
- } else if (text->operation & TEXT_DO_NONE)
- penum->index += accepted;
- } else {
- /* Use the slow case. Set mask to any non-zero value. */
- mask = TEXT_RETURN_WIDTH;
- }
+ /*
+ * If any character has real_width != Width, we have to process
+ * the string character-by-character. process_text_return_width
+ * will tell us what we need to know.
+ */
+ if (!(text->operation & (TEXT_DO_DRAW | TEXT_RETURN_WIDTH)))
+ return 0;
+ code = process_text_return_width(penum, font, ppts,
+ (gs_const_string *)pstr, gdata,
+ &width_pt, &accepted);
+ if (code < 0)
+ return code;
+ if (code == 0) {
+ /* No characters with redefined widths -- the fast case. */
+ if (text->operation & TEXT_DO_DRAW || penum->pis->text_rendering_mode == 3) {
+ code = pdf_append_chars(pdev, pstr->data, accepted,
+ width_pt.x, width_pt.y, false);
+ if (code < 0)
+ return code;
+ adjust_first_last_char(pdfont, pstr->data, accepted);
+ penum->index += accepted;
+ } else if (text->operation & TEXT_DO_NONE)
+ penum->index += accepted;
+ } else {
+ /* Use the slow case. Set mask to any non-zero value. */
+ mask = TEXT_RETURN_WIDTH;
+ }
}
if (mask) {
- /* process_text_modify_width destroys text parameters, save them now. */
+ /* process_text_modify_width destroys text parameters, save them now. */
int index0 = penum->index, xy_index = penum->xy_index;
- gs_text_params_t text = penum->text;
- int xy_index_step = (!(penum->text.operation & TEXT_REPLACE_WIDTHS) ? 0 :
- penum->text.x_widths == penum->text.y_widths ? 2 : 1);
- /* A glyphshow takes a shortcut by storing the single glyph directly into
- * penum->text.data.d_glyph. However, process_text_modify_width
- * replaces pte->text.data.bytes (these two are part of a union) with
- * pstr->data, which is not valid for a glyphshow because it alters
- * the glyph value store there. If we make a copy of the single glyph,
- * it all works correctly.then
- */
- gs_glyph gdata_i, *gdata_p = (gs_glyph *)gdata;
- if (penum->text.operation & TEXT_FROM_SINGLE_GLYPH) {
- gdata_i = *gdata;
- gdata_p = &gdata_i;
- }
-
- if (penum->text.operation & TEXT_REPLACE_WIDTHS) {
- if (penum->text.x_widths != NULL)
- penum->text.x_widths += xy_index * xy_index_step;
- if (penum->text.y_widths != NULL)
- penum->text.y_widths += xy_index * xy_index_step;
- }
- penum->xy_index = 0;
- code = process_text_modify_width(penum, (gs_font *)font, ppts,
- (gs_const_string *)pstr,
- &width_pt, (const gs_glyph *)gdata_p, false);
- if (penum->text.operation & TEXT_REPLACE_WIDTHS) {
- if (penum->text.x_widths != NULL)
- penum->text.x_widths -= xy_index * xy_index_step;
- if (penum->text.y_widths != NULL)
- penum->text.y_widths -= xy_index * xy_index_step;
- }
- penum->xy_index += xy_index;
- adjust_first_last_char(pdfont, pstr->data, penum->index);
- penum->text = text;
- penum->index += index0;
- if (code < 0)
- return code;
+ gs_text_params_t text = penum->text;
+ int xy_index_step = (!(penum->text.operation & TEXT_REPLACE_WIDTHS) ? 0 :
+ penum->text.x_widths == penum->text.y_widths ? 2 : 1);
+ /* A glyphshow takes a shortcut by storing the single glyph directly into
+ * penum->text.data.d_glyph. However, process_text_modify_width
+ * replaces pte->text.data.bytes (these two are part of a union) with
+ * pstr->data, which is not valid for a glyphshow because it alters
+ * the glyph value store there. If we make a copy of the single glyph,
+ * it all works correctly.then
+ */
+ gs_glyph gdata_i, *gdata_p = (gs_glyph *)gdata;
+ if (penum->text.operation & TEXT_FROM_SINGLE_GLYPH) {
+ gdata_i = *gdata;
+ gdata_p = &gdata_i;
+ }
+
+ if (penum->text.operation & TEXT_REPLACE_WIDTHS) {
+ if (penum->text.x_widths != NULL)
+ penum->text.x_widths += xy_index * xy_index_step;
+ if (penum->text.y_widths != NULL)
+ penum->text.y_widths += xy_index * xy_index_step;
+ }
+ penum->xy_index = 0;
+ code = process_text_modify_width(penum, (gs_font *)font, ppts,
+ (gs_const_string *)pstr,
+ &width_pt, (const gs_glyph *)gdata_p, false);
+ if (penum->text.operation & TEXT_REPLACE_WIDTHS) {
+ if (penum->text.x_widths != NULL)
+ penum->text.x_widths -= xy_index * xy_index_step;
+ if (penum->text.y_widths != NULL)
+ penum->text.y_widths -= xy_index * xy_index_step;
+ }
+ penum->xy_index += xy_index;
+ adjust_first_last_char(pdfont, pstr->data, penum->index);
+ penum->text = text;
+ penum->index += index0;
+ if (code < 0)
+ return code;
}
finish:
/* Finally, return the total width if requested. */
if (!(text->operation & TEXT_RETURN_WIDTH))
- return 0;
+ return 0;
if (text->operation & TEXT_DO_NONE) {
- /* stringwidth needs to transform to user space. */
- gs_point p;
+ /* stringwidth needs to transform to user space. */
+ gs_point p;
- gs_distance_transform_inverse(width_pt.x, width_pt.y, &ctm_only(penum->pis), &p);
- penum->returned.total_width.x += p.x;
- penum->returned.total_width.y += p.y;
+ gs_distance_transform_inverse(width_pt.x, width_pt.y, &ctm_only(penum->pis), &p);
+ penum->returned.total_width.x += p.x;
+ penum->returned.total_width.y += p.y;
} else
- penum->returned.total_width = width_pt;
+ penum->returned.total_width = width_pt;
return pdf_shift_text_currentpoint(penum, &width_pt);
}
@@ -631,8 +631,8 @@ finish:
*/
static int
pdf_char_widths(gx_device_pdf *const pdev,
- pdf_font_resource_t *pdfont, int ch, gs_font_base *font,
- pdf_glyph_widths_t *pwidths /* may be NULL */)
+ pdf_font_resource_t *pdfont, int ch, gs_font_base *font,
+ pdf_glyph_widths_t *pwidths /* may be NULL */)
{
pdf_glyph_widths_t widths;
int code;
@@ -641,78 +641,78 @@ pdf_char_widths(gx_device_pdf *const pdev,
int char_cache_size, width_cache_size;
pdf_font_resource_t *pdfont1;
- code = pdf_attached_font_resource(pdev, (gs_font *)font, &pdfont1,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ code = pdf_attached_font_resource(pdev, (gs_font *)font, &pdfont1,
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
if (pdfont1 != pdfont)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (ch < 0 || ch > 255)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (ch >= width_cache_size)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pwidths == 0)
- pwidths = &widths;
+ pwidths = &widths;
if (font->FontType != ft_user_defined && real_widths[ch] == 0) {
- /* Might be an unused char, or just not cached. */
- gs_glyph glyph = pdfont->u.simple.Encoding[ch].glyph;
-
- code = pdf_glyph_widths(pdfont, font->WMode, glyph, (gs_font *)font, pwidths, NULL);
- if (code < 0)
- return code;
- if (font->WMode != 0 && code > 0 && !pwidths->replaced_v) {
- /*
- * The font has no Metrics2, so it must write
- * horizontally due to PS spec.
- * Therefore we need to fill the Widths array,
- * which is required by PDF spec.
- * Take it from WMode==0.
- */
- code = pdf_glyph_widths(pdfont, 0, glyph, (gs_font *)font, pwidths, NULL);
- }
- if (pwidths->replaced_v) {
- pdfont->u.simple.v[ch].x = pwidths->real_width.v.x - pwidths->Width.v.x;
- pdfont->u.simple.v[ch].y = pwidths->real_width.v.y - pwidths->Width.v.y;
- } else
- pdfont->u.simple.v[ch].x = pdfont->u.simple.v[ch].y = 0;
- if (code == 0) {
- pdfont->Widths[ch] = pwidths->Width.w;
- real_widths[ch] = pwidths->real_width.w;
- }
+ /* Might be an unused char, or just not cached. */
+ gs_glyph glyph = pdfont->u.simple.Encoding[ch].glyph;
+
+ code = pdf_glyph_widths(pdfont, font->WMode, glyph, (gs_font *)font, pwidths, NULL);
+ if (code < 0)
+ return code;
+ if (font->WMode != 0 && code > 0 && !pwidths->replaced_v) {
+ /*
+ * The font has no Metrics2, so it must write
+ * horizontally due to PS spec.
+ * Therefore we need to fill the Widths array,
+ * which is required by PDF spec.
+ * Take it from WMode==0.
+ */
+ code = pdf_glyph_widths(pdfont, 0, glyph, (gs_font *)font, pwidths, NULL);
+ }
+ if (pwidths->replaced_v) {
+ pdfont->u.simple.v[ch].x = pwidths->real_width.v.x - pwidths->Width.v.x;
+ pdfont->u.simple.v[ch].y = pwidths->real_width.v.y - pwidths->Width.v.y;
+ } else
+ pdfont->u.simple.v[ch].x = pdfont->u.simple.v[ch].y = 0;
+ if (code == 0) {
+ pdfont->Widths[ch] = pwidths->Width.w;
+ real_widths[ch] = pwidths->real_width.w;
+ }
} else {
- if (font->FontType == ft_user_defined) {
- if (!(pdfont->used[ch >> 3] & 0x80 >> (ch & 7)))
- return gs_error_undefined; /* The charproc was not accumulated. */
- if (!pdev->charproc_just_accumulated &&
- !(pdfont->u.simple.s.type3.cached[ch >> 3] & 0x80 >> (ch & 7))) {
- /* The charproc uses setcharwidth.
- Need to accumulate again to check for a glyph variation. */
- return gs_error_undefined;
- }
- }
- pwidths->Width.w = pdfont->Widths[ch];
- pwidths->Width.v = pdfont->u.simple.v[ch];
- if (font->FontType == ft_user_defined) {
- pwidths->real_width.w = real_widths[ch * 2];
- pwidths->Width.xy.x = pwidths->Width.w;
- pwidths->Width.xy.y = 0;
- pwidths->real_width.xy.x = real_widths[ch * 2 + 0];
- pwidths->real_width.xy.y = real_widths[ch * 2 + 1];
- pwidths->replaced_v = 0;
- } else if (font->WMode) {
- pwidths->real_width.w = real_widths[ch];
- pwidths->Width.xy.x = 0;
- pwidths->Width.xy.y = pwidths->Width.w;
- pwidths->real_width.xy.x = 0;
- pwidths->real_width.xy.y = pwidths->real_width.w;
- } else {
- pwidths->real_width.w = real_widths[ch];
- pwidths->Width.xy.x = pwidths->Width.w;
- pwidths->Width.xy.y = 0;
- pwidths->real_width.xy.x = pwidths->real_width.w;
- pwidths->real_width.xy.y = 0;
- }
- code = 0;
+ if (font->FontType == ft_user_defined) {
+ if (!(pdfont->used[ch >> 3] & 0x80 >> (ch & 7)))
+ return gs_error_undefined; /* The charproc was not accumulated. */
+ if (!pdev->charproc_just_accumulated &&
+ !(pdfont->u.simple.s.type3.cached[ch >> 3] & 0x80 >> (ch & 7))) {
+ /* The charproc uses setcharwidth.
+ Need to accumulate again to check for a glyph variation. */
+ return gs_error_undefined;
+ }
+ }
+ pwidths->Width.w = pdfont->Widths[ch];
+ pwidths->Width.v = pdfont->u.simple.v[ch];
+ if (font->FontType == ft_user_defined) {
+ pwidths->real_width.w = real_widths[ch * 2];
+ pwidths->Width.xy.x = pwidths->Width.w;
+ pwidths->Width.xy.y = 0;
+ pwidths->real_width.xy.x = real_widths[ch * 2 + 0];
+ pwidths->real_width.xy.y = real_widths[ch * 2 + 1];
+ pwidths->replaced_v = 0;
+ } else if (font->WMode) {
+ pwidths->real_width.w = real_widths[ch];
+ pwidths->Width.xy.x = 0;
+ pwidths->Width.xy.y = pwidths->Width.w;
+ pwidths->real_width.xy.x = 0;
+ pwidths->real_width.xy.y = pwidths->real_width.w;
+ } else {
+ pwidths->real_width.w = real_widths[ch];
+ pwidths->Width.xy.x = pwidths->Width.w;
+ pwidths->Width.xy.y = 0;
+ pwidths->real_width.xy.x = pwidths->real_width.w;
+ pwidths->real_width.xy.y = 0;
+ }
+ code = 0;
}
return code;
}
@@ -723,24 +723,24 @@ pdf_char_widths(gx_device_pdf *const pdev,
*/
static void
pdf_char_widths_to_uts(pdf_font_resource_t *pdfont /* may be NULL for non-Type3 */,
- pdf_glyph_widths_t *pwidths)
+ pdf_glyph_widths_t *pwidths)
{
if (pdfont && pdfont->FontType == ft_user_defined) {
- gs_matrix *pmat = &pdfont->u.simple.s.type3.FontMatrix;
+ gs_matrix *pmat = &pdfont->u.simple.s.type3.FontMatrix;
- pwidths->Width.xy.x *= pmat->xx; /* formula simplified based on wy in glyph space == 0 */
- pwidths->Width.xy.y = 0.0; /* WMode == 0 for PDF Type 3 fonts */
- gs_distance_transform(pwidths->real_width.xy.x, pwidths->real_width.xy.y, pmat, &pwidths->real_width.xy);
+ pwidths->Width.xy.x *= pmat->xx; /* formula simplified based on wy in glyph space == 0 */
+ pwidths->Width.xy.y = 0.0; /* WMode == 0 for PDF Type 3 fonts */
+ gs_distance_transform(pwidths->real_width.xy.x, pwidths->real_width.xy.y, pmat, &pwidths->real_width.xy);
} else {
- /*
- * For other font types:
- * - PDF design->text space is a simple scaling by 0.001.
- * - The Width.xy.x/y that should be zeroed-out per 5.3.3 "Text Space Details" is already 0.
- */
- pwidths->Width.xy.x /= 1000.0;
- pwidths->Width.xy.y /= 1000.0;
- pwidths->real_width.xy.x /= 1000.0;
- pwidths->real_width.xy.y /= 1000.0;
+ /*
+ * For other font types:
+ * - PDF design->text space is a simple scaling by 0.001.
+ * - The Width.xy.x/y that should be zeroed-out per 5.3.3 "Text Space Details" is already 0.
+ */
+ pwidths->Width.xy.x /= 1000.0;
+ pwidths->Width.xy.y /= 1000.0;
+ pwidths->real_width.xy.x /= 1000.0;
+ pwidths->real_width.xy.y /= 1000.0;
}
}
@@ -750,77 +750,77 @@ pdf_char_widths_to_uts(pdf_font_resource_t *pdfont /* may be NULL for non-Type3
*/
static int
process_text_return_width(const pdf_text_enum_t *pte, gs_font_base *font,
- pdf_text_process_state_t *ppts,
- const gs_const_string *pstr, const gs_glyph *gdata,
- gs_point *pdpt, int *accepted)
+ pdf_text_process_state_t *ppts,
+ const gs_const_string *pstr, const gs_glyph *gdata,
+ gs_point *pdpt, int *accepted)
{
int i;
gs_point w;
gs_point dpt;
int num_spaces = 0;
int space_char =
- (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
- pte->text.space.s_char : -1);
+ (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
+ pte->text.space.s_char : -1);
int widths_differ = 0, code;
gx_device_pdf *pdev = (gx_device_pdf *)pte->dev;
pdf_font_resource_t *pdfont;
code = pdf_attached_font_resource(pdev, (gs_font *)font, &pdfont, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
for (i = 0, w.x = w.y = 0; i < pstr->size; ++i) {
- pdf_glyph_widths_t cw; /* in PDF text space */
- gs_char ch = pstr->data[i];
-
- { const gs_glyph *gdata_i = (gdata != NULL ? gdata + i : 0);
-
- code = pdf_encode_string_element(pdev, (gs_font *)font, pdfont, ch, gdata_i);
- if (code < 0)
- return code;
- }
- if (font->FontType == ft_user_defined &&
- (i > 0 || !pdev->charproc_just_accumulated) &&
- !(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7))))
- code = gs_error_undefined;
- else
- code = pdf_char_widths((gx_device_pdf *)pte->dev,
- ppts->values.pdfont, ch, font,
- &cw);
- if (code < 0) {
- if (i)
- break;
- *accepted = 0;
- return code;
- }
- pdf_char_widths_to_uts(pdfont, &cw);
- w.x += cw.real_width.xy.x;
- w.y += cw.real_width.xy.y;
- if (cw.real_width.xy.x != cw.Width.xy.x ||
- cw.real_width.xy.y != cw.Width.xy.y
- )
- widths_differ = 1;
- if (pstr->data[i] == space_char)
- ++num_spaces;
+ pdf_glyph_widths_t cw; /* in PDF text space */
+ gs_char ch = pstr->data[i];
+
+ { const gs_glyph *gdata_i = (gdata != NULL ? gdata + i : 0);
+
+ code = pdf_encode_string_element(pdev, (gs_font *)font, pdfont, ch, gdata_i);
+ if (code < 0)
+ return code;
+ }
+ if (font->FontType == ft_user_defined &&
+ (i > 0 || !pdev->charproc_just_accumulated) &&
+ !(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7))))
+ code = gs_error_undefined;
+ else
+ code = pdf_char_widths((gx_device_pdf *)pte->dev,
+ ppts->values.pdfont, ch, font,
+ &cw);
+ if (code < 0) {
+ if (i)
+ break;
+ *accepted = 0;
+ return code;
+ }
+ pdf_char_widths_to_uts(pdfont, &cw);
+ w.x += cw.real_width.xy.x;
+ w.y += cw.real_width.xy.y;
+ if (cw.real_width.xy.x != cw.Width.xy.x ||
+ cw.real_width.xy.y != cw.Width.xy.y
+ )
+ widths_differ = 1;
+ if (pstr->data[i] == space_char)
+ ++num_spaces;
}
*accepted = i;
gs_distance_transform(w.x * ppts->values.size, w.y * ppts->values.size,
- &ppts->values.matrix, &dpt);
+ &ppts->values.matrix, &dpt);
if (pte->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
- int num_chars = *accepted;
- gs_point tpt;
+ int num_chars = *accepted;
+ gs_point tpt;
- gs_distance_transform(pte->text.delta_all.x, pte->text.delta_all.y,
- &ctm_only(pte->pis), &tpt);
- dpt.x += tpt.x * num_chars;
- dpt.y += tpt.y * num_chars;
+ gs_distance_transform(pte->text.delta_all.x, pte->text.delta_all.y,
+ &ctm_only(pte->pis), &tpt);
+ dpt.x += tpt.x * num_chars;
+ dpt.y += tpt.y * num_chars;
}
if (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
- gs_point tpt;
+ gs_point tpt;
- gs_distance_transform(pte->text.delta_space.x, pte->text.delta_space.y,
- &ctm_only(pte->pis), &tpt);
- dpt.x += tpt.x * num_spaces;
- dpt.y += tpt.y * num_spaces;
+ gs_distance_transform(pte->text.delta_space.x, pte->text.delta_space.y,
+ &ctm_only(pte->pis), &tpt);
+ dpt.x += tpt.x * num_spaces;
+ dpt.y += tpt.y * num_spaces;
}
*pdpt = dpt;
@@ -832,22 +832,22 @@ process_text_return_width(const pdf_text_enum_t *pte, gs_font_base *font,
/*
* Retrieve glyph origing shift for WMode = 1 in design units.
*/
-static void
+static void
pdf_glyph_origin(pdf_font_resource_t *pdfont, int ch, int WMode, gs_point *p)
{
/* For CID fonts PDF viewers provide glyph origin shift automatically.
* Therefore we only need to do for non-CID fonts.
*/
switch (pdfont->FontType) {
- case ft_encrypted:
- case ft_encrypted2:
- case ft_TrueType:
- case ft_user_defined:
- *p = pdfont->u.simple.v[ch];
- break;
- default:
- p->x = p->y = 0;
- break;
+ case ft_encrypted:
+ case ft_encrypted2:
+ case ft_TrueType:
+ case ft_user_defined:
+ *p = pdfont->u.simple.v[ch];
+ break;
+ default:
+ p->x = p->y = 0;
+ break;
}
}
#endif
@@ -856,28 +856,28 @@ pdf_glyph_origin(pdf_font_resource_t *pdfont, int ch, int WMode, gs_point *p)
* Emulate TEXT_ADD_TO_ALL_WIDTHS and/or TEXT_ADD_TO_SPACE_WIDTH,
* and implement TEXT_REPLACE_WIDTHS if requested.
* Uses and updates ppts->values.matrix; uses ppts->values.pdfont.
- *
- * Destroys the text parameters in *pte.
+ *
+ * Destroys the text parameters in *pte.
* The caller must restore them.
*/
int
process_text_modify_width(pdf_text_enum_t *pte, gs_font *font,
- pdf_text_process_state_t *ppts,
- const gs_const_string *pstr,
- gs_point *pdpt, const gs_glyph *gdata, bool composite)
+ pdf_text_process_state_t *ppts,
+ const gs_const_string *pstr,
+ gs_point *pdpt, const gs_glyph *gdata, bool composite)
{
gx_device_pdf *const pdev = (gx_device_pdf *)pte->dev;
int space_char =
- (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
- pte->text.space.s_char : -1);
+ (pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH ?
+ pte->text.space.s_char : -1);
gs_point start, total;
pdf_font_resource_t *pdfont3 = NULL;
int code;
if (font->FontType == ft_user_defined) {
- code = pdf_attached_font_resource(pdev, font, &pdfont3, NULL, NULL, NULL, NULL);
+ code = pdf_attached_font_resource(pdev, font, &pdfont3, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
}
pte->text.data.bytes = pstr->data;
@@ -894,197 +894,197 @@ process_text_modify_width(pdf_text_enum_t *pte, gs_font *font,
* and the width values for pdf_append_chars are in device space.
*/
for (;;) {
- pdf_glyph_widths_t cw; /* design space, then converted to PDF text space */
- gs_point did, wanted, tpt; /* user space */
- gs_point v = {0, 0}; /* design space */
- gs_char chr;
- gs_glyph glyph;
- int index = pte->index;
- gs_text_enum_t pte1 = *(gs_text_enum_t *)pte;
- int FontType;
+ pdf_glyph_widths_t cw; /* design space, then converted to PDF text space */
+ gs_point did, wanted, tpt; /* user space */
+ gs_point v = {0, 0}; /* design space */
+ gs_char chr;
+ gs_glyph glyph;
+ int index = pte->index;
+ gs_text_enum_t pte1 = *(gs_text_enum_t *)pte;
+ int FontType;
#if RIGHT_SBW
- bool use_cached_v = true;
+ bool use_cached_v = true;
#endif
- byte composite_type3_text[1];
-
- code = pte1.orig_font->procs.next_char_glyph(&pte1, &chr, &glyph);
- if (code == 2) { /* end of string */
- gs_text_enum_copy_dynamic((gs_text_enum_t *)pte, &pte1, true);
- break;
- }
- if (code < 0)
- return code;
- if (composite) { /* from process_cmap_text */
- gs_font *subfont = pte1.fstack.items[pte1.fstack.depth].font;
-
- if (subfont->FontType == ft_user_defined) {
- pdf_font_resource_t *pdfont;
-
- FontType = subfont->FontType;
- code = pdf_attached_font_resource(pdev, subfont,
- &pdfont, NULL, NULL, NULL, NULL);
- if (code < 0)
- return code;
- chr = pdf_find_glyph(pdfont, glyph);
- composite_type3_text[0] = (byte)chr;
- code = pdf_char_widths((gx_device_pdf *)pte->dev,
- ppts->values.pdfont, chr, (gs_font_base *)subfont,
- &cw);
- } else {
- pdf_font_resource_t *pdsubf = ppts->values.pdfont->u.type0.DescendantFont;
-
- FontType = pdsubf->FontType;
- code = pdf_glyph_widths(pdsubf, font->WMode, glyph, subfont, &cw,
- pte->cdevproc_callout ? pte->cdevproc_result : NULL);
- }
- } else {/* must be a base font */
- const gs_glyph *gdata_i = (gdata != NULL ? gdata + pte->index : 0);
-
- /* gdata is NULL when composite == true, or the text isn't a single byte. */
- code = pdf_encode_string_element(pdev, font, ppts->values.pdfont, chr, gdata_i);
- FontType = font->FontType;
- if (code >= 0) {
- if (chr == GS_NO_CHAR && glyph != GS_NO_GLYPH) {
- /* glyphshow, we have no char code. Bug 686988.*/
- code = pdf_glyph_widths(ppts->values.pdfont, font->WMode, glyph, font, &cw, NULL);
- use_cached_v = false; /* Since we have no chr and don't call pdf_char_widths. */
- } else {
- code = pdf_char_widths((gx_device_pdf *)pte->dev,
- ppts->values.pdfont, chr, (gs_font_base *)font,
- &cw);
- }
- }
- }
- if (code < 0) {
- if (index > 0)
- break;
- return code;
- }
- gs_text_enum_copy_dynamic((gs_text_enum_t *)pte, &pte1, true);
+ byte composite_type3_text[1];
+
+ code = pte1.orig_font->procs.next_char_glyph(&pte1, &chr, &glyph);
+ if (code == 2) { /* end of string */
+ gs_text_enum_copy_dynamic((gs_text_enum_t *)pte, &pte1, true);
+ break;
+ }
+ if (code < 0)
+ return code;
+ if (composite) { /* from process_cmap_text */
+ gs_font *subfont = pte1.fstack.items[pte1.fstack.depth].font;
+
+ if (subfont->FontType == ft_user_defined) {
+ pdf_font_resource_t *pdfont;
+
+ FontType = subfont->FontType;
+ code = pdf_attached_font_resource(pdev, subfont,
+ &pdfont, NULL, NULL, NULL, NULL);
+ if (code < 0)
+ return code;
+ chr = pdf_find_glyph(pdfont, glyph);
+ composite_type3_text[0] = (byte)chr;
+ code = pdf_char_widths((gx_device_pdf *)pte->dev,
+ ppts->values.pdfont, chr, (gs_font_base *)subfont,
+ &cw);
+ } else {
+ pdf_font_resource_t *pdsubf = ppts->values.pdfont->u.type0.DescendantFont;
+
+ FontType = pdsubf->FontType;
+ code = pdf_glyph_widths(pdsubf, font->WMode, glyph, subfont, &cw,
+ pte->cdevproc_callout ? pte->cdevproc_result : NULL);
+ }
+ } else {/* must be a base font */
+ const gs_glyph *gdata_i = (gdata != NULL ? gdata + pte->index : 0);
+
+ /* gdata is NULL when composite == true, or the text isn't a single byte. */
+ code = pdf_encode_string_element(pdev, font, ppts->values.pdfont, chr, gdata_i);
+ FontType = font->FontType;
+ if (code >= 0) {
+ if (chr == GS_NO_CHAR && glyph != GS_NO_GLYPH) {
+ /* glyphshow, we have no char code. Bug 686988.*/
+ code = pdf_glyph_widths(ppts->values.pdfont, font->WMode, glyph, font, &cw, NULL);
+ use_cached_v = false; /* Since we have no chr and don't call pdf_char_widths. */
+ } else {
+ code = pdf_char_widths((gx_device_pdf *)pte->dev,
+ ppts->values.pdfont, chr, (gs_font_base *)font,
+ &cw);
+ }
+ }
+ }
+ if (code < 0) {
+ if (index > 0)
+ break;
+ return code;
+ }
+ gs_text_enum_copy_dynamic((gs_text_enum_t *)pte, &pte1, true);
#if RIGHT_SBW
- if (composite || !use_cached_v) {
- if (cw.replaced_v) {
- v.x = cw.real_width.v.x - cw.Width.v.x;
- v.y = cw.real_width.v.y - cw.Width.v.y;
- }
- } else
- v = ppts->values.pdfont->u.simple.v[chr];
- if (font->WMode) {
- /* With WMode 1 v-vector is (WMode 1 origin) - (WMode 0 origin).
- The glyph shifts in the opposite direction. */
- v.x = - v.x;
- v.y = - v.y;
- } else {
- /* With WMode 0 v-vector is (Metrics sb) - (native sb).
- The glyph shifts in same direction. */
- }
- /* pdf_glyph_origin is not longer used. */
+ if (composite || !use_cached_v) {
+ if (cw.replaced_v) {
+ v.x = cw.real_width.v.x - cw.Width.v.x;
+ v.y = cw.real_width.v.y - cw.Width.v.y;
+ }
+ } else
+ v = ppts->values.pdfont->u.simple.v[chr];
+ if (font->WMode) {
+ /* With WMode 1 v-vector is (WMode 1 origin) - (WMode 0 origin).
+ The glyph shifts in the opposite direction. */
+ v.x = - v.x;
+ v.y = - v.y;
+ } else {
+ /* With WMode 0 v-vector is (Metrics sb) - (native sb).
+ The glyph shifts in same direction. */
+ }
+ /* pdf_glyph_origin is not longer used. */
#else
- if ((pte->text.operation & TEXT_FROM_SINGLE_GLYPH) ||
- (pte->text.operation & TEXT_FROM_GLYPHS)) {
- v.x = v.y = 0;
- } else if (composite) {
- if (cw.replaced_v) {
- v.x = cw.real_width.v.x - cw.Width.v.x;
- v.y = cw.real_width.v.y - cw.Width.v.y;
- }
- } else
- pdf_glyph_origin(ppts->values.pdfont, chr, font->WMode, &v);
+ if ((pte->text.operation & TEXT_FROM_SINGLE_GLYPH) ||
+ (pte->text.operation & TEXT_FROM_GLYPHS)) {
+ v.x = v.y = 0;
+ } else if (composite) {
+ if (cw.replaced_v) {
+ v.x = cw.real_width.v.x - cw.Width.v.x;
+ v.y = cw.real_width.v.y - cw.Width.v.y;
+ }
+ } else
+ pdf_glyph_origin(ppts->values.pdfont, chr, font->WMode, &v);
#endif
- if (v.x != 0 || v.y != 0) {
- gs_point glyph_origin_shift;
- double scale0;
-
- if (FontType == ft_TrueType || FontType == ft_CID_TrueType)
- scale0 = (float)0.001;
- else
- scale0 = 1;
+ if (v.x != 0 || v.y != 0) {
+ gs_point glyph_origin_shift;
+ double scale0;
+
+ if (FontType == ft_TrueType || FontType == ft_CID_TrueType)
+ scale0 = (float)0.001;
+ else
+ scale0 = 1;
#if RIGHT_SBW
- glyph_origin_shift.x = v.x * scale0;
- glyph_origin_shift.y = v.y * scale0;
+ glyph_origin_shift.x = v.x * scale0;
+ glyph_origin_shift.y = v.y * scale0;
#else
- glyph_origin_shift.x = - v.x * scale0;
- glyph_origin_shift.y = - v.y * scale0;
+ glyph_origin_shift.x = - v.x * scale0;
+ glyph_origin_shift.y = - v.y * scale0;
#endif
- if (composite) {
- gs_font *subfont = pte->fstack.items[pte->fstack.depth].font;
-
- gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
- &subfont->FontMatrix, &glyph_origin_shift);
- }
- gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
- &font->FontMatrix, &glyph_origin_shift);
- gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
- &ctm_only(pte->pis), &glyph_origin_shift);
- if (glyph_origin_shift.x != 0 || glyph_origin_shift.y != 0) {
- ppts->values.matrix.tx = start.x + total.x + glyph_origin_shift.x;
- ppts->values.matrix.ty = start.y + total.y + glyph_origin_shift.y;
- code = pdf_set_text_state_values(pdev, &ppts->values);
- if (code < 0)
- break;
- }
- }
- pdf_char_widths_to_uts(pdfont3, &cw); /* convert design->text space */
- if (pte->text.operation & (TEXT_DO_DRAW | TEXT_RENDER_MODE_3)) {
- gs_distance_transform(cw.Width.xy.x * ppts->values.size,
- cw.Width.xy.y * ppts->values.size,
- &ppts->values.matrix, &did);
- gs_distance_transform((font->WMode ? 0 : ppts->values.character_spacing),
- (font->WMode ? ppts->values.character_spacing : 0),
- &ppts->values.matrix, &tpt);
- did.x += tpt.x;
- did.y += tpt.y;
- if (chr == space_char) {
- gs_distance_transform((font->WMode ? 0 : ppts->values.word_spacing),
- (font->WMode ? ppts->values.word_spacing : 0),
- &ppts->values.matrix, &tpt);
- did.x += tpt.x;
- did.y += tpt.y;
- }
- if (composite && FontType == ft_user_defined)
- code = pdf_append_chars(pdev, composite_type3_text, 1, did.x, did.y, composite);
- else
- code = pdf_append_chars(pdev, pstr->data + index, pte->index - index, did.x, did.y, composite);
- if (code < 0)
- break;
- } else
- did.x = did.y = 0;
- if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
- gs_point dpt;
-
- code = gs_text_replaced_width(&pte->text, pte->xy_index++, &dpt);
- if (code < 0)
- return_error(gs_error_unregistered);
- gs_distance_transform(dpt.x, dpt.y, &ctm_only(pte->pis), &wanted);
- } else {
- gs_distance_transform(cw.real_width.xy.x * ppts->values.size,
- cw.real_width.xy.y * ppts->values.size,
- &ppts->values.matrix, &wanted);
- if (pte->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
- gs_distance_transform(pte->text.delta_all.x,
- pte->text.delta_all.y,
- &ctm_only(pte->pis), &tpt);
- wanted.x += tpt.x;
- wanted.y += tpt.y;
- }
- if (chr == space_char && pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
- gs_distance_transform(pte->text.delta_space.x,
- pte->text.delta_space.y,
- &ctm_only(pte->pis), &tpt);
- wanted.x += tpt.x;
- wanted.y += tpt.y;
- }
- }
- total.x += wanted.x;
- total.y += wanted.y;
- if (wanted.x != did.x || wanted.y != did.y) {
- ppts->values.matrix.tx = start.x + total.x;
- ppts->values.matrix.ty = start.y + total.y;
- code = pdf_set_text_state_values(pdev, &ppts->values);
- if (code < 0)
- break;
- }
- pdev->charproc_just_accumulated = false;
+ if (composite) {
+ gs_font *subfont = pte->fstack.items[pte->fstack.depth].font;
+
+ gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
+ &subfont->FontMatrix, &glyph_origin_shift);
+ }
+ gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
+ &font->FontMatrix, &glyph_origin_shift);
+ gs_distance_transform(glyph_origin_shift.x, glyph_origin_shift.y,
+ &ctm_only(pte->pis), &glyph_origin_shift);
+ if (glyph_origin_shift.x != 0 || glyph_origin_shift.y != 0) {
+ ppts->values.matrix.tx = start.x + total.x + glyph_origin_shift.x;
+ ppts->values.matrix.ty = start.y + total.y + glyph_origin_shift.y;
+ code = pdf_set_text_state_values(pdev, &ppts->values);
+ if (code < 0)
+ break;
+ }
+ }
+ pdf_char_widths_to_uts(pdfont3, &cw); /* convert design->text space */
+ if (pte->text.operation & (TEXT_DO_DRAW | TEXT_RENDER_MODE_3)) {
+ gs_distance_transform(cw.Width.xy.x * ppts->values.size,
+ cw.Width.xy.y * ppts->values.size,
+ &ppts->values.matrix, &did);
+ gs_distance_transform((font->WMode ? 0 : ppts->values.character_spacing),
+ (font->WMode ? ppts->values.character_spacing : 0),
+ &ppts->values.matrix, &tpt);
+ did.x += tpt.x;
+ did.y += tpt.y;
+ if (chr == space_char) {
+ gs_distance_transform((font->WMode ? 0 : ppts->values.word_spacing),
+ (font->WMode ? ppts->values.word_spacing : 0),
+ &ppts->values.matrix, &tpt);
+ did.x += tpt.x;
+ did.y += tpt.y;
+ }
+ if (composite && FontType == ft_user_defined)
+ code = pdf_append_chars(pdev, composite_type3_text, 1, did.x, did.y, composite);
+ else
+ code = pdf_append_chars(pdev, pstr->data + index, pte->index - index, did.x, did.y, composite);
+ if (code < 0)
+ break;
+ } else
+ did.x = did.y = 0;
+ if (pte->text.operation & TEXT_REPLACE_WIDTHS) {
+ gs_point dpt;
+
+ code = gs_text_replaced_width(&pte->text, pte->xy_index++, &dpt);
+ if (code < 0)
+ return_error(gs_error_unregistered);
+ gs_distance_transform(dpt.x, dpt.y, &ctm_only(pte->pis), &wanted);
+ } else {
+ gs_distance_transform(cw.real_width.xy.x * ppts->values.size,
+ cw.real_width.xy.y * ppts->values.size,
+ &ppts->values.matrix, &wanted);
+ if (pte->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
+ gs_distance_transform(pte->text.delta_all.x,
+ pte->text.delta_all.y,
+ &ctm_only(pte->pis), &tpt);
+ wanted.x += tpt.x;
+ wanted.y += tpt.y;
+ }
+ if (chr == space_char && pte->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
+ gs_distance_transform(pte->text.delta_space.x,
+ pte->text.delta_space.y,
+ &ctm_only(pte->pis), &tpt);
+ wanted.x += tpt.x;
+ wanted.y += tpt.y;
+ }
+ }
+ total.x += wanted.x;
+ total.y += wanted.y;
+ if (wanted.x != did.x || wanted.y != did.y) {
+ ppts->values.matrix.tx = start.x + total.x;
+ ppts->values.matrix.ty = start.y + total.y;
+ code = pdf_set_text_state_values(pdev, &ppts->values);
+ if (code < 0)
+ break;
+ }
+ pdev->charproc_just_accumulated = false;
}
*pdpt = total;
return 0;
@@ -1095,22 +1095,22 @@ process_text_modify_width(pdf_text_enum_t *pte, gs_font *font,
* An usage of this function is very undesirable,
* because a glyph may be unlisted in Encoding.
*/
-int
+int
pdf_encode_glyph(gs_font_base *bfont, gs_glyph glyph0,
- byte *buf, int buf_size, int *char_code_length)
+ byte *buf, int buf_size, int *char_code_length)
{
gs_char c;
*char_code_length = 1;
- if (*char_code_length > buf_size)
- return_error(gs_error_rangecheck); /* Must not happen. */
+ if (*char_code_length > buf_size)
+ return_error(gs_error_rangecheck); /* Must not happen. */
for (c = 0; c < 255; c++) {
- gs_glyph glyph1 = bfont->procs.encode_char((gs_font *)bfont, c,
- GLYPH_SPACE_NAME);
- if (glyph1 == glyph0) {
- buf[0] = (byte)c;
- return 0;
- }
+ gs_glyph glyph1 = bfont->procs.encode_char((gs_font *)bfont, c,
+ GLYPH_SPACE_NAME);
+ if (glyph1 == glyph0) {
+ buf[0] = (byte)c;
+ return 0;
+ }
}
return_error(gs_error_rangecheck); /* Can't encode. */
}
@@ -1133,108 +1133,108 @@ process_plain_text(gs_text_enum_t *pte, void *vbuf, uint bsize)
const gs_glyph *gdata = NULL;
if (operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES)) {
- count = pte->text.size - pte->index;
- if (bsize < count)
- return_error(gs_error_unregistered); /* Must not happen. */
- memcpy(buf, (const byte *)pte->text.data.bytes + pte->index, count);
+ count = pte->text.size - pte->index;
+ if (bsize < count)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ memcpy(buf, (const byte *)pte->text.data.bytes + pte->index, count);
} else if (operation & (TEXT_FROM_CHARS | TEXT_FROM_SINGLE_CHAR)) {
- /* Check that all chars fit in a single byte. */
- const gs_char *cdata;
- int i;
-
- if (operation & TEXT_FROM_CHARS) {
- cdata = pte->text.data.chars;
- count = (pte->text.size - pte->index);
- } else {
- cdata = &pte->text.data.d_char;
- count = 1;
- }
- if (bsize < count * sizeof(gs_char))
- return_error(gs_error_unregistered); /* Must not happen. */
- for (i = 0; i < count; ++i) {
- gs_char chr = cdata[pte->index + i];
-
- if (chr & ~0xff)
- return_error(gs_error_rangecheck);
- buf[i] = (byte)chr;
- }
+ /* Check that all chars fit in a single byte. */
+ const gs_char *cdata;
+ int i;
+
+ if (operation & TEXT_FROM_CHARS) {
+ cdata = pte->text.data.chars;
+ count = (pte->text.size - pte->index);
+ } else {
+ cdata = &pte->text.data.d_char;
+ count = 1;
+ }
+ if (bsize < count * sizeof(gs_char))
+ return_error(gs_error_unregistered); /* Must not happen. */
+ for (i = 0; i < count; ++i) {
+ gs_char chr = cdata[pte->index + i];
+
+ if (chr & ~0xff)
+ return_error(gs_error_rangecheck);
+ buf[i] = (byte)chr;
+ }
} else if (operation & (TEXT_FROM_GLYPHS | TEXT_FROM_SINGLE_GLYPH)) {
- /*
- * Since PDF has no analogue of 'glyphshow',
- * we try to encode glyphs with the current
- * font's encoding. If the current font has no encoding,
- * or the encoding doesn't contain necessary glyphs,
- * the text will be represented with a Type 3 font with
- * bitmaps or outlines.
- *
- * When we fail with encoding (136-01.ps is an example),
- * we could locate a PDF font resource or create a new one
- * with same outlines and an appropriate encoding.
- * Also we could change .notdef entries in the
- * copied font (assuming that document designer didn't use
- * .notdef for a meanful printing).
- * fixme: Not implemented yet.
- */
- gs_font *font = pte->current_font;
- uint size;
- int i;
-
- if (operation & TEXT_FROM_GLYPHS) {
- gdata = pte->text.data.glyphs;
- size = pte->text.size - pte->index;
- } else {
- gdata = &pte->text.data.d_glyph;
- size = 1;
- }
- if (!pdf_is_simple_font(font))
- return_error(gs_error_unregistered); /* Must not happen. */
- count = 0;
- for (i = 0; i < size; ++i) {
- gs_glyph glyph = gdata[pte->index + i];
- int char_code_length;
-
- code = pdf_encode_glyph((gs_font_base *)font, glyph,
- buf + count, size - count, &char_code_length);
- if (code < 0)
- break;
- count += char_code_length;
- if (operation & TEXT_INTERVENE)
- break; /* Just do one character. */
- }
- if (i < size) {
- pdf_font_resource_t *pdfont;
-
- str.data = buf;
- str.size = size;
- code = pdf_obtain_font_resource_unencoded(penum, &str, &pdfont, gdata);
- if (code < 0) {
- /*
- * pdf_text_process will fall back
- * to default implementation.
- */
- return code;
- }
- count = size;
- }
- /* So far we will use TEXT_FROM_STRING instead
- TEXT_FROM_*_GLYPH*. Since we used a single
- byte encoding, the character index appears invariant
- during this substitution.
- */
+ /*
+ * Since PDF has no analogue of 'glyphshow',
+ * we try to encode glyphs with the current
+ * font's encoding. If the current font has no encoding,
+ * or the encoding doesn't contain necessary glyphs,
+ * the text will be represented with a Type 3 font with
+ * bitmaps or outlines.
+ *
+ * When we fail with encoding (136-01.ps is an example),
+ * we could locate a PDF font resource or create a new one
+ * with same outlines and an appropriate encoding.
+ * Also we could change .notdef entries in the
+ * copied font (assuming that document designer didn't use
+ * .notdef for a meanful printing).
+ * fixme: Not implemented yet.
+ */
+ gs_font *font = pte->current_font;
+ uint size;
+ int i;
+
+ if (operation & TEXT_FROM_GLYPHS) {
+ gdata = pte->text.data.glyphs;
+ size = pte->text.size - pte->index;
+ } else {
+ gdata = &pte->text.data.d_glyph;
+ size = 1;
+ }
+ if (!pdf_is_simple_font(font))
+ return_error(gs_error_unregistered); /* Must not happen. */
+ count = 0;
+ for (i = 0; i < size; ++i) {
+ gs_glyph glyph = gdata[pte->index + i];
+ int char_code_length;
+
+ code = pdf_encode_glyph((gs_font_base *)font, glyph,
+ buf + count, size - count, &char_code_length);
+ if (code < 0)
+ break;
+ count += char_code_length;
+ if (operation & TEXT_INTERVENE)
+ break; /* Just do one character. */
+ }
+ if (i < size) {
+ pdf_font_resource_t *pdfont;
+
+ str.data = buf;
+ str.size = size;
+ code = pdf_obtain_font_resource_unencoded(penum, &str, &pdfont, gdata);
+ if (code < 0) {
+ /*
+ * pdf_text_process will fall back
+ * to default implementation.
+ */
+ return code;
+ }
+ count = size;
+ }
+ /* So far we will use TEXT_FROM_STRING instead
+ TEXT_FROM_*_GLYPH*. Since we used a single
+ byte encoding, the character index appears invariant
+ during this substitution.
+ */
} else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
str.data = buf;
if (count > 1 && (operation & TEXT_INTERVENE)) {
- /* Just do one character. */
- str.size = 1;
- code = pdf_process_string_aux(penum, &str, gdata, NULL, &text_state);
- if (code >= 0) {
- pte->returned.current_char = buf[0];
- code = TEXT_PROCESS_INTERVENE;
- }
+ /* Just do one character. */
+ str.size = 1;
+ code = pdf_process_string_aux(penum, &str, gdata, NULL, &text_state);
+ if (code >= 0) {
+ pte->returned.current_char = buf[0];
+ code = TEXT_PROCESS_INTERVENE;
+ }
} else {
- str.size = count;
- code = pdf_process_string_aux(penum, &str, gdata, NULL, &text_state);
+ str.size = count;
+ code = pdf_process_string_aux(penum, &str, gdata, NULL, &text_state);
}
return code;
}
diff --git a/gs/base/gdevpdtf.c b/gs/base/gdevpdtf.c
index 215d932de..2e6e0bc28 100644
--- a/gs/base/gdevpdtf.c
+++ b/gs/base/gdevpdtf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,7 +63,7 @@ case 7: switch (pdfont->FontType) {
case 8: switch (pdfont->FontType) {
case ft_composite:
return (pdfont->u.type0.cmap_is_standard ? ENUM_OBJ(0) :
- ENUM_CONST_STRING(&pdfont->u.type0.CMapName));
+ ENUM_CONST_STRING(&pdfont->u.type0.CMapName));
case ft_encrypted:
case ft_encrypted2:
case ft_TrueType:
@@ -116,29 +116,29 @@ RELOC_PTRS_WITH(pdf_font_resource_reloc_ptrs, pdf_font_resource_t *pdfont)
RELOC_VAR(pdfont->cmap_ToUnicode);
switch (pdfont->FontType) {
case ft_composite:
- if (!pdfont->u.type0.cmap_is_standard)
- RELOC_CONST_STRING_VAR(pdfont->u.type0.CMapName);
- RELOC_VAR(pdfont->u.type0.DescendantFont);
- break;
+ if (!pdfont->u.type0.cmap_is_standard)
+ RELOC_CONST_STRING_VAR(pdfont->u.type0.CMapName);
+ RELOC_VAR(pdfont->u.type0.DescendantFont);
+ break;
case ft_user_defined:
- RELOC_VAR(pdfont->u.simple.Encoding);
- RELOC_VAR(pdfont->u.simple.v);
- RELOC_VAR(pdfont->u.simple.s.type3.char_procs);
- RELOC_VAR(pdfont->u.simple.s.type3.cached);
- RELOC_VAR(pdfont->u.simple.s.type3.Resources);
- break;
+ RELOC_VAR(pdfont->u.simple.Encoding);
+ RELOC_VAR(pdfont->u.simple.v);
+ RELOC_VAR(pdfont->u.simple.s.type3.char_procs);
+ RELOC_VAR(pdfont->u.simple.s.type3.cached);
+ RELOC_VAR(pdfont->u.simple.s.type3.Resources);
+ break;
case ft_CID_encrypted:
case ft_CID_TrueType:
- RELOC_VAR(pdfont->u.cidfont.Widths2);
- RELOC_VAR(pdfont->u.cidfont.v);
- RELOC_VAR(pdfont->u.cidfont.CIDToGIDMap);
- RELOC_VAR(pdfont->u.cidfont.parent);
- RELOC_VAR(pdfont->u.cidfont.used2);
- break;
+ RELOC_VAR(pdfont->u.cidfont.Widths2);
+ RELOC_VAR(pdfont->u.cidfont.v);
+ RELOC_VAR(pdfont->u.cidfont.CIDToGIDMap);
+ RELOC_VAR(pdfont->u.cidfont.parent);
+ RELOC_VAR(pdfont->u.cidfont.used2);
+ break;
default:
- RELOC_VAR(pdfont->u.simple.Encoding);
- RELOC_VAR(pdfont->u.simple.v);
- break;
+ RELOC_VAR(pdfont->u.simple.Encoding);
+ RELOC_VAR(pdfont->u.simple.v);
+ break;
}
}
RELOC_PTRS_END
@@ -179,10 +179,10 @@ pdf_find_standard_font_name(const byte *str, uint size)
const pdf_standard_font_info_t *ppsf;
for (ppsf = standard_font_info; ppsf->fname; ++ppsf)
- if (ppsf->size == size &&
- !memcmp(ppsf->fname, (const char *)str, size)
- )
- return ppsf - standard_font_info;
+ if (ppsf->size == size &&
+ !memcmp(ppsf->fname, (const char *)str, size)
+ )
+ return ppsf - standard_font_info;
return -1;
}
@@ -194,7 +194,7 @@ pdf_find_standard_font_name(const byte *str, uint size)
*/
static int
find_std_appearance(const gx_device_pdf *pdev, gs_font_base *bfont,
- int mask, pdf_char_glyph_pair_t *pairs, int num_glyphs)
+ int mask, pdf_char_glyph_pair_t *pairs, int num_glyphs)
{
bool has_uid = uid_is_UniqueID(&bfont->UID) && bfont->UID.id != 0;
const pdf_standard_font_t *psf = pdf_standard_fonts(pdev);
@@ -204,38 +204,38 @@ find_std_appearance(const gx_device_pdf *pdev, gs_font_base *bfont,
case ft_encrypted:
case ft_encrypted2:
case ft_TrueType:
- break;
+ break;
default:
- return -1;
+ return -1;
}
for (i = 0; i < PDF_NUM_STANDARD_FONTS; ++psf, ++i) {
- gs_font_base *cfont;
- int code;
-
- if (!psf->pdfont)
- continue;
- cfont = pdf_font_resource_font(psf->pdfont, false);
- if (has_uid) {
- /*
- * Require the UIDs to match. The PostScript spec says this
- * is the case iff the outlines are the same.
- */
- if (!uid_equal(&bfont->UID, &cfont->UID))
- continue;
- }
- /*
- * Require the actual outlines to match (within the given subset).
- */
- code = gs_copied_can_copy_glyphs((const gs_font *)cfont,
- (const gs_font *)bfont,
- &pairs[0].glyph, num_glyphs,
- sizeof(pdf_char_glyph_pair_t), true);
- if (code == gs_error_unregistered) /* Debug purpose only. */
- return code;
- /* Note: code < 0 means an error. Skip it here. */
- if (code > 0)
- return i;
+ gs_font_base *cfont;
+ int code;
+
+ if (!psf->pdfont)
+ continue;
+ cfont = pdf_font_resource_font(psf->pdfont, false);
+ if (has_uid) {
+ /*
+ * Require the UIDs to match. The PostScript spec says this
+ * is the case iff the outlines are the same.
+ */
+ if (!uid_equal(&bfont->UID, &cfont->UID))
+ continue;
+ }
+ /*
+ * Require the actual outlines to match (within the given subset).
+ */
+ code = gs_copied_can_copy_glyphs((const gs_font *)cfont,
+ (const gs_font *)bfont,
+ &pairs[0].glyph, num_glyphs,
+ sizeof(pdf_char_glyph_pair_t), true);
+ if (code == gs_error_unregistered) /* Debug purpose only. */
+ return code;
+ /* Note: code < 0 means an error. Skip it here. */
+ if (code > 0)
+ return i;
}
return -1;
}
@@ -252,26 +252,26 @@ scan_for_standard_fonts(gx_device_pdf *pdev, const gs_font_dir *dir)
gs_font *orig = dir->orig_fonts;
for (; orig; orig = orig->next) {
- gs_font_base *obfont;
-
- if (orig->FontType == ft_composite || !orig->is_resource)
- continue;
- obfont = (gs_font_base *)orig;
- if (uid_is_UniqueID(&obfont->UID)) {
- /* Is it one of the standard fonts? */
- int i = pdf_find_standard_font_name(orig->key_name.chars,
- orig->key_name.size);
-
- if (i >= 0 && pdf_standard_fonts(pdev)[i].pdfont == 0) {
- pdf_font_resource_t *pdfont;
- int code = pdf_font_std_alloc(pdev, &pdfont, true, orig->id, obfont,
- i);
-
- if (code < 0)
- continue;
- found = true;
- }
- }
+ gs_font_base *obfont;
+
+ if (orig->FontType == ft_composite || !orig->is_resource)
+ continue;
+ obfont = (gs_font_base *)orig;
+ if (uid_is_UniqueID(&obfont->UID)) {
+ /* Is it one of the standard fonts? */
+ int i = pdf_find_standard_font_name(orig->key_name.chars,
+ orig->key_name.size);
+
+ if (i >= 0 && pdf_standard_fonts(pdev)[i].pdfont == 0) {
+ pdf_font_resource_t *pdfont;
+ int code = pdf_font_std_alloc(pdev, &pdfont, true, orig->id, obfont,
+ i);
+
+ if (code < 0)
+ continue;
+ found = true;
+ }
+ }
}
return found;
}
@@ -285,16 +285,16 @@ pdf_outline_fonts_t *
pdf_outline_fonts_alloc(gs_memory_t *mem)
{
pdf_outline_fonts_t *pofs =
- gs_alloc_struct(mem, pdf_outline_fonts_t, &st_pdf_outline_fonts,
- "pdf_outline_fonts_alloc(outline_fonts)");
+ gs_alloc_struct(mem, pdf_outline_fonts_t, &st_pdf_outline_fonts,
+ "pdf_outline_fonts_alloc(outline_fonts)");
pdf_standard_font_t *ppsf =
- gs_alloc_struct_array(mem, PDF_NUM_STANDARD_FONTS,
- pdf_standard_font_t,
- &st_pdf_standard_font_element,
- "pdf_outline_fonts_alloc(standard_fonts)");
+ gs_alloc_struct_array(mem, PDF_NUM_STANDARD_FONTS,
+ pdf_standard_font_t,
+ &st_pdf_standard_font_element,
+ "pdf_outline_fonts_alloc(standard_fonts)");
if (pofs == 0 || ppsf == 0)
- return 0;
+ return 0;
memset(ppsf, 0, PDF_NUM_STANDARD_FONTS * sizeof(*ppsf));
memset(pofs, 0, sizeof(*pofs));
pofs->standard_fonts = ppsf;
@@ -321,19 +321,17 @@ pdf_clean_standard_fonts(const gx_device_pdf *pdev)
memset(ppsf, 0, PDF_NUM_STANDARD_FONTS * sizeof(*ppsf));
}
-
/* ---------------- Font resources ---------------- */
/* ------ Private ------ */
-
-static int
+static int
pdf_resize_array(gs_memory_t *mem, void **p, int elem_size, int old_size, int new_size)
{
void *q = gs_alloc_byte_array(mem, new_size, elem_size, "pdf_resize_array");
if (q == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset((char *)q + elem_size * old_size, 0, elem_size * (new_size - old_size));
memcpy(q, *p, elem_size * old_size);
gs_free_object(mem, *p, "pdf_resize_array");
@@ -346,9 +344,9 @@ pdf_resize_array(gs_memory_t *mem, void **p, int elem_size, int old_size, int ne
*/
static int
font_resource_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- pdf_resource_type_t rtype, gs_id rid, font_type ftype,
- int chars_count,
- pdf_font_write_contents_proc_t write_contents)
+ pdf_resource_type_t rtype, gs_id rid, font_type ftype,
+ int chars_count,
+ pdf_font_write_contents_proc_t write_contents)
{
gs_memory_t *mem = pdev->pdf_memory;
pdf_font_resource_t *pfres;
@@ -358,28 +356,28 @@ font_resource_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
bool is_CID_font = (ftype == ft_CID_encrypted || ftype == ft_CID_TrueType);
if (chars_count != 0) {
- uint size = (chars_count + 7) / 8;
-
- if (!is_CID_font) {
- widths = (void *)gs_alloc_byte_array(mem, chars_count, sizeof(*widths),
- "font_resource_alloc(Widths)");
- } else {
- /* Delay allocation because we don't know which WMode will be used. */
- }
- used = gs_alloc_bytes(mem, size, "font_resource_alloc(used)");
- if ((!is_CID_font && widths == 0) || used == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
- }
- if (!is_CID_font)
- memset(widths, 0, chars_count * sizeof(*widths));
- memset(used, 0, size);
+ uint size = (chars_count + 7) / 8;
+
+ if (!is_CID_font) {
+ widths = (void *)gs_alloc_byte_array(mem, chars_count, sizeof(*widths),
+ "font_resource_alloc(Widths)");
+ } else {
+ /* Delay allocation because we don't know which WMode will be used. */
+ }
+ used = gs_alloc_bytes(mem, size, "font_resource_alloc(used)");
+ if ((!is_CID_font && widths == 0) || used == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
+ }
+ if (!is_CID_font)
+ memset(widths, 0, chars_count * sizeof(*widths));
+ memset(used, 0, size);
}
code = pdf_alloc_resource(pdev, rtype, rid, (pdf_resource_t **)&pfres, -1L);
if (code < 0)
- goto fail;
+ goto fail;
memset((byte *)pfres + sizeof(pdf_resource_t), 0,
- sizeof(*pfres) - sizeof(pdf_resource_t));
+ sizeof(*pfres) - sizeof(pdf_resource_t));
pfres->FontType = ftype;
pfres->count = chars_count;
pfres->Widths = widths;
@@ -401,37 +399,37 @@ int
pdf_assign_font_object_id(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
{
if (pdf_resource_id((pdf_resource_t *)pdfont) == -1) {
- int code;
-
- pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont, 0);
- code = pdf_mark_font_descriptor_used(pdev, pdfont->FontDescriptor);
- if (code < 0)
- return code;
- if (pdfont->FontType == 0) {
- pdf_font_resource_t *pdfont1 = pdfont->u.type0.DescendantFont;
-
- if (pdf_font_id(pdfont1) == -1) {
- pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont1, 0);
- code = pdf_mark_font_descriptor_used(pdev, pdfont1->FontDescriptor);
- if (code < 0)
- return code;
- }
- }
+ int code;
+
+ pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont, 0);
+ code = pdf_mark_font_descriptor_used(pdev, pdfont->FontDescriptor);
+ if (code < 0)
+ return code;
+ if (pdfont->FontType == 0) {
+ pdf_font_resource_t *pdfont1 = pdfont->u.type0.DescendantFont;
+
+ if (pdf_font_id(pdfont1) == -1) {
+ pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont1, 0);
+ code = pdf_mark_font_descriptor_used(pdev, pdfont1->FontDescriptor);
+ if (code < 0)
+ return code;
+ }
+ }
}
return 0;
}
static int
font_resource_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, font_type ftype, int chars_count,
- pdf_font_write_contents_proc_t write_contents)
+ gs_id rid, font_type ftype, int chars_count,
+ pdf_font_write_contents_proc_t write_contents)
{
pdf_font_resource_t *pfres;
int code = font_resource_alloc(pdev, &pfres, resourceFont, rid, ftype,
- chars_count, write_contents);
+ chars_count, write_contents);
if (code < 0)
- return code;
+ return code;
pfres->u.simple.FirstChar = 256;
pfres->u.simple.LastChar = -1;
pfres->u.simple.BaseEncoding = -1;
@@ -442,39 +440,38 @@ font_resource_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
}
int
font_resource_encoded_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, font_type ftype,
- pdf_font_write_contents_proc_t write_contents)
+ gs_id rid, font_type ftype,
+ pdf_font_write_contents_proc_t write_contents)
{
pdf_encoding_element_t *Encoding =
- gs_alloc_struct_array(pdev->pdf_memory, 256, pdf_encoding_element_t,
- &st_pdf_encoding_element,
- "font_resource_encoded_alloc");
- gs_point *v = (gs_point *)gs_alloc_byte_array(pdev->pdf_memory,
- 256, sizeof(gs_point), "pdf_font_simple_alloc");
+ gs_alloc_struct_array(pdev->pdf_memory, 256, pdf_encoding_element_t,
+ &st_pdf_encoding_element,
+ "font_resource_encoded_alloc");
+ gs_point *v = (gs_point *)gs_alloc_byte_array(pdev->pdf_memory,
+ 256, sizeof(gs_point), "pdf_font_simple_alloc");
pdf_font_resource_t *pdfont;
int code, i;
-
if (v == 0 || Encoding == 0) {
- gs_free_object(pdev->pdf_memory, Encoding,
- "font_resource_encoded_alloc");
- gs_free_object(pdev->pdf_memory, v,
- "font_resource_encoded_alloc");
- return_error(gs_error_VMerror);
+ gs_free_object(pdev->pdf_memory, Encoding,
+ "font_resource_encoded_alloc");
+ gs_free_object(pdev->pdf_memory, v,
+ "font_resource_encoded_alloc");
+ return_error(gs_error_VMerror);
}
code = font_resource_simple_alloc(pdev, &pdfont, rid, ftype,
- 256, write_contents);
+ 256, write_contents);
if (code < 0) {
- gs_free_object(pdev->pdf_memory, Encoding,
- "font_resource_encoded_alloc");
- gs_free_object(pdev->pdf_memory, v,
- "font_resource_encoded_alloc");
- return_error(gs_error_VMerror);
+ gs_free_object(pdev->pdf_memory, Encoding,
+ "font_resource_encoded_alloc");
+ gs_free_object(pdev->pdf_memory, v,
+ "font_resource_encoded_alloc");
+ return_error(gs_error_VMerror);
}
memset(v, 0, 256 * sizeof(*v));
memset(Encoding, 0, 256 * sizeof(*Encoding));
for (i = 0; i < 256; ++i)
- Encoding[i].glyph = GS_NO_GLYPH;
+ Encoding[i].glyph = GS_NO_GLYPH;
pdfont->u.simple.Encoding = Encoding;
pdfont->u.simple.v = v;
*ppfres = pdfont;
@@ -490,69 +487,69 @@ set_is_MM_instance(pdf_font_resource_t *pdfont, const gs_font_base *pfont)
switch (pfont->FontType) {
case ft_encrypted:
case ft_encrypted2:
- pdfont->u.simple.s.type1.is_MM_instance =
- ((const gs_font_type1 *)pfont)->data.WeightVector.count > 0;
+ pdfont->u.simple.s.type1.is_MM_instance =
+ ((const gs_font_type1 *)pfont)->data.WeightVector.count > 0;
default:
- break;
+ break;
}
}
/* ------ Generic public ------ */
/* Resize font resource arrays. */
-int
+int
pdf_resize_resource_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pfres, int chars_count)
{
/* This function fixes CID fonts that provide a lesser CIDCount than
CIDs used in a document. Rather PS requires to print CID=0,
- we need to provide a bigger CIDCount since we don't
- re-encode the text. The text should look fine if the
+ we need to provide a bigger CIDCount since we don't
+ re-encode the text. The text should look fine if the
viewer application substitutes the font. */
gs_memory_t *mem = pdev->pdf_memory;
int code;
-
+
if (chars_count < pfres->count)
- return 0;
+ return 0;
if (pfres->Widths != NULL) {
- code = pdf_resize_array(mem, (void **)&pfres->Widths, sizeof(*pfres->Widths),
- pfres->count, chars_count);
- if (code < 0)
- return code;
+ code = pdf_resize_array(mem, (void **)&pfres->Widths, sizeof(*pfres->Widths),
+ pfres->count, chars_count);
+ if (code < 0)
+ return code;
}
- code = pdf_resize_array(mem, (void **)&pfres->used, sizeof(*pfres->used),
- (pfres->count + 7) / 8, (chars_count + 7) / 8);
+ code = pdf_resize_array(mem, (void **)&pfres->used, sizeof(*pfres->used),
+ (pfres->count + 7) / 8, (chars_count + 7) / 8);
if (code < 0)
- return code;
+ return code;
if (pfres->FontType == ft_CID_encrypted || pfres->FontType == ft_CID_TrueType) {
- if (pfres->u.cidfont.v != NULL) {
- code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.v,
- sizeof(*pfres->u.cidfont.v), pfres->count * 2, chars_count * 2);
- if (code < 0)
- return code;
- }
- if (pfres->u.cidfont.Widths2 != NULL) {
- code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.Widths2,
- sizeof(*pfres->u.cidfont.Widths2), pfres->count, chars_count);
- if (code < 0)
- return code;
- }
+ if (pfres->u.cidfont.v != NULL) {
+ code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.v,
+ sizeof(*pfres->u.cidfont.v), pfres->count * 2, chars_count * 2);
+ if (code < 0)
+ return code;
+ }
+ if (pfres->u.cidfont.Widths2 != NULL) {
+ code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.Widths2,
+ sizeof(*pfres->u.cidfont.Widths2), pfres->count, chars_count);
+ if (code < 0)
+ return code;
+ }
}
if (pfres->FontType == ft_CID_TrueType) {
- if (pfres->u.cidfont.CIDToGIDMap != NULL) {
- code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.CIDToGIDMap,
- sizeof(*pfres->u.cidfont.CIDToGIDMap), pfres->count, chars_count);
- if (code < 0)
- return code;
- }
+ if (pfres->u.cidfont.CIDToGIDMap != NULL) {
+ code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.CIDToGIDMap,
+ sizeof(*pfres->u.cidfont.CIDToGIDMap), pfres->count, chars_count);
+ if (code < 0)
+ return code;
+ }
}
if (pfres->FontType == ft_CID_encrypted || pfres->FontType == ft_CID_TrueType) {
- if (pfres->u.cidfont.used2 != NULL) {
- code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.used2,
- sizeof(*pfres->u.cidfont.used2),
- (pfres->count + 7) / 8, (chars_count + 7) / 8);
- if (code < 0)
- return code;
- }
+ if (pfres->u.cidfont.used2 != NULL) {
+ code = pdf_resize_array(mem, (void **)&pfres->u.cidfont.used2,
+ sizeof(*pfres->u.cidfont.used2),
+ (pfres->count + 7) / 8, (chars_count + 7) / 8);
+ if (code < 0)
+ return code;
+ }
}
pfres->count = chars_count;
return 0;
@@ -573,9 +570,9 @@ gs_font_base *
pdf_font_resource_font(const pdf_font_resource_t *pdfont, bool complete)
{
if (pdfont->base_font != NULL)
- return pdf_base_font_font(pdfont->base_font, complete);
+ return pdf_base_font_font(pdfont->base_font, complete);
if (pdfont->FontDescriptor == 0)
- return 0;
+ return 0;
return pdf_font_descriptor_font(pdfont->FontDescriptor, complete);
}
@@ -588,42 +585,42 @@ static bool
font_is_symbolic(const gs_font *font)
{
if (font->FontType == ft_composite)
- return true; /* arbitrary */
+ return true; /* arbitrary */
switch (((const gs_font_base *)font)->nearest_encoding_index) {
case ENCODING_INDEX_STANDARD:
case ENCODING_INDEX_ISOLATIN1:
case ENCODING_INDEX_WINANSI:
case ENCODING_INDEX_MACROMAN:
- return false;
+ return false;
default:
- return true;
+ return true;
}
}
static bool
embed_list_includes(const gs_param_string_array *psa, const byte *chars,
- uint size)
+ uint size)
{
uint i;
for (i = 0; i < psa->size; ++i)
- if (!bytes_compare(psa->data[i].data, psa->data[i].size, chars, size))
- return true;
+ if (!bytes_compare(psa->data[i].data, psa->data[i].size, chars, size))
+ return true;
return false;
}
static bool
embed_as_standard(gx_device_pdf *pdev, gs_font *font, int index,
- pdf_char_glyph_pair_t *pairs, int num_glyphs)
+ pdf_char_glyph_pair_t *pairs, int num_glyphs)
{
if (font->is_resource) {
- return true;
+ return true;
}
if (find_std_appearance(pdev, (gs_font_base *)font, -1,
- pairs, num_glyphs) == index)
- return true;
+ pairs, num_glyphs) == index)
+ return true;
if (!scan_for_standard_fonts(pdev, font->dir))
- return false;
+ return false;
return (find_std_appearance(pdev, (gs_font_base *)font, -1,
- pairs, num_glyphs) == index);
+ pairs, num_glyphs) == index);
}
static bool
has_extension_glyphs(gs_font *pfont)
@@ -636,13 +633,13 @@ has_extension_glyphs(gs_font *pfont)
psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, NULL, 0, GLYPH_SPACE_NAME);
for (glyph = gs_no_glyph; (psf_enumerate_glyphs_next(&genum, &glyph)) != 1; ) {
- code = pfont->procs.glyph_name(pfont, glyph, &str);
- if (code < 0)
- return code;
- l = str.size - sl;
- for (j = 0; j < l; j ++)
- if (!memcmp(gx_extendeg_glyph_name_separator, str.data + j, sl))
- return true;
+ code = pfont->procs.glyph_name(pfont, glyph, &str);
+ if (code < 0)
+ return code;
+ l = str.size - sl;
+ for (j = 0; j < l; j ++)
+ if (!memcmp(gx_extendeg_glyph_name_separator, str.data + j, sl))
+ return true;
}
psf_enumerate_glyphs_reset(&genum);
return false;
@@ -650,7 +647,7 @@ has_extension_glyphs(gs_font *pfont)
pdf_font_embed_t
pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font, int *pindex,
- pdf_char_glyph_pair_t *pairs, int num_glyphs)
+ pdf_char_glyph_pair_t *pairs, int num_glyphs)
{
const gs_font_name *fn = &font->font_name;
const byte *chars = fn->chars;
@@ -664,29 +661,29 @@ pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font, int *pindex,
memset(&info, 0x00, sizeof(gs_font_info_t));
code = font->procs.font_info(font, NULL, FONT_INFO_EMBEDDING_RIGHTS, &info);
if (code == 0 && (info.members & FONT_INFO_EMBEDDING_RIGHTS)) {
- if (((info.EmbeddingRights == 0x0002) || (info.EmbeddingRights & 0x0200))
- && !IsInWhiteList ((const char *)chars, size)) {
- /* See the OpenType specification, "The 'OS/2' and Windows Metrics Table" for details
- of the fstype parameter. This is a bitfield, currently we forbid embedding of fonts
- with these bits set:
- bit 1 0x0002 Fonts that have only this bit set must not be modified, embedded or
- exchanged in any manner.
- bit 9 0x0200 Bitmap embedding only.
-
- Note for Restricted License embedding (bit 1), this must be the only level of embedding
- selected (see the OpenType spec).
+ if (((info.EmbeddingRights == 0x0002) || (info.EmbeddingRights & 0x0200))
+ && !IsInWhiteList ((const char *)chars, size)) {
+ /* See the OpenType specification, "The 'OS/2' and Windows Metrics Table" for details
+ of the fstype parameter. This is a bitfield, currently we forbid embedding of fonts
+ with these bits set:
+ bit 1 0x0002 Fonts that have only this bit set must not be modified, embedded or
+ exchanged in any manner.
+ bit 9 0x0200 Bitmap embedding only.
+
+ Note for Restricted License embedding (bit 1), this must be the only level of embedding
+ selected (see the OpenType spec).
*/
- char name[gs_font_name_max + 1];
- int len;
+ char name[gs_font_name_max + 1];
+ int len;
- len = min(gs_font_name_max, font->font_name.size);
- memcpy(name, font->font_name.chars, len);
- name[len] = 0;
- emprintf1(pdev->memory,
+ len = min(gs_font_name_max, font->font_name.size);
+ memcpy(name, font->font_name.chars, len);
+ name[len] = 0;
+ emprintf1(pdev->memory,
"\nWarning: %s cannot be embedded because of licensing restrictions\n",
name);
- return FONT_EMBED_NO;
- }
+ return FONT_EMBED_NO;
+ }
}
/*
* The behavior of Acrobat Distiller changed between 3.0 (PDF 1.2),
@@ -696,34 +693,34 @@ pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font, int *pindex,
* special treatment.
*/
if (pindex)
- *pindex = index;
+ *pindex = index;
if (pdev->PDFX || pdev->PDFA)
- return FONT_EMBED_YES;
+ return FONT_EMBED_YES;
if (pdev->CompatibilityLevel < 1.3) {
- if (index >= 0 &&
- (embed_as_standard_called = true,
- do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs))) {
- if (pdev->ForOPDFRead && has_extension_glyphs(font))
- return FONT_EMBED_YES;
- return FONT_EMBED_STANDARD;
- }
+ if (index >= 0 &&
+ (embed_as_standard_called = true,
+ do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs))) {
+ if (pdev->ForOPDFRead && has_extension_glyphs(font))
+ return FONT_EMBED_YES;
+ return FONT_EMBED_STANDARD;
+ }
}
/* Check the Embed lists. */
if (!embed_list_includes(&pdev->params.NeverEmbed, chars, size) ||
- (index >= 0 &&
- !(embed_as_standard_called ? do_embed_as_standard :
- (embed_as_standard_called = true,
- (do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs)))))
- /* Ignore NeverEmbed for a non-standard font with a standard name */
- ) {
- if (pdev->params.EmbedAllFonts || font_is_symbolic(font) ||
- embed_list_includes(&pdev->params.AlwaysEmbed, chars, size))
- return FONT_EMBED_YES;
+ (index >= 0 &&
+ !(embed_as_standard_called ? do_embed_as_standard :
+ (embed_as_standard_called = true,
+ (do_embed_as_standard = embed_as_standard(pdev, font, index, pairs, num_glyphs)))))
+ /* Ignore NeverEmbed for a non-standard font with a standard name */
+ ) {
+ if (pdev->params.EmbedAllFonts || font_is_symbolic(font) ||
+ embed_list_includes(&pdev->params.AlwaysEmbed, chars, size))
+ return FONT_EMBED_YES;
}
- if (index >= 0 &&
- (embed_as_standard_called ? do_embed_as_standard :
- embed_as_standard(pdev, font, index, pairs, num_glyphs)))
- return FONT_EMBED_STANDARD;
+ if (index >= 0 &&
+ (embed_as_standard_called ? do_embed_as_standard :
+ embed_as_standard(pdev, font, index, pairs, num_glyphs)))
+ return FONT_EMBED_STANDARD;
return FONT_EMBED_NO;
}
@@ -740,82 +737,82 @@ pdf_compute_BaseFont(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, bool fini
byte *data;
if (pdfont->FontType == ft_composite) {
- int code;
-
- pdsubf = pdfont->u.type0.DescendantFont;
- code = pdf_compute_BaseFont(pdev, pdsubf, finish);
- if (code < 0)
- return code;
- fname = pdsubf->BaseFont;
- if (pdsubf->FontType == ft_CID_encrypted || pdsubf->FontType == ft_CID_TrueType)
- extra = 1 + pdfont->u.type0.CMapName.size;
+ int code;
+
+ pdsubf = pdfont->u.type0.DescendantFont;
+ code = pdf_compute_BaseFont(pdev, pdsubf, finish);
+ if (code < 0)
+ return code;
+ fname = pdsubf->BaseFont;
+ if (pdsubf->FontType == ft_CID_encrypted || pdsubf->FontType == ft_CID_TrueType)
+ extra = 1 + pdfont->u.type0.CMapName.size;
}
else if (pdfont->FontDescriptor == 0) {
- /* Type 3 font, or has its BaseFont computed in some other way. */
- return 0;
+ /* Type 3 font, or has its BaseFont computed in some other way. */
+ return 0;
} else
- fname = *pdf_font_descriptor_base_name(pdsubf->FontDescriptor);
+ fname = *pdf_font_descriptor_base_name(pdsubf->FontDescriptor);
size = fname.size;
data = gs_alloc_string(pdev->pdf_memory, size + extra,
- "pdf_compute_BaseFont");
+ "pdf_compute_BaseFont");
if (data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(data, fname.data, size);
switch (pdfont->FontType) {
case ft_composite:
- if (extra) {
- data[size] = '-';
- memcpy(data + size + 1, pdfont->u.type0.CMapName.data, extra - 1);
- size += extra;
- }
- break;
+ if (extra) {
+ data[size] = '-';
+ memcpy(data + size + 1, pdfont->u.type0.CMapName.data, extra - 1);
+ size += extra;
+ }
+ break;
case ft_encrypted:
case ft_encrypted2:
- if (pdfont->u.simple.s.type1.is_MM_instance &&
- !pdf_font_descriptor_embedding(pdfont->FontDescriptor)
- ) {
- /* Replace spaces by underscores in the base name. */
- uint i;
-
- for (i = 0; i < size; ++i)
- if (data[i] == ' ')
- data[i] = '_';
- }
- break;
+ if (pdfont->u.simple.s.type1.is_MM_instance &&
+ !pdf_font_descriptor_embedding(pdfont->FontDescriptor)
+ ) {
+ /* Replace spaces by underscores in the base name. */
+ uint i;
+
+ for (i = 0; i < size; ++i)
+ if (data[i] == ' ')
+ data[i] = '_';
+ }
+ break;
case ft_TrueType:
case ft_CID_TrueType: {
- /* Remove spaces from the base name. */
- uint i, j;
-
- for (i = j = 0; i < size; ++i)
- if (data[i] != ' ')
- data[j++] = data[i];
- data = gs_resize_string(pdev->pdf_memory, data, i, j,
- "pdf_compute_BaseFont");
- size = j;
- break;
+ /* Remove spaces from the base name. */
+ uint i, j;
+
+ for (i = j = 0; i < size; ++i)
+ if (data[i] != ' ')
+ data[j++] = data[i];
+ data = gs_resize_string(pdev->pdf_memory, data, i, j,
+ "pdf_compute_BaseFont");
+ size = j;
+ break;
}
default:
- break;
+ break;
}
pdfont->BaseFont.data = fname.data = data;
pdfont->BaseFont.size = fname.size = size;
/* Compute names for subset fonts. */
if (finish && pdfont->FontDescriptor != NULL &&
- pdf_font_descriptor_is_subset(pdfont->FontDescriptor) &&
- !pdf_has_subset_prefix(fname.data, fname.size) &&
- pdf_font_descriptor_embedding(pdfont->FontDescriptor)
- ) {
- int code = pdf_add_subset_prefix(pdev, &fname, pdfont->used, pdfont->count);
-
- if (code < 0)
- return code;
+ pdf_font_descriptor_is_subset(pdfont->FontDescriptor) &&
+ !pdf_has_subset_prefix(fname.data, fname.size) &&
+ pdf_font_descriptor_embedding(pdfont->FontDescriptor)
+ ) {
+ int code = pdf_add_subset_prefix(pdev, &fname, pdfont->used, pdfont->count);
+
+ if (code < 0)
+ return code;
pdfont->BaseFont = fname;
- /* Don't write a UID for subset fonts. */
- uid_set_invalid(&pdf_font_resource_font(pdfont, false)->UID);
+ /* Don't write a UID for subset fonts. */
+ uid_set_invalid(&pdf_font_resource_font(pdfont, false)->UID);
}
if (pdfont->FontType != ft_composite && pdsubf->FontDescriptor)
- *pdf_font_descriptor_name(pdsubf->FontDescriptor) = fname;
+ *pdf_font_descriptor_name(pdsubf->FontDescriptor) = fname;
return 0;
}
@@ -824,19 +821,19 @@ pdf_compute_BaseFont(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, bool fini
/* Allocate a Type 0 font resource. */
int
pdf_font_type0_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_resource_t *DescendantFont,
- const gs_const_string *CMapName)
+ gs_id rid, pdf_font_resource_t *DescendantFont,
+ const gs_const_string *CMapName)
{
int code = font_resource_alloc(pdev, ppfres, resourceFont, rid,
- ft_composite, 0, pdf_write_contents_type0);
+ ft_composite, 0, pdf_write_contents_type0);
if (code >= 0) {
- (*ppfres)->u.type0.DescendantFont = DescendantFont;
- (*ppfres)->u.type0.CMapName = *CMapName;
- (*ppfres)->u.type0.font_index = 0;
- code = pdf_compute_BaseFont(pdev, *ppfres, false);
+ (*ppfres)->u.type0.DescendantFont = DescendantFont;
+ (*ppfres)->u.type0.CMapName = *CMapName;
+ (*ppfres)->u.type0.font_index = 0;
+ code = pdf_compute_BaseFont(pdev, *ppfres, false);
}
- return code;
+ return code;
}
/* ------ Type 3 ------ */
@@ -844,10 +841,10 @@ pdf_font_type0_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
/* Allocate a Type 3 font resource for sinthesyzed bitmap fonts. */
int
pdf_font_type3_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- pdf_font_write_contents_proc_t write_contents)
+ pdf_font_write_contents_proc_t write_contents)
{
return font_resource_simple_alloc(pdev, ppfres, gs_no_id, ft_user_defined,
- 256, write_contents);
+ 256, write_contents);
}
/* ------ Standard (base 14) Type 1 or TrueType ------ */
@@ -855,26 +852,26 @@ pdf_font_type3_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
/* Allocate a standard (base 14) font resource. */
int
pdf_font_std_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- bool is_original, gs_id rid, gs_font_base *pfont, int index)
+ bool is_original, gs_id rid, gs_font_base *pfont, int index)
{
pdf_font_resource_t *pdfont;
int code = font_resource_encoded_alloc(pdev, &pdfont, rid, pfont->FontType,
- pdf_write_contents_std);
+ pdf_write_contents_std);
const pdf_standard_font_info_t *psfi = &standard_font_info[index];
pdf_standard_font_t *psf = &pdf_standard_fonts(pdev)[index];
gs_matrix *orig_matrix = (is_original ? &pfont->FontMatrix : &psf->orig_matrix);
if (code < 0 ||
- (code = pdf_base_font_alloc(pdev, &pdfont->base_font, pfont, orig_matrix, true)) < 0
- )
- return code;
+ (code = pdf_base_font_alloc(pdev, &pdfont->base_font, pfont, orig_matrix, true)) < 0
+ )
+ return code;
pdfont->BaseFont.data = (byte *)psfi->fname; /* break const */
pdfont->BaseFont.size = strlen(psfi->fname);
pdfont->mark_glyph = pfont->dir->ccache.mark_glyph;
set_is_MM_instance(pdfont, pfont);
if (is_original) {
- psf->pdfont = pdfont;
- psf->orig_matrix = pfont->FontMatrix;
+ psf->pdfont = pdfont;
+ psf->orig_matrix = pfont->FontMatrix;
}
*ppfres = pdfont;
return 0;
@@ -885,17 +882,17 @@ pdf_font_std_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
/* Allocate a Type 1 or TrueType font resource. */
int
pdf_font_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_descriptor_t *pfd)
+ gs_id rid, pdf_font_descriptor_t *pfd)
{
pdf_font_resource_t *pdfont;
int code;
code = font_resource_encoded_alloc(pdev, &pdfont, rid,
- pdf_font_descriptor_FontType(pfd),
- pdf_write_contents_simple);
+ pdf_font_descriptor_FontType(pfd),
+ pdf_write_contents_simple);
if (code < 0)
- return(gs_note_error(code));
+ return(gs_note_error(code));
pdfont->FontDescriptor = pfd;
set_is_MM_instance(pdfont, pdf_font_descriptor_font(pfd, false));
*ppfres = pdfont;
@@ -907,7 +904,7 @@ pdf_font_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
/* Allocate a CIDFont resource. */
int
pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_descriptor_t *pfd)
+ gs_id rid, pdf_font_descriptor_t *pfd)
{
font_type FontType = pdf_font_descriptor_FontType(pfd);
gs_font_base *font = pdf_font_descriptor_font(pfd, false);
@@ -920,30 +917,30 @@ pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
switch (FontType) {
case ft_CID_encrypted:
- chars_count = ((const gs_font_cid0 *)font)->cidata.common.CIDCount;
- pcidsi = &((const gs_font_cid0 *)font)->cidata.common.CIDSystemInfo;
- write_contents = pdf_write_contents_cid0;
- break;
+ chars_count = ((const gs_font_cid0 *)font)->cidata.common.CIDCount;
+ pcidsi = &((const gs_font_cid0 *)font)->cidata.common.CIDSystemInfo;
+ write_contents = pdf_write_contents_cid0;
+ break;
case ft_CID_TrueType:
- chars_count = ((const gs_font_cid2 *)font)->cidata.common.CIDCount;
- pcidsi = &((const gs_font_cid2 *)font)->cidata.common.CIDSystemInfo;
- map = (void *)gs_alloc_byte_array(pdev->pdf_memory, chars_count,
- sizeof(*map), "CIDToGIDMap");
- if (map == 0)
- return_error(gs_error_VMerror);
- memset(map, 0, chars_count * sizeof(*map));
- write_contents = pdf_write_contents_cid2;
- break;
+ chars_count = ((const gs_font_cid2 *)font)->cidata.common.CIDCount;
+ pcidsi = &((const gs_font_cid2 *)font)->cidata.common.CIDSystemInfo;
+ map = (void *)gs_alloc_byte_array(pdev->pdf_memory, chars_count,
+ sizeof(*map), "CIDToGIDMap");
+ if (map == 0)
+ return_error(gs_error_VMerror);
+ memset(map, 0, chars_count * sizeof(*map));
+ write_contents = pdf_write_contents_cid2;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
code = font_resource_alloc(pdev, &pdfont, resourceCIDFont, rid, FontType,
- chars_count, write_contents);
+ chars_count, write_contents);
if (code < 0)
- return code;
+ return code;
pdfont->FontDescriptor = pfd;
pdfont->u.cidfont.CIDToGIDMap = map;
- /* fixme : Likely pdfont->u.cidfont.CIDToGIDMap duplicates
+ /* fixme : Likely pdfont->u.cidfont.CIDToGIDMap duplicates
pdfont->FontDescriptor->base_font->copied->client_data->CIDMap.
Only difference is 0xFFFF designates unmapped CIDs.
*/
@@ -952,8 +949,8 @@ pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
pdfont->u.cidfont.parent = NULL;
/* Don' know whether the font will use WMode 1,
so reserve it now. */
- pdfont->u.cidfont.used2 = gs_alloc_bytes(pdev->pdf_memory,
- (chars_count + 7) / 8, "pdf_font_cidfont_alloc");
+ pdfont->u.cidfont.used2 = gs_alloc_bytes(pdev->pdf_memory,
+ (chars_count + 7) / 8, "pdf_font_cidfont_alloc");
if (pdfont->u.cidfont.used2 == NULL)
return_error(gs_error_VMerror);
memset(pdfont->u.cidfont.used2, 0, (chars_count + 7) / 8);
@@ -963,13 +960,13 @@ pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
*/
code = pdf_write_cid_systemInfo_separate(pdev, pcidsi, &pdfont->u.cidfont.CIDSystemInfo_id);
if (code < 0)
- return code;
+ return code;
*ppfres = pdfont;
return pdf_compute_BaseFont(pdev, pdfont, false);
}
int
-pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
+pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
int wmode, double **w, double **w0, double **v)
{
gs_memory_t *mem = pdev->pdf_memory;
@@ -980,36 +977,36 @@ pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfon
*v = (wmode ? pdfont->u.cidfont.v : NULL);
*w = (wmode ? pdfont->u.cidfont.Widths2 : pdfont->Widths);
if (*w == NULL) {
- ww = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*ww),
- "pdf_obtain_cidfont_widths_arrays");
- if (wmode) {
- vv = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*vv) * 2,
- "pdf_obtain_cidfont_widths_arrays");
- if (pdfont->Widths == 0) {
- ww0 = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*ww0),
- "pdf_obtain_cidfont_widths_arrays");
- pdfont->Widths = *w0 = ww0;
- if (ww0 != 0)
- memset(ww0, 0, chars_count * sizeof(*ww));
- } else
- *w0 = ww0 = pdfont->Widths;
- }
- if (ww == 0 || (wmode && vv == 0) || (wmode && ww0 == 0)) {
- gs_free_object(mem, ww, "pdf_obtain_cidfont_widths_arrays");
- gs_free_object(mem, vv, "pdf_obtain_cidfont_widths_arrays");
- gs_free_object(mem, ww0, "pdf_obtain_cidfont_widths_arrays");
- return_error(gs_error_VMerror);
- }
- if (wmode)
- memset(vv, 0, chars_count * 2 * sizeof(*vv));
- memset(ww, 0, chars_count * sizeof(*ww));
- if (wmode) {
- pdfont->u.cidfont.Widths2 = *w = ww;
- pdfont->u.cidfont.v = *v = vv;
- } else {
- pdfont->Widths = *w = ww;
- *v = NULL;
- }
+ ww = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*ww),
+ "pdf_obtain_cidfont_widths_arrays");
+ if (wmode) {
+ vv = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*vv) * 2,
+ "pdf_obtain_cidfont_widths_arrays");
+ if (pdfont->Widths == 0) {
+ ww0 = (double *)gs_alloc_byte_array(mem, chars_count, sizeof(*ww0),
+ "pdf_obtain_cidfont_widths_arrays");
+ pdfont->Widths = *w0 = ww0;
+ if (ww0 != 0)
+ memset(ww0, 0, chars_count * sizeof(*ww));
+ } else
+ *w0 = ww0 = pdfont->Widths;
+ }
+ if (ww == 0 || (wmode && vv == 0) || (wmode && ww0 == 0)) {
+ gs_free_object(mem, ww, "pdf_obtain_cidfont_widths_arrays");
+ gs_free_object(mem, vv, "pdf_obtain_cidfont_widths_arrays");
+ gs_free_object(mem, ww0, "pdf_obtain_cidfont_widths_arrays");
+ return_error(gs_error_VMerror);
+ }
+ if (wmode)
+ memset(vv, 0, chars_count * 2 * sizeof(*vv));
+ memset(ww, 0, chars_count * sizeof(*ww));
+ if (wmode) {
+ pdfont->u.cidfont.Widths2 = *w = ww;
+ pdfont->u.cidfont.v = *v = vv;
+ } else {
+ pdfont->Widths = *w = ww;
+ *v = NULL;
+ }
}
return 0;
}
@@ -1017,53 +1014,53 @@ pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfon
/*
* Convert True Type fonts into CID fonts for PDF/A.
*/
-int
+int
pdf_convert_truetype_font(gx_device_pdf *pdev, pdf_resource_t *pres)
{
if (!pdev->PDFA)
- return 0;
+ return 0;
else {
- pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
-
- if (pdfont->FontType != ft_TrueType)
- return 0;
- else if (pdf_resource_id(pres) == -1)
- return 0; /* An unused font. */
- else {
- int code = pdf_different_encoding_index(pdfont, 0);
-
- if (code < 0)
- return code;
- if (code == 256 && pdfont->u.simple.BaseEncoding != ENCODING_INDEX_UNKNOWN)
- return 0;
- { /* The encoding have a difference - do convert. */
- pdf_font_resource_t *pdfont0;
- gs_const_string CMapName = {(const byte *)"OneByteIdentityH", 16};
-
- code = pdf_convert_truetype_font_descriptor(pdev, pdfont);
- if (code < 0)
- return code;
- code = pdf_font_type0_alloc(pdev, &pdfont0, pres->rid + 1, pdfont, &CMapName);
- if (code < 0)
- return code;
- /* Pass the font object ID to the type 0 font resource. */
- pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont0, pdf_resource_id(pres));
- pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont, gs_no_id);
- /* Set Encoding_name because we won't call attach_cmap_resource for it : */
- code = pdf_write_OneByteIdentityH(pdev);
- if (code < 0)
- return 0;
- pdfont->u.cidfont.CIDSystemInfo_id = pdev->IdentityCIDSystemInfo_id;
- sprintf(pdfont0->u.type0.Encoding_name, "%ld 0 R", pdf_resource_id(pdev->OneByteIdentityH));
- /* Move ToUnicode : */
- pdfont0->res_ToUnicode = pdfont->res_ToUnicode; pdfont->res_ToUnicode = 0;
- pdfont0->cmap_ToUnicode = pdfont->cmap_ToUnicode; pdfont->cmap_ToUnicode = 0;
- /* Change the font type to CID font : */
- pdfont->FontType = ft_CID_TrueType;
- pdfont->write_contents = pdf_write_contents_cid2;
- return 0;
- }
- }
+ pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
+
+ if (pdfont->FontType != ft_TrueType)
+ return 0;
+ else if (pdf_resource_id(pres) == -1)
+ return 0; /* An unused font. */
+ else {
+ int code = pdf_different_encoding_index(pdfont, 0);
+
+ if (code < 0)
+ return code;
+ if (code == 256 && pdfont->u.simple.BaseEncoding != ENCODING_INDEX_UNKNOWN)
+ return 0;
+ { /* The encoding have a difference - do convert. */
+ pdf_font_resource_t *pdfont0;
+ gs_const_string CMapName = {(const byte *)"OneByteIdentityH", 16};
+
+ code = pdf_convert_truetype_font_descriptor(pdev, pdfont);
+ if (code < 0)
+ return code;
+ code = pdf_font_type0_alloc(pdev, &pdfont0, pres->rid + 1, pdfont, &CMapName);
+ if (code < 0)
+ return code;
+ /* Pass the font object ID to the type 0 font resource. */
+ pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont0, pdf_resource_id(pres));
+ pdf_reserve_object_id(pdev, (pdf_resource_t *)pdfont, gs_no_id);
+ /* Set Encoding_name because we won't call attach_cmap_resource for it : */
+ code = pdf_write_OneByteIdentityH(pdev);
+ if (code < 0)
+ return 0;
+ pdfont->u.cidfont.CIDSystemInfo_id = pdev->IdentityCIDSystemInfo_id;
+ sprintf(pdfont0->u.type0.Encoding_name, "%ld 0 R", pdf_resource_id(pdev->OneByteIdentityH));
+ /* Move ToUnicode : */
+ pdfont0->res_ToUnicode = pdfont->res_ToUnicode; pdfont->res_ToUnicode = 0;
+ pdfont0->cmap_ToUnicode = pdfont->cmap_ToUnicode; pdfont->cmap_ToUnicode = 0;
+ /* Change the font type to CID font : */
+ pdfont->FontType = ft_CID_TrueType;
+ pdfont->write_contents = pdf_write_contents_cid2;
+ return 0;
+ }
+ }
}
}
@@ -1074,8 +1071,7 @@ pdf_convert_truetype_font(gx_device_pdf *pdev, pdf_resource_t *pres)
*/
int
pdf_cmap_alloc(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
- pdf_resource_t **ppres, int font_index_only)
+ pdf_resource_t **ppres, int font_index_only)
{
return pdf_write_cmap(pdev, pcmap, ppres, font_index_only);
}
-
diff --git a/gs/base/gdevpdtf.h b/gs/base/gdevpdtf.h
index 413eba616..06055e4e0 100644
--- a/gs/base/gdevpdtf.h
+++ b/gs/base/gdevpdtf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -144,7 +144,6 @@ typedef struct pdf_encoding_element_s {
"pdf_encoding_element_t[]", pdf_encoding_elt_enum_ptrs,\
pdf_encoding_elt_reloc_ptrs, st_pdf_encoding1)
-
struct pdf_base_font_s {
/*
* For the standard 14 fonts, copied == complete is a complete copy
@@ -160,9 +159,9 @@ struct pdf_base_font_s {
gs_font_base *copied;
gs_font_base *complete;
enum {
- DO_SUBSET_UNKNOWN = 0,
- DO_SUBSET_NO,
- DO_SUBSET_YES
+ DO_SUBSET_UNKNOWN = 0,
+ DO_SUBSET_NO,
+ DO_SUBSET_YES
} do_subset;
bool is_standard;
/*
@@ -186,7 +185,6 @@ BASIC_PTRS(pdf_base_font_ptrs) {\
GC_STRING_ELT(pdf_base_font_t, font_name)\
}
-
typedef struct {
gs_id id;
pdf_resource_type_t type;
@@ -204,7 +202,7 @@ struct pdf_font_resource_s {
pdf_font_write_contents_proc_t write_contents;
gs_string BaseFont; /* (not used for Type 3) */
pdf_font_descriptor_t *FontDescriptor; /* (not used for Type 0, Type 3, */
- /* or standard 14 fonts) */
+ /* or standard 14 fonts) */
/*
* The base_font member is only used for
* the standard 14 fonts, which do not have a FontDescriptor.
@@ -213,88 +211,88 @@ struct pdf_font_resource_s {
uint count; /* # of chars/CIDs */
double *Widths; /* [count] (not used for Type 0) */
byte *used; /* [ceil(count/8)] bitmap of chars/CIDs used */
- /* (not used for Type 0 or Type 3) */
+ /* (not used for Type 0 or Type 3) */
pdf_resource_t *res_ToUnicode; /* CMap (not used for CIDFonts) */
gs_cmap_t *cmap_ToUnicode; /* CMap (not used for CIDFonts) */
gs_glyph_mark_proc_t mark_glyph;
void *mark_glyph_data; /* closure data */
union {
- struct /*type0*/ {
-
- pdf_font_resource_t *DescendantFont; /* CIDFont */
- /*
- * The Encoding_name must be long enough to hold either the
- * longest standard CMap name defined in the PDF Reference,
- * or the longest reference to an embedded CMap (# 0 R).
- */
- char Encoding_name[max( /* standard name or <id> 0 R */
- 17, /* /UniJIS-UCS2-HW-H */
- sizeof(long) * 8 / 3 + 1 + 4 /* <id> 0 R */
- ) + 1 /* \0 terminator */
- ];
- gs_const_string CMapName; /* copied from the original CMap, */
- /* or references the table of standard names */
- uint font_index; /* The index of the descendent font in the source CMap. */
- bool cmap_is_standard;
- int WMode; /* of CMap */
-
- } type0;
-
- struct /*cidfont*/ {
-
- /* [D]W[2] is Widths. */
- long CIDSystemInfo_id; /* (written when font is allocated) */
- ushort *CIDToGIDMap; /* (CIDFontType 2 only) [count] */
- gs_id glyphshow_font_id;
- double *Widths2; /* [count * 2] (x, y) */
- double *v; /* [count] */
- byte *used2; /* [(count + 7) / 8] */
- pdf_font_resource_t *parent;
-
- } cidfont;
-
- struct /*simple*/ {
-
- int FirstChar, LastChar; /* 0 <= FirstChar <= LastChar <= 255 */
- /*
- * The BaseEncoding can only be ENCODING_INDEX_WINANSI,
- * ENCODING_INDEX_MACROMAN, ENCODING_INDEX_MACEXPERT, or -1.
- */
- gs_encoding_index_t BaseEncoding;
- gs_encoding_index_t preferred_encoding_index;
- pdf_encoding_element_t *Encoding; /* [256], not for Type 3 */
- gs_point *v; /* [256], glyph origin for WMode 1 */
- int last_reserved_char; /* Except for synthesised Type 3,
- which stores such data in LastChar */
-
- union {
-
- struct /*type1*/ {
- bool is_MM_instance;
- } type1;
-
- struct /*truetype*/ {
- /*
- * No extra info needed, but the ANSI standard doesn't
- * allow empty structs.
- */
- int _dummy;
- } truetype;
-
- struct /*type3*/ {
- gs_rect FontBBox;
- gs_matrix FontMatrix;
- pdf_char_proc_ownership_t *char_procs;
- int max_y_offset;
- bool bitmap_font;
- cos_dict_t *Resources;
- byte *cached;
- } type3;
-
- } s;
-
- } simple;
+ struct /*type0*/ {
+
+ pdf_font_resource_t *DescendantFont; /* CIDFont */
+ /*
+ * The Encoding_name must be long enough to hold either the
+ * longest standard CMap name defined in the PDF Reference,
+ * or the longest reference to an embedded CMap (# 0 R).
+ */
+ char Encoding_name[max( /* standard name or <id> 0 R */
+ 17, /* /UniJIS-UCS2-HW-H */
+ sizeof(long) * 8 / 3 + 1 + 4 /* <id> 0 R */
+ ) + 1 /* \0 terminator */
+ ];
+ gs_const_string CMapName; /* copied from the original CMap, */
+ /* or references the table of standard names */
+ uint font_index; /* The index of the descendent font in the source CMap. */
+ bool cmap_is_standard;
+ int WMode; /* of CMap */
+
+ } type0;
+
+ struct /*cidfont*/ {
+
+ /* [D]W[2] is Widths. */
+ long CIDSystemInfo_id; /* (written when font is allocated) */
+ ushort *CIDToGIDMap; /* (CIDFontType 2 only) [count] */
+ gs_id glyphshow_font_id;
+ double *Widths2; /* [count * 2] (x, y) */
+ double *v; /* [count] */
+ byte *used2; /* [(count + 7) / 8] */
+ pdf_font_resource_t *parent;
+
+ } cidfont;
+
+ struct /*simple*/ {
+
+ int FirstChar, LastChar; /* 0 <= FirstChar <= LastChar <= 255 */
+ /*
+ * The BaseEncoding can only be ENCODING_INDEX_WINANSI,
+ * ENCODING_INDEX_MACROMAN, ENCODING_INDEX_MACEXPERT, or -1.
+ */
+ gs_encoding_index_t BaseEncoding;
+ gs_encoding_index_t preferred_encoding_index;
+ pdf_encoding_element_t *Encoding; /* [256], not for Type 3 */
+ gs_point *v; /* [256], glyph origin for WMode 1 */
+ int last_reserved_char; /* Except for synthesised Type 3,
+ which stores such data in LastChar */
+
+ union {
+
+ struct /*type1*/ {
+ bool is_MM_instance;
+ } type1;
+
+ struct /*truetype*/ {
+ /*
+ * No extra info needed, but the ANSI standard doesn't
+ * allow empty structs.
+ */
+ int _dummy;
+ } truetype;
+
+ struct /*type3*/ {
+ gs_rect FontBBox;
+ gs_matrix FontMatrix;
+ pdf_char_proc_ownership_t *char_procs;
+ int max_y_offset;
+ bool bitmap_font;
+ cos_dict_t *Resources;
+ byte *cached;
+ } type3;
+
+ } s;
+
+ } simple;
} u;
};
@@ -376,26 +374,26 @@ int pdf_free_font_cache(gx_device_pdf *pdev);
* Allocate specific types of font resource.
*/
int pdf_font_type0_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_resource_t *DescendantFont,
- const gs_const_string *CMapName);
+ gs_id rid, pdf_font_resource_t *DescendantFont,
+ const gs_const_string *CMapName);
int pdf_font_type3_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- pdf_font_write_contents_proc_t write_contents);
+ pdf_font_write_contents_proc_t write_contents);
int pdf_font_std_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- bool is_original, gs_id rid, gs_font_base *pfont, int index);
+ bool is_original, gs_id rid, gs_font_base *pfont, int index);
int pdf_font_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_descriptor_t *pfd);
+ gs_id rid, pdf_font_descriptor_t *pfd);
int pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, pdf_font_descriptor_t *pfd);
-int pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
- int wmode, double **w, double **w0, double **v);
+ gs_id rid, pdf_font_descriptor_t *pfd);
+int pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
+ int wmode, double **w, double **w0, double **v);
int font_resource_encoded_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
- gs_id rid, font_type ftype,
- pdf_font_write_contents_proc_t write_contents);
+ gs_id rid, font_type ftype,
+ pdf_font_write_contents_proc_t write_contents);
int pdf_assign_font_object_id(gx_device_pdf *pdev, pdf_font_resource_t *pdfont);
/* Resize font resource arrays. */
-int pdf_resize_resource_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pfres,
- int chars_count);
+int pdf_resize_resource_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pfres,
+ int chars_count);
/*
* Return the (copied, subset or complete) font associated with a font resource.
@@ -411,8 +409,8 @@ gs_font_base *pdf_font_resource_font(const pdf_font_resource_t *pdfont, bool com
* (pindex and/or psame may be NULL.)
*/
pdf_font_embed_t pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font,
- int *pindex,
- pdf_char_glyph_pair_t *pairs, int num_glyphs);
+ int *pindex,
+ pdf_char_glyph_pair_t *pairs, int num_glyphs);
/*
* Compute the BaseFont of a font according to the algorithm described
@@ -442,7 +440,7 @@ int pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_
* Allocate a CMap resource.
*/
int pdf_cmap_alloc(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
- pdf_resource_t **ppres /* CMap */, int font_index_only);
+ pdf_resource_t **ppres /* CMap */, int font_index_only);
/*
* Add a CID-to-GID mapping to a CIDFontType 2 font resource.
diff --git a/gs/base/gdevpdti.c b/gs/base/gdevpdti.c
index 3aa8b099b..7e702af3e 100644
--- a/gs/base/gdevpdti.c
+++ b/gs/base/gdevpdti.c
@@ -1,7 +1,6 @@
-
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,74 +80,74 @@ assign_char_code(gx_device_pdf * pdev, gs_text_enum_t *pte)
uint operation = pte->text.operation;
if (pbfs->bitmap_encoding_id == 0)
- pbfs->bitmap_encoding_id = pdf_obj_ref(pdev);
+ pbfs->bitmap_encoding_id = pdf_obj_ref(pdev);
if (pdfont == 0 || pdfont->u.simple.LastChar == 255 ||
- !pbfs->use_open_font
- ) {
- /* Start a new synthesized font. */
- char *pc;
-
- code = pdf_font_type3_alloc(pdev, &pdfont, pdf_write_contents_bitmap);
- if (code < 0)
- return code;
+ !pbfs->use_open_font
+ ) {
+ /* Start a new synthesized font. */
+ char *pc;
+
+ code = pdf_font_type3_alloc(pdev, &pdfont, pdf_write_contents_bitmap);
+ if (code < 0)
+ return code;
pdfont->u.simple.s.type3.bitmap_font = true;
- if (pbfs->open_font == 0)
- pdfont->rname[0] = 0;
- else
- strcpy(pdfont->rname, pbfs->open_font->rname);
- pdfont->u.simple.s.type3.FontBBox.p.x = 0;
- pdfont->u.simple.s.type3.FontBBox.p.y = 0;
- pdfont->u.simple.s.type3.FontBBox.q.x = 0;
- pdfont->u.simple.s.type3.FontBBox.q.y = 0;
- pdfont->mark_glyph = NULL;
- gs_make_identity(&pdfont->u.simple.s.type3.FontMatrix);
- /*
- * We "increment" the font name as a radix-26 "number".
- * This cannot possibly overflow.
- */
- for (pc = pdfont->rname; *pc == 'Z'; ++pc)
- *pc = '@';
- if ((*pc)++ == 0)
- *pc = 'A', pc[1] = 0;
- pbfs->open_font = pdfont;
- pbfs->use_open_font = true;
- pdfont->u.simple.FirstChar = 255;
+ if (pbfs->open_font == 0)
+ pdfont->rname[0] = 0;
+ else
+ strcpy(pdfont->rname, pbfs->open_font->rname);
+ pdfont->u.simple.s.type3.FontBBox.p.x = 0;
+ pdfont->u.simple.s.type3.FontBBox.p.y = 0;
+ pdfont->u.simple.s.type3.FontBBox.q.x = 0;
+ pdfont->u.simple.s.type3.FontBBox.q.y = 0;
+ pdfont->mark_glyph = NULL;
+ gs_make_identity(&pdfont->u.simple.s.type3.FontMatrix);
+ /*
+ * We "increment" the font name as a radix-26 "number".
+ * This cannot possibly overflow.
+ */
+ for (pc = pdfont->rname; *pc == 'Z'; ++pc)
+ *pc = '@';
+ if ((*pc)++ == 0)
+ *pc = 'A', pc[1] = 0;
+ pbfs->open_font = pdfont;
+ pbfs->use_open_font = true;
+ pdfont->u.simple.FirstChar = 255;
}
if ((operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES)) ||
(operation & (TEXT_FROM_CHARS | TEXT_FROM_SINGLE_CHAR))) {
- unsigned char p = *pte->text.data.bytes;
- unsigned char index = p / 8, bit = 0x01 << (p % 8);
-
- if (pdfont->used[index] & bit) {
- for (i = 0;i < 256;i++) {
- index = i / 8;
- bit = 0x01 << (i % 8);
- if (!(pdfont->used[index] & bit)) {
- c = i;
- break;
- }
- }
- } else
- c = p;
- pdfont->used[index] |= bit;
- if (c > pdfont->u.simple.LastChar)
- pdfont->u.simple.LastChar = c;
+ unsigned char p = *pte->text.data.bytes;
+ unsigned char index = p / 8, bit = 0x01 << (p % 8);
+
+ if (pdfont->used[index] & bit) {
+ for (i = 0;i < 256;i++) {
+ index = i / 8;
+ bit = 0x01 << (i % 8);
+ if (!(pdfont->used[index] & bit)) {
+ c = i;
+ break;
+ }
+ }
+ } else
+ c = p;
+ pdfont->used[index] |= bit;
+ if (c > pdfont->u.simple.LastChar)
+ pdfont->u.simple.LastChar = c;
} else {
- unsigned char index, bit;
+ unsigned char index, bit;
c = ++(pdfont->u.simple.LastChar);
- index = c / 8;
- bit = 0x01 << (c % 8);
- pdfont->used[index] |= bit;
+ index = c / 8;
+ bit = 0x01 << (c % 8);
+ pdfont->used[index] |= bit;
}
if (c < pdfont->u.simple.FirstChar)
pdfont->u.simple.FirstChar = c;
- pdfont->Widths[c] = psdf_round(pdev->char_width.x, 100, 10); /* See
- pdf_write_Widths about rounding. We need to provide
- a compatible data for Tj. */
+ pdfont->Widths[c] = psdf_round(pdev->char_width.x, 100, 10); /* See
+ pdf_write_Widths about rounding. We need to provide
+ a compatible data for Tj. */
if (c > pbfs->max_embedded_code)
- pbfs->max_embedded_code = c;
+ pbfs->max_embedded_code = c;
return c;
}
@@ -163,42 +162,42 @@ pdf_write_contents_bitmap(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
int code;
if (pdfont->u.simple.s.type3.bitmap_font)
- diff_id = pdev->text->bitmap_fonts->bitmap_encoding_id;
+ diff_id = pdev->text->bitmap_fonts->bitmap_encoding_id;
else {
- /* See comment in pdf_write_encoding. */
+ /* See comment in pdf_write_encoding. */
diff_id = pdf_obj_ref(pdev);
}
code = pdf_write_encoding_ref(pdev, pdfont, diff_id);
if (code < 0)
- return code;
+ return code;
stream_puts(s, "/CharProcs <<");
/* Write real characters. */
for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo;
- pcpo = pcpo->char_next
- ) {
- if (pdfont->u.simple.s.type3.bitmap_font)
- pprintld2(s, "/a%ld %ld 0 R\n", (long)pcpo->char_code,
- pdf_char_proc_id(pcpo->char_proc));
- else if (!pcpo-> duplicate_char_name) {
- pdf_put_name(pdev, pcpo->char_name.data, pcpo->char_name.size);
- pprintld1(s, " %ld 0 R\n", pdf_char_proc_id(pcpo->char_proc));
- }
+ pcpo = pcpo->char_next
+ ) {
+ if (pdfont->u.simple.s.type3.bitmap_font)
+ pprintld2(s, "/a%ld %ld 0 R\n", (long)pcpo->char_code,
+ pdf_char_proc_id(pcpo->char_proc));
+ else if (!pcpo-> duplicate_char_name) {
+ pdf_put_name(pdev, pcpo->char_name.data, pcpo->char_name.size);
+ pprintld1(s, " %ld 0 R\n", pdf_char_proc_id(pcpo->char_proc));
+ }
}
stream_puts(s, ">>");
- pprintg6(s, "/FontMatrix[%g %g %g %g %g %g]",
- (float)pdfont->u.simple.s.type3.FontMatrix.xx,
- (float)pdfont->u.simple.s.type3.FontMatrix.xy,
- (float)pdfont->u.simple.s.type3.FontMatrix.yx,
- (float)pdfont->u.simple.s.type3.FontMatrix.yy,
- (float)pdfont->u.simple.s.type3.FontMatrix.tx,
- (float)pdfont->u.simple.s.type3.FontMatrix.ty);
+ pprintg6(s, "/FontMatrix[%g %g %g %g %g %g]",
+ (float)pdfont->u.simple.s.type3.FontMatrix.xx,
+ (float)pdfont->u.simple.s.type3.FontMatrix.xy,
+ (float)pdfont->u.simple.s.type3.FontMatrix.yx,
+ (float)pdfont->u.simple.s.type3.FontMatrix.yy,
+ (float)pdfont->u.simple.s.type3.FontMatrix.tx,
+ (float)pdfont->u.simple.s.type3.FontMatrix.ty);
code = pdf_finish_write_contents_type3(pdev, pdfont);
if (code < 0)
- return code;
+ return code;
if (!pdfont->u.simple.s.type3.bitmap_font && diff_id > 0) {
- code = pdf_write_encoding(pdev, pdfont, diff_id, 0);
- if (code < 0)
- return code;
+ code = pdf_write_encoding(pdev, pdfont, diff_id, 0);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -212,11 +211,11 @@ pdf_bitmap_fonts_t *
pdf_bitmap_fonts_alloc(gs_memory_t *mem)
{
pdf_bitmap_fonts_t *pbfs =
- gs_alloc_struct(mem, pdf_bitmap_fonts_t, &st_pdf_bitmap_fonts,
- "pdf_bitmap_fonts_alloc");
+ gs_alloc_struct(mem, pdf_bitmap_fonts_t, &st_pdf_bitmap_fonts,
+ "pdf_bitmap_fonts_alloc");
if (pbfs == 0)
- return 0;
+ return 0;
memset(pbfs, 0, sizeof(*pbfs));
pbfs->max_embedded_code = -1;
return pbfs;
@@ -238,7 +237,7 @@ pdf_close_text_page(gx_device_pdf *pdev)
* add additional characters on subsequent pages.
*/
if (pdev->CompatibilityLevel <= 1.2)
- pdev->text->bitmap_fonts->use_open_font = false;
+ pdev->text->bitmap_fonts->use_open_font = false;
}
int
@@ -256,28 +255,28 @@ pdf_charproc_x_offset(pdf_char_proc_t *pcp)
/* Attach a CharProc to a font. */
static int
pdf_attach_charproc(gx_device_pdf * pdev, pdf_font_resource_t *pdfont, pdf_char_proc_t *pcp,
- gs_glyph glyph, gs_char char_code, const gs_const_string *gnstr)
+ gs_glyph glyph, gs_char char_code, const gs_const_string *gnstr)
{
pdf_char_proc_ownership_t *pcpo;
bool duplicate_char_name = false;
-
+
for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pcpo->glyph == glyph && pcpo->char_code == char_code)
- return 0;
+ if (pcpo->glyph == glyph && pcpo->char_code == char_code)
+ return 0;
}
if (!pdfont->u.simple.s.type3.bitmap_font) {
- for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- if (!bytes_compare(pcpo->char_name.data, pcpo->char_name.size, gnstr->data, gnstr->size)) {
- duplicate_char_name = true;
- break;
- }
- }
+ for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
+ if (!bytes_compare(pcpo->char_name.data, pcpo->char_name.size, gnstr->data, gnstr->size)) {
+ duplicate_char_name = true;
+ break;
+ }
+ }
}
- pcpo = gs_alloc_struct(pdev->pdf_memory,
- pdf_char_proc_ownership_t, &st_pdf_char_proc_ownership, "pdf_attach_charproc");
+ pcpo = gs_alloc_struct(pdev->pdf_memory,
+ pdf_char_proc_ownership_t, &st_pdf_char_proc_ownership, "pdf_attach_charproc");
if (pcpo == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcpo->font = pdfont;
pcpo->char_next = pdfont->u.simple.s.type3.char_procs;
pdfont->u.simple.s.type3.char_procs = pcpo;
@@ -287,10 +286,10 @@ pdf_attach_charproc(gx_device_pdf * pdev, pdf_font_resource_t *pdfont, pdf_char_
pcpo->char_code = char_code;
pcpo->glyph = glyph;
if (gnstr == NULL) {
- pcpo->char_name.data = 0;
- pcpo->char_name.size = 0;
+ pcpo->char_name.data = 0;
+ pcpo->char_name.size = 0;
} else
- pcpo->char_name = *gnstr;
+ pcpo->char_name = *gnstr;
pcpo->duplicate_char_name = duplicate_char_name;
return 0;
}
@@ -298,11 +297,11 @@ pdf_attach_charproc(gx_device_pdf * pdev, pdf_font_resource_t *pdfont, pdf_char_
/* Begin a CharProc for a synthesized (bitmap) font. */
int
pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
- int y_offset, int x_offset, gs_id id, pdf_char_proc_t ** ppcp,
- pdf_stream_position_t * ppos)
+ int y_offset, int x_offset, gs_id id, pdf_char_proc_t ** ppcp,
+ pdf_stream_position_t * ppos)
{
gs_char char_code = 0;
- pdf_bitmap_fonts_t *const pbfs = pdev->text->bitmap_fonts;
+ pdf_bitmap_fonts_t *const pbfs = pdev->text->bitmap_fonts;
pdf_font_resource_t *font;
pdf_resource_t *pres;
pdf_char_proc_t *pcp;
@@ -315,123 +314,123 @@ pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
/* Since this is for text searching, its only useful if the character code
* lies in an ASCII range, so we only handle some kinds of text layout.
*/
- int allowed_op = (show_enum->text.operation &
- (TEXT_FROM_STRING | TEXT_FROM_BYTES | TEXT_FROM_CHARS | TEXT_FROM_SINGLE_CHAR));
+ int allowed_op = (show_enum->text.operation &
+ (TEXT_FROM_STRING | TEXT_FROM_BYTES | TEXT_FROM_CHARS | TEXT_FROM_SINGLE_CHAR));
/* Check to see the current font is a type 3. We can get here if pdfwrite decides
* it can't handle a font type, and renders to a bitmap instead. If that's the
- * case then we can't add the bitmap to the existing font (its not a type 3 font)
+ * case then we can't add the bitmap to the existing font (its not a type 3 font)
* and must fall back to holding it in our fallback type 3 font 'collection'.
*/
- /* Because the bitmaps are stored directly in the cache they already have any
+ /* Because the bitmaps are stored directly in the cache they already have any
* effects caused by non-identity FontMatrix entries applied. So if the type 3
- * font we created has a non-identity FontMatrix we can't use it and must
+ * font we created has a non-identity FontMatrix we can't use it and must
* go back to collecting the bitmap into our fallback font.
*/
- if (show_enum->current_font->FontType == ft_user_defined && allowed_op &&
- show_enum->current_font->FontMatrix.xx == 1 && show_enum->current_font->FontMatrix.xy == 0 &&
- show_enum->current_font->FontMatrix.yx == 0 && show_enum->current_font->FontMatrix.yy == 1) {
- pdf_char_proc_ownership_t *pcpo;
-
- gs_font_base *base = (gs_font_base *)show_enum->current_font;
- code = pdf_attached_font_resource(pdev, show_enum->current_font, &font, NULL, NULL, NULL, NULL);
- if (code < 0)
- return code;
- /* The text processing will have run past the glyph, so we need to 'back up'
- * by one and get it again in order to get the character code and glyph, and update
- * the pointer correctly.
- */
- show_enum->index--;
- code = gs_default_next_char_glyph((gs_text_enum_t *)show_enum, (gs_char *)&char_code, &glyph);
- if (code < 0)
- return code;
-
- /* If the returned character code is outside the possible Encoding for
- * a type 3 font, then set pet to NULL, this means we will fall back to
- * the 'collection' font, as pet is checked below.
- */
- if (char_code >= 0 && char_code <= 255) {
- pet = &font->u.simple.Encoding[char_code];
- if (pet) {
- /* Check to see if we *already* have this glyph in this font. If
- * we do then we can't add it to this font. Setting pet to 0
- * falls back to the collection method.
- */
- for (pcpo = font->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pcpo->glyph == pet->glyph && pcpo->char_code == char_code) {
- pet = 0x00;
- break;
- }
- }
- }
- }
- else
- pet = 0x00;
-
- /* We need a glyph name for the type 3 font's Encoding, if we haven't got one
- * then we need to give up, something about the font or text is not acceptable
- * (see various comments above).
- */
- if (pet && pet->glyph != GS_NO_GLYPH && !(pet->str.size == 7 &&
- !strncmp((const char *)pet->str.data, ".notdef", 7))) {
- if (char_code < font->u.simple.FirstChar)
- font->u.simple.FirstChar = char_code;
- if ((int)char_code > font->u.simple.LastChar)
- font->u.simple.LastChar = char_code;
- base->FontBBox.q.x = max(base->FontBBox.q.x, w);
- base->FontBBox.q.y = max(base->FontBBox.q.y, y_offset + h);
- str = &pet->str;
- glyph = pet->glyph;
- /* This is to work around a weird Acrobat bug. If the Encoding of a type 3
- * (possibly other types) is simply a standard encoding (eg WinAnsiEncoding)
- * then Acrobat 4 & 8 just ignore the glyphs altogether. This forces us to write
- * all the used glyphs as /Differencess, and that makes it work <sigh>
- */
- pet->is_difference = 1;
- font->Widths[char_code] = psdf_round(pdev->char_width.x, 100, 10); /* See
- pdf_write_Widths about rounding. We need to provide
- a compatible data for Tj. */
- } else {
- char_code = assign_char_code(pdev, pdev->pte);
- font = pbfs->open_font; /* Type 3 */
- }
+ if (show_enum->current_font->FontType == ft_user_defined && allowed_op &&
+ show_enum->current_font->FontMatrix.xx == 1 && show_enum->current_font->FontMatrix.xy == 0 &&
+ show_enum->current_font->FontMatrix.yx == 0 && show_enum->current_font->FontMatrix.yy == 1) {
+ pdf_char_proc_ownership_t *pcpo;
+
+ gs_font_base *base = (gs_font_base *)show_enum->current_font;
+ code = pdf_attached_font_resource(pdev, show_enum->current_font, &font, NULL, NULL, NULL, NULL);
+ if (code < 0)
+ return code;
+ /* The text processing will have run past the glyph, so we need to 'back up'
+ * by one and get it again in order to get the character code and glyph, and update
+ * the pointer correctly.
+ */
+ show_enum->index--;
+ code = gs_default_next_char_glyph((gs_text_enum_t *)show_enum, (gs_char *)&char_code, &glyph);
+ if (code < 0)
+ return code;
+
+ /* If the returned character code is outside the possible Encoding for
+ * a type 3 font, then set pet to NULL, this means we will fall back to
+ * the 'collection' font, as pet is checked below.
+ */
+ if (char_code >= 0 && char_code <= 255) {
+ pet = &font->u.simple.Encoding[char_code];
+ if (pet) {
+ /* Check to see if we *already* have this glyph in this font. If
+ * we do then we can't add it to this font. Setting pet to 0
+ * falls back to the collection method.
+ */
+ for (pcpo = font->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
+ if (pcpo->glyph == pet->glyph && pcpo->char_code == char_code) {
+ pet = 0x00;
+ break;
+ }
+ }
+ }
+ }
+ else
+ pet = 0x00;
+
+ /* We need a glyph name for the type 3 font's Encoding, if we haven't got one
+ * then we need to give up, something about the font or text is not acceptable
+ * (see various comments above).
+ */
+ if (pet && pet->glyph != GS_NO_GLYPH && !(pet->str.size == 7 &&
+ !strncmp((const char *)pet->str.data, ".notdef", 7))) {
+ if (char_code < font->u.simple.FirstChar)
+ font->u.simple.FirstChar = char_code;
+ if ((int)char_code > font->u.simple.LastChar)
+ font->u.simple.LastChar = char_code;
+ base->FontBBox.q.x = max(base->FontBBox.q.x, w);
+ base->FontBBox.q.y = max(base->FontBBox.q.y, y_offset + h);
+ str = &pet->str;
+ glyph = pet->glyph;
+ /* This is to work around a weird Acrobat bug. If the Encoding of a type 3
+ * (possibly other types) is simply a standard encoding (eg WinAnsiEncoding)
+ * then Acrobat 4 & 8 just ignore the glyphs altogether. This forces us to write
+ * all the used glyphs as /Differencess, and that makes it work <sigh>
+ */
+ pet->is_difference = 1;
+ font->Widths[char_code] = psdf_round(pdev->char_width.x, 100, 10); /* See
+ pdf_write_Widths about rounding. We need to provide
+ a compatible data for Tj. */
+ } else {
+ char_code = assign_char_code(pdev, pdev->pte);
+ font = pbfs->open_font; /* Type 3 */
+ }
} else {
- char_code = assign_char_code(pdev, pdev->pte);
- font = pbfs->open_font; /* Type 3 */
+ char_code = assign_char_code(pdev, pdev->pte);
+ font = pbfs->open_font; /* Type 3 */
}
code = pdf_begin_resource(pdev, resourceCharProc, id, &pres);
if (code < 0)
- return code;
+ return code;
pcp = (pdf_char_proc_t *) pres;
code = pdf_attach_charproc(pdev, font, pcp, glyph, char_code, str);
if (code < 0)
- return code;
+ return code;
pres->object->written = true;
{
- stream *s = pdev->strm;
-
- /*
- * The resource file is positionable, so rather than use an
- * object reference for the length, we'll go back and fill it in
- * at the end of the definition. Take 1M as the longest
- * definition we can handle. (This used to be 10K, but there was
- * a real file that exceeded this limit.)
- */
- stream_puts(s, "<</Length >>stream\n");
- ppos->start_pos = stell(s);
+ stream *s = pdev->strm;
+
+ /*
+ * The resource file is positionable, so rather than use an
+ * object reference for the length, we'll go back and fill it in
+ * at the end of the definition. Take 1M as the longest
+ * definition we can handle. (This used to be 10K, but there was
+ * a real file that exceeded this limit.)
+ */
+ stream_puts(s, "<</Length >>stream\n");
+ ppos->start_pos = stell(s);
}
code = pdf_begin_encrypt(pdev, &pdev->strm, pres->object->id);
if (code < 0)
- return code;
+ return code;
pcp->y_offset = y_offset;
pcp->x_offset = x_offset;
font->u.simple.s.type3.FontBBox.q.x =
- max(font->u.simple.s.type3.FontBBox.q.x, w);
+ max(font->u.simple.s.type3.FontBBox.q.x, w);
font->u.simple.s.type3.FontBBox.q.y =
- max(font->u.simple.s.type3.FontBBox.q.y, y_offset + h);
+ max(font->u.simple.s.type3.FontBBox.q.y, y_offset + h);
font->u.simple.s.type3.max_y_offset =
- max(font->u.simple.s.type3.max_y_offset, h + (h >> 2));
+ max(font->u.simple.s.type3.max_y_offset, h + (h >> 2));
*ppcp = pcp;
return 0;
}
@@ -449,12 +448,12 @@ pdf_end_char_proc(gx_device_pdf * pdev, pdf_stream_position_t * ppos)
end_pos = stell(s);
length = end_pos - start_pos;
if (length > 999999)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
sseek(s, start_pos - 15);
pprintd1(s, "%d", length);
sseek(s, end_pos);
if (pdev->PDFA)
- stream_puts(s, "\n");
+ stream_puts(s, "\n");
stream_puts(s, "endstream\n");
pdf_end_separate(pdev, resourceCharProc);
return 0;
@@ -465,28 +464,28 @@ void
pdf_mark_glyph_names(const pdf_font_resource_t *pdfont, const gs_memory_t *memory)
{
if (pdfont->mark_glyph == NULL) {
- /* Synthesised bitmap fonts pass here. */
- return;
+ /* Synthesised bitmap fonts pass here. */
+ return;
}
if (pdfont->u.simple.Encoding != NULL) {
- int i;
+ int i;
- for (i = 0; i < 256; i++)
- if (pdfont->u.simple.Encoding[i].glyph != GS_NO_GLYPH)
- pdfont->mark_glyph(memory, pdfont->u.simple.Encoding[i].glyph, pdfont->mark_glyph_data);
+ for (i = 0; i < 256; i++)
+ if (pdfont->u.simple.Encoding[i].glyph != GS_NO_GLYPH)
+ pdfont->mark_glyph(memory, pdfont->u.simple.Encoding[i].glyph, pdfont->mark_glyph_data);
}
if (pdfont->FontType == ft_user_defined) {
- const pdf_char_proc_ownership_t *pcpo = pdfont->u.simple.s.type3.char_procs;
+ const pdf_char_proc_ownership_t *pcpo = pdfont->u.simple.s.type3.char_procs;
- for (; pcpo != NULL; pcpo = pcpo->font_next)
- pdfont->mark_glyph(memory, pcpo->glyph, pdfont->mark_glyph_data);
+ for (; pcpo != NULL; pcpo = pcpo->font_next)
+ pdfont->mark_glyph(memory, pcpo->glyph, pdfont->mark_glyph_data);
}
}
/* Put out a reference to an image as a character in a synthesized font. */
int
pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
- const gs_matrix * pimat)
+ const gs_matrix * pimat)
{
/* We need to choose a font, which use the charproc.
In most cases it is the last font, which the charproc is attached to.
@@ -516,27 +515,27 @@ pdf_write_bitmap_fonts_Encoding(gx_device_pdf *pdev)
pdf_bitmap_fonts_t *pbfs = pdev->text->bitmap_fonts;
if (pbfs->bitmap_encoding_id) {
- stream *s;
- int i;
-
- pdf_open_separate(pdev, pbfs->bitmap_encoding_id, resourceEncoding);
- s = pdev->strm;
- /*
- * Even though the PDF reference documentation says that a
- * BaseEncoding key is required unless the encoding is
- * "based on the base font's encoding" (and there is no base
- * font in this case), Acrobat 2.1 gives an error if the
- * BaseEncoding key is present.
- */
- stream_puts(s, "<</Type/Encoding/Differences[0");
- for (i = 0; i <= pbfs->max_embedded_code; ++i) {
- if (!(i & 15))
- stream_puts(s, "\n");
- pprintd1(s, "/a%d", i);
- }
- stream_puts(s, "\n] >>\n");
- pdf_end_separate(pdev, resourceEncoding);
- pbfs->bitmap_encoding_id = 0;
+ stream *s;
+ int i;
+
+ pdf_open_separate(pdev, pbfs->bitmap_encoding_id, resourceEncoding);
+ s = pdev->strm;
+ /*
+ * Even though the PDF reference documentation says that a
+ * BaseEncoding key is required unless the encoding is
+ * "based on the base font's encoding" (and there is no base
+ * font in this case), Acrobat 2.1 gives an error if the
+ * BaseEncoding key is present.
+ */
+ stream_puts(s, "<</Type/Encoding/Differences[0");
+ for (i = 0; i <= pbfs->max_embedded_code; ++i) {
+ if (!(i & 15))
+ stream_puts(s, "\n");
+ pprintd1(s, "/a%d", i);
+ }
+ stream_puts(s, "\n] >>\n");
+ pdf_end_separate(pdev, resourceEncoding);
+ pbfs->bitmap_encoding_id = 0;
}
return 0;
}
@@ -549,8 +548,8 @@ pdf_start_charproc_accum(gx_device_pdf *pdev)
{
pdf_char_proc_t *pcp;
pdf_resource_t *pres;
- int code = pdf_enter_substream(pdev, resourceCharProc, gs_next_ids(pdev->memory, 1),
- &pres, false, pdev->CompressFonts);
+ int code = pdf_enter_substream(pdev, resourceCharProc, gs_next_ids(pdev->memory, 1),
+ &pres, false, pdev->CompressFonts);
if (code < 0)
return code;
@@ -564,7 +563,7 @@ pdf_start_charproc_accum(gx_device_pdf *pdev)
*/
int
pdf_set_charproc_attrs(gx_device_pdf *pdev, gs_font *font, const double *pw, int narg,
- gs_text_cache_control_t control, gs_char ch)
+ gs_text_cache_control_t control, gs_char ch)
{
pdf_font_resource_t *pdfont;
pdf_resource_t *pres = pdev->accumulating_substream_resource;
@@ -573,7 +572,7 @@ pdf_set_charproc_attrs(gx_device_pdf *pdev, gs_font *font, const double *pw, int
code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
pcp = (pdf_char_proc_t *)pres;
pcp->owner_fonts = NULL;
pcp->real_width.x = pw[font->WMode && narg > 6 ? 6 : 0];
@@ -581,23 +580,23 @@ pdf_set_charproc_attrs(gx_device_pdf *pdev, gs_font *font, const double *pw, int
pcp->v.x = (narg > 8 ? pw[8] : 0);
pcp->v.y = (narg > 8 ? pw[9] : 0);
if (control == TEXT_SET_CHAR_WIDTH) {
- /* PLRM 5.7.1 "BuildGlyph" reads : "Normally, it is unnecessary and
- undesirable to initialize the current color parameter, because show
- is defined to paint glyphs with the current color."
- However comparefiles/Bug687044.ps doesn't follow that. */
- pdev->skip_colors = false;
- pprintg1(pdev->strm, "%g 0 d0\n", (float)pw[0]);
+ /* PLRM 5.7.1 "BuildGlyph" reads : "Normally, it is unnecessary and
+ undesirable to initialize the current color parameter, because show
+ is defined to paint glyphs with the current color."
+ However comparefiles/Bug687044.ps doesn't follow that. */
+ pdev->skip_colors = false;
+ pprintg1(pdev->strm, "%g 0 d0\n", (float)pw[0]);
} else {
- pdev->skip_colors = true;
- pprintg6(pdev->strm, "%g %g %g %g %g %g d1\n",
- (float)pw[0], (float)0.0, (float)pw[2],
- (float)pw[3], (float)pw[4], (float)pw[5]);
- pdfont->u.simple.s.type3.cached[ch >> 3] |= 0x80 >> (ch & 7);
+ pdev->skip_colors = true;
+ pprintg6(pdev->strm, "%g %g %g %g %g %g d1\n",
+ (float)pw[0], (float)0.0, (float)pw[2],
+ (float)pw[3], (float)pw[4], (float)pw[5]);
+ pdfont->u.simple.s.type3.cached[ch >> 3] |= 0x80 >> (ch & 7);
}
/* See comments in pdf_text_process regarding type 3 CharProc accumulation
* Initially this matrix was emitted there, at the start of the accumulator
* but if we do that then GS incorrectly applied the matrix to the 'd1'
- * operator. We write the scale matrix here because this is *after* the
+ * operator. We write the scale matrix here because this is *after* the
* 'd1' has been emitted above, and so does not affect it.
*/
code = stream_puts(pdev->strm, "0.01 0 0 0.01 0 0 cm\n");
@@ -611,40 +610,40 @@ pdf_set_charproc_attrs(gx_device_pdf *pdev, gs_font *font, const double *pw, int
*/
int
-pdf_open_aside(gx_device_pdf *pdev, pdf_resource_type_t rtype,
- gs_id id, pdf_resource_t **ppres, bool reserve_object_id, int options)
+pdf_open_aside(gx_device_pdf *pdev, pdf_resource_type_t rtype,
+ gs_id id, pdf_resource_t **ppres, bool reserve_object_id, int options)
{
int code;
pdf_resource_t *pres;
stream *s, *save_strm = pdev->strm;
pdf_data_writer_t writer;
static const pdf_filter_names_t fnames = {
- PDF_FILTER_NAMES
+ PDF_FILTER_NAMES
};
pdev->streams.save_strm = pdev->strm;
if (rtype > NUM_RESOURCE_TYPES)
- rtype = resourceOther;
+ rtype = resourceOther;
code = pdf_alloc_aside(pdev, PDF_RESOURCE_CHAIN(pdev, rtype, id),
- pdf_resource_type_structs[rtype], &pres, reserve_object_id ? 0 : -1);
+ pdf_resource_type_structs[rtype], &pres, reserve_object_id ? 0 : -1);
if (code < 0)
- return code;
+ return code;
cos_become(pres->object, cos_type_stream);
s = cos_write_stream_alloc((cos_stream_t *)pres->object, pdev, "pdf_enter_substream");
if (s == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pdev->strm = s;
code = pdf_append_data_stream_filters(pdev, &writer,
- options | DATA_STREAM_NOLENGTH, pres->object->id);
+ options | DATA_STREAM_NOLENGTH, pres->object->id);
if (code < 0) {
- pdev->strm = save_strm;
- return code;
+ pdev->strm = save_strm;
+ return code;
}
code = pdf_put_filters((cos_dict_t *)pres->object, pdev, writer.binary.strm, &fnames);
if (code < 0) {
- pdev->strm = save_strm;
- return code;
+ pdev->strm = save_strm;
+ return code;
}
pdev->strm = writer.binary.strm;
*ppres = pres;
@@ -655,10 +654,10 @@ pdf_open_aside(gx_device_pdf *pdev, pdf_resource_type_t rtype,
* Close a stream object in the temporary file.
*/
int
-pdf_close_aside(gx_device_pdf *pdev)
+pdf_close_aside(gx_device_pdf *pdev)
{
/* We should call pdf_end_data here, but we don't want to put pdf_data_writer_t
- into pdf_substream_save stack to simplify garbager descriptors.
+ into pdf_substream_save stack to simplify garbager descriptors.
Use a lower level functions instead that. */
stream *s = pdev->strm;
int status = s_close_filters(&s, cos_write_stream_from_pipeline(s));
@@ -666,7 +665,7 @@ pdf_close_aside(gx_device_pdf *pdev)
int code = 0;
if (status < 0)
- code = gs_note_error(gs_error_ioerror);
+ code = gs_note_error(gs_error_ioerror);
pcs->is_open = false;
sclose(s);
pdev->strm = pdev->streams.save_strm;
@@ -677,8 +676,8 @@ pdf_close_aside(gx_device_pdf *pdev)
* Enter the substream accumulation mode.
*/
int
-pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
- gs_id id, pdf_resource_t **ppres, bool reserve_object_id, bool compress)
+pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
+ gs_id id, pdf_resource_t **ppres, bool reserve_object_id, bool compress)
{
int sbstack_ptr = pdev->sbstack_depth;
pdf_resource_t *pres;
@@ -686,20 +685,20 @@ pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
int code;
if (pdev->sbstack_depth >= pdev->sbstack_size)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pdev->sbstack[sbstack_ptr].text_state == 0) {
- pdev->sbstack[sbstack_ptr].text_state = pdf_text_state_alloc(pdev->pdf_memory);
- if (pdev->sbstack[sbstack_ptr].text_state == 0)
- return_error(gs_error_VMerror);
+ pdev->sbstack[sbstack_ptr].text_state = pdf_text_state_alloc(pdev->pdf_memory);
+ if (pdev->sbstack[sbstack_ptr].text_state == 0)
+ return_error(gs_error_VMerror);
}
- code = pdf_open_aside(pdev, rtype, id, &pres, reserve_object_id,
- (compress ? DATA_STREAM_COMPRESS : 0));
+ code = pdf_open_aside(pdev, rtype, id, &pres, reserve_object_id,
+ (compress ? DATA_STREAM_COMPRESS : 0));
if (code < 0)
- return code;
+ return code;
code = pdf_save_viewer_state(pdev, NULL);
if (code < 0) {
- pdev->strm = save_strm;
- return code;
+ pdev->strm = save_strm;
+ return code;
}
pdev->sbstack[sbstack_ptr].context = pdev->context;
pdf_text_state_copy(pdev->sbstack[sbstack_ptr].text_state, pdev->text->text_state);
@@ -745,25 +744,25 @@ pdf_enter_substream(gx_device_pdf *pdev, pdf_resource_type_t rtype,
* Exit the substream accumulation mode.
*/
int
-pdf_exit_substream(gx_device_pdf *pdev)
+pdf_exit_substream(gx_device_pdf *pdev)
{
int code, code1;
int sbstack_ptr;
if (pdev->sbstack_depth <= 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = pdf_open_contents(pdev, PDF_IN_STREAM);
sbstack_ptr = pdev->sbstack_depth - 1;
while (pdev->vgstack_depth > pdev->vgstack_bottom) {
- code1 = pdf_restore_viewer_state(pdev, pdev->strm);
- if (code >= 0)
- code = code1;
+ code1 = pdf_restore_viewer_state(pdev, pdev->strm);
+ if (code >= 0)
+ code = code1;
}
if (pdev->clip_path != 0)
- gx_path_free(pdev->clip_path, "pdf_end_charproc_accum");
+ gx_path_free(pdev->clip_path, "pdf_end_charproc_accum");
code1 = pdf_close_aside(pdev);
if (code1 < 0 && code >= 0)
- code = code1;
+ code = code1;
pdev->context = pdev->sbstack[sbstack_ptr].context;
pdf_text_state_copy(pdev->text->text_state, pdev->sbstack[sbstack_ptr].text_state);
pdev->clip_path = pdev->sbstack[sbstack_ptr].clip_path;
@@ -788,21 +787,21 @@ pdf_exit_substream(gx_device_pdf *pdev)
pdev->sbstack_depth = sbstack_ptr;
code1 = pdf_restore_viewer_state(pdev, NULL);
if (code1 < 0 && code >= 0)
- code = code1;
+ code = code1;
return code;
}
-static bool
+static bool
pdf_is_same_charproc_attrs1(gx_device_pdf *pdev, pdf_char_proc_t *pcp0, pdf_char_proc_t *pcp1)
{
if (pcp0->real_width.x != pcp1->real_width.x)
- return false;
+ return false;
if (pcp0->real_width.y != pcp1->real_width.y)
- return false;
+ return false;
if (pcp0->v.x != pcp1->v.x)
- return false;
+ return false;
if (pcp0->v.y != pcp1->v.y)
- return false;
+ return false;
return true;
}
@@ -820,14 +819,14 @@ is_char_code_used(pdf_font_resource_t *pdfont, gs_char char_code)
pdf_char_proc_ownership_t *pcpo;
for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pcpo->char_code == char_code) {
- return true;
- }
+ if (pcpo->char_code == char_code) {
+ return true;
+ }
}
return false;
}
-static int
+static int
pdf_is_charproc_compatible(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_resource_t *pres1)
{
charproc_compatibility_data_t *data = (charproc_compatibility_data_t *)pdev->find_resource_param;
@@ -840,92 +839,92 @@ pdf_is_charproc_compatible(gx_device_pdf * pdev, pdf_resource_t *pres0, pdf_reso
/* Does it have same attributes ? */
if (!pdf_is_same_charproc_attrs1(pdev, pcp0, pcp1))
- return 0;
+ return 0;
/* Is it from same font ? */
for (pcpo = pcp1->owner_fonts; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pdfont == pcpo->font) {
- /* Check for encoding conflict. */
- if (pcpo->char_code == data->char_code && pcpo->glyph == data->glyph)
- return 1; /* Same char code. */
- if (!computed_can_add_to_current_font) {
- can_add_to_current_font = !is_char_code_used(pdfont, data->char_code);
- computed_can_add_to_current_font = true;
- }
- if (can_add_to_current_font)
- return 1; /* No conflict. */
- }
+ if (pdfont == pcpo->font) {
+ /* Check for encoding conflict. */
+ if (pcpo->char_code == data->char_code && pcpo->glyph == data->glyph)
+ return 1; /* Same char code. */
+ if (!computed_can_add_to_current_font) {
+ can_add_to_current_font = !is_char_code_used(pdfont, data->char_code);
+ computed_can_add_to_current_font = true;
+ }
+ if (can_add_to_current_font)
+ return 1; /* No conflict. */
+ }
}
/* Look for another font with same encoding,
- because we want to reduce the number of new fonts.
+ because we want to reduce the number of new fonts.
We also restrict with ones attached to same PS font,
otherwise it creates too mixed fonts and disturbs word breaks.
*/
e = pdf_locate_font_cache_elem(pdev, data->font);
if (e != NULL) {
- for (pcpo = pcp1->owner_fonts; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pcpo->char_code != data->char_code || pcpo->glyph != data->glyph)
- continue; /* Need same Encoding to generate a proper ToUnicode. */
- if (pdfont->u.simple.s.type3.bitmap_font != pcpo->font->u.simple.s.type3.bitmap_font)
- continue;
- if (memcmp(&pdfont->u.simple.s.type3.FontMatrix, &pcpo->font->u.simple.s.type3.FontMatrix,
- sizeof(pdfont->u.simple.s.type3.FontMatrix)))
- continue;
- if (data->cgp != NULL) {
- if (!pdf_check_encoding_compatibility(pcpo->font, data->cgp->s, data->cgp->num_all_chars))
- continue;
- }
- if ((*e)->pdfont != pcpo->font)
- continue;
- data->pdfont = pcpo->font; /* Switch to the other font. */
- return 1;
- }
+ for (pcpo = pcp1->owner_fonts; pcpo != NULL; pcpo = pcpo->char_next) {
+ if (pcpo->char_code != data->char_code || pcpo->glyph != data->glyph)
+ continue; /* Need same Encoding to generate a proper ToUnicode. */
+ if (pdfont->u.simple.s.type3.bitmap_font != pcpo->font->u.simple.s.type3.bitmap_font)
+ continue;
+ if (memcmp(&pdfont->u.simple.s.type3.FontMatrix, &pcpo->font->u.simple.s.type3.FontMatrix,
+ sizeof(pdfont->u.simple.s.type3.FontMatrix)))
+ continue;
+ if (data->cgp != NULL) {
+ if (!pdf_check_encoding_compatibility(pcpo->font, data->cgp->s, data->cgp->num_all_chars))
+ continue;
+ }
+ if ((*e)->pdfont != pcpo->font)
+ continue;
+ data->pdfont = pcpo->font; /* Switch to the other font. */
+ return 1;
+ }
}
/* Check whether it can be added into the current font. */
if (!computed_can_add_to_current_font)
- can_add_to_current_font = !is_char_code_used(pdfont, data->char_code);
+ can_add_to_current_font = !is_char_code_used(pdfont, data->char_code);
if (!can_add_to_current_font) {
- /* Can't substitute due to encoding conflict. */
- return 0;
+ /* Can't substitute due to encoding conflict. */
+ return 0;
}
/* The current font will share it with another font. */
return 1;
}
-static int
-pdf_find_same_charproc_aux(gx_device_pdf *pdev,
- pdf_font_resource_t **ppdfont, pdf_char_proc_t **ppcp)
+static int
+pdf_find_same_charproc_aux(gx_device_pdf *pdev,
+ pdf_font_resource_t **ppdfont, pdf_char_proc_t **ppcp)
{
pdf_char_proc_ownership_t *pcpo;
int code;
- /* fixme: this passes parameters to pdf_is_charproc_compatible
+ /* fixme: this passes parameters to pdf_is_charproc_compatible
through special gx_device_pdf field pdev->find_resource_param
due to prototype limitation of pdf_find_same_resource.
It would be better to change the client data argument type in there to void. */
for (pcpo = (*ppdfont)->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- pdf_char_proc_t *pcp = pcpo->char_proc;
-
- if (*ppcp != pcp && pdf_is_same_charproc_attrs1(pdev, *ppcp, pcp)) {
- cos_object_t *pco0 = pcp->object;
- cos_object_t *pco1 = (*ppcp)->object;
-
- code = pco0->cos_procs->equal(pco0, pco1, pdev);
- if (code < 0) {
- return code;
- }
- if (code) {
- *ppcp = pcp;
- return 1;
- }
- }
+ pdf_char_proc_t *pcp = pcpo->char_proc;
+
+ if (*ppcp != pcp && pdf_is_same_charproc_attrs1(pdev, *ppcp, pcp)) {
+ cos_object_t *pco0 = pcp->object;
+ cos_object_t *pco1 = (*ppcp)->object;
+
+ code = pco0->cos_procs->equal(pco0, pco1, pdev);
+ if (code < 0) {
+ return code;
+ }
+ if (code) {
+ *ppcp = pcp;
+ return 1;
+ }
+ }
}
return pdf_find_same_resource(pdev, resourceCharProc, (pdf_resource_t **)ppcp, pdf_is_charproc_compatible);
}
-static int
-pdf_find_same_charproc(gx_device_pdf *pdev,
- pdf_font_resource_t **ppdfont, const pdf_char_glyph_pairs_t *cgp,
- pdf_char_proc_t **ppcp, gs_glyph glyph, gs_char char_code,
- gs_font *font)
+static int
+pdf_find_same_charproc(gx_device_pdf *pdev,
+ pdf_font_resource_t **ppdfont, const pdf_char_glyph_pairs_t *cgp,
+ pdf_char_proc_t **ppcp, gs_glyph glyph, gs_char char_code,
+ gs_font *font)
{
charproc_compatibility_data_t data;
int code;
@@ -948,17 +947,17 @@ pdf_is_charproc_defined(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, gs_cha
pdf_char_proc_ownership_t *pcpo;
for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- if (pcpo->char_code == ch)
- return true;
+ if (pcpo->char_code == ch)
+ return true;
}
return false;
}
static int
-complete_adding_char(gx_device_pdf *pdev, gs_font *font,
- gs_glyph glyph, gs_char ch, pdf_char_proc_t *pcp,
- const gs_const_string *gnstr)
-{
+complete_adding_char(gx_device_pdf *pdev, gs_font *font,
+ gs_glyph glyph, gs_char ch, pdf_char_proc_t *pcp,
+ const gs_const_string *gnstr)
+{
pdf_font_resource_t *pdfont;
double *real_widths;
byte *glyph_usage;
@@ -967,14 +966,14 @@ complete_adding_char(gx_device_pdf *pdev, gs_font *font,
int code;
code = pdf_attached_font_resource(pdev, font, &pdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
code = pdf_attach_charproc(pdev, pdfont, pcp, glyph, ch, gnstr);
if (code < 0)
- return code;
+ return code;
if (ch >= char_cache_size || ch >= width_cache_size)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
pet = &pdfont->u.simple.Encoding[ch];
pdfont->Widths[ch] = pcp->real_width.x;
real_widths[ch * 2 ] = pcp->real_width.x;
@@ -982,16 +981,16 @@ complete_adding_char(gx_device_pdf *pdev, gs_font *font,
glyph_usage[ch / 8] |= 0x80 >> (ch & 7);
pdfont->used[ch >> 3] |= 0x80 >> (ch & 7);
if (pdfont->u.simple.v != NULL && font->WMode) {
- pdfont->u.simple.v[ch].x = pcp->v.x;
- pdfont->u.simple.v[ch].y = pcp->v.x;
+ pdfont->u.simple.v[ch].x = pcp->v.x;
+ pdfont->u.simple.v[ch].y = pcp->v.x;
}
pet->glyph = glyph;
pet->str = *gnstr;
pet->is_difference = true;
if (pdfont->u.simple.LastChar < (int)ch)
- pdfont->u.simple.LastChar = (int)ch;
+ pdfont->u.simple.LastChar = (int)ch;
if (pdfont->u.simple.FirstChar > (int)ch)
- pdfont->u.simple.FirstChar = (int)ch;
+ pdfont->u.simple.FirstChar = (int)ch;
return 0;
}
@@ -1006,27 +1005,26 @@ pdf_char_widths_from_charprocs(gx_device_pdf *pdev, gs_font *font)
int code;
code = pdf_attached_font_resource(pdev, font, &pdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
for (pcpo = pdfont->u.simple.s.type3.char_procs; pcpo != NULL; pcpo = pcpo->char_next) {
- pdf_char_proc_t *pcp = pcpo->char_proc;
- gs_char ch = pcpo->char_code;
+ pdf_char_proc_t *pcp = pcpo->char_proc;
+ gs_char ch = pcpo->char_code;
- real_widths[ch * 2 ] = pcp->real_width.x;
- real_widths[ch * 2 + 1] = pcp->real_width.y;
- glyph_usage[ch / 8] |= 0x80 >> (ch & 7);
+ real_widths[ch * 2 ] = pcp->real_width.x;
+ real_widths[ch * 2 + 1] = pcp->real_width.y;
+ glyph_usage[ch / 8] |= 0x80 >> (ch & 7);
}
return 0;
}
-
/*
* Complete charproc accumulation for a Type 3 font.
*/
int
-pdf_end_charproc_accum(gx_device_pdf *pdev, gs_font *font, const pdf_char_glyph_pairs_t *cgp,
- gs_glyph glyph, gs_char output_char_code, const gs_const_string *gnstr)
+pdf_end_charproc_accum(gx_device_pdf *pdev, gs_font *font, const pdf_char_glyph_pairs_t *cgp,
+ gs_glyph glyph, gs_char output_char_code, const gs_const_string *gnstr)
{
int code;
pdf_resource_t *pres = (pdf_resource_t *)pdev->accumulating_substream_resource;
@@ -1039,61 +1037,61 @@ pdf_end_charproc_accum(gx_device_pdf *pdev, gs_font *font, const pdf_char_glyph_
bool checking_glyph_variation = false;
if (ch == GS_NO_CHAR)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (ch >= 256)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
if (pdfont != (pdf_font_resource_t *)pdev->font3)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = pdf_exit_substream(pdev);
if (code < 0)
- return code;
+ return code;
if (!(pdfont->used[ch >> 3] & (0x80 >> (ch & 7))) ||
- !(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7)))) {
- /* First appearence or not cached - check for duplicates. */
- pdf_font_resource_t *pdfont1 = pdfont;
-
- checking_glyph_variation = true;
- /* CAUTION : a possible font change. */
- code = pdf_find_same_charproc(pdev, &pdfont, cgp, &pcp, glyph, ch, font);
- if (code < 0)
- return code;
- if (code != 0) {
- code = pdf_cancel_resource(pdev, pres, resourceCharProc);
- if (code < 0)
- return code;
- pdf_forget_resource(pdev, pres, resourceCharProc);
- if (pdfont1 != pdfont) {
- code = pdf_attach_font_resource(pdev, font, pdfont);
- if (code < 0)
- return code;
- code = pdf_char_widths_from_charprocs(pdev, font);
- if (code < 0)
- return code;
- }
- pdev->charproc_just_accumulated = true;
- return complete_adding_char(pdev, font, glyph, ch, pcp, gnstr);
- }
- if (pdf_is_charproc_defined(pdev, pdfont, ch)) {
- /* Encoding conflict after a font change. */
- gs_font *base_font = font, *below;
-
- while ((below = base_font->base) != base_font &&
- base_font->procs.same_font(base_font, below, FONT_SAME_OUTLINES))
- base_font = below;
- code = pdf_make_font3_resource(pdev, base_font, &pdfont);
- if (code < 0)
- return code;
- code = pdf_attach_font_resource(pdev, font, pdfont);
- if (code < 0)
- return code;
- }
- }
+ !(pdfont->u.simple.s.type3.cached[ch >> 3] & (0x80 >> (ch & 7)))) {
+ /* First appearence or not cached - check for duplicates. */
+ pdf_font_resource_t *pdfont1 = pdfont;
+
+ checking_glyph_variation = true;
+ /* CAUTION : a possible font change. */
+ code = pdf_find_same_charproc(pdev, &pdfont, cgp, &pcp, glyph, ch, font);
+ if (code < 0)
+ return code;
+ if (code != 0) {
+ code = pdf_cancel_resource(pdev, pres, resourceCharProc);
+ if (code < 0)
+ return code;
+ pdf_forget_resource(pdev, pres, resourceCharProc);
+ if (pdfont1 != pdfont) {
+ code = pdf_attach_font_resource(pdev, font, pdfont);
+ if (code < 0)
+ return code;
+ code = pdf_char_widths_from_charprocs(pdev, font);
+ if (code < 0)
+ return code;
+ }
+ pdev->charproc_just_accumulated = true;
+ return complete_adding_char(pdev, font, glyph, ch, pcp, gnstr);
+ }
+ if (pdf_is_charproc_defined(pdev, pdfont, ch)) {
+ /* Encoding conflict after a font change. */
+ gs_font *base_font = font, *below;
+
+ while ((below = base_font->base) != base_font &&
+ base_font->procs.same_font(base_font, below, FONT_SAME_OUTLINES))
+ base_font = below;
+ code = pdf_make_font3_resource(pdev, base_font, &pdfont);
+ if (code < 0)
+ return code;
+ code = pdf_attach_font_resource(pdev, font, pdfont);
+ if (code < 0)
+ return code;
+ }
+ }
pdf_reserve_object_id(pdev, pres, 0);
if (checking_glyph_variation)
- pdev->charproc_just_accumulated = true;
+ pdev->charproc_just_accumulated = true;
return complete_adding_char(pdev, font, glyph, ch, pcp, gnstr);
}
@@ -1106,13 +1104,13 @@ pdf_add_procsets(cos_dict_t *pcd, pdf_procset_t procsets)
strcpy(str, "[/PDF");
if (procsets & ImageB)
- strcat(str, "/ImageB");
+ strcat(str, "/ImageB");
if (procsets & ImageC)
- strcat(str, "/ImageC");
+ strcat(str, "/ImageC");
if (procsets & ImageI)
- strcat(str, "/ImageI");
+ strcat(str, "/ImageI");
if (procsets & Text)
- strcat(str, "/Text");
+ strcat(str, "/Text");
strcat(str, "]");
cos_string_value(&v, (byte *)str, strlen(str));
return cos_dict_put_c_key(pcd, "/ProcSet", &v);
@@ -1123,38 +1121,37 @@ int
pdf_add_resource(gx_device_pdf *pdev, cos_dict_t *pcd, const char *key, pdf_resource_t *pres)
{
if (pcd != 0) {
- const cos_value_t *v = cos_dict_find(pcd, (const byte *)key, strlen(key));
- cos_dict_t *list;
- int code;
- char buf[10 + (sizeof(long) * 8 / 3 + 1)], buf1[sizeof(pres->rname) + 1];
-
- if (pdev->ForOPDFRead && !pres->global && pdev->accumulating_a_global_object) {
- pres->global = true;
- code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
- if (code < 0)
- return code;
- }
- sprintf(buf, "%ld 0 R\n", pres->object->id);
- if (v != NULL) {
- if (v->value_type != COS_VALUE_OBJECT &&
- v->value_type != COS_VALUE_RESOURCE)
- return_error(gs_error_unregistered); /* Must not happen. */
- list = (cos_dict_t *)v->contents.object;
- if (list->cos_procs != &cos_dict_procs)
- return_error(gs_error_unregistered); /* Must not happen. */
- } else {
- list = cos_dict_alloc(pdev, "pdf_add_resource");
- if (list == NULL)
- return_error(gs_error_VMerror);
- code = cos_dict_put_c_key_object((cos_dict_t *)pcd, key, (cos_object_t *)list);
- if (code < 0)
- return code;
- }
- buf1[0] = '/';
- strcpy(buf1 + 1, pres->rname);
- return cos_dict_put_string(list, (const byte *)buf1, strlen(buf1),
- (const byte *)buf, strlen(buf));
+ const cos_value_t *v = cos_dict_find(pcd, (const byte *)key, strlen(key));
+ cos_dict_t *list;
+ int code;
+ char buf[10 + (sizeof(long) * 8 / 3 + 1)], buf1[sizeof(pres->rname) + 1];
+
+ if (pdev->ForOPDFRead && !pres->global && pdev->accumulating_a_global_object) {
+ pres->global = true;
+ code = cos_dict_put_c_key_bool((cos_dict_t *)pres->object, "/.Global", true);
+ if (code < 0)
+ return code;
+ }
+ sprintf(buf, "%ld 0 R\n", pres->object->id);
+ if (v != NULL) {
+ if (v->value_type != COS_VALUE_OBJECT &&
+ v->value_type != COS_VALUE_RESOURCE)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ list = (cos_dict_t *)v->contents.object;
+ if (list->cos_procs != &cos_dict_procs)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ } else {
+ list = cos_dict_alloc(pdev, "pdf_add_resource");
+ if (list == NULL)
+ return_error(gs_error_VMerror);
+ code = cos_dict_put_c_key_object((cos_dict_t *)pcd, key, (cos_object_t *)list);
+ if (code < 0)
+ return code;
+ }
+ buf1[0] = '/';
+ strcpy(buf1 + 1, pres->rname);
+ return cos_dict_put_string(list, (const byte *)buf1, strlen(buf1),
+ (const byte *)buf, strlen(buf));
}
return 0;
}
-
diff --git a/gs/base/gdevpdti.h b/gs/base/gdevpdti.h
index 872b7defe..309089969 100644
--- a/gs/base/gdevpdti.h
+++ b/gs/base/gdevpdti.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -60,15 +60,15 @@ int pdf_charproc_y_offset(pdf_char_proc_t *pcp);
/* Begin a CharProc for an embedded (bitmap) font. */
int pdf_begin_char_proc(gx_device_pdf * pdev, int w, int h, int x_width,
- int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
- pdf_stream_position_t * ppos);
+ int y_offset, int x_offset, gs_id id, pdf_char_proc_t **ppcp,
+ pdf_stream_position_t * ppos);
/* End a CharProc. */
int pdf_end_char_proc(gx_device_pdf * pdev, pdf_stream_position_t * ppos);
/* Put out a reference to an image as a character in an embedded font. */
int pdf_do_char_image(gx_device_pdf * pdev, const pdf_char_proc_t * pcp,
- const gs_matrix * pimat);
+ const gs_matrix * pimat);
/* Only used within text code */
diff --git a/gs/base/gdevpdts.c b/gs/base/gdevpdts.c
index 55b894939..219bbfed4 100644
--- a/gs/base/gdevpdts.c
+++ b/gs/base/gdevpdts.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -100,8 +100,8 @@ static const pdf_text_state_t ts_default = {
};
/* GC descriptor */
gs_private_st_ptrs2(st_pdf_text_state, pdf_text_state_t, "pdf_text_state_t",
- pdf_text_state_enum_ptrs, pdf_text_state_reloc_ptrs,
- in.pdfont, out.pdfont);
+ pdf_text_state_enum_ptrs, pdf_text_state_reloc_ptrs,
+ in.pdfont, out.pdfont);
/* ================ Procedures ================ */
@@ -121,24 +121,24 @@ append_text_move(pdf_text_state_t *pts, floatp dw)
double rounded;
if (count > 0 && pts->buffer.moves[count - 1].index == pos) {
- /* Merge adjacent moves. */
- dw += pts->buffer.moves[--count].amount;
+ /* Merge adjacent moves. */
+ dw += pts->buffer.moves[--count].amount;
}
/* Round dw if it's very close to an integer. */
rounded = floor(dw + 0.5);
if (fabs(dw - rounded) < 0.001)
- dw = rounded;
+ dw = rounded;
if (dw < -MAX_USER_COORD) {
- /* Acrobat reader 4.0c, 5.0 can't handle big offsets.
- Adobe Reader 6 can. */
- return -1;
+ /* Acrobat reader 4.0c, 5.0 can't handle big offsets.
+ Adobe Reader 6 can. */
+ return -1;
}
if (dw != 0) {
- if (count == MAX_TEXT_BUFFER_MOVES)
- return -1;
- pts->buffer.moves[count].index = pos;
- pts->buffer.moves[count].amount = dw;
- ++count;
+ if (count == MAX_TEXT_BUFFER_MOVES)
+ return -1;
+ pts->buffer.moves[count].index = pos;
+ pts->buffer.moves[count].amount = dw;
+ ++count;
}
pts->buffer.count_moves = count;
return 0;
@@ -154,20 +154,20 @@ set_text_distance(gs_point *pdist, floatp dx, floatp dy, const gs_matrix *pmat)
double rounded;
if (code == gs_error_undefinedresult) {
- /* The CTM is degenerate.
- Can't know the distance in user space.
- Set zero because we believe it is not important for rendering.
- We want to copy the text to PDF to make it searchable.
- Bug 689006.
- */
- pdist->x = pdist->y = 0;
+ /* The CTM is degenerate.
+ Can't know the distance in user space.
+ Set zero because we believe it is not important for rendering.
+ We want to copy the text to PDF to make it searchable.
+ Bug 689006.
+ */
+ pdist->x = pdist->y = 0;
} else if (code < 0)
- return code;
+ return code;
/* If the distance is very close to integers, round it. */
if (fabs(pdist->x - (rounded = floor(pdist->x + 0.5))) < 0.0005)
- pdist->x = rounded;
+ pdist->x = rounded;
if (fabs(pdist->y - (rounded = floor(pdist->y + 0.5))) < 0.0005)
- pdist->y = rounded;
+ pdist->y = rounded;
return 0;
}
@@ -178,7 +178,7 @@ static bool
matrix_is_compatible(const gs_matrix *pmat1, const gs_matrix *pmat2)
{
return (pmat2->xx == pmat1->xx && pmat2->xy == pmat1->xy &&
- pmat2->yx == pmat1->yx && pmat2->yy == pmat1->yy);
+ pmat2->yx == pmat1->yx && pmat2->yy == pmat1->yy);
}
/*
@@ -191,59 +191,59 @@ add_text_delta_move(gx_device_pdf *pdev, const gs_matrix *pmat)
pdf_text_state_t *const pts = pdev->text->text_state;
if (matrix_is_compatible(pmat, &pts->in.matrix)) {
- double dx = pmat->tx - pts->in.matrix.tx,
- dy = pmat->ty - pts->in.matrix.ty;
- gs_point dist;
- double dw, dnotw, tdw;
- int code;
-
- code = set_text_distance(&dist, dx, dy, pmat);
- if (code < 0)
- return code;
- if (pts->wmode)
- dw = dist.y, dnotw = dist.x;
- else
- dw = dist.x, dnotw = dist.y;
- if (dnotw == 0 && pts->buffer.count_chars > 0 &&
- /*
- * Acrobat Reader limits the magnitude of user-space
- * coordinates. Also, AR apparently doesn't handle large
- * positive movement values (negative X displacements), even
- * though the PDF Reference says this bug was fixed in AR3.
- *
- * Old revisions used the upper threshold 1000 for tdw,
- * but it appears too big when a font sets a too big
- * character width in setcachedevice. Particularly this happens
- * with a Type 3 font generated by Aldus Freehand 4.0
- * to represent a texture - see bug #687051.
- * The problem is that when the Widths is multiplied
- * to the font size, the viewer represents the result
- * with insufficient fraction bits to represent the precise width.
- * We work around that problem here restricting tdw
- * with a smaller threshold 990. Our intention is to
- * disable Tj when the real glyph width appears smaller
- * than 1% of the width specified in setcachedevice.
- * A Td instruction will be generated instead.
- * Note that the value 990 is arbitrary and may need a
- * further adjustment.
- */
- /* Revised the above. It seems unreasonable to use a fixed
- * value which is not based on the point size, when the problem is
- * caused by a large point size being multiplied by the width. The
- * original fix also caused bitmap fonts (from PCL and other sources)
- * to fail to use kerning, as these fonts are scaled to 1 point and
- * therefore use large kerning values. Instead we check the kerned value
- * multiplied by the point size of the font.
- */
- (tdw = dw * -1000.0 / pts->in.size,
- tdw >= -MAX_USER_COORD && (tdw * pts->in.size) < MAX_USER_COORD)
- ) {
- /* Use TJ. */
- int code = append_text_move(pts, tdw);
-
- if (code >= 0)
- goto finish;
- }
+ double dx = pmat->tx - pts->in.matrix.tx,
+ dy = pmat->ty - pts->in.matrix.ty;
+ gs_point dist;
+ double dw, dnotw, tdw;
+ int code;
+
+ code = set_text_distance(&dist, dx, dy, pmat);
+ if (code < 0)
+ return code;
+ if (pts->wmode)
+ dw = dist.y, dnotw = dist.x;
+ else
+ dw = dist.x, dnotw = dist.y;
+ if (dnotw == 0 && pts->buffer.count_chars > 0 &&
+ /*
+ * Acrobat Reader limits the magnitude of user-space
+ * coordinates. Also, AR apparently doesn't handle large
+ * positive movement values (negative X displacements), even
+ * though the PDF Reference says this bug was fixed in AR3.
+ *
+ * Old revisions used the upper threshold 1000 for tdw,
+ * but it appears too big when a font sets a too big
+ * character width in setcachedevice. Particularly this happens
+ * with a Type 3 font generated by Aldus Freehand 4.0
+ * to represent a texture - see bug #687051.
+ * The problem is that when the Widths is multiplied
+ * to the font size, the viewer represents the result
+ * with insufficient fraction bits to represent the precise width.
+ * We work around that problem here restricting tdw
+ * with a smaller threshold 990. Our intention is to
+ * disable Tj when the real glyph width appears smaller
+ * than 1% of the width specified in setcachedevice.
+ * A Td instruction will be generated instead.
+ * Note that the value 990 is arbitrary and may need a
+ * further adjustment.
+ */
+ /* Revised the above. It seems unreasonable to use a fixed
+ * value which is not based on the point size, when the problem is
+ * caused by a large point size being multiplied by the width. The
+ * original fix also caused bitmap fonts (from PCL and other sources)
+ * to fail to use kerning, as these fonts are scaled to 1 point and
+ * therefore use large kerning values. Instead we check the kerned value
+ * multiplied by the point size of the font.
+ */
+ (tdw = dw * -1000.0 / pts->in.size,
+ tdw >= -MAX_USER_COORD && (tdw * pts->in.size) < MAX_USER_COORD)
+ ) {
+ /* Use TJ. */
+ int code = append_text_move(pts, tdw);
+
+ if (code >= 0)
+ goto finish;
+ }
}
return -1;
finish:
@@ -266,38 +266,38 @@ pdf_set_text_matrix(gx_device_pdf * pdev)
pts->use_leading = false;
if (matrix_is_compatible(&pts->out.matrix, &pts->in.matrix)) {
- gs_point dist;
- int code;
-
- code = set_text_distance(&dist, pts->start.x - pts->line_start.x,
- pts->start.y - pts->line_start.y, &pts->in.matrix);
- if (code < 0)
- return code;
- if (dist.x == 0 && dist.y < 0) {
- /* Use TL, if needed, and T* or '. */
- float dist_y = (float)-dist.y;
-
- if (fabs(pts->leading - dist_y) > 0.0005) {
- pprintg1(s, "%g TL\n", dist_y);
- pts->leading = dist_y;
- }
- pts->use_leading = true;
- } else {
- /* Use Td. */
- pprintg2(s, "%g %g Td\n", dist.x, dist.y);
- }
+ gs_point dist;
+ int code;
+
+ code = set_text_distance(&dist, pts->start.x - pts->line_start.x,
+ pts->start.y - pts->line_start.y, &pts->in.matrix);
+ if (code < 0)
+ return code;
+ if (dist.x == 0 && dist.y < 0) {
+ /* Use TL, if needed, and T* or '. */
+ float dist_y = (float)-dist.y;
+
+ if (fabs(pts->leading - dist_y) > 0.0005) {
+ pprintg1(s, "%g TL\n", dist_y);
+ pts->leading = dist_y;
+ }
+ pts->use_leading = true;
+ } else {
+ /* Use Td. */
+ pprintg2(s, "%g %g Td\n", dist.x, dist.y);
+ }
} else { /* Use Tm. */
- /*
- * See stream_to_text in gdevpdfu.c for why we need the following
- * matrix adjustments.
- */
- double sx = 72.0 / pdev->HWResolution[0],
- sy = 72.0 / pdev->HWResolution[1];
-
- pprintg6(s, "%g %g %g %g %g %g Tm\n",
- pts->in.matrix.xx * sx, pts->in.matrix.xy * sy,
- pts->in.matrix.yx * sx, pts->in.matrix.yy * sy,
- pts->start.x * sx, pts->start.y * sy);
+ /*
+ * See stream_to_text in gdevpdfu.c for why we need the following
+ * matrix adjustments.
+ */
+ double sx = 72.0 / pdev->HWResolution[0],
+ sy = 72.0 / pdev->HWResolution[1];
+
+ pprintg6(s, "%g %g %g %g %g %g Tm\n",
+ pts->in.matrix.xx * sx, pts->in.matrix.xy * sy,
+ pts->in.matrix.yx * sx, pts->in.matrix.yy * sy,
+ pts->start.x * sx, pts->start.y * sy);
}
pts->line_start.x = pts->start.x;
pts->line_start.y = pts->start.y;
@@ -314,11 +314,11 @@ pdf_text_state_t *
pdf_text_state_alloc(gs_memory_t *mem)
{
pdf_text_state_t *pts =
- gs_alloc_struct(mem, pdf_text_state_t, &st_pdf_text_state,
- "pdf_text_state_alloc");
+ gs_alloc_struct(mem, pdf_text_state_t, &st_pdf_text_state,
+ "pdf_text_state_alloc");
if (pts == 0)
- return 0;
+ return 0;
*pts = ts_default;
return pts;
}
@@ -394,35 +394,35 @@ flush_text_buffer(gx_device_pdf *pdev)
stream *s = pdev->strm;
if (pts->buffer.count_chars != 0) {
- pdf_font_resource_t *pdfont = pts->in.pdfont;
- int code = pdf_assign_font_object_id(pdev, pdfont);
-
- if (code < 0)
- return code;
- code = pdf_add_resource(pdev, pdev->substream_Resources, "/Font", (pdf_resource_t *)pdfont);
- if (code < 0)
- return code;
+ pdf_font_resource_t *pdfont = pts->in.pdfont;
+ int code = pdf_assign_font_object_id(pdev, pdfont);
+
+ if (code < 0)
+ return code;
+ code = pdf_add_resource(pdev, pdev->substream_Resources, "/Font", (pdf_resource_t *)pdfont);
+ if (code < 0)
+ return code;
}
if (pts->buffer.count_moves > 0) {
- int i, cur = 0;
-
- if (pts->use_leading)
- stream_puts(s, "T*");
- stream_puts(s, "[");
- for (i = 0; i < pts->buffer.count_moves; ++i) {
- int next = pts->buffer.moves[i].index;
-
- pdf_put_string(pdev, pts->buffer.chars + cur, next - cur);
- pprintg1(s, "%g", pts->buffer.moves[i].amount);
- cur = next;
- }
- if (pts->buffer.count_chars > cur)
- pdf_put_string(pdev, pts->buffer.chars + cur,
- pts->buffer.count_chars - cur);
- stream_puts(s, "]TJ\n");
+ int i, cur = 0;
+
+ if (pts->use_leading)
+ stream_puts(s, "T*");
+ stream_puts(s, "[");
+ for (i = 0; i < pts->buffer.count_moves; ++i) {
+ int next = pts->buffer.moves[i].index;
+
+ pdf_put_string(pdev, pts->buffer.chars + cur, next - cur);
+ pprintg1(s, "%g", pts->buffer.moves[i].amount);
+ cur = next;
+ }
+ if (pts->buffer.count_chars > cur)
+ pdf_put_string(pdev, pts->buffer.chars + cur,
+ pts->buffer.count_chars - cur);
+ stream_puts(s, "]TJ\n");
} else {
- pdf_put_string(pdev, pts->buffer.chars, pts->buffer.count_chars);
- stream_puts(s, (pts->use_leading ? "'\n" : "Tj\n"));
+ pdf_put_string(pdev, pts->buffer.chars, pts->buffer.count_chars);
+ stream_puts(s, (pts->use_leading ? "'\n" : "Tj\n"));
}
pts->buffer.count_chars = 0;
pts->buffer.count_moves = 0;
@@ -441,59 +441,59 @@ sync_text_state(gx_device_pdf *pdev)
int code;
if (pts->buffer.count_chars == 0)
- return 0; /* nothing to output */
+ return 0; /* nothing to output */
- if (pts->continue_line)
- return flush_text_buffer(pdev);
+ if (pts->continue_line)
+ return flush_text_buffer(pdev);
/* Bring text state parameters up to date. */
if (pts->out.character_spacing != pts->in.character_spacing) {
- pprintg1(s, "%g Tc\n", pts->in.character_spacing);
- pts->out.character_spacing = pts->in.character_spacing;
+ pprintg1(s, "%g Tc\n", pts->in.character_spacing);
+ pts->out.character_spacing = pts->in.character_spacing;
}
if (pts->out.pdfont != pts->in.pdfont || pts->out.size != pts->in.size) {
- pdf_font_resource_t *pdfont = pts->in.pdfont;
-
- code = pdf_assign_font_object_id(pdev, pdfont);
- if (code < 0)
- return code;
- pprints1(s, "/%s ", pdfont->rname);
- pprintg1(s, "%g Tf\n", pts->in.size);
- pts->out.pdfont = pdfont;
- pts->out.size = pts->in.size;
- /*
- * In PDF, the only place to specify WMode is in the CMap
- * (a.k.a. Encoding) of a Type 0 font.
- */
- pts->wmode =
- (pdfont->FontType == ft_composite ?
- pdfont->u.type0.WMode : 0);
- code = pdf_used_charproc_resources(pdev, pdfont);
- if (code < 0)
- return code;
+ pdf_font_resource_t *pdfont = pts->in.pdfont;
+
+ code = pdf_assign_font_object_id(pdev, pdfont);
+ if (code < 0)
+ return code;
+ pprints1(s, "/%s ", pdfont->rname);
+ pprintg1(s, "%g Tf\n", pts->in.size);
+ pts->out.pdfont = pdfont;
+ pts->out.size = pts->in.size;
+ /*
+ * In PDF, the only place to specify WMode is in the CMap
+ * (a.k.a. Encoding) of a Type 0 font.
+ */
+ pts->wmode =
+ (pdfont->FontType == ft_composite ?
+ pdfont->u.type0.WMode : 0);
+ code = pdf_used_charproc_resources(pdev, pdfont);
+ if (code < 0)
+ return code;
}
if (memcmp(&pts->in.matrix, &pts->out.matrix, sizeof(pts->in.matrix)) ||
- ((pts->start.x != pts->out_pos.x || pts->start.y != pts->out_pos.y) &&
- (pts->buffer.count_chars != 0 || pts->buffer.count_moves != 0))) {
- /* pdf_set_text_matrix sets out.matrix = in.matrix */
- code = pdf_set_text_matrix(pdev);
- if (code < 0)
- return code;
+ ((pts->start.x != pts->out_pos.x || pts->start.y != pts->out_pos.y) &&
+ (pts->buffer.count_chars != 0 || pts->buffer.count_moves != 0))) {
+ /* pdf_set_text_matrix sets out.matrix = in.matrix */
+ code = pdf_set_text_matrix(pdev);
+ if (code < 0)
+ return code;
}
if (pts->out.render_mode != pts->in.render_mode) {
- pprintg1(s, "%g Tr\n", pts->in.render_mode);
- pts->out.render_mode = pts->in.render_mode;
+ pprintg1(s, "%g Tr\n", pts->in.render_mode);
+ pts->out.render_mode = pts->in.render_mode;
}
if (pts->out.word_spacing != pts->in.word_spacing) {
- if (memchr(pts->buffer.chars, 32, pts->buffer.count_chars)) {
- pprintg1(s, "%g Tw\n", pts->in.word_spacing);
- pts->out.word_spacing = pts->in.word_spacing;
- }
+ if (memchr(pts->buffer.chars, 32, pts->buffer.count_chars)) {
+ pprintg1(s, "%g Tw\n", pts->in.word_spacing);
+ pts->out.word_spacing = pts->in.word_spacing;
+ }
}
return flush_text_buffer(pdev);
@@ -528,10 +528,10 @@ pdf_close_text_contents(gx_device_pdf *pdev)
*/
bool
pdf_render_mode_uses_stroke(const gx_device_pdf *pdev,
- const pdf_text_state_values_t *ptsv)
+ const pdf_text_state_values_t *ptsv)
{
return ((ptsv->render_mode == 1 || ptsv->render_mode == 2 ||
- ptsv->render_mode == 5 || ptsv->render_mode == 6));
+ ptsv->render_mode == 5 || ptsv->render_mode == 6));
}
/*
@@ -554,35 +554,34 @@ pdf_set_text_wmode(gx_device_pdf *pdev, int wmode)
pts->wmode = wmode;
}
-
/*
* Set the stored client view of text state values.
*/
int
pdf_set_text_state_values(gx_device_pdf *pdev,
- const pdf_text_state_values_t *ptsv)
+ const pdf_text_state_values_t *ptsv)
{
pdf_text_state_t *pts = pdev->text->text_state;
if (pts->buffer.count_chars > 0) {
- int code;
-
- if (pts->in.character_spacing == ptsv->character_spacing &&
- pts->in.pdfont == ptsv->pdfont && pts->in.size == ptsv->size &&
- pts->in.render_mode == ptsv->render_mode &&
- pts->in.word_spacing == ptsv->word_spacing
- ) {
- if (!memcmp(&pts->in.matrix, &ptsv->matrix,
- sizeof(pts->in.matrix)))
- return 0;
- /* add_text_delta_move sets pts->in.matrix if successful */
- code = add_text_delta_move(pdev, &ptsv->matrix);
- if (code >= 0)
- return 0;
- }
- code = sync_text_state(pdev);
- if (code < 0)
- return code;
+ int code;
+
+ if (pts->in.character_spacing == ptsv->character_spacing &&
+ pts->in.pdfont == ptsv->pdfont && pts->in.size == ptsv->size &&
+ pts->in.render_mode == ptsv->render_mode &&
+ pts->in.word_spacing == ptsv->word_spacing
+ ) {
+ if (!memcmp(&pts->in.matrix, &ptsv->matrix,
+ sizeof(pts->in.matrix)))
+ return 0;
+ /* add_text_delta_move sets pts->in.matrix if successful */
+ code = add_text_delta_move(pdev, &ptsv->matrix);
+ if (code >= 0)
+ return 0;
+ }
+ code = sync_text_state(pdev);
+ if (code < 0)
+ return code;
}
pts->in = *ptsv;
@@ -596,7 +595,7 @@ pdf_set_text_state_values(gx_device_pdf *pdev,
*/
int
pdf_text_distance_transform(floatp wx, floatp wy, const pdf_text_state_t *pts,
- gs_point *ppt)
+ gs_point *ppt)
{
return gs_distance_transform(wx, wy, &pts->in.matrix, ppt);
}
@@ -620,45 +619,45 @@ pdf_text_position(const gx_device_pdf *pdev, gs_point *ppt)
*/
int
pdf_append_chars(gx_device_pdf * pdev, const byte * str, uint size,
- floatp wx, floatp wy, bool nobreak)
+ floatp wx, floatp wy, bool nobreak)
{
pdf_text_state_t *pts = pdev->text->text_state;
const byte *p = str;
uint left = size;
if (pts->buffer.count_chars == 0 && pts->buffer.count_moves == 0) {
- pts->out_pos.x = pts->start.x = pts->in.matrix.tx;
- pts->out_pos.y = pts->start.y = pts->in.matrix.ty;
+ pts->out_pos.x = pts->start.x = pts->in.matrix.tx;
+ pts->out_pos.y = pts->start.y = pts->in.matrix.ty;
}
while (left)
- if (pts->buffer.count_chars == MAX_TEXT_BUFFER_CHARS ||
- (nobreak && pts->buffer.count_chars + left > MAX_TEXT_BUFFER_CHARS)) {
- int code = sync_text_state(pdev);
-
- if (code < 0)
- return code;
- /* We'll keep a continuation of this line in the buffer,
- * but the current input parameters don't correspond to
- * the current position, because the text was broken in a
- * middle with unknown current point.
- * Don't change the output text state parameters
- * until input parameters are changed.
- * pdf_set_text_state_values will reset the 'continue_line' flag
- * at that time.
- */
- pts->continue_line = true;
- } else {
- int code = pdf_open_page(pdev, PDF_IN_STRING);
- uint copy;
-
- if (code < 0)
- return code;
- copy = min(MAX_TEXT_BUFFER_CHARS - pts->buffer.count_chars, left);
- memcpy(pts->buffer.chars + pts->buffer.count_chars, p, copy);
- pts->buffer.count_chars += copy;
- p += copy;
- left -= copy;
- }
+ if (pts->buffer.count_chars == MAX_TEXT_BUFFER_CHARS ||
+ (nobreak && pts->buffer.count_chars + left > MAX_TEXT_BUFFER_CHARS)) {
+ int code = sync_text_state(pdev);
+
+ if (code < 0)
+ return code;
+ /* We'll keep a continuation of this line in the buffer,
+ * but the current input parameters don't correspond to
+ * the current position, because the text was broken in a
+ * middle with unknown current point.
+ * Don't change the output text state parameters
+ * until input parameters are changed.
+ * pdf_set_text_state_values will reset the 'continue_line' flag
+ * at that time.
+ */
+ pts->continue_line = true;
+ } else {
+ int code = pdf_open_page(pdev, PDF_IN_STRING);
+ uint copy;
+
+ if (code < 0)
+ return code;
+ copy = min(MAX_TEXT_BUFFER_CHARS - pts->buffer.count_chars, left);
+ memcpy(pts->buffer.chars + pts->buffer.count_chars, p, copy);
+ pts->buffer.count_chars += copy;
+ p += copy;
+ left -= copy;
+ }
pts->in.matrix.tx += wx;
pts->in.matrix.ty += wy;
pts->out_pos.x += wx;
@@ -669,9 +668,9 @@ pdf_append_chars(gx_device_pdf * pdev, const byte * str, uint size,
/* Check a new piece of charpath text to see if its safe to combine
* with a previous text operation using text rendering modes.
*/
-bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *pdev,
- gs_imager_state *pis, gs_font *font,
- const gs_text_params_t *text)
+bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *pdev,
+ gs_imager_state *pis, gs_font *font,
+ const gs_text_params_t *text)
{
int code;
float size;
@@ -680,32 +679,32 @@ bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *p
/* check to ensure the new text has the same length as the saved text */
if(text->size != pts->buffer.count_chars)
- return(false);
+ return(false);
if(font->FontType == ft_user_defined)
- return(false);
+ return(false);
/* check to ensure the new text has the same data as the saved text */
if(memcmp(text->data.bytes, &pts->buffer.chars, text->size))
- return(false);
+ return(false);
/* See if the same font is in use by checking the attahced pdfont resource for
* the currrent font and comparing with the saved text state
*/
code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
if(code < 0)
- return(false);
+ return(false);
if(!pdfont || pdfont != pts->in.pdfont)
- return(false);
+ return(false);
- /* Check to see the new text starts at the same point as the saved text.
+ /* Check to see the new text starts at the same point as the saved text.
* NB! only check 2 decimal places, allow some slack in the match. This
* still may prove to be too tight a requirement.
*/
- if(fabs(pts->start.x - pis->current_point.x) > 0.01 ||
- fabs(pts->start.y - pis->current_point.y) > 0.01)
- return(false);
+ if(fabs(pts->start.x - pis->current_point.x) > 0.01 ||
+ fabs(pts->start.y - pis->current_point.y) > 0.01)
+ return(false);
size = pdf_calculate_text_size(pis, pdfont, &font->FontMatrix, &smat, &tmat, font, pdev);
@@ -713,7 +712,7 @@ bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *p
* the text state.
*/
if(size != pts->in.size)
- return(false);
+ return(false);
return(true);
}
@@ -738,54 +737,54 @@ void pdf_set_text_render_mode(pdf_text_state_t *pts, int mode)
int pdf_modify_text_render_mode(pdf_text_state_t *pts, int render_mode)
{
switch (pts->in.render_mode) {
- case 0:
- if (render_mode == 1) {
- pts->in.render_mode = 2;
- return(1);
- }
- break;
- case 1:
- if (render_mode == 1)
- return(1);
- break;
- case 2:
- if (render_mode == 1)
- return(1);
- break;
- case 3:
- if (render_mode == 1) {
- pts->in.render_mode = 1;
- return(1);
- }
- break;
- case 4:
- if (render_mode == 1) {
- pts->in.render_mode = 6;
- return(1);
- }
- break;
- case 5:
- if (render_mode == 1)
- return(1);
- break;
+ case 0:
+ if (render_mode == 1) {
+ pts->in.render_mode = 2;
+ return(1);
+ }
+ break;
+ case 1:
+ if (render_mode == 1)
+ return(1);
+ break;
+ case 2:
+ if (render_mode == 1)
+ return(1);
+ break;
+ case 3:
+ if (render_mode == 1) {
+ pts->in.render_mode = 1;
+ return(1);
+ }
+ break;
+ case 4:
+ if (render_mode == 1) {
+ pts->in.render_mode = 6;
+ return(1);
+ }
+ break;
+ case 5:
+ if (render_mode == 1)
+ return(1);
+ break;
case 6:
- if (render_mode == 1)
- return(1);
- break;
- case 7:
- if (render_mode == 1) {
- pts->in.render_mode = 5;
- return(1);
- }
- break;
- default:
- break;
+ if (render_mode == 1)
+ return(1);
+ break;
+ case 7:
+ if (render_mode == 1) {
+ pts->in.render_mode = 5;
+ return(1);
+ }
+ break;
+ default:
+ break;
}
return(0);
}
-int pdf_set_PaintType0_params (gx_device_pdf *pdev, gs_imager_state *pis, float size,
- double scaled_width, const pdf_text_state_values_t *ptsv)
+int pdf_set_PaintType0_params (gx_device_pdf *pdev, gs_imager_state *pis, float size,
+ double scaled_width, const pdf_text_state_values_t *ptsv)
{
pdf_text_state_t *pts = pdev->text->text_state;
double saved_width = pis->line_params.half_width;
@@ -807,22 +806,22 @@ int pdf_set_PaintType0_params (gx_device_pdf *pdev, gs_imager_state *pis, float
* (new text) Tj
*/
if (pts->buffer.count_chars > 0) {
- if (pts->PaintType0Width != scaled_width) {
- pis->line_params.half_width = scaled_width / 2;
- code = pdf_set_text_state_values(pdev, ptsv);
- if (code < 0)
- return code;
- if (pdev->text->text_state->in.render_mode == ptsv->render_mode){
- code = pdf_prepare_stroke(pdev, pis);
- if (code >= 0)
- code = gdev_vector_prepare_stroke((gx_device_vector *)pdev,
- pis, NULL, NULL, 1);
- }
- if (code < 0)
- return code;
- pis->line_params.half_width = saved_width;
- pts->PaintType0Width = scaled_width;
- }
+ if (pts->PaintType0Width != scaled_width) {
+ pis->line_params.half_width = scaled_width / 2;
+ code = pdf_set_text_state_values(pdev, ptsv);
+ if (code < 0)
+ return code;
+ if (pdev->text->text_state->in.render_mode == ptsv->render_mode){
+ code = pdf_prepare_stroke(pdev, pis);
+ if (code >= 0)
+ code = gdev_vector_prepare_stroke((gx_device_vector *)pdev,
+ pis, NULL, NULL, 1);
+ }
+ if (code < 0)
+ return code;
+ pis->line_params.half_width = saved_width;
+ pts->PaintType0Width = scaled_width;
+ }
}
return 0;
}
diff --git a/gs/base/gdevpdts.h b/gs/base/gdevpdts.h
index 99ae2de54..6bb458509 100644
--- a/gs/base/gdevpdts.h
+++ b/gs/base/gdevpdts.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -84,33 +84,32 @@ void pdf_close_text_contents(gx_device_pdf *pdev); /* gdevpdts.h */
* parameters.
*/
bool pdf_render_mode_uses_stroke(const gx_device_pdf *pdev,
- const pdf_text_state_values_t *ptsv);
+ const pdf_text_state_values_t *ptsv);
/*
* Read the stored client view of text state values.
*/
void pdf_get_text_state_values(gx_device_pdf *pdev,
- pdf_text_state_values_t *ptsv);
+ pdf_text_state_values_t *ptsv);
/*
* Set wmode to text state.
*/
void pdf_set_text_wmode(gx_device_pdf *pdev, int wmode);
-
/*
* Set the stored client view of text state values.
*/
int pdf_set_text_state_values(gx_device_pdf *pdev,
- const pdf_text_state_values_t *ptsv);
+ const pdf_text_state_values_t *ptsv);
/*
* Transform a distance from unscaled text space (text space ignoring the
* scaling implied by the font size) to device space.
*/
int pdf_text_distance_transform(floatp wx, floatp wy,
- const pdf_text_state_t *pts,
- gs_point *ppt);
+ const pdf_text_state_t *pts,
+ gs_point *ppt);
/*
* Return the current (x,y) text position as seen by the client, in
@@ -123,16 +122,16 @@ void pdf_text_position(const gx_device_pdf *pdev, gs_point *ppt);
* in device space.
*/
int pdf_append_chars(gx_device_pdf * pdev, const byte * str, uint size,
- floatp wx, floatp wy, bool nobreak);
+ floatp wx, floatp wy, bool nobreak);
-bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *pdev,
- gs_imager_state *pis, gs_font *font,
- const gs_text_params_t *text);
+bool pdf_compare_text_state_for_charpath(pdf_text_state_t *pts, gx_device_pdf *pdev,
+ gs_imager_state *pis, gs_font *font,
+ const gs_text_params_t *text);
int pdf_get_text_render_mode(pdf_text_state_t *pts);
void pdf_set_text_render_mode(pdf_text_state_t *pts, int mode);
int pdf_modify_text_render_mode(pdf_text_state_t *pts, int render_mode);
-int pdf_set_PaintType0_params (gx_device_pdf *pdev, gs_imager_state *pis,
- float size, double scaled_width,
- const pdf_text_state_values_t *ptsv);
+int pdf_set_PaintType0_params (gx_device_pdf *pdev, gs_imager_state *pis,
+ float size, double scaled_width,
+ const pdf_text_state_values_t *ptsv);
#endif /* gdevpdts_INCLUDED */
diff --git a/gs/base/gdevpdtt.c b/gs/base/gdevpdtt.c
index 2234bb977..6f0343226 100644
--- a/gs/base/gdevpdtt.c
+++ b/gs/base/gdevpdtt.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,8 +29,8 @@
#include "gxfcopy.h"
#include "gxfcmap.h"
#include "gxpath.h" /* for getting current point */
-#include "gxchar.h"
-#include "gxstate.h"
+#include "gxchar.h"
+#include "gxstate.h"
#include "gdevpdfx.h"
#include "gdevpdfg.h"
#include "gdevpdfo.h"
@@ -61,12 +61,12 @@ pdf_text_resync(gs_text_enum_t *pte, const gs_text_enum_t *pfrom)
pdf_text_enum_t *const penum = (pdf_text_enum_t *)pte;
if ((pte->text.operation ^ pfrom->text.operation) & ~TEXT_FROM_ANY)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (penum->pte_default) {
- int code = gs_text_resync(penum->pte_default, pfrom);
+ int code = gs_text_resync(penum->pte_default, pfrom);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
pte->text = pfrom->text;
gs_text_enum_copy_dynamic(pte, pfrom, false);
@@ -78,7 +78,7 @@ pdf_text_is_width_only(const gs_text_enum_t *pte)
const pdf_text_enum_t *const penum = (const pdf_text_enum_t *)pte;
if (penum->pte_default)
- return gs_text_is_width_only(penum->pte_default);
+ return gs_text_is_width_only(penum->pte_default);
return false;
}
static int
@@ -87,177 +87,177 @@ pdf_text_current_width(const gs_text_enum_t *pte, gs_point *pwidth)
const pdf_text_enum_t *const penum = (const pdf_text_enum_t *)pte;
if (penum->pte_default)
- return gs_text_current_width(penum->pte_default, pwidth);
+ return gs_text_current_width(penum->pte_default, pwidth);
return_error(gs_error_rangecheck); /* can't happen */
}
static int
pdf_text_set_cache(gs_text_enum_t *pte, const double *pw,
- gs_text_cache_control_t control)
+ gs_text_cache_control_t control)
{
pdf_text_enum_t *const penum = (pdf_text_enum_t *)pte;
gx_device_pdf *pdev = (gx_device_pdf *)pte->dev;
gs_matrix m;
if (pdev->type3charpath)
- return gs_text_set_cache(penum->pte_default, pw, control);
+ return gs_text_set_cache(penum->pte_default, pw, control);
switch (control) {
case TEXT_SET_CHAR_WIDTH:
case TEXT_SET_CACHE_DEVICE:
- /* See comments in pdf_text_process. We are using a 100x100 matrix
- * NOT the identity, but we want the cache device values to be in
- * font co-ordinate space, so we need to undo that scale here.
- */
- gs_matrix_scale(&ctm_only(pte->pis), .01, .01, &m);
- gs_distance_transform(pw[0], pw[1], &m, &pdev->char_width);
- break;
+ /* See comments in pdf_text_process. We are using a 100x100 matrix
+ * NOT the identity, but we want the cache device values to be in
+ * font co-ordinate space, so we need to undo that scale here.
+ */
+ gs_matrix_scale(&ctm_only(pte->pis), .01, .01, &m);
+ gs_distance_transform(pw[0], pw[1], &m, &pdev->char_width);
+ break;
case TEXT_SET_CACHE_DEVICE2:
- /*
- * pdev->char_width is used with synthesized Type 3 fonts only.
- * Since they are simple fonts, we only need the horisontal
- * width for Widths array. Therefore we don't check
- * gs_rootfont(pgs)->WMode and don't use pw[6:7].
- */
- /* See comments in pdf_text_process. We are using a 100x100 matrix
- * NOT the identity, but we want the cache device values to be in
- * font co-ordinate space, so we need to undo that scale here.
- */
- gs_matrix_scale(&ctm_only(pte->pis), .01, .01, &m);
- gs_distance_transform(pw[0], pw[1], &m, &pdev->char_width);
- if (penum->cdevproc_callout) {
- memcpy(penum->cdevproc_result, pw, sizeof(penum->cdevproc_result));
- return 0;
- }
- break;
+ /*
+ * pdev->char_width is used with synthesized Type 3 fonts only.
+ * Since they are simple fonts, we only need the horisontal
+ * width for Widths array. Therefore we don't check
+ * gs_rootfont(pgs)->WMode and don't use pw[6:7].
+ */
+ /* See comments in pdf_text_process. We are using a 100x100 matrix
+ * NOT the identity, but we want the cache device values to be in
+ * font co-ordinate space, so we need to undo that scale here.
+ */
+ gs_matrix_scale(&ctm_only(pte->pis), .01, .01, &m);
+ gs_distance_transform(pw[0], pw[1], &m, &pdev->char_width);
+ if (penum->cdevproc_callout) {
+ memcpy(penum->cdevproc_result, pw, sizeof(penum->cdevproc_result));
+ return 0;
+ }
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
if (penum->pte_default == NULL)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
- if (penum->current_font->FontType == ft_user_defined &&
- penum->outer_CID == GS_NO_GLYPH &&
- !(penum->pte_default->text.operation & TEXT_DO_CHARWIDTH)) {
- int code;
- gs_glyph glyph;
+ if (penum->current_font->FontType == ft_user_defined &&
+ penum->outer_CID == GS_NO_GLYPH &&
+ !(penum->pte_default->text.operation & TEXT_DO_CHARWIDTH)) {
+ int code;
+ gs_glyph glyph;
glyph = penum->returned.current_glyph;
- if (glyph != GS_NO_GLYPH && penum->output_char_code != GS_NO_CHAR) {
- gs_show_enum *penum_s;
- extern_st(st_gs_show_enum);
- gs_fixed_rect clip_box;
- double pw1[10];
- int narg = (control == TEXT_SET_CHAR_WIDTH ? 2 :
- control == TEXT_SET_CACHE_DEVICE ? 6 : 10), i;
-
- /* Check to verify the structure type is really gs_show_enum */
- if (gs_object_type(penum->pte_default->memory, penum->pte_default) != &st_gs_show_enum) {
- /* Must not happen with PS interpreter.
- Other clients should conform. */
- return_error(gs_error_unregistered);
- }
- penum_s = (gs_show_enum *)penum->pte_default;
- /* BuildChar could change the scale before calling setcachedevice (Bug 687290).
- We must scale the setcachedevice arguments because we assumed
- identity scale before entering the charproc.
- For now we only handle scaling matrices.
- */
- for (i = 0; i < narg; i += 2) {
- gs_point p;
-
- gs_point_transform(pw[i], pw[i + 1], &ctm_only(penum_s->pgs), &p);
- pw1[i] = p.x;
- pw1[i + 1] = p.y;
- }
- if (control != TEXT_SET_CHAR_WIDTH) {
- clip_box.p.x = float2fixed(pw1[2]);
- clip_box.p.y = float2fixed(pw1[3]);
- clip_box.q.x = float2fixed(pw1[4]);
- clip_box.q.y = float2fixed(pw1[5]);
- } else {
- /*
- * We have no character bbox, but we need one to install the clipping
- * to the graphic state of the PS interpreter. Since some fonts don't
- * provide a proper FontBBox (Bug 687239 supplies a zero one),
- * we set an "infinite" clipping here.
- * We also detected that min_int, max_int don't work here with
- * comparefiles/Bug687044.ps, therefore we divide them by 2.
- */
- clip_box.p.x = clip_box.p.y = min_int / 2;
- clip_box.q.x = clip_box.q.y = max_int / 2;
- }
- code = gx_clip_to_rectangle(penum_s->pgs, &clip_box);
- if (code < 0)
- return code;
-
- /* See comments in pdf_text_process. We are using a 100x100 matrix
- * NOT the identity, but we want the cache device values to be in
- * font co-ordinate space, so we need to undo that scale here. We
- * can't do it above, where we take any scaling from the BuildChar
- * into account, because that would get the clip path wrong, that
- * needs to be in the 100x100 space so that it doesn't clip
- * out marking operations.
- */
- gs_matrix_scale(&ctm_only(penum_s->pgs), .01, .01, &m);
- for (i = 0; i < narg; i += 2) {
- gs_point p;
-
- gs_point_transform(pw[i], pw[i + 1], &m, &p);
- pw1[i] = p.x;
- pw1[i + 1] = p.y;
- }
- code = pdf_set_charproc_attrs(pdev, pte->current_font,
- pw1, narg, control, penum->output_char_code);
- if (code < 0)
- return code;
- /* Prevent writing the clipping path to charproc.
- See the comment above and bugs 687678, 688327.
- Note that the clipping in the graphic state will be used while
- fallbacks to default implementations of graphic objects.
- Hopely such fallbacks are rare. */
- pdev->clip_path_id = gx_get_clip_path_id(penum_s->pgs);
- return code;
- } else {
- gs_matrix m;
- pdf_resource_t *pres = pdev->accumulating_substream_resource;
-
- /* pdf_text_process started a charproc stream accumulation,
- but now we re-decided to go with the default implementation.
- Cancel the stream now.
- */
- code = pdf_exit_substream(pdev);
- if (code < 0)
- return code;
- code = pdf_cancel_resource(pdev, pres, resourceCharProc);
- if (code < 0)
- return code;
- pdf_forget_resource(pdev, pres, resourceCharProc);
- /* pdf_text_process had set an identity CTM for the
- charproc stream accumulation, but now we re-decided
- to go with the default implementation.
- Need to restore the correct CTM and add
- changes, which the charproc possibly did. */
- /* See comments in pdf_text_process. We are using a 100x100 matrix
- * NOT the identity, so we need to undo that scale here.
- */
- gs_matrix_scale(&ctm_only(penum->pis), .01, .01, (gs_matrix *)&ctm_only(penum->pis));
- /* We also scaled the page height and width. Because we
- * don't go through the accumulator 'close' in pdf_text_process
- * we must also undo that scale.
- */
- pdev->width /= 100;
- pdev->height /= 100;
-
- gs_matrix_multiply((gs_matrix *)&pdev->charproc_ctm, (gs_matrix *)&penum->pis->ctm, &m);
- gs_matrix_fixed_from_matrix(&penum->pis->ctm, &m);
- penum->charproc_accum = false;
- }
+ if (glyph != GS_NO_GLYPH && penum->output_char_code != GS_NO_CHAR) {
+ gs_show_enum *penum_s;
+ extern_st(st_gs_show_enum);
+ gs_fixed_rect clip_box;
+ double pw1[10];
+ int narg = (control == TEXT_SET_CHAR_WIDTH ? 2 :
+ control == TEXT_SET_CACHE_DEVICE ? 6 : 10), i;
+
+ /* Check to verify the structure type is really gs_show_enum */
+ if (gs_object_type(penum->pte_default->memory, penum->pte_default) != &st_gs_show_enum) {
+ /* Must not happen with PS interpreter.
+ Other clients should conform. */
+ return_error(gs_error_unregistered);
+ }
+ penum_s = (gs_show_enum *)penum->pte_default;
+ /* BuildChar could change the scale before calling setcachedevice (Bug 687290).
+ We must scale the setcachedevice arguments because we assumed
+ identity scale before entering the charproc.
+ For now we only handle scaling matrices.
+ */
+ for (i = 0; i < narg; i += 2) {
+ gs_point p;
+
+ gs_point_transform(pw[i], pw[i + 1], &ctm_only(penum_s->pgs), &p);
+ pw1[i] = p.x;
+ pw1[i + 1] = p.y;
+ }
+ if (control != TEXT_SET_CHAR_WIDTH) {
+ clip_box.p.x = float2fixed(pw1[2]);
+ clip_box.p.y = float2fixed(pw1[3]);
+ clip_box.q.x = float2fixed(pw1[4]);
+ clip_box.q.y = float2fixed(pw1[5]);
+ } else {
+ /*
+ * We have no character bbox, but we need one to install the clipping
+ * to the graphic state of the PS interpreter. Since some fonts don't
+ * provide a proper FontBBox (Bug 687239 supplies a zero one),
+ * we set an "infinite" clipping here.
+ * We also detected that min_int, max_int don't work here with
+ * comparefiles/Bug687044.ps, therefore we divide them by 2.
+ */
+ clip_box.p.x = clip_box.p.y = min_int / 2;
+ clip_box.q.x = clip_box.q.y = max_int / 2;
+ }
+ code = gx_clip_to_rectangle(penum_s->pgs, &clip_box);
+ if (code < 0)
+ return code;
+
+ /* See comments in pdf_text_process. We are using a 100x100 matrix
+ * NOT the identity, but we want the cache device values to be in
+ * font co-ordinate space, so we need to undo that scale here. We
+ * can't do it above, where we take any scaling from the BuildChar
+ * into account, because that would get the clip path wrong, that
+ * needs to be in the 100x100 space so that it doesn't clip
+ * out marking operations.
+ */
+ gs_matrix_scale(&ctm_only(penum_s->pgs), .01, .01, &m);
+ for (i = 0; i < narg; i += 2) {
+ gs_point p;
+
+ gs_point_transform(pw[i], pw[i + 1], &m, &p);
+ pw1[i] = p.x;
+ pw1[i + 1] = p.y;
+ }
+ code = pdf_set_charproc_attrs(pdev, pte->current_font,
+ pw1, narg, control, penum->output_char_code);
+ if (code < 0)
+ return code;
+ /* Prevent writing the clipping path to charproc.
+ See the comment above and bugs 687678, 688327.
+ Note that the clipping in the graphic state will be used while
+ fallbacks to default implementations of graphic objects.
+ Hopely such fallbacks are rare. */
+ pdev->clip_path_id = gx_get_clip_path_id(penum_s->pgs);
+ return code;
+ } else {
+ gs_matrix m;
+ pdf_resource_t *pres = pdev->accumulating_substream_resource;
+
+ /* pdf_text_process started a charproc stream accumulation,
+ but now we re-decided to go with the default implementation.
+ Cancel the stream now.
+ */
+ code = pdf_exit_substream(pdev);
+ if (code < 0)
+ return code;
+ code = pdf_cancel_resource(pdev, pres, resourceCharProc);
+ if (code < 0)
+ return code;
+ pdf_forget_resource(pdev, pres, resourceCharProc);
+ /* pdf_text_process had set an identity CTM for the
+ charproc stream accumulation, but now we re-decided
+ to go with the default implementation.
+ Need to restore the correct CTM and add
+ changes, which the charproc possibly did. */
+ /* See comments in pdf_text_process. We are using a 100x100 matrix
+ * NOT the identity, so we need to undo that scale here.
+ */
+ gs_matrix_scale(&ctm_only(penum->pis), .01, .01, (gs_matrix *)&ctm_only(penum->pis));
+ /* We also scaled the page height and width. Because we
+ * don't go through the accumulator 'close' in pdf_text_process
+ * we must also undo that scale.
+ */
+ pdev->width /= 100;
+ pdev->height /= 100;
+
+ gs_matrix_multiply((gs_matrix *)&pdev->charproc_ctm, (gs_matrix *)&penum->pis->ctm, &m);
+ gs_matrix_fixed_from_matrix(&penum->pis->ctm, &m);
+ penum->charproc_accum = false;
+ }
}
if (penum->pte_default) {
- if (penum->pte_default->text.operation & TEXT_DO_CHARWIDTH /* See process_cmap_text.*/)
- return gs_text_set_cache(penum->pte_default, pw, TEXT_SET_CHAR_WIDTH);
- else
- return gs_text_set_cache(penum->pte_default, pw, control);
+ if (penum->pte_default->text.operation & TEXT_DO_CHARWIDTH /* See process_cmap_text.*/)
+ return gs_text_set_cache(penum->pte_default, pw, TEXT_SET_CHAR_WIDTH);
+ else
+ return gs_text_set_cache(penum->pte_default, pw, control);
}
return_error(gs_error_unregistered); /* can't happen */
}
@@ -267,7 +267,7 @@ pdf_text_retry(gs_text_enum_t *pte)
pdf_text_enum_t *const penum = (pdf_text_enum_t *)pte;
if (penum->pte_default)
- return gs_text_retry(penum->pte_default);
+ return gs_text_retry(penum->pte_default);
return_error(gs_error_rangecheck); /* can't happen */
}
static void
@@ -276,8 +276,8 @@ pdf_text_release(gs_text_enum_t *pte, client_name_t cname)
pdf_text_enum_t *const penum = (pdf_text_enum_t *)pte;
if (penum->pte_default) {
- gs_text_release(penum->pte_default, cname);
- penum->pte_default = 0;
+ gs_text_release(penum->pte_default, cname);
+ penum->pte_default = 0;
}
pdf_text_release_cgp(penum);
gx_default_text_release(pte, cname);
@@ -286,8 +286,8 @@ void
pdf_text_release_cgp(pdf_text_enum_t *penum)
{
if (penum->cgp) {
- gs_free_object(penum->memory, penum->cgp, "pdf_text_release");
- penum->cgp = 0;
+ gs_free_object(penum->memory, penum->cgp, "pdf_text_release");
+ penum->cgp = 0;
}
}
@@ -311,54 +311,54 @@ pdf_prepare_text_drawing(gx_device_pdf *const pdev, gs_text_enum_t *pte)
int code;
if (!(text->operation & TEXT_DO_NONE) || pis->text_rendering_mode == 3) {
- new_clip = pdf_must_put_clip_path(pdev, pcpath);
- if (new_clip)
- code = pdf_unclip(pdev);
- else if (pdev->context == PDF_IN_NONE)
- code = pdf_open_page(pdev, PDF_IN_STREAM);
- else
- code = 0;
- if (code < 0)
- return code;
- code = pdf_prepare_fill(pdev, pis);
- if (code < 0)
- return code;
+ new_clip = pdf_must_put_clip_path(pdev, pcpath);
+ if (new_clip)
+ code = pdf_unclip(pdev);
+ else if (pdev->context == PDF_IN_NONE)
+ code = pdf_open_page(pdev, PDF_IN_STREAM);
+ else
+ code = 0;
+ if (code < 0)
+ return code;
+ code = pdf_prepare_fill(pdev, pis);
+ if (code < 0)
+ return code;
}
if (text->operation & TEXT_DO_DRAW) {
- /*
- * Set the clipping path and drawing color. We set both the fill
- * and stroke color, because we don't know whether the fonts will be
- * filled or stroked, and we can't set a color while we are in text
- * mode. (This is a consequence of the implementation, not a
- * limitation of PDF.)
- */
-
- if (new_clip) {
- code = pdf_put_clip_path(pdev, pcpath);
- if (code < 0)
- return code;
- }
-
- if ((code =
- pdf_set_drawing_color(pdev, pis, pdcolor, &pdev->saved_stroke_color,
- &pdev->stroke_used_process_color,
- &psdf_set_stroke_color_commands)) < 0 ||
- (code =
- pdf_set_drawing_color(pdev, pis, pdcolor, &pdev->saved_fill_color,
- &pdev->fill_used_process_color,
- &psdf_set_fill_color_commands)) < 0
- )
- return code;
+ /*
+ * Set the clipping path and drawing color. We set both the fill
+ * and stroke color, because we don't know whether the fonts will be
+ * filled or stroked, and we can't set a color while we are in text
+ * mode. (This is a consequence of the implementation, not a
+ * limitation of PDF.)
+ */
+
+ if (new_clip) {
+ code = pdf_put_clip_path(pdev, pcpath);
+ if (code < 0)
+ return code;
+ }
+
+ if ((code =
+ pdf_set_drawing_color(pdev, pis, pdcolor, &pdev->saved_stroke_color,
+ &pdev->stroke_used_process_color,
+ &psdf_set_stroke_color_commands)) < 0 ||
+ (code =
+ pdf_set_drawing_color(pdev, pis, pdcolor, &pdev->saved_fill_color,
+ &pdev->fill_used_process_color,
+ &psdf_set_fill_color_commands)) < 0
+ )
+ return code;
}
return 0;
}
int
gdev_pdf_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t *text, gs_font * font,
- gx_path * path0, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ const gs_text_params_t *text, gs_font * font,
+ gx_path * path0, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gx_device_pdf *const pdev = (gx_device_pdf *)dev;
gx_path *path = path0;
@@ -367,122 +367,122 @@ gdev_pdf_text_begin(gx_device * dev, gs_imager_state * pis,
/* Track the dominant text rotation. */
{
- gs_matrix tmat;
- gs_point p;
- int i;
-
- gs_matrix_multiply(&font->FontMatrix, &ctm_only(pis), &tmat);
- gs_distance_transform(1, 0, &tmat, &p);
- if (p.x > fabs(p.y))
- i = 0;
- else if (p.x < -fabs(p.y))
- i = 2;
- else if (p.y > fabs(p.x))
- i = 1;
- else if (p.y < -fabs(p.x))
- i = 3;
- else
- i = 4;
- pdf_current_page(pdev)->text_rotation.counts[i] += text->size;
+ gs_matrix tmat;
+ gs_point p;
+ int i;
+
+ gs_matrix_multiply(&font->FontMatrix, &ctm_only(pis), &tmat);
+ gs_distance_transform(1, 0, &tmat, &p);
+ if (p.x > fabs(p.y))
+ i = 0;
+ else if (p.x < -fabs(p.y))
+ i = 2;
+ else if (p.y > fabs(p.x))
+ i = 1;
+ else if (p.y < -fabs(p.x))
+ i = 3;
+ else
+ i = 4;
+ pdf_current_page(pdev)->text_rotation.counts[i] += text->size;
}
pdev->last_charpath_op = 0;
if ((text->operation & TEXT_DO_ANY_CHARPATH) && !path0->first_subpath) {
- if (pdf_compare_text_state_for_charpath(pdev->text->text_state, pdev, pis, font, text))
- pdev->last_charpath_op = text->operation & TEXT_DO_ANY_CHARPATH;
+ if (pdf_compare_text_state_for_charpath(pdev->text->text_state, pdev, pis, font, text))
+ pdev->last_charpath_op = text->operation & TEXT_DO_ANY_CHARPATH;
}
if(font->FontType == ft_user_defined)
- user_defined = 1;
+ user_defined = 1;
/* We need to know whether any of the glyphs in a string using a composite font
* use a descendant font which is a type 3 (user-defined) so that we can properly
* skip the caching below.
*/
if(font->FontType == ft_composite && ((gs_font_type0 *)font)->data.FMapType != fmap_CMap) {
- int font_code;
- gs_char chr;
- gs_glyph glyph;
-
- rc_alloc_struct_1(penum, pdf_text_enum_t, &st_pdf_text_enum, mem,
- return_error(gs_error_VMerror), "gdev_pdf_text_begin");
- penum->rc.free = rc_free_text_enum;
- penum->pte_default = 0;
- penum->charproc_accum = false;
- penum->cdevproc_callout = false;
- penum->returned.total_width.x = penum->returned.total_width.y = 0;
- penum->cgp = NULL;
- penum->output_char_code = GS_NO_CHAR;
- code = gs_text_enum_init((gs_text_enum_t *)penum, &pdf_text_procs,
- dev, pis, text, font, path, pdcolor, pcpath, mem);
- if (code < 0) {
- gs_free_object(mem, penum, "gdev_pdf_text_begin");
- return code;
- }
- do {
- font_code = penum->orig_font->procs.next_char_glyph
- ((gs_text_enum_t *)penum, &chr, &glyph);
- if (font_code == 1){
- if (penum->fstack.items[penum->fstack.depth].font->FontType == 3) {
- user_defined = 1;
- break;
- }
- }
- } while(font_code != 2 && font_code >= 0);
- gs_text_release((gs_text_enum_t *)penum, "pdf_text_process");
+ int font_code;
+ gs_char chr;
+ gs_glyph glyph;
+
+ rc_alloc_struct_1(penum, pdf_text_enum_t, &st_pdf_text_enum, mem,
+ return_error(gs_error_VMerror), "gdev_pdf_text_begin");
+ penum->rc.free = rc_free_text_enum;
+ penum->pte_default = 0;
+ penum->charproc_accum = false;
+ penum->cdevproc_callout = false;
+ penum->returned.total_width.x = penum->returned.total_width.y = 0;
+ penum->cgp = NULL;
+ penum->output_char_code = GS_NO_CHAR;
+ code = gs_text_enum_init((gs_text_enum_t *)penum, &pdf_text_procs,
+ dev, pis, text, font, path, pdcolor, pcpath, mem);
+ if (code < 0) {
+ gs_free_object(mem, penum, "gdev_pdf_text_begin");
+ return code;
+ }
+ do {
+ font_code = penum->orig_font->procs.next_char_glyph
+ ((gs_text_enum_t *)penum, &chr, &glyph);
+ if (font_code == 1){
+ if (penum->fstack.items[penum->fstack.depth].font->FontType == 3) {
+ user_defined = 1;
+ break;
+ }
+ }
+ } while(font_code != 2 && font_code >= 0);
+ gs_text_release((gs_text_enum_t *)penum, "pdf_text_process");
}
if (!user_defined || !(text->operation & TEXT_DO_ANY_CHARPATH)) {
if (user_defined &&
- (text->operation & TEXT_DO_NONE) && (text->operation & TEXT_RETURN_WIDTH)) {
- /* This is stringwidth, see gx_default_text_begin.
- * We need to prevent writing characters to PS cache,
- * otherwise the font converts to bitmaps.
- * So pass through even with stringwidth.
- */
- code = gx_hld_stringwidth_begin(pis, &path);
- if (code < 0)
- return code;
- } else if ((!(text->operation & TEXT_DO_DRAW) && pis->text_rendering_mode != 3)
- || path == 0 || !path_position_valid(path)
- || pdev->type3charpath)
- return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
- pcpath, mem, ppte);
- else if (text->operation & TEXT_DO_ANY_CHARPATH)
- return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
- pcpath, mem, ppte);
+ (text->operation & TEXT_DO_NONE) && (text->operation & TEXT_RETURN_WIDTH)) {
+ /* This is stringwidth, see gx_default_text_begin.
+ * We need to prevent writing characters to PS cache,
+ * otherwise the font converts to bitmaps.
+ * So pass through even with stringwidth.
+ */
+ code = gx_hld_stringwidth_begin(pis, &path);
+ if (code < 0)
+ return code;
+ } else if ((!(text->operation & TEXT_DO_DRAW) && pis->text_rendering_mode != 3)
+ || path == 0 || !path_position_valid(path)
+ || pdev->type3charpath)
+ return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
+ pcpath, mem, ppte);
+ else if (text->operation & TEXT_DO_ANY_CHARPATH)
+ return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
+ pcpath, mem, ppte);
}
/* Allocate and initialize the enumerator. */
rc_alloc_struct_1(penum, pdf_text_enum_t, &st_pdf_text_enum, mem,
- return_error(gs_error_VMerror), "gdev_pdf_text_begin");
+ return_error(gs_error_VMerror), "gdev_pdf_text_begin");
penum->rc.free = rc_free_text_enum;
- penum->pte_default = 0;
+ penum->pte_default = 0;
penum->charproc_accum = false;
penum->cdevproc_callout = false;
penum->returned.total_width.x = penum->returned.total_width.y = 0;
penum->cgp = NULL;
penum->output_char_code = GS_NO_CHAR;
code = gs_text_enum_init((gs_text_enum_t *)penum, &pdf_text_procs,
- dev, pis, text, font, path, pdcolor, pcpath, mem);
+ dev, pis, text, font, path, pdcolor, pcpath, mem);
if (code < 0) {
- gs_free_object(mem, penum, "gdev_pdf_text_begin");
- return code;
+ gs_free_object(mem, penum, "gdev_pdf_text_begin");
+ return code;
}
if (pdev->font3 != 0) {
- /* A text operation happens while accumulating a charproc.
- This is a case when source document uses a Type 3 font,
- which's charproc uses another font.
- Since the text operation is handled by the device,
- the font isn't converting to a raster (i.e. to a bitmap font).
- Disable the grid fitting for the convertion to get a proper outlines,
- because the viewer resolution is not known during the accumulation.
- Note we set identity CTM in pdf_text_set_cache for the accumilation,
- and therefore the font may look too small while the source charproc
- interpretation. The document tpc2.ps of the bug 687087 is an example.
- */
- penum->device_disabled_grid_fitting = true;
+ /* A text operation happens while accumulating a charproc.
+ This is a case when source document uses a Type 3 font,
+ which's charproc uses another font.
+ Since the text operation is handled by the device,
+ the font isn't converting to a raster (i.e. to a bitmap font).
+ Disable the grid fitting for the convertion to get a proper outlines,
+ because the viewer resolution is not known during the accumulation.
+ Note we set identity CTM in pdf_text_set_cache for the accumilation,
+ and therefore the font may look too small while the source charproc
+ interpretation. The document tpc2.ps of the bug 687087 is an example.
+ */
+ penum->device_disabled_grid_fitting = true;
}
*ppte = (gs_text_enum_t *)penum;
@@ -498,7 +498,7 @@ private_st_pdf_font_cache_elem();
/*
* Compute id for a font cache element.
*/
-static ulong
+static ulong
pdf_font_cache_elem_id(gs_font *font)
{
#if 0
@@ -516,10 +516,10 @@ pdf_font_cache_elem_id(gs_font *font)
* This branch is incompatible with pdf_notify_remove_font.
*/
if (font->FontType == ft_composite || font->PaintType != 0 ||
- !uid_is_valid(&(((gs_font_base *)font)->UID)))
- return font->id;
+ !uid_is_valid(&(((gs_font_base *)font)->UID)))
+ return font->id;
else
- return ((gs_font_base *)font)->UID.id;
+ return ((gs_font_base *)font)->UID.id;
#else
return font->id;
#endif
@@ -532,9 +532,9 @@ pdf_locate_font_cache_elem(gx_device_pdf *pdev, gs_font *font)
long id = pdf_font_cache_elem_id(font);
for (; *e != 0; e = &(*e)->next)
- if ((*e)->font_id == id) {
- return e;
- }
+ if ((*e)->font_id == id) {
+ return e;
+ }
return 0;
}
@@ -545,85 +545,85 @@ pdf_remove_font_cache_elem(pdf_font_cache_elem_t *e0)
pdf_font_cache_elem_t **e = &pdev->font_cache;
for (; *e != 0; e = &(*e)->next)
- if (*e == e0) {
- *e = e0->next;
- gs_free_object(pdev->pdf_memory, e0->glyph_usage,
- "pdf_remove_font_cache_elem");
- gs_free_object(pdev->pdf_memory, e0->real_widths,
- "pdf_remove_font_cache_elem");
- /* Clean pointers, because gs_free_object below may work idle
- when this function is called by a garbager notification.
- Leaving unclean pointers may cause
- a further heap validation to fail
- since the unfreed structure points to freed areas.
- For instance, e0->next may point to an element,
- which is really freed with a subsequent 'restore'.
- Bug 688837. */
- e0->next = 0;
- e0->glyph_usage = 0;
- e0->real_widths = 0;
- e0->pdev = 0;
- gs_free_object(pdev->pdf_memory, e0,
- "pdf_remove_font_cache_elem");
- return;
- }
+ if (*e == e0) {
+ *e = e0->next;
+ gs_free_object(pdev->pdf_memory, e0->glyph_usage,
+ "pdf_remove_font_cache_elem");
+ gs_free_object(pdev->pdf_memory, e0->real_widths,
+ "pdf_remove_font_cache_elem");
+ /* Clean pointers, because gs_free_object below may work idle
+ when this function is called by a garbager notification.
+ Leaving unclean pointers may cause
+ a further heap validation to fail
+ since the unfreed structure points to freed areas.
+ For instance, e0->next may point to an element,
+ which is really freed with a subsequent 'restore'.
+ Bug 688837. */
+ e0->next = 0;
+ e0->glyph_usage = 0;
+ e0->real_widths = 0;
+ e0->pdev = 0;
+ gs_free_object(pdev->pdf_memory, e0,
+ "pdf_remove_font_cache_elem");
+ return;
+ }
}
static void
font_cache_elem_array_sizes(gx_device_pdf *pdev, gs_font *font,
- int *num_widths, int *num_chars)
+ int *num_widths, int *num_chars)
{
switch (font->FontType) {
case ft_composite:
- *num_widths = 0; /* Unused for Type 0 */
- *num_chars = 65536; /* No chance to determine, use max. */
- break;
+ *num_widths = 0; /* Unused for Type 0 */
+ *num_chars = 65536; /* No chance to determine, use max. */
+ break;
case ft_encrypted:
case ft_encrypted2:
case ft_user_defined:
case ft_disk_based:
case ft_Chameleon:
case ft_TrueType:
- *num_widths = *num_chars = 256; /* Assuming access to glyph_usage by character codes */
- break;
+ *num_widths = *num_chars = 256; /* Assuming access to glyph_usage by character codes */
+ break;
case ft_CID_encrypted:
- *num_widths = *num_chars = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
- break;
+ *num_widths = *num_chars = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
+ break;
case ft_CID_TrueType:
- *num_widths = *num_chars = ((gs_font_cid2 *)font)->cidata.common.CIDCount;
- break;
+ *num_widths = *num_chars = ((gs_font_cid2 *)font)->cidata.common.CIDCount;
+ break;
default:
- *num_widths = *num_chars = 65536; /* No chance to determine, use max. */
+ *num_widths = *num_chars = 65536; /* No chance to determine, use max. */
}
}
-static int
+static int
alloc_font_cache_elem_arrays(gx_device_pdf *pdev, pdf_font_cache_elem_t *e,
- gs_font *font)
+ gs_font *font)
{
int num_widths, num_chars, len;
font_cache_elem_array_sizes(pdev, font, &num_widths, &num_chars);
len = (num_chars + 7) / 8;
- e->glyph_usage = gs_alloc_bytes(pdev->pdf_memory,
- len, "alloc_font_cache_elem_arrays");
+ e->glyph_usage = gs_alloc_bytes(pdev->pdf_memory,
+ len, "alloc_font_cache_elem_arrays");
- e->real_widths = (num_widths > 0 ? (double *)gs_alloc_bytes(pdev->pdf_memory,
- num_widths * sizeof(*e->real_widths) *
- (font->FontType == ft_user_defined ? 2 : 1),
- "alloc_font_cache_elem_arrays") : NULL);
+ e->real_widths = (num_widths > 0 ? (double *)gs_alloc_bytes(pdev->pdf_memory,
+ num_widths * sizeof(*e->real_widths) *
+ (font->FontType == ft_user_defined ? 2 : 1),
+ "alloc_font_cache_elem_arrays") : NULL);
if (e->glyph_usage == NULL || (num_widths !=0 && e->real_widths == NULL)) {
- gs_free_object(pdev->pdf_memory, e->glyph_usage,
- "pdf_attach_font_resource");
- gs_free_object(pdev->pdf_memory, e->real_widths,
- "alloc_font_cache_elem_arrays");
- return_error(gs_error_VMerror);
+ gs_free_object(pdev->pdf_memory, e->glyph_usage,
+ "pdf_attach_font_resource");
+ gs_free_object(pdev->pdf_memory, e->real_widths,
+ "alloc_font_cache_elem_arrays");
+ return_error(gs_error_VMerror);
}
e->num_chars = num_chars;
e->num_widths = num_widths;
memset(e->glyph_usage, 0, len);
if (e->real_widths != NULL)
- memset(e->real_widths, 0, num_widths * sizeof(*e->real_widths));
+ memset(e->real_widths, 0, num_widths * sizeof(*e->real_widths));
return 0;
}
@@ -635,42 +635,41 @@ pdf_free_font_cache(gx_device_pdf *pdev)
return 0;
}
-
/*
* Retrive font resource attached to a font,
* allocating glyph_usage and real_widths on request.
*/
int
-pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **pdfont, byte **glyph_usage,
- double **real_widths, int *num_chars, int *num_widths)
+pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,
+ pdf_font_resource_t **pdfont, byte **glyph_usage,
+ double **real_widths, int *num_chars, int *num_widths)
{
pdf_font_cache_elem_t **e = pdf_locate_font_cache_elem(pdev, font);
if (e != NULL && (((*e)->glyph_usage == NULL && glyph_usage !=NULL) ||
- ((*e)->real_widths == NULL && real_widths !=NULL))) {
- int code = alloc_font_cache_elem_arrays(pdev, *e, font);
+ ((*e)->real_widths == NULL && real_widths !=NULL))) {
+ int code = alloc_font_cache_elem_arrays(pdev, *e, font);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
*pdfont = (e == NULL ? NULL : (*e)->pdfont);
if (glyph_usage != NULL)
- *glyph_usage = (e == NULL ? NULL : (*e)->glyph_usage);
+ *glyph_usage = (e == NULL ? NULL : (*e)->glyph_usage);
if (real_widths != NULL)
- *real_widths = (e == NULL ? NULL : (*e)->real_widths);
+ *real_widths = (e == NULL ? NULL : (*e)->real_widths);
if (num_chars != NULL)
- *num_chars = (e == NULL ? 0 : (*e)->num_chars);
+ *num_chars = (e == NULL ? 0 : (*e)->num_chars);
if (num_widths != NULL)
- *num_widths = (e == NULL ? 0 : (*e)->num_widths);
+ *num_widths = (e == NULL ? 0 : (*e)->num_widths);
return 0;
}
-static int
+static int
pdf_notify_remove_font(void *proc_data, void *event_data)
{ /* gs_font_finalize passes event_data == NULL, so check it here. */
if (event_data == NULL)
- pdf_remove_font_cache_elem((pdf_font_cache_elem_t *)proc_data);
+ pdf_remove_font_cache_elem((pdf_font_cache_elem_t *)proc_data);
return 0;
}
@@ -678,42 +677,42 @@ pdf_notify_remove_font(void *proc_data, void *event_data)
* Attach font resource to a font.
*/
int
-pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t *pdfont)
+pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font,
+ pdf_font_resource_t *pdfont)
{
int num_chars, num_widths, len;
pdf_font_cache_elem_t *e, **pe = pdf_locate_font_cache_elem(pdev, font);
if (pdfont->FontType != font->FontType)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
font_cache_elem_array_sizes(pdev, font, &num_widths, &num_chars);
len = (num_chars + 7) / 8;
if (pe != NULL) {
- e = *pe;
- if (e->pdfont == pdfont)
- return 0;
- e->pdfont = pdfont;
- /* Reset glyph cache because e->pdfont had changed. */
- memset(e->glyph_usage, 0, len);
- memset(e->real_widths, 0, num_widths * sizeof(*e->real_widths));
+ e = *pe;
+ if (e->pdfont == pdfont)
+ return 0;
+ e->pdfont = pdfont;
+ /* Reset glyph cache because e->pdfont had changed. */
+ memset(e->glyph_usage, 0, len);
+ memset(e->real_widths, 0, num_widths * sizeof(*e->real_widths));
} else {
- int code;
- e = (pdf_font_cache_elem_t *)gs_alloc_struct(pdev->pdf_memory,
- pdf_font_cache_elem_t, &st_pdf_font_cache_elem,
- "pdf_attach_font_resource");
- if (e == NULL)
- return_error(gs_error_VMerror);
- e->pdfont = pdfont;
- e->font_id = pdf_font_cache_elem_id(font);
- e->num_chars = 0;
- e->glyph_usage = NULL;
- e->real_widths = NULL;
- e->pdev = pdev;
- e->next = pdev->font_cache;
- pdev->font_cache = e;
- code = gs_notify_register(&font->notify_list, pdf_notify_remove_font, e);
- if (code < 0)
- return code;
+ int code;
+ e = (pdf_font_cache_elem_t *)gs_alloc_struct(pdev->pdf_memory,
+ pdf_font_cache_elem_t, &st_pdf_font_cache_elem,
+ "pdf_attach_font_resource");
+ if (e == NULL)
+ return_error(gs_error_VMerror);
+ e->pdfont = pdfont;
+ e->font_id = pdf_font_cache_elem_id(font);
+ e->num_chars = 0;
+ e->glyph_usage = NULL;
+ e->real_widths = NULL;
+ e->pdev = pdev;
+ e->next = pdev->font_cache;
+ pdev->font_cache = e;
+ code = gs_notify_register(&font->notify_list, pdf_notify_remove_font, e);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -732,14 +731,14 @@ pdf_font_orig_matrix(const gs_font *font, gs_matrix *pmat)
case ft_composite: /* subfonts have their own FontMatrix */
case ft_TrueType:
case ft_CID_TrueType:
- /* The TrueType FontMatrix is 1 unit per em, which is what we want. */
- gs_make_identity(pmat);
- return 0;
+ /* The TrueType FontMatrix is 1 unit per em, which is what we want. */
+ gs_make_identity(pmat);
+ return 0;
case ft_encrypted:
case ft_encrypted2:
case ft_CID_encrypted:
case ft_user_defined:
- /*
+ /*
* Type 1 fonts are supposed to use a standard FontMatrix of
* [0.001 0 0 0.001 0 0], with a 1000-unit cell. However,
* Windows NT 4.0 creates Type 1 fonts, apparently derived from
@@ -757,45 +756,45 @@ pdf_font_orig_matrix(const gs_font *font, gs_matrix *pmat)
* must still be set to 0.001, not 0.012 .
*
* The old code used a heuristic to detect and correct for this here.
- * Unfortunately it doesn't work properly when it meets a font
- * with FontMatrix like this :
- *
- * /FontMatrix [1 2288 div 0 0 1 2288 div 0 0 ] def
- *
- * (the bug 686970). Also comparefiles\455690.pdf appears to
- * have similar problem. Therefore we added a support to lib/gs_fonts.ps,
- * src/zbfont.c, src/gsfont.c that provides an acces to the original
- * font via a special key OrigFont added to the font dictionary while definefont.
- * Now we work through this access with PS interpreter,
- * but keep the old heuristic for other clients.
- */
- {
- const gs_font *base_font = font;
-
- while (base_font->base != base_font)
- base_font = base_font->base;
- if (font->FontType == ft_user_defined)
- *pmat = base_font->FontMatrix;
- else if (base_font->orig_FontMatrix.xx != 0 || base_font->orig_FontMatrix.xy != 0 ||
- base_font->orig_FontMatrix.yx != 0 || base_font->orig_FontMatrix.yy != 0)
- *pmat = base_font->orig_FontMatrix;
- else {
- /* Must not happen with PS interpreter.
- Provide a hewuristic for other clients.
- */
- if (base_font->FontMatrix.xx == 1.0/2048 &&
- base_font->FontMatrix.xy == 0 &&
- base_font->FontMatrix.yx == 0 &&
- any_abs(base_font->FontMatrix.yy) == 1.0/2048
- )
- *pmat = base_font->FontMatrix;
- else
- gs_make_scaling(0.001, 0.001, pmat);
- }
- }
- return 0;
+ * Unfortunately it doesn't work properly when it meets a font
+ * with FontMatrix like this :
+ *
+ * /FontMatrix [1 2288 div 0 0 1 2288 div 0 0 ] def
+ *
+ * (the bug 686970). Also comparefiles\455690.pdf appears to
+ * have similar problem. Therefore we added a support to lib/gs_fonts.ps,
+ * src/zbfont.c, src/gsfont.c that provides an acces to the original
+ * font via a special key OrigFont added to the font dictionary while definefont.
+ * Now we work through this access with PS interpreter,
+ * but keep the old heuristic for other clients.
+ */
+ {
+ const gs_font *base_font = font;
+
+ while (base_font->base != base_font)
+ base_font = base_font->base;
+ if (font->FontType == ft_user_defined)
+ *pmat = base_font->FontMatrix;
+ else if (base_font->orig_FontMatrix.xx != 0 || base_font->orig_FontMatrix.xy != 0 ||
+ base_font->orig_FontMatrix.yx != 0 || base_font->orig_FontMatrix.yy != 0)
+ *pmat = base_font->orig_FontMatrix;
+ else {
+ /* Must not happen with PS interpreter.
+ Provide a hewuristic for other clients.
+ */
+ if (base_font->FontMatrix.xx == 1.0/2048 &&
+ base_font->FontMatrix.xy == 0 &&
+ base_font->FontMatrix.yx == 0 &&
+ any_abs(base_font->FontMatrix.yy) == 1.0/2048
+ )
+ *pmat = base_font->FontMatrix;
+ else
+ gs_make_scaling(0.001, 0.001, pmat);
+ }
+ }
+ return 0;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
}
@@ -809,54 +808,53 @@ glyph_orig_matrix(const gs_font *font, gs_glyph cid, gs_matrix *pmat)
{
int code = pdf_font_orig_matrix(font, pmat);
if (code >= 0) {
- if (font->FontType == ft_CID_encrypted) {
- int fidx;
-
- if (cid < GS_MIN_CID_GLYPH)
- cid = GS_MIN_CID_GLYPH;
- code = ((gs_font_cid0 *)font)->cidata.glyph_data((gs_font_base *)font,
- cid, NULL, &fidx);
- if (code < 0) {
- code = ((gs_font_cid0 *)font)->cidata.glyph_data((gs_font_base *)font,
- (gs_glyph)GS_MIN_CID_GLYPH, NULL, &fidx);
- }
- if (code >= 0) {
- gs_matrix_multiply(&(gs_cid0_indexed_font(font, fidx)->FontMatrix),
- pmat, pmat);
- }
- }
+ if (font->FontType == ft_CID_encrypted) {
+ int fidx;
+
+ if (cid < GS_MIN_CID_GLYPH)
+ cid = GS_MIN_CID_GLYPH;
+ code = ((gs_font_cid0 *)font)->cidata.glyph_data((gs_font_base *)font,
+ cid, NULL, &fidx);
+ if (code < 0) {
+ code = ((gs_font_cid0 *)font)->cidata.glyph_data((gs_font_base *)font,
+ (gs_glyph)GS_MIN_CID_GLYPH, NULL, &fidx);
+ }
+ if (code >= 0) {
+ gs_matrix_multiply(&(gs_cid0_indexed_font(font, fidx)->FontMatrix),
+ pmat, pmat);
+ }
+ }
}
return code;
}
-
-/*
- * Check the Encoding compatibility
+/*
+ * Check the Encoding compatibility
*/
bool
-pdf_check_encoding_compatibility(const pdf_font_resource_t *pdfont,
- const pdf_char_glyph_pair_t *pairs, int num_chars)
+pdf_check_encoding_compatibility(const pdf_font_resource_t *pdfont,
+ const pdf_char_glyph_pair_t *pairs, int num_chars)
{
int i;
for (i = 0; i < num_chars; ++i) {
- gs_char ch = pairs[i].chr;
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ gs_char ch = pairs[i].chr;
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- if (pairs[i].glyph == pet->glyph)
- continue;
- if (pet->glyph != GS_NO_GLYPH) /* encoding conflict */
- return false;
+ if (pairs[i].glyph == pet->glyph)
+ continue;
+ if (pet->glyph != GS_NO_GLYPH) /* encoding conflict */
+ return false;
}
return true;
}
-/*
+/*
* Check whether the Encoding has listed glyphs.
*/
static bool
-pdf_check_encoding_has_glyphs(const pdf_font_resource_t *pdfont,
- const pdf_char_glyph_pair_t *pairs, int num_chars)
+pdf_check_encoding_has_glyphs(const pdf_font_resource_t *pdfont,
+ const pdf_char_glyph_pair_t *pairs, int num_chars)
{
/* This function is pretty slow, but we can't find a better algorithm.
It works for the case of glyphshow with no proper encoding,
@@ -865,70 +863,69 @@ pdf_check_encoding_has_glyphs(const pdf_font_resource_t *pdfont,
int i, ch;
for (i = 0; i < num_chars; ++i) {
- for (ch = 0; ch < 256; ch++) {
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ for (ch = 0; ch < 256; ch++) {
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- if (pairs[i].glyph == pet->glyph)
- return true;
- }
+ if (pairs[i].glyph == pet->glyph)
+ return true;
+ }
}
return false;
}
-
/*
* Check font resource for encoding compatibility.
*/
static bool
pdf_is_compatible_encoding(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
- gs_font *font, const pdf_char_glyph_pair_t *pairs, int num_chars)
-{
+ gs_font *font, const pdf_char_glyph_pair_t *pairs, int num_chars)
+{
/*
* This crude version of the code ignores
* the possibility of re-encoding characters.
*/
switch (pdfont->FontType) {
case ft_composite:
- { /*
- * We assume that source document don't redefine CMap
- * resources and that incremental CMaps do not exist.
- * Therefore we don't maintain stable CMap copies,
- * but just compare CMap names for equality.
- * A better implementation should compare the chars->glyphs
- * translation against the stable copy of CMap,
- * which to be handled with PDF CMap resource.
- */
- gs_font_type0 *pfont = (gs_font_type0 *)font;
-
- if (pfont->data.FMapType == fmap_CMap) {
- const gs_cmap_t *pcmap = pfont->data.CMap;
- const gs_const_string *s0 = &pdfont->u.type0.CMapName;
- const gs_const_string *s1 = &pcmap->CMapName;
-
- return (s0->size == s1->size &&
- !memcmp(s0->data, s1->data, s0->size));
- }
- }
- return false;
+ { /*
+ * We assume that source document don't redefine CMap
+ * resources and that incremental CMaps do not exist.
+ * Therefore we don't maintain stable CMap copies,
+ * but just compare CMap names for equality.
+ * A better implementation should compare the chars->glyphs
+ * translation against the stable copy of CMap,
+ * which to be handled with PDF CMap resource.
+ */
+ gs_font_type0 *pfont = (gs_font_type0 *)font;
+
+ if (pfont->data.FMapType == fmap_CMap) {
+ const gs_cmap_t *pcmap = pfont->data.CMap;
+ const gs_const_string *s0 = &pdfont->u.type0.CMapName;
+ const gs_const_string *s1 = &pcmap->CMapName;
+
+ return (s0->size == s1->size &&
+ !memcmp(s0->data, s1->data, s0->size));
+ }
+ }
+ return false;
case ft_user_defined:
- if (pdfont->u.simple.Encoding == NULL)
- return false; /* Not sure. Happens with 020-01.ps . */
- /* fall through */
+ if (pdfont->u.simple.Encoding == NULL)
+ return false; /* Not sure. Happens with 020-01.ps . */
+ /* fall through */
case ft_encrypted:
case ft_encrypted2:
case ft_TrueType:
- return pdf_check_encoding_compatibility(pdfont, pairs, num_chars);
+ return pdf_check_encoding_compatibility(pdfont, pairs, num_chars);
case ft_CID_encrypted:
case ft_CID_TrueType:
- {
- gs_font *font1 = (gs_font *)pdf_font_resource_font(pdfont, false);
+ {
+ gs_font *font1 = (gs_font *)pdf_font_resource_font(pdfont, false);
- return gs_is_CIDSystemInfo_compatible(
- gs_font_cid_system_info(font),
- gs_font_cid_system_info(font1));
- }
+ return gs_is_CIDSystemInfo_compatible(
+ gs_font_cid_system_info(font),
+ gs_font_cid_system_info(font1));
+ }
default:
- return false;
+ return false;
}
}
@@ -937,8 +934,8 @@ pdf_is_compatible_encoding(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
*/
static bool
pdf_font_has_glyphs(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
- gs_font *font, const pdf_char_glyph_pair_t *pairs, int num_chars)
-{
+ gs_font *font, const pdf_char_glyph_pair_t *pairs, int num_chars)
+{
/*
* This crude version of the code ignores
* the possibility of re-encoding characters.
@@ -946,146 +943,144 @@ pdf_font_has_glyphs(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
switch (pdfont->FontType) {
case ft_composite:
case ft_user_defined:
- /* Unused case. */
- return false;
+ /* Unused case. */
+ return false;
case ft_encrypted:
case ft_encrypted2:
case ft_TrueType:
- return pdf_check_encoding_has_glyphs(pdfont, pairs, num_chars);
+ return pdf_check_encoding_has_glyphs(pdfont, pairs, num_chars);
case ft_CID_encrypted:
case ft_CID_TrueType:
- /* Unused case. */
- return false;
+ /* Unused case. */
+ return false;
default:
- return false;
+ return false;
}
}
-
-/*
- * Find a font resource compatible with a given font.
+/*
+ * Find a font resource compatible with a given font.
*/
static int
pdf_find_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_resource_type_t type,
- pdf_font_resource_t **ppdfont,
- pdf_char_glyph_pairs_t *cgp,
- bool compatible_encoding)
+ pdf_resource_type_t type,
+ pdf_font_resource_t **ppdfont,
+ pdf_char_glyph_pairs_t *cgp,
+ bool compatible_encoding)
{
pdf_resource_t **pchain = pdev->resources[type].chains;
pdf_resource_t *pres;
int i;
-
+
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next) {
- pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
- const gs_font_base *cfont;
- gs_font *ofont = font;
- int code;
-
- if (font->FontType != pdfont->FontType)
- continue;
- if (pdfont->FontType == ft_composite) {
- gs_font_type0 *font0 = (gs_font_type0 *)font;
-
- ofont = font0->data.FDepVector[0]; /* See pdf_make_font_resource. */
- cfont = pdf_font_resource_font(pdfont->u.type0.DescendantFont, false);
- if (font0->data.CMap->WMode != pdfont->u.type0.WMode)
- continue;
- } else
- cfont = pdf_font_resource_font(pdfont, false);
- if (!pdf_is_CID_font(ofont) &&
- (compatible_encoding
- ? !pdf_is_compatible_encoding(pdev, pdfont, font, cgp->s, cgp->num_all_chars)
- : !pdf_font_has_glyphs(pdev, pdfont, font, cgp->s, cgp->num_all_chars)))
- continue;
- if (cfont == 0)
- continue;
- code = gs_copied_can_copy_glyphs((const gs_font *)cfont, ofont,
- &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
- sizeof(pdf_char_glyph_pair_t), true);
- if (code == gs_error_unregistered) /* Debug purpose only. */
- return code;
- if(code > 0) {
- *ppdfont = pdfont;
- return 1;
- }
- }
+ for (pres = pchain[i]; pres != 0; pres = pres->next) {
+ pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
+ const gs_font_base *cfont;
+ gs_font *ofont = font;
+ int code;
+
+ if (font->FontType != pdfont->FontType)
+ continue;
+ if (pdfont->FontType == ft_composite) {
+ gs_font_type0 *font0 = (gs_font_type0 *)font;
+
+ ofont = font0->data.FDepVector[0]; /* See pdf_make_font_resource. */
+ cfont = pdf_font_resource_font(pdfont->u.type0.DescendantFont, false);
+ if (font0->data.CMap->WMode != pdfont->u.type0.WMode)
+ continue;
+ } else
+ cfont = pdf_font_resource_font(pdfont, false);
+ if (!pdf_is_CID_font(ofont) &&
+ (compatible_encoding
+ ? !pdf_is_compatible_encoding(pdev, pdfont, font, cgp->s, cgp->num_all_chars)
+ : !pdf_font_has_glyphs(pdev, pdfont, font, cgp->s, cgp->num_all_chars)))
+ continue;
+ if (cfont == 0)
+ continue;
+ code = gs_copied_can_copy_glyphs((const gs_font *)cfont, ofont,
+ &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
+ sizeof(pdf_char_glyph_pair_t), true);
+ if (code == gs_error_unregistered) /* Debug purpose only. */
+ return code;
+ if(code > 0) {
+ *ppdfont = pdfont;
+ return 1;
+ }
+ }
}
return 0;
}
-/*
- * Find a type0 font resource for a gived descendent name and CMap name.
+/*
+ * Find a type0 font resource for a gived descendent name and CMap name.
*/
static int
-pdf_find_type0_font_resource(gx_device_pdf *pdev, const pdf_font_resource_t *pdsubf,
- const gs_const_string *CMapName, uint font_index, pdf_font_resource_t **ppdfont)
+pdf_find_type0_font_resource(gx_device_pdf *pdev, const pdf_font_resource_t *pdsubf,
+ const gs_const_string *CMapName, uint font_index, pdf_font_resource_t **ppdfont)
{
pdf_resource_t **pchain = pdev->resources[resourceFont].chains;
pdf_resource_t *pres;
int i;
-
+
for (i = 0; i < NUM_RESOURCE_CHAINS; i++) {
- for (pres = pchain[i]; pres != 0; pres = pres->next) {
- pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
-
- if (pdfont->FontType != ft_composite)
- continue;
- if (pdfont->u.type0.DescendantFont != pdsubf)
- continue;
- if (pdfont->u.type0.font_index != font_index)
- continue;
- if (pdfont->BaseFont.size != pdsubf->BaseFont.size + CMapName->size + 1)
- continue;
- if (memcmp(pdfont->BaseFont.data + pdsubf->BaseFont.size + 1,
- CMapName->data, CMapName->size))
- continue;
- *ppdfont = pdfont;
- return 1;
- }
+ for (pres = pchain[i]; pres != 0; pres = pres->next) {
+ pdf_font_resource_t *pdfont = (pdf_font_resource_t *)pres;
+
+ if (pdfont->FontType != ft_composite)
+ continue;
+ if (pdfont->u.type0.DescendantFont != pdsubf)
+ continue;
+ if (pdfont->u.type0.font_index != font_index)
+ continue;
+ if (pdfont->BaseFont.size != pdsubf->BaseFont.size + CMapName->size + 1)
+ continue;
+ if (memcmp(pdfont->BaseFont.data + pdsubf->BaseFont.size + 1,
+ CMapName->data, CMapName->size))
+ continue;
+ *ppdfont = pdfont;
+ return 1;
+ }
}
return 0;
}
-
static int pdf_make_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **ppdfont,
- pdf_char_glyph_pairs_t *cgp);
+ pdf_font_resource_t **ppdfont,
+ pdf_char_glyph_pairs_t *cgp);
/*
* Create or find a CID font resource object for a glyph set.
*/
int
-pdf_obtain_cidfont_resource(gx_device_pdf *pdev, gs_font *subfont,
- pdf_font_resource_t **ppdsubf,
- pdf_char_glyph_pairs_t *cgp)
+pdf_obtain_cidfont_resource(gx_device_pdf *pdev, gs_font *subfont,
+ pdf_font_resource_t **ppdsubf,
+ pdf_char_glyph_pairs_t *cgp)
{
int code = 0;
code = pdf_attached_font_resource(pdev, subfont, ppdsubf, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
if (*ppdsubf != NULL) {
- const gs_font_base *cfont = pdf_font_resource_font(*ppdsubf, false);
+ const gs_font_base *cfont = pdf_font_resource_font(*ppdsubf, false);
- code = gs_copied_can_copy_glyphs((const gs_font *)cfont, subfont,
- &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
- sizeof(pdf_char_glyph_pair_t), true);
- if (code > 0)
- return 0;
- if (code < 0)
- return code;
- *ppdsubf = NULL;
+ code = gs_copied_can_copy_glyphs((const gs_font *)cfont, subfont,
+ &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
+ sizeof(pdf_char_glyph_pair_t), true);
+ if (code > 0)
+ return 0;
+ if (code < 0)
+ return code;
+ *ppdsubf = NULL;
}
code = pdf_find_font_resource(pdev, subfont,
- resourceCIDFont, ppdsubf, cgp, true);
+ resourceCIDFont, ppdsubf, cgp, true);
if (code < 0)
- return code;
+ return code;
if (*ppdsubf == NULL) {
- code = pdf_make_font_resource(pdev, subfont, ppdsubf, cgp);
- if (code < 0)
- return code;
+ code = pdf_make_font_resource(pdev, subfont, ppdsubf, cgp);
+ if (code < 0)
+ return code;
}
return pdf_attach_font_resource(pdev, subfont, *ppdsubf);
}
@@ -1093,20 +1088,20 @@ pdf_obtain_cidfont_resource(gx_device_pdf *pdev, gs_font *subfont,
/*
* Refine index of BaseEncoding.
*/
-static int
+static int
pdf_refine_encoding_index(const gx_device_pdf *pdev, int index, bool is_standard)
{
if (pdev->ForOPDFRead) {
- /*
- * Allow Postscript encodings only.
- */
- switch (index) {
+ /*
+ * Allow Postscript encodings only.
+ */
+ switch (index) {
- case ENCODING_INDEX_STANDARD: return index;
- case ENCODING_INDEX_ISOLATIN1: return index;
- default:
- return ENCODING_INDEX_STANDARD;
- }
+ case ENCODING_INDEX_STANDARD: return index;
+ case ENCODING_INDEX_ISOLATIN1: return index;
+ default:
+ return ENCODING_INDEX_STANDARD;
+ }
}
/*
* Per the PDF 1.3 documentation, there are only 3 BaseEncoding
@@ -1116,13 +1111,13 @@ pdf_refine_encoding_index(const gx_device_pdf *pdev, int index, bool is_standard
case ENCODING_INDEX_WINANSI:
case ENCODING_INDEX_MACROMAN:
case ENCODING_INDEX_MACEXPERT:
- return index;
+ return index;
case ENCODING_INDEX_STANDARD:
- if (is_standard)
- return index;
- /* Falls through. */
+ if (is_standard)
+ return index;
+ /* Falls through. */
default:
- return ENCODING_INDEX_WINANSI;
+ return ENCODING_INDEX_WINANSI;
}
}
@@ -1131,7 +1126,7 @@ pdf_refine_encoding_index(const gx_device_pdf *pdev, int index, bool is_standard
*/
int
pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **ppdfont)
+ pdf_font_resource_t **ppdfont)
{
const gs_font_base *bfont = (const gs_font_base *)font;
pdf_font_resource_t *pdfont;
@@ -1140,18 +1135,18 @@ pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
cached = gs_alloc_bytes(pdev->pdf_memory, 256/8, "pdf_make_font3_resource");
if (cached == NULL)
- return_error(gs_error_VMerror);
- code = font_resource_encoded_alloc(pdev, &pdfont, bfont->id,
- ft_user_defined, pdf_write_contents_bitmap);
+ return_error(gs_error_VMerror);
+ code = font_resource_encoded_alloc(pdev, &pdfont, bfont->id,
+ ft_user_defined, pdf_write_contents_bitmap);
if (code < 0) {
- gs_free_object(pdev->pdf_memory, cached, "pdf_make_font3_resource");
- return code;
+ gs_free_object(pdev->pdf_memory, cached, "pdf_make_font3_resource");
+ return code;
}
memset(cached, 0, 256 / 8);
pdfont->mark_glyph = font->dir->ccache.mark_glyph; /* For pdf_font_resource_enum_ptrs. */
pdfont->u.simple.s.type3.bitmap_font = false;
pdfont->u.simple.BaseEncoding = pdf_refine_encoding_index(pdev,
- bfont->nearest_encoding_index, true);
+ bfont->nearest_encoding_index, true);
pdfont->u.simple.s.type3.char_procs = NULL;
pdfont->u.simple.s.type3.cached = cached;
pdfont->u.simple.s.type3.FontBBox.p.x = bfont->FontBBox.p.x;
@@ -1161,22 +1156,22 @@ pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
pdfont->u.simple.s.type3.FontMatrix = bfont->FontMatrix;
pdfont->u.simple.s.type3.Resources = cos_dict_alloc(pdev, "pdf_make_font3_resource");
if (pdfont->u.simple.s.type3.Resources == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Adobe viewers have a precision problem with small font matrices : */
/* Don't perform this test if all entries are 0, leads to infinite loop! */
if (pdfont->u.simple.s.type3.FontMatrix.xx != 0.0 ||
- pdfont->u.simple.s.type3.FontMatrix.xy != 0.0 ||
- pdfont->u.simple.s.type3.FontMatrix.yx != 0.0 ||
- pdfont->u.simple.s.type3.FontMatrix.yy != 0.0) {
- while (any_abs(pdfont->u.simple.s.type3.FontMatrix.xx) < 0.001 &&
- any_abs(pdfont->u.simple.s.type3.FontMatrix.xy) < 0.001 &&
- any_abs(pdfont->u.simple.s.type3.FontMatrix.yx) < 0.001 &&
- any_abs(pdfont->u.simple.s.type3.FontMatrix.yy) < 0.001) {
- pdfont->u.simple.s.type3.FontMatrix.xx *= 10;
- pdfont->u.simple.s.type3.FontMatrix.xy *= 10;
- pdfont->u.simple.s.type3.FontMatrix.yx *= 10;
- pdfont->u.simple.s.type3.FontMatrix.yy *= 10;
- }
+ pdfont->u.simple.s.type3.FontMatrix.xy != 0.0 ||
+ pdfont->u.simple.s.type3.FontMatrix.yx != 0.0 ||
+ pdfont->u.simple.s.type3.FontMatrix.yy != 0.0) {
+ while (any_abs(pdfont->u.simple.s.type3.FontMatrix.xx) < 0.001 &&
+ any_abs(pdfont->u.simple.s.type3.FontMatrix.xy) < 0.001 &&
+ any_abs(pdfont->u.simple.s.type3.FontMatrix.yx) < 0.001 &&
+ any_abs(pdfont->u.simple.s.type3.FontMatrix.yy) < 0.001) {
+ pdfont->u.simple.s.type3.FontMatrix.xx *= 10;
+ pdfont->u.simple.s.type3.FontMatrix.xy *= 10;
+ pdfont->u.simple.s.type3.FontMatrix.yx *= 10;
+ pdfont->u.simple.s.type3.FontMatrix.yy *= 10;
+ }
}
*ppdfont = pdfont;
return 0;
@@ -1190,177 +1185,177 @@ pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
*/
static int
pdf_make_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **ppdfont,
- pdf_char_glyph_pairs_t *cgp)
+ pdf_font_resource_t **ppdfont,
+ pdf_char_glyph_pairs_t *cgp)
{
int index = -1;
int BaseEncoding = ENCODING_INDEX_UNKNOWN;
pdf_font_embed_t embed;
pdf_font_descriptor_t *pfd = 0;
int (*font_alloc)(gx_device_pdf *, pdf_font_resource_t **,
- gs_id, pdf_font_descriptor_t *);
+ gs_id, pdf_font_descriptor_t *);
gs_font *base_font = font; /* A roudiment from old code. Keep it for a while. */
pdf_font_resource_t *pdfont;
pdf_standard_font_t *const psfa =
- pdev->text->outline_fonts->standard_fonts;
+ pdev->text->outline_fonts->standard_fonts;
int code = 0;
if (pdev->version < psdf_version_level2_with_TT) {
- switch(font->FontType) {
- case ft_TrueType:
- case ft_CID_TrueType:
- return_error(gs_error_undefined);
- default:
- break;
- }
+ switch(font->FontType) {
+ case ft_TrueType:
+ case ft_CID_TrueType:
+ return_error(gs_error_undefined);
+ default:
+ break;
+ }
}
if (pdev->ForOPDFRead && !pdev->HaveCIDSystem) {
- switch(font->FontType) {
- case ft_CID_encrypted:
- case ft_CID_TrueType:
- return_error(gs_error_undefined);
- default:
- break;
- }
+ switch(font->FontType) {
+ case ft_CID_encrypted:
+ case ft_CID_TrueType:
+ return_error(gs_error_undefined);
+ default:
+ break;
+ }
}
if (!pdev->HaveCFF) {
- if (font->FontType == ft_encrypted2)
- return_error(gs_error_undefined);
+ if (font->FontType == ft_encrypted2)
+ return_error(gs_error_undefined);
}
embed = pdf_font_embed_status(pdev, base_font, &index, cgp->s, cgp->num_all_chars);
if (pdev->CompatibilityLevel < 1.3)
- if (embed != FONT_EMBED_NO && font->FontType == ft_CID_TrueType)
- return_error(gs_error_rangecheck);
+ if (embed != FONT_EMBED_NO && font->FontType == ft_CID_TrueType)
+ return_error(gs_error_rangecheck);
if (embed == FONT_EMBED_STANDARD) {
- pdf_standard_font_t *psf = &psfa[index];
-
- if (psf->pdfont == NULL ||
- !pdf_is_compatible_encoding(pdev, psf->pdfont, font,
- cgp->s, cgp->num_all_chars)) {
- code = pdf_font_std_alloc(pdev, ppdfont, (psf->pdfont == NULL), base_font->id,
- (gs_font_base *)base_font, index);
- if (code < 0)
- return code;
- if (psf->pdfont == NULL)
- psf->pdfont = *ppdfont;
- (*ppdfont)->u.simple.BaseEncoding = pdf_refine_encoding_index(pdev,
- ((const gs_font_base *)base_font)->nearest_encoding_index, true);
- code = 1;
- } else
- *ppdfont = psf->pdfont;
- return code;
- }
+ pdf_standard_font_t *psf = &psfa[index];
+
+ if (psf->pdfont == NULL ||
+ !pdf_is_compatible_encoding(pdev, psf->pdfont, font,
+ cgp->s, cgp->num_all_chars)) {
+ code = pdf_font_std_alloc(pdev, ppdfont, (psf->pdfont == NULL), base_font->id,
+ (gs_font_base *)base_font, index);
+ if (code < 0)
+ return code;
+ if (psf->pdfont == NULL)
+ psf->pdfont = *ppdfont;
+ (*ppdfont)->u.simple.BaseEncoding = pdf_refine_encoding_index(pdev,
+ ((const gs_font_base *)base_font)->nearest_encoding_index, true);
+ code = 1;
+ } else
+ *ppdfont = psf->pdfont;
+ return code;
+ }
switch (font->FontType) {
case ft_CID_encrypted:
case ft_CID_TrueType:
- font_alloc = pdf_font_cidfont_alloc;
- break;
+ font_alloc = pdf_font_cidfont_alloc;
+ break;
case ft_encrypted:
case ft_encrypted2:
case ft_TrueType:
- font_alloc = pdf_font_simple_alloc;
- break;
+ font_alloc = pdf_font_simple_alloc;
+ break;
case ft_user_defined:
- code = pdf_make_font3_resource(pdev, font, ppdfont);
- if (code < 0)
- return code;
- return 1;
+ code = pdf_make_font3_resource(pdev, font, ppdfont);
+ if (code < 0)
+ return code;
+ return 1;
default:
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
}
/* Create an appropriate font resource and descriptor. */
if (embed == FONT_EMBED_YES) {
- /*
- * HACK: Acrobat Reader 3 has a bug that makes cmap formats 4
- * and 6 not work in embedded TrueType fonts. Consequently, it
- * can only handle embedded TrueType fonts if all the glyphs
- * referenced by the Encoding have numbers 0-255. Check for
- * this now.
- */
- if (font->FontType == ft_TrueType &&
- pdev->CompatibilityLevel <= 1.2 && !pdev->ForOPDFRead
- ) {
- int i;
-
- for (i = 0; i <= 0xff; ++i) {
- gs_glyph glyph =
- font->procs.encode_char(font, (gs_char)i,
- GLYPH_SPACE_INDEX);
-
- if (glyph == GS_NO_GLYPH ||
- (glyph >= GS_MIN_GLYPH_INDEX &&
- glyph <= GS_MIN_GLYPH_INDEX + 0xff)
- )
- continue;
- /* Can't embed, punt. */
- return_error(gs_error_rangecheck);
- }
- }
+ /*
+ * HACK: Acrobat Reader 3 has a bug that makes cmap formats 4
+ * and 6 not work in embedded TrueType fonts. Consequently, it
+ * can only handle embedded TrueType fonts if all the glyphs
+ * referenced by the Encoding have numbers 0-255. Check for
+ * this now.
+ */
+ if (font->FontType == ft_TrueType &&
+ pdev->CompatibilityLevel <= 1.2 && !pdev->ForOPDFRead
+ ) {
+ int i;
+
+ for (i = 0; i <= 0xff; ++i) {
+ gs_glyph glyph =
+ font->procs.encode_char(font, (gs_char)i,
+ GLYPH_SPACE_INDEX);
+
+ if (glyph == GS_NO_GLYPH ||
+ (glyph >= GS_MIN_GLYPH_INDEX &&
+ glyph <= GS_MIN_GLYPH_INDEX + 0xff)
+ )
+ continue;
+ /* Can't embed, punt. */
+ return_error(gs_error_rangecheck);
+ }
+ }
}
if (font->FontType == ft_encrypted || font->FontType == ft_encrypted2
- || (font->FontType == ft_TrueType && pdev->ForOPDFRead)) {
- /* Removed the addition of Encodings to TrueType fonts as we always write
- * these with the Symbolic flag set. The comment below explains why we
- * previously wrote these, but as the comment notes this was incorrect.
- * Removed as it is causing preflight problems, and is specifically
- * disallowed with PDF/A output.
- */
+ || (font->FontType == ft_TrueType && pdev->ForOPDFRead)) {
+ /* Removed the addition of Encodings to TrueType fonts as we always write
+ * these with the Symbolic flag set. The comment below explains why we
+ * previously wrote these, but as the comment notes this was incorrect.
+ * Removed as it is causing preflight problems, and is specifically
+ * disallowed with PDF/A output.
+ */
/*
- * We write True Types with Symbolic flag set.
- * PDF spec says that "symbolic font should not specify Encoding entry"
- * (see section 5.5, the article "Encodings for True Type fonts", paragraph 3).
- * However Acrobat Reader 4,5,6 fail when TT font with no Encoding
- * appears in a document together with a CID font with a non-standard CMap
- * (AR 4 and 5 claim "The encoding (CMap) specified by a font is corrupted."
- * (we read it as "The encoding or CMap specified by a font is corrupted.",
- * and apply the 1st alternative)). We believe that AR is buggy,
- * and therefore we write an Encoding with non-CID True Type fonts.
- * Hopely other viewers can ignore Encoding in such case. Actually in this case
- * an Encoding doesn't add an useful information.
- */
- BaseEncoding = pdf_refine_encoding_index(pdev,
- ((const gs_font_base *)base_font)->nearest_encoding_index, false);
+ * We write True Types with Symbolic flag set.
+ * PDF spec says that "symbolic font should not specify Encoding entry"
+ * (see section 5.5, the article "Encodings for True Type fonts", paragraph 3).
+ * However Acrobat Reader 4,5,6 fail when TT font with no Encoding
+ * appears in a document together with a CID font with a non-standard CMap
+ * (AR 4 and 5 claim "The encoding (CMap) specified by a font is corrupted."
+ * (we read it as "The encoding or CMap specified by a font is corrupted.",
+ * and apply the 1st alternative)). We believe that AR is buggy,
+ * and therefore we write an Encoding with non-CID True Type fonts.
+ * Hopely other viewers can ignore Encoding in such case. Actually in this case
+ * an Encoding doesn't add an useful information.
+ */
+ BaseEncoding = pdf_refine_encoding_index(pdev,
+ ((const gs_font_base *)base_font)->nearest_encoding_index, false);
}
if ((code = pdf_font_descriptor_alloc(pdev, &pfd,
- (gs_font_base *)base_font,
- embed == FONT_EMBED_YES)) < 0 ||
- (code = font_alloc(pdev, &pdfont, base_font->id, pfd)) < 0
- )
- return code;
+ (gs_font_base *)base_font,
+ embed == FONT_EMBED_YES)) < 0 ||
+ (code = font_alloc(pdev, &pdfont, base_font->id, pfd)) < 0
+ )
+ return code;
if (!pdf_is_CID_font(font)) {
- pdfont->u.simple.BaseEncoding = BaseEncoding;
- pdfont->mark_glyph = font->dir->ccache.mark_glyph;
+ pdfont->u.simple.BaseEncoding = BaseEncoding;
+ pdfont->mark_glyph = font->dir->ccache.mark_glyph;
}
if (pdev->PDFA && font->FontType == ft_TrueType) {
- /* The Adobe preflight tool for PDF/A
- checks whether Widht or W include elements
- for all characters in the True Type font.
- Due to that we need to provide a width
- for .notdef glyph.
- (It's a part of the bug 688790).
- */
- gs_font_base *cfont = pdf_font_descriptor_font(pfd, false/*any*/);
- gs_glyph notdef_glyph = copied_get_notdef((const gs_font *)cfont);
- pdf_glyph_widths_t widths;
- double cdevproc_result[10] = {0,0,0,0,0, 0,0,0,0,0};
- double *w, *v, *w0;
-
- if (notdef_glyph != GS_NO_GLYPH) {
- code = pdf_obtain_cidfont_widths_arrays(pdev, pdfont, font->WMode, &w, &w0, &v);
- if (code < 0)
- return code;
- widths.Width.w = 0;
- code = pdf_glyph_widths(pdfont, font->WMode, notdef_glyph,
- font, &widths, cdevproc_result);
- if (code < 0)
- return code;
- w[0] = widths.Width.w;
- pdfont->used[0] |= 0x80;
- }
+ /* The Adobe preflight tool for PDF/A
+ checks whether Widht or W include elements
+ for all characters in the True Type font.
+ Due to that we need to provide a width
+ for .notdef glyph.
+ (It's a part of the bug 688790).
+ */
+ gs_font_base *cfont = pdf_font_descriptor_font(pfd, false/*any*/);
+ gs_glyph notdef_glyph = copied_get_notdef((const gs_font *)cfont);
+ pdf_glyph_widths_t widths;
+ double cdevproc_result[10] = {0,0,0,0,0, 0,0,0,0,0};
+ double *w, *v, *w0;
+
+ if (notdef_glyph != GS_NO_GLYPH) {
+ code = pdf_obtain_cidfont_widths_arrays(pdev, pdfont, font->WMode, &w, &w0, &v);
+ if (code < 0)
+ return code;
+ widths.Width.w = 0;
+ code = pdf_glyph_widths(pdfont, font->WMode, notdef_glyph,
+ font, &widths, cdevproc_result);
+ if (code < 0)
+ return code;
+ w[0] = widths.Width.w;
+ pdfont->used[0] |= 0x80;
+ }
}
*ppdfont = pdfont;
return 1;
@@ -1369,74 +1364,74 @@ pdf_make_font_resource(gx_device_pdf *pdev, gs_font *font,
/*
* Check for simple font.
*/
-bool
+bool
pdf_is_simple_font(gs_font *font)
-{
+{
return (font->FontType == ft_encrypted ||
- font->FontType == ft_encrypted2 ||
- font->FontType == ft_TrueType ||
- font->FontType == ft_user_defined);
+ font->FontType == ft_encrypted2 ||
+ font->FontType == ft_TrueType ||
+ font->FontType == ft_user_defined);
}
/*
* Check for CID font.
*/
-bool
+bool
pdf_is_CID_font(gs_font *font)
-{
+{
return (font->FontType == ft_CID_encrypted ||
- font->FontType == ft_CID_TrueType);
+ font->FontType == ft_CID_TrueType);
}
/*
* Enumerate glyphs for a text.
*/
static int
-pdf_next_char_glyph(gs_text_enum_t *penum, const gs_string *pstr,
- /* const */ gs_font *font, bool font_is_simple,
- gs_char *char_code, gs_char *cid, gs_glyph *glyph)
+pdf_next_char_glyph(gs_text_enum_t *penum, const gs_string *pstr,
+ /* const */ gs_font *font, bool font_is_simple,
+ gs_char *char_code, gs_char *cid, gs_glyph *glyph)
{
int code = font->procs.next_char_glyph(penum, char_code, glyph);
if (code == 2) /* end of string */
- return code;
+ return code;
if (code < 0)
- return code;
+ return code;
if (font_is_simple) {
- *cid = *char_code;
- *glyph = font->procs.encode_char(font, *char_code, GLYPH_SPACE_NAME);
- if (*glyph == GS_NO_GLYPH)
- return 3;
+ *cid = *char_code;
+ *glyph = font->procs.encode_char(font, *char_code, GLYPH_SPACE_NAME);
+ if (*glyph == GS_NO_GLYPH)
+ return 3;
} else {
- if (*glyph < GS_MIN_CID_GLYPH)
- return 3; /* Not sure why, copied from scan_cmap_text. */
- *cid = *glyph - GS_MIN_CID_GLYPH; /* CID */
+ if (*glyph < GS_MIN_CID_GLYPH)
+ return 3; /* Not sure why, copied from scan_cmap_text. */
+ *cid = *glyph - GS_MIN_CID_GLYPH; /* CID */
}
return 0;
}
static void
-store_glyphs(pdf_char_glyph_pairs_t *cgp,
- byte *glyph_usage, int char_cache_size,
- gs_char char_code, gs_char cid, gs_glyph glyph)
+store_glyphs(pdf_char_glyph_pairs_t *cgp,
+ byte *glyph_usage, int char_cache_size,
+ gs_char char_code, gs_char cid, gs_glyph glyph)
{
int j;
for (j = 0; j < cgp->num_all_chars; j++)
- if (cgp->s[j].chr == cid)
- break;
+ if (cgp->s[j].chr == cid)
+ break;
if (j < cgp->num_all_chars)
- return;
+ return;
cgp->s[cgp->num_all_chars].glyph = glyph;
cgp->s[cgp->num_all_chars].chr = char_code;
cgp->num_all_chars++;
if (glyph_usage == 0 || !(glyph_usage[cid / 8] & (0x80 >> (cid & 7)))) {
- cgp->s[cgp->unused_offset + cgp->num_unused_chars].glyph = glyph;
- cgp->s[cgp->unused_offset + cgp->num_unused_chars].chr = char_code;
- cgp->num_unused_chars++;
+ cgp->s[cgp->unused_offset + cgp->num_unused_chars].glyph = glyph;
+ cgp->s[cgp->unused_offset + cgp->num_unused_chars].chr = char_code;
+ cgp->num_unused_chars++;
}
/* We are disliked that gs_copied_can_copy_glyphs can get redundant
- * glyphs, if Encoding specifies several codes for same glyph.
+ * glyphs, if Encoding specifies several codes for same glyph.
* But we need the positional correspondence
* of glyphs to codes for pdf_is_compatible_encoding.
* Redundant glyphs isn't a big payment for it
@@ -1450,10 +1445,10 @@ pdf_new_char_code_in_pdfont(pdf_char_glyph_pairs_t *cgp, gs_glyph glyph, int *la
int j, ch;
for (j = 0; j < cgp->num_all_chars; j++)
- if (cgp->s[j].glyph == glyph)
- break;
+ if (cgp->s[j].glyph == glyph)
+ break;
if (j < cgp->num_all_chars)
- return cgp->s[j].chr;
+ return cgp->s[j].chr;
ch = ++*last_reserved_char;
cgp->s[cgp->num_all_chars].glyph = glyph;
cgp->s[cgp->num_all_chars].chr = ch;
@@ -1465,8 +1460,8 @@ pdf_new_char_code_in_pdfont(pdf_char_glyph_pairs_t *cgp, gs_glyph glyph, int *la
}
static gs_char
-pdf_reserve_char_code_in_pdfont(pdf_font_resource_t *pdfont, pdf_char_glyph_pairs_t *cgp, gs_glyph glyph,
- int *last_reserved_char)
+pdf_reserve_char_code_in_pdfont(pdf_font_resource_t *pdfont, pdf_char_glyph_pairs_t *cgp, gs_glyph glyph,
+ int *last_reserved_char)
{ /* Returns 256 if encoding overflows. */
/* This function is pretty slow, but we can't find a better algorithm.
It works for the case of glyphshow with no proper encoding,
@@ -1475,43 +1470,43 @@ pdf_reserve_char_code_in_pdfont(pdf_font_resource_t *pdfont, pdf_char_glyph_pair
int j, ch;
for (j = 0; j < cgp->num_all_chars; j++)
- if (cgp->s[j].glyph == glyph)
- break;
+ if (cgp->s[j].glyph == glyph)
+ break;
if (j < cgp->num_all_chars)
- return cgp->s[j].chr;
+ return cgp->s[j].chr;
for (ch = 0; ch < 256; ch++) {
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- if (glyph == pet->glyph)
- return ch;
+ if (glyph == pet->glyph)
+ return ch;
}
/* If the font has a known encoding, prefer .notdef codes. */
if (pdfont->u.simple.preferred_encoding_index != -1) {
- const ushort *enc = gs_c_known_encodings[pdfont->u.simple.preferred_encoding_index];
+ const ushort *enc = gs_c_known_encodings[pdfont->u.simple.preferred_encoding_index];
- if (standard_glyph_code_for_notdef == GS_NO_GLYPH)
- standard_glyph_code_for_notdef =
- gs_c_name_glyph((const byte *)".notdef", 7) - gs_c_min_std_encoding_glyph;
- for (ch = *last_reserved_char + 1; ch < 256; ch++) {
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ if (standard_glyph_code_for_notdef == GS_NO_GLYPH)
+ standard_glyph_code_for_notdef =
+ gs_c_name_glyph((const byte *)".notdef", 7) - gs_c_min_std_encoding_glyph;
+ for (ch = *last_reserved_char + 1; ch < 256; ch++) {
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- if (pet->glyph == GS_NO_GLYPH && enc[ch] == standard_glyph_code_for_notdef) {
- *last_reserved_char = ch;
- break;
- }
- }
+ if (pet->glyph == GS_NO_GLYPH && enc[ch] == standard_glyph_code_for_notdef) {
+ *last_reserved_char = ch;
+ break;
+ }
+ }
}
/* Otherwise use any code unused in the font. */
if (ch > 255) {
- ch = *last_reserved_char + 1;
- for (; ch < 255; ch++) {
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ ch = *last_reserved_char + 1;
+ for (; ch < 255; ch++) {
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- if (pet->glyph == GS_NO_GLYPH)
- break;
- }
- *last_reserved_char = ch;
+ if (pet->glyph == GS_NO_GLYPH)
+ break;
+ }
+ *last_reserved_char = ch;
}
cgp->s[cgp->num_all_chars].glyph = glyph;
cgp->s[cgp->num_all_chars].chr = ch;
@@ -1522,18 +1517,17 @@ pdf_reserve_char_code_in_pdfont(pdf_font_resource_t *pdfont, pdf_char_glyph_pair
return ch;
}
-
/* Allocate storage for the glyph set of the text. */
static int
pdf_alloc_text_glyphs_table(gx_device_pdf *pdev, pdf_text_enum_t *penum, const gs_string *pstr)
{
const int go = (pstr != NULL ? pstr->size : penum->text.size);
- const int struct_size = sizeof(pdf_char_glyph_pairs_t) +
- sizeof(pdf_char_glyph_pair_t) * (2 * go - 1);
- pdf_char_glyph_pairs_t *cgp = (pdf_char_glyph_pairs_t *)gs_alloc_bytes(penum->memory,
- struct_size, "pdf_alloc_text_glyphs_table");
+ const int struct_size = sizeof(pdf_char_glyph_pairs_t) +
+ sizeof(pdf_char_glyph_pair_t) * (2 * go - 1);
+ pdf_char_glyph_pairs_t *cgp = (pdf_char_glyph_pairs_t *)gs_alloc_bytes(penum->memory,
+ struct_size, "pdf_alloc_text_glyphs_table");
if (cgp == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
penum->cgp = cgp;
cgp->unused_offset = go;
cgp->num_all_chars = 0;
@@ -1543,8 +1537,8 @@ pdf_alloc_text_glyphs_table(gx_device_pdf *pdev, pdf_text_enum_t *penum, const g
/* Build the glyph set of the text. */
static int
-pdf_make_text_glyphs_table(pdf_text_enum_t *penum, const gs_string *pstr,
- byte *glyph_usage, int char_cache_size)
+pdf_make_text_glyphs_table(pdf_text_enum_t *penum, const gs_string *pstr,
+ byte *glyph_usage, int char_cache_size)
{
gs_text_enum_t scan = *(gs_text_enum_t *)penum;
gs_font *font = (gs_font *)penum->current_font;
@@ -1557,28 +1551,28 @@ pdf_make_text_glyphs_table(pdf_text_enum_t *penum, const gs_string *pstr,
cgp->num_unused_chars = 0;
cgp->num_all_chars = 0;
if (pstr != NULL) {
- scan.text.data.bytes = pstr->data;
- scan.text.size = pstr->size;
- scan.index = 0;
+ scan.text.data.bytes = pstr->data;
+ scan.text.size = pstr->size;
+ scan.index = 0;
/* if TEXT_FROM_CHARS the data was converted to bytes earlier */
if ( scan.text.operation & TEXT_FROM_CHARS )
scan.text.operation = ((scan.text.operation & ~TEXT_FROM_CHARS) | TEXT_FROM_STRING);
}
for (;;) {
- code = pdf_next_char_glyph(&scan, pstr, font, font_is_simple,
- &char_code, &cid, &glyph);
- if (code == 2) /* end of string */
- break;
- if (code == 3) /* no glyph */
- continue;
- if (code < 0)
- return code;
- if (cgp->num_all_chars > cgp->unused_offset)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (glyph_usage != 0 && cid > char_cache_size)
- continue;
- store_glyphs(cgp, glyph_usage, char_cache_size,
- char_code, cid, glyph);
+ code = pdf_next_char_glyph(&scan, pstr, font, font_is_simple,
+ &char_code, &cid, &glyph);
+ if (code == 2) /* end of string */
+ break;
+ if (code == 3) /* no glyph */
+ continue;
+ if (code < 0)
+ return code;
+ if (cgp->num_all_chars > cgp->unused_offset)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (glyph_usage != 0 && cid > char_cache_size)
+ continue;
+ store_glyphs(cgp, glyph_usage, char_cache_size,
+ char_code, cid, glyph);
}
return 0;
}
@@ -1586,8 +1580,8 @@ pdf_make_text_glyphs_table(pdf_text_enum_t *penum, const gs_string *pstr,
/* Build the glyph set of the glyphshow text, and re_encode the text. */
static int
pdf_make_text_glyphs_table_unencoded(gx_device_pdf *pdev, pdf_char_glyph_pairs_t *cgp,
- gs_font *font, const gs_string *pstr, const gs_glyph *gdata,
- int *ps_encoding_index)
+ gs_font *font, const gs_string *pstr, const gs_glyph *gdata,
+ int *ps_encoding_index)
{
int i, j, code;
gs_char ch;
@@ -1600,220 +1594,219 @@ pdf_make_text_glyphs_table_unencoded(gx_device_pdf *pdev, pdf_char_glyph_pairs_t
code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
if (code < 0)
- return code;
+ return code;
/* Translate glyph name indices into gscencs.c indices. */
for (i = 0; i < pstr->size; i++) {
- int code = font->procs.glyph_name(font, gdata[i], &gname);
-
- if (code < 0)
- return code;
- gid[i] = gs_c_name_glyph(gname.data, gname.size);
- if (gid[i] == GS_NO_GLYPH) {
- /* Use global glyph name. */
- /* Assuming this can't fail in a middle of a text,
- because TEXT_FROM_GLYPHS never works for Postscript. */
- gid[i] = gdata[i];
- unknown = true;
- }
+ int code = font->procs.glyph_name(font, gdata[i], &gname);
+
+ if (code < 0)
+ return code;
+ gid[i] = gs_c_name_glyph(gname.data, gname.size);
+ if (gid[i] == GS_NO_GLYPH) {
+ /* Use global glyph name. */
+ /* Assuming this can't fail in a middle of a text,
+ because TEXT_FROM_GLYPHS never works for Postscript. */
+ gid[i] = gdata[i];
+ unknown = true;
+ }
}
do_unknown:
if (unknown) {
- int last_reserved_char = -1;
- /* Using global glyph names. */
-
- /* Try to find an existing font resource, which has necessary glyphs.
- Doing so to prevent creating multiple font copies.
- */
- cgp->num_unused_chars = 0;
- cgp->num_all_chars = 0;
- for (i = 0; i < pstr->size; i++) {
- /* Temporary stub gid instead cid and char_code : */
- store_glyphs(cgp, NULL, 0, gdata[i], gdata[i], gdata[i]);
- }
- code = pdf_find_font_resource(pdev, font, resourceFont, &pdfont, cgp, false);
- if (code < 0)
- return code;
- if (code) {
- /* Found one - make it be current. */
- code = pdf_attach_font_resource(pdev, font, pdfont);
- if (code < 0)
- return code;
- }
- /* Try to add glyphs to the current font resource. . */
- cgp->num_unused_chars = 0;
- cgp->num_all_chars = 0;
-
- if(pdfont != NULL)
- last_reserved_char = pdfont->u.simple.last_reserved_char;
-
- for (i = 0; i < pstr->size; i++) {
-
- if (pdfont == NULL)
- ch = 256; /* Force new encoding. */
- else
- ch = pdf_reserve_char_code_in_pdfont(pdfont, cgp, gdata[i], &last_reserved_char);
- if (ch > 255) {
- if(pdfont != NULL)
- last_reserved_char = pdfont->u.simple.last_reserved_char;
- /* Start a new font/encoding. */
- last_reserved_char = -1;
-
- cgp->num_unused_chars = 0;
- cgp->num_all_chars = 0;
- for (i = 0; i < pstr->size; i++) {
- ch = pdf_new_char_code_in_pdfont(cgp, gdata[i], &last_reserved_char);
- if (ch > 255) {
- /* More than 255 unknown characters in a text.
- It must not happen because TEXT_FROM_GLYPHS
- never works for Postscript. */
- return_error(gs_error_unregistered);
- }
- }
- }
- }
- if (pdfont != NULL)
- pdfont->u.simple.last_reserved_char = last_reserved_char;
- /* Change glyphs to char codes in the text : */
- for (i = 0; i < pstr->size; i++) {
- /* Picked up by Coverity, if pdfont is NULL then the call might dereference it */
- if (pdfont != NULL) {
- /* A trick : pdf_reserve_char_code_in_pdfont here simply encodes with cgp. */
- ch = pdf_reserve_char_code_in_pdfont(pdfont, cgp, gdata[i], &pdfont->u.simple.last_reserved_char);
- pstr->data[i] = ch;
- } else {
- /* So if pdffont is NULL, do the 'trick' code mentioned above.
- * If that fails (I believe it shouod not), then return an error.
- */
- int j;
-
- for (j = 0; j < cgp->num_all_chars; j++)
- if (cgp->s[j].glyph == gdata[i])
- break;
- if (j < cgp->num_all_chars)
- pstr->data[i] = cgp->s[j].chr;
- else
- return_error(gs_error_unregistered);
- }
- }
- return 0;
+ int last_reserved_char = -1;
+ /* Using global glyph names. */
+
+ /* Try to find an existing font resource, which has necessary glyphs.
+ Doing so to prevent creating multiple font copies.
+ */
+ cgp->num_unused_chars = 0;
+ cgp->num_all_chars = 0;
+ for (i = 0; i < pstr->size; i++) {
+ /* Temporary stub gid instead cid and char_code : */
+ store_glyphs(cgp, NULL, 0, gdata[i], gdata[i], gdata[i]);
+ }
+ code = pdf_find_font_resource(pdev, font, resourceFont, &pdfont, cgp, false);
+ if (code < 0)
+ return code;
+ if (code) {
+ /* Found one - make it be current. */
+ code = pdf_attach_font_resource(pdev, font, pdfont);
+ if (code < 0)
+ return code;
+ }
+ /* Try to add glyphs to the current font resource. . */
+ cgp->num_unused_chars = 0;
+ cgp->num_all_chars = 0;
+
+ if(pdfont != NULL)
+ last_reserved_char = pdfont->u.simple.last_reserved_char;
+
+ for (i = 0; i < pstr->size; i++) {
+
+ if (pdfont == NULL)
+ ch = 256; /* Force new encoding. */
+ else
+ ch = pdf_reserve_char_code_in_pdfont(pdfont, cgp, gdata[i], &last_reserved_char);
+ if (ch > 255) {
+ if(pdfont != NULL)
+ last_reserved_char = pdfont->u.simple.last_reserved_char;
+ /* Start a new font/encoding. */
+ last_reserved_char = -1;
+
+ cgp->num_unused_chars = 0;
+ cgp->num_all_chars = 0;
+ for (i = 0; i < pstr->size; i++) {
+ ch = pdf_new_char_code_in_pdfont(cgp, gdata[i], &last_reserved_char);
+ if (ch > 255) {
+ /* More than 255 unknown characters in a text.
+ It must not happen because TEXT_FROM_GLYPHS
+ never works for Postscript. */
+ return_error(gs_error_unregistered);
+ }
+ }
+ }
+ }
+ if (pdfont != NULL)
+ pdfont->u.simple.last_reserved_char = last_reserved_char;
+ /* Change glyphs to char codes in the text : */
+ for (i = 0; i < pstr->size; i++) {
+ /* Picked up by Coverity, if pdfont is NULL then the call might dereference it */
+ if (pdfont != NULL) {
+ /* A trick : pdf_reserve_char_code_in_pdfont here simply encodes with cgp. */
+ ch = pdf_reserve_char_code_in_pdfont(pdfont, cgp, gdata[i], &pdfont->u.simple.last_reserved_char);
+ pstr->data[i] = ch;
+ } else {
+ /* So if pdffont is NULL, do the 'trick' code mentioned above.
+ * If that fails (I believe it shouod not), then return an error.
+ */
+ int j;
+
+ for (j = 0; j < cgp->num_all_chars; j++)
+ if (cgp->s[j].glyph == gdata[i])
+ break;
+ if (j < cgp->num_all_chars)
+ pstr->data[i] = cgp->s[j].chr;
+ else
+ return_error(gs_error_unregistered);
+ }
+ }
+ return 0;
}
/* Now we know it's a base font, bcause it has glyph names. */
bfont = (gs_font_base *)font;
if (start_ei < 0)
- start_ei = bfont->nearest_encoding_index;
+ start_ei = bfont->nearest_encoding_index;
if (start_ei < 0)
- start_ei = 0;
- /* Find an acceptable encodng, starting from start_ei.
- We need a conservative search to minimize the probability
+ start_ei = 0;
+ /* Find an acceptable encodng, starting from start_ei.
+ We need a conservative search to minimize the probability
of encoding conflicts.
*/
for (j = 0, ei = start_ei; gs_c_known_encodings[j]; j++, ei++) {
- if (!gs_c_known_encodings[ei])
- ei = 0;
- /* Restrict with PDF encodings, because others give frequent conflicts. */
- if (ei > 5) /* Hack : gscedata.c must provide a constant. */
- continue;
- cgp->num_unused_chars = 0;
- cgp->num_all_chars = 0;
- for (i = 0; i < pstr->size; i++) {
- ch = gs_c_decode(gid[i], ei);
- if (ch == GS_NO_CHAR)
- break;
- if (ch > 255)
- break; /* MacGlyphEncoding defines extra glyphs. */
- /* pstr->data[i] = (byte)ch; Can't do because pstr->data and gid
- are same pointer. Will do in a separate pass below. */
- store_glyphs(cgp, NULL, 0, ch, ch, gdata[i]);
- }
- *ps_encoding_index = ei;
- if (i == pstr->size) {
- /* Change glyphs to char codes in the text : */
- for (i = 0; i < pstr->size; i++)
- pstr->data[i] = (byte)gs_c_decode(gid[i], ei);
- return 0;
- }
+ if (!gs_c_known_encodings[ei])
+ ei = 0;
+ /* Restrict with PDF encodings, because others give frequent conflicts. */
+ if (ei > 5) /* Hack : gscedata.c must provide a constant. */
+ continue;
+ cgp->num_unused_chars = 0;
+ cgp->num_all_chars = 0;
+ for (i = 0; i < pstr->size; i++) {
+ ch = gs_c_decode(gid[i], ei);
+ if (ch == GS_NO_CHAR)
+ break;
+ if (ch > 255)
+ break; /* MacGlyphEncoding defines extra glyphs. */
+ /* pstr->data[i] = (byte)ch; Can't do because pstr->data and gid
+ are same pointer. Will do in a separate pass below. */
+ store_glyphs(cgp, NULL, 0, ch, ch, gdata[i]);
+ }
+ *ps_encoding_index = ei;
+ if (i == pstr->size) {
+ /* Change glyphs to char codes in the text : */
+ for (i = 0; i < pstr->size; i++)
+ pstr->data[i] = (byte)gs_c_decode(gid[i], ei);
+ return 0;
+ }
}
unknown = true;
goto do_unknown;
}
-
/* Get/make font resource for the font with a known encoding. */
static int
pdf_obtain_font_resource_encoded(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **ppdfont, pdf_char_glyph_pairs_t *cgp)
+ pdf_font_resource_t **ppdfont, pdf_char_glyph_pairs_t *cgp)
{
int code;
pdf_font_resource_t *pdfont_not_allowed = NULL;
if (*ppdfont != 0) {
- gs_font_base *cfont = pdf_font_resource_font(*ppdfont, false);
-
- if (font->FontType != ft_user_defined) {
- code = gs_copied_can_copy_glyphs((gs_font *)cfont, font,
- &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
- sizeof(pdf_char_glyph_pair_t), true);
- if (code < 0)
- return code;
- } else
- code = 1;
- if (code == 0) {
- pdfont_not_allowed = *ppdfont;
- *ppdfont = 0;
- } else if(!pdf_is_compatible_encoding(pdev, *ppdfont, font,
- cgp->s, cgp->num_all_chars)) {
- pdfont_not_allowed = *ppdfont;
- *ppdfont = 0;
- }
+ gs_font_base *cfont = pdf_font_resource_font(*ppdfont, false);
+
+ if (font->FontType != ft_user_defined) {
+ code = gs_copied_can_copy_glyphs((gs_font *)cfont, font,
+ &cgp->s[cgp->unused_offset].glyph, cgp->num_unused_chars,
+ sizeof(pdf_char_glyph_pair_t), true);
+ if (code < 0)
+ return code;
+ } else
+ code = 1;
+ if (code == 0) {
+ pdfont_not_allowed = *ppdfont;
+ *ppdfont = 0;
+ } else if(!pdf_is_compatible_encoding(pdev, *ppdfont, font,
+ cgp->s, cgp->num_all_chars)) {
+ pdfont_not_allowed = *ppdfont;
+ *ppdfont = 0;
+ }
}
if (*ppdfont == 0) {
- gs_font *base_font = font;
- gs_font *below;
- bool same_encoding = true;
-
- /*
- * Find the "lowest" base font that has the same outlines.
- * We use its FontName for font resource.
- */
- while ((below = base_font->base) != base_font &&
- base_font->procs.same_font(base_font, below, FONT_SAME_OUTLINES))
- base_font = below;
- if (base_font != font)
- same_encoding = ((base_font->procs.same_font(base_font, font,
- FONT_SAME_ENCODING) & FONT_SAME_ENCODING) != 0);
- /* Find or make font resource. */
- code = pdf_attached_font_resource(pdev, base_font, ppdfont, NULL, NULL, NULL, NULL);
- if (code < 0)
- return code;
- if (base_font != font) {
- if (pdfont_not_allowed == *ppdfont)
- *ppdfont = NULL;
- }
- if(*ppdfont != NULL && !pdf_is_compatible_encoding(pdev, *ppdfont,
- base_font, cgp->s, cgp->num_all_chars))
- *ppdfont = NULL;
- if (*ppdfont == NULL || *ppdfont == pdfont_not_allowed) {
- pdf_resource_type_t type =
- (pdf_is_CID_font(base_font) ? resourceCIDFont
- : resourceFont);
- *ppdfont = NULL;
- code = pdf_find_font_resource(pdev, base_font, type, ppdfont, cgp, true);
- if (code < 0)
- return code;
- if (*ppdfont == NULL) {
- code = pdf_make_font_resource(pdev, base_font, ppdfont, cgp);
- if (code < 0)
- return code;
- }
- if (base_font != font && same_encoding) {
- code = pdf_attach_font_resource(pdev, base_font, *ppdfont);
- if (code < 0)
- return code;
- }
- }
- code = pdf_attach_font_resource(pdev, font, *ppdfont);
- if (code < 0)
- return code;
+ gs_font *base_font = font;
+ gs_font *below;
+ bool same_encoding = true;
+
+ /*
+ * Find the "lowest" base font that has the same outlines.
+ * We use its FontName for font resource.
+ */
+ while ((below = base_font->base) != base_font &&
+ base_font->procs.same_font(base_font, below, FONT_SAME_OUTLINES))
+ base_font = below;
+ if (base_font != font)
+ same_encoding = ((base_font->procs.same_font(base_font, font,
+ FONT_SAME_ENCODING) & FONT_SAME_ENCODING) != 0);
+ /* Find or make font resource. */
+ code = pdf_attached_font_resource(pdev, base_font, ppdfont, NULL, NULL, NULL, NULL);
+ if (code < 0)
+ return code;
+ if (base_font != font) {
+ if (pdfont_not_allowed == *ppdfont)
+ *ppdfont = NULL;
+ }
+ if(*ppdfont != NULL && !pdf_is_compatible_encoding(pdev, *ppdfont,
+ base_font, cgp->s, cgp->num_all_chars))
+ *ppdfont = NULL;
+ if (*ppdfont == NULL || *ppdfont == pdfont_not_allowed) {
+ pdf_resource_type_t type =
+ (pdf_is_CID_font(base_font) ? resourceCIDFont
+ : resourceFont);
+ *ppdfont = NULL;
+ code = pdf_find_font_resource(pdev, base_font, type, ppdfont, cgp, true);
+ if (code < 0)
+ return code;
+ if (*ppdfont == NULL) {
+ code = pdf_make_font_resource(pdev, base_font, ppdfont, cgp);
+ if (code < 0)
+ return code;
+ }
+ if (base_font != font && same_encoding) {
+ code = pdf_attach_font_resource(pdev, base_font, *ppdfont);
+ if (code < 0)
+ return code;
+ }
+ }
+ code = pdf_attach_font_resource(pdev, font, *ppdfont);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -1821,7 +1814,7 @@ pdf_obtain_font_resource_encoded(gx_device_pdf *pdev, gs_font *font,
/* Mark glyphs used in the text with the font resource. */
static int
pdf_mark_text_glyphs(const gs_text_enum_t *penum, const gs_string *pstr,
- byte *glyph_usage, int char_cache_size)
+ byte *glyph_usage, int char_cache_size)
{
gs_text_enum_t scan = *penum;
gs_font *font = (gs_font *)penum->current_font;
@@ -1830,30 +1823,30 @@ pdf_mark_text_glyphs(const gs_text_enum_t *penum, const gs_string *pstr,
gs_glyph glyph;
if (glyph_usage == NULL)
- return 0;
+ return 0;
if (pstr != NULL) {
- scan.text.data.bytes = pstr->data;
- scan.text.size = pstr->size;
- scan.index = 0;
+ scan.text.data.bytes = pstr->data;
+ scan.text.size = pstr->size;
+ scan.index = 0;
/* if TEXT_FROM_CHARS the data was converted to bytes earlier */
if ( scan.text.operation & TEXT_FROM_CHARS )
- scan.text.operation =
+ scan.text.operation =
((scan.text.operation & ~TEXT_FROM_CHARS) | TEXT_FROM_STRING);
}
for (;;) {
- int code = pdf_next_char_glyph(&scan, pstr, font, font_is_simple,
- &char_code, &cid, &glyph);
-
- if (code == 2) /* end of string */
- break;
- if (code == 3) /* no glyph */
- continue;
- if (code < 0)
- return code;
- if (cid >= char_cache_size)
- continue;
- glyph_usage[cid / 8] |= 0x80 >> (cid & 7);
+ int code = pdf_next_char_glyph(&scan, pstr, font, font_is_simple,
+ &char_code, &cid, &glyph);
+
+ if (code == 2) /* end of string */
+ break;
+ if (code == 3) /* no glyph */
+ continue;
+ if (code < 0)
+ return code;
+ if (cid >= char_cache_size)
+ continue;
+ glyph_usage[cid / 8] |= 0x80 >> (cid & 7);
}
return 0;
}
@@ -1861,16 +1854,16 @@ pdf_mark_text_glyphs(const gs_text_enum_t *penum, const gs_string *pstr,
/* Mark glyphs used in the glyphshow text with the font resource. */
static int
pdf_mark_text_glyphs_unencoded(const gs_text_enum_t *penum, const gs_string *pstr,
- byte *glyph_usage, int char_cache_size)
+ byte *glyph_usage, int char_cache_size)
{
int i;
for(i = 0; i < pstr->size; i++) {
- byte ch = pstr->data[i];
+ byte ch = pstr->data[i];
- if (ch >= char_cache_size)
- return_error(gs_error_rangecheck);
- glyph_usage[ch / 8] |= 0x80 >> (ch & 7);
+ if (ch >= char_cache_size)
+ return_error(gs_error_rangecheck);
+ glyph_usage[ch / 8] |= 0x80 >> (ch & 7);
}
return 0;
}
@@ -1879,8 +1872,8 @@ pdf_mark_text_glyphs_unencoded(const gs_text_enum_t *penum, const gs_string *pst
* Create or find a font resource object for a text.
*/
int
-pdf_obtain_font_resource(pdf_text_enum_t *penum,
- const gs_string *pstr, pdf_font_resource_t **ppdfont)
+pdf_obtain_font_resource(pdf_text_enum_t *penum,
+ const gs_string *pstr, pdf_font_resource_t **ppdfont)
{
gx_device_pdf *pdev = (gx_device_pdf *)penum->dev;
gs_font *font = (gs_font *)penum->current_font;
@@ -1890,30 +1883,30 @@ pdf_obtain_font_resource(pdf_text_enum_t *penum,
int code;
if (font->FontType == ft_composite) {
- /* Must not happen, because we always split composite fonts into descendents. */
- return_error(gs_error_unregistered);
+ /* Must not happen, because we always split composite fonts into descendents. */
+ return_error(gs_error_unregistered);
}
code = pdf_attached_font_resource(pdev, font, ppdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
/* *ppdfont is NULL if no resource attached. */
if (code < 0)
- return code;
+ return code;
if (penum->cgp == NULL) {
- code = pdf_alloc_text_glyphs_table(pdev, penum, pstr);
- if (code < 0)
- return code;
- code = pdf_make_text_glyphs_table(penum, pstr,
- glyph_usage, char_cache_size);
- if (code < 0)
- return code;
+ code = pdf_alloc_text_glyphs_table(pdev, penum, pstr);
+ if (code < 0)
+ return code;
+ code = pdf_make_text_glyphs_table(penum, pstr,
+ glyph_usage, char_cache_size);
+ if (code < 0)
+ return code;
}
code = pdf_obtain_font_resource_encoded(pdev, font, ppdfont, penum->cgp);
if (code < 0)
- return code;
- code = pdf_attached_font_resource(pdev, font, ppdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ return code;
+ code = pdf_attached_font_resource(pdev, font, ppdfont,
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
return pdf_mark_text_glyphs((const gs_text_enum_t *)penum, pstr, glyph_usage, char_cache_size);
}
@@ -1921,8 +1914,8 @@ pdf_obtain_font_resource(pdf_text_enum_t *penum,
* Create or find a font resource object for a glyphshow text.
*/
int
-pdf_obtain_font_resource_unencoded(pdf_text_enum_t *penum,
- const gs_string *pstr, pdf_font_resource_t **ppdfont, const gs_glyph *gdata)
+pdf_obtain_font_resource_unencoded(pdf_text_enum_t *penum,
+ const gs_string *pstr, pdf_font_resource_t **ppdfont, const gs_glyph *gdata)
{
gx_device_pdf *pdev = (gx_device_pdf *)penum->dev;
gs_font *font = (gs_font *)penum->current_font;
@@ -1932,74 +1925,74 @@ pdf_obtain_font_resource_unencoded(pdf_text_enum_t *penum,
int code, ps_encoding_index = -1;
if (font->FontType == ft_composite) {
- /* Must not happen, because we always split composite fonts into descendents. */
- return_error(gs_error_unregistered);
+ /* Must not happen, because we always split composite fonts into descendents. */
+ return_error(gs_error_unregistered);
}
code = pdf_attached_font_resource(pdev, font, ppdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
/* *ppdfont is NULL if no resource attached. */
if (*ppdfont != NULL)
- ps_encoding_index = (*ppdfont)->u.simple.preferred_encoding_index;
+ ps_encoding_index = (*ppdfont)->u.simple.preferred_encoding_index;
if (penum->cgp == NULL) {
- code = pdf_alloc_text_glyphs_table(pdev, penum, pstr);
- if (code < 0)
- return code;
- code = pdf_make_text_glyphs_table_unencoded(pdev, penum->cgp, font, pstr, gdata, &ps_encoding_index);
- if (code < 0)
- return code;
+ code = pdf_alloc_text_glyphs_table(pdev, penum, pstr);
+ if (code < 0)
+ return code;
+ code = pdf_make_text_glyphs_table_unencoded(pdev, penum->cgp, font, pstr, gdata, &ps_encoding_index);
+ if (code < 0)
+ return code;
}
code = pdf_obtain_font_resource_encoded(pdev, font, ppdfont, penum->cgp);
if (code < 0)
- return code;
- code = pdf_attached_font_resource(pdev, font, ppdfont,
- &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
+ return code;
+ code = pdf_attached_font_resource(pdev, font, ppdfont,
+ &glyph_usage, &real_widths, &char_cache_size, &width_cache_size);
if (code < 0)
- return code;
+ return code;
(*ppdfont)->u.simple.preferred_encoding_index = ps_encoding_index;
- return pdf_mark_text_glyphs_unencoded((const gs_text_enum_t *)penum,
- pstr, glyph_usage, char_cache_size);
+ return pdf_mark_text_glyphs_unencoded((const gs_text_enum_t *)penum,
+ pstr, glyph_usage, char_cache_size);
}
static inline bool
strings_equal(const gs_const_string *s1, const gs_const_string *s2)
{
return s1->size == s2->size &&
- !memcmp(s1->data, s2->data, s1->size);
+ !memcmp(s1->data, s2->data, s1->size);
}
/*
* Create or find a parent Type 0 font resource object for a CID font resource.
*/
int
-pdf_obtain_parent_type0_font_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdsubf,
- uint font_index, const gs_const_string *CMapName, pdf_font_resource_t **pdfont)
+pdf_obtain_parent_type0_font_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdsubf,
+ uint font_index, const gs_const_string *CMapName, pdf_font_resource_t **pdfont)
{
if (pdsubf->u.cidfont.parent != 0 &&
- font_index == pdsubf->u.cidfont.parent->u.type0.font_index &&
- strings_equal(CMapName, &pdsubf->u.cidfont.parent->u.type0.CMapName))
- *pdfont = pdsubf->u.cidfont.parent;
+ font_index == pdsubf->u.cidfont.parent->u.type0.font_index &&
+ strings_equal(CMapName, &pdsubf->u.cidfont.parent->u.type0.CMapName))
+ *pdfont = pdsubf->u.cidfont.parent;
else {
- /*
- * PDF spec 1.4 section 5.6 "Composite Fonts" says :
- *
- * PDF 1.2 introduces a general architecture for composite fonts that theoretically
- * allows a Type 0 font to have multiple descendants,which might themselves be
- * Type 0 fonts.However,in versions up to and including PDF 1.4,only a single
- * descendant is allowed,which must be a CIDFont (not a font).This restriction
- * may be relaxed in a future PDF version.
- */
-
- if (pdsubf->u.cidfont.parent == NULL ||
- pdf_find_type0_font_resource(pdev, pdsubf, CMapName, font_index, pdfont) <= 0) {
- int code = pdf_font_type0_alloc(pdev, pdfont, gs_no_id, pdsubf, CMapName);
-
- if (code < 0)
- return code;
- (*pdfont)->u.type0.font_index = font_index;
- }
- pdsubf->u.cidfont.parent = *pdfont;
+ /*
+ * PDF spec 1.4 section 5.6 "Composite Fonts" says :
+ *
+ * PDF 1.2 introduces a general architecture for composite fonts that theoretically
+ * allows a Type 0 font to have multiple descendants,which might themselves be
+ * Type 0 fonts.However,in versions up to and including PDF 1.4,only a single
+ * descendant is allowed,which must be a CIDFont (not a font).This restriction
+ * may be relaxed in a future PDF version.
+ */
+
+ if (pdsubf->u.cidfont.parent == NULL ||
+ pdf_find_type0_font_resource(pdev, pdsubf, CMapName, font_index, pdfont) <= 0) {
+ int code = pdf_font_type0_alloc(pdev, pdfont, gs_no_id, pdsubf, CMapName);
+
+ if (code < 0)
+ return code;
+ (*pdfont)->u.type0.font_index = font_index;
+ }
+ pdsubf->u.cidfont.parent = *pdfont;
}
return 0;
}
@@ -2008,24 +2001,24 @@ gs_char
pdf_find_glyph(pdf_font_resource_t *pdfont, gs_glyph glyph)
{
if (pdfont->FontType != ft_user_defined)
- return GS_NO_CHAR;
+ return GS_NO_CHAR;
else {
- pdf_encoding_element_t *pet = pdfont->u.simple.Encoding;
- int i, i0 = -1;
-
- if (pdfont->u.simple.FirstChar > pdfont->u.simple.LastChar)
- return (gs_char)0;
- for (i = pdfont->u.simple.FirstChar; i <= pdfont->u.simple.LastChar; i++, pet++) {
- if (pet->glyph == glyph)
- return (gs_char)i;
- if (i0 == -1 && pet->glyph == GS_NO_GLYPH)
- i0 = i;
- }
- if (i0 != -1)
- return (gs_char)i0;
- if (i < 256)
- return (gs_char)i;
- return GS_NO_CHAR;
+ pdf_encoding_element_t *pet = pdfont->u.simple.Encoding;
+ int i, i0 = -1;
+
+ if (pdfont->u.simple.FirstChar > pdfont->u.simple.LastChar)
+ return (gs_char)0;
+ for (i = pdfont->u.simple.FirstChar; i <= pdfont->u.simple.LastChar; i++, pet++) {
+ if (pet->glyph == glyph)
+ return (gs_char)i;
+ if (i0 == -1 && pet->glyph == GS_NO_GLYPH)
+ i0 = i;
+ }
+ if (i0 != -1)
+ return (gs_char)i0;
+ if (i < 256)
+ return (gs_char)i;
+ return GS_NO_CHAR;
}
}
@@ -2039,58 +2032,57 @@ pdf_find_glyph(pdf_font_resource_t *pdfont, gs_glyph glyph)
*/
static int
transform_delta_inverse(const gs_point *pdelta, const gs_matrix *pmat,
- gs_point *ppt)
+ gs_point *ppt)
{
int code = gs_distance_transform_inverse(pdelta->x, pdelta->y, pmat, ppt);
gs_point delta;
if (code < 0)
- return code;
+ return code;
if (ppt->y == 0)
- return 0;
+ return 0;
/* Check for numerical fuzz. */
code = gs_distance_transform(ppt->x, 0.0, pmat, &delta);
if (code < 0)
- return 0; /* punt */
+ return 0; /* punt */
if (fabs(delta.x - pdelta->x) < 0.01 && fabs(delta.y - pdelta->y) < 0.01) {
- /* Close enough to y == 0: device space error < 0.01 pixel. */
- ppt->y = 0;
+ /* Close enough to y == 0: device space error < 0.01 pixel. */
+ ppt->y = 0;
}
return 0;
}
-float pdf_calculate_text_size(gs_imager_state *pis, pdf_font_resource_t *pdfont,
- const gs_matrix *pfmat, gs_matrix *smat, gs_matrix *tmat,
- gs_font *font, gx_device_pdf *pdev)
+float pdf_calculate_text_size(gs_imager_state *pis, pdf_font_resource_t *pdfont,
+ const gs_matrix *pfmat, gs_matrix *smat, gs_matrix *tmat,
+ gs_font *font, gx_device_pdf *pdev)
{
gs_matrix orig_matrix;
double
- sx = pdev->HWResolution[0] / 72.0,
- sy = pdev->HWResolution[1] / 72.0;
+ sx = pdev->HWResolution[0] / 72.0,
+ sy = pdev->HWResolution[1] / 72.0;
float size;
-
/* Get the original matrix of the base font. */
{
- gs_font_base *cfont = pdf_font_resource_font(pdfont, false);
-
- if (pdfont->FontType == ft_user_defined)
- orig_matrix = pdfont->u.simple.s.type3.FontMatrix;
- else if (cfont != 0) {
- /*
- * The text matrix to be computed relatively to the
- * embedded font matrix.
- */
- orig_matrix = cfont->FontMatrix;
- } else {
- /*
- * We don't embed the font.
- * The text matrix to be computed relatively to
- * standard font matrix.
- */
- pdf_font_orig_matrix(font, &orig_matrix);
- }
+ gs_font_base *cfont = pdf_font_resource_font(pdfont, false);
+
+ if (pdfont->FontType == ft_user_defined)
+ orig_matrix = pdfont->u.simple.s.type3.FontMatrix;
+ else if (cfont != 0) {
+ /*
+ * The text matrix to be computed relatively to the
+ * embedded font matrix.
+ */
+ orig_matrix = cfont->FontMatrix;
+ } else {
+ /*
+ * We don't embed the font.
+ * The text matrix to be computed relatively to
+ * standard font matrix.
+ */
+ pdf_font_orig_matrix(font, &orig_matrix);
+ }
}
/* Compute the scaling matrix and combined matrix. */
@@ -2106,17 +2098,17 @@ float pdf_calculate_text_size(gs_imager_state *pis, pdf_font_resource_t *pdfont,
size = hypot(tmat->yx, tmat->yy) / sy;
if (size < 0.01)
- size = hypot(tmat->xx, tmat->xy) / sx;
+ size = hypot(tmat->xx, tmat->xy) / sx;
if (size < 0.01)
- size = 1;
+ size = 1;
return(size);
}
int
pdf_update_text_state(pdf_text_process_state_t *ppts,
- const pdf_text_enum_t *penum,
- pdf_font_resource_t *pdfont, const gs_matrix *pfmat)
+ const pdf_text_enum_t *penum,
+ pdf_font_resource_t *pdfont, const gs_matrix *pfmat)
{
gx_device_pdf *const pdev = (gx_device_pdf *)penum->dev;
gs_font *font = penum->current_font;
@@ -2128,34 +2120,33 @@ pdf_update_text_state(pdf_text_process_state_t *ppts,
int code = gx_path_current_point(penum->path, &cpt);
if (code < 0)
- return code;
-
+ return code;
size = pdf_calculate_text_size(penum->pis, pdfont, pfmat, &smat, &tmat, penum->current_font, pdev);
/* Check for spacing parameters we can handle, and transform them. */
if (penum->text.operation & TEXT_ADD_TO_ALL_WIDTHS) {
- if (penum->current_font->WMode == 0) {
- gs_point pt;
-
- code = transform_delta_inverse(&penum->text.delta_all, &smat, &pt);
- if (code >= 0 && pt.y == 0)
- c_s = pt.x * size;
- else
- mask |= TEXT_ADD_TO_ALL_WIDTHS;
- }
- else
- mask |= TEXT_ADD_TO_ALL_WIDTHS;
- }
-
+ if (penum->current_font->WMode == 0) {
+ gs_point pt;
+
+ code = transform_delta_inverse(&penum->text.delta_all, &smat, &pt);
+ if (code >= 0 && pt.y == 0)
+ c_s = pt.x * size;
+ else
+ mask |= TEXT_ADD_TO_ALL_WIDTHS;
+ }
+ else
+ mask |= TEXT_ADD_TO_ALL_WIDTHS;
+ }
+
if (penum->text.operation & TEXT_ADD_TO_SPACE_WIDTH) {
- gs_point pt;
+ gs_point pt;
- code = transform_delta_inverse(&penum->text.delta_space, &smat, &pt);
- if (code >= 0 && pt.y == 0 && penum->text.space.s_char == 32)
- w_s = pt.x * size;
- else
- mask |= TEXT_ADD_TO_SPACE_WIDTH;
+ code = transform_delta_inverse(&penum->text.delta_space, &smat, &pt);
+ if (code >= 0 && pt.y == 0 && penum->text.space.s_char == 32)
+ w_s = pt.x * size;
+ else
+ mask |= TEXT_ADD_TO_SPACE_WIDTH;
}
/* Store the updated values. */
@@ -2176,38 +2167,38 @@ pdf_update_text_state(pdf_text_process_state_t *ppts,
if (font->PaintType == 2 && penum->pis->text_rendering_mode == 0)
{
- gs_imager_state *pis = penum->pis;
- gs_font *font = penum->current_font;
- double scaled_width = font->StrokeWidth != 0 ? font->StrokeWidth : 0.001;
- double saved_width = pis->line_params.half_width;
- /*
- * See stream_to_text in gdevpdfu.c re the computation of
- * the scaling value.
- */
- double scale = 72.0 / pdev->HWResolution[1];
-
- if (font->FontMatrix.yy != 0)
- scaled_width *= fabs(font->orig_FontMatrix.yy) * size * tmat.yy * scale;
- else
- scaled_width *= fabs(font->orig_FontMatrix.xy) * size * tmat.xy * scale;
-
- ppts->values.render_mode = 1;
-
- /* Sort out any pending glyphs */
- code = pdf_set_PaintType0_params(pdev, pis, size, scaled_width, &ppts->values);
- if (code < 0)
- return code;
-
- pis->line_params.half_width = scaled_width / 2;
- code = pdf_set_text_process_state(pdev, (const gs_text_enum_t *)penum,
- ppts);
- if (code < 0)
- return code;
-
- pis->line_params.half_width = saved_width;
+ gs_imager_state *pis = penum->pis;
+ gs_font *font = penum->current_font;
+ double scaled_width = font->StrokeWidth != 0 ? font->StrokeWidth : 0.001;
+ double saved_width = pis->line_params.half_width;
+ /*
+ * See stream_to_text in gdevpdfu.c re the computation of
+ * the scaling value.
+ */
+ double scale = 72.0 / pdev->HWResolution[1];
+
+ if (font->FontMatrix.yy != 0)
+ scaled_width *= fabs(font->orig_FontMatrix.yy) * size * tmat.yy * scale;
+ else
+ scaled_width *= fabs(font->orig_FontMatrix.xy) * size * tmat.xy * scale;
+
+ ppts->values.render_mode = 1;
+
+ /* Sort out any pending glyphs */
+ code = pdf_set_PaintType0_params(pdev, pis, size, scaled_width, &ppts->values);
+ if (code < 0)
+ return code;
+
+ pis->line_params.half_width = scaled_width / 2;
+ code = pdf_set_text_process_state(pdev, (const gs_text_enum_t *)penum,
+ ppts);
+ if (code < 0)
+ return code;
+
+ pis->line_params.half_width = saved_width;
} else {
- code = pdf_set_text_process_state(pdev, (const gs_text_enum_t *)penum,
- ppts);
+ code = pdf_set_text_process_state(pdev, (const gs_text_enum_t *)penum,
+ ppts);
}
return (code < 0 ? code : mask);
}
@@ -2219,8 +2210,8 @@ pdf_update_text_state(pdf_text_process_state_t *ppts,
*/
int
pdf_set_text_process_state(gx_device_pdf *pdev,
- const gs_text_enum_t *pte, /* for pdcolor, pis */
- pdf_text_process_state_t *ppts)
+ const gs_text_enum_t *pte, /* for pdcolor, pis */
+ pdf_text_process_state_t *ppts)
{
/*
* Setting the stroke parameters may exit text mode, causing the
@@ -2228,22 +2219,22 @@ pdf_set_text_process_state(gx_device_pdf *pdev,
* stroke parameters first.
*/
if (pdf_render_mode_uses_stroke(pdev, &ppts->values)) {
- /* Write all the parameters for stroking. */
- gs_imager_state *pis = pte->pis;
- float save_width = pis->line_params.half_width;
- int code;
+ /* Write all the parameters for stroking. */
+ gs_imager_state *pis = pte->pis;
+ float save_width = pis->line_params.half_width;
+ int code;
- code = pdf_open_contents(pdev, PDF_IN_STRING);
- if (code < 0)
- return code;
+ code = pdf_open_contents(pdev, PDF_IN_STRING);
+ if (code < 0)
+ return code;
- code = pdf_prepare_stroke(pdev, pis);
- if (code >= 0)
- code = gdev_vector_prepare_stroke((gx_device_vector *)pdev,
- pis, NULL, NULL, 1);
- pis->line_params.half_width = save_width;
- if (code < 0)
- return code;
+ code = pdf_prepare_stroke(pdev, pis);
+ if (code >= 0)
+ code = gdev_vector_prepare_stroke((gx_device_vector *)pdev,
+ pis, NULL, NULL, 1);
+ pis->line_params.half_width = save_width;
+ if (code < 0)
+ return code;
}
/* Now set all the other parameters. */
@@ -2253,17 +2244,17 @@ pdf_set_text_process_state(gx_device_pdf *pdev,
static int
store_glyph_width(pdf_glyph_width_t *pwidth, int wmode, const gs_matrix *scale,
- const gs_glyph_info_t *pinfo)
+ const gs_glyph_info_t *pinfo)
{
double w, v;
gs_distance_transform(pinfo->width[wmode].x, pinfo->width[wmode].y, scale, &pwidth->xy);
if (wmode)
- w = pwidth->xy.y, v = pwidth->xy.x;
+ w = pwidth->xy.y, v = pwidth->xy.x;
else
- w = pwidth->xy.x, v = pwidth->xy.y;
+ w = pwidth->xy.x, v = pwidth->xy.y;
if (v != 0)
- return 1;
+ return 1;
pwidth->w = w;
gs_distance_transform(pinfo->v.x, pinfo->v.y, scale, &pwidth->v);
return 0;
@@ -2271,30 +2262,30 @@ store_glyph_width(pdf_glyph_width_t *pwidth, int wmode, const gs_matrix *scale,
static int
get_missing_width(gs_font_base *cfont, int wmode, const gs_matrix *scale_c,
- pdf_glyph_widths_t *pwidths)
+ pdf_glyph_widths_t *pwidths)
{
gs_font_info_t finfo;
int code;
code = cfont->procs.font_info((gs_font *)cfont, NULL,
- FONT_INFO_MISSING_WIDTH, &finfo);
+ FONT_INFO_MISSING_WIDTH, &finfo);
if (code < 0)
- return code;
+ return code;
if (wmode) {
- gs_distance_transform(0.0, -finfo.MissingWidth, scale_c, &pwidths->real_width.xy);
- pwidths->Width.xy.x = 0;
- pwidths->Width.xy.y = pwidths->real_width.xy.y;
- pwidths->Width.w = pwidths->real_width.w =
- pwidths->Width.xy.y;
- pwidths->Width.v.x = - pwidths->Width.xy.y / 2;
- pwidths->Width.v.y = - pwidths->Width.xy.y;
+ gs_distance_transform(0.0, -finfo.MissingWidth, scale_c, &pwidths->real_width.xy);
+ pwidths->Width.xy.x = 0;
+ pwidths->Width.xy.y = pwidths->real_width.xy.y;
+ pwidths->Width.w = pwidths->real_width.w =
+ pwidths->Width.xy.y;
+ pwidths->Width.v.x = - pwidths->Width.xy.y / 2;
+ pwidths->Width.v.y = - pwidths->Width.xy.y;
} else {
- gs_distance_transform(finfo.MissingWidth, 0.0, scale_c, &pwidths->real_width.xy);
- pwidths->Width.xy.x = pwidths->real_width.xy.x;
- pwidths->Width.xy.y = 0;
- pwidths->Width.w = pwidths->real_width.w =
- pwidths->Width.xy.x;
- pwidths->Width.v.x = pwidths->Width.v.y = 0;
+ gs_distance_transform(finfo.MissingWidth, 0.0, scale_c, &pwidths->real_width.xy);
+ pwidths->Width.xy.x = pwidths->real_width.xy.x;
+ pwidths->Width.xy.y = 0;
+ pwidths->Width.w = pwidths->real_width.w =
+ pwidths->Width.xy.x;
+ pwidths->Width.v.x = pwidths->Width.v.y = 0;
}
/*
* Don't mark the width as known, just in case this is an
@@ -2303,7 +2294,6 @@ get_missing_width(gs_font_base *cfont, int wmode, const gs_matrix *scale_c,
return 1;
}
-
/*
* Get the widths (unmodified from the copied font,
* and possibly modified from the original font) of a given glyph.
@@ -2313,8 +2303,8 @@ get_missing_width(gs_font_base *cfont, int wmode, const gs_matrix *scale_c,
*/
int
pdf_glyph_widths(pdf_font_resource_t *pdfont, int wmode, gs_glyph glyph,
- gs_font *orig_font, pdf_glyph_widths_t *pwidths,
- const double cdevproc_result[10])
+ gs_font *orig_font, pdf_glyph_widths_t *pwidths,
+ const double cdevproc_result[10])
{
gs_font_base *cfont = pdf_font_resource_font(pdfont, false);
gs_font *ofont = orig_font;
@@ -2322,124 +2312,124 @@ pdf_glyph_widths(pdf_font_resource_t *pdfont, int wmode, gs_glyph glyph,
gs_matrix scale_c, scale_o;
int code, rcode = 0;
gs_point v;
- int allow_cdevproc_callout = (orig_font->FontType == ft_CID_TrueType
- || orig_font->FontType == ft_CID_encrypted
- ? GLYPH_INFO_CDEVPROC : 0); /* fixme : allow more font types. */
+ int allow_cdevproc_callout = (orig_font->FontType == ft_CID_TrueType
+ || orig_font->FontType == ft_CID_encrypted
+ ? GLYPH_INFO_CDEVPROC : 0); /* fixme : allow more font types. */
if (ofont->FontType == ft_composite)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = glyph_orig_matrix((const gs_font *)cfont, glyph, &scale_c);
if (code < 0)
- return code;
+ return code;
code = glyph_orig_matrix(ofont, glyph, &scale_o);
if (code < 0)
- return code;
+ return code;
gs_matrix_scale(&scale_c, 1000.0, 1000.0, &scale_c);
gs_matrix_scale(&scale_o, 1000.0, 1000.0, &scale_o);
pwidths->Width.v.x = pwidths->Width.v.y = 0;
pwidths->real_width.v.x = pwidths->real_width.v.y = 0;
pwidths->replaced_v = false;
if (glyph == GS_NO_GLYPH)
- return get_missing_width(cfont, wmode, &scale_c, pwidths);
+ return get_missing_width(cfont, wmode, &scale_c, pwidths);
code = cfont->procs.glyph_info((gs_font *)cfont, glyph, NULL,
- GLYPH_INFO_WIDTH0 |
- (GLYPH_INFO_WIDTH0 << wmode) |
- GLYPH_INFO_OUTLINE_WIDTHS |
- (GLYPH_INFO_VVECTOR0 << wmode),
- &info);
+ GLYPH_INFO_WIDTH0 |
+ (GLYPH_INFO_WIDTH0 << wmode) |
+ GLYPH_INFO_OUTLINE_WIDTHS |
+ (GLYPH_INFO_VVECTOR0 << wmode),
+ &info);
/* For CID fonts the PDF spec requires the x-component of v-vector
to be equal to half glyph width, and AR5 takes it from W, DW.
So make a compatibe data here.
*/
if (code == gs_error_undefined || !(info.members & (GLYPH_INFO_WIDTH0 << wmode))) {
- code = get_missing_width(cfont, wmode, &scale_c, pwidths);
- if (code < 0)
- v.y = 0;
- else
- v.y = pwidths->Width.v.y;
- if (wmode && pdf_is_CID_font(ofont)) {
- pdf_glyph_widths_t widths1;
-
- if (get_missing_width(cfont, 0, &scale_c, &widths1) < 0)
- v.x = 0;
- else
- v.x = widths1.Width.w / 2;
- } else
- v.x = pwidths->Width.v.x;
+ code = get_missing_width(cfont, wmode, &scale_c, pwidths);
+ if (code < 0)
+ v.y = 0;
+ else
+ v.y = pwidths->Width.v.y;
+ if (wmode && pdf_is_CID_font(ofont)) {
+ pdf_glyph_widths_t widths1;
+
+ if (get_missing_width(cfont, 0, &scale_c, &widths1) < 0)
+ v.x = 0;
+ else
+ v.x = widths1.Width.w / 2;
+ } else
+ v.x = pwidths->Width.v.x;
} else if (code < 0)
- return code;
+ return code;
else {
- code = store_glyph_width(&pwidths->Width, wmode, &scale_c, &info);
- if (code < 0)
- return code;
- rcode |= code;
- if (info.members & (GLYPH_INFO_VVECTOR0 << wmode))
- gs_distance_transform(info.v.x, info.v.y, &scale_c, &v);
- else
- v.x = v.y = 0;
- if (wmode && pdf_is_CID_font(ofont)) {
- if (info.members & (GLYPH_INFO_WIDTH0 << wmode)) {
- gs_point xy;
-
- gs_distance_transform(info.width[0].x, info.width[0].y, &scale_c, &xy);
- v.x = xy.x / 2;
- } else {
- pdf_glyph_widths_t widths1;
-
- if (get_missing_width(cfont, 0, &scale_c, &widths1) < 0)
- v.x = 0;
- else
- v.x = widths1.Width.w / 2;
- }
- }
+ code = store_glyph_width(&pwidths->Width, wmode, &scale_c, &info);
+ if (code < 0)
+ return code;
+ rcode |= code;
+ if (info.members & (GLYPH_INFO_VVECTOR0 << wmode))
+ gs_distance_transform(info.v.x, info.v.y, &scale_c, &v);
+ else
+ v.x = v.y = 0;
+ if (wmode && pdf_is_CID_font(ofont)) {
+ if (info.members & (GLYPH_INFO_WIDTH0 << wmode)) {
+ gs_point xy;
+
+ gs_distance_transform(info.width[0].x, info.width[0].y, &scale_c, &xy);
+ v.x = xy.x / 2;
+ } else {
+ pdf_glyph_widths_t widths1;
+
+ if (get_missing_width(cfont, 0, &scale_c, &widths1) < 0)
+ v.x = 0;
+ else
+ v.x = widths1.Width.w / 2;
+ }
+ }
}
pwidths->Width.v = v;
#if 0
if (code > 0)
- pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0;
+ pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0;
#else /* Skip only if not paralel to the axis. */
if (code > 0 && !pdf_is_CID_font(ofont))
- pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0;
+ pwidths->Width.xy.x = pwidths->Width.xy.y = pwidths->Width.w = 0;
#endif
if (cdevproc_result == NULL) {
- info.members = 0;
- code = ofont->procs.glyph_info(ofont, glyph, NULL,
- (GLYPH_INFO_WIDTH0 << wmode) |
- (GLYPH_INFO_VVECTOR0 << wmode) |
- allow_cdevproc_callout,
- &info);
- /* fixme : Move this call before cfont->procs.glyph_info. */
- if (info.members & GLYPH_INFO_CDEVPROC) {
- if (allow_cdevproc_callout)
- return TEXT_PROCESS_CDEVPROC;
- else
- return_error(gs_error_rangecheck);
- }
+ info.members = 0;
+ code = ofont->procs.glyph_info(ofont, glyph, NULL,
+ (GLYPH_INFO_WIDTH0 << wmode) |
+ (GLYPH_INFO_VVECTOR0 << wmode) |
+ allow_cdevproc_callout,
+ &info);
+ /* fixme : Move this call before cfont->procs.glyph_info. */
+ if (info.members & GLYPH_INFO_CDEVPROC) {
+ if (allow_cdevproc_callout)
+ return TEXT_PROCESS_CDEVPROC;
+ else
+ return_error(gs_error_rangecheck);
+ }
} else {
- info.width[0].x = cdevproc_result[0];
- info.width[0].y = cdevproc_result[1];
- info.width[1].x = cdevproc_result[6];
- info.width[1].y = cdevproc_result[7];
- info.v.x = (wmode ? cdevproc_result[8] : 0);
- info.v.y = (wmode ? cdevproc_result[9] : 0);
- info.members = (GLYPH_INFO_WIDTH0 << wmode) |
- (wmode ? GLYPH_INFO_VVECTOR1 : 0);
- code = 0;
+ info.width[0].x = cdevproc_result[0];
+ info.width[0].y = cdevproc_result[1];
+ info.width[1].x = cdevproc_result[6];
+ info.width[1].y = cdevproc_result[7];
+ info.v.x = (wmode ? cdevproc_result[8] : 0);
+ info.v.y = (wmode ? cdevproc_result[9] : 0);
+ info.members = (GLYPH_INFO_WIDTH0 << wmode) |
+ (wmode ? GLYPH_INFO_VVECTOR1 : 0);
+ code = 0;
}
if (code == gs_error_undefined || !(info.members & (GLYPH_INFO_WIDTH0 << wmode)))
- pwidths->real_width = pwidths->Width;
+ pwidths->real_width = pwidths->Width;
else if (code < 0)
- return code;
+ return code;
else {
- if ((info.members & (GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1)) != 0)
- pwidths->replaced_v = true;
- else
- info.v.x = info.v.y = 0;
- code = store_glyph_width(&pwidths->real_width, wmode, &scale_o, &info);
- if (code < 0)
- return code;
- rcode |= code;
- gs_distance_transform(info.v.x, info.v.y, &scale_o, &pwidths->real_width.v);
+ if ((info.members & (GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1)) != 0)
+ pwidths->replaced_v = true;
+ else
+ info.v.x = info.v.y = 0;
+ code = store_glyph_width(&pwidths->real_width, wmode, &scale_o, &info);
+ if (code < 0)
+ return code;
+ rcode |= code;
+ gs_distance_transform(info.v.x, info.v.y, &scale_o, &pwidths->real_width.v);
}
return rcode;
}
@@ -2451,40 +2441,40 @@ pdf_choose_output_char_code(gx_device_pdf *pdev, pdf_text_enum_t *penum, gs_char
gs_font *font = penum->current_font;
if (penum->text.operation & TEXT_FROM_SINGLE_GLYPH) {
- byte buf[1];
- int char_code_length;
- gs_glyph glyph = penum->text.data.d_glyph;
- int code = pdf_encode_glyph((gs_font_base *)font, glyph,
- buf, sizeof(buf), &char_code_length);
-
- if (code < 0) {
- /* Must not happen, becuse pdf_encode_glyph was passed in process_plain_text.*/
- ch = GS_NO_CHAR;
- } else if (char_code_length != 1) {
- /* Must not happen with type 3 fonts.*/
- ch = GS_NO_CHAR;
- } else
- ch = buf[0];
+ byte buf[1];
+ int char_code_length;
+ gs_glyph glyph = penum->text.data.d_glyph;
+ int code = pdf_encode_glyph((gs_font_base *)font, glyph,
+ buf, sizeof(buf), &char_code_length);
+
+ if (code < 0) {
+ /* Must not happen, becuse pdf_encode_glyph was passed in process_plain_text.*/
+ ch = GS_NO_CHAR;
+ } else if (char_code_length != 1) {
+ /* Must not happen with type 3 fonts.*/
+ ch = GS_NO_CHAR;
+ } else
+ ch = buf[0];
} else if (penum->orig_font->FontType == ft_composite) {
- gs_font_type0 *font0 = (gs_font_type0 *)penum->orig_font;
- gs_glyph glyph = penum->returned.current_glyph;
-
- if (font0->data.FMapType == fmap_CMap) {
- pdf_font_resource_t *pdfont;
- int code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
-
- if (code < 0)
- return code;
- ch = pdf_find_glyph(pdfont, glyph);
- } else
- ch = penum->returned.current_char;
+ gs_font_type0 *font0 = (gs_font_type0 *)penum->orig_font;
+ gs_glyph glyph = penum->returned.current_glyph;
+
+ if (font0->data.FMapType == fmap_CMap) {
+ pdf_font_resource_t *pdfont;
+ int code = pdf_attached_font_resource(pdev, font, &pdfont, NULL, NULL, NULL, NULL);
+
+ if (code < 0)
+ return code;
+ ch = pdf_find_glyph(pdfont, glyph);
+ } else
+ ch = penum->returned.current_char;
} else {
- ch = penum->returned.current_char;
- /* Keep for records : glyph = font->procs.encode_char(font, ch, GLYPH_SPACE_NAME); */
- /*
- * If glyph == GS_NO_GLYPH, we should replace it with
- * a notdef glyph, but we don't know how to do with Type 3 fonts.
- */
+ ch = penum->returned.current_char;
+ /* Keep for records : glyph = font->procs.encode_char(font, ch, GLYPH_SPACE_NAME); */
+ /*
+ * If glyph == GS_NO_GLYPH, we should replace it with
+ * a notdef glyph, but we don't know how to do with Type 3 fonts.
+ */
}
*pch = ch;
return 0;
@@ -2494,21 +2484,21 @@ static int
pdf_choose_output_glyph_hame(gx_device_pdf *pdev, pdf_text_enum_t *penum, gs_const_string *gnstr, gs_glyph glyph)
{
if (penum->orig_font->FontType == ft_composite) {
- char buf[6];
- byte *p;
-
- gnstr->size = 5;
- p = (byte *)gs_alloc_string(pdev->pdf_memory, gnstr->size, "pdf_text_set_cache");
- if (p == NULL)
- return_error(gs_error_VMerror);
- sprintf(buf, "g%04x", (unsigned int)(glyph & 0xFFFF));
- memcpy(p, buf, 5);
- gnstr->data = p;
+ char buf[6];
+ byte *p;
+
+ gnstr->size = 5;
+ p = (byte *)gs_alloc_string(pdev->pdf_memory, gnstr->size, "pdf_text_set_cache");
+ if (p == NULL)
+ return_error(gs_error_VMerror);
+ sprintf(buf, "g%04x", (unsigned int)(glyph & 0xFFFF));
+ memcpy(p, buf, 5);
+ gnstr->data = p;
} else {
- int code = penum->orig_font->procs.glyph_name(penum->orig_font, glyph, gnstr);
+ int code = penum->orig_font->procs.glyph_name(penum->orig_font, glyph, gnstr);
- if (code < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ if (code < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
}
return 0;
}
@@ -2520,18 +2510,18 @@ pdf_choose_output_glyph_hame(gx_device_pdf *pdev, pdf_text_enum_t *penum, gs_con
*/
int
pdf_default_text_begin(gs_text_enum_t *pte, const gs_text_params_t *text,
- gs_text_enum_t **ppte)
+ gs_text_enum_t **ppte)
{
gs_text_params_t text1 = *text;
if(pte->current_font->FontType == 3 && (text1.operation & TEXT_DO_NONE)) {
- /* We need a real drawing to accumulate charproc. */
- text1.operation &= ~TEXT_DO_NONE;
- text1.operation |= TEXT_DO_DRAW;
+ /* We need a real drawing to accumulate charproc. */
+ text1.operation &= ~TEXT_DO_NONE;
+ text1.operation |= TEXT_DO_DRAW;
}
return gx_default_text_begin(pte->dev, pte->pis, &text1, pte->current_font,
- pte->path, pte->pdcolor, pte->pcpath,
- pte->memory, ppte);
+ pte->path, pte->pdcolor, pte->pcpath,
+ pte->memory, ppte);
}
/*
@@ -2552,34 +2542,34 @@ pdf_text_process(gs_text_enum_t *pte)
#define BUF_SIZE 100 /* arbitrary > 0 */
/* Use a union to ensure alignment. */
union bu_ {
- byte bytes[BUF_SIZE];
- gs_char chars[BUF_SIZE / sizeof(gs_char)];
- gs_glyph glyphs[BUF_SIZE / sizeof(gs_glyph)];
+ byte bytes[BUF_SIZE];
+ gs_char chars[BUF_SIZE / sizeof(gs_char)];
+ gs_glyph glyphs[BUF_SIZE / sizeof(gs_glyph)];
} buf;
if (!penum->pte_default && !penum->charproc_accum) {
- /* Don't need to sync before exiting charproc. */
- code = pdf_prepare_text_drawing(pdev, pte);
- if (code == gs_error_rangecheck) {
- /* Fallback to the default implermentation for handling
- a transparency with CompatibilityLevel<=1.3 . */
- goto default_impl;
- }
- if (code < 0)
- return code;
+ /* Don't need to sync before exiting charproc. */
+ code = pdf_prepare_text_drawing(pdev, pte);
+ if (code == gs_error_rangecheck) {
+ /* Fallback to the default implermentation for handling
+ a transparency with CompatibilityLevel<=1.3 . */
+ goto default_impl;
+ }
+ if (code < 0)
+ return code;
}
if (!penum->pte_default) {
- pdev->charproc_just_accumulated = false;
- if (penum->cdevproc_callout) {
- /* Restore after TEXT_PROCESS_CDEVPROC in scan_cmap_text. */
- penum->current_font = penum->orig_font;
- }
+ pdev->charproc_just_accumulated = false;
+ if (penum->cdevproc_callout) {
+ /* Restore after TEXT_PROCESS_CDEVPROC in scan_cmap_text. */
+ penum->current_font = penum->orig_font;
+ }
}
if (penum->current_font->FontType == ft_user_defined && (penum->text.operation & TEXT_DO_ANY_CHARPATH)
- && !pdev->type3charpath) {
- pdev->type3charpath = true;
- if (!penum->charproc_accum)
- goto default_impl;
+ && !pdev->type3charpath) {
+ pdev->type3charpath = true;
+ if (!penum->charproc_accum)
+ goto default_impl;
}
code = -1; /* to force default implementation */
@@ -2590,163 +2580,163 @@ pdf_text_process(gs_text_enum_t *pte)
top:
pte_default = penum->pte_default;
if (pte_default) {
- if (penum->charproc_accum) {
- gs_const_string gnstr;
-
- code = pdf_choose_output_glyph_hame(pdev, penum, &gnstr, pte_default->returned.current_glyph);
- if (code < 0)
- return code;
-
- if ((penum->current_font->FontType == ft_user_defined) && stell(pdev->strm) == 0)
- {
- char glyph[256], FontName[gs_font_name_max + 1], KeyName[256];
- int len;
-
- len = min(gs_font_name_max, gnstr.size);
- memcpy(glyph, gnstr.data, len);
- glyph[len] = 0x00;
- len = min(gs_font_name_max, penum->current_font->font_name.size);
- memcpy(FontName, penum->current_font->font_name.chars, len);
- FontName[len] = 0x00;
- len = min(gs_font_name_max, penum->current_font->key_name.size);
- memcpy(KeyName, penum->current_font->key_name.chars, len);
- KeyName[len] = 0x00;
-
- emprintf4(pdev->memory,
+ if (penum->charproc_accum) {
+ gs_const_string gnstr;
+
+ code = pdf_choose_output_glyph_hame(pdev, penum, &gnstr, pte_default->returned.current_glyph);
+ if (code < 0)
+ return code;
+
+ if ((penum->current_font->FontType == ft_user_defined) && stell(pdev->strm) == 0)
+ {
+ char glyph[256], FontName[gs_font_name_max + 1], KeyName[256];
+ int len;
+
+ len = min(gs_font_name_max, gnstr.size);
+ memcpy(glyph, gnstr.data, len);
+ glyph[len] = 0x00;
+ len = min(gs_font_name_max, penum->current_font->font_name.size);
+ memcpy(FontName, penum->current_font->font_name.chars, len);
+ FontName[len] = 0x00;
+ len = min(gs_font_name_max, penum->current_font->key_name.size);
+ memcpy(KeyName, penum->current_font->key_name.chars, len);
+ KeyName[len] = 0x00;
+
+ emprintf4(pdev->memory,
"ERROR: Page %d used undefined glyph '%s' from type 3 font '%s', key '%s'\n",
- pdev->next_page, glyph, FontName, KeyName);
- stream_puts(pdev->strm, "0 0 0 0 0 0 d1\n");
- }
-
- /* See below, we scaled the device height and width to prevent
- * clipping of the CharProc operations, now we need to undo that.
- */
- pdev->width /= 100;
- pdev->height /= 100;
- code = pdf_end_charproc_accum(pdev, penum->current_font, penum->cgp,
- pte_default->returned.current_glyph, penum->output_char_code, &gnstr);
- if (code < 0)
- return code;
- penum->charproc_accum = false;
- code = gx_default_text_restore_state(pte_default);
- if (code < 0)
- return code;
- gs_text_release(pte_default, "pdf_text_process");
- penum->pte_default = 0;
- if (!pdev->type3charpath)
- goto top;
- else
- goto default_impl;
- }
- pdev->pte = pte_default; /* CAUTION: See comment in gdevpdfx.h . */
- code = gs_text_process(pte_default);
- pdev->pte = NULL; /* CAUTION: See comment in gdevpdfx.h . */
- pdev->charproc_just_accumulated = false;
- if (code == TEXT_PROCESS_RENDER && !pdev->type3charpath) {
- penum->returned.current_char = pte_default->returned.current_char;
- penum->returned.current_glyph = pte_default->returned.current_glyph;
- pdev->charproc_ctm = penum->pis->ctm;
- if (penum->current_font->FontType == ft_user_defined &&
- penum->outer_CID == GS_NO_GLYPH &&
- !(penum->pte_default->text.operation & TEXT_DO_CHARWIDTH)) {
- /* The condition above must be consistent with one in pdf_text_set_cache,
- which decides to apply pdf_set_charproc_attrs. */
- gs_matrix m;
- pdf_font_resource_t *pdfont;
-
- code = pdf_start_charproc_accum(pdev);
- if (code < 0)
- return code;
-
- /* We need to give FreeType some room for accuracy when
- * retrieving the outline. We will use a scale factor of 100
- * (see below). Because this appears to the regular path
- * handling code as if it were at the page level, the co-ords
- * would be clipped frequently, so we temporarily hack the
- * width and height of the device here to ensure it doesn't.
- * Note that this requires some careful manipulation of the
- * CTM in various places, which want numbers in the font
- * co-ordinate space, not the scaled user space.
- */
- pdev->width *= 100;
- pdev->height *= 100;
-
- pdf_viewer_state_from_imager_state(pdev, pte->pis, pte->pdcolor);
- /* Set line params to unallowed values so that
- they'll synchronize with writing them out on the first use.
- Doing so because PDF viewer inherits them from the
- contents stream when executing the charproc,
- but at this moment we don't know in what contexts
- it will be used. */
- pdev->state.line_params.half_width = -1;
- pdev->state.line_params.start_cap = gs_cap_unknown;
- pdev->state.line_params.end_cap = gs_cap_unknown;
- pdev->state.line_params.dash_cap = gs_cap_unknown;
- pdev->state.line_params.join = gs_join_unknown;
- pdev->state.line_params.miter_limit = -1;
- pdev->state.line_params.dash.pattern_size = -1;
- /* Must set an identity CTM for the charproc accumulation.
- The function show_proceed (called from gs_text_process above)
- executed gsave, so we are safe to change CTM now.
- Note that BuildChar may change CTM before calling setcachedevice. */
- gs_make_identity(&m);
- /* See comment above, we actually want to use a scale factor
- * of 100 in order to give FreeType some room in the fixed
- * precision calculations when retrieing the outline. So in
- * fact we don't use the identity CTM, but a 100x100 matrix
- * Originally tried 1000, but that was too likely to cause
- * clipping or arithmetic overflow.
- */
- gs_matrix_scale(&m, 100, 100, &m);
- gs_matrix_fixed_from_matrix(&penum->pis->ctm, &m);
-
- /* Choose a character code to use with the charproc. */
- code = pdf_choose_output_char_code(pdev, penum, &penum->output_char_code);
- if (code < 0)
- return code;
- code = pdf_attached_font_resource(pdev, penum->current_font, &pdfont, NULL, NULL, NULL, NULL);
- if (code < 0)
- return code;
- pdev->font3 = (pdf_resource_t *)pdfont;
- pdev->substream_Resources = pdfont->u.simple.s.type3.Resources;
- penum->charproc_accum = true;
- return TEXT_PROCESS_RENDER;
- } else
- code += 0; /* A fgood place for breakpoint. */
- }
- gs_text_enum_copy_dynamic(pte, pte_default, true);
- if (code)
- return code;
- gs_text_release(pte_default, "pdf_text_process");
- penum->pte_default = 0;
- if (pdev->type3charpath)
- pdev->type3charpath = false;
- return 0;
+ pdev->next_page, glyph, FontName, KeyName);
+ stream_puts(pdev->strm, "0 0 0 0 0 0 d1\n");
+ }
+
+ /* See below, we scaled the device height and width to prevent
+ * clipping of the CharProc operations, now we need to undo that.
+ */
+ pdev->width /= 100;
+ pdev->height /= 100;
+ code = pdf_end_charproc_accum(pdev, penum->current_font, penum->cgp,
+ pte_default->returned.current_glyph, penum->output_char_code, &gnstr);
+ if (code < 0)
+ return code;
+ penum->charproc_accum = false;
+ code = gx_default_text_restore_state(pte_default);
+ if (code < 0)
+ return code;
+ gs_text_release(pte_default, "pdf_text_process");
+ penum->pte_default = 0;
+ if (!pdev->type3charpath)
+ goto top;
+ else
+ goto default_impl;
+ }
+ pdev->pte = pte_default; /* CAUTION: See comment in gdevpdfx.h . */
+ code = gs_text_process(pte_default);
+ pdev->pte = NULL; /* CAUTION: See comment in gdevpdfx.h . */
+ pdev->charproc_just_accumulated = false;
+ if (code == TEXT_PROCESS_RENDER && !pdev->type3charpath) {
+ penum->returned.current_char = pte_default->returned.current_char;
+ penum->returned.current_glyph = pte_default->returned.current_glyph;
+ pdev->charproc_ctm = penum->pis->ctm;
+ if (penum->current_font->FontType == ft_user_defined &&
+ penum->outer_CID == GS_NO_GLYPH &&
+ !(penum->pte_default->text.operation & TEXT_DO_CHARWIDTH)) {
+ /* The condition above must be consistent with one in pdf_text_set_cache,
+ which decides to apply pdf_set_charproc_attrs. */
+ gs_matrix m;
+ pdf_font_resource_t *pdfont;
+
+ code = pdf_start_charproc_accum(pdev);
+ if (code < 0)
+ return code;
+
+ /* We need to give FreeType some room for accuracy when
+ * retrieving the outline. We will use a scale factor of 100
+ * (see below). Because this appears to the regular path
+ * handling code as if it were at the page level, the co-ords
+ * would be clipped frequently, so we temporarily hack the
+ * width and height of the device here to ensure it doesn't.
+ * Note that this requires some careful manipulation of the
+ * CTM in various places, which want numbers in the font
+ * co-ordinate space, not the scaled user space.
+ */
+ pdev->width *= 100;
+ pdev->height *= 100;
+
+ pdf_viewer_state_from_imager_state(pdev, pte->pis, pte->pdcolor);
+ /* Set line params to unallowed values so that
+ they'll synchronize with writing them out on the first use.
+ Doing so because PDF viewer inherits them from the
+ contents stream when executing the charproc,
+ but at this moment we don't know in what contexts
+ it will be used. */
+ pdev->state.line_params.half_width = -1;
+ pdev->state.line_params.start_cap = gs_cap_unknown;
+ pdev->state.line_params.end_cap = gs_cap_unknown;
+ pdev->state.line_params.dash_cap = gs_cap_unknown;
+ pdev->state.line_params.join = gs_join_unknown;
+ pdev->state.line_params.miter_limit = -1;
+ pdev->state.line_params.dash.pattern_size = -1;
+ /* Must set an identity CTM for the charproc accumulation.
+ The function show_proceed (called from gs_text_process above)
+ executed gsave, so we are safe to change CTM now.
+ Note that BuildChar may change CTM before calling setcachedevice. */
+ gs_make_identity(&m);
+ /* See comment above, we actually want to use a scale factor
+ * of 100 in order to give FreeType some room in the fixed
+ * precision calculations when retrieing the outline. So in
+ * fact we don't use the identity CTM, but a 100x100 matrix
+ * Originally tried 1000, but that was too likely to cause
+ * clipping or arithmetic overflow.
+ */
+ gs_matrix_scale(&m, 100, 100, &m);
+ gs_matrix_fixed_from_matrix(&penum->pis->ctm, &m);
+
+ /* Choose a character code to use with the charproc. */
+ code = pdf_choose_output_char_code(pdev, penum, &penum->output_char_code);
+ if (code < 0)
+ return code;
+ code = pdf_attached_font_resource(pdev, penum->current_font, &pdfont, NULL, NULL, NULL, NULL);
+ if (code < 0)
+ return code;
+ pdev->font3 = (pdf_resource_t *)pdfont;
+ pdev->substream_Resources = pdfont->u.simple.s.type3.Resources;
+ penum->charproc_accum = true;
+ return TEXT_PROCESS_RENDER;
+ } else
+ code += 0; /* A fgood place for breakpoint. */
+ }
+ gs_text_enum_copy_dynamic(pte, pte_default, true);
+ if (code)
+ return code;
+ gs_text_release(pte_default, "pdf_text_process");
+ penum->pte_default = 0;
+ if (pdev->type3charpath)
+ pdev->type3charpath = false;
+ return 0;
}
{
- gs_font *font = pte->orig_font; /* Not sure. Changed for CDevProc callout. Was pte->current_font */
-
- switch (font->FontType) {
- case ft_CID_encrypted:
- case ft_CID_TrueType:
- process = process_cid_text;
- break;
- case ft_encrypted:
- case ft_encrypted2:
- case ft_TrueType:
- case ft_user_defined:
- /* The data may be either glyphs or characters. */
- process = process_plain_text;
- break;
- case ft_composite:
- process =
- (((gs_font_type0 *)font)->data.FMapType == fmap_CMap ?
- process_cmap_text :
- process_composite_text);
- break;
- default:
- goto skip;
- }
+ gs_font *font = pte->orig_font; /* Not sure. Changed for CDevProc callout. Was pte->current_font */
+
+ switch (font->FontType) {
+ case ft_CID_encrypted:
+ case ft_CID_TrueType:
+ process = process_cid_text;
+ break;
+ case ft_encrypted:
+ case ft_encrypted2:
+ case ft_TrueType:
+ case ft_user_defined:
+ /* The data may be either glyphs or characters. */
+ process = process_plain_text;
+ break;
+ case ft_composite:
+ process =
+ (((gs_font_type0 *)font)->data.FMapType == fmap_CMap ?
+ process_cmap_text :
+ process_composite_text);
+ break;
+ default:
+ goto skip;
+ }
}
/*
@@ -2756,74 +2746,74 @@ pdf_text_process(gs_text_enum_t *pte)
*/
if (operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES)) {
- if (size < sizeof(gs_glyph))
- size = sizeof(gs_glyph); /* for process_cid_text */
+ if (size < sizeof(gs_glyph))
+ size = sizeof(gs_glyph); /* for process_cid_text */
} else if (operation & TEXT_FROM_CHARS)
- size *= sizeof(gs_char);
+ size *= sizeof(gs_char);
else if (operation & TEXT_FROM_SINGLE_CHAR)
- size = sizeof(gs_char);
+ size = sizeof(gs_char);
else if (operation & TEXT_FROM_GLYPHS)
- size *= sizeof(gs_glyph);
+ size *= sizeof(gs_glyph);
else if (operation & TEXT_FROM_SINGLE_GLYPH)
- size = sizeof(gs_glyph);
+ size = sizeof(gs_glyph);
else
- goto skip;
+ goto skip;
/* Now that we are using the working buffer for text in composite fonts, we must make sure
* it is large enough. Each input character code may be promoted to a gs_glyph, in scan_cmap_text
* when processing a Type 0 font with a type 1 descendant font. This routine uses
- * pdf_make_text_glyphs_table_unencoded (called from pdf_obtain_font_resource_unencoded) which
+ * pdf_make_text_glyphs_table_unencoded (called from pdf_obtain_font_resource_unencoded) which
* also may require an identically sized buffer, so we need:
* num__input_characters * sizeof(gs_glyph) * 2.
*/
if (pte->orig_font->FontType == ft_composite) {
- if (size < (pte->text.size - pte->index) * sizeof(gs_glyph) * 2)
- size = (pte->text.size - pte->index) * sizeof(gs_glyph) * 2;
+ if (size < (pte->text.size - pte->index) * sizeof(gs_glyph) * 2)
+ size = (pte->text.size - pte->index) * sizeof(gs_glyph) * 2;
}
if (size <= sizeof(buf)) {
- code = process(pte, buf.bytes, size);
+ code = process(pte, buf.bytes, size);
} else {
- byte *buf = gs_alloc_string(pte->memory, size, "pdf_text_process");
+ byte *buf = gs_alloc_string(pte->memory, size, "pdf_text_process");
- if (buf == 0)
- return_error(gs_error_VMerror);
- code = process(pte, buf, size);
- gs_free_string(pte->memory, buf, size, "pdf_text_process");
+ if (buf == 0)
+ return_error(gs_error_VMerror);
+ code = process(pte, buf, size);
+ gs_free_string(pte->memory, buf, size, "pdf_text_process");
}
skip:
- if (code < 0 ||
- (pte->current_font->FontType == ft_user_defined &&
- code != TEXT_PROCESS_INTERVENE &&
- penum->index < penum->text.size)) {
- if (code == gs_error_unregistered) /* Debug purpose only. */
- return code;
- if (code == gs_error_VMerror)
- return code;
- if (code == gs_error_invalidfont) /* Bug 688370. */
- return code;
+ if (code < 0 ||
+ (pte->current_font->FontType == ft_user_defined &&
+ code != TEXT_PROCESS_INTERVENE &&
+ penum->index < penum->text.size)) {
+ if (code == gs_error_unregistered) /* Debug purpose only. */
+ return code;
+ if (code == gs_error_VMerror)
+ return code;
+ if (code == gs_error_invalidfont) /* Bug 688370. */
+ return code;
default_impl:
- /* Fall back to the default implementation. */
- code = pdf_default_text_begin(pte, &pte->text, &pte_default);
- if (code < 0)
- return code;
- penum->pte_default = pte_default;
- gs_text_enum_copy_dynamic(pte_default, pte, false);
+ /* Fall back to the default implementation. */
+ code = pdf_default_text_begin(pte, &pte->text, &pte_default);
+ if (code < 0)
+ return code;
+ penum->pte_default = pte_default;
+ gs_text_enum_copy_dynamic(pte_default, pte, false);
}
/* The 'process' procedure might also have set pte_default itself. */
if (penum->pte_default && !code)
- goto top;
+ goto top;
return code;
/*
* This function uses an unobvious algorithm while handling type 3 fonts.
* It runs 'process' to copy text until a glyph, which was not copied to
* output font. Then it installs pte_default and falls back to default
- * implementation with PS interpreter callout. The callout executes
+ * implementation with PS interpreter callout. The callout executes
* BuildChar/BuildGlyph with setcachedevice. The latter calls
- * pdf_set_charproc_attrs, which sets up an accumulator
+ * pdf_set_charproc_attrs, which sets up an accumulator
* of graphic objects to a pdf_begin_resource stream.
* When the callout completes, pdf_text_process calls pdf_end_charproc_accum
- * and later resumes the normal (non-default) text enumeration, repeating the
+ * and later resumes the normal (non-default) text enumeration, repeating the
* the "callouted" glyph AT SECOND TIME. We can't do without the second pass
* becauase in the first pass the glyph widths is unknown.
*/
diff --git a/gs/base/gdevpdtt.h b/gs/base/gdevpdtt.h
index ed69793b0..e0fef5232 100644
--- a/gs/base/gdevpdtt.h
+++ b/gs/base/gdevpdtt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -162,51 +162,51 @@ typedef struct pdf_glyph_widths_s {
*/
int pdf_font_orig_matrix(const gs_font *font, gs_matrix *pmat);
-/*
- * Check the Encoding compatibility
+/*
+ * Check the Encoding compatibility
*/
-bool pdf_check_encoding_compatibility(const pdf_font_resource_t *pdfont,
- const pdf_char_glyph_pair_t *pairs, int num_chars);
+bool pdf_check_encoding_compatibility(const pdf_font_resource_t *pdfont,
+ const pdf_char_glyph_pair_t *pairs, int num_chars);
/*
* Create or find a font resource object for a text.
*/
int
-pdf_obtain_font_resource(pdf_text_enum_t *penum,
- const gs_string *pstr, pdf_font_resource_t **ppdfont);
+pdf_obtain_font_resource(pdf_text_enum_t *penum,
+ const gs_string *pstr, pdf_font_resource_t **ppdfont);
/*
* Create or find a font resource object for a glyphshow text.
*/
-int pdf_obtain_font_resource_unencoded(pdf_text_enum_t *penum,
- const gs_string *pstr, pdf_font_resource_t **ppdfont, const gs_glyph *gdata);
+int pdf_obtain_font_resource_unencoded(pdf_text_enum_t *penum,
+ const gs_string *pstr, pdf_font_resource_t **ppdfont, const gs_glyph *gdata);
/*
* Create or find a CID font resource object for a glyph set.
*/
-int pdf_obtain_cidfont_resource(gx_device_pdf *pdev, gs_font *subfont,
- pdf_font_resource_t **ppdsubf,
- pdf_char_glyph_pairs_t *cgp);
+int pdf_obtain_cidfont_resource(gx_device_pdf *pdev, gs_font *subfont,
+ pdf_font_resource_t **ppdsubf,
+ pdf_char_glyph_pairs_t *cgp);
/*
* Create or find a parent Type 0 font resource object for a CID font resource.
*/
-int pdf_obtain_parent_type0_font_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdsubf,
- uint font_index, const gs_const_string *CMapName, pdf_font_resource_t **pdfont);
+int pdf_obtain_parent_type0_font_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdsubf,
+ uint font_index, const gs_const_string *CMapName, pdf_font_resource_t **pdfont);
/*
* Retrive font resource attached to a font.
* allocating glyph_usage and real_widths on request.
*/
-int pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **pdfont, byte **glyph_usage,
- double **real_widths, int *num_chars, int *num_widths);
+int pdf_attached_font_resource(gx_device_pdf *pdev, gs_font *font,
+ pdf_font_resource_t **pdfont, byte **glyph_usage,
+ double **real_widths, int *num_chars, int *num_widths);
/*
* Attach font resource to a font.
*/
-int pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t *pdfont);
+int pdf_attach_font_resource(gx_device_pdf *pdev, gs_font *font,
+ pdf_font_resource_t *pdfont);
/*
* Locate a font cache element.
@@ -218,7 +218,7 @@ pdf_locate_font_cache_elem(gx_device_pdf *pdev, gs_font *font);
* Create a font resource object for a gs_font of Type 3.
*/
int pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
- pdf_font_resource_t **ppdfont);
+ pdf_font_resource_t **ppdfont);
/*
* Compute the cached values in the text processing state from the text
@@ -228,9 +228,9 @@ int pdf_make_font3_resource(gx_device_pdf *pdev, gs_font *font,
* TEXT_ADD_TO_SPACE_WIDTH.
*/
int pdf_update_text_state(pdf_text_process_state_t *ppts,
- const pdf_text_enum_t *penum,
- pdf_font_resource_t *pdfont,
- const gs_matrix *pfmat);
+ const pdf_text_enum_t *penum,
+ pdf_font_resource_t *pdfont,
+ const gs_matrix *pfmat);
/*
* Set up commands to make the output state match the processing state.
@@ -238,8 +238,8 @@ int pdf_update_text_state(pdf_text_process_state_t *ppts,
* are written later.
*/
int pdf_set_text_process_state(gx_device_pdf *pdev,
- const gs_text_enum_t *pte, /*for pdcolor, pis*/
- pdf_text_process_state_t *ppts);
+ const gs_text_enum_t *pte, /*for pdcolor, pis*/
+ pdf_text_process_state_t *ppts);
/*
* Get the widths (unmodified and possibly modified) of a glyph in a (base)
@@ -250,14 +250,14 @@ int pdf_set_text_process_state(gx_device_pdf *pdev,
* cdevproc_result != NULL if we restart after a CDevProc callout.
*/
int pdf_glyph_widths(pdf_font_resource_t *pdfont, int wmode, gs_glyph glyph,
- gs_font *font, pdf_glyph_widths_t *pwidths,
- const double cdevproc_result[10]);
+ gs_font *font, pdf_glyph_widths_t *pwidths,
+ const double cdevproc_result[10]);
/*
* Fall back to the default text processing code when needed.
*/
int pdf_default_text_begin(gs_text_enum_t *pte, const gs_text_params_t *text,
- gs_text_enum_t **ppte);
+ gs_text_enum_t **ppte);
/*
* Check for simple font.
@@ -289,8 +289,8 @@ PROCESS_TEXT_PROC(process_plain_text);
* Process a string with a simple gs_font.
*/
int pdf_process_string_aux(pdf_text_enum_t *penum, gs_string *pstr,
- const gs_glyph *gdata, const gs_matrix *pfmat,
- pdf_text_process_state_t *ppts);
+ const gs_glyph *gdata, const gs_matrix *pfmat,
+ pdf_text_process_state_t *ppts);
/*
* Emulate TEXT_ADD_TO_ALL_WIDTHS and/or TEXT_ADD_TO_SPACE_WIDTH,
@@ -298,17 +298,17 @@ int pdf_process_string_aux(pdf_text_enum_t *penum, gs_string *pstr,
* Uses and updates ppts->values.matrix; uses ppts->values.pdfont.
*/
int process_text_modify_width(pdf_text_enum_t *pte, gs_font *font,
- pdf_text_process_state_t *ppts,
- const gs_const_string *pstr,
- gs_point *pdpt, const gs_glyph *gdata, bool composite);
+ pdf_text_process_state_t *ppts,
+ const gs_const_string *pstr,
+ gs_point *pdpt, const gs_glyph *gdata, bool composite);
-/*
+/*
* Add char code pair to ToUnicode CMap,
* creating the CMap on neccessity.
*/
int
-pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfont,
- gs_glyph glyph, gs_char ch, const gs_const_string *gnstr);
+pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfont,
+ gs_glyph glyph, gs_char ch, const gs_const_string *gnstr);
/*
* Get character code from a glyph code.
@@ -316,13 +316,13 @@ pdf_add_ToUnicode(gx_device_pdf *pdev, gs_font *font, pdf_font_resource_t *pdfon
* because a glyph may be unlisted in Encoding.
*/
int pdf_encode_glyph(gs_font_base *bfont, gs_glyph glyph0,
- byte *buf, int buf_size, int *char_code_length);
+ byte *buf, int buf_size, int *char_code_length);
int pdf_shift_text_currentpoint(pdf_text_enum_t *penum, gs_point *wpt);
void adjust_first_last_char(pdf_font_resource_t *pdfont, byte *str, int size);
-float pdf_calculate_text_size(gs_imager_state *pis, pdf_font_resource_t *pdfont,
- const gs_matrix *pfmat, gs_matrix *smat, gs_matrix *tmat,
- gs_font *font, gx_device_pdf *pdev);
+float pdf_calculate_text_size(gs_imager_state *pis, pdf_font_resource_t *pdfont,
+ const gs_matrix *pfmat, gs_matrix *smat, gs_matrix *tmat,
+ gs_font *font, gx_device_pdf *pdev);
#endif /* gdevpdtt_INCLUDED */
diff --git a/gs/base/gdevpdtv.c b/gs/base/gdevpdtv.c
index 1b84285bb..cffef2706 100644
--- a/gs/base/gdevpdtv.c
+++ b/gs/base/gdevpdtv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpdtv.h b/gs/base/gdevpdtv.h
index 37a858e94..7e5da651e 100644
--- a/gs/base/gdevpdtv.h
+++ b/gs/base/gdevpdtv.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpdtw.c b/gs/base/gdevpdtw.c
index 5b3bb8bd5..db70d6b98 100644
--- a/gs/base/gdevpdtw.c
+++ b/gs/base/gdevpdtw.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,20 +46,20 @@ pdf_write_Widths(gx_device_pdf *pdev, int first, int last, const double *widths)
int i;
if (first > last)
- first = last = 0;
+ first = last = 0;
pprintd2(s, "/FirstChar %d/LastChar %d/Widths[", first, last);
for (i = first; i <= last; ++i)
- pprintg1(s, (i & 15 ? " %g" : "\n%g"), psdf_round(widths[i], 100, 10));
+ pprintg1(s, (i & 15 ? " %g" : "\n%g"), psdf_round(widths[i], 100, 10));
stream_puts(s, "]\n");
return 0;
}
/* Check strings equality. */
-static bool
+static bool
strings_equal(const gs_const_string *str0, const gs_const_string *str1)
{
return str0->size == str1->size &&
- !memcmp(str0->data, str1->data, str0->size);
+ !memcmp(str0->data, str1->data, str0->size);
}
/* Check if an encoding element differs from a standard one. */
@@ -67,18 +67,18 @@ static int
pdf_different_encoding_element(const pdf_font_resource_t *pdfont, int ch, int encoding_index)
{
if (pdfont->u.simple.Encoding[ch].is_difference)
- return 1;
+ return 1;
else if (encoding_index != ENCODING_INDEX_UNKNOWN) {
- gs_glyph glyph0 = gs_c_known_encode(ch, encoding_index);
- gs_glyph glyph1 = pdfont->u.simple.Encoding[ch].glyph;
- gs_const_string str;
- int code = gs_c_glyph_name(glyph0, &str);
-
- if (code < 0)
- return code; /* Must not happen */
- if (glyph1 != GS_NO_GLYPH)
- if (!strings_equal(&str, &pdfont->u.simple.Encoding[ch].str))
- return 1;
+ gs_glyph glyph0 = gs_c_known_encode(ch, encoding_index);
+ gs_glyph glyph1 = pdfont->u.simple.Encoding[ch].glyph;
+ gs_const_string str;
+ int code = gs_c_glyph_name(glyph0, &str);
+
+ if (code < 0)
+ return code; /* Must not happen */
+ if (glyph1 != GS_NO_GLYPH)
+ if (!strings_equal(&str, &pdfont->u.simple.Encoding[ch].str))
+ return 1;
}
return 0;
}
@@ -91,11 +91,11 @@ pdf_different_encoding_index(const pdf_font_resource_t *pdfont, int ch0)
int ch, code;
for (ch = ch0; ch < 256; ++ch) {
- code = pdf_different_encoding_element(pdfont, ch, base_encoding);
- if (code < 0)
- return code; /* Must not happen */
- if (code)
- break;
+ code = pdf_different_encoding_element(pdfont, ch, base_encoding);
+ if (code < 0)
+ return code; /* Must not happen */
+ if (code)
+ break;
}
return ch;
}
@@ -105,41 +105,41 @@ static bool
pdf_simple_font_needs_ToUnicode(const pdf_font_resource_t *pdfont)
{
int ch;
- unsigned char mask = (pdfont->FontType == ft_encrypted || pdfont->FontType == ft_encrypted2
- ? GS_C_PDF_GOOD_GLYPH_MASK : GS_C_PDF_GOOD_NON_SYMBOL_MASK);
+ unsigned char mask = (pdfont->FontType == ft_encrypted || pdfont->FontType == ft_encrypted2
+ ? GS_C_PDF_GOOD_GLYPH_MASK : GS_C_PDF_GOOD_NON_SYMBOL_MASK);
if (pdfont->u.simple.Encoding == NULL)
- return true; /* Bitmap Type 3 fonts have no pdfont->u.simple.Encoding . */
+ return true; /* Bitmap Type 3 fonts have no pdfont->u.simple.Encoding . */
if (pdfont->FontType == ft_TrueType)
- /*
- TrueType fonts are always written as symbolic, and so they do not have
- an Encoding entry (SVN revision 11735, bugs #690744, #691036, #691319).
- In this circumstance, write the ToUnicode map to get a searchable PDF.
- */
- return true;
+ /*
+ TrueType fonts are always written as symbolic, and so they do not have
+ an Encoding entry (SVN revision 11735, bugs #690744, #691036, #691319).
+ In this circumstance, write the ToUnicode map to get a searchable PDF.
+ */
+ return true;
for (ch = 0; ch < 256; ++ch) {
- pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
- gs_glyph glyph = pet->glyph;
-
- if (glyph == GS_NO_GLYPH)
- continue;
- if (glyph < gs_c_min_std_encoding_glyph || glyph >= GS_MIN_CID_GLYPH) {
- if (pet->str.size == 0)
- return true;
- glyph = gs_c_name_glyph(pet->str.data, pet->str.size);
- if (glyph == GS_NO_GLYPH)
- return true;
- }
+ pdf_encoding_element_t *pet = &pdfont->u.simple.Encoding[ch];
+ gs_glyph glyph = pet->glyph;
+
+ if (glyph == GS_NO_GLYPH)
+ continue;
+ if (glyph < gs_c_min_std_encoding_glyph || glyph >= GS_MIN_CID_GLYPH) {
+ if (pet->str.size == 0)
+ return true;
+ glyph = gs_c_name_glyph(pet->str.data, pet->str.size);
+ if (glyph == GS_NO_GLYPH)
+ return true;
+ }
glyph -= gs_c_min_std_encoding_glyph;
if( glyph > GS_C_PDF_MAX_GOOD_GLYPH ||
- !(gs_c_pdf_glyph_type[glyph >> 2] & (mask << (( glyph & 3 )<<1) )))
+ !(gs_c_pdf_glyph_type[glyph >> 2] & (mask << (( glyph & 3 )<<1) )))
return true;
}
return false;
}
/* Write Encoding differencrs. */
-int
+int
pdf_write_encoding(gx_device_pdf *pdev, const pdf_font_resource_t *pdfont, long id, int ch)
{
/* Note : this truncates extended glyph names to original names. */
@@ -152,42 +152,42 @@ pdf_write_encoding(gx_device_pdf *pdev, const pdf_font_resource_t *pdfont, long
s = pdev->strm;
stream_puts(s, "<</Type/Encoding");
if (base_encoding < 0 && pdev->ForOPDFRead)
- base_encoding = ENCODING_INDEX_STANDARD;
+ base_encoding = ENCODING_INDEX_STANDARD;
if (base_encoding > 0)
- pprints1(s, "/BaseEncoding/%s", encoding_names[base_encoding]);
+ pprints1(s, "/BaseEncoding/%s", encoding_names[base_encoding]);
stream_puts(s, "/Differences[");
for (; ch < 256; ++ch) {
- code = pdf_different_encoding_element(pdfont, ch, base_encoding);
- if (code < 0)
- return code; /* Must not happen */
- if (code == 0 && pdfont->FontType == ft_user_defined) {
- /* PDF 1.4 spec Appendix H Note 42 says that
- * Acrobat 4 can't properly handle Base Encoding.
- * Enforce writing differences against that.
- */
- if (pdfont->used[ch >> 3] & 0x80 >> (ch & 7))
- if (pdfont->u.simple.Encoding[ch].str.size)
- code = 1;
- }
- if (code) {
- const byte *d = pdfont->u.simple.Encoding[ch].str.data;
- int i, l = pdfont->u.simple.Encoding[ch].str.size;
-
- if (pdev->HavePDFWidths) {
- for (i = 0; i + sl < l; i++)
- if (!memcmp(d + i, gx_extendeg_glyph_name_separator, sl)) {
- l = i;
- break;
- }
- }
- if (ch != prev + 1) {
- pprintd1(s, "\n%d", ch);
- cnt = 1;
- } else if (!(cnt++ & 15))
- stream_puts(s, "\n");
- pdf_put_name(pdev, d, l);
- prev = ch;
- }
+ code = pdf_different_encoding_element(pdfont, ch, base_encoding);
+ if (code < 0)
+ return code; /* Must not happen */
+ if (code == 0 && pdfont->FontType == ft_user_defined) {
+ /* PDF 1.4 spec Appendix H Note 42 says that
+ * Acrobat 4 can't properly handle Base Encoding.
+ * Enforce writing differences against that.
+ */
+ if (pdfont->used[ch >> 3] & 0x80 >> (ch & 7))
+ if (pdfont->u.simple.Encoding[ch].str.size)
+ code = 1;
+ }
+ if (code) {
+ const byte *d = pdfont->u.simple.Encoding[ch].str.data;
+ int i, l = pdfont->u.simple.Encoding[ch].str.size;
+
+ if (pdev->HavePDFWidths) {
+ for (i = 0; i + sl < l; i++)
+ if (!memcmp(d + i, gx_extendeg_glyph_name_separator, sl)) {
+ l = i;
+ break;
+ }
+ }
+ if (ch != prev + 1) {
+ pprintd1(s, "\n%d", ch);
+ cnt = 1;
+ } else if (!(cnt++ & 15))
+ stream_puts(s, "\n");
+ pdf_put_name(pdev, d, l);
+ prev = ch;
+ }
}
stream_puts(s, "]>>\n");
pdf_end_separate(pdev, resourceEncoding);
@@ -197,15 +197,15 @@ pdf_write_encoding(gx_device_pdf *pdev, const pdf_font_resource_t *pdfont, long
/* Write Encoding reference. */
int
pdf_write_encoding_ref(gx_device_pdf *pdev,
- const pdf_font_resource_t *pdfont, long id)
+ const pdf_font_resource_t *pdfont, long id)
{
stream *s = pdev->strm;
if (id != 0)
- pprintld1(s, "/Encoding %ld 0 R", id);
+ pprintld1(s, "/Encoding %ld 0 R", id);
else if (pdfont->u.simple.BaseEncoding > 0) {
- gs_encoding_index_t base_encoding = pdfont->u.simple.BaseEncoding;
- pprints1(s, "/Encoding/%s", encoding_names[base_encoding]);
+ gs_encoding_index_t base_encoding = pdfont->u.simple.BaseEncoding;
+ pprints1(s, "/Encoding/%s", encoding_names[base_encoding]);
}
return 0;
}
@@ -213,7 +213,7 @@ pdf_write_encoding_ref(gx_device_pdf *pdev,
/* Write the Subtype and Encoding for a simple font. */
static int
pdf_write_simple_contents(gx_device_pdf *pdev,
- const pdf_font_resource_t *pdfont)
+ const pdf_font_resource_t *pdfont)
{
stream *s = pdev->strm;
long diff_id = 0;
@@ -222,19 +222,19 @@ pdf_write_simple_contents(gx_device_pdf *pdev,
ch = pdf_different_encoding_index(pdfont, ch);
if (ch < 256)
- diff_id = pdf_obj_ref(pdev);
+ diff_id = pdf_obj_ref(pdev);
code = pdf_write_encoding_ref(pdev, pdfont, diff_id);
if (code < 0)
- return code;
+ return code;
pprints1(s, "/Subtype/%s>>\n",
- (pdfont->FontType == ft_TrueType ? "TrueType" :
- pdfont->u.simple.s.type1.is_MM_instance ? "MMType1" : "Type1"));
+ (pdfont->FontType == ft_TrueType ? "TrueType" :
+ pdfont->u.simple.s.type1.is_MM_instance ? "MMType1" : "Type1"));
pdf_end_separate(pdev, resourceFont);
if (diff_id) {
- mark_font_descriptor_symbolic(pdfont);
- code = pdf_write_encoding(pdev, pdfont, diff_id, ch);
- if (code < 0)
- return code;
+ mark_font_descriptor_symbolic(pdfont);
+ code = pdf_write_encoding(pdev, pdfont, diff_id, ch);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -259,42 +259,42 @@ pdf_compute_CIDFont_default_widths(const pdf_font_resource_t *pdfont, int wmode,
* and use the corresponding sign.
* fixme : implement 2 hystograms.
*/
- psf_enumerate_bits_begin(&genum, NULL,
- wmode ? pdfont->u.cidfont.used2 : pdfont->used,
- pdfont->count, GLYPH_SPACE_INDEX);
+ psf_enumerate_bits_begin(&genum, NULL,
+ wmode ? pdfont->u.cidfont.used2 : pdfont->used,
+ pdfont->count, GLYPH_SPACE_INDEX);
memset(counts, 0, sizeof(counts));
while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
int i = glyph - GS_MIN_CID_GLYPH;
- if ( i < pdfont->count) { /* safety */
- int width = (int)(w[i] + 0.5);
+ if ( i < pdfont->count) { /* safety */
+ int width = (int)(w[i] + 0.5);
- counts[min(any_abs(width), countof(counts) - 1)]++;
- if (width > 0)
- pos_count++;
- else if (width < 0)
- neg_count++;
- }
+ counts[min(any_abs(width), countof(counts) - 1)]++;
+ if (width > 0)
+ pos_count++;
+ else if (width < 0)
+ neg_count++;
+ }
}
for (i = 1; i < countof(counts); ++i)
- if (counts[i] > dw_count)
- dwi = i, dw_count = counts[i];
+ if (counts[i] > dw_count)
+ dwi = i, dw_count = counts[i];
*pdw = (neg_count > pos_count ? -dwi : dwi);
*pdv = 0;
if (wmode) {
- psf_enumerate_glyphs_reset(&genum);
- while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
- int i = glyph - GS_MIN_CID_GLYPH;
-
- if ( i < pdfont->count) { /* safety */
- int width = (int)(w[i] + 0.5);
-
- if (min(any_abs(width), countof(counts) - 1) == any_abs(dwi)) {
- *pdv = (int)(pdfont->u.cidfont.v[i * 2 + 1] + 0.5);
- break;
- }
- }
- }
+ psf_enumerate_glyphs_reset(&genum);
+ while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
+ int i = glyph - GS_MIN_CID_GLYPH;
+
+ if ( i < pdfont->count) { /* safety */
+ int width = (int)(w[i] + 0.5);
+
+ if (min(any_abs(width), countof(counts) - 1) == any_abs(dwi)) {
+ *pdv = (int)(pdfont->u.cidfont.v[i * 2 + 1] + 0.5);
+ break;
+ }
+ }
+ }
}
return (dw_count + counts[0] > 0);
}
@@ -305,7 +305,7 @@ pdf_compute_CIDFont_default_widths(const pdf_font_resource_t *pdfont, int wmode,
*/
static int
pdf_write_CIDFont_widths(gx_device_pdf *pdev,
- const pdf_font_resource_t *pdfont, int wmode)
+ const pdf_font_resource_t *pdfont, int wmode)
{
/*
* The values of the CIDFont width keys are as follows:
@@ -323,84 +323,84 @@ pdf_write_CIDFont_widths(gx_device_pdf *pdev,
/* Compute and write default width : */
if (pdf_compute_CIDFont_default_widths(pdfont, wmode, &dw, &dv)) {
- if (wmode) {
- pprintd2(s, "/DW2 [%d %d]\n", dv, dw);
- } else
- pprintd1(s, "/DW %d\n", dw);
+ if (wmode) {
+ pprintd2(s, "/DW2 [%d %d]\n", dv, dw);
+ } else
+ pprintd1(s, "/DW %d\n", dw);
}
/*
* Now write all widths different from the default one. Currently we make no
* attempt to optimize this: we write every width individually.
*/
- psf_enumerate_bits_begin(&genum, NULL,
- wmode ? pdfont->u.cidfont.used2 : pdfont->used,
- pdfont->count, GLYPH_SPACE_INDEX);
+ psf_enumerate_bits_begin(&genum, NULL,
+ wmode ? pdfont->u.cidfont.used2 : pdfont->used,
+ pdfont->count, GLYPH_SPACE_INDEX);
{
- while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
- int cid = glyph - GS_MIN_CID_GLYPH;
- int width = (int)(w[cid] + 0.5);
+ while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
+ int cid = glyph - GS_MIN_CID_GLYPH;
+ int width = (int)(w[cid] + 0.5);
#if 0 /* Must write zero widths - see test file of the bug Bug 687681.
- We don't enumerate unused glyphs here due to pdfont->used. */
- if (width == 0)
- continue; /* Don't write for unused glyphs. */
+ We don't enumerate unused glyphs here due to pdfont->used. */
+ if (width == 0)
+ continue; /* Don't write for unused glyphs. */
#else
- { /* Check whether copied font really have this glyph.
- debugged with 401-01.ps, which uses undefined CIDs. */
- gs_font_base *pfont = pdf_font_resource_font(pdfont, false);
- gs_glyph_info_t info;
-
- if (pfont->FontType == ft_TrueType) {
- /* We're converting a Type 42 into CIDFontType2. */
- /* We know that CIDs equal to char codes. */
- gs_glyph glyph1;
- int ch = glyph & 0xff;
-
- glyph1 = pfont->procs.encode_char((gs_font *)pfont, ch, GLYPH_SPACE_NAME);
- if (cid == 0 && glyph1 == GS_NO_GLYPH)
- glyph1 = copied_get_notdef((gs_font *)pdf_font_resource_font(pdfont, false));
- if (glyph1 == GS_NO_GLYPH)
- continue;
- if (pfont->procs.glyph_info((gs_font *)pfont, glyph1, NULL, 0, &info) < 0)
- continue;
- } else if (pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL, 0, &info) < 0)
- continue;
- }
+ { /* Check whether copied font really have this glyph.
+ debugged with 401-01.ps, which uses undefined CIDs. */
+ gs_font_base *pfont = pdf_font_resource_font(pdfont, false);
+ gs_glyph_info_t info;
+
+ if (pfont->FontType == ft_TrueType) {
+ /* We're converting a Type 42 into CIDFontType2. */
+ /* We know that CIDs equal to char codes. */
+ gs_glyph glyph1;
+ int ch = glyph & 0xff;
+
+ glyph1 = pfont->procs.encode_char((gs_font *)pfont, ch, GLYPH_SPACE_NAME);
+ if (cid == 0 && glyph1 == GS_NO_GLYPH)
+ glyph1 = copied_get_notdef((gs_font *)pdf_font_resource_font(pdfont, false));
+ if (glyph1 == GS_NO_GLYPH)
+ continue;
+ if (pfont->procs.glyph_info((gs_font *)pfont, glyph1, NULL, 0, &info) < 0)
+ continue;
+ } else if (pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL, 0, &info) < 0)
+ continue;
+ }
#endif
- if (cid == prev + 1) {
- if (wmode) {
- int vx = (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5);
- int vy = (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5);
-
- pprintd3(s, "\n%d %d %d", width, vx, vy);
- } else
- pprintd1(s, "\n%d", width);
- } else if (!pdev->PDFA && width == dw &&
- (!wmode || (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5) ==
- (int)(pdfont->Widths[cid] / 2 + 0.5)) &&
- (!wmode || (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5) == dv))
- continue;
- else {
- if (prev >= 0)
- stream_puts(s, "]\n");
- else {
- stream_puts(s, Widths_key);
- stream_puts(s, "[");
- }
- if (wmode) {
- int vx = (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5);
- int vy = (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5);
-
- pprintd4(s, "%d[%d %d %d", cid, width, vx, vy);
- } else
- pprintd2(s, "%d[%d", cid, width);
- }
- prev = cid;
- }
- if (prev >= 0)
- stream_puts(s, "]]\n");
- }
+ if (cid == prev + 1) {
+ if (wmode) {
+ int vx = (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5);
+ int vy = (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5);
+
+ pprintd3(s, "\n%d %d %d", width, vx, vy);
+ } else
+ pprintd1(s, "\n%d", width);
+ } else if (!pdev->PDFA && width == dw &&
+ (!wmode || (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5) ==
+ (int)(pdfont->Widths[cid] / 2 + 0.5)) &&
+ (!wmode || (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5) == dv))
+ continue;
+ else {
+ if (prev >= 0)
+ stream_puts(s, "]\n");
+ else {
+ stream_puts(s, Widths_key);
+ stream_puts(s, "[");
+ }
+ if (wmode) {
+ int vx = (int)(pdfont->u.cidfont.v[cid * 2 + 0] + 0.5);
+ int vy = (int)(pdfont->u.cidfont.v[cid * 2 + 1] + 0.5);
+
+ pprintd4(s, "%d[%d %d %d", cid, width, vx, vy);
+ } else
+ pprintd2(s, "%d[%d", cid, width);
+ }
+ prev = cid;
+ }
+ if (prev >= 0)
+ stream_puts(s, "]]\n");
+ }
return 0;
}
@@ -418,9 +418,9 @@ pdf_write_contents_type0(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
* creating the font resource.
*/
if (pdfont->u.type0.Encoding_name[0])
- pprints1(s, "/Encoding %s", pdfont->u.type0.Encoding_name);
+ pprints1(s, "/Encoding %s", pdfont->u.type0.Encoding_name);
pprintld1(s, "/DescendantFonts[%ld 0 R]",
- pdf_font_id(pdfont->u.type0.DescendantFont));
+ pdf_font_id(pdfont->u.type0.DescendantFont));
stream_puts(s, "/Subtype/Type0>>\n");
pdf_end_separate(pdev, resourceFont);
return 0;
@@ -432,13 +432,13 @@ pdf_write_contents_type0(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
*/
int
pdf_finish_write_contents_type3(gx_device_pdf *pdev,
- pdf_font_resource_t *pdfont)
+ pdf_font_resource_t *pdfont)
{
stream *s = pdev->strm;
pdf_write_font_bbox_float(pdev, &pdfont->u.simple.s.type3.FontBBox);
- pdf_write_Widths(pdev, pdfont->u.simple.FirstChar,
- pdfont->u.simple.LastChar, pdfont->Widths);
+ pdf_write_Widths(pdev, pdfont->u.simple.FirstChar,
+ pdfont->u.simple.LastChar, pdfont->Widths);
stream_puts(s, "/Subtype/Type3>>\n");
pdf_end_separate(pdev, resourceFont);
return 0;
@@ -456,36 +456,36 @@ int
pdf_write_contents_simple(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
{
pdf_write_Widths(pdev, pdfont->u.simple.FirstChar,
- pdfont->u.simple.LastChar, pdfont->Widths);
+ pdfont->u.simple.LastChar, pdfont->Widths);
return pdf_write_simple_contents(pdev, pdfont);
}
/* Write the contents of a CIDFont resource. */
static int
write_contents_cid_common(gx_device_pdf *pdev, pdf_font_resource_t *pdfont,
- int subtype)
+ int subtype)
{
/* Write [D]W[2], CIDSystemInfo, and Subtype, and close the object. */
stream *s = pdev->strm;
int code;
if (pdfont->Widths != 0) {
- code = pdf_write_CIDFont_widths(pdev, pdfont, 0);
- if (code < 0)
- return code;
+ code = pdf_write_CIDFont_widths(pdev, pdfont, 0);
+ if (code < 0)
+ return code;
} else {
- /* With a vertical font, the viewer uses /DW
- to determine glyph width to compute its v-vector. */
- stream_puts(s, "/DW 0\n");
+ /* With a vertical font, the viewer uses /DW
+ to determine glyph width to compute its v-vector. */
+ stream_puts(s, "/DW 0\n");
}
if (pdfont->u.cidfont.Widths2 != 0) {
- code = pdf_write_CIDFont_widths(pdev, pdfont, 1);
- if (code < 0)
- return code;
+ code = pdf_write_CIDFont_widths(pdev, pdfont, 1);
+ if (code < 0)
+ return code;
}
if (pdfont->u.cidfont.CIDSystemInfo_id)
- pprintld1(s, "/CIDSystemInfo %ld 0 R",
- pdfont->u.cidfont.CIDSystemInfo_id);
+ pprintld1(s, "/CIDSystemInfo %ld 0 R",
+ pdfont->u.cidfont.CIDSystemInfo_id);
pprintd1(s, "/Subtype/CIDFontType%d>>\n", subtype);
pdf_end_separate(pdev, resourceFont);
return 0;
@@ -506,44 +506,44 @@ pdf_write_contents_cid2(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
/* Check for the identity CIDMap. */
psf_enumerate_bits_begin(&genum, NULL, pdfont->used, count,
- GLYPH_SPACE_INDEX);
+ GLYPH_SPACE_INDEX);
while (!psf_enumerate_glyphs_next(&genum, &glyph)) {
- int cid = glyph - GS_MIN_CID_GLYPH;
- int gid = pdfont->u.cidfont.CIDToGIDMap[cid];
-
- if (gid != cid) { /* non-identity map */
- map_id = pdf_obj_ref(pdev);
- pprintld1(pdev->strm, "/CIDToGIDMap %ld 0 R\n", map_id);
- break;
- }
+ int cid = glyph - GS_MIN_CID_GLYPH;
+ int gid = pdfont->u.cidfont.CIDToGIDMap[cid];
+
+ if (gid != cid) { /* non-identity map */
+ map_id = pdf_obj_ref(pdev);
+ pprintld1(pdev->strm, "/CIDToGIDMap %ld 0 R\n", map_id);
+ break;
+ }
}
if (map_id == 0 && pdf_font_descriptor_embedding(pdfont->FontDescriptor)) {
- code = stream_puts(pdev->strm, "/CIDToGIDMap /Identity\n");
- if (code < 0)
- return code;
+ code = stream_puts(pdev->strm, "/CIDToGIDMap /Identity\n");
+ if (code < 0)
+ return code;
}
code = write_contents_cid_common(pdev, pdfont, 2);
if (code < 0)
- return code;
+ return code;
if (map_id && pdf_font_descriptor_embedding(pdfont->FontDescriptor)) {
- pdf_data_writer_t writer;
- int i;
-
- pdf_begin_data_stream(pdev, &writer,
- DATA_STREAM_BINARY | (pdev->CompressFonts ? DATA_STREAM_COMPRESS : 0),
- /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
- See comment in pdf_begin_encrypt. */
- map_id);
- for (i = 0; i < count; ++i) {
- uint gid = pdfont->u.cidfont.CIDToGIDMap[i];
-
- stream_putc(writer.binary.strm, (byte)(gid >> 8));
- stream_putc(writer.binary.strm, (byte)(gid));
- }
- code = pdf_end_data(&writer);
+ pdf_data_writer_t writer;
+ int i;
+
+ pdf_begin_data_stream(pdev, &writer,
+ DATA_STREAM_BINARY | (pdev->CompressFonts ? DATA_STREAM_COMPRESS : 0),
+ /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
+ See comment in pdf_begin_encrypt. */
+ map_id);
+ for (i = 0; i < count; ++i) {
+ uint gid = pdfont->u.cidfont.CIDToGIDMap[i];
+
+ stream_putc(writer.binary.strm, (byte)(gid >> 8));
+ stream_putc(writer.binary.strm, (byte)(gid));
+ }
+ code = pdf_end_data(&writer);
}
return code;
}
@@ -558,53 +558,53 @@ pdf_write_font_resource(gx_device_pdf *pdev, pdf_font_resource_t *pdfont)
cos_dict_t *pcd_Resources = NULL;
if (pdfont->cmap_ToUnicode != NULL && pdfont->res_ToUnicode == NULL)
- if (pdfont->FontType == ft_composite ||
- ((pdfont->FontType == ft_encrypted || pdfont->FontType == ft_encrypted2 ||
- pdfont->FontType == ft_TrueType || pdfont->FontType == ft_user_defined) &&
- pdf_simple_font_needs_ToUnicode(pdfont))
- ) {
- pdf_resource_t *prcmap;
- int code = pdf_cmap_alloc(pdev, pdfont->cmap_ToUnicode, &prcmap, -1);
-
- if (code < 0)
- return code;
- pdfont->res_ToUnicode = prcmap;
- }
+ if (pdfont->FontType == ft_composite ||
+ ((pdfont->FontType == ft_encrypted || pdfont->FontType == ft_encrypted2 ||
+ pdfont->FontType == ft_TrueType || pdfont->FontType == ft_user_defined) &&
+ pdf_simple_font_needs_ToUnicode(pdfont))
+ ) {
+ pdf_resource_t *prcmap;
+ int code = pdf_cmap_alloc(pdev, pdfont->cmap_ToUnicode, &prcmap, -1);
+
+ if (code < 0)
+ return code;
+ pdfont->res_ToUnicode = prcmap;
+ }
if (pdev->CompatibilityLevel >= 1.2 &&
- pdfont->FontType == ft_user_defined &&
- pdfont->u.simple.s.type3.Resources != NULL &&
- pdfont->u.simple.s.type3.Resources->elements != NULL) {
- int code;
-
- pcd_Resources = pdfont->u.simple.s.type3.Resources;
- pcd_Resources->id = pdf_obj_ref(pdev);
- pdf_open_separate(pdev, pcd_Resources->id, resourceFont);
- code = COS_WRITE(pcd_Resources, pdev);
- if (code < 0)
- return code;
- pdf_end_separate(pdev, resourceFont);
+ pdfont->FontType == ft_user_defined &&
+ pdfont->u.simple.s.type3.Resources != NULL &&
+ pdfont->u.simple.s.type3.Resources->elements != NULL) {
+ int code;
+
+ pcd_Resources = pdfont->u.simple.s.type3.Resources;
+ pcd_Resources->id = pdf_obj_ref(pdev);
+ pdf_open_separate(pdev, pcd_Resources->id, resourceFont);
+ code = COS_WRITE(pcd_Resources, pdev);
+ if (code < 0)
+ return code;
+ pdf_end_separate(pdev, resourceFont);
}
pdf_open_separate(pdev, pdf_font_id(pdfont), resourceFont);
s = pdev->strm;
stream_puts(s, "<<");
if (pdfont->BaseFont.size > 0) {
- stream_puts(s, "/BaseFont");
- pdf_put_name(pdev, pdfont->BaseFont.data, pdfont->BaseFont.size);
+ stream_puts(s, "/BaseFont");
+ pdf_put_name(pdev, pdfont->BaseFont.data, pdfont->BaseFont.size);
}
if (pdfont->FontDescriptor)
- pprintld1(s, "/FontDescriptor %ld 0 R",
- pdf_font_descriptor_id(pdfont->FontDescriptor));
+ pprintld1(s, "/FontDescriptor %ld 0 R",
+ pdf_font_descriptor_id(pdfont->FontDescriptor));
if (pdfont->res_ToUnicode)
- pprintld1(s, "/ToUnicode %ld 0 R",
- pdf_resource_id((const pdf_resource_t *)pdfont->res_ToUnicode));
+ pprintld1(s, "/ToUnicode %ld 0 R",
+ pdf_resource_id((const pdf_resource_t *)pdfont->res_ToUnicode));
if (pdev->CompatibilityLevel > 1.0)
- stream_puts(s, "/Type/Font\n");
+ stream_puts(s, "/Type/Font\n");
else
- pprintld1(s, "/Type/Font/Name/R%ld\n", pdf_font_id(pdfont));
+ pprintld1(s, "/Type/Font/Name/R%ld\n", pdf_font_id(pdfont));
if (pdev->ForOPDFRead && pdfont->global)
- stream_puts(s, "/.Global true\n");
+ stream_puts(s, "/.Global true\n");
if (pcd_Resources != NULL)
- pprintld1(s, "/Resources %ld 0 R\n", pcd_Resources->id);
+ pprintld1(s, "/Resources %ld 0 R\n", pcd_Resources->id);
return pdfont->write_contents(pdev, pdfont);
}
@@ -619,39 +619,39 @@ write_font_resources(gx_device_pdf *pdev, pdf_resource_list_t *prlist)
pdf_resource_t *pres;
for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
- for (pres = prlist->chains[j]; pres != 0; pres = pres->next) {
- pdf_font_resource_t *const pdfont = (pdf_font_resource_t *)pres;
-
- if (pdf_resource_id(pres) != -1) {
- int code = pdf_compute_BaseFont(pdev, pdfont, true);
-
- if (code < 0)
- return code;
- code = pdf_write_font_resource(pdev, pdfont);
- if (code < 0)
- return code;
- pdfont->object->written = true;
- }
- }
+ for (pres = prlist->chains[j]; pres != 0; pres = pres->next) {
+ pdf_font_resource_t *const pdfont = (pdf_font_resource_t *)pres;
+
+ if (pdf_resource_id(pres) != -1) {
+ int code = pdf_compute_BaseFont(pdev, pdfont, true);
+
+ if (code < 0)
+ return code;
+ code = pdf_write_font_resource(pdev, pdfont);
+ if (code < 0)
+ return code;
+ pdfont->object->written = true;
+ }
+ }
return 0;
}
int
pdf_finish_resources(gx_device_pdf *pdev, pdf_resource_type_t type,
- int (*finish_proc)(gx_device_pdf *,
- pdf_resource_t *))
+ int (*finish_proc)(gx_device_pdf *,
+ pdf_resource_t *))
{
int j;
pdf_resource_t *pres;
for (j = 0; j < NUM_RESOURCE_CHAINS; ++j)
- for (pres = pdev->resources[type].chains[j];
- pres != 0; pres = pres->next
- ) {
- int code = finish_proc(pdev, pres);
-
- if (code < 0)
- return code;
- }
+ for (pres = pdev->resources[type].chains[j];
+ pres != 0; pres = pres->next
+ ) {
+ int code = finish_proc(pdev, pres);
+
+ if (code < 0)
+ return code;
+ }
return 0;
}
int
@@ -667,14 +667,14 @@ pdf_close_text_document(gx_device_pdf *pdev)
pdf_clean_standard_fonts(pdev);
if ((code = pdf_free_font_cache(pdev)) < 0 ||
- (code = pdf_write_resource_objects(pdev, resourceCharProc)) < 0 ||
- (code = pdf_finish_resources(pdev, resourceFont, pdf_convert_truetype_font)) < 0 ||
- (code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_finish_FontDescriptor)) < 0 ||
- (code = write_font_resources(pdev, &pdev->resources[resourceCIDFont])) < 0 ||
- (code = write_font_resources(pdev, &pdev->resources[resourceFont])) < 0 ||
- (code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_write_FontDescriptor)) < 0
- )
- return code;
+ (code = pdf_write_resource_objects(pdev, resourceCharProc)) < 0 ||
+ (code = pdf_finish_resources(pdev, resourceFont, pdf_convert_truetype_font)) < 0 ||
+ (code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_finish_FontDescriptor)) < 0 ||
+ (code = write_font_resources(pdev, &pdev->resources[resourceCIDFont])) < 0 ||
+ (code = write_font_resources(pdev, &pdev->resources[resourceFont])) < 0 ||
+ (code = pdf_finish_resources(pdev, resourceFontDescriptor, pdf_write_FontDescriptor)) < 0
+ )
+ return code;
/* If required, write the Encoding for Type 3 bitmap fonts. */
@@ -688,28 +688,28 @@ pdf_close_text_document(gx_device_pdf *pdev)
*/
static int
pdf_write_cid_system_info_to_stream(gx_device_pdf *pdev, stream *s,
- const gs_cid_system_info_t *pcidsi, gs_id object_id)
+ const gs_cid_system_info_t *pcidsi, gs_id object_id)
{
byte Registry[32], Ordering[32];
if (pcidsi->Registry.size > sizeof(Registry))
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
if (pcidsi->Ordering.size > sizeof(Ordering))
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
memcpy(Registry, pcidsi->Registry.data, pcidsi->Registry.size);
memcpy(Ordering, pcidsi->Ordering.data, pcidsi->Ordering.size);
if (pdev->KeyLength && object_id != 0) {
- stream_arcfour_state sarc4;
- int code;
-
- code = pdf_encrypt_init(pdev, object_id, &sarc4);
- if (code < 0)
- return code;
- s_arcfour_process_buffer(&sarc4, Registry, pcidsi->Registry.size);
- code = pdf_encrypt_init(pdev, object_id, &sarc4);
- if (code < 0)
- return code;
- s_arcfour_process_buffer(&sarc4, Ordering, pcidsi->Ordering.size);
+ stream_arcfour_state sarc4;
+ int code;
+
+ code = pdf_encrypt_init(pdev, object_id, &sarc4);
+ if (code < 0)
+ return code;
+ s_arcfour_process_buffer(&sarc4, Registry, pcidsi->Registry.size);
+ code = pdf_encrypt_init(pdev, object_id, &sarc4);
+ if (code < 0)
+ return code;
+ s_arcfour_process_buffer(&sarc4, Ordering, pcidsi->Ordering.size);
}
stream_puts(s, "<<\n/Registry");
s_write_ps_string(s, Registry, pcidsi->Registry.size, PRINT_HEX_NOT_OK);
@@ -721,14 +721,14 @@ pdf_write_cid_system_info_to_stream(gx_device_pdf *pdev, stream *s,
int
pdf_write_cid_system_info(gx_device_pdf *pdev,
- const gs_cid_system_info_t *pcidsi, gs_id object_id)
+ const gs_cid_system_info_t *pcidsi, gs_id object_id)
{
return pdf_write_cid_system_info_to_stream(pdev, pdev->strm, pcidsi, object_id);
}
int
pdf_write_cid_systemInfo_separate(gx_device_pdf *pdev, const gs_cid_system_info_t *pcidsi, long *id)
-{
+{
int code;
*id = pdf_begin_separate(pdev, resourceCIDSystemInfo);
@@ -743,7 +743,7 @@ pdf_write_cid_systemInfo_separate(gx_device_pdf *pdev, const gs_cid_system_info_
*/
int
pdf_write_cmap(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
- pdf_resource_t **ppres /*CMap*/, int font_index_only)
+ pdf_resource_t **ppres /*CMap*/, int font_index_only)
{
int code;
pdf_data_writer_t writer;
@@ -751,56 +751,56 @@ pdf_write_cmap(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
const gs_const_string *cmap_name = &pcmap->CMapName;
code = pdf_begin_data_stream(pdev, &writer,
- DATA_STREAM_NOT_BINARY |
- /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
- See comment in pdf_begin_encrypt. */
- (pdev->CompressFonts ?
- DATA_STREAM_COMPRESS : 0), gs_no_id);
+ DATA_STREAM_NOT_BINARY |
+ /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
+ See comment in pdf_begin_encrypt. */
+ (pdev->CompressFonts ?
+ DATA_STREAM_COMPRESS : 0), gs_no_id);
if (code < 0)
- return code;
+ return code;
*ppres = writer.pres;
writer.pres->where_used = 0; /* CMap isn't a PDF resource. */
if (!pcmap->ToUnicode) {
- byte buf[200];
- cos_dict_t *pcd = (cos_dict_t *)writer.pres->object;
- stream s;
-
- code = cos_dict_put_c_key_int(pcd, "/WMode", pcmap->WMode);
- if (code < 0)
- return code;
- buf[0] = '/';
- memcpy(buf + 1, pcmap->CMapName.data, pcmap->CMapName.size);
- code = cos_dict_put_c_key_string(pcd, "/CMapName",
- buf, pcmap->CMapName.size + 1);
- if (code < 0)
- return code;
- s_init(&s, pdev->memory);
- swrite_string(&s, buf, sizeof(buf));
- code = pdf_write_cid_system_info_to_stream(pdev, &s, pcmap->CIDSystemInfo, 0);
- if (code < 0)
- return code;
- code = cos_dict_put_c_key_string(pcd, "/CIDSystemInfo",
- buf, stell(&s));
- if (code < 0)
- return code;
- code = cos_dict_put_string_copy(pcd, "/Type", "/CMap");
- if (code < 0)
- return code;
+ byte buf[200];
+ cos_dict_t *pcd = (cos_dict_t *)writer.pres->object;
+ stream s;
+
+ code = cos_dict_put_c_key_int(pcd, "/WMode", pcmap->WMode);
+ if (code < 0)
+ return code;
+ buf[0] = '/';
+ memcpy(buf + 1, pcmap->CMapName.data, pcmap->CMapName.size);
+ code = cos_dict_put_c_key_string(pcd, "/CMapName",
+ buf, pcmap->CMapName.size + 1);
+ if (code < 0)
+ return code;
+ s_init(&s, pdev->memory);
+ swrite_string(&s, buf, sizeof(buf));
+ code = pdf_write_cid_system_info_to_stream(pdev, &s, pcmap->CIDSystemInfo, 0);
+ if (code < 0)
+ return code;
+ code = cos_dict_put_c_key_string(pcd, "/CIDSystemInfo",
+ buf, stell(&s));
+ if (code < 0)
+ return code;
+ code = cos_dict_put_string_copy(pcd, "/Type", "/CMap");
+ if (code < 0)
+ return code;
}
if (pcmap->CMapName.size == 0) {
- /* Create an arbitrary name (for ToUnicode CMap). */
- alt_cmap_name.data = (byte *)(*ppres)->rname;
- alt_cmap_name.size = strlen((*ppres)->rname);
- cmap_name = &alt_cmap_name;
+ /* Create an arbitrary name (for ToUnicode CMap). */
+ alt_cmap_name.data = (byte *)(*ppres)->rname;
+ alt_cmap_name.size = strlen((*ppres)->rname);
+ cmap_name = &alt_cmap_name;
}
code = psf_write_cmap(pdev->memory, writer.binary.strm, pcmap,
- pdf_put_name_chars_proc(pdev),
- cmap_name, font_index_only);
+ pdf_put_name_chars_proc(pdev),
+ cmap_name, font_index_only);
if (code < 0)
- return code;
+ return code;
code = pdf_end_data(&writer);
if (code < 0)
- return code;
+ return code;
return code;
}
@@ -831,12 +831,12 @@ static const char *OneByteIdentityH[] = {
"end",
NULL};
-/*
- * Write OneByteIdentityH CMap.
+/*
+ * Write OneByteIdentityH CMap.
*/
int
pdf_write_OneByteIdentityH(gx_device_pdf *pdev)
-{
+{
int code, i;
pdf_data_writer_t writer;
cos_dict_t *pcd;
@@ -845,36 +845,36 @@ pdf_write_OneByteIdentityH(gx_device_pdf *pdev)
long id;
if (pdev->IdentityCIDSystemInfo_id == gs_no_id) {
- code = pdf_write_cid_systemInfo_separate(pdev, &cidsi, &id);
- if (code < 0)
- return code;
- pdev->IdentityCIDSystemInfo_id = id;
+ code = pdf_write_cid_systemInfo_separate(pdev, &cidsi, &id);
+ if (code < 0)
+ return code;
+ pdev->IdentityCIDSystemInfo_id = id;
}
if (pdev->OneByteIdentityH != NULL)
- return 0;
+ return 0;
code = pdf_begin_data_stream(pdev, &writer,
- DATA_STREAM_NOT_BINARY |
- /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
- See comment in pdf_begin_encrypt. */
- (pdev->CompressFonts ?
- DATA_STREAM_COMPRESS : 0), gs_no_id);
+ DATA_STREAM_NOT_BINARY |
+ /* Don't set DATA_STREAM_ENCRYPT since we write to a temporary file.
+ See comment in pdf_begin_encrypt. */
+ (pdev->CompressFonts ?
+ DATA_STREAM_COMPRESS : 0), gs_no_id);
if (code < 0)
- return code;
+ return code;
pdev->OneByteIdentityH = writer.pres;
pcd = (cos_dict_t *)writer.pres->object;
code = cos_dict_put_string_copy(pcd, "/CMapName", "/OneByteIdentityH");
if (code < 0)
- return code;
+ return code;
sprintf(buf, "%ld 0 R", pdev->IdentityCIDSystemInfo_id);
code = cos_dict_put_string_copy(pcd, "/CIDSystemInfo", buf);
if (code < 0)
- return code;
+ return code;
code = cos_dict_put_string_copy(pcd, "/Type", "/CMap");
if (code < 0)
- return code;
+ return code;
for (i = 0; OneByteIdentityH[i]; i++) {
- stream_puts(pdev->strm, OneByteIdentityH[i]);
- stream_putc(pdev->strm, '\n');
+ stream_puts(pdev->strm, OneByteIdentityH[i]);
+ stream_putc(pdev->strm, '\n');
}
return pdf_end_data(&writer);
}
diff --git a/gs/base/gdevpdtw.h b/gs/base/gdevpdtw.h
index 083510553..5485dabed 100644
--- a/gs/base/gdevpdtw.h
+++ b/gs/base/gdevpdtw.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@
int
pdf_write_contents_type0(gx_device_pdf *pdev, pdf_font_resource_t *pdfont),
pdf_finish_write_contents_type3(gx_device_pdf *pdev,
- pdf_font_resource_t *pdfont),
+ pdf_font_resource_t *pdfont),
pdf_write_contents_std(gx_device_pdf *pdev, pdf_font_resource_t *pdfont),
pdf_write_contents_simple(gx_device_pdf *pdev, pdf_font_resource_t *pdfont),
pdf_write_contents_cid0(gx_device_pdf *pdev, pdf_font_resource_t *pdfont),
@@ -41,7 +41,6 @@ int
pdf_write_encoding(gx_device_pdf *pdev, const pdf_font_resource_t *pdfont, long id, int ch),
pdf_write_encoding_ref(gx_device_pdf *pdev, const pdf_font_resource_t *pdfont, long id);
-
/* ---------------- CMap resource writing ---------------- */
#ifndef gs_cid_system_info_DEFINED
@@ -57,23 +56,21 @@ typedef struct gs_cmap_s gs_cmap_t;
* Write the CIDSystemInfo for a CIDFont or a CMap.
*/
int pdf_write_cid_system_info(gx_device_pdf *pdev,
- const gs_cid_system_info_t *pcidsi, gs_id object_id);
+ const gs_cid_system_info_t *pcidsi, gs_id object_id);
/* Write CIDSystemInfo */
-int pdf_write_cid_systemInfo_separate(gx_device_pdf *pdev,
- const gs_cid_system_info_t *pcidsi, long *id);
-
-
+int pdf_write_cid_systemInfo_separate(gx_device_pdf *pdev,
+ const gs_cid_system_info_t *pcidsi, long *id);
/*
* Write a CMap resource. We pass the CMap object as well as the resource,
* because we write CMaps when they are created.
*/
int pdf_write_cmap(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
- pdf_resource_t **ppres, int font_index_only);
+ pdf_resource_t **ppres, int font_index_only);
-/*
- * Write OneByteIdentityH CMap.
+/*
+ * Write OneByteIdentityH CMap.
*/
int pdf_write_OneByteIdentityH(gx_device_pdf *pdev);
diff --git a/gs/base/gdevpdtx.h b/gs/base/gdevpdtx.h
index 7b55a124f..a223d27f5 100644
--- a/gs/base/gdevpdtx.h
+++ b/gs/base/gdevpdtx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpe.c b/gs/base/gdevpe.c
index 062d8d215..02bb4da63 100644
--- a/gs/base/gdevpe.c
+++ b/gs/base/gdevpe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,14 +25,14 @@
char *getenv(char *name);
typedef struct gx_device_pe_s {
- gx_device_common;
- byte *fbaddr;
- unsigned regs;
+ gx_device_common;
+ byte *fbaddr;
+ unsigned regs;
} gx_device_pe;
#define pedev ((gx_device_pe *)dev)
typedef struct {
- ushort reg, val;
+ ushort reg, val;
} regval;
#define XSIZE 720
@@ -50,208 +50,208 @@ dev_proc_copy_mono(pe_copy_mono);
static gx_device_procs pe_procs =
{ pe_open,
- NULL, /* get_initial_matrix */
- NULL, /* sync_output */
- NULL, /* output_page */
- pe_close,
- NULL, /* map_rgb_color */
- NULL, /* map_color_rgb */
- pe_fill_rectangle,
- NULL, /* tile_rectangle */
- pe_copy_mono,
- NULL /* copy_color */
+ NULL, /* get_initial_matrix */
+ NULL, /* sync_output */
+ NULL, /* output_page */
+ pe_close,
+ NULL, /* map_rgb_color */
+ NULL, /* map_color_rgb */
+ pe_fill_rectangle,
+ NULL, /* tile_rectangle */
+ pe_copy_mono,
+ NULL /* copy_color */
};
-gx_device_pe far_data gs_pe_device =
+gx_device_pe far_data gs_pe_device =
{ std_device_std_body(gx_device_pe, &pe_procs, "pe",
- XSIZE, YSIZE, XPPI, YPPI),
- { 0 }, /* std_procs */
- DEFAULT_ADDRESS, DEFAULT_REGISTERS
+ XSIZE, YSIZE, XPPI, YPPI),
+ { 0 }, /* std_procs */
+ DEFAULT_ADDRESS, DEFAULT_REGISTERS
};
static regval peinit[] = {{0x04, 0x1e}, {0x05, 0x00},
- {0x04, 0x0c}, {0x05, 0x21},
- {0x04, 0x0d}, {0x05, 0x98},
- {0x08, 0x00}, {0x08, 0x1e},
- {0x04, 0x1e}, {0x05, 0x01}};
+ {0x04, 0x0c}, {0x05, 0x21},
+ {0x04, 0x0d}, {0x05, 0x98},
+ {0x08, 0x00}, {0x08, 0x1e},
+ {0x04, 0x1e}, {0x05, 0x01}};
static regval pedone[] = {{0x04, 0x1e}, {0x05, 0x10},
- {0x04, 0x0a}, {0x05, 0x00},
- {0x04, 0x0b}, {0x05, 0x07},
- {0x04, 0x0c}, {0x05, 0x00},
- {0x04, 0x0d}, {0x05, 0x00},
- {0x04, 0x0e}, {0x05, 0x00},
- {0x04, 0x0f}, {0x05, 0x00},
- {0x08, 0x00}, {0x08, 0x29}};
+ {0x04, 0x0a}, {0x05, 0x00},
+ {0x04, 0x0b}, {0x05, 0x07},
+ {0x04, 0x0c}, {0x05, 0x00},
+ {0x04, 0x0d}, {0x05, 0x00},
+ {0x04, 0x0e}, {0x05, 0x00},
+ {0x04, 0x0f}, {0x05, 0x00},
+ {0x08, 0x00}, {0x08, 0x29}};
int pe_open(gx_device *dev)
{
- char *str;
- int i;
-
- if ((str = getenv("PEFBADDR")) != 0)
- {
- if (!sscanf(str, "%lx", &(pedev->fbaddr)))
- {
- emprintf(dev->memory,
+ char *str;
+ int i;
+
+ if ((str = getenv("PEFBADDR")) != 0)
+ {
+ if (!sscanf(str, "%lx", &(pedev->fbaddr)))
+ {
+ emprintf(dev->memory,
"Private Eye: PEFBADDR environment string format error\n");
- exit(1);
- }
- }
-
- if ((str = getenv("PEREGS")) != 0)
- {
- if (!sscanf(str, "%x", &(pedev->regs)))
- {
- emprintf(dev->memory,
+ exit(1);
+ }
+ }
+
+ if ((str = getenv("PEREGS")) != 0)
+ {
+ if (!sscanf(str, "%x", &(pedev->regs)))
+ {
+ emprintf(dev->memory,
"Private Eye: PEREGS environment string format error\n");
- exit(1);
- }
- }
+ exit(1);
+ }
+ }
- for (i = 0; i < 10; i++)
- outportb(pedev->regs + peinit[i].reg, peinit[i].val);
+ for (i = 0; i < 10; i++)
+ outportb(pedev->regs + peinit[i].reg, peinit[i].val);
- return 0;
+ return 0;
}
int pe_close(gx_device *dev)
{
- int i;
+ int i;
- /* restore the screen */
- for (i = 0; i < 16; i++)
- outportb(pedev->regs + pedone[i].reg, pedone[i].val);
+ /* restore the screen */
+ for (i = 0; i < 16; i++)
+ outportb(pedev->regs + pedone[i].reg, pedone[i].val);
- /* clear the frame buffer */
- memset(pedev->fbaddr, 0, 4000);
+ /* clear the frame buffer */
+ memset(pedev->fbaddr, 0, 4000);
- return 0;
+ return 0;
}
int pe_fill_rectangle(gx_device *dev, int x1, int y1, int w, int h,
gx_color_index color)
{
- int x2, y2, xlen;
- byte led, red, d;
- byte *ptr;
-
- /* cull */
-
- if ((w <= 0) || (h <= 0) || (x1 > XSIZE) || (y1 > YSIZE))
- return 0;
-
- x2 = x1 + w - 1;
- y2 = y1 + h - 1;
-
- /* cull some more */
-
- if ((x2 < 0) || (y2 < 0))
- return 0;
-
- /* clip */
-
- if (x1 < 0) x1 = 0;
- if (x2 > XSIZE-1) x2 = XSIZE-1;
- if (y1 < 0) y1 = 0;
- if (y2 > YSIZE-1) y2 = YSIZE-1;
-
- w = x2 - x1 + 1;
- h = y2 - y1 + 1;
- xlen = (x2 >> 3) - (x1 >> 3) - 1;
- led = 0xff >> (x1 & 7);
- red = 0xff << (7 - (x2 & 7));
-
- ptr = pedev->fbaddr + (y1 * BPL) + (x1 >> 3);
-
- if (color)
- {
- /* here to set pixels */
-
- if (xlen == -1)
- {
- /* special for rectangles that fit in a byte */
-
- d = led & red;
- for(; h >= 0; h--, ptr += BPL)
- *ptr |= d;
- return 0;
- }
-
- /* normal fill */
-
- for(; h >= 0; h--, ptr += BPL)
- { register int x = xlen;
- register byte *p = ptr;
- *p++ |= led;
- while ( x-- ) *p++ = 0xff;
- *p |= red;
- }
- }
-
- /* here to clear pixels */
-
- led = ~led;
- red = ~red;
-
- if (xlen == -1)
- {
- /* special for rectangles that fit in a byte */
-
- d = led | red;
- for(; h >= 0; h--, ptr += BPL)
- *ptr &= d;
- return 0;
- }
-
- /* normal fill */
-
- for(; h >= 0; h--, ptr += BPL)
- { register int x = xlen;
- register byte *p = ptr;
- *p++ &= led;
- while ( x-- ) *p++ = 0x00;
- *p &= red;
- }
- return 0;
+ int x2, y2, xlen;
+ byte led, red, d;
+ byte *ptr;
+
+ /* cull */
+
+ if ((w <= 0) || (h <= 0) || (x1 > XSIZE) || (y1 > YSIZE))
+ return 0;
+
+ x2 = x1 + w - 1;
+ y2 = y1 + h - 1;
+
+ /* cull some more */
+
+ if ((x2 < 0) || (y2 < 0))
+ return 0;
+
+ /* clip */
+
+ if (x1 < 0) x1 = 0;
+ if (x2 > XSIZE-1) x2 = XSIZE-1;
+ if (y1 < 0) y1 = 0;
+ if (y2 > YSIZE-1) y2 = YSIZE-1;
+
+ w = x2 - x1 + 1;
+ h = y2 - y1 + 1;
+ xlen = (x2 >> 3) - (x1 >> 3) - 1;
+ led = 0xff >> (x1 & 7);
+ red = 0xff << (7 - (x2 & 7));
+
+ ptr = pedev->fbaddr + (y1 * BPL) + (x1 >> 3);
+
+ if (color)
+ {
+ /* here to set pixels */
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led & red;
+ for(; h >= 0; h--, ptr += BPL)
+ *ptr |= d;
+ return 0;
+ }
+
+ /* normal fill */
+
+ for(; h >= 0; h--, ptr += BPL)
+ { register int x = xlen;
+ register byte *p = ptr;
+ *p++ |= led;
+ while ( x-- ) *p++ = 0xff;
+ *p |= red;
+ }
+ }
+
+ /* here to clear pixels */
+
+ led = ~led;
+ red = ~red;
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led | red;
+ for(; h >= 0; h--, ptr += BPL)
+ *ptr &= d;
+ return 0;
+ }
+
+ /* normal fill */
+
+ for(; h >= 0; h--, ptr += BPL)
+ { register int x = xlen;
+ register byte *p = ptr;
+ *p++ &= led;
+ while ( x-- ) *p++ = 0x00;
+ *p &= red;
+ }
+ return 0;
}
int pe_copy_mono(gx_device *dev,
- const byte *base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte *base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
- const byte *line;
- int sleft, dleft;
- int mask, rmask;
- int invert, zmask, omask;
- byte *dest;
- int offset;
+ const byte *line;
+ int sleft, dleft;
+ int mask, rmask;
+ int invert, zmask, omask;
+ byte *dest;
+ int offset;
#define izero (int)zero
#define ione (int)one
if ( ione == izero ) /* vacuous case */
- return pe_fill_rectangle(dev, x, y, w, h, zero);
+ return pe_fill_rectangle(dev, x, y, w, h, zero);
- /* clip */
+ /* clip */
- if ((x > XSIZE) || (y > YSIZE) || ((x + w) < 0) || ((y + h) < 0))
- return 0;
+ if ((x > XSIZE) || (y > YSIZE) || ((x + w) < 0) || ((y + h) < 0))
+ return 0;
- offset = x >> 3;
- dest = pedev->fbaddr + (y * BPL) + offset;
- line = base + (sourcex >> 3);
- sleft = 8 - (sourcex & 7);
- dleft = 8 - (x & 7);
- mask = 0xff >> (8 - dleft);
- if ( w < dleft )
- mask -= mask >> w;
- else
- rmask = 0xff00 >> ((w - dleft) & 7);
+ offset = x >> 3;
+ dest = pedev->fbaddr + (y * BPL) + offset;
+ line = base + (sourcex >> 3);
+ sleft = 8 - (sourcex & 7);
+ dleft = 8 - (x & 7);
+ mask = 0xff >> (8 - dleft);
+ if ( w < dleft )
+ mask -= mask >> w;
+ else
+ rmask = 0xff00 >> ((w - dleft) & 7);
- /* Macros for writing partial bytes. */
- /* bits has already been inverted by xor'ing with invert. */
+ /* Macros for writing partial bytes. */
+ /* bits has already been inverted by xor'ing with invert. */
#define write_byte_masked(ptr, bits, mask)\
*ptr = ((bits | ~mask | zmask) & *ptr | (bits & mask & omask))
@@ -260,104 +260,104 @@ if ( ione == izero ) /* vacuous case */
*ptr = ((bits | zmask) & *ptr | (bits & omask))
/* if ( dev->invert )
- {
- if ( izero != (int)gx_no_color_index ) zero ^= 1;
- if ( ione != (int)gx_no_color_index ) one ^= 1;
- } */
- invert = (izero == 1 || ione == 0 ? -1 : 0);
- zmask = (izero == 0 || ione == 0 ? 0 : -1);
- omask = (izero == 1 || ione == 1 ? -1 : 0);
+ {
+ if ( izero != (int)gx_no_color_index ) zero ^= 1;
+ if ( ione != (int)gx_no_color_index ) one ^= 1;
+ } */
+ invert = (izero == 1 || ione == 0 ? -1 : 0);
+ zmask = (izero == 0 || ione == 0 ? 0 : -1);
+ omask = (izero == 1 || ione == 1 ? -1 : 0);
#undef izero
#undef ione
- if (sleft == dleft) /* optimize the aligned case */
- {
- w -= dleft;
- while ( --h >= 0 )
- {
- register const byte *bptr = line;
- int count = w;
- register byte *optr = dest;
- register int bits = *bptr ^ invert; /* first partial byte */
-
- write_byte_masked(optr, bits, mask);
-
- /* Do full bytes. */
-
- while ((count -= 8) >= 0)
- {
- bits = *++bptr ^ invert;
- ++optr;
- write_byte(optr, bits);
- }
-
- /* Do last byte */
-
- if (count > -8)
- {
- bits = *++bptr ^ invert;
- ++optr;
- write_byte_masked(optr, bits, rmask);
- }
- dest += BPL;
- line += raster;
- }
- }
- else
- {
- int skew = (sleft - dleft) & 7;
- int cskew = 8 - skew;
-
- while (--h >= 0)
- {
- const byte *bptr = line;
- int count = w;
- byte *optr = dest;
- register int bits;
-
- /* Do the first partial byte */
-
- if (sleft >= dleft)
- {
- bits = *bptr >> skew;
- }
- else /* ( sleft < dleft ) */
- {
- bits = *bptr++ << cskew;
- if (count > sleft)
- bits += *bptr >> skew;
- }
- bits ^= invert;
- write_byte_masked(optr, bits, mask);
- count -= dleft;
- optr++;
-
- /* Do full bytes. */
-
- while ( count >= 8 )
- {
- bits = *bptr++ << cskew;
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte(optr, bits);
- count -= 8;
- optr++;
- }
-
- /* Do last byte */
-
- if (count > 0)
- {
- bits = *bptr++ << cskew;
- if (count > skew)
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte_masked(optr, bits, rmask);
- }
- dest += BPL;
- line += raster;
- }
- }
- return 0;
+ if (sleft == dleft) /* optimize the aligned case */
+ {
+ w -= dleft;
+ while ( --h >= 0 )
+ {
+ register const byte *bptr = line;
+ int count = w;
+ register byte *optr = dest;
+ register int bits = *bptr ^ invert; /* first partial byte */
+
+ write_byte_masked(optr, bits, mask);
+
+ /* Do full bytes. */
+
+ while ((count -= 8) >= 0)
+ {
+ bits = *++bptr ^ invert;
+ ++optr;
+ write_byte(optr, bits);
+ }
+
+ /* Do last byte */
+
+ if (count > -8)
+ {
+ bits = *++bptr ^ invert;
+ ++optr;
+ write_byte_masked(optr, bits, rmask);
+ }
+ dest += BPL;
+ line += raster;
+ }
+ }
+ else
+ {
+ int skew = (sleft - dleft) & 7;
+ int cskew = 8 - skew;
+
+ while (--h >= 0)
+ {
+ const byte *bptr = line;
+ int count = w;
+ byte *optr = dest;
+ register int bits;
+
+ /* Do the first partial byte */
+
+ if (sleft >= dleft)
+ {
+ bits = *bptr >> skew;
+ }
+ else /* ( sleft < dleft ) */
+ {
+ bits = *bptr++ << cskew;
+ if (count > sleft)
+ bits += *bptr >> skew;
+ }
+ bits ^= invert;
+ write_byte_masked(optr, bits, mask);
+ count -= dleft;
+ optr++;
+
+ /* Do full bytes. */
+
+ while ( count >= 8 )
+ {
+ bits = *bptr++ << cskew;
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte(optr, bits);
+ count -= 8;
+ optr++;
+ }
+
+ /* Do last byte */
+
+ if (count > 0)
+ {
+ bits = *bptr++ << cskew;
+ if (count > skew)
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte_masked(optr, bits, rmask);
+ }
+ dest += BPL;
+ line += raster;
+ }
+ }
+ return 0;
}
diff --git a/gs/base/gdevperm.c b/gs/base/gdevperm.c
index 2ab34ccd3..1dcfe970e 100644
--- a/gs/base/gdevperm.c
+++ b/gs/base/gdevperm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -114,18 +114,17 @@ static const gx_device_procs perm_procs = {
const gx_device_perm_t gs_perm_device = {
prn_device_body_extended(gx_device_perm_t, perm_procs, "permute",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72, 72,
- 0, 0, 0, 0,
- GX_DEVICE_COLOR_MAX_COMPONENTS, 4,
- GX_CINFO_POLARITY_SUBTRACTIVE,
- 32, 0, 255, 255, 256, 256,
- GX_CINFO_SEP_LIN,
- "DeviceN",
- perm_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72, 72,
+ 0, 0, 0, 0,
+ GX_DEVICE_COLOR_MAX_COMPONENTS, 4,
+ GX_CINFO_POLARITY_SUBTRACTIVE,
+ 32, 0, 255, 255, 256, 256,
+ GX_CINFO_SEP_LIN,
+ "DeviceN",
+ perm_print_page),
NULL, 0, 0, 0
};
-
static int
perm_print_page(gx_device_printer *pdev, FILE *pstream)
{
@@ -144,45 +143,45 @@ perm_print_page(gx_device_printer *pdev, FILE *pstream)
raw_line = gs_alloc_bytes(pdev->memory, raw_raster, "perm_print_page");
cooked_line = gs_alloc_bytes(pdev->memory, dev->width * 3, "perm_print_page");
for (y = 0; y < dev->height; y++) {
- int x;
- code = gdev_prn_get_bits(pdev, y, raw_line, &row);
- for (x = 0; x < dev->width; x++) {
- int c, m, y, k;
- int r, g, b;
-
- if (mode == 0) {
- if (permute) {
- c = row[x * ncomp + 1];
- m = row[x * ncomp + 3];
- y = row[x * ncomp + 0];
- k = row[x * ncomp + 5];
- } else {
- c = row[x * ncomp];
- m = row[x * ncomp + 1];
- y = row[x * ncomp + 2];
- k = row[x * ncomp + 3];
- }
- } else /* if (mode == 1) */ {
- if (permute) {
- c = row[x * ncomp + 1];
- m = row[x * ncomp + 3];
- y = row[x * ncomp + 0];
- k = 0;
- } else {
- c = row[x * ncomp];
- m = row[x * ncomp + 1];
- y = row[x * ncomp + 2];
- k = 0;
- }
- }
- r = (255 - c) * (255 - k) / 255;
- g = (255 - m) * (255 - k) / 255;
- b = (255 - y) * (255 - k) / 255;
- cooked_line[x * 3] = r;
- cooked_line[x * 3 + 1] = g;
- cooked_line[x * 3 + 2] = b;
- }
- fwrite(cooked_line, 1, dev->width * 3, pstream);
+ int x;
+ code = gdev_prn_get_bits(pdev, y, raw_line, &row);
+ for (x = 0; x < dev->width; x++) {
+ int c, m, y, k;
+ int r, g, b;
+
+ if (mode == 0) {
+ if (permute) {
+ c = row[x * ncomp + 1];
+ m = row[x * ncomp + 3];
+ y = row[x * ncomp + 0];
+ k = row[x * ncomp + 5];
+ } else {
+ c = row[x * ncomp];
+ m = row[x * ncomp + 1];
+ y = row[x * ncomp + 2];
+ k = row[x * ncomp + 3];
+ }
+ } else /* if (mode == 1) */ {
+ if (permute) {
+ c = row[x * ncomp + 1];
+ m = row[x * ncomp + 3];
+ y = row[x * ncomp + 0];
+ k = 0;
+ } else {
+ c = row[x * ncomp];
+ m = row[x * ncomp + 1];
+ y = row[x * ncomp + 2];
+ k = 0;
+ }
+ }
+ r = (255 - c) * (255 - k) / 255;
+ g = (255 - m) * (255 - k) / 255;
+ b = (255 - y) * (255 - k) / 255;
+ cooked_line[x * 3] = r;
+ cooked_line[x * 3 + 1] = g;
+ cooked_line[x * 3 + 2] = b;
+ }
+ fwrite(cooked_line, 1, dev->width * 3, pstream);
}
gs_free_object(pdev->memory, cooked_line, "perm_print_page");
gs_free_object(pdev->memory, raw_line, "perm_print_page");
@@ -194,14 +193,14 @@ perm_permute_cm(gx_device *pdev, frac out[])
{
gx_device_perm_t * const dev = (gx_device_perm_t *)pdev;
if (dev->permute) {
- frac y;
- out[5] = dev->mode == 0 ? out[3] : 0;
- out[4] = frac_0;
- y = out[2];
- out[3] = out[1];
- out[2] = out[0];
- out[1] = out[0];
- out[0] = y;
+ frac y;
+ out[5] = dev->mode == 0 ? out[3] : 0;
+ out[4] = frac_0;
+ y = out[2];
+ out[3] = out[1];
+ out[2] = out[0];
+ out[1] = out[0];
+ out[0] = y;
}
}
@@ -215,7 +214,7 @@ gray_cs_to_perm_cm_0(gx_device *dev, frac gray, frac out[])
static void
rgb_cs_to_perm_cm_0(gx_device *dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
color_rgb_to_cmyk(r, g, b, pis, out, dev->memory);
perm_permute_cm(dev, out);
@@ -240,7 +239,7 @@ gray_cs_to_perm_cm_1(gx_device *dev, frac gray, frac out[])
static void
rgb_cs_to_perm_cm_1(gx_device *dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
out[0] = frac_1 - r;
out[1] = frac_1 - g;
@@ -277,26 +276,26 @@ perm_get_color_mapping_procs(const gx_device *dev)
const gx_device_perm_t * const pdev = (const gx_device_perm_t *)dev;
if (pdev->mode < 0 || pdev->mode >= sizeof(perm_cmapping_procs) / sizeof(perm_cmapping_procs[0]))
- return NULL;
+ return NULL;
return perm_cmapping_procs[pdev->mode];
}
#define compare_color_names(name, name_size, str, str_size) \
(name_size == str_size && \
- (strncmp((const char *)name, (const char *)str, name_size) == 0))
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
static int
perm_get_color_comp_index(const gx_device *pdev, const char *pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
const gx_device_perm_t * const dev = (const gx_device_perm_t *)pdev;
int n_separation_names = dev->num_std_colorant_names;
int i;
for (i = 0; i < n_separation_names; i++) {
- const char *sep_name = dev->std_colorant_names[i];
- if (compare_color_names(pname, name_size, sep_name, strlen(sep_name)))
- return i;
+ const char *sep_name = dev->std_colorant_names[i];
+ if (compare_color_names(pname, name_size, sep_name, strlen(sep_name)))
+ return i;
}
return -1;
}
@@ -319,7 +318,7 @@ perm_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
+ color <<= bpc;
color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
@@ -339,7 +338,7 @@ perm_decode_color(gx_device *dev, gx_color_index color, gx_color_value *out)
for (; i<ncomp; i++) {
out[ncomp - i - 1] = (gx_color_value)((color & mask) << drop);
- color >>= bpc;
+ color >>= bpc;
}
return 0;
}
@@ -355,56 +354,56 @@ perm_get_params(gx_device *pdev, gs_param_list *plist)
code = param_write_int(plist, "Permute", &dev->permute);
if (code >= 0)
- code = param_write_int(plist, "Mode", &dev->mode);
+ code = param_write_int(plist, "Mode", &dev->mode);
/*
* We need to specify the SeparationColorNames if we are permuting the colors.
*/
if (code >= 0 && dev->permute == 1) {
- int i;
- /* Temp variables. The data is copied into the plist below. */
+ int i;
+ /* Temp variables. The data is copied into the plist below. */
gs_param_string_array scna;
gs_param_string scn[6];
set_param_array(scna, scn, dev->num_std_colorant_names);
- /* Place colorant names into string array elements */
- for (i = 0; i < dev->num_std_colorant_names; i++)
- param_string_from_string(scn[i], dev->std_colorant_names[i]);
- /*
- * Place the name array in the plist. This includes allocating
- * memory for the name array element and the actual string array.
- */
- code = param_write_name_array(plist, "SeparationColorNames", &scna);
+ /* Place colorant names into string array elements */
+ for (i = 0; i < dev->num_std_colorant_names; i++)
+ param_string_from_string(scn[i], dev->std_colorant_names[i]);
+ /*
+ * Place the name array in the plist. This includes allocating
+ * memory for the name array element and the actual string array.
+ */
+ code = param_write_name_array(plist, "SeparationColorNames", &scna);
}
if (code >= 0)
- code = gdev_prn_get_params(pdev, plist);
+ code = gdev_prn_get_params(pdev, plist);
return code;
}
#undef set_param_array
static const char * DeviceCMYKComponents[] = {
- "Cyan",
- "Magenta",
- "Yellow",
- "Black",
- 0 /* List terminator */
+ "Cyan",
+ "Magenta",
+ "Yellow",
+ "Black",
+ 0 /* List terminator */
};
static const char * DeviceCMYComponents[] = {
- "Cyan",
- "Magenta",
- "Yellow",
- 0 /* List terminator */
+ "Cyan",
+ "Magenta",
+ "Yellow",
+ 0 /* List terminator */
};
static const char * DeviceNComponents[] = {
- "Yellow",
- "Cyan",
- "Cyan2",
- "Magenta",
- "Zero",
- "Black",
- 0 /* List terminator */
+ "Yellow",
+ "Cyan",
+ "Cyan2",
+ "Magenta",
+ "Zero",
+ "Black",
+ 0 /* List terminator */
};
static int
@@ -413,27 +412,27 @@ perm_set_color_model(gx_device_perm_t *dev, int mode, int permute)
dev->mode = mode;
dev->permute = permute;
if (mode == 0 && permute == 0) {
- dev->std_colorant_names = DeviceCMYKComponents;
- dev->num_std_colorant_names = 4;
- dev->color_info.cm_name = "DeviceCMYK";
- dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ dev->std_colorant_names = DeviceCMYKComponents;
+ dev->num_std_colorant_names = 4;
+ dev->color_info.cm_name = "DeviceCMYK";
+ dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (mode == 0 && permute == 1) {
- dev->std_colorant_names = DeviceNComponents;
- dev->num_std_colorant_names = 6;
- dev->color_info.cm_name = "DeviceN";
- dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ dev->std_colorant_names = DeviceNComponents;
+ dev->num_std_colorant_names = 6;
+ dev->color_info.cm_name = "DeviceN";
+ dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (mode == 1 && permute == 0) {
- dev->std_colorant_names = DeviceCMYComponents;
- dev->num_std_colorant_names = 3;
- dev->color_info.cm_name = "DeviceCMY";
- dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ dev->std_colorant_names = DeviceCMYComponents;
+ dev->num_std_colorant_names = 3;
+ dev->color_info.cm_name = "DeviceCMY";
+ dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (mode == 1 && permute == 1) {
- dev->std_colorant_names = DeviceNComponents;
- dev->num_std_colorant_names = 6;
- dev->color_info.cm_name = "DeviceN";
- dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ dev->std_colorant_names = DeviceNComponents;
+ dev->num_std_colorant_names = 6;
+ dev->color_info.cm_name = "DeviceN";
+ dev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else {
- return -1;
+ return -1;
}
dev->color_info.num_components = dev->num_std_colorant_names;
dev->color_info.depth = 8 * dev->num_std_colorant_names;
@@ -452,22 +451,21 @@ perm_put_params(gx_device *pdev, gs_param_list *plist)
code = param_read_int(plist, "Permute", &new_permute);
if (code < 0)
- return code;
+ return code;
code = param_read_int(plist, "Mode", &new_mode);
if (code < 0)
- return code;
+ return code;
if (new_mode < 0 || new_mode >= sizeof(perm_cmapping_procs) / sizeof(perm_cmapping_procs[0])) {
- dlprintf("rangecheck!\n");
- return_error(gs_error_rangecheck);
+ dlprintf("rangecheck!\n");
+ return_error(gs_error_rangecheck);
}
dev->permute = new_permute;
dev->mode = new_mode;
save_info = pdev->color_info;
code = perm_set_color_model(dev, dev->mode, dev->permute);
if (code >= 0)
- code = gdev_prn_put_params(pdev, plist);
+ code = gdev_prn_put_params(pdev, plist);
if (code < 0)
- pdev->color_info = save_info;
+ pdev->color_info = save_info;
return code;
}
-
diff --git a/gs/base/gdevphex.c b/gs/base/gdevphex.c
index 4e4f31bf6..f451be3f4 100644
--- a/gs/base/gdevphex.c
+++ b/gs/base/gdevphex.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,26 +31,25 @@ HISTORY
8 June 1999 Zoltán Kócsi (aka Kocsonya) zoltan@bendor.com.au
- Initial revision.
- No shingling, depletion.
- Colour only.
- Dither matrix is blatantly copied from gslib.c.
+ Initial revision.
+ No shingling, depletion.
+ Colour only.
+ Dither matrix is blatantly copied from gslib.c.
17 April 2000 Zoltán Kócsi
- After much play worked out a reasonably simple colour mapping
- that gives fairly good results. It has some very hairy things
- in it but ot seems to work reasonably well on a variety of natural
- as well as artificial images.
-
-
+ After much play worked out a reasonably simple colour mapping
+ that gives fairly good results. It has some very hairy things
+ in it but ot seems to work reasonably well on a variety of natural
+ as well as artificial images.
+
LEGALISE
~~~~~~~~
-The usual disclaimer applies, neither me (Zoltán Kócsi) nor
-Bendor Research Pty. Ltd. assume any liability whatsoever in
-relation to events arising out of or related to the use of
-the software or the included documentation in any form, way
+The usual disclaimer applies, neither me (Zoltán Kócsi) nor
+Bendor Research Pty. Ltd. assume any liability whatsoever in
+relation to events arising out of or related to the use of
+the software or the included documentation in any form, way
or purpose. This software is not guaranteed to work, you
get it "as is" and use it for your own risk.
@@ -59,16 +58,16 @@ license for details.
CREDIT
~~~~~~
-This driver was written from scratch, however, I have used the
+This driver was written from scratch, however, I have used the
HP/BJ driver very heavily as a reference (GhostScript's documentation
needs some working :-). In addition, I got some help in understanding
the more arcane features of the printer by digging into the colour
-Epson driver and its documentation (documentation for the Photo EX
-did not exist). I thank to the authors of these drivers and the
-related docs.
+Epson driver and its documentation (documentation for the Photo EX
+did not exist). I thank to the authors of these drivers and the
+related docs.
-I do also hereby express my despising Epson, Inc. who try to enlarge
-Microsoft's monopoly by witholding programming information about such
+I do also hereby express my despising Epson, Inc. who try to enlarge
+Microsoft's monopoly by witholding programming information about such
a commodity item as a printer.
KNOWN BUGS/LIMITATIONS
@@ -77,7 +76,7 @@ KNOWN BUGS/LIMITATIONS
- The driver is not optimised for speed
- The driver does not support TIFF compression
- Shingling and depletion is not implemented
-- The colour correction and ink transfer curve are hardcoded
+- The colour correction and ink transfer curve are hardcoded
- The dither matrix is straight stolen from Ghostscript
- The alternative error diffusion included but does not work (yet)
@@ -88,8 +87,8 @@ PREFACE
~~~~~~~
The Epson Stylus Photo EX is a colour ink-jet printer.
It can handle papers up to A3. It uses 6 inks, black in one cartridge
-and cyan, magenta, yellow, light cyan and light magenta in an other
-cartridge. The head has 32 nozzles, with 1/90" spacing.
+and cyan, magenta, yellow, light cyan and light magenta in an other
+cartridge. The head has 32 nozzles, with 1/90" spacing.
The maximal resolution is 1440 dpi horizontal 720 dpi vertical.
In 720x720 and 360x360 dpi it supports microweave. To achieve
1440x720 you must use software weaving. It has only one built-in font,
@@ -99,17 +98,17 @@ driver software. It comes with (what else ?) Windows 9x and Mac drivers.
The printer uses the ESC/P Raster protocol. This protocol is somewhat
similar to the ESC/P2 one. Initially Epson refused to give any info
about it. Later (unfortunately after I had already spent lot of time
-to reverse engineer it) they released its definition. It could be
+to reverse engineer it) they released its definition. It could be
found on their website (http://www.ercipd.com/isv/level1/6clr_98b.pdf).
Alas, they removed it, so at the moment I do not know about any existing
-docs of the printer.
+docs of the printer.
There are still a few commands which are not covered by the docs
and for example the Windows driver uses them. There are others which
-are in the docs, saying that you can find them in other docs but you
-can't. Fortunately, these commands apparently have no effect on the
+are in the docs, saying that you can find them in other docs but you
+can't. Fortunately, these commands apparently have no effect on the
printing process so this driver simply ignores them. Tricky business.
-By the way, my personal experience is that Epson tech support is
+By the way, my personal experience is that Epson tech support is
a joke, or in Usenet lingvo it sucks big time - they know absolutely
nothing about the product they supposed to support. Epson's webpage
contains false info as well (they state that the Photo EX uses ESC/P2,
@@ -120,8 +119,8 @@ as well but I have not tested it on them.
If you think that you can get some useful info from me above of what you
can find below, feel free to email me at zoltan@bendor.com.au.
-If you enhance the driver or find a bug *please* send me info about
-it.
+If you enhance the driver or find a bug *please* send me info about
+it.
DRIVER
~~~~~~
@@ -130,301 +129,291 @@ This file should contain two drivers, one for colour mode and one for B&W.
The devices are "photoex" and "photoexm". The mono device driver is
catered for (that is, the rendering part knows how to render for B&W)
but it is not finished yet (no device structure and gray colour mapping
-procedures) mainly because all my B&W needs are fairly well satisfied
+procedures) mainly because all my B&W needs are fairly well satisfied
by our laser printer.
The driver features the following:
Supported resolutions
- 360x360 Y weaving (not that micro :-) by the printer
- 720x720 Y microweave by the driver (quicker than the printer)
- 1440x720 Y and X microweave by the driver
-
- Resolutions other than these will result in a rangecheck error.
-
+ 360x360 Y weaving (not that micro :-) by the printer
+ 720x720 Y microweave by the driver (quicker than the printer)
+ 1440x720 Y and X microweave by the driver
+
+ Resolutions other than these will result in a rangecheck error.
+
Papersize:
-
- Whatever Ghostscript supports. The printer docs say that if you load
- multiple sheets of transparencies into the tray you should at least
- have 30mm or 1.2" top margin. The driver always sets the smallest
- possible top margin (3mm or 0.12"), it's up to you to comply.
-
- In addition, the printer says that the bottom margin is at least
- 14mm or 0.54". I violate it by setting it to 0.5" or 12.7mm.
- 0.5" seems to be a common margin value for documents and you
- would hate it when the last line of your page gets printed on the
- top of the next sheet ...
-
+
+ Whatever Ghostscript supports. The printer docs say that if you load
+ multiple sheets of transparencies into the tray you should at least
+ have 30mm or 1.2" top margin. The driver always sets the smallest
+ possible top margin (3mm or 0.12"), it's up to you to comply.
+
+ In addition, the printer says that the bottom margin is at least
+ 14mm or 0.54". I violate it by setting it to 0.5" or 12.7mm.
+ 0.5" seems to be a common margin value for documents and you
+ would hate it when the last line of your page gets printed on the
+ top of the next sheet ...
+
Options:
-
- -dDotSize=n
-
- n = 0 Let the driver choose a dotsize
- n = 1 small dots
- n = 2 more ink
- n = 3 ink flood
- n = 4 'super microdots' (whatever they are, they are *big*)
-
- The default is 0 which is n=1 for 1440x720, 2 for 720x720 and
- 3 for 360x360. Do not use large dots if you don't have to, you
- will soak the paper. If you print 720x720 on normal paper, try
- using n=1.
-
- -dRender=n
-
- n = 0 Floyd-Steinbeck error diffusion
- n = 1 Clustered dither
- n = 2 Bendor's error diffusion (experimental, do not use)
-
- Default is Floyd-Steinbeck error diffusion
-
- -dLeakage=nn
-
- nn is between 0 and 25. It only effects Bendor's error diffusion.
- It sets the percentage of the error which is left to 'leak', that
- is it is the coefficient of an exponential decay of the error.
- Experiments show that it can be beneficial on image quality.
- Default is 0 (no leakage).
-
- -dSplash=nn
-
- nn is between 0 and 100. It only affects Bendor's error diffusion.
- The ED routine tries to take the increase of dot diameter on certain
- paper types into account.
- It sets the percentage of the ink dot size increase as it splashes
- onto the paper and spreads. 0 means no splashing, 100 means that
- the dot is twice as large as it should be.
- Default is 0.
-
- -dBinhibit=n
-
- If n is 1, then if black ink is deposited to a pixel, it will
- inhibit the deposition of any other ink to the same pixel.
- If 0, black ink may be deposited together with other inks.
- Default is on (1).
-
+
+ -dDotSize=n
+
+ n = 0 Let the driver choose a dotsize
+ n = 1 small dots
+ n = 2 more ink
+ n = 3 ink flood
+ n = 4 'super microdots' (whatever they are, they are *big*)
+
+ The default is 0 which is n=1 for 1440x720, 2 for 720x720 and
+ 3 for 360x360. Do not use large dots if you don't have to, you
+ will soak the paper. If you print 720x720 on normal paper, try
+ using n=1.
+
+ -dRender=n
+
+ n = 0 Floyd-Steinbeck error diffusion
+ n = 1 Clustered dither
+ n = 2 Bendor's error diffusion (experimental, do not use)
+
+ Default is Floyd-Steinbeck error diffusion
+
+ -dLeakage=nn
+
+ nn is between 0 and 25. It only effects Bendor's error diffusion.
+ It sets the percentage of the error which is left to 'leak', that
+ is it is the coefficient of an exponential decay of the error.
+ Experiments show that it can be beneficial on image quality.
+ Default is 0 (no leakage).
+
+ -dSplash=nn
+
+ nn is between 0 and 100. It only affects Bendor's error diffusion.
+ The ED routine tries to take the increase of dot diameter on certain
+ paper types into account.
+ It sets the percentage of the ink dot size increase as it splashes
+ onto the paper and spreads. 0 means no splashing, 100 means that
+ the dot is twice as large as it should be.
+ Default is 0.
+
+ -dBinhibit=n
+
+ If n is 1, then if black ink is deposited to a pixel, it will
+ inhibit the deposition of any other ink to the same pixel.
+ If 0, black ink may be deposited together with other inks.
+ Default is on (1).
+
ESC/P RASTER DOCS
~~~~~~~~~~~~~~~~~
-The parts of the ESC/P Raster protocol which I've managed to decipher,
+The parts of the ESC/P Raster protocol which I've managed to decipher,
and which are actually used in this driver can be found below.
nn, mm, xx, etc. represent a single byte with a binary value in it.
nnnn, xxxx etc. represent a 16-bit binary number, sent in two bytes,
-in little endian order (low byte first). 2-digit numbers are a single
+in little endian order (low byte first). 2-digit numbers are a single
byte in hex. Other chars are themselves.
-Quite a few commands are identical to the ESC/P2 commands, these are
+Quite a few commands are identical to the ESC/P2 commands, these are
marked with (P2).
-ESC @ (P2)
-
- Resets the printer.
+ESC @ (P2)
+ Resets the printer.
ESC ( U 01 00 nn (P2)
- Sets the unit to 3600/nn dpi. Note that 1440 can not be set !
-
+ Sets the unit to 3600/nn dpi. Note that 1440 can not be set !
ESC ( C 02 00 nnnn (P2)
- Sets the page (paper) length to nnnn units
-
+ Sets the page (paper) length to nnnn units
ESC ( c 04 00 bbbb tttt (P2)
- Sets the top margin to tttt units, the bottom margin to
- bbbb units. The bottom margin is measured from the top
- of the page not from the bottom of the page !
-
-
+ Sets the top margin to tttt units, the bottom margin to
+ bbbb units. The bottom margin is measured from the top
+ of the page not from the bottom of the page !
+
ESC U nn (P2)
- Unidirectional printing
-
- nn
- 00 off
- 01 on
- 30 off (this is ASCII 0)
- 31 on (this is ASCII 1)
-
-
+ Unidirectional printing
+
+ nn
+ 00 off
+ 01 on
+ 30 off (this is ASCII 0)
+ 31 on (this is ASCII 1)
+
ESC ( i 01 00 nn (P2)
- Microweave
-
- nn
- 00 off
- 01 on
- 30 off (this is ASCII 0)
- 31 on (this is ASCII 1)
-
- Turns microweave on for 720x720 dpi printing.
-
+ Microweave
+
+ nn
+ 00 off
+ 01 on
+ 30 off (this is ASCII 0)
+ 31 on (this is ASCII 1)
+
+ Turns microweave on for 720x720 dpi printing.
+
ESC r nn (P2)
- Select colour
-
- nn
- 01 Cyan
- 02 Magenta
- 04 Yellow
- 08 Black
-
+ Select colour
+
+ nn
+ 01 Cyan
+ 02 Magenta
+ 04 Yellow
+ 08 Black
ESC ( G 01 00 nn (P2)
- Selects graphics mode:
-
- nn
- 00 Off
- 01 On
- 30 Off
- 31 On
-
-
-ESC ( v 02 00 dddd (P2)
+ Selects graphics mode:
- Advance the paper by dddd units defined by ESC ( U
+ nn
+ 00 Off
+ 01 On
+ 30 Off
+ 31 On
+ESC ( v 02 00 dddd (P2)
+
+ Advance the paper by dddd units defined by ESC ( U
ESC . cc vv hh nn mmmm <data> (P2)
- Sends graphics data to the printer.
-
- cc Encoding mode
-
- 00 Raw data
- 01 Run-length encoded data
-
- vv Vertical resolution
-
- 28 90 dpi *interleave*
- 14 180 dpi *interleave*
- 0a 360 dpi
- 05 720 dpi
-
- hh Horizontal resolution
-
- 0a 360 dpi
- 05 720 dpi
-
- nn Number of nozzles
-
- It should be set to 32 (normal printing) or 1 (microweave)
-
- mmmm Number of collumns of data (not number of data bytes !)
-
- <data>
-
- The data should contain as many bytes as needed to fill the
- mmmm * nn pixels. Data is presented horizontally, that is,
- the bits of a byte will be represented by eight pixels in
- a row. If the number of collumns is not an integer multiple
- of eight, then some bits from the last byte belonging to the
- row will be discarded and the next row starts on a byte boundary.
- If a bit in a byte is '1' ink is deposited, if '0' not.
- The leftmost pixel is represented by the MSB, rightmost by LSB.
- In case of raw data that's about it.
-
- In case of run-length encoded data, the following is done:
- The first byte is a counter. If the counter is <= 127 then
- the following counter+1 bytes are uncompressed data.
- If the counter is >= 128 then the following single byte should
- be repeated 257-counter times.
-
- There are resolution restrictions:
-
- 360x360 nozzle= 1 microweave on
- 360x360 nozzle=32 microweave off
- 720x 90 nozzle=32 microweave off
- 720x720 nozzle= 1 microweave on
-
- Other combinations are not supported.
+ Sends graphics data to the printer.
+
+ cc Encoding mode
+
+ 00 Raw data
+ 01 Run-length encoded data
+
+ vv Vertical resolution
+
+ 28 90 dpi *interleave*
+ 14 180 dpi *interleave*
+ 0a 360 dpi
+ 05 720 dpi
+
+ hh Horizontal resolution
+
+ 0a 360 dpi
+ 05 720 dpi
+
+ nn Number of nozzles
+
+ It should be set to 32 (normal printing) or 1 (microweave)
+
+ mmmm Number of collumns of data (not number of data bytes !)
+
+ <data>
+
+ The data should contain as many bytes as needed to fill the
+ mmmm * nn pixels. Data is presented horizontally, that is,
+ the bits of a byte will be represented by eight pixels in
+ a row. If the number of collumns is not an integer multiple
+ of eight, then some bits from the last byte belonging to the
+ row will be discarded and the next row starts on a byte boundary.
+ If a bit in a byte is '1' ink is deposited, if '0' not.
+ The leftmost pixel is represented by the MSB, rightmost by LSB.
+ In case of raw data that's about it.
+
+ In case of run-length encoded data, the following is done:
+ The first byte is a counter. If the counter is <= 127 then
+ the following counter+1 bytes are uncompressed data.
+ If the counter is >= 128 then the following single byte should
+ be repeated 257-counter times.
+
+ There are resolution restrictions:
+
+ 360x360 nozzle= 1 microweave on
+ 360x360 nozzle=32 microweave off
+ 720x 90 nozzle=32 microweave off
+ 720x720 nozzle= 1 microweave on
+
+ Other combinations are not supported.
ESC ( e 02 00 00 nn
- Sets the amount of ink spat onto the paper.
-
- nn
- 01 microdots (faint printing)
- 02 normal dots (not so faint printing)
- 03 double dots (full inking)
- 04 super microdots (ink is continuously dripping :-)
-
- Values other than that have apparently no effect.
-
+ Sets the amount of ink spat onto the paper.
+
+ nn
+ 01 microdots (faint printing)
+ 02 normal dots (not so faint printing)
+ 03 double dots (full inking)
+ 04 super microdots (ink is continuously dripping :-)
+
+ Values other than that have apparently no effect.
+
ESC ( K 02 00 xxxx
- This command is sent by the Windows driver but it is not used
- in the Epson test images. I have not found it having any effect
- whatsoever. The driver does not use it. The Epson docs don't
- mention it.
-
-ESC ( r 02 00 nn mm
-
- Selects the ink according to this:
+ This command is sent by the Windows driver but it is not used
+ in the Epson test images. I have not found it having any effect
+ whatsoever. The driver does not use it. The Epson docs don't
+ mention it.
- nn mm
- 00 00 black
- 00 01 magenta
- 00 02 cyan
- 00 04 yellow
- 01 01 light magenta
- 01 02 light yellow
+ESC ( r 02 00 nn mm
+ Selects the ink according to this:
+
+ nn mm
+ 00 00 black
+ 00 01 magenta
+ 00 02 cyan
+ 00 04 yellow
+ 01 01 light magenta
+ 01 02 light yellow
ESC ( \ 04 00 xxxx llll
- Horizontal positioning of the head.
-
- Moves the head to the position llll times 1/xxxx inches from
- the left margin.
- On the example images xxxx was always set to 1440.
- I tried other values in which case the command was ignored,
- so stick to 1440.
+ Horizontal positioning of the head.
+
+ Moves the head to the position llll times 1/xxxx inches from
+ the left margin.
+ On the example images xxxx was always set to 1440.
+ I tried other values in which case the command was ignored,
+ so stick to 1440.
-
-ESC ( R ll 00 00 <text> <cc> xxxx nn .. nn
+ESC ( R ll 00 00 <text> <cc> xxxx nn .. nn
ESC 00 00 00
- This is supposedly sets the printer into 'remote' mode.
- ll is the length of the <text> + 1 which consists of ASCII
- characters (e.g. REMOTE1).
- <cc> is a two-character code, for example "SN" or "LD".
- xxxx is the number of bytes (nn -s) which will follow.
- After that there's either a new <cc> xxxx nn .. nn sequence or
- the ESC 00 00 00.
- I have absolutely no idea about this command and the Epson document
- says that it's in an other document. It's not in that other one.
- The driver does not use it. The printer does not miss it.
- The Epson test images use it and the Windows driver uses it too.
- They send different <cc>-s and different values for identical <cc>-s.
- Go figure.
-
+ This is supposedly sets the printer into 'remote' mode.
+ ll is the length of the <text> + 1 which consists of ASCII
+ characters (e.g. REMOTE1).
+ <cc> is a two-character code, for example "SN" or "LD".
+ xxxx is the number of bytes (nn -s) which will follow.
+ After that there's either a new <cc> xxxx nn .. nn sequence or
+ the ESC 00 00 00.
+ I have absolutely no idea about this command and the Epson document
+ says that it's in an other document. It's not in that other one.
+ The driver does not use it. The printer does not miss it.
+ The Epson test images use it and the Windows driver uses it too.
+ They send different <cc>-s and different values for identical <cc>-s.
+ Go figure.
+
DRIVER INTERNALS
~~~~~~~~~~~~~~~~
First, some comments.
-Anything I know about the printer can be found above.
-Anything I know about Ghostscript internals (not much) can be
-found in the comments in the code. I do not believe in the 'it was hard
-to write, it should be hard to read' principle since I once had to
+Anything I know about the printer can be found above.
+Anything I know about Ghostscript internals (not much) can be
+found in the comments in the code. I do not believe in the 'it was hard
+to write, it should be hard to read' principle since I once had to
understand my own code.
Therefore, the code has lots of comments in it, sometimes apparently
-superfluous but I find it easier to understand the program 6 months
+superfluous but I find it easier to understand the program 6 months
later that way.
I did not follow the Ghostscript or GNU style guide, I write code the way
I like it - I'm a lazy dog :-) I use hard tabs at every 4th position,
I use a *lot* of whitespace (as recommended by K&R in their original
-C book) and I have a formatting style similar to the K&R with the
-notable exception that I do not indent variable declarations that follow
-the curly. Anyway, you can run your favourite C formatter through the
+C book) and I have a formatting style similar to the K&R with the
+notable exception that I do not indent variable declarations that follow
+the curly. Anyway, you can run your favourite C formatter through the
source.
-In addition to the above, the driver is not hand-optimised, it assumes
+In addition to the above, the driver is not hand-optimised, it assumes
that it is compiled with a good optimising compiler which will handle
common subexpression ellimination, move loop independent code out of
the loop, transform repeated array accesses to cached pointer arithmetics
-and so on. The code is much more readable this way and gcc is fairly
+and so on. The code is much more readable this way and gcc is fairly
good at doing optimisation. Feel free to hand-optimise it.
So, the driver works the following way:
@@ -438,8 +427,8 @@ Line scheduling
Then it calls the line scheduler. To see why do we have a scheduler, you
have to understand weaving. The printer head has 32 nozzles which are
spaced at 8 line intervals. Therefore, it prints 32 lines at a time but they
-are distributed over a 256 line high area. Obviously, if you want to print
-all the lines under the head, you should pass over the paper 8 times.
+are distributed over a 256 line high area. Obviously, if you want to print
+all the lines under the head, you should pass over the paper 8 times.
You can do it the obvious way:
Print, move down by one line, print ... repeat 8 times then move down
by 256 - 8 lines and start again. Unfortunately, this would result in
@@ -450,21 +439,21 @@ cause 8-line high bands to appear on the image.
The solution is 'microweave', a funny way of doing interlaced printing.
Instead of moving down 1, 1, 1, 1, .. 1, 248, 1, 1 .. you move down
-a constant, larger amount (called a band). This amount must be chosen
-in such a way that each line will be printed and preferably it will be
+a constant, larger amount (called a band). This amount must be chosen
+in such a way that each line will be printed and preferably it will be
printed only once.
-Let for example the move down amount (the band) be 31. Let's say,
+Let for example the move down amount (the band) be 31. Let's say,
in band N nozzle 31 is over line 300, in which case nozzle 30 is over
-line 292. We move the head down by 31 lines, then line 299 will be
+line 292. We move the head down by 31 lines, then line 299 will be
under nozzle 27 and line 307 under nozzle 28.
Next move, nozzle 23 will print line 298 and nozzle 24 line 306, then
19/297 20/305, 15/296 16/304, 11/295 12/303, 7/294 8/302, 3/293 4/302,
-0/292 3/301 which covers the entire area between 292 and 307.
-The same will apply to any other area on the page. Also note that
-adjacent lines are always printed by different nozzles.
+0/292 3/301 which covers the entire area between 292 and 307.
+The same will apply to any other area on the page. Also note that
+adjacent lines are always printed by different nozzles.
You probably have realised that line 292 was printed in the first pass
-and in the last one. In this case, of course, the line must not be printed
+and in the last one. In this case, of course, the line must not be printed
twice, one or the other pass should not deliver data to the nozzle which
passes over this line.
@@ -472,41 +461,40 @@ Now there's a twist. When the horizontal resolution is 1440 dpi you have
to print each line twice, first depositing all even pixels then offset
the head by 1/1440" and deposit all odd pixels (the printer can only
print with 720 dpi but you can initially position the head with 1440 dpi
-resolution). You could do it the easy way, passing over the same area
-twice but you can do better. You can find a band size which will result
-each line being printed twice. Instead of suppressing the double print,
+resolution). You could do it the easy way, passing over the same area
+twice but you can do better. You can find a band size which will result
+each line being printed twice. Instead of suppressing the double print,
you use this mechanism to print the odd and the even pixels.
Now if you print one line's odd pixels, obviously, all lines belonging
to the 31 other nozzles of the head will have their odd pixels printed too.
Therefore, you have to keep track which lines have been printed in which
phase and try to find an odd-even phase assignment to bands so that each line
-has both groups printed (and each group only once).
+has both groups printed (and each group only once).
The added bonus is that even the same line will be printed by two different
nozzles thus effects of nozzle differences can be decreased further.
-The whole issue is further complicated with the beginning of the page and
+The whole issue is further complicated with the beginning of the page and
the end of the page. When you print the first 8 lines you *must* use the
print, down by 1, print ... method but then you have to switch over to the
banding method. To do it well, you should minimise the number of lines which
-are printed out of band. This optimisation is not complex but not trivial
+are printed out of band. This optimisation is not complex but not trivial
either. Our solution is to employ precalculated tables for the first 8 lines.
(Epson's solution is not to print the 'problematic' lines at all - they
warn you in the manual that at the top and bottom you may have "slight
distortions". Analyzing their output reveals the reason ... ).
-The bottom is different. It is easier, because you are already banding, so
+The bottom is different. It is easier, because you are already banding, so
you can't screw up the rest of the image. On the other hand, you can't use
tables because these tables would depend on the page height which you don't
-know a priori. Our solution is to switch to single line mode when we can
-not do the banding any more and try to finish the page with the minimal
+know a priori. Our solution is to switch to single line mode when we can
+not do the banding any more and try to finish the page with the minimal
amount of passes.
-So, first the driver calls the scheduler which returns a list of lines which
-it dispatched to print in the current band. Then the driver checks if it has
-all these lines halftoned. Since the head covers an area of 256 lines, we
-have to buffer that many lines (actually, 256-7). As the head moves down,
+So, first the driver calls the scheduler which returns a list of lines which
+it dispatched to print in the current band. Then the driver checks if it has
+all these lines halftoned. Since the head covers an area of 256 lines, we
+have to buffer that many lines (actually, 256-7). As the head moves down,
we can flush lines which it has left and halftone the new ones.
-
Colour transformations
----------------------
@@ -520,8 +508,8 @@ transformations that will map the ideal C, M, Y values to amounts of
ink of the real kind. You also have a black ink. Although in theory
mixing C, M, Y in equal amount will give you black, it doesn't exactly
work that way. In addition, black ink is cheap compared to the colour
-so if you can use black, you rather use that. On top of all that,
-because of other effects (ink splashing on the paper and things like that)
+so if you can use black, you rather use that. On top of all that,
+because of other effects (ink splashing on the paper and things like that)
you have to apply some non-linear functions to get reasonable colours.
Halftoning
@@ -534,7 +522,7 @@ FS one and IMHO results in somewhat lower halftoning noise. However,
it completely screws up some flat colours so don't use it.
There is also dithering, which is quick but noisy.
-For any halftoning method, it is assumed that the haltoning can be
+For any halftoning method, it is assumed that the haltoning can be
done on the 4 colours (CMYK) separately and all interdependencies are
already handled. It is an optimistic assumption, however, close enough.
@@ -543,14 +531,14 @@ module. A halftoner module consists of 4 functions:
- Init, which is called before halftoning starts.
- Threshold, which should return a number which tells the driver how many
- empty lines needed before halftoning can be stopped (i.e. for how many
+ empty lines needed before halftoning can be stopped (i.e. for how many
lines will a line affect halftoning of subsequent lines).
- Halftone, which halftones one colour of one line
- EndOfLine which is called when all colours of a scanline are halftoned,
you can do your housekeeping functions here.
For example, in the case of ED init() clears the error buffers, threshold()
-returns ~5 (5 empty lines are enough for the accumulated error to go to
+returns ~5 (5 empty lines are enough for the accumulated error to go to
almost zero), endofline() shuffles the error buffers and halftone() itself
does the error diffusion. In case of dithering, threshold is 0 (dithering
has no memory), init and endofline do nothing and halftone simply
@@ -564,13 +552,13 @@ A few options are available for all halftoners:
Therefore, an already set black pixel can block the halftoning of colours
for that pixel. Whether this thing is activated or not is a command line
switch (default is on). Your halftoner may choose to ignore this flag.
-
+
- the intensity value of the light-cyan and light-magenta ink can be
set from the command line. My experience is that the default 127 is
good enough, but you can override it if you want to.
-
-Apart from these features, each halftoner can have all sorts of other
-switches. Currently there are switches for the Bendor ED, see the
+
+Apart from these features, each halftoner can have all sorts of other
+switches. Currently there are switches for the Bendor ED, see the
comments in front of the BendorLine() function to see what they are.
Postprocessing
@@ -677,7 +665,7 @@ it may come later.
#define ICOLN 4
/*
-* This is the maximum number of error lines needed by any
+* This is the maximum number of error lines needed by any
* currently implemented rendering function.
* If you need more, increase it.
*/
@@ -685,16 +673,16 @@ it may come later.
#define MAX_ED_LINES 3
/*
-* If this is defined to !0 then we use Adobe's CMYK -> RGB mapping,
+* If this is defined to !0 then we use Adobe's CMYK -> RGB mapping,
* Ghostscript's otherwise. Ghostscript claims that their mapping
* is better. The mapping of CMYK to RGB according to Adobe is:
-*
+*
* R = 1.0 - min( 1.0, C + K )
* G = 1.0 - min( 1.0, M + K )
* B = 1.0 - min( 1.0, Y + K )
*
* while Ghostscript uses this:
-*
+*
* R = ( 1.0 - C ) * ( 1.0 - K )
* G = ( 1.0 - M ) * ( 1.0 - K )
* B = ( 1.0 - Y ) * ( 1.0 - K )
@@ -717,29 +705,29 @@ it may come later.
#define OFFS_K 3
#define DECOMPOSE_CMYK( index, c, m, y, k ) \
- { \
- (k) = (index) & 255; \
- (y) = ( (index) >> 8 ) & 255; \
- (m) = ( (index) >> 16 ) & 255; \
- (c) = ( (index) >> 24 ) & 255; \
- }
+ { \
+ (k) = (index) & 255; \
+ (y) = ( (index) >> 8 ) & 255; \
+ (m) = ( (index) >> 16 ) & 255; \
+ (c) = ( (index) >> 24 ) & 255; \
+ }
#define BUILD_CMYK( c, m, y, k ) \
- ((((long)(c)&255)<<24)|(((long)(m)&255)<<16)|\
- (((long)(y)&255)<<8)|((long)(k)&255))
+ ((((long)(c)&255)<<24)|(((long)(m)&255)<<16)|\
+ (((long)(y)&255)<<8)|((long)(k)&255))
/*
* This structure is for colour compensation
*/
-
+
typedef struct {
- int ra; /* Real colour angle (hue) */
- int ia; /* Theoretical ink colour angle */
- int c; /* Cyan component */
- int m; /* Magenta component */
- int y; /* Yellow component */
-
+ int ra; /* Real colour angle (hue) */
+ int ia; /* Theoretical ink colour angle */
+ int c; /* Cyan component */
+ int m; /* Magenta component */
+ int y; /* Yellow component */
+
} CCOMP;
/*
@@ -748,18 +736,18 @@ typedef struct {
typedef struct gx_photoex_device_s {
- gx_device_common; /* This macro defines a graphics dev. */
- gx_prn_device_common; /* This macro extends for printer dev. */
- int shingling; /* Shingling (multipass, overlap) mode */
- int depletion; /* Excess dot removal */
- int halftoner; /* Rendering type */
- int splash; /* Splashing compensation factor */
- int leakage; /* Error leakage (percentage) */
- int mono; /* Monochrome mode (black only) */
- int pureblack; /* Black ink blocks others */
- int midcyan; /* Light cyan ink value */
- int midmagenta; /* Light magenta ink value */
- int dotsize; /* Size of the ink dot */
+ gx_device_common; /* This macro defines a graphics dev. */
+ gx_prn_device_common; /* This macro extends for printer dev. */
+ int shingling; /* Shingling (multipass, overlap) mode */
+ int depletion; /* Excess dot removal */
+ int halftoner; /* Rendering type */
+ int splash; /* Splashing compensation factor */
+ int leakage; /* Error leakage (percentage) */
+ int mono; /* Monochrome mode (black only) */
+ int pureblack; /* Black ink blocks others */
+ int midcyan; /* Light cyan ink value */
+ int midmagenta; /* Light magenta ink value */
+ int dotsize; /* Size of the ink dot */
} gx_photoex_device;
@@ -787,16 +775,16 @@ typedef gs_param_name PNAME;
typedef struct {
- int first; /* Index of the first useful byte */
- int last; /* Index of the last useful byte */
- byte data[ MAX_BYTES ]; /* Actual raw data */
+ int first; /* Index of the first useful byte */
+ int last; /* Index of the last useful byte */
+ byte data[ MAX_BYTES ]; /* Actual raw data */
} RAWLINE;
/*
* These definitions are used by the microweave scheduler.
* These are the band height definitions. Do not fiddle with them,
-* they are the largest number with which no lines are skipped
+* they are the largest number with which no lines are skipped
* and the unused nozzles in the head for each band is minimal.
* They, of course, depend on the number of nozzles in the head
* and their spacing, these numbers are for 32 and 8, respectively.
@@ -812,23 +800,23 @@ typedef struct {
/*
* This structure is used to generate the line scheduling data.
-* Input/output refers to the scheduler I/F: input means data
+* Input/output refers to the scheduler I/F: input means data
* given to the scheduler, output is what it gives back. Unspecified
* data is scheduler private.
*/
typedef struct {
- int last; /* Input Last line to print */
- int resol; /* Input X Resolution */
- int nozzle; /* Output Number of nozzles */
- int down; /* Output Lines to move down */
- int head[ NOZZLES ]; /* Output Which lines to be sent */
- int offset; /* Output Offset line by 1/1440" */
- int top; /* Head position now */
- int markbeg; /* First marked line */
- byte mark[ MAX_MARK ]; /* Marks already printed lines */
-
+ int last; /* Input Last line to print */
+ int resol; /* Input X Resolution */
+ int nozzle; /* Output Number of nozzles */
+ int down; /* Output Lines to move down */
+ int head[ NOZZLES ]; /* Output Which lines to be sent */
+ int offset; /* Output Offset line by 1/1440" */
+ int top; /* Head position now */
+ int markbeg; /* First marked line */
+ byte mark[ MAX_MARK ]; /* Marks already printed lines */
+
} SCHEDUL;
/*
@@ -838,53 +826,53 @@ typedef struct {
#define SendByte( s, x ) fputc( (x), (s) )
#define SendWord( s, x ) SendByte((s), (x) & 255); \
- SendByte((s), ((x) >> 8 ) & 255);
+ SendByte((s), ((x) >> 8 ) & 255);
/*
* This structure stores all the data during rendering
*/
typedef struct {
-
- EDEV *dev; /* The actual device struct */
- FILE *stream; /* Output stream */
- int yres; /* Y resolution */
- int xres; /* X resolution */
- int start; /* Left margin in 1/1440 inches */
- int width; /* Input data width in pixels */
- int lines; /* Number of lines */
- int mono; /* Black only */
- byte *dbuff; /* Data buffer */
- int htone_thold; /* Halftoner restart threshold */
- int htone_last; /* Last line halftoned */
- SCHEDUL schedule; /* Line scheduling info */
-
- /* These are the error buffers for error diffusion. MAX_PIXELS*2
- is needed for 1440 dpi printing. */
-
- short err[ MAX_ED_LINES ][ ICOLN ][ MAX_PIXELS*2 ];
-
- /* Error buffer pointers. I love C :-) */
-
- short ( *error[ MAX_ED_LINES ] )[ MAX_PIXELS*2 ];
-
- /* This stores the halftoning result for a line,
- not yet in device format. (It's CMYK 1 byte/pixel/colour) */
-
- byte res[ ICOLN ][ MAX_PIXELS*2 ];
-
- /* This is the buffer for rendered lines, converted
- to raw device data (not yet run-length encoded).
- That is, it's 6 colours, 1 bit/pixel/colour.
- The first index is the 1440 dpi X-weave phase. */
-
- RAWLINE raw[ 2 ][ DCOLN ][ MAX_MARK ];
-
- /* This buffer stores a single line of one colour,
- run-length encoded, ready to send to the printer */
-
- byte rle[ MAX_PIXELS * 2 ];
-
+
+ EDEV *dev; /* The actual device struct */
+ FILE *stream; /* Output stream */
+ int yres; /* Y resolution */
+ int xres; /* X resolution */
+ int start; /* Left margin in 1/1440 inches */
+ int width; /* Input data width in pixels */
+ int lines; /* Number of lines */
+ int mono; /* Black only */
+ byte *dbuff; /* Data buffer */
+ int htone_thold; /* Halftoner restart threshold */
+ int htone_last; /* Last line halftoned */
+ SCHEDUL schedule; /* Line scheduling info */
+
+ /* These are the error buffers for error diffusion. MAX_PIXELS*2
+ is needed for 1440 dpi printing. */
+
+ short err[ MAX_ED_LINES ][ ICOLN ][ MAX_PIXELS*2 ];
+
+ /* Error buffer pointers. I love C :-) */
+
+ short ( *error[ MAX_ED_LINES ] )[ MAX_PIXELS*2 ];
+
+ /* This stores the halftoning result for a line,
+ not yet in device format. (It's CMYK 1 byte/pixel/colour) */
+
+ byte res[ ICOLN ][ MAX_PIXELS*2 ];
+
+ /* This is the buffer for rendered lines, converted
+ to raw device data (not yet run-length encoded).
+ That is, it's 6 colours, 1 bit/pixel/colour.
+ The first index is the 1440 dpi X-weave phase. */
+
+ RAWLINE raw[ 2 ][ DCOLN ][ MAX_MARK ];
+
+ /* This buffer stores a single line of one colour,
+ run-length encoded, ready to send to the printer */
+
+ byte rle[ MAX_PIXELS * 2 ];
+
} RENDER;
/*
@@ -892,18 +880,18 @@ typedef struct {
*/
typedef struct {
-
- RENDER *render; /* Render info, if needed */
- byte *data; /* Input data */
- int step; /* Steps on input data */
- byte *res; /* Result */
- byte *block; /* Blocking data */
- short **err; /* Pointers to error buffers */
- int lim1; /* Halftoning lower limit */
- int lim2; /* Halftoning upper limit */
- int mval; /* Level represented by 'light' colour */
-
-} HTONE;
+
+ RENDER *render; /* Render info, if needed */
+ byte *data; /* Input data */
+ int step; /* Steps on input data */
+ byte *res; /* Result */
+ byte *block; /* Blocking data */
+ short **err; /* Pointers to error buffers */
+ int lim1; /* Halftoning lower limit */
+ int lim2; /* Halftoning upper limit */
+ int mval; /* Level represented by 'light' colour */
+
+} HTONE;
/*
* Halftoner function table
@@ -911,10 +899,10 @@ typedef struct {
typedef struct {
- int (*hthld)( RENDER *rend );
- void (*hstrt)( RENDER *rend, int line );
- void (*hteol)( RENDER *rend, int line );
- void (*htone)( HTONE *htone, int line );
+ int (*hthld)( RENDER *rend );
+ void (*hstrt)( RENDER *rend, int line );
+ void (*hteol)( RENDER *rend, int line );
+ void (*htone)( HTONE *htone, int line );
} HFUNCS;
@@ -930,7 +918,7 @@ typedef struct {
#define DMATRIX_X 16
#define DMATRIX_Y 16
-
+
/****************************************************************************/
/* Prototypes */
/****************************************************************************/
@@ -943,7 +931,7 @@ static int photoex_get_params( DEV *dev, PLIST *plist );
static int photoex_put_params( DEV *dev, PLIST *plist );
static int PutInt( PLIST *plist, PNAME name, int *val,
- int minval, int maxval, int code );
+ int minval, int maxval, int code );
static int GetInt( PLIST *list, PNAME name, int *value, int code );
static int Cmy2A( int c, int m, int y );
@@ -1005,26 +993,26 @@ static void DitherLine( HTONE *htone, int y );
static const HFUNCS htable[ MAXHTONE ] = {
- { FloydSThold, FloydSStart, FloydSEol, FloydSLine },
- { DitherThold, DitherStart, DitherEol, DitherLine },
- { BendorThold, BendorStart, BendorEol, BendorLine }
+ { FloydSThold, FloydSStart, FloydSEol, FloydSLine },
+ { DitherThold, DitherStart, DitherEol, DitherLine },
+ { BendorThold, BendorStart, BendorEol, BendorLine }
};
/*
* Define the printer procedures.
-* The definition is based on GS macros, the only real stuff that we
+* The definition is based on GS macros, the only real stuff that we
* define here are the photoex_ functions.
*/
static gx_device_procs photoex_device_procs = prn_color_params_procs(
- photoex_open, /* Opens the device */
- gdev_prn_output_page,
- gdev_prn_close,
- photoex_map_rgb_color, /* Maps an RGB pixel to device colour */
- photoex_map_color_rgb, /* Maps device colour back to RGB */
- photoex_get_params, /* Gets device parameters */
- photoex_put_params /* Puts device parameters */
+ photoex_open, /* Opens the device */
+ gdev_prn_output_page,
+ gdev_prn_close,
+ photoex_map_rgb_color, /* Maps an RGB pixel to device colour */
+ photoex_map_color_rgb, /* Maps device colour back to RGB */
+ photoex_get_params, /* Gets device parameters */
+ photoex_put_params /* Puts device parameters */
);
/*
@@ -1034,182 +1022,181 @@ static gx_device_procs photoex_device_procs = prn_color_params_procs(
*/
gx_photoex_device far_data gs_photoex_device = {
-
- /* This is a macro that fills GS specific fields in the struct */
-
- prn_device_body(
-
- gx_photoex_device, /* Device struct type */
- photoex_device_procs, /* Procedure table */
- "photoex", /* Name of the device */
- DEFAULT_WIDTH_10THS, /* Default width */
- DEFAULT_HEIGHT_10THS, /* Default height */
- X_DPI, /* Vertical resolution */
- Y_DPI, /* Horizontal resolution */
- MARGIN_L, /* Left margin */
- MARGIN_B, /* Bottom margin */
- MARGIN_R, /* Right margin */
- MARGIN_T, /* Top margin */
- ICOLN, /* Number of colours (4:CMYK) */
- 32, /* Bit per pixel for the device(!) */
- 255, /* Max. gray level */
- 255, /* Max. colour level */
- 256, /* Number of gray gradations */
- 256, /* Number of colour gradations */
- photoex_print_page /* Print page procedure */
- ),
-
- /* Here come our extensions */
-
- 0, /* Shingling off, not implemented */
- 0, /* Depletion off, not implemented */
- 0, /* Dither type: FS ED */
- 0, /* No splash correction */
- 0, /* No leakage */
- 0, /* Not monochrome */
- 1, /* Colour inhibition on black */
- 127, /* Mid level cyan */
- 127, /* Mid level magenta */
- 0 /* Automatic dot size setting */
+
+ /* This is a macro that fills GS specific fields in the struct */
+
+ prn_device_body(
+
+ gx_photoex_device, /* Device struct type */
+ photoex_device_procs, /* Procedure table */
+ "photoex", /* Name of the device */
+ DEFAULT_WIDTH_10THS, /* Default width */
+ DEFAULT_HEIGHT_10THS, /* Default height */
+ X_DPI, /* Vertical resolution */
+ Y_DPI, /* Horizontal resolution */
+ MARGIN_L, /* Left margin */
+ MARGIN_B, /* Bottom margin */
+ MARGIN_R, /* Right margin */
+ MARGIN_T, /* Top margin */
+ ICOLN, /* Number of colours (4:CMYK) */
+ 32, /* Bit per pixel for the device(!) */
+ 255, /* Max. gray level */
+ 255, /* Max. colour level */
+ 256, /* Number of gray gradations */
+ 256, /* Number of colour gradations */
+ photoex_print_page /* Print page procedure */
+ ),
+
+ /* Here come our extensions */
+
+ 0, /* Shingling off, not implemented */
+ 0, /* Depletion off, not implemented */
+ 0, /* Dither type: FS ED */
+ 0, /* No splash correction */
+ 0, /* No leakage */
+ 0, /* Not monochrome */
+ 1, /* Colour inhibition on black */
+ 127, /* Mid level cyan */
+ 127, /* Mid level magenta */
+ 0 /* Automatic dot size setting */
};
/*
-* This table contains the line scheduling table for the first
+* This table contains the line scheduling table for the first
* few runs if we are in 720 dpi mode.
*/
static const int start_720[ HEAD_SPACING ][ NOZZLES ] = {
- { 0, 8, 16, 24, 32, 40, 48, 56,
- 64, 72, 80, 88, 96, 104, 112, 120,
- 128, 136, 144, 152, 160, 168, 176, 184,
- 192, 200, 208, 216, 224, 232, 240, 248 },
-
- { 1, 9, 17, 25, 33, 41, 49, 57,
- 65, 73, 81, 89, 97, 105, 113, 121,
- 129, 137, 145, 153, 161, 169, 177, 185,
- 193, 201, 209, -1, -1, -1, -1, -1 },
-
- { 2, 10, 18, 26, 34, 42, 50, 58,
- 66, 74, 82, 90, 98, 106, 114, 122,
- 130, 138, 146, 154, 162, 170, 178, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 3, 11, 19, 27, 35, 43, 51, 59,
- 67, 75, 83, 91, 99, 107, 115, 123,
- 131, 139, 147, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 4, 12, 20, 28, 36, 44, 52, 60,
- 68, 76, 84, 92, 100, 108, 116, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 5, 13, 21, 29, 37, 45, 53, 61,
- 69, 77, 85, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 6, 14, 22, 30, 38, 46, 54, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 7, 15, 23, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 }
+ { 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 72, 80, 88, 96, 104, 112, 120,
+ 128, 136, 144, 152, 160, 168, 176, 184,
+ 192, 200, 208, 216, 224, 232, 240, 248 },
+
+ { 1, 9, 17, 25, 33, 41, 49, 57,
+ 65, 73, 81, 89, 97, 105, 113, 121,
+ 129, 137, 145, 153, 161, 169, 177, 185,
+ 193, 201, 209, -1, -1, -1, -1, -1 },
+
+ { 2, 10, 18, 26, 34, 42, 50, 58,
+ 66, 74, 82, 90, 98, 106, 114, 122,
+ 130, 138, 146, 154, 162, 170, 178, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 3, 11, 19, 27, 35, 43, 51, 59,
+ 67, 75, 83, 91, 99, 107, 115, 123,
+ 131, 139, 147, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 4, 12, 20, 28, 36, 44, 52, 60,
+ 68, 76, 84, 92, 100, 108, 116, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 5, 13, 21, 29, 37, 45, 53, 61,
+ 69, 77, 85, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 6, 14, 22, 30, 38, 46, 54, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 7, 15, 23, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 }
};
-
/*
-* This table contains the scheduling table for the first
+* This table contains the scheduling table for the first
* few lines if we are in 1440 dpi mode
*/
static const int start_1440[ 2 ][ HEAD_SPACING ][ NOZZLES ] = {
{
- { 0, 8, 16, 24, 32, 40, 48, 56,
- 64, 72, 80, 88, 96, 104, 112, 120,
- 128, 136, 144, 152, 160, 168, 176, 184,
- 192, 200, 208, 216, 224, 232, 240, 248 },
-
- { 1, 9, 17, 25, 33, 41, 49, 57,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 2, 10, 18, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 3, 11, 19, 27, 35, 43, 51, 59,
- 67, 75, 83, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 4, 12, 20, 28, 36, 44, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 5, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 6, 14, 22, 30, 38, 46, 54, 62,
- 70, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 7, 15, 23, 31, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
+ { 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 72, 80, 88, 96, 104, 112, 120,
+ 128, 136, 144, 152, 160, 168, 176, 184,
+ 192, 200, 208, 216, 224, 232, 240, 248 },
+
+ { 1, 9, 17, 25, 33, 41, 49, 57,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 2, 10, 18, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 3, 11, 19, 27, 35, 43, 51, 59,
+ 67, 75, 83, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 4, 12, 20, 28, 36, 44, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 5, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 6, 14, 22, 30, 38, 46, 54, 62,
+ 70, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 7, 15, 23, 31, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
},
{
- { 0, 8, 16, 24, 32, 40, 48, 56,
- 64, 72, 80, 88, 96, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 1, 9, 17, 25, 33, 41, 49, 57,
- 65, 73, 81, 89, 97, 105, 113, 121,
- 129, 137, 145, 153, 161, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 2, 10, 18, 26, 34, 42, 50, 58,
- 66, 74, 82, 90, 98, 106, 114, 122,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 3, 11, 19, 27, 35, 43, 51, 59,
- 67, 75, 83, 91, 99, 107, 115, 123,
- 131, 139, 147, 155, 163, 171, 179, 187,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 4, 12, 20, 28, 36, 44, 52, 60,
- 68, 76, 84, 92, 100, 108, 116, 124,
- 132, 140, 148, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 5, 13, 21, 29, 37, 45, 53, 61,
- 69, 77, 85, 93, 101, 109, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 6, 14, 22, 30, 38, 46, 54, 62,
- 70, 78, 86, 94, 102, 110, 118, 126,
- 134, 142, 150, 158, 166, 174, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
-
- { 7, 15, 23, 31, 39, 47, 55, 63,
- 71, 79, 87, 95, 103, 111, 119, 127,
- 135, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1 },
+ { 0, 8, 16, 24, 32, 40, 48, 56,
+ 64, 72, 80, 88, 96, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 1, 9, 17, 25, 33, 41, 49, 57,
+ 65, 73, 81, 89, 97, 105, 113, 121,
+ 129, 137, 145, 153, 161, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 2, 10, 18, 26, 34, 42, 50, 58,
+ 66, 74, 82, 90, 98, 106, 114, 122,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 3, 11, 19, 27, 35, 43, 51, 59,
+ 67, 75, 83, 91, 99, 107, 115, 123,
+ 131, 139, 147, 155, 163, 171, 179, 187,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 4, 12, 20, 28, 36, 44, 52, 60,
+ 68, 76, 84, 92, 100, 108, 116, 124,
+ 132, 140, 148, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 5, 13, 21, 29, 37, 45, 53, 61,
+ 69, 77, 85, 93, 101, 109, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 6, 14, 22, 30, 38, 46, 54, 62,
+ 70, 78, 86, 94, 102, 110, 118, 126,
+ 134, 142, 150, 158, 166, 174, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
+
+ { 7, 15, 23, 31, 39, 47, 55, 63,
+ 71, 79, 87, 95, 103, 111, 119, 127,
+ 135, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1 },
}
};
@@ -1220,70 +1207,70 @@ static const int start_1440[ 2 ][ HEAD_SPACING ][ NOZZLES ] = {
*/
static byte dmatrix[ DMATRIX_Y ][ DMATRIX_X ] = {
- {
- 0x0e, 0x8e, 0x2e, 0xae, 0x06, 0x86, 0x26, 0xa6,
- 0x0c, 0x8c, 0x2c, 0xac, 0x04, 0x84, 0x24, 0xa4
- },
- {
- 0xce, 0x4e, 0xee, 0x6e, 0xc6, 0x46, 0xe6, 0x66,
- 0xcc, 0x4c, 0xec, 0x6c, 0xc4, 0x44, 0xe4, 0x64
- },
- {
- 0x3e, 0xbe, 0x1e, 0x9e, 0x36, 0xb6, 0x16, 0x96,
- 0x3c, 0xbc, 0x1c, 0x9c, 0x34, 0xb4, 0x14, 0x94
- },
- {
- 0xfe, 0x7e, 0xde, 0x5e, 0xf6, 0x76, 0xd6, 0x56,
- 0xfc, 0x7c, 0xdc, 0x5c, 0xf4, 0x74, 0xd4, 0x54
- },
- {
- 0x01, 0x81, 0x21, 0xa1, 0x09, 0x89, 0x29, 0xa9,
- 0x03, 0x83, 0x23, 0xa3, 0x0b, 0x8b, 0x2b, 0xab
- },
- {
- 0xc1, 0x41, 0xe1, 0x61, 0xc9, 0x49, 0xe9, 0x69,
- 0xc3, 0x43, 0xe3, 0x63, 0xcb, 0x4b, 0xeb, 0x6b
- },
- {
- 0x31, 0xb1, 0x11, 0x91, 0x39, 0xb9, 0x19, 0x99,
- 0x33, 0xb3, 0x13, 0x93, 0x3b, 0xbb, 0x1b, 0x9b
- },
- {
- 0xf1, 0x71, 0xd1, 0x51, 0xf9, 0x79, 0xd9, 0x59,
- 0xf3, 0x73, 0xd3, 0x53, 0xfb, 0x7b, 0xdb, 0x5b
- },
- {
- 0x0d, 0x8d, 0x2d, 0xad, 0x05, 0x85, 0x25, 0xa5,
- 0x0f, 0x8f, 0x2f, 0xaf, 0x07, 0x87, 0x27, 0xa7
- },
- {
- 0xcd, 0x4d, 0xed, 0x6d, 0xc5, 0x45, 0xe5, 0x65,
- 0xcf, 0x4f, 0xef, 0x6f, 0xc7, 0x47, 0xe7, 0x67
- },
- {
- 0x3d, 0xbd, 0x1d, 0x9d, 0x35, 0xb5, 0x15, 0x95,
- 0x3f, 0xbf, 0x1f, 0x9f, 0x37, 0xb7, 0x17, 0x97
- },
- {
- 0xfd, 0x7d, 0xdd, 0x5d, 0xf5, 0x75, 0xd5, 0x55,
- 0xff, 0x7f, 0xdf, 0x5f, 0xf7, 0x77, 0xd7, 0x57
- },
- {
- 0x02, 0x82, 0x22, 0xa2, 0x0a, 0x8a, 0x2a, 0xaa,
- 0x01, 0x80, 0x20, 0xa0, 0x08, 0x88, 0x28, 0xa8
- },
- {
- 0xc2, 0x42, 0xe2, 0x62, 0xca, 0x4a, 0xea, 0x6a,
- 0xc0, 0x40, 0xe0, 0x60, 0xc8, 0x48, 0xe8, 0x68
- },
- {
- 0x32, 0xb2, 0x12, 0x92, 0x3a, 0xba, 0x1a, 0x9a,
- 0x30, 0xb0, 0x10, 0x90, 0x38, 0xb8, 0x18, 0x98
- },
- {
- 0xf2, 0x72, 0xd2, 0x52, 0xfa, 0x7a, 0xda, 0x5a,
- 0xf0, 0x70, 0xd0, 0x50, 0xf8, 0x78, 0xd8, 0x58
- }
+ {
+ 0x0e, 0x8e, 0x2e, 0xae, 0x06, 0x86, 0x26, 0xa6,
+ 0x0c, 0x8c, 0x2c, 0xac, 0x04, 0x84, 0x24, 0xa4
+ },
+ {
+ 0xce, 0x4e, 0xee, 0x6e, 0xc6, 0x46, 0xe6, 0x66,
+ 0xcc, 0x4c, 0xec, 0x6c, 0xc4, 0x44, 0xe4, 0x64
+ },
+ {
+ 0x3e, 0xbe, 0x1e, 0x9e, 0x36, 0xb6, 0x16, 0x96,
+ 0x3c, 0xbc, 0x1c, 0x9c, 0x34, 0xb4, 0x14, 0x94
+ },
+ {
+ 0xfe, 0x7e, 0xde, 0x5e, 0xf6, 0x76, 0xd6, 0x56,
+ 0xfc, 0x7c, 0xdc, 0x5c, 0xf4, 0x74, 0xd4, 0x54
+ },
+ {
+ 0x01, 0x81, 0x21, 0xa1, 0x09, 0x89, 0x29, 0xa9,
+ 0x03, 0x83, 0x23, 0xa3, 0x0b, 0x8b, 0x2b, 0xab
+ },
+ {
+ 0xc1, 0x41, 0xe1, 0x61, 0xc9, 0x49, 0xe9, 0x69,
+ 0xc3, 0x43, 0xe3, 0x63, 0xcb, 0x4b, 0xeb, 0x6b
+ },
+ {
+ 0x31, 0xb1, 0x11, 0x91, 0x39, 0xb9, 0x19, 0x99,
+ 0x33, 0xb3, 0x13, 0x93, 0x3b, 0xbb, 0x1b, 0x9b
+ },
+ {
+ 0xf1, 0x71, 0xd1, 0x51, 0xf9, 0x79, 0xd9, 0x59,
+ 0xf3, 0x73, 0xd3, 0x53, 0xfb, 0x7b, 0xdb, 0x5b
+ },
+ {
+ 0x0d, 0x8d, 0x2d, 0xad, 0x05, 0x85, 0x25, 0xa5,
+ 0x0f, 0x8f, 0x2f, 0xaf, 0x07, 0x87, 0x27, 0xa7
+ },
+ {
+ 0xcd, 0x4d, 0xed, 0x6d, 0xc5, 0x45, 0xe5, 0x65,
+ 0xcf, 0x4f, 0xef, 0x6f, 0xc7, 0x47, 0xe7, 0x67
+ },
+ {
+ 0x3d, 0xbd, 0x1d, 0x9d, 0x35, 0xb5, 0x15, 0x95,
+ 0x3f, 0xbf, 0x1f, 0x9f, 0x37, 0xb7, 0x17, 0x97
+ },
+ {
+ 0xfd, 0x7d, 0xdd, 0x5d, 0xf5, 0x75, 0xd5, 0x55,
+ 0xff, 0x7f, 0xdf, 0x5f, 0xf7, 0x77, 0xd7, 0x57
+ },
+ {
+ 0x02, 0x82, 0x22, 0xa2, 0x0a, 0x8a, 0x2a, 0xaa,
+ 0x01, 0x80, 0x20, 0xa0, 0x08, 0x88, 0x28, 0xa8
+ },
+ {
+ 0xc2, 0x42, 0xe2, 0x62, 0xca, 0x4a, 0xea, 0x6a,
+ 0xc0, 0x40, 0xe0, 0x60, 0xc8, 0x48, 0xe8, 0x68
+ },
+ {
+ 0x32, 0xb2, 0x12, 0x92, 0x3a, 0xba, 0x1a, 0x9a,
+ 0x30, 0xb0, 0x10, 0x90, 0x38, 0xb8, 0x18, 0x98
+ },
+ {
+ 0xf2, 0x72, 0xd2, 0x52, 0xfa, 0x7a, 0xda, 0x5a,
+ 0xf0, 0x70, 0xd0, 0x50, 0xf8, 0x78, 0xd8, 0x58
+ }
};
/*
@@ -1292,14 +1279,14 @@ static byte dmatrix[ DMATRIX_Y ][ DMATRIX_X ] = {
static CCOMP ctable[] = {
- { -255, -255, 0, 0, 255 }, /* same as green */
- { 102, 0, 255, 0, 0 }, /* cyan */
- { 255, 255, 255, 255, 0 }, /* blue */
- { 560, 512, 0, 255, 0 }, /* magenta */
- { 765, 765, 0, 255, 255 }, /* red */
- { 1045, 1020, 0, 0, 255 }, /* yellow */
- { 1275, 1275, 255, 0, 255 }, /* green */
- { 1632, 1530, 255, 0, 0 } /* same as cyan */
+ { -255, -255, 0, 0, 255 }, /* same as green */
+ { 102, 0, 255, 0, 0 }, /* cyan */
+ { 255, 255, 255, 255, 0 }, /* blue */
+ { 560, 512, 0, 255, 0 }, /* magenta */
+ { 765, 765, 0, 255, 255 }, /* red */
+ { 1045, 1020, 0, 0, 255 }, /* yellow */
+ { 1275, 1275, 255, 0, 255 }, /* green */
+ { 1632, 1530, 255, 0, 0 } /* same as cyan */
};
/*
@@ -1309,38 +1296,38 @@ static CCOMP ctable[] = {
static const unsigned char xtrans[ 256 ] = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 3, 3,
- 3, 3, 3, 3, 3, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5,
- 6, 6, 6, 6, 6, 7, 7, 7,
- 7, 8, 8, 8, 8, 9, 9, 9,
- 10, 10, 10, 11, 11, 11, 12, 12,
- 12, 13, 13, 13, 14, 14, 14, 15,
- 15, 16, 16, 17, 17, 17, 18, 18,
- 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 26, 26, 27,
- 27, 28, 29, 29, 30, 30, 31, 32,
- 32, 33, 34, 34, 35, 36, 37, 37,
- 38, 39, 40, 40, 41, 42, 43, 44,
- 44, 45, 46, 47, 48, 49, 50, 51,
- 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 67,
- 68, 69, 70, 71, 72, 73, 74, 76,
- 77, 78, 79, 80, 82, 83, 84, 86,
- 87, 88, 89, 91, 92, 94, 95, 96,
- 98, 99, 101, 102, 103, 105, 106, 108,
- 109, 111, 112, 114, 116, 117, 119, 120,
- 122, 124, 125, 127, 129, 130, 132, 134,
- 136, 137, 139, 141, 143, 145, 146, 148,
- 150, 152, 154, 156, 158, 160, 162, 164,
- 166, 168, 170, 172, 174, 176, 178, 180
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+ 3, 3, 3, 3, 3, 4, 4, 4,
+ 4, 4, 4, 5, 5, 5, 5, 5,
+ 6, 6, 6, 6, 6, 7, 7, 7,
+ 7, 8, 8, 8, 8, 9, 9, 9,
+ 10, 10, 10, 11, 11, 11, 12, 12,
+ 12, 13, 13, 13, 14, 14, 14, 15,
+ 15, 16, 16, 17, 17, 17, 18, 18,
+ 19, 19, 20, 20, 21, 21, 22, 22,
+ 23, 23, 24, 24, 25, 26, 26, 27,
+ 27, 28, 29, 29, 30, 30, 31, 32,
+ 32, 33, 34, 34, 35, 36, 37, 37,
+ 38, 39, 40, 40, 41, 42, 43, 44,
+ 44, 45, 46, 47, 48, 49, 50, 51,
+ 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 67,
+ 68, 69, 70, 71, 72, 73, 74, 76,
+ 77, 78, 79, 80, 82, 83, 84, 86,
+ 87, 88, 89, 91, 92, 94, 95, 96,
+ 98, 99, 101, 102, 103, 105, 106, 108,
+ 109, 111, 112, 114, 116, 117, 119, 120,
+ 122, 124, 125, 127, 129, 130, 132, 134,
+ 136, 137, 139, 141, 143, 145, 146, 148,
+ 150, 152, 154, 156, 158, 160, 162, 164,
+ 166, 168, 170, 172, 174, 176, 178, 180
};
/****************************************************************************/
@@ -1353,16 +1340,16 @@ double height;
double width;
float margins[ 4 ]; /* L, B, R, T */
- height = pdev->height / pdev->y_pixels_per_inch;
- width = pdev->width / pdev->x_pixels_per_inch;
-
- margins[ 0 ] = 0.12;
- margins[ 1 ] = 0.5;
- margins[ 2 ] = 0.12;
- margins[ 3 ] = ( width > 11.46+0.12 ) ? width - (11.46+0.12) : 0.12;
-
- gx_device_set_margins( pdev, margins, true );
- return( gdev_prn_open( pdev ) );
+ height = pdev->height / pdev->y_pixels_per_inch;
+ width = pdev->width / pdev->x_pixels_per_inch;
+
+ margins[ 0 ] = 0.12;
+ margins[ 1 ] = 0.5;
+ margins[ 2 ] = 0.12;
+ margins[ 3 ] = ( width > 11.46+0.12 ) ? width - (11.46+0.12) : 0.12;
+
+ gx_device_set_margins( pdev, margins, true );
+ return( gdev_prn_open( pdev ) );
}
/****************************************************************************/
@@ -1370,11 +1357,11 @@ float margins[ 4 ]; /* L, B, R, T */
/****************************************************************************/
/*
-* Map an RGB colour to device colour.
+* Map an RGB colour to device colour.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
-* Since we present ourselves to Ghostscript as if we were a
-* full colour resolution RGB device, we calculate the CMYK
+* Since we present ourselves to Ghostscript as if we were a
+* full colour resolution RGB device, we calculate the CMYK
* values and pack them into the result. This depends on
* color_index being at least 32 bit !!!
*/
@@ -1386,59 +1373,59 @@ int a, s, f;
EDEV *edev;
int i;
- edev = (EDEV *) dev;
-
- /* White and black are treated on their own */
-
- if ( ( r & g & b ) == ( 1 << gx_color_value_bits ) - 1 ) {
-
- /* White */
-
- return( BUILD_CMYK( 0, 0, 0, 0 ) );
- }
-
- if ( ( r | g | b ) == 0 ) {
-
- /* Black */
-
- return( BUILD_CMYK( 0, 0, 0, xtrans[ 0xff ] ) );
- }
-
- /* Map RGB to 8 bit/colour CMY */
-
- c = 255 - ( r >> ( gx_color_value_bits - 8 ) );
- m = 255 - ( g >> ( gx_color_value_bits - 8 ) );
- y = 255 - ( b >> ( gx_color_value_bits - 8 ) );
-
- k = xtrans[ min( c, min( m, y ) ) ] * 0.8; /* FIXME:empirical constant */
- c -= k;
- m -= k;
- y -= k;
-
- s = max ( c, max( y, m ) );
-
- /* Map the colour to an angle and find the relevant table range */
-
- a = Cmy2A( c, m, y );
- for ( i = 1 ; a > ctable[ i ].ra ; i++ );
-
- /* Now map c, m, y. */
-
- f = ((a - ctable[ i-1 ].ra) << 16 ) / (ctable[ i ].ra - ctable[ i-1 ].ra);
- c = (( ctable[i-1].c << 16 ) + ( ctable[i].c - ctable[i-1].c ) * f ) >> 16;
- m = (( ctable[i-1].m << 16 ) + ( ctable[i].m - ctable[i-1].m ) * f ) >> 16;
- y = (( ctable[i-1].y << 16 ) + ( ctable[i].y - ctable[i-1].y ) * f ) >> 16;
-
- s = xtrans[ s ];
- c = ( c * s ) >> 8;
- m = ( m * s ) >> 8;
- y = ( y * s ) >> 8;
-
- return( BUILD_CMYK( c, m, y, k ) );
+ edev = (EDEV *) dev;
+
+ /* White and black are treated on their own */
+
+ if ( ( r & g & b ) == ( 1 << gx_color_value_bits ) - 1 ) {
+
+ /* White */
+
+ return( BUILD_CMYK( 0, 0, 0, 0 ) );
+ }
+
+ if ( ( r | g | b ) == 0 ) {
+
+ /* Black */
+
+ return( BUILD_CMYK( 0, 0, 0, xtrans[ 0xff ] ) );
+ }
+
+ /* Map RGB to 8 bit/colour CMY */
+
+ c = 255 - ( r >> ( gx_color_value_bits - 8 ) );
+ m = 255 - ( g >> ( gx_color_value_bits - 8 ) );
+ y = 255 - ( b >> ( gx_color_value_bits - 8 ) );
+
+ k = xtrans[ min( c, min( m, y ) ) ] * 0.8; /* FIXME:empirical constant */
+ c -= k;
+ m -= k;
+ y -= k;
+
+ s = max ( c, max( y, m ) );
+
+ /* Map the colour to an angle and find the relevant table range */
+
+ a = Cmy2A( c, m, y );
+ for ( i = 1 ; a > ctable[ i ].ra ; i++ );
+
+ /* Now map c, m, y. */
+
+ f = ((a - ctable[ i-1 ].ra) << 16 ) / (ctable[ i ].ra - ctable[ i-1 ].ra);
+ c = (( ctable[i-1].c << 16 ) + ( ctable[i].c - ctable[i-1].c ) * f ) >> 16;
+ m = (( ctable[i-1].m << 16 ) + ( ctable[i].m - ctable[i-1].m ) * f ) >> 16;
+ y = (( ctable[i-1].y << 16 ) + ( ctable[i].y - ctable[i-1].y ) * f ) >> 16;
+
+ s = xtrans[ s ];
+ c = ( c * s ) >> 8;
+ m = ( m * s ) >> 8;
+ y = ( y * s ) >> 8;
+
+ return( BUILD_CMYK( c, m, y, k ) );
}
/*
-* Map a device colour value back to RGB.
+* Map a device colour value back to RGB.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* CAVEAT:
@@ -1451,49 +1438,49 @@ static int photoex_map_color_rgb( DEV *dev, CINX index, CVAL prgb[3] )
uint c, m, y, k;
CVAL r, g, b;
- /* Let's separate the colours */
-
- DECOMPOSE_CMYK( index, c, m, y, k );
-
- k = index & 255;
- y = ( index >> 8 ) & 255;
- m = ( index >> 16 ) & 255;
- c = ( index >> 24 ) & 255;
-
- /* Depending on whether we use Adobe or Ghostscript mapping,
- calculate the colours */
-
- if ( MAP_RGB_ADOBE ) {
-
- r = gx_max_color_value * ( 1.0 - min( 1.0, (c / 255.0 + k / 255.0) ) );
- g = gx_max_color_value * ( 1.0 - min( 1.0, (m / 255.0 + k / 255.0) ) );
- b = gx_max_color_value * ( 1.0 - min( 1.0, (y / 255.0 + k / 255.0) ) );
- }
- else {
-
- r = gx_max_color_value * ( 1.0 - c / 255.0 ) * ( 1.0 - k / 255.0);
- g = gx_max_color_value * ( 1.0 - m / 255.0 ) * ( 1.0 - k / 255.0);
- b = gx_max_color_value * ( 1.0 - y / 255.0 ) * ( 1.0 - k / 255.0);
- }
-
- prgb[ 0 ] = r;
- prgb[ 1 ] = g;
- prgb[ 2 ] = b;
-
- return( 0 );
+ /* Let's separate the colours */
+
+ DECOMPOSE_CMYK( index, c, m, y, k );
+
+ k = index & 255;
+ y = ( index >> 8 ) & 255;
+ m = ( index >> 16 ) & 255;
+ c = ( index >> 24 ) & 255;
+
+ /* Depending on whether we use Adobe or Ghostscript mapping,
+ calculate the colours */
+
+ if ( MAP_RGB_ADOBE ) {
+
+ r = gx_max_color_value * ( 1.0 - min( 1.0, (c / 255.0 + k / 255.0) ) );
+ g = gx_max_color_value * ( 1.0 - min( 1.0, (m / 255.0 + k / 255.0) ) );
+ b = gx_max_color_value * ( 1.0 - min( 1.0, (y / 255.0 + k / 255.0) ) );
+ }
+ else {
+
+ r = gx_max_color_value * ( 1.0 - c / 255.0 ) * ( 1.0 - k / 255.0);
+ g = gx_max_color_value * ( 1.0 - m / 255.0 ) * ( 1.0 - k / 255.0);
+ b = gx_max_color_value * ( 1.0 - y / 255.0 ) * ( 1.0 - k / 255.0);
+ }
+
+ prgb[ 0 ] = r;
+ prgb[ 1 ] = g;
+ prgb[ 2 ] = b;
+
+ return( 0 );
}
/*
* This function maps a (c,m,y) triplet into an angle.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
-* Angle: 0 cyan C=255 M= 0 Y= 0
+* Angle: 0 cyan C=255 M= 0 Y= 0
* 255 blue C=255 M=255 Y= 0
* 510 magenta C= 0 M=255 Y= 0
* 765 red C= 0 M=255 Y=255
* 1020 yellow C= 0 M= 0 Y=255
* 1275 green C=255 M= 0 Y=255
-* 1530 cyan
+* 1530 cyan
*/
static int Cmy2A( int c, int m, int y )
@@ -1502,55 +1489,55 @@ int black;
int maxim;
int a;
- /* Calculate the black level */
-
- black = min( c, min( m, y ) );
-
- /* Remove the black from the colours themselves */
-
- c -= black;
- m -= black;
- y -= black;
-
- /* If all 3 remaining colours are 0, then it is a gray: special case */
-
- if ( ! c && ! m && ! y ) return( 0 );
-
- /* Normalise the colours. At least one at most two of them is 0
- and at least one at most two of them is 255 */
-
- maxim = max( c, max( m, y ) );
-
- c = ( 255 * c ) / maxim;
- m = ( 255 * m ) / maxim;
- y = ( 255 * y ) / maxim;
-
- if ( c == 255 ) {
-
- if ( ! y )
-
- a = m; /* cyan - blue */
- else
- a = 1530 - y; /* green - cyan */
- }
- else if ( m == 255 ) {
-
- if ( ! c )
-
- a = 510 + y; /* magenta - red */
- else
- a = 510 - c; /* blue - magenta */
- }
- else {
-
- if ( ! m )
-
- a = 1020 + c; /* yellow - green */
- else
- a = 1020 - m; /* red - yellow */
- }
-
- return( a );
+ /* Calculate the black level */
+
+ black = min( c, min( m, y ) );
+
+ /* Remove the black from the colours themselves */
+
+ c -= black;
+ m -= black;
+ y -= black;
+
+ /* If all 3 remaining colours are 0, then it is a gray: special case */
+
+ if ( ! c && ! m && ! y ) return( 0 );
+
+ /* Normalise the colours. At least one at most two of them is 0
+ and at least one at most two of them is 255 */
+
+ maxim = max( c, max( m, y ) );
+
+ c = ( 255 * c ) / maxim;
+ m = ( 255 * m ) / maxim;
+ y = ( 255 * y ) / maxim;
+
+ if ( c == 255 ) {
+
+ if ( ! y )
+
+ a = m; /* cyan - blue */
+ else
+ a = 1530 - y; /* green - cyan */
+ }
+ else if ( m == 255 ) {
+
+ if ( ! c )
+
+ a = 510 + y; /* magenta - red */
+ else
+ a = 510 - c; /* blue - magenta */
+ }
+ else {
+
+ if ( ! m )
+
+ a = 1020 + c; /* yellow - green */
+ else
+ a = 1020 - m; /* red - yellow */
+ }
+
+ return( a );
}
/****************************************************************************/
@@ -1567,18 +1554,18 @@ static int photoex_get_params( DEV *device, PLIST *plist )
int code;
EDEV *dev;
- dev = (EDEV *) device;
-
- code = gdev_prn_get_params( device, plist );
-
- code = GetInt( plist, "Depletion", &dev->depletion, code );
- code = GetInt( plist, "Shingling", &dev->shingling, code );
- code = GetInt( plist, "Render", &dev->halftoner, code );
- code = GetInt( plist, "Splash", &dev->splash, code );
- code = GetInt( plist, "Leakage", &dev->leakage, code );
- code = GetInt( plist, "Binhibit", &dev->pureblack, code );
- code = GetInt( plist, "DotSize", &dev->dotsize, code );
- return( code );
+ dev = (EDEV *) device;
+
+ code = gdev_prn_get_params( device, plist );
+
+ code = GetInt( plist, "Depletion", &dev->depletion, code );
+ code = GetInt( plist, "Shingling", &dev->shingling, code );
+ code = GetInt( plist, "Render", &dev->halftoner, code );
+ code = GetInt( plist, "Splash", &dev->splash, code );
+ code = GetInt( plist, "Leakage", &dev->leakage, code );
+ code = GetInt( plist, "Binhibit", &dev->pureblack, code );
+ code = GetInt( plist, "DotSize", &dev->dotsize, code );
+ return( code );
}
/*
@@ -1591,22 +1578,22 @@ static int photoex_put_params( DEV *device, PLIST *plist )
int code;
EDEV *dev;
- dev = (EDEV *) device;
- code = 0;
-
- code = PutInt( plist, "Depletion", &dev->depletion, 0, 2, code );
- code = PutInt( plist, "Shingling", &dev->shingling, 0, 2, code );
- code = PutInt( plist, "Render", &dev->halftoner, 0,MAXHTONE-1, code );
- code = PutInt( plist, "Splash", &dev->splash, 0, 50, code );
- code = PutInt( plist, "Leakage", &dev->leakage, 0, 25, code );
- code = PutInt( plist, "Binhibit", &dev->pureblack, 0, 1, code );
- code = PutInt( plist, "DotSize", &dev->dotsize, 0, 4, code );
-
- if ( code < 0 )
-
- return( code );
- else
- return( gdev_prn_put_params( device, plist ) );
+ dev = (EDEV *) device;
+ code = 0;
+
+ code = PutInt( plist, "Depletion", &dev->depletion, 0, 2, code );
+ code = PutInt( plist, "Shingling", &dev->shingling, 0, 2, code );
+ code = PutInt( plist, "Render", &dev->halftoner, 0,MAXHTONE-1, code );
+ code = PutInt( plist, "Splash", &dev->splash, 0, 50, code );
+ code = PutInt( plist, "Leakage", &dev->leakage, 0, 25, code );
+ code = PutInt( plist, "Binhibit", &dev->pureblack, 0, 1, code );
+ code = PutInt( plist, "DotSize", &dev->dotsize, 0, 4, code );
+
+ if ( code < 0 )
+
+ return( code );
+ else
+ return( gdev_prn_put_params( device, plist ) );
}
/*
@@ -1615,40 +1602,40 @@ EDEV *dev;
*/
static int PutInt( PLIST *plist, PNAME name, int *val,
- int minval, int maxval, int code )
+ int minval, int maxval, int code )
{
int new;
- /* If code is already an error, we return it and do nothing. */
-
- if ( code ) return( code );
-
- /* Otherwise we try to read the value */
-
- new = *val;
-
- switch ( code = param_read_int( plist, name, &new ) ) {
-
- case 1: /* No such parameter defined, it's OK */
-
- code = 0;
- break;
-
- case 0: /* We have received a value, rangecheck */
-
- if ( minval > new || new > maxval )
-
- param_signal_error( plist, name, gs_error_rangecheck );
- else
- *val = new;
-
- break;
-
- default: /* Error */
- break;
- }
-
- return( code );
+ /* If code is already an error, we return it and do nothing. */
+
+ if ( code ) return( code );
+
+ /* Otherwise we try to read the value */
+
+ new = *val;
+
+ switch ( code = param_read_int( plist, name, &new ) ) {
+
+ case 1: /* No such parameter defined, it's OK */
+
+ code = 0;
+ break;
+
+ case 0: /* We have received a value, rangecheck */
+
+ if ( minval > new || new > maxval )
+
+ param_signal_error( plist, name, gs_error_rangecheck );
+ else
+ *val = new;
+
+ break;
+
+ default: /* Error */
+ break;
+ }
+
+ return( code );
}
/*
@@ -1658,8 +1645,8 @@ int new;
static int GetInt( PLIST *list, PNAME name, int *value, int code )
{
- if ( code < 0 ) return( code );
- return( param_write_int( list, name, value ) );
+ if ( code < 0 ) return( code );
+ return( param_write_int( list, name, value ) );
}
/****************************************************************************/
@@ -1683,119 +1670,119 @@ int start, width;
int unit;
double psize;
- dev = (EDEV *) device;
-
- /* Check if the resolution is one of the supported ones */
-
- yres = (int) dev->y_pixels_per_inch;
- xres = (int) dev->x_pixels_per_inch;
-
- if ( ! ( ( xres == 360 && yres == 360 ) ||
- ( xres == 720 && yres == 720 ) ||
- ( xres == 1440 && yres == 720 ) ) )
-
- return( gs_error_rangecheck );
-
- pixels = gdev_prn_raster( device ) / sizeof( long );
- psize = device->height / device->y_pixels_per_inch;
-
- /* Check if the requested width is within device limits.
- The calculations are in 1440 dpi units. */
-
- start = 1440.0 * dev_l_margin( device );
-
- x = xres == 360 ? 4 : xres == 720 ? 2 : 1;
-
- if ( start + x * pixels > 2 * MAX_PIXELS ) {
-
- /* We're over the limit, clip width to the required level */
-
- width = ( 2 * MAX_PIXELS - start ) / x;
-
- /* It is rather inprobable that someone would set up a
- left margin wider than the printer, still ... */
-
- if ( width <= 0 ) return( gs_error_rangecheck );
- }
- else {
-
- /* We accept the width as it is */
-
- width = pixels;
- }
-
- /* Now try to get the memory we need. It's actually quite a lot,
- since we have to cache 256 processed lines at 6kbyte each plus
- we need error buffers and stuff. All in all, we'll request
- about 1.5 ~ 2M. */
-
- if ( ! ( render = (RENDER *) gs_malloc( dev->memory, 1, sizeof( RENDER ), "PhotoEX" )))
-
- return_error( gs_error_VMerror );
-
- if ( ! ( render->dbuff = (byte *) gs_malloc( dev->memory, pixels, sizeof( long ),
- "PhotoEX" ) ) ) {
-
- gs_free( dev->memory, render, 1, sizeof( RENDER ), "PhotoEX" );
- return_error( gs_error_VMerror );
- }
-
- /* We've done every possible check and preparation, now
- do the work. Fill the rest of the structure so we can pass
- it to the actual render routine. */
-
- render->dev = dev;
- render->yres = yres;
- render->xres = xres;
- render->width = width;
- render->lines = dev->height;
- render->stream = stream;
- render->mono = dev->mono;
-
- /* Initialise the printer */
-
- SendReset( stream );
- SendReset( stream );
- SendGmode( stream, 1 );
-
- /* Set up units */
-
- unit = ( yres == 360 ) ? 360 : 720;
- SendUnit( stream, RESCODE( unit ) );
-
- /* Set up papersize and margins */
-
- SendPaper( stream, device->height / device->y_pixels_per_inch * unit );
- SendMargin( stream, ( psize - dev_b_margin( device ) ) * unit,
- dev_t_margin( device ) * unit );
-
- /* Dot size as per user setting */
-
- if ( dev->dotsize )
-
- SendInk( stream, dev->dotsize );
- else
- SendInk( stream, yres == 360 ? 3 : ( xres == 720 ? 2 : 1 ) );
-
- /* Microveawe is off, unidirectional printing on */
-
- SendMicro( stream, 0 );
- SendUnidir( stream, 1 );
-
- /* Render the page and send image data to printer */
-
- RenderPage( render );
-
- /* Eject the paper, reset printer */
-
- SendByte( stream, FF );
- SendReset( stream );
-
- /* Release the memory and return */
-
- gs_free( dev->memory, render->dbuff, pixels, sizeof( long ), "PhotoEX" );
- gs_free( dev->memory, render, 1, sizeof( RENDER ), "PhotoEX" );
- return( 0 );
+ dev = (EDEV *) device;
+
+ /* Check if the resolution is one of the supported ones */
+
+ yres = (int) dev->y_pixels_per_inch;
+ xres = (int) dev->x_pixels_per_inch;
+
+ if ( ! ( ( xres == 360 && yres == 360 ) ||
+ ( xres == 720 && yres == 720 ) ||
+ ( xres == 1440 && yres == 720 ) ) )
+
+ return( gs_error_rangecheck );
+
+ pixels = gdev_prn_raster( device ) / sizeof( long );
+ psize = device->height / device->y_pixels_per_inch;
+
+ /* Check if the requested width is within device limits.
+ The calculations are in 1440 dpi units. */
+
+ start = 1440.0 * dev_l_margin( device );
+
+ x = xres == 360 ? 4 : xres == 720 ? 2 : 1;
+
+ if ( start + x * pixels > 2 * MAX_PIXELS ) {
+
+ /* We're over the limit, clip width to the required level */
+
+ width = ( 2 * MAX_PIXELS - start ) / x;
+
+ /* It is rather inprobable that someone would set up a
+ left margin wider than the printer, still ... */
+
+ if ( width <= 0 ) return( gs_error_rangecheck );
+ }
+ else {
+
+ /* We accept the width as it is */
+
+ width = pixels;
+ }
+
+ /* Now try to get the memory we need. It's actually quite a lot,
+ since we have to cache 256 processed lines at 6kbyte each plus
+ we need error buffers and stuff. All in all, we'll request
+ about 1.5 ~ 2M. */
+
+ if ( ! ( render = (RENDER *) gs_malloc( dev->memory, 1, sizeof( RENDER ), "PhotoEX" )))
+
+ return_error( gs_error_VMerror );
+
+ if ( ! ( render->dbuff = (byte *) gs_malloc( dev->memory, pixels, sizeof( long ),
+ "PhotoEX" ) ) ) {
+
+ gs_free( dev->memory, render, 1, sizeof( RENDER ), "PhotoEX" );
+ return_error( gs_error_VMerror );
+ }
+
+ /* We've done every possible check and preparation, now
+ do the work. Fill the rest of the structure so we can pass
+ it to the actual render routine. */
+
+ render->dev = dev;
+ render->yres = yres;
+ render->xres = xres;
+ render->width = width;
+ render->lines = dev->height;
+ render->stream = stream;
+ render->mono = dev->mono;
+
+ /* Initialise the printer */
+
+ SendReset( stream );
+ SendReset( stream );
+ SendGmode( stream, 1 );
+
+ /* Set up units */
+
+ unit = ( yres == 360 ) ? 360 : 720;
+ SendUnit( stream, RESCODE( unit ) );
+
+ /* Set up papersize and margins */
+
+ SendPaper( stream, device->height / device->y_pixels_per_inch * unit );
+ SendMargin( stream, ( psize - dev_b_margin( device ) ) * unit,
+ dev_t_margin( device ) * unit );
+
+ /* Dot size as per user setting */
+
+ if ( dev->dotsize )
+
+ SendInk( stream, dev->dotsize );
+ else
+ SendInk( stream, yres == 360 ? 3 : ( xres == 720 ? 2 : 1 ) );
+
+ /* Microveawe is off, unidirectional printing on */
+
+ SendMicro( stream, 0 );
+ SendUnidir( stream, 1 );
+
+ /* Render the page and send image data to printer */
+
+ RenderPage( render );
+
+ /* Eject the paper, reset printer */
+
+ SendByte( stream, FF );
+ SendReset( stream );
+
+ /* Release the memory and return */
+
+ gs_free( dev->memory, render->dbuff, pixels, sizeof( long ), "PhotoEX" );
+ gs_free( dev->memory, render, 1, sizeof( RENDER ), "PhotoEX" );
+ return( 0 );
}
/*
@@ -1813,118 +1800,118 @@ int min, max; /* Min/max active bytes in a raw line */
int phase; /* 1440dpi X weave offset */
int i, j, l, col;
- p->htone_thold = HalftoneThold( p );
- p->htone_last = -1 - p->htone_thold;
-
- p->schedule.top = -1;
- p->schedule.resol = p->xres;
- p->schedule.last = p->lines;
-
- last_done = -1;
- move_down = 0;
-
- do {
-
- /* Schedule the next batch of lines */
-
- last_band = ScheduleLines( &p->schedule );
-
- /* Find the largest line number we have to process and
- halftone all lines which have not yet been done */
-
- last_need = last_done;
- for ( i = NOZZLES-1 ; i >= 0 && p->schedule.head[ i ] == -1 ; i-- );
- if ( i >= 0 ) last_need = p->schedule.head[ i ];
- while ( last_need > last_done ) RenderLine( p, ++last_done );
-
- /* Now loop through the colours and build the data stream */
-
- phase = p->schedule.offset;
-
- for ( col = 0 ; col < DCOLN ; col++ ) {
-
- /* First see if we have to send any data at all */
-
- min = MAX_BYTES;
- max = 0;
-
- for ( i = 0 ; i < NOZZLES && i < p->schedule.nozzle ; i++ ) {
-
- if ( ( j = p->schedule.head[ i ] ) != -1 ) {
-
- j %= MAX_MARK;
-
- if ( p->raw[ phase ][ col ][ j ].first < min )
-
- min = p->raw[ phase ][ col ][ j ].first;
-
- if ( p->raw[ phase ][ col ][ j ].last > max )
-
- max = p->raw[ phase ][ col ][ j ].last;
- }
- }
-
- if ( min <= max ) {
-
- max++;
-
- /* We have to send data to the printer. If we have
- to position the head, do so now */
-
- if ( move_down ) {
-
- SendDown( p->stream, move_down );
- move_down = 0;
- }
-
- /* Set the desired colour */
-
- SendColour( p->stream, col );
-
- /* Move the head to the desired position */
-
- if ( p->xres == 360 )
-
- SendRight( p->stream, 4 * 8 * min );
-
- else if ( p->xres == 720 )
-
- SendRight( p->stream, 2 * 8 * min );
- else
- SendRight( p->stream, 8 * min + phase );
-
- /* Send the data */
-
- SendData( p->stream, p->xres, p->yres, p->schedule.nozzle,
- ( max-min ) * 8 );
-
- for ( i = 0 ; i < p->schedule.nozzle ; i++ ) {
-
- if ( ( j = p->schedule.head[ i ] ) == -1 ||
- ( p->raw[ phase ][ col ][ j % MAX_MARK ].last <
- p->raw[ phase ][ col ][ j % MAX_MARK ].first ) ) {
-
- l = RleCompress( NULL, min, max, p->rle );
- }
- else {
-
- l = RleCompress( p->raw[ phase ][ col ] + j % MAX_MARK,
- min, max, p->rle );
- }
-
- fwrite( p->rle, l, 1, p->stream );
- }
-
- SendByte( p->stream, CR );
- }
- }
-
- /* Note the amount the head should go down before it prints the
- next band */
-
- move_down += p->schedule.down;
-
- } while ( ! last_band );
+ p->htone_thold = HalftoneThold( p );
+ p->htone_last = -1 - p->htone_thold;
+
+ p->schedule.top = -1;
+ p->schedule.resol = p->xres;
+ p->schedule.last = p->lines;
+
+ last_done = -1;
+ move_down = 0;
+
+ do {
+
+ /* Schedule the next batch of lines */
+
+ last_band = ScheduleLines( &p->schedule );
+
+ /* Find the largest line number we have to process and
+ halftone all lines which have not yet been done */
+
+ last_need = last_done;
+ for ( i = NOZZLES-1 ; i >= 0 && p->schedule.head[ i ] == -1 ; i-- );
+ if ( i >= 0 ) last_need = p->schedule.head[ i ];
+ while ( last_need > last_done ) RenderLine( p, ++last_done );
+
+ /* Now loop through the colours and build the data stream */
+
+ phase = p->schedule.offset;
+
+ for ( col = 0 ; col < DCOLN ; col++ ) {
+
+ /* First see if we have to send any data at all */
+
+ min = MAX_BYTES;
+ max = 0;
+
+ for ( i = 0 ; i < NOZZLES && i < p->schedule.nozzle ; i++ ) {
+
+ if ( ( j = p->schedule.head[ i ] ) != -1 ) {
+
+ j %= MAX_MARK;
+
+ if ( p->raw[ phase ][ col ][ j ].first < min )
+
+ min = p->raw[ phase ][ col ][ j ].first;
+
+ if ( p->raw[ phase ][ col ][ j ].last > max )
+
+ max = p->raw[ phase ][ col ][ j ].last;
+ }
+ }
+
+ if ( min <= max ) {
+
+ max++;
+
+ /* We have to send data to the printer. If we have
+ to position the head, do so now */
+
+ if ( move_down ) {
+
+ SendDown( p->stream, move_down );
+ move_down = 0;
+ }
+
+ /* Set the desired colour */
+
+ SendColour( p->stream, col );
+
+ /* Move the head to the desired position */
+
+ if ( p->xres == 360 )
+
+ SendRight( p->stream, 4 * 8 * min );
+
+ else if ( p->xres == 720 )
+
+ SendRight( p->stream, 2 * 8 * min );
+ else
+ SendRight( p->stream, 8 * min + phase );
+
+ /* Send the data */
+
+ SendData( p->stream, p->xres, p->yres, p->schedule.nozzle,
+ ( max-min ) * 8 );
+
+ for ( i = 0 ; i < p->schedule.nozzle ; i++ ) {
+
+ if ( ( j = p->schedule.head[ i ] ) == -1 ||
+ ( p->raw[ phase ][ col ][ j % MAX_MARK ].last <
+ p->raw[ phase ][ col ][ j % MAX_MARK ].first ) ) {
+
+ l = RleCompress( NULL, min, max, p->rle );
+ }
+ else {
+
+ l = RleCompress( p->raw[ phase ][ col ] + j % MAX_MARK,
+ min, max, p->rle );
+ }
+
+ fwrite( p->rle, l, 1, p->stream );
+ }
+
+ SendByte( p->stream, CR );
+ }
+ }
+
+ /* Note the amount the head should go down before it prints the
+ next band */
+
+ move_down += p->schedule.down;
+
+ } while ( ! last_band );
}
/*
@@ -1942,51 +1929,51 @@ static void RenderLine( RENDER *p, int line )
byte *data;
int i;
- /* Get the line from Ghostscript and see if its empty */
-
- gdev_prn_get_bits( (PDEV *) p->dev, line, p->dbuff, &data );
-
- if ( IsScanlineEmpty( p, data ) ) {
-
- if ( line - p->htone_last > p->htone_thold ) {
-
- /* The line is empty and is farer from the last nonempty
- line than the threshold, no need to render it. */
-
- for ( i = 0 ; i < DCOLN ; i++ ) {
-
- p->raw[ 0 ][ i ][ line % MAX_MARK ].first = MAX_BYTES;
- p->raw[ 0 ][ i ][ line % MAX_MARK ].last = 0;
- p->raw[ 1 ][ i ][ line % MAX_MARK ].first = MAX_BYTES;
- p->raw[ 1 ][ i ][ line % MAX_MARK ].last = 0;
-
- }
- }
- else {
-
- /* The line is empty but it is within the threshold, so we
- have to render it. We do not move the index, though */
-
- HalftoneLine( p, line, data );
- }
- }
- else {
-
- /* This line is not empty */
-
- if ( line - p->htone_last >= p->htone_thold ) {
-
- /* Previous lines were empty and we have already stopped
- rendering them. We have to restart the renderer */
-
- HalftonerStart( p, line );
- }
-
- /* Render the line and move the last active index to this line */
-
- HalftoneLine( p, line, data );
- p->htone_last = line;
- }
+ /* Get the line from Ghostscript and see if its empty */
+
+ gdev_prn_get_bits( (PDEV *) p->dev, line, p->dbuff, &data );
+
+ if ( IsScanlineEmpty( p, data ) ) {
+
+ if ( line - p->htone_last > p->htone_thold ) {
+
+ /* The line is empty and is farer from the last nonempty
+ line than the threshold, no need to render it. */
+
+ for ( i = 0 ; i < DCOLN ; i++ ) {
+
+ p->raw[ 0 ][ i ][ line % MAX_MARK ].first = MAX_BYTES;
+ p->raw[ 0 ][ i ][ line % MAX_MARK ].last = 0;
+ p->raw[ 1 ][ i ][ line % MAX_MARK ].first = MAX_BYTES;
+ p->raw[ 1 ][ i ][ line % MAX_MARK ].last = 0;
+
+ }
+ }
+ else {
+
+ /* The line is empty but it is within the threshold, so we
+ have to render it. We do not move the index, though */
+
+ HalftoneLine( p, line, data );
+ }
+ }
+ else {
+
+ /* This line is not empty */
+
+ if ( line - p->htone_last >= p->htone_thold ) {
+
+ /* Previous lines were empty and we have already stopped
+ rendering them. We have to restart the renderer */
+
+ HalftonerStart( p, line );
+ }
+
+ /* Render the line and move the last active index to this line */
+
+ HalftoneLine( p, line, data );
+ p->htone_last = line;
+ }
}
/*
@@ -1998,15 +1985,15 @@ static int IsScanlineEmpty( RENDER *r, byte *line )
{
int i;
long *p;
-
- p = (long *) line;
-
- for ( i = 0 ; i < r->width ; i++ ) {
-
- if ( *p++ ) return( FALSE );
- }
-
- return( TRUE );
+
+ p = (long *) line;
+
+ for ( i = 0 ; i < r->width ; i++ ) {
+
+ if ( *p++ ) return( FALSE );
+ }
+
+ return( TRUE );
}
/****************************************************************************/
@@ -2026,73 +2013,73 @@ long *p;
* The down field contains the number of units which the head should
* move down when printing of the band is finished. Other fields are
* mainly for the routine's internal use. At the first call, however,
-* the top field should be set to -1, the resol field should be set
+* the top field should be set to -1, the resol field should be set
* to 360, 720 or 1440 and the last field should contain the number
-* of lines to print (that is, last + 1 :-).
+* of lines to print (that is, last + 1 :-).
*
* The routine returns a flag indicating if this was the last print
* for the page.
*/
-
+
static int ScheduleLines( SCHEDUL *p )
{
int i;
- if ( p->top == -1 ) {
-
- /* First call, init everything, then fall through to the rest */
-
- SchedulerInit( p );
- }
-
- /* If nozzle is one, just schedule the next line and that's it.
- You can use this feature for hardware microweave at 720 dpi,
- the driver uses it for 360 dpi. */
-
- if ( p->nozzle == 1 ) {
-
- p->head[ 0 ] = p->top;
- p->down = 1;
- p->top++;
- return( p->top == p->last );
- }
-
- /* Release all expired entries in the mark array */
-
- for ( i = p->markbeg ; i < p->top ; i++ ) p->mark[ i % MAX_MARK ] = 0;
- p->markbeg = p->top;
-
- /* If top is less than the the head spacing, then create the image
- by single steps. This will cause banding on the very top, but
- there's nothing we can do about it. We're still better than
- Epson's driver which simply ignores the first few lines,
- it does not even try to schedule them ... */
-
- if ( p->top < HEAD_SPACING ) {
-
- ScheduleLeading( p );
- return( FALSE );
- }
-
- /* See if we are almost at the end. If yes, we will advance line by
- line. */
-
- if ( p->top + p->resol + (NOZZLES) * HEAD_SPACING > p->last ) {
-
- ScheduleTrailing( p );
-
- if ( p->down )
-
- return( p->top + (NOZZLES-1) * HEAD_SPACING >= p->last );
- else
- return( FALSE );
- }
-
- /* Otherwise we're in the middle of the page, just do the
- simple banding and selecting as many lines as we can. */
-
- ScheduleMiddle( p );
- return( FALSE );
+ if ( p->top == -1 ) {
+
+ /* First call, init everything, then fall through to the rest */
+
+ SchedulerInit( p );
+ }
+
+ /* If nozzle is one, just schedule the next line and that's it.
+ You can use this feature for hardware microweave at 720 dpi,
+ the driver uses it for 360 dpi. */
+
+ if ( p->nozzle == 1 ) {
+
+ p->head[ 0 ] = p->top;
+ p->down = 1;
+ p->top++;
+ return( p->top == p->last );
+ }
+
+ /* Release all expired entries in the mark array */
+
+ for ( i = p->markbeg ; i < p->top ; i++ ) p->mark[ i % MAX_MARK ] = 0;
+ p->markbeg = p->top;
+
+ /* If top is less than the the head spacing, then create the image
+ by single steps. This will cause banding on the very top, but
+ there's nothing we can do about it. We're still better than
+ Epson's driver which simply ignores the first few lines,
+ it does not even try to schedule them ... */
+
+ if ( p->top < HEAD_SPACING ) {
+
+ ScheduleLeading( p );
+ return( FALSE );
+ }
+
+ /* See if we are almost at the end. If yes, we will advance line by
+ line. */
+
+ if ( p->top + p->resol + (NOZZLES) * HEAD_SPACING > p->last ) {
+
+ ScheduleTrailing( p );
+
+ if ( p->down )
+
+ return( p->top + (NOZZLES-1) * HEAD_SPACING >= p->last );
+ else
+ return( FALSE );
+ }
+
+ /* Otherwise we're in the middle of the page, just do the
+ simple banding and selecting as many lines as we can. */
+
+ ScheduleMiddle( p );
+ return( FALSE );
}
/*
@@ -2103,33 +2090,33 @@ int i;
static void SchedulerInit( SCHEDUL *p )
{
int i;
-
- p->top = 0;
-
- switch ( p->resol ) {
-
- case 360:
- p->offset = 0;
- p->resol = BAND_360;
- p->nozzle = NOZZLE_360;
- break;
-
- case 720:
- p->offset = 0;
- p->resol = BAND_720;
- p->nozzle = NOZZLE_720;
- break;
-
- case 1440:
- p->offset = 1; /* Need to be set for the algorithm! */
- p->resol = BAND_1440;
- p->nozzle = NOZZLE_1440;
- break;
- }
-
- for ( i = 0 ; i < NOZZLES ; i++ ) p->head[ i ] = -1;
- for ( i = 0 ; i < MAX_MARK ; i++ ) p->mark[ i ] = 0;
- p->markbeg = 0;
+
+ p->top = 0;
+
+ switch ( p->resol ) {
+
+ case 360:
+ p->offset = 0;
+ p->resol = BAND_360;
+ p->nozzle = NOZZLE_360;
+ break;
+
+ case 720:
+ p->offset = 0;
+ p->resol = BAND_720;
+ p->nozzle = NOZZLE_720;
+ break;
+
+ case 1440:
+ p->offset = 1; /* Need to be set for the algorithm! */
+ p->resol = BAND_1440;
+ p->nozzle = NOZZLE_1440;
+ break;
+ }
+
+ for ( i = 0 ; i < NOZZLES ; i++ ) p->head[ i ] = -1;
+ for ( i = 0 ; i < MAX_MARK ; i++ ) p->mark[ i ] = 0;
+ p->markbeg = 0;
}
/*
@@ -2141,86 +2128,86 @@ static void ScheduleLeading( SCHEDUL *p )
{
int i;
- if ( p->resol == BAND_720 ) {
-
- /* Copy the line scheduling data to the struct */
-
- memcpy( p->head, start_720[ p->top ], sizeof( int ) * NOZZLES );
-
- /* Mark all lines to be set */
-
- for ( i = 0 ; i < NOZZLES ; i++ )
-
- if ( p->head[ i ] != -1 )
-
- p->mark[ p->head[ i ] % MAX_MARK ] = 1;
-
- /* We move down by one line except at the end */
-
- if ( p->top == HEAD_SPACING - 1 ) {
-
- p->down = BAND_720 - p->top;
- p->top = BAND_720;
- }
- else {
-
- p->down = 1;
- p->top++;
- }
- }
- else {
-
- /* 1440 dpi version, two passes needed for each scanline */
-
- if ( p->offset ) {
-
- /* Copy the non-offseted scheduling data to the struct */
-
- memcpy( p->head, start_1440[0][p->top], sizeof( int ) * NOZZLES );
-
- /* Mark all lines to be set */
-
- for ( i = 0 ; i < NOZZLES ; i++ )
-
- if ( p->head[ i ] != -1 )
-
- p->mark[ p->head[ i ] % MAX_MARK ] = 1;
-
- /* This is the non-offseted line, do not move ! */
-
- p->offset = 0;
- p->down = 0;
- }
- else {
-
- /* Copy the non-offseted schduling data to the struct */
-
- memcpy( p->head, start_1440[1][p->top], sizeof( int ) * NOZZLES );
-
- /* Mark all lines to be set */
-
- for ( i = 0 ; i < NOZZLES ; i++ )
-
- if ( p->head[ i ] != -1 )
-
- p->mark[ p->head[ i ] % MAX_MARK ] |= 2;
-
- /* We move down by one line except at the end and set offset */
-
- if ( p->top == HEAD_SPACING - 1 ) {
-
- p->down = BAND_1440 - p->top;
- p->top = BAND_1440;
- }
- else {
-
- p->down = 1;
- p->top++;
- }
-
- p->offset = 1;
- }
- }
+ if ( p->resol == BAND_720 ) {
+
+ /* Copy the line scheduling data to the struct */
+
+ memcpy( p->head, start_720[ p->top ], sizeof( int ) * NOZZLES );
+
+ /* Mark all lines to be set */
+
+ for ( i = 0 ; i < NOZZLES ; i++ )
+
+ if ( p->head[ i ] != -1 )
+
+ p->mark[ p->head[ i ] % MAX_MARK ] = 1;
+
+ /* We move down by one line except at the end */
+
+ if ( p->top == HEAD_SPACING - 1 ) {
+
+ p->down = BAND_720 - p->top;
+ p->top = BAND_720;
+ }
+ else {
+
+ p->down = 1;
+ p->top++;
+ }
+ }
+ else {
+
+ /* 1440 dpi version, two passes needed for each scanline */
+
+ if ( p->offset ) {
+
+ /* Copy the non-offseted scheduling data to the struct */
+
+ memcpy( p->head, start_1440[0][p->top], sizeof( int ) * NOZZLES );
+
+ /* Mark all lines to be set */
+
+ for ( i = 0 ; i < NOZZLES ; i++ )
+
+ if ( p->head[ i ] != -1 )
+
+ p->mark[ p->head[ i ] % MAX_MARK ] = 1;
+
+ /* This is the non-offseted line, do not move ! */
+
+ p->offset = 0;
+ p->down = 0;
+ }
+ else {
+
+ /* Copy the non-offseted schduling data to the struct */
+
+ memcpy( p->head, start_1440[1][p->top], sizeof( int ) * NOZZLES );
+
+ /* Mark all lines to be set */
+
+ for ( i = 0 ; i < NOZZLES ; i++ )
+
+ if ( p->head[ i ] != -1 )
+
+ p->mark[ p->head[ i ] % MAX_MARK ] |= 2;
+
+ /* We move down by one line except at the end and set offset */
+
+ if ( p->top == HEAD_SPACING - 1 ) {
+
+ p->down = BAND_1440 - p->top;
+ p->top = BAND_1440;
+ }
+ else {
+
+ p->down = 1;
+ p->top++;
+ }
+
+ p->offset = 1;
+ }
+ }
}
/*
@@ -2234,55 +2221,55 @@ int ph0, ph1;
int line, mask;
int i;
- if ( p->resol == BAND_720 ) {
-
- /* 720 DPI printing. See which lines should we print and
- fill the head array accordingly, then move down a band. */
-
- ScheduleBand( p, 1 );
- p->down = BAND_720;
- p->top += BAND_720;
- }
- else {
-
- /* 1440 dpi printing. This is a bit more complex than the
- 720 dpi one. First, see how many lines in each phase
- has already been printed. */
-
- ph0 = ph1 = 0;
-
- for ( line = p->top, i=0 ; i < NOZZLES ; i++, line += HEAD_SPACING ) {
-
- line = p->top + i * HEAD_SPACING;
- ph0 += p->mark[ line % MAX_MARK ] & 1;
- ph1 += p->mark[ line % MAX_MARK ] & 2;
- }
-
- ph1 >>= 1;
-
- /* Choose the phase which has less lines in it. */
-
- if ( ph0 <= ph1 ) {
-
- p->offset = 0;
- mask = 1;
- }
- else {
-
- p->offset = 1;
- mask = 2;
- }
-
- /* Fill the line array and mark the phase.
- We should check here if moving down the head will leave
- any line empty, but we do not because we *know* that it
- won't - the BAND_1440 is selected by finding a value
- which guarantees that it will cover every line. */
-
- ScheduleBand( p, mask );
- p->down = BAND_1440;
- p->top += BAND_1440;
- }
+ if ( p->resol == BAND_720 ) {
+
+ /* 720 DPI printing. See which lines should we print and
+ fill the head array accordingly, then move down a band. */
+
+ ScheduleBand( p, 1 );
+ p->down = BAND_720;
+ p->top += BAND_720;
+ }
+ else {
+
+ /* 1440 dpi printing. This is a bit more complex than the
+ 720 dpi one. First, see how many lines in each phase
+ has already been printed. */
+
+ ph0 = ph1 = 0;
+
+ for ( line = p->top, i=0 ; i < NOZZLES ; i++, line += HEAD_SPACING ) {
+
+ line = p->top + i * HEAD_SPACING;
+ ph0 += p->mark[ line % MAX_MARK ] & 1;
+ ph1 += p->mark[ line % MAX_MARK ] & 2;
+ }
+
+ ph1 >>= 1;
+
+ /* Choose the phase which has less lines in it. */
+
+ if ( ph0 <= ph1 ) {
+
+ p->offset = 0;
+ mask = 1;
+ }
+ else {
+
+ p->offset = 1;
+ mask = 2;
+ }
+
+ /* Fill the line array and mark the phase.
+ We should check here if moving down the head will leave
+ any line empty, but we do not because we *know* that it
+ won't - the BAND_1440 is selected by finding a value
+ which guarantees that it will cover every line. */
+
+ ScheduleBand( p, mask );
+ p->down = BAND_1440;
+ p->top += BAND_1440;
+ }
}
/*
@@ -2294,37 +2281,37 @@ static void ScheduleTrailing( SCHEDUL *p )
{
int mask;
- if ( p->down > 1 ) {
-
- /* This is the first time we came here. */
-
- p->offset = 1;
- }
-
- if ( p->resol == BAND_720 ) {
-
- p->offset = 0;
- p->down = 1;
- mask = 1;
- }
- else {
-
- if ( p->offset ) {
-
- p->offset = 0;
- p->down = 0;
- mask = 1;
- }
- else {
-
- p->offset = 1;
- p->down = 1;
- mask = 2;
- }
- }
-
- ScheduleBand( p, mask );
- p->top += p->down;
+ if ( p->down > 1 ) {
+
+ /* This is the first time we came here. */
+
+ p->offset = 1;
+ }
+
+ if ( p->resol == BAND_720 ) {
+
+ p->offset = 0;
+ p->down = 1;
+ mask = 1;
+ }
+ else {
+
+ if ( p->offset ) {
+
+ p->offset = 0;
+ p->down = 0;
+ mask = 1;
+ }
+ else {
+
+ p->offset = 1;
+ p->down = 1;
+ mask = 2;
+ }
+ }
+
+ ScheduleBand( p, mask );
+ p->top += p->down;
}
/*
@@ -2337,19 +2324,18 @@ static void ScheduleBand( SCHEDUL *p, int mask )
int i;
int line;
- for ( line = p->top, i = 0 ; i < NOZZLES ; i++, line += HEAD_SPACING ) {
-
-
- if ( p->mark[ line % MAX_MARK ] & mask ) {
-
- p->head[ i ] = -1;
- }
- else {
-
- p->head[ i ] = line;
- p->mark[ line % MAX_MARK ] |= mask;
- }
- }
+ for ( line = p->top, i = 0 ; i < NOZZLES ; i++, line += HEAD_SPACING ) {
+
+ if ( p->mark[ line % MAX_MARK ] & mask ) {
+
+ p->head[ i ] = -1;
+ }
+ else {
+
+ p->head[ i ] = line;
+ p->mark[ line % MAX_MARK ] |= mask;
+ }
+ }
}
/****************************************************************************/
@@ -2366,45 +2352,45 @@ int line;
*/
static void PackLine( byte *input, int pixnum, int lev_on, int step,
- RAWLINE *line )
+ RAWLINE *line )
{
byte bits;
char *result;
int i, j, k;
- result = line->data;
- line->first = MAX_PIXELS;
- line->last = 0;
-
- for ( j = 0x80, bits = k = i = 0 ; i < pixnum ; i += step, input += step ){
-
- if ( *input == lev_on ) bits |= j;
-
- if ( ! ( j >>= 1 ) ) {
-
- if ( bits ) {
-
- if ( line->first > k ) line->first = k;
- if ( line->last < k ) line->last = k;
- }
-
- *result++ = bits;
- j = 0x80;
- bits = 0;
- k++;
- }
- }
-
- if ( j != 0x80 ) {
-
- *result = bits;
-
- if ( bits ) {
-
- if ( line->first > k ) line->first = k;
- if ( line->last < k ) line->last = k;
- }
- }
+ result = line->data;
+ line->first = MAX_PIXELS;
+ line->last = 0;
+
+ for ( j = 0x80, bits = k = i = 0 ; i < pixnum ; i += step, input += step ){
+
+ if ( *input == lev_on ) bits |= j;
+
+ if ( ! ( j >>= 1 ) ) {
+
+ if ( bits ) {
+
+ if ( line->first > k ) line->first = k;
+ if ( line->last < k ) line->last = k;
+ }
+
+ *result++ = bits;
+ j = 0x80;
+ bits = 0;
+ k++;
+ }
+ }
+
+ if ( j != 0x80 ) {
+
+ *result = bits;
+
+ if ( bits ) {
+
+ if ( line->first > k ) line->first = k;
+ if ( line->last < k ) line->last = k;
+ }
+ }
}
/*
@@ -2413,7 +2399,7 @@ int i, j, k;
*
* Returns the length of the RLE data.
*/
-
+
static int RleCompress( RAWLINE *raw, int min, int max, byte *rle_data )
{
int i, n;
@@ -2423,101 +2409,101 @@ int length;
byte *input;
int len;
- if ( ! raw ) {
-
- /* This is an empty line */
-
- for ( n = 0, i = max - min ; i >= 129 ; i -= 129 ) {
-
- *rle_data++ = 128;
- *rle_data++ = 0;
- n += 2;
- }
-
- if ( i >= 2 ) {
-
- *rle_data++ = 257 - i;
- *rle_data++ = 0;
- n += 2;
- }
- else if ( i ) {
-
- *rle_data++ = 0;
- *rle_data++ = 0;
- n+= 2;
- }
-
- return( n );
- }
-
- /* There's data, set up encoding parameters */
-
- input = raw->data + min;
- len = max - min;
-
- /* Create a run-length encoded version. We do it even if no pixel
- was set because it may be that this line is just part of a
- multi-line band. */
-
- length = 0;
- start = input;
- rstrt = NULL;
- pbyte = *input++;
-
- for ( i = 1 ; i < len ; i++, input++ ) {
-
- if ( *input == pbyte ) {
-
- /* This byte is identical to the previous one(s). */
-
- if ( ! rstrt ) {
-
- /* This is the start of a new repeating sequence */
-
- rstrt = input - 1;
- }
- }
- else {
-
- /* Different byte than the previous one(s) */
-
- if ( rstrt ) {
-
- /* There was a repetitive sequence. */
-
- if ( rstrt - input < 4 ) {
-
- /* For less than four bytes it isn't worth
- to do RLE, we discard them */
-
- rstrt = NULL;
- }
- else {
-
- /* We must flush */
-
- n = RleFlush( start, rstrt, input, rle_data );
- rle_data += n;
- length += n;
-
- /* Initialise again */
-
- start = rle_data;
- rstrt = NULL;
- }
- }
-
- pbyte = *rle_data;
- }
- }
-
- /* We flush whatever is left over */
-
- length += RleFlush( start, rstrt, input, rle_data );
-
- return( length );
+ if ( ! raw ) {
+
+ /* This is an empty line */
+
+ for ( n = 0, i = max - min ; i >= 129 ; i -= 129 ) {
+
+ *rle_data++ = 128;
+ *rle_data++ = 0;
+ n += 2;
+ }
+
+ if ( i >= 2 ) {
+
+ *rle_data++ = 257 - i;
+ *rle_data++ = 0;
+ n += 2;
+ }
+ else if ( i ) {
+
+ *rle_data++ = 0;
+ *rle_data++ = 0;
+ n+= 2;
+ }
+
+ return( n );
+ }
+
+ /* There's data, set up encoding parameters */
+
+ input = raw->data + min;
+ len = max - min;
+
+ /* Create a run-length encoded version. We do it even if no pixel
+ was set because it may be that this line is just part of a
+ multi-line band. */
+
+ length = 0;
+ start = input;
+ rstrt = NULL;
+ pbyte = *input++;
+
+ for ( i = 1 ; i < len ; i++, input++ ) {
+
+ if ( *input == pbyte ) {
+
+ /* This byte is identical to the previous one(s). */
+
+ if ( ! rstrt ) {
+
+ /* This is the start of a new repeating sequence */
+
+ rstrt = input - 1;
+ }
+ }
+ else {
+
+ /* Different byte than the previous one(s) */
+
+ if ( rstrt ) {
+
+ /* There was a repetitive sequence. */
+
+ if ( rstrt - input < 4 ) {
+
+ /* For less than four bytes it isn't worth
+ to do RLE, we discard them */
+
+ rstrt = NULL;
+ }
+ else {
+
+ /* We must flush */
+
+ n = RleFlush( start, rstrt, input, rle_data );
+ rle_data += n;
+ length += n;
+
+ /* Initialise again */
+
+ start = rle_data;
+ rstrt = NULL;
+ }
+ }
+
+ pbyte = *rle_data;
+ }
+ }
+
+ /* We flush whatever is left over */
+
+ length += RleFlush( start, rstrt, input, rle_data );
+
+ return( length );
}
-
+
/*
* This function flushes the RLE encoding buffer
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2537,85 +2523,85 @@ int len;
* but it isn't. This can cause some penalty, however, we will live
* with that for now.
*/
-
+
static int RleFlush( byte *first, byte *reps, byte *now, byte *out )
{
int count;
int l;
- if ( ! first ) return( 0 );
-
- if ( ! reps ) reps = now;
-
- count = 0;
-
- /* Write the nonrepetitve pattern first */
-
- while ( ( l = reps - first ) ) {
-
- if ( l > 128 ) {
-
- /* More than 128 consecutive bytes, write out a 128 byte chunk */
-
- *out++ = 127;
- memcpy( out, first, 128 );
- out += 128;
- first += 128;
- count += 129;
- }
- else {
-
- /* There are not more than 128 bytes, write them into a
- single chunk */
-
- *out++ = l - 1;
- memcpy( out, first, l );
- count += l + 1;
- first += l;
- out += l;
- }
- }
-
- /* Now write the repeated pattern */
-
- while ( ( l = now - reps ) ) {
-
- if ( l > 128 ) {
-
- /* More than 128 bytes are identical, write out a
- 129 byte chunk */
-
- *out++ = 128;
- *out++ = *reps;
- count += 2;
- reps += 129;
- }
- else {
-
- if ( l == 1 ) {
-
- /* There is only one byte left, write it out as a
- nonrepetitive chunk */
-
- *out++ = 0;
- *out++ = *reps;
- count += 2;
- reps++;
- }
- else {
-
- /* What remains is at least 2 bytes but not larger than what
- can be written in a single chunk */
-
- *out++ = 257 - l;
- *out++ = *reps;
- count += 2;
- reps = now;
- }
- }
- }
-
- return( count );
+ if ( ! first ) return( 0 );
+
+ if ( ! reps ) reps = now;
+
+ count = 0;
+
+ /* Write the nonrepetitve pattern first */
+
+ while ( ( l = reps - first ) ) {
+
+ if ( l > 128 ) {
+
+ /* More than 128 consecutive bytes, write out a 128 byte chunk */
+
+ *out++ = 127;
+ memcpy( out, first, 128 );
+ out += 128;
+ first += 128;
+ count += 129;
+ }
+ else {
+
+ /* There are not more than 128 bytes, write them into a
+ single chunk */
+
+ *out++ = l - 1;
+ memcpy( out, first, l );
+ count += l + 1;
+ first += l;
+ out += l;
+ }
+ }
+
+ /* Now write the repeated pattern */
+
+ while ( ( l = now - reps ) ) {
+
+ if ( l > 128 ) {
+
+ /* More than 128 bytes are identical, write out a
+ 129 byte chunk */
+
+ *out++ = 128;
+ *out++ = *reps;
+ count += 2;
+ reps += 129;
+ }
+ else {
+
+ if ( l == 1 ) {
+
+ /* There is only one byte left, write it out as a
+ nonrepetitive chunk */
+
+ *out++ = 0;
+ *out++ = *reps;
+ count += 2;
+ reps++;
+ }
+ else {
+
+ /* What remains is at least 2 bytes but not larger than what
+ can be written in a single chunk */
+
+ *out++ = 257 - l;
+ *out++ = *reps;
+ count += 2;
+ reps = now;
+ }
+ }
+ }
+
+ return( count );
}
/****************************************************************************/
@@ -2624,112 +2610,112 @@ int l;
static void SendReset( FILE *stream )
{
- SendString( stream, ESC "@" );
+ SendString( stream, ESC "@" );
}
static void SendMargin( FILE *stream, int top, int bot )
{
- SendString( stream, ESC "(c" );
- SendWord( stream, 4 );
- SendWord( stream, bot );
- SendWord( stream, top );
+ SendString( stream, ESC "(c" );
+ SendWord( stream, 4 );
+ SendWord( stream, bot );
+ SendWord( stream, top );
}
static void SendPaper( FILE *stream, int length )
{
- SendString( stream, ESC "(C" );
- SendWord( stream, 2 );
- SendWord( stream, length );
+ SendString( stream, ESC "(C" );
+ SendWord( stream, 2 );
+ SendWord( stream, length );
}
static void SendGmode( FILE *stream, int on )
{
- SendString( stream, ESC "(G" );
- SendWord( stream, 1 );
- SendByte( stream, on );
+ SendString( stream, ESC "(G" );
+ SendWord( stream, 1 );
+ SendByte( stream, on );
}
static void SendUnit( FILE *stream, int res )
{
- SendString( stream, ESC "(U" );
- SendWord( stream, 1 );
- SendByte( stream, res );
+ SendString( stream, ESC "(U" );
+ SendWord( stream, 1 );
+ SendByte( stream, res );
}
static void SendUnidir( FILE *stream, int on )
{
- SendString( stream, ESC "U" );
- SendByte( stream, on );
+ SendString( stream, ESC "U" );
+ SendByte( stream, on );
}
static void SendMicro( FILE *stream, int on )
{
- SendString( stream, ESC "(i" );
- SendWord( stream, 1 );
- SendByte( stream, on );
+ SendString( stream, ESC "(i" );
+ SendWord( stream, 1 );
+ SendByte( stream, on );
}
static void SendInk( FILE *stream, int x )
{
- SendString( stream, ESC "(e" );
- SendWord( stream, 2 );
- SendByte( stream, 0 );
- SendByte( stream, x );
+ SendString( stream, ESC "(e" );
+ SendWord( stream, 2 );
+ SendByte( stream, 0 );
+ SendByte( stream, x );
}
static void SendDown( FILE *stream, int x )
{
- SendString( stream, ESC "(v" );
- SendWord( stream, 2 );
- SendWord( stream, x );
+ SendString( stream, ESC "(v" );
+ SendWord( stream, 2 );
+ SendWord( stream, x );
}
static void SendRight( FILE *stream, int amount )
{
- SendString( stream, ESC "(\\" );
- SendWord( stream, 4 );
- SendWord( stream, 1440 );
- SendWord( stream, amount );
+ SendString( stream, ESC "(\\" );
+ SendWord( stream, 4 );
+ SendWord( stream, 1440 );
+ SendWord( stream, amount );
}
static void SendColour( FILE *stream, int col )
{
static int ccode[] = { 0x000, 0x200, 0x100, 0x400, 0x201, 0x101 };
- SendString( stream, ESC "(r" );
- SendWord( stream, 2 );
- SendWord( stream, ccode[ col ] );
+ SendString( stream, ESC "(r" );
+ SendWord( stream, 2 );
+ SendWord( stream, ccode[ col ] );
}
-static void SendData( FILE *stream, int hres, int vres, int noz, int col )
+static void SendData( FILE *stream, int hres, int vres, int noz, int col )
{
- SendString( stream, ESC "." );
- SendByte( stream, 1 ); /* Run-length encoded data */
-
- /* If we use 1 nozzle, then vertical resolution is what it is.
- Otherwise it must be set to 90 dpi */
-
- if ( noz == 1 )
-
- SendByte( stream, RESCODE( vres ) );
- else
- SendByte( stream, RESCODE( 90 ) );
-
- /* The horizontal resolution is max. 720 dpi */
-
- if ( hres > 720 )
-
- SendByte( stream, RESCODE( 720 ) );
- else
- SendByte( stream, RESCODE( hres ) );
-
- SendByte( stream, noz );
- SendWord( stream, col );
+ SendString( stream, ESC "." );
+ SendByte( stream, 1 ); /* Run-length encoded data */
+
+ /* If we use 1 nozzle, then vertical resolution is what it is.
+ Otherwise it must be set to 90 dpi */
+
+ if ( noz == 1 )
+
+ SendByte( stream, RESCODE( vres ) );
+ else
+ SendByte( stream, RESCODE( 90 ) );
+
+ /* The horizontal resolution is max. 720 dpi */
+
+ if ( hres > 720 )
+
+ SendByte( stream, RESCODE( 720 ) );
+ else
+ SendByte( stream, RESCODE( hres ) );
+
+ SendByte( stream, noz );
+ SendWord( stream, col );
}
-
+
static void SendString( FILE *stream, const char *s )
{
- while ( *s ) SendByte( stream, *s++ );
+ while ( *s ) SendByte( stream, *s++ );
}
/****************************************************************************/
@@ -2743,7 +2729,7 @@ static void SendString( FILE *stream, const char *s )
static void HalftonerStart( RENDER *render, int line )
{
- (*(htable[ render->dev->halftoner ].hstrt))( render, line );
+ (*(htable[ render->dev->halftoner ].hstrt))( render, line );
}
/*
@@ -2753,7 +2739,7 @@ static void HalftonerStart( RENDER *render, int line )
static int HalftoneThold( RENDER *render )
{
- return( (*(htable[ render->dev->halftoner ].hthld))( render ) );
+ return( (*(htable[ render->dev->halftoner ].hthld))( render ) );
}
/*
@@ -2762,7 +2748,7 @@ static int HalftoneThold( RENDER *render )
*
* This function has one fundamental assumption: halftoning of separate
* colours is independent of each other.
-*
+*
* It calls the mono halftoner with the K, C, M, Y components.
*/
@@ -2775,173 +2761,173 @@ HTONE hdata;
short *errs[ MAX_ED_LINES ];
int i;
- /* Get the rendering function */
-
- dev = render->dev;
- htone = htable[ render->dev->halftoner ].htone;
- offs = render->mono ? 0 : OFFS_K;
-
- if ( dev->mono ) {
-
- /* Monochrome, do only the black */
-
- for ( i = 0 ; i < MAX_ED_LINES ; i++ )
-
- errs[ i ] = render->error[ i ][ OFFS_K ];
-
- hdata.render = render;
- hdata.data = data + OFFS_K;
- hdata.step = sizeof( byte );
- hdata.res = render->res[ OFFS_K ];
- hdata.block = NULL;
- hdata.err = errs;
- hdata.mval = 255;
-
- (*htone)( &hdata, line );
- }
- else {
-
- /* Colour. D black first */
-
- for ( i = 0 ; i < MAX_ED_LINES ; i++ )
-
- errs[ i ] = render->error[ i ][ OFFS_K ];
-
- hdata.render = render;
- hdata.step = sizeof( long );
- hdata.data = data + OFFS_K;
- hdata.res = render->res[ OFFS_K ];
- hdata.block = NULL;
- hdata.err = errs;
- hdata.mval = 255;
-
- (*htone)( &hdata, line );
-
- /* Yellow has no intermediate ink. The already done black
- may inhibit it. */
-
- for ( i = 0 ; i < MAX_ED_LINES ; i++ )
-
- errs[ i ] = render->error[ i ][ OFFS_Y ];
-
- hdata.render = render;
- hdata.step = sizeof( long );
- hdata.data = data + OFFS_Y;
- hdata.res = render->res[ OFFS_Y ];
- hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
- hdata.err = errs;
- hdata.mval = 255;
-
- (*htone)( &hdata, line );
-
- /* Cyan and magenta has intermediate colour ink, black may inhibit */
-
- for ( i = 0 ; i < MAX_ED_LINES ; i++ )
-
- errs[ i ] = render->error[ i ][ OFFS_C ];
-
- hdata.data = data + OFFS_C;
- hdata.res = render->res[ OFFS_C ];
- hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
- hdata.mval = dev->midcyan;
-
- (*htone)( &hdata, line );
-
- for ( i = 0 ; i < MAX_ED_LINES ; i++ )
-
- errs[ i ] = render->error[ i ][ OFFS_M ];
-
- hdata.data = data + OFFS_M;
- hdata.res = render->res[ OFFS_M ];
- hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
- hdata.mval = dev->midmagenta;
-
- (*htone)( &hdata, line );
- }
-
- /* Here we have create the raw device format scanlines */
-
- if ( dev->mono ) {
-
- if ( render->xres == 1440 ) {
-
- PackLine( render->res[ OFFS_K ], render->width, 255, 2,
- render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_K ]+1, render->width-1, 255, 2,
- render->raw[ 1 ][ DEV_BLACK ]+ line % MAX_MARK );
- }
- else {
-
- PackLine( render->res[ OFFS_K ], render->width, 255, 1,
- render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
- }
- }
- else {
-
- if ( render->xres == 1440 ) {
-
- PackLine( render->res[ OFFS_K ], render->width, 255, 2,
- render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_K ]+1, render->width-1, 255, 2,
- render->raw[ 1 ][ DEV_BLACK ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ], render->width, 255, 2,
- render->raw[ 0 ][ DEV_CYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ]+1, render->width-1, 255, 2,
- render->raw[ 1 ][ DEV_CYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_M ], render->width, 255, 2,
- render->raw[ 0 ][ DEV_MAGENTA ]+ line % MAX_MARK);
-
- PackLine( render->res[ OFFS_M ]+1, render->width-1, 255, 2,
- render->raw[ 1 ][ DEV_MAGENTA ]+ line % MAX_MARK);
-
- PackLine( render->res[ OFFS_Y ], render->width, 255, 2,
- render->raw[ 0 ][ DEV_YELLOW ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_Y ]+1, render->width-1, 255, 2,
- render->raw[ 1 ][ DEV_YELLOW ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ], render->width, dev->midcyan,
- 2, render->raw[ 0 ][ DEV_LCYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ]+1, render->width-1, dev->midcyan,
- 2, render->raw[ 1 ][ DEV_LCYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_M ], render->width, dev->midmagenta,
- 2, render->raw[0][ DEV_LMAGENTA ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_M ]+1, render->width-1,dev->midmagenta,
- 2, render->raw[1][ DEV_LMAGENTA ]+ line % MAX_MARK );
- }
- else {
-
- PackLine( render->res[ OFFS_K ], render->width, 255, 1,
- render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ], render->width, 255, 1,
- render->raw[ 0 ][ DEV_CYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_M ], render->width, 255, 1,
- render->raw[ 0 ][ DEV_MAGENTA ]+ line % MAX_MARK);
-
- PackLine( render->res[ OFFS_Y ], render->width, 255, 1,
- render->raw[ 0 ][ DEV_YELLOW ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_C ], render->width, dev->midcyan,
- 1, render->raw[ 0 ][ DEV_LCYAN ]+ line % MAX_MARK );
-
- PackLine( render->res[ OFFS_M ], render->width, dev->midmagenta,
- 1, render->raw[0][ DEV_LMAGENTA ]+ line % MAX_MARK );
- }
- }
-
- /* Call the halftoner specific end-of-line function */
-
- (*htable[ render->dev->halftoner ].hteol)( render, line );
+ /* Get the rendering function */
+
+ dev = render->dev;
+ htone = htable[ render->dev->halftoner ].htone;
+ offs = render->mono ? 0 : OFFS_K;
+
+ if ( dev->mono ) {
+
+ /* Monochrome, do only the black */
+
+ for ( i = 0 ; i < MAX_ED_LINES ; i++ )
+
+ errs[ i ] = render->error[ i ][ OFFS_K ];
+
+ hdata.render = render;
+ hdata.data = data + OFFS_K;
+ hdata.step = sizeof( byte );
+ hdata.res = render->res[ OFFS_K ];
+ hdata.block = NULL;
+ hdata.err = errs;
+ hdata.mval = 255;
+
+ (*htone)( &hdata, line );
+ }
+ else {
+
+ /* Colour. D black first */
+
+ for ( i = 0 ; i < MAX_ED_LINES ; i++ )
+
+ errs[ i ] = render->error[ i ][ OFFS_K ];
+
+ hdata.render = render;
+ hdata.step = sizeof( long );
+ hdata.data = data + OFFS_K;
+ hdata.res = render->res[ OFFS_K ];
+ hdata.block = NULL;
+ hdata.err = errs;
+ hdata.mval = 255;
+
+ (*htone)( &hdata, line );
+
+ /* Yellow has no intermediate ink. The already done black
+ may inhibit it. */
+
+ for ( i = 0 ; i < MAX_ED_LINES ; i++ )
+
+ errs[ i ] = render->error[ i ][ OFFS_Y ];
+
+ hdata.render = render;
+ hdata.step = sizeof( long );
+ hdata.data = data + OFFS_Y;
+ hdata.res = render->res[ OFFS_Y ];
+ hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
+ hdata.err = errs;
+ hdata.mval = 255;
+
+ (*htone)( &hdata, line );
+
+ /* Cyan and magenta has intermediate colour ink, black may inhibit */
+
+ for ( i = 0 ; i < MAX_ED_LINES ; i++ )
+
+ errs[ i ] = render->error[ i ][ OFFS_C ];
+
+ hdata.data = data + OFFS_C;
+ hdata.res = render->res[ OFFS_C ];
+ hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
+ hdata.mval = dev->midcyan;
+
+ (*htone)( &hdata, line );
+
+ for ( i = 0 ; i < MAX_ED_LINES ; i++ )
+
+ errs[ i ] = render->error[ i ][ OFFS_M ];
+
+ hdata.data = data + OFFS_M;
+ hdata.res = render->res[ OFFS_M ];
+ hdata.block = dev->pureblack ? render->res[ OFFS_K ] : NULL;
+ hdata.mval = dev->midmagenta;
+
+ (*htone)( &hdata, line );
+ }
+
+ /* Here we have create the raw device format scanlines */
+
+ if ( dev->mono ) {
+
+ if ( render->xres == 1440 ) {
+
+ PackLine( render->res[ OFFS_K ], render->width, 255, 2,
+ render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_K ]+1, render->width-1, 255, 2,
+ render->raw[ 1 ][ DEV_BLACK ]+ line % MAX_MARK );
+ }
+ else {
+
+ PackLine( render->res[ OFFS_K ], render->width, 255, 1,
+ render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
+ }
+ }
+ else {
+
+ if ( render->xres == 1440 ) {
+
+ PackLine( render->res[ OFFS_K ], render->width, 255, 2,
+ render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_K ]+1, render->width-1, 255, 2,
+ render->raw[ 1 ][ DEV_BLACK ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ], render->width, 255, 2,
+ render->raw[ 0 ][ DEV_CYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ]+1, render->width-1, 255, 2,
+ render->raw[ 1 ][ DEV_CYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_M ], render->width, 255, 2,
+ render->raw[ 0 ][ DEV_MAGENTA ]+ line % MAX_MARK);
+
+ PackLine( render->res[ OFFS_M ]+1, render->width-1, 255, 2,
+ render->raw[ 1 ][ DEV_MAGENTA ]+ line % MAX_MARK);
+
+ PackLine( render->res[ OFFS_Y ], render->width, 255, 2,
+ render->raw[ 0 ][ DEV_YELLOW ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_Y ]+1, render->width-1, 255, 2,
+ render->raw[ 1 ][ DEV_YELLOW ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ], render->width, dev->midcyan,
+ 2, render->raw[ 0 ][ DEV_LCYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ]+1, render->width-1, dev->midcyan,
+ 2, render->raw[ 1 ][ DEV_LCYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_M ], render->width, dev->midmagenta,
+ 2, render->raw[0][ DEV_LMAGENTA ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_M ]+1, render->width-1,dev->midmagenta,
+ 2, render->raw[1][ DEV_LMAGENTA ]+ line % MAX_MARK );
+ }
+ else {
+
+ PackLine( render->res[ OFFS_K ], render->width, 255, 1,
+ render->raw[ 0 ][ DEV_BLACK ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ], render->width, 255, 1,
+ render->raw[ 0 ][ DEV_CYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_M ], render->width, 255, 1,
+ render->raw[ 0 ][ DEV_MAGENTA ]+ line % MAX_MARK);
+
+ PackLine( render->res[ OFFS_Y ], render->width, 255, 1,
+ render->raw[ 0 ][ DEV_YELLOW ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_C ], render->width, dev->midcyan,
+ 1, render->raw[ 0 ][ DEV_LCYAN ]+ line % MAX_MARK );
+
+ PackLine( render->res[ OFFS_M ], render->width, dev->midmagenta,
+ 1, render->raw[0][ DEV_LMAGENTA ]+ line % MAX_MARK );
+ }
+ }
+
+ /* Call the halftoner specific end-of-line function */
+
+ (*htable[ render->dev->halftoner ].hteol)( render, line );
}
/****************************************************************************/
@@ -2955,7 +2941,7 @@ int i;
static int FloydSThold( RENDER *p )
{
- return( 5 );
+ return( 5 );
}
/*
@@ -2965,8 +2951,8 @@ static int FloydSThold( RENDER *p )
static void FloydSStart( RENDER *p, int line )
{
- memset( p->err, 0, ICOLN * MAX_PIXELS*2 );
- p->error[ 0 ] = p->err[ 0 ];
+ memset( p->err, 0, ICOLN * MAX_PIXELS*2 );
+ p->error[ 0 ] = p->err[ 0 ];
}
/*
@@ -2976,7 +2962,7 @@ static void FloydSStart( RENDER *p, int line )
static void FloydSEol( RENDER *p, int line )
{
- /* Since we use single error buffering, nothing to do */
+ /* Since we use single error buffering, nothing to do */
}
/*
@@ -2988,7 +2974,7 @@ static void FloydSEol( RENDER *p, int line )
* * 7/16 r
* 3/16 5/16 1/16
*
-* r is the residual (0, in theory).
+* r is the residual (0, in theory).
* Absolutely nothing fancy is done here.
*
*/
@@ -3006,66 +2992,66 @@ int lim1, lim2; /* Limits */
short e0, e1; /* Propagating errors in current line */
short *l0; /* Error buffer pointer */
- length = htone->render->width;
-
- res = htone->res;
- data = htone->data;
- block = htone->block;
-
- lim1 = htone->mval / 2;
- lim2 = ( htone->mval + 256 ) / 2;
-
- l0 = htone->err[ 0 ];
-
- e0 = l0[ 1 ];
- e1 = l0[ 2 ];
-
- l0[ 1 ] = 0;
- l0[ 2 ] = 0;
-
- for ( x = 0 ; x < length ; x++ ) {
-
- /* First, clear the res byte. It is needed for the black */
-
- *res = 0;
-
- /* Add the actual error to the pixel, normalise, init, whatever. */
-
- pixel = ( ( *data << 4 ) + e0 );
- e0 = e1;
- e1 = l0[ 3 ] + ( pixel & 15 ); /* This is the residual */
-
- l0[ 3 ] = 0;
- pixel >>= 4;
-
- if ( ( block && *block ) || ( pixel < lim1 ) )
-
- *res = 0;
-
- else if ( pixel >= lim2 )
-
- *res = 255;
- else
- *res = htone->mval;
-
- /* Calculate the err */
-
- pixerr = pixel - *res;
-
- /* Diffuse the err */
-
- e0 += ( pixerr << 3 ) - pixerr; /* 7/16 */
- l0[ 0 ] += ( pixerr << 2 ) - pixerr; /* 3/16 */
- l0[ 1 ] += ( pixerr << 2 ) + pixerr; /* 5/16 */
- l0[ 2 ] += pixerr; /* 1/16 */
-
- /* We have done everything, move the pointers */
-
- res++;
- if ( block ) block++;
- data += htone->step;
- l0++;
- }
+ length = htone->render->width;
+
+ res = htone->res;
+ data = htone->data;
+ block = htone->block;
+
+ lim1 = htone->mval / 2;
+ lim2 = ( htone->mval + 256 ) / 2;
+
+ l0 = htone->err[ 0 ];
+
+ e0 = l0[ 1 ];
+ e1 = l0[ 2 ];
+
+ l0[ 1 ] = 0;
+ l0[ 2 ] = 0;
+
+ for ( x = 0 ; x < length ; x++ ) {
+
+ /* First, clear the res byte. It is needed for the black */
+
+ *res = 0;
+
+ /* Add the actual error to the pixel, normalise, init, whatever. */
+
+ pixel = ( ( *data << 4 ) + e0 );
+ e0 = e1;
+ e1 = l0[ 3 ] + ( pixel & 15 ); /* This is the residual */
+
+ l0[ 3 ] = 0;
+ pixel >>= 4;
+
+ if ( ( block && *block ) || ( pixel < lim1 ) )
+
+ *res = 0;
+
+ else if ( pixel >= lim2 )
+
+ *res = 255;
+ else
+ *res = htone->mval;
+
+ /* Calculate the err */
+
+ pixerr = pixel - *res;
+
+ /* Diffuse the err */
+
+ e0 += ( pixerr << 3 ) - pixerr; /* 7/16 */
+ l0[ 0 ] += ( pixerr << 2 ) - pixerr; /* 3/16 */
+ l0[ 1 ] += ( pixerr << 2 ) + pixerr; /* 5/16 */
+ l0[ 2 ] += pixerr; /* 1/16 */
+
+ /* We have done everything, move the pointers */
+
+ res++;
+ if ( block ) block++;
+ data += htone->step;
+ l0++;
+ }
}
/****************************************************************************/
@@ -3079,7 +3065,7 @@ short *l0; /* Error buffer pointer */
static int DitherThold( RENDER *p )
{
- return( 0 );
+ return( 0 );
}
/*
@@ -3089,7 +3075,7 @@ static int DitherThold( RENDER *p )
static void DitherStart( RENDER *p, int line )
{
- /* Nothing to initialise */
+ /* Nothing to initialise */
}
/*
@@ -3099,7 +3085,7 @@ static void DitherStart( RENDER *p, int line )
static void DitherEol( RENDER *p, int line )
{
- /* Nothing to do - dithering has no memory */
+ /* Nothing to do - dithering has no memory */
}
/*
@@ -3119,66 +3105,66 @@ byte *matrix; /* Dither matrix's current line */
int mx; /* Matrix index */
int lval, hval; /* Halftoned high/low values */
- length = htone->render->width;
-
- res = htone->res;
- data = htone->data;
- block = htone->block;
-
- matrix = dmatrix[ y % DMATRIX_Y ];
-
- for ( mx = x = 0 ; x < length ; x++ ) {
-
- /* First, clear the res byte. It is needed for the black */
-
- *res = 0;
-
- /* Next, see if the pixel is above the mval */
-
- if ( ( pixel = *data ) > htone->mval ) {
-
- lval = htone->mval;
- hval = 255;
-
- if ( htone->mval == 127 )
-
- pixel = ( ( pixel - htone->mval ) * 2 - 1 ) / 2;
- else
- pixel = ( pixel - htone->mval ) * 255 / ( 255 - htone->mval );
- }
- else {
-
- lval = 0;
- hval = htone->mval;
-
- if ( htone->mval != 255 ) {
-
- if ( htone->mval == 127 )
-
- pixel = ( pixel * 4 + 1 ) / 2;
- else
- pixel = pixel * 255 / htone->mval;
- }
- }
-
- if ( block && *block ) {
-
- *res = 0;
- }
- else {
-
- if ( pixel >= matrix[ mx ] )
-
- *res = hval;
- else
- *res = lval;
- }
-
- res++;
- if ( ++mx == DMATRIX_X ) mx = 0;
- if ( block ) block++;
- data += htone->step;
- }
+ length = htone->render->width;
+
+ res = htone->res;
+ data = htone->data;
+ block = htone->block;
+
+ matrix = dmatrix[ y % DMATRIX_Y ];
+
+ for ( mx = x = 0 ; x < length ; x++ ) {
+
+ /* First, clear the res byte. It is needed for the black */
+
+ *res = 0;
+
+ /* Next, see if the pixel is above the mval */
+
+ if ( ( pixel = *data ) > htone->mval ) {
+
+ lval = htone->mval;
+ hval = 255;
+
+ if ( htone->mval == 127 )
+
+ pixel = ( ( pixel - htone->mval ) * 2 - 1 ) / 2;
+ else
+ pixel = ( pixel - htone->mval ) * 255 / ( 255 - htone->mval );
+ }
+ else {
+
+ lval = 0;
+ hval = htone->mval;
+
+ if ( htone->mval != 255 ) {
+
+ if ( htone->mval == 127 )
+
+ pixel = ( pixel * 4 + 1 ) / 2;
+ else
+ pixel = pixel * 255 / htone->mval;
+ }
+ }
+
+ if ( block && *block ) {
+
+ *res = 0;
+ }
+ else {
+
+ if ( pixel >= matrix[ mx ] )
+
+ *res = hval;
+ else
+ *res = lval;
+ }
+
+ res++;
+ if ( ++mx == DMATRIX_X ) mx = 0;
+ if ( block ) block++;
+ data += htone->step;
+ }
}
/****************************************************************************/
@@ -3192,7 +3178,7 @@ int lval, hval; /* Halftoned high/low values */
static int BendorThold( RENDER *p )
{
- return( 5 );
+ return( 5 );
}
/*
@@ -3202,9 +3188,9 @@ static int BendorThold( RENDER *p )
static void BendorStart( RENDER *p, int line )
{
- memset( p->err, 0, 2 * ICOLN * MAX_PIXELS*2 );
- p->error[ 0 ] = p->err[ 0 ];
- p->error[ 1 ] = p->err[ 1 ];
+ memset( p->err, 0, 2 * ICOLN * MAX_PIXELS*2 );
+ p->error[ 0 ] = p->err[ 0 ];
+ p->error[ 1 ] = p->err[ 1 ];
}
/*
@@ -3216,9 +3202,9 @@ static void BendorEol( RENDER *p, int line )
{
void *x;
- x = p->error[ 0 ];
- p->error[ 0 ] = p->error[ 1 ];
- p->error[ 1 ] = x;
+ x = p->error[ 0 ];
+ p->error[ 0 ] = p->error[ 1 ];
+ p->error[ 1 ] = x;
}
/*
@@ -3227,7 +3213,7 @@ void *x;
*
* This is not yet finished (the matrix is bad, actually).
*
-* The matrix is the following (the normalisation factor is 1/128,
+* The matrix is the following (the normalisation factor is 1/128,
* '*' represents the current pixel, r is the truncation residual):
*
* * 20 10 r
@@ -3241,21 +3227,21 @@ void *x;
* * 3
* 2 3 2
*
-* and the normalisation factor can be set by the user.
-* The splash matrix is only applied if we have actually deposited
-* ink and the amount added to the errors is independent that of the
+* and the normalisation factor can be set by the user.
+* The splash matrix is only applied if we have actually deposited
+* ink and the amount added to the errors is independent that of the
* actual image value, it only depends on the ink applied.
* Of course, the ink spreads up and left as well and we could compensate
* for this for a certain extent by keeping track of the errors caused in
* previous pixels and lines and modifying them accordingly but it
* would lead to a horrible code mess and it wouldn't be worth the effort.
*
-* A further enhancement that we allow the error to 'leak'. Experimental
-* results show that with a 5-15% loss of error the image quality
+* A further enhancement that we allow the error to 'leak'. Experimental
+* results show that with a 5-15% loss of error the image quality
* increases and the colour distortion remains very low. If you think
* about it, this, in effect stops the error to spread its effect over
-* large areas but it will have almost undisturbed effect on neighbouring
-* areas (you allow for an exponential error decay).
+* large areas but it will have almost undisturbed effect on neighbouring
+* areas (you allow for an exponential error decay).
* This parameter is user definable, too.
*/
@@ -3276,113 +3262,113 @@ int lim1, lim2; /* Limits */
short e0, e1; /* Propagating errors in current line */
short *l0, *l1; /* Error buffer pointers */
- splash = htone->render->dev->splash;
- leakage = htone->render->dev->splash;
- length = htone->render->width;
-
- res = htone->res;
- data = htone->data;
- block = htone->block;
-
- lim1 = htone->mval / 2;
- lim2 = ( htone->mval + 256 ) / 2;
-
- l0 = htone->err[ 0 ];
- l1 = htone->err[ 1 ];
-
- e0 = l0[ 2 ];
- e1 = l0[ 3 ];
-
- l0[ 2 ] = 0;
- l0[ 3 ] = 0;
-
- for ( x = 0 ; x < length ; x++ ) {
-
- /* First, clear the res byte. It is needed for the black */
-
- *res = 0;
-
- /* Add the actual error to the pixel, normalise, init, whatever. */
-
- pixel = ( ( *data << 7 ) + e0 );
- e0 = e1;
- e1 = l0[ 4 ] + ( pixel & 127 ); /* This is the residual */
-
- l0[ 4 ] = 0;
- pixel >>= 7;
-
- if ( ( block && *block ) || ( pixel < lim1 ) )
-
- *res = 0;
-
- else if ( pixel >= lim2 )
-
- *res = 255;
- else
- *res = htone->mval;
-
- /* Calculate the err */
-
- pixerr = pixel - *res;
-
- /* If leakage is defined, apply it */
-
- if ( leakage ) pixerr -= ( pixerr * leakage ) / 100;
-
- /* Diffuse the err */
-
- pixerr <<= 1; /* Multiplier is 2 */
- pixe14 = pixerr; /* pixe14 now 2 */
- pixerr <<= 1; /* Multiplier is 4 */
- pixe14 += pixerr; /* pixe14 now 6 */
-
- l0[ 0 ] += pixerr;
- l0[ 4 ] += pixerr;
-
- pixerr <<= 1; /* Multiplier is 8 */
- pixe14 += pixerr; /* pixe14 now 14 */
-
- l0[ 1 ] += pixerr;
- l0[ 3 ] += pixerr;
- l1[ 0 ] += pixerr;
- l1[ 4 ] += pixerr;
-
- pixerr += pixerr >> 2; /* Multiplier is 10 */
-
- l0[ 2 ] += pixerr;
- e1 += pixerr;
-
- pixerr <<= 1; /* Multiplier is 20 */
-
- l1[ 2 ] += pixerr;
- e0 += pixerr;
-
- /* pixe14 already contains 14 * err */
-
- l1[ 1 ] += pixe14;
- l1[ 3 ] += pixe14;
-
- /* If splashing is defined, apply the splash matrix.
- The splash value is normalised to the same level as the err */
-
- if ( splash && *res ) {
-
- sval = splash * *res; /* This is the 2x value */
-
- l1[ 1 ] -= sval;
- l1[ 3 ] -= sval;
-
- sval += sval >> 1; /* This represents 3x */
-
- e0 -= sval;
- l1[ 2 ] -= sval;
- }
-
- /* We have done everything, move the pointers */
-
- res++;
- if ( block ) block++;
- data += htone->step;
- l0++, l1++;
- }
+ splash = htone->render->dev->splash;
+ leakage = htone->render->dev->splash;
+ length = htone->render->width;
+
+ res = htone->res;
+ data = htone->data;
+ block = htone->block;
+
+ lim1 = htone->mval / 2;
+ lim2 = ( htone->mval + 256 ) / 2;
+
+ l0 = htone->err[ 0 ];
+ l1 = htone->err[ 1 ];
+
+ e0 = l0[ 2 ];
+ e1 = l0[ 3 ];
+
+ l0[ 2 ] = 0;
+ l0[ 3 ] = 0;
+
+ for ( x = 0 ; x < length ; x++ ) {
+
+ /* First, clear the res byte. It is needed for the black */
+
+ *res = 0;
+
+ /* Add the actual error to the pixel, normalise, init, whatever. */
+
+ pixel = ( ( *data << 7 ) + e0 );
+ e0 = e1;
+ e1 = l0[ 4 ] + ( pixel & 127 ); /* This is the residual */
+
+ l0[ 4 ] = 0;
+ pixel >>= 7;
+
+ if ( ( block && *block ) || ( pixel < lim1 ) )
+
+ *res = 0;
+
+ else if ( pixel >= lim2 )
+
+ *res = 255;
+ else
+ *res = htone->mval;
+
+ /* Calculate the err */
+
+ pixerr = pixel - *res;
+
+ /* If leakage is defined, apply it */
+
+ if ( leakage ) pixerr -= ( pixerr * leakage ) / 100;
+
+ /* Diffuse the err */
+
+ pixerr <<= 1; /* Multiplier is 2 */
+ pixe14 = pixerr; /* pixe14 now 2 */
+ pixerr <<= 1; /* Multiplier is 4 */
+ pixe14 += pixerr; /* pixe14 now 6 */
+
+ l0[ 0 ] += pixerr;
+ l0[ 4 ] += pixerr;
+
+ pixerr <<= 1; /* Multiplier is 8 */
+ pixe14 += pixerr; /* pixe14 now 14 */
+
+ l0[ 1 ] += pixerr;
+ l0[ 3 ] += pixerr;
+ l1[ 0 ] += pixerr;
+ l1[ 4 ] += pixerr;
+
+ pixerr += pixerr >> 2; /* Multiplier is 10 */
+
+ l0[ 2 ] += pixerr;
+ e1 += pixerr;
+
+ pixerr <<= 1; /* Multiplier is 20 */
+
+ l1[ 2 ] += pixerr;
+ e0 += pixerr;
+
+ /* pixe14 already contains 14 * err */
+
+ l1[ 1 ] += pixe14;
+ l1[ 3 ] += pixe14;
+
+ /* If splashing is defined, apply the splash matrix.
+ The splash value is normalised to the same level as the err */
+
+ if ( splash && *res ) {
+
+ sval = splash * *res; /* This is the 2x value */
+
+ l1[ 1 ] -= sval;
+ l1[ 3 ] -= sval;
+
+ sval += sval >> 1; /* This represents 3x */
+
+ e0 -= sval;
+ l1[ 2 ] -= sval;
+ }
+
+ /* We have done everything, move the pointers */
+
+ res++;
+ if ( block ) block++;
+ data += htone->step;
+ l0++, l1++;
+ }
}
diff --git a/gs/base/gdevpipe.c b/gs/base/gdevpipe.c
index 8ede3d922..55bc441b0 100644
--- a/gs/base/gdevpipe.c
+++ b/gs/base/gdevpipe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ const gx_io_device gs_iodev_pipe = {
static int
pipe_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
errno = 0;
/*
@@ -48,16 +48,16 @@ pipe_fopen(gx_io_device * iodev, const char *fname, const char *access,
* mode, even though pipes are not positionable. Detect this here.
*/
if (strchr(access, '+'))
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
/*
* The OSF/1 1.3 library doesn't include const in the
* prototype for popen, so we have to break const here.
*/
*pfile = popen((char *)fname, (char *)access);
if (*pfile == NULL)
- return_error(gs_fopen_errno_to_code(errno));
+ return_error(gs_fopen_errno_to_code(errno));
if (rfname != NULL)
- strcpy(rfname, fname);
+ strcpy(rfname, fname);
return 0;
}
diff --git a/gs/base/gdevpjet.c b/gs/base/gdevpjet.c
index f135342b6..b4ec45543 100644
--- a/gs/base/gdevpjet.c
+++ b/gs/base/gdevpjet.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,28 +36,28 @@ static gx_device_procs paintjet_procs =
gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
const gx_device_printer far_data gs_lj250_device =
prn_device(paintjet_procs, "lj250",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.25, 0, 0.25, 0, /* margins */
- 3, lj250_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.25, 0, 0.25, 0, /* margins */
+ 3, lj250_print_page);
const gx_device_printer far_data gs_paintjet_device =
prn_device(paintjet_procs, "paintjet",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.25, 0, 0.25, 0, /* margins */
- 3, paintjet_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.25, 0, 0.25, 0, /* margins */
+ 3, paintjet_print_page);
static gx_device_procs pjetxl_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
const gx_device_printer far_data gs_pjetxl_device =
prn_device(pjetxl_procs, "pjetxl",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.25, 0, 0, 0, /* margins */
- 3, pjetxl_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.25, 0, 0, 0, /* margins */
+ 3, pjetxl_print_page);
/* Forward references */
static int compress1_row(const byte *, const byte *, byte *);
@@ -69,27 +69,27 @@ static int compress1_row(const byte *, const byte *, byte *);
static int
lj250_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ fputs("\033%8", prn_stream); /* Enter PCL emulation mode */
- /* ends raster graphics to set raster graphics resolution */
- fputs("\033*rB", prn_stream);
- /* Exit PCL emulation mode after printing */
- return pj_common_print_page(pdev, prn_stream, 0, "\033*r0B\014\033%@");
+ /* ends raster graphics to set raster graphics resolution */
+ fputs("\033*rB", prn_stream);
+ /* Exit PCL emulation mode after printing */
+ return pj_common_print_page(pdev, prn_stream, 0, "\033*r0B\014\033%@");
}
/* Send a page to the PaintJet. */
static int
paintjet_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ /* ends raster graphics to set raster graphics resolution */
- fputs("\033*rB", prn_stream);
- return pj_common_print_page(pdev, prn_stream, 0, "\033*r0B\014");
+ fputs("\033*rB", prn_stream);
+ return pj_common_print_page(pdev, prn_stream, 0, "\033*r0B\014");
}
/* Send a page to the PaintJet XL. */
static int
pjetxl_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ /* Initialize PaintJet XL for printing */
- fputs("\033E", prn_stream);
- /* The XL has a different vertical origin, who knows why?? */
- return pj_common_print_page(pdev, prn_stream, -360, "\033*rC");
+ fputs("\033E", prn_stream);
+ /* The XL has a different vertical origin, who knows why?? */
+ return pj_common_print_page(pdev, prn_stream, -360, "\033*rC");
}
/* Send the page to the printer. Compress each scan line. */
@@ -98,119 +98,119 @@ pj_common_print_page(gx_device_printer *pdev, FILE *prn_stream, int y_origin,
const char *end_page)
{
#define DATA_SIZE (LINE_SIZE * 8)
- byte *data =
- (byte *)gs_malloc(pdev->memory, DATA_SIZE, 1,
- "paintjet_print_page(data)");
- byte *plane_data =
- (byte *)gs_malloc(pdev->memory, LINE_SIZE * 3, 1,
- "paintjet_print_page(plane_data)");
- if ( data == 0 || plane_data == 0 )
- { if ( data )
- gs_free(pdev->memory, (char *)data, DATA_SIZE, 1,
- "paintjet_print_page(data)");
- if ( plane_data )
- gs_free(pdev->memory, (char *)plane_data, LINE_SIZE * 3, 1,
- "paintjet_print_page(plane_data)");
- return_error(gs_error_VMerror);
- }
-
- /* set raster graphics resolution -- 90 or 180 dpi */
- fprintf(prn_stream, "\033*t%dR", X_DPI);
-
- /* set the line width */
- fprintf(prn_stream, "\033*r%dS", DATA_SIZE);
-
- /* set the number of color planes */
- fprintf(prn_stream, "\033*r%dU", 3); /* always 3 */
-
- /* move to top left of page */
- fprintf(prn_stream, "\033&a0H\033&a%dV", y_origin);
-
- /* select data compression */
- fputs("\033*b1M", prn_stream);
-
- /* start raster graphics */
- fputs("\033*r1A", prn_stream);
-
- /* Send each scan line in turn */
- { int lnum;
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- int num_blank_lines = 0;
- for ( lnum = 0; lnum < pdev->height; lnum++ )
- { byte *end_data = data + line_size;
- gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
- /* Remove trailing 0s. */
- while ( end_data > data && end_data[-1] == 0 )
- end_data--;
- if ( end_data == data )
- { /* Blank line */
- num_blank_lines++;
- }
- else
- { int i;
- byte *odp;
- byte *row;
-
- /* Pad with 0s to fill out the last */
- /* block of 8 bytes. */
- memset(end_data, 0, 7);
-
- /* Transpose the data to get pixel planes. */
- for ( i = 0, odp = plane_data; i < DATA_SIZE;
- i += 8, odp++
- )
- { /* The following is for 16-bit machines */
+ byte *data =
+ (byte *)gs_malloc(pdev->memory, DATA_SIZE, 1,
+ "paintjet_print_page(data)");
+ byte *plane_data =
+ (byte *)gs_malloc(pdev->memory, LINE_SIZE * 3, 1,
+ "paintjet_print_page(plane_data)");
+ if ( data == 0 || plane_data == 0 )
+ { if ( data )
+ gs_free(pdev->memory, (char *)data, DATA_SIZE, 1,
+ "paintjet_print_page(data)");
+ if ( plane_data )
+ gs_free(pdev->memory, (char *)plane_data, LINE_SIZE * 3, 1,
+ "paintjet_print_page(plane_data)");
+ return_error(gs_error_VMerror);
+ }
+
+ /* set raster graphics resolution -- 90 or 180 dpi */
+ fprintf(prn_stream, "\033*t%dR", X_DPI);
+
+ /* set the line width */
+ fprintf(prn_stream, "\033*r%dS", DATA_SIZE);
+
+ /* set the number of color planes */
+ fprintf(prn_stream, "\033*r%dU", 3); /* always 3 */
+
+ /* move to top left of page */
+ fprintf(prn_stream, "\033&a0H\033&a%dV", y_origin);
+
+ /* select data compression */
+ fputs("\033*b1M", prn_stream);
+
+ /* start raster graphics */
+ fputs("\033*r1A", prn_stream);
+
+ /* Send each scan line in turn */
+ { int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int num_blank_lines = 0;
+ for ( lnum = 0; lnum < pdev->height; lnum++ )
+ { byte *end_data = data + line_size;
+ gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data == data )
+ { /* Blank line */
+ num_blank_lines++;
+ }
+ else
+ { int i;
+ byte *odp;
+ byte *row;
+
+ /* Pad with 0s to fill out the last */
+ /* block of 8 bytes. */
+ memset(end_data, 0, 7);
+
+ /* Transpose the data to get pixel planes. */
+ for ( i = 0, odp = plane_data; i < DATA_SIZE;
+ i += 8, odp++
+ )
+ { /* The following is for 16-bit machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static ulong spr40[8] = spread3(0x40);
- static ulong spr8[8] = spread3(8);
- static ulong spr2[8] = spread3(2);
- register byte *dp = data + i;
- register ulong pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr8[dp[3]] << 1) +
- (spr8[dp[4]]) +
- (spr8[dp[5]] >> 1) +
- (spr2[dp[6]]) +
- (spr2[dp[7]] >> 1);
- odp[0] = (byte)(pword >> 16);
- odp[LINE_SIZE] = (byte)(pword >> 8);
- odp[LINE_SIZE*2] = (byte)(pword);
- }
- /* Skip blank lines if any */
- if ( num_blank_lines > 0 )
- { /* move down from current position */
- fprintf(prn_stream, "\033&a+%dV",
- num_blank_lines * (720 / Y_DPI));
- num_blank_lines = 0;
- }
-
- /* Transfer raster graphics */
- /* in the order R, G, B. */
- for ( row = plane_data + LINE_SIZE * 2, i = 0;
- i < 3; row -= LINE_SIZE, i++
- )
- { byte temp[LINE_SIZE * 2];
- int count = compress1_row(row, row + LINE_SIZE, temp);
- fprintf(prn_stream, "\033*b%d%c",
- count, "VVW"[i]);
- fwrite(temp, sizeof(byte),
- count, prn_stream);
- }
- }
- }
- }
-
- /* end the page */
- fputs(end_page, prn_stream);
-
- gs_free(pdev->memory, (char *)data, DATA_SIZE, 1, "paintjet_print_page(data)");
- gs_free(pdev->memory, (char *)plane_data, LINE_SIZE * 3, 1, "paintjet_print_page(plane_data)");
-
- return 0;
+ static ulong spr40[8] = spread3(0x40);
+ static ulong spr8[8] = spread3(8);
+ static ulong spr2[8] = spread3(2);
+ register byte *dp = data + i;
+ register ulong pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr8[dp[3]] << 1) +
+ (spr8[dp[4]]) +
+ (spr8[dp[5]] >> 1) +
+ (spr2[dp[6]]) +
+ (spr2[dp[7]] >> 1);
+ odp[0] = (byte)(pword >> 16);
+ odp[LINE_SIZE] = (byte)(pword >> 8);
+ odp[LINE_SIZE*2] = (byte)(pword);
+ }
+ /* Skip blank lines if any */
+ if ( num_blank_lines > 0 )
+ { /* move down from current position */
+ fprintf(prn_stream, "\033&a+%dV",
+ num_blank_lines * (720 / Y_DPI));
+ num_blank_lines = 0;
+ }
+
+ /* Transfer raster graphics */
+ /* in the order R, G, B. */
+ for ( row = plane_data + LINE_SIZE * 2, i = 0;
+ i < 3; row -= LINE_SIZE, i++
+ )
+ { byte temp[LINE_SIZE * 2];
+ int count = compress1_row(row, row + LINE_SIZE, temp);
+ fprintf(prn_stream, "\033*b%d%c",
+ count, "VVW"[i]);
+ fwrite(temp, sizeof(byte),
+ count, prn_stream);
+ }
+ }
+ }
+ }
+
+ /* end the page */
+ fputs(end_page, prn_stream);
+
+ gs_free(pdev->memory, (char *)data, DATA_SIZE, 1, "paintjet_print_page(data)");
+ gs_free(pdev->memory, (char *)plane_data, LINE_SIZE * 3, 1, "paintjet_print_page(plane_data)");
+
+ return 0;
}
/*
@@ -228,19 +228,19 @@ static int
compress1_row(const byte *row, const byte *end_row,
byte *compressed)
{ register const byte *in = row;
- register byte *out = compressed;
- while ( in < end_row )
- { byte test = *in++;
- const byte *run = in;
- while ( in < end_row && *in == test ) in++;
- /* Note that in - run + 1 is the repetition count. */
- while ( in - run > 255 )
- { *out++ = 255;
- *out++ = ~test;
- run += 256;
- }
- *out++ = in - run;
- *out++ = ~test;
- }
- return out - compressed;
+ register byte *out = compressed;
+ while ( in < end_row )
+ { byte test = *in++;
+ const byte *run = in;
+ while ( in < end_row && *in == test ) in++;
+ /* Note that in - run + 1 is the repetition count. */
+ while ( in - run > 255 )
+ { *out++ = 255;
+ *out++ = ~test;
+ run += 256;
+ }
+ *out++ = in - run;
+ *out++ = ~test;
+ }
+ return out - compressed;
}
diff --git a/gs/base/gdevplib.c b/gs/base/gdevplib.c
index b85f8d7e6..f3a2bd826 100644
--- a/gs/base/gdevplib.c
+++ b/gs/base/gdevplib.c
@@ -50,7 +50,7 @@
#define DEBUG_DUMP
/* Define HT_RAW_DUMP to store the output as a raw CMYK buffer with the
- data size packed into the file name. Photoshop does not handle pam
+ data size packed into the file name. Photoshop does not handle pam
cmyk properly so we resort to this for debugging */
#define HT_RAW_DUMP
@@ -255,7 +255,6 @@ static dev_proc_put_params(plib_put_params);
static dev_proc_dev_spec_op(plib_dev_spec_op);
-
/* And of course we need our own print-page routines. */
static dev_proc_print_page(plib_print_page);
@@ -322,13 +321,13 @@ static int plibk_print_page(gx_device_printer * pdev, FILE * pstream);
NULL, /* get_color_comp_index */\
p_map_rgb_color, /* encode_color */\
p_map_color_rgb, /* decode_color */\
- NULL, /* pattern_manage */\
- NULL, /* fill_rectangle_hl_color */\
- NULL, /* include_color_space */\
- NULL, /* fill_linear_color_scanline */\
- NULL, /* fill_linear_color_trapezoid */\
- NULL, /* fill_linear_color_triangle */\
- NULL, /* update spot */\
+ NULL, /* pattern_manage */\
+ NULL, /* fill_rectangle_hl_color */\
+ NULL, /* include_color_space */\
+ NULL, /* fill_linear_color_scanline */\
+ NULL, /* fill_linear_color_trapezoid */\
+ NULL, /* fill_linear_color_triangle */\
+ NULL, /* update spot */\
NULL, /* DevN params */\
NULL, /* fill page */\
NULL, /* push_transparency_state */\
@@ -988,11 +987,11 @@ plibc_print_page(gx_device_printer * pdev, FILE * pstream)
return plib_print_page_loop(pdev, 3, 4, pstream);
}
-static int
+static int
plib_dev_spec_op(gx_device *pdev, int dev_spec_op,
- void *data, int size)
+ void *data, int size)
{
if (dev_spec_op == gxdso_is_native_planar)
- return 1;
+ return 1;
return gx_default_dev_spec_op(pdev, dev_spec_op, data, size);
}
diff --git a/gs/base/gdevplnx.c b/gs/base/gdevplnx.c
index 434ee39a9..655ba0219 100644
--- a/gs/base/gdevplnx.c
+++ b/gs/base/gdevplnx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@
#define COPY_ROP_TEXTURE_BUF_SIZE 100
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(device_plane_extract_enum_ptrs, gx_device_plane_extract *edev)
ENUM_PREFIX(st_device_forward, 1);
case 0: ENUM_RETURN(gx_device_enum_ptr(edev->target));
@@ -68,51 +68,51 @@ static dev_proc_get_bits_rectangle(plane_get_bits_rectangle);
/* Device prototype */
static const gx_device_plane_extract gs_plane_extract_device = {
std_device_std_body(gx_device_plane_extract, 0, "plane_extract",
- 0, 0, 72, 72),
+ 0, 0, 72, 72),
{
- plane_open_device,
- NULL,
- NULL,
- NULL,
- gx_default_close_device,
- NULL,
- NULL,
- plane_fill_rectangle,
- gx_default_tile_rectangle,
- plane_copy_mono,
- plane_copy_color,
- gx_default_draw_line,
- gx_default_get_bits,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- plane_copy_alpha,
- NULL,
- gx_default_copy_rop,
- plane_fill_path,
- plane_stroke_path,
- plane_fill_mask,
- gx_default_fill_trapezoid,
- plane_fill_parallelogram,
- plane_fill_triangle,
- gx_default_draw_thin_line,
- gx_default_begin_image,
- gx_default_image_data,
- gx_default_end_image,
- plane_strip_tile_rectangle,
- plane_strip_copy_rop,
- NULL,
- plane_begin_typed_image,
- plane_get_bits_rectangle,
- NULL,
- gx_no_create_compositor, /* WRONG */
- NULL,
- gx_default_text_begin
+ plane_open_device,
+ NULL,
+ NULL,
+ NULL,
+ gx_default_close_device,
+ NULL,
+ NULL,
+ plane_fill_rectangle,
+ gx_default_tile_rectangle,
+ plane_copy_mono,
+ plane_copy_color,
+ gx_default_draw_line,
+ gx_default_get_bits,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ plane_copy_alpha,
+ NULL,
+ gx_default_copy_rop,
+ plane_fill_path,
+ plane_stroke_path,
+ plane_fill_mask,
+ gx_default_fill_trapezoid,
+ plane_fill_parallelogram,
+ plane_fill_triangle,
+ gx_default_draw_thin_line,
+ gx_default_begin_image,
+ gx_default_image_data,
+ gx_default_end_image,
+ plane_strip_tile_rectangle,
+ plane_strip_copy_rop,
+ NULL,
+ plane_begin_typed_image,
+ plane_get_bits_rectangle,
+ NULL,
+ gx_no_create_compositor, /* WRONG */
+ NULL,
+ gx_default_text_begin
},
/* device-specific members */
NULL, /* target */
@@ -147,93 +147,93 @@ typedef enum {
((edev)->any_marks = true, REDUCE_DRAW))
static reduced_color_t
reduce_drawing_color(gx_device_color *ppdc, gx_device_plane_extract *edev,
- const gx_drawing_color *pdevc,
- gs_logical_operation_t *plop)
+ const gx_drawing_color *pdevc,
+ gs_logical_operation_t *plop)
{
reduced_color_t reduced;
if (gx_dc_is_pure(pdevc)) {
- gx_color_index pixel = COLOR_PIXEL(edev, gx_dc_pure_color(pdevc));
+ gx_color_index pixel = COLOR_PIXEL(edev, gx_dc_pure_color(pdevc));
- set_nonclient_dev_color(ppdc, pixel);
- reduced = REDUCE_PURE(edev, pixel);
+ set_nonclient_dev_color(ppdc, pixel);
+ reduced = REDUCE_PURE(edev, pixel);
} else if (gx_dc_is_binary_halftone(pdevc)) {
- gx_color_index pixel0 =
- TRANS_COLOR_PIXEL(edev, gx_dc_binary_color0(pdevc));
- gx_color_index pixel1 =
- TRANS_COLOR_PIXEL(edev, gx_dc_binary_color1(pdevc));
-
- if (pixel0 == pixel1) {
- set_nonclient_dev_color(ppdc, pixel0);
- reduced = REDUCE_PURE(edev, pixel0);
- } else {
- *ppdc = *pdevc;
- ppdc->colors.binary.color[0] = pixel0;
- ppdc->colors.binary.color[1] = pixel1;
- edev->any_marks = true;
- reduced = REDUCE_DRAW;
- }
+ gx_color_index pixel0 =
+ TRANS_COLOR_PIXEL(edev, gx_dc_binary_color0(pdevc));
+ gx_color_index pixel1 =
+ TRANS_COLOR_PIXEL(edev, gx_dc_binary_color1(pdevc));
+
+ if (pixel0 == pixel1) {
+ set_nonclient_dev_color(ppdc, pixel0);
+ reduced = REDUCE_PURE(edev, pixel0);
+ } else {
+ *ppdc = *pdevc;
+ ppdc->colors.binary.color[0] = pixel0;
+ ppdc->colors.binary.color[1] = pixel1;
+ edev->any_marks = true;
+ reduced = REDUCE_DRAW;
+ }
} else if (color_is_colored_halftone(pdevc)) {
- int plane = edev->plane.index;
- int i;
-
- *ppdc = *pdevc;
- for (i = 0; i < countof(ppdc->colors.colored.c_base); ++i)
- if (i != edev->plane.index) {
- ppdc->colors.colored.c_base[i] = 0;
- ppdc->colors.colored.c_level[i] = 0;
- }
- ppdc->colors.colored.plane_mask &= 1 << plane;
- if (ppdc->colors.colored.c_level[plane] == 0) {
- gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev);
- ppdc->colors.pure = COLOR_PIXEL(edev, ppdc->colors.pure);
- reduced = REDUCE_PURE(edev, gx_dc_pure_color(ppdc));
- } else if (ppdc->colors.colored.alpha != gx_max_color_value)
- return REDUCE_FAILED; /* can't reduce */
- else {
- gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev);
- ppdc->colors.binary.color[0] =
- COLOR_PIXEL(edev, ppdc->colors.binary.color[0]);
- ppdc->colors.binary.color[1] =
- COLOR_PIXEL(edev, ppdc->colors.binary.color[1]);
- gx_color_load(ppdc, NULL, (gx_device *)edev);
- edev->any_marks = true;
- reduced = REDUCE_DRAW;
- }
+ int plane = edev->plane.index;
+ int i;
+
+ *ppdc = *pdevc;
+ for (i = 0; i < countof(ppdc->colors.colored.c_base); ++i)
+ if (i != edev->plane.index) {
+ ppdc->colors.colored.c_base[i] = 0;
+ ppdc->colors.colored.c_level[i] = 0;
+ }
+ ppdc->colors.colored.plane_mask &= 1 << plane;
+ if (ppdc->colors.colored.c_level[plane] == 0) {
+ gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev);
+ ppdc->colors.pure = COLOR_PIXEL(edev, ppdc->colors.pure);
+ reduced = REDUCE_PURE(edev, gx_dc_pure_color(ppdc));
+ } else if (ppdc->colors.colored.alpha != gx_max_color_value)
+ return REDUCE_FAILED; /* can't reduce */
+ else {
+ gx_devn_reduce_colored_halftone(ppdc, (gx_device *)edev);
+ ppdc->colors.binary.color[0] =
+ COLOR_PIXEL(edev, ppdc->colors.binary.color[0]);
+ ppdc->colors.binary.color[1] =
+ COLOR_PIXEL(edev, ppdc->colors.binary.color[1]);
+ gx_color_load(ppdc, NULL, (gx_device *)edev);
+ edev->any_marks = true;
+ reduced = REDUCE_DRAW;
+ }
} else
- return REDUCE_FAILED; /* can't handle it */
+ return REDUCE_FAILED; /* can't handle it */
if (*plop & lop_T_transparent) {
- /*
- * If the logical operation invokes transparency for the texture, we
- * must do some extra work, since a color that was originally opaque
- * may become transparent (white) if reduced to a single plane. If
- * RasterOp transparency were calculated before halftoning, life
- * would be easy: we would simply turn off texture transparency in
- * the logical operation iff the original (not reduced) color was
- * not white. Unfortunately, RasterOp transparency is calculated
- * after halftoning. (This is arguably wrong, but it's how we've
- * defined it.) Therefore, if transparency is involved with a
- * white color or a halftone that can include white, we must keep
- * the entire pixel together for the RasterOp.
- */
- gx_color_index white = gx_device_white((gx_device *)edev);
-
- /*
- * Given that we haven't failed, the only possible colors at this
- * point are pure or binary halftone.
- */
- if (gx_dc_is_pure(ppdc)) {
- if (gx_dc_pure_color(pdevc) != white)
- *plop &= ~lop_T_transparent;
- else if (!gx_dc_is_pure(pdevc))
- return REDUCE_FAILED;
- } else {
- if (gx_dc_binary_color0(pdevc) != white &&
- gx_dc_binary_color1(pdevc) != white) {
- *plop &= ~lop_T_transparent;
- } else
- return REDUCE_FAILED;
- }
+ /*
+ * If the logical operation invokes transparency for the texture, we
+ * must do some extra work, since a color that was originally opaque
+ * may become transparent (white) if reduced to a single plane. If
+ * RasterOp transparency were calculated before halftoning, life
+ * would be easy: we would simply turn off texture transparency in
+ * the logical operation iff the original (not reduced) color was
+ * not white. Unfortunately, RasterOp transparency is calculated
+ * after halftoning. (This is arguably wrong, but it's how we've
+ * defined it.) Therefore, if transparency is involved with a
+ * white color or a halftone that can include white, we must keep
+ * the entire pixel together for the RasterOp.
+ */
+ gx_color_index white = gx_device_white((gx_device *)edev);
+
+ /*
+ * Given that we haven't failed, the only possible colors at this
+ * point are pure or binary halftone.
+ */
+ if (gx_dc_is_pure(ppdc)) {
+ if (gx_dc_pure_color(pdevc) != white)
+ *plop &= ~lop_T_transparent;
+ else if (!gx_dc_is_pure(pdevc))
+ return REDUCE_FAILED;
+ } else {
+ if (gx_dc_binary_color0(pdevc) != white &&
+ gx_dc_binary_color1(pdevc) != white) {
+ *plop &= ~lop_T_transparent;
+ } else
+ return REDUCE_FAILED;
+ }
}
return reduced;
}
@@ -253,25 +253,25 @@ reduce_drawing_color(gx_device_color *ppdc, gx_device_plane_extract *edev,
* is not used.
*/
typedef struct tiling_state_s {
- /* Save the original operands. */
+ /* Save the original operands. */
const gx_device_plane_extract *edev;
const byte *data;
int data_x;
uint raster;
int width, height;
int dest_x; /* only for copy_color, defaults to 0 */
- /* Define the (aligned) buffer for doing the operation. */
+ /* Define the (aligned) buffer for doing the operation. */
struct tsb_ {
- byte *data;
- uint size;
- uint raster;
- bool on_heap;
+ byte *data;
+ uint size;
+ uint raster;
+ bool on_heap;
} buffer;
- /* Record the current tile available for processing. */
- /* The client may read these out. */
+ /* Record the current tile available for processing. */
+ /* The client may read these out. */
gs_int_point offset;
gs_int_point size;
- /* Record private tiling parameters. */
+ /* Record private tiling parameters. */
int per_tile_width;
} tiling_state_t;
@@ -295,7 +295,7 @@ extract_partial_tile(const tiling_state_t *pts)
source.x = pts->data_x + pts->offset.x;
bits_extract_plane(&dest, &source, edev->plane.shift,
- pts->size.x, pts->size.y);
+ pts->size.x, pts->size.y);
return 0;
}
@@ -309,7 +309,7 @@ begin_tiling(tiling_state_t *pts, gx_device_plane_extract *edev,
byte *local_buffer, uint buffer_size, bool partial_ok)
{
uint width_raster =
- bitmap_raster(width * edev->plane_dev->color_info.depth);
+ bitmap_raster(width * edev->plane_dev->color_info.depth);
uint full_size = width_raster * height;
pts->edev = edev;
@@ -317,34 +317,34 @@ begin_tiling(tiling_state_t *pts, gx_device_plane_extract *edev,
pts->width = width, pts->height = height;
pts->dest_x = 0;
if (full_size <= buffer_size) {
- pts->buffer.data = local_buffer;
- pts->buffer.size = buffer_size;
- pts->buffer.raster = width_raster;
- pts->buffer.on_heap = false;
- pts->size.x = width, pts->size.y = height;
+ pts->buffer.data = local_buffer;
+ pts->buffer.size = buffer_size;
+ pts->buffer.raster = width_raster;
+ pts->buffer.on_heap = false;
+ pts->size.x = width, pts->size.y = height;
} else if (partial_ok) {
- pts->buffer.data = local_buffer;
- pts->buffer.size = buffer_size;
- pts->buffer.on_heap = false;
- if (buffer_size >= width_raster) {
- pts->buffer.raster = width_raster;
- pts->size.x = width;
- pts->size.y = buffer_size / width_raster;
- } else {
- pts->buffer.raster = buffer_size & -align_bitmap_mod;
- pts->size.x =
- pts->buffer.raster * (8 / edev->plane_dev->color_info.depth);
- pts->size.y = 1;
- }
+ pts->buffer.data = local_buffer;
+ pts->buffer.size = buffer_size;
+ pts->buffer.on_heap = false;
+ if (buffer_size >= width_raster) {
+ pts->buffer.raster = width_raster;
+ pts->size.x = width;
+ pts->size.y = buffer_size / width_raster;
+ } else {
+ pts->buffer.raster = buffer_size & -align_bitmap_mod;
+ pts->size.x =
+ pts->buffer.raster * (8 / edev->plane_dev->color_info.depth);
+ pts->size.y = 1;
+ }
} else {
- pts->buffer.data =
- gs_alloc_bytes(edev->memory, full_size, "begin_tiling");
- if (!pts->buffer.data)
- return_error(gs_error_VMerror);
- pts->buffer.size = full_size;
- pts->buffer.raster = width_raster;
- pts->buffer.on_heap = true;
- pts->size.x = width, pts->size.y = height;
+ pts->buffer.data =
+ gs_alloc_bytes(edev->memory, full_size, "begin_tiling");
+ if (!pts->buffer.data)
+ return_error(gs_error_VMerror);
+ pts->buffer.size = full_size;
+ pts->buffer.raster = width_raster;
+ pts->buffer.on_heap = true;
+ pts->size.x = width, pts->size.y = height;
}
pts->buffer.raster = width_raster;
pts->offset.x = pts->offset.y = 0;
@@ -359,14 +359,14 @@ static bool
next_tile(tiling_state_t *pts)
{
if ((pts->offset.x += pts->size.x) >= pts->width) {
- if ((pts->offset.y += pts->size.y) >= pts->height)
- return false;
- pts->offset.x = 0;
- pts->size.x = pts->per_tile_width;
- if (pts->offset.y + pts->size.y >= pts->height)
- pts->size.y = pts->height - pts->offset.y;
+ if ((pts->offset.y += pts->size.y) >= pts->height)
+ return false;
+ pts->offset.x = 0;
+ pts->size.x = pts->per_tile_width;
+ if (pts->offset.y + pts->size.y >= pts->height)
+ pts->size.y = pts->height - pts->offset.y;
} else if (pts->offset.x + pts->size.x >= pts->width)
- pts->size.x = pts->width - pts->offset.x;
+ pts->size.x = pts->width - pts->offset.x;
return true;
}
@@ -377,7 +377,7 @@ static void
end_tiling(tiling_state_t *pts)
{
if (pts->buffer.on_heap)
- gs_free_object(pts->edev->memory, pts->buffer.data, "end_tiling");
+ gs_free_object(pts->edev->memory, pts->buffer.data, "end_tiling");
}
/* ---------------- Initialization ---------------- */
@@ -388,10 +388,10 @@ plane_device_init(gx_device_plane_extract *edev, gx_device *target,
{
/* Check for compatibility of the plane specification. */
if (render_plane->depth > plane_dev->color_info.depth)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
gx_device_init((gx_device *)edev,
- (const gx_device *)&gs_plane_extract_device,
- edev->memory, true);
+ (const gx_device *)&gs_plane_extract_device,
+ edev->memory, true);
check_device_separable((gx_device *)edev);
gx_device_forward_fill_in_procs((gx_device_forward *)edev);
gx_device_set_target((gx_device_forward *)edev, target);
@@ -400,10 +400,10 @@ plane_device_init(gx_device_plane_extract *edev, gx_device *target,
edev->plane = *render_plane;
plane_open_device((gx_device *)edev);
if (clear) {
- dev_proc(plane_dev, fill_rectangle)
- (plane_dev, 0, 0, plane_dev->width, plane_dev->height,
- edev->plane_white);
- edev->any_marks = false;
+ dev_proc(plane_dev, fill_rectangle)
+ (plane_dev, 0, 0, plane_dev->width, plane_dev->height,
+ edev->plane_white);
+ edev->any_marks = false;
}
return 0;
}
@@ -417,12 +417,12 @@ plane_open_device(gx_device *dev)
gx_device * const plane_dev = edev->plane_dev;
int plane_depth = plane_dev->color_info.depth;
const gx_device_memory * const mdproto =
- gdev_mem_device_for_bits(plane_depth);
+ gdev_mem_device_for_bits(plane_depth);
edev->plane_white = gx_device_white(plane_dev);
edev->plane_mask = (1 << plane_depth) - 1;
edev->plane_dev_is_memory = mdproto != 0 &&
- dev_proc(plane_dev, copy_color) == dev_proc(mdproto, copy_color);
+ dev_proc(plane_dev, copy_color) == dev_proc(mdproto, copy_color);
/* We don't set or clear any_marks here: see ...init above. */
return 0;
}
@@ -436,11 +436,11 @@ plane_fill_rectangle(gx_device *dev,
gx_color_index pixel = COLOR_PIXEL(edev, color);
if (pixel != edev->plane_white)
- edev->any_marks = true;
+ edev->any_marks = true;
else if (!edev->any_marks)
- return 0;
+ return 0;
return dev_proc(plane_dev, fill_rectangle)
- (plane_dev, x, y, w, h, pixel);
+ (plane_dev, x, y, w, h, pixel);
}
static int
@@ -455,16 +455,16 @@ plane_copy_mono(gx_device *dev,
gx_color_index pixel1 = TRANS_COLOR_PIXEL(edev, color1);
if (pixel0 == pixel1)
- return plane_fill_rectangle(dev, x, y, w, h, color0);
+ return plane_fill_rectangle(dev, x, y, w, h, color0);
if ((pixel0 == edev->plane_white || pixel0 == gx_no_color_index) &&
- (pixel1 == edev->plane_white || pixel1 == gx_no_color_index)) {
- /* This operation will only write white. */
- if (!edev->any_marks)
- return 0;
+ (pixel1 == edev->plane_white || pixel1 == gx_no_color_index)) {
+ /* This operation will only write white. */
+ if (!edev->any_marks)
+ return 0;
} else
- edev->any_marks = true;
+ edev->any_marks = true;
return dev_proc(plane_dev, copy_mono)
- (plane_dev, data, data_x, raster, id, x, y, w, h, pixel0, pixel1);
+ (plane_dev, data, data_x, raster, id, x, y, w, h, pixel0, pixel1);
}
static int
@@ -479,31 +479,31 @@ plane_copy_color(gx_device *dev,
int code;
if (edev->plane_dev_is_memory) {
- /* Reduce the source directly into the plane device. */
- gx_device_memory * const mdev = (gx_device_memory *)plane_dev;
-
- fit_copy(edev, data, data_x, raster, id, x, y, w, h);
- code = begin_tiling(&state, edev, data, data_x, raster, w, h,
- scan_line_base(mdev, y), max_uint, false);
- if (code < 0)
- return code;
- state.dest_x = x;
- state.buffer.raster = mdev->raster;
- extract_partial_tile(&state);
- end_tiling(&state);
- edev->any_marks = true;
- return 0;
+ /* Reduce the source directly into the plane device. */
+ gx_device_memory * const mdev = (gx_device_memory *)plane_dev;
+
+ fit_copy(edev, data, data_x, raster, id, x, y, w, h);
+ code = begin_tiling(&state, edev, data, data_x, raster, w, h,
+ scan_line_base(mdev, y), max_uint, false);
+ if (code < 0)
+ return code;
+ state.dest_x = x;
+ state.buffer.raster = mdev->raster;
+ extract_partial_tile(&state);
+ end_tiling(&state);
+ edev->any_marks = true;
+ return 0;
}
code = begin_tiling(&state, edev, data, data_x, raster,
- w, h, (byte *)buf, sizeof(buf), true);
+ w, h, (byte *)buf, sizeof(buf), true);
if (code < 0)
- return code;
+ return code;
do {
- extract_partial_tile(&state);
- code = dev_proc(plane_dev, copy_color)
- (plane_dev, state.buffer.data, 0, state.buffer.raster,
- gx_no_bitmap_id, x + state.offset.x, y + state.offset.y,
- state.size.x, state.size.y);
+ extract_partial_tile(&state);
+ code = dev_proc(plane_dev, copy_color)
+ (plane_dev, state.buffer.data, 0, state.buffer.raster,
+ gx_no_bitmap_id, x + state.offset.x, y + state.offset.y,
+ state.size.x, state.size.y);
} while (code >= 0 && next_tile(&state));
end_tiling(&state);
edev->any_marks = true;
@@ -520,11 +520,11 @@ plane_copy_alpha(gx_device *dev, const byte *data, int data_x,
gx_color_index pixel = COLOR_PIXEL(edev, color);
if (pixel != edev->plane_white)
- edev->any_marks = true;
+ edev->any_marks = true;
else if (!edev->any_marks)
- return 0;
+ return 0;
return dev_proc(plane_dev, copy_alpha)
- (plane_dev, data, data_x, raster, id, x, y, w, h, pixel, depth);
+ (plane_dev, data, data_x, raster, id, x, y, w, h, pixel, depth);
}
static int
@@ -536,27 +536,27 @@ plane_fill_path(gx_device *dev,
gx_device_plane_extract * const edev = (gx_device_plane_extract *)dev;
gx_device * const plane_dev = edev->plane_dev;
gs_logical_operation_t lop_orig =
- gs_current_logical_op((const gs_state *)pis);
+ gs_current_logical_op((const gs_state *)pis);
gs_logical_operation_t lop = lop_orig;
gx_device_color dcolor;
switch (reduce_drawing_color(&dcolor, edev, pdevc, &lop)) {
case REDUCE_SKIP:
- return 0;
+ return 0;
case REDUCE_DRAW: {
- gs_imager_state lopis;
- const gs_imager_state *pis_draw = pis;
-
- if (lop != lop_orig) {
- lopis = *pis;
- gs_set_logical_op((gs_state *)&lopis, lop);
- pis_draw = &lopis;
- }
- return dev_proc(plane_dev, fill_path)
- (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);
+ gs_imager_state lopis;
+ const gs_imager_state *pis_draw = pis;
+
+ if (lop != lop_orig) {
+ lopis = *pis;
+ gs_set_logical_op((gs_state *)&lopis, lop);
+ pis_draw = &lopis;
+ }
+ return dev_proc(plane_dev, fill_path)
+ (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);
}
default /*REDUCE_FAILED*/:
- return gx_default_fill_path(dev, pis, ppath, params, pdevc, pcpath);
+ return gx_default_fill_path(dev, pis, ppath, params, pdevc, pcpath);
}
}
@@ -569,27 +569,27 @@ plane_stroke_path(gx_device *dev,
gx_device_plane_extract * const edev = (gx_device_plane_extract *)dev;
gx_device * const plane_dev = edev->plane_dev;
gs_logical_operation_t lop_orig =
- gs_current_logical_op((const gs_state *)pis);
+ gs_current_logical_op((const gs_state *)pis);
gs_logical_operation_t lop = lop_orig;
gx_device_color dcolor;
switch (reduce_drawing_color(&dcolor, edev, pdevc, &lop)) {
case REDUCE_SKIP:
- return 0;
+ return 0;
case REDUCE_DRAW: {
- gs_imager_state lopis;
- const gs_imager_state *pis_draw = pis;
-
- if (lop != lop_orig) {
- lopis = *pis;
- gs_set_logical_op((gs_state *)&lopis, lop);
- pis_draw = &lopis;
- }
- return dev_proc(plane_dev, stroke_path)
- (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);
+ gs_imager_state lopis;
+ const gs_imager_state *pis_draw = pis;
+
+ if (lop != lop_orig) {
+ lopis = *pis;
+ gs_set_logical_op((gs_state *)&lopis, lop);
+ pis_draw = &lopis;
+ }
+ return dev_proc(plane_dev, stroke_path)
+ (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);
}
default /*REDUCE_FAILED*/:
- return gx_default_stroke_path(dev, pis, ppath, params, pdevc, pcpath);
+ return gx_default_stroke_path(dev, pis, ppath, params, pdevc, pcpath);
}
}
@@ -606,14 +606,14 @@ plane_fill_mask(gx_device *dev,
switch (reduce_drawing_color(&dcolor, edev, pdcolor, &lop)) {
case REDUCE_SKIP:
- return 0;
+ return 0;
case REDUCE_DRAW:
- return dev_proc(plane_dev, fill_mask)
- (plane_dev, data, data_x, raster, gx_no_bitmap_id, x, y, w, h,
- &dcolor, depth, lop, pcpath);
+ return dev_proc(plane_dev, fill_mask)
+ (plane_dev, data, data_x, raster, gx_no_bitmap_id, x, y, w, h,
+ &dcolor, depth, lop, pcpath);
default /*REDUCE_FAILED*/:
- return gx_default_fill_mask(dev, data, data_x, raster, gx_no_bitmap_id,
- x, y, w, h, &dcolor, depth, lop, pcpath);
+ return gx_default_fill_mask(dev, data, data_x, raster, gx_no_bitmap_id,
+ x, y, w, h, &dcolor, depth, lop, pcpath);
}
}
@@ -628,13 +628,13 @@ plane_fill_parallelogram(gx_device * dev,
switch (reduce_drawing_color(&dcolor, edev, pdcolor, &lop)) {
case REDUCE_SKIP:
- return 0;
+ return 0;
case REDUCE_DRAW:
- return dev_proc(plane_dev, fill_parallelogram)
- (plane_dev, px, py, ax, ay, bx, by, &dcolor, lop);
+ return dev_proc(plane_dev, fill_parallelogram)
+ (plane_dev, px, py, ax, ay, bx, by, &dcolor, lop);
default /*REDUCE_FAILED*/:
- return gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
- pdcolor, lop);
+ return gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
+ pdcolor, lop);
}
}
@@ -649,13 +649,13 @@ plane_fill_triangle(gx_device * dev,
switch (reduce_drawing_color(&dcolor, edev, pdcolor, &lop)) {
case REDUCE_SKIP:
- return 0;
+ return 0;
case REDUCE_DRAW:
- return dev_proc(plane_dev, fill_triangle)
- (plane_dev, px, py, ax, ay, bx, by, &dcolor, lop);
+ return dev_proc(plane_dev, fill_triangle)
+ (plane_dev, px, py, ax, ay, bx, by, &dcolor, lop);
default /*REDUCE_FAILED*/:
- return gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
- pdcolor, lop);
+ return gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
+ pdcolor, lop);
}
}
@@ -671,43 +671,43 @@ plane_strip_tile_rectangle(gx_device *dev,
gx_color_index pixel1 = TRANS_COLOR_PIXEL(edev, color1);
if (pixel0 == pixel1) {
- if (pixel0 != gx_no_color_index)
- return plane_fill_rectangle(dev, x, y, w, h, color0);
- /* The tile is a pixmap rather than a bitmap. */
- /* We should use the default implementation if it is small.... */
- {
- gx_strip_bitmap plane_tile;
- tiling_state_t state;
- long buf[TILE_RECTANGLE_BUF_SIZE / sizeof(long)];
- int code = begin_tiling(&state, edev, tiles->data, 0, tiles->raster,
- tiles->size.x, tiles->size.y,
- (byte *)buf, sizeof(buf), false);
-
- if (code < 0)
- return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
- color0, color1, phase_x, phase_y);
- extract_partial_tile(&state);
- plane_tile = *tiles;
- plane_tile.data = state.buffer.data;
- plane_tile.raster = state.buffer.raster;
- plane_tile.id = gx_no_bitmap_id;
- code = dev_proc(plane_dev, strip_tile_rectangle)
- (plane_dev, &plane_tile, x, y, w, h, pixel0, pixel1,
- phase_x, phase_y);
- end_tiling(&state);
- edev->any_marks = true;
- return code;
- }
+ if (pixel0 != gx_no_color_index)
+ return plane_fill_rectangle(dev, x, y, w, h, color0);
+ /* The tile is a pixmap rather than a bitmap. */
+ /* We should use the default implementation if it is small.... */
+ {
+ gx_strip_bitmap plane_tile;
+ tiling_state_t state;
+ long buf[TILE_RECTANGLE_BUF_SIZE / sizeof(long)];
+ int code = begin_tiling(&state, edev, tiles->data, 0, tiles->raster,
+ tiles->size.x, tiles->size.y,
+ (byte *)buf, sizeof(buf), false);
+
+ if (code < 0)
+ return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
+ color0, color1, phase_x, phase_y);
+ extract_partial_tile(&state);
+ plane_tile = *tiles;
+ plane_tile.data = state.buffer.data;
+ plane_tile.raster = state.buffer.raster;
+ plane_tile.id = gx_no_bitmap_id;
+ code = dev_proc(plane_dev, strip_tile_rectangle)
+ (plane_dev, &plane_tile, x, y, w, h, pixel0, pixel1,
+ phase_x, phase_y);
+ end_tiling(&state);
+ edev->any_marks = true;
+ return code;
+ }
}
if ((pixel0 == edev->plane_white || pixel0 == gx_no_color_index) &&
- (pixel1 == edev->plane_white || pixel1 == gx_no_color_index)) {
- /* This operation will only write white. */
- if (!edev->any_marks)
- return 0;
+ (pixel1 == edev->plane_white || pixel1 == gx_no_color_index)) {
+ /* This operation will only write white. */
+ if (!edev->any_marks)
+ return 0;
} else
- edev->any_marks = true;
+ edev->any_marks = true;
return dev_proc(plane_dev, strip_tile_rectangle)
- (plane_dev, tiles, x, y, w, h, pixel0, pixel1, phase_x, phase_y);
+ (plane_dev, tiles, x, y, w, h, pixel0, pixel1, phase_x, phase_y);
}
static int
@@ -722,9 +722,9 @@ plane_strip_copy_rop(gx_device *dev,
gx_device * const plane_dev = edev->plane_dev;
gs_rop3_t rop = lop_rop(lop);
struct crp_ {
- gx_color_index pixels[2];
- gx_color_index *colors;
- tiling_state_t state;
+ gx_color_index pixels[2];
+ gx_color_index *colors;
+ tiling_state_t state;
} source, texture;
long sbuf[COPY_ROP_SOURCE_BUF_SIZE / sizeof(long)];
long tbuf[COPY_ROP_TEXTURE_BUF_SIZE / sizeof(long)];
@@ -736,73 +736,73 @@ plane_strip_copy_rop(gx_device *dev,
/* We should do better than this on transparency.... */
if (lop & (lop_S_transparent | lop_T_transparent))
- return gx_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
- scolors, textures, tcolors,
- x, y, w, h, phase_x, phase_y, lop);
+ return gx_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
+ scolors, textures, tcolors,
+ x, y, w, h, phase_x, phase_y, lop);
if (!rop3_uses_S(rop)) {
- sdata = 0;
- source.colors = 0;
+ sdata = 0;
+ source.colors = 0;
} else if (scolors) {
- source.pixels[0] = COLOR_PIXEL(edev, scolors[0]);
- source.pixels[1] = COLOR_PIXEL(edev, scolors[1]);
- if (source.pixels[0] == source.pixels[1])
- sdata = 0;
- source.colors = source.pixels;
+ source.pixels[0] = COLOR_PIXEL(edev, scolors[0]);
+ source.pixels[1] = COLOR_PIXEL(edev, scolors[1]);
+ if (source.pixels[0] == source.pixels[1])
+ sdata = 0;
+ source.colors = source.pixels;
}
else
- source.colors = 0;
+ source.colors = 0;
if (!rop3_uses_T(rop)) {
- textures = 0;
- texture.colors = 0;
+ textures = 0;
+ texture.colors = 0;
} else if (tcolors) {
- texture.pixels[0] = COLOR_PIXEL(edev, tcolors[0]);
- texture.pixels[1] = COLOR_PIXEL(edev, tcolors[1]);
- if (texture.pixels[0] == texture.pixels[1])
- textures = 0;
- texture.colors = texture.pixels;
+ texture.pixels[0] = COLOR_PIXEL(edev, tcolors[0]);
+ texture.pixels[1] = COLOR_PIXEL(edev, tcolors[1]);
+ if (texture.pixels[0] == texture.pixels[1])
+ textures = 0;
+ texture.colors = texture.pixels;
}
else
- texture.colors = 0;
+ texture.colors = 0;
if (sdata) {
- code = begin_tiling(&source.state, edev, sdata, sourcex, sraster, w, y,
- (byte *)sbuf, sizeof(sbuf), true);
- if (code < 0)
- return gx_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
- scolors, textures, tcolors,
- x, y, w, h, phase_x, phase_y, lop);
- plane_source = source.state.buffer.data;
- plane_raster = source.state.buffer.raster;
+ code = begin_tiling(&source.state, edev, sdata, sourcex, sraster, w, y,
+ (byte *)sbuf, sizeof(sbuf), true);
+ if (code < 0)
+ return gx_default_strip_copy_rop(dev, sdata, sourcex, sraster, id,
+ scolors, textures, tcolors,
+ x, y, w, h, phase_x, phase_y, lop);
+ plane_source = source.state.buffer.data;
+ plane_raster = source.state.buffer.raster;
} else
- plane_source = 0;
+ plane_source = 0;
if (textures) {
- code = begin_tiling(&texture.state, edev, textures->data, 0,
- textures->raster, textures->size.x,
- textures->size.y, (byte *)tbuf, sizeof(tbuf),
- false);
- if (code < 0) {
- if (plane_source)
- end_tiling(&source.state);
- return code;
- }
- plane_texture = *textures;
- plane_texture.data = texture.state.buffer.data;
- plane_texture.raster = texture.state.buffer.raster;
- plane_textures = &plane_texture;
+ code = begin_tiling(&texture.state, edev, textures->data, 0,
+ textures->raster, textures->size.x,
+ textures->size.y, (byte *)tbuf, sizeof(tbuf),
+ false);
+ if (code < 0) {
+ if (plane_source)
+ end_tiling(&source.state);
+ return code;
+ }
+ plane_texture = *textures;
+ plane_texture.data = texture.state.buffer.data;
+ plane_texture.raster = texture.state.buffer.raster;
+ plane_textures = &plane_texture;
}
if (textures)
- extract_partial_tile(&texture.state);
+ extract_partial_tile(&texture.state);
do {
- if (sdata)
- extract_partial_tile(&source.state);
- code = dev_proc(plane_dev, strip_copy_rop)
- (plane_dev, plane_source, sourcex, plane_raster, gx_no_bitmap_id,
- source.colors, plane_textures, texture.colors,
- x, y, w, h, phase_x, phase_y, lop);
+ if (sdata)
+ extract_partial_tile(&source.state);
+ code = dev_proc(plane_dev, strip_copy_rop)
+ (plane_dev, plane_source, sourcex, plane_raster, gx_no_bitmap_id,
+ source.colors, plane_textures, texture.colors,
+ x, y, w, h, phase_x, phase_y, lop);
} while (code >= 0 && sdata && next_tile(&source.state));
if (textures)
- end_tiling(&texture.state);
+ end_tiling(&texture.state);
if (sdata)
- end_tiling(&source.state);
+ end_tiling(&source.state);
return code;
}
@@ -833,14 +833,14 @@ plane_cmap_gray(frac gray, gx_device_color * pdc,
const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select)
{
const plane_image_enum_t *ppie =
- (const plane_image_enum_t *)pis_image->client_data;
+ (const plane_image_enum_t *)pis_image->client_data;
gx_device_plane_extract * const edev =
- (gx_device_plane_extract *)ppie->dev;
+ (gx_device_plane_extract *)ppie->dev;
gs_logical_operation_t lop = gs_current_logical_op_inline(pis_image);
gx_device_color dcolor;
gx_remap_concrete_gray(gray, &dcolor, ppie->pis,
- (gx_device *)edev, select);
+ (gx_device *)edev, select);
reduce_drawing_color(pdc, edev, &dcolor, &lop);
}
static void
@@ -848,14 +848,14 @@ plane_cmap_rgb(frac r, frac g, frac b, gx_device_color * pdc,
const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select)
{
const plane_image_enum_t *ppie =
- (const plane_image_enum_t *)pis_image->client_data;
+ (const plane_image_enum_t *)pis_image->client_data;
gx_device_plane_extract * const edev =
- (gx_device_plane_extract *)ppie->dev;
+ (gx_device_plane_extract *)ppie->dev;
gs_logical_operation_t lop = gs_current_logical_op_inline(pis_image);
gx_device_color dcolor;
gx_remap_concrete_rgb(r, g, b, &dcolor, ppie->pis,
- (gx_device *)edev, select);
+ (gx_device *)edev, select);
reduce_drawing_color(pdc, edev, &dcolor, &lop);
}
static void
@@ -863,14 +863,14 @@ plane_cmap_cmyk(frac c, frac m, frac y, frac k, gx_device_color * pdc,
const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select)
{
const plane_image_enum_t *ppie =
- (const plane_image_enum_t *)pis_image->client_data;
+ (const plane_image_enum_t *)pis_image->client_data;
gx_device_plane_extract * const edev =
- (gx_device_plane_extract *)ppie->dev;
+ (gx_device_plane_extract *)ppie->dev;
gs_logical_operation_t lop = gs_current_logical_op_inline(pis_image);
gx_device_color dcolor;
gx_remap_concrete_cmyk(c, m, y, k, &dcolor, ppie->pis,
- (gx_device *)edev, select);
+ (gx_device *)edev, select);
reduce_drawing_color(pdc, edev, &dcolor, &lop);
}
static void
@@ -878,14 +878,14 @@ plane_cmap_rgb_alpha(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select)
{
const plane_image_enum_t *ppie =
- (const plane_image_enum_t *)pis_image->client_data;
+ (const plane_image_enum_t *)pis_image->client_data;
gx_device_plane_extract * const edev =
- (gx_device_plane_extract *)ppie->dev;
+ (gx_device_plane_extract *)ppie->dev;
gs_logical_operation_t lop = gs_current_logical_op_inline(pis_image);
gx_device_color dcolor;
gx_remap_concrete_rgb_alpha(r, g, b, alpha, &dcolor, ppie->pis,
- (gx_device *)edev, select);
+ (gx_device *)edev, select);
reduce_drawing_color(pdc, edev, &dcolor, &lop);
}
static bool
@@ -913,10 +913,10 @@ static const gx_image_enum_procs_t plane_image_enum_procs = {
static int
plane_begin_typed_image(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
/*
* For images, we intercept the imager state's cmap_procs and apply
@@ -936,48 +936,48 @@ plane_begin_typed_image(gx_device * dev,
/* We can only handle a limited set of image types. */
switch (pic->type->index) {
case 1: {
- const gs_image1_t * const pim1 = (const gs_image1_t *)pic;
+ const gs_image1_t * const pim1 = (const gs_image1_t *)pic;
- if (pim1->Alpha != gs_image_alpha_none)
- goto fail;
- uses_color = pim1->ImageMask;
- break;
- }
+ if (pim1->Alpha != gs_image_alpha_none)
+ goto fail;
+ uses_color = pim1->ImageMask;
+ break;
+ }
case 3:
case 4:
- break;
+ break;
default:
- goto fail;
+ goto fail;
}
pim = (const gs_pixel_image_t *)pic;
if ((lop & lop_S_transparent) ||
- ((uses_color || pim->CombineWithColor) && (lop & lop_T_transparent))
- )
- goto fail;
+ ((uses_color || pim->CombineWithColor) && (lop & lop_T_transparent))
+ )
+ goto fail;
if (uses_color || (pim->CombineWithColor && lop_uses_T(lop))) {
- if (reduce_drawing_color(&dcolor, edev, pdcolor, &lop) ==
- REDUCE_FAILED)
- goto fail;
+ if (reduce_drawing_color(&dcolor, edev, pdcolor, &lop) ==
+ REDUCE_FAILED)
+ goto fail;
} else {
- /*
- * The drawing color won't be used, but if RasterOp is involved,
- * it may still be accessed in some anomalous cases.
- */
- set_nonclient_dev_color(&dcolor, (gx_color_index)0);
+ /*
+ * The drawing color won't be used, but if RasterOp is involved,
+ * it may still be accessed in some anomalous cases.
+ */
+ set_nonclient_dev_color(&dcolor, (gx_color_index)0);
}
info = gs_alloc_struct(memory, plane_image_enum_t, &st_plane_image_enum,
- "plane_image_begin_typed(info)");
+ "plane_image_begin_typed(info)");
pis_image = gs_imager_state_copy(pis, memory);
if (pis_image == 0 || info == 0)
- goto fail;
+ goto fail;
*pis_image = *pis;
pis_image->client_data = info;
pis_image->get_cmap_procs = plane_get_cmap_procs;
code = dev_proc(edev->plane_dev, begin_typed_image)
- (edev->plane_dev, pis_image, pmat, pic, prect,
- &dcolor, pcpath, memory, &info->info);
+ (edev->plane_dev, pis_image, pmat, pic, prect,
+ &dcolor, pcpath, memory, &info->info);
if (code < 0)
- goto fail;
+ goto fail;
*((gx_image_enum_common_t *)info) = *info->info;
info->procs = &plane_image_enum_procs;
info->dev = (gx_device *)edev;
@@ -991,13 +991,13 @@ fail:
gs_free_object(memory, pis_image, "plane_image_begin_typed(pis_image)");
gs_free_object(memory, info, "plane_image_begin_typed(info)");
return gx_default_begin_typed_image(dev, pis, pmat, pic, prect,
- pdcolor, pcpath, memory, pinfo);
+ pdcolor, pcpath, memory, pinfo);
}
static int
plane_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
plane_image_enum_t * const ppie = (plane_image_enum_t *)info;
@@ -1011,7 +1011,7 @@ plane_image_end_image(gx_image_enum_common_t * info, bool draw_last)
int code = gx_image_end(ppie->info, draw_last);
gs_free_object(ppie->memory, ppie->pis_image,
- "plane_image_end_image(pis_image)");
+ "plane_image_end_image(pis_image)");
gx_image_free_enum(&info);
return code;
}
@@ -1020,7 +1020,7 @@ plane_image_end_image(gx_image_enum_common_t * info, bool draw_last)
static int
plane_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_plane_extract * const edev = (gx_device_plane_extract *)dev;
gx_device * const plane_dev = edev->plane_dev;
@@ -1037,69 +1037,69 @@ plane_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
* arbitrary (but might as well be zero).
*/
if ((options & GB_PACKING_PLANAR) && (options & GB_SELECT_PLANES)) {
- if (params->data[plane_index] == 0)
- return gx_default_get_bits_rectangle(dev, prect, params, unread);
- /* If the caller wants any other plane(s), punt. */
- for (plane = 0; plane < dev->color_info.num_components; ++plane)
- if (plane != plane_index && params->data[plane] != 0)
- return gx_default_get_bits_rectangle(dev, prect, params, unread);
- /* Pass the request on to the plane device. */
- plane_params = *params;
- plane_params.options =
- (options & ~(GB_PACKING_ALL | GB_SELECT_PLANES)) |
- GB_PACKING_CHUNKY;
- plane_params.data[0] = params->data[plane_index];
- code = dev_proc(plane_dev, get_bits_rectangle)
- (plane_dev, prect, &plane_params, unread);
- if (code >= 0) {
- *params = plane_params;
- params->options = (params->options & ~GB_PACKING_ALL) |
- (GB_PACKING_PLANAR | GB_SELECT_PLANES);
- params->data[plane_index] = params->data[0];
- for (plane = 0; plane < dev->color_info.num_components; ++plane)
- if (plane != plane_index)
- params->data[plane] = 0;
- }
+ if (params->data[plane_index] == 0)
+ return gx_default_get_bits_rectangle(dev, prect, params, unread);
+ /* If the caller wants any other plane(s), punt. */
+ for (plane = 0; plane < dev->color_info.num_components; ++plane)
+ if (plane != plane_index && params->data[plane] != 0)
+ return gx_default_get_bits_rectangle(dev, prect, params, unread);
+ /* Pass the request on to the plane device. */
+ plane_params = *params;
+ plane_params.options =
+ (options & ~(GB_PACKING_ALL | GB_SELECT_PLANES)) |
+ GB_PACKING_CHUNKY;
+ plane_params.data[0] = params->data[plane_index];
+ code = dev_proc(plane_dev, get_bits_rectangle)
+ (plane_dev, prect, &plane_params, unread);
+ if (code >= 0) {
+ *params = plane_params;
+ params->options = (params->options & ~GB_PACKING_ALL) |
+ (GB_PACKING_PLANAR | GB_SELECT_PLANES);
+ params->data[plane_index] = params->data[0];
+ for (plane = 0; plane < dev->color_info.num_components; ++plane)
+ if (plane != plane_index)
+ params->data[plane] = 0;
+ }
} else if (!(~options & (GB_COLORS_NATIVE | GB_ALPHA_NONE |
- GB_PACKING_CHUNKY | GB_RETURN_COPY |
- GB_ALIGN_STANDARD | GB_OFFSET_0 |
- GB_RASTER_STANDARD))) {
- /* Expand the plane into chunky pixels. */
- bits_plane_t dest, source;
-
- dest.data.write = params->data[0];
- dest.raster =
- bitmap_raster((prect->q.x - prect->p.x) * dev->color_info.depth);
- dest.depth = edev->color_info.depth;
- dest.x = 0;
-
- /* not source.data, source.raster, source.x */
- source.depth = plane_dev->color_info.depth;
-
- plane_params = *params;
- plane_params.options = options &=
- (~(GB_COLORS_ALL | GB_ALPHA_ALL | GB_PACKING_ALL |
- GB_RETURN_ALL | GB_ALIGN_ALL | GB_OFFSET_ALL | GB_RASTER_ALL) |
- GB_COLORS_NATIVE | GB_ALPHA_NONE | GB_PACKING_CHUNKY |
- /* Try for a pointer return the first time. */
- GB_RETURN_POINTER |
- GB_ALIGN_STANDARD |
- (GB_OFFSET_0 | GB_OFFSET_ANY) |
- (GB_RASTER_STANDARD | GB_RASTER_ANY));
- plane_params.raster = gx_device_raster(plane_dev, true);
- code = dev_proc(plane_dev, get_bits_rectangle)
- (plane_dev, prect, &plane_params, unread);
- if (code >= 0) {
- /* Success, expand the plane into pixels. */
- source.data.read = plane_params.data[0];
- source.raster = plane_params.raster;
- source.x = params->x_offset;
- code = bits_expand_plane(&dest, &source, edev->plane.shift,
- prect->q.x - prect->p.x,
- prect->q.y - prect->p.y);
- }
- params->options = (options & ~GB_RETURN_POINTER) | GB_RETURN_COPY;
+ GB_PACKING_CHUNKY | GB_RETURN_COPY |
+ GB_ALIGN_STANDARD | GB_OFFSET_0 |
+ GB_RASTER_STANDARD))) {
+ /* Expand the plane into chunky pixels. */
+ bits_plane_t dest, source;
+
+ dest.data.write = params->data[0];
+ dest.raster =
+ bitmap_raster((prect->q.x - prect->p.x) * dev->color_info.depth);
+ dest.depth = edev->color_info.depth;
+ dest.x = 0;
+
+ /* not source.data, source.raster, source.x */
+ source.depth = plane_dev->color_info.depth;
+
+ plane_params = *params;
+ plane_params.options = options &=
+ (~(GB_COLORS_ALL | GB_ALPHA_ALL | GB_PACKING_ALL |
+ GB_RETURN_ALL | GB_ALIGN_ALL | GB_OFFSET_ALL | GB_RASTER_ALL) |
+ GB_COLORS_NATIVE | GB_ALPHA_NONE | GB_PACKING_CHUNKY |
+ /* Try for a pointer return the first time. */
+ GB_RETURN_POINTER |
+ GB_ALIGN_STANDARD |
+ (GB_OFFSET_0 | GB_OFFSET_ANY) |
+ (GB_RASTER_STANDARD | GB_RASTER_ANY));
+ plane_params.raster = gx_device_raster(plane_dev, true);
+ code = dev_proc(plane_dev, get_bits_rectangle)
+ (plane_dev, prect, &plane_params, unread);
+ if (code >= 0) {
+ /* Success, expand the plane into pixels. */
+ source.data.read = plane_params.data[0];
+ source.raster = plane_params.raster;
+ source.x = params->x_offset;
+ code = bits_expand_plane(&dest, &source, edev->plane.shift,
+ prect->q.x - prect->p.x,
+ prect->q.y - prect->p.y);
+ }
+ params->options = (options & ~GB_RETURN_POINTER) | GB_RETURN_COPY;
} else
- return gx_default_get_bits_rectangle(dev, prect, params, unread);
+ return gx_default_get_bits_rectangle(dev, prect, params, unread);
return code;
}
diff --git a/gs/base/gdevplnx.h b/gs/base/gdevplnx.h
index b897c5150..303d966e5 100644
--- a/gs/base/gdevplnx.h
+++ b/gs/base/gdevplnx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,14 +45,14 @@
typedef struct gx_device_plane_extract_s {
gx_device_forward_common;
- /* The following are set by the client before opening the device. */
+ /* The following are set by the client before opening the device. */
gx_device *plane_dev; /* the drawing device for the plane */
gx_render_plane_t plane;
- /* The following are set by open_device. */
+ /* The following are set by open_device. */
gx_color_index plane_white;
uint plane_mask;
bool plane_dev_is_memory;
- /* The following change dynamically. */
+ /* The following change dynamically. */
bool any_marks;
} gx_device_plane_extract;
extern_st(st_device_plane_extract);
@@ -63,7 +63,7 @@ extern_st(st_device_plane_extract);
/* Initialize a plane extraction device. */
int plane_device_init(gx_device_plane_extract *edev, gx_device *target,
- gx_device *plane_dev,
- const gx_render_plane_t *render_plane, bool clear);
+ gx_device *plane_dev,
+ const gx_render_plane_t *render_plane, bool clear);
#endif /* gdevplnx_INCLUDED */
diff --git a/gs/base/gdevpm.h b/gs/base/gdevpm.h
index 63ac3d687..8c05746d0 100644
--- a/gs/base/gdevpm.h
+++ b/gs/base/gdevpm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpng.c b/gs/base/gdevpng.c
index ff310da40..91e53e0ab 100644
--- a/gs/base/gdevpng.c
+++ b/gs/base/gdevpng.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -75,22 +75,22 @@ static dev_proc_create_buf_device(pngalpha_create_buf_device);
const gx_device_printer gs_pngmono_device =
prn_device(prn_std_procs, "pngmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, png_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, png_print_page);
/* 4-bit planar (EGA/VGA-style) color. */
static const gx_device_procs png16_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
+ pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
const gx_device_printer gs_png16_device = {
prn_device_body(gx_device_printer, png16_procs, "png16",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 4, 1, 1, 2, 2, png_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 4, 1, 1, 2, 2, png_print_page)
};
/* 8-bit (SuperVGA-style) color. */
@@ -98,56 +98,55 @@ const gx_device_printer gs_png16_device = {
static const gx_device_procs png256_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
+ pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
const gx_device_printer gs_png256_device = {
prn_device_body(gx_device_printer, png256_procs, "png256",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 8, 5, 5, 6, 6, png_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 8, 5, 5, 6, 6, png_print_page)
};
/* 8-bit gray */
static const gx_device_procs pnggray_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
const gx_device_printer gs_pnggray_device =
{prn_device_body(gx_device_printer, pnggray_procs, "pnggray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, 8, 255, 0, 256, 0, png_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, 8, 255, 0, 256, 0, png_print_page)
};
/* 24-bit color. */
static const gx_device_procs png16m_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
const gx_device_printer gs_png16m_device =
prn_device(png16m_procs, "png16m",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 24, png_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 24, png_print_page);
/* 48 bit color. */
static const gx_device_procs png48_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
const gx_device_printer gs_png48_device =
prn_device(png48_procs, "png48",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 48, png_print_page);
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 48, png_print_page);
/* 32-bit RGBA */
/* pngalpha device is 32-bit RGBA, with the alpha channel
- * indicating pixel coverage, not true transparency.
+ * indicating pixel coverage, not true transparency.
* Anti-aliasing is enabled by default.
* An erasepage will erase to transparent, not white.
* It is intended to be used for creating web graphics with
@@ -162,95 +161,94 @@ struct gx_device_pngalpha_s {
};
static const gx_device_procs pngalpha_procs =
{
- pngalpha_open,
- NULL, /* get_initial_matrix */
- NULL, /* sync_output */
- gdev_prn_output_page,
- gdev_prn_close,
- pngalpha_encode_color, /* map_rgb_color */
- pngalpha_decode_color, /* map_color_rgb */
- pngalpha_fill_rectangle,
- NULL, /* tile_rectangle */
- NULL, /* copy_mono */
- NULL, /* copy_color */
- NULL, /* draw_line */
- NULL, /* get_bits */
- pngalpha_get_params,
- pngalpha_put_params,
- NULL, /* map_cmyk_color */
- NULL, /* get_xfont_procs */
- NULL, /* get_xfont_device */
- NULL, /* map_rgb_alpha_color */
- gx_page_device_get_page_device,
- NULL, /* get_alpha_bits */
- pngalpha_copy_alpha,
- NULL, /* get_band */
- NULL, /* copy_rop */
- NULL, /* fill_path */
- NULL, /* stroke_path */
- NULL, /* fill_mask */
- NULL, /* fill_trapezoid */
- NULL, /* fill_parallelogram */
- NULL, /* fill_triangle */
- NULL, /* draw_thin_line */
- NULL, /* begin_image */
- NULL, /* image_data */
- NULL, /* end_image */
- NULL, /* strip_tile_rectangle */
- NULL, /* strip_copy_rop, */
- NULL, /* get_clipping_box */
- NULL, /* begin_typed_image */
- NULL, /* get_bits_rectangle */
- NULL, /* map_color_rgb_alpha */
- NULL, /* create_compositor */
- NULL, /* get_hardware_params */
- NULL, /* text_begin */
- NULL, /* finish_copydevice */
- NULL, /* begin_transparency_group */
- NULL, /* end_transparency_group */
- NULL, /* begin_transparency_mask */
- NULL, /* end_transparency_mask */
- NULL, /* discard_transparency_layer */
- gx_default_DevRGB_get_color_mapping_procs,
- gx_default_DevRGB_get_color_comp_index,
- pngalpha_encode_color,
- pngalpha_decode_color
+ pngalpha_open,
+ NULL, /* get_initial_matrix */
+ NULL, /* sync_output */
+ gdev_prn_output_page,
+ gdev_prn_close,
+ pngalpha_encode_color, /* map_rgb_color */
+ pngalpha_decode_color, /* map_color_rgb */
+ pngalpha_fill_rectangle,
+ NULL, /* tile_rectangle */
+ NULL, /* copy_mono */
+ NULL, /* copy_color */
+ NULL, /* draw_line */
+ NULL, /* get_bits */
+ pngalpha_get_params,
+ pngalpha_put_params,
+ NULL, /* map_cmyk_color */
+ NULL, /* get_xfont_procs */
+ NULL, /* get_xfont_device */
+ NULL, /* map_rgb_alpha_color */
+ gx_page_device_get_page_device,
+ NULL, /* get_alpha_bits */
+ pngalpha_copy_alpha,
+ NULL, /* get_band */
+ NULL, /* copy_rop */
+ NULL, /* fill_path */
+ NULL, /* stroke_path */
+ NULL, /* fill_mask */
+ NULL, /* fill_trapezoid */
+ NULL, /* fill_parallelogram */
+ NULL, /* fill_triangle */
+ NULL, /* draw_thin_line */
+ NULL, /* begin_image */
+ NULL, /* image_data */
+ NULL, /* end_image */
+ NULL, /* strip_tile_rectangle */
+ NULL, /* strip_copy_rop, */
+ NULL, /* get_clipping_box */
+ NULL, /* begin_typed_image */
+ NULL, /* get_bits_rectangle */
+ NULL, /* map_color_rgb_alpha */
+ NULL, /* create_compositor */
+ NULL, /* get_hardware_params */
+ NULL, /* text_begin */
+ NULL, /* finish_copydevice */
+ NULL, /* begin_transparency_group */
+ NULL, /* end_transparency_group */
+ NULL, /* begin_transparency_mask */
+ NULL, /* end_transparency_mask */
+ NULL, /* discard_transparency_layer */
+ gx_default_DevRGB_get_color_mapping_procs,
+ gx_default_DevRGB_get_color_comp_index,
+ pngalpha_encode_color,
+ pngalpha_decode_color
};
const gx_device_pngalpha gs_pngalpha_device = {
- std_device_part1_(gx_device_pngalpha, &pngalpha_procs, "pngalpha",
- &st_device_printer, open_init_closed),
- /* color_info */
- {3 /* max components */,
- 3 /* number components */,
- GX_CINFO_POLARITY_ADDITIVE /* polarity */,
- 32 /* depth */,
- -1 /* gray index */,
- 255 /* max gray */,
- 255 /* max color */,
- 256 /* dither grays */,
- 256 /* dither colors */,
- { 4, 4 } /* antialias info text, graphics */,
- GX_CINFO_SEP_LIN_NONE /* separable_and_linear */,
- { 0 } /* component shift */,
- { 0 } /* component bits */,
- { 0 } /* component mask */,
- "DeviceRGB" /* process color name */,
- GX_CINFO_OPMODE_UNKNOWN /* opmode */,
- 0 /* process_cmps */
- },
- std_device_part2_(
- (int)((float)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10 + 0.5),
- (int)((float)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10 + 0.5),
- X_DPI, Y_DPI),
- offset_margin_values(0, 0, 0, 0, 0, 0),
- std_device_part3_(),
- prn_device_body_rest_(png_print_page),
- NULL,
- 0xffffff /* white background */
+ std_device_part1_(gx_device_pngalpha, &pngalpha_procs, "pngalpha",
+ &st_device_printer, open_init_closed),
+ /* color_info */
+ {3 /* max components */,
+ 3 /* number components */,
+ GX_CINFO_POLARITY_ADDITIVE /* polarity */,
+ 32 /* depth */,
+ -1 /* gray index */,
+ 255 /* max gray */,
+ 255 /* max color */,
+ 256 /* dither grays */,
+ 256 /* dither colors */,
+ { 4, 4 } /* antialias info text, graphics */,
+ GX_CINFO_SEP_LIN_NONE /* separable_and_linear */,
+ { 0 } /* component shift */,
+ { 0 } /* component bits */,
+ { 0 } /* component mask */,
+ "DeviceRGB" /* process color name */,
+ GX_CINFO_OPMODE_UNKNOWN /* opmode */,
+ 0 /* process_cmps */
+ },
+ std_device_part2_(
+ (int)((float)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10 + 0.5),
+ (int)((float)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10 + 0.5),
+ X_DPI, Y_DPI),
+ offset_margin_values(0, 0, 0, 0, 0, 0),
+ std_device_part3_(),
+ prn_device_body_rest_(png_print_page),
+ NULL,
+ 0xffffff /* white background */
};
-
/* ------ Private definitions ------ */
/* Write out a page in PNG format. */
@@ -276,14 +274,14 @@ png_print_page(gx_device_printer * pdev, FILE * file)
png_text text_png;
if (row == 0 || png_ptr == 0 || info_ptr == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
/* set error handling */
if (setjmp(png_ptr->jmpbuf)) {
- /* If we get here, we had a problem reading the file */
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ /* If we get here, we had a problem reading the file */
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
code = 0; /* for normal path */
/* set up the output control */
@@ -294,83 +292,83 @@ png_print_page(gx_device_printer * pdev, FILE * file)
info_ptr->height = pdev->height;
/* resolution is in pixels per meter vs. dpi */
info_ptr->x_pixels_per_unit =
- (png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54));
+ (png_uint_32) (pdev->HWResolution[0] * (100.0 / 2.54));
info_ptr->y_pixels_per_unit =
- (png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54));
+ (png_uint_32) (pdev->HWResolution[1] * (100.0 / 2.54));
info_ptr->phys_unit_type = PNG_RESOLUTION_METER;
info_ptr->valid |= PNG_INFO_pHYs;
switch (depth) {
- case 32:
- info_ptr->bit_depth = 8;
- info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
- png_set_invert_alpha(png_ptr);
- { gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
- png_color_16 background;
- background.index = 0;
- background.red = (ppdev->background >> 16) & 0xff;
- background.green = (ppdev->background >> 8) & 0xff;
- background.blue = (ppdev->background) & 0xff;
- background.gray = 0;
- png_set_bKGD(png_ptr, info_ptr, &background);
- }
- break;
- case 48:
- info_ptr->bit_depth = 16;
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
-#if defined(ARCH_IS_BIG_ENDIAN) && (!ARCH_IS_BIG_ENDIAN)
- png_set_swap(png_ptr);
+ case 32:
+ info_ptr->bit_depth = 8;
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
+ png_set_invert_alpha(png_ptr);
+ { gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
+ png_color_16 background;
+ background.index = 0;
+ background.red = (ppdev->background >> 16) & 0xff;
+ background.green = (ppdev->background >> 8) & 0xff;
+ background.blue = (ppdev->background) & 0xff;
+ background.gray = 0;
+ png_set_bKGD(png_ptr, info_ptr, &background);
+ }
+ break;
+ case 48:
+ info_ptr->bit_depth = 16;
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+#if defined(ARCH_IS_BIG_ENDIAN) && (!ARCH_IS_BIG_ENDIAN)
+ png_set_swap(png_ptr);
#endif
- break;
- case 24:
- info_ptr->bit_depth = 8;
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
- break;
- case 8:
- info_ptr->bit_depth = 8;
- if (gx_device_has_color(pdev))
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
- else
- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
- break;
- case 4:
- info_ptr->bit_depth = 4;
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
- break;
- case 1:
- info_ptr->bit_depth = 1;
- info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
- /* invert monocrome pixels */
- png_set_invert_mono(png_ptr);
- break;
+ break;
+ case 24:
+ info_ptr->bit_depth = 8;
+ info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+ break;
+ case 8:
+ info_ptr->bit_depth = 8;
+ if (gx_device_has_color(pdev))
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+ else
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
+ break;
+ case 4:
+ info_ptr->bit_depth = 4;
+ info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
+ break;
+ case 1:
+ info_ptr->bit_depth = 1;
+ info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
+ /* invert monocrome pixels */
+ png_set_invert_mono(png_ptr);
+ break;
}
/* set the palette if there is one */
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) {
- int i;
- int num_colors = 1 << depth;
- gx_color_value rgb[3];
-
- info_ptr->palette =
- (void *)gs_alloc_bytes(mem, 256 * sizeof(png_color),
- "png palette");
- if (info_ptr->palette == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
- }
- info_ptr->num_palette = num_colors;
- info_ptr->valid |= PNG_INFO_PLTE;
- for (i = 0; i < num_colors; i++) {
- (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
- (gx_color_index) i, rgb);
- info_ptr->palette[i].red = gx_color_value_to_byte(rgb[0]);
- info_ptr->palette[i].green = gx_color_value_to_byte(rgb[1]);
- info_ptr->palette[i].blue = gx_color_value_to_byte(rgb[2]);
- }
+ int i;
+ int num_colors = 1 << depth;
+ gx_color_value rgb[3];
+
+ info_ptr->palette =
+ (void *)gs_alloc_bytes(mem, 256 * sizeof(png_color),
+ "png palette");
+ if (info_ptr->palette == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
+ }
+ info_ptr->num_palette = num_colors;
+ info_ptr->valid |= PNG_INFO_PLTE;
+ for (i = 0; i < num_colors; i++) {
+ (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
+ (gx_color_index) i, rgb);
+ info_ptr->palette[i].red = gx_color_value_to_byte(rgb[0]);
+ info_ptr->palette[i].green = gx_color_value_to_byte(rgb[1]);
+ info_ptr->palette[i].blue = gx_color_value_to_byte(rgb[2]);
+ }
}
/* add comment */
strncpy(software_key, "Software", sizeof(software_key));
sprintf(software_text, "%s %d.%02d", gs_product,
- (int)(gs_revision / 100), (int)(gs_revision % 100));
+ (int)(gs_revision / 100), (int)(gs_revision % 100));
text_png.compression = -1; /* uncompressed */
text_png.key = software_key;
text_png.text = software_text;
@@ -387,8 +385,8 @@ png_print_page(gx_device_printer * pdev, FILE * file)
/* Write the contents of the image. */
for (y = 0; y < height; y++) {
- gdev_prn_copy_scan_lines(pdev, y, row, raster);
- png_write_rows(png_ptr, &row, 1);
+ gdev_prn_copy_scan_lines(pdev, y, row, raster);
+ png_write_rows(png_ptr, &row, 1);
}
/* write the rest of the file */
@@ -418,7 +416,7 @@ png_print_page(gx_device_printer * pdev, FILE * file)
# endif
void
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer,
- PPFB_LENGTH_T length)
+ PPFB_LENGTH_T length)
{
}
#endif
@@ -428,32 +426,32 @@ pngalpha_open(gx_device * pdev)
{
gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
int code;
- /* We replace create_buf_device so we can replace copy_alpha
+ /* We replace create_buf_device so we can replace copy_alpha
* for memory device, but not clist.
*/
- ppdev->printer_procs.buf_procs.create_buf_device =
- pngalpha_create_buf_device;
+ ppdev->printer_procs.buf_procs.create_buf_device =
+ pngalpha_create_buf_device;
code = gdev_prn_open(pdev);
/* We intercept fill_rectangle to translate "fill page with white"
* into "fill page with transparent". We then call the original
* implementation of fill_page.
*/
if ((ppdev->procs.fill_rectangle != pngalpha_fill_rectangle) &&
- (ppdev->procs.fill_rectangle != NULL)) {
- ppdev->orig_fill_rectangle = ppdev->procs.fill_rectangle;
+ (ppdev->procs.fill_rectangle != NULL)) {
+ ppdev->orig_fill_rectangle = ppdev->procs.fill_rectangle;
ppdev->procs.fill_rectangle = pngalpha_fill_rectangle;
}
return code;
}
-static int
+static int
pngalpha_create_buf_device(gx_device **pbdev, gx_device *target, int y,
const gx_render_plane_t *render_plane, gs_memory_t *mem,
gx_band_complexity_t *band_complexity)
{
gx_device_printer *ptarget = (gx_device_printer *)target;
- int code = gx_default_create_buf_device(pbdev, target, y,
- render_plane, mem, band_complexity);
+ int code = gx_default_create_buf_device(pbdev, target, y,
+ render_plane, mem, band_complexity);
/* Now set copy_alpha to one that handles RGBA */
set_dev_proc(*pbdev, copy_alpha, ptarget->orig_procs.copy_alpha);
return code;
@@ -468,28 +466,28 @@ pngalpha_put_params(gx_device * pdev, gs_param_list * plist)
/* BackgroundColor in format 16#RRGGBB is used for bKGD chunk */
switch(code = param_read_int(plist, "BackgroundColor", &background)) {
- case 0:
- ppdev->background = background & 0xffffff;
- break;
- case 1: /* not found */
- code = 0;
- break;
- default:
- param_signal_error(plist, "BackgroundColor", code);
- break;
+ case 0:
+ ppdev->background = background & 0xffffff;
+ break;
+ case 1: /* not found */
+ code = 0;
+ break;
+ default:
+ param_signal_error(plist, "BackgroundColor", code);
+ break;
}
if (code == 0) {
- code = gdev_prn_put_params(pdev, plist);
- if ((ppdev->procs.fill_rectangle != pngalpha_fill_rectangle) &&
- (ppdev->procs.fill_rectangle != NULL)) {
- /* Get current implementation of fill_rectangle and restore ours.
- * Implementation is either clist or memory and can change
- * during put_params.
- */
- ppdev->orig_fill_rectangle = ppdev->procs.fill_rectangle;
- ppdev->procs.fill_rectangle = pngalpha_fill_rectangle;
- }
+ code = gdev_prn_put_params(pdev, plist);
+ if ((ppdev->procs.fill_rectangle != pngalpha_fill_rectangle) &&
+ (ppdev->procs.fill_rectangle != NULL)) {
+ /* Get current implementation of fill_rectangle and restore ours.
+ * Implementation is either clist or memory and can change
+ * during put_params.
+ */
+ ppdev->orig_fill_rectangle = ppdev->procs.fill_rectangle;
+ ppdev->procs.fill_rectangle = pngalpha_fill_rectangle;
+ }
}
return code;
}
@@ -501,33 +499,32 @@ pngalpha_get_params(gx_device * pdev, gs_param_list * plist)
gx_device_pngalpha *ppdev = (gx_device_pngalpha *)pdev;
int code = gdev_prn_get_params(pdev, plist);
if (code >= 0)
- code = param_write_int(plist, "BackgroundColor",
- &(ppdev->background));
+ code = param_write_int(plist, "BackgroundColor",
+ &(ppdev->background));
return code;
}
-
/* RGB mapping for 32-bit RGBA color devices */
static gx_color_index
pngalpha_encode_color(gx_device * dev, const gx_color_value cv[])
{
- /* bits 0-7 are alpha, stored inverted to avoid white/opaque
+ /* bits 0-7 are alpha, stored inverted to avoid white/opaque
* being 0xffffffff which is also gx_no_color_index.
* So 0xff is transparent and 0x00 is opaque.
* We always return opaque colors (bits 0-7 = 0).
* Return value is 0xRRGGBB00.
*/
return
- ((uint) gx_color_value_to_byte(cv[2]) << 8) +
- ((ulong) gx_color_value_to_byte(cv[1]) << 16) +
- ((ulong) gx_color_value_to_byte(cv[0]) << 24);
+ ((uint) gx_color_value_to_byte(cv[2]) << 8) +
+ ((ulong) gx_color_value_to_byte(cv[1]) << 16) +
+ ((ulong) gx_color_value_to_byte(cv[0]) << 24);
}
/* Map a color index to a r-g-b color. */
static int
pngalpha_decode_color(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
prgb[0] = gx_color_value_from_byte((color >> 24) & 0xff);
prgb[1] = gx_color_value_from_byte((color >> 16) & 0xff);
@@ -537,12 +534,12 @@ pngalpha_decode_color(gx_device * dev, gx_color_index color,
static int
pngalpha_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_pngalpha *pdev = (gx_device_pngalpha *)dev;
- if ((color == 0xffffff00) && (x==0) && (y==0)
- && (w==dev->width) && (h==dev->height)) {
- /* If filling whole page with white, make it transparent */
+ if ((color == 0xffffff00) && (x==0) && (y==0)
+ && (w==dev->width) && (h==dev->height)) {
+ /* If filling whole page with white, make it transparent */
return pdev->orig_fill_rectangle(dev, x, y, w, h, 0xffffffff);
}
return pdev->orig_fill_rectangle(dev, x, y, w, h, color);
@@ -552,106 +549,105 @@ pngalpha_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Derived from gx_default_copy_alpha, but now maintains alpha channel. */
static int
pngalpha_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{ /* This might be called with depth = 1.... */
if (depth == 1)
- return (*dev_proc(dev, copy_mono)) (dev, data, data_x, raster, id,
- x, y, width, height,
- gx_no_color_index, color);
+ return (*dev_proc(dev, copy_mono)) (dev, data, data_x, raster, id,
+ x, y, width, height,
+ gx_no_color_index, color);
/*
* Simulate alpha by weighted averaging of RGB values.
* This is very slow, but functionally correct.
*/
{
- const byte *row;
- gs_memory_t *mem = dev->memory;
- int bpp = dev->color_info.depth;
- int ncomps = dev->color_info.num_components;
- uint in_size = gx_device_raster(dev, false);
- byte *lin;
- uint out_size;
- byte *lout;
- int code = 0;
- gx_color_value color_cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int ry;
-
- fit_copy(dev, data, data_x, raster, id, x, y, width, height);
- row = data;
- out_size = bitmap_raster(width * bpp);
- lin = gs_alloc_bytes(mem, in_size, "copy_alpha(lin)");
- lout = gs_alloc_bytes(mem, out_size, "copy_alpha(lout)");
- if (lin == 0 || lout == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
- }
- (*dev_proc(dev, decode_color)) (dev, color, color_cv);
- for (ry = y; ry < y + height; row += raster, ++ry) {
- byte *line;
- int sx, rx;
-
- DECLARE_LINE_ACCUM_COPY(lout, bpp, x);
-
- code = (*dev_proc(dev, get_bits)) (dev, ry, lin, &line);
- if (code < 0)
- break;
- for (sx = data_x, rx = x; sx < data_x + width; ++sx, ++rx) {
- gx_color_index previous = gx_no_color_index;
- gx_color_index composite;
- int alpha2, alpha;
-
- if (depth == 2) /* map 0 - 3 to 0 - 15 */
- alpha = ((row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
- else
- alpha2 = row[sx >> 1],
- alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
- if (alpha == 15) { /* Just write the new color. */
- composite = color;
- } else {
- if (previous == gx_no_color_index) { /* Extract the old color. */
- const byte *src = line + (rx * (bpp >> 3));
- previous = 0;
- previous += (gx_color_index) * src++ << 24;
- previous += (gx_color_index) * src++ << 16;
- previous += (gx_color_index) * src++ << 8;
- previous += *src++;
- }
- if (alpha == 0) { /* Just write the old color. */
- composite = previous;
- } else { /* Blend values. */
- gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int i;
- int old_coverage;
- int new_coverage;
-
- (*dev_proc(dev, decode_color)) (dev, previous, cv);
- /* decode color doesn't give us coverage */
- cv[3] = previous & 0xff;
- old_coverage = 255 - cv[3];
- new_coverage =
- (255 * alpha + old_coverage * (15 - alpha)) / 15;
- for (i=0; i<ncomps; i++)
- cv[i] = min(((255 * alpha * color_cv[i]) +
- (old_coverage * (15 - alpha ) * cv[i]))
- / (new_coverage * 15), gx_max_color_value);
- composite =
- (*dev_proc(dev, encode_color)) (dev, cv);
- /* encode color doesn't include coverage */
- composite |= (255 - new_coverage) & 0xff;
-
- /* composite can never be gx_no_color_index
- * because pixel is never completely transparent
- * (low byte != 0xff).
- */
- }
- }
- LINE_ACCUM(composite, bpp);
- }
- LINE_ACCUM_COPY(dev, lout, bpp, x, rx, raster, ry);
- }
+ const byte *row;
+ gs_memory_t *mem = dev->memory;
+ int bpp = dev->color_info.depth;
+ int ncomps = dev->color_info.num_components;
+ uint in_size = gx_device_raster(dev, false);
+ byte *lin;
+ uint out_size;
+ byte *lout;
+ int code = 0;
+ gx_color_value color_cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int ry;
+
+ fit_copy(dev, data, data_x, raster, id, x, y, width, height);
+ row = data;
+ out_size = bitmap_raster(width * bpp);
+ lin = gs_alloc_bytes(mem, in_size, "copy_alpha(lin)");
+ lout = gs_alloc_bytes(mem, out_size, "copy_alpha(lout)");
+ if (lin == 0 || lout == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
+ }
+ (*dev_proc(dev, decode_color)) (dev, color, color_cv);
+ for (ry = y; ry < y + height; row += raster, ++ry) {
+ byte *line;
+ int sx, rx;
+
+ DECLARE_LINE_ACCUM_COPY(lout, bpp, x);
+
+ code = (*dev_proc(dev, get_bits)) (dev, ry, lin, &line);
+ if (code < 0)
+ break;
+ for (sx = data_x, rx = x; sx < data_x + width; ++sx, ++rx) {
+ gx_color_index previous = gx_no_color_index;
+ gx_color_index composite;
+ int alpha2, alpha;
+
+ if (depth == 2) /* map 0 - 3 to 0 - 15 */
+ alpha = ((row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
+ else
+ alpha2 = row[sx >> 1],
+ alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
+ if (alpha == 15) { /* Just write the new color. */
+ composite = color;
+ } else {
+ if (previous == gx_no_color_index) { /* Extract the old color. */
+ const byte *src = line + (rx * (bpp >> 3));
+ previous = 0;
+ previous += (gx_color_index) * src++ << 24;
+ previous += (gx_color_index) * src++ << 16;
+ previous += (gx_color_index) * src++ << 8;
+ previous += *src++;
+ }
+ if (alpha == 0) { /* Just write the old color. */
+ composite = previous;
+ } else { /* Blend values. */
+ gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int i;
+ int old_coverage;
+ int new_coverage;
+
+ (*dev_proc(dev, decode_color)) (dev, previous, cv);
+ /* decode color doesn't give us coverage */
+ cv[3] = previous & 0xff;
+ old_coverage = 255 - cv[3];
+ new_coverage =
+ (255 * alpha + old_coverage * (15 - alpha)) / 15;
+ for (i=0; i<ncomps; i++)
+ cv[i] = min(((255 * alpha * color_cv[i]) +
+ (old_coverage * (15 - alpha ) * cv[i]))
+ / (new_coverage * 15), gx_max_color_value);
+ composite =
+ (*dev_proc(dev, encode_color)) (dev, cv);
+ /* encode color doesn't include coverage */
+ composite |= (255 - new_coverage) & 0xff;
+
+ /* composite can never be gx_no_color_index
+ * because pixel is never completely transparent
+ * (low byte != 0xff).
+ */
+ }
+ }
+ LINE_ACCUM(composite, bpp);
+ }
+ LINE_ACCUM_COPY(dev, lout, bpp, x, rx, raster, ry);
+ }
out:gs_free_object(mem, lout, "copy_alpha(lout)");
- gs_free_object(mem, lin, "copy_alpha(lin)");
- return code;
+ gs_free_object(mem, lin, "copy_alpha(lin)");
+ return code;
}
}
-
diff --git a/gs/base/gdevppla.c b/gs/base/gdevppla.c
index dcffbf84a..2fd552f8d 100644
--- a/gs/base/gdevppla.c
+++ b/gs/base/gdevppla.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,7 +17,6 @@
#include "gdevmpla.h"
#include "gdevppla.h"
-
/* Set the buf_procs in a printer device to planar mode. */
int
gdev_prn_set_procs_planar(gx_device *dev)
@@ -25,9 +24,9 @@ gdev_prn_set_procs_planar(gx_device *dev)
gx_device_printer * const pdev = (gx_device_printer *)dev;
pdev->printer_procs.buf_procs.create_buf_device =
- gdev_prn_create_buf_planar;
+ gdev_prn_create_buf_planar;
pdev->printer_procs.buf_procs.size_buf_device =
- gdev_prn_size_buf_planar;
+ gdev_prn_size_buf_planar;
return 0;
}
@@ -36,35 +35,35 @@ int
gdev_prn_open_planar(gx_device *dev, bool upb)
{
if (upb)
- gdev_prn_set_procs_planar(dev);
+ gdev_prn_set_procs_planar(dev);
return gdev_prn_open(dev);
}
/* Augment get/put_params to add UsePlanarBuffer. */
int
gdev_prn_get_params_planar(gx_device * pdev, gs_param_list * plist,
- bool *pupb)
+ bool *pupb)
{
int ecode = gdev_prn_get_params(pdev, plist);
if (ecode < 0)
- return ecode;
+ return ecode;
return param_write_bool(plist, "UsePlanarBuffer", pupb);
}
int
gdev_prn_put_params_planar(gx_device * pdev, gs_param_list * plist,
- bool *pupb)
+ bool *pupb)
{
bool upb = *pupb;
int ecode = 0, code;
if (pdev->color_info.num_components > 1)
- ecode = param_read_bool(plist, "UsePlanarBuffer", &upb);
+ ecode = param_read_bool(plist, "UsePlanarBuffer", &upb);
code = gdev_prn_put_params(pdev, plist);
if (ecode >= 0)
- ecode = code;
+ ecode = code;
if (ecode >= 0)
- *pupb = upb;
+ *pupb = upb;
return ecode;
}
@@ -77,12 +76,12 @@ gdev_prn_set_planar(gx_device_memory *mdev, const gx_device *tdev)
int depth = tdev->color_info.depth / num_comp;
if (num_comp < 1 || num_comp > 4)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Round up the depth per plane to a power of 2. */
while (depth & (depth - 1))
- --depth, depth = (depth | (depth >> 1)) + 1;
+ --depth, depth = (depth | (depth >> 1)) + 1;
planes[3].depth = planes[2].depth = planes[1].depth = planes[0].depth =
- depth;
+ depth;
/* We want the most significant plane to come out first. */
planes[0].shift = depth * (num_comp - 1);
planes[1].shift = planes[0].shift - depth;
@@ -94,16 +93,16 @@ gdev_prn_set_planar(gx_device_memory *mdev, const gx_device *tdev)
/* Create a planar buffer device. */
int
gdev_prn_create_buf_planar(gx_device **pbdev, gx_device *target, int y,
- const gx_render_plane_t *render_plane,
- gs_memory_t *mem, gx_band_complexity_t *for_band)
+ const gx_render_plane_t *render_plane,
+ gs_memory_t *mem, gx_band_complexity_t *for_band)
{
int code = gx_default_create_buf_device(pbdev, target, y, render_plane, mem,
- for_band);
+ for_band);
if (code < 0)
- return code;
+ return code;
if (gs_device_is_memory(*pbdev) /* == render_plane->index < 0 */) {
- code = gdev_prn_set_planar((gx_device_memory *)*pbdev, *pbdev);
+ code = gdev_prn_set_planar((gx_device_memory *)*pbdev, *pbdev);
}
return code;
}
@@ -111,21 +110,21 @@ gdev_prn_create_buf_planar(gx_device **pbdev, gx_device *target, int y,
/* Determine the space needed by a planar buffer device. */
int
gdev_prn_size_buf_planar(gx_device_buf_space_t *space, gx_device *target,
- const gx_render_plane_t *render_plane,
- int height, bool for_band)
+ const gx_render_plane_t *render_plane,
+ int height, bool for_band)
{
gx_device_memory mdev;
int code;
if (render_plane && render_plane->index >= 0)
- return gx_default_size_buf_device(space, target, render_plane,
- height, for_band);
+ return gx_default_size_buf_device(space, target, render_plane,
+ height, for_band);
mdev.color_info = target->color_info;
code = gdev_prn_set_planar(&mdev, target);
if (code < 0)
return code;
if (gdev_mem_bits_size(&mdev, target->width, height, &(space->bits)) < 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
space->line_ptrs = gdev_mem_line_ptrs_size(&mdev, target->width, height);
space->raster = bitmap_raster(target->width * mdev.planes[0].depth);
return 0;
diff --git a/gs/base/gdevppla.h b/gs/base/gdevppla.h
index 2afd987e8..2db8c43c5 100644
--- a/gs/base/gdevppla.h
+++ b/gs/base/gdevppla.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,21 +26,21 @@ int gdev_prn_open_planar(gx_device *pdev, bool upb);
/* Augment get/put_params to add UsePlanarBuffer. */
int gdev_prn_get_params_planar(gx_device * pdev, gs_param_list * plist,
- bool *pupb);
+ bool *pupb);
int gdev_prn_put_params_planar(gx_device * pdev, gs_param_list * plist,
- bool *pupb);
+ bool *pupb);
/* Create a planar buffer device. */
/* Use this instead of the default if UsePlanarBuffer is true. */
int gdev_prn_create_buf_planar(gx_device **pbdev, gx_device *target, int y,
- const gx_render_plane_t *render_plane,
- gs_memory_t *mem, gx_band_complexity_t *for_band);
+ const gx_render_plane_t *render_plane,
+ gs_memory_t *mem, gx_band_complexity_t *for_band);
/* Determine the space needed by a planar buffer device. */
/* Use this instead of the default if UsePlanarBuffer is true. */
int gdev_prn_size_buf_planar(gx_device_buf_space_t *space,
- gx_device *target,
- const gx_render_plane_t *render_plane,
- int height, bool for_band);
+ gx_device *target,
+ const gx_render_plane_t *render_plane,
+ int height, bool for_band);
#endif /* gdevppla_INCLUDED */
diff --git a/gs/base/gdevprn.c b/gs/base/gdevprn.c
index 3c209b967..d9c09935a 100644
--- a/gs/base/gdevprn.c
+++ b/gs/base/gdevprn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,17 +31,17 @@
static
ENUM_PTRS_WITH(device_printer_enum_ptrs, gx_device_printer *pdev)
if (PRINTER_IS_CLIST(pdev))
- ENUM_PREFIX(st_device_clist, 0);
+ ENUM_PREFIX(st_device_clist, 0);
else
- ENUM_PREFIX(st_device_forward, 0);
+ ENUM_PREFIX(st_device_forward, 0);
ENUM_PTRS_END
static
RELOC_PTRS_WITH(device_printer_reloc_ptrs, gx_device_printer *pdev)
{
if (PRINTER_IS_CLIST(pdev))
- RELOC_PREFIX(st_device_clist);
+ RELOC_PREFIX(st_device_clist);
else
- RELOC_PREFIX(st_device_forward);
+ RELOC_PREFIX(st_device_forward);
} RELOC_PTRS_END
public_st_device_printer();
@@ -52,10 +52,10 @@ const gx_device_procs prn_std_procs =
prn_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close);
/* Forward references */
-int gdev_prn_maybe_realloc_memory(gx_device_printer *pdev,
- gdev_prn_space_params *old_space,
- int old_width, int old_height,
- bool old_page_uses_transparency);
+int gdev_prn_maybe_realloc_memory(gx_device_printer *pdev,
+ gdev_prn_space_params *old_space,
+ int old_width, int old_height,
+ bool old_page_uses_transparency);
extern dev_proc_open_device(pattern_clist_open_device);
@@ -72,9 +72,9 @@ gdev_prn_open(gx_device * pdev)
ppdev->file = NULL;
code = gdev_prn_allocate_memory(pdev, NULL, 0, 0);
if (code < 0)
- return code;
+ return code;
if (ppdev->OpenOutputFile)
- code = gdev_prn_open_printer(pdev, 1);
+ code = gdev_prn_open_printer(pdev, 1);
return code;
}
@@ -88,17 +88,17 @@ gdev_prn_close(gx_device * pdev)
gdev_prn_free_memory(pdev);
if (ppdev->file != NULL) {
- code = gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
- ppdev->file = NULL;
+ code = gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
+ ppdev->file = NULL;
}
return code;
}
static int /* returns 0 ok, else -ve error cde */
gdev_prn_setup_as_command_list(gx_device *pdev, gs_memory_t *buffer_memory,
- byte **the_memory,
- const gdev_prn_space_params *space_params,
- bool bufferSpace_is_exact)
+ byte **the_memory,
+ const gdev_prn_space_params *space_params,
+ bool bufferSpace_is_exact)
{
gx_device_printer * const ppdev = (gx_device_printer *)pdev;
uint space;
@@ -114,24 +114,24 @@ gdev_prn_setup_as_command_list(gx_device *pdev, gs_memory_t *buffer_memory,
BEGIN\
ulong *fp_ = (ulong *)&first_arg - 2;\
for (; fp_ && (fp_[1] & 0xff000000) == 0x08000000; fp_ = (ulong *)*fp_)\
- dprintf2(" fp=0x%lx ip=0x%lx\n", (ulong)fp_, fp_[1]);\
+ dprintf2(" fp=0x%lx ip=0x%lx\n", (ulong)fp_, fp_[1]);\
END
dputs("alloc buffer:\n");
BACKTRACE(pdev);
#endif /*DEBUGGING_HACKS*/
for ( space = space_params->BufferSpace; ; ) {
- base = (reallocate ?
- (byte *)gs_resize_object(buffer_memory, *the_memory, space,
- "cmd list buffer") :
- gs_alloc_bytes(buffer_memory, space,
- "cmd list buffer"));
- if (base != 0)
- break;
- if (bufferSpace_is_exact || (space >>= 1) < PRN_MIN_BUFFER_SPACE)
- break;
+ base = (reallocate ?
+ (byte *)gs_resize_object(buffer_memory, *the_memory, space,
+ "cmd list buffer") :
+ gs_alloc_bytes(buffer_memory, space,
+ "cmd list buffer"));
+ if (base != 0)
+ break;
+ if (bufferSpace_is_exact || (space >>= 1) < PRN_MIN_BUFFER_SPACE)
+ break;
}
if (base == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
*the_memory = base;
/* Try opening the command list, to see if we allocated */
@@ -141,45 +141,45 @@ open_c:
ppdev->buffer_space = space;
clist_init_io_procs(pclist_dev, false);
clist_init_params(pclist_dev, base, space, pdev,
- ppdev->printer_procs.buf_procs,
- space_params->band, ppdev->is_async_renderer,
- (ppdev->bandlist_memory == 0 ? pdev->memory->non_gc_memory:
- ppdev->bandlist_memory),
- ppdev->free_up_bandlist_memory,
- ppdev->clist_disable_mask,
- ppdev->page_uses_transparency);
+ ppdev->printer_procs.buf_procs,
+ space_params->band, ppdev->is_async_renderer,
+ (ppdev->bandlist_memory == 0 ? pdev->memory->non_gc_memory:
+ ppdev->bandlist_memory),
+ ppdev->free_up_bandlist_memory,
+ ppdev->clist_disable_mask,
+ ppdev->page_uses_transparency);
code = (*gs_clist_device_procs.open_device)( (gx_device *)pcldev );
if (code < 0) {
- /* If there wasn't enough room, and we haven't */
- /* already shrunk the buffer, try enlarging it. */
- if ( code == gs_error_rangecheck &&
- space >= space_params->BufferSpace &&
- !bufferSpace_is_exact
- ) {
- space <<= 1;
- if (reallocate) {
- base = gs_resize_object(buffer_memory,
- *the_memory, space,
- "cmd list buf(retry open)");
- if (base != 0)
- *the_memory = base;
- } else {
- gs_free_object(buffer_memory, base,
- "cmd list buf(retry open)");
- *the_memory = base =
- gs_alloc_bytes(buffer_memory, space,
- "cmd list buf(retry open)");
- }
- ppdev->buf = *the_memory;
- if (base != 0)
- goto open_c;
- }
- /* Failure. */
- if (!reallocate) {
- gs_free_object(buffer_memory, base, "cmd list buf");
- ppdev->buffer_space = 0;
- *the_memory = 0;
- }
+ /* If there wasn't enough room, and we haven't */
+ /* already shrunk the buffer, try enlarging it. */
+ if ( code == gs_error_rangecheck &&
+ space >= space_params->BufferSpace &&
+ !bufferSpace_is_exact
+ ) {
+ space <<= 1;
+ if (reallocate) {
+ base = gs_resize_object(buffer_memory,
+ *the_memory, space,
+ "cmd list buf(retry open)");
+ if (base != 0)
+ *the_memory = base;
+ } else {
+ gs_free_object(buffer_memory, base,
+ "cmd list buf(retry open)");
+ *the_memory = base =
+ gs_alloc_bytes(buffer_memory, space,
+ "cmd list buf(retry open)");
+ }
+ ppdev->buf = *the_memory;
+ if (base != 0)
+ goto open_c;
+ }
+ /* Failure. */
+ if (!reallocate) {
+ gs_free_object(buffer_memory, base, "cmd list buf");
+ ppdev->buffer_space = 0;
+ *the_memory = 0;
+ }
}
return code;
}
@@ -194,29 +194,29 @@ gdev_prn_tear_down(gx_device *pdev, byte **the_memory)
bool is_command_list;
if (ppdev->buffer_space != 0) {
- /* Close cmd list device & point to the storage */
- (*gs_clist_device_procs.close_device)( (gx_device *)pcldev );
- *the_memory = ppdev->buf;
- ppdev->buf = 0;
- ppdev->buffer_space = 0;
- is_command_list = true;
-
- /* If the clist is a reader clist, free any band_complexity_array
- * memory used by same.
- */
- if (!CLIST_IS_WRITER(pclist_dev))
- gx_clist_reader_free_band_complexity_array(pclist_dev);
-
+ /* Close cmd list device & point to the storage */
+ (*gs_clist_device_procs.close_device)( (gx_device *)pcldev );
+ *the_memory = ppdev->buf;
+ ppdev->buf = 0;
+ ppdev->buffer_space = 0;
+ is_command_list = true;
+
+ /* If the clist is a reader clist, free any band_complexity_array
+ * memory used by same.
+ */
+ if (!CLIST_IS_WRITER(pclist_dev))
+ gx_clist_reader_free_band_complexity_array(pclist_dev);
+
} else {
- /* point at the device bitmap, no need to close mem dev */
- *the_memory = pmemdev->base;
- pmemdev->base = 0;
- is_command_list = false;
+ /* point at the device bitmap, no need to close mem dev */
+ *the_memory = pmemdev->base;
+ pmemdev->base = 0;
+ is_command_list = false;
}
/* Reset device proc vector to default */
if (ppdev->orig_procs.open_device != 0)
- pdev->procs = ppdev->orig_procs;
+ pdev->procs = ppdev->orig_procs;
ppdev->orig_procs.open_device = 0; /* prevent uninit'd restore of procs */
return is_command_list;
@@ -224,7 +224,7 @@ gdev_prn_tear_down(gx_device *pdev, byte **the_memory)
static int
gdev_prn_allocate(gx_device *pdev, gdev_prn_space_params *new_space_params,
- int new_width, int new_height, bool reallocate)
+ int new_width, int new_height, bool reallocate)
{
gx_device_printer * const ppdev = (gx_device_printer *)pdev;
gx_device_memory * const pmemdev = (gx_device_memory *)pdev;
@@ -238,215 +238,215 @@ gdev_prn_allocate(gx_device *pdev, gdev_prn_space_params *new_space_params,
int ecode = 0;
int pass;
gs_memory_t *buffer_memory =
- (ppdev->buffer_memory == 0 ? pdev->memory->non_gc_memory :
- ppdev->buffer_memory);
+ (ppdev->buffer_memory == 0 ? pdev->memory->non_gc_memory :
+ ppdev->buffer_memory);
/* If reallocate, find allocated memory & tear down buffer device */
if (reallocate)
- save_is_command_list = gdev_prn_tear_down(pdev, &the_memory);
+ save_is_command_list = gdev_prn_tear_down(pdev, &the_memory);
/* Re/allocate memory */
ppdev->orig_procs = pdev->procs;
for ( pass = 1; pass <= (reallocate ? 2 : 1); ++pass ) {
- ulong mem_space;
- ulong pdf14_trans_buffer_size = 0;
- byte *base = 0;
- bool bufferSpace_is_default = false;
- gdev_prn_space_params space_params;
- gx_device_buf_space_t buf_space;
-
- if (reallocate)
- switch (pass)
- {
- case 1:
- /* Setup device to get reallocated */
- ppdev->space_params = *new_space_params;
- save_width = ppdev->width;
- ppdev->width = new_width;
- save_height = ppdev->height;
- ppdev->height = new_height;
- break;
- case 2: /* only comes here if reallocate */
- /* Restore device to previous contents */
- ppdev->space_params = save_params;
- ppdev->width = save_width;
- ppdev->height = save_height;
- break;
- }
-
- /* Init clist/mem device-specific fields */
- memset(ppdev->skip, 0, sizeof(ppdev->skip));
- size_ok = ppdev->printer_procs.buf_procs.size_buf_device
- (&buf_space, pdev, NULL, pdev->height, false) >= 0;
- mem_space = buf_space.bits + buf_space.line_ptrs;
- if (ppdev->page_uses_transparency) {
- pdf14_trans_buffer_size = (ESTIMATED_PDF14_ROW_SPACE(max(1, new_width)) >> 3);
- if (new_height < (max_ulong - mem_space) / pdf14_trans_buffer_size) {
- pdf14_trans_buffer_size *= new_height;
- mem_space += pdf14_trans_buffer_size;
- } else {
- size_ok = 0;
- }
- }
-
- /* Compute desired space params: never use the space_params as-is. */
- /* Rather, give the dev-specific driver a chance to adjust them. */
- space_params = ppdev->space_params;
- space_params.BufferSpace = 0;
- (*ppdev->printer_procs.get_space_params)(ppdev, &space_params);
- if (ppdev->is_async_renderer && space_params.band.BandBufferSpace != 0)
- space_params.BufferSpace = space_params.band.BandBufferSpace;
- else if (space_params.BufferSpace == 0) {
- if (space_params.band.BandBufferSpace > 0)
- space_params.BufferSpace = space_params.band.BandBufferSpace;
- else {
- space_params.BufferSpace = ppdev->space_params.BufferSpace;
- bufferSpace_is_default = true;
- }
- }
-
- /* Determine if we can use a full bitmap buffer, or have to use banding */
- if (pass > 1)
- is_command_list = save_is_command_list;
- else {
- is_command_list = space_params.banding_type == BandingAlways ||
- mem_space >= space_params.MaxBitmap ||
- !size_ok; /* too big to allocate */
- }
- if (!is_command_list) {
- /* Try to allocate memory for full memory buffer */
- base =
- (reallocate ?
- (byte *)gs_resize_object(buffer_memory, the_memory,
- (uint)mem_space, "printer buffer") :
- gs_alloc_bytes(buffer_memory, (uint)mem_space,
- "printer_buffer"));
- if (base == 0)
- is_command_list = true;
- else
- the_memory = base;
- }
- if (!is_command_list && pass == 1 && PRN_MIN_MEMORY_LEFT != 0
- && buffer_memory == pdev->memory->non_gc_memory) {
- /* before using full memory buffer, ensure enough working mem left */
- byte * left = gs_alloc_bytes( buffer_memory,
- PRN_MIN_MEMORY_LEFT, "printer mem left");
- if (left == 0)
- is_command_list = true;
- else
- gs_free_object(buffer_memory, left, "printer mem left");
- }
-
- if (is_command_list) {
- /* Buffer the image in a command list. */
- /* Release the buffer if we allocated it. */
- int code;
- if (!reallocate) {
- gs_free_object(buffer_memory, the_memory,
- "printer buffer(open)");
- the_memory = 0;
- }
- if (space_params.banding_type == BandingNever) {
- ecode = gs_note_error(gs_error_VMerror);
- continue;
- }
- code = gdev_prn_setup_as_command_list(pdev, buffer_memory,
- &the_memory, &space_params,
- !bufferSpace_is_default);
- if (ecode == 0)
- ecode = code;
-
- if ( code >= 0 || (reallocate && pass > 1) )
- ppdev->procs = gs_clist_device_procs;
- /*
- * Now the device is a clist device, we enable multi-threaded rendering.
- * It will remain enabled, but that doesn't really cause any problems.
- */
- clist_enable_multi_thread_render(pdev);
- } else {
- /* Render entirely in memory. */
- gx_device *bdev = (gx_device *)pmemdev;
- int code;
-
- ppdev->buffer_space = 0;
- if ((code = gdev_create_buf_device
- (ppdev->printer_procs.buf_procs.create_buf_device,
- &bdev, pdev, 0, NULL, NULL, NULL)) < 0 ||
- (code = ppdev->printer_procs.buf_procs.setup_buf_device
- (bdev, base, buf_space.raster,
- (byte **)(base + buf_space.bits), 0, pdev->height,
- pdev->height)) < 0
- ) {
- /* Catastrophic. Shouldn't ever happen */
- gs_free_object(buffer_memory, base, "printer buffer");
- pdev->procs = ppdev->orig_procs;
- ppdev->orig_procs.open_device = 0; /* prevent uninit'd restore of procs */
- return_error(code);
- }
- pmemdev->base = base;
- }
- if (ecode == 0)
- break;
+ ulong mem_space;
+ ulong pdf14_trans_buffer_size = 0;
+ byte *base = 0;
+ bool bufferSpace_is_default = false;
+ gdev_prn_space_params space_params;
+ gx_device_buf_space_t buf_space;
+
+ if (reallocate)
+ switch (pass)
+ {
+ case 1:
+ /* Setup device to get reallocated */
+ ppdev->space_params = *new_space_params;
+ save_width = ppdev->width;
+ ppdev->width = new_width;
+ save_height = ppdev->height;
+ ppdev->height = new_height;
+ break;
+ case 2: /* only comes here if reallocate */
+ /* Restore device to previous contents */
+ ppdev->space_params = save_params;
+ ppdev->width = save_width;
+ ppdev->height = save_height;
+ break;
+ }
+
+ /* Init clist/mem device-specific fields */
+ memset(ppdev->skip, 0, sizeof(ppdev->skip));
+ size_ok = ppdev->printer_procs.buf_procs.size_buf_device
+ (&buf_space, pdev, NULL, pdev->height, false) >= 0;
+ mem_space = buf_space.bits + buf_space.line_ptrs;
+ if (ppdev->page_uses_transparency) {
+ pdf14_trans_buffer_size = (ESTIMATED_PDF14_ROW_SPACE(max(1, new_width)) >> 3);
+ if (new_height < (max_ulong - mem_space) / pdf14_trans_buffer_size) {
+ pdf14_trans_buffer_size *= new_height;
+ mem_space += pdf14_trans_buffer_size;
+ } else {
+ size_ok = 0;
+ }
+ }
+
+ /* Compute desired space params: never use the space_params as-is. */
+ /* Rather, give the dev-specific driver a chance to adjust them. */
+ space_params = ppdev->space_params;
+ space_params.BufferSpace = 0;
+ (*ppdev->printer_procs.get_space_params)(ppdev, &space_params);
+ if (ppdev->is_async_renderer && space_params.band.BandBufferSpace != 0)
+ space_params.BufferSpace = space_params.band.BandBufferSpace;
+ else if (space_params.BufferSpace == 0) {
+ if (space_params.band.BandBufferSpace > 0)
+ space_params.BufferSpace = space_params.band.BandBufferSpace;
+ else {
+ space_params.BufferSpace = ppdev->space_params.BufferSpace;
+ bufferSpace_is_default = true;
+ }
+ }
+
+ /* Determine if we can use a full bitmap buffer, or have to use banding */
+ if (pass > 1)
+ is_command_list = save_is_command_list;
+ else {
+ is_command_list = space_params.banding_type == BandingAlways ||
+ mem_space >= space_params.MaxBitmap ||
+ !size_ok; /* too big to allocate */
+ }
+ if (!is_command_list) {
+ /* Try to allocate memory for full memory buffer */
+ base =
+ (reallocate ?
+ (byte *)gs_resize_object(buffer_memory, the_memory,
+ (uint)mem_space, "printer buffer") :
+ gs_alloc_bytes(buffer_memory, (uint)mem_space,
+ "printer_buffer"));
+ if (base == 0)
+ is_command_list = true;
+ else
+ the_memory = base;
+ }
+ if (!is_command_list && pass == 1 && PRN_MIN_MEMORY_LEFT != 0
+ && buffer_memory == pdev->memory->non_gc_memory) {
+ /* before using full memory buffer, ensure enough working mem left */
+ byte * left = gs_alloc_bytes( buffer_memory,
+ PRN_MIN_MEMORY_LEFT, "printer mem left");
+ if (left == 0)
+ is_command_list = true;
+ else
+ gs_free_object(buffer_memory, left, "printer mem left");
+ }
+
+ if (is_command_list) {
+ /* Buffer the image in a command list. */
+ /* Release the buffer if we allocated it. */
+ int code;
+ if (!reallocate) {
+ gs_free_object(buffer_memory, the_memory,
+ "printer buffer(open)");
+ the_memory = 0;
+ }
+ if (space_params.banding_type == BandingNever) {
+ ecode = gs_note_error(gs_error_VMerror);
+ continue;
+ }
+ code = gdev_prn_setup_as_command_list(pdev, buffer_memory,
+ &the_memory, &space_params,
+ !bufferSpace_is_default);
+ if (ecode == 0)
+ ecode = code;
+
+ if ( code >= 0 || (reallocate && pass > 1) )
+ ppdev->procs = gs_clist_device_procs;
+ /*
+ * Now the device is a clist device, we enable multi-threaded rendering.
+ * It will remain enabled, but that doesn't really cause any problems.
+ */
+ clist_enable_multi_thread_render(pdev);
+ } else {
+ /* Render entirely in memory. */
+ gx_device *bdev = (gx_device *)pmemdev;
+ int code;
+
+ ppdev->buffer_space = 0;
+ if ((code = gdev_create_buf_device
+ (ppdev->printer_procs.buf_procs.create_buf_device,
+ &bdev, pdev, 0, NULL, NULL, NULL)) < 0 ||
+ (code = ppdev->printer_procs.buf_procs.setup_buf_device
+ (bdev, base, buf_space.raster,
+ (byte **)(base + buf_space.bits), 0, pdev->height,
+ pdev->height)) < 0
+ ) {
+ /* Catastrophic. Shouldn't ever happen */
+ gs_free_object(buffer_memory, base, "printer buffer");
+ pdev->procs = ppdev->orig_procs;
+ ppdev->orig_procs.open_device = 0; /* prevent uninit'd restore of procs */
+ return_error(code);
+ }
+ pmemdev->base = base;
+ }
+ if (ecode == 0)
+ break;
}
if (ecode >= 0 || reallocate) { /* even if realloc failed */
- /* Synthesize the procedure vector. */
- /* Rendering operations come from the memory or clist device, */
- /* non-rendering come from the printer device. */
+ /* Synthesize the procedure vector. */
+ /* Rendering operations come from the memory or clist device, */
+ /* non-rendering come from the printer device. */
#define COPY_PROC(p) set_dev_proc(ppdev, p, ppdev->orig_procs.p)
- COPY_PROC(get_initial_matrix);
- COPY_PROC(output_page);
- COPY_PROC(close_device);
- COPY_PROC(map_rgb_color);
- COPY_PROC(map_color_rgb);
- COPY_PROC(get_params);
- COPY_PROC(put_params);
- COPY_PROC(map_cmyk_color);
- COPY_PROC(get_xfont_procs);
- COPY_PROC(get_xfont_device);
- COPY_PROC(map_rgb_alpha_color);
- /* All printers are page devices, even if they didn't use the */
- /* standard macros for generating their procedure vectors. */
- set_dev_proc(ppdev, get_page_device, gx_page_device_get_page_device);
- COPY_PROC(get_clipping_box);
- COPY_PROC(map_color_rgb_alpha);
- COPY_PROC(get_hardware_params);
- COPY_PROC(get_color_mapping_procs);
- COPY_PROC(get_color_comp_index);
- COPY_PROC(encode_color);
- COPY_PROC(decode_color);
- COPY_PROC(update_spot_equivalent_colors);
- COPY_PROC(ret_devn_params);
+ COPY_PROC(get_initial_matrix);
+ COPY_PROC(output_page);
+ COPY_PROC(close_device);
+ COPY_PROC(map_rgb_color);
+ COPY_PROC(map_color_rgb);
+ COPY_PROC(get_params);
+ COPY_PROC(put_params);
+ COPY_PROC(map_cmyk_color);
+ COPY_PROC(get_xfont_procs);
+ COPY_PROC(get_xfont_device);
+ COPY_PROC(map_rgb_alpha_color);
+ /* All printers are page devices, even if they didn't use the */
+ /* standard macros for generating their procedure vectors. */
+ set_dev_proc(ppdev, get_page_device, gx_page_device_get_page_device);
+ COPY_PROC(get_clipping_box);
+ COPY_PROC(map_color_rgb_alpha);
+ COPY_PROC(get_hardware_params);
+ COPY_PROC(get_color_mapping_procs);
+ COPY_PROC(get_color_comp_index);
+ COPY_PROC(encode_color);
+ COPY_PROC(decode_color);
+ COPY_PROC(update_spot_equivalent_colors);
+ COPY_PROC(ret_devn_params);
COPY_PROC(put_image);
#undef COPY_PROC
- /* If using a command list, already opened the device. */
- if (is_command_list)
- return ecode;
- else
- return (*dev_proc(pdev, open_device))(pdev);
+ /* If using a command list, already opened the device. */
+ if (is_command_list)
+ return ecode;
+ else
+ return (*dev_proc(pdev, open_device))(pdev);
} else {
- pdev->procs = ppdev->orig_procs;
- ppdev->orig_procs.open_device = 0; /* prevent uninit'd restore of procs */
- return ecode;
+ pdev->procs = ppdev->orig_procs;
+ ppdev->orig_procs.open_device = 0; /* prevent uninit'd restore of procs */
+ return ecode;
}
}
int
gdev_prn_allocate_memory(gx_device *pdev,
- gdev_prn_space_params *new_space_params,
- int new_width, int new_height)
+ gdev_prn_space_params *new_space_params,
+ int new_width, int new_height)
{
return gdev_prn_allocate(pdev, new_space_params,
- new_width, new_height, false);
+ new_width, new_height, false);
}
int
gdev_prn_reallocate_memory(gx_device *pdev,
- gdev_prn_space_params *new_space_params,
- int new_width, int new_height)
+ gdev_prn_space_params *new_space_params,
+ int new_width, int new_height)
{
return gdev_prn_allocate(pdev, new_space_params,
- new_width, new_height, true);
+ new_width, new_height, true);
}
int
@@ -455,8 +455,8 @@ gdev_prn_free_memory(gx_device *pdev)
gx_device_printer * const ppdev = (gx_device_printer *)pdev;
byte *the_memory = 0;
gs_memory_t *buffer_memory =
- (ppdev->buffer_memory == 0 ? pdev->memory->non_gc_memory :
- ppdev->buffer_memory);
+ (ppdev->buffer_memory == 0 ? pdev->memory->non_gc_memory :
+ ppdev->buffer_memory);
gdev_prn_tear_down(pdev, &the_memory);
gs_free_object(buffer_memory, the_memory, "gdev_prn_free_memory");
@@ -498,26 +498,26 @@ gdev_prn_get_params(gx_device * pdev, gs_param_list * plist)
gs_param_string ofns;
if (code < 0 ||
- (code = param_write_long(plist, "MaxBitmap", &ppdev->space_params.MaxBitmap)) < 0 ||
- (code = param_write_long(plist, "BufferSpace", &ppdev->space_params.BufferSpace)) < 0 ||
- (code = param_write_int(plist, "BandWidth", &ppdev->space_params.band.BandWidth)) < 0 ||
- (code = param_write_int(plist, "BandHeight", &ppdev->space_params.band.BandHeight)) < 0 ||
- (code = param_write_long(plist, "BandBufferSpace", &ppdev->space_params.band.BandBufferSpace)) < 0 ||
- (code = param_write_int(plist, "NumRenderingThreads", &ppdev->num_render_threads_requested)) < 0 ||
- (code = param_write_bool(plist, "OpenOutputFile", &ppdev->OpenOutputFile)) < 0 ||
- (code = param_write_bool(plist, "ReopenPerPage", &ppdev->ReopenPerPage)) < 0 ||
- (code = param_write_bool(plist, "PageUsesTransparency",
- &ppdev->page_uses_transparency)) < 0 ||
- (ppdev->Duplex_set >= 0 &&
- (code = (ppdev->Duplex_set ?
- param_write_bool(plist, "Duplex", &ppdev->Duplex) :
- param_write_null(plist, "Duplex"))) < 0)
- )
- return code;
+ (code = param_write_long(plist, "MaxBitmap", &ppdev->space_params.MaxBitmap)) < 0 ||
+ (code = param_write_long(plist, "BufferSpace", &ppdev->space_params.BufferSpace)) < 0 ||
+ (code = param_write_int(plist, "BandWidth", &ppdev->space_params.band.BandWidth)) < 0 ||
+ (code = param_write_int(plist, "BandHeight", &ppdev->space_params.band.BandHeight)) < 0 ||
+ (code = param_write_long(plist, "BandBufferSpace", &ppdev->space_params.band.BandBufferSpace)) < 0 ||
+ (code = param_write_int(plist, "NumRenderingThreads", &ppdev->num_render_threads_requested)) < 0 ||
+ (code = param_write_bool(plist, "OpenOutputFile", &ppdev->OpenOutputFile)) < 0 ||
+ (code = param_write_bool(plist, "ReopenPerPage", &ppdev->ReopenPerPage)) < 0 ||
+ (code = param_write_bool(plist, "PageUsesTransparency",
+ &ppdev->page_uses_transparency)) < 0 ||
+ (ppdev->Duplex_set >= 0 &&
+ (code = (ppdev->Duplex_set ?
+ param_write_bool(plist, "Duplex", &ppdev->Duplex) :
+ param_write_null(plist, "Duplex"))) < 0)
+ )
+ return code;
ofns.data = (const byte *)ppdev->fname,
- ofns.size = strlen(ppdev->fname),
- ofns.persistent = false;
+ ofns.size = strlen(ppdev->fname),
+ ofns.persistent = false;
return param_write_string(plist, "OutputFile", &ofns);
}
@@ -529,7 +529,7 @@ validate_output_file(const gs_param_string * ofs, gs_memory_t *memory)
const char *fmt;
return gx_parse_output_file_name(&parsed, &fmt, (const char *)ofs->data,
- ofs->size, memory) >= 0;
+ ofs->size, memory) >= 0;
}
/* Put parameters. */
@@ -558,146 +558,146 @@ gdev_prn_put_params(gx_device * pdev, gs_param_list * plist)
save_sp = sp;
switch (code = param_read_bool(plist, (param_name = "OpenOutputFile"), &oof)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
switch (code = param_read_bool(plist, (param_name = "ReopenPerPage"), &rpp)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
switch (code = param_read_bool(plist, (param_name = "PageUsesTransparency"),
- &page_uses_transparency)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ &page_uses_transparency)) {
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
if (ppdev->Duplex_set >= 0) /* i.e., Duplex is supported */
- switch (code = param_read_bool(plist, (param_name = "Duplex"),
- &duplex)) {
- case 0:
- duplex_set = 1;
- break;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- duplex_set = 0;
- break;
- }
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- ;
- }
+ switch (code = param_read_bool(plist, (param_name = "Duplex"),
+ &duplex)) {
+ case 0:
+ duplex_set = 1;
+ break;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ duplex_set = 0;
+ break;
+ }
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ ;
+ }
#define CHECK_PARAM_CASES(member, bad, label)\
case 0:\
- if ((sp.params_are_read_only ? sp.member != save_sp.member : bad))\
- ecode = gs_error_rangecheck;\
- else\
- break;\
- goto label;\
+ if ((sp.params_are_read_only ? sp.member != save_sp.member : bad))\
+ ecode = gs_error_rangecheck;\
+ else\
+ break;\
+ goto label;\
default:\
- ecode = code;\
+ ecode = code;\
label:\
- param_signal_error(plist, param_name, ecode);\
+ param_signal_error(plist, param_name, ecode);\
case 1:\
- break
+ break
switch (code = param_read_long(plist, (param_name = "MaxBitmap"), &sp.MaxBitmap)) {
- CHECK_PARAM_CASES(MaxBitmap, sp.MaxBitmap < 10000, mbe);
+ CHECK_PARAM_CASES(MaxBitmap, sp.MaxBitmap < 10000, mbe);
}
switch (code = param_read_long(plist, (param_name = "BufferSpace"), &sp.BufferSpace)) {
- CHECK_PARAM_CASES(BufferSpace, sp.BufferSpace < 10000, bse);
+ CHECK_PARAM_CASES(BufferSpace, sp.BufferSpace < 10000, bse);
}
switch (code = param_read_int(plist, (param_name = "BandWidth"), &sp.band.BandWidth)) {
- CHECK_PARAM_CASES(band.BandWidth, sp.band.BandWidth < 0, bwe);
+ CHECK_PARAM_CASES(band.BandWidth, sp.band.BandWidth < 0, bwe);
}
switch (code = param_read_int(plist, (param_name = "BandHeight"), &sp.band.BandHeight)) {
- CHECK_PARAM_CASES(band.BandHeight, sp.band.BandHeight < 0, bhe);
+ CHECK_PARAM_CASES(band.BandHeight, sp.band.BandHeight < 0, bhe);
}
switch (code = param_read_long(plist, (param_name = "BandBufferSpace"), &sp.band.BandBufferSpace)) {
- CHECK_PARAM_CASES(band.BandBufferSpace, sp.band.BandBufferSpace < 0, bbse);
+ CHECK_PARAM_CASES(band.BandBufferSpace, sp.band.BandBufferSpace < 0, bbse);
}
switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofs)) {
- case 0:
- if (pdev->LockSafetyParams &&
- bytes_compare(ofs.data, ofs.size,
- (const byte *)ppdev->fname, strlen(ppdev->fname))) {
- code = gs_error_invalidaccess;
- }
- else
- code = validate_output_file(&ofs, pdev->memory);
- if (code >= 0)
- break;
- /* falls through */
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- ofs.data = 0;
- break;
+ case 0:
+ if (pdev->LockSafetyParams &&
+ bytes_compare(ofs.data, ofs.size,
+ (const byte *)ppdev->fname, strlen(ppdev->fname))) {
+ code = gs_error_invalidaccess;
+ }
+ else
+ code = validate_output_file(&ofs, pdev->memory);
+ if (code >= 0)
+ break;
+ /* falls through */
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ ofs.data = 0;
+ break;
}
/* Read InputAttributes and OutputAttributes just for the type */
/* check and to indicate that they aren't undefined. */
#define read_media(pname)\
- switch ( code = param_begin_read_dict(plist, (param_name = pname), &mdict, true) )\
- {\
- case 0:\
- param_end_read_dict(plist, pname, &mdict);\
- break;\
- default:\
- ecode = code;\
- param_signal_error(plist, param_name, ecode);\
- case 1:\
- ;\
- }
+ switch ( code = param_begin_read_dict(plist, (param_name = pname), &mdict, true) )\
+ {\
+ case 0:\
+ param_end_read_dict(plist, pname, &mdict);\
+ break;\
+ default:\
+ ecode = code;\
+ param_signal_error(plist, param_name, ecode);\
+ case 1:\
+ ;\
+ }
read_media("InputAttributes");
read_media("OutputAttributes");
switch (code = param_read_int(plist, (param_name = "NumRenderingThreads"), &nthreads)) {
- case 0:
- break;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- ;
+ case 0:
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ ;
}
if (ecode < 0)
- return ecode;
+ return ecode;
/* Prevent gx_default_put_params from closing the printer. */
pdev->is_open = false;
code = gx_default_put_params(pdev, plist);
pdev->is_open = is_open;
if (code < 0)
- return code;
+ return code;
ppdev->OpenOutputFile = oof;
ppdev->ReopenPerPage = rpp;
ppdev->page_uses_transparency = page_uses_transparency;
if (duplex_set >= 0) {
- ppdev->Duplex = duplex;
- ppdev->Duplex_set = duplex_set;
+ ppdev->Duplex = duplex;
+ ppdev->Duplex_set = duplex_set;
}
ppdev->space_params = sp;
ppdev->num_render_threads_requested = nthreads;
@@ -706,29 +706,29 @@ label:\
/* Formerly, would not reallocate if device is not open: */
/* we had to patch this out (see News for 5.50). */
code = gdev_prn_maybe_realloc_memory(ppdev, &save_sp, width, height,
- old_page_uses_transparency);
+ old_page_uses_transparency);
if (code < 0)
- return code;
+ return code;
/* If filename changed, close file. */
if (ofs.data != 0 &&
- bytes_compare(ofs.data, ofs.size,
- (const byte *)ppdev->fname, strlen(ppdev->fname))
- ) {
- /* Close the file if it's open. */
- if (ppdev->file != NULL)
- gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
- ppdev->file = NULL;
- memcpy(ppdev->fname, ofs.data, ofs.size);
- ppdev->fname[ofs.size] = 0;
+ bytes_compare(ofs.data, ofs.size,
+ (const byte *)ppdev->fname, strlen(ppdev->fname))
+ ) {
+ /* Close the file if it's open. */
+ if (ppdev->file != NULL)
+ gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
+ ppdev->file = NULL;
+ memcpy(ppdev->fname, ofs.data, ofs.size);
+ ppdev->fname[ofs.size] = 0;
}
/* If the device is open and OpenOutputFile is true, */
/* open the OutputFile now. (If the device isn't open, */
/* this will happen when it is opened.) */
if (pdev->is_open && oof) {
- code = gdev_prn_open_printer(pdev, 1);
- if (code < 0)
- return code;
+ code = gdev_prn_open_printer(pdev, 1);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -738,7 +738,7 @@ label:\
/* Default routine to (not) override current space_params. */
void
gx_default_get_space_params(const gx_device_printer *printer_dev,
- gdev_prn_space_params *space_params)
+ gdev_prn_space_params *space_params)
{
return;
}
@@ -752,41 +752,41 @@ gdev_prn_output_page(gx_device * pdev, int num_copies, int flush)
bool upgraded_copypage = false;
if (num_copies > 0 || !flush) {
- int code = gdev_prn_open_printer(pdev, 1);
-
- if (code < 0)
- return code;
-
- /* If copypage request, try to do it using buffer_page */
- if ( !flush &&
- (*ppdev->printer_procs.buffer_page)
- (ppdev, ppdev->file, num_copies) >= 0
- ) {
- upgraded_copypage = true;
- flush = true;
- }
- else if (num_copies > 0)
- /* Print the accumulated page description. */
- outcode =
- (*ppdev->printer_procs.print_page_copies)(ppdev, ppdev->file,
- num_copies);
- fflush(ppdev->file);
- errcode =
- (ferror(ppdev->file) ? gs_note_error(gs_error_ioerror) : 0);
- if (!upgraded_copypage)
- closecode = gdev_prn_close_printer(pdev);
+ int code = gdev_prn_open_printer(pdev, 1);
+
+ if (code < 0)
+ return code;
+
+ /* If copypage request, try to do it using buffer_page */
+ if ( !flush &&
+ (*ppdev->printer_procs.buffer_page)
+ (ppdev, ppdev->file, num_copies) >= 0
+ ) {
+ upgraded_copypage = true;
+ flush = true;
+ }
+ else if (num_copies > 0)
+ /* Print the accumulated page description. */
+ outcode =
+ (*ppdev->printer_procs.print_page_copies)(ppdev, ppdev->file,
+ num_copies);
+ fflush(ppdev->file);
+ errcode =
+ (ferror(ppdev->file) ? gs_note_error(gs_error_ioerror) : 0);
+ if (!upgraded_copypage)
+ closecode = gdev_prn_close_printer(pdev);
}
endcode = (ppdev->buffer_space && !ppdev->is_async_renderer ?
- clist_finish_page(pdev, flush) : 0);
+ clist_finish_page(pdev, flush) : 0);
if (outcode < 0)
- return outcode;
+ return outcode;
if (errcode < 0)
- return errcode;
+ return errcode;
if (closecode < 0)
- return closecode;
+ return closecode;
if (endcode < 0)
- return endcode;
+ return endcode;
endcode = gx_finish_output_page(pdev, num_copies, flush);
return (endcode < 0 ? endcode : upgraded_copypage ? 1 : 0);
}
@@ -801,34 +801,34 @@ gx_print_page_single_copy(gx_device_printer * pdev, FILE * prn_stream)
/* Print multiple copies of a page by calling print_page multiple times. */
int
gx_default_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int i = 1;
int code = 0;
for (; i < num_copies; ++i) {
- int errcode, closecode;
-
- code = (*pdev->printer_procs.print_page) (pdev, prn_stream);
- if (code < 0)
- return code;
- /*
- * Close and re-open the printer, to reset is_new and do the
- * right thing if we're producing multiple output files.
- * Code is mostly copied from gdev_prn_output_page.
- */
- fflush(pdev->file);
- errcode =
- (ferror(pdev->file) ? gs_note_error(gs_error_ioerror) : 0);
- closecode = gdev_prn_close_printer((gx_device *)pdev);
- pdev->PageCount++;
- code = (errcode < 0 ? errcode : closecode < 0 ? closecode :
- gdev_prn_open_printer((gx_device *)pdev, true));
- if (code < 0) {
- pdev->PageCount -= i;
- return code;
- }
- prn_stream = pdev->file;
+ int errcode, closecode;
+
+ code = (*pdev->printer_procs.print_page) (pdev, prn_stream);
+ if (code < 0)
+ return code;
+ /*
+ * Close and re-open the printer, to reset is_new and do the
+ * right thing if we're producing multiple output files.
+ * Code is mostly copied from gdev_prn_output_page.
+ */
+ fflush(pdev->file);
+ errcode =
+ (ferror(pdev->file) ? gs_note_error(gs_error_ioerror) : 0);
+ closecode = gdev_prn_close_printer((gx_device *)pdev);
+ pdev->PageCount++;
+ code = (errcode < 0 ? errcode : closecode < 0 ? closecode :
+ gdev_prn_open_printer((gx_device *)pdev, true));
+ if (code < 0) {
+ pdev->PageCount -= i;
+ return code;
+ }
+ prn_stream = pdev->file;
}
/* Print the last (or only) page. */
pdev->PageCount -= num_copies - 1;
@@ -842,7 +842,7 @@ gx_default_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
*/
int
gx_default_buffer_page(gx_device_printer *pdev, FILE *prn_stream,
- int num_copies)
+ int num_copies)
{
return gs_error_unknownerror;
}
@@ -852,7 +852,7 @@ gx_default_buffer_page(gx_device_printer *pdev, FILE *prn_stream,
/* Initialize a rendering plane specification. */
int
gx_render_plane_init(gx_render_plane_t *render_plane, const gx_device *dev,
- int index)
+ int index)
{
/*
* Eventually the computation of shift and depth from dev and index
@@ -862,7 +862,7 @@ gx_render_plane_init(gx_render_plane_t *render_plane, const gx_device *dev,
int plane_depth = dev->color_info.depth / num_planes;
if (index < 0 || index >= num_planes)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
render_plane->index = index;
render_plane->depth = plane_depth;
render_plane->shift = plane_depth * (num_planes - 1 - index);
@@ -872,13 +872,13 @@ gx_render_plane_init(gx_render_plane_t *render_plane, const gx_device *dev,
/* Clear trailing bits in the last byte of (a) scan line(s). */
void
gdev_prn_clear_trailing_bits(byte *data, uint raster, int height,
- const gx_device *dev)
+ const gx_device *dev)
{
int first_bit = dev->width * dev->color_info.depth;
if (first_bit & 7)
- bits_fill_rectangle(data, first_bit, raster, mono_fill_make_pattern(0),
- -first_bit & 7, height);
+ bits_fill_rectangle(data, first_bit, raster, mono_fill_make_pattern(0),
+ -first_bit & 7, height);
}
/* Return the number of scan lines that should actually be passed */
@@ -897,9 +897,9 @@ gdev_prn_print_scan_lines(gx_device * pdev)
bottom = (int)(dev_b_margin(pdev) * yscale);
offset = (int)(dev_y_offset(pdev) * yscale);
if (yscale < 0) { /* Y=0 is top of page */
- end = -offset + height + bottom;
+ end = -offset + height + bottom;
} else { /* Y=0 is bottom of page */
- end = offset + height - top;
+ end = offset + height - top;
}
return min(height, end);
}
@@ -907,20 +907,20 @@ gdev_prn_print_scan_lines(gx_device * pdev)
/* Open the current page for printing. */
int
gdev_prn_open_printer_seekable(gx_device *pdev, bool binary_mode,
- bool seekable)
+ bool seekable)
{
gx_device_printer * const ppdev = (gx_device_printer *)pdev;
if (ppdev->file != 0) {
- ppdev->file_is_new = false;
- return 0;
+ ppdev->file_is_new = false;
+ return 0;
}
{
- int code = gx_device_open_output_file(pdev, ppdev->fname,
- binary_mode, seekable,
- &ppdev->file);
- if (code < 0)
- return code;
+ int code = gx_device_open_output_file(pdev, ppdev->fname,
+ binary_mode, seekable,
+ &ppdev->file);
+ if (code < 0)
+ return code;
}
ppdev->file_is_new = true;
return 0;
@@ -945,9 +945,9 @@ gdev_prn_file_is_new(const gx_device_printer *pdev)
/* Determine the colors used in a range of lines. */
int
gx_page_info_colors_used(const gx_device *dev,
- const gx_band_page_info_t *page_info,
- int y, int height,
- gx_colors_used_t *colors_used, int *range_start)
+ const gx_band_page_info_t *page_info,
+ int y, int height,
+ gx_colors_used_t *colors_used, int *range_start)
{
int start, end, i;
int num_lines = page_info->scan_lines_per_colors_used;
@@ -955,12 +955,12 @@ gx_page_info_colors_used(const gx_device *dev,
bool slow_rop = false;
if (y < 0 || height < 0 || height > dev->height - y)
- return -1;
+ return -1;
start = y / num_lines;
end = (y + height + num_lines - 1) / num_lines;
for (i = start; i < end; ++i) {
- or |= page_info->band_colors_used[i].or;
- slow_rop |= page_info->band_colors_used[i].slow_rop;
+ or |= page_info->band_colors_used[i].or;
+ slow_rop |= page_info->band_colors_used[i].slow_rop;
}
colors_used->or = or;
colors_used->slow_rop = slow_rop;
@@ -969,22 +969,22 @@ gx_page_info_colors_used(const gx_device *dev,
}
int
gdev_prn_colors_used(gx_device *dev, int y, int height,
- gx_colors_used_t *colors_used, int *range_start)
+ gx_colors_used_t *colors_used, int *range_start)
{
gx_device_clist_writer *cldev;
/* If this isn't a banded device, return default values. */
if (dev_proc(dev, open_device) != gs_clist_device_procs.open_device) {
- *range_start = 0;
- colors_used->or = ((gx_color_index)1 << dev->color_info.depth) - 1;
- return dev->height;
+ *range_start = 0;
+ colors_used->or = ((gx_color_index)1 << dev->color_info.depth) - 1;
+ return dev->height;
}
cldev = (gx_device_clist_writer *)dev;
if (cldev->page_info.scan_lines_per_colors_used == 0) /* not set yet */
- clist_compute_colors_used(cldev);
+ clist_compute_colors_used(cldev);
return
- gx_page_info_colors_used(dev, &cldev->page_info,
- y, height, colors_used, range_start);
+ gx_page_info_colors_used(dev, &cldev->page_info,
+ y, height, colors_used, range_start);
}
/*
@@ -993,14 +993,14 @@ gdev_prn_colors_used(gx_device *dev, int y, int height,
*/
int
gdev_create_buf_device(create_buf_device_proc_t cbd_proc, gx_device **pbdev,
- gx_device *target, int y,
- const gx_render_plane_t *render_plane,
- gs_memory_t *mem, gx_band_complexity_t *band_complexity)
+ gx_device *target, int y,
+ const gx_render_plane_t *render_plane,
+ gs_memory_t *mem, gx_band_complexity_t *band_complexity)
{
int code = cbd_proc(pbdev, target, y, render_plane, mem, band_complexity);
if (code < 0)
- return code;
+ return code;
/* Retain this device -- it will be freed explicitly. */
gx_device_retain(*pbdev, true);
return code;
@@ -1021,28 +1021,28 @@ gx_default_create_buf_device(gx_device **pbdev, gx_device *target, int y,
gx_device *bdev;
if (plane_index >= 0)
- depth = render_plane->depth;
+ depth = render_plane->depth;
else
- depth = target->color_info.depth;
+ depth = target->color_info.depth;
mdproto = gdev_mem_device_for_bits(depth);
if (mdproto == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (mem) {
- mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "create_buf_device");
- if (mdev == 0)
- return_error(gs_error_VMerror);
+ mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
+ "create_buf_device");
+ if (mdev == 0)
+ return_error(gs_error_VMerror);
} else {
- mdev = (gx_device_memory *)*pbdev;
+ mdev = (gx_device_memory *)*pbdev;
}
if (target == (gx_device *)mdev) {
- /* The following is a special hack for setting up printer devices. */
- assign_dev_procs(mdev, mdproto);
+ /* The following is a special hack for setting up printer devices. */
+ assign_dev_procs(mdev, mdproto);
check_device_separable((gx_device *)mdev);
- gx_device_fill_in_procs((gx_device *)mdev);
+ gx_device_fill_in_procs((gx_device *)mdev);
} else {
- gs_make_mem_device(mdev, mdproto, mem, (band_complexity == NULL ? 1 : 0),
- (target == (gx_device *)mdev ? NULL : target));
+ gs_make_mem_device(mdev, mdproto, mem, (band_complexity == NULL ? 1 : 0),
+ (target == (gx_device *)mdev ? NULL : target));
mdev->device_icc_profile = target->device_icc_profile;
rc_increment(mdev->device_icc_profile);
}
@@ -1056,20 +1056,20 @@ gx_default_create_buf_device(gx_device **pbdev, gx_device *target, int y,
*/
gs_deviceinitialmatrix(target, &mdev->initial_matrix);
if (plane_index >= 0) {
- gx_device_plane_extract *edev =
- gs_alloc_struct(mem, gx_device_plane_extract,
- &st_device_plane_extract, "create_buf_device");
-
- if (edev == 0) {
- gx_default_destroy_buf_device((gx_device *)mdev);
- return_error(gs_error_VMerror);
- }
- edev->memory = mem;
- plane_device_init(edev, target, (gx_device *)mdev, render_plane,
- false);
- bdev = (gx_device *)edev;
+ gx_device_plane_extract *edev =
+ gs_alloc_struct(mem, gx_device_plane_extract,
+ &st_device_plane_extract, "create_buf_device");
+
+ if (edev == 0) {
+ gx_default_destroy_buf_device((gx_device *)mdev);
+ return_error(gs_error_VMerror);
+ }
+ edev->memory = mem;
+ plane_device_init(edev, target, (gx_device *)mdev, render_plane,
+ false);
+ bdev = (gx_device *)edev;
} else
- bdev = (gx_device *)mdev;
+ bdev = (gx_device *)mdev;
/****** QUESTIONABLE, BUT BETTER THAN OMITTING ******/
if (&bdev->color_info != &target->color_info) /* Pacify Valgrind */
bdev->color_info = target->color_info;
@@ -1080,8 +1080,8 @@ gx_default_create_buf_device(gx_device **pbdev, gx_device *target, int y,
/* Determine the space needed by the buffer device. */
int
gx_default_size_buf_device(gx_device_buf_space_t *space, gx_device *target,
- const gx_render_plane_t *render_plane,
- int height, bool not_used)
+ const gx_render_plane_t *render_plane,
+ int height, bool not_used)
{
gx_device_memory mdev;
@@ -1089,12 +1089,12 @@ gx_default_size_buf_device(gx_device_buf_space_t *space, gx_device *target,
space->bits = 0; /* clear in case of failure */
space->raster = 0; /* */
mdev.color_info.depth =
- (render_plane && render_plane->index >= 0 ? render_plane->depth :
- target->color_info.depth);
+ (render_plane && render_plane->index >= 0 ? render_plane->depth :
+ target->color_info.depth);
mdev.width = target->width;
mdev.num_planes = 0;
if (gdev_mem_bits_size(&mdev, target->width, height, &(space->bits)) < 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
space->line_ptrs = gdev_mem_line_ptrs_size(&mdev, target->width, height);
space->raster = gdev_mem_raster(&mdev);
return 0;
@@ -1103,46 +1103,46 @@ gx_default_size_buf_device(gx_device_buf_space_t *space, gx_device *target,
/* Set up the buffer device. */
int
gx_default_setup_buf_device(gx_device *bdev, byte *buffer, int bytes_per_line,
- byte **line_ptrs, int y, int setup_height,
- int full_height)
+ byte **line_ptrs, int y, int setup_height,
+ int full_height)
{
gx_device_memory *mdev =
- (gs_device_is_memory(bdev) ? (gx_device_memory *)bdev :
- (gx_device_memory *)(((gx_device_plane_extract *)bdev)->plane_dev));
+ (gs_device_is_memory(bdev) ? (gx_device_memory *)bdev :
+ (gx_device_memory *)(((gx_device_plane_extract *)bdev)->plane_dev));
byte **ptrs = line_ptrs;
int raster = bytes_per_line;
int code;
/****** HACK ******/
if ((gx_device *)mdev == bdev && mdev->num_planes)
- raster = bitmap_raster(mdev->planes[0].depth * mdev->width);
+ raster = bitmap_raster(mdev->planes[0].depth * mdev->width);
if (ptrs == 0) {
- /*
- * Before allocating a new line pointer array, if there is a previous
- * array, free it to prevent leaks.
- */
- if (mdev->line_ptrs != NULL)
- gs_free_object(mdev->line_pointer_memory, mdev->line_ptrs,
- "mem_close");
- /*
- * Allocate line pointers now; free them when we close the device.
- * Note that for multi-planar devices, we have to allocate using
- * full_height rather than setup_height.
- */
- ptrs = (byte **)
- gs_alloc_byte_array(mdev->memory,
- (mdev->num_planes ?
- full_height * mdev->num_planes :
- setup_height),
- sizeof(byte *), "setup_buf_device");
- if (ptrs == 0)
- return_error(gs_error_VMerror);
- mdev->line_pointer_memory = mdev->memory;
- mdev->foreign_line_pointers = false;
+ /*
+ * Before allocating a new line pointer array, if there is a previous
+ * array, free it to prevent leaks.
+ */
+ if (mdev->line_ptrs != NULL)
+ gs_free_object(mdev->line_pointer_memory, mdev->line_ptrs,
+ "mem_close");
+ /*
+ * Allocate line pointers now; free them when we close the device.
+ * Note that for multi-planar devices, we have to allocate using
+ * full_height rather than setup_height.
+ */
+ ptrs = (byte **)
+ gs_alloc_byte_array(mdev->memory,
+ (mdev->num_planes ?
+ full_height * mdev->num_planes :
+ setup_height),
+ sizeof(byte *), "setup_buf_device");
+ if (ptrs == 0)
+ return_error(gs_error_VMerror);
+ mdev->line_pointer_memory = mdev->memory;
+ mdev->foreign_line_pointers = false;
}
mdev->height = full_height;
code = gdev_mem_set_line_ptrs(mdev, buffer + raster * y, bytes_per_line,
- ptrs, setup_height);
+ ptrs, setup_height);
mdev->height = setup_height;
bdev->height = setup_height; /* do here in case mdev == bdev */
return code;
@@ -1155,9 +1155,9 @@ gx_default_destroy_buf_device(gx_device *bdev)
gx_device *mdev = bdev;
if (!gs_device_is_memory(bdev)) {
- /* bdev must be a plane extraction device. */
- mdev = ((gx_device_plane_extract *)bdev)->plane_dev;
- gs_free_object(bdev->memory, bdev, "destroy_buf_device");
+ /* bdev must be a plane extraction device. */
+ mdev = ((gx_device_plane_extract *)bdev)->plane_dev;
+ gs_free_object(bdev->memory, bdev, "destroy_buf_device");
}
/* gs_free_object will do finalize which will decrement icc profile */
dev_proc(mdev, close_device)(mdev);
@@ -1170,9 +1170,9 @@ gx_default_destroy_buf_device(gx_device *bdev)
*/
int
gdev_prn_get_lines(gx_device_printer *pdev, int y, int height,
- byte *buffer, uint bytes_per_line,
- byte **actual_buffer, uint *actual_bytes_per_line,
- const gx_render_plane_t *render_plane)
+ byte *buffer, uint bytes_per_line,
+ byte **actual_buffer, uint *actual_bytes_per_line,
+ const gx_render_plane_t *render_plane)
{
int code;
gs_int_rect rect;
@@ -1180,49 +1180,48 @@ gdev_prn_get_lines(gx_device_printer *pdev, int y, int height,
int plane;
if (y < 0 || height < 0 || y + height > pdev->height)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
rect.p.x = 0, rect.p.y = y;
rect.q.x = pdev->width, rect.q.y = y + height;
params.options =
- GB_RETURN_POINTER | GB_ALIGN_STANDARD | GB_OFFSET_0 |
- GB_RASTER_ANY |
- /* No depth specified, we always use native colors. */
- GB_COLORS_NATIVE | GB_ALPHA_NONE;
+ GB_RETURN_POINTER | GB_ALIGN_STANDARD | GB_OFFSET_0 |
+ GB_RASTER_ANY |
+ /* No depth specified, we always use native colors. */
+ GB_COLORS_NATIVE | GB_ALPHA_NONE;
if (render_plane) {
- params.options |= GB_PACKING_PLANAR | GB_SELECT_PLANES;
- memset(params.data, 0,
- sizeof(params.data[0]) * pdev->color_info.num_components);
- plane = render_plane->index;
- params.data[plane] = buffer;
+ params.options |= GB_PACKING_PLANAR | GB_SELECT_PLANES;
+ memset(params.data, 0,
+ sizeof(params.data[0]) * pdev->color_info.num_components);
+ plane = render_plane->index;
+ params.data[plane] = buffer;
} else {
- params.options |= GB_PACKING_CHUNKY;
- params.data[0] = buffer;
- plane = 0;
+ params.options |= GB_PACKING_CHUNKY;
+ params.data[0] = buffer;
+ plane = 0;
}
params.x_offset = 0;
params.raster = bytes_per_line;
code = dev_proc(pdev, get_bits_rectangle)
- ((gx_device *)pdev, &rect, &params, NULL);
+ ((gx_device *)pdev, &rect, &params, NULL);
if (code < 0 && actual_buffer) {
- /*
- * RETURN_POINTER might not be implemented for this
- * combination of parameters: try RETURN_COPY.
- */
- params.options &= ~(GB_RETURN_POINTER | GB_RASTER_ALL);
- params.options |= GB_RETURN_COPY | GB_RASTER_SPECIFIED;
- code = dev_proc(pdev, get_bits_rectangle)
- ((gx_device *)pdev, &rect, &params, NULL);
+ /*
+ * RETURN_POINTER might not be implemented for this
+ * combination of parameters: try RETURN_COPY.
+ */
+ params.options &= ~(GB_RETURN_POINTER | GB_RASTER_ALL);
+ params.options |= GB_RETURN_COPY | GB_RASTER_SPECIFIED;
+ code = dev_proc(pdev, get_bits_rectangle)
+ ((gx_device *)pdev, &rect, &params, NULL);
}
if (code < 0)
- return code;
+ return code;
if (actual_buffer)
- *actual_buffer = params.data[plane];
+ *actual_buffer = params.data[plane];
if (actual_bytes_per_line)
- *actual_bytes_per_line = params.raster;
+ *actual_bytes_per_line = params.raster;
return code;
}
-
/* Copy a scan line from the buffer to the printer. */
int
gdev_prn_get_bits(gx_device_printer * pdev, int y, byte * str, byte ** actual_data)
@@ -1232,11 +1231,11 @@ gdev_prn_get_bits(gx_device_printer * pdev, int y, byte * str, byte ** actual_da
int last_bits = -(pdev->width * pdev->color_info.depth) & 7;
if (code < 0)
- return code;
+ return code;
if (last_bits != 0) {
- byte *dest = (actual_data != 0 ? *actual_data : str);
+ byte *dest = (actual_data != 0 ? *actual_data : str);
- dest[line_size - 1] &= 0xff << last_bits;
+ dest[line_size - 1] &= 0xff << last_bits;
}
return 0;
}
@@ -1252,10 +1251,10 @@ gdev_prn_copy_scan_lines(gx_device_printer * pdev, int y, byte * str, uint size)
count = min(count, pdev->height - y);
for (i = 0; i < count; i++, dest += line_size) {
- int code = gdev_prn_get_bits(pdev, y + i, dest, NULL);
+ int code = gdev_prn_get_bits(pdev, y + i, dest, NULL);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return count;
}
@@ -1268,28 +1267,28 @@ gdev_prn_close_printer(gx_device * pdev)
gs_parsed_file_name_t parsed;
const char *fmt;
int code = gx_parse_output_file_name(&parsed, &fmt, ppdev->fname,
- strlen(ppdev->fname), pdev->memory);
+ strlen(ppdev->fname), pdev->memory);
if ((code >= 0 && fmt) /* file per page */ ||
- ppdev->ReopenPerPage /* close and reopen for each page */
- ) {
- gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
- ppdev->file = NULL;
+ ppdev->ReopenPerPage /* close and reopen for each page */
+ ) {
+ gx_device_close_output_file(pdev, ppdev->fname, ppdev->file);
+ ppdev->file = NULL;
}
return 0;
}
/* If necessary, free and reallocate the printer memory after changing params */
int
-gdev_prn_maybe_realloc_memory(gx_device_printer *prdev,
- gdev_prn_space_params *old_sp,
- int old_width, int old_height,
- bool old_page_uses_transparency)
+gdev_prn_maybe_realloc_memory(gx_device_printer *prdev,
+ gdev_prn_space_params *old_sp,
+ int old_width, int old_height,
+ bool old_page_uses_transparency)
{
int code = 0;
gx_device *const pdev = (gx_device *)prdev;
/*gx_device_memory * const mdev = (gx_device_memory *)prdev;*/
-
+
/*
* The first test was changed to mdev->base != 0 in 5.50 (per Artifex).
* Not only was this test wrong logically, it was incorrect in that
@@ -1299,28 +1298,28 @@ gdev_prn_maybe_realloc_memory(gx_device_printer *prdev,
* for these filesets.
*/
if (prdev->is_open &&
- (memcmp(&prdev->space_params, old_sp, sizeof(*old_sp)) != 0 ||
- prdev->width != old_width || prdev->height != old_height ||
- prdev->page_uses_transparency != old_page_uses_transparency)
- ) {
- int new_width = prdev->width;
- int new_height = prdev->height;
- gdev_prn_space_params new_sp;
+ (memcmp(&prdev->space_params, old_sp, sizeof(*old_sp)) != 0 ||
+ prdev->width != old_width || prdev->height != old_height ||
+ prdev->page_uses_transparency != old_page_uses_transparency)
+ ) {
+ int new_width = prdev->width;
+ int new_height = prdev->height;
+ gdev_prn_space_params new_sp;
#ifdef DEBUGGING_HACKS
debug_dump_bytes((const byte *)old_sp, (const byte *)(old_sp + 1), "old");
debug_dump_bytes((const byte *)&prdev->space_params,
- (const byte *)(&prdev->space_params + 1), "new");
+ (const byte *)(&prdev->space_params + 1), "new");
dprintf4("w=%d/%d, h=%d/%d\n", old_width, new_width, old_height, new_height);
#endif /*DEBUGGING_HACKS*/
- new_sp = prdev->space_params;
- prdev->width = old_width;
- prdev->height = old_height;
- prdev->space_params = *old_sp;
- code = gdev_prn_reallocate_memory(pdev, &new_sp,
- new_width, new_height);
- /* If this fails, device should be usable w/old params, but */
- /* band files may not be open. */
+ new_sp = prdev->space_params;
+ prdev->width = old_width;
+ prdev->height = old_height;
+ prdev->space_params = *old_sp;
+ code = gdev_prn_reallocate_memory(pdev, &new_sp,
+ new_width, new_height);
+ /* If this fails, device should be usable w/old params, but */
+ /* band files may not be open. */
}
return code;
}
diff --git a/gs/base/gdevprn.h b/gs/base/gdevprn.h
index af3792849..0e11b667d 100644
--- a/gs/base/gdevprn.h
+++ b/gs/base/gdevprn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -218,37 +218,37 @@ struct gdev_prn_space_params_s {
};
#define gx_prn_device_common\
- byte skip[max(sizeof(gx_device_memory), sizeof(gx_device_clist)) -\
- sizeof(gx_device) + sizeof(double) /* padding */];\
- gx_printer_device_procs printer_procs;\
- /* ------ Device parameters that must be set ------ */\
- /* ------ before calling the device open routine. ------ */\
- gdev_prn_space_params space_params;\
- char fname[prn_fname_sizeof]; /* OutputFile */\
- /* ------ Other device parameters ------ */\
- bool OpenOutputFile;\
- bool ReopenPerPage;\
+ byte skip[max(sizeof(gx_device_memory), sizeof(gx_device_clist)) -\
+ sizeof(gx_device) + sizeof(double) /* padding */];\
+ gx_printer_device_procs printer_procs;\
+ /* ------ Device parameters that must be set ------ */\
+ /* ------ before calling the device open routine. ------ */\
+ gdev_prn_space_params space_params;\
+ char fname[prn_fname_sizeof]; /* OutputFile */\
+ /* ------ Other device parameters ------ */\
+ bool OpenOutputFile;\
+ bool ReopenPerPage;\
bool page_uses_transparency; /* PDF 1.4 transparency is used on page */\
- bool Duplex;\
- int Duplex_set; /* -1 = not supported */\
- /* ------ End of parameters ------ */\
- bool file_is_new; /* true iff file just opened */\
- FILE *file; /* output file */\
- long buffer_space; /* amount of space for clist buffer, */\
- /* 0 means not using clist */\
- byte *buf; /* buffer for rendering */\
- /* ---- Begin async rendering support --- */\
- gs_memory_t *buffer_memory; /* allocator for command list */\
- gs_memory_t *bandlist_memory; /* allocator for bandlist files */\
- proc_free_up_bandlist_memory((*free_up_bandlist_memory)); /* if nz, proc to free some bandlist memory */\
- gx_page_queue_t *page_queue; /* if <> 0,page queue for gdevprna NOT GC'd */\
- bool is_async_renderer; /* device is only the rendering part of async device */\
- gx_device_printer *async_renderer; /* in async writer, pointer to async renderer */\
- uint clist_disable_mask; /* mask of clist options to disable */\
- /* ---- End async rendering support --- */\
- int num_render_threads_requested; /* for multiple band rendering threads */\
- gx_device_procs save_procs_while_delaying_erasepage; /* save device procs while delaying erasepage. */\
- gx_device_procs orig_procs /* original (std_)procs */
+ bool Duplex;\
+ int Duplex_set; /* -1 = not supported */\
+ /* ------ End of parameters ------ */\
+ bool file_is_new; /* true iff file just opened */\
+ FILE *file; /* output file */\
+ long buffer_space; /* amount of space for clist buffer, */\
+ /* 0 means not using clist */\
+ byte *buf; /* buffer for rendering */\
+ /* ---- Begin async rendering support --- */\
+ gs_memory_t *buffer_memory; /* allocator for command list */\
+ gs_memory_t *bandlist_memory; /* allocator for bandlist files */\
+ proc_free_up_bandlist_memory((*free_up_bandlist_memory)); /* if nz, proc to free some bandlist memory */\
+ gx_page_queue_t *page_queue; /* if <> 0,page queue for gdevprna NOT GC'd */\
+ bool is_async_renderer; /* device is only the rendering part of async device */\
+ gx_device_printer *async_renderer; /* in async writer, pointer to async renderer */\
+ uint clist_disable_mask; /* mask of clist options to disable */\
+ /* ---- End async rendering support --- */\
+ int num_render_threads_requested; /* for multiple band rendering threads */\
+ gx_device_procs save_procs_while_delaying_erasepage; /* save device procs while delaying erasepage. */\
+ gx_device_procs orig_procs /* original (std_)procs */
/* The device descriptor */
struct gx_device_printer_s {
@@ -293,50 +293,50 @@ prn_dev_proc_buffer_page(gx_default_buffer_page); /* returns an error */
prn_color_params_procs(p_open, p_output_page, p_close, p_map_rgb_color, p_map_color_rgb, gdev_prn_get_params, gdev_prn_put_params)
/* See gdev_prn_open for explanation of the NULLs below. */
#define prn_color_params_procs(p_open, p_output_page, p_close, p_map_rgb_color, p_map_color_rgb, p_get_params, p_put_params) {\
- p_open,\
- NULL, /* get_initial_matrix */\
- NULL, /* sync_output */\
- p_output_page,\
- p_close,\
- p_map_rgb_color,\
- p_map_color_rgb,\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- p_get_params,\
- p_put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device,\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop, */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL /* finish_copydevice */\
+ p_open,\
+ NULL, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ p_output_page,\
+ p_close,\
+ p_map_rgb_color,\
+ p_map_color_rgb,\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ p_get_params,\
+ p_put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device,\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop, */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL /* finish_copydevice */\
}
/* The standard printer device procedures */
@@ -358,36 +358,36 @@ extern const gx_device_procs prn_std_procs;
* Note that print_page and print_page_copies must not both be defaulted.
*/
#define prn_device_body_rest2_(print_page, print_page_copies, duplex_set)\
- { 0 }, /* std_procs */\
- { 0 }, /* skip */\
- { print_page,\
- print_page_copies,\
- { gx_default_create_buf_device,\
- gx_default_size_buf_device,\
- gx_default_setup_buf_device,\
- gx_default_destroy_buf_device\
- },\
- gdev_prn_default_get_space_params,\
- gx_default_start_render_thread,\
- gx_default_open_render_device,\
- gx_default_close_render_device,\
- gx_default_buffer_page\
- },\
- { PRN_MAX_BITMAP, PRN_BUFFER_SPACE,\
- { BAND_PARAMS_INITIAL_VALUES },\
- 0/*false*/, /* params_are_read_only */\
- BandingAuto /* banding_type */\
- },\
- { 0 }, /* fname */\
- 0/*false*/, /* OpenOutputFile */\
- 0/*false*/, /* ReopenPerPage */\
- 0/*false*/, /* page_uses_transparency */\
- 0/*false*/, duplex_set, /* Duplex[_set] */\
- 0/*false*/, 0, 0, 0, /* file_is_new ... buf */\
- 0, 0, 0, 0, 0/*false*/, 0, 0, /* buffer_memory ... clist_dis'_mask */\
- 0, /* num_render_threads_requested */\
- { 0 }, /* save_procs_while_delaying_erasepage */\
- { 0 } /* ... orig_procs */
+ { 0 }, /* std_procs */\
+ { 0 }, /* skip */\
+ { print_page,\
+ print_page_copies,\
+ { gx_default_create_buf_device,\
+ gx_default_size_buf_device,\
+ gx_default_setup_buf_device,\
+ gx_default_destroy_buf_device\
+ },\
+ gdev_prn_default_get_space_params,\
+ gx_default_start_render_thread,\
+ gx_default_open_render_device,\
+ gx_default_close_render_device,\
+ gx_default_buffer_page\
+ },\
+ { PRN_MAX_BITMAP, PRN_BUFFER_SPACE,\
+ { BAND_PARAMS_INITIAL_VALUES },\
+ 0/*false*/, /* params_are_read_only */\
+ BandingAuto /* banding_type */\
+ },\
+ { 0 }, /* fname */\
+ 0/*false*/, /* OpenOutputFile */\
+ 0/*false*/, /* ReopenPerPage */\
+ 0/*false*/, /* page_uses_transparency */\
+ 0/*false*/, duplex_set, /* Duplex[_set] */\
+ 0/*false*/, 0, 0, 0, /* file_is_new ... buf */\
+ 0, 0, 0, 0, 0/*false*/, 0, 0, /* buffer_memory ... clist_dis'_mask */\
+ 0, /* num_render_threads_requested */\
+ { 0 }, /* save_procs_while_delaying_erasepage */\
+ { 0 } /* ... orig_procs */
#define prn_device_body_rest_(print_page)\
prn_device_body_rest2_(print_page, gx_default_print_page_copies, -1)
#define prn_device_body_copies_rest_(print_page_copies)\
@@ -396,27 +396,27 @@ extern const gx_device_procs prn_std_procs;
/* The Sun cc compiler won't allow \ within a macro argument list. */
/* This accounts for the short parameter names here and below. */
#define prn_device_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
- std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
- (int)((float)(w10) * (xdpi) / 10 + 0.5),\
- (int)((float)(h10) * (ydpi) / 10 + 0.5),\
- xdpi, ydpi,\
- ncomp, depth, mg, mc, dg, dc,\
- (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
- (float)((lm) * 72.0), (float)((bm) * 72.0),\
- (float)((rm) * 72.0), (float)((tm) * 72.0)\
- ),\
- prn_device_body_rest_(print_page)
+ std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
+ (int)((float)(w10) * (xdpi) / 10 + 0.5),\
+ (int)((float)(h10) * (ydpi) / 10 + 0.5),\
+ xdpi, ydpi,\
+ ncomp, depth, mg, mc, dg, dc,\
+ (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
+ (float)((lm) * 72.0), (float)((bm) * 72.0),\
+ (float)((rm) * 72.0), (float)((tm) * 72.0)\
+ ),\
+ prn_device_body_rest_(print_page)
#define prn_device_margins_stype_body(dtype, procs, dname, stype, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
- std_device_full_body_type(dtype, &procs, dname, stype,\
- (int)((float)(w10) * (xdpi) / 10 + 0.5),\
- (int)((float)(h10) * (ydpi) / 10 + 0.5),\
- xdpi, ydpi,\
- ncomp, depth, mg, mc, dg, dc,\
- (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
- (float)((lm) * 72.0), (float)((bm) * 72.0),\
- (float)((rm) * 72.0), (float)((tm) * 72.0)\
- ),\
- prn_device_body_rest_(print_page)
+ std_device_full_body_type(dtype, &procs, dname, stype,\
+ (int)((float)(w10) * (xdpi) / 10 + 0.5),\
+ (int)((float)(h10) * (ydpi) / 10 + 0.5),\
+ xdpi, ydpi,\
+ ncomp, depth, mg, mc, dg, dc,\
+ (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
+ (float)((lm) * 72.0), (float)((bm) * 72.0),\
+ (float)((rm) * 72.0), (float)((tm) * 72.0)\
+ ),\
+ prn_device_body_rest_(print_page)
#define prn_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
prn_device_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi,\
@@ -426,46 +426,46 @@ extern const gx_device_procs prn_std_procs;
lm, tm, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)
#define prn_device_margins_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)\
- std_device_full_body_type_extended(dtype, &procs, dname, &st_device_printer,\
- (int)((long)(w10) * (xdpi) / 10),\
- (int)((long)(h10) * (ydpi) / 10),\
- xdpi, ydpi,\
- mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn,\
- -(lo) * (xdpi), -(to) * (ydpi),\
- (lm) * 72.0, (bm) * 72.0,\
- (rm) * 72.0, (tm) * 72.0\
- ),\
- prn_device_body_rest_(print_page)
+ std_device_full_body_type_extended(dtype, &procs, dname, &st_device_printer,\
+ (int)((long)(w10) * (xdpi) / 10),\
+ (int)((long)(h10) * (ydpi) / 10),\
+ xdpi, ydpi,\
+ mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn,\
+ -(lo) * (xdpi), -(to) * (ydpi),\
+ (lm) * 72.0, (bm) * 72.0,\
+ (rm) * 72.0, (tm) * 72.0\
+ ),\
+ prn_device_body_rest_(print_page)
#define prn_device_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)\
prn_device_margins_body_extended(dtype, procs, dname, w10, h10, xdpi, ydpi,\
lm, tm, lm, bm, rm, tm, mcomp, ncomp, pol, depth, gi, mg, mc, dg, dc, ef, cn, print_page)
#define prn_device_std_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, color_bits, print_page)\
- std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
- (int)((float)(w10) * (xdpi) / 10 + 0.5),\
- (int)((float)(h10) * (ydpi) / 10 + 0.5),\
- xdpi, ydpi, color_bits,\
- (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
- (float)((lm) * 72.0), (float)((bm) * 72.0),\
- (float)((rm) * 72.0), (float)((tm) * 72.0)\
- ),\
- prn_device_body_rest_(print_page)
+ std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
+ (int)((float)(w10) * (xdpi) / 10 + 0.5),\
+ (int)((float)(h10) * (ydpi) / 10 + 0.5),\
+ xdpi, ydpi, color_bits,\
+ (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
+ (float)((lm) * 72.0), (float)((bm) * 72.0),\
+ (float)((rm) * 72.0), (float)((tm) * 72.0)\
+ ),\
+ prn_device_body_rest_(print_page)
#define prn_device_std_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page)\
prn_device_std_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi,\
lm, tm, lm, bm, rm, tm, color_bits, print_page)
#define prn_device_std_margins_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, color_bits, print_page_copies)\
- std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
- (int)((float)(w10) * (xdpi) / 10 + 0.5),\
- (int)((float)(h10) * (ydpi) / 10 + 0.5),\
- xdpi, ydpi, color_bits,\
- (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
- (float)((lm) * 72.0), (float)((bm) * 72.0),\
- (float)((rm) * 72.0), (float)((tm) * 72.0)\
- ),\
- prn_device_body_copies_rest_(print_page_copies)
+ std_device_std_color_full_body_type(dtype, &procs, dname, &st_device_printer,\
+ (int)((float)(w10) * (xdpi) / 10 + 0.5),\
+ (int)((float)(h10) * (ydpi) / 10 + 0.5),\
+ xdpi, ydpi, color_bits,\
+ (float)(-(lo) * (xdpi)), (float)(-(to) * (ydpi)),\
+ (float)((lm) * 72.0), (float)((bm) * 72.0),\
+ (float)((rm) * 72.0), (float)((tm) * 72.0)\
+ ),\
+ prn_device_body_copies_rest_(print_page_copies)
#define prn_device_std_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page_copies)\
prn_device_std_margins_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi,\
@@ -499,7 +499,7 @@ extern const gx_device_procs prn_std_procs;
*/
/* VMS limits procedure names to 31 characters. */
int gdev_prn_open_printer_seekable(gx_device *dev, bool binary_mode,
- bool seekable);
+ bool seekable);
/* BACKWARD COMPATIBILITY */
#define gdev_prn_open_printer_positionable gdev_prn_open_printer_seekable
/* open_printer defaults positionable = false */
@@ -530,17 +530,17 @@ bool gdev_prn_file_is_new(const gx_device_printer *pdev);
* If the parameters are invalid, the procedure returns -1.
*/
int gdev_prn_colors_used(gx_device *dev, int y, int height,
- gx_colors_used_t *colors_used,
- int *range_start);
+ gx_colors_used_t *colors_used,
+ int *range_start);
/*
* Determine the colors used in a saved page. We still need the device
* in order to know the total page height.
*/
int gx_page_info_colors_used(const gx_device *dev,
- const gx_band_page_info_t *page_info,
- int y, int height,
- gx_colors_used_t *colors_used,
- int *range_start);
+ const gx_band_page_info_t *page_info,
+ int y, int height,
+ gx_colors_used_t *colors_used,
+ int *range_start);
/*
* Render a subrectangle of the page into a target device provided by the
@@ -565,10 +565,10 @@ int gx_page_info_colors_used(const gx_device *dev,
* an error.
*/
int gdev_prn_render_rectangle(gx_device_printer *pdev,
- const gs_int_rect *prect,
- gx_device *target,
- const gx_render_plane_t *render_plane,
- bool clear);
+ const gs_int_rect *prect,
+ gx_device *target,
+ const gx_render_plane_t *render_plane,
+ bool clear);
/*
* Read one or more rasterized scan lines for printing.
@@ -587,9 +587,9 @@ int gdev_prn_render_rectangle(gx_device_printer *pdev,
* returned.
*/
int gdev_prn_get_lines(gx_device_printer *pdev, int y, int height,
- byte *buffer, uint bytes_per_line,
- byte **actual_buffer, uint *actual_bytes_per_line,
- const gx_render_plane_t *render_plane);
+ byte *buffer, uint bytes_per_line,
+ byte **actual_buffer, uint *actual_bytes_per_line,
+ const gx_render_plane_t *render_plane);
/*
* Read a rasterized scan line for sending to the printer.
@@ -597,7 +597,7 @@ int gdev_prn_get_lines(gx_device_printer *pdev, int y, int height,
* except that it also calls gdev_prn_clear_trailing_bits.
*/
int gdev_prn_get_bits(gx_device_printer *pdev, int y, byte *buffer,
- byte **actual_buffer);
+ byte **actual_buffer);
/*
* Copy scan lines to send to the printer. This is now DEPRECATED,
@@ -614,7 +614,7 @@ int gdev_prn_copy_scan_lines(gx_device_printer *, int, byte *, uint);
* a printer device.
*/
void gdev_prn_clear_trailing_bits(byte *data, uint raster, int height,
- const gx_device *dev);
+ const gx_device *dev);
/*
* Close the printer's output file.
@@ -638,11 +638,11 @@ int gdev_prn_print_scan_lines(gx_device *);
/* Allocate / reallocate / free printer memory. */
int gdev_prn_allocate_memory(gx_device *pdev,
- gdev_prn_space_params *space,
- int new_width, int new_height);
+ gdev_prn_space_params *space,
+ int new_width, int new_height);
int gdev_prn_reallocate_memory(gx_device *pdev,
- gdev_prn_space_params *space,
- int new_width, int new_height);
+ gdev_prn_space_params *space,
+ int new_width, int new_height);
int gdev_prn_free_memory(gx_device *pdev);
/*
@@ -653,9 +653,9 @@ int gdev_prn_free_memory(gx_device *pdev);
*/
typedef dev_proc_create_buf_device((*create_buf_device_proc_t));
int gdev_create_buf_device(create_buf_device_proc_t cbd_proc,
- gx_device **pbdev, gx_device *target, int y,
- const gx_render_plane_t *render_plane,
- gs_memory_t *mem, gx_band_complexity_t *band_complexity);
+ gx_device **pbdev, gx_device *target, int y,
+ const gx_render_plane_t *render_plane,
+ gs_memory_t *mem, gx_band_complexity_t *band_complexity);
/* BACKWARD COMPATIBILITY */
#define dev_print_scan_lines(dev)\
@@ -690,8 +690,8 @@ static dev_proc_print_page(pageproc);\
static int \
initproc(gx_device *dev)\
{ int code = gdev_prn_initialize(dev, dname, pageproc);\
- gdev_prn_init_color(dev, depth, rcproc, crproc);\
- return code;\
+ gdev_prn_init_color(dev, depth, rcproc, crproc);\
+ return code;\
}\
device_type(dtname, st_prn_device, initproc)
diff --git a/gs/base/gdevprna.c b/gs/base/gdevprna.c
index b7af18aa9..802b9e2cb 100644
--- a/gs/base/gdevprna.c
+++ b/gs/base/gdevprna.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -71,13 +71,13 @@ static gs_memory_recover_status_t
*/
int
gdev_prn_async_write_open(gx_device_printer * pwdev, int max_raster,
- int min_band_height, int max_src_image_row)
+ int min_band_height, int max_src_image_row)
{
gx_device *const pdev = (gx_device *) pwdev;
int code;
bool writer_is_open = false;
gx_device_clist_writer *const pcwdev =
- &((gx_device_clist *) pwdev)->writer;
+ &((gx_device_clist *) pwdev)->writer;
gx_device_clist_reader *pcrdev = 0;
gx_device_printer *prdev = 0;
gs_memory_t *render_memory = 0; /* renderer's mem allocator */
@@ -96,18 +96,18 @@ gdev_prn_async_write_open(gx_device_printer * pwdev, int max_raster,
/* The * 2's in the next statement are a ****** HACK ****** to deal with */
/* sandbars in the memory manager. */
if ((code = alloc_render_memory(&render_memory,
- pwdev->memory->non_gc_memory, RendererAllocationOverheadBytes + max_raster
- /* the first * 2 is not a hack */
- + (max_raster + sizeof(void *) * 2) * min_band_height
- + max_src_image_row + gx_ht_cache_default_bits_size() * 2)) < 0)
- goto open_err;
+ pwdev->memory->non_gc_memory, RendererAllocationOverheadBytes + max_raster
+ /* the first * 2 is not a hack */
+ + (max_raster + sizeof(void *) * 2) * min_band_height
+ + max_src_image_row + gx_ht_cache_default_bits_size() * 2)) < 0)
+ goto open_err;
/* Alloc & init bandlist allocators */
/* Bandlist mem is threadsafe & common to rdr/wtr, so it's used */
/* for page queue & cmd list buffers. */
if ((code = alloc_bandlist_memory
- (&pwdev->bandlist_memory, pwdev->memory->non_gc_memory)) < 0)
- goto open_err;
+ (&pwdev->bandlist_memory, pwdev->memory->non_gc_memory)) < 0)
+ goto open_err;
/* Dictate banding parameters for both renderer & writer */
/* Protect from user change, since user changing these won't be */
@@ -119,7 +119,7 @@ gdev_prn_async_write_open(gx_device_printer * pwdev, int max_raster,
code = gs_copydevice((gx_device **) & prdev, pdev, render_memory);
pcrdev = &((gx_device_clist *) prdev)->reader;
if (code < 0)
- goto open_err;
+ goto open_err;
/* -------------- Open cmd list WRITER instance of device ------- */
/* --------------------------------------------------------------- */
@@ -131,82 +131,82 @@ gdev_prn_async_write_open(gx_device_printer * pwdev, int max_raster,
/* prevent clist writer from queuing path graphics & force it to split images */
pwdev->clist_disable_mask |= clist_disable_fill_path |
- clist_disable_stroke_path | clist_disable_complex_clip |
- clist_disable_nonrect_hl_image | clist_disable_pass_thru_params;
+ clist_disable_stroke_path | clist_disable_complex_clip |
+ clist_disable_nonrect_hl_image | clist_disable_pass_thru_params;
if ((code = gdev_prn_open(pdev)) >= 0) {
- writer_is_open = true;
+ writer_is_open = true;
- /* set up constant async-specific fields in device */
- reinit_printer_into_printera(pwdev);
+ /* set up constant async-specific fields in device */
+ reinit_printer_into_printera(pwdev);
- /* keep ptr to renderer device */
- pwdev->async_renderer = prdev;
+ /* keep ptr to renderer device */
+ pwdev->async_renderer = prdev;
- /* Allocate the page queue, then initialize it */
- /* Use bandlist memory since it's shared between rdr & wtr */
- if ((pwdev->page_queue = gx_page_queue_alloc(pwdev->bandlist_memory)) == 0)
- code = gs_note_error(gs_error_VMerror);
- else
- /* Allocate from clist allocator since it is thread-safe */
- code = gx_page_queue_init(pwdev->page_queue, pwdev->bandlist_memory);
+ /* Allocate the page queue, then initialize it */
+ /* Use bandlist memory since it's shared between rdr & wtr */
+ if ((pwdev->page_queue = gx_page_queue_alloc(pwdev->bandlist_memory)) == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else
+ /* Allocate from clist allocator since it is thread-safe */
+ code = gx_page_queue_init(pwdev->page_queue, pwdev->bandlist_memory);
}
/* ------------ Open cmd list RENDERER instance of device ------- */
/* --------------------------------------------------------------- */
if (code >= 0) {
- gx_semaphore_t *open_semaphore;
-
- /* Force writer's actual band params into reader's requested params */
- prdev->space_params.band = pcwdev->page_info.band_params;
-
- /* copydevice has already set up prdev->memory = render_memory */
- /* prdev->bandlist_memory = pwdev->bandlist_memory; */
- prdev->buffer_memory = prdev->memory;
-
- /* enable renderer to accept changes to params computed by writer */
- prdev->space_params.params_are_read_only = false;
-
- /* page queue is common to both devices */
- prdev->page_queue = pwdev->page_queue;
-
- /* Start renderer thread & wait for its successful open of device */
- if (!(open_semaphore = gx_semaphore_alloc(prdev->memory)))
- code = gs_note_error(gs_error_VMerror);
- else {
- gdev_prn_start_render_params thread_params;
-
- thread_params.writer_device = pwdev;
- thread_params.open_semaphore = open_semaphore;
- thread_params.open_code = 0;
- code = (*pwdev->printer_procs.start_render_thread)
- (&thread_params);
- if (code >= 0)
- gx_semaphore_wait(open_semaphore);
- code = thread_params.open_code;
- gx_semaphore_free(open_semaphore);
- }
+ gx_semaphore_t *open_semaphore;
+
+ /* Force writer's actual band params into reader's requested params */
+ prdev->space_params.band = pcwdev->page_info.band_params;
+
+ /* copydevice has already set up prdev->memory = render_memory */
+ /* prdev->bandlist_memory = pwdev->bandlist_memory; */
+ prdev->buffer_memory = prdev->memory;
+
+ /* enable renderer to accept changes to params computed by writer */
+ prdev->space_params.params_are_read_only = false;
+
+ /* page queue is common to both devices */
+ prdev->page_queue = pwdev->page_queue;
+
+ /* Start renderer thread & wait for its successful open of device */
+ if (!(open_semaphore = gx_semaphore_alloc(prdev->memory)))
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ gdev_prn_start_render_params thread_params;
+
+ thread_params.writer_device = pwdev;
+ thread_params.open_semaphore = open_semaphore;
+ thread_params.open_code = 0;
+ code = (*pwdev->printer_procs.start_render_thread)
+ (&thread_params);
+ if (code >= 0)
+ gx_semaphore_wait(open_semaphore);
+ code = thread_params.open_code;
+ gx_semaphore_free(open_semaphore);
+ }
}
/* ----- Set the recovery procedure for the mem allocator ----- */
if (code >= 0) {
- gs_memory_retrying_set_recover(
- (gs_memory_retrying_t *)pwdev->memory->non_gc_memory,
- prna_mem_recover,
- (void *)pcwdev
- );
+ gs_memory_retrying_set_recover(
+ (gs_memory_retrying_t *)pwdev->memory->non_gc_memory,
+ prna_mem_recover,
+ (void *)pcwdev
+ );
}
/* --------------------- Wrap up --------------------------------- */
/* --------------------------------------------------------------- */
if (code < 0) {
open_err:
- /* error mop-up */
- if (render_memory && !prdev)
- free_render_memory(render_memory);
-
- gdev_prn_dealloc(pwdev);
- if (writer_is_open) {
- gdev_prn_close(pdev);
- pwdev->free_up_bandlist_memory = 0;
- }
+ /* error mop-up */
+ if (render_memory && !prdev)
+ free_render_memory(render_memory);
+
+ gdev_prn_dealloc(pwdev);
+ if (writer_is_open) {
+ gdev_prn_close(pdev);
+ pwdev->free_up_bandlist_memory = 0;
+ }
}
return code;
}
@@ -221,21 +221,21 @@ prna_mem_recover(gs_memory_retrying_t *rmem, void *proc_data)
gx_device_clist_writer *cldev = proc_data;
if (cldev->free_up_bandlist_memory != NULL)
- pages_remain =
- (*cldev->free_up_bandlist_memory)( (gx_device *)cldev, false );
+ pages_remain =
+ (*cldev->free_up_bandlist_memory)( (gx_device *)cldev, false );
return (pages_remain > 0) ? RECOVER_STATUS_RETRY_OK : RECOVER_STATUS_NO_RETRY;
}
/* (Re)set printer device fields which get trampled by gdevprn_open & put_params */
static void
reinit_printer_into_printera(
- gx_device_printer * const pdev /* printer to convert */
+ gx_device_printer * const pdev /* printer to convert */
)
{
/* Change some of the procedure vector to point at async procedures */
/* Originals were already saved by gdev_prn_open */
if (dev_proc(pdev, close_device) == gdev_prn_close)
- set_dev_proc(pdev, close_device, gdev_prn_async_write_close_device);
+ set_dev_proc(pdev, close_device, gdev_prn_async_write_close_device);
set_dev_proc(pdev, output_page, gdev_prn_async_write_output_page);
set_dev_proc(pdev, put_params, gdev_prn_async_write_put_params);
set_dev_proc(pdev, get_xfont_procs, gx_default_get_xfont_procs);
@@ -252,11 +252,11 @@ gdev_prn_async_write_close_device(gx_device * pdev)
{
gx_device_printer *const pwdev = (gx_device_printer *) pdev;
gx_device_clist_writer *const pcwdev =
- &((gx_device_clist *) pdev)->writer;
+ &((gx_device_clist *) pdev)->writer;
/* Signal render thread to close & terminate when done */
gx_page_queue_add_page(pcwdev, pwdev->page_queue,
- GX_PAGE_QUEUE_ACTION_TERMINATE, 0, 0);
+ GX_PAGE_QUEUE_ACTION_TERMINATE, 0, 0);
/* Wait for renderer to finish all pages & terminate req */
gx_page_queue_wait_until_empty(pwdev->page_queue);
@@ -278,21 +278,21 @@ gdev_prn_dealloc(gx_device_printer * pwdev)
/* Delete renderer device & its memory allocator */
if (prdev) {
- gs_memory_t *render_alloc = prdev->memory;
+ gs_memory_t *render_alloc = prdev->memory;
- gs_free_object(render_alloc, prdev, "gdev_prn_dealloc");
- free_render_memory(render_alloc);
+ gs_free_object(render_alloc, prdev, "gdev_prn_dealloc");
+ free_render_memory(render_alloc);
}
/* Free page queue */
if (pwdev->page_queue) {
- gx_page_queue_dnit(pwdev->page_queue);
- gs_free_object(pwdev->bandlist_memory, pwdev->page_queue,
- "gdev_prn_dealloc");
- pwdev->page_queue = 0;
+ gx_page_queue_dnit(pwdev->page_queue);
+ gs_free_object(pwdev->bandlist_memory, pwdev->page_queue,
+ "gdev_prn_dealloc");
+ pwdev->page_queue = 0;
}
/* Free memory bandlist allocators */
if (pwdev->bandlist_memory)
- free_bandlist_memory(pwdev->bandlist_memory);
+ free_bandlist_memory(pwdev->bandlist_memory);
}
/* Open the render portion of a printer device in ASYNC (overlapped) mode.
@@ -321,7 +321,7 @@ gdev_prn_async_render_close_device(gx_device_printer * prdev)
/* (Re)set renderer device fields which get trampled by gdevprn_open & put_params */
static void
reinit_printer_into_renderer(
- gx_device_printer * const pdev /* printer to convert */
+ gx_device_printer * const pdev /* printer to convert */
)
{
set_dev_proc(pdev, put_params, gdev_prn_async_render_put_params);
@@ -340,7 +340,7 @@ reinit_printer_into_renderer(
*/
int /* rets 0 ok, -ve error code if open failed */
gdev_prn_async_render_thread(
- gdev_prn_start_render_params * params
+ gdev_prn_start_render_params * params
)
{
gx_device_printer *const pwdev = params->writer_device;
@@ -350,85 +350,85 @@ gdev_prn_async_render_thread(
/* Open device, but don't use default if user didn't override */
if (prdev->printer_procs.open_render_device ==
- gx_default_open_render_device)
- code = gdev_prn_async_render_open(prdev);
+ gx_default_open_render_device)
+ code = gdev_prn_async_render_open(prdev);
else
- code = (*prdev->printer_procs.open_render_device) (prdev);
+ code = (*prdev->printer_procs.open_render_device) (prdev);
reinit_printer_into_renderer(prdev);
/* The cmd list logic assumes reader's & writer's tile caches are same size */
if (code >= 0 &&
- ((gx_device_clist *) pwdev)->writer.page_tile_cache_size !=
- ((gx_device_clist *) prdev)->writer.page_tile_cache_size) {
- gdev_prn_async_render_close_device(prdev);
- code = gs_note_error(gs_error_VMerror);
+ ((gx_device_clist *) pwdev)->writer.page_tile_cache_size !=
+ ((gx_device_clist *) prdev)->writer.page_tile_cache_size) {
+ gdev_prn_async_render_close_device(prdev);
+ code = gs_note_error(gs_error_VMerror);
}
params->open_code = code;
gx_semaphore_signal(params->open_semaphore);
if (code < 0)
- return code;
+ return code;
/* fake open, since not called by gs_opendevice */
prdev->is_open = true;
/* Successful open */
while ((entry = gx_page_queue_start_dequeue(prdev->page_queue))
- && entry->action != GX_PAGE_QUEUE_ACTION_TERMINATE) {
- /* Force printer open again if it mysteriously closed. */
- /* This shouldn't ever happen, but... */
- if (!prdev->is_open) {
- if (prdev->printer_procs.open_render_device ==
- gx_default_open_render_device)
- code = gdev_prn_async_render_open(prdev);
- else
- code = (*prdev->printer_procs.open_render_device) (prdev);
- reinit_printer_into_renderer(prdev);
-
- if (code >= 0) {
- prdev->is_open = true;
- gdev_prn_output_page((gx_device *) prdev, 0, true);
- }
- }
- if (prdev->is_open) {
- /* Force retrieved entry onto render device */
- ((gx_device_clist *) prdev)->common.page_info = entry->page_info;
-
- /* Set up device geometry */
- if (clist_setup_params((gx_device *) prdev) >= 0)
- /* Go this again, since setup_params may have trashed it */
- ((gx_device_clist *) prdev)->common.page_info = entry->page_info;
-
- /* Call appropriate renderer routine to deal w/buffer */
- /* Ignore status, since we don't know how to deal w/errors! */
- switch (entry->action) {
-
- case GX_PAGE_QUEUE_ACTION_FULL_PAGE:
- (*dev_proc(prdev, output_page))((gx_device *) prdev,
- entry->num_copies, true);
- break;
-
- case GX_PAGE_QUEUE_ACTION_PARTIAL_PAGE:
- case GX_PAGE_QUEUE_ACTION_COPY_PAGE:
- (*dev_proc(prdev, output_page))((gx_device *) prdev,
- entry->num_copies, false);
- break;
- }
- /*
- * gx_page_queue_finish_dequeue will close and free the band
- * list files, so we don't need to call clist_close_output_file.
- */
- }
- /* Finalize dequeue & free retrieved queue entry */
- gx_page_queue_finish_dequeue(entry);
+ && entry->action != GX_PAGE_QUEUE_ACTION_TERMINATE) {
+ /* Force printer open again if it mysteriously closed. */
+ /* This shouldn't ever happen, but... */
+ if (!prdev->is_open) {
+ if (prdev->printer_procs.open_render_device ==
+ gx_default_open_render_device)
+ code = gdev_prn_async_render_open(prdev);
+ else
+ code = (*prdev->printer_procs.open_render_device) (prdev);
+ reinit_printer_into_renderer(prdev);
+
+ if (code >= 0) {
+ prdev->is_open = true;
+ gdev_prn_output_page((gx_device *) prdev, 0, true);
+ }
+ }
+ if (prdev->is_open) {
+ /* Force retrieved entry onto render device */
+ ((gx_device_clist *) prdev)->common.page_info = entry->page_info;
+
+ /* Set up device geometry */
+ if (clist_setup_params((gx_device *) prdev) >= 0)
+ /* Go this again, since setup_params may have trashed it */
+ ((gx_device_clist *) prdev)->common.page_info = entry->page_info;
+
+ /* Call appropriate renderer routine to deal w/buffer */
+ /* Ignore status, since we don't know how to deal w/errors! */
+ switch (entry->action) {
+
+ case GX_PAGE_QUEUE_ACTION_FULL_PAGE:
+ (*dev_proc(prdev, output_page))((gx_device *) prdev,
+ entry->num_copies, true);
+ break;
+
+ case GX_PAGE_QUEUE_ACTION_PARTIAL_PAGE:
+ case GX_PAGE_QUEUE_ACTION_COPY_PAGE:
+ (*dev_proc(prdev, output_page))((gx_device *) prdev,
+ entry->num_copies, false);
+ break;
+ }
+ /*
+ * gx_page_queue_finish_dequeue will close and free the band
+ * list files, so we don't need to call clist_close_output_file.
+ */
+ }
+ /* Finalize dequeue & free retrieved queue entry */
+ gx_page_queue_finish_dequeue(entry);
}
/* Close device, but don't use default if user hasn't overriden. */
/* Ignore status, since returning bad status means open failed */
if (prdev->printer_procs.close_render_device ==
- gx_default_close_render_device)
- gdev_prn_async_render_close_device(prdev);
+ gx_default_close_render_device)
+ gdev_prn_async_render_close_device(prdev);
else
- (*prdev->printer_procs.close_render_device)(prdev);
+ (*prdev->printer_procs.close_render_device)(prdev);
/* undo fake open, since not called by gs_closedevice */
prdev->is_open = false;
@@ -446,7 +446,7 @@ static int
gdev_prn_async_write_put_params(gx_device * pdev, gs_param_list * plist)
{
gx_device_clist_writer *const pclwdev =
- &((gx_device_clist *) pdev)->writer;
+ &((gx_device_clist *) pdev)->writer;
gx_device_printer *const pwdev = (gx_device_printer *) pdev;
gdev_prn_space_params save_sp = pwdev->space_params;
int save_height = pwdev->height;
@@ -454,7 +454,7 @@ gdev_prn_async_write_put_params(gx_device * pdev, gs_param_list * plist)
int code, ecode;
if (!pwdev->is_open)
- return (*pwdev->orig_procs.put_params) (pdev, plist);
+ return (*pwdev->orig_procs.put_params) (pdev, plist);
/*
* First, cascade to real device's put_params.
@@ -478,56 +478,56 @@ gdev_prn_async_write_put_params(gx_device * pdev, gs_param_list * plist)
/* Flush device or emit to command list, depending if device changed geometry */
if (memcmp(&pwdev->space_params, &save_sp, sizeof(save_sp)) != 0 ||
- pwdev->width != save_width || pwdev->height != save_height
- ) {
- int pageq_remaining;
- int new_width = pwdev->width;
- int new_height = pwdev->height;
- gdev_prn_space_params new_sp = pwdev->space_params;
-
- /* Need to start a new page, reallocate clist memory */
- pwdev->width = save_width;
- pwdev->height = save_height;
- pwdev->space_params = save_sp;
-
- /* First, get rid of any pending partial pages */
- code = flush_page(pwdev, false);
-
- /* Free and reallocate the printer memory. */
- pageq_remaining = 1; /* assume there are pages left in queue */
- do {
- ecode =
- gdev_prn_reallocate_memory(pdev,
- &new_sp, new_width, new_height);
- if (ecode >= 0)
- break; /* managed to recover enough memory */
- if (!pdev->is_open) {
- /* Disaster! Device was forced closed, which async drivers */
- /* aren't suppsed to do. */
- gdev_prn_async_write_close_device(pdev);
- return ecode; /* caller 'spozed to know could be closed now */
- }
- pclwdev->error_is_retryable = (ecode == gs_error_VMerror);
- }
- while (pageq_remaining >= 1 &&
- (pageq_remaining = ecode =
- clist_VMerror_recover(pclwdev, ecode)) >= 0);
- if (ecode < 0) {
- gdev_prn_free_memory(pdev);
- pclwdev->is_open = false;
- code = ecode;
- }
+ pwdev->width != save_width || pwdev->height != save_height
+ ) {
+ int pageq_remaining;
+ int new_width = pwdev->width;
+ int new_height = pwdev->height;
+ gdev_prn_space_params new_sp = pwdev->space_params;
+
+ /* Need to start a new page, reallocate clist memory */
+ pwdev->width = save_width;
+ pwdev->height = save_height;
+ pwdev->space_params = save_sp;
+
+ /* First, get rid of any pending partial pages */
+ code = flush_page(pwdev, false);
+
+ /* Free and reallocate the printer memory. */
+ pageq_remaining = 1; /* assume there are pages left in queue */
+ do {
+ ecode =
+ gdev_prn_reallocate_memory(pdev,
+ &new_sp, new_width, new_height);
+ if (ecode >= 0)
+ break; /* managed to recover enough memory */
+ if (!pdev->is_open) {
+ /* Disaster! Device was forced closed, which async drivers */
+ /* aren't suppsed to do. */
+ gdev_prn_async_write_close_device(pdev);
+ return ecode; /* caller 'spozed to know could be closed now */
+ }
+ pclwdev->error_is_retryable = (ecode == gs_error_VMerror);
+ }
+ while (pageq_remaining >= 1 &&
+ (pageq_remaining = ecode =
+ clist_VMerror_recover(pclwdev, ecode)) >= 0);
+ if (ecode < 0) {
+ gdev_prn_free_memory(pdev);
+ pclwdev->is_open = false;
+ code = ecode;
+ }
} else if (code >= 0) {
- do
- if ((ecode = cmd_put_params(pclwdev, plist)) >= 0)
- break;
- while ((ecode = clist_VMerror_recover(pclwdev, ecode)) >= 0);
- if (ecode < 0 && pclwdev->error_is_retryable &&
- pclwdev->driver_call_nesting == 0
- )
- ecode = clist_VMerror_recover_flush(pclwdev, ecode);
- if (ecode < 0)
- code = ecode;
+ do
+ if ((ecode = cmd_put_params(pclwdev, plist)) >= 0)
+ break;
+ while ((ecode = clist_VMerror_recover(pclwdev, ecode)) >= 0);
+ if (ecode < 0 && pclwdev->error_is_retryable &&
+ pclwdev->driver_call_nesting == 0
+ )
+ ecode = clist_VMerror_recover_flush(pclwdev, ecode);
+ if (ecode < 0)
+ code = ecode;
}
/* Reset fields that got trashed by gdev_prn_put_params and/or gdev_prn_open */
reinit_printer_into_printera(pwdev);
@@ -543,15 +543,15 @@ gdev_prn_async_write_get_hardware_params(gx_device * pdev, gs_param_list * plist
gx_device_printer *const prdev = pwdev->async_renderer;
if (!pwdev->is_open || !prdev)
- /* if not open, just use device's get hw params */
- return (dev_proc(pwdev, get_hardware_params))(pdev, plist);
+ /* if not open, just use device's get hw params */
+ return (dev_proc(pwdev, get_hardware_params))(pdev, plist);
else {
- /* wait for empty pipeline */
- gx_page_queue_wait_until_empty(pwdev->page_queue);
+ /* wait for empty pipeline */
+ gx_page_queue_wait_until_empty(pwdev->page_queue);
- /* get reader's h/w params, now that writer & reader are sync'ed */
- return (dev_proc(prdev, get_hardware_params))
- ((gx_device *) prdev, plist);
+ /* get reader's h/w params, now that writer & reader are sync'ed */
+ return (dev_proc(prdev, get_hardware_params))
+ ((gx_device *) prdev, plist);
}
}
@@ -568,23 +568,22 @@ gdev_prn_async_render_put_params(gx_device * pdev, gs_param_list * plist)
/* If device closed itself, try to open & clear it */
if (!prdev->is_open && save_is_open) {
- int code;
-
- if (prdev->printer_procs.open_render_device ==
- gx_default_open_render_device)
- code = gdev_prn_async_render_open(prdev);
- else
- code = (*prdev->printer_procs.open_render_device) (prdev);
- reinit_printer_into_renderer(prdev);
- if (code >= 0)
- /****** CLEAR PAGE SOMEHOW ******/;
- else
- return code; /* this'll cause clist to stop processing this band! */
+ int code;
+
+ if (prdev->printer_procs.open_render_device ==
+ gx_default_open_render_device)
+ code = gdev_prn_async_render_open(prdev);
+ else
+ code = (*prdev->printer_procs.open_render_device) (prdev);
+ reinit_printer_into_renderer(prdev);
+ if (code >= 0)
+ /****** CLEAR PAGE SOMEHOW ******/;
+ else
+ return code; /* this'll cause clist to stop processing this band! */
}
return 0; /* return this unless FATAL status */
}
-
/* ------ Others ------ */
/* Output page causes file to get added to page queue for later rasterizing */
@@ -593,7 +592,7 @@ gdev_prn_async_write_output_page(gx_device * pdev, int num_copies, int flush)
{
gx_device_printer *const pwdev = (gx_device_printer *) pdev;
gx_device_clist_writer *const pcwdev =
- &((gx_device_clist *) pdev)->writer;
+ &((gx_device_clist *) pdev)->writer;
int flush_code;
int add_code;
int open_code;
@@ -602,26 +601,26 @@ gdev_prn_async_write_output_page(gx_device * pdev, int num_copies, int flush)
/* do NOT close files before sending to page queue */
flush_code = clist_end_page(pcwdev);
add_code = gx_page_queue_add_page(pcwdev, pwdev->page_queue,
- (flush ? GX_PAGE_QUEUE_ACTION_FULL_PAGE :
- GX_PAGE_QUEUE_ACTION_COPY_PAGE),
- &pcwdev->page_info, num_copies);
+ (flush ? GX_PAGE_QUEUE_ACTION_FULL_PAGE :
+ GX_PAGE_QUEUE_ACTION_COPY_PAGE),
+ &pcwdev->page_info, num_copies);
if (flush && (flush_code >= 0) && (add_code >= 0)) {
- /* This page is finished */
- gx_finish_output_page(pdev, num_copies, flush);
+ /* This page is finished */
+ gx_finish_output_page(pdev, num_copies, flush);
}
/* Open new band files to take the place of ones added to page queue */
while ((open_code = (*gs_clist_device_procs.open_device)
- ((gx_device *) pdev)) == gs_error_VMerror) {
- /* Open failed, try after a page gets rendered */
- if (!gx_page_queue_wait_one_page(pwdev->page_queue)
- && one_last_time-- <= 0)
- break;
+ ((gx_device *) pdev)) == gs_error_VMerror) {
+ /* Open failed, try after a page gets rendered */
+ if (!gx_page_queue_wait_one_page(pwdev->page_queue)
+ && one_last_time-- <= 0)
+ break;
}
return
- (flush_code < 0 ? flush_code : open_code < 0 ? open_code :
- add_code < 0 ? add_code : 0);
+ (flush_code < 0 ? flush_code : open_code < 0 ? open_code :
+ add_code < 0 ? add_code : 0);
}
/* Free bandlist memory waits until the rasterizer runs enough to free some mem */
@@ -631,10 +630,10 @@ gdev_prn_async_write_free_up_bandlist_memory(gx_device * pdev, bool flush_curren
gx_device_printer *const pwdev = (gx_device_printer *) pdev;
if (flush_current) {
- int code = flush_page(pwdev, true);
+ int code = flush_page(pwdev, true);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return gx_page_queue_wait_one_page(pwdev->page_queue);
}
@@ -645,8 +644,8 @@ gdev_prn_async_write_free_up_bandlist_memory(gx_device * pdev, bool flush_curren
/* LEAVE DEVICE in a state where it must be re-opened/re-init'd */
static int /* ret 0 ok no flush, -ve error code */
flush_page(
- gx_device_printer * pwdev, /* async writer device to flush */
- bool partial /* true if only partial page */
+ gx_device_printer * pwdev, /* async writer device to flush */
+ bool partial /* true if only partial page */
)
{
gx_device_clist *const pcldev = (gx_device_clist *) pwdev;
@@ -657,23 +656,23 @@ flush_page(
/* do NOT close files before sending to page queue */
flush_code = clist_end_page(pcwdev);
add_code = gx_page_queue_add_page(pcwdev, pwdev->page_queue,
- (partial ? GX_PAGE_QUEUE_ACTION_PARTIAL_PAGE :
- GX_PAGE_QUEUE_ACTION_FULL_PAGE),
- &pcwdev->page_info, 0);
+ (partial ? GX_PAGE_QUEUE_ACTION_PARTIAL_PAGE :
+ GX_PAGE_QUEUE_ACTION_FULL_PAGE),
+ &pcwdev->page_info, 0);
/* Device no longer has BANDFILES, so it must be re-init'd by caller */
pcwdev->page_info.bfile = pcwdev->page_info.cfile = 0;
/* return the worst of the status. */
if (flush_code < 0)
- return flush_code;
+ return flush_code;
return add_code;
}
/* Flush any pending partial pages, re-open device */
static int
reopen_clist_after_flush(
- gx_device_printer * pwdev /* async writer device to flush */
+ gx_device_printer * pwdev /* async writer device to flush */
)
{
int open_code;
@@ -681,11 +680,11 @@ reopen_clist_after_flush(
/* Open new band files to take the place of ones added to page queue */
while ((open_code = (*gs_clist_device_procs.open_device)
- ((gx_device *) pwdev)) == gs_error_VMerror) {
- /* Open failed, try after a page gets rendered */
- if (!gx_page_queue_wait_one_page(pwdev->page_queue)
- && one_last_time-- <= 0)
- break;
+ ((gx_device *) pwdev)) == gs_error_VMerror) {
+ /* Open failed, try after a page gets rendered */
+ if (!gx_page_queue_wait_one_page(pwdev->page_queue)
+ && one_last_time-- <= 0)
+ break;
}
return open_code;
}
@@ -702,7 +701,7 @@ reopen_clist_after_flush(
/* Create a bandlist allocator. */
static int
alloc_bandlist_memory(gs_memory_t ** final_allocator,
- gs_memory_t * base_allocator)
+ gs_memory_t * base_allocator)
{
gs_memory_t *data_allocator = 0;
gs_memory_locked_t *locked_allocator = 0;
@@ -710,30 +709,30 @@ alloc_bandlist_memory(gs_memory_t ** final_allocator,
#if defined(DEBUG) && defined(DebugBandlistMemorySize)
code = alloc_render_memory(&data_allocator, base_allocator,
- DebugBandlistMemorySize);
+ DebugBandlistMemorySize);
if (code < 0)
- return code;
+ return code;
#else
data_allocator = (gs_memory_t *)gs_malloc_memory_init();
if (!data_allocator)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
#endif
locked_allocator = (gs_memory_locked_t *)
- gs_alloc_bytes_immovable(data_allocator, sizeof(gs_memory_locked_t),
- "alloc_bandlist_memory(locked allocator)");
+ gs_alloc_bytes_immovable(data_allocator, sizeof(gs_memory_locked_t),
+ "alloc_bandlist_memory(locked allocator)");
if (!locked_allocator)
- goto alloc_err;
+ goto alloc_err;
code = gs_memory_locked_init(locked_allocator, data_allocator);
if (code < 0)
- goto alloc_err;
+ goto alloc_err;
*final_allocator = (gs_memory_t *)locked_allocator;
return 0;
alloc_err:
if (locked_allocator)
- free_bandlist_memory((gs_memory_t *)locked_allocator);
+ free_bandlist_memory((gs_memory_t *)locked_allocator);
else if (data_allocator)
- gs_memory_free_all(data_allocator, FREE_ALL_EVERYTHING,
- "alloc_bandlist_memory(data allocator)");
+ gs_memory_free_all(data_allocator, FREE_ALL_EVERYTHING,
+ "alloc_bandlist_memory(data allocator)");
return (code < 0 ? code : gs_note_error(gs_error_VMerror));
}
@@ -745,30 +744,30 @@ free_bandlist_memory(gs_memory_t *bandlist_allocator)
gs_memory_t *data_mem = gs_memory_locked_target(lmem);
gs_memory_free_all(bandlist_allocator,
- FREE_ALL_STRUCTURES | FREE_ALL_ALLOCATOR,
- "free_bandlist_memory(locked allocator)");
+ FREE_ALL_STRUCTURES | FREE_ALL_ALLOCATOR,
+ "free_bandlist_memory(locked allocator)");
if (data_mem)
- gs_memory_free_all(data_mem, FREE_ALL_EVERYTHING,
- "free_bandlist_memory(data allocator)");
+ gs_memory_free_all(data_mem, FREE_ALL_EVERYTHING,
+ "free_bandlist_memory(data allocator)");
}
/* Create an allocator with a fixed memory limit. */
static int
alloc_render_memory(gs_memory_t **final_allocator,
- gs_memory_t *base_allocator, long space)
+ gs_memory_t *base_allocator, long space)
{
gs_ref_memory_t *rmem =
- ialloc_alloc_state((gs_memory_t *)base_allocator, space);
+ ialloc_alloc_state((gs_memory_t *)base_allocator, space);
vm_spaces spaces;
int i, code;
if (rmem == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = ialloc_add_chunk(rmem, space, "alloc_render_memory");
if (code < 0) {
- gs_memory_free_all((gs_memory_t *)rmem, FREE_ALL_EVERYTHING,
- "alloc_render_memory");
- return code;
+ gs_memory_free_all((gs_memory_t *)rmem, FREE_ALL_EVERYTHING,
+ "alloc_render_memory");
+ return code;
}
*final_allocator = (gs_memory_t *)rmem;
@@ -776,7 +775,7 @@ alloc_render_memory(gs_memory_t **final_allocator,
/* Only need this once since no other chunks will ever exist */
for ( i = 0; i < countof(spaces_indexed); ++i )
- spaces_indexed[i] = 0;
+ spaces_indexed[i] = 0;
space_local = space_global = (gs_ref_memory_t *)rmem;
spaces.vm_reclaim = gs_nogc_reclaim; /* no real GC on this chunk */
GS_RECLAIM(&spaces, false);
@@ -789,6 +788,6 @@ static void
free_render_memory(gs_memory_t *render_allocator)
{
if (render_allocator)
- gs_memory_free_all(render_allocator, FREE_ALL_EVERYTHING,
- "free_render_memory");
+ gs_memory_free_all(render_allocator, FREE_ALL_EVERYTHING,
+ "free_render_memory");
}
diff --git a/gs/base/gdevprna.h b/gs/base/gdevprna.h
index 8b7659eb0..4e34fc3c6 100644
--- a/gs/base/gdevprna.h
+++ b/gs/base/gdevprna.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,17 +23,17 @@
# include "gdevprn.h"
# include "gxsync.h"
-/*
+/*
* General
* -------
* Async drivers actually create two separate instances of the device at
* the same time. The first (the writer instance) is only used in the
- * interpretation operation; it feeds rendering commands into the command
- * lists. The second device instance is used only for rendering the
+ * interpretation operation; it feeds rendering commands into the command
+ * lists. The second device instance is used only for rendering the
* commands placed into the command list by the writer.
- * The writer builds a command list for an entire page; the command list
- * is only queued for rendering once a page's command list is completely
+ * The writer builds a command list for an entire page; the command list
+ * is only queued for rendering once a page's command list is completely
* built. The only exception to this rule is when the interpreter runs
* out of memory, or when no free command list memory is available. In
* such cases, the interpreter queues a "partial page" consisting of all
@@ -43,7 +43,7 @@
* command list memory to enable the interpreter to proceed.
* To avoid deadlocks when the system runs out of memory, special
- * memory allocation provisions are made on both the writer and
+ * memory allocation provisions are made on both the writer and
* renderer sides. On the writer side, enough "reserve" bandlist
* memory is set aside at startup time to cover the needs of queuing a
* partial page to the renderer. The renderer operates out of a fixed
@@ -59,7 +59,7 @@
* dictate the "restricted bandlist format."
* Note that the renderer's instance of the device driver uses the
- * renderer's memory. That implies that it must also operate in a small,
+ * renderer's memory. That implies that it must also operate in a small,
* fixed amount of memory, and must do all memory allocation using the
* memory allocator pointed to by the render device's ->memory member.
@@ -84,13 +84,13 @@
* Since partial page support imposes extra requirements on drivers,
* such support can be disabled by zeroing out (in the async writer open
- * routine, after calling down to gdev_prn_async_write_open) the
+ * routine, after calling down to gdev_prn_async_write_open) the
* free_up_bandlist_memory member of the driver structure. Doing so
* will, of course, cause interpretation to fail if memory runs out.
* Once the driver calls down to gdev_prn_async_write_open, the async
* support logic will create a second instance of the driver for
- * rendering, but will not open it just yet. Instead, the async logic
+ * rendering, but will not open it just yet. Instead, the async logic
* will attempt to synchronize the two device instances.
* Synchrnonizing the instances
@@ -99,7 +99,7 @@
* will call printer_procs.start_render_thread (which the driver is
* required to implement). start_render_thread must somehow either start a new
* thread or rendez-vous with an existing thread for use in rendering,
- * then return. start_render_thread must also have caused the render thread
+ * then return. start_render_thread must also have caused the render thread
* to call gdev_prn_async_render_thread, passing it as an argument a magic
* cookie passed to start_render_thread. start_render_thread will only
* return once the device has been closed and all renering has been
@@ -141,7 +141,7 @@ struct gdev_prn_start_render_params_s {
/* -------- Macros used to initialize render-specific structures ------ */
#define init_async_render_procs(xpdev, xstart_render_thread,\
- xbuffer_page, xprint_page_copies)\
+ xbuffer_page, xprint_page_copies)\
BEGIN\
(xpdev)->printer_procs.start_render_thread = (xstart_render_thread);\
(xpdev)->printer_procs.buffer_page = (xbuffer_page);\
@@ -152,11 +152,11 @@ struct gdev_prn_start_render_params_s {
/* Open this printer device in ASYNC (overlapped) mode.
*
- * This routine is always called by the concrete device's xx_open routine
+ * This routine is always called by the concrete device's xx_open routine
* in lieu of gdev_prn_open.
*/
int gdev_prn_async_write_open(gx_device_printer *pdev, int max_raster,
- int min_band_height, int max_src_image_row);
+ int min_band_height, int max_src_image_row);
/* Open the render portion of a printer device in ASYNC (overlapped) mode.
*
diff --git a/gs/base/gdevps.c b/gs/base/gdevps.c
index 4e1fee744..478eb7b06 100644
--- a/gs/base/gdevps.c
+++ b/gs/base/gdevps.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,7 +66,7 @@ typedef struct psw_path_state_s {
int num_points; /* # of points since last non-lineto */
int move; /* 1 iff last non-lineto was moveto, else 0 */
gs_point dprev[2]; /* line deltas before previous point, */
- /* if num_points - move >= 2 */
+ /* if num_points - move >= 2 */
} psw_path_state_t;
typedef struct psw_image_params_s {
@@ -89,8 +89,8 @@ typedef struct gx_device_pswrite_s {
psw_image_params_t image_cache[image_cache_size];
bool cache_toggle;
struct pf_ {
- gs_int_rect rect;
- gx_color_index color;
+ gs_int_rect rect;
+ gx_color_index color;
} page_fill;
/* Temporary state while writing a path */
psw_path_state_t path_state;
@@ -98,104 +98,104 @@ typedef struct gx_device_pswrite_s {
/* GC descriptor and procedures */
gs_private_st_suffix_add1_final(st_device_pswrite, gx_device_pswrite,
- "gx_device_pswrite", device_pswrite_enum_ptrs,
- device_pswrite_reloc_ptrs, gx_device_finalize,
- st_device_psdf, image_writer);
+ "gx_device_pswrite", device_pswrite_enum_ptrs,
+ device_pswrite_reloc_ptrs, gx_device_finalize,
+ st_device_psdf, image_writer);
#define psw_procs\
- { psw_open,\
- gx_upright_get_initial_matrix,\
- NULL, /* sync_output */\
- psw_output_page,\
- psw_close,\
- gx_default_rgb_map_rgb_color,\
- gx_default_rgb_map_color_rgb,\
- psw_fill_rectangle,\
- NULL, /* tile_rectangle */\
- psw_copy_mono,\
- psw_copy_color,\
- NULL, /* draw_line */\
- psdf_get_bits,\
- psw_get_params,\
- psw_put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device,\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- psw_fill_path,\
- psw_stroke_path,\
- psw_fill_mask,\
- gdev_vector_fill_trapezoid,\
- gdev_vector_fill_parallelogram,\
- gdev_vector_fill_triangle,\
- NULL /****** WRONG ******/, /* draw_thin_line */\
- psw_begin_image,\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL,/******psw_strip_copy_rop******/\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- psdf_get_bits_rectangle,\
- NULL, /* map_color_rgb_alpha */\
- psdf_create_compositor\
- }
+ { psw_open,\
+ gx_upright_get_initial_matrix,\
+ NULL, /* sync_output */\
+ psw_output_page,\
+ psw_close,\
+ gx_default_rgb_map_rgb_color,\
+ gx_default_rgb_map_color_rgb,\
+ psw_fill_rectangle,\
+ NULL, /* tile_rectangle */\
+ psw_copy_mono,\
+ psw_copy_color,\
+ NULL, /* draw_line */\
+ psdf_get_bits,\
+ psw_get_params,\
+ psw_put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device,\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ psw_fill_path,\
+ psw_stroke_path,\
+ psw_fill_mask,\
+ gdev_vector_fill_trapezoid,\
+ gdev_vector_fill_parallelogram,\
+ gdev_vector_fill_triangle,\
+ NULL /****** WRONG ******/, /* draw_thin_line */\
+ psw_begin_image,\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL,/******psw_strip_copy_rop******/\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ psdf_get_bits_rectangle,\
+ NULL, /* map_color_rgb_alpha */\
+ psdf_create_compositor\
+ }
const gx_device_pswrite gs_pswrite_device = {
std_device_dci_type_body(gx_device_pswrite, 0, "pswrite",
- &st_device_pswrite,
- DEFAULT_WIDTH_10THS * X_DPI / 10,
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,
- X_DPI, Y_DPI, 3, 24, 255, 255, 256, 256),
+ &st_device_pswrite,
+ DEFAULT_WIDTH_10THS * X_DPI / 10,
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,
+ X_DPI, Y_DPI, 3, 24, 255, 255, 256, 256),
psw_procs,
psdf_initial_values(psdf_version_default, 1 /*true */ ), /* (ASCII85EncodePages) */
PSWRITE_COMMON_VALUES(LanguageLevel_default, /* LanguageLevel */
- 0 /*false*/, /* ProduceEPS */
- PSWRITE_PROCSET_VERSION /* ProcSet_version */)
+ 0 /*false*/, /* ProduceEPS */
+ PSWRITE_PROCSET_VERSION /* ProcSet_version */)
};
const gx_device_pswrite gs_epswrite_device = {
std_device_dci_type_body(gx_device_pswrite, 0, "epswrite",
- &st_device_pswrite,
- DEFAULT_WIDTH_10THS * X_DPI / 10,
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,
- X_DPI, Y_DPI, 3, 24, 255, 255, 256, 256),
+ &st_device_pswrite,
+ DEFAULT_WIDTH_10THS * X_DPI / 10,
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,
+ X_DPI, Y_DPI, 3, 24, 255, 255, 256, 256),
psw_procs,
psdf_initial_values(psdf_version_default, 1 /*true */ ), /* (ASCII85EncodePages) */
PSWRITE_COMMON_VALUES(LanguageLevel_default, /* LanguageLevel */
- 1 /*true*/, /* ProduceEPS */
- PSWRITE_PROCSET_VERSION /* ProcSet_version */)
+ 1 /*true*/, /* ProduceEPS */
+ PSWRITE_PROCSET_VERSION /* ProcSet_version */)
};
/* Vector device implementation */
static int
psw_beginpage(gx_device_vector * vdev),
- psw_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
+ psw_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc),
- psw_setcolors(gx_device_vector * vdev, const gs_imager_state * pis,
+ psw_setcolors(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc),
psw_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type),
+ fixed y1, gx_path_type_t type),
psw_beginpath(gx_device_vector * vdev, gx_path_type_t type),
psw_moveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type),
+ floatp x, floatp y, gx_path_type_t type),
psw_lineto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type),
+ floatp x, floatp y, gx_path_type_t type),
psw_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type),
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type),
psw_closepath(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type),
+ floatp x_start, floatp y_start, gx_path_type_t type),
psw_endpath(gx_device_vector * vdev, gx_path_type_t type);
static const gx_device_vector_procs psw_vector_procs = {
- /* Page management */
+ /* Page management */
psw_beginpage,
- /* Imager state */
+ /* Imager state */
psdf_setlinewidth,
psdf_setlinecap,
psdf_setlinejoin,
@@ -203,11 +203,11 @@ static const gx_device_vector_procs psw_vector_procs = {
psdf_setdash,
psdf_setflat,
psdf_setlogop,
- /* Other state */
+ /* Other state */
psw_can_handle_hl_color,
psw_setcolors, /* fill & stroke colors are the same */
psw_setcolors,
- /* Paths */
+ /* Paths */
psdf_dopath,
psw_dorect,
psw_beginpath,
@@ -227,49 +227,49 @@ static const gx_device_vector_procs psw_vector_procs = {
static const char *const psw_procset[] = {
"/!{bind def}bind def/#{load def}!/N/counttomark #",
- /* <rbyte> <gbyte> <bbyte> rG - */
- /* <graybyte> G - */
+ /* <rbyte> <gbyte> <bbyte> rG - */
+ /* <graybyte> G - */
"/rG{3{3 -1 roll 255 div}repeat setrgbcolor}!/G{255 div setgray}!/K{0 G}!",
- /* <bbyte> <rgbyte> r6 - */
- /* <gbyte> <rbbyte> r5 - */
- /* <rbyte> <gbbyte> r3 - */
+ /* <bbyte> <rgbyte> r6 - */
+ /* <gbyte> <rbbyte> r5 - */
+ /* <rbyte> <gbbyte> r3 - */
"/r6{dup 3 -1 roll rG}!/r5{dup 3 1 roll rG}!/r3{dup rG}!",
"/w/setlinewidth #/J/setlinecap #",
"/j/setlinejoin #/M/setmiterlimit #/d/setdash #/i/setflat #",
"/m/moveto #/l/lineto #/c/rcurveto #",
- /* <dx1> <dy1> ... <dxn> <dyn> p - */
+ /* <dx1> <dy1> ... <dxn> <dyn> p - */
"/p{N 2 idiv{N -2 roll rlineto}repeat}!",
- /* <x> <y> <dx1> <dy1> ... <dxn> <dyn> P - */
+ /* <x> <y> <dx1> <dy1> ... <dxn> <dyn> P - */
"/P{N 0 gt{N -2 roll moveto p}if}!",
"/h{p closepath}!/H{P closepath}!",
- /* <dx> lx - */
- /* <dy> ly - */
- /* <dx2> <dy2> <dx3> <dy3> v - */
- /* <dx1> <dy1> <dx2> <dy2> y - */
+ /* <dx> lx - */
+ /* <dy> ly - */
+ /* <dx2> <dy2> <dx3> <dy3> v - */
+ /* <dx1> <dy1> <dx2> <dy2> y - */
"/lx{0 rlineto}!/ly{0 exch rlineto}!/v{0 0 6 2 roll c}!/y{2 copy c}!",
- /* <x> <y> <dx> <dy> re - */
+ /* <x> <y> <dx> <dy> re - */
"/re{4 -2 roll m exch dup lx exch ly neg lx h}!",
- /* <x> <y> <a> <b> ^ <x> <y> <a> <b> <-x> <-y> */
+ /* <x> <y> <a> <b> ^ <x> <y> <a> <b> <-x> <-y> */
"/^{3 index neg 3 index neg}!",
"/f{P fill}!/f*{P eofill}!/s{H stroke}!/S{P stroke}!",
"/q/gsave #/Q/grestore #/rf{re fill}!",
"/Y{P clip newpath}!/Y*{P eoclip newpath}!/rY{re Y}!",
- /* <w> <h> <name> <data> <?> |= <w> <h> <data> */
+ /* <w> <h> <name> <data> <?> |= <w> <h> <data> */
"/|={pop exch 4 1 roll 1 array astore cvx 3 array astore cvx exch 1 index def exec}!",
- /* <w> <h> <name> <length> <src> | <w> <h> <data> */
+ /* <w> <h> <name> <length> <src> | <w> <h> <data> */
"/|{exch string readstring |=}!",
- /* <w> <?> <name> (<length>|) + <w> <?> <name> <length> */
+ /* <w> <?> <name> (<length>|) + <w> <?> <name> <length> */
"/+{dup type/nametype eq{2 index 7 add -3 bitshift 2 index mul}if}!",
- /* <w> <h> <name> (<length>|) $ <w> <h> <data> */
+ /* <w> <h> <name> (<length>|) $ <w> <h> <data> */
"/@/currentfile #/${+ @ |}!",
- /* <file> <nbytes> <ncomp> B <proc_1> ... <proc_ncomp> true */
+ /* <file> <nbytes> <ncomp> B <proc_1> ... <proc_ncomp> true */
"/B{{2 copy string{readstring pop}aload pop 4 array astore cvx",
"3 1 roll}repeat pop pop true}!",
- /* <x> <y> <w> <h> <bpc/inv> <src> Ix <w> <h> <bps/inv> <mtx> <src> */
+ /* <x> <y> <w> <h> <bpc/inv> <src> Ix <w> <h> <bps/inv> <mtx> <src> */
"/Ix{[1 0 0 1 11 -2 roll exch neg exch neg]exch}!",
- /* <x> <y> <h> <src> , - */
- /* <x> <y> <h> <src> If - */
- /* <x> <y> <h> <src> I - */
+ /* <x> <y> <h> <src> , - */
+ /* <x> <y> <h> <src> If - */
+ /* <x> <y> <h> <src> I - */
"/,{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}!",
0
};
@@ -279,42 +279,42 @@ static const char *const psw_1_procset[] = {
};
static const char *const psw_1_x_procset[] = {
- /* <w> <h> <name> <length> <src> |X <w> <h> <data> */
- /* <w> <h> <name> (<length>|) $X <w> <h> <data> */
+ /* <w> <h> <name> <length> <src> |X <w> <h> <data> */
+ /* <w> <h> <name> (<length>|) $X <w> <h> <data> */
"/|X{exch string readhexstring |=}!/$X{+ @ |X}!",
- /* - @X <hexsrc> */
+ /* - @X <hexsrc> */
"/@X{{currentfile ( ) readhexstring pop}}!",
0
};
static const char *const psw_1_5_procset[] = {
- /* <x> <y> <w> <h> <src> <bpc> Ic - */
+ /* <x> <y> <w> <h> <src> <bpc> Ic - */
"/Ic{exch Ix false 3 colorimage}!",
0
};
static const char *const psw_2_procset[] = {
- /* <src> <w> <h> -mark- ... F <g4src> */
- /* <src> <w> <h> FX <g4src> */
+ /* <src> <w> <h> -mark- ... F <g4src> */
+ /* <src> <w> <h> FX <g4src> */
"/F{/Columns counttomark 3 add -2 roll/Rows exch/K -1/BlackIs1 true>>",
"/CCITTFaxDecode filter}!/FX{<</EndOfBlock false F}!",
- /* <src> X <a85src> */
- /* - @X <a85src> */
- /* <w> <h> <src> /&2 <w> <h> <src> <w> <h> */
+ /* <src> X <a85src> */
+ /* - @X <a85src> */
+ /* <w> <h> <src> /&2 <w> <h> <src> <w> <h> */
"/X{/ASCII85Decode filter}!/@X{@ X}!/&2{2 index 2 index}!",
- /* <w> <h> @F <w> <h> <g4src> */
- /* <w> <h> @C <w> <h> <g4a85src> */
+ /* <w> <h> @F <w> <h> <g4src> */
+ /* <w> <h> @C <w> <h> <g4a85src> */
"/@F{@ &2<<F}!/@C{@X &2 FX}!",
- /* <w> <h> <name> (<length>|) $X <w> <h> <data> */
- /* <w> <h> <?> <?> <src> &4 <w> <h> <?> <?> <src> <w> <h> */
- /* <w> <h> <name> (<length>|) $F <w> <h> <data> */
- /* <w> <h> <name> (<length>|) $C <w> <h> <data> */
+ /* <w> <h> <name> (<length>|) $X <w> <h> <data> */
+ /* <w> <h> <?> <?> <src> &4 <w> <h> <?> <?> <src> <w> <h> */
+ /* <w> <h> <name> (<length>|) $F <w> <h> <data> */
+ /* <w> <h> <name> (<length>|) $C <w> <h> <data> */
"/$X{+ @X |}!/&4{4 index 4 index}!/$F{+ @ &4<<F |}!/$C{+ @X &4 FX |}!",
- /* <w> <h> <bpc> <matrix> <decode> <interpolate> <src>IC - */
+ /* <w> <h> <bpc> <matrix> <decode> <interpolate> <src>IC - */
"/IC{3 1 roll 10 dict begin 1{/ImageType/Interpolate/Decode/DataSource",
"/ImageMatrix/BitsPerComponent/Height/Width}{exch def}forall",
"currentdict end image}!",
- /* A hack for compatibility with interpreters, which don't consume
+ /* A hack for compatibility with interpreters, which don't consume
ASCII85Decode EOD when reader stops immediately before it : */
"/~{@ read {pop} if}!",
0
@@ -335,19 +335,19 @@ psw_begin_file(gx_device_pswrite *pdev, const gs_rect *pbbox)
char const * const *p2;
if (pdev->pswrite_common.LanguageLevel < 1.5) {
- p1 = psw_1_x_procset;
- p2 = psw_1_procset;
+ p1 = psw_1_x_procset;
+ p2 = psw_1_procset;
} else if (pdev->pswrite_common.LanguageLevel > 1.5) {
- p1 = psw_1_5_procset;
- p2 = psw_2_procset;
+ p1 = psw_1_5_procset;
+ p2 = psw_2_procset;
} else {
- p1 = psw_1_x_procset;
- p2 = psw_1_5_procset;
+ p1 = psw_1_x_procset;
+ p2 = psw_1_5_procset;
}
if ((code = psw_begin_file_header(f, (gx_device *)pdev, pbbox,
- &pdev->pswrite_common,
- pdev->params.ASCII85EncodePages)) < 0 ||
+ &pdev->pswrite_common,
+ pdev->params.ASCII85EncodePages)) < 0 ||
(code = psw_print_lines(f, psw_procset)) < 0 ||
(code = psw_print_lines(f, p1)) < 0 ||
(code = psw_print_lines(f, p2)) < 0 ||
@@ -365,7 +365,7 @@ image_cache_reset(gx_device_pswrite * pdev)
int i;
for (i = 0; i < image_cache_size; ++i)
- pdev->image_cache[i].id = gx_no_bitmap_id;
+ pdev->image_cache[i].id = gx_no_bitmap_id;
pdev->cache_toggle = false;
}
@@ -374,30 +374,30 @@ image_cache_reset(gx_device_pswrite * pdev)
/* If id is gx_no_bitmap_id or enter is false, do not enter it. */
static int
image_cache_lookup(gx_device_pswrite * pdev, gx_bitmap_id id,
- int width, int height, bool enter)
+ int width, int height, bool enter)
{
int i1, i2;
psw_image_params_t *pip1;
psw_image_params_t *pip2;
if (id == gx_no_bitmap_id)
- return -1;
+ return -1;
i1 = id % image_cache_size;
pip1 = &pdev->image_cache[i1];
if (pip1->id == id && pip1->width == width && pip1->height == height) {
- return i1;
+ return i1;
}
i2 = (i1 + image_cache_reprobe_step) % image_cache_size;
pip2 = &pdev->image_cache[i2];
if (pip2->id == id && pip2->width == width && pip2->height == height) {
- return i2;
+ return i2;
}
if (enter) {
- int i = ((pdev->cache_toggle = !pdev->cache_toggle) ? i2 : i1);
- psw_image_params_t *pip = &pdev->image_cache[i];
+ int i = ((pdev->cache_toggle = !pdev->cache_toggle) ? i2 : i1);
+ psw_image_params_t *pip = &pdev->image_cache[i];
- pip->id = id, pip->width = width, pip->height = height;
- return i;
+ pip->id = id, pip->width = width, pip->height = height;
+ return i;
}
return -1;
}
@@ -413,26 +413,26 @@ psw_image_stream_setup(gx_device_pswrite * pdev, bool binary_ok)
bool save = pdev->binary_ok;
if (pdev->pswrite_common.LanguageLevel >= 2 || binary_ok) {
- pdev->binary_ok = binary_ok;
- code = psdf_begin_binary((gx_device_psdf *)pdev, pdev->image_writer);
+ pdev->binary_ok = binary_ok;
+ code = psdf_begin_binary((gx_device_psdf *)pdev, pdev->image_writer);
} else {
- /* LanguageLevel 1, binary not OK. Use ASCIIHex encoding. */
- pdev->binary_ok = true;
- code = psdf_begin_binary((gx_device_psdf *)pdev, pdev->image_writer);
- if (code >= 0) {
- stream_state *st =
- s_alloc_state(pdev->v_memory, s_AXE_template.stype,
- "psw_image_stream_setup");
-
- if (st == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- code = psdf_encode_binary(pdev->image_writer,
- &s_AXE_template, st);
- if (code >= 0)
- ((stream_AXE_state *)st)->EndOfData = false; /* no > */
- }
- }
+ /* LanguageLevel 1, binary not OK. Use ASCIIHex encoding. */
+ pdev->binary_ok = true;
+ code = psdf_begin_binary((gx_device_psdf *)pdev, pdev->image_writer);
+ if (code >= 0) {
+ stream_state *st =
+ s_alloc_state(pdev->v_memory, s_AXE_template.stype,
+ "psw_image_stream_setup");
+
+ if (st == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ code = psdf_encode_binary(pdev->image_writer,
+ &s_AXE_template, st);
+ if (code >= 0)
+ ((stream_AXE_state *)st)->EndOfData = false; /* no > */
+ }
+ }
}
pdev->binary_ok = save;
return (code < 0 ? code : !binary_ok);
@@ -443,10 +443,10 @@ static int
psw_image_cleanup(gx_device_pswrite * pdev)
{
int code = 0;
-
+
if (pdev->image_stream != 0) {
- code = psdf_end_binary(pdev->image_writer);
- memset(pdev->image_writer, 0, sizeof(*pdev->image_writer));
+ code = psdf_end_binary(pdev->image_writer);
+ memset(pdev->image_writer, 0, sizeof(*pdev->image_writer));
}
return code;
}
@@ -454,25 +454,25 @@ psw_image_cleanup(gx_device_pswrite * pdev)
/* Write data for an image. Assumes width > 0, height > 0. */
static int
psw_put_bits(stream * s, const byte * data, int data_x_bit, uint raster,
- uint width_bits, int height)
+ uint width_bits, int height)
{
const byte *row = data + (data_x_bit >> 3);
int shift = data_x_bit & 7;
int y;
for (y = 0; y < height; ++y, row += raster) {
- if (shift == 0)
- stream_write(s, row, (width_bits + 7) >> 3);
- else {
- const byte *src = row;
- int wleft = width_bits;
- int cshift = 8 - shift;
-
- for (; wleft + shift > 8; ++src, wleft -= 8)
- stream_putc(s, (byte)((*src << shift) + (src[1] >> cshift)));
- if (wleft > 0)
- stream_putc(s, (byte)((*src << shift) & (byte)(0xff00 >> wleft)));
- }
+ if (shift == 0)
+ stream_write(s, row, (width_bits + 7) >> 3);
+ else {
+ const byte *src = row;
+ int wleft = width_bits;
+ int cshift = 8 - shift;
+
+ for (; wleft + shift > 8; ++src, wleft -= 8)
+ stream_putc(s, (byte)((*src << shift) + (src[1] >> cshift)));
+ if (wleft > 0)
+ stream_putc(s, (byte)((*src << shift) & (byte)(0xff00 >> wleft)));
+ }
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
@@ -480,14 +480,14 @@ psw_put_bits(stream * s, const byte * data, int data_x_bit, uint raster,
}
static int
psw_put_image_bits(gx_device_pswrite *pdev, const char *op,
- const byte * data, int data_x, uint raster,
- int width, int height, int depth)
+ const byte * data, int data_x, uint raster,
+ int width, int height, int depth)
{
int code;
-
+
pprints1(pdev->strm, "%s\n", op);
code = psw_put_bits(pdev->image_stream, data, data_x * depth, raster,
- width * depth, height);
+ width * depth, height);
if (code < 0)
return code;
psw_image_cleanup(pdev);
@@ -495,25 +495,25 @@ psw_put_image_bits(gx_device_pswrite *pdev, const char *op,
}
static int
psw_put_image(gx_device_pswrite *pdev, const char *op, int encode,
- const byte * data, int data_x, uint raster,
- int width, int height, int depth)
+ const byte * data, int data_x, uint raster,
+ int width, int height, int depth)
{
int code = psw_image_stream_setup(pdev, !(encode & 1));
if (code < 0)
- return code;
+ return code;
if (encode & 2) {
- code = psdf_CFE_binary(pdev->image_writer, width, height, false);
- if (code < 0)
- return code;
+ code = psdf_CFE_binary(pdev->image_writer, width, height, false);
+ if (code < 0)
+ return code;
}
return psw_put_image_bits(pdev, op, data, data_x, raster,
- width, height, depth);
+ width, height, depth);
}
static int
psw_image_write(gx_device_pswrite * pdev, const char *imagestr,
- const byte * data, int data_x, uint raster, gx_bitmap_id id,
- int x, int y, int width, int height, int depth)
+ const byte * data, int data_x, uint raster, gx_bitmap_id id,
+ int x, int y, int width, int height, int depth)
{
stream *s = gdev_vector_stream((gx_device_vector *) pdev);
uint width_bits = width * depth;
@@ -524,42 +524,42 @@ psw_image_write(gx_device_pswrite * pdev, const char *imagestr,
const char *op;
if (index >= 0) {
- sprintf(str, "%d%c", index / 26, index % 26 + 'A');
- pprintd2(s, "%d %d ", x, y);
- pprints2(s, "%s %s\n", str, imagestr);
+ sprintf(str, "%d%c", index / 26, index % 26 + 'A');
+ pprintd2(s, "%d %d ", x, y);
+ pprints2(s, "%s %s\n", str, imagestr);
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
- return 0;
+ return 0;
}
pprintd4(s, "%d %d %d %d ", x, y, width, height);
encode = !pdev->binary_ok;
if (depth == 1 && width > 16 && pdev->pswrite_common.LanguageLevel >= 2) {
- /*
- * We should really look at the statistics of the image before
- * committing to using G4 encoding....
- */
- encode += 2;
+ /*
+ * We should really look at the statistics of the image before
+ * committing to using G4 encoding....
+ */
+ encode += 2;
}
if (id == gx_no_bitmap_id || width_bits * (ulong) height > 8000) {
- static const char *const uncached[4] = {
- "@", "@X", "@F", "@C"
- };
+ static const char *const uncached[4] = {
+ "@", "@X", "@F", "@C"
+ };
- stream_puts(s, uncached[encode]);
- op = imagestr;
- strcpy(endstr, "\n");
+ stream_puts(s, uncached[encode]);
+ op = imagestr;
+ strcpy(endstr, "\n");
} else {
- static const char *const cached[4] = {
- "$", "$X", "$F", "$C"
- };
-
- index = image_cache_lookup(pdev, id, width_bits, height, true);
- sprintf(str, "/%d%c", index / 26, index % 26 + 'A');
- stream_puts(s, str);
- if (depth != 1)
- pprintld1(s, " %ld", ((width_bits + 7) >> 3) * (ulong) height);
- op = cached[encode];
- sprintf(endstr, "\n%s\n", imagestr);
+ static const char *const cached[4] = {
+ "$", "$X", "$F", "$C"
+ };
+
+ index = image_cache_lookup(pdev, id, width_bits, height, true);
+ sprintf(str, "/%d%c", index / 26, index % 26 + 'A');
+ stream_puts(s, str);
+ if (depth != 1)
+ pprintld1(s, " %ld", ((width_bits + 7) >> 3) * (ulong) height);
+ op = cached[encode];
+ sprintf(endstr, "\n%s\n", imagestr);
}
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
@@ -573,33 +573,33 @@ psw_image_write(gx_device_pswrite * pdev, const char *imagestr,
* the desired property. Therefore, we only bracket binary data.
*/
if (encode & 1) {
- /* We're using ASCII encoding. */
- stream_putc(s, '\n');
- code = psw_put_image(pdev, op, encode, data, data_x, raster,
- width, height, depth);
- if (code < 0)
- return code;
+ /* We're using ASCII encoding. */
+ stream_putc(s, '\n');
+ code = psw_put_image(pdev, op, encode, data, data_x, raster,
+ width, height, depth);
+ if (code < 0)
+ return code;
} else {
- /*
- * Do a pre-pass to compute the amount of binary data for the
- * %%BeginData DSC comment.
- */
- stream poss;
-
- s_init(s, pdev->memory);
- swrite_position_only(&poss);
- pdev->strm = &poss;
- code = psw_put_image(pdev, op, encode, data, data_x, raster,
- width, height, depth);
- pdev->strm = s;
- if (code < 0)
- return code;
- pprintld1(s, "\n%%%%BeginData: %ld\n", stell(&poss));
- code = psw_put_image(pdev, op, encode, data, data_x, raster,
- width, height, depth);
- if (code < 0)
- return code;
- stream_puts(s, "\n%%EndData");
+ /*
+ * Do a pre-pass to compute the amount of binary data for the
+ * %%BeginData DSC comment.
+ */
+ stream poss;
+
+ s_init(s, pdev->memory);
+ swrite_position_only(&poss);
+ pdev->strm = &poss;
+ code = psw_put_image(pdev, op, encode, data, data_x, raster,
+ width, height, depth);
+ pdev->strm = s;
+ if (code < 0)
+ return code;
+ pprintld1(s, "\n%%%%BeginData: %ld\n", stell(&poss));
+ code = psw_put_image(pdev, op, encode, data, data_x, raster,
+ width, height, depth);
+ if (code < 0)
+ return code;
+ stream_puts(s, "\n%%EndData");
}
stream_puts(s, endstr);
if (s->end_status == ERRC)
@@ -612,7 +612,7 @@ static void
psw_put_matrix(stream * s, const gs_matrix * pmat)
{
pprintg6(s, "[%g %g %g %g %g %g]",
- pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
+ pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
}
/* Check for a deferred erasepage. */
@@ -622,19 +622,19 @@ psw_check_erasepage(gx_device_pswrite *pdev)
int code = 0;
if (pdev->page_fill.color != gx_no_color_index) {
- if (pdev->page_fill.rect.p.x != pdev->page_fill.rect.q.x
- && pdev->page_fill.rect.p.y != pdev->page_fill.rect.q.y)
- {
- code = gdev_vector_fill_rectangle((gx_device *)pdev,
- pdev->page_fill.rect.p.x,
- pdev->page_fill.rect.p.y,
- pdev->page_fill.rect.q.x -
- pdev->page_fill.rect.p.x,
- pdev->page_fill.rect.q.y -
- pdev->page_fill.rect.p.y,
- pdev->page_fill.color);
- }
- pdev->page_fill.color = gx_no_color_index;
+ if (pdev->page_fill.rect.p.x != pdev->page_fill.rect.q.x
+ && pdev->page_fill.rect.p.y != pdev->page_fill.rect.q.y)
+ {
+ code = gdev_vector_fill_rectangle((gx_device *)pdev,
+ pdev->page_fill.rect.p.x,
+ pdev->page_fill.rect.p.y,
+ pdev->page_fill.rect.q.x -
+ pdev->page_fill.rect.p.x,
+ pdev->page_fill.rect.q.y -
+ pdev->page_fill.rect.p.y,
+ pdev->page_fill.color);
+ }
+ pdev->page_fill.color = gx_no_color_index;
}
return code;
}
@@ -647,14 +647,14 @@ psw_check_erasepage(gx_device_pswrite *pdev)
END
/* Check if we write each page into separate file. */
-static bool
+static bool
psw_is_separate_pages(gx_device_vector *const vdev)
{
const char *fmt;
gs_parsed_file_name_t parsed;
int code = gx_parse_output_file_name(&parsed, &fmt, vdev->fname,
strlen(vdev->fname), vdev->memory);
-
+
return (code >= 0 && fmt != 0);
}
@@ -669,62 +669,61 @@ psw_beginpage(gx_device_vector * vdev)
stream *s = vdev->strm;
if (code < 0)
- return code;
+ return code;
if (pdev->first_page) {
- code = psw_begin_file(pdev, NULL);
+ code = psw_begin_file(pdev, NULL);
if (code < 0)
- return code;
+ return code;
}
- code = psw_write_page_header(s, (gx_device *)vdev, &pdev->pswrite_common, true,
+ code = psw_write_page_header(s, (gx_device *)vdev, &pdev->pswrite_common, true,
(psw_is_separate_pages(vdev) ? 1 : vdev->PageCount + 1),
image_cache_size);
if (code < 0)
- return code;
+ return code;
pdev->page_fill.color = gx_no_color_index;
return 0;
}
-
static int
-psw_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis1,
+psw_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis1,
const gx_drawing_color * pdc)
{
return false; /* High level color is not implemented yet. */
}
static int
-psw_setcolors(gx_device_vector * vdev, const gs_imager_state * pis1,
+psw_setcolors(gx_device_vector * vdev, const gs_imager_state * pis1,
const gx_drawing_color * pdc)
{
const gs_imager_state * pis = NULL; /* High level color is not implemented yet. */
if (!gx_dc_is_pure(pdc))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* PostScript only keeps track of a single color. */
gx_hld_save_color(pis, pdc, &vdev->saved_fill_color);
gx_hld_save_color(pis, pdc, &vdev->saved_stroke_color);
{
- stream *s = gdev_vector_stream(vdev);
- gx_color_index color = gx_dc_pure_color(pdc);
- int r = color >> 16;
- int g = (color >> 8) & 0xff;
- int b = color & 0xff;
-
- if (r == g && g == b) {
- if (r == 0)
- stream_puts(s, "K\n");
- else
- pprintd1(s, "%d G\n", r);
- } else if (r == g)
- pprintd2(s, "%d %d r6\n", b, r);
- else if (g == b)
- pprintd2(s, "%d %d r3\n", r, g);
- else if (r == b)
- pprintd2(s, "%d %d r5\n", g, b);
- else
- pprintd3(s, "%d %d %d rG\n", r, g, b);
+ stream *s = gdev_vector_stream(vdev);
+ gx_color_index color = gx_dc_pure_color(pdc);
+ int r = color >> 16;
+ int g = (color >> 8) & 0xff;
+ int b = color & 0xff;
+
+ if (r == g && g == b) {
+ if (r == 0)
+ stream_puts(s, "K\n");
+ else
+ pprintd1(s, "%d G\n", r);
+ } else if (r == g)
+ pprintd2(s, "%d %d r6\n", b, r);
+ else if (g == b)
+ pprintd2(s, "%d %d r3\n", r, g);
+ else if (r == b)
+ pprintd2(s, "%d %d r5\n", g, b);
+ else
+ pprintd3(s, "%d %d %d rG\n", r, g, b);
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
@@ -734,13 +733,13 @@ psw_setcolors(gx_device_vector * vdev, const gs_imager_state * pis1,
/* Redefine dorect to recognize rectangle fills. */
static int
psw_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1, fixed y1,
- gx_path_type_t type)
+ gx_path_type_t type)
{
if ((type & ~gx_path_type_rule) != gx_path_type_fill)
- return psdf_dorect(vdev, x0, y0, x1, y1, type);
+ return psdf_dorect(vdev, x0, y0, x1, y1, type);
pprintg4(gdev_vector_stream(vdev), "%g %g %g %g rf\n",
- fixed2float(x0), fixed2float(y0),
- fixed2float(x1 - x0), fixed2float(y1 - y0));
+ fixed2float(x0), fixed2float(y0),
+ fixed2float(x1 - x0), fixed2float(y1 - y0));
if ((gdev_vector_stream(vdev))->end_status == ERRC)
return_error(gs_error_ioerror);
return 0;
@@ -761,7 +760,7 @@ print_coord2(stream * s, floatp x, floatp y, const char *str)
{
pprintg2(s, "%g %g ", round_coord2(x), round_coord2(y));
if (str != 0)
- stream_puts(s, str);
+ stream_puts(s, str);
}
static int
@@ -770,24 +769,24 @@ psw_beginpath(gx_device_vector * vdev, gx_path_type_t type)
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
if (type & (gx_path_type_fill | gx_path_type_stroke)) {
- /*
- * fill_path and stroke_path call CHECK_BEGIN_PAGE themselves:
- * we do it here to handle polygons (trapezoid, parallelogram,
- * triangle), which don't go through fill_path.
- */
- CHECK_BEGIN_PAGE(pdev);
+ /*
+ * fill_path and stroke_path call CHECK_BEGIN_PAGE themselves:
+ * we do it here to handle polygons (trapezoid, parallelogram,
+ * triangle), which don't go through fill_path.
+ */
+ CHECK_BEGIN_PAGE(pdev);
}
pdev->path_state.num_points = 0;
pdev->path_state.move = 0;
if (type & gx_path_type_clip) {
- /*
- * This approach doesn't work for clip + fill or stroke, but that
- * combination can't occur.
- */
- stream *s = gdev_vector_stream(vdev);
-
- stream_puts(s, "Q q\n");
- gdev_vector_reset(vdev);
+ /*
+ * This approach doesn't work for clip + fill or stroke, but that
+ * combination can't occur.
+ */
+ stream *s = gdev_vector_stream(vdev);
+
+ stream_puts(s, "Q q\n");
+ gdev_vector_reset(vdev);
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
@@ -796,19 +795,19 @@ psw_beginpath(gx_device_vector * vdev, gx_path_type_t type)
static int
psw_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
if (pdev->path_state.num_points > pdev->path_state.move)
- stream_puts(s, (pdev->path_state.move ? "P\n" : "p\n"));
+ stream_puts(s, (pdev->path_state.move ? "P\n" : "p\n"));
else if (pdev->path_state.move) {
- /*
- * Two consecutive movetos -- possible only if a zero-length line
- * was discarded.
- */
- stream_puts(s, "pop pop\n");
+ /*
+ * Two consecutive movetos -- possible only if a zero-length line
+ * was discarded.
+ */
+ stream_puts(s, "pop pop\n");
}
print_coord2(s, x, y, NULL);
pdev->path_state.num_points = 1;
@@ -820,7 +819,7 @@ psw_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
static int
psw_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
double dx = x - x0, dy = y - y0;
@@ -829,29 +828,29 @@ psw_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
****** MAYBE WRONG IF PATH CONSISTS ONLY OF NULL LINES. ******
*/
if ((type & gx_path_type_stroke) || dx != 0 || dy != 0) {
- stream *s = gdev_vector_stream(vdev);
- gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
+ stream *s = gdev_vector_stream(vdev);
+ gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
- if (pdev->path_state.num_points > MAXOPSTACK / 2 - 10) {
- stream_puts(s, (pdev->path_state.move ? "P\n" : "p\n"));
+ if (pdev->path_state.num_points > MAXOPSTACK / 2 - 10) {
+ stream_puts(s, (pdev->path_state.move ? "P\n" : "p\n"));
pdev->path_state.num_points = 0;
pdev->path_state.move = 0;
}
else if (pdev->path_state.num_points > 0 &&
- !(pdev->path_state.num_points & 7)
- )
- stream_putc(s, '\n'); /* limit line length for DSC compliance */
- if (pdev->path_state.num_points - pdev->path_state.move >= 2 &&
- dx == -pdev->path_state.dprev[1].x &&
- dy == -pdev->path_state.dprev[1].y
- )
- stream_puts(s, "^ ");
- else
- print_coord2(s, dx, dy, NULL);
- pdev->path_state.num_points++;
- pdev->path_state.dprev[1] = pdev->path_state.dprev[0];
- pdev->path_state.dprev[0].x = dx;
- pdev->path_state.dprev[0].y = dy;
+ !(pdev->path_state.num_points & 7)
+ )
+ stream_putc(s, '\n'); /* limit line length for DSC compliance */
+ if (pdev->path_state.num_points - pdev->path_state.move >= 2 &&
+ dx == -pdev->path_state.dprev[1].x &&
+ dy == -pdev->path_state.dprev[1].y
+ )
+ stream_puts(s, "^ ");
+ else
+ print_coord2(s, dx, dy, NULL);
+ pdev->path_state.num_points++;
+ pdev->path_state.dprev[1] = pdev->path_state.dprev[0];
+ pdev->path_state.dprev[0].x = dx;
+ pdev->path_state.dprev[0].y = dy;
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
@@ -860,8 +859,8 @@ psw_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
static int
psw_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
double dx1 = x1 - x0, dy1 = y1 - y0;
@@ -870,19 +869,19 @@ psw_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
if (pdev->path_state.num_points > 0)
- stream_puts(s, (pdev->path_state.move ?
- (pdev->path_state.num_points == 1 ? "m\n" : "P\n") :
- "p\n"));
+ stream_puts(s, (pdev->path_state.move ?
+ (pdev->path_state.num_points == 1 ? "m\n" : "P\n") :
+ "p\n"));
if (dx1 == 0 && dy1 == 0) {
- print_coord2(s, dx2, dy2, NULL);
- print_coord2(s, dx3, dy3, "v\n");
+ print_coord2(s, dx2, dy2, NULL);
+ print_coord2(s, dx3, dy3, "v\n");
} else if (x3 == x2 && y3 == y2) {
- print_coord2(s, dx1, dy1, NULL);
- print_coord2(s, dx2, dy2, "y\n");
+ print_coord2(s, dx1, dy1, NULL);
+ print_coord2(s, dx2, dy2, "y\n");
} else {
- print_coord2(s, dx1, dy1, NULL);
- print_coord2(s, dx2, dy2, NULL);
- print_coord2(s, dx3, dy3, "c\n");
+ print_coord2(s, dx1, dy1, NULL);
+ print_coord2(s, dx2, dy2, NULL);
+ print_coord2(s, dx3, dy3, "c\n");
}
pdev->path_state.num_points = 0;
pdev->path_state.move = 0;
@@ -893,13 +892,13 @@ psw_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
static int
psw_closepath(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
stream_puts(gdev_vector_stream(vdev),
- (pdev->path_state.num_points > 0 && pdev->path_state.move ?
- "H\n" : "h\n"));
+ (pdev->path_state.num_points > 0 && pdev->path_state.move ?
+ "H\n" : "h\n"));
pdev->path_state.num_points = 0;
pdev->path_state.move = 0;
if ((gdev_vector_stream(vdev))->end_status == ERRC)
@@ -915,21 +914,21 @@ psw_endpath(gx_device_vector * vdev, gx_path_type_t type)
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
if (pdev->path_state.num_points > 0 && !pdev->path_state.move)
- stream_puts(s, "p ");
+ stream_puts(s, "p ");
if (type & gx_path_type_fill) {
- if (type & (gx_path_type_stroke | gx_path_type_clip))
- pprints1(s, "q f%s Q ", star);
- else
- pprints1(s, "f%s\n", star);
+ if (type & (gx_path_type_stroke | gx_path_type_clip))
+ pprints1(s, "q f%s Q ", star);
+ else
+ pprints1(s, "f%s\n", star);
}
if (type & gx_path_type_stroke) {
- if (type & gx_path_type_clip)
- stream_puts(s, "q S Q ");
- else
- stream_puts(s, "S\n");
+ if (type & gx_path_type_clip)
+ stream_puts(s, "q S Q ");
+ else
+ stream_puts(s, "S\n");
}
if (type & gx_path_type_clip)
- pprints1(s, "Y%s\n", star);
+ pprints1(s, "Y%s\n", star);
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
return 0;
@@ -954,8 +953,8 @@ psw_open(gx_device * dev)
vdev->fill_options = vdev->stroke_options = gx_path_type_optimize;
pdev->binary_ok = !pdev->params.ASCII85EncodePages;
pdev->image_writer = gs_alloc_struct(mem, psdf_binary_writer,
- &st_psdf_binary_writer,
- "psw_open(image_writer)");
+ &st_psdf_binary_writer,
+ "psw_open(image_writer)");
memset(pdev->image_writer, 0, sizeof(*pdev->image_writer)); /* for GC */
image_cache_reset(pdev);
@@ -963,10 +962,10 @@ psw_open(gx_device * dev)
/* if (ppdev->OpenOutputFile) */
{
- int code = psw_open_printer(dev);
+ int code = psw_open_printer(dev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
@@ -992,19 +991,19 @@ psw_output_page(gx_device * dev, int num_copies, int flush)
gdev_vector_reset(vdev);
image_cache_reset(pdev);
if (ferror(vdev->file))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
dev->PageCount ++;
if (psw_is_separate_pages(vdev)) {
- code = psw_close_printer(dev);
+ code = psw_close_printer(dev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
- code = psw_open_printer(dev);
+ code = psw_open_printer(dev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -1019,14 +1018,14 @@ psw_close(gx_device * dev)
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
gs_free_object(pdev->v_memory, pdev->image_writer,
- "psw_close(image_writer)");
+ "psw_close(image_writer)");
pdev->image_writer = 0;
if (vdev->strm != NULL) {
- int code = psw_close_printer(dev);
+ int code = psw_close_printer(dev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
@@ -1043,9 +1042,9 @@ psw_get_params(gx_device * dev, gs_param_list * plist)
int ecode;
if (code < 0)
- return code;
+ return code;
if ((ecode = param_write_float(plist, "LanguageLevel", &pdev->pswrite_common.LanguageLevel)) < 0)
- return ecode;
+ return ecode;
return code;
}
@@ -1061,37 +1060,37 @@ psw_put_params(gx_device * dev, gs_param_list * plist)
psdf_version save_version = pdev->version;
switch (code = param_read_float(plist, (param_name = "LanguageLevel"), &ll)) {
- case 0:
- if (ll == 1.0 || ll == 1.5 || ll == 2.0 || ll == 3.0)
- break;
- code = gs_error_rangecheck;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- ;
+ case 0:
+ if (ll == 1.0 || ll == 1.5 || ll == 2.0 || ll == 3.0)
+ break;
+ code = gs_error_rangecheck;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ ;
}
if (ecode < 0)
- return ecode;
+ return ecode;
/*
* We have to set version to the new value, because the set of
* legal parameter values for psdf_put_params varies according to
* the version.
*/
{
- static const psdf_version vv[3] =
- {
- psdf_version_level1, psdf_version_level1_color,
- psdf_version_level2
- };
+ static const psdf_version vv[3] =
+ {
+ psdf_version_level1, psdf_version_level1_color,
+ psdf_version_level2
+ };
- pdev->version = vv[(int)(ll * 2) - 2];
+ pdev->version = vv[(int)(ll * 2) - 2];
}
code = gdev_psdf_put_params(dev, plist);
if (code < 0) {
- pdev->version = save_version;
- return code;
+ pdev->version = save_version;
+ return code;
}
pdev->pswrite_common.LanguageLevel = ll;
return code;
@@ -1101,7 +1100,7 @@ psw_put_params(gx_device * dev, gs_param_list * plist)
static int
psw_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_pswrite *const pdev = (gx_device_pswrite *)dev;
@@ -1113,15 +1112,15 @@ psw_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
* very first page of a document.
*/
if (!pdev->in_page && !pdev->first_page) {
- if (pdev->page_fill.color == gx_no_color_index) {
- /* Save, but don't output, the erasepage. */
- pdev->page_fill.rect.p.x = x;
- pdev->page_fill.rect.p.y = y;
- pdev->page_fill.rect.q.x = x + w;
- pdev->page_fill.rect.q.y = y + h;
- pdev->page_fill.color = color;
- return 0;
- }
+ if (pdev->page_fill.color == gx_no_color_index) {
+ /* Save, but don't output, the erasepage. */
+ pdev->page_fill.rect.p.x = x;
+ pdev->page_fill.rect.p.y = y;
+ pdev->page_fill.rect.q.x = x + w;
+ pdev->page_fill.rect.q.y = y + h;
+ pdev->page_fill.color = color;
+ return 0;
+ }
}
return gdev_vector_fill_rectangle(dev, x, y, w, h, color);
}
@@ -1130,22 +1129,22 @@ psw_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
* Open the printer's output file if necessary.
*/
-static int
+static int
psw_open_printer(gx_device * dev)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
if (vdev->strm != 0) {
- return 0;
+ return 0;
}
{
- int code = gdev_vector_open_file_options(vdev, 512,
- VECTOR_OPEN_FILE_SEQUENTIAL_OK |
- VECTOR_OPEN_FILE_BBOX);
+ int code = gdev_vector_open_file_options(vdev, 512,
+ VECTOR_OPEN_FILE_SEQUENTIAL_OK |
+ VECTOR_OPEN_FILE_BBOX);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
pdev->first_page = true;
@@ -1157,7 +1156,7 @@ psw_open_printer(gx_device * dev)
* Close the printer's output file.
*/
-static int
+static int
psw_close_printer(gx_device * dev)
{
int code;
@@ -1168,27 +1167,27 @@ psw_close_printer(gx_device * dev)
gx_device_bbox_bbox(vdev->bbox_device, &bbox);
if (pdev->first_page && !vdev->in_page) {
- /* Nothing has been written. Write the file header now. */
- code = psw_begin_file(pdev, &bbox);
+ /* Nothing has been written. Write the file header now. */
+ code = psw_begin_file(pdev, &bbox);
if (code < 0)
return code;
} else {
- /* If there is an incomplete page, complete it now. */
- if (vdev->in_page) {
- /*
- * Flush the stream after writing page trailer.
- */
-
- stream *s = vdev->strm;
- code = psw_write_page_trailer(vdev->file, 1, 1);
+ /* If there is an incomplete page, complete it now. */
+ if (vdev->in_page) {
+ /*
+ * Flush the stream after writing page trailer.
+ */
+
+ stream *s = vdev->strm;
+ code = psw_write_page_trailer(vdev->file, 1, 1);
if(code < 0)
return code;
- sflush(s);
+ sflush(s);
- dev->PageCount++;
- }
+ dev->PageCount++;
+ }
}
- code = psw_end_file(f, dev, &pdev->pswrite_common, &bbox,
+ code = psw_end_file(f, dev, &pdev->pswrite_common, &bbox,
(psw_is_separate_pages(vdev) ? 1 : vdev->PageCount));
if(code < 0)
return code;
@@ -1201,8 +1200,8 @@ psw_close_printer(gx_device * dev)
/* Copy a monochrome bitmap. */
static int
psw_copy_mono(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
@@ -1212,42 +1211,42 @@ psw_copy_mono(gx_device * dev, const byte * data,
CHECK_BEGIN_PAGE(pdev);
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
(*dev_proc(vdev->bbox_device, copy_mono))
- ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
- x, y, w, h, zero, one);
+ ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
+ x, y, w, h, zero, one);
if (one == gx_no_color_index) {
- set_nonclient_dev_color(&color, zero);
- code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
- NULL, &color);
- op = "If";
+ set_nonclient_dev_color(&color, zero);
+ code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
+ NULL, &color);
+ op = "If";
} else if (zero == vdev->black && one == vdev->white)
- op = "1 I";
+ op = "1 I";
else {
- if (zero != gx_no_color_index) {
- code = (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h, zero);
- if (code < 0)
- return code;
- }
- set_nonclient_dev_color(&color, one);
- code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
- NULL, &color);
- op = ",";
+ if (zero != gx_no_color_index) {
+ code = (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h, zero);
+ if (code < 0)
+ return code;
+ }
+ set_nonclient_dev_color(&color, one);
+ code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
+ NULL, &color);
+ op = ",";
}
if (code < 0)
- return 0;
+ return 0;
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
return psw_image_write(pdev, op, data, data_x, raster, id,
- x, y, w, h, 1);
+ x, y, w, h, 1);
}
/* Copy a color bitmap. */
static int
psw_copy_color(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
int depth = dev->color_info.depth;
const byte *bits = data + data_x * 3;
@@ -1258,132 +1257,132 @@ psw_copy_color(gx_device * dev,
CHECK_BEGIN_PAGE(pdev);
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
(*dev_proc(vdev->bbox_device, copy_color))
- ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
- x, y, w, h);
+ ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
+ x, y, w, h);
/*
* If this is a 1-pixel-high image, check for it being all the
* same color, and if so, fill it as a rectangle.
*/
if (h == 1 && !memcmp(bits, bits + 3, (w - 1) * 3)) {
- return (*dev_proc(dev, fill_rectangle))
- (dev, x, y, w, h, (bits[0] << 16) + (bits[1] << 8) + bits[2]);
+ return (*dev_proc(dev, fill_rectangle))
+ (dev, x, y, w, h, (bits[0] << 16) + (bits[1] << 8) + bits[2]);
}
sprintf(op, "%d Ic", depth / 3); /* RGB */
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
return psw_image_write(pdev, op, data, data_x, raster, id,
- x, y, w, h, depth);
+ x, y, w, h, depth);
}
/* Fill or stroke a path. */
/* We redefine these to skip empty paths, and to allow optimization. */
static int
psw_fill_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
CHECK_BEGIN_PAGE((gx_device_pswrite *)dev);
if (gx_path_is_void(ppath))
- return 0;
+ return 0;
/* Update the clipping path now. */
gdev_vector_update_clip_path((gx_device_vector *)dev, pcpath);
return gdev_vector_fill_path(dev, pis, ppath, params, pdevc, pcpath);
}
static int
psw_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_device_color * pdcolor, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_device_color * pdcolor, const gx_clip_path * pcpath)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
CHECK_BEGIN_PAGE((gx_device_pswrite *)dev);
if (gx_path_is_void(ppath) &&
- (gx_path_is_null(ppath) ||
- gs_currentlinecap((const gs_state *)pis) != gs_cap_round)
- )
- return 0;
+ (gx_path_is_null(ppath) ||
+ gs_currentlinecap((const gs_state *)pis) != gs_cap_round)
+ )
+ return 0;
/* Update the clipping path now. */
gdev_vector_update_clip_path(vdev, pcpath);
/* Do the right thing for oddly transformed coordinate systems.... */
{
- gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
- stream *s;
- int code;
- double scale;
- bool set_ctm;
- gs_matrix mat;
-
- if (!gx_dc_is_pure(pdcolor))
- return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
- pcpath);
- set_ctm = (bool)gdev_vector_stroke_scaling(vdev, pis, &scale, &mat);
- gdev_vector_update_clip_path(vdev, pcpath);
- code = gdev_vector_prepare_stroke((gx_device_vector *)pdev, pis, params,
- pdcolor, scale);
- if (code < 0)
- return code;
- s = pdev->strm;
- if (set_ctm) {
- stream_puts(s, "q");
- if (is_fzero2(mat.xy, mat.yx) && is_fzero2(mat.tx, mat.ty))
- pprintg2(s, " %g %g scale\n", mat.xx, mat.yy);
- else {
- psw_put_matrix(s, &mat);
- stream_puts(s, "concat\n");
- }
+ gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
+ stream *s;
+ int code;
+ double scale;
+ bool set_ctm;
+ gs_matrix mat;
+
+ if (!gx_dc_is_pure(pdcolor))
+ return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
+ set_ctm = (bool)gdev_vector_stroke_scaling(vdev, pis, &scale, &mat);
+ gdev_vector_update_clip_path(vdev, pcpath);
+ code = gdev_vector_prepare_stroke((gx_device_vector *)pdev, pis, params,
+ pdcolor, scale);
+ if (code < 0)
+ return code;
+ s = pdev->strm;
+ if (set_ctm) {
+ stream_puts(s, "q");
+ if (is_fzero2(mat.xy, mat.yx) && is_fzero2(mat.tx, mat.ty))
+ pprintg2(s, " %g %g scale\n", mat.xx, mat.yy);
+ else {
+ psw_put_matrix(s, &mat);
+ stream_puts(s, "concat\n");
+ }
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
- code = gdev_vector_dopath(vdev, ppath, gx_path_type_stroke,
- (set_ctm ? &mat : (const gs_matrix *)0));
- if (code < 0)
- return code;
- if (set_ctm)
- stream_puts(s, "Q\n");
+ code = gdev_vector_dopath(vdev, ppath, gx_path_type_stroke,
+ (set_ctm ? &mat : (const gs_matrix *)0));
+ if (code < 0)
+ return code;
+ if (set_ctm)
+ stream_puts(s, "Q\n");
}
/* We must merge in the bounding box explicitly. */
return (vdev->bbox_device == 0 ? 0 :
- dev_proc(vdev->bbox_device, stroke_path)
- ((gx_device *)vdev->bbox_device, pis, ppath, params,
- pdcolor, pcpath));
+ dev_proc(vdev->bbox_device, stroke_path)
+ ((gx_device *)vdev->bbox_device, pis, ppath, params,
+ pdcolor, pcpath));
}
/* Fill a mask. */
static int
psw_fill_mask(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
CHECK_BEGIN_PAGE(pdev);
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
/* gdev_vector_update_clip_path may output a grestore and gsave,
* causing the setting of the color to be lost. Therefore, we
* must update the clip path first.
*/
if (depth > 1 ||
- gdev_vector_update_clip_path(vdev, pcpath) < 0 ||
- gdev_vector_update_fill_color(vdev, NULL, pdcolor) < 0 ||
- gdev_vector_update_log_op(vdev, lop) < 0
- )
- return gx_default_fill_mask(dev, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth, lop, pcpath);
+ gdev_vector_update_clip_path(vdev, pcpath) < 0 ||
+ gdev_vector_update_fill_color(vdev, NULL, pdcolor) < 0 ||
+ gdev_vector_update_log_op(vdev, lop) < 0
+ )
+ return gx_default_fill_mask(dev, data, data_x, raster, id,
+ x, y, w, h, pdcolor, depth, lop, pcpath);
(*dev_proc(vdev->bbox_device, fill_mask))
- ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth, lop, pcpath);
+ ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
+ x, y, w, h, pdcolor, depth, lop, pcpath);
/* Update the clipping path now. */
gdev_vector_update_clip_path(vdev, pcpath);
return psw_image_write(pdev, ",", data, data_x, raster, id,
- x, y, w, h, 1);
+ x, y, w, h, 1);
}
/* ---------------- High-level images ---------------- */
@@ -1397,10 +1396,10 @@ static const gx_image_enum_procs_t psw_image_enum_procs = {
/* Start processing an image. */
static int
psw_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pswrite *const pdev = (gx_device_pswrite *)vdev;
@@ -1418,181 +1417,181 @@ psw_begin_image(gx_device * dev,
CHECK_BEGIN_PAGE(pdev);
pie = gs_alloc_struct(mem, gdev_vector_image_enum_t,
- &st_vector_image_enum, "psw_begin_image");
+ &st_vector_image_enum, "psw_begin_image");
if (pie == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (prect && !(prect->p.x == 0 && prect->p.y == 0 &&
- prect->q.x == pim->Width && prect->q.y == pim->Height)
- )
- goto fail;
+ prect->q.x == pim->Width && prect->q.y == pim->Height)
+ )
+ goto fail;
switch (pim->format) {
case gs_image_format_chunky:
case gs_image_format_component_planar:
- break;
+ break;
default:
- goto fail;
+ goto fail;
}
pie->memory = mem;
pie->default_info = 0; /* not used */
if (pim->ImageMask) {
- index = -1; /* bogus, not used */
- num_components = 1;
+ index = -1; /* bogus, not used */
+ num_components = 1;
} else {
- index = gs_color_space_get_index(pcs);
- num_components = gs_color_space_num_components(pcs);
- if (pim->CombineWithColor)
- goto fail;
- /*
- * We can only handle Device color spaces right now, or Indexed
- * color spaces over them, and only the default Decode [0 1 ...]
- * or [0 2^BPC-1] respectively.
- */
- switch (index) {
- case gs_color_space_index_Indexed: {
- if (pdev->pswrite_common.LanguageLevel < 2 || pcs->params.indexed.use_proc ||
- pim->Decode[0] != 0 ||
- pim->Decode[1] != (1 << pim->BitsPerComponent) - 1
- ) {
- goto fail;
- }
- pbcs = pcs->base_space;
- switch (gs_color_space_get_index(pbcs)) {
- case gs_color_space_index_DeviceGray:
- base_name = "DeviceGray"; break;
- case gs_color_space_index_DeviceRGB:
- base_name = "DeviceRGB"; break;
- case gs_color_space_index_DeviceCMYK:
- base_name = "DeviceCMYK"; break;
- default:
- goto fail;
- }
- break;
- }
- case gs_color_space_index_DeviceGray:
- case gs_color_space_index_DeviceRGB:
- case gs_color_space_index_DeviceCMYK: {
- int i;
-
- for (i = 0; i < num_components * 2; ++i)
- if (pim->Decode[i] != (i & 1))
- goto fail;
- break;
- }
- default:
- goto fail;
- }
+ index = gs_color_space_get_index(pcs);
+ num_components = gs_color_space_num_components(pcs);
+ if (pim->CombineWithColor)
+ goto fail;
+ /*
+ * We can only handle Device color spaces right now, or Indexed
+ * color spaces over them, and only the default Decode [0 1 ...]
+ * or [0 2^BPC-1] respectively.
+ */
+ switch (index) {
+ case gs_color_space_index_Indexed: {
+ if (pdev->pswrite_common.LanguageLevel < 2 || pcs->params.indexed.use_proc ||
+ pim->Decode[0] != 0 ||
+ pim->Decode[1] != (1 << pim->BitsPerComponent) - 1
+ ) {
+ goto fail;
+ }
+ pbcs = pcs->base_space;
+ switch (gs_color_space_get_index(pbcs)) {
+ case gs_color_space_index_DeviceGray:
+ base_name = "DeviceGray"; break;
+ case gs_color_space_index_DeviceRGB:
+ base_name = "DeviceRGB"; break;
+ case gs_color_space_index_DeviceCMYK:
+ base_name = "DeviceCMYK"; break;
+ default:
+ goto fail;
+ }
+ break;
+ }
+ case gs_color_space_index_DeviceGray:
+ case gs_color_space_index_DeviceRGB:
+ case gs_color_space_index_DeviceCMYK: {
+ int i;
+
+ for (i = 0; i < num_components * 2; ++i)
+ if (pim->Decode[i] != (i & 1))
+ goto fail;
+ break;
+ }
+ default:
+ goto fail;
+ }
}
if (pdev->pswrite_common.LanguageLevel < 2 && !pim->ImageMask) {
- /*
- * Restrict ourselves to Level 1 images: bits per component <= 8,
- * not indexed.
- */
- if (pim->BitsPerComponent > 8 || pbcs != pcs)
- goto fail;
+ /*
+ * Restrict ourselves to Level 1 images: bits per component <= 8,
+ * not indexed.
+ */
+ if (pim->BitsPerComponent > 8 || pbcs != pcs)
+ goto fail;
}
if (gdev_vector_begin_image(vdev, pis, pim, format, prect, pdcolor,
- pcpath, mem, &psw_image_enum_procs, pie) < 0)
- goto fail;
+ pcpath, mem, &psw_image_enum_procs, pie) < 0)
+ goto fail;
if (binary) {
- /*
- * We need to buffer the entire image in memory. Currently, the
- * only reason for this is the infamous "short image" problem: the
- * image may actually have fewer rows than its height specifies. If
- * it weren't for that, we could know the size of the binary data in
- * advance. However, this will change if we compress images.
- */
- uint bsize = MAX_IMAGE_OP +
- ((pie->bits_per_row + 7) >> 3) * pie->height;
-
- buffer = gs_alloc_bytes(mem, bsize, "psw_begin_image(buffer)");
- bs = s_alloc(mem, "psw_begin_image(buffer stream)");
- if (buffer && bs) {
+ /*
+ * We need to buffer the entire image in memory. Currently, the
+ * only reason for this is the infamous "short image" problem: the
+ * image may actually have fewer rows than its height specifies. If
+ * it weren't for that, we could know the size of the binary data in
+ * advance. However, this will change if we compress images.
+ */
+ uint bsize = MAX_IMAGE_OP +
+ ((pie->bits_per_row + 7) >> 3) * pie->height;
+
+ buffer = gs_alloc_bytes(mem, bsize, "psw_begin_image(buffer)");
+ bs = s_alloc(mem, "psw_begin_image(buffer stream)");
+ if (buffer && bs) {
s_init(bs, mem);
- swrite_string(bs, buffer, bsize);
- } else {
- /* An allocation failed. */
- gs_free_object(mem, bs, "psw_begin_image(buffer stream)");
- gs_free_object(mem, buffer, "psw_begin_image(buffer)");
- /*
- * Rather than returning VMerror, we fall back to an ASCII
- * encoding, which doesn't require a buffer stream.
- */
- buffer = 0;
- bs = 0;
- binary = false;
- }
+ swrite_string(bs, buffer, bsize);
+ } else {
+ /* An allocation failed. */
+ gs_free_object(mem, bs, "psw_begin_image(buffer stream)");
+ gs_free_object(mem, buffer, "psw_begin_image(buffer)");
+ /*
+ * Rather than returning VMerror, we fall back to an ASCII
+ * encoding, which doesn't require a buffer stream.
+ */
+ buffer = 0;
+ bs = 0;
+ binary = false;
+ }
}
if (binary) {
- /* Set up the image stream to write into the buffer. */
- stream *save = pdev->strm;
+ /* Set up the image stream to write into the buffer. */
+ stream *save = pdev->strm;
- pdev->strm = bs;
- code = psw_image_stream_setup(pdev, true);
- pdev->strm = save;
+ pdev->strm = bs;
+ code = psw_image_stream_setup(pdev, true);
+ pdev->strm = save;
} else {
- code = psw_image_stream_setup(pdev, false);
+ code = psw_image_stream_setup(pdev, false);
}
if (code < 0)
- goto fail;
+ goto fail;
/* Update the clipping path now. */
gdev_vector_update_clip_path(vdev, pcpath);
/* Write the image/colorimage/imagemask preamble. */
{
- stream *s = gdev_vector_stream((gx_device_vector *) pdev);
- const char *source = (code ? "@X" : "@");
- gs_matrix imat;
- const char *op;
-
- stream_puts(s, "q");
- (*dev_proc(dev, get_initial_matrix)) (dev, &imat);
- gs_matrix_scale(&imat, 72.0 / dev->HWResolution[0],
- 72.0 / dev->HWResolution[1], &imat);
- gs_matrix_invert(&imat, &imat);
- gs_matrix_multiply(&ctm_only(pis), &imat, &imat);
- psw_put_matrix(s, &imat);
- pprintd2(s, "concat\n%d %d ", pie->width, pie->height);
- if (pim->ImageMask) {
- stream_puts(s, (pim->Decode[0] == 0 ? "false" : "true"));
- psw_put_matrix(s, &pim->ImageMatrix);
- stream_puts(s, source);
- op = "imagemask";
- } else {
- pprintd1(s, "%d", pim->BitsPerComponent);
- psw_put_matrix(s, &pim->ImageMatrix);
- if (pbcs != pcs) {
- /* This is an Indexed color space. */
- pprints1(s, "[/Indexed /%s ", base_name);
- pprintd1(s, "%d\n", pcs->params.indexed.hival);
- /*
- * Don't write the table in binary: it might interfere
- * with DSC parsing.
- */
- s_write_ps_string(s, pcs->params.indexed.lookup.table.data,
- pcs->params.indexed.lookup.table.size,
- PRINT_ASCII85_OK);
- pprintd1(s, "\n]setcolorspace[0 %d]", (int)pim->Decode[1]);
- pprints2(s, "%s %s",
- (pim->Interpolate ? "true" : "false"), source);
- op = "IC";
- } else if (index == gs_color_space_index_DeviceGray) {
- stream_puts(s, source);
- op = "image";
- } else {
- if (format == gs_image_format_chunky)
- pprints1(s, "%s false", source);
- else {
- /* We have to use procedures. */
- stream_puts(s, source);
- pprintd2(s, " %d %d B",
- (pim->Width * pim->BitsPerComponent + 7) >> 3,
- num_components);
- }
- pprintd1(s, " %d", num_components);
- op = "colorimage";
- }
- }
- stream_putc(s, '\n');
- pprints1((bs ? bs : s), "%s\n", op);
+ stream *s = gdev_vector_stream((gx_device_vector *) pdev);
+ const char *source = (code ? "@X" : "@");
+ gs_matrix imat;
+ const char *op;
+
+ stream_puts(s, "q");
+ (*dev_proc(dev, get_initial_matrix)) (dev, &imat);
+ gs_matrix_scale(&imat, 72.0 / dev->HWResolution[0],
+ 72.0 / dev->HWResolution[1], &imat);
+ gs_matrix_invert(&imat, &imat);
+ gs_matrix_multiply(&ctm_only(pis), &imat, &imat);
+ psw_put_matrix(s, &imat);
+ pprintd2(s, "concat\n%d %d ", pie->width, pie->height);
+ if (pim->ImageMask) {
+ stream_puts(s, (pim->Decode[0] == 0 ? "false" : "true"));
+ psw_put_matrix(s, &pim->ImageMatrix);
+ stream_puts(s, source);
+ op = "imagemask";
+ } else {
+ pprintd1(s, "%d", pim->BitsPerComponent);
+ psw_put_matrix(s, &pim->ImageMatrix);
+ if (pbcs != pcs) {
+ /* This is an Indexed color space. */
+ pprints1(s, "[/Indexed /%s ", base_name);
+ pprintd1(s, "%d\n", pcs->params.indexed.hival);
+ /*
+ * Don't write the table in binary: it might interfere
+ * with DSC parsing.
+ */
+ s_write_ps_string(s, pcs->params.indexed.lookup.table.data,
+ pcs->params.indexed.lookup.table.size,
+ PRINT_ASCII85_OK);
+ pprintd1(s, "\n]setcolorspace[0 %d]", (int)pim->Decode[1]);
+ pprints2(s, "%s %s",
+ (pim->Interpolate ? "true" : "false"), source);
+ op = "IC";
+ } else if (index == gs_color_space_index_DeviceGray) {
+ stream_puts(s, source);
+ op = "image";
+ } else {
+ if (format == gs_image_format_chunky)
+ pprints1(s, "%s false", source);
+ else {
+ /* We have to use procedures. */
+ stream_puts(s, source);
+ pprintd2(s, " %d %d B",
+ (pim->Width * pim->BitsPerComponent + 7) >> 3,
+ num_components);
+ }
+ pprintd1(s, " %d", num_components);
+ op = "colorimage";
+ }
+ }
+ stream_putc(s, '\n');
+ pprints1((bs ? bs : s), "%s\n", op);
if (s->end_status == ERRC) {
gs_free_object(mem, bs, "psw_begin_image(buffer stream)");
gs_free_object(mem, buffer, "psw_begin_image(buffer)");
@@ -1607,32 +1606,32 @@ psw_begin_image(gx_device * dev,
gs_free_object(mem, buffer, "psw_begin_image(buffer)");
gs_free_object(mem, pie, "psw_begin_image");
return gx_default_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, mem, pinfo);
+ pdcolor, pcpath, mem, pinfo);
}
/* Process the next piece of an image. */
static int
psw_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_device *dev = info->dev;
gx_device_pswrite *const pdev = (gx_device_pswrite *)dev;
gdev_vector_image_enum_t *pie = (gdev_vector_image_enum_t *) info;
int code =
- gx_image_plane_data_rows(pie->bbox_info, planes, height, rows_used);
+ gx_image_plane_data_rows(pie->bbox_info, planes, height, rows_used);
int pi, j;
for (j = 0; j < *rows_used; j++) {
for (pi = 0; pi < pie->num_planes; ++pi) {
- if (pie->bits_per_row != pie->width * info->plane_depths[pi])
- return_error(gs_error_rangecheck);
- psw_put_bits(pdev->image_stream,
+ if (pie->bits_per_row != pie->width * info->plane_depths[pi])
+ return_error(gs_error_rangecheck);
+ psw_put_bits(pdev->image_stream,
planes[pi].data,
- planes[pi].data_x*info->plane_depths[pi] + planes[pi].raster*j*8,
- planes[pi].raster,
+ planes[pi].data_x*info->plane_depths[pi] + planes[pi].raster*j*8,
+ planes[pi].raster,
pie->bits_per_row,
- 1 );
+ 1 );
if (pdev->image_stream->end_status == ERRC)
return_error(gs_error_ioerror);
}
@@ -1653,31 +1652,31 @@ psw_image_end_image(gx_image_enum_common_t * info, bool draw_last)
code = gdev_vector_end_image(vdev, pie, draw_last, pdev->white);
if (code > 0) {
- stream *s = pdev->strm;
- stream *bs = pdev->image_stream;
-
- /* If we were buffering a binary image, write it now. */
- while (bs != s && bs->strm != 0)
- bs = bs->strm;
- psw_image_cleanup(pdev);
- if (bs != s) {
- /*
- * We were buffering a binary image. Write it now, with the
- * DSC comments.
- */
- gs_memory_t *mem = bs->memory;
- byte *buffer = bs->cbuf;
- long len = stell(bs);
- uint ignore;
-
- pprintld1(s, "%%%%BeginData: %ld\n", len);
- sputs(s, buffer, (uint)len, &ignore);
- stream_puts(s, "\n%%EndData");
- /* Free the buffer and its stream. */
- gs_free_object(mem, bs, "psw_image_end_image(buffer stream)");
- gs_free_object(mem, buffer, "psw_image_end_image(buffer)");
- }
- stream_puts(s, "\nQ\n");
+ stream *s = pdev->strm;
+ stream *bs = pdev->image_stream;
+
+ /* If we were buffering a binary image, write it now. */
+ while (bs != s && bs->strm != 0)
+ bs = bs->strm;
+ psw_image_cleanup(pdev);
+ if (bs != s) {
+ /*
+ * We were buffering a binary image. Write it now, with the
+ * DSC comments.
+ */
+ gs_memory_t *mem = bs->memory;
+ byte *buffer = bs->cbuf;
+ long len = stell(bs);
+ uint ignore;
+
+ pprintld1(s, "%%%%BeginData: %ld\n", len);
+ sputs(s, buffer, (uint)len, &ignore);
+ stream_puts(s, "\n%%EndData");
+ /* Free the buffer and its stream. */
+ gs_free_object(mem, bs, "psw_image_end_image(buffer stream)");
+ gs_free_object(mem, buffer, "psw_image_end_image(buffer)");
+ }
+ stream_puts(s, "\nQ\n");
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
}
diff --git a/gs/base/gdevpsd.c b/gs/base/gdevpsd.c
index 8f7ce940a..bd8ad1e37 100644
--- a/gs/base/gdevpsd.c
+++ b/gs/base/gdevpsd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -95,7 +95,7 @@ typedef struct psd_device_s {
psd_color_model color_model;
- /* ICC color profile objects, for color conversion.
+ /* ICC color profile objects, for color conversion.
These are all device link profiles. At least that
is how it appears looking at how this code
was written to work with the old icclib. Just
@@ -118,16 +118,16 @@ typedef struct psd_device_s {
} psd_device;
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(psd_device_enum_ptrs, psd_device *pdev)
{
if (index == 0)
- ENUM_RETURN(pdev->devn_params.compressed_color_list);
+ ENUM_RETURN(pdev->devn_params.compressed_color_list);
index--;
if (index < pdev->devn_params.separations.num_separations)
- ENUM_RETURN(pdev->devn_params.separations.names[index].data);
+ ENUM_RETURN(pdev->devn_params.separations.names[index].data);
ENUM_PREFIX(st_device_printer,
- pdev->devn_params.separations.num_separations);
+ pdev->devn_params.separations.num_separations);
return 0;
}
ENUM_PTRS_END
@@ -136,11 +136,11 @@ static RELOC_PTRS_WITH(psd_device_reloc_ptrs, psd_device *pdev)
{
RELOC_PREFIX(st_device_printer);
{
- int i;
+ int i;
- for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
- RELOC_PTR(psd_device, devn_params.separations.names[i].data);
- }
+ for (i = 0; i < pdev->devn_params.separations.num_separations; ++i) {
+ RELOC_PTR(psd_device, devn_params.separations.names[i].data);
+ }
}
RELOC_PTR(psd_device, devn_params.compressed_color_list);
}
@@ -152,7 +152,7 @@ RELOC_PTRS_END
static void
psd_device_finalize(void *vpdev)
{
- /* We need to deallocate the compressed_color_list.
+ /* We need to deallocate the compressed_color_list.
and the names. */
devn_free_params((gx_device*) vpdev);
gx_device_finalize(vpdev);
@@ -167,99 +167,98 @@ gs_private_st_composite_final(st_psd_device, psd_device,
*/
#define device_procs(get_color_mapping_procs, encode_color, decode_color)\
{ psd_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page, /* output_page */\
- psd_prn_close, /* close */\
- NULL, /* map_rgb_color - not used */\
- psd_map_color_rgb, /* map_color_rgb */\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- psd_get_params, /* get_params */\
- psd_put_params, /* put_params */\
- NULL, /* map_cmyk_color - not used */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- psd_get_color_comp_index, /* get_color_comp_index */\
- encode_color, /* encode_color */\
- decode_color, /* decode_color */\
- NULL, /* pattern_manage */\
- NULL, /* fill_rectangle_hl_color */\
- NULL, /* include_color_space */\
- NULL, /* fill_linear_color_scanline */\
- NULL, /* fill_linear_color_trapezoid */\
- NULL, /* fill_linear_color_triangle */\
- psd_update_spot_equivalent_colors, /* update_spot_equivalent_colors */\
- psd_ret_devn_params /* ret_devn_params */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page, /* output_page */\
+ psd_prn_close, /* close */\
+ NULL, /* map_rgb_color - not used */\
+ psd_map_color_rgb, /* map_color_rgb */\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ psd_get_params, /* get_params */\
+ psd_put_params, /* put_params */\
+ NULL, /* map_cmyk_color - not used */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ psd_get_color_comp_index, /* get_color_comp_index */\
+ encode_color, /* encode_color */\
+ decode_color, /* decode_color */\
+ NULL, /* pattern_manage */\
+ NULL, /* fill_rectangle_hl_color */\
+ NULL, /* include_color_space */\
+ NULL, /* fill_linear_color_scanline */\
+ NULL, /* fill_linear_color_trapezoid */\
+ NULL, /* fill_linear_color_triangle */\
+ psd_update_spot_equivalent_colors, /* update_spot_equivalent_colors */\
+ psd_ret_devn_params /* ret_devn_params */\
}
-
static fixed_colorant_name DeviceGrayComponents[] = {
- "Gray",
- 0 /* List terminator */
+ "Gray",
+ 0 /* List terminator */
};
static fixed_colorant_name DeviceRGBComponents[] = {
- "Red",
- "Green",
- "Blue",
- 0 /* List terminator */
+ "Red",
+ "Green",
+ "Blue",
+ 0 /* List terminator */
};
#define psd_device_body(procs, dname, ncomp, pol, depth, mg, mc, sl, cn)\
std_device_full_body_type_extended(psd_device, &procs, dname,\
- &st_psd_device,\
- (int)((long)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10),\
- (int)((long)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10),\
- X_DPI, Y_DPI,\
- GX_DEVICE_COLOR_MAX_COMPONENTS, /* MaxComponents */\
- ncomp, /* NumComp */\
- pol, /* Polarity */\
- depth, 0, /* Depth, GrayIndex */\
- mg, mc, /* MaxGray, MaxColor */\
- mg + 1, mc + 1, /* DitherGray, DitherColor */\
- sl, /* Linear & Separable? */\
- cn, /* Process color model name */\
- 0, 0, /* offsets */\
- 0, 0, 0, 0 /* margins */\
- ),\
- prn_device_body_rest_(psd_print_page)
+ &st_psd_device,\
+ (int)((long)(DEFAULT_WIDTH_10THS) * (X_DPI) / 10),\
+ (int)((long)(DEFAULT_HEIGHT_10THS) * (Y_DPI) / 10),\
+ X_DPI, Y_DPI,\
+ GX_DEVICE_COLOR_MAX_COMPONENTS, /* MaxComponents */\
+ ncomp, /* NumComp */\
+ pol, /* Polarity */\
+ depth, 0, /* Depth, GrayIndex */\
+ mg, mc, /* MaxGray, MaxColor */\
+ mg + 1, mc + 1, /* DitherGray, DitherColor */\
+ sl, /* Linear & Separable? */\
+ cn, /* Process color model name */\
+ 0, 0, /* offsets */\
+ 0, 0, 0, 0 /* margins */\
+ ),\
+ prn_device_body_rest_(psd_print_page)
/*
* PSD device with RGB process color model.
@@ -268,7 +267,7 @@ static const gx_device_procs spot_rgb_procs =
device_procs(get_psdrgb_color_mapping_procs, psd_encode_color, psd_decode_color);
const psd_device gs_psdrgb_device =
-{
+{
psd_device_body(spot_rgb_procs, "psdrgb", 3, GX_CINFO_POLARITY_ADDITIVE, 24, 255, 255, GX_CINFO_SEP_LIN, "DeviceRGB"),
/* devn_params specific parameters */
{ 8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -293,7 +292,7 @@ const psd_device gs_psdrgb_device =
* use a simple non-compressable encoding.
*/
#if USE_COMPRESSED_ENCODING
-#define NC GX_DEVICE_COLOR_MAX_COMPONENTS
+#define NC GX_DEVICE_COLOR_MAX_COMPONENTS
#define SL GX_CINFO_SEP_LIN_NONE
#define ENCODE_COLOR psd_encode_compressed_color
#define DECODE_COLOR psd_decode_compressed_color
@@ -309,10 +308,10 @@ const psd_device gs_psdrgb_device =
* PSD device with CMYK process color model and spot color support.
*/
static const gx_device_procs spot_cmyk_procs
- = device_procs(get_psd_color_mapping_procs, ENCODE_COLOR, DECODE_COLOR);
+ = device_procs(get_psd_color_mapping_procs, ENCODE_COLOR, DECODE_COLOR);
const psd_device gs_psdcmyk_device =
-{
+{
psd_device_body(spot_cmyk_procs, "psdcmyk", NC, GX_CINFO_POLARITY_SUBTRACTIVE, GCIB, 255, 255, SL, "DeviceCMYK"),
/* devn_params specific parameters */
{ 8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -362,7 +361,7 @@ gray_cs_to_psdgray_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_psdgray_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
out[0] = color_rgb_to_gray(r, g, b, NULL);
}
@@ -373,7 +372,6 @@ cmyk_cs_to_psdgray_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[
out[0] = color_cmyk_to_gray(c, m, y, k, NULL);
}
-
/*
* The following procedures are used to map the standard color spaces into
* the color components for the psdrgb device.
@@ -390,7 +388,7 @@ gray_cs_to_psdrgb_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_psdrgb_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
int i = ((psd_device *)dev)->devn_params.separations.num_separations;
@@ -403,7 +401,7 @@ rgb_cs_to_psdrgb_cm(gx_device * dev, const gs_imager_state *pis,
static void
cmyk_cs_to_psdrgb_cm(gx_device * dev,
- frac c, frac m, frac y, frac k, frac out[])
+ frac c, frac m, frac y, frac k, frac out[])
{
int i = ((psd_device *)dev)->devn_params.separations.num_separations;
@@ -424,7 +422,7 @@ gray_cs_to_psdcmyk_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_psdcmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
int * map = ((psd_device *) dev)->devn_params.separation_order_map;
@@ -433,7 +431,7 @@ rgb_cs_to_psdcmyk_cm(gx_device * dev, const gs_imager_state *pis,
static void
cmyk_cs_to_psdcmyk_cm(gx_device * dev,
- frac c, frac m, frac y, frac k, frac out[])
+ frac c, frac m, frac y, frac k, frac out[])
{
int * map = ((psd_device *) dev)->devn_params.separation_order_map;
@@ -451,31 +449,31 @@ cmyk_cs_to_spotn_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
if (link != NULL) {
- unsigned short in[4];
- unsigned short tmp[MAX_CHAN];
- int outn = xdev->cmyk_profile->num_comps_out;
+ unsigned short in[4];
+ unsigned short tmp[MAX_CHAN];
+ int outn = xdev->cmyk_profile->num_comps_out;
- in[0] = frac2ushort(c);
- in[1] = frac2ushort(m);
- in[2] = frac2ushort(y);
- in[3] = frac2ushort(k);
+ in[0] = frac2ushort(c);
+ in[1] = frac2ushort(m);
+ in[2] = frac2ushort(y);
+ in[3] = frac2ushort(k);
gscms_transform_color(link, &(in[0]),
&(tmp[0]), 2, NULL);
- for (i = 0; i < outn; i++)
- out[i] = ushort2frac(tmp[i]);
- for (; i < n + 4; i++)
- out[i] = 0;
+ for (i = 0; i < outn; i++)
+ out[i] = ushort2frac(tmp[i]);
+ for (; i < n + 4; i++)
+ out[i] = 0;
} else {
- /* If no profile given, assume CMYK */
- out[0] = c;
- out[1] = m;
- out[2] = y;
- out[3] = k;
- for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ /* If no profile given, assume CMYK */
+ out[0] = c;
+ out[1] = m;
+ out[2] = y;
+ out[3] = k;
+ for(i = 0; i < n; i++) /* Clear spot colors */
+ out[4 + i] = 0;
}
}
@@ -487,7 +485,7 @@ gray_cs_to_spotn_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotn_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
psd_device *xdev = (psd_device *)dev;
int n = xdev->devn_params.separations.num_separations;
@@ -497,27 +495,27 @@ rgb_cs_to_spotn_cm(gx_device * dev, const gs_imager_state *pis,
if (link != NULL) {
unsigned short in[3];
- unsigned short tmp[MAX_CHAN];
- int outn = xdev->rgb_profile->num_comps_out;
+ unsigned short tmp[MAX_CHAN];
+ int outn = xdev->rgb_profile->num_comps_out;
- in[0] = frac2ushort(r);
- in[1] = frac2ushort(g);
- in[2] = frac2ushort(b);
+ in[0] = frac2ushort(r);
+ in[1] = frac2ushort(g);
+ in[2] = frac2ushort(b);
gscms_transform_color(link, &(in[0]),
&(tmp[0]), 2, NULL);
- for (i = 0; i < outn; i++)
- out[i] = ushort2frac(tmp[i]);
- for (; i < n + 4; i++)
- out[i] = 0;
+ for (i = 0; i < outn; i++)
+ out[i] = ushort2frac(tmp[i]);
+ for (; i < n + 4; i++)
+ out[i] = 0;
} else {
- frac cmyk[4];
+ frac cmyk[4];
- color_rgb_to_cmyk(r, g, b, pis, cmyk, dev->memory);
- cmyk_cs_to_spotn_cm(dev, cmyk[0], cmyk[1], cmyk[2], cmyk[3],
- out);
+ color_rgb_to_cmyk(r, g, b, pis, cmyk, dev->memory);
+ cmyk_cs_to_spotn_cm(dev, cmyk[0], cmyk[1], cmyk[2], cmyk[3],
+ out);
}
}
@@ -553,15 +551,15 @@ get_psd_color_mapping_procs(const gx_device * dev)
const psd_device *xdev = (const psd_device *)dev;
if (xdev->color_model == psd_DEVICE_RGB)
- return &psdRGB_procs;
+ return &psdRGB_procs;
else if (xdev->color_model == psd_DEVICE_CMYK)
- return &psdCMYK_procs;
+ return &psdCMYK_procs;
else if (xdev->color_model == psd_DEVICE_N)
- return &psdN_procs;
+ return &psdN_procs;
else if (xdev->color_model == psd_DEVICE_GRAY)
- return &psdGray_procs;
+ return &psdGray_procs;
else
- return NULL;
+ return NULL;
}
/*
@@ -577,7 +575,7 @@ psd_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
+ color <<= bpc;
color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
@@ -597,7 +595,7 @@ psd_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out)
for (; i<ncomp; i++) {
out[ncomp - i - 1] = (gx_color_value) ((color & mask) << drop);
- color >>= bpc;
+ color >>= bpc;
}
return 0;
}
@@ -622,7 +620,7 @@ static int
psd_decode_compressed_color(gx_device * dev, gx_color_index color, gx_color_value * out)
{
return devn_decode_compressed_color(dev, color, out,
- &(((psd_device *)dev)->devn_params));
+ &(((psd_device *)dev)->devn_params));
}
/*
@@ -634,7 +632,7 @@ psd_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3])
psd_device *xdev = (psd_device *)dev;
if (xdev->color_model == psd_DEVICE_RGB)
- return psd_decode_color(dev, color, rgb);
+ return psd_decode_color(dev, color, rgb);
/* TODO: return reasonable values. */
rgb[0] = 0;
rgb[1] = 0;
@@ -651,7 +649,7 @@ psd_update_spot_equivalent_colors(gx_device *pdev, const gs_state * pgs)
psd_device * psdev = (psd_device *)pdev;
update_spot_equivalent_cmyk_colors(pdev, pgs,
- &psdev->devn_params, &psdev->equiv_cmyk_colors);
+ &psdev->devn_params, &psdev->equiv_cmyk_colors);
return 0;
}
@@ -672,8 +670,8 @@ psd_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhli
{
gsicc_rendering_param_t rendering_params;
-
- icc_profile = gsicc_get_profile_handle_file(profile_out_fn,
+
+ icc_profile = gsicc_get_profile_handle_file(profile_out_fn,
strlen(profile_out_fn), memory);
if (icc_profile == NULL)
@@ -686,7 +684,7 @@ psd_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhli
rendering_params.rendering_intent = gsPERCEPTUAL;
/* Call with a NULL destination profile since we are using a device link profile here */
- icc_link = gscms_get_link(icc_profile,
+ icc_link = gscms_get_link(icc_profile,
NULL, &rendering_params);
if (icc_link == NULL)
@@ -694,7 +692,6 @@ psd_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhli
return(0);
-
}
static int
@@ -704,21 +701,21 @@ psd_open_profiles(psd_device *xdev)
if (xdev->output_icc_link == NULL && xdev->profile_out_fn[0]) {
- code = psd_open_profile(xdev->profile_out_fn, xdev->output_profile,
+ code = psd_open_profile(xdev->profile_out_fn, xdev->output_profile,
xdev->output_icc_link, xdev->memory);
}
if (code >= 0 && xdev->rgb_icc_link == NULL && xdev->profile_rgb_fn[0]) {
- code = psd_open_profile(xdev->profile_rgb_fn, xdev->rgb_profile,
+ code = psd_open_profile(xdev->profile_rgb_fn, xdev->rgb_profile,
xdev->rgb_icc_link, xdev->memory);
}
if (code >= 0 && xdev->cmyk_icc_link == NULL && xdev->profile_cmyk_fn[0]) {
- code = psd_open_profile(xdev->profile_cmyk_fn, xdev->cmyk_profile,
+ code = psd_open_profile(xdev->profile_cmyk_fn, xdev->cmyk_profile,
xdev->cmyk_icc_link, xdev->memory);
}
@@ -742,30 +739,30 @@ psd_get_params(gx_device * pdev, gs_param_list * plist)
code = gdev_prn_get_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
code = devn_get_params(pdev, plist,
- &(xdev->devn_params), &(xdev->equiv_cmyk_colors));
+ &(xdev->devn_params), &(xdev->equiv_cmyk_colors));
if (code < 0)
- return code;
+ return code;
#if ENABLE_ICC_PROFILE
pos.data = (const byte *)xdev->profile_out_fn,
- pos.size = strlen(xdev->profile_out_fn),
- pos.persistent = false;
+ pos.size = strlen(xdev->profile_out_fn),
+ pos.persistent = false;
code = param_write_string(plist, "ProfileOut", &pos);
if (code < 0)
- return code;
+ return code;
prgbs.data = (const byte *)xdev->profile_rgb_fn,
- prgbs.size = strlen(xdev->profile_rgb_fn),
- prgbs.persistent = false;
+ prgbs.size = strlen(xdev->profile_rgb_fn),
+ prgbs.persistent = false;
code = param_write_string(plist, "ProfileRgb", &prgbs);
if (code < 0)
- return code;
+ return code;
pcmyks.data = (const byte *)xdev->profile_cmyk_fn,
- pcmyks.size = strlen(xdev->profile_cmyk_fn),
- pcmyks.persistent = false;
+ pcmyks.size = strlen(xdev->profile_cmyk_fn),
+ pcmyks.persistent = false;
code = param_write_string(plist, "ProfileCmyk", &prgbs);
#endif
@@ -775,15 +772,15 @@ psd_get_params(gx_device * pdev, gs_param_list * plist)
#if ENABLE_ICC_PROFILE
static int
psd_param_read_fn(gs_param_list *plist, const char *name,
- gs_param_string *pstr, uint max_len)
+ gs_param_string *pstr, uint max_len)
{
int code = param_read_string(plist, name, pstr);
if (code == 0) {
- if (pstr->size >= max_len)
- param_signal_error(plist, name, code = gs_error_rangecheck);
+ if (pstr->size >= max_len)
+ param_signal_error(plist, name, code = gs_error_rangecheck);
} else {
- pstr->data = 0;
+ pstr->data = 0;
}
return code;
}
@@ -794,7 +791,7 @@ static bool
param_string_eq(const gs_param_string *pcs, const char *str)
{
return (strlen(str) == pcs->size &&
- !strncmp(str, (const char *)pcs->data, pcs->size));
+ !strncmp(str, (const char *)pcs->data, pcs->size));
}
static int
@@ -802,27 +799,27 @@ psd_set_color_model(psd_device *xdev, psd_color_model color_model)
{
xdev->color_model = color_model;
if (color_model == psd_DEVICE_GRAY) {
- xdev->devn_params.std_colorant_names = DeviceGrayComponents;
- xdev->devn_params.num_std_colorant_names = 1;
- xdev->color_info.cm_name = "DeviceGray";
- xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ xdev->devn_params.std_colorant_names = DeviceGrayComponents;
+ xdev->devn_params.num_std_colorant_names = 1;
+ xdev->color_info.cm_name = "DeviceGray";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == psd_DEVICE_RGB) {
- xdev->devn_params.std_colorant_names = DeviceRGBComponents;
- xdev->devn_params.num_std_colorant_names = 3;
- xdev->color_info.cm_name = "DeviceRGB";
- xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ xdev->devn_params.std_colorant_names = DeviceRGBComponents;
+ xdev->devn_params.num_std_colorant_names = 3;
+ xdev->color_info.cm_name = "DeviceRGB";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == psd_DEVICE_CMYK) {
- xdev->devn_params.std_colorant_names = DeviceCMYKComponents;
- xdev->devn_params.num_std_colorant_names = 4;
- xdev->color_info.cm_name = "DeviceCMYK";
- xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ xdev->devn_params.std_colorant_names = DeviceCMYKComponents;
+ xdev->devn_params.num_std_colorant_names = 4;
+ xdev->color_info.cm_name = "DeviceCMYK";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (color_model == psd_DEVICE_N) {
- xdev->devn_params.std_colorant_names = DeviceCMYKComponents;
- xdev->devn_params.num_std_colorant_names = 4;
- xdev->color_info.cm_name = "DeviceN";
- xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ xdev->devn_params.std_colorant_names = DeviceCMYKComponents;
+ xdev->devn_params.num_std_colorant_names = 4;
+ xdev->color_info.cm_name = "DeviceN";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else {
- return -1;
+ return -1;
}
return 0;
@@ -845,30 +842,30 @@ psd_put_params(gx_device * pdev, gs_param_list * plist)
#if ENABLE_ICC_PROFILE
code = psd_param_read_fn(plist, "ProfileOut", &po,
- sizeof(pdevn->profile_out_fn));
+ sizeof(pdevn->profile_out_fn));
if (code >= 0)
- code = psd_param_read_fn(plist, "ProfileRgb", &prgb,
- sizeof(pdevn->profile_rgb_fn));
+ code = psd_param_read_fn(plist, "ProfileRgb", &prgb,
+ sizeof(pdevn->profile_rgb_fn));
if (code >= 0)
- code = psd_param_read_fn(plist, "ProfileCmyk", &pcmyk,
- sizeof(pdevn->profile_cmyk_fn));
+ code = psd_param_read_fn(plist, "ProfileCmyk", &pcmyk,
+ sizeof(pdevn->profile_cmyk_fn));
#endif
if (code >= 0)
- code = param_read_name(plist, "ProcessColorModel", &pcm);
+ code = param_read_name(plist, "ProcessColorModel", &pcm);
if (code == 0) {
- if (param_string_eq (&pcm, "DeviceGray"))
- color_model = psd_DEVICE_GRAY;
- else if (param_string_eq (&pcm, "DeviceRGB"))
- color_model = psd_DEVICE_RGB;
- else if (param_string_eq (&pcm, "DeviceCMYK"))
- color_model = psd_DEVICE_CMYK;
- else if (param_string_eq (&pcm, "DeviceN"))
- color_model = psd_DEVICE_N;
- else {
- param_signal_error(plist, "ProcessColorModel",
- code = gs_error_rangecheck);
- }
+ if (param_string_eq (&pcm, "DeviceGray"))
+ color_model = psd_DEVICE_GRAY;
+ else if (param_string_eq (&pcm, "DeviceRGB"))
+ color_model = psd_DEVICE_RGB;
+ else if (param_string_eq (&pcm, "DeviceCMYK"))
+ color_model = psd_DEVICE_CMYK;
+ else if (param_string_eq (&pcm, "DeviceN"))
+ color_model = psd_DEVICE_N;
+ else {
+ param_signal_error(plist, "ProcessColorModel",
+ code = gs_error_rangecheck);
+ }
}
if (code >= 0)
@@ -877,39 +874,38 @@ psd_put_params(gx_device * pdev, gs_param_list * plist)
/* handle the standard DeviceN related parameters */
if (code == 0)
code = devn_printer_put_params(pdev, plist,
- &(pdevn->devn_params), &(pdevn->equiv_cmyk_colors));
+ &(pdevn->devn_params), &(pdevn->equiv_cmyk_colors));
if (code < 0) {
- pdev->color_info = save_info;
- return code;
+ pdev->color_info = save_info;
+ return code;
}
#if ENABLE_ICC_PROFILE
/* Open any ICC profiles that have been specified. */
if (po.data != 0) {
- memcpy(pdevn->profile_out_fn, po.data, po.size);
- pdevn->profile_out_fn[po.size] = 0;
+ memcpy(pdevn->profile_out_fn, po.data, po.size);
+ pdevn->profile_out_fn[po.size] = 0;
}
if (prgb.data != 0) {
- memcpy(pdevn->profile_rgb_fn, prgb.data, prgb.size);
- pdevn->profile_rgb_fn[prgb.size] = 0;
+ memcpy(pdevn->profile_rgb_fn, prgb.data, prgb.size);
+ pdevn->profile_rgb_fn[prgb.size] = 0;
}
if (pcmyk.data != 0) {
- memcpy(pdevn->profile_cmyk_fn, pcmyk.data, pcmyk.size);
- pdevn->profile_cmyk_fn[pcmyk.size] = 0;
+ memcpy(pdevn->profile_cmyk_fn, pcmyk.data, pcmyk.size);
+ pdevn->profile_cmyk_fn[pcmyk.size] = 0;
}
if (memcmp(&pdevn->color_info, &save_info,
- size_of(gx_device_color_info)) != 0)
+ size_of(gx_device_color_info)) != 0)
code = psd_open_profiles(pdevn);
#endif
return code;
}
-
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -921,15 +917,14 @@ psd_put_params(gx_device * pdev, gs_param_list * plist)
*/
static int
psd_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
return devn_get_color_comp_index(dev,
- &(((psd_device *)dev)->devn_params),
- &(((psd_device *)dev)->equiv_cmyk_colors),
- pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
+ &(((psd_device *)dev)->devn_params),
+ &(((psd_device *)dev)->equiv_cmyk_colors),
+ pname, name_size, component_type, ENABLE_AUTO_SPOT_COLORS);
}
-
/* ------ Private definitions ------ */
/* All two-byte quantities are stored MSB-first! */
@@ -980,18 +975,18 @@ psd_setup(psd_write_ctx *xc, psd_device *dev)
* the RGB color model.
*/
for (i = 0; i < xc->base_bytes_pp + xc->n_extra_channels; i++)
- xc->chnl_to_position[i] = -1;
+ xc->chnl_to_position[i] = -1;
for (i = 0; i < xc->base_bytes_pp + xc->n_extra_channels; i++) {
- int sep_order_num = dev->devn_params.separation_order_map[i];
-
- if (sep_order_num != GX_DEVICE_COLOR_MAX_COMPONENTS) {
- if (i < NUM_CMYK_COMPONENTS) /* Do not rearrange CMYK */
- xc->chnl_to_position[i] = sep_order_num;
- else { /* Re arrange separations */
- xc->chnl_to_position[xc->num_channels] = sep_order_num;
- xc->chnl_to_orig_sep[xc->num_channels++] = i;
- }
- }
+ int sep_order_num = dev->devn_params.separation_order_map[i];
+
+ if (sep_order_num != GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ if (i < NUM_CMYK_COMPONENTS) /* Do not rearrange CMYK */
+ xc->chnl_to_position[i] = sep_order_num;
+ else { /* Re arrange separations */
+ xc->chnl_to_position[xc->num_channels] = sep_order_num;
+ xc->chnl_to_orig_sep[xc->num_channels++] = i;
+ }
+ }
}
return 0;
@@ -1003,7 +998,7 @@ psd_write(psd_write_ctx *xc, const byte *buf, int size) {
code = fwrite(buf, 1, size, xc->f);
if (code < 0)
- return code;
+ return code;
return 0;
}
@@ -1051,7 +1046,7 @@ psd_write_header(psd_write_ctx *xc, psd_device *pdev)
psd_write_32(xc, xc->width); /* Columns */
psd_write_16(xc, 8); /* Depth - 1, 8 and 16 */
psd_write_16(xc, (bits16) xc->base_bytes_pp); /* Mode - RGB=3, CMYK=4 */
-
+
/* Color Mode Data */
psd_write_32(xc, 0); /* No color mode data */
@@ -1059,25 +1054,25 @@ psd_write_header(psd_write_ctx *xc, psd_device *pdev)
/* Channel Names */
for (chan_idx = NUM_CMYK_COMPONENTS; chan_idx < xc->num_channels; chan_idx++) {
- sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
- separation_name = &(pdev->devn_params.separations.names[sep_num]);
- chan_names_len += (separation_name->size + 1);
- }
+ sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
+ separation_name = &(pdev->devn_params.separations.names[sep_num]);
+ chan_names_len += (separation_name->size + 1);
+ }
psd_write_32(xc, 12 + (chan_names_len + (chan_names_len % 2))
- + (12 + (14 * (xc->num_channels - xc->base_bytes_pp)))
- + 28);
+ + (12 + (14 * (xc->num_channels - xc->base_bytes_pp)))
+ + 28);
psd_write(xc, (const byte *)"8BIM", 4);
psd_write_16(xc, 1006); /* 0x03EE */
psd_write_16(xc, 0); /* PString */
psd_write_32(xc, chan_names_len + (chan_names_len % 2));
for (chan_idx = NUM_CMYK_COMPONENTS; chan_idx < xc->num_channels; chan_idx++) {
- sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
- separation_name = &(pdev->devn_params.separations.names[sep_num]);
- psd_write_8(xc, (byte) separation_name->size);
- psd_write(xc, separation_name->data, separation_name->size);
- }
- if (chan_names_len % 2)
- psd_write_8(xc, 0); /* pad */
+ sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
+ separation_name = &(pdev->devn_params.separations.names[sep_num]);
+ psd_write_8(xc, (byte) separation_name->size);
+ psd_write(xc, separation_name->data, separation_name->size);
+ }
+ if (chan_names_len % 2)
+ psd_write_8(xc, 0); /* pad */
/* DisplayInfo - Colors for each spot channels */
psd_write(xc, (const byte *)"8BIM", 4);
@@ -1085,27 +1080,27 @@ psd_write_header(psd_write_ctx *xc, psd_device *pdev)
psd_write_16(xc, 0); /* PString */
psd_write_32(xc, 14 * (xc->num_channels - xc->base_bytes_pp)); /* Length */
for (chan_idx = NUM_CMYK_COMPONENTS; chan_idx < xc->num_channels; chan_idx++) {
- sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
- psd_write_16(xc, 02); /* CMYK */
- /* PhotoShop stores all component values as if they were additive. */
- if (pdev->equiv_cmyk_colors.color[sep_num].color_info_valid) {
+ sep_num = xc->chnl_to_orig_sep[chan_idx] - NUM_CMYK_COMPONENTS;
+ psd_write_16(xc, 02); /* CMYK */
+ /* PhotoShop stores all component values as if they were additive. */
+ if (pdev->equiv_cmyk_colors.color[sep_num].color_info_valid) {
#define convert_color(component) ((bits16)((65535 * ((double)\
(frac_1 - pdev->equiv_cmyk_colors.color[sep_num].component)) / frac_1)))
- psd_write_16(xc, convert_color(c)); /* Cyan */
- psd_write_16(xc, convert_color(m)); /* Magenta */
- psd_write_16(xc, convert_color(y)); /* Yellow */
- psd_write_16(xc, convert_color(k)); /* Black */
+ psd_write_16(xc, convert_color(c)); /* Cyan */
+ psd_write_16(xc, convert_color(m)); /* Magenta */
+ psd_write_16(xc, convert_color(y)); /* Yellow */
+ psd_write_16(xc, convert_color(k)); /* Black */
#undef convert_color
- }
- else { /* Else set C = M = Y = 0, K = 1 */
- psd_write_16(xc, 65535); /* Cyan */
- psd_write_16(xc, 65535); /* Magenta */
- psd_write_16(xc, 65535); /* Yellow */
- psd_write_16(xc, 0); /* Black */
- }
- psd_write_16(xc, 0); /* Opacity 0 to 100 */
- psd_write_8(xc, 2); /* Don't know */
- psd_write_8(xc, 0); /* Padding - Always Zero */
+ }
+ else { /* Else set C = M = Y = 0, K = 1 */
+ psd_write_16(xc, 65535); /* Cyan */
+ psd_write_16(xc, 65535); /* Magenta */
+ psd_write_16(xc, 65535); /* Yellow */
+ psd_write_16(xc, 0); /* Black */
+ }
+ psd_write_16(xc, 0); /* Opacity 0 to 100 */
+ psd_write_8(xc, 2); /* Don't know */
+ psd_write_8(xc, 0); /* Padding - Always Zero */
}
/* Image resolution */
@@ -1113,7 +1108,7 @@ psd_write_header(psd_write_ctx *xc, psd_device *pdev)
psd_write_16(xc, 1005); /* 0x03ED */
psd_write_16(xc, 0); /* PString */
psd_write_32(xc, 16); /* Length */
- /* Resolution is specified as a fixed 16.16 bits */
+ /* Resolution is specified as a fixed 16.16 bits */
psd_write_32(xc, (int) (pdev->HWResolution[0] * 0x10000 + 0.5));
psd_write_16(xc, 1); /* width: 1 --> resolution is pixels per inch */
psd_write_16(xc, 1); /* width: 1 --> resolution is pixels per inch */
@@ -1127,10 +1122,9 @@ psd_write_header(psd_write_ctx *xc, psd_device *pdev)
return code;
}
-
static void
-psd_calib_row(psd_write_ctx *xc, byte **tile_data, const byte *row,
- int channel, gcmmhlink_t link, int inn, int outn)
+psd_calib_row(psd_write_ctx *xc, byte **tile_data, const byte *row,
+ int channel, gcmmhlink_t link, int inn, int outn)
{
int base_bytes_pp = xc->base_bytes_pp;
int n_extra_channels = xc->n_extra_channels;
@@ -1139,22 +1133,21 @@ psd_calib_row(psd_write_ctx *xc, byte **tile_data, const byte *row,
unsigned char in[MAX_CHAN];
for (x = 0; x < xc->width; x++) {
- if (channel < outn) {
- int plane_idx;
+ if (channel < outn) {
+ int plane_idx;
- for (plane_idx = 0; plane_idx < inn; plane_idx++)
- in[plane_idx] = row[x*channels+plane_idx];
+ for (plane_idx = 0; plane_idx < inn; plane_idx++)
+ in[plane_idx] = row[x*channels+plane_idx];
gscms_transform_color(link, &(in[0]),
&((*tile_data)[x]), 1, NULL);
- } else {
- (*tile_data)[x] = 255 ^ row[x*channels+base_bytes_pp+channel];
- }
+ } else {
+ (*tile_data)[x] = 255 ^ row[x*channels+base_bytes_pp+channel];
+ }
}
}
-
/*
* Close device and clean up ICC structures.
*/
@@ -1222,46 +1215,46 @@ psd_write_image_data(psd_write_ctx *xc, gx_device_printer *pdev)
line = gs_alloc_bytes(pdev->memory, raster, "psd_write_image_data");
sep_line = gs_alloc_bytes(pdev->memory, xc->width, "psd_write_sep_line");
unpacked = gs_alloc_bytes(pdev->memory, width *num_comp,
- "psd_write_image");
+ "psd_write_image");
if (line == NULL || sep_line == NULL || unpacked == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Print the output planes */
for (chan_idx = 0; chan_idx < num_comp; chan_idx++) {
- for (j = 0; j < xc->height; ++j) {
- int data_pos = xc->chnl_to_position[chan_idx];
-
- /* Check if the separation is present in the SeparationOrder */
- if (data_pos >= 0) {
- code = gdev_prn_get_bits(pdev, j, line, &row);
- /* Unpack the encoded color info */
- non_encodable_count += devn_unpack_row((gx_device *)pdev,
- num_comp, &(xdev->devn_params), width, row, unpacked);
- if (link == NULL) {
- for (i = 0; i < xc->width; ++i) {
- if (base_bytes_pp == 3) {
- /* RGB */
- sep_line[i] = unpacked[i * num_comp + data_pos];
- } else {
- /* CMYK */
- sep_line[i] = 255 - unpacked[i * num_comp + data_pos];
- }
- }
- } else {
- psd_calib_row(xc, &sep_line, unpacked, data_pos,
+ for (j = 0; j < xc->height; ++j) {
+ int data_pos = xc->chnl_to_position[chan_idx];
+
+ /* Check if the separation is present in the SeparationOrder */
+ if (data_pos >= 0) {
+ code = gdev_prn_get_bits(pdev, j, line, &row);
+ /* Unpack the encoded color info */
+ non_encodable_count += devn_unpack_row((gx_device *)pdev,
+ num_comp, &(xdev->devn_params), width, row, unpacked);
+ if (link == NULL) {
+ for (i = 0; i < xc->width; ++i) {
+ if (base_bytes_pp == 3) {
+ /* RGB */
+ sep_line[i] = unpacked[i * num_comp + data_pos];
+ } else {
+ /* CMYK */
+ sep_line[i] = 255 - unpacked[i * num_comp + data_pos];
+ }
+ }
+ } else {
+ psd_calib_row(xc, &sep_line, unpacked, data_pos,
link, xdev->output_profile->num_comps,
- xdev->output_profile->num_comps_out);
- }
- psd_write(xc, sep_line, xc->width);
- } else {
- if (chan_idx < NUM_CMYK_COMPONENTS) {
- /* Write empty process color */
- for (i = 0; i < xc->width; ++i)
- sep_line[i] = 255;
- psd_write(xc, sep_line, xc->width);
- }
- }
- }
+ xdev->output_profile->num_comps_out);
+ }
+ psd_write(xc, sep_line, xc->width);
+ } else {
+ if (chan_idx < NUM_CMYK_COMPONENTS) {
+ /* Write empty process color */
+ for (i = 0; i < xc->width; ++i)
+ sep_line[i] = 255;
+ psd_write(xc, sep_line, xc->width);
+ }
+ }
+ }
}
gs_free_object(pdev->memory, sep_line, "psd_write_sep_line");
diff --git a/gs/base/gdevpsdf.h b/gs/base/gdevpsdf.h
index 701dc0843..02f2b6c28 100644
--- a/gs/base/gdevpsdf.h
+++ b/gs/base/gdevpsdf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,12 +49,12 @@ typedef struct psdf_image_params_s {
bool Downsample;
float DownsampleThreshold;
enum psdf_downsample_type {
- ds_Average,
- ds_Bicubic,
- ds_Subsample
+ ds_Average,
+ ds_Bicubic,
+ ds_Subsample
} DownsampleType;
#define psdf_ds_names\
- "Average", "Bicubic", "Subsample"
+ "Average", "Bicubic", "Subsample"
bool Encode;
const char *Filter;
int Resolution;
@@ -69,29 +69,29 @@ typedef struct psdf_distiller_params_s {
bool ASCII85EncodePages;
enum psdf_auto_rotate_pages {
- arp_None,
- arp_All,
- arp_PageByPage
+ arp_None,
+ arp_All,
+ arp_PageByPage
} AutoRotatePages;
#define psdf_arp_names\
- "None", "All", "PageByPage"
+ "None", "All", "PageByPage"
enum psdf_binding {
- binding_Left,
- binding_Right
+ binding_Left,
+ binding_Right
} Binding;
#define psdf_binding_names\
- "Left", "Right"
+ "Left", "Right"
bool CompressPages;
enum psdf_default_rendering_intent {
- ri_Default,
- ri_Perceptual,
- ri_Saturation,
- ri_RelativeColorimetric,
- ri_AbsoluteColorimetric
+ ri_Default,
+ ri_Perceptual,
+ ri_Saturation,
+ ri_RelativeColorimetric,
+ ri_AbsoluteColorimetric
} DefaultRenderingIntent;
#define psdf_ri_names\
- "Default", "Perceptual", "Saturation", "RelativeColorimetric",\
- "AbsoluteColorimetric"
+ "Default", "Perceptual", "Saturation", "RelativeColorimetric",\
+ "AbsoluteColorimetric"
bool DetectBlends;
bool DoThumbnails;
long ImageMemory;
@@ -108,33 +108,33 @@ typedef struct psdf_distiller_params_s {
gs_const_string CalRGBProfile;
gs_const_string sRGBProfile;
enum psdf_color_conversion_strategy {
- ccs_LeaveColorUnchanged,
- ccs_UseDeviceDependentColor, /* not in Acrobat Distiller 4.0 */
- ccs_UseDeviceIndependentColor,
- ccs_UseDeviceIndependentColorForImages,
- ccs_sRGB,
- ccs_CMYK,
- ccs_Gray
+ ccs_LeaveColorUnchanged,
+ ccs_UseDeviceDependentColor, /* not in Acrobat Distiller 4.0 */
+ ccs_UseDeviceIndependentColor,
+ ccs_UseDeviceIndependentColorForImages,
+ ccs_sRGB,
+ ccs_CMYK,
+ ccs_Gray
} ColorConversionStrategy;
#define psdf_ccs_names\
- "LeaveColorUnchanged", "UseDeviceDependentColor",\
- "UseDeviceIndependentColor", "UseDeviceIndependentColorForImages",\
- "sRGB", "CMYK", "Gray"
+ "LeaveColorUnchanged", "UseDeviceDependentColor",\
+ "UseDeviceIndependentColor", "UseDeviceIndependentColorForImages",\
+ "sRGB", "CMYK", "Gray"
bool PreserveHalftoneInfo;
bool PreserveOverprintSettings;
enum psdf_transfer_function_info {
- tfi_Preserve,
- tfi_Apply,
- tfi_Remove
+ tfi_Preserve,
+ tfi_Apply,
+ tfi_Remove
} TransferFunctionInfo;
#define psdf_tfi_names\
- "Preserve", "Apply", "Remove"
+ "Preserve", "Apply", "Remove"
enum psdf_ucr_and_bg_info {
- ucrbg_Preserve,
- ucrbg_Remove
+ ucrbg_Preserve,
+ ucrbg_Remove
} UCRandBGInfo;
#define psdf_ucrbg_names\
- "Preserve", "Remove"
+ "Preserve", "Remove"
/* Color sampled image parameters */
@@ -146,23 +146,21 @@ typedef struct psdf_distiller_params_s {
psdf_image_params GrayImage;
-
/* Monochrome sampled image parameters */
psdf_image_params MonoImage;
-
/* Font embedding parameters */
gs_param_string_array AlwaysEmbed;
gs_param_string_array NeverEmbed;
enum psdf_cannot_embed_font_policy {
- cefp_OK,
- cefp_Warning,
- cefp_Error
+ cefp_OK,
+ cefp_Warning,
+ cefp_Error
} CannotEmbedFontPolicy;
#define psdf_cefp_names\
- "OK", "Warning", "Error"
+ "OK", "Warning", "Error"
bool EmbedAllFonts;
int MaxSubsetPct;
bool SubsetFonts;
@@ -188,7 +186,7 @@ extern const stream_template s_zlibE_template;
1, /* Overprintmode (OPM) */ \
0, /* PreserveOPIComments (false) */ \
1, /* UseFlateCompression (true) */ \
- /* Color processing parameters */\
+ /* Color processing parameters */\
{0}, /* calCMYKProfile */ \
{0}, /* CalGrayProfile */ \
{0}, /* calRGBProfile */ \
@@ -256,7 +254,6 @@ extern const stream_template s_zlibE_template;
100, /* Max Subset Percent */ \
1 /* Subset Fonts (true) */
-
/* Define PostScript/PDF versions, corresponding roughly to Adobe versions. */
typedef enum {
psdf_version_level1 = 1000, /* Red Book Level 1 */
@@ -269,50 +266,50 @@ typedef enum {
/* Define the extended device structure. */
#define gx_device_psdf_common\
- gx_device_vector_common;\
- psdf_version version;\
- bool binary_ok; /* derived from ASCII85EncodePages */\
- bool HaveCFF;\
- bool HaveTrueTypes;\
- bool HaveCIDSystem;\
- double ParamCompatibilityLevel;\
- psdf_distiller_params params
+ gx_device_vector_common;\
+ psdf_version version;\
+ bool binary_ok; /* derived from ASCII85EncodePages */\
+ bool HaveCFF;\
+ bool HaveTrueTypes;\
+ bool HaveCIDSystem;\
+ double ParamCompatibilityLevel;\
+ psdf_distiller_params params
typedef struct gx_device_psdf_s {
gx_device_psdf_common;
} gx_device_psdf;
#define psdf_initial_values(version, ascii)\
- vector_initial_values,\
- version,\
- !(ascii),\
- true,\
- true,\
- false,\
- 1.3,\
- { psdf_general_param_defaults(ascii),\
- psdf_color_image_param_defaults,\
- psdf_gray_image_param_defaults,\
- psdf_mono_image_param_defaults,\
- psdf_font_param_defaults\
- }
+ vector_initial_values,\
+ version,\
+ !(ascii),\
+ true,\
+ true,\
+ false,\
+ 1.3,\
+ { psdf_general_param_defaults(ascii),\
+ psdf_color_image_param_defaults,\
+ psdf_gray_image_param_defaults,\
+ psdf_mono_image_param_defaults,\
+ psdf_font_param_defaults\
+ }
/* st_device_psdf is never instantiated per se, but we still need to */
/* extern its descriptor for the sake of subclasses. */
extern_st(st_device_psdf);
#define public_st_device_psdf() /* in gdevpsdu.c */\
BASIC_PTRS(device_psdf_ptrs) {\
GC_OBJ_ELT2(gx_device_psdf, params.ColorImage.ACSDict,\
- params.ColorImage.Dict),\
+ params.ColorImage.Dict),\
GC_CONST_STRING_ELT(gx_device_psdf, params.CalCMYKProfile),\
GC_CONST_STRING_ELT(gx_device_psdf, params.CalGrayProfile),\
GC_CONST_STRING_ELT(gx_device_psdf, params.CalRGBProfile),\
GC_CONST_STRING_ELT(gx_device_psdf, params.sRGBProfile),\
GC_OBJ_ELT2(gx_device_psdf, params.GrayImage.ACSDict,\
- params.GrayImage.Dict),\
+ params.GrayImage.Dict),\
GC_OBJ_ELT2(gx_device_psdf, params.MonoImage.ACSDict,\
- params.MonoImage.Dict),\
+ params.MonoImage.Dict),\
GC_OBJ_ELT2(gx_device_psdf, params.AlwaysEmbed.data,\
- params.NeverEmbed.data)\
+ params.NeverEmbed.data)\
};\
gs_public_st_basic_super_final(st_device_psdf, gx_device_psdf,\
"gx_device_psdf", device_psdf_ptrs, device_psdf_data,\
@@ -325,31 +322,31 @@ dev_proc_put_params(gdev_psdf_put_params);
/* ---------------- Vector implementation procedures ---------------- */
- /* Imager state */
+ /* Imager state */
int psdf_setlinewidth(gx_device_vector * vdev, floatp width);
int psdf_setlinecap(gx_device_vector * vdev, gs_line_cap cap);
int psdf_setlinejoin(gx_device_vector * vdev, gs_line_join join);
int psdf_setmiterlimit(gx_device_vector * vdev, floatp limit);
int psdf_setdash(gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset);
+ uint count, floatp offset);
int psdf_setflat(gx_device_vector * vdev, floatp flatness);
int psdf_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff);
+ gs_logical_operation_t diff);
- /* Paths */
+ /* Paths */
#define psdf_dopath gdev_vector_dopath
int psdf_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type);
+ fixed y1, gx_path_type_t type);
int psdf_beginpath(gx_device_vector * vdev, gx_path_type_t type);
int psdf_moveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
int psdf_lineto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
int psdf_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2,
- floatp y2, floatp x3, floatp y3, gx_path_type_t type);
+ floatp x1, floatp y1, floatp x2,
+ floatp y2, floatp x3, floatp y3, gx_path_type_t type);
int psdf_closepath(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type);
+ floatp x_start, floatp y_start, gx_path_type_t type);
/* ---------------- Binary (image) data procedures ---------------- */
@@ -378,7 +375,7 @@ int psdf_begin_binary(gx_device_psdf * pdev, psdf_binary_writer * pbw);
/* Add an encoding filter. The client must have allocated the stream state, */
/* if any, using pdev->v_memory. */
int psdf_encode_binary(psdf_binary_writer * pbw,
- const stream_template * template, stream_state * ss);
+ const stream_template * template, stream_state * ss);
/* Add a 2-D CCITTFax encoding filter. */
/* Set EndOfBlock iff the stream is not ASCII85 encoded. */
@@ -391,46 +388,46 @@ int psdf_CFE_binary(psdf_binary_writer * pbw, int w, int h, bool invert);
* used. pbw = NULL means just set up the stream state.
*/
int psdf_DCT_filter(gs_param_list *plist /* may be NULL */,
- stream_state /*stream_DCTE_state*/ *st,
- int Columns, int Rows, int Colors,
- psdf_binary_writer *pbw /* may be NULL */);
+ stream_state /*stream_DCTE_state*/ *st,
+ int Columns, int Rows, int Colors,
+ psdf_binary_writer *pbw /* may be NULL */);
/* Decive whether to convert an image to RGB. */
-bool psdf_is_converting_image_to_RGB(const gx_device_psdf * pdev,
- const gs_imager_state * pis, const gs_pixel_image_t * pim);
+bool psdf_is_converting_image_to_RGB(const gx_device_psdf * pdev,
+ const gs_imager_state * pis, const gs_pixel_image_t * pim);
/* Set up compression and downsampling filters for an image. */
/* Note that this may modify the image parameters. */
/* If pctm is NULL, downsampling is not used. */
/* pis only provides UCR and BG information for CMYK => RGB conversion. */
int psdf_setup_image_filters(gx_device_psdf *pdev, psdf_binary_writer *pbw,
- gs_pixel_image_t *pim, const gs_matrix *pctm,
- const gs_imager_state * pis, bool lossless,
- bool in_line);
+ gs_pixel_image_t *pim, const gs_matrix *pctm,
+ const gs_imager_state * pis, bool lossless,
+ bool in_line);
/* Set up compression filters for a lossless image, with no downsampling, */
/* no color space conversion, and only lossless filters. */
/* Note that this may modify the image parameters. */
int psdf_setup_lossless_filters(gx_device_psdf *pdev, psdf_binary_writer *pbw,
- gs_pixel_image_t *pim, bool in_line);
+ gs_pixel_image_t *pim, bool in_line);
/* Finish writing binary data. */
int psdf_end_binary(psdf_binary_writer * pbw);
/* Set up image compression chooser. */
int psdf_setup_compression_chooser(psdf_binary_writer *pbw,
- gx_device_psdf *pdev,
- int width, int height, int depth,
- int bits_per_sample);
+ gx_device_psdf *pdev,
+ int width, int height, int depth,
+ int bits_per_sample);
/* Set up an "image to mask" filter. */
int psdf_setup_image_to_mask_filter(psdf_binary_writer *pbw, gx_device_psdf *pdev,
- int width, int height, int depth, int bits_per_sample, uint *MaskColor);
+ int width, int height, int depth, int bits_per_sample, uint *MaskColor);
/* Set up an image colors filter. */
-int psdf_setup_image_colors_filter(psdf_binary_writer *pbw,
- gx_device_psdf *pdev, gs_pixel_image_t * pim,
- const gs_imager_state *pis);
+int psdf_setup_image_colors_filter(psdf_binary_writer *pbw,
+ gx_device_psdf *pdev, gs_pixel_image_t * pim,
+ const gs_imager_state *pis);
/* ---------------- Symbolic data printing ---------------- */
@@ -464,11 +461,11 @@ extern const psdf_set_color_commands_t
* of gx_color_index isn't representable.
*/
gx_color_index psdf_adjust_color_index(gx_device_vector *vdev,
- gx_color_index color);
+ gx_color_index color);
/* Set the fill or stroke color. */
int psdf_set_color(gx_device_vector *vdev, const gx_drawing_color *pdc,
- const psdf_set_color_commands_t *ppscc);
+ const psdf_set_color_commands_t *ppscc);
/* Round a double value to a specified precision. */
double psdf_round(double v, int precision, int radix);
diff --git a/gs/base/gdevpsdi.c b/gs/base/gdevpsdi.c
index 6c1db3722..ba8db4238 100644
--- a/gs/base/gdevpsdi.c
+++ b/gs/base/gdevpsdi.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,7 @@ extern stream_state_proc_put_params(s_CF_put_params, stream_CF_state);
*/
static int
pixel_resize(psdf_binary_writer * pbw, int width, int num_components,
- int bpc_in, int bpc_out)
+ int bpc_in, int bpc_out)
{
gs_memory_t *mem = pbw->dev->v_memory;
const stream_template *template;
@@ -57,37 +57,37 @@ pixel_resize(psdf_binary_writer * pbw, int width, int num_components,
int code;
if (bpc_out == bpc_in)
- return 0;
+ return 0;
if (bpc_in != 8) {
- static const stream_template *const exts[13] = {
- 0, &s_1_8_template, &s_2_8_template, 0, &s_4_8_template,
- 0, 0, 0, 0, 0, 0, 0, &s_12_8_template
- };
+ static const stream_template *const exts[13] = {
+ 0, &s_1_8_template, &s_2_8_template, 0, &s_4_8_template,
+ 0, 0, 0, 0, 0, 0, 0, &s_12_8_template
+ };
- template = exts[bpc_in];
+ template = exts[bpc_in];
} else {
- static const stream_template *const rets[5] = {
- 0, &s_8_1_template, &s_8_2_template, 0, &s_8_4_template
- };
+ static const stream_template *const rets[5] = {
+ 0, &s_8_1_template, &s_8_2_template, 0, &s_8_4_template
+ };
- template = rets[bpc_out];
+ template = rets[bpc_out];
}
st = (stream_1248_state *)
- s_alloc_state(mem, template->stype, "pixel_resize state");
+ s_alloc_state(mem, template->stype, "pixel_resize state");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = psdf_encode_binary(pbw, template, (stream_state *) st);
if (code < 0) {
- gs_free_object(mem, st, "pixel_resize state");
- return code;
+ gs_free_object(mem, st, "pixel_resize state");
+ return code;
}
s_1248_init(st, width, num_components);
return 0;
}
static int
-convert_color(gx_device *pdev, const gs_color_space *pcs, const gs_imager_state * pis,
- gs_client_color *cc, float c[3])
+convert_color(gx_device *pdev, const gs_color_space *pcs, const gs_imager_state * pis,
+ gs_client_color *cc, float c[3])
{
int code;
gx_device_color dc;
@@ -95,7 +95,7 @@ convert_color(gx_device *pdev, const gs_color_space *pcs, const gs_imager_state
cs_restrict_color(cc, pcs);
code = pcs->type->remap_color(cc, pcs, &dc, pis, pdev, gs_color_select_texture);
if (code < 0)
- return code;
+ return code;
c[0] = (float)((int)(dc.colors.pure >> pdev->color_info.comp_shift[0]) & ((1 << pdev->color_info.comp_bits[0]) - 1));
c[1] = (float)((int)(dc.colors.pure >> pdev->color_info.comp_shift[1]) & ((1 << pdev->color_info.comp_bits[1]) - 1));
c[2] = (float)((int)(dc.colors.pure >> pdev->color_info.comp_shift[2]) & ((1 << pdev->color_info.comp_bits[2]) - 1));
@@ -103,12 +103,12 @@ convert_color(gx_device *pdev, const gs_color_space *pcs, const gs_imager_state
}
/* A hewristic choice of DCT compression parameters - see bug 687174. */
-static int
-choose_DCT_params(gx_device *pdev, const gs_color_space *pcs,
- const gs_imager_state * pis,
- gs_c_param_list *list, gs_c_param_list **param,
- stream_state *st)
-{
+static int
+choose_DCT_params(gx_device *pdev, const gs_color_space *pcs,
+ const gs_imager_state * pis,
+ gs_c_param_list *list, gs_c_param_list **param,
+ stream_state *st)
+{
gx_device_memory mdev;
gs_client_color cc;
int code;
@@ -118,12 +118,12 @@ choose_DCT_params(gx_device *pdev, const gs_color_space *pcs,
const int one = 1, zero = 0;
if (pcs->type->num_components(pcs) != 3)
- return 0;
+ return 0;
if (*param != NULL) {
- /* Make a copy of the parameter list since we will modify it. */
- code = param_list_copy((gs_param_list *)list, (gs_param_list *)*param);
- if (code < 0)
- return code;
+ /* Make a copy of the parameter list since we will modify it. */
+ code = param_list_copy((gs_param_list *)list, (gs_param_list *)*param);
+ if (code < 0)
+ return code;
}
*param = list;
@@ -135,73 +135,73 @@ choose_DCT_params(gx_device *pdev, const gs_color_space *pcs,
/* Set mem device icc profile */
gsicc_init_device_profile((const gs_state *) pis, (gx_device *) &mdev);
if (pis) {
- /* Check for an RGB-like color space.
- To recognize that we make a matrix as it were a linear operator,
- suppress an ununiformity by subtracting the image of {0,0,0},
- and then check for giagonal domination. */
- cc.paint.values[0] = cc.paint.values[1] = cc.paint.values[2] = MIN_FLOAT;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[3]);
- cc.paint.values[0] = MAX_FLOAT; cc.paint.values[1] = MIN_FLOAT; cc.paint.values[2] = MIN_FLOAT;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[0]);
- cc.paint.values[0] = MIN_FLOAT; cc.paint.values[1] = MAX_FLOAT; cc.paint.values[2] = MIN_FLOAT;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[1]);
- cc.paint.values[0] = MIN_FLOAT; cc.paint.values[1] = MIN_FLOAT; cc.paint.values[2] = MAX_FLOAT;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[2]);
- c[0][0] -= c[3][0]; c[0][1] -= c[3][1]; c[0][2] -= c[3][2];
- c[1][0] -= c[3][0]; c[1][1] -= c[3][1]; c[1][2] -= c[3][2];
- c[2][0] -= c[3][0]; c[2][1] -= c[3][1]; c[2][2] -= c[3][2];
- c[0][0] = any_abs(c[0][0]); c[0][1] = any_abs(c[0][1]); c[0][2] = any_abs(c[0][2]);
- c[1][0] = any_abs(c[1][0]); c[1][1] = any_abs(c[1][1]); c[1][2] = any_abs(c[1][2]);
- c[2][0] = any_abs(c[2][0]); c[2][1] = any_abs(c[2][1]); c[2][2] = any_abs(c[2][2]);
- if (c[0][0] * domination > c[0][1] && c[0][0] * domination > c[0][2] &&
- c[1][1] * domination > c[1][0] && c[1][1] * domination > c[1][2] &&
- c[2][2] * domination > c[2][0] && c[2][2] * domination > c[2][1]) {
- /* Yes, it looks like an RGB color space.
- Replace ColorTransform with 1. */
- code = param_write_int((gs_param_list *)list, "ColorTransform", &one);
- if (code < 0)
- return code;
- goto done;
- }
-
- /* Check for a Lab-like color space.
- Colors {v,0,0} should map to grays. */
- cc.paint.values[0] = MAX_FLOAT; cc.paint.values[1] = cc.paint.values[2] = 0;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[0]);
- cc.paint.values[0] /= 2;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[1]);
- cc.paint.values[0] /= 2;
- convert_color((gx_device *)&mdev, pcs, pis, &cc, c[2]);
- c[0][1] -= c[0][0]; c[0][2] -= c[0][0];
- c[1][1] -= c[1][0]; c[1][2] -= c[1][0];
- c[2][1] -= c[2][0]; c[2][2] -= c[2][0];
- c[0][1] = any_abs(c[0][1]); c[0][2] = any_abs(c[0][2]);
- c[1][1] = any_abs(c[1][1]); c[1][2] = any_abs(c[1][2]);
- c[2][1] = any_abs(c[2][1]); c[2][2] = any_abs(c[2][2]);
+ /* Check for an RGB-like color space.
+ To recognize that we make a matrix as it were a linear operator,
+ suppress an ununiformity by subtracting the image of {0,0,0},
+ and then check for giagonal domination. */
+ cc.paint.values[0] = cc.paint.values[1] = cc.paint.values[2] = MIN_FLOAT;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[3]);
+ cc.paint.values[0] = MAX_FLOAT; cc.paint.values[1] = MIN_FLOAT; cc.paint.values[2] = MIN_FLOAT;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[0]);
+ cc.paint.values[0] = MIN_FLOAT; cc.paint.values[1] = MAX_FLOAT; cc.paint.values[2] = MIN_FLOAT;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[1]);
+ cc.paint.values[0] = MIN_FLOAT; cc.paint.values[1] = MIN_FLOAT; cc.paint.values[2] = MAX_FLOAT;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[2]);
+ c[0][0] -= c[3][0]; c[0][1] -= c[3][1]; c[0][2] -= c[3][2];
+ c[1][0] -= c[3][0]; c[1][1] -= c[3][1]; c[1][2] -= c[3][2];
+ c[2][0] -= c[3][0]; c[2][1] -= c[3][1]; c[2][2] -= c[3][2];
+ c[0][0] = any_abs(c[0][0]); c[0][1] = any_abs(c[0][1]); c[0][2] = any_abs(c[0][2]);
+ c[1][0] = any_abs(c[1][0]); c[1][1] = any_abs(c[1][1]); c[1][2] = any_abs(c[1][2]);
+ c[2][0] = any_abs(c[2][0]); c[2][1] = any_abs(c[2][1]); c[2][2] = any_abs(c[2][2]);
+ if (c[0][0] * domination > c[0][1] && c[0][0] * domination > c[0][2] &&
+ c[1][1] * domination > c[1][0] && c[1][1] * domination > c[1][2] &&
+ c[2][2] * domination > c[2][0] && c[2][2] * domination > c[2][1]) {
+ /* Yes, it looks like an RGB color space.
+ Replace ColorTransform with 1. */
+ code = param_write_int((gs_param_list *)list, "ColorTransform", &one);
+ if (code < 0)
+ return code;
+ goto done;
+ }
+
+ /* Check for a Lab-like color space.
+ Colors {v,0,0} should map to grays. */
+ cc.paint.values[0] = MAX_FLOAT; cc.paint.values[1] = cc.paint.values[2] = 0;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[0]);
+ cc.paint.values[0] /= 2;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[1]);
+ cc.paint.values[0] /= 2;
+ convert_color((gx_device *)&mdev, pcs, pis, &cc, c[2]);
+ c[0][1] -= c[0][0]; c[0][2] -= c[0][0];
+ c[1][1] -= c[1][0]; c[1][2] -= c[1][0];
+ c[2][1] -= c[2][0]; c[2][2] -= c[2][0];
+ c[0][1] = any_abs(c[0][1]); c[0][2] = any_abs(c[0][2]);
+ c[1][1] = any_abs(c[1][1]); c[1][2] = any_abs(c[1][2]);
+ c[2][1] = any_abs(c[2][1]); c[2][2] = any_abs(c[2][2]);
}
if (pis && c[0][0] * domination > c[0][1] && c[0][0] * domination > c[0][2] &&
- c[1][0] * domination > c[1][1] && c[1][0] * domination > c[1][2] &&
- c[2][0] * domination > c[2][1] && c[2][0] * domination > c[2][2]) {
- /* Yes, it looks like an Lab color space.
- Replace ColorTransform with 0. */
- code = param_write_int((gs_param_list *)list, "ColorTransform", &zero);
- if (code < 0)
- return code;
+ c[1][0] * domination > c[1][1] && c[1][0] * domination > c[1][2] &&
+ c[2][0] * domination > c[2][1] && c[2][0] * domination > c[2][2]) {
+ /* Yes, it looks like an Lab color space.
+ Replace ColorTransform with 0. */
+ code = param_write_int((gs_param_list *)list, "ColorTransform", &zero);
+ if (code < 0)
+ return code;
} else {
- /* Unknown color space type.
- Replace /HSamples [1 1 1 1] /VSamples [1 1 1 1] to avoid quality degradation. */
- gs_param_string a;
- static const byte v[4] = {1, 1, 1, 1};
-
- a.data = v;
- a.size = 4;
- a.persistent = true;
- code = param_write_string((gs_param_list *)list, "HSamples", &a);
- if (code < 0)
- return code;
- code = param_write_string((gs_param_list *)list, "VSamples", &a);
- if (code < 0)
- return code;
+ /* Unknown color space type.
+ Replace /HSamples [1 1 1 1] /VSamples [1 1 1 1] to avoid quality degradation. */
+ gs_param_string a;
+ static const byte v[4] = {1, 1, 1, 1};
+
+ a.data = v;
+ a.size = 4;
+ a.persistent = true;
+ code = param_write_string((gs_param_list *)list, "HSamples", &a);
+ if (code < 0)
+ return code;
+ code = param_write_string((gs_param_list *)list, "VSamples", &a);
+ if (code < 0)
+ return code;
}
done:
gs_c_param_list_read(list);
@@ -211,166 +211,166 @@ done:
/* Add the appropriate image compression filter, if any. */
static int
setup_image_compression(psdf_binary_writer *pbw, const psdf_image_params *pdip,
- const gs_pixel_image_t * pim, const gs_imager_state * pis,
- bool lossless)
+ const gs_pixel_image_t * pim, const gs_imager_state * pis,
+ bool lossless)
{
gx_device_psdf *pdev = pbw->dev;
gs_memory_t *mem = pdev->v_memory;
const stream_template *template = pdip->filter_template;
const stream_template *lossless_template =
- (pdev->params.UseFlateCompression &&
- pdev->version >= psdf_version_ll3 ?
- &s_zlibE_template : &s_LZWE_template);
+ (pdev->params.UseFlateCompression &&
+ pdev->version >= psdf_version_ll3 ?
+ &s_zlibE_template : &s_LZWE_template);
const gs_color_space *pcs = pim->ColorSpace; /* null if mask */
int Colors = (pcs ? gs_color_space_num_components(pcs) : 1);
bool Indexed =
- (pcs != 0 &&
- gs_color_space_get_index(pcs) == gs_color_space_index_Indexed);
+ (pcs != 0 &&
+ gs_color_space_get_index(pcs) == gs_color_space_index_Indexed);
gs_c_param_list *dict = pdip->Dict;
stream_state *st;
int code;
# ifdef USE_LWF_JP2
if (lossless && template == &s_jpxe_template && !Indexed)
- lossless_template = &s_jpxe_template;
+ lossless_template = &s_jpxe_template;
# endif
if (!pdip->Encode) /* no compression */
- return 0;
+ return 0;
if (pdip->AutoFilter) {
- /*
- * Disregard the requested filter. What we should do at this point
- * is analyze the image to decide whether to use JPEG encoding
- * (DCTEncode with ACSDict) or the lossless filter. However, since
- * we don't buffer the entire image, we'll make the choice on-fly,
- * forking the image data into 3 streams : (1) JPEG, (2) lossless,
- * (3) the compression chooser. In this case this function is
- * called 2 times with different values of the 'lossless' argument.
- */
+ /*
+ * Disregard the requested filter. What we should do at this point
+ * is analyze the image to decide whether to use JPEG encoding
+ * (DCTEncode with ACSDict) or the lossless filter. However, since
+ * we don't buffer the entire image, we'll make the choice on-fly,
+ * forking the image data into 3 streams : (1) JPEG, (2) lossless,
+ * (3) the compression chooser. In this case this function is
+ * called 2 times with different values of the 'lossless' argument.
+ */
if (lossless) {
template = lossless_template;
- } else if (template == NULL || template == &s_zlibE_template ||
- template == &s_LZWE_template) {
+ } else if (template == NULL || template == &s_zlibE_template ||
+ template == &s_LZWE_template) {
template = &s_DCTE_template;
}
- dict = pdip->ACSDict;
+ dict = pdip->ACSDict;
} else if (!lossless)
- return gs_error_rangecheck; /* Reject the alternative stream. */
+ return gs_error_rangecheck; /* Reject the alternative stream. */
if (pdev->version < psdf_version_ll3 && template == &s_zlibE_template)
- template = lossless_template;
+ template = lossless_template;
if (dict != NULL) /* Some interpreters don't supply filter parameters. */
- gs_c_param_list_read(dict); /* ensure param list is in read mode */
+ gs_c_param_list_read(dict); /* ensure param list is in read mode */
if (template == 0) /* no compression */
- return 0;
+ return 0;
if (pim->Width < 200 && pim->Height < 200) /* Prevent a fixed overflow. */
- if (pim->Width * pim->Height * Colors * pim->BitsPerComponent <= 160)
- return 0; /* not worth compressing */
+ if (pim->Width * pim->Height * Colors * pim->BitsPerComponent <= 160)
+ return 0; /* not worth compressing */
/* Only use DCTE for 8-bit, non-Indexed data. */
if (template == &s_DCTE_template) {
- if (Indexed ||
+ if (Indexed ||
!(pdip->Downsample ?
- pdip->Depth == 8 ||
- (pdip->Depth == -1 && pim->BitsPerComponent == 8) :
- pim->BitsPerComponent == 8)
- ) {
- /* Use LZW/Flate instead. */
- template = lossless_template;
- }
+ pdip->Depth == 8 ||
+ (pdip->Depth == -1 && pim->BitsPerComponent == 8) :
+ pim->BitsPerComponent == 8)
+ ) {
+ /* Use LZW/Flate instead. */
+ template = lossless_template;
+ }
}
st = s_alloc_state(mem, template->stype, "setup_image_compression");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (template->set_defaults)
- (*template->set_defaults) (st);
+ (*template->set_defaults) (st);
if (template == &s_CFE_template) {
- stream_CFE_state *const ss = (stream_CFE_state *) st;
-
- if (pdip->Dict != 0 && pdip->filter_template == template) {
- s_CF_put_params((gs_param_list *)pdip->Dict,
- (stream_CF_state *)ss); /* ignore errors */
- } else {
- ss->K = -1;
- ss->BlackIs1 = true;
- }
- ss->Columns = pim->Width;
- ss->Rows = (ss->EndOfBlock ? 0 : pim->Height);
+ stream_CFE_state *const ss = (stream_CFE_state *) st;
+
+ if (pdip->Dict != 0 && pdip->filter_template == template) {
+ s_CF_put_params((gs_param_list *)pdip->Dict,
+ (stream_CF_state *)ss); /* ignore errors */
+ } else {
+ ss->K = -1;
+ ss->BlackIs1 = true;
+ }
+ ss->Columns = pim->Width;
+ ss->Rows = (ss->EndOfBlock ? 0 : pim->Height);
} else if ((template == &s_LZWE_template ||
- template == &s_zlibE_template) &&
- pdev->version >= psdf_version_ll3) {
- /* If not Indexed, add a PNGPredictor filter. */
- if (!Indexed) {
- code = psdf_encode_binary(pbw, template, st);
- if (code < 0)
- goto fail;
- template = &s_PNGPE_template;
- st = s_alloc_state(mem, template->stype, "setup_image_compression");
- if (st == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
- }
- if (template->set_defaults)
- (*template->set_defaults) (st);
- {
- stream_PNGP_state *const ss = (stream_PNGP_state *) st;
-
- ss->Colors = Colors;
- ss->Columns = pim->Width;
- }
- }
+ template == &s_zlibE_template) &&
+ pdev->version >= psdf_version_ll3) {
+ /* If not Indexed, add a PNGPredictor filter. */
+ if (!Indexed) {
+ code = psdf_encode_binary(pbw, template, st);
+ if (code < 0)
+ goto fail;
+ template = &s_PNGPE_template;
+ st = s_alloc_state(mem, template->stype, "setup_image_compression");
+ if (st == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
+ }
+ if (template->set_defaults)
+ (*template->set_defaults) (st);
+ {
+ stream_PNGP_state *const ss = (stream_PNGP_state *) st;
+
+ ss->Colors = Colors;
+ ss->Columns = pim->Width;
+ }
+ }
} else if (template == &s_DCTE_template) {
- gs_c_param_list list, *param = dict;
-
- gs_c_param_list_write(&list, mem);
- code = choose_DCT_params((gx_device *)pbw->dev, pcs, pis, &list, &param, st);
- if (code < 0) {
- gs_c_param_list_release(&list);
- return code;
- }
- code = psdf_DCT_filter((gs_param_list *)param,
- st, pim->Width, pim->Height, Colors, pbw);
- gs_c_param_list_release(&list);
- if (code < 0)
- goto fail;
- /* psdf_DCT_filter already did the psdf_encode_binary. */
- return 0;
+ gs_c_param_list list, *param = dict;
+
+ gs_c_param_list_write(&list, mem);
+ code = choose_DCT_params((gx_device *)pbw->dev, pcs, pis, &list, &param, st);
+ if (code < 0) {
+ gs_c_param_list_release(&list);
+ return code;
+ }
+ code = psdf_DCT_filter((gs_param_list *)param,
+ st, pim->Width, pim->Height, Colors, pbw);
+ gs_c_param_list_release(&list);
+ if (code < 0)
+ goto fail;
+ /* psdf_DCT_filter already did the psdf_encode_binary. */
+ return 0;
} else {
# ifdef USE_LDF_JB2
- if (template == &s_jbig2encode_template) {
- stream_jbig2encode_state *state = (stream_jbig2encode_state *)st;
+ if (template == &s_jbig2encode_template) {
+ stream_jbig2encode_state *state = (stream_jbig2encode_state *)st;
- state->width = pim->Width;
- state->height = pim->Height;
- }
+ state->width = pim->Width;
+ state->height = pim->Height;
+ }
# endif
# ifdef USE_LWF_JP2
- if (template == &s_jpxe_template) {
- stream_jpxe_state *state = (stream_jpxe_state *)st;
- int ncomps = pim->ColorSpace->type->num_components(pim->ColorSpace);
-
- /* HACK : We choose a JPX color space from the number of components :
- CIEBasedA goes as gs_jpx_cs_gray,
- CIEBasedABC and DeviceN(3) go as gs_jpx_cs_rgb,
- CIEBasedABCD and DeviceN(4) go as gs_jpx_cs_cmyk.
- */
- switch (ncomps) {
- case 1 : state->colorspace = gs_jpx_cs_gray; break;
- case 3 : state->colorspace = gs_jpx_cs_rgb; break;
- case 4 : state->colorspace = gs_jpx_cs_cmyk; break;
- default:
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- state->width = pim->Width;
- state->height = pim->Height;
- state->bpc = pim->BitsPerComponent;
- state->components = ncomps;
- state->lossless = lossless;
- /* Other encode parameters are not implemented yet.
- Therefore ACSDict is being ignored. */
- }
+ if (template == &s_jpxe_template) {
+ stream_jpxe_state *state = (stream_jpxe_state *)st;
+ int ncomps = pim->ColorSpace->type->num_components(pim->ColorSpace);
+
+ /* HACK : We choose a JPX color space from the number of components :
+ CIEBasedA goes as gs_jpx_cs_gray,
+ CIEBasedABC and DeviceN(3) go as gs_jpx_cs_rgb,
+ CIEBasedABCD and DeviceN(4) go as gs_jpx_cs_cmyk.
+ */
+ switch (ncomps) {
+ case 1 : state->colorspace = gs_jpx_cs_gray; break;
+ case 3 : state->colorspace = gs_jpx_cs_rgb; break;
+ case 4 : state->colorspace = gs_jpx_cs_cmyk; break;
+ default:
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ state->width = pim->Width;
+ state->height = pim->Height;
+ state->bpc = pim->BitsPerComponent;
+ state->components = ncomps;
+ state->lossless = lossless;
+ /* Other encode parameters are not implemented yet.
+ Therefore ACSDict is being ignored. */
+ }
# endif
}
code = psdf_encode_binary(pbw, template, st);
if (code >= 0)
- return 0;
+ return 0;
fail:
gs_free_object(mem, st, "setup_image_compression");
return code;
@@ -379,12 +379,12 @@ setup_image_compression(psdf_binary_writer *pbw, const psdf_image_params *pdip,
/* Determine whether an image should be downsampled. */
static bool
do_downsample(const psdf_image_params *pdip, const gs_pixel_image_t *pim,
- floatp resolution)
+ floatp resolution)
{
floatp factor = (int)(resolution / pdip->Resolution);
return (pdip->Downsample && factor >= pdip->DownsampleThreshold &&
- factor <= pim->Width && factor <= pim->Height);
+ factor <= pim->Width && factor <= pim->Height);
}
/* Add downsampling, antialiasing, and compression filters. */
@@ -392,14 +392,14 @@ do_downsample(const psdf_image_params *pdip, const gs_pixel_image_t *pim,
/* Assumes do_downsampling() is true. */
static int
setup_downsampling(psdf_binary_writer * pbw, const psdf_image_params * pdip,
- gs_pixel_image_t * pim, const gs_imager_state * pis,
- floatp resolution, bool lossless)
+ gs_pixel_image_t * pim, const gs_imager_state * pis,
+ floatp resolution, bool lossless)
{
gx_device_psdf *pdev = pbw->dev;
/* Note: Bicubic is currently interpreted as Average. */
const stream_template *template =
- (pdip->DownsampleType == ds_Subsample ?
- &s_Subsample_template : &s_Average_template);
+ (pdip->DownsampleType == ds_Subsample ?
+ &s_Subsample_template : &s_Average_template);
int factor = (int)(resolution / pdip->Resolution);
int orig_bpc = pim->BitsPerComponent;
int orig_width = pim->Width;
@@ -408,87 +408,87 @@ setup_downsampling(psdf_binary_writer * pbw, const psdf_image_params * pdip,
int code;
st = s_alloc_state(pdev->v_memory, template->stype,
- "setup_downsampling");
+ "setup_downsampling");
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (template->set_defaults)
- template->set_defaults(st);
+ template->set_defaults(st);
{
- stream_Downsample_state *const ss = (stream_Downsample_state *) st;
-
- ss->Colors =
- (pim->ColorSpace == 0 ? 1 /*mask*/ :
- gs_color_space_num_components(pim->ColorSpace));
- ss->WidthIn = pim->Width;
- ss->HeightIn = pim->Height;
- ss->XFactor = ss->YFactor = factor;
- ss->AntiAlias = pdip->AntiAlias;
- ss->padX = ss->padY = false; /* should be true */
- if (template->init)
- template->init(st);
- pim->Width = s_Downsample_size_out(pim->Width, factor, ss->padX);
- pim->Height = s_Downsample_size_out(pim->Height, factor, ss->padY);
- pim->BitsPerComponent = pdip->Depth;
- gs_matrix_scale(&pim->ImageMatrix, (double)pim->Width / orig_width,
- (double)pim->Height / orig_height,
- &pim->ImageMatrix);
- /****** NO ANTI-ALIASING YET ******/
- if ((code = setup_image_compression(pbw, pdip, pim, pis, lossless)) < 0 ||
- (code = pixel_resize(pbw, pim->Width, ss->Colors,
- 8, pdip->Depth)) < 0 ||
- (code = psdf_encode_binary(pbw, template, st)) < 0 ||
- (code = pixel_resize(pbw, orig_width, ss->Colors,
- orig_bpc, 8)) < 0
- ) {
- gs_free_object(pdev->v_memory, st, "setup_image_compression");
- return code;
- }
+ stream_Downsample_state *const ss = (stream_Downsample_state *) st;
+
+ ss->Colors =
+ (pim->ColorSpace == 0 ? 1 /*mask*/ :
+ gs_color_space_num_components(pim->ColorSpace));
+ ss->WidthIn = pim->Width;
+ ss->HeightIn = pim->Height;
+ ss->XFactor = ss->YFactor = factor;
+ ss->AntiAlias = pdip->AntiAlias;
+ ss->padX = ss->padY = false; /* should be true */
+ if (template->init)
+ template->init(st);
+ pim->Width = s_Downsample_size_out(pim->Width, factor, ss->padX);
+ pim->Height = s_Downsample_size_out(pim->Height, factor, ss->padY);
+ pim->BitsPerComponent = pdip->Depth;
+ gs_matrix_scale(&pim->ImageMatrix, (double)pim->Width / orig_width,
+ (double)pim->Height / orig_height,
+ &pim->ImageMatrix);
+ /****** NO ANTI-ALIASING YET ******/
+ if ((code = setup_image_compression(pbw, pdip, pim, pis, lossless)) < 0 ||
+ (code = pixel_resize(pbw, pim->Width, ss->Colors,
+ 8, pdip->Depth)) < 0 ||
+ (code = psdf_encode_binary(pbw, template, st)) < 0 ||
+ (code = pixel_resize(pbw, orig_width, ss->Colors,
+ orig_bpc, 8)) < 0
+ ) {
+ gs_free_object(pdev->v_memory, st, "setup_image_compression");
+ return code;
+ }
}
return 0;
}
/* Decive whether to convert an image to RGB. */
bool
-psdf_is_converting_image_to_RGB(const gx_device_psdf * pdev,
- const gs_imager_state * pis, const gs_pixel_image_t * pim)
+psdf_is_converting_image_to_RGB(const gx_device_psdf * pdev,
+ const gs_imager_state * pis, const gs_pixel_image_t * pim)
{
return pdev->params.ConvertCMYKImagesToRGB &&
- pis != 0 && pim->ColorSpace &&
- (gs_color_space_get_index(pim->ColorSpace) == gs_color_space_index_DeviceCMYK ||
- (gs_color_space_get_index(pim->ColorSpace) == gs_color_space_index_ICC
- && gsicc_get_default_type(pim->ColorSpace->cmm_icc_profile_data) ==
- gs_color_space_index_DeviceCMYK));
+ pis != 0 && pim->ColorSpace &&
+ (gs_color_space_get_index(pim->ColorSpace) == gs_color_space_index_DeviceCMYK ||
+ (gs_color_space_get_index(pim->ColorSpace) == gs_color_space_index_ICC
+ && gsicc_get_default_type(pim->ColorSpace->cmm_icc_profile_data) ==
+ gs_color_space_index_DeviceCMYK));
}
-static inline void
-adjust_auto_filter_strategy(gx_device_psdf *pdev,
- psdf_image_params *params, gs_c_param_list *plist,
- const gs_pixel_image_t * pim, bool in_line)
+static inline void
+adjust_auto_filter_strategy(gx_device_psdf *pdev,
+ psdf_image_params *params, gs_c_param_list *plist,
+ const gs_pixel_image_t * pim, bool in_line)
{
#ifdef USE_LWF_JP2
if (!in_line && params->Depth > 1 && pdev->ParamCompatibilityLevel >= 1.5 &&
- pim->ColorSpace->type->index != gs_color_space_index_Indexed &&
- params->AutoFilter &&
- !strcmp(params->AutoFilterStrategy, "/JPEG2000")) {
- params->Filter = "/JPXEncode";
- params->filter_template = &s_jpxe_template;
- params->Dict = plist;
+ pim->ColorSpace->type->index != gs_color_space_index_Indexed &&
+ params->AutoFilter &&
+ !strcmp(params->AutoFilterStrategy, "/JPEG2000")) {
+ params->Filter = "/JPXEncode";
+ params->filter_template = &s_jpxe_template;
+ params->Dict = plist;
}
#endif
}
-static inline void
-adjust_auto_filter_strategy_mono(gx_device_psdf *pdev,
- psdf_image_params *params, gs_c_param_list *plist,
- const gs_pixel_image_t * pim, bool in_line)
+static inline void
+adjust_auto_filter_strategy_mono(gx_device_psdf *pdev,
+ psdf_image_params *params, gs_c_param_list *plist,
+ const gs_pixel_image_t * pim, bool in_line)
{
#ifdef USE_LDF_JB2
if (!in_line && pdev->ParamCompatibilityLevel >= 1.5 &&
- params->AutoFilter &&
- pim->ColorSpace->type->index != gs_color_space_index_Indexed) {
- params->Filter = "/JBIG2Encode";
- params->filter_template = &s_jbig2encode_template;
- params->Dict = plist;
+ params->AutoFilter &&
+ pim->ColorSpace->type->index != gs_color_space_index_Indexed) {
+ params->Filter = "/JBIG2Encode";
+ params->filter_template = &s_jbig2encode_template;
+ params->Dict = plist;
}
#endif
}
@@ -497,8 +497,8 @@ adjust_auto_filter_strategy_mono(gx_device_psdf *pdev,
/* Note that this may modify the image parameters. */
int
psdf_setup_image_filters(gx_device_psdf * pdev, psdf_binary_writer * pbw,
- gs_pixel_image_t * pim, const gs_matrix * pctm,
- const gs_imager_state * pis, bool lossless, bool in_line)
+ gs_pixel_image_t * pim, const gs_matrix * pctm,
+ const gs_imager_state * pis, bool lossless, bool in_line)
{
/*
* The following algorithms are per Adobe Tech Note # 5151,
@@ -522,29 +522,29 @@ psdf_setup_image_filters(gx_device_psdf * pdev, psdf_binary_writer * pbw,
* allowed.
*/
if (pim->ColorSpace == NULL) { /* mask image */
- params = pdev->params.MonoImage;
- params.Depth = 1;
- ncomp = 1;
+ params = pdev->params.MonoImage;
+ params.Depth = 1;
+ ncomp = 1;
} else {
- ncomp = gs_color_space_num_components(pim->ColorSpace);
- if (pim->ColorSpace->type->index == gs_color_space_index_Indexed) {
- params = pdev->params.ColorImage;
- /* Ensure we don't use JPEG on a /Indexed colour space */
- params.AutoFilter = false;
- params.Filter = "FlateEncode";
- } else {
- if (ncomp == 1) {
- if (bpc == 1)
- params = pdev->params.MonoImage;
- else
- params = pdev->params.GrayImage;
- if (params.Depth == -1)
- params.Depth = bpc;
- } else {
- params = pdev->params.ColorImage;
- /* params.Depth is reset below */
- }
- }
+ ncomp = gs_color_space_num_components(pim->ColorSpace);
+ if (pim->ColorSpace->type->index == gs_color_space_index_Indexed) {
+ params = pdev->params.ColorImage;
+ /* Ensure we don't use JPEG on a /Indexed colour space */
+ params.AutoFilter = false;
+ params.Filter = "FlateEncode";
+ } else {
+ if (ncomp == 1) {
+ if (bpc == 1)
+ params = pdev->params.MonoImage;
+ else
+ params = pdev->params.GrayImage;
+ if (params.Depth == -1)
+ params.Depth = bpc;
+ } else {
+ params = pdev->params.ColorImage;
+ /* params.Depth is reset below */
+ }
+ }
}
/*
@@ -553,82 +553,82 @@ psdf_setup_image_filters(gx_device_psdf * pdev, psdf_binary_writer * pbw,
* We can replace W by 1 to simplify the computation.
*/
if (pctm == 0)
- resolution = -1;
+ resolution = -1;
else {
- gs_point pt;
-
- /* We could do both X and Y, but why bother? */
- code = gs_distance_transform_inverse(1.0, 0.0, &pim->ImageMatrix, &pt);
- if (code < 0)
- return code;
- gs_distance_transform(pt.x, pt.y, pctm, &pt);
- resolution = 1.0 / hypot(pt.x / pdev->HWResolution[0],
- pt.y / pdev->HWResolution[1]);
+ gs_point pt;
+
+ /* We could do both X and Y, but why bother? */
+ code = gs_distance_transform_inverse(1.0, 0.0, &pim->ImageMatrix, &pt);
+ if (code < 0)
+ return code;
+ gs_distance_transform(pt.x, pt.y, pctm, &pt);
+ resolution = 1.0 / hypot(pt.x / pdev->HWResolution[0],
+ pt.y / pdev->HWResolution[1]);
}
if (ncomp == 1 && pim->ColorSpace && pim->ColorSpace->type->index != gs_color_space_index_Indexed) {
- /* Monochrome, gray, or mask */
- /* Check for downsampling. */
- if (do_downsample(&params, pim, resolution)) {
- /* Use the downsampled depth, not the original data depth. */
- if (params.Depth == 1) {
- params.Filter = pdev->params.MonoImage.Filter;
- params.filter_template = pdev->params.MonoImage.filter_template;
- params.Dict = pdev->params.MonoImage.Dict;
- adjust_auto_filter_strategy_mono(pdev, &params, pdev->params.MonoImage.Dict, pim, in_line);
- } else {
- params.Filter = pdev->params.GrayImage.Filter;
- params.filter_template = pdev->params.GrayImage.filter_template;
- params.Dict = pdev->params.GrayImage.Dict;
- adjust_auto_filter_strategy(pdev, &params, pdev->params.GrayImage.Dict, pim, in_line);
- }
- code = setup_downsampling(pbw, &params, pim, pis, resolution, lossless);
- } else {
- adjust_auto_filter_strategy(pdev, &params, pdev->params.GrayImage.Dict, pim, in_line);
- code = setup_image_compression(pbw, &params, pim, pis, lossless);
- }
- if (code < 0)
- return code;
- code = pixel_resize(pbw, pim->Width, ncomp, bpc, bpc_out);
+ /* Monochrome, gray, or mask */
+ /* Check for downsampling. */
+ if (do_downsample(&params, pim, resolution)) {
+ /* Use the downsampled depth, not the original data depth. */
+ if (params.Depth == 1) {
+ params.Filter = pdev->params.MonoImage.Filter;
+ params.filter_template = pdev->params.MonoImage.filter_template;
+ params.Dict = pdev->params.MonoImage.Dict;
+ adjust_auto_filter_strategy_mono(pdev, &params, pdev->params.MonoImage.Dict, pim, in_line);
+ } else {
+ params.Filter = pdev->params.GrayImage.Filter;
+ params.filter_template = pdev->params.GrayImage.filter_template;
+ params.Dict = pdev->params.GrayImage.Dict;
+ adjust_auto_filter_strategy(pdev, &params, pdev->params.GrayImage.Dict, pim, in_line);
+ }
+ code = setup_downsampling(pbw, &params, pim, pis, resolution, lossless);
+ } else {
+ adjust_auto_filter_strategy(pdev, &params, pdev->params.GrayImage.Dict, pim, in_line);
+ code = setup_image_compression(pbw, &params, pim, pis, lossless);
+ }
+ if (code < 0)
+ return code;
+ code = pixel_resize(pbw, pim->Width, ncomp, bpc, bpc_out);
} else {
- /* Color */
- bool cmyk_to_rgb = psdf_is_converting_image_to_RGB(pdev, pis, pim);
-
- if (cmyk_to_rgb) {
- gs_memory_t *mem = pdev->v_memory;
-
- /* {csrc} decref old colorspace? */
- rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
- pim->ColorSpace = gs_cspace_new_DeviceRGB(mem);
- }
- if (params.Depth == -1)
- params.Depth = (cmyk_to_rgb ? 8 : bpc_out);
- if (do_downsample(&params, pim, resolution)) {
- adjust_auto_filter_strategy(pdev, &params, pdev->params.ColorImage.Dict, pim, in_line);
- code = setup_downsampling(pbw, &params, pim, pis, resolution, lossless);
- } else {
- adjust_auto_filter_strategy(pdev, &params, pdev->params.ColorImage.Dict, pim, in_line);
- code = setup_image_compression(pbw, &params, pim, pis, lossless);
- }
- if (code < 0)
- return code;
- if (cmyk_to_rgb) {
- gs_memory_t *mem = pdev->v_memory;
- stream_C2R_state *ss = (stream_C2R_state *)
- s_alloc_state(mem, s_C2R_template.stype, "C2R state");
- int code = pixel_resize(pbw, pim->Width, 3, 8, bpc_out);
-
- if (code < 0 ||
- (code = psdf_encode_binary(pbw, &s_C2R_template,
- (stream_state *) ss)) < 0 ||
- (code = pixel_resize(pbw, pim->Width, 4, bpc, 8)) < 0
- )
- return code;
- s_C2R_init(ss, pis);
- } else {
- code = pixel_resize(pbw, pim->Width, ncomp, bpc, bpc_out);
- if (code < 0)
- return code;
- }
+ /* Color */
+ bool cmyk_to_rgb = psdf_is_converting_image_to_RGB(pdev, pis, pim);
+
+ if (cmyk_to_rgb) {
+ gs_memory_t *mem = pdev->v_memory;
+
+ /* {csrc} decref old colorspace? */
+ rc_decrement_only_cs(pim->ColorSpace, "psdf_setup_image_filters");
+ pim->ColorSpace = gs_cspace_new_DeviceRGB(mem);
+ }
+ if (params.Depth == -1)
+ params.Depth = (cmyk_to_rgb ? 8 : bpc_out);
+ if (do_downsample(&params, pim, resolution)) {
+ adjust_auto_filter_strategy(pdev, &params, pdev->params.ColorImage.Dict, pim, in_line);
+ code = setup_downsampling(pbw, &params, pim, pis, resolution, lossless);
+ } else {
+ adjust_auto_filter_strategy(pdev, &params, pdev->params.ColorImage.Dict, pim, in_line);
+ code = setup_image_compression(pbw, &params, pim, pis, lossless);
+ }
+ if (code < 0)
+ return code;
+ if (cmyk_to_rgb) {
+ gs_memory_t *mem = pdev->v_memory;
+ stream_C2R_state *ss = (stream_C2R_state *)
+ s_alloc_state(mem, s_C2R_template.stype, "C2R state");
+ int code = pixel_resize(pbw, pim->Width, 3, 8, bpc_out);
+
+ if (code < 0 ||
+ (code = psdf_encode_binary(pbw, &s_C2R_template,
+ (stream_state *) ss)) < 0 ||
+ (code = pixel_resize(pbw, pim->Width, 4, bpc, 8)) < 0
+ )
+ return code;
+ s_C2R_init(ss, pis);
+ } else {
+ code = pixel_resize(pbw, pim->Width, ncomp, bpc, bpc_out);
+ if (code < 0)
+ return code;
+ }
}
return code;
}
@@ -638,7 +638,7 @@ psdf_setup_image_filters(gx_device_psdf * pdev, psdf_binary_writer * pbw,
/* Note that this may modify the image parameters. */
int
psdf_setup_lossless_filters(gx_device_psdf *pdev, psdf_binary_writer *pbw,
- gs_pixel_image_t *pim, bool in_line)
+ gs_pixel_image_t *pim, bool in_line)
{
/*
* Set up a device with modified parameters for computing the image
@@ -662,77 +662,77 @@ psdf_setup_lossless_filters(gx_device_psdf *pdev, psdf_binary_writer *pbw,
/* Set up image compression chooser. */
int
psdf_setup_compression_chooser(psdf_binary_writer *pbw, gx_device_psdf *pdev,
- int width, int height, int depth, int bits_per_sample)
+ int width, int height, int depth, int bits_per_sample)
{
int code;
- stream_state *ss = s_alloc_state(pdev->memory, s_compr_chooser_template.stype,
+ stream_state *ss = s_alloc_state(pdev->memory, s_compr_chooser_template.stype,
"psdf_setup_compression_chooser");
if (ss == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pbw->memory = pdev->memory;
pbw->strm = pdev->strm; /* just a stub - will not write to it. */
pbw->dev = pdev;
pbw->target = pbw->strm; /* Since s_add_filter may insert NullEncode to comply buffering,
- will need to close a chain of filetrs. */
+ will need to close a chain of filetrs. */
code = psdf_encode_binary(pbw, &s_compr_chooser_template, ss);
if (code < 0)
- return code;
- code = s_compr_chooser_set_dimensions((stream_compr_chooser_state *)ss,
- width, height, depth, bits_per_sample);
+ return code;
+ code = s_compr_chooser_set_dimensions((stream_compr_chooser_state *)ss,
+ width, height, depth, bits_per_sample);
return code;
}
/* Set up an "image to mask" filter. */
int
psdf_setup_image_to_mask_filter(psdf_binary_writer *pbw, gx_device_psdf *pdev,
- int width, int height, int depth, int bits_per_sample, uint *MaskColor)
+ int width, int height, int depth, int bits_per_sample, uint *MaskColor)
{
int code;
- stream_state *ss = s_alloc_state(pdev->memory, s__image_colors_template.stype,
- "psdf_setup_image_colors_filter");
+ stream_state *ss = s_alloc_state(pdev->memory, s__image_colors_template.stype,
+ "psdf_setup_image_colors_filter");
if (ss == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pbw->memory = pdev->memory;
pbw->dev = pdev;
code = psdf_encode_binary(pbw, &s__image_colors_template, ss);
if (code < 0)
- return code;
- s_image_colors_set_dimensions((stream_image_colors_state *)ss,
- width, height, depth, bits_per_sample);
+ return code;
+ s_image_colors_set_dimensions((stream_image_colors_state *)ss,
+ width, height, depth, bits_per_sample);
s_image_colors_set_mask_colors((stream_image_colors_state *)ss, MaskColor);
return 0;
}
/* Set up an image colors filter. */
int
-psdf_setup_image_colors_filter(psdf_binary_writer *pbw,
- gx_device_psdf *pdev, gs_pixel_image_t * pim,
- const gs_imager_state *pis)
+psdf_setup_image_colors_filter(psdf_binary_writer *pbw,
+ gx_device_psdf *pdev, gs_pixel_image_t * pim,
+ const gs_imager_state *pis)
{ /* fixme: currently it's a stub convertion to mask. */
int code;
- stream_state *ss = s_alloc_state(pdev->memory, s__image_colors_template.stype,
- "psdf_setup_image_colors_filter");
+ stream_state *ss = s_alloc_state(pdev->memory, s__image_colors_template.stype,
+ "psdf_setup_image_colors_filter");
int i;
if (ss == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pbw->memory = pdev->memory;
pbw->dev = pdev;
code = psdf_encode_binary(pbw, &s__image_colors_template, ss);
if (code < 0)
- return code;
- s_image_colors_set_dimensions((stream_image_colors_state *)ss,
- pim->Width, pim->Height,
- gs_color_space_num_components(pim->ColorSpace),
- pim->BitsPerComponent);
- s_image_colors_set_color_space((stream_image_colors_state *)ss,
- (gx_device *)pdev, pim->ColorSpace, pis, pim->Decode);
+ return code;
+ s_image_colors_set_dimensions((stream_image_colors_state *)ss,
+ pim->Width, pim->Height,
+ gs_color_space_num_components(pim->ColorSpace),
+ pim->BitsPerComponent);
+ s_image_colors_set_color_space((stream_image_colors_state *)ss,
+ (gx_device *)pdev, pim->ColorSpace, pis, pim->Decode);
pim->BitsPerComponent = pdev->color_info.comp_bits[0]; /* Same precision for all components. */
for (i = 0; i < pdev->color_info.num_components; i++) {
- pim->Decode[i * 2 + 0] = 0;
- pim->Decode[i * 2 + 1] = 1;
+ pim->Decode[i * 2 + 0] = 0;
+ pim->Decode[i * 2 + 1] = 1;
}
return 0;
}
diff --git a/gs/base/gdevpsdp.c b/gs/base/gdevpsdp.c
index f6c2c2920..3fd1fd03d 100644
--- a/gs/base/gdevpsdp.c
+++ b/gs/base/gdevpsdp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,12 +34,10 @@
#include "sjpx_luratech.h"
#endif
-
-
/* Define a (bogus) GC descriptor for gs_param_string. */
/* The only ones we use are GC-able and not persistent. */
gs_private_st_composite(st_gs_param_string, gs_param_string, "gs_param_string",
- param_string_enum_ptrs, param_string_reloc_ptrs);
+ param_string_enum_ptrs, param_string_reloc_ptrs);
static
ENUM_PTRS_WITH(param_string_enum_ptrs, gs_param_string *pstr) return 0;
case 0: return ENUM_CONST_STRING(pstr);
@@ -55,9 +53,8 @@ RELOC_PTRS_WITH(param_string_reloc_ptrs, gs_param_string *pstr)
}
RELOC_PTRS_END
gs_private_st_element(st_param_string_element, gs_param_string,
- "gs_param_string[]", param_string_elt_enum_ptrs,
- param_string_elt_reloc_ptrs, st_gs_param_string);
-
+ "gs_param_string[]", param_string_elt_enum_ptrs,
+ param_string_elt_reloc_ptrs, st_gs_param_string);
/* ---------------- Get/put Distiller parameters ---------------- */
@@ -124,9 +121,9 @@ typedef struct psdf_image_param_names_s {
const char *Filter;
const char *AutoFilterStrategy;
gs_param_item_t items[9]; /* AutoFilter (not used for mono), */
- /* AntiAlias, */
- /* Depth, Downsample, DownsampleThreshold, */
- /* Encode, Resolution, AutoFilterStrategy, end marker */
+ /* AntiAlias, */
+ /* Depth, Downsample, DownsampleThreshold, */
+ /* Encode, Resolution, AutoFilterStrategy, end marker */
} psdf_image_param_names_t;
#define pi(key, type, memb) { key, type, offset_of(psdf_image_params, memb) }
#define psdf_image_param_names(acs, aa, af, de, di, ds, dt, dst, dstd, e, f, fns, r, afs)\
@@ -144,52 +141,52 @@ typedef struct psdf_image_param_names_s {
static const psdf_image_param_names_t Color_names = {
psdf_image_param_names(
- "ColorACSImageDict", "AntiAliasColorImages", "AutoFilterColorImages",
- "ColorImageDepth", "ColorImageDict",
- "DownsampleColorImages", "ColorImageDownsampleType",
- "ColorImageDownsampleThreshold", 1.5,
- "EncodeColorImages", "ColorImageFilter", Poly_filters,
- "ColorImageResolution", 0
+ "ColorACSImageDict", "AntiAliasColorImages", "AutoFilterColorImages",
+ "ColorImageDepth", "ColorImageDict",
+ "DownsampleColorImages", "ColorImageDownsampleType",
+ "ColorImageDownsampleThreshold", 1.5,
+ "EncodeColorImages", "ColorImageFilter", Poly_filters,
+ "ColorImageResolution", 0
)
};
static const psdf_image_param_names_t Gray_names = {
psdf_image_param_names(
- "GrayACSImageDict", "AntiAliasGrayImages", "AutoFilterGrayImages",
- "GrayImageDepth", "GrayImageDict",
- "DownsampleGrayImages", "GrayImageDownsampleType",
- "GrayImageDownsampleThreshold", 2.0,
- "EncodeGrayImages", "GrayImageFilter", Poly_filters,
- "GrayImageResolution", 0
+ "GrayACSImageDict", "AntiAliasGrayImages", "AutoFilterGrayImages",
+ "GrayImageDepth", "GrayImageDict",
+ "DownsampleGrayImages", "GrayImageDownsampleType",
+ "GrayImageDownsampleThreshold", 2.0,
+ "EncodeGrayImages", "GrayImageFilter", Poly_filters,
+ "GrayImageResolution", 0
)
};
static const psdf_image_param_names_t Mono_names = {
psdf_image_param_names(
- 0, "AntiAliasMonoImages", 0,
- "MonoImageDepth", "MonoImageDict",
- "DownsampleMonoImages", "MonoImageDownsampleType",
- "MonoImageDownsampleThreshold", 2.0,
- "EncodeMonoImages", "MonoImageFilter", Mono_filters,
- "MonoImageResolution", 0
+ 0, "AntiAliasMonoImages", 0,
+ "MonoImageDepth", "MonoImageDict",
+ "DownsampleMonoImages", "MonoImageDownsampleType",
+ "MonoImageDownsampleThreshold", 2.0,
+ "EncodeMonoImages", "MonoImageFilter", Mono_filters,
+ "MonoImageResolution", 0
)
};
static const psdf_image_param_names_t Color_names15 = {
psdf_image_param_names(
- "ColorACSImageDict", "AntiAliasColorImages", "AutoFilterColorImages",
- "ColorImageDepth", "ColorImageDict",
- "DownsampleColorImages", "ColorImageDownsampleType",
- "ColorImageDownsampleThreshold", 1.5,
- "EncodeColorImages", "ColorImageFilter", Poly_filters,
- "ColorImageResolution", "ColorAutoFilterStrategy"
+ "ColorACSImageDict", "AntiAliasColorImages", "AutoFilterColorImages",
+ "ColorImageDepth", "ColorImageDict",
+ "DownsampleColorImages", "ColorImageDownsampleType",
+ "ColorImageDownsampleThreshold", 1.5,
+ "EncodeColorImages", "ColorImageFilter", Poly_filters,
+ "ColorImageResolution", "ColorAutoFilterStrategy"
)
};
static const psdf_image_param_names_t Gray_names15 = {
psdf_image_param_names(
- "GrayACSImageDict", "AntiAliasGrayImages", "AutoFilterGrayImages",
- "GrayImageDepth", "GrayImageDict",
- "DownsampleGrayImages", "GrayImageDownsampleType",
- "GrayImageDownsampleThreshold", 2.0,
- "EncodeGrayImages", "GrayImageFilter", Poly_filters,
- "GrayImageResolution", "GrayAutoFilterStrategy"
+ "GrayACSImageDict", "AntiAliasGrayImages", "AutoFilterGrayImages",
+ "GrayImageDepth", "GrayImageDict",
+ "DownsampleGrayImages", "GrayImageDownsampleType",
+ "GrayImageDownsampleThreshold", 2.0,
+ "EncodeGrayImages", "GrayImageFilter", Poly_filters,
+ "GrayImageResolution", "GrayAutoFilterStrategy"
)
};
#undef pi
@@ -270,7 +267,7 @@ psdf_write_name(gs_param_list *plist, const char *key, const char *str)
static int
psdf_write_string_param(gs_param_list *plist, const char *key,
- const gs_const_string *pstr)
+ const gs_const_string *pstr)
{
gs_param_string ps;
@@ -286,19 +283,19 @@ psdf_write_string_param(gs_param_list *plist, const char *key,
*/
static int
psdf_get_image_dict_param(gs_param_list * plist, const gs_param_name pname,
- gs_c_param_list *plvalue)
+ gs_c_param_list *plvalue)
{
gs_param_dict dict;
int code;
if (pname == 0)
- return 0;
+ return 0;
dict.size = 12; /* enough for all param dicts we know about */
if ((code = param_begin_write_dict(plist, pname, &dict, false)) < 0)
- return code;
+ return code;
if (plvalue != 0) {
- gs_c_param_list_read(plvalue);
- code = param_list_copy(dict.list, (gs_param_list *)plvalue);
+ gs_c_param_list_read(plvalue);
+ code = param_list_copy(dict.list, (gs_param_list *)plvalue);
}
param_end_write_dict(plist, pname, &dict);
return code;
@@ -307,11 +304,11 @@ psdf_get_image_dict_param(gs_param_list * plist, const gs_param_name pname,
/* Get a set of image-related parameters. */
static int
psdf_get_image_params(gs_param_list * plist,
- const psdf_image_param_names_t * pnames, psdf_image_params * params)
+ const psdf_image_param_names_t * pnames, psdf_image_params * params)
{
/* Skip AutoFilter for mono images. */
const gs_param_item_t *items =
- (pnames->items[0].key == 0 ? pnames->items + 1 : pnames->items);
+ (pnames->items[0].key == 0 ? pnames->items + 1 : pnames->items);
int code;
/*
@@ -320,45 +317,45 @@ psdf_get_image_params(gs_param_list * plist,
* from the command line.
*/
if (
- (code = gs_param_write_items(plist, params, NULL, items)) < 0 ||
- (code = psdf_get_image_dict_param(plist, pnames->ACSDict,
- params->ACSDict)) < 0 ||
- /* (AntiAlias) */
- /* (AutoFilter) */
- /* (Depth) */
- (code = psdf_get_image_dict_param(plist, pnames->Dict,
- params->Dict)) < 0 ||
- /* (Downsample) */
- (code = psdf_write_name(plist, pnames->DownsampleType,
- DownsampleType_names[params->DownsampleType])) < 0 ||
- /* (DownsampleThreshold) */
- /* (Encode) */
- (code = psdf_write_name(plist, pnames->Filter,
- (params->Filter == 0 ?
- pnames->filter_names[0].pname :
- params->Filter))) < 0
- /* (Resolution) */
+ (code = gs_param_write_items(plist, params, NULL, items)) < 0 ||
+ (code = psdf_get_image_dict_param(plist, pnames->ACSDict,
+ params->ACSDict)) < 0 ||
+ /* (AntiAlias) */
+ /* (AutoFilter) */
+ /* (Depth) */
+ (code = psdf_get_image_dict_param(plist, pnames->Dict,
+ params->Dict)) < 0 ||
+ /* (Downsample) */
+ (code = psdf_write_name(plist, pnames->DownsampleType,
+ DownsampleType_names[params->DownsampleType])) < 0 ||
+ /* (DownsampleThreshold) */
+ /* (Encode) */
+ (code = psdf_write_name(plist, pnames->Filter,
+ (params->Filter == 0 ?
+ pnames->filter_names[0].pname :
+ params->Filter))) < 0
+ /* (Resolution) */
#ifdef USE_LWF_JP2
- ||
- (pnames->AutoFilterStrategy != 0 &&
- (code = psdf_write_name(plist, pnames->AutoFilterStrategy,
- (params->AutoFilterStrategy == 0 ?
- "JPEG2000" : params->AutoFilterStrategy))) < 0)
+ ||
+ (pnames->AutoFilterStrategy != 0 &&
+ (code = psdf_write_name(plist, pnames->AutoFilterStrategy,
+ (params->AutoFilterStrategy == 0 ?
+ "JPEG2000" : params->AutoFilterStrategy))) < 0)
#endif
- )
- DO_NOTHING;
+ )
+ DO_NOTHING;
return code;
}
/* Get a font embedding parameter. */
static int
psdf_get_embed_param(gs_param_list *plist, gs_param_name allpname,
- const gs_param_string_array *psa)
+ const gs_param_string_array *psa)
{
int code = param_write_name_array(plist, allpname, psa);
if (code >= 0)
- code = param_write_name_array(plist, allpname + 1, psa);
+ code = param_write_name_array(plist, allpname + 1, psa);
return code;
}
@@ -370,56 +367,56 @@ gdev_psdf_get_params(gx_device * dev, gs_param_list * plist)
int code = gdev_vector_get_params(dev, plist);
if (
- code < 0 ||
- (code = gs_param_write_items(plist, &pdev->params, NULL, psdf_param_items)) < 0 ||
+ code < 0 ||
+ (code = gs_param_write_items(plist, &pdev->params, NULL, psdf_param_items)) < 0 ||
/* General parameters */
- (code = psdf_write_name(plist, "AutoRotatePages",
- AutoRotatePages_names[(int)pdev->params.AutoRotatePages])) < 0 ||
- (code = psdf_write_name(plist, "Binding",
- Binding_names[(int)pdev->params.Binding])) < 0 ||
- (code = psdf_write_name(plist, "DefaultRenderingIntent",
- DefaultRenderingIntent_names[(int)pdev->params.DefaultRenderingIntent])) < 0 ||
- (code = psdf_write_name(plist, "TransferFunctionInfo",
- TransferFunctionInfo_names[(int)pdev->params.TransferFunctionInfo])) < 0 ||
- (code = psdf_write_name(plist, "UCRandBGInfo",
- UCRandBGInfo_names[(int)pdev->params.UCRandBGInfo])) < 0 ||
+ (code = psdf_write_name(plist, "AutoRotatePages",
+ AutoRotatePages_names[(int)pdev->params.AutoRotatePages])) < 0 ||
+ (code = psdf_write_name(plist, "Binding",
+ Binding_names[(int)pdev->params.Binding])) < 0 ||
+ (code = psdf_write_name(plist, "DefaultRenderingIntent",
+ DefaultRenderingIntent_names[(int)pdev->params.DefaultRenderingIntent])) < 0 ||
+ (code = psdf_write_name(plist, "TransferFunctionInfo",
+ TransferFunctionInfo_names[(int)pdev->params.TransferFunctionInfo])) < 0 ||
+ (code = psdf_write_name(plist, "UCRandBGInfo",
+ UCRandBGInfo_names[(int)pdev->params.UCRandBGInfo])) < 0 ||
/* Color sampled image parameters */
- (code = psdf_get_image_params(plist,
- (pdev->ParamCompatibilityLevel >= 1.5 ? &Color_names15 : &Color_names),
- &pdev->params.ColorImage)) < 0 ||
- (code = psdf_write_name(plist, "ColorConversionStrategy",
- ColorConversionStrategy_names[(int)pdev->params.ColorConversionStrategy])) < 0 ||
- (code = psdf_write_string_param(plist, "CalCMYKProfile",
- &pdev->params.CalCMYKProfile)) < 0 ||
- (code = psdf_write_string_param(plist, "CalGrayProfile",
- &pdev->params.CalGrayProfile)) < 0 ||
- (code = psdf_write_string_param(plist, "CalRGBProfile",
- &pdev->params.CalRGBProfile)) < 0 ||
- (code = psdf_write_string_param(plist, "sRGBProfile",
- &pdev->params.sRGBProfile)) < 0 ||
+ (code = psdf_get_image_params(plist,
+ (pdev->ParamCompatibilityLevel >= 1.5 ? &Color_names15 : &Color_names),
+ &pdev->params.ColorImage)) < 0 ||
+ (code = psdf_write_name(plist, "ColorConversionStrategy",
+ ColorConversionStrategy_names[(int)pdev->params.ColorConversionStrategy])) < 0 ||
+ (code = psdf_write_string_param(plist, "CalCMYKProfile",
+ &pdev->params.CalCMYKProfile)) < 0 ||
+ (code = psdf_write_string_param(plist, "CalGrayProfile",
+ &pdev->params.CalGrayProfile)) < 0 ||
+ (code = psdf_write_string_param(plist, "CalRGBProfile",
+ &pdev->params.CalRGBProfile)) < 0 ||
+ (code = psdf_write_string_param(plist, "sRGBProfile",
+ &pdev->params.sRGBProfile)) < 0 ||
/* Gray sampled image parameters */
- (code = psdf_get_image_params(plist,
- (pdev->ParamCompatibilityLevel >= 1.5 ? &Gray_names15 : &Gray_names),
- &pdev->params.GrayImage)) < 0 ||
+ (code = psdf_get_image_params(plist,
+ (pdev->ParamCompatibilityLevel >= 1.5 ? &Gray_names15 : &Gray_names),
+ &pdev->params.GrayImage)) < 0 ||
/* Mono sampled image parameters */
- (code = psdf_get_image_params(plist, &Mono_names, &pdev->params.MonoImage)) < 0 ||
+ (code = psdf_get_image_params(plist, &Mono_names, &pdev->params.MonoImage)) < 0 ||
/* Font embedding parameters */
- (code = psdf_get_embed_param(plist, ".AlwaysEmbed", &pdev->params.AlwaysEmbed)) < 0 ||
- (code = psdf_get_embed_param(plist, ".NeverEmbed", &pdev->params.NeverEmbed)) < 0 ||
- (code = psdf_write_name(plist, "CannotEmbedFontPolicy",
- CannotEmbedFontPolicy_names[(int)pdev->params.CannotEmbedFontPolicy])) < 0
- )
- DO_NOTHING;
+ (code = psdf_get_embed_param(plist, ".AlwaysEmbed", &pdev->params.AlwaysEmbed)) < 0 ||
+ (code = psdf_get_embed_param(plist, ".NeverEmbed", &pdev->params.NeverEmbed)) < 0 ||
+ (code = psdf_write_name(plist, "CannotEmbedFontPolicy",
+ CannotEmbedFontPolicy_names[(int)pdev->params.CannotEmbedFontPolicy])) < 0
+ )
+ DO_NOTHING;
return code;
}
@@ -431,27 +428,27 @@ typedef stream_state_proc_put_params((*ss_put_params_t), stream_state);
static int
psdf_read_string_param(gs_param_list *plist, const char *key,
- gs_const_string *pstr, gs_memory_t *mem, int ecode)
+ gs_const_string *pstr, gs_memory_t *mem, int ecode)
{
gs_param_string ps;
int code;
switch (code = param_read_string(plist, key, &ps)) {
case 0: {
- uint size = ps.size;
- byte *data = gs_alloc_string(mem, size, "psdf_read_string_param");
-
- if (data == 0)
- return_error(gs_error_VMerror);
- memcpy(data, ps.data, size);
- pstr->data = data;
- pstr->size = size;
- break;
+ uint size = ps.size;
+ byte *data = gs_alloc_string(mem, size, "psdf_read_string_param");
+
+ if (data == 0)
+ return_error(gs_error_VMerror);
+ memcpy(data, ps.data, size);
+ pstr->data = data;
+ pstr->size = size;
+ break;
}
default:
- ecode = code;
+ ecode = code;
case 1:
- break;
+ break;
}
return ecode;
}
@@ -462,7 +459,7 @@ psdf_read_string_param(gs_param_list *plist, const char *key,
*/
static int
psdf_put_enum(gs_param_list *plist, const char *key, int value,
- const char *const pnames[], int *pecode)
+ const char *const pnames[], int *pecode)
{
*pecode = param_put_enum(plist, key, &value, pnames, *pecode);
return value;
@@ -483,24 +480,24 @@ static int
psdf_DCT_put_params(gs_param_list * plist, stream_state * st)
{
return psdf_DCT_filter(plist, st, 8 /*nominal*/, 8 /*ibid.*/, 3 /*ibid.*/,
- NULL);
+ NULL);
}
/* Put [~](Always|Never)Embed parameters. */
/* Returns 0 = OK, 1 = no paramewter specified, <0 = error. */
static int
param_read_embed_array(gs_param_list * plist, gs_param_name pname,
- gs_param_string_array * psa)
+ gs_param_string_array * psa)
{
int code;
psa->data = 0, psa->size = 0;
switch (code = param_read_name_array(plist, pname, psa)) {
- default:
- param_signal_error(plist, pname, code);
- case 0:
- case 1:
- break;
+ default:
+ param_signal_error(plist, pname, code);
+ case 0:
+ case 1:
+ break;
}
return code;
}
@@ -511,79 +508,79 @@ param_string_eq(const gs_param_string *ps1, const gs_param_string *ps2)
}
static int
add_embed(gs_param_string_array *prsa, const gs_param_string_array *psa,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
uint i;
gs_param_string *const rdata =
- (gs_param_string *)prsa->data; /* break const */
+ (gs_param_string *)prsa->data; /* break const */
uint count = prsa->size;
for (i = 0; i < psa->size; ++i) {
- uint j;
-
- for (j = 0; j < count; ++j)
- if (param_string_eq(&psa->data[i], &rdata[j]))
- break;
- if (j == count) {
- uint size = psa->data[i].size;
- byte *data = gs_alloc_string(mem, size, "add_embed");
-
- if (data == 0)
- return_error(gs_error_VMerror);
- memcpy(data, psa->data[i].data, size);
- rdata[count].data = data;
- rdata[count].size = size;
- rdata[count].persistent = false;
- count++;
- }
+ uint j;
+
+ for (j = 0; j < count; ++j)
+ if (param_string_eq(&psa->data[i], &rdata[j]))
+ break;
+ if (j == count) {
+ uint size = psa->data[i].size;
+ byte *data = gs_alloc_string(mem, size, "add_embed");
+
+ if (data == 0)
+ return_error(gs_error_VMerror);
+ memcpy(data, psa->data[i].data, size);
+ rdata[count].data = data;
+ rdata[count].size = size;
+ rdata[count].persistent = false;
+ count++;
+ }
}
prsa->size = count;
return 0;
}
static void
delete_embed(gs_param_string_array *prsa, const gs_param_string_array *pnsa,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
uint i;
gs_param_string *const rdata =
- (gs_param_string *)prsa->data; /* break const */
+ (gs_param_string *)prsa->data; /* break const */
uint count = prsa->size;
for (i = pnsa->size; i-- > 0;) {
- uint j;
-
- for (j = count; j-- > 0;)
- if (param_string_eq(&pnsa->data[i], &rdata[j]))
- break;
- if (j + 1 != 0) {
- gs_free_const_string(mem, rdata[j].data, rdata[j].size,
- "delete_embed");
- rdata[j] = rdata[--count];
- }
+ uint j;
+
+ for (j = count; j-- > 0;)
+ if (param_string_eq(&pnsa->data[i], &rdata[j]))
+ break;
+ if (j + 1 != 0) {
+ gs_free_const_string(mem, rdata[j].data, rdata[j].size,
+ "delete_embed");
+ rdata[j] = rdata[--count];
+ }
}
prsa->size = count;
}
-static int merge_embed(gs_param_string_array * psa, gs_param_string_array * asa,
- gs_memory_t *mem)
+static int merge_embed(gs_param_string_array * psa, gs_param_string_array * asa,
+ gs_memory_t *mem)
{
gs_param_string_array rsa;
gs_param_string *rdata;
int code;
rdata = gs_alloc_struct_array(mem, psa->size + asa->size,
- gs_param_string,
- &st_param_string_element,
- "psdf_put_embed_param(update)");
+ gs_param_string,
+ &st_param_string_element,
+ "psdf_put_embed_param(update)");
if (rdata == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(rdata, psa->data, psa->size * sizeof(*psa->data));
rsa.data = rdata;
rsa.size = psa->size;
rsa.persistent = false;
code = add_embed(&rsa, asa, mem);
if (code < 0) {
- gs_free_object(mem, rdata, "psdf_put_embed_param(update)");
- return code;
+ gs_free_object(mem, rdata, "psdf_put_embed_param(update)");
+ return code;
}
gs_free_const_object(mem, psa->data, "psdf_put_embed_param(free)");
*psa = rsa;
@@ -592,8 +589,8 @@ static int merge_embed(gs_param_string_array * psa, gs_param_string_array * asa,
static int
psdf_put_embed_param(gs_param_list * plist, gs_param_name notpname,
- gs_param_name pname, gs_param_string_array * psa,
- gs_memory_t *mem, int ecode)
+ gs_param_name pname, gs_param_string_array * psa,
+ gs_memory_t *mem, int ecode)
{
gs_param_name allpname = pname + 1;
gs_param_string_array sa, nsa, asa;
@@ -602,52 +599,52 @@ psdf_put_embed_param(gs_param_list * plist, gs_param_name notpname,
mem = gs_memory_stable(mem);
code = param_read_embed_array(plist, pname, &sa);
if (code < 0)
- return code;
+ return code;
if (code == 0) {
- /* Optimize for sa == *psa. */
- int i;
+ /* Optimize for sa == *psa. */
+ int i;
- if (sa.size == psa->size) {
- for (i = 0; i < sa.size; ++i) {
- if (!param_string_eq(&sa.data[i], &psa->data[i]))
- break;
+ if (sa.size == psa->size) {
+ for (i = 0; i < sa.size; ++i) {
+ if (!param_string_eq(&sa.data[i], &psa->data[i]))
+ break;
}
- } else
- i = -1;
- if (i == sa.size) {
- /* equal, no-op. */
- } else {
- delete_embed(psa, psa, mem);
- code = merge_embed(psa, &sa, mem);
- if (code < 0)
- return code;
- }
+ } else
+ i = -1;
+ if (i == sa.size) {
+ /* equal, no-op. */
+ } else {
+ delete_embed(psa, psa, mem);
+ code = merge_embed(psa, &sa, mem);
+ if (code < 0)
+ return code;
+ }
}
code = param_read_embed_array(plist, notpname, &nsa);
if (code < 0)
- return code;
+ return code;
if (nsa.data != 0)
- delete_embed(psa, &nsa, mem);
+ delete_embed(psa, &nsa, mem);
code = param_read_embed_array(plist, allpname, &asa);
if (code < 0)
- return code;
+ return code;
if (asa.data != 0) {
- code = merge_embed(psa, &asa, mem);
- if (code < 0)
- return code;
+ code = merge_embed(psa, &asa, mem);
+ if (code < 0)
+ return code;
}
if (psa->data)
- psa->data = gs_resize_object(mem, (gs_param_string *)psa->data, psa->size,
- "psdf_put_embed_param(resize)");
+ psa->data = gs_resize_object(mem, (gs_param_string *)psa->data, psa->size,
+ "psdf_put_embed_param(resize)");
return 0;
}
/* Put an image Dict parameter. */
static int
psdf_put_image_dict_param(gs_param_list * plist, const gs_param_name pname,
- gs_c_param_list **pplvalue,
- const stream_template * template,
- ss_put_params_t put_params, gs_memory_t * mem)
+ gs_c_param_list **pplvalue,
+ const stream_template * template,
+ ss_put_params_t put_params, gs_memory_t * mem)
{
gs_param_dict dict;
gs_c_param_list *plvalue = *pplvalue;
@@ -655,47 +652,47 @@ psdf_put_image_dict_param(gs_param_list * plist, const gs_param_name pname,
mem = gs_memory_stable(mem);
switch (code = param_begin_read_dict(plist, pname, &dict, false)) {
- default:
- param_signal_error(plist, pname, code);
- return code;
- case 1:
- return 0;
- case 0: {
- /* Check the parameter values now. */
- stream_state *ss = s_alloc_state(mem, template->stype, pname);
-
- if (ss == 0)
- return_error(gs_error_VMerror);
- ss->template = template;
- if (template->set_defaults)
- template->set_defaults(ss);
- code = put_params(dict.list, ss);
- if (template->release)
- template->release(ss);
- gs_free_object(mem, ss, pname);
- if (code < 0) {
- param_signal_error(plist, pname, code);
- } else {
- plvalue = gs_c_param_list_alloc(mem, pname);
- if (plvalue == 0)
- return_error(gs_error_VMerror);
- gs_c_param_list_write(plvalue, mem);
- code = param_list_copy((gs_param_list *)plvalue,
- dict.list);
- if (code < 0) {
- gs_c_param_list_release(plvalue);
- gs_free_object(mem, plvalue, pname);
- plvalue = *pplvalue;
- }
- }
- }
- param_end_read_dict(plist, pname, &dict);
- break;
+ default:
+ param_signal_error(plist, pname, code);
+ return code;
+ case 1:
+ return 0;
+ case 0: {
+ /* Check the parameter values now. */
+ stream_state *ss = s_alloc_state(mem, template->stype, pname);
+
+ if (ss == 0)
+ return_error(gs_error_VMerror);
+ ss->template = template;
+ if (template->set_defaults)
+ template->set_defaults(ss);
+ code = put_params(dict.list, ss);
+ if (template->release)
+ template->release(ss);
+ gs_free_object(mem, ss, pname);
+ if (code < 0) {
+ param_signal_error(plist, pname, code);
+ } else {
+ plvalue = gs_c_param_list_alloc(mem, pname);
+ if (plvalue == 0)
+ return_error(gs_error_VMerror);
+ gs_c_param_list_write(plvalue, mem);
+ code = param_list_copy((gs_param_list *)plvalue,
+ dict.list);
+ if (code < 0) {
+ gs_c_param_list_release(plvalue);
+ gs_free_object(mem, plvalue, pname);
+ plvalue = *pplvalue;
+ }
+ }
+ }
+ param_end_read_dict(plist, pname, &dict);
+ break;
}
if (plvalue != *pplvalue) {
- if (*pplvalue)
- gs_c_param_list_release(*pplvalue);
- *pplvalue = plvalue;
+ if (*pplvalue)
+ gs_c_param_list_release(*pplvalue);
+ *pplvalue = plvalue;
}
return code;
}
@@ -703,8 +700,8 @@ psdf_put_image_dict_param(gs_param_list * plist, const gs_param_name pname,
/* Put a set of image-related parameters. */
static int
psdf_put_image_params(const gx_device_psdf * pdev, gs_param_list * plist,
- const psdf_image_param_names_t * pnames,
- psdf_image_params * params, int ecode)
+ const psdf_image_param_names_t * pnames,
+ psdf_image_params * params, int ecode)
{
gs_param_string fs;
/*
@@ -715,116 +712,116 @@ psdf_put_image_params(const gx_device_psdf * pdev, gs_param_list * plist,
gs_param_name pname;
/* Skip AutoFilter for mono images. */
const gs_param_item_t *items =
- (pnames->items[0].key == 0 ? pnames->items + 1 : pnames->items);
+ (pnames->items[0].key == 0 ? pnames->items + 1 : pnames->items);
int code = gs_param_read_items(plist, params, items);
if ((pname = pnames->ACSDict) != 0) {
- code = psdf_put_image_dict_param(plist, pname, &params->ACSDict,
- &s_DCTE_template,
- psdf_DCT_put_params, mem);
- if (code < 0)
- ecode = code;
+ code = psdf_put_image_dict_param(plist, pname, &params->ACSDict,
+ &s_DCTE_template,
+ psdf_DCT_put_params, mem);
+ if (code < 0)
+ ecode = code;
}
/* (AntiAlias) */
/* (AutoFilter) */
/* (Depth) */
if ((pname = pnames->Dict) != 0) {
- const stream_template *template;
- ss_put_params_t put_params;
-
- /* Hack to determine what kind of a Dict we want: */
- if (pnames->Dict[0] == 'M')
- template = &s_CFE_template,
- put_params = psdf_CF_put_params;
- else
- template = &s_DCTE_template,
- put_params = psdf_DCT_put_params;
- code = psdf_put_image_dict_param(plist, pname, &params->Dict,
- template, put_params, mem);
- if (code < 0)
- ecode = code;
+ const stream_template *template;
+ ss_put_params_t put_params;
+
+ /* Hack to determine what kind of a Dict we want: */
+ if (pnames->Dict[0] == 'M')
+ template = &s_CFE_template,
+ put_params = psdf_CF_put_params;
+ else
+ template = &s_DCTE_template,
+ put_params = psdf_DCT_put_params;
+ code = psdf_put_image_dict_param(plist, pname, &params->Dict,
+ template, put_params, mem);
+ if (code < 0)
+ ecode = code;
}
/* (Downsample) */
params->DownsampleType = (enum psdf_downsample_type)
- psdf_put_enum(plist, pnames->DownsampleType,
- (int)params->DownsampleType, DownsampleType_names,
- &ecode);
+ psdf_put_enum(plist, pnames->DownsampleType,
+ (int)params->DownsampleType, DownsampleType_names,
+ &ecode);
/* (DownsampleThreshold) */
/* (Encode) */
#ifdef USE_LWF_JP2
- /* Process AutoFilterStrategy before Filter, because it sets defaults
+ /* Process AutoFilterStrategy before Filter, because it sets defaults
for the latter. */
if (pnames->AutoFilterStrategy != NULL) {
- switch (code = param_read_string(plist, pnames->AutoFilterStrategy, &fs)) {
- case 0:
- {
- const psdf_image_filter_name *pn = pnames->filter_names;
- const char *param_name = 0;
-
- if (gs_param_string_eq(&fs, "/JPEG")) {
- params->AutoFilterStrategy = "/JPEG";
- param_name = "DCTEncode";
- } if (gs_param_string_eq(&fs, "/JPEG2000")) {
- params->AutoFilterStrategy = "/JPEG2000";
- param_name = "JPXEncode";
- } else {
- ecode = gs_error_rangecheck;
- goto ipe1;
- }
- while (pn->pname != 0 && !gs_param_string_eq(&fs, param_name))
- pn++;
- if (pn->pname != 0 && pn->min_version <= pdev->version) {
- params->Filter = pn->pname;
- params->filter_template = pn->template;
- }
- break;
- }
- default:
- ecode = code;
- ipe1:param_signal_error(plist, pnames->AutoFilterStrategy, ecode);
- case 1:
- break;
+ switch (code = param_read_string(plist, pnames->AutoFilterStrategy, &fs)) {
+ case 0:
+ {
+ const psdf_image_filter_name *pn = pnames->filter_names;
+ const char *param_name = 0;
+
+ if (gs_param_string_eq(&fs, "/JPEG")) {
+ params->AutoFilterStrategy = "/JPEG";
+ param_name = "DCTEncode";
+ } if (gs_param_string_eq(&fs, "/JPEG2000")) {
+ params->AutoFilterStrategy = "/JPEG2000";
+ param_name = "JPXEncode";
+ } else {
+ ecode = gs_error_rangecheck;
+ goto ipe1;
+ }
+ while (pn->pname != 0 && !gs_param_string_eq(&fs, param_name))
+ pn++;
+ if (pn->pname != 0 && pn->min_version <= pdev->version) {
+ params->Filter = pn->pname;
+ params->filter_template = pn->template;
+ }
+ break;
+ }
+ default:
+ ecode = code;
+ ipe1:param_signal_error(plist, pnames->AutoFilterStrategy, ecode);
+ case 1:
+ break;
}
}
#endif
switch (code = param_read_string(plist, pnames->Filter, &fs)) {
- case 0:
- {
- const psdf_image_filter_name *pn = pnames->filter_names;
-
- while (pn->pname != 0 && !gs_param_string_eq(&fs, pn->pname))
- pn++;
- if (pn->pname == 0 || pn->min_version > pdev->version) {
- ecode = gs_error_rangecheck;
- goto ipe;
- }
- params->Filter = pn->pname;
- params->filter_template = pn->template;
- break;
- }
- default:
- ecode = code;
- ipe:param_signal_error(plist, pnames->Filter, ecode);
- case 1:
- break;
+ case 0:
+ {
+ const psdf_image_filter_name *pn = pnames->filter_names;
+
+ while (pn->pname != 0 && !gs_param_string_eq(&fs, pn->pname))
+ pn++;
+ if (pn->pname == 0 || pn->min_version > pdev->version) {
+ ecode = gs_error_rangecheck;
+ goto ipe;
+ }
+ params->Filter = pn->pname;
+ params->filter_template = pn->template;
+ break;
+ }
+ default:
+ ecode = code;
+ ipe:param_signal_error(plist, pnames->Filter, ecode);
+ case 1:
+ break;
}
/* (Resolution) */
if (ecode >= 0) { /* Force parameters to acceptable values. */
- if (params->Resolution < 1)
- params->Resolution = 1;
- if (params->DownsampleThreshold < 1 ||
- params->DownsampleThreshold > 10)
- params->DownsampleThreshold = pnames->DownsampleThreshold_default;
- switch (params->Depth) {
- default:
- params->Depth = -1;
- case 1:
- case 2:
- case 4:
- case 8:
- case -1:
- break;
- }
+ if (params->Resolution < 1)
+ params->Resolution = 1;
+ if (params->DownsampleThreshold < 1 ||
+ params->DownsampleThreshold > 10)
+ params->DownsampleThreshold = pnames->DownsampleThreshold_default;
+ switch (params->Depth) {
+ default:
+ params->Depth = -1;
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case -1:
+ break;
+ }
}
return ecode;
}
@@ -835,7 +832,7 @@ gdev_psdf_put_params(gx_device * dev, gs_param_list * plist)
{
gx_device_psdf *pdev = (gx_device_psdf *) dev;
gs_memory_t *mem =
- (pdev->v_memory ? pdev->v_memory : dev->memory);
+ (pdev->v_memory ? pdev->v_memory : dev->memory);
int ecode, code;
psdf_distiller_params params;
@@ -847,79 +844,79 @@ gdev_psdf_put_params(gx_device * dev, gs_param_list * plist)
* standard device parameters.
*/
ecode = code = param_read_bool(plist, "LockDistillerParams",
- &params.LockDistillerParams);
+ &params.LockDistillerParams);
if (!(pdev->params.LockDistillerParams && params.LockDistillerParams)) {
-
- /* General parameters. */
-
- code = gs_param_read_items(plist, &params, psdf_param_items);
- if (code < 0)
- ecode = code;
- params.AutoRotatePages = (enum psdf_auto_rotate_pages)
- psdf_put_enum(plist, "AutoRotatePages", (int)params.AutoRotatePages,
- AutoRotatePages_names, &ecode);
- params.Binding = (enum psdf_binding)
- psdf_put_enum(plist, "Binding", (int)params.Binding,
- Binding_names, &ecode);
- params.DefaultRenderingIntent = (enum psdf_default_rendering_intent)
- psdf_put_enum(plist, "DefaultRenderingIntent",
- (int)params.DefaultRenderingIntent,
- DefaultRenderingIntent_names, &ecode);
- params.TransferFunctionInfo = (enum psdf_transfer_function_info)
- psdf_put_enum(plist, "TransferFunctionInfo",
- (int)params.TransferFunctionInfo,
- TransferFunctionInfo_names, &ecode);
- params.UCRandBGInfo = (enum psdf_ucr_and_bg_info)
- psdf_put_enum(plist, "UCRandBGInfo", (int)params.UCRandBGInfo,
- UCRandBGInfo_names, &ecode);
- ecode = param_put_bool(plist, "UseFlateCompression",
- &params.UseFlateCompression, ecode);
-
- /* Color sampled image parameters */
-
- ecode = psdf_put_image_params(pdev, plist,
- (pdev->ParamCompatibilityLevel >= 1.5 ? &Color_names15 : &Color_names),
- &params.ColorImage, ecode);
- params.ColorConversionStrategy = (enum psdf_color_conversion_strategy)
- psdf_put_enum(plist, "ColorConversionStrategy",
- (int)params.ColorConversionStrategy,
- ColorConversionStrategy_names, &ecode);
- ecode = psdf_read_string_param(plist, "CalCMYKProfile",
- &params.CalCMYKProfile, mem, ecode);
- ecode = psdf_read_string_param(plist, "CalGrayProfile",
- &params.CalGrayProfile, mem, ecode);
- ecode = psdf_read_string_param(plist, "CalRGBProfile",
- &params.CalRGBProfile, mem, ecode);
- ecode = psdf_read_string_param(plist, "sRGBProfile",
- &params.sRGBProfile, mem, ecode);
-
- /* Gray sampled image parameters */
-
- ecode = psdf_put_image_params(pdev, plist,
- (pdev->ParamCompatibilityLevel >= 1.5 ? &Gray_names15 : &Gray_names),
- &params.GrayImage, ecode);
-
- /* Mono sampled image parameters */
-
- ecode = psdf_put_image_params(pdev, plist, &Mono_names,
- &params.MonoImage, ecode);
-
- /* Font embedding parameters */
-
- ecode = psdf_put_embed_param(plist, "~AlwaysEmbed", ".AlwaysEmbed",
- &params.AlwaysEmbed, mem, ecode);
- ecode = psdf_put_embed_param(plist, "~NeverEmbed", ".NeverEmbed",
- &params.NeverEmbed, mem, ecode);
- params.CannotEmbedFontPolicy = (enum psdf_cannot_embed_font_policy)
- psdf_put_enum(plist, "CannotEmbedFontPolicy",
- (int)params.CannotEmbedFontPolicy,
- CannotEmbedFontPolicy_names, &ecode);
+
+ /* General parameters. */
+
+ code = gs_param_read_items(plist, &params, psdf_param_items);
+ if (code < 0)
+ ecode = code;
+ params.AutoRotatePages = (enum psdf_auto_rotate_pages)
+ psdf_put_enum(plist, "AutoRotatePages", (int)params.AutoRotatePages,
+ AutoRotatePages_names, &ecode);
+ params.Binding = (enum psdf_binding)
+ psdf_put_enum(plist, "Binding", (int)params.Binding,
+ Binding_names, &ecode);
+ params.DefaultRenderingIntent = (enum psdf_default_rendering_intent)
+ psdf_put_enum(plist, "DefaultRenderingIntent",
+ (int)params.DefaultRenderingIntent,
+ DefaultRenderingIntent_names, &ecode);
+ params.TransferFunctionInfo = (enum psdf_transfer_function_info)
+ psdf_put_enum(plist, "TransferFunctionInfo",
+ (int)params.TransferFunctionInfo,
+ TransferFunctionInfo_names, &ecode);
+ params.UCRandBGInfo = (enum psdf_ucr_and_bg_info)
+ psdf_put_enum(plist, "UCRandBGInfo", (int)params.UCRandBGInfo,
+ UCRandBGInfo_names, &ecode);
+ ecode = param_put_bool(plist, "UseFlateCompression",
+ &params.UseFlateCompression, ecode);
+
+ /* Color sampled image parameters */
+
+ ecode = psdf_put_image_params(pdev, plist,
+ (pdev->ParamCompatibilityLevel >= 1.5 ? &Color_names15 : &Color_names),
+ &params.ColorImage, ecode);
+ params.ColorConversionStrategy = (enum psdf_color_conversion_strategy)
+ psdf_put_enum(plist, "ColorConversionStrategy",
+ (int)params.ColorConversionStrategy,
+ ColorConversionStrategy_names, &ecode);
+ ecode = psdf_read_string_param(plist, "CalCMYKProfile",
+ &params.CalCMYKProfile, mem, ecode);
+ ecode = psdf_read_string_param(plist, "CalGrayProfile",
+ &params.CalGrayProfile, mem, ecode);
+ ecode = psdf_read_string_param(plist, "CalRGBProfile",
+ &params.CalRGBProfile, mem, ecode);
+ ecode = psdf_read_string_param(plist, "sRGBProfile",
+ &params.sRGBProfile, mem, ecode);
+
+ /* Gray sampled image parameters */
+
+ ecode = psdf_put_image_params(pdev, plist,
+ (pdev->ParamCompatibilityLevel >= 1.5 ? &Gray_names15 : &Gray_names),
+ &params.GrayImage, ecode);
+
+ /* Mono sampled image parameters */
+
+ ecode = psdf_put_image_params(pdev, plist, &Mono_names,
+ &params.MonoImage, ecode);
+
+ /* Font embedding parameters */
+
+ ecode = psdf_put_embed_param(plist, "~AlwaysEmbed", ".AlwaysEmbed",
+ &params.AlwaysEmbed, mem, ecode);
+ ecode = psdf_put_embed_param(plist, "~NeverEmbed", ".NeverEmbed",
+ &params.NeverEmbed, mem, ecode);
+ params.CannotEmbedFontPolicy = (enum psdf_cannot_embed_font_policy)
+ psdf_put_enum(plist, "CannotEmbedFontPolicy",
+ (int)params.CannotEmbedFontPolicy,
+ CannotEmbedFontPolicy_names, &ecode);
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gdev_vector_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
pdev->params = params; /* OK to update now */
return 0;
diff --git a/gs/base/gdevpsds.c b/gs/base/gdevpsds.c
index 43beb8a3d..4a13c2955 100644
--- a/gs/base/gdevpsds.c
+++ b/gs/base/gdevpsds.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -77,100 +77,100 @@ s_12_init(stream_state * st)
/* Process one buffer. */
#define BEGIN_1248\
- stream_1248_state * const ss = (stream_1248_state *)st;\
- const byte *p = pr->ptr;\
- const byte *rlimit = pr->limit;\
- byte *q = pw->ptr;\
- byte *wlimit = pw->limit;\
- uint left = ss->left;\
- int status;\
- int n
+ stream_1248_state * const ss = (stream_1248_state *)st;\
+ const byte *p = pr->ptr;\
+ const byte *rlimit = pr->limit;\
+ byte *q = pw->ptr;\
+ byte *wlimit = pw->limit;\
+ uint left = ss->left;\
+ int status;\
+ int n
#define END_1248\
- pr->ptr = p;\
- pw->ptr = q;\
- ss->left = left;\
- return status
+ pr->ptr = p;\
+ pw->ptr = q;\
+ ss->left = left;\
+ return status
/* N-to-8 expansion */
#define FOREACH_N_8(in, nout)\
- status = 0;\
- for ( ; p < rlimit; left -= n, q += n, ++p ) {\
- byte in = p[1];\
- n = min(left, nout);\
- if ( wlimit - q < n ) {\
- status = 1;\
- break;\
- }\
- switch ( n ) {\
- case 0: left = ss->samples_per_row; --p; continue;
+ status = 0;\
+ for ( ; p < rlimit; left -= n, q += n, ++p ) {\
+ byte in = p[1];\
+ n = min(left, nout);\
+ if ( wlimit - q < n ) {\
+ status = 1;\
+ break;\
+ }\
+ switch ( n ) {\
+ case 0: left = ss->samples_per_row; --p; continue;
#define END_FOREACH_N_8\
- }\
- }
+ }\
+ }
static int
s_N_8_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
BEGIN_1248;
switch (ss->bits_per_sample) {
- case 1:{
- FOREACH_N_8(in, 8)
- case 8:
- q[8] = (byte) - (in & 1);
- case 7:
- q[7] = (byte) - ((in >> 1) & 1);
- case 6:
- q[6] = (byte) - ((in >> 2) & 1);
- case 5:
- q[5] = (byte) - ((in >> 3) & 1);
- case 4:
- q[4] = (byte) - ((in >> 4) & 1);
- case 3:
- q[3] = (byte) - ((in >> 5) & 1);
- case 2:
- q[2] = (byte) - ((in >> 6) & 1);
- case 1:
- q[1] = (byte) - (in >> 7);
- END_FOREACH_N_8;
- }
- break;
-
- case 2:{
- static const byte b2[4] =
- {0x00, 0x55, 0xaa, 0xff};
-
- FOREACH_N_8(in, 4)
- case 4:
- q[4] = b2[in & 3];
- case 3:
- q[3] = b2[(in >> 2) & 3];
- case 2:
- q[2] = b2[(in >> 4) & 3];
- case 1:
- q[1] = b2[in >> 6];
- END_FOREACH_N_8;
- }
- break;
-
- case 4:{
- static const byte b4[16] =
- {
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
- 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
- };
-
- FOREACH_N_8(in, 2)
- case 2:
- q[2] = b4[in & 0xf];
- case 1:
- q[1] = b4[in >> 4];
- END_FOREACH_N_8;
- }
- break;
-
- default:
- return ERRC;
+ case 1:{
+ FOREACH_N_8(in, 8)
+ case 8:
+ q[8] = (byte) - (in & 1);
+ case 7:
+ q[7] = (byte) - ((in >> 1) & 1);
+ case 6:
+ q[6] = (byte) - ((in >> 2) & 1);
+ case 5:
+ q[5] = (byte) - ((in >> 3) & 1);
+ case 4:
+ q[4] = (byte) - ((in >> 4) & 1);
+ case 3:
+ q[3] = (byte) - ((in >> 5) & 1);
+ case 2:
+ q[2] = (byte) - ((in >> 6) & 1);
+ case 1:
+ q[1] = (byte) - (in >> 7);
+ END_FOREACH_N_8;
+ }
+ break;
+
+ case 2:{
+ static const byte b2[4] =
+ {0x00, 0x55, 0xaa, 0xff};
+
+ FOREACH_N_8(in, 4)
+ case 4:
+ q[4] = b2[in & 3];
+ case 3:
+ q[3] = b2[(in >> 2) & 3];
+ case 2:
+ q[2] = b2[(in >> 4) & 3];
+ case 1:
+ q[1] = b2[in >> 6];
+ END_FOREACH_N_8;
+ }
+ break;
+
+ case 4:{
+ static const byte b4[16] =
+ {
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
+ };
+
+ FOREACH_N_8(in, 2)
+ case 2:
+ q[2] = b4[in & 0xf];
+ case 1:
+ q[1] = b4[in >> 4];
+ END_FOREACH_N_8;
+ }
+ break;
+
+ default:
+ return ERRC;
}
END_1248;
@@ -179,106 +179,105 @@ s_N_8_process(stream_state * st, stream_cursor_read * pr,
/* 12-to-8 "expansion" */
static int
s_12_8_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
BEGIN_1248;
n = ss->samples_per_row; /* misuse n to avoid a compiler warning */
status = 0;
for (; rlimit - p >= 2; ++q) {
- if (q >= wlimit) {
- status = 1;
- break;
- }
- if (left == 0)
- left = n;
- if ((n - left) & 1) {
- q[1] = (byte)((p[1] << 4) | (p[2] >> 4));
- p += 2, --left;
- } else {
- q[1] = *++p;
- if (!--left)
- ++p;
- }
+ if (q >= wlimit) {
+ status = 1;
+ break;
+ }
+ if (left == 0)
+ left = n;
+ if ((n - left) & 1) {
+ q[1] = (byte)((p[1] << 4) | (p[2] >> 4));
+ p += 2, --left;
+ } else {
+ q[1] = *++p;
+ if (!--left)
+ ++p;
+ }
}
END_1248;
}
-
/* 8-to-N reduction */
#define FOREACH_8_N(out, nin)\
- byte out;\
- status = 1;\
- for ( ; q < wlimit; left -= n, p += n, ++q ) {\
- n = min(left, nin);\
- if ( rlimit - p < n ) {\
- status = 0;\
- break;\
- }\
- out = 0;\
- switch ( n ) {\
- case 0: left = ss->samples_per_row; --q; continue;
+ byte out;\
+ status = 1;\
+ for ( ; q < wlimit; left -= n, p += n, ++q ) {\
+ n = min(left, nin);\
+ if ( rlimit - p < n ) {\
+ status = 0;\
+ break;\
+ }\
+ out = 0;\
+ switch ( n ) {\
+ case 0: left = ss->samples_per_row; --q; continue;
#define END_FOREACH_8_N\
- q[1] = out;\
- }\
- }
+ q[1] = out;\
+ }\
+ }
static int
s_8_N_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
BEGIN_1248;
switch (ss->bits_per_sample) {
- case 1:{
- FOREACH_8_N(out, 8)
- case 8:
- out = p[8] >> 7;
- case 7:
- out |= (p[7] >> 7) << 1;
- case 6:
- out |= (p[6] >> 7) << 2;
- case 5:
- out |= (p[5] >> 7) << 3;
- case 4:
- out |= (p[4] >> 7) << 4;
- case 3:
- out |= (p[3] >> 7) << 5;
- case 2:
- out |= (p[2] >> 7) << 6;
- case 1:
- out |= p[1] & 0x80;
- END_FOREACH_8_N;
- }
- break;
-
- case 2:{
- FOREACH_8_N(out, 4)
- case 4:
- out |= p[4] >> 6;
- case 3:
- out |= (p[3] >> 6) << 2;
- case 2:
- out |= (p[2] >> 6) << 4;
- case 1:
- out |= p[1] & 0xc0;
- END_FOREACH_8_N;
- }
- break;
-
- case 4:{
- FOREACH_8_N(out, 2)
- case 2:
- out |= p[2] >> 4;
- case 1:
- out |= p[1] & 0xf0;
- END_FOREACH_8_N;
- }
- break;
-
- default:
- return ERRC;
+ case 1:{
+ FOREACH_8_N(out, 8)
+ case 8:
+ out = p[8] >> 7;
+ case 7:
+ out |= (p[7] >> 7) << 1;
+ case 6:
+ out |= (p[6] >> 7) << 2;
+ case 5:
+ out |= (p[5] >> 7) << 3;
+ case 4:
+ out |= (p[4] >> 7) << 4;
+ case 3:
+ out |= (p[3] >> 7) << 5;
+ case 2:
+ out |= (p[2] >> 7) << 6;
+ case 1:
+ out |= p[1] & 0x80;
+ END_FOREACH_8_N;
+ }
+ break;
+
+ case 2:{
+ FOREACH_8_N(out, 4)
+ case 4:
+ out |= p[4] >> 6;
+ case 3:
+ out |= (p[3] >> 6) << 2;
+ case 2:
+ out |= (p[2] >> 6) << 4;
+ case 1:
+ out |= p[1] & 0xc0;
+ END_FOREACH_8_N;
+ }
+ break;
+
+ case 4:{
+ FOREACH_8_N(out, 2)
+ case 2:
+ out |= p[2] >> 4;
+ case 1:
+ out |= p[1] & 0xf0;
+ END_FOREACH_8_N;
+ }
+ break;
+
+ default:
+ return ERRC;
}
END_1248;
@@ -333,7 +332,7 @@ s_C2R_set_defaults(stream_state * st)
/* Process one buffer. */
static int
s_C2R_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_C2R_state *const ss = (stream_C2R_state *) st;
const byte *p = pr->ptr;
@@ -342,14 +341,14 @@ s_C2R_process(stream_state * st, stream_cursor_read * pr,
byte *wlimit = pw->limit;
for (; rlimit - p >= 4 && wlimit - q >= 3; p += 4, q += 3) {
- byte bc = p[1], bm = p[2], by = p[3], bk = p[4];
- frac rgb[3];
-
- color_cmyk_to_rgb(byte2frac(bc), byte2frac(bm), byte2frac(by),
- byte2frac(bk), ss->pis, rgb, ss->pis->memory);
- q[1] = frac2byte(rgb[0]);
- q[2] = frac2byte(rgb[1]);
- q[3] = frac2byte(rgb[2]);
+ byte bc = p[1], bm = p[2], by = p[3], bk = p[4];
+ frac rgb[3];
+
+ color_cmyk_to_rgb(byte2frac(bc), byte2frac(bm), byte2frac(by),
+ byte2frac(bk), ss->pis, rgb, ss->pis->memory);
+ q[1] = frac2byte(rgb[0]);
+ q[2] = frac2byte(rgb[1]);
+ q[3] = frac2byte(rgb[2]);
}
pr->ptr = p;
pw->ptr = q;
@@ -395,12 +394,12 @@ s_IE_init(stream_state * st)
int i;
if (ss->Table.data == 0 || ss->Table.size < key_index)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
/* Initialize Table with default values. */
memset(ss->Table.data, 0, ss->NumComponents);
ss->Table.data[ss->Table.size - 1] = 0;
for (i = 0; i < countof(ss->hash_table); ++i)
- ss->hash_table[i] = key_index;
+ ss->hash_table[i] = key_index;
ss->next_index = 0;
ss->in_bits_left = 0;
ss->next_component = 0;
@@ -412,7 +411,7 @@ s_IE_init(stream_state * st)
/* Process a buffer. */
static int
s_IE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_IE_state *const ss = (stream_IE_state *) st;
/* Constant values from the state */
@@ -434,70 +433,70 @@ s_IE_process(stream_state * st, stream_cursor_read * pr,
int status = 0;
for (;;) {
- uint hash, reprobe;
- int i, index;
-
- /* Check for a filled output byte. */
- if (byte_out >= 0x100) {
- if (q >= wlimit) {
- status = 1;
- break;
- }
- *++q = (byte)byte_out;
- byte_out = 1;
- }
- /* Acquire a complete input value. */
- while (next_component < num_components) {
- const float *decode = &ss->Decode[next_component * 2];
- int sample;
-
- if (in_bits_left == 0) {
- if (p >= rlimit)
- goto out;
- byte_in = *++p;
- in_bits_left = 8;
- }
- /* An input sample can never span a byte boundary. */
- in_bits_left -= bpc;
- sample = (byte_in >> in_bits_left) & ((1 << bpc) - 1);
- /* Scale the sample according to Decode. */
- sample = (int)((decode[0] +
- (sample / (float)((1 << bpc) - 1) *
- (decode[1] - decode[0]))) * 255 + 0.5);
- key[next_component++] =
- (sample < 0 ? 0 : sample > 255 ? 255 : (byte)sample);
- }
- /* Look up the input value. */
- for (hash = 0, i = 0; i < num_components; ++i)
- hash = hash + 23 * key[i]; /* adhoc */
- reprobe = (hash / countof(ss->hash_table)) | 137; /* adhoc */
- for (hash %= countof(ss->hash_table);
- memcmp(table + ss->hash_table[hash], key, num_components);
- hash = (hash + reprobe) % countof(ss->hash_table)
- )
- DO_NOTHING;
- index = ss->hash_table[hash];
- if (index == end_index) {
- /* The match was on an empty entry. */
- if (ss->next_index == end_index) {
- /* Too many different values. */
- status = ERRC;
- break;
- }
- ss->hash_table[hash] = index = ss->next_index;
- ss->next_index += num_components;
- memcpy(table + index, key, num_components);
- }
- byte_out = (byte_out << ss->BitsPerIndex) + index / num_components;
- next_component = 0;
- if (++(ss->x) == ss->Width) {
- /* Handle input and output padding. */
- in_bits_left = 0;
- if (byte_out != 1)
- while (byte_out < 0x100)
- byte_out <<= 1;
- ss->x = 0;
- }
+ uint hash, reprobe;
+ int i, index;
+
+ /* Check for a filled output byte. */
+ if (byte_out >= 0x100) {
+ if (q >= wlimit) {
+ status = 1;
+ break;
+ }
+ *++q = (byte)byte_out;
+ byte_out = 1;
+ }
+ /* Acquire a complete input value. */
+ while (next_component < num_components) {
+ const float *decode = &ss->Decode[next_component * 2];
+ int sample;
+
+ if (in_bits_left == 0) {
+ if (p >= rlimit)
+ goto out;
+ byte_in = *++p;
+ in_bits_left = 8;
+ }
+ /* An input sample can never span a byte boundary. */
+ in_bits_left -= bpc;
+ sample = (byte_in >> in_bits_left) & ((1 << bpc) - 1);
+ /* Scale the sample according to Decode. */
+ sample = (int)((decode[0] +
+ (sample / (float)((1 << bpc) - 1) *
+ (decode[1] - decode[0]))) * 255 + 0.5);
+ key[next_component++] =
+ (sample < 0 ? 0 : sample > 255 ? 255 : (byte)sample);
+ }
+ /* Look up the input value. */
+ for (hash = 0, i = 0; i < num_components; ++i)
+ hash = hash + 23 * key[i]; /* adhoc */
+ reprobe = (hash / countof(ss->hash_table)) | 137; /* adhoc */
+ for (hash %= countof(ss->hash_table);
+ memcmp(table + ss->hash_table[hash], key, num_components);
+ hash = (hash + reprobe) % countof(ss->hash_table)
+ )
+ DO_NOTHING;
+ index = ss->hash_table[hash];
+ if (index == end_index) {
+ /* The match was on an empty entry. */
+ if (ss->next_index == end_index) {
+ /* Too many different values. */
+ status = ERRC;
+ break;
+ }
+ ss->hash_table[hash] = index = ss->next_index;
+ ss->next_index += num_components;
+ memcpy(table + index, key, num_components);
+ }
+ byte_out = (byte_out << ss->BitsPerIndex) + index / num_components;
+ next_component = 0;
+ if (++(ss->x) == ss->Width) {
+ /* Handle input and output padding. */
+ in_bits_left = 0;
+ if (byte_out != 1)
+ while (byte_out < 0x100)
+ byte_out <<= 1;
+ ss->x = 0;
+ }
}
out:
pr->ptr = p;
@@ -508,8 +507,8 @@ out:
ss->byte_out = byte_out;
/* For simplicity, always update the record of the table size. */
ss->Table.data[ss->Table.size - 1] =
- (ss->next_index == 0 ? 0 :
- ss->next_index / ss->NumComponents - 1);
+ (ss->next_index == 0 ? 0 :
+ ss->next_index / ss->NumComponents - 1);
return status;
}
@@ -529,14 +528,14 @@ test_IE(void)
stream_state *const ss = (stream_state *)&state;
static const float decode[6] = {1, 0, 1, 0, 1, 0};
static const byte in[] = {
- /*
- * Each row is 3 pixels x 3 components x 4 bits. Processing the
- * first two rows doesn't cause an error; processing all 3 rows
- * does.
- */
- 0x12, 0x35, 0x67, 0x9a, 0xb0,
- 0x56, 0x7d, 0xef, 0x12, 0x30,
- 0x88, 0x88, 0x88, 0x88, 0x80
+ /*
+ * Each row is 3 pixels x 3 components x 4 bits. Processing the
+ * first two rows doesn't cause an error; processing all 3 rows
+ * does.
+ */
+ 0x12, 0x35, 0x67, 0x9a, 0xb0,
+ 0x56, 0x7d, 0xef, 0x12, 0x30,
+ 0x88, 0x88, 0x88, 0x88, 0x80
};
byte table[3 * 5];
int n;
@@ -549,24 +548,24 @@ test_IE(void)
state.Decode = decode;
gs_bytestring_from_bytes(&state.Table, table, 0, sizeof(table));
for (n = 10; n <= 15; n += 5) {
- stream_cursor_read r;
- stream_cursor_write w;
- byte out[100];
- int status;
-
- s_IE_init(ss);
- r.ptr = in; --r.ptr;
- r.limit = r.ptr + n;
- w.ptr = out; --w.ptr;
- w.limit = w.ptr + sizeof(out);
- memset(table, 0xcc, sizeof(table));
- memset(out, 0xff, sizeof(out));
- dprintf1("processing %d bytes\n", n);
- status = template->process(ss, &r, &w, true);
- dprintf3("%d bytes read, %d bytes written, status = %d\n",
- (int)(r.ptr + 1 - in), (int)(w.ptr + 1 - out), status);
- debug_dump_bytes(table, table + sizeof(table), "table");
- debug_dump_bytes(out, w.ptr + 1, "out");
+ stream_cursor_read r;
+ stream_cursor_write w;
+ byte out[100];
+ int status;
+
+ s_IE_init(ss);
+ r.ptr = in; --r.ptr;
+ r.limit = r.ptr + n;
+ w.ptr = out; --w.ptr;
+ w.limit = w.ptr + sizeof(out);
+ memset(table, 0xcc, sizeof(table));
+ memset(out, 0xff, sizeof(out));
+ dprintf1("processing %d bytes\n", n);
+ status = template->process(ss, &r, &w, true);
+ dprintf3("%d bytes read, %d bytes written, status = %d\n",
+ (int)(r.ptr + 1 - in), (int)(w.ptr + 1 - out), status);
+ debug_dump_bytes(table, table + sizeof(table), "table");
+ debug_dump_bytes(out, w.ptr + 1, "out");
}
}
@@ -592,7 +591,7 @@ s_Downsample_set_defaults(register stream_state * st)
/* ------ Subsample ------ */
gs_private_st_simple(st_Subsample_state, stream_Subsample_state,
- "stream_Subsample_state");
+ "stream_Subsample_state");
/* Initialize the state. */
static int
@@ -607,7 +606,7 @@ s_Subsample_init(stream_state * st)
/* Process one buffer. */
static int
s_Subsample_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_Subsample_state *const ss = (stream_Subsample_state *) st;
const byte *p = pr->ptr;
@@ -620,31 +619,31 @@ s_Subsample_process(stream_state * st, stream_cursor_read * pr,
int xf2 = xf / 2, yf2 = yf / 2;
int xlimit = (width / xf) * xf, ylimit = (height / yf) * yf;
int xlast =
- (ss->padX && xlimit < width ? xlimit + (width % xf) / 2 : -1);
+ (ss->padX && xlimit < width ? xlimit + (width % xf) / 2 : -1);
int ylast =
- (ss->padY && ylimit < height ? ylimit + (height % yf) / 2 : -1);
+ (ss->padY && ylimit < height ? ylimit + (height % yf) / 2 : -1);
int x = ss->x, y = ss->y;
int status = 0;
if_debug4('w', "[w]subsample: x=%d, y=%d, rcount=%ld, wcount=%ld\n",
- x, y, (long)(rlimit - p), (long)(wlimit - q));
+ x, y, (long)(rlimit - p), (long)(wlimit - q));
for (; rlimit - p >= spp; p += spp) {
- if (((y % yf == yf2 && y < ylimit) || y == ylast) &&
- ((x % xf == xf2 && x < xlimit) || x == xlast)
- ) {
- if (wlimit - q < spp) {
- status = 1;
- break;
- }
- memcpy(q + 1, p + 1, spp);
- q += spp;
- }
- if (++x == width)
- x = 0, ++y;
+ if (((y % yf == yf2 && y < ylimit) || y == ylast) &&
+ ((x % xf == xf2 && x < xlimit) || x == xlast)
+ ) {
+ if (wlimit - q < spp) {
+ status = 1;
+ break;
+ }
+ memcpy(q + 1, p + 1, spp);
+ q += spp;
+ }
+ if (++x == width)
+ x = 0, ++y;
}
if_debug5('w',
- "[w]subsample: x'=%d, y'=%d, read %ld, wrote %ld, status = %d\n",
- x, y, (long)(p - pr->ptr), (long)(q - pw->ptr), status);
+ "[w]subsample: x'=%d, y'=%d, read %ld, wrote %ld, status = %d\n",
+ x, y, (long)(p - pr->ptr), (long)(q - pw->ptr), status);
pr->ptr = p;
pw->ptr = q;
ss->x = x, ss->y = y;
@@ -678,14 +677,14 @@ s_Average_init(stream_state * st)
stream_Average_state *const ss = (stream_Average_state *) st;
ss->sum_size =
- ss->Colors * ((ss->WidthIn + ss->XFactor - 1) / ss->XFactor);
+ ss->Colors * ((ss->WidthIn + ss->XFactor - 1) / ss->XFactor);
ss->copy_size = ss->sum_size -
- (ss->padX || (ss->WidthIn % ss->XFactor == 0) ? 0 : ss->Colors);
+ (ss->padX || (ss->WidthIn % ss->XFactor == 0) ? 0 : ss->Colors);
ss->sums =
- (uint *)gs_alloc_byte_array(st->memory, ss->sum_size,
- sizeof(uint), "Average sums");
+ (uint *)gs_alloc_byte_array(st->memory, ss->sum_size,
+ sizeof(uint), "Average sums");
if (ss->sums == 0)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
memset(ss->sums, 0, ss->sum_size * sizeof(uint));
return s_Subsample_init(st);
}
@@ -702,7 +701,7 @@ s_Average_release(stream_state * st)
/* Process one buffer. */
static int
s_Average_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_Average_state *const ss = (stream_Average_state *) st;
const byte *p = pr->ptr;
@@ -718,34 +717,34 @@ s_Average_process(stream_state * st, stream_cursor_read * pr,
top:
if (y == yf || (last && p >= rlimit && ss->padY && y != 0)) {
- /* We're copying averaged values to the output. */
- int ncopy = min(ss->copy_size - x, wlimit - q);
-
- if (ncopy) {
- int scale = xf * y;
-
- while (--ncopy >= 0)
- *++q = (byte) (sums[x++] / scale);
- }
- if (x < ss->copy_size) {
- status = 1;
- goto out;
- }
- /* Done copying. */
- x = y = 0;
- memset(sums, 0, ss->sum_size * sizeof(uint));
+ /* We're copying averaged values to the output. */
+ int ncopy = min(ss->copy_size - x, wlimit - q);
+
+ if (ncopy) {
+ int scale = xf * y;
+
+ while (--ncopy >= 0)
+ *++q = (byte) (sums[x++] / scale);
+ }
+ if (x < ss->copy_size) {
+ status = 1;
+ goto out;
+ }
+ /* Done copying. */
+ x = y = 0;
+ memset(sums, 0, ss->sum_size * sizeof(uint));
}
while (rlimit - p >= spp) {
- uint *bp = sums + x / xf * spp;
- int i;
-
- for (i = spp; --i >= 0;)
- *bp++ += *++p;
- if (++x == width) {
- x = 0;
- ++y;
- goto top;
- }
+ uint *bp = sums + x / xf * spp;
+ int i;
+
+ for (i = spp; --i >= 0;)
+ *bp++ += *++p;
+ if (++x == width) {
+ x = 0;
+ ++y;
+ goto top;
+ }
}
out:
pr->ptr = p;
@@ -782,8 +781,8 @@ s_compr_chooser_init(stream_state * st)
/* Set image dimensions. */
int
-s_compr_chooser_set_dimensions(stream_compr_chooser_state * ss, int width,
- int height, int depth, int bits_per_sample)
+s_compr_chooser_set_dimensions(stream_compr_chooser_state * ss, int width,
+ int height, int depth, int bits_per_sample)
{
ss->width = width;
ss->height = height;
@@ -791,7 +790,7 @@ s_compr_chooser_set_dimensions(stream_compr_chooser_state * ss, int width,
ss->bits_per_sample = bits_per_sample;
ss->sample = gs_alloc_bytes(ss->memory, width * depth, "s_compr_chooser_set_dimensions");
if (ss->sample == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
return 0;
}
@@ -807,16 +806,16 @@ s_compr_chooser_release(stream_state * st)
/* Estimate a row for photo/lineart recognition. */
static void
s_compr_chooser__estimate_row(stream_compr_chooser_state *const ss, byte *p)
-{
+{
/* This function uses a statistical algorithm being not well defined.
- We compute areas covered by gradients,
- separately with small width (line art)
- and with big width (photo).
- Making the choice based on the areas.
+ We compute areas covered by gradients,
+ separately with small width (line art)
+ and with big width (photo).
+ Making the choice based on the areas.
- Note that we deal with horizontal frequencies only.
- Dealing with vertical ones would be too expensive.
+ Note that we deal with horizontal frequencies only.
+ Dealing with vertical ones would be too expensive.
*/
const int delta = 256 / 16; /* about 1/16 of the color range */
const int max_lineart_boundary_width = 3; /* pixels */
@@ -828,76 +827,76 @@ s_compr_chooser__estimate_row(stream_compr_chooser_state *const ss, byte *p)
bool lower = false, upper = false;
for (i = 1; i < ss->width; i++) {
- v = p[i];
- if (!lower) {
- if (w1 < v) {
- if (!upper)
- j1 = i - 1;
- w1 = v;
- upper = true;
- } else if (w1 == v && j1 < i - max_gradient_constant)
- j1 = i - max_gradient_constant; /* inner constant plateaw */
- else if (upper && w1 - delta > v) {
- /* end of upper plateau at w1-delta...w1 */
- for (j0 = i - 1; j0 > j1 && w1 - delta <= p[j0]; j0--) DO_NOTHING;
- /* upper plateau j0+1...i-1 */
- if(j0 > 0 && i < ss->width - 1) /* ignore sides */
- upper_plateaus += i - j0;
- plateau_count ++;
- if (j0 > j1) {
- /* upgrade j1...j0 */
- if (j0 > j1 + max_lineart_boundary_width)
- gradients += j0 - j1;
- }
- j1 = i;
- upper = false;
- w0 = w1;
- continue;
- }
- }
- if (!upper) {
- if (w0 > v) {
- if (!lower)
- j1 = i - 1;
- w0 = v;
- lower = true;
- } else if (w0 == v && j1 < i - max_gradient_constant)
- j1 = i - max_gradient_constant; /* inner constant plateaw */
- else if (lower && w0 + delta < v) {
- /* end of lower plateau at w0...w0+delta */
- for (j0 = i - 1; j0 > j1 && w0 + delta >= p[j0]; j0--) DO_NOTHING;
- /* lower plateau j0+1...i-1 */
- if(j0 > 0 && i < ss->width - 1) /* ignore sides */
- lower_plateaus += i - j0;
- plateau_count ++;
- if (j0 > j1) {
- /* downgrade j1...j0 */
- if (j0 > j1 + max_lineart_boundary_width)
- gradients += j0 - j1;
- }
- j1 = i;
- lower = false;
- w1 = w0;
- }
- }
+ v = p[i];
+ if (!lower) {
+ if (w1 < v) {
+ if (!upper)
+ j1 = i - 1;
+ w1 = v;
+ upper = true;
+ } else if (w1 == v && j1 < i - max_gradient_constant)
+ j1 = i - max_gradient_constant; /* inner constant plateaw */
+ else if (upper && w1 - delta > v) {
+ /* end of upper plateau at w1-delta...w1 */
+ for (j0 = i - 1; j0 > j1 && w1 - delta <= p[j0]; j0--) DO_NOTHING;
+ /* upper plateau j0+1...i-1 */
+ if(j0 > 0 && i < ss->width - 1) /* ignore sides */
+ upper_plateaus += i - j0;
+ plateau_count ++;
+ if (j0 > j1) {
+ /* upgrade j1...j0 */
+ if (j0 > j1 + max_lineart_boundary_width)
+ gradients += j0 - j1;
+ }
+ j1 = i;
+ upper = false;
+ w0 = w1;
+ continue;
+ }
+ }
+ if (!upper) {
+ if (w0 > v) {
+ if (!lower)
+ j1 = i - 1;
+ w0 = v;
+ lower = true;
+ } else if (w0 == v && j1 < i - max_gradient_constant)
+ j1 = i - max_gradient_constant; /* inner constant plateaw */
+ else if (lower && w0 + delta < v) {
+ /* end of lower plateau at w0...w0+delta */
+ for (j0 = i - 1; j0 > j1 && w0 + delta >= p[j0]; j0--) DO_NOTHING;
+ /* lower plateau j0+1...i-1 */
+ if(j0 > 0 && i < ss->width - 1) /* ignore sides */
+ lower_plateaus += i - j0;
+ plateau_count ++;
+ if (j0 > j1) {
+ /* downgrade j1...j0 */
+ if (j0 > j1 + max_lineart_boundary_width)
+ gradients += j0 - j1;
+ }
+ j1 = i;
+ lower = false;
+ w1 = w0;
+ }
+ }
}
if (plateau_count > ss->width / 6) {
- /* Possibly a dithering, can't recognize.
- It would be better to estimate frequency histogram rather than
- rough quantity, but we hope that the simpler test can work fine.
- */
+ /* Possibly a dithering, can't recognize.
+ It would be better to estimate frequency histogram rather than
+ rough quantity, but we hope that the simpler test can work fine.
+ */
} else if (!plateau_count) /* a pseudo-constant color through entire row */
- DO_NOTHING; /* ignore such lines */
+ DO_NOTHING; /* ignore such lines */
else {
- int plateaus;
- ss->lower_plateaus += lower_plateaus;
- ss->upper_plateaus += upper_plateaus;
- ss->gradients += gradients;
- plateaus = min(ss->lower_plateaus, ss->upper_plateaus); /* (fore/back)ground */
- if (ss->gradients >= 10000 && ss->gradients > plateaus / 6)
- ss->choice = 1; /* choice is made : photo */
- else if (plateaus >= 100000 && plateaus / 5000 >= ss->gradients)
- ss->choice = 2; /* choice is made : lineart */
+ int plateaus;
+ ss->lower_plateaus += lower_plateaus;
+ ss->upper_plateaus += upper_plateaus;
+ ss->gradients += gradients;
+ plateaus = min(ss->lower_plateaus, ss->upper_plateaus); /* (fore/back)ground */
+ if (ss->gradients >= 10000 && ss->gradients > plateaus / 6)
+ ss->choice = 1; /* choice is made : photo */
+ else if (plateaus >= 100000 && plateaus / 5000 >= ss->gradients)
+ ss->choice = 2; /* choice is made : lineart */
}
}
@@ -909,15 +908,15 @@ s_compr_chooser__recognize(stream_compr_chooser_state * ss)
byte *p = ss->sample;
for (i = 0; i < ss->depth; i++, p += ss->width)
- s_compr_chooser__estimate_row(ss, p);
+ s_compr_chooser__estimate_row(ss, p);
/* todo: make decision */
}
/* Uppack data and recognize photo/lineart. */
static void
-s_compr_chooser__unpack_and_recognize(stream_compr_chooser_state *const ss,
- const byte *data, int length)
-{
+s_compr_chooser__unpack_and_recognize(stream_compr_chooser_state *const ss,
+ const byte *data, int length)
+{
/*
* Input samples are packed ABCABCABC..., but the sample[] array of
* unpacked values is stored AAA...BBB...CCC. i counts samples within
@@ -929,49 +928,49 @@ s_compr_chooser__unpack_and_recognize(stream_compr_chooser_state *const ss,
int l = length;
while (l) {
- if (ss->bits_left < 8) {
- uint k = (sizeof(ss->packed_data) * 8 - ss->bits_left) / 8;
-
- k = min(k, l);
- for (; k; k--, l--, p++, ss->bits_left += 8)
- ss->packed_data = (ss->packed_data << 8) + *p;
- }
- while (ss->bits_left >= ss->bits_per_sample) {
- uint k = ss->bits_left - ss->bits_per_sample;
- ulong v = ss->packed_data >> k;
-
- ss->packed_data -= (v << k);
- ss->bits_left -= ss->bits_per_sample;
- if (ss->bits_per_sample > 8)
- v >>= ss->bits_per_sample - 8;
- else
- v <<= 8 - ss->bits_per_sample;
- ss->sample[i + j] = (byte)v; /* scaled to 0...255 */
- i += ss->width;
- if (i >= ss->width * ss->depth)
- i = 0, j++;
- ss->samples_count++;
- if (ss->samples_count >= ss->width * ss->depth) {
- s_compr_chooser__recognize(ss);
- ss->packed_data = 0;
- ss->bits_left = 0;
- ss->samples_count = 0;
- i = j = 0;
- }
- }
+ if (ss->bits_left < 8) {
+ uint k = (sizeof(ss->packed_data) * 8 - ss->bits_left) / 8;
+
+ k = min(k, l);
+ for (; k; k--, l--, p++, ss->bits_left += 8)
+ ss->packed_data = (ss->packed_data << 8) + *p;
+ }
+ while (ss->bits_left >= ss->bits_per_sample) {
+ uint k = ss->bits_left - ss->bits_per_sample;
+ ulong v = ss->packed_data >> k;
+
+ ss->packed_data -= (v << k);
+ ss->bits_left -= ss->bits_per_sample;
+ if (ss->bits_per_sample > 8)
+ v >>= ss->bits_per_sample - 8;
+ else
+ v <<= 8 - ss->bits_per_sample;
+ ss->sample[i + j] = (byte)v; /* scaled to 0...255 */
+ i += ss->width;
+ if (i >= ss->width * ss->depth)
+ i = 0, j++;
+ ss->samples_count++;
+ if (ss->samples_count >= ss->width * ss->depth) {
+ s_compr_chooser__recognize(ss);
+ ss->packed_data = 0;
+ ss->bits_left = 0;
+ ss->samples_count = 0;
+ i = j = 0;
+ }
+ }
}
}
/* Process a buffer. */
static int
s_compr_chooser_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_compr_chooser_state *const ss = (stream_compr_chooser_state *) st;
int l = pr->limit - pr->ptr;
if (ss->width >= 3) /* Can't process narrow images. */
- s_compr_chooser__unpack_and_recognize(ss, pr->ptr + 1, l);
+ s_compr_chooser__unpack_and_recognize(ss, pr->ptr + 1, l);
pr->ptr += l;
return 0;
}
@@ -982,18 +981,18 @@ const stream_template s_compr_chooser_template = {
};
/* Get choice */
-uint
+uint
s_compr_chooser__get_choice(stream_compr_chooser_state *ss, bool force)
{
ulong plateaus = min(ss->lower_plateaus, ss->upper_plateaus);
if (ss->choice)
- return ss->choice;
+ return ss->choice;
if (force) {
- if (ss->gradients > plateaus / 12) /* messenger16.pdf, page 3. */
- return 1; /* photo */
- else if (plateaus / 5000 >= ss->gradients)
- return 2; /* lineart */
+ if (ss->gradients > plateaus / 12) /* messenger16.pdf, page 3. */
+ return 1; /* photo */
+ else if (plateaus / 5000 >= ss->gradients)
+ return 2; /* lineart */
}
return 0;
}
@@ -1030,15 +1029,15 @@ s_image_colors_init(stream_state * st)
return 0;
}
-static int
+static int
s_image_colors_convert_color_to_mask(stream_image_colors_state *ss)
{
int i, ii;
for (i = ii = 0; i < ss->depth; i++, ii += 2)
- if (ss->input_color[i] < ss->MaskColor[ii] ||
- ss->input_color[i] > ss->MaskColor[ii + 1])
- break;
+ if (ss->input_color[i] < ss->MaskColor[ii] ||
+ ss->input_color[i] > ss->MaskColor[ii + 1])
+ break;
ss->output_color[0] = (i < ss->depth ? 1 : 0);
return 0;
}
@@ -1053,18 +1052,18 @@ s_image_colors_convert_to_device_color(stream_image_colors_state * ss)
double v1 = (1 << ss->output_bits_per_sample) - 1;
for (i = 0; i < ss->depth; i++)
- cc.paint.values[i] = ss->input_color[i] *
- (ss->Decode[i * 2 + 1] - ss->Decode[i * 2]) / v0 + ss->Decode[i * 2];
+ cc.paint.values[i] = ss->input_color[i] *
+ (ss->Decode[i * 2 + 1] - ss->Decode[i * 2]) / v0 + ss->Decode[i * 2];
code = ss->pcs->type->remap_color(&cc, ss->pcs, &dc, ss->pis,
- ss->pdev, gs_color_select_texture);
+ ss->pdev, gs_color_select_texture);
if (code < 0)
- return code;
+ return code;
for (i = 0; i < ss->output_depth; i++) {
- uint m = (1 << ss->pdev->color_info.comp_bits[i]) - 1;
- uint w = (dc.colors.pure >> ss->pdev->color_info.comp_shift[i]) & m;
+ uint m = (1 << ss->pdev->color_info.comp_bits[i]) - 1;
+ uint w = (dc.colors.pure >> ss->pdev->color_info.comp_shift[i]) & m;
- ss->output_color[i] = (uint)(v1 * w / m + 0.5);
+ ss->output_color[i] = (uint)(v1 * w / m + 0.5);
}
return 0;
}
@@ -1079,8 +1078,8 @@ s_image_colors_set_mask_colors(stream_image_colors_state * ss, uint *MaskColor)
/* Set image dimensions. */
void
-s_image_colors_set_dimensions(stream_image_colors_state * ss,
- int width, int height, int depth, int bits_per_sample)
+s_image_colors_set_dimensions(stream_image_colors_state * ss,
+ int width, int height, int depth, int bits_per_sample)
{
ss->width = width;
ss->height = height;
@@ -1093,8 +1092,8 @@ s_image_colors_set_dimensions(stream_image_colors_state * ss,
void
s_image_colors_set_color_space(stream_image_colors_state * ss, gx_device *pdev,
- const gs_color_space *pcs, const gs_imager_state *pis,
- float *Decode)
+ const gs_color_space *pcs, const gs_imager_state *pis,
+ float *Decode)
{
ss->output_depth = pdev->color_info.num_components;
ss->output_component_index = ss->output_depth;
@@ -1106,92 +1105,91 @@ s_image_colors_set_color_space(stream_image_colors_state * ss, gx_device *pdev,
memcpy(ss->Decode, Decode, ss->depth * sizeof(Decode[0]) * 2);
}
-
/* Process a buffer. */
static int
s_image_colors_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_image_colors_state *const ss = (stream_image_colors_state *) st;
for (;;) {
- if (pw->ptr >= pw->limit)
- return 1;
- if (ss->row_bits_passed >= ss->row_bits) {
- ss->row_alignment_bytes_left = ss->row_alignment_bytes;
- ss->input_bits_buffered = 0;
- ss->input_bits_buffer = 0; /* Just to simplify the debugging. */
- if (ss->output_bits_buffered) {
- *(++pw->ptr) = ss->output_bits_buffer;
- ss->output_bits_buffered = 0;
- ss->output_bits_buffer = 0;
- }
- ss->row_bits_passed = 0;
- continue;
- }
- if (ss->row_alignment_bytes_left) {
- uint k = pr->limit - pr->ptr;
-
- if (k > ss->row_alignment_bytes_left)
- k = ss->row_alignment_bytes_left;
- pr->ptr += k;
- ss->row_alignment_bytes_left -= k;
- if (pr->ptr >= pr->limit)
- return 0;
- }
- if (ss->output_component_index < ss->output_depth) {
- for (;ss->output_component_index < ss->output_depth;) {
- uint fitting = (uint)(8 - ss->output_bits_buffered);
- uint v, w, u, n, m;
-
- if (pw->ptr >= pw->limit)
- return 1;
- v = ss->output_color[ss->output_component_index];
- n = ss->output_bits_per_sample - ss->output_component_bits_written; /* no. of bits left */
- w = v - ((v >> n) << n); /* the current component without written bits. */
- if (fitting > n)
- fitting = n; /* no. of bits to write. */
- m = n - fitting; /* no. of bits will left. */
- u = w >> m; /* bits to write (near lsb). */
- ss->output_bits_buffer |= u << (8 - ss->output_bits_buffered - fitting);
- ss->output_bits_buffered += fitting;
- if (ss->output_bits_buffered >= 8) {
- *(++pw->ptr) = ss->output_bits_buffer;
- ss->output_bits_buffered = 0;
- ss->output_bits_buffer = 0;
- }
- ss->output_component_bits_written += fitting;
- if (ss->output_component_bits_written >= ss->output_bits_per_sample) {
- ss->output_component_index++;
- ss->output_component_bits_written = 0;
- }
- }
- ss->row_bits_passed += ss->bits_per_sample * ss->depth;
- continue;
- }
- if (ss->input_bits_buffered < ss->bits_per_sample) {
- if (pr->ptr >= pr->limit)
- return 0;
- ss->input_bits_buffer = (ss->input_bits_buffer << 8) | *++pr->ptr;
- ss->input_bits_buffered += 8;
- /* fixme: delay shifting the input ptr until input_bits_buffer is cleaned. */
- }
- if (ss->input_bits_buffered >= ss->bits_per_sample) {
- uint w;
-
- ss->input_bits_buffered -= ss->bits_per_sample;
- ss->input_color[ss->input_component_index] = w = ss->input_bits_buffer >> ss->input_bits_buffered;
- ss->input_bits_buffer &= ~(w << ss->input_bits_buffered);
- ss->input_component_index++;
- if (ss->input_component_index >= ss->depth) {
- int code = ss->convert_color(ss);
-
- if (code < 0)
- return ERRC;
- ss->output_component_index = 0;
- ss->input_component_index = 0;
- }
- }
+ if (pw->ptr >= pw->limit)
+ return 1;
+ if (ss->row_bits_passed >= ss->row_bits) {
+ ss->row_alignment_bytes_left = ss->row_alignment_bytes;
+ ss->input_bits_buffered = 0;
+ ss->input_bits_buffer = 0; /* Just to simplify the debugging. */
+ if (ss->output_bits_buffered) {
+ *(++pw->ptr) = ss->output_bits_buffer;
+ ss->output_bits_buffered = 0;
+ ss->output_bits_buffer = 0;
+ }
+ ss->row_bits_passed = 0;
+ continue;
+ }
+ if (ss->row_alignment_bytes_left) {
+ uint k = pr->limit - pr->ptr;
+
+ if (k > ss->row_alignment_bytes_left)
+ k = ss->row_alignment_bytes_left;
+ pr->ptr += k;
+ ss->row_alignment_bytes_left -= k;
+ if (pr->ptr >= pr->limit)
+ return 0;
+ }
+ if (ss->output_component_index < ss->output_depth) {
+ for (;ss->output_component_index < ss->output_depth;) {
+ uint fitting = (uint)(8 - ss->output_bits_buffered);
+ uint v, w, u, n, m;
+
+ if (pw->ptr >= pw->limit)
+ return 1;
+ v = ss->output_color[ss->output_component_index];
+ n = ss->output_bits_per_sample - ss->output_component_bits_written; /* no. of bits left */
+ w = v - ((v >> n) << n); /* the current component without written bits. */
+ if (fitting > n)
+ fitting = n; /* no. of bits to write. */
+ m = n - fitting; /* no. of bits will left. */
+ u = w >> m; /* bits to write (near lsb). */
+ ss->output_bits_buffer |= u << (8 - ss->output_bits_buffered - fitting);
+ ss->output_bits_buffered += fitting;
+ if (ss->output_bits_buffered >= 8) {
+ *(++pw->ptr) = ss->output_bits_buffer;
+ ss->output_bits_buffered = 0;
+ ss->output_bits_buffer = 0;
+ }
+ ss->output_component_bits_written += fitting;
+ if (ss->output_component_bits_written >= ss->output_bits_per_sample) {
+ ss->output_component_index++;
+ ss->output_component_bits_written = 0;
+ }
+ }
+ ss->row_bits_passed += ss->bits_per_sample * ss->depth;
+ continue;
+ }
+ if (ss->input_bits_buffered < ss->bits_per_sample) {
+ if (pr->ptr >= pr->limit)
+ return 0;
+ ss->input_bits_buffer = (ss->input_bits_buffer << 8) | *++pr->ptr;
+ ss->input_bits_buffered += 8;
+ /* fixme: delay shifting the input ptr until input_bits_buffer is cleaned. */
+ }
+ if (ss->input_bits_buffered >= ss->bits_per_sample) {
+ uint w;
+
+ ss->input_bits_buffered -= ss->bits_per_sample;
+ ss->input_color[ss->input_component_index] = w = ss->input_bits_buffer >> ss->input_bits_buffered;
+ ss->input_bits_buffer &= ~(w << ss->input_bits_buffered);
+ ss->input_component_index++;
+ if (ss->input_component_index >= ss->depth) {
+ int code = ss->convert_color(ss);
+
+ if (code < 0)
+ return ERRC;
+ ss->output_component_index = 0;
+ ss->input_component_index = 0;
+ }
+ }
}
}
@@ -1199,4 +1197,3 @@ const stream_template s__image_colors_template = {
&st_stream_image_colors_state, s_image_colors_init, s_image_colors_process, 1, 1,
NULL, NULL
};
-
diff --git a/gs/base/gdevpsds.h b/gs/base/gdevpsds.h
index b67b4adcc..c7693b006 100644
--- a/gs/base/gdevpsds.h
+++ b/gs/base/gdevpsds.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -108,15 +108,15 @@ extern const stream_template s_IE_template;
/* Downsample, possibly with anti-aliasing. */
#define stream_Downsample_state_common\
- stream_state_common;\
- /* The client sets the following before initialization. */\
- int Colors;\
- int WidthIn, HeightIn;\
- int XFactor, YFactor;\
- bool AntiAlias;\
- bool padX, padY; /* keep excess samples */\
- /* The following are updated dynamically. */\
- int x, y /* position within input image */
+ stream_state_common;\
+ /* The client sets the following before initialization. */\
+ int Colors;\
+ int WidthIn, HeightIn;\
+ int XFactor, YFactor;\
+ bool AntiAlias;\
+ bool padX, padY; /* keep excess samples */\
+ /* The following are updated dynamically. */\
+ int x, y /* position within input image */
#define s_Downsample_set_defaults_inline(ss)\
((ss)->AntiAlias = (ss)->padX = (ss)->padY = false)
typedef struct stream_Downsample_state_s {
@@ -167,8 +167,8 @@ extern const stream_template s_compr_chooser_template;
/* Set image dimensions. */
int
-s_compr_chooser_set_dimensions(stream_compr_chooser_state * st, int width,
- int height, int depth, int bits_per_sample);
+s_compr_chooser_set_dimensions(stream_compr_chooser_state * st, int width,
+ int height, int depth, int bits_per_sample);
/* Get choice */
uint s_compr_chooser__get_choice(stream_compr_chooser_state *st, bool force);
@@ -215,14 +215,14 @@ struct stream_image_colors_state_s {
extern const stream_template s_image_colors_template;
-void s_image_colors_set_dimensions(stream_image_colors_state * st,
- int width, int height, int depth, int bits_per_sample);
+void s_image_colors_set_dimensions(stream_image_colors_state * st,
+ int width, int height, int depth, int bits_per_sample);
void s_image_colors_set_mask_colors(stream_image_colors_state * ss, uint *MaskColor);
void s_image_colors_set_color_space(stream_image_colors_state * ss, gx_device *pdev,
- const gs_color_space *pcs, const gs_imager_state *pis,
- float *Decode);
+ const gs_color_space *pcs, const gs_imager_state *pis,
+ float *Decode);
extern const stream_template s__image_colors_template;
diff --git a/gs/base/gdevpsdu.c b/gs/base/gdevpsdu.c
index db3ecbc60..f21601e6b 100644
--- a/gs/base/gdevpsdu.c
+++ b/gs/base/gdevpsdu.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,7 +39,6 @@ const psdf_set_color_commands_t psdf_set_stroke_color_commands = {
"G", "RG", "K", "CS", "SC", "SCN"
};
-
/* Define parameter-setting procedures. */
extern stream_state_proc_put_params(s_DCTE_put_params, stream_DCT_state);
@@ -56,22 +55,22 @@ int
psdf_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
{
switch (cap) {
- case gs_cap_butt:
- case gs_cap_round:
- case gs_cap_square:
- pprintd1(gdev_vector_stream(vdev), "%d J\n", cap);
- break;
- case gs_cap_triangle:
- /* If we get a PCL triangle cap, substitute with a round cap */
- pprintd1(gdev_vector_stream(vdev), "%d J\n", gs_cap_round);
- break;
- default:
- /* Ensure we don't write a broken file if we don't recognise the cap */
- emprintf1(vdev->memory,
+ case gs_cap_butt:
+ case gs_cap_round:
+ case gs_cap_square:
+ pprintd1(gdev_vector_stream(vdev), "%d J\n", cap);
+ break;
+ case gs_cap_triangle:
+ /* If we get a PCL triangle cap, substitute with a round cap */
+ pprintd1(gdev_vector_stream(vdev), "%d J\n", gs_cap_round);
+ break;
+ default:
+ /* Ensure we don't write a broken file if we don't recognise the cap */
+ emprintf1(vdev->memory,
"Unknown line cap enumerator %d, substituting butt\n",
cap);
- pprintd1(gdev_vector_stream(vdev), "%d J\n", gs_cap_butt);
- break;
+ pprintd1(gdev_vector_stream(vdev), "%d J\n", gs_cap_butt);
+ break;
}
return 0;
}
@@ -80,26 +79,26 @@ int
psdf_setlinejoin(gx_device_vector * vdev, gs_line_join join)
{
switch (join) {
- case gs_join_miter:
- case gs_join_round:
- case gs_join_bevel:
- pprintd1(gdev_vector_stream(vdev), "%d j\n", join);
- break;
- case gs_join_none:
- /* If we get a PCL triangle join, substitute with a bevel join */
- pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_bevel);
- break;
- case gs_join_triangle:
- /* If we get a PCL triangle join, substitute with a miter join */
- pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_miter);
- break;
- default:
- /* Ensure we don't write a broken file if we don't recognise the join */
- emprintf1(vdev->memory,
+ case gs_join_miter:
+ case gs_join_round:
+ case gs_join_bevel:
+ pprintd1(gdev_vector_stream(vdev), "%d j\n", join);
+ break;
+ case gs_join_none:
+ /* If we get a PCL triangle join, substitute with a bevel join */
+ pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_bevel);
+ break;
+ case gs_join_triangle:
+ /* If we get a PCL triangle join, substitute with a miter join */
+ pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_miter);
+ break;
+ default:
+ /* Ensure we don't write a broken file if we don't recognise the join */
+ emprintf1(vdev->memory,
"Unknown line join enumerator %d, substituting miter\n",
join);
- pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_miter);
- break;
+ pprintd1(gdev_vector_stream(vdev), "%d j\n", gs_join_miter);
+ break;
}
return 0;
}
@@ -113,14 +112,14 @@ psdf_setmiterlimit(gx_device_vector * vdev, floatp limit)
int
psdf_setdash(gx_device_vector * vdev, const float *pattern, uint count,
- floatp offset)
+ floatp offset)
{
stream *s = gdev_vector_stream(vdev);
int i;
stream_puts(s, "[ ");
for (i = 0; i < count; ++i)
- pprintg1(s, "%g ", pattern[i]);
+ pprintg1(s, "%g ", pattern[i]);
pprintg1(s, "] %g d\n", offset);
return 0;
}
@@ -134,7 +133,7 @@ psdf_setflat(gx_device_vector * vdev, floatp flatness)
int
psdf_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff)
+ gs_logical_operation_t diff)
{
/****** SHOULD AT LEAST DETECT SET-0 & SET-1 ******/
return 0;
@@ -142,15 +141,15 @@ psdf_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
int
psdf_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1, fixed y1,
- gx_path_type_t type)
+ gx_path_type_t type)
{
int code = (*vdev_proc(vdev, beginpath)) (vdev, type);
if (code < 0)
- return code;
+ return code;
pprintg4(gdev_vector_stream(vdev), "%g %g %g %g re\n",
- fixed2float(x0), fixed2float(y0),
- fixed2float(x1 - x0), fixed2float(y1 - y0));
+ fixed2float(x0), fixed2float(y0),
+ fixed2float(x1 - x0), fixed2float(y1 - y0));
return (*vdev_proc(vdev, endpath)) (vdev, type);
}
@@ -162,7 +161,7 @@ psdf_beginpath(gx_device_vector * vdev, gx_path_type_t type)
int
psdf_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
pprintg2(gdev_vector_stream(vdev), "%g %g m\n", x, y);
return 0;
@@ -170,7 +169,7 @@ psdf_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
int
psdf_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
pprintg2(gdev_vector_stream(vdev), "%g %g l\n", x, y);
return 0;
@@ -178,26 +177,26 @@ psdf_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
int
psdf_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type)
{
if (x1 == x0 && y1 == y0 && x2 == x3 && y2 == y3)
- pprintg2(gdev_vector_stream(vdev), "%g %g l\n", x3, y3);
+ pprintg2(gdev_vector_stream(vdev), "%g %g l\n", x3, y3);
else if (x1 == x0 && y1 == y0)
- pprintg4(gdev_vector_stream(vdev), "%g %g %g %g v\n",
- x2, y2, x3, y3);
+ pprintg4(gdev_vector_stream(vdev), "%g %g %g %g v\n",
+ x2, y2, x3, y3);
else if (x3 == x2 && y3 == y2)
- pprintg4(gdev_vector_stream(vdev), "%g %g %g %g y\n",
- x1, y1, x2, y2);
+ pprintg4(gdev_vector_stream(vdev), "%g %g %g %g y\n",
+ x1, y1, x2, y2);
else
- pprintg6(gdev_vector_stream(vdev), "%g %g %g %g %g %g c\n",
- x1, y1, x2, y2, x3, y3);
+ pprintg6(gdev_vector_stream(vdev), "%g %g %g %g %g %g c\n",
+ x1, y1, x2, y2, x3, y3);
return 0;
}
int
psdf_closepath(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
stream_puts(gdev_vector_stream(vdev), "h\n");
return 0;
@@ -221,17 +220,17 @@ psdf_adjust_color_index(gx_device_vector *vdev, gx_color_index color)
}
/* Round a double value to a specified precision. */
-double
+double
psdf_round(double v, int precision, int radix)
{
double mul = 1;
double w = v;
if (w <= 0)
- return w;
+ return w;
while (w < precision) {
- w *= radix;
- mul *= radix;
+ w *= radix;
+ mul *= radix;
}
return (int)(w + 0.5) / mul;
}
@@ -247,53 +246,53 @@ round_byte_color(gx_color_index cv)
}
int
psdf_set_color(gx_device_vector * vdev, const gx_drawing_color * pdc,
- const psdf_set_color_commands_t *ppscc)
+ const psdf_set_color_commands_t *ppscc)
{
const char *setcolor;
if (!gx_dc_is_pure(pdc))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
{
- stream *s = gdev_vector_stream(vdev);
- gx_color_index color =
- psdf_adjust_color_index(vdev, gx_dc_pure_color(pdc));
- /*
- * Normally we would precompute all of v0 .. v3, but gcc 2.7.2.3
- * generates incorrect code for Intel CPUs if we do this. The code
- * below is longer, but does less computation in some cases.
- */
- double v3 = round_byte_color(color & 0xff);
-
- switch (vdev->color_info.num_components) {
- case 4:
- /* if (v0 == 0 && v1 == 0 && v2 == 0 && ...) */
- if ((color & 0xffffff00) == 0 && ppscc->setgray != 0) {
- v3 = 1.0 - v3;
- goto g;
- }
- pprintg4(s, "%g %g %g %g", round_byte_color(color >> 24),
- round_byte_color((color >> 16) & 0xff),
- round_byte_color((color >> 8) & 0xff), v3);
- setcolor = ppscc->setcmykcolor;
- break;
- case 3:
- /* if (v1 == v2 && v2 == v3 && ...) */
- if (!((color ^ (color >> 8)) & 0xffff) && ppscc->setgray != 0)
- goto g;
- pprintg3(s, "%g %g %g", round_byte_color((color >> 16) & 0xff),
- round_byte_color((color >> 8) & 0xff), v3);
- setcolor = ppscc->setrgbcolor;
- break;
- case 1:
- g:
- pprintg1(s, "%g", v3);
- setcolor = ppscc->setgray;
- break;
- default: /* can't happen */
- return_error(gs_error_rangecheck);
- }
- if (setcolor)
- pprints1(s, " %s\n", setcolor);
+ stream *s = gdev_vector_stream(vdev);
+ gx_color_index color =
+ psdf_adjust_color_index(vdev, gx_dc_pure_color(pdc));
+ /*
+ * Normally we would precompute all of v0 .. v3, but gcc 2.7.2.3
+ * generates incorrect code for Intel CPUs if we do this. The code
+ * below is longer, but does less computation in some cases.
+ */
+ double v3 = round_byte_color(color & 0xff);
+
+ switch (vdev->color_info.num_components) {
+ case 4:
+ /* if (v0 == 0 && v1 == 0 && v2 == 0 && ...) */
+ if ((color & 0xffffff00) == 0 && ppscc->setgray != 0) {
+ v3 = 1.0 - v3;
+ goto g;
+ }
+ pprintg4(s, "%g %g %g %g", round_byte_color(color >> 24),
+ round_byte_color((color >> 16) & 0xff),
+ round_byte_color((color >> 8) & 0xff), v3);
+ setcolor = ppscc->setcmykcolor;
+ break;
+ case 3:
+ /* if (v1 == v2 && v2 == v3 && ...) */
+ if (!((color ^ (color >> 8)) & 0xffff) && ppscc->setgray != 0)
+ goto g;
+ pprintg3(s, "%g %g %g", round_byte_color((color >> 16) & 0xff),
+ round_byte_color((color >> 8) & 0xff), v3);
+ setcolor = ppscc->setrgbcolor;
+ break;
+ case 1:
+ g:
+ pprintg1(s, "%g", v3);
+ setcolor = ppscc->setgray;
+ break;
+ default: /* can't happen */
+ return_error(gs_error_rangecheck);
+ }
+ if (setcolor)
+ pprints1(s, " %s\n", setcolor);
}
return 0;
}
@@ -312,24 +311,24 @@ psdf_begin_binary(gx_device_psdf * pdev, psdf_binary_writer * pbw)
/* If not binary, set up the encoding stream. */
if (!pdev->binary_ok) {
#define BUF_SIZE 100 /* arbitrary */
- byte *buf = gs_alloc_bytes(mem, BUF_SIZE, "psdf_begin_binary(buf)");
- stream_A85E_state *ss = (stream_A85E_state *)
- s_alloc_state(mem, s_A85E_template.stype,
- "psdf_begin_binary(stream_state)");
- stream *s = s_alloc(mem, "psdf_begin_binary(stream)");
-
- if (buf == 0 || ss == 0 || s == 0) {
- gs_free_object(mem, s, "psdf_begin_binary(stream)");
- gs_free_object(mem, ss, "psdf_begin_binary(stream_state)");
- gs_free_object(mem, buf, "psdf_begin_binary(buf)");
- return_error(gs_error_VMerror);
- }
- ss->template = &s_A85E_template;
- s_init_filter(s, (stream_state *)ss, buf, BUF_SIZE, pdev->strm);
+ byte *buf = gs_alloc_bytes(mem, BUF_SIZE, "psdf_begin_binary(buf)");
+ stream_A85E_state *ss = (stream_A85E_state *)
+ s_alloc_state(mem, s_A85E_template.stype,
+ "psdf_begin_binary(stream_state)");
+ stream *s = s_alloc(mem, "psdf_begin_binary(stream)");
+
+ if (buf == 0 || ss == 0 || s == 0) {
+ gs_free_object(mem, s, "psdf_begin_binary(stream)");
+ gs_free_object(mem, ss, "psdf_begin_binary(stream_state)");
+ gs_free_object(mem, buf, "psdf_begin_binary(buf)");
+ return_error(gs_error_VMerror);
+ }
+ ss->template = &s_A85E_template;
+ s_init_filter(s, (stream_state *)ss, buf, BUF_SIZE, pdev->strm);
#undef BUF_SIZE
- pbw->strm = s;
+ pbw->strm = s;
} else {
- pbw->strm = pdev->strm;
+ pbw->strm = pdev->strm;
}
return 0;
}
@@ -338,10 +337,10 @@ psdf_begin_binary(gx_device_psdf * pdev, psdf_binary_writer * pbw)
/* if any, using pdev->v_memory. */
int
psdf_encode_binary(psdf_binary_writer * pbw, const stream_template * template,
- stream_state * ss)
+ stream_state * ss)
{
return (s_add_filter(&pbw->strm, template, ss, pbw->memory) == 0 ?
- gs_note_error(gs_error_VMerror) : 0);
+ gs_note_error(gs_error_VMerror) : 0);
}
/*
@@ -352,68 +351,68 @@ psdf_encode_binary(psdf_binary_writer * pbw, const stream_template * template,
*/
int
psdf_DCT_filter(gs_param_list *plist /* may be NULL */,
- stream_state /*stream_DCTE_state*/ *st,
- int Columns, int Rows, int Colors,
- psdf_binary_writer *pbw /* may be NULL */)
+ stream_state /*stream_DCTE_state*/ *st,
+ int Columns, int Rows, int Colors,
+ psdf_binary_writer *pbw /* may be NULL */)
{
- stream_DCT_state *const ss = (stream_DCT_state *) st;
- gs_memory_t *mem = st->memory;
- jpeg_compress_data *jcdp;
- gs_c_param_list rcc_list;
- int code;
-
- /*
- * "Wrap" the actual Dict or ACSDict parameter list in one that
- * sets Rows, Columns, and Colors.
- */
- gs_c_param_list_write(&rcc_list, mem);
- if ((code = param_write_int((gs_param_list *)&rcc_list, "Rows",
- &Rows)) < 0 ||
- (code = param_write_int((gs_param_list *)&rcc_list, "Columns",
- &Columns)) < 0 ||
- (code = param_write_int((gs_param_list *)&rcc_list, "Colors",
- &Colors)) < 0
- ) {
- goto rcc_fail;
- }
- gs_c_param_list_read(&rcc_list);
- if (plist)
- gs_c_param_list_set_target(&rcc_list, plist);
- /* Allocate space for IJG parameters. */
- jcdp = gs_alloc_struct_immovable(mem, jpeg_compress_data,
+ stream_DCT_state *const ss = (stream_DCT_state *) st;
+ gs_memory_t *mem = st->memory;
+ jpeg_compress_data *jcdp;
+ gs_c_param_list rcc_list;
+ int code;
+
+ /*
+ * "Wrap" the actual Dict or ACSDict parameter list in one that
+ * sets Rows, Columns, and Colors.
+ */
+ gs_c_param_list_write(&rcc_list, mem);
+ if ((code = param_write_int((gs_param_list *)&rcc_list, "Rows",
+ &Rows)) < 0 ||
+ (code = param_write_int((gs_param_list *)&rcc_list, "Columns",
+ &Columns)) < 0 ||
+ (code = param_write_int((gs_param_list *)&rcc_list, "Colors",
+ &Colors)) < 0
+ ) {
+ goto rcc_fail;
+ }
+ gs_c_param_list_read(&rcc_list);
+ if (plist)
+ gs_c_param_list_set_target(&rcc_list, plist);
+ /* Allocate space for IJG parameters. */
+ jcdp = gs_alloc_struct_immovable(mem, jpeg_compress_data,
&st_jpeg_compress_data, "zDCTE");
if (jcdp == 0)
- return_error(gs_error_VMerror);
- ss->data.compress = jcdp;
- jcdp->memory = ss->jpeg_memory = mem; /* set now for allocation */
- if ((code = gs_jpeg_create_compress(ss)) < 0)
- goto dcte_fail; /* correct to do jpeg_destroy here */
- /* Read parameters from dictionary */
- code = s_DCTE_put_params((gs_param_list *)&rcc_list, ss);
- if (code < 0)
- return code;
- /* Create the filter. */
- jcdp->template = s_DCTE_template;
- /* Make sure we get at least a full scan line of input. */
- ss->scan_line_size = jcdp->cinfo.input_components *
- jcdp->cinfo.image_width;
- jcdp->template.min_in_size =
- max(s_DCTE_template.min_in_size, ss->scan_line_size);
- /* Make sure we can write the user markers in a single go. */
- jcdp->template.min_out_size =
- max(s_DCTE_template.min_out_size, ss->Markers.size);
- if (pbw)
- code = psdf_encode_binary(pbw, &jcdp->template, st);
- if (code >= 0) {
- gs_c_param_list_release(&rcc_list);
- return 0;
- }
+ return_error(gs_error_VMerror);
+ ss->data.compress = jcdp;
+ jcdp->memory = ss->jpeg_memory = mem; /* set now for allocation */
+ if ((code = gs_jpeg_create_compress(ss)) < 0)
+ goto dcte_fail; /* correct to do jpeg_destroy here */
+ /* Read parameters from dictionary */
+ code = s_DCTE_put_params((gs_param_list *)&rcc_list, ss);
+ if (code < 0)
+ return code;
+ /* Create the filter. */
+ jcdp->template = s_DCTE_template;
+ /* Make sure we get at least a full scan line of input. */
+ ss->scan_line_size = jcdp->cinfo.input_components *
+ jcdp->cinfo.image_width;
+ jcdp->template.min_in_size =
+ max(s_DCTE_template.min_in_size, ss->scan_line_size);
+ /* Make sure we can write the user markers in a single go. */
+ jcdp->template.min_out_size =
+ max(s_DCTE_template.min_out_size, ss->Markers.size);
+ if (pbw)
+ code = psdf_encode_binary(pbw, &jcdp->template, st);
+ if (code >= 0) {
+ gs_c_param_list_release(&rcc_list);
+ return 0;
+ }
dcte_fail:
- gs_jpeg_destroy(ss);
- gs_free_object(mem, jcdp, "setup_image_compression");
+ gs_jpeg_destroy(ss);
+ gs_free_object(mem, jcdp, "setup_image_compression");
rcc_fail:
- gs_c_param_list_release(&rcc_list);
- return code;
+ gs_c_param_list_release(&rcc_list);
+ return code;
}
/* Add a 2-D CCITTFax encoding filter. */
@@ -424,12 +423,12 @@ psdf_CFE_binary(psdf_binary_writer * pbw, int w, int h, bool invert)
gs_memory_t *mem = pbw->memory;
const stream_template *template = &s_CFE_template;
stream_CFE_state *st =
- gs_alloc_struct(mem, stream_CFE_state, template->stype,
- "psdf_CFE_binary");
+ gs_alloc_struct(mem, stream_CFE_state, template->stype,
+ "psdf_CFE_binary");
int code;
if (st == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
(*template->set_defaults) ((stream_state *) st);
st->K = -1;
st->Columns = w;
@@ -438,7 +437,7 @@ psdf_CFE_binary(psdf_binary_writer * pbw, int w, int h, bool invert)
st->EndOfBlock = pbw->strm->state->template != &s_A85E_template;
code = psdf_encode_binary(pbw, template, (stream_state *) st);
if (code < 0)
- gs_free_object(mem, st, "psdf_CFE_binary");
+ gs_free_object(mem, st, "psdf_CFE_binary");
return code;
}
@@ -461,9 +460,9 @@ int
psdf_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
{
if (dev_proc(dev, get_alpha_bits)(dev, go_graphics) > 1)
- emprintf1(dev->memory,
+ emprintf1(dev->memory,
"Can't set GraphicsAlphaBits > 1 with a vector device %s.\n",
- dev->dname);
+ dev->dname);
return_error(gs_error_unregistered);
}
diff --git a/gs/base/gdevpsf.h b/gs/base/gdevpsf.h
index a9bcb2827..2fa9ab8ca 100644
--- a/gs/base/gdevpsf.h
+++ b/gs/base/gdevpsf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,11 +44,11 @@ typedef struct psf_glyph_enum_s psf_glyph_enum_t;
struct psf_glyph_enum_s {
gs_font *font;
struct su_ {
- union sus_ {
- const gs_glyph *list; /* if subset given by a list */
- const byte *bits; /* if CID or TT subset given by a bitmap */
- } selected;
- uint size;
+ union sus_ {
+ const gs_glyph *list; /* if subset given by a list */
+ const byte *bits; /* if CID or TT subset given by a bitmap */
+ } selected;
+ uint size;
} subset;
gs_glyph_space_t glyph_space;
ulong index;
@@ -61,17 +61,17 @@ struct psf_glyph_enum_s {
* (as integer glyphs, i.e., offset by gs_min_cid_glyph).
*/
void psf_enumerate_list_begin(psf_glyph_enum_t *ppge, gs_font *font,
- const gs_glyph *subset_list,
- uint subset_size,
- gs_glyph_space_t glyph_space);
+ const gs_glyph *subset_list,
+ uint subset_size,
+ gs_glyph_space_t glyph_space);
/* Backward compatibility */
#define psf_enumerate_glyphs_begin psf_enumerate_list_begin
/* Begin enumerating CID or TT glyphs in a subset given by a bit vector. */
/* Note that subset_size is given in bits, not in bytes. */
void psf_enumerate_bits_begin(psf_glyph_enum_t *ppge, gs_font *font,
- const byte *subset_bits, uint subset_size,
- gs_glyph_space_t glyph_space);
+ const byte *subset_bits, uint subset_size,
+ gs_glyph_space_t glyph_space);
/* Backward compatibility */
#define psf_enumerate_cids_begin(ppge, font, bits, size)\
psf_enumerate_bits_begin(ppge, font, bits, size, GLYPH_SPACE_NAME)
@@ -94,7 +94,7 @@ int psf_enumerate_glyphs_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph);
* use max_count.
*/
int psf_add_subset_pieces(gs_glyph *glyphs, uint *pcount, uint max_count,
- uint max_pieces, gs_font *font);
+ uint max_pieces, gs_font *font);
/*
* Sort a list of glyphs and remove duplicates. Return the number of glyphs
@@ -107,12 +107,12 @@ int psf_sort_glyphs(gs_glyph *glyphs, int count);
* if the glyph is not present.
*/
int psf_sorted_glyphs_index_of(const gs_glyph *glyphs, int count,
- gs_glyph glyph);
+ gs_glyph glyph);
/*
* Determine whether a sorted list of glyphs includes a given glyph.
*/
bool psf_sorted_glyphs_include(const gs_glyph *glyphs, int count,
- gs_glyph glyph);
+ gs_glyph glyph);
/*
* Define the internal structure that holds glyph information for an
@@ -137,12 +137,12 @@ typedef struct gs_font_type1_s gs_font_type1;
/* Define the type for the glyph data callback procedure. */
typedef int (*glyph_data_proc_t)(gs_font_base *, gs_glyph,
- gs_glyph_data_t *, gs_font_type1 **);
+ gs_glyph_data_t *, gs_font_type1 **);
/* Check that all selected glyphs can be written. */
int psf_check_outline_glyphs(gs_font_base *pfont,
- psf_glyph_enum_t *ppge,
- glyph_data_proc_t glyph_data);
+ psf_glyph_enum_t *ppge,
+ glyph_data_proc_t glyph_data);
/*
* Gather glyph information for a Type 1, Type 2, or CIDFontType 0 font.
@@ -153,17 +153,17 @@ int psf_check_outline_glyphs(gs_font_base *pfont,
* undefined glyphs from the list it builds.
*/
int psf_get_outline_glyphs(psf_outline_glyphs_t *pglyphs,
- gs_font_base *pfont, gs_glyph *subset_glyphs,
- uint subset_size, glyph_data_proc_t glyph_data);
+ gs_font_base *pfont, gs_glyph *subset_glyphs,
+ uint subset_size, glyph_data_proc_t glyph_data);
/* ------ Exported by gdevpsf1.c ------ */
/* Gather glyph information for a Type 1 or Type 2 font. */
int psf_type1_glyph_data(gs_font_base *, gs_glyph, gs_glyph_data_t *,
- gs_font_type1 **);
+ gs_font_type1 **);
int psf_get_type1_glyphs(psf_outline_glyphs_t *pglyphs,
- gs_font_type1 *pfont,
- gs_glyph *subset_glyphs, uint subset_size);
+ gs_font_type1 *pfont,
+ gs_glyph *subset_glyphs, uint subset_size);
/*
* Write a Type 1 font definition. This procedure does not allocate
@@ -176,9 +176,9 @@ int psf_get_type1_glyphs(psf_outline_glyphs_t *pglyphs,
#define WRITE_TYPE1_POSTSCRIPT 16 /* don't observe ATM restrictions */
#define WRITE_TYPE1_WITH_LENIV 32 /* don't allow lenIV = -1 */
int psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
- gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name,
- int lengths[3]);
+ gs_glyph *subset_glyphs, uint subset_size,
+ const gs_const_string *alt_font_name,
+ int lengths[3]);
/* ------ Exported by gdevpsf2.c ------ */
@@ -191,9 +191,9 @@ int psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
#define WRITE_TYPE2_AR3 4 /* work around bugs in Acrobat Reader 3 */
#define WRITE_TYPE2_NO_GSUBRS 8 /* omit GlobalSubrs */
int psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
- gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name,
- gs_int_rect *FontBBox);
+ gs_glyph *subset_glyphs, uint subset_size,
+ const gs_const_string *alt_font_name,
+ gs_int_rect *FontBBox);
#ifndef gs_font_cid0_DEFINED
# define gs_font_cid0_DEFINED
@@ -207,8 +207,8 @@ typedef struct gs_font_cid0_s gs_font_cid0;
* This procedure does not allocate or free any data.
*/
int psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
- const byte *subset_cids, uint subset_size,
- const gs_const_string *alt_font_name);
+ const byte *subset_cids, uint subset_size,
+ const gs_const_string *alt_font_name);
/* ------ Exported by gdevpsfm.c ------ */
@@ -222,8 +222,8 @@ typedef struct gs_cmap_s gs_cmap_t;
#endif
typedef int (*psf_put_name_chars_proc_t)(stream *, const byte *, uint);
int psf_write_cmap(const gs_memory_t *mem, stream *s, const gs_cmap_t *pcmap,
- psf_put_name_chars_proc_t put_name_chars,
- const gs_const_string *alt_cmap_name, int font_index_only);
+ psf_put_name_chars_proc_t put_name_chars,
+ const gs_const_string *alt_cmap_name, int font_index_only);
/* ------ Exported by gdevpsft.c ------ */
extern const long default_defaultWidthX;
@@ -241,13 +241,13 @@ typedef struct gs_font_type42_s gs_font_type42;
#define WRITE_TRUETYPE_POST 4 /* generate post if missing */
#define WRITE_TRUETYPE_NO_TRIMMED_TABLE 8 /* not OK to use cmap format 6 */
#define WRITE_TRUETYPE_HVMTX 16 /* generate [hv]mtx from glyph_info */
-#define WRITE_TRUETYPE_UNICODE_CMAP 32 /* For PDF/A or other non-symbolic TT font,
- * write a 3,1 (Windows Unicode) cmap instead of
- * a 3,0 one.
- */
+#define WRITE_TRUETYPE_UNICODE_CMAP 32 /* For PDF/A or other non-symbolic TT font,
+ * write a 3,1 (Windows Unicode) cmap instead of
+ * a 3,0 one.
+ */
int psf_write_truetype_font(stream *s, gs_font_type42 *pfont, int options,
- gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name);
+ gs_glyph *subset_glyphs, uint subset_size,
+ const gs_const_string *alt_font_name);
/*
* Write a "stripped" TrueType font definition. All tables are written
@@ -285,8 +285,8 @@ typedef struct gs_font_cid2_s gs_font_cid2;
* This procedure does not allocate or free any data.
*/
int psf_write_cid2_font(stream *s, gs_font_cid2 *pfont, int options,
- const byte *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name);
+ const byte *subset_glyphs, uint subset_size,
+ const gs_const_string *alt_font_name);
/*
* Write a "stripped" CIDFontType 2 font definition. This is the same
@@ -302,6 +302,6 @@ int psf_write_cid2_stripped(stream *s, gs_font_cid2 *pfont);
* NOTE: this procedure expands all Subrs in-line.
*/
int psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
- gs_font_type1 *pfont);
+ gs_font_type1 *pfont);
#endif /* gdevpsf_INCLUDED */
diff --git a/gs/base/gdevpsf1.c b/gs/base/gdevpsf1.c
index 10ffc5620..2ac4b8773 100644
--- a/gs/base/gdevpsf1.c
+++ b/gs/base/gdevpsf1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@
/* Gather glyph information for a Type 1 or Type 2 font. */
int
psf_type1_glyph_data(gs_font_base *pbfont, gs_glyph glyph,
- gs_glyph_data_t *pgd, gs_font_type1 **ppfont)
+ gs_glyph_data_t *pgd, gs_font_type1 **ppfont)
{
gs_font_type1 *const pfont = (gs_font_type1 *)pbfont;
@@ -45,11 +45,11 @@ psf_type1_glyph_data(gs_font_base *pbfont, gs_glyph glyph,
}
int
psf_get_type1_glyphs(psf_outline_glyphs_t *pglyphs, gs_font_type1 *pfont,
- gs_glyph *subset_glyphs, uint subset_size)
+ gs_glyph *subset_glyphs, uint subset_size)
{
return psf_get_outline_glyphs(pglyphs, (gs_font_base *)pfont,
- subset_glyphs, subset_size,
- psf_type1_glyph_data);
+ subset_glyphs, subset_size,
+ psf_type1_glyph_data);
}
/* ------ Main program ------ */
@@ -57,15 +57,15 @@ psf_get_type1_glyphs(psf_outline_glyphs_t *pglyphs, gs_font_type1 *pfont,
/* Write a (named) array of floats. */
static int
write_float_array(gs_param_list *plist, const char *key, const float *values,
- int count)
+ int count)
{
if (count != 0) {
- gs_param_float_array fa;
+ gs_param_float_array fa;
- fa.persistent = false;
- fa.size = count;
- fa.data = values;
- return param_write_float_array(plist, key, &fa);
+ fa.persistent = false;
+ fa.size = count;
+ fa.data = values;
+ return param_write_float_array(plist, key, &fa);
}
return 0;
}
@@ -75,52 +75,52 @@ static void
write_uid(stream *s, const gs_uid *puid)
{
if (uid_is_UniqueID(puid))
- pprintld1(s, "/UniqueID %ld def\n", puid->id);
+ pprintld1(s, "/UniqueID %ld def\n", puid->id);
else if (uid_is_XUID(puid)) {
- uint i, n = uid_XUID_size(puid);
+ uint i, n = uid_XUID_size(puid);
- stream_puts(s, "/XUID [");
- for (i = 0; i < n; ++i)
- pprintld1(s, "%ld ", uid_XUID_values(puid)[i]);
- stream_puts(s, "] readonly def\n");
+ stream_puts(s, "/XUID [");
+ for (i = 0; i < n; ++i)
+ pprintld1(s, "%ld ", uid_XUID_values(puid)[i]);
+ stream_puts(s, "] readonly def\n");
}
}
/* Write the font name. */
static void
write_font_name(stream *s, const gs_font_type1 *pfont,
- const gs_const_string *alt_font_name, bool as_name)
+ const gs_const_string *alt_font_name, bool as_name)
{
const byte *c;
const byte *name = (alt_font_name ? alt_font_name->data : pfont->font_name.chars);
int n = (alt_font_name ? alt_font_name->size : pfont->font_name.size);
if (n == 0)
- /* empty name, may need to write it as empty string */
- stream_puts(s, (as_name ? "/" : "()"));
+ /* empty name, may need to write it as empty string */
+ stream_puts(s, (as_name ? "/" : "()"));
else {
- for (c = (byte *)"()<>[]{}/% \n\r\t\b\f\004\033"; *c; c++)
- if (memchr(name, *c, n))
- break;
- if (*c || memchr(name, 0, n)) {
- /* name contains whitespace (NUL included) or a PostScript separator */
- byte pssebuf[1 + 4 * gs_font_name_max + 1]; /* "(" + "\ooo" * gs_font_name_max + ")" */
- stream_cursor_read r;
- stream_cursor_write w;
-
- pssebuf[0] = '(';
- r.limit = (r.ptr = name - 1) + n;
- w.limit = (w.ptr = pssebuf) + sizeof pssebuf - 1;
- s_PSSE_template.process(NULL, &r, &w, true);
- stream_write(s, pssebuf, w.ptr - pssebuf + 1);
- if (as_name)
- stream_puts(s, " cvn");
- } else {
- /* name without any special characters */
- if (as_name)
- stream_putc(s, '/');
- stream_write(s, name, n);
- }
+ for (c = (byte *)"()<>[]{}/% \n\r\t\b\f\004\033"; *c; c++)
+ if (memchr(name, *c, n))
+ break;
+ if (*c || memchr(name, 0, n)) {
+ /* name contains whitespace (NUL included) or a PostScript separator */
+ byte pssebuf[1 + 4 * gs_font_name_max + 1]; /* "(" + "\ooo" * gs_font_name_max + ")" */
+ stream_cursor_read r;
+ stream_cursor_write w;
+
+ pssebuf[0] = '(';
+ r.limit = (r.ptr = name - 1) + n;
+ w.limit = (w.ptr = pssebuf) + sizeof pssebuf - 1;
+ s_PSSE_template.process(NULL, &r, &w, true);
+ stream_write(s, pssebuf, w.ptr - pssebuf + 1);
+ if (as_name)
+ stream_puts(s, " cvn");
+ } else {
+ /* name without any special characters */
+ if (as_name)
+ stream_putc(s, '/');
+ stream_write(s, name, n);
+ }
}
}
/*
@@ -129,51 +129,51 @@ write_font_name(stream *s, const gs_font_type1 *pfont,
*/
static int
write_Encoding(stream *s, gs_font_type1 *pfont, int options,
- gs_glyph *subset_glyphs, uint subset_size, gs_glyph notdef)
+ gs_glyph *subset_glyphs, uint subset_size, gs_glyph notdef)
{
stream_puts(s, "/Encoding ");
switch (pfont->encoding_index) {
- case ENCODING_INDEX_STANDARD:
- stream_puts(s, "StandardEncoding");
- break;
- case ENCODING_INDEX_ISOLATIN1:
- /* ATM only recognizes StandardEncoding. */
- if (options & WRITE_TYPE1_POSTSCRIPT) {
- stream_puts(s, "ISOLatin1Encoding");
- break;
- }
- default:{
- gs_char i;
-
- stream_puts(s, "256 array\n");
- stream_puts(s, "0 1 255 {1 index exch /.notdef put} for\n");
- for (i = 0; i < 256; ++i) {
- gs_glyph glyph =
- (*pfont->procs.encode_char)
- ((gs_font *)pfont, (gs_char)i, GLYPH_SPACE_NAME);
- gs_const_string namestr;
-
- if (subset_glyphs && subset_size) {
- /*
- * Only write Encoding entries for glyphs in the
- * subset. Use binary search to check each glyph,
- * since subset_glyphs are sorted.
- */
- if (!psf_sorted_glyphs_include(subset_glyphs,
- subset_size, glyph))
- continue;
- }
- if (glyph != gs_no_glyph && glyph != notdef &&
- pfont->procs.glyph_name((gs_font *)pfont, glyph,
- &namestr) >= 0
- ) {
- pprintd1(s, "dup %d /", (int)i);
- stream_write(s, namestr.data, namestr.size);
- stream_puts(s, " put\n");
- }
- }
- stream_puts(s, "readonly");
- }
+ case ENCODING_INDEX_STANDARD:
+ stream_puts(s, "StandardEncoding");
+ break;
+ case ENCODING_INDEX_ISOLATIN1:
+ /* ATM only recognizes StandardEncoding. */
+ if (options & WRITE_TYPE1_POSTSCRIPT) {
+ stream_puts(s, "ISOLatin1Encoding");
+ break;
+ }
+ default:{
+ gs_char i;
+
+ stream_puts(s, "256 array\n");
+ stream_puts(s, "0 1 255 {1 index exch /.notdef put} for\n");
+ for (i = 0; i < 256; ++i) {
+ gs_glyph glyph =
+ (*pfont->procs.encode_char)
+ ((gs_font *)pfont, (gs_char)i, GLYPH_SPACE_NAME);
+ gs_const_string namestr;
+
+ if (subset_glyphs && subset_size) {
+ /*
+ * Only write Encoding entries for glyphs in the
+ * subset. Use binary search to check each glyph,
+ * since subset_glyphs are sorted.
+ */
+ if (!psf_sorted_glyphs_include(subset_glyphs,
+ subset_size, glyph))
+ continue;
+ }
+ if (glyph != gs_no_glyph && glyph != notdef &&
+ pfont->procs.glyph_name((gs_font *)pfont, glyph,
+ &namestr) >= 0
+ ) {
+ pprintd1(s, "dup %d /", (int)i);
+ stream_write(s, namestr.data, namestr.size);
+ stream_puts(s, " put\n");
+ }
+ }
+ stream_puts(s, "readonly");
+ }
}
stream_puts(s, " def\n");
return 0;
@@ -187,10 +187,10 @@ write_Encoding(stream *s, gs_font_type1 *pfont, int options,
*/
static int
write_Private(stream *s, gs_font_type1 *pfont,
- gs_glyph *subset_glyphs, uint subset_size,
- gs_glyph notdef, int lenIV,
- int (*write_CharString)(stream *, const void *, uint),
- const param_printer_params_t *ppp)
+ gs_glyph *subset_glyphs, uint subset_size,
+ gs_glyph notdef, int lenIV,
+ int (*write_CharString)(stream *, const void *, uint),
+ const param_printer_params_t *ppp)
{
const gs_type1_data *const pdata = &pfont->data;
printer_param_list_t rlist;
@@ -198,62 +198,62 @@ write_Private(stream *s, gs_font_type1 *pfont,
int code = s_init_param_printer(&rlist, ppp, s);
if (code < 0)
- return 0;
+ return 0;
stream_puts(s, "dup /Private 17 dict dup begin\n");
stream_puts(s, "/-|{string currentfile exch readstring pop}executeonly def\n");
stream_puts(s, "/|-{noaccess def}executeonly def\n");
stream_puts(s, "/|{noaccess put}executeonly def\n");
{
- static const gs_param_item_t private_items[] = {
- {"BlueFuzz", gs_param_type_int,
- offset_of(gs_type1_data, BlueFuzz)},
- {"BlueScale", gs_param_type_float,
- offset_of(gs_type1_data, BlueScale)},
- {"BlueShift", gs_param_type_float,
- offset_of(gs_type1_data, BlueShift)},
- {"ExpansionFactor", gs_param_type_float,
- offset_of(gs_type1_data, ExpansionFactor)},
- {"ForceBold", gs_param_type_bool,
- offset_of(gs_type1_data, ForceBold)},
- {"LanguageGroup", gs_param_type_int,
- offset_of(gs_type1_data, LanguageGroup)},
- {"RndStemUp", gs_param_type_bool,
- offset_of(gs_type1_data, RndStemUp)},
- gs_param_item_end
- };
- gs_type1_data defaults;
-
- defaults.BlueFuzz = 1;
- defaults.BlueScale = (float)0.039625;
- defaults.BlueShift = 7.0;
- defaults.ExpansionFactor = (float)0.06;
- defaults.ForceBold = false;
- defaults.LanguageGroup = 0;
- defaults.RndStemUp = true;
- code = gs_param_write_items(plist, pdata, &defaults, private_items);
- if (code < 0)
- return code;
- if (lenIV != 4) {
- code = param_write_int(plist, "lenIV", &lenIV);
- if (code < 0)
- return code;
- }
- write_float_array(plist, "BlueValues", pdata->BlueValues.values,
- pdata->BlueValues.count);
- write_float_array(plist, "OtherBlues", pdata->OtherBlues.values,
- pdata->OtherBlues.count);
- write_float_array(plist, "FamilyBlues", pdata->FamilyBlues.values,
- pdata->FamilyBlues.count);
- write_float_array(plist, "FamilyOtherBlues", pdata->FamilyOtherBlues.values,
- pdata->FamilyOtherBlues.count);
- write_float_array(plist, "StdHW", pdata->StdHW.values,
- pdata->StdHW.count);
- write_float_array(plist, "StdVW", pdata->StdVW.values,
- pdata->StdVW.count);
- write_float_array(plist, "StemSnapH", pdata->StemSnapH.values,
- pdata->StemSnapH.count);
- write_float_array(plist, "StemSnapV", pdata->StemSnapV.values,
- pdata->StemSnapV.count);
+ static const gs_param_item_t private_items[] = {
+ {"BlueFuzz", gs_param_type_int,
+ offset_of(gs_type1_data, BlueFuzz)},
+ {"BlueScale", gs_param_type_float,
+ offset_of(gs_type1_data, BlueScale)},
+ {"BlueShift", gs_param_type_float,
+ offset_of(gs_type1_data, BlueShift)},
+ {"ExpansionFactor", gs_param_type_float,
+ offset_of(gs_type1_data, ExpansionFactor)},
+ {"ForceBold", gs_param_type_bool,
+ offset_of(gs_type1_data, ForceBold)},
+ {"LanguageGroup", gs_param_type_int,
+ offset_of(gs_type1_data, LanguageGroup)},
+ {"RndStemUp", gs_param_type_bool,
+ offset_of(gs_type1_data, RndStemUp)},
+ gs_param_item_end
+ };
+ gs_type1_data defaults;
+
+ defaults.BlueFuzz = 1;
+ defaults.BlueScale = (float)0.039625;
+ defaults.BlueShift = 7.0;
+ defaults.ExpansionFactor = (float)0.06;
+ defaults.ForceBold = false;
+ defaults.LanguageGroup = 0;
+ defaults.RndStemUp = true;
+ code = gs_param_write_items(plist, pdata, &defaults, private_items);
+ if (code < 0)
+ return code;
+ if (lenIV != 4) {
+ code = param_write_int(plist, "lenIV", &lenIV);
+ if (code < 0)
+ return code;
+ }
+ write_float_array(plist, "BlueValues", pdata->BlueValues.values,
+ pdata->BlueValues.count);
+ write_float_array(plist, "OtherBlues", pdata->OtherBlues.values,
+ pdata->OtherBlues.count);
+ write_float_array(plist, "FamilyBlues", pdata->FamilyBlues.values,
+ pdata->FamilyBlues.count);
+ write_float_array(plist, "FamilyOtherBlues", pdata->FamilyOtherBlues.values,
+ pdata->FamilyOtherBlues.count);
+ write_float_array(plist, "StdHW", pdata->StdHW.values,
+ pdata->StdHW.count);
+ write_float_array(plist, "StdVW", pdata->StdVW.values,
+ pdata->StdVW.count);
+ write_float_array(plist, "StemSnapH", pdata->StemSnapH.values,
+ pdata->StemSnapH.count);
+ write_float_array(plist, "StemSnapV", pdata->StemSnapV.values,
+ pdata->StemSnapV.count);
}
write_uid(s, &pfont->UID);
stream_puts(s, "/MinFeature{16 16} def\n");
@@ -265,33 +265,33 @@ write_Private(stream *s, gs_font_type1 *pfont,
*/
{
- int n, i;
- gs_glyph_data_t gdata;
- int code;
-
- gdata.memory = pfont->memory;
- for (n = 0;
- (code = pdata->procs.subr_data(pfont, n, false, &gdata)) !=
- gs_error_rangecheck;
- ) {
- ++n;
- if (code >= 0)
- gs_glyph_data_free(&gdata, "write_Private(Subrs)");
- }
- pprintd1(s, "/Subrs %d array\n", n);
- for (i = 0; i < n; ++i)
- if ((code = pdata->procs.subr_data(pfont, i, false, &gdata)) >= 0) {
- char buf[50];
-
- if (gdata.bits.size) {
- sprintf(buf, "dup %d %u -| ", i, gdata.bits.size);
- stream_puts(s, buf);
- write_CharString(s, gdata.bits.data, gdata.bits.size);
- stream_puts(s, " |\n");
- }
- gs_glyph_data_free(&gdata, "write_Private(Subrs)");
- }
- stream_puts(s, "|-\n");
+ int n, i;
+ gs_glyph_data_t gdata;
+ int code;
+
+ gdata.memory = pfont->memory;
+ for (n = 0;
+ (code = pdata->procs.subr_data(pfont, n, false, &gdata)) !=
+ gs_error_rangecheck;
+ ) {
+ ++n;
+ if (code >= 0)
+ gs_glyph_data_free(&gdata, "write_Private(Subrs)");
+ }
+ pprintd1(s, "/Subrs %d array\n", n);
+ for (i = 0; i < n; ++i)
+ if ((code = pdata->procs.subr_data(pfont, i, false, &gdata)) >= 0) {
+ char buf[50];
+
+ if (gdata.bits.size) {
+ sprintf(buf, "dup %d %u -| ", i, gdata.bits.size);
+ stream_puts(s, buf);
+ write_CharString(s, gdata.bits.data, gdata.bits.size);
+ stream_puts(s, " |\n");
+ }
+ gs_glyph_data_free(&gdata, "write_Private(Subrs)");
+ }
+ stream_puts(s, "|-\n");
}
/* We don't write OtherSubrs -- there had better not be any! */
@@ -299,46 +299,46 @@ write_Private(stream *s, gs_font_type1 *pfont,
/* Write the CharStrings. */
{
- int num_chars = 0;
- gs_glyph glyph;
- psf_glyph_enum_t genum;
- gs_glyph_data_t gdata;
- int code;
-
- gdata.memory = pfont->memory;
- psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, subset_glyphs,
- (subset_glyphs ? subset_size : 0),
- GLYPH_SPACE_NAME);
- for (glyph = gs_no_glyph;
- (code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1;
- )
- if (code == 0 &&
- (code = pdata->procs.glyph_data(pfont, glyph, &gdata)) >= 0
- ) {
- ++num_chars;
- gs_glyph_data_free(&gdata, "write_Private(CharStrings)");
- }
- pprintd1(s, "2 index /CharStrings %d dict dup begin\n", num_chars);
- psf_enumerate_glyphs_reset(&genum);
- for (glyph = gs_no_glyph;
- (code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1;
- )
- if (code == 0 &&
- (code = pdata->procs.glyph_data(pfont, glyph, &gdata)) >= 0
- ) {
- gs_const_string gstr;
- int code;
-
- code = pfont->procs.glyph_name((gs_font *)pfont, glyph, &gstr);
- if (code < 0)
- return code;
- stream_puts(s, "/");
- stream_write(s, gstr.data, gstr.size);
- pprintd1(s, " %d -| ", gdata.bits.size);
- write_CharString(s, gdata.bits.data, gdata.bits.size);
- stream_puts(s, " |-\n");
- gs_glyph_data_free(&gdata, "write_Private(CharStrings)");
- }
+ int num_chars = 0;
+ gs_glyph glyph;
+ psf_glyph_enum_t genum;
+ gs_glyph_data_t gdata;
+ int code;
+
+ gdata.memory = pfont->memory;
+ psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, subset_glyphs,
+ (subset_glyphs ? subset_size : 0),
+ GLYPH_SPACE_NAME);
+ for (glyph = gs_no_glyph;
+ (code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1;
+ )
+ if (code == 0 &&
+ (code = pdata->procs.glyph_data(pfont, glyph, &gdata)) >= 0
+ ) {
+ ++num_chars;
+ gs_glyph_data_free(&gdata, "write_Private(CharStrings)");
+ }
+ pprintd1(s, "2 index /CharStrings %d dict dup begin\n", num_chars);
+ psf_enumerate_glyphs_reset(&genum);
+ for (glyph = gs_no_glyph;
+ (code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1;
+ )
+ if (code == 0 &&
+ (code = pdata->procs.glyph_data(pfont, glyph, &gdata)) >= 0
+ ) {
+ gs_const_string gstr;
+ int code;
+
+ code = pfont->procs.glyph_name((gs_font *)pfont, glyph, &gstr);
+ if (code < 0)
+ return code;
+ stream_puts(s, "/");
+ stream_write(s, gstr.data, gstr.size);
+ pprintd1(s, " %d -| ", gdata.bits.size);
+ write_CharString(s, gdata.bits.data, gdata.bits.size);
+ stream_puts(s, " |-\n");
+ gs_glyph_data_free(&gdata, "write_Private(CharStrings)");
+ }
}
/* Wrap up. */
@@ -359,9 +359,9 @@ stream_write_encrypted(stream *s, const void *ptr, uint count)
int code = 0;
for (left = count; left > 0; left -= n) {
- n = min(left, sizeof(buf));
- gs_type1_encrypt(buf, data + count - left, n, &state);
- code = stream_write(s, buf, n);
+ n = min(left, sizeof(buf));
+ gs_type1_encrypt(buf, data + count - left, n, &state);
+ code = stream_write(s, buf, n);
}
return code;
}
@@ -369,20 +369,20 @@ stream_write_encrypted(stream *s, const void *ptr, uint count)
/* Write one FontInfo entry. */
static void
write_font_info(stream *s, const char *key, const gs_const_string *pvalue,
- int do_write)
+ int do_write)
{
if (do_write) {
- pprints1(s, "\n/%s ", key);
- s_write_ps_string(s, pvalue->data, pvalue->size, PRINT_HEX_NOT_OK);
- stream_puts(s, " def");
+ pprints1(s, "\n/%s ", key);
+ s_write_ps_string(s, pvalue->data, pvalue->size, PRINT_HEX_NOT_OK);
+ stream_puts(s, " def");
}
}
/* Write the definition of a Type 1 font. */
int
psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
- gs_glyph *orig_subset_glyphs, uint orig_subset_size,
- const gs_const_string *alt_font_name, int lengths[3])
+ gs_glyph *orig_subset_glyphs, uint orig_subset_size,
+ const gs_const_string *alt_font_name, int lengths[3])
{
stream *es = s;
long start = stell(s);
@@ -399,21 +399,21 @@ psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
int lenIV = pfont->data.lenIV;
int (*write_CharString)(stream *, const void *, uint) = stream_write;
int code = psf_get_type1_glyphs(&glyphs, pfont, orig_subset_glyphs,
- orig_subset_size);
+ orig_subset_size);
if (code < 0)
- return code;
+ return code;
/* Initialize the parameter printer. */
ppp = param_printer_params_default;
ppp.item_suffix = " def\n";
ppp.print_ok =
- (options & WRITE_TYPE1_ASCIIHEX ? 0 : PRINT_BINARY_OK) |
- PRINT_HEX_NOT_OK;
+ (options & WRITE_TYPE1_ASCIIHEX ? 0 : PRINT_BINARY_OK) |
+ PRINT_HEX_NOT_OK;
code = s_init_param_printer(&rlist, &ppp, s);
if (code < 0)
- return code;
+ return code;
/* Write the font header. */
@@ -425,22 +425,22 @@ psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
stream_puts(s, "/FontInfo 5 dict dup begin");
{
- gs_font_info_t info;
- int code = pfont->procs.font_info((gs_font *)pfont, NULL,
- (FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
- FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
- &info);
-
- if (code >= 0) {
- write_font_info(s, "Copyright", &info.Copyright,
- info.members & FONT_INFO_COPYRIGHT);
- write_font_info(s, "Notice", &info.Notice,
- info.members & FONT_INFO_NOTICE);
- write_font_info(s, "FamilyName", &info.FamilyName,
- info.members & FONT_INFO_FAMILY_NAME);
- write_font_info(s, "FullName", &info.FullName,
- info.members & FONT_INFO_FULL_NAME);
- }
+ gs_font_info_t info;
+ int code = pfont->procs.font_info((gs_font *)pfont, NULL,
+ (FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
+ FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
+ &info);
+
+ if (code >= 0) {
+ write_font_info(s, "Copyright", &info.Copyright,
+ info.members & FONT_INFO_COPYRIGHT);
+ write_font_info(s, "Notice", &info.Notice,
+ info.members & FONT_INFO_NOTICE);
+ write_font_info(s, "FamilyName", &info.FamilyName,
+ info.members & FONT_INFO_FAMILY_NAME);
+ write_font_info(s, "FullName", &info.FullName,
+ info.members & FONT_INFO_FULL_NAME);
+ }
}
stream_puts(s, "\nend readonly def\n");
@@ -450,94 +450,94 @@ psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
write_font_name(s, pfont, alt_font_name, true);
stream_puts(s, " def\n");
code = write_Encoding(s, pfont, options, glyphs.subset_glyphs,
- glyphs.subset_size, glyphs.notdef);
+ glyphs.subset_size, glyphs.notdef);
if (code < 0)
- return code;
+ return code;
pprintg6(s, "/FontMatrix [%g %g %g %g %g %g] readonly def\n",
- pfont->FontMatrix.xx, pfont->FontMatrix.xy,
- pfont->FontMatrix.yx, pfont->FontMatrix.yy,
- pfont->FontMatrix.tx, pfont->FontMatrix.ty);
+ pfont->FontMatrix.xx, pfont->FontMatrix.xy,
+ pfont->FontMatrix.yx, pfont->FontMatrix.yy,
+ pfont->FontMatrix.tx, pfont->FontMatrix.ty);
write_uid(s, &pfont->UID);
pprintg4(s, "/FontBBox {%g %g %g %g} readonly def\n",
- pfont->FontBBox.p.x, pfont->FontBBox.p.y,
- pfont->FontBBox.q.x, pfont->FontBBox.q.y);
+ pfont->FontBBox.p.x, pfont->FontBBox.p.y,
+ pfont->FontBBox.q.x, pfont->FontBBox.q.y);
{
- static const gs_param_item_t font_items[] = {
- {"FontType", gs_param_type_int,
- offset_of(gs_font_type1, FontType)},
- {"PaintType", gs_param_type_int,
- offset_of(gs_font_type1, PaintType)},
- {"StrokeWidth", gs_param_type_float,
- offset_of(gs_font_type1, StrokeWidth)},
- gs_param_item_end
- };
-
- code = gs_param_write_items(plist, pfont, NULL, font_items);
- if (code < 0)
- return code;
+ static const gs_param_item_t font_items[] = {
+ {"FontType", gs_param_type_int,
+ offset_of(gs_font_type1, FontType)},
+ {"PaintType", gs_param_type_int,
+ offset_of(gs_font_type1, PaintType)},
+ {"StrokeWidth", gs_param_type_float,
+ offset_of(gs_font_type1, StrokeWidth)},
+ gs_param_item_end
+ };
+
+ code = gs_param_write_items(plist, pfont, NULL, font_items);
+ if (code < 0)
+ return code;
}
{
- const gs_type1_data *const pdata = &pfont->data;
+ const gs_type1_data *const pdata = &pfont->data;
- write_float_array(plist, "WeightVector", pdata->WeightVector.values,
- pdata->WeightVector.count);
+ write_float_array(plist, "WeightVector", pdata->WeightVector.values,
+ pdata->WeightVector.count);
}
stream_puts(s, "currentdict end\n");
/* Write the Private dictionary. */
if (lenIV < 0 && (options & WRITE_TYPE1_WITH_LENIV)) {
- /* We'll have to encrypt the CharStrings. */
- lenIV = 0;
- write_CharString = stream_write_encrypted;
+ /* We'll have to encrypt the CharStrings. */
+ lenIV = 0;
+ write_CharString = stream_write_encrypted;
}
if (options & WRITE_TYPE1_EEXEC) {
- stream_puts(s, "currentfile eexec\n");
- lengths[0] = stell(s) - start;
- start = stell(s);
- if (options & WRITE_TYPE1_ASCIIHEX) {
- s_init(&AXE_stream, s->memory);
- s_init_state((stream_state *)&AXE_state, &s_AXE_template, NULL);
- AXE_state.EndOfData = false;
- s_init_filter(&AXE_stream, (stream_state *)&AXE_state,
- AXE_buf, sizeof(AXE_buf), es);
- es = &AXE_stream;
- }
- s_init(&exE_stream, s->memory);
- s_init_state((stream_state *)&exE_state, &s_exE_template, NULL);
- exE_state.cstate = 55665;
- s_init_filter(&exE_stream, (stream_state *)&exE_state,
- exE_buf, sizeof(exE_buf), es);
- es = &exE_stream;
- /*
- * Note: eexec encryption always writes/skips 4 initial bytes, not
- * the number of initial bytes given by pdata->lenIV.
- */
- stream_puts(es, "****");
+ stream_puts(s, "currentfile eexec\n");
+ lengths[0] = stell(s) - start;
+ start = stell(s);
+ if (options & WRITE_TYPE1_ASCIIHEX) {
+ s_init(&AXE_stream, s->memory);
+ s_init_state((stream_state *)&AXE_state, &s_AXE_template, NULL);
+ AXE_state.EndOfData = false;
+ s_init_filter(&AXE_stream, (stream_state *)&AXE_state,
+ AXE_buf, sizeof(AXE_buf), es);
+ es = &AXE_stream;
+ }
+ s_init(&exE_stream, s->memory);
+ s_init_state((stream_state *)&exE_state, &s_exE_template, NULL);
+ exE_state.cstate = 55665;
+ s_init_filter(&exE_stream, (stream_state *)&exE_state,
+ exE_buf, sizeof(exE_buf), es);
+ es = &exE_stream;
+ /*
+ * Note: eexec encryption always writes/skips 4 initial bytes, not
+ * the number of initial bytes given by pdata->lenIV.
+ */
+ stream_puts(es, "****");
}
code = write_Private(es, pfont, glyphs.subset_glyphs, glyphs.subset_size,
- glyphs.notdef, lenIV, write_CharString, &ppp);
+ glyphs.notdef, lenIV, write_CharString, &ppp);
if (code < 0)
- return code;
+ return code;
stream_puts(es, "dup/FontName get exch definefont pop\n");
if (options & WRITE_TYPE1_EEXEC) {
- if (options & (WRITE_TYPE1_EEXEC_PAD | WRITE_TYPE1_EEXEC_MARK))
- stream_puts(es, "mark ");
- stream_puts(es, "currentfile closefile\n");
- s_close_filters(&es, s);
- lengths[1] = stell(s) - start;
- start = stell(s);
- if (options & WRITE_TYPE1_EEXEC_PAD) {
- int i;
-
- for (i = 0; i < 8; ++i)
- stream_puts(s, "\n0000000000000000000000000000000000000000000000000000000000000000");
- stream_puts(s, "\ncleartomark\n");
- }
- lengths[2] = stell(s) - start;
+ if (options & (WRITE_TYPE1_EEXEC_PAD | WRITE_TYPE1_EEXEC_MARK))
+ stream_puts(es, "mark ");
+ stream_puts(es, "currentfile closefile\n");
+ s_close_filters(&es, s);
+ lengths[1] = stell(s) - start;
+ start = stell(s);
+ if (options & WRITE_TYPE1_EEXEC_PAD) {
+ int i;
+
+ for (i = 0; i < 8; ++i)
+ stream_puts(s, "\n0000000000000000000000000000000000000000000000000000000000000000");
+ stream_puts(s, "\ncleartomark\n");
+ }
+ lengths[2] = stell(s) - start;
} else {
- lengths[0] = stell(s) - start;
- lengths[1] = lengths[2] = 0;
+ lengths[0] = stell(s) - start;
+ lengths[1] = lengths[2] = 0;
}
/* Wrap up. */
diff --git a/gs/base/gdevpsf2.c b/gs/base/gdevpsf2.c
index a11dd9086..c9b37f57a 100644
--- a/gs/base/gdevpsf2.c
+++ b/gs/base/gdevpsf2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,7 +78,7 @@ typedef struct cff_glyph_subset_s {
/* Initialize a string table. */
static void
cff_string_table_init(cff_string_table_t *pcst, cff_string_item_t *items,
- int size)
+ int size)
{
int reprobe = 17;
@@ -87,7 +87,7 @@ cff_string_table_init(cff_string_table_t *pcst, cff_string_item_t *items,
pcst->count = 0;
pcst->size = size;
while (reprobe != 1 && igcd(size, reprobe) != 1)
- reprobe = (reprobe * 2 + 1) % size;
+ reprobe = (reprobe * 2 + 1) % size;
pcst->total = 0;
pcst->reprobe = reprobe;
}
@@ -99,7 +99,7 @@ cff_string_add(cff_string_table_t *pcst, const byte *data, uint size)
int index;
if (pcst->count >= pcst->size)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
index = pcst->count++;
pcst->items[index].key.data = data;
pcst->items[index].key.size = size;
@@ -111,28 +111,28 @@ cff_string_add(cff_string_table_t *pcst, const byte *data, uint size)
/* Return 1 if the string was added. */
static int
cff_string_index(cff_string_table_t *pcst, const byte *data, uint size,
- bool enter, int *pindex)
+ bool enter, int *pindex)
{
/****** FAILS IF TABLE FULL AND KEY MISSING ******/
int j = (size == 0 ? 0 : data[0] * 23 + data[size - 1] * 59 + size);
int index, c = 0;
while ((index = pcst->items[j %= pcst->size].index1) != 0) {
- --index;
- if (!bytes_compare(pcst->items[index].key.data,
- pcst->items[index].key.size, data, size)) {
- *pindex = index;
- return 0;
- }
- j += pcst->reprobe;
- if (++c >= pcst->size)
- break;
+ --index;
+ if (!bytes_compare(pcst->items[index].key.data,
+ pcst->items[index].key.size, data, size)) {
+ *pindex = index;
+ return 0;
+ }
+ j += pcst->reprobe;
+ if (++c >= pcst->size)
+ break;
}
if (!enter)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
index = cff_string_add(pcst, data, size);
if (index < 0)
- return index;
+ return index;
pcst->items[j].index1 = index + 1;
*pindex = index;
return 1;
@@ -146,10 +146,10 @@ cff_string_sid(cff_writer_t *pcw, const byte *data, uint size)
int code = cff_string_index(&pcw->std_strings, data, size, false, &index);
if (code < 0) {
- code = cff_string_index(&pcw->strings, data, size, true, &index);
- if (code < 0)
- return code;
- index += NUM_STD_STRINGS;
+ code = cff_string_index(&pcw->strings, data, size, true, &index);
+ if (code < 0)
+ return code;
+ index += NUM_STD_STRINGS;
}
return index;
}
@@ -158,10 +158,10 @@ cff_glyph_sid(cff_writer_t *pcw, gs_glyph glyph)
{
gs_const_string str;
int code =
- pcw->pfont->procs.glyph_name((gs_font *)pcw->pfont, glyph, &str);
+ pcw->pfont->procs.glyph_name((gs_font *)pcw->pfont, glyph, &str);
if (code < 0)
- return code;
+ return code;
return cff_string_sid(pcw, str.data, str.size);
}
@@ -179,7 +179,7 @@ offset_size(uint offset)
int size = 1;
while (offset > 255)
- offset >>= 8, ++size;
+ offset >>= 8, ++size;
return size;
}
static void
@@ -188,7 +188,7 @@ put_offset(cff_writer_t *pcw, int offset)
int i;
for (i = pcw->offset_size - 1; i >= 0; --i)
- sputc(pcw->strm, (byte)(offset >> (i * 8)));
+ sputc(pcw->strm, (byte)(offset >> (i * 8)));
}
static int
put_bytes(stream * s, const byte *ptr, uint count)
@@ -213,10 +213,10 @@ static void
cff_put_op(cff_writer_t *pcw, int op)
{
if (op >= CE_OFFSET) {
- sputc(pcw->strm, cx_escape);
- sputc(pcw->strm, (byte)(op - CE_OFFSET));
+ sputc(pcw->strm, cx_escape);
+ sputc(pcw->strm, (byte)(op - CE_OFFSET));
} else
- sputc(pcw->strm, (byte)op);
+ sputc(pcw->strm, (byte)op);
}
static void
cff_put_int(cff_writer_t *pcw, int i)
@@ -224,18 +224,18 @@ cff_put_int(cff_writer_t *pcw, int i)
stream *s = pcw->strm;
if (i >= -107 && i <= 107)
- sputc(s, (byte)(i + 139));
+ sputc(s, (byte)(i + 139));
else if (i <= 1131 && i >= 0)
- put_card16(pcw, (c_pos2_0 << 8) + i - 108);
+ put_card16(pcw, (c_pos2_0 << 8) + i - 108);
else if (i >= -1131 && i < 0)
- put_card16(pcw, (c_neg2_0 << 8) - i - 108);
+ put_card16(pcw, (c_neg2_0 << 8) - i - 108);
else if (i >= -32768 && i <= 32767) {
- sputc(s, c2_shortint);
- put_card16(pcw, i & 0xffff);
+ sputc(s, c2_shortint);
+ put_card16(pcw, i & 0xffff);
} else {
- sputc(s, CD_LONGINT);
- put_card16(pcw, i >> 16);
- put_card16(pcw, i & 0xffff);
+ sputc(s, CD_LONGINT);
+ put_card16(pcw, i >> 16);
+ put_card16(pcw, i & 0xffff);
}
}
static void
@@ -248,7 +248,7 @@ static void
cff_put_int_if_ne(cff_writer_t *pcw, int i, int i_default, int op)
{
if (i != i_default)
- cff_put_int_value(pcw, i, op);
+ cff_put_int_value(pcw, i, op);
}
static void
cff_put_bool(cff_writer_t *pcw, bool b)
@@ -265,50 +265,50 @@ static void
cff_put_real(cff_writer_t *pcw, floatp f)
{
if (f == (int)f)
- cff_put_int(pcw, (int)f);
+ cff_put_int(pcw, (int)f);
else {
- /* Use decimal representation. */
- char str[50];
- byte b = 0xff;
- const char *p;
-
- sprintf(str, "%g", f);
- sputc(pcw->strm, CD_REAL);
- for (p = str; ; ++p) {
- int digit;
-
- switch (*p) {
- case 0:
- goto done;
- case '.':
- digit = 0xa; break;
- case '+':
+ /* Use decimal representation. */
+ char str[50];
+ byte b = 0xff;
+ const char *p;
+
+ sprintf(str, "%g", f);
+ sputc(pcw->strm, CD_REAL);
+ for (p = str; ; ++p) {
+ int digit;
+
+ switch (*p) {
+ case 0:
+ goto done;
+ case '.':
+ digit = 0xa; break;
+ case '+':
continue;
case '-':
- digit = 0xe; break;
- case 'e': case 'E':
- if (p[1] == '-')
- digit = 0xc, ++p;
- else
- digit = 0xb;
- break;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- digit = *p - '0';
- break;
- default: /* can't happen */
- digit = 0xd; /* invalid */
- break;
- }
- if (b == 0xff)
- b = (digit << 4) + 0xf;
- else {
- sputc(pcw->strm, (byte)((b & 0xf0) + digit));
- b = 0xff;
- }
- }
+ digit = 0xe; break;
+ case 'e': case 'E':
+ if (p[1] == '-')
+ digit = 0xc, ++p;
+ else
+ digit = 0xb;
+ break;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ digit = *p - '0';
+ break;
+ default: /* can't happen */
+ digit = 0xd; /* invalid */
+ break;
+ }
+ if (b == 0xff)
+ b = (digit << 4) + 0xf;
+ else {
+ sputc(pcw->strm, (byte)((b & 0xf0) + digit));
+ b = 0xff;
+ }
+ }
done:
- sputc(pcw->strm, b);
+ sputc(pcw->strm, b);
}
}
static void
@@ -321,7 +321,7 @@ static void
cff_put_real_if_ne(cff_writer_t *pcw, floatp f, floatp f_default, int op)
{
if ((float)f != (float)f_default)
- cff_put_real_value(pcw, f, op);
+ cff_put_real_value(pcw, f, op);
}
static void
cff_put_real_deltarray(cff_writer_t *pcw, const float *pf, int count, int op)
@@ -330,12 +330,12 @@ cff_put_real_deltarray(cff_writer_t *pcw, const float *pf, int count, int op)
int i;
if (count <= 0)
- return;
+ return;
for (i = 0; i < count; ++i) {
- float f = pf[i];
+ float f = pf[i];
- cff_put_real(pcw, f - prev);
- prev = f;
+ cff_put_real(pcw, f - prev);
+ prev = f;
}
cff_put_op(pcw, op);
}
@@ -345,7 +345,7 @@ cff_put_string(cff_writer_t *pcw, const byte *data, uint size)
int sid = cff_string_sid(pcw, data, size);
if (sid < 0)
- return sid;
+ return sid;
cff_put_int(pcw, sid);
return 0;
}
@@ -355,54 +355,54 @@ cff_put_string_value(cff_writer_t *pcw, const byte *data, uint size, int op)
int code = cff_put_string(pcw, data, size);
if (code >= 0)
- cff_put_op(pcw, op);
+ cff_put_op(pcw, op);
return code;
}
static int
cff_extra_lenIV(const cff_writer_t *pcw, const gs_font_type1 *pfont)
{
return (pcw->options & WRITE_TYPE2_NO_LENIV ?
- max(pfont->data.lenIV, 0) : 0);
+ max(pfont->data.lenIV, 0) : 0);
}
static bool
cff_convert_charstrings(const cff_writer_t *pcw, const gs_font_base *pfont)
{
return (pfont->FontType != ft_encrypted2 &&
- (pcw->options & WRITE_TYPE2_CHARSTRINGS) != 0);
+ (pcw->options & WRITE_TYPE2_CHARSTRINGS) != 0);
}
static int
cff_put_CharString(cff_writer_t *pcw, const byte *data, uint size,
- gs_font_type1 *pfont)
+ gs_font_type1 *pfont)
{
int lenIV = pfont->data.lenIV;
stream *s = pcw->strm;
if (cff_convert_charstrings(pcw, (gs_font_base *)pfont)) {
- gs_glyph_data_t gdata;
- int code;
-
- gdata.memory = pfont->memory;
- gs_glyph_data_from_string(&gdata, data, size, NULL);
- code = psf_convert_type1_to_type2(s, &gdata, pfont);
- if (code < 0)
- return code;
+ gs_glyph_data_t gdata;
+ int code;
+
+ gdata.memory = pfont->memory;
+ gs_glyph_data_from_string(&gdata, data, size, NULL);
+ code = psf_convert_type1_to_type2(s, &gdata, pfont);
+ if (code < 0)
+ return code;
} else if (lenIV < 0 || !(pcw->options & WRITE_TYPE2_NO_LENIV))
- put_bytes(s, data, size);
+ put_bytes(s, data, size);
else if (size >= lenIV) {
- /* Remove encryption. */
- crypt_state state = crypt_charstring_seed;
- byte buf[50]; /* arbitrary */
- uint left, n;
-
- for (left = lenIV; left > 0; left -= n) {
- n = min(left, sizeof(buf));
- gs_type1_decrypt(buf, data + lenIV - left, n, &state);
- }
- for (left = size - lenIV; left > 0; left -= n) {
- n = min(left, sizeof(buf));
- gs_type1_decrypt(buf, data + size - left, n, &state);
- put_bytes(s, buf, n);
- }
+ /* Remove encryption. */
+ crypt_state state = crypt_charstring_seed;
+ byte buf[50]; /* arbitrary */
+ uint left, n;
+
+ for (left = lenIV; left > 0; left -= n) {
+ n = min(left, sizeof(buf));
+ gs_type1_decrypt(buf, data + lenIV - left, n, &state);
+ }
+ for (left = size - lenIV; left > 0; left -= n) {
+ n = min(left, sizeof(buf));
+ gs_type1_decrypt(buf, data + size - left, n, &state);
+ put_bytes(s, buf, n);
+ }
}
return 0;
}
@@ -410,16 +410,16 @@ static uint
cff_Index_size(uint count, uint total)
{
return (count == 0 ? 2 :
- 3 + offset_size(total + 1) * (count + 1) + total);
+ 3 + offset_size(total + 1) * (count + 1) + total);
}
static void
cff_put_Index_header(cff_writer_t *pcw, uint count, uint total)
{
put_card16(pcw, count);
if (count > 0) {
- pcw->offset_size = offset_size(total + 1);
- sputc(pcw->strm, (byte)pcw->offset_size);
- put_offset(pcw, 1);
+ pcw->offset_size = offset_size(total + 1);
+ sputc(pcw->strm, (byte)pcw->offset_size);
+ put_offset(pcw, 1);
}
}
static void
@@ -428,16 +428,16 @@ cff_put_Index(cff_writer_t *pcw, const cff_string_table_t *pcst)
uint j, offset;
if (pcst->count == 0) {
- put_card16(pcw, 0);
- return;
+ put_card16(pcw, 0);
+ return;
}
cff_put_Index_header(pcw, pcst->count, pcst->total);
for (j = 0, offset = 1; j < pcst->count; ++j) {
- offset += pcst->items[j].key.size;
- put_offset(pcw, offset);
+ offset += pcst->items[j].key.size;
+ put_offset(pcw, offset);
}
for (j = 0; j < pcst->count; ++j)
- put_bytes(pcw->strm, pcst->items[j].key.data, pcst->items[j].key.size);
+ put_bytes(pcw->strm, pcst->items[j].key.data, pcst->items[j].key.size);
}
/* ---------------- Main code ---------------- */
@@ -514,7 +514,7 @@ typedef enum {
static int
cff_get_Top_info_common(cff_writer_t *pcw, gs_font_base *pbfont,
- bool full_info, gs_font_info_t *pinfo)
+ bool full_info, gs_font_info_t *pinfo)
{
pinfo->Flags_requested = FONT_IS_FIXED_WIDTH;
/* Preset defaults */
@@ -524,18 +524,18 @@ cff_get_Top_info_common(cff_writer_t *pcw, gs_font_base *pbfont,
pinfo->UnderlinePosition = UnderlinePosition_DEFAULT;
pinfo->UnderlineThickness = UnderlineThickness_DEFAULT;
return pbfont->procs.font_info
- ((gs_font *)pbfont, NULL,
- (full_info ?
- FONT_INFO_FLAGS | FONT_INFO_ITALIC_ANGLE |
- FONT_INFO_UNDERLINE_POSITION |
- FONT_INFO_UNDERLINE_THICKNESS : 0) |
- (FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
- FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
- pinfo);
+ ((gs_font *)pbfont, NULL,
+ (full_info ?
+ FONT_INFO_FLAGS | FONT_INFO_ITALIC_ANGLE |
+ FONT_INFO_UNDERLINE_POSITION |
+ FONT_INFO_UNDERLINE_THICKNESS : 0) |
+ (FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
+ FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
+ pinfo);
}
static void
cff_write_Top_common(cff_writer_t *pcw, gs_font_base *pbfont,
- bool write_FontMatrix, const gs_font_info_t *pinfo)
+ bool write_FontMatrix, const gs_font_info_t *pinfo)
{
/*
* The Adobe documentation doesn't make it at all clear that if the
@@ -547,87 +547,87 @@ cff_write_Top_common(cff_writer_t *pcw, gs_font_base *pbfont,
*/
/* (version) */
if (pinfo->members & FONT_INFO_NOTICE)
- cff_put_string_value(pcw, pinfo->Notice.data, pinfo->Notice.size,
- TOP_Notice);
+ cff_put_string_value(pcw, pinfo->Notice.data, pinfo->Notice.size,
+ TOP_Notice);
if (pinfo->members & FONT_INFO_FULL_NAME)
- cff_put_string_value(pcw, pinfo->FullName.data, pinfo->FullName.size,
- TOP_FullName);
+ cff_put_string_value(pcw, pinfo->FullName.data, pinfo->FullName.size,
+ TOP_FullName);
if (pinfo->members & FONT_INFO_FAMILY_NAME)
- cff_put_string_value(pcw, pinfo->FamilyName.data,
- pinfo->FamilyName.size, TOP_FamilyName);
+ cff_put_string_value(pcw, pinfo->FamilyName.data,
+ pinfo->FamilyName.size, TOP_FamilyName);
if (pcw->FontBBox.p.x != 0 || pcw->FontBBox.p.y != 0 ||
- pcw->FontBBox.q.x != 0 || pcw->FontBBox.q.y != 0
- ) {
- /* An omitted FontBBox is equivalent to an empty one. */
- /*
- * Since Acrobat Reader 4 on Solaris doesn't like
- * an omitted FontBBox, we copy it here from
- * the font descriptor, because the base font
- * is allowed to omit it's FontBBox.
- */
- cff_put_real(pcw, pcw->FontBBox.p.x);
- cff_put_real(pcw, pcw->FontBBox.p.y);
- cff_put_real(pcw, pcw->FontBBox.q.x);
- cff_put_real(pcw, pcw->FontBBox.q.y);
- cff_put_op(pcw, TOP_FontBBox);
+ pcw->FontBBox.q.x != 0 || pcw->FontBBox.q.y != 0
+ ) {
+ /* An omitted FontBBox is equivalent to an empty one. */
+ /*
+ * Since Acrobat Reader 4 on Solaris doesn't like
+ * an omitted FontBBox, we copy it here from
+ * the font descriptor, because the base font
+ * is allowed to omit it's FontBBox.
+ */
+ cff_put_real(pcw, pcw->FontBBox.p.x);
+ cff_put_real(pcw, pcw->FontBBox.p.y);
+ cff_put_real(pcw, pcw->FontBBox.q.x);
+ cff_put_real(pcw, pcw->FontBBox.q.y);
+ cff_put_op(pcw, TOP_FontBBox);
}
if (uid_is_UniqueID(&pbfont->UID))
- cff_put_int_value(pcw, pbfont->UID.id, TOP_UniqueID);
+ cff_put_int_value(pcw, pbfont->UID.id, TOP_UniqueID);
else if (uid_is_XUID(&pbfont->UID)) {
- int j;
+ int j;
- for (j = 0; j < uid_XUID_size(&pbfont->UID); ++j)
- cff_put_int(pcw, uid_XUID_values(&pbfont->UID)[j]);
- cff_put_op(pcw, TOP_XUID);
+ for (j = 0; j < uid_XUID_size(&pbfont->UID); ++j)
+ cff_put_int(pcw, uid_XUID_values(&pbfont->UID)[j]);
+ cff_put_op(pcw, TOP_XUID);
}
/*
* Acrobat Reader 3 gives an error if a CFF font includes any of the
* following opcodes.
*/
if (!(pcw->options & WRITE_TYPE2_AR3)) {
- if (pinfo->members & FONT_INFO_COPYRIGHT)
- cff_put_string_value(pcw, pinfo->Copyright.data,
- pinfo->Copyright.size, TOP_Copyright);
- if (pinfo->Flags & pinfo->Flags_returned & FONT_IS_FIXED_WIDTH)
- cff_put_bool_value(pcw, true, TOP_isFixedPitch);
- cff_put_real_if_ne(pcw, pinfo->ItalicAngle, ItalicAngle_DEFAULT,
- TOP_ItalicAngle);
- cff_put_int_if_ne(pcw, pinfo->UnderlinePosition,
- UnderlinePosition_DEFAULT, TOP_UnderlinePosition);
- cff_put_int_if_ne(pcw, pinfo->UnderlineThickness,
- UnderlineThickness_DEFAULT, TOP_UnderlineThickness);
- cff_put_int_if_ne(pcw, pbfont->PaintType, PaintType_DEFAULT,
- TOP_PaintType);
+ if (pinfo->members & FONT_INFO_COPYRIGHT)
+ cff_put_string_value(pcw, pinfo->Copyright.data,
+ pinfo->Copyright.size, TOP_Copyright);
+ if (pinfo->Flags & pinfo->Flags_returned & FONT_IS_FIXED_WIDTH)
+ cff_put_bool_value(pcw, true, TOP_isFixedPitch);
+ cff_put_real_if_ne(pcw, pinfo->ItalicAngle, ItalicAngle_DEFAULT,
+ TOP_ItalicAngle);
+ cff_put_int_if_ne(pcw, pinfo->UnderlinePosition,
+ UnderlinePosition_DEFAULT, TOP_UnderlinePosition);
+ cff_put_int_if_ne(pcw, pinfo->UnderlineThickness,
+ UnderlineThickness_DEFAULT, TOP_UnderlineThickness);
+ cff_put_int_if_ne(pcw, pbfont->PaintType, PaintType_DEFAULT,
+ TOP_PaintType);
}
{
- static const gs_matrix fm_default = {
- constant_matrix_body(0.001, 0, 0, 0.001, 0, 0)
- };
-
- if (write_FontMatrix ||
- pbfont->FontMatrix.xx != fm_default.xx ||
- pbfont->FontMatrix.xy != 0 || pbfont->FontMatrix.yx != 0 ||
- pbfont->FontMatrix.yy != fm_default.yy ||
- pbfont->FontMatrix.tx != 0 || pbfont->FontMatrix.ty != 0
- ) {
- cff_put_real(pcw, pbfont->FontMatrix.xx);
- cff_put_real(pcw, pbfont->FontMatrix.xy);
- cff_put_real(pcw, pbfont->FontMatrix.yx);
- cff_put_real(pcw, pbfont->FontMatrix.yy);
- cff_put_real(pcw, pbfont->FontMatrix.tx);
- cff_put_real(pcw, pbfont->FontMatrix.ty);
- cff_put_op(pcw, TOP_FontMatrix);
- }
+ static const gs_matrix fm_default = {
+ constant_matrix_body(0.001, 0, 0, 0.001, 0, 0)
+ };
+
+ if (write_FontMatrix ||
+ pbfont->FontMatrix.xx != fm_default.xx ||
+ pbfont->FontMatrix.xy != 0 || pbfont->FontMatrix.yx != 0 ||
+ pbfont->FontMatrix.yy != fm_default.yy ||
+ pbfont->FontMatrix.tx != 0 || pbfont->FontMatrix.ty != 0
+ ) {
+ cff_put_real(pcw, pbfont->FontMatrix.xx);
+ cff_put_real(pcw, pbfont->FontMatrix.xy);
+ cff_put_real(pcw, pbfont->FontMatrix.yx);
+ cff_put_real(pcw, pbfont->FontMatrix.yy);
+ cff_put_real(pcw, pbfont->FontMatrix.tx);
+ cff_put_real(pcw, pbfont->FontMatrix.ty);
+ cff_put_op(pcw, TOP_FontMatrix);
+ }
}
cff_put_real_if_ne(pcw, pbfont->StrokeWidth, StrokeWidth_DEFAULT,
- TOP_StrokeWidth);
+ TOP_StrokeWidth);
}
/* Type 1 or Type 2 font */
static void
cff_write_Top_font(cff_writer_t *pcw, uint Encoding_offset,
- uint charset_offset, uint CharStrings_offset,
- uint Private_offset, uint Private_size)
+ uint charset_offset, uint CharStrings_offset,
+ uint Private_offset, uint Private_size)
{
gs_font_base *pbfont = (gs_font_base *)pcw->pfont;
gs_font_info_t info;
@@ -640,11 +640,11 @@ cff_write_Top_font(cff_writer_t *pcw, uint Encoding_offset,
cff_put_int_if_ne(pcw, charset_offset, charset_DEFAULT, TOP_charset);
cff_put_int_if_ne(pcw, Encoding_offset, Encoding_DEFAULT, TOP_Encoding);
{
- int type = (pcw->options & WRITE_TYPE2_CHARSTRINGS ? 2 :
- pbfont->FontType == ft_encrypted2 ? 2 : 1);
+ int type = (pcw->options & WRITE_TYPE2_CHARSTRINGS ? 2 :
+ pbfont->FontType == ft_encrypted2 ? 2 : 1);
- cff_put_int_if_ne(pcw, type, CharstringType_DEFAULT,
- TOP_CharstringType);
+ cff_put_int_if_ne(pcw, type, CharstringType_DEFAULT,
+ TOP_CharstringType);
}
}
@@ -658,8 +658,8 @@ cff_write_ROS(cff_writer_t *pcw, const gs_cid_system_info_t *pcidsi)
}
static void
cff_write_Top_cidfont(cff_writer_t *pcw, uint charset_offset,
- uint CharStrings_offset, uint FDSelect_offset,
- uint Font_offset, const gs_font_info_t *pinfo)
+ uint CharStrings_offset, uint FDSelect_offset,
+ uint Font_offset, const gs_font_info_t *pinfo)
{
gs_font_base *pbfont = (gs_font_base *)pcw->pfont;
gs_font_cid0 *pfont = (gs_font_cid0 *)pbfont;
@@ -673,7 +673,7 @@ cff_write_Top_cidfont(cff_writer_t *pcw, uint charset_offset,
* so we don't currently write them. CIDFontType is always 0.
*/
cff_put_int_if_ne(pcw, pfont->cidata.common.CIDCount, CIDCount_DEFAULT,
- TOP_CIDCount);
+ TOP_CIDCount);
/* We don't use UIDBase. */
cff_put_int_value(pcw, Font_offset, TOP_FDArray);
cff_put_int_value(pcw, FDSelect_offset, TOP_FDSelect);
@@ -682,20 +682,20 @@ cff_write_Top_cidfont(cff_writer_t *pcw, uint charset_offset,
/* FDArray Index for CIDFont (offsets only) */
static void
cff_write_FDArray_offsets(cff_writer_t *pcw, uint *FDArray_offsets,
- int num_fonts)
+ int num_fonts)
{
int j;
cff_put_Index_header(pcw, num_fonts,
- FDArray_offsets[num_fonts] - FDArray_offsets[0]);
+ FDArray_offsets[num_fonts] - FDArray_offsets[0]);
for (j = 1; j <= num_fonts; ++j)
- put_offset(pcw, FDArray_offsets[j] - FDArray_offsets[0] + 1);
+ put_offset(pcw, FDArray_offsets[j] - FDArray_offsets[0] + 1);
}
/* FDArray entry for CIDFont */
static void
cff_write_Top_fdarray(cff_writer_t *pcw, gs_font_base *pbfont,
- uint Private_offset, uint Private_size)
+ uint Private_offset, uint Private_size)
{
const gs_font_name *pfname = &pbfont->font_name;
gs_font_info_t info;
@@ -705,10 +705,10 @@ cff_write_Top_fdarray(cff_writer_t *pcw, gs_font_base *pbfont,
cff_put_int(pcw, Private_size);
cff_put_int_value(pcw, Private_offset, TOP_Private);
if (pfname->size == 0)
- pfname = &pbfont->key_name;
+ pfname = &pbfont->key_name;
if (pfname->size) {
- cff_put_string(pcw, pfname->chars, pfname->size);
- cff_put_op(pcw, TOP_FontName);
+ cff_put_string(pcw, pfname->chars, pfname->size);
+ cff_put_op(pcw, TOP_FontName);
}
}
@@ -753,52 +753,52 @@ const long default_defaultWidthX = defaultWidthX_DEFAULT; /* For gdevpsfx.c */
static void
cff_write_Private(cff_writer_t *pcw, uint Subrs_offset,
- const gs_font_type1 *pfont)
+ const gs_font_type1 *pfont)
{
#define PUT_FLOAT_TABLE(member, op)\
cff_put_real_deltarray(pcw, pfont->data.member.values,\
- pfont->data.member.count, op)
-
+ pfont->data.member.count, op)
+
PUT_FLOAT_TABLE(BlueValues, PRIVATE_BlueValues);
PUT_FLOAT_TABLE(OtherBlues, PRIVATE_OtherBlues);
PUT_FLOAT_TABLE(FamilyBlues, PRIVATE_FamilyBlues);
PUT_FLOAT_TABLE(FamilyOtherBlues, PRIVATE_FamilyOtherBlues);
if (pfont->data.StdHW.count > 0)
- cff_put_real_value(pcw, pfont->data.StdHW.values[0], PRIVATE_StdHW);
+ cff_put_real_value(pcw, pfont->data.StdHW.values[0], PRIVATE_StdHW);
if (pfont->data.StdVW.count > 0)
- cff_put_real_value(pcw, pfont->data.StdVW.values[0], PRIVATE_StdVW);
+ cff_put_real_value(pcw, pfont->data.StdVW.values[0], PRIVATE_StdVW);
if (Subrs_offset)
- cff_put_int_value(pcw, Subrs_offset, PRIVATE_Subrs);
+ cff_put_int_value(pcw, Subrs_offset, PRIVATE_Subrs);
if (pfont->FontType != ft_encrypted) {
- if (pfont->data.defaultWidthX != defaultWidthX_DEFAULT)
- cff_put_real_value(pcw, fixed2float(pfont->data.defaultWidthX),
- PRIVATE_defaultWidthX);
- if (pfont->data.nominalWidthX != nominalWidthX_DEFAULT)
- cff_put_real_value(pcw, fixed2float(pfont->data.nominalWidthX),
- PRIVATE_nominalWidthX);
- cff_put_int_if_ne(pcw, pfont->data.initialRandomSeed,
- initialRandomSeed_DEFAULT,
- PRIVATE_initialRandomSeed);
+ if (pfont->data.defaultWidthX != defaultWidthX_DEFAULT)
+ cff_put_real_value(pcw, fixed2float(pfont->data.defaultWidthX),
+ PRIVATE_defaultWidthX);
+ if (pfont->data.nominalWidthX != nominalWidthX_DEFAULT)
+ cff_put_real_value(pcw, fixed2float(pfont->data.nominalWidthX),
+ PRIVATE_nominalWidthX);
+ cff_put_int_if_ne(pcw, pfont->data.initialRandomSeed,
+ initialRandomSeed_DEFAULT,
+ PRIVATE_initialRandomSeed);
}
cff_put_real_if_ne(pcw, pfont->data.BlueScale, BlueScale_DEFAULT,
- PRIVATE_BlueScale);
+ PRIVATE_BlueScale);
cff_put_real_if_ne(pcw, pfont->data.BlueShift, BlueShift_DEFAULT,
- PRIVATE_BlueShift);
+ PRIVATE_BlueShift);
cff_put_int_if_ne(pcw, pfont->data.BlueFuzz, BlueFuzz_DEFAULT,
- PRIVATE_BlueFuzz);
+ PRIVATE_BlueFuzz);
PUT_FLOAT_TABLE(StemSnapH, PRIVATE_StemSnapH);
PUT_FLOAT_TABLE(StemSnapV, PRIVATE_StemSnapV);
if (pfont->data.ForceBold != ForceBold_DEFAULT)
- cff_put_bool_value(pcw, pfont->data.ForceBold,
- PRIVATE_ForceBold);
+ cff_put_bool_value(pcw, pfont->data.ForceBold,
+ PRIVATE_ForceBold);
/* (ForceBoldThreshold) */
if (!(pcw->options & WRITE_TYPE2_NO_LENIV))
- cff_put_int_if_ne(pcw, pfont->data.lenIV, lenIV_DEFAULT,
- PRIVATE_lenIV);
+ cff_put_int_if_ne(pcw, pfont->data.lenIV, lenIV_DEFAULT,
+ PRIVATE_lenIV);
cff_put_int_if_ne(pcw, pfont->data.LanguageGroup, LanguageGroup_DEFAULT,
- PRIVATE_LanguageGroup);
+ PRIVATE_LanguageGroup);
cff_put_real_if_ne(pcw, pfont->data.ExpansionFactor,
- ExpansionFactor_DEFAULT, PRIVATE_ExpansionFactor);
+ ExpansionFactor_DEFAULT, PRIVATE_ExpansionFactor);
/* initialRandomSeed was handled above */
#undef PUT_FLOAT_TABLE
@@ -809,7 +809,7 @@ cff_write_Private(cff_writer_t *pcw, uint Subrs_offset,
/* These are separate procedures only for readability. */
static int
cff_write_CharStrings_offsets(cff_writer_t *pcw, psf_glyph_enum_t *penum,
- uint *pcount)
+ uint *pcount)
{
gs_font_base *pfont = pcw->pfont;
int offset;
@@ -821,38 +821,38 @@ cff_write_CharStrings_offsets(cff_writer_t *pcw, psf_glyph_enum_t *penum,
s_init(&poss, NULL);
psf_enumerate_glyphs_reset(penum);
for (glyph = gs_no_glyph, count = 0, offset = 1;
- (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
- ++count) {
- gs_glyph_data_t gdata;
- gs_font_type1 *pfd;
- int gcode;
-
- gdata.memory = pfont->memory;
- if (code == 0 &&
- (gcode = pcw->glyph_data(pfont, glyph, &gdata, &pfd)) >= 0
- ) {
- int extra_lenIV;
-
- if (gdata.bits.size >= (extra_lenIV = cff_extra_lenIV(pcw, pfd))) {
- if (cff_convert_charstrings(pcw, (gs_font_base *)pfd)) {
- swrite_position_only(&poss);
- code = psf_convert_type1_to_type2(&poss, &gdata, pfd);
- if (code < 0)
- return code;
- offset += stell(&poss);
- } else
- offset += gdata.bits.size - extra_lenIV;
- }
- gs_glyph_data_free(&gdata, "cff_write_CharStrings_offsets");
- }
- put_offset(pcw, offset);
+ (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
+ ++count) {
+ gs_glyph_data_t gdata;
+ gs_font_type1 *pfd;
+ int gcode;
+
+ gdata.memory = pfont->memory;
+ if (code == 0 &&
+ (gcode = pcw->glyph_data(pfont, glyph, &gdata, &pfd)) >= 0
+ ) {
+ int extra_lenIV;
+
+ if (gdata.bits.size >= (extra_lenIV = cff_extra_lenIV(pcw, pfd))) {
+ if (cff_convert_charstrings(pcw, (gs_font_base *)pfd)) {
+ swrite_position_only(&poss);
+ code = psf_convert_type1_to_type2(&poss, &gdata, pfd);
+ if (code < 0)
+ return code;
+ offset += stell(&poss);
+ } else
+ offset += gdata.bits.size - extra_lenIV;
+ }
+ gs_glyph_data_free(&gdata, "cff_write_CharStrings_offsets");
+ }
+ put_offset(pcw, offset);
}
*pcount = count;
return offset - 1;
}
static void
cff_write_CharStrings(cff_writer_t *pcw, psf_glyph_enum_t *penum,
- uint charstrings_count, uint charstrings_size)
+ uint charstrings_count, uint charstrings_size)
{
gs_font_base *pfont = pcw->pfont;
uint ignore_count;
@@ -863,18 +863,18 @@ cff_write_CharStrings(cff_writer_t *pcw, psf_glyph_enum_t *penum,
cff_write_CharStrings_offsets(pcw, penum, &ignore_count);
psf_enumerate_glyphs_reset(penum);
for (glyph = gs_no_glyph;
- (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
- ) {
- gs_glyph_data_t gdata;
- gs_font_type1 *pfd;
-
- gdata.memory = pfont->memory;
- if (code == 0 &&
- (code = pcw->glyph_data(pfont, glyph, &gdata, &pfd)) >= 0
- ) {
- cff_put_CharString(pcw, gdata.bits.data, gdata.bits.size, pfd);
- gs_glyph_data_free(&gdata, "cff_write_CharStrings");
- }
+ (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
+ ) {
+ gs_glyph_data_t gdata;
+ gs_font_type1 *pfd;
+
+ gdata.memory = pfont->memory;
+ if (code == 0 &&
+ (code = pcw->glyph_data(pfont, glyph, &gdata, &pfd)) >= 0
+ ) {
+ cff_put_CharString(pcw, gdata.bits.data, gdata.bits.size, pfd);
+ gs_glyph_data_free(&gdata, "cff_write_CharStrings");
+ }
}
}
@@ -887,7 +887,7 @@ cff_write_CharStrings(cff_writer_t *pcw, psf_glyph_enum_t *penum,
static uint
cff_write_Subrs_offsets(cff_writer_t *pcw, uint *pcount, gs_font_type1 *pfont,
- bool global)
+ bool global)
{
int extra_lenIV = cff_extra_lenIV(pcw, pfont);
int j, offset;
@@ -896,14 +896,14 @@ cff_write_Subrs_offsets(cff_writer_t *pcw, uint *pcount, gs_font_type1 *pfont,
gdata.memory = pfont->memory;
for (j = 0, offset = 1;
- (code = pfont->data.procs.subr_data(pfont, j, global, &gdata)) !=
- gs_error_rangecheck;
- ++j) {
- if (code >= 0 && gdata.bits.size >= extra_lenIV)
- offset += gdata.bits.size - extra_lenIV;
- put_offset(pcw, offset);
- if (code >= 0)
- gs_glyph_data_free(&gdata, "cff_write_Subrs_offsets");
+ (code = pfont->data.procs.subr_data(pfont, j, global, &gdata)) !=
+ gs_error_rangecheck;
+ ++j) {
+ if (code >= 0 && gdata.bits.size >= extra_lenIV)
+ offset += gdata.bits.size - extra_lenIV;
+ put_offset(pcw, offset);
+ if (code >= 0)
+ gs_glyph_data_free(&gdata, "cff_write_Subrs_offsets");
}
*pcount = j;
return offset - 1;
@@ -911,7 +911,7 @@ cff_write_Subrs_offsets(cff_writer_t *pcw, uint *pcount, gs_font_type1 *pfont,
static void
cff_write_Subrs(cff_writer_t *pcw, uint subrs_count, uint subrs_size,
- gs_font_type1 *pfont, bool global)
+ gs_font_type1 *pfont, bool global)
{
int j;
uint ignore_count;
@@ -922,13 +922,13 @@ cff_write_Subrs(cff_writer_t *pcw, uint subrs_count, uint subrs_size,
cff_put_Index_header(pcw, subrs_count, subrs_size);
cff_write_Subrs_offsets(pcw, &ignore_count, pfont, global);
for (j = 0;
- (code = pfont->data.procs.subr_data(pfont, j, global, &gdata)) !=
- gs_error_rangecheck;
- ++j) {
- if (code >= 0) {
- cff_put_CharString(pcw, gdata.bits.data, gdata.bits.size, pfont);
- gs_glyph_data_free(&gdata, "cff_write_Subrs");
- }
+ (code = pfont->data.procs.subr_data(pfont, j, global, &gdata)) !=
+ gs_error_rangecheck;
+ ++j) {
+ if (code >= 0) {
+ cff_put_CharString(pcw, gdata.bits.data, gdata.bits.size, pfont);
+ gs_glyph_data_free(&gdata, "cff_write_Subrs");
+ }
}
}
@@ -940,8 +940,8 @@ cff_Encoding_size(int num_encoded, int num_encoded_chars)
int n = min(num_encoded, 255);
return 2 + n +
- (num_encoded_chars > n ?
- 1 + (num_encoded_chars - n) * 3 : 0);
+ (num_encoded_chars > n ?
+ 1 + (num_encoded_chars - n) * 3 : 0);
}
static int
@@ -957,50 +957,50 @@ cff_write_Encoding(cff_writer_t *pcw, cff_glyph_subset_t *pgsub)
memset(used, 0, num_enc);
for (j = 0; j < 256; ++j) {
- gs_glyph glyph = pfont->procs.encode_char((gs_font *)pfont,
- (gs_char)j,
- GLYPH_SPACE_NAME);
- int i;
-
- if (glyph == gs_no_glyph || glyph == pgsub->glyphs.notdef)
- continue;
- i = psf_sorted_glyphs_index_of(pgsub->glyphs.subset_data + 1,
- pgsub->num_encoded, glyph);
- if (i < 0)
- continue; /* encoded but not in subset */
- if (i >= sizeof(used) || used[i])
- supplement[nsupp++] = j;
- else
- index[i] = j, used[i] = 1;
+ gs_glyph glyph = pfont->procs.encode_char((gs_font *)pfont,
+ (gs_char)j,
+ GLYPH_SPACE_NAME);
+ int i;
+
+ if (glyph == gs_no_glyph || glyph == pgsub->glyphs.notdef)
+ continue;
+ i = psf_sorted_glyphs_index_of(pgsub->glyphs.subset_data + 1,
+ pgsub->num_encoded, glyph);
+ if (i < 0)
+ continue; /* encoded but not in subset */
+ if (i >= sizeof(used) || used[i])
+ supplement[nsupp++] = j;
+ else
+ index[i] = j, used[i] = 1;
}
sputc(s, (byte)(nsupp ? 0x80 : 0));
sputc(s, (byte)num_enc);
#ifdef DEBUG
{ int num_enc_chars = pgsub->num_encoded_chars;
- if (nsupp != num_enc_chars - num_enc)
- lprintf3("nsupp = %d, num_enc_chars = %d, num_enc = %d\n",
- nsupp, num_enc_chars, num_enc);
- for (j = 0; j < num_enc; ++j)
- if (!used[j])
- lprintf2("glyph %d = 0x%lx not used\n", j,
- pgsub->glyphs.subset_data[j + 1]);
+ if (nsupp != num_enc_chars - num_enc)
+ lprintf3("nsupp = %d, num_enc_chars = %d, num_enc = %d\n",
+ nsupp, num_enc_chars, num_enc);
+ for (j = 0; j < num_enc; ++j)
+ if (!used[j])
+ lprintf2("glyph %d = 0x%lx not used\n", j,
+ pgsub->glyphs.subset_data[j + 1]);
}
#endif
put_bytes(s, index, num_enc);
if (nsupp) {
- /* Write supplementary entries for multiply-encoded glyphs. */
- sputc(s, (byte)nsupp);
- for (j = 0; j < nsupp; ++j) {
- byte chr = supplement[j];
-
- sputc(s, chr);
- put_card16(pcw,
- cff_glyph_sid(pcw,
- pfont->procs.encode_char((gs_font *)pfont,
- (gs_char)chr,
- GLYPH_SPACE_NAME)));
- }
+ /* Write supplementary entries for multiply-encoded glyphs. */
+ sputc(s, (byte)nsupp);
+ for (j = 0; j < nsupp; ++j) {
+ byte chr = supplement[j];
+
+ sputc(s, chr);
+ put_card16(pcw,
+ cff_glyph_sid(pcw,
+ pfont->procs.encode_char((gs_font *)pfont,
+ (gs_char)chr,
+ GLYPH_SPACE_NAME)));
+ }
}
return 0;
}
@@ -1012,7 +1012,7 @@ cff_write_charset(cff_writer_t *pcw, cff_glyph_subset_t *pgsub)
sputc(pcw->strm, 0);
for (j = 1; j < pgsub->glyphs.subset_size; ++j)
- put_card16(pcw, cff_glyph_sid(pcw, pgsub->glyphs.subset_data[j]));
+ put_card16(pcw, cff_glyph_sid(pcw, pgsub->glyphs.subset_data[j]));
return 0;
}
static int
@@ -1024,9 +1024,9 @@ cff_write_cidset(cff_writer_t *pcw, psf_glyph_enum_t *penum)
sputc(pcw->strm, 0);
psf_enumerate_glyphs_reset(penum);
while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
- /* Skip glyph 0 (the .notdef glyph), which is always first. */
- if (glyph != gs_min_cid_glyph)
- put_card16(pcw, (uint)(glyph - gs_min_cid_glyph));
+ /* Skip glyph 0 (the .notdef glyph), which is always first. */
+ if (glyph != gs_min_cid_glyph)
+ put_card16(pcw, (uint)(glyph - gs_min_cid_glyph));
}
return min(code, 0);
}
@@ -1047,28 +1047,28 @@ cff_FDSelect_size(cff_writer_t *pcw, psf_glyph_enum_t *penum, uint *pformat)
/* Determine whether format 0 or 3 is more efficient. */
psf_enumerate_glyphs_reset(penum);
while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
- int font_index;
-
- code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
- if (code >= 0) {
- if (font_index != prev)
- range_size += 3, prev = font_index;
- ++linear_size;
- }
+ int font_index;
+
+ code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
+ if (code >= 0) {
+ if (font_index != prev)
+ range_size += 3, prev = font_index;
+ ++linear_size;
+ }
}
if (range_size < linear_size) {
- *pformat = 3;
- return range_size;
+ *pformat = 3;
+ return range_size;
} else {
- *pformat = 0;
- return linear_size;
+ *pformat = 0;
+ return linear_size;
}
}
/* Write FDSelect. size and format were returned by cff_FDSelect_size. */
static int
cff_write_FDSelect(cff_writer_t *pcw, psf_glyph_enum_t *penum, uint size,
- int format)
+ int format)
{
stream *s = pcw->strm;
gs_font_cid0 *const pfont = (gs_font_cid0 *)pcw->pfont;
@@ -1082,33 +1082,33 @@ cff_write_FDSelect(cff_writer_t *pcw, psf_glyph_enum_t *penum, uint size,
psf_enumerate_glyphs_reset(penum);
switch (format) {
case 3: /* ranges */
- put_card16(pcw, (size - 5) / 3);
- while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
- int font_index;
-
- code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
- if (code >= 0) {
- if (font_index != prev) {
- put_card16(pcw, cid_count);
- sputc(s, (byte)font_index);
- prev = font_index;
- }
- ++cid_count;
- }
- }
- put_card16(pcw, cid_count);
- break;
+ put_card16(pcw, (size - 5) / 3);
+ while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
+ int font_index;
+
+ code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
+ if (code >= 0) {
+ if (font_index != prev) {
+ put_card16(pcw, cid_count);
+ sputc(s, (byte)font_index);
+ prev = font_index;
+ }
+ ++cid_count;
+ }
+ }
+ put_card16(pcw, cid_count);
+ break;
case 0: /* linear table */
- while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
- int font_index;
-
- code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
- if (code >= 0)
- sputc(s, (byte)font_index);
- }
- break;
+ while ((code = psf_enumerate_glyphs_next(penum, &glyph)) == 0) {
+ int font_index;
+
+ code = pfont->cidata.glyph_data(pbfont, glyph, NULL, &font_index);
+ if (code >= 0)
+ sputc(s, (byte)font_index);
+ }
+ break;
default: /* not possible */
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
return 0;
}
@@ -1118,9 +1118,9 @@ cff_write_FDSelect(cff_writer_t *pcw, psf_glyph_enum_t *penum, uint size,
/* Write the CFF definition of a Type 1 or Type 2 font. */
int
psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
- gs_glyph *subset_glyphs, uint subset_size,
- const gs_const_string *alt_font_name,
- gs_int_rect *FontBBox)
+ gs_glyph *subset_glyphs, uint subset_size,
+ const gs_const_string *alt_font_name,
+ gs_int_rect *FontBBox)
{
gs_font_base *const pbfont = (gs_font_base *)pfont;
cff_writer_t writer;
@@ -1138,15 +1138,15 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
* (see below).
*/
uint
- Top_size = 0x7fffff,
- GSubrs_offset,
- Encoding_offset,
- charset_offset,
- CharStrings_offset,
- Private_offset,
- Private_size = 0x7fffff,
- Subrs_offset,
- End_offset = 0x7fffff;
+ Top_size = 0x7fffff,
+ GSubrs_offset,
+ Encoding_offset,
+ charset_offset,
+ CharStrings_offset,
+ Private_offset,
+ Private_size = 0x7fffff,
+ Subrs_offset,
+ End_offset = 0x7fffff;
int j;
psf_glyph_enum_t genum;
gs_glyph glyph;
@@ -1156,32 +1156,32 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Allocate the string tables. */
psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont,
- NULL, 0, GLYPH_SPACE_NAME);
+ NULL, 0, GLYPH_SPACE_NAME);
while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1)
- number_of_glyphs++;
+ number_of_glyphs++;
subset.glyphs.subset_data = (gs_glyph *)gs_alloc_bytes(pfont->memory,
- number_of_glyphs * sizeof(glyph), "psf_write_type2_font");
+ number_of_glyphs * sizeof(glyph), "psf_write_type2_font");
number_of_strings = number_of_glyphs + MAX_CFF_MISC_STRINGS;
std_string_items = (cff_string_item_t *)gs_alloc_bytes(pfont->memory,
- (MAX_CFF_STD_STRINGS + number_of_strings) * sizeof(cff_string_item_t),
- "psf_write_type2_font");
+ (MAX_CFF_STD_STRINGS + number_of_strings) * sizeof(cff_string_item_t),
+ "psf_write_type2_font");
if (std_string_items == NULL || subset.glyphs.subset_data == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
string_items = std_string_items + MAX_CFF_STD_STRINGS;
/* Get subset glyphs. */
code = psf_get_type1_glyphs(&subset.glyphs, pfont, subset_glyphs,
- subset_size);
+ subset_size);
if (code < 0)
- return code;
+ return code;
if (subset.glyphs.notdef == gs_no_glyph)
- return_error(gs_error_rangecheck); /* notdef is required */
+ return_error(gs_error_rangecheck); /* notdef is required */
/* If we're writing Type 2 CharStrings, don't encrypt them. */
if (options & WRITE_TYPE2_CHARSTRINGS) {
- options |= WRITE_TYPE2_NO_LENIV;
- if (pfont->FontType != ft_encrypted2)
- pfont->data.defaultWidthX = pfont->data.nominalWidthX = 0;
+ options |= WRITE_TYPE2_NO_LENIV;
+ if (pfont->FontType != ft_encrypted2)
+ pfont->data.defaultWidthX = pfont->data.nominalWidthX = 0;
}
writer.options = options;
s_init(&poss, NULL);
@@ -1195,92 +1195,92 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Initialize the enumeration of the glyphs. */
psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont,
- subset.glyphs.subset_glyphs,
- (subset.glyphs.subset_glyphs ?
- subset.glyphs.subset_size : 0),
- GLYPH_SPACE_NAME);
+ subset.glyphs.subset_glyphs,
+ (subset.glyphs.subset_glyphs ?
+ subset.glyphs.subset_size : 0),
+ GLYPH_SPACE_NAME);
/* Shuffle the glyphs into the order .notdef, encoded, unencoded. */
{
- gs_glyph encoded[256];
- int num_enc, num_enc_chars;
-
- /* Get the list of encoded glyphs. */
- for (j = 0, num_enc_chars = 0; j < 256; ++j) {
- glyph = pfont->procs.encode_char((gs_font *)pfont, (gs_char)j,
- GLYPH_SPACE_NAME);
- if (glyph != gs_no_glyph && glyph != subset.glyphs.notdef &&
- (subset.glyphs.subset_glyphs == 0 ||
- psf_sorted_glyphs_include(subset.glyphs.subset_data,
- subset.glyphs.subset_size, glyph)))
- encoded[num_enc_chars++] = glyph;
- }
- subset.num_encoded_chars = num_enc_chars;
- subset.num_encoded = num_enc =
- psf_sort_glyphs(encoded, num_enc_chars);
-
- /* Get the complete list of glyphs if we don't have it already. */
- if (!subset.glyphs.subset_glyphs) {
- int num_glyphs = 0;
-
- psf_enumerate_glyphs_reset(&genum);
- while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1)
- if (code == 0) {
- if (num_glyphs == number_of_glyphs)
- return_error(gs_error_limitcheck);
- subset.glyphs.subset_data[num_glyphs++] = glyph;
- }
- subset.glyphs.subset_size =
- psf_sort_glyphs(subset.glyphs.subset_data, num_glyphs);
- subset.glyphs.subset_glyphs = subset.glyphs.subset_data;
- }
-
- /* Move the unencoded glyphs to the top of the list. */
- /*
- * We could do this in time N rather than N log N with a two-finger
- * algorithm, but it doesn't seem worth the trouble right now.
- */
- {
- int from = subset.glyphs.subset_size;
- int to = from;
-
- while (from > 0) {
- glyph = subset.glyphs.subset_data[--from];
- if (glyph != subset.glyphs.notdef &&
- !psf_sorted_glyphs_include(encoded, num_enc, glyph))
- subset.glyphs.subset_data[--to] = glyph;
- }
+ gs_glyph encoded[256];
+ int num_enc, num_enc_chars;
+
+ /* Get the list of encoded glyphs. */
+ for (j = 0, num_enc_chars = 0; j < 256; ++j) {
+ glyph = pfont->procs.encode_char((gs_font *)pfont, (gs_char)j,
+ GLYPH_SPACE_NAME);
+ if (glyph != gs_no_glyph && glyph != subset.glyphs.notdef &&
+ (subset.glyphs.subset_glyphs == 0 ||
+ psf_sorted_glyphs_include(subset.glyphs.subset_data,
+ subset.glyphs.subset_size, glyph)))
+ encoded[num_enc_chars++] = glyph;
+ }
+ subset.num_encoded_chars = num_enc_chars;
+ subset.num_encoded = num_enc =
+ psf_sort_glyphs(encoded, num_enc_chars);
+
+ /* Get the complete list of glyphs if we don't have it already. */
+ if (!subset.glyphs.subset_glyphs) {
+ int num_glyphs = 0;
+
+ psf_enumerate_glyphs_reset(&genum);
+ while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1)
+ if (code == 0) {
+ if (num_glyphs == number_of_glyphs)
+ return_error(gs_error_limitcheck);
+ subset.glyphs.subset_data[num_glyphs++] = glyph;
+ }
+ subset.glyphs.subset_size =
+ psf_sort_glyphs(subset.glyphs.subset_data, num_glyphs);
+ subset.glyphs.subset_glyphs = subset.glyphs.subset_data;
+ }
+
+ /* Move the unencoded glyphs to the top of the list. */
+ /*
+ * We could do this in time N rather than N log N with a two-finger
+ * algorithm, but it doesn't seem worth the trouble right now.
+ */
+ {
+ int from = subset.glyphs.subset_size;
+ int to = from;
+
+ while (from > 0) {
+ glyph = subset.glyphs.subset_data[--from];
+ if (glyph != subset.glyphs.notdef &&
+ !psf_sorted_glyphs_include(encoded, num_enc, glyph))
+ subset.glyphs.subset_data[--to] = glyph;
+ }
#ifdef DEBUG
- if (to != num_enc + 1)
- lprintf2("to = %d, num_enc + 1 = %d\n", to, num_enc + 1);
+ if (to != num_enc + 1)
+ lprintf2("to = %d, num_enc + 1 = %d\n", to, num_enc + 1);
#endif
- }
+ }
- /* Move .notdef and the encoded glyphs to the bottom of the list. */
- subset.glyphs.subset_data[0] = subset.glyphs.notdef;
- memcpy(subset.glyphs.subset_data + 1, encoded,
- sizeof(encoded[0]) * num_enc);
+ /* Move .notdef and the encoded glyphs to the bottom of the list. */
+ subset.glyphs.subset_data[0] = subset.glyphs.notdef;
+ memcpy(subset.glyphs.subset_data + 1, encoded,
+ sizeof(encoded[0]) * num_enc);
}
/* Set the font name. */
if (alt_font_name)
- font_name = *alt_font_name;
+ font_name = *alt_font_name;
else
- font_name.data = pfont->font_name.chars,
- font_name.size = pfont->font_name.size;
+ font_name.data = pfont->font_name.chars,
+ font_name.size = pfont->font_name.size;
/* Initialize the string tables. */
cff_string_table_init(&writer.std_strings, std_string_items,
- MAX_CFF_STD_STRINGS);
+ MAX_CFF_STD_STRINGS);
for (j = 0; (glyph = gs_c_known_encode((gs_char)j,
- ENCODING_INDEX_CFFSTRINGS)) != gs_no_glyph;
- ++j) {
- gs_const_string str;
- int ignore;
-
- gs_c_glyph_name(glyph, &str);
- cff_string_index(&writer.std_strings, str.data, str.size, true,
- &ignore);
+ ENCODING_INDEX_CFFSTRINGS)) != gs_no_glyph;
+ ++j) {
+ gs_const_string str;
+ int ignore;
+
+ gs_c_glyph_name(glyph, &str);
+ cff_string_index(&writer.std_strings, str.data, str.size, true,
+ &ignore);
}
cff_string_table_init(&writer.strings, string_items, number_of_strings);
@@ -1290,15 +1290,15 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Enter the glyph names in the string table. */
/* (Note that we have changed the glyph list.) */
psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont,
- subset.glyphs.subset_data,
- subset.glyphs.subset_size,
- GLYPH_SPACE_NAME);
+ subset.glyphs.subset_data,
+ subset.glyphs.subset_size,
+ GLYPH_SPACE_NAME);
while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1)
- if (code == 0) {
- code = cff_glyph_sid(&writer, glyph);
- if (code < 0)
- return code;
- }
+ if (code == 0) {
+ code = cff_glyph_sid(&writer, glyph);
+ if (code < 0)
+ return code;
+ }
/*
* The CFF specification says that the Encoding, charset, CharStrings,
@@ -1311,12 +1311,12 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
* Compute the size of the GSubrs Index, if not omitted.
*/
if ((options & WRITE_TYPE2_NO_GSUBRS) != 0 ||
- cff_convert_charstrings(&writer, pbfont) /* we expand all Subrs */
- )
- gsubrs_count = 0, gsubrs_size = 0;
+ cff_convert_charstrings(&writer, pbfont) /* we expand all Subrs */
+ )
+ gsubrs_count = 0, gsubrs_size = 0;
else
- gsubrs_size = cff_write_Subrs_offsets(&writer, &gsubrs_count,
- pfont, true);
+ gsubrs_size = cff_write_Subrs_offsets(&writer, &gsubrs_count,
+ pfont, true);
/*
* Compute the size of the Encoding. For simplicity, we currently
@@ -1325,7 +1325,7 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
* glyphs that occur at more than one place in the Encoding.
*/
encoding_size = cff_Encoding_size(subset.num_encoded,
- subset.num_encoded_chars);
+ subset.num_encoded_chars);
/*
* Compute the size of the charset. For simplicity, we currently
@@ -1336,17 +1336,17 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Compute the size of the CharStrings Index. */
code = cff_write_CharStrings_offsets(&writer, &genum, &charstrings_count);
if (code < 0)
- return code;
+ return code;
charstrings_size = (uint)code;
/* Compute the size of the (local) Subrs Index. */
#ifdef SKIP_EMPTY_SUBRS
subrs_size =
- (cff_convert_charstrings(&writer, pbfont) ? 0 :
- cff_write_Subrs_offsets(&writer, &subrs_count, pfont, false));
+ (cff_convert_charstrings(&writer, pbfont) ? 0 :
+ cff_write_Subrs_offsets(&writer, &subrs_count, pfont, false));
#else
if (cff_convert_charstrings(&writer, pbfont))
- subrs_count = 0; /* we expand all Subrs */
+ subrs_count = 0; /* we expand all Subrs */
subrs_size = cff_write_Subrs_offsets(&writer, &subrs_count, pfont, false);
#endif
@@ -1369,19 +1369,19 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Compute the offsets. */
GSubrs_offset = 4 + cff_Index_size(1, font_name.size) +
- cff_Index_size(1, Top_size) +
- cff_Index_size(writer.strings.count, writer.strings.total);
+ cff_Index_size(1, Top_size) +
+ cff_Index_size(writer.strings.count, writer.strings.total);
Encoding_offset = GSubrs_offset +
- cff_Index_size(gsubrs_count, gsubrs_size);
+ cff_Index_size(gsubrs_count, gsubrs_size);
charset_offset = Encoding_offset + encoding_size;
CharStrings_offset = charset_offset + charset_size;
Private_offset = CharStrings_offset +
- cff_Index_size(charstrings_count, charstrings_size);
+ cff_Index_size(charstrings_count, charstrings_size);
Subrs_offset = Private_size; /* relative to Private Dict */
write:
if(check_ioerror(writer.strm))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
start_pos = stell(writer.strm);
/* Write the header, setting offset_size. */
cff_write_header(&writer, End_offset);
@@ -1396,25 +1396,25 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
put_offset(&writer, Top_size + 1);
offset = stell(writer.strm) - start_pos;
cff_write_Top_font(&writer, Encoding_offset, charset_offset,
- CharStrings_offset,
- Private_offset, Private_size);
+ CharStrings_offset,
+ Private_offset, Private_size);
Top_size = stell(writer.strm) - start_pos - offset;
/* Write the strings Index. */
cff_put_Index(&writer, &writer.strings);
if(check_ioerror(writer.strm))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
/* Write the GSubrs Index, if any, checking the offset. */
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]GSubrs = %u => %u\n", GSubrs_offset, offset);
if (offset > GSubrs_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
GSubrs_offset = offset;
if (gsubrs_count == 0 || cff_convert_charstrings(&writer, pbfont))
- cff_put_Index_header(&writer, 0, 0);
+ cff_put_Index_header(&writer, 0, 0);
else
- cff_write_Subrs(&writer, gsubrs_count, gsubrs_size, pfont, true);
+ cff_write_Subrs(&writer, gsubrs_count, gsubrs_size, pfont, true);
/* Write the Encoding. */
cff_write_Encoding(&writer, &subset);
@@ -1425,17 +1425,17 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Write the CharStrings Index, checking the offset. */
offset = stell(writer.strm) - start_pos;
if (offset > CharStrings_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
CharStrings_offset = offset;
cff_write_CharStrings(&writer, &genum, charstrings_count,
- charstrings_size);
+ charstrings_size);
if(check_ioerror(writer.strm))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
/* Write the Private Dict, checking the offset. */
offset = stell(writer.strm) - start_pos;
if (offset > Private_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
Private_offset = offset;
cff_write_Private(&writer, (subrs_size == 0 ? 0 : Subrs_offset), pfont);
Private_size = stell(writer.strm) - start_pos - offset;
@@ -1443,29 +1443,29 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Write the Subrs Index, checking the offset. */
offset = stell(writer.strm) - (start_pos + Private_offset);
if (offset > Subrs_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
Subrs_offset = offset;
if (cff_convert_charstrings(&writer, pbfont))
- cff_put_Index_header(&writer, 0, 0);
+ cff_put_Index_header(&writer, 0, 0);
else if (subrs_size != 0)
- cff_write_Subrs(&writer, subrs_count, subrs_size, pfont, false);
+ cff_write_Subrs(&writer, subrs_count, subrs_size, pfont, false);
/* Check the final offset. */
if(check_ioerror(writer.strm))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
offset = stell(writer.strm) - start_pos;
if (offset > End_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (offset == End_offset) {
- /* The iteration has converged. Write the result. */
- if (writer.strm == &poss) {
- writer.strm = s;
- goto write;
- }
+ /* The iteration has converged. Write the result. */
+ if (writer.strm == &poss) {
+ writer.strm = s;
+ goto write;
+ }
} else {
- /* No convergence yet. */
- End_offset = offset;
- goto iter;
+ /* No convergence yet. */
+ End_offset = offset;
+ goto iter;
}
/* All done. */
@@ -1477,14 +1477,14 @@ psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
/* Write the CFF definition of a CIDFontType 0 font (CIDFont). */
static int
cid0_glyph_data(gs_font_base *pbfont, gs_glyph glyph, gs_glyph_data_t *pgd,
- gs_font_type1 **ppfont)
+ gs_font_type1 **ppfont)
{
gs_font_cid0 *const pfont = (gs_font_cid0 *)pbfont;
int font_index;
int code = pfont->cidata.glyph_data(pbfont, glyph, pgd, &font_index);
if (code >= 0)
- *ppfont = pfont->cidata.FDArray[font_index];
+ *ppfont = pfont->cidata.FDArray[font_index];
return code;
}
#ifdef DEBUG
@@ -1499,8 +1499,8 @@ offset_error(const char *msg)
#endif
int
psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
- const byte *subset_cids, uint subset_size,
- const gs_const_string *alt_font_name)
+ const byte *subset_cids, uint subset_size,
+ const gs_const_string *alt_font_name)
{
/*
* CIDFontType 0 fonts differ from ordinary Type 1 / Type 2 fonts
@@ -1520,7 +1520,7 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
cff_string_item_t std_string_items[500]; /* 391 entries used */
/****** HOW TO DETERMINE THE SIZE OF STRINGS? ******/
cff_string_item_t string_items[500 /* character names */ +
- 40 /* misc. values */];
+ 40 /* misc. values */];
gs_const_string font_name;
stream poss;
uint charstrings_count, charstrings_size;
@@ -1532,16 +1532,16 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
* (see below).
*/
uint
- Top_size = 0x7fffff,
- GSubrs_offset = 0x1ffffff,
- charset_offset = 0x1ffffff,
- FDSelect_offset = 0x1ffffff,
- CharStrings_offset = 0x1ffffff,
- Font_offset = 0x1ffffff,
- FDArray_offsets[257],
- Private_offsets[257],
- Subrs_offsets[257],
- End_offset = 0x1ffffff;
+ Top_size = 0x7fffff,
+ GSubrs_offset = 0x1ffffff,
+ charset_offset = 0x1ffffff,
+ FDSelect_offset = 0x1ffffff,
+ CharStrings_offset = 0x1ffffff,
+ Font_offset = 0x1ffffff,
+ FDArray_offsets[257],
+ Private_offsets[257],
+ Subrs_offsets[257],
+ End_offset = 0x1ffffff;
int j;
psf_glyph_enum_t genum;
gs_font_info_t info;
@@ -1550,19 +1550,18 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
int num_fonts = pfont->cidata.FDArray_size;
int code;
-
/* Initialize the enumeration of the glyphs. */
psf_enumerate_cids_begin(&genum, (gs_font *)pfont, subset_cids,
- subset_size);
+ subset_size);
/* Check that the font can be written. */
code = psf_check_outline_glyphs((gs_font_base *)pfont, &genum,
- cid0_glyph_data);
+ cid0_glyph_data);
if (code < 0)
- return code;
+ return code;
/* The .notdef glyph (glyph 0) must be included. */
if (subset_cids && subset_size > 0 && !(subset_cids[0] & 0x80))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
writer.options = options;
s_init(&poss, NULL);
@@ -1577,26 +1576,26 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
/* Set the font name. */
if (alt_font_name)
- font_name = *alt_font_name;
+ font_name = *alt_font_name;
else if (pfont->font_name.size)
- font_name.data = pfont->font_name.chars,
- font_name.size = pfont->font_name.size;
+ font_name.data = pfont->font_name.chars,
+ font_name.size = pfont->font_name.size;
else
- font_name.data = pfont->key_name.chars,
- font_name.size = pfont->key_name.size;
+ font_name.data = pfont->key_name.chars,
+ font_name.size = pfont->key_name.size;
/* Initialize the string tables. */
cff_string_table_init(&writer.std_strings, std_string_items,
- countof(std_string_items));
+ countof(std_string_items));
cff_string_table_init(&writer.strings, string_items,
- countof(string_items));
+ countof(string_items));
/* Make all entries in the string table. */
cff_write_ROS(&writer, &pfont->cidata.common.CIDSystemInfo);
for (j = 0; j < num_fonts; ++j) {
- gs_font_type1 *pfd = pfont->cidata.FDArray[j];
+ gs_font_type1 *pfd = pfont->cidata.FDArray[j];
- cff_write_Top_fdarray(&writer, (gs_font_base *)pfd, 0, 0);
+ cff_write_Top_fdarray(&writer, (gs_font_base *)pfd, 0, 0);
}
/*
@@ -1608,8 +1607,8 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
/* Initialize the offset arrays. */
for (j = 0; j <= num_fonts; ++j)
- FDArray_offsets[j] = Private_offsets[j] = Subrs_offsets[j] =
- 0x7effffff / num_fonts * j + 0x1000000;
+ FDArray_offsets[j] = Private_offsets[j] = Subrs_offsets[j] =
+ 0x7effffff / num_fonts * j + 0x1000000;
/*
* Compute the size of the GSubrs Index, if not omitted.
@@ -1617,14 +1616,14 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
* the CharString type.
*/
if ((options & WRITE_TYPE2_NO_GSUBRS) != 0 ||
- cff_convert_charstrings(&writer,
- (const gs_font_base *)pfont->cidata.FDArray[0])
- /* we expand all Subrs */
- )
- gsubrs_count = 0, gsubrs_size = 0;
+ cff_convert_charstrings(&writer,
+ (const gs_font_base *)pfont->cidata.FDArray[0])
+ /* we expand all Subrs */
+ )
+ gsubrs_count = 0, gsubrs_size = 0;
else
- gsubrs_size = cff_write_Subrs_offsets(&writer, &gsubrs_count,
- pfont->cidata.FDArray[0], true);
+ gsubrs_size = cff_write_Subrs_offsets(&writer, &gsubrs_count,
+ pfont->cidata.FDArray[0], true);
/*
* Compute the size of the charset. For simplicity, we currently
@@ -1641,21 +1640,21 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
/* Compute the size of the CharStrings Index. */
code = cff_write_CharStrings_offsets(&writer, &genum, &charstrings_count);
if (code < 0)
- return code;
+ return code;
charstrings_size = (uint)code;
/* Compute the size of the (local) Subrs Indexes. */
for (j = 0; j < num_fonts; ++j) {
- gs_font_type1 *pfd = pfont->cidata.FDArray[j];
+ gs_font_type1 *pfd = pfont->cidata.FDArray[j];
#ifdef SKIP_EMPTY_SUBRS
- subrs_size[j] =
- (cff_convert_charstrings(&writer, (gs_font_base *)pfd) ? 0 :
- cff_write_Subrs_offsets(&writer, &subrs_count[j], pfd, false));
+ subrs_size[j] =
+ (cff_convert_charstrings(&writer, (gs_font_base *)pfd) ? 0 :
+ cff_write_Subrs_offsets(&writer, &subrs_count[j], pfd, false));
#else
- if (cff_convert_charstrings(&writer, (gs_font_base *)pfd))
- subrs_count[j] = 0; /* we expand all Subrs */
- subrs_size[j] = cff_write_Subrs_offsets(&writer, &subrs_count[j], pfd, false);
+ if (cff_convert_charstrings(&writer, (gs_font_base *)pfd))
+ subrs_count[j] = 0; /* we expand all Subrs */
+ subrs_size[j] = cff_write_Subrs_offsets(&writer, &subrs_count[j], pfd, false);
#endif
}
@@ -1681,14 +1680,14 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
/* Compute the offsets. */
GSubrs_offset = 4 + cff_Index_size(1, font_name.size) +
- cff_Index_size(1, Top_size) +
- cff_Index_size(writer.strings.count, writer.strings.total);
+ cff_Index_size(1, Top_size) +
+ cff_Index_size(writer.strings.count, writer.strings.total);
charset_offset = GSubrs_offset +
- cff_Index_size(gsubrs_count, gsubrs_size);
+ cff_Index_size(gsubrs_count, gsubrs_size);
FDSelect_offset = charset_offset + charset_size;
CharStrings_offset = FDSelect_offset + fdselect_size;
if_debug4('l', "[l]GSubrs at %u, charset at %u, FDSelect at %u, CharStrings at %u\n",
- GSubrs_offset, charset_offset, FDSelect_offset, CharStrings_offset);
+ GSubrs_offset, charset_offset, FDSelect_offset, CharStrings_offset);
write:
start_pos = stell(writer.strm);
@@ -1706,7 +1705,7 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
put_offset(&writer, Top_size + 1);
offset = stell(writer.strm) - start_pos;
cff_write_Top_cidfont(&writer, charset_offset, CharStrings_offset,
- FDSelect_offset, Font_offset, &info);
+ FDSelect_offset, Font_offset, &info);
Top_size = stell(writer.strm) - start_pos - offset;
if_debug1('l', "[l]Top_size = %u\n", Top_size);
@@ -1717,16 +1716,16 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]GSubrs = %u => %u\n", GSubrs_offset, offset);
if (offset > GSubrs_offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
GSubrs_offset = offset;
if (gsubrs_count == 0 ||
- cff_convert_charstrings(&writer,
- (const gs_font_base *)pfont->cidata.FDArray[0])
- )
- cff_put_Index_header(&writer, 0, 0);
+ cff_convert_charstrings(&writer,
+ (const gs_font_base *)pfont->cidata.FDArray[0])
+ )
+ cff_put_Index_header(&writer, 0, 0);
else
- cff_write_Subrs(&writer, gsubrs_count, gsubrs_size,
- pfont->cidata.FDArray[0], true);
+ cff_write_Subrs(&writer, gsubrs_count, gsubrs_size,
+ pfont->cidata.FDArray[0], true);
/* Write the charset. */
if_debug1('l', "[l]charset = %lu\n", stell(writer.strm) - start_pos);
@@ -1736,7 +1735,7 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]FDSelect = %u => %u\n", FDSelect_offset, offset);
if (offset > FDSelect_offset)
- return_error(offset_error("FDselect"));
+ return_error(offset_error("FDselect"));
FDSelect_offset = offset;
cff_write_FDSelect(&writer, &genum, fdselect_size, fdselect_format);
@@ -1744,93 +1743,93 @@ psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]CharStrings = %u => %u\n", CharStrings_offset, offset);
if (offset > CharStrings_offset)
- return_error(offset_error("CharStrings"));
+ return_error(offset_error("CharStrings"));
CharStrings_offset = offset;
cff_write_CharStrings(&writer, &genum, charstrings_count,
- charstrings_size);
+ charstrings_size);
/* Write the Font Dict Index. */
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]Font = %u => %u\n", Font_offset, offset);
if (offset > Font_offset)
- return_error(offset_error("Font"));
+ return_error(offset_error("Font"));
Font_offset = offset;
cff_write_FDArray_offsets(&writer, FDArray_offsets, num_fonts);
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]FDArray[0] = %u => %u\n", FDArray_offsets[0], offset);
if (offset > FDArray_offsets[0])
- return_error(offset_error("FDArray[0]"));
+ return_error(offset_error("FDArray[0]"));
FDArray_offsets[0] = offset;
for (j = 0; j < num_fonts; ++j) {
- gs_font_type1 *pfd = pfont->cidata.FDArray[j];
-
- /* If we're writing Type 2 CharStrings, don't encrypt them. */
- if (options & WRITE_TYPE2_CHARSTRINGS) {
- options |= WRITE_TYPE2_NO_LENIV;
- if (pfd->FontType != ft_encrypted2)
- pfd->data.defaultWidthX = pfd->data.nominalWidthX = 0;
- }
- cff_write_Top_fdarray(&writer, (gs_font_base *)pfd, Private_offsets[j],
- Private_offsets[j + 1] - Private_offsets[j]);
- offset = stell(writer.strm) - start_pos;
- if_debug3('l', "[l]FDArray[%d] = %u => %u\n", j + 1,
- FDArray_offsets[j + 1], offset);
- if (offset > FDArray_offsets[j + 1])
- return_error(offset_error("FDArray"));
- FDArray_offsets[j + 1] = offset;
+ gs_font_type1 *pfd = pfont->cidata.FDArray[j];
+
+ /* If we're writing Type 2 CharStrings, don't encrypt them. */
+ if (options & WRITE_TYPE2_CHARSTRINGS) {
+ options |= WRITE_TYPE2_NO_LENIV;
+ if (pfd->FontType != ft_encrypted2)
+ pfd->data.defaultWidthX = pfd->data.nominalWidthX = 0;
+ }
+ cff_write_Top_fdarray(&writer, (gs_font_base *)pfd, Private_offsets[j],
+ Private_offsets[j + 1] - Private_offsets[j]);
+ offset = stell(writer.strm) - start_pos;
+ if_debug3('l', "[l]FDArray[%d] = %u => %u\n", j + 1,
+ FDArray_offsets[j + 1], offset);
+ if (offset > FDArray_offsets[j + 1])
+ return_error(offset_error("FDArray"));
+ FDArray_offsets[j + 1] = offset;
}
/* Write the Private Dicts, checking the offset. */
for (j = 0; ; ++j) {
- gs_font_type1 *pfd;
-
- offset = stell(writer.strm) - start_pos;
- if_debug3('l', "[l]Private[%d] = %u => %u\n",
- j, Private_offsets[j], offset);
- if (offset > Private_offsets[j])
- return_error(offset_error("Private"));
- Private_offsets[j] = offset;
- if (j == num_fonts)
- break;
- pfd = pfont->cidata.FDArray[j];
- cff_write_Private(&writer,
- (subrs_size[j] == 0 ? 0 : Subrs_offsets[j]), pfd);
+ gs_font_type1 *pfd;
+
+ offset = stell(writer.strm) - start_pos;
+ if_debug3('l', "[l]Private[%d] = %u => %u\n",
+ j, Private_offsets[j], offset);
+ if (offset > Private_offsets[j])
+ return_error(offset_error("Private"));
+ Private_offsets[j] = offset;
+ if (j == num_fonts)
+ break;
+ pfd = pfont->cidata.FDArray[j];
+ cff_write_Private(&writer,
+ (subrs_size[j] == 0 ? 0 : Subrs_offsets[j]), pfd);
}
/* Write the Subrs Indexes, checking the offsets. */
for (j = 0; ; ++j) {
- gs_font_type1 *pfd;
-
- offset = stell(writer.strm) - (start_pos + Private_offsets[j]);
- if_debug3('l', "[l]Subrs[%d] = %u => %u\n",
- j, Subrs_offsets[j], offset);
- if (offset > Subrs_offsets[j])
- return_error(offset_error("Subrs"));
- Subrs_offsets[j] = offset;
- if (j == num_fonts)
- break;
- pfd = pfont->cidata.FDArray[j];
- if (cff_convert_charstrings(&writer, (gs_font_base *)pfd))
- cff_put_Index_header(&writer, 0, 0);
- else if (subrs_size[j] != 0)
- cff_write_Subrs(&writer, subrs_count[j], subrs_size[j], pfd, false);
+ gs_font_type1 *pfd;
+
+ offset = stell(writer.strm) - (start_pos + Private_offsets[j]);
+ if_debug3('l', "[l]Subrs[%d] = %u => %u\n",
+ j, Subrs_offsets[j], offset);
+ if (offset > Subrs_offsets[j])
+ return_error(offset_error("Subrs"));
+ Subrs_offsets[j] = offset;
+ if (j == num_fonts)
+ break;
+ pfd = pfont->cidata.FDArray[j];
+ if (cff_convert_charstrings(&writer, (gs_font_base *)pfd))
+ cff_put_Index_header(&writer, 0, 0);
+ else if (subrs_size[j] != 0)
+ cff_write_Subrs(&writer, subrs_count[j], subrs_size[j], pfd, false);
}
/* Check the final offset. */
offset = stell(writer.strm) - start_pos;
if_debug2('l', "[l]End = %u => %u\n", End_offset, offset);
if (offset > End_offset)
- return_error(offset_error("End"));
+ return_error(offset_error("End"));
if (offset == End_offset) {
- /* The iteration has converged. Write the result. */
- if (writer.strm == &poss) {
- writer.strm = s;
- goto write;
- }
+ /* The iteration has converged. Write the result. */
+ if (writer.strm == &poss) {
+ writer.strm = s;
+ goto write;
+ }
} else {
- /* No convergence yet. */
- End_offset = offset;
- goto iter;
+ /* No convergence yet. */
+ End_offset = offset;
+ goto iter;
}
/* All done. */
diff --git a/gs/base/gdevpsfm.c b/gs/base/gdevpsfm.c
index 82ceeb56f..a3d89b445 100644
--- a/gs/base/gdevpsfm.c
+++ b/gs/base/gdevpsfm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,8 +55,8 @@ pput_hex(stream *s, const byte *pcid, int size)
static const char *const hex_digits = "0123456789abcdef";
for (i = 0; i < size; ++i) {
- stream_putc(s, hex_digits[pcid[i] >> 4]);
- stream_putc(s, hex_digits[pcid[i] & 0xf]);
+ stream_putc(s, hex_digits[pcid[i] >> 4]);
+ stream_putc(s, hex_digits[pcid[i] & 0xf]);
}
}
@@ -68,11 +68,11 @@ cmap_put_ranges(stream *s, const gx_code_space_range_t *pcsr, int count)
pprintd1(s, "%d begincodespacerange\n", count);
for (i = 0; i < count; ++i, ++pcsr) {
- stream_puts(s, "<");
- pput_hex(s, pcsr->first, pcsr->size);
- stream_puts(s, "><");
- pput_hex(s, pcsr->last, pcsr->size);
- stream_puts(s, ">\n");
+ stream_puts(s, "<");
+ pput_hex(s, pcsr->first, pcsr->size);
+ stream_puts(s, "><");
+ pput_hex(s, pcsr->last, pcsr->size);
+ stream_puts(s, ">\n");
}
stream_puts(s, "endcodespacerange\n");
}
@@ -82,24 +82,24 @@ static void
cmap_put_system_info(stream *s, const gs_cid_system_info_t *pcidsi)
{
if (cid_system_info_is_null(pcidsi)) {
- stream_puts(s, " null ");
+ stream_puts(s, " null ");
} else {
- stream_puts(s, " 3 dict dup begin\n");
- stream_puts(s, "/Registry ");
- s_write_ps_string(s, pcidsi->Registry.data, pcidsi->Registry.size, 0);
- stream_puts(s, " def\n/Ordering ");
- s_write_ps_string(s, pcidsi->Ordering.data, pcidsi->Ordering.size, 0);
- pprintd1(s, " def\n/Supplement %d def\nend ", pcidsi->Supplement);
+ stream_puts(s, " 3 dict dup begin\n");
+ stream_puts(s, "/Registry ");
+ s_write_ps_string(s, pcidsi->Registry.data, pcidsi->Registry.size, 0);
+ stream_puts(s, " def\n/Ordering ");
+ s_write_ps_string(s, pcidsi->Ordering.data, pcidsi->Ordering.size, 0);
+ pprintd1(s, " def\n/Supplement %d def\nend ", pcidsi->Supplement);
}
}
/* Write one code map. */
static int
cmap_put_code_map(const gs_memory_t *mem,
- stream *s, int which, const gs_cmap_t *pcmap,
- const cmap_operators_t *pcmo,
- psf_put_name_chars_proc_t put_name_chars,
- int font_index_only)
+ stream *s, int which, const gs_cmap_t *pcmap,
+ const cmap_operators_t *pcmo,
+ psf_put_name_chars_proc_t put_name_chars,
+ int font_index_only)
{
/* For simplicity, produce one entry for each lookup range. */
gs_cmap_lookups_enum_t lenum;
@@ -107,87 +107,87 @@ cmap_put_code_map(const gs_memory_t *mem,
int code;
for (gs_cmap_lookups_enum_init(pcmap, which, &lenum);
- (code = gs_cmap_enum_next_lookup(&lenum)) == 0; ) {
- gs_cmap_lookups_enum_t counter;
- int num_entries = 0;
- int gi;
-
- if (font_index_only >= 0 && lenum.entry.font_index != font_index_only)
- continue;
- if (font_index_only < 0 && lenum.entry.font_index != font_index) {
- pprintd1(s, "%d usefont\n", lenum.entry.font_index);
- font_index = lenum.entry.font_index;
- }
- /* Count the number of entries in this lookup range. */
- counter = lenum;
- while (gs_cmap_enum_next_entry(&counter) == 0)
- ++num_entries;
- for (gi = 0; gi < num_entries; gi += 100) {
- int i = gi, ni = min(i + 100, num_entries);
- const char *end;
-
- pprintd1(s, "%d ", ni - i);
- if (lenum.entry.key_is_range) {
- if (lenum.entry.value_type == CODE_VALUE_CID || lenum.entry.value_type == CODE_VALUE_NOTDEF) {
- stream_puts(s, pcmo->beginrange);
- end = pcmo->endrange;
- } else { /* must be def, not notdef */
- stream_puts(s, "beginbfrange\n");
- end = "endbfrange\n";
- }
- } else {
- if (lenum.entry.value_type == CODE_VALUE_CID || lenum.entry.value_type == CODE_VALUE_NOTDEF) {
- stream_puts(s, pcmo->beginchar);
- end = pcmo->endchar;
- } else { /* must be def, not notdef */
- stream_puts(s, "beginbfchar\n");
- end = "endbfchar\n";
- }
- }
- for (; i < ni; ++i) {
- int j;
- long value;
- int value_size;
-
- DISCARD(gs_cmap_enum_next_entry(&lenum)); /* can't fail */
- value_size = lenum.entry.value.size;
- for (j = 0; j <= lenum.entry.key_is_range; ++j) {
- stream_putc(s, '<');
- pput_hex(s, lenum.entry.key[j], lenum.entry.key_size);
- stream_putc(s, '>');
- }
- for (j = 0, value = 0; j < value_size; ++j)
- value = (value << 8) + lenum.entry.value.data[j];
- switch (lenum.entry.value_type) {
- case CODE_VALUE_CID:
- case CODE_VALUE_NOTDEF:
- pprintld1(s, "%ld", value);
- break;
- case CODE_VALUE_CHARS:
- stream_putc(s, '<');
- pput_hex(s, lenum.entry.value.data, value_size);
- stream_putc(s, '>');
- break;
- case CODE_VALUE_GLYPH: {
- gs_const_string str;
- int code = pcmap->glyph_name(mem, (gs_glyph)value, &str,
- pcmap->glyph_name_data);
-
- if (code < 0)
- return code;
- stream_putc(s, '/');
- code = put_name_chars(s, str.data, str.size);
- if (code < 0)
- return code;
- }
- break;
- default: /* not possible */
- return_error(gs_error_unregistered);
- }
- stream_putc(s, '\n');
- }
- stream_puts(s, end);
- }
+ (code = gs_cmap_enum_next_lookup(&lenum)) == 0; ) {
+ gs_cmap_lookups_enum_t counter;
+ int num_entries = 0;
+ int gi;
+
+ if (font_index_only >= 0 && lenum.entry.font_index != font_index_only)
+ continue;
+ if (font_index_only < 0 && lenum.entry.font_index != font_index) {
+ pprintd1(s, "%d usefont\n", lenum.entry.font_index);
+ font_index = lenum.entry.font_index;
+ }
+ /* Count the number of entries in this lookup range. */
+ counter = lenum;
+ while (gs_cmap_enum_next_entry(&counter) == 0)
+ ++num_entries;
+ for (gi = 0; gi < num_entries; gi += 100) {
+ int i = gi, ni = min(i + 100, num_entries);
+ const char *end;
+
+ pprintd1(s, "%d ", ni - i);
+ if (lenum.entry.key_is_range) {
+ if (lenum.entry.value_type == CODE_VALUE_CID || lenum.entry.value_type == CODE_VALUE_NOTDEF) {
+ stream_puts(s, pcmo->beginrange);
+ end = pcmo->endrange;
+ } else { /* must be def, not notdef */
+ stream_puts(s, "beginbfrange\n");
+ end = "endbfrange\n";
+ }
+ } else {
+ if (lenum.entry.value_type == CODE_VALUE_CID || lenum.entry.value_type == CODE_VALUE_NOTDEF) {
+ stream_puts(s, pcmo->beginchar);
+ end = pcmo->endchar;
+ } else { /* must be def, not notdef */
+ stream_puts(s, "beginbfchar\n");
+ end = "endbfchar\n";
+ }
+ }
+ for (; i < ni; ++i) {
+ int j;
+ long value;
+ int value_size;
+
+ DISCARD(gs_cmap_enum_next_entry(&lenum)); /* can't fail */
+ value_size = lenum.entry.value.size;
+ for (j = 0; j <= lenum.entry.key_is_range; ++j) {
+ stream_putc(s, '<');
+ pput_hex(s, lenum.entry.key[j], lenum.entry.key_size);
+ stream_putc(s, '>');
+ }
+ for (j = 0, value = 0; j < value_size; ++j)
+ value = (value << 8) + lenum.entry.value.data[j];
+ switch (lenum.entry.value_type) {
+ case CODE_VALUE_CID:
+ case CODE_VALUE_NOTDEF:
+ pprintld1(s, "%ld", value);
+ break;
+ case CODE_VALUE_CHARS:
+ stream_putc(s, '<');
+ pput_hex(s, lenum.entry.value.data, value_size);
+ stream_putc(s, '>');
+ break;
+ case CODE_VALUE_GLYPH: {
+ gs_const_string str;
+ int code = pcmap->glyph_name(mem, (gs_glyph)value, &str,
+ pcmap->glyph_name_data);
+
+ if (code < 0)
+ return code;
+ stream_putc(s, '/');
+ code = put_name_chars(s, str.data, str.size);
+ if (code < 0)
+ return code;
+ }
+ break;
+ default: /* not possible */
+ return_error(gs_error_unregistered);
+ }
+ stream_putc(s, '\n');
+ }
+ stream_puts(s, end);
+ }
}
return code;
}
@@ -196,34 +196,34 @@ cmap_put_code_map(const gs_memory_t *mem,
/* Write a CMap in its standard (source) format. */
int
-psf_write_cmap(const gs_memory_t *mem,
- stream *s, const gs_cmap_t *pcmap,
- psf_put_name_chars_proc_t put_name_chars,
- const gs_const_string *alt_cmap_name, int font_index_only)
+psf_write_cmap(const gs_memory_t *mem,
+ stream *s, const gs_cmap_t *pcmap,
+ psf_put_name_chars_proc_t put_name_chars,
+ const gs_const_string *alt_cmap_name, int font_index_only)
{
const gs_const_string *const cmap_name =
- (alt_cmap_name ? alt_cmap_name : &pcmap->CMapName);
+ (alt_cmap_name ? alt_cmap_name : &pcmap->CMapName);
const gs_cid_system_info_t *const pcidsi = pcmap->CIDSystemInfo;
switch (pcmap->CMapType) {
case 0: case 1: case 2:
- break;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
/* Write the header. */
if (!pcmap->ToUnicode) {
- stream_puts(s, "%!PS-Adobe-3.0 Resource-CMap\n");
- stream_puts(s, "%%DocumentNeededResources: ProcSet (CIDInit)\n");
- stream_puts(s, "%%IncludeResource: ProcSet (CIDInit)\n");
- pput_string_entry(s, "%%BeginResource: CMap (", cmap_name);
- pput_string_entry(s, ")\n%%Title: (", cmap_name);
- pput_string_entry(s, " ", &pcidsi->Registry);
- pput_string_entry(s, " ", &pcidsi->Ordering);
- pprintd1(s, " %d)\n", pcidsi->Supplement);
- pprintg1(s, "%%%%Version: %g\n", pcmap->CMapVersion);
+ stream_puts(s, "%!PS-Adobe-3.0 Resource-CMap\n");
+ stream_puts(s, "%%DocumentNeededResources: ProcSet (CIDInit)\n");
+ stream_puts(s, "%%IncludeResource: ProcSet (CIDInit)\n");
+ pput_string_entry(s, "%%BeginResource: CMap (", cmap_name);
+ pput_string_entry(s, ")\n%%Title: (", cmap_name);
+ pput_string_entry(s, " ", &pcidsi->Registry);
+ pput_string_entry(s, " ", &pcidsi->Ordering);
+ pprintd1(s, " %d)\n", pcidsi->Supplement);
+ pprintg1(s, "%%%%Version: %g\n", pcmap->CMapVersion);
}
stream_puts(s, "/CIDInit /ProcSet findresource begin\n");
stream_puts(s, "12 dict begin\nbegincmap\n");
@@ -235,72 +235,72 @@ psf_write_cmap(const gs_memory_t *mem,
put_name_chars(s, cmap_name->data, cmap_name->size);
stream_puts(s, " def\n");
if (!pcmap->ToUnicode) {
- pprintg1(s, "/CMapVersion %g def\n", pcmap->CMapVersion);
- stream_puts(s, "/CIDSystemInfo");
- if (font_index_only >= 0 && font_index_only < pcmap->num_fonts) {
- cmap_put_system_info(s, pcidsi + font_index_only);
- } else if (pcmap->num_fonts == 1) {
- cmap_put_system_info(s, pcidsi);
- } else {
- int i;
-
- pprintd1(s, " %d array\n", pcmap->num_fonts);
- for (i = 0; i < pcmap->num_fonts; ++i) {
- pprintd1(s, "dup %d", i);
- cmap_put_system_info(s, pcidsi + i);
- stream_puts(s, "put\n");
- }
- }
- stream_puts(s, " def\n");
- if (uid_is_XUID(&pcmap->uid)) {
- uint i, n = uid_XUID_size(&pcmap->uid);
- const long *values = uid_XUID_values(&pcmap->uid);
-
- stream_puts(s, "/XUID [");
- for (i = 0; i < n; ++i)
- pprintld1(s, " %ld", values[i]);
- stream_puts(s, "] def\n");
- }
- pprintld1(s, "/UIDOffset %ld def\n", pcmap->UIDOffset);
- pprintd1(s, "/WMode %d def\n", pcmap->WMode);
+ pprintg1(s, "/CMapVersion %g def\n", pcmap->CMapVersion);
+ stream_puts(s, "/CIDSystemInfo");
+ if (font_index_only >= 0 && font_index_only < pcmap->num_fonts) {
+ cmap_put_system_info(s, pcidsi + font_index_only);
+ } else if (pcmap->num_fonts == 1) {
+ cmap_put_system_info(s, pcidsi);
+ } else {
+ int i;
+
+ pprintd1(s, " %d array\n", pcmap->num_fonts);
+ for (i = 0; i < pcmap->num_fonts; ++i) {
+ pprintd1(s, "dup %d", i);
+ cmap_put_system_info(s, pcidsi + i);
+ stream_puts(s, "put\n");
+ }
+ }
+ stream_puts(s, " def\n");
+ if (uid_is_XUID(&pcmap->uid)) {
+ uint i, n = uid_XUID_size(&pcmap->uid);
+ const long *values = uid_XUID_values(&pcmap->uid);
+
+ stream_puts(s, "/XUID [");
+ for (i = 0; i < n; ++i)
+ pprintld1(s, " %ld", values[i]);
+ stream_puts(s, "] def\n");
+ }
+ pprintld1(s, "/UIDOffset %ld def\n", pcmap->UIDOffset);
+ pprintd1(s, "/WMode %d def\n", pcmap->WMode);
}
/* Write the code space ranges. */
{
- gs_cmap_ranges_enum_t renum;
+ gs_cmap_ranges_enum_t renum;
#define MAX_RANGES 100
- gx_code_space_range_t ranges[MAX_RANGES];
- int code, count = 0;
-
- for (gs_cmap_ranges_enum_init(pcmap, &renum);
- (code = gs_cmap_enum_next_range(&renum)) == 0; ) {
- if (count == MAX_RANGES) {
- cmap_put_ranges(s, ranges, count);
- count = 0;
- }
- ranges[count++] = renum.range;
- }
- if (code < 0)
- return code;
- if (count)
- cmap_put_ranges(s, ranges, count);
+ gx_code_space_range_t ranges[MAX_RANGES];
+ int code, count = 0;
+
+ for (gs_cmap_ranges_enum_init(pcmap, &renum);
+ (code = gs_cmap_enum_next_range(&renum)) == 0; ) {
+ if (count == MAX_RANGES) {
+ cmap_put_ranges(s, ranges, count);
+ count = 0;
+ }
+ ranges[count++] = renum.range;
+ }
+ if (code < 0)
+ return code;
+ if (count)
+ cmap_put_ranges(s, ranges, count);
#undef MAX_RANGES
}
/* Write the code and notdef data. */
{
- int code;
-
- code = cmap_put_code_map(mem, s, 1, pcmap, &cmap_notdef_operators,
- put_name_chars, font_index_only);
- if (code < 0)
- return code;
- code = cmap_put_code_map(mem, s, 0, pcmap, &cmap_cid_operators,
- put_name_chars, font_index_only);
- if (code < 0)
- return code;
+ int code;
+
+ code = cmap_put_code_map(mem, s, 1, pcmap, &cmap_notdef_operators,
+ put_name_chars, font_index_only);
+ if (code < 0)
+ return code;
+ code = cmap_put_code_map(mem, s, 0, pcmap, &cmap_cid_operators,
+ put_name_chars, font_index_only);
+ if (code < 0)
+ return code;
}
/* Write the trailer. */
@@ -308,10 +308,9 @@ psf_write_cmap(const gs_memory_t *mem,
stream_puts(s, "endcmap\n");
stream_puts(s, "CMapName currentdict /CMap defineresource pop\nend end\n");
if (!pcmap->ToUnicode) {
- stream_puts(s, "%%EndResource\n");
- stream_puts(s, "%%EOF\n");
+ stream_puts(s, "%%EndResource\n");
+ stream_puts(s, "%%EOF\n");
}
return 0;
}
-
diff --git a/gs/base/gdevpsft.c b/gs/base/gdevpsft.c
index 415d38c9f..d763e1916 100644
--- a/gs/base/gdevpsft.c
+++ b/gs/base/gdevpsft.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,9 +42,9 @@
*
* Note that these options interact. Here is the complete list of settings
* that make sense.
- 0 -1,0,1 N/A 0,1 0,1
- 0xf000 -1 N/A 1 0,1
- 0xf000 0,1 0,1 1 0,1
+ 0 -1,0,1 N/A 0,1 0,1
+ 0xf000 -1 N/A 1 0,1
+ 0xf000 0,1 0,1 1 0,1
*/
/* Define whether to use the 0xf000 character bias for generated tables. */
#define TT_BIAS 0xf000 /* 0xf000 */
@@ -94,9 +94,9 @@ static void
put_loca(stream *s, ulong offset, int indexToLocFormat)
{
if (indexToLocFormat)
- put_ulong(s, offset);
+ put_ulong(s, offset);
else
- put_ushort(s, (uint)(offset >> 1));
+ put_ushort(s, (uint)(offset >> 1));
}
/* Get or put 2- or 4-byte quantities from/into a table. */
@@ -119,7 +119,7 @@ put_u32(byte *p, ulong v)
}
static ulong
put_table(byte tab[16], const char *tname, ulong checksum, ulong offset,
- uint length)
+ uint length)
{
memcpy(tab, (const byte *)tname, 4);
put_u32(tab + 4, checksum);
@@ -135,19 +135,19 @@ write_range(stream *s, gs_font_type42 *pfont, ulong start, uint length)
ulong base = start, size = length;
if_debug3('l', "[l]write_range pos = %ld, start = %lu, length = %u\n",
- stell(s), start, length);
+ stell(s), start, length);
while (size > 0) {
- const byte *ptr;
- int code;
-
- code = pfont->data.string_proc(pfont, base, size, &ptr);
- if (code < 0)
- return code;
- if (!code)
- code = size;
- stream_write(s, ptr, code);
- base += code;
- size -= code;
+ const byte *ptr;
+ int code;
+
+ code = pfont->data.string_proc(pfont, base, size, &ptr);
+ if (code < 0)
+ return code;
+ if (!code)
+ code = size;
+ stream_write(s, ptr, code);
+ base += code;
+ size -= code;
}
return 0;
}
@@ -160,42 +160,42 @@ static int
mac_glyph_index(gs_font *font, int ch, gs_const_string *pstr, int *index)
{
gs_glyph glyph = font->procs.encode_char(font, (gs_char)ch,
- GLYPH_SPACE_NAME);
+ GLYPH_SPACE_NAME);
int code;
if (glyph == gs_no_glyph) {
- *index = 0;
- return 0; /* .notdef */
+ *index = 0;
+ return 0; /* .notdef */
}
code = font->procs.glyph_name(font, glyph, pstr);
if (code < 0)
- return code;
+ return code;
if (glyph < gs_min_cid_glyph) {
- gs_char mac_char;
- gs_glyph mac_glyph;
- gs_const_string mstr;
-
- /* Look (not very hard) for a match in the Mac glyph space. */
- if (ch >= 32 && ch <= 126)
- mac_char = ch - 29;
- else if (ch >= 128 && ch <= 255)
- mac_char = ch - 30;
- else {
- *index = -1;
- return 0;
- }
- mac_glyph = gs_c_known_encode(mac_char, ENCODING_INDEX_MACGLYPH);
- if (mac_glyph == gs_no_glyph) {
- *index = -1;
- return 0;
- }
- code = gs_c_glyph_name(mac_glyph, &mstr);
- if (code < 0)
- return code;
- if (!bytes_compare(pstr->data, pstr->size, mstr.data, mstr.size)) {
- *index = (int)mac_char;
- return 0;
- }
+ gs_char mac_char;
+ gs_glyph mac_glyph;
+ gs_const_string mstr;
+
+ /* Look (not very hard) for a match in the Mac glyph space. */
+ if (ch >= 32 && ch <= 126)
+ mac_char = ch - 29;
+ else if (ch >= 128 && ch <= 255)
+ mac_char = ch - 30;
+ else {
+ *index = -1;
+ return 0;
+ }
+ mac_glyph = gs_c_known_encode(mac_char, ENCODING_INDEX_MACGLYPH);
+ if (mac_glyph == gs_no_glyph) {
+ *index = -1;
+ return 0;
+ }
+ code = gs_c_glyph_name(mac_glyph, &mstr);
+ if (code < 0)
+ return code;
+ if (!bytes_compare(pstr->data, pstr->size, mstr.data, mstr.size)) {
+ *index = (int)mac_char;
+ return 0;
+ }
}
*index = -1;
return 0;
@@ -210,16 +210,16 @@ static const byte cmap_initial_0[] = {
0, 0, /* table version # = 0 */
0, 2, /* # of encoding tables = 2 */
- /* First table, Macintosh */
+ /* First table, Macintosh */
0, 1, /* platform ID = Macintosh */
0, 0, /* platform encoding ID = ??? */
0, 0, 0, 4+8+8, /* offset to table start */
- /* Second table, Windows */
+ /* Second table, Windows */
0, 3, /* platform ID = Microsoft */
0, 0, /* platform encoding ID = unknown */
0, 0, 1, 4+8+8+6, /* offset to table start */
- /* Start of Macintosh format 0 table */
+ /* Start of Macintosh format 0 table */
0, 0, /* format = 0, byte encoding table */
1, 6, /* length */
0, 0 /* version number */
@@ -228,17 +228,17 @@ static const byte cmap_initial_6[] = {
0, 0, /* table version # = 0 */
0, 2, /* # of encoding tables = 2 */
- /* First table, Macintosh */
+ /* First table, Macintosh */
0, 1, /* platform ID = Macintosh */
0, 0, /* platform encoding ID = ??? */
0, 0, 0, 4+8+8, /* offset to table start */
- /* Second table, Windows */
+ /* Second table, Windows */
0, 3, /* platform ID = Microsoft */
0, 0, /* platform encoding ID = unknown */
0, 0, 0, 4+8+8+10, /* offset to table start */
- /* *VARIABLE*, add 2 x # of entries */
+ /* *VARIABLE*, add 2 x # of entries */
- /* Start of Macintosh format 6 table */
+ /* Start of Macintosh format 6 table */
0, 6, /* format = 6, trimmed table mapping */
0, 10, /* length *VARIABLE*, add 2 x # of entries */
0, 0, /* version number */
@@ -249,17 +249,17 @@ static const byte cmap_unicode_initial_6[] = {
0, 0, /* table version # = 0 */
0, 2, /* # of encoding tables = 2 */
- /* First table, Macintosh */
+ /* First table, Macintosh */
0, 1, /* platform ID = Macintosh */
0, 0, /* platform encoding ID = ??? */
0, 0, 0, 4+8+8, /* offset to table start */
- /* Second table, Windows */
+ /* Second table, Windows */
0, 3, /* platform ID = Microsoft */
0, 1, /* platform encoding ID = Unicode */
0, 0, 0, 4+8+8+10, /* offset to table start */
- /* *VARIABLE*, add 2 x # of entries */
+ /* *VARIABLE*, add 2 x # of entries */
- /* Start of Macintosh format 6 table */
+ /* Start of Macintosh format 6 table */
0, 6, /* format = 6, trimmed table mapping */
0, 10, /* length *VARIABLE*, add 2 x # of entries */
0, 0, /* version number */
@@ -270,7 +270,7 @@ static const byte cmap_initial_4[] = {
0, 0, /* table version # = 0 */
0, 1, /* # of encoding tables = 2 */
- /* Single table, Windows */
+ /* Single table, Windows */
0, 3, /* platform ID = Microsoft */
0, 0, /* platform encoding ID = unknown */
0, 0, 0, 4+8 /* offset to table start */
@@ -308,38 +308,38 @@ write_cmap_0(stream *s, byte* entries /*[CMAP_ENTRIES_SIZE]*/, uint num_glyphs)
memset(entries + 2 * num_glyphs, 0, CMAP_ENTRIES_SIZE - 2 * num_glyphs);
stream_write(s, cmap_initial_0, sizeof(cmap_initial_0));
for (i = 0; i <= 0xff; ++i)
- sputc(s, (byte)entries[2 * i + 1]);
+ sputc(s, (byte)entries[2 * i + 1]);
}
static void
write_cmap_6(stream *s, byte *entries /*[CMAP_ENTRIES_SIZE]*/, uint first_code,
- uint first_entry, uint num_entries)
+ uint first_entry, uint num_entries)
{
byte cmap_data[sizeof(cmap_initial_6)];
memcpy(cmap_data, cmap_initial_6, sizeof(cmap_initial_6));
put_u16(cmap_data + 18,
- U16(cmap_data + 18) + num_entries * 2); /* offset */
+ U16(cmap_data + 18) + num_entries * 2); /* offset */
put_u16(cmap_data + 22,
- U16(cmap_data + 22) + num_entries * 2); /* length */
+ U16(cmap_data + 22) + num_entries * 2); /* length */
put_u16(cmap_data + 26,
#if TT_BIAS_CMAP_6
- first_code +
+ first_code +
#endif
- first_entry);
+ first_entry);
put_u16(cmap_data + 28, num_entries);
stream_write(s, cmap_data, sizeof(cmap_data));
stream_write(s, entries + first_entry * 2, num_entries * 2);
}
static void write_unicode_cmap_6(stream *s, byte *entries, uint first_code,
- uint first_entry, uint num_entries)
+ uint first_entry, uint num_entries)
{
byte cmap_data[sizeof(cmap_unicode_initial_6)];
memcpy(cmap_data, cmap_unicode_initial_6, sizeof(cmap_unicode_initial_6));
put_u16(cmap_data + 18,
- U16(cmap_data + 18) + num_entries * 2); /* offset */
+ U16(cmap_data + 18) + num_entries * 2); /* offset */
put_u16(cmap_data + 22,
- U16(cmap_data + 22) + num_entries * 2); /* length */
+ U16(cmap_data + 22) + num_entries * 2); /* length */
put_u16(cmap_data + 26, first_entry);
put_u16(cmap_data + 28, num_entries);
stream_write(s, cmap_data, sizeof(cmap_data));
@@ -347,7 +347,7 @@ static void write_unicode_cmap_6(stream *s, byte *entries, uint first_code,
}
static void
write_cmap(stream *s, gs_font *font, uint first_code, int num_glyphs,
- gs_glyph max_glyph, int options, uint cmap_length)
+ gs_glyph max_glyph, int options, uint cmap_length)
{
byte cmap_sub[sizeof(cmap_sub_initial)];
byte entries[CMAP_ENTRIES_SIZE];
@@ -360,39 +360,39 @@ write_cmap(stream *s, gs_font *font, uint first_code, int num_glyphs,
/* Collect the table entries. */
for (i = 0; i < num_glyphs; ++i) {
- gs_glyph glyph =
- font->procs.encode_char(font, (gs_char)i, GLYPH_SPACE_INDEX);
- uint glyph_index;
-
- if (glyph == gs_no_glyph || glyph < GS_MIN_GLYPH_INDEX ||
- glyph > max_glyph
- )
- glyph = GS_MIN_GLYPH_INDEX;
- glyph_index = (uint)(glyph - GS_MIN_GLYPH_INDEX);
- merge |= glyph_index;
- put_u16(entries + 2 * i, glyph_index);
+ gs_glyph glyph =
+ font->procs.encode_char(font, (gs_char)i, GLYPH_SPACE_INDEX);
+ uint glyph_index;
+
+ if (glyph == gs_no_glyph || glyph < GS_MIN_GLYPH_INDEX ||
+ glyph > max_glyph
+ )
+ glyph = GS_MIN_GLYPH_INDEX;
+ glyph_index = (uint)(glyph - GS_MIN_GLYPH_INDEX);
+ merge |= glyph_index;
+ put_u16(entries + 2 * i, glyph_index);
}
while (end_entry > first_entry && !U16(entries + 2 * end_entry - 2))
- --end_entry;
+ --end_entry;
while (first_entry < end_entry && !U16(entries + 2 * first_entry))
- ++first_entry;
+ ++first_entry;
num_entries = end_entry - first_entry;
/* Write the table header and Macintosh sub-table (if any). */
if (options & WRITE_TRUETYPE_UNICODE_CMAP) {
- write_unicode_cmap_6(s, entries, first_code, first_entry, num_entries);
-
- /* Write the Windows sub-table. */
- memcpy(cmap_sub, cmap_sub_initial, sizeof(cmap_sub_initial));
- put_u16(cmap_sub + 2, U16(cmap_sub + 2) + num_entries * 2); /* length */
- put_u16(cmap_sub + 14, end_entry - 1); /* endCount[0] */
- put_u16(cmap_sub + 20, first_entry); /* startCount[0] */
- stream_write(s, cmap_sub, sizeof(cmap_sub));
- stream_write(s, entries + first_entry * 2, num_entries * 2);
- put_pad(s, cmap_length);
- return;
- }
+ write_unicode_cmap_6(s, entries, first_code, first_entry, num_entries);
+
+ /* Write the Windows sub-table. */
+ memcpy(cmap_sub, cmap_sub_initial, sizeof(cmap_sub_initial));
+ put_u16(cmap_sub + 2, U16(cmap_sub + 2) + num_entries * 2); /* length */
+ put_u16(cmap_sub + 14, end_entry - 1); /* endCount[0] */
+ put_u16(cmap_sub + 20, first_entry); /* startCount[0] */
+ stream_write(s, cmap_sub, sizeof(cmap_sub));
+ stream_write(s, entries + first_entry * 2, num_entries * 2);
+ put_pad(s, cmap_length);
+ return;
+ }
#if TT_FORCE_CMAP_6 > 0
/* Always use format 6. */
write_cmap_6(s, entries, first_code, first_entry, num_entries);
@@ -400,7 +400,7 @@ write_cmap(stream *s, gs_font *font, uint first_code, int num_glyphs,
# if TT_FORCE_CMAP_6 < 0
/* Never use format 6. Use format 0 if possible. */
if (merge == (byte)merge)
- write_cmap_0(s, entries, num_glyphs);
+ write_cmap_0(s, entries, num_glyphs);
else
# else /* TT_FORCE_CMAP == 0 */
/*
@@ -408,18 +408,18 @@ write_cmap(stream *s, gs_font *font, uint first_code, int num_glyphs,
* otherwise format 6 if allowed.
*/
if (merge == (byte)merge && (num_entries <= 127 || !can_use_trimmed))
- write_cmap_0(s, entries, num_glyphs);
+ write_cmap_0(s, entries, num_glyphs);
else if (can_use_trimmed)
- write_cmap_6(s, entries, first_code, first_entry, num_entries);
+ write_cmap_6(s, entries, first_code, first_entry, num_entries);
else
# endif
{
- /*
- * Punt. Acrobat Reader 3 can't handle any other Mac table format.
- * (AR3 for Linux doesn't seem to be able to handle Windows format,
- * either, but maybe AR3 for Windows can.)
- */
- stream_write(s, cmap_initial_4, sizeof(cmap_initial_4));
+ /*
+ * Punt. Acrobat Reader 3 can't handle any other Mac table format.
+ * (AR3 for Linux doesn't seem to be able to handle Windows format,
+ * either, but maybe AR3 for Windows can.)
+ */
+ stream_write(s, cmap_initial_4, sizeof(cmap_initial_4));
}
#endif
@@ -435,7 +435,7 @@ write_cmap(stream *s, gs_font *font, uint first_code, int num_glyphs,
}
static uint
size_cmap(gs_font *font, uint first_code, int num_glyphs, gs_glyph max_glyph,
- int options)
+ int options)
{
stream poss;
@@ -449,7 +449,7 @@ size_cmap(gs_font *font, uint first_code, int num_glyphs, gs_glyph max_glyph,
static void
write_mtx(stream *s, gs_font_type42 *pfont, const gs_type42_mtx_t *pmtx,
- int wmode)
+ int wmode)
{
uint num_metrics = pmtx->numMetrics;
uint len = num_metrics * 4;
@@ -459,27 +459,27 @@ write_mtx(stream *s, gs_font_type42 *pfont, const gs_type42_mtx_t *pmtx,
sbw[0] = sbw[1] = sbw[2] = sbw[3] = 0; /* in case of failures */
for (i = 0; i < pmtx->numMetrics; ++i) {
- float f;
- DISCARD(pfont->data.get_metrics(pfont, i, wmode, sbw));
- /* the temporary assignment to a float is necessary for AIX else the result is always 0 if sbw[] < 0
- this happens even with gcc and I'm not sure why it happens at all nor why only on AIX */
- f = (float) (sbw[wmode + 2] * factor); /* width */
- put_short(s, (short) floor(f + 0.5));
- f = (float) (sbw[wmode] * factor); /* lsb, may be <0 */
- put_short(s, (short) floor(f + 0.5));
+ float f;
+ DISCARD(pfont->data.get_metrics(pfont, i, wmode, sbw));
+ /* the temporary assignment to a float is necessary for AIX else the result is always 0 if sbw[] < 0
+ this happens even with gcc and I'm not sure why it happens at all nor why only on AIX */
+ f = (float) (sbw[wmode + 2] * factor); /* width */
+ put_short(s, (short) floor(f + 0.5));
+ f = (float) (sbw[wmode] * factor); /* lsb, may be <0 */
+ put_short(s, (short) floor(f + 0.5));
}
for (; len < pmtx->length; ++i, len += 2) {
- float f;
- DISCARD(pfont->data.get_metrics(pfont, i, wmode, sbw));
- f = (float) (sbw[wmode] * factor); /* lsb, may be <0 */
- put_short(s, (short) floor(f + 0.5));
+ float f;
+ DISCARD(pfont->data.get_metrics(pfont, i, wmode, sbw));
+ f = (float) (sbw[wmode] * factor); /* lsb, may be <0 */
+ put_short(s, (short) floor(f + 0.5));
}
}
/* Compute the metrics from the glyph_info. */
static uint
size_mtx(gs_font_type42 *pfont, gs_type42_mtx_t *pmtx, uint max_glyph,
- int wmode)
+ int wmode)
{
int prev_width = min_int;
uint last_width = 0; /* pacify compilers */
@@ -487,15 +487,15 @@ size_mtx(gs_font_type42 *pfont, gs_type42_mtx_t *pmtx, uint max_glyph,
uint i;
for (i = 0; i <= max_glyph; ++i) {
- float sbw[4];
- int code = pfont->data.get_metrics(pfont, i, wmode, sbw);
- int width;
-
- if (code < 0)
- continue;
- width = (int)(sbw[wmode + 2] * factor + 0.5);
- if (width != prev_width)
- prev_width = width, last_width = i;
+ float sbw[4];
+ int code = pfont->data.get_metrics(pfont, i, wmode, sbw);
+ int width;
+
+ if (code < 0)
+ continue;
+ width = (int)(sbw[wmode + 2] * factor + 0.5);
+ if (width != prev_width)
+ prev_width = width, last_width = i;
}
pmtx->numMetrics = last_width + 1;
pmtx->length = pmtx->numMetrics * 4 + (max_glyph - last_width) * 2;
@@ -546,11 +546,11 @@ update_OS_2(ttf_OS_2_t *pos2, uint first_glyph, int num_glyphs)
put_u16(pos2->usLastCharIndex, first_glyph + num_glyphs - 1);
#if TT_ADJUST_OS_2
if (first_glyph >= 0xf000) {
- /* This font is being treated as a symbolic font. */
- memset(pos2->ulUnicodeRanges, 0, sizeof(pos2->ulUnicodeRanges));
- pos2->ulUnicodeRanges[7] = 8; /* bit 60, private use range */
- memset(pos2->ulCodePageRanges, 0, sizeof(pos2->ulCodePageRanges));
- pos2->ulCodePageRanges[3] = 1; /* bit 31, symbolic */
+ /* This font is being treated as a symbolic font. */
+ memset(pos2->ulUnicodeRanges, 0, sizeof(pos2->ulUnicodeRanges));
+ pos2->ulUnicodeRanges[7] = 8; /* bit 60, private use range */
+ memset(pos2->ulCodePageRanges, 0, sizeof(pos2->ulCodePageRanges));
+ pos2->ulCodePageRanges[3] = 1; /* bit 31, symbolic */
}
#endif
}
@@ -581,7 +581,7 @@ write_OS_2(stream *s, gs_font *font, uint first_glyph, int num_glyphs)
memset(&info, 0x00, sizeof(gs_font_info_t));
code = font->procs.font_info(font, NULL, FONT_INFO_EMBEDDING_RIGHTS, &info);
if (code == 0 && (info.members & FONT_INFO_EMBEDDING_RIGHTS)) {
- put_u16(os2.fsType, info.EmbeddingRights);
+ put_u16(os2.fsType, info.EmbeddingRights);
}
stream_write(s, &os2, offset_of(ttf_OS_2_t, sxHeight[0]));
@@ -600,7 +600,7 @@ static int
compare_post_glyphs(const void *pg1, const void *pg2)
{
gs_glyph g1 = ((const post_glyph_t *)pg1)->glyph_index,
- g2 = ((const post_glyph_t *)pg2)->glyph_index;
+ g2 = ((const post_glyph_t *)pg2)->glyph_index;
return (g1 < g2 ? -1 : g1 > g2 ? 1 : 0);
}
@@ -620,39 +620,39 @@ compute_post(gs_font *font, post_t *post)
int i;
for (i = 0, post->length = 32 + 2; i <= 255; ++i) {
- gs_const_string str;
- gs_glyph glyph = font->procs.encode_char(font, (gs_char)i,
- GLYPH_SPACE_INDEX);
- int mac_index;
-
- int code = mac_glyph_index(font, i, &str, &mac_index);
- if (code < 0)
- return code;
- if (mac_index != 0) {
- post->glyphs[post->count].char_index = i;
- post->glyphs[post->count].size =
- (mac_index < 0 ? str.size + 1 : 0);
- post->glyphs[post->count].glyph_index = glyph - GS_MIN_GLYPH_INDEX;
- post->count++;
- }
+ gs_const_string str;
+ gs_glyph glyph = font->procs.encode_char(font, (gs_char)i,
+ GLYPH_SPACE_INDEX);
+ int mac_index;
+
+ int code = mac_glyph_index(font, i, &str, &mac_index);
+ if (code < 0)
+ return code;
+ if (mac_index != 0) {
+ post->glyphs[post->count].char_index = i;
+ post->glyphs[post->count].size =
+ (mac_index < 0 ? str.size + 1 : 0);
+ post->glyphs[post->count].glyph_index = glyph - GS_MIN_GLYPH_INDEX;
+ post->count++;
+ }
}
if (post->count) {
- int j;
-
- qsort(post->glyphs, post->count, sizeof(post->glyphs[0]),
- compare_post_glyphs);
- /* Eliminate duplicate references to the same glyph. */
- for (i = j = 0; i < post->count; ++i) {
- if (i == 0 ||
- post->glyphs[i].glyph_index !=
- post->glyphs[i - 1].glyph_index
- ) {
- post->length += post->glyphs[i].size;
- post->glyphs[j++] = post->glyphs[i];
- }
- }
- post->count = j;
- post->glyph_count = post->glyphs[post->count - 1].glyph_index + 1;
+ int j;
+
+ qsort(post->glyphs, post->count, sizeof(post->glyphs[0]),
+ compare_post_glyphs);
+ /* Eliminate duplicate references to the same glyph. */
+ for (i = j = 0; i < post->count; ++i) {
+ if (i == 0 ||
+ post->glyphs[i].glyph_index !=
+ post->glyphs[i - 1].glyph_index
+ ) {
+ post->length += post->glyphs[i].size;
+ post->glyphs[j++] = post->glyphs[i];
+ }
+ }
+ post->count = j;
+ post->glyph_count = post->glyphs[post->count - 1].glyph_index + 1;
}
post->length += post->glyph_count * 2;
return 0;
@@ -675,47 +675,47 @@ write_post(stream *s, gs_font *font, post_t *post)
/* Write the name index table. */
for (i = 0, name_index = 258, glyph_index = 0; i < post->count; ++i) {
- gs_const_string str;
- int ch = post->glyphs[i].char_index;
- int mac_index;
- int code = mac_glyph_index(font, ch, &str, &mac_index);
-
- if (code < 0)
- return code;
- for (; glyph_index < post->glyphs[i].glyph_index; ++glyph_index)
- put_ushort(s, 0);
- glyph_index++;
- if (mac_index >= 0)
- put_ushort(s, mac_index);
- else {
- put_ushort(s, name_index);
- name_index++;
- }
+ gs_const_string str;
+ int ch = post->glyphs[i].char_index;
+ int mac_index;
+ int code = mac_glyph_index(font, ch, &str, &mac_index);
+
+ if (code < 0)
+ return code;
+ for (; glyph_index < post->glyphs[i].glyph_index; ++glyph_index)
+ put_ushort(s, 0);
+ glyph_index++;
+ if (mac_index >= 0)
+ put_ushort(s, mac_index);
+ else {
+ put_ushort(s, name_index);
+ name_index++;
+ }
}
/* Write the string names of the glyphs. */
for (i = 0; i < post->count; ++i) {
- gs_const_string str;
- int ch = post->glyphs[i].char_index;
- int mac_index;
- int code = mac_glyph_index(font, ch, &str, &mac_index);
-
- if (code < 0)
- return code;
- if (mac_index < 0) {
- spputc(s, (byte)str.size);
- stream_write(s, str.data, str.size);
- }
+ gs_const_string str;
+ int ch = post->glyphs[i].char_index;
+ int mac_index;
+ int code = mac_glyph_index(font, ch, &str, &mac_index);
+
+ if (code < 0)
+ return code;
+ if (mac_index < 0) {
+ spputc(s, (byte)str.size);
+ stream_write(s, str.data, str.size);
+ }
}
put_pad(s, post->length);
return 0;
}
static inline bool check_position(const gs_memory_t *mem, int pos1, int pos2)
-{
+{
if (pos1 == pos2)
- return false;
+ return false;
emprintf2(mem,
"Actual TT subtable offset %d differs from one in the TT header %d.\n",
pos1,
@@ -729,13 +729,13 @@ static void remove_table(byte *tables, char *tag, uint *numTables)
int i;
for (i = 0; i < *numTables;) {
- byte *tab = tables + i * 16;
+ byte *tab = tables + i * 16;
- if (!memcmp(tab, tag, 4)) {
- memmove(tab, tab + 16, 16 * (*numTables - i - 1));
- --*numTables;
- } else
- ++i;
+ if (!memcmp(tab, tag, 4)) {
+ memmove(tab, tab + 16, 16 * (*numTables - i - 1));
+ --*numTables;
+ } else
+ ++i;
}
}
@@ -751,8 +751,8 @@ compare_table_tags(const void *pt1, const void *pt2)
}
static int
psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
- psf_glyph_enum_t *penum, bool is_subset,
- const gs_const_string *alt_font_name)
+ psf_glyph_enum_t *penum, bool is_subset,
+ const gs_const_string *alt_font_name)
{
gs_font *const font = (gs_font *)pfont;
gs_const_string font_name;
@@ -774,21 +774,21 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
ulong head_checksum, file_checksum = 0;
int indexToLocFormat = 0;
bool
- writing_cid = (options & WRITE_TRUETYPE_CID) != 0,
- writing_stripped = (options & WRITE_TRUETYPE_STRIPPED) != 0,
- generate_mtx = (options & WRITE_TRUETYPE_HVMTX) != 0,
- no_generate = writing_cid | writing_stripped,
- have_cmap = no_generate,
- have_name = !(options & WRITE_TRUETYPE_NAME),
- have_OS_2 = no_generate,
- have_post = no_generate;
+ writing_cid = (options & WRITE_TRUETYPE_CID) != 0,
+ writing_stripped = (options & WRITE_TRUETYPE_STRIPPED) != 0,
+ generate_mtx = (options & WRITE_TRUETYPE_HVMTX) != 0,
+ no_generate = writing_cid | writing_stripped,
+ have_cmap = no_generate,
+ have_name = !(options & WRITE_TRUETYPE_NAME),
+ have_OS_2 = no_generate,
+ have_post = no_generate;
int have_hvhea[2];
uint cmap_length = 0;
ulong OS_2_start = 0;
uint OS_2_length = OS_2_LENGTH1;
ulong maxp_start = 0;
uint maxp_length = 0;
- struct { int glyf, loca, cmap, name, os_2, mtx[2], post, head;
+ struct { int glyf, loca, cmap, name, os_2, mtx[2], post, head;
} subtable_positions;
int start_position = stell(s);
int enlarged_numGlyphs = 0;
@@ -798,10 +798,10 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
memset(&subtable_positions, 0, sizeof(subtable_positions));
have_hvhea[0] = have_hvhea[1] = 0;
if (alt_font_name)
- font_name = *alt_font_name;
+ font_name = *alt_font_name;
else
- font_name.data = font->font_name.chars,
- font_name.size = font->font_name.size;
+ font_name.data = font->font_name.chars,
+ font_name.size = font->font_name.size;
/*
* Count the number of tables, including the eventual glyf and loca
@@ -814,94 +814,94 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
READ_SFNTS(pfont, 0, 12, OffsetTable);
if (u32(OffsetTable) == W('t','t','c','f')) {
- READ_SFNTS(pfont, 12, 4, OffsetTable);
- TTCFontOffset = u32(OffsetTable);
- READ_SFNTS(pfont, TTCFontOffset, 12, OffsetTable);
+ READ_SFNTS(pfont, 12, 4, OffsetTable);
+ TTCFontOffset = u32(OffsetTable);
+ READ_SFNTS(pfont, TTCFontOffset, 12, OffsetTable);
}
numTables_stored = U16(OffsetTable + 4);
for (i = numTables = 0; i < numTables_stored; ++i) {
- byte tab[16];
- byte data[54];
- ulong start;
- uint length;
-
- if (numTables == MAX_NUM_TT_TABLES)
- return_error(gs_error_limitcheck);
- READ_SFNTS(pfont, TTCFontOffset + 12 + i * 16, 16, tab);
- start = u32(tab + 8);
- length = u32(tab + 12);
- /* Copy the table data now (a rudiment of old code). */
- memcpy(&tables[numTables * 16], tab, 16);
-
- switch (u32(tab)) {
- case W('h','e','a','d'):
- if (length < 54)
- return_error(gs_error_invalidfont);
- length = 54; /* bug 688409 fig2.eps has length=56. */
- READ_SFNTS(pfont, start, length, data);
- memcpy(head, data, length);
- continue;
- case W('g','l','y','f'): /* synthesized */
- case W('g','l','y','x'): /* Adobe bogus */
- case W('l','o','c','a'): /* synthesized */
- case W('l','o','c','x'): /* Adobe bogus */
- case W('g','d','i','r'): /* Adobe marker */
- continue;
- case W('c','m','a','p'):
- if (options & (WRITE_TRUETYPE_CMAP | WRITE_TRUETYPE_CID))
- continue;
- have_cmap = true;
- break;
- case W('m','a','x','p'):
- READ_SFNTS(pfont, start, length, data);
- numGlyphs = U16(data + 4);
- maxp_start = start;
- maxp_length = length;
- break;
- case W('n','a','m','e'):
- if (writing_cid)
- continue;
- have_name = true;
- break;
- case W('O','S','/','2'):
- if (writing_cid)
- continue;
- have_OS_2 = true;
- if (length > OS_2_LENGTH2)
- return_error(gs_error_invalidfont);
- OS_2_start = start;
- OS_2_length = length;
- continue;
- case W('p','o','s','t'):
- have_post = true;
- break;
- case W('h','h','e','a'):
- have_hvhea[0] = 1;
- break;
- case W('v','h','e','a'):
- have_hvhea[1] = 1;
- break;
- case W('h','m','t','x'):
- case W('v','m','t','x'):
- if (generate_mtx)
- continue;
- /* falls through */
- case W('c','v','t',' '):
- case W('f','p','g','m'):
- case W('g','a','s','p'):
- case W('k','e','r','n'):
- case W('p','r','e','p'):
- break; /* always copy these if present */
- case W('E','B','D','T'):
- case W('E','B','L','C'):
- case W('E','B','S','C'):
- continue;
- default:
- if (writing_cid)
- continue;
- break;
- }
- numTables++;
+ byte tab[16];
+ byte data[54];
+ ulong start;
+ uint length;
+
+ if (numTables == MAX_NUM_TT_TABLES)
+ return_error(gs_error_limitcheck);
+ READ_SFNTS(pfont, TTCFontOffset + 12 + i * 16, 16, tab);
+ start = u32(tab + 8);
+ length = u32(tab + 12);
+ /* Copy the table data now (a rudiment of old code). */
+ memcpy(&tables[numTables * 16], tab, 16);
+
+ switch (u32(tab)) {
+ case W('h','e','a','d'):
+ if (length < 54)
+ return_error(gs_error_invalidfont);
+ length = 54; /* bug 688409 fig2.eps has length=56. */
+ READ_SFNTS(pfont, start, length, data);
+ memcpy(head, data, length);
+ continue;
+ case W('g','l','y','f'): /* synthesized */
+ case W('g','l','y','x'): /* Adobe bogus */
+ case W('l','o','c','a'): /* synthesized */
+ case W('l','o','c','x'): /* Adobe bogus */
+ case W('g','d','i','r'): /* Adobe marker */
+ continue;
+ case W('c','m','a','p'):
+ if (options & (WRITE_TRUETYPE_CMAP | WRITE_TRUETYPE_CID))
+ continue;
+ have_cmap = true;
+ break;
+ case W('m','a','x','p'):
+ READ_SFNTS(pfont, start, length, data);
+ numGlyphs = U16(data + 4);
+ maxp_start = start;
+ maxp_length = length;
+ break;
+ case W('n','a','m','e'):
+ if (writing_cid)
+ continue;
+ have_name = true;
+ break;
+ case W('O','S','/','2'):
+ if (writing_cid)
+ continue;
+ have_OS_2 = true;
+ if (length > OS_2_LENGTH2)
+ return_error(gs_error_invalidfont);
+ OS_2_start = start;
+ OS_2_length = length;
+ continue;
+ case W('p','o','s','t'):
+ have_post = true;
+ break;
+ case W('h','h','e','a'):
+ have_hvhea[0] = 1;
+ break;
+ case W('v','h','e','a'):
+ have_hvhea[1] = 1;
+ break;
+ case W('h','m','t','x'):
+ case W('v','m','t','x'):
+ if (generate_mtx)
+ continue;
+ /* falls through */
+ case W('c','v','t',' '):
+ case W('f','p','g','m'):
+ case W('g','a','s','p'):
+ case W('k','e','r','n'):
+ case W('p','r','e','p'):
+ break; /* always copy these if present */
+ case W('E','B','D','T'):
+ case W('E','B','L','C'):
+ case W('E','B','S','C'):
+ continue;
+ default:
+ if (writing_cid)
+ continue;
+ break;
+ }
+ numTables++;
}
/*
@@ -911,80 +911,80 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/****** NO CHECKSUMS YET ******/
for (max_glyph = 0, glyf_length = 0;
- (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
- ) {
- uint glyph_index;
- gs_glyph_data_t glyph_data;
-
- if (glyph < gs_min_cid_glyph)
- return_error(gs_error_invalidfont);
- glyph_index = glyph & ~GS_GLYPH_TAG;
- if_debug1('L', "[L]glyph_index %u\n", glyph_index);
- glyph_data.memory = pfont->memory;
- if ((code = pfont->data.get_outline(pfont, glyph_index, &glyph_data)) >= 0) {
- /* Since indexToLocFormat==0 assumes even glyph lengths,
- round it up here. If later we choose indexToLocFormat==1,
- subtract the glyf_alignment to compensate it. */
- uint l = (glyph_data.bits.size + 1) & ~1;
-
- max_glyph = max(max_glyph, glyph_index);
- glyf_length += l;
- if (l != glyph_data.bits.size)
- glyf_alignment++;
- if_debug1('L', "[L] size %u\n", glyph_data.bits.size);
- gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
- }
+ (code = psf_enumerate_glyphs_next(penum, &glyph)) != 1;
+ ) {
+ uint glyph_index;
+ gs_glyph_data_t glyph_data;
+
+ if (glyph < gs_min_cid_glyph)
+ return_error(gs_error_invalidfont);
+ glyph_index = glyph & ~GS_GLYPH_TAG;
+ if_debug1('L', "[L]glyph_index %u\n", glyph_index);
+ glyph_data.memory = pfont->memory;
+ if ((code = pfont->data.get_outline(pfont, glyph_index, &glyph_data)) >= 0) {
+ /* Since indexToLocFormat==0 assumes even glyph lengths,
+ round it up here. If later we choose indexToLocFormat==1,
+ subtract the glyf_alignment to compensate it. */
+ uint l = (glyph_data.bits.size + 1) & ~1;
+
+ max_glyph = max(max_glyph, glyph_index);
+ glyf_length += l;
+ if (l != glyph_data.bits.size)
+ glyf_alignment++;
+ if_debug1('L', "[L] size %u\n", glyph_data.bits.size);
+ gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
+ }
}
if (writing_stripped) {
- glyf_length = 0;
- loca_length = 0;
+ glyf_length = 0;
+ loca_length = 0;
} else {
- if (max_glyph + 1 > numGlyphs) {
- /* Either original font is wrong,
- or we added glyphs to it due to font merge.
- Need to adjust maxp, hmtx, vmtx, vdmx, hdmx,
- assuming that the merge doesn't change hhea
- and other tables.
- Since changing hdmx, vdmx is too difficult,
- and since they're not required for PDF,
- we'll simply skip them.
- */
- enlarged_numGlyphs = max_glyph + 1;
- if (enlarged_numGlyphs > 0xFFFF) {
- emprintf1(pfont->memory,
+ if (max_glyph + 1 > numGlyphs) {
+ /* Either original font is wrong,
+ or we added glyphs to it due to font merge.
+ Need to adjust maxp, hmtx, vmtx, vdmx, hdmx,
+ assuming that the merge doesn't change hhea
+ and other tables.
+ Since changing hdmx, vdmx is too difficult,
+ and since they're not required for PDF,
+ we'll simply skip them.
+ */
+ enlarged_numGlyphs = max_glyph + 1;
+ if (enlarged_numGlyphs > 0xFFFF) {
+ emprintf1(pfont->memory,
"The number of glyphs %d exceeds capability of True Type format.\n",
enlarged_numGlyphs);
- return_error(gs_error_unregistered);
- }
- loca_length = (enlarged_numGlyphs + 1) << 2;
- remove_table(tables, (char *)"hdmx", &numTables);
- remove_table(tables, (char *)"vdmx", &numTables);
- } else
- loca_length = (numGlyphs + 1) << 2;
- indexToLocFormat = (glyf_length > 0x1fffc);
- if (!indexToLocFormat)
- loca_length >>= 1;
- else
- glyf_length -= glyf_alignment;
- /* Acrobat Reader won't accept fonts with empty glyfs. */
- if (glyf_length == 0)
- glyf_length = 1;
+ return_error(gs_error_unregistered);
+ }
+ loca_length = (enlarged_numGlyphs + 1) << 2;
+ remove_table(tables, (char *)"hdmx", &numTables);
+ remove_table(tables, (char *)"vdmx", &numTables);
+ } else
+ loca_length = (numGlyphs + 1) << 2;
+ indexToLocFormat = (glyf_length > 0x1fffc);
+ if (!indexToLocFormat)
+ loca_length >>= 1;
+ else
+ glyf_length -= glyf_alignment;
+ /* Acrobat Reader won't accept fonts with empty glyfs. */
+ if (glyf_length == 0)
+ glyf_length = 1;
}
if_debug2('l', "[l]max_glyph = %lu, glyf_length = %lu\n",
- (ulong)max_glyph, (ulong)glyf_length);
+ (ulong)max_glyph, (ulong)glyf_length);
/*
* If necessary, compute the length of the post table. Note that we
* only generate post entries for characters in the Encoding. */
if (!have_post) {
- memset(&post, 0, sizeof(post));
- if (options & WRITE_TRUETYPE_POST) {
- code = compute_post(font, &post);
- if (code < 0)
- return code;
- } else
- post.length = 32; /* dummy table */
+ memset(&post, 0, sizeof(post));
+ if (options & WRITE_TRUETYPE_POST) {
+ code = compute_post(font, &post);
+ if (code < 0)
+ return code;
+ } else
+ post.length = 32; /* dummy table */
}
/* Fix up the head table. */
@@ -993,7 +993,7 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
head[51] = (byte)indexToLocFormat;
memset(head + 54, 0, 2);
for (head_checksum = 0, i = 0; i < 56; i += 4)
- head_checksum += u32(&head[i]);
+ head_checksum += u32(&head[i]);
/*
* Construct the table directory, except for glyf, loca, head, OS/2,
@@ -1002,97 +1002,97 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
*/
numTables_out = numTables + 1 /* head */
- + !writing_stripped * 2 /* glyf, loca */
- + generate_mtx * (have_hvhea[0] + have_hvhea[1]) /* hmtx, vmtx */
- + !have_OS_2 /* OS/2 */
- + !have_cmap + !have_name + !have_post;
+ + !writing_stripped * 2 /* glyf, loca */
+ + generate_mtx * (have_hvhea[0] + have_hvhea[1]) /* hmtx, vmtx */
+ + !have_OS_2 /* OS/2 */
+ + !have_cmap + !have_name + !have_post;
if (numTables_out >= MAX_NUM_TT_TABLES)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
offset = 12 + numTables_out * 16;
for (i = 0; i < numTables; ++i) {
- byte *tab = &tables[i * 16];
- ulong length = u32(tab + 12);
+ byte *tab = &tables[i * 16];
+ ulong length = u32(tab + 12);
- offset += round_up(length, 4);
+ offset += round_up(length, 4);
}
/* Make the table directory entries for generated tables. */
{
- byte *tab = &tables[numTables * 16];
-
- if (!writing_stripped) {
- subtable_positions.glyf = offset;
- offset = put_table(tab, "glyf", glyf_checksum,
- offset, glyf_length);
- tab += 16;
- subtable_positions.loca = offset;
- offset = put_table(tab, "loca", loca_checksum[indexToLocFormat],
- offset, loca_length);
- tab += 16;
- }
-
- if (!have_cmap) {
- cmap_length = size_cmap(font, TT_BIAS, 256,
- GS_MIN_GLYPH_INDEX + max_glyph, options);
- subtable_positions.cmap = offset;
- offset = put_table(tab, "cmap", 0L /****** NO CHECKSUM ******/,
- offset, cmap_length);
- tab += 16;
- }
-
- if (!have_name) {
- subtable_positions.name = offset;
- offset = put_table(tab, "name", 0L /****** NO CHECKSUM ******/,
- offset, size_name(&font_name));
- tab += 16;
- }
-
- if (!no_generate) {
- subtable_positions.os_2 = offset;
- offset = put_table(tab, "OS/2", 0L /****** NO CHECKSUM ******/,
- offset, OS_2_length);
- tab += 16;
- }
-
- if (generate_mtx)
- for (i = 0; i < 2; ++i)
- if (have_hvhea[i]) {
- subtable_positions.mtx[i] = offset;
- offset = put_table(tab, (i ? "vmtx" : "hmtx"),
- 0L /****** NO CHECKSUM ******/,
- offset,
- size_mtx(pfont, &mtx[i], max_glyph, i));
- tab += 16;
- }
-
- if (!have_post) {
- subtable_positions.post = offset;
- offset = put_table(tab, "post", 0L /****** NO CHECKSUM ******/,
- offset, post.length);
- tab += 16;
- }
-
- /*
- * Note that the 'head' table must have length 54, even though
- * it occupies 56 bytes on the file.
- */
- subtable_positions.head = offset;
- offset = put_table(tab, "head", head_checksum, offset, 54);
- tab += 16;
+ byte *tab = &tables[numTables * 16];
+
+ if (!writing_stripped) {
+ subtable_positions.glyf = offset;
+ offset = put_table(tab, "glyf", glyf_checksum,
+ offset, glyf_length);
+ tab += 16;
+ subtable_positions.loca = offset;
+ offset = put_table(tab, "loca", loca_checksum[indexToLocFormat],
+ offset, loca_length);
+ tab += 16;
+ }
+
+ if (!have_cmap) {
+ cmap_length = size_cmap(font, TT_BIAS, 256,
+ GS_MIN_GLYPH_INDEX + max_glyph, options);
+ subtable_positions.cmap = offset;
+ offset = put_table(tab, "cmap", 0L /****** NO CHECKSUM ******/,
+ offset, cmap_length);
+ tab += 16;
+ }
+
+ if (!have_name) {
+ subtable_positions.name = offset;
+ offset = put_table(tab, "name", 0L /****** NO CHECKSUM ******/,
+ offset, size_name(&font_name));
+ tab += 16;
+ }
+
+ if (!no_generate) {
+ subtable_positions.os_2 = offset;
+ offset = put_table(tab, "OS/2", 0L /****** NO CHECKSUM ******/,
+ offset, OS_2_length);
+ tab += 16;
+ }
+
+ if (generate_mtx)
+ for (i = 0; i < 2; ++i)
+ if (have_hvhea[i]) {
+ subtable_positions.mtx[i] = offset;
+ offset = put_table(tab, (i ? "vmtx" : "hmtx"),
+ 0L /****** NO CHECKSUM ******/,
+ offset,
+ size_mtx(pfont, &mtx[i], max_glyph, i));
+ tab += 16;
+ }
+
+ if (!have_post) {
+ subtable_positions.post = offset;
+ offset = put_table(tab, "post", 0L /****** NO CHECKSUM ******/,
+ offset, post.length);
+ tab += 16;
+ }
+
+ /*
+ * Note that the 'head' table must have length 54, even though
+ * it occupies 56 bytes on the file.
+ */
+ subtable_positions.head = offset;
+ offset = put_table(tab, "head", head_checksum, offset, 54);
+ tab += 16;
}
numTables = numTables_out;
/* Write the font header. */
{
- static const byte version[4] = {0, 1, 0, 0};
+ static const byte version[4] = {0, 1, 0, 0};
- stream_write(s, version, 4);
+ stream_write(s, version, 4);
}
put_ushort(s, numTables);
for (i = 0; 1 << i <= numTables; ++i)
- DO_NOTHING;
+ DO_NOTHING;
--i;
put_ushort(s, 16 << i); /* searchRange */
put_ushort(s, i); /* entrySelectors */
@@ -1103,206 +1103,206 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
qsort(tables, numTables, 16, compare_table_tags);
offset = 12 + numTables * 16;
for (i = 0; i < numTables; ++i) {
- const byte *tab = &tables[i * 16];
- byte entry[16];
-
- memcpy(entry, tab, 16);
- if (entry[8] < 0x40) {
- /* Not a generated table. */
- uint length = u32(tab + 12);
-
- put_u32(entry + 8, offset);
- offset += round_up(length, 4);
- } else {
- entry[8] -= 0x40;
- }
- stream_write(s, entry, 16);
+ const byte *tab = &tables[i * 16];
+ byte entry[16];
+
+ memcpy(entry, tab, 16);
+ if (entry[8] < 0x40) {
+ /* Not a generated table. */
+ uint length = u32(tab + 12);
+
+ put_u32(entry + 8, offset);
+ offset += round_up(length, 4);
+ } else {
+ entry[8] -= 0x40;
+ }
+ stream_write(s, entry, 16);
}
/* Write tables other than the ones we generate here. */
for (i = 0; i < numTables; ++i) {
- const byte *tab = &tables[i * 16];
-
- if (tab[8] < 0x40) {
- ulong start = u32(tab + 8);
- uint length = u32(tab + 12);
-
- switch (u32(tab)) {
- case W('O','S','/','2'):
- if (!have_cmap) {
- /*
- * Adjust the first and last character indices in the OS/2
- * table to reflect the values in the generated cmap.
- */
- byte pos2[OS_2_LENGTH2];
- ttf_OS_2_t os2;
-
- READ_SFNTS(pfont, OS_2_start, OS_2_length, pos2);
- memcpy(&os2, pos2, min(OS_2_length, sizeof(os2)));
- update_OS_2(&os2, TT_BIAS, 256);
- stream_write(s, &os2, OS_2_length);
- put_pad(s, OS_2_length);
- } else {
- /* Just copy the existing OS/2 table. */
- write_range(s, pfont, OS_2_start, OS_2_length);
- put_pad(s, OS_2_length);
- }
- break;
- case W('m','a','x','p'):
- if (enlarged_numGlyphs) {
- /* Must keep the table size. */
- byte buf[6];
-
- READ_SFNTS(pfont, maxp_start, sizeof(buf), buf);
- put_u16(buf + 4, enlarged_numGlyphs);
- stream_write(s, buf, min(length, sizeof(buf)));
- if (length > sizeof(buf)) /* Paranoid Safety */
- write_range(s, pfont, start + sizeof(buf), length - sizeof(buf));
- } else
- write_range(s, pfont, start, length);
- break;
- case W('h','h','e','a'):
- case W('v','h','e','a'):
- if (generate_mtx) {
- write_range(s, pfont, start, length - 2); /* 34 */
- put_ushort(s, mtx[tab[0] == 'v'].numMetrics);
- break;
- }
- /* falls through */
- default:
- write_range(s, pfont, start, length);
- }
- put_pad(s, length);
- }
+ const byte *tab = &tables[i * 16];
+
+ if (tab[8] < 0x40) {
+ ulong start = u32(tab + 8);
+ uint length = u32(tab + 12);
+
+ switch (u32(tab)) {
+ case W('O','S','/','2'):
+ if (!have_cmap) {
+ /*
+ * Adjust the first and last character indices in the OS/2
+ * table to reflect the values in the generated cmap.
+ */
+ byte pos2[OS_2_LENGTH2];
+ ttf_OS_2_t os2;
+
+ READ_SFNTS(pfont, OS_2_start, OS_2_length, pos2);
+ memcpy(&os2, pos2, min(OS_2_length, sizeof(os2)));
+ update_OS_2(&os2, TT_BIAS, 256);
+ stream_write(s, &os2, OS_2_length);
+ put_pad(s, OS_2_length);
+ } else {
+ /* Just copy the existing OS/2 table. */
+ write_range(s, pfont, OS_2_start, OS_2_length);
+ put_pad(s, OS_2_length);
+ }
+ break;
+ case W('m','a','x','p'):
+ if (enlarged_numGlyphs) {
+ /* Must keep the table size. */
+ byte buf[6];
+
+ READ_SFNTS(pfont, maxp_start, sizeof(buf), buf);
+ put_u16(buf + 4, enlarged_numGlyphs);
+ stream_write(s, buf, min(length, sizeof(buf)));
+ if (length > sizeof(buf)) /* Paranoid Safety */
+ write_range(s, pfont, start + sizeof(buf), length - sizeof(buf));
+ } else
+ write_range(s, pfont, start, length);
+ break;
+ case W('h','h','e','a'):
+ case W('v','h','e','a'):
+ if (generate_mtx) {
+ write_range(s, pfont, start, length - 2); /* 34 */
+ put_ushort(s, mtx[tab[0] == 'v'].numMetrics);
+ break;
+ }
+ /* falls through */
+ default:
+ write_range(s, pfont, start, length);
+ }
+ put_pad(s, length);
+ }
}
if (!writing_stripped) {
- int n = max(numGlyphs, enlarged_numGlyphs) + 1;
+ int n = max(numGlyphs, enlarged_numGlyphs) + 1;
- /* Write glyf. */
+ /* Write glyf. */
- if (check_position(pfont->memory,
+ if (check_position(pfont->memory,
subtable_positions.glyf + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- psf_enumerate_glyphs_reset(penum);
- for (offset = 0; psf_enumerate_glyphs_next(penum, &glyph) != 1; ) {
- gs_glyph_data_t glyph_data;
-
- glyph_data.memory = pfont->memory;
- if ((code = pfont->data.get_outline(pfont,
- glyph & ~GS_GLYPH_TAG,
- &glyph_data)) >= 0
- ) {
- uint l = glyph_data.bits.size, zero = 0;
-
- if (!indexToLocFormat)
- l = (l + 1) & ~1;
- stream_write(s, glyph_data.bits.data, glyph_data.bits.size);
- if (glyph_data.bits.size < l)
- stream_write(s, &zero, 1);
- offset += l;
- if_debug2('L', "[L]glyf index = %u, size = %u\n",
- i, glyph_data.bits.size);
- gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
- }
- }
- if_debug1('l', "[l]glyf final offset = %lu\n", offset);
- /* Add a dummy byte if necessary to make glyf non-empty. */
- while (offset < glyf_length)
- stream_putc(s, 0), ++offset;
- put_pad(s, (uint)offset);
-
- /* Write loca. */
-
- if (check_position(pfont->memory,
+ return_error(gs_error_unregistered);
+ psf_enumerate_glyphs_reset(penum);
+ for (offset = 0; psf_enumerate_glyphs_next(penum, &glyph) != 1; ) {
+ gs_glyph_data_t glyph_data;
+
+ glyph_data.memory = pfont->memory;
+ if ((code = pfont->data.get_outline(pfont,
+ glyph & ~GS_GLYPH_TAG,
+ &glyph_data)) >= 0
+ ) {
+ uint l = glyph_data.bits.size, zero = 0;
+
+ if (!indexToLocFormat)
+ l = (l + 1) & ~1;
+ stream_write(s, glyph_data.bits.data, glyph_data.bits.size);
+ if (glyph_data.bits.size < l)
+ stream_write(s, &zero, 1);
+ offset += l;
+ if_debug2('L', "[L]glyf index = %u, size = %u\n",
+ i, glyph_data.bits.size);
+ gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
+ }
+ }
+ if_debug1('l', "[l]glyf final offset = %lu\n", offset);
+ /* Add a dummy byte if necessary to make glyf non-empty. */
+ while (offset < glyf_length)
+ stream_putc(s, 0), ++offset;
+ put_pad(s, (uint)offset);
+
+ /* Write loca. */
+
+ if (check_position(pfont->memory,
subtable_positions.loca + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- psf_enumerate_glyphs_reset(penum);
- glyph_prev = 0;
- for (offset = 0; psf_enumerate_glyphs_next(penum, &glyph) != 1; ) {
- gs_glyph_data_t glyph_data;
- uint glyph_index = glyph & ~GS_GLYPH_TAG;
-
- for (; glyph_prev <= glyph_index; ++glyph_prev)
- put_loca(s, offset, indexToLocFormat);
- glyph_data.memory = pfont->memory;
- if ((code = pfont->data.get_outline(pfont, glyph_index,
- &glyph_data)) >= 0
- ) {
- uint l = glyph_data.bits.size;
-
- if (!indexToLocFormat)
- l = (l + 1) & ~1;
- offset += l;
- gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
- }
-
- }
- /* Pad to numGlyphs + 1 entries (including the trailing entry). */
- for (; glyph_prev < n; ++glyph_prev)
- put_loca(s, offset, indexToLocFormat);
- put_pad(s, loca_length);
-
- /* If necessary, write cmap, name, and OS/2. */
-
- if (!have_cmap) {
- if (check_position(pfont->memory,
+ return_error(gs_error_unregistered);
+ psf_enumerate_glyphs_reset(penum);
+ glyph_prev = 0;
+ for (offset = 0; psf_enumerate_glyphs_next(penum, &glyph) != 1; ) {
+ gs_glyph_data_t glyph_data;
+ uint glyph_index = glyph & ~GS_GLYPH_TAG;
+
+ for (; glyph_prev <= glyph_index; ++glyph_prev)
+ put_loca(s, offset, indexToLocFormat);
+ glyph_data.memory = pfont->memory;
+ if ((code = pfont->data.get_outline(pfont, glyph_index,
+ &glyph_data)) >= 0
+ ) {
+ uint l = glyph_data.bits.size;
+
+ if (!indexToLocFormat)
+ l = (l + 1) & ~1;
+ offset += l;
+ gs_glyph_data_free(&glyph_data, "psf_write_truetype_data");
+ }
+
+ }
+ /* Pad to numGlyphs + 1 entries (including the trailing entry). */
+ for (; glyph_prev < n; ++glyph_prev)
+ put_loca(s, offset, indexToLocFormat);
+ put_pad(s, loca_length);
+
+ /* If necessary, write cmap, name, and OS/2. */
+
+ if (!have_cmap) {
+ if (check_position(pfont->memory,
subtable_positions.cmap + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- write_cmap(s, font, TT_BIAS, 256, GS_MIN_GLYPH_INDEX + max_glyph,
- options, cmap_length);
- }
- if (!have_name) {
- if (check_position(pfont->memory,
+ return_error(gs_error_unregistered);
+ write_cmap(s, font, TT_BIAS, 256, GS_MIN_GLYPH_INDEX + max_glyph,
+ options, cmap_length);
+ }
+ if (!have_name) {
+ if (check_position(pfont->memory,
subtable_positions.name + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- write_name(s, &font_name);
- }
- if (!have_OS_2) {
- if (check_position(pfont->memory,
+ return_error(gs_error_unregistered);
+ write_name(s, &font_name);
+ }
+ if (!have_OS_2) {
+ if (check_position(pfont->memory,
subtable_positions.os_2 + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- write_OS_2(s, font, TT_BIAS, 256);
- }
+ return_error(gs_error_unregistered);
+ write_OS_2(s, font, TT_BIAS, 256);
+ }
- /* If necessary, write [hv]mtx. */
+ /* If necessary, write [hv]mtx. */
- if (generate_mtx)
- for (i = 0; i < 2; ++i)
- if (have_hvhea[i]) {
- if (check_position(pfont->memory,
+ if (generate_mtx)
+ for (i = 0; i < 2; ++i)
+ if (have_hvhea[i]) {
+ if (check_position(pfont->memory,
subtable_positions.mtx[i] + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- write_mtx(s, pfont, &mtx[i], i);
- put_pad(s, mtx[i].length);
- }
+ return_error(gs_error_unregistered);
+ write_mtx(s, pfont, &mtx[i], i);
+ put_pad(s, mtx[i].length);
+ }
- /* If necessary, write post. */
+ /* If necessary, write post. */
- if (!have_post) {
- if (check_position(pfont->memory,
+ if (!have_post) {
+ if (check_position(pfont->memory,
subtable_positions.post + start_position,
stell(s)))
- return_error(gs_error_unregistered);
- if (options & WRITE_TRUETYPE_POST) {
- code = write_post(s, font, &post);
- if (code < 0)
- return code;
- } else {
- byte post_initial[32 + 2];
-
- memset(post_initial, 0, 32);
- put_u32(post_initial, 0x00030000);
- stream_write(s, post_initial, 32);
- }
- }
+ return_error(gs_error_unregistered);
+ if (options & WRITE_TRUETYPE_POST) {
+ code = write_post(s, font, &post);
+ if (code < 0)
+ return code;
+ } else {
+ byte post_initial[32 + 2];
+
+ memset(post_initial, 0, 32);
+ put_u32(post_initial, 0x00030000);
+ stream_write(s, post_initial, 32);
+ }
+ }
}
/* Write head. */
@@ -1322,7 +1322,7 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
if (check_position(pfont->memory,
subtable_positions.head + start_position,
stell(s)))
- return_error(gs_error_unregistered);
+ return_error(gs_error_unregistered);
stream_write(s, head, 56);
return 0;
@@ -1331,8 +1331,8 @@ psf_write_truetype_data(stream *s, gs_font_type42 *pfont, int options,
/* Write a TrueType font. */
int
psf_write_truetype_font(stream *s, gs_font_type42 *pfont, int options,
- gs_glyph *orig_subset_glyphs, uint orig_subset_size,
- const gs_const_string *alt_font_name)
+ gs_glyph *orig_subset_glyphs, uint orig_subset_size,
+ const gs_const_string *alt_font_name)
{
gs_font *const font = (gs_font *)pfont;
psf_glyph_enum_t genum;
@@ -1343,25 +1343,25 @@ psf_write_truetype_font(stream *s, gs_font_type42 *pfont, int options,
/* Sort the subset glyphs, if any. */
if (subset_glyphs) {
- /* Add the component glyphs for composites. */
- int code;
-
- memcpy(subset_data, orig_subset_glyphs,
- sizeof(gs_glyph) * subset_size);
- subset_glyphs = subset_data;
- code = psf_add_subset_pieces(subset_glyphs, &subset_size,
- countof(subset_data),
- countof(subset_data),
- font);
- if (code < 0)
- return code;
- subset_size = psf_sort_glyphs(subset_glyphs, subset_size);
+ /* Add the component glyphs for composites. */
+ int code;
+
+ memcpy(subset_data, orig_subset_glyphs,
+ sizeof(gs_glyph) * subset_size);
+ subset_glyphs = subset_data;
+ code = psf_add_subset_pieces(subset_glyphs, &subset_size,
+ countof(subset_data),
+ countof(subset_data),
+ font);
+ if (code < 0)
+ return code;
+ subset_size = psf_sort_glyphs(subset_glyphs, subset_size);
}
psf_enumerate_glyphs_begin(&genum, font, subset_glyphs,
- (subset_glyphs ? subset_size : 0),
- GLYPH_SPACE_INDEX);
+ (subset_glyphs ? subset_size : 0),
+ GLYPH_SPACE_INDEX);
return psf_write_truetype_data(s, pfont, options & ~WRITE_TRUETYPE_CID,
- &genum, subset_glyphs != 0, alt_font_name);
+ &genum, subset_glyphs != 0, alt_font_name);
}
/* Write a stripped TrueType font. */
int
@@ -1371,26 +1371,26 @@ psf_write_truetype_stripped(stream *s, gs_font_type42 *pfont)
byte no_subset = 0;
psf_enumerate_bits_begin(&genum, (gs_font *)pfont, &no_subset, 0,
- GLYPH_SPACE_INDEX);
+ GLYPH_SPACE_INDEX);
return psf_write_truetype_data(s, pfont, WRITE_TRUETYPE_STRIPPED,
- &genum, true, NULL);
+ &genum, true, NULL);
}
/* Write a CIDFontType 2 font. */
int
psf_write_cid2_font(stream *s, gs_font_cid2 *pfont, int options,
- const byte *subset_bits, uint subset_size,
- const gs_const_string *alt_font_name)
+ const byte *subset_bits, uint subset_size,
+ const gs_const_string *alt_font_name)
{
gs_font *const font = (gs_font *)pfont;
psf_glyph_enum_t genum;
psf_enumerate_bits_begin(&genum, font, subset_bits,
- (subset_bits ? subset_size : 0),
- GLYPH_SPACE_INDEX);
+ (subset_bits ? subset_size : 0),
+ GLYPH_SPACE_INDEX);
return psf_write_truetype_data(s, (gs_font_type42 *)font,
- options | WRITE_TRUETYPE_CID, &genum,
- subset_bits != 0, alt_font_name);
+ options | WRITE_TRUETYPE_CID, &genum,
+ subset_bits != 0, alt_font_name);
}
/* Write a stripped CIDFontType 2 font. */
@@ -1402,9 +1402,9 @@ psf_write_cid2_stripped(stream *s, gs_font_cid2 *pfont)
byte no_subset = 0;
psf_enumerate_bits_begin(&genum, font, &no_subset, 0,
- GLYPH_SPACE_INDEX);
+ GLYPH_SPACE_INDEX);
return psf_write_truetype_data(s, (gs_font_type42 *)font,
- WRITE_TRUETYPE_STRIPPED |
- WRITE_TRUETYPE_CID,
- &genum, true, NULL);
+ WRITE_TRUETYPE_STRIPPED |
+ WRITE_TRUETYPE_CID,
+ &genum, true, NULL);
}
diff --git a/gs/base/gdevpsfu.c b/gs/base/gdevpsfu.c
index ce11da0e7..dfa841ed8 100644
--- a/gs/base/gdevpsfu.c
+++ b/gs/base/gdevpsfu.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,7 +28,7 @@ enumerate_font_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph)
gs_font *font = ppge->font;
int index = (int)ppge->index;
int code = font->procs.enumerate_glyph(font, &index,
- ppge->glyph_space, pglyph);
+ ppge->glyph_space, pglyph);
ppge->index = index;
return (index == 0 ? 1 : code < 0 ? code : 0);
@@ -37,7 +37,7 @@ static int
enumerate_glyphs_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph)
{
if (ppge->index >= ppge->subset.size)
- return 1;
+ return 1;
*pglyph = ppge->subset.selected.list[ppge->index++];
return 0;
}
@@ -45,22 +45,22 @@ static int
enumerate_range_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph)
{
if (ppge->index >= ppge->subset.size)
- return 1;
+ return 1;
*pglyph = (gs_glyph)(ppge->index++ + gs_min_cid_glyph);
return 0;
}
void
psf_enumerate_list_begin(psf_glyph_enum_t *ppge, gs_font *font,
- const gs_glyph *subset_list, uint subset_size,
- gs_glyph_space_t glyph_space)
+ const gs_glyph *subset_list, uint subset_size,
+ gs_glyph_space_t glyph_space)
{
ppge->font = font;
ppge->subset.selected.list = subset_list;
ppge->subset.size = subset_size;
ppge->glyph_space = glyph_space;
ppge->enumerate_next =
- (subset_list ? enumerate_glyphs_next :
- subset_size ? enumerate_range_next : enumerate_font_next);
+ (subset_list ? enumerate_glyphs_next :
+ subset_size ? enumerate_range_next : enumerate_font_next);
psf_enumerate_glyphs_reset(ppge);
}
@@ -69,24 +69,24 @@ static int
enumerate_bits_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph)
{
for (; ppge->index < ppge->subset.size; ppge->index++)
- if (ppge->subset.selected.bits[ppge->index >> 3] & (0x80 >> (ppge->index & 7))) {
- *pglyph = (gs_glyph)(ppge->index++ + gs_min_cid_glyph);
- return 0;
- }
+ if (ppge->subset.selected.bits[ppge->index >> 3] & (0x80 >> (ppge->index & 7))) {
+ *pglyph = (gs_glyph)(ppge->index++ + gs_min_cid_glyph);
+ return 0;
+ }
return 1;
}
void
psf_enumerate_bits_begin(psf_glyph_enum_t *ppge, gs_font *font,
- const byte *subset_bits, uint subset_size,
- gs_glyph_space_t glyph_space)
+ const byte *subset_bits, uint subset_size,
+ gs_glyph_space_t glyph_space)
{
ppge->font = font;
ppge->subset.selected.bits = subset_bits;
ppge->subset.size = subset_size;
ppge->glyph_space = glyph_space;
ppge->enumerate_next =
- (subset_bits ? enumerate_bits_next :
- subset_size ? enumerate_range_next : enumerate_font_next);
+ (subset_bits ? enumerate_bits_next :
+ subset_size ? enumerate_range_next : enumerate_font_next);
psf_enumerate_glyphs_reset(ppge);
}
@@ -113,30 +113,30 @@ psf_enumerate_glyphs_next(psf_glyph_enum_t *ppge, gs_glyph *pglyph)
*/
int
psf_add_subset_pieces(gs_glyph *glyphs, uint *pcount, uint max_count,
- uint max_pieces, gs_font *font)
+ uint max_pieces, gs_font *font)
{
uint i;
uint count = *pcount;
for (i = 0; i < count; ++i) {
- gs_glyph_info_t info;
- int code;
-
- if (count + max_pieces > max_count) {
- /* Check first to make sure there is enough room. */
- code = font->procs.glyph_info(font, glyphs[i], NULL,
- GLYPH_INFO_NUM_PIECES, &info);
- if (code < 0)
- continue;
- if (count + info.num_pieces > max_count)
- return_error(gs_error_rangecheck);
- }
- info.pieces = &glyphs[count];
- code = font->procs.glyph_info(font, glyphs[i], NULL,
- GLYPH_INFO_NUM_PIECES |
- GLYPH_INFO_PIECES, &info);
- if (code >= 0)
- count += info.num_pieces;
+ gs_glyph_info_t info;
+ int code;
+
+ if (count + max_pieces > max_count) {
+ /* Check first to make sure there is enough room. */
+ code = font->procs.glyph_info(font, glyphs[i], NULL,
+ GLYPH_INFO_NUM_PIECES, &info);
+ if (code < 0)
+ continue;
+ if (count + info.num_pieces > max_count)
+ return_error(gs_error_rangecheck);
+ }
+ info.pieces = &glyphs[count];
+ code = font->procs.glyph_info(font, glyphs[i], NULL,
+ GLYPH_INFO_NUM_PIECES |
+ GLYPH_INFO_PIECES, &info);
+ if (code >= 0)
+ count += info.num_pieces;
}
*pcount = count;
return 0;
@@ -160,8 +160,8 @@ psf_sort_glyphs(gs_glyph *glyphs, int count)
qsort(glyphs, count, sizeof(*glyphs), compare_glyphs);
for (i = n = 0; i < count; ++i)
- if (i == 0 || glyphs[i] != glyphs[i - 1])
- glyphs[n++] = glyphs[i];
+ if (i == 0 || glyphs[i] != glyphs[i - 1])
+ glyphs[n++] = glyphs[i];
return n;
}
@@ -175,20 +175,20 @@ psf_sorted_glyphs_index_of(const gs_glyph *glyphs, int count, gs_glyph glyph)
int lo = 0, hi = count - 1;
if (hi < 0)
- return -1;
+ return -1;
if (glyph < glyphs[0] || glyph > glyphs[hi])
- return -1;
+ return -1;
/*
* Loop invariants: hi > lo;
* glyphs[lo] <= glyph <= glyphs[hi].
*/
while (hi - lo > 1) {
- int mid = (lo + hi) >> 1;
+ int mid = (lo + hi) >> 1;
- if (glyph >= glyphs[mid])
- lo = mid;
- else
- hi = mid;
+ if (glyph >= glyphs[mid])
+ lo = mid;
+ else
+ hi = mid;
}
return (glyph == glyphs[lo] ? lo : glyph == glyphs[hi] ? hi : -1);
}
@@ -202,146 +202,146 @@ psf_sorted_glyphs_include(const gs_glyph *glyphs, int count, gs_glyph glyph)
/* Check that all selected glyphs can be written. */
int
psf_check_outline_glyphs(gs_font_base *pfont, psf_glyph_enum_t *ppge,
- glyph_data_proc_t glyph_data)
+ glyph_data_proc_t glyph_data)
{
uint members = GLYPH_INFO_WIDTH0 << pfont->WMode;
gs_glyph glyph;
int code, good_glyphs = 0;
while ((code = psf_enumerate_glyphs_next(ppge, &glyph)) != 1) {
- gs_glyph_data_t gdata;
- gs_font_type1 *ignore_font;
- gs_glyph_info_t info;
-
- if (code < 0)
- return code;
- gdata.memory = pfont->memory;
- code = glyph_data(pfont, glyph, &gdata, &ignore_font);
- /*
- * If the glyph isn't defined by a CharString, glyph_data will
- * return a typecheck error. But if there's merely a glyph in
- * in the Encoding that isn't defined, glyph_data will return an
- * undefined error, which is OK.
- */
- if (code < 0) {
- if (code == gs_error_undefined)
- continue;
- return code;
- }
- gs_glyph_data_free(&gdata, "psf_check_outline_glyphs");
- /*
- * If the font has a CDevProc or calls a non-standard OtherSubr,
- * glyph_info will return a rangecheck error.
- */
- code = pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL,
- members, &info);
-
- /* It may be that a single glyph is bad (eg no (h)sbw), we'll ignore it */
- /* here, the glyph may not be included in any subset, or not used at all */
- /* (ie the /.notdef). If an invalid glyoh is actually used then the text */
- /* processing will still signal an error causing the document to fail. */
- if(code == gs_error_invalidfont)
- continue;
-
- if (code < 0)
- return code;
- good_glyphs++;
+ gs_glyph_data_t gdata;
+ gs_font_type1 *ignore_font;
+ gs_glyph_info_t info;
+
+ if (code < 0)
+ return code;
+ gdata.memory = pfont->memory;
+ code = glyph_data(pfont, glyph, &gdata, &ignore_font);
+ /*
+ * If the glyph isn't defined by a CharString, glyph_data will
+ * return a typecheck error. But if there's merely a glyph in
+ * in the Encoding that isn't defined, glyph_data will return an
+ * undefined error, which is OK.
+ */
+ if (code < 0) {
+ if (code == gs_error_undefined)
+ continue;
+ return code;
+ }
+ gs_glyph_data_free(&gdata, "psf_check_outline_glyphs");
+ /*
+ * If the font has a CDevProc or calls a non-standard OtherSubr,
+ * glyph_info will return a rangecheck error.
+ */
+ code = pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL,
+ members, &info);
+
+ /* It may be that a single glyph is bad (eg no (h)sbw), we'll ignore it */
+ /* here, the glyph may not be included in any subset, or not used at all */
+ /* (ie the /.notdef). If an invalid glyoh is actually used then the text */
+ /* processing will still signal an error causing the document to fail. */
+ if(code == gs_error_invalidfont)
+ continue;
+
+ if (code < 0)
+ return code;
+ good_glyphs++;
}
if(good_glyphs)
- return 0;
+ return 0;
else
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
}
/* Gather glyph information for a Type 1 or Type 2 font. */
int
psf_get_outline_glyphs(psf_outline_glyphs_t *pglyphs, gs_font_base *pfont,
- gs_glyph *orig_subset_glyphs, uint orig_subset_size,
- glyph_data_proc_t glyph_data)
+ gs_glyph *orig_subset_glyphs, uint orig_subset_size,
+ glyph_data_proc_t glyph_data)
{
gs_glyph notdef = gs_no_glyph;
gs_glyph *subset_glyphs = orig_subset_glyphs;
uint subset_size = orig_subset_size;
if (subset_glyphs) {
- if (subset_size > countof(pglyphs->subset_data))
- return_error(gs_error_limitcheck);
- memcpy(pglyphs->subset_data, orig_subset_glyphs,
- sizeof(gs_glyph) * subset_size);
- subset_glyphs = pglyphs->subset_data;
+ if (subset_size > countof(pglyphs->subset_data))
+ return_error(gs_error_limitcheck);
+ memcpy(pglyphs->subset_data, orig_subset_glyphs,
+ sizeof(gs_glyph) * subset_size);
+ subset_glyphs = pglyphs->subset_data;
}
{
- /*
- * Make sure that this font can be written out. Specifically, it
- * must have no CharStrings defined by PostScript procedures, no
- * non-standard OtherSubrs, and no CDevProc.
- */
- psf_glyph_enum_t genum;
- int code;
-
- psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, subset_glyphs,
- (subset_glyphs ? subset_size : 0),
- GLYPH_SPACE_NAME);
- code = psf_check_outline_glyphs(pfont, &genum, glyph_data);
- if (code < 0)
- return code;
+ /*
+ * Make sure that this font can be written out. Specifically, it
+ * must have no CharStrings defined by PostScript procedures, no
+ * non-standard OtherSubrs, and no CDevProc.
+ */
+ psf_glyph_enum_t genum;
+ int code;
+
+ psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, subset_glyphs,
+ (subset_glyphs ? subset_size : 0),
+ GLYPH_SPACE_NAME);
+ code = psf_check_outline_glyphs(pfont, &genum, glyph_data);
+ if (code < 0)
+ return code;
}
{
- /*
- * Detect the .notdef glyph, needed for subset fonts and to
- * eliminate unnecessary Encoding assignments.
- */
- psf_glyph_enum_t genum;
- gs_glyph glyph;
- int code;
-
- psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, NULL, 0,
- GLYPH_SPACE_NAME);
- while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1) {
- if (gs_font_glyph_is_notdef(pfont, glyph)) {
- notdef = glyph;
- break;
- }
- }
+ /*
+ * Detect the .notdef glyph, needed for subset fonts and to
+ * eliminate unnecessary Encoding assignments.
+ */
+ psf_glyph_enum_t genum;
+ gs_glyph glyph;
+ int code;
+
+ psf_enumerate_glyphs_begin(&genum, (gs_font *)pfont, NULL, 0,
+ GLYPH_SPACE_NAME);
+ while ((code = psf_enumerate_glyphs_next(&genum, &glyph)) != 1) {
+ if (gs_font_glyph_is_notdef(pfont, glyph)) {
+ notdef = glyph;
+ break;
+ }
+ }
}
if (subset_glyphs) {
- /*
- * For subset fonts, we must ensure that characters referenced
- * by seac are also included. Note that seac creates at most
- * 2 pieces.
- */
- int code = psf_add_subset_pieces(subset_glyphs, &subset_size,
- countof(pglyphs->subset_data) - 1, 2,
- (gs_font *)pfont);
- uint keep_size, i;
-
- if (code < 0)
- return code;
- /* Subset fonts require .notdef. */
- if (notdef == gs_no_glyph)
- return_error(gs_error_rangecheck);
- /* Remove undefined glyphs. */
- for (i = 0, keep_size = 0; i < subset_size; ++i) {
- gs_glyph_info_t info;
- gs_glyph glyph = subset_glyphs[i];
-
- /*
- * The documentation for the glyph_info procedure says that
- * using members = 0 is an inexpensive way to find out
- * whether a given glyph exists, but the implementations
- * don't actually do this. Request an inexpensive value.
- */
- if (pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL,
- GLYPH_INFO_NUM_PIECES, &info) >= 0)
- subset_glyphs[keep_size++] = glyph;
- }
- subset_size = keep_size;
- /* Sort the glyphs. Make sure .notdef is included. */
- subset_glyphs[subset_size++] = notdef;
- subset_size = psf_sort_glyphs(subset_glyphs, subset_size);
+ /*
+ * For subset fonts, we must ensure that characters referenced
+ * by seac are also included. Note that seac creates at most
+ * 2 pieces.
+ */
+ int code = psf_add_subset_pieces(subset_glyphs, &subset_size,
+ countof(pglyphs->subset_data) - 1, 2,
+ (gs_font *)pfont);
+ uint keep_size, i;
+
+ if (code < 0)
+ return code;
+ /* Subset fonts require .notdef. */
+ if (notdef == gs_no_glyph)
+ return_error(gs_error_rangecheck);
+ /* Remove undefined glyphs. */
+ for (i = 0, keep_size = 0; i < subset_size; ++i) {
+ gs_glyph_info_t info;
+ gs_glyph glyph = subset_glyphs[i];
+
+ /*
+ * The documentation for the glyph_info procedure says that
+ * using members = 0 is an inexpensive way to find out
+ * whether a given glyph exists, but the implementations
+ * don't actually do this. Request an inexpensive value.
+ */
+ if (pfont->procs.glyph_info((gs_font *)pfont, glyph, NULL,
+ GLYPH_INFO_NUM_PIECES, &info) >= 0)
+ subset_glyphs[keep_size++] = glyph;
+ }
+ subset_size = keep_size;
+ /* Sort the glyphs. Make sure .notdef is included. */
+ subset_glyphs[subset_size++] = notdef;
+ subset_size = psf_sort_glyphs(subset_glyphs, subset_size);
}
pglyphs->notdef = notdef;
diff --git a/gs/base/gdevpsfx.c b/gs/base/gdevpsfx.c
index a064820f4..fd9e1f2b6 100644
--- a/gs/base/gdevpsfx.c
+++ b/gs/base/gdevpsfx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,7 +63,7 @@ skip_iv(gs_type1_state *pcis)
crypt_state state = crypt_charstring_seed;
for (; skip > 0; ++cip, --skip)
- decrypt_skip_next(*cip, state);
+ decrypt_skip_next(*cip, state);
ipsp->ip = cip;
ipsp->dstate = state;
}
@@ -76,7 +76,7 @@ skip_iv(gs_type1_state *pcis)
*/
static void
type1_next_init(gs_type1_state *pcis, const gs_glyph_data_t *pgd,
- gs_font_type1 *pfont)
+ gs_font_type1 *pfont)
{
gs_type1_interp_init(pcis, NULL, NULL, NULL, NULL, false, 0, pfont);
pcis->flex_count = flex_max;
@@ -98,10 +98,10 @@ type1_callsubr(gs_type1_state *pcis, int index)
gs_font_type1 *pfont = pcis->pfont;
ip_state_t *ipsp1 = &pcis->ipstack[pcis->ips_count];
int code = pfont->data.procs.subr_data(pfont, index, false,
- &ipsp1->cs_data);
+ &ipsp1->cs_data);
if (code < 0)
- return_error(code);
+ return_error(code);
pcis->ips_count++;
skip_iv(pcis);
return code;
@@ -110,7 +110,7 @@ type1_callsubr(gs_type1_state *pcis, int index)
/* Add 1 or 3 stem hints. */
static int
type1_stem1(gs_type1_state *pcis, cv_stem_hint_table *psht, const fixed *pv,
- fixed lsb, byte *active_hints)
+ fixed lsb, byte *active_hints)
{
fixed v0 = pv[0] + lsb, v1 = v0 + pv[1];
cv_stem_hint *bot = &psht->data[0];
@@ -118,22 +118,22 @@ type1_stem1(gs_type1_state *pcis, cv_stem_hint_table *psht, const fixed *pv,
cv_stem_hint *top = orig_top;
if (psht->count >= max_total_stem_hints)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
while (top > bot &&
- (v0 < top[-1].v0 || (v0 == top[-1].v0 && v1 < top[-1].v1))
- ) {
- *top = top[-1];
- top--;
+ (v0 < top[-1].v0 || (v0 == top[-1].v0 && v1 < top[-1].v1))
+ ) {
+ *top = top[-1];
+ top--;
}
if (top > bot && v0 == top[-1].v0 && v1 == top[-1].v1) {
- /* Duplicate hint, don't add it. */
- memmove(top, top + 1, (char *)orig_top - (char *)top);
- if (active_hints) {
- uint index = top[-1].index;
-
- active_hints[index >> 3] |= 0x80 >> (index & 7);
- }
- return 0;
+ /* Duplicate hint, don't add it. */
+ memmove(top, top + 1, (char *)orig_top - (char *)top);
+ if (active_hints) {
+ uint index = top[-1].index;
+
+ active_hints[index >> 3] |= 0x80 >> (index & 7);
+ }
+ return 0;
}
top->v0 = v0;
top->v1 = v1;
@@ -142,7 +142,7 @@ type1_stem1(gs_type1_state *pcis, cv_stem_hint_table *psht, const fixed *pv,
}
static void
type1_stem3(gs_type1_state *pcis, cv_stem_hint_table *psht, const fixed *pv3,
- fixed lsb, byte *active_hints)
+ fixed lsb, byte *active_hints)
{
type1_stem1(pcis, psht, pv3, lsb, active_hints);
type1_stem1(pcis, psht, pv3 + 2, lsb, active_hints);
@@ -170,127 +170,127 @@ type1_next(gs_type1_state *pcis)
state = ipsp->dstate;
for (;;) {
if (cip >= cipe)
- return_error(gs_error_invalidfont);
- c0 = *cip++;
- charstring_next(c0, state, c, encrypted);
- if (c >= c_num1) {
- /* This is a number, decode it and push it on the stack. */
- if (c < c_pos2_0) { /* 1-byte number */
- decode_push_num1(csp, pcis->ostack, c);
- } else if (c < cx_num4) { /* 2-byte number */
- decode_push_num2(csp, pcis->ostack, c, cip, state, encrypted);
- } else if (c == cx_num4) { /* 4-byte number */
- long lw;
-
- decode_num4(lw, cip, state, encrypted);
- CS_CHECK_PUSH(csp, pcis->ostack);
- *++csp = int2fixed(lw);
- if (lw != fixed2long(*csp)) {
- /*
- * The integer was too large to handle in fixed point.
- * Handle this case specially.
- */
- code = gs_type1_check_float(&state, encrypted, &cip, csp, lw);
- if (code < 0)
- return code;
- }
- } else /* not possible */
- return_error(gs_error_invalidfont);
- continue;
- }
+ return_error(gs_error_invalidfont);
+ c0 = *cip++;
+ charstring_next(c0, state, c, encrypted);
+ if (c >= c_num1) {
+ /* This is a number, decode it and push it on the stack. */
+ if (c < c_pos2_0) { /* 1-byte number */
+ decode_push_num1(csp, pcis->ostack, c);
+ } else if (c < cx_num4) { /* 2-byte number */
+ decode_push_num2(csp, pcis->ostack, c, cip, state, encrypted);
+ } else if (c == cx_num4) { /* 4-byte number */
+ long lw;
+
+ decode_num4(lw, cip, state, encrypted);
+ CS_CHECK_PUSH(csp, pcis->ostack);
+ *++csp = int2fixed(lw);
+ if (lw != fixed2long(*csp)) {
+ /*
+ * The integer was too large to handle in fixed point.
+ * Handle this case specially.
+ */
+ code = gs_type1_check_float(&state, encrypted, &cip, csp, lw);
+ if (code < 0)
+ return code;
+ }
+ } else /* not possible */
+ return_error(gs_error_invalidfont);
+ continue;
+ }
#ifdef DEBUG
- if (gs_debug_c('1')) {
- const fixed *p;
-
- for (p = pcis->ostack; p <= csp; ++p)
- dprintf1(" %g", fixed2float(*p));
- if (c == cx_escape) {
- crypt_state cstate = state;
- int cn;
-
- charstring_next(*cip, cstate, cn, encrypted);
- dprintf1(" [*%d]\n", cn);
- } else
- dprintf1(" [%d]\n", c);
- }
+ if (gs_debug_c('1')) {
+ const fixed *p;
+
+ for (p = pcis->ostack; p <= csp; ++p)
+ dprintf1(" %g", fixed2float(*p));
+ if (c == cx_escape) {
+ crypt_state cstate = state;
+ int cn;
+
+ charstring_next(*cip, cstate, cn, encrypted);
+ dprintf1(" [*%d]\n", cn);
+ } else
+ dprintf1(" [%d]\n", c);
+ }
#endif
- switch ((char_command) c) {
- default:
- break;
- case c_undef0:
- case c_undef2:
- case c_undef17:
- return_error(gs_error_invalidfont);
- case c_callsubr:
- code = type1_callsubr(pcis, fixed2int_var(*csp) +
- pcis->pfont->data.subroutineNumberBias);
- if (code < 0)
- return_error(code);
- ipsp->ip = cip, ipsp->dstate = state;
- --csp;
- ++ipsp;
- goto load;
- case c_return:
- gs_glyph_data_free(&ipsp->cs_data, "type1_next");
- pcis->ips_count--;
- --ipsp;
- goto load;
- case c_undoc15:
- /* See gstype1.h for information on this opcode. */
- CLEAR;
- continue;
- case cx_escape:
- charstring_next(*cip, state, c, encrypted);
- ++cip;
- switch ((char1_extended_command) c) {
- default:
- c += CE_OFFSET;
- break;
- case ce1_div:
- csp[-1] = float2fixed((double)csp[-1] / (double)*csp);
- --csp;
- continue;
- case ce1_undoc15: /* see gstype1.h */
- CLEAR;
- continue;
- case ce1_callothersubr:
- switch (fixed2int_var(*csp)) {
- case 0:
- pcis->ignore_pops = 2;
- break; /* pass to caller */
- case 3:
- pcis->ignore_pops = 1;
- break; /* pass to caller */
- case 14:
- num_results = 1; goto blend;
- case 15:
- num_results = 2; goto blend;
- case 16:
- num_results = 3; goto blend;
- case 17:
- num_results = 4; goto blend;
- case 18:
- num_results = 6;
- blend:
- code = gs_type1_blend(pcis, csp, num_results);
- if (code < 0)
- return code;
- csp -= code;
- continue;
- default:
- break; /* pass to caller */
- }
- break;
- case ce1_pop:
- if (pcis->ignore_pops != 0) {
- pcis->ignore_pops--;
- continue;
- }
- return_error(gs_error_rangecheck);
- }
- break;
- }
- break;
+ switch ((char_command) c) {
+ default:
+ break;
+ case c_undef0:
+ case c_undef2:
+ case c_undef17:
+ return_error(gs_error_invalidfont);
+ case c_callsubr:
+ code = type1_callsubr(pcis, fixed2int_var(*csp) +
+ pcis->pfont->data.subroutineNumberBias);
+ if (code < 0)
+ return_error(code);
+ ipsp->ip = cip, ipsp->dstate = state;
+ --csp;
+ ++ipsp;
+ goto load;
+ case c_return:
+ gs_glyph_data_free(&ipsp->cs_data, "type1_next");
+ pcis->ips_count--;
+ --ipsp;
+ goto load;
+ case c_undoc15:
+ /* See gstype1.h for information on this opcode. */
+ CLEAR;
+ continue;
+ case cx_escape:
+ charstring_next(*cip, state, c, encrypted);
+ ++cip;
+ switch ((char1_extended_command) c) {
+ default:
+ c += CE_OFFSET;
+ break;
+ case ce1_div:
+ csp[-1] = float2fixed((double)csp[-1] / (double)*csp);
+ --csp;
+ continue;
+ case ce1_undoc15: /* see gstype1.h */
+ CLEAR;
+ continue;
+ case ce1_callothersubr:
+ switch (fixed2int_var(*csp)) {
+ case 0:
+ pcis->ignore_pops = 2;
+ break; /* pass to caller */
+ case 3:
+ pcis->ignore_pops = 1;
+ break; /* pass to caller */
+ case 14:
+ num_results = 1; goto blend;
+ case 15:
+ num_results = 2; goto blend;
+ case 16:
+ num_results = 3; goto blend;
+ case 17:
+ num_results = 4; goto blend;
+ case 18:
+ num_results = 6;
+ blend:
+ code = gs_type1_blend(pcis, csp, num_results);
+ if (code < 0)
+ return code;
+ csp -= code;
+ continue;
+ default:
+ break; /* pass to caller */
+ }
+ break;
+ case ce1_pop:
+ if (pcis->ignore_pops != 0) {
+ pcis->ignore_pops--;
+ continue;
+ }
+ return_error(gs_error_rangecheck);
+ }
+ break;
+ }
+ break;
}
ipsp->ip = cip, ipsp->dstate = state;
pcis->ips_count = ipsp + 1 - &pcis->ipstack[0];
@@ -319,10 +319,10 @@ static void
type2_put_op(stream *s, int op)
{
if (op >= CE_OFFSET) {
- spputc(s, cx_escape);
- spputc(s, (byte)(op - CE_OFFSET));
+ spputc(s, cx_escape);
+ spputc(s, (byte)(op - CE_OFFSET));
} else
- sputc(s, (byte)op);
+ sputc(s, (byte)op);
}
/* Put a Type 2 number on a stream. */
@@ -330,25 +330,25 @@ static void
type2_put_int(stream *s, int i)
{
if (i >= -107 && i <= 107)
- sputc(s, (byte)(i + 139));
+ sputc(s, (byte)(i + 139));
else if (i <= 1131 && i >= 0)
- sputc2(s, (c_pos2_0 << 8) + i - 108);
+ sputc2(s, (c_pos2_0 << 8) + i - 108);
else if (i >= -1131 && i < 0)
- sputc2(s, (c_neg2_0 << 8) - i - 108);
+ sputc2(s, (c_neg2_0 << 8) - i - 108);
else if (i >= -32768 && i <= 32767) {
- spputc(s, c2_shortint);
- sputc2(s, i);
+ spputc(s, c2_shortint);
+ sputc2(s, i);
} else {
- /*
- * We can't represent this number directly: compute it.
- * (This can be done much more efficiently in particular cases;
- * we'll do this if it ever seems worthwhile.)
- */
- type2_put_int(s, i >> 10);
- type2_put_int(s, 1024);
- type2_put_op(s, CE_OFFSET + ce2_mul);
- type2_put_int(s, i & 1023);
- type2_put_op(s, CE_OFFSET + ce2_add);
+ /*
+ * We can't represent this number directly: compute it.
+ * (This can be done much more efficiently in particular cases;
+ * we'll do this if it ever seems worthwhile.)
+ */
+ type2_put_int(s, i >> 10);
+ type2_put_int(s, 1024);
+ type2_put_op(s, CE_OFFSET + ce2_mul);
+ type2_put_int(s, i & 1023);
+ type2_put_op(s, CE_OFFSET + ce2_add);
}
}
@@ -357,15 +357,15 @@ static void
type2_put_fixed(stream *s, fixed v)
{
if (fixed_is_int(v))
- type2_put_int(s, fixed2int_var(v));
+ type2_put_int(s, fixed2int_var(v));
else if (v >= int2fixed(-32768) && v < int2fixed(32768)) {
- /* We can represent this as a 16:16 number. */
- spputc(s, cx_num4);
- sputc4(s, v << (16 - _fixed_shift));
+ /* We can represent this as a 16:16 number. */
+ spputc(s, cx_num4);
+ sputc4(s, v << (16 - _fixed_shift));
} else {
- type2_put_int(s, fixed2int_var(v));
- type2_put_fixed(s, fixed_fraction(v));
- type2_put_op(s, CE_OFFSET + ce2_add);
+ type2_put_int(s, fixed2int_var(v));
+ type2_put_fixed(s, fixed_fraction(v));
+ type2_put_op(s, CE_OFFSET + ce2_add);
}
}
@@ -378,16 +378,16 @@ type2_put_stems(stream *s, int os_count, const cv_stem_hint_table *psht, int op)
int i;
for (i = 0; i < psht->count; ++i, pushed += 2) {
- fixed v0 = psht->data[i].v0;
- fixed v1 = psht->data[i].v1;
-
- if (pushed > ostack_size - 2) {
- type2_put_op(s, op);
- pushed = 0;
- }
- type2_put_fixed(s, v0 - prev);
- type2_put_fixed(s, v1 - v0);
- prev = v1;
+ fixed v0 = psht->data[i].v0;
+ fixed v1 = psht->data[i].v1;
+
+ if (pushed > ostack_size - 2) {
+ type2_put_op(s, op);
+ pushed = 0;
+ }
+ type2_put_fixed(s, v0 - prev);
+ type2_put_fixed(s, v1 - v0);
+ prev = v1;
}
type2_put_op(s, op);
}
@@ -404,7 +404,6 @@ type2_put_hintmask(stream *s, const byte *mask, uint size)
/* ------ Main program ------ */
-
/*
* Convert a Type 1 Charstring to (unencrypted) Type 2.
* For simplicity, we expand all Subrs in-line.
@@ -417,7 +416,7 @@ type2_put_hintmask(stream *s, const byte *mask, uint size)
#define MAX_STACK ostack_size
int
psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
- gs_font_type1 *pfont)
+ gs_font_type1 *pfont)
{
gs_type1_state cis;
cv_stem_hint_table hstem_hints; /* horizontal stem hints */
@@ -427,8 +426,8 @@ psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
bool replace_hints = false;
bool hints_changed = false;
enum {
- dotsection_in = 0,
- dotsection_out = -1
+ dotsection_in = 0,
+ dotsection_out = -1
} dotsection_flag = dotsection_out;
byte active_hints[(max_total_stem_hints + 7) / 8];
byte dot_save_hints[(max_total_stem_hints + 7) / 8];
@@ -437,16 +436,16 @@ psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
BEGIN\
hints_changed = replace_hints;\
if (hints_changed)\
- CHECK_OP(); /* see below */\
+ CHECK_OP(); /* see below */\
END
#define CHECK_HINTS_CHANGED()\
BEGIN\
if (hints_changed) {\
- type2_put_hintmask(s, active_hints, hintmask_size);\
- hints_changed = false;\
+ type2_put_hintmask(s, active_hints, hintmask_size);\
+ hints_changed = false;\
}\
END
- /*
+ /*
* In order to combine Type 1 operators, we usually delay writing
* out operators (but not their operands). We must keep track of
* the stack depth so we don't exceed it when combining operators.
@@ -458,8 +457,8 @@ psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
#define CHECK_OP()\
BEGIN\
if (prev_op >= 0) {\
- type2_put_op(s, prev_op);\
- CLEAR_OP();\
+ type2_put_op(s, prev_op);\
+ CLEAR_OP();\
}\
END
fixed mx0 = 0, my0 = 0; /* See ce1_setcurrentpoint. */
@@ -475,51 +474,51 @@ psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
vstem_hints.count = vstem_hints.replaced_count = vstem_hints.current = 0;
type1_next_init(&cis, pgd, pfont);
for (;;) {
- int c = type1_next(&cis);
- fixed *csp = &cis.ostack[cis.os_count - 1];
-
- switch (c) {
- default:
- if (c < 0)
- return c;
- type1_clear(&cis);
- continue;
- case c1_hsbw:
- gs_type1_sbw(&cis, cis.ostack[0], fixed_0, cis.ostack[1], fixed_0);
- goto clear;
- case cx_hstem:
- type1_stem1(&cis, &hstem_hints, csp - 1, cis.lsb.y, NULL);
- goto clear;
- case cx_vstem:
- type1_stem1(&cis, &vstem_hints, csp - 1, cis.lsb.x, NULL);
- goto clear;
- case CE_OFFSET + ce1_sbw:
- gs_type1_sbw(&cis, cis.ostack[0], cis.ostack[1],
- cis.ostack[2], cis.ostack[3]);
- goto clear;
- case CE_OFFSET + ce1_vstem3:
- type1_stem3(&cis, &vstem_hints, csp - 5, cis.lsb.x, NULL);
- goto clear;
- case CE_OFFSET + ce1_hstem3:
- type1_stem3(&cis, &hstem_hints, csp - 5, cis.lsb.y, NULL);
- clear:
- type1_clear(&cis);
- continue;
- case ce1_callothersubr:
- if (*csp == int2fixed(3))
- replace_hints = true;
- if (*csp == int2fixed(12) || *csp == int2fixed(13))
- cis.os_count -= fixed2int(csp[-1]);
- cis.os_count -= 2;
- continue;
- case CE_OFFSET + ce1_dotsection:
- replace_hints = true;
- continue;
- case CE_OFFSET + ce1_seac:
- case cx_endchar:
- break;
- }
- break;
+ int c = type1_next(&cis);
+ fixed *csp = &cis.ostack[cis.os_count - 1];
+
+ switch (c) {
+ default:
+ if (c < 0)
+ return c;
+ type1_clear(&cis);
+ continue;
+ case c1_hsbw:
+ gs_type1_sbw(&cis, cis.ostack[0], fixed_0, cis.ostack[1], fixed_0);
+ goto clear;
+ case cx_hstem:
+ type1_stem1(&cis, &hstem_hints, csp - 1, cis.lsb.y, NULL);
+ goto clear;
+ case cx_vstem:
+ type1_stem1(&cis, &vstem_hints, csp - 1, cis.lsb.x, NULL);
+ goto clear;
+ case CE_OFFSET + ce1_sbw:
+ gs_type1_sbw(&cis, cis.ostack[0], cis.ostack[1],
+ cis.ostack[2], cis.ostack[3]);
+ goto clear;
+ case CE_OFFSET + ce1_vstem3:
+ type1_stem3(&cis, &vstem_hints, csp - 5, cis.lsb.x, NULL);
+ goto clear;
+ case CE_OFFSET + ce1_hstem3:
+ type1_stem3(&cis, &hstem_hints, csp - 5, cis.lsb.y, NULL);
+ clear:
+ type1_clear(&cis);
+ continue;
+ case ce1_callothersubr:
+ if (*csp == int2fixed(3))
+ replace_hints = true;
+ if (*csp == int2fixed(12) || *csp == int2fixed(13))
+ cis.os_count -= fixed2int(csp[-1]);
+ cis.os_count -= 2;
+ continue;
+ case CE_OFFSET + ce1_dotsection:
+ replace_hints = true;
+ continue;
+ case CE_OFFSET + ce1_seac:
+ case cx_endchar:
+ break;
+ }
+ break;
}
/*
* Number the hints for hintmask. We must do this even if we never
@@ -527,394 +526,394 @@ psf_convert_type1_to_type2(stream *s, const gs_glyph_data_t *pgd,
* active_hints.
*/
{
- int i;
+ int i;
- for (i = 0; i < hstem_hints.count; ++i)
- hstem_hints.data[i].index = i;
- for (i = 0; i < vstem_hints.count; ++i)
- vstem_hints.data[i].index = i + hstem_hints.count;
+ for (i = 0; i < hstem_hints.count; ++i)
+ hstem_hints.data[i].index = i;
+ for (i = 0; i < vstem_hints.count; ++i)
+ vstem_hints.data[i].index = i + hstem_hints.count;
}
if (replace_hints) {
- hintmask_size =
- (hstem_hints.count + vstem_hints.count + 7) / 8;
- memset(active_hints, 0, hintmask_size);
- } else
- hintmask_size = 0;
+ hintmask_size =
+ (hstem_hints.count + vstem_hints.count + 7) / 8;
+ memset(active_hints, 0, hintmask_size);
+ } else
+ hintmask_size = 0;
/* Do a second pass to write the result. */
type1_next_init(&cis, pgd, pfont);
CLEAR_OP();
for (;;) {
- int c = type1_next(&cis);
- fixed *csp = &cis.ostack[cis.os_count - 1];
+ int c = type1_next(&cis);
+ fixed *csp = &cis.ostack[cis.os_count - 1];
#define POP(n)\
(csp -= (n), cis.os_count -= (n))
- int i;
- fixed mx, my;
+ int i;
+ fixed mx, my;
- if (need_moveto && ((c >= cx_rlineto && c <= cx_rrcurveto) ||
- c == cx_vhcurveto || c == cx_hvcurveto))
+ if (need_moveto && ((c >= cx_rlineto && c <= cx_rrcurveto) ||
+ c == cx_vhcurveto || c == cx_hvcurveto))
{
- mx = my = 0;
- need_moveto = false;
- CHECK_OP();
- if (first) {
- if (cis.os_count)
- type2_put_fixed(s, *csp); /* width */
- mx += cis.lsb.x + mx0, my += cis.lsb.y + my0;
- first = false;
- /* We need to move all the stored numeric values up by
- * one in the stack, eliminating the width, so that later
- * processing when we handle the drswing operator emits the correct
- * values. This is different to the 'move' case below.
- */
- cis.os_count--;
- for (i = 0; i < cis.os_count; ++i)
- cis.ostack[i] = cis.ostack[i+1];
- }
- CHECK_HINTS_CHANGED();
- if (mx == 0) {
- type2_put_fixed(s, my);
- depth = 1, prev_op = cx_vmoveto;
- } else if (my == 0) {
- type2_put_fixed(s, mx);
- depth = 1, prev_op = cx_hmoveto;
- } else {
- type2_put_fixed(s, mx);
- type2_put_fixed(s, my);
- depth = 2, prev_op = cx_rmoveto;
- }
- }
-
- switch (c) {
- default:
- if (c < 0)
- return c;
- if (c >= CE_OFFSET)
- return_error(gs_error_rangecheck);
- /* The Type 1 use of all other operators is the same in Type 2. */
- copy:
- CHECK_OP();
- CHECK_HINTS_CHANGED();
- put:
- for (i = 0; i < cis.os_count; ++i)
- type2_put_fixed(s, cis.ostack[i]);
- depth += cis.os_count;
- prev_op = c;
- type1_clear(&cis);
- continue;
- case cx_hstem:
- type1_stem1(&cis, &hstem_hints, csp - 1, cis.lsb.y, active_hints);
- hint:
- HINTS_CHANGED();
- type1_clear(&cis);
- continue;
- case cx_vstem:
- type1_stem1(&cis, &vstem_hints, csp - 1, cis.lsb.x, active_hints);
- goto hint;
- case CE_OFFSET + ce1_vstem3:
- type1_stem3(&cis, &vstem_hints, csp - 5, cis.lsb.x, active_hints);
- goto hint;
- case CE_OFFSET + ce1_hstem3:
- type1_stem3(&cis, &hstem_hints, csp - 5, cis.lsb.y, active_hints);
- goto hint;
- case CE_OFFSET + ce1_dotsection:
- if (dotsection_flag == dotsection_out) {
- memcpy(dot_save_hints, active_hints, hintmask_size);
- memset(active_hints, 0, hintmask_size);
- dotsection_flag = dotsection_in;
- } else {
- memcpy(active_hints, dot_save_hints, hintmask_size);
- dotsection_flag = dotsection_out;
- }
- HINTS_CHANGED();
- continue;
- case c1_closepath:
- need_moveto = true;
- continue;
- case CE_OFFSET + ce1_setcurrentpoint:
- if (first) {
- /* A workaround for fonts which use ce1_setcurrentpoint
- in an illegal way for shifting a path.
- See t1_hinter__setcurrentpoint for more information. */
- mx0 = csp[-1], my0 = *csp;
- }
- continue;
- case cx_vmoveto:
- mx = 0, my = *csp;
- POP(1); goto move;
- case cx_hmoveto:
- mx = *csp, my = 0;
- POP(1); goto move;
- case cx_rmoveto:
- mx = csp[-1], my = *csp;
- POP(2);
- move:
- need_moveto = false;
- CHECK_OP();
- if (first) {
- if (cis.os_count)
- type2_put_fixed(s, *csp); /* width */
- mx += cis.lsb.x + mx0, my += cis.lsb.y + my0;
- first = false;
- }
- if (cis.flex_count != flex_max) {
- /* We're accumulating points for a flex. */
- if (type1_next(&cis) != ce1_callothersubr)
- return_error(gs_error_rangecheck);
- csp = &cis.ostack[cis.os_count - 1];
- if (*csp != int2fixed(2) || csp[-1] != fixed_0)
- return_error(gs_error_rangecheck);
- cis.flex_count++;
- csp[-1] = mx, *csp = my;
- continue;
- }
- CHECK_HINTS_CHANGED();
- if (mx == 0) {
- type2_put_fixed(s, my);
- depth = 1, prev_op = cx_vmoveto;
- } else if (my == 0) {
- type2_put_fixed(s, mx);
- depth = 1, prev_op = cx_hmoveto;
- } else {
- type2_put_fixed(s, mx);
- type2_put_fixed(s, my);
- depth = 2, prev_op = cx_rmoveto;
- }
- type1_clear(&cis);
- continue;
- case c1_hsbw:
- gs_type1_sbw(&cis, cis.ostack[0], fixed_0, cis.ostack[1], fixed_0);
- /*
- * Leave the l.s.b. on the operand stack for the initial hint,
- * moveto, or endchar command.
- */
- cis.ostack[0] = cis.ostack[1];
- sbw:
- /* cff_write_Private doesn't write defaultWidthX
- when called with the Type 1 font,
- so the reader will assume
- defaultWidthX = defaultWidthX_DEFAULT
- Use the latter here.
- */
- if (cis.ostack[0] == default_defaultWidthX)
- cis.os_count = 0;
- else {
- cis.ostack[0] -= default_defaultWidthX;
- cis.os_count = 1;
- }
- if (hstem_hints.count) {
- if (cis.os_count)
- type2_put_fixed(s, cis.ostack[0]);
- type2_put_stems(s, cis.os_count, &hstem_hints,
- (replace_hints ? c2_hstemhm : cx_hstem));
- cis.os_count = 0;
- }
- if (vstem_hints.count) {
- if (cis.os_count)
- type2_put_fixed(s, cis.ostack[0]);
- type2_put_stems(s, cis.os_count, &vstem_hints,
- (replace_hints ? c2_vstemhm : cx_vstem));
- cis.os_count = 0;
- }
- continue;
- case CE_OFFSET + ce1_seac:
- /*
- * It is an undocumented feature of the Type 2 CharString
- * format that endchar + 4 or 5 operands is equivalent to
- * seac with an implicit asb operand + endchar with 0 or 1
- * operands. Remove the asb argument from the stack, but
- * adjust the adx argument to compensate for the fact that
- * Type 2 CharStrings don't have any concept of l.s.b.
- */
- csp[-3] += cis.lsb.x - csp[-4];
- memmove(csp - 4, csp - 3, sizeof(*csp) * 4);
- POP(1);
- /* (falls through) */
- case cx_endchar:
- CHECK_OP();
- for (i = 0; i < cis.os_count; ++i)
- type2_put_fixed(s, cis.ostack[i]);
- type2_put_op(s, cx_endchar);
- return 0;
- case CE_OFFSET + ce1_sbw:
- gs_type1_sbw(&cis, cis.ostack[0], cis.ostack[1],
- cis.ostack[2], cis.ostack[3]);
- cis.ostack[0] = cis.ostack[2];
- goto sbw;
- case ce1_callothersubr:
- CHECK_OP();
- switch (fixed2int_var(*csp)) {
- default:
- return_error(gs_error_rangecheck);
- case 0:
- /*
- * The operand stack contains: delta to reference point,
- * 6 deltas for the two curves, fd, final point, 3, 0.
- */
- csp[-18] += csp[-16], csp[-17] += csp[-15];
- memmove(csp - 16, csp - 14, sizeof(*csp) * 11);
- cis.os_count -= 6, csp -= 6;
- /*
- * We could optimize by using [h]flex[1],
- * but it isn't worth the trouble.
- */
- c = CE_OFFSET + ce2_flex;
- cis.flex_count = flex_max; /* not inside flex */
- cis.ignore_pops = 2;
- goto copy;
- case 1:
- cis.flex_count = 0;
- cis.os_count -= 2;
- continue;
- /*case 2:*/ /* detected in *moveto */
- case 3:
- memset(active_hints, 0, hintmask_size);
- HINTS_CHANGED();
- cis.ignore_pops = 1;
- cis.os_count -= 2;
- continue;
- case 12:
- case 13:
- /* Counter control is not implemented. */
- cis.os_count -= 2 + fixed2int(csp[-1]);
- continue;
- }
- /*
- * The remaining cases are strictly for optimization.
- */
- case cx_rlineto:
- if (depth > MAX_STACK - 2)
- goto copy;
- switch (prev_op) {
- case cx_rlineto: /* rlineto+ => rlineto */
- goto put;
- case cx_rrcurveto: /* rrcurveto+ rlineto => rcurveline */
- c = c2_rcurveline;
- goto put;
- default:
- goto copy;
- }
- case cx_hlineto: /* hlineto (vlineto hlineto)* [vlineto] => hlineto */
- if (depth > MAX_STACK - 1 ||
- prev_op != (depth & 1 ? cx_vlineto : cx_hlineto))
- goto copy;
- c = prev_op;
- goto put;
- case cx_vlineto: /* vlineto (hlineto vlineto)* [hlineto] => vlineto */
- if (depth > MAX_STACK - 1 ||
- prev_op != (depth & 1 ? cx_hlineto : cx_vlineto))
- goto copy;
- c = prev_op;
- goto put;
- case cx_hvcurveto: /* hvcurveto (vhcurveto hvcurveto)* => hvcurveto */
- /* (vhcurveto hvcurveto)+ => vhcurveto */
- /*
- * We have to check (depth & 1) because the last curve might
- * have 5 parameters rather than 4 (see rrcurveto below).
- */
- if ((depth & 1) || depth > MAX_STACK - 4 ||
- prev_op != (depth & 4 ? cx_vhcurveto : cx_hvcurveto))
- goto copy;
- c = prev_op;
- goto put;
- case cx_vhcurveto: /* vhcurveto (hvcurveto vhcurveto)* => vhcurveto */
- /* (hvcurveto vhcurveto)+ => hvcurveto */
- /* See above re the (depth & 1) check. */
- if ((depth & 1) || depth > MAX_STACK - 4 ||
- prev_op != (depth & 4 ? cx_hvcurveto : cx_vhcurveto))
- goto copy;
- c = prev_op;
- goto put;
- case cx_rrcurveto:
- if (depth == 0) {
- if (csp[-1] == 0) {
- /* A|0 B C D 0 F rrcurveto => [A] B C D F vvcurveto */
- c = c2_vvcurveto;
- csp[-1] = csp[0];
- if (csp[-5] == 0) {
- memmove(csp - 5, csp - 4, sizeof(*csp) * 4);
- POP(2);
- } else
- POP(1);
- } else if (*csp == 0) {
- /* A B|0 C D E 0 rrcurveto => [B] A C D E hhcurveto */
- c = c2_hhcurveto;
- if (csp[-4] == 0) {
- memmove(csp - 4, csp - 3, sizeof(*csp) * 3);
- POP(2);
- } else {
- *csp = csp[-5], csp[-5] = csp[-4], csp[-4] = *csp;
- POP(1);
- }
- }
- /*
- * We could also optimize:
- * 0 B C D E F|0 rrcurveto => B C D E [F] vhcurveto
- * A 0 C D E|0 F rrcurveto => A C D F [E] hvcurveto
- * but this gets in the way of subsequent optimization
- * of multiple rrcurvetos, so we don't do it.
- */
- goto copy;
- }
- if (depth > MAX_STACK - 6)
- goto copy;
- switch (prev_op) {
- case c2_hhcurveto: /* hrcurveto (x1 0 x2 y2 x3 0 rrcurveto)* => */
- /* hhcurveto */
- if (csp[-4] == 0 && *csp == 0) {
- memmove(csp - 4, csp - 3, sizeof(*csp) * 3);
- c = prev_op;
- POP(2);
- goto put;
- }
- goto copy;
- case c2_vvcurveto: /* rvcurveto (0 y1 x2 y2 0 y3 rrcurveto)* => */
- /* vvcurveto */
- if (csp[-5] == 0 && csp[-1] == 0) {
- memmove(csp - 5, csp - 4, sizeof(*csp) * 3);
- csp[-2] = *csp;
- c = prev_op;
- POP(2);
- goto put;
- }
- goto copy;
- case cx_hvcurveto:
- if (depth & 1)
- goto copy;
- if (!(depth & 4))
- goto hrc;
- vrc: /* (vhcurveto hvcurveto)+ vrcurveto => vhcurveto */
- /* hvcurveto (vhcurveto hvcurveto)* vrcurveto => hvcurveto */
- if (csp[-5] != 0)
- goto copy;
- memmove(csp - 5, csp - 4, sizeof(*csp) * 5);
- c = prev_op;
- POP(1);
- goto put;
- case cx_vhcurveto:
- if (depth & 1)
- goto copy;
- if (!(depth & 4))
- goto vrc;
- hrc: /* (hvcurveto vhcurveto)+ hrcurveto => hvcurveto */
- /* vhcurveto (hvcurveto vhcurveto)* hrcurveto => vhcurveto */
- if (csp[-4] != 0)
- goto copy;
- /* A 0 C D E F => A C D F E */
- memmove(csp - 4, csp - 3, sizeof(*csp) * 2);
- csp[-2] = *csp;
- c = prev_op;
- POP(1);
- goto put;
- case cx_rlineto: /* rlineto+ rrcurveto => rlinecurve */
- c = c2_rlinecurve;
- goto put;
- case cx_rrcurveto: /* rrcurveto+ => rrcurveto */
- goto put;
- default:
- goto copy;
- }
- }
+ mx = my = 0;
+ need_moveto = false;
+ CHECK_OP();
+ if (first) {
+ if (cis.os_count)
+ type2_put_fixed(s, *csp); /* width */
+ mx += cis.lsb.x + mx0, my += cis.lsb.y + my0;
+ first = false;
+ /* We need to move all the stored numeric values up by
+ * one in the stack, eliminating the width, so that later
+ * processing when we handle the drswing operator emits the correct
+ * values. This is different to the 'move' case below.
+ */
+ cis.os_count--;
+ for (i = 0; i < cis.os_count; ++i)
+ cis.ostack[i] = cis.ostack[i+1];
+ }
+ CHECK_HINTS_CHANGED();
+ if (mx == 0) {
+ type2_put_fixed(s, my);
+ depth = 1, prev_op = cx_vmoveto;
+ } else if (my == 0) {
+ type2_put_fixed(s, mx);
+ depth = 1, prev_op = cx_hmoveto;
+ } else {
+ type2_put_fixed(s, mx);
+ type2_put_fixed(s, my);
+ depth = 2, prev_op = cx_rmoveto;
+ }
+ }
+
+ switch (c) {
+ default:
+ if (c < 0)
+ return c;
+ if (c >= CE_OFFSET)
+ return_error(gs_error_rangecheck);
+ /* The Type 1 use of all other operators is the same in Type 2. */
+ copy:
+ CHECK_OP();
+ CHECK_HINTS_CHANGED();
+ put:
+ for (i = 0; i < cis.os_count; ++i)
+ type2_put_fixed(s, cis.ostack[i]);
+ depth += cis.os_count;
+ prev_op = c;
+ type1_clear(&cis);
+ continue;
+ case cx_hstem:
+ type1_stem1(&cis, &hstem_hints, csp - 1, cis.lsb.y, active_hints);
+ hint:
+ HINTS_CHANGED();
+ type1_clear(&cis);
+ continue;
+ case cx_vstem:
+ type1_stem1(&cis, &vstem_hints, csp - 1, cis.lsb.x, active_hints);
+ goto hint;
+ case CE_OFFSET + ce1_vstem3:
+ type1_stem3(&cis, &vstem_hints, csp - 5, cis.lsb.x, active_hints);
+ goto hint;
+ case CE_OFFSET + ce1_hstem3:
+ type1_stem3(&cis, &hstem_hints, csp - 5, cis.lsb.y, active_hints);
+ goto hint;
+ case CE_OFFSET + ce1_dotsection:
+ if (dotsection_flag == dotsection_out) {
+ memcpy(dot_save_hints, active_hints, hintmask_size);
+ memset(active_hints, 0, hintmask_size);
+ dotsection_flag = dotsection_in;
+ } else {
+ memcpy(active_hints, dot_save_hints, hintmask_size);
+ dotsection_flag = dotsection_out;
+ }
+ HINTS_CHANGED();
+ continue;
+ case c1_closepath:
+ need_moveto = true;
+ continue;
+ case CE_OFFSET + ce1_setcurrentpoint:
+ if (first) {
+ /* A workaround for fonts which use ce1_setcurrentpoint
+ in an illegal way for shifting a path.
+ See t1_hinter__setcurrentpoint for more information. */
+ mx0 = csp[-1], my0 = *csp;
+ }
+ continue;
+ case cx_vmoveto:
+ mx = 0, my = *csp;
+ POP(1); goto move;
+ case cx_hmoveto:
+ mx = *csp, my = 0;
+ POP(1); goto move;
+ case cx_rmoveto:
+ mx = csp[-1], my = *csp;
+ POP(2);
+ move:
+ need_moveto = false;
+ CHECK_OP();
+ if (first) {
+ if (cis.os_count)
+ type2_put_fixed(s, *csp); /* width */
+ mx += cis.lsb.x + mx0, my += cis.lsb.y + my0;
+ first = false;
+ }
+ if (cis.flex_count != flex_max) {
+ /* We're accumulating points for a flex. */
+ if (type1_next(&cis) != ce1_callothersubr)
+ return_error(gs_error_rangecheck);
+ csp = &cis.ostack[cis.os_count - 1];
+ if (*csp != int2fixed(2) || csp[-1] != fixed_0)
+ return_error(gs_error_rangecheck);
+ cis.flex_count++;
+ csp[-1] = mx, *csp = my;
+ continue;
+ }
+ CHECK_HINTS_CHANGED();
+ if (mx == 0) {
+ type2_put_fixed(s, my);
+ depth = 1, prev_op = cx_vmoveto;
+ } else if (my == 0) {
+ type2_put_fixed(s, mx);
+ depth = 1, prev_op = cx_hmoveto;
+ } else {
+ type2_put_fixed(s, mx);
+ type2_put_fixed(s, my);
+ depth = 2, prev_op = cx_rmoveto;
+ }
+ type1_clear(&cis);
+ continue;
+ case c1_hsbw:
+ gs_type1_sbw(&cis, cis.ostack[0], fixed_0, cis.ostack[1], fixed_0);
+ /*
+ * Leave the l.s.b. on the operand stack for the initial hint,
+ * moveto, or endchar command.
+ */
+ cis.ostack[0] = cis.ostack[1];
+ sbw:
+ /* cff_write_Private doesn't write defaultWidthX
+ when called with the Type 1 font,
+ so the reader will assume
+ defaultWidthX = defaultWidthX_DEFAULT
+ Use the latter here.
+ */
+ if (cis.ostack[0] == default_defaultWidthX)
+ cis.os_count = 0;
+ else {
+ cis.ostack[0] -= default_defaultWidthX;
+ cis.os_count = 1;
+ }
+ if (hstem_hints.count) {
+ if (cis.os_count)
+ type2_put_fixed(s, cis.ostack[0]);
+ type2_put_stems(s, cis.os_count, &hstem_hints,
+ (replace_hints ? c2_hstemhm : cx_hstem));
+ cis.os_count = 0;
+ }
+ if (vstem_hints.count) {
+ if (cis.os_count)
+ type2_put_fixed(s, cis.ostack[0]);
+ type2_put_stems(s, cis.os_count, &vstem_hints,
+ (replace_hints ? c2_vstemhm : cx_vstem));
+ cis.os_count = 0;
+ }
+ continue;
+ case CE_OFFSET + ce1_seac:
+ /*
+ * It is an undocumented feature of the Type 2 CharString
+ * format that endchar + 4 or 5 operands is equivalent to
+ * seac with an implicit asb operand + endchar with 0 or 1
+ * operands. Remove the asb argument from the stack, but
+ * adjust the adx argument to compensate for the fact that
+ * Type 2 CharStrings don't have any concept of l.s.b.
+ */
+ csp[-3] += cis.lsb.x - csp[-4];
+ memmove(csp - 4, csp - 3, sizeof(*csp) * 4);
+ POP(1);
+ /* (falls through) */
+ case cx_endchar:
+ CHECK_OP();
+ for (i = 0; i < cis.os_count; ++i)
+ type2_put_fixed(s, cis.ostack[i]);
+ type2_put_op(s, cx_endchar);
+ return 0;
+ case CE_OFFSET + ce1_sbw:
+ gs_type1_sbw(&cis, cis.ostack[0], cis.ostack[1],
+ cis.ostack[2], cis.ostack[3]);
+ cis.ostack[0] = cis.ostack[2];
+ goto sbw;
+ case ce1_callothersubr:
+ CHECK_OP();
+ switch (fixed2int_var(*csp)) {
+ default:
+ return_error(gs_error_rangecheck);
+ case 0:
+ /*
+ * The operand stack contains: delta to reference point,
+ * 6 deltas for the two curves, fd, final point, 3, 0.
+ */
+ csp[-18] += csp[-16], csp[-17] += csp[-15];
+ memmove(csp - 16, csp - 14, sizeof(*csp) * 11);
+ cis.os_count -= 6, csp -= 6;
+ /*
+ * We could optimize by using [h]flex[1],
+ * but it isn't worth the trouble.
+ */
+ c = CE_OFFSET + ce2_flex;
+ cis.flex_count = flex_max; /* not inside flex */
+ cis.ignore_pops = 2;
+ goto copy;
+ case 1:
+ cis.flex_count = 0;
+ cis.os_count -= 2;
+ continue;
+ /*case 2:*/ /* detected in *moveto */
+ case 3:
+ memset(active_hints, 0, hintmask_size);
+ HINTS_CHANGED();
+ cis.ignore_pops = 1;
+ cis.os_count -= 2;
+ continue;
+ case 12:
+ case 13:
+ /* Counter control is not implemented. */
+ cis.os_count -= 2 + fixed2int(csp[-1]);
+ continue;
+ }
+ /*
+ * The remaining cases are strictly for optimization.
+ */
+ case cx_rlineto:
+ if (depth > MAX_STACK - 2)
+ goto copy;
+ switch (prev_op) {
+ case cx_rlineto: /* rlineto+ => rlineto */
+ goto put;
+ case cx_rrcurveto: /* rrcurveto+ rlineto => rcurveline */
+ c = c2_rcurveline;
+ goto put;
+ default:
+ goto copy;
+ }
+ case cx_hlineto: /* hlineto (vlineto hlineto)* [vlineto] => hlineto */
+ if (depth > MAX_STACK - 1 ||
+ prev_op != (depth & 1 ? cx_vlineto : cx_hlineto))
+ goto copy;
+ c = prev_op;
+ goto put;
+ case cx_vlineto: /* vlineto (hlineto vlineto)* [hlineto] => vlineto */
+ if (depth > MAX_STACK - 1 ||
+ prev_op != (depth & 1 ? cx_hlineto : cx_vlineto))
+ goto copy;
+ c = prev_op;
+ goto put;
+ case cx_hvcurveto: /* hvcurveto (vhcurveto hvcurveto)* => hvcurveto */
+ /* (vhcurveto hvcurveto)+ => vhcurveto */
+ /*
+ * We have to check (depth & 1) because the last curve might
+ * have 5 parameters rather than 4 (see rrcurveto below).
+ */
+ if ((depth & 1) || depth > MAX_STACK - 4 ||
+ prev_op != (depth & 4 ? cx_vhcurveto : cx_hvcurveto))
+ goto copy;
+ c = prev_op;
+ goto put;
+ case cx_vhcurveto: /* vhcurveto (hvcurveto vhcurveto)* => vhcurveto */
+ /* (hvcurveto vhcurveto)+ => hvcurveto */
+ /* See above re the (depth & 1) check. */
+ if ((depth & 1) || depth > MAX_STACK - 4 ||
+ prev_op != (depth & 4 ? cx_hvcurveto : cx_vhcurveto))
+ goto copy;
+ c = prev_op;
+ goto put;
+ case cx_rrcurveto:
+ if (depth == 0) {
+ if (csp[-1] == 0) {
+ /* A|0 B C D 0 F rrcurveto => [A] B C D F vvcurveto */
+ c = c2_vvcurveto;
+ csp[-1] = csp[0];
+ if (csp[-5] == 0) {
+ memmove(csp - 5, csp - 4, sizeof(*csp) * 4);
+ POP(2);
+ } else
+ POP(1);
+ } else if (*csp == 0) {
+ /* A B|0 C D E 0 rrcurveto => [B] A C D E hhcurveto */
+ c = c2_hhcurveto;
+ if (csp[-4] == 0) {
+ memmove(csp - 4, csp - 3, sizeof(*csp) * 3);
+ POP(2);
+ } else {
+ *csp = csp[-5], csp[-5] = csp[-4], csp[-4] = *csp;
+ POP(1);
+ }
+ }
+ /*
+ * We could also optimize:
+ * 0 B C D E F|0 rrcurveto => B C D E [F] vhcurveto
+ * A 0 C D E|0 F rrcurveto => A C D F [E] hvcurveto
+ * but this gets in the way of subsequent optimization
+ * of multiple rrcurvetos, so we don't do it.
+ */
+ goto copy;
+ }
+ if (depth > MAX_STACK - 6)
+ goto copy;
+ switch (prev_op) {
+ case c2_hhcurveto: /* hrcurveto (x1 0 x2 y2 x3 0 rrcurveto)* => */
+ /* hhcurveto */
+ if (csp[-4] == 0 && *csp == 0) {
+ memmove(csp - 4, csp - 3, sizeof(*csp) * 3);
+ c = prev_op;
+ POP(2);
+ goto put;
+ }
+ goto copy;
+ case c2_vvcurveto: /* rvcurveto (0 y1 x2 y2 0 y3 rrcurveto)* => */
+ /* vvcurveto */
+ if (csp[-5] == 0 && csp[-1] == 0) {
+ memmove(csp - 5, csp - 4, sizeof(*csp) * 3);
+ csp[-2] = *csp;
+ c = prev_op;
+ POP(2);
+ goto put;
+ }
+ goto copy;
+ case cx_hvcurveto:
+ if (depth & 1)
+ goto copy;
+ if (!(depth & 4))
+ goto hrc;
+ vrc: /* (vhcurveto hvcurveto)+ vrcurveto => vhcurveto */
+ /* hvcurveto (vhcurveto hvcurveto)* vrcurveto => hvcurveto */
+ if (csp[-5] != 0)
+ goto copy;
+ memmove(csp - 5, csp - 4, sizeof(*csp) * 5);
+ c = prev_op;
+ POP(1);
+ goto put;
+ case cx_vhcurveto:
+ if (depth & 1)
+ goto copy;
+ if (!(depth & 4))
+ goto vrc;
+ hrc: /* (hvcurveto vhcurveto)+ hrcurveto => hvcurveto */
+ /* vhcurveto (hvcurveto vhcurveto)* hrcurveto => vhcurveto */
+ if (csp[-4] != 0)
+ goto copy;
+ /* A 0 C D E F => A C D F E */
+ memmove(csp - 4, csp - 3, sizeof(*csp) * 2);
+ csp[-2] = *csp;
+ c = prev_op;
+ POP(1);
+ goto put;
+ case cx_rlineto: /* rlineto+ rrcurveto => rlinecurve */
+ c = c2_rlinecurve;
+ goto put;
+ case cx_rrcurveto: /* rrcurveto+ => rrcurveto */
+ goto put;
+ default:
+ goto copy;
+ }
+ }
}
}
diff --git a/gs/base/gdevpsim.c b/gs/base/gdevpsim.c
index 07af18b33..a9b8c1db9 100644
--- a/gs/base/gdevpsim.c
+++ b/gs/base/gdevpsim.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,28 +41,28 @@
/* Write the file (if necessary) and page headers. */
static void
ps_image_write_headers(FILE *f, gx_device_printer *pdev,
- const char *const setup[],
- gx_device_pswrite_common_t *pdpc)
+ const char *const setup[],
+ gx_device_pswrite_common_t *pdpc)
{
if (gdev_prn_file_is_new(pdev)) {
- gs_rect bbox;
-
- bbox.p.x = 0;
- bbox.p.y = 0;
- bbox.q.x = pdev->width / pdev->HWResolution[0] * 72.0;
- bbox.q.y = pdev->height / pdev->HWResolution[1] * 72.0;
- psw_begin_file_header(f, (gx_device *)pdev, &bbox, pdpc, false);
- psw_print_lines(f, setup);
- psw_end_file_header(f);
+ gs_rect bbox;
+
+ bbox.p.x = 0;
+ bbox.p.y = 0;
+ bbox.q.x = pdev->width / pdev->HWResolution[0] * 72.0;
+ bbox.q.y = pdev->height / pdev->HWResolution[1] * 72.0;
+ psw_begin_file_header(f, (gx_device *)pdev, &bbox, pdpc, false);
+ psw_print_lines(f, setup);
+ psw_end_file_header(f);
}
{
- byte buf[100]; /* arbitrary */
- stream s;
+ byte buf[100]; /* arbitrary */
+ stream s;
- s_init(&s, pdev->memory);
- swrite_file(&s, f, buf, sizeof(buf));
- psw_write_page_header(&s, (gx_device *)pdev, pdpc, true, pdev->PageCount + 1, 10);
- sflush(&s);
+ s_init(&s, pdev->memory);
+ swrite_file(&s, f, buf, sizeof(buf));
+ psw_write_page_header(&s, (gx_device *)pdev, pdpc, true, pdev->PageCount + 1, 10);
+ sflush(&s);
}
}
@@ -85,33 +85,33 @@ static dev_proc_close_device(psmono_close);
const gx_device_printer gs_psmono_device =
prn_device(prn_std_procs, "psmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, psmono_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, psmono_print_page);
static const gx_device_procs psgray_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, psmono_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
const gx_device_printer gs_psgray_device = {
prn_device_body(gx_device_printer, psgray_procs, "psgray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, 8, 255, 0, 256, 1, psmono_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, 8, 255, 0, 256, 1, psmono_print_page)
};
static const char *const psmono_setup[] = {
- /* Initialize the strings for filling runs. */
+ /* Initialize the strings for filling runs. */
"/.ImageFills [ 0 1 255 {",
" 256 string dup 0 1 7 { 3 index put dup } for { 8 16 32 64 128 } {",
" 2 copy 0 exch getinterval putinterval dup",
" } forall pop exch pop",
"} bind for ] def",
- /* Initialize the procedure table for input dispatching. */
+ /* Initialize the procedure table for input dispatching. */
"/.ImageProcs [",
- /* Stack: <buffer> <file> <xdigits> <previous> <byte> */
+ /* Stack: <buffer> <file> <xdigits> <previous> <byte> */
" 32 { { pop .ImageItem } } repeat",
" 16 { {", /* 0x20-0x2f: (N-0x20) data bytes follow */
" 32 sub 3 -1 roll add 3 index exch 0 exch getinterval 2 index exch",
@@ -126,23 +126,23 @@ static const char *const psmono_setup[] = {
" } bind } repeat",
" 160 { { pop .ImageItem } } repeat",
"] readonly def",
- /* Read one item from a compressed image. */
- /* Stack contents: <buffer> <file> <xdigits> <previous> */
+ /* Read one item from a compressed image. */
+ /* Stack contents: <buffer> <file> <xdigits> <previous> */
"/.ImageItem {",
" 2 index read pop dup .ImageProcs exch get exec",
"} bind def",
- /* Read and print an entire compressed image. */
+ /* Read and print an entire compressed image. */
"/.ImageRead {" /* <width> <height> <bpc> .ImageRead - */
" gsave [",
/* Stack: width height bpc -mark- */
" 1 0 0 -1 0 7 index",
/* Stack: width height bpc -mark- 1 0 0 -1 0 height */
" ] { .ImageItem }",
- /* Stack: width height bpc <matrix> <proc> */
+ /* Stack: width height bpc <matrix> <proc> */
" 4 index 3 index mul 7 add 8 idiv string currentfile 0 ()",
- /* Stack: width height bpc <matrix> <proc> <buffer> <file> 0 () */
+ /* Stack: width height bpc <matrix> <proc> <buffer> <file> 0 () */
" 9 4 roll",
- /* Stack: <buffer> <file> 0 () width height bpc <matrix> <proc> */
+ /* Stack: <buffer> <file> 0 () width height bpc <matrix> <proc> */
" image pop pop pop pop grestore",
"} def",
0
@@ -169,7 +169,7 @@ psmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
gx_device_pswrite_common_t pswrite_common;
if (line == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pswrite_common = psmono_values;
/* If this is the first page of the file, */
@@ -178,59 +178,59 @@ psmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* Write the .ImageRead command. */
fprintf(prn_stream,
- "%d %d %d .ImageRead\n",
- pdev->width, pdev->height, pdev->color_info.depth);
+ "%d %d %d .ImageRead\n",
+ pdev->width, pdev->height, pdev->color_info.depth);
/* Compress each scan line in turn. */
for (lnum = 0; lnum < pdev->height; lnum++) {
- const byte *p;
- int left = line_size;
- byte *data;
+ const byte *p;
+ int left = line_size;
+ byte *data;
- gdev_prn_get_bits(pdev, lnum, line, &data);
- p = data;
- /* Loop invariant: p + left = data + line_size. */
+ gdev_prn_get_bits(pdev, lnum, line, &data);
+ p = data;
+ /* Loop invariant: p + left = data + line_size. */
#define min_repeat_run 10
- while (left >= min_repeat_run) { /* Detect a maximal run of non-repeated data. */
- const byte *p1 = p;
- int left1 = left;
- byte b;
- int count, count_left;
-
- while (left1 >= min_repeat_run &&
- ((b = *p1) != p1[1] ||
- b != p1[2] || b != p1[3] || b != p1[4] ||
- b != p1[5] || b != p1[6] || b != p1[7] ||
- b != p1[8] || b != p1[9])
- )
- ++p1, --left1;
- if (left1 < min_repeat_run)
- break; /* no repeated data left */
- write_data_run(p, (int)(p1 - p + 1), prn_stream,
- invert);
- /* Detect a maximal run of repeated data. */
- p = ++p1 + (min_repeat_run - 1);
- left = --left1 - (min_repeat_run - 1);
- while (left > 0 && *p == b)
- ++p, --left;
- for (count = p - p1; count > 0;
- count -= count_left
- ) {
- count_left = min(count, max_repeat_run);
- if (count_left > max_repeat_run_code)
- fputc(xdigit_code + (count_left >> 4),
- prn_stream),
- fputc(repeat_run_code + (count_left & 0xf),
- prn_stream);
- else
- putc(repeat_run_code + count_left,
- prn_stream);
- }
+ while (left >= min_repeat_run) { /* Detect a maximal run of non-repeated data. */
+ const byte *p1 = p;
+ int left1 = left;
+ byte b;
+ int count, count_left;
+
+ while (left1 >= min_repeat_run &&
+ ((b = *p1) != p1[1] ||
+ b != p1[2] || b != p1[3] || b != p1[4] ||
+ b != p1[5] || b != p1[6] || b != p1[7] ||
+ b != p1[8] || b != p1[9])
+ )
+ ++p1, --left1;
+ if (left1 < min_repeat_run)
+ break; /* no repeated data left */
+ write_data_run(p, (int)(p1 - p + 1), prn_stream,
+ invert);
+ /* Detect a maximal run of repeated data. */
+ p = ++p1 + (min_repeat_run - 1);
+ left = --left1 - (min_repeat_run - 1);
+ while (left > 0 && *p == b)
+ ++p, --left;
+ for (count = p - p1; count > 0;
+ count -= count_left
+ ) {
+ count_left = min(count, max_repeat_run);
+ if (count_left > max_repeat_run_code)
+ fputc(xdigit_code + (count_left >> 4),
+ prn_stream),
+ fputc(repeat_run_code + (count_left & 0xf),
+ prn_stream);
+ else
+ putc(repeat_run_code + count_left,
+ prn_stream);
+ }
if (ferror(prn_stream))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
}
- /* Write the remaining data, if any. */
- write_data_run(p, left, prn_stream, invert);
+ /* Write the remaining data, if any. */
+ write_data_run(p, left, prn_stream, invert);
}
/* Clean up and return. */
@@ -238,7 +238,7 @@ psmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
psw_write_page_trailer(prn_stream, 1, true);
gs_free_object(pdev->memory, line, "psmono_print_page");
if (ferror(prn_stream))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
return 0;
}
@@ -246,9 +246,9 @@ psmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
static int
psmono_close(gx_device *dev)
{
- int code = psw_end_file(((gx_device_printer *)dev)->file, dev,
+ int code = psw_end_file(((gx_device_printer *)dev)->file, dev,
&psmono_values, NULL, dev->PageCount);
-
+
if (code < 0)
return code;
return gdev_prn_close(dev);
@@ -267,31 +267,31 @@ write_data_run(const byte * data, int count, FILE * f, byte invert)
/* Write the count. */
if (!count)
- return;
+ return;
{
- int shift = sizeof(count) * 8;
+ int shift = sizeof(count) * 8;
- while ((shift -= 4) > 0 && (count >> shift) == 0);
- for (; shift > 0; shift -= 4)
- *q++ = xdigit_code + ((count >> shift) & 0xf);
- *q++ = data_run_code + (count & 0xf);
+ while ((shift -= 4) > 0 && (count >> shift) == 0);
+ for (; shift > 0; shift -= 4)
+ *q++ = xdigit_code + ((count >> shift) & 0xf);
+ *q++ = data_run_code + (count & 0xf);
}
/* Write the data. */
while (left > 0) {
- register int wcount = min(left, max_data_per_line);
-
- left -= wcount;
- for (; wcount > 0; ++p, --wcount) {
- byte b = *p ^ invert;
-
- *q++ = hex_digits[b >> 4];
- *q++ = hex_digits[b & 0xf];
- }
- *q++ = '\n';
- fwrite(line, 1, q - line, f);
- q = line;
+ register int wcount = min(left, max_data_per_line);
+
+ left -= wcount;
+ for (; wcount > 0; ++p, --wcount) {
+ byte b = *p ^ invert;
+
+ *q++ = hex_digits[b >> 4];
+ *q++ = hex_digits[b & 0xf];
+ }
+ *q++ = '\n';
+ fwrite(line, 1, q - line, f);
+ q = line;
}
}
@@ -312,14 +312,14 @@ static dev_proc_close_device(psrgb_close);
static const gx_device_procs psrgb_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, psrgb_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
const gx_device_printer gs_psrgb_device = {
prn_device_body(gx_device_printer, psrgb_procs, "psrgb",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 3, 24, 255, 255, 256, 256, psrgb_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 3, 24, 255, 255, 256, 256, psrgb_print_page)
};
static const char *const psrgb_setup[] = {
@@ -343,7 +343,7 @@ psrgb_print_page(gx_device_printer * pdev, FILE * prn_stream)
gs_memory_t *mem = pdev->memory;
int width = pdev->width;
byte *lbuf = gs_alloc_bytes(mem, width * 3,
- "psrgb_print_page(lbuf)");
+ "psrgb_print_page(lbuf)");
int lnum;
stream fs, a85s, rls;
stream_A85E_state a85state;
@@ -355,7 +355,7 @@ psrgb_print_page(gx_device_printer * pdev, FILE * prn_stream)
pswrite_common = psrgb_values;
if (lbuf == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
ps_image_write_headers(prn_stream, pdev, psrgb_setup, &pswrite_common);
fprintf(prn_stream, "%d %d rgbimage\n", width, pdev->height);
s_init(&fs, mem);
@@ -363,10 +363,10 @@ psrgb_print_page(gx_device_printer * pdev, FILE * prn_stream)
fs.memory = 0;
if (s_A85E_template.set_defaults)
- (*s_A85E_template.set_defaults) ((stream_state *) & a85state);
+ (*s_A85E_template.set_defaults) ((stream_state *) & a85state);
s_init(&a85s, mem);
s_std_init(&a85s, a85sbuf, sizeof(a85sbuf), &s_filter_write_procs,
- s_mode_write);
+ s_mode_write);
a85s.memory = 0;
a85state.memory = 0;
a85state.template = &s_A85E_template;
@@ -378,7 +378,7 @@ psrgb_print_page(gx_device_printer * pdev, FILE * prn_stream)
(*s_RLE_template.set_defaults) ((stream_state *) & rlstate);
s_init(&rls, mem);
s_std_init(&rls, rlsbuf, sizeof(rlsbuf), &s_filter_write_procs,
- s_mode_write);
+ s_mode_write);
rls.memory = 0;
rlstate.memory = 0;
rlstate.template = &s_RLE_template;
@@ -388,18 +388,18 @@ psrgb_print_page(gx_device_printer * pdev, FILE * prn_stream)
rls.strm = &a85s;
for (lnum = 0; lnum < pdev->height; ++lnum) {
- byte *data;
- int i, c;
+ byte *data;
+ int i, c;
- gdev_prn_get_bits(pdev, lnum, lbuf, &data);
- for (c = 0; c < 3; ++c) {
- const byte *p;
+ gdev_prn_get_bits(pdev, lnum, lbuf, &data);
+ for (c = 0; c < 3; ++c) {
+ const byte *p;
- for (i = 0, p = data + c; i < width; ++i, p += 3)
- sputc(&rls, *p);
+ for (i = 0, p = data + c; i < width; ++i, p += 3)
+ sputc(&rls, *p);
if (rls.end_status == ERRC)
return_error(gs_error_ioerror);
- }
+ }
}
sclose(&rls);
sclose(&a85s);
@@ -418,7 +418,7 @@ psrgb_close(gx_device *dev)
{
int code = psw_end_file(((gx_device_printer *)dev)->file, dev,
&psrgb_values, NULL, dev->PageCount);
-
+
if (code < 0)
return code;
return gdev_prn_close(dev);
diff --git a/gs/base/gdevpsu.c b/gs/base/gdevpsu.c
index 1240e6e5c..0671275c8 100644
--- a/gs/base/gdevpsu.c
+++ b/gs/base/gdevpsu.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ psw_print_lines(FILE *f, const char *const lines[])
{
int i;
for (i = 0; lines[i] != 0; ++i) {
- if (fprintf(f, "%s\n", lines[i]) < 0)
+ if (fprintf(f, "%s\n", lines[i]) < 0)
return_error(gs_error_ioerror);
}
return 0;
@@ -42,17 +42,17 @@ psw_print_lines(FILE *f, const char *const lines[])
/* Write the ProcSet name. */
static void
psw_put_procset_name(stream *s, const gx_device *dev,
- const gx_device_pswrite_common_t *pdpc)
+ const gx_device_pswrite_common_t *pdpc)
{
pprints1(s, "GS_%s", dev->dname);
pprintd3(s, "_%d_%d_%d",
- (int)pdpc->LanguageLevel,
- (int)(pdpc->LanguageLevel * 10 + 0.5) % 10,
- pdpc->ProcSet_version);
+ (int)pdpc->LanguageLevel,
+ (int)(pdpc->LanguageLevel * 10 + 0.5) % 10,
+ pdpc->ProcSet_version);
}
static void
psw_print_procset_name(FILE *f, const gx_device *dev,
- const gx_device_pswrite_common_t *pdpc)
+ const gx_device_pswrite_common_t *pdpc)
{
byte buf[100]; /* arbitrary */
stream s;
@@ -68,10 +68,10 @@ static void
psw_print_bbox(FILE *f, const gs_rect *pbbox)
{
fprintf(f, "%%%%BoundingBox: %d %d %d %d\n",
- (int)floor(pbbox->p.x), (int)floor(pbbox->p.y),
- (int)ceil(pbbox->q.x), (int)ceil(pbbox->q.y));
+ (int)floor(pbbox->p.x), (int)floor(pbbox->p.y),
+ (int)ceil(pbbox->q.x), (int)ceil(pbbox->q.y));
fprintf(f, "%%%%HiResBoundingBox: %f %f %f %f\n",
- pbbox->p.x, pbbox->p.y, pbbox->q.x, pbbox->q.y);
+ pbbox->p.x, pbbox->p.y, pbbox->q.x, pbbox->q.y);
}
/* ---------------- File level ---------------- */
@@ -91,8 +91,8 @@ static const char *const psw_begin_prolog[] = {
"%%EndComments",
"%%BeginProlog",
"% This copyright applies to everything between here and the %%EndProlog:",
- /* copyright */
- /* begin ProcSet */
+ /* copyright */
+ /* begin ProcSet */
0
};
@@ -103,7 +103,7 @@ static const char *const psw_begin_prolog[] = {
* it only if it is necessary.
*/
static const char *const psw_ps_procset[] = {
- /* <w> <h> <sizename> setpagesize - */
+ /* <w> <h> <sizename> setpagesize - */
"/PageSize 2 array def"
"/setpagesize" /* x y /a4 -> - */
"{ PageSize aload pop " /* x y /a4 x0 y0 */
@@ -149,7 +149,7 @@ static const char *const psw_end_prolog[] = {
*/
static bool
is_seekable(FILE *f)
-{
+{
struct stat buf;
if(fstat(fileno(f), &buf))
@@ -163,39 +163,39 @@ is_seekable(FILE *f)
*/
int
psw_begin_file_header(FILE *f, const gx_device *dev, const gs_rect *pbbox,
- gx_device_pswrite_common_t *pdpc, bool ascii)
+ gx_device_pswrite_common_t *pdpc, bool ascii)
{
psw_print_lines(f, (pdpc->ProduceEPS ? psw_eps_header : psw_ps_header));
if (pbbox) {
- psw_print_bbox(f, pbbox);
- pdpc->bbox_position = 0;
+ psw_print_bbox(f, pbbox);
+ pdpc->bbox_position = 0;
} else if (!is_seekable(f)) { /* File is not seekable. */
- pdpc->bbox_position = -1;
- fputs("%%BoundingBox: (atend)\n", f);
- fputs("%%HiResBoundingBox: (atend)\n", f);
+ pdpc->bbox_position = -1;
+ fputs("%%BoundingBox: (atend)\n", f);
+ fputs("%%HiResBoundingBox: (atend)\n", f);
} else { /* File is seekable, leave room to rewrite bbox. */
- pdpc->bbox_position = ftell(f);
- fputs("%...............................................................\n", f);
- fputs("%...............................................................\n", f);
+ pdpc->bbox_position = ftell(f);
+ fputs("%...............................................................\n", f);
+ fputs("%...............................................................\n", f);
}
fprintf(f, "%%%%Creator: %s %ld (%s)\n", gs_product, (long)gs_revision,
- dev->dname);
+ dev->dname);
{
- time_t t;
- struct tm tms;
+ time_t t;
+ struct tm tms;
- time(&t);
- tms = *localtime(&t);
- fprintf(f, "%%%%CreationDate: %d/%02d/%02d %02d:%02d:%02d\n",
- tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
- tms.tm_hour, tms.tm_min, tms.tm_sec);
+ time(&t);
+ tms = *localtime(&t);
+ fprintf(f, "%%%%CreationDate: %d/%02d/%02d %02d:%02d:%02d\n",
+ tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
}
if (ascii)
- fputs("%%DocumentData: Clean7Bit\n", f);
+ fputs("%%DocumentData: Clean7Bit\n", f);
if (pdpc->LanguageLevel >= 2.0)
- fprintf(f, "%%%%LanguageLevel: %d\n", (int)pdpc->LanguageLevel);
+ fprintf(f, "%%%%LanguageLevel: %d\n", (int)pdpc->LanguageLevel);
else if (pdpc->LanguageLevel == 1.5)
- fputs("%%Extensions: CMYK\n", f);
+ fputs("%%Extensions: CMYK\n", f);
psw_print_lines(f, psw_begin_prolog);
fprintf(f, "%% %s\n", gs_copyright);
fputs("%%BeginResource: procset ", f);
@@ -226,7 +226,7 @@ psw_end_file_header(FILE *f)
*/
int
psw_end_file(FILE *f, const gx_device *dev,
- const gx_device_pswrite_common_t *pdpc, const gs_rect *pbbox,
+ const gx_device_pswrite_common_t *pdpc, const gs_rect *pbbox,
int /* should be long */ page_count)
{
if (f == NULL)
@@ -235,36 +235,36 @@ psw_end_file(FILE *f, const gx_device *dev,
if (ferror(f))
return_error(gs_error_ioerror);
if (dev->PageCount > 0 && pdpc->bbox_position != 0) {
- if (pdpc->bbox_position >= 0) {
- long save_pos = ftell(f);
+ if (pdpc->bbox_position >= 0) {
+ long save_pos = ftell(f);
- fseek(f, pdpc->bbox_position, SEEK_SET);
- /* Theoretically the bbox device should fill in the bounding box
- * but this does nothing because we don't write on the page.
- * So if bbox = 0 0 0 0, replace with the device page size.
- */
- if(pbbox->p.x == 0 && pbbox->p.y == 0
- && pbbox->q.x == 0 && pbbox->q.y == 0) {
- gs_rect bbox;
- int width = (int)(dev->width * 72.0 / dev->HWResolution[0] + 0.5);
- int height = (int)(dev->height * 72.0 / dev->HWResolution[1] + 0.5);
+ fseek(f, pdpc->bbox_position, SEEK_SET);
+ /* Theoretically the bbox device should fill in the bounding box
+ * but this does nothing because we don't write on the page.
+ * So if bbox = 0 0 0 0, replace with the device page size.
+ */
+ if(pbbox->p.x == 0 && pbbox->p.y == 0
+ && pbbox->q.x == 0 && pbbox->q.y == 0) {
+ gs_rect bbox;
+ int width = (int)(dev->width * 72.0 / dev->HWResolution[0] + 0.5);
+ int height = (int)(dev->height * 72.0 / dev->HWResolution[1] + 0.5);
- bbox.p.x = 0;
- bbox.p.y = 0;
- bbox.q.x = width;
- bbox.q.y = height;
- psw_print_bbox(f, &bbox);
- } else
- psw_print_bbox(f, pbbox);
+ bbox.p.x = 0;
+ bbox.p.y = 0;
+ bbox.q.x = width;
+ bbox.q.y = height;
+ psw_print_bbox(f, &bbox);
+ } else
+ psw_print_bbox(f, pbbox);
fputc('%', f);
if (ferror(f))
return_error(gs_error_ioerror);
fseek(f, save_pos, SEEK_SET);
- } else
- psw_print_bbox(f, pbbox);
+ } else
+ psw_print_bbox(f, pbbox);
}
if (!pdpc->ProduceEPS)
- fputs("%%EOF\n", f);
+ fputs("%%EOF\n", f);
if (ferror(f))
return_error(gs_error_ioerror);
return 0;
@@ -286,7 +286,7 @@ psw_write_page_header(stream *s, const gx_device *dev,
pprintld2(s, "%%%%Page: %ld %ld\n", page, page_ord);
if (!pdpc->ProduceEPS)
- pprintld2(s, "%%%%PageBoundingBox: 0 0 %ld %ld\n", width, height);
+ pprintld2(s, "%%%%PageBoundingBox: 0 0 %ld %ld\n", width, height);
stream_puts(s, "%%BeginPageSetup\n");
/*
@@ -301,39 +301,39 @@ psw_write_page_header(stream *s, const gx_device *dev,
psw_put_procset_name(s, dev, pdpc);
stream_puts(s, " begin\n");
if (!pdpc->ProduceEPS) {
- typedef struct ps_ {
- const char *size_name;
- int width, height;
- } page_size;
- static const page_size sizes[] = {
- {"/11x17", 792, 1224},
- {"/a3", 842, 1191},
- {"/a4", 595, 842},
- {"/b5", 501, 709},
- {"/ledger", 1224, 792},
- {"/legal", 612, 1008},
- {"/letter", 612, 792},
- {"null", 0, 0}
- };
- const page_size *p = sizes;
+ typedef struct ps_ {
+ const char *size_name;
+ int width, height;
+ } page_size;
+ static const page_size sizes[] = {
+ {"/11x17", 792, 1224},
+ {"/a3", 842, 1191},
+ {"/a4", 595, 842},
+ {"/b5", 501, 709},
+ {"/ledger", 1224, 792},
+ {"/legal", 612, 1008},
+ {"/letter", 612, 792},
+ {"null", 0, 0}
+ };
+ const page_size *p = sizes;
- while (p->size_name[0] == '/') {
- if((p->width - 5) <= width && (p->width + 5) >= width) {
- if((p->height - 5) <= height && (p->height + 5) >= height) {
- break;
- } else
- ++p;
- }
- else
- ++p;
- }
- pprintd2(s, "%d %d ", width, height);
- pprints1(s, "%s setpagesize\n", p->size_name);
+ while (p->size_name[0] == '/') {
+ if((p->width - 5) <= width && (p->width + 5) >= width) {
+ if((p->height - 5) <= height && (p->height + 5) >= height) {
+ break;
+ } else
+ ++p;
+ }
+ else
+ ++p;
+ }
+ pprintd2(s, "%d %d ", width, height);
+ pprints1(s, "%s setpagesize\n", p->size_name);
}
pprintd1(s, "/pagesave save store %d dict begin\n", dictsize);
if (do_scale)
- pprintg2(s, "%g %g scale\n",
- 72.0 / dev->HWResolution[0], 72.0 / dev->HWResolution[1]);
+ pprintg2(s, "%g %g scale\n",
+ 72.0 / dev->HWResolution[0], 72.0 / dev->HWResolution[1]);
stream_puts(s, "%%EndPageSetup\ngsave mark\n");
if (s->end_status == ERRC)
return_error(gs_error_ioerror);
@@ -349,7 +349,7 @@ psw_write_page_trailer(FILE *f, int num_copies, int flush)
{
fprintf(f, "cleartomark end end pagesave restore\n");
if (num_copies != 1)
- fprintf(f, "userdict /#copies %d put\n", num_copies);
+ fprintf(f, "userdict /#copies %d put\n", num_copies);
fprintf(f, " %s\n%%%%PageTrailer\n", (flush ? "showpage" : "copypage"));
fflush(f);
if (ferror(f))
diff --git a/gs/base/gdevpsu.h b/gs/base/gdevpsu.h
index babc1fd16..8b9b29bca 100644
--- a/gs/base/gdevpsu.h
+++ b/gs/base/gdevpsu.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,16 +40,16 @@ int psw_print_lines(FILE *f, const char *const lines[]);
* file, not a stream, because it may be called during finalization.
*/
int psw_begin_file_header(FILE *f, const gx_device *dev,
- const gs_rect *pbbox,
- gx_device_pswrite_common_t *pdpc, bool ascii);
+ const gs_rect *pbbox,
+ gx_device_pswrite_common_t *pdpc, bool ascii);
/* End the file header.*/
int psw_end_file_header(FILE *f);
/* End the file. */
int psw_end_file(FILE *f, const gx_device *dev,
- const gx_device_pswrite_common_t *pdpc,
- const gs_rect *pbbox, int page_count);
+ const gx_device_pswrite_common_t *pdpc,
+ const gs_rect *pbbox, int page_count);
/* ---------------- Page level ---------------- */
@@ -57,8 +57,8 @@ int psw_end_file(FILE *f, const gx_device *dev,
* Write the page header.
*/
int psw_write_page_header(stream *s, const gx_device *dev,
- const gx_device_pswrite_common_t *pdpc,
- bool do_scale, long page_ord, int dictsize);
+ const gx_device_pswrite_common_t *pdpc,
+ bool do_scale, long page_ord, int dictsize);
/*
* Write the page trailer. We do this directly to the file, rather than to
* the stream, because we may have to do it during finalization.
@@ -66,4 +66,3 @@ int psw_write_page_header(stream *s, const gx_device *dev,
int psw_write_page_trailer(FILE *f, int num_copies, int flush);
#endif /* gdevpsu_INCLUDED */
-
diff --git a/gs/base/gdevpx.c b/gs/base/gdevpx.c
index 3999eb179..edbe3d583 100644
--- a/gs/base/gdevpx.c
+++ b/gs/base/gdevpx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,6 @@
#include "gdevpcl.h" /* for gdev_pcl_mode3compress() */
#include <stdlib.h> /* abs() */
-
/* ---------------- Device definition ---------------- */
/* Define the default resolution. */
@@ -57,7 +56,7 @@ typedef struct gx_device_pclxl_s {
/* Additional state information */
pxeMediaSize_t media_size;
bool ManualFeed; /* map ps setpage commands to pxl */
- bool ManualFeed_set;
+ bool ManualFeed_set;
int MediaPosition; /* MediaPosition attribute */
int MediaPosition_set;
int page; /* Page number starting at 0 */
@@ -67,29 +66,29 @@ typedef struct gx_device_pclxl_s {
gx_path_type_t clip_rule; /* ditto */
pxeColorSpace_t color_space;
struct pal_ {
- int size; /* # of bytes */
- byte data[256 * 3]; /* up to 8-bit samples */
+ int size; /* # of bytes */
+ byte data[256 * 3]; /* up to 8-bit samples */
} palette;
struct pts_ { /* buffer for accumulating path points */
- gs_int_point current; /* current point as of start of data */
- point_type_t type;
- int count;
- gs_int_point data[NUM_POINTS];
+ gs_int_point current; /* current point as of start of data */
+ point_type_t type;
+ int count;
+ gs_int_point data[NUM_POINTS];
} points;
struct ch_ { /* cache for downloaded characters */
#define MAX_CACHED_CHARS 400
#define MAX_CHAR_DATA 500000
#define MAX_CHAR_SIZE 5000
#define CHAR_HASH_FACTOR 247
- ushort table[MAX_CACHED_CHARS * 3 / 2];
- struct cd_ {
- gs_id id; /* key */
- uint size;
- } data[MAX_CACHED_CHARS];
- int next_in; /* next data element to fill in */
- int next_out; /* next data element to discard */
- int count; /* of occupied data elements */
- ulong used;
+ ushort table[MAX_CACHED_CHARS * 3 / 2];
+ struct cd_ {
+ gs_id id; /* key */
+ uint size;
+ } data[MAX_CACHED_CHARS];
+ int next_in; /* next data element to fill in */
+ int next_out; /* next data element to discard */
+ int count; /* of occupied data elements */
+ ulong used;
} chars;
bool font_set;
int state_rotated; /* 0, 1, 2, -1, mutiple of 90 deg */
@@ -102,18 +101,18 @@ typedef struct gx_device_pclxl_s {
} gx_device_pclxl;
gs_public_st_suffix_add0_final(st_device_pclxl, gx_device_pclxl,
- "gx_device_pclxl",
- device_pclxl_enum_ptrs, device_pclxl_reloc_ptrs,
- gx_device_finalize, st_device_vector);
+ "gx_device_pclxl",
+ device_pclxl_enum_ptrs, device_pclxl_reloc_ptrs,
+ gx_device_finalize, st_device_vector);
#define pclxl_device_body(dname, depth)\
std_device_dci_type_body(gx_device_pclxl, 0, dname, &st_device_pclxl,\
- DEFAULT_WIDTH_10THS * X_DPI / 10,\
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
- X_DPI, Y_DPI,\
- (depth > 8 ? 3 : 1), depth,\
- (depth > 1 ? 255 : 1), (depth > 8 ? 255 : 0),\
- (depth > 1 ? 256 : 2), (depth > 8 ? 256 : 1))
+ DEFAULT_WIDTH_10THS * X_DPI / 10,\
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
+ X_DPI, Y_DPI,\
+ (depth > 8 ? 3 : 1), depth,\
+ (depth > 1 ? 255 : 1), (depth > 8 ? 255 : 0),\
+ (depth > 1 ? 256 : 2), (depth > 8 ? 256 : 1))
/* Driver procedures */
static dev_proc_open_device(pclxl_open_device);
@@ -132,42 +131,42 @@ static dev_proc_strip_copy_rop(pclxl_strip_copy_rop);
#define pclxl_device_procs(map_rgb_color, map_color_rgb)\
{\
- pclxl_open_device,\
- NULL, /* get_initial_matrix */\
- NULL, /* sync_output */\
- pclxl_output_page,\
- pclxl_close_device,\
- map_rgb_color, /* differs */\
- map_color_rgb, /* differs */\
- gdev_vector_fill_rectangle,\
- NULL, /* tile_rectangle */\
- pclxl_copy_mono,\
- pclxl_copy_color,\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- pclxl_get_params,\
- pclxl_put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device,\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- gdev_vector_fill_path,\
- gdev_vector_stroke_path,\
- pclxl_fill_mask,\
- gdev_vector_fill_trapezoid,\
- gdev_vector_fill_parallelogram,\
- gdev_vector_fill_triangle,\
- NULL /****** WRONG ******/, /* draw_thin_line */\
- pclxl_begin_image,\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- pclxl_strip_copy_rop\
+ pclxl_open_device,\
+ NULL, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ pclxl_output_page,\
+ pclxl_close_device,\
+ map_rgb_color, /* differs */\
+ map_color_rgb, /* differs */\
+ gdev_vector_fill_rectangle,\
+ NULL, /* tile_rectangle */\
+ pclxl_copy_mono,\
+ pclxl_copy_color,\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ pclxl_get_params,\
+ pclxl_put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device,\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ gdev_vector_fill_path,\
+ gdev_vector_stroke_path,\
+ pclxl_fill_mask,\
+ gdev_vector_fill_trapezoid,\
+ gdev_vector_fill_parallelogram,\
+ gdev_vector_fill_triangle,\
+ NULL /****** WRONG ******/, /* draw_thin_line */\
+ pclxl_begin_image,\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ pclxl_strip_copy_rop\
}
const gx_device_pclxl gs_pxlmono_device = {
@@ -215,37 +214,37 @@ static void
pclxl_set_color_space(gx_device_pclxl * xdev, pxeColorSpace_t color_space)
{
if (xdev->color_space != color_space) {
- stream *s = pclxl_stream(xdev);
+ stream *s = pclxl_stream(xdev);
- px_put_ub(s, (byte)color_space);
- px_put_ac(s, pxaColorSpace, pxtSetColorSpace);
- xdev->color_space = color_space;
- xdev->palette.size = 0; /* purge the cached palette */
+ px_put_ub(s, (byte)color_space);
+ px_put_ac(s, pxaColorSpace, pxtSetColorSpace);
+ xdev->color_space = color_space;
+ xdev->palette.size = 0; /* purge the cached palette */
}
}
static void
pclxl_set_color_palette(gx_device_pclxl * xdev, pxeColorSpace_t color_space,
- const byte * palette, uint palette_size)
+ const byte * palette, uint palette_size)
{
if (xdev->color_space != color_space ||
- xdev->palette.size != palette_size ||
- memcmp(xdev->palette.data, palette, palette_size)
- ) {
- stream *s = pclxl_stream(xdev);
- static const byte csp_[] = {
- DA(pxaColorSpace),
- DUB(e8Bit), DA(pxaPaletteDepth),
- pxt_ubyte_array
- };
-
- px_put_ub(s, (byte)color_space);
- PX_PUT_LIT(s, csp_);
- px_put_u(s, palette_size);
- px_put_bytes(s, palette, palette_size);
- px_put_ac(s, pxaPaletteData, pxtSetColorSpace);
- xdev->color_space = color_space;
- xdev->palette.size = palette_size;
- memcpy(xdev->palette.data, palette, palette_size);
+ xdev->palette.size != palette_size ||
+ memcmp(xdev->palette.data, palette, palette_size)
+ ) {
+ stream *s = pclxl_stream(xdev);
+ static const byte csp_[] = {
+ DA(pxaColorSpace),
+ DUB(e8Bit), DA(pxaPaletteDepth),
+ pxt_ubyte_array
+ };
+
+ px_put_ub(s, (byte)color_space);
+ PX_PUT_LIT(s, csp_);
+ px_put_u(s, palette_size);
+ px_put_bytes(s, palette, palette_size);
+ px_put_ac(s, pxaPaletteData, pxtSetColorSpace);
+ xdev->color_space = color_space;
+ xdev->palette.size = palette_size;
+ memcpy(xdev->palette.data, palette, palette_size);
}
}
@@ -268,7 +267,7 @@ pclxl_set_cached_nulls(gx_device_pclxl * xdev, px_attribute_t null_source, px_ta
if (op == pxtSetBrushSource) {
if (xdev->brush_null)
return 0;
- else
+ else
xdev->brush_null = true;
}
px_put_uba(s, 0, (byte)null_source);
@@ -279,35 +278,35 @@ pclxl_set_cached_nulls(gx_device_pclxl * xdev, px_attribute_t null_source, px_ta
/* Set a drawing RGB color. */
static int
pclxl_set_color(gx_device_pclxl * xdev, const gx_drawing_color * pdc,
- px_attribute_t null_source, px_tag_t op)
+ px_attribute_t null_source, px_tag_t op)
{
stream *s = pclxl_stream(xdev);
if (gx_dc_is_pure(pdc)) {
- gx_color_index color = gx_dc_pure_color(pdc);
-
- if (op == pxtSetPenSource) xdev->pen_null = false;
- if (op == pxtSetBrushSource) xdev->brush_null = false;
-
- if (xdev->color_info.num_components == 1 || RGB_IS_GRAY(color)) {
- pclxl_set_color_space(xdev, eGray);
- px_put_uba(s, (byte) color, pxaGrayLevel);
- } else {
- pclxl_set_color_space(xdev, eRGB);
- spputc(s, pxt_ubyte_array);
- px_put_ub(s, 3);
- spputc(s, (byte) (color >> 16));
- spputc(s, (byte) (color >> 8));
- spputc(s, (byte) color);
- px_put_a(s, pxaRGBColor);
- }
+ gx_color_index color = gx_dc_pure_color(pdc);
+
+ if (op == pxtSetPenSource) xdev->pen_null = false;
+ if (op == pxtSetBrushSource) xdev->brush_null = false;
+
+ if (xdev->color_info.num_components == 1 || RGB_IS_GRAY(color)) {
+ pclxl_set_color_space(xdev, eGray);
+ px_put_uba(s, (byte) color, pxaGrayLevel);
+ } else {
+ pclxl_set_color_space(xdev, eRGB);
+ spputc(s, pxt_ubyte_array);
+ px_put_ub(s, 3);
+ spputc(s, (byte) (color >> 16));
+ spputc(s, (byte) (color >> 8));
+ spputc(s, (byte) color);
+ px_put_a(s, pxaRGBColor);
+ }
} else if (gx_dc_is_null(pdc) || !color_is_set(pdc)) {
- if (op == pxtSetPenSource || op == pxtSetBrushSource)
- return pclxl_set_cached_nulls(xdev, null_source, op);
- else
- px_put_uba(s, 0, null_source);
+ if (op == pxtSetPenSource || op == pxtSetBrushSource)
+ return pclxl_set_cached_nulls(xdev, null_source, op);
+ else
+ px_put_uba(s, 0, null_source);
} else
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
spputc(s, (byte)op);
return 0;
}
@@ -320,13 +319,13 @@ pclxl_can_handle_color_space(const gs_color_space * pcs)
gs_color_space_index index = gs_color_space_get_index(pcs);
if (index == gs_color_space_index_Indexed) {
- if (pcs->params.indexed.use_proc)
- return false;
- index =
- gs_color_space_get_index(gs_color_space_indexed_base_space(pcs));
+ if (pcs->params.indexed.use_proc)
+ return false;
+ index =
+ gs_color_space_get_index(gs_color_space_indexed_base_space(pcs));
}
return !(index == gs_color_space_index_Separation ||
- index == gs_color_space_index_Pattern ||
+ index == gs_color_space_index_Pattern ||
index == gs_color_space_index_ICC);
}
@@ -338,26 +337,26 @@ pclxl_set_paints(gx_device_pclxl * xdev, gx_path_type_t type)
gx_path_type_t rule = type & gx_path_type_rule;
if (!(type & gx_path_type_fill) &&
- (color_is_set(&xdev->saved_fill_color.saved_dev_color) ||
- !gx_dc_is_null(&xdev->saved_fill_color.saved_dev_color)
- )
- ) {
- pclxl_set_cached_nulls(xdev, pxaNullBrush, pxtSetBrushSource);
- color_set_null(&xdev->saved_fill_color.saved_dev_color);
- if (rule != xdev->fill_rule) {
- px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
- eNonZeroWinding));
- px_put_ac(s, pxaFillMode, pxtSetFillMode);
- xdev->fill_rule = rule;
- }
+ (color_is_set(&xdev->saved_fill_color.saved_dev_color) ||
+ !gx_dc_is_null(&xdev->saved_fill_color.saved_dev_color)
+ )
+ ) {
+ pclxl_set_cached_nulls(xdev, pxaNullBrush, pxtSetBrushSource);
+ color_set_null(&xdev->saved_fill_color.saved_dev_color);
+ if (rule != xdev->fill_rule) {
+ px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
+ eNonZeroWinding));
+ px_put_ac(s, pxaFillMode, pxtSetFillMode);
+ xdev->fill_rule = rule;
+ }
}
if (!(type & gx_path_type_stroke) &&
- (color_is_set(&xdev->saved_stroke_color.saved_dev_color) ||
- !gx_dc_is_null(&xdev->saved_stroke_color.saved_dev_color)
- )
- ) {
- pclxl_set_cached_nulls(xdev, pxaNullPen, pxtSetPenSource);
- color_set_null(&xdev->saved_stroke_color.saved_dev_color);
+ (color_is_set(&xdev->saved_stroke_color.saved_dev_color) ||
+ !gx_dc_is_null(&xdev->saved_stroke_color.saved_dev_color)
+ )
+ ) {
+ pclxl_set_cached_nulls(xdev, pxaNullPen, pxtSetPenSource);
+ color_set_null(&xdev->saved_stroke_color.saved_dev_color);
}
}
@@ -439,156 +438,156 @@ pclxl_flush_points(gx_device_pclxl * xdev)
int count = xdev->points.count;
if (count) {
- stream *s = pclxl_stream(xdev);
- px_tag_t op;
- int x = xdev->points.current.x, y = xdev->points.current.y;
- int uor = 0, sor = 0;
- pxeDataType_t data_type;
- int i, di;
- byte diffs[NUM_POINTS * 2];
- floatp x_scale = 1;
- floatp y_scale = 1;
- int temp_origin_x = 0, temp_origin_y = 0;
- int count_smalls = 0;
-
- if (xdev->points.type != POINTS_NONE) {
- for (i = 0; i < count; ++i) {
- if ((abs(xdev->points.data[i].x) > 0x7FFF) || (abs(xdev->points.data[i].y) > 0x7FFF))
- xdev->scaled = true;
- if ((abs(xdev->points.data[i].x) < 0x8000) && (abs(xdev->points.data[i].y) < 0x8000)) {
- if ((temp_origin_x != xdev->points.data[i].x) || (temp_origin_y != xdev->points.data[i].y)) {
- temp_origin_x = xdev->points.data[i].x;
- temp_origin_y = xdev->points.data[i].y;
- count_smalls++;
- }
- }
- }
- if (xdev->scaled) {
- /* if there are some points with small co-ordinates, we set origin to it
- before scaling, an unset afterwards. This works around problems
- for small co-ordinates being moved snapped to 32767 x 32767 grid points;
- if there are more than 1, the other points
- will be in-accurate, unfortunately */
- if (count_smalls) {
- pclxl_set_page_origin(s, temp_origin_x, temp_origin_y);
- }
- for (i = 0; i < count; ++i) {
- x_scale = max(((floatp) abs(xdev->points.data[i].x - temp_origin_x))/0x7FFF , x_scale);
- y_scale = max(((floatp) abs(xdev->points.data[i].y - temp_origin_y))/0x7FFF , y_scale);
- }
- for (i = 0; i < count; ++i) {
- xdev->points.data[i].x = (int)((xdev->points.data[i].x - temp_origin_x)/x_scale + 0.5);
- xdev->points.data[i].y = (int)((xdev->points.data[i].y - temp_origin_y)/y_scale + 0.5);
- }
- x = (int)((x - temp_origin_x)/x_scale + 0.5);
- y = (int)((y - temp_origin_y)/y_scale + 0.5);
- pclxl_set_page_scale(xdev, x_scale, y_scale);
- } else {
- /* don't reset origin if we did not scale */
- count_smalls = 0;
- }
- }
- /*
- * Writing N lines using a point list requires 11 + 4*N or 11 +
- * 2*N bytes, as opposed to 8*N bytes using separate commands;
- * writing N curves requires 11 + 12*N or 11 + 6*N bytes
- * vs. 22*N. So it's always shorter to write curves with a
- * list (except for N = 1 with full-size coordinates, but since
- * the difference is only 1 byte, we don't bother to ever use
- * the non-list form), but lines are shorter only if N >= 3
- * (again, with a 1-byte difference if N = 2 and byte
- * coordinates).
- */
- switch (xdev->points.type) {
- case POINTS_NONE:
- return 0;
- case POINTS_LINES:
- op = pxtLinePath;
- if (count < 3) {
- for (i = 0; i < count; ++i) {
- px_put_ssp(s, xdev->points.data[i].x,
- xdev->points.data[i].y);
- px_put_a(s, pxaEndPoint);
- spputc(s, (byte)op);
- }
- pclxl_unset_page_scale(xdev);
- if (count_smalls)
- pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
- goto zap;
- }
- /* See if we can use byte values. */
- for (i = di = 0; i < count; ++i, di += 2) {
- int dx = xdev->points.data[i].x - x;
- int dy = xdev->points.data[i].y - y;
-
- diffs[di] = (byte) dx;
- diffs[di + 1] = (byte) dy;
- uor |= dx | dy;
- sor |= (dx + 0x80) | (dy + 0x80);
- x += dx, y += dy;
- }
- if (!(uor & ~0xff))
- data_type = eUByte;
- else if (!(sor & ~0xff))
- data_type = eSByte;
- else
- break;
- op = pxtLineRelPath;
- /* Use byte values. */
- useb:px_put_np(s, count, data_type);
- spputc(s, (byte)op);
- px_put_data_length(s, count * 2); /* 2 bytes per point */
- px_put_bytes(s, diffs, count * 2);
- pclxl_unset_page_scale(xdev);
- if (count_smalls)
- pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
- goto zap;
- case POINTS_CURVES:
- op = pxtBezierPath;
- /* See if we can use byte values. */
- for (i = di = 0; i < count; i += 3, di += 6) {
- int dx1 = xdev->points.data[i].x - x;
- int dy1 = xdev->points.data[i].y - y;
- int dx2 = xdev->points.data[i + 1].x - x;
- int dy2 = xdev->points.data[i + 1].y - y;
- int dx = xdev->points.data[i + 2].x - x;
- int dy = xdev->points.data[i + 2].y - y;
-
- diffs[di] = (byte) dx1;
- diffs[di + 1] = (byte) dy1;
- diffs[di + 2] = (byte) dx2;
- diffs[di + 3] = (byte) dy2;
- diffs[di + 4] = (byte) dx;
- diffs[di + 5] = (byte) dy;
- uor |= dx1 | dy1 | dx2 | dy2 | dx | dy;
- sor |= (dx1 + 0x80) | (dy1 + 0x80) |
- (dx2 + 0x80) | (dy2 + 0x80) |
- (dx + 0x80) | (dy + 0x80);
- x += dx, y += dy;
- }
- if (!(uor & ~0xff))
- data_type = eUByte;
- else if (!(sor & ~0xff))
- data_type = eSByte;
- else
- break;
- op = pxtBezierRelPath;
- goto useb;
- default: /* can't happen */
- return_error(gs_error_unknownerror);
- }
- px_put_np(s, count, eSInt16);
- spputc(s, (byte)op);
- px_put_data_length(s, count * 4); /* 2 UInt16s per point */
- for (i = 0; i < count; ++i) {
- px_put_s(s, xdev->points.data[i].x);
- px_put_s(s, xdev->points.data[i].y);
- }
- pclxl_unset_page_scale(xdev);
- if (count_smalls)
- pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
+ stream *s = pclxl_stream(xdev);
+ px_tag_t op;
+ int x = xdev->points.current.x, y = xdev->points.current.y;
+ int uor = 0, sor = 0;
+ pxeDataType_t data_type;
+ int i, di;
+ byte diffs[NUM_POINTS * 2];
+ floatp x_scale = 1;
+ floatp y_scale = 1;
+ int temp_origin_x = 0, temp_origin_y = 0;
+ int count_smalls = 0;
+
+ if (xdev->points.type != POINTS_NONE) {
+ for (i = 0; i < count; ++i) {
+ if ((abs(xdev->points.data[i].x) > 0x7FFF) || (abs(xdev->points.data[i].y) > 0x7FFF))
+ xdev->scaled = true;
+ if ((abs(xdev->points.data[i].x) < 0x8000) && (abs(xdev->points.data[i].y) < 0x8000)) {
+ if ((temp_origin_x != xdev->points.data[i].x) || (temp_origin_y != xdev->points.data[i].y)) {
+ temp_origin_x = xdev->points.data[i].x;
+ temp_origin_y = xdev->points.data[i].y;
+ count_smalls++;
+ }
+ }
+ }
+ if (xdev->scaled) {
+ /* if there are some points with small co-ordinates, we set origin to it
+ before scaling, an unset afterwards. This works around problems
+ for small co-ordinates being moved snapped to 32767 x 32767 grid points;
+ if there are more than 1, the other points
+ will be in-accurate, unfortunately */
+ if (count_smalls) {
+ pclxl_set_page_origin(s, temp_origin_x, temp_origin_y);
+ }
+ for (i = 0; i < count; ++i) {
+ x_scale = max(((floatp) abs(xdev->points.data[i].x - temp_origin_x))/0x7FFF , x_scale);
+ y_scale = max(((floatp) abs(xdev->points.data[i].y - temp_origin_y))/0x7FFF , y_scale);
+ }
+ for (i = 0; i < count; ++i) {
+ xdev->points.data[i].x = (int)((xdev->points.data[i].x - temp_origin_x)/x_scale + 0.5);
+ xdev->points.data[i].y = (int)((xdev->points.data[i].y - temp_origin_y)/y_scale + 0.5);
+ }
+ x = (int)((x - temp_origin_x)/x_scale + 0.5);
+ y = (int)((y - temp_origin_y)/y_scale + 0.5);
+ pclxl_set_page_scale(xdev, x_scale, y_scale);
+ } else {
+ /* don't reset origin if we did not scale */
+ count_smalls = 0;
+ }
+ }
+ /*
+ * Writing N lines using a point list requires 11 + 4*N or 11 +
+ * 2*N bytes, as opposed to 8*N bytes using separate commands;
+ * writing N curves requires 11 + 12*N or 11 + 6*N bytes
+ * vs. 22*N. So it's always shorter to write curves with a
+ * list (except for N = 1 with full-size coordinates, but since
+ * the difference is only 1 byte, we don't bother to ever use
+ * the non-list form), but lines are shorter only if N >= 3
+ * (again, with a 1-byte difference if N = 2 and byte
+ * coordinates).
+ */
+ switch (xdev->points.type) {
+ case POINTS_NONE:
+ return 0;
+ case POINTS_LINES:
+ op = pxtLinePath;
+ if (count < 3) {
+ for (i = 0; i < count; ++i) {
+ px_put_ssp(s, xdev->points.data[i].x,
+ xdev->points.data[i].y);
+ px_put_a(s, pxaEndPoint);
+ spputc(s, (byte)op);
+ }
+ pclxl_unset_page_scale(xdev);
+ if (count_smalls)
+ pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
+ goto zap;
+ }
+ /* See if we can use byte values. */
+ for (i = di = 0; i < count; ++i, di += 2) {
+ int dx = xdev->points.data[i].x - x;
+ int dy = xdev->points.data[i].y - y;
+
+ diffs[di] = (byte) dx;
+ diffs[di + 1] = (byte) dy;
+ uor |= dx | dy;
+ sor |= (dx + 0x80) | (dy + 0x80);
+ x += dx, y += dy;
+ }
+ if (!(uor & ~0xff))
+ data_type = eUByte;
+ else if (!(sor & ~0xff))
+ data_type = eSByte;
+ else
+ break;
+ op = pxtLineRelPath;
+ /* Use byte values. */
+ useb:px_put_np(s, count, data_type);
+ spputc(s, (byte)op);
+ px_put_data_length(s, count * 2); /* 2 bytes per point */
+ px_put_bytes(s, diffs, count * 2);
+ pclxl_unset_page_scale(xdev);
+ if (count_smalls)
+ pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
+ goto zap;
+ case POINTS_CURVES:
+ op = pxtBezierPath;
+ /* See if we can use byte values. */
+ for (i = di = 0; i < count; i += 3, di += 6) {
+ int dx1 = xdev->points.data[i].x - x;
+ int dy1 = xdev->points.data[i].y - y;
+ int dx2 = xdev->points.data[i + 1].x - x;
+ int dy2 = xdev->points.data[i + 1].y - y;
+ int dx = xdev->points.data[i + 2].x - x;
+ int dy = xdev->points.data[i + 2].y - y;
+
+ diffs[di] = (byte) dx1;
+ diffs[di + 1] = (byte) dy1;
+ diffs[di + 2] = (byte) dx2;
+ diffs[di + 3] = (byte) dy2;
+ diffs[di + 4] = (byte) dx;
+ diffs[di + 5] = (byte) dy;
+ uor |= dx1 | dy1 | dx2 | dy2 | dx | dy;
+ sor |= (dx1 + 0x80) | (dy1 + 0x80) |
+ (dx2 + 0x80) | (dy2 + 0x80) |
+ (dx + 0x80) | (dy + 0x80);
+ x += dx, y += dy;
+ }
+ if (!(uor & ~0xff))
+ data_type = eUByte;
+ else if (!(sor & ~0xff))
+ data_type = eSByte;
+ else
+ break;
+ op = pxtBezierRelPath;
+ goto useb;
+ default: /* can't happen */
+ return_error(gs_error_unknownerror);
+ }
+ px_put_np(s, count, eSInt16);
+ spputc(s, (byte)op);
+ px_put_data_length(s, count * 4); /* 2 UInt16s per point */
+ for (i = 0; i < count; ++i) {
+ px_put_s(s, xdev->points.data[i].x);
+ px_put_s(s, xdev->points.data[i].y);
+ }
+ pclxl_unset_page_scale(xdev);
+ if (count_smalls)
+ pclxl_set_page_origin(s, -temp_origin_x, -temp_origin_y);
zap:xdev->points.type = POINTS_NONE;
- xdev->points.count = 0;
+ xdev->points.count = 0;
}
return 0;
}
@@ -604,7 +603,7 @@ static const gx_image_enum_procs_t pclxl_image_enum_procs = {
/* Begin an image. */
static void
pclxl_write_begin_image(gx_device_pclxl * xdev, uint width, uint height,
- uint dest_width, uint dest_height)
+ uint dest_width, uint dest_height)
{
stream *s = pclxl_stream(xdev);
@@ -620,7 +619,7 @@ pclxl_write_begin_image(gx_device_pclxl * xdev, uint width, uint height,
/* RLE version */
static void
pclxl_write_image_data_RLE(gx_device_pclxl * xdev, const byte * base, int data_bit,
- uint raster, uint width_bits, int y, int height)
+ uint raster, uint width_bits, int y, int height)
{
stream *s = pclxl_stream(xdev);
uint width_bytes = (width_bits + 7) >> 3;
@@ -634,63 +633,63 @@ pclxl_write_image_data_RLE(gx_device_pclxl * xdev, const byte * base, int data_b
px_put_usa(s, y, pxaStartLine);
px_put_usa(s, height, pxaBlockHeight);
if (compress) {
- stream_RLE_state rlstate;
- stream_cursor_write w;
- stream_cursor_read r;
-
- /*
- * H-P printers require that all the data for an operator be
- * contained in a single data block. Thus, we must allocate a
- * temporary buffer for the compressed data. Currently we don't go
- * to the trouble of doing two passes if we can't allocate a buffer
- * large enough for the entire transfer.
- */
- byte *buf = gs_alloc_bytes(xdev->v_memory, num_bytes,
- "pclxl_write_image_data");
-
- if (buf == 0)
- goto nc;
- s_RLE_set_defaults_inline(&rlstate);
- rlstate.EndOfData = false;
- s_RLE_init_inline(&rlstate);
- w.ptr = buf - 1;
- w.limit = w.ptr + num_bytes;
- /*
- * If we ever overrun the buffer, it means that the compressed
- * data was larger than the uncompressed. If this happens,
- * write the data uncompressed.
- */
- for (i = 0; i < height; ++i) {
- r.ptr = data + i * raster - 1;
- r.limit = r.ptr + width_bytes;
- if ((*s_RLE_template.process)
- ((stream_state *) & rlstate, &r, &w, true) != 0 ||
- r.ptr != r.limit
- )
- goto ncfree;
- r.ptr = (const byte *)"\000\000\000\000\000";
- r.limit = r.ptr + (-(int)width_bytes & 3);
- if ((*s_RLE_template.process)
- ((stream_state *) & rlstate, &r, &w, true) != 0 ||
- r.ptr != r.limit
- )
- goto ncfree;
- }
- r.ptr = r.limit;
- if ((*s_RLE_template.process)
- ((stream_state *) & rlstate, &r, &w, true) != 0
- )
- goto ncfree;
- {
- uint count = w.ptr + 1 - buf;
-
- px_put_ub(s, eRLECompression);
- px_put_ac(s, pxaCompressMode, pxtReadImage);
- px_put_data_length(s, count);
- px_put_bytes(s, buf, count);
- }
- gs_free_object(xdev->v_memory, buf, "pclxl_write_image_data");
- return;
+ stream_RLE_state rlstate;
+ stream_cursor_write w;
+ stream_cursor_read r;
+
+ /*
+ * H-P printers require that all the data for an operator be
+ * contained in a single data block. Thus, we must allocate a
+ * temporary buffer for the compressed data. Currently we don't go
+ * to the trouble of doing two passes if we can't allocate a buffer
+ * large enough for the entire transfer.
+ */
+ byte *buf = gs_alloc_bytes(xdev->v_memory, num_bytes,
+ "pclxl_write_image_data");
+
+ if (buf == 0)
+ goto nc;
+ s_RLE_set_defaults_inline(&rlstate);
+ rlstate.EndOfData = false;
+ s_RLE_init_inline(&rlstate);
+ w.ptr = buf - 1;
+ w.limit = w.ptr + num_bytes;
+ /*
+ * If we ever overrun the buffer, it means that the compressed
+ * data was larger than the uncompressed. If this happens,
+ * write the data uncompressed.
+ */
+ for (i = 0; i < height; ++i) {
+ r.ptr = data + i * raster - 1;
+ r.limit = r.ptr + width_bytes;
+ if ((*s_RLE_template.process)
+ ((stream_state *) & rlstate, &r, &w, true) != 0 ||
+ r.ptr != r.limit
+ )
+ goto ncfree;
+ r.ptr = (const byte *)"\000\000\000\000\000";
+ r.limit = r.ptr + (-(int)width_bytes & 3);
+ if ((*s_RLE_template.process)
+ ((stream_state *) & rlstate, &r, &w, true) != 0 ||
+ r.ptr != r.limit
+ )
+ goto ncfree;
+ }
+ r.ptr = r.limit;
+ if ((*s_RLE_template.process)
+ ((stream_state *) & rlstate, &r, &w, true) != 0
+ )
+ goto ncfree;
+ {
+ uint count = w.ptr + 1 - buf;
+
+ px_put_ub(s, eRLECompression);
+ px_put_ac(s, pxaCompressMode, pxtReadImage);
+ px_put_data_length(s, count);
+ px_put_bytes(s, buf, count);
+ }
+ gs_free_object(xdev->v_memory, buf, "pclxl_write_image_data");
+ return;
ncfree:gs_free_object(xdev->v_memory, buf, "pclxl_write_image_data");
}
nc:
@@ -699,8 +698,8 @@ pclxl_write_image_data_RLE(gx_device_pclxl * xdev, const byte * base, int data_b
px_put_ac(s, pxaCompressMode, pxtReadImage);
px_put_data_length(s, num_bytes);
for (i = 0; i < height; ++i) {
- px_put_bytes(s, data + i * raster, width_bytes);
- px_put_bytes(s, (const byte *)"\000\000\000\000", -(int)width_bytes & 3);
+ px_put_bytes(s, data + i * raster, width_bytes);
+ px_put_bytes(s, (const byte *)"\000\000\000\000", -(int)width_bytes & 3);
}
}
/* DeltaRow compression (also called "mode 3"):
@@ -712,7 +711,7 @@ pclxl_write_image_data_RLE(gx_device_pclxl * xdev, const byte * base, int data_b
*/
static void
pclxl_write_image_data_DeltaRow(gx_device_pclxl * xdev, const byte * base, int data_bit,
- uint raster, uint width_bits, int y, int height)
+ uint raster, uint width_bits, int y, int height)
{
stream *s = pclxl_stream(xdev);
uint width_bytes = (width_bits + 7) >> 3;
@@ -732,7 +731,7 @@ pclxl_write_image_data_DeltaRow(gx_device_pclxl * xdev, const byte * base, int d
/* the RLE routine can write uncompressed without extra-allocation */
if ((buf == 0) || (prow == 0)) {
pclxl_write_image_data_RLE(xdev, data, data_bit, raster, width_bits, y, height);
- return;
+ return;
}
/* initialize the seed row */
memset(prow, 0, width_bytes);
@@ -759,7 +758,7 @@ pclxl_write_image_data_DeltaRow(gx_device_pclxl * xdev, const byte * base, int d
static void
pclxl_write_image_data(gx_device_pclxl * xdev, const byte * data, int data_bit,
- uint raster, uint width_bits, int y, int height)
+ uint raster, uint width_bits, int y, int height)
{
/* If we only have 1 line, it does not make sense to do DeltaRow */
if (height < 2) {
@@ -792,13 +791,13 @@ static void
px_put_string(stream * s, const byte * data, uint len, bool wide)
{
if (wide) {
- spputc(s, pxt_uint16_array);
- px_put_u(s, len);
- px_put_bytes(s, data, len * 2);
+ spputc(s, pxt_uint16_array);
+ px_put_u(s, len);
+ px_put_bytes(s, data, len * 2);
} else {
- spputc(s, pxt_ubyte_array);
- px_put_u(s, len);
- px_put_bytes(s, data, len);
+ spputc(s, pxt_ubyte_array);
+ px_put_u(s, len);
+ px_put_bytes(s, data, len);
}
}
@@ -817,18 +816,18 @@ pclxl_define_bitmap_font(gx_device_pclxl * xdev)
{
stream *s = pclxl_stream(xdev);
static const byte bfh_[] = {
- DA(pxaFontName), DUB(0), DA(pxaFontFormat),
- pxtBeginFontHeader,
- DUS(8 + 6 + 4 + 6), DA(pxaFontHeaderLength),
- pxtReadFontHeader,
- pxt_dataLengthByte, 8 + 6 + 4 + 6,
- 0, 0, 0, 0,
- 254, 0, (MAX_CACHED_CHARS + 255) >> 8, 0,
- 'B', 'R', 0, 0, 0, 4
+ DA(pxaFontName), DUB(0), DA(pxaFontFormat),
+ pxtBeginFontHeader,
+ DUS(8 + 6 + 4 + 6), DA(pxaFontHeaderLength),
+ pxtReadFontHeader,
+ pxt_dataLengthByte, 8 + 6 + 4 + 6,
+ 0, 0, 0, 0,
+ 254, 0, (MAX_CACHED_CHARS + 255) >> 8, 0,
+ 'B', 'R', 0, 0, 0, 4
};
static const byte efh_[] = {
- 0xff, 0xff, 0, 0, 0, 0,
- pxtEndFontHeader
+ 0xff, 0xff, 0, 0, 0, 0,
+ pxtEndFontHeader
};
PX_PUT_LIT(s, bfh_);
@@ -844,8 +843,8 @@ pclxl_set_font(gx_device_pclxl * xdev)
{
stream *s = pclxl_stream(xdev);
static const byte sf_[] = {
- DA(pxaFontName), DUB(1), DA(pxaCharSize), DUS(0), DA(pxaSymbolSet),
- pxtSetFont
+ DA(pxaFontName), DUB(1), DA(pxaCharSize), DUS(0), DA(pxaSymbolSet),
+ pxtSetFont
};
PX_PUT_LIT(s, sf_);
@@ -855,7 +854,7 @@ pclxl_set_font(gx_device_pclxl * xdev)
/* with the font name immediately before calling this procedure. */
static void
pclxl_define_bitmap_char(gx_device_pclxl * xdev, uint ccode,
- const byte * data, uint raster, uint width_bits, uint height)
+ const byte * data, uint raster, uint width_bits, uint height)
{
stream *s = pclxl_stream(xdev);
uint width_bytes = (width_bits + 7) >> 3;
@@ -866,17 +865,17 @@ pclxl_define_bitmap_char(gx_device_pclxl * xdev, uint ccode,
px_put_u(s, ccode);
px_put_a(s, pxaCharCode);
if (size > 0xffff) {
- spputc(s, pxt_uint32);
- px_put_l(s, (ulong) size);
+ spputc(s, pxt_uint32);
+ px_put_l(s, (ulong) size);
} else
- px_put_us(s, size);
+ px_put_us(s, size);
px_put_ac(s, pxaCharDataSize, pxtReadChar);
px_put_data_length(s, size);
px_put_bytes(s, (const byte *)"\000\000\000\000\000\000", 6);
px_put_us_be(s, width_bits);
px_put_us_be(s, height);
for (i = 0; i < height; ++i)
- px_put_bytes(s, data + i * raster, width_bytes);
+ px_put_bytes(s, data + i * raster, width_bytes);
spputc(s, pxtEndChar);
}
@@ -898,18 +897,18 @@ pclxl_char_index(gx_device_pclxl * xdev, gs_id id)
uint ccode;
for (i = (id * CHAR_HASH_FACTOR) % countof(xdev->chars.table);;
- i = (i == 0 ? countof(xdev->chars.table) : i) - 1
- ) {
- ccode = xdev->chars.table[i];
- if (ccode == 0)
- return (i_empty >= 0 ? i_empty : i);
- else if (ccode == 1) {
- if (i_empty < 0)
- i_empty = i;
- else if (i == i_empty) /* full table */
- return i;
- } else if (xdev->chars.data[ccode].id == id)
- return i;
+ i = (i == 0 ? countof(xdev->chars.table) : i) - 1
+ ) {
+ ccode = xdev->chars.table[i];
+ if (ccode == 0)
+ return (i_empty >= 0 ? i_empty : i);
+ else if (ccode == 1) {
+ if (i_empty < 0)
+ i_empty = i;
+ else if (i == i_empty) /* full table */
+ return i;
+ } else if (xdev->chars.data[ccode].id == id)
+ return i;
}
}
@@ -921,18 +920,18 @@ pclxl_remove_char(gx_device_pclxl * xdev, int index)
int i;
if (ccode < 2)
- return;
+ return;
xdev->chars.count--;
xdev->chars.used -= xdev->chars.data[ccode].size;
xdev->chars.table[index] = 1; /* mark as deleted */
i = (index == 0 ? countof(xdev->chars.table) : index) - 1;
if (xdev->chars.table[i] == 0) {
- /* The next slot in probe order is empty. */
- /* Mark this slot and any deleted predecessors as empty. */
- for (i = index; xdev->chars.table[i] == 1;
- i = (i == countof(xdev->chars.table) - 1 ? 0 : i + 1)
- )
- xdev->chars.table[i] = 0;
+ /* The next slot in probe order is empty. */
+ /* Mark this slot and any deleted predecessors as empty. */
+ for (i = index; xdev->chars.table[i] == 1;
+ i = (i == countof(xdev->chars.table) - 1 ? 0 : i + 1)
+ )
+ xdev->chars.table[i] = 0;
}
}
@@ -941,7 +940,7 @@ pclxl_remove_char(gx_device_pclxl * xdev, int index)
/* We know id != gs_no_id. */
static int
pclxl_copy_text_char(gx_device_pclxl * xdev, const byte * data,
- int raster, gx_bitmap_id id, int w, int h)
+ int raster, gx_bitmap_id id, int w, int h)
{
uint width_bytes = (w + 7) >> 3;
uint size = width_bytes * h;
@@ -950,45 +949,45 @@ pclxl_copy_text_char(gx_device_pclxl * xdev, const byte * data,
stream *s = pclxl_stream(xdev);
if (size > MAX_CHAR_SIZE)
- return -1;
+ return -1;
index = pclxl_char_index(xdev, id);
if ((ccode = xdev->chars.table[index]) < 2) {
- /* Enter the character in the table. */
- while (xdev->chars.used + size > MAX_CHAR_DATA ||
- xdev->chars.count >= MAX_CACHED_CHARS - 2
- ) {
- ccode = xdev->chars.next_out;
- index = pclxl_char_index(xdev, xdev->chars.data[ccode].id);
- pclxl_remove_char(xdev, index);
- xdev->chars.next_out =
- (ccode == MAX_CACHED_CHARS - 1 ? 2 : ccode + 1);
- }
- index = pclxl_char_index(xdev, id);
- ccode = xdev->chars.next_in;
- xdev->chars.data[ccode].id = id;
- xdev->chars.data[ccode].size = size;
- xdev->chars.table[index] = ccode;
- xdev->chars.next_in =
- (ccode == MAX_CACHED_CHARS - 1 ? 2 : ccode + 1);
- if (!xdev->chars.count++) {
- /* This is the very first character. */
- pclxl_write_font_name(xdev);
- pclxl_define_bitmap_font(xdev);
- }
- xdev->chars.used += size;
- pclxl_write_font_name(xdev);
- pclxl_define_bitmap_char(xdev, ccode, data, raster, w, h);
+ /* Enter the character in the table. */
+ while (xdev->chars.used + size > MAX_CHAR_DATA ||
+ xdev->chars.count >= MAX_CACHED_CHARS - 2
+ ) {
+ ccode = xdev->chars.next_out;
+ index = pclxl_char_index(xdev, xdev->chars.data[ccode].id);
+ pclxl_remove_char(xdev, index);
+ xdev->chars.next_out =
+ (ccode == MAX_CACHED_CHARS - 1 ? 2 : ccode + 1);
+ }
+ index = pclxl_char_index(xdev, id);
+ ccode = xdev->chars.next_in;
+ xdev->chars.data[ccode].id = id;
+ xdev->chars.data[ccode].size = size;
+ xdev->chars.table[index] = ccode;
+ xdev->chars.next_in =
+ (ccode == MAX_CACHED_CHARS - 1 ? 2 : ccode + 1);
+ if (!xdev->chars.count++) {
+ /* This is the very first character. */
+ pclxl_write_font_name(xdev);
+ pclxl_define_bitmap_font(xdev);
+ }
+ xdev->chars.used += size;
+ pclxl_write_font_name(xdev);
+ pclxl_define_bitmap_char(xdev, ccode, data, raster, w, h);
}
if (!xdev->font_set) {
- pclxl_write_font_name(xdev);
- pclxl_set_font(xdev);
- xdev->font_set = true;
+ pclxl_write_font_name(xdev);
+ pclxl_set_font(xdev);
+ xdev->font_set = true;
} {
- byte cc_bytes[2];
+ byte cc_bytes[2];
- cc_bytes[0] = (byte) ccode;
- cc_bytes[1] = ccode >> 8;
- px_put_string(s, cc_bytes, 1, cc_bytes[1] != 0);
+ cc_bytes[0] = (byte) ccode;
+ cc_bytes[1] = ccode >> 8;
+ px_put_string(s, cc_bytes, 1, cc_bytes[1] != 0);
}
px_put_ac(s, pxaTextData, pxtText);
return 0;
@@ -1017,13 +1016,13 @@ pclxl_beginpage(gx_device_vector * vdev)
px_write_page_header(s, (const gx_device *)vdev);
- if (xdev->ManualFeed_set && xdev->ManualFeed)
- media_source = 2;
+ if (xdev->ManualFeed_set && xdev->ManualFeed)
+ media_source = 2;
else if (xdev->MediaPosition_set && xdev->MediaPosition >= 0 )
- media_source = xdev->MediaPosition;
-
+ media_source = xdev->MediaPosition;
+
px_write_select_media(s, (const gx_device *)vdev, &xdev->media_size,
- &media_source,
+ &media_source,
xdev->page, xdev->Duplex, xdev->Tumble);
spputc(s, pxtBeginPage);
@@ -1085,32 +1084,32 @@ pclxl_setmiterlimit(gx_device_vector * vdev, floatp limit)
static int
pclxl_setdash(gx_device_vector * vdev, const float *pattern, uint count,
- floatp offset)
+ floatp offset)
{
stream *s = gdev_vector_stream(vdev);
if (count == 0) {
- static const byte nac_[] = {
- DUB(0), DA(pxaSolidLine)
- };
+ static const byte nac_[] = {
+ DUB(0), DA(pxaSolidLine)
+ };
- PX_PUT_LIT(s, nac_);
+ PX_PUT_LIT(s, nac_);
} else if (count > 255)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
else {
- uint i;
-
- /*
- * Astoundingly, PCL XL doesn't allow real numbers here.
- * Do the best we can.
- */
- spputc(s, pxt_uint16_array);
- px_put_ub(s, (byte)count);
- for (i = 0; i < count; ++i)
- px_put_s(s, (uint)pattern[i]);
- px_put_a(s, pxaLineDashStyle);
- if (offset != 0)
- px_put_usa(s, (uint)offset, pxaDashOffset);
+ uint i;
+
+ /*
+ * Astoundingly, PCL XL doesn't allow real numbers here.
+ * Do the best we can.
+ */
+ spputc(s, pxt_uint16_array);
+ px_put_ub(s, (byte)count);
+ for (i = 0; i < count; ++i)
+ px_put_s(s, (uint)pattern[i]);
+ px_put_a(s, pxaLineDashStyle);
+ if (offset != 0)
+ px_put_usa(s, (uint)offset, pxaDashOffset);
}
spputc(s, pxtSetLineDash);
return 0;
@@ -1118,34 +1117,34 @@ pclxl_setdash(gx_device_vector * vdev, const float *pattern, uint count,
static int
pclxl_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff)
+ gs_logical_operation_t diff)
{
stream *s = gdev_vector_stream(vdev);
if (diff & lop_S_transparent) {
- px_put_ub(s, (byte)(lop & lop_S_transparent ? 1 : 0));
- px_put_ac(s, pxaTxMode, pxtSetSourceTxMode);
+ px_put_ub(s, (byte)(lop & lop_S_transparent ? 1 : 0));
+ px_put_ac(s, pxaTxMode, pxtSetSourceTxMode);
}
if (diff & lop_T_transparent) {
- px_put_ub(s, (byte)(lop & lop_T_transparent ? 1 : 0));
- px_put_ac(s, pxaTxMode, pxtSetPaintTxMode);
+ px_put_ub(s, (byte)(lop & lop_T_transparent ? 1 : 0));
+ px_put_ac(s, pxaTxMode, pxtSetPaintTxMode);
}
if (lop_rop(diff)) {
- px_put_ub(s, (byte)lop_rop(lop));
- px_put_ac(s, pxaROP3, pxtSetROP);
+ px_put_ub(s, (byte)lop_rop(lop));
+ px_put_ac(s, pxaROP3, pxtSetROP);
}
return 0;
}
static int
-pclxl_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
+pclxl_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc)
{
return false;
}
static int
-pclxl_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
+pclxl_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
@@ -1154,7 +1153,7 @@ pclxl_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
}
static int
-pclxl_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
+pclxl_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
@@ -1164,7 +1163,7 @@ pclxl_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
static int
pclxl_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type)
+ fixed y1, gx_path_type_t type)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
stream *s = gdev_vector_stream(vdev);
@@ -1172,24 +1171,24 @@ pclxl_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
/* Check for out-of-range points. */
#define OUT_OF_RANGE(v) (v < 0 || v >= int2fixed(0x10000))
if (OUT_OF_RANGE(x0) || OUT_OF_RANGE(y0) ||
- OUT_OF_RANGE(x1) || OUT_OF_RANGE(y1)
- )
- return_error(gs_error_rangecheck);
+ OUT_OF_RANGE(x1) || OUT_OF_RANGE(y1)
+ )
+ return_error(gs_error_rangecheck);
#undef OUT_OF_RANGE
if (type & (gx_path_type_fill | gx_path_type_stroke)) {
- pclxl_set_paints(xdev, type);
- px_put_usq_fixed(s, x0, y0, x1, y1);
- px_put_ac(s, pxaBoundingBox, pxtRectangle);
+ pclxl_set_paints(xdev, type);
+ px_put_usq_fixed(s, x0, y0, x1, y1);
+ px_put_ac(s, pxaBoundingBox, pxtRectangle);
}
if (type & gx_path_type_clip) {
- static const byte cr_[] = {
- DA(pxaBoundingBox),
- DUB(eInterior), DA(pxaClipRegion),
- pxtSetClipRectangle
- };
-
- px_put_usq_fixed(s, x0, y0, x1, y1);
- PX_PUT_LIT(s, cr_);
+ static const byte cr_[] = {
+ DA(pxaBoundingBox),
+ DUB(eInterior), DA(pxaClipRegion),
+ pxtSetClipRectangle
+ };
+
+ px_put_usq_fixed(s, x0, y0, x1, y1);
+ PX_PUT_LIT(s, cr_);
}
return 0;
}
@@ -1208,70 +1207,70 @@ pclxl_beginpath(gx_device_vector * vdev, gx_path_type_t type)
static int
pclxl_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
int code = pclxl_flush_points(xdev);
if (code < 0)
- return code;
+ return code;
return pclxl_set_cursor(xdev,
- xdev->points.current.x = (int)(x+0.5),
- xdev->points.current.y = (int)(y+0.5));
+ xdev->points.current.x = (int)(x+0.5),
+ xdev->points.current.y = (int)(y+0.5));
}
static int
pclxl_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x, floatp y,
- gx_path_type_t type)
+ gx_path_type_t type)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
if (xdev->points.type != POINTS_LINES ||
- xdev->points.count >= NUM_POINTS
- ) {
- if (xdev->points.type != POINTS_NONE) {
- int code = pclxl_flush_points(xdev);
-
- if (code < 0)
- return code;
- }
- xdev->points.current.x = (int)(x0+0.5);
- xdev->points.current.y = (int)(y0+0.5);
- xdev->points.type = POINTS_LINES;
+ xdev->points.count >= NUM_POINTS
+ ) {
+ if (xdev->points.type != POINTS_NONE) {
+ int code = pclxl_flush_points(xdev);
+
+ if (code < 0)
+ return code;
+ }
+ xdev->points.current.x = (int)(x0+0.5);
+ xdev->points.current.y = (int)(y0+0.5);
+ xdev->points.type = POINTS_LINES;
} {
- gs_int_point *ppt = &xdev->points.data[xdev->points.count++];
+ gs_int_point *ppt = &xdev->points.data[xdev->points.count++];
- ppt->x = (int)(x+0.5), ppt->y = (int)(y+0.5);
+ ppt->x = (int)(x+0.5), ppt->y = (int)(y+0.5);
}
return 0;
}
static int
pclxl_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
if (xdev->points.type != POINTS_CURVES ||
- xdev->points.count >= NUM_POINTS - 2
- ) {
- if (xdev->points.type != POINTS_NONE) {
- int code = pclxl_flush_points(xdev);
-
- if (code < 0)
- return code;
- }
- xdev->points.current.x = (int)(x0+0.5);
- xdev->points.current.y = (int)(y0+0.5);
- xdev->points.type = POINTS_CURVES;
+ xdev->points.count >= NUM_POINTS - 2
+ ) {
+ if (xdev->points.type != POINTS_NONE) {
+ int code = pclxl_flush_points(xdev);
+
+ if (code < 0)
+ return code;
+ }
+ xdev->points.current.x = (int)(x0+0.5);
+ xdev->points.current.y = (int)(y0+0.5);
+ xdev->points.type = POINTS_CURVES;
}
{
- gs_int_point *ppt = &xdev->points.data[xdev->points.count];
+ gs_int_point *ppt = &xdev->points.data[xdev->points.count];
- ppt->x = (int)(x1+0.5), ppt->y = (int)(y1+0.5), ++ppt;
- ppt->x = (int)(x2+0.5), ppt->y = (int)(y2+0.5), ++ppt;
- ppt->x = (int)(x3+0.5), ppt->y = (int)(y3+0.5);
+ ppt->x = (int)(x1+0.5), ppt->y = (int)(y1+0.5), ++ppt;
+ ppt->x = (int)(x2+0.5), ppt->y = (int)(y2+0.5), ++ppt;
+ ppt->x = (int)(x3+0.5), ppt->y = (int)(y3+0.5);
}
xdev->points.count += 3;
return 0;
@@ -1279,14 +1278,14 @@ pclxl_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
static int
pclxl_closepath(gx_device_vector * vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
gx_device_pclxl *const xdev = (gx_device_pclxl *)vdev;
stream *s = gdev_vector_stream(vdev);
int code = pclxl_flush_points(xdev);
if (code < 0)
- return code;
+ return code;
spputc(s, pxtCloseSubPath);
xdev->points.current.x = (int)(x_start+0.5);
xdev->points.current.y = (int)(y_start+0.5);
@@ -1302,29 +1301,29 @@ pclxl_endpath(gx_device_vector * vdev, gx_path_type_t type)
gx_path_type_t rule = type & gx_path_type_rule;
if (code < 0)
- return code;
+ return code;
if (type & (gx_path_type_fill | gx_path_type_stroke)) {
- if (rule != xdev->fill_rule) {
- px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
- eNonZeroWinding));
- px_put_ac(s, pxaFillMode, pxtSetFillMode);
- xdev->fill_rule = rule;
- }
- pclxl_set_paints(xdev, type);
- spputc(s, pxtPaintPath);
+ if (rule != xdev->fill_rule) {
+ px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
+ eNonZeroWinding));
+ px_put_ac(s, pxaFillMode, pxtSetFillMode);
+ xdev->fill_rule = rule;
+ }
+ pclxl_set_paints(xdev, type);
+ spputc(s, pxtPaintPath);
}
if (type & gx_path_type_clip) {
- static const byte scr_[] = {
- DUB(eInterior), DA(pxaClipRegion), pxtSetClipReplace
- };
-
- if (rule != xdev->clip_rule) {
- px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
- eNonZeroWinding));
- px_put_ac(s, pxaClipMode, pxtSetClipMode);
- xdev->clip_rule = rule;
- }
- PX_PUT_LIT(s, scr_);
+ static const byte scr_[] = {
+ DUB(eInterior), DA(pxaClipRegion), pxtSetClipReplace
+ };
+
+ if (rule != xdev->clip_rule) {
+ px_put_ub(s, (byte)(rule == gx_path_type_even_odd ? eEvenOdd :
+ eNonZeroWinding));
+ px_put_ac(s, pxaClipMode, pxtSetClipMode);
+ xdev->clip_rule = rule;
+ }
+ PX_PUT_LIT(s, scr_);
}
return 0;
}
@@ -1332,9 +1331,9 @@ pclxl_endpath(gx_device_vector * vdev, gx_path_type_t type)
/* Vector implementation procedures */
static const gx_device_vector_procs pclxl_vector_procs = {
- /* Page management */
+ /* Page management */
pclxl_beginpage,
- /* Imager state */
+ /* Imager state */
pclxl_setlinewidth,
pclxl_setlinecap,
pclxl_setlinejoin,
@@ -1342,11 +1341,11 @@ static const gx_device_vector_procs pclxl_vector_procs = {
pclxl_setdash,
gdev_vector_setflat,
pclxl_setlogop,
- /* Other state */
+ /* Other state */
pclxl_can_handle_hl_color,
pclxl_setfillcolor,
pclxl_setstrokecolor,
- /* Paths */
+ /* Paths */
gdev_vector_dopath,
pclxl_dorect,
pclxl_beginpath,
@@ -1372,9 +1371,9 @@ pclxl_open_device(gx_device * dev)
vdev->v_memory = dev->memory; /****** WRONG ******/
vdev->vec_procs = &pclxl_vector_procs;
code = gdev_vector_open_file_options(vdev, 512,
- VECTOR_OPEN_FILE_SEQUENTIAL);
+ VECTOR_OPEN_FILE_SEQUENTIAL);
if (code < 0)
- return code;
+ return code;
pclxl_page_init(xdev);
px_write_file_header(vdev->strm, dev);
@@ -1394,14 +1393,14 @@ pclxl_output_page(gx_device * dev, int num_copies, int flush)
/* Note that unlike close_device, end_page must not omit blank pages. */
if (!xdev->in_page)
- pclxl_beginpage((gx_device_vector *)dev);
+ pclxl_beginpage((gx_device_vector *)dev);
s = xdev->strm;
px_put_usa(s, (uint)num_copies, pxaPageCopies); /* num_copies */
spputc(s, pxtEndPage);
sflush(s);
pclxl_page_init(xdev);
if (ferror(xdev->file))
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
return gx_finish_output_page(dev, num_copies, flush);
}
@@ -1415,9 +1414,9 @@ pclxl_close_device(gx_device * dev)
FILE *file = xdev->file;
if (xdev->strm != NULL)
- sflush(xdev->strm);
+ sflush(xdev->strm);
if (xdev->in_page)
- fputc(pxtEndPage, file);
+ fputc(pxtEndPage, file);
px_write_file_trailer(file);
return gdev_vector_close_file((gx_device_vector *)dev);
}
@@ -1431,8 +1430,8 @@ static const byte eBit_values[] = {
/* Copy a monochrome bitmap. */
static int
pclxl_copy_mono(gx_device * dev, const byte * data, int data_x, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pclxl *const xdev = (gx_device_pclxl *)dev;
@@ -1449,30 +1448,30 @@ pclxl_copy_mono(gx_device * dev, const byte * data, int data_x, int raster,
fit_copy(dev, data, data_x, raster, id, x, y, w, h);
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
/* write_image_data() needs byte-alignment,
* and gx_default_copy_* is more efficient than pxlcl_*
* for small rasters. See details in copy_color().
*/
if ( ((data_x & 7) != 0) || (h == 1) || (w == 1) )
- return gx_default_copy_mono(dev, data, data_x, raster, id,
- x, y, w, h, zero, one);
+ return gx_default_copy_mono(dev, data, data_x, raster, id,
+ x, y, w, h, zero, one);
pclxl_set_cursor(xdev, x, y);
if (id != gs_no_id && zero == gx_no_color_index &&
- one != gx_no_color_index && data_x == 0
- ) {
- gx_drawing_color dcolor;
-
- code = gdev_vector_update_log_op(vdev, rop3_T|lop_T_transparent);
- if (code < 0)
- return 0;
-
- set_nonclient_dev_color(&dcolor, one);
- pclxl_setfillcolor(vdev, NULL, &dcolor);
- if (pclxl_copy_text_char(xdev, data, raster, id, w, h) >= 0)
- return 0;
+ one != gx_no_color_index && data_x == 0
+ ) {
+ gx_drawing_color dcolor;
+
+ code = gdev_vector_update_log_op(vdev, rop3_T|lop_T_transparent);
+ if (code < 0)
+ return 0;
+
+ set_nonclient_dev_color(&dcolor, one);
+ pclxl_setfillcolor(vdev, NULL, &dcolor);
+ if (pclxl_copy_text_char(xdev, data, raster, id, w, h) >= 0)
+ return 0;
}
/*
* The following doesn't work if we're writing white with a mask.
@@ -1494,71 +1493,71 @@ pclxl_copy_mono(gx_device * dev, const byte * data, int data_x, int raster,
*
* There is a further refinement to this algorithm - it appears that
* black+mask is treated specially by the vector driver core (rendered
- * as transparent on white), and does not work as non-white + mask.
+ * as transparent on white), and does not work as non-white + mask.
* So Instead we set mask color to white and do (S & D) (i.e. draw
* background on mask, instead of transparent on mask).
*
*/
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- if (one != white) {
- if (one == black) {
- lop = (rop3_S & rop3_D);
- } else {
- lop = rop3_S | lop_S_transparent;
- }
- color0 = white;
- } else {
- lop = rop3_S | (rop3_D & rop3_not(rop3_S));
- color0 = black;
- }
+ if (one == gx_no_color_index)
+ return 0;
+ if (one != white) {
+ if (one == black) {
+ lop = (rop3_S & rop3_D);
+ } else {
+ lop = rop3_S | lop_S_transparent;
+ }
+ color0 = white;
+ } else {
+ lop = rop3_S | (rop3_D & rop3_not(rop3_S));
+ color0 = black;
+ }
} else if (one == gx_no_color_index) {
- if (zero != white) {
- if (zero == black) {
- lop = (rop3_S & rop3_D);
- } else {
- lop = rop3_S | lop_S_transparent;
- }
- color1 = white;
- } else {
- lop = rop3_S | (rop3_D & rop3_not(rop3_S));
- color1 = black;
- }
+ if (zero != white) {
+ if (zero == black) {
+ lop = (rop3_S & rop3_D);
+ } else {
+ lop = rop3_S | lop_S_transparent;
+ }
+ color1 = white;
+ } else {
+ lop = rop3_S | (rop3_D & rop3_not(rop3_S));
+ color1 = black;
+ }
} else {
- lop = rop3_S;
+ lop = rop3_S;
}
if (dev->color_info.num_components == 1 ||
- (RGB_IS_GRAY(color0) && RGB_IS_GRAY(color1))
- ) {
- palette[0] = (byte) color0;
- palette[1] = (byte) color1;
- palette_size = 2;
- color_space = eGray;
- if_debug2('b', "color palette %02X %02X\n", palette[0], palette[1]);
+ (RGB_IS_GRAY(color0) && RGB_IS_GRAY(color1))
+ ) {
+ palette[0] = (byte) color0;
+ palette[1] = (byte) color1;
+ palette_size = 2;
+ color_space = eGray;
+ if_debug2('b', "color palette %02X %02X\n", palette[0], palette[1]);
} else {
- palette[0] = (byte) (color0 >> 16);
- palette[1] = (byte) (color0 >> 8);
- palette[2] = (byte) color0;
- palette[3] = (byte) (color1 >> 16);
- palette[4] = (byte) (color1 >> 8);
- palette[5] = (byte) color1;
- palette_size = 6;
- color_space = eRGB;
+ palette[0] = (byte) (color0 >> 16);
+ palette[1] = (byte) (color0 >> 8);
+ palette[2] = (byte) color0;
+ palette[3] = (byte) (color1 >> 16);
+ palette[4] = (byte) (color1 >> 8);
+ palette[5] = (byte) color1;
+ palette_size = 6;
+ color_space = eRGB;
}
code = gdev_vector_update_log_op(vdev, lop);
if (code < 0)
- return 0;
+ return 0;
pclxl_set_color_palette(xdev, color_space, palette, palette_size);
s = pclxl_stream(xdev);
{
- static const byte mi_[] = {
- DUB(e1Bit), DA(pxaColorDepth),
- DUB(eIndexedPixel), DA(pxaColorMapping)
- };
+ static const byte mi_[] = {
+ DUB(e1Bit), DA(pxaColorDepth),
+ DUB(eIndexedPixel), DA(pxaColorMapping)
+ };
- PX_PUT_LIT(s, mi_);
+ PX_PUT_LIT(s, mi_);
}
pclxl_write_begin_image(xdev, w, h, w, h);
pclxl_write_image_data(xdev, data, data_x, raster, w, 0, h);
@@ -1569,8 +1568,8 @@ pclxl_copy_mono(gx_device * dev, const byte * data, int data_x, int raster,
/* Copy a color bitmap. */
static int
pclxl_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pclxl *const xdev = (gx_device_pclxl *)dev;
@@ -1581,8 +1580,7 @@ pclxl_copy_color(gx_device * dev,
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
-
+ return code;
source_bit = sourcex * dev->color_info.depth;
@@ -1603,26 +1601,26 @@ pclxl_copy_color(gx_device * dev,
* than images.
*/
if ( ((source_bit & 7) != 0) || (w == 1) || (h == 1) )
- return gx_default_copy_color(dev, base, sourcex, raster, id,
- x, y, w, h);
+ return gx_default_copy_color(dev, base, sourcex, raster, id,
+ x, y, w, h);
code = gdev_vector_update_log_op(vdev, rop3_S);
if(code < 0)
return 0;
pclxl_set_cursor(xdev, x, y);
s = pclxl_stream(xdev);
{
- static const byte ci_[] = {
- DA(pxaColorDepth),
- DUB(eDirectPixel), DA(pxaColorMapping)
- };
-
- px_put_ub(s, eBit_values[dev->color_info.depth /
- dev->color_info.num_components]);
- PX_PUT_LIT(s, ci_);
+ static const byte ci_[] = {
+ DA(pxaColorDepth),
+ DUB(eDirectPixel), DA(pxaColorMapping)
+ };
+
+ px_put_ub(s, eBit_values[dev->color_info.depth /
+ dev->color_info.num_components]);
+ PX_PUT_LIT(s, ci_);
}
pclxl_write_begin_image(xdev, w, h, w, h);
pclxl_write_image_data(xdev, base, source_bit, raster,
- w * dev->color_info.depth, 0, h);
+ w * dev->color_info.depth, 0, h);
pclxl_write_end_image(xdev);
return 0;
}
@@ -1630,10 +1628,10 @@ pclxl_copy_color(gx_device * dev,
/* Fill a mask. */
static int
pclxl_fill_mask(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pclxl *const xdev = (gx_device_pclxl *)dev;
@@ -1647,23 +1645,23 @@ pclxl_fill_mask(gx_device * dev,
* for small rasters. See details in copy_color().
*/
if ((data_x & 7) != 0 || !gx_dc_is_pure(pdcolor) || depth > 1 || (w == 1) || (h == 1) )
- return gx_default_fill_mask(dev, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth,
- lop, pcpath);
+ return gx_default_fill_mask(dev, data, data_x, raster, id,
+ x, y, w, h, pdcolor, depth,
+ lop, pcpath);
code = gdev_vector_update_clip_path(vdev, pcpath);
foreground = gx_dc_pure_color(pdcolor);
if (code < 0)
- return code;
+ return code;
code = gdev_vector_update_fill_color(vdev, NULL, pdcolor);
if (code < 0)
- return 0;
+ return 0;
pclxl_set_cursor(xdev, x, y);
if (id != gs_no_id && data_x == 0) {
- code = gdev_vector_update_log_op(vdev, lop);
- if (code < 0)
- return 0;
- if (pclxl_copy_text_char(xdev, data, raster, id, w, h) >= 0)
- return 0;
+ code = gdev_vector_update_log_op(vdev, lop);
+ if (code < 0)
+ return 0;
+ if (pclxl_copy_text_char(xdev, data, raster, id, w, h) >= 0)
+ return 0;
}
/* This is similiar to the copy_mono white-on-mask,
* except we are drawing white on the black of a black/white mask,
@@ -1675,18 +1673,18 @@ pclxl_fill_mask(gx_device * dev,
}else lop |= rop3_S | lop_S_transparent;
code = gdev_vector_update_log_op(vdev,
- lop);
+ lop);
if (code < 0)
- return 0;
+ return 0;
pclxl_set_color_palette(xdev, eGray, (const byte *)"\377\000", 2);
s = pclxl_stream(xdev);
{
- static const byte mi_[] = {
- DUB(e1Bit), DA(pxaColorDepth),
- DUB(eIndexedPixel), DA(pxaColorMapping)
- };
+ static const byte mi_[] = {
+ DUB(e1Bit), DA(pxaColorDepth),
+ DUB(eIndexedPixel), DA(pxaColorMapping)
+ };
- PX_PUT_LIT(s, mi_);
+ PX_PUT_LIT(s, mi_);
}
pclxl_write_begin_image(xdev, w, h, w, h);
pclxl_write_image_data(xdev, data, data_x, raster, w, 0, h);
@@ -1697,12 +1695,12 @@ pclxl_fill_mask(gx_device * dev,
/* Do a RasterOp. */
static int
pclxl_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
- uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{ /* We can't do general RasterOps yet. */
/****** WORK IN PROGRESS ******/
return 0;
@@ -1715,25 +1713,25 @@ typedef struct pclxl_image_enum_s {
gdev_vector_image_enum_common;
gs_matrix mat;
struct ir_ {
- byte *data;
- int num_rows; /* # of allocated rows */
- int first_y;
- uint raster;
+ byte *data;
+ int num_rows; /* # of allocated rows */
+ int first_y;
+ uint raster;
} rows;
} pclxl_image_enum_t;
gs_private_st_suffix_add1(st_pclxl_image_enum, pclxl_image_enum_t,
- "pclxl_image_enum_t", pclxl_image_enum_enum_ptrs,
- pclxl_image_enum_reloc_ptrs, st_vector_image_enum,
- rows.data);
+ "pclxl_image_enum_t", pclxl_image_enum_enum_ptrs,
+ pclxl_image_enum_reloc_ptrs, st_vector_image_enum,
+ rows.data);
/* Start processing an image. */
static int
pclxl_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
gx_device_vector *const vdev = (gx_device_vector *)dev;
gx_device_pclxl *const xdev = (gx_device_pclxl *)dev;
@@ -1747,8 +1745,8 @@ pclxl_begin_image(gx_device * dev,
* images, i.e., num_planes = 1.
*/
int bits_per_pixel =
- (pim->ImageMask ? 1 :
- pim->BitsPerComponent * gs_color_space_num_components(pcs));
+ (pim->ImageMask ? 1 :
+ pim->BitsPerComponent * gs_color_space_num_components(pcs));
gs_matrix mat;
int code;
@@ -1766,35 +1764,35 @@ pclxl_begin_image(gx_device * dev,
*/
if ((!((mat.xx * mat.yy > 0) && (mat.xy == 0) && (mat.yx == 0)) &&
!((mat.xx == 0) && (mat.yy == 0) && (mat.xy * mat.yx < 0))) ||
- (pim->ImageMask ?
- (!gx_dc_is_pure(pdcolor) || pim->CombineWithColor) :
- (!pclxl_can_handle_color_space(pim->ColorSpace) ||
- (bits_per_pixel != 1 && bits_per_pixel != 4 &&
- bits_per_pixel != 8 && bits_per_pixel !=24))) ||
- format != gs_image_format_chunky || pim->Interpolate ||
- prect
- )
- goto use_default;
+ (pim->ImageMask ?
+ (!gx_dc_is_pure(pdcolor) || pim->CombineWithColor) :
+ (!pclxl_can_handle_color_space(pim->ColorSpace) ||
+ (bits_per_pixel != 1 && bits_per_pixel != 4 &&
+ bits_per_pixel != 8 && bits_per_pixel !=24))) ||
+ format != gs_image_format_chunky || pim->Interpolate ||
+ prect
+ )
+ goto use_default;
row_raster = (bits_per_pixel * pim->Width + 7) >> 3;
num_rows = MAX_ROW_DATA / row_raster;
if (num_rows > pim->Height)
- num_rows = pim->Height;
+ num_rows = pim->Height;
if (num_rows <= 0)
- num_rows = 1;
+ num_rows = 1;
pie = gs_alloc_struct(mem, pclxl_image_enum_t, &st_pclxl_image_enum,
- "pclxl_begin_image");
+ "pclxl_begin_image");
row_data = gs_alloc_bytes(mem, num_rows * row_raster,
- "pclxl_begin_image(rows)");
+ "pclxl_begin_image(rows)");
if (pie == 0 || row_data == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
code = gdev_vector_begin_image(vdev, pis, pim, format, prect,
- pdcolor, pcpath, mem,
- &pclxl_image_enum_procs,
- (gdev_vector_image_enum_t *)pie);
+ pdcolor, pcpath, mem,
+ &pclxl_image_enum_procs,
+ (gdev_vector_image_enum_t *)pie);
if (code < 0)
- return code;
+ return code;
/* emit a PXL XL rotation and adjust mat correspondingly */
if (mat.xx * mat.yy > 0) {
@@ -1841,33 +1839,33 @@ pclxl_begin_image(gx_device * dev,
pie->rows.raster = row_raster;
*pinfo = (gx_image_enum_common_t *) pie;
{
- gs_logical_operation_t lop = pis->log_op;
-
- if (pim->ImageMask) {
- const byte *palette = (const byte *)
- (pim->Decode[0] ? "\377\000" : "\000\377");
- gx_color_index foreground = gx_dc_pure_color(pdcolor);
-
- code = gdev_vector_update_fill_color(vdev,
- NULL, /* use process color */
- pdcolor);
- if (code < 0)
- goto fail;
- /* This is similiar to the copy_mono white-on-mask,
- * except we are drawing white on the black of a black/white mask,
- * so we invert source, compared to copy_mono */
- if (foreground == (1 << dev->color_info.depth) - 1) { /* white */
- lop = rop3_not(rop3_S) | (rop3_D & rop3_S);
- }else if (foreground == 0) { /* black */
- lop = (rop3_S & rop3_D);
- }else lop |= rop3_S | lop_S_transparent;
-
- code = gdev_vector_update_log_op
- (vdev, lop);
- if (code < 0)
- goto fail;
- pclxl_set_color_palette(xdev, eGray, palette, 2);
- } else {
+ gs_logical_operation_t lop = pis->log_op;
+
+ if (pim->ImageMask) {
+ const byte *palette = (const byte *)
+ (pim->Decode[0] ? "\377\000" : "\000\377");
+ gx_color_index foreground = gx_dc_pure_color(pdcolor);
+
+ code = gdev_vector_update_fill_color(vdev,
+ NULL, /* use process color */
+ pdcolor);
+ if (code < 0)
+ goto fail;
+ /* This is similiar to the copy_mono white-on-mask,
+ * except we are drawing white on the black of a black/white mask,
+ * so we invert source, compared to copy_mono */
+ if (foreground == (1 << dev->color_info.depth) - 1) { /* white */
+ lop = rop3_not(rop3_S) | (rop3_D & rop3_S);
+ }else if (foreground == 0) { /* black */
+ lop = (rop3_S & rop3_D);
+ }else lop |= rop3_S | lop_S_transparent;
+
+ code = gdev_vector_update_log_op
+ (vdev, lop);
+ if (code < 0)
+ goto fail;
+ pclxl_set_color_palette(xdev, eGray, palette, 2);
+ } else {
if (bits_per_pixel == 24 ) {
code = gdev_vector_update_log_op
(vdev, (pim->CombineWithColor ? lop : rop3_know_T_0(lop)));
@@ -1879,50 +1877,50 @@ pclxl_begin_image(gx_device * dev,
pclxl_set_color_space(xdev, eRGB);
}
} else {
- int bpc = pim->BitsPerComponent;
- int num_components = pie->plane_depths[0] * pie->num_planes / bpc;
- int sample_max = (1 << bpc) - 1;
- byte palette[256 * 3];
- int i;
-
- code = gdev_vector_update_log_op
- (vdev, (pim->CombineWithColor ? lop : rop3_know_T_0(lop)));
- if (code < 0)
- goto fail;
- for (i = 0; i < 1 << bits_per_pixel; ++i) {
- gs_client_color cc;
- gx_device_color devc;
- int cv = i, j;
- gx_color_index ci;
-
- for (j = num_components - 1; j >= 0; cv >>= bpc, --j)
- cc.paint.values[j] = pim->Decode[j * 2] +
- (cv & sample_max) *
- (pim->Decode[j * 2 + 1] - pim->Decode[j * 2]) /
- sample_max;
- (*pcs->type->remap_color)
- (&cc, pcs, &devc, pis, dev, gs_color_select_source);
- if (!gx_dc_is_pure(&devc))
- return_error(gs_error_Fatal);
- ci = gx_dc_pure_color(&devc);
- if (dev->color_info.num_components == 1) {
- palette[i] = (byte)ci;
- } else {
- byte *ppal = &palette[i * 3];
-
- ppal[0] = (byte) (ci >> 16);
- ppal[1] = (byte) (ci >> 8);
- ppal[2] = (byte) ci;
- }
- }
- if (dev->color_info.num_components == 1)
- pclxl_set_color_palette(xdev, eGray, palette,
- 1 << bits_per_pixel);
- else
- pclxl_set_color_palette(xdev, eRGB, palette,
- 3 << bits_per_pixel);
+ int bpc = pim->BitsPerComponent;
+ int num_components = pie->plane_depths[0] * pie->num_planes / bpc;
+ int sample_max = (1 << bpc) - 1;
+ byte palette[256 * 3];
+ int i;
+
+ code = gdev_vector_update_log_op
+ (vdev, (pim->CombineWithColor ? lop : rop3_know_T_0(lop)));
+ if (code < 0)
+ goto fail;
+ for (i = 0; i < 1 << bits_per_pixel; ++i) {
+ gs_client_color cc;
+ gx_device_color devc;
+ int cv = i, j;
+ gx_color_index ci;
+
+ for (j = num_components - 1; j >= 0; cv >>= bpc, --j)
+ cc.paint.values[j] = pim->Decode[j * 2] +
+ (cv & sample_max) *
+ (pim->Decode[j * 2 + 1] - pim->Decode[j * 2]) /
+ sample_max;
+ (*pcs->type->remap_color)
+ (&cc, pcs, &devc, pis, dev, gs_color_select_source);
+ if (!gx_dc_is_pure(&devc))
+ return_error(gs_error_Fatal);
+ ci = gx_dc_pure_color(&devc);
+ if (dev->color_info.num_components == 1) {
+ palette[i] = (byte)ci;
+ } else {
+ byte *ppal = &palette[i * 3];
+
+ ppal[0] = (byte) (ci >> 16);
+ ppal[1] = (byte) (ci >> 8);
+ ppal[2] = (byte) ci;
+ }
+ }
+ if (dev->color_info.num_components == 1)
+ pclxl_set_color_palette(xdev, eGray, palette,
+ 1 << bits_per_pixel);
+ else
+ pclxl_set_color_palette(xdev, eRGB, palette,
+ 3 << bits_per_pixel);
}
- }
+ }
}
return 0;
fail:
@@ -1934,7 +1932,7 @@ pclxl_begin_image(gx_device * dev,
else
pclxl_set_color_space(xdev, eRGB);
return gx_default_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, mem, pinfo);
+ pdcolor, pcpath, mem, pinfo);
}
/* Write one strip of an image, from pie->rows.first_y to pie->y. */
@@ -1942,13 +1940,13 @@ static int
image_transform_x(const pclxl_image_enum_t *pie, int sx)
{
return (int)((pie->mat.tx + sx * pie->mat.xx + 0.5) /
- ((const gx_device_pclxl *)pie->dev)->scale.x);
+ ((const gx_device_pclxl *)pie->dev)->scale.x);
}
static int
image_transform_y(const pclxl_image_enum_t *pie, int sy)
{
return (int)((pie->mat.ty + sy * pie->mat.yy + 0.5) /
- ((const gx_device_pclxl *)pie->dev)->scale.y);
+ ((const gx_device_pclxl *)pie->dev)->scale.y);
}
static int
@@ -1965,16 +1963,16 @@ pclxl_image_write_rows(pclxl_image_enum_t *pie)
int rows_raster=pie->rows.raster;
if (dw <= 0 || dh <= 0)
- return 0;
+ return 0;
pclxl_set_cursor(xdev, xo, yo);
if (pie->bits_per_pixel==24) {
- static const byte ci_[] = {
- DA(pxaColorDepth),
- DUB(eDirectPixel), DA(pxaColorMapping)
- };
+ static const byte ci_[] = {
+ DA(pxaColorDepth),
+ DUB(eDirectPixel), DA(pxaColorMapping)
+ };
- px_put_ub(s, eBit_values[8]);
- PX_PUT_LIT(s, ci_);
+ px_put_ub(s, eBit_values[8]);
+ PX_PUT_LIT(s, ci_);
if (xdev->color_info.depth==8) {
byte *in=pie->rows.data;
byte *out=pie->rows.data;
@@ -1983,9 +1981,9 @@ pclxl_image_write_rows(pclxl_image_enum_t *pie)
rows_raster/=3;
for (j=0; j<h; j++) {
for (i=0; i<rows_raster; i++) {
- *out = (byte)( ((*(in+0) * (ulong) lum_red_weight) +
- (*(in+1) * (ulong) lum_green_weight) +
- (*(in+2) * (ulong) lum_blue_weight) +
+ *out = (byte)( ((*(in+0) * (ulong) lum_red_weight) +
+ (*(in+1) * (ulong) lum_green_weight) +
+ (*(in+2) * (ulong) lum_blue_weight) +
(lum_all_weights / 2)) / lum_all_weights);
in+=3;
out++;
@@ -1994,15 +1992,15 @@ pclxl_image_write_rows(pclxl_image_enum_t *pie)
}
} else {
static const byte ii_[] = {
- DA(pxaColorDepth),
- DUB(eIndexedPixel), DA(pxaColorMapping)
+ DA(pxaColorDepth),
+ DUB(eIndexedPixel), DA(pxaColorMapping)
};
px_put_ub(s, eBit_values[pie->bits_per_pixel]);
PX_PUT_LIT(s, ii_);
}
pclxl_write_begin_image(xdev, pie->width, h, dw, dh);
pclxl_write_image_data(xdev, pie->rows.data, 0, rows_raster,
- rows_raster << 3, 0, h);
+ rows_raster << 3, 0, h);
pclxl_write_end_image(xdev);
return 0;
}
@@ -2010,8 +2008,8 @@ pclxl_image_write_rows(pclxl_image_enum_t *pie)
/* Process the next piece of an image. */
static int
pclxl_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
pclxl_image_enum_t *pie = (pclxl_image_enum_t *) info;
int data_bit = planes[0].data_x * info->plane_depths[0];
@@ -2020,21 +2018,21 @@ pclxl_image_plane_data(gx_image_enum_common_t * info,
/****** SHOULD HANDLE NON-BYTE-ALIGNED DATA ******/
if (width_bits != pie->bits_per_row || (data_bit & 7) != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (height > pie->height - pie->y)
- height = pie->height - pie->y;
+ height = pie->height - pie->y;
for (i = 0; i < height; pie->y++, ++i) {
- if (pie->y - pie->rows.first_y == pie->rows.num_rows) {
- int code = pclxl_image_write_rows(pie);
-
- if (code < 0)
- return code;
- pie->rows.first_y = pie->y;
- }
- memcpy(pie->rows.data +
- pie->rows.raster * (pie->y - pie->rows.first_y),
- planes[0].data + planes[0].raster * i + (data_bit >> 3),
- pie->rows.raster);
+ if (pie->y - pie->rows.first_y == pie->rows.num_rows) {
+ int code = pclxl_image_write_rows(pie);
+
+ if (code < 0)
+ return code;
+ pie->rows.first_y = pie->y;
+ }
+ memcpy(pie->rows.data +
+ pie->rows.raster * (pie->y - pie->rows.first_y),
+ planes[0].data + planes[0].raster * i + (data_bit >> 3),
+ pie->rows.raster);
}
*rows_used = height;
return pie->y >= pie->height;
@@ -2049,7 +2047,7 @@ pclxl_image_end_image(gx_image_enum_common_t * info, bool draw_last)
/* Write the final strip, if any. */
if (pie->y > pie->rows.first_y && draw_last)
- code = pclxl_image_write_rows(pie);
+ code = pclxl_image_write_rows(pie);
if (draw_last) {
gx_device_pclxl *xdev = (gx_device_pclxl *)info->dev;
stream *s = pclxl_stream(xdev);
@@ -2091,7 +2089,6 @@ pclxl_get_params(gx_device *dev, /* I - Device info */
gx_device_pclxl *xdev; /* PCL XL device */
int code; /* Return code */
-
/*
* First process the "standard" page device parameters...
*/
@@ -2122,7 +2119,6 @@ pclxl_get_params(gx_device *dev, /* I - Device info */
return (0);
}
-
/*
* 'pclxl_put_params()' - Set pagedevice parameters.
*/
@@ -2136,7 +2132,6 @@ pclxl_put_params(gx_device *dev, /* I - Device info */
int intval; /* Integer value */
bool boolval; /* Boolean value */
-
/*
* Process PCL-XL driver parameters...
*/
diff --git a/gs/base/gdevpxen.h b/gs/base/gdevpxen.h
index 49cbdbc6b..708c14da8 100644
--- a/gs/base/gdevpxen.h
+++ b/gs/base/gdevpxen.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -319,5 +319,5 @@ typedef enum {
eCIELabmatch2,
pxeColorTreatment_next
} pxeColorTreatment;
-
+
#endif /* gdevpxen_INCLUDED */
diff --git a/gs/base/gdevpxop.h b/gs/base/gdevpxop.h
index 6d798268c..85e71c20e 100644
--- a/gs/base/gdevpxop.h
+++ b/gs/base/gdevpxop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gdevpxut.c b/gs/base/gdevpxut.c
index e94780c2b..9fc2b8011 100644
--- a/gs/base/gdevpxut.c
+++ b/gs/base/gdevpxut.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,72 +41,72 @@ px_write_file_header(stream *s, const gx_device *dev)
static const char *const resolution_1200 = "1200";
static const char *const resolution_2400 = "2400";
static const char *const file_header =
- "\n@PJL ENTER LANGUAGE = PCLXL\n\
+ "\n@PJL ENTER LANGUAGE = PCLXL\n\
) HP-PCL XL;1;1;Comment Copyright Artifex Sofware, Inc. 2005\000\n";
static const byte stream_header[] = {
- DA(pxaUnitsPerMeasure),
- DUB(0), DA(pxaMeasure),
- DUB(eBackChAndErrPage), DA(pxaErrorReport),
- pxtBeginSession,
- DUB(0), DA(pxaSourceType),
- DUB(eBinaryLowByteFirst), DA(pxaDataOrg),
- pxtOpenDataSource
+ DA(pxaUnitsPerMeasure),
+ DUB(0), DA(pxaMeasure),
+ DUB(eBackChAndErrPage), DA(pxaErrorReport),
+ pxtBeginSession,
+ DUB(0), DA(pxaSourceType),
+ DUB(eBinaryLowByteFirst), DA(pxaDataOrg),
+ pxtOpenDataSource
};
px_put_bytes(s, (const byte *)enter_pjl_header,
- strlen(enter_pjl_header));
+ strlen(enter_pjl_header));
if (dev->color_info.num_components == 1)
- px_put_bytes(s, (const byte *)rendermode_gray,
- strlen(rendermode_gray));
+ px_put_bytes(s, (const byte *)rendermode_gray,
+ strlen(rendermode_gray));
else
- px_put_bytes(s, (const byte *)rendermode_color,
- strlen(rendermode_color));
+ px_put_bytes(s, (const byte *)rendermode_color,
+ strlen(rendermode_color));
px_put_bytes(s, (const byte *)pjl_resolution,
- strlen(pjl_resolution));
+ strlen(pjl_resolution));
if ((uint) (dev->HWResolution[0] + 0.5) == 150)
- px_put_bytes(s, (const byte *)resolution_150,
- strlen(resolution_150));
+ px_put_bytes(s, (const byte *)resolution_150,
+ strlen(resolution_150));
else if ((uint) (dev->HWResolution[0] + 0.5) == 300)
- px_put_bytes(s, (const byte *)resolution_300,
- strlen(resolution_300));
+ px_put_bytes(s, (const byte *)resolution_300,
+ strlen(resolution_300));
else if ((uint) (dev->HWResolution[0] + 0.5) == 1200)
- px_put_bytes(s, (const byte *)resolution_1200,
- strlen(resolution_1200));
+ px_put_bytes(s, (const byte *)resolution_1200,
+ strlen(resolution_1200));
else if ((uint) (dev->HWResolution[0] + 0.5) == 2400)
- px_put_bytes(s, (const byte *)resolution_2400,
- strlen(resolution_2400));
- else
+ px_put_bytes(s, (const byte *)resolution_2400,
+ strlen(resolution_2400));
+ else
px_put_bytes(s, (const byte *)resolution_600,
- strlen(resolution_600));
+ strlen(resolution_600));
if ((uint) (dev->HWResolution[1] + 0.5) !=
- (uint) (dev->HWResolution[0] + 0.5)) {
+ (uint) (dev->HWResolution[0] + 0.5)) {
px_put_bytes(s, (const byte *)"x", strlen("x"));
- if ((uint) (dev->HWResolution[1] + 0.5) == 150)
- px_put_bytes(s, (const byte *)resolution_150,
- strlen(resolution_150));
- else if ((uint) (dev->HWResolution[1] + 0.5) == 300)
- px_put_bytes(s, (const byte *)resolution_300,
- strlen(resolution_300));
- else if ((uint) (dev->HWResolution[1] + 0.5) == 1200)
- px_put_bytes(s, (const byte *)resolution_1200,
- strlen(resolution_1200));
- else if ((uint) (dev->HWResolution[1] + 0.5) == 2400)
- px_put_bytes(s, (const byte *)resolution_2400,
- strlen(resolution_2400));
- else
- px_put_bytes(s, (const byte *)resolution_600,
- strlen(resolution_600));
+ if ((uint) (dev->HWResolution[1] + 0.5) == 150)
+ px_put_bytes(s, (const byte *)resolution_150,
+ strlen(resolution_150));
+ else if ((uint) (dev->HWResolution[1] + 0.5) == 300)
+ px_put_bytes(s, (const byte *)resolution_300,
+ strlen(resolution_300));
+ else if ((uint) (dev->HWResolution[1] + 0.5) == 1200)
+ px_put_bytes(s, (const byte *)resolution_1200,
+ strlen(resolution_1200));
+ else if ((uint) (dev->HWResolution[1] + 0.5) == 2400)
+ px_put_bytes(s, (const byte *)resolution_2400,
+ strlen(resolution_2400));
+ else
+ px_put_bytes(s, (const byte *)resolution_600,
+ strlen(resolution_600));
}
/* We have to add 2 to the strlen because the next-to-last */
/* character is a null. */
px_put_bytes(s, (const byte *)file_header,
- strlen(file_header) + 2);
+ strlen(file_header) + 2);
px_put_usp(s, (uint) (dev->HWResolution[0] + 0.5),
- (uint) (dev->HWResolution[1] + 0.5));
+ (uint) (dev->HWResolution[1] + 0.5));
PX_PUT_LIT(s, stream_header);
return 0;
}
@@ -116,7 +116,7 @@ int
px_write_page_header(stream *s, const gx_device *dev)
{
static const byte page_header_1[] = {
- DUB(ePortraitOrientation), DA(pxaOrientation)
+ DUB(ePortraitOrientation), DA(pxaOrientation)
};
PX_PUT_LIT(s, page_header_1);
@@ -125,23 +125,23 @@ px_write_page_header(stream *s, const gx_device *dev)
/* Write the media selection command if needed, updating the media size. */
int
-px_write_select_media(stream *s, const gx_device *dev,
- pxeMediaSize_t *pms, byte *media_source,
- int page, bool Duplex, bool Tumble)
+px_write_select_media(stream *s, const gx_device *dev,
+ pxeMediaSize_t *pms, byte *media_source,
+ int page, bool Duplex, bool Tumble)
{
#define MSD(ms, mstr, res, w, h) \
{ ms, mstr, (float)((w) * 1.0 / (res)), (float)((h) * 1.0 / res) },
static const struct {
- pxeMediaSize_t ms;
+ pxeMediaSize_t ms;
const char *media_name;
- float width, height;
+ float width, height;
} media_sizes[] = {
- px_enumerate_media(MSD)
- { pxeMediaSize_next }
+ px_enumerate_media(MSD)
+ { pxeMediaSize_next }
};
#undef MSD
float w = dev->width / dev->HWResolution[0],
- h = dev->height / dev->HWResolution[1];
+ h = dev->height / dev->HWResolution[1];
int i;
pxeMediaSize_t size = eDefaultPaperSize;
byte tray = eAutoSelect;
@@ -150,13 +150,13 @@ px_write_select_media(stream *s, const gx_device *dev,
/* The default is eDefaultPaperSize (=96), but we'll emit CustomMediaSize */
/* 0.05 = 30@r600 - one of the test files is 36 off and within 5.0/72@600 */
for (i = countof(media_sizes) - 2; i > 0; --i)
- if (fabs(media_sizes[i].width - w) < 0.05 &&
- fabs(media_sizes[i].height - h) < 0.05
- ) {
- match_found = true;
- size = media_sizes[i].ms;
- break;
- }
+ if (fabs(media_sizes[i].width - w) < 0.05 &&
+ fabs(media_sizes[i].height - h) < 0.05
+ ) {
+ match_found = true;
+ size = media_sizes[i].ms;
+ break;
+ }
/*
* According to the PCL XL documentation, MediaSize/CustomMediaSize must always
* be specified, but MediaSource is optional.
@@ -171,26 +171,26 @@ px_write_select_media(stream *s, const gx_device *dev,
}
if (media_source != NULL)
- tray = *media_source;
+ tray = *media_source;
px_put_uba(s, tray, pxaMediaSource);
if (Duplex)
{
if (Tumble)
- px_put_uba(s, (byte)eDuplexHorizontalBinding, pxaDuplexPageMode);
+ px_put_uba(s, (byte)eDuplexHorizontalBinding, pxaDuplexPageMode);
else
- px_put_uba(s, (byte)eDuplexVerticalBinding, pxaDuplexPageMode);
+ px_put_uba(s, (byte)eDuplexVerticalBinding, pxaDuplexPageMode);
if (page & 1)
- px_put_uba(s, (byte)eFrontMediaSide, pxaDuplexPageSide);
+ px_put_uba(s, (byte)eFrontMediaSide, pxaDuplexPageSide);
else
- px_put_uba(s, (byte)eBackMediaSide, pxaDuplexPageSide);
+ px_put_uba(s, (byte)eBackMediaSide, pxaDuplexPageSide);
}
else
px_put_uba(s, (byte)eSimplexFrontSide, pxaSimplexPageMode);
if (pms)
- *pms = size;
+ *pms = size;
return 0;
}
@@ -203,9 +203,9 @@ int
px_write_file_trailer(FILE *file)
{
static const byte file_trailer[] = {
- pxtCloseDataSource,
- pxtEndSession,
- 033, '%', '-', '1', '2', '3', '4', '5', 'X'
+ pxtCloseDataSource,
+ pxtEndSession,
+ 033, '%', '-', '1', '2', '3', '4', '5', 'X'
};
fwrite(file_trailer, 1, sizeof(file_trailer), file);
@@ -275,9 +275,9 @@ void
px_put_u(stream * s, uint i)
{
if (i <= 255)
- px_put_ub(s, (byte)i);
+ px_put_ub(s, (byte)i);
else
- px_put_us(s, i);
+ px_put_us(s, i);
}
void
@@ -360,10 +360,10 @@ px_put_r(stream * s, floatp r)
2^(-126) * 0.[22 '0' then '1']_base2 = 2 ^(146) * 0.1_base2
but it is simplier for such small number to be zero. */
if (exp < -126)
- mantissa = 0, exp = 0; /* unnormalized */
+ mantissa = 0, exp = 0; /* unnormalized */
/* put the sign bit in the right place */
if (mantissa < 0)
- exp += 128, mantissa = -mantissa;
+ exp += 128, mantissa = -mantissa;
/* All quantities are little-endian. */
spputc(s, (byte) mantissa);
spputc(s, (byte) (mantissa >> 8));
@@ -396,10 +396,10 @@ void
px_put_data_length(stream * s, uint num_bytes)
{
if (num_bytes > 255) {
- spputc(s, pxt_dataLength);
- px_put_l(s, (ulong) num_bytes);
+ spputc(s, pxt_dataLength);
+ px_put_l(s, (ulong) num_bytes);
} else {
- spputc(s, pxt_dataLengthByte);
- spputc(s, (byte) num_bytes);
+ spputc(s, pxt_dataLengthByte);
+ spputc(s, (byte) num_bytes);
}
}
diff --git a/gs/base/gdevpxut.h b/gs/base/gdevpxut.h
index 2ba6d151e..823651ceb 100644
--- a/gs/base/gdevpxut.h
+++ b/gs/base/gdevpxut.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,9 +28,9 @@ int px_write_page_header(stream *s, const gx_device *dev);
/* Write the media selection command if needed, updating the media size. */
int px_write_select_media(stream *s, const gx_device *dev,
- pxeMediaSize_t *pms,
- byte *media_source,
- int page, bool Duplex, bool Tumble);
+ pxeMediaSize_t *pms,
+ byte *media_source,
+ int page, bool Duplex, bool Tumble);
/*
* Write the file trailer. Note that this takes a FILE *, not a stream *,
diff --git a/gs/base/gdevrinkj.c b/gs/base/gdevrinkj.c
index 3b95ff8a7..2700fed29 100644
--- a/gs/base/gdevrinkj.c
+++ b/gs/base/gdevrinkj.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,8 +37,6 @@
typedef void* gcmmhprofile_t;
#endif
-
-
#include "rinkj/rinkj-device.h"
#include "rinkj/rinkj-byte-stream.h"
#include "rinkj/rinkj-screen-eb.h"
@@ -148,97 +146,95 @@ typedef struct rinkj_device_s {
*/
#define device_procs(get_color_mapping_procs)\
{ gdev_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page, /* output_page */\
- rinkj_close_device, /* close */\
- NULL, /* map_rgb_color - not used */\
- rinkj_map_color_rgb, /* map_color_rgb */\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- rinkj_get_params, /* get_params */\
- rinkj_put_params, /* put_params */\
- NULL, /* map_cmyk_color - not used */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- rinkj_get_color_comp_index, /* get_color_comp_index */\
- rinkj_encode_color, /* encode_color */\
- rinkj_decode_color /* decode_color */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page, /* output_page */\
+ rinkj_close_device, /* close */\
+ NULL, /* map_rgb_color - not used */\
+ rinkj_map_color_rgb, /* map_color_rgb */\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ rinkj_get_params, /* get_params */\
+ rinkj_put_params, /* put_params */\
+ NULL, /* map_cmyk_color - not used */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ rinkj_get_color_comp_index, /* get_color_comp_index */\
+ rinkj_encode_color, /* encode_color */\
+ rinkj_decode_color /* decode_color */\
}
-
static const fixed_colorant_names_list DeviceGrayComponents = {
- "Gray",
- 0 /* List terminator */
+ "Gray",
+ 0 /* List terminator */
};
static const fixed_colorant_names_list DeviceRGBComponents = {
- "Red",
- "Green",
- "Blue",
- 0 /* List terminator */
+ "Red",
+ "Green",
+ "Blue",
+ 0 /* List terminator */
};
static const fixed_colorant_names_list DeviceCMYKComponents = {
- "Cyan",
- "Magenta",
- "Yellow",
- "Black",
- 0 /* List terminator */
+ "Cyan",
+ "Magenta",
+ "Yellow",
+ "Black",
+ 0 /* List terminator */
};
-
static const gx_device_procs spot_cmyk_procs = device_procs(get_rinkj_color_mapping_procs);
const rinkj_device gs_rinkj_device =
-{
+{
prn_device_body_extended(rinkj_device, spot_cmyk_procs, "rinkj",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* X and Y hardware resolution */
- 0, 0, 0, 0, /* margins */
- GX_DEVICE_COLOR_MAX_COMPONENTS, 4, /* MaxComponents, NumComp */
- GX_CINFO_POLARITY_SUBTRACTIVE, /* Polarity */
- 32, 0, /* Depth, Gray_index, */
- 255, 255, 1, 1, /* MaxGray, MaxColor, DitherGray, DitherColor */
- GX_CINFO_SEP_LIN, /* Linear & Separable */
- "DeviceN", /* Process color model name */
- rinkj_print_page), /* Printer page print routine */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* X and Y hardware resolution */
+ 0, 0, 0, 0, /* margins */
+ GX_DEVICE_COLOR_MAX_COMPONENTS, 4, /* MaxComponents, NumComp */
+ GX_CINFO_POLARITY_SUBTRACTIVE, /* Polarity */
+ 32, 0, /* Depth, Gray_index, */
+ 255, 255, 1, 1, /* MaxGray, MaxColor, DitherGray, DitherColor */
+ GX_CINFO_SEP_LIN, /* Linear & Separable */
+ "DeviceN", /* Process color model name */
+ rinkj_print_page), /* Printer page print routine */
/* DeviceN device specific parameters */
RINKJ_DEVICE_CMYK, /* Color model */
8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -266,7 +262,7 @@ gray_cs_to_spotrgb_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotrgb_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
int i = ((rinkj_device *)dev)->separation_names.num_names;
@@ -303,7 +299,7 @@ gray_cs_to_spotcmyk_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotcmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
rinkj_device *rdev = (rinkj_device *)dev;
@@ -312,7 +308,7 @@ rgb_cs_to_spotcmyk_cm(gx_device * dev, const gs_imager_state *pis,
color_rgb_to_cmyk(r, g, b, pis, out, dev->memory);
for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ out[4 + i] = 0;
}
static void
@@ -328,7 +324,7 @@ cmyk_cs_to_spotcmyk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out
out[2] = y;
out[3] = k;
for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ out[4 + i] = 0;
};
static void
@@ -345,7 +341,7 @@ cmyk_cs_to_spotn_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
out[2] = y;
out[3] = k;
for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ out[4 + i] = 0;
};
static void
@@ -358,14 +354,14 @@ gray_cs_to_spotn_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotn_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
frac cmyk[4];
color_rgb_to_cmyk(r, g, b, pis, cmyk, dev->memory);
cmyk_cs_to_spotn_cm(dev, cmyk[0], cmyk[1], cmyk[2], cmyk[3],
- out);
+ out);
}
static const gx_cm_color_map_procs spotRGB_procs = {
@@ -391,13 +387,13 @@ get_rinkj_color_mapping_procs(const gx_device * dev)
const rinkj_device *rdev = (const rinkj_device *)dev;
if (rdev->color_model == RINKJ_DEVICE_RGB)
- return &spotRGB_procs;
+ return &spotRGB_procs;
else if (rdev->color_model == RINKJ_DEVICE_CMYK)
- return &spotCMYK_procs;
+ return &spotCMYK_procs;
else if (rdev->color_model == RINKJ_DEVICE_N)
- return &spotN_procs;
+ return &spotN_procs;
else
- return NULL;
+ return NULL;
}
/*
@@ -413,7 +409,7 @@ rinkj_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
+ color <<= bpc;
color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
@@ -433,7 +429,7 @@ rinkj_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out)
for (; i<ncomp; i++) {
out[ncomp - i - 1] = (color & mask) << drop;
- color >>= bpc;
+ color >>= bpc;
}
return 0;
}
@@ -447,7 +443,7 @@ rinkj_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3])
rinkj_device *rdev = (rinkj_device *)dev;
if (rdev->color_model == RINKJ_DEVICE_RGB)
- return rinkj_decode_color(dev, color, rgb);
+ return rinkj_decode_color(dev, color, rgb);
/* TODO: return reasonable values. */
rgb[0] = 0;
rgb[1] = 0;
@@ -462,7 +458,7 @@ rinkj_open_profile(rinkj_device *rdev)
if (rdev->link_profile == NULL && rdev->profile_out_fn[0]) {
- rdev->link_profile = gsicc_get_profile_handle_file(rdev->profile_out_fn,
+ rdev->link_profile = gsicc_get_profile_handle_file(rdev->profile_out_fn,
strlen(rdev->profile_out_fn), rdev->memory);
if (rdev->link_profile == NULL)
@@ -475,7 +471,7 @@ rinkj_open_profile(rinkj_device *rdev)
rendering_params.rendering_intent = gsPERCEPTUAL;
/* Call with a NULL destination profile since we are using a device link profile here */
- rdev->icc_link = gscms_get_link(rdev->link_profile,
+ rdev->icc_link = gscms_get_link(rdev->link_profile,
NULL, &rendering_params);
if (rdev->icc_link == NULL)
@@ -503,19 +499,19 @@ rinkj_get_params(gx_device * pdev, gs_param_list * plist)
if ( (code = gdev_prn_get_params(pdev, plist)) < 0 ||
(code = sample_device_crd_get_params(pdev, plist, "CRDDefault")) < 0 ||
- (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
- (code = param_write_bool(plist, "Separations", &seprs)) < 0)
- return code;
+ (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
+ (code = param_write_bool(plist, "Separations", &seprs)) < 0)
+ return code;
pos.data = (const byte *)rdev->profile_out_fn,
- pos.size = strlen(rdev->profile_out_fn),
- pos.persistent = false;
+ pos.size = strlen(rdev->profile_out_fn),
+ pos.persistent = false;
code = param_write_string(plist, "ProfileOut", &pos);
if (code < 0)
- return code;
+ return code;
sfs.data = (const byte *)rdev->setup_fn,
- sfs.size = strlen(rdev->setup_fn),
+ sfs.size = strlen(rdev->setup_fn),
sfs.persistent = false;
code = param_write_string(plist, "SetupFile", &sfs);
@@ -525,7 +521,7 @@ rinkj_get_params(gx_device * pdev, gs_param_list * plist)
#define compare_color_names(name, name_size, str, str_size) \
(name_size == str_size && \
- (strncmp((const char *)name, (const char *)str, name_size) == 0))
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
/*
* This routine will check if a name matches any item in a list of process model
@@ -533,18 +529,18 @@ rinkj_get_params(gx_device * pdev, gs_param_list * plist)
*/
static bool
check_process_color_names(const fixed_colorant_names_list * pcomp_list,
- const gs_param_string * pstring)
+ const gs_param_string * pstring)
{
if (pcomp_list) {
const fixed_colorant_name * plist = *pcomp_list;
uint size = pstring->size;
-
- while( *plist) {
- if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
- return true;
- }
- plist++;
- }
+
+ while( *plist) {
+ if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
+ return true;
+ }
+ plist++;
+ }
}
return false;
}
@@ -566,47 +562,47 @@ static int
bpc_to_depth(int ncomp, int bpc)
{
static const byte depths[4][8] = {
- {1, 2, 0, 4, 8, 0, 0, 8},
- {2, 4, 0, 8, 16, 0, 0, 16},
- {4, 8, 0, 16, 16, 0, 0, 24},
- {4, 8, 0, 16, 32, 0, 0, 32}
+ {1, 2, 0, 4, 8, 0, 0, 8},
+ {2, 4, 0, 8, 16, 0, 0, 16},
+ {4, 8, 0, 16, 16, 0, 0, 24},
+ {4, 8, 0, 16, 32, 0, 0, 32}
};
if (ncomp <=4 && bpc <= 8)
return depths[ncomp -1][bpc-1];
else
- return (ncomp * bpc + 7) & 0xf8;
+ return (ncomp * bpc + 7) & 0xf8;
}
#define BEGIN_ARRAY_PARAM(pread, pname, pa, psize, e)\
BEGIN\
switch (code = pread(plist, (param_name = pname), &(pa))) {\
case 0:\
- if ((pa).size != psize) {\
- ecode = gs_note_error(gs_error_rangecheck);\
- (pa).data = 0; /* mark as not filled */\
- } else
+ if ((pa).size != psize) {\
+ ecode = gs_note_error(gs_error_rangecheck);\
+ (pa).data = 0; /* mark as not filled */\
+ } else
#define END_ARRAY_PARAM(pa, e)\
- goto e;\
+ goto e;\
default:\
- ecode = code;\
+ ecode = code;\
e: param_signal_error(plist, param_name, ecode);\
case 1:\
- (pa).data = 0; /* mark as not filled */\
+ (pa).data = 0; /* mark as not filled */\
}\
END
static int
rinkj_param_read_fn(gs_param_list *plist, const char *name,
- gs_param_string *pstr, int max_len)
+ gs_param_string *pstr, int max_len)
{
int code = param_read_string(plist, name, pstr);
if (code == 0) {
- if (pstr->size >= max_len)
- param_signal_error(plist, name, code = gs_error_rangecheck);
+ if (pstr->size >= max_len)
+ param_signal_error(plist, name, code = gs_error_rangecheck);
} else {
- pstr->data = 0;
+ pstr->data = 0;
}
return code;
}
@@ -616,7 +612,7 @@ static bool
param_string_eq(const gs_param_string *pcs, const char *str)
{
return (strlen(str) == pcs->size &&
- !strncmp(str, (const char *)pcs->data, pcs->size));
+ !strncmp(str, (const char *)pcs->data, pcs->size));
}
static int
@@ -626,27 +622,27 @@ rinkj_set_color_model(rinkj_device *rdev, rinkj_color_model color_model)
rdev->color_model = color_model;
if (color_model == RINKJ_DEVICE_GRAY) {
- rdev->std_colorant_names = &DeviceGrayComponents;
- rdev->num_std_colorant_names = 1;
- rdev->color_info.cm_name = "DeviceGray";
- rdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ rdev->std_colorant_names = &DeviceGrayComponents;
+ rdev->num_std_colorant_names = 1;
+ rdev->color_info.cm_name = "DeviceGray";
+ rdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == RINKJ_DEVICE_RGB) {
- rdev->std_colorant_names = &DeviceRGBComponents;
- rdev->num_std_colorant_names = 3;
- rdev->color_info.cm_name = "DeviceRGB";
- rdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ rdev->std_colorant_names = &DeviceRGBComponents;
+ rdev->num_std_colorant_names = 3;
+ rdev->color_info.cm_name = "DeviceRGB";
+ rdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == RINKJ_DEVICE_CMYK) {
- rdev->std_colorant_names = &DeviceCMYKComponents;
- rdev->num_std_colorant_names = 4;
- rdev->color_info.cm_name = "DeviceCMYK";
- rdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ rdev->std_colorant_names = &DeviceCMYKComponents;
+ rdev->num_std_colorant_names = 4;
+ rdev->color_info.cm_name = "DeviceCMYK";
+ rdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (color_model == RINKJ_DEVICE_N) {
- rdev->std_colorant_names = &DeviceCMYKComponents;
- rdev->num_std_colorant_names = 4;
- rdev->color_info.cm_name = "DeviceN";
- rdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ rdev->std_colorant_names = &DeviceCMYKComponents;
+ rdev->num_std_colorant_names = 4;
+ rdev->color_info.cm_name = "DeviceN";
+ rdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else {
- return -1;
+ return -1;
}
rdev->color_info.max_components = rdev->num_std_colorant_names;
@@ -673,35 +669,35 @@ rinkj_put_params(gx_device * pdev, gs_param_list * plist)
rinkj_color_model color_model = pdevn->color_model;
BEGIN_ARRAY_PARAM(param_read_name_array, "SeparationColorNames", scna, scna.size, scne) {
- break;
+ break;
} END_ARRAY_PARAM(scna, scne);
if (code >= 0)
- code = rinkj_param_read_fn(plist, "ProfileOut", &po,
- sizeof(pdevn->profile_out_fn));
+ code = rinkj_param_read_fn(plist, "ProfileOut", &po,
+ sizeof(pdevn->profile_out_fn));
if (code >= 0)
- code = rinkj_param_read_fn(plist, "SetupFile", &sf,
- sizeof(pdevn->setup_fn));
+ code = rinkj_param_read_fn(plist, "SetupFile", &sf,
+ sizeof(pdevn->setup_fn));
if (code >= 0)
- code = param_read_name(plist, "ProcessColorModel", &pcm);
+ code = param_read_name(plist, "ProcessColorModel", &pcm);
if (code == 0) {
- if (param_string_eq (&pcm, "DeviceGray"))
- color_model = RINKJ_DEVICE_GRAY;
- else if (param_string_eq (&pcm, "DeviceRGB"))
- color_model = RINKJ_DEVICE_RGB;
- else if (param_string_eq (&pcm, "DeviceCMYK"))
- color_model = RINKJ_DEVICE_CMYK;
- else if (param_string_eq (&pcm, "DeviceN"))
- color_model = RINKJ_DEVICE_N;
- else {
- param_signal_error(plist, "ProcessColorModel",
- code = gs_error_rangecheck);
- }
+ if (param_string_eq (&pcm, "DeviceGray"))
+ color_model = RINKJ_DEVICE_GRAY;
+ else if (param_string_eq (&pcm, "DeviceRGB"))
+ color_model = RINKJ_DEVICE_RGB;
+ else if (param_string_eq (&pcm, "DeviceCMYK"))
+ color_model = RINKJ_DEVICE_CMYK;
+ else if (param_string_eq (&pcm, "DeviceN"))
+ color_model = RINKJ_DEVICE_N;
+ else {
+ param_signal_error(plist, "ProcessColorModel",
+ code = gs_error_rangecheck);
+ }
}
if (code < 0)
- ecode = code;
+ ecode = code;
/*
* Save the color_info in case gdev_prn_put_params fails, and for
@@ -710,62 +706,61 @@ rinkj_put_params(gx_device * pdev, gs_param_list * plist)
save_info = pdevn->color_info;
ecode = rinkj_set_color_model(pdevn, color_model);
if (ecode == 0)
- ecode = gdev_prn_put_params(pdev, plist);
+ ecode = gdev_prn_put_params(pdev, plist);
if (ecode < 0) {
- pdevn->color_info = save_info;
- return ecode;
+ pdevn->color_info = save_info;
+ return ecode;
}
/* Separations are only valid with a subtractive color model */
if (pdev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE) {
/*
* Process the separation color names. Remove any names that already
- * match the process color model colorant names for the device.
+ * match the process color model colorant names for the device.
*/
if (scna.data != 0) {
- int i;
- int num_names = scna.size;
- const fixed_colorant_names_list * pcomp_names =
- ((rinkj_device *)pdev)->std_colorant_names;
-
- for (i = num_spot = 0; i < num_names; i++) {
- if (!check_process_color_names(pcomp_names, &scna.data[i]))
- pdevn->separation_names.names[num_spot++] = &scna.data[i];
- }
- pdevn->separation_names.num_names = num_spot;
- if (pdevn->is_open)
- gs_closedevice(pdev);
+ int i;
+ int num_names = scna.size;
+ const fixed_colorant_names_list * pcomp_names =
+ ((rinkj_device *)pdev)->std_colorant_names;
+
+ for (i = num_spot = 0; i < num_names; i++) {
+ if (!check_process_color_names(pcomp_names, &scna.data[i]))
+ pdevn->separation_names.names[num_spot++] = &scna.data[i];
+ }
+ pdevn->separation_names.num_names = num_spot;
+ if (pdevn->is_open)
+ gs_closedevice(pdev);
}
}
npcmcolors = pdevn->num_std_colorant_names;
pdevn->color_info.num_components = npcmcolors + num_spot;
- /*
+ /*
* The DeviceN device can have zero components if nothing has been
* specified. This causes some problems so force at least one
* component until something is specified.
*/
if (!pdevn->color_info.num_components)
- pdevn->color_info.num_components = 1;
+ pdevn->color_info.num_components = 1;
pdevn->color_info.depth = bpc_to_depth(pdevn->color_info.num_components,
- pdevn->bitspercomponent);
+ pdevn->bitspercomponent);
if (pdevn->color_info.depth != save_info.depth) {
- gs_closedevice(pdev);
+ gs_closedevice(pdev);
}
if (po.data != 0) {
- memcpy(pdevn->profile_out_fn, po.data, po.size);
- pdevn->profile_out_fn[po.size] = 0;
+ memcpy(pdevn->profile_out_fn, po.data, po.size);
+ pdevn->profile_out_fn[po.size] = 0;
}
if (sf.data != 0) {
- memcpy(pdevn->setup_fn, sf.data, sf.size);
- pdevn->setup_fn[sf.size] = 0;
+ memcpy(pdevn->setup_fn, sf.data, sf.size);
+ pdevn->setup_fn[sf.size] = 0;
}
code = rinkj_open_profile(pdevn);
return code;
}
-
/*
* Close device and clean up ICC structures.
*/
@@ -783,7 +778,7 @@ rinkj_close_device(gx_device *dev)
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -795,7 +790,7 @@ rinkj_close_device(gx_device *dev)
*/
static int
rinkj_get_color_comp_index(gx_device * dev, const char * pname, int name_size,
- int src_index)
+ int src_index)
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
const fixed_colorant_names_list * list = ((const rinkj_device *)dev)->std_colorant_names;
@@ -805,26 +800,26 @@ rinkj_get_color_comp_index(gx_device * dev, const char * pname, int name_size,
/* Check if the component is in the implied list. */
if (pcolor) {
- while( *pcolor) {
- if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
- return color_component_number;
- pcolor++;
- color_component_number++;
- }
+ while( *pcolor) {
+ if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
+ return color_component_number;
+ pcolor++;
+ color_component_number++;
+ }
}
/* Check if the component is in the separation names list. */
{
- const gs_separation_names * separations = &((const rinkj_device *)dev)->separation_names;
- int num_spot = separations->num_names;
-
- for (i=0; i<num_spot; i++) {
- if (compare_color_names((const char *)separations->names[i]->data,
- separations->names[i]->size, pname, name_size)) {
- return color_component_number;
- }
- color_component_number++;
- }
+ const gs_separation_names * separations = &((const rinkj_device *)dev)->separation_names;
+ int num_spot = separations->num_names;
+
+ for (i=0; i<num_spot; i++) {
+ if (compare_color_names((const char *)separations->names[i]->data,
+ separations->names[i]->size, pname, name_size)) {
+ return color_component_number;
+ }
+ color_component_number++;
+ }
}
return -1;
@@ -839,7 +834,7 @@ rinkj_graph_lookup (const double *graph_x, const double *graph_y, int n_graph, d
for (i = 0; i < n_graph - 1; i++)
{
if (graph_x[i + 1] > x)
- break;
+ break;
}
return graph_y[i] + (x - graph_x[i]) * (graph_y[i + 1] - graph_y[i]) /
(graph_x[i + 1] - graph_x[i]);
@@ -871,34 +866,34 @@ rinkj_add_lut(rinkj_device *rdev, rinkj_lutset *lutset, char plane, FILE *f)
rinkj_lutchain **pp;
for (plane_ix = 0; lutset->plane_names[plane_ix]; plane_ix++)
- if (lutset->plane_names[plane_ix] == plane)
- break;
+ if (lutset->plane_names[plane_ix] == plane)
+ break;
if (lutset->plane_names[plane_ix] != plane)
- return -1;
+ return -1;
pp = &lutset->lut[plane_ix];
if (fgets(linebuf, sizeof(linebuf), f) == NULL)
- return -1;
+ return -1;
if (sscanf(linebuf, "%d", &n_graph) != 1)
- return -1;
+ return -1;
chain = (rinkj_lutchain *)gs_alloc_bytes(rdev->memory, sizeof(rinkj_lutchain), "rinkj_add_lut");
chain->next = NULL;
chain->n_graph = n_graph;
chain->graph_x = (double *)gs_alloc_bytes(rdev->memory, sizeof(double) * n_graph, "rinkj_add_lut");
chain->graph_y = (double *)gs_alloc_bytes(rdev->memory, sizeof(double) * n_graph, "rinkj_add_lut");
for (i = 0; i < n_graph; i++) {
- double x, y;
-
- if (fgets(linebuf, sizeof(linebuf), f) == NULL)
- return -1;
- if (sscanf(linebuf, "%lf %lf", &y, &x) != 2)
- return -1;
- chain->graph_x[i] = x / 1.0;
- chain->graph_y[i] = y / 1.0;
+ double x, y;
+
+ if (fgets(linebuf, sizeof(linebuf), f) == NULL)
+ return -1;
+ if (sscanf(linebuf, "%lf %lf", &y, &x) != 2)
+ return -1;
+ chain->graph_x[i] = x / 1.0;
+ chain->graph_y[i] = y / 1.0;
}
/* add at end of chain */
while (*pp) {
- pp = &((*pp)->next);
+ pp = &((*pp)->next);
}
*pp = chain;
return 0;
@@ -911,26 +906,26 @@ rinkj_apply_luts(rinkj_device *rdev, RinkjDevice *cmyk_dev, const rinkj_lutset *
double lut[256];
for (plane_ix = 0; plane_ix < 7; plane_ix++) {
- int i;
- for (i = 0; i < 256; i++) {
- double g = i / 255.0;
- rinkj_lutchain *chain;
-
- for (chain = lutset->lut[plane_ix]; chain; chain = chain->next) {
- g = rinkj_graph_lookup(chain->graph_x, chain->graph_y,
- chain->n_graph, g);
- }
- lut[i] = g;
- }
- rinkj_screen_eb_set_lut(cmyk_dev, plane_ix, lut);
+ int i;
+ for (i = 0; i < 256; i++) {
+ double g = i / 255.0;
+ rinkj_lutchain *chain;
+
+ for (chain = lutset->lut[plane_ix]; chain; chain = chain->next) {
+ g = rinkj_graph_lookup(chain->graph_x, chain->graph_y,
+ chain->n_graph, g);
+ }
+ lut[i] = g;
+ }
+ rinkj_screen_eb_set_lut(cmyk_dev, plane_ix, lut);
}
return 0;
}
static int
rinkj_set_luts(rinkj_device *rdev,
- RinkjDevice *printer_dev, RinkjDevice *cmyk_dev,
- const char *config_fn, const RinkjDeviceParams *params)
+ RinkjDevice *printer_dev, RinkjDevice *cmyk_dev,
+ const char *config_fn, const RinkjDeviceParams *params)
{
FILE *f = fopen(config_fn, "r");
char linebuf[256];
@@ -941,29 +936,29 @@ rinkj_set_luts(rinkj_device *rdev,
lutset.plane_names = "KkCMcmY";
for (i = 0; i < MAX_CHAN; i++) {
- lutset.lut[i] = NULL;
+ lutset.lut[i] = NULL;
}
for (;;) {
- if (fgets(linebuf, sizeof(linebuf), f) == NULL)
- break;
- for (i = 0; linebuf[i]; i++)
- if (linebuf[i] == ':') break;
- if (linebuf[i] != ':') {
- continue;
- }
- memcpy(key, linebuf, i);
- key[i] = 0;
- for (i++; linebuf[i] == ' '; i++);
- val = linebuf + i;
-
- if (!strcmp(key, "AddLut")) {
- if_debug1('r', "[r]%s", linebuf);
- rinkj_add_lut(rdev, &lutset, val[0], f);
- } else if (!strcmp(key, "Dither") || !strcmp(key, "Aspect")) {
- rinkj_device_set_param_string(cmyk_dev, key, val);
- } else {
- rinkj_device_set_param_string(printer_dev, key, val);
- }
+ if (fgets(linebuf, sizeof(linebuf), f) == NULL)
+ break;
+ for (i = 0; linebuf[i]; i++)
+ if (linebuf[i] == ':') break;
+ if (linebuf[i] != ':') {
+ continue;
+ }
+ memcpy(key, linebuf, i);
+ key[i] = 0;
+ for (i++; linebuf[i] == ' '; i++);
+ val = linebuf + i;
+
+ if (!strcmp(key, "AddLut")) {
+ if_debug1('r', "[r]%s", linebuf);
+ rinkj_add_lut(rdev, &lutset, val[0], f);
+ } else if (!strcmp(key, "Dither") || !strcmp(key, "Aspect")) {
+ rinkj_device_set_param_string(cmyk_dev, key, val);
+ } else {
+ rinkj_device_set_param_string(printer_dev, key, val);
+ }
}
fclose(f);
@@ -1033,25 +1028,24 @@ rinkj_write_image_data(gx_device_printer *pdev, RinkjDevice *cmyk_dev)
int code = 0;
rinkj_color_cache_entry *cache = NULL;
-
n_planes = n_planes_in + rdev->separation_names.num_names;
if_debug1('r', "[r]n_planes = %d\n", n_planes);
xsb = pdev->width;
for (i = 0; i < n_planes_out; i++)
- plane_data[i] = gs_alloc_bytes(pdev->memory, xsb, "rinkj_write_image_data");
+ plane_data[i] = gs_alloc_bytes(pdev->memory, xsb, "rinkj_write_image_data");
if (rdev->icc_link != NULL) {
-
- cache = (rinkj_color_cache_entry *)gs_alloc_bytes(pdev->memory, RINKJ_CCACHE_SIZE * sizeof(rinkj_color_cache_entry), "rinkj_write_image_data");
- if (cache == NULL)
- return gs_note_error(gs_error_VMerror);
- /* Set up cache so that none of the keys will hit. */
+ cache = (rinkj_color_cache_entry *)gs_alloc_bytes(pdev->memory, RINKJ_CCACHE_SIZE * sizeof(rinkj_color_cache_entry), "rinkj_write_image_data");
+ if (cache == NULL)
+ return gs_note_error(gs_error_VMerror);
+
+ /* Set up cache so that none of the keys will hit. */
+
+ cache[0].key = 1;
+ for (i = 1; i < RINKJ_CCACHE_SIZE; i++)
+ cache[i].key = 0;
- cache[0].key = 1;
- for (i = 1; i < RINKJ_CCACHE_SIZE; i++)
- cache[i].key = 0;
-
}
/* do CMYK -> CMYKcmk ink split by plane replication */
@@ -1065,126 +1059,126 @@ rinkj_write_image_data(gx_device_printer *pdev, RinkjDevice *cmyk_dev)
line = gs_alloc_bytes(pdev->memory, raster, "rinkj_write_image_data");
for (y = 0; y < pdev->height; y++) {
- byte *row;
- int x;
-
- code = gdev_prn_get_bits(pdev, y, line, &row);
-
- if (rdev->icc_link == NULL) {
- int rowix = 0;
- for (x = 0; x < pdev->width; x++) {
- for (i = 0; i < n_planes_in; i++)
- plane_data[i][x] = row[rowix + i];
- rowix += n_planes;
- }
- } else if (n_planes == 3) {
- int rowix = 0;
- for (x = 0; x < pdev->width; x++) {
- byte cbuf[4] = {0, 0, 0, 0};
- bits32 color;
- bits32 hash;
- byte vbuf[4];
-
- memcpy(cbuf, row + rowix, 3);
- color = ((bits32 *)cbuf)[0];
- hash = rinkj_color_hash(color);
-
- if (cache[hash].key != color) {
+ byte *row;
+ int x;
+
+ code = gdev_prn_get_bits(pdev, y, line, &row);
+
+ if (rdev->icc_link == NULL) {
+ int rowix = 0;
+ for (x = 0; x < pdev->width; x++) {
+ for (i = 0; i < n_planes_in; i++)
+ plane_data[i][x] = row[rowix + i];
+ rowix += n_planes;
+ }
+ } else if (n_planes == 3) {
+ int rowix = 0;
+ for (x = 0; x < pdev->width; x++) {
+ byte cbuf[4] = {0, 0, 0, 0};
+ bits32 color;
+ bits32 hash;
+ byte vbuf[4];
+
+ memcpy(cbuf, row + rowix, 3);
+ color = ((bits32 *)cbuf)[0];
+ hash = rinkj_color_hash(color);
+
+ if (cache[hash].key != color) {
/* 3 channel to CMYK */
gscms_transform_color(rdev->icc_link, &cbuf,
&(vbuf), 1, NULL);
- cache[hash].key = color;
- cache[hash].value = ((bits32 *)vbuf)[0];
-
- } else {
- ((bits32 *)vbuf)[0] = cache[hash].value;
- }
- plane_data[0][x] = vbuf[0];
- plane_data[1][x] = vbuf[1];
- plane_data[2][x] = vbuf[2];
- plane_data[3][x] = vbuf[3];
- rowix += n_planes;
- }
- } else if (n_planes == 4) {
- for (x = 0; x < pdev->width; x++) {
- bits32 color = ((bits32 *)row)[x];
- bits32 hash = rinkj_color_hash(color);
- byte vbuf[4];
-
- if (cache[hash].key != color) {
- byte cbuf[4];
-
- ((bits32 *)cbuf)[0] = color;
+ cache[hash].key = color;
+ cache[hash].value = ((bits32 *)vbuf)[0];
+
+ } else {
+ ((bits32 *)vbuf)[0] = cache[hash].value;
+ }
+ plane_data[0][x] = vbuf[0];
+ plane_data[1][x] = vbuf[1];
+ plane_data[2][x] = vbuf[2];
+ plane_data[3][x] = vbuf[3];
+ rowix += n_planes;
+ }
+ } else if (n_planes == 4) {
+ for (x = 0; x < pdev->width; x++) {
+ bits32 color = ((bits32 *)row)[x];
+ bits32 hash = rinkj_color_hash(color);
+ byte vbuf[4];
+
+ if (cache[hash].key != color) {
+ byte cbuf[4];
+
+ ((bits32 *)cbuf)[0] = color;
/* 4 channel to CMYK */
gscms_transform_color(rdev->icc_link, &cbuf,
&(vbuf), 1, NULL);
- cache[hash].key = color;
- cache[hash].value = ((bits32 *)vbuf)[0];
- } else {
- ((bits32 *)vbuf)[0] = cache[hash].value;
- }
- plane_data[0][x] = vbuf[0];
- plane_data[1][x] = vbuf[1];
- plane_data[2][x] = vbuf[2];
- plane_data[3][x] = vbuf[3];
- }
- } else if (n_planes == 5) {
- int rowix = 0;
- for (x = 0; x < pdev->width; x++) {
- byte cbuf[4];
- bits32 color;
- bits32 hash;
- byte vbuf[4];
- byte spot;
- int scolor[4] = { 0x08, 0xc0, 0x80, 0 };
-
- memcpy(cbuf, row + rowix, 4);
- color = ((bits32 *)cbuf)[0];
- hash = rinkj_color_hash(color);
-
- if (cache[hash].key != color) {
+ cache[hash].key = color;
+ cache[hash].value = ((bits32 *)vbuf)[0];
+ } else {
+ ((bits32 *)vbuf)[0] = cache[hash].value;
+ }
+ plane_data[0][x] = vbuf[0];
+ plane_data[1][x] = vbuf[1];
+ plane_data[2][x] = vbuf[2];
+ plane_data[3][x] = vbuf[3];
+ }
+ } else if (n_planes == 5) {
+ int rowix = 0;
+ for (x = 0; x < pdev->width; x++) {
+ byte cbuf[4];
+ bits32 color;
+ bits32 hash;
+ byte vbuf[4];
+ byte spot;
+ int scolor[4] = { 0x08, 0xc0, 0x80, 0 };
+
+ memcpy(cbuf, row + rowix, 4);
+ color = ((bits32 *)cbuf)[0];
+ hash = rinkj_color_hash(color);
+
+ if (cache[hash].key != color) {
/* Not sure what is going on here. Old
- code was still working with 4 to 4
+ code was still working with 4 to 4
conversion. Replacing with new ICC AMP call */
gscms_transform_color(rdev->icc_link, &cbuf,
&(vbuf), 1, NULL);
- cache[hash].key = color;
- cache[hash].value = ((bits32 *)vbuf)[0];
- } else {
- ((bits32 *)vbuf)[0] = cache[hash].value;
- }
- spot = row[rowix + 4];
- if (spot != 0) {
- for (i = 0; i < 4; i++) {
- int cmyk = vbuf[i], sp_i = spot;
- int tmp = (cmyk << 8) - cmyk;
- tmp += (sp_i * scolor[i] * (255 - cmyk)) >> 8;
- tmp += 0x80;
- plane_data[i][x] = (tmp + (tmp >> 8)) >> 8;
- }
- } else {
- plane_data[0][x] = vbuf[0];
- plane_data[1][x] = vbuf[1];
- plane_data[2][x] = vbuf[2];
- plane_data[3][x] = vbuf[3];
- }
- rowix += n_planes;
- }
- }
-
- code = rinkj_device_write(cmyk_dev, (const char **)split_plane_data);
+ cache[hash].key = color;
+ cache[hash].value = ((bits32 *)vbuf)[0];
+ } else {
+ ((bits32 *)vbuf)[0] = cache[hash].value;
+ }
+ spot = row[rowix + 4];
+ if (spot != 0) {
+ for (i = 0; i < 4; i++) {
+ int cmyk = vbuf[i], sp_i = spot;
+ int tmp = (cmyk << 8) - cmyk;
+ tmp += (sp_i * scolor[i] * (255 - cmyk)) >> 8;
+ tmp += 0x80;
+ plane_data[i][x] = (tmp + (tmp >> 8)) >> 8;
+ }
+ } else {
+ plane_data[0][x] = vbuf[0];
+ plane_data[1][x] = vbuf[1];
+ plane_data[2][x] = vbuf[2];
+ plane_data[3][x] = vbuf[3];
+ }
+ rowix += n_planes;
+ }
+ }
+
+ code = rinkj_device_write(cmyk_dev, (const char **)split_plane_data);
}
rinkj_device_write(cmyk_dev, NULL);
for (i = 0; i < n_planes_in; i++)
- gs_free_object(pdev->memory, plane_data[i], "rinkj_write_image_data");
+ gs_free_object(pdev->memory, plane_data[i], "rinkj_write_image_data");
gs_free_object(pdev->memory, line, "rinkj_write_image_data");
gs_free_object(pdev->memory, cache, "rinkj_write_image_data");
@@ -1200,7 +1194,7 @@ rinkj_print_page(gx_device_printer *pdev, FILE *file)
cmyk_dev = rinkj_init(rdev, file);
if (cmyk_dev == 0)
- return gs_note_error(gs_error_ioerror);
+ return gs_note_error(gs_error_ioerror);
code = rinkj_write_image_data(pdev, cmyk_dev);
return code;
diff --git a/gs/base/gdevrops.c b/gs/base/gdevrops.c
index e0353a442..c529412ae 100644
--- a/gs/base/gdevrops.c
+++ b/gs/base/gdevrops.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,12 +23,12 @@
private_st_device_rop_texture();
static ENUM_PTRS_BEGIN(device_rop_texture_enum_ptrs) {
if (index < st_device_color_max_ptrs) {
- gs_ptr_type_t ptype =
- ENUM_SUPER_ELT(gx_device_rop_texture, st_device_color, texture, 0);
+ gs_ptr_type_t ptype =
+ ENUM_SUPER_ELT(gx_device_rop_texture, st_device_color, texture, 0);
- if (ptype)
- return ptype;
- return ENUM_OBJ(NULL); /* don't stop early */
+ if (ptype)
+ return ptype;
+ return ENUM_OBJ(NULL); /* don't stop early */
}
ENUM_PREFIX(st_device_forward, st_device_color_max_ptrs);
} ENUM_PTRS_END
@@ -45,7 +45,7 @@ static dev_proc_copy_color(rop_texture_copy_color);
/* The device descriptor. */
static const gx_device_rop_texture gs_rop_texture_device = {
std_device_std_body(gx_device_rop_texture, 0, "rop source",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{NULL, /* open_device */
gx_forward_get_initial_matrix,
NULL, /* default_sync_output */
@@ -121,21 +121,21 @@ static const gx_device_rop_texture gs_rop_texture_device = {
/* Create a RasterOp source device. */
int
gx_alloc_rop_texture_device(gx_device_rop_texture ** prsdev, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
*prsdev = gs_alloc_struct(mem, gx_device_rop_texture,
- &st_device_rop_texture, cname);
+ &st_device_rop_texture, cname);
return (*prsdev == 0 ? gs_note_error(gs_error_VMerror) : 0);
}
/* Initialize a RasterOp source device. */
void
gx_make_rop_texture_device(gx_device_rop_texture * dev, gx_device * target,
- gs_logical_operation_t log_op, const gx_device_color * texture)
+ gs_logical_operation_t log_op, const gx_device_color * texture)
{
gx_device_init((gx_device *) dev,
- (const gx_device *)&gs_rop_texture_device,
- (target ? target->memory : NULL), true);
+ (const gx_device *)&gs_rop_texture_device,
+ (target ? target->memory : NULL), true);
gx_device_set_target((gx_device_forward *)dev, target);
/* Drawing operations are defaulted, non-drawing are forwarded. */
check_device_separable((gx_device *) dev);
@@ -148,7 +148,7 @@ gx_make_rop_texture_device(gx_device_rop_texture * dev, gx_device * target,
/* Fill a rectangle */
static int
rop_texture_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_rop_texture *const rtdev = (gx_device_rop_texture *)dev;
gx_rop_source_t source;
@@ -160,16 +160,16 @@ rop_texture_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
source.scolors[0] = source.scolors[1] = color;
source.use_scolors = true;
return gx_device_color_fill_rectangle(&rtdev->texture,
- x, y, w, h, rtdev->target,
- rtdev->log_op, &source);
+ x, y, w, h, rtdev->target,
+ rtdev->log_op, &source);
}
/* Copy a monochrome rectangle */
static int
rop_texture_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_rop_texture *const rtdev = (gx_device_rop_texture *)dev;
gx_rop_source_t source;
@@ -184,19 +184,19 @@ rop_texture_copy_mono(gx_device * dev,
source.use_scolors = true;
/* Adjust the logical operation per transparent colors. */
if (color0 == gx_no_color_index)
- lop = rop3_use_D_when_S_0(lop);
+ lop = rop3_use_D_when_S_0(lop);
else if (color1 == gx_no_color_index)
- lop = rop3_use_D_when_S_1(lop);
+ lop = rop3_use_D_when_S_1(lop);
return gx_device_color_fill_rectangle(&rtdev->texture,
- x, y, w, h, rtdev->target,
- lop, &source);
+ x, y, w, h, rtdev->target,
+ lop, &source);
}
/* Copy a color rectangle */
static int
rop_texture_copy_color(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_rop_texture *const rtdev = (gx_device_rop_texture *)dev;
gx_rop_source_t source;
@@ -208,6 +208,6 @@ rop_texture_copy_color(gx_device * dev,
source.scolors[0] = source.scolors[1] = gx_no_color_index;
source.use_scolors = false;
return gx_device_color_fill_rectangle(&rtdev->texture,
- x, y, w, h, rtdev->target,
- rtdev->log_op, &source);
+ x, y, w, h, rtdev->target,
+ rtdev->log_op, &source);
}
diff --git a/gs/base/gdevs3ga.c b/gs/base/gdevs3ga.c
index 62228610c..6cd12becd 100644
--- a/gs/base/gdevs3ga.c
+++ b/gs/base/gdevs3ga.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -103,26 +103,26 @@ s3_open(gx_device * dev)
{
static const mode_info mode_table[] =
{
- {640, 480, 0x201},
- {800, 600, 0x203},
- {1024, 768, 0x205},
- {-1, -1, -1}
+ {640, 480, 0x201},
+ {800, 600, 0x203},
+ {1024, 768, 0x205},
+ {-1, -1, -1}
};
int code = svga_find_mode(dev, mode_table);
if (code < 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* The enhanced modes all use a 1024-pixel raster. */
fb_dev->raster = 1024;
code = svga_open(dev);
if (code < 0)
- return code;
+ return code;
/* Clear the cache */
{
- int i;
+ int i;
- for (i = 0; i < cache_capacity; i++)
- cache_ids[i] = gx_no_bitmap_id;
+ for (i = 0; i < cache_capacity; i++)
+ cache_ids[i] = gx_no_bitmap_id;
}
return 0;
}
@@ -130,7 +130,7 @@ s3_open(gx_device * dev)
/* Fill a rectangle. */
int
s3_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
fit_fill(dev, x, y, w, h);
s3_wait_fifo();
@@ -146,7 +146,7 @@ s3_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Color = gx_no_color_index means transparent (no effect on the image). */
static int
s3_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone)
{
int sbit;
@@ -164,79 +164,79 @@ s3_copy_mono(gx_device * dev,
lmask = 0xff >> sbit;
/* See whether the cache is applicable. */
if (id != gx_no_bitmap_id && w <= cell_width - 7 &&
- h <= cell_height
- ) {
- cache_index = (int)(id & (cache_capacity - 1));
- cache_x = ((cache_index & ((1 << cache_x_bits) - 1)) <<
- log2_cell_width) + 7;
- cache_y = ((cache_index >> cache_x_bits) <<
- log2_cell_height) + 768;
- if (cache_ids[cache_index] != id) {
- cache_ids[cache_index] = id;
- /* Copy the bitmap to the cache. */
- s3_wait_fifo();
- out_s3_rect(cache_x - sbit, cache_y, w + sbit, h);
- outport(s3_fore_mix, 0x22); /* 1s */
- outport(s3_back_mix, 0x01); /* 0s */
- outport(s3_mf_control, mf_data_cpu);
- outport(s3_command, 0x41b3);
- {
- const int skip = raster - run;
-
- for (i = h; i > 0; i--, sptr += skip)
- for (j = run; j > 0; j--, sptr++)
- outportb(s3_pixel_data, *sptr);
- }
- }
- s3_wait_fifo();
+ h <= cell_height
+ ) {
+ cache_index = (int)(id & (cache_capacity - 1));
+ cache_x = ((cache_index & ((1 << cache_x_bits) - 1)) <<
+ log2_cell_width) + 7;
+ cache_y = ((cache_index >> cache_x_bits) <<
+ log2_cell_height) + 768;
+ if (cache_ids[cache_index] != id) {
+ cache_ids[cache_index] = id;
+ /* Copy the bitmap to the cache. */
+ s3_wait_fifo();
+ out_s3_rect(cache_x - sbit, cache_y, w + sbit, h);
+ outport(s3_fore_mix, 0x22); /* 1s */
+ outport(s3_back_mix, 0x01); /* 0s */
+ outport(s3_mf_control, mf_data_cpu);
+ outport(s3_command, 0x41b3);
+ {
+ const int skip = raster - run;
+
+ for (i = h; i > 0; i--, sptr += skip)
+ for (j = run; j > 0; j--, sptr++)
+ outportb(s3_pixel_data, *sptr);
+ }
+ }
+ s3_wait_fifo();
} else {
- cache_index = -1;
- if (lmask != 0xff) { /* The hardware won't do the masking for us. */
- if (czero != gx_no_color_index) {
- if (cone != gx_no_color_index) {
- s3_fill_rectangle(dev, x, y, w, h, czero);
- czero = gx_no_color_index;
- } else {
- lmerge = ~lmask;
- }
- }
- }
- s3_wait_fifo();
- out_s3_rect(x - sbit, y, w + sbit, h);
+ cache_index = -1;
+ if (lmask != 0xff) { /* The hardware won't do the masking for us. */
+ if (czero != gx_no_color_index) {
+ if (cone != gx_no_color_index) {
+ s3_fill_rectangle(dev, x, y, w, h, czero);
+ czero = gx_no_color_index;
+ } else {
+ lmerge = ~lmask;
+ }
+ }
+ }
+ s3_wait_fifo();
+ out_s3_rect(x - sbit, y, w + sbit, h);
}
/* Load the colors for the real transfer. */
if (cone != gx_no_color_index) {
- outport(s3_fore_mix, 0x27);
- outport(s3_fore_color, (int)cone);
+ outport(s3_fore_mix, 0x27);
+ outport(s3_fore_color, (int)cone);
} else
- outport(s3_fore_mix, 0x63);
+ outport(s3_fore_mix, 0x63);
if (czero != gx_no_color_index) {
- outport(s3_back_mix, 0x07);
- outport(s3_back_color, (int)czero);
+ outport(s3_back_mix, 0x07);
+ outport(s3_back_color, (int)czero);
} else
- outport(s3_back_mix, 0x63);
+ outport(s3_back_mix, 0x63);
s3_wait_fifo();
if (cache_index < 0) { /* direct transfer */
- outport(s3_mf_control, mf_data_cpu);
- outport(s3_command, 0x41b3);
- if (run == 1 && !lmerge) { /* special case for chars */
- for (i = h; i > 0; i--, sptr += raster)
- outportb(s3_pixel_data, *sptr & lmask);
- } else {
- const int skip = raster - run;
-
- for (i = h; i > 0; i--, sptr += skip) {
- outportb(s3_pixel_data, (*sptr++ & lmask) | lmerge);
- for (j = run; j > 1; j--, sptr++)
- outportb(s3_pixel_data, *sptr);
- }
- }
+ outport(s3_mf_control, mf_data_cpu);
+ outport(s3_command, 0x41b3);
+ if (run == 1 && !lmerge) { /* special case for chars */
+ for (i = h; i > 0; i--, sptr += raster)
+ outportb(s3_pixel_data, *sptr & lmask);
+ } else {
+ const int skip = raster - run;
+
+ for (i = h; i > 0; i--, sptr += skip) {
+ outportb(s3_pixel_data, (*sptr++ & lmask) | lmerge);
+ for (j = run; j > 1; j--, sptr++)
+ outportb(s3_pixel_data, *sptr);
+ }
+ }
} else { /* Copy the character from the cache to the screen. */
- out_s3_rect(cache_x, cache_y, w, h);
- outport(s3_x_dest, x);
- outport(s3_y_dest, y);
- outport(s3_mf_control, mf_data_display);
- outport(s3_command, 0xc0b3);
+ out_s3_rect(cache_x, cache_y, w, h);
+ outport(s3_x_dest, x);
+ outport(s3_y_dest, y);
+ outport(s3_mf_control, mf_data_display);
+ outport(s3_command, 0xc0b3);
}
return 0;
}
diff --git a/gs/base/gdevsco.c b/gs/base/gdevsco.c
index f33487e46..bc8e8bdd3 100644
--- a/gs/base/gdevsco.c
+++ b/gs/base/gdevsco.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,21 +66,21 @@ open_console()
const char *dev;
if (console_fd != -1)
- return;
+ return;
dev = getenv("GSDEVICE");
if (dev == NULL || *dev == '\0')
- dev = "/dev/tty";
+ dev = "/dev/tty";
console_fd = open(dev, 0);
if (console_fd == -1) {
- ega_close((gx_device *) NULL);
- eprintf1("unable to map display '%s'\n", dev);
- perror("open_console");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf1("unable to map display '%s'\n", dev);
+ perror("open_console");
+ exit(1);
}
}
#if defined(__GNUC__)
- /* Done with inline assembly in gdevpcfb.h */
+ /* Done with inline assembly in gdevpcfb.h */
#else
/* Output to a port */
void
@@ -90,7 +90,7 @@ outportb(uint port, byte data)
struct port_io_arg pio;
if (console_fd == -1)
- open_console();
+ open_console();
pio.args[0].dir = OUT_ON_PORT;
pio.args[0].port = port;
pio.args[0].data = data;
@@ -99,10 +99,10 @@ outportb(uint port, byte data)
pio.args[3].port = 0;
i = ioctl(console_fd, CONSIO, (long)(&pio));
if (i == -1) {
- ega_close((gx_device *) NULL);
- eprintf("error setting device register\n");
- perror("outportb");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("error setting device register\n");
+ perror("outportb");
+ exit(1);
}
}
@@ -114,7 +114,7 @@ outport2(uint port, byte index, byte data)
struct port_io_arg pio;
if (console_fd == -1)
- open_console();
+ open_console();
pio.args[0].dir = OUT_ON_PORT;
pio.args[0].port = port;
pio.args[0].data = index;
@@ -125,10 +125,10 @@ outport2(uint port, byte index, byte data)
pio.args[3].port = 0;
i = ioctl(console_fd, CONSIO, (long)(&pio));
if (i == -1) {
- ega_close((gx_device *) NULL);
- eprintf("error setting device register\n");
- perror("outport2");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("error setting device register\n");
+ perror("outport2");
+ exit(1);
}
}
#endif
@@ -207,20 +207,20 @@ pcfb_get_state(pcfb_bios_state * pbs)
mode = ioctl(console_fd, CONS_CURRENT, 0L);
if (mode == -1) {
#ifdef __linux__
- mode = M_ENH_C80x25;
+ mode = M_ENH_C80x25;
#else
- ega_close((gx_device *) NULL);
- eprintf("unable to get current console mode\n");
- perror("pcfb_get_state");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("unable to get current console mode\n");
+ perror("pcfb_get_state");
+ exit(1);
#endif
}
pbs->display_mode =
- (mode == M_ENH_CG640 || mode == M_CG640x350 ? 0x10 :
+ (mode == M_ENH_CG640 || mode == M_CG640x350 ? 0x10 :
#ifdef M_VGA12
- mode == M_VGA12 ? 0x12 :
+ mode == M_VGA12 ? 0x12 :
#endif
- 0x03);
+ 0x03);
}
/* Set the device mode */
@@ -233,45 +233,45 @@ pcfb_set_mode(int mode)
cur_mode = mode;
mode1 = -1;
if (mode == 0x10)
- mode = SW_ENH_CG640;
+ mode = SW_ENH_CG640;
#ifdef SW_VGA12
else if (mode == 0x12)
- mode = SW_VGA12;
+ mode = SW_VGA12;
#endif
else if (mode == 0x03) {
#ifdef SW_VGA80x25
- mode = SW_VGA80x25;
- mode1 = SW_ENHC80x25;
+ mode = SW_VGA80x25;
+ mode1 = SW_ENHC80x25;
#else
- mode = SW_ENHC80x25;
+ mode = SW_ENHC80x25;
#endif
} else {
- eprintf1("can not set to video mode %d\n", mode);
- exit(1);
+ eprintf1("can not set to video mode %d\n", mode);
+ exit(1);
}
i = ioctl(console_fd, mode, 0L);
if (i == -1 && mode1 != -1)
- i = ioctl(console_fd, mode1, 0L);
+ i = ioctl(console_fd, mode1, 0L);
if (i == -1) {
- ega_close((gx_device *) NULL);
- eprintf("unable to set console mode\n");
- perror("pcfb_set_mode");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("unable to set console mode\n");
+ perror("pcfb_set_mode");
+ exit(1);
}
#ifdef VGA_IOPRIVL
if (ioctl(console_fd, VGA_IOPRIVL, 1) == -1) {
- ega_close((gx_device *) NULL);
- eprintf("unable to get I/O privilege\n");
- perror("pcfb_set_mode");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("unable to get I/O privilege\n");
+ perror("pcfb_set_mode");
+ exit(1);
}
#endif
i = ioctl(console_fd, MAPCONS, 0L);
if (i == -1) {
- ega_close((gx_device *) NULL);
- eprintf("unable to map console adaptor's display memory\n");
- perror("pcfb_set_mode");
- exit(1);
+ ega_close((gx_device *) NULL);
+ eprintf("unable to map console adaptor's display memory\n");
+ perror("pcfb_set_mode");
+ exit(1);
}
fb_addr = (fb_ptr) (i);
}
diff --git a/gs/base/gdevsgi.c b/gs/base/gdevsgi.c
index 81073ec25..c18ef3d06 100644
--- a/gs/base/gdevsgi.c
+++ b/gs/base/gdevsgi.c
@@ -14,10 +14,10 @@
#define sgi_prn_device(procs, dev_name, num_comp, depth, max_gray, max_color, print_page)\
{prn_device_body(gx_device_printer, procs, dev_name, \
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, \
- 0, 0, 0, 0, \
- num_comp, depth, max_gray, max_color, max_gray+1, max_color+1, \
- print_page)}
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, X_DPI, Y_DPI, \
+ 0, 0, 0, 0, \
+ num_comp, depth, max_gray, max_color, max_gray+1, max_color+1, \
+ print_page)}
static dev_proc_map_rgb_color(sgi_map_rgb_color);
static dev_proc_map_color_rgb(sgi_map_color_rgb);
@@ -26,7 +26,7 @@ static dev_proc_print_page(sgi_print_page);
static gx_device_procs sgi_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- sgi_map_rgb_color, sgi_map_color_rgb);
+ sgi_map_rgb_color, sgi_map_color_rgb);
const gx_device_printer far_data gs_sgirgb_device =
sgi_prn_device(sgi_procs, "sgirgb", 3, 24, 255, 255, sgi_print_page);
@@ -39,22 +39,22 @@ sgi_map_rgb_color(gx_device * dev, const ushort cv[])
red = cv[0]; green = cv[1]; blue = cv[2];
return ((red*max_value / gx_max_color_value) << (bitspercolor * 2)) +
- ((green*max_value / gx_max_color_value) << bitspercolor) +
- (blue*max_value / gx_max_color_value);
+ ((green*max_value / gx_max_color_value) << bitspercolor) +
+ (blue*max_value / gx_max_color_value);
}
static int
sgi_map_color_rgb(gx_device *dev, gx_color_index color, ushort prgb[3])
{ ushort bitspercolor = dev->color_info.depth / 3;
- ushort colormask = (1 << bitspercolor) - 1;
-
- prgb[0] = (ushort)(((color >> (bitspercolor * 2)) & colormask) *
- (ulong)gx_max_color_value / colormask);
- prgb[1] = (ushort)(((color >> bitspercolor) & colormask) *
- (ulong)gx_max_color_value / colormask);
- prgb[2] = (ushort)((color & colormask) *
- (ulong)gx_max_color_value / colormask);
- return 0;
+ ushort colormask = (1 << bitspercolor) - 1;
+
+ prgb[0] = (ushort)(((color >> (bitspercolor * 2)) & colormask) *
+ (ulong)gx_max_color_value / colormask);
+ prgb[1] = (ushort)(((color >> bitspercolor) & colormask) *
+ (ulong)gx_max_color_value / colormask);
+ prgb[2] = (ushort)((color & colormask) *
+ (ulong)gx_max_color_value / colormask);
+ return 0;
}
typedef struct sgi_cursor_s {
@@ -68,46 +68,46 @@ typedef struct sgi_cursor_s {
/* write a short int to disk as big-endean */
static int putshort(unsigned int val, FILE *outf)
{
- unsigned char buf[2];
+ unsigned char buf[2];
- buf[0] = (val>>8);
- buf[1] = val;
- return fwrite(buf,2,1,outf);
+ buf[0] = (val>>8);
+ buf[1] = val;
+ return fwrite(buf,2,1,outf);
}
/* write an int to disk as big-endean */
static int putint(unsigned int val, FILE *outf)
{
- unsigned char buf[4];
+ unsigned char buf[4];
- buf[0] = (val>>24);
- buf[1] = (val>>16);
- buf[2] = (val>>8);
- buf[3] = val;
- return fwrite(buf,4,1,outf);
+ buf[0] = (val>>24);
+ buf[1] = (val>>16);
+ buf[2] = (val>>8);
+ buf[3] = val;
+ return fwrite(buf,4,1,outf);
}
/* write the header field by field in big-endian */
static void putheader(IMAGE *header, FILE *outf)
{
- int i;
- char filler= '\0';
+ int i;
+ char filler= '\0';
- putshort(header->imagic, outf);
- fputc(1, outf); /* RLE */
- fputc(1, outf); /* bpp */
- putshort(header->dim, outf);
- putshort(header->xsize, outf);
- putshort(header->ysize, outf);
- putshort(header->zsize, outf);
+ putshort(header->imagic, outf);
+ fputc(1, outf); /* RLE */
+ fputc(1, outf); /* bpp */
+ putshort(header->dim, outf);
+ putshort(header->xsize, outf);
+ putshort(header->ysize, outf);
+ putshort(header->zsize, outf);
- putint(header->min_color, outf);
- putint(header->max_color, outf);
- putint(header->wastebytes, outf);
+ putint(header->min_color, outf);
+ putint(header->max_color, outf);
+ putint(header->wastebytes, outf);
- fwrite(header->name,80,1,outf);
+ fwrite(header->name,80,1,outf);
- putint(header->colormap, outf);
+ putint(header->colormap, outf);
/* put the filler for the rest */
for (i=0; i<404; i++)
@@ -125,7 +125,7 @@ sgi_begin_page(gx_device_printer *bdev, FILE *pstream, sgi_cursor *pcur)
emprintf(bdev->memory,
"sgi rgb format only supports one page per file.\n"
"Please use the '%%d' OutputFile option to create one file for each page.\n");
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
line_size = gdev_mem_bytes_per_scan_line((gx_device_printer*)bdev);
data = (byte*)gs_malloc(bdev->memory, line_size, 1, "sgi_begin_page");
@@ -134,7 +134,7 @@ sgi_begin_page(gx_device_printer *bdev, FILE *pstream, sgi_cursor *pcur)
if ((data == (byte*)0)||(header == (IMAGE*)0)) {
gs_free(bdev->memory, data, line_size, 1, "sgi_begin_page");
gs_free(bdev->memory, header, sizeof(IMAGE),1,"sgi_begin_page");
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
}
memset(header,0, sizeof(IMAGE));
header->imagic = IMAGIC;
@@ -162,7 +162,7 @@ sgi_next_row(sgi_cursor *pcur)
{ if (pcur->lnum < 0)
return 1;
gdev_prn_copy_scan_lines((gx_device_printer*)pcur->dev,
- pcur->lnum--, pcur->data, pcur->line_size);
+ pcur->lnum--, pcur->data, pcur->line_size);
return 0;
}
@@ -180,10 +180,10 @@ sgi_print_page(gx_device_printer *pdev, FILE *pstream)
int rownumber;
if (pdev->PageCount >= 1 && !pdev->file_is_new)
- return_error(gs_error_rangecheck); /* support single page only, can't happen */
+ return_error(gs_error_rangecheck); /* support single page only, can't happen */
#define aref2(a,b) (a)*bdev->height+(b)
- rowsizes=(int*)gs_malloc(pdev->memory, sizeof(int),3*bdev->height,"sgi_print_page");
+ rowsizes=(int*)gs_malloc(pdev->memory, sizeof(int),3*bdev->height,"sgi_print_page");
edata = (byte*)gs_malloc(pdev->memory, cur.line_size, 1, "sgi_begin_page");
if((code<0)||(rowsizes==(int*)NULL)||(edata==(byte*)NULL)) {
@@ -194,94 +194,94 @@ sgi_print_page(gx_device_printer *pdev, FILE *pstream)
lastval = 512+4*6*bdev->height; /* skip offset table */
fseek(pstream,lastval,0);
for (separation=0; separation < 3; separation++)
- {
- cur.lnum = cur.dev->height-1;
- rownumber = 0;
- bpe = cur.bpp/3;
- mask = (1<<bpe) - 1;
- while ( !(code=sgi_next_row(&cur)))
- { byte *bp;
- uint x;
- int shift;
- byte *curcol=cur.data;
- byte *startcol=edata;
- int count;
- byte todo, cc;
- byte *iptr, *sptr, *optr, *ibufend;
- for (bp = cur.data, x=0, shift = 8 - cur.bpp;
- x < bdev->width;
- )
- { uint pixel = 0;
- uint r, g, b;
- switch (cur.bpp >> 3)
- {
- case 3: pixel = (uint)*bp << 16; bp++;
- case 2: pixel += (uint)*bp << 8; bp++;
- case 1: pixel += *bp; bp++; break;
- case 0: pixel = *bp >> shift;
- if ((shift-=cur.bpp) < 0)
- bp++, shift += 8; break;
- }
- ++x;
- b = pixel & mask; pixel >>= bpe;
- g = pixel & mask; pixel >>= bpe;
- r = pixel & mask;
- switch(separation)
- {
- case 0: *curcol++=r; break;
- case 1: *curcol++=g; break;
- case 2: *curcol++=b; break;
- }
- }
- iptr=cur.data;
- optr=startcol;
- ibufend=curcol-1;
- while(iptr<ibufend) {
- sptr = iptr;
- iptr += 2;
- while((iptr<ibufend)&&((iptr[-2]!=iptr[-1])||(iptr[-1]!=iptr[0])))
- iptr++;
- iptr -= 2;
- count = iptr-sptr;
- while(count) {
- todo = count>126 ? 126:count;
- count -= todo;
- *optr++ = 0x80|todo;
- while(todo--)
- *optr++ = *sptr++;
- }
- sptr = iptr;
- cc = *iptr++;
- while( (iptr<ibufend) && (*iptr == cc) )
- iptr++;
- count = iptr-sptr;
- while(count) {
- todo = count>126 ? 126:count;
- count -= todo;
- *optr++ = todo;
- *optr++ = cc;
- }
- }
+ {
+ cur.lnum = cur.dev->height-1;
+ rownumber = 0;
+ bpe = cur.bpp/3;
+ mask = (1<<bpe) - 1;
+ while ( !(code=sgi_next_row(&cur)))
+ { byte *bp;
+ uint x;
+ int shift;
+ byte *curcol=cur.data;
+ byte *startcol=edata;
+ int count;
+ byte todo, cc;
+ byte *iptr, *sptr, *optr, *ibufend;
+ for (bp = cur.data, x=0, shift = 8 - cur.bpp;
+ x < bdev->width;
+ )
+ { uint pixel = 0;
+ uint r, g, b;
+ switch (cur.bpp >> 3)
+ {
+ case 3: pixel = (uint)*bp << 16; bp++;
+ case 2: pixel += (uint)*bp << 8; bp++;
+ case 1: pixel += *bp; bp++; break;
+ case 0: pixel = *bp >> shift;
+ if ((shift-=cur.bpp) < 0)
+ bp++, shift += 8; break;
+ }
+ ++x;
+ b = pixel & mask; pixel >>= bpe;
+ g = pixel & mask; pixel >>= bpe;
+ r = pixel & mask;
+ switch(separation)
+ {
+ case 0: *curcol++=r; break;
+ case 1: *curcol++=g; break;
+ case 2: *curcol++=b; break;
+ }
+ }
+ iptr=cur.data;
+ optr=startcol;
+ ibufend=curcol-1;
+ while(iptr<ibufend) {
+ sptr = iptr;
+ iptr += 2;
+ while((iptr<ibufend)&&((iptr[-2]!=iptr[-1])||(iptr[-1]!=iptr[0])))
+ iptr++;
+ iptr -= 2;
+ count = iptr-sptr;
+ while(count) {
+ todo = count>126 ? 126:count;
+ count -= todo;
+ *optr++ = 0x80|todo;
+ while(todo--)
+ *optr++ = *sptr++;
+ }
+ sptr = iptr;
+ cc = *iptr++;
+ while( (iptr<ibufend) && (*iptr == cc) )
+ iptr++;
+ count = iptr-sptr;
+ while(count) {
+ todo = count>126 ? 126:count;
+ count -= todo;
+ *optr++ = todo;
+ *optr++ = cc;
+ }
+ }
*optr++ = 0;
- rowsizes[aref2(separation,rownumber++)] = optr-startcol;
- if (fwrite(startcol,1,optr-startcol,pstream) != optr-startcol) {
+ rowsizes[aref2(separation,rownumber++)] = optr-startcol;
+ if (fwrite(startcol,1,optr-startcol,pstream) != optr-startcol) {
code = gs_note_error(gs_error_ioerror);
goto free_mem;
}
- }
- }
+ }
+ }
fseek(pstream,512L,0);
for(separation=0; separation<3; separation++)
- for(rownumber=0; rownumber<bdev->height; rownumber++)
- {putint(lastval,pstream);
- lastval+=rowsizes[aref2(separation,rownumber)];}
+ for(rownumber=0; rownumber<bdev->height; rownumber++)
+ {putint(lastval,pstream);
+ lastval+=rowsizes[aref2(separation,rownumber)];}
for(separation=0; separation<3; separation++)
- for(rownumber=0; rownumber<bdev->height; rownumber++)
- {lastval=rowsizes[aref2(separation,rownumber)];
- putint(lastval,pstream);}
+ for(rownumber=0; rownumber<bdev->height; rownumber++)
+ {lastval=rowsizes[aref2(separation,rownumber)];
+ putint(lastval,pstream);}
free_mem:
gs_free(pdev->memory, (char*)cur.data, cur.line_size, 1,
- "sgi_print_page(done)");
+ "sgi_print_page(done)");
gs_free(pdev->memory, (char*)edata, cur.line_size, 1, "sgi_print_page(done)");
gs_free(pdev->memory, (char*)rowsizes,4,3*bdev->height,"sgi_print_page(done)");
return (code < 0 ? code : 0);
diff --git a/gs/base/gdevsgi.h b/gs/base/gdevsgi.h
index e10961551..90dc8bbd0 100644
--- a/gs/base/gdevsgi.h
+++ b/gs/base/gdevsgi.h
@@ -36,8 +36,8 @@
#define ifileno(p) ((p)->file)
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
#define putpix(p,x) (--(p)->cnt>=0 \
- ? ((int)(*(p)->ptr++=(unsigned)(x))) \
- : iflsbuf(p,(unsigned)(x)))
+ ? ((int)(*(p)->ptr++=(unsigned)(x))) \
+ : iflsbuf(p,(unsigned)(x)))
typedef struct {
unsigned short imagic; /* stuff saved on disk . . */
diff --git a/gs/base/gdevsj48.c b/gs/base/gdevsj48.c
index 1b717efc7..dc6176dbe 100644
--- a/gs/base/gdevsj48.c
+++ b/gs/base/gdevsj48.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,9 +18,8 @@
* --- derived from gdevbj10.c 1993-10-07
* by Mats kerblom (f86ma@dd.chalmers.se).
*/
-
-#include "gdevprn.h"
+#include "gdevprn.h"
/*
* The only available resolutions (in the program) are (180,360)x(180,360).
@@ -40,13 +39,12 @@
static dev_proc_print_page(sj48_print_page);
gx_device_printer far_data gs_sj48_device =
prn_device(prn_std_procs, "sj48",
- 80, /* width_10ths, 8" */
- 105, /* height_10ths, 10.5" */
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0,0,0,0, /* margins */
- 1, sj48_print_page);
-
+ 80, /* width_10ths, 8" */
+ 105, /* height_10ths, 10.5" */
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, sj48_print_page);
/* This comes from the bj10/bj200 source. I don't know how it applies
* for a StarJet. --- Mats kerblom.
@@ -60,7 +58,7 @@ gx_device_printer far_data gs_sj48_device =
* for A4 paper, both are 3.4mm (0.13").
*
* The bottom margin requires a bit of care. The image is printed
- * as strips, each about 3.4mm wide. We can only attain the bottom
+ * as strips, each about 3.4mm wide. We can only attain the bottom
* margin if the final strip coincides with it. Note that each strip
* is generated using only 48 of the available 64 jets, and the absence
* of those bottom 16 jets makes our bottom margin, in effect, about
@@ -76,212 +74,211 @@ gx_device_printer far_data gs_sj48_device =
*
*/
-
/* Send the page to the printer. */
static int
sj48_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size = gx_device_raster((gx_device *)pdev, 0);
- int xres = pdev->x_pixels_per_inch;
- int yres = pdev->y_pixels_per_inch;
- int mode = (yres == 180 ?
- (xres == 180 ? 39 : 40) :
- (xres == 180 ? 71 : 72));
- int bytes_per_column = (yres == 180) ? 3 : 6;
- int bits_per_column = bytes_per_column * 8;
- int skip_unit = bytes_per_column * (xres == 180 ? 1 : 2); /* Skips in step of 1/180" */
- byte *in = (byte *)gs_malloc(pdev->memory, 8, line_size, "sj48_print_page(in)");
- byte *out = (byte *)gs_malloc(pdev->memory, bits_per_column, line_size, "sj48_print_page(out)");
- int lnum = 0;
- int skip = 0;
- int skips;
- int code = 0;
- int last_row = dev_print_scan_lines(pdev);
- int limit = last_row - bits_per_column;
+ int xres = pdev->x_pixels_per_inch;
+ int yres = pdev->y_pixels_per_inch;
+ int mode = (yres == 180 ?
+ (xres == 180 ? 39 : 40) :
+ (xres == 180 ? 71 : 72));
+ int bytes_per_column = (yres == 180) ? 3 : 6;
+ int bits_per_column = bytes_per_column * 8;
+ int skip_unit = bytes_per_column * (xres == 180 ? 1 : 2); /* Skips in step of 1/180" */
+ byte *in = (byte *)gs_malloc(pdev->memory, 8, line_size, "sj48_print_page(in)");
+ byte *out = (byte *)gs_malloc(pdev->memory, bits_per_column, line_size, "sj48_print_page(out)");
+ int lnum = 0;
+ int skip = 0;
+ int skips;
+ int code = 0;
+ int last_row = dev_print_scan_lines(pdev);
+ int limit = last_row - bits_per_column;
- if ( in == 0 || out == 0 )
- { code = gs_error_VMerror;
- gs_note_error(code);
- goto fin;
- }
+ if ( in == 0 || out == 0 )
+ { code = gs_error_VMerror;
+ gs_note_error(code);
+ goto fin;
+ }
- /* Abort if the requested resolution is unsupported. */
- if ((xres !=180 && xres != 360) || (yres !=180 && yres != 360))
- { code = gs_error_rangecheck;
- gs_note_error(code);
- goto fin;
- }
+ /* Abort if the requested resolution is unsupported. */
+ if ((xres !=180 && xres != 360) || (yres !=180 && yres != 360))
+ { code = gs_error_rangecheck;
+ gs_note_error(code);
+ goto fin;
+ }
- /* Initialize the printer. */
- fwrite("\033@\000\000", 1, 4, prn_stream); /* <Printer reset>, <0>, <0>. */
+ /* Initialize the printer. */
+ fwrite("\033@\000\000", 1, 4, prn_stream); /* <Printer reset>, <0>, <0>. */
- /* Transfer pixels to printer. The last row we can print is defined
- by "last_row". Only the bottom of the print head can print at the
- bottom margin, and so we align the final printing pass. The print
- head is kept from moving below "limit", which is exactly one pass
- above the bottom margin. Once it reaches this limit, we make our
- final printing pass of a full "bits_per_column" rows. */
- while ( lnum < last_row )
- {
- byte *in_data;
- byte *in_end = in + line_size;
- byte *out_beg = out;
- byte *out_end = out + bytes_per_column * pdev->width;
- byte *outl = out;
- int bnum;
+ /* Transfer pixels to printer. The last row we can print is defined
+ by "last_row". Only the bottom of the print head can print at the
+ bottom margin, and so we align the final printing pass. The print
+ head is kept from moving below "limit", which is exactly one pass
+ above the bottom margin. Once it reaches this limit, we make our
+ final printing pass of a full "bits_per_column" rows. */
+ while ( lnum < last_row )
+ {
+ byte *in_data;
+ byte *in_end = in + line_size;
+ byte *out_beg = out;
+ byte *out_end = out + bytes_per_column * pdev->width;
+ byte *outl = out;
+ int bnum;
- /* Copy 1 scan line and test for all zero. */
- code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if ( code < 0 ) goto xit;
- /* The mem... or str... functions should be faster than */
- /* the following code, but all systems seem to implement */
- /* them so badly that this code is faster. */
- { register const long *zip = (const long *)in_data;
- register int zcnt = line_size;
- register const byte *zipb;
- for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
- { if ( zip[0] | zip[1] | zip[2] | zip[3] )
- goto notz;
- }
- zipb = (const byte *)zip;
- while ( --zcnt >= 0 )
- {
- if ( *zipb++ )
- goto notz;
- }
- /* Line is all zero, skip */
- lnum++;
- skip++;
- continue;
+ /* Copy 1 scan line and test for all zero. */
+ code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( code < 0 ) goto xit;
+ /* The mem... or str... functions should be faster than */
+ /* the following code, but all systems seem to implement */
+ /* them so badly that this code is faster. */
+ { register const long *zip = (const long *)in_data;
+ register int zcnt = line_size;
+ register const byte *zipb;
+ for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
+ { if ( zip[0] | zip[1] | zip[2] | zip[3] )
+ goto notz;
+ }
+ zipb = (const byte *)zip;
+ while ( --zcnt >= 0 )
+ {
+ if ( *zipb++ )
+ goto notz;
+ }
+ /* Line is all zero, skip */
+ lnum++;
+ skip++;
+ continue;
notz: ;
- }
+ }
- /* Vertical tab to the appropriate position. Note here that
- we make sure we don't move below limit. */
- if ( lnum > limit )
- { skip -= (limit - lnum);
- lnum = limit;
- }
+ /* Vertical tab to the appropriate position. Note here that
+ we make sure we don't move below limit. */
+ if ( lnum > limit )
+ { skip -= (limit - lnum);
+ lnum = limit;
+ }
- /* The SJ48 can only skip in steps of 1/180" */
- if (yres == 180) {
- skips = skip;
- } else {
- if (skip & 1) {
- skip--; /* Makes skip even. */
- lnum--;
- }
+ /* The SJ48 can only skip in steps of 1/180" */
+ if (yres == 180) {
+ skips = skip;
+ } else {
+ if (skip & 1) {
+ skip--; /* Makes skip even. */
+ lnum--;
+ }
skips = skip/2;
- }
-
- while ( skips > 255 )
- { fputs("\033J\377", prn_stream);
- skips -= 255;
- }
- if ( skips )
- fprintf(prn_stream, "\033J%c", skips);
+ }
+
+ while ( skips > 255 )
+ { fputs("\033J\377", prn_stream);
+ skips -= 255;
+ }
+ if ( skips )
+ fprintf(prn_stream, "\033J%c", skips);
- /* If we've printed as far as "limit", then reset "limit"
- to "last_row" for the final printing pass. */
- if ( lnum == limit )
- limit = last_row;
- skip = 0;
+ /* If we've printed as far as "limit", then reset "limit"
+ to "last_row" for the final printing pass. */
+ if ( lnum == limit )
+ limit = last_row;
+ skip = 0;
- /* Transpose in blocks of 8 scan lines. */
- for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
- { int lcnt = min(8, limit - lnum);
- byte *inp = in;
- byte *outp = outl;
- lcnt = gdev_prn_copy_scan_lines(pdev,
- lnum, in, lcnt * line_size);
- if ( lcnt < 0 )
- { code = lcnt;
- goto xit;
- }
- if ( lcnt < 8 )
- memset(in + lcnt * line_size, 0,
- (8 - lcnt) * line_size);
- for ( ; inp < in_end; inp++, outp += bits_per_column )
- { gdev_prn_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- }
- outl++;
- lnum += lcnt;
- skip += lcnt;
- }
+ /* Transpose in blocks of 8 scan lines. */
+ for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
+ { int lcnt = min(8, limit - lnum);
+ byte *inp = in;
+ byte *outp = outl;
+ lcnt = gdev_prn_copy_scan_lines(pdev,
+ lnum, in, lcnt * line_size);
+ if ( lcnt < 0 )
+ { code = lcnt;
+ goto xit;
+ }
+ if ( lcnt < 8 )
+ memset(in + lcnt * line_size, 0,
+ (8 - lcnt) * line_size);
+ for ( ; inp < in_end; inp++, outp += bits_per_column )
+ { gdev_prn_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ }
+ outl++;
+ lnum += lcnt;
+ skip += lcnt;
+ }
- /* Send the bits to the printer. We alternate horizontal
- skips with the data. The horizontal skips are in units
- of 1/180 inches, so we look at the data in groups of
- 1 or 2 columns depending on resolution (controlled
+ /* Send the bits to the printer. We alternate horizontal
+ skips with the data. The horizontal skips are in units
+ of 1/180 inches, so we look at the data in groups of
+ 1 or 2 columns depending on resolution (controlled
by skip_unit). */
- outl = out;
- do
- { int count;
- int n;
- byte *out_ptr;
+ outl = out;
+ do
+ { int count;
+ int n;
+ byte *out_ptr;
- /* First look for blank groups of columns. */
- while(outl < out_end)
- { n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while ( --count >= 0 )
- { if ( *out_ptr++ )
- break;
- }
- if ( count >= 0 )
- break;
- else
- outl = out_ptr;
- }
- if (outl >= out_end)
- break;
- if (outl > out_beg)
- { count = (outl - out_beg) / skip_unit;
- fprintf(prn_stream, "\033\\%c%c",
- count & 0xff, count >> 8);
- }
+ /* First look for blank groups of columns. */
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count >= 0 )
+ break;
+ else
+ outl = out_ptr;
+ }
+ if (outl >= out_end)
+ break;
+ if (outl > out_beg)
+ { count = (outl - out_beg) / skip_unit;
+ fprintf(prn_stream, "\033\\%c%c",
+ count & 0xff, count >> 8);
+ }
- /* Next look for non-blank groups of columns. */
- out_beg = outl;
- outl += n;
- while(outl < out_end)
- { n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while ( --count >= 0 )
- { if ( *out_ptr++ )
- break;
- }
- if ( count < 0 )
- break;
- else
- outl += n;
- }
- count = outl - out_beg;
- {
- /* What to transmit is the number of columns in the row.
- Compare this with the <Esc>|*-command wich expects the
- total number of bytes in the graphic row! */
- int count1 = count/bytes_per_column;
- fprintf(prn_stream, "\033*%c%c%c",
- mode, count1 & 0xff, count1 >> 8);
- }
- fwrite(out_beg, 1, count, prn_stream);
- out_beg = outl;
- outl += n;
- }
- while ( out_beg < out_end );
+ /* Next look for non-blank groups of columns. */
+ out_beg = outl;
+ outl += n;
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count < 0 )
+ break;
+ else
+ outl += n;
+ }
+ count = outl - out_beg;
+ {
+ /* What to transmit is the number of columns in the row.
+ Compare this with the <Esc>|*-command wich expects the
+ total number of bytes in the graphic row! */
+ int count1 = count/bytes_per_column;
+ fprintf(prn_stream, "\033*%c%c%c",
+ mode, count1 & 0xff, count1 >> 8);
+ }
+ fwrite(out_beg, 1, count, prn_stream);
+ out_beg = outl;
+ outl += n;
+ }
+ while ( out_beg < out_end );
- fputc('\r', prn_stream);
- skip = bits_per_column; /* <CR> only moves to the beginning of the row. */
- }
+ fputc('\r', prn_stream);
+ skip = bits_per_column; /* <CR> only moves to the beginning of the row. */
+ }
- /* Eject the page */
+ /* Eject the page */
xit: fputc(014, prn_stream); /* form feed */
- fflush(prn_stream);
+ fflush(prn_stream);
fin: if ( out != 0 )
- gs_free(pdev->memory, (char *)out, bits_per_column, line_size,
- "sj48_print_page(out)");
- if ( in != 0 )
- gs_free(pdev->memory, (char *)in, 8, line_size, "sj48_print_page(in)");
- return code;
+ gs_free(pdev->memory, (char *)out, bits_per_column, line_size,
+ "sj48_print_page(out)");
+ if ( in != 0 )
+ gs_free(pdev->memory, (char *)in, 8, line_size, "sj48_print_page(in)");
+ return code;
}
diff --git a/gs/base/gdevsnfb.c b/gs/base/gdevsnfb.c
index 49e9c6217..d280efe9c 100644
--- a/gs/base/gdevsnfb.c
+++ b/gs/base/gdevsnfb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,12 +29,12 @@ static gx_device_procs sonyfb_procs =
prn_procs(sonyfb_open, sonyfb_output_page, sonyfb_close);
const gx_device_printer far_data gs_sonyfb_device =
prn_device(sonyfb_procs, "sonyfb",
- 102.4, /* width_10ths */
- 103.2, /* height_10ths */
- 100, /* x_dpi */
- 100, /* y_dpi */
- 0,0,0,0, /* margins */
- 1, 0);
+ 102.4, /* width_10ths */
+ 103.2, /* height_10ths */
+ 100, /* x_dpi */
+ 100, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, 0);
static int fb_file = -1;
sPrimRect prect;
@@ -49,9 +49,9 @@ sonyfb_open(gx_device *dev)
perror("open failed");
else
if(ioctl(fb_file, FBIOCGETSCRTYPE, &stype) < 0)
- perror("ioctl failed");
+ perror("ioctl failed");
else
- prect.rect = stype.visiblerect;
+ prect.rect = stype.visiblerect;
return gdev_prn_open(dev);
}
@@ -83,7 +83,7 @@ sonyfb_output_page(gx_device *dev, int num_copies, int flush)
prect.refPoint.x = 0;
prect.refPoint.y = 0;
prect.ptnRect = prect.rect;
-
+
prect.ptnBM.type = BM_MEM;
prect.ptnBM.depth = 1;
prect.ptnBM.width = (byte_width + 1) / 2;
@@ -92,7 +92,7 @@ sonyfb_output_page(gx_device *dev, int num_copies, int flush)
prect.ptnBM.rect.extent.x = byte_width * 8; /* width in 16bit words */
prect.ptnBM.rect.extent.y = height;
prect.ptnBM.base = (typeof(prect.ptnBM.base))bm;
-
+
prect.fore_color = 1;
prect.aux_color = 0;
prect.planemask = FB_PLANEALL;
@@ -104,7 +104,7 @@ sonyfb_output_page(gx_device *dev, int num_copies, int flush)
prect.drawBM.width = (prect.rect.extent.x + 15) / 16;
prect.drawBM.rect = prect.rect;
prect.drawBM.base = 0;
-
+
if(ioctl(fb_file, FBIOCRECTANGLE, &prect) < 0)
perror("rect ioctl failed");
diff --git a/gs/base/gdevsppr.c b/gs/base/gdevsppr.c
index 2d1f5b0eb..45e515a14 100644
--- a/gs/base/gdevsppr.c
+++ b/gs/base/gdevsppr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -60,13 +60,13 @@ prn_device(prn_sparc_procs,
static int
sparc_open(gx_device *pdev)
{ /* Change the margins according to the paper size. */
- const float *m;
- static const float m_a4[4] = { SPARC_MARGINS_A4 };
- static const float m_letter[4] = { SPARC_MARGINS_LETTER };
+ const float *m;
+ static const float m_a4[4] = { SPARC_MARGINS_A4 };
+ static const float m_letter[4] = { SPARC_MARGINS_LETTER };
- m = (pdev->height / pdev->y_pixels_per_inch >= 11.1 ? m_a4 : m_letter);
- gx_device_set_margins(pdev, m, true);
- return gdev_prn_open(pdev);
+ m = (pdev->height / pdev->y_pixels_per_inch >= 11.1 ? m_a4 : m_letter);
+ gx_device_set_margins(pdev, m, true);
+ return gdev_prn_open(pdev);
}
char *errmsg[]={
@@ -140,38 +140,38 @@ sparc_print_page(gx_device_printer *pdev, FILE *prn)
switch (lpvierr.err_type)
{
case 0:
- if (warning==0)
+ if (warning==0)
{
errprintf(pdev->memory,
"sparc_print_page: Printer Problem with unknown reason...");
dflush();
warning=1;
}
- sleep(5);
- break;
+ sleep(5);
+ break;
case ENGWARN:
- errprintf(pdev->memory,
+ errprintf(pdev->memory,
"sparc_print_page: Printer-Warning: %s...",
err_code_string(lpvierr.err_code));
- dflush();
- warning=1;
- sleep(5);
- break;
+ dflush();
+ warning=1;
+ sleep(5);
+ break;
case ENGFATL:
- errprintf(pdev->memory,
+ errprintf(pdev->memory,
"sparc_print_page: Printer-Fatal: %s\n",
err_code_string(lpvierr.err_code));
- return -1;
+ return -1;
case EDRVR:
- errprintf(pdev->memory,
+ errprintf(pdev->memory,
"sparc_print_page: Interface/driver error: %s\n",
err_code_string(lpvierr.err_code));
- return -1;
+ return -1;
default:
- errprintf(pdev->memory,
+ errprintf(pdev->memory,
"sparc_print_page: Unknown err_type=%d(err_code=%d)\n",
lpvierr.err_type,lpvierr.err_code);
- return -1;
+ return -1;
}
}
if (warning==1)
diff --git a/gs/base/gdevstc.c b/gs/base/gdevstc.c
index 982577a11..c781b069b 100644
--- a/gs/base/gdevstc.c
+++ b/gs/base/gdevstc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -216,8 +216,8 @@ static int stc_print_setup(stcolor_device *sd);
*** compute the ESC/P2 specific values
***/
-static int
-stc_print_setup(stcolor_device *sd)
+static int
+stc_print_setup(stcolor_device *sd)
{
/*
@@ -258,8 +258,8 @@ stc_print_setup(stcolor_device *sd)
sd->stc.escp_top = (int)(dev_t_margin(sd)*sd->y_pixels_per_inch);
if((sd->stc.flags & STCBOTTOM) == 0)
- sd->stc.escp_bottom = (int)(sd->height -
- dev_b_margin(sd)*sd->y_pixels_per_inch);
+ sd->stc.escp_bottom = (int)(sd->height -
+ dev_b_margin(sd)*sd->y_pixels_per_inch);
if((sd->stc.flags & STCINIT) == 0) { /* No Initialization-String defined */
int need = 8 /* Reset, Graphics-Mode 1 */
@@ -292,7 +292,6 @@ stc_print_setup(stcolor_device *sd)
"\033@\033(G\001\0\1\033(i\1\0w\033(U\001\000u\033(C\2\000hh\033(c\4\000ttbb\033U",
need);
-
if((sd->stc.flags & STCUWEAVE) != 0) bp[13] = '\1';
else bp[13] = '\0';
@@ -537,7 +536,6 @@ stc_print_page(gx_device_printer * pdev, FILE * prn_stream)
sigprocmask(SIG_BLOCK,&stc_int_mask, &stc_int_save);
#endif /* STC_SIGNAL */
-
if(sd->color_info.num_components > 1) ncolor = 4;
else ncolor = 1;
@@ -583,7 +581,6 @@ stc_print_page(gx_device_printer * pdev, FILE * prn_stream)
sd->stc.prt_width[buf_i+color] = 0;
}
-
/* "read data", immediately continue if all is white */
if(sd->stc.buf_y < sd->stc.prt_scans) { /* Test for White */
@@ -610,7 +607,6 @@ stc_print_page(gx_device_printer * pdev, FILE * prn_stream)
alg_data = (*iconvert)(sd,ext_data,prt_pixels,alg_line);
-
/*
* invoke the dithering-algorithm
*/
@@ -737,7 +733,7 @@ stc_print_page(gx_device_printer * pdev, FILE * prn_stream)
#ifdef STC_SIGNAL
sigprocmask(SIG_SETMASK,&stc_int_save,NULL);
#endif /* STC_DIGNAL */
-
+
}
}
@@ -794,7 +790,7 @@ stc_print_page(gx_device_printer * pdev, FILE * prn_stream)
/*
* white-check
*/
-static bool
+static bool
stc_iswhite(stcolor_device *sd, int prt_pixels,byte *ext_data)
{
long b2do = (prt_pixels*sd->color_info.depth+7)>>3;
@@ -1017,7 +1013,6 @@ stc_cmyk10_float(stcolor_device *sd,
\
return alg_line;
-
static byte *
stc_cmyk10_dbyte(stcolor_device *sd,
byte *ext_data,int prt_pixels,byte *alg_line)
@@ -1046,7 +1041,7 @@ stc_any_direct(stcolor_device *sd,byte *ext_data,int prt_pixels,byte *alg_line)
/* ----------------------------------------------------------------------- */
/* stc_rle: epson ESC/P2 RLE-Encoding
*/
-static int
+static int
stc_rle(byte *out,const byte *in,int width)
{
@@ -1104,11 +1099,10 @@ stc_rle(byte *out,const byte *in,int width)
return used;
}
-
/*
* Horizontal & vertical positioning, color-selection, "ESC ."
*/
-static int
+static int
stc_print_escpcmd(stcolor_device *sd, FILE *prn_stream,
int escp_used, int color,int m,int wbytes)
{
@@ -1141,7 +1135,7 @@ stc_print_escpcmd(stcolor_device *sd, FILE *prn_stream,
((dy % sd->stc.escp_lf) == 0)) /* and possible */
nlf = dy / sd->stc.escp_lf;
else nlf = 7;
-
+
if(nlf > 6) {
sd->stc.escp_data[escp_used++] = '\033';
sd->stc.escp_data[escp_used++] = '(';
@@ -1183,7 +1177,7 @@ stc_print_escpcmd(stcolor_device *sd, FILE *prn_stream,
/*
* compute width of a group of scanlines
*/
-static int
+static int
stc_bandwidth(stcolor_device *sd,int color,int m,int npass)
{
int ncolor = sd->color_info.num_components == 1 ? 1 : 4;
@@ -1201,7 +1195,7 @@ stc_bandwidth(stcolor_device *sd,int color,int m,int npass)
/*
* Multi-Pass Printing-Routine
*/
-static void
+static void
stc_print_weave(stcolor_device *sd, FILE *prn_stream)
{
@@ -1210,7 +1204,6 @@ stc_print_weave(stcolor_device *sd, FILE *prn_stream)
int npass = sd->stc.escp_v / sd->stc.escp_u;
int ncolor = sd->color_info.num_components == 1 ? 1 : 4;
-
while(sd->stc.stc_y < sd->stc.prt_scans) {
/*
@@ -1276,7 +1269,7 @@ stc_print_weave(stcolor_device *sd, FILE *prn_stream)
/*
* Single-Pass printing-Routine
*/
-static void
+static void
stc_print_bands(stcolor_device *sd, FILE *prn_stream)
{
@@ -1343,7 +1336,7 @@ stc_print_bands(stcolor_device *sd, FILE *prn_stream)
}
/* ----------------------------------------------------------------------- */
-static int
+static int
stc_deltarow(byte *out,const byte *in,int width,byte *seed)
{
@@ -1430,7 +1423,7 @@ stc_print_delta(stcolor_device *sd, FILE *prn_stream)
{
int color,buf_a,w;
- int escp_used = 0;
+ int escp_used = 0;
int ncolor = sd->color_info.num_components == 1 ? 1 : 4;
while(sd->stc.stc_y < sd->stc.prt_scans) {
@@ -1524,7 +1517,7 @@ stc_print_delta(stcolor_device *sd, FILE *prn_stream)
/***
*** Free-Data: release the specific-Arrays
***/
-static void
+static void
stc_freedata(gs_memory_t *mem, stc_t *stc)
{
int i,j;
@@ -1558,7 +1551,7 @@ stc_freedata(gs_memory_t *mem, stc_t *stc)
*** open the device and initialize margins & arrays
***/
-static int
+static int
stc_open(gx_device *pdev) /* setup margins & arrays */
{
stcolor_device *sd = (stcolor_device *) pdev;
@@ -1597,7 +1590,6 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
* Establish internal Value & Code-Arrays
*/
-
for(i = 0; i < sd->color_info.num_components; ++i) { /* comp */
if((sd->stc.sizc[i] > 1) && (sd->stc.extc[i] != NULL)) { /* code req. */
@@ -1679,7 +1671,6 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
} else { /* success */
-
if(sd->stc.code[i] == NULL) { /* linear */
byte *Out = sd->stc.vals[i];
@@ -1710,7 +1701,6 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
Y = Omin + (Omax-Omin) * Y;
Y = Y < Omin ? Omin : (Y > Omax ? Omax : Y);
-
switch(sd->stc.dither->flags & STC_TYPE) {
case STC_BYTE:
Ovb = (byte)Y;
@@ -1793,11 +1783,11 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
switch(sd->color_info.num_components) { /* Establish color-procs */
case 1:
- sd->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ sd->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
set_dev_proc(sd,map_rgb_color, stc_map_gray_color);
set_dev_proc(sd,map_cmyk_color,gx_default_map_cmyk_color);
set_dev_proc(sd,map_color_rgb, stc_map_color_gray);
- set_dev_proc(sd,encode_color, stc_map_gray_color);
+ set_dev_proc(sd,encode_color, stc_map_gray_color);
set_dev_proc(sd,decode_color, stc_map_color_gray);
set_dev_proc(sd, get_color_mapping_procs,
gx_default_DevGray_get_color_mapping_procs);
@@ -1807,11 +1797,11 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
white = stc_map_gray_color((gx_device *) sd, cv);
break;
case 3:
- sd->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ sd->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
set_dev_proc(sd,map_rgb_color, stc_map_rgb_color);
set_dev_proc(sd,map_cmyk_color,gx_default_map_cmyk_color);
set_dev_proc(sd,map_color_rgb, stc_map_color_rgb);
- set_dev_proc(sd,encode_color, stc_map_rgb_color);
+ set_dev_proc(sd,encode_color, stc_map_rgb_color);
set_dev_proc(sd,decode_color, stc_map_color_rgb);
set_dev_proc(sd, get_color_mapping_procs,
gx_default_DevRGB_get_color_mapping_procs);
@@ -1821,7 +1811,7 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
white = stc_map_rgb_color((gx_device *) sd, cv);
break;
default:
- sd->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ sd->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
set_dev_proc(sd,map_rgb_color, gx_default_map_rgb_color);
set_dev_proc(sd, get_color_mapping_procs,
gx_default_DevCMYK_get_color_mapping_procs);
@@ -1830,14 +1820,14 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
if(sd->stc.flags & STCCMYK10) {
set_dev_proc(sd,map_cmyk_color,stc_map_cmyk10_color);
set_dev_proc(sd,map_color_rgb, stc_map_color_cmyk10);
- set_dev_proc(sd,encode_color,stc_map_cmyk10_color);
+ set_dev_proc(sd,encode_color,stc_map_cmyk10_color);
set_dev_proc(sd,decode_color, stc_map_color_cmyk10);
cv[0] = cv[1] = cv[2] = cv[3] = 0;
white = stc_map_cmyk10_color((gx_device *) sd, cv);
} else {
set_dev_proc(sd,map_cmyk_color,stc_map_cmyk_color);
set_dev_proc(sd,map_color_rgb, stc_map_color_cmyk);
- set_dev_proc(sd,encode_color,stc_map_cmyk_color);
+ set_dev_proc(sd,encode_color,stc_map_cmyk_color);
set_dev_proc(sd,decode_color, stc_map_color_cmyk);
cv[0] = cv[1] = cv[2] = cv[3] = 0;
white = stc_map_cmyk_color((gx_device *) sd,cv);
@@ -1845,7 +1835,6 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
break; /* Establish color-procs */
}
-
/*
* create at least a Byte
*/
@@ -1921,7 +1910,7 @@ stc_open(gx_device *pdev) /* setup margins & arrays */
/***
*** stc_close: release the internal data
***/
-static int
+static int
stc_close(gx_device *pdev)
{
stc_freedata(pdev->memory, &((stcolor_device *) pdev)->stc);
@@ -1929,11 +1918,10 @@ stc_close(gx_device *pdev)
return gdev_prn_close(pdev);
}
-
/***
*** Function for Bit-Truncation, including direct-byte-transfer
***/
-static gx_color_value
+static gx_color_value
stc_truncate(stcolor_device *sd,int i,gx_color_value v)
{
@@ -1986,7 +1974,7 @@ stc_truncate1(stcolor_device *sd,int i,gx_color_value v)
/***
*** Expansion of indices for reverse-mapping
***/
-static gx_color_value
+static gx_color_value
stc_expand(stcolor_device *sd,int i,gx_color_index col)
{
@@ -2018,7 +2006,7 @@ stc_expand(stcolor_device *sd,int i,gx_color_index col)
/***
*** color-mapping of gray-scales
***/
-static gx_color_index
+static gx_color_index
stc_map_gray_color(gx_device *pdev, const gx_color_value cv[])
{
@@ -2064,7 +2052,7 @@ stc_map_gray_color(gx_device *pdev, const gx_color_value cv[])
return rv;
}
-static int
+static int
stc_map_color_gray(gx_device *pdev, gx_color_index color,gx_color_value prgb[3])
{
stcolor_device *sd = (stcolor_device *) pdev;
@@ -2079,7 +2067,7 @@ stc_map_color_gray(gx_device *pdev, gx_color_index color,gx_color_value prgb[3])
/***
*** color-mapping of rgb-values
***/
-static gx_color_index
+static gx_color_index
stc_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
{
@@ -2129,7 +2117,7 @@ stc_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
return rv;
}
-static int
+static int
stc_map_color_rgb(gx_device *pdev, gx_color_index color,gx_color_value prgb[3])
{
@@ -2147,7 +2135,7 @@ stc_map_color_rgb(gx_device *pdev, gx_color_index color,gx_color_value prgb[3])
/***
*** color-mapping of cmyk-values
***/
-static gx_color_index
+static gx_color_index
stc_map_cmyk_color(gx_device *pdev, const gx_color_value cv[])
{
@@ -2241,7 +2229,7 @@ stc_map_cmyk_color(gx_device *pdev, const gx_color_value cv[])
}
/* Modified to be a "decode_color" routine */
-static int
+static int
stc_map_color_cmyk(gx_device *pdev, gx_color_index color,gx_color_value cv[4])
{
@@ -2255,19 +2243,18 @@ stc_map_color_cmyk(gx_device *pdev, gx_color_index color,gx_color_value cv[4])
m = stc_expand(sd,1, color & l); color >>= shift;
c = stc_expand(sd,0, color & l);
-
cv[0] = c;
cv[1] = m;
cv[2] = y;
cv[3] = k;
-
+
return 0;
}
/***
*** color-mapping of cmyk10-values
***/
-static gx_color_index
+static gx_color_index
stc_map_cmyk10_color(gx_device *pdev, const gx_color_value cv[])
{
@@ -2400,7 +2387,7 @@ stc_map_cmyk10_color(gx_device *pdev, const gx_color_value cv[])
return rv;
}
-static int
+static int
stc_map_color_cmyk10(gx_device *pdev, gx_color_index color,
gx_color_value cv[3])
{
@@ -2523,7 +2510,7 @@ stc_map_color_cmyk10(gx_device *pdev, gx_color_index color,
*** Get parameters == Make them accessable via PostScript
***/
-static int
+static int
stc_get_params(gx_device *pdev, gs_param_list *plist)
{
int code,nc;
@@ -2672,7 +2659,7 @@ stc_get_params(gx_device *pdev, gs_param_list *plist)
*** put parameters == Store them in the device-structure
***/
-static int
+static int
stc_put_params(gx_device *pdev, gs_param_list *plist)
{
int code,error,i,l;
@@ -3329,7 +3316,6 @@ stc_gscmyk(stcolor_device *sdev,int npixel,byte *in,byte *buf,byte *out)
byte *ip = in;
int error = 0;
-
/* ============================================================= */
if(npixel > 0) { /* npixel > 0 -> scanline-processing */
/* ============================================================= */
diff --git a/gs/base/gdevstc.h b/gs/base/gdevstc.h
index 0ead90596..5087149d9 100644
--- a/gs/base/gdevstc.h
+++ b/gs/base/gdevstc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -82,7 +82,6 @@ typedef struct stc_s {
int buf_y; /* Next line 2b loaded into the buffer */
int prt_scans; /* number of lines printed */
-
int *prt_width; /* Width of buffered lines */
byte **prt_data; /* Buffered printer-lines */
byte *escp_data; /* Buffer for ESC/P2-Data */
@@ -93,8 +92,8 @@ typedef struct stc_s {
/*** Main-Device Structure ***/
typedef struct stcolor_device_s {
- gx_device_common;
- gx_prn_device_common;
+ gx_device_common;
+ gx_prn_device_common;
stc_t stc;
} stcolor_device;
@@ -176,7 +175,6 @@ stc_proc_dither(stc_fscmyk); /* resides in gdevstc2.c too */
stc_proc_dither(stc_gsrgb); /* resides in gdevstc3.c */
stc_proc_dither(stc_fs2); /* resides in gdevstc4.c */
-
/* Values used to assemble flags */
#define DeviceGray 1 /* ProcessColorModel = DeviceGray */
#define DeviceRGB 3 /* ProcessColorModel = DeviceRGB */
@@ -215,11 +213,10 @@ stc_proc_dither(stc_fs2); /* resides in gdevstc4.c */
{"fs2", stc_fs2, \
DeviceRGB |STC_BYTE|STC_WHITE|1*STC_SCAN,0,{0.0,255.0}},
-
#ifndef X_DPI
#define X_DPI 360
#endif /* X_DPI */
-#ifndef Y_DPI
+#ifndef Y_DPI
#define Y_DPI 360
#endif /* Y_DPI */
diff --git a/gs/base/gdevstc1.c b/gs/base/gdevstc1.c
index a36c89575..41a0ea204 100644
--- a/gs/base/gdevstc1.c
+++ b/gs/base/gdevstc1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,8 +39,8 @@
*/
/*ARGSUSED*/
-int
-stc_gsmono(stcolor_device *sdev,int npixel,byte *in,byte *buf,byte *out)
+int
+stc_gsmono(stcolor_device *sdev,int npixel,byte *in,byte *buf,byte *out)
{
/*
@@ -94,7 +94,7 @@ stc_gsmono(stcolor_device *sdev,int npixel,byte *in,byte *buf,byte *out)
* additionally, the size of the scanlines may be expanded by one to the
* right and to the left.
*/
- buf_size =
+ buf_size =
sdev->stc.dither->bufadd /* scanline-independend size */
+ (-npixel) /* pixels */
* (sdev->stc.dither->flags/STC_SCAN) /* * scanlines */
diff --git a/gs/base/gdevstc2.c b/gs/base/gdevstc2.c
index 848adf388..a9083a5ce 100644
--- a/gs/base/gdevstc2.c
+++ b/gs/base/gdevstc2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,11 +37,11 @@
#include <stdlib.h> /* for rand */
/*
- Both algorithms require an error-buffer of
+ Both algorithms require an error-buffer of
3 + 3*num_components +1*scan long-items.
- and must consequently set up to work with longs.
+ and must consequently set up to work with longs.
It is just a Floyd-Steinberg-algorithm applied to each component.
*/
@@ -67,9 +67,8 @@ static const byte cmykvals[16] = {
static const byte *const pixelconversion[5] = {
NULL, grayvals, NULL, rgbvals, cmykvals};
-
-int
-stc_fs(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
+int
+stc_fs(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
{
long *in = (long *) bin;
@@ -135,7 +134,6 @@ stc_fs(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
out += bstep;
} /* loop over pixels */
-
/* ============================================================= */
} else { /* npixel <= 0 -> initialisation */
/* ============================================================= */
@@ -222,8 +220,8 @@ stc_fs(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
* Experimental CMYK-Algorithm
*/
-int
-stc_fscmyk(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
+int
+stc_fscmyk(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
{
long *in = (long *) bin;
long *buf = (long *) bbuf;
@@ -335,7 +333,6 @@ stc_fscmyk(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
out += bstep;
} /* loop over pixels */
-
/* ============================================================= */
} else { /* npixel <= 0 -> initialisation */
/* ============================================================= */
@@ -380,8 +377,8 @@ stc_fscmyk(stcolor_device *sdev,int npixel,byte *bin,byte *bbuf,byte *out)
offset = sdev->stc.dither->minmax[0];
scale -= offset;
if(sdev->stc.flags & STCDFLAG1) {
- buf[2] = (long)((sdev->stc.extv[0][sdev->stc.sizv[0]-1] -
- sdev->stc.extv[0][0]) * scale / 2.0 + offset);
+ buf[2] = (long)((sdev->stc.extv[0][sdev->stc.sizv[0]-1] -
+ sdev->stc.extv[0][0]) * scale / 2.0 + offset);
} else {
if((offset+0.5*scale) > 0.0) buf[2] = (long)(offset + 0.5*scale + 0.5);
else buf[2] = (long)(offset + 0.5*scale - 0.5);
diff --git a/gs/base/gdevstc3.c b/gs/base/gdevstc3.c
index d40617c22..66a60494b 100644
--- a/gs/base/gdevstc3.c
+++ b/gs/base/gdevstc3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,7 +39,7 @@
*/
/*ARGSUSED*/
-int
+int
stc_gsrgb(stcolor_device *sdev,int npixel,byte *ip,byte *buf,byte *out)
{
@@ -62,7 +62,7 @@ stc_gsrgb(stcolor_device *sdev,int npixel,byte *ip,byte *buf,byte *out)
int p;
/*
- * simply merge the color-values into a single byte
+ * simply merge the color-values into a single byte
* (RED, GREEN, BLUE are defined in gdevstc.h)
*/
for(p = 0; p < npixel; ++p,++out) { /* loop over pixels */
diff --git a/gs/base/gdevstc4.c b/gs/base/gdevstc4.c
index 7bb0a618e..61a3452a5 100644
--- a/gs/base/gdevstc4.c
+++ b/gs/base/gdevstc4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,13 +16,13 @@
/***
This file holds a byte-Implementation of the Floyd-Steinberg error
- diffusion-algorithm. This algorithm is an alternative for high quality
+ diffusion-algorithm. This algorithm is an alternative for high quality
printing in conjunction with the PostScript-Header stcolor.ps:
gs -sDEVICE=stcolor -sDithering=fs2 <other options> stcolor.ps ...
THIS ALGORIHM WAS WRITTEN BY STEVEN SINGER (S.Singer@ph.surrey.ac.uk)
- AS PART OF escp2cfs2.
+ AS PART OF escp2cfs2.
THIS IMPLEMENTATION INCORPORATES ONLY FEW CHANGES TO THE ORIGINAL CODE.
***/
@@ -30,7 +30,7 @@
#include "gdevstc.h"
/*
- * escp2c_pick best scans for best matching color
+ * escp2c_pick best scans for best matching color
*/
static byte *
escp2c_pick_best(byte *col)
@@ -60,15 +60,15 @@ escp2c_pick_best(byte *col)
z = col[2];
for(n=8; n--; )
{
- dx = x - colour[n][0];
- dy = y - colour[n][1];
- dz = z - colour[n][2];
- d = dx*(dx-(dy>>1)) + dy*(dy-(dz>>1)) + dz*(dz-(dx>>1));
- if (d < md)
- {
- md = d;
- p = n;
- }
+ dx = x - colour[n][0];
+ dy = y - colour[n][1];
+ dz = z - colour[n][2];
+ d = dx*(dx-(dy>>1)) + dy*(dy-(dz>>1)) + dz*(dz-(dx>>1));
+ if (d < md)
+ {
+ md = d;
+ p = n;
+ }
}
*/
@@ -120,7 +120,6 @@ escp2c_conv_stc(byte *p, byte *q, int i)
*q++ = (*p & RED) | (p[1] & GREEN) | (p[2] & BLUE);
}
-
/*
* Limit byte-values
*/
@@ -130,7 +129,7 @@ escp2c_conv_stc(byte *p, byte *q, int i)
/*
* Main routine of the algorithm
*/
-int
+int
stc_fs2(stcolor_device *sd,int npixel,byte *in,byte *buf,byte *out)
{
int fullcolor_line_size = npixel*3;
@@ -155,118 +154,116 @@ stc_fs2(stcolor_device *sd,int npixel,byte *in,byte *buf,byte *out)
p = buf;
if (*p != 0 || memcmp((char *) p, (char *) p + 1, fullcolor_line_size - 1))
{
- for(p = in, q=buf, i=fullcolor_line_size;
- i--; p++, q++ )
- {
- j = *p + ((*q & 128) ? *q - 256 : *q);
- LIMIT(j);
- *p = j;
- }
+ for(p = in, q=buf, i=fullcolor_line_size;
+ i--; p++, q++ )
+ {
+ j = *p + ((*q & 128) ? *q - 256 : *q);
+ LIMIT(j);
+ *p = j;
+ }
}
p = in;
- fb = below[2];
- b = below[1];
- bb = below[0];
- *b = b[1] = b[2] = *bb = bb[1] = bb[2] = 0;
-
- if (dir)
- {
- for(p = in, q=buf-3,
- i=fullcolor_line_size; i; i-=3)
- {
- cp = escp2c_pick_best(p);
- for(i2=3; i2--; p++, q++, fb++, b++, bb++)
- {
- j = *p;
- *p = *cp++;
- j -= *p;
- if (j != 0)
- {
- l = (e = (j>>1)) - (*fb = (j>>4));
- if (i > 2)
- {
- k = p[3] + l;
- LIMIT(k);
- p[3] = k;
- }
- *b += e - (l = (j>>2) - *fb);
- if (i < fullcolor_line_size)
- {
- l += *bb;
- LIMIT2(l);
- *q = l;
- }
- }
- else
- *fb = 0;
- }
- tb = bb-3;
- bb = b-3;
- b = fb-3;
- fb = tb;
- }
- *q = *bb;
- q[1] = bb[1];
- q[2] = bb[2];
- dir = 0;
- }
- else
- {
- for(p = in+fullcolor_line_size-1,
- q = buf+fullcolor_line_size+2, i=fullcolor_line_size;
+ fb = below[2];
+ b = below[1];
+ bb = below[0];
+ *b = b[1] = b[2] = *bb = bb[1] = bb[2] = 0;
+
+ if (dir)
+ {
+ for(p = in, q=buf-3,
+ i=fullcolor_line_size; i; i-=3)
+ {
+ cp = escp2c_pick_best(p);
+ for(i2=3; i2--; p++, q++, fb++, b++, bb++)
+ {
+ j = *p;
+ *p = *cp++;
+ j -= *p;
+ if (j != 0)
+ {
+ l = (e = (j>>1)) - (*fb = (j>>4));
+ if (i > 2)
+ {
+ k = p[3] + l;
+ LIMIT(k);
+ p[3] = k;
+ }
+ *b += e - (l = (j>>2) - *fb);
+ if (i < fullcolor_line_size)
+ {
+ l += *bb;
+ LIMIT2(l);
+ *q = l;
+ }
+ }
+ else
+ *fb = 0;
+ }
+ tb = bb-3;
+ bb = b-3;
+ b = fb-3;
+ fb = tb;
+ }
+ *q = *bb;
+ q[1] = bb[1];
+ q[2] = bb[2];
+ dir = 0;
+ }
+ else
+ {
+ for(p = in+fullcolor_line_size-1,
+ q = buf+fullcolor_line_size+2, i=fullcolor_line_size;
i; i-=3)
- {
- cp = escp2c_pick_best(p-2) + 2;
- for(i2=3; i2--; p--, q--, fb++, b++, bb++)
- {
- j = *p;
- *p = *cp--;
- j -= *p;
- if (j != 0)
- {
- l = (e = (j>>1)) - (*fb = (j>>4));
- if (i > 2)
- {
- k = p[-3] + l;
- LIMIT(k);
- p[-3] = k;
- }
- *b += e - (l = (j>>2) - *fb);
- if (i < fullcolor_line_size)
- {
- l += *bb;
- LIMIT2(l);
- *q = l;
- }
- }
- else
- *fb = 0;
- }
- tb = bb-3;
- bb = b-3;
- b = fb-3;
- fb = tb;
- }
- *q = *bb;
- q[1] = bb[1];
- q[2] = bb[2];
- dir = 1;
- }
-
+ {
+ cp = escp2c_pick_best(p-2) + 2;
+ for(i2=3; i2--; p--, q--, fb++, b++, bb++)
+ {
+ j = *p;
+ *p = *cp--;
+ j -= *p;
+ if (j != 0)
+ {
+ l = (e = (j>>1)) - (*fb = (j>>4));
+ if (i > 2)
+ {
+ k = p[-3] + l;
+ LIMIT(k);
+ p[-3] = k;
+ }
+ *b += e - (l = (j>>2) - *fb);
+ if (i < fullcolor_line_size)
+ {
+ l += *bb;
+ LIMIT2(l);
+ *q = l;
+ }
+ }
+ else
+ *fb = 0;
+ }
+ tb = bb-3;
+ bb = b-3;
+ b = fb-3;
+ fb = tb;
+ }
+ *q = *bb;
+ q[1] = bb[1];
+ q[2] = bb[2];
+ dir = 1;
+ }
+
escp2c_conv_stc(in, out, fullcolor_line_size);
/* ------------------------------------------------------------------- */
} /* buffer-reset | dithering */
/* ------------------------------------------------------------------- */
-
/* ============================================================= */
} else { /* npixel <= 0 -> initialisation */
/* ============================================================= */
-
/*
* check wether the number of components is valid
*/
diff --git a/gs/base/gdevsun.c b/gs/base/gdevsun.c
index fef535d3a..74047402f 100644
--- a/gs/base/gdevsun.c
+++ b/gs/base/gdevsun.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,37 +51,37 @@ dev_proc_draw_line(sun_draw_line);
/* The device descriptor */
static gx_device_procs sun_procs = {
- sun_open,
- NULL, /* get_initial_matrix */
- sun_sync,
- NULL, /* output_page */
- sun_close,
- sun_map_rgb_color,
- sun_map_color_rgb,
- sun_fill_rectangle,
- NULL, /* tile_rectangle */
- sun_copy_mono,
- sun_copy_color,
- sun_draw_line
+ sun_open,
+ NULL, /* get_initial_matrix */
+ sun_sync,
+ NULL, /* output_page */
+ sun_close,
+ sun_map_rgb_color,
+ sun_map_color_rgb,
+ sun_fill_rectangle,
+ NULL, /* tile_rectangle */
+ sun_copy_mono,
+ sun_copy_color,
+ sun_draw_line
};
#define CMSNAME "GHOSTVIEW" /* SunView colormap name */
/* Define the SunView device */
typedef struct gx_device_sun {
- gx_device_common;
- Frame frame;
- Canvas canvas;
- Pixwin *pw;
- struct mpr_data mpr;
- Pixrect pr;
- int truecolor; /* use truecolor mapping */
- int freecols; /* unallocated colors */
- byte *red, *green, *blue; /* colormap */
- char cmsname[sizeof(CMSNAME)+9];/* color map name */
+ gx_device_common;
+ Frame frame;
+ Canvas canvas;
+ Pixwin *pw;
+ struct mpr_data mpr;
+ Pixrect pr;
+ int truecolor; /* use truecolor mapping */
+ int freecols; /* unallocated colors */
+ byte *red, *green, *blue; /* colormap */
+ char cmsname[sizeof(CMSNAME)+9];/* color map name */
#if !arch_is_big_endian /* need to swap bits & bytes */
# define BUF_WIDTH_BYTES (((int)(8.5*DEFAULT_DPI)+15)/16*2)
- byte swap_buf[BUF_WIDTH_BYTES];
+ byte swap_buf[BUF_WIDTH_BYTES];
#endif
} gx_device_sun;
@@ -109,12 +109,12 @@ static byte reverse_bits[256] = {
/* The instance is public. */
gx_device_sun far_data gs_sunview_device = {
- std_device_std_body(gx_device_sun, &sun_procs, "sunview",
- (int)(PAPER_X*DEFAULT_DPI), (int)(PAPER_Y*DEFAULT_DPI), /* x and y extent */
- DEFAULT_DPI, DEFAULT_DPI /* x and y density */
- ), /* fill in color_info later from display depth */
- { 0 }, /* std_procs */
- 0, /* connection not initialized */
+ std_device_std_body(gx_device_sun, &sun_procs, "sunview",
+ (int)(PAPER_X*DEFAULT_DPI), (int)(PAPER_Y*DEFAULT_DPI), /* x and y extent */
+ DEFAULT_DPI, DEFAULT_DPI /* x and y density */
+ ), /* fill in color_info later from display depth */
+ { 0 }, /* std_procs */
+ 0, /* connection not initialized */
};
/* Macro for casting gx_device argument */
@@ -161,7 +161,7 @@ gx_device_sun far_data gs_sunview_device = {
#define BLUE_MASK ((1 << BLUE_BITS) - 1)
#define GREEN_MASK ((1 << (BLUE_BITS + GREEN_BITS)) - 1 - BLUE_MASK)
#define RED_MASK ((1 << (BLUE_BITS + GREEN_BITS + RED_BITS)) - 1 \
- - BLUE_MASK - GREEN_MASK)
+ - BLUE_MASK - GREEN_MASK)
/*
* number of colors on rgb dimensions
*/
@@ -175,12 +175,12 @@ gx_device_sun far_data gs_sunview_device = {
*/
#define ALL_COLS (1 << DEPTH) /* 256 */
#define CMS_SIZE ALL_COLS /* cut down to 64 or 128 for
- more cooperative behaviour */
+ more cooperative behaviour */
#if (RGB_COLS > CMS_SIZE) /* one is reserved for the scrollbar */
CMS_SIZE_too_small_for_color_cube
#endif
-#if (RGB_BITS < 0) || (RGB_BITS > DEPTH)
+#if (RGB_BITS < 0) || (RGB_BITS > DEPTH)
Display_does_not_support_this_many_colors
#endif
@@ -207,10 +207,10 @@ Display_does_not_support_this_many_colors
*/
#define TRUE_RED_MASK ((1 << TRUE_RED_BITS) - 1)
#define TRUE_GREEN_MASK ((1 << (TRUE_RED_BITS + TRUE_GREEN_BITS)) - 1 \
- - TRUE_RED_MASK)
+ - TRUE_RED_MASK)
#define TRUE_BLUE_MASK ((1 << (TRUE_RED_BITS + TRUE_GREEN_BITS \
- + TRUE_BLUE_BITS)) - 1 \
- - TRUE_GREEN_MASK - TRUE_RED_MASK)
+ + TRUE_BLUE_BITS)) - 1 \
+ - TRUE_GREEN_MASK - TRUE_RED_MASK)
/*
* number of colors on rgb dimensions
*/
@@ -225,351 +225,350 @@ sun_open(register gx_device *dev)
{
#ifdef gs_DEBUG
if ( gs_debug['X'] )
- { extern int _Xdebug;
- _Xdebug = 1;
- }
+ { extern int _Xdebug;
+ _Xdebug = 1;
+ }
#endif
- if (xdev->frame == (Frame)0)
- xdev->frame =
- window_create(NULL, FRAME, FRAME_LABEL, gs_product,
- WIN_WIDTH, min(xdev->width + 24, 900),
- WIN_HEIGHT, min(xdev->height + 36, 900),
- WIN_Y, 0,
- WIN_X, 200,
- 0);
- if (xdev->frame == (Frame)0)
- return -1;
- xdev->canvas = window_create(xdev->frame, CANVAS,
- CANVAS_AUTO_EXPAND, FALSE,
- CANVAS_AUTO_SHRINK, FALSE,
- CANVAS_WIDTH, xdev->width,
- CANVAS_HEIGHT, xdev->height,
+ if (xdev->frame == (Frame)0)
+ xdev->frame =
+ window_create(NULL, FRAME, FRAME_LABEL, gs_product,
+ WIN_WIDTH, min(xdev->width + 24, 900),
+ WIN_HEIGHT, min(xdev->height + 36, 900),
+ WIN_Y, 0,
+ WIN_X, 200,
+ 0);
+ if (xdev->frame == (Frame)0)
+ return -1;
+ xdev->canvas = window_create(xdev->frame, CANVAS,
+ CANVAS_AUTO_EXPAND, FALSE,
+ CANVAS_AUTO_SHRINK, FALSE,
+ CANVAS_WIDTH, xdev->width,
+ CANVAS_HEIGHT, xdev->height,
#ifndef PRE_IBIS /* try to use 24-bit visual if OS supports it */
- CANVAS_COLOR24, TRUE,
+ CANVAS_COLOR24, TRUE,
#endif
- CANVAS_RETAINED, FALSE,
- 0);
- xdev->pw = canvas_pixwin(xdev->canvas);
-
- switch (xdev->pw->pw_pixrect->pr_depth) {
- static gx_device_color_info mono_ci =
- dci_black_and_white;
- /*
- * If the pre-allocated color cube leaves room for spare entries,
- * tell gs we can render colors exactly. Otherwise admit our
- * limitations.
- */
- static gx_device_color_info color_ci =
+ CANVAS_RETAINED, FALSE,
+ 0);
+ xdev->pw = canvas_pixwin(xdev->canvas);
+
+ switch (xdev->pw->pw_pixrect->pr_depth) {
+ static gx_device_color_info mono_ci =
+ dci_black_and_white;
+ /*
+ * If the pre-allocated color cube leaves room for spare entries,
+ * tell gs we can render colors exactly. Otherwise admit our
+ * limitations.
+ */
+ static gx_device_color_info color_ci =
#if (RGB_COLS < CMS_SIZE)
- dci_color(DEPTH, 31, MAX_COLS);
+ dci_color(DEPTH, 31, MAX_COLS);
#else
- dci_color(DEPTH, MAX_COLS - 1, MAX_COLS);
+ dci_color(DEPTH, MAX_COLS - 1, MAX_COLS);
#endif
- static gx_device_color_info truecolor_ci =
- dci_color(TRUE_DEPTH,31,4);
- case 1:
- /* mono display */
- xdev->color_info = mono_ci;
- break;
+ static gx_device_color_info truecolor_ci =
+ dci_color(TRUE_DEPTH,31,4);
+ case 1:
+ /* mono display */
+ xdev->color_info = mono_ci;
+ break;
#ifndef FAKE_TRUE_COLOR
- case DEPTH:
- /* pseudo-color display */
- xdev->color_info = color_ci;
- xdev->truecolor = 0;
- break;
+ case DEPTH:
+ /* pseudo-color display */
+ xdev->color_info = color_ci;
+ xdev->truecolor = 0;
+ break;
#endif /* FAKE_TRUE_COLOR */
- case TRUE_DEPTH:
- case TRUE_DEPTH+8: /* I'm not sure whether the XBGR frame buffer
- returns depth 24 or 32. */
- /* pseudo-color display */
- xdev->color_info = truecolor_ci;
- xdev->truecolor = 1;
- break;
- default:
- emprintf1(dev->memory,
+ case TRUE_DEPTH:
+ case TRUE_DEPTH+8: /* I'm not sure whether the XBGR frame buffer
+ returns depth 24 or 32. */
+ /* pseudo-color display */
+ xdev->color_info = truecolor_ci;
+ xdev->truecolor = 1;
+ break;
+ default:
+ emprintf1(dev->memory,
"gs: Cannot handle display of depth %d.\n",
- xdev->pw->pw_pixrect->pr_depth);
- return -1;
- }
-
- if ( gx_device_has_color(xdev)
+ xdev->pw->pw_pixrect->pr_depth);
+ return -1;
+ }
+
+ if ( gx_device_has_color(xdev)
#ifndef FAKE_TRUE_COLOR
- && !xdev->truecolor
+ && !xdev->truecolor
#endif
- )
- {
- int j;
- int color;
-
- /*
- * Create the pre-allocated colorcube.
- */
- xdev->red = (byte *)malloc(CMS_SIZE);
- xdev->green = (byte *)malloc(CMS_SIZE);
- xdev->blue = (byte *)malloc(CMS_SIZE);
- if (!xdev->red || !xdev->green || !xdev->blue) {
- emprintf(dev->memory, "gs: no memory for colormap\n");
- return -1;
- }
+ )
+ {
+ int j;
+ int color;
+
+ /*
+ * Create the pre-allocated colorcube.
+ */
+ xdev->red = (byte *)malloc(CMS_SIZE);
+ xdev->green = (byte *)malloc(CMS_SIZE);
+ xdev->blue = (byte *)malloc(CMS_SIZE);
+ if (!xdev->red || !xdev->green || !xdev->blue) {
+ emprintf(dev->memory, "gs: no memory for colormap\n");
+ return -1;
+ }
#ifdef FAKE_TRUE_COLOR
- /*
- * Fit the largest possible color cube into the colormap.
- */
- for ( j = 0; j < ALL_COLS; j++ ) {
- xdev->blue[j] =
- (double)((j & TRUE_BLUE_MASK)
- >> (TRUE_GREEN_BITS + TRUE_RED_BITS))
- / (TRUE_BLUE_COLS - 1)
- * (ALL_COLS - 1);
- xdev->green[j] =
- (double)((j & TRUE_GREEN_MASK) >> TRUE_RED_BITS)
- / (TRUE_GREEN_COLS - 1)
- * (ALL_COLS - 1);
- xdev->red[j] =
- (double)((j & TRUE_RED_MASK))
- / (TRUE_RED_COLS - 1)
- * (ALL_COLS - 1);
- }
-
- xdev->freecols = 0;
+ /*
+ * Fit the largest possible color cube into the colormap.
+ */
+ for ( j = 0; j < ALL_COLS; j++ ) {
+ xdev->blue[j] =
+ (double)((j & TRUE_BLUE_MASK)
+ >> (TRUE_GREEN_BITS + TRUE_RED_BITS))
+ / (TRUE_BLUE_COLS - 1)
+ * (ALL_COLS - 1);
+ xdev->green[j] =
+ (double)((j & TRUE_GREEN_MASK) >> TRUE_RED_BITS)
+ / (TRUE_GREEN_COLS - 1)
+ * (ALL_COLS - 1);
+ xdev->red[j] =
+ (double)((j & TRUE_RED_MASK))
+ / (TRUE_RED_COLS - 1)
+ * (ALL_COLS - 1);
+ }
+
+ xdev->freecols = 0;
#else /* !FAKE_TRUE_COLOR */
- /*
- * Black and white are allocated in the last two slots,
- * so as to be compatible with the monochrome colormap.
- * This prevents most text etc. to go technicolor as focus
- * changes into the window.
- *
- * The requirement that these two entries be at the end
- * of the colormap makes it most convenient to allocate
- * the remmaining entries from back to the front as well.
- * Therefore xdev->freecols is the minimal allocated
- * color index, and decreases as new ones are allocated.
- */
- j = CMS_SIZE - 2;
- cms_monochromeload(xdev->red + j,
- xdev->green + j,
- xdev->blue + j);
-
- /*
- * The remaining slots down to CMS_SIZE - RGB_COLS are filled
- * with evenly spaced points from the colorcube.
- */
- for ( color = 1; color < RGB_COLS - 1; color++ ) {
- j--;
- xdev->red[j] =
- (double)((color & RED_MASK) >> (GREEN_BITS + BLUE_BITS))
- / (RED_COLS - 1)
- * (ALL_COLS - 1);
- xdev->green[j] =
- (double)((color & GREEN_MASK) >> BLUE_BITS)
- / (GREEN_COLS - 1)
- * (ALL_COLS - 1);
- xdev->blue[j] =
- (double)((color & BLUE_MASK))
- / (BLUE_COLS - 1)
- * (ALL_COLS - 1);
- }
-
-
- /*
- * Set the low-water mark to the beginning of the colorcube.
- */
- xdev->freecols = j;
-
- /*
- * The unused entries are filled so that the last entry is
- * always different from the 0th entry. This is a requirement
- * for SunWindows.
- */
- for (j-- ; j >= 0 ; j--) {
- xdev->red[j] = xdev->green[j] = xdev->blue[j] =
- ~xdev->red[CMS_SIZE - 1];
- }
+ /*
+ * Black and white are allocated in the last two slots,
+ * so as to be compatible with the monochrome colormap.
+ * This prevents most text etc. to go technicolor as focus
+ * changes into the window.
+ *
+ * The requirement that these two entries be at the end
+ * of the colormap makes it most convenient to allocate
+ * the remmaining entries from back to the front as well.
+ * Therefore xdev->freecols is the minimal allocated
+ * color index, and decreases as new ones are allocated.
+ */
+ j = CMS_SIZE - 2;
+ cms_monochromeload(xdev->red + j,
+ xdev->green + j,
+ xdev->blue + j);
+
+ /*
+ * The remaining slots down to CMS_SIZE - RGB_COLS are filled
+ * with evenly spaced points from the colorcube.
+ */
+ for ( color = 1; color < RGB_COLS - 1; color++ ) {
+ j--;
+ xdev->red[j] =
+ (double)((color & RED_MASK) >> (GREEN_BITS + BLUE_BITS))
+ / (RED_COLS - 1)
+ * (ALL_COLS - 1);
+ xdev->green[j] =
+ (double)((color & GREEN_MASK) >> BLUE_BITS)
+ / (GREEN_COLS - 1)
+ * (ALL_COLS - 1);
+ xdev->blue[j] =
+ (double)((color & BLUE_MASK))
+ / (BLUE_COLS - 1)
+ * (ALL_COLS - 1);
+ }
+
+ /*
+ * Set the low-water mark to the beginning of the colorcube.
+ */
+ xdev->freecols = j;
+
+ /*
+ * The unused entries are filled so that the last entry is
+ * always different from the 0th entry. This is a requirement
+ * for SunWindows.
+ */
+ for (j-- ; j >= 0 ; j--) {
+ xdev->red[j] = xdev->green[j] = xdev->blue[j] =
+ ~xdev->red[CMS_SIZE - 1];
+ }
#endif /* FAKE_TRUE_COLOR */
- /*
- * Install the colormap.
- */
- sprintf(xdev->cmsname, "%s-%d", CMSNAME, getpid());
- pw_setcmsname(xdev->pw, xdev->cmsname);
- pw_putcolormap(xdev->pw, 0, CMS_SIZE,
- xdev->red, xdev->green, xdev->blue);
- }
- else {
- xdev->freecols = 0;
- xdev->red = (byte *)0;
- xdev->green = (byte *)0;
- xdev->blue = (byte *)0;
- }
-
- /*
- * Reset to retained after colormap length is changed
- */
- window_set(xdev->canvas,
- CANVAS_RETAINED, TRUE,
- WIN_VERTICAL_SCROLLBAR, scrollbar_create(0),
- WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
- 0);
- window_set(xdev->frame, WIN_SHOW, TRUE, 0);
- /* Interpose a destroy function to keep the driver bookkeeping */
- /* machinery from getting confused if the user closes the window. */
- notify_interpose_destroy_func(xdev->frame, destroy_func);
- (void) notify_do_dispatch();
- (void) notify_dispatch();
- return 0;
+ /*
+ * Install the colormap.
+ */
+ sprintf(xdev->cmsname, "%s-%d", CMSNAME, getpid());
+ pw_setcmsname(xdev->pw, xdev->cmsname);
+ pw_putcolormap(xdev->pw, 0, CMS_SIZE,
+ xdev->red, xdev->green, xdev->blue);
+ }
+ else {
+ xdev->freecols = 0;
+ xdev->red = (byte *)0;
+ xdev->green = (byte *)0;
+ xdev->blue = (byte *)0;
+ }
+
+ /*
+ * Reset to retained after colormap length is changed
+ */
+ window_set(xdev->canvas,
+ CANVAS_RETAINED, TRUE,
+ WIN_VERTICAL_SCROLLBAR, scrollbar_create(0),
+ WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0),
+ 0);
+ window_set(xdev->frame, WIN_SHOW, TRUE, 0);
+ /* Interpose a destroy function to keep the driver bookkeeping */
+ /* machinery from getting confused if the user closes the window. */
+ notify_interpose_destroy_func(xdev->frame, destroy_func);
+ (void) notify_do_dispatch();
+ (void) notify_dispatch();
+ return 0;
}
/* Prevent the user from closing the window. */
static Notify_value
destroy_func(Frame frame, Destroy_status status)
{ if ( status == DESTROY_CHECKING )
- { notify_veto_destroy(frame);
- return (NOTIFY_DONE);
- }
- return (notify_next_destroy_func(frame, status));
+ { notify_veto_destroy(frame);
+ return (NOTIFY_DONE);
+ }
+ return (notify_next_destroy_func(frame, status));
}
/* Close the device. */
int
sun_close(gx_device *dev)
{ window_destroy(xdev->frame);
- xdev->frame = (Frame)0;
- xdev->canvas = (Canvas)0;
- xdev->pw = (Pixwin *)0;
- xdev->freecols = 0;
- if (xdev->red)
- free(xdev->red);
- if (xdev->green)
- free(xdev->green);
- if (xdev->blue)
- free(xdev->blue);
- return 0;
+ xdev->frame = (Frame)0;
+ xdev->canvas = (Canvas)0;
+ xdev->pw = (Pixwin *)0;
+ xdev->freecols = 0;
+ if (xdev->red)
+ free(xdev->red);
+ if (xdev->green)
+ free(xdev->green);
+ if (xdev->blue)
+ free(xdev->blue);
+ return 0;
}
/* Synchronize the display with the commands already given */
int
sun_sync(register gx_device *dev)
{ (void) notify_dispatch();
- return 0;
+ return 0;
}
/* Map RGB to color number -
- Look for existing entry in colormap, or create a new one, or
- give up if no free colormap entries (requesting dithering).
+ Look for existing entry in colormap, or create a new one, or
+ give up if no free colormap entries (requesting dithering).
*/
gx_color_index
sun_map_rgb_color(gx_device *dev, unsigned short red,
- unsigned short green, unsigned short blue)
+ unsigned short green, unsigned short blue)
{ if ( !xdev->frame || !gx_device_has_color(dev) )
- /*
- * Invert default color index to match mono display
- * pixel values (black = 1, white = 0).
- */
- return !gx_default_map_rgb_color(dev, red, green, blue);
- else if ( !xdev->truecolor ) {
- byte red_val, green_val, blue_val;
- int i;
- static int warn = 1;
-
- /*
- * Determine the RGB values at display resolution we
- * ideally would want this color to be mapped into.
- */
- red_val = (double)red/gx_max_color_value * (ALL_COLS - 1);
- green_val = (double)green/gx_max_color_value * (ALL_COLS - 1);
- blue_val = (double)blue/gx_max_color_value * (ALL_COLS - 1);
-
- /*
- * Look for an exact match among the colors already allocated.
- * This includes the pre-allocated default color cube.
- */
- for (i = CMS_SIZE - 1; i >= xdev->freecols; i--) {
- if (xdev->red[i] == red_val &&
- xdev->green[i] == green_val &&
- xdev->blue[i] == blue_val) {
- return i;
- }
- }
-
- /*
- * If we run out of space in the color map, let gs know.
- * It will call us again to request colors to do the
- * dithering, and hopefully request only RGB values that
- * match the colorcube entries. IF NOT, WE WILL LOOP
- * FOREVER!
- * NOTE: Leave the zero'th colormap entry alone lest the
- * scrollbar be colored.
- */
- if (xdev->freecols <= 1) {
- if (warn) {
- emprintf(dev->memory,
+ /*
+ * Invert default color index to match mono display
+ * pixel values (black = 1, white = 0).
+ */
+ return !gx_default_map_rgb_color(dev, red, green, blue);
+ else if ( !xdev->truecolor ) {
+ byte red_val, green_val, blue_val;
+ int i;
+ static int warn = 1;
+
+ /*
+ * Determine the RGB values at display resolution we
+ * ideally would want this color to be mapped into.
+ */
+ red_val = (double)red/gx_max_color_value * (ALL_COLS - 1);
+ green_val = (double)green/gx_max_color_value * (ALL_COLS - 1);
+ blue_val = (double)blue/gx_max_color_value * (ALL_COLS - 1);
+
+ /*
+ * Look for an exact match among the colors already allocated.
+ * This includes the pre-allocated default color cube.
+ */
+ for (i = CMS_SIZE - 1; i >= xdev->freecols; i--) {
+ if (xdev->red[i] == red_val &&
+ xdev->green[i] == green_val &&
+ xdev->blue[i] == blue_val) {
+ return i;
+ }
+ }
+
+ /*
+ * If we run out of space in the color map, let gs know.
+ * It will call us again to request colors to do the
+ * dithering, and hopefully request only RGB values that
+ * match the colorcube entries. IF NOT, WE WILL LOOP
+ * FOREVER!
+ * NOTE: Leave the zero'th colormap entry alone lest the
+ * scrollbar be colored.
+ */
+ if (xdev->freecols <= 1) {
+ if (warn) {
+ emprintf(dev->memory,
"gs: last spare color map entry allocated\n");
- warn = 0;
- }
- return gx_no_color_index;
- }
-
- /*
- * Allocate new color in map.
- */
- xdev->red[i] = red_val;
- xdev->green[i] = green_val;
- xdev->blue[i] = blue_val;
- pw_setcmsname(xdev->pw, xdev->cmsname);
- pw_putcolormap(xdev->pw, i, 1,
- &xdev->red[i], &xdev->green[i], &xdev->blue[i]);
-
- xdev->freecols = i;
- return i;
- }
- else { /* true color mapping --
- color index encodes all 3 RGB values */
- return ((blue >> (gx_color_value_bits - TRUE_BLUE_BITS))
- << (TRUE_GREEN_BITS + TRUE_RED_BITS)) |
- ((green >> (gx_color_value_bits - TRUE_GREEN_BITS))
- << TRUE_RED_BITS) |
- (red >> (gx_color_value_bits - TRUE_RED_BITS));
- }
+ warn = 0;
+ }
+ return gx_no_color_index;
+ }
+
+ /*
+ * Allocate new color in map.
+ */
+ xdev->red[i] = red_val;
+ xdev->green[i] = green_val;
+ xdev->blue[i] = blue_val;
+ pw_setcmsname(xdev->pw, xdev->cmsname);
+ pw_putcolormap(xdev->pw, i, 1,
+ &xdev->red[i], &xdev->green[i], &xdev->blue[i]);
+
+ xdev->freecols = i;
+ return i;
+ }
+ else { /* true color mapping --
+ color index encodes all 3 RGB values */
+ return ((blue >> (gx_color_value_bits - TRUE_BLUE_BITS))
+ << (TRUE_GREEN_BITS + TRUE_RED_BITS)) |
+ ((green >> (gx_color_value_bits - TRUE_GREEN_BITS))
+ << TRUE_RED_BITS) |
+ (red >> (gx_color_value_bits - TRUE_RED_BITS));
+ }
}
/* Map color number back to RGB values - see sun_map_rgb_color(), above */
int
sun_map_color_rgb(gx_device *dev, gx_color_index color,
- unsigned short rgb[3])
+ unsigned short rgb[3])
{ if ( !xdev->frame || !gx_device_has_color(dev) )
- return gx_default_map_color_rgb(dev, !color, rgb);
- else if ( !xdev->truecolor ) {
- /*
- * We just use the colormap to map back to rgb values.
- */
- if (color < xdev->freecols || color >= CMS_SIZE) {
- emprintf1(dev->memory,
+ return gx_default_map_color_rgb(dev, !color, rgb);
+ else if ( !xdev->truecolor ) {
+ /*
+ * We just use the colormap to map back to rgb values.
+ */
+ if (color < xdev->freecols || color >= CMS_SIZE) {
+ emprintf1(dev->memory,
"gs: attempt to get RGB values for unallocated color index %d\n",
(int)color);
- return -1;
- }
- rgb[0] = (double)xdev->red[color] / (ALL_COLS - 1)
- * gx_max_color_value;
- rgb[1] = (double)xdev->green[color] / (ALL_COLS - 1)
- * gx_max_color_value;
- rgb[2] = (double)xdev->blue[color] / (ALL_COLS - 1)
- * gx_max_color_value;
- return 0;
- }
- else { /* true color mapping */
- rgb[0] = (double)((unsigned short)(color & TRUE_RED_MASK))
- / (TRUE_RED_COLS - 1)
- * gx_max_color_value;
- rgb[1] = (double)((unsigned short)(color & TRUE_GREEN_MASK)
- >> TRUE_RED_BITS)
- / (TRUE_GREEN_COLS - 1)
- * gx_max_color_value;
- rgb[2] = (double)((unsigned short)(color & TRUE_BLUE_MASK)
- >> (TRUE_GREEN_BITS + TRUE_RED_BITS))
- / (TRUE_BLUE_COLS - 1)
- * gx_max_color_value;
- return 0;
- }
+ return -1;
+ }
+ rgb[0] = (double)xdev->red[color] / (ALL_COLS - 1)
+ * gx_max_color_value;
+ rgb[1] = (double)xdev->green[color] / (ALL_COLS - 1)
+ * gx_max_color_value;
+ rgb[2] = (double)xdev->blue[color] / (ALL_COLS - 1)
+ * gx_max_color_value;
+ return 0;
+ }
+ else { /* true color mapping */
+ rgb[0] = (double)((unsigned short)(color & TRUE_RED_MASK))
+ / (TRUE_RED_COLS - 1)
+ * gx_max_color_value;
+ rgb[1] = (double)((unsigned short)(color & TRUE_GREEN_MASK)
+ >> TRUE_RED_BITS)
+ / (TRUE_GREEN_COLS - 1)
+ * gx_max_color_value;
+ rgb[2] = (double)((unsigned short)(color & TRUE_BLUE_MASK)
+ >> (TRUE_GREEN_BITS + TRUE_RED_BITS))
+ / (TRUE_BLUE_COLS - 1)
+ * gx_max_color_value;
+ return 0;
+ }
}
/* Fill a rectangle with a color. */
@@ -578,10 +577,10 @@ sun_fill_rectangle(register gx_device *dev,
int x, int y, int w, int h, gx_color_index color)
{ fit_fill(dev, x, y, w, h);
- pw_write(xdev->pw, x, y, w, h, PIX_SRC | PIX_COLOR((int)(color)),
- (Pixrect *)0, 0, 0);
- (void) notify_dispatch();
- return 0;
+ pw_write(xdev->pw, x, y, w, h, PIX_SRC | PIX_COLOR((int)(color)),
+ (Pixrect *)0, 0, 0);
+ (void) notify_dispatch();
+ return 0;
}
/* Copy a monochrome bitmap. */
@@ -595,54 +594,54 @@ sun_copy_mono(register gx_device *dev,
/* Yes, this is a bad and wicked thing to do! */
#define non_const_base ((byte *)base)
- register int i;
- int nbytes;
- extern struct pixrectops mem_ops;
+ register int i;
+ int nbytes;
+ extern struct pixrectops mem_ops;
#if !arch_is_big_endian /* need to swap bits & bytes */
# define BUF_WIDTH_BYTES (((int)(8.5*DEFAULT_DPI)+15)/16*2)
- byte swap_buf[BUF_WIDTH_BYTES];
+ byte swap_buf[BUF_WIDTH_BYTES];
#endif
- fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
- nbytes = h * raster;
+ fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
+ nbytes = h * raster;
- xdev->pr.pr_ops = &mem_ops;
- xdev->pr.pr_width = w + sourcex + 8;
- xdev->pr.pr_height = h;
- xdev->pr.pr_depth = 1;
- xdev->pr.pr_data = (caddr_t)&(xdev->mpr);
- xdev->mpr.md_linebytes = raster;
- xdev->mpr.md_image = (short *)((ulong)base & ~1);
+ xdev->pr.pr_ops = &mem_ops;
+ xdev->pr.pr_width = w + sourcex + 8;
+ xdev->pr.pr_height = h;
+ xdev->pr.pr_depth = 1;
+ xdev->pr.pr_data = (caddr_t)&(xdev->mpr);
+ xdev->mpr.md_linebytes = raster;
+ xdev->mpr.md_image = (short *)((ulong)base & ~1);
#if !arch_is_big_endian
- /* Reverse the bit order in each byte. */
- for ( i = 0; i < nbytes; i++ )
- non_const_base[i] = reverse_bits[base[i]];
+ /* Reverse the bit order in each byte. */
+ for ( i = 0; i < nbytes; i++ )
+ non_const_base[i] = reverse_bits[base[i]];
#endif
- pw_batch_on(xdev->pw);
- if (one != gx_no_color_index)
- { pw_stencil(xdev->pw, x, y, w, h,
- PIX_SRC | PIX_COLOR(one), &(xdev->pr),
- ((int)base & 1) ? sourcex + 8 : sourcex, 0,
- (Pixrect *)0, 0, 0);
- }
- if (zero != gx_no_color_index)
- { for (i = 0; i < nbytes; i++)
- non_const_base[i] = ~base[i];
- pw_stencil(xdev->pw, x, y, w, h,
- PIX_SRC | PIX_COLOR(zero), &(xdev->pr),
- ((int)base & 1) ? sourcex + 8 : sourcex, 0,
- (Pixrect *)0, 0, 0);
- for (i = 0; i < nbytes; i++)
- non_const_base[i] = ~base[i];
- }
- pw_batch_off(xdev->pw);
+ pw_batch_on(xdev->pw);
+ if (one != gx_no_color_index)
+ { pw_stencil(xdev->pw, x, y, w, h,
+ PIX_SRC | PIX_COLOR(one), &(xdev->pr),
+ ((int)base & 1) ? sourcex + 8 : sourcex, 0,
+ (Pixrect *)0, 0, 0);
+ }
+ if (zero != gx_no_color_index)
+ { for (i = 0; i < nbytes; i++)
+ non_const_base[i] = ~base[i];
+ pw_stencil(xdev->pw, x, y, w, h,
+ PIX_SRC | PIX_COLOR(zero), &(xdev->pr),
+ ((int)base & 1) ? sourcex + 8 : sourcex, 0,
+ (Pixrect *)0, 0, 0);
+ for (i = 0; i < nbytes; i++)
+ non_const_base[i] = ~base[i];
+ }
+ pw_batch_off(xdev->pw);
#if !arch_is_big_endian
- /* Reverse the bits back again. */
- for ( i = 0; i < nbytes; i++ )
- non_const_base[i] = reverse_bits[base[i]];
+ /* Reverse the bits back again. */
+ for ( i = 0; i < nbytes; i++ )
+ non_const_base[i] = reverse_bits[base[i]];
#endif
- (void) notify_dispatch();
- return 0;
+ (void) notify_dispatch();
+ return 0;
}
/* Copy a color bitmap. */
@@ -651,27 +650,27 @@ sun_copy_color(register gx_device *dev,
const byte *base, int sourcex, int raster, gx_bitmap_id id,
int x, int y, int w, int h)
{
- extern struct pixrectops mem_ops;
-
- if ( !gx_device_has_color(dev) )
- return sun_copy_mono(dev, base, sourcex, raster, id,
- x, y, w, h,
- (gx_color_index)0, (gx_color_index)1);
-
- fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
-
- xdev->pr.pr_ops = &mem_ops;
- xdev->pr.pr_width = w + sourcex + 8;
- xdev->pr.pr_height = h;
- xdev->pr.pr_depth = 8;
- xdev->pr.pr_data = (caddr_t)&(xdev->mpr);
- xdev->mpr.md_linebytes = raster;
- xdev->mpr.md_image = (short *)((ulong)base & ~1);
- pw_write(xdev->pw, x, y, w, h,
- PIX_SRC, &(xdev->pr),
- (((int)base & 1) ? sourcex + 8 : sourcex), 0);
- (void) notify_dispatch();
- return 0;
+ extern struct pixrectops mem_ops;
+
+ if ( !gx_device_has_color(dev) )
+ return sun_copy_mono(dev, base, sourcex, raster, id,
+ x, y, w, h,
+ (gx_color_index)0, (gx_color_index)1);
+
+ fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
+
+ xdev->pr.pr_ops = &mem_ops;
+ xdev->pr.pr_width = w + sourcex + 8;
+ xdev->pr.pr_height = h;
+ xdev->pr.pr_depth = 8;
+ xdev->pr.pr_data = (caddr_t)&(xdev->mpr);
+ xdev->mpr.md_linebytes = raster;
+ xdev->mpr.md_image = (short *)((ulong)base & ~1);
+ pw_write(xdev->pw, x, y, w, h,
+ PIX_SRC, &(xdev->pr),
+ (((int)base & 1) ? sourcex + 8 : sourcex), 0);
+ (void) notify_dispatch();
+ return 0;
}
/* Draw a line */
@@ -679,6 +678,6 @@ int
sun_draw_line(register gx_device *dev,
int x0, int y0, int x1, int y1, gx_color_index color)
{ pw_vector(xdev->pw, x0, y0, x1, y1, PIX_SRC, color);
- (void) notify_dispatch();
- return 0;
+ (void) notify_dispatch();
+ return 0;
}
diff --git a/gs/base/gdevsunr.c b/gs/base/gdevsunr.c
index 96a9421cb..0bdca6eb1 100644
--- a/gs/base/gdevsunr.c
+++ b/gs/base/gdevsunr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,14 +24,14 @@
#define RT_STANDARD 1 /* Raw pixrect image in 68000 byte order */
#define RMT_NONE 0 /* ras_maplength is expected to be 0 */
typedef struct sun_rasterfile_s {
- int ras_magic; /* magic number */
- int ras_width; /* width (pixels) of image */
- int ras_height; /* height (pixels) of image */
- int ras_depth; /* depth (1, 8, or 24 bits) of pixel */
- int ras_length; /* length (bytes) of image */
- int ras_type; /* type of file; see RT_* below */
- int ras_maptype; /* type of colormap; see RMT_* below */
- int ras_maplength; /* length (bytes) of following map */
+ int ras_magic; /* magic number */
+ int ras_width; /* width (pixels) of image */
+ int ras_height; /* height (pixels) of image */
+ int ras_depth; /* depth (1, 8, or 24 bits) of pixel */
+ int ras_length; /* length (bytes) of image */
+ int ras_type; /* type of file; see RT_* below */
+ int ras_maptype; /* type of colormap; see RMT_* below */
+ int ras_maplength; /* length (bytes) of following map */
} sun_rasterfile_t;
#ifndef X_DPI
@@ -45,10 +45,10 @@ static dev_proc_print_page(sunhmono_print_page);
const gx_device_printer gs_sunhmono_device =
prn_device(prn_std_procs, "sunhmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, sunhmono_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, sunhmono_print_page);
static int
sunhmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
@@ -68,8 +68,8 @@ sunhmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
*/
lineStorage = gs_malloc(pdev->memory, gsLineBytes, 1, "rasterfile_print_page(in)");
if (lineStorage == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
/* Setup values in header */
ras.ras_magic = RAS_MAGIC;
@@ -84,10 +84,10 @@ sunhmono_print_page(gx_device_printer * pdev, FILE * prn_stream)
fwrite(&ras, 1, sizeof(ras), prn_stream);
/* For each raster line */
for (lineCnt = 0; lineCnt < pdev->height; ++lineCnt) {
- gdev_prn_get_bits(pdev, lineCnt, lineStorage, &data);
- fwrite(data, 1, gsLineBytes, prn_stream);
- if (gsLineBytes % 2)
- fputc(0, prn_stream); /* pad to even # of bytes with a 0 */
+ gdev_prn_get_bits(pdev, lineCnt, lineStorage, &data);
+ fwrite(data, 1, gsLineBytes, prn_stream);
+ if (gsLineBytes % 2)
+ fputc(0, prn_stream); /* pad to even # of bytes with a 0 */
}
/* The weird file terminator */
fwrite("};\n", 1, 3, prn_stream);
diff --git a/gs/base/gdevsvg.c b/gs/base/gdevsvg.c
index a6b29013a..027720d79 100644
--- a/gs/base/gdevsvg.c
+++ b/gs/base/gdevsvg.c
@@ -64,12 +64,12 @@ typedef struct gx_device_svg_s {
#define svg_device_body(dname, depth)\
std_device_dci_type_body(gx_device_svg, 0, dname, &st_device_svg, \
- DEFAULT_WIDTH_10THS * X_DPI / 10, \
- DEFAULT_HEIGHT_10THS * Y_DPI / 10, \
- X_DPI, Y_DPI, \
- (depth > 8 ? 3 : 1), depth, \
- (depth > 1 ? 255 : 1), (depth > 8 ? 255 : 0), \
- (depth > 1 ? 256 : 2), (depth > 8 ? 256 : 1))
+ DEFAULT_WIDTH_10THS * X_DPI / 10, \
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10, \
+ X_DPI, Y_DPI, \
+ (depth > 8 ? 3 : 1), depth, \
+ (depth > 1 ? 255 : 1), (depth > 8 ? 255 : 0), \
+ (depth > 1 ? 256 : 2), (depth > 8 ? 256 : 1))
static dev_proc_open_device(svg_open_device);
static dev_proc_output_page(svg_output_page);
@@ -80,7 +80,7 @@ static dev_proc_put_params(svg_put_params);
#define svg_device_procs \
{ \
- svg_open_device, \
+ svg_open_device, \
NULL, /* get_initial_matrix */\
NULL, /* sync_output */\
svg_output_page,\
@@ -121,10 +121,10 @@ static dev_proc_put_params(svg_put_params);
gs_public_st_suffix_string2_final(st_device_svg, gx_device_svg,
"gx_device_svg",
device_svg_enum_ptrs,
- device_svg_reloc_ptrs,
+ device_svg_reloc_ptrs,
gx_device_finalize,
- st_device_vector,
- strokecolor, fillcolor);
+ st_device_vector,
+ strokecolor, fillcolor);
/* The output device is named 'svg' but we're referred to as the
'svgwrite' device by the build system to avoid conflicts with
@@ -148,40 +148,40 @@ static int
svg_setmiterlimit(gx_device_vector *vdev, floatp limit);
static int
svg_setdash(gx_device_vector *vdev, const float *pattern,
- uint count, floatp offset);
+ uint count, floatp offset);
static int
svg_setlogop(gx_device_vector *vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff);
+ gs_logical_operation_t diff);
static int
svg_can_handle_hl_color(gx_device_vector *vdev, const gs_imager_state *pis,
- const gx_drawing_color * pdc);
+ const gx_drawing_color * pdc);
static int
svg_setfillcolor(gx_device_vector *vdev, const gs_imager_state *pis,
const gx_drawing_color *pdc);
static int
svg_setstrokecolor(gx_device_vector *vdev, const gs_imager_state *pis,
- const gx_drawing_color *pdc);
+ const gx_drawing_color *pdc);
static int
svg_dorect(gx_device_vector *vdev, fixed x0, fixed y0,
- fixed x1, fixed y1, gx_path_type_t type);
+ fixed x1, fixed y1, gx_path_type_t type);
static int
svg_beginpath(gx_device_vector *vdev, gx_path_type_t type);
static int
svg_moveto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
static int
svg_lineto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
static int
svg_curveto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type);
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type);
static int
svg_closepath(gx_device_vector *vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type);
+ floatp x_start, floatp y_start, gx_path_type_t type);
static int
svg_endpath(gx_device_vector *vdev, gx_path_type_t type);
@@ -216,7 +216,7 @@ static const gx_device_vector_procs svg_vector_procs = {
/* local utility prototypes */
static int svg_write_bytes(gx_device_svg *svg,
- const char *string, uint length);
+ const char *string, uint length);
static int svg_write(gx_device_svg *svg, const char *string);
static int svg_write_header(gx_device_svg *svg);
@@ -235,7 +235,7 @@ svg_open_device(gx_device *dev)
vdev->vec_procs = &svg_vector_procs;
gdev_vector_init(vdev);
code = gdev_vector_open_file_options(vdev, 512,
- VECTOR_OPEN_FILE_SEQUENTIAL);
+ VECTOR_OPEN_FILE_SEQUENTIAL);
if (code < 0)
return gs_rethrow_code(code);
@@ -288,9 +288,9 @@ svg_close_device(gx_device *dev)
}
if (svg->fillcolor) gs_free_string(svg->memory,
- (byte *)svg->fillcolor, 8, "svg_close_device");
+ (byte *)svg->fillcolor, 8, "svg_close_device");
if (svg->strokecolor) gs_free_string(svg->memory,
- (byte *)svg->strokecolor, 8, "svg_close_device");
+ (byte *)svg->strokecolor, 8, "svg_close_device");
if (ferror(svg->file))
return gs_throw_code(gs_error_ioerror);
@@ -378,17 +378,17 @@ svg_write_header(gx_device_svg *svg)
/* svg_write(svg, line); */
sputs(s, (byte *)line, strlen(line), &used);
sprintf(line, "<svg xmlns='%s' version='%s'",
- SVG_XMLNS, SVG_VERSION);
+ SVG_XMLNS, SVG_VERSION);
/* svg_write(svg, line); */
sputs(s, (byte *)line, strlen(line), &used);
sprintf(line, "\n\twidth='%dpt' height='%dpt'>\n",
- (int)svg->MediaSize[0], (int)svg->MediaSize[1]);
+ (int)svg->MediaSize[0], (int)svg->MediaSize[1]);
sputs(s, (byte *)line, strlen(line), &used);
/* Scale drawing so our coordinates are in pixels */
sprintf(line, "<g transform='scale(%lf,%lf)'>\n",
- 72.0 / svg->HWResolution[0],
- 72.0 / svg->HWResolution[1]);
+ 72.0 / svg->HWResolution[0],
+ 72.0 / svg->HWResolution[1]);
/* svg_write(svg, line); */
sputs(s, (byte *)line, strlen(line), &used);
svg->mark++;
@@ -441,13 +441,13 @@ svg_write_state(gx_device_svg *svg)
svg_write(svg, "<g ");
if (svg->strokecolor) {
sprintf(line, " stroke='%s'", svg->strokecolor);
- svg_write(svg, line);
+ svg_write(svg, line);
} else {
- svg_write(svg, " stroke='none'");
+ svg_write(svg, " stroke='none'");
}
if (svg->fillcolor) {
- sprintf(line, " fill='%s'", svg->fillcolor);
- svg_write(svg, line);
+ sprintf(line, " fill='%s'", svg->fillcolor);
+ svg_write(svg, line);
} else {
svg_write(svg, " fill='none'");
}
@@ -456,38 +456,38 @@ svg_write_state(gx_device_svg *svg)
svg_write(svg, line);
}
if (svg->linecap != SVG_DEFAULT_LINECAP) {
- switch (svg->linecap) {
- case gs_cap_round:
- svg_write(svg, " stroke-linecap='round'");
- break;
- case gs_cap_square:
- svg_write(svg, " stroke-linecap='square'");
- break;
- case gs_cap_butt:
- default:
- /* treat all the other options as the default */
- svg_write(svg, " stroke-linecap='butt'");
- break;
- }
+ switch (svg->linecap) {
+ case gs_cap_round:
+ svg_write(svg, " stroke-linecap='round'");
+ break;
+ case gs_cap_square:
+ svg_write(svg, " stroke-linecap='square'");
+ break;
+ case gs_cap_butt:
+ default:
+ /* treat all the other options as the default */
+ svg_write(svg, " stroke-linecap='butt'");
+ break;
+ }
}
if (svg->linejoin != SVG_DEFAULT_LINEJOIN) {
- switch (svg->linejoin) {
- case gs_join_round:
- svg_write(svg, " stroke-linejoin='round'");
- break;
- case gs_join_bevel:
- svg_write(svg, " stroke-linejoin='bevel'");
- break;
- case gs_join_miter:
- default:
- /* SVG doesn't support any other variants */
- svg_write(svg, " stroke-linejoin='miter'");
- break;
- }
+ switch (svg->linejoin) {
+ case gs_join_round:
+ svg_write(svg, " stroke-linejoin='round'");
+ break;
+ case gs_join_bevel:
+ svg_write(svg, " stroke-linejoin='bevel'");
+ break;
+ case gs_join_miter:
+ default:
+ /* SVG doesn't support any other variants */
+ svg_write(svg, " stroke-linejoin='miter'");
+ break;
+ }
}
if (svg->miterlimit != SVG_DEFAULT_MITERLIMIT) {
- sprintf(line, " stroke-miterlimit='%lf'", svg->miterlimit);
- svg_write(svg, line);
+ sprintf(line, " stroke-miterlimit='%lf'", svg->miterlimit);
+ svg_write(svg, line);
}
svg_write(svg, ">\n");
svg->mark++;
@@ -528,10 +528,10 @@ svg_setlinecap(gx_device_vector *vdev, gs_line_cap cap)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
const char *linecap_names[] = {"butt", "round", "square",
- "triangle", "unknown"};
+ "triangle", "unknown"};
if (cap < 0 || cap > gs_cap_unknown)
- return gs_throw_code(gs_error_rangecheck);
+ return gs_throw_code(gs_error_rangecheck);
dprintf1("svg_setlinecap(%s)\n", linecap_names[cap]);
svg->linecap = cap;
@@ -544,10 +544,10 @@ svg_setlinejoin(gx_device_vector *vdev, gs_line_join join)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
const char *linejoin_names[] = {"miter", "round", "bevel",
- "none", "triangle", "unknown"};
+ "none", "triangle", "unknown"};
if (join < 0 || join > gs_join_unknown)
- return gs_throw_code(gs_error_rangecheck);
+ return gs_throw_code(gs_error_rangecheck);
dprintf1("svg_setlinejoin(%s)\n", linejoin_names[join]);
svg->linejoin = join;
@@ -563,17 +563,17 @@ svg_setmiterlimit(gx_device_vector *vdev, floatp limit)
}
static int
svg_setdash(gx_device_vector *vdev, const float *pattern,
- uint count, floatp offset)
+ uint count, floatp offset)
{
dprintf("svg_setdash\n");
return 0;
}
static int
svg_setlogop(gx_device_vector *vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff)
+ gs_logical_operation_t diff)
{
dprintf2("svg_setlogop(%u,%u) set logical operation\n",
- lop, diff);
+ lop, diff);
/* SVG can fake some simpler modes, but we ignore this for now. */
return 0;
}
@@ -582,7 +582,7 @@ svg_setlogop(gx_device_vector *vdev, gs_logical_operation_t lop,
static int
svg_can_handle_hl_color(gx_device_vector *vdev, const gs_imager_state *pis,
- const gx_drawing_color * pdc)
+ const gx_drawing_color * pdc)
{
dprintf("svg_can_handle_hl_color\n");
return 0;
@@ -590,7 +590,7 @@ svg_can_handle_hl_color(gx_device_vector *vdev, const gs_imager_state *pis,
static int
svg_setfillcolor(gx_device_vector *vdev, const gs_imager_state *pis,
- const gx_drawing_color *pdc)
+ const gx_drawing_color *pdc)
{
gx_device_svg *svg = (gx_device_svg*)vdev;
char *fill;
@@ -605,8 +605,8 @@ svg_setfillcolor(gx_device_vector *vdev, const gs_imager_state *pis,
/* update our state with the new color */
if (svg->fillcolor)
- gs_free_string(svg->memory, (byte *)svg->fillcolor, 8,
- "svg_setfillcolor");
+ gs_free_string(svg->memory, (byte *)svg->fillcolor, 8,
+ "svg_setfillcolor");
svg->fillcolor = fill;
/* request a new group element */
svg->dirty++;
@@ -616,7 +616,7 @@ svg_setfillcolor(gx_device_vector *vdev, const gs_imager_state *pis,
static int
svg_setstrokecolor(gx_device_vector *vdev, const gs_imager_state *pis,
- const gx_drawing_color *pdc)
+ const gx_drawing_color *pdc)
{
gx_device_svg *svg = (gx_device_svg*)vdev;
char *stroke;
@@ -631,8 +631,8 @@ svg_setstrokecolor(gx_device_vector *vdev, const gs_imager_state *pis,
/* update our state with the new color */
if (svg->strokecolor)
- gs_free_string(svg->memory, (byte *)svg->strokecolor, 8,
- "svg_setstrokecolor");
+ gs_free_string(svg->memory, (byte *)svg->strokecolor, 8,
+ "svg_setstrokecolor");
svg->strokecolor = stroke;
/* request a new group element */
svg->dirty++;
@@ -640,25 +640,25 @@ svg_setstrokecolor(gx_device_vector *vdev, const gs_imager_state *pis,
return 0;
}
- /* Paths */
+ /* Paths */
/* gdev_vector_dopath */
static int svg_print_path_type(gx_device_svg *svg, gx_path_type_t type)
{
const char *path_type_names[] = {"winding number", "fill", "stroke",
- "fill and stroke", "clip"};
+ "fill and stroke", "clip"};
if (type <= 4)
- dprintf2("type %d (%s)", type, path_type_names[type]);
+ dprintf2("type %d (%s)", type, path_type_names[type]);
else
- dprintf1("type %d", type);
+ dprintf1("type %d", type);
return 0;
}
static int
svg_dorect(gx_device_vector *vdev, fixed x0, fixed y0,
- fixed x1, fixed y1, gx_path_type_t type)
+ fixed x1, fixed y1, gx_path_type_t type)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
char line[300];
@@ -674,23 +674,23 @@ svg_dorect(gx_device_vector *vdev, fixed x0, fixed y0,
svg_write_state(svg);
if (type & gx_path_type_clip) {
- svg_write(svg, "<clipPath>\n");
+ svg_write(svg, "<clipPath>\n");
}
sprintf(line, "<rect x='%lf' y='%lf' width='%lf' height='%lf'",
- fixed2float(x0), fixed2float(y0),
- fixed2float(x1 - x0), fixed2float(y1 - y0));
+ fixed2float(x0), fixed2float(y0),
+ fixed2float(x1 - x0), fixed2float(y1 - y0));
svg_write(svg, line);
/* override the inherited stroke attribute if we're not stroking */
if (!(type & gx_path_type_stroke) && svg->strokecolor)
- svg_write(svg, " stroke='none'");
+ svg_write(svg, " stroke='none'");
/* override the inherited fill attribute if we're not filling */
if (!(type & gx_path_type_fill) && svg->fillcolor)
- svg_write(svg, " fill='none'");
+ svg_write(svg, " fill='none'");
svg_write(svg, "/>\n");
if (type & gx_path_type_clip) {
- svg_write(svg, "</clipPath>\n");
+ svg_write(svg, "</clipPath>\n");
}
return 0;
@@ -721,7 +721,7 @@ svg_beginpath(gx_device_vector *vdev, gx_path_type_t type)
static int
svg_moveto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type)
+ floatp x, floatp y, gx_path_type_t type)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
char line[SVG_LINESIZE];
@@ -746,7 +746,7 @@ svg_moveto(gx_device_vector *vdev, floatp x0, floatp y0,
static int
svg_lineto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type)
+ floatp x, floatp y, gx_path_type_t type)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
char line[SVG_LINESIZE];
@@ -771,8 +771,8 @@ svg_lineto(gx_device_vector *vdev, floatp x0, floatp y0,
static int
svg_curveto(gx_device_vector *vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
char line[SVG_LINESIZE];
@@ -786,7 +786,7 @@ svg_curveto(gx_device_vector *vdev, floatp x0, floatp y0,
return 0;
dprintf8("svg_curveto(%lf,%lf, %lf,%lf, %lf,%lf, %lf,%lf) ",
- x0,y0, x1,y1, x2,y2, x3,y3);
+ x0,y0, x1,y1, x2,y2, x3,y3);
svg_print_path_type(svg, type);
dprintf("\n");
@@ -798,7 +798,7 @@ svg_curveto(gx_device_vector *vdev, floatp x0, floatp y0,
static int
svg_closepath(gx_device_vector *vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
gx_device_svg *svg = (gx_device_svg *)vdev;
@@ -851,4 +851,3 @@ svg_endpath(gx_device_vector *vdev, gx_path_type_t type)
return 0;
}
-
diff --git a/gs/base/gdevsvga.c b/gs/base/gdevsvga.c
index a18523291..3e6deac22 100644
--- a/gs/base/gdevsvga.c
+++ b/gs/base/gdevsvga.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,16 +40,16 @@ static dc_entry dynamic_colors[dc_hash_size + 1];
/* Procedure records */
#define svga_procs(open) {\
- open, NULL /*get_initial_matrix*/,\
- NULL /*sync_output*/, NULL /*output_page*/, svga_close,\
- svga_map_rgb_color, svga_map_color_rgb,\
- svga_fill_rectangle, NULL /*tile_rectangle*/,\
- svga_copy_mono, svga_copy_color, NULL /*draw_line*/,\
- svga_get_bits, NULL /*get_params*/, svga_put_params,\
- NULL /*map_cmyk_color*/, NULL /*get_xfont_procs*/,\
- NULL /*get_xfont_device*/, NULL /*map_rgb_alpha_color*/,\
- gx_page_device_get_page_device, NULL /*get_alpha_bits*/,\
- svga_copy_alpha\
+ open, NULL /*get_initial_matrix*/,\
+ NULL /*sync_output*/, NULL /*output_page*/, svga_close,\
+ svga_map_rgb_color, svga_map_color_rgb,\
+ svga_fill_rectangle, NULL /*tile_rectangle*/,\
+ svga_copy_mono, svga_copy_color, NULL /*draw_line*/,\
+ svga_get_bits, NULL /*get_params*/, svga_put_params,\
+ NULL /*map_cmyk_color*/, NULL /*get_xfont_procs*/,\
+ NULL /*get_xfont_device*/, NULL /*map_rgb_alpha_color*/,\
+ gx_page_device_get_page_device, NULL /*get_alpha_bits*/,\
+ svga_copy_alpha\
}
/* Save the controller mode */
@@ -64,10 +64,10 @@ static int svga_save_mode = -1;
/* We know that y is within bounds. */
#define set_pixel_ptr(ptr, fbdev, x, y, wnum)\
{ ulong index = (ulong)(y) * fbdev->raster + (uint)(x);\
- if ( (uint)(index >> 16) != fbdev->current_page )\
- { (*fbdev->set_page)(fbdev, (fbdev->current_page = index >> 16), wnum);\
- }\
- ptr = (fb_ptr)MK_PTR(regen, (ushort)index);\
+ if ( (uint)(index >> 16) != fbdev->current_page )\
+ { (*fbdev->set_page)(fbdev, (fbdev->current_page = index >> 16), wnum);\
+ }\
+ ptr = (fb_ptr)MK_PTR(regen, (ushort)index);\
}
#define set_pixel_write_ptr(ptr, fbdev, x, y)\
set_pixel_ptr(ptr, fbdev, x, y, fbdev->wnum_write)
@@ -81,15 +81,15 @@ int
svga_find_mode(gx_device * dev, const mode_info * mip)
{
for (;; mip++) {
- if (mip->width >= fb_dev->width &&
- mip->height >= fb_dev->height ||
- mip[1].mode < 0
- ) {
- fb_dev->mode = mip;
- gx_device_adjust_resolution(dev, mip->width, mip->height, 1);
- fb_dev->raster = fb_dev->width;
- return 0;
- }
+ if (mip->width >= fb_dev->width &&
+ mip->height >= fb_dev->height ||
+ mip[1].mode < 0
+ ) {
+ fb_dev->mode = mip;
+ gx_device_adjust_resolution(dev, mip->width, mip->height, 1);
+ fb_dev->raster = fb_dev->width;
+ return 0;
+ }
}
return_error(gs_error_rangecheck);
}
@@ -110,11 +110,11 @@ void
svga_init_colors(gx_device * dev)
{
if (fb_dev->fixed_colors)
- next_dc_index = num_colors;
+ next_dc_index = num_colors;
else {
- memset(dynamic_colors, 0,
- (dc_hash_size + 1) * sizeof(dc_entry));
- next_dc_index = first_dc_index;
+ memset(dynamic_colors, 0,
+ (dc_hash_size + 1) * sizeof(dc_entry));
+ next_dc_index = first_dc_index;
}
}
@@ -126,20 +126,20 @@ svga_load_colors(gx_device * dev)
svga_dac_set_write_index(0);
if (fb_dev->fixed_colors)
- for (ci = 0; ci < num_colors; ci++) {
- gx_color_value rgb[3];
+ for (ci = 0; ci < num_colors; ci++) {
+ gx_color_value rgb[3];
- pc_8bit_map_color_rgb(dev, (gx_color_index) ci, rgb);
- svga_dac_write(cv_bits(rgb[0], 6), cv_bits(rgb[1], 6),
- cv_bits(rgb[2], 6));
+ pc_8bit_map_color_rgb(dev, (gx_color_index) ci, rgb);
+ svga_dac_write(cv_bits(rgb[0], 6), cv_bits(rgb[1], 6),
+ cv_bits(rgb[2], 6));
} else
- for (ci = 0; ci < 64; ci++) {
- static const byte c2[10] =
- {0, 42, 0, 0, 0, 0, 0, 0, 21, 63};
+ for (ci = 0; ci < 64; ci++) {
+ static const byte c2[10] =
+ {0, 42, 0, 0, 0, 0, 0, 0, 21, 63};
- svga_dac_write(c2[(ci >> 2) & 9], c2[(ci >> 1) & 9],
- c2[ci & 9]);
- }
+ svga_dac_write(c2[(ci >> 2) & 9], c2[(ci >> 1) & 9],
+ c2[ci & 9]);
+ }
}
/* Initialize the device structure and the DACs. */
@@ -147,11 +147,11 @@ int
svga_open(gx_device * dev)
{
fb_dev->x_pixels_per_inch =
- fb_dev->y_pixels_per_inch =
- fb_dev->height / PAGE_HEIGHT_INCHES;
+ fb_dev->y_pixels_per_inch =
+ fb_dev->height / PAGE_HEIGHT_INCHES;
/* Set the display mode. */
if (svga_save_mode < 0)
- svga_save_mode = (*fb_dev->get_mode) ();
+ svga_save_mode = (*fb_dev->get_mode) ();
(*fb_dev->set_mode) (fb_dev->mode->mode);
svga_init_colors(dev);
svga_load_colors(dev);
@@ -164,7 +164,7 @@ int
svga_close(gx_device * dev)
{
if (svga_save_mode >= 0)
- (*fb_dev->set_mode) (svga_save_mode);
+ (*fb_dev->set_mode) (svga_save_mode);
svga_save_mode = -1;
return 0;
}
@@ -180,57 +180,57 @@ svga_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value r = cv[0], g = cv[1], b = cv[2];
if (fb_dev->fixed_colors) {
- gx_color_index ci = pc_8bit_map_rgb_color(dev, cv);
+ gx_color_index ci = pc_8bit_map_rgb_color(dev, cv);
- /* Here is where we should permute the index to match */
- /* the old color map... but we don't yet. */
- return ci;
+ /* Here is where we should permute the index to match */
+ /* the old color map... but we don't yet. */
+ return ci;
} {
- ushort r5 = cv_bits(r, 5), g5 = cv_bits(g, 5), b5 = cv_bits(b, 5);
- static const byte cube_bits[32] =
- {0, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 8, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 1, 128, 128, 128, 128, 128, 128, 128, 128, 128,
- 9
- };
- uint cx = ((uint) cube_bits[r5] << 2) +
- ((uint) cube_bits[g5] << 1) +
- (uint) cube_bits[b5];
-
- /* Check for a color on the cube. */
- if (cx < 64)
- return (gx_color_index) cx;
- /* Not on the cube, check the dynamic color table. */
- rgb = (r5 << 10) + (g5 << 5) + b5;
+ ushort r5 = cv_bits(r, 5), g5 = cv_bits(g, 5), b5 = cv_bits(b, 5);
+ static const byte cube_bits[32] =
+ {0, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 8, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 1, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+ 9
+ };
+ uint cx = ((uint) cube_bits[r5] << 2) +
+ ((uint) cube_bits[g5] << 1) +
+ (uint) cube_bits[b5];
+
+ /* Check for a color on the cube. */
+ if (cx < 64)
+ return (gx_color_index) cx;
+ /* Not on the cube, check the dynamic color table. */
+ rgb = (r5 << 10) + (g5 << 5) + b5;
}
{
- register dc_entry *pdc;
-
- for (pdc = &dynamic_colors[rgb % dc_hash_size];
- pdc->rgb != 0; pdc++
- )
- if (pdc->rgb == rgb)
- return (gx_color_index) (pdc->index);
- if (pdc == &dynamic_colors[dc_hash_size]) { /* Wraparound */
- for (pdc = &dynamic_colors[0]; pdc->rgb != 0; pdc++)
- if (pdc->rgb == rgb)
- return (gx_color_index) (pdc->index);
- }
- if (next_dc_index == num_colors) { /* No space left, report failure. */
- return gx_no_color_index;
- }
- /* Not on the cube, and not in the dynamic table. */
- /* Put in the dynamic table if space available. */
- {
- int i = next_dc_index++;
-
- pdc->rgb = rgb;
- pdc->index = i;
- svga_dac_set_write_index(i);
- svga_dac_write(cv_bits(r, 6), cv_bits(g, 6),
- cv_bits(b, 6));
- return (gx_color_index) i;
- }
+ register dc_entry *pdc;
+
+ for (pdc = &dynamic_colors[rgb % dc_hash_size];
+ pdc->rgb != 0; pdc++
+ )
+ if (pdc->rgb == rgb)
+ return (gx_color_index) (pdc->index);
+ if (pdc == &dynamic_colors[dc_hash_size]) { /* Wraparound */
+ for (pdc = &dynamic_colors[0]; pdc->rgb != 0; pdc++)
+ if (pdc->rgb == rgb)
+ return (gx_color_index) (pdc->index);
+ }
+ if (next_dc_index == num_colors) { /* No space left, report failure. */
+ return gx_no_color_index;
+ }
+ /* Not on the cube, and not in the dynamic table. */
+ /* Put in the dynamic table if space available. */
+ {
+ int i = next_dc_index++;
+
+ pdc->rgb = rgb;
+ pdc->index = i;
+ svga_dac_set_write_index(i);
+ svga_dac_write(cv_bits(r, 6), cv_bits(g, 6),
+ cv_bits(b, 6));
+ return (gx_color_index) i;
+ }
}
}
@@ -239,7 +239,7 @@ svga_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Since this is practically never used, we just read the DAC. */
int
svga_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
uint cval;
@@ -257,7 +257,7 @@ svga_map_color_rgb(gx_device * dev, gx_color_index color,
/* Fill a rectangle. */
int
svga_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
uint raster = fb_dev->raster;
ushort limit = (ushort) - raster;
@@ -269,61 +269,61 @@ svga_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Most fills are very small and don't cross a page boundary. */
yi = h;
switch (w) {
- case 0:
- return 0; /* no-op */
- case 1:
- while (--yi >= 0 && PTR_OFF(ptr) < limit)
- ptr[0] = (byte) color,
- ptr += raster;
- if (!++yi)
- return 0;
- break;
- case 2:
- while (--yi >= 0 && PTR_OFF(ptr) < limit)
- ptr[0] = ptr[1] = (byte) color,
- ptr += raster;
- if (!++yi)
- return 0;
- break;
- case 3:
- while (--yi >= 0 && PTR_OFF(ptr) < limit)
- ptr[0] = ptr[1] = ptr[2] = (byte) color,
- ptr += raster;
- if (!++yi)
- return 0;
- break;
- case 4:
- while (--yi >= 0 && PTR_OFF(ptr) < limit)
- ptr[0] = ptr[1] = ptr[2] = ptr[3] = (byte) color,
- ptr += raster;
- if (!++yi)
- return 0;
- break;
- default:
- if (w < 0)
- return 0;
- /* Check for erasepage. */
- if (w == dev->width && h == dev->height &&
- color < first_dc_index
- )
- svga_init_colors(dev);
+ case 0:
+ return 0; /* no-op */
+ case 1:
+ while (--yi >= 0 && PTR_OFF(ptr) < limit)
+ ptr[0] = (byte) color,
+ ptr += raster;
+ if (!++yi)
+ return 0;
+ break;
+ case 2:
+ while (--yi >= 0 && PTR_OFF(ptr) < limit)
+ ptr[0] = ptr[1] = (byte) color,
+ ptr += raster;
+ if (!++yi)
+ return 0;
+ break;
+ case 3:
+ while (--yi >= 0 && PTR_OFF(ptr) < limit)
+ ptr[0] = ptr[1] = ptr[2] = (byte) color,
+ ptr += raster;
+ if (!++yi)
+ return 0;
+ break;
+ case 4:
+ while (--yi >= 0 && PTR_OFF(ptr) < limit)
+ ptr[0] = ptr[1] = ptr[2] = ptr[3] = (byte) color,
+ ptr += raster;
+ if (!++yi)
+ return 0;
+ break;
+ default:
+ if (w < 0)
+ return 0;
+ /* Check for erasepage. */
+ if (w == dev->width && h == dev->height &&
+ color < first_dc_index
+ )
+ svga_init_colors(dev);
}
while (--yi >= 0) {
- if (PTR_OFF(ptr) < limit) {
- memset(ptr, (byte) color, w);
- ptr += raster;
- } else if (PTR_OFF(ptr) <= (ushort) (-w)) {
- memset(ptr, (byte) color, w);
- if (yi > 0)
- set_pixel_write_ptr(ptr, fb_dev, x, y + h - yi);
- } else {
- uint left = (uint) 0x10000 - PTR_OFF(ptr);
-
- memset(ptr, (byte) color, left);
- set_pixel_write_ptr(ptr, fb_dev, x + left, y + h - 1 - yi);
- memset(ptr, (byte) color, w - left);
- ptr += raster - left;
- }
+ if (PTR_OFF(ptr) < limit) {
+ memset(ptr, (byte) color, w);
+ ptr += raster;
+ } else if (PTR_OFF(ptr) <= (ushort) (-w)) {
+ memset(ptr, (byte) color, w);
+ if (yi > 0)
+ set_pixel_write_ptr(ptr, fb_dev, x, y + h - yi);
+ } else {
+ uint left = (uint) 0x10000 - PTR_OFF(ptr);
+
+ memset(ptr, (byte) color, left);
+ set_pixel_write_ptr(ptr, fb_dev, x + left, y + h - 1 - yi);
+ memset(ptr, (byte) color, w - left);
+ ptr += raster - left;
+ }
}
return 0;
}
@@ -332,7 +332,7 @@ svga_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Color = gx_no_color_index means transparent (no effect on the image). */
int
svga_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone)
{
uint raster = fb_dev->raster;
@@ -351,68 +351,68 @@ svga_copy_mono(gx_device * dev,
#define izero (int)czero
#define ione (int)cone
if (ione == no_color) {
- gx_color_index temp;
-
- if (izero == no_color)
- return 0; /* no-op */
- temp = czero;
- czero = cone;
- cone = temp;
- invert = ~0;
+ gx_color_index temp;
+
+ if (izero == no_color)
+ return 0; /* no-op */
+ temp = czero;
+ czero = cone;
+ cone = temp;
+ invert = ~0;
} else
- invert = 0;
+ invert = 0;
/* Pre-filling saves us a test in the loop, */
/* and since tiling is uncommon, we come out ahead. */
if (izero != no_color)
- svga_fill_rectangle(dev, x, y, w, h, czero);
+ svga_fill_rectangle(dev, x, y, w, h, czero);
for (yi = 0; yi < h; yi++) {
- const byte *sptr = srow;
- uint bits;
- int bitno = sourcex & 7;
-
- wi = w;
- if (PTR_OFF(ptr) <= skip) {
- set_pixel_write_ptr(ptr, fb_dev, x, y + yi);
- } else if (PTR_OFF(ptr) > limit) { /* We're crossing a page boundary. */
- /* This is extremely rare, so it doesn't matter */
- /* how slow it is. */
- int xi = (ushort) - PTR_OFF(ptr);
-
- svga_copy_mono(dev, srow, sourcex & 7, sraster,
- gx_no_bitmap_id, x, y + yi, xi, 1,
- gx_no_color_index, cone);
- set_pixel_write_ptr(ptr, fb_dev, x + xi, y + yi);
- sptr = srow - (sourcex >> 3) + ((sourcex + xi) >> 3);
- bitno = (sourcex + xi) & 7;
- wi -= xi;
- }
- bits = *sptr ^ invert;
- switch (bitno) {
+ const byte *sptr = srow;
+ uint bits;
+ int bitno = sourcex & 7;
+
+ wi = w;
+ if (PTR_OFF(ptr) <= skip) {
+ set_pixel_write_ptr(ptr, fb_dev, x, y + yi);
+ } else if (PTR_OFF(ptr) > limit) { /* We're crossing a page boundary. */
+ /* This is extremely rare, so it doesn't matter */
+ /* how slow it is. */
+ int xi = (ushort) - PTR_OFF(ptr);
+
+ svga_copy_mono(dev, srow, sourcex & 7, sraster,
+ gx_no_bitmap_id, x, y + yi, xi, 1,
+ gx_no_color_index, cone);
+ set_pixel_write_ptr(ptr, fb_dev, x + xi, y + yi);
+ sptr = srow - (sourcex >> 3) + ((sourcex + xi) >> 3);
+ bitno = (sourcex + xi) & 7;
+ wi -= xi;
+ }
+ bits = *sptr ^ invert;
+ switch (bitno) {
#define ifbit(msk)\
if ( bits & msk ) *ptr = (byte)ione;\
if ( !--wi ) break; ptr++
- case 0:
- bit0:ifbit(0x80);
- case 1:
- ifbit(0x40);
- case 2:
- ifbit(0x20);
- case 3:
- ifbit(0x10);
- case 4:
- ifbit(0x08);
- case 5:
- ifbit(0x04);
- case 6:
- ifbit(0x02);
- case 7:
- ifbit(0x01);
+ case 0:
+ bit0:ifbit(0x80);
+ case 1:
+ ifbit(0x40);
+ case 2:
+ ifbit(0x20);
+ case 3:
+ ifbit(0x10);
+ case 4:
+ ifbit(0x08);
+ case 5:
+ ifbit(0x04);
+ case 6:
+ ifbit(0x02);
+ case 7:
+ ifbit(0x01);
#undef ifbit
- bits = *++sptr ^ invert;
- goto bit0;
- }
- ptr += skip;
- srow += sraster;
+ bits = *++sptr ^ invert;
+ goto bit0;
+ }
+ ptr += skip;
+ srow += sraster;
}
#undef izero
#undef ione
@@ -423,8 +423,8 @@ svga_copy_mono(gx_device * dev,
/* except that each pixel takes 8 bits instead of 1. */
int
svga_copy_color(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
int xi, yi;
int skip;
@@ -435,13 +435,13 @@ svga_copy_color(gx_device * dev,
skip = sraster - w;
sptr = base + sourcex;
for (yi = y; yi - y < h; yi++) {
- ptr = 0;
- for (xi = x; xi - x < w; xi++) {
- if (PTR_OFF(ptr) == 0)
- set_pixel_write_ptr(ptr, fb_dev, xi, yi);
- *ptr++ = *sptr++;
- }
- sptr += skip;
+ ptr = 0;
+ for (xi = x; xi - x < w; xi++) {
+ if (PTR_OFF(ptr) == 0)
+ set_pixel_write_ptr(ptr, fb_dev, xi, yi);
+ *ptr++ = *sptr++;
+ }
+ sptr += skip;
}
return 0;
}
@@ -455,8 +455,8 @@ svga_put_params(gx_device * dev, gs_param_list * plist)
const char *param_name;
if ((code = ecode) < 0 ||
- (code = gx_default_put_params(dev, plist)) < 0
- ) {
+ (code = gx_default_put_params(dev, plist)) < 0
+ ) {
}
return code;
}
@@ -470,20 +470,20 @@ svga_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
fb_ptr src;
if (y < 0 || y >= dev->height)
- return gs_error_rangecheck;
+ return gs_error_rangecheck;
set_pixel_read_ptr(src, fb_dev, 0, y);
/* The logic here is similar to fill_rectangle. */
if (PTR_OFF(src) <= limit)
- memcpy(data, src, bytes_per_row);
+ memcpy(data, src, bytes_per_row);
else {
- uint left = (uint) 0x10000 - PTR_OFF(src);
+ uint left = (uint) 0x10000 - PTR_OFF(src);
- memcpy(data, src, left);
- set_pixel_read_ptr(src, fb_dev, left, y);
- memcpy(data + left, src, bytes_per_row - left);
+ memcpy(data, src, left);
+ set_pixel_read_ptr(src, fb_dev, left, y);
+ memcpy(data + left, src, bytes_per_row - left);
}
if (actual_data != 0)
- *actual_data = data;
+ *actual_data = data;
return 0;
}
@@ -491,8 +491,8 @@ svga_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
/* Depth is 1, 2, or 4. */
static int
svga_copy_alpha(gx_device * dev, const byte * base, int sourcex,
- int sraster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int sraster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
int xi, yi;
int skip;
@@ -509,56 +509,56 @@ svga_copy_alpha(gx_device * dev, const byte * base, int sourcex,
fit_copy(dev, base, sourcex, sraster, id, x, y, w, h);
shades[0] = (byte) svga_map_rgb_color(dev, gx_max_color_value,
- gx_max_color_value,
- gx_max_color_value);
+ gx_max_color_value,
+ gx_max_color_value);
shades[n1] = (byte) color;
if (n1 > 1) {
- memset(shades + 1, 255, n1 - 1);
- svga_map_color_rgb(dev, color, rgb);
+ memset(shades + 1, 255, n1 - 1);
+ svga_map_color_rgb(dev, color, rgb);
}
skip = sraster - ((w * depth) >> 3);
sptr = base + (sourcex >> (3 - log2_depth));
mask = n1;
ishift = (~sourcex & (7 >> log2_depth)) << log2_depth;
for (yi = y; yi - y < h; yi++) {
- fb_ptr ptr = 0;
- int shift = ishift;
+ fb_ptr ptr = 0;
+ int shift = ishift;
- for (xi = x; xi - x < w; xi++, ptr++) {
- uint a = (*sptr >> shift) & mask;
+ for (xi = x; xi - x < w; xi++, ptr++) {
+ uint a = (*sptr >> shift) & mask;
- if (PTR_OFF(ptr) == 0)
- set_pixel_write_ptr(ptr, fb_dev, xi, yi);
- map:if (a != 0) {
- byte ci = shades[a];
+ if (PTR_OFF(ptr) == 0)
+ set_pixel_write_ptr(ptr, fb_dev, xi, yi);
+ map:if (a != 0) {
+ byte ci = shades[a];
- if (ci == 255) { /* Map the color now. */
+ if (ci == 255) { /* Map the color now. */
#define make_shade(v, alpha, n1)\
(gx_max_color_value -\
((ulong)(gx_max_color_value - (v)) * (alpha) / (n1)))
- gx_color_value r =
- make_shade(rgb[0], a, n1);
- gx_color_value g =
- make_shade(rgb[1], a, n1);
- gx_color_value b =
- make_shade(rgb[2], a, n1);
- gx_color_index sci =
- svga_map_rgb_color(dev, r, g, b);
-
- if (sci == gx_no_color_index) {
- a += (n1 + 1 - a) >> 1;
- goto map;
- }
- shades[a] = ci = (byte) sci;
- }
- *ptr = ci;
- }
- if (shift == 0)
- shift = 8 - depth, sptr++;
- else
- shift -= depth;
- }
- sptr += skip;
+ gx_color_value r =
+ make_shade(rgb[0], a, n1);
+ gx_color_value g =
+ make_shade(rgb[1], a, n1);
+ gx_color_value b =
+ make_shade(rgb[2], a, n1);
+ gx_color_index sci =
+ svga_map_rgb_color(dev, r, g, b);
+
+ if (sci == gx_no_color_index) {
+ a += (n1 + 1 - a) >> 1;
+ goto map;
+ }
+ shades[a] = ci = (byte) sci;
+ }
+ *ptr = ci;
+ }
+ if (shift == 0)
+ shift = 8 - depth, sptr++;
+ else
+ shift -= depth;
+ }
+ sptr += skip;
}
return 0;
}
@@ -658,14 +658,14 @@ vesa_get_info(int mode, vesa_info _ss * info)
int86x(0x10, &regs, &regs, &sregs);
#ifdef DEBUG
if (regs.h.ah == 0 && regs.h.al == 0x4f)
- dlprintf8("vesa_get_info(%x): ma=%x wa=%x/%x wg=%x ws=%x wseg=%x/%x\n",
- mode, info->mode_attributes,
- info->win_a_attributes, info->win_b_attributes,
- info->win_granularity, info->win_size,
- info->win_a_segment, info->win_b_segment);
+ dlprintf8("vesa_get_info(%x): ma=%x wa=%x/%x wg=%x ws=%x wseg=%x/%x\n",
+ mode, info->mode_attributes,
+ info->win_a_attributes, info->win_b_attributes,
+ info->win_granularity, info->win_size,
+ info->win_a_segment, info->win_b_segment);
else
- dlprintf3("vesa_get_info(%x) failed: ah=%x al=%x\n",
- mode, regs.h.ah, regs.h.al);
+ dlprintf3("vesa_get_info(%x) failed: ah=%x al=%x\n",
+ mode, regs.h.ah, regs.h.al);
#endif
return (regs.h.ah == 0 && regs.h.al == 0x4f ? 0 : -1);
}
@@ -679,44 +679,44 @@ vesa_find_mode(gx_device * dev, const mode_info * mode_table)
const mode_info *mip;
for (mip = mode_table; mip->mode >= 0; mip++) {
- if (mip->width >= fb_dev->width &&
- mip->height >= fb_dev->height &&
- vesa_get_info(mip->mode, &info) >= 0 &&
- bits_include(info.mode_attributes,
- m_supported | m_graphics) &&
- info.win_granularity <= 64 &&
- (info.win_granularity & (info.win_granularity - 1)) == 0 &&
- info.win_size == 64 &&
- bits_include(info.win_a_attributes,
- w_supported) &&
- info.win_a_segment == regen
- ) { /* Make sure we can both read & write. */
- /* Initialize for the default case. */
- fb_dev->wnum_read = 0;
- fb_dev->wnum_write = 0;
- if (bits_include(info.win_a_attributes,
- w_readable | w_writable)
- )
- break;
- else if (info.win_b_segment == regen &&
- bits_include(info.win_b_attributes,
- w_supported) &&
- bits_include(info.win_a_attributes |
- info.win_b_attributes,
- w_readable | w_writable)
- ) { /* Two superimposed windows. */
- if (!bits_include(info.win_a_attributes,
- w_writable)
- )
- fb_dev->wnum_write = 1;
- else
- fb_dev->wnum_read = 1;
- }
- break;
- }
+ if (mip->width >= fb_dev->width &&
+ mip->height >= fb_dev->height &&
+ vesa_get_info(mip->mode, &info) >= 0 &&
+ bits_include(info.mode_attributes,
+ m_supported | m_graphics) &&
+ info.win_granularity <= 64 &&
+ (info.win_granularity & (info.win_granularity - 1)) == 0 &&
+ info.win_size == 64 &&
+ bits_include(info.win_a_attributes,
+ w_supported) &&
+ info.win_a_segment == regen
+ ) { /* Make sure we can both read & write. */
+ /* Initialize for the default case. */
+ fb_dev->wnum_read = 0;
+ fb_dev->wnum_write = 0;
+ if (bits_include(info.win_a_attributes,
+ w_readable | w_writable)
+ )
+ break;
+ else if (info.win_b_segment == regen &&
+ bits_include(info.win_b_attributes,
+ w_supported) &&
+ bits_include(info.win_a_attributes |
+ info.win_b_attributes,
+ w_readable | w_writable)
+ ) { /* Two superimposed windows. */
+ if (!bits_include(info.win_a_attributes,
+ w_writable)
+ )
+ fb_dev->wnum_write = 1;
+ else
+ fb_dev->wnum_read = 1;
+ }
+ break;
+ }
}
if (mip->mode < 0)
- return_error(gs_error_rangecheck); /* mode not available */
+ return_error(gs_error_rangecheck); /* mode not available */
fb_dev->mode = mip;
gx_device_adjust_resolution(dev, mip->width, mip->height, 1);
fb_dev->info.vesa.bios_set_page = info.win_func_ptr;
@@ -730,17 +730,17 @@ vesa_open(gx_device * dev)
{
static const mode_info mode_table[] =
{
- {640, 400, 0x100},
- {640, 480, 0x101},
- {800, 600, 0x103},
- {1024, 768, 0x105},
- {1280, 1024, 0x107},
- {-1, -1, -1}
+ {640, 400, 0x100},
+ {640, 480, 0x101},
+ {800, 600, 0x103},
+ {1024, 768, 0x105},
+ {1280, 1024, 0x107},
+ {-1, -1, -1}
};
int code = vesa_find_mode(dev, mode_table);
if (code < 0)
- return code;
+ return code;
return svga_open(dev);
}
@@ -794,20 +794,20 @@ static int
atiw_open(gx_device * dev)
{ /* Select the proper video mode */
{
- static const mode_info mode_table[] =
- {
- {640, 400, 0x61},
- {640, 480, 0x62},
- {800, 600, 0x63},
- {1024, 768, 0x64},
- {-1, -1, -1}
- };
- int code = svga_find_mode(dev, mode_table);
-
- if (code < 0)
- return code; /* mode not available */
- fb_dev->info.atiw.select_reg = *(int *)MK_PTR(0xc000, 0x10);
- return svga_open(dev);
+ static const mode_info mode_table[] =
+ {
+ {640, 400, 0x61},
+ {640, 480, 0x62},
+ {800, 600, 0x63},
+ {1024, 768, 0x64},
+ {-1, -1, -1}
+ };
+ int code = svga_find_mode(dev, mode_table);
+
+ if (code < 0)
+ return code; /* mode not available */
+ fb_dev->info.atiw.select_reg = *(int *)MK_PTR(0xc000, 0x10);
+ return svga_open(dev);
}
}
@@ -844,19 +844,19 @@ tvga_open(gx_device * dev)
fb_dev->wnum_write = 0;
/* Select the proper video mode */
{
- static const mode_info mode_table[] =
- {
- {640, 400, 0x5c},
- {640, 480, 0x5d},
- {800, 600, 0x5e},
- {1024, 768, 0x62},
- {-1, -1, -1}
- };
- int code = svga_find_mode(dev, mode_table);
-
- if (code < 0)
- return code; /* mode not available */
- return svga_open(dev);
+ static const mode_info mode_table[] =
+ {
+ {640, 400, 0x5c},
+ {640, 480, 0x5d},
+ {800, 600, 0x5e},
+ {1024, 768, 0x62},
+ {-1, -1, -1}
+ };
+ int code = svga_find_mode(dev, mode_table);
+
+ if (code < 0)
+ return code; /* mode not available */
+ return svga_open(dev);
}
}
@@ -893,32 +893,32 @@ tseng_open(gx_device * dev)
fb_dev->wnum_write = 0;
/* Select the proper video mode */
{
- static const mode_info mode_table[] =
- {
- {640, 350, 0x2d},
- {640, 480, 0x2e},
- {800, 600, 0x30},
- {1024, 768, 0x38},
- {-1, -1, -1}
- };
- int code = svga_find_mode(dev, mode_table);
- volatile_fb_ptr p0 = (volatile_fb_ptr) MK_PTR(regen, 0);
-
- if (code < 0)
- return code; /* mode not available */
- code = svga_open(dev);
- if (code < 0)
- return 0;
- /* Figure out whether we have an ET3000 or an ET4000 */
- /* by playing with the segment register. */
- outportb(0x3cd, 0x44);
- *p0 = 4; /* byte 0, page 4 */
- outportb(0x3cd, 0x40);
- *p0 = 3; /* byte 0, page 0 */
- fb_dev->info.tseng.et_model = *p0;
- /* read page 0 if ET3000, */
- /* page 4 if ET4000 */
- return 0;
+ static const mode_info mode_table[] =
+ {
+ {640, 350, 0x2d},
+ {640, 480, 0x2e},
+ {800, 600, 0x30},
+ {1024, 768, 0x38},
+ {-1, -1, -1}
+ };
+ int code = svga_find_mode(dev, mode_table);
+ volatile_fb_ptr p0 = (volatile_fb_ptr) MK_PTR(regen, 0);
+
+ if (code < 0)
+ return code; /* mode not available */
+ code = svga_open(dev);
+ if (code < 0)
+ return 0;
+ /* Figure out whether we have an ET3000 or an ET4000 */
+ /* by playing with the segment register. */
+ outportb(0x3cd, 0x44);
+ *p0 = 4; /* byte 0, page 4 */
+ outportb(0x3cd, 0x40);
+ *p0 = 3; /* byte 0, page 0 */
+ fb_dev->info.tseng.et_model = *p0;
+ /* read page 0 if ET3000, */
+ /* page 4 if ET4000 */
+ return 0;
}
}
@@ -931,7 +931,7 @@ tseng_set_page(gx_device_svga * dev, int pn, int wnum)
int mask = (1 << shift) - 1;
if (wnum)
- pn <<= shift, mask <<= shift;
+ pn <<= shift, mask <<= shift;
outportb(0x3cd, (inportb(0x3cd) & ~mask) + pn);
}
/* ------ The Cirrus device (CL-GD54XX) ------ */
@@ -954,23 +954,23 @@ cirr_open(gx_device * dev)
fb_dev->wnum_write = 0;
/* Select the proper video mode */
{
- static const mode_info mode_table[] =
- {
- {640, 400, 0x5e},
- {640, 480, 0x5f},
- {800, 600, 0x5c},
- {1024, 768, 0x60},
- {-1, -1, -1}
- };
- int code = svga_find_mode(dev, mode_table);
-
- if (code < 0)
- return code; /* mode not available */
- outportb(0x3c4, 0x06);
- outportb(0x3c5, 0x12);
- outportb(0x3ce, 0x0b);
- outportb(0x3cf, (inportb(0x3cf) & 0xde));
- return svga_open(dev);
+ static const mode_info mode_table[] =
+ {
+ {640, 400, 0x5e},
+ {640, 480, 0x5f},
+ {800, 600, 0x5c},
+ {1024, 768, 0x60},
+ {-1, -1, -1}
+ };
+ int code = svga_find_mode(dev, mode_table);
+
+ if (code < 0)
+ return code; /* mode not available */
+ outportb(0x3c4, 0x06);
+ outportb(0x3c5, 0x12);
+ outportb(0x3ce, 0x0b);
+ outportb(0x3cf, (inportb(0x3cf) & 0xde));
+ return svga_open(dev);
}
}
@@ -995,7 +995,7 @@ static void ali_set_page(gx_device_svga *, int, int);
/* The 256-color Avance Logic device */
gx_device_svga gs_ali_device =
svga_device(ali_procs, "ali", atiw_get_mode, atiw_set_mode,
- ali_set_page);
+ ali_set_page);
/* Initialize the graphics mode. */
static int
@@ -1005,19 +1005,19 @@ ali_open(gx_device * dev)
fb_dev->wnum_write = 0;
/* Select the proper video mode */
{
- static const mode_info mode_table[] =
- {
- {640, 400, 0x29},
- {640, 480, 0x2a},
- {800, 600, 0x2c},
- {1024, 768, 0x31},
- {-1, -1, -1}
- };
- int code = svga_find_mode(dev, mode_table);
-
- if (code < 0)
- return code; /* mode not available */
- return svga_open(dev);
+ static const mode_info mode_table[] =
+ {
+ {640, 400, 0x29},
+ {640, 480, 0x2a},
+ {800, 600, 0x2c},
+ {1024, 768, 0x31},
+ {-1, -1, -1}
+ };
+ int code = svga_find_mode(dev, mode_table);
+
+ if (code < 0)
+ return code; /* mode not available */
+ return svga_open(dev);
}
}
diff --git a/gs/base/gdevsvga.h b/gs/base/gdevsvga.h
index 5cd467de2..8f342275a 100644
--- a/gs/base/gdevsvga.h
+++ b/gs/base/gdevsvga.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
/* Common procedures */
- /* See gxdevice.h for the definitions of the procedures. */
+ /* See gxdevice.h for the definitions of the procedures. */
dev_proc_close_device(svga_close);
dev_proc_map_rgb_color(svga_map_rgb_color);
@@ -53,17 +53,17 @@ struct gx_device_svga_s {
int wnum_read, wnum_write; /* window #s for read vs. write */
/* Following are device-specific. */
union {
- struct {
- void (*bios_set_page) (int, int); /* set-page function */
- int pn_shift; /* log2(64K/granularity) */
- } vesa;
- struct {
- int select_reg; /* page-select register */
- } atiw;
- struct {
- int et_model; /* 4 for ET4000, */
- /* 3 for ET3000 */
- } tseng;
+ struct {
+ void (*bios_set_page) (int, int); /* set-page function */
+ int pn_shift; /* log2(64K/granularity) */
+ } vesa;
+ struct {
+ int select_reg; /* page-select register */
+ } atiw;
+ struct {
+ int et_model; /* 4 for ET4000, */
+ /* 3 for ET3000 */
+ } tseng;
} info;
};
@@ -71,13 +71,13 @@ struct gx_device_svga_s {
/* the screen to a full-page coordinate space. */
/* This may or may not be what is desired! */
#define svga_color_device(procs, name, depth, maxv, dither, get_mode, set_mode, set_page) {\
- std_device_color_body(gx_device_svga, &procs, name,\
- 640, 480,\
- 480 / PAGE_HEIGHT_INCHES, 480 / PAGE_HEIGHT_INCHES,\
- /*dci_color(*/depth, maxv, dither/*)*/),\
- { 0 }, /* std_procs */\
- get_mode, set_mode, set_page,\
- 0 /*fixed_colors*/\
+ std_device_color_body(gx_device_svga, &procs, name,\
+ 640, 480,\
+ 480 / PAGE_HEIGHT_INCHES, 480 / PAGE_HEIGHT_INCHES,\
+ /*dci_color(*/depth, maxv, dither/*)*/),\
+ { 0 }, /* std_procs */\
+ get_mode, set_mode, set_page,\
+ 0 /*fixed_colors*/\
}
#define svga_device(procs, name, get_mode, set_mode, set_page)\
svga_color_device(procs, name, 8, 31, 4, get_mode, set_mode, set_page)
diff --git a/gs/base/gdevtfax.c b/gs/base/gdevtfax.c
index d9b591ea7..f8268b42c 100644
--- a/gs/base/gdevtfax.c
+++ b/gs/base/gdevtfax.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,7 +51,7 @@ typedef struct gx_device_tfax_s gx_device_tfax;
/* Define procedures that adjust the paper size. */
static const gx_device_procs gdev_tfax_std_procs =
prn_params_procs(tfax_open, tiff_output_page, tfax_close,
- tfax_get_params, tfax_put_params);
+ tfax_get_params, tfax_put_params);
#define TFAX_DEVICE(dname, print_page, compr)\
{\
@@ -75,7 +75,6 @@ const gx_device_tfax gs_tiffg32d_device =
const gx_device_tfax gs_tiffg4_device =
TFAX_DEVICE("tiffg4", tiffg4_print_page, COMPRESSION_CCITTFAX4);
-
static int
tfax_open(gx_device * pdev)
{
@@ -85,11 +84,11 @@ tfax_open(gx_device * pdev)
ppdev->file = NULL;
code = gdev_prn_allocate_memory(pdev, NULL, 0, 0);
if (code < 0)
- return code;
+ return code;
if (ppdev->OpenOutputFile)
- if ((code = gdev_prn_open_printer_seekable(pdev, 1, true)) < 0)
- return code;
+ if ((code = gdev_prn_open_printer_seekable(pdev, 1, true)) < 0)
+ return code;
return code;
}
@@ -113,7 +112,6 @@ tfax_get_params(gx_device * dev, gs_param_list * plist)
int ecode = code;
gs_param_string comprstr;
-
if ((code = param_write_long(plist, "MaxStripSize", &tfdev->MaxStripSize)) < 0)
ecode = code;
if ((code = param_write_int(plist, "FillOrder", &tfdev->FillOrder)) < 0)
@@ -121,8 +119,8 @@ tfax_get_params(gx_device * dev, gs_param_list * plist)
if ((code = param_write_bool(plist, "BigEndian", &tfdev->BigEndian)) < 0)
ecode = code;
if ((code = tiff_compression_param_string(&comprstr, tfdev->Compression)) < 0 ||
- (code = param_write_string(plist, "Compression", &comprstr)) < 0)
- ecode = code;
+ (code = param_write_string(plist, "Compression", &comprstr)) < 0)
+ ecode = code;
return ecode;
}
@@ -142,62 +140,62 @@ tfax_put_params(gx_device * dev, gs_param_list * plist)
switch (code = param_read_long(plist, (param_name = "MaxStripSize"), &mss)) {
case 0:
- /*
- * Strip must be large enough to accommodate a raster line.
- * If the max strip size is too small, we still write a single
- * line per strip rather than giving an error.
- */
- if (mss >= 0)
- break;
- code = gs_error_rangecheck;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ /*
+ * Strip must be large enough to accommodate a raster line.
+ * If the max strip size is too small, we still write a single
+ * line per strip rather than giving an error.
+ */
+ if (mss >= 0)
+ break;
+ code = gs_error_rangecheck;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
- /* Following TIFF spec, FillOrder is integer */
+ /* Following TIFF spec, FillOrder is integer */
switch (code = param_read_int(plist, (param_name = "FillOrder"), &fill_order)) {
case 0:
- if (fill_order == 1 || fill_order == 2)
- break;
- code = gs_error_rangecheck;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ if (fill_order == 1 || fill_order == 2)
+ break;
+ code = gs_error_rangecheck;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
-
- /* Read BigEndian option as bool */
+
+ /* Read BigEndian option as bool */
switch (code = param_read_bool(plist, (param_name = "BigEndian"), &big_endian)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
case 0:
- case 1:
- break;
+ case 1:
+ break;
}
/* Read Compression */
switch (code = param_read_string(plist, (param_name = "Compression"), &comprstr)) {
- case 0:
- if ((ecode = tiff_compression_id(&compr, &comprstr)) < 0 ||
- !tiff_compression_allowed(compr, dev->color_info.depth))
- param_signal_error(plist, param_name, ecode);
- break;
- case 1:
- break;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
+ case 0:
+ if ((ecode = tiff_compression_id(&compr, &comprstr)) < 0 ||
+ !tiff_compression_allowed(compr, dev->color_info.depth))
+ param_signal_error(plist, param_name, ecode);
+ break;
+ case 1:
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gdev_fax_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
tfdev->MaxStripSize = mss;
tfdev->FillOrder = fill_order;
@@ -206,7 +204,6 @@ tfax_put_params(gx_device * dev, gs_param_list * plist)
return code;
}
-
/* ---------------- Other TIFF output ---------------- */
#include "slzwx.h"
@@ -218,10 +215,10 @@ static dev_proc_print_page(tiffpack_print_page);
const gx_device_tfax gs_tifflzw_device = {
prn_device_std_body(gx_device_tfax, gdev_tfax_std_procs, "tifflzw",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, tifflzw_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, tifflzw_print_page),
0 /* AdjustWidth */,
0 /* MinFeatureSize */,
TIFF_DEFAULT_STRIP_SIZE /* strip size byte count */,
@@ -232,10 +229,10 @@ const gx_device_tfax gs_tifflzw_device = {
const gx_device_tfax gs_tiffpack_device = {
prn_device_std_body(gx_device_tfax, gdev_tfax_std_procs, "tiffpack",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, tiffpack_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins */
+ 1, tiffpack_print_page),
0 /* AdjustWidth */,
0 /* MinFeatureSize */,
TIFF_DEFAULT_STRIP_SIZE /* strip size byte count */,
@@ -244,7 +241,6 @@ const gx_device_tfax gs_tiffpack_device = {
COMPRESSION_PACKBITS
};
-
/* Forward references */
static int tfax_begin_page(gx_device_tfax * tfdev, FILE * file);
@@ -259,9 +255,9 @@ tfax_set_fields(gx_device_tfax *tfdev)
TIFFSetField(tfdev->tif, TIFFTAG_SAMPLESPERPIXEL, 1);
tiff_set_compression((gx_device_printer *)tfdev,
- tfdev->tif,
- tfdev->Compression,
- tfdev->MaxStripSize);
+ tfdev->tif,
+ tfdev->Compression,
+ tfdev->MaxStripSize);
}
static int
@@ -285,7 +281,7 @@ tiffg3_print_page(gx_device_printer * dev, FILE * prn_stream)
tfax_set_fields(tfdev);
if (tfdev->Compression == COMPRESSION_CCITTFAX3)
- TIFFSetField(tfdev->tif, TIFFTAG_GROUP3OPTIONS, GROUP3OPT_FILLBITS);
+ TIFFSetField(tfdev->tif, TIFFTAG_GROUP3OPTIONS, GROUP3OPT_FILLBITS);
return tiff_print_page(dev, tfdev->tif, tfdev->MinFeatureSize);
}
@@ -299,7 +295,7 @@ tiffg32d_print_page(gx_device_printer * dev, FILE * prn_stream)
tfax_set_fields(tfdev);
if (tfdev->Compression == COMPRESSION_CCITTFAX3)
- TIFFSetField(tfdev->tif, TIFFTAG_GROUP3OPTIONS, GROUP3OPT_2DENCODING | GROUP3OPT_FILLBITS);
+ TIFFSetField(tfdev->tif, TIFFTAG_GROUP3OPTIONS, GROUP3OPT_2DENCODING | GROUP3OPT_FILLBITS);
return tiff_print_page(dev, tfdev->tif, tfdev->MinFeatureSize);
}
@@ -313,7 +309,7 @@ tiffg4_print_page(gx_device_printer * dev, FILE * prn_stream)
tfax_set_fields(tfdev);
if (tfdev->Compression == COMPRESSION_CCITTFAX4)
- TIFFSetField(tfdev->tif, TIFFTAG_GROUP4OPTIONS, 0);
+ TIFFSetField(tfdev->tif, TIFFTAG_GROUP4OPTIONS, 0);
return tiff_print_page(dev, tfdev->tif, tfdev->MinFeatureSize);
}
@@ -353,9 +349,9 @@ tfax_begin_page(gx_device_tfax * tfdev, FILE * file)
/* open the TIFF device */
if (gdev_prn_file_is_new(pdev)) {
- tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
- if (!tfdev->tif)
- return_error(gs_error_invalidfileaccess);
+ tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
+ if (!tfdev->tif)
+ return_error(gs_error_invalidfileaccess);
}
code = tiff_set_fields_for_printer(pdev, tfdev->tif, 1, tfdev->AdjustWidth);
diff --git a/gs/base/gdevtfax.h b/gs/base/gdevtfax.h
index fca7f5b06..bf08217a0 100644
--- a/gs/base/gdevtfax.h
+++ b/gs/base/gdevtfax.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,6 +18,6 @@
# define gdevtfax_INCLUDED
int gdev_fax_print_page_stripped(gx_device_printer *pdev, FILE *prn_stream,
- stream_CFE_state *ss, long rows_per_strip);
+ stream_CFE_state *ss, long rows_per_strip);
#endif /* gdevtfax_INCLUDED */
diff --git a/gs/base/gdevtfnx.c b/gs/base/gdevtfnx.c
index d13ee5156..e51a6cffe 100644
--- a/gs/base/gdevtfnx.c
+++ b/gs/base/gdevtfnx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,19 +35,19 @@ static dev_proc_print_page(tiff_rgb_print_page);
static const gx_device_procs tiff12_procs =
prn_color_params_procs(tiff_open, tiff_output_page, tiff_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
- tiff_get_params, tiff_put_params);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ tiff_get_params, tiff_put_params);
static const gx_device_procs tiff24_procs =
prn_color_params_procs(tiff_open, tiff_output_page, tiff_close,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
- tiff_get_params, tiff_put_params);
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
+ tiff_get_params, tiff_put_params);
const gx_device_tiff gs_tiff12nc_device = {
prn_device_std_body(gx_device_tiff, tiff12_procs, "tiff12nc",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 24, tiff12_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0,
+ 24, tiff12_print_page),
arch_is_big_endian /* default to native endian (i.e. use big endian iff the platform is so*/,
COMPRESSION_NONE,
TIFF_DEFAULT_STRIP_SIZE,
@@ -58,10 +58,10 @@ const gx_device_tiff gs_tiff12nc_device = {
const gx_device_tiff gs_tiff24nc_device = {
prn_device_std_body(gx_device_tiff, tiff24_procs, "tiff24nc",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 24, tiff_rgb_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0,
+ 24, tiff_rgb_print_page),
arch_is_big_endian /* default to native endian (i.e. use big endian iff the platform is so*/,
COMPRESSION_NONE,
TIFF_DEFAULT_STRIP_SIZE,
@@ -72,10 +72,10 @@ const gx_device_tiff gs_tiff24nc_device = {
const gx_device_tiff gs_tiff48nc_device = {
prn_device_std_body(gx_device_tiff, tiff24_procs, "tiff48nc",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 48, tiff_rgb_print_page),
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0,
+ 48, tiff_rgb_print_page),
arch_is_big_endian /* default to native endian (i.e. use big endian iff the platform is so*/,
COMPRESSION_NONE,
TIFF_DEFAULT_STRIP_SIZE,
@@ -100,12 +100,12 @@ tiff_set_rgb_fields(gx_device_tiff *tfdev)
default:
TIFFSetField(tfdev->tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
break;
- }
+ }
TIFFSetField(tfdev->tif, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
TIFFSetField(tfdev->tif, TIFFTAG_SAMPLESPERPIXEL, 3);
tiff_set_compression((gx_device_printer *)tfdev, tfdev->tif,
- tfdev->Compression, tfdev->MaxStripSize);
+ tfdev->Compression, tfdev->MaxStripSize);
}
static int
@@ -116,14 +116,14 @@ tiff12_print_page(gx_device_printer * pdev, FILE * file)
/* open the TIFF device */
if (gdev_prn_file_is_new(pdev)) {
- tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
- if (!tfdev->tif)
- return_error(gs_error_invalidfileaccess);
+ tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
+ if (!tfdev->tif)
+ return_error(gs_error_invalidfileaccess);
}
code = gdev_tiff_begin_page(tfdev, file);
if (code < 0)
- return code;
+ return code;
TIFFSetField(tfdev->tif, TIFFTAG_BITSPERSAMPLE, 4);
tiff_set_rgb_fields(tfdev);
@@ -132,36 +132,36 @@ tiff12_print_page(gx_device_printer * pdev, FILE * file)
/* Write the page data. */
{
- int y;
- int size = gdev_prn_raster(pdev);
- byte *data = gs_alloc_bytes(pdev->memory, size, "tiff12_print_page");
-
- if (data == 0)
- return_error(gs_error_VMerror);
-
- memset(data, 0, size);
-
- for (y = 0; y < pdev->height; ++y) {
- const byte *src;
- byte *dest;
- int x;
-
- code = gdev_prn_copy_scan_lines(pdev, y, data, size);
- if (code < 0)
- break;
-
- for (src = data, dest = data, x = 0; x < size;
- src += 6, dest += 3, x += 6
- ) {
- dest[0] = (src[0] & 0xf0) | (src[1] >> 4);
- dest[1] = (src[2] & 0xf0) | (src[3] >> 4);
- dest[2] = (src[4] & 0xf0) | (src[5] >> 4);
- }
- TIFFWriteScanline(tfdev->tif, data, y, 0);
- }
- gs_free_object(pdev->memory, data, "tiff12_print_page");
-
- TIFFWriteDirectory(tfdev->tif);
+ int y;
+ int size = gdev_prn_raster(pdev);
+ byte *data = gs_alloc_bytes(pdev->memory, size, "tiff12_print_page");
+
+ if (data == 0)
+ return_error(gs_error_VMerror);
+
+ memset(data, 0, size);
+
+ for (y = 0; y < pdev->height; ++y) {
+ const byte *src;
+ byte *dest;
+ int x;
+
+ code = gdev_prn_copy_scan_lines(pdev, y, data, size);
+ if (code < 0)
+ break;
+
+ for (src = data, dest = data, x = 0; x < size;
+ src += 6, dest += 3, x += 6
+ ) {
+ dest[0] = (src[0] & 0xf0) | (src[1] >> 4);
+ dest[1] = (src[2] & 0xf0) | (src[3] >> 4);
+ dest[2] = (src[4] & 0xf0) | (src[5] >> 4);
+ }
+ TIFFWriteScanline(tfdev->tif, data, y, 0);
+ }
+ gs_free_object(pdev->memory, data, "tiff12_print_page");
+
+ TIFFWriteDirectory(tfdev->tif);
}
return code;
@@ -175,17 +175,17 @@ tiff_rgb_print_page(gx_device_printer * pdev, FILE * file)
/* open the TIFF device */
if (gdev_prn_file_is_new(pdev)) {
- tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
- if (!tfdev->tif)
- return_error(gs_error_invalidfileaccess);
+ tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
+ if (!tfdev->tif)
+ return_error(gs_error_invalidfileaccess);
}
code = gdev_tiff_begin_page(tfdev, file);
if (code < 0)
- return code;
+ return code;
TIFFSetField(tfdev->tif, TIFFTAG_BITSPERSAMPLE,
- pdev->color_info.depth / pdev->color_info.num_components);
+ pdev->color_info.depth / pdev->color_info.num_components);
tiff_set_rgb_fields(tfdev);
/* Write the page data. */
diff --git a/gs/base/gdevtifs.c b/gs/base/gdevtifs.c
index 2bb3725b4..cc6c60e48 100644
--- a/gs/base/gdevtifs.c
+++ b/gs/base/gdevtifs.c
@@ -808,7 +808,6 @@ cleanup:
return code;
}
-
static struct compression_string {
uint16 id;
const char *str;
@@ -856,4 +855,3 @@ int tiff_compression_allowed(uint16 compression, byte depth)
compression != COMPRESSION_CCITTFAX4);
}
-
diff --git a/gs/base/gdevtifs.h b/gs/base/gdevtifs.h
index eacba402a..087548ead 100644
--- a/gs/base/gdevtifs.h
+++ b/gs/base/gdevtifs.h
@@ -18,8 +18,8 @@
# define gdevtifs_INCLUDED
#include <tiffio.h> /* must be first, because gdevio.h re-#defines "printf"
- which is used in a function __attribute__ by
- tiffio.h */
+ which is used in a function __attribute__ by
+ tiffio.h */
#include "gdevprn.h"
/* ================ Implementation ================ */
@@ -63,9 +63,9 @@ int tiff_downscale_and_print_page(gx_device_printer *dev, TIFF *tif,
#define TIFF_DEFAULT_DOWNSCALE 1
int tiff_set_compression(gx_device_printer *pdev,
- TIFF *tif,
- uint compression,
- long max_strip_size);
+ TIFF *tif,
+ uint compression,
+ long max_strip_size);
int tiff_set_fields_for_printer(gx_device_printer *pdev, TIFF *tif, int factor,
int adjustWidth);
diff --git a/gs/base/gdevtknk.c b/gs/base/gdevtknk.c
index 35f3c5fd6..5804e92a2 100644
--- a/gs/base/gdevtknk.c
+++ b/gs/base/gdevtknk.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -12,7 +12,7 @@
*/
/* $Id$*/
-/*
+/*
This driver is written for Tektronix ink-jet 4696 and 4695 plotters.
It may easily be adopted to the 4393 and 4394 models as well, simply by
@@ -24,7 +24,6 @@
/* Thanks to Karsten Spang (spang@nbivax.nbi.dk) for contributing */
/* this code to Aladdin Enterprises. */
-
/* The device descriptor */
/* We need our own color mapping procedures. */
static dev_proc_map_rgb_color(tekink_map_rgb_color);
@@ -32,13 +31,12 @@ static dev_proc_map_color_rgb(tekink_map_color_rgb);
static dev_proc_print_page(tekink_print_page);
static gx_device_procs tekink_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- tekink_map_rgb_color, tekink_map_color_rgb);
-
+ tekink_map_rgb_color, tekink_map_color_rgb);
-/*
+/*
Device descriptor for the Tek 4696.
The 4696 plotter uses roll media, thus the y size is arbitrary. The
- value below is chosen to make the image area A*-format like, i.e. the
+ value below is chosen to make the image area A*-format like, i.e. the
aspect ratio is close to sqrt(2).
*/
const gx_device_printer far_data gs_tek4696_device =
@@ -50,7 +48,7 @@ const gx_device_printer far_data gs_tek4696_device =
tekink_print_page);
/* Color mapping.
- The tek inkjets use subtractive colors B=0 M=1 Y=2 C=3. These are
+ The tek inkjets use subtractive colors B=0 M=1 Y=2 C=3. These are
represented as 4 bits B=1 M=2 Y=4 C=8 in a byte. This gives:
White = 0
Black = 1
@@ -61,7 +59,7 @@ const gx_device_printer far_data gs_tek4696_device =
Blue = 10
Green = 12
The remaining values are unused. (They give ugly results if sent to the
- plotter.) Of course this could have been compressed into 3 bits, but
+ plotter.) Of course this could have been compressed into 3 bits, but
as the palette color memory device uses 8 bits anyway, this is easier,
and perhaps faster.
*/
@@ -93,9 +91,9 @@ tekink_map_rgb_color(gx_device *dev, const gx_color_value cv[])
gx_color_value r = cv[0];
gx_color_value g = cv[1];
gx_color_value b = cv[2];
-
- return(rgb_to_index[(((b>32767) << 2) + ((g>32767) << 1) +
- (r>32767)) & 7]);
+
+ return(rgb_to_index[(((b>32767) << 2) + ((g>32767) << 1) +
+ (r>32767)) & 7]);
}
/* Map the printer color back to RGB. */
@@ -107,7 +105,7 @@ tekink_map_color_rgb(gx_device *dev, gx_color_index color, ushort prgb[3])
if (c>15) return -1;
if (index_to_rgb[c][0]==2) return -1;
for (i=0;i<3;i++){
- prgb[i]=index_to_rgb[c][i];
+ prgb[i]=index_to_rgb[c][i];
}
return 0;
}
@@ -118,18 +116,18 @@ tekink_print_page(gx_device_printer *pdev,FILE *prn_stream)
{
int line_size,color_line_size,scan_line,num_bytes,scan_lines,color_plane;
int roll_paper,out_line,micro_line,pending_micro_lines,line_blank,
- blank_lines;
+ blank_lines;
byte *outdata,*indata1,*bdata1,*mdata1,*ydata1,*cdata1;
register byte *indata,*bdatap,*mdatap,*ydatap,*cdatap;
register byte bdata,mdata,ydata,cdata;
register byte mask,inbyte;
register byte *indataend,*outdataend;
-
+
/* Allocate a temporary buffer for color separation.
The buffer is partitioned into an input buffer and four
output buffers for the color planes. The output buffers
are allocated with an extra sentinel byte. */
-
+
line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
color_line_size=(pdev->width+7)/8;
indata1=(byte *)malloc(line_size+4*(color_line_size+1));
@@ -143,25 +141,25 @@ tekink_print_page(gx_device_printer *pdev,FILE *prn_stream)
/* Does this device use roll paper? */
roll_paper=!strcmp(pdev->dname,"tek4696");
-
+
out_line=0;
blank_lines=0;
scan_lines=pdev->height;
for (scan_line=0;scan_line<scan_lines;scan_line++){
- /* get data */
- gdev_prn_copy_scan_lines(pdev,scan_line,indata1,line_size);
- /* Separate data into color planes */
- bdatap = bdata1+1;
- mdatap = mdata1+1;
- ydatap = ydata1+1;
- cdatap = cdata1+1;
- bdata=0;
- mdata=0;
- cdata=0;
- ydata=0;
- mask=0x80;
- memset(indataend,0,4*(color_line_size+1));
- for (indata=indata1;indata<indataend;indata++){
+ /* get data */
+ gdev_prn_copy_scan_lines(pdev,scan_line,indata1,line_size);
+ /* Separate data into color planes */
+ bdatap = bdata1+1;
+ mdatap = mdata1+1;
+ ydatap = ydata1+1;
+ cdatap = cdata1+1;
+ bdata=0;
+ mdata=0;
+ cdata=0;
+ ydata=0;
+ mask=0x80;
+ memset(indataend,0,4*(color_line_size+1));
+ for (indata=indata1;indata<indataend;indata++){
inbyte = *indata;
if (inbyte&0x01) bdata|=mask;
if (inbyte&0x02) mdata|=mask;
@@ -169,84 +167,84 @@ tekink_print_page(gx_device_printer *pdev,FILE *prn_stream)
if (inbyte&0x08) cdata|=mask;
mask>>=1;
if (!mask){
- *(bdatap++) = bdata;
- *(mdatap++) = mdata;
- *(cdatap++) = cdata;
- *(ydatap++) = ydata;
- bdata=0;
- mdata=0;
- cdata=0;
- ydata=0;
- mask=0x80;
+ *(bdatap++) = bdata;
+ *(mdatap++) = mdata;
+ *(cdatap++) = cdata;
+ *(ydatap++) = ydata;
+ bdata=0;
+ mdata=0;
+ cdata=0;
+ ydata=0;
+ mask=0x80;
}
- }
- if (mask!=0x80){
+ }
+ if (mask!=0x80){
*bdatap = bdata;
*mdatap = mdata;
*cdatap = cdata;
*ydatap = ydata;
- }
- line_blank=1;
- /* Output each of the four color planes */
- for (color_plane=0;color_plane<4;color_plane++){
+ }
+ line_blank=1;
+ /* Output each of the four color planes */
+ for (color_plane=0;color_plane<4;color_plane++){
outdata=indataend+(color_plane*(color_line_size+1));
outdataend=outdata+color_line_size;
-
- /* Remove trailing spaces and output the color line if it is
+
+ /* Remove trailing spaces and output the color line if it is
not blank */
*outdata=0xff;
while (!(*outdataend)) outdataend--;
num_bytes=(outdataend-outdata);
if (num_bytes!=0){
- line_blank=0;
- /* On encountering the first non-blank data, output pending
- blank lines */
- if (blank_lines){
+ line_blank=0;
+ /* On encountering the first non-blank data, output pending
+ blank lines */
+ if (blank_lines){
pending_micro_lines=((out_line+blank_lines+1)/4)-
- (out_line/4);
+ (out_line/4);
for (micro_line=0;micro_line<pending_micro_lines;
- micro_line++){
- fputs("\033A",prn_stream);
+ micro_line++){
+ fputs("\033A",prn_stream);
}
out_line+=blank_lines;
blank_lines=0;
- }
- fprintf(prn_stream,"\033I%c%03d",'0'+(out_line%4)+
+ }
+ fprintf(prn_stream,"\033I%c%03d",'0'+(out_line%4)+
4*color_plane,num_bytes);
- fwrite(outdata+1,1,num_bytes,prn_stream);
+ fwrite(outdata+1,1,num_bytes,prn_stream);
}
- } /* loop over color planes */
-
- /* If this line is blank, and if it is a roll paper model,
+ } /* loop over color planes */
+
+ /* If this line is blank, and if it is a roll paper model,
count the line. Otherwise output the line */
- if (line_blank&&roll_paper){
- /* Only increment the blank line count, if non blank lines
+ if (line_blank&&roll_paper){
+ /* Only increment the blank line count, if non blank lines
have been encountered previously, i.e. skip leading blank
lines. */
if (out_line) blank_lines++;
- }
- else{
+ }
+ else{
if (out_line%4==3){
- /* Write micro line feed code */
- fputs("\033A",prn_stream);
+ /* Write micro line feed code */
+ fputs("\033A",prn_stream);
}
out_line++;
- }
+ }
} /* loop over scan lines */
-
- /* if the number of scan lines written is not a multiple of four,
+
+ /* if the number of scan lines written is not a multiple of four,
write the final micro line feed code */
if (out_line%4){
- fputs("\033A",prn_stream);
+ fputs("\033A",prn_stream);
}
/* Separate this plot from the next */
if (roll_paper){
- fputs("\n\n\n\n\n",prn_stream);
+ fputs("\n\n\n\n\n",prn_stream);
}
else{
- fputs("\f",prn_stream);
+ fputs("\f",prn_stream);
}
-
+
/* Deallocate temp buffer */
free(indata1);
return 0;
diff --git a/gs/base/gdevtrac.c b/gs/base/gdevtrac.c
index b432b0f2f..826f0f02f 100644
--- a/gs/base/gdevtrac.c
+++ b/gs/base/gdevtrac.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,35 +44,35 @@ trace_drawing_color(const char *prefix, const gx_drawing_color *pdcolor)
{
dprintf1("%scolor=", prefix);
if (pdcolor->type == gx_dc_type_none)
- dputs("none");
+ dputs("none");
else if (pdcolor->type == gx_dc_type_null)
- dputs("null");
+ dputs("null");
else if (pdcolor->type == gx_dc_type_pure)
- dprintf1("0x%lx", (ulong)pdcolor->colors.pure);
+ dprintf1("0x%lx", (ulong)pdcolor->colors.pure);
else if (pdcolor->type == gx_dc_type_ht_binary) {
- int ci = pdcolor->colors.binary.b_index;
-
- dprintf5("binary(0x%lx, 0x%lx, %d/%d, index=%d)",
- (ulong)pdcolor->colors.binary.color[0],
- (ulong)pdcolor->colors.binary.color[1],
- pdcolor->colors.binary.b_level,
- (ci < 0 ? pdcolor->colors.binary.b_ht->order.num_bits :
- pdcolor->colors.binary.b_ht->components[ci].corder.num_bits),
- ci);
+ int ci = pdcolor->colors.binary.b_index;
+
+ dprintf5("binary(0x%lx, 0x%lx, %d/%d, index=%d)",
+ (ulong)pdcolor->colors.binary.color[0],
+ (ulong)pdcolor->colors.binary.color[1],
+ pdcolor->colors.binary.b_level,
+ (ci < 0 ? pdcolor->colors.binary.b_ht->order.num_bits :
+ pdcolor->colors.binary.b_ht->components[ci].corder.num_bits),
+ ci);
} else if (pdcolor->type == gx_dc_type_ht_colored) {
- ulong plane_mask = pdcolor->colors.colored.plane_mask;
- int ci;
-
- dprintf1("colored(mask=%lu", plane_mask);
- for (ci = 0; plane_mask != 0; ++ci, plane_mask >>= 1)
- if (plane_mask & 1) {
- dprintf2(", (base=%u, level=%u)",
- pdcolor->colors.colored.c_base[ci],
- pdcolor->colors.colored.c_level[ci]);
- } else
- dputs(", -");
+ ulong plane_mask = pdcolor->colors.colored.plane_mask;
+ int ci;
+
+ dprintf1("colored(mask=%lu", plane_mask);
+ for (ci = 0; plane_mask != 0; ++ci, plane_mask >>= 1)
+ if (plane_mask & 1) {
+ dprintf2(", (base=%u, level=%u)",
+ pdcolor->colors.colored.c_base[ci],
+ pdcolor->colors.colored.c_level[ci]);
+ } else
+ dputs(", -");
} else {
- dputs("**unknown**");
+ dputs("**unknown**");
}
}
@@ -89,30 +89,30 @@ trace_path(const gx_path *path)
gx_path_enum_init(&penum, path);
for (;;) {
- gs_fixed_point pts[3];
-
- switch (gx_path_enum_next(&penum, pts)) {
- case gs_pe_moveto:
- dprintf2(" %g %g moveto\n", fixed2float(pts[0].x),
- fixed2float(pts[0].y));
- continue;
- case gs_pe_lineto:
- dprintf2(" %g %g lineto\n", fixed2float(pts[0].x),
- fixed2float(pts[0].y));
- continue;
- case gs_pe_curveto:
- dprintf6(" %g %g %g %g %g %g curveto\n", fixed2float(pts[0].x),
- fixed2float(pts[0].y), fixed2float(pts[1].x),
- fixed2float(pts[1].y), fixed2float(pts[2].x),
- fixed2float(pts[2].y));
- continue;
- case gs_pe_closepath:
- dputs(" closepath\n");
- continue;
- default:
- break;
- }
- break;
+ gs_fixed_point pts[3];
+
+ switch (gx_path_enum_next(&penum, pts)) {
+ case gs_pe_moveto:
+ dprintf2(" %g %g moveto\n", fixed2float(pts[0].x),
+ fixed2float(pts[0].y));
+ continue;
+ case gs_pe_lineto:
+ dprintf2(" %g %g lineto\n", fixed2float(pts[0].x),
+ fixed2float(pts[0].y));
+ continue;
+ case gs_pe_curveto:
+ dprintf6(" %g %g %g %g %g %g curveto\n", fixed2float(pts[0].x),
+ fixed2float(pts[0].y), fixed2float(pts[1].x),
+ fixed2float(pts[1].y), fixed2float(pts[2].x),
+ fixed2float(pts[2].y));
+ continue;
+ case gs_pe_closepath:
+ dputs(" closepath\n");
+ continue;
+ default:
+ break;
+ }
+ break;
}
}
@@ -120,17 +120,17 @@ static void
trace_clip(gx_device *dev, const gx_clip_path *pcpath)
{
if (pcpath == 0)
- return;
+ return;
if (gx_cpath_includes_rectangle(pcpath, fixed_0, fixed_0,
- int2fixed(dev->width),
- int2fixed(dev->height))
- )
- return;
+ int2fixed(dev->width),
+ int2fixed(dev->height))
+ )
+ return;
dputs(", clip={");
if (pcpath->path_valid)
- trace_path(&pcpath->path);
+ trace_path(&pcpath->path);
else
- dputs("NO PATH");
+ dputs("NO PATH");
dputs("}");
}
@@ -138,55 +138,55 @@ trace_clip(gx_device *dev, const gx_clip_path *pcpath)
static int
trace_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
dprintf5("fill_rectangle(%d, %d, %d, %d, 0x%lx)\n",
- x, y, w, h, (ulong)color);
+ x, y, w, h, (ulong)color);
return 0;
}
static int
trace_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
dprintf7("copy_mono(x=%d, y=%d, w=%d, h=%d, dx=%d, raster=%d, id=0x%lx,\n",
- x, y, w, h, dx, raster, (ulong)id);
+ x, y, w, h, dx, raster, (ulong)id);
dprintf2(" colors=(0x%lx,0x%lx))\n", (ulong)zero, (ulong)one);
return 0;
}
static int
trace_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
dprintf7("copy_color(x=%d, y=%d, w=%d, h=%d, dx=%d, raster=%d, id=0x%lx)\n",
- x, y, w, h, dx, raster, (ulong)id);
+ x, y, w, h, dx, raster, (ulong)id);
return 0;
}
static int
trace_copy_alpha(gx_device * dev, const byte * data, int dx, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
dprintf7("copy_alpha(x=%d, y=%d, w=%d, h=%d, dx=%d, raster=%d, id=0x%lx,\n",
- x, y, w, h, dx, raster, (ulong)id);
+ x, y, w, h, dx, raster, (ulong)id);
dprintf2(" color=0x%lx, depth=%d)\n", (ulong)color, depth);
return 0;
}
static int
trace_fill_mask(gx_device * dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
dprintf7("fill_mask(x=%d, y=%d, w=%d, h=%d, dx=%d, raster=%d, id=0x%lx,\n",
- x, y, w, h, dx, raster, (ulong)id);
+ x, y, w, h, dx, raster, (ulong)id);
trace_drawing_color(" ", pdcolor);
dprintf1(", depth=%d", depth);
trace_lop(lop);
@@ -197,11 +197,11 @@ trace_fill_mask(gx_device * dev,
static int
trace_fill_trapezoid(gx_device * dev,
- const gs_fixed_edge * left,
- const gs_fixed_edge * right,
- fixed ybot, fixed ytop, bool swap_axes,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ const gs_fixed_edge * left,
+ const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
dputs("**fill_trapezoid**\n");
return 0;
@@ -209,13 +209,13 @@ trace_fill_trapezoid(gx_device * dev,
static int
trace_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay,
- fixed bx, fixed by, const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay,
+ fixed bx, fixed by, const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
dprintf6("fill_parallelogram((%g,%g), (%g,%g), (%g,%g)",
- fixed2float(px), fixed2float(py), fixed2float(ax),
- fixed2float(ay), fixed2float(bx), fixed2float(by));
+ fixed2float(px), fixed2float(py), fixed2float(ax),
+ fixed2float(ay), fixed2float(bx), fixed2float(by));
trace_drawing_color(", ", pdcolor);
trace_lop(lop);
dputs(")\n");
@@ -224,13 +224,13 @@ trace_fill_parallelogram(gx_device * dev,
static int
trace_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop)
{
dprintf6("fill_triangle((%g,%g), (%g,%g), (%g,%g)",
- fixed2float(px), fixed2float(py), fixed2float(ax),
- fixed2float(ay), fixed2float(bx), fixed2float(by));
+ fixed2float(px), fixed2float(py), fixed2float(ax),
+ fixed2float(ay), fixed2float(bx), fixed2float(by));
trace_drawing_color(", ", pdcolor);
trace_lop(lop);
dputs(")\n");
@@ -239,14 +239,14 @@ trace_fill_triangle(gx_device * dev,
static int
trace_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_drawing_color * pdcolor,
- gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_drawing_color * pdcolor,
+ gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
dprintf4("draw_thin_line((%g,%g), (%g,%g)",
- fixed2float(fx0), fixed2float(fy0), fixed2float(fx1),
- fixed2float(fy1));
+ fixed2float(fx0), fixed2float(fy0), fixed2float(fx1),
+ fixed2float(fy1));
trace_drawing_color(", ", pdcolor);
trace_lop(lop);
dputs(")\n");
@@ -255,26 +255,26 @@ trace_draw_thin_line(gx_device * dev,
static int
trace_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1,
+ int px, int py)
{
dprintf6("strip_tile_rectangle(x=%d, y=%d, w=%d, h=%d, colors=(0x%lx,0x%lx),\n",
- x, y, w, h, (ulong)color0, (ulong)color1);
+ x, y, w, h, (ulong)color0, (ulong)color1);
dprintf8(" size=(%d,%d) shift %u, rep=(%u,%u) shift %u, phase=(%d,%d))\n",
- tiles->size.x, tiles->size.y, tiles->shift,
- tiles->rep_width, tiles->rep_height, tiles->rep_shift, px, py);
+ tiles->size.x, tiles->size.y, tiles->shift,
+ tiles->rep_width, tiles->rep_height, tiles->rep_shift, px, py);
return 0;
}
static int
trace_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
- uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
dputs("**strip_copy_rop**\n");
return 0;
@@ -284,16 +284,16 @@ trace_strip_copy_rop(gx_device * dev, const byte * sdata, int sourcex,
static int
trace_fill_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
dputs("fill_path({\n");
trace_path(ppath);
trace_drawing_color("}, ", pdcolor);
dprintf4(", rule=%d, adjust=(%g,%g), flatness=%g",
- params->rule, fixed2float(params->adjust.x),
- fixed2float(params->adjust.y), params->flatness);
+ params->rule, fixed2float(params->adjust.x),
+ fixed2float(params->adjust.y), params->flatness);
trace_clip(dev, pcpath);
/****** pis ******/
dputs(")\n");
@@ -302,9 +302,9 @@ trace_fill_path(gx_device * dev, const gs_imager_state * pis,
static int
trace_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
dputs("stroke_path({\n");
trace_path(ppath);
@@ -321,25 +321,25 @@ typedef struct trace_image_enum_s {
int rows_left;
} trace_image_enum_t;
gs_private_st_suffix_add0(st_trace_image_enum, trace_image_enum_t,
- "trace_image_enum_t", trace_image_enum_enum_ptrs,
- trace_image_enum_reloc_ptrs,
- st_gx_image_enum_common);
+ "trace_image_enum_t", trace_image_enum_enum_ptrs,
+ trace_image_enum_reloc_ptrs,
+ st_gx_image_enum_common);
static int
trace_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
trace_image_enum_t *pie = (trace_image_enum_t *)info;
int i;
dprintf1("image_plane_data(height=%d", height);
for (i = 0; i < pie->num_planes; ++i) {
- if (planes[i].data)
- dprintf4(", {depth=%d, width=%d, dx=%d, raster=%u}",
- pie->plane_depths[i], pie->plane_widths[i],
- planes[i].data_x, planes[i].raster);
- else
- dputs(", -");
+ if (planes[i].data)
+ dprintf4(", {depth=%d, width=%d, dx=%d, raster=%u}",
+ pie->plane_depths[i], pie->plane_widths[i],
+ planes[i].data_x, planes[i].raster);
+ else
+ dputs(", -");
}
dputs(")\n");
*rows_used = height;
@@ -358,53 +358,53 @@ static const gx_image_enum_procs_t trace_image_enum_procs = {
};
static int
trace_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
- const gs_matrix * pmat,
- const gs_image_common_t * pim,
- const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory,
- gx_image_enum_common_t ** pinfo)
+ const gs_matrix * pmat,
+ const gs_image_common_t * pim,
+ const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory,
+ gx_image_enum_common_t ** pinfo)
{
trace_image_enum_t *pie;
const gs_pixel_image_t *ppi = (const gs_pixel_image_t *)pim;
int ncomp;
dprintf7("begin_typed_image(type=%d, ImageMatrix=[%g %g %g %g %g %g]",
- pim->type->index, pim->ImageMatrix.xx, pim->ImageMatrix.xy,
- pim->ImageMatrix.yx, pim->ImageMatrix.yy,
- pim->ImageMatrix.tx, pim->ImageMatrix.ty);
+ pim->type->index, pim->ImageMatrix.xx, pim->ImageMatrix.xy,
+ pim->ImageMatrix.yx, pim->ImageMatrix.yy,
+ pim->ImageMatrix.tx, pim->ImageMatrix.ty);
switch (pim->type->index) {
case 1:
- if (((const gs_image1_t *)ppi)->ImageMask) {
- ncomp = 1;
- break;
- }
- /* falls through */
+ if (((const gs_image1_t *)ppi)->ImageMask) {
+ ncomp = 1;
+ break;
+ }
+ /* falls through */
case 4:
- ncomp = gs_color_space_num_components(ppi->ColorSpace);
- break;
+ ncomp = gs_color_space_num_components(ppi->ColorSpace);
+ break;
case 3:
- ncomp = gs_color_space_num_components(ppi->ColorSpace) + 1;
- break;
+ ncomp = gs_color_space_num_components(ppi->ColorSpace) + 1;
+ break;
case 2: /* no data */
- dputs(")\n");
- return 1;
+ dputs(")\n");
+ return 1;
default:
- goto dflt;
+ goto dflt;
}
pie = gs_alloc_struct(memory, trace_image_enum_t, &st_trace_image_enum,
- "trace_begin_typed_image");
+ "trace_begin_typed_image");
if (pie == 0)
- goto dflt;
+ goto dflt;
if (gx_image_enum_common_init((gx_image_enum_common_t *)pie,
- (const gs_data_image_t *)pim,
- &trace_image_enum_procs, dev, ncomp,
- ppi->format) < 0
- )
- goto dflt;
+ (const gs_data_image_t *)pim,
+ &trace_image_enum_procs, dev, ncomp,
+ ppi->format) < 0
+ )
+ goto dflt;
dprintf4("\n Width=%d, Height=%d, BPC=%d, num_components=%d)\n",
- ppi->Width, ppi->Height, ppi->BitsPerComponent, ncomp);
+ ppi->Width, ppi->Height, ppi->BitsPerComponent, ncomp);
pie->memory = memory;
pie->rows_left = ppi->Height;
*pinfo = (gx_image_enum_common_t *)pie;
@@ -412,7 +412,7 @@ trace_begin_typed_image(gx_device * dev, const gs_imager_state * pis,
dflt:
dputs(") DEFAULTED\n");
return gx_default_begin_typed_image(dev, pis, pmat, pim, prect, pdcolor,
- pcpath, memory, pinfo);
+ pcpath, memory, pinfo);
}
static int
@@ -426,19 +426,19 @@ static const gs_text_enum_procs_t trace_text_procs = {
};
static int
trace_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * memory,
- gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * memory,
+ gs_text_enum_t ** ppenum)
{
static const char *const tags[sizeof(text->operation) * 8] = {
- "FROM_STRING", "FROM_BYTES", "FROM_CHARS", "FROM_GLYPHS",
- "FROM_SINGLE_CHAR", "FROM_SINGLE_GLYPH",
- "ADD_TO_ALL_WIDTHS", "ADD_TO_SPACE_WIDTH",
- "REPLACE_WIDTHS", "DO_NONE", "DO_DRAW", "DO_CHARWIDTH",
- "DO_FALSE_CHARPATH", "DO_TRUE_CHARPATH",
- "DO_FALSE_CHARBOXPATH", "DO_TRUE_CHARBOXPATH",
- "INTERVENE", "RETURN_WIDTH"
+ "FROM_STRING", "FROM_BYTES", "FROM_CHARS", "FROM_GLYPHS",
+ "FROM_SINGLE_CHAR", "FROM_SINGLE_GLYPH",
+ "ADD_TO_ALL_WIDTHS", "ADD_TO_SPACE_WIDTH",
+ "REPLACE_WIDTHS", "DO_NONE", "DO_DRAW", "DO_CHARWIDTH",
+ "DO_FALSE_CHARPATH", "DO_TRUE_CHARPATH",
+ "DO_FALSE_CHARBOXPATH", "DO_TRUE_CHARBOXPATH",
+ "INTERVENE", "RETURN_WIDTH"
};
int i;
gs_text_enum_t *pte;
@@ -446,128 +446,128 @@ trace_text_begin(gx_device * dev, gs_imager_state * pis,
dputs("text_begin(");
for (i = 0; i < countof(tags); ++i)
- if (text->operation & (1 << i)) {
- if (tags[i])
- dprintf1("%s ", tags[i]);
- else
- dprintf1("%d? ", i);
- }
+ if (text->operation & (1 << i)) {
+ if (tags[i])
+ dprintf1("%s ", tags[i]);
+ else
+ dprintf1("%d? ", i);
+ }
dprintf1("font=%s\n text=(", font->font_name.chars);
if (text->operation & TEXT_FROM_SINGLE_CHAR)
- dprintf1("0x%lx", (ulong)text->data.d_char);
+ dprintf1("0x%lx", (ulong)text->data.d_char);
else if (text->operation & TEXT_FROM_SINGLE_GLYPH)
- dprintf1("0x%lx", (ulong)text->data.d_glyph);
+ dprintf1("0x%lx", (ulong)text->data.d_glyph);
else
- for (i = 0; i < text->size; ++i) {
- if (text->operation & TEXT_FROM_STRING)
- dputc(text->data.bytes[i]);
- else
- dprintf1("0x%lx ",
- (text->operation & TEXT_FROM_GLYPHS ?
- (ulong)text->data.glyphs[i] :
- (ulong)text->data.chars[i]));
+ for (i = 0; i < text->size; ++i) {
+ if (text->operation & TEXT_FROM_STRING)
+ dputc(text->data.bytes[i]);
+ else
+ dprintf1("0x%lx ",
+ (text->operation & TEXT_FROM_GLYPHS ?
+ (ulong)text->data.glyphs[i] :
+ (ulong)text->data.chars[i]));
}
dprintf1(")\n size=%u", text->size);
if (text->operation & TEXT_ADD_TO_ALL_WIDTHS)
- dprintf2(", delta_all=(%g,%g)", text->delta_all.x, text->delta_all.y);
+ dprintf2(", delta_all=(%g,%g)", text->delta_all.x, text->delta_all.y);
if (text->operation & TEXT_ADD_TO_SPACE_WIDTH) {
- dprintf3(", space=0x%lx, delta_space=(%g,%g)",
- (text->operation & TEXT_FROM_GLYPHS ?
- (ulong)text->space.s_glyph : (ulong)text->space.s_char),
- text->delta_space.x, text->delta_space.y);
+ dprintf3(", space=0x%lx, delta_space=(%g,%g)",
+ (text->operation & TEXT_FROM_GLYPHS ?
+ (ulong)text->space.s_glyph : (ulong)text->space.s_char),
+ text->delta_space.x, text->delta_space.y);
}
if (text->operation & TEXT_REPLACE_WIDTHS) {
- dputs("\n widths=");
- for (i = 0; i < text->widths_size; ++i) {
- if (text->x_widths)
- dprintf1("(%g,", text->x_widths[i]);
- else
- dputs("(,");
- if (text->y_widths)
- dprintf1("%g)",
- (text->y_widths == text->x_widths ?
- text->y_widths[++i] : text->y_widths[i]));
- else
- dputs(")");
- }
+ dputs("\n widths=");
+ for (i = 0; i < text->widths_size; ++i) {
+ if (text->x_widths)
+ dprintf1("(%g,", text->x_widths[i]);
+ else
+ dputs("(,");
+ if (text->y_widths)
+ dprintf1("%g)",
+ (text->y_widths == text->x_widths ?
+ text->y_widths[++i] : text->y_widths[i]));
+ else
+ dputs(")");
+ }
}
if (text->operation & TEXT_DO_DRAW)
- trace_drawing_color(", ", pdcolor);
+ trace_drawing_color(", ", pdcolor);
/*
* We can't do it if CHAR*PATH or INTERVENE, or if (RETURN_WIDTH and not
* REPLACE_WIDTHS and we can't get the widths from the font).
*/
if (text->operation &
- (TEXT_DO_FALSE_CHARPATH | TEXT_DO_TRUE_CHARPATH |
- TEXT_DO_FALSE_CHARBOXPATH | TEXT_DO_TRUE_CHARBOXPATH |
- TEXT_INTERVENE)
- )
- goto dflt;
+ (TEXT_DO_FALSE_CHARPATH | TEXT_DO_TRUE_CHARPATH |
+ TEXT_DO_FALSE_CHARBOXPATH | TEXT_DO_TRUE_CHARBOXPATH |
+ TEXT_INTERVENE)
+ )
+ goto dflt;
rc_alloc_struct_1(pte, gs_text_enum_t, &st_gs_text_enum, memory,
- goto dflt, "trace_text_begin");
+ goto dflt, "trace_text_begin");
code = gs_text_enum_init(pte, &trace_text_procs, dev, pis, text, font,
- path, pdcolor, pcpath, memory);
+ path, pdcolor, pcpath, memory);
if (code < 0)
- goto dfree;
+ goto dfree;
if ((text->operation & (TEXT_DO_CHARWIDTH | TEXT_RETURN_WIDTH)) &&
- !(text->operation & TEXT_REPLACE_WIDTHS)
- ) {
- /*
- * Get the widths from the font. This code is mostly copied from
- * the pdfwrite driver, and should probably be shared with it.
- * ****** WRONG IF Type 0 FONT ******
- */
- int i;
- gs_point w;
- double scale = (font->FontType == ft_TrueType ? 0.001 : 1.0);
- gs_fixed_point origin;
- gs_point dpt;
- int num_spaces = 0;
-
- if (!(text->operation & TEXT_FROM_STRING))
- goto dfree; /* can't handle yet */
- if (gx_path_current_point(path, &origin) < 0)
- goto dfree;
- w.x = 0, w.y = 0;
- for (i = 0; i < text->size; ++i) {
- gs_char ch = text->data.bytes[i];
- int wmode = font->WMode;
- gs_glyph glyph =
- ((gs_font_base *)font)->procs.encode_char(font, ch,
- GLYPH_SPACE_NAME);
- gs_glyph_info_t info;
-
- if (glyph != gs_no_glyph &&
- (code = font->procs.glyph_info(font, glyph, NULL,
- GLYPH_INFO_WIDTH0 << wmode,
- &info)) >= 0
- ) {
- w.x += info.width[wmode].x;
- w.y += info.width[wmode].y;
- } else
- goto dfree;
- if (ch == text->space.s_char)
- ++num_spaces;
- }
- gs_distance_transform(w.x * scale, w.y * scale,
- &font->FontMatrix, &dpt);
- if (text->operation & TEXT_ADD_TO_ALL_WIDTHS) {
- int num_chars = text->size;
-
- dpt.x += text->delta_all.x * num_chars;
- dpt.y += text->delta_all.y * num_chars;
- }
- if (text->operation & TEXT_ADD_TO_SPACE_WIDTH) {
- dpt.x += text->delta_space.x * num_spaces;
- dpt.y += text->delta_space.y * num_spaces;
- }
- pte->returned.total_width = dpt;
- gs_distance_transform(dpt.x, dpt.y, &ctm_only(pis), &dpt);
- code = gx_path_add_point(path,
- origin.x + float2fixed(dpt.x),
- origin.y + float2fixed(dpt.y));
- if (code < 0)
- goto dfree;
+ !(text->operation & TEXT_REPLACE_WIDTHS)
+ ) {
+ /*
+ * Get the widths from the font. This code is mostly copied from
+ * the pdfwrite driver, and should probably be shared with it.
+ * ****** WRONG IF Type 0 FONT ******
+ */
+ int i;
+ gs_point w;
+ double scale = (font->FontType == ft_TrueType ? 0.001 : 1.0);
+ gs_fixed_point origin;
+ gs_point dpt;
+ int num_spaces = 0;
+
+ if (!(text->operation & TEXT_FROM_STRING))
+ goto dfree; /* can't handle yet */
+ if (gx_path_current_point(path, &origin) < 0)
+ goto dfree;
+ w.x = 0, w.y = 0;
+ for (i = 0; i < text->size; ++i) {
+ gs_char ch = text->data.bytes[i];
+ int wmode = font->WMode;
+ gs_glyph glyph =
+ ((gs_font_base *)font)->procs.encode_char(font, ch,
+ GLYPH_SPACE_NAME);
+ gs_glyph_info_t info;
+
+ if (glyph != gs_no_glyph &&
+ (code = font->procs.glyph_info(font, glyph, NULL,
+ GLYPH_INFO_WIDTH0 << wmode,
+ &info)) >= 0
+ ) {
+ w.x += info.width[wmode].x;
+ w.y += info.width[wmode].y;
+ } else
+ goto dfree;
+ if (ch == text->space.s_char)
+ ++num_spaces;
+ }
+ gs_distance_transform(w.x * scale, w.y * scale,
+ &font->FontMatrix, &dpt);
+ if (text->operation & TEXT_ADD_TO_ALL_WIDTHS) {
+ int num_chars = text->size;
+
+ dpt.x += text->delta_all.x * num_chars;
+ dpt.y += text->delta_all.y * num_chars;
+ }
+ if (text->operation & TEXT_ADD_TO_SPACE_WIDTH) {
+ dpt.x += text->delta_space.x * num_spaces;
+ dpt.y += text->delta_space.y * num_spaces;
+ }
+ pte->returned.total_width = dpt;
+ gs_distance_transform(dpt.x, dpt.y, &ctm_only(pis), &dpt);
+ code = gx_path_add_point(path,
+ origin.x + float2fixed(dpt.x),
+ origin.y + float2fixed(dpt.y));
+ if (code < 0)
+ goto dfree;
}
dputs(")\n");
*ppenum = pte;
@@ -577,20 +577,20 @@ trace_text_begin(gx_device * dev, gs_imager_state * pis,
dflt:
dputs(") DEFAULTED\n");
return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
- pcpath, memory, ppenum);
+ pcpath, memory, ppenum);
}
/* ---------------- The device definition ---------------- */
#define TRACE_DEVICE_BODY(dname, ncomp, depth, map_rgb_color, map_color_rgb, map_cmyk_color, map_rgb_alpha_color)\
std_device_dci_body(gx_device, 0, dname,\
- DEFAULT_WIDTH_10THS * X_DPI / 10,\
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
- X_DPI, Y_DPI, ncomp, depth,\
- (1 << (depth / ncomp)) - 1,\
- (ncomp > 1 ? (1 << (depth / ncomp)) - 1 : 0),\
- 1 << (depth / ncomp),\
- (ncomp > 1 ? 1 << (depth / ncomp) : 1)),\
+ DEFAULT_WIDTH_10THS * X_DPI / 10,\
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
+ X_DPI, Y_DPI, ncomp, depth,\
+ (1 << (depth / ncomp)) - 1,\
+ (ncomp > 1 ? (1 << (depth / ncomp)) - 1 : 0),\
+ 1 << (depth / ncomp),\
+ (ncomp > 1 ? 1 << (depth / ncomp) : 1)),\
{\
NULL, /* open_device */\
NULL, /* get_initial_matrix */\
@@ -636,22 +636,22 @@ trace_text_begin(gx_device * dev, gs_imager_state * pis,
NULL, /* get_hardware_params */\
trace_text_begin,\
NULL /* finish_copydevice */\
-}
+}
const gx_device gs_tr_mono_device = {
TRACE_DEVICE_BODY("tr_mono", 1, 1,
- gx_default_b_w_map_rgb_color,
- gx_default_b_w_map_color_rgb, NULL, NULL)
+ gx_default_b_w_map_rgb_color,
+ gx_default_b_w_map_color_rgb, NULL, NULL)
};
const gx_device gs_tr_rgb_device = {
TRACE_DEVICE_BODY("tr_rgb", 3, 24,
- gx_default_rgb_map_rgb_color,
- gx_default_rgb_map_color_rgb, NULL, NULL)
+ gx_default_rgb_map_rgb_color,
+ gx_default_rgb_map_color_rgb, NULL, NULL)
};
const gx_device gs_tr_cmyk_device = {
TRACE_DEVICE_BODY("tr_cmyk", 4, 4,
- NULL, cmyk_1bit_map_color_rgb,
- cmyk_1bit_map_cmyk_color, NULL)
+ NULL, cmyk_1bit_map_color_rgb,
+ cmyk_1bit_map_cmyk_color, NULL)
};
diff --git a/gs/base/gdevtsep.c b/gs/base/gdevtsep.c
index 8911ffac9..f143574ae 100644
--- a/gs/base/gdevtsep.c
+++ b/gs/base/gdevtsep.c
@@ -99,7 +99,6 @@ const gx_device_tiff gs_tiffscaled_device = {
1 /* MinFeatureSize */
};
-
/* ------ Private functions ------ */
static void
@@ -334,7 +333,7 @@ RELOC_PTRS_END
static void
tiffsep_device_finalize(void *vpdev)
{
- /* We need to deallocate the compressed_color_list.
+ /* We need to deallocate the compressed_color_list.
and the names. */
devn_free_params((gx_device*) vpdev);
gx_device_finalize(vpdev);
@@ -411,7 +410,6 @@ gs_private_st_composite_final(st_tiffsep_device, tiffsep_device,
tiffsep_ret_devn_params /* ret_devn_params */\
}
-
#define tiffsep_devices_body(dtype, procs, dname, ncomp, pol, depth, mg, mc, sl, cn, print_page, compr)\
std_device_full_body_type_extended(dtype, &procs, dname,\
&st_tiffsep_device,\
@@ -858,7 +856,6 @@ tiffsep1_prn_close(gx_device * pdev)
return 0;
}
-
static int
sep1_fill_path(gx_device * pdev, const gs_imager_state * pis,
gx_path * ppath, const gx_fill_params * params,
@@ -1657,7 +1654,6 @@ tiffsep1_print_page(gx_device_printer * pdev, FILE * file)
} /* end initialization of separation files */
-
{ /* Get the expanded contone line, halftone and write out the dithered separations */
int raster = gdev_prn_raster(pdev);
int width = tfdev->width;
diff --git a/gs/base/gdevtxtw.c b/gs/base/gdevtxtw.c
index d4d3aa431..e334c3f03 100644
--- a/gs/base/gdevtxtw.c
+++ b/gs/base/gdevtxtw.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 artofcode LLC.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,10 +64,10 @@ const gx_device_txtwrite_t gs_txtwrite_device =
{
/* Define the device as 8-bit gray scale to avoid computing halftones. */
std_device_dci_body(gx_device_txtwrite_t, 0, "txtwrite",
- DEFAULT_WIDTH_10THS * X_DPI / 10,
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,
- X_DPI, Y_DPI,
- 1, 8, 255, 0, 256, 1),
+ DEFAULT_WIDTH_10THS * X_DPI / 10,
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,
+ X_DPI, Y_DPI,
+ 1, 8, 255, 0, 256, 1),
{txtwrite_open_device,
gx_upright_get_initial_matrix,
gx_default_sync_output,
@@ -139,7 +139,7 @@ txtwrite_open_device(gx_device * dev)
if (tdev->fname[0] == 0)
return_error(gs_error_undefinedfilename);
code = gx_device_open_output_file(dev, tdev->fname,
- true, false, &tdev->file); /* binary, sequential */
+ true, false, &tdev->file); /* binary, sequential */
if (code < 0)
return code;
return 0;
@@ -165,30 +165,30 @@ txtwrite_output_page(gx_device * dev, int num_copies, int flush)
static int
txtwrite_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
return 0;
}
static int
txtwrite_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
return 0;
}
static int
txtwrite_copy_mono(gx_device * dev, const byte * data, int dx, int raster,
- gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
return 0;
}
static int
txtwrite_copy_color(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height)
{
return 0;
}
@@ -196,20 +196,20 @@ txtwrite_copy_color(gx_device * dev, const byte * data,
static int
txtwrite_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
+ int px, int py)
{
return 0;
}
static int
txtwrite_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster,
- gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures,
- const gx_color_index * tcolors,
- int x, int y, int w, int h,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster,
+ gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int w, int h,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return 0;
}
@@ -247,42 +247,42 @@ txtwrite_put_params(gx_device * dev, gs_param_list * plist)
gs_param_string ofs;
switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofs)) {
- case 0:
- if (dev->LockSafetyParams &&
- bytes_compare(ofs.data, ofs.size,
- (const byte *)tdev->fname, strlen(tdev->fname))) {
- ecode = gs_note_error(gs_error_invalidaccess);
- goto ofe;
- }
- if (ofs.size >= gp_file_name_sizeof)
- ecode = gs_error_limitcheck;
- else
- break;
- goto ofe;
- default:
- ecode = code;
- ofe:param_signal_error(plist, param_name, ecode);
- case 1:
- ofs.data = 0;
- break;
+ case 0:
+ if (dev->LockSafetyParams &&
+ bytes_compare(ofs.data, ofs.size,
+ (const byte *)tdev->fname, strlen(tdev->fname))) {
+ ecode = gs_note_error(gs_error_invalidaccess);
+ goto ofe;
+ }
+ if (ofs.size >= gp_file_name_sizeof)
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto ofe;
+ default:
+ ecode = code;
+ ofe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ ofs.data = 0;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gx_default_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
if (ofs.data != 0) { /* Close the file if it's open. */
- if (tdev->file != 0) {
- fclose(tdev->file);
- tdev->file = 0;
- }
- memcpy(tdev->fname, ofs.data, ofs.size);
- tdev->fname[ofs.size] = 0;
- tdev->file = fopen(tdev->fname, "wb");
- if (tdev->file == 0)
- return_error(gs_error_ioerror);
+ if (tdev->file != 0) {
+ fclose(tdev->file);
+ tdev->file = 0;
+ }
+ memcpy(tdev->fname, ofs.data, ofs.size);
+ tdev->fname[ofs.size] = 0;
+ tdev->file = fopen(tdev->fname, "wb");
+ if (tdev->file == 0)
+ return_error(gs_error_ioerror);
}
return 0;
}
@@ -291,35 +291,35 @@ txtwrite_put_params(gx_device * dev, gs_param_list * plist)
static int
txtwrite_fill_trapezoid(gx_device * dev,
- const gs_fixed_edge * left, const gs_fixed_edge * right,
- fixed ybot, fixed ytop, bool swap_axes,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ const gs_fixed_edge * left, const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
return 0;
}
static int
txtwrite_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay,
- fixed bx, fixed by, const gx_device_color * pdevc,
- gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay,
+ fixed bx, fixed by, const gx_device_color * pdevc,
+ gs_logical_operation_t lop)
{
return 0;
}
static int
txtwrite_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
return 0;
}
static int
txtwrite_draw_thin_line(gx_device * dev,
- fixed fx0, fixed fy0, fixed fx1, fixed fy1,
- const gx_device_color * pdevc, gs_logical_operation_t lop,
- fixed adjustx, fixed adjusty)
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_device_color * pdevc, gs_logical_operation_t lop,
+ fixed adjustx, fixed adjusty)
{
return 0;
}
@@ -328,37 +328,37 @@ txtwrite_draw_thin_line(gx_device * dev,
static int
txtwrite_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_fill_params * params, const gx_device_color * pdevc,
- const gx_clip_path * pcpath)
+ const gx_fill_params * params, const gx_device_color * pdevc,
+ const gx_clip_path * pcpath)
{
- return 0;
+ return 0;
}
static int
txtwrite_stroke_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_stroke_params * params,
- const gx_drawing_color * pdevc, const gx_clip_path * pcpath)
+ const gx_stroke_params * params,
+ const gx_drawing_color * pdevc, const gx_clip_path * pcpath)
{
return 0;
}
static int
txtwrite_fill_mask(gx_device * dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
return 0;
}
static int
txtwrite_begin_typed_image(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
{
return 0;
}
@@ -367,14 +367,13 @@ txtwrite_begin_typed_image(gx_device * dev,
static int
txtwrite_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, const gx_device_color * pdcolor,
- const gx_clip_path * pcpath,
- gs_memory_t * memory, gs_text_enum_t ** ppenum)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, const gx_device_color * pdcolor,
+ const gx_clip_path * pcpath,
+ gs_memory_t * memory, gs_text_enum_t ** ppenum)
{
int code = gx_default_text_begin(dev, pis, text, font, path, pdcolor,
- pcpath, memory, ppenum);
+ pcpath, memory, ppenum);
return code;
}
-
diff --git a/gs/base/gdevupd.c b/gs/base/gdevupd.c
index d2b155008..52c744006 100644
--- a/gs/base/gdevupd.c
+++ b/gs/base/gdevupd.c
@@ -271,7 +271,6 @@ upd_device far_data gs_uniprint_device = { /** */
NULL /** upd-field: Initially none */
}; /** */
-
/* ------------------------------------------------------------------- */
/* UPD-Data- and Prototypes */
/* ------------------------------------------------------------------- */
@@ -616,7 +615,6 @@ typedef struct updcmap_s { /** */
} updcmap_t, *updcmap_p; /** */
typedef const updcmap_t *updcmap_pc;
-
/**
"updcomp" holds similar informations, but is used for the rendering
*/
@@ -640,7 +638,6 @@ typedef struct updscan_s { /* Single Scanline (1 Bit/Pixel) */
int *xend; /* last Pixel set (or -1, if none) */
} updscan_t, *updscan_p; /* Single Scanline (1 Bit/Pixel) */
-
/** Main upd-Structure ***/
#define UPD_CMAP_MAX 4 /** Number of Colormaps provided */
@@ -715,7 +712,6 @@ struct upd_s { /* All upd-specific data */
const gs_memory_t *memory; /* Memory pointer - for errprintf */
}; /* All upd-specific data */
-
/* ------------------------------------------------------------------- */
/* Various Message-Levels */
/* ------------------------------------------------------------------- */
@@ -863,7 +859,6 @@ The seventh writer is for ESC P/2 Nozzle Map Mode (currently Stylus Color 300) (
static int upd_wrtescnm( upd_p upd, FILE *out);
-
/**
Generalized Pixel Get & Read
*/
@@ -961,7 +956,7 @@ Here are several Macros, named "UPD_MM_*" to deal with that.
uint iii; \
To.size = From.size; \
for(iii = 0; To.size > iii; ++iii) \
- UPD_MM_CPY_PARAM(mem, tmp2[iii],From.data[iii]); \
+ UPD_MM_CPY_PARAM(mem, tmp2[iii],From.data[iii]); \
} \
}
@@ -1002,7 +997,6 @@ upd_signal_handler(int sig)
}
#endif
-
/* ------------------------------------------------------------------- */
/* upd_print_page: The main workhorse */
/* ------------------------------------------------------------------- */
@@ -1198,18 +1192,18 @@ upd_print_page(gx_device_printer *pdev, FILE *out)
* If necessary, write the close-sequence
*/
{
- gs_parsed_file_name_t parsed;
- const char *fmt;
+ gs_parsed_file_name_t parsed;
+ const char *fmt;
- if (NULL != udev->fname &&
- 0 <= gx_parse_output_file_name(&parsed, &fmt, udev->fname,
+ if (NULL != udev->fname &&
+ 0 <= gx_parse_output_file_name(&parsed, &fmt, udev->fname,
strlen(udev->fname), udev->memory) &&
- fmt
- ) {
- if (0 < upd->strings[S_CLOSE].size)
- fwrite(upd->strings[S_CLOSE].data,1,upd->strings[S_CLOSE].size,out);
- upd->flags &= ~B_OPEN;
- }
+ fmt
+ ) {
+ if (0 < upd->strings[S_CLOSE].size)
+ fwrite(upd->strings[S_CLOSE].data,1,upd->strings[S_CLOSE].size,out);
+ upd->flags &= ~B_OPEN;
+ }
}
/*
@@ -1446,7 +1440,6 @@ buffer for the raw raster-data
}
-
errprintf(udev->memory,"\n%sready to print\n\n",
B_OK4GO != (upd->flags & (B_OK4GO | B_ERROR)) ?
"NOT " : "");
@@ -1520,7 +1513,6 @@ upd_close(gx_device *pdev)
code = gdev_prn_close(pdev);
error = error > code ? code : error;
-
#if UPD_MESSAGES & UPD_M_TOPCALLS
errprintf(pdev->memory,"RETURN: %d = upd_close(0x%05lx)\n",
error,(long) pdev);
@@ -1707,7 +1699,6 @@ is carried out by upd_open.
(long)udev,(long)plist);
#endif
-
/**
I consider the following part of upd_put_params a bad-nasty-hack-hack
and i am uncertain, wether it really works in the intended way. I provide it
@@ -1784,7 +1775,6 @@ setting data and size to 0.
UPD_PARAM_READ(param_read_string,upd_version,udev->upd_version,udev->memory)
-
/**
upd_put_params begins it's normal work by creating a copy, of
the data, that it might change, except for color_info that might
@@ -2149,7 +2139,6 @@ transferred into the device-structure. In the case of "uniprint", this may
upd_procs_map(udev);
-
#if UPD_MESSAGES & UPD_M_TOPCALLS
errprintf(udev->memory,"RETURN: %d = upd_put_params(0x%05lx,0x%05lx)\n",
error,(long) udev, (long) plist);
@@ -2195,13 +2184,11 @@ in the W- or K-Component.
rv = upd_truncate(upd,0,k) | upd_truncate(upd,1,c)
| upd_truncate(upd,2,m) | upd_truncate(upd,3,y);
-
/* It might still become a "gx_no_color_value" due to truncation, thus: */
if(rv == gx_no_color_index) rv ^= 1;
}
-
#if UPD_MESSAGES & UPD_M_MAPCALLS
errprintf(pdev->memory,
"cmyk_icolor: (%5.1f,%5.1f,%5.1f,%5.1f) : (%5.1f,%5.1f,%5.1f,%5.1f) : 0x%0*lx\n",
@@ -2256,7 +2243,6 @@ upd_icolor_rgb(gx_device *pdev, gx_color_index color, gx_color_value prgb[3])
if(prgb[2] > k) prgb[2] -= k;
else prgb[2] = 0;
-
#if UPD_MESSAGES & UPD_M_MAPCALLS
errprintf(pdev->memory,
"icolor_rgb: 0x%0*lx -> (%5.1f,%5.1f,%5.1f,%5.1f) -> (%5.1f,%5.1f,%5.1f,%5.1f) -> (%5.1f,%5.1f,%5.1f)\n",
@@ -2467,7 +2453,6 @@ upd_4color_rgb(gx_device *pdev, gx_color_index color, gx_color_value prgb[3])
if(!(prgb[0] || prgb[1] || prgb[2]))
prgb[0] = prgb[1] = prgb[2] = upd_expand(upd,0,color);
-
#if UPD_MESSAGES & UPD_M_MAPCALLS
errprintf(pdev->memory,
"4color_rgb: 0x%0*lx -> (%5.1f,%5.1f,%5.1f,%5.1f) -> (%5.1f,%5.1f,%5.1f)\n",
@@ -2524,7 +2509,6 @@ upd_cmyk_kcolor(gx_device *pdev, const gx_color_value cv[])
if(rv == gx_no_color_index) rv ^= 1;
}
-
#if UPD_MESSAGES & UPD_M_MAPCALLS
errprintf(pdev->memory,
"cmyk_kcolor: (%5.1f,%5.1f,%5.1f,%5.1f) : (%5.1f,%5.1f,%5.1f,%5.1f) : 0x%0*lx\n",
@@ -2865,7 +2849,6 @@ upd_open_map(upd_device *udev)
}
}
-
/** The bit number sould be positive & fit into the storage */
if(imap) { /* Check number of Bits & Shifts */
@@ -2892,7 +2875,6 @@ upd_open_map(upd_device *udev)
success = false;
-
} else {
int n;
@@ -3097,7 +3079,6 @@ upd_open_map(upd_device *udev)
}
}
-
/** If unsuccesful, install the default routines */
if(!imap) {
@@ -3283,7 +3264,6 @@ upd_open_render(upd_device *udev)
return;
}
-
/* ------------------------------------------------------------------- */
/* upd_close_render: Deinitialize rendering */
/* ------------------------------------------------------------------- */
@@ -4150,7 +4130,6 @@ upd_open_writer(upd_device *udev)
const upd_p upd = udev->upd;
bool success = true;
-
/** Reset the crucial values */
upd->start_writer = NULL;
upd->writer = NULL;
@@ -4226,7 +4205,6 @@ upd_open_writer(upd_device *udev)
if(0 >= upd->ints[I_END_Y]) upd->ints[I_END_Y] = upd->ints[I_PHEIGHT] ?
upd->ints[I_PHEIGHT] : upd->gsheight;
-
/* Create Default X-Passes */
if(0 >= upd->int_a[IA_STD_IX].size) {
@@ -4339,7 +4317,6 @@ upd_open_writer(upd_device *udev)
}
}
-
/** The sum of Values in BEG_DY should equal BEG_Y */
#if UPD_MESSAGES & UPD_M_WARNING
@@ -4574,12 +4551,10 @@ upd_close_writer(upd_device *udev)
gs_free(udev->memory, upd->scnbuf,upd->nscnbuf,sizeof(upd->scnbuf[0]),"upd/scnbuf");
}
-
upd->flags &= ~B_FORMAT;
}
}
-
/* ------------------------------------------------------------------- */
/* upd_limits: Establish passwise limits, after rendering */
/* ------------------------------------------------------------------- */
@@ -4876,7 +4851,6 @@ upd_open_wrtescp(upd_device *udev)
}
} /* BOP-Checker */
-
/** Either SETLF or YMOVE must be set */
if((0 == upd->strings[S_SETLF].size) &&
(0 == upd->strings[S_YMOVE].size) ) {
@@ -5442,7 +5416,6 @@ upd_open_wrtescp2(upd_device *udev)
break;
}
-
/** If there is neither a writecomp nor a setcomp-command, generate both */
if((0 == upd->string_a[SA_WRITECOMP].size) &&
(0 == upd->string_a[SA_SETCOMP].size ) ) { /* Default-commands */
@@ -5555,7 +5528,6 @@ upd_open_wrtescp2(upd_device *udev)
break;
}
-
/**
If all this is correct, it's time to compute the size of the output-buffer.
It must hold:
@@ -6143,7 +6115,6 @@ upd_wrtescnm(upd_p upd, FILE *out)
return 0;
}
-
/* ------------------------------------------------------------------- */
/* upd_wrtescp2x: Write an ESC/P2-pass with X-Weaving */
/* ------------------------------------------------------------------- */
@@ -7116,7 +7087,6 @@ upd_wrtcanon(upd_p upd, FILE *out)
int x, xend, icomp, ioutbuf, step, ioutbuf1;
byte *data;
-
/* Check length of the printable date */
xend = -1;
for(icomp = 0; icomp < upd->ocomp; ++icomp) {
@@ -7155,9 +7125,9 @@ upd_wrtcanon(upd_p upd, FILE *out)
/* Compressing of the scan line */
if(x <= xend) {
- ioutbuf = upd_rle(upd->outbuf, scan[icomp].bytes, xend);
+ ioutbuf = upd_rle(upd->outbuf, scan[icomp].bytes, xend);
} else {
- ioutbuf = 0;
+ ioutbuf = 0;
}
ioutbuf1 = ioutbuf + 1;
@@ -7205,8 +7175,6 @@ upd_wrtcanon(upd_p upd, FILE *out)
return 0;
}
-
-
/* ------------------------------------------------------------------- */
/* All the Pixel-Get Routines */
/* ------------------------------------------------------------------- */
@@ -7379,7 +7347,6 @@ upd_pxlget2f4(upd_p upd)
return (uint32_t) (*upd->pxlptr++) & (uint32_t) 0x03;
}
-
/* 4 Bit Forward */
static uint32_t
upd_pxlget4f1(upd_p upd)
@@ -7395,7 +7362,6 @@ upd_pxlget4f2(upd_p upd)
return (uint32_t) (*upd->pxlptr++) & (uint32_t) 0x0F;
}
-
/* 8 Bit Forward */
static uint32_t
upd_pxlget8f(upd_p upd)
@@ -7403,7 +7369,6 @@ upd_pxlget8f(upd_p upd)
return (uint32_t) (*upd->pxlptr++);
}
-
/* 16 Bit Forward */
static uint32_t
upd_pxlget16f(upd_p upd)
@@ -7434,7 +7399,6 @@ upd_pxlget32f(upd_p upd)
return ci;
}
-
/* Dummy-Routine */
static uint32_t
@@ -7611,7 +7575,6 @@ upd_pxlget4r2(upd_p upd)
return (uint32_t) (*upd->pxlptr ) & (uint32_t) 0x0F;
}
-
/* 8 Bit Reverse */
static uint32_t
upd_pxlget8r(upd_p upd)
@@ -7619,7 +7582,6 @@ upd_pxlget8r(upd_p upd)
return (uint32_t) (*upd->pxlptr--);
}
-
/* 16 Bit Reverse */
static uint32_t
upd_pxlget16r(upd_p upd)
diff --git a/gs/base/gdevvec.c b/gs/base/gdevvec.c
index f25608c6d..49c30fbb8 100644
--- a/gs/base/gdevvec.c
+++ b/gs/base/gdevvec.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,14 +47,14 @@ static bool
coord_between(fixed start, fixed mid, fixed end)
{
return (start <= end ? start <= mid && mid <= end :
- start >= mid && mid >= end);
+ start >= mid && mid >= end);
}
int
gdev_vector_dopath(gx_device_vector *vdev, const gx_path * ppath,
- gx_path_type_t type, const gs_matrix *pmat)
+ gx_path_type_t type, const gs_matrix *pmat)
{
bool do_close =
- (type & (gx_path_type_stroke | gx_path_type_always_close)) != 0;
+ (type & (gx_path_type_stroke | gx_path_type_always_close)) != 0;
gs_fixed_rect rbox;
gx_path_rectangular_type rtype = gx_path_is_rectangular(ppath, &rbox);
gs_path_enum cenum;
@@ -72,153 +72,153 @@ gdev_vector_dopath(gx_device_vector *vdev, const gx_path * ppath,
* which requires (untransformed) device coordinates.
*/
if (rtype != prt_none &&
- (!(type & gx_path_type_stroke) || rtype == prt_closed) &&
- (pmat == 0 || is_xxyy(pmat) || is_xyyx(pmat)) &&
- (state.scale_mat.xx == 1.0 && state.scale_mat.yy == 1.0 &&
- is_xxyy(&state.scale_mat) &&
- is_fzero2(state.scale_mat.tx, state.scale_mat.ty))
- ) {
- gs_point p, q;
-
- gs_point_transform_inverse((floatp)rbox.p.x, (floatp)rbox.p.y,
- &state.scale_mat, &p);
- gs_point_transform_inverse((floatp)rbox.q.x, (floatp)rbox.q.y,
- &state.scale_mat, &q);
- code = vdev_proc(vdev, dorect)(vdev, (fixed)p.x, (fixed)p.y,
- (fixed)q.x, (fixed)q.y, type);
- if (code >= 0)
- return code;
- /* If the dorect proc failed, use a general path. */
+ (!(type & gx_path_type_stroke) || rtype == prt_closed) &&
+ (pmat == 0 || is_xxyy(pmat) || is_xyyx(pmat)) &&
+ (state.scale_mat.xx == 1.0 && state.scale_mat.yy == 1.0 &&
+ is_xxyy(&state.scale_mat) &&
+ is_fzero2(state.scale_mat.tx, state.scale_mat.ty))
+ ) {
+ gs_point p, q;
+
+ gs_point_transform_inverse((floatp)rbox.p.x, (floatp)rbox.p.y,
+ &state.scale_mat, &p);
+ gs_point_transform_inverse((floatp)rbox.q.x, (floatp)rbox.q.y,
+ &state.scale_mat, &q);
+ code = vdev_proc(vdev, dorect)(vdev, (fixed)p.x, (fixed)p.y,
+ (fixed)q.x, (fixed)q.y, type);
+ if (code >= 0)
+ return code;
+ /* If the dorect proc failed, use a general path. */
}
code = vdev_proc(vdev, beginpath)(vdev, type);
if (code < 0)
- return code;
+ return code;
gx_path_enum_init(&cenum, ppath);
for (;;) {
- gs_fixed_point vs[3];
- int pe_op = gx_path_enum_next(&cenum, vs);
+ gs_fixed_point vs[3];
+ int pe_op = gx_path_enum_next(&cenum, vs);
sw:
- if (type & gx_path_type_optimize) {
- opt:
- if (pe_op == gs_pe_lineto) {
- if (!incomplete_line) {
- line_end = vs[0];
- incomplete_line = true;
- continue;
- }
- /*
- * Merge collinear horizontal or vertical line segments
- * going in the same direction.
- */
- if (vs[0].x == line_end.x) {
- if (vs[0].x == line_start.x &&
- coord_between(line_start.y, line_end.y, vs[0].y)
- ) {
- line_end.y = vs[0].y;
- continue;
- }
- } else if (vs[0].y == line_end.y) {
- if (vs[0].y == line_start.y &&
- coord_between(line_start.x, line_end.x, vs[0].x)
- ) {
- line_end.x = vs[0].x;
- continue;
- }
- }
- }
- if (incomplete_line) {
- if (need_moveto) { /* see gs_pe_moveto case */
- code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
- &line_start);
- if (code < 0)
- return code;
- need_moveto = false;
- }
- code = gdev_vector_dopath_segment(&state, gs_pe_lineto,
- &line_end);
- if (code < 0)
- return code;
- line_start = line_end;
- incomplete_line = false;
- goto opt;
- }
- }
- switch (pe_op) {
- case 0: /* done */
- done:
- code = vdev_proc(vdev, endpath)(vdev, type);
- return (code < 0 ? code : 0);
- case gs_pe_curveto:
- if (need_moveto) { /* see gs_pe_moveto case */
- code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
- &line_start);
- if (code < 0)
- return code;
- need_moveto = false;
- }
- line_start = vs[2];
- goto draw;
- case gs_pe_moveto:
- /*
- * A bug in Acrobat Reader 4 causes it to draw a single pixel
- * for a fill with an isolated moveto. If we're doing a fill
- * without a stroke, defer emitting a moveto until we know that
- * the subpath has more elements.
- */
- line_start = vs[0];
- if (!(type & gx_path_type_stroke) && (type & gx_path_type_fill)) {
- need_moveto = true;
- continue;
- }
- goto draw;
- case gs_pe_lineto:
- if (need_moveto) { /* see gs_pe_moveto case */
- code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
- &line_start);
- if (code < 0)
- return code;
- need_moveto = false;
- }
- line_start = vs[0];
- goto draw;
- case gs_pe_closepath:
- if (need_moveto) { /* see gs_pe_moveto case */
- need_moveto = false;
- continue;
- }
- if (!do_close) {
- pe_op = gx_path_enum_next(&cenum, vs);
- if (pe_op == 0)
- goto done;
- code = gdev_vector_dopath_segment(&state, gs_pe_closepath, vs);
- if (code < 0)
- return code;
- goto sw;
- }
- /* falls through */
- draw:
- code = gdev_vector_dopath_segment(&state, pe_op, vs);
- if (code < 0)
- return code;
- }
- incomplete_line = false; /* only needed if optimizing */
+ if (type & gx_path_type_optimize) {
+ opt:
+ if (pe_op == gs_pe_lineto) {
+ if (!incomplete_line) {
+ line_end = vs[0];
+ incomplete_line = true;
+ continue;
+ }
+ /*
+ * Merge collinear horizontal or vertical line segments
+ * going in the same direction.
+ */
+ if (vs[0].x == line_end.x) {
+ if (vs[0].x == line_start.x &&
+ coord_between(line_start.y, line_end.y, vs[0].y)
+ ) {
+ line_end.y = vs[0].y;
+ continue;
+ }
+ } else if (vs[0].y == line_end.y) {
+ if (vs[0].y == line_start.y &&
+ coord_between(line_start.x, line_end.x, vs[0].x)
+ ) {
+ line_end.x = vs[0].x;
+ continue;
+ }
+ }
+ }
+ if (incomplete_line) {
+ if (need_moveto) { /* see gs_pe_moveto case */
+ code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
+ &line_start);
+ if (code < 0)
+ return code;
+ need_moveto = false;
+ }
+ code = gdev_vector_dopath_segment(&state, gs_pe_lineto,
+ &line_end);
+ if (code < 0)
+ return code;
+ line_start = line_end;
+ incomplete_line = false;
+ goto opt;
+ }
+ }
+ switch (pe_op) {
+ case 0: /* done */
+ done:
+ code = vdev_proc(vdev, endpath)(vdev, type);
+ return (code < 0 ? code : 0);
+ case gs_pe_curveto:
+ if (need_moveto) { /* see gs_pe_moveto case */
+ code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
+ &line_start);
+ if (code < 0)
+ return code;
+ need_moveto = false;
+ }
+ line_start = vs[2];
+ goto draw;
+ case gs_pe_moveto:
+ /*
+ * A bug in Acrobat Reader 4 causes it to draw a single pixel
+ * for a fill with an isolated moveto. If we're doing a fill
+ * without a stroke, defer emitting a moveto until we know that
+ * the subpath has more elements.
+ */
+ line_start = vs[0];
+ if (!(type & gx_path_type_stroke) && (type & gx_path_type_fill)) {
+ need_moveto = true;
+ continue;
+ }
+ goto draw;
+ case gs_pe_lineto:
+ if (need_moveto) { /* see gs_pe_moveto case */
+ code = gdev_vector_dopath_segment(&state, gs_pe_moveto,
+ &line_start);
+ if (code < 0)
+ return code;
+ need_moveto = false;
+ }
+ line_start = vs[0];
+ goto draw;
+ case gs_pe_closepath:
+ if (need_moveto) { /* see gs_pe_moveto case */
+ need_moveto = false;
+ continue;
+ }
+ if (!do_close) {
+ pe_op = gx_path_enum_next(&cenum, vs);
+ if (pe_op == 0)
+ goto done;
+ code = gdev_vector_dopath_segment(&state, gs_pe_closepath, vs);
+ if (code < 0)
+ return code;
+ goto sw;
+ }
+ /* falls through */
+ draw:
+ code = gdev_vector_dopath_segment(&state, pe_op, vs);
+ if (code < 0)
+ return code;
+ }
+ incomplete_line = false; /* only needed if optimizing */
}
}
int
gdev_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type)
+ fixed y1, gx_path_type_t type)
{
int code = (*vdev_proc(vdev, beginpath)) (vdev, type);
if (code < 0)
- return code;
+ return code;
code = gdev_vector_write_rectangle(vdev, x0, y0, x1, y1,
- (type & gx_path_type_stroke) != 0,
- gx_rect_x_first);
+ (type & gx_path_type_stroke) != 0,
+ gx_rect_x_first);
if (code < 0)
- return code;
+ return code;
return (*vdev_proc(vdev, endpath)) (vdev, type);
}
@@ -253,57 +253,57 @@ gdev_vector_reset(gx_device_vector * vdev)
gx_hld_saved_color_init(&vdev->saved_fill_color);
gx_hld_saved_color_init(&vdev->saved_stroke_color);
vdev->clip_path_id =
- vdev->no_clip_path_id = gs_next_ids(vdev->memory, 1);
+ vdev->no_clip_path_id = gs_next_ids(vdev->memory, 1);
}
/* Open the output file and stream. */
int
gdev_vector_open_file_options(gx_device_vector * vdev, uint strmbuf_size,
- int open_options)
+ int open_options)
{
bool binary = !(open_options & VECTOR_OPEN_FILE_ASCII);
int code = -1; /* (only for testing, never returned) */
/* Open the file as seekable or sequential, as requested. */
if (!(open_options & VECTOR_OPEN_FILE_SEQUENTIAL)) {
- /* Try to open as seekable. */
- code =
- gx_device_open_output_file((gx_device *)vdev, vdev->fname,
- binary, true, &vdev->file);
+ /* Try to open as seekable. */
+ code =
+ gx_device_open_output_file((gx_device *)vdev, vdev->fname,
+ binary, true, &vdev->file);
}
if (code < 0 && (open_options & (VECTOR_OPEN_FILE_SEQUENTIAL |
- VECTOR_OPEN_FILE_SEQUENTIAL_OK))) {
- /* Try to open as sequential. */
- code = gx_device_open_output_file((gx_device *)vdev, vdev->fname,
- binary, false, &vdev->file);
+ VECTOR_OPEN_FILE_SEQUENTIAL_OK))) {
+ /* Try to open as sequential. */
+ code = gx_device_open_output_file((gx_device *)vdev, vdev->fname,
+ binary, false, &vdev->file);
}
if (code < 0)
- return code;
+ return code;
if ((vdev->strmbuf = gs_alloc_bytes(vdev->v_memory, strmbuf_size,
- "vector_open(strmbuf)")) == 0 ||
- (vdev->strm = s_alloc(vdev->v_memory,
- "vector_open(strm)")) == 0 ||
- ((open_options & VECTOR_OPEN_FILE_BBOX) &&
- (vdev->bbox_device =
- gs_alloc_struct_immovable(vdev->v_memory,
- gx_device_bbox, &st_device_bbox,
- "vector_open(bbox_device)")) == 0)
- ) {
- if (vdev->bbox_device)
- gs_free_object(vdev->v_memory, vdev->bbox_device,
- "vector_open(bbox_device)");
- vdev->bbox_device = 0;
- if (vdev->strm)
- gs_free_object(vdev->v_memory, vdev->strm,
- "vector_open(strm)");
- vdev->strm = 0;
- if (vdev->strmbuf)
- gs_free_object(vdev->v_memory, vdev->strmbuf,
- "vector_open(strmbuf)");
- vdev->strmbuf = 0;
- gx_device_close_output_file((gx_device *)vdev, vdev->fname, vdev->file);
- vdev->file = 0;
- return_error(gs_error_VMerror);
+ "vector_open(strmbuf)")) == 0 ||
+ (vdev->strm = s_alloc(vdev->v_memory,
+ "vector_open(strm)")) == 0 ||
+ ((open_options & VECTOR_OPEN_FILE_BBOX) &&
+ (vdev->bbox_device =
+ gs_alloc_struct_immovable(vdev->v_memory,
+ gx_device_bbox, &st_device_bbox,
+ "vector_open(bbox_device)")) == 0)
+ ) {
+ if (vdev->bbox_device)
+ gs_free_object(vdev->v_memory, vdev->bbox_device,
+ "vector_open(bbox_device)");
+ vdev->bbox_device = 0;
+ if (vdev->strm)
+ gs_free_object(vdev->v_memory, vdev->strm,
+ "vector_open(strm)");
+ vdev->strm = 0;
+ if (vdev->strmbuf)
+ gs_free_object(vdev->v_memory, vdev->strmbuf,
+ "vector_open(strmbuf)");
+ vdev->strmbuf = 0;
+ gx_device_close_output_file((gx_device *)vdev, vdev->fname, vdev->file);
+ vdev->file = 0;
+ return_error(gs_error_VMerror);
}
vdev->strmbuf_size = strmbuf_size;
swrite_file(vdev->strm, vdev->file, vdev->strmbuf, strmbuf_size);
@@ -314,18 +314,18 @@ gdev_vector_open_file_options(gx_device_vector * vdev, uint strmbuf_size,
*/
vdev->strm->procs.close = vdev->strm->procs.flush;
if (vdev->bbox_device) {
- gx_device_bbox_init(vdev->bbox_device, NULL, vdev->v_memory);
+ gx_device_bbox_init(vdev->bbox_device, NULL, vdev->v_memory);
rc_increment(vdev->bbox_device);
- gx_device_set_resolution((gx_device *) vdev->bbox_device,
- vdev->HWResolution[0],
- vdev->HWResolution[1]);
- /* Do the right thing about upright vs. inverted. */
- /* (This is dangerous in general, since the procedure */
- /* might reference non-standard elements.) */
- set_dev_proc(vdev->bbox_device, get_initial_matrix,
- dev_proc(vdev, get_initial_matrix));
- (*dev_proc(vdev->bbox_device, open_device))
- ((gx_device *) vdev->bbox_device);
+ gx_device_set_resolution((gx_device *) vdev->bbox_device,
+ vdev->HWResolution[0],
+ vdev->HWResolution[1]);
+ /* Do the right thing about upright vs. inverted. */
+ /* (This is dangerous in general, since the procedure */
+ /* might reference non-standard elements.) */
+ set_dev_proc(vdev->bbox_device, get_initial_matrix,
+ dev_proc(vdev, get_initial_matrix));
+ (*dev_proc(vdev->bbox_device, open_device))
+ ((gx_device *) vdev->bbox_device);
}
return 0;
}
@@ -335,8 +335,8 @@ stream *
gdev_vector_stream(gx_device_vector * vdev)
{
if (!vdev->in_page) {
- (*vdev_proc(vdev, beginpage)) (vdev);
- vdev->in_page = true;
+ (*vdev_proc(vdev, beginpage)) (vdev);
+ vdev->in_page = true;
}
return vdev->strm;
}
@@ -348,11 +348,11 @@ gdev_vector_update_log_op(gx_device_vector * vdev, gs_logical_operation_t lop)
gs_logical_operation_t diff = lop ^ vdev->state.log_op;
if (diff != 0) {
- int code = (*vdev_proc(vdev, setlogop)) (vdev, lop, diff);
+ int code = (*vdev_proc(vdev, setlogop)) (vdev, lop, diff);
- if (code < 0)
- return code;
- vdev->state.log_op = lop;
+ if (code < 0)
+ return code;
+ vdev->state.log_op = lop;
}
return 0;
}
@@ -360,24 +360,24 @@ gdev_vector_update_log_op(gx_device_vector * vdev, gs_logical_operation_t lop)
/* Update color (fill or stroke). */
static int
gdev_vector_update_color(gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_drawing_color * pdcolor,
- gx_hl_saved_color *sc,
- int (*setcolor) (gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_drawing_color * pdc))
+ const gs_imager_state * pis,
+ const gx_drawing_color * pdcolor,
+ gx_hl_saved_color *sc,
+ int (*setcolor) (gx_device_vector * vdev,
+ const gs_imager_state * pis,
+ const gx_drawing_color * pdc))
{
gx_hl_saved_color temp;
int code;
bool hl_color = (*vdev_proc(vdev, can_handle_hl_color)) (vdev, pis, pdcolor);
const gs_imager_state *pis_for_hl_color = (hl_color ? pis : NULL);
-
+
gx_hld_save_color(pis_for_hl_color, pdcolor, &temp);
if (gx_hld_saved_color_equal(&temp, sc))
- return 0;
+ return 0;
code = (*setcolor) (vdev, pis_for_hl_color, pdcolor);
if (code < 0)
- return code;
+ return code;
*sc = temp;
return 0;
}
@@ -385,36 +385,36 @@ gdev_vector_update_color(gx_device_vector * vdev,
/* Update the fill color. */
int
gdev_vector_update_fill_color(gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_drawing_color * pdcolor)
+ const gs_imager_state * pis,
+ const gx_drawing_color * pdcolor)
{
- return gdev_vector_update_color(vdev, pis, pdcolor, &vdev->saved_fill_color,
+ return gdev_vector_update_color(vdev, pis, pdcolor, &vdev->saved_fill_color,
vdev_proc(vdev, setfillcolor));
}
/* Update the state for filling a region. */
static int
-update_fill(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+update_fill(gx_device_vector * vdev, const gs_imager_state * pis,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
{
int code = gdev_vector_update_fill_color(vdev, pis, pdcolor);
if (code < 0)
- return code;
+ return code;
return gdev_vector_update_log_op(vdev, lop);
}
/* Bring state up to date for filling. */
int
gdev_vector_prepare_fill(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_fill_params * params, const gx_drawing_color * pdcolor)
+ const gx_fill_params * params, const gx_drawing_color * pdcolor)
{
if (params->flatness != vdev->state.flatness) {
- int code = (*vdev_proc(vdev, setflat)) (vdev, params->flatness);
+ int code = (*vdev_proc(vdev, setflat)) (vdev, params->flatness);
- if (code < 0)
- return code;
- vdev->state.flatness = params->flatness;
+ if (code < 0)
+ return code;
+ vdev->state.flatness = params->flatness;
}
return update_fill(vdev, pis, pdcolor, pis->log_op);
}
@@ -426,101 +426,101 @@ dash_pattern_eq(const float *stored, const gx_dash_params * set, floatp scale)
int i;
for (i = 0; i < set->pattern_size; ++i)
- if (stored[i] != (float)(set->pattern[i] * scale))
- return false;
+ if (stored[i] != (float)(set->pattern[i] * scale))
+ return false;
return true;
}
/* Bring state up to date for stroking. */
int
gdev_vector_prepare_stroke(gx_device_vector * vdev,
- const gs_imager_state * pis, /* may be NULL */
- const gx_stroke_params * params, /* may be NULL */
- const gx_drawing_color * pdcolor, /* may be NULL */
- floatp scale)
+ const gs_imager_state * pis, /* may be NULL */
+ const gx_stroke_params * params, /* may be NULL */
+ const gx_drawing_color * pdcolor, /* may be NULL */
+ floatp scale)
{
if (pis) {
- int pattern_size = pis->line_params.dash.pattern_size;
- float dash_offset = pis->line_params.dash.offset * scale;
- float half_width = pis->line_params.half_width * scale;
-
- if (pattern_size > max_dash)
- return_error(gs_error_limitcheck);
- if (dash_offset != vdev->state.line_params.dash.offset ||
- pattern_size != vdev->state.line_params.dash.pattern_size ||
- (pattern_size != 0 &&
- !dash_pattern_eq(vdev->dash_pattern, &pis->line_params.dash,
- scale))
- ) {
- float pattern[max_dash];
- int i, code;
-
- for (i = 0; i < pattern_size; ++i)
- pattern[i] = pis->line_params.dash.pattern[i] * scale;
- code = (*vdev_proc(vdev, setdash))
- (vdev, pattern, pattern_size, dash_offset);
- if (code < 0)
- return code;
- memcpy(vdev->dash_pattern, pattern, pattern_size * sizeof(float));
-
- vdev->state.line_params.dash.pattern_size = pattern_size;
- vdev->state.line_params.dash.offset = dash_offset;
- }
- if (half_width != vdev->state.line_params.half_width) {
- int code = (*vdev_proc(vdev, setlinewidth))
- (vdev, half_width * 2);
-
- if (code < 0)
- return code;
- vdev->state.line_params.half_width = half_width;
- }
- if (pis->line_params.miter_limit != vdev->state.line_params.miter_limit) {
- int code = (*vdev_proc(vdev, setmiterlimit))
- (vdev, pis->line_params.miter_limit);
-
- if (code < 0)
- return code;
- gx_set_miter_limit(&vdev->state.line_params,
- pis->line_params.miter_limit);
- }
- /* FIXME: Should cope with end_cap and dash_cap too */
- if (pis->line_params.start_cap != vdev->state.line_params.start_cap) {
- int code = (*vdev_proc(vdev, setlinecap))
- (vdev, pis->line_params.start_cap);
-
- if (code < 0)
- return code;
- vdev->state.line_params.start_cap = pis->line_params.start_cap;
- }
- if (pis->line_params.join != vdev->state.line_params.join) {
- int code = (*vdev_proc(vdev, setlinejoin))
- (vdev, pis->line_params.join);
-
- if (code < 0)
- return code;
- vdev->state.line_params.join = pis->line_params.join;
- } {
- int code = gdev_vector_update_log_op(vdev, pis->log_op);
-
- if (code < 0)
- return code;
- }
+ int pattern_size = pis->line_params.dash.pattern_size;
+ float dash_offset = pis->line_params.dash.offset * scale;
+ float half_width = pis->line_params.half_width * scale;
+
+ if (pattern_size > max_dash)
+ return_error(gs_error_limitcheck);
+ if (dash_offset != vdev->state.line_params.dash.offset ||
+ pattern_size != vdev->state.line_params.dash.pattern_size ||
+ (pattern_size != 0 &&
+ !dash_pattern_eq(vdev->dash_pattern, &pis->line_params.dash,
+ scale))
+ ) {
+ float pattern[max_dash];
+ int i, code;
+
+ for (i = 0; i < pattern_size; ++i)
+ pattern[i] = pis->line_params.dash.pattern[i] * scale;
+ code = (*vdev_proc(vdev, setdash))
+ (vdev, pattern, pattern_size, dash_offset);
+ if (code < 0)
+ return code;
+ memcpy(vdev->dash_pattern, pattern, pattern_size * sizeof(float));
+
+ vdev->state.line_params.dash.pattern_size = pattern_size;
+ vdev->state.line_params.dash.offset = dash_offset;
+ }
+ if (half_width != vdev->state.line_params.half_width) {
+ int code = (*vdev_proc(vdev, setlinewidth))
+ (vdev, half_width * 2);
+
+ if (code < 0)
+ return code;
+ vdev->state.line_params.half_width = half_width;
+ }
+ if (pis->line_params.miter_limit != vdev->state.line_params.miter_limit) {
+ int code = (*vdev_proc(vdev, setmiterlimit))
+ (vdev, pis->line_params.miter_limit);
+
+ if (code < 0)
+ return code;
+ gx_set_miter_limit(&vdev->state.line_params,
+ pis->line_params.miter_limit);
+ }
+ /* FIXME: Should cope with end_cap and dash_cap too */
+ if (pis->line_params.start_cap != vdev->state.line_params.start_cap) {
+ int code = (*vdev_proc(vdev, setlinecap))
+ (vdev, pis->line_params.start_cap);
+
+ if (code < 0)
+ return code;
+ vdev->state.line_params.start_cap = pis->line_params.start_cap;
+ }
+ if (pis->line_params.join != vdev->state.line_params.join) {
+ int code = (*vdev_proc(vdev, setlinejoin))
+ (vdev, pis->line_params.join);
+
+ if (code < 0)
+ return code;
+ vdev->state.line_params.join = pis->line_params.join;
+ } {
+ int code = gdev_vector_update_log_op(vdev, pis->log_op);
+
+ if (code < 0)
+ return code;
+ }
}
if (params) {
- if (params->flatness != vdev->state.flatness) {
- int code = (*vdev_proc(vdev, setflat)) (vdev, params->flatness);
+ if (params->flatness != vdev->state.flatness) {
+ int code = (*vdev_proc(vdev, setflat)) (vdev, params->flatness);
- if (code < 0)
- return code;
- vdev->state.flatness = params->flatness;
- }
+ if (code < 0)
+ return code;
+ vdev->state.flatness = params->flatness;
+ }
}
if (pdcolor) {
- int code = gdev_vector_update_color(vdev, pis, pdcolor,
- &vdev->saved_stroke_color, vdev_proc(vdev, setstrokecolor));
+ int code = gdev_vector_update_color(vdev, pis, pdcolor,
+ &vdev->saved_stroke_color, vdev_proc(vdev, setstrokecolor));
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -533,8 +533,8 @@ gdev_vector_prepare_stroke(gx_device_vector * vdev,
*/
int
gdev_vector_stroke_scaling(const gx_device_vector *vdev,
- const gs_imager_state *pis,
- double *pscale, gs_matrix *pmat)
+ const gs_imager_state *pis,
+ double *pscale, gs_matrix *pmat)
{
bool set_ctm = true;
double scale = 1;
@@ -550,35 +550,35 @@ gdev_vector_stroke_scaling(const gx_device_vector *vdev,
* the coordinates.
*/
if (is_xxyy(&pis->ctm)) {
- scale = fabs(pis->ctm.xx);
- set_ctm = fabs(pis->ctm.yy) != scale;
+ scale = fabs(pis->ctm.xx);
+ set_ctm = fabs(pis->ctm.yy) != scale;
} else if (is_xyyx(&pis->ctm)) {
- scale = fabs(pis->ctm.xy);
- set_ctm = fabs(pis->ctm.yx) != scale;
+ scale = fabs(pis->ctm.xy);
+ set_ctm = fabs(pis->ctm.yx) != scale;
} else if ((pis->ctm.xx == pis->ctm.yy && pis->ctm.xy == -pis->ctm.yx) ||
- (pis->ctm.xx == -pis->ctm.yy && pis->ctm.xy == pis->ctm.yx)
- ) {
- scale = hypot(pis->ctm.xx, pis->ctm.xy);
- set_ctm = false;
+ (pis->ctm.xx == -pis->ctm.yy && pis->ctm.xy == pis->ctm.yx)
+ ) {
+ scale = hypot(pis->ctm.xx, pis->ctm.xy);
+ set_ctm = false;
}
if (set_ctm) {
- /*
- * Adobe Acrobat Reader has limitations on the maximum user
- * coordinate value. If we scale the matrix down too far, the
- * coordinates will get too big: limit the scale factor to prevent
- * this from happening. (This does no harm for other output
- * formats.)
- */
- double
- mxx = pis->ctm.xx / vdev->scale.x,
- mxy = pis->ctm.xy / vdev->scale.y,
- myx = pis->ctm.yx / vdev->scale.x,
- myy = pis->ctm.yy / vdev->scale.y;
-
- scale = 0.5 * (fabs(mxx) + fabs(mxy) + fabs(myx) + fabs(myy));
- pmat->xx = mxx / scale, pmat->xy = mxy / scale;
- pmat->yx = myx / scale, pmat->yy = myy / scale;
- pmat->tx = pmat->ty = 0;
+ /*
+ * Adobe Acrobat Reader has limitations on the maximum user
+ * coordinate value. If we scale the matrix down too far, the
+ * coordinates will get too big: limit the scale factor to prevent
+ * this from happening. (This does no harm for other output
+ * formats.)
+ */
+ double
+ mxx = pis->ctm.xx / vdev->scale.x,
+ mxy = pis->ctm.xy / vdev->scale.y,
+ myx = pis->ctm.yx / vdev->scale.x,
+ myy = pis->ctm.yy / vdev->scale.y;
+
+ scale = 0.5 * (fabs(mxx) + fabs(mxy) + fabs(myx) + fabs(myy));
+ pmat->xx = mxx / scale, pmat->xy = mxy / scale;
+ pmat->yx = myx / scale, pmat->yy = myy / scale;
+ pmat->tx = pmat->ty = 0;
}
*pscale = scale;
return (int)set_ctm;
@@ -587,21 +587,21 @@ gdev_vector_stroke_scaling(const gx_device_vector *vdev,
/* Initialize for writing a path using the default implementation. */
void
gdev_vector_dopath_init(gdev_vector_dopath_state_t *state,
- gx_device_vector *vdev, gx_path_type_t type,
- const gs_matrix *pmat)
+ gx_device_vector *vdev, gx_path_type_t type,
+ const gs_matrix *pmat)
{
state->vdev = vdev;
state->type = type;
if (pmat) {
- state->scale_mat = *pmat;
- /*
- * The path element writing procedures all divide the coordinates
- * by the scale, so we must compensate for that here.
- */
- gs_matrix_scale(&state->scale_mat, 1.0 / vdev->scale.x,
- 1.0 / vdev->scale.y, &state->scale_mat);
+ state->scale_mat = *pmat;
+ /*
+ * The path element writing procedures all divide the coordinates
+ * by the scale, so we must compensate for that here.
+ */
+ gs_matrix_scale(&state->scale_mat, 1.0 / vdev->scale.x,
+ 1.0 / vdev->scale.y, &state->scale_mat);
} else {
- gs_make_scaling(vdev->scale.x, vdev->scale.y, &state->scale_mat);
+ gs_make_scaling(vdev->scale.x, vdev->scale.y, &state->scale_mat);
}
state->first = true;
}
@@ -612,7 +612,7 @@ gdev_vector_dopath_init(gdev_vector_dopath_state_t *state,
*/
int
gdev_vector_dopath_segment(gdev_vector_dopath_state_t *state, int pe_op,
- gs_fixed_point vs[3])
+ gs_fixed_point vs[3])
{
gx_device_vector *vdev = state->vdev;
const gs_matrix *const pmat = &state->scale_mat;
@@ -620,52 +620,52 @@ gdev_vector_dopath_segment(gdev_vector_dopath_state_t *state, int pe_op,
int code;
switch (pe_op) {
- case gs_pe_moveto:
- code = gs_point_transform_inverse(fixed2float(vs[0].x),
- fixed2float(vs[0].y), pmat, &vp[0]);
- if (code < 0)
- return code;
- if (state->first)
- state->start = vp[0], state->first = false;
- code = vdev_proc(vdev, moveto)
- (vdev, 0/*unused*/, 0/*unused*/, vp[0].x, vp[0].y,
- state->type);
- state->prev = vp[0];
- break;
- case gs_pe_lineto:
- code = gs_point_transform_inverse(fixed2float(vs[0].x),
- fixed2float(vs[0].y), pmat, &vp[0]);
- if (code < 0)
- return code;
- code = vdev_proc(vdev, lineto)
- (vdev, state->prev.x, state->prev.y, vp[0].x, vp[0].y,
- state->type);
- state->prev = vp[0];
- break;
- case gs_pe_curveto:
- code = gs_point_transform_inverse(fixed2float(vs[0].x),
- fixed2float(vs[0].y), pmat, &vp[0]);
- if (code < 0)
- return code;
- code = gs_point_transform_inverse(fixed2float(vs[1].x),
- fixed2float(vs[1].y), pmat, &vp[1]);
- if (code < 0)
- return code;
- gs_point_transform_inverse(fixed2float(vs[2].x),
- fixed2float(vs[2].y), pmat, &vp[2]);
- code = vdev_proc(vdev, curveto)
- (vdev, state->prev.x, state->prev.y, vp[0].x, vp[0].y,
- vp[1].x, vp[1].y, vp[2].x, vp[2].y, state->type);
- state->prev = vp[2];
- break;
- case gs_pe_closepath:
- code = vdev_proc(vdev, closepath)
- (vdev, state->prev.x, state->prev.y, state->start.x,
- state->start.y, state->type);
- state->prev = state->start;
- break;
- default: /* can't happen */
- return -1;
+ case gs_pe_moveto:
+ code = gs_point_transform_inverse(fixed2float(vs[0].x),
+ fixed2float(vs[0].y), pmat, &vp[0]);
+ if (code < 0)
+ return code;
+ if (state->first)
+ state->start = vp[0], state->first = false;
+ code = vdev_proc(vdev, moveto)
+ (vdev, 0/*unused*/, 0/*unused*/, vp[0].x, vp[0].y,
+ state->type);
+ state->prev = vp[0];
+ break;
+ case gs_pe_lineto:
+ code = gs_point_transform_inverse(fixed2float(vs[0].x),
+ fixed2float(vs[0].y), pmat, &vp[0]);
+ if (code < 0)
+ return code;
+ code = vdev_proc(vdev, lineto)
+ (vdev, state->prev.x, state->prev.y, vp[0].x, vp[0].y,
+ state->type);
+ state->prev = vp[0];
+ break;
+ case gs_pe_curveto:
+ code = gs_point_transform_inverse(fixed2float(vs[0].x),
+ fixed2float(vs[0].y), pmat, &vp[0]);
+ if (code < 0)
+ return code;
+ code = gs_point_transform_inverse(fixed2float(vs[1].x),
+ fixed2float(vs[1].y), pmat, &vp[1]);
+ if (code < 0)
+ return code;
+ gs_point_transform_inverse(fixed2float(vs[2].x),
+ fixed2float(vs[2].y), pmat, &vp[2]);
+ code = vdev_proc(vdev, curveto)
+ (vdev, state->prev.x, state->prev.y, vp[0].x, vp[0].y,
+ vp[1].x, vp[1].y, vp[2].x, vp[2].y, state->type);
+ state->prev = vp[2];
+ break;
+ case gs_pe_closepath:
+ code = vdev_proc(vdev, closepath)
+ (vdev, state->prev.x, state->prev.y, state->start.x,
+ state->start.y, state->type);
+ state->prev = state->start;
+ break;
+ default: /* can't happen */
+ return -1;
}
return code;
}
@@ -674,123 +674,123 @@ gdev_vector_dopath_segment(gdev_vector_dopath_state_t *state, int pe_op,
/* May call beginpath, moveto, lineto, closepath, endpath. */
int
gdev_vector_write_polygon(gx_device_vector * vdev, const gs_fixed_point * points,
- uint count, bool close, gx_path_type_t type)
+ uint count, bool close, gx_path_type_t type)
{
int code = 0;
if (type != gx_path_type_none &&
- (code = (*vdev_proc(vdev, beginpath)) (vdev, type)) < 0
- )
- return code;
+ (code = (*vdev_proc(vdev, beginpath)) (vdev, type)) < 0
+ )
+ return code;
if (count > 0) {
- double x = fixed2float(points[0].x) / vdev->scale.x, y = fixed2float(points[0].y) / vdev->scale.y;
- double x_start = x, y_start = y, x_prev, y_prev;
- uint i;
-
- code = (*vdev_proc(vdev, moveto))
- (vdev, 0.0, 0.0, x, y, type);
- if (code >= 0)
- for (i = 1; i < count && code >= 0; ++i) {
- x_prev = x, y_prev = y;
- code = (*vdev_proc(vdev, lineto))
- (vdev, x_prev, y_prev,
- (x = fixed2float(points[i].x) / vdev->scale.x),
- (y = fixed2float(points[i].y) / vdev->scale.y),
- type);
- }
- if (code >= 0 && close)
- code = (*vdev_proc(vdev, closepath))
- (vdev, x, y, x_start, y_start, type);
+ double x = fixed2float(points[0].x) / vdev->scale.x, y = fixed2float(points[0].y) / vdev->scale.y;
+ double x_start = x, y_start = y, x_prev, y_prev;
+ uint i;
+
+ code = (*vdev_proc(vdev, moveto))
+ (vdev, 0.0, 0.0, x, y, type);
+ if (code >= 0)
+ for (i = 1; i < count && code >= 0; ++i) {
+ x_prev = x, y_prev = y;
+ code = (*vdev_proc(vdev, lineto))
+ (vdev, x_prev, y_prev,
+ (x = fixed2float(points[i].x) / vdev->scale.x),
+ (y = fixed2float(points[i].y) / vdev->scale.y),
+ type);
+ }
+ if (code >= 0 && close)
+ code = (*vdev_proc(vdev, closepath))
+ (vdev, x, y, x_start, y_start, type);
}
return (code >= 0 && type != gx_path_type_none ?
- (*vdev_proc(vdev, endpath)) (vdev, type) : code);
+ (*vdev_proc(vdev, endpath)) (vdev, type) : code);
}
/* Write a rectangle as part of a path. */
/* May call moveto, lineto, closepath. */
int
gdev_vector_write_rectangle(gx_device_vector * vdev, fixed x0, fixed y0,
- fixed x1, fixed y1, bool close, gx_rect_direction_t direction)
+ fixed x1, fixed y1, bool close, gx_rect_direction_t direction)
{
gs_fixed_point points[4];
points[0].x = x0, points[0].y = y0;
points[2].x = x1, points[2].y = y1;
if (direction == gx_rect_x_first)
- points[1].x = x1, points[1].y = y0,
- points[3].x = x0, points[3].y = y1;
+ points[1].x = x1, points[1].y = y0,
+ points[3].x = x0, points[3].y = y1;
else
- points[1].x = x0, points[1].y = y1,
- points[3].x = x1, points[3].y = y0;
+ points[1].x = x0, points[1].y = y1,
+ points[3].x = x1, points[3].y = y0;
return gdev_vector_write_polygon(vdev, points, 4, close,
- gx_path_type_none);
+ gx_path_type_none);
}
/* Write a clipping path by calling the path procedures. */
int
gdev_vector_write_clip_path(gx_device_vector * vdev,
- const gx_clip_path * pcpath)
+ const gx_clip_path * pcpath)
{
const gx_clip_rect *prect;
gx_clip_rect page_rect;
int code;
if (pcpath == 0) {
- /* There's no special provision for initclip. */
- /* Write a rectangle that covers the entire page. */
- page_rect.xmin = page_rect.ymin = 0;
- page_rect.xmax = vdev->width;
- page_rect.ymax = vdev->height;
- page_rect.next = 0;
- prect = &page_rect;
+ /* There's no special provision for initclip. */
+ /* Write a rectangle that covers the entire page. */
+ page_rect.xmin = page_rect.ymin = 0;
+ page_rect.xmax = vdev->width;
+ page_rect.ymax = vdev->height;
+ page_rect.next = 0;
+ prect = &page_rect;
} else if (pcpath->path_valid) {
- return (*vdev_proc(vdev, dopath))
- (vdev, &pcpath->path,
- (pcpath->rule <= 0 ?
- gx_path_type_clip | gx_path_type_winding_number :
- gx_path_type_clip | gx_path_type_even_odd),
- NULL);
+ return (*vdev_proc(vdev, dopath))
+ (vdev, &pcpath->path,
+ (pcpath->rule <= 0 ?
+ gx_path_type_clip | gx_path_type_winding_number :
+ gx_path_type_clip | gx_path_type_even_odd),
+ NULL);
} else {
- const gx_clip_list *list = gx_cpath_list(pcpath);
+ const gx_clip_list *list = gx_cpath_list(pcpath);
- prect = list->head;
- if (prect == 0)
- prect = &list->single;
+ prect = list->head;
+ if (prect == 0)
+ prect = &list->single;
}
/* Write out the rectangles. */
code = (*vdev_proc(vdev, beginpath)) (vdev, gx_path_type_clip);
for (; code >= 0 && prect != 0; prect = prect->next)
- if (prect->xmax > prect->xmin && prect->ymax > prect->ymin)
- code = gdev_vector_write_rectangle
- (vdev, int2fixed(prect->xmin), int2fixed(prect->ymin),
- int2fixed(prect->xmax), int2fixed(prect->ymax),
- false, gx_rect_x_first);
+ if (prect->xmax > prect->xmin && prect->ymax > prect->ymin)
+ code = gdev_vector_write_rectangle
+ (vdev, int2fixed(prect->xmin), int2fixed(prect->ymin),
+ int2fixed(prect->xmax), int2fixed(prect->ymax),
+ false, gx_rect_x_first);
if (code >= 0)
- code = (*vdev_proc(vdev, endpath)) (vdev, gx_path_type_clip);
+ code = (*vdev_proc(vdev, endpath)) (vdev, gx_path_type_clip);
return code;
}
/* Update the clipping path if needed. */
int
gdev_vector_update_clip_path(gx_device_vector * vdev,
- const gx_clip_path * pcpath)
+ const gx_clip_path * pcpath)
{
if (pcpath) {
- if (pcpath->id != vdev->clip_path_id) {
- int code = gdev_vector_write_clip_path(vdev, pcpath);
+ if (pcpath->id != vdev->clip_path_id) {
+ int code = gdev_vector_write_clip_path(vdev, pcpath);
- if (code < 0)
- return code;
- vdev->clip_path_id = pcpath->id;
- }
+ if (code < 0)
+ return code;
+ vdev->clip_path_id = pcpath->id;
+ }
} else {
- if (vdev->clip_path_id != vdev->no_clip_path_id) {
- int code = gdev_vector_write_clip_path(vdev, NULL);
+ if (vdev->clip_path_id != vdev->no_clip_path_id) {
+ int code = gdev_vector_write_clip_path(vdev, NULL);
- if (code < 0)
- return code;
- vdev->clip_path_id = vdev->no_clip_path_id;
- }
+ if (code < 0)
+ return code;
+ vdev->clip_path_id = vdev->no_clip_path_id;
+ }
}
return 0;
}
@@ -803,22 +803,22 @@ gdev_vector_close_file(gx_device_vector * vdev)
int err;
gs_free_object(vdev->v_memory, vdev->bbox_device,
- "vector_close(bbox_device)");
+ "vector_close(bbox_device)");
vdev->bbox_device = 0;
if (vdev->strm) {
- sclose(vdev->strm);
- gs_free_object(vdev->v_memory, vdev->strm, "vector_close(strm)");
- vdev->strm = 0;
- gs_free_object(vdev->v_memory, vdev->strmbuf, "vector_close(strmbuf)");
- vdev->strmbuf = 0;
+ sclose(vdev->strm);
+ gs_free_object(vdev->v_memory, vdev->strm, "vector_close(strm)");
+ vdev->strm = 0;
+ gs_free_object(vdev->v_memory, vdev->strmbuf, "vector_close(strmbuf)");
+ vdev->strmbuf = 0;
}
vdev->file = 0;
if (f) {
- err = ferror(f);
- /* We prevented sclose from closing the file. */
- if (gx_device_close_output_file((gx_device *)vdev, vdev->fname, f) != 0
- || err != 0)
- return_error(gs_error_ioerror);
+ err = ferror(f);
+ /* We prevented sclose from closing the file. */
+ if (gx_device_close_output_file((gx_device *)vdev, vdev->fname, f) != 0
+ || err != 0)
+ return_error(gs_error_ioerror);
}
return 0;
}
@@ -828,11 +828,11 @@ gdev_vector_close_file(gx_device_vector * vdev)
/* Initialize for enumerating an image. */
int
gdev_vector_begin_image(gx_device_vector * vdev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, const gx_image_enum_procs_t * pprocs,
- gdev_vector_image_enum_t * pie)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, const gx_image_enum_procs_t * pprocs,
+ gdev_vector_image_enum_t * pie)
{
const gs_color_space *pcs = pim->ColorSpace;
int num_components;
@@ -840,37 +840,37 @@ gdev_vector_begin_image(gx_device_vector * vdev,
int code;
if (pim->ImageMask)
- bits_per_pixel = num_components = 1;
+ bits_per_pixel = num_components = 1;
else
- num_components = gs_color_space_num_components(pcs),
- bits_per_pixel = pim->BitsPerComponent;
+ num_components = gs_color_space_num_components(pcs),
+ bits_per_pixel = pim->BitsPerComponent;
code = gx_image_enum_common_init((gx_image_enum_common_t *) pie,
- (const gs_data_image_t *)pim,
- pprocs, (gx_device *) vdev,
- num_components, format);
+ (const gs_data_image_t *)pim,
+ pprocs, (gx_device *) vdev,
+ num_components, format);
if (code < 0)
- return code;
+ return code;
pie->bits_per_pixel = bits_per_pixel * num_components /
- pie->num_planes;
+ pie->num_planes;
pie->default_info = 0;
pie->bbox_info = 0;
if ((code = gdev_vector_update_log_op(vdev, pis->log_op)) < 0 ||
- (code = gdev_vector_update_clip_path(vdev, pcpath)) < 0 ||
- ((pim->ImageMask ||
- (pim->CombineWithColor && rop3_uses_T(pis->log_op))) &&
- (code = gdev_vector_update_fill_color(vdev, pis, pdcolor)) < 0) ||
- (vdev->bbox_device &&
- (code = (*dev_proc(vdev->bbox_device, begin_image))
- ((gx_device *) vdev->bbox_device, pis, pim, format, prect,
- pdcolor, pcpath, mem, &pie->bbox_info)) < 0)
- )
- return code;
+ (code = gdev_vector_update_clip_path(vdev, pcpath)) < 0 ||
+ ((pim->ImageMask ||
+ (pim->CombineWithColor && rop3_uses_T(pis->log_op))) &&
+ (code = gdev_vector_update_fill_color(vdev, pis, pdcolor)) < 0) ||
+ (vdev->bbox_device &&
+ (code = (*dev_proc(vdev->bbox_device, begin_image))
+ ((gx_device *) vdev->bbox_device, pis, pim, format, prect,
+ pdcolor, pcpath, mem, &pie->bbox_info)) < 0)
+ )
+ return code;
pie->memory = mem;
if (prect)
- pie->width = prect->q.x - prect->p.x,
- pie->height = prect->q.y - prect->p.y;
+ pie->width = prect->q.x - prect->p.x,
+ pie->height = prect->q.y - prect->p.y;
else
- pie->width = pim->Width, pie->height = pim->Height;
+ pie->width = pim->Width, pie->height = pim->Height;
pie->bits_per_row = pie->width * pie->bits_per_pixel;
pie->y = 0;
return 0;
@@ -880,39 +880,39 @@ gdev_vector_begin_image(gx_device_vector * vdev,
/* Return 0 if we used the default implementation, 1 if not. */
int
gdev_vector_end_image(gx_device_vector * vdev,
- gdev_vector_image_enum_t * pie, bool draw_last, gx_color_index pad)
+ gdev_vector_image_enum_t * pie, bool draw_last, gx_color_index pad)
{
int code;
if (pie->default_info) {
- code = gx_default_end_image((gx_device *) vdev, pie->default_info,
- draw_last);
- if (code >= 0)
- code = 0;
+ code = gx_default_end_image((gx_device *) vdev, pie->default_info,
+ draw_last);
+ if (code >= 0)
+ code = 0;
} else { /* Fill out to the full image height. */
- if (pie->y < pie->height && pad != gx_no_color_index) {
- uint bytes_per_row = (pie->bits_per_row + 7) >> 3;
- byte *row = gs_alloc_bytes(pie->memory, bytes_per_row,
- "gdev_vector_end_image(fill)");
+ if (pie->y < pie->height && pad != gx_no_color_index) {
+ uint bytes_per_row = (pie->bits_per_row + 7) >> 3;
+ byte *row = gs_alloc_bytes(pie->memory, bytes_per_row,
+ "gdev_vector_end_image(fill)");
- if (row == 0)
- return_error(gs_error_VMerror);
+ if (row == 0)
+ return_error(gs_error_VMerror);
/****** FILL VALUE IS WRONG ******/
- memset(row, (byte) pad, bytes_per_row);
- for (; pie->y < pie->height; pie->y++)
- gx_image_data((gx_image_enum_common_t *) pie,
- (const byte **)&row, 0,
- bytes_per_row, 1);
- gs_free_object(pie->memory, row,
- "gdev_vector_end_image(fill)");
- }
- code = 1;
+ memset(row, (byte) pad, bytes_per_row);
+ for (; pie->y < pie->height; pie->y++)
+ gx_image_data((gx_image_enum_common_t *) pie,
+ (const byte **)&row, 0,
+ bytes_per_row, 1);
+ gs_free_object(pie->memory, row,
+ "gdev_vector_end_image(fill)");
+ }
+ code = 1;
}
if (vdev->bbox_device) {
- int bcode = gx_image_end(pie->bbox_info, draw_last);
+ int bcode = gx_image_end(pie->bbox_info, draw_last);
- if (bcode < 0)
- code = bcode;
+ if (bcode < 0)
+ code = bcode;
}
gx_image_free_enum((gx_image_enum_common_t **)&pie);
return code;
@@ -931,12 +931,12 @@ gdev_vector_get_params(gx_device * dev, gs_param_list * plist)
gs_param_string ofns;
if (code < 0)
- return code;
+ return code;
ofns.data = (const byte *)vdev->fname,
- ofns.size = strlen(vdev->fname),
- ofns.persistent = false;
+ ofns.size = strlen(vdev->fname),
+ ofns.persistent = false;
if ((ecode = param_write_string(plist, "OutputFile", &ofns)) < 0)
- return ecode;
+ return ecode;
return code;
}
@@ -950,65 +950,65 @@ gdev_vector_put_params(gx_device * dev, gs_param_list * plist)
gs_param_string ofns;
switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofns)) {
- case 0:
- /*
- * Vector devices typically write header information at the
- * beginning of the file: changing the file name after writing
- * any pages should be an error.
- */
- if (ofns.size > fname_size)
- ecode = gs_error_limitcheck;
- else if (!bytes_compare(ofns.data, ofns.size,
- (const byte *)vdev->fname,
- strlen(vdev->fname))
- ) {
- /* The new name is the same as the old name. Do nothing. */
- ofns.data = 0;
- break;
- } else if (dev->LockSafetyParams ||
- (dev->is_open && vdev->strm != 0 &&
- stell(vdev->strm) != 0)
- )
- ecode = (dev->LockSafetyParams) ? gs_error_invalidaccess :
- gs_error_rangecheck;
- else
- break;
- goto ofe;
- default:
- ecode = code;
- ofe:param_signal_error(plist, param_name, ecode);
- case 1:
- ofns.data = 0;
- break;
+ case 0:
+ /*
+ * Vector devices typically write header information at the
+ * beginning of the file: changing the file name after writing
+ * any pages should be an error.
+ */
+ if (ofns.size > fname_size)
+ ecode = gs_error_limitcheck;
+ else if (!bytes_compare(ofns.data, ofns.size,
+ (const byte *)vdev->fname,
+ strlen(vdev->fname))
+ ) {
+ /* The new name is the same as the old name. Do nothing. */
+ ofns.data = 0;
+ break;
+ } else if (dev->LockSafetyParams ||
+ (dev->is_open && vdev->strm != 0 &&
+ stell(vdev->strm) != 0)
+ )
+ ecode = (dev->LockSafetyParams) ? gs_error_invalidaccess :
+ gs_error_rangecheck;
+ else
+ break;
+ goto ofe;
+ default:
+ ecode = code;
+ ofe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ ofns.data = 0;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
{
- bool open = dev->is_open;
+ bool open = dev->is_open;
- /* Don't let gx_default_put_params close the device. */
- dev->is_open = false;
- code = gx_default_put_params(dev, plist);
- dev->is_open = open;
+ /* Don't let gx_default_put_params close the device. */
+ dev->is_open = false;
+ code = gx_default_put_params(dev, plist);
+ dev->is_open = open;
}
if (code < 0)
- return code;
+ return code;
if (ofns.data != 0) {
- memcpy(vdev->fname, ofns.data, ofns.size);
- vdev->fname[ofns.size] = 0;
- if (vdev->file != 0) {
- gx_device_bbox *bbdev = vdev->bbox_device;
-
- vdev->bbox_device = 0; /* don't let it be freed */
- code = gdev_vector_close_file(vdev);
- vdev->bbox_device = bbdev;
- if (code < 0)
- return code;
- return gdev_vector_open_file_options(vdev, vdev->strmbuf_size,
- vdev->open_options);
- }
+ memcpy(vdev->fname, ofns.data, ofns.size);
+ vdev->fname[ofns.size] = 0;
+ if (vdev->file != 0) {
+ gx_device_bbox *bbdev = vdev->bbox_device;
+
+ vdev->bbox_device = 0; /* don't let it be freed */
+ code = gdev_vector_close_file(vdev);
+ vdev->bbox_device = bbdev;
+ if (code < 0)
+ return code;
+ return gdev_vector_open_file_options(vdev, vdev->strmbuf_size,
+ vdev->open_options);
+ }
}
return 0;
}
@@ -1017,67 +1017,67 @@ gdev_vector_put_params(gx_device * dev, gs_param_list * plist)
int
gdev_vector_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_drawing_color dcolor;
/* Ignore the initial fill with white. */
if (!vdev->in_page && color == vdev->white)
- return 0;
+ return 0;
/*
* The original colorspace and client color are unknown so use
* set_nonclient_dev_color instead of color_set_pure.
*/
set_nonclient_dev_color(&dcolor, color);
{
- /* Make sure we aren't being clipped. */
- int code = gdev_vector_update_clip_path(vdev, NULL);
+ /* Make sure we aren't being clipped. */
+ int code = gdev_vector_update_clip_path(vdev, NULL);
- if (code < 0)
- return code;
- if ((code = update_fill(vdev, NULL, &dcolor, rop3_T)) < 0)
- return code;
+ if (code < 0)
+ return code;
+ if ((code = update_fill(vdev, NULL, &dcolor, rop3_T)) < 0)
+ return code;
}
if (vdev->bbox_device) {
- int code = (*dev_proc(vdev->bbox_device, fill_rectangle))
- ((gx_device *) vdev->bbox_device, x, y, w, h, color);
+ int code = (*dev_proc(vdev->bbox_device, fill_rectangle))
+ ((gx_device *) vdev->bbox_device, x, y, w, h, color);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return (*vdev_proc(vdev, dorect)) (vdev, int2fixed(x), int2fixed(y),
- int2fixed(x + w), int2fixed(y + h),
- gx_path_type_fill);
+ int2fixed(x + w), int2fixed(y + h),
+ gx_path_type_fill);
}
int
gdev_vector_fill_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_fill_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_fill_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
int code;
if ((code = gdev_vector_update_clip_path(vdev, pcpath)) < 0 ||
- (code = gdev_vector_prepare_fill(vdev, pis, params, pdevc)) < 0 ||
- (vdev->bbox_device &&
- (code = (*dev_proc(vdev->bbox_device, fill_path))
- ((gx_device *) vdev->bbox_device, pis, ppath, params,
- pdevc, pcpath)) < 0) ||
- (code = (*vdev_proc(vdev, dopath))
- (vdev, ppath,
- (params->rule > 0 ? gx_path_type_even_odd :
- gx_path_type_winding_number) | gx_path_type_fill |
- vdev->fill_options,
- NULL)) < 0
- )
- return gx_default_fill_path(dev, pis, ppath, params, pdevc, pcpath);
+ (code = gdev_vector_prepare_fill(vdev, pis, params, pdevc)) < 0 ||
+ (vdev->bbox_device &&
+ (code = (*dev_proc(vdev->bbox_device, fill_path))
+ ((gx_device *) vdev->bbox_device, pis, ppath, params,
+ pdevc, pcpath)) < 0) ||
+ (code = (*vdev_proc(vdev, dopath))
+ (vdev, ppath,
+ (params->rule > 0 ? gx_path_type_even_odd :
+ gx_path_type_winding_number) | gx_path_type_fill |
+ vdev->fill_options,
+ NULL)) < 0
+ )
+ return gx_default_fill_path(dev, pis, ppath, params, pdevc, pcpath);
return code;
}
int
gdev_vector_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
int code;
double scale;
@@ -1085,23 +1085,23 @@ gdev_vector_stroke_path(gx_device * dev, const gs_imager_state * pis,
gs_matrix mat;
if ((code = gdev_vector_update_clip_path(vdev, pcpath)) < 0 ||
- (set_ctm = gdev_vector_stroke_scaling(vdev, pis, &scale, &mat)) != 0 ||
- (code = gdev_vector_prepare_stroke(vdev, pis, params, pdcolor, scale)) < 0 ||
- (vdev->bbox_device &&
- (code = (*dev_proc(vdev->bbox_device, stroke_path))
- ((gx_device *) vdev->bbox_device, pis, ppath, params,
- pdcolor, pcpath)) < 0) ||
- (code = (*vdev_proc(vdev, dopath))
- (vdev, ppath, gx_path_type_stroke | vdev->stroke_options, NULL)) < 0
- )
- return gx_default_stroke_path(dev, pis, ppath, params, pdcolor, pcpath);
+ (set_ctm = gdev_vector_stroke_scaling(vdev, pis, &scale, &mat)) != 0 ||
+ (code = gdev_vector_prepare_stroke(vdev, pis, params, pdcolor, scale)) < 0 ||
+ (vdev->bbox_device &&
+ (code = (*dev_proc(vdev->bbox_device, stroke_path))
+ ((gx_device *) vdev->bbox_device, pis, ppath, params,
+ pdcolor, pcpath)) < 0) ||
+ (code = (*vdev_proc(vdev, dopath))
+ (vdev, ppath, gx_path_type_stroke | vdev->stroke_options, NULL)) < 0
+ )
+ return gx_default_stroke_path(dev, pis, ppath, params, pdcolor, pcpath);
return code;
}
int
gdev_vector_fill_trapezoid(gx_device * dev, const gs_fixed_edge * left,
- const gs_fixed_edge * right, fixed ybot, fixed ytop, bool swap_axes,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ const gs_fixed_edge * right, fixed ybot, fixed ytop, bool swap_axes,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
fixed xl = left->start.x;
fixed wl = left->end.x - xl;
@@ -1122,94 +1122,94 @@ gdev_vector_fill_trapezoid(gx_device * dev, const gs_fixed_edge * left,
gs_fixed_point points[4];
if (code < 0)
- return gx_default_fill_trapezoid(dev, left, right, ybot, ytop,
- swap_axes, pdevc, lop);
+ return gx_default_fill_trapezoid(dev, left, right, ybot, ytop,
+ swap_axes, pdevc, lop);
/* Make sure we aren't being clipped. */
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
if (swap_axes)
- points[0].y = x0l, points[1].y = x0r,
- points[0].x = points[1].x = y0,
- points[2].y = x1r, points[3].y = x1l,
- points[2].x = points[3].x = y1;
+ points[0].y = x0l, points[1].y = x0r,
+ points[0].x = points[1].x = y0,
+ points[2].y = x1r, points[3].y = x1l,
+ points[2].x = points[3].x = y1;
else
- points[0].x = x0l, points[1].x = x0r,
- points[0].y = points[1].y = y0,
- points[2].x = x1r, points[3].x = x1l,
- points[2].y = points[3].y = y1;
+ points[0].x = x0l, points[1].x = x0r,
+ points[0].y = points[1].y = y0,
+ points[2].x = x1r, points[3].x = x1l,
+ points[2].y = points[3].y = y1;
#undef y0
#undef y1
if (vdev->bbox_device) {
- int code = (*dev_proc(vdev->bbox_device, fill_trapezoid))
- ((gx_device *) vdev->bbox_device, left, right, ybot, ytop,
- swap_axes, pdevc, lop);
+ int code = (*dev_proc(vdev->bbox_device, fill_trapezoid))
+ ((gx_device *) vdev->bbox_device, left, right, ybot, ytop,
+ swap_axes, pdevc, lop);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return gdev_vector_write_polygon(vdev, points, 4, true,
- gx_path_type_fill);
+ gx_path_type_fill);
}
int
gdev_vector_fill_parallelogram(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
fixed pax = px + ax, pay = py + ay;
int code = update_fill(vdev, NULL, pdevc, lop);
gs_fixed_point points[4];
if (code < 0)
- return gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
- pdevc, lop);
+ return gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
+ pdevc, lop);
/* Make sure we aren't being clipped. */
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
if (vdev->bbox_device) {
- code = (*dev_proc(vdev->bbox_device, fill_parallelogram))
- ((gx_device *) vdev->bbox_device, px, py, ax, ay, bx, by,
- pdevc, lop);
- if (code < 0)
- return code;
+ code = (*dev_proc(vdev->bbox_device, fill_parallelogram))
+ ((gx_device *) vdev->bbox_device, px, py, ax, ay, bx, by,
+ pdevc, lop);
+ if (code < 0)
+ return code;
}
points[0].x = px, points[0].y = py;
points[1].x = pax, points[1].y = pay;
points[2].x = pax + bx, points[2].y = pay + by;
points[3].x = px + bx, points[3].y = py + by;
return gdev_vector_write_polygon(vdev, points, 4, true,
- gx_path_type_fill);
+ gx_path_type_fill);
}
int
gdev_vector_fill_triangle(gx_device * dev,
- fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
- const gx_device_color * pdevc, gs_logical_operation_t lop)
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_device_color * pdevc, gs_logical_operation_t lop)
{
int code = update_fill(vdev, NULL, pdevc, lop);
gs_fixed_point points[3];
if (code < 0)
- return gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
- pdevc, lop);
+ return gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
+ pdevc, lop);
/* Make sure we aren't being clipped. */
code = gdev_vector_update_clip_path(vdev, NULL);
if (code < 0)
- return code;
+ return code;
if (vdev->bbox_device) {
- code = (*dev_proc(vdev->bbox_device, fill_triangle))
- ((gx_device *) vdev->bbox_device, px, py, ax, ay, bx, by,
- pdevc, lop);
- if (code < 0)
- return code;
+ code = (*dev_proc(vdev->bbox_device, fill_triangle))
+ ((gx_device *) vdev->bbox_device, px, py, ax, ay, bx, by,
+ pdevc, lop);
+ if (code < 0)
+ return code;
}
points[0].x = px, points[0].y = py;
points[1].x = px + ax, points[1].y = py + ay;
points[2].x = px + bx, points[2].y = py + by;
return gdev_vector_write_polygon(vdev, points, 3, true,
- gx_path_type_fill);
+ gx_path_type_fill);
}
#undef vdev
diff --git a/gs/base/gdevvec.h b/gs/base/gdevvec.h
index 875a8b639..c42e10226 100644
--- a/gs/base/gdevvec.h
+++ b/gs/base/gdevvec.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -98,43 +98,43 @@ typedef struct gx_device_vector_procs_s {
int (*beginpage) (gx_device_vector * vdev);
/* The beginpage proc is actually called from gdev_vector_stream(),
so this accessor must be used from all other procs that want
- to be called after beginpage and *cannot* be used from within
- beginpage. in_page must also be set to false in the device's
- output_page method to request that beginpage be called again
- when drawing next occurs. */
+ to be called after beginpage and *cannot* be used from within
+ beginpage. in_page must also be set to false in the device's
+ output_page method to request that beginpage be called again
+ when drawing next occurs. */
/* Imager state */
int (*setlinewidth) (gx_device_vector * vdev, floatp width);
int (*setlinecap) (gx_device_vector * vdev, gs_line_cap cap);
int (*setlinejoin) (gx_device_vector * vdev, gs_line_join join);
int (*setmiterlimit) (gx_device_vector * vdev, floatp limit);
int (*setdash) (gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset);
+ uint count, floatp offset);
int (*setflat) (gx_device_vector * vdev, floatp flatness);
int (*setlogop) (gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff);
+ gs_logical_operation_t diff);
/* Other state */
- bool (*can_handle_hl_color) (gx_device_vector * vdev, const gs_imager_state * pis,
+ bool (*can_handle_hl_color) (gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc);
- int (*setfillcolor) (gx_device_vector * vdev, const gs_imager_state * pis,
+ int (*setfillcolor) (gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc);
int (*setstrokecolor) (gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc);
/* Paths */
/* dopath and dorect are normally defaulted */
int (*dopath) (gx_device_vector * vdev, const gx_path * ppath,
- gx_path_type_t type, const gs_matrix *pmat);
+ gx_path_type_t type, const gs_matrix *pmat);
int (*dorect) (gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type);
+ fixed y1, gx_path_type_t type);
int (*beginpath) (gx_device_vector * vdev, gx_path_type_t type);
int (*moveto) (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
int (*lineto) (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
int (*curveto) (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type);
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type);
int (*closepath) (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type);
+ floatp x_start, floatp y_start, gx_path_type_t type);
int (*endpath) (gx_device_vector * vdev, gx_path_type_t type);
} gx_device_vector_procs;
@@ -145,66 +145,66 @@ int gdev_vector_setflat(gx_device_vector * vdev, floatp flatness);
/* dopath may call dorect, beginpath, moveto/lineto/curveto/closepath, */
/* endpath */
int gdev_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
- gx_path_type_t type, const gs_matrix *pmat);
+ gx_path_type_t type, const gs_matrix *pmat);
/* dorect may call beginpath, moveto, lineto, closepath */
int gdev_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0,
- fixed x1, fixed y1, gx_path_type_t type);
+ fixed x1, fixed y1, gx_path_type_t type);
/* Finally, define the extended device structure. */
#define gx_device_vector_common\
- gx_device_common;\
- gs_memory_t *v_memory;\
- /* Output element writing procedures */\
- const gx_device_vector_procs *vec_procs;\
- /* Output file */\
- char fname[fname_size + 1];\
- FILE *file;\
- stream *strm;\
- byte *strmbuf;\
- uint strmbuf_size;\
- int open_options; /* see below */\
- /* Graphics state */\
- gs_imager_state state;\
- float dash_pattern[max_dash];\
- bool fill_used_process_color;\
- bool stroke_used_process_color;\
- gx_hl_saved_color saved_fill_color;\
- gx_hl_saved_color saved_stroke_color;\
- gs_id no_clip_path_id; /* indicates no clipping */\
- gs_id clip_path_id;\
- /* Other state */\
- gx_path_type_t fill_options, stroke_options; /* optimize */\
- gs_point scale; /* device coords / scale => output coords */\
- bool in_page; /* true if any marks on this page */\
- gx_device_bbox *bbox_device; /* for tracking bounding box */\
- /* Cached values */\
- gx_color_index black, white
+ gx_device_common;\
+ gs_memory_t *v_memory;\
+ /* Output element writing procedures */\
+ const gx_device_vector_procs *vec_procs;\
+ /* Output file */\
+ char fname[fname_size + 1];\
+ FILE *file;\
+ stream *strm;\
+ byte *strmbuf;\
+ uint strmbuf_size;\
+ int open_options; /* see below */\
+ /* Graphics state */\
+ gs_imager_state state;\
+ float dash_pattern[max_dash];\
+ bool fill_used_process_color;\
+ bool stroke_used_process_color;\
+ gx_hl_saved_color saved_fill_color;\
+ gx_hl_saved_color saved_stroke_color;\
+ gs_id no_clip_path_id; /* indicates no clipping */\
+ gs_id clip_path_id;\
+ /* Other state */\
+ gx_path_type_t fill_options, stroke_options; /* optimize */\
+ gs_point scale; /* device coords / scale => output coords */\
+ bool in_page; /* true if any marks on this page */\
+ gx_device_bbox *bbox_device; /* for tracking bounding box */\
+ /* Cached values */\
+ gx_color_index black, white
#define vdev_proc(vdev, p) ((vdev)->vec_procs->p)
#define vector_initial_values\
- 0, /* v_memory */\
- 0, /* vec_procs */\
- { 0 }, /* fname */\
- 0, /* file */\
- 0, /* strm */\
- 0, /* strmbuf */\
- 0, /* strmbuf_size */\
- 0, /* open_options */\
- { 0 }, /* state */\
- { 0 }, /* dash_pattern */\
- true, /* fill_used_process_color */\
- true, /* stroke_used_process_color */\
- { 0 }, /* fill_color ****** WRONG ****** */\
- { 0 }, /* stroke_color ****** WRONG ****** */\
- gs_no_id, /* clip_path_id */\
- gs_no_id, /* no_clip_path_id */\
- 0, 0, /* fill/stroke_options */\
- { X_DPI/72.0, Y_DPI/72.0 }, /* scale */\
- 0/*false*/, /* in_page */\
- 0, /* bbox_device */\
- gx_no_color_index, /* black */\
- gx_no_color_index /* white */
+ 0, /* v_memory */\
+ 0, /* vec_procs */\
+ { 0 }, /* fname */\
+ 0, /* file */\
+ 0, /* strm */\
+ 0, /* strmbuf */\
+ 0, /* strmbuf_size */\
+ 0, /* open_options */\
+ { 0 }, /* state */\
+ { 0 }, /* dash_pattern */\
+ true, /* fill_used_process_color */\
+ true, /* stroke_used_process_color */\
+ { 0 }, /* fill_color ****** WRONG ****** */\
+ { 0 }, /* stroke_color ****** WRONG ****** */\
+ gs_no_id, /* clip_path_id */\
+ gs_no_id, /* no_clip_path_id */\
+ 0, 0, /* fill/stroke_options */\
+ { X_DPI/72.0, Y_DPI/72.0 }, /* scale */\
+ 0/*false*/, /* in_page */\
+ 0, /* bbox_device */\
+ gx_no_color_index, /* black */\
+ gx_no_color_index /* white */
struct gx_device_vector_s {
gx_device_vector_common;
@@ -235,13 +235,13 @@ void gdev_vector_reset(gx_device_vector * vdev);
#define VECTOR_OPEN_FILE_ASCII 1 /* open file as text, not binary */
#define VECTOR_OPEN_FILE_SEQUENTIAL 2 /* open as non-seekable */
#define VECTOR_OPEN_FILE_SEQUENTIAL_OK 4 /* open as non-seekable if */
- /* open as seekable fails */
+ /* open as seekable fails */
#define VECTOR_OPEN_FILE_BBOX 8 /* also open bbox device */
int gdev_vector_open_file_options(gx_device_vector * vdev,
- uint strmbuf_size, int open_options);
+ uint strmbuf_size, int open_options);
#define gdev_vector_open_file_bbox(vdev, bufsize, bbox)\
gdev_vector_open_file_options(vdev, bufsize,\
- (bbox ? VECTOR_OPEN_FILE_BBOX : 0))
+ (bbox ? VECTOR_OPEN_FILE_BBOX : 0))
#define gdev_vector_open_file(vdev, strmbuf_size)\
gdev_vector_open_file_bbox(vdev, strmbuf_size, false)
@@ -251,20 +251,20 @@ stream *gdev_vector_stream(gx_device_vector * vdev);
/* Bring the logical operation up to date. */
/* May call setlogop. */
int gdev_vector_update_log_op(gx_device_vector * vdev,
- gs_logical_operation_t lop);
+ gs_logical_operation_t lop);
/* Bring the fill color up to date. */
/* May call setfillcolor. */
int gdev_vector_update_fill_color(gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_drawing_color * pdcolor);
+ const gs_imager_state * pis,
+ const gx_drawing_color * pdcolor);
/* Bring state up to date for filling. */
/* May call setflat, setfillcolor, setlogop. */
int gdev_vector_prepare_fill(gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_fill_params * params,
- const gx_drawing_color * pdcolor);
+ const gs_imager_state * pis,
+ const gx_fill_params * params,
+ const gx_drawing_color * pdcolor);
/* Bring state up to date for stroking. Note that we pass the scale */
/* for the line width and dash offset explicitly. */
@@ -272,10 +272,10 @@ int gdev_vector_prepare_fill(gx_device_vector * vdev,
/* setdash, setflat, setstrokecolor, setlogop. */
/* Any of pis, params, and pdcolor may be NULL. */
int gdev_vector_prepare_stroke(gx_device_vector * vdev,
- const gs_imager_state * pis,
- const gx_stroke_params * params,
- const gx_drawing_color * pdcolor,
- floatp scale);
+ const gs_imager_state * pis,
+ const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor,
+ floatp scale);
/*
* Compute the scale for transforming the line width and dash pattern for a
@@ -284,8 +284,8 @@ int gdev_vector_prepare_stroke(gx_device_vector * vdev,
* Return 0 if only scaling, 1 if a full matrix is needed.
*/
int gdev_vector_stroke_scaling(const gx_device_vector *vdev,
- const gs_imager_state *pis,
- double *pscale, gs_matrix *pmat);
+ const gs_imager_state *pis,
+ double *pscale, gs_matrix *pmat);
/* Prepare to write a path using the default implementation. */
typedef struct gdev_vector_dopath_state_s {
@@ -299,35 +299,35 @@ typedef struct gdev_vector_dopath_state_s {
gs_point prev;
} gdev_vector_dopath_state_t;
void gdev_vector_dopath_init(gdev_vector_dopath_state_t *state,
- gx_device_vector *vdev,
- gx_path_type_t type, const gs_matrix *pmat);
+ gx_device_vector *vdev,
+ gx_path_type_t type, const gs_matrix *pmat);
/* Write a segment of a path using the default implementation. */
int gdev_vector_dopath_segment(gdev_vector_dopath_state_t *state, int pe_op,
- gs_fixed_point vs[3]);
+ gs_fixed_point vs[3]);
/* Write a polygon as part of a path (type = gx_path_type_none) */
/* or as a path. */
/* May call moveto, lineto, closepath (if close); */
/* may call beginpath & endpath if type != none. */
int gdev_vector_write_polygon(gx_device_vector * vdev,
- const gs_fixed_point * points, uint count,
- bool close, gx_path_type_t type);
+ const gs_fixed_point * points, uint count,
+ bool close, gx_path_type_t type);
/* Write a rectangle. This is just a special case of write_polygon. */
int gdev_vector_write_rectangle(gx_device_vector * vdev,
- fixed x0, fixed y0, fixed x1, fixed y1,
- bool close, gx_rect_direction_t dir);
+ fixed x0, fixed y0, fixed x1, fixed y1,
+ bool close, gx_rect_direction_t dir);
/* Write a clipping path by calling the path procedures. */
/* May call the same procedures as writepath. */
int gdev_vector_write_clip_path(gx_device_vector * vdev,
- const gx_clip_path * pcpath);
+ const gx_clip_path * pcpath);
/* Bring the clipping state up to date. */
/* May call write_rectangle (q.v.), write_clip_path (q.v.). */
int gdev_vector_update_clip_path(gx_device_vector * vdev,
- const gx_clip_path * pcpath);
+ const gx_clip_path * pcpath);
/* Close the output file and stream. */
int gdev_vector_close_file(gx_device_vector * vdev);
@@ -336,15 +336,15 @@ int gdev_vector_close_file(gx_device_vector * vdev);
/* Define a common set of state parameters for enumerating images. */
#define gdev_vector_image_enum_common\
- gx_image_enum_common;\
- /* Set by begin_image */\
- gx_image_enum_common_t *default_info; /* non-0 iff using default implementation */\
- gx_image_enum_common_t *bbox_info; /* non-0 iff passing image data to bbox dev */\
- int width, height;\
- int bits_per_pixel; /* (per plane) */\
- uint bits_per_row; /* (per plane) */\
- /* Updated dynamically by image_data */\
- int y /* 0 <= y < height */
+ gx_image_enum_common;\
+ /* Set by begin_image */\
+ gx_image_enum_common_t *default_info; /* non-0 iff using default implementation */\
+ gx_image_enum_common_t *bbox_info; /* non-0 iff passing image data to bbox dev */\
+ int width, height;\
+ int bits_per_pixel; /* (per plane) */\
+ uint bits_per_row; /* (per plane) */\
+ /* Updated dynamically by image_data */\
+ int y /* 0 <= y < height */
typedef struct gdev_vector_image_enum_s {
gdev_vector_image_enum_common;
} gdev_vector_image_enum_t;
@@ -361,11 +361,11 @@ extern_st(st_vector_image_enum);
* enumerator.
*/
int gdev_vector_begin_image(gx_device_vector * vdev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, const gx_image_enum_procs_t * pprocs,
- gdev_vector_image_enum_t * pie);
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, const gx_image_enum_procs_t * pprocs,
+ gdev_vector_image_enum_t * pie);
/* End an image, optionally supplying any necessary blank padding rows. */
/* Return 0 if we used the default implementation, 1 if not. */
diff --git a/gs/base/gdevvglb.c b/gs/base/gdevvglb.c
index 7d9eacefa..bedbcbc68 100644
--- a/gs/base/gdevvglb.c
+++ b/gs/base/gdevvglb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -69,7 +69,7 @@ static dev_proc_put_params(vgalib_put_params);
const gx_device_vgalib gs_vgalib_device =
{
std_device_std_body(gx_device_vgalib, 0, "vgalib",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{vgalib_open,
NULL, /* get_initial_matrix */
NULL, /* sync_output */
@@ -101,21 +101,21 @@ vgalib_open(gx_device * dev)
int width = dev->width, height = dev->height;
if (VGAMODE == -1)
- VGAMODE = vga_getdefaultmode();
+ VGAMODE = vga_getdefaultmode();
if (VGAMODE == -1)
- vga_setmode(G640x480x16);
+ vga_setmode(G640x480x16);
else
- vga_setmode(VGAMODE);
+ vga_setmode(VGAMODE);
vga_clear();
if (width == 0)
- width = vga_getxdim() + 1;
+ width = vga_getxdim() + 1;
if (height == 0)
- height = vga_getydim() + 1;
+ height = vga_getydim() + 1;
/*vgalib provides no facilities for finding out aspect ratios */
if (dev->y_pixels_per_inch == 1) {
- dev->y_pixels_per_inch = height / 11.0;
- dev->x_pixels_per_inch = dev->y_pixels_per_inch;
+ dev->y_pixels_per_inch = height / 11.0;
+ dev->x_pixels_per_inch = dev->y_pixels_per_inch;
}
gx_device_set_width_height(dev, width, height);
@@ -123,20 +123,20 @@ vgalib_open(gx_device * dev)
/* (default initialization is monochrome). */
/* We only recognize 16-color devices right now. */
if (vga_getcolors() > 1) {
- int index;
+ int index;
- static const gx_device_color_info vgalib_16color = dci_pc_4bit;
+ static const gx_device_color_info vgalib_16color = dci_pc_4bit;
- dev->color_info = vgalib_16color;
+ dev->color_info = vgalib_16color;
- for (index = 0; index < 16; ++index) {
- gx_color_value rgb[3];
+ for (index = 0; index < 16; ++index) {
+ gx_color_value rgb[3];
- (*dev_proc(dev, map_color_rgb)) (dev, (gx_color_index) index, rgb);
+ (*dev_proc(dev, map_color_rgb)) (dev, (gx_color_index) index, rgb);
#define cv2pv(cv) ((cv) >> (gx_color_value_bits - 8))
- vga_setpalette(index, cv2pv(rgb[0]), cv2pv(rgb[1]), cv2pv(rgb[2]));
+ vga_setpalette(index, cv2pv(rgb[0]), cv2pv(rgb[1]), cv2pv(rgb[2]));
#undef cv2pv
- }
+ }
}
return 0;
}
@@ -156,51 +156,51 @@ vgalib_map_rgb_color(gx_device * dev, const gx_color_value cv[])
static int
vgalib_map_color_rgb(gx_device * dev, gx_color_index index,
- unsigned short rgb[3])
+ unsigned short rgb[3])
{
return pc_4bit_map_color_rgb(dev, index, rgb);
}
static int
vgalib_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
- int x, int y, int w, int h, gx_color_index czero,
- gx_color_index cone, int px, int py)
+ int x, int y, int w, int h, gx_color_index czero,
+ gx_color_index cone, int px, int py)
{
if (czero != gx_no_color_index && cone != gx_no_color_index) {
- vgalib_fill_rectangle(dev, x, y, w, h, czero);
- czero = gx_no_color_index;
+ vgalib_fill_rectangle(dev, x, y, w, h, czero);
+ czero = gx_no_color_index;
}
return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone, px,
- py);
+ py);
}
static int
vgalib_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
int i, j;
fit_fill(dev, x, y, w, h);
vga_setcolor((int)color);
if ((w | h) > 3) { /* Draw larger rectangles as lines. */
- if (w > h)
- for (i = y; i < y + h; ++i)
- vga_drawline(x, i, x + w - 1, i);
- else
- for (j = x; j < x + w; ++j)
- vga_drawline(j, y, j, y + h - 1);
+ if (w > h)
+ for (i = y; i < y + h; ++i)
+ vga_drawline(x, i, x + w - 1, i);
+ else
+ for (j = x; j < x + w; ++j)
+ vga_drawline(j, y, j, y + h - 1);
} else { /* Draw small rectangles point-by-point. */
- for (i = y; i < y + h; i++)
- for (j = x; j < x + w; j++)
- vga_drawpixel(j, i);
+ for (i = y; i < y + h; i++)
+ for (j = x; j < x + w; j++)
+ vga_drawpixel(j, i);
}
return 0;
}
static int
vgalib_copy_mono(gx_device * dev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int width,
- int height, gx_color_index zero, gx_color_index one)
+ int raster, gx_bitmap_id id, int x, int y, int width,
+ int height, gx_color_index zero, gx_color_index one)
{
const byte *ptr_line;
int left_bit, dest_y, end_x;
@@ -213,90 +213,89 @@ vgalib_copy_mono(gx_device * dev, const byte * base, int sourcex,
dest_y = y, end_x = x + width;
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- color = (int)one;
+ if (one == gx_no_color_index)
+ return 0;
+ color = (int)one;
} else {
- if (one == gx_no_color_index) {
- color = (int)zero;
- invert = -1;
- } else { /* Pre-clear the rectangle to zero */
- vgalib_fill_rectangle(dev, x, y, width, height, zero);
- color = (int)one;
- }
+ if (one == gx_no_color_index) {
+ color = (int)zero;
+ invert = -1;
+ } else { /* Pre-clear the rectangle to zero */
+ vgalib_fill_rectangle(dev, x, y, width, height, zero);
+ color = (int)one;
+ }
}
vga_setcolor(color);
while (height--) { /* for each line */
- const byte *ptr_source = ptr_line;
- register int dest_x = x;
- register int bit = left_bit;
-
- while (dest_x < end_x) { /* for each bit in the line */
- if ((*ptr_source ^ invert) & bit)
- vga_drawpixel(dest_x, dest_y);
- dest_x++;
- if ((bit >>= 1) == 0)
- bit = 0x80, ptr_source++;
- }
-
- dest_y++;
- ptr_line += raster;
+ const byte *ptr_source = ptr_line;
+ register int dest_x = x;
+ register int bit = left_bit;
+
+ while (dest_x < end_x) { /* for each bit in the line */
+ if ((*ptr_source ^ invert) & bit)
+ vga_drawpixel(dest_x, dest_y);
+ dest_x++;
+ if ((bit >>= 1) == 0)
+ bit = 0x80, ptr_source++;
+ }
+
+ dest_y++;
+ ptr_line += raster;
}
return 0;
}
-
/* Copy a color pixel map. This is just like a bitmap, except that */
/* each pixel takes 4 bits instead of 1 when device driver has color. */
static int
vgalib_copy_color(gx_device * dev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y,
- int width, int height)
+ int raster, gx_bitmap_id id, int x, int y,
+ int width, int height)
{
fit_copy(dev, base, sourcex, raster, id, x, y, width, height);
if (gx_device_has_color(dev)) { /* color device, four bits per pixel */
- const byte *line = base + (sourcex >> 1);
- int dest_y = y, end_x = x + width;
-
- if (width <= 0)
- return 0;
- while (height--) { /* for each line */
- const byte *source = line;
- register int dest_x = x;
-
- if (sourcex & 1) { /* odd nibble first */
- int color = *source++ & 0xf;
-
- vga_setcolor(color);
- vga_drawpixel(dest_x, dest_y);
- dest_x++;
- }
- /* Now do full bytes */
- while (dest_x < end_x) {
- int color = *source >> 4;
-
- vga_setcolor(color);
- vga_drawpixel(dest_x, dest_y);
- dest_x++;
-
- if (dest_x < end_x) {
- color = *source++ & 0xf;
- vga_setcolor(color);
- vga_drawpixel(dest_x, dest_y);
- dest_x++;
- }
- }
-
- dest_y++;
- line += raster;
- }
+ const byte *line = base + (sourcex >> 1);
+ int dest_y = y, end_x = x + width;
+
+ if (width <= 0)
+ return 0;
+ while (height--) { /* for each line */
+ const byte *source = line;
+ register int dest_x = x;
+
+ if (sourcex & 1) { /* odd nibble first */
+ int color = *source++ & 0xf;
+
+ vga_setcolor(color);
+ vga_drawpixel(dest_x, dest_y);
+ dest_x++;
+ }
+ /* Now do full bytes */
+ while (dest_x < end_x) {
+ int color = *source >> 4;
+
+ vga_setcolor(color);
+ vga_drawpixel(dest_x, dest_y);
+ dest_x++;
+
+ if (dest_x < end_x) {
+ color = *source++ & 0xf;
+ vga_setcolor(color);
+ vga_drawpixel(dest_x, dest_y);
+ dest_x++;
+ }
+ }
+
+ dest_y++;
+ line += raster;
+ }
} else { /* monochrome device: one bit per pixel */
- /* bitmap is the same as bgi_copy_mono: one bit per pixel */
- vgalib_copy_mono(dev, base, sourcex, raster, id, x, y, width, height,
- (gx_color_index) 0, (gx_color_index) 7);
+ /* bitmap is the same as bgi_copy_mono: one bit per pixel */
+ vgalib_copy_mono(dev, base, sourcex, raster, id, x, y, width, height,
+ (gx_color_index) 0, (gx_color_index) 7);
}
return 0;
@@ -314,16 +313,16 @@ vgalib_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
int left = 8;
if (actual_data)
- *actual_data = data;
+ *actual_data = data;
for (x = 0; x < dev->width; ++x) {
- int color = vga_getpixel(x, y);
+ int color = vga_getpixel(x, y);
- if ((left -= depth) < 0)
- *dest++ = b, b = 0, left += 8;
- b += (color & mask) << left;
+ if ((left -= depth) < 0)
+ *dest++ = b, b = 0, left += 8;
+ b += (color & mask) << left;
}
if (left < 8)
- *dest = b;
+ *dest = b;
return 0;
}
@@ -334,7 +333,7 @@ vgalib_get_params(gx_device * dev, gs_param_list * plist)
int code = gx_default_get_params(dev, plist);
if (code < 0)
- return code;
+ return code;
return param_write_int(plist, "DisplayMode", &vga_dev->display_mode);
}
static int
@@ -346,24 +345,24 @@ vgalib_put_params(gx_device * dev, gs_param_list * plist)
const char *param_name;
switch (code = param_read_int(plist, (param_name = "DisplayMode"), &imode)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gx_default_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
if (imode != vga_dev->display_mode) {
- if (dev->is_open)
- gs_closedevice(dev);
- vga_dev->display_mode = imode;
+ if (dev->is_open)
+ gs_closedevice(dev);
+ vga_dev->display_mode = imode;
}
return 0;
}
diff --git a/gs/base/gdevwddb.c b/gs/base/gdevwddb.c
index 3aff74579..a336ddd71 100644
--- a/gs/base/gdevwddb.c
+++ b/gs/base/gdevwddb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,7 +67,7 @@ struct gx_device_win_ddb_s {
#define select_brush(color)\
if (wdev->hbrush != wdev->hbrushs[color])\
{ wdev->hbrush = wdev->hbrushs[color];\
- SelectObject(wdev->hdcbit,wdev->hbrush);\
+ SelectObject(wdev->hdcbit,wdev->hbrush);\
}
HPALETTE hpalette;
LPLOGPALETTE lpalette;
@@ -106,8 +106,8 @@ static const gx_device_procs win_ddb_procs =
gx_device_win_ddb far_data gs_mswin_device =
{
std_device_std_body(gx_device_win_ddb, &win_ddb_procs, "mswin",
- INITIAL_WIDTH, INITIAL_HEIGHT, /* win_open() fills these in later */
- INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
+ INITIAL_WIDTH, INITIAL_HEIGHT, /* win_open() fills these in later */
+ INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
),
{0}, /* std_procs */
0, /* BitsPerPixel - not used */
@@ -130,24 +130,24 @@ win_ddb_open(gx_device * dev)
HDC hdc;
if (code < 0)
- return code;
+ return code;
if (wdev->BitsPerPixel > 8)
- return gs_error_limitcheck; /* don't support 24 bit/pixel */
+ return gs_error_limitcheck; /* don't support 24 bit/pixel */
/* Create the backing bitmap. */
code = win_ddb_alloc_bitmap((gx_device_win *) dev, dev);
if (code < 0)
- return code;
+ return code;
/* Create the bitmap and DC for copy_mono. */
hdc = GetDC(wdev->hwndimg);
wdev->hbmmono = CreateBitmap(bmWidthBits, bmHeight, 1, 1, NULL);
wdev->hdcmono = CreateCompatibleDC(hdc);
if (wdev->hbmmono == NULL || wdev->hdcmono == NULL) {
- win_ddb_free_bitmap((gx_device_win *) dev);
- ReleaseDC(wdev->hwndimg, hdc);
- return win_nomemory();
+ win_ddb_free_bitmap((gx_device_win *) dev);
+ ReleaseDC(wdev->hwndimg, hdc);
+ return win_nomemory();
}
SetMapMode(wdev->hdcmono, GetMapMode(hdc));
SelectObject(wdev->hdcmono, wdev->hbmmono);
@@ -156,8 +156,8 @@ win_ddb_open(gx_device * dev)
/* create palette and tools for bitmap */
if ((wdev->lpalette = win_makepalette((gx_device_win *) dev))
- == (LPLOGPALETTE) NULL)
- return win_nomemory();
+ == (LPLOGPALETTE) NULL)
+ return win_nomemory();
wdev->hpalette = CreatePalette(wdev->lpalette);
(void)SelectPalette(wdev->hdcbit, wdev->hpalette, NULL);
RealizePalette(wdev->hdcbit);
@@ -180,8 +180,8 @@ win_ddb_close(gx_device * dev)
DeleteObject(wdev->hpalette);
DeleteObject(wdev->hbmmono);
gs_free((char *)(wdev->lpalette), 1, sizeof(LOGPALETTE) +
- (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
- "win_ddb_close");
+ (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
+ "win_ddb_close");
return win_close(dev);
}
@@ -189,7 +189,7 @@ win_ddb_close(gx_device * dev)
/* Map a r-g-b color to the colors available under Windows */
static gx_color_index
win_ddb_map_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
- gx_color_value b)
+ gx_color_value b)
{
int i = wdev->nColors;
gx_color_index color = win_map_rgb_color(dev, r, g, b);
@@ -197,7 +197,7 @@ win_ddb_map_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
LPLOGPALETTE lpal = wdev->lpalette;
if (color != i)
- return color;
+ return color;
/* We just added a color to the window palette. */
/* Add it to the bitmap palette as well. */
@@ -224,19 +224,18 @@ rect.left = x, rect.top = y;\
rect.right = x + w, rect.bottom = y + h;\
FillRect(wdev->hdcbit, &rect, wdev->hbrushs[(int)color])
-
/* Fill a rectangle. */
static int
win_ddb_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
fit_fill(dev, x, y, w, h);
/* Use PatBlt for filling. Special-case black. */
if (color == 0)
- PatBlt(wdev->hdcbit, x, y, w, h, rop_write_0s);
+ PatBlt(wdev->hdcbit, x, y, w, h, rop_write_0s);
else {
- select_brush((int)color);
- PatBlt(wdev->hdcbit, x, y, w, h, rop_write_pattern);
+ select_brush((int)color);
+ PatBlt(wdev->hdcbit, x, y, w, h, rop_write_pattern);
}
win_update((gx_device_win *) dev);
@@ -250,78 +249,77 @@ win_ddb_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
static int
win_ddb_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone,
- int px, int py)
+ int px, int py)
{
fit_fill(dev, x, y, w, h);
if (czero != gx_no_color_index && cone != gx_no_color_index) {
- fill_rect(x, y, w, h, czero);
- czero = gx_no_color_index;
+ fill_rect(x, y, w, h, czero);
+ czero = gx_no_color_index;
}
if (tile->raster == bmWidthBytes && tile->size.y <= bmHeight &&
- (px | py) == 0 && cone != gx_no_color_index
- ) { /* We can do this much more efficiently */
- /* by using the internal algorithms of copy_mono */
- /* and gx_default_tile_rectangle. */
- int width = tile->size.x;
- int height = tile->size.y;
- int rwidth = tile->rep_width;
- int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
- x & (rwidth - 1) :
- x % rwidth);
- int ry = y % tile->rep_height;
- int icw = width - irx;
- int ch = height - ry;
- int ex = x + w, ey = y + h;
- int fex = ex - width, fey = ey - height;
- int cx, cy;
-
- select_brush((int)cone);
-
- if (tile->id != wdev->bm_id || tile->id == gx_no_bitmap_id) {
- wdev->bm_id = tile->id;
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * tile->size.y),
- (BYTE *) tile->data);
- }
+ (px | py) == 0 && cone != gx_no_color_index
+ ) { /* We can do this much more efficiently */
+ /* by using the internal algorithms of copy_mono */
+ /* and gx_default_tile_rectangle. */
+ int width = tile->size.x;
+ int height = tile->size.y;
+ int rwidth = tile->rep_width;
+ int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
+ x & (rwidth - 1) :
+ x % rwidth);
+ int ry = y % tile->rep_height;
+ int icw = width - irx;
+ int ch = height - ry;
+ int ex = x + w, ey = y + h;
+ int fex = ex - width, fey = ey - height;
+ int cx, cy;
+
+ select_brush((int)cone);
+
+ if (tile->id != wdev->bm_id || tile->id == gx_no_bitmap_id) {
+ wdev->bm_id = tile->id;
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * tile->size.y),
+ (BYTE *) tile->data);
+ }
#define copy_tile(srcx, srcy, tx, ty, tw, th)\
BitBlt(wdev->hdcbit, tx, ty, tw, th, wdev->hdcmono, srcx, srcy, rop_write_at_1s)
- if (ch > h)
- ch = h;
- for (cy = y;;) {
- if (w <= icw)
- copy_tile(irx, ry, x, cy, w, ch);
- else {
- copy_tile(irx, ry, x, cy, icw, ch);
- cx = x + icw;
- while (cx <= fex) {
- copy_tile(0, ry, cx, cy, width, ch);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, ry, cx, cy, ex - cx, ch);
- }
- }
- if ((cy += ch) >= ey)
- break;
- ch = (cy > fey ? ey - cy : height);
- ry = 0;
- }
-
- win_update((gx_device_win *) dev);
- return 0;
+ if (ch > h)
+ ch = h;
+ for (cy = y;;) {
+ if (w <= icw)
+ copy_tile(irx, ry, x, cy, w, ch);
+ else {
+ copy_tile(irx, ry, x, cy, icw, ch);
+ cx = x + icw;
+ while (cx <= fex) {
+ copy_tile(0, ry, cx, cy, width, ch);
+ cx += width;
+ }
+ if (cx < ex) {
+ copy_tile(0, ry, cx, cy, ex - cx, ch);
+ }
+ }
+ if ((cy += ch) >= ey)
+ break;
+ ch = (cy > fey ? ey - cy : height);
+ ry = 0;
+ }
+
+ win_update((gx_device_win *) dev);
+ return 0;
}
return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone, px, py);
}
-
/* Copy a monochrome bitmap. The colors are given explicitly. */
/* Color = gx_no_color_index means transparent (no effect on the image). */
static int
win_ddb_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
int endx;
const byte *ptr_line;
@@ -334,164 +332,163 @@ win_ddb_copy_mono(gx_device * dev,
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (sourcex & ~7) {
- base += sourcex >> 3;
- sourcex &= 7;
+ base += sourcex >> 3;
+ sourcex &= 7;
}
/* Break up large transfers into smaller ones. */
while ((endx = sourcex + w) > bmWidthBits) {
- int lastx = (endx - 1) & -bmWidthBits;
- int subw = endx - lastx;
- int code = win_ddb_copy_mono(dev, base, lastx,
- raster, gx_no_bitmap_id,
- x + lastx - sourcex, y,
- subw, h, zero, one);
-
- if (code < 0)
- return code;
- w -= subw;
+ int lastx = (endx - 1) & -bmWidthBits;
+ int subw = endx - lastx;
+ int code = win_ddb_copy_mono(dev, base, lastx,
+ raster, gx_no_bitmap_id,
+ x + lastx - sourcex, y,
+ subw, h, zero, one);
+
+ if (code < 0)
+ return code;
+ w -= subw;
}
while (h > bmHeight) {
- int code;
-
- h -= bmHeight;
- code = win_ddb_copy_mono(dev, base + h * raster, sourcex,
- raster, gx_no_bitmap_id,
- x, y + h, w, bmHeight, zero, one);
- if (code < 0)
- return code;
+ int code;
+
+ h -= bmHeight;
+ code = win_ddb_copy_mono(dev, base + h * raster, sourcex,
+ raster, gx_no_bitmap_id,
+ x, y + h, w, bmHeight, zero, one);
+ if (code < 0)
+ return code;
}
width_bytes = (sourcex + w + 7) >> 3;
ptr_line = base;
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- color = (int)one;
- if (color == 0)
- rop = rop_write_0_at_1s;
- else
- select_brush(color);
+ if (one == gx_no_color_index)
+ return 0;
+ color = (int)one;
+ if (color == 0)
+ rop = rop_write_0_at_1s;
+ else
+ select_brush(color);
} else {
- if (one == gx_no_color_index) {
- color = (int)zero;
- rop = rop_write_at_0s;
- } else { /* Pre-clear the rectangle to zero */
- fill_rect(x, y, w, h, zero);
- color = (int)one;
- }
- select_brush(color);
+ if (one == gx_no_color_index) {
+ color = (int)zero;
+ rop = rop_write_at_0s;
+ } else { /* Pre-clear the rectangle to zero */
+ fill_rect(x, y, w, h, zero);
+ color = (int)one;
+ }
+ select_brush(color);
}
if (id != wdev->bm_id || id == gx_no_bitmap_id) {
- wdev->bm_id = id;
- if (raster == bmWidthBytes) { /* We can do the whole thing in a single transfer! */
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * h),
- (BYTE *) base);
- } else {
- for (height = h; height--;
- ptr_line += raster, aptr += bmWidthBytes
- ) { /* Pack the bits into the bitmap. */
- switch (width_bytes) {
- default:
- memcpy(aptr, ptr_line, width_bytes);
- break;
- case 4:
- aptr[3] = ptr_line[3];
- case 3:
- aptr[2] = ptr_line[2];
- case 2:
- aptr[1] = ptr_line[1];
- case 1:
- aptr[0] = ptr_line[0];
- }
- }
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * h),
- &aBit[0]);
- }
+ wdev->bm_id = id;
+ if (raster == bmWidthBytes) { /* We can do the whole thing in a single transfer! */
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * h),
+ (BYTE *) base);
+ } else {
+ for (height = h; height--;
+ ptr_line += raster, aptr += bmWidthBytes
+ ) { /* Pack the bits into the bitmap. */
+ switch (width_bytes) {
+ default:
+ memcpy(aptr, ptr_line, width_bytes);
+ break;
+ case 4:
+ aptr[3] = ptr_line[3];
+ case 3:
+ aptr[2] = ptr_line[2];
+ case 2:
+ aptr[1] = ptr_line[1];
+ case 1:
+ aptr[0] = ptr_line[0];
+ }
+ }
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * h),
+ &aBit[0]);
+ }
}
BitBlt(wdev->hdcbit, x, y, w, h, wdev->hdcmono, sourcex, 0, rop);
win_update((gx_device_win *) dev);
return 0;
}
-
/* Copy a color pixel map. This is just like a bitmap, except that */
/* each pixel takes 8 or 4 bits instead of 1 when device driver has color. */
static int
win_ddb_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (gx_device_has_color(dev)) {
- switch (dev->color_info.depth) {
- case 8:
- {
- int xi, yi;
- int skip = raster - w;
- const byte *sptr = base + sourcex;
-
- if (w <= 0)
- return 0;
- if (x < 0 || x + w > dev->width)
- return_error(gs_error_rangecheck);
- for (yi = y; yi - y < h; yi++) {
- for (xi = x; xi - x < w; xi++) {
- int color = *sptr++;
-
- SetPixel(wdev->hdcbit, xi, yi, PALETTEINDEX(color));
- }
- sptr += skip;
- }
- }
- break;
- case 4:
- { /* color device, four bits per pixel */
- const byte *line = base + (sourcex >> 1);
- int dest_y = y, end_x = x + w;
-
- if (w <= 0)
- return 0;
- while (h--) { /* for each line */
- const byte *source = line;
- register int dest_x = x;
-
- if (sourcex & 1) { /* odd nibble first */
- int color = *source++ & 0xf;
-
- SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- }
- /* Now do full bytes */
- while (dest_x < end_x) {
- int color = *source >> 4;
-
- SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- if (dest_x < end_x) {
- color = *source++ & 0xf;
- SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- }
- }
- dest_y++;
- line += raster;
- }
- }
- break;
- default:
- return (-1); /* panic */
- }
+ switch (dev->color_info.depth) {
+ case 8:
+ {
+ int xi, yi;
+ int skip = raster - w;
+ const byte *sptr = base + sourcex;
+
+ if (w <= 0)
+ return 0;
+ if (x < 0 || x + w > dev->width)
+ return_error(gs_error_rangecheck);
+ for (yi = y; yi - y < h; yi++) {
+ for (xi = x; xi - x < w; xi++) {
+ int color = *sptr++;
+
+ SetPixel(wdev->hdcbit, xi, yi, PALETTEINDEX(color));
+ }
+ sptr += skip;
+ }
+ }
+ break;
+ case 4:
+ { /* color device, four bits per pixel */
+ const byte *line = base + (sourcex >> 1);
+ int dest_y = y, end_x = x + w;
+
+ if (w <= 0)
+ return 0;
+ while (h--) { /* for each line */
+ const byte *source = line;
+ register int dest_x = x;
+
+ if (sourcex & 1) { /* odd nibble first */
+ int color = *source++ & 0xf;
+
+ SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ }
+ /* Now do full bytes */
+ while (dest_x < end_x) {
+ int color = *source >> 4;
+
+ SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ if (dest_x < end_x) {
+ color = *source++ & 0xf;
+ SetPixel(wdev->hdcbit, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ }
+ }
+ dest_y++;
+ line += raster;
+ }
+ }
+ break;
+ default:
+ return (-1); /* panic */
+ }
} else
- /* monochrome device: one bit per pixel */
+ /* monochrome device: one bit per pixel */
{ /* bitmap is the same as win_copy_mono: one bit per pixel */
- win_ddb_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
- (gx_color_index) 0,
- (gx_color_index) (dev->color_info.depth == 8 ? 63 : dev->color_info.max_gray));
+ win_ddb_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
+ (gx_color_index) 0,
+ (gx_color_index) (dev->color_info.depth == 8 ? 63 : dev->color_info.max_gray));
}
win_update((gx_device_win *) dev);
return 0;
@@ -499,42 +496,39 @@ win_ddb_copy_color(gx_device * dev,
/* ------ Windows-specific device procedures ------ */
-
/* Copy the bitmap to the clipboard. */
static void
win_ddb_copy_to_clipboard(gx_device_win * dev)
{ /* make somewhere to put it and copy */
HDC hdcbit = wdev->hdcbit;
HBITMAP bitmap = CreateCompatibleBitmap(hdcbit, dev->width,
- dev->height);
+ dev->height);
if (bitmap) {
- /* there is enough memory and the bitmaps OK */
- HDC mem = CreateCompatibleDC(hdcbit);
-
- SelectObject(mem, bitmap);
- BitBlt(mem, 0, 0, dev->width, dev->height,
- hdcbit, 0, 0, SRCCOPY);
- DeleteDC(mem);
- /* copy it to the clipboard */
- OpenClipboard(wdev->hwndimg);
- EmptyClipboard();
- SetClipboardData(CF_BITMAP, bitmap);
- SetClipboardData(CF_PALETTE, CreatePalette(wdev->limgpalette));
- CloseClipboard();
+ /* there is enough memory and the bitmaps OK */
+ HDC mem = CreateCompatibleDC(hdcbit);
+
+ SelectObject(mem, bitmap);
+ BitBlt(mem, 0, 0, dev->width, dev->height,
+ hdcbit, 0, 0, SRCCOPY);
+ DeleteDC(mem);
+ /* copy it to the clipboard */
+ OpenClipboard(wdev->hwndimg);
+ EmptyClipboard();
+ SetClipboardData(CF_BITMAP, bitmap);
+ SetClipboardData(CF_PALETTE, CreatePalette(wdev->limgpalette));
+ CloseClipboard();
}
}
-
/* Repaint a section of the window. */
static void
win_ddb_repaint(gx_device_win * dev, HDC hdc, int dx, int dy, int wx, int wy,
- int sx, int sy)
+ int sx, int sy)
{
BitBlt(hdc, dx, dy, wx, wy, wdev->hdcbit, sx, sy, SRCCOPY);
}
-
/* Allocate the backing bitmap. */
static int
win_ddb_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
@@ -544,19 +538,19 @@ win_ddb_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
hdc = GetDC(wdev->hwndimg);
for (i = 0;; i++) {
- wdev->hbitmap = CreateCompatibleBitmap(hdc,
- param_dev->width, param_dev->height);
- if (wdev->hbitmap != (HBITMAP) NULL)
- break;
- if (i >= 4) {
- ReleaseDC(wdev->hwndimg, hdc);
- return win_nomemory();
- }
- errprintf(param_dev->memory, "\nNot enough memory for bitmap. Halving resolution... ");
- param_dev->x_pixels_per_inch /= 2;
- param_dev->y_pixels_per_inch /= 2;
- param_dev->width /= 2;
- param_dev->height /= 2;
+ wdev->hbitmap = CreateCompatibleBitmap(hdc,
+ param_dev->width, param_dev->height);
+ if (wdev->hbitmap != (HBITMAP) NULL)
+ break;
+ if (i >= 4) {
+ ReleaseDC(wdev->hwndimg, hdc);
+ return win_nomemory();
+ }
+ errprintf(param_dev->memory, "\nNot enough memory for bitmap. Halving resolution... ");
+ param_dev->x_pixels_per_inch /= 2;
+ param_dev->y_pixels_per_inch /= 2;
+ param_dev->width /= 2;
+ param_dev->height /= 2;
}
wdev->hdcbit = CreateCompatibleDC(hdc); /* create Device Context for drawing */
@@ -565,7 +559,6 @@ win_ddb_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
return 0;
}
-
/* Free the backing bitmap. */
static void
win_ddb_free_bitmap(gx_device_win * dev)
@@ -574,12 +567,10 @@ win_ddb_free_bitmap(gx_device_win * dev)
DeleteObject(wdev->hbitmap);
}
-
/* ------ Internal routines ------ */
#undef wdev
-
static void near
win_addtool(gx_device_win_ddb * wdev, int i)
{
@@ -587,7 +578,6 @@ win_addtool(gx_device_win_ddb * wdev, int i)
wdev->hbrushs[i] = CreateSolidBrush(PALETTEINDEX(i));
}
-
static void near
win_maketools(gx_device_win_ddb * wdev, HDC hdc)
{
@@ -595,34 +585,33 @@ win_maketools(gx_device_win_ddb * wdev, HDC hdc)
wdev->hpensize = (1 << (wdev->color_info.depth)) * sizeof(HPEN);
wdev->hpens = (HPEN *) gs_malloc(wdev->memory, 1, wdev->hpensize,
- "win_maketools(pens)");
+ "win_maketools(pens)");
wdev->hbrushsize = (1 << (wdev->color_info.depth)) * sizeof(HBRUSH);
wdev->hbrushs = (HBRUSH *) gs_malloc(wdev->memory, 1, wdev->hbrushsize,
- "win_maketools(brushes)");
+ "win_maketools(brushes)");
if (wdev->hpens && wdev->hbrushs) {
- for (i = 0; i < wdev->nColors; i++)
- win_addtool(wdev, i);
+ for (i = 0; i < wdev->nColors; i++)
+ win_addtool(wdev, i);
- wdev->hpen = wdev->hpens[0];
- SelectObject(hdc, wdev->hpen);
+ wdev->hpen = wdev->hpens[0];
+ SelectObject(hdc, wdev->hpen);
- wdev->hbrush = wdev->hbrushs[0];
- SelectObject(hdc, wdev->hbrush);
+ wdev->hbrush = wdev->hbrushs[0];
+ SelectObject(hdc, wdev->hbrush);
}
}
-
static void near
win_destroytools(gx_device_win_ddb * wdev)
{
int i;
for (i = 0; i < wdev->nColors; i++) {
- DeleteObject(wdev->hpens[i]);
- DeleteObject(wdev->hbrushs[i]);
+ DeleteObject(wdev->hpens[i]);
+ DeleteObject(wdev->hbrushs[i]);
}
gs_free(wdev->memory, (char *)wdev->hbrushs, 1, wdev->hbrushsize,
- "win_destroytools(brushes)");
+ "win_destroytools(brushes)");
gs_free(wdev->memory, (char *)wdev->hpens, 1, wdev->hpensize,
- "win_destroytools(pens)");
+ "win_destroytools(pens)");
}
diff --git a/gs/base/gdevwdib.c b/gs/base/gdevwdib.c
index e40fde177..c68e96f24 100644
--- a/gs/base/gdevwdib.c
+++ b/gs/base/gdevwdib.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -96,8 +96,8 @@ static const gx_device_procs win_dib_procs =
gx_device_win_dib far_data gs_mswindll_device =
{
std_device_std_body(gx_device_win_dib, &win_dib_procs, "mswindll",
- INITIAL_WIDTH, INITIAL_HEIGHT,/* win_open() fills these in later */
- INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
+ INITIAL_WIDTH, INITIAL_HEIGHT,/* win_open() fills these in later */
+ INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
),
{0}, /* std_procs */
0, /* BitsPerPixel */
@@ -111,7 +111,6 @@ gx_device_win_dib far_data gs_mswindll_device =
static HGLOBAL win_dib_make_dib(gx_device_win * dev, int orgx, int orgy, int wx, int wy);
static int win_dib_lock_device(unsigned char *device, int flag);
-
/* Open the win_dib driver */
static int
win_dib_open(gx_device * dev)
@@ -119,27 +118,27 @@ win_dib_open(gx_device * dev)
int code = win_open(dev);
if (code < 0)
- return code;
+ return code;
#ifdef __WIN32__
if (!is_win32s)
- wdev->hmtx = CreateMutex(NULL, FALSE, NULL); /* unnamed mutex, initially unowned */
+ wdev->hmtx = CreateMutex(NULL, FALSE, NULL); /* unnamed mutex, initially unowned */
#endif
if (gdev_mem_device_for_bits(dev->color_info.depth) == 0) {
- win_close(dev);
- return gs_error_rangecheck;
+ win_close(dev);
+ return gs_error_rangecheck;
}
code = win_dib_alloc_bitmap((gx_device_win *) dev, dev);
if (code < 0) {
- win_close(dev);
- return code;
+ win_close(dev);
+ return code;
}
/* notify caller about new device */
if (pgsdll_callback) {
- (*pgsdll_callback) (GSDLL_DEVICE, (unsigned char *)dev, 1);
- (*pgsdll_callback) (GSDLL_SIZE, (unsigned char *)dev,
- (dev->width & 0xffff) +
- ((ulong) (dev->height & 0xffff) << 16));
+ (*pgsdll_callback) (GSDLL_DEVICE, (unsigned char *)dev, 1);
+ (*pgsdll_callback) (GSDLL_SIZE, (unsigned char *)dev,
+ (dev->width & 0xffff) +
+ ((ulong) (dev->height & 0xffff) << 16));
}
return code;
}
@@ -166,12 +165,12 @@ win_dib_close(gx_device * dev)
/* wait until bitmap is not being used by caller */
win_dib_lock_device((unsigned char *)dev, 1);
if (pgsdll_callback)
- (*pgsdll_callback) (GSDLL_DEVICE, (unsigned char *)dev, 0);
+ (*pgsdll_callback) (GSDLL_DEVICE, (unsigned char *)dev, 0);
win_dib_lock_device((unsigned char *)dev, 0);
win_dib_free_bitmap((gx_device_win *) dev);
#ifdef __WIN32__
if (!is_win32s)
- CloseHandle(wdev->hmtx);
+ CloseHandle(wdev->hmtx);
#endif
code = win_close(dev);
return code;
@@ -190,11 +189,11 @@ win_dib_close(gx_device * dev)
#define BEGIN_BLOCKS\
{ int by, bh, left = h;\
- for ( by = y; left > 0; by += bh, left -= bh )\
- { bh = wdev->y_block - (by & wdev->y_mask);\
- if ( bh > left ) bh = left;
+ for ( by = y; left > 0; by += bh, left -= bh )\
+ { bh = wdev->y_block - (by & wdev->y_mask);\
+ if ( bh > left ) bh = left;
#define END_BLOCKS\
- }\
+ }\
}
#endif /* (!)USE_SEGMENTS */
@@ -202,15 +201,15 @@ win_dib_close(gx_device * dev)
/* Fill a rectangle. */
static int
win_dib_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
#if USE_SEGMENTS
if (single_block(y, h)) {
- wmproc(fill_rectangle) (wmdev, x, y, w, h, color);
+ wmproc(fill_rectangle) (wmdev, x, y, w, h, color);
} else { /* Divide the transfer into blocks. */
- BEGIN_BLOCKS
- wmproc(fill_rectangle) (wmdev, x, by, w, bh, color);
- END_BLOCKS
+ BEGIN_BLOCKS
+ wmproc(fill_rectangle) (wmdev, x, by, w, bh, color);
+ END_BLOCKS
}
#else
wmproc(fill_rectangle) (wmdev, x, y, w, h, color);
@@ -222,27 +221,27 @@ win_dib_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Color = gx_no_color_index means transparent (no effect on the image). */
static int
win_dib_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
#if USE_SEGMENTS
if (single_block(y, h)) {
- wmproc(copy_mono) (wmdev, base, sourcex, raster, id,
- x, y, w, h, zero, one);
+ wmproc(copy_mono) (wmdev, base, sourcex, raster, id,
+ x, y, w, h, zero, one);
} else { /* Divide the transfer into blocks. */
- const byte *source = base;
-
- BEGIN_BLOCKS
- wmproc(copy_mono) (wmdev, source, sourcex, raster,
- gx_no_bitmap_id, x, by, w, bh,
- zero, one);
- source += bh * raster;
- END_BLOCKS
+ const byte *source = base;
+
+ BEGIN_BLOCKS
+ wmproc(copy_mono) (wmdev, source, sourcex, raster,
+ gx_no_bitmap_id, x, by, w, bh,
+ zero, one);
+ source += bh * raster;
+ END_BLOCKS
}
#else
wmproc(copy_mono) (wmdev, base, sourcex, raster, id,
- x, y, w, h, zero, one);
+ x, y, w, h, zero, one);
#endif
return 0;
}
@@ -251,25 +250,25 @@ win_dib_copy_mono(gx_device * dev,
/* each pixel takes 8 or 4 bits instead of 1 when device driver has color. */
static int
win_dib_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
#if USE_SEGMENTS
if (single_block(y, h)) {
- wmproc(copy_color) (wmdev, base, sourcex, raster, id,
- x, y, w, h);
+ wmproc(copy_color) (wmdev, base, sourcex, raster, id,
+ x, y, w, h);
} else { /* Divide the transfer into blocks. */
- const byte *source = base;
+ const byte *source = base;
- BEGIN_BLOCKS
- wmproc(copy_color) (wmdev, source, sourcex, raster,
- gx_no_bitmap_id, x, by, w, bh);
- source += by * raster;
- END_BLOCKS
+ BEGIN_BLOCKS
+ wmproc(copy_color) (wmdev, source, sourcex, raster,
+ gx_no_bitmap_id, x, by, w, bh);
+ source += by * raster;
+ END_BLOCKS
}
#else
wmproc(copy_color) (wmdev, base, sourcex, raster, id,
- x, y, w, h);
+ x, y, w, h);
#endif
return 0;
}
@@ -301,7 +300,7 @@ gsdll_copy_dib(unsigned char *device)
gx_device_win_dib *dev = (gx_device_win_dib *) device;
if (!dev || !dev->is_open || dev->mdev.width == 0 || dev->mdev.height == 0)
- return (HGLOBAL) NULL;
+ return (HGLOBAL) NULL;
return win_dib_make_dib((gx_device_win *) dev, 0, 0, dev->width, dev->height);
}
@@ -313,9 +312,9 @@ gsdll_copy_palette(unsigned char *device)
gx_device_win_dib *dev = (gx_device_win_dib *) device;
if (!dev || !dev->is_open || dev->mdev.width == 0 || dev->mdev.height == 0)
- return (HPALETTE) NULL;
+ return (HPALETTE) NULL;
if (wdev->nColors > 0)
- return CreatePalette(dev->limgpalette);
+ return CreatePalette(dev->limgpalette);
return (HPALETTE) NULL;
}
@@ -330,37 +329,36 @@ gsdll_draw(unsigned char *device, HDC hdc, LPRECT dest, LPRECT src)
HPALETTE oldpalette;
if (!dev || !dev->is_open || dev->mdev.width == 0 || dev->mdev.height == 0)
- return;
+ return;
if (dev->nColors > 0) {
- oldpalette = SelectPalette(hdc, dev->himgpalette, FALSE);
- RealizePalette(hdc);
+ oldpalette = SelectPalette(hdc, dev->himgpalette, FALSE);
+ RealizePalette(hdc);
}
win_dib_repaint((gx_device_win *) dev, hdc, dest->left, dest->top,
- dest->right - dest->left, dest->bottom - dest->top,
- src->left, src->top);
+ dest->right - dest->left, dest->bottom - dest->top,
+ src->left, src->top);
if (dev->nColors > 0) {
- SelectPalette(hdc, oldpalette, FALSE);
+ SelectPalette(hdc, oldpalette, FALSE);
}
return;
}
/* ------ Windows-specific device procedures ------ */
-
/* Repaint a section of the window. */
static void
win_dib_repaint(gx_device_win * dev, HDC hdc, int dx, int dy, int wx, int wy,
- int sx, int sy)
+ int sx, int sy)
{
struct bmi_s {
- BITMAPINFOHEADER h;
- ushort pal_index[256];
+ BITMAPINFOHEADER h;
+ ushort pal_index[256];
} bmi;
int i;
UINT which_colors;
memset(&bmi.h, 0, sizeof(bmi.h));
-
+
bmi.h.biSize = sizeof(bmi.h);
bmi.h.biWidth = wdev->mdev.width;
bmi.h.biHeight = wy;
@@ -370,31 +368,31 @@ win_dib_repaint(gx_device_win * dev, HDC hdc, int dx, int dy, int wx, int wy,
bmi.h.biSizeImage = 0; /* default */
bmi.h.biXPelsPerMeter = 0; /* default */
bmi.h.biYPelsPerMeter = 0; /* default */
-
+
if (dev->BitsPerPixel <= 8) {
- bmi.h.biClrUsed = wdev->nColors;
- bmi.h.biClrImportant = wdev->nColors;
- for (i = 0; i < wdev->nColors; i++)
- bmi.pal_index[i] = i;
- which_colors = DIB_PAL_COLORS;
+ bmi.h.biClrUsed = wdev->nColors;
+ bmi.h.biClrImportant = wdev->nColors;
+ for (i = 0; i < wdev->nColors; i++)
+ bmi.pal_index[i] = i;
+ which_colors = DIB_PAL_COLORS;
} else if (dev->BitsPerPixel == 15) { /* 5-5-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0x7c00;
- bmi_colors[1] = 0x03e0;
- bmi_colors[2] = 0x001f;
- which_colors = DIB_RGB_COLORS;
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ bmi_colors[0] = 0x7c00;
+ bmi_colors[1] = 0x03e0;
+ bmi_colors[2] = 0x001f;
+ which_colors = DIB_RGB_COLORS;
} else if (dev->BitsPerPixel == 16) { /* 5-6-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0xf800;
- bmi_colors[1] = 0x07e0;
- bmi_colors[2] = 0x001f;
- which_colors = DIB_RGB_COLORS;
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ bmi_colors[0] = 0xf800;
+ bmi_colors[1] = 0x07e0;
+ bmi_colors[2] = 0x001f;
+ which_colors = DIB_RGB_COLORS;
} else {
- bmi.h.biClrUsed = 0;
- bmi.h.biClrImportant = 0;
- which_colors = DIB_RGB_COLORS;
+ bmi.h.biClrUsed = 0;
+ bmi.h.biClrImportant = 0;
+ which_colors = DIB_RGB_COLORS;
}
/*
* Windows apparently limits the size of a single transfer
@@ -403,19 +401,19 @@ win_dib_repaint(gx_device_win * dev, HDC hdc, int dx, int dy, int wx, int wy,
*/
#define max_transfer 2000000
if (wdev->mdev.raster > 0) { /* just in case! */
- long ny = max_transfer / wdev->mdev.raster;
+ long ny = max_transfer / wdev->mdev.raster;
- for (; wy > ny; dy += ny, wy -= ny, sy += ny)
- SetDIBitsToDevice(hdc, dx, dy, wx, ny,
- sx, 0, 0, ny,
- wdev->mdev.line_ptrs[wdev->height - (sy + ny)],
- (BITMAPINFO FAR *) & bmi, which_colors);
+ for (; wy > ny; dy += ny, wy -= ny, sy += ny)
+ SetDIBitsToDevice(hdc, dx, dy, wx, ny,
+ sx, 0, 0, ny,
+ wdev->mdev.line_ptrs[wdev->height - (sy + ny)],
+ (BITMAPINFO FAR *) & bmi, which_colors);
}
#undef max_transfer
SetDIBitsToDevice(hdc, dx, dy, wx, wy,
- sx, 0, 0, wy,
- wdev->mdev.line_ptrs[wdev->height - (sy + wy)],
- (BITMAPINFO FAR *) & bmi, which_colors);
+ sx, 0, 0, wy,
+ wdev->mdev.line_ptrs[wdev->height - (sy + wy)],
+ (BITMAPINFO FAR *) & bmi, which_colors);
}
/* This makes a DIB that contains all or part of the bitmap. */
@@ -442,31 +440,31 @@ win_dib_make_dib(gx_device_win * dev, int orgx, int orgy, int wx, int wy)
#endif
if (orgx + wx > wdev->width)
- wx = wdev->width - orgx;
+ wx = wdev->width - orgx;
if (orgy + wy > wdev->height)
- wy = wdev->height - orgy;
+ wy = wdev->height - orgy;
loffset = orgx * wdev->color_info.depth / 8;
lwidth = ((wx * wdev->color_info.depth + 31) & ~31) >> 3;
bitmapsize = (long)lwidth *wy;
if (wdev->color_info.depth > 16)
- palcount = 0;
+ palcount = 0;
else if (wdev->color_info.depth > 8)
- palcount = 3; /* 16-bit BI_BITFIELDS */
+ palcount = 3; /* 16-bit BI_BITFIELDS */
else
- palcount = wdev->nColors;
+ palcount = wdev->nColors;
hglobal = GlobalAlloc(GHND | GMEM_SHARE, sizeof(BITMAPINFOHEADER)
- + sizeof(RGBQUAD) * palcount + bitmapsize);
+ + sizeof(RGBQUAD) * palcount + bitmapsize);
if (hglobal == (HGLOBAL) NULL) {
- MessageBeep(-1);
- return (HGLOBAL) NULL;
+ MessageBeep(-1);
+ return (HGLOBAL) NULL;
}
pDIB = (BYTE FAR *) GlobalLock(hglobal);
if (pDIB == (BYTE FAR *) NULL) {
- MessageBeep(-1);
- return (HGLOBAL) NULL;
+ MessageBeep(-1);
+ return (HGLOBAL) NULL;
}
pbmih = (BITMAPINFOHEADER FAR *) (pDIB);
pColors = (RGBQUAD FAR *) (pDIB + sizeof(BITMAPINFOHEADER));
@@ -485,51 +483,50 @@ win_dib_make_dib(gx_device_win * dev, int orgx, int orgy, int wx, int wy)
pbmih->biClrImportant = palcount;
if (dev->BitsPerPixel == 15) { /* 5-5-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(pColors);
+ DWORD* bmi_colors = (DWORD*)(pColors);
pbmih->biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0x7c00;
- bmi_colors[1] = 0x03e0;
- bmi_colors[2] = 0x001f;
- }
+ bmi_colors[0] = 0x7c00;
+ bmi_colors[1] = 0x03e0;
+ bmi_colors[2] = 0x001f;
+ }
else if (dev->BitsPerPixel == 16) { /* 5-6-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(pColors);
+ DWORD* bmi_colors = (DWORD*)(pColors);
pbmih->biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0xf800;
- bmi_colors[1] = 0x07e0;
- bmi_colors[2] = 0x001f;
- }
+ bmi_colors[0] = 0xf800;
+ bmi_colors[1] = 0x07e0;
+ bmi_colors[2] = 0x001f;
+ }
else {
for (i = 0; i < palcount; i++) {
- win_map_color_rgb((gx_device *) wdev, (gx_color_index) i, prgb);
- pColors[i].rgbRed = win_color_value(prgb[0]);
- pColors[i].rgbGreen = win_color_value(prgb[1]);
- pColors[i].rgbBlue = win_color_value(prgb[2]);
- pColors[i].rgbReserved = 0;
+ win_map_color_rgb((gx_device *) wdev, (gx_color_index) i, prgb);
+ pColors[i].rgbRed = win_color_value(prgb[0]);
+ pColors[i].rgbGreen = win_color_value(prgb[1]);
+ pColors[i].rgbBlue = win_color_value(prgb[2]);
+ pColors[i].rgbReserved = 0;
}
}
pLine = pBits;
for (i = orgy; i < orgy + wy; i++) {
#if USE_SEGMENTS
- /* Window 3.1 has hmemcpy, but 3.0 doesn't */
- lseg = (UINT) (-OFFSETOF(pLine)); /* remaining bytes in this segment */
- if (lseg >= lwidth) {
- _fmemcpy(pLine, xwdev->mdev.line_ptrs[i] + loffset, lwidth);
- } else { /* break up transfer to avoid crossing segment boundary */
- _fmemcpy(pLine, xwdev->mdev.line_ptrs[i] + loffset, lseg);
- _fmemcpy(pLine + lseg, xwdev->mdev.line_ptrs[i] + loffset + lseg, lwidth - lseg);
- }
+ /* Window 3.1 has hmemcpy, but 3.0 doesn't */
+ lseg = (UINT) (-OFFSETOF(pLine)); /* remaining bytes in this segment */
+ if (lseg >= lwidth) {
+ _fmemcpy(pLine, xwdev->mdev.line_ptrs[i] + loffset, lwidth);
+ } else { /* break up transfer to avoid crossing segment boundary */
+ _fmemcpy(pLine, xwdev->mdev.line_ptrs[i] + loffset, lseg);
+ _fmemcpy(pLine + lseg, xwdev->mdev.line_ptrs[i] + loffset + lseg, lwidth - lseg);
+ }
#else
- memcpy(pLine, xwdev->mdev.line_ptrs[i], lwidth);
+ memcpy(pLine, xwdev->mdev.line_ptrs[i], lwidth);
#endif
- pLine += lwidth;
+ pLine += lwidth;
}
GlobalUnlock(hglobal);
return hglobal;
}
-
/* Allocate the backing bitmap. */
static int
win_dib_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
@@ -549,21 +546,21 @@ win_dib_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
#ifdef __WIN32__
if (is_win32s) {
#endif
- /* Round up the width so that the scan line size is a power of 2. */
- if (dev->color_info.depth == 24) {
- width = param_dev->width * 3 - 1;
- while (width & (width + 1))
- width |= width >> 1;
- width = (width + 1) / 3;
- } else {
- width = param_dev->width - 1;
- while (width & (width + 1))
- width |= width >> 1;
- width++;
- }
+ /* Round up the width so that the scan line size is a power of 2. */
+ if (dev->color_info.depth == 24) {
+ width = param_dev->width * 3 - 1;
+ while (width & (width + 1))
+ width |= width >> 1;
+ width = (width + 1) / 3;
+ } else {
+ width = param_dev->width - 1;
+ while (width & (width + 1))
+ width |= width >> 1;
+ width++;
+ }
#ifdef __WIN32__
} else { /* don't have to worry about segments so use less memory */
- width = param_dev->width;
+ width = param_dev->width;
}
#endif
@@ -578,7 +575,7 @@ win_dib_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
ptr_size = sizeof(byte **) * mdev.height;
hmdata = GlobalAlloc(0, raster + data_size + ptr_size * 2);
if (hmdata == 0) {
- return win_nomemory();
+ return win_nomemory();
}
/* Nothing can go wrong now.... */
@@ -590,25 +587,24 @@ win_dib_alloc_bitmap(gx_device_win * dev, gx_device * param_dev)
base += (-PTR_OFF(base) & (raster - 1));
ptr_base = base + data_size;
if (PTR_OFF(ptr_base + ptr_size) < ptr_size)
- base += (uint) - PTR_OFF(ptr_base);
+ base += (uint) - PTR_OFF(ptr_base);
wdev->y_block = 0x10000L / raster;
wdev->y_mask = wdev->y_block - 1;
if ((wdev->y_base = PTR_OFF(base)) != 0)
- wdev->y_base = -(PTR_OFF(base) / raster);
+ wdev->y_base = -(PTR_OFF(base) / raster);
#endif
wdev->mdev = mdev;
wdev->mdev.base = (byte *) base;
wmproc(open_device) ((gx_device *) & wdev->mdev);
if (wdev->is_open && pgsdll_callback)
- (*pgsdll_callback) (GSDLL_SIZE, (unsigned char *)dev,
- (dev->width & 0xffff) +
- ((ulong) (dev->height & 0xffff) << 16));
+ (*pgsdll_callback) (GSDLL_SIZE, (unsigned char *)dev,
+ (dev->width & 0xffff) +
+ ((ulong) (dev->height & 0xffff) << 16));
return 0;
}
-
/* Free the backing bitmap. */
static void
win_dib_free_bitmap(gx_device_win * dev)
@@ -629,21 +625,21 @@ win_dib_lock_device(unsigned char *device, int flag)
#ifdef __WIN32__
if (!is_win32s) {
- if (flag) {
- if (WaitForSingleObject(wdev->hmtx, 60000) == WAIT_TIMEOUT)
- return 2;
- return 1;
- }
- ReleaseMutex(wdev->hmtx);
- return 0;
+ if (flag) {
+ if (WaitForSingleObject(wdev->hmtx, 60000) == WAIT_TIMEOUT)
+ return 2;
+ return 1;
+ }
+ ReleaseMutex(wdev->hmtx);
+ return 0;
}
#endif
if (flag)
- wdev->lock_count++;
+ wdev->lock_count++;
else
- wdev->lock_count--;
+ wdev->lock_count--;
if (wdev->lock_count < 0)
- wdev->lock_count = 0;
+ wdev->lock_count = 0;
return wdev->lock_count;
}
@@ -653,7 +649,6 @@ gsdll_lock_device(unsigned char *device, int flag)
return win_dib_lock_device(device, flag);
}
-
/* Copy bitmap
* If pbmih nonzero, copy the BITMAPINFOHEADER.
* If prgbquad nonzero, copy the palette.
@@ -673,7 +668,7 @@ gsdll_lock_device(unsigned char *device, int flag)
*/
int GSDLLAPI _export
gsdll_get_bitmap_row(unsigned char *device, LPBITMAPINFOHEADER pbmih,
- LPRGBQUAD prgbquad, LPBYTE * ppbyte, unsigned int row)
+ LPRGBQUAD prgbquad, LPBYTE * ppbyte, unsigned int row)
{
int palcount;
gx_device_win_dib *dev = (gx_device_win_dib *) device;
@@ -681,57 +676,57 @@ gsdll_get_bitmap_row(unsigned char *device, LPBITMAPINFOHEADER pbmih,
palcount = (dev->color_info.depth == 24) ? 0 : dev->nColors;
if (pbmih) {
- pbmih->biSize = sizeof(BITMAPINFOHEADER);
- pbmih->biWidth = dev->width;
- pbmih->biHeight = dev->mdev.height;
- pbmih->biPlanes = 1;
- pbmih->biBitCount = dev->color_info.depth;
- if ((dev->BitsPerPixel == 15) || (dev->BitsPerPixel == 16))
+ pbmih->biSize = sizeof(BITMAPINFOHEADER);
+ pbmih->biWidth = dev->width;
+ pbmih->biHeight = dev->mdev.height;
+ pbmih->biPlanes = 1;
+ pbmih->biBitCount = dev->color_info.depth;
+ if ((dev->BitsPerPixel == 15) || (dev->BitsPerPixel == 16))
pbmih->biCompression = BI_BITFIELDS;
- else
- pbmih->biCompression = 0;
- pbmih->biSizeImage = 0; /* default */
- pbmih->biXPelsPerMeter = (DWORD) (dev->x_pixels_per_inch / 25.4 * 1000);
- pbmih->biYPelsPerMeter = (DWORD) (dev->y_pixels_per_inch / 25.4 * 1000);
- pbmih->biClrUsed = palcount;
- pbmih->biClrImportant = palcount;
+ else
+ pbmih->biCompression = 0;
+ pbmih->biSizeImage = 0; /* default */
+ pbmih->biXPelsPerMeter = (DWORD) (dev->x_pixels_per_inch / 25.4 * 1000);
+ pbmih->biYPelsPerMeter = (DWORD) (dev->y_pixels_per_inch / 25.4 * 1000);
+ pbmih->biClrUsed = palcount;
+ pbmih->biClrImportant = palcount;
}
if (prgbquad) {
- int i;
- gx_color_value prgb[3];
-
- if (dev->BitsPerPixel == 15) { /* 5-5-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(prgbquad);
- pbmih->biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0x7c00;
- bmi_colors[1] = 0x03e0;
- bmi_colors[2] = 0x001f;
- }
- else if (dev->BitsPerPixel == 16) { /* 5-6-5 RGB mode */
- DWORD* bmi_colors = (DWORD*)(prgbquad);
- pbmih->biCompression = BI_BITFIELDS;
- bmi_colors[0] = 0xf800;
- bmi_colors[1] = 0x07e0;
- bmi_colors[2] = 0x001f;
- }
- else {
- for (i = 0; i < palcount; i++) {
- win_map_color_rgb((gx_device *) wdev, (gx_color_index) i, prgb);
- prgbquad[i].rgbRed = win_color_value(prgb[0]);
- prgbquad[i].rgbGreen = win_color_value(prgb[1]);
- prgbquad[i].rgbBlue = win_color_value(prgb[2]);
- prgbquad[i].rgbReserved = 0;
- }
- }
+ int i;
+ gx_color_value prgb[3];
+
+ if (dev->BitsPerPixel == 15) { /* 5-5-5 RGB mode */
+ DWORD* bmi_colors = (DWORD*)(prgbquad);
+ pbmih->biCompression = BI_BITFIELDS;
+ bmi_colors[0] = 0x7c00;
+ bmi_colors[1] = 0x03e0;
+ bmi_colors[2] = 0x001f;
+ }
+ else if (dev->BitsPerPixel == 16) { /* 5-6-5 RGB mode */
+ DWORD* bmi_colors = (DWORD*)(prgbquad);
+ pbmih->biCompression = BI_BITFIELDS;
+ bmi_colors[0] = 0xf800;
+ bmi_colors[1] = 0x07e0;
+ bmi_colors[2] = 0x001f;
+ }
+ else {
+ for (i = 0; i < palcount; i++) {
+ win_map_color_rgb((gx_device *) wdev, (gx_color_index) i, prgb);
+ prgbquad[i].rgbRed = win_color_value(prgb[0]);
+ prgbquad[i].rgbGreen = win_color_value(prgb[1]);
+ prgbquad[i].rgbBlue = win_color_value(prgb[2]);
+ prgbquad[i].rgbReserved = 0;
+ }
+ }
}
if (ppbyte) {
- if (row < dev->mdev.height)
- *ppbyte = dev->mdev.line_ptrs[row];
- else
- *ppbyte = NULL;
+ if (row < dev->mdev.height)
+ *ppbyte = dev->mdev.line_ptrs[row];
+ else
+ *ppbyte = NULL;
}
if ((pbmih == NULL) && (prgbquad == NULL) && (ppbyte == NULL))
- return sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)
- + gdev_mem_raster(&(dev->mdev));
+ return sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)
+ + gdev_mem_raster(&(dev->mdev));
return 0;
}
diff --git a/gs/base/gdevwpr2.c b/gs/base/gdevwpr2.c
index 6f33c272a..82dc0637e 100644
--- a/gs/base/gdevwpr2.c
+++ b/gs/base/gdevwpr2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -128,7 +128,6 @@
#include "gpcheck.h"
#include "commdlg.h"
-
/* Make sure we cast to the correct structure type. */
typedef struct gx_device_win_pr2_s gx_device_win_pr2;
@@ -150,14 +149,13 @@ static void win_pr2_set_bpp(gx_device * dev, int depth);
static const gx_device_procs win_pr2_procs =
prn_color_params_procs(win_pr2_open, gdev_prn_output_page, win_pr2_close,
- win_pr2_map_rgb_color, win_pr2_map_color_rgb,
- win_pr2_get_params, win_pr2_put_params);
+ win_pr2_map_rgb_color, win_pr2_map_color_rgb,
+ win_pr2_get_params, win_pr2_put_params);
#define PARENT_WINDOW HWND_DESKTOP
BOOL CALLBACK CancelDlgProc(HWND, UINT, WPARAM, LPARAM);
BOOL CALLBACK AbortProc2(HDC, int);
-
/* The device descriptor */
typedef struct gx_device_win_pr2_s gx_device_win_pr2;
struct gx_device_win_pr2_s {
@@ -199,9 +197,9 @@ struct gx_device_win_pr2_s {
gx_device_win_pr2 far_data gs_mswinpr2_device =
{
prn_device_std_body(gx_device_win_pr2, win_pr2_procs, "mswinpr2",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72.0, 72.0,
- 0, 0, 0, 0,
- 0, win_pr2_print_page), /* depth = 0 */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, 72.0, 72.0,
+ 0, 0, 0, 0,
+ 0, win_pr2_print_page), /* depth = 0 */
0, /* hdcprn */
0, /* nocancel */
0, /* doc_page_begin */
@@ -256,72 +254,72 @@ win_pr2_open(gx_device * dev)
FILE *pfile;
DOCINFO docinfo;
float ratio = 1.0;
-
+
win_pr2_copy_check(wdev);
/* get a HDC for the printer */
if ((wdev->win32_hdevmode) &&
- (wdev->win32_hdevnames)) {
- /* The user has already had the opportunity to choose the output */
- /* file interactively. Just use the specified parameters. */
-
- LPDEVMODE devmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
- LPDEVNAMES devnames = (LPDEVNAMES) GlobalLock(wdev->win32_hdevnames);
-
- const char* driver = (char*)(devnames)+(devnames->wDriverOffset);
- const char* device = (char*)(devnames)+(devnames->wDeviceOffset);
- const char* output = (char*)(devnames)+(devnames->wOutputOffset);
-
- wdev->hdcprn = CreateDC(driver, device, output, devmode);
-
- GlobalUnlock(wdev->win32_hdevmode);
- GlobalUnlock(wdev->win32_hdevnames);
-
- if (wdev->hdcprn == NULL) {
- return gs_error_Fatal;
- }
-
+ (wdev->win32_hdevnames)) {
+ /* The user has already had the opportunity to choose the output */
+ /* file interactively. Just use the specified parameters. */
+
+ LPDEVMODE devmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
+ LPDEVNAMES devnames = (LPDEVNAMES) GlobalLock(wdev->win32_hdevnames);
+
+ const char* driver = (char*)(devnames)+(devnames->wDriverOffset);
+ const char* device = (char*)(devnames)+(devnames->wDeviceOffset);
+ const char* output = (char*)(devnames)+(devnames->wOutputOffset);
+
+ wdev->hdcprn = CreateDC(driver, device, output, devmode);
+
+ GlobalUnlock(wdev->win32_hdevmode);
+ GlobalUnlock(wdev->win32_hdevnames);
+
+ if (wdev->hdcprn == NULL) {
+ return gs_error_Fatal;
+ }
+
} else if (!win_pr2_getdc(wdev)) {
- /* couldn't get a printer from -sOutputFile= */
- /* Prompt with dialog box */
-
- LPDEVMODE devmode = NULL;
- memset(&pd, 0, sizeof(pd));
-
- pd.lStructSize = sizeof(pd);
- pd.hwndOwner = PARENT_WINDOW;
- pd.Flags = PD_RETURNDC;
- pd.nMinPage = wdev->doc_page_begin;
- pd.nMaxPage = wdev->doc_page_end;
- pd.nFromPage = wdev->user_page_begin;
- pd.nToPage = wdev->user_page_end;
- pd.nCopies = wdev->user_copies;
-
- if (!PrintDlg(&pd)) {
- /* device not opened - exit ghostscript */
- return gs_error_Fatal; /* exit Ghostscript cleanly */
- }
-
- devmode = GlobalLock(pd.hDevMode);
- win_pr2_update_dev(wdev,devmode);
- GlobalUnlock(pd.hDevMode);
-
- if (wdev->win32_hdevmode)
- GlobalFree(wdev->win32_hdevmode);
- if (wdev->win32_hdevnames)
- GlobalFree(wdev->win32_hdevnames);
-
- wdev->hdcprn = pd.hDC;
- wdev->win32_hdevmode = pd.hDevMode;
- wdev->win32_hdevnames = pd.hDevNames;
-
- pd.hDevMode = NULL;
- pd.hDevNames = NULL;
+ /* couldn't get a printer from -sOutputFile= */
+ /* Prompt with dialog box */
+
+ LPDEVMODE devmode = NULL;
+ memset(&pd, 0, sizeof(pd));
+
+ pd.lStructSize = sizeof(pd);
+ pd.hwndOwner = PARENT_WINDOW;
+ pd.Flags = PD_RETURNDC;
+ pd.nMinPage = wdev->doc_page_begin;
+ pd.nMaxPage = wdev->doc_page_end;
+ pd.nFromPage = wdev->user_page_begin;
+ pd.nToPage = wdev->user_page_end;
+ pd.nCopies = wdev->user_copies;
+
+ if (!PrintDlg(&pd)) {
+ /* device not opened - exit ghostscript */
+ return gs_error_Fatal; /* exit Ghostscript cleanly */
+ }
+
+ devmode = GlobalLock(pd.hDevMode);
+ win_pr2_update_dev(wdev,devmode);
+ GlobalUnlock(pd.hDevMode);
+
+ if (wdev->win32_hdevmode)
+ GlobalFree(wdev->win32_hdevmode);
+ if (wdev->win32_hdevnames)
+ GlobalFree(wdev->win32_hdevnames);
+
+ wdev->hdcprn = pd.hDC;
+ wdev->win32_hdevmode = pd.hDevMode;
+ wdev->win32_hdevnames = pd.hDevNames;
+
+ pd.hDevMode = NULL;
+ pd.hDevNames = NULL;
}
if (!(GetDeviceCaps(wdev->hdcprn, RASTERCAPS) != RC_DIBTODEV)) {
- errprintf(dev->memory, "Windows printer does not have RC_DIBTODEV\n");
- DeleteDC(wdev->hdcprn);
- return gs_error_limitcheck;
+ errprintf(dev->memory, "Windows printer does not have RC_DIBTODEV\n");
+ DeleteDC(wdev->hdcprn);
+ return gs_error_limitcheck;
}
/* initialise printer, install abort proc */
wdev->lpfnAbortProc = (DLGPROC) AbortProc2;
@@ -340,54 +338,54 @@ win_pr2_open(gx_device * dev)
/*docinfo.fwType = 0;*/
if (docinfo.lpszDocName[0] == 0) {
- docinfo.lpszDocName = "Ghostscript output";
+ docinfo.lpszDocName = "Ghostscript output";
}
if (StartDoc(wdev->hdcprn, &docinfo) <= 0) {
- errprintf(dev->memory,
+ errprintf(dev->memory,
"Printer StartDoc failed (error %08x)\n", GetLastError());
- DeleteDC(wdev->hdcprn);
- return gs_error_limitcheck;
+ DeleteDC(wdev->hdcprn);
+ return gs_error_limitcheck;
}
-
+
dev->x_pixels_per_inch = (float)GetDeviceCaps(wdev->hdcprn, LOGPIXELSX);
dev->y_pixels_per_inch = (float)GetDeviceCaps(wdev->hdcprn, LOGPIXELSY);
-
+
wdev->ratio = 1;
-
+
if (wdev->max_dpi > 50) {
-
- float dpi_x = dev->x_pixels_per_inch;
- float dpi_y = dev->y_pixels_per_inch;
-
- while ((dev->x_pixels_per_inch > wdev->max_dpi)
- || (dev->y_pixels_per_inch > wdev->max_dpi)) {
- ratio += 1.0;
- wdev->ratio ++;
- dev->x_pixels_per_inch = dpi_x / ratio;
- dev->y_pixels_per_inch = dpi_y / ratio;
- }
+
+ float dpi_x = dev->x_pixels_per_inch;
+ float dpi_y = dev->y_pixels_per_inch;
+
+ while ((dev->x_pixels_per_inch > wdev->max_dpi)
+ || (dev->y_pixels_per_inch > wdev->max_dpi)) {
+ ratio += 1.0;
+ wdev->ratio ++;
+ dev->x_pixels_per_inch = dpi_x / ratio;
+ dev->y_pixels_per_inch = dpi_y / ratio;
+ }
}
-
+
size.x = GetDeviceCaps(wdev->hdcprn, PHYSICALWIDTH);
size.y = GetDeviceCaps(wdev->hdcprn, PHYSICALHEIGHT);
gx_device_set_width_height(dev, (int)(size.x / ratio), (int)(size.y / ratio));
offset.x = GetDeviceCaps(wdev->hdcprn, PHYSICALOFFSETX);
offset.y = GetDeviceCaps(wdev->hdcprn, PHYSICALOFFSETY);
-
+
/* m[] gives margins in inches */
m[0] /*left */ = offset.x / dev->x_pixels_per_inch / ratio;
m[3] /*top */ = offset.y / dev->y_pixels_per_inch / ratio;
m[2] /*right */ = (size.x - offset.x - GetDeviceCaps(wdev->hdcprn, HORZRES)) / dev->x_pixels_per_inch / ratio;
m[1] /*bottom */ = (size.y - offset.y - GetDeviceCaps(wdev->hdcprn, VERTRES)) / dev->y_pixels_per_inch / ratio;
gx_device_set_margins(dev, m, true);
-
+
depth = dev->color_info.depth;
if (depth == 0) {
- /* Set parameters that were unknown before opening device */
- /* Find out if the device supports color */
- /* We recognize 1, 4 (but use only 3), 8 and 24 bit color devices */
- depth = GetDeviceCaps(wdev->hdcprn, PLANES) * GetDeviceCaps(wdev->hdcprn, BITSPIXEL);
+ /* Set parameters that were unknown before opening device */
+ /* Find out if the device supports color */
+ /* We recognize 1, 4 (but use only 3), 8 and 24 bit color devices */
+ depth = GetDeviceCaps(wdev->hdcprn, PLANES) * GetDeviceCaps(wdev->hdcprn, BITSPIXEL);
}
win_pr2_set_bpp(dev, depth);
@@ -396,18 +394,18 @@ win_pr2_open(gx_device * dev)
wdev->fname[0] = '\0';
pfile = gp_open_scratch_file(dev->memory,
gp_scratch_file_name_prefix,
- wdev->fname, "wb");
+ wdev->fname, "wb");
fclose(pfile);
code = gdev_prn_open(dev);
if ((code < 0) && wdev->fname[0])
unlink(wdev->fname);
if (!wdev->nocancel) {
- /* inform user of progress with dialog box and allow cancel */
- wdev->lpfnCancelProc = (DLGPROC) CancelDlgProc;
- wdev->hDlgModeless = CreateDialog(phInstance, "CancelDlgBox",
- PARENT_WINDOW, wdev->lpfnCancelProc);
- ShowWindow(wdev->hDlgModeless, SW_HIDE);
+ /* inform user of progress with dialog box and allow cancel */
+ wdev->lpfnCancelProc = (DLGPROC) CancelDlgProc;
+ wdev->hDlgModeless = CreateDialog(phInstance, "CancelDlgBox",
+ PARENT_WINDOW, wdev->lpfnCancelProc);
+ ShowWindow(wdev->hDlgModeless, SW_HIDE);
}
return code;
};
@@ -424,38 +422,37 @@ win_pr2_close(gx_device * dev)
/* Free resources */
if (!wdev->nocancel) {
- if (!wdev->hDlgModeless)
- aborted = TRUE;
- else
- DestroyWindow(wdev->hDlgModeless);
- wdev->hDlgModeless = 0;
+ if (!wdev->hDlgModeless)
+ aborted = TRUE;
+ else
+ DestroyWindow(wdev->hDlgModeless);
+ wdev->hDlgModeless = 0;
}
if (aborted)
- AbortDoc(wdev->hdcprn);
+ AbortDoc(wdev->hdcprn);
else
- EndDoc(wdev->hdcprn);
+ EndDoc(wdev->hdcprn);
DeleteDC(wdev->hdcprn);
if (wdev->win32_hdevmode != NULL) {
- GlobalFree(wdev->win32_hdevmode);
- wdev->win32_hdevmode = NULL;
+ GlobalFree(wdev->win32_hdevmode);
+ wdev->win32_hdevmode = NULL;
}
if (wdev->win32_hdevnames != NULL) {
- GlobalFree(wdev->win32_hdevnames);
- wdev->win32_hdevnames = NULL;
+ GlobalFree(wdev->win32_hdevnames);
+ wdev->win32_hdevnames = NULL;
}
code = gdev_prn_close(dev);
/* delete unwanted temporary file */
if (wdev->fname[0])
- unlink(wdev->fname);
+ unlink(wdev->fname);
return code;
}
-
/* ------ Internal routines ------ */
#undef wdev
@@ -465,7 +462,6 @@ win_pr2_close(gx_device * dev)
/* ------ Private definitions ------ */
-
/* new win_pr2_print_page routine */
/* Write BMP header to memory, then send bitmap to printer */
@@ -490,20 +486,20 @@ win_pr2_print_page(gx_device_printer * pdev, FILE * file)
int ratio = ((gx_device_win_pr2 *)pdev)->ratio;
struct bmi_s {
- BITMAPINFOHEADER h;
- RGBQUAD pal[256];
+ BITMAPINFOHEADER h;
+ RGBQUAD pal[256];
} bmi;
scan_lines = dev_print_scan_lines(pdev);
width = (int)(pdev->width - ((dev_l_margin(pdev) + dev_r_margin(pdev) -
- dev_x_offset(pdev)) * pdev->x_pixels_per_inch));
+ dev_x_offset(pdev)) * pdev->x_pixels_per_inch));
yslice = 65535 / bmp_raster; /* max lines in 64k */
bmp_raster_multi = bmp_raster * yslice;
hrow = GlobalAlloc(0, bmp_raster_multi);
row = GlobalLock(hrow);
if (row == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Write the info header. */
@@ -518,86 +514,86 @@ win_pr2_print_page(gx_device_printer * pdev, FILE * file)
bmi.h.biYPelsPerMeter = 0; /* default */
StartPage(wdev->hdcprn);
-
+
/* Write the palette. */
if (depth <= 8) {
- int i;
- gx_color_value rgb[3];
- LPRGBQUAD pq;
-
- bmi.h.biClrUsed = 1 << depth;
- bmi.h.biClrImportant = 1 << depth;
- for (i = 0; i != 1 << depth; i++) {
- (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
- (gx_color_index) i, rgb);
- pq = &bmi.pal[i];
- pq->rgbRed = gx_color_value_to_byte(rgb[0]);
- pq->rgbGreen = gx_color_value_to_byte(rgb[1]);
- pq->rgbBlue = gx_color_value_to_byte(rgb[2]);
- pq->rgbReserved = 0;
- }
+ int i;
+ gx_color_value rgb[3];
+ LPRGBQUAD pq;
+
+ bmi.h.biClrUsed = 1 << depth;
+ bmi.h.biClrImportant = 1 << depth;
+ for (i = 0; i != 1 << depth; i++) {
+ (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
+ (gx_color_index) i, rgb);
+ pq = &bmi.pal[i];
+ pq->rgbRed = gx_color_value_to_byte(rgb[0]);
+ pq->rgbGreen = gx_color_value_to_byte(rgb[1]);
+ pq->rgbBlue = gx_color_value_to_byte(rgb[2]);
+ pq->rgbReserved = 0;
+ }
} else {
- bmi.h.biClrUsed = 0;
- bmi.h.biClrImportant = 0;
+ bmi.h.biClrUsed = 0;
+ bmi.h.biClrImportant = 0;
}
if (!wdev->nocancel) {
- sprintf(dlgtext, "Printing page %d", (int)(pdev->PageCount) + 1);
- SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PRINTING), dlgtext);
- ShowWindow(wdev->hDlgModeless, SW_SHOW);
+ sprintf(dlgtext, "Printing page %d", (int)(pdev->PageCount) + 1);
+ SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PRINTING), dlgtext);
+ ShowWindow(wdev->hDlgModeless, SW_SHOW);
}
for (y = 0; y < scan_lines;) {
- /* copy slice to row buffer */
- if (y > scan_lines - yslice)
- lines = scan_lines - y;
- else
- lines = yslice;
- for (i = 0; i < lines; i++)
- gdev_prn_copy_scan_lines(pdev, y + i,
- row + (bmp_raster * (lines - 1 - i)), raster);
-
- if (ratio > 1) {
- StretchDIBits(wdev->hdcprn, 0, y*ratio, pdev->width*ratio, lines*ratio,
- 0, 0, pdev->width, lines,
- row,
- (BITMAPINFO FAR *) & bmi, DIB_RGB_COLORS, SRCCOPY);
- } else {
- SetDIBitsToDevice(wdev->hdcprn, 0, y, pdev->width, lines,
- 0, 0, 0, lines,
- row,
- (BITMAPINFO FAR *) & bmi, DIB_RGB_COLORS);
- }
- y += lines;
-
- if (!wdev->nocancel) {
- /* inform user of progress */
- sprintf(dlgtext, "%d%% done", (int)(y * 100L / scan_lines));
- SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PCDONE), dlgtext);
- }
- /* process message loop */
- while (PeekMessage(&msg, wdev->hDlgModeless, 0, 0, PM_REMOVE)) {
- if ((wdev->hDlgModeless == 0) || !IsDialogMessage(wdev->hDlgModeless, &msg)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- if ((!wdev->nocancel) && (wdev->hDlgModeless == 0)) {
- /* user pressed cancel button */
- break;
- }
+ /* copy slice to row buffer */
+ if (y > scan_lines - yslice)
+ lines = scan_lines - y;
+ else
+ lines = yslice;
+ for (i = 0; i < lines; i++)
+ gdev_prn_copy_scan_lines(pdev, y + i,
+ row + (bmp_raster * (lines - 1 - i)), raster);
+
+ if (ratio > 1) {
+ StretchDIBits(wdev->hdcprn, 0, y*ratio, pdev->width*ratio, lines*ratio,
+ 0, 0, pdev->width, lines,
+ row,
+ (BITMAPINFO FAR *) & bmi, DIB_RGB_COLORS, SRCCOPY);
+ } else {
+ SetDIBitsToDevice(wdev->hdcprn, 0, y, pdev->width, lines,
+ 0, 0, 0, lines,
+ row,
+ (BITMAPINFO FAR *) & bmi, DIB_RGB_COLORS);
+ }
+ y += lines;
+
+ if (!wdev->nocancel) {
+ /* inform user of progress */
+ sprintf(dlgtext, "%d%% done", (int)(y * 100L / scan_lines));
+ SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PCDONE), dlgtext);
+ }
+ /* process message loop */
+ while (PeekMessage(&msg, wdev->hDlgModeless, 0, 0, PM_REMOVE)) {
+ if ((wdev->hDlgModeless == 0) || !IsDialogMessage(wdev->hDlgModeless, &msg)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ if ((!wdev->nocancel) && (wdev->hDlgModeless == 0)) {
+ /* user pressed cancel button */
+ break;
+ }
}
if ((!wdev->nocancel) && (wdev->hDlgModeless == 0))
- code = gs_error_Fatal; /* exit Ghostscript cleanly */
+ code = gs_error_Fatal; /* exit Ghostscript cleanly */
else {
- /* push out the page */
- if (!wdev->nocancel)
- SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PCDONE),
- "Ejecting page...");
- EndPage(wdev->hdcprn);
- if (!wdev->nocancel)
- ShowWindow(wdev->hDlgModeless, SW_HIDE);
+ /* push out the page */
+ if (!wdev->nocancel)
+ SetWindowText(GetDlgItem(wdev->hDlgModeless, CANCEL_PCDONE),
+ "Ejecting page...");
+ EndPage(wdev->hdcprn);
+ if (!wdev->nocancel)
+ ShowWindow(wdev->hDlgModeless, SW_HIDE);
}
GlobalUnlock(hrow);
@@ -619,19 +615,19 @@ win_pr2_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value g = cv[1];
gx_color_value b = cv[2];
switch (dev->color_info.depth) {
- case 1:
- return gdev_prn_map_rgb_color(dev, cv);
- case 4:
- /* use only 8 colors */
- return (r > (gx_max_color_value / 2 + 1) ? 4 : 0) +
- (g > (gx_max_color_value / 2 + 1) ? 2 : 0) +
- (b > (gx_max_color_value / 2 + 1) ? 1 : 0);
- case 8:
- return pc_8bit_map_rgb_color(dev, cv);
- case 24:
- return gx_color_value_to_byte(r) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- ((ulong) gx_color_value_to_byte(b) << 16);
+ case 1:
+ return gdev_prn_map_rgb_color(dev, cv);
+ case 4:
+ /* use only 8 colors */
+ return (r > (gx_max_color_value / 2 + 1) ? 4 : 0) +
+ (g > (gx_max_color_value / 2 + 1) ? 2 : 0) +
+ (b > (gx_max_color_value / 2 + 1) ? 1 : 0);
+ case 8:
+ return pc_8bit_map_rgb_color(dev, cv);
+ case 24:
+ return gx_color_value_to_byte(r) +
+ ((uint) gx_color_value_to_byte(g) << 8) +
+ ((ulong) gx_color_value_to_byte(b) << 16);
}
return 0; /* error */
}
@@ -639,26 +635,26 @@ win_pr2_map_rgb_color(gx_device * dev, const gx_color_value cv[])
/* Map a color index to a r-g-b color. */
static int
win_pr2_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
switch (dev->color_info.depth) {
- case 1:
- gdev_prn_map_color_rgb(dev, color, prgb);
- break;
- case 4:
- /* use only 8 colors */
- prgb[0] = (color & 4) ? gx_max_color_value : 0;
- prgb[1] = (color & 2) ? gx_max_color_value : 0;
- prgb[2] = (color & 1) ? gx_max_color_value : 0;
- break;
- case 8:
- pc_8bit_map_color_rgb(dev, color, prgb);
- break;
- case 24:
- prgb[2] = gx_color_value_from_byte(color >> 16);
- prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[0] = gx_color_value_from_byte(color & 0xff);
- break;
+ case 1:
+ gdev_prn_map_color_rgb(dev, color, prgb);
+ break;
+ case 4:
+ /* use only 8 colors */
+ prgb[0] = (color & 4) ? gx_max_color_value : 0;
+ prgb[1] = (color & 2) ? gx_max_color_value : 0;
+ prgb[2] = (color & 1) ? gx_max_color_value : 0;
+ break;
+ case 8:
+ pc_8bit_map_color_rgb(dev, color, prgb);
+ break;
+ case 24:
+ prgb[2] = gx_color_value_from_byte(color >> 16);
+ prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[0] = gx_color_value_from_byte(color & 0xff);
+ break;
}
return 0;
}
@@ -667,48 +663,48 @@ void
win_pr2_set_bpp(gx_device * dev, int depth)
{
if (depth > 8) {
- static const gx_device_color_info win_pr2_24color = dci_std_color(24);
+ static const gx_device_color_info win_pr2_24color = dci_std_color(24);
- dev->color_info = win_pr2_24color;
- depth = 24;
+ dev->color_info = win_pr2_24color;
+ depth = 24;
} else if (depth >= 8) {
- /* 8-bit (SuperVGA-style) color. */
- /* (Uses a fixed palette of 3,3,2 bits.) */
- static const gx_device_color_info win_pr2_8color = dci_pc_8bit;
+ /* 8-bit (SuperVGA-style) color. */
+ /* (Uses a fixed palette of 3,3,2 bits.) */
+ static const gx_device_color_info win_pr2_8color = dci_pc_8bit;
- dev->color_info = win_pr2_8color;
- depth = 8;
+ dev->color_info = win_pr2_8color;
+ depth = 8;
} else if (depth >= 3) {
- /* 3 plane printer */
- /* suitable for impact dot matrix CMYK printers */
- /* create 4-bit bitmap, but only use 8 colors */
- static const gx_device_color_info win_pr2_4color = dci_values(3, 4, 1, 1, 2, 2);
+ /* 3 plane printer */
+ /* suitable for impact dot matrix CMYK printers */
+ /* create 4-bit bitmap, but only use 8 colors */
+ static const gx_device_color_info win_pr2_4color = dci_values(3, 4, 1, 1, 2, 2);
- dev->color_info = win_pr2_4color;
- depth = 4;
+ dev->color_info = win_pr2_4color;
+ depth = 4;
} else { /* default is black_and_white */
- static const gx_device_color_info win_pr2_1color = dci_std_color(1);
+ static const gx_device_color_info win_pr2_1color = dci_std_color(1);
- dev->color_info = win_pr2_1color;
- depth = 1;
+ dev->color_info = win_pr2_1color;
+ depth = 1;
}
-
+
((gx_device_win_pr2 *)dev)->selected_bpp = depth;
/* copy encode/decode procedures */
dev->procs.encode_color = dev->procs.map_rgb_color;
dev->procs.decode_color = dev->procs.map_color_rgb;
if (depth == 1) {
- dev->procs.get_color_mapping_procs =
- gx_default_DevGray_get_color_mapping_procs;
- dev->procs.get_color_comp_index =
- gx_default_DevGray_get_color_comp_index;
+ dev->procs.get_color_mapping_procs =
+ gx_default_DevGray_get_color_mapping_procs;
+ dev->procs.get_color_comp_index =
+ gx_default_DevGray_get_color_comp_index;
}
else {
- dev->procs.get_color_mapping_procs =
- gx_default_DevRGB_get_color_mapping_procs;
- dev->procs.get_color_comp_index =
- gx_default_DevRGB_get_color_comp_index;
+ dev->procs.get_color_mapping_procs =
+ gx_default_DevRGB_get_color_mapping_procs;
+ dev->procs.get_color_comp_index =
+ gx_default_DevRGB_get_color_comp_index;
}
}
@@ -723,22 +719,21 @@ win_pr2_get_params(gx_device * pdev, gs_param_list * plist)
win_pr2_copy_check(wdev);
if (code >= 0)
- code = param_write_bool(plist, "NoCancel",
- &(wdev->nocancel));
+ code = param_write_bool(plist, "NoCancel",
+ &(wdev->nocancel));
if (code >= 0)
- code = param_write_int(plist, "QueryUser",
- &(wdev->query_user));
+ code = param_write_int(plist, "QueryUser",
+ &(wdev->query_user));
if (code >= 0)
- code = win_pr2_write_user_settings(wdev, plist);
-
+ code = win_pr2_write_user_settings(wdev, plist);
+
if ((code >= 0) && (wdev->Duplex_set > 0))
- code = param_write_bool(plist, "Tumble",
- &(wdev->tumble));
+ code = param_write_bool(plist, "Tumble",
+ &(wdev->tumble));
return code;
}
-
/* We implement this ourselves so that we can change BitsPerPixel */
/* before the device is opened */
int
@@ -758,99 +753,99 @@ win_pr2_put_params(gx_device * pdev, gs_param_list * plist)
int old_mx_dpi = wdev->max_dpi;
if (wdev->Duplex_set < 0) {
- wdev->Duplex_set = 0;
- wdev->Duplex = false;
- wdev->tumble = false;
+ wdev->Duplex_set = 0;
+ wdev->Duplex = false;
+ wdev->tumble = false;
}
-
+
win_pr2_copy_check(wdev);
code = win_pr2_read_user_settings(wdev, plist);
switch (code = param_read_int(plist, "BitsPerPixel", &bpp)) {
- case 0:
- if (pdev->is_open) {
- if (wdev->selected_bpp == bpp) {
- break;
- }
- ecode = gs_error_rangecheck;
- } else { /* change dev->color_info is valid before device is opened */
- win_pr2_set_bpp(pdev, bpp);
- break;
- }
- goto bppe;
- default:
- ecode = code;
- bppe:param_signal_error(plist, "BitsPerPixel", ecode);
- case 1:
- break;
+ case 0:
+ if (pdev->is_open) {
+ if (wdev->selected_bpp == bpp) {
+ break;
+ }
+ ecode = gs_error_rangecheck;
+ } else { /* change dev->color_info is valid before device is opened */
+ win_pr2_set_bpp(pdev, bpp);
+ break;
+ }
+ goto bppe;
+ default:
+ ecode = code;
+ bppe:param_signal_error(plist, "BitsPerPixel", ecode);
+ case 1:
+ break;
}
switch (code = param_read_bool(plist, "NoCancel", &nocancel)) {
- case 0:
- if (pdev->is_open) {
- if (wdev->nocancel == nocancel) {
- break;
- }
- ecode = gs_error_rangecheck;
- } else {
- wdev->nocancel = nocancel;
- break;
- }
- goto nocancele;
- default:
- ecode = code;
- nocancele:param_signal_error(plist, "NoCancel", ecode);
- case 1:
- break;
+ case 0:
+ if (pdev->is_open) {
+ if (wdev->nocancel == nocancel) {
+ break;
+ }
+ ecode = gs_error_rangecheck;
+ } else {
+ wdev->nocancel = nocancel;
+ break;
+ }
+ goto nocancele;
+ default:
+ ecode = code;
+ nocancele:param_signal_error(plist, "NoCancel", ecode);
+ case 1:
+ break;
}
switch (code = param_read_bool(plist, "Tumble", &tumble)) {
- case 0:
- wdev->tumble = tumble;
- break;
- default:
- ecode = code;
- param_signal_error(plist, "Tumble", ecode);
- case 1:
- break;
+ case 0:
+ wdev->tumble = tumble;
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, "Tumble", ecode);
+ case 1:
+ break;
}
switch (code = param_read_int(plist, "QueryUser", &queryuser)) {
- case 0:
- if ((queryuser > 0) &&
- (queryuser < 4)) {
- win_pr2_print_setup_interaction(wdev, queryuser);
- }
- break;
- default:
- ecode = code;
- param_signal_error(plist, "QueryUser", ecode);
- case 1:
- break;
+ case 0:
+ if ((queryuser > 0) &&
+ (queryuser < 4)) {
+ win_pr2_print_setup_interaction(wdev, queryuser);
+ }
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, "QueryUser", ecode);
+ case 1:
+ break;
}
if (ecode >= 0)
- ecode = gdev_prn_put_params(pdev, plist);
-
+ ecode = gdev_prn_put_params(pdev, plist);
+
if (wdev->win32_hdevmode && wdev->hdcprn) {
- if ( (old_duplex != wdev->Duplex)
- || (old_tumble != wdev->tumble)
- || (old_orient != wdev->user_orient)
- || (old_color != wdev->user_color)
- || (old_paper != wdev->user_paper)
- || (old_mx_dpi != wdev->max_dpi) ) {
-
- LPDEVMODE pdevmode = GlobalLock(wdev->win32_hdevmode);
-
- if (pdevmode) {
- win_pr2_update_win(wdev, pdevmode);
- ResetDC(wdev->hdcprn, pdevmode);
- GlobalUnlock(pdevmode);
- }
- }
+ if ( (old_duplex != wdev->Duplex)
+ || (old_tumble != wdev->tumble)
+ || (old_orient != wdev->user_orient)
+ || (old_color != wdev->user_color)
+ || (old_paper != wdev->user_paper)
+ || (old_mx_dpi != wdev->max_dpi) ) {
+
+ LPDEVMODE pdevmode = GlobalLock(wdev->win32_hdevmode);
+
+ if (pdevmode) {
+ win_pr2_update_win(wdev, pdevmode);
+ ResetDC(wdev->hdcprn, pdevmode);
+ GlobalUnlock(pdevmode);
+ }
+ }
}
-
+
return ecode;
}
@@ -858,7 +853,6 @@ win_pr2_put_params(gx_device * pdev, gs_param_list * plist)
/********************************************************************************/
-
/* Get Device Context for printer */
static int
win_pr2_getdc(gx_device_win_pr2 * wdev)
@@ -886,30 +880,30 @@ win_pr2_getdc(gx_device_win_pr2 * wdev)
/* first try to derive the printer name from -sOutputFile= */
/* is printer if name prefixed by \\spool\ or by %printer% */
if (is_spool(wdev->fname)) {
- device = wdev->fname + 8; /* skip over \\spool\ */
- wdev->use_old_spool_name = true;
+ device = wdev->fname + 8; /* skip over \\spool\ */
+ wdev->use_old_spool_name = true;
} else if (strncmp("%printer%",wdev->fname,9) == 0) {
- device = wdev->fname + 9; /* skip over %printer% */
- wdev->use_old_spool_name = false;
+ device = wdev->fname + 9; /* skip over %printer% */
+ wdev->use_old_spool_name = false;
} else {
- return FALSE;
+ return FALSE;
}
/* now try to match the printer name against the [Devices] section */
if ((devices = gs_malloc(wdev->memory, 4096, 1, "win_pr2_getdc")) == (char *)NULL)
- return FALSE;
+ return FALSE;
GetProfileString("Devices", NULL, "", devices, 4096);
p = devices;
while (*p) {
- if (stricmp(p, device) == 0)
- break;
- p += strlen(p) + 1;
+ if (stricmp(p, device) == 0)
+ break;
+ p += strlen(p) + 1;
}
if (*p == '\0')
- p = NULL;
+ p = NULL;
gs_free(wdev->memory, devices, 4096, 1, "win_pr2_getdc");
if (p == NULL)
- return FALSE; /* doesn't match an available printer */
+ return FALSE; /* doesn't match an available printer */
/* the printer exists, get the remaining information from win.ini */
GetProfileString("Devices", device, "", driverbuf, sizeof(driverbuf));
@@ -917,17 +911,17 @@ win_pr2_getdc(gx_device_win_pr2 * wdev)
output = strtok(NULL, ",");
if (!OpenPrinter(device, &hprinter, NULL))
- return FALSE;
+ return FALSE;
devmode_size = DocumentProperties(NULL, hprinter, device, NULL, NULL, 0);
if ((podevmode = gs_malloc(wdev->memory, devmode_size, 1, "win_pr2_getdc"))
- == (LPDEVMODE) NULL) {
- ClosePrinter(hprinter);
- return FALSE;
+ == (LPDEVMODE) NULL) {
+ ClosePrinter(hprinter);
+ return FALSE;
}
if ((pidevmode = gs_malloc(wdev->memory, devmode_size, 1, "win_pr2_getdc")) == (LPDEVMODE) NULL) {
- gs_free(wdev->memory, podevmode, devmode_size, 1, "win_pr2_getdc");
- ClosePrinter(hprinter);
- return FALSE;
+ gs_free(wdev->memory, podevmode, devmode_size, 1, "win_pr2_getdc");
+ ClosePrinter(hprinter);
+ return FALSE;
}
DocumentProperties(NULL, hprinter, device, podevmode, NULL, DM_OUT_BUFFER);
@@ -935,7 +929,7 @@ win_pr2_getdc(gx_device_win_pr2 * wdev)
devcapsize = DeviceCapabilities(device, output, DC_PAPERSIZE, NULL, NULL);
devcapsize *= sizeof(POINT);
if ((devcap = gs_malloc(wdev->memory, devcapsize, 1, "win_pr2_getdc")) == (LPBYTE) NULL)
- return FALSE;
+ return FALSE;
n = DeviceCapabilities(device, output, DC_PAPERSIZE, devcap, NULL);
paperwidth = (int)(wdev->MediaSize[0] * 254 / 72);
paperheight = (int)(wdev->MediaSize[1] * 254 / 72);
@@ -945,123 +939,122 @@ win_pr2_getdc(gx_device_win_pr2 * wdev)
orientation = 0;
pp = (POINT *) devcap;
for (i = 0; i < n; i++, pp++) {
- if ((pp->x < paperwidth + 20) && (pp->x > paperwidth - 20) &&
- (pp->y < paperheight + 20) && (pp->y > paperheight - 20)) {
- paperindex = i;
- paperwidth = pp->x;
- paperheight = pp->y;
- orientation = DMORIENT_PORTRAIT;
- break;
- }
+ if ((pp->x < paperwidth + 20) && (pp->x > paperwidth - 20) &&
+ (pp->y < paperheight + 20) && (pp->y > paperheight - 20)) {
+ paperindex = i;
+ paperwidth = pp->x;
+ paperheight = pp->y;
+ orientation = DMORIENT_PORTRAIT;
+ break;
+ }
}
if (paperindex < 0) {
- /* try again in landscape */
- pp = (POINT *) devcap;
- for (i = 0; i < n; i++, pp++) {
- if ((pp->x < paperheight + 20) && (pp->x > paperheight - 20) &&
- (pp->y < paperwidth + 20) && (pp->y > paperwidth - 20)) {
- paperindex = i;
- paperwidth = pp->x;
- paperheight = pp->y;
- orientation = DMORIENT_LANDSCAPE;
- break;
- }
- }
+ /* try again in landscape */
+ pp = (POINT *) devcap;
+ for (i = 0; i < n; i++, pp++) {
+ if ((pp->x < paperheight + 20) && (pp->x > paperheight - 20) &&
+ (pp->y < paperwidth + 20) && (pp->y > paperwidth - 20)) {
+ paperindex = i;
+ paperwidth = pp->x;
+ paperheight = pp->y;
+ orientation = DMORIENT_LANDSCAPE;
+ break;
+ }
+ }
}
gs_free(wdev->memory, devcap, devcapsize, 1, "win_pr2_getdc");
-
+
/* get the dmPaperSize */
devcapsize = DeviceCapabilities(device, output, DC_PAPERS, NULL, NULL);
devcapsize *= sizeof(WORD);
if ((devcap = gs_malloc(wdev->memory, devcapsize, 1, "win_pr2_getdc")) == (LPBYTE) NULL)
- return FALSE;
+ return FALSE;
n = DeviceCapabilities(device, output, DC_PAPERS, devcap, NULL);
if ((paperindex >= 0) && (paperindex < n))
- papersize = ((WORD *) devcap)[paperindex];
+ papersize = ((WORD *) devcap)[paperindex];
gs_free(wdev->memory, devcap, devcapsize, 1, "win_pr2_getdc");
/* get the paper name */
devcapsize = DeviceCapabilities(device, output, DC_PAPERNAMES, NULL, NULL);
devcapsize *= 64;
if ((devcap = gs_malloc(wdev->memory, devcapsize, 1, "win_pr2_getdc")) == (LPBYTE) NULL)
- return FALSE;
+ return FALSE;
n = DeviceCapabilities(device, output, DC_PAPERNAMES, devcap, NULL);
if ((paperindex >= 0) && (paperindex < n))
- strcpy(papername, devcap + paperindex * 64);
+ strcpy(papername, devcap + paperindex * 64);
gs_free(wdev->memory, devcap, devcapsize, 1, "win_pr2_getdc");
memcpy(pidevmode, podevmode, devmode_size);
pidevmode->dmFields = 0;
-
+
wdev->paper_name[0] = 0;
if ( (wdev->user_paper)
&& (wdev->user_paper != papersize) ) {
- papersize = wdev->user_paper;
- paperheight = 0;
- paperwidth = 0;
- papername[0] = 0;
+ papersize = wdev->user_paper;
+ paperheight = 0;
+ paperwidth = 0;
+ papername[0] = 0;
}
if (wdev->user_orient) {
- orientation = wdev->user_orient;
+ orientation = wdev->user_orient;
}
-
+
pidevmode->dmFields &= ~(DM_PAPERSIZE | DM_ORIENTATION | DM_COLOR | DM_PAPERLENGTH | DM_PAPERWIDTH | DM_DUPLEX);
pidevmode->dmFields |= DM_DEFAULTSOURCE;
pidevmode->dmDefaultSource = 0;
-
+
if (orientation) {
- wdev->user_orient = orientation;
+ wdev->user_orient = orientation;
}
if (papersize) {
- wdev->user_paper = papersize;
- strcpy (wdev->paper_name, papername);
+ wdev->user_paper = papersize;
+ strcpy (wdev->paper_name, papername);
}
-
+
if (paperheight && paperwidth) {
- pidevmode->dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
- pidevmode->dmPaperWidth = paperwidth;
- pidevmode->dmPaperLength = paperheight;
+ pidevmode->dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
+ pidevmode->dmPaperWidth = paperwidth;
+ pidevmode->dmPaperLength = paperheight;
wdev->user_media_size[0] = paperwidth / 254.0 * 72.0;
- wdev->user_media_size[1] = paperheight / 254.0 * 72.0;
+ wdev->user_media_size[1] = paperheight / 254.0 * 72.0;
}
-
+
if (DeviceCapabilities(device, output, DC_DUPLEX, NULL, NULL)) {
- wdev->Duplex_set = 1;
+ wdev->Duplex_set = 1;
}
-
+
win_pr2_update_win(wdev, pidevmode);
-
+
/* merge the entries */
DocumentProperties(NULL, hprinter, device, podevmode, pidevmode, DM_IN_BUFFER | DM_OUT_BUFFER);
ClosePrinter(hprinter);
-
+
/* now get a DC */
wdev->hdcprn = CreateDC(driver, device, NULL, podevmode);
-
+
if (wdev->win32_hdevmode == NULL)
- wdev->win32_hdevmode = GlobalAlloc(0, devmode_size);
-
+ wdev->win32_hdevmode = GlobalAlloc(0, devmode_size);
+
if (wdev->win32_hdevmode) {
- LPDEVMODE pdevmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
- if (pdevmode) {
- memcpy(pdevmode, podevmode, devmode_size);
- GlobalUnlock(wdev->win32_hdevmode);
- }
+ LPDEVMODE pdevmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
+ if (pdevmode) {
+ memcpy(pdevmode, podevmode, devmode_size);
+ GlobalUnlock(wdev->win32_hdevmode);
+ }
}
gs_free(wdev->memory, pidevmode, devmode_size, 1, "win_pr2_getdc");
gs_free(wdev->memory, podevmode, devmode_size, 1, "win_pr2_getdc");
if (wdev->hdcprn != (HDC) NULL)
- return TRUE; /* success */
+ return TRUE; /* success */
/* fall back to prompting user */
return FALSE;
}
-
/*
* Minimalist update of the wdev parameters (mainly for the
* UserSettings parameters).
@@ -1071,26 +1064,26 @@ static int
win_pr2_update_dev(gx_device_win_pr2 * dev, LPDEVMODE pdevmode)
{
if (pdevmode == 0)
- return FALSE;
-
+ return FALSE;
+
if (pdevmode->dmFields & DM_COLOR) {
- dev->user_color = pdevmode->dmColor;
+ dev->user_color = pdevmode->dmColor;
}
if (pdevmode->dmFields & DM_ORIENTATION) {
- dev->user_orient = pdevmode->dmOrientation;
+ dev->user_orient = pdevmode->dmOrientation;
}
if (pdevmode->dmFields & DM_PAPERSIZE) {
- dev->user_paper = pdevmode->dmPaperSize;
+ dev->user_paper = pdevmode->dmPaperSize;
dev->user_media_size[0] = pdevmode->dmPaperWidth / 254.0 * 72.0;
- dev->user_media_size[1] = pdevmode->dmPaperLength / 254.0 * 72.0;
- dev->paper_name[0] = 0; /* unknown paper size */
+ dev->user_media_size[1] = pdevmode->dmPaperLength / 254.0 * 72.0;
+ dev->paper_name[0] = 0; /* unknown paper size */
}
if (pdevmode->dmFields & DM_DUPLEX) {
- dev->Duplex_set = 1;
- dev->Duplex = pdevmode->dmDuplex == DMDUP_SIMPLEX ? false : true;
- dev->tumble = pdevmode->dmDuplex == DMDUP_HORIZONTAL ? true : false;
+ dev->Duplex_set = 1;
+ dev->Duplex = pdevmode->dmDuplex == DMDUP_SIMPLEX ? false : true;
+ dev->tumble = pdevmode->dmDuplex == DMDUP_HORIZONTAL ? true : false;
}
-
+
return TRUE;
}
@@ -1098,30 +1091,30 @@ static int
win_pr2_update_win(gx_device_win_pr2 * dev, LPDEVMODE pdevmode)
{
if (dev->Duplex_set > 0) {
- pdevmode->dmFields |= DM_DUPLEX;
- pdevmode->dmDuplex = DMDUP_SIMPLEX;
- if (dev->Duplex) {
- if (dev->tumble == false) {
- pdevmode->dmDuplex = DMDUP_VERTICAL;
- } else {
- pdevmode->dmDuplex = DMDUP_HORIZONTAL;
- }
- }
+ pdevmode->dmFields |= DM_DUPLEX;
+ pdevmode->dmDuplex = DMDUP_SIMPLEX;
+ if (dev->Duplex) {
+ if (dev->tumble == false) {
+ pdevmode->dmDuplex = DMDUP_VERTICAL;
+ } else {
+ pdevmode->dmDuplex = DMDUP_HORIZONTAL;
+ }
+ }
}
-
+
if (dev->user_color) {
- pdevmode->dmColor = dev->user_color;
- pdevmode->dmFields |= DM_COLOR;
+ pdevmode->dmColor = dev->user_color;
+ pdevmode->dmFields |= DM_COLOR;
}
-
+
if (dev->user_orient) {
- pdevmode->dmFields |= DM_ORIENTATION;
- pdevmode->dmOrientation = dev->user_orient;
+ pdevmode->dmFields |= DM_ORIENTATION;
+ pdevmode->dmOrientation = dev->user_orient;
}
-
+
if (dev->user_paper) {
- pdevmode->dmFields |= DM_PAPERSIZE;
- pdevmode->dmPaperSize = dev->user_paper;
+ pdevmode->dmFields |= DM_PAPERSIZE;
+ pdevmode->dmPaperSize = dev->user_paper;
}
return 0;
}
@@ -1132,23 +1125,22 @@ win_pr2_update_win(gx_device_win_pr2 * dev, LPDEVMODE pdevmode)
switch ( code = pread(dict.list, (param_name = pname), &(pa)) )\
{\
case 0:\
- if ( (pa).size != psize )\
- ecode = gs_note_error(gs_error_rangecheck);\
- else {
+ if ( (pa).size != psize )\
+ ecode = gs_note_error(gs_error_rangecheck);\
+ else {
/* The body of the processing code goes here. */
/* If it succeeds, it should do a 'break'; */
/* if it fails, it should set ecode and fall through. */
#define END_ARRAY_PARAM(pa, e)\
- }\
- goto e;\
+ }\
+ goto e;\
default:\
- ecode = code;\
+ ecode = code;\
e: param_signal_error(dict.list, param_name, ecode);\
case 1:\
- (pa).data = 0; /* mark as not filled */\
+ (pa).data = 0; /* mark as not filled */\
}
-
/* Put the user params from UserSettings into our */
/* internal variables. */
static int
@@ -1162,81 +1154,80 @@ win_pr2_read_user_settings(gx_device_win_pr2 * wdev, gs_param_list * plist)
int ecode = 0;
switch (code = param_begin_read_dict(plist, dict_name, &dict, false)) {
- default:
- param_signal_error(plist, dict_name, code);
- return code;
- case 1:
- break;
- case 0:
- {
- gs_param_int_array ia;
-
- BEGIN_ARRAY_PARAM(param_read_int_array, "DocumentRange", ia, 2, ia)
- if ((ia.data[0] < 0) ||
- (ia.data[1] < 0) ||
- (ia.data[0] > ia.data[1]))
- ecode = gs_note_error(gs_error_rangecheck);
- wdev->doc_page_begin = ia.data[0];
- wdev->doc_page_end = ia.data[1];
- END_ARRAY_PARAM(ia, doc_range_error)
-
- BEGIN_ARRAY_PARAM(param_read_int_array, "SelectedRange", ia, 2, ia)
- if ((ia.data[0] < 0) ||
- (ia.data[1] < 0) ||
- (ia.data[0] > ia.data[1]))
- ecode = gs_note_error(gs_error_rangecheck);
- wdev->user_page_begin = ia.data[0];
- wdev->user_page_end = ia.data[1];
- END_ARRAY_PARAM(ia, sel_range_error)
-
- param_read_int(dict.list, "Copies", &wdev->user_copies);
- param_read_int(dict.list, "Paper", &wdev->user_paper);
- param_read_int(dict.list, "Orientation", &wdev->user_orient);
- param_read_int(dict.list, "Color", &wdev->user_color);
- param_read_int(dict.list, "MaxResolution", &wdev->max_dpi);
-
- switch (code = param_read_string(dict.list, (param_name = "DocumentName"), &docn)) {
- case 0:
- if (docn.size < sizeof(wdev->doc_name))
- break;
- code = gs_error_rangecheck;
- /* fall through */
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- /* fall through */
- case 1:
- docn.data = 0;
- break;
- }
-
- param_end_read_dict(plist, dict_name, &dict);
-
- if (docn.data) {
- memcpy(wdev->doc_name, docn.data, docn.size);
- wdev->doc_name[docn.size] = 0;
- }
-
- wdev->print_copies = 1;
-
- if (wdev->win32_hdevmode) {
- LPDEVMODE devmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
- if (devmode) {
- devmode->dmCopies = wdev->user_copies;
- devmode->dmPaperSize = wdev->user_paper;
- devmode->dmOrientation = wdev->user_orient;
- devmode->dmColor = wdev->user_color;
- GlobalUnlock(wdev->win32_hdevmode);
- }
- }
- }
- break;
+ default:
+ param_signal_error(plist, dict_name, code);
+ return code;
+ case 1:
+ break;
+ case 0:
+ {
+ gs_param_int_array ia;
+
+ BEGIN_ARRAY_PARAM(param_read_int_array, "DocumentRange", ia, 2, ia)
+ if ((ia.data[0] < 0) ||
+ (ia.data[1] < 0) ||
+ (ia.data[0] > ia.data[1]))
+ ecode = gs_note_error(gs_error_rangecheck);
+ wdev->doc_page_begin = ia.data[0];
+ wdev->doc_page_end = ia.data[1];
+ END_ARRAY_PARAM(ia, doc_range_error)
+
+ BEGIN_ARRAY_PARAM(param_read_int_array, "SelectedRange", ia, 2, ia)
+ if ((ia.data[0] < 0) ||
+ (ia.data[1] < 0) ||
+ (ia.data[0] > ia.data[1]))
+ ecode = gs_note_error(gs_error_rangecheck);
+ wdev->user_page_begin = ia.data[0];
+ wdev->user_page_end = ia.data[1];
+ END_ARRAY_PARAM(ia, sel_range_error)
+
+ param_read_int(dict.list, "Copies", &wdev->user_copies);
+ param_read_int(dict.list, "Paper", &wdev->user_paper);
+ param_read_int(dict.list, "Orientation", &wdev->user_orient);
+ param_read_int(dict.list, "Color", &wdev->user_color);
+ param_read_int(dict.list, "MaxResolution", &wdev->max_dpi);
+
+ switch (code = param_read_string(dict.list, (param_name = "DocumentName"), &docn)) {
+ case 0:
+ if (docn.size < sizeof(wdev->doc_name))
+ break;
+ code = gs_error_rangecheck;
+ /* fall through */
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ /* fall through */
+ case 1:
+ docn.data = 0;
+ break;
+ }
+
+ param_end_read_dict(plist, dict_name, &dict);
+
+ if (docn.data) {
+ memcpy(wdev->doc_name, docn.data, docn.size);
+ wdev->doc_name[docn.size] = 0;
+ }
+
+ wdev->print_copies = 1;
+
+ if (wdev->win32_hdevmode) {
+ LPDEVMODE devmode = (LPDEVMODE) GlobalLock(wdev->win32_hdevmode);
+ if (devmode) {
+ devmode->dmCopies = wdev->user_copies;
+ devmode->dmPaperSize = wdev->user_paper;
+ devmode->dmOrientation = wdev->user_orient;
+ devmode->dmColor = wdev->user_color;
+ GlobalUnlock(wdev->win32_hdevmode);
+ }
+ }
+ }
+ break;
}
return code;
}
-
static int
win_pr2_write_user_settings(gx_device_win_pr2 * wdev, gs_param_list * plist)
{
@@ -1280,16 +1271,16 @@ win_pr2_write_user_settings(gx_device_win_pr2 * wdev, gs_param_list * plist)
code = param_write_int(dict.list, "Paper", &wdev->user_paper);
if (code < 0) goto error;
-
+
code = param_write_int(dict.list, "Orientation", &wdev->user_orient);
if (code < 0) goto error;
-
+
code = param_write_int(dict.list, "Color", &wdev->user_color);
if (code < 0) goto error;
-
+
code = param_write_int(dict.list, "MaxResolution", &wdev->max_dpi);
if (code < 0) goto error;
-
+
code = param_write_int(dict.list, "PrintCopies", &wdev->print_copies);
if (code < 0) goto error;
@@ -1299,11 +1290,11 @@ win_pr2_write_user_settings(gx_device_win_pr2 * wdev, gs_param_list * plist)
code = param_write_string(dict.list, "DocumentName", &docn);
if (code < 0) goto error;
-
+
papn.data = (const byte*)wdev->paper_name;
papn.size = strlen(wdev->paper_name);
papn.persistent = false;
-
+
code = param_write_string(dict.list, "PaperName", &papn);
if (code < 0) goto error;
@@ -1336,9 +1327,9 @@ win_pr2_print_setup_interaction(gx_device_win_pr2 * wdev, int mode)
pd.hwndOwner = PARENT_WINDOW;
switch (mode) {
- case 2: pd.Flags = PD_PRINTSETUP; break;
- case 3: pd.Flags = PD_RETURNDEFAULT; break;
- default: pd.Flags = 0; break;
+ case 2: pd.Flags = PD_PRINTSETUP; break;
+ case 3: pd.Flags = PD_RETURNDEFAULT; break;
+ default: pd.Flags = 0; break;
}
pd.Flags |= PD_USEDEVMODECOPIES;
@@ -1360,14 +1351,14 @@ win_pr2_print_setup_interaction(gx_device_win_pr2 * wdev, int mode)
wdev->user_changed_settings = TRUE;
if (wdev->use_old_spool_name) {
- sprintf(wdev->fname, "\\\\spool\\%s", (char*)(devnames)+(devnames->wDeviceOffset));
+ sprintf(wdev->fname, "\\\\spool\\%s", (char*)(devnames)+(devnames->wDeviceOffset));
} else {
- sprintf(wdev->fname, "%%printer%%%s", (char*)(devnames)+(devnames->wDeviceOffset));
+ sprintf(wdev->fname, "%%printer%%%s", (char*)(devnames)+(devnames->wDeviceOffset));
}
if (mode == 3) {
- devmode->dmCopies = wdev->user_copies * wdev->print_copies;
- pd.nCopies = 1;
+ devmode->dmCopies = wdev->user_copies * wdev->print_copies;
+ pd.nCopies = 1;
}
wdev->user_page_begin = pd.nFromPage;
@@ -1379,29 +1370,29 @@ win_pr2_print_setup_interaction(gx_device_win_pr2 * wdev, int mode)
wdev->user_paper = devmode->dmPaperSize;
wdev->user_orient = devmode->dmOrientation;
wdev->user_color = devmode->dmColor;
-
+
if (devmode->dmFields & DM_DUPLEX) {
- wdev->Duplex_set = 1;
- wdev->Duplex = devmode->dmDuplex == DMDUP_SIMPLEX ? false : true;
- wdev->tumble = devmode->dmDuplex == DMDUP_HORIZONTAL ? true : false;
+ wdev->Duplex_set = 1;
+ wdev->Duplex = devmode->dmDuplex == DMDUP_SIMPLEX ? false : true;
+ wdev->tumble = devmode->dmDuplex == DMDUP_HORIZONTAL ? true : false;
}
{
- float xppinch = 0;
- float yppinch = 0;
- const char* driver = (char*)(devnames)+(devnames->wDriverOffset);
- const char* device = (char*)(devnames)+(devnames->wDeviceOffset);
- const char* output = (char*)(devnames)+(devnames->wOutputOffset);
-
- HDC hic = CreateIC(driver, device, output, devmode);
-
- if (hic) {
- xppinch = (float)GetDeviceCaps(hic, LOGPIXELSX);
- yppinch = (float)GetDeviceCaps(hic, LOGPIXELSY);
- wdev->user_media_size[0] = GetDeviceCaps(hic, PHYSICALWIDTH) * 72.0 / xppinch;
- wdev->user_media_size[1] = GetDeviceCaps(hic, PHYSICALHEIGHT) * 72.0 / yppinch;
- DeleteDC(hic);
- }
+ float xppinch = 0;
+ float yppinch = 0;
+ const char* driver = (char*)(devnames)+(devnames->wDriverOffset);
+ const char* device = (char*)(devnames)+(devnames->wDeviceOffset);
+ const char* output = (char*)(devnames)+(devnames->wOutputOffset);
+
+ HDC hic = CreateIC(driver, device, output, devmode);
+
+ if (hic) {
+ xppinch = (float)GetDeviceCaps(hic, LOGPIXELSX);
+ yppinch = (float)GetDeviceCaps(hic, LOGPIXELSY);
+ wdev->user_media_size[0] = GetDeviceCaps(hic, PHYSICALWIDTH) * 72.0 / xppinch;
+ wdev->user_media_size[1] = GetDeviceCaps(hic, PHYSICALHEIGHT) * 72.0 / yppinch;
+ DeleteDC(hic);
+ }
}
devmode = NULL;
@@ -1411,10 +1402,10 @@ win_pr2_print_setup_interaction(gx_device_win_pr2 * wdev, int mode)
GlobalUnlock(pd.hDevNames);
if (wdev->win32_hdevmode != NULL) {
- GlobalFree(wdev->win32_hdevmode);
+ GlobalFree(wdev->win32_hdevmode);
}
if (wdev->win32_hdevnames != NULL) {
- GlobalFree(wdev->win32_hdevnames);
+ GlobalFree(wdev->win32_hdevnames);
}
wdev->win32_hdevmode = pd.hDevMode;
@@ -1437,7 +1428,7 @@ win_pr2_copy_check(gx_device_win_pr2 * wdev)
DWORD devnames_len = (hdevnames) ? GlobalSize(hdevnames) : 0;
if (wdev->original_device == wdev)
- return;
+ return;
wdev->hdcprn = NULL;
wdev->win32_hdevmode = NULL;
@@ -1446,51 +1437,48 @@ win_pr2_copy_check(gx_device_win_pr2 * wdev)
wdev->original_device = wdev;
if (devmode_len) {
- wdev->win32_hdevmode = GlobalAlloc(0, devmode_len);
- if (wdev->win32_hdevmode) {
- memcpy(GlobalLock(wdev->win32_hdevmode), GlobalLock(hdevmode), devmode_len);
- GlobalUnlock(wdev->win32_hdevmode);
- GlobalUnlock(hdevmode);
- }
+ wdev->win32_hdevmode = GlobalAlloc(0, devmode_len);
+ if (wdev->win32_hdevmode) {
+ memcpy(GlobalLock(wdev->win32_hdevmode), GlobalLock(hdevmode), devmode_len);
+ GlobalUnlock(wdev->win32_hdevmode);
+ GlobalUnlock(hdevmode);
+ }
}
if (devnames_len) {
- wdev->win32_hdevnames = GlobalAlloc(0, devnames_len);
- if (wdev->win32_hdevnames) {
- memcpy(GlobalLock(wdev->win32_hdevnames), GlobalLock(hdevnames), devnames_len);
- GlobalUnlock(wdev->win32_hdevnames);
- GlobalUnlock(hdevnames);
- }
+ wdev->win32_hdevnames = GlobalAlloc(0, devnames_len);
+ if (wdev->win32_hdevnames) {
+ memcpy(GlobalLock(wdev->win32_hdevnames), GlobalLock(hdevnames), devnames_len);
+ GlobalUnlock(wdev->win32_hdevnames);
+ GlobalUnlock(hdevnames);
+ }
}
}
-
/* Modeless dialog box - Cancel printing */
-BOOL CALLBACK
+BOOL CALLBACK
CancelDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
- case WM_INITDIALOG:
- SetWindowText(hDlg, szAppName);
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDCANCEL:
- DestroyWindow(hDlg);
- EndDialog(hDlg, 0);
- return TRUE;
- }
+ case WM_INITDIALOG:
+ SetWindowText(hDlg, szAppName);
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ DestroyWindow(hDlg);
+ EndDialog(hDlg, 0);
+ return TRUE;
+ }
}
return FALSE;
}
-
-BOOL CALLBACK
+BOOL CALLBACK
AbortProc2(HDC hdcPrn, int code)
{
process_interrupts(NULL);
if (code == SP_OUTOFDISK)
- return (FALSE); /* cancel job */
+ return (FALSE); /* cancel job */
return (TRUE);
}
-
diff --git a/gs/base/gdevwprn.c b/gs/base/gdevwprn.c
index ab56f162c..bfa8d2919 100644
--- a/gs/base/gdevwprn.c
+++ b/gs/base/gdevwprn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,12 +28,11 @@
#define PARENT_WINDOW HWND_DESKTOP
-
/*
****** NOTE: this module and gdevwddb should be refactored.
* The drawing routines are almost identical.
* The differences are that the mswinprn doesn't use an extra
- * palette (gdevwddb.c could probably be made to work with
+ * palette (gdevwddb.c could probably be made to work with
* one palette also), mswinprn doesn't call win_update() because
* hwndimg doesn't exist, and the HDC is hdcmf not hdcbit.
******/
@@ -78,7 +77,7 @@ struct gx_device_win_prn_s {
#define select_brush(color)\
if (wdev->hbrush != wdev->hbrushs[color])\
{ wdev->hbrush = wdev->hbrushs[color];\
- SelectObject(wdev->hdcmf,wdev->hbrush);\
+ SelectObject(wdev->hdcmf,wdev->hbrush);\
}
/* A staging bitmap for copy_mono. */
/* We want one big enough to handle the standard 16x16 halftone; */
@@ -119,8 +118,8 @@ static const gx_device_procs win_prn_procs =
gx_device_win_prn far_data gs_mswinprn_device =
{
std_device_std_body(gx_device_win_prn, &win_prn_procs, "mswinprn",
- INITIAL_WIDTH, INITIAL_HEIGHT, /* win_open() fills these in later */
- INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
+ INITIAL_WIDTH, INITIAL_HEIGHT, /* win_open() fills these in later */
+ INITIAL_RESOLUTION, INITIAL_RESOLUTION /* win_open() fills these in later */
),
{0}, /* std_procs */
0, /* BitsPerPixel */
@@ -143,30 +142,30 @@ win_prn_open(gx_device * dev)
pd.hwndOwner = PARENT_WINDOW;
pd.Flags = PD_PRINTSETUP | PD_RETURNDC;
if (!PrintDlg(&pd)) {
- /* device not opened - exit ghostscript */
- return gs_error_limitcheck;
+ /* device not opened - exit ghostscript */
+ return gs_error_limitcheck;
}
GlobalFree(pd.hDevMode);
GlobalFree(pd.hDevNames);
pd.hDevMode = pd.hDevNames = NULL;
wdev->hdcprn = pd.hDC;
if (!(GetDeviceCaps(wdev->hdcprn, RASTERCAPS) != RC_BITBLT)) {
- DeleteDC(wdev->hdcprn);
- return gs_error_limitcheck;
+ DeleteDC(wdev->hdcprn);
+ return gs_error_limitcheck;
}
wdev->lpfnAbortProc = (DLGPROC) AbortProc;
Escape(wdev->hdcprn, SETABORTPROC, 0, (LPSTR) wdev->lpfnAbortProc, NULL);
if (Escape(wdev->hdcprn, STARTDOC, strlen(szAppName), szAppName, NULL) <= 0) {
- DeleteDC(wdev->hdcprn);
- return gs_error_limitcheck;
+ DeleteDC(wdev->hdcprn);
+ return gs_error_limitcheck;
}
f = gp_open_scratch_file(dev->memory,
gp_scratch_file_name_prefix,
- wdev->mfname, "wb");
+ wdev->mfname, "wb");
if (f == (FILE *) NULL) {
- Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
- DeleteDC(wdev->hdcprn);
- return gs_error_limitcheck;
+ Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
+ DeleteDC(wdev->hdcprn);
+ return gs_error_limitcheck;
}
unlink(wdev->mfname);
wdev->hdcmf = CreateMetaFile(wdev->mfname);
@@ -180,12 +179,12 @@ win_prn_open(gx_device * dev)
m[0] /*left */ = offset.x / dev->x_pixels_per_inch;
m[3] /*top */ = offset.y / dev->y_pixels_per_inch;
m[2] /*right */ =
- (size.x - offset.x - GetDeviceCaps(wdev->hdcprn, HORZRES))
- / dev->x_pixels_per_inch;
+ (size.x - offset.x - GetDeviceCaps(wdev->hdcprn, HORZRES))
+ / dev->x_pixels_per_inch;
m[1] /*bottom */ =
- (size.y - offset.y - GetDeviceCaps(wdev->hdcprn, VERTRES))
- / dev->y_pixels_per_inch
- + 0.15; /* hack to add a bit more margin for deskjet printer */
+ (size.y - offset.y - GetDeviceCaps(wdev->hdcprn, VERTRES))
+ / dev->y_pixels_per_inch
+ + 0.15; /* hack to add a bit more margin for deskjet printer */
gx_device_set_margins(dev, m, true);
/* Set parameters that were unknown before opening device */
@@ -193,45 +192,45 @@ win_prn_open(gx_device * dev)
/* We recognize 2, 16 or 256 color devices */
depth = GetDeviceCaps(wdev->hdcprn, PLANES) * GetDeviceCaps(wdev->hdcprn, BITSPIXEL);
if (depth >= 8) { /* use 64 static colors and 166 dynamic colors from 8 planes */
- static const gx_device_color_info win_256color = dci_color(8, 31, 4);
+ static const gx_device_color_info win_256color = dci_color(8, 31, 4);
- dev->color_info = win_256color;
- wdev->nColors = 64;
+ dev->color_info = win_256color;
+ wdev->nColors = 64;
} else if (depth >= 4) {
- static const gx_device_color_info win_16ega_color = dci_color(4, 2, 3);
+ static const gx_device_color_info win_16ega_color = dci_color(4, 2, 3);
- dev->color_info = win_16ega_color;
- wdev->nColors = 16;
+ dev->color_info = win_16ega_color;
+ wdev->nColors = 16;
} else { /* default is black_and_white */
- wdev->nColors = 2;
+ wdev->nColors = 2;
}
/* copy encode/decode procedures */
wdev->procs.encode_color = wdev->procs.map_rgb_color;
wdev->procs.decode_color = wdev->procs.map_color_rgb;
if (dev->color_info.depth == 1) {
- wdev->procs.get_color_mapping_procs =
- gx_default_DevGray_get_color_mapping_procs;
- wdev->procs.get_color_comp_index =
- gx_default_DevGray_get_color_comp_index;
+ wdev->procs.get_color_mapping_procs =
+ gx_default_DevGray_get_color_mapping_procs;
+ wdev->procs.get_color_comp_index =
+ gx_default_DevGray_get_color_comp_index;
}
else {
- wdev->procs.get_color_mapping_procs =
- gx_default_DevRGB_get_color_mapping_procs;
- wdev->procs.get_color_comp_index =
- gx_default_DevRGB_get_color_comp_index;
+ wdev->procs.get_color_mapping_procs =
+ gx_default_DevRGB_get_color_mapping_procs;
+ wdev->procs.get_color_comp_index =
+ gx_default_DevRGB_get_color_comp_index;
}
/* create palette for display */
if ((wdev->limgpalette = win_makepalette((gx_device_win *) dev))
- == (LPLOGPALETTE) NULL) {
- HMETAFILE hmf = CloseMetaFile(wdev->hdcmf);
-
- DeleteMetaFile(hmf);
- unlink(wdev->mfname);
- Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
- DeleteDC(wdev->hdcprn);
- return win_nomemory();
+ == (LPLOGPALETTE) NULL) {
+ HMETAFILE hmf = CloseMetaFile(wdev->hdcmf);
+
+ DeleteMetaFile(hmf);
+ unlink(wdev->mfname);
+ Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
+ DeleteDC(wdev->hdcprn);
+ return win_nomemory();
}
wdev->himgpalette = CreatePalette(wdev->limgpalette);
@@ -239,16 +238,16 @@ win_prn_open(gx_device * dev)
wdev->hbmmono = CreateBitmap(bmWidthBits, bmHeight, 1, 1, NULL);
wdev->hdcmono = CreateCompatibleDC(wdev->hdcprn);
if (wdev->hbmmono == NULL || wdev->hdcmono == NULL) {
- HMETAFILE hmf = CloseMetaFile(wdev->hdcmf);
-
- DeleteMetaFile(hmf);
- unlink(wdev->mfname);
- Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
- DeleteDC(wdev->hdcprn);
- gs_free((char *)(wdev->limgpalette), 1, sizeof(LOGPALETTE) +
- (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
- "win_prn_open");
- return win_nomemory();
+ HMETAFILE hmf = CloseMetaFile(wdev->hdcmf);
+
+ DeleteMetaFile(hmf);
+ unlink(wdev->mfname);
+ Escape(wdev->hdcprn, ENDDOC, 0, NULL, NULL);
+ DeleteDC(wdev->hdcprn);
+ gs_free((char *)(wdev->limgpalette), 1, sizeof(LOGPALETTE) +
+ (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
+ "win_prn_open");
+ return win_nomemory();
}
SetMapMode(wdev->hdcmono, GetMapMode(wdev->hdcprn));
SelectObject(wdev->hdcmono, wdev->hbmmono);
@@ -260,7 +259,6 @@ win_prn_open(gx_device * dev)
return 0;
}
-
/* Close the win_prn driver */
static int
win_prn_close(gx_device * dev)
@@ -279,8 +277,8 @@ win_prn_close(gx_device * dev)
DeleteObject(wdev->hbmmono);
DeleteObject(wdev->himgpalette);
gs_free((char *)(wdev->limgpalette), 1, sizeof(LOGPALETTE) +
- (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
- "win_prn_close");
+ (1 << (wdev->color_info.depth)) * sizeof(PALETTEENTRY),
+ "win_prn_close");
return (0);
}
@@ -302,9 +300,9 @@ win_prn_output_page(gx_device * dev, int num_copies, int flush)
Escape(wdev->hdcprn, NEXTBAND, 0, NULL, (LPRECT) & rect);
while (!IsRectEmpty(&rect)) {
- PlayMetaFile(wdev->hdcprn, hmf);
- if (Escape(wdev->hdcprn, NEXTBAND, 0, NULL, (LPRECT) & rect) <= 0)
- break;
+ PlayMetaFile(wdev->hdcprn, hmf);
+ if (Escape(wdev->hdcprn, NEXTBAND, 0, NULL, (LPRECT) & rect) <= 0)
+ break;
}
DeleteMetaFile(hmf);
unlink(wdev->mfname);
@@ -317,7 +315,6 @@ win_prn_output_page(gx_device * dev, int num_copies, int flush)
return gx_finish_output_page(dev, num_copies, flush);
}
-
/* Map a r-g-b color to the colors available under Windows */
static gx_color_index
win_prn_map_rgb_color(gx_device * dev, const gx_color_value cv[])
@@ -326,7 +323,7 @@ win_prn_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_index color = win_map_rgb_color(dev, cv);
if (color != i)
- return color;
+ return color;
(void)SelectPalette(wdev->hdcmf, wdev->himgpalette, FALSE);
RealizePalette(wdev->hdcmf);
win_prn_addtool(wdev, i);
@@ -334,7 +331,6 @@ win_prn_map_rgb_color(gx_device * dev, const gx_color_value cv[])
return color;
}
-
/* Macro for filling a rectangle with a color. */
/* Note that it starts with a declaration. */
#define fill_rect(x, y, w, h, color)\
@@ -343,19 +339,18 @@ rect.left = x, rect.top = y;\
rect.right = x + w, rect.bottom = y + h;\
FillRect(wdev->hdcmf, &rect, wdev->hbrushs[(int)color])
-
/* Fill a rectangle. */
static int
win_prn_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
fit_fill(dev, x, y, w, h);
/* Use PatBlt for filling. Special-case black. */
if (color == 0)
- PatBlt(wdev->hdcmf, x, y, w, h, rop_write_0s);
+ PatBlt(wdev->hdcmf, x, y, w, h, rop_write_0s);
else {
- select_brush((int)color);
- PatBlt(wdev->hdcmf, x, y, w, h, rop_write_pattern);
+ select_brush((int)color);
+ PatBlt(wdev->hdcmf, x, y, w, h, rop_write_pattern);
}
return 0;
@@ -368,78 +363,77 @@ win_prn_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
static int
win_prn_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
int x, int y, int w, int h, gx_color_index czero, gx_color_index cone,
- int px, int py)
+ int px, int py)
{
fit_fill(dev, x, y, w, h);
if (czero != gx_no_color_index && cone != gx_no_color_index) {
- fill_rect(x, y, w, h, czero);
- czero = gx_no_color_index;
+ fill_rect(x, y, w, h, czero);
+ czero = gx_no_color_index;
}
if (tile->raster == bmWidthBytes && tile->size.y <= bmHeight &&
- (px | py) == 0 && cone != gx_no_color_index
- ) { /* We can do this much more efficiently */
- /* by using the internal algorithms of copy_mono */
- /* and gx_default_tile_rectangle. */
- int width = tile->size.x;
- int height = tile->size.y;
- int rwidth = tile->rep_width;
- int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
- x & (rwidth - 1) :
- x % rwidth);
- int ry = y % tile->rep_height;
- int icw = width - irx;
- int ch = height - ry;
- int ex = x + w, ey = y + h;
- int fex = ex - width, fey = ey - height;
- int cx, cy;
-
- select_brush((int)cone);
-
- if (tile->id != wdev->bm_id || tile->id == gx_no_bitmap_id) {
- wdev->bm_id = tile->id;
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * tile->size.y),
- (BYTE *) tile->data);
- }
+ (px | py) == 0 && cone != gx_no_color_index
+ ) { /* We can do this much more efficiently */
+ /* by using the internal algorithms of copy_mono */
+ /* and gx_default_tile_rectangle. */
+ int width = tile->size.x;
+ int height = tile->size.y;
+ int rwidth = tile->rep_width;
+ int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
+ x & (rwidth - 1) :
+ x % rwidth);
+ int ry = y % tile->rep_height;
+ int icw = width - irx;
+ int ch = height - ry;
+ int ex = x + w, ey = y + h;
+ int fex = ex - width, fey = ey - height;
+ int cx, cy;
+
+ select_brush((int)cone);
+
+ if (tile->id != wdev->bm_id || tile->id == gx_no_bitmap_id) {
+ wdev->bm_id = tile->id;
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * tile->size.y),
+ (BYTE *) tile->data);
+ }
#define copy_tile(srcx, srcy, tx, ty, tw, th)\
BitBlt(wdev->hdcmf, tx, ty, tw, th, wdev->hdcmono, srcx, srcy, rop_write_at_1s)
- if (ch > h)
- ch = h;
- for (cy = y;;) {
- if (w <= icw)
- copy_tile(irx, ry, x, cy, w, ch);
- else {
- copy_tile(irx, ry, x, cy, icw, ch);
- cx = x + icw;
- while (cx <= fex) {
- copy_tile(0, ry, cx, cy, width, ch);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, ry, cx, cy, ex - cx, ch);
- }
- }
- if ((cy += ch) >= ey)
- break;
- ch = (cy > fey ? ey - cy : height);
- ry = 0;
- }
-
- return 0;
+ if (ch > h)
+ ch = h;
+ for (cy = y;;) {
+ if (w <= icw)
+ copy_tile(irx, ry, x, cy, w, ch);
+ else {
+ copy_tile(irx, ry, x, cy, icw, ch);
+ cx = x + icw;
+ while (cx <= fex) {
+ copy_tile(0, ry, cx, cy, width, ch);
+ cx += width;
+ }
+ if (cx < ex) {
+ copy_tile(0, ry, cx, cy, ex - cx, ch);
+ }
+ }
+ if ((cy += ch) >= ey)
+ break;
+ ch = (cy > fey ? ey - cy : height);
+ ry = 0;
+ }
+
+ return 0;
}
return gx_default_tile_rectangle(dev, tile, x, y, w, h, czero, cone, px, py);
}
-
/* Draw a line */
static int
win_prn_draw_line(gx_device * dev, int x0, int y0, int x1, int y1,
- gx_color_index color)
+ gx_color_index color)
{
if (wdev->hpen != wdev->hpens[(int)color]) {
- wdev->hpen = wdev->hpens[(int)color];
- SelectObject(wdev->hdcmf, wdev->hpen);
+ wdev->hpen = wdev->hpens[(int)color];
+ SelectObject(wdev->hdcmf, wdev->hpen);
}
MoveToEx(wdev->hdcmf, x0, y0, NULL);
LineTo(wdev->hdcmf, x1, y1);
@@ -450,9 +444,9 @@ win_prn_draw_line(gx_device * dev, int x0, int y0, int x1, int y1,
/* Color = gx_no_color_index means transparent (no effect on the image). */
static int
win_prn_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
int endx;
const byte *ptr_line;
@@ -465,173 +459,170 @@ win_prn_copy_mono(gx_device * dev,
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (sourcex & ~7) {
- base += sourcex >> 3;
- sourcex &= 7;
+ base += sourcex >> 3;
+ sourcex &= 7;
}
/* Break up large transfers into smaller ones. */
while ((endx = sourcex + w) > bmWidthBits) {
- int lastx = (endx - 1) & -bmWidthBits;
- int subw = endx - lastx;
- int code = win_prn_copy_mono(dev, base, lastx,
- raster, gx_no_bitmap_id,
- x + lastx - sourcex, y,
- subw, h, zero, one);
-
- if (code < 0)
- return code;
- w -= subw;
+ int lastx = (endx - 1) & -bmWidthBits;
+ int subw = endx - lastx;
+ int code = win_prn_copy_mono(dev, base, lastx,
+ raster, gx_no_bitmap_id,
+ x + lastx - sourcex, y,
+ subw, h, zero, one);
+
+ if (code < 0)
+ return code;
+ w -= subw;
}
while (h > bmHeight) {
- int code;
-
- h -= bmHeight;
- code = win_prn_copy_mono(dev, base + h * raster, sourcex,
- raster, gx_no_bitmap_id,
- x, y + h, w, bmHeight, zero, one);
- if (code < 0)
- return code;
+ int code;
+
+ h -= bmHeight;
+ code = win_prn_copy_mono(dev, base + h * raster, sourcex,
+ raster, gx_no_bitmap_id,
+ x, y + h, w, bmHeight, zero, one);
+ if (code < 0)
+ return code;
}
width_bytes = (sourcex + w + 7) >> 3;
ptr_line = base;
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- color = (int)one;
- if (color == 0)
- rop = rop_write_0_at_1s;
- else
- select_brush(color);
+ if (one == gx_no_color_index)
+ return 0;
+ color = (int)one;
+ if (color == 0)
+ rop = rop_write_0_at_1s;
+ else
+ select_brush(color);
} else {
- if (one == gx_no_color_index) {
- color = (int)zero;
- rop = rop_write_at_0s;
- } else { /* Pre-clear the rectangle to zero */
- fill_rect(x, y, w, h, zero);
- color = (int)one;
- }
- select_brush(color);
+ if (one == gx_no_color_index) {
+ color = (int)zero;
+ rop = rop_write_at_0s;
+ } else { /* Pre-clear the rectangle to zero */
+ fill_rect(x, y, w, h, zero);
+ color = (int)one;
+ }
+ select_brush(color);
}
if (id != wdev->bm_id || id == gx_no_bitmap_id) {
- wdev->bm_id = id;
- if (raster == bmWidthBytes) { /* We can do the whole thing in a single transfer! */
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * h),
- (BYTE *) base);
- } else {
- for (height = h; height--;
- ptr_line += raster, aptr += bmWidthBytes
- ) { /* Pack the bits into the bitmap. */
- switch (width_bytes) {
- default:
- memcpy(aptr, ptr_line, width_bytes);
- break;
- case 4:
- aptr[3] = ptr_line[3];
- case 3:
- aptr[2] = ptr_line[2];
- case 2:
- aptr[1] = ptr_line[1];
- case 1:
- aptr[0] = ptr_line[0];
- }
- }
- SetBitmapBits(wdev->hbmmono,
- (DWORD) (bmWidthBytes * h),
- &aBit[0]);
- }
+ wdev->bm_id = id;
+ if (raster == bmWidthBytes) { /* We can do the whole thing in a single transfer! */
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * h),
+ (BYTE *) base);
+ } else {
+ for (height = h; height--;
+ ptr_line += raster, aptr += bmWidthBytes
+ ) { /* Pack the bits into the bitmap. */
+ switch (width_bytes) {
+ default:
+ memcpy(aptr, ptr_line, width_bytes);
+ break;
+ case 4:
+ aptr[3] = ptr_line[3];
+ case 3:
+ aptr[2] = ptr_line[2];
+ case 2:
+ aptr[1] = ptr_line[1];
+ case 1:
+ aptr[0] = ptr_line[0];
+ }
+ }
+ SetBitmapBits(wdev->hbmmono,
+ (DWORD) (bmWidthBytes * h),
+ &aBit[0]);
+ }
}
BitBlt(wdev->hdcmf, x, y, w, h, wdev->hdcmono, sourcex, 0, rop);
return 0;
}
-
/* Copy a color pixel map. This is just like a bitmap, except that */
/* each pixel takes 8 or 4 bits instead of 1 when device driver has color. */
static int
win_prn_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
if (gx_device_has_color(dev)) {
- switch (dev->color_info.depth) {
- case 8:
- {
- int xi, yi;
- int skip = raster - w;
- const byte *sptr = base + sourcex;
-
- if (w <= 0)
- return 0;
- if (x < 0 || x + w > dev->width)
- return_error(gs_error_rangecheck);
- for (yi = y; yi - y < h; yi++) {
- for (xi = x; xi - x < w; xi++) {
- int color = *sptr++;
-
- SetPixel(wdev->hdcmf, xi, yi, PALETTEINDEX(color));
- }
- sptr += skip;
- }
- }
- break;
- case 4:
- { /* color device, four bits per pixel */
- const byte *line = base + (sourcex >> 1);
- int dest_y = y, end_x = x + w;
-
- if (w <= 0)
- return 0;
- while (h--) { /* for each line */
- const byte *source = line;
- register int dest_x = x;
-
- if (sourcex & 1) { /* odd nibble first */
- int color = *source++ & 0xf;
-
- SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- }
- /* Now do full bytes */
- while (dest_x < end_x) {
- int color = *source >> 4;
-
- SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- if (dest_x < end_x) {
- color = *source++ & 0xf;
- SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
- dest_x++;
- }
- }
- dest_y++;
- line += raster;
- }
- }
- break;
- default:
- return (-1); /* panic */
- }
+ switch (dev->color_info.depth) {
+ case 8:
+ {
+ int xi, yi;
+ int skip = raster - w;
+ const byte *sptr = base + sourcex;
+
+ if (w <= 0)
+ return 0;
+ if (x < 0 || x + w > dev->width)
+ return_error(gs_error_rangecheck);
+ for (yi = y; yi - y < h; yi++) {
+ for (xi = x; xi - x < w; xi++) {
+ int color = *sptr++;
+
+ SetPixel(wdev->hdcmf, xi, yi, PALETTEINDEX(color));
+ }
+ sptr += skip;
+ }
+ }
+ break;
+ case 4:
+ { /* color device, four bits per pixel */
+ const byte *line = base + (sourcex >> 1);
+ int dest_y = y, end_x = x + w;
+
+ if (w <= 0)
+ return 0;
+ while (h--) { /* for each line */
+ const byte *source = line;
+ register int dest_x = x;
+
+ if (sourcex & 1) { /* odd nibble first */
+ int color = *source++ & 0xf;
+
+ SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ }
+ /* Now do full bytes */
+ while (dest_x < end_x) {
+ int color = *source >> 4;
+
+ SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ if (dest_x < end_x) {
+ color = *source++ & 0xf;
+ SetPixel(wdev->hdcmf, dest_x, dest_y, PALETTEINDEX(color));
+ dest_x++;
+ }
+ }
+ dest_y++;
+ line += raster;
+ }
+ }
+ break;
+ default:
+ return (-1); /* panic */
+ }
} else
- /* monochrome device: one bit per pixel */
+ /* monochrome device: one bit per pixel */
{ /* bitmap is the same as win_copy_mono: one bit per pixel */
- win_prn_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
- (gx_color_index) 0,
- (gx_color_index) (dev->color_info.depth == 8 ? 63 : dev->color_info.max_gray));
+ win_prn_copy_mono(dev, base, sourcex, raster, id, x, y, w, h,
+ (gx_color_index) 0,
+ (gx_color_index) (dev->color_info.depth == 8 ? 63 : dev->color_info.max_gray));
}
return 0;
}
-
/* ------ Internal routines ------ */
#undef wdev
-
static void near
win_prn_addtool(gx_device_win_prn * wdev, int i)
{
@@ -639,7 +630,6 @@ win_prn_addtool(gx_device_win_prn * wdev, int i)
wdev->hbrushs[i] = CreateSolidBrush(PALETTEINDEX(i));
}
-
static void near
win_prn_maketools(gx_device_win_prn * wdev, HDC hdc)
{
@@ -647,36 +637,35 @@ win_prn_maketools(gx_device_win_prn * wdev, HDC hdc)
wdev->hpensize = (1 << (wdev->color_info.depth)) * sizeof(HPEN);
wdev->hpens = (HPEN *) gs_malloc(wdev->memory, 1, wdev->hpensize,
- "win_prn_maketools(pens)");
+ "win_prn_maketools(pens)");
wdev->hbrushsize = (1 << (wdev->color_info.depth)) * sizeof(HBRUSH);
wdev->hbrushs = (HBRUSH *) gs_malloc(wdev->memory, 1, wdev->hbrushsize,
- "win_prn_maketools(brushes)");
+ "win_prn_maketools(brushes)");
if (wdev->hpens && wdev->hbrushs) {
- for (i = 0; i < wdev->nColors; i++)
- win_prn_addtool(wdev, i);
+ for (i = 0; i < wdev->nColors; i++)
+ win_prn_addtool(wdev, i);
- wdev->hpen = wdev->hpens[0];
- SelectObject(hdc, wdev->hpen);
+ wdev->hpen = wdev->hpens[0];
+ SelectObject(hdc, wdev->hpen);
- wdev->hbrush = wdev->hbrushs[0];
- SelectObject(hdc, wdev->hbrush);
+ wdev->hbrush = wdev->hbrushs[0];
+ SelectObject(hdc, wdev->hbrush);
}
}
-
static void near
win_prn_destroytools(gx_device_win_prn * wdev)
{
int i;
for (i = 0; i < wdev->nColors; i++) {
- DeleteObject(wdev->hpens[i]);
- DeleteObject(wdev->hbrushs[i]);
+ DeleteObject(wdev->hpens[i]);
+ DeleteObject(wdev->hbrushs[i]);
}
gs_free(wdev->memory, (char *)wdev->hbrushs, 1, wdev->hbrushsize,
- "win_prn_destroytools(brushes)");
+ "win_prn_destroytools(brushes)");
gs_free(wdev->memory, (char *)wdev->hpens, 1, wdev->hpensize,
- "win_prn_destroytools(pens)");
+ "win_prn_destroytools(pens)");
}
BOOL CALLBACK _export
@@ -684,7 +673,6 @@ AbortProc(HDC hdcPrn, int code)
{
process_interrupts(NULL);
if (code == SP_OUTOFDISK)
- return (FALSE); /* cancel job */
+ return (FALSE); /* cancel job */
return (TRUE);
}
-
diff --git a/gs/base/gdevwts.c b/gs/base/gdevwts.c
index 9104d75c5..e048bfd22 100644
--- a/gs/base/gdevwts.c
+++ b/gs/base/gdevwts.c
@@ -2,11 +2,11 @@
This software is provided AS-IS with no warranty, either express or
implied.
-
+
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
-
+
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -43,7 +43,6 @@
typedef void* gcmmhprofile_t;
#endif
-
/* Memory arg is included in ghostpcl branch but not main branch. */
#define GS_NOTE_ERROR(m, e) gs_note_error(e)
@@ -79,10 +78,10 @@ static const gx_device_procs wtscmyk_procs = {
const gx_device_wts gs_wtscmyk_device = {
prn_device_body(gx_device_wts, wtscmyk_procs, "wtscmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* Margins */
- 4, 32, 255, 255, 256, 256, wtscmyk_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* Margins */
+ 4, 32, 255, 255, 256, 256, wtscmyk_print_page)
};
/* RGB with imdi conversion to CMYK and wts halftoning */
@@ -145,35 +144,35 @@ static const gx_device_procs wtsimdi_procs =
const gx_device_wtsimdi gs_wtsimdi_device = {
prn_device_body(gx_device_wtsimdi, wtsimdi_procs, "wtsimdi",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* Margins */
- 3, 24, 255, 255, 256, 256, wtsimdi_print_page)
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* Margins */
+ 3, 24, 255, 255, 256, 256, wtsimdi_print_page)
};
#if DUMMY_WTS_HALFTONE_LINE
static void
wts_halftone_line(void **wts, int y, int width, int n_planes,
- long band_offset_x, long band_offset_y,
- byte **dst, const byte *src)
+ long band_offset_x, long band_offset_y,
+ byte **dst, const byte *src)
{
int x;
int plane_ix;
for (plane_ix = 0; plane_ix < n_planes; plane_ix++) {
- byte *dline = dst[plane_ix];
- for (x = 0; x < width; x += 8) {
- byte b = 0;
- if (src[(x + 0) * n_planes + plane_ix] > 0x20) b |= 0x80;
- if (src[(x + 1) * n_planes + plane_ix] > 0x40) b |= 0x40;
- if (src[(x + 2) * n_planes + plane_ix] > 0x60) b |= 0x20;
- if (src[(x + 3) * n_planes + plane_ix] > 0x80) b |= 0x10;
- if (src[(x + 4) * n_planes + plane_ix] > 0xa0) b |= 0x08;
- if (src[(x + 5) * n_planes + plane_ix] > 0xc0) b |= 0x04;
- if (src[(x + 6) * n_planes + plane_ix] > 0xe0) b |= 0x02;
- if (src[(x + 7) * n_planes + plane_ix] > 0xfe) b |= 0x01;
- dline[x >> 3] = b;
- }
+ byte *dline = dst[plane_ix];
+ for (x = 0; x < width; x += 8) {
+ byte b = 0;
+ if (src[(x + 0) * n_planes + plane_ix] > 0x20) b |= 0x80;
+ if (src[(x + 1) * n_planes + plane_ix] > 0x40) b |= 0x40;
+ if (src[(x + 2) * n_planes + plane_ix] > 0x60) b |= 0x20;
+ if (src[(x + 3) * n_planes + plane_ix] > 0x80) b |= 0x10;
+ if (src[(x + 4) * n_planes + plane_ix] > 0xa0) b |= 0x08;
+ if (src[(x + 5) * n_planes + plane_ix] > 0xc0) b |= 0x04;
+ if (src[(x + 6) * n_planes + plane_ix] > 0xe0) b |= 0x02;
+ if (src[(x + 7) * n_planes + plane_ix] > 0xfe) b |= 0x01;
+ dline[x >> 3] = b;
+ }
}
}
#endif
@@ -182,72 +181,72 @@ wts_halftone_line(void **wts, int y, int width, int n_planes,
/* RJW: Not used currently */
static void
wts_halftone_line_16(wts_cooked_halftone *wch, int y, int width, int n_planes,
- long band_offset_x, long band_offset_y,
- byte **dst, const byte *src)
+ long band_offset_x, long band_offset_y,
+ byte **dst, const byte *src)
{
int x;
int plane_ix;
wts_screen_sample_t *samples;
for (plane_ix = 0; plane_ix < n_planes; plane_ix++) {
- wts_screen_t *w = wch[plane_ix].wts;
- byte *dline = dst[plane_ix];
- int imax;
-
- for (x = 0; x < width;) {
- int i;
- int n_samples;
- int cx, cy;
-
- wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples);
- samples = w->samples + cy * w->cell_width + cx;
-
- imax = min(width - x, n_samples);
- for (i = 0; i < imax; i += 8) {
- byte b = 0;
- int src_ix = x * 4 + plane_ix;
+ wts_screen_t *w = wch[plane_ix].wts;
+ byte *dline = dst[plane_ix];
+ int imax;
+
+ for (x = 0; x < width;) {
+ int i;
+ int n_samples;
+ int cx, cy;
+
+ wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples);
+ samples = w->samples + cy * w->cell_width + cx;
+
+ imax = min(width - x, n_samples);
+ for (i = 0; i < imax; i += 8) {
+ byte b = 0;
+ int src_ix = x * 4 + plane_ix;
#if 0
- if (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) b |= 0x80;
- if (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) b |= 0x40;
- if (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) b |= 0x20;
- if (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) b |= 0x10;
- if (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) b |= 0x08;
- if (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) b |= 0x04;
- if (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) b |= 0x02;
- if (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) b |= 0x01;
+ if (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) b |= 0x80;
+ if (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) b |= 0x40;
+ if (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) b |= 0x20;
+ if (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) b |= 0x10;
+ if (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) b |= 0x08;
+ if (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) b |= 0x04;
+ if (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) b |= 0x02;
+ if (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) b |= 0x01;
#else
#if 0
- b |= (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) << 7;
- b |= (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) << 6;
- b |= (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) << 5;
- b |= (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) << 4;
- b |= (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) << 3;
- b |= (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) << 2;
- b |= (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) << 1;
- b |= (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) << 0;
+ b |= (src[src_ix + 0 * 4] > (samples[i + 0] >> 7)) << 7;
+ b |= (src[src_ix + 1 * 4] > (samples[i + 1] >> 7)) << 6;
+ b |= (src[src_ix + 2 * 4] > (samples[i + 2] >> 7)) << 5;
+ b |= (src[src_ix + 3 * 4] > (samples[i + 3] >> 7)) << 4;
+ b |= (src[src_ix + 4 * 4] > (samples[i + 4] >> 7)) << 3;
+ b |= (src[src_ix + 5 * 4] > (samples[i + 5] >> 7)) << 2;
+ b |= (src[src_ix + 6 * 4] > (samples[i + 6] >> 7)) << 1;
+ b |= (src[src_ix + 7 * 4] > (samples[i + 7] >> 7)) << 0;
#else
- b = (((unsigned int)(((int)(samples[i + 0] >> 7)) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80;
- b |= (((unsigned int)(((int)(samples[i + 1] >> 7)) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40;
- b |= (((unsigned int)(((int)(samples[i + 2] >> 7)) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20;
- b |= (((unsigned int)(((int)(samples[i + 3] >> 7)) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10;
- b |= (((unsigned int)(((int)(samples[i + 4] >> 7)) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08;
- b |= (((unsigned int)(((int)(samples[i + 5] >> 7)) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04;
- b |= (((unsigned int)(((int)(samples[i + 6] >> 7)) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02;
- b |= (((unsigned int)(((int)(samples[i + 7] >> 7)) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01;
+ b = (((unsigned int)(((int)(samples[i + 0] >> 7)) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80;
+ b |= (((unsigned int)(((int)(samples[i + 1] >> 7)) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40;
+ b |= (((unsigned int)(((int)(samples[i + 2] >> 7)) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20;
+ b |= (((unsigned int)(((int)(samples[i + 3] >> 7)) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10;
+ b |= (((unsigned int)(((int)(samples[i + 4] >> 7)) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08;
+ b |= (((unsigned int)(((int)(samples[i + 5] >> 7)) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04;
+ b |= (((unsigned int)(((int)(samples[i + 6] >> 7)) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02;
+ b |= (((unsigned int)(((int)(samples[i + 7] >> 7)) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01;
#endif
#endif
- dline[x >> 3] = b;
- x += 8;
- }
- }
+ dline[x >> 3] = b;
+ x += 8;
+ }
+ }
}
}
#endif
static void
wts_halftone_line_8(wts_cooked_halftone *wch, int y, int width, int n_planes,
- long band_offset_x, long band_offset_y,
- byte * dst, const byte * src)
+ long band_offset_x, long band_offset_y,
+ byte * dst, const byte * src)
{
int x;
int plane_ix;
@@ -255,36 +254,36 @@ wts_halftone_line_8(wts_cooked_halftone *wch, int y, int width, int n_planes,
int halftoned_bytes = (width + 7) >> 3;
for (plane_ix = 0; plane_ix < n_planes; plane_ix++) {
- wts_screen_t *w = wch[plane_ix].wts;
- int width_padded = wch[plane_ix].width_padded;
- byte * dline = dst + plane_ix * halftoned_bytes;
- /*byte * dline = dst[plane_ix];*/
- int imax;
-
- for (x = 0; x < width;) {
- int i;
- int n_samples;
- int cx, cy;
-
- wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples);
- samples = wch[plane_ix].cell + cy * width_padded + cx;
-
- imax = min(width - x, n_samples);
- for (i = 0; i < imax; i += 8) {
- byte b = 0;
- int src_ix = x * 4 + plane_ix;
- b = (((unsigned int)(((int)(samples[i + 0])) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80;
- b |= (((unsigned int)(((int)(samples[i + 1])) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40;
- b |= (((unsigned int)(((int)(samples[i + 2])) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20;
- b |= (((unsigned int)(((int)(samples[i + 3])) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10;
- b |= (((unsigned int)(((int)(samples[i + 4])) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08;
- b |= (((unsigned int)(((int)(samples[i + 5])) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04;
- b |= (((unsigned int)(((int)(samples[i + 6])) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02;
- b |= (((unsigned int)(((int)(samples[i + 7])) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01;
- *dline++ = b;
- x += 8;
- }
- }
+ wts_screen_t *w = wch[plane_ix].wts;
+ int width_padded = wch[plane_ix].width_padded;
+ byte * dline = dst + plane_ix * halftoned_bytes;
+ /*byte * dline = dst[plane_ix];*/
+ int imax;
+
+ for (x = 0; x < width;) {
+ int i;
+ int n_samples;
+ int cx, cy;
+
+ wts_get_samples(w, band_offset_x + x, band_offset_y + y, &cx, &cy, &n_samples);
+ samples = wch[plane_ix].cell + cy * width_padded + cx;
+
+ imax = min(width - x, n_samples);
+ for (i = 0; i < imax; i += 8) {
+ byte b = 0;
+ int src_ix = x * 4 + plane_ix;
+ b = (((unsigned int)(((int)(samples[i + 0])) - ((int)src[src_ix + 0 * 4]))) >> 24) & 0x80;
+ b |= (((unsigned int)(((int)(samples[i + 1])) - ((int)src[src_ix + 1 * 4]))) >> 24) & 0x40;
+ b |= (((unsigned int)(((int)(samples[i + 2])) - ((int)src[src_ix + 2 * 4]))) >> 24) & 0x20;
+ b |= (((unsigned int)(((int)(samples[i + 3])) - ((int)src[src_ix + 3 * 4]))) >> 24) & 0x10;
+ b |= (((unsigned int)(((int)(samples[i + 4])) - ((int)src[src_ix + 4 * 4]))) >> 24) & 0x08;
+ b |= (((unsigned int)(((int)(samples[i + 5])) - ((int)src[src_ix + 5 * 4]))) >> 24) & 0x04;
+ b |= (((unsigned int)(((int)(samples[i + 6])) - ((int)src[src_ix + 6 * 4]))) >> 24) & 0x02;
+ b |= (((unsigned int)(((int)(samples[i + 7])) - ((int)src[src_ix + 7 * 4]))) >> 24) & 0x01;
+ *dline++ = b;
+ x += 8;
+ }
+ }
}
}
@@ -305,7 +304,7 @@ wts_load_halftone(gs_memory_t *mem, wts_cooked_halftone *wch, const char *fn)
fseek(f, 0, 0);
buf = gs_malloc(mem, size, 1, "wts_load_halftone");
if (buf == 0) {
- return gs_error_VMerror;
+ return gs_error_VMerror;
}
(void)fread(buf, 1, size, f);
fclose(f);
@@ -315,20 +314,20 @@ wts_load_halftone(gs_memory_t *mem, wts_cooked_halftone *wch, const char *fn)
width_padded = wts->cell_width + 7;
wch->width_padded = width_padded;
cooked_cell = gs_malloc(mem, width_padded * wts->cell_height, 1,
- "wts_load_halftone");
+ "wts_load_halftone");
if (cooked_cell == 0) {
- return gs_error_VMerror;
+ return gs_error_VMerror;
}
wch->cell = cooked_cell;
for (y = 0; y < wts->cell_height; y++) {
- wts_screen_sample_t *line = &wts->samples[y * wts->cell_width];
- byte *dstline = cooked_cell + y * width_padded;
- int x;
- for (x = 0; x < width_padded; x++) {
- wts_screen_sample_t sample = line[x % wts->cell_width];
- dstline[x] = (254 * (int)sample + 0x7fc0) / 0x8ff0;
- }
+ wts_screen_sample_t *line = &wts->samples[y * wts->cell_width];
+ byte *dstline = cooked_cell + y * width_padded;
+ int x;
+ for (x = 0; x < width_padded; x++) {
+ wts_screen_sample_t sample = line[x % wts->cell_width];
+ dstline[x] = (254 * (int)sample + 0x7fc0) / 0x8ff0;
+ }
}
#if 0
@@ -348,22 +347,22 @@ wts_init_halftones(gx_device_wts *wdev, int n_planes)
int code;
for (i = 0; i < n_planes; i++) {
- if (wdev->wcooked[i].wts == 0) {
- char wts_fn[256];
+ if (wdev->wcooked[i].wts == 0) {
+ char wts_fn[256];
- sprintf(wts_fn, "wts_plane_%d", i);
+ sprintf(wts_fn, "wts_plane_%d", i);
{
FILE *f;
if ((f=fopen(wts_fn,"r"))) {
fclose(f);
} else {
- sprintf(wts_fn, "/usr/local/lib/ghostscript/wts_plane_%d", i);
+ sprintf(wts_fn, "/usr/local/lib/ghostscript/wts_plane_%d", i);
}
}
- code = wts_load_halftone(wdev->memory, &wdev->wcooked[i], wts_fn);
- if (code < 0)
- return gs_throw1(code, "could not open file '%s'", wts_fn);
- }
+ code = wts_load_halftone(wdev->memory, &wdev->wcooked[i], wts_fn);
+ if (code < 0)
+ return gs_throw1(code, "could not open file '%s'", wts_fn);
+ }
}
return 0;
}
@@ -390,34 +389,34 @@ wtscmyk_print_page(gx_device_printer *pdev, FILE *prn_stream)
cmyk_line = (byte *)gs_malloc(pdev->memory, cmyk_bytes, 1, "wtscmyk_print_page(in)");
if (cmyk_line == 0) {
- code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
- goto out;
+ code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
+ goto out;
}
pbm_bytes = (pdev->width + 7) >> 3;
dst = gs_malloc(pdev->memory, pbm_bytes * n_planes, 1,
- "wtscmyk_print_page");
+ "wtscmyk_print_page");
if (dst == 0) {
- code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
- goto out;
+ code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
+ goto out;
}
/* Create additional output streams. */
for (i = 0; i < n_planes; i++) {
- if (i == 0) {
- ostream[i] = prn_stream;
- } else {
- char fn[256];
- char plane_name[4] = "cmyk";
- int fname_len = strlen(pdev->fname);
-
- if (fname_len >= 5 && fname_len < 256) {
- strcpy(fn, pdev->fname);
- if (!strcmp(fn + fname_len - 5, "c.pbm"))
- fn[fname_len - 5] = plane_name[i];
- }
- ostream[i] = fopen(fn, "wb");
- }
- fprintf(ostream[i], "P4\n%d %d\n", pdev->width, pdev->height);
+ if (i == 0) {
+ ostream[i] = prn_stream;
+ } else {
+ char fn[256];
+ char plane_name[4] = "cmyk";
+ int fname_len = strlen(pdev->fname);
+
+ if (fname_len >= 5 && fname_len < 256) {
+ strcpy(fn, pdev->fname);
+ if (!strcmp(fn + fname_len - 5, "c.pbm"))
+ fn[fname_len - 5] = plane_name[i];
+ }
+ ostream[i] = fopen(fn, "wb");
+ }
+ fprintf(ostream[i], "P4\n%d %d\n", pdev->width, pdev->height);
}
#if 0
dprintf2(OPTIONAL_MEM(pdev->memory) "Output file name: %s %d\n", pdev->fname, sizeof(dst));
@@ -425,23 +424,23 @@ wtscmyk_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* For each raster line */
for (y = 0; y < pdev->height; y++) {
- code = gdev_prn_get_bits(pdev, y, cmyk_line, &data);
- if (code < 0)
- break; /* return the code below after cleanup */
- wts_halftone_line_8(wdev->wcooked, y, pdev->width, n_planes,
- wdev->band_offset_x, wdev->band_offset_y, dst, data);
- for (i = 0; i < n_planes; i++)
- if (ostream[i])
- fwrite(dst + i * pbm_bytes, 1, pbm_bytes, ostream[i]);
+ code = gdev_prn_get_bits(pdev, y, cmyk_line, &data);
+ if (code < 0)
+ break; /* return the code below after cleanup */
+ wts_halftone_line_8(wdev->wcooked, y, pdev->width, n_planes,
+ wdev->band_offset_x, wdev->band_offset_y, dst, data);
+ for (i = 0; i < n_planes; i++)
+ if (ostream[i])
+ fwrite(dst + i * pbm_bytes, 1, pbm_bytes, ostream[i]);
}
out:
/* Clean up... */
gs_free(pdev->memory, cmyk_line, cmyk_bytes, 1, "wtscmyk_print_page(in)");
gs_free(pdev->memory, dst, pbm_bytes, 1, "wtscmyk_print_page");
for (i = 1; i < n_planes; i++) {
- /* Don't close ostream[0], because gdev_prn_close will. */
- if (ostream[i])
- fclose(ostream[i]);
+ /* Don't close ostream[0], because gdev_prn_close will. */
+ if (ostream[i])
+ fclose(ostream[i]);
}
return code;
}
@@ -460,18 +459,18 @@ wtsimdi_open_device(gx_device *dev)
gsicc_device_cm_t *postrender_cm;
/*
- * We replace create_buf_device so we can replace copy_alpha
+ * We replace create_buf_device so we can replace copy_alpha
* for memory device, but not clist.
*/
- idev->printer_procs.buf_procs.create_buf_device =
- wtsimdi_create_buf_device;
+ idev->printer_procs.buf_procs.create_buf_device =
+ wtsimdi_create_buf_device;
- idev->postrender_cm =
+ idev->postrender_cm =
(gsicc_device_cm_t*) gs_malloc(dev->memory->non_gc_memory,
1, sizeof(gsicc_device_cm_t),
"wtsimdi_open_device");
- idev->icc_link =
+ idev->icc_link =
(gsicc_link_t*) gs_malloc(dev->memory->non_gc_memory,
1, sizeof(gsicc_link_t),
"wtsimdi_open_device");
@@ -489,16 +488,16 @@ wtsimdi_open_device(gx_device *dev)
if (postrender_cm->rgb_profile == NULL)
return gs_throw(-1, "Could not create RGB input profile for WTS device");
- postrender_cm->cmyk_profile = gsicc_get_profile_handle_file(DEFAULT_CMYK_ICC,
+ postrender_cm->cmyk_profile = gsicc_get_profile_handle_file(DEFAULT_CMYK_ICC,
strlen(DEFAULT_CMYK_ICC)+1, postrender_cm->memory);
if (postrender_cm->cmyk_profile == NULL)
return gs_throw(-1, "Could not create CMYK output profile for WTS device");
if (postrender_cm->rgb_profile->num_comps != 3)
- return gs_throw1(-1, "WTS input profile must have 3 input channels. got %d.",
+ return gs_throw1(-1, "WTS input profile must have 3 input channels. got %d.",
postrender_cm->rgb_profile->num_comps);
if (postrender_cm->cmyk_profile->num_comps != 4)
- return gs_throw1(-1, "WTS output profile must have 4 output channels. got %d.",
+ return gs_throw1(-1, "WTS output profile must have 4 output channels. got %d.",
postrender_cm->cmyk_profile->num_comps);
/* Set up the rendering parameters */
@@ -506,7 +505,7 @@ wtsimdi_open_device(gx_device *dev)
rendering_params.object_type = GS_DEVICE_DOESNT_SUPPORT_TAGS; /* Already rendered */
rendering_params.rendering_intent = gsRELATIVECOLORIMETRIC;
- idev->icc_link->link_handle = gscms_get_link(postrender_cm->rgb_profile->profile_handle,
+ idev->icc_link->link_handle = gscms_get_link(postrender_cm->rgb_profile->profile_handle,
postrender_cm->cmyk_profile->profile_handle, &rendering_params);
idev->icc_link->is_identity = 0;
idev->icc_link->contextptr = NULL;
@@ -514,17 +513,17 @@ wtsimdi_open_device(gx_device *dev)
idev->icc_link->includes_softproof = false;
if (idev->icc_link->link_handle == NULL)
- return gs_throw(-1, "Could not create ICC link for WTS device");
+ return gs_throw(-1, "Could not create ICC link for WTS device");
/* Not sure this is the best way to do this with most CMMs. Since CMM has a cache usually */
/* Allocate at least 1 for sytems that return NULL if requested count is 0 */
idev->color_cache = (cached_color *)gs_malloc(idev->memory, max(COLOR_CACHE_SIZE, 1),
- sizeof(cached_color), "wtsimdi_open_device(color_cache)");
+ sizeof(cached_color), "wtsimdi_open_device(color_cache)");
if (idev->color_cache == NULL) {
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
}
for (i=0; i<COLOR_CACHE_SIZE; i++) /* clear cache to empty */
- idev->color_cache[i].color_index = gx_no_color_index;
+ idev->color_cache[i].color_index = gx_no_color_index;
idev->current_color.color_index = gx_no_color_index;
/* guarantee the device bands */
@@ -548,12 +547,12 @@ wtsimdi_close_device(gx_device *dev)
rc_decrement(postrender_cm->rgb_profile, "wtsimdi_close_device");
rc_decrement(postrender_cm->cmyk_profile, "wtsimdi_close_device");
- gs_free(postrender_cm->memory, postrender_cm, 1, sizeof(gsicc_device_cm_t),
+ gs_free(postrender_cm->memory, postrender_cm, 1, sizeof(gsicc_device_cm_t),
"wtsimidi_close");
- gs_free(dev->memory->non_gc_memory, idev->icc_link, 1, sizeof(gsicc_link_t),
+ gs_free(dev->memory->non_gc_memory, idev->icc_link, 1, sizeof(gsicc_link_t),
"wtsimidi_close");
- gs_free(dev->memory, idev->color_cache, COLOR_CACHE_SIZE,
- sizeof(cached_color), "wtsimdi_close_device(color_cache)");
+ gs_free(dev->memory, idev->color_cache, COLOR_CACHE_SIZE,
+ sizeof(cached_color), "wtsimdi_close_device(color_cache)");
return gdev_prn_close(dev);
}
@@ -562,36 +561,36 @@ static int
wtsimdi_resolve_one(gx_device_wtsimdi *idev, gx_color_index color)
{
if (color != idev->current_color.color_index) { /* quick out for same color */
- int hash = COLOR_TO_CACHE_INDEX(color); /* 24 bits down to cache index */
+ int hash = COLOR_TO_CACHE_INDEX(color); /* 24 bits down to cache index */
- if (idev->color_cache[hash].color_index == color) {
- /* cache hit */
+ if (idev->color_cache[hash].color_index == color) {
+ /* cache hit */
#ifdef DEBUG
- idev->color_cache_hit++;
+ idev->color_cache_hit++;
#endif
- idev->current_color = idev->color_cache[hash];
- } else {
+ idev->current_color = idev->color_cache[hash];
+ } else {
- /* cache collision or empty, fill it */
+ /* cache collision or empty, fill it */
#ifdef DEBUG
- if (idev->color_cache[hash].color_index == gx_no_color_index)
- idev->cache_fill_empty++;
- else
- idev->color_cache_collision++;
+ if (idev->color_cache[hash].color_index == gx_no_color_index)
+ idev->cache_fill_empty++;
+ else
+ idev->color_cache_collision++;
#endif
/* Transform the color */
gscms_transform_color(idev->icc_link, &color,
&(idev->current_color.cmyk), 1, NULL);
- idev->color_cache[hash] = idev->current_color;
+ idev->color_cache[hash] = idev->current_color;
- }
+ }
}
#ifdef DEBUG
else
- idev->color_is_current++;
+ idev->color_is_current++;
#endif
return 0;
}
@@ -599,12 +598,12 @@ wtsimdi_resolve_one(gx_device_wtsimdi *idev, gx_color_index color)
/* Fill a rectangle with a color. */
static int
wtsimdi_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index color)
+ int x, int y, int w, int h, gx_color_index color)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
gx_device_wtsimdi * idev = (gx_device_wtsimdi *)
- ((mdev->target) ? (gx_device_wts *)(mdev->target)
- : (gx_device_wts *)dev);
+ ((mdev->target) ? (gx_device_wts *)(mdev->target)
+ : (gx_device_wts *)dev);
wts_cooked_halftone * wch = idev->wcooked;
int code, comp_value;
int halftoned_bytes = (idev-> width + 7) >> 3;
@@ -627,68 +626,68 @@ wtsimdi_fill_rectangle(gx_device * dev,
* time, we keep a couple of values cached in the wtsimdi device.
*/
if ((code = wtsimdi_resolve_one(idev, color)) < 0)
- return code;
+ return code;
for (; h--; y++) {
base = scan_line_base(mdev, y);
for (plane_ix = 0; plane_ix < 4; plane_ix++) {
- int nfill = (end_x >> 3) - first_byte;
-
- width_padded = wch[plane_ix].width_padded;
- dst = base + first_byte + plane_ix * halftoned_bytes;
- comp_value = idev->current_color.cmyk[plane_ix];
- if (comp_value == 0) {
- if (nfill == 0) {
- dst[0] &= (0xff << (8 - (x & 7))) |
- ((1 << (7 - (end_x & 7))) - 1);
- } else {
- dst[0] &= (0xff << (8 - (x & 7)));
+ int nfill = (end_x >> 3) - first_byte;
+
+ width_padded = wch[plane_ix].width_padded;
+ dst = base + first_byte + plane_ix * halftoned_bytes;
+ comp_value = idev->current_color.cmyk[plane_ix];
+ if (comp_value == 0) {
+ if (nfill == 0) {
+ dst[0] &= (0xff << (8 - (x & 7))) |
+ ((1 << (7 - (end_x & 7))) - 1);
+ } else {
+ dst[0] &= (0xff << (8 - (x & 7)));
memset(&dst[1], 0, nfill-1);
- dst[nfill] &= ((1 << (7 - (end_x & 7))) - 1);
- }
- } else if (comp_value == 0xff) {
- if (nfill == 0) {
- dst[0] |= ~((0xff << (8 - (x & 7))) |
- ((1 << (7 - (end_x & 7))) - 1));
- } else {
- dst[0] |= ~(0xff << (8 - (x & 7)));
+ dst[nfill] &= ((1 << (7 - (end_x & 7))) - 1);
+ }
+ } else if (comp_value == 0xff) {
+ if (nfill == 0) {
+ dst[0] |= ~((0xff << (8 - (x & 7))) |
+ ((1 << (7 - (end_x & 7))) - 1));
+ } else {
+ dst[0] |= ~(0xff << (8 - (x & 7)));
memset(&dst[1], 0xff, nfill-1);
- dst[nfill] |= ~((1 << (7 - (end_x & 7))) - 1);
- }
- } else {
- byte save_left = dst[0];
- byte save_right = dst[nfill];
- int i;
-
- for (i = 0; i < nfill + 1;) {
- int n_samples;
- int cx, cy;
- int j;
-
- wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3),
- (dev->band_offset_y + y), &cx, &cy, &n_samples);
- samples = wch[plane_ix].cell + cy * width_padded + cx;
-
- imax = min((nfill + 1 - i) << 3, n_samples);
- for (j = 0; j < imax; j += 8) {
- int b;
- b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80;
- b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40;
- b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20;
- b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10;
- b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08;
- b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04;
- b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02;
- b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01;
- dst[i + (j >> 3)] = b;
- }
- dst[0] = (save_left & (0xff << (8 - (x & 7)))) |
- (dst[0] & ~(0xff << (8 - (x & 7))));
- dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) |
- (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1));
- i += (j >> 3);
- }
- }
+ dst[nfill] |= ~((1 << (7 - (end_x & 7))) - 1);
+ }
+ } else {
+ byte save_left = dst[0];
+ byte save_right = dst[nfill];
+ int i;
+
+ for (i = 0; i < nfill + 1;) {
+ int n_samples;
+ int cx, cy;
+ int j;
+
+ wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3),
+ (dev->band_offset_y + y), &cx, &cy, &n_samples);
+ samples = wch[plane_ix].cell + cy * width_padded + cx;
+
+ imax = min((nfill + 1 - i) << 3, n_samples);
+ for (j = 0; j < imax; j += 8) {
+ int b;
+ b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80;
+ b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40;
+ b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20;
+ b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10;
+ b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08;
+ b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04;
+ b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02;
+ b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01;
+ dst[i + (j >> 3)] = b;
+ }
+ dst[0] = (save_left & (0xff << (8 - (x & 7)))) |
+ (dst[0] & ~(0xff << (8 - (x & 7))));
+ dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) |
+ (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1));
+ i += (j >> 3);
+ }
+ }
}
}
return 0;
@@ -696,13 +695,13 @@ wtsimdi_fill_rectangle(gx_device * dev,
static int
wtsimdi_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * data, int sourcex, int sraster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
gx_device_memory * const mdev = (gx_device_memory *)dev;
gx_device_wtsimdi * idev = (gx_device_wtsimdi *)
- ((mdev->target) ? (gx_device_wts *)(mdev->target)
- : (gx_device_wts *)dev);
+ ((mdev->target) ? (gx_device_wts *)(mdev->target)
+ : (gx_device_wts *)dev);
wts_cooked_halftone * wch = idev->wcooked;
int code, comp_value;
int halftoned_bytes = (idev-> width + 7) >> 3;
@@ -715,18 +714,18 @@ wtsimdi_copy_mono(gx_device * dev,
int sshift;
if (zero != gx_no_color_index)
- return gx_default_copy_mono(dev, data, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ return gx_default_copy_mono(dev, data, sourcex, sraster, id,
+ x, y, w, h, zero, one);
if (x < 0) {
- sourcex -= x;
- w += x;
- x = 0;
+ sourcex -= x;
+ w += x;
+ x = 0;
}
src = data + ((sourcex - (x & 7)) >> 3);
if (y < 0) {
- src -= sraster * y;
- h += y;
- y = 0;
+ src -= sraster * y;
+ h += y;
+ y = 0;
}
fit_fill(dev, x, y, w, h);
@@ -740,88 +739,87 @@ wtsimdi_copy_mono(gx_device * dev,
* Check if this is a new color. To minimize color conversion
* time, we keep a couple of values cached in the wtsimdi device.
*/
-#define COPY_MONO_BLACK_IS_K
+#define COPY_MONO_BLACK_IS_K
#define COPY_MONO_OPTIMIZATION
-#ifdef COPY_MONO_BLACK_IS_K
+#ifdef COPY_MONO_BLACK_IS_K
if (one == 0) {
- /* FIXME: This should rely on tag bits, but copy_mono black is (probably) only used for text */
- idev->current_color.cmyk[0] =idev->current_color.cmyk[1] = idev->current_color.cmyk[2] = 0;
- idev->current_color.cmyk[3] = 0xff; /* 100% K channel, 0% C, M, Y */
- idev->current_color.color_index = 0;
+ /* FIXME: This should rely on tag bits, but copy_mono black is (probably) only used for text */
+ idev->current_color.cmyk[0] =idev->current_color.cmyk[1] = idev->current_color.cmyk[2] = 0;
+ idev->current_color.cmyk[3] = 0xff; /* 100% K channel, 0% C, M, Y */
+ idev->current_color.color_index = 0;
} else
#endif
if ((code = wtsimdi_resolve_one(idev, one)) < 0)
- return code;
+ return code;
sshift = 8 - ((sourcex - x) & 7);
for (; h--; y++) {
base = scan_line_base(mdev, y);
for (plane_ix = 0; plane_ix < 4; plane_ix++) {
- int nfill = (end_x >> 3) - first_byte;
- int i;
- byte smask, save_left, save_right;
-
- width_padded = wch[plane_ix].width_padded;
- dst = base + first_byte + plane_ix * halftoned_bytes;
- save_left = dst[0];
- save_right = dst[nfill];
- comp_value = idev->current_color.cmyk[plane_ix];
+ int nfill = (end_x >> 3) - first_byte;
+ int i;
+ byte smask, save_left, save_right;
+
+ width_padded = wch[plane_ix].width_padded;
+ dst = base + first_byte + plane_ix * halftoned_bytes;
+ save_left = dst[0];
+ save_right = dst[nfill];
+ comp_value = idev->current_color.cmyk[plane_ix];
#ifdef COPY_MONO_OPTIMIZATION
- if (comp_value == 0) {
- for (i = 0; i < nfill + 1; i++) {
- if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0)
- dst[i] = dst[i] & ~smask;
- }
- } else if (comp_value == 0xff) {
- for (i = 0; i < nfill + 1; i++) {
- if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0)
- dst[i] = smask | (dst[i] & ~smask) ;
- }
- } else
+ if (comp_value == 0) {
+ for (i = 0; i < nfill + 1; i++) {
+ if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0)
+ dst[i] = dst[i] & ~smask;
+ }
+ } else if (comp_value == 0xff) {
+ for (i = 0; i < nfill + 1; i++) {
+ if ((smask = (src[i] << 8 | src[i + 1]) >> sshift) != 0)
+ dst[i] = smask | (dst[i] & ~smask) ;
+ }
+ } else
#endif
- {
- for (i = 0; i < nfill + 1;) {
- int n_samples;
- int cx, cy;
- int j;
-
- wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3),
- (dev->band_offset_y + y), &cx, &cy, &n_samples);
- samples = wch[plane_ix].cell + cy * width_padded + cx;
-
- imax = min((nfill + 1 - i) << 3, n_samples);
- for (j = 0; j < imax; j += 8) {
- smask = (src[i] << 8 | src[i + 1]) >> sshift;
- if (smask) {
- byte b;
- b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80;
- b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40;
- b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20;
- b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10;
- b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08;
- b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04;
- b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02;
- b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01;
- dst[i] = (b & smask) | (dst[i] & ~smask);
- }
- i++;
- }
- }
- }
- /* Restore edge areas on left and right that may have been overwritten */
- dst[0] = (save_left & (0xff << (8 - (x & 7)))) |
- (dst[0] & ~(0xff << (8 - (x & 7))));
- dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) |
- (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1));
+ {
+ for (i = 0; i < nfill + 1;) {
+ int n_samples;
+ int cx, cy;
+ int j;
+
+ wts_get_samples(wch[plane_ix].wts, ((dev->band_offset_x + x) & -8) + (i << 3),
+ (dev->band_offset_y + y), &cx, &cy, &n_samples);
+ samples = wch[plane_ix].cell + cy * width_padded + cx;
+
+ imax = min((nfill + 1 - i) << 3, n_samples);
+ for (j = 0; j < imax; j += 8) {
+ smask = (src[i] << 8 | src[i + 1]) >> sshift;
+ if (smask) {
+ byte b;
+ b = (((unsigned int)(((int)(samples[j + 0])) - comp_value) >> 24)) & 0x80;
+ b |= (((unsigned int)(((int)(samples[j + 1])) - comp_value) >> 24)) & 0x40;
+ b |= (((unsigned int)(((int)(samples[j + 2])) - comp_value) >> 24)) & 0x20;
+ b |= (((unsigned int)(((int)(samples[j + 3])) - comp_value) >> 24)) & 0x10;
+ b |= (((unsigned int)(((int)(samples[j + 4])) - comp_value) >> 24)) & 0x08;
+ b |= (((unsigned int)(((int)(samples[j + 5])) - comp_value) >> 24)) & 0x04;
+ b |= (((unsigned int)(((int)(samples[j + 6])) - comp_value) >> 24)) & 0x02;
+ b |= (((unsigned int)(((int)(samples[j + 7])) - comp_value) >> 24)) & 0x01;
+ dst[i] = (b & smask) | (dst[i] & ~smask);
+ }
+ i++;
+ }
+ }
+ }
+ /* Restore edge areas on left and right that may have been overwritten */
+ dst[0] = (save_left & (0xff << (8 - (x & 7)))) |
+ (dst[0] & ~(0xff << (8 - (x & 7))));
+ dst[nfill] = (save_right & ((1 << (7 - (end_x & 7))) - 1)) |
+ (dst[nfill] & ~((1 << (7 - (end_x & 7))) - 1));
}
- src += sraster;
+ src += sraster;
}
return 0;
}
-
/*
* This is a clone of gx_default_get_bits except that we are adding
* GB_HALFTONED to the parameter options. This will tell the buffer
@@ -830,9 +828,9 @@ wtsimdi_copy_mono(gx_device * dev,
int
wtsimdi_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
{ /*
- * Hand off to get_bits_rectangle, being careful to avoid a
- * possible recursion loop.
- */
+ * Hand off to get_bits_rectangle, being careful to avoid a
+ * possible recursion loop.
+ */
dev_proc_get_bits((*save_get_bits)) = dev_proc(dev, get_bits);
gs_int_rect rect;
gs_get_bits_params_t params;
@@ -841,27 +839,27 @@ wtsimdi_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
rect.p.x = 0, rect.p.y = y;
rect.q.x = dev->width, rect.q.y = y + 1;
params.options =
- (actual_data ? GB_RETURN_POINTER : 0) | GB_RETURN_COPY |
- (GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_RASTER_STANDARD |
+ (actual_data ? GB_RETURN_POINTER : 0) | GB_RETURN_COPY |
+ (GB_ALIGN_STANDARD | GB_OFFSET_0 | GB_RASTER_STANDARD |
/* No depth specified, we always use native colors. */
- GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE |
- GB_HALFTONED);
+ GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE |
+ GB_HALFTONED);
params.x_offset = 0;
params.raster = bitmap_raster(dev->width * dev->color_info.depth);
params.data[0] = data;
params.original_y = y;
set_dev_proc(dev, get_bits, gx_no_get_bits);
code = (*dev_proc(dev, get_bits_rectangle))
- (dev, &rect, &params, NULL);
+ (dev, &rect, &params, NULL);
if (actual_data)
- *actual_data = params.data[0];
+ *actual_data = params.data[0];
set_dev_proc(dev, get_bits, save_get_bits);
return code;
}
int
wtsimdi_halftoned_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
/*
* We should only get to this routine if the caller wants the halftoned
@@ -869,14 +867,13 @@ wtsimdi_halftoned_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
* wtsimdi_contone_get_bits_rectangle.
*/
if (!(params->options & GB_HALFTONED))
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
return mem_get_bits_rectangle(dev, prect, params, unread);
}
-
int
wtsimdi_contone_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
/*
* Save the options since mem_get_bits_rectangle will change them to
@@ -888,50 +885,50 @@ wtsimdi_contone_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
int code = mem_get_bits_rectangle(dev, prect, params, unread);
if (code < 0)
- return code;
+ return code;
if (options & GB_HALFTONED) {
- gx_device_memory * const mdev = (gx_device_memory *)dev;
+ gx_device_memory * const mdev = (gx_device_memory *)dev;
gx_device_wtsimdi * idev = (gx_device_wtsimdi *)
- ((mdev->target) ? (gx_device_wts *)(mdev->target)
- : (gx_device_wts *)dev);
- int width = dev->width;
- int n_planes = 4;
- int r_last = -1, g_last = -1, b_last = -1, r, g, b;
- int x;
- byte * src = params->data[0];
- /* Note that the following relies on objects being allocated to
- * at least a 4-byte boundary for efficiency on x86 and to prevent
- * alignment errors on CPU's that gripe about it. We know this is
- * true due to object headers requiring alignment. In the future
- * if we want to remove this invariant, we can use 'obj_align_mod'
- * to allocate a slightly larger buffer and offset 'cmyk_data'
- * to the proper alignment within the buffer.
- */
+ ((mdev->target) ? (gx_device_wts *)(mdev->target)
+ : (gx_device_wts *)dev);
+ int width = dev->width;
+ int n_planes = 4;
+ int r_last = -1, g_last = -1, b_last = -1, r, g, b;
+ int x;
+ byte * src = params->data[0];
+ /* Note that the following relies on objects being allocated to
+ * at least a 4-byte boundary for efficiency on x86 and to prevent
+ * alignment errors on CPU's that gripe about it. We know this is
+ * true due to object headers requiring alignment. In the future
+ * if we want to remove this invariant, we can use 'obj_align_mod'
+ * to allocate a slightly larger buffer and offset 'cmyk_data'
+ * to the proper alignment within the buffer.
+ */
uint32_t * cmyk_buffer = gs_malloc(dev->memory,
- (width + 7), sizeof(uint32_t),
- "wtsimdi_contone_get_bits(cmyk_buffer)");
- uint32_t* cmyk_data = cmyk_buffer;
+ (width + 7), sizeof(uint32_t),
+ "wtsimdi_contone_get_bits(cmyk_buffer)");
+ uint32_t* cmyk_data = cmyk_buffer;
if (cmyk_data == NULL)
- return_error(gs_error_VMerror);
-
- for (x = 0; x < width; x++) {
- r = *src++;
- g = *src++;
- b = *src++;
- if (r != r_last || g != g_last || b != b_last) {
- gx_color_index color = (((b<<8) | g) << 8) | r;
-
- r_last = r, g_last = g, b_last = b;
- wtsimdi_resolve_one(idev, color);
- }
- *cmyk_data++ = *((uint32_t *)idev->current_color.cmyk);
- }
- wts_halftone_line_8(idev->wcooked, original_y, width, n_planes,
- idev->band_offset_x, idev->band_offset_y, buffer, (const byte *)cmyk_buffer);
- params->data[0] = buffer;
- gs_free(dev->memory, cmyk_buffer, halftoned_bytes * n_planes, 1,
- "wtsimdi_print_page(halftoned_data)");
+ return_error(gs_error_VMerror);
+
+ for (x = 0; x < width; x++) {
+ r = *src++;
+ g = *src++;
+ b = *src++;
+ if (r != r_last || g != g_last || b != b_last) {
+ gx_color_index color = (((b<<8) | g) << 8) | r;
+
+ r_last = r, g_last = g, b_last = b;
+ wtsimdi_resolve_one(idev, color);
+ }
+ *cmyk_data++ = *((uint32_t *)idev->current_color.cmyk);
+ }
+ wts_halftone_line_8(idev->wcooked, original_y, width, n_planes,
+ idev->band_offset_x, idev->band_offset_y, buffer, (const byte *)cmyk_buffer);
+ params->data[0] = buffer;
+ gs_free(dev->memory, cmyk_buffer, halftoned_bytes * n_planes, 1,
+ "wtsimdi_print_page(halftoned_data)");
}
return code;
}
@@ -947,28 +944,28 @@ const bool ALWAYS_CONTONE = true;
* We need to create custom memory buffer devices. We use the default
* create_buf_device routine and then we set our custom device procedures.
*/
-static int
+static int
wtsimdi_create_buf_device(gx_device **pbdev, gx_device *target, int y,
const gx_render_plane_t *render_plane, gs_memory_t *mem,
gx_band_complexity_t *band_complexity)
{
int code = gx_default_create_buf_device(pbdev, target, y,
- render_plane, mem, band_complexity);
+ render_plane, mem, band_complexity);
/* Now set our custom device procedures. */
if ((band_complexity && band_complexity->nontrivial_rops) || ALWAYS_CONTONE) {
- set_dev_proc(*pbdev, get_bits_rectangle,
- wtsimdi_contone_get_bits_rectangle);
+ set_dev_proc(*pbdev, get_bits_rectangle,
+ wtsimdi_contone_get_bits_rectangle);
} else {
- set_dev_proc(*pbdev, get_bits_rectangle,
- wtsimdi_halftoned_get_bits_rectangle);
- set_dev_proc(*pbdev, fill_rectangle, wtsimdi_fill_rectangle);
- set_dev_proc(*pbdev, copy_mono, wtsimdi_copy_mono);
- /* All procedures which are defined as mem_true24_* need to be either
- implemented or replaced with a default implementation. The following
- three don't have significant usage in testing with Altona.
- */
- set_dev_proc(*pbdev, copy_alpha, gx_default_copy_alpha);
- set_dev_proc(*pbdev, copy_color, gx_default_copy_color);
+ set_dev_proc(*pbdev, get_bits_rectangle,
+ wtsimdi_halftoned_get_bits_rectangle);
+ set_dev_proc(*pbdev, fill_rectangle, wtsimdi_fill_rectangle);
+ set_dev_proc(*pbdev, copy_mono, wtsimdi_copy_mono);
+ /* All procedures which are defined as mem_true24_* need to be either
+ implemented or replaced with a default implementation. The following
+ three don't have significant usage in testing with Altona.
+ */
+ set_dev_proc(*pbdev, copy_alpha, gx_default_copy_alpha);
+ set_dev_proc(*pbdev, copy_color, gx_default_copy_color);
}
return code;
}
@@ -985,52 +982,52 @@ static void
write_pkmraw_row(int width, byte * data, FILE * pstream)
{
if (pstream == NULL)
- return;
+ return;
{
- int x, bit;
- int halftoned_bytes = (width + 7) >> 3;
- byte * cdata = data;
- byte * mdata = data + halftoned_bytes;
- byte * ydata = mdata + halftoned_bytes;
- byte * kdata = ydata + halftoned_bytes;
- byte c = *cdata++;
- byte m = *mdata++;
- byte y = *ydata++;
- byte k = *kdata++;
-
- /*
- * Contrary to what the documentation implies, gcc compiles putc
- * as a procedure call. This is ridiculous, but since we can't
- * change it, we buffer groups of pixels ourselves and use fwrite.
- */
- for (bit = 7, x = 0; x < width;) {
- byte raw[80 * 3]; /* 80 is arbitrary, must be a multiple of 8 */
- int end = min(x + sizeof(raw) / 3, width);
- byte *outp = raw;
-
- for (; x < end; x++) {
-
- if ((k >> bit) & 1) {
- *outp++ = 0; /* Set output color = black */
- *outp++ = 0;
- *outp++ = 0;
- } else {
- *outp++ = 255 & (255 + ((c >> bit) & 1));
- *outp++ = 255 & (255 + ((m >> bit) & 1));
- *outp++ = 255 & (255 + ((y >> bit) & 1));
- }
- if (bit == 0) {
- c = *cdata++;
- m = *mdata++;
- y = *ydata++;
- k = *kdata++;
- bit = 7;
- } else
- bit--;
- }
- fwrite(raw, 1, outp - raw, pstream);
- }
- return;
+ int x, bit;
+ int halftoned_bytes = (width + 7) >> 3;
+ byte * cdata = data;
+ byte * mdata = data + halftoned_bytes;
+ byte * ydata = mdata + halftoned_bytes;
+ byte * kdata = ydata + halftoned_bytes;
+ byte c = *cdata++;
+ byte m = *mdata++;
+ byte y = *ydata++;
+ byte k = *kdata++;
+
+ /*
+ * Contrary to what the documentation implies, gcc compiles putc
+ * as a procedure call. This is ridiculous, but since we can't
+ * change it, we buffer groups of pixels ourselves and use fwrite.
+ */
+ for (bit = 7, x = 0; x < width;) {
+ byte raw[80 * 3]; /* 80 is arbitrary, must be a multiple of 8 */
+ int end = min(x + sizeof(raw) / 3, width);
+ byte *outp = raw;
+
+ for (; x < end; x++) {
+
+ if ((k >> bit) & 1) {
+ *outp++ = 0; /* Set output color = black */
+ *outp++ = 0;
+ *outp++ = 0;
+ } else {
+ *outp++ = 255 & (255 + ((c >> bit) & 1));
+ *outp++ = 255 & (255 + ((m >> bit) & 1));
+ *outp++ = 255 & (255 + ((y >> bit) & 1));
+ }
+ if (bit == 0) {
+ c = *cdata++;
+ m = *mdata++;
+ y = *ydata++;
+ k = *kdata++;
+ bit = 7;
+ } else
+ bit--;
+ }
+ fwrite(raw, 1, outp - raw, pstream);
+ }
+ return;
}
}
@@ -1051,7 +1048,7 @@ wtsimdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
int height = pdev->height;
dev_proc_get_bits((*save_get_bits)) = dev_proc(pdev, get_bits);
int output_is_nul = !strncmp(pdev->fname, "nul:", min(strlen(pdev->fname), 4)) ||
- !strncmp(pdev->fname, "/dev/null", min(strlen(pdev->fname), 9));
+ !strncmp(pdev->fname, "/dev/null", min(strlen(pdev->fname), 9));
/*
* The printer device setup changed the get_bits routine to
@@ -1071,62 +1068,62 @@ wtsimdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
*/
halftoned_bytes = (width + 7) >> 3; /* bytes per component */
halftoned_buffer = gs_malloc(pdev->memory, halftoned_bytes * n_planes, 1,
- "wtsimdi_print_page(halftoned_data)");
+ "wtsimdi_print_page(halftoned_data)");
if (halftoned_buffer == NULL) {
- code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
- goto cleanup;
+ code = GS_NOTE_ERROR(pdev->memory, gs_error_VMerror);
+ goto cleanup;
}
#ifdef DEBUG
/* Collect stats on each page. With the allocation now done once in 'open' the
* statistics won't be the same if other pages have been printed */
idev->color_cache_hit = idev->color_cache_collision =
- idev->color_is_current = idev->cache_fill_empty = 0;
+ idev->color_is_current = idev->cache_fill_empty = 0;
#endif
/* Initialize output file header. */
if (!output_is_nul) {
- fprintf(prn_stream, "P6\n%d %d\n", width, height);
- fprintf(prn_stream, "# Image generated by %s %ld.%02ld (device=wtsimdi)\n",
- gs_program_name(), gs_revision_number() / 100,
- gs_revision_number() % 100);
- fprintf(prn_stream, "%d\n", 255);
+ fprintf(prn_stream, "P6\n%d %d\n", width, height);
+ fprintf(prn_stream, "# Image generated by %s %ld.%02ld (device=wtsimdi)\n",
+ gs_program_name(), gs_revision_number() / 100,
+ gs_revision_number() % 100);
+ fprintf(prn_stream, "%d\n", 255);
}
/*
* Get raster data and then write data to output file.
*/
for (y = 0; y < height; y++) {
- /*
- * The get_bit routines for our device returns a halftoned copy of
- * the output data. Print this data to the output file.
- */
- code = gdev_prn_get_bits(pdev, y, halftoned_buffer, &halftoned_data);
- if (code < 0)
- break; /* return code below after cleanup */
- if (!output_is_nul)
- write_pkmraw_row(width, halftoned_data, prn_stream);
+ /*
+ * The get_bit routines for our device returns a halftoned copy of
+ * the output data. Print this data to the output file.
+ */
+ code = gdev_prn_get_bits(pdev, y, halftoned_buffer, &halftoned_data);
+ if (code < 0)
+ break; /* return code below after cleanup */
+ if (!output_is_nul)
+ write_pkmraw_row(width, halftoned_data, prn_stream);
}
cleanup:
if (idev->color_cache != NULL) {
#ifdef DEBUG
- {
+ {
int i, unused_color_cache_slots;
for (i=0,unused_color_cache_slots=0; i<COLOR_CACHE_SIZE; i++)
- if (idev->color_cache[i].color_index == gx_no_color_index)
- unused_color_cache_slots++;
- if_debug5(':',"wtsimdi_print_page color cache stats:"
- " current=%ld, hits=%ld,"
- " collisions=%ld, fill=%ld, unused_slots=%d\n",
- idev->color_is_current, idev->color_cache_hit,
- idev->color_cache_collision, idev->cache_fill_empty,
- unused_color_cache_slots);
+ if (idev->color_cache[i].color_index == gx_no_color_index)
+ unused_color_cache_slots++;
+ if_debug5(':',"wtsimdi_print_page color cache stats:"
+ " current=%ld, hits=%ld,"
+ " collisions=%ld, fill=%ld, unused_slots=%d\n",
+ idev->color_is_current, idev->color_cache_hit,
+ idev->color_cache_collision, idev->cache_fill_empty,
+ unused_color_cache_slots);
}
#endif
}
if (halftoned_buffer != NULL)
- gs_free(pdev->memory, halftoned_buffer, halftoned_bytes * n_planes, 1,
- "wtsimdi_print_page(halftoned_buffer)");
+ gs_free(pdev->memory, halftoned_buffer, halftoned_bytes * n_planes, 1,
+ "wtsimdi_print_page(halftoned_buffer)");
set_dev_proc(pdev, get_bits, save_get_bits);
return code;
}
diff --git a/gs/base/gdevx.c b/gs/base/gdevx.c
index a75d56e26..d8b91ad44 100644
--- a/gs/base/gdevx.c
+++ b/gs/base/gdevx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,7 +39,7 @@ private_st_device_X();
/* Forward references */
static int x_copy_image(gx_device_X * xdev, const byte * base, int sourcex,
- int raster, int x, int y, int w, int h);
+ int raster, int x, int y, int w, int h);
static int set_tile(gx_device *, const gx_strip_bitmap *);
static void free_cp(gx_device *);
@@ -79,50 +79,50 @@ static dev_proc_get_bits_rectangle(x_get_bits_rectangle);
const gx_device_X this_device = { \
dev_body, \
{ /* std_procs */ \
- x_open, \
- x_get_initial_matrix, \
- x_sync, \
- x_output_page, \
- x_close, \
- gdev_x_map_rgb_color, \
- gdev_x_map_color_rgb, \
- x_fill_rectangle, \
- NULL, /* tile_rectangle */ \
- x_copy_mono, \
- x_copy_color, \
- NULL, /* draw_line */ \
- NULL, /* get_bits */ \
- gdev_x_get_params, \
- gdev_x_put_params, \
- NULL, /* map_cmyk_color */ \
- gdev_x_get_xfont_procs, \
- NULL, /* get_xfont_device */ \
- NULL, /* map_rgb_alpha_color */ \
- x_get_page_device, \
- NULL, /* get_alpha_bits */ \
- NULL, /* copy_alpha */ \
- NULL, /* get_band */ \
- NULL, /* copy_rop */ \
- NULL, /* fill_path */ \
- NULL, /* stroke_path */ \
- NULL, /* fill_mask */ \
- NULL, /* fill_trapezoid */ \
- NULL, /* fill_parallelogram */ \
- NULL, /* fill_triangle */ \
- NULL, /* draw_thin_line */ \
- NULL, /* begin_image */ \
- NULL, /* image_data */ \
- NULL, /* end_image */ \
- x_strip_tile_rectangle, \
- NULL, /* strip_copy_rop */ \
- NULL, /* get_clipping_box */ \
- x_begin_typed_image, \
- x_get_bits_rectangle, \
- NULL, /* map_color_rgb_alpha */ \
- NULL, /* create_compositor */ \
- NULL, /* get_hardware_params */ \
- NULL, /* text_begin */ \
- gdev_x_finish_copydevice \
+ x_open, \
+ x_get_initial_matrix, \
+ x_sync, \
+ x_output_page, \
+ x_close, \
+ gdev_x_map_rgb_color, \
+ gdev_x_map_color_rgb, \
+ x_fill_rectangle, \
+ NULL, /* tile_rectangle */ \
+ x_copy_mono, \
+ x_copy_color, \
+ NULL, /* draw_line */ \
+ NULL, /* get_bits */ \
+ gdev_x_get_params, \
+ gdev_x_put_params, \
+ NULL, /* map_cmyk_color */ \
+ gdev_x_get_xfont_procs, \
+ NULL, /* get_xfont_device */ \
+ NULL, /* map_rgb_alpha_color */ \
+ x_get_page_device, \
+ NULL, /* get_alpha_bits */ \
+ NULL, /* copy_alpha */ \
+ NULL, /* get_band */ \
+ NULL, /* copy_rop */ \
+ NULL, /* fill_path */ \
+ NULL, /* stroke_path */ \
+ NULL, /* fill_mask */ \
+ NULL, /* fill_trapezoid */ \
+ NULL, /* fill_parallelogram */ \
+ NULL, /* fill_triangle */ \
+ NULL, /* draw_thin_line */ \
+ NULL, /* begin_image */ \
+ NULL, /* image_data */ \
+ NULL, /* end_image */ \
+ x_strip_tile_rectangle, \
+ NULL, /* strip_copy_rop */ \
+ NULL, /* get_clipping_box */ \
+ x_begin_typed_image, \
+ x_get_bits_rectangle, \
+ NULL, /* map_color_rgb_alpha */ \
+ NULL, /* create_compositor */ \
+ NULL, /* get_hardware_params */ \
+ NULL, /* text_begin */ \
+ gdev_x_finish_copydevice \
}, \
gx_device_bbox_common_initial(0 /*false*/, 1 /*true*/, 1 /*true*/), \
0 /*false*/, /* is_buffered */ \
@@ -131,23 +131,23 @@ const gx_device_X this_device = { \
NULL, /* buffer */ \
0, /* buffer_size */ \
{ /* image */ \
- 0, 0, /* width, height */ \
- 0, XYBitmap, NULL, /* xoffset, format, data */ \
- MSBFirst, 8, /* byte-order, bitmap-unit */ \
- MSBFirst, 8, 1, /* bitmap-bit-order, bitmap-pad, depth */ \
- 0, 1, /* bytes_per_line, bits_per_pixel */ \
- 0, 0, 0, /* red_mask, green_mask, blue_mask */ \
- NULL, /* *obdata */ \
- {NULL, /* *(*create_image)() */ \
- NULL, /* (*destroy_image)() */ \
- NULL, /* (*get_pixel)() */ \
- NULL, /* (*put_pixel)() */ \
- NULL, /* *(*sub_image)() */ \
- NULL /* (*add_pixel)() */ \
- }, \
+ 0, 0, /* width, height */ \
+ 0, XYBitmap, NULL, /* xoffset, format, data */ \
+ MSBFirst, 8, /* byte-order, bitmap-unit */ \
+ MSBFirst, 8, 1, /* bitmap-bit-order, bitmap-pad, depth */ \
+ 0, 1, /* bytes_per_line, bits_per_pixel */ \
+ 0, 0, 0, /* red_mask, green_mask, blue_mask */ \
+ NULL, /* *obdata */ \
+ {NULL, /* *(*create_image)() */ \
+ NULL, /* (*destroy_image)() */ \
+ NULL, /* (*get_pixel)() */ \
+ NULL, /* (*put_pixel)() */ \
+ NULL, /* *(*sub_image)() */ \
+ NULL /* (*add_pixel)() */ \
+ }, \
}, \
NULL, NULL, /* dpy, scr */ \
- /* (connection not initialized) */ \
+ /* (connection not initialized) */ \
NULL, /* vinfo */ \
(Colormap) None, /* cmap */ \
(Window) None, /* win */ \
@@ -159,27 +159,27 @@ const gx_device_X this_device = { \
{identity_matrix_body}, /* initial matrix (filled in) */ \
(Atom) 0, (Atom) 0, (Atom) 0, /* Atoms: NEXT, PAGE, DONE */ \
{ /* update */ \
- { /* box */ \
- {max_int_in_fixed, max_int_in_fixed}, \
- {min_int_in_fixed, min_int_in_fixed} \
- }, \
- 0, /* area */ \
- 0, /* total */ \
- 0 /* count */ \
+ { /* box */ \
+ {max_int_in_fixed, max_int_in_fixed}, \
+ {min_int_in_fixed, min_int_in_fixed} \
+ }, \
+ 0, /* area */ \
+ 0, /* total */ \
+ 0 /* count */ \
}, \
(Pixmap) 0, /* dest */ \
0L, (ulong)~0L, /* colors_or, colors_and */ \
{ /* cp */ \
- (Pixmap) 0, /* pixmap */ \
- NULL, /* gc */ \
- -1, -1 /* raster, height */ \
+ (Pixmap) 0, /* pixmap */ \
+ NULL, /* gc */ \
+ -1, -1 /* raster, height */ \
}, \
{ /* ht */ \
- (Pixmap) None, /* pixmap */ \
- (Pixmap) None, /* no_pixmap */ \
- gx_no_bitmap_id, /* id */ \
- 0, 0, 0, /* width, height, raster */ \
- 0, 0 /* fore_c, back_c */ \
+ (Pixmap) None, /* pixmap */ \
+ (Pixmap) None, /* no_pixmap */ \
+ gx_no_bitmap_id, /* id */ \
+ 0, 0, 0, /* width, height, raster */ \
+ 0, 0 /* fore_c, back_c */ \
}, \
GXcopy, /* function */ \
FillSolid, /* fill_style */ \
@@ -207,31 +207,31 @@ const gx_device_X this_device = { \
max_int, /* MaxBufferedCount */ \
\
{ /* text */ \
- 0, /* item_count */ \
- 0, /* char_count */ \
- {0, 0}, /* origin */ \
- 0, /* x */ \
- { \
- {0}}, /* items */ \
- {0} /* chars */ \
+ 0, /* item_count */ \
+ 0, /* char_count */ \
+ {0, 0}, /* origin */ \
+ 0, /* x */ \
+ { \
+ {0}}, /* items */ \
+ {0} /* chars */ \
} \
};
x_device(gs_x11_device,
- std_device_color_stype_body(gx_device_X, 0, "x11", &st_device_X,
- FAKE_RES * DEFAULT_WIDTH_10THS / 10,
- FAKE_RES * DEFAULT_HEIGHT_10THS / 10, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 24, 255, 256 ),
- 0)
+ std_device_color_stype_body(gx_device_X, 0, "x11", &st_device_X,
+ FAKE_RES * DEFAULT_WIDTH_10THS / 10,
+ FAKE_RES * DEFAULT_HEIGHT_10THS / 10, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 24, 255, 256 ),
+ 0)
x_device(gs_x11alpha_device,
- std_device_dci_alpha_type_body(gx_device_X, 0, "x11alpha", &st_device_X,
- FAKE_RES * DEFAULT_WIDTH_10THS / 10,
- FAKE_RES * DEFAULT_HEIGHT_10THS / 10, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 3, 24, 255, 255, 256, 256, 4, 4 ),
- 50000000)
+ std_device_dci_alpha_type_body(gx_device_X, 0, "x11alpha", &st_device_X,
+ FAKE_RES * DEFAULT_WIDTH_10THS / 10,
+ FAKE_RES * DEFAULT_HEIGHT_10THS / 10, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 3, 24, 255, 255, 256, 256, 4, 4 ),
+ 50000000)
/* If XPutImage doesn't work, do it ourselves. */
static int alt_put_image(gx_device * dev, Display * dpy, Drawable win,
@@ -255,7 +255,7 @@ x_open(gx_device * dev)
int code = gdev_x_open(xdev);
if (code < 0)
- return code;
+ return code;
update_init(xdev);
return 0;
}
@@ -278,8 +278,8 @@ x_get_initial_matrix(gx_device * dev, gs_matrix * pmat)
gx_device_X *xdev = (gx_device_X *) dev;
if (!xdev->ghostview) {
- gx_default_get_initial_matrix(dev, pmat);
- return;
+ gx_default_get_initial_matrix(dev, pmat);
+ return;
}
pmat->xx = xdev->initial_matrix.xx;
pmat->xy = xdev->initial_matrix.xy;
@@ -327,14 +327,14 @@ x_output_page(gx_device * dev, int num_copies, int flush)
/* Send ghostview a "page" client event */
/* Wait for a "next" client event */
if (xdev->ghostview) {
- XEvent event;
-
- gdev_x_send_event(xdev, xdev->PAGE);
- XNextEvent(xdev->dpy, &event);
- while (event.type != ClientMessage ||
- event.xclient.message_type != xdev->NEXT) {
- XNextEvent(xdev->dpy, &event);
- }
+ XEvent event;
+
+ gdev_x_send_event(xdev, xdev->PAGE);
+ XNextEvent(xdev->dpy, &event);
+ while (event.type != ClientMessage ||
+ event.xclient.message_type != xdev->NEXT) {
+ XNextEvent(xdev->dpy, &event);
+ }
}
return gx_finish_output_page(dev, num_copies, flush);
}
@@ -342,7 +342,7 @@ x_output_page(gx_device * dev, int num_copies, int flush)
/* Fill a rectangle with a color. */
static int
x_fill_rectangle(gx_device * dev,
- int x, int y, int w, int h, gx_color_index gscolor)
+ int x, int y, int w, int h, gx_color_index gscolor)
{
gx_device_X *xdev = (gx_device_X *) dev;
unsigned long color = (unsigned long) gscolor;
@@ -358,24 +358,24 @@ x_fill_rectangle(gx_device * dev,
/* on every operation, but there's no separate driver routine */
/* for erasepage (yet). */
if (x == 0 && y == 0 && w == xdev->width && h == xdev->height) {
- if (color == xdev->foreground || color == xdev->background)
- gdev_x_free_dynamic_colors(xdev);
- xdev->colors_or = xdev->colors_and = color;
+ if (color == xdev->foreground || color == xdev->background)
+ gdev_x_free_dynamic_colors(xdev);
+ xdev->colors_or = xdev->colors_and = color;
}
if (xdev->bpixmap != (Pixmap) 0) {
- x_update_add(xdev, x, y, w, h);
+ x_update_add(xdev, x, y, w, h);
}
if_debug5('F', "[F] fill (%d,%d):(%d,%d) %ld\n",
- x, y, w, h, (long)color);
+ x, y, w, h, (long)color);
return 0;
}
/* Copy a monochrome bitmap. */
static int
x_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
/*
* X doesn't directly support the simple operation of writing a color
* through a mask specified by an image. The plot is the following:
@@ -401,11 +401,11 @@ x_copy_mono(gx_device * dev,
gx_device_X *xdev = (gx_device_X *) dev;
int function = GXcopy;
unsigned long
- lzero = zero,
- lone = one;
+ lzero = zero,
+ lone = one;
x_pixel
- bc = lzero,
- fc = lone;
+ bc = lzero,
+ fc = lone;
fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
flush_text(xdev);
@@ -418,68 +418,68 @@ x_copy_mono(gx_device * dev,
/* Check for null, easy 1-color, hard 1-color, and 2-color cases. */
if (zero != gx_no_color_index) {
- if (one != gx_no_color_index) {
- /* 2-color case. */
- /* Simply replace existing bits with what's in the image. */
- } else if (!(~xdev->colors_and & bc)) {
- function = GXand;
- fc = ~(x_pixel) 0;
- } else if (!(~bc & xdev->colors_or)) {
- function = GXor;
- fc = 0;
- } else {
- goto hard;
- }
+ if (one != gx_no_color_index) {
+ /* 2-color case. */
+ /* Simply replace existing bits with what's in the image. */
+ } else if (!(~xdev->colors_and & bc)) {
+ function = GXand;
+ fc = ~(x_pixel) 0;
+ } else if (!(~bc & xdev->colors_or)) {
+ function = GXor;
+ fc = 0;
+ } else {
+ goto hard;
+ }
} else {
- if (one == gx_no_color_index) { /* no-op */
- return 0;
- } else if (!(~xdev->colors_and & fc)) {
- function = GXand;
- bc = ~(x_pixel) 0;
- } else if (!(~fc & xdev->colors_or)) {
- function = GXor;
- bc = 0;
- } else {
- goto hard;
- }
+ if (one == gx_no_color_index) { /* no-op */
+ return 0;
+ } else if (!(~xdev->colors_and & fc)) {
+ function = GXand;
+ bc = ~(x_pixel) 0;
+ } else if (!(~fc & xdev->colors_or)) {
+ function = GXor;
+ bc = 0;
+ } else {
+ goto hard;
+ }
}
xdev->image.format = XYBitmap;
X_SET_FUNCTION(xdev, function);
if (bc != xdev->back_color) {
- XSetBackground(xdev->dpy, xdev->gc, (xdev->back_color = bc));
+ XSetBackground(xdev->dpy, xdev->gc, (xdev->back_color = bc));
}
if (fc != xdev->fore_color) {
- XSetForeground(xdev->dpy, xdev->gc, (xdev->fore_color = fc));
+ XSetForeground(xdev->dpy, xdev->gc, (xdev->fore_color = fc));
}
if (zero != gx_no_color_index)
- NOTE_COLOR(xdev, lzero);
+ NOTE_COLOR(xdev, lzero);
if (one != gx_no_color_index)
- NOTE_COLOR(xdev, lone);
+ NOTE_COLOR(xdev, lone);
put_image(xdev->dpy, xdev->dest, xdev->gc, &xdev->image,
- sourcex, 0, x, y, w, h);
+ sourcex, 0, x, y, w, h);
goto out;
hard: /* Handle the hard 1-color case. */
if (raster > xdev->cp.raster || h > xdev->cp.height) {
- /* Must allocate a new pixmap and GC. */
- /* Release the old ones first. */
- free_cp(dev);
-
- /* Create the clipping pixmap, depth must be 1. */
- xdev->cp.pixmap =
- XCreatePixmap(xdev->dpy, xdev->win, raster << 3, h, 1);
- if (xdev->cp.pixmap == (Pixmap) 0) {
- lprintf("x_copy_mono: can't allocate pixmap\n");
- return_error(gs_error_VMerror);
- }
- xdev->cp.gc = XCreateGC(xdev->dpy, xdev->cp.pixmap, 0, 0);
- if (xdev->cp.gc == (GC) 0) {
- lprintf("x_copy_mono: can't allocate GC\n");
- return_error(gs_error_VMerror);
- }
- xdev->cp.raster = raster;
- xdev->cp.height = h;
+ /* Must allocate a new pixmap and GC. */
+ /* Release the old ones first. */
+ free_cp(dev);
+
+ /* Create the clipping pixmap, depth must be 1. */
+ xdev->cp.pixmap =
+ XCreatePixmap(xdev->dpy, xdev->win, raster << 3, h, 1);
+ if (xdev->cp.pixmap == (Pixmap) 0) {
+ lprintf("x_copy_mono: can't allocate pixmap\n");
+ return_error(gs_error_VMerror);
+ }
+ xdev->cp.gc = XCreateGC(xdev->dpy, xdev->cp.pixmap, 0, 0);
+ if (xdev->cp.gc == (GC) 0) {
+ lprintf("x_copy_mono: can't allocate GC\n");
+ return_error(gs_error_VMerror);
+ }
+ xdev->cp.raster = raster;
+ xdev->cp.height = h;
}
/* Initialize static mask image params */
xdev->image.format = XYBitmap;
@@ -487,16 +487,16 @@ x_copy_mono(gx_device * dev,
/* Select polarity based on fg/bg transparency. */
if (one == gx_no_color_index) { /* invert */
- XSetBackground(xdev->dpy, xdev->cp.gc, (x_pixel) 1);
- XSetForeground(xdev->dpy, xdev->cp.gc, (x_pixel) 0);
- X_SET_FORE_COLOR(xdev, lzero);
+ XSetBackground(xdev->dpy, xdev->cp.gc, (x_pixel) 1);
+ XSetForeground(xdev->dpy, xdev->cp.gc, (x_pixel) 0);
+ X_SET_FORE_COLOR(xdev, lzero);
} else {
- XSetBackground(xdev->dpy, xdev->cp.gc, (x_pixel) 0);
- XSetForeground(xdev->dpy, xdev->cp.gc, (x_pixel) 1);
- X_SET_FORE_COLOR(xdev, lone);
+ XSetBackground(xdev->dpy, xdev->cp.gc, (x_pixel) 0);
+ XSetForeground(xdev->dpy, xdev->cp.gc, (x_pixel) 1);
+ X_SET_FORE_COLOR(xdev, lone);
}
put_image(xdev->dpy, xdev->cp.pixmap, xdev->cp.gc,
- &xdev->image, sourcex, 0, 0, 0, w, h);
+ &xdev->image, sourcex, 0, 0, 0, w, h);
/* Install as clipmask. */
XSetClipMask(xdev->dpy, xdev->gc, xdev->cp.pixmap);
@@ -511,11 +511,11 @@ x_copy_mono(gx_device * dev,
/* Tidy up. Free the pixmap if it's big. */
XSetClipMask(xdev->dpy, xdev->gc, None);
if (raster * h > xdev->MaxTempPixmap)
- free_cp(dev);
+ free_cp(dev);
out:if (xdev->bpixmap != (Pixmap) 0) {
- /* We wrote to the pixmap, so update the display now. */
- x_update_add(xdev, x, y, w, h);
+ /* We wrote to the pixmap, so update the display now. */
+ x_update_add(xdev, x, y, w, h);
}
return 0;
}
@@ -527,12 +527,12 @@ free_cp(gx_device * dev)
gx_device_X *xdev = (gx_device_X *) dev;
if (xdev->cp.gc != NULL) {
- XFreeGC(xdev->dpy, xdev->cp.gc);
- xdev->cp.gc = NULL;
+ XFreeGC(xdev->dpy, xdev->cp.gc);
+ xdev->cp.gc = NULL;
}
if (xdev->cp.pixmap != (Pixmap) 0) {
- XFreePixmap(xdev->dpy, xdev->cp.pixmap);
- xdev->cp.pixmap = (Pixmap) 0;
+ XFreePixmap(xdev->dpy, xdev->cp.pixmap);
+ xdev->cp.pixmap = (Pixmap) 0;
}
xdev->cp.raster = -1; /* mark as unallocated */
}
@@ -540,7 +540,7 @@ free_cp(gx_device * dev)
/* Copy a color bitmap. */
static int
x_copy_image(gx_device_X * xdev, const byte * base, int sourcex, int raster,
- int x, int y, int w, int h)
+ int x, int y, int w, int h)
{
int depth = xdev->color_info.depth;
@@ -551,52 +551,52 @@ x_copy_image(gx_device_X * xdev, const byte * base, int sourcex, int raster,
/* copy_color calls for a single pixel. Check for this now. */
if (h == 1 && w == 1) {
- uint sbit = sourcex * depth;
- const byte *ptr = base + (sbit >> 3);
- x_pixel pixel;
-
- if (depth < 8)
- pixel = (byte) (*ptr << (sbit & 7)) >> (8 - depth);
- else {
- pixel = *ptr++;
- while ((depth -= 8) > 0)
- pixel = (pixel << 8) + *ptr++;
- }
- X_SET_FORE_COLOR(xdev, pixel);
- XDrawPoint(xdev->dpy, xdev->dest, xdev->gc, x, y);
+ uint sbit = sourcex * depth;
+ const byte *ptr = base + (sbit >> 3);
+ x_pixel pixel;
+
+ if (depth < 8)
+ pixel = (byte) (*ptr << (sbit & 7)) >> (8 - depth);
+ else {
+ pixel = *ptr++;
+ while ((depth -= 8) > 0)
+ pixel = (pixel << 8) + *ptr++;
+ }
+ X_SET_FORE_COLOR(xdev, pixel);
+ XDrawPoint(xdev->dpy, xdev->dest, xdev->gc, x, y);
} else {
- /* Reduce base, sourcex */
- int width = sourcex + w;
- int vdepth = xdev->vinfo->depth;
- xdev->image.width = width;
- xdev->image.height = h;
- xdev->image.format = ZPixmap;
- xdev->image.data = (char *)base;
- xdev->image.depth = vdepth;
- xdev->image.bitmap_pad = 8;
- if (width * vdepth < raster * 8)
- xdev->image.bytes_per_line = raster;
- else
- xdev->image.bytes_per_line = 0;
- xdev->image.bits_per_pixel = depth;
- if (XInitImage(&xdev->image) == 0){
- errprintf(xdev->memory, "XInitImage failed in x_copy_image.\n");
- return_error(gs_error_unknownerror);
- }
- XPutImage(xdev->dpy, xdev->dest, xdev->gc, &xdev->image,
- sourcex, 0, x, y, w, h);
- xdev->image.depth = xdev->image.bits_per_pixel = 1;
-
- /* give up on optimization */
- xdev->colors_or = (x_pixel)(-1);
- xdev->colors_and = 0;
+ /* Reduce base, sourcex */
+ int width = sourcex + w;
+ int vdepth = xdev->vinfo->depth;
+ xdev->image.width = width;
+ xdev->image.height = h;
+ xdev->image.format = ZPixmap;
+ xdev->image.data = (char *)base;
+ xdev->image.depth = vdepth;
+ xdev->image.bitmap_pad = 8;
+ if (width * vdepth < raster * 8)
+ xdev->image.bytes_per_line = raster;
+ else
+ xdev->image.bytes_per_line = 0;
+ xdev->image.bits_per_pixel = depth;
+ if (XInitImage(&xdev->image) == 0){
+ errprintf(xdev->memory, "XInitImage failed in x_copy_image.\n");
+ return_error(gs_error_unknownerror);
+ }
+ XPutImage(xdev->dpy, xdev->dest, xdev->gc, &xdev->image,
+ sourcex, 0, x, y, w, h);
+ xdev->image.depth = xdev->image.bits_per_pixel = 1;
+
+ /* give up on optimization */
+ xdev->colors_or = (x_pixel)(-1);
+ xdev->colors_and = 0;
}
return 0;
}
static int
x_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_X *xdev = (gx_device_X *) dev;
int code;
@@ -605,9 +605,9 @@ x_copy_color(gx_device * dev,
flush_text(xdev);
code = x_copy_image(xdev, base, sourcex, raster, x, y, w, h);
if (xdev->bpixmap != (Pixmap) 0)
- x_update_add(xdev, x, y, w, h);
+ x_update_add(xdev, x, y, w, h);
if_debug4('F', "[F] copy_color (%d,%d):(%d,%d)\n",
- x, y, w, h);
+ x, y, w, h);
return code;
}
@@ -622,26 +622,25 @@ x_get_page_device(gx_device * dev)
/* Tile a rectangle. */
static int
x_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one,
- int px, int py)
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one,
+ int px, int py)
{
gx_device_X *xdev = (gx_device_X *) dev;
unsigned long lzero = (unsigned long) zero;
unsigned long lone = (unsigned long) one;
-
/* Give up if one color is transparent, or if the tile is colored. */
/* We should implement the latter someday, since X can handle it. */
if (one == gx_no_color_index || zero == gx_no_color_index)
- return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
- zero, one, px, py);
+ return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
+ zero, one, px, py);
/* For the moment, give up if the phase or shift is non-zero. */
if (tiles->shift | px | py)
- return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
- zero, one, px, py);
+ return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
+ zero, one, px, py);
fit_fill(dev, x, y, w, h);
flush_text(xdev);
@@ -650,28 +649,28 @@ x_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
/* tile_rectangle calls. Check for this now. */
if (h <= 2 && w <= 2) {
- int j;
-
- X_SET_FILL_STYLE(xdev, FillSolid);
- X_SET_FUNCTION(xdev, GXcopy);
- for (j = y + h; --j >= y;) {
- const byte *ptr =
- tiles->data + (j % tiles->rep_height) * tiles->raster;
- int i;
-
- for (i = x + w; --i >= x;) {
- uint tx = i % tiles->rep_width;
- byte mask = 0x80 >> (tx & 7);
- x_pixel pixel = (ptr[tx >> 3] & mask ? lone : lzero);
-
- X_SET_FORE_COLOR(xdev, pixel);
- XDrawPoint(xdev->dpy, xdev->dest, xdev->gc, i, j);
- }
- }
- if (xdev->bpixmap != (Pixmap) 0) {
- x_update_add(xdev, x, y, w, h);
- }
- return 0;
+ int j;
+
+ X_SET_FILL_STYLE(xdev, FillSolid);
+ X_SET_FUNCTION(xdev, GXcopy);
+ for (j = y + h; --j >= y;) {
+ const byte *ptr =
+ tiles->data + (j % tiles->rep_height) * tiles->raster;
+ int i;
+
+ for (i = x + w; --i >= x;) {
+ uint tx = i % tiles->rep_width;
+ byte mask = 0x80 >> (tx & 7);
+ x_pixel pixel = (ptr[tx >> 3] & mask ? lone : lzero);
+
+ X_SET_FORE_COLOR(xdev, pixel);
+ XDrawPoint(xdev->dpy, xdev->dest, xdev->gc, i, j);
+ }
+ }
+ if (xdev->bpixmap != (Pixmap) 0) {
+ x_update_add(xdev, x, y, w, h);
+ }
+ return 0;
}
/*
* Remember, an X tile is already filled with particular
@@ -682,23 +681,23 @@ x_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
* fg/bg but use the same halftone screen.
*/
if ((lzero != xdev->ht.back_c) || (lone != xdev->ht.fore_c))
- xdev->ht.id = ~tiles->id; /* force reload */
+ xdev->ht.id = ~tiles->id; /* force reload */
X_SET_BACK_COLOR(xdev, lzero);
X_SET_FORE_COLOR(xdev, lone);
if (!set_tile(dev, tiles)) { /* Bad news. Fall back to the default algorithm. */
- return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
- zero, one, px, py);
+ return gx_default_strip_tile_rectangle(dev, tiles, x, y, w, h,
+ zero, one, px, py);
}
/* Use the tile to fill the rectangle */
X_SET_FILL_STYLE(xdev, FillTiled);
X_SET_FUNCTION(xdev, GXcopy);
XFillRectangle(xdev->dpy, xdev->dest, xdev->gc, x, y, w, h);
if (xdev->bpixmap != (Pixmap) 0) {
- x_update_add(xdev, x, y, w, h);
+ x_update_add(xdev, x, y, w, h);
}
if_debug6('F', "[F] tile (%d,%d):(%d,%d) %ld,%ld\n",
- x, y, w, h, lzero, lone);
+ x, y, w, h, lzero, lone);
return 0;
}
@@ -707,10 +706,10 @@ x_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
/* this procedure does all the work. */
static int
x_begin_typed_image(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
gx_device_X *xdev = (gx_device_X *) dev;
const gs_image2_t *pim;
@@ -719,17 +718,17 @@ x_begin_typed_image(gx_device * dev,
gs_matrix smat, dmat;
if (pic->type->index != 2)
- goto punt;
+ goto punt;
pim = (const gs_image2_t *)pic;
if (!pim->PixelCopy)
- goto punt;
+ goto punt;
pgs = pim->DataSource;
sdev = gs_currentdevice(pgs);
if (dev->dname != sdev->dname ||
- memcmp(&dev->color_info, &sdev->color_info,
- sizeof(dev->color_info))
- )
- goto punt;
+ memcmp(&dev->color_info, &sdev->color_info,
+ sizeof(dev->color_info))
+ )
+ goto punt;
flush_text(xdev);
gs_currentmatrix(pgs, &smat);
/*
@@ -739,52 +738,52 @@ x_begin_typed_image(gx_device * dev,
*/
gs_matrix_multiply(&pim->ImageMatrix, &smat, &smat);
if (pis == 0)
- dmat = *pmat;
+ dmat = *pmat;
else
- gs_currentmatrix((const gs_state *)pis, &dmat);
+ gs_currentmatrix((const gs_state *)pis, &dmat);
if (!((is_xxyy(&dmat) || is_xyyx(&dmat)) &&
#define eqe(e) smat.e == dmat.e
- eqe(xx) && eqe(xy) && eqe(yx) && eqe(yy))
+ eqe(xx) && eqe(xy) && eqe(yx) && eqe(yy))
#undef eqe
- )
- goto punt;
+ )
+ goto punt;
{
- gs_rect rect, src, dest;
- gs_int_point size;
- int srcx, srcy, destx, desty;
-
- rect.p.x = rect.p.y = 0;
- rect.q.x = pim->Width, rect.q.y = pim->Height;
- gs_bbox_transform(&rect, &dmat, &dest);
- if (pcpath != NULL &&
- !gx_cpath_includes_rectangle(pcpath,
- float2fixed(dest.p.x), float2fixed(dest.p.y),
- float2fixed(dest.q.x), float2fixed(dest.q.y))
- )
- goto punt;
- rect.q.x += (rect.p.x = pim->XOrigin);
- rect.q.y += (rect.p.y = pim->YOrigin);
- gs_bbox_transform(&rect, &smat, &src);
- (*pic->type->source_size) (pis, pic, &size);
- X_SET_FILL_STYLE(xdev, FillSolid);
- X_SET_FUNCTION(xdev, GXcopy);
- srcx = (int)(src.p.x + 0.5);
- srcy = (int)(src.p.y + 0.5);
- destx = (int)(dest.p.x + 0.5);
- desty = (int)(dest.p.y + 0.5);
- XCopyArea(xdev->dpy, xdev->bpixmap, xdev->bpixmap, xdev->gc,
- srcx, srcy, size.x, size.y, destx, desty);
- x_update_add(xdev, destx, desty, size.x, size.y);
+ gs_rect rect, src, dest;
+ gs_int_point size;
+ int srcx, srcy, destx, desty;
+
+ rect.p.x = rect.p.y = 0;
+ rect.q.x = pim->Width, rect.q.y = pim->Height;
+ gs_bbox_transform(&rect, &dmat, &dest);
+ if (pcpath != NULL &&
+ !gx_cpath_includes_rectangle(pcpath,
+ float2fixed(dest.p.x), float2fixed(dest.p.y),
+ float2fixed(dest.q.x), float2fixed(dest.q.y))
+ )
+ goto punt;
+ rect.q.x += (rect.p.x = pim->XOrigin);
+ rect.q.y += (rect.p.y = pim->YOrigin);
+ gs_bbox_transform(&rect, &smat, &src);
+ (*pic->type->source_size) (pis, pic, &size);
+ X_SET_FILL_STYLE(xdev, FillSolid);
+ X_SET_FUNCTION(xdev, GXcopy);
+ srcx = (int)(src.p.x + 0.5);
+ srcy = (int)(src.p.y + 0.5);
+ destx = (int)(dest.p.x + 0.5);
+ desty = (int)(dest.p.y + 0.5);
+ XCopyArea(xdev->dpy, xdev->bpixmap, xdev->bpixmap, xdev->gc,
+ srcx, srcy, size.x, size.y, destx, desty);
+ x_update_add(xdev, destx, desty, size.x, size.y);
}
return 0;
punt:return gx_default_begin_typed_image(dev, pis, pmat, pic, prect,
- pdcolor, pcpath, mem, pinfo);
+ pdcolor, pcpath, mem, pinfo);
}
/* Read bits back from the screen. */
static int
x_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_X *xdev = (gx_device_X *) dev;
int depth = dev->color_info.depth;
@@ -805,50 +804,50 @@ x_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
#endif /* GET_IMAGE_EXPOSURES */
if (x0 < 0 || y0 < 0 || x1 > dev->width || y1 > dev->height)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* XGetImage can only handle x_offset = 0. */
if ((options & GB_OFFSET_SPECIFIED) && params->x_offset == 0)
- options = (options & ~GB_OFFSET_SPECIFIED) | GB_OFFSET_0;
+ options = (options & ~GB_OFFSET_SPECIFIED) | GB_OFFSET_0;
if (~options &
- (GB_RETURN_COPY | GB_OFFSET_0 | GB_PACKING_CHUNKY |
- GB_COLORS_NATIVE) ||
- !(options & GB_ALIGN_ALL) ||
- !(options & GB_RASTER_ALL)
- )
- return
- gx_default_get_bits_rectangle(dev, prect, params, unread);
+ (GB_RETURN_COPY | GB_OFFSET_0 | GB_PACKING_CHUNKY |
+ GB_COLORS_NATIVE) ||
+ !(options & GB_ALIGN_ALL) ||
+ !(options & GB_RASTER_ALL)
+ )
+ return
+ gx_default_get_bits_rectangle(dev, prect, params, unread);
params->options =
- GB_COLORS_NATIVE | GB_ALPHA_NONE | GB_PACKING_CHUNKY |
- GB_RETURN_COPY | GB_OFFSET_0 |
- (options & GB_ALIGN_ALL) |
- (options & GB_RASTER_SPECIFIED ? GB_RASTER_SPECIFIED :
- GB_RASTER_STANDARD);
+ GB_COLORS_NATIVE | GB_ALPHA_NONE | GB_PACKING_CHUNKY |
+ GB_RETURN_COPY | GB_OFFSET_0 |
+ (options & GB_ALIGN_ALL) |
+ (options & GB_RASTER_SPECIFIED ? GB_RASTER_SPECIFIED :
+ GB_RASTER_STANDARD);
if (x0 >= x1 || y0 >= y1)
- return 0;
+ return 0;
if (x1 <= xdev->update.box.p.x || x0 >= xdev->update.box.q.x ||
- y1 <= xdev->update.box.p.y || y0 >= xdev->update.box.q.y
- ) {
- /*
- * The area being read back doesn't overlap the pending update:
- * just flush text.
- */
- flush_text(xdev);
+ y1 <= xdev->update.box.p.y || y0 >= xdev->update.box.q.y
+ ) {
+ /*
+ * The area being read back doesn't overlap the pending update:
+ * just flush text.
+ */
+ flush_text(xdev);
} else
- update_do_flush(xdev);
+ update_do_flush(xdev);
/*
* If we want a list of unread rectangles, turn on graphics
* exposures, and accept exposure events.
*/
- /******
- ****** FOLLOWING IS WRONG. XGetImage DOES NOT GENERATE
- ****** EXPOSURE EVENTS.
- ******/
+ /******
+ ****** FOLLOWING IS WRONG. XGetImage DOES NOT GENERATE
+ ****** EXPOSURE EVENTS.
+ ******/
#if GET_IMAGE_EXPOSURES
if (unread) {
- XSetGraphicsExposures(xdev->dpy, xdev->gc, True);
- XGetWindowAttributes(xdev->dpy, xdev->win, &attributes);
- XSelectInput(xdev->dpy, xdev->win,
- attributes.your_event_mask | ExposureMask);
+ XSetGraphicsExposures(xdev->dpy, xdev->gc, True);
+ XGetWindowAttributes(xdev->dpy, xdev->win, &attributes);
+ XSelectInput(xdev->dpy, xdev->win,
+ attributes.your_event_mask | ExposureMask);
}
#endif /* GET_IMAGE_EXPOSURES */
/*
@@ -857,119 +856,119 @@ x_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
* bit or byte order.
*/
if (band == 0)
- band = 1;
+ band = 1;
for (y = y0; y < y1; y += h) {
- int cy;
-
- h = min(band, y1 - y);
- image = XGetImage(xdev->dpy, xdev->dest, x0, y, x1 - x0, h,
- plane_mask, ZPixmap);
- for (cy = y; cy < y + h; ++cy) {
- const byte *source =
- (const byte *)image->data + (cy - y) * image->bytes_per_line;
- byte *dest = params->data[0] + (cy - y0) * raster;
-
- /*
- * XGetImage can return an image with any bit order, byte order,
- * unit size (for bitmaps), and bits_per_pixel it wants: it's up
- * to us to convert the results. (It's a major botch in the X
- * design that even though the server has to have the ability to
- * convert images from any format to any format, there's no way
- * to specify a requested format for XGetImage.)
- */
- if (image->bits_per_pixel == image->depth &&
- (image->depth > 1 || image->bitmap_bit_order == MSBFirst) &&
- (image->byte_order == MSBFirst || image->depth <= 8)
- ) {
- /*
- * The server has been nice enough to return an image in the
- * format we use.
- */
- memcpy(dest, source, width_bytes);
- } else {
- /*
- * We need to swap byte order and/or bit order. What a
- * totally unnecessary nuisance! For the moment, the only
- * cases we deal with are 15-, 16- and 24-bit images with padding
- * and/or byte swapping.
- * If we ever need to support other color depths, consider rewriting
- * all these byte swaps with XGetPixel() .
- */
- if (image->depth == 24) {
- int cx;
- const byte *p = source;
- byte *q = dest;
- int step = image->bits_per_pixel >> 3;
-
- if (image->byte_order == MSBFirst) {
- p += step - 3;
- for (cx = x0; cx < x1; p += step, q += 3, ++cx)
- q[0] = p[0], q[1] = p[1], q[2] = p[2];
- } else {
- for (cx = x0; cx < x1; p += step, q += 3, ++cx)
- q[0] = p[2], q[1] = p[1], q[2] = p[0];
- }
- } else if (image->depth == 16 || image->depth == 15) {
- int cx;
- const byte *p = source;
- byte *q = dest;
- int step = image->bits_per_pixel >> 3;
-
- if (image->byte_order == MSBFirst) {
- p += step - 2;
- for (cx = x0; cx < x1; p += step, q += 2, ++cx)
- q[0] = p[0], q[1] = p[1];
- } else {
- for (cx = x0; cx < x1; p += step, q += 2, ++cx)
- q[0] = p[1], q[1] = p[0];
- }
- } else
- code = gs_note_error(gs_error_rangecheck);
- }
- }
- XDestroyImage(image);
+ int cy;
+
+ h = min(band, y1 - y);
+ image = XGetImage(xdev->dpy, xdev->dest, x0, y, x1 - x0, h,
+ plane_mask, ZPixmap);
+ for (cy = y; cy < y + h; ++cy) {
+ const byte *source =
+ (const byte *)image->data + (cy - y) * image->bytes_per_line;
+ byte *dest = params->data[0] + (cy - y0) * raster;
+
+ /*
+ * XGetImage can return an image with any bit order, byte order,
+ * unit size (for bitmaps), and bits_per_pixel it wants: it's up
+ * to us to convert the results. (It's a major botch in the X
+ * design that even though the server has to have the ability to
+ * convert images from any format to any format, there's no way
+ * to specify a requested format for XGetImage.)
+ */
+ if (image->bits_per_pixel == image->depth &&
+ (image->depth > 1 || image->bitmap_bit_order == MSBFirst) &&
+ (image->byte_order == MSBFirst || image->depth <= 8)
+ ) {
+ /*
+ * The server has been nice enough to return an image in the
+ * format we use.
+ */
+ memcpy(dest, source, width_bytes);
+ } else {
+ /*
+ * We need to swap byte order and/or bit order. What a
+ * totally unnecessary nuisance! For the moment, the only
+ * cases we deal with are 15-, 16- and 24-bit images with padding
+ * and/or byte swapping.
+ * If we ever need to support other color depths, consider rewriting
+ * all these byte swaps with XGetPixel() .
+ */
+ if (image->depth == 24) {
+ int cx;
+ const byte *p = source;
+ byte *q = dest;
+ int step = image->bits_per_pixel >> 3;
+
+ if (image->byte_order == MSBFirst) {
+ p += step - 3;
+ for (cx = x0; cx < x1; p += step, q += 3, ++cx)
+ q[0] = p[0], q[1] = p[1], q[2] = p[2];
+ } else {
+ for (cx = x0; cx < x1; p += step, q += 3, ++cx)
+ q[0] = p[2], q[1] = p[1], q[2] = p[0];
+ }
+ } else if (image->depth == 16 || image->depth == 15) {
+ int cx;
+ const byte *p = source;
+ byte *q = dest;
+ int step = image->bits_per_pixel >> 3;
+
+ if (image->byte_order == MSBFirst) {
+ p += step - 2;
+ for (cx = x0; cx < x1; p += step, q += 2, ++cx)
+ q[0] = p[0], q[1] = p[1];
+ } else {
+ for (cx = x0; cx < x1; p += step, q += 2, ++cx)
+ q[0] = p[1], q[1] = p[0];
+ }
+ } else
+ code = gs_note_error(gs_error_rangecheck);
+ }
+ }
+ XDestroyImage(image);
}
if (unread) {
#if GET_IMAGE_EXPOSURES
- XEvent event;
+ XEvent event;
#endif /* GET_IMAGE_EXPOSURES */
- *unread = 0;
+ *unread = 0;
#if GET_IMAGE_EXPOSURES
- /* Read any exposure events. */
- XWindowEvent(xdev->dpy, xdev->win, ExposureMask, &event);
- if (event.type == GraphicsExpose) {
- gs_int_rect *rects = (gs_int_rect *)
- gs_alloc_bytes(dev->memory, sizeof(gs_int_rect),
- "x_get_bits_rectangle");
- int num_rects = 0;
-
- for (;;) {
- if (rects == 0) {
- code = gs_note_error(gs_error_VMerror);
- break;
- }
+ /* Read any exposure events. */
+ XWindowEvent(xdev->dpy, xdev->win, ExposureMask, &event);
+ if (event.type == GraphicsExpose) {
+ gs_int_rect *rects = (gs_int_rect *)
+ gs_alloc_bytes(dev->memory, sizeof(gs_int_rect),
+ "x_get_bits_rectangle");
+ int num_rects = 0;
+
+ for (;;) {
+ if (rects == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ break;
+ }
#define xevent (*(XGraphicsExposeEvent *)&event)
- rects[num_rects].q.x = xevent.width +
- (rects[num_rects].p.x = xevent.x);
- rects[num_rects].q.y = xevent.height +
- (rects[num_rects].p.y = xevent.y);
- ++num_rects;
- if (!xevent.count)
- break;
+ rects[num_rects].q.x = xevent.width +
+ (rects[num_rects].p.x = xevent.x);
+ rects[num_rects].q.y = xevent.height +
+ (rects[num_rects].p.y = xevent.y);
+ ++num_rects;
+ if (!xevent.count)
+ break;
#undef xevent
- rects = gs_resize_object(dev->memory, rects,
- (num_rects + 1) * sizeof(gs_int_rect),
- "x_get_bits_rectangle");
- }
- if (code >= 0) {
- *unread = rects;
- code = num_rects;
- }
- }
- /* Restore the window state. */
- XSetGraphicsExposures(xdev->dpy, xdev->gc, False);
- XSelectInput(xdev->dpy, xdev->win, attributes.your_event_mask);
+ rects = gs_resize_object(dev->memory, rects,
+ (num_rects + 1) * sizeof(gs_int_rect),
+ "x_get_bits_rectangle");
+ }
+ if (code >= 0) {
+ *unread = rects;
+ code = num_rects;
+ }
+ }
+ /* Restore the window state. */
+ XSetGraphicsExposures(xdev->dpy, xdev->gc, False);
+ XSelectInput(xdev->dpy, xdev->win, attributes.your_event_mask);
#endif /* GET_IMAGE_EXPOSURES */
}
return code;
@@ -984,23 +983,23 @@ set_tile(gx_device * dev, const gx_strip_bitmap * tile)
#ifdef DEBUG
if (gs_debug['T'])
- return 0;
+ return 0;
#endif
if (tile->id == xdev->ht.id && tile->id != gx_no_bitmap_id)
- return xdev->useXSetTile;
+ return xdev->useXSetTile;
/* Set up the tile Pixmap */
if (tile->size.x != xdev->ht.width ||
- tile->size.y != xdev->ht.height ||
- xdev->ht.pixmap == (Pixmap) 0) {
- if (xdev->ht.pixmap != (Pixmap) 0)
- XFreePixmap(xdev->dpy, xdev->ht.pixmap);
- xdev->ht.pixmap = XCreatePixmap(xdev->dpy, xdev->win,
- tile->size.x, tile->size.y,
- xdev->vinfo->depth);
- if (xdev->ht.pixmap == (Pixmap) 0)
- return 0;
- xdev->ht.width = tile->size.x, xdev->ht.height = tile->size.y;
- xdev->ht.raster = tile->raster;
+ tile->size.y != xdev->ht.height ||
+ xdev->ht.pixmap == (Pixmap) 0) {
+ if (xdev->ht.pixmap != (Pixmap) 0)
+ XFreePixmap(xdev->dpy, xdev->ht.pixmap);
+ xdev->ht.pixmap = XCreatePixmap(xdev->dpy, xdev->win,
+ tile->size.x, tile->size.y,
+ xdev->vinfo->depth);
+ if (xdev->ht.pixmap == (Pixmap) 0)
+ return 0;
+ xdev->ht.width = tile->size.x, xdev->ht.height = tile->size.y;
+ xdev->ht.raster = tile->raster;
}
xdev->ht.fore_c = xdev->fore_color;
xdev->ht.back_c = xdev->back_color;
@@ -1013,20 +1012,20 @@ set_tile(gx_device * dev, const gx_strip_bitmap * tile)
X_SET_FILL_STYLE(xdev, FillSolid);
#ifdef DEBUG
if (gs_debug['H']) {
- int i;
-
- dlprintf4("[H] 0x%lx: width=%d height=%d raster=%d\n",
- (ulong) tile->data, tile->size.x, tile->size.y, tile->raster);
- dlputs("");
- for (i = 0; i < tile->raster * tile->size.y; i++)
- dprintf1(" %02x", tile->data[i]);
- dputc('\n');
+ int i;
+
+ dlprintf4("[H] 0x%lx: width=%d height=%d raster=%d\n",
+ (ulong) tile->data, tile->size.x, tile->size.y, tile->raster);
+ dlputs("");
+ for (i = 0; i < tile->raster * tile->size.y; i++)
+ dprintf1(" %02x", tile->data[i]);
+ dputc('\n');
}
#endif
XSetTile(xdev->dpy, xdev->gc, xdev->ht.no_pixmap); /* *** X bug *** */
X_SET_FUNCTION(xdev, GXcopy);
put_image(xdev->dpy, xdev->ht.pixmap, xdev->gc, &xdev->image,
- 0, 0, 0, 0, tile->size.x, tile->size.y);
+ 0, 0, 0, 0, tile->size.x, tile->size.y);
XSetTile(xdev->dpy, xdev->gc, xdev->ht.pixmap);
xdev->ht.id = tile->id;
return xdev->useXSetTile;
@@ -1049,35 +1048,35 @@ update_do_flush(gx_device_X * xdev)
{
flush_text(xdev);
if (xdev->update.count != 0) {
- int x = xdev->update.box.p.x, y = xdev->update.box.p.y;
- int w = xdev->update.box.q.x - x, h = xdev->update.box.q.y - y;
-
- fit_fill_xywh(xdev, x, y, w, h);
- if (w > 0 && h > 0) {
- if (xdev->is_buffered) {
- /* Copy from memory image to X server. */
- const gx_device_memory *mdev =
- (const gx_device_memory *)xdev->target;
-
- /*
- * The bbox device may have set the target to NULL
- * temporarily. If this is the case, defer the screen
- * update.
- */
- if (mdev == NULL)
- return; /* don't reset */
- x_copy_image(xdev, mdev->line_ptrs[y], x, mdev->raster,
- x, y, w, h);
- }
- if (xdev->bpixmap) {
- /* Copy from X backing pixmap to screen. */
-
- X_SET_FUNCTION(xdev, GXcopy);
- XCopyArea(xdev->dpy, xdev->bpixmap, xdev->win, xdev->gc,
- x, y, w, h, x, y);
- }
- }
- update_init(xdev);
+ int x = xdev->update.box.p.x, y = xdev->update.box.p.y;
+ int w = xdev->update.box.q.x - x, h = xdev->update.box.q.y - y;
+
+ fit_fill_xywh(xdev, x, y, w, h);
+ if (w > 0 && h > 0) {
+ if (xdev->is_buffered) {
+ /* Copy from memory image to X server. */
+ const gx_device_memory *mdev =
+ (const gx_device_memory *)xdev->target;
+
+ /*
+ * The bbox device may have set the target to NULL
+ * temporarily. If this is the case, defer the screen
+ * update.
+ */
+ if (mdev == NULL)
+ return; /* don't reset */
+ x_copy_image(xdev, mdev->line_ptrs[y], x, mdev->raster,
+ x, y, w, h);
+ }
+ if (xdev->bpixmap) {
+ /* Copy from X backing pixmap to screen. */
+
+ X_SET_FUNCTION(xdev, GXcopy);
+ XCopyArea(xdev->dpy, xdev->bpixmap, xdev->win, xdev->gc,
+ x, y, w, h, x, y);
+ }
+ }
+ update_init(xdev);
}
}
@@ -1103,33 +1102,33 @@ x_update_add(gx_device_X * xdev, int xo, int yo, int w, int h)
xdev->update.area = new_up_area;
xdev->update.total += added;
if (!xdev->AlwaysUpdate &&
- xdev->update.count < xdev->MaxBufferedCount &&
- xdev->update.area < xdev->MaxBufferedArea &&
- xdev->update.total < xdev->MaxBufferedTotal
- ) {
- /*
- * Test whether adding this rectangle would result in too much being
- * copied unnecessarily. The fraction of new_up_area used in the
- * following test is not particularly critical; using a denominator
- * that is a power of 2 eliminates a divide.
- */
- if (nw + nh >= 70 && (nw | nh) >= 16 &&
- old_area + added < new_up_area - (new_up_area >> 2)
- )
- DO_NOTHING;
- else {
- xdev->update.box = u;
- return;
- }
+ xdev->update.count < xdev->MaxBufferedCount &&
+ xdev->update.area < xdev->MaxBufferedArea &&
+ xdev->update.total < xdev->MaxBufferedTotal
+ ) {
+ /*
+ * Test whether adding this rectangle would result in too much being
+ * copied unnecessarily. The fraction of new_up_area used in the
+ * following test is not particularly critical; using a denominator
+ * that is a power of 2 eliminates a divide.
+ */
+ if (nw + nh >= 70 && (nw | nh) >= 16 &&
+ old_area + added < new_up_area - (new_up_area >> 2)
+ )
+ DO_NOTHING;
+ else {
+ xdev->update.box = u;
+ return;
+ }
}
if (xdev->is_buffered && (xdev->target == NULL))
- xdev->update.box = u; /* update deferred since bbox has target disabled */
+ xdev->update.box = u; /* update deferred since bbox has target disabled */
else {
- update_do_flush(xdev);
- xdev->update.box.p.x = xo, xdev->update.box.p.y = yo;
- xdev->update.box.q.x = xe, xdev->update.box.q.y = ye;
- xdev->update.count = 1;
- xdev->update.area = xdev->update.total = added;
+ update_do_flush(xdev);
+ xdev->update.box.p.x = xo, xdev->update.box.p.y = yo;
+ xdev->update.box.q.x = xe, xdev->update.box.q.y = ye;
+ xdev->update.count = 1;
+ xdev->update.area = xdev->update.total = added;
}
}
@@ -1138,7 +1137,7 @@ static void
do_flush_text(gx_device_X * xdev)
{
if (!IN_TEXT(xdev))
- return;
+ return;
DRAW_TEXT(xdev);
xdev->text.item_count = xdev->text.char_count = 0;
}
@@ -1169,7 +1168,7 @@ x_bbox_add_rect(void *pdata, fixed x0, fixed y0, fixed x1, fixed y1)
int x = fixed2int(x0), y = fixed2int(y0);
x_update_add(xdev, x, y, fixed2int_ceiling(x1) - x,
- fixed2int_ceiling(y1) - y);
+ fixed2int_ceiling(y1) - y);
}
static bool
x_bbox_in_rect(const void *pdata, const gs_fixed_rect *pbox)
@@ -1192,7 +1191,7 @@ const gx_device_bbox_procs_t gdev_x_box_procs = {
*/
static int
alt_put_image(gx_device *dev, Display *dpy, Drawable win, GC gc, XImage *pi,
- int sx, int sy, int dx, int dy, unsigned w, unsigned h)
+ int sx, int sy, int dx, int dy, unsigned w, unsigned h)
{
int raster = pi->bytes_per_line;
byte *data = (byte *) pi->data + sy * raster + (sx >> 3);
@@ -1206,80 +1205,80 @@ alt_put_image(gx_device *dev, Display *dpy, Drawable win, GC gc, XImage *pi,
#ifdef DEBUG
if (pi->format != XYBitmap || pi->byte_order != MSBFirst ||
- pi->bitmap_bit_order != MSBFirst || pi->depth != 1
- ) {
- lprintf("alt_put_image: unimplemented parameter values!\n");
- return_error(gs_error_rangecheck);
+ pi->bitmap_bit_order != MSBFirst || pi->depth != 1
+ ) {
+ lprintf("alt_put_image: unimplemented parameter values!\n");
+ return_error(gs_error_rangecheck);
}
#endif
XGetGCValues(dpy, gc, (GCFunction | GCForeground | GCBackground), &gcv);
if (gcv.function == GXcopy) {
- XSetForeground(dpy, gc, gcv.background);
- XFillRectangle(dpy, win, gc, dx, dy, w, h);
- XSetForeground(dpy, gc, gcv.foreground);
+ XSetForeground(dpy, gc, gcv.background);
+ XFillRectangle(dpy, win, gc, dx, dy, w, h);
+ XSetForeground(dpy, gc, gcv.foreground);
} else if (gcv.function == GXand) {
- /* The only cases used above are fc = ~0 or bc = ~0. */
+ /* The only cases used above are fc = ~0 or bc = ~0. */
#ifdef DEBUG
- if (gcv.foreground != ~(x_pixel)0 && gcv.background != ~(x_pixel)0) {
- lprintf("alt_put_image: unimplemented GXand case!\n");
- return_error(gs_error_rangecheck);
- }
+ if (gcv.foreground != ~(x_pixel)0 && gcv.background != ~(x_pixel)0) {
+ lprintf("alt_put_image: unimplemented GXand case!\n");
+ return_error(gs_error_rangecheck);
+ }
#endif
- if (gcv.background != ~(x_pixel) 0) {
- XSetForeground(dpy, gc, gcv.background);
- invert = 0xff;
- }
+ if (gcv.background != ~(x_pixel) 0) {
+ XSetForeground(dpy, gc, gcv.background);
+ invert = 0xff;
+ }
} else if (gcv.function == GXor) {
- /* The only cases used above are fc = 0 or bc = 0. */
+ /* The only cases used above are fc = 0 or bc = 0. */
#ifdef DEBUG
- if (gcv.foreground != 0 && gcv.background != 0) {
- lprintf("alt_put_image: unimplemented GXor case!\n");
- return_error(gs_error_rangecheck);
- }
+ if (gcv.foreground != 0 && gcv.background != 0) {
+ lprintf("alt_put_image: unimplemented GXor case!\n");
+ return_error(gs_error_rangecheck);
+ }
#endif
- if (gcv.background != 0) {
- XSetForeground(dpy, gc, gcv.background);
- invert = 0xff;
- }
+ if (gcv.background != 0) {
+ XSetForeground(dpy, gc, gcv.background);
+ invert = 0xff;
+ }
} else {
- lprintf("alt_put_image: unimplemented function.\n");
- return_error(gs_error_rangecheck);
+ lprintf("alt_put_image: unimplemented function.\n");
+ return_error(gs_error_rangecheck);
}
for (yi = 0; yi < h; yi++, data += raster) {
- int mask = init_mask;
- byte *dp = data;
- int xi = 0;
-
- while (xi < w) {
- if ((*dp ^ invert) & mask) {
- int xleft = xi;
-
- if (rp == &rects[NUM_RECTS]) {
- XFillRectangles(dpy, win, gc, rects, NUM_RECTS);
- rp = rects;
- }
- /* Scan over a run of 1-bits */
- rp->x = dx + xi, rp->y = dy + yi;
- do {
- if (!(mask >>= 1))
- mask = 0x80, dp++;
- xi++;
- } while (xi < w && ((*dp ^ invert) & mask));
- rp->width = xi - xleft, rp->height = 1;
- rp++;
- } else {
- if (!(mask >>= 1))
- mask = 0x80, dp++;
- xi++;
- }
- }
+ int mask = init_mask;
+ byte *dp = data;
+ int xi = 0;
+
+ while (xi < w) {
+ if ((*dp ^ invert) & mask) {
+ int xleft = xi;
+
+ if (rp == &rects[NUM_RECTS]) {
+ XFillRectangles(dpy, win, gc, rects, NUM_RECTS);
+ rp = rects;
+ }
+ /* Scan over a run of 1-bits */
+ rp->x = dx + xi, rp->y = dy + yi;
+ do {
+ if (!(mask >>= 1))
+ mask = 0x80, dp++;
+ xi++;
+ } while (xi < w && ((*dp ^ invert) & mask));
+ rp->width = xi - xleft, rp->height = 1;
+ rp++;
+ } else {
+ if (!(mask >>= 1))
+ mask = 0x80, dp++;
+ xi++;
+ }
+ }
}
XFillRectangles(dpy, win, gc, rects, rp - rects);
if (invert)
- XSetForeground(dpy, gc, gcv.foreground);
+ XSetForeground(dpy, gc, gcv.foreground);
return 0;
#undef NUM_RECTS
}
diff --git a/gs/base/gdevx.h b/gs/base/gdevx.h
index 8dcb447bf..f7350f935 100644
--- a/gs/base/gdevx.h
+++ b/gs/base/gdevx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -79,16 +79,16 @@ typedef struct gx_device_X_s {
/* A backing pixmap so X will handle exposure automatically */
Pixmap bpixmap; /* 0 if useBackingPixmap is false, */
- /* or if it can't be allocated */
+ /* or if it can't be allocated */
int ghostview; /* flag to tell if ghostview is in control */
Window mwin; /* window to receive ghostview messages */
gs_matrix initial_matrix; /* the initial transformation */
Atom NEXT, PAGE, DONE; /* Atoms used to talk to ghostview */
struct {
- gs_int_rect box; /* region needing updating */
- long area; /* total area of update */
- long total; /* total of individual area updates */
- int count; /* # of updates since flush */
+ gs_int_rect box; /* region needing updating */
+ long area; /* total area of update */
+ long total; /* total of individual area updates */
+ int count; /* # of updates since flush */
} update;
Pixmap dest; /* bpixmap if non-0, else use win */
x_pixel colors_or; /* 'or' of all device colors used so far */
@@ -96,19 +96,19 @@ typedef struct gx_device_X_s {
/* An intermediate pixmap for the stencil case of copy_mono */
struct {
- Pixmap pixmap;
- GC gc;
- int raster, height;
+ Pixmap pixmap;
+ GC gc;
+ int raster, height;
} cp;
/* Structure for dealing with the halftone tile. */
/* Later this might become a multi-element cache. */
struct {
- Pixmap pixmap;
- Pixmap no_pixmap; /* kludge to get around X bug */
- gx_bitmap_id id;
- int width, height, raster;
- x_pixel fore_c, back_c;
+ Pixmap pixmap;
+ Pixmap no_pixmap; /* kludge to get around X bug */
+ gx_bitmap_id id;
+ int width, height, raster;
+ x_pixel fore_c, back_c;
} ht;
/* Cache the function and fill style from the GC */
@@ -213,15 +213,15 @@ typedef struct gx_device_X_s {
* Buffered text awaiting display.
*/
struct {
- int item_count;
+ int item_count;
#define IN_TEXT(xdev) ((xdev)->text.item_count != 0)
- int char_count;
- gs_int_point origin;
- int x; /* after last buffered char */
+ int char_count;
+ gs_int_point origin;
+ int x; /* after last buffered char */
#define MAX_TEXT_ITEMS 12
- XTextItem items[MAX_TEXT_ITEMS];
+ XTextItem items[MAX_TEXT_ITEMS];
#define MAX_TEXT_CHARS 25
- char chars[MAX_TEXT_CHARS];
+ char chars[MAX_TEXT_CHARS];
} text;
/*
* All the GC parameters are set correctly when we buffer the first
@@ -230,7 +230,7 @@ typedef struct gx_device_X_s {
*/
#define DRAW_TEXT(xdev)\
XDrawText(xdev->dpy, xdev->dest, xdev->gc, xdev->text.origin.x,\
- xdev->text.origin.y, xdev->text.items, xdev->text.item_count)
+ xdev->text.origin.y, xdev->text.items, xdev->text.item_count)
} gx_device_X;
#define private_st_device_X() /* in gdevx.c */\
diff --git a/gs/base/gdevxalt.c b/gs/base/gdevxalt.c
index ff131cc8a..a9d725dbf 100644
--- a/gs/base/gdevxalt.c
+++ b/gs/base/gdevxalt.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,10 +42,10 @@ typedef struct {
dev_proc_map_color_rgb((*alt_map_color));
} gx_device_X_wrapper;
#define X_WRAPPER_DATA(amc_proc)\
- /* gx_device_forward_common */\
+ /* gx_device_forward_common */\
{0}, /* std_procs */\
0, /* target */\
- /* gx_device_X_wrapper */\
+ /* gx_device_X_wrapper */\
{0}, /* cache */\
amc_proc
gs_private_st_suffix_add0_final(st_device_X_wrapper, gx_device_X_wrapper,
@@ -68,7 +68,7 @@ x_clear_color_cache(gx_device /*gx_device_X_wrapper */ * dev)
int i;
for (i = 0; i < countof(xdev->color_cache); ++i)
- xdev->color_cache[i] = gx_no_color_index;
+ xdev->color_cache[i] = gx_no_color_index;
gx_device_decache_colors(dev);
}
@@ -84,7 +84,7 @@ x_wrap_open(gx_device * dev)
return code;
rcode = (*dev_proc(tdev, open_device)) (tdev);
if (rcode < 0)
- return rcode;
+ return rcode;
tdev->is_open = true;
code = get_target_info(dev);
return (code < 0 ? code : rcode);
@@ -127,7 +127,7 @@ x_wrap_close(gx_device * dev)
static int
x_wrap_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_device *tdev;
int code;
@@ -135,13 +135,13 @@ x_wrap_map_color_rgb(gx_device * dev, gx_color_index color,
if ((code = get_dev_target(&tdev, dev)) < 0)
return code;
return (*dev_proc(tdev, map_color_rgb)) (tdev,
- x_alt_map_color(dev, color),
- prgb);
+ x_alt_map_color(dev, color),
+ prgb);
}
static int
x_wrap_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device *tdev;
int code;
@@ -149,14 +149,14 @@ x_wrap_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
if ((code = get_dev_target(&tdev, dev)) < 0)
return code;
return (*dev_proc(tdev, fill_rectangle)) (tdev, x, y, w, h,
- x_alt_map_color(dev, color));
+ x_alt_map_color(dev, color));
}
static int
x_wrap_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ const byte * base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device *tdev;
int code;
@@ -164,15 +164,15 @@ x_wrap_copy_mono(gx_device * dev,
if ((code = get_dev_target(&tdev, dev)) < 0)
return code;
return (*dev_proc(tdev, copy_mono)) (tdev, base, sourcex, raster, id,
- x, y, w, h,
- x_alt_map_color(dev, zero),
- x_alt_map_color(dev, one));
+ x, y, w, h,
+ x_alt_map_color(dev, zero),
+ x_alt_map_color(dev, one));
}
static int
x_wrap_copy_color(gx_device * dev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device *tdev;
@@ -188,62 +188,61 @@ x_wrap_copy_color(gx_device * dev, const byte * base, int sourcex,
return code;
/* Device pixels must be an integral number of bytes. */
if (tdev->color_info.depth & 7)
- return gx_default_copy_color(dev, base, sourcex, raster, id,
- x, y, w, h);
+ return gx_default_copy_color(dev, base, sourcex, raster, id,
+ x, y, w, h);
depth_bytes = tdev->color_info.depth >> 3;
source_bits = dev->color_info.depth;
{
- int mapped_pixels = mapped_bytes / depth_bytes;
+ int mapped_pixels = mapped_bytes / depth_bytes;
- if (w > mapped_pixels >> 1)
- block_w = min(w, mapped_pixels), block_h = 1;
- else
- block_w = w, block_h = mapped_pixels / w;
+ if (w > mapped_pixels >> 1)
+ block_w = min(w, mapped_pixels), block_h = 1;
+ else
+ block_w = w, block_h = mapped_pixels / w;
}
for (yblock = y; yblock < y + h; yblock += block_h)
- for (xblock = x; xblock < x + w; xblock += block_w) {
- byte *p = mapped;
- int xend = min(xblock + block_w, x + w);
- int yend = min(yblock + block_h, y + h);
- int xcur, ycur;
- int code;
-
- for (ycur = yblock; ycur < yend; ++ycur)
- for (xcur = xblock; xcur < xend; ++xcur) {
- int sbit = (xcur - x + sourcex) * source_bits;
- uint sbyte =
- base[(ycur - y) * raster + (sbit >> 3)];
- uint spixel =
- ((sbyte << (sbit & 7)) & 0xff) >> (8 - source_bits);
- gx_color_index cindex =
- ((gx_device_X_wrapper *) dev)->color_cache[spixel];
-
- if (cindex == gx_no_color_index)
- cindex = x_alt_map_color(dev, spixel);
- switch (depth_bytes) {
- case 4:
- *p++ = (byte) (cindex >> 24);
- case 3:
- *p++ = (byte) (cindex >> 16);
- case 2:
- *p++ = (byte) (cindex >> 8);
- default /*case 1 */ :
- *p++ = (byte) cindex;
- }
- }
- code = (*dev_proc(tdev, copy_color))
- (tdev, mapped, 0, (xend - xblock) * depth_bytes, gx_no_bitmap_id,
- xblock, yblock, xend - xblock, yend - yblock);
- if (code < 0)
- return code;
- }
+ for (xblock = x; xblock < x + w; xblock += block_w) {
+ byte *p = mapped;
+ int xend = min(xblock + block_w, x + w);
+ int yend = min(yblock + block_h, y + h);
+ int xcur, ycur;
+ int code;
+
+ for (ycur = yblock; ycur < yend; ++ycur)
+ for (xcur = xblock; xcur < xend; ++xcur) {
+ int sbit = (xcur - x + sourcex) * source_bits;
+ uint sbyte =
+ base[(ycur - y) * raster + (sbit >> 3)];
+ uint spixel =
+ ((sbyte << (sbit & 7)) & 0xff) >> (8 - source_bits);
+ gx_color_index cindex =
+ ((gx_device_X_wrapper *) dev)->color_cache[spixel];
+
+ if (cindex == gx_no_color_index)
+ cindex = x_alt_map_color(dev, spixel);
+ switch (depth_bytes) {
+ case 4:
+ *p++ = (byte) (cindex >> 24);
+ case 3:
+ *p++ = (byte) (cindex >> 16);
+ case 2:
+ *p++ = (byte) (cindex >> 8);
+ default /*case 1 */ :
+ *p++ = (byte) cindex;
+ }
+ }
+ code = (*dev_proc(tdev, copy_color))
+ (tdev, mapped, 0, (xend - xblock) * depth_bytes, gx_no_bitmap_id,
+ xblock, yblock, xend - xblock, yend - yblock);
+ if (code < 0)
+ return code;
+ }
return 0;
}
-
static int
x_forward_copy_color(gx_device * dev, const byte * base, int sourcex,
- int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device *tdev;
int code;
@@ -251,7 +250,7 @@ x_forward_copy_color(gx_device * dev, const byte * base, int sourcex,
if ((code = get_dev_target(&tdev, dev)) < 0)
return code;
return (*dev_proc(tdev, copy_color)) (tdev, base, sourcex, raster, id,
- x, y, w, h);
+ x, y, w, h);
}
static int
@@ -300,41 +299,41 @@ x_wrap_get_bits(gx_device * dev, int y, byte * str, byte ** actual_data)
dsize = (width * sdepth + 7) / 8;
row = gs_alloc_bytes(mem, dsize, "x_wrap_get_bits");
if (row == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = (*dev_proc(tdev, get_bits)) (tdev, y, row, &base);
if (code < 0)
- goto gx;
+ goto gx;
for (sbit = 0, xi = 0; xi < width; sbit += sdepth, ++xi) {
- const byte *sptr = base + (sbit >> 3);
- gx_color_index pixel;
- gx_color_value rgb[3];
- int i;
-
- if (sdepth <= 8)
- pixel = (*sptr >> (8 - sdepth - (sbit & 7))) & smask;
- else {
- pixel = 0;
- for (i = 0; i < sdepth; i += 8, ++sptr)
- pixel = (pixel << 8) + *sptr;
- }
- if (pixel != pixel_in) {
- (*dev_proc(tdev, map_color_rgb))(tdev, pixel, rgb);
- pixel_in = pixel;
- if (dev->color_info.num_components <= 3)
- pixel_out = (*dev_proc(dev, map_rgb_color))(dev, rgb);
- else {
- /* Convert RGB to CMYK. */
- gx_color_value c = gx_max_color_value - rgb[0];
- gx_color_value m = gx_max_color_value - rgb[1];
- gx_color_value y = gx_max_color_value - rgb[2];
- gx_color_value k = (c < m ? min(c, y) : min(m, y));
+ const byte *sptr = base + (sbit >> 3);
+ gx_color_index pixel;
+ gx_color_value rgb[3];
+ int i;
+
+ if (sdepth <= 8)
+ pixel = (*sptr >> (8 - sdepth - (sbit & 7))) & smask;
+ else {
+ pixel = 0;
+ for (i = 0; i < sdepth; i += 8, ++sptr)
+ pixel = (pixel << 8) + *sptr;
+ }
+ if (pixel != pixel_in) {
+ (*dev_proc(tdev, map_color_rgb))(tdev, pixel, rgb);
+ pixel_in = pixel;
+ if (dev->color_info.num_components <= 3)
+ pixel_out = (*dev_proc(dev, map_rgb_color))(dev, rgb);
+ else {
+ /* Convert RGB to CMYK. */
+ gx_color_value c = gx_max_color_value - rgb[0];
+ gx_color_value m = gx_max_color_value - rgb[1];
+ gx_color_value y = gx_max_color_value - rgb[2];
+ gx_color_value k = (c < m ? min(c, y) : min(m, y));
gx_color_value cmyk[4];
cmyk[0] = c - k; cmyk[1] = m - k; cmyk[2] = y - k; cmyk[3] = k;
- pixel_out = (*dev_proc(dev, map_cmyk_color))(dev, cmyk);
- }
- }
- LINE_ACCUM(pixel_out, depth);
+ pixel_out = (*dev_proc(dev, map_cmyk_color))(dev, cmyk);
+ }
+ }
+ LINE_ACCUM(pixel_out, depth);
}
LINE_ACCUM_STORE(depth);
gx:gs_free_object(mem, row, "x_wrap_get_bits");
@@ -355,7 +354,7 @@ x_wrap_get_params(gx_device * dev, gs_param_list * plist)
return code;
save_dev = *(gx_device_X *) tdev;
if (tdev->is_open)
- tdev->color_info = dev->color_info;
+ tdev->color_info = dev->color_info;
tdev->dname = dev->dname;
ecode = (*dev_proc(tdev, get_params)) (tdev, plist);
*(gx_device_X *) tdev = save_dev;
@@ -384,7 +383,7 @@ x_wrap_put_params(gx_device * dev, gs_param_list * plist)
tdev->color_info = cinfo;
tdev->dname = dname;
if (rcode < 0)
- return rcode;
+ return rcode;
code = get_target_info(dev);
return (code < 0 ? code : rcode);
}
@@ -398,16 +397,16 @@ get_dev_target(gx_device ** ptdev, gx_device * dev)
gx_device *tdev = ((gx_device_forward *) dev)->target;
if (tdev == 0) {
- /* Create an X device instance. */
- int code = gs_copydevice(&tdev, (const gx_device *)&gs_x11_device,
- dev->memory);
+ /* Create an X device instance. */
+ int code = gs_copydevice(&tdev, (const gx_device *)&gs_x11_device,
+ dev->memory);
- if (code < 0)
- return 0;
+ if (code < 0)
+ return 0;
check_device_separable(tdev);
- gx_device_fill_in_procs(tdev);
- gx_device_set_target((gx_device_forward *)dev, tdev);
- x_clear_color_cache(dev);
+ gx_device_fill_in_procs(tdev);
+ gx_device_set_target((gx_device_forward *)dev, tdev);
+ x_clear_color_cache(dev);
}
*ptdev = tdev;
return 0;
@@ -437,12 +436,12 @@ get_target_info(gx_device * dev)
copy2(Margins);
copy4(HWMargins);
if (dev->color_info.num_components == 3) {
- /* Leave the anti-aliasing information alone. */
- gx_device_anti_alias_info aa;
+ /* Leave the anti-aliasing information alone. */
+ gx_device_anti_alias_info aa;
- aa = dev->color_info.anti_alias;
- copy(color_info);
- dev->color_info.anti_alias = aa;
+ aa = dev->color_info.anti_alias;
+ copy(color_info);
+ dev->color_info.anti_alias = aa;
}
#undef copy4
@@ -465,21 +464,21 @@ x_alt_map_color(gx_device * dev, gx_color_index color)
int code;
if (color == gx_no_color_index)
- return color;
+ return color;
if (color < 16) {
- cindex = ((gx_device_X_wrapper *) dev)->color_cache[color];
- if (cindex != gx_no_color_index)
- return cindex;
+ cindex = ((gx_device_X_wrapper *) dev)->color_cache[color];
+ if (cindex != gx_no_color_index)
+ return cindex;
}
if ((code = get_dev_target(&tdev, dev)) < 0)
return code;
result = xdev->alt_map_color(dev, color, rgb);
if (result >= 0)
- cindex = result;
+ cindex = result;
else
- cindex = dev_proc(tdev, map_rgb_color)(tdev, rgb);
+ cindex = dev_proc(tdev, map_rgb_color)(tdev, rgb);
if (color < 16)
- ((gx_device_X_wrapper *) dev)->color_cache[color] = cindex;
+ ((gx_device_X_wrapper *) dev)->color_cache[color] = cindex;
return cindex;
}
@@ -521,41 +520,41 @@ static const gx_device_procs x_cmyk_procs = {
/* The instances are public. */
const gx_device_X_wrapper gs_x11cmyk_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_cmyk_procs, "x11cmyk",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 4, 4, 1, 1, 2, 2),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 4, 4, 1, 1, 2, 2),
X_WRAPPER_DATA(x_cmyk_alt_map_color)
};
const gx_device_X_wrapper gs_x11cmyk2_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_cmyk_procs, "x11cmyk2",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 4, 8, 3, 3, 4, 4),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 4, 8, 3, 3, 4, 4),
X_WRAPPER_DATA(x_cmyk_alt_map_color)
};
const gx_device_X_wrapper gs_x11cmyk4_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_cmyk_procs, "x11cmyk4",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 4, 16, 15, 15, 16, 16),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 4, 16, 15, 15, 16, 16),
X_WRAPPER_DATA(x_cmyk_alt_map_color)
};
const gx_device_X_wrapper gs_x11cmyk8_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_cmyk_procs, "x11cmyk8",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 4, 32, 255, 255, 256, 256),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 4, 32, 255, 255, 256, 256),
X_WRAPPER_DATA(x_cmyk_alt_map_color)
};
/* Map a fake color to RGB. */
static int
x_cmyk_alt_map_color(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
int shift = dev->color_info.depth >> 2;
int mask = (1 << shift) - 1;
@@ -577,9 +576,9 @@ static void
x_cmyk_set_procs(gx_device *dev)
{
if (dev->color_info.depth == 4) {
- set_dev_proc(dev, map_cmyk_color, cmyk_1bit_map_cmyk_color);
+ set_dev_proc(dev, map_cmyk_color, cmyk_1bit_map_cmyk_color);
} else {
- set_dev_proc(dev, map_cmyk_color, x_cmyk_map_cmyk_color);
+ set_dev_proc(dev, map_cmyk_color, x_cmyk_map_cmyk_color);
}
}
@@ -591,7 +590,7 @@ x_cmyk_open(gx_device *dev)
int code = x_wrap_open(dev);
if (code >= 0)
- x_cmyk_set_procs(dev);
+ x_cmyk_set_procs(dev);
return code;
}
@@ -601,7 +600,7 @@ x_cmyk_put_params(gx_device * dev, gs_param_list * plist)
int code = x_wrap_put_params(dev, plist);
if (code >= 0)
- x_cmyk_set_procs(dev);
+ x_cmyk_set_procs(dev);
return code;
}
@@ -651,17 +650,17 @@ static const gx_device_procs x_mono_procs = {
/* The instance is public. */
const gx_device_X_wrapper gs_x11mono_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_mono_procs, "x11mono",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 1, 1, 1, 0, 2, 0),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 1, 1, 1, 0, 2, 0),
X_WRAPPER_DATA(x_mono_alt_map_color)
};
/* Map a fake color to RGB. */
static int
x_mono_alt_map_color(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
rgb[0] = rgb[1] = rgb[2] = (color ? 0 : gx_max_color_value);
return -1;
@@ -701,29 +700,29 @@ static const gx_device_procs x_gray_procs = {
/* The instances are public. */
const gx_device_X_wrapper gs_x11gray2_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_gray_procs, "x11gray2",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 1, 2, 3, 0, 4, 0),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 1, 2, 3, 0, 4, 0),
X_WRAPPER_DATA(x_gray_alt_map_color)
};
const gx_device_X_wrapper gs_x11gray4_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_gray_procs, "x11gray4",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 1, 4, 15, 0, 16, 0),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 1, 4, 15, 0, 16, 0),
X_WRAPPER_DATA(x_gray_alt_map_color)
};
/* Map a fake color to RGB. */
static int
x_gray_alt_map_color(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
rgb[0] = rgb[1] = rgb[2] =
- color * gx_max_color_value / dev->color_info.max_gray;
+ color * gx_max_color_value / dev->color_info.max_gray;
return -1;
}
@@ -741,7 +740,7 @@ x_alpha_map_rgb_alpha_color(gx_device * dev,
cv[0] = r; cv[1] = g; cv[2] = b;
color = gx_forward_map_rgb_color(dev, cv);
return (abyte == 0 ? (gx_color_index)0xff << 24 :
- ((gx_color_index) (abyte ^ 0xff) << 24) + color);
+ ((gx_color_index) (abyte ^ 0xff) << 24) + color);
}
/* ---------------- Permuted RGB16/32 procedures ---------------- */
@@ -783,10 +782,10 @@ static const gx_device_procs x_rg16x_procs = {
};
const gx_device_X_wrapper gs_x11rg16x_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_rg16x_procs, "x11rg16x",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 3, 16, 31, 31, 32, 32),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 3, 16, 31, 31, 32, 32),
X_WRAPPER_DATA(x_rg16x_alt_map_color)
};
@@ -795,10 +794,10 @@ static const gx_device_procs x_rg32x_procs = {
};
const gx_device_X_wrapper gs_x11rg32x_device = {
std_device_dci_type_body(gx_device_X_wrapper, &x_rg32x_procs, "x11rg32x",
- &st_device_X_wrapper,
- FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
- FAKE_RES, FAKE_RES, /* x and y density (nominal) */
- 3, 32, 1023, 1023, 1024, 1024),
+ &st_device_X_wrapper,
+ FAKE_RES * 85 / 10, FAKE_RES * 11, /* x and y extent (nominal) */
+ FAKE_RES, FAKE_RES, /* x and y density (nominal) */
+ 3, 32, 1023, 1023, 1024, 1024),
X_WRAPPER_DATA(x_rg32x_alt_map_color)
};
@@ -810,8 +809,8 @@ x_rg16x_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value r, g, b;
r = cv[0]; g = cv[1]; b = cv[2];
return (r >> (gx_color_value_bits - 6)) +
- ((g >> (gx_color_value_bits - 5)) << 11) +
- ((b >> (gx_color_value_bits - 5)) << 6);
+ ((g >> (gx_color_value_bits - 5)) << 11) +
+ ((b >> (gx_color_value_bits - 5)) << 6);
}
static gx_color_index
x_rg32x_map_rgb_color(gx_device * dev, const gx_color_value cv[])
@@ -820,14 +819,14 @@ x_rg32x_map_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value r, g, b;
r = cv[0]; g = cv[1]; b = cv[2];
return (r >> (gx_color_value_bits - 11)) +
- ((gx_color_index)(g >> (gx_color_value_bits - 11)) << 21) +
- ((gx_color_index)(b >> (gx_color_value_bits - 10)) << 11);
+ ((gx_color_index)(g >> (gx_color_value_bits - 11)) << 21) +
+ ((gx_color_index)(b >> (gx_color_value_bits - 10)) << 11);
}
/* Map a fake color to RGB. */
static int
x_rg16x_alt_map_color(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
rgb[0] = (color & 0x3f) * gx_max_color_value / 0x3f;
rgb[1] = ((color >> 11) & 0x1f) * gx_max_color_value / 0x1f;
@@ -836,7 +835,7 @@ x_rg16x_alt_map_color(gx_device * dev, gx_color_index color,
}
static int
x_rg32x_alt_map_color(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
rgb[0] = (color & 0x7ff) * gx_max_color_value / 0x7ff;
rgb[1] = ((color >> 21) & 0x7ff) * gx_max_color_value / 0x7ff;
diff --git a/gs/base/gdevxcf.c b/gs/base/gdevxcf.c
index 11c1f76df..62755cb5b 100644
--- a/gs/base/gdevxcf.c
+++ b/gs/base/gdevxcf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,6 @@
typedef void* gcmmhprofile_t;
#endif
-
#ifndef MAX_CHAN
# define MAX_CHAN 8
#endif
@@ -124,7 +123,7 @@ typedef struct xcf_device_s {
*/
gs_separation_names separation_order;
- /* ICC color profile objects, for color conversion.
+ /* ICC color profile objects, for color conversion.
These are all device link profiles. At least that
is how it appears looking at how this code
was written to work with the old icclib. Just
@@ -151,100 +150,98 @@ typedef struct xcf_device_s {
*/
#define device_procs(get_color_mapping_procs)\
{ gdev_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page, /* output_page */\
- xcf_prn_close, /* close */\
- NULL, /* map_rgb_color - not used */\
- xcf_map_color_rgb, /* map_color_rgb */\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- xcf_get_params, /* get_params */\
- xcf_put_params, /* put_params */\
- NULL, /* map_cmyk_color - not used */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- NULL, /* fill_path */\
- NULL, /* stroke_path */\
- NULL, /* fill_mask */\
- NULL, /* fill_trapezoid */\
- NULL, /* fill_parallelogram */\
- NULL, /* fill_triangle */\
- NULL, /* draw_thin_line */\
- NULL, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL, /* strip_copy_rop */\
- NULL, /* get_clipping_box */\
- NULL, /* begin_typed_image */\
- NULL, /* get_bits_rectangle */\
- NULL, /* map_color_rgb_alpha */\
- NULL, /* create_compositor */\
- NULL, /* get_hardware_params */\
- NULL, /* text_begin */\
- NULL, /* finish_copydevice */\
- NULL, /* begin_transparency_group */\
- NULL, /* end_transparency_group */\
- NULL, /* begin_transparency_mask */\
- NULL, /* end_transparency_mask */\
- NULL, /* discard_transparency_layer */\
- get_color_mapping_procs, /* get_color_mapping_procs */\
- xcf_get_color_comp_index, /* get_color_comp_index */\
- xcf_encode_color, /* encode_color */\
- xcf_decode_color /* decode_color */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page, /* output_page */\
+ xcf_prn_close, /* close */\
+ NULL, /* map_rgb_color - not used */\
+ xcf_map_color_rgb, /* map_color_rgb */\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ xcf_get_params, /* get_params */\
+ xcf_put_params, /* put_params */\
+ NULL, /* map_cmyk_color - not used */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ NULL, /* fill_path */\
+ NULL, /* stroke_path */\
+ NULL, /* fill_mask */\
+ NULL, /* fill_trapezoid */\
+ NULL, /* fill_parallelogram */\
+ NULL, /* fill_triangle */\
+ NULL, /* draw_thin_line */\
+ NULL, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL, /* strip_copy_rop */\
+ NULL, /* get_clipping_box */\
+ NULL, /* begin_typed_image */\
+ NULL, /* get_bits_rectangle */\
+ NULL, /* map_color_rgb_alpha */\
+ NULL, /* create_compositor */\
+ NULL, /* get_hardware_params */\
+ NULL, /* text_begin */\
+ NULL, /* finish_copydevice */\
+ NULL, /* begin_transparency_group */\
+ NULL, /* end_transparency_group */\
+ NULL, /* begin_transparency_mask */\
+ NULL, /* end_transparency_mask */\
+ NULL, /* discard_transparency_layer */\
+ get_color_mapping_procs, /* get_color_mapping_procs */\
+ xcf_get_color_comp_index, /* get_color_comp_index */\
+ xcf_encode_color, /* encode_color */\
+ xcf_decode_color /* decode_color */\
}
-
static const fixed_colorant_names_list DeviceGrayComponents = {
- "Gray",
- 0 /* List terminator */
+ "Gray",
+ 0 /* List terminator */
};
static const fixed_colorant_names_list DeviceRGBComponents = {
- "Red",
- "Green",
- "Blue",
- 0 /* List terminator */
+ "Red",
+ "Green",
+ "Blue",
+ 0 /* List terminator */
};
static const fixed_colorant_names_list DeviceCMYKComponents = {
- "Cyan",
- "Magenta",
- "Yellow",
- "Black",
- 0 /* List terminator */
+ "Cyan",
+ "Magenta",
+ "Yellow",
+ "Black",
+ 0 /* List terminator */
};
-
/*
* Example device with RGB and spot color support
*/
static const gx_device_procs spot_rgb_procs = device_procs(get_spotrgb_color_mapping_procs);
const xcf_device gs_xcf_device =
-{
+{
prn_device_body_extended(xcf_device, spot_rgb_procs, "xcf",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* X and Y hardware resolution */
- 0, 0, 0, 0, /* margins */
- GX_DEVICE_COLOR_MAX_COMPONENTS, 3, /* MaxComponents, NumComp */
- GX_CINFO_POLARITY_ADDITIVE, /* Polarity */
- 24, 0, /* Depth, Gray_index, */
- 255, 255, 256, 256, /* MaxGray, MaxColor, DitherGray, DitherColor */
- GX_CINFO_UNKNOWN_SEP_LIN, /* Let check_device_separable set up values */
- "DeviceN", /* Process color model name */
- xcf_print_page), /* Printer page print routine */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* X and Y hardware resolution */
+ 0, 0, 0, 0, /* margins */
+ GX_DEVICE_COLOR_MAX_COMPONENTS, 3, /* MaxComponents, NumComp */
+ GX_CINFO_POLARITY_ADDITIVE, /* Polarity */
+ 24, 0, /* Depth, Gray_index, */
+ 255, 255, 256, 256, /* MaxGray, MaxColor, DitherGray, DitherColor */
+ GX_CINFO_UNKNOWN_SEP_LIN, /* Let check_device_separable set up values */
+ "DeviceN", /* Process color model name */
+ xcf_print_page), /* Printer page print routine */
/* DeviceN device specific parameters */
XCF_DEVICE_RGB, /* Color model */
8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -257,18 +254,18 @@ const xcf_device gs_xcf_device =
static const gx_device_procs spot_cmyk_procs = device_procs(get_xcf_color_mapping_procs);
const xcf_device gs_xcfcmyk_device =
-{
+{
prn_device_body_extended(xcf_device, spot_cmyk_procs, "xcfcmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI, /* X and Y hardware resolution */
- 0, 0, 0, 0, /* margins */
- GX_DEVICE_COLOR_MAX_COMPONENTS, 4, /* MaxComponents, NumComp */
- GX_CINFO_POLARITY_SUBTRACTIVE, /* Polarity */
- 32, 0, /* Depth, Gray_index, */
- 255, 255, 256, 256, /* MaxGray, MaxColor, DitherGray, DitherColor */
- GX_CINFO_UNKNOWN_SEP_LIN, /* Let check_device_separable set up values */
- "DeviceN", /* Process color model name */
- xcf_print_page), /* Printer page print routine */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI, /* X and Y hardware resolution */
+ 0, 0, 0, 0, /* margins */
+ GX_DEVICE_COLOR_MAX_COMPONENTS, 4, /* MaxComponents, NumComp */
+ GX_CINFO_POLARITY_SUBTRACTIVE, /* Polarity */
+ 32, 0, /* Depth, Gray_index, */
+ 255, 255, 256, 256, /* MaxGray, MaxColor, DitherGray, DitherColor */
+ GX_CINFO_UNKNOWN_SEP_LIN, /* Let check_device_separable set up values */
+ "DeviceN", /* Process color model name */
+ xcf_print_page), /* Printer page print routine */
/* DeviceN device specific parameters */
XCF_DEVICE_CMYK, /* Color model */
8, /* Bits per color - must match ncomp, depth, etc. above */
@@ -295,7 +292,7 @@ gray_cs_to_spotrgb_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotrgb_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
int i = ((xcf_device *)dev)->separation_names.num_names;
@@ -332,7 +329,7 @@ gray_cs_to_spotcmyk_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotcmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
xcf_device *xdev = (xcf_device *)dev;
@@ -341,7 +338,7 @@ rgb_cs_to_spotcmyk_cm(gx_device * dev, const gs_imager_state *pis,
color_rgb_to_cmyk(r, g, b, pis, out, dev->memory);
for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ out[4 + i] = 0;
}
static void
@@ -357,7 +354,7 @@ cmyk_cs_to_spotcmyk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out
out[2] = y;
out[3] = k;
for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ out[4 + i] = 0;
}
static void
@@ -371,31 +368,31 @@ cmyk_cs_to_spotn_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
int i;
if (link != NULL) {
- unsigned short in[4];
- unsigned short tmp[MAX_CHAN];
- int outn = xdev->cmyk_profile->num_comps_out;
+ unsigned short in[4];
+ unsigned short tmp[MAX_CHAN];
+ int outn = xdev->cmyk_profile->num_comps_out;
- in[0] = frac2ushort(c);
- in[1] = frac2ushort(m);
- in[2] = frac2ushort(y);
- in[3] = frac2ushort(k);
+ in[0] = frac2ushort(c);
+ in[1] = frac2ushort(m);
+ in[2] = frac2ushort(y);
+ in[3] = frac2ushort(k);
gscms_transform_color(link, &(in[0]),
&(tmp[0]), 2, NULL);
- for (i = 0; i < outn; i++)
- out[i] = ushort2frac(tmp[i]);
- for (; i < n + 4; i++)
- out[i] = 0;
+ for (i = 0; i < outn; i++)
+ out[i] = ushort2frac(tmp[i]);
+ for (; i < n + 4; i++)
+ out[i] = 0;
} else {
- /* If no profile given, assume CMYK */
- out[0] = c;
- out[1] = m;
- out[2] = y;
- out[3] = k;
- for(i = 0; i < n; i++) /* Clear spot colors */
- out[4 + i] = 0;
+ /* If no profile given, assume CMYK */
+ out[0] = c;
+ out[1] = m;
+ out[2] = y;
+ out[3] = k;
+ for(i = 0; i < n; i++) /* Clear spot colors */
+ out[4 + i] = 0;
}
}
@@ -409,7 +406,7 @@ gray_cs_to_spotn_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_spotn_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
xcf_device *xdev = (xcf_device *)dev;
@@ -418,27 +415,27 @@ rgb_cs_to_spotn_cm(gx_device * dev, const gs_imager_state *pis,
int i;
if (link != NULL) {
- unsigned short in[3];
- unsigned short tmp[MAX_CHAN];
- int outn = xdev->rgb_profile->num_comps_out;
+ unsigned short in[3];
+ unsigned short tmp[MAX_CHAN];
+ int outn = xdev->rgb_profile->num_comps_out;
- in[0] = frac2ushort(r);
- in[1] = frac2ushort(g);
- in[2] = frac2ushort(b);
+ in[0] = frac2ushort(r);
+ in[1] = frac2ushort(g);
+ in[2] = frac2ushort(b);
gscms_transform_color(link, &(in[0]),
&(tmp[0]), 2, NULL);
- for (i = 0; i < outn; i++)
- out[i] = ushort2frac(tmp[i]);
- for (; i < n + 4; i++)
- out[i] = 0;
+ for (i = 0; i < outn; i++)
+ out[i] = ushort2frac(tmp[i]);
+ for (; i < n + 4; i++)
+ out[i] = 0;
} else {
- frac cmyk[4];
+ frac cmyk[4];
- color_rgb_to_cmyk(r, g, b, pis, cmyk, dev->memory);
- cmyk_cs_to_spotn_cm(dev, cmyk[0], cmyk[1], cmyk[2], cmyk[3],
- out);
+ color_rgb_to_cmyk(r, g, b, pis, cmyk, dev->memory);
+ cmyk_cs_to_spotn_cm(dev, cmyk[0], cmyk[1], cmyk[2], cmyk[3],
+ out);
}
}
@@ -472,20 +469,19 @@ get_spotcmyk_color_mapping_procs(const gx_device * dev)
}
#endif
-
static const gx_cm_color_map_procs *
get_xcf_color_mapping_procs(const gx_device * dev)
{
const xcf_device *xdev = (const xcf_device *)dev;
if (xdev->color_model == XCF_DEVICE_RGB)
- return &spotRGB_procs;
+ return &spotRGB_procs;
else if (xdev->color_model == XCF_DEVICE_CMYK)
- return &spotCMYK_procs;
+ return &spotCMYK_procs;
else if (xdev->color_model == XCF_DEVICE_N)
- return &spotN_procs;
+ return &spotN_procs;
else
- return NULL;
+ return NULL;
}
/*
@@ -501,7 +497,7 @@ xcf_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (; i<ncomp; i++) {
- color <<= bpc;
+ color <<= bpc;
color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
@@ -521,7 +517,7 @@ xcf_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out)
for (; i<ncomp; i++) {
out[ncomp - i - 1] = (color & mask) << drop;
- color >>= bpc;
+ color >>= bpc;
}
return 0;
}
@@ -535,7 +531,7 @@ xcf_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3])
xcf_device *xdev = (xcf_device *)dev;
if (xdev->color_model == XCF_DEVICE_RGB)
- return xcf_decode_color(dev, color, rgb);
+ return xcf_decode_color(dev, color, rgb);
/* TODO: return reasonable values. */
rgb[0] = 0;
rgb[1] = 0;
@@ -562,7 +558,7 @@ xcf_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3])
#if 0
static int
repack_data(byte * source, byte * dest, int depth, int first_bit,
- int bit_width, int npixel)
+ int bit_width, int npixel)
{
int in_nbyte = depth >> 3; /* Number of bytes per input pixel */
int out_nbyte = bit_width >> 3; /* Number of bytes per output pixel */
@@ -577,57 +573,55 @@ repack_data(byte * source, byte * dest, int depth, int first_bit,
mask = (mask << bit_width) - 1;
for (i=0; i<npixel; i++) {
/* Get the pixel data */
- if (!in_nbyte) { /* Multiple pixels per byte */
- data = *source;
- data >>= in_byte_loc;
- in_byte_loc += depth;
- if (in_byte_loc >= 8) { /* If finished with byte */
- in_byte_loc = 0;
- source++;
- }
- }
- else { /* One or more bytes per pixel */
- data = *source++;
- for (j=1; j<in_nbyte; j++)
- data = (data << 8) + *source++;
- }
- data >>= first_bit;
- data &= mask;
-
- /* Put the output data */
- if (!out_nbyte) { /* Multiple pixels per byte */
- temp = *out & ~(mask << out_byte_loc);
- *out = temp | (data << out_byte_loc);
- out_byte_loc += bit_width;
- if (out_byte_loc > max_bit_byte) { /* If finished with byte */
- out_byte_loc = 0;
- out++;
- }
- }
- else { /* One or more bytes per pixel */
- *out++ = data >> ((out_nbyte - 1) * 8);
- for (j=1; j<out_nbyte; j++) {
- *out++ = data >> ((out_nbyte - 1 - j) * 8);
- }
- }
+ if (!in_nbyte) { /* Multiple pixels per byte */
+ data = *source;
+ data >>= in_byte_loc;
+ in_byte_loc += depth;
+ if (in_byte_loc >= 8) { /* If finished with byte */
+ in_byte_loc = 0;
+ source++;
+ }
+ }
+ else { /* One or more bytes per pixel */
+ data = *source++;
+ for (j=1; j<in_nbyte; j++)
+ data = (data << 8) + *source++;
+ }
+ data >>= first_bit;
+ data &= mask;
+
+ /* Put the output data */
+ if (!out_nbyte) { /* Multiple pixels per byte */
+ temp = *out & ~(mask << out_byte_loc);
+ *out = temp | (data << out_byte_loc);
+ out_byte_loc += bit_width;
+ if (out_byte_loc > max_bit_byte) { /* If finished with byte */
+ out_byte_loc = 0;
+ out++;
+ }
+ }
+ else { /* One or more bytes per pixel */
+ *out++ = data >> ((out_nbyte - 1) * 8);
+ for (j=1; j<out_nbyte; j++) {
+ *out++ = data >> ((out_nbyte - 1 - j) * 8);
+ }
+ }
}
/* Return the number of bytes in the destination buffer. */
length = out - dest;
if (out_byte_loc) /* If partially filled last byte */
- length++;
+ length++;
return length;
}
#endif /* 0 */
-
-
static int
xcf_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhlink_t icc_link, gs_memory_t *memory)
{
gsicc_rendering_param_t rendering_params;
-
- icc_profile = gsicc_get_profile_handle_file(profile_out_fn,
+
+ icc_profile = gsicc_get_profile_handle_file(profile_out_fn,
strlen(profile_out_fn), memory);
if (icc_profile == NULL)
@@ -640,7 +634,7 @@ xcf_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhli
rendering_params.rendering_intent = gsPERCEPTUAL;
/* Call with a NULL destination profile since we are using a device link profile here */
- icc_link = gscms_get_link(icc_profile,
+ icc_link = gscms_get_link(icc_profile,
NULL, &rendering_params);
if (icc_link == NULL)
@@ -648,10 +642,8 @@ xcf_open_profile(const char *profile_out_fn, cmm_profile_t *icc_profile, gcmmhli
return(0);
-
}
-
static int
xcf_open_profiles(xcf_device *xdev)
{
@@ -659,21 +651,21 @@ xcf_open_profiles(xcf_device *xdev)
if (xdev->output_icc_link == NULL && xdev->profile_out_fn[0]) {
- code = xcf_open_profile(xdev->profile_out_fn, xdev->output_profile,
+ code = xcf_open_profile(xdev->profile_out_fn, xdev->output_profile,
xdev->output_icc_link, xdev->memory);
}
if (code >= 0 && xdev->rgb_icc_link == NULL && xdev->profile_rgb_fn[0]) {
- code = xcf_open_profile(xdev->profile_rgb_fn, xdev->rgb_profile,
+ code = xcf_open_profile(xdev->profile_rgb_fn, xdev->rgb_profile,
xdev->rgb_icc_link, xdev->memory);
}
if (code >= 0 && xdev->cmyk_icc_link == NULL && xdev->profile_cmyk_fn[0]) {
- code = xcf_open_profile(xdev->profile_cmyk_fn, xdev->cmyk_profile,
+ code = xcf_open_profile(xdev->profile_cmyk_fn, xdev->cmyk_profile,
xdev->cmyk_icc_link, xdev->memory);
}
@@ -681,7 +673,6 @@ xcf_open_profiles(xcf_device *xdev)
return code;
}
-
#define set_param_array(a, d, s)\
(a.data = d, a.size = s, a.persistent = false);
@@ -701,25 +692,25 @@ xcf_get_params(gx_device * pdev, gs_param_list * plist)
if ( (code = gdev_prn_get_params(pdev, plist)) < 0 ||
(code = sample_device_crd_get_params(pdev, plist, "CRDDefault")) < 0 ||
- (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
- (code = param_write_bool(plist, "Separations", &seprs)) < 0)
- return code;
+ (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
+ (code = param_write_bool(plist, "Separations", &seprs)) < 0)
+ return code;
pos.data = (const byte *)xdev->profile_out_fn,
- pos.size = strlen(xdev->profile_out_fn),
- pos.persistent = false;
+ pos.size = strlen(xdev->profile_out_fn),
+ pos.persistent = false;
code = param_write_string(plist, "ProfileOut", &pos);
if (code < 0)
- return code;
+ return code;
prgbs.data = (const byte *)xdev->profile_rgb_fn,
- prgbs.size = strlen(xdev->profile_rgb_fn),
- prgbs.persistent = false;
+ prgbs.size = strlen(xdev->profile_rgb_fn),
+ prgbs.persistent = false;
code = param_write_string(plist, "ProfileRgb", &prgbs);
pcmyks.data = (const byte *)xdev->profile_cmyk_fn,
- pcmyks.size = strlen(xdev->profile_cmyk_fn),
- pcmyks.persistent = false;
+ pcmyks.size = strlen(xdev->profile_cmyk_fn),
+ pcmyks.persistent = false;
code = param_write_string(plist, "ProfileCmyk", &prgbs);
return code;
@@ -728,7 +719,7 @@ xcf_get_params(gx_device * pdev, gs_param_list * plist)
#define compare_color_names(name, name_size, str, str_size) \
(name_size == str_size && \
- (strncmp((const char *)name, (const char *)str, name_size) == 0))
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
/*
* This routine will check if a name matches any item in a list of process model
@@ -736,18 +727,18 @@ xcf_get_params(gx_device * pdev, gs_param_list * plist)
*/
static bool
check_process_color_names(const fixed_colorant_names_list * pcomp_list,
- const gs_param_string * pstring)
+ const gs_param_string * pstring)
{
if (pcomp_list) {
const fixed_colorant_name * plist = *pcomp_list;
uint size = pstring->size;
-
- while( *plist) {
- if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
- return true;
- }
- plist++;
- }
+
+ while( *plist) {
+ if (compare_color_names(*plist, strlen(*plist), pstring->data, size)) {
+ return true;
+ }
+ plist++;
+ }
}
return false;
}
@@ -769,47 +760,47 @@ static int
bpc_to_depth(int ncomp, int bpc)
{
static const byte depths[4][8] = {
- {1, 2, 0, 4, 8, 0, 0, 8},
- {2, 4, 0, 8, 16, 0, 0, 16},
- {4, 8, 0, 16, 16, 0, 0, 24},
- {4, 8, 0, 16, 32, 0, 0, 32}
+ {1, 2, 0, 4, 8, 0, 0, 8},
+ {2, 4, 0, 8, 16, 0, 0, 16},
+ {4, 8, 0, 16, 16, 0, 0, 24},
+ {4, 8, 0, 16, 32, 0, 0, 32}
};
if (ncomp <=4 && bpc <= 8)
return depths[ncomp -1][bpc-1];
else
- return (ncomp * bpc + 7) & 0xf8;
+ return (ncomp * bpc + 7) & 0xf8;
}
#define BEGIN_ARRAY_PARAM(pread, pname, pa, psize, e)\
BEGIN\
switch (code = pread(plist, (param_name = pname), &(pa))) {\
case 0:\
- if ((pa).size != psize) {\
- ecode = gs_note_error(gs_error_rangecheck);\
- (pa).data = 0; /* mark as not filled */\
- } else
+ if ((pa).size != psize) {\
+ ecode = gs_note_error(gs_error_rangecheck);\
+ (pa).data = 0; /* mark as not filled */\
+ } else
#define END_ARRAY_PARAM(pa, e)\
- goto e;\
+ goto e;\
default:\
- ecode = code;\
+ ecode = code;\
e: param_signal_error(plist, param_name, ecode);\
case 1:\
- (pa).data = 0; /* mark as not filled */\
+ (pa).data = 0; /* mark as not filled */\
}\
END
static int
xcf_param_read_fn(gs_param_list *plist, const char *name,
- gs_param_string *pstr, int max_len)
+ gs_param_string *pstr, int max_len)
{
int code = param_read_string(plist, name, pstr);
if (code == 0) {
- if (pstr->size >= max_len)
- param_signal_error(plist, name, code = gs_error_rangecheck);
+ if (pstr->size >= max_len)
+ param_signal_error(plist, name, code = gs_error_rangecheck);
} else {
- pstr->data = 0;
+ pstr->data = 0;
}
return code;
}
@@ -819,7 +810,7 @@ static bool
param_string_eq(const gs_param_string *pcs, const char *str)
{
return (strlen(str) == pcs->size &&
- !strncmp(str, (const char *)pcs->data, pcs->size));
+ !strncmp(str, (const char *)pcs->data, pcs->size));
}
static int
@@ -827,27 +818,27 @@ xcf_set_color_model(xcf_device *xdev, xcf_color_model color_model)
{
xdev->color_model = color_model;
if (color_model == XCF_DEVICE_GRAY) {
- xdev->std_colorant_names = &DeviceGrayComponents;
- xdev->num_std_colorant_names = 1;
- xdev->color_info.cm_name = "DeviceGray";
- xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ xdev->std_colorant_names = &DeviceGrayComponents;
+ xdev->num_std_colorant_names = 1;
+ xdev->color_info.cm_name = "DeviceGray";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == XCF_DEVICE_RGB) {
- xdev->std_colorant_names = &DeviceRGBComponents;
- xdev->num_std_colorant_names = 3;
- xdev->color_info.cm_name = "DeviceRGB";
- xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
+ xdev->std_colorant_names = &DeviceRGBComponents;
+ xdev->num_std_colorant_names = 3;
+ xdev->color_info.cm_name = "DeviceRGB";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_ADDITIVE;
} else if (color_model == XCF_DEVICE_CMYK) {
- xdev->std_colorant_names = &DeviceCMYKComponents;
- xdev->num_std_colorant_names = 4;
- xdev->color_info.cm_name = "DeviceCMYK";
- xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ xdev->std_colorant_names = &DeviceCMYKComponents;
+ xdev->num_std_colorant_names = 4;
+ xdev->color_info.cm_name = "DeviceCMYK";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else if (color_model == XCF_DEVICE_N) {
- xdev->std_colorant_names = &DeviceCMYKComponents;
- xdev->num_std_colorant_names = 4;
- xdev->color_info.cm_name = "DeviceN";
- xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
+ xdev->std_colorant_names = &DeviceCMYKComponents;
+ xdev->num_std_colorant_names = 4;
+ xdev->color_info.cm_name = "DeviceN";
+ xdev->color_info.polarity = GX_CINFO_POLARITY_SUBTRACTIVE;
} else {
- return -1;
+ return -1;
}
return 0;
@@ -899,37 +890,37 @@ xcf_put_params(gx_device * pdev, gs_param_list * plist)
xcf_color_model color_model = pdevn->color_model;
BEGIN_ARRAY_PARAM(param_read_name_array, "SeparationColorNames", scna, scna.size, scne) {
- break;
+ break;
} END_ARRAY_PARAM(scna, scne);
if (code >= 0)
- code = xcf_param_read_fn(plist, "ProfileOut", &po,
- sizeof(pdevn->profile_out_fn));
+ code = xcf_param_read_fn(plist, "ProfileOut", &po,
+ sizeof(pdevn->profile_out_fn));
if (code >= 0)
- code = xcf_param_read_fn(plist, "ProfileRgb", &prgb,
- sizeof(pdevn->profile_rgb_fn));
+ code = xcf_param_read_fn(plist, "ProfileRgb", &prgb,
+ sizeof(pdevn->profile_rgb_fn));
if (code >= 0)
- code = xcf_param_read_fn(plist, "ProfileCmyk", &pcmyk,
- sizeof(pdevn->profile_cmyk_fn));
+ code = xcf_param_read_fn(plist, "ProfileCmyk", &pcmyk,
+ sizeof(pdevn->profile_cmyk_fn));
if (code >= 0)
- code = param_read_name(plist, "ProcessColorModel", &pcm);
+ code = param_read_name(plist, "ProcessColorModel", &pcm);
if (code == 0) {
- if (param_string_eq (&pcm, "DeviceGray"))
- color_model = XCF_DEVICE_GRAY;
- else if (param_string_eq (&pcm, "DeviceRGB"))
- color_model = XCF_DEVICE_RGB;
- else if (param_string_eq (&pcm, "DeviceCMYK"))
- color_model = XCF_DEVICE_CMYK;
- else if (param_string_eq (&pcm, "DeviceN"))
- color_model = XCF_DEVICE_N;
- else {
- param_signal_error(plist, "ProcessColorModel",
- code = gs_error_rangecheck);
- }
+ if (param_string_eq (&pcm, "DeviceGray"))
+ color_model = XCF_DEVICE_GRAY;
+ else if (param_string_eq (&pcm, "DeviceRGB"))
+ color_model = XCF_DEVICE_RGB;
+ else if (param_string_eq (&pcm, "DeviceCMYK"))
+ color_model = XCF_DEVICE_CMYK;
+ else if (param_string_eq (&pcm, "DeviceN"))
+ color_model = XCF_DEVICE_N;
+ else {
+ param_signal_error(plist, "ProcessColorModel",
+ code = gs_error_rangecheck);
+ }
}
if (code < 0)
- ecode = code;
+ ecode = code;
/*
* Save the color_info in case gdev_prn_put_params fails, and for
@@ -938,69 +929,68 @@ xcf_put_params(gx_device * pdev, gs_param_list * plist)
save_info = pdevn->color_info;
ecode = xcf_set_color_model(pdevn, color_model);
if (ecode == 0)
- ecode = gdev_prn_put_params(pdev, plist);
+ ecode = gdev_prn_put_params(pdev, plist);
if (ecode < 0) {
- pdevn->color_info = save_info;
- return ecode;
+ pdevn->color_info = save_info;
+ return ecode;
}
/* Separations are only valid with a subrtractive color model */
if (pdev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE) {
/*
* Process the separation color names. Remove any names that already
- * match the process color model colorant names for the device.
+ * match the process color model colorant names for the device.
*/
if (scna.data != 0) {
- int i;
- int num_names = scna.size;
- const fixed_colorant_names_list * pcomp_names =
- ((xcf_device *)pdev)->std_colorant_names;
-
- for (i = num_spot = 0; i < num_names; i++) {
- if (!check_process_color_names(pcomp_names, &scna.data[i]))
- pdevn->separation_names.names[num_spot++] = &scna.data[i];
- }
- pdevn->separation_names.num_names = num_spot;
- if (pdevn->is_open)
- gs_closedevice(pdev);
+ int i;
+ int num_names = scna.size;
+ const fixed_colorant_names_list * pcomp_names =
+ ((xcf_device *)pdev)->std_colorant_names;
+
+ for (i = num_spot = 0; i < num_names; i++) {
+ if (!check_process_color_names(pcomp_names, &scna.data[i]))
+ pdevn->separation_names.names[num_spot++] = &scna.data[i];
+ }
+ pdevn->separation_names.num_names = num_spot;
+ if (pdevn->is_open)
+ gs_closedevice(pdev);
}
npcmcolors = pdevn->num_std_colorant_names;
pdevn->color_info.num_components = npcmcolors + num_spot;
- /*
+ /*
* The DeviceN device can have zero components if nothing has been
- * specified. This causes some problems so force at least one
- * component until something is specified.
+ * specified. This causes some problems so force at least one
+ * component until something is specified.
*/
if (!pdevn->color_info.num_components)
- pdevn->color_info.num_components = 1;
+ pdevn->color_info.num_components = 1;
pdevn->color_info.depth = bpc_to_depth(pdevn->color_info.num_components,
- pdevn->bitspercomponent);
+ pdevn->bitspercomponent);
if (pdevn->color_info.depth != save_info.depth) {
- gs_closedevice(pdev);
+ gs_closedevice(pdev);
}
}
if (po.data != 0) {
- memcpy(pdevn->profile_out_fn, po.data, po.size);
- pdevn->profile_out_fn[po.size] = 0;
+ memcpy(pdevn->profile_out_fn, po.data, po.size);
+ pdevn->profile_out_fn[po.size] = 0;
}
if (prgb.data != 0) {
- memcpy(pdevn->profile_rgb_fn, prgb.data, prgb.size);
- pdevn->profile_rgb_fn[prgb.size] = 0;
+ memcpy(pdevn->profile_rgb_fn, prgb.data, prgb.size);
+ pdevn->profile_rgb_fn[prgb.size] = 0;
}
if (pcmyk.data != 0) {
- memcpy(pdevn->profile_cmyk_fn, pcmyk.data, pcmyk.size);
- pdevn->profile_cmyk_fn[pcmyk.size] = 0;
+ memcpy(pdevn->profile_cmyk_fn, pcmyk.data, pcmyk.size);
+ pdevn->profile_cmyk_fn[pcmyk.size] = 0;
}
code = xcf_open_profiles(pdevn);
return code;
}
-
/*
* This routine will check to see if the color component name match those
- * that are available amoung the current device's color components.
+ * that are available amoung the current device's color components.
*
* Parameters:
* dev - pointer to device data structure.
@@ -1012,7 +1002,7 @@ xcf_put_params(gx_device * pdev, gs_param_list * plist)
*/
static int
xcf_get_color_comp_index(gx_device * dev, const char * pname, int name_size,
- int component_type)
+ int component_type)
{
/* TO_DO_DEVICEN This routine needs to include the effects of the SeparationOrder array */
const fixed_colorant_names_list * list = ((const xcf_device *)dev)->std_colorant_names;
@@ -1022,32 +1012,31 @@ xcf_get_color_comp_index(gx_device * dev, const char * pname, int name_size,
/* Check if the component is in the implied list. */
if (pcolor) {
- while( *pcolor) {
- if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
- return color_component_number;
- pcolor++;
- color_component_number++;
- }
+ while( *pcolor) {
+ if (compare_color_names(pname, name_size, *pcolor, strlen(*pcolor)))
+ return color_component_number;
+ pcolor++;
+ color_component_number++;
+ }
}
/* Check if the component is in the separation names list. */
{
- const gs_separation_names * separations = &((const xcf_device *)dev)->separation_names;
- int num_spot = separations->num_names;
-
- for (i=0; i<num_spot; i++) {
- if (compare_color_names((const char *)separations->names[i]->data,
- separations->names[i]->size, pname, name_size)) {
- return color_component_number;
- }
- color_component_number++;
- }
+ const gs_separation_names * separations = &((const xcf_device *)dev)->separation_names;
+ int num_spot = separations->num_names;
+
+ for (i=0; i<num_spot; i++) {
+ if (compare_color_names((const char *)separations->names[i]->data,
+ separations->names[i]->size, pname, name_size)) {
+ return color_component_number;
+ }
+ color_component_number++;
+ }
}
return -1;
}
-
/* ------ Private definitions ------ */
/* All two-byte quantities are stored MSB-first! */
@@ -1085,8 +1074,8 @@ xcf_calc_levels(int size, int tile_size)
{
int levels = 1;
while (size > tile_size) {
- size >>= 1;
- levels++;
+ size >>= 1;
+ levels++;
}
return levels;
}
@@ -1102,7 +1091,7 @@ xcf_setup_tiles(xcf_write_ctx *xc, xcf_device *dev)
xc->n_tiles_y = (dev->height + TILE_HEIGHT - 1) / TILE_HEIGHT;
xc->n_tiles = xc->n_tiles_x * xc->n_tiles_y;
xc->n_levels = max(xcf_calc_levels(dev->width, TILE_WIDTH),
- xcf_calc_levels(dev->height, TILE_HEIGHT));
+ xcf_calc_levels(dev->height, TILE_HEIGHT));
return 0;
}
@@ -1124,7 +1113,7 @@ xcf_write(xcf_write_ctx *xc, const byte *buf, int size) {
code = fwrite(buf, 1, size, xc->f);
if (code < 0)
- return code;
+ return code;
xc->offset += code;
return 0;
}
@@ -1158,20 +1147,19 @@ xcf_base_size(xcf_write_ctx *xc, const char *layer_name)
int bytes_pp = xc->base_bytes_pp + xc->n_extra_channels;
return 17 + strlen (layer_name) + /* header and name */
- 8 + /* layer props */
- 12 + xc->n_levels * 16 + /* layer tile hierarchy */
- 12 + xc->n_tiles * 4 + /* tile offsets */
- xc->width * xc->height * bytes_pp; /* image data */
+ 8 + /* layer props */
+ 12 + xc->n_levels * 16 + /* layer tile hierarchy */
+ 12 + xc->n_tiles * 4 + /* tile offsets */
+ xc->width * xc->height * bytes_pp; /* image data */
}
-
static int
xcf_channel_size(xcf_write_ctx *xc, int name_size)
{
return 17 + name_size + /* header and name */
- 8 + /* channel props */
- 4 + xc->n_levels * 16 + /* channel tile hiearchy */
- 12 + xc->n_tiles * 4; /* tile offsets */
+ 8 + /* channel props */
+ 4 + xc->n_levels * 16 + /* channel tile hiearchy */
+ 12 + xc->n_tiles * 4; /* tile offsets */
}
static int
@@ -1199,13 +1187,13 @@ xcf_write_header(xcf_write_ctx *xc, xcf_device *pdev)
/* channel offsets */
tile_offset = xc->offset + 4 + 4 * n_extra_channels +
- xcf_base_size(xc, layer_name);
+ xcf_base_size(xc, layer_name);
for (channel_idx = 0; channel_idx < n_extra_channels; channel_idx++) {
- const gs_param_string *separation_name =
- pdev->separation_names.names[channel_idx];
- dlprintf1("tile offset: %d\n", tile_offset);
- xcf_write_32(xc, tile_offset);
- tile_offset += xcf_channel_size(xc, separation_name->size);
+ const gs_param_string *separation_name =
+ pdev->separation_names.names[channel_idx];
+ dlprintf1("tile offset: %d\n", tile_offset);
+ xcf_write_32(xc, tile_offset);
+ tile_offset += xcf_channel_size(xc, separation_name->size);
}
xcf_write_32(xc, 0);
@@ -1229,10 +1217,10 @@ xcf_write_header(xcf_write_ctx *xc, xcf_device *pdev)
xcf_write_32(xc, xc->base_bytes_pp);
xcf_write_32(xc, xc->offset + (1 + xc->n_levels) * 4);
tile_offset = xc->offset + xc->width * xc->height * bytes_pp +
- xc->n_tiles * 4 + 12;
+ xc->n_tiles * 4 + 12;
for (level = 1; level < xc->n_levels; level++) {
- xcf_write_32(xc, tile_offset);
- tile_offset += 12;
+ xcf_write_32(xc, tile_offset);
+ tile_offset += 12;
}
xcf_write_32(xc, 0);
@@ -1241,8 +1229,8 @@ xcf_write_header(xcf_write_ctx *xc, xcf_device *pdev)
xcf_write_32(xc, xc->height);
tile_offset = xc->offset + (xc->n_tiles + 1) * 4;
for (tile_idx = 0; tile_idx < xc->n_tiles; tile_idx++) {
- xcf_write_32(xc, tile_offset);
- tile_offset += xcf_tile_sizeof(xc, tile_idx) * bytes_pp;
+ xcf_write_32(xc, tile_offset);
+ tile_offset += xcf_tile_sizeof(xc, tile_idx) * bytes_pp;
}
xcf_write_32(xc, 0);
@@ -1253,7 +1241,7 @@ xcf_write_header(xcf_write_ctx *xc, xcf_device *pdev)
static void
xcf_shuffle_to_tile(xcf_write_ctx *xc, byte **tile_data, const byte *row,
- int y)
+ int y)
{
int tile_j = y / TILE_HEIGHT;
int yrem = y % TILE_HEIGHT;
@@ -1263,31 +1251,30 @@ xcf_shuffle_to_tile(xcf_write_ctx *xc, byte **tile_data, const byte *row,
int row_idx = 0;
for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
- int x;
- int tile_width = min(TILE_WIDTH, xc->width - tile_i * TILE_WIDTH);
- int tile_height = min(TILE_HEIGHT, xc->height - tile_j * TILE_HEIGHT);
- byte *base_ptr = tile_data[tile_i] +
- yrem * tile_width * base_bytes_pp;
- int extra_stride = tile_width * tile_height;
- byte *extra_ptr = tile_data[tile_i] + extra_stride * base_bytes_pp +
- yrem * tile_width;
-
- int base_idx = 0;
-
- for (x = 0; x < tile_width; x++) {
- int plane_idx;
- for (plane_idx = 0; plane_idx < base_bytes_pp; plane_idx++)
- base_ptr[base_idx++] = row[row_idx++];
- for (plane_idx = 0; plane_idx < n_extra_channels; plane_idx++)
- extra_ptr[plane_idx * extra_stride + x] = 255 ^ row[row_idx++];
- }
+ int x;
+ int tile_width = min(TILE_WIDTH, xc->width - tile_i * TILE_WIDTH);
+ int tile_height = min(TILE_HEIGHT, xc->height - tile_j * TILE_HEIGHT);
+ byte *base_ptr = tile_data[tile_i] +
+ yrem * tile_width * base_bytes_pp;
+ int extra_stride = tile_width * tile_height;
+ byte *extra_ptr = tile_data[tile_i] + extra_stride * base_bytes_pp +
+ yrem * tile_width;
+
+ int base_idx = 0;
+
+ for (x = 0; x < tile_width; x++) {
+ int plane_idx;
+ for (plane_idx = 0; plane_idx < base_bytes_pp; plane_idx++)
+ base_ptr[base_idx++] = row[row_idx++];
+ for (plane_idx = 0; plane_idx < n_extra_channels; plane_idx++)
+ extra_ptr[plane_idx * extra_stride + x] = 255 ^ row[row_idx++];
+ }
}
}
-
static void
xcf_icc_to_tile(xcf_write_ctx *xc, byte **tile_data, const byte *row,
- int y, gcmmhlink_t link)
+ int y, gcmmhlink_t link)
{
int tile_j = y / TILE_HEIGHT;
int yrem = y % TILE_HEIGHT;
@@ -1297,35 +1284,34 @@ xcf_icc_to_tile(xcf_write_ctx *xc, byte **tile_data, const byte *row,
int row_idx = 0;
for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
- int x;
- int tile_width = min(TILE_WIDTH, xc->width - tile_i * TILE_WIDTH);
- int tile_height = min(TILE_HEIGHT, xc->height - tile_j * TILE_HEIGHT);
- byte *base_ptr = tile_data[tile_i] +
- yrem * tile_width * base_bytes_pp;
- int extra_stride = tile_width * tile_height;
- byte *extra_ptr = tile_data[tile_i] + extra_stride * base_bytes_pp +
- yrem * tile_width;
-
- int base_idx = 0;
-
- for (x = 0; x < tile_width; x++) {
-
- int plane_idx;
-
- /* This loop could be optimized. I don't quite
- understand what is going on in the loop
+ int x;
+ int tile_width = min(TILE_WIDTH, xc->width - tile_i * TILE_WIDTH);
+ int tile_height = min(TILE_HEIGHT, xc->height - tile_j * TILE_HEIGHT);
+ byte *base_ptr = tile_data[tile_i] +
+ yrem * tile_width * base_bytes_pp;
+ int extra_stride = tile_width * tile_height;
+ byte *extra_ptr = tile_data[tile_i] + extra_stride * base_bytes_pp +
+ yrem * tile_width;
+
+ int base_idx = 0;
+
+ for (x = 0; x < tile_width; x++) {
+
+ int plane_idx;
+
+ /* This loop could be optimized. I don't quite
+ understand what is going on in the loop
with the 255^row[row_idx++] operation */
gscms_transform_color(link, &(row[row_idx]),
&(base_ptr[base_idx]), 1, NULL);
- for (plane_idx = 0; plane_idx < n_extra_channels; plane_idx++)
- extra_ptr[plane_idx * extra_stride + x] = 255 ^ row[row_idx++];
- }
+ for (plane_idx = 0; plane_idx < n_extra_channels; plane_idx++)
+ extra_ptr[plane_idx * extra_stride + x] = 255 ^ row[row_idx++];
+ }
}
}
-
static int
xcf_write_image_data(xcf_write_ctx *xc, gx_device_printer *pdev)
{
@@ -1343,44 +1329,44 @@ xcf_write_image_data(xcf_write_ctx *xc, gx_device_printer *pdev)
line = gs_alloc_bytes(pdev->memory, raster, "xcf_write_image_data");
tile_data = (byte **)gs_alloc_bytes(pdev->memory,
- xc->n_tiles_x * sizeof(byte *),
- "xcf_write_image_data");
+ xc->n_tiles_x * sizeof(byte *),
+ "xcf_write_image_data");
for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
- int tile_bytes = xcf_tile_sizeof(xc, tile_i) * bytes_pp;
+ int tile_bytes = xcf_tile_sizeof(xc, tile_i) * bytes_pp;
- tile_data[tile_i] = gs_alloc_bytes(pdev->memory, tile_bytes,
- "xcf_write_image_data");
+ tile_data[tile_i] = gs_alloc_bytes(pdev->memory, tile_bytes,
+ "xcf_write_image_data");
}
for (tile_j = 0; tile_j < xc->n_tiles_y; tile_j++) {
- int y0, y1;
- int y;
- byte *row;
-
- y0 = tile_j * TILE_HEIGHT;
- y1 = min(xc->height, y0 + TILE_HEIGHT);
- for (y = y0; y < y1; y++) {
- code = gdev_prn_get_bits(pdev, y, line, &row);
- if (link == NULL)
- xcf_shuffle_to_tile(xc, tile_data, row, y);
- else
- xcf_icc_to_tile(xc, tile_data, row, y, link);
- }
- for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
- int tile_idx = tile_j * xc->n_tiles_x + tile_i;
- int tile_size = xcf_tile_sizeof(xc, tile_idx);
- int base_size = tile_size * base_bytes_pp;
-
- xcf_write(xc, tile_data[tile_i], base_size);
- for (chan_idx = 0; chan_idx < n_extra_channels; chan_idx++) {
- xcf_write(xc, tile_data[tile_i] + base_size +
- tile_size * chan_idx, tile_size);
- }
- }
+ int y0, y1;
+ int y;
+ byte *row;
+
+ y0 = tile_j * TILE_HEIGHT;
+ y1 = min(xc->height, y0 + TILE_HEIGHT);
+ for (y = y0; y < y1; y++) {
+ code = gdev_prn_get_bits(pdev, y, line, &row);
+ if (link == NULL)
+ xcf_shuffle_to_tile(xc, tile_data, row, y);
+ else
+ xcf_icc_to_tile(xc, tile_data, row, y, link);
+ }
+ for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
+ int tile_idx = tile_j * xc->n_tiles_x + tile_i;
+ int tile_size = xcf_tile_sizeof(xc, tile_idx);
+ int base_size = tile_size * base_bytes_pp;
+
+ xcf_write(xc, tile_data[tile_i], base_size);
+ for (chan_idx = 0; chan_idx < n_extra_channels; chan_idx++) {
+ xcf_write(xc, tile_data[tile_i] + base_size +
+ tile_size * chan_idx, tile_size);
+ }
+ }
}
for (tile_i = 0; tile_i < xc->n_tiles_x; tile_i++) {
- gs_free_object(pdev->memory, tile_data[tile_i],
- "xcf_write_image_data");
+ gs_free_object(pdev->memory, tile_data[tile_i],
+ "xcf_write_image_data");
}
gs_free_object(pdev->memory, tile_data, "xcf_write_image_data");
gs_free_object(pdev->memory, line, "xcf_write_image_data");
@@ -1394,11 +1380,11 @@ xcf_write_fake_hierarchy(xcf_write_ctx *xc)
int i;
for (i = 1; i < xc->n_levels; i++) {
- widthf >>= 1;
- heightf >>= 1;
- xcf_write_32(xc, widthf);
- xcf_write_32(xc, heightf);
- xcf_write_32(xc, 0);
+ widthf >>= 1;
+ heightf >>= 1;
+ xcf_write_32(xc, widthf);
+ xcf_write_32(xc, heightf);
+ xcf_write_32(xc, 0);
}
return 0;
}
@@ -1415,51 +1401,51 @@ xcf_write_footer(xcf_write_ctx *xc, xcf_device *pdev)
xcf_write_fake_hierarchy(xc);
for (chan_idx = 0; chan_idx < xc->n_extra_channels; chan_idx++) {
- const gs_param_string *separation_name =
- pdev->separation_names.names[chan_idx];
- byte nullbyte[] = { 0 };
- int level;
- int offset;
- int tile_idx;
-
- dlprintf2("actual tile offset: %d %d\n", xc->offset, (int)arch_sizeof_color_index);
- xcf_write_32(xc, xc->width);
- xcf_write_32(xc, xc->height);
- xcf_write_32(xc, separation_name->size + 1);
- xcf_write(xc, separation_name->data, separation_name->size);
- xcf_write(xc, nullbyte, 1);
-
- /* channel props */
- xcf_write_32(xc, 0);
- xcf_write_32(xc, 0);
-
- /* channel tile hierarchy */
- xcf_write_32(xc, xc->offset + 4);
-
- xcf_write_32(xc, xc->width);
- xcf_write_32(xc, xc->height);
- xcf_write_32(xc, 1);
- xcf_write_32(xc, xc->offset + xc->n_levels * 16 - 8);
- offset = xc->offset + xc->n_levels * 4;
- for (level = 1; level < xc->n_levels; level++) {
- xcf_write_32(xc, offset);
- offset += 12;
- }
- xcf_write_32(xc, 0);
- xcf_write_fake_hierarchy(xc);
-
- /* channel tile offsets */
- xcf_write_32(xc, xc->width);
- xcf_write_32(xc, xc->height);
- offset = xc->image_data_off;
- for (tile_idx = 0; tile_idx < xc->n_tiles; tile_idx++) {
- int tile_size = xcf_tile_sizeof(xc, tile_idx);
-
- xcf_write_32(xc, offset + (base_bytes_pp + chan_idx) * tile_size);
- offset += bytes_pp * tile_size;
- }
- xcf_write_32(xc, 0);
-
+ const gs_param_string *separation_name =
+ pdev->separation_names.names[chan_idx];
+ byte nullbyte[] = { 0 };
+ int level;
+ int offset;
+ int tile_idx;
+
+ dlprintf2("actual tile offset: %d %d\n", xc->offset, (int)arch_sizeof_color_index);
+ xcf_write_32(xc, xc->width);
+ xcf_write_32(xc, xc->height);
+ xcf_write_32(xc, separation_name->size + 1);
+ xcf_write(xc, separation_name->data, separation_name->size);
+ xcf_write(xc, nullbyte, 1);
+
+ /* channel props */
+ xcf_write_32(xc, 0);
+ xcf_write_32(xc, 0);
+
+ /* channel tile hierarchy */
+ xcf_write_32(xc, xc->offset + 4);
+
+ xcf_write_32(xc, xc->width);
+ xcf_write_32(xc, xc->height);
+ xcf_write_32(xc, 1);
+ xcf_write_32(xc, xc->offset + xc->n_levels * 16 - 8);
+ offset = xc->offset + xc->n_levels * 4;
+ for (level = 1; level < xc->n_levels; level++) {
+ xcf_write_32(xc, offset);
+ offset += 12;
+ }
+ xcf_write_32(xc, 0);
+ xcf_write_fake_hierarchy(xc);
+
+ /* channel tile offsets */
+ xcf_write_32(xc, xc->width);
+ xcf_write_32(xc, xc->height);
+ offset = xc->image_data_off;
+ for (tile_idx = 0; tile_idx < xc->n_tiles; tile_idx++) {
+ int tile_size = xcf_tile_sizeof(xc, tile_idx);
+
+ xcf_write_32(xc, offset + (base_bytes_pp + chan_idx) * tile_size);
+ offset += bytes_pp * tile_size;
+ }
+ xcf_write_32(xc, 0);
+
}
return code;
}
diff --git a/gs/base/gdevxcmp.c b/gs/base/gdevxcmp.c
index e04358302..9378fa1fe 100644
--- a/gs/base/gdevxcmp.c
+++ b/gs/base/gdevxcmp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,14 +40,14 @@ set_cmap_values(x11_cmap_values_t *values, int maxv, int mult)
int i;
if (maxv < 1 || maxv > 63 || (maxv & (maxv + 1)) ||
- (mult & (mult - 1))
- )
- return false;
+ (mult & (mult - 1))
+ )
+ return false;
values->cv_shift = 16 - small_exact_log2(maxv + 1);
for (i = 0; i <= maxv; ++i)
- values->nearest[i] = X_max_color_value * i / maxv;
+ values->nearest[i] = X_max_color_value * i / maxv;
for (i = 0; mult != (1 << i); ++i)
- DO_NOTHING;
+ DO_NOTHING;
values->pixel_shift = i;
return true;
}
@@ -56,9 +56,9 @@ set_std_cmap(gx_device_X *xdev, XStandardColormap *map)
{
xdev->cman.std_cmap.map = map;
xdev->cman.std_cmap.fast =
- set_cmap_values(&xdev->cman.std_cmap.red, map->red_max, map->red_mult) &&
- set_cmap_values(&xdev->cman.std_cmap.green, map->green_max, map->green_mult) &&
- set_cmap_values(&xdev->cman.std_cmap.blue, map->blue_max, map->blue_mult);
+ set_cmap_values(&xdev->cman.std_cmap.red, map->red_max, map->red_mult) &&
+ set_cmap_values(&xdev->cman.std_cmap.green, map->green_max, map->green_mult) &&
+ set_cmap_values(&xdev->cman.std_cmap.blue, map->blue_max, map->blue_mult);
}
/* Get the Standard colormap if available. */
@@ -71,10 +71,10 @@ x_get_std_cmap(gx_device_X * xdev, Atom prop)
int nitems;
if (XGetRGBColormaps(xdev->dpy, RootWindowOfScreen(xdev->scr),
- &scmap, &nitems, prop))
- for (i = 0, sp = scmap; i < nitems; i++, sp++)
- if (xdev->cmap == sp->colormap)
- return sp;
+ &scmap, &nitems, prop))
+ for (i = 0, sp = scmap; i < nitems; i++, sp++)
+ if (xdev->cmap == sp->colormap)
+ return sp;
return NULL;
}
@@ -88,33 +88,33 @@ alloc_std_cmap(gx_device_X *xdev, bool colored)
XStandardColormap *cmap = XAllocStandardColormap();
if (cmap == 0)
- return false; /* can't allocate */
+ return false; /* can't allocate */
/*
* Some buggy X servers (including XFree86) don't set any of the
* _mask values for StaticGray visuals. Compensate for that here.
*/
if ((cmap->red_max = xdev->vinfo->red_mask) == 0) {
- cmap->red_max = (1 << xdev->vinfo->depth) - 1;
- cmap->red_mult = 1;
+ cmap->red_max = (1 << xdev->vinfo->depth) - 1;
+ cmap->red_mult = 1;
} else {
- for (cmap->red_mult = 1; (cmap->red_max & 1) == 0;) {
- cmap->red_max >>= 1;
- cmap->red_mult <<= 1;
- }
+ for (cmap->red_mult = 1; (cmap->red_max & 1) == 0;) {
+ cmap->red_max >>= 1;
+ cmap->red_mult <<= 1;
+ }
}
if (colored) {
- for (cmap->green_max = xdev->vinfo->green_mask, cmap->green_mult = 1;
- (cmap->green_max & 1) == 0;
- ) {
- cmap->green_max >>= 1;
- cmap->green_mult <<= 1;
- }
- for (cmap->blue_max = xdev->vinfo->blue_mask, cmap->blue_mult = 1;
- (cmap->blue_max & 1) == 0;
- ) {
- cmap->blue_max >>= 1;
- cmap->blue_mult <<= 1;
- }
+ for (cmap->green_max = xdev->vinfo->green_mask, cmap->green_mult = 1;
+ (cmap->green_max & 1) == 0;
+ ) {
+ cmap->green_max >>= 1;
+ cmap->green_mult <<= 1;
+ }
+ for (cmap->blue_max = xdev->vinfo->blue_mask, cmap->blue_mult = 1;
+ (cmap->blue_max & 1) == 0;
+ ) {
+ cmap->blue_max >>= 1;
+ cmap->blue_mult <<= 1;
+ }
} else {
cmap->green_max = cmap->blue_max = cmap->red_max;
cmap->green_mult = cmap->blue_mult = cmap->red_mult;
@@ -132,19 +132,19 @@ static void
alloc_dynamic_colors(gx_device_X * xdev, int num_colors)
{
if (num_colors > 0) {
- xdev->cman.dynamic.colors = (x11_color_t **)
- gs_malloc(xdev->memory, sizeof(x11_color_t *), xdev->cman.num_rgb,
- "x11 cman.dynamic.colors");
- if (xdev->cman.dynamic.colors) {
- int i;
-
- xdev->cman.dynamic.size = xdev->cman.num_rgb;
- xdev->cman.dynamic.shift = 16 - xdev->vinfo->bits_per_rgb;
- for (i = 0; i < xdev->cman.num_rgb; i++)
- xdev->cman.dynamic.colors[i] = NULL;
- xdev->cman.dynamic.max_used = min(256, num_colors);
- xdev->cman.dynamic.used = 0;
- }
+ xdev->cman.dynamic.colors = (x11_color_t **)
+ gs_malloc(xdev->memory, sizeof(x11_color_t *), xdev->cman.num_rgb,
+ "x11 cman.dynamic.colors");
+ if (xdev->cman.dynamic.colors) {
+ int i;
+
+ xdev->cman.dynamic.size = xdev->cman.num_rgb;
+ xdev->cman.dynamic.shift = 16 - xdev->vinfo->bits_per_rgb;
+ for (i = 0; i < xdev->cman.num_rgb; i++)
+ xdev->cman.dynamic.colors[i] = NULL;
+ xdev->cman.dynamic.max_used = min(256, num_colors);
+ xdev->cman.dynamic.used = 0;
+ }
}
}
@@ -159,12 +159,12 @@ x_alloc_color(gx_device_X *xdev, XColor *xcolor)
rgb.rgb[1] = xcolor->green;
rgb.rgb[2] = xcolor->blue;
if (!XAllocColor(xdev->dpy, xdev->cmap, xcolor))
- return false;
+ return false;
if (xcolor->pixel < xdev->cman.color_to_rgb.size) {
- x11_rgb_t *pxrgb = &xdev->cman.color_to_rgb.values[xcolor->pixel];
+ x11_rgb_t *pxrgb = &xdev->cman.color_to_rgb.values[xcolor->pixel];
- memcpy(pxrgb->rgb, rgb.rgb, sizeof(rgb.rgb));
- pxrgb->defined = true;
+ memcpy(pxrgb->rgb, rgb.rgb, sizeof(rgb.rgb));
+ pxrgb->defined = true;
}
return true;
}
@@ -178,8 +178,8 @@ x_free_colors(gx_device_X *xdev, x_pixel *pixels /*[count]*/, int count)
XFreeColors(xdev->dpy, xdev->cmap, pixels, count, 0);
for (i = 0; i < count; ++i)
- if ((pixel = pixels[i]) < xdev->cman.color_to_rgb.size)
- xdev->cman.color_to_rgb.values[pixel].defined = false;
+ if ((pixel = pixels[i]) < xdev->cman.color_to_rgb.size)
+ xdev->cman.color_to_rgb.values[pixel].defined = false;
}
/* Free a partially filled color cube or ramp. */
@@ -188,7 +188,7 @@ static void
free_ramp(gx_device_X * xdev, int num_used, int size)
{
if (num_used - 1 > 0)
- x_free_colors(xdev, xdev->cman.dither_ramp + 1, num_used - 1);
+ x_free_colors(xdev, xdev->cman.dither_ramp + 1, num_used - 1);
gs_x_free(xdev->memory, xdev->cman.dither_ramp, "x11_setup_colors");
xdev->cman.dither_ramp = NULL;
}
@@ -205,37 +205,37 @@ setup_cube(gx_device_X * xdev, int ramp_size, bool colors)
int index;
if (colors) {
- num_entries = ramp_size * ramp_size * ramp_size;
- step = 1; /* all colors */
+ num_entries = ramp_size * ramp_size * ramp_size;
+ step = 1; /* all colors */
} else {
- num_entries = ramp_size;
- step = (ramp_size + 1) * ramp_size + 1; /* gray only */
+ num_entries = ramp_size;
+ step = (ramp_size + 1) * ramp_size + 1; /* gray only */
}
xdev->cman.dither_ramp =
- (x_pixel *) gs_malloc(xdev->memory, sizeof(x_pixel), num_entries,
- "gdevx setup_cube");
+ (x_pixel *) gs_malloc(xdev->memory, sizeof(x_pixel), num_entries,
+ "gdevx setup_cube");
if (xdev->cman.dither_ramp == NULL)
- return false;
+ return false;
xdev->cman.dither_ramp[0] = xdev->foreground;
xdev->cman.dither_ramp[num_entries - 1] = xdev->background;
for (index = 1; index < num_entries - 1; index++) {
- int rgb_index = index * step;
- int q = rgb_index / ramp_size,
- r = q / ramp_size,
- g = q % ramp_size,
- b = rgb_index % ramp_size;
- XColor xc;
-
- xc.red = (X_max_color_value * r / max_rgb) & xdev->cman.color_mask.red;
- xc.green = (X_max_color_value * g / max_rgb) & xdev->cman.color_mask.green;
- xc.blue = (X_max_color_value * b / max_rgb) & xdev->cman.color_mask.blue;
- if (!x_alloc_color(xdev, &xc)) {
- free_ramp(xdev, index, num_entries);
- return false;
- }
- xdev->cman.dither_ramp[index] = xc.pixel;
+ int rgb_index = index * step;
+ int q = rgb_index / ramp_size,
+ r = q / ramp_size,
+ g = q % ramp_size,
+ b = rgb_index % ramp_size;
+ XColor xc;
+
+ xc.red = (X_max_color_value * r / max_rgb) & xdev->cman.color_mask.red;
+ xc.green = (X_max_color_value * g / max_rgb) & xdev->cman.color_mask.green;
+ xc.blue = (X_max_color_value * b / max_rgb) & xdev->cman.color_mask.blue;
+ if (!x_alloc_color(xdev, &xc)) {
+ free_ramp(xdev, index, num_entries);
+ return false;
+ }
+ xdev->cman.dither_ramp[index] = xc.pixel;
}
return true;
@@ -246,46 +246,46 @@ int
gdev_x_setup_colors(gx_device_X * xdev)
{
char palette =
- ((xdev->vinfo->class != StaticGray) &&
- (xdev->vinfo->class != GrayScale) ? 'C' : /* Color */
- (xdev->vinfo->colormap_size > 2) ? 'G' : /* GrayScale */
- 'M'); /* MonoChrome */
+ ((xdev->vinfo->class != StaticGray) &&
+ (xdev->vinfo->class != GrayScale) ? 'C' : /* Color */
+ (xdev->vinfo->colormap_size > 2) ? 'G' : /* GrayScale */
+ 'M'); /* MonoChrome */
if (xdev->ghostview) {
- Atom gv_colors = XInternAtom(xdev->dpy, "GHOSTVIEW_COLORS", False);
- Atom type;
- int format;
- unsigned long nitems, bytes_after;
- char *buf;
-
- /* Delete property if explicit dest is given */
- if (XGetWindowProperty(xdev->dpy, xdev->win, gv_colors, 0,
- 256, (xdev->dest != 0), XA_STRING,
- &type, &format, &nitems, &bytes_after,
- (unsigned char **)&buf) == 0 &&
- type == XA_STRING) {
- nitems = sscanf(buf, "%*s %ld %ld", &(xdev->foreground),
- &(xdev->background));
- if (nitems != 2 || (*buf != 'M' && *buf != 'G' && *buf != 'C')) {
- emprintf(xdev->memory, "Malformed GHOSTVIEW_COLOR property.\n");
- return_error(gs_error_rangecheck);
- }
- palette = max(palette, *buf);
- }
+ Atom gv_colors = XInternAtom(xdev->dpy, "GHOSTVIEW_COLORS", False);
+ Atom type;
+ int format;
+ unsigned long nitems, bytes_after;
+ char *buf;
+
+ /* Delete property if explicit dest is given */
+ if (XGetWindowProperty(xdev->dpy, xdev->win, gv_colors, 0,
+ 256, (xdev->dest != 0), XA_STRING,
+ &type, &format, &nitems, &bytes_after,
+ (unsigned char **)&buf) == 0 &&
+ type == XA_STRING) {
+ nitems = sscanf(buf, "%*s %ld %ld", &(xdev->foreground),
+ &(xdev->background));
+ if (nitems != 2 || (*buf != 'M' && *buf != 'G' && *buf != 'C')) {
+ emprintf(xdev->memory, "Malformed GHOSTVIEW_COLOR property.\n");
+ return_error(gs_error_rangecheck);
+ }
+ palette = max(palette, *buf);
+ }
} else {
- if (xdev->palette[0] == 'c')
- xdev->palette[0] = 'C';
- else if (xdev->palette[0] == 'g')
- xdev->palette[0] = 'G';
- else if (xdev->palette[0] == 'm')
- xdev->palette[0] = 'M';
- palette = max(palette, xdev->palette[0]);
+ if (xdev->palette[0] == 'c')
+ xdev->palette[0] = 'C';
+ else if (xdev->palette[0] == 'g')
+ xdev->palette[0] = 'G';
+ else if (xdev->palette[0] == 'm')
+ xdev->palette[0] = 'M';
+ palette = max(palette, xdev->palette[0]);
}
/* set up color mappings here */
xdev->cman.color_mask.red = xdev->cman.color_mask.green =
- xdev->cman.color_mask.blue = X_max_color_value -
- (X_max_color_value >> xdev->vinfo->bits_per_rgb);
+ xdev->cman.color_mask.blue = X_max_color_value -
+ (X_max_color_value >> xdev->vinfo->bits_per_rgb);
xdev->cman.match_mask = xdev->cman.color_mask; /* default */
xdev->cman.num_rgb = 1 << xdev->vinfo->bits_per_rgb;
@@ -299,153 +299,153 @@ gdev_x_setup_colors(gx_device_X * xdev)
xdev->cman.dynamic.used = 0;
switch (xdev->vinfo->depth) {
case 1: case 2: case 4: case 8: case 16: case 24: case 32:
- xdev->color_info.depth = xdev->vinfo->depth;
- break;
+ xdev->color_info.depth = xdev->vinfo->depth;
+ break;
case 15:
- xdev->color_info.depth = 16;
- break;
+ xdev->color_info.depth = 16;
+ break;
default:
- emprintf1(xdev->memory,
+ emprintf1(xdev->memory,
"Unsupported X visual depth: %d\n",
xdev->vinfo->depth);
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
{ /* Set up the reverse map from pixel values to RGB. */
- int count = 1 << min(xdev->color_info.depth, 8);
-
- xdev->cman.color_to_rgb.values =
- (x11_rgb_t *)gs_malloc(xdev->memory, sizeof(x11_rgb_t), count,
- "gdevx color_to_rgb");
- if (xdev->cman.color_to_rgb.values) {
- int i;
-
- for (i = 0; i < count; ++i)
- xdev->cman.color_to_rgb.values[i].defined = false;
- xdev->cman.color_to_rgb.size = count;
- } else
- xdev->cman.color_to_rgb.size = 0;
+ int count = 1 << min(xdev->color_info.depth, 8);
+
+ xdev->cman.color_to_rgb.values =
+ (x11_rgb_t *)gs_malloc(xdev->memory, sizeof(x11_rgb_t), count,
+ "gdevx color_to_rgb");
+ if (xdev->cman.color_to_rgb.values) {
+ int i;
+
+ for (i = 0; i < count; ++i)
+ xdev->cman.color_to_rgb.values[i].defined = false;
+ xdev->cman.color_to_rgb.size = count;
+ } else
+ xdev->cman.color_to_rgb.size = 0;
}
switch ((int)palette) {
case 'C':
- xdev->color_info.num_components = 3;
- xdev->color_info.max_gray =
- xdev->color_info.max_color = xdev->cman.num_rgb - 1;
+ xdev->color_info.num_components = 3;
+ xdev->color_info.max_gray =
+ xdev->color_info.max_color = xdev->cman.num_rgb - 1;
#if HaveStdCMap
- /* Get a standard color map if available */
- if (xdev->vinfo->visual == DefaultVisualOfScreen(xdev->scr)) {
- xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_DEFAULT_MAP);
- } else {
- xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_BEST_MAP);
- }
- if (xdev->cman.std_cmap.map ||
- (xdev->vinfo->class == TrueColor && alloc_std_cmap(xdev, true))
- ) {
- xdev->color_info.dither_grays = xdev->color_info.dither_colors =
- min(xdev->cman.std_cmap.map->red_max,
- min(xdev->cman.std_cmap.map->green_max,
- xdev->cman.std_cmap.map->blue_max)) + 1;
- if (xdev->cman.std_cmap.map)
- set_std_cmap(xdev, xdev->cman.std_cmap.map);
- } else
+ /* Get a standard color map if available */
+ if (xdev->vinfo->visual == DefaultVisualOfScreen(xdev->scr)) {
+ xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_DEFAULT_MAP);
+ } else {
+ xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_BEST_MAP);
+ }
+ if (xdev->cman.std_cmap.map ||
+ (xdev->vinfo->class == TrueColor && alloc_std_cmap(xdev, true))
+ ) {
+ xdev->color_info.dither_grays = xdev->color_info.dither_colors =
+ min(xdev->cman.std_cmap.map->red_max,
+ min(xdev->cman.std_cmap.map->green_max,
+ xdev->cman.std_cmap.map->blue_max)) + 1;
+ if (xdev->cman.std_cmap.map)
+ set_std_cmap(xdev, xdev->cman.std_cmap.map);
+ } else
#endif
- /* Otherwise set up a rgb cube of our own */
- /* The color cube is limited to about 1/2 of the available */
- /* colormap, the user specified maxRGBRamp (usually 5), */
- /* or the number of representable colors */
+ /* Otherwise set up a rgb cube of our own */
+ /* The color cube is limited to about 1/2 of the available */
+ /* colormap, the user specified maxRGBRamp (usually 5), */
+ /* or the number of representable colors */
#define CUBE(r) (r*r*r)
#define CBRT(r) pow(r, 1.0/3.0)
- {
- int ramp_size =
- min((int)CBRT(xdev->vinfo->colormap_size / 2.0),
- min(xdev->maxRGBRamp, xdev->cman.num_rgb));
-
- while (!xdev->cman.dither_ramp && ramp_size >= 2) {
- xdev->color_info.dither_grays =
- xdev->color_info.dither_colors = ramp_size;
- if (!setup_cube(xdev, ramp_size, true)) {
+ {
+ int ramp_size =
+ min((int)CBRT(xdev->vinfo->colormap_size / 2.0),
+ min(xdev->maxRGBRamp, xdev->cman.num_rgb));
+
+ while (!xdev->cman.dither_ramp && ramp_size >= 2) {
+ xdev->color_info.dither_grays =
+ xdev->color_info.dither_colors = ramp_size;
+ if (!setup_cube(xdev, ramp_size, true)) {
#ifdef DEBUG
- emprintf3(xdev->memory,
+ emprintf3(xdev->memory,
"Warning: failed to allocate %dx%dx%d RGB cube.\n",
- ramp_size,
+ ramp_size,
ramp_size,
ramp_size);
#endif
- ramp_size--;
- continue;
- }
- }
-
- if (!xdev->cman.dither_ramp) {
- goto grayscale;
- }
- }
-
- /* Allocate the dynamic color table. */
- alloc_dynamic_colors(xdev, CUBE(xdev->cman.num_rgb) -
- CUBE(xdev->color_info.dither_colors));
+ ramp_size--;
+ continue;
+ }
+ }
+
+ if (!xdev->cman.dither_ramp) {
+ goto grayscale;
+ }
+ }
+
+ /* Allocate the dynamic color table. */
+ alloc_dynamic_colors(xdev, CUBE(xdev->cman.num_rgb) -
+ CUBE(xdev->color_info.dither_colors));
#undef CUBE
#undef CBRT
- break;
+ break;
case 'G':
grayscale:
- xdev->color_info.num_components = 1;
- xdev->color_info.gray_index = 0;
- xdev->color_info.max_gray = xdev->cman.num_rgb - 1;
+ xdev->color_info.num_components = 1;
+ xdev->color_info.gray_index = 0;
+ xdev->color_info.max_gray = xdev->cman.num_rgb - 1;
#if HaveStdCMap
- /* Get a standard color map if available */
- xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_GRAY_MAP);
- if (xdev->cman.std_cmap.map ||
- (xdev->vinfo->class == StaticGray && alloc_std_cmap(xdev, false))
- ) {
- xdev->color_info.dither_grays =
- xdev->cman.std_cmap.map->red_max + 1;
- if (xdev->cman.std_cmap.map)
- set_std_cmap(xdev, xdev->cman.std_cmap.map);
- } else
+ /* Get a standard color map if available */
+ xdev->cman.std_cmap.map = x_get_std_cmap(xdev, XA_RGB_GRAY_MAP);
+ if (xdev->cman.std_cmap.map ||
+ (xdev->vinfo->class == StaticGray && alloc_std_cmap(xdev, false))
+ ) {
+ xdev->color_info.dither_grays =
+ xdev->cman.std_cmap.map->red_max + 1;
+ if (xdev->cman.std_cmap.map)
+ set_std_cmap(xdev, xdev->cman.std_cmap.map);
+ } else
#endif
- /* Otherwise set up a gray ramp of our own */
- /* The gray ramp is limited to about 1/2 of the available */
- /* colormap, the user specified maxGrayRamp (usually 128), */
- /* or the number of representable grays */
- {
- int ramp_size = min(xdev->vinfo->colormap_size / 2,
- min(xdev->maxGrayRamp, xdev->cman.num_rgb));
-
- while (!xdev->cman.dither_ramp && ramp_size >= 3) {
- xdev->color_info.dither_grays = ramp_size;
- if (!setup_cube(xdev, ramp_size, false)) {
+ /* Otherwise set up a gray ramp of our own */
+ /* The gray ramp is limited to about 1/2 of the available */
+ /* colormap, the user specified maxGrayRamp (usually 128), */
+ /* or the number of representable grays */
+ {
+ int ramp_size = min(xdev->vinfo->colormap_size / 2,
+ min(xdev->maxGrayRamp, xdev->cman.num_rgb));
+
+ while (!xdev->cman.dither_ramp && ramp_size >= 3) {
+ xdev->color_info.dither_grays = ramp_size;
+ if (!setup_cube(xdev, ramp_size, false)) {
#ifdef DEBUG
- emprintf1(xdev->memory,
+ emprintf1(xdev->memory,
"Warning: failed to allocate %d level gray ramp.\n",
- ramp_size);
+ ramp_size);
#endif
- ramp_size /= 2;
- continue;
- }
- }
- if (!xdev->cman.dither_ramp) {
- goto monochrome;
- }
- }
-
- /* Allocate the dynamic color table. */
- alloc_dynamic_colors(xdev, xdev->cman.num_rgb -
- xdev->color_info.dither_grays);
- break;
+ ramp_size /= 2;
+ continue;
+ }
+ }
+ if (!xdev->cman.dither_ramp) {
+ goto monochrome;
+ }
+ }
+
+ /* Allocate the dynamic color table. */
+ alloc_dynamic_colors(xdev, xdev->cman.num_rgb -
+ xdev->color_info.dither_grays);
+ break;
case 'M':
monochrome:
- xdev->color_info.num_components = 1;
- xdev->color_info.gray_index = 0;
- xdev->color_info.max_gray = 1;
- xdev->color_info.dither_grays = 2;
- break;
+ xdev->color_info.num_components = 1;
+ xdev->color_info.gray_index = 0;
+ xdev->color_info.max_gray = 1;
+ xdev->color_info.dither_grays = 2;
+ break;
default:
- emprintf1(xdev->memory, "Unknown palette: %s\n", xdev->palette);
- if (xdev->cman.color_to_rgb.values) {
- gs_x_free(xdev->memory, xdev->cman.color_to_rgb.values, "gdevx color_to_rgb");
- xdev->cman.color_to_rgb.values = 0;
- }
- return_error(gs_error_rangecheck);
+ emprintf1(xdev->memory, "Unknown palette: %s\n", xdev->palette);
+ if (xdev->cman.color_to_rgb.values) {
+ gs_x_free(xdev->memory, xdev->cman.color_to_rgb.values, "gdevx color_to_rgb");
+ xdev->cman.color_to_rgb.values = 0;
+ }
+ return_error(gs_error_rangecheck);
}
#if HaveStdCMap
@@ -454,14 +454,14 @@ monochrome:
* many bits as actually fit in a pixel, even if the hardware has more.
*/
if (!gx_device_must_halftone(xdev)) {
- if (xdev->cman.std_cmap.map) {
- xdev->cman.match_mask.red &=
- X_max_color_value << xdev->cman.std_cmap.red.cv_shift;
- xdev->cman.match_mask.green &=
- X_max_color_value << xdev->cman.std_cmap.green.cv_shift;
- xdev->cman.match_mask.blue &=
- X_max_color_value << xdev->cman.std_cmap.blue.cv_shift;
- }
+ if (xdev->cman.std_cmap.map) {
+ xdev->cman.match_mask.red &=
+ X_max_color_value << xdev->cman.std_cmap.red.cv_shift;
+ xdev->cman.match_mask.green &=
+ X_max_color_value << xdev->cman.std_cmap.green.cv_shift;
+ xdev->cman.match_mask.blue &=
+ X_max_color_value << xdev->cman.std_cmap.blue.cv_shift;
+ }
}
#endif
@@ -474,20 +474,20 @@ void
gdev_x_free_dynamic_colors(gx_device_X *xdev)
{
if (xdev->cman.dynamic.colors) {
- int i;
- x11_color_t *xcp;
- x11_color_t *next;
-
- for (i = 0; i < xdev->cman.dynamic.size; i++) {
- for (xcp = xdev->cman.dynamic.colors[i]; xcp; xcp = next) {
- next = xcp->next;
- if (xcp->color.pad)
- x_free_colors(xdev, &xcp->color.pixel, 1);
- gs_x_free(xdev->memory, xcp, "x11_dynamic_color");
- }
- xdev->cman.dynamic.colors[i] = NULL;
- }
- xdev->cman.dynamic.used = 0;
+ int i;
+ x11_color_t *xcp;
+ x11_color_t *next;
+
+ for (i = 0; i < xdev->cman.dynamic.size; i++) {
+ for (xcp = xdev->cman.dynamic.colors[i]; xcp; xcp = next) {
+ next = xcp->next;
+ if (xcp->color.pad)
+ x_free_colors(xdev, &xcp->color.pixel, 1);
+ gs_x_free(xdev->memory, xcp, "x11_dynamic_color");
+ }
+ xdev->cman.dynamic.colors[i] = NULL;
+ }
+ xdev->cman.dynamic.used = 0;
}
}
@@ -500,22 +500,22 @@ void
gdev_x_free_colors(gx_device_X *xdev)
{
if (xdev->cman.std_cmap.free_map) {
- /* XFree is declared as taking a char *, not a void *! */
- XFree((void *)xdev->cman.std_cmap.map);
- xdev->cman.std_cmap.free_map = false;
+ /* XFree is declared as taking a char *, not a void *! */
+ XFree((void *)xdev->cman.std_cmap.map);
+ xdev->cman.std_cmap.free_map = false;
}
xdev->cman.std_cmap.map = 0;
if (xdev->cman.dither_ramp)
- gs_x_free(xdev->memory, xdev->cman.dither_ramp, "x11 dither_colors");
+ gs_x_free(xdev->memory, xdev->cman.dither_ramp, "x11 dither_colors");
if (xdev->cman.dynamic.colors) {
- gdev_x_free_dynamic_colors(xdev);
- gs_x_free(xdev->memory, xdev->cman.dynamic.colors, "x11 cman.dynamic.colors");
- xdev->cman.dynamic.colors = NULL;
+ gdev_x_free_dynamic_colors(xdev);
+ gs_x_free(xdev->memory, xdev->cman.dynamic.colors, "x11 cman.dynamic.colors");
+ xdev->cman.dynamic.colors = NULL;
}
if (xdev->cman.color_to_rgb.values) {
- gs_x_free(xdev->memory, xdev->cman.color_to_rgb.values, "x11 color_to_rgb");
- xdev->cman.color_to_rgb.values = NULL;
- xdev->cman.color_to_rgb.size = 0;
+ gs_x_free(xdev->memory, xdev->cman.color_to_rgb.values, "x11 color_to_rgb");
+ xdev->cman.color_to_rgb.values = NULL;
+ xdev->cman.color_to_rgb.size = 0;
}
}
@@ -578,26 +578,26 @@ gdev_x_map_rgb_color(gx_device * dev, const gx_color_value cv[])
X_color_value db = b & xdev->cman.color_mask.blue;
{
- /* Foreground and background get special treatment: */
- /* They may be mapped to other colors. */
- /* Set mrgb to the color to be used for match testing. */
- X_color_value mr = r & xdev->cman.match_mask.red;
- X_color_value mg = g & xdev->cman.match_mask.green;
- X_color_value mb = b & xdev->cman.match_mask.blue;
-
- if ((mr | mg | mb) == 0) { /* i.e., all 0 */
- if_debug4('C', "[cX]%u,%u,%u => foreground = %lu\n",
- r, g, b, (ulong) xdev->foreground);
- return xdev->foreground;
- }
- if (mr == xdev->cman.match_mask.red &&
- mg == xdev->cman.match_mask.green &&
- mb == xdev->cman.match_mask.blue
- ) {
- if_debug4('C', "[cX]%u,%u,%u => background = %lu\n",
- r, g, b, (ulong) xdev->background);
- return xdev->background;
- }
+ /* Foreground and background get special treatment: */
+ /* They may be mapped to other colors. */
+ /* Set mrgb to the color to be used for match testing. */
+ X_color_value mr = r & xdev->cman.match_mask.red;
+ X_color_value mg = g & xdev->cman.match_mask.green;
+ X_color_value mb = b & xdev->cman.match_mask.blue;
+
+ if ((mr | mg | mb) == 0) { /* i.e., all 0 */
+ if_debug4('C', "[cX]%u,%u,%u => foreground = %lu\n",
+ r, g, b, (ulong) xdev->foreground);
+ return xdev->foreground;
+ }
+ if (mr == xdev->cman.match_mask.red &&
+ mg == xdev->cman.match_mask.green &&
+ mb == xdev->cman.match_mask.blue
+ ) {
+ if_debug4('C', "[cX]%u,%u,%u => background = %lu\n",
+ r, g, b, (ulong) xdev->background);
+ return xdev->background;
+ }
}
#define CV_DENOM (gx_max_color_value + 1)
@@ -605,179 +605,178 @@ gdev_x_map_rgb_color(gx_device * dev, const gx_color_value cv[])
#if HaveStdCMap
/* check the standard colormap first */
if (xdev->cman.std_cmap.map) {
- const XStandardColormap *cmap = xdev->cman.std_cmap.map;
-
- if (gx_device_has_color(xdev)) {
- uint cr, cg, cb; /* rgb cube indices */
- X_color_value cvr, cvg, cvb; /* color value on cube */
-
- if (xdev->cman.std_cmap.fast) {
- cr = r >> xdev->cman.std_cmap.red.cv_shift;
- cvr = xdev->cman.std_cmap.red.nearest[cr];
- cg = g >> xdev->cman.std_cmap.green.cv_shift;
- cvg = xdev->cman.std_cmap.green.nearest[cg];
- cb = b >> xdev->cman.std_cmap.blue.cv_shift;
- cvb = xdev->cman.std_cmap.blue.nearest[cb];
- } else {
- cr = r * (cmap->red_max + 1) / CV_DENOM;
- cg = g * (cmap->green_max + 1) / CV_DENOM;
- cb = b * (cmap->blue_max + 1) / CV_DENOM;
- cvr = X_max_color_value * cr / cmap->red_max;
- cvg = X_max_color_value * cg / cmap->green_max;
- cvb = X_max_color_value * cb / cmap->blue_max;
- }
- if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0 &&
- (iabs((int)g - (int)cvg) & xdev->cman.match_mask.green) == 0 &&
- (iabs((int)b - (int)cvb) & xdev->cman.match_mask.blue) == 0) {
- gx_color_index pixel =
- (xdev->cman.std_cmap.fast ?
- (cr << xdev->cman.std_cmap.red.pixel_shift) +
- (cg << xdev->cman.std_cmap.green.pixel_shift) +
- (cb << xdev->cman.std_cmap.blue.pixel_shift) :
- cr * cmap->red_mult + cg * cmap->green_mult +
- cb * cmap->blue_mult) + cmap->base_pixel;
-
- if_debug4('C', "[cX]%u,%u,%u (std cmap) => %lu\n",
- r, g, b, pixel); /* NB: gx_color_index size is 4 or 8 */
- return pixel;
- }
- if_debug3('C', "[cX]%u,%u,%u (std cmap fails)\n", r, g, b);
- } else {
- uint cr;
- X_color_value cvr;
-
- cr = r * (cmap->red_max + 1) / CV_DENOM;
- cvr = X_max_color_value * cr / cmap->red_max;
- if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0) {
- gx_color_index pixel = cr * cmap->red_mult + cmap->base_pixel;
-
- if_debug2('C', "[cX]%u (std cmap) => %lu\n", r, pixel);
- return pixel;
- }
- if_debug1('C', "[cX]%u (std cmap fails)\n", r);
- }
+ const XStandardColormap *cmap = xdev->cman.std_cmap.map;
+
+ if (gx_device_has_color(xdev)) {
+ uint cr, cg, cb; /* rgb cube indices */
+ X_color_value cvr, cvg, cvb; /* color value on cube */
+
+ if (xdev->cman.std_cmap.fast) {
+ cr = r >> xdev->cman.std_cmap.red.cv_shift;
+ cvr = xdev->cman.std_cmap.red.nearest[cr];
+ cg = g >> xdev->cman.std_cmap.green.cv_shift;
+ cvg = xdev->cman.std_cmap.green.nearest[cg];
+ cb = b >> xdev->cman.std_cmap.blue.cv_shift;
+ cvb = xdev->cman.std_cmap.blue.nearest[cb];
+ } else {
+ cr = r * (cmap->red_max + 1) / CV_DENOM;
+ cg = g * (cmap->green_max + 1) / CV_DENOM;
+ cb = b * (cmap->blue_max + 1) / CV_DENOM;
+ cvr = X_max_color_value * cr / cmap->red_max;
+ cvg = X_max_color_value * cg / cmap->green_max;
+ cvb = X_max_color_value * cb / cmap->blue_max;
+ }
+ if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0 &&
+ (iabs((int)g - (int)cvg) & xdev->cman.match_mask.green) == 0 &&
+ (iabs((int)b - (int)cvb) & xdev->cman.match_mask.blue) == 0) {
+ gx_color_index pixel =
+ (xdev->cman.std_cmap.fast ?
+ (cr << xdev->cman.std_cmap.red.pixel_shift) +
+ (cg << xdev->cman.std_cmap.green.pixel_shift) +
+ (cb << xdev->cman.std_cmap.blue.pixel_shift) :
+ cr * cmap->red_mult + cg * cmap->green_mult +
+ cb * cmap->blue_mult) + cmap->base_pixel;
+
+ if_debug4('C', "[cX]%u,%u,%u (std cmap) => %lu\n",
+ r, g, b, pixel); /* NB: gx_color_index size is 4 or 8 */
+ return pixel;
+ }
+ if_debug3('C', "[cX]%u,%u,%u (std cmap fails)\n", r, g, b);
+ } else {
+ uint cr;
+ X_color_value cvr;
+
+ cr = r * (cmap->red_max + 1) / CV_DENOM;
+ cvr = X_max_color_value * cr / cmap->red_max;
+ if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0) {
+ gx_color_index pixel = cr * cmap->red_mult + cmap->base_pixel;
+
+ if_debug2('C', "[cX]%u (std cmap) => %lu\n", r, pixel);
+ return pixel;
+ }
+ if_debug1('C', "[cX]%u (std cmap fails)\n", r);
+ }
} else
#endif
- /* If there is no standard colormap, check the dither cube/ramp */
+ /* If there is no standard colormap, check the dither cube/ramp */
if (xdev->cman.dither_ramp) {
- if (gx_device_has_color(xdev)) {
- uint cr, cg, cb; /* rgb cube indices */
- X_color_value cvr, cvg, cvb; /* color value on cube */
- int dither_rgb = xdev->color_info.dither_colors;
- uint max_rgb = dither_rgb - 1;
-
- cr = r * dither_rgb / CV_DENOM;
- cg = g * dither_rgb / CV_DENOM;
- cb = b * dither_rgb / CV_DENOM;
- if (max_rgb < countof(cv_tables)) {
- const ushort *cv_tab = cv_tables[max_rgb];
-
- cvr = cv_tab[cr];
- cvg = cv_tab[cg];
- cvb = cv_tab[cb];
- } else {
- cvr = CV_FRACTION(cr, max_rgb);
- cvg = CV_FRACTION(cg, max_rgb);
- cvb = CV_FRACTION(cb, max_rgb);
- }
- if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0 &&
- (iabs((int)g - (int)cvg) & xdev->cman.match_mask.green) == 0 &&
- (iabs((int)b - (int)cvb) & xdev->cman.match_mask.blue) == 0) {
- gx_color_index pixel =
- xdev->cman.dither_ramp[CUBE_INDEX(cr, cg, cb)];
-
- if_debug4('C', "[cX]%u,%u,%u (dither cube) => %lu\n",
- r, g, b, pixel);
- return pixel;
- }
- if_debug3('C', "[cX]%u,%u,%u (dither cube fails)\n", r, g, b);
- } else {
- uint cr;
- X_color_value cvr;
- int dither_grays = xdev->color_info.dither_grays;
- uint max_gray = dither_grays - 1;
-
- cr = r * dither_grays / CV_DENOM;
- cvr = (X_max_color_value * cr / max_gray);
- if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0) {
- gx_color_index pixel = xdev->cman.dither_ramp[cr];
-
- if_debug2('C', "[cX]%u (dither ramp) => %lu\n", r, pixel);
- return pixel;
- }
- if_debug1('C', "[cX]%u (dither ramp fails)\n", r);
- }
+ if (gx_device_has_color(xdev)) {
+ uint cr, cg, cb; /* rgb cube indices */
+ X_color_value cvr, cvg, cvb; /* color value on cube */
+ int dither_rgb = xdev->color_info.dither_colors;
+ uint max_rgb = dither_rgb - 1;
+
+ cr = r * dither_rgb / CV_DENOM;
+ cg = g * dither_rgb / CV_DENOM;
+ cb = b * dither_rgb / CV_DENOM;
+ if (max_rgb < countof(cv_tables)) {
+ const ushort *cv_tab = cv_tables[max_rgb];
+
+ cvr = cv_tab[cr];
+ cvg = cv_tab[cg];
+ cvb = cv_tab[cb];
+ } else {
+ cvr = CV_FRACTION(cr, max_rgb);
+ cvg = CV_FRACTION(cg, max_rgb);
+ cvb = CV_FRACTION(cb, max_rgb);
+ }
+ if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0 &&
+ (iabs((int)g - (int)cvg) & xdev->cman.match_mask.green) == 0 &&
+ (iabs((int)b - (int)cvb) & xdev->cman.match_mask.blue) == 0) {
+ gx_color_index pixel =
+ xdev->cman.dither_ramp[CUBE_INDEX(cr, cg, cb)];
+
+ if_debug4('C', "[cX]%u,%u,%u (dither cube) => %lu\n",
+ r, g, b, pixel);
+ return pixel;
+ }
+ if_debug3('C', "[cX]%u,%u,%u (dither cube fails)\n", r, g, b);
+ } else {
+ uint cr;
+ X_color_value cvr;
+ int dither_grays = xdev->color_info.dither_grays;
+ uint max_gray = dither_grays - 1;
+
+ cr = r * dither_grays / CV_DENOM;
+ cvr = (X_max_color_value * cr / max_gray);
+ if ((iabs((int)r - (int)cvr) & xdev->cman.match_mask.red) == 0) {
+ gx_color_index pixel = xdev->cman.dither_ramp[cr];
+
+ if_debug2('C', "[cX]%u (dither ramp) => %lu\n", r, pixel);
+ return pixel;
+ }
+ if_debug1('C', "[cX]%u (dither ramp fails)\n", r);
+ }
}
/* Finally look through the list of dynamic colors */
if (xdev->cman.dynamic.colors) {
- int i = (dr ^ dg ^ db) >> xdev->cman.dynamic.shift;
- x11_color_t *xcp = xdev->cman.dynamic.colors[i];
- x11_color_t *prev = NULL;
- XColor xc;
-
- for (; xcp; prev = xcp, xcp = xcp->next)
- if (xcp->color.red == dr && xcp->color.green == dg &&
- xcp->color.blue == db) {
- /* Promote the found entry to the front of the list. */
- if (prev) {
- prev->next = xcp->next;
- xcp->next = xdev->cman.dynamic.colors[i];
- xdev->cman.dynamic.colors[i] = xcp;
- }
- if (xcp->color.pad) {
- if_debug4('C', "[cX]%u,%u,%u (dynamic) => %lu\n",
- r, g, b, (ulong) xcp->color.pixel);
- return xcp->color.pixel;
- } else {
- if_debug3('C', "[cX]%u,%u,%u (dynamic) => missing\n",
- r, g, b);
- return gx_no_color_index;
- }
- }
-
- /* If not in our list of dynamic colors, */
- /* ask the X server and add an entry. */
- /* First check if dynamic table is exhausted */
- if (xdev->cman.dynamic.used > xdev->cman.dynamic.max_used) {
- if_debug3('C', "[cX]%u,%u,%u (dynamic) => full\n", r, g, b);
- return gx_no_color_index;
- }
- xcp = (x11_color_t *)
- gs_malloc(xdev->memory, sizeof(x11_color_t), 1, "x11_dynamic_color");
- if (!xcp)
- return gx_no_color_index;
- xc.red = xcp->color.red = dr;
- xc.green = xcp->color.green = dg;
- xc.blue = xcp->color.blue = db;
- xcp->next = xdev->cman.dynamic.colors[i];
- xdev->cman.dynamic.colors[i] = xcp;
- xdev->cman.dynamic.used++;
- if (x_alloc_color(xdev, &xc)) {
- xcp->color.pixel = xc.pixel;
- xcp->color.pad = true;
- if_debug5('c', "[cX]0x%x,0x%x,0x%x (dynamic) => added [%d]%lu\n",
- dr, dg, db, xdev->cman.dynamic.used - 1,
- (ulong)xc.pixel);
- return xc.pixel;
- } else {
- xcp->color.pad = false;
- if_debug3('c', "[cX]0x%x,0x%x,0x%x (dynamic) => can't alloc\n",
- dr, dg, db);
- return gx_no_color_index;
- }
+ int i = (dr ^ dg ^ db) >> xdev->cman.dynamic.shift;
+ x11_color_t *xcp = xdev->cman.dynamic.colors[i];
+ x11_color_t *prev = NULL;
+ XColor xc;
+
+ for (; xcp; prev = xcp, xcp = xcp->next)
+ if (xcp->color.red == dr && xcp->color.green == dg &&
+ xcp->color.blue == db) {
+ /* Promote the found entry to the front of the list. */
+ if (prev) {
+ prev->next = xcp->next;
+ xcp->next = xdev->cman.dynamic.colors[i];
+ xdev->cman.dynamic.colors[i] = xcp;
+ }
+ if (xcp->color.pad) {
+ if_debug4('C', "[cX]%u,%u,%u (dynamic) => %lu\n",
+ r, g, b, (ulong) xcp->color.pixel);
+ return xcp->color.pixel;
+ } else {
+ if_debug3('C', "[cX]%u,%u,%u (dynamic) => missing\n",
+ r, g, b);
+ return gx_no_color_index;
+ }
+ }
+
+ /* If not in our list of dynamic colors, */
+ /* ask the X server and add an entry. */
+ /* First check if dynamic table is exhausted */
+ if (xdev->cman.dynamic.used > xdev->cman.dynamic.max_used) {
+ if_debug3('C', "[cX]%u,%u,%u (dynamic) => full\n", r, g, b);
+ return gx_no_color_index;
+ }
+ xcp = (x11_color_t *)
+ gs_malloc(xdev->memory, sizeof(x11_color_t), 1, "x11_dynamic_color");
+ if (!xcp)
+ return gx_no_color_index;
+ xc.red = xcp->color.red = dr;
+ xc.green = xcp->color.green = dg;
+ xc.blue = xcp->color.blue = db;
+ xcp->next = xdev->cman.dynamic.colors[i];
+ xdev->cman.dynamic.colors[i] = xcp;
+ xdev->cman.dynamic.used++;
+ if (x_alloc_color(xdev, &xc)) {
+ xcp->color.pixel = xc.pixel;
+ xcp->color.pad = true;
+ if_debug5('c', "[cX]0x%x,0x%x,0x%x (dynamic) => added [%d]%lu\n",
+ dr, dg, db, xdev->cman.dynamic.used - 1,
+ (ulong)xc.pixel);
+ return xc.pixel;
+ } else {
+ xcp->color.pad = false;
+ if_debug3('c', "[cX]0x%x,0x%x,0x%x (dynamic) => can't alloc\n",
+ dr, dg, db);
+ return gx_no_color_index;
+ }
}
if_debug3('C', "[cX]%u,%u,%u fails\n", r, g, b);
return gx_no_color_index;
#undef CV_DENOM
}
-
/* Map a pixel value back to r-g-b. */
int
gdev_x_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
const gx_device_X *const xdev = (const gx_device_X *) dev;
#if HaveStdCMap
@@ -785,55 +784,55 @@ gdev_x_map_color_rgb(gx_device * dev, gx_color_index color,
#endif
if (color == xdev->foreground) {
- prgb[0] = prgb[1] = prgb[2] = 0;
- return 0;
+ prgb[0] = prgb[1] = prgb[2] = 0;
+ return 0;
}
if (color == xdev->background) {
- prgb[0] = prgb[1] = prgb[2] = gx_max_color_value;
- return 0;
+ prgb[0] = prgb[1] = prgb[2] = gx_max_color_value;
+ return 0;
}
if (color < xdev->cman.color_to_rgb.size) {
- const x11_rgb_t *pxrgb = &xdev->cman.color_to_rgb.values[color];
-
- if (pxrgb->defined) {
- prgb[0] = pxrgb->rgb[0];
- prgb[1] = pxrgb->rgb[1];
- prgb[2] = pxrgb->rgb[2];
- return 0;
- }
+ const x11_rgb_t *pxrgb = &xdev->cman.color_to_rgb.values[color];
+
+ if (pxrgb->defined) {
+ prgb[0] = pxrgb->rgb[0];
+ prgb[1] = pxrgb->rgb[1];
+ prgb[2] = pxrgb->rgb[2];
+ return 0;
+ }
#if HaveStdCMap
}
/* Check the standard colormap. */
if (cmap) {
- if (color >= cmap->base_pixel) {
- x_pixel value = color - cmap->base_pixel;
- uint r = (value / cmap->red_mult) % (cmap->red_max + 1);
- uint g = (value / cmap->green_mult) % (cmap->green_max + 1);
- uint b = (value / cmap->blue_mult) % (cmap->blue_max + 1);
-
- if (value == r * cmap->red_mult + g * cmap->green_mult +
- b * cmap->blue_mult) {
- /* When mapping color buckets back to specific colors,
- * we can choose to map them to the darkest shades
- * (e.g., 0, 1/3, 2/3), to the lightest shades (e.g.,
- * 1/3-epsilon, 2/3-epsilon, 1-epsilon), to the middle
- * shades (e.g., 1/6, 1/2, 5/6), or for maximum range
- * (e.g., 0, 1/2, 1). The last of these matches the
- * assumptions of the halftoning code, so that is what
- * we choose.
- */
- prgb[0] = r * gx_max_color_value / cmap->red_max;
- prgb[1] = g * gx_max_color_value / cmap->green_max;
- prgb[2] = b * gx_max_color_value / cmap->blue_max;
- return 0;
- }
- }
+ if (color >= cmap->base_pixel) {
+ x_pixel value = color - cmap->base_pixel;
+ uint r = (value / cmap->red_mult) % (cmap->red_max + 1);
+ uint g = (value / cmap->green_mult) % (cmap->green_max + 1);
+ uint b = (value / cmap->blue_mult) % (cmap->blue_max + 1);
+
+ if (value == r * cmap->red_mult + g * cmap->green_mult +
+ b * cmap->blue_mult) {
+ /* When mapping color buckets back to specific colors,
+ * we can choose to map them to the darkest shades
+ * (e.g., 0, 1/3, 2/3), to the lightest shades (e.g.,
+ * 1/3-epsilon, 2/3-epsilon, 1-epsilon), to the middle
+ * shades (e.g., 1/6, 1/2, 5/6), or for maximum range
+ * (e.g., 0, 1/2, 1). The last of these matches the
+ * assumptions of the halftoning code, so that is what
+ * we choose.
+ */
+ prgb[0] = r * gx_max_color_value / cmap->red_max;
+ prgb[1] = g * gx_max_color_value / cmap->green_max;
+ prgb[2] = b * gx_max_color_value / cmap->blue_max;
+ return 0;
+ }
+ }
}
if (color < xdev->cman.color_to_rgb.size) {
#endif
- /* Error -- undefined pixel value. */
- return_error(gs_error_unknownerror);
+ /* Error -- undefined pixel value. */
+ return_error(gs_error_unknownerror);
}
/*
* Check the dither cube/ramp. This is hardly ever used, since if
@@ -841,54 +840,54 @@ gdev_x_map_color_rgb(gx_device * dev, gx_color_index color,
* are likely to be small enough to index color_to_rgb.
*/
if (xdev->cman.dither_ramp) {
- if (gx_device_has_color(xdev)) {
- int size = xdev->color_info.dither_colors;
- int size3 = size * size * size;
- int i;
-
- for (i = 0; i < size3; ++i)
- if (xdev->cman.dither_ramp[i] == color) {
- uint max_rgb = size - 1;
- uint q = i / size,
- r = q / size,
- g = q % size,
- b = i % size;
-
- /*
- * See above regarding the choice of color mapping
- * algorithm.
- */
- prgb[0] = r * gx_max_color_value / max_rgb;
- prgb[1] = g * gx_max_color_value / max_rgb;
- prgb[2] = b * gx_max_color_value / max_rgb;
- return 0;
- }
- } else {
- int size = xdev->color_info.dither_grays;
- int i;
-
- for (i = 0; i < size; ++i)
- if (xdev->cman.dither_ramp[i] == color) {
- prgb[0] = prgb[1] = prgb[2] =
- i * gx_max_color_value / (size - 1);
- return 0;
- }
- }
+ if (gx_device_has_color(xdev)) {
+ int size = xdev->color_info.dither_colors;
+ int size3 = size * size * size;
+ int i;
+
+ for (i = 0; i < size3; ++i)
+ if (xdev->cman.dither_ramp[i] == color) {
+ uint max_rgb = size - 1;
+ uint q = i / size,
+ r = q / size,
+ g = q % size,
+ b = i % size;
+
+ /*
+ * See above regarding the choice of color mapping
+ * algorithm.
+ */
+ prgb[0] = r * gx_max_color_value / max_rgb;
+ prgb[1] = g * gx_max_color_value / max_rgb;
+ prgb[2] = b * gx_max_color_value / max_rgb;
+ return 0;
+ }
+ } else {
+ int size = xdev->color_info.dither_grays;
+ int i;
+
+ for (i = 0; i < size; ++i)
+ if (xdev->cman.dither_ramp[i] == color) {
+ prgb[0] = prgb[1] = prgb[2] =
+ i * gx_max_color_value / (size - 1);
+ return 0;
+ }
+ }
}
/* Finally, search the list of dynamic colors. */
if (xdev->cman.dynamic.colors) {
- int i;
- const x11_color_t *xcp;
-
- for (i = xdev->cman.dynamic.size; --i >= 0;)
- for (xcp = xdev->cman.dynamic.colors[i]; xcp; xcp = xcp->next)
- if (xcp->color.pixel == color && xcp->color.pad) {
- prgb[0] = xcp->color.red;
- prgb[1] = xcp->color.green;
- prgb[2] = xcp->color.blue;
- return 0;
- }
+ int i;
+ const x11_color_t *xcp;
+
+ for (i = xdev->cman.dynamic.size; --i >= 0;)
+ for (xcp = xdev->cman.dynamic.colors[i]; xcp; xcp = xcp->next)
+ if (xcp->color.pixel == color && xcp->color.pad) {
+ prgb[0] = xcp->color.red;
+ prgb[1] = xcp->color.green;
+ prgb[2] = xcp->color.blue;
+ return 0;
+ }
}
/* Not found -- not possible! */
diff --git a/gs/base/gdevxcmp.h b/gs/base/gdevxcmp.h
index e2c064793..3fa4fb103 100644
--- a/gs/base/gdevxcmp.h
+++ b/gs/base/gdevxcmp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -74,32 +74,32 @@ typedef struct x11_cman_s {
* fewer bits than color_mask if the device is not using halftones.
*/
struct cmm_ {
- X_color_value red, green, blue;
+ X_color_value red, green, blue;
} color_mask, match_mask;
#if HaveStdCMap /* Standard colormap stuff is only in X11R4 and later. */
struct {
- /*
- * map is the X standard colormap for the display and screen,
- * if one is available.
- */
- XStandardColormap *map;
-
- /*
- * When possible, we precompute shift values and tables that replace
- * some multiplies and divides.
- */
- bool fast;
- x11_cmap_values_t red, green, blue;
-
- /*
- * If free_map is true, we allocated the map ourselves (to
- * represent a TrueColor or Static Gray visual), and must free it
- * when closing the device.
- */
- bool free_map;
+ /*
+ * map is the X standard colormap for the display and screen,
+ * if one is available.
+ */
+ XStandardColormap *map;
+
+ /*
+ * When possible, we precompute shift values and tables that replace
+ * some multiplies and divides.
+ */
+ bool fast;
+ x11_cmap_values_t red, green, blue;
+
+ /*
+ * If free_map is true, we allocated the map ourselves (to
+ * represent a TrueColor or Static Gray visual), and must free it
+ * when closing the device.
+ */
+ bool free_map;
} std_cmap;
@@ -111,8 +111,8 @@ typedef struct x11_cman_s {
* through the standard colormap or query the server.
*/
struct cmc_ {
- int size; /* min(1 << depth, 256) */
- x11_rgb_t *values; /* [color_to_rgb.size] */
+ int size; /* min(1 << depth, 256) */
+ x11_rgb_t *values; /* [color_to_rgb.size] */
} color_to_rgb;
/*
@@ -121,9 +121,9 @@ typedef struct x11_cman_s {
* dithering.
*/
#define CUBE_INDEX(r,g,b) (((r) * xdev->color_info.dither_colors + (g)) * \
- xdev->color_info.dither_colors + (b))
+ xdev->color_info.dither_colors + (b))
x_pixel *dither_ramp; /* [color_info.dither_colors^3] if color,
- [color_info.dither_grays] if gray */
+ [color_info.dither_grays] if gray */
/*
* For systems with writable colormaps, dynamic.colors is a chained
@@ -131,11 +131,11 @@ typedef struct x11_cman_s {
* pixel values. Entries are added dynamically.
*/
struct cmd_ {
- int size;
- x11_color_t **colors; /* [size] */
- int shift; /* 16 - log2(size) */
- int used;
- int max_used;
+ int size;
+ x11_color_t **colors; /* [size] */
+ int shift; /* 16 - log2(size) */
+ int used;
+ int max_used;
} dynamic;
} x11_cman_t;
diff --git a/gs/base/gdevxini.c b/gs/base/gdevxini.c
index af3743187..7769e2853 100644
--- a/gs/base/gdevxini.c
+++ b/gs/base/gdevxini.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,9 +67,9 @@ static int
x_catch_alloc(Display * dpy, XErrorEvent * err)
{
if (err->error_code == BadAlloc)
- x_error_handler.alloc_error = True;
+ x_error_handler.alloc_error = True;
if (x_error_handler.alloc_error)
- return 0;
+ return 0;
return x_error_handler.oldhandler(dpy, err);
}
@@ -77,7 +77,7 @@ int
x_catch_free_colors(Display * dpy, XErrorEvent * err)
{
if (err->request_code == X_FreeColors)
- return 0;
+ return 0;
return x_error_handler.orighandler(dpy, err);
}
@@ -101,179 +101,179 @@ gdev_x_open(gx_device_X * xdev)
#ifdef DEBUG
# ifdef have_Xdebug
if (gs_debug['X']) {
- extern int _Xdebug;
+ extern int _Xdebug;
- _Xdebug = 1;
+ _Xdebug = 1;
}
# endif
#endif
if (!(xdev->dpy = XOpenDisplay((char *)NULL))) {
- char *dispname = getenv("DISPLAY");
+ char *dispname = getenv("DISPLAY");
emprintf1(xdev->memory,
"Cannot open X display `%s'.\n",
- (dispname == NULL ? "(null)" : dispname));
- return_error(gs_error_ioerror);
+ (dispname == NULL ? "(null)" : dispname));
+ return_error(gs_error_ioerror);
}
xdev->dest = 0;
if ((window_id = getenv("GHOSTVIEW"))) {
- if (!(xdev->ghostview = sscanf(window_id, "%ld %ld",
- &(xdev->win), &(xdev->dest)))) {
+ if (!(xdev->ghostview = sscanf(window_id, "%ld %ld",
+ &(xdev->win), &(xdev->dest)))) {
emprintf(xdev->memory, "Cannot get Window ID from ghostview.\n");
- return_error(gs_error_ioerror);
- }
+ return_error(gs_error_ioerror);
+ }
}
if (xdev->pwin != (Window) None) { /* pick up the destination window parameters if specified */
- XWindowAttributes attrib;
-
- xdev->win = xdev->pwin;
- if (XGetWindowAttributes(xdev->dpy, xdev->win, &attrib)) {
- xdev->scr = attrib.screen;
- xvinfo.visual = attrib.visual;
- xdev->cmap = attrib.colormap;
- xid_width = attrib.width;
- xid_height = attrib.height;
- } else {
- /* No idea why we can't get the attributes, but */
- /* we shouldn't let it lead to a failure below. */
- xid_width = xid_height = 0;
- }
+ XWindowAttributes attrib;
+
+ xdev->win = xdev->pwin;
+ if (XGetWindowAttributes(xdev->dpy, xdev->win, &attrib)) {
+ xdev->scr = attrib.screen;
+ xvinfo.visual = attrib.visual;
+ xdev->cmap = attrib.colormap;
+ xid_width = attrib.width;
+ xid_height = attrib.height;
+ } else {
+ /* No idea why we can't get the attributes, but */
+ /* we shouldn't let it lead to a failure below. */
+ xid_width = xid_height = 0;
+ }
} else if (xdev->ghostview) {
- XWindowAttributes attrib;
- Atom type;
- int format;
- unsigned long nitems, bytes_after;
- char *buf;
- Atom ghostview_atom = XInternAtom(xdev->dpy, "GHOSTVIEW", False);
-
- if (XGetWindowAttributes(xdev->dpy, xdev->win, &attrib)) {
- xdev->scr = attrib.screen;
- xvinfo.visual = attrib.visual;
- xdev->cmap = attrib.colormap;
- xdev->width = attrib.width;
- xdev->height = attrib.height;
- }
- /* Delete property if explicit dest is given */
- if (XGetWindowProperty(xdev->dpy, xdev->win, ghostview_atom, 0,
- 256, (xdev->dest != 0), XA_STRING,
- &type, &format, &nitems, &bytes_after,
- (unsigned char **)&buf) == 0 &&
- type == XA_STRING) {
- int llx, lly, urx, ury;
- int left_margin = 0, bottom_margin = 0;
- int right_margin = 0, top_margin = 0;
-
- /* We declare page_orientation as an int so that we can */
- /* use an int * to reference it for sscanf; compilers */
- /* might be tempted to use less space to hold it if */
- /* it were declared as an orientation. */
- int /*orientation */ page_orientation;
- float xppp, yppp; /* pixels per point */
-
- nitems = sscanf(buf,
- "%ld %d %d %d %d %d %f %f %d %d %d %d",
- &(xdev->bpixmap), &page_orientation,
- &llx, &lly, &urx, &ury,
- &(xdev->x_pixels_per_inch),
- &(xdev->y_pixels_per_inch),
- &left_margin, &bottom_margin,
- &right_margin, &top_margin);
- if (!(nitems == 8 || nitems == 12)) {
- emprintf(xdev->memory, "Cannot get ghostview property.\n");
- return_error(gs_error_ioerror);
- }
- if (xdev->dest && xdev->bpixmap) {
- emprintf(xdev->memory,
+ XWindowAttributes attrib;
+ Atom type;
+ int format;
+ unsigned long nitems, bytes_after;
+ char *buf;
+ Atom ghostview_atom = XInternAtom(xdev->dpy, "GHOSTVIEW", False);
+
+ if (XGetWindowAttributes(xdev->dpy, xdev->win, &attrib)) {
+ xdev->scr = attrib.screen;
+ xvinfo.visual = attrib.visual;
+ xdev->cmap = attrib.colormap;
+ xdev->width = attrib.width;
+ xdev->height = attrib.height;
+ }
+ /* Delete property if explicit dest is given */
+ if (XGetWindowProperty(xdev->dpy, xdev->win, ghostview_atom, 0,
+ 256, (xdev->dest != 0), XA_STRING,
+ &type, &format, &nitems, &bytes_after,
+ (unsigned char **)&buf) == 0 &&
+ type == XA_STRING) {
+ int llx, lly, urx, ury;
+ int left_margin = 0, bottom_margin = 0;
+ int right_margin = 0, top_margin = 0;
+
+ /* We declare page_orientation as an int so that we can */
+ /* use an int * to reference it for sscanf; compilers */
+ /* might be tempted to use less space to hold it if */
+ /* it were declared as an orientation. */
+ int /*orientation */ page_orientation;
+ float xppp, yppp; /* pixels per point */
+
+ nitems = sscanf(buf,
+ "%ld %d %d %d %d %d %f %f %d %d %d %d",
+ &(xdev->bpixmap), &page_orientation,
+ &llx, &lly, &urx, &ury,
+ &(xdev->x_pixels_per_inch),
+ &(xdev->y_pixels_per_inch),
+ &left_margin, &bottom_margin,
+ &right_margin, &top_margin);
+ if (!(nitems == 8 || nitems == 12)) {
+ emprintf(xdev->memory, "Cannot get ghostview property.\n");
+ return_error(gs_error_ioerror);
+ }
+ if (xdev->dest && xdev->bpixmap) {
+ emprintf(xdev->memory,
"Both destination and backing pixmap specified.\n");
- return_error(gs_error_rangecheck);
- }
- if (xdev->dest) {
- Window root;
- int x, y;
- unsigned int width, height;
- unsigned int border_width, depth;
-
- if (XGetGeometry(xdev->dpy, xdev->dest, &root, &x, &y,
- &width, &height, &border_width, &depth)) {
- xdev->width = width;
- xdev->height = height;
- }
- }
- xppp = xdev->x_pixels_per_inch / 72.0;
- yppp = xdev->y_pixels_per_inch / 72.0;
- switch (page_orientation) {
- case Portrait:
- xdev->initial_matrix.xx = xppp;
- xdev->initial_matrix.xy = 0.0;
- xdev->initial_matrix.yx = 0.0;
- xdev->initial_matrix.yy = -yppp;
- xdev->initial_matrix.tx = -llx * xppp;
- xdev->initial_matrix.ty = ury * yppp;
- break;
- case Landscape:
- xdev->initial_matrix.xx = 0.0;
- xdev->initial_matrix.xy = yppp;
- xdev->initial_matrix.yx = xppp;
- xdev->initial_matrix.yy = 0.0;
- xdev->initial_matrix.tx = -lly * xppp;
- xdev->initial_matrix.ty = -llx * yppp;
- break;
- case Upsidedown:
- xdev->initial_matrix.xx = -xppp;
- xdev->initial_matrix.xy = 0.0;
- xdev->initial_matrix.yx = 0.0;
- xdev->initial_matrix.yy = yppp;
- xdev->initial_matrix.tx = urx * xppp;
- xdev->initial_matrix.ty = -lly * yppp;
- break;
- case Seascape:
- xdev->initial_matrix.xx = 0.0;
- xdev->initial_matrix.xy = -yppp;
- xdev->initial_matrix.yx = -xppp;
- xdev->initial_matrix.yy = 0.0;
- xdev->initial_matrix.tx = ury * xppp;
- xdev->initial_matrix.ty = urx * yppp;
- break;
- }
-
- /* The following sets the imageable area according to the */
- /* bounding box and margins sent by ghostview. */
- /* This code has been patched many times; its current state */
- /* is per a recommendation by Tim Theisen on 4/28/95. */
-
- xdev->ImagingBBox[0] = llx - left_margin;
- xdev->ImagingBBox[1] = lly - bottom_margin;
- xdev->ImagingBBox[2] = urx + right_margin;
- xdev->ImagingBBox[3] = ury + top_margin;
- xdev->ImagingBBox_set = true;
-
- } else if (xdev->pwin == (Window) None) {
- emprintf(xdev->memory, "Cannot get ghostview property.\n");
- return_error(gs_error_ioerror);
- }
+ return_error(gs_error_rangecheck);
+ }
+ if (xdev->dest) {
+ Window root;
+ int x, y;
+ unsigned int width, height;
+ unsigned int border_width, depth;
+
+ if (XGetGeometry(xdev->dpy, xdev->dest, &root, &x, &y,
+ &width, &height, &border_width, &depth)) {
+ xdev->width = width;
+ xdev->height = height;
+ }
+ }
+ xppp = xdev->x_pixels_per_inch / 72.0;
+ yppp = xdev->y_pixels_per_inch / 72.0;
+ switch (page_orientation) {
+ case Portrait:
+ xdev->initial_matrix.xx = xppp;
+ xdev->initial_matrix.xy = 0.0;
+ xdev->initial_matrix.yx = 0.0;
+ xdev->initial_matrix.yy = -yppp;
+ xdev->initial_matrix.tx = -llx * xppp;
+ xdev->initial_matrix.ty = ury * yppp;
+ break;
+ case Landscape:
+ xdev->initial_matrix.xx = 0.0;
+ xdev->initial_matrix.xy = yppp;
+ xdev->initial_matrix.yx = xppp;
+ xdev->initial_matrix.yy = 0.0;
+ xdev->initial_matrix.tx = -lly * xppp;
+ xdev->initial_matrix.ty = -llx * yppp;
+ break;
+ case Upsidedown:
+ xdev->initial_matrix.xx = -xppp;
+ xdev->initial_matrix.xy = 0.0;
+ xdev->initial_matrix.yx = 0.0;
+ xdev->initial_matrix.yy = yppp;
+ xdev->initial_matrix.tx = urx * xppp;
+ xdev->initial_matrix.ty = -lly * yppp;
+ break;
+ case Seascape:
+ xdev->initial_matrix.xx = 0.0;
+ xdev->initial_matrix.xy = -yppp;
+ xdev->initial_matrix.yx = -xppp;
+ xdev->initial_matrix.yy = 0.0;
+ xdev->initial_matrix.tx = ury * xppp;
+ xdev->initial_matrix.ty = urx * yppp;
+ break;
+ }
+
+ /* The following sets the imageable area according to the */
+ /* bounding box and margins sent by ghostview. */
+ /* This code has been patched many times; its current state */
+ /* is per a recommendation by Tim Theisen on 4/28/95. */
+
+ xdev->ImagingBBox[0] = llx - left_margin;
+ xdev->ImagingBBox[1] = lly - bottom_margin;
+ xdev->ImagingBBox[2] = urx + right_margin;
+ xdev->ImagingBBox[3] = ury + top_margin;
+ xdev->ImagingBBox_set = true;
+
+ } else if (xdev->pwin == (Window) None) {
+ emprintf(xdev->memory, "Cannot get ghostview property.\n");
+ return_error(gs_error_ioerror);
+ }
} else {
- Screen *scr = DefaultScreenOfDisplay(xdev->dpy);
-
- xdev->scr = scr;
- xvinfo.visual = DefaultVisualOfScreen(scr);
- xdev->cmap = DefaultColormapOfScreen(scr);
- if (xvinfo.visual->class != TrueColor) {
- int scrno = DefaultScreen(xdev->dpy);
- if ( XMatchVisualInfo(xdev->dpy, scrno, 24, TrueColor, &xvinfo) ||
- XMatchVisualInfo(xdev->dpy, scrno, 32, TrueColor, &xvinfo) ||
- XMatchVisualInfo(xdev->dpy, scrno, 16, TrueColor, &xvinfo) ||
- XMatchVisualInfo(xdev->dpy, scrno, 15, TrueColor, &xvinfo) ) {
- xdev->cmap = XCreateColormap (xdev->dpy,
- DefaultRootWindow(xdev->dpy),
- xvinfo.visual, AllocNone );
- }
- }
+ Screen *scr = DefaultScreenOfDisplay(xdev->dpy);
+
+ xdev->scr = scr;
+ xvinfo.visual = DefaultVisualOfScreen(scr);
+ xdev->cmap = DefaultColormapOfScreen(scr);
+ if (xvinfo.visual->class != TrueColor) {
+ int scrno = DefaultScreen(xdev->dpy);
+ if ( XMatchVisualInfo(xdev->dpy, scrno, 24, TrueColor, &xvinfo) ||
+ XMatchVisualInfo(xdev->dpy, scrno, 32, TrueColor, &xvinfo) ||
+ XMatchVisualInfo(xdev->dpy, scrno, 16, TrueColor, &xvinfo) ||
+ XMatchVisualInfo(xdev->dpy, scrno, 15, TrueColor, &xvinfo) ) {
+ xdev->cmap = XCreateColormap (xdev->dpy,
+ DefaultRootWindow(xdev->dpy),
+ xvinfo.visual, AllocNone );
+ }
+ }
}
xvinfo.visualid = XVisualIDFromVisual(xvinfo.visual);
xdev->vinfo = XGetVisualInfo(xdev->dpy, VisualIDMask, &xvinfo, &nitems);
if (xdev->vinfo == NULL) {
- emprintf(xdev->memory, "Cannot get XVisualInfo.\n");
- return_error(gs_error_ioerror);
+ emprintf(xdev->memory, "Cannot get XVisualInfo.\n");
+ return_error(gs_error_ioerror);
}
/* Buggy X servers may cause a Bad Access on XFreeColors. */
x_error_handler.orighandler = XSetErrorHandler(x_catch_free_colors);
@@ -283,12 +283,12 @@ gdev_x_open(gx_device_X * xdev)
app_con = XtCreateApplicationContext();
XtAppSetFallbackResources(app_con, gdev_x_fallback_resources);
dpy = XtOpenDisplay(app_con, NULL, "ghostscript", "Ghostscript",
- NULL, 0, &zero, NULL);
+ NULL, 0, &zero, NULL);
toplevel = XtAppCreateShell(NULL, "Ghostscript",
- applicationShellWidgetClass, dpy, NULL, 0);
+ applicationShellWidgetClass, dpy, NULL, 0);
XtGetApplicationResources(toplevel, (XtPointer) xdev,
- gdev_x_resources, gdev_x_resource_count,
- NULL, 0);
+ gdev_x_resources, gdev_x_resource_count,
+ NULL, 0);
/* Reserve foreground and background colors under the regular connection. */
xc.pixel = xdev->foreground;
@@ -302,8 +302,8 @@ gdev_x_open(gx_device_X * xdev)
code = gdev_x_setup_colors(xdev);
if (code < 0) {
- XCloseDisplay(xdev->dpy);
- return code;
+ XCloseDisplay(xdev->dpy);
+ return code;
}
/* Now that the color map is setup check if the device is separable. */
check_device_separable((gx_device *)xdev);
@@ -311,137 +311,137 @@ gdev_x_open(gx_device_X * xdev)
gdev_x_setup_fontmap(xdev);
if (!xdev->ghostview) {
- XWMHints wm_hints;
- XSetWindowAttributes xswa;
- gx_device *dev = (gx_device *) xdev;
-
- /* Take care of resolution and paper size. */
- if (xdev->x_pixels_per_inch == FAKE_RES ||
- xdev->y_pixels_per_inch == FAKE_RES) {
- float xsize = (float)xdev->width / xdev->x_pixels_per_inch;
- float ysize = (float)xdev->height / xdev->y_pixels_per_inch;
- int workarea_width = WidthOfScreen(xdev->scr), workarea_height = HeightOfScreen(xdev->scr);
-
- /* Get area available for windows placement */
- x_get_work_area(xdev, &workarea_width, &workarea_height);
-
- if (xdev->xResolution == 0.0 && xdev->yResolution == 0.0) {
- float dpi, xdpi, ydpi;
-
- xdpi = 25.4 * WidthOfScreen(xdev->scr) /
- WidthMMOfScreen(xdev->scr);
- ydpi = 25.4 * HeightOfScreen(xdev->scr) /
- HeightMMOfScreen(xdev->scr);
- dpi = min(xdpi, ydpi);
- /*
- * Some X servers provide very large "virtual screens", and
- * return the virtual screen size for Width/HeightMM but the
- * physical size for Width/Height. Attempt to detect and
- * correct for this now. This is a KLUDGE required because
- * the X server provides no way to read the screen
- * resolution directly.
- */
- if (dpi < 30)
- dpi = 75; /* arbitrary */
- else {
- while (xsize * dpi > WidthOfScreen(xdev->scr) - 32 ||
- ysize * dpi > HeightOfScreen(xdev->scr) - 32)
- dpi *= 0.95;
- }
- xdev->x_pixels_per_inch = dpi;
- xdev->y_pixels_per_inch = dpi;
- } else {
- xdev->x_pixels_per_inch = xdev->xResolution;
- xdev->y_pixels_per_inch = xdev->yResolution;
- }
- /* Restrict maximum window size to available work area */
- if (xdev->width > workarea_width) {
- xdev->width = min(xsize * xdev->x_pixels_per_inch, workarea_width);
- }
- if (xdev->height > workarea_height) {
- xdev->height = min(ysize * xdev->y_pixels_per_inch, workarea_height);
- }
- xdev->MediaSize[0] =
- (float)xdev->width / xdev->x_pixels_per_inch * 72;
- xdev->MediaSize[1] =
- (float)xdev->height / xdev->y_pixels_per_inch * 72;
- }
- sizehints.x = 0;
- sizehints.y = 0;
- sizehints.width = xdev->width;
- sizehints.height = xdev->height;
- sizehints.flags = 0;
-
- if (xdev->geometry != NULL) {
- /*
- * Note that border_width must be set first. We can't use
- * scr, because that is a Screen*, and XWMGeometry wants
- * the screen number.
- */
- char gstr[40];
- int bitmask;
-
- sprintf(gstr, "%dx%d+%d+%d", sizehints.width,
- sizehints.height, sizehints.x, sizehints.y);
- bitmask = XWMGeometry(xdev->dpy, DefaultScreen(xdev->dpy),
- xdev->geometry, gstr, xdev->borderWidth,
- &sizehints,
- &sizehints.x, &sizehints.y,
- &sizehints.width, &sizehints.height,
- &sizehints.win_gravity);
-
- if (bitmask & (XValue | YValue))
- sizehints.flags |= USPosition;
- }
- gx_default_get_initial_matrix(dev, &(xdev->initial_matrix));
-
- if (xdev->pwin != (Window) None && xid_width != 0 && xid_height != 0) {
+ XWMHints wm_hints;
+ XSetWindowAttributes xswa;
+ gx_device *dev = (gx_device *) xdev;
+
+ /* Take care of resolution and paper size. */
+ if (xdev->x_pixels_per_inch == FAKE_RES ||
+ xdev->y_pixels_per_inch == FAKE_RES) {
+ float xsize = (float)xdev->width / xdev->x_pixels_per_inch;
+ float ysize = (float)xdev->height / xdev->y_pixels_per_inch;
+ int workarea_width = WidthOfScreen(xdev->scr), workarea_height = HeightOfScreen(xdev->scr);
+
+ /* Get area available for windows placement */
+ x_get_work_area(xdev, &workarea_width, &workarea_height);
+
+ if (xdev->xResolution == 0.0 && xdev->yResolution == 0.0) {
+ float dpi, xdpi, ydpi;
+
+ xdpi = 25.4 * WidthOfScreen(xdev->scr) /
+ WidthMMOfScreen(xdev->scr);
+ ydpi = 25.4 * HeightOfScreen(xdev->scr) /
+ HeightMMOfScreen(xdev->scr);
+ dpi = min(xdpi, ydpi);
+ /*
+ * Some X servers provide very large "virtual screens", and
+ * return the virtual screen size for Width/HeightMM but the
+ * physical size for Width/Height. Attempt to detect and
+ * correct for this now. This is a KLUDGE required because
+ * the X server provides no way to read the screen
+ * resolution directly.
+ */
+ if (dpi < 30)
+ dpi = 75; /* arbitrary */
+ else {
+ while (xsize * dpi > WidthOfScreen(xdev->scr) - 32 ||
+ ysize * dpi > HeightOfScreen(xdev->scr) - 32)
+ dpi *= 0.95;
+ }
+ xdev->x_pixels_per_inch = dpi;
+ xdev->y_pixels_per_inch = dpi;
+ } else {
+ xdev->x_pixels_per_inch = xdev->xResolution;
+ xdev->y_pixels_per_inch = xdev->yResolution;
+ }
+ /* Restrict maximum window size to available work area */
+ if (xdev->width > workarea_width) {
+ xdev->width = min(xsize * xdev->x_pixels_per_inch, workarea_width);
+ }
+ if (xdev->height > workarea_height) {
+ xdev->height = min(ysize * xdev->y_pixels_per_inch, workarea_height);
+ }
+ xdev->MediaSize[0] =
+ (float)xdev->width / xdev->x_pixels_per_inch * 72;
+ xdev->MediaSize[1] =
+ (float)xdev->height / xdev->y_pixels_per_inch * 72;
+ }
+ sizehints.x = 0;
+ sizehints.y = 0;
+ sizehints.width = xdev->width;
+ sizehints.height = xdev->height;
+ sizehints.flags = 0;
+
+ if (xdev->geometry != NULL) {
+ /*
+ * Note that border_width must be set first. We can't use
+ * scr, because that is a Screen*, and XWMGeometry wants
+ * the screen number.
+ */
+ char gstr[40];
+ int bitmask;
+
+ sprintf(gstr, "%dx%d+%d+%d", sizehints.width,
+ sizehints.height, sizehints.x, sizehints.y);
+ bitmask = XWMGeometry(xdev->dpy, DefaultScreen(xdev->dpy),
+ xdev->geometry, gstr, xdev->borderWidth,
+ &sizehints,
+ &sizehints.x, &sizehints.y,
+ &sizehints.width, &sizehints.height,
+ &sizehints.win_gravity);
+
+ if (bitmask & (XValue | YValue))
+ sizehints.flags |= USPosition;
+ }
+ gx_default_get_initial_matrix(dev, &(xdev->initial_matrix));
+
+ if (xdev->pwin != (Window) None && xid_width != 0 && xid_height != 0) {
#if 0 /*************** */
- /*
- * The user who originally implemented the WindowID feature
- * provided the following code to scale the displayed output
- * to fit in the window. We think this is a bad idea,
- * since it doesn't track window resizing and is generally
- * completely at odds with the way Ghostscript treats
- * window or paper size in all other contexts. We are
- * leaving the code here in case someone decides that
- * this really is the behavior they want.
- */
-
- /* Scale to fit in the window. */
- xdev->initial_matrix.xx
- = xdev->initial_matrix.xx *
- (float)xid_width / (float)xdev->width;
- xdev->initial_matrix.yy
- = xdev->initial_matrix.yy *
- (float)xid_height / (float)xdev->height;
+ /*
+ * The user who originally implemented the WindowID feature
+ * provided the following code to scale the displayed output
+ * to fit in the window. We think this is a bad idea,
+ * since it doesn't track window resizing and is generally
+ * completely at odds with the way Ghostscript treats
+ * window or paper size in all other contexts. We are
+ * leaving the code here in case someone decides that
+ * this really is the behavior they want.
+ */
+
+ /* Scale to fit in the window. */
+ xdev->initial_matrix.xx
+ = xdev->initial_matrix.xx *
+ (float)xid_width / (float)xdev->width;
+ xdev->initial_matrix.yy
+ = xdev->initial_matrix.yy *
+ (float)xid_height / (float)xdev->height;
#endif /*************** */
- xdev->width = xid_width;
- xdev->height = xid_height;
- xdev->initial_matrix.ty = xdev->height;
- } else { /* !xdev->pwin */
- xswa.event_mask = ExposureMask;
- xswa.background_pixel = xdev->background;
- xswa.border_pixel = xdev->borderColor;
- xswa.colormap = xdev->cmap;
- xdev->win = XCreateWindow(xdev->dpy, RootWindowOfScreen(xdev->scr),
- sizehints.x, sizehints.y, /* upper left */
- xdev->width, xdev->height,
- xdev->borderWidth,
- xdev->vinfo->depth,
- InputOutput, /* class */
- xdev->vinfo->visual, /* visual */
- CWEventMask | CWBackPixel |
- CWBorderPixel | CWColormap,
- &xswa);
- XStoreName(xdev->dpy, xdev->win, "ghostscript");
- XSetWMNormalHints(xdev->dpy, xdev->win, &sizehints);
- wm_hints.flags = InputHint;
- wm_hints.input = False;
- XSetWMHints(xdev->dpy, xdev->win, &wm_hints); /* avoid input focus */
- }
+ xdev->width = xid_width;
+ xdev->height = xid_height;
+ xdev->initial_matrix.ty = xdev->height;
+ } else { /* !xdev->pwin */
+ xswa.event_mask = ExposureMask;
+ xswa.background_pixel = xdev->background;
+ xswa.border_pixel = xdev->borderColor;
+ xswa.colormap = xdev->cmap;
+ xdev->win = XCreateWindow(xdev->dpy, RootWindowOfScreen(xdev->scr),
+ sizehints.x, sizehints.y, /* upper left */
+ xdev->width, xdev->height,
+ xdev->borderWidth,
+ xdev->vinfo->depth,
+ InputOutput, /* class */
+ xdev->vinfo->visual, /* visual */
+ CWEventMask | CWBackPixel |
+ CWBorderPixel | CWColormap,
+ &xswa);
+ XStoreName(xdev->dpy, xdev->win, "ghostscript");
+ XSetWMNormalHints(xdev->dpy, xdev->win, &sizehints);
+ wm_hints.flags = InputHint;
+ wm_hints.input = False;
+ XSetWMHints(xdev->dpy, xdev->win, &wm_hints); /* avoid input focus */
+ }
}
/***
*** According to Ricard Torres (torres@upf.es), we have to wait until here
@@ -467,42 +467,42 @@ gdev_x_open(gx_device_X * xdev)
xdev->gc = XCreateGC(xdev->dpy, xdev->win, 0, (XGCValues *) NULL);
XSetFunction(xdev->dpy, xdev->gc, GXcopy);
XSetLineAttributes(xdev->dpy, xdev->gc, 0,
- LineSolid, CapButt, JoinMiter);
+ LineSolid, CapButt, JoinMiter);
gdev_x_clear_window(xdev);
if (!xdev->ghostview) { /* Make the window appear. */
- XMapWindow(xdev->dpy, xdev->win);
-
- /* Before anything else, do a flush and wait for */
- /* an exposure event. */
- XSync(xdev->dpy, False);
- if (xdev->pwin == (Window) None) { /* there isn't a next event for existing windows */
- XNextEvent(xdev->dpy, &event);
- }
- /* Now turn off graphics exposure events so they don't queue up */
- /* indefinitely. Also, since we can't do anything about real */
- /* Expose events, mask them out. */
- XSetGraphicsExposures(xdev->dpy, xdev->gc, False);
- XSelectInput(xdev->dpy, xdev->win, NoEventMask);
+ XMapWindow(xdev->dpy, xdev->win);
+
+ /* Before anything else, do a flush and wait for */
+ /* an exposure event. */
+ XSync(xdev->dpy, False);
+ if (xdev->pwin == (Window) None) { /* there isn't a next event for existing windows */
+ XNextEvent(xdev->dpy, &event);
+ }
+ /* Now turn off graphics exposure events so they don't queue up */
+ /* indefinitely. Also, since we can't do anything about real */
+ /* Expose events, mask them out. */
+ XSetGraphicsExposures(xdev->dpy, xdev->gc, False);
+ XSelectInput(xdev->dpy, xdev->win, NoEventMask);
} else {
- /* Create an unmapped window, that the window manager will ignore.
- * This invisible window will be used to receive "next page"
- * events from ghostview */
- XSetWindowAttributes attributes;
-
- attributes.override_redirect = True;
- xdev->mwin = XCreateWindow(xdev->dpy, RootWindowOfScreen(xdev->scr),
- 0, 0, 1, 1, 0, CopyFromParent,
- CopyFromParent, CopyFromParent,
- CWOverrideRedirect, &attributes);
- xdev->NEXT = XInternAtom(xdev->dpy, "NEXT", False);
- xdev->PAGE = XInternAtom(xdev->dpy, "PAGE", False);
- xdev->DONE = XInternAtom(xdev->dpy, "DONE", False);
+ /* Create an unmapped window, that the window manager will ignore.
+ * This invisible window will be used to receive "next page"
+ * events from ghostview */
+ XSetWindowAttributes attributes;
+
+ attributes.override_redirect = True;
+ xdev->mwin = XCreateWindow(xdev->dpy, RootWindowOfScreen(xdev->scr),
+ 0, 0, 1, 1, 0, CopyFromParent,
+ CopyFromParent, CopyFromParent,
+ CWOverrideRedirect, &attributes);
+ xdev->NEXT = XInternAtom(xdev->dpy, "NEXT", False);
+ xdev->PAGE = XInternAtom(xdev->dpy, "PAGE", False);
+ xdev->DONE = XInternAtom(xdev->dpy, "DONE", False);
}
xdev->ht.no_pixmap = XCreatePixmap(xdev->dpy, xdev->win, 1, 1,
- xdev->vinfo->depth);
+ xdev->vinfo->depth);
return 0;
}
@@ -516,11 +516,11 @@ x_get_work_area(gx_device_X *xdev, int *pwidth, int *pheight)
/* Try to get NET_WORKAREA then WIN_WORKAREA */
if ((area = x_get_win_property(xdev, "_NET_WORKAREA")) != NULL ||
- (area = x_get_win_property(xdev, "_WIN_WORKAREA")) != NULL) {
- /* Update maximum screen size with usable screen size */
- *pwidth = area[2];
- *pheight = area[3];
- XFree(area);
+ (area = x_get_win_property(xdev, "_WIN_WORKAREA")) != NULL) {
+ /* Update maximum screen size with usable screen size */
+ *pwidth = area[2];
+ *pheight = area[3];
+ XFree(area);
}
}
@@ -535,7 +535,7 @@ x_get_win_property(gx_device_X *xdev, const char *atom_name)
unsigned char *prop;
if (XGetWindowProperty(xdev->dpy, RootWindowOfScreen(xdev->scr),
- XInternAtom(xdev->dpy, atom_name, False),
+ XInternAtom(xdev->dpy, atom_name, False),
0, 4, False, XA_CARDINAL,
&r_type, &r_format,
&count, &bytes_remain, &prop) == Success &&
@@ -564,109 +564,109 @@ x_set_buffer(gx_device_X * xdev)
setup:
if (buffered) {
- /* We want to buffer. */
- /* Check that we can set up a memory device. */
- gx_device_memory *mdev = (gx_device_memory *)xdev->target;
-
- if (mdev == 0 || mdev->color_info.depth != xdev->color_info.depth) {
- const gx_device_memory *mdproto =
- gdev_mem_device_for_bits(xdev->color_info.depth);
-
- if (!mdproto) {
- buffered = false;
- goto setup;
- }
- if (mdev) {
- /* Update the pointer we're about to overwrite. */
- gx_device_set_target((gx_device_forward *)mdev, NULL);
- } else {
- mdev = gs_alloc_struct(mem, gx_device_memory,
- &st_device_memory, "memory device");
- if (mdev == 0) {
- buffered = false;
- goto setup;
- }
- }
- /*
- * We want to forward image drawing to the memory device.
- * That requires making the memory device forward its color
- * mapping operations back to the X device, creating a circular
- * pointer structure. This is not a disaster, we just need to
- * be aware that this is going on.
- */
- gs_make_mem_device(mdev, mdproto, mem, 0, (gx_device *)xdev);
- gx_device_set_target((gx_device_forward *)xdev, (gx_device *)mdev);
- xdev->is_buffered = true;
- }
- if (mdev->width != xdev->width || mdev->height != xdev->height) {
- byte *buffer;
- ulong space;
-
- if (gdev_mem_data_size(mdev, xdev->width, xdev->height, &space) < 0 ||
- space > xdev->MaxBitmap) {
- buffered = false;
- goto setup;
- }
- buffer =
- (xdev->buffer ?
- (byte *)gs_resize_object(mem, xdev->buffer, space, "buffer") :
- gs_alloc_bytes(mem, space, "buffer"));
- if (!buffer) {
- buffered = false;
- goto setup;
- }
- xdev->buffer_size = space;
- xdev->buffer = buffer;
- mdev->width = xdev->width;
- mdev->height = xdev->height;
- mdev->device_icc_profile = xdev->device_icc_profile;
- rc_increment(xdev->device_icc_profile);
- mdev->color_info = xdev->color_info;
- mdev->base = xdev->buffer;
- gdev_mem_open_scan_lines(mdev, xdev->height);
- }
- xdev->white = gx_device_white((gx_device *)xdev);
- xdev->black = gx_device_black((gx_device *)xdev);
- procs = &gs_bbox_device.procs;
+ /* We want to buffer. */
+ /* Check that we can set up a memory device. */
+ gx_device_memory *mdev = (gx_device_memory *)xdev->target;
+
+ if (mdev == 0 || mdev->color_info.depth != xdev->color_info.depth) {
+ const gx_device_memory *mdproto =
+ gdev_mem_device_for_bits(xdev->color_info.depth);
+
+ if (!mdproto) {
+ buffered = false;
+ goto setup;
+ }
+ if (mdev) {
+ /* Update the pointer we're about to overwrite. */
+ gx_device_set_target((gx_device_forward *)mdev, NULL);
+ } else {
+ mdev = gs_alloc_struct(mem, gx_device_memory,
+ &st_device_memory, "memory device");
+ if (mdev == 0) {
+ buffered = false;
+ goto setup;
+ }
+ }
+ /*
+ * We want to forward image drawing to the memory device.
+ * That requires making the memory device forward its color
+ * mapping operations back to the X device, creating a circular
+ * pointer structure. This is not a disaster, we just need to
+ * be aware that this is going on.
+ */
+ gs_make_mem_device(mdev, mdproto, mem, 0, (gx_device *)xdev);
+ gx_device_set_target((gx_device_forward *)xdev, (gx_device *)mdev);
+ xdev->is_buffered = true;
+ }
+ if (mdev->width != xdev->width || mdev->height != xdev->height) {
+ byte *buffer;
+ ulong space;
+
+ if (gdev_mem_data_size(mdev, xdev->width, xdev->height, &space) < 0 ||
+ space > xdev->MaxBitmap) {
+ buffered = false;
+ goto setup;
+ }
+ buffer =
+ (xdev->buffer ?
+ (byte *)gs_resize_object(mem, xdev->buffer, space, "buffer") :
+ gs_alloc_bytes(mem, space, "buffer"));
+ if (!buffer) {
+ buffered = false;
+ goto setup;
+ }
+ xdev->buffer_size = space;
+ xdev->buffer = buffer;
+ mdev->width = xdev->width;
+ mdev->height = xdev->height;
+ mdev->device_icc_profile = xdev->device_icc_profile;
+ rc_increment(xdev->device_icc_profile);
+ mdev->color_info = xdev->color_info;
+ mdev->base = xdev->buffer;
+ gdev_mem_open_scan_lines(mdev, xdev->height);
+ }
+ xdev->white = gx_device_white((gx_device *)xdev);
+ xdev->black = gx_device_black((gx_device *)xdev);
+ procs = &gs_bbox_device.procs;
} else {
- /* Not buffering. Release the buffer and memory device. */
- gs_free_object(mem, xdev->buffer, "buffer");
- xdev->buffer = 0;
- xdev->buffer_size = 0;
- if (!xdev->is_buffered)
- return 0;
- gx_device_set_target((gx_device_forward *)xdev->target, NULL);
- gx_device_set_target((gx_device_forward *)xdev, NULL);
- xdev->is_buffered = false;
- procs = &gs_x11_device.procs;
+ /* Not buffering. Release the buffer and memory device. */
+ gs_free_object(mem, xdev->buffer, "buffer");
+ xdev->buffer = 0;
+ xdev->buffer_size = 0;
+ if (!xdev->is_buffered)
+ return 0;
+ gx_device_set_target((gx_device_forward *)xdev->target, NULL);
+ gx_device_set_target((gx_device_forward *)xdev, NULL);
+ xdev->is_buffered = false;
+ procs = &gs_x11_device.procs;
}
if (dev_proc(xdev, fill_rectangle) != procs->fill_rectangle) {
#define COPY_PROC(p) set_dev_proc(xdev, p, procs->p)
- COPY_PROC(fill_rectangle);
- COPY_PROC(copy_mono);
- COPY_PROC(copy_color);
- COPY_PROC(copy_alpha);
- COPY_PROC(fill_path);
- COPY_PROC(stroke_path);
- COPY_PROC(fill_mask);
- COPY_PROC(fill_trapezoid);
- COPY_PROC(fill_parallelogram);
- COPY_PROC(fill_triangle);
- COPY_PROC(draw_thin_line);
- COPY_PROC(strip_tile_rectangle);
- COPY_PROC(strip_copy_rop);
- COPY_PROC(begin_typed_image);
- COPY_PROC(text_begin);
+ COPY_PROC(fill_rectangle);
+ COPY_PROC(copy_mono);
+ COPY_PROC(copy_color);
+ COPY_PROC(copy_alpha);
+ COPY_PROC(fill_path);
+ COPY_PROC(stroke_path);
+ COPY_PROC(fill_mask);
+ COPY_PROC(fill_trapezoid);
+ COPY_PROC(fill_parallelogram);
+ COPY_PROC(fill_triangle);
+ COPY_PROC(draw_thin_line);
+ COPY_PROC(strip_tile_rectangle);
+ COPY_PROC(strip_copy_rop);
+ COPY_PROC(begin_typed_image);
+ COPY_PROC(text_begin);
#undef COPY_PROC
- if (xdev->is_buffered) {
- check_device_separable((gx_device *)xdev);
- gx_device_forward_fill_in_procs((gx_device_forward *)xdev);
- xdev->box_procs = gdev_x_box_procs;
- xdev->box_proc_data = xdev;
- } else {
- check_device_separable((gx_device *)xdev);
- gx_device_fill_in_procs((gx_device *)xdev);
- }
+ if (xdev->is_buffered) {
+ check_device_separable((gx_device *)xdev);
+ gx_device_forward_fill_in_procs((gx_device_forward *)xdev);
+ xdev->box_procs = gdev_x_box_procs;
+ xdev->box_proc_data = xdev;
+ } else {
+ check_device_separable((gx_device *)xdev);
+ gx_device_fill_in_procs((gx_device *)xdev);
+ }
}
return 0;
}
@@ -676,56 +676,56 @@ void
gdev_x_clear_window(gx_device_X * xdev)
{
if (!xdev->ghostview) {
- if (xdev->useBackingPixmap) {
- if (xdev->bpixmap == 0) {
- x_error_handler.oldhandler = XSetErrorHandler(x_catch_alloc);
- x_error_handler.alloc_error = False;
- xdev->bpixmap =
- XCreatePixmap(xdev->dpy, xdev->win,
- xdev->width, xdev->height,
- xdev->vinfo->depth);
- XSync(xdev->dpy, False); /* Force the error */
- if (x_error_handler.alloc_error) {
- xdev->useBackingPixmap = False;
+ if (xdev->useBackingPixmap) {
+ if (xdev->bpixmap == 0) {
+ x_error_handler.oldhandler = XSetErrorHandler(x_catch_alloc);
+ x_error_handler.alloc_error = False;
+ xdev->bpixmap =
+ XCreatePixmap(xdev->dpy, xdev->win,
+ xdev->width, xdev->height,
+ xdev->vinfo->depth);
+ XSync(xdev->dpy, False); /* Force the error */
+ if (x_error_handler.alloc_error) {
+ xdev->useBackingPixmap = False;
#ifdef DEBUG
- emprintf(xdev->memory,
+ emprintf(xdev->memory,
"Warning: Failed to allocated backing pixmap.\n");
#endif
- if (xdev->bpixmap) {
- XFreePixmap(xdev->dpy, xdev->bpixmap);
- xdev->bpixmap = None;
- XSync(xdev->dpy, False); /* Force the error */
- }
- }
- x_error_handler.oldhandler =
- XSetErrorHandler(x_error_handler.oldhandler);
- }
- } else {
- if (xdev->bpixmap != 0) {
- XFreePixmap(xdev->dpy, xdev->bpixmap);
- xdev->bpixmap = (Pixmap) 0;
- }
- }
+ if (xdev->bpixmap) {
+ XFreePixmap(xdev->dpy, xdev->bpixmap);
+ xdev->bpixmap = None;
+ XSync(xdev->dpy, False); /* Force the error */
+ }
+ }
+ x_error_handler.oldhandler =
+ XSetErrorHandler(x_error_handler.oldhandler);
+ }
+ } else {
+ if (xdev->bpixmap != 0) {
+ XFreePixmap(xdev->dpy, xdev->bpixmap);
+ xdev->bpixmap = (Pixmap) 0;
+ }
+ }
}
x_set_buffer(xdev);
/* Clear the destination pixmap to avoid initializing with garbage. */
if (xdev->dest == (Pixmap) 0) {
- xdev->dest = (xdev->bpixmap != (Pixmap) 0 ?
- xdev->bpixmap : (Pixmap) xdev->win);
+ xdev->dest = (xdev->bpixmap != (Pixmap) 0 ?
+ xdev->bpixmap : (Pixmap) xdev->win);
}
if (xdev->dest != (Pixmap) 0) {
- XSetForeground(xdev->dpy, xdev->gc, xdev->background);
- XFillRectangle(xdev->dpy, xdev->dest, xdev->gc,
- 0, 0, xdev->width, xdev->height);
+ XSetForeground(xdev->dpy, xdev->gc, xdev->background);
+ XFillRectangle(xdev->dpy, xdev->dest, xdev->gc,
+ 0, 0, xdev->width, xdev->height);
}
/* Clear the background pixmap to avoid initializing with garbage. */
if (xdev->bpixmap != (Pixmap) 0) {
- if (!xdev->ghostview)
- XSetWindowBackgroundPixmap(xdev->dpy, xdev->win, xdev->bpixmap);
- XSetForeground(xdev->dpy, xdev->gc, xdev->background);
- XFillRectangle(xdev->dpy, xdev->bpixmap, xdev->gc,
- 0, 0, xdev->width, xdev->height);
+ if (!xdev->ghostview)
+ XSetWindowBackgroundPixmap(xdev->dpy, xdev->win, xdev->bpixmap);
+ XSetForeground(xdev->dpy, xdev->gc, xdev->background);
+ XFillRectangle(xdev->dpy, xdev->bpixmap, xdev->gc,
+ 0, 0, xdev->width, xdev->height);
}
/* Initialize foreground and background colors */
xdev->back_color = xdev->background;
@@ -746,18 +746,18 @@ get_ps_name(const char **cpp, int *len)
*len = 0;
/* skip over whitespace and newlines */
while (**cpp == ' ' || **cpp == '\t' || **cpp == '\n') {
- (*cpp)++;
+ (*cpp)++;
}
/* return font name up to ":", whitespace, or end of string */
if (**cpp == ':' || **cpp == '\0') {
- return NULL;
+ return NULL;
}
ret = *cpp;
while (**cpp != ':' &&
- **cpp != ' ' && **cpp != '\t' && **cpp != '\n' &&
- **cpp != '\0') {
- (*cpp)++;
- (*len)++;
+ **cpp != ' ' && **cpp != '\t' && **cpp != '\n' &&
+ **cpp != '\0') {
+ (*cpp)++;
+ (*len)++;
}
return ret;
}
@@ -772,26 +772,26 @@ get_x11_name(const char **cpp, int *len)
*len = 0;
/* skip over whitespace and the colon */
while (**cpp == ' ' || **cpp == '\t' ||
- **cpp == ':') {
- (*cpp)++;
+ **cpp == ':') {
+ (*cpp)++;
}
/* return font name up to end of line or string */
if (**cpp == '\0' || **cpp == '\n') {
- return NULL;
+ return NULL;
}
ret = *cpp;
while (dashes != 7 &&
- **cpp != '\0' && **cpp != '\n') {
- if (**cpp == '-')
- dashes++;
- (*cpp)++;
- (*len)++;
+ **cpp != '\0' && **cpp != '\n') {
+ if (**cpp == '-')
+ dashes++;
+ (*cpp)++;
+ (*len)++;
}
while (**cpp != '\0' && **cpp != '\n') {
- (*cpp)++;
+ (*cpp)++;
}
if (dashes != 7)
- return NULL;
+ return NULL;
return ret;
}
@@ -807,39 +807,39 @@ scan_font_resource(const char *resource, x11fontmap **pmaps, gs_memory_t *mem)
const char *cp = resource;
while ((ps_name = get_ps_name(&cp, &ps_name_len)) != 0) {
- x11_name = get_x11_name(&cp, &x11_name_len);
- if (x11_name) {
- font = gs_alloc_struct(mem, x11fontmap, &st_x11fontmap,
- "scan_font_resource(font)");
- if (font == NULL)
- continue;
- font->ps_name = (char *)
- gs_alloc_byte_array(mem, ps_name_len + 1, sizeof(char),
- "scan_font_resource(ps_name)");
- if (font->ps_name == NULL) {
- gs_free_object(mem, font, "scan_font_resource(font)");
- continue;
- }
- strncpy(font->ps_name, ps_name, ps_name_len);
- font->ps_name[ps_name_len] = '\0';
- font->x11_name = (char *)
- gs_alloc_byte_array(mem, x11_name_len, sizeof(char),
- "scan_font_resource(x11_name)");
- if (font->x11_name == NULL) {
- gs_free_object(mem, font->ps_name,
- "scan_font_resource(ps_name)");
- gs_free_object(mem, font, "scan_font_resource(font)");
- continue;
- }
- strncpy(font->x11_name, x11_name, x11_name_len - 1);
- font->x11_name[x11_name_len - 1] = '\0';
- font->std.names = NULL;
- font->std.count = -1;
- font->iso.names = NULL;
- font->iso.count = -1;
- font->next = *pmaps;
- *pmaps = font;
- }
+ x11_name = get_x11_name(&cp, &x11_name_len);
+ if (x11_name) {
+ font = gs_alloc_struct(mem, x11fontmap, &st_x11fontmap,
+ "scan_font_resource(font)");
+ if (font == NULL)
+ continue;
+ font->ps_name = (char *)
+ gs_alloc_byte_array(mem, ps_name_len + 1, sizeof(char),
+ "scan_font_resource(ps_name)");
+ if (font->ps_name == NULL) {
+ gs_free_object(mem, font, "scan_font_resource(font)");
+ continue;
+ }
+ strncpy(font->ps_name, ps_name, ps_name_len);
+ font->ps_name[ps_name_len] = '\0';
+ font->x11_name = (char *)
+ gs_alloc_byte_array(mem, x11_name_len, sizeof(char),
+ "scan_font_resource(x11_name)");
+ if (font->x11_name == NULL) {
+ gs_free_object(mem, font->ps_name,
+ "scan_font_resource(ps_name)");
+ gs_free_object(mem, font, "scan_font_resource(font)");
+ continue;
+ }
+ strncpy(font->x11_name, x11_name, x11_name_len - 1);
+ font->x11_name[x11_name_len - 1] = '\0';
+ font->std.names = NULL;
+ font->std.count = -1;
+ font->iso.names = NULL;
+ font->iso.count = -1;
+ font->next = *pmaps;
+ *pmaps = font;
+ }
}
}
@@ -848,7 +848,7 @@ static void
gdev_x_setup_fontmap(gx_device_X * xdev)
{
if (!xdev->useXFonts)
- return; /* If no external fonts, don't bother */
+ return; /* If no external fonts, don't bother */
scan_font_resource(xdev->regularFonts, &xdev->regular_fonts, xdev->memory);
scan_font_resource(xdev->symbolFonts, &xdev->symbol_fonts, xdev->memory);
@@ -887,7 +887,7 @@ gdev_x_finish_copydevice(gx_device *dev, const gx_device *from_dev)
xdev->is_buffered = false;
/* See x_set_buffer for why we do this: */
set_dev_proc(xdev, fill_rectangle,
- dev_proc(&gs_x11_device, fill_rectangle));
+ dev_proc(&gs_x11_device, fill_rectangle));
return 0;
}
@@ -903,16 +903,16 @@ gdev_x_get_params(gx_device * dev, gs_param_list * plist)
long id = (long)xdev->pwin;
if (code < 0 ||
- (code = param_write_long(plist, "WindowID", &id)) < 0 ||
- (code = param_write_bool(plist, ".IsPageDevice", &xdev->IsPageDevice)) < 0 ||
- (code = param_write_long(plist, "MaxBitmap", &xdev->MaxBitmap)) < 0 ||
- (code = param_write_int(plist, "MaxTempPixmap", &xdev->MaxTempPixmap)) < 0 ||
- (code = param_write_int(plist, "MaxTempImage", &xdev->MaxTempImage)) < 0 ||
- (code = param_write_int(plist, "MaxBufferedTotal", &xdev->MaxBufferedTotal)) < 0 ||
- (code = param_write_int(plist, "MaxBufferedArea", &xdev->MaxBufferedArea)) < 0 ||
- (code = param_write_int(plist, "MaxBufferedCount", &xdev->MaxBufferedCount)) < 0
- )
- DO_NOTHING;
+ (code = param_write_long(plist, "WindowID", &id)) < 0 ||
+ (code = param_write_bool(plist, ".IsPageDevice", &xdev->IsPageDevice)) < 0 ||
+ (code = param_write_long(plist, "MaxBitmap", &xdev->MaxBitmap)) < 0 ||
+ (code = param_write_int(plist, "MaxTempPixmap", &xdev->MaxTempPixmap)) < 0 ||
+ (code = param_write_int(plist, "MaxTempImage", &xdev->MaxTempImage)) < 0 ||
+ (code = param_write_int(plist, "MaxBufferedTotal", &xdev->MaxBufferedTotal)) < 0 ||
+ (code = param_write_int(plist, "MaxBufferedArea", &xdev->MaxBufferedArea)) < 0 ||
+ (code = param_write_int(plist, "MaxBufferedCount", &xdev->MaxBufferedCount)) < 0
+ )
+ DO_NOTHING;
return code;
}
@@ -948,23 +948,23 @@ gdev_x_put_params(gx_device * dev, gs_param_list * plist)
ecode = param_put_int(plist, "MaxBufferedCount", &values.MaxBufferedCount, ecode);
if (ecode < 0)
- return ecode;
+ return ecode;
/* Unless we specified a new window ID, */
/* prevent gx_default_put_params from closing the device. */
if (pwin == (long)xdev->pwin)
- dev->is_open = false;
+ dev->is_open = false;
xdev->IsPageDevice = values.IsPageDevice;
code = gx_default_put_params(dev, plist);
dev->is_open = values.is_open; /* saved value */
if (code < 0) { /* Undo setting of .IsPageDevice */
- xdev->IsPageDevice = save_is_page;
- return code;
+ xdev->IsPageDevice = save_is_page;
+ return code;
}
if (pwin != (long)xdev->pwin) {
- if (xdev->is_open)
- gs_closedevice(dev);
- xdev->pwin = (Window) pwin;
+ if (xdev->is_open)
+ gs_closedevice(dev);
+ xdev->pwin = (Window) pwin;
}
/* Restore the original page size if it was set by Ghostview */
/* This gives the Ghostview user control over the /setpage entry */
@@ -981,25 +981,25 @@ gdev_x_put_params(gx_device * dev, gs_param_list * plist)
/* If the device is open, resize the window. */
/* Don't do this if Ghostview is active. */
if (xdev->is_open && !xdev->ghostview &&
- (dev->width != values.width || dev->height != values.height ||
- dev->HWResolution[0] != values.HWResolution[0] ||
- dev->HWResolution[1] != values.HWResolution[1])
- ) {
- int area_width = WidthOfScreen(xdev->scr), area_height = HeightOfScreen(xdev->scr);
- int dw, dh;
-
- /* Get work area */
- x_get_work_area(xdev, &area_width, &area_height);
-
- /* Preserve screen resolution */
- dev->x_pixels_per_inch = values.x_pixels_per_inch;
- dev->y_pixels_per_inch = values.y_pixels_per_inch;
- dev->HWResolution[0] = values.HWResolution[0];
- dev->HWResolution[1] = values.HWResolution[1];
-
- /* Recompute window size using screen resolution and available work area size*/
- /* pixels */
- dev->width = min(dev->width, area_width);
+ (dev->width != values.width || dev->height != values.height ||
+ dev->HWResolution[0] != values.HWResolution[0] ||
+ dev->HWResolution[1] != values.HWResolution[1])
+ ) {
+ int area_width = WidthOfScreen(xdev->scr), area_height = HeightOfScreen(xdev->scr);
+ int dw, dh;
+
+ /* Get work area */
+ x_get_work_area(xdev, &area_width, &area_height);
+
+ /* Preserve screen resolution */
+ dev->x_pixels_per_inch = values.x_pixels_per_inch;
+ dev->y_pixels_per_inch = values.y_pixels_per_inch;
+ dev->HWResolution[0] = values.HWResolution[0];
+ dev->HWResolution[1] = values.HWResolution[1];
+
+ /* Recompute window size using screen resolution and available work area size*/
+ /* pixels */
+ dev->width = min(dev->width, area_width);
dev->height = min(dev->height, area_height);
/* points */
dev->MediaSize[0] = (float)dev->width / xdev->x_pixels_per_inch * 72;
@@ -1007,31 +1007,31 @@ gdev_x_put_params(gx_device * dev, gs_param_list * plist)
dw = dev->width - values.width;
dh = dev->height - values.height;
- if (dw || dh) {
- XResizeWindow(xdev->dpy, xdev->win,
- dev->width, dev->height);
- if (xdev->bpixmap != (Pixmap) 0) {
- XFreePixmap(xdev->dpy, xdev->bpixmap);
- xdev->bpixmap = (Pixmap) 0;
- }
- xdev->dest = 0;
- clear_window = true;
- }
- /* Attempt to update the initial matrix in a sensible way. */
- /* The whole handling of the initial matrix is a hack! */
- if (xdev->initial_matrix.xy == 0) {
- if (xdev->initial_matrix.xx < 0) { /* 180 degree rotation */
- xdev->initial_matrix.tx += dw;
- } else { /* no rotation */
- xdev->initial_matrix.ty += dh;
- }
- } else {
- if (xdev->initial_matrix.xy < 0) { /* 90 degree rotation */
- xdev->initial_matrix.tx += dh;
- xdev->initial_matrix.ty += dw;
- } else { /* 270 degree rotation */
- }
- }
+ if (dw || dh) {
+ XResizeWindow(xdev->dpy, xdev->win,
+ dev->width, dev->height);
+ if (xdev->bpixmap != (Pixmap) 0) {
+ XFreePixmap(xdev->dpy, xdev->bpixmap);
+ xdev->bpixmap = (Pixmap) 0;
+ }
+ xdev->dest = 0;
+ clear_window = true;
+ }
+ /* Attempt to update the initial matrix in a sensible way. */
+ /* The whole handling of the initial matrix is a hack! */
+ if (xdev->initial_matrix.xy == 0) {
+ if (xdev->initial_matrix.xx < 0) { /* 180 degree rotation */
+ xdev->initial_matrix.tx += dw;
+ } else { /* no rotation */
+ xdev->initial_matrix.ty += dh;
+ }
+ } else {
+ if (xdev->initial_matrix.xy < 0) { /* 90 degree rotation */
+ xdev->initial_matrix.tx += dh;
+ xdev->initial_matrix.ty += dw;
+ } else { /* 270 degree rotation */
+ }
+ }
}
xdev->MaxTempPixmap = values.MaxTempPixmap;
xdev->MaxTempImage = values.MaxTempImage;
@@ -1039,10 +1039,10 @@ gdev_x_put_params(gx_device * dev, gs_param_list * plist)
xdev->MaxBufferedArea = values.MaxBufferedArea;
xdev->MaxBufferedCount = values.MaxBufferedCount;
if (clear_window || xdev->MaxBitmap != values.MaxBitmap) {
- /****** DO MORE FOR RESETTING MaxBitmap ******/
- xdev->MaxBitmap = values.MaxBitmap;
- if (xdev->is_open)
- gdev_x_clear_window(xdev);
+ /****** DO MORE FOR RESETTING MaxBitmap ******/
+ xdev->MaxBitmap = values.MaxBitmap;
+ if (xdev->is_open)
+ gdev_x_clear_window(xdev);
}
return 0;
}
@@ -1054,16 +1054,16 @@ static void
free_x_fontmaps(x11fontmap **pmaps, gs_memory_t *mem)
{
while (*pmaps) {
- x11fontmap *font = *pmaps;
-
- *pmaps = font->next;
- if (font->std.names)
- XFreeFontNames(font->std.names);
- if (font->iso.names)
- XFreeFontNames(font->iso.names);
- gs_free_object(mem, font->x11_name, "free_x_fontmaps(x11_name)");
- gs_free_object(mem, font->ps_name, "free_x_fontmaps(ps_name)");
- gs_free_object(mem, font, "free_x_fontmaps(font)");
+ x11fontmap *font = *pmaps;
+
+ *pmaps = font->next;
+ if (font->std.names)
+ XFreeFontNames(font->std.names);
+ if (font->iso.names)
+ XFreeFontNames(font->iso.names);
+ gs_free_object(mem, font->x11_name, "free_x_fontmaps(x11_name)");
+ gs_free_object(mem, font->ps_name, "free_x_fontmaps(ps_name)");
+ gs_free_object(mem, font, "free_x_fontmaps(font)");
}
}
@@ -1072,17 +1072,17 @@ int
gdev_x_close(gx_device_X *xdev)
{
if (xdev->ghostview)
- gdev_x_send_event(xdev, xdev->DONE);
+ gdev_x_send_event(xdev, xdev->DONE);
if (xdev->vinfo) {
- XFree((char *)xdev->vinfo);
- xdev->vinfo = NULL;
+ XFree((char *)xdev->vinfo);
+ xdev->vinfo = NULL;
}
gdev_x_free_colors(xdev);
free_x_fontmaps(&xdev->dingbat_fonts, xdev->memory);
free_x_fontmaps(&xdev->symbol_fonts, xdev->memory);
free_x_fontmaps(&xdev->regular_fonts, xdev->memory);
if (xdev->cmap != DefaultColormapOfScreen(xdev->scr))
- XFreeColormap(xdev->dpy, xdev->cmap);
+ XFreeColormap(xdev->dpy, xdev->cmap);
XCloseDisplay(xdev->dpy);
return 0;
}
diff --git a/gs/base/gdevxres.c b/gs/base/gdevxres.c
index 0d2ea20b2..3d4a5ed0c 100644
--- a/gs/base/gdevxres.c
+++ b/gs/base/gdevxres.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,7 +53,7 @@ XtResource gdev_x_resources[] = {
rpix(XtNborderColor, XtCBorderColor, borderColor, "XtDefaultForeground"),
rdim(XtNborderWidth, XtCBorderWidth, borderWidth, 1),
rstr("dingbatFonts", "DingbatFonts", dingbatFonts,
- "ZapfDingbats: -Adobe-ITC Zapf Dingbats-Medium-R-Normal--"),
+ "ZapfDingbats: -Adobe-ITC Zapf Dingbats-Medium-R-Normal--"),
rpix(XtNforeground, XtCForeground, foreground, "XtDefaultForeground"),
rstr(XtNgeometry, XtCGeometry, geometry, NULL),
rbool("logExternalFonts", "LogExternalFonts", logXFonts, False),
@@ -105,7 +105,7 @@ Utopia-Regular:-Adobe-Utopia-Regular-R-Normal--\n\
ZapfChancery-MediumItalic:-Adobe-ITC Zapf Chancery-Medium-I-Normal--"),
rstr("symbolFonts", "SymbolFonts", symbolFonts,
- "Symbol: -Adobe-Symbol-Medium-R-Normal--"),
+ "Symbol: -Adobe-Symbol-Medium-R-Normal--"),
rbool("useBackingPixmap", "UseBackingPixmap", useBackingPixmap, True),
rbool("useExternalFonts", "UseExternalFonts", useXFonts, True),
diff --git a/gs/base/gdevxxf.c b/gs/base/gdevxxf.c
index 320b1b693..01d1d41f6 100644
--- a/gs/base/gdevxxf.c
+++ b/gs/base/gdevxxf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -107,7 +107,7 @@ struct x_xfont_s {
};
gs_private_st_dev_ptrs1(st_x_xfont, x_xfont, "x_xfont",
- x_xfont_enum_ptrs, x_xfont_reloc_ptrs, xdev);
+ x_xfont_enum_ptrs, x_xfont_reloc_ptrs, xdev);
/* ---------------- Utilities ---------------- */
@@ -118,10 +118,10 @@ find_fontmap(x11fontmap *fmps, const byte *fname, uint len)
x11fontmap *fmp = fmps;
while (fmp) {
- if (len == strlen(fmp->ps_name) &&
- strncmp(fmp->ps_name, (const char *)fname, len) == 0)
- break;
- fmp = fmp->next;
+ if (len == strlen(fmp->ps_name) &&
+ strncmp(fmp->ps_name, (const char *)fname, len) == 0)
+ break;
+ fmp = fmp->next;
}
return fmp;
}
@@ -129,36 +129,36 @@ find_fontmap(x11fontmap *fmps, const byte *fname, uint len)
/* Find an X font with a given name, encoding, and size. */
static char *
find_x_font(gx_device_X *xdev, char x11template[256], x11fontmap *fmp,
- const char *encoding_name, x11fontlist *fls, int xheight,
- bool *scalable_font)
+ const char *encoding_name, x11fontlist *fls, int xheight,
+ bool *scalable_font)
{
int i;
char *x11fontname = 0;
int len1 = strlen(fmp->x11_name) + 1;
if (fls->count == -1) {
- sprintf(x11template, "%s-*-*-*-*-*-*-%s", fmp->x11_name,
- encoding_name);
- fls->names = XListFonts(xdev->dpy, x11template, 32, &fls->count);
+ sprintf(x11template, "%s-*-*-*-*-*-*-%s", fmp->x11_name,
+ encoding_name);
+ fls->names = XListFonts(xdev->dpy, x11template, 32, &fls->count);
}
*scalable_font = false;
for (i = 0; i < fls->count; i++) {
- const char *szp = fls->names[i] + len1;
- int size = 0;
-
- while (*szp >= '0' && *szp <= '9')
- size = size * 10 + *szp++ - '0';
- if (size == 0) {
- *scalable_font = true;
- continue;
- }
- if (size == xheight)
- return fls->names[i];
+ const char *szp = fls->names[i] + len1;
+ int size = 0;
+
+ while (*szp >= '0' && *szp <= '9')
+ size = size * 10 + *szp++ - '0';
+ if (size == 0) {
+ *scalable_font = true;
+ continue;
+ }
+ if (size == xheight)
+ return fls->names[i];
}
if (*scalable_font && xdev->useScalableFonts) {
- sprintf(x11template, "%s-%d-0-0-0-*-0-%s", fmp->x11_name,
- xheight, encoding_name);
- x11fontname = x11template;
+ sprintf(x11template, "%s-%d-0-0-0-*-0-%s", fmp->x11_name,
+ xheight, encoding_name);
+ x11fontname = x11template;
}
return x11fontname;
}
@@ -168,8 +168,8 @@ find_x_font(gx_device_X *xdev, char x11template[256], x11fontmap *fmp,
/* Look up a font. */
static gx_xfont *
x_lookup_font(gx_device * dev, const byte * fname, uint len,
- int encoding_index, const gs_uid * puid, const gs_matrix * pmat,
- gs_memory_t * mem)
+ int encoding_index, const gs_uid * puid, const gs_matrix * pmat,
+ gs_memory_t * mem)
{
gx_device_X *xdev = (gx_device_X *) dev;
x_xfont *xxf;
@@ -183,22 +183,22 @@ x_lookup_font(gx_device * dev, const byte * fname, uint len,
bool scalable_font;
if (!xdev->useXFonts)
- return NULL;
+ return NULL;
if (pmat->xy == 0 && pmat->yx == 0) {
- xwidth = fabs(pmat->xx * 1000) + 0.5;
- xheight = fabs(pmat->yy * 1000) + 0.5;
- height = fabs(pmat->yy * 1000);
- angle = (pmat->xx > 0 ? 0 : 180);
- My = (pmat->xx > 0 && pmat->yy > 0) || (pmat->xx < 0 && pmat->yy < 0);
+ xwidth = fabs(pmat->xx * 1000) + 0.5;
+ xheight = fabs(pmat->yy * 1000) + 0.5;
+ height = fabs(pmat->yy * 1000);
+ angle = (pmat->xx > 0 ? 0 : 180);
+ My = (pmat->xx > 0 && pmat->yy > 0) || (pmat->xx < 0 && pmat->yy < 0);
} else if (pmat->xx == 0 && pmat->yy == 0) {
- xwidth = fabs(pmat->xy * 1000) + 0.5;
- xheight = fabs(pmat->yx * 1000) + 0.5;
- height = fabs(pmat->yx * 1000);
- angle = (pmat->yx < 0 ? 90 : 270);
- My = (pmat->yx > 0 && pmat->xy < 0) || (pmat->yx < 0 && pmat->xy > 0);
+ xwidth = fabs(pmat->xy * 1000) + 0.5;
+ xheight = fabs(pmat->yx * 1000) + 0.5;
+ height = fabs(pmat->yx * 1000);
+ angle = (pmat->yx < 0 ? 90 : 270);
+ My = (pmat->yx > 0 && pmat->xy < 0) || (pmat->yx < 0 && pmat->xy > 0);
} else {
- return NULL;
+ return NULL;
}
/* Don't do very small fonts, where font metrics are way off */
@@ -207,79 +207,79 @@ x_lookup_font(gx_device * dev, const byte * fname, uint len,
/* the server may lock up the entire window system while rasterizing */
/* the whole font. */
if (xwidth < min_X_font_size || xwidth > max_X_font_size ||
- xheight < min_X_font_size || xheight > max_X_font_size
- )
- return NULL;
+ xheight < min_X_font_size || xheight > max_X_font_size
+ )
+ return NULL;
if (!xdev->useFontExtensions && (My || angle != 0))
- return NULL;
+ return NULL;
switch (encoding_index) {
case 0:
- fmp = find_fontmap(xdev->regular_fonts, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
- if (!x11fontname) {
- x11fontname =
- find_x_font(xdev, x11template, fmp, "ISO8859-1",
- &fmp->iso, xheight, &scalable_font);
- encoding_index = 1;
- }
- break;
+ fmp = find_fontmap(xdev->regular_fonts, fname, len);
+ if (fmp == NULL)
+ return NULL;
+ x11fontname =
+ find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
+ &fmp->std, xheight, &scalable_font);
+ if (!x11fontname) {
+ x11fontname =
+ find_x_font(xdev, x11template, fmp, "ISO8859-1",
+ &fmp->iso, xheight, &scalable_font);
+ encoding_index = 1;
+ }
+ break;
case 1:
- fmp = find_fontmap(xdev->regular_fonts, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "ISO8859-1",
- &fmp->iso, xheight, &scalable_font);
- if (!x11fontname) {
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
- encoding_index = 0;
- }
- break;
+ fmp = find_fontmap(xdev->regular_fonts, fname, len);
+ if (fmp == NULL)
+ return NULL;
+ x11fontname =
+ find_x_font(xdev, x11template, fmp, "ISO8859-1",
+ &fmp->iso, xheight, &scalable_font);
+ if (!x11fontname) {
+ x11fontname =
+ find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
+ &fmp->std, xheight, &scalable_font);
+ encoding_index = 0;
+ }
+ break;
case 2:
- fmp = xdev->symbol_fonts;
- goto sym;
+ fmp = xdev->symbol_fonts;
+ goto sym;
case 3:
- fmp = xdev->dingbat_fonts;
+ fmp = xdev->dingbat_fonts;
sym: fmp = find_fontmap(fmp, fname, len);
- if (fmp == NULL)
- return NULL;
- x11fontname =
- find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
- &fmp->std, xheight, &scalable_font);
+ if (fmp == NULL)
+ return NULL;
+ x11fontname =
+ find_x_font(xdev, x11template, fmp, "Adobe-fontspecific",
+ &fmp->std, xheight, &scalable_font);
default:
- return NULL;
+ return NULL;
}
if (!x11fontname)
- return NULL;
+ return NULL;
if (xwidth != xheight || angle != 0 || My) {
- if (!xdev->useScalableFonts || !scalable_font)
- return NULL;
- sprintf(x11template, "%s%s+%d-%d+%d-0-0-0-*-0-%s",
- fmp->x11_name, (My ? "+My" : ""),
- angle * 64, xheight, xwidth,
- (encoding_index == 1 ? "ISO8859-1" : "Adobe-fontspecific"));
- x11fontname = x11template;
+ if (!xdev->useScalableFonts || !scalable_font)
+ return NULL;
+ sprintf(x11template, "%s%s+%d-%d+%d-0-0-0-*-0-%s",
+ fmp->x11_name, (My ? "+My" : ""),
+ angle * 64, xheight, xwidth,
+ (encoding_index == 1 ? "ISO8859-1" : "Adobe-fontspecific"));
+ x11fontname = x11template;
}
x11font = XLoadQueryFont(xdev->dpy, x11fontname);
if (x11font == NULL)
- return NULL;
+ return NULL;
/* Don't bother with 16-bit or 2 byte fonts yet */
if (x11font->min_byte1 || x11font->max_byte1) {
- XFreeFont(xdev->dpy, x11font);
- return NULL;
+ XFreeFont(xdev->dpy, x11font);
+ return NULL;
}
xxf = gs_alloc_struct(mem, x_xfont, &st_x_xfont, "x_lookup_font");
if (xxf == NULL)
- return NULL;
+ return NULL;
xxf->common.procs = &x_xfont_procs;
xxf->xdev = xdev;
xxf->font = x11font;
@@ -287,9 +287,9 @@ sym: fmp = find_fontmap(fmp, fname, len);
xxf->My = (My ? -1 : 1);
xxf->angle = angle;
if (xdev->logXFonts) {
- dprintf3("Using %s\n for %s at %g pixels.\n", x11fontname,
- fmp->ps_name, height);
- dflush();
+ dprintf3("Using %s\n for %s at %g pixels.\n", x11fontname,
+ fmp->ps_name, height);
+ dflush();
}
return (gx_xfont *) xxf;
}
@@ -297,32 +297,32 @@ sym: fmp = find_fontmap(fmp, fname, len);
/* Convert a character name or index to an xglyph code. */
static gx_xglyph
x_char_xglyph(gx_xfont * xf, gs_char chr, int encoding_index,
- gs_glyph glyph, const gs_const_string *glyph_name)
+ gs_glyph glyph, const gs_const_string *glyph_name)
{
const x_xfont *xxf = (x_xfont *) xf;
if (chr == gs_no_char)
- return gx_no_xglyph; /* can't look up names yet */
+ return gx_no_xglyph; /* can't look up names yet */
if (encoding_index != xxf->encoding_index) {
- if (encoding_index == 0 && xxf->encoding_index == 1)
- chr = gs_map_std_to_iso[chr];
- else if (encoding_index == 1 && xxf->encoding_index == 0)
- chr = gs_map_iso_to_std[chr];
- else
- return gx_no_xglyph;
- if (chr == 0)
- return gx_no_xglyph;
+ if (encoding_index == 0 && xxf->encoding_index == 1)
+ chr = gs_map_std_to_iso[chr];
+ else if (encoding_index == 1 && xxf->encoding_index == 0)
+ chr = gs_map_iso_to_std[chr];
+ else
+ return gx_no_xglyph;
+ if (chr == 0)
+ return gx_no_xglyph;
}
if (chr < xxf->font->min_char_or_byte2 ||
- chr > xxf->font->max_char_or_byte2)
- return gx_no_xglyph;
+ chr > xxf->font->max_char_or_byte2)
+ return gx_no_xglyph;
if (xxf->font->per_char) {
- int i = chr - xxf->font->min_char_or_byte2;
- const XCharStruct *xc = &xxf->font->per_char[i];
+ int i = chr - xxf->font->min_char_or_byte2;
+ const XCharStruct *xc = &xxf->font->per_char[i];
- if ((xc->lbearing == 0) && (xc->rbearing == 0) &&
- (xc->ascent == 0) && (xc->descent == 0))
- return gx_no_xglyph;
+ if ((xc->lbearing == 0) && (xc->rbearing == 0) &&
+ (xc->ascent == 0) && (xc->descent == 0))
+ return gx_no_xglyph;
}
return (gx_xglyph) chr;
}
@@ -330,38 +330,38 @@ x_char_xglyph(gx_xfont * xf, gs_char chr, int encoding_index,
/* Get the metrics for a character. */
static int
x_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
- gs_point * pwidth, gs_int_rect * pbbox)
+ gs_point * pwidth, gs_int_rect * pbbox)
{
const x_xfont *xxf = (const x_xfont *) xf;
int width;
if (wmode != 0)
- return gs_error_undefined;
+ return gs_error_undefined;
if (xxf->font->per_char == NULL) {
- width = xxf->font->max_bounds.width;
- pbbox->p.x = xxf->font->max_bounds.lbearing;
- pbbox->q.x = xxf->font->max_bounds.rbearing;
- pbbox->p.y = -xxf->font->max_bounds.ascent;
- pbbox->q.y = xxf->font->max_bounds.descent;
+ width = xxf->font->max_bounds.width;
+ pbbox->p.x = xxf->font->max_bounds.lbearing;
+ pbbox->q.x = xxf->font->max_bounds.rbearing;
+ pbbox->p.y = -xxf->font->max_bounds.ascent;
+ pbbox->q.y = xxf->font->max_bounds.descent;
} else {
- int i = xg - xxf->font->min_char_or_byte2;
- const XCharStruct *xc = &xxf->font->per_char[i];
-
- width = xc->width;
- pbbox->p.x = xc->lbearing;
- pbbox->q.x = xc->rbearing;
- pbbox->p.y = -xc->ascent;
- pbbox->q.y = xc->descent;
+ int i = xg - xxf->font->min_char_or_byte2;
+ const XCharStruct *xc = &xxf->font->per_char[i];
+
+ width = xc->width;
+ pbbox->p.x = xc->lbearing;
+ pbbox->q.x = xc->rbearing;
+ pbbox->p.y = -xc->ascent;
+ pbbox->q.y = xc->descent;
}
switch (xxf->angle) {
case 0:
- pwidth->x = width, pwidth->y = 0; break;
+ pwidth->x = width, pwidth->y = 0; break;
case 90:
- pwidth->x = 0, pwidth->y = -xxf->My * width; break;
+ pwidth->x = 0, pwidth->y = -xxf->My * width; break;
case 180:
- pwidth->x = -width, pwidth->y = 0; break;
+ pwidth->x = -width, pwidth->y = 0; break;
case 270:
- pwidth->x = 0, pwidth->y = xxf->My * width; break;
+ pwidth->x = 0, pwidth->y = xxf->My * width; break;
}
return 0;
}
@@ -369,7 +369,7 @@ x_char_metrics(gx_xfont * xf, gx_xglyph xg, int wmode,
/* Render a character. */
static int
x_render_char(gx_xfont * xf, gx_xglyph xg, gx_device * dev,
- int xo, int yo, gx_color_index color, int required)
+ int xo, int yo, gx_color_index color, int required)
{
x_xfont *xxf = (x_xfont *) xf;
char chr = (char)xg;
@@ -379,115 +379,115 @@ x_render_char(gx_xfont * xf, gx_xglyph xg, gx_device * dev,
int code;
if (dev->dname == gs_x11_device.dname && !((gx_device_X *)dev)->is_buffered) {
- gx_device_X *xdev = (gx_device_X *)dev;
-
- code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
- if (code < 0)
- return code;
- /* Buffer text for more efficient X interaction. */
- if (xdev->text.item_count == MAX_TEXT_ITEMS ||
- xdev->text.char_count == MAX_TEXT_CHARS ||
- (IN_TEXT(xdev) &&
- (yo != xdev->text.origin.y || color != xdev->fore_color ||
- xxf->font->fid != xdev->fid))
- ) {
- DRAW_TEXT(xdev);
- xdev->text.item_count = xdev->text.char_count = 0;
- }
- if (xdev->text.item_count == 0) {
- X_SET_FILL_STYLE(xdev, FillSolid);
- X_SET_FORE_COLOR(xdev, color);
- X_SET_FUNCTION(xdev, GXcopy);
- xdev->text.origin.x = xdev->text.x = xo;
- xdev->text.origin.y = yo;
- xdev->text.items[0].font = xdev->fid = xxf->font->fid;
- }
- /*
- * The following is wrong for rotated text, but it doesn't matter,
- * because the next call of x_render_char will have a different Y.
- */
- {
- int index = xdev->text.item_count;
- XTextItem *item = &xdev->text.items[index];
- char *pchar = &xdev->text.chars[xdev->text.char_count++];
- int delta = xo - xdev->text.x;
-
- *pchar = chr;
- if (index > 0 && delta == 0) {
- /* Continue the same item. */
- item[-1].nchars++;
- } else {
- /* Start a new item. */
- item->chars = pchar;
- item->nchars = 1;
- item->delta = delta;
- if (index > 0)
- item->font = None;
- xdev->text.item_count++;
- }
- xdev->text.x = xo + wxy.x;
- }
- if (xdev->bpixmap != (Pixmap) 0) {
- x = xo + bbox.p.x;
- y = yo + bbox.p.y;
- w = bbox.q.x - bbox.p.x;
- h = bbox.q.y - bbox.p.y;
- fit_fill(dev, x, y, w, h);
- x_update_add(xdev, x, y, w, h);
- }
- return 0;
+ gx_device_X *xdev = (gx_device_X *)dev;
+
+ code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
+ if (code < 0)
+ return code;
+ /* Buffer text for more efficient X interaction. */
+ if (xdev->text.item_count == MAX_TEXT_ITEMS ||
+ xdev->text.char_count == MAX_TEXT_CHARS ||
+ (IN_TEXT(xdev) &&
+ (yo != xdev->text.origin.y || color != xdev->fore_color ||
+ xxf->font->fid != xdev->fid))
+ ) {
+ DRAW_TEXT(xdev);
+ xdev->text.item_count = xdev->text.char_count = 0;
+ }
+ if (xdev->text.item_count == 0) {
+ X_SET_FILL_STYLE(xdev, FillSolid);
+ X_SET_FORE_COLOR(xdev, color);
+ X_SET_FUNCTION(xdev, GXcopy);
+ xdev->text.origin.x = xdev->text.x = xo;
+ xdev->text.origin.y = yo;
+ xdev->text.items[0].font = xdev->fid = xxf->font->fid;
+ }
+ /*
+ * The following is wrong for rotated text, but it doesn't matter,
+ * because the next call of x_render_char will have a different Y.
+ */
+ {
+ int index = xdev->text.item_count;
+ XTextItem *item = &xdev->text.items[index];
+ char *pchar = &xdev->text.chars[xdev->text.char_count++];
+ int delta = xo - xdev->text.x;
+
+ *pchar = chr;
+ if (index > 0 && delta == 0) {
+ /* Continue the same item. */
+ item[-1].nchars++;
+ } else {
+ /* Start a new item. */
+ item->chars = pchar;
+ item->nchars = 1;
+ item->delta = delta;
+ if (index > 0)
+ item->font = None;
+ xdev->text.item_count++;
+ }
+ xdev->text.x = xo + wxy.x;
+ }
+ if (xdev->bpixmap != (Pixmap) 0) {
+ x = xo + bbox.p.x;
+ y = yo + bbox.p.y;
+ w = bbox.q.x - bbox.p.x;
+ h = bbox.q.y - bbox.p.y;
+ fit_fill(dev, x, y, w, h);
+ x_update_add(xdev, x, y, w, h);
+ }
+ return 0;
} else if (!required)
- return -1; /* too hard */
+ return -1; /* too hard */
else {
- /* Display on an intermediate bitmap, then copy the bits. */
- gx_device_X *xdev = xxf->xdev;
- int wbm, raster;
- int i;
- XImage *xim;
- Pixmap xpm;
- GC fgc;
- byte *bits;
-
- dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
-
- code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
- if (code < 0)
- return code;
- w = bbox.q.x - bbox.p.x;
- h = bbox.q.y - bbox.p.y;
- wbm = ROUND_UP(w, align_bitmap_mod * 8);
- raster = wbm >> 3;
- bits = (byte *) gs_malloc(xdev->memory, h, raster, "x_render_char");
- if (bits == 0)
- return gs_error_limitcheck;
- xpm = XCreatePixmap(xdev->dpy, xdev->win, w, h, 1);
- fgc = XCreateGC(xdev->dpy, xpm, None, NULL);
- XSetForeground(xdev->dpy, fgc, 0);
- XFillRectangle(xdev->dpy, xpm, fgc, 0, 0, w, h);
- XSetForeground(xdev->dpy, fgc, 1);
- XSetFont(xdev->dpy, fgc, xxf->font->fid);
- XDrawString(xdev->dpy, xpm, fgc, -bbox.p.x, -bbox.p.y, &chr, 1);
- xim = XGetImage(xdev->dpy, xpm, 0, 0, w, h, 1, ZPixmap);
- i = 0;
- for (y = 0; y < h; y++) {
- char b = 0;
-
- for (x = 0; x < wbm; x++) {
- b = b << 1;
- if (x < w)
- b += XGetPixel(xim, x, y);
- if ((x & 7) == 7)
- bits[i++] = b;
- }
- }
- code = (*copy_mono) (dev, bits, 0, raster, gx_no_bitmap_id,
- xo + bbox.p.x, yo + bbox.p.y, w, h,
- gx_no_color_index, color);
- gs_free(xdev->memory, (char *)bits, h, raster, "x_render_char");
- XFreePixmap(xdev->dpy, xpm);
- XFreeGC(xdev->dpy, fgc);
- XDestroyImage(xim);
- return (code < 0 ? code : 0);
+ /* Display on an intermediate bitmap, then copy the bits. */
+ gx_device_X *xdev = xxf->xdev;
+ int wbm, raster;
+ int i;
+ XImage *xim;
+ Pixmap xpm;
+ GC fgc;
+ byte *bits;
+
+ dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
+
+ code = (*xf->common.procs->char_metrics) (xf, xg, 0, &wxy, &bbox);
+ if (code < 0)
+ return code;
+ w = bbox.q.x - bbox.p.x;
+ h = bbox.q.y - bbox.p.y;
+ wbm = ROUND_UP(w, align_bitmap_mod * 8);
+ raster = wbm >> 3;
+ bits = (byte *) gs_malloc(xdev->memory, h, raster, "x_render_char");
+ if (bits == 0)
+ return gs_error_limitcheck;
+ xpm = XCreatePixmap(xdev->dpy, xdev->win, w, h, 1);
+ fgc = XCreateGC(xdev->dpy, xpm, None, NULL);
+ XSetForeground(xdev->dpy, fgc, 0);
+ XFillRectangle(xdev->dpy, xpm, fgc, 0, 0, w, h);
+ XSetForeground(xdev->dpy, fgc, 1);
+ XSetFont(xdev->dpy, fgc, xxf->font->fid);
+ XDrawString(xdev->dpy, xpm, fgc, -bbox.p.x, -bbox.p.y, &chr, 1);
+ xim = XGetImage(xdev->dpy, xpm, 0, 0, w, h, 1, ZPixmap);
+ i = 0;
+ for (y = 0; y < h; y++) {
+ char b = 0;
+
+ for (x = 0; x < wbm; x++) {
+ b = b << 1;
+ if (x < w)
+ b += XGetPixel(xim, x, y);
+ if ((x & 7) == 7)
+ bits[i++] = b;
+ }
+ }
+ code = (*copy_mono) (dev, bits, 0, raster, gx_no_bitmap_id,
+ xo + bbox.p.x, yo + bbox.p.y, w, h,
+ gx_no_color_index, color);
+ gs_free(xdev->memory, (char *)bits, h, raster, "x_render_char");
+ XFreePixmap(xdev->dpy, xpm);
+ XFreeGC(xdev->dpy, fgc);
+ XDestroyImage(xim);
+ return (code < 0 ? code : 0);
}
}
@@ -502,6 +502,6 @@ x_release(gx_xfont * xf, gs_memory_t * mem)
XFreeFont(xxf->xdev->dpy, xxf->font);
#endif
if (mem != NULL)
- gs_free_object(mem, xf, "x_release");
+ gs_free_object(mem, xf, "x_release");
return 0;
}
diff --git a/gs/base/genarch.c b/gs/base/genarch.c
index ca9255716..e4987ad03 100644
--- a/gs/base/genarch.c
+++ b/gs/base/genarch.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,7 +21,7 @@
#include <ctype.h>
#include <stdio.h>
/*
- * In theory, not all systems provide <string.h> or declare memset
+ * In theory, not all systems provide <string.h> or declare memset
* there, but at this point we don't think we care about any that don't.
*/
#include <string.h>
@@ -62,7 +62,7 @@ print_ffs(FILE *f, int nbytes)
int i;
for (i = 0; i < nbytes; ++i)
- fprintf(f, "ff");
+ fprintf(f, "ff");
}
static int
@@ -71,7 +71,7 @@ ilog2(int n)
int i = 0, m = n;
while (m > 1)
- ++i, m = (m + 1) >> 1;
+ ++i, m = (m + 1) >> 1;
return i;
}
@@ -81,49 +81,49 @@ main(int argc, char *argv[])
char *fname = argv[1];
long one = 1;
struct {
- char c;
- short s;
+ char c;
+ short s;
} ss;
struct {
- char c;
- int i;
+ char c;
+ int i;
} si;
struct {
- char c;
- long l;
+ char c;
+ long l;
} sl;
struct {
- char c;
- char *p;
+ char c;
+ char *p;
} sp;
struct {
- char c;
- float f;
+ char c;
+ float f;
} sf;
struct {
- char c;
- double d;
+ char c;
+ double d;
} sd;
long lm1 = -1;
long lr1 = lm1 >> 1, lr2 = lm1 >> 2;
int im1 = -1;
int ir1 = im1 >> 1, ir2 = im1 >> 2;
union {
- long l;
- char *p;
+ long l;
+ char *p;
} pl0, pl1;
int ars;
union {
- float f;
- int i;
- long l;
+ float f;
+ int i;
+ long l;
} f0, f1, fm1;
int floats_are_IEEE;
FILE *f = fopen(fname, "w");
if (f == NULL) {
- fprintf(stderr, "genarch.c: can't open %s for writing\n", fname);
- return exit_FAILED;
+ fprintf(stderr, "genarch.c: can't open %s for writing\n", fname);
+ return exit_FAILED;
}
fprintf(f, "/* Parameters derived from machine and compiler architecture. */\n");
fprintf(f, "/* This file is generated mechanically by genarch.c. */\n");
@@ -132,9 +132,9 @@ main(int argc, char *argv[])
/* because the preprocessor can't evaluate sizeof. */
f0.f = 0.0, f1.f = 1.0, fm1.f = -1.0;
floats_are_IEEE =
- (size_of(float) == size_of(int) ?
- f0.i == 0 && f1.i == (int)0x3f800000 && fm1.i == (int)0xbf800000 :
- f0.l == 0 && f1.l == 0x3f800000L && fm1.l == 0xbf800000L);
+ (size_of(float) == size_of(int) ?
+ f0.i == 0 && f1.i == (int)0x3f800000 && fm1.i == (int)0xbf800000 :
+ f0.l == 0 && f1.l == 0x3f800000L && fm1.l == 0xbf800000L);
section(f, "Scalar alignments");
@@ -170,17 +170,17 @@ main(int argc, char *argv[])
define_int(f, "ARCH_SIZEOF_FLOAT", size_of(float));
define_int(f, "ARCH_SIZEOF_DOUBLE", size_of(double));
if (floats_are_IEEE) {
- define_int(f, "ARCH_FLOAT_MANTISSA_BITS", 24);
- define_int(f, "ARCH_DOUBLE_MANTISSA_BITS", 53);
+ define_int(f, "ARCH_FLOAT_MANTISSA_BITS", 24);
+ define_int(f, "ARCH_DOUBLE_MANTISSA_BITS", 53);
} else {
- /*
- * There isn't any general way to compute the number of mantissa
- * bits accurately, especially if the machine uses hex rather
- * than binary exponents. Use conservative values, assuming
- * the exponent is stored in a 16-bit word of its own.
- */
- define_int(f, "ARCH_FLOAT_MANTISSA_BITS", sizeof(float) * 8 - 17);
- define_int(f, "ARCH_DOUBLE_MANTISSA_BITS", sizeof(double) * 8 - 17);
+ /*
+ * There isn't any general way to compute the number of mantissa
+ * bits accurately, especially if the machine uses hex rather
+ * than binary exponents. Use conservative values, assuming
+ * the exponent is stored in a 16-bit word of its own.
+ */
+ define_int(f, "ARCH_FLOAT_MANTISSA_BITS", sizeof(float) * 8 - 17);
+ define_int(f, "ARCH_DOUBLE_MANTISSA_BITS", sizeof(double) * 8 - 17);
}
section(f, "Unsigned max values");
@@ -224,8 +224,8 @@ main(int argc, char *argv[])
* never correct.
*/
ars = (lr2 != -1 || ir1 != -1 || ir2 != -1 ? 0 :
- lr1 != -1 ? 1 : /* Turbo C problem */
- 2);
+ lr1 != -1 ? 1 : /* Turbo C problem */
+ 2);
define_int(f, "ARCH_ARITH_RSHIFT", ars);
/*
* Determine whether dividing a negative integer by a positive one
diff --git a/gs/base/genconf.c b/gs/base/genconf.c
index bfb62cd8b..a5cf697d0 100644
--- a/gs/base/genconf.c
+++ b/gs/base/genconf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -275,20 +275,20 @@ typedef struct config_s {
string_list_t replaces;
/* Real resources */
union ru_ {
- struct nu_ {
- /* These names must parallel config_lists below. */
- string_list_t sorted_resources;
- string_list_t resources;
- string_list_t devs; /* also includes devs2 */
- string_list_t compositors;
- string_list_t fonts;
- string_list_t libs;
- string_list_t libpaths;
- string_list_t links;
- string_list_t objs;
- } named;
+ struct nu_ {
+ /* These names must parallel config_lists below. */
+ string_list_t sorted_resources;
+ string_list_t resources;
+ string_list_t devs; /* also includes devs2 */
+ string_list_t compositors;
+ string_list_t fonts;
+ string_list_t libs;
+ string_list_t libpaths;
+ string_list_t links;
+ string_list_t objs;
+ } named;
#define NUM_RESOURCE_LISTS 9
- string_list_t indexed[NUM_RESOURCE_LISTS];
+ string_list_t indexed[NUM_RESOURCE_LISTS];
} lists;
string_pattern_t lib_p;
string_pattern_t libpath_p;
@@ -345,12 +345,12 @@ main(int argc, char *argv[])
/* Allocate string lists. */
conf = init_config;
memcpy(conf.lists.indexed, init_config_lists,
- sizeof(conf.lists.indexed));
+ sizeof(conf.lists.indexed));
alloc_list(&conf.file_names);
alloc_list(&conf.file_contents);
alloc_list(&conf.replaces);
for (i = 0; i < NUM_RESOURCE_LISTS; ++i)
- alloc_list(&conf.lists.indexed[i]);
+ alloc_list(&conf.lists.indexed[i]);
/* Initialize patterns. */
conf.lib_p.upper_case = false;
@@ -361,161 +361,161 @@ main(int argc, char *argv[])
/* Process command line arguments. */
for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
- FILE *out;
- int lib = 0, obj = 0;
-
- if (*arg != '-') {
- read_dev(&conf, arg);
- continue;
- }
- if (i == argc - 1) {
- fprintf(stderr, "Missing argument after %s.\n",
- arg);
- exit(1);
- }
- switch (arg[1]) {
- case 'C': /* change directory, by analogy with make */
- conf.file_prefix =
- (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
- ++i;
- continue;
- case 'e':
- escape = argv[i + 1][0];
- ++i;
- continue;
- case 'n':
- conf.name_prefix =
- (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
- ++i;
- continue;
- case 'p':
- {
- string_pattern_t *pat;
-
- switch (*(arg += 2)) {
- case 'l':
- pat = &conf.lib_p;
- break;
- case 'L':
- pat = &conf.libpath_p;
- break;
- default:
- pat = &conf.obj_p;
- arg--;
- }
- pat->upper_case = false;
- pat->drop_extn = false;
- if (argv[i + 1][0] == '-')
- strcpy(pat->pattern, "%s\n");
- else {
- char *p, *q;
-
- for (p = pat->pattern, q = argv[++i];
- (*p++ = *q++) != 0;
- )
- if (p[-1] == escape)
- switch (*q) {
- case 'p':
- p[-1] = '%'; q++; break;
- case 's':
- p[-1] = ' '; q++; break;
- case '-':
- p[-1] = '-'; q++; break;
- default:
- if (*q == escape) {
- p[-1] = '\\'; q++; break;
- }
- fprintf(stderr,
- "%c not followed by p|s|%c|-: &%c\n",
- escape, escape, *q);
- exit(1);
- }
- p[-1] = '\n';
- *p = 0;
- }
- for (;;) {
- switch (*++arg) {
- case 'u':
- pat->upper_case = true;
- break;
- case 'e':
- pat->drop_extn = true;
- break;
- case 0:
- goto pbreak;
- default:
- fprintf(stderr, "Unknown switch %s.\n", arg);
- exit(1);
- }
- }
- pbreak:if (pat == &conf.obj_p) {
- conf.lib_p = *pat;
- conf.libpath_p = *pat;
- }
- continue;
- }
- case 'Z':
- conf.debug = 1;
- continue;
- }
- /* Must be an output file. */
- out = fopen(argv[++i], "w");
- if (out == 0) {
- fprintf(stderr, "Can't open %s for output.\n",
- argv[i]);
- exit(1);
- }
- switch (arg[1]) {
- case 'f':
- process_replaces(&conf);
- fputs("/* This file was generated automatically by genconf.c. */\n", out);
- fputs("/* For documentation, see gsconfig.c. */\n", out);
- {
- char template[80];
-
- sprintf(template,
- "font_(\"0.font_%%s\",%sf_%%s,zf_%%s)\n",
- conf.name_prefix);
- write_list(out, &conf.lists.named.fonts, template);
- }
- break;
- case 'h':
- process_replaces(&conf);
- fputs("/* This file was generated automatically by genconf.c. */\n", out);
- write_list(out, &conf.lists.named.compositors, "%s\n");
- write_list(out, &conf.lists.named.devs, "%s\n");
- sort_uniq(&conf.lists.named.resources, true);
- write_list(out, &conf.lists.named.resources, "%s\n");
- sort_uniq(&conf.lists.named.sorted_resources, false);
- write_list(out, &conf.lists.named.sorted_resources, "%s\n");
- break;
- case 'l':
- lib = 1;
- obj = arg[2] == 'o';
- goto lo;
- case 'o':
- obj = 1;
- lib = arg[2] == 'l';
- lo:process_replaces(&conf);
- if (obj) {
- sort_uniq(&conf.lists.named.objs, true);
- write_list_pattern(out, &conf.lists.named.objs, &conf.obj_p);
- }
- if (lib) {
- sort_uniq(&conf.lists.named.libs, true);
- sort_uniq(&conf.lists.named.links, true);
- write_list_pattern(out, &conf.lists.named.libpaths, &conf.libpath_p);
- write_list_pattern(out, &conf.lists.named.links, &conf.obj_p);
- write_list_pattern(out, &conf.lists.named.libs, &conf.lib_p);
- }
- break;
- default:
- fclose(out);
- fprintf(stderr, "Unknown switch %s.\n", argv[i]);
- exit(1);
- }
- fclose(out);
+ const char *arg = argv[i];
+ FILE *out;
+ int lib = 0, obj = 0;
+
+ if (*arg != '-') {
+ read_dev(&conf, arg);
+ continue;
+ }
+ if (i == argc - 1) {
+ fprintf(stderr, "Missing argument after %s.\n",
+ arg);
+ exit(1);
+ }
+ switch (arg[1]) {
+ case 'C': /* change directory, by analogy with make */
+ conf.file_prefix =
+ (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
+ ++i;
+ continue;
+ case 'e':
+ escape = argv[i + 1][0];
+ ++i;
+ continue;
+ case 'n':
+ conf.name_prefix =
+ (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
+ ++i;
+ continue;
+ case 'p':
+ {
+ string_pattern_t *pat;
+
+ switch (*(arg += 2)) {
+ case 'l':
+ pat = &conf.lib_p;
+ break;
+ case 'L':
+ pat = &conf.libpath_p;
+ break;
+ default:
+ pat = &conf.obj_p;
+ arg--;
+ }
+ pat->upper_case = false;
+ pat->drop_extn = false;
+ if (argv[i + 1][0] == '-')
+ strcpy(pat->pattern, "%s\n");
+ else {
+ char *p, *q;
+
+ for (p = pat->pattern, q = argv[++i];
+ (*p++ = *q++) != 0;
+ )
+ if (p[-1] == escape)
+ switch (*q) {
+ case 'p':
+ p[-1] = '%'; q++; break;
+ case 's':
+ p[-1] = ' '; q++; break;
+ case '-':
+ p[-1] = '-'; q++; break;
+ default:
+ if (*q == escape) {
+ p[-1] = '\\'; q++; break;
+ }
+ fprintf(stderr,
+ "%c not followed by p|s|%c|-: &%c\n",
+ escape, escape, *q);
+ exit(1);
+ }
+ p[-1] = '\n';
+ *p = 0;
+ }
+ for (;;) {
+ switch (*++arg) {
+ case 'u':
+ pat->upper_case = true;
+ break;
+ case 'e':
+ pat->drop_extn = true;
+ break;
+ case 0:
+ goto pbreak;
+ default:
+ fprintf(stderr, "Unknown switch %s.\n", arg);
+ exit(1);
+ }
+ }
+ pbreak:if (pat == &conf.obj_p) {
+ conf.lib_p = *pat;
+ conf.libpath_p = *pat;
+ }
+ continue;
+ }
+ case 'Z':
+ conf.debug = 1;
+ continue;
+ }
+ /* Must be an output file. */
+ out = fopen(argv[++i], "w");
+ if (out == 0) {
+ fprintf(stderr, "Can't open %s for output.\n",
+ argv[i]);
+ exit(1);
+ }
+ switch (arg[1]) {
+ case 'f':
+ process_replaces(&conf);
+ fputs("/* This file was generated automatically by genconf.c. */\n", out);
+ fputs("/* For documentation, see gsconfig.c. */\n", out);
+ {
+ char template[80];
+
+ sprintf(template,
+ "font_(\"0.font_%%s\",%sf_%%s,zf_%%s)\n",
+ conf.name_prefix);
+ write_list(out, &conf.lists.named.fonts, template);
+ }
+ break;
+ case 'h':
+ process_replaces(&conf);
+ fputs("/* This file was generated automatically by genconf.c. */\n", out);
+ write_list(out, &conf.lists.named.compositors, "%s\n");
+ write_list(out, &conf.lists.named.devs, "%s\n");
+ sort_uniq(&conf.lists.named.resources, true);
+ write_list(out, &conf.lists.named.resources, "%s\n");
+ sort_uniq(&conf.lists.named.sorted_resources, false);
+ write_list(out, &conf.lists.named.sorted_resources, "%s\n");
+ break;
+ case 'l':
+ lib = 1;
+ obj = arg[2] == 'o';
+ goto lo;
+ case 'o':
+ obj = 1;
+ lib = arg[2] == 'l';
+ lo:process_replaces(&conf);
+ if (obj) {
+ sort_uniq(&conf.lists.named.objs, true);
+ write_list_pattern(out, &conf.lists.named.objs, &conf.obj_p);
+ }
+ if (lib) {
+ sort_uniq(&conf.lists.named.libs, true);
+ sort_uniq(&conf.lists.named.links, true);
+ write_list_pattern(out, &conf.lists.named.libpaths, &conf.libpath_p);
+ write_list_pattern(out, &conf.lists.named.links, &conf.obj_p);
+ write_list_pattern(out, &conf.lists.named.libs, &conf.lib_p);
+ }
+ break;
+ default:
+ fclose(out);
+ fprintf(stderr, "Unknown switch %s.\n", argv[i]);
+ exit(1);
+ }
+ fclose(out);
}
return 0;
@@ -532,11 +532,11 @@ mrealloc(void *old_ptr, size_t old_size, size_t new_size)
void *new_ptr = malloc(new_size);
if (new_ptr == NULL)
- return NULL;
+ return NULL;
/* We have to pass in the old size, since we have no way to */
/* determine it otherwise. */
if (old_ptr)
- memcpy(new_ptr, old_ptr, min(old_size, new_size));
+ memcpy(new_ptr, old_ptr, min(old_size, new_size));
return new_ptr;
}
@@ -546,7 +546,7 @@ alloc_list(string_list_t * list)
{
list->count = 0;
list->items =
- (string_item_t *) calloc(list->max_count, sizeof(string_item_t));
+ (string_item_t *) calloc(list->max_count, sizeof(string_item_t));
assert(list->items != NULL);
return 0;
}
@@ -558,7 +558,7 @@ dev_file_name(char *str)
int len = strlen(str);
if (len <= 4 || strcmp(".dev", str + len - 4))
- strcat(str, ".dev");
+ strcat(str, ".dev");
}
/* Delete any files that are named as -replace "resources". */
@@ -569,48 +569,48 @@ process_replaces(config_t * pconf)
int i;
for (i = 0; i < pconf->replaces.count; ++i) {
- int j;
-
- strcpy(bufname, pconf->replaces.items[i].str);
- /* See if the file being replaced was included. */
- dev_file_name(bufname);
- for (j = 0; j < pconf->file_names.count; ++j) {
- const char *fname = pconf->file_names.items[j].str;
-
- if (!strcmp(fname, bufname)) {
- if (pconf->debug)
- printf("Replacing file %s.\n", fname);
- /* Delete all resources associated with this file. */
- {
- int rn;
-
- for (rn = 0; rn < NUM_RESOURCE_LISTS; ++rn) {
- string_item_t *items = pconf->lists.indexed[rn].items;
- int count = pconf->lists.indexed[rn].count;
- int tn;
-
- for (tn = 0; tn < count; ++tn) {
- if (items[tn].file_index == j) {
- /*
- * Delete the item. Since we haven't sorted
- * the items yet, just replace this item
- * with the last one, but make sure we don't
- * miss scanning it.
- */
- if (pconf->debug)
- printf("Replacing %s %s.\n",
- pconf->lists.indexed[rn].list_name,
- items[tn].str);
- items[tn--] = items[--count];
- }
- }
- pconf->lists.indexed[rn].count = count;
- }
- }
- pconf->file_names.items[j].str = "";
- break;
- }
- }
+ int j;
+
+ strcpy(bufname, pconf->replaces.items[i].str);
+ /* See if the file being replaced was included. */
+ dev_file_name(bufname);
+ for (j = 0; j < pconf->file_names.count; ++j) {
+ const char *fname = pconf->file_names.items[j].str;
+
+ if (!strcmp(fname, bufname)) {
+ if (pconf->debug)
+ printf("Replacing file %s.\n", fname);
+ /* Delete all resources associated with this file. */
+ {
+ int rn;
+
+ for (rn = 0; rn < NUM_RESOURCE_LISTS; ++rn) {
+ string_item_t *items = pconf->lists.indexed[rn].items;
+ int count = pconf->lists.indexed[rn].count;
+ int tn;
+
+ for (tn = 0; tn < count; ++tn) {
+ if (items[tn].file_index == j) {
+ /*
+ * Delete the item. Since we haven't sorted
+ * the items yet, just replace this item
+ * with the last one, but make sure we don't
+ * miss scanning it.
+ */
+ if (pconf->debug)
+ printf("Replacing %s %s.\n",
+ pconf->lists.indexed[rn].list_name,
+ items[tn].str);
+ items[tn--] = items[--count];
+ }
+ }
+ pconf->lists.indexed[rn].count = count;
+ }
+ }
+ pconf->file_names.items[j].str = "";
+ break;
+ }
+ }
}
/* Don't process the replaces again. */
pconf->replaces.count = 0;
@@ -634,41 +634,41 @@ read_file(config_t * pconf, const char *fname)
string_item_t *item;
if (cname == 0) {
- fprintf(stderr, "Can't allocate space for file name %s%s.\n",
- pconf->file_prefix, fname);
- exit(1);
+ fprintf(stderr, "Can't allocate space for file name %s%s.\n",
+ pconf->file_prefix, fname);
+ exit(1);
}
strcpy(cname, pconf->file_prefix);
strcat(cname, fname);
for (i = 0; i < pconf->file_names.count; ++i)
- if (!strcmp(pconf->file_names.items[i].str, cname)) {
- free(cname);
- return &pconf->file_contents.items[i];
- }
+ if (!strcmp(pconf->file_names.items[i].str, cname)) {
+ free(cname);
+ return &pconf->file_contents.items[i];
+ }
/* Try to open the file in binary mode, to avoid the overhead */
/* of unnecessary EOL conversion in the C library. */
in = fopen(cname, "rb");
if (in == 0) {
- in = fopen(cname, "r");
- if (in == 0) {
- fprintf(stderr, "Can't read %s.\n", cname);
- exit(1);
- }
+ in = fopen(cname, "r");
+ if (in == 0) {
+ fprintf(stderr, "Can't read %s.\n", cname);
+ exit(1);
+ }
}
fseek(in, 0L, 2 /*SEEK_END */ );
end = ftell(in);
cont = malloc(end + 1);
if (cont == 0) {
- fprintf(stderr, "Can't allocate %d bytes to read %s.\n",
- end + 1, cname);
- exit(1);
+ fprintf(stderr, "Can't allocate %d bytes to read %s.\n",
+ end + 1, cname);
+ exit(1);
}
rewind(in);
nread = fread(cont, 1, end, in);
fclose(in);
cont[nread] = 0;
if (pconf->debug)
- printf("File %s = %d bytes.\n", cname, nread);
+ printf("File %s = %d bytes.\n", cname, nread);
add_item(&pconf->file_names, cname, -1);
item = add_item(&pconf->file_contents, cont, -1);
item->index = 0; /* union of uniq_mode_ts */
@@ -689,26 +689,26 @@ read_dev(config_t * pconf, const char *arg)
int len;
if (pconf->debug)
- printf("Reading %s;\n", arg);
+ printf("Reading %s;\n", arg);
item = read_file(pconf, arg);
if (item->index == uniq_first) { /* Don't need to read the file again. */
- if (pconf->debug)
- printf("Skipping duplicate file.\n");
- return uniq_first;
+ if (pconf->debug)
+ printf("Skipping duplicate file.\n");
+ return uniq_first;
}
in = item->str;
file_index = item - pconf->file_contents.items;
strcpy(category, "obj");
while ((len = read_token(token, MAX_TOKEN, &in)) > 0)
- item->index |= add_entry(pconf, category, token, file_index);
+ item->index |= add_entry(pconf, category, token, file_index);
free(category);
#undef MAX_TOKEN
if (len < 0) {
- fprintf(stderr, "Token too long: %s.\n", token);
- exit(1);
+ fprintf(stderr, "Token too long: %s.\n", token);
+ exit(1);
}
if (pconf->debug)
- printf("Finished %s.\n", arg);
+ printf("Finished %s.\n", arg);
free(token);
return item->index;
}
@@ -721,17 +721,17 @@ read_token(char *token, int max_len, const char **pin)
int len = 0;
while (len < max_len) {
- char ch = *in;
-
- if (ch == 0)
- break;
- ++in;
- if (isspace(ch)) {
- if (len > 0)
- break;
- continue;
- }
- token[len++] = ch;
+ char ch = *in;
+
+ if (ch == 0)
+ break;
+ ++in;
+ if (isspace(ch)) {
+ if (len > 0)
+ break;
+ continue;
+ }
+ token[len++] = ch;
}
token[len] = 0;
*pin = in;
@@ -743,131 +743,131 @@ int
add_entry(config_t * pconf, char *category, const char *item, int file_index)
{
if (item[0] == '-' && islower(item[1])) { /* set category */
- strcpy(category, item + 1);
- return 0;
+ strcpy(category, item + 1);
+ return 0;
} else { /* add to current category */
- char str[MAX_STR];
- char template[80];
- const char *pat = 0;
- string_list_t *list = &pconf->lists.named.resources;
-
- if (pconf->debug)
- printf("Adding %s %s;\n", category, item);
- /* Handle a few resources specially; just queue the rest. */
- switch (category[0]) {
+ char str[MAX_STR];
+ char template[80];
+ const char *pat = 0;
+ string_list_t *list = &pconf->lists.named.resources;
+
+ if (pconf->debug)
+ printf("Adding %s %s;\n", category, item);
+ /* Handle a few resources specially; just queue the rest. */
+ switch (category[0]) {
#define IS_CAT(str) !strcmp(category, str)
- case 'c':
- if (!IS_CAT("comp"))
- goto err;
- pat = "compositor_(%scomposite_%%s_type)";
- list = &pconf->lists.named.compositors;
- goto pre;
- case 'd':
- if (IS_CAT("dev"))
- pat = "device_(%s%%s_device)";
- else if (IS_CAT("dev2"))
- pat = "device2_(%s%%s_device)";
- else
- goto err;
- list = &pconf->lists.named.devs;
+ case 'c':
+ if (!IS_CAT("comp"))
+ goto err;
+ pat = "compositor_(%scomposite_%%s_type)";
+ list = &pconf->lists.named.compositors;
+ goto pre;
+ case 'd':
+ if (IS_CAT("dev"))
+ pat = "device_(%s%%s_device)";
+ else if (IS_CAT("dev2"))
+ pat = "device2_(%s%%s_device)";
+ else
+ goto err;
+ list = &pconf->lists.named.devs;
pre: sprintf(template, pat, pconf->name_prefix);
- pat = template;
- break;
- case 'e':
- if (IS_CAT("emulator")) {
- sprintf(str, "emulator_(\"%s\",%u)",
- item, (uint)strlen(item));
- item = str;
- break;
- }
- goto err;
- case 'f':
- if (IS_CAT("font")) {
- list = &pconf->lists.named.fonts;
- break;
- } else if (IS_CAT("functiontype")) {
- pat = "function_type_(%%s,%sbuild_function_%%s)";
- } else
- goto err;
- goto pre;
- case 'h':
- if (IS_CAT("halftone")) {
- pat = "halftone_(%sdht_%%s)";
- } else
- goto err;
- goto pre;
- case 'i':
- if (IS_CAT("imageclass")) {
- list = &pconf->lists.named.sorted_resources;
- pat = "image_class_(%simage_class_%%s)";
- } else if (IS_CAT("imagetype")) {
- pat = "image_type_(%%s,%simage_type_%%s)";
- } else if (IS_CAT("include")) {
- strcpy(str, item);
- dev_file_name(str);
- return read_dev(pconf, str);
- } else if (IS_CAT("init")) {
- pat = "init_(%s%%s_init)";
- } else if (IS_CAT("iodev")) {
- pat = "io_device_(%siodev_%%s)";
- } else
- goto err;
- goto pre;
- case 'l':
- if (IS_CAT("lib")) {
- list = &pconf->lists.named.libs;
- break;
- } else if (IS_CAT("libpath")) {
- list = &pconf->lists.named.libpaths;
- break;
- } else if (IS_CAT("link")) {
- list = &pconf->lists.named.links;
- break;
- }
- goto err;
- case 'o':
- if (IS_CAT("obj")) {
- list = &pconf->lists.named.objs;
- strcpy(template, pconf->file_prefix);
- strcat(template, "%s");
- pat = template;
- break;
- }
- if (IS_CAT("oper")) {
- pat = "oper_(%s_op_defs)";
- break;
- }
- goto err;
- case 'p':
- if (IS_CAT("ps")) {
- sprintf(str, "psfile_(\"%s.ps\",%u)",
- item, (uint)(strlen(item) + 3));
- item = str;
- break;
- } else if (IS_CAT("plugin")) {
- pat = "plugin_(%s%%s_instantiate)";
+ pat = template;
+ break;
+ case 'e':
+ if (IS_CAT("emulator")) {
+ sprintf(str, "emulator_(\"%s\",%u)",
+ item, (uint)strlen(item));
+ item = str;
+ break;
+ }
+ goto err;
+ case 'f':
+ if (IS_CAT("font")) {
+ list = &pconf->lists.named.fonts;
+ break;
+ } else if (IS_CAT("functiontype")) {
+ pat = "function_type_(%%s,%sbuild_function_%%s)";
+ } else
+ goto err;
+ goto pre;
+ case 'h':
+ if (IS_CAT("halftone")) {
+ pat = "halftone_(%sdht_%%s)";
+ } else
+ goto err;
+ goto pre;
+ case 'i':
+ if (IS_CAT("imageclass")) {
+ list = &pconf->lists.named.sorted_resources;
+ pat = "image_class_(%simage_class_%%s)";
+ } else if (IS_CAT("imagetype")) {
+ pat = "image_type_(%%s,%simage_type_%%s)";
+ } else if (IS_CAT("include")) {
+ strcpy(str, item);
+ dev_file_name(str);
+ return read_dev(pconf, str);
+ } else if (IS_CAT("init")) {
+ pat = "init_(%s%%s_init)";
+ } else if (IS_CAT("iodev")) {
+ pat = "io_device_(%siodev_%%s)";
+ } else
+ goto err;
+ goto pre;
+ case 'l':
+ if (IS_CAT("lib")) {
+ list = &pconf->lists.named.libs;
+ break;
+ } else if (IS_CAT("libpath")) {
+ list = &pconf->lists.named.libpaths;
+ break;
+ } else if (IS_CAT("link")) {
+ list = &pconf->lists.named.links;
+ break;
+ }
+ goto err;
+ case 'o':
+ if (IS_CAT("obj")) {
+ list = &pconf->lists.named.objs;
+ strcpy(template, pconf->file_prefix);
+ strcat(template, "%s");
+ pat = template;
+ break;
+ }
+ if (IS_CAT("oper")) {
+ pat = "oper_(%s_op_defs)";
+ break;
+ }
+ goto err;
+ case 'p':
+ if (IS_CAT("ps")) {
+ sprintf(str, "psfile_(\"%s.ps\",%u)",
+ item, (uint)(strlen(item) + 3));
+ item = str;
+ break;
+ } else if (IS_CAT("plugin")) {
+ pat = "plugin_(%s%%s_instantiate)";
goto pre;
}
- goto err;
- case 'r':
- if (IS_CAT("replace")) {
- list = &pconf->replaces;
- break;
- }
- goto err;
+ goto err;
+ case 'r':
+ if (IS_CAT("replace")) {
+ list = &pconf->replaces;
+ break;
+ }
+ goto err;
#undef IS_CAT
- default:
+ default:
err: fprintf(stderr, "Definition not recognized: %s %s.\n",
- category, item);
- exit(1);
- }
- if (pat) {
- sprintf(str, pat, item, item);
- assert(strlen(str) < MAX_STR);
- add_item(list, str, file_index);
- } else
- add_item(list, item, file_index);
- return list->mode;
+ category, item);
+ exit(1);
+ }
+ if (pat) {
+ sprintf(str, pat, item, item);
+ assert(strlen(str) < MAX_STR);
+ add_item(list, str, file_index);
+ } else
+ add_item(list, item, file_index);
+ return list->mode;
}
}
@@ -880,16 +880,16 @@ add_item(string_list_t * list, const char *str, int file_index)
string_item_t *item;
if (count >= list->max_count) {
- list->max_count <<= 1;
- if (list->max_count < 20)
- list->max_count = 20;
- list->items =
- (string_item_t *) mrealloc(list->items,
- (list->max_count >> 1) *
- sizeof(string_item_t),
- list->max_count *
- sizeof(string_item_t));
- assert(list->items != NULL);
+ list->max_count <<= 1;
+ if (list->max_count < 20)
+ list->max_count = 20;
+ list->items =
+ (string_item_t *) mrealloc(list->items,
+ (list->max_count >> 1) *
+ sizeof(string_item_t),
+ list->max_count *
+ sizeof(string_item_t));
+ assert(list->items != NULL);
}
item = &list->items[count];
item->str = rstr;
@@ -933,19 +933,19 @@ sort_uniq(string_list_t * list, bool by_index)
bool last = list->mode == uniq_last;
if (count == 0)
- return;
+ return;
qsort((char *)strlist, count, sizeof(string_item_t), cmp_str);
for (from = to = strlist + 1, i = 1; i < count; from++, i++)
- if (strcmp(from->str, to[-1].str))
- *to++ = *from;
- else if ((last ? from->index > to[-1].index :
- from->index < to[-1].index)
- )
- to[-1] = *from;
+ if (strcmp(from->str, to[-1].str))
+ *to++ = *from;
+ else if ((last ? from->index > to[-1].index :
+ from->index < to[-1].index)
+ )
+ to[-1] = *from;
count = to - strlist;
list->count = count;
if (by_index)
- qsort((char *)strlist, count, sizeof(string_item_t), cmp_index);
+ qsort((char *)strlist, count, sizeof(string_item_t), cmp_index);
}
/* Write a list of strings using a template. */
@@ -961,7 +961,7 @@ write_list(FILE * out, const string_list_t * list, const char *pstr)
}
void
write_list_pattern(FILE * out, const string_list_t * list,
- const string_pattern_t * pat)
+ const string_pattern_t * pat)
{
int i;
char macname[40];
@@ -969,54 +969,54 @@ write_list_pattern(FILE * out, const string_list_t * list,
*macname = 0;
for (i = 0; i < list->count; i++) {
- const char *lstr = list->items[i].str;
- int len = strlen(lstr);
- char *str = malloc(len + 1);
- int xlen = plen + len * 3;
- char *xstr = malloc(xlen + 1);
- char *alist;
-
- strcpy(str, lstr);
- if (pat->drop_extn) {
- char *dot = str + len;
-
- while (dot > str && *dot != '.')
- dot--;
- if (dot > str)
- *dot = 0, len = dot - str;
- }
- if (pat->upper_case) {
- char *ptr = str;
-
- for (; *ptr; ptr++)
- if (islower(*ptr))
- *ptr = toupper(*ptr);
- }
- /* We repeat str for the benefit of patterns that */
- /* need the argument substituted in more than one place. */
- sprintf(xstr, pat->pattern, str, str, str);
- /* Check to make sure the item is within the scope of */
- /* an appropriate #ifdef, if necessary. */
- alist = strchr(xstr, '(');
- if (alist != 0 && alist != xstr && alist[-1] == '_') {
- *alist = 0;
- if (strcmp(xstr, macname)) {
- if (*macname)
- fputs("#endif\n", out);
- fprintf(out, "#ifdef %s\n", xstr);
- strcpy(macname, xstr);
- }
- *alist = '(';
- } else {
- if (*macname) {
- fputs("#endif\n", out);
- *macname = 0;
- }
- }
- fputs(xstr, out);
- free(xstr);
- free(str);
+ const char *lstr = list->items[i].str;
+ int len = strlen(lstr);
+ char *str = malloc(len + 1);
+ int xlen = plen + len * 3;
+ char *xstr = malloc(xlen + 1);
+ char *alist;
+
+ strcpy(str, lstr);
+ if (pat->drop_extn) {
+ char *dot = str + len;
+
+ while (dot > str && *dot != '.')
+ dot--;
+ if (dot > str)
+ *dot = 0, len = dot - str;
+ }
+ if (pat->upper_case) {
+ char *ptr = str;
+
+ for (; *ptr; ptr++)
+ if (islower(*ptr))
+ *ptr = toupper(*ptr);
+ }
+ /* We repeat str for the benefit of patterns that */
+ /* need the argument substituted in more than one place. */
+ sprintf(xstr, pat->pattern, str, str, str);
+ /* Check to make sure the item is within the scope of */
+ /* an appropriate #ifdef, if necessary. */
+ alist = strchr(xstr, '(');
+ if (alist != 0 && alist != xstr && alist[-1] == '_') {
+ *alist = 0;
+ if (strcmp(xstr, macname)) {
+ if (*macname)
+ fputs("#endif\n", out);
+ fprintf(out, "#ifdef %s\n", xstr);
+ strcpy(macname, xstr);
+ }
+ *alist = '(';
+ } else {
+ if (*macname) {
+ fputs("#endif\n", out);
+ *macname = 0;
+ }
+ }
+ fputs(xstr, out);
+ free(xstr);
+ free(str);
}
if (*macname)
- fputs("#endif\n", out);
+ fputs("#endif\n", out);
}
diff --git a/gs/base/gendev.c b/gs/base/gendev.c
index 0c765e9ce..9d834f605 100644
--- a/gs/base/gendev.c
+++ b/gs/base/gendev.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -88,110 +88,110 @@ main(int argc, char *argv[])
conf = init_config;
/* Process command line arguments. */
for (i = 1; i < argc; i++) {
- const char *arg = argv[i];
+ const char *arg = argv[i];
- if (*arg != '-') {
- fprintf(stderr, "-d|m|a must precede non-switches.\n", arg);
- exit(1);
- }
- switch (arg[1]) {
- case 'C': /* change directory, by analogy with make */
- conf.file_prefix =
- (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
- ++i;
- continue;
- case 'n':
- conf.name_prefix =
- (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
- ++i;
- continue;
- case 'a':
- dev = false, append = true;
- break;
- case 'd':
- dev = true, append = false;
- break;
- case 'm':
- dev = false, append = false;
- break;
- case 'Z':
- conf.debug = true;
- continue;
- default:
- fprintf(stderr, "Unknown switch %s.\n", argv[i]);
- exit(1);
- }
- break;
+ if (*arg != '-') {
+ fprintf(stderr, "-d|m|a must precede non-switches.\n", arg);
+ exit(1);
+ }
+ switch (arg[1]) {
+ case 'C': /* change directory, by analogy with make */
+ conf.file_prefix =
+ (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
+ ++i;
+ continue;
+ case 'n':
+ conf.name_prefix =
+ (argv[i + 1][0] == '-' ? "" : argv[i + 1]);
+ ++i;
+ continue;
+ case 'a':
+ dev = false, append = true;
+ break;
+ case 'd':
+ dev = true, append = false;
+ break;
+ case 'm':
+ dev = false, append = false;
+ break;
+ case 'Z':
+ conf.debug = true;
+ continue;
+ default:
+ fprintf(stderr, "Unknown switch %s.\n", argv[i]);
+ exit(1);
+ }
+ break;
}
if (i == argc - 1) {
- fprintf(stderr, "No output file name given, last argument is %s.\n",
- argv[i]);
- exit(1);
+ fprintf(stderr, "No output file name given, last argument is %s.\n",
+ argv[i]);
+ exit(1);
}
/* Must be the output file. */
fnarg = argv[++i];
{
- char fname[100];
+ char fname[100];
- strcpy(fname, fnarg);
- strcat(fname, ".dev");
- out = fopen(fname, (append ? "a" : "w"));
- if (out == 0) {
- fprintf(stderr, "Can't open %s for output.\n", fname);
- exit(1);
- }
- if (!append)
- fprintf(out,
- "/*\n * File %s created automatically by gendev.\n */\n",
- fname);
+ strcpy(fname, fnarg);
+ strcat(fname, ".dev");
+ out = fopen(fname, (append ? "a" : "w"));
+ if (out == 0) {
+ fprintf(stderr, "Can't open %s for output.\n", fname);
+ exit(1);
+ }
+ if (!append)
+ fprintf(out,
+ "/*\n * File %s created automatically by gendev.\n */\n",
+ fname);
}
conf.out = out;
pos = ftell(out);
/* We need a separate _INCLUDED flag for each batch of definitions. */
fprintf(out, "\n#%sifndef %s_%ld_INCLUDED\n",
- indent_INCLUDED, fnarg, pos);
+ indent_INCLUDED, fnarg, pos);
fprintf(out, "#%s define %s_%ld_INCLUDED\n",
- indent_INCLUDED, fnarg, pos);
+ indent_INCLUDED, fnarg, pos);
/* Create a "unique" hash for the output file. */
for (j = 0; fnarg[j] != 0; ++j)
- conf.file_id = conf.file_id * 41 + fnarg[j];
+ conf.file_id = conf.file_id * 41 + fnarg[j];
conf.item_id <<= ITEM_ID_BITS;
/* Add the real entries. */
if (dev)
- add_entry(&conf, "dev", fnarg, false);
+ add_entry(&conf, "dev", fnarg, false);
for (j = i + 1; j < argc; ++j) {
- const char *arg = argv[j];
+ const char *arg = argv[j];
- if (arg[0] == '-')
- category = arg + 1;
- else
- add_entry(&conf, category, arg, false);
+ if (arg[0] == '-')
+ category = arg + 1;
+ else
+ add_entry(&conf, category, arg, false);
}
if (conf.in_category)
- fprintf(out, "#%sendif /* -%s */\n",
- indent_category, conf.current_category);
+ fprintf(out, "#%sendif /* -%s */\n",
+ indent_category, conf.current_category);
/* Add the scanning entries, if any. */
if (conf.any_scan_items) {
- if (conf.in_res_scan)
- fprintf(out, "#%selse /* RES_SCAN */\n", indent_RES_SCAN);
- else
- fprintf(out, "#%sifdef RES_SCAN\n", indent_RES_SCAN);
- conf.in_res_scan = true;
- category = INITIAL_CATEGORY;
- conf.item_id = 0;
- for (j = i + 1; j < argc; ++j) {
- const char *arg = argv[j];
+ if (conf.in_res_scan)
+ fprintf(out, "#%selse /* RES_SCAN */\n", indent_RES_SCAN);
+ else
+ fprintf(out, "#%sifdef RES_SCAN\n", indent_RES_SCAN);
+ conf.in_res_scan = true;
+ category = INITIAL_CATEGORY;
+ conf.item_id = 0;
+ for (j = i + 1; j < argc; ++j) {
+ const char *arg = argv[j];
- if (arg[0] == '-')
- category = arg + 1;
- else
- add_entry(&conf, category, arg, true);
- }
+ if (arg[0] == '-')
+ category = arg + 1;
+ else
+ add_entry(&conf, category, arg, true);
+ }
}
if (conf.in_res_scan)
- fprintf(out, "#%sendif /* RES_SCAN */\n", indent_RES_SCAN);
+ fprintf(out, "#%sendif /* RES_SCAN */\n", indent_RES_SCAN);
fprintf(out, "#%sendif /* !%s_%ld_INCLUDED */\n",
- indent_INCLUDED, fnarg, pos);
+ indent_INCLUDED, fnarg, pos);
fclose(out);
exit(0);
}
@@ -204,65 +204,65 @@ typedef enum {
} uniq_mode;
void
write_item(config * pconf, const char *str, const char *category,
- const char *item, uniq_mode mode)
+ const char *item, uniq_mode mode)
{
FILE *out = pconf->out;
char cati[80];
if (!pconf->in_res_scan) {
- fprintf(out, "#%sifndef RES_SCAN\n", indent_RES_SCAN);
- pconf->in_res_scan = true;
+ fprintf(out, "#%sifndef RES_SCAN\n", indent_RES_SCAN);
+ pconf->in_res_scan = true;
}
if (strcmp(pconf->current_category, category)) {
- const char *paren = strchr(str, '(');
+ const char *paren = strchr(str, '(');
- if (pconf->in_category)
- fprintf(out, "#%sendif /* -%s */\n",
- indent_category, pconf->current_category);
- fprintf(out, "#%sifdef ", indent_category);
- fwrite(str, sizeof(char), paren - str, out);
+ if (pconf->in_category)
+ fprintf(out, "#%sendif /* -%s */\n",
+ indent_category, pconf->current_category);
+ fprintf(out, "#%sifdef ", indent_category);
+ fwrite(str, sizeof(char), paren - str, out);
- fprintf(out, "\n");
- pconf->current_category = category;
- pconf->in_category = true;
+ fprintf(out, "\n");
+ pconf->current_category = category;
+ pconf->in_category = true;
}
sprintf(cati, "%s_%s_", category, item);
switch (mode) {
- case uniq_none:
- fprintf(out, "%s%s\n", indent_item, str);
- break;
- case uniq_first:
- fprintf(out, "#%sifndef %sSEEN\n", indent_SEEN, cati);
- fprintf(out, "#%s define %sSEEN\n", indent_SEEN, cati);
- write_item(pconf, str, category, item, uniq_none);
- fprintf(out, "#%sendif\n", indent_SEEN, cati);
- break;
- case uniq_last:
- fprintf(out, "#%sif %sSEEN == %lu\n", indent_SEEN, cati,
- pconf->file_id + pconf->item_id++);
- write_item(pconf, str, category, item, uniq_none);
- fprintf(out, "#%sendif\n", indent_SEEN, cati);
- pconf->any_scan_items = true;
- break;
+ case uniq_none:
+ fprintf(out, "%s%s\n", indent_item, str);
+ break;
+ case uniq_first:
+ fprintf(out, "#%sifndef %sSEEN\n", indent_SEEN, cati);
+ fprintf(out, "#%s define %sSEEN\n", indent_SEEN, cati);
+ write_item(pconf, str, category, item, uniq_none);
+ fprintf(out, "#%sendif\n", indent_SEEN, cati);
+ break;
+ case uniq_last:
+ fprintf(out, "#%sif %sSEEN == %lu\n", indent_SEEN, cati,
+ pconf->file_id + pconf->item_id++);
+ write_item(pconf, str, category, item, uniq_none);
+ fprintf(out, "#%sendif\n", indent_SEEN, cati);
+ pconf->any_scan_items = true;
+ break;
}
}
void
write_scan_item(config * pconf, const char *str, const char *category,
- const char *item, uniq_mode mode)
+ const char *item, uniq_mode mode)
{
FILE *out = pconf->out;
char cati[80];
sprintf(cati, "%s_%s_", category, item);
switch (mode) {
- case uniq_none:
- break;
- case uniq_first:
- break;
- case uniq_last:
- fprintf(out, "#%sundef %sSEEN\n", indent_scan_item, cati);
- fprintf(out, "#%s define %sSEEN %lu\n", indent_scan_item, cati,
- pconf->file_id + pconf->item_id++);
+ case uniq_none:
+ break;
+ case uniq_first:
+ break;
+ case uniq_last:
+ fprintf(out, "#%sundef %sSEEN\n", indent_scan_item, cati);
+ fprintf(out, "#%s define %sSEEN %lu\n", indent_scan_item, cati,
+ pconf->file_id + pconf->item_id++);
}
}
void
@@ -272,86 +272,86 @@ add_entry(config * pconf, const char *category, const char *item, bool scan)
uniq_mode mode = uniq_first;
if (pconf->debug && !scan)
- printf("Adding %s %s;\n", category, item);
+ printf("Adding %s %s;\n", category, item);
str[0] = 0;
switch (category[0]) { /* just an accelerator */
#define is_cat(str) !strcmp(category, str)
- case 'd':
- if (is_cat("dev"))
- sprintf(str, "device_(%s%s_device)\n",
- pconf->name_prefix, item);
- else if (is_cat("dev2"))
- sprintf(str, "device2_(%s%s_device)\n",
- pconf->name_prefix, item);
- break;
- case 'e':
- if (is_cat("emulator"))
- sprintf(str, "emulator_(\"%s\",%d)",
- item, strlen(item));
- break;
- case 'f':
- if (is_cat("font"))
- sprintf(str, "font_(\"0.font_%s\",%sf_%s,zf_%s)",
- item, pconf->name_prefix, item, item);
- break;
- case 'i':
- if (is_cat("include")) {
- int len = strlen(item);
+ case 'd':
+ if (is_cat("dev"))
+ sprintf(str, "device_(%s%s_device)\n",
+ pconf->name_prefix, item);
+ else if (is_cat("dev2"))
+ sprintf(str, "device2_(%s%s_device)\n",
+ pconf->name_prefix, item);
+ break;
+ case 'e':
+ if (is_cat("emulator"))
+ sprintf(str, "emulator_(\"%s\",%d)",
+ item, strlen(item));
+ break;
+ case 'f':
+ if (is_cat("font"))
+ sprintf(str, "font_(\"0.font_%s\",%sf_%s,zf_%s)",
+ item, pconf->name_prefix, item, item);
+ break;
+ case 'i':
+ if (is_cat("include")) {
+ int len = strlen(item);
- if (scan)
- return;
- if (strcmp(pconf->current_category, category)) {
- if (pconf->in_category) {
- fprintf(pconf->out, "#%sendif /* -%s */\n",
- indent_category, pconf->current_category);
- pconf->in_category = false;
- }
- pconf->current_category = category;
- }
- if (pconf->in_res_scan) {
- fprintf(pconf->out, "#%sendif /* RES_SCAN */\n",
- indent_RES_SCAN);
- pconf->in_res_scan = false;
- }
- if (len < 5 || strcmp(item + len - 4, ".dev"))
- fprintf(pconf->out, "#%sinclude \"%s.dev\"\n",
- indent_include, item);
- else
- fprintf(pconf->out, "#%sinclude \"%s\"\n",
- indent_include, item);
- return;
- } else if (is_cat("init"))
- sprintf(str, "init_(%s%s_init)", pconf->name_prefix, item);
- else if (is_cat("iodev"))
- sprintf(str, "io_device_(%siodev_%s)", pconf->name_prefix, item);
- break;
- case 'l':
- if (is_cat("lib")) {
- sprintf(str, "lib_(%s)", item);
- mode = uniq_last;
- }
- break;
- case 'o':
- if (is_cat("obj"))
- sprintf(str, "obj_(%s%s)", pconf->file_prefix, item);
- else if (is_cat("oper"))
- sprintf(str, "oper_(%s_op_defs)", item);
- break;
- case 'p':
- if (is_cat("ps"))
- sprintf(str, "psfile_(\"%s.ps\",%d)",
- item, strlen(item) + 3);
- break;
+ if (scan)
+ return;
+ if (strcmp(pconf->current_category, category)) {
+ if (pconf->in_category) {
+ fprintf(pconf->out, "#%sendif /* -%s */\n",
+ indent_category, pconf->current_category);
+ pconf->in_category = false;
+ }
+ pconf->current_category = category;
+ }
+ if (pconf->in_res_scan) {
+ fprintf(pconf->out, "#%sendif /* RES_SCAN */\n",
+ indent_RES_SCAN);
+ pconf->in_res_scan = false;
+ }
+ if (len < 5 || strcmp(item + len - 4, ".dev"))
+ fprintf(pconf->out, "#%sinclude \"%s.dev\"\n",
+ indent_include, item);
+ else
+ fprintf(pconf->out, "#%sinclude \"%s\"\n",
+ indent_include, item);
+ return;
+ } else if (is_cat("init"))
+ sprintf(str, "init_(%s%s_init)", pconf->name_prefix, item);
+ else if (is_cat("iodev"))
+ sprintf(str, "io_device_(%siodev_%s)", pconf->name_prefix, item);
+ break;
+ case 'l':
+ if (is_cat("lib")) {
+ sprintf(str, "lib_(%s)", item);
+ mode = uniq_last;
+ }
+ break;
+ case 'o':
+ if (is_cat("obj"))
+ sprintf(str, "obj_(%s%s)", pconf->file_prefix, item);
+ else if (is_cat("oper"))
+ sprintf(str, "oper_(%s_op_defs)", item);
+ break;
+ case 'p':
+ if (is_cat("ps"))
+ sprintf(str, "psfile_(\"%s.ps\",%d)",
+ item, strlen(item) + 3);
+ break;
#undef is_cat
- default:
- ;
+ default:
+ ;
}
if (str[0] == 0) {
- fprintf(stderr, "Unknown category %s.\n", category);
- exit(1);
+ fprintf(stderr, "Unknown category %s.\n", category);
+ exit(1);
}
if (scan)
- write_scan_item(pconf, str, category, item, mode);
+ write_scan_item(pconf, str, category, item, mode);
else
- write_item(pconf, str, category, item, mode);
+ write_item(pconf, str, category, item, mode);
}
diff --git a/gs/base/genht.c b/gs/base/genht.c
index 159877c9a..acd01b133 100644
--- a/gs/base/genht.c
+++ b/gs/base/genht.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,17 +35,17 @@
* in the file (there may be more than one) must follow this format,
* where ... indicates arbitrary text:
(optionally:)
- /halftone_name ...
- /HalftoneType 5
+ /halftone_name ...
+ /HalftoneType 5
(zero or more times:)
- /halftone_name ...
- /HalftoneType 3
- /Width xxx
- /Height xxx
- /Thresholds ...
- --hex data terminated by a >--
- (zero or more times:)
- /halftone_name 1 index
+ /halftone_name ...
+ /HalftoneType 3
+ /Width xxx
+ /Height xxx
+ /Thresholds ...
+ --hex data terminated by a >--
+ (zero or more times:)
+ /halftone_name 1 index
(finally)
... defineresource
* Lines that don't follow the above syntax may appear anywhere in the file
@@ -70,9 +70,9 @@ read_file(FILE *in, char *cname)
len = ftell(in);
cont = malloc(len + 1);
if (cont == 0) {
- fprintf(stderr, "Can't allocate %d bytes to read %s.\n",
- len + 1, cname);
- return 0;
+ fprintf(stderr, "Can't allocate %d bytes to read %s.\n",
+ len + 1, cname);
+ return 0;
}
rewind(in);
nread = fread(cont, 1, len, in);
@@ -88,23 +88,23 @@ parse_line(char **pstr, char **pline)
top:
while (*str && strchr(" \t\r\n", *str)) /* trim leading space */
- ++str;
+ ++str;
if (*str == 0) {
- *pline = 0;
- return false;
+ *pline = 0;
+ return false;
}
*pline = str;
while (*str && !strchr("\r\n", *str)) /* find EOL */
- ++str;
+ ++str;
while (str > *pline && strchr(" \t", str[-1])) /* trim trailing space */
- --str;
+ --str;
*str = 0;
*pstr = str + 1;
return true;
}
static int
parse_halftone(gx_device_halftone_resource_t *phtr, byte **pThresholds,
- char **pprefix, char **pcont)
+ char **pprefix, char **pcont)
{
char *str;
char *line;
@@ -116,110 +116,110 @@ parse_halftone(gx_device_halftone_resource_t *phtr, byte **pThresholds,
/* Parse the file. */
for (str = *pcont; parse_line(&str, &line);) {
- char *end;
- char *prefix;
- char terminator;
+ char *end;
+ char *prefix;
+ char terminator;
- if (line[0] == '%')
- continue;
- if (strlen(line) >= 14 &&
- !strcmp(line + strlen(line) - 14, "defineresource")
- )
- break;
- if (line[0] != '/')
- continue;
- if (strlen(line) >= 8 &&
- !strcmp(line + strlen(line) - 8, " 1 index")
- )
- continue;
- end = ++line;
- while (*end && !strchr(" \t<", *end)) /* find end of name */
- ++end;
- terminator = *end;
- *end = 0;
- if (rname == 0) { /* first name is halftone name */
- rname = malloc(strlen(line) + 1);
- strcpy(rname, line);
- continue;
- }
- if (terminator == 0) /* name alone */
- continue;
- ++end;
- if (!strcmp(line, "HalftoneType")) {
- if (sscanf(end, "%d", &HalftoneType) != 1) {
- fprintf(stderr, "Invalid HalftoneType syntax: %s\n", line - 1);
- return -1;
- }
- switch (HalftoneType) {
- case 3:
- break;
- case 5:
- if (*pprefix)
- free(*pprefix);
- *pprefix = rname;
- rname = 0;
- break;
- default:
- fprintf(stderr, "Invalid HalftoneType: %s\n", end);
- return -1;
- }
- continue;
- } else if (!strcmp(line, "Width")) {
- if (sscanf(end, "%d", &Width) != 1 ||
- Width <= 0 || Width > 0x4000
- ) {
- fprintf(stderr, "Invalid Width: %s\n", end);
- return -1;
- }
- } else if (!strcmp(line, "Height")) {
- if (sscanf(end, "%d", &Height) != 1 ||
- Height <= 0 || Height > 0x4000
- ) {
- fprintf(stderr, "Invalid Height: %s\n", end);
- return -1;
- }
- } else if (!strcmp(line, "Thresholds")) {
- uint ignore;
- uint num_levels = 256;
- uint num_bits = Width * Height;
- char *eol = end + strlen(end); /* skip rest of line */
- stream_cursor_read r;
- stream_cursor_write w;
+ if (line[0] == '%')
+ continue;
+ if (strlen(line) >= 14 &&
+ !strcmp(line + strlen(line) - 14, "defineresource")
+ )
+ break;
+ if (line[0] != '/')
+ continue;
+ if (strlen(line) >= 8 &&
+ !strcmp(line + strlen(line) - 8, " 1 index")
+ )
+ continue;
+ end = ++line;
+ while (*end && !strchr(" \t<", *end)) /* find end of name */
+ ++end;
+ terminator = *end;
+ *end = 0;
+ if (rname == 0) { /* first name is halftone name */
+ rname = malloc(strlen(line) + 1);
+ strcpy(rname, line);
+ continue;
+ }
+ if (terminator == 0) /* name alone */
+ continue;
+ ++end;
+ if (!strcmp(line, "HalftoneType")) {
+ if (sscanf(end, "%d", &HalftoneType) != 1) {
+ fprintf(stderr, "Invalid HalftoneType syntax: %s\n", line - 1);
+ return -1;
+ }
+ switch (HalftoneType) {
+ case 3:
+ break;
+ case 5:
+ if (*pprefix)
+ free(*pprefix);
+ *pprefix = rname;
+ rname = 0;
+ break;
+ default:
+ fprintf(stderr, "Invalid HalftoneType: %s\n", end);
+ return -1;
+ }
+ continue;
+ } else if (!strcmp(line, "Width")) {
+ if (sscanf(end, "%d", &Width) != 1 ||
+ Width <= 0 || Width > 0x4000
+ ) {
+ fprintf(stderr, "Invalid Width: %s\n", end);
+ return -1;
+ }
+ } else if (!strcmp(line, "Height")) {
+ if (sscanf(end, "%d", &Height) != 1 ||
+ Height <= 0 || Height > 0x4000
+ ) {
+ fprintf(stderr, "Invalid Height: %s\n", end);
+ return -1;
+ }
+ } else if (!strcmp(line, "Thresholds")) {
+ uint ignore;
+ uint num_levels = 256;
+ uint num_bits = Width * Height;
+ char *eol = end + strlen(end); /* skip rest of line */
+ stream_cursor_read r;
+ stream_cursor_write w;
- if (Width < 0 || Height < 0) {
- fprintf(stderr, "Width and Height must precede Thresholds.\n");
- return -1;
- }
- phtr->num_levels = num_levels;
- phtr->levels =
- malloc(num_levels * sizeof(*phtr->levels));
- phtr->bit_data =
- malloc(num_bits * sizeof(ushort));
- Thresholds = malloc(num_bits);
- s_AXD_init_inline(&ss);
- r.ptr = (const byte *)eol;
- r.limit = (const byte *)eol + strlen(eol + 1);
- w.ptr = Thresholds - 1;
- w.limit = w.ptr + num_bits;
- s_AXD_template.process((stream_state *)&ss, &r, &w, true);
- str = (char *)r.ptr + 1;
- break;
- }
+ if (Width < 0 || Height < 0) {
+ fprintf(stderr, "Width and Height must precede Thresholds.\n");
+ return -1;
+ }
+ phtr->num_levels = num_levels;
+ phtr->levels =
+ malloc(num_levels * sizeof(*phtr->levels));
+ phtr->bit_data =
+ malloc(num_bits * sizeof(ushort));
+ Thresholds = malloc(num_bits);
+ s_AXD_init_inline(&ss);
+ r.ptr = (const byte *)eol;
+ r.limit = (const byte *)eol + strlen(eol + 1);
+ w.ptr = Thresholds - 1;
+ w.limit = w.ptr + num_bits;
+ s_AXD_template.process((stream_state *)&ss, &r, &w, true);
+ str = (char *)r.ptr + 1;
+ break;
+ }
}
/* Check for successful parsing. */
if (rname == 0)
- return 1; /* end of definitions */
+ return 1; /* end of definitions */
if (HalftoneType < 0)
- fprintf(stderr, "HalftoneType not found.\n");
+ fprintf(stderr, "HalftoneType not found.\n");
if (Width < 0)
- fprintf(stderr, "Width not found.\n");
+ fprintf(stderr, "Width not found.\n");
if (Height < 0)
- fprintf(stderr, "Height not found.\n");
+ fprintf(stderr, "Height not found.\n");
if (Thresholds == 0)
- fprintf(stderr, "Thresholds not found.\n");
+ fprintf(stderr, "Thresholds not found.\n");
if (rname == 0 || Thresholds == 0)
- return -1;
+ return -1;
phtr->rname = rname;
phtr->HalftoneType = HalftoneType;
phtr->Width = Width;
@@ -232,7 +232,7 @@ parse_halftone(gx_device_halftone_resource_t *phtr, byte **pThresholds,
/* Write a halftone as a C procedure. */
static int
write_halftone(FILE *out, gx_device_halftone_resource_t *phtr,
- const char *prefix, int index)
+ const char *prefix, int index)
{
int num_bits = phtr->Width * phtr->Height;
int i;
@@ -240,32 +240,32 @@ write_halftone(FILE *out, gx_device_halftone_resource_t *phtr,
/* Write the initial comment. */
fputs("\n/* ", out);
if (prefix)
- fprintf(out, "%s.", prefix);
+ fprintf(out, "%s.", prefix);
fprintf(out, "%s */\n", phtr->rname);
/* Write the levels array. */
fprintf(out, "static const unsigned int levels_%d[] = {", index);
for (i = 0; i < phtr->num_levels; ++i) {
- if (i % 10 == 0)
- fputs("\n", out);
- fprintf(out, "%5u,", phtr->levels[i]);
+ if (i % 10 == 0)
+ fputs("\n", out);
+ fprintf(out, "%5u,", phtr->levels[i]);
}
fputs("\n0};\n", out);
/* Write the bit_data array. */
fprintf(out, "static const unsigned short bit_data_%d[] = {", index);
for (i = 0; i < num_bits; ++i) {
- if (i % 10 == 0)
- fputs("\n", out);
- fprintf(out, "%5u,", ((const ushort *)phtr->bit_data)[i]);
+ if (i % 10 == 0)
+ fputs("\n", out);
+ fprintf(out, "%5u,", ((const ushort *)phtr->bit_data)[i]);
}
fputs("\n0};\n", out);
/* Write the top-level structure. */
fprintf(out, "static const gx_device_halftone_resource_t res_%d = {\n \"%s\", %d, %d, %d, %d, levels_%d, bit_data_%d, %u\n};\n",
- index, phtr->rname, phtr->HalftoneType, phtr->Width, phtr->Height,
- phtr->num_levels, index, index,
- ht_order_procs_short.bit_data_elt_size);
+ index, phtr->rname, phtr->HalftoneType, phtr->Width, phtr->Height,
+ phtr->num_levels, index, index,
+ ht_order_procs_short.bit_data_elt_size);
return 0;
}
@@ -288,60 +288,60 @@ main(int argc, char *argv[])
int index, i;
if (argc != 3) {
- fprintf(stderr, "Usage: genht ht_res.ps ht_data.c\n");
- exit(1);
+ fprintf(stderr, "Usage: genht ht_res.ps ht_data.c\n");
+ exit(1);
}
iname = argv[1];
oname = argv[2];
in = fopen(iname, "rb");
if (in == 0) {
- in = fopen(iname, "r");
- if (in == 0) {
- fprintf(stderr, "Can't read %s.\n", iname);
- exit(1);
- }
+ in = fopen(iname, "r");
+ if (in == 0) {
+ fprintf(stderr, "Can't read %s.\n", iname);
+ exit(1);
+ }
}
cont = read_file(in, iname);
if (cont == 0)
- exit(1);
+ exit(1);
fclose(in);
out = fopen(oname, "w");
if (out == 0) {
- fprintf(stderr, "Can't open %s for output.\n", oname);
- exit(1);
+ fprintf(stderr, "Can't open %s for output.\n", oname);
+ exit(1);
}
fprintf(out, "/*\n * This file %s was generated from %s by genht.\n * Do not edit this file.\n *\n", oname, iname);
/* Copy initial comments from the input file. */
while (parse_line(&cont, &line) && line[0] == '%')
- if (line[1] != '!')
- fprintf(out, " * %s\n", line + 1);
+ if (line[1] != '!')
+ fprintf(out, " * %s\n", line + 1);
cont[-1] = '\n';
cont = line;
fputs(" */\n#include \"gxdhtres.h\"\n", out);
for (index = 0;
- (code = parse_halftone(&res, &Thresholds, &prefix, &cont)) == 0;
- ++index) {
- order.width = res.Width;
- order.num_levels = res.num_levels;
- order.levels = (uint *)res.levels;
- order.num_bits = res.Width * res.Height;
- order.bit_data = (void *)res.bit_data;
- ht_order_procs_short.construct_order(&order, Thresholds);
- write_halftone(out, &res, prefix, index);
+ (code = parse_halftone(&res, &Thresholds, &prefix, &cont)) == 0;
+ ++index) {
+ order.width = res.Width;
+ order.num_levels = res.num_levels;
+ order.levels = (uint *)res.levels;
+ order.num_bits = res.Width * res.Height;
+ order.bit_data = (void *)res.bit_data;
+ ht_order_procs_short.construct_order(&order, Thresholds);
+ write_halftone(out, &res, prefix, index);
}
if (prefix == 0)
- prefix = res.rname;
+ prefix = res.rname;
fputs("/* Check the prototype. */\n", out);
fprintf(out, "DEVICE_HALFTONE_RESOURCE_PROC(gs_dht_%s);\n", prefix);
fputs("\nconst gx_device_halftone_resource_t *const *\n", out);
fprintf(out, "gs_dht_%s(void)\n{\n static const gx_device_halftone_resource_t *const res[] = {\n\t",
- prefix);
+ prefix);
for (i = 0; i < index; ++i)
- fprintf(out, "&res_%d, ", i);
+ fprintf(out, "&res_%d, ", i);
fputs("0\n };\n return res;\n}\n", out);
fclose(out);
if (code < 0)
- exit(1);
+ exit(1);
return 0;
}
diff --git a/gs/base/gp.h b/gs/base/gp.h
index 38bb2bc50..e35116fc4 100644
--- a/gs/base/gp.h
+++ b/gs/base/gp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -77,11 +77,11 @@ const char *gp_strerror(int);
* countries using the imperial system, and a4 for countries
* using the metric system.
*
- * If there is no default paper size, set *ptr = 0 (if *plen > 0),
+ * If there is no default paper size, set *ptr = 0 (if *plen > 0),
* set *plen = 1, and return 1.
*
- * If there is a default paper size and the length len of the value
- * (not counting the terminating \0) is less than *plen,
+ * If there is a default paper size and the length len of the value
+ * (not counting the terminating \0) is less than *plen,
* copy the value to ptr, set *plen = len + 1, and return 0.
*
* If there is a default paper size and len >= *plen, set *plen = len + 1,
@@ -128,9 +128,9 @@ int gp_readline_init(void **preadline_data, gs_memory_t *mem);
* See srdline.h for the definition of sreadline_proc.
*/
int gp_readline(stream *s_in, stream *s_out, void *readline_data,
- gs_const_string *prompt, gs_string *buf,
- gs_memory_t *bufmem, uint *pcount, bool *pin_eol,
- bool (*is_stdin)(const stream *));
+ gs_const_string *prompt, gs_string *buf,
+ gs_memory_t *bufmem, uint *pcount, bool *pin_eol,
+ bool (*is_stdin)(const stream *));
/*
* Free a readline state.
@@ -144,7 +144,7 @@ void gp_readline_finit(void *readline_data);
* Returns number of bytes read, or 0 if EOF, or -ve if error.
* If unbuffered is NOT possible, fetch 1 byte if interactive
* is non-zero, or up to len bytes otherwise.
- * If unbuffered is possible, fetch at least 1 byte (unless error or EOF)
+ * If unbuffered is possible, fetch at least 1 byte (unless error or EOF)
* and any additional bytes that are available without blocking.
*/
int gp_stdin_read(char *buf, int len, int interactive, FILE *f);
@@ -204,14 +204,14 @@ extern const char gp_fmode_wb[];
* an appropriate system directory, usually as determined from
* gp_gettmpdir(), followed by a path as returned from a system call.
*
- * Implementations should make sure that
+ * Implementations should make sure that
*
* Return value: Opened file object, or NULL on error.
**/
FILE *gp_open_scratch_file(const gs_memory_t *mem,
const char *prefix,
- char fname[gp_file_name_sizeof],
- const char *mode);
+ char fname[gp_file_name_sizeof],
+ const char *mode);
/* Open a file with the given name, as a stream of uninterpreted bytes. */
FILE *gp_fopen(const char *fname, const char *mode);
@@ -228,13 +228,13 @@ typedef enum {
/*
* Combine a file name with a prefix.
- * Concatenates two paths and reduce parten references and current
+ * Concatenates two paths and reduce parten references and current
* directory references from the concatenation when possible.
* The trailing zero byte is being added.
* Various platforms may share this code.
*/
-gp_file_name_combine_result gp_file_name_combine(const char *prefix, uint plen,
- const char *fname, uint flen, bool no_sibling, char *buffer, uint *blen);
+gp_file_name_combine_result gp_file_name_combine(const char *prefix, uint plen,
+ const char *fname, uint flen, bool no_sibling, char *buffer, uint *blen);
/* -------------- Helpers for gp_file_name_combine_generic ------------- */
/* Platforms, which do not call gp_file_name_combine_generic, */
@@ -307,14 +307,13 @@ bool gp_file_name_is_empty_item_meanful(void);
/* 'type' and 16 bit 'id' in an extended attribute of a file. The is */
/* primarily for accessing fonts on MacOS, which classically used this */
/* format. Presumedly a 'nop' on systems that don't support Apple HFS. */
-int gp_read_macresource(byte *buf, const char *fname,
+int gp_read_macresource(byte *buf, const char *fname,
const uint type, const ushort id);
-
/* ------ persistent cache interface ------ */
/*
- * This is used for access to data cached between invocations of
+ * This is used for access to data cached between invocations of
* Ghostscript. It is generally used for saving reusable data that
* is expensive to compute. Concurrent access by multiple instances
* is safe. Because of this care should be taken to use a new data
@@ -326,7 +325,7 @@ int gp_read_macresource(byte *buf, const char *fname,
* A query if successful uses the passed callback to allocate a buffer
* and fills it with the retrieved data. The caller is thus responsible
* for the buffer's memory management.
- *
+ *
* See zmisc.c for postscript test operators and an example implementation.
*/
@@ -344,7 +343,6 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
#define GP_CACHE_TYPE_WTS_SIZE 2
#define GP_CACHE_TYPE_WTS_CELL 3
-
/* ------ Printer accessing ------ */
/*
@@ -395,7 +393,7 @@ typedef struct file_enum_s file_enum;
* the pattern also, as a quoting character.
*/
file_enum *gp_enumerate_files_init(const char *pat, uint patlen,
- gs_memory_t * memory);
+ gs_memory_t * memory);
/*
* Return the next file name in the enumeration. The client passes in
@@ -414,11 +412,10 @@ uint gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen);
*/
void gp_enumerate_files_close(file_enum * pfen);
-
/* ------ Font enumeration ------ */
-/* This is used to query the native os for a list of font names and
- * corresponding paths. The general idea is to save the hassle of
+/* This is used to query the native os for a list of font names and
+ * corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file
*/
@@ -431,7 +428,7 @@ void *gp_enumerate_fonts_init(gs_memory_t *mem);
return C strings. The string 'name' is the font name, 'path'
is the access path for the font resource. The returned strings
are only safe to reference until until the next call.
- Returns 0 when no more fonts are available, a positive value
+ Returns 0 when no more fonts are available, a positive value
on success, or negative value on error. */
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path);
@@ -441,7 +438,7 @@ void gp_enumerate_fonts_free(void *enum_state);
/* --------- 64 bit file access ----------- */
/* The following functions are analogues of ones with
- same name without the "_64" suffix.
+ same name without the "_64" suffix.
They perform same function with allowing big files
(over 4 gygabytes length).
@@ -454,15 +451,15 @@ void gp_enumerate_fonts_free(void *enum_state);
because most files do not need 64 bits access.
The upgrading of old code to the new 64 bits access
to be done step by step on real necessity,
- with replacing old function names with
+ with replacing old function names with
new function names through code,
- together with providing the int64_t type for storing
+ together with providing the int64_t type for storing
file offsets in intermediate structures and variables.
We assume that the result of 64 bits variant of 'ftell'
can be represented in int64_t on all platforms,
rather the result type of the native 64 bits function is
- compiler dependent (__off_t on Linux, _off_t on Cygwin,
+ compiler dependent (__off_t on Linux, _off_t on Cygwin,
__int64 on Windows).
*/
@@ -482,7 +479,7 @@ int gp_fseek_64(FILE *strm, int64_t offset, int origin);
/* We don't define gp_fread_64, gp_fwrite_64,
because (1) known platforms allow regular fread, fwrite
- to be applied to a file opened with O_LARGEFILE,
+ to be applied to a file opened with O_LARGEFILE,
fopen64, etc.; (2) Ghostscript code does not
perform writing/reading a long (over 4gb) block
in one operation.
diff --git a/gs/base/gp_dosfe.c b/gs/base/gp_dosfe.c
index 5f35c2704..ec52e0b76 100644
--- a/gs/base/gp_dosfe.c
+++ b/gs/base/gp_dosfe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@ struct file_enum_s {
gs_memory_t *memory;
};
gs_private_st_ptrs1(st_file_enum, struct file_enum_s, "file_enum",
- file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
+ file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
/* Initialize an enumeration. Note that * and ? in a directory */
/* don't work, and \ is taken literally unless a second \ follows. */
@@ -51,44 +51,44 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
int dot = 0;
if (pfen == 0)
- return 0;
+ return 0;
/* pattern could be allocated as a string, */
/* but it's simpler for GC and freeing to allocate it as bytes. */
pattern = (char *)gs_alloc_bytes(mem, pat_size,
- "gp_enumerate_files(pattern)");
+ "gp_enumerate_files(pattern)");
if (pattern == 0)
- return 0;
+ return 0;
memcpy(pattern, pat, patlen);
p = pattern + patlen;
for (i = 0; i < patlen; i++) {
- switch (pat[i]) {
- case '*':
- /* Skip to . or end of string so DOS can do it. */
- *p++ = '*';
- while (i < patlen && pat[i] != '.')
- i++;
- if (i == patlen && !dot) { /* DOS doesn't interpret * alone as */
- /* matching all files; we need *.*. */
- *p++ = '.';
- *p++ = '*';
- }
- i--;
- continue;
- case '.':
- dot = 1;
- break;
- case '\\':
- if (i + 1 < patlen && pat[i + 1] == '\\')
- i++;
- /* falls through */
- case ':':
- case '/':
- hsize = p + 1 - (pattern + patlen);
- dot = 0;
- }
- *p++ = pat[i];
+ switch (pat[i]) {
+ case '*':
+ /* Skip to . or end of string so DOS can do it. */
+ *p++ = '*';
+ while (i < patlen && pat[i] != '.')
+ i++;
+ if (i == patlen && !dot) { /* DOS doesn't interpret * alone as */
+ /* matching all files; we need *.*. */
+ *p++ = '.';
+ *p++ = '*';
+ }
+ i--;
+ continue;
+ case '.':
+ dot = 1;
+ break;
+ case '\\':
+ if (i + 1 < patlen && pat[i + 1] == '\\')
+ i++;
+ /* falls through */
+ case ':':
+ case '/':
+ hsize = p + 1 - (pattern + patlen);
+ dot = 0;
+ }
+ *p++ = pat[i];
}
*p = 0;
pfen->pattern = pattern;
@@ -113,24 +113,24 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
const char *fpat = pfen->pattern + pfen->patlen;
top:if (pfen->first_time) {
- code = dos_findfirst(fpat, &pfen->ffblk);
- pfen->first_time = 0;
+ code = dos_findfirst(fpat, &pfen->ffblk);
+ pfen->first_time = 0;
} else
- code = dos_findnext(&pfen->ffblk);
+ code = dos_findnext(&pfen->ffblk);
if (code != 0) { /* All done, clean up. */
- gp_enumerate_files_close(pfen);
- return ~(uint) 0;
+ gp_enumerate_files_close(pfen);
+ return ~(uint) 0;
}
if (maxlen < 13 + pfen->head_size)
- return maxlen + 1; /* cop out! */
+ return maxlen + 1; /* cop out! */
memcpy(ptr, fpat, pfen->head_size);
for (p = &pfen->ffblk.ff_name[0], q = ptr + pfen->head_size; *p; p++)
- if (*p != ' ')
- *q++ = *p;
+ if (*p != ' ')
+ *q++ = *p;
len = q - ptr;
/* Make sure this file really matches the pattern. */
if (!string_match(ptr, len, pfen->pattern, pfen->patlen, &smp_file))
- goto top;
+ goto top;
return len;
}
@@ -141,6 +141,6 @@ gp_enumerate_files_close(file_enum * pfen)
gs_memory_t *mem = pfen->memory;
gs_free_object(mem, pfen->pattern,
- "gp_enumerate_files_close(pattern)");
+ "gp_enumerate_files_close(pattern)");
gs_free_object(mem, pfen, "gp_enumerate_files_close");
}
diff --git a/gs/base/gp_dosfs.c b/gs/base/gp_dosfs.c
index f4a22ee34..cc62965e2 100644
--- a/gs/base/gp_dosfs.c
+++ b/gs/base/gp_dosfs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,11 +34,11 @@ gp_set_file_binary(int prnfno, bool binary)
regs.rshort.bx = prnfno;
intdos(&regs, &regs);
if (regs.rshort.cflag != 0 || !(regs.h.dl & 0x80))
- return; /* error, or not a device */
+ return; /* error, or not a device */
if (binary)
- regs.h.dl |= 0x20; /* binary (no ^Z intervention) */
+ regs.h.dl |= 0x20; /* binary (no ^Z intervention) */
else
- regs.h.dl &= ~0x20; /* text */
+ regs.h.dl &= ~0x20; /* text */
regs.h.dh = 0;
regs.h.ah = 0x44; /* ioctl */
regs.h.al = 1; /* set device info */
@@ -72,36 +72,36 @@ const char gp_fmode_wb[] = "wb";
uint gp_file_name_root(const char *fname, uint len)
{ int i = 0;
-
+
if (len == 0)
- return 0;
+ return 0;
if (len > 1 && fname[0] == '\\' && fname[1] == '\\') {
- /* A network path: "\\server\share\" */
- int k = 0;
-
- for (i = 2; i < len; i++)
- if (fname[i] == '\\' || fname[i] == '/')
- if (k++) {
- i++;
- break;
- }
+ /* A network path: "\\server\share\" */
+ int k = 0;
+
+ for (i = 2; i < len; i++)
+ if (fname[i] == '\\' || fname[i] == '/')
+ if (k++) {
+ i++;
+ break;
+ }
} else if (fname[0] == '/' || fname[0] == '\\') {
- /* Absolute with no drive. */
- i = 1;
+ /* Absolute with no drive. */
+ i = 1;
} else if (len > 1 && fname[1] == ':') {
- /* Absolute with a drive. */
- i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
+ /* Absolute with a drive. */
+ i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
}
return i;
}
uint gs_file_name_check_separator(const char *fname, int len, const char *item)
{ if (len > 0) {
- if (fname[0] == '/' || fname[0] == '\\')
- return 1;
+ if (fname[0] == '/' || fname[0] == '\\')
+ return 1;
} else if (len < 0) {
- if (fname[-1] == '/' || fname[-1] == '\\')
- return 1;
+ if (fname[-1] == '/' || fname[-1] == '\\')
+ return 1;
}
return 0;
}
@@ -139,9 +139,9 @@ bool gp_file_name_is_empty_item_meanful(void)
}
gp_file_name_combine_result
-gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
- return gp_file_name_combine_generic(prefix, plen,
- fname, flen, no_sibling, buffer, blen);
+ return gp_file_name_combine_generic(prefix, plen,
+ fname, flen, no_sibling, buffer, blen);
}
diff --git a/gs/base/gp_dvx.c b/gs/base/gp_dvx.c
index 01d42ec7a..04e3f8664 100644
--- a/gs/base/gp_dvx.c
+++ b/gs/base/gp_dvx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,8 +59,8 @@ gp_get_realtime(long *pdt)
struct timezone tzp;
if (gettimeofday(&tp, &tzp) == -1) {
- lprintf("Ghostscript: gettimeofday failed!\n");
- tp.tv_sec = tp.tv_usec = 0;
+ lprintf("Ghostscript: gettimeofday failed!\n");
+ tp.tv_sec = tp.tv_usec = 0;
}
/* tp.tv_sec is #secs since Jan 1, 1970 */
pdt[0] = tp.tv_sec;
@@ -68,7 +68,7 @@ gp_get_realtime(long *pdt)
#ifdef DEBUG_CLOCK
printf("tp.tv_sec = %d tp.tv_usec = %d pdt[0] = %ld pdt[1] = %ld\n",
- tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
+ tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
#endif
}
@@ -81,14 +81,14 @@ gp_get_usertime(long *pdt)
}
/* ------ Persistent data cache ------*/
-
+
/* insert a buffer under a (type, key) pair */
int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
-{
+{
/* not yet implemented */
return 0;
-}
-
+}
+
/* look up a (type, key) in the cache */
int gp_cache_query(int type, byte* key, int keylen, void **buffer,
gp_cache_alloc alloc, void *userdata)
@@ -109,12 +109,12 @@ gp_open_printer(const gs_memory_t *mem,
int binary_mode)
{
if (strlen(fname) == 0 || !strcmp(fname, "PRN")) {
- if (binary_mode)
- gp_set_file_binary(fileno(stdprn), 1);
- stdprn->_flag = _IOWRT; /* Make stdprn buffered to improve performance */
- return stdprn;
+ if (binary_mode)
+ gp_set_file_binary(fileno(stdprn), 1);
+ stdprn->_flag = _IOWRT; /* Make stdprn buffered to improve performance */
+ return stdprn;
} else
- return fopen(fname, (binary_mode ? "wb" : "w"));
+ return fopen(fname, (binary_mode ? "wb" : "w"));
}
/* Close the connection to the printer. */
@@ -122,28 +122,28 @@ void
gp_close_printer(const gs_memory_t *mem, FILE * pfile, const char *fname)
{
if (pfile == stdprn)
- fflush(pfile);
+ fflush(pfile);
else
- fclose(pfile);
+ fclose(pfile);
}
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file.
*/
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
return NULL;
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
return 0;
}
-
+
void gp_enumerate_fonts_free(void *enum_state)
{
-}
+}
diff --git a/gs/base/gp_getnv.c b/gs/base/gp_getnv.c
index 70d67b8ee..fff0e68c7 100644
--- a/gs/base/gp_getnv.c
+++ b/gs/base/gp_getnv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,21 +29,21 @@ gp_getenv(const char *key, char *ptr, int *plen)
const char *str = getenv(key);
if (str) {
- int len = strlen(str);
+ int len = strlen(str);
- if (len < *plen) {
- /* string fits */
- strcpy(ptr, str);
- *plen = len + 1;
- return 0;
- }
- /* string doesn't fit */
- *plen = len + 1;
- return -1;
+ if (len < *plen) {
+ /* string fits */
+ strcpy(ptr, str);
+ *plen = len + 1;
+ return 0;
+ }
+ /* string doesn't fit */
+ *plen = len + 1;
+ return -1;
}
/* missing key */
if (*plen > 0)
- *ptr = 0;
+ *ptr = 0;
*plen = 1;
return 1;
}
diff --git a/gs/base/gp_mac.c b/gs/base/gp_mac.c
index 58fd5aca0..0b3d64b3d 100644
--- a/gs/base/gp_mac.c
+++ b/gs/base/gp_mac.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,37 +59,35 @@
HWND hwndtext; /* used as identifier for the dll instance */
-
char *
mygetenv(const char * env)
{
- return (NULL);
+ return (NULL);
}
void
gp_init (void)
{
- extern char *gs_lib_default_path;
- extern char *gs_init_file;
-
+ extern char *gs_lib_default_path;
+ extern char *gs_init_file;
+
#if 0
- /*...Initialize Ghostscript's default library paths and initialization file...*/
-
- {
- int i;
- char **p;
-
-
- for (i = iGSLibPathStr, p = &gs_lib_default_path;
- i <= iGSInitFileStr;
- i++, p = &gs_init_file)
- {
- GetIndString (string, MACSTRS_RES_ID, i);
- (void) PtoCstr (string);
- *p = malloc ((size_t) (strlen ((char *) string) + 1));
- strcpy (*p, (char *) string);
- }
- }
+ /*...Initialize Ghostscript's default library paths and initialization file...*/
+
+ {
+ int i;
+ char **p;
+
+ for (i = iGSLibPathStr, p = &gs_lib_default_path;
+ i <= iGSInitFileStr;
+ i++, p = &gs_init_file)
+ {
+ GetIndString (string, MACSTRS_RES_ID, i);
+ (void) PtoCstr (string);
+ *p = malloc ((size_t) (strlen ((char *) string) + 1));
+ strcpy (*p, (char *) string);
+ }
+ }
#endif
}
@@ -117,8 +115,8 @@ gettimeofday(struct timeval *tvp)
long ticks;
if (!offset) {
- time(&offset);
- offset -= (time((long *)&tms) / HZ);
+ time(&offset);
+ offset -= (time((long *)&tms) / HZ);
}
ticks = time((long *)&tms);
tvp->tv_sec = ticks / HZ + offset;
@@ -137,10 +135,10 @@ gp_get_realtime(long *pdt)
{
struct timeval tp;
- if (gettimeofday(&tp) == -1) {
- lprintf("Ghostscript: gettimeofday failed!\n");
- gs_abort(NULL);
- }
+ if (gettimeofday(&tp) == -1) {
+ lprintf("Ghostscript: gettimeofday failed!\n");
+ gs_abort(NULL);
+ }
/* tp.tv_sec is #secs since Jan 1, 1970 */
pdt[0] = tp.tv_sec;
@@ -148,10 +146,10 @@ gp_get_realtime(long *pdt)
/* Some Unix systems (e.g., Interactive 3.2 r3.0) return garbage */
/* in tp.tv_usec. Try to filter out the worst of it here. */
pdt[1] = tp.tv_usec >= 0 && tp.tv_usec < 1000000 ? tp.tv_usec * 1000 : 0;
-
+
#ifdef DEBUG_CLOCK
printf("tp.tv_sec = %d tp.tv_usec = %d pdt[0] = %ld pdt[1] = %ld\n",
- tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
+ tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
#endif
}
@@ -161,10 +159,9 @@ void
gp_get_usertime(long *pdt)
{
gp_get_realtime(pdt); /* Use an approximation on other hosts. */
- pdt[0] -= (char)rand(); // was needed, if used for random generator seed (g3 is too fast)
+ pdt[0] -= (char)rand(); // was needed, if used for random generator seed (g3 is too fast)
}
-
/*
* Get the string corresponding to an OS error number.
* If no string is available, return NULL. The caller may assume
@@ -172,10 +169,9 @@ gp_get_usertime(long *pdt)
*/
const char * gp_strerror(int)
{
- return NULL;
+ return NULL;
}
-
/* ------ Date and time ------ */
/* Read the current date (in days since Jan. 1, 1980) */
@@ -185,33 +181,32 @@ void
gp_get_clock (long *pdt) {
gp_get_realtime(pdt); /* Use an approximation on other hosts. */
-
+
}
void
gpp_get_clock (long *pdt)
{
- long secs;
- DateTimeRec dateRec;
- static DateTimeRec baseDateRec = {1980, 1, 1, 0, 0, 0, 1};
- long pdtmp[2];
- void do_get_clock (DateTimeRec *dateRec, long *pdt);
-
+ long secs;
+ DateTimeRec dateRec;
+ static DateTimeRec baseDateRec = {1980, 1, 1, 0, 0, 0, 1};
+ long pdtmp[2];
+ void do_get_clock (DateTimeRec *dateRec, long *pdt);
- GetDateTime ((unsigned long *) &secs);
+ GetDateTime ((unsigned long *) &secs);
// SecsondsToDate (secs, &dateRec);
- do_get_clock (&dateRec , pdt);
- do_get_clock (&baseDateRec, pdtmp);
+ do_get_clock (&dateRec , pdt);
+ do_get_clock (&baseDateRec, pdtmp);
- /* If the date is reasonable, subtract the days since Jan. 1, 1980 */
+ /* If the date is reasonable, subtract the days since Jan. 1, 1980 */
- if (pdtmp[0] < pdt[0])
- pdt[0] -= pdtmp[0];
+ if (pdtmp[0] < pdt[0])
+ pdt[0] -= pdtmp[0];
#ifdef DEBUG_CLOCK
- printf("pdt[0] = %ld pdt[1] = %ld\n", pdt[0], pdt[1]);
+ printf("pdt[0] = %ld pdt[1] = %ld\n", pdt[0], pdt[1]);
#endif
}
@@ -225,54 +220,50 @@ gpp_get_realtime (long *pdt)
{
UnsignedWide microTickCount,
- nMicroTickCount;
-
- long idate;
- static const int mstart[12] =
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
- long secs;
- DateTimeRec dateRec;
- static DateTimeRec baseDateRec = {1980, 1, 1, 0, 0, 0, 1};
- void do_get_clock (DateTimeRec *dateRec, long *pdt);
+ nMicroTickCount;
+ long idate;
+ static const int mstart[12] =
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+ long secs;
+ DateTimeRec dateRec;
+ static DateTimeRec baseDateRec = {1980, 1, 1, 0, 0, 0, 1};
+ void do_get_clock (DateTimeRec *dateRec, long *pdt);
if ((beginMicroTickCount.lo == 0)&&(beginMicroTickCount.hi == 0) ) {
- Microseconds(&beginMicroTickCount);
+ Microseconds(&beginMicroTickCount);
}
-
- Microseconds(&microTickCount);
-
+ Microseconds(&microTickCount);
+
nMicroTickCount.lo = microTickCount.lo - beginMicroTickCount.lo;
nMicroTickCount.hi = microTickCount.hi - beginMicroTickCount.hi;
-
- GetDateTime ((unsigned long *) &secs);
- SecondsToDate (secs, &dateRec);
+ GetDateTime ((unsigned long *) &secs);
+ SecondsToDate (secs, &dateRec);
- /* If the date is reasonable, subtract the days since Jan. 1, 1980 */
+ /* If the date is reasonable, subtract the days since Jan. 1, 1980 */
- idate = ((long) dateRec.year - 1980) * 365 + /* days per year */
- (((long) dateRec.year - 1)/4 - 1979/4) + /* intervening leap days */
- (1979/100 - ((long) dateRec.year - 1)/100) +
- (((long) dateRec.month - 1)/400 - 1979/400) +
- mstart[dateRec.month - 1] + /* month is 1-origin */
- dateRec.day - 1; /* day of month is 1-origin */
- idate += (2 < dateRec.month
- && (dateRec.year % 4 == 0
- && (dateRec.year % 100 != 0 || dateRec.year % 400 == 0)));
- pdt[0] = ((idate*24 + dateRec.hour) * 60 + dateRec.minute) * 60 + dateRec.second;
- pdt[1] = nMicroTickCount.lo * 100;
+ idate = ((long) dateRec.year - 1980) * 365 + /* days per year */
+ (((long) dateRec.year - 1)/4 - 1979/4) + /* intervening leap days */
+ (1979/100 - ((long) dateRec.year - 1)/100) +
+ (((long) dateRec.month - 1)/400 - 1979/400) +
+ mstart[dateRec.month - 1] + /* month is 1-origin */
+ dateRec.day - 1; /* day of month is 1-origin */
+ idate += (2 < dateRec.month
+ && (dateRec.year % 4 == 0
+ && (dateRec.year % 100 != 0 || dateRec.year % 400 == 0)));
+ pdt[0] = ((idate*24 + dateRec.hour) * 60 + dateRec.minute) * 60 + dateRec.second;
+ pdt[1] = nMicroTickCount.lo * 100;
//#define DEBUG_CLOCK 1
#ifdef DEBUG_CLOCK
- fprintf(stderr,"pdt[0] = %ld pdt[1] = %ld\n", pdt[0], pdt[1]);
- fprintf(stderr,"b hi[0] = %ld lo[1] = %ld\n", beginMicroTickCount.hi, beginMicroTickCount.lo);
- fprintf(stderr,"m hi[0] = %ld lo[1] = %ld\n", microTickCount.hi, microTickCount.lo);
+ fprintf(stderr,"pdt[0] = %ld pdt[1] = %ld\n", pdt[0], pdt[1]);
+ fprintf(stderr,"b hi[0] = %ld lo[1] = %ld\n", beginMicroTickCount.hi, beginMicroTickCount.lo);
+ fprintf(stderr,"m hi[0] = %ld lo[1] = %ld\n", microTickCount.hi, microTickCount.lo);
#endif
}
-
static void
do_get_clock (DateTimeRec *dateRec, long *pdt)
@@ -280,29 +271,28 @@ do_get_clock (DateTimeRec *dateRec, long *pdt)
long idate;
static const int mstart[12] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
- /* This gets UTC, not local time */
- /* We have no way of knowing the time zone correction */
- idate = ((long) dateRec->year - 1980) * 365 + /* days per year */
- (((long) dateRec->year - 1)/4 - 1979/4) + /* intervening leap days */
- (1979/100 - ((long) dateRec->year - 1)/100) +
- (((long) dateRec->month - 1)/400 - 1979/400) +
- mstart[dateRec->month - 1] + /* month is 1-origin */
- dateRec->day - 1; /* day of month is 1-origin */
- idate += (2 < dateRec->month
- && (dateRec->year % 4 == 0
- && (dateRec->year % 100 != 0 || dateRec->year % 400 == 0)));
- pdt[0] = ((idate*24 + dateRec->hour) * 60 + dateRec->minute) * 60 + dateRec->second;
- pdt[1] = 0; //dateRec->milisecond * 1000000;
+ /* This gets UTC, not local time */
+ /* We have no way of knowing the time zone correction */
+ idate = ((long) dateRec->year - 1980) * 365 + /* days per year */
+ (((long) dateRec->year - 1)/4 - 1979/4) + /* intervening leap days */
+ (1979/100 - ((long) dateRec->year - 1)/100) +
+ (((long) dateRec->month - 1)/400 - 1979/400) +
+ mstart[dateRec->month - 1] + /* month is 1-origin */
+ dateRec->day - 1; /* day of month is 1-origin */
+ idate += (2 < dateRec->month
+ && (dateRec->year % 4 == 0
+ && (dateRec->year % 100 != 0 || dateRec->year % 400 == 0)));
+ pdt[0] = ((idate*24 + dateRec->hour) * 60 + dateRec->minute) * 60 + dateRec->second;
+ pdt[1] = 0; //dateRec->milisecond * 1000000;
}
void
gpp_get_usertime(long *pdt)
{
- gp_get_realtime(pdt); /* Use an approximation for now. */
+ gp_get_realtime(pdt); /* Use an approximation for now. */
}
-
/* ------ Persistent data cache ------*/
/* insert a buffer under a (type, key) pair */
@@ -320,7 +310,6 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
return -1;
}
-
/* ------ Screen management ------ */
/* Initialize the console. */
@@ -330,19 +319,17 @@ gp_init_console(void)
{
}
-
/* Write a string to the console. */
void
gp_console_puts (const char *str, uint size)
{
/* fwrite (str, 1, size, stdout);*/
- return;
+ return;
}
const char *
gp_getenv_display(void)
{
- return NULL;
+ return NULL;
}
-
diff --git a/gs/base/gp_mac.h b/gs/base/gp_mac.h
index 5fd4d77b9..e730e1e7c 100644
--- a/gs/base/gp_mac.h
+++ b/gs/base/gp_mac.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,4 +19,3 @@
/* no special definitions for macos */
#endif /* gp_mac_INCLUDED */
-
diff --git a/gs/base/gp_macio.c b/gs/base/gp_macio.c
index d2fa1762c..4e6141cd8 100644
--- a/gs/base/gp_macio.c
+++ b/gs/base/gp_macio.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,55 +65,54 @@
//HWND hwndtext;
-
extern void
convertSpecToPath(FSSpec * s, char * p, int pLen)
{
- OSStatus err = noErr;
- CInfoPBRec params;
- Str255 dirName;
- int totLen = 0, dirLen = 0;
-
- memcpy(p, s->name + 1, s->name[0]);
- totLen += s->name[0];
-
- params.dirInfo.ioNamePtr = dirName;
- params.dirInfo.ioVRefNum = s->vRefNum;
- params.dirInfo.ioDrParID = s->parID;
- params.dirInfo.ioFDirIndex = -1;
-
- do {
- params.dirInfo.ioDrDirID = params.dirInfo.ioDrParID;
- err = PBGetCatInfoSync(&params);
-
- if ((err != noErr) || (totLen + dirName[0] + 2 > pLen)) {
- p[0] = 0;
- return;
- }
-
- dirName[++dirName[0]] = ':';
- memmove(p + dirName[0], p, totLen);
- memcpy(p, dirName + 1, dirName[0]);
- totLen += dirName[0];
- } while (params.dirInfo.ioDrParID != fsRtParID);
-
- p[totLen] = 0;
-
- return;
+ OSStatus err = noErr;
+ CInfoPBRec params;
+ Str255 dirName;
+ int totLen = 0, dirLen = 0;
+
+ memcpy(p, s->name + 1, s->name[0]);
+ totLen += s->name[0];
+
+ params.dirInfo.ioNamePtr = dirName;
+ params.dirInfo.ioVRefNum = s->vRefNum;
+ params.dirInfo.ioDrParID = s->parID;
+ params.dirInfo.ioFDirIndex = -1;
+
+ do {
+ params.dirInfo.ioDrDirID = params.dirInfo.ioDrParID;
+ err = PBGetCatInfoSync(&params);
+
+ if ((err != noErr) || (totLen + dirName[0] + 2 > pLen)) {
+ p[0] = 0;
+ return;
+ }
+
+ dirName[++dirName[0]] = ':';
+ memmove(p + dirName[0], p, totLen);
+ memcpy(p, dirName + 1, dirName[0]);
+ totLen += dirName[0];
+ } while (params.dirInfo.ioDrParID != fsRtParID);
+
+ p[totLen] = 0;
+
+ return;
}
OSErr
convertPathToSpec(const char *path, const int pathlength, FSSpec * spec)
{
- Str255 filename;
-
- /* path must be shorter than 255 bytes */
- if (pathlength > 254) return bdNamErr;
-
- *filename = pathlength;
- memcpy(filename + 1, path, pathlength);
-
- return FSMakeFSSpec(0, 0, filename, spec);
+ Str255 filename;
+
+ /* path must be shorter than 255 bytes */
+ if (pathlength > 254) return bdNamErr;
+
+ *filename = pathlength;
+ memcpy(filename + 1, path, pathlength);
+
+ return FSMakeFSSpec(0, 0, filename, spec);
}
/* ------ File name syntax ------ */
@@ -132,7 +131,6 @@ extern const char gp_current_directory_name[] = ":";
int fake_stdin = 0;
-
/* Do platform-dependent initialization */
void
@@ -145,33 +143,33 @@ setenv(const char * env, char *p) {
char *
getenv(const char * env) {
- char *p;
- FSSpec pFile;
- OSErr err = 0;
- char fpath[256]="";
-
- if ( strcmp(env,"GS_LIB") == 0) {
-
- pFile.name[0] = 0;
- err = FindFolder(kOnSystemDisk, kApplicationSupportFolderType, kDontCreateFolder,
- &pFile.vRefNum, &pFile.parID);
-
- if (err != noErr) goto failed;
+ char *p;
+ FSSpec pFile;
+ OSErr err = 0;
+ char fpath[256]="";
+
+ if ( strcmp(env,"GS_LIB") == 0) {
+
+ pFile.name[0] = 0;
+ err = FindFolder(kOnSystemDisk, kApplicationSupportFolderType, kDontCreateFolder,
+ &pFile.vRefNum, &pFile.parID);
+
+ if (err != noErr) goto failed;
// FSMakeFSSpec(pFile.vRefNum, pFile.parID,thepfname, &pfile);
- convertSpecToPath(&pFile, fpath, 256);
+ convertSpecToPath(&pFile, fpath, 256);
// sprintf(fpath,"%s",fpath);
- p = (char*)malloc((size_t) ( 4*strlen(fpath) + 40));
- sprintf(p,"%s,%sGhostscript:lib,%sGhostscript:fonts",
- (char *)&fpath[0],(char *)&fpath[0],
- (char *)&fpath[0] );
+ p = (char*)malloc((size_t) ( 4*strlen(fpath) + 40));
+ sprintf(p,"%s,%sGhostscript:lib,%sGhostscript:fonts",
+ (char *)&fpath[0],(char *)&fpath[0],
+ (char *)&fpath[0] );
- return p;
+ return p;
failed:
-
- return NULL;
- } else
- return NULL;
+
+ return NULL;
+ } else
+ return NULL;
}
@@ -210,13 +208,13 @@ mac_stdio_init(gx_io_device * iodev, gs_memory_t * mem)
extern const gx_io_device gs_iodev_stdin;
static int
mac_stdin_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int code = gs_iodev_stdin.procs.open_device(iodev, access, ps, mem);
stream *s = *ps;
if (code != 1)
- return code;
+ return code;
s->procs.process = mac_stdin_read_process;
s->procs.available = mac_std_available;
s->file = NULL;
@@ -226,13 +224,13 @@ mac_stdin_open(gx_io_device * iodev, const char *access, stream ** ps,
extern const gx_io_device gs_iodev_stdout;
static int
mac_stdout_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int code = gs_iodev_stdout.procs.open_device(iodev, access, ps, mem);
stream *s = *ps;
if (code != 1)
- return code;
+ return code;
s->procs.process = mac_stdout_write_process;
s->procs.available = mac_std_available;
s->file = NULL;
@@ -242,13 +240,13 @@ mac_stdout_open(gx_io_device * iodev, const char *access, stream ** ps,
extern const gx_io_device gs_iodev_stderr;
static int
mac_stderr_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int code = gs_iodev_stderr.procs.open_device(iodev, access, ps, mem);
stream *s = *ps;
if (code != 1)
- return code;
+ return code;
s->procs.process = mac_stderr_write_process;
s->procs.available = mac_std_available;
s->file = NULL;
@@ -263,19 +261,18 @@ mac_std_init(void)
/* which haven't gotten called yet. */
// if (gp_file_is_console(gs_stdin))
- gs_findiodevice((const byte *)"%stdin", 6)->procs.open_device =
- mac_stdin_open;
+ gs_findiodevice((const byte *)"%stdin", 6)->procs.open_device =
+ mac_stdin_open;
// if (gp_file_is_console(gs_stdout))
- gs_findiodevice((const byte *)"%stdout", 7)->procs.open_device =
- mac_stdout_open;
+ gs_findiodevice((const byte *)"%stdout", 7)->procs.open_device =
+ mac_stdout_open;
// if (gp_file_is_console(gs_stderr))
- gs_findiodevice((const byte *)"%stderr", 7)->procs.open_device =
- mac_stderr_open;
+ gs_findiodevice((const byte *)"%stderr", 7)->procs.open_device =
+ mac_stderr_open;
}
-
static int
mac_stdin_read_process(stream_state *st, stream_cursor_read *ignore_pr,
stream_cursor_write *pw, bool last)
@@ -284,20 +281,19 @@ mac_stdin_read_process(stream_state *st, stream_cursor_read *ignore_pr,
/* callback to get more input */
if (pgsdll_callback == NULL) return EOFC;
count = (*pgsdll_callback) (GSDLL_STDIN, (char*)pw->ptr + 1, count);
- pw->ptr += count;
- return 1;
+ pw->ptr += count;
+ return 1;
}
-
static int
mac_stdout_write_process(stream_state *st, stream_cursor_read *pr,
stream_cursor_write *ignore_pw, bool last)
{ uint count = pr->limit - pr->ptr;
-
+
if (pgsdll_callback == NULL) return EOFC;
(*pgsdll_callback) (GSDLL_STDOUT, (char *)(pr->ptr + 1), count);
- pr->ptr = pr->limit;
- return 0;
+ pr->ptr = pr->limit;
+ return 0;
}
static int
@@ -307,8 +303,8 @@ mac_stderr_write_process(stream_state *st, stream_cursor_read *pr,
if (pgsdll_callback == NULL) return EOFC;
(*pgsdll_callback) (GSDLL_STDOUT, (char *)(pr->ptr + 1), count);
- pr->ptr = pr->limit;
- return 0;
+ pr->ptr = pr->limit;
+ return 0;
}
static int
@@ -345,7 +341,6 @@ gp_close_printer (const gs_memory_t *mem, FILE *pfile, const char *fname)
fclose(pfile);
}
-
/* Define whether case is insignificant in file names. */
/* OBSOLETE
const int gp_file_names_ignore_case = 1;
@@ -359,14 +354,12 @@ const char gp_fmode_binary_suffix[] = "b";
const char gp_fmode_rb[] = "rb";
const char gp_fmode_wb[] = "wb";
-
/* Set a file into binary or text mode. */
int
gp_setmode_binary(FILE *pfile, bool binary)
{ return 0; /* Noop under VMS */
}
-
/* Create and open a scratch file with a given name prefix. */
/* Write the actual file name at fname. */
@@ -388,35 +381,35 @@ gp_open_scratch_file (const gs_memory_t *mem,
if (prefix_length > gp_file_name_sizeof) return NULL;
strcpy (fname, (char *) prefix);
{
- char newName[50];
+ char newName[50];
- tmpnam (newName);
- if ( prefix_length + strlen(newName) > gp_file_name_sizeof ) return NULL;
- strcat (fname, newName);
+ tmpnam (newName);
+ if ( prefix_length + strlen(newName) > gp_file_name_sizeof ) return NULL;
+ strcat (fname, newName);
}
if ( strlen(fname) > 255 ) return NULL;
if ( strrchr(fname,':') == NULL ) {
memmove((char*)&thepfname[1],(char *)&fname[0],strlen(fname));
- thepfname[0]=strlen(fname);
- myErr = FindFolder(kOnSystemDisk,kTemporaryFolderType,kCreateFolder,
- &foundVRefNum, &foundDirID);
- if ( myErr != noErr ) {
- emprintf(mem, "Can't find temp folder.\n");
- return (NULL);
- }
- FSMakeFSSpec(foundVRefNum, foundDirID,thepfname, &fSpec);
- convertSpecToPath(&fSpec, thefname, sizeof(thefname) - 1);
- sprintf(fname,"%s",thefname);
+ thepfname[0]=strlen(fname);
+ myErr = FindFolder(kOnSystemDisk,kTemporaryFolderType,kCreateFolder,
+ &foundVRefNum, &foundDirID);
+ if ( myErr != noErr ) {
+ emprintf(mem, "Can't find temp folder.\n");
+ return (NULL);
+ }
+ FSMakeFSSpec(foundVRefNum, foundDirID,thepfname, &fSpec);
+ convertSpecToPath(&fSpec, thefname, sizeof(thefname) - 1);
+ sprintf(fname,"%s",thefname);
} else {
sprintf((char*)&thefname[0],"%s\0",fname);
memmove((char*)&thepfname[1],(char *)&thefname[0],strlen(thefname));
- thepfname[0]=strlen(thefname);
+ thepfname[0]=strlen(thefname);
}
f = gp_fopen (thefname, mode);
if (f == NULL)
- emprintf1(mem, "**** Could not open temporary file %s\n", fname);
+ emprintf1(mem, "**** Could not open temporary file %s\n", fname);
return f;
}
@@ -435,26 +428,26 @@ gp_read_macresource(byte *buf, const char *fname, const uint type, const ushort
FSSpec spec;
SInt16 fileref;
OSErr result;
-
+
/* open file */
result = convertPathToSpec(fname, strlen(fname), &spec);
if (result != noErr) goto fin;
fileref = FSpOpenResFile(&spec, fsRdPerm);
if (fileref == -1) goto fin;
-
+
if_debug1('s', "[s] loading resource from fileref %d\n", fileref);
/* load resource */
resource = Get1Resource((ResType)type, (SInt16)id);
if (resource == NULL) goto fin;
-
+
/* allocate res */
/* GetResourceSize() is probably good enough */
//size = GetResourceSizeOnDisk(resource);
size = GetMaxResourceSize(resource);
-
+
if_debug1('s', "[s] resource size on disk is %d bytes\n", size);
-
+
/* if we don't have a buffer to fill, just return */
if (buf == NULL) goto fin;
@@ -462,16 +455,16 @@ gp_read_macresource(byte *buf, const char *fname, const uint type, const ushort
HLock(resource);
memcpy(buf, *resource, size);
HUnlock(resource);
-
+
fin:
/* free resource, if necessary */
ReleaseResource(resource);
CloseResFile(fileref);
-
+
return (size);
}
-/* return a list of font names and corresponding paths from
+/* return a list of font names and corresponding paths from
* the native system locations
*/
int gp_native_fontmap(char *names[], char *paths[], int *count)
@@ -484,9 +477,9 @@ int gp_native_fontmap(char *names[], char *paths[], int *count)
/****** THIS IS NOT SUPPORTED ON MACINTOSH SYSTEMS. ******/
struct file_enum_s {
- char *pattern;
- int first_time;
- gs_memory_t *memory;
+ char *pattern;
+ int first_time;
+ gs_memory_t *memory;
};
/* Initialize an enumeration. NEEDS WORK ON HANDLING * ? \. */
@@ -494,19 +487,19 @@ struct file_enum_s {
file_enum *
gp_enumerate_files_init (const char *pat, uint patlen, gs_memory_t *memory)
-{ file_enum *pfen =
- (file_enum *)gs_alloc_bytes(memory, sizeof(file_enum), "gp_enumerate_files");
- char *pattern;
- if ( pfen == 0 ) return 0;
- pattern =
- (char *)gs_alloc_bytes(memory, patlen + 1, "gp_enumerate_files(pattern)");
- if ( pattern == 0 ) return 0;
- memcpy(pattern, pat, patlen);
- pattern[patlen] = 0;
- pfen->pattern = pattern;
- pfen->memory = memory;
- pfen->first_time = 1;
- return pfen;
+{ file_enum *pfen =
+ (file_enum *)gs_alloc_bytes(memory, sizeof(file_enum), "gp_enumerate_files");
+ char *pattern;
+ if ( pfen == 0 ) return 0;
+ pattern =
+ (char *)gs_alloc_bytes(memory, patlen + 1, "gp_enumerate_files(pattern)");
+ if ( pattern == 0 ) return 0;
+ memcpy(pattern, pat, patlen);
+ pattern[patlen] = 0;
+ pfen->pattern = pattern;
+ pfen->memory = memory;
+ pfen->first_time = 1;
+ return pfen;
}
/* Enumerate the next file. */
@@ -515,9 +508,9 @@ uint
gp_enumerate_files_next (file_enum *pfen, char *ptr, uint maxlen)
{ if ( pfen->first_time )
- { pfen->first_time = 0;
- }
- return -1;
+ { pfen->first_time = 0;
+ }
+ return -1;
}
/* Clean up the file enumeration. */
@@ -525,12 +518,12 @@ gp_enumerate_files_next (file_enum *pfen, char *ptr, uint maxlen)
void
gp_enumerate_files_close (file_enum *pfen)
-{
- gs_free_object(pfen->memory, pfen->pattern, "gp_enumerate_files_close(pattern)");
- gs_free_object(pfen->memory, (char *)pfen, "gp_enumerate_files_close");
+{
+ gs_free_object(pfen->memory, pfen->pattern, "gp_enumerate_files_close(pattern)");
+ gs_free_object(pfen->memory, (char *)pfen, "gp_enumerate_files_close");
}
-FILE *
+FILE *
gp_fopen (const char * fname, const char * mode) {
char thefname[256];
@@ -538,26 +531,26 @@ gp_fopen (const char * fname, const char * mode) {
//sprintf((char*)&thefname[0],"\n%s\n",fname);
//(*pgsdll_callback) (GSDLL_STDOUT, thefname, strlen(fname));
- if ( strrchr(fname,':') == NULL )
+ if ( strrchr(fname,':') == NULL )
// sprintf((char *)&thefname[0],"%s%s\0",g_homeDir,fname);
sprintf((char *)&thefname[0],"%s%s\0","",fname);
else
sprintf((char*)&thefname[0],"%s\0",fname);
-
+
fid = fopen(thefname,mode);
-
+
return fid;
-
+
}
-FILE *
+FILE *
popen (const char * fname, const char * mode ) {
- return gp_fopen (fname, mode);
+ return gp_fopen (fname, mode);
}
int
pclose (FILE * pipe ) {
- return fclose (pipe);
+ return fclose (pipe);
}
/* -------------- Helpers for gp_file_name_combine_generic ------------- */
@@ -567,48 +560,48 @@ pclose (FILE * pipe ) {
/* compare an HFSUnitStr255 with a C string */
static int compare_UniStr(HFSUniStr255 u, const char *c, uint len)
{
- int i,searchlen,unichar;
- searchlen = min(len,u.length);
- for (i = 0; i < searchlen; i++) {
- unichar = u.unicode[i];
- /* punt on wide characters. we should really convert */
- if (unichar & !0xFF) return -1;
- /* otherwise return the the index of the first non-matching character */
- if (unichar != c[i]) break;
- }
- /* return the offset iff we matched the whole volume name */
- return (i == u.length) ? i : 0;
+ int i,searchlen,unichar;
+ searchlen = min(len,u.length);
+ for (i = 0; i < searchlen; i++) {
+ unichar = u.unicode[i];
+ /* punt on wide characters. we should really convert */
+ if (unichar & !0xFF) return -1;
+ /* otherwise return the the index of the first non-matching character */
+ if (unichar != c[i]) break;
+ }
+ /* return the offset iff we matched the whole volume name */
+ return (i == u.length) ? i : 0;
}
uint gp_file_name_root(const char *fname, uint len)
{
- OSErr err = noErr;
- HFSUniStr255 volumeName;
- FSRef rootDirectory;
- int index, match;
-
+ OSErr err = noErr;
+ HFSUniStr255 volumeName;
+ FSRef rootDirectory;
+ int index, match;
+
if (len > 0 && fname[0] == ':')
- return 0; /* A relative path, no root. */
-
- /* iterate over mounted volumes and compare our path */
- index = 1;
- while (err == noErr) {
- err = FSGetVolumeInfo (kFSInvalidVolumeRefNum, index,
- NULL, kFSVolInfoNone, NULL, /* not interested in these fields */
- &volumeName, &rootDirectory);
- if (err == nsvErr) return 0; /* no more volumes */
- if (err == noErr) {
- match = compare_UniStr(volumeName, fname, len);
- if (match > 0) {
- /* include the separator if it's present */
- if (fname[match] == ':') return match + 1;
- return match;
- }
- }
- index++;
- }
-
- /* nothing matched */
+ return 0; /* A relative path, no root. */
+
+ /* iterate over mounted volumes and compare our path */
+ index = 1;
+ while (err == noErr) {
+ err = FSGetVolumeInfo (kFSInvalidVolumeRefNum, index,
+ NULL, kFSVolInfoNone, NULL, /* not interested in these fields */
+ &volumeName, &rootDirectory);
+ if (err == nsvErr) return 0; /* no more volumes */
+ if (err == noErr) {
+ match = compare_UniStr(volumeName, fname, len);
+ if (match > 0) {
+ /* include the separator if it's present */
+ if (fname[match] == ':') return match + 1;
+ return match;
+ }
+ }
+ index++;
+ }
+
+ /* nothing matched */
return 0;
}
@@ -618,24 +611,23 @@ uint gp_file_name_root(const char *fname, uint len)
we essentially leave this unimplemented on Classic */
uint gp_file_name_root(const char *fname, uint len)
{
- return 0;
+ return 0;
}
-
-#endif /* __CARBON__ */
+#endif /* __CARBON__ */
uint gs_file_name_check_separator(const char *fname, int len, const char *item)
{ if (len > 0) {
- if (fname[0] == ':') {
- if (fname == item + 1 && item[0] == ':')
- return 1; /* It is a separator after parent. */
- if (len > 1 && fname[1] == ':')
- return 0; /* It is parent, not a separator. */
- return 1;
- }
+ if (fname[0] == ':') {
+ if (fname == item + 1 && item[0] == ':')
+ return 1; /* It is a separator after parent. */
+ if (len > 1 && fname[1] == ':')
+ return 0; /* It is parent, not a separator. */
+ return 1;
+ }
} else if (len < 0) {
- if (fname[-1] == ':')
- return 1;
+ if (fname[-1] == ':')
+ return 1;
}
return 0;
}
@@ -673,32 +665,32 @@ bool gp_file_name_is_empty_item_meanful(void)
}
gp_file_name_combine_result
-gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
- return gp_file_name_combine_generic(prefix, plen,
- fname, flen, no_sibling, buffer, blen);
+ return gp_file_name_combine_generic(prefix, plen,
+ fname, flen, no_sibling, buffer, blen);
}
// FIXME: there must be a system util for this!
static char *MacStr2c(char *pstring)
{
- char *cstring;
- int len = (pstring[0] < 256) ? pstring[0] : 255;
-
- if (len == 0) return NULL;
-
- cstring = malloc(len + 1);
- if (cstring != NULL) {
- memcpy(cstring, &(pstring[1]), len);
- cstring[len] = '\0';
- }
-
- return(cstring);
+ char *cstring;
+ int len = (pstring[0] < 256) ? pstring[0] : 255;
+
+ if (len == 0) return NULL;
+
+ cstring = malloc(len + 1);
+ if (cstring != NULL) {
+ memcpy(cstring, &(pstring[1]), len);
+ cstring[len] = '\0';
+ }
+
+ return(cstring);
}
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file
@@ -761,34 +753,34 @@ static fond_table * parse_fond(FSSpec *spec)
unsigned char *res;
fond_table *table = NULL;
int i,j, count, n, start;
-
- /* FSpOpenResFile will fail for data fork resource (.dfont) files.
- FSOpenResourceFile can open either, but cannot handle broken resource
- maps, as often occurs in font files (the suitcase version of Arial,
- for example) Thus, we try one, and then the other. */
-
+
+ /* FSpOpenResFile will fail for data fork resource (.dfont) files.
+ FSOpenResourceFile can open either, but cannot handle broken resource
+ maps, as often occurs in font files (the suitcase version of Arial,
+ for example) Thus, we try one, and then the other. */
+
result = FSpMakeFSRef(spec,&specref);
#ifdef __CARBON__
- if (result == noErr)
- result = FSOpenResourceFile(&specref, 0, NULL, fsRdPerm, &ref);
+ if (result == noErr)
+ result = FSOpenResourceFile(&specref, 0, NULL, fsRdPerm, &ref);
#else
- result = bdNamErr; /* simulate failure of the carbon routine above */
+ result = bdNamErr; /* simulate failure of the carbon routine above */
#endif
if (result != noErr) {
- ref = FSpOpenResFile(spec, fsRdPerm);
- result = ResError();
- }
+ ref = FSpOpenResFile(spec, fsRdPerm);
+ result = ResError();
+ }
if (result != noErr || ref <= 0) {
- char path[256];
- convertSpecToPath(spec, path, 256);
- dlprintf2("unable to open resource file '%s' for font enumeration (error %d)\n",
- path, result);
- goto fin;
+ char path[256];
+ convertSpecToPath(spec, path, 256);
+ dlprintf2("unable to open resource file '%s' for font enumeration (error %d)\n",
+ path, result);
+ goto fin;
}
-
+
/* we've opened the font file, now loop over the FOND resource(s)
and construct a table of the font references */
-
+
start = 0; /* number of entries so far */
UseResFile(ref);
count = Count1Resources('FOND');
@@ -798,7 +790,7 @@ static fond_table * parse_fond(FSSpec *spec)
result = ResError();
goto fin;
}
-
+
/* The FOND resource structure corresponds to the FamRec and AsscEntry
data structures documented in the FontManager reference. However,
access to these types is deprecated in Carbon. We therefore access the
@@ -807,7 +799,7 @@ static fond_table * parse_fond(FSSpec *spec)
HLock(fond);
res = *fond + 52; /* offset to association table */
n = get_int16(res) + 1; res += 2;
- table = fond_table_grow(table, n);
+ table = fond_table_grow(table, n);
for (j = start; j < start + n; j++ ) {
table->refs[j].size = get_int16(res); res += 2;
table->refs[j].style = get_int16(res); res += 2;
@@ -846,38 +838,38 @@ static void strip_char(char *string, int len, const int c)
fontname */
static char *makePSFontName(FMFontFamily Family, FMFontStyle Style)
{
- Str255 Name;
- OSStatus result;
- int length;
- char *stylename, *fontname;
- char *psname;
-
- result = FMGetFontFamilyName(Family, Name);
- if (result != noErr) return NULL;
- fontname = MacStr2c(Name);
- if (fontname == NULL) return NULL;
- strip_char(fontname, strlen(fontname), ' ');
-
- switch (Style) {
- case 0: stylename=""; break;;
- case 1: stylename="Bold"; break;;
- case 2: stylename="Italic"; break;;
- case 3: stylename="BoldItalic"; break;;
- default: stylename="Unknown"; break;;
- }
-
- length = strlen(fontname) + strlen(stylename) + 2;
- psname = malloc(length);
- if (Style != 0)
- snprintf(psname, length, "%s-%s", fontname, stylename);
- else
- snprintf(psname, length, "%s", fontname);
-
- free(fontname);
-
- return psname;
+ Str255 Name;
+ OSStatus result;
+ int length;
+ char *stylename, *fontname;
+ char *psname;
+
+ result = FMGetFontFamilyName(Family, Name);
+ if (result != noErr) return NULL;
+ fontname = MacStr2c(Name);
+ if (fontname == NULL) return NULL;
+ strip_char(fontname, strlen(fontname), ' ');
+
+ switch (Style) {
+ case 0: stylename=""; break;;
+ case 1: stylename="Bold"; break;;
+ case 2: stylename="Italic"; break;;
+ case 3: stylename="BoldItalic"; break;;
+ default: stylename="Unknown"; break;;
+ }
+
+ length = strlen(fontname) + strlen(stylename) + 2;
+ psname = malloc(length);
+ if (Style != 0)
+ snprintf(psname, length, "%s-%s", fontname, stylename);
+ else
+ snprintf(psname, length, "%s", fontname);
+
+ free(fontname);
+
+ return psname;
}
-
+
typedef struct {
int count;
FMFontIterator Iterator;
@@ -887,24 +879,24 @@ typedef struct {
char *last_container_path;
fond_table *last_table;
} fontenum_t;
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
fontenum_t *state = gs_alloc_bytes(mem, sizeof(fontenum_t),
- "macos font enumerator state");
- FMFontIterator *Iterator = &state->Iterator;
- OSStatus result;
-
+ "macos font enumerator state");
+ FMFontIterator *Iterator = &state->Iterator;
+ OSStatus result;
+
if (state != NULL) {
- state->count = 0;
- state->name = NULL;
- state->path = NULL;
- result = FMCreateFontIterator(NULL, NULL,
- kFMLocalIterationScope, Iterator);
- if (result != noErr) return NULL;
- memset(&state->last_container, 0, sizeof(FSSpec));
- state->last_container_path = NULL;
- state->last_table = NULL;
+ state->count = 0;
+ state->name = NULL;
+ state->path = NULL;
+ result = FMCreateFontIterator(NULL, NULL,
+ kFMLocalIterationScope, Iterator);
+ if (result != noErr) return NULL;
+ memset(&state->last_container, 0, sizeof(FSSpec));
+ state->last_container_path = NULL;
+ state->last_table = NULL;
}
return (void *)state;
@@ -913,83 +905,83 @@ void *gp_enumerate_fonts_init(gs_memory_t *mem)
void gp_enumerate_fonts_free(void *enum_state)
{
fontenum_t *state = (fontenum_t *)enum_state;
- FMFontIterator *Iterator = &state->Iterator;
-
- FMDisposeFontIterator(Iterator);
-
+ FMFontIterator *Iterator = &state->Iterator;
+
+ FMDisposeFontIterator(Iterator);
+
/* free any malloc'd stuff here */
if (state->name) free(state->name);
if (state->path) free(state->path);
if (state->last_container_path) free(state->last_container_path);
if (state->last_table) fond_table_free(state->last_table);
/* the garbage collector will take care of the struct itself */
-
+
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
fontenum_t *state = (fontenum_t *)enum_state;
- FMFontIterator *Iterator = &state->Iterator;
- FMFont Font;
- FourCharCode Format;
- FMFontFamily FontFamily;
- FMFontStyle Style;
- FSSpec FontContainer;
- char type[5];
- char fontpath[256];
- char *psname;
- fond_table *table = NULL;
- OSStatus result;
-
- result = FMGetNextFont(Iterator, &Font);
+ FMFontIterator *Iterator = &state->Iterator;
+ FMFont Font;
+ FourCharCode Format;
+ FMFontFamily FontFamily;
+ FMFontStyle Style;
+ FSSpec FontContainer;
+ char type[5];
+ char fontpath[256];
+ char *psname;
+ fond_table *table = NULL;
+ OSStatus result;
+
+ result = FMGetNextFont(Iterator, &Font);
if (result != noErr) return 0; /* no more fonts */
- result = FMGetFontFormat(Font, &Format);
- type[0] = ((char*)&Format)[0];
- type[1] = ((char*)&Format)[1];
- type[2] = ((char*)&Format)[2];
- type[3] = ((char*)&Format)[3];
- type[4] = '\0';
+ result = FMGetFontFormat(Font, &Format);
+ type[0] = ((char*)&Format)[0];
+ type[1] = ((char*)&Format)[1];
+ type[2] = ((char*)&Format)[2];
+ type[3] = ((char*)&Format)[3];
+ type[4] = '\0';
- FMGetFontFamilyInstanceFromFont(Font, &FontFamily, &Style);
+ FMGetFontFamilyInstanceFromFont(Font, &FontFamily, &Style);
if (state->name) free (state->name);
-
+
psname = makePSFontName(FontFamily, Style);
if (psname == NULL) {
- state->name = strdup("GSPlaceHolder");
- } else {
- state->name = psname;
- }
-
- result = FMGetFontContainer(Font, &FontContainer);
- if (!memcmp(&FontContainer, &state->last_container, sizeof(FSSpec))) {
- /* we have cached data on this file */
- strncpy(fontpath, state->last_container_path, 256);
- table = state->last_table;
- } else {
- convertSpecToPath(&FontContainer, fontpath, 256);
- if (!is_ttf_file(fontpath) && !is_otf_file(fontpath))
- table = parse_fond(&FontContainer);
- /* cache data on the new font file */
- memcpy(&state->last_container, &FontContainer, sizeof(FSSpec));
- if (state->last_container_path) free (state->last_container_path);
- state->last_container_path = strdup(fontpath);
- if (state->last_table) fond_table_free(state->last_table);
- state->last_table = table;
- }
-
- if (state->path) {
- free(state->path);
- state->path = NULL;
- }
+ state->name = strdup("GSPlaceHolder");
+ } else {
+ state->name = psname;
+ }
+
+ result = FMGetFontContainer(Font, &FontContainer);
+ if (!memcmp(&FontContainer, &state->last_container, sizeof(FSSpec))) {
+ /* we have cached data on this file */
+ strncpy(fontpath, state->last_container_path, 256);
+ table = state->last_table;
+ } else {
+ convertSpecToPath(&FontContainer, fontpath, 256);
+ if (!is_ttf_file(fontpath) && !is_otf_file(fontpath))
+ table = parse_fond(&FontContainer);
+ /* cache data on the new font file */
+ memcpy(&state->last_container, &FontContainer, sizeof(FSSpec));
+ if (state->last_container_path) free (state->last_container_path);
+ state->last_container_path = strdup(fontpath);
+ if (state->last_table) fond_table_free(state->last_table);
+ state->last_table = table;
+ }
+
+ if (state->path) {
+ free(state->path);
+ state->path = NULL;
+ }
if (table != NULL) {
- int i;
- for (i = 0; i < table->entries; i++) {
+ int i;
+ for (i = 0; i < table->entries; i++) {
if (table->refs[i].size == 0) { /* ignore non-scalable fonts */
if (table->refs[i].style == Style) {
int len = strlen(fontpath) + strlen("%macresource%#sfnt+") + 6;
- state->path = malloc(len);
- snprintf(state->path, len, "%%macresource%%%s#sfnt+%d",
+ state->path = malloc(len);
+ snprintf(state->path, len, "%%macresource%%%s#sfnt+%d",
fontpath, table->refs[i].id);
break;
}
@@ -1000,13 +992,13 @@ int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
state->path = strdup(fontpath);
}
if (state->path == NULL) {
- /* no matching font was found in the FOND resource table. this usually */
- /* means an LWFN file, which we don't handle yet. */
- /* we still specify these with a %macresource% path, but no res id */
- /* TODO: check file type */
- int len = strlen(fontpath) + strlen("%macresource%#POST") + 1;
- state->path = malloc(len);
- snprintf(state->path, len, "%%macresource%%%s#POST", fontpath);
+ /* no matching font was found in the FOND resource table. this usually */
+ /* means an LWFN file, which we don't handle yet. */
+ /* we still specify these with a %macresource% path, but no res id */
+ /* TODO: check file type */
+ int len = strlen(fontpath) + strlen("%macresource%#POST") + 1;
+ state->path = malloc(len);
+ snprintf(state->path, len, "%%macresource%%%s#POST", fontpath);
}
#ifdef DEBUG
dlprintf2("fontenum: returning '%s' in '%s'\n", state->name, state->path);
@@ -1014,13 +1006,13 @@ int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
*fontname = state->name;
*path = state->path;
- state->count += 1;
- return 1;
+ state->count += 1;
+ return 1;
}
-
+
/* --------- 64 bit file access ----------- */
/* fixme: Not implemented yet.
- * Currently we stub it with 32 bits access.
+ * Currently we stub it with 32 bits access.
*/
FILE *gp_fopen_64(const char *filename, const char *mode)
@@ -1051,8 +1043,8 @@ int64_t gp_ftell_64(FILE *strm)
int gp_fseek_64(FILE *strm, int64_t offset, int origin)
{
long offset1 = (long)offset;
-
+
if (offset != offset1)
- return -1;
+ return -1;
return fseek(strm, offset1, origin);
}
diff --git a/gs/base/gp_macpoll.c b/gs/base/gp_macpoll.c
index 17fa9408c..03570a76b 100644
--- a/gs/base/gp_macpoll.c
+++ b/gs/base/gp_macpoll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,38 +37,38 @@
extern HWND hwndtext;
/* ------ Process message loop ------ */
-/*
+/*
* Check messages and interrupts; return true if interrupted.
* This is called frequently - it must be quick!
*/
int gp_check_interrupts(const gs_memory_t *mem)
{
- /* static variables need to go away for thread safety */
- static unsigned long lastYieldTicks = 0;
- int iRetVal = 0;
-
- if ((TickCount() - lastYieldTicks) > 2) {
- lastYieldTicks = TickCount();
- if (pgsdll_callback) {
- /* WARNING: The use of the old gsdll interface is deprecated.
- * The caller should use the newer gsapi_set_poll.
- * If the caller needs access to "hwndtext", it should do
- * this via caller_handle which is passed to poll_fn.
- */
- /* the hwnd parameter which is submitted in gsdll_init
- * to the DLL is returned in every gsdll_poll message
- * in the count parameter
- */
- iRetVal = (*pgsdll_callback)(GSDLL_POLL, 0, (long) hwndtext);
- } else {
- if (mem == NULL) {
- /* this is not thread safe */
- mem = gs_lib_ctx_get_non_gc_memory_t();
- }
- if (mem && mem->gs_lib_ctx && mem->gs_lib_ctx->poll_fn)
- iRetVal = (*mem->gs_lib_ctx->poll_fn)(mem->gs_lib_ctx->caller_handle);
- }
- }
- return iRetVal;
+ /* static variables need to go away for thread safety */
+ static unsigned long lastYieldTicks = 0;
+ int iRetVal = 0;
+
+ if ((TickCount() - lastYieldTicks) > 2) {
+ lastYieldTicks = TickCount();
+ if (pgsdll_callback) {
+ /* WARNING: The use of the old gsdll interface is deprecated.
+ * The caller should use the newer gsapi_set_poll.
+ * If the caller needs access to "hwndtext", it should do
+ * this via caller_handle which is passed to poll_fn.
+ */
+ /* the hwnd parameter which is submitted in gsdll_init
+ * to the DLL is returned in every gsdll_poll message
+ * in the count parameter
+ */
+ iRetVal = (*pgsdll_callback)(GSDLL_POLL, 0, (long) hwndtext);
+ } else {
+ if (mem == NULL) {
+ /* this is not thread safe */
+ mem = gs_lib_ctx_get_non_gc_memory_t();
+ }
+ if (mem && mem->gs_lib_ctx && mem->gs_lib_ctx->poll_fn)
+ iRetVal = (*mem->gs_lib_ctx->poll_fn)(mem->gs_lib_ctx->caller_handle);
+ }
+ }
+ return iRetVal;
}
#endif
diff --git a/gs/base/gp_mktmp.c b/gs/base/gp_mktmp.c
index bfa182701..2051c8388 100644
--- a/gs/base/gp_mktmp.c
+++ b/gs/base/gp_mktmp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,22 +23,22 @@ mktemp(char *fname)
struct stat fst;
int len = strlen(fname);
char *end = fname + len - 6;
-
+
if (len < 6 || strcmp(end, "XXXXXX"))
- return (char *)0; /* invalid */
+ return (char *)0; /* invalid */
strcpy(end, "AA.AAA");
while (stat(fname, &fst) == 0) {
- char *inc = fname + len - 1;
+ char *inc = fname + len - 1;
- while (*inc == 'Z' || *inc == '.') {
- if (inc == end)
- return (char *)0; /* failure */
- if (*inc == 'Z')
- *inc = 'A';
- --inc;
- }
- ++*inc;
+ while (*inc == 'Z' || *inc == '.') {
+ if (inc == end)
+ return (char *)0; /* failure */
+ if (*inc == 'Z')
+ *inc = 'A';
+ --inc;
+ }
+ ++*inc;
}
return fname;
}
diff --git a/gs/base/gp_msdll.c b/gs/base/gp_msdll.c
index 1e89eafc8..f8ae8555b 100644
--- a/gs/base/gp_msdll.c
+++ b/gs/base/gp_msdll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@ DllEntryPoint(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved)
DWORD version = GetVersion();
if (((HIWORD(version) & 0x8000) != 0) && ((HIWORD(version) & 0x4000) == 0))
- is_win32s = TRUE;
+ is_win32s = TRUE;
phInstance = hInst;
return TRUE;
@@ -43,5 +43,3 @@ DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved)
{
return DllEntryPoint(hInst, fdwReason, lpReserved);
}
-
-
diff --git a/gs/base/gp_msdos.c b/gs/base/gp_msdos.c
index 812616dc6..5cabccf6f 100644
--- a/gs/base/gp_msdos.c
+++ b/gs/base/gp_msdos.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,19 +55,19 @@ gp_get_realtime(long *pdt)
#define ti_sec h.dh
#define ti_hund h.dl
idate = (long)osdate.da_year * 365 +
- ( /* intervening leap days */
- ((osdate.da_year + 1979) / 4 - 1979 / 4) +
- (1979 / 100 - (osdate.da_year + 1979) / 100) +
- ((osdate.da_year + 1979) / 400 - 1979 / 400) +
- mstart[osdate.da_mon - 1] + /* month is 1-origin */
- osdate.da_day - 1); /* day of month is 1-origin */
+ ( /* intervening leap days */
+ ((osdate.da_year + 1979) / 4 - 1979 / 4) +
+ (1979 / 100 - (osdate.da_year + 1979) / 100) +
+ ((osdate.da_year + 1979) / 400 - 1979 / 400) +
+ mstart[osdate.da_mon - 1] + /* month is 1-origin */
+ osdate.da_day - 1); /* day of month is 1-origin */
idate += (2 < osdate.da_mon
- && (osdate.da_year % 4 == 0
- && ((osdate.da_year + 1980) % 100 != 0
- || (osdate.da_year + 1980) % 400 == 0)));
+ && (osdate.da_year % 4 == 0
+ && ((osdate.da_year + 1980) % 100 != 0
+ || (osdate.da_year + 1980) % 400 == 0)));
pdt[0] =
- ((idate * 24 + ostime.ti_hour) * 60 + ostime.ti_min) * 60 +
- ostime.ti_sec;
+ ((idate * 24 + ostime.ti_hour) * 60 + ostime.ti_min) * 60 +
+ ostime.ti_sec;
pdt[1] = ostime.ti_hund * 10000000;
}
@@ -92,10 +92,10 @@ gp_file_is_console(FILE * f)
#ifdef __DLL__
if (f == NULL)
- return 1;
+ return 1;
#else
if (f == NULL)
- return 0;
+ return 0;
#endif
regs.h.ah = 0x44; /* ioctl */
regs.h.al = 0; /* get device info */
diff --git a/gs/base/gp_mshdl.c b/gs/base/gp_mshdl.c
index 11705ff7b..e706b7ec0 100644
--- a/gs/base/gp_mshdl.c
+++ b/gs/base/gp_mshdl.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,13 +27,13 @@
/* This allows an MS-Windows file handle to be passed in to
* Ghostscript as %handle%NNNNNNNN where NNNNNNNN is the hexadecimal
- * value of the handle.
- * The typical use is for another program to create a pipe,
- * pass the write end into Ghostscript using
+ * value of the handle.
+ * The typical use is for another program to create a pipe,
+ * pass the write end into Ghostscript using
* -sOutputFile="%handle%NNNNNNNN"
* so that Ghostscript printer output can be captured by the
* other program. The handle would be created with CreatePipe().
- * If Ghostscript is not a DLL, the pipe will have to be inheritable
+ * If Ghostscript is not a DLL, the pipe will have to be inheritable
* by the Ghostscript process.
*/
@@ -62,50 +62,50 @@ const gx_io_device gs_iodev_handle = {
* The OS file handle on success.
* INVALID_HANDLE_VALUE on failure.
*
- * This allows the caller to create an OS pipe and give us a
+ * This allows the caller to create an OS pipe and give us a
* handle to the write end of the pipe.
- * If we are called as an EXE, the OS file handle must be
+ * If we are called as an EXE, the OS file handle must be
* inherited by Ghostscript.
* Pipes aren't supported under Win32s.
*/
-static long
+static long
get_os_handle(const char *name)
{
ulong hfile; /* This must be as long as the longest handle. */
- /* This is correct for Win32, maybe wrong for Win64. */
+ /* This is correct for Win32, maybe wrong for Win64. */
int i, ch;
for (i = 0; (ch = name[i]) != 0; ++i)
- if (!isxdigit(ch))
- return (long)INVALID_HANDLE_VALUE;
+ if (!isxdigit(ch))
+ return (long)INVALID_HANDLE_VALUE;
if (sscanf(name, "%lx", &hfile) != 1)
- return (long)INVALID_HANDLE_VALUE;
- return (long)hfile;
+ return (long)INVALID_HANDLE_VALUE;
+ return (long)hfile;
}
static int
mswin_handle_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
int fd;
long hfile; /* Correct for Win32, may be wrong for Win64 */
errno = 0;
if ((hfile = get_os_handle(fname)) == (long)INVALID_HANDLE_VALUE)
- return_error(gs_fopen_errno_to_code(EBADF));
+ return_error(gs_fopen_errno_to_code(EBADF));
/* associate a C file handle with an OS file handle */
fd = _open_osfhandle((long)hfile, 0);
if (fd == -1)
- return_error(gs_fopen_errno_to_code(EBADF));
+ return_error(gs_fopen_errno_to_code(EBADF));
/* associate a C file stream with C file handle */
*pfile = fdopen(fd, (char *)access);
if (*pfile == NULL)
- return_error(gs_fopen_errno_to_code(errno));
+ return_error(gs_fopen_errno_to_code(errno));
if (rfname != NULL)
- strcpy(rfname, fname);
+ strcpy(rfname, fname);
return 0;
}
diff --git a/gs/base/gp_mslib.c b/gs/base/gp_mslib.c
index fdbf578b4..4ea8ebcc0 100644
--- a/gs/base/gp_mslib.c
+++ b/gs/base/gp_mslib.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
*/
/* ------ Process message loop ------ */
-/*
+/*
* Check messages and interrupts; return true if interrupted.
* This is called frequently - it must be quick!
*/
diff --git a/gs/base/gp_mspol.c b/gs/base/gp_mspol.c
index 591080701..df278941d 100644
--- a/gs/base/gp_mspol.c
+++ b/gs/base/gp_mspol.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@
#include "gpcheck.h"
/* ------ Process message loop ------ */
-/*
+/*
* Check messages and interrupts; return true if interrupted.
* This is called frequently - it must be quick!
*/
@@ -31,11 +31,11 @@ int
gp_check_interrupts(const gs_memory_t *mem)
{
if(mem == NULL) {
- /* MAJOR HACK will NOT work in multithreaded environment */
- mem = gs_lib_ctx_get_non_gc_memory_t();
+ /* MAJOR HACK will NOT work in multithreaded environment */
+ mem = gs_lib_ctx_get_non_gc_memory_t();
}
if (mem && mem->gs_lib_ctx && mem->gs_lib_ctx->poll_fn)
- return (*mem->gs_lib_ctx->poll_fn)(mem->gs_lib_ctx->caller_handle);
+ return (*mem->gs_lib_ctx->poll_fn)(mem->gs_lib_ctx->caller_handle);
return 0;
}
#endif
diff --git a/gs/base/gp_msprn.c b/gs/base/gp_msprn.c
index 65b61f49e..0ec5c7bda 100644
--- a/gs/base/gp_msprn.c
+++ b/gs/base/gp_msprn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@
/* The MS-Windows printer IODevice */
/*
- * This allows a MS-Windows printer to be specified as an
+ * This allows a MS-Windows printer to be specified as an
* output using
* -sOutputFile="%printer%HP DeskJet 500"
*
@@ -40,9 +40,9 @@
* -sOutputFile="%printer%\\server\printer name"
*
* If you don't supply a printer name you will get
- * Error: /undefinedfilename in --.outputpage--
+ * Error: /undefinedfilename in --.outputpage--
* If the printer name is invalid you will get
- * Error: /invalidfileaccess in --.outputpage--
+ * Error: /invalidfileaccess in --.outputpage--
*
* This is implemented by returning the file pointer
* for the write end of a pipe, and starting a thread
@@ -71,7 +71,6 @@ typedef struct tid_s {
unsigned long tid;
} tid_t;
-
void mswin_printer_thread(void *arg)
{
int fd = (int)arg;
@@ -86,48 +85,48 @@ void mswin_printer_thread(void *arg)
* First gp_file_name_sizeof bytes are name of the printer.
*/
if (read(fd, pname, sizeof(pname)) != sizeof(pname)) {
- /* Didn't get the printer name */
- close(fd);
- return;
+ /* Didn't get the printer name */
+ close(fd);
+ return;
}
while ( (count = read(fd, data, sizeof(data))) > 0 ) {
- if (hprinter == INVALID_HANDLE_VALUE) {
- if (!OpenPrinter(pname, &hprinter, NULL)) {
- close(fd);
- return;
- }
- di.pDocName = (LPTSTR)gs_product;
- di.pOutputFile = NULL;
- di.pDatatype = "RAW";
- if (!StartDocPrinter(hprinter, 1, (LPBYTE) & di)) {
- AbortPrinter(hprinter);
- close(fd);
- return;
- }
- }
- if (!StartPagePrinter(hprinter)) {
- AbortPrinter(hprinter);
- close(fd);
- return;
- }
- if (!WritePrinter(hprinter, (LPVOID) data, count, &written)) {
- AbortPrinter(hprinter);
- close(fd);
- return;
- }
+ if (hprinter == INVALID_HANDLE_VALUE) {
+ if (!OpenPrinter(pname, &hprinter, NULL)) {
+ close(fd);
+ return;
+ }
+ di.pDocName = (LPTSTR)gs_product;
+ di.pOutputFile = NULL;
+ di.pDatatype = "RAW";
+ if (!StartDocPrinter(hprinter, 1, (LPBYTE) & di)) {
+ AbortPrinter(hprinter);
+ close(fd);
+ return;
+ }
+ }
+ if (!StartPagePrinter(hprinter)) {
+ AbortPrinter(hprinter);
+ close(fd);
+ return;
+ }
+ if (!WritePrinter(hprinter, (LPVOID) data, count, &written)) {
+ AbortPrinter(hprinter);
+ close(fd);
+ return;
+ }
}
if (hprinter != INVALID_HANDLE_VALUE) {
- if (count == 0) {
- /* EOF */
- EndPagePrinter(hprinter);
- EndDocPrinter(hprinter);
- ClosePrinter(hprinter);
- }
- else {
- /* Error */
- AbortPrinter(hprinter);
- }
+ if (count == 0) {
+ /* EOF */
+ EndPagePrinter(hprinter);
+ EndDocPrinter(hprinter);
+ ClosePrinter(hprinter);
+ }
+ else {
+ /* Error */
+ AbortPrinter(hprinter);
+ }
}
close(fd);
}
@@ -144,10 +143,9 @@ mswin_printer_init(gx_io_device * iodev, gs_memory_t * mem)
return 0;
}
-
static int
mswin_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
DWORD version = GetVersion();
HANDLE hprinter;
@@ -158,47 +156,47 @@ mswin_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
unsigned long *ptid = &((tid_t *)(iodev->state))->tid;
/* Win32s supports neither pipes nor Win32 printers. */
- if (((HIWORD(version) & 0x8000) != 0) &&
- ((HIWORD(version) & 0x4000) == 0))
- return_error(gs_error_invalidfileaccess);
+ if (((HIWORD(version) & 0x8000) != 0) &&
+ ((HIWORD(version) & 0x4000) == 0))
+ return_error(gs_error_invalidfileaccess);
/* Make sure that printer exists. */
if (!OpenPrinter((LPTSTR)fname, &hprinter, NULL))
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
ClosePrinter(hprinter);
/* Create a pipe to connect a FILE pointer to a Windows printer. */
if (_pipe(pipeh, 4096, _O_BINARY) != 0)
- return_error(gs_fopen_errno_to_code(errno));
+ return_error(gs_fopen_errno_to_code(errno));
*pfile = fdopen(pipeh[1], (char *)access);
if (*pfile == NULL) {
- close(pipeh[0]);
- close(pipeh[1]);
- return_error(gs_fopen_errno_to_code(errno));
+ close(pipeh[0]);
+ close(pipeh[1]);
+ return_error(gs_fopen_errno_to_code(errno));
}
/* start a thread to read the pipe */
tid = _beginthread(&mswin_printer_thread, 32768, (void *)(pipeh[0]));
if (tid == -1) {
- fclose(*pfile);
- close(pipeh[0]);
- return_error(gs_error_invalidfileaccess);
+ fclose(*pfile);
+ close(pipeh[0]);
+ return_error(gs_error_invalidfileaccess);
}
/* Duplicate thread handle so we can wait on it
* even if original handle is closed by CRTL
* when the thread finishes.
*/
if (!DuplicateHandle(GetCurrentProcess(), (HANDLE)tid,
- GetCurrentProcess(), &hthread,
- 0, FALSE, DUPLICATE_SAME_ACCESS)) {
- fclose(*pfile);
- return_error(gs_error_invalidfileaccess);
+ GetCurrentProcess(), &hthread,
+ 0, FALSE, DUPLICATE_SAME_ACCESS)) {
+ fclose(*pfile);
+ return_error(gs_error_invalidfileaccess);
}
*ptid = (unsigned long)hthread;
/* Give the name of the printer to the thread by writing
- * it to the pipe. This is avoids elaborate thread
+ * it to the pipe. This is avoids elaborate thread
* synchronisation code.
*/
strncpy(pname, fname, sizeof(pname));
@@ -214,13 +212,11 @@ mswin_printer_fclose(gx_io_device * iodev, FILE * file)
HANDLE hthread;
fclose(file);
if (*ptid != -1) {
- /* Wait until the print thread finishes before continuing */
- hthread = (HANDLE)*ptid;
- WaitForSingleObject(hthread, 60000);
- CloseHandle(hthread);
- *ptid = -1;
+ /* Wait until the print thread finishes before continuing */
+ hthread = (HANDLE)*ptid;
+ WaitForSingleObject(hthread, 60000);
+ CloseHandle(hthread);
+ *ptid = -1;
}
return 0;
}
-
-
diff --git a/gs/base/gp_mswin.c b/gs/base/gp_mswin.c
index a9c3d3ace..531d0cdbe 100644
--- a/gs/base/gp_mswin.c
+++ b/gs/base/gp_mswin.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,7 +67,6 @@ BOOL is_win32s = FALSE;
const LPSTR szAppName = "Ghostscript";
static int is_printer(const char *name);
-
/* ====== Generic platform procedures ====== */
/* ------ Initialization/termination (from gp_itbc.c) ------ */
@@ -122,19 +121,19 @@ gp_open_printer(const gs_memory_t *mem,
int binary_mode)
{
if (is_printer(fname)) {
- FILE *pfile;
+ FILE *pfile;
- /* Open a scratch file, which we will send to the */
- /* actual printer in gp_close_printer. */
- pfile = gp_open_scratch_file(mem, gp_scratch_file_name_prefix,
- win_prntmp, "wb");
- return pfile;
+ /* Open a scratch file, which we will send to the */
+ /* actual printer in gp_close_printer. */
+ pfile = gp_open_scratch_file(mem, gp_scratch_file_name_prefix,
+ win_prntmp, "wb");
+ return pfile;
} else if (fname[0] == '|') /* pipe */
- return popen(fname + 1, (binary_mode ? "wb" : "w"));
+ return popen(fname + 1, (binary_mode ? "wb" : "w"));
else if (strcmp(fname, "LPT1:") == 0)
- return NULL; /* not supported, use %printer%name instead */
+ return NULL; /* not supported, use %printer%name instead */
else
- return fopen(fname, (binary_mode ? "wb" : "w"));
+ return fopen(fname, (binary_mode ? "wb" : "w"));
}
/* Close the connection to the printer. */
@@ -143,13 +142,12 @@ gp_close_printer(const gs_memory_t *mem, FILE * pfile, const char *fname)
{
fclose(pfile);
if (!is_printer(fname))
- return; /* a file, not a printer */
+ return; /* a file, not a printer */
gp_printfile(win_prntmp, fname);
unlink(win_prntmp);
}
-
/* Dialog box to select printer port */
DLGRETURN CALLBACK
SpoolDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -157,27 +155,27 @@ SpoolDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LPSTR entry;
switch (message) {
- case WM_INITDIALOG:
- entry = (LPSTR) lParam;
- while (*entry) {
- SendDlgItemMessage(hDlg, SPOOL_PORT, LB_ADDSTRING, 0, (LPARAM) entry);
- entry += lstrlen(entry) + 1;
- }
- SendDlgItemMessage(hDlg, SPOOL_PORT, LB_SETCURSEL, 0, (LPARAM) 0);
- return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case SPOOL_PORT:
- if (HIWORD(wParam) == LBN_DBLCLK)
- PostMessage(hDlg, WM_COMMAND, IDOK, 0L);
- return FALSE;
- case IDOK:
- EndDialog(hDlg, 1 + (int)SendDlgItemMessage(hDlg, SPOOL_PORT, LB_GETCURSEL, 0, 0L));
- return TRUE;
- case IDCANCEL:
- EndDialog(hDlg, 0);
- return TRUE;
- }
+ case WM_INITDIALOG:
+ entry = (LPSTR) lParam;
+ while (*entry) {
+ SendDlgItemMessage(hDlg, SPOOL_PORT, LB_ADDSTRING, 0, (LPARAM) entry);
+ entry += lstrlen(entry) + 1;
+ }
+ SendDlgItemMessage(hDlg, SPOOL_PORT, LB_SETCURSEL, 0, (LPARAM) 0);
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case SPOOL_PORT:
+ if (HIWORD(wParam) == LBN_DBLCLK)
+ PostMessage(hDlg, WM_COMMAND, IDOK, 0L);
+ return FALSE;
+ case IDOK:
+ EndDialog(hDlg, 1 + (int)SendDlgItemMessage(hDlg, SPOOL_PORT, LB_GETCURSEL, 0, 0L));
+ return TRUE;
+ case IDCANCEL:
+ EndDialog(hDlg, 0);
+ return TRUE;
+ }
}
return FALSE;
}
@@ -190,34 +188,32 @@ is_spool(const char *queue)
int i;
for (i = 0; i < 7; i++) {
- if (prefix[i] == '\\') {
- if ((*queue != '\\') && (*queue != '/'))
- return FALSE;
- } else if (tolower(*queue) != prefix[i])
- return FALSE;
- queue++;
+ if (prefix[i] == '\\') {
+ if ((*queue != '\\') && (*queue != '/'))
+ return FALSE;
+ } else if (tolower(*queue) != prefix[i])
+ return FALSE;
+ queue++;
}
if (*queue && (*queue != '\\') && (*queue != '/'))
- return FALSE;
+ return FALSE;
return TRUE;
}
-
static int
is_printer(const char *name)
{
/* is printer if no name given */
if (strlen(name) == 0)
- return TRUE;
+ return TRUE;
/* is printer if name prefixed by \\spool\ */
if (is_spool(name))
- return TRUE;
+ return TRUE;
return FALSE;
}
-
/******************************************************************/
/* Print File to port or queue */
/* port==NULL means prompt for port or queue with dialog box */
@@ -243,22 +239,22 @@ static int
gp_printfile(const char *filename, const char *pmport)
{
if (strlen(pmport) == 0) { /* get default printer */
- char buf[256];
- char *p;
-
- /* WinNT stores default printer in registry and win.ini */
- /* Win95 stores default printer in win.ini */
- GetProfileString("windows", "device", "", buf, sizeof(buf));
- if ((p = strchr(buf, ',')) != NULL)
- *p = '\0';
- return gp_printfile_win32(filename, buf);
+ char buf[256];
+ char *p;
+
+ /* WinNT stores default printer in registry and win.ini */
+ /* Win95 stores default printer in win.ini */
+ GetProfileString("windows", "device", "", buf, sizeof(buf));
+ if ((p = strchr(buf, ',')) != NULL)
+ *p = '\0';
+ return gp_printfile_win32(filename, buf);
} else if (is_spool(pmport)) {
- if (strlen(pmport) >= 8)
- return gp_printfile_win32(filename, (char *)pmport + 8);
- else
- return gp_printfile_win32(filename, (char *)NULL);
+ if (strlen(pmport) >= 8)
+ return gp_printfile_win32(filename, (char *)pmport + 8);
+ else
+ return gp_printfile_win32(filename, (char *)NULL);
} else
- return gs_error_undefinedfilename;
+ return gs_error_undefinedfilename;
}
#define PRINT_BUF_SIZE 16384u
@@ -277,36 +273,36 @@ get_queues(void)
/* enumerate all available printers */
EnumPrinters(PRINTER_ENUM_CONNECTIONS | PRINTER_ENUM_LOCAL, NULL, 1, NULL, 0, &needed, &count);
if (needed == 0) {
- /* no printers */
- enumbuffer = malloc(4);
- if (enumbuffer == (char *)NULL)
- return NULL;
- memset(enumbuffer, 0, 4);
- return enumbuffer;
+ /* no printers */
+ enumbuffer = malloc(4);
+ if (enumbuffer == (char *)NULL)
+ return NULL;
+ memset(enumbuffer, 0, 4);
+ return enumbuffer;
}
enumbuffer = malloc(needed);
if (enumbuffer == (char *)NULL)
- return NULL;
+ return NULL;
if (!EnumPrinters(PRINTER_ENUM_CONNECTIONS | PRINTER_ENUM_LOCAL, NULL, 1, (LPBYTE) enumbuffer, needed, &needed, &count)) {
- char buf[256];
+ char buf[256];
- free(enumbuffer);
- sprintf(buf, "EnumPrinters() failed, error code = %d", GetLastError());
- MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
- return NULL;
+ free(enumbuffer);
+ sprintf(buf, "EnumPrinters() failed, error code = %d", GetLastError());
+ MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
+ return NULL;
}
prinfo = (PRINTER_INFO_1 *) enumbuffer;
if ((buffer = malloc(PORT_BUF_SIZE)) == (char *)NULL) {
- free(enumbuffer);
- return NULL;
+ free(enumbuffer);
+ return NULL;
}
/* copy printer names to single buffer */
p = buffer;
for (i = 0; i < count; i++) {
- if (strlen(prinfo[i].pName) + 1 < (PORT_BUF_SIZE - (p - buffer))) {
- strcpy(p, prinfo[i].pName);
- p += strlen(p) + 1;
- }
+ if (strlen(prinfo[i].pName) + 1 < (PORT_BUF_SIZE - (p - buffer))) {
+ strcpy(p, prinfo[i].pName);
+ p += strlen(p) + 1;
+ }
}
*p = '\0'; /* double null at end */
free(enumbuffer);
@@ -325,25 +321,25 @@ get_queuename(char *portname, const char *queue)
buffer = get_queues();
if (buffer == NULL)
- return FALSE;
+ return FALSE;
if ((queue == (char *)NULL) || (strlen(queue) == 0)) {
/* PROMPTING FOR A QUEUE IS CURRENTLY BROKEN */
- /* select a queue */
- iport = DialogBoxParam(phInstance, "QueueDlgBox", (HWND) NULL, SpoolDlgProc, (LPARAM) buffer);
- if (!iport) {
- free(buffer);
- return FALSE;
- }
- p = buffer;
- for (i = 1; i < iport && strlen(p) != 0; i++)
- p += lstrlen(p) + 1;
- /* prepend \\spool\ which is used by Ghostscript to distinguish */
- /* real files from queues */
- strcpy(portname, "\\\\spool\\");
- strcat(portname, p);
+ /* select a queue */
+ iport = DialogBoxParam(phInstance, "QueueDlgBox", (HWND) NULL, SpoolDlgProc, (LPARAM) buffer);
+ if (!iport) {
+ free(buffer);
+ return FALSE;
+ }
+ p = buffer;
+ for (i = 1; i < iport && strlen(p) != 0; i++)
+ p += lstrlen(p) + 1;
+ /* prepend \\spool\ which is used by Ghostscript to distinguish */
+ /* real files from queues */
+ strcpy(portname, "\\\\spool\\");
+ strcat(portname, p);
} else {
- strcpy(portname, "\\\\spool\\");
- strcat(portname, queue);
+ strcpy(portname, "\\\\spool\\");
+ strcat(portname, queue);
}
free(buffer);
@@ -363,24 +359,24 @@ gp_printfile_win32(const char *filename, char *port)
DWORD written;
if (!get_queuename(portname, port))
- return FALSE;
+ return FALSE;
port = portname + 8; /* skip over \\spool\ */
if ((buffer = malloc(PRINT_BUF_SIZE)) == (char *)NULL)
- return FALSE;
+ return FALSE;
if ((f = fopen(filename, "rb")) == (FILE *) NULL) {
- free(buffer);
- return FALSE;
+ free(buffer);
+ return FALSE;
}
/* open a printer */
if (!OpenPrinter(port, &printer, NULL)) {
- char buf[256];
+ char buf[256];
- sprintf(buf, "OpenPrinter() failed for \042%s\042, error code = %d", port, GetLastError());
- MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
- free(buffer);
- return FALSE;
+ sprintf(buf, "OpenPrinter() failed for \042%s\042, error code = %d", port, GetLastError());
+ MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
+ free(buffer);
+ return FALSE;
}
/* from here until ClosePrinter, should AbortPrinter on error */
@@ -388,50 +384,47 @@ gp_printfile_win32(const char *filename, char *port)
di.pOutputFile = NULL;
di.pDatatype = "RAW"; /* for available types see EnumPrintProcessorDatatypes */
if (!StartDocPrinter(printer, 1, (LPBYTE) & di)) {
- char buf[256];
+ char buf[256];
- sprintf(buf, "StartDocPrinter() failed, error code = %d", GetLastError());
- MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
- AbortPrinter(printer);
- free(buffer);
- return FALSE;
+ sprintf(buf, "StartDocPrinter() failed, error code = %d", GetLastError());
+ MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
+ AbortPrinter(printer);
+ free(buffer);
+ return FALSE;
}
/* copy file to printer */
while ((count = fread(buffer, 1, PRINT_BUF_SIZE, f)) != 0) {
- if (!WritePrinter(printer, (LPVOID) buffer, count, &written)) {
- free(buffer);
- fclose(f);
- AbortPrinter(printer);
- return FALSE;
- }
+ if (!WritePrinter(printer, (LPVOID) buffer, count, &written)) {
+ free(buffer);
+ fclose(f);
+ AbortPrinter(printer);
+ return FALSE;
+ }
}
fclose(f);
free(buffer);
if (!EndDocPrinter(printer)) {
- char buf[256];
+ char buf[256];
- sprintf(buf, "EndDocPrinter() failed, error code = %d", GetLastError());
- MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
- AbortPrinter(printer);
- return FALSE;
+ sprintf(buf, "EndDocPrinter() failed, error code = %d", GetLastError());
+ MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
+ AbortPrinter(printer);
+ return FALSE;
}
if (!ClosePrinter(printer)) {
- char buf[256];
+ char buf[256];
- sprintf(buf, "ClosePrinter() failed, error code = %d", GetLastError());
- MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
- return FALSE;
+ sprintf(buf, "ClosePrinter() failed, error code = %d", GetLastError());
+ MessageBox((HWND) NULL, buf, szAppName, MB_OK | MB_ICONSTOP);
+ return FALSE;
}
return TRUE;
}
-
-
-
/******************************************************************/
/* MS Windows has popen and pclose in stdio.h, but under different names.
- * Unfortunately MSVC5 and 6 have a broken implementation of _popen,
+ * Unfortunately MSVC5 and 6 have a broken implementation of _popen,
* so we use own. Our implementation only supports mode "wb".
*/
FILE *mswin_popen(const char *cmd, const char *mode)
@@ -450,38 +443,38 @@ FILE *mswin_popen(const char *cmd, const char *mode)
FILE *pipe = NULL;
if (strcmp(mode, "wb") != 0)
- return NULL;
+ return NULL;
/* Set the bInheritHandle flag so pipe handles are inherited. */
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
- /* Create anonymous inheritable pipes for STDIN for child.
- * First create a noninheritable duplicate handle of our end of
+ /* Create anonymous inheritable pipes for STDIN for child.
+ * First create a noninheritable duplicate handle of our end of
* the pipe, then close the inheritable handle.
*/
if (handle == 0)
if (!CreatePipe(&hChildStdinRd, &hPipeTemp, &saAttr, 0))
- handle = -1;
+ handle = -1;
if (handle == 0) {
- if (!DuplicateHandle(hProcess, hPipeTemp,
- hProcess, &hChildStdinWr, 0, FALSE /* not inherited */,
- DUPLICATE_SAME_ACCESS))
- handle = -1;
+ if (!DuplicateHandle(hProcess, hPipeTemp,
+ hProcess, &hChildStdinWr, 0, FALSE /* not inherited */,
+ DUPLICATE_SAME_ACCESS))
+ handle = -1;
CloseHandle(hPipeTemp);
}
/* Create inheritable duplicate handles for our stdout/err */
if (handle == 0)
- if (!DuplicateHandle(hProcess, GetStdHandle(STD_OUTPUT_HANDLE),
- hProcess, &hChildStdoutWr, 0, TRUE /* inherited */,
- DUPLICATE_SAME_ACCESS))
- handle = -1;
+ if (!DuplicateHandle(hProcess, GetStdHandle(STD_OUTPUT_HANDLE),
+ hProcess, &hChildStdoutWr, 0, TRUE /* inherited */,
+ DUPLICATE_SAME_ACCESS))
+ handle = -1;
if (handle == 0)
if (!DuplicateHandle(hProcess, GetStdHandle(STD_ERROR_HANDLE),
- hProcess, &hChildStderrWr, 0, TRUE /* inherited */,
- DUPLICATE_SAME_ACCESS))
- handle = -1;
+ hProcess, &hChildStderrWr, 0, TRUE /* inherited */,
+ DUPLICATE_SAME_ACCESS))
+ handle = -1;
/* Set up members of STARTUPINFO structure. */
memset(&siStartInfo, 0, sizeof(STARTUPINFO));
@@ -492,55 +485,54 @@ FILE *mswin_popen(const char *cmd, const char *mode)
siStartInfo.hStdError = hChildStderrWr;
if (handle == 0) {
- command = (char *)malloc(strlen(cmd)+1);
- if (command)
- strcpy(command, cmd);
- else
- handle = -1;
+ command = (char *)malloc(strlen(cmd)+1);
+ if (command)
+ strcpy(command, cmd);
+ else
+ handle = -1;
}
if (handle == 0)
- if (!CreateProcess(NULL,
- command, /* command line */
- NULL, /* process security attributes */
- NULL, /* primary thread security attributes */
- TRUE, /* handles are inherited */
- 0, /* creation flags */
- NULL, /* environment */
- NULL, /* use parent's current directory */
- &siStartInfo, /* STARTUPINFO pointer */
- &piProcInfo)) /* receives PROCESS_INFORMATION */
- {
- handle = -1;
- }
- else {
- CloseHandle(piProcInfo.hProcess);
- CloseHandle(piProcInfo.hThread);
- handle = _open_osfhandle((long)hChildStdinWr, 0);
- }
+ if (!CreateProcess(NULL,
+ command, /* command line */
+ NULL, /* process security attributes */
+ NULL, /* primary thread security attributes */
+ TRUE, /* handles are inherited */
+ 0, /* creation flags */
+ NULL, /* environment */
+ NULL, /* use parent's current directory */
+ &siStartInfo, /* STARTUPINFO pointer */
+ &piProcInfo)) /* receives PROCESS_INFORMATION */
+ {
+ handle = -1;
+ }
+ else {
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(piProcInfo.hThread);
+ handle = _open_osfhandle((long)hChildStdinWr, 0);
+ }
if (hChildStdinRd != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdinRd); /* close our copy */
+ CloseHandle(hChildStdinRd); /* close our copy */
if (hChildStdoutWr != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdoutWr); /* close our copy */
+ CloseHandle(hChildStdoutWr); /* close our copy */
if (hChildStderrWr != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStderrWr); /* close our copy */
+ CloseHandle(hChildStderrWr); /* close our copy */
if (command)
- free(command);
+ free(command);
if (handle < 0) {
- if (hChildStdinWr != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdinWr);
+ if (hChildStdinWr != INVALID_HANDLE_VALUE)
+ CloseHandle(hChildStdinWr);
}
else {
- pipe = _fdopen(handle, "wb");
- if (pipe == NULL)
- _close(handle);
+ pipe = _fdopen(handle, "wb");
+ if (pipe == NULL)
+ _close(handle);
}
return pipe;
}
-
/* ------ File naming and accessing ------ */
/* Create and open a scratch file with a given name prefix. */
@@ -561,77 +553,77 @@ gp_open_scratch_file(const gs_memory_t *mem,
memset(fname, 0, gp_file_name_sizeof);
if (!gp_file_name_is_absolute(prefix, strlen(prefix))) {
- int plen = sizeof(sTempDir);
+ int plen = sizeof(sTempDir);
- if (gp_gettmpdir(sTempDir, &plen) != 0)
- l = GetTempPath(sizeof(sTempDir), sTempDir);
- else
- l = strlen(sTempDir);
+ if (gp_gettmpdir(sTempDir, &plen) != 0)
+ l = GetTempPath(sizeof(sTempDir), sTempDir);
+ else
+ l = strlen(sTempDir);
} else {
- strncpy(sTempDir, prefix, sizeof(sTempDir));
- prefix = "";
- l = strlen(sTempDir);
+ strncpy(sTempDir, prefix, sizeof(sTempDir));
+ prefix = "";
+ l = strlen(sTempDir);
}
/* Fix the trailing terminator so GetTempFileName doesn't get confused */
if (sTempDir[l-1] == '/')
- sTempDir[l-1] = '\\'; /* What Windoze prefers */
+ sTempDir[l-1] = '\\'; /* What Windoze prefers */
if (l <= sizeof(sTempDir)) {
- n = GetTempFileName(sTempDir, prefix, 0, sTempFileName);
- if (n == 0) {
- /* If 'prefix' is not a directory, it is a path prefix. */
- int l = strlen(sTempDir), i;
-
- for (i = l - 1; i > 0; i--) {
- uint slen = gs_file_name_check_separator(sTempDir + i, l, sTempDir + l);
-
- if (slen > 0) {
- sTempDir[i] = 0;
- i += slen;
- break;
- }
- }
- if (i > 0)
- n = GetTempFileName(sTempDir, sTempDir + i, 0, sTempFileName);
- }
- if (n != 0) {
- hfile = CreateFile(sTempFileName,
- GENERIC_READ | GENERIC_WRITE | DELETE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL /* | FILE_FLAG_DELETE_ON_CLOSE */,
- NULL);
- /*
- * Can't apply FILE_FLAG_DELETE_ON_CLOSE due to
- * the logics of clist_fclose. Also note that
- * gdev_prn_render_pages requires multiple temporary files
- * to exist simultaneousely, so that keeping all them opened
- * may exceed available CRTL file handles.
- */
- }
+ n = GetTempFileName(sTempDir, prefix, 0, sTempFileName);
+ if (n == 0) {
+ /* If 'prefix' is not a directory, it is a path prefix. */
+ int l = strlen(sTempDir), i;
+
+ for (i = l - 1; i > 0; i--) {
+ uint slen = gs_file_name_check_separator(sTempDir + i, l, sTempDir + l);
+
+ if (slen > 0) {
+ sTempDir[i] = 0;
+ i += slen;
+ break;
+ }
+ }
+ if (i > 0)
+ n = GetTempFileName(sTempDir, sTempDir + i, 0, sTempFileName);
+ }
+ if (n != 0) {
+ hfile = CreateFile(sTempFileName,
+ GENERIC_READ | GENERIC_WRITE | DELETE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL /* | FILE_FLAG_DELETE_ON_CLOSE */,
+ NULL);
+ /*
+ * Can't apply FILE_FLAG_DELETE_ON_CLOSE due to
+ * the logics of clist_fclose. Also note that
+ * gdev_prn_render_pages requires multiple temporary files
+ * to exist simultaneousely, so that keeping all them opened
+ * may exceed available CRTL file handles.
+ */
+ }
}
if (hfile != INVALID_HANDLE_VALUE) {
- /* Associate a C file handle with an OS file handle. */
- fd = _open_osfhandle((long)hfile, 0);
- if (fd == -1)
- CloseHandle(hfile);
- else {
- /* Associate a C file stream with C file handle. */
- f = fdopen(fd, mode);
- if (f == NULL)
- _close(fd);
- }
+ /* Associate a C file handle with an OS file handle. */
+ fd = _open_osfhandle((long)hfile, 0);
+ if (fd == -1)
+ CloseHandle(hfile);
+ else {
+ /* Associate a C file stream with C file handle. */
+ f = fdopen(fd, mode);
+ if (f == NULL)
+ _close(fd);
+ }
}
if (f != NULL) {
- if ((strlen(sTempFileName) < gp_file_name_sizeof))
- strncpy(fname, sTempFileName, gp_file_name_sizeof - 1);
- else {
- /* The file name is too long. */
- fclose(f);
- f = NULL;
- }
+ if ((strlen(sTempFileName) < gp_file_name_sizeof))
+ strncpy(fname, sTempFileName, gp_file_name_sizeof - 1);
+ else {
+ /* The file name is too long. */
+ fclose(f);
+ f = NULL;
+ }
}
if (f == NULL)
- emprintf1(mem, "**** Could not open temporary file '%s'\n", fname);
+ emprintf1(mem, "**** Could not open temporary file '%s'\n", fname);
return f;
}
@@ -643,25 +635,25 @@ gp_fopen(const char *fname, const char *mode)
}
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file.
*/
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
return NULL;
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
return 0;
}
-
+
void gp_enumerate_fonts_free(void *enum_state)
{
-}
+}
/* --------- 64 bit file access ----------- */
/* MSVC versions before 8 doen't provide big files.
@@ -715,9 +707,9 @@ int gp_fseek_64(FILE *strm, int64_t offset, int origin)
return fseek(strm, offset, origin);
#elif _MSC_VER < 1200
long offset1 = (long)offset;
-
+
if (offset != offset1)
- return -1;
+ return -1;
return fseek(strm, offset1, origin);
#else
return _fseeki64(strm, offset, origin);
@@ -732,14 +724,14 @@ int gp_fseek_64(FILE *strm, int64_t offset, int origin)
int snprintf(char *buffer, size_t count, const char *format, ...)
{
if (count > 0) {
- va_list args;
- int n;
-
- va_start(args, format);
- n = _vsnprintf(buffer, count, format, args);
- buffer[count - 1] = 0;
- va_end(args);
- return n;
+ va_list args;
+ int n;
+
+ va_start(args, format);
+ n = _vsnprintf(buffer, count, format, args);
+ buffer[count - 1] = 0;
+ va_end(args);
+ return n;
} else
- return 0;
+ return 0;
}
diff --git a/gs/base/gp_mswin.h b/gs/base/gp_mswin.h
index 566da9444..aef738914 100644
--- a/gs/base/gp_mswin.h
+++ b/gs/base/gp_mswin.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,7 +17,6 @@
#ifndef gp_mswin_INCLUDED
# define gp_mswin_INCLUDED
-
#define GSTEXT_ICON 50
#define GSIMAGE_ICON 51
#define SPOOL_PORT 100
@@ -38,7 +37,7 @@
#define _export
#endif
-/*
+/*
extern HWND hwndtext;
extern HWND hDlgModeless;
*/
diff --git a/gs/base/gp_nsync.c b/gs/base/gp_nsync.c
index 805388456..e16c4744c 100644
--- a/gs/base/gp_nsync.c
+++ b/gs/base/gp_nsync.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ int
gp_semaphore_open(gp_semaphore * sema)
{
if (sema)
- *(int *)sema = 0;
+ *(int *)sema = 0;
return 0;
}
@@ -46,7 +46,7 @@ int
gp_semaphore_wait(gp_semaphore * sema)
{
if (*(int *)sema == 0)
- return_error(gs_error_unknownerror); /* no real waiting */
+ return_error(gs_error_unknownerror); /* no real waiting */
--(*(int *)sema);
return 0;
}
@@ -70,7 +70,7 @@ int
gp_monitor_open(gp_monitor * mon)
{
if (mon)
- mon->dummy_ = 0;
+ mon->dummy_ = 0;
return 0;
}
@@ -84,7 +84,7 @@ int
gp_monitor_enter(gp_monitor * mon)
{
if (mon->dummy_ != 0)
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
mon->dummy_ = mon;
return 0;
}
@@ -93,7 +93,7 @@ int
gp_monitor_leave(gp_monitor * mon)
{
if (mon->dummy_ != mon)
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
mon->dummy_ = 0;
return 0;
}
diff --git a/gs/base/gp_ntfs.c b/gs/base/gp_ntfs.c
index 186d1a14b..70be4350e 100644
--- a/gs/base/gp_ntfs.c
+++ b/gs/base/gp_ntfs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -93,7 +93,7 @@ struct file_enum_s {
gs_memory_t *memory;
};
gs_private_st_ptrs1(st_file_enum, struct file_enum_s, "file_enum",
- file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
+ file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
/* Initialize an enumeration. Note that * and ? in a directory */
/* don't work with the OS call currently used. The '\' escape */
@@ -108,28 +108,28 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
int i, j;
if (pfen == 0)
- return 0;
+ return 0;
/* pattern could be allocated as a string, */
/* but it's simpler for GC and freeing to allocate it as bytes. */
pattern = (char *)gs_alloc_bytes(mem, pat_size,
- "gp_enumerate_files(pattern)");
+ "gp_enumerate_files(pattern)");
if (pattern == 0)
- return 0;
+ return 0;
/* translate the template into a pattern discarding the escape */
/* char '\' (not needed by the OS Find...File logic). Note that */
/* a final '\' in the string is also discarded. */
for (i = 0, j=0; i < patlen; i++) {
- if (pat[i] == '\\') {
- i++;
- if (i == patlen)
- break; /* '\' at end ignored */
- }
- pattern[j++]=pat[i];
+ if (pat[i] == '\\') {
+ i++;
+ if (i == patlen)
+ break; /* '\' at end ignored */
+ }
+ pattern[j++]=pat[i];
}
/* Scan for last path separator to determine 'head_size' (directory part) */
for (i = 0; i < j; i++) {
- if(pattern[i] == '/' || pattern[i] == '\\' || pattern[i] == ':')
- hsize = i+1;
+ if(pattern[i] == '/' || pattern[i] == '\\' || pattern[i] == ':')
+ hsize = i+1;
}
pattern[j] = 0;
pfen->pattern = pattern;
@@ -149,44 +149,44 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
{
int code = 0;
uint len;
- for(;;)
- { if (pfen->first_time)
+ for(;;)
+ { if (pfen->first_time)
{ pfen->find_handle = FindFirstFile(pfen->pattern, &(pfen->find_data));
- if (pfen->find_handle == INVALID_HANDLE_VALUE)
- { code = -1;
+ if (pfen->find_handle == INVALID_HANDLE_VALUE)
+ { code = -1;
break;
}
- pfen->first_time = 0;
- }
- else
+ pfen->first_time = 0;
+ }
+ else
{ if (!FindNextFile(pfen->find_handle, &(pfen->find_data)))
- { code = -1;
+ { code = -1;
break;
}
}
if ( strcmp(".", pfen->find_data.cFileName)
&& strcmp("..", pfen->find_data.cFileName)
- && (pfen->find_data.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY))
+ && (pfen->find_data.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY))
break;
- }
-
+ }
+
if (code != 0) { /* All done, clean up. */
- gp_enumerate_files_close(pfen);
- return ~(uint) 0;
+ gp_enumerate_files_close(pfen);
+ return ~(uint) 0;
}
len = strlen(pfen->find_data.cFileName);
if (pfen->head_size + len < maxlen) {
- memcpy(ptr, pfen->pattern, pfen->head_size);
- strcpy(ptr + pfen->head_size, pfen->find_data.cFileName);
- return pfen->head_size + len;
+ memcpy(ptr, pfen->pattern, pfen->head_size);
+ strcpy(ptr + pfen->head_size, pfen->find_data.cFileName);
+ return pfen->head_size + len;
}
if (pfen->head_size >= maxlen)
- return 0; /* no hope at all */
+ return 0; /* no hope at all */
memcpy(ptr, pfen->pattern, pfen->head_size);
strncpy(ptr + pfen->head_size, pfen->find_data.cFileName,
- maxlen - pfen->head_size - 1);
+ maxlen - pfen->head_size - 1);
return maxlen;
}
@@ -197,47 +197,46 @@ gp_enumerate_files_close(file_enum * pfen)
gs_memory_t *mem = pfen->memory;
if (pfen->find_handle != INVALID_HANDLE_VALUE)
- FindClose(pfen->find_handle);
+ FindClose(pfen->find_handle);
gs_free_object(mem, pfen->pattern,
- "gp_enumerate_files_close(pattern)");
+ "gp_enumerate_files_close(pattern)");
gs_free_object(mem, pfen, "gp_enumerate_files_close");
}
-
/* -------------- Helpers for gp_file_name_combine_generic ------------- */
uint gp_file_name_root(const char *fname, uint len)
{ int i = 0;
-
+
if (len == 0)
- return 0;
+ return 0;
if (len > 1 && fname[0] == '\\' && fname[1] == '\\') {
- /* A network path: "\\server\share\" */
- int k = 0;
-
- for (i = 2; i < len; i++)
- if (fname[i] == '\\' || fname[i] == '/')
- if (k++) {
- i++;
- break;
- }
+ /* A network path: "\\server\share\" */
+ int k = 0;
+
+ for (i = 2; i < len; i++)
+ if (fname[i] == '\\' || fname[i] == '/')
+ if (k++) {
+ i++;
+ break;
+ }
} else if (fname[0] == '/' || fname[0] == '\\') {
- /* Absolute with no drive. */
- i = 1;
+ /* Absolute with no drive. */
+ i = 1;
} else if (len > 1 && fname[1] == ':') {
- /* Absolute with a drive. */
- i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
+ /* Absolute with a drive. */
+ i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
}
return i;
}
uint gs_file_name_check_separator(const char *fname, int len, const char *item)
{ if (len > 0) {
- if (fname[0] == '/' || fname[0] == '\\')
- return 1;
+ if (fname[0] == '/' || fname[0] == '\\')
+ return 1;
} else if (len < 0) {
- if (fname[-1] == '/' || fname[-1] == '\\')
- return 1;
+ if (fname[-1] == '/' || fname[-1] == '\\')
+ return 1;
}
return 0;
}
@@ -275,10 +274,9 @@ bool gp_file_name_is_empty_item_meanful(void)
}
gp_file_name_combine_result
-gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
- return gp_file_name_combine_generic(prefix, plen,
- fname, flen, no_sibling, buffer, blen);
+ return gp_file_name_combine_generic(prefix, plen,
+ fname, flen, no_sibling, buffer, blen);
}
-
diff --git a/gs/base/gp_os2.c b/gs/base/gp_os2.c
index e5e566249..3580a87bb 100644
--- a/gs/base/gp_os2.c
+++ b/gs/base/gp_os2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,7 +81,6 @@ extern jmp_buf gsdll_env;
#endif
char pm_prntmp[256]; /* filename of printer spool temporary file */
-
/* ------ Miscellaneous ------ */
/* Get the string corresponding to an OS error number. */
@@ -104,8 +103,8 @@ gp_get_realtime(long *pdt)
struct timezone tzp;
if (gettimeofday(&tp, &tzp) == -1) {
- lprintf("Ghostscript: gettimeofday failed!\n");
- tp.tv_sec = tp.tv_usec = 0;
+ lprintf("Ghostscript: gettimeofday failed!\n");
+ tp.tv_sec = tp.tv_usec = 0;
}
/* tp.tv_sec is #secs since Jan 1, 1970 */
pdt[0] = tp.tv_sec;
@@ -113,7 +112,7 @@ gp_get_realtime(long *pdt)
#ifdef DEBUG_CLOCK
printf("tp.tv_sec = %d tp.tv_usec = %d pdt[0] = %ld pdt[1] = %ld\n",
- tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
+ tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]);
#endif
}
@@ -125,7 +124,6 @@ gp_get_usertime(long *pdt)
gp_get_realtime(pdt); /* Use an approximation for now. */
}
-
/* ------ Console management ------ */
/* Answer whether a given file is the console (input or output). */
@@ -138,31 +136,31 @@ gp_file_is_console(FILE * f)
{
#ifndef __DLL__
if (!isos2) {
- union REGS regs;
-
- if (f == NULL)
- return false;
- regs.h.ah = 0x44; /* ioctl */
- regs.h.al = 0; /* get device info */
- regs.rshort.bx = fileno(f);
- intdos(&regs, &regs);
- return ((regs.h.dl & 0x80) != 0 && (regs.h.dl & 3) != 0);
+ union REGS regs;
+
+ if (f == NULL)
+ return false;
+ regs.h.ah = 0x44; /* ioctl */
+ regs.h.al = 0; /* get device info */
+ regs.rshort.bx = fileno(f);
+ intdos(&regs, &regs);
+ return ((regs.h.dl & 0x80) != 0 && (regs.h.dl & 3) != 0);
}
#endif
if (fileno(f) <= 2)
- return true;
+ return true;
return false;
}
/* ------ Persistent data cache ------*/
-
+
/* insert a buffer under a (type, key) pair */
int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
-{
+{
/* not yet implemented */
return 0;
-}
-
+}
+
/* look up a (type, key) in the cache */
int gp_cache_query(int type, byte* key, int keylen, void **buffer,
gp_cache_alloc alloc, void *userdata)
@@ -171,7 +169,6 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
return -1;
}
-
/*************************************************************/
/* from gp_iwatc.c and gp_itbc.c */
@@ -199,12 +196,12 @@ gp_init(void)
/* get environment of EXE */
DosGetInfoBlocks(&pptib, &pppib);
for (i = 0, p = pppib->pib_pchenv; *p; p += strlen(p) + 1)
- i++;
+ i++;
_environ = environ = (char **)malloc((i + 2) * sizeof(char *));
for (i = 0, p = pppib->pib_pchenv; *p; p += strlen(p) + 1) {
- environ[i] = p;
- i++;
+ environ[i] = p;
+ i++;
}
environ[i] = p;
i++;
@@ -221,7 +218,6 @@ gp_init(void)
signal(SIGFPE, handle_FPE);
}
-
/* Trap numeric exceptions. Someday we will do something */
/* more appropriate with these. */
static void
@@ -237,8 +233,8 @@ gp_exit(int exit_status, int code)
{
#if defined(__DLL__) && defined(__EMX__)
if (environ != fake_environ) {
- free(environ);
- environ = _environ = fake_environ;
+ free(environ);
+ environ = _environ = fake_environ;
}
#endif
}
@@ -267,11 +263,11 @@ gp_set_file_binary(int prnfno, int binary)
regs.rshort.bx = prnfno;
intdos(&regs, &regs);
if (((regs.rshort.flags) & 1) != 0 || !(regs.h.dl & 0x80))
- return; /* error, or not a device */
+ return; /* error, or not a device */
if (binary)
- regs.h.dl |= 0x20; /* binary (no ^Z intervention) */
+ regs.h.dl |= 0x20; /* binary (no ^Z intervention) */
else
- regs.h.dl &= ~0x20; /* text */
+ regs.h.dl &= ~0x20; /* text */
regs.h.dh = 0;
regs.h.ah = 0x44; /* ioctl */
regs.h.al = 1; /* set device info */
@@ -297,27 +293,27 @@ gp_open_printer(const gs_memory_t *mem,
FILE *pfile;
if ((strlen(fname) == 0) || is_os2_spool(fname)) {
- if (isos2) {
- /* default or spool */
- if (pm_spool(mem, NULL, fname)) /* check if spool queue valid */
- return NULL;
- pfile = gp_open_scratch_file(mem,
+ if (isos2) {
+ /* default or spool */
+ if (pm_spool(mem, NULL, fname)) /* check if spool queue valid */
+ return NULL;
+ pfile = gp_open_scratch_file(mem,
gp_scratch_file_name_prefix,
pm_prntmp,
(binary_mode ? "wb" : "w"));
- } else
- pfile = fopen("PRN", (binary_mode ? "wb" : "w"));
+ } else
+ pfile = fopen("PRN", (binary_mode ? "wb" : "w"));
} else if ((isos2) && (fname[0] == '|'))
- /* pipe */
- pfile = popen(fname + 1, (binary_mode ? "wb" : "w"));
+ /* pipe */
+ pfile = popen(fname + 1, (binary_mode ? "wb" : "w"));
else
- /* normal file or port */
- pfile = fopen(fname, (binary_mode ? "wb" : "w"));
+ /* normal file or port */
+ pfile = fopen(fname, (binary_mode ? "wb" : "w"));
if (pfile == (FILE *) NULL)
- return (FILE *) NULL;
+ return (FILE *) NULL;
if (!isos2)
- gp_set_file_binary(fileno(pfile), binary_mode);
+ gp_set_file_binary(fileno(pfile), binary_mode);
return pfile;
}
@@ -326,14 +322,14 @@ void
gp_close_printer(const gs_memory_t *mem, FILE * pfile, const char *fname)
{
if (isos2 && (fname[0] == '|'))
- pclose(pfile);
+ pclose(pfile);
else
- fclose(pfile);
+ fclose(pfile);
if ((strlen(fname) == 0) || is_os2_spool(fname)) {
- /* spool temporary file */
- pm_spool(mem, pm_prntmp, fname);
- unlink(pm_prntmp);
+ /* spool temporary file */
+ pm_spool(mem, pm_prntmp, fname);
+ unlink(pm_prntmp);
}
}
@@ -374,66 +370,65 @@ pm_find_queue(const gs_memory_t *mem, char *queue_name, char *driver_name)
ulLevel = 3L;
pszComputerName = (PSZ) NULL;
splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, 0L, /* cbBuf */
- &cReturned, &cTotal,
- &cbNeeded, NULL);
+ &cReturned, &cTotal,
+ &cbNeeded, NULL);
if (splerr == ERROR_MORE_DATA || splerr == NERR_BufTooSmall) {
- if (!DosAllocMem((PVOID) & pBuf, cbNeeded,
- PAG_READ | PAG_WRITE | PAG_COMMIT)) {
- cbBuf = cbNeeded;
- splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, cbBuf,
- &cReturned, &cTotal,
- &cbNeeded, NULL);
- if (splerr == NO_ERROR) {
- /* Set pointer to point to the beginning of the buffer. */
- prq = (PPRQINFO3) pBuf;
-
- /* cReturned has the count of the number of PRQINFO3 structures. */
- for (i = 0; i < cReturned; i++) {
- if (queue_name) {
- /* find queue name and return driver name */
- if (strlen(queue_name) == 0) { /* use default queue */
- if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
- strcpy(queue_name, prq->pszName);
- }
- if (strcmp(prq->pszName, queue_name) == 0) {
- char *p;
-
- for (p = prq->pszDriverName; *p && (*p != '.'); p++)
- /* do nothing */ ;
- *p = '\0'; /* truncate at '.' */
- if (driver_name != NULL)
- strcpy(driver_name, prq->pszDriverName);
- DosFreeMem((PVOID) pBuf);
- return 0;
- }
- } else {
- /* list queue details */
- if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
- emprintf1(mem, " \042%s\042 (DEFAULT)\n", prq->pszName);
- else
- emprintf1(mem, " \042%s\042\n", prq->pszName);
- }
- prq++;
- } /*endfor cReturned */
- }
- DosFreeMem((PVOID) pBuf);
- }
+ if (!DosAllocMem((PVOID) & pBuf, cbNeeded,
+ PAG_READ | PAG_WRITE | PAG_COMMIT)) {
+ cbBuf = cbNeeded;
+ splerr = SplEnumQueue(pszComputerName, ulLevel, pBuf, cbBuf,
+ &cReturned, &cTotal,
+ &cbNeeded, NULL);
+ if (splerr == NO_ERROR) {
+ /* Set pointer to point to the beginning of the buffer. */
+ prq = (PPRQINFO3) pBuf;
+
+ /* cReturned has the count of the number of PRQINFO3 structures. */
+ for (i = 0; i < cReturned; i++) {
+ if (queue_name) {
+ /* find queue name and return driver name */
+ if (strlen(queue_name) == 0) { /* use default queue */
+ if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
+ strcpy(queue_name, prq->pszName);
+ }
+ if (strcmp(prq->pszName, queue_name) == 0) {
+ char *p;
+
+ for (p = prq->pszDriverName; *p && (*p != '.'); p++)
+ /* do nothing */ ;
+ *p = '\0'; /* truncate at '.' */
+ if (driver_name != NULL)
+ strcpy(driver_name, prq->pszDriverName);
+ DosFreeMem((PVOID) pBuf);
+ return 0;
+ }
+ } else {
+ /* list queue details */
+ if (prq->fsType & PRQ3_TYPE_APPDEFAULT)
+ emprintf1(mem, " \042%s\042 (DEFAULT)\n", prq->pszName);
+ else
+ emprintf1(mem, " \042%s\042\n", prq->pszName);
+ }
+ prq++;
+ } /*endfor cReturned */
+ }
+ DosFreeMem((PVOID) pBuf);
+ }
}
- /* end if Q level given */
+ /* end if Q level given */
else {
- /* If we are here we had a bad error code. Print it and some other info. */
- emprintf4(mem,
+ /* If we are here we had a bad error code. Print it and some other info. */
+ emprintf4(mem,
"SplEnumQueue Error=%ld, Total=%ld, Returned=%ld, Needed=%ld\n",
- splerr, cTotal, cReturned, cbNeeded);
+ splerr, cTotal, cReturned, cbNeeded);
}
if (splerr)
- return splerr;
+ return splerr;
if (queue_name)
- return -1;
+ return -1;
return 0;
}
-
/* return TRUE if queue looks like a valid OS/2 queue name */
static int
is_os2_spool(const char *queue)
@@ -442,12 +437,12 @@ is_os2_spool(const char *queue)
int i;
for (i = 0; i < 8; i++) {
- if (prefix[i] == '\\') {
- if ((*queue != '\\') && (*queue != '/'))
- return FALSE;
- } else if (tolower(*queue) != prefix[i])
- return FALSE;
- queue++;
+ if (prefix[i] == '\\') {
+ if ((*queue != '\\') && (*queue != '/'))
+ return FALSE;
+ } else if (tolower(*queue) != prefix[i])
+ return FALSE;
+ queue++;
}
return TRUE;
}
@@ -472,110 +467,107 @@ pm_spool(const gs_memory_t *mem, char *filename, const char *queue)
int count;
if (strlen(queue) != 0) {
- /* queue specified */
- strcpy(queue_name, queue + 8); /* skip over \\spool\ */
+ /* queue specified */
+ strcpy(queue_name, queue + 8); /* skip over \\spool\ */
} else {
- /* get default queue */
- queue_name[0] = '\0';
+ /* get default queue */
+ queue_name[0] = '\0';
}
if (pm_find_queue(mem, queue_name, driver_name)) {
- /* error, list valid queue names */
- emprintf(mem, "Invalid queue name. Use one of:\n");
- pm_find_queue(mem, NULL, NULL);
- return 1;
+ /* error, list valid queue names */
+ emprintf(mem, "Invalid queue name. Use one of:\n");
+ pm_find_queue(mem, NULL, NULL);
+ return 1;
}
if (!filename)
- return 0; /* we were only asked to check the queue */
-
+ return 0; /* we were only asked to check the queue */
if ((buffer = malloc(PRINT_BUF_SIZE)) == (char *)NULL) {
- emprintf(mem, "Out of memory in pm_spool\n");
- return 1;
+ emprintf(mem, "Out of memory in pm_spool\n");
+ return 1;
}
if ((f = fopen(filename, "rb")) == (FILE *) NULL) {
- free(buffer);
- emprintf1(mem, "Can't open temporary file %s\n", filename);
- return 1;
+ free(buffer);
+ emprintf1(mem, "Can't open temporary file %s\n", filename);
+ return 1;
}
/* Allocate memory for pdata */
if (!DosAllocMem((PVOID) & pdata, sizeof(DEVOPENSTRUC),
- (PAG_READ | PAG_WRITE | PAG_COMMIT))) {
- /* Initialize elements of pdata */
- pdata->pszLogAddress = queue_name;
- pdata->pszDriverName = driver_name;
- pdata->pdriv = NULL;
- pdata->pszDataType = "PM_Q_RAW";
- pdata->pszComment = "Ghostscript";
- pdata->pszQueueProcName = NULL;
- pdata->pszQueueProcParams = NULL;
- pdata->pszSpoolerParams = NULL;
- pdata->pszNetworkParams = NULL;
-
- hspl = SplQmOpen(pszToken, 4L, (PQMOPENDATA) pdata);
- if (hspl == SPL_ERROR) {
- emprintf(mem, "SplQmOpen failed.\n");
- DosFreeMem((PVOID) pdata);
- free(buffer);
- fclose(f);
- return 1; /* failed */
- }
- rc = SplQmStartDoc(hspl, "Ghostscript");
- if (!rc) {
- emprintf(mem, "SplQmStartDoc failed.\n");
- DosFreeMem((PVOID) pdata);
- free(buffer);
- fclose(f);
- return 1;
- }
- /* loop, copying file to queue */
- while (rc && (count = fread(buffer, 1, PRINT_BUF_SIZE, f)) != 0) {
- rc = SplQmWrite(hspl, count, buffer);
- if (!rc)
- emprintf(mem, "SplQmWrite failed.\n");
- }
- free(buffer);
- fclose(f);
-
- if (!rc) {
- emprintf(mem, "Aborting Spooling.\n");
- SplQmAbort(hspl);
- } else {
- SplQmEndDoc(hspl);
- rc = SplQmClose(hspl);
- if (!rc)
- emprintf(mem, "SplQmClose failed.\n");
- }
+ (PAG_READ | PAG_WRITE | PAG_COMMIT))) {
+ /* Initialize elements of pdata */
+ pdata->pszLogAddress = queue_name;
+ pdata->pszDriverName = driver_name;
+ pdata->pdriv = NULL;
+ pdata->pszDataType = "PM_Q_RAW";
+ pdata->pszComment = "Ghostscript";
+ pdata->pszQueueProcName = NULL;
+ pdata->pszQueueProcParams = NULL;
+ pdata->pszSpoolerParams = NULL;
+ pdata->pszNetworkParams = NULL;
+
+ hspl = SplQmOpen(pszToken, 4L, (PQMOPENDATA) pdata);
+ if (hspl == SPL_ERROR) {
+ emprintf(mem, "SplQmOpen failed.\n");
+ DosFreeMem((PVOID) pdata);
+ free(buffer);
+ fclose(f);
+ return 1; /* failed */
+ }
+ rc = SplQmStartDoc(hspl, "Ghostscript");
+ if (!rc) {
+ emprintf(mem, "SplQmStartDoc failed.\n");
+ DosFreeMem((PVOID) pdata);
+ free(buffer);
+ fclose(f);
+ return 1;
+ }
+ /* loop, copying file to queue */
+ while (rc && (count = fread(buffer, 1, PRINT_BUF_SIZE, f)) != 0) {
+ rc = SplQmWrite(hspl, count, buffer);
+ if (!rc)
+ emprintf(mem, "SplQmWrite failed.\n");
+ }
+ free(buffer);
+ fclose(f);
+
+ if (!rc) {
+ emprintf(mem, "Aborting Spooling.\n");
+ SplQmAbort(hspl);
+ } else {
+ SplQmEndDoc(hspl);
+ rc = SplQmClose(hspl);
+ if (!rc)
+ emprintf(mem, "SplQmClose failed.\n");
+ }
} else
- rc = 0; /* no memory */
+ rc = 0; /* no memory */
return !rc;
}
-
-
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file.
*/
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
return NULL;
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
return 0;
}
-
+
void gp_enumerate_fonts_free(void *enum_state)
{
-}
+}
/* --------- 64 bit file access ----------- */
/* fixme: Not implemented yet.
- * Currently we stub it with 32 bits access.
+ * Currently we stub it with 32 bits access.
*/
FILE *gp_fopen_64(const char *filename, const char *mode)
@@ -606,8 +598,8 @@ int64_t gp_ftell_64(FILE *strm)
int gp_fseek_64(FILE *strm, int64_t offset, int origin)
{
long offset1 = (long)offset;
-
+
if (offset != offset1)
- return -1;
+ return -1;
return fseek(strm, offset1, origin);
}
diff --git a/gs/base/gp_os2.h b/gs/base/gp_os2.h
index c684a117b..d71d8d12e 100644
--- a/gs/base/gp_os2.h
+++ b/gs/base/gp_os2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,5 +28,4 @@ int pm_find_queue(const gs_memory_t *mem, char *queue_name, char *driver_name);
/* If filename is NULL, return 0 if spool queue is valid, non-zero if error */
int pm_spool(const gs_memory_t *mem, char *filename, const char *queue);
-
#endif /* gp_os2_INCLUDED */
diff --git a/gs/base/gp_os2fs.c b/gs/base/gp_os2fs.c
index 10d9d49bd..caba46763 100644
--- a/gs/base/gp_os2fs.c
+++ b/gs/base/gp_os2fs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -70,7 +70,6 @@ const char gp_fmode_wb[] = "wb";
/* ------ File enumeration ------ */
-
struct file_enum_s {
FILEFINDBUF3 findbuf;
HDIR hdir;
@@ -83,7 +82,7 @@ struct file_enum_s {
gs_memory_t *memory;
};
gs_private_st_ptrs1(st_file_enum, struct file_enum_s, "file_enum",
- file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
+ file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern);
/* Initialize an enumeration. may NEED WORK ON HANDLING * ? \. */
file_enum *
@@ -96,27 +95,27 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
int i;
if (pfen == 0)
- return 0;
+ return 0;
/* pattern could be allocated as a string, */
/* but it's simpler for GC and freeing to allocate it as bytes. */
pattern = (char *)gs_alloc_bytes(mem, pat_size,
- "gp_enumerate_files(pattern)");
+ "gp_enumerate_files(pattern)");
if (pattern == 0)
- return 0;
+ return 0;
memcpy(pattern, pat, patlen);
/* find directory name = header */
for (i = 0; i < patlen; i++) {
- switch (pat[i]) {
- case '\\':
- if (i + 1 < patlen && pat[i + 1] == '\\')
- i++;
- /* falls through */
- case ':':
- case '/':
- hsize = i + 1;
- }
+ switch (pat[i]) {
+ case '\\':
+ if (i + 1 < patlen && pat[i + 1] == '\\')
+ i++;
+ /* falls through */
+ case ':':
+ case '/':
+ hsize = i + 1;
+ }
}
pattern[patlen] = 0;
pfen->pattern = pattern;
@@ -137,43 +136,43 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
ULONG cFilenames = 1;
if (!isos2) {
- /* CAN'T DO IT SO JUST RETURN THE PATTERN. */
- if (pfen->first_time) {
- char *pattern = pfen->pattern;
- uint len = strlen(pattern);
-
- pfen->first_time = 0;
- if (len > maxlen)
- return maxlen + 1;
- strcpy(ptr, pattern);
- return len;
- }
- return -1;
+ /* CAN'T DO IT SO JUST RETURN THE PATTERN. */
+ if (pfen->first_time) {
+ char *pattern = pfen->pattern;
+ uint len = strlen(pattern);
+
+ pfen->first_time = 0;
+ if (len > maxlen)
+ return maxlen + 1;
+ strcpy(ptr, pattern);
+ return len;
+ }
+ return -1;
}
/* else OS/2 */
if (pfen->first_time) {
- rc = DosFindFirst(pfen->pattern, &pfen->hdir, FILE_NORMAL,
- &pfen->findbuf, sizeof(pfen->findbuf),
- &cFilenames, FIL_STANDARD);
- pfen->first_time = 0;
+ rc = DosFindFirst(pfen->pattern, &pfen->hdir, FILE_NORMAL,
+ &pfen->findbuf, sizeof(pfen->findbuf),
+ &cFilenames, FIL_STANDARD);
+ pfen->first_time = 0;
} else {
- rc = DosFindNext(pfen->hdir, &pfen->findbuf, sizeof(pfen->findbuf),
- &cFilenames);
+ rc = DosFindNext(pfen->hdir, &pfen->findbuf, sizeof(pfen->findbuf),
+ &cFilenames);
}
if (rc)
- return -1;
+ return -1;
if (pfen->head_size + pfen->findbuf.cchName < maxlen) {
- memcpy(ptr, pfen->pattern, pfen->head_size);
- strcpy(ptr + pfen->head_size, pfen->findbuf.achName);
- return pfen->head_size + pfen->findbuf.cchName;
+ memcpy(ptr, pfen->pattern, pfen->head_size);
+ strcpy(ptr + pfen->head_size, pfen->findbuf.achName);
+ return pfen->head_size + pfen->findbuf.cchName;
}
if (pfen->head_size >= maxlen)
- return 0; /* no hope at all */
+ return 0; /* no hope at all */
memcpy(ptr, pfen->pattern, pfen->head_size);
strncpy(ptr + pfen->head_size, pfen->findbuf.achName,
- maxlen - pfen->head_size - 1);
+ maxlen - pfen->head_size - 1);
return maxlen;
}
@@ -184,13 +183,12 @@ gp_enumerate_files_close(file_enum * pfen)
gs_memory_t *mem = pfen->memory;
if (isos2)
- DosFindClose(pfen->hdir);
+ DosFindClose(pfen->hdir);
gs_free_object(mem, pfen->pattern,
- "gp_enumerate_files_close(pattern)");
+ "gp_enumerate_files_close(pattern)");
gs_free_object(mem, pfen, "gp_enumerate_files_close");
}
-
/* ------ File naming and accessing ------ */
/* Create and open a scratch file with a given name prefix. */
@@ -199,7 +197,7 @@ FILE *
gp_open_scratch_file(const gs_memory_t *mem,
const char *prefix,
char fname[gp_file_name_sizeof],
- const char *mode)
+ const char *mode)
{
FILE *f;
#ifdef __IBMC__
@@ -208,19 +206,19 @@ gp_open_scratch_file(const gs_memory_t *mem,
int prefix_length = strlen(prefix);
if (!gp_file_name_is_absolute(prefix, prefix_length)) {
- temp = getenv("TMPDIR");
- if (temp == 0)
- temp = getenv("TEMP");
+ temp = getenv("TMPDIR");
+ if (temp == 0)
+ temp = getenv("TEMP");
}
*fname = 0;
tname = _tempnam(temp, (char *)prefix);
if (tname) {
- if (strlen(tname) > gp_file_name_sizeof - 1) {
- free(tname);
- return 0; /* file name too long */
- }
- strcpy(fname, tname);
- free(tname);
+ if (strlen(tname) > gp_file_name_sizeof - 1) {
+ free(tname);
+ return 0; /* file name too long */
+ }
+ strcpy(fname, tname);
+ free(tname);
}
#else
/* The -7 is for XXXXXX plus a possible final \. */
@@ -228,25 +226,25 @@ gp_open_scratch_file(const gs_memory_t *mem,
int len = gp_file_name_sizeof - prefix_length - 7;
if (gp_file_name_is_absolute(prefix, prefix_length) ||
- gp_gettmpdir(fname, &len) != 0)
- *fname = 0;
+ gp_gettmpdir(fname, &len) != 0)
+ *fname = 0;
else {
- char last = '\\';
- char *temp;
-
- /* Prevent X's in path from being converted by mktemp. */
- for (temp = fname; *temp; temp++)
- *temp = last = tolower(*temp);
- switch (last) {
- default:
- strcat(fname, "\\");
- case ':':
- case '\\':
- ;
- }
+ char last = '\\';
+ char *temp;
+
+ /* Prevent X's in path from being converted by mktemp. */
+ for (temp = fname; *temp; temp++)
+ *temp = last = tolower(*temp);
+ switch (last) {
+ default:
+ strcat(fname, "\\");
+ case ':':
+ case '\\':
+ ;
+ }
}
if (strlen(fname) + prefix_length + 7 >= gp_file_name_sizeof)
- return 0; /* file name too long */
+ return 0; /* file name too long */
strcat(fname, prefix);
strcat(fname, "XXXXXX");
mktemp(fname);
@@ -266,36 +264,36 @@ gp_fopen(const char *fname, const char *mode)
uint gp_file_name_root(const char *fname, uint len)
{ int i = 0;
-
+
if (len == 0)
- return 0;
+ return 0;
if (len > 1 && fname[0] == '\\' && fname[1] == '\\') {
- /* A network path: "\\server\share\" */
- int k = 0;
-
- for (i = 2; i < len; i++)
- if (fname[i] == '\\' || fname[i] == '/')
- if (k++) {
- i++;
- break;
- }
+ /* A network path: "\\server\share\" */
+ int k = 0;
+
+ for (i = 2; i < len; i++)
+ if (fname[i] == '\\' || fname[i] == '/')
+ if (k++) {
+ i++;
+ break;
+ }
} else if (fname[0] == '/' || fname[0] == '\\') {
- /* Absolute with no drive. */
- i = 1;
+ /* Absolute with no drive. */
+ i = 1;
} else if (len > 1 && fname[1] == ':') {
- /* Absolute with a drive. */
- i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
+ /* Absolute with a drive. */
+ i = (len > 2 && (fname[2] == '/' || fname[2] == '\\') ? 3 : 2);
}
return i;
}
uint gs_file_name_check_separator(const char *fname, int len, const char *item)
{ if (len > 0) {
- if (fname[0] == '/' || fname[0] == '\\')
- return 1;
+ if (fname[0] == '/' || fname[0] == '\\')
+ return 1;
} else if (len < 0) {
- if (fname[-1] == '/' || fname[-1] == '\\')
- return 1;
+ if (fname[-1] == '/' || fname[-1] == '\\')
+ return 1;
}
return 0;
}
@@ -333,11 +331,9 @@ bool gp_file_name_is_empty_item_meanful(void)
}
gp_file_name_combine_result
-gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
- return gp_file_name_combine_generic(prefix, plen,
- fname, flen, no_sibling, buffer, blen);
+ return gp_file_name_combine_generic(prefix, plen,
+ fname, flen, no_sibling, buffer, blen);
}
-
-
diff --git a/gs/base/gp_os2pr.c b/gs/base/gp_os2pr.c
index 61958a67c..3f4c3391e 100644
--- a/gs/base/gp_os2pr.c
+++ b/gs/base/gp_os2pr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,15 +37,15 @@
/* The OS/2 printer IODevice */
/*
- * This allows an OS/2 printer to be specified as an
+ * This allows an OS/2 printer to be specified as an
* output using
* -sOutputFile="%printer%AppleLas"
* where "AppleLas" is the physical name of the queue.
*
* If you don't supply a printer name you will get
- * Error: /undefinedfilename in --.outputpage--
+ * Error: /undefinedfilename in --.outputpage--
* If the printer name is invalid you will get
- * Error: /invalidfileaccess in --.outputpage--
+ * Error: /invalidfileaccess in --.outputpage--
*
* This is implemented by writing to a temporary file
* then copying it to the spooler.
@@ -81,8 +81,8 @@ static int
os2_printer_init(gx_io_device * iodev, gs_memory_t * mem)
{
/* state -> structure containing thread handle */
- iodev->state = gs_alloc_bytes(mem, sizeof(os2_printer_t),
- "os2_printer_init");
+ iodev->state = gs_alloc_bytes(mem, sizeof(os2_printer_t),
+ "os2_printer_init");
if (iodev->state == NULL)
return_error(gs_error_VMerror);
memset(iodev->state, 0, sizeof(os2_printer_t));
@@ -90,20 +90,19 @@ os2_printer_init(gx_io_device * iodev, gs_memory_t * mem)
return 0;
}
-
static int
os2_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
os2_printer_t *pr = (os2_printer_t *)iodev->state;
char driver_name[256];
/* Make sure that printer exists. */
if (pm_find_queue(pr->memory, fname, driver_name)) {
- /* error, list valid queue names */
- emprintf(pr->memory, "Invalid queue name. Use one of:\n");
- pm_find_queue(pr->memory, NULL, NULL);
- return_error(gs_error_undefinedfilename);
+ /* error, list valid queue names */
+ emprintf(pr->memory, "Invalid queue name. Use one of:\n");
+ pm_find_queue(pr->memory, NULL, NULL);
+ return_error(gs_error_undefinedfilename);
}
strncpy(pr->queue, fname, sizeof(pr->queue)-1);
@@ -111,7 +110,7 @@ os2_printer_fopen(gx_io_device * iodev, const char *fname, const char *access,
/* Create a temporary file */
*pfile = gp_open_scratch_file(pr->memory, "gs", pr->filename, access);
if (*pfile == NULL)
- return_error(gs_fopen_errno_to_code(errno));
+ return_error(gs_fopen_errno_to_code(errno));
return 0;
}
@@ -121,8 +120,7 @@ os2_printer_fclose(gx_io_device * iodev, FILE * file)
{
os2_printer_t *pr = (os2_printer_t *)iodev->state;
fclose(file);
- pm_spool(pr->memory, pr->filename, pr->queue);
+ pm_spool(pr->memory, pr->filename, pr->queue);
unlink(pr->filename);
return 0;
}
-
diff --git a/gs/base/gp_os9.c b/gs/base/gp_os9.c
index a15c35bed..3872cdd64 100644
--- a/gs/base/gp_os9.c
+++ b/gs/base/gp_os9.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,15 +53,15 @@ signalhandler(int sig)
{
clearerr(stdin);
switch (sig) {
- case SIGINT:
- case SIGQUIT:
- interrupted = 1;
- break;
- case SIGFPE:
- interrupted = 2;
- break;
- default:
- break;
+ case SIGINT:
+ case SIGQUIT:
+ interrupted = 1;
+ break;
+ case SIGFPE:
+ interrupted = 2;
+ break;
+ default:
+ break;
}
}
@@ -101,7 +101,6 @@ gp_get_usertime(long *pdt)
return gp_get_realtime(pdt); /* not yet implemented */
}
-
/* ------ Persistent data cache ------*/
/* insert a buffer under a (type, key) pair */
@@ -131,9 +130,9 @@ gp_open_printer(const gs_memory_t *mem,
int binary_mode)
{
return
- (strlen(fname) == 0 ? 0 :
- fname[0] == '|' ? popen(fname + 1, "w") :
- rbfopen(fname, "w"));
+ (strlen(fname) == 0 ? 0 :
+ fname[0] == '|' ? popen(fname + 1, "w") :
+ rbfopen(fname, "w"));
}
FILE *
@@ -150,9 +149,9 @@ void
gp_close_printer(const gs_memory_t *mem, FILE * pfile, const char *fname)
{
if (fname[0] == '|')
- pclose(pfile);
+ pclose(pfile);
else
- fclose(pfile);
+ fclose(pfile);
}
/* ------ File accessing -------- */
@@ -162,29 +161,29 @@ int
gp_setmode_binary(FILE * pfile, bool binary)
{
if (binary)
- file->_flag |= _RBF;
+ file->_flag |= _RBF;
else
- file->_flag &= ~_RBF;
+ file->_flag &= ~_RBF;
return 0;
}
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file.
*/
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
return NULL;
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
return 0;
}
-
+
void gp_enumerate_fonts_free(void *enum_state)
{
-}
+}
diff --git a/gs/base/gp_paper.c b/gs/base/gp_paper.c
index 808f9f049..c5bcda795 100644
--- a/gs/base/gp_paper.c
+++ b/gs/base/gp_paper.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@ gp_defaultpapersize(char *ptr, int *plen)
/* None available */
if (*plen > 0)
- *ptr = 0;
+ *ptr = 0;
*plen = 1;
return 1;
}
diff --git a/gs/base/gp_psync.c b/gs/base/gp_psync.c
index d0658d12f..9b821b042 100644
--- a/gs/base/gp_psync.c
+++ b/gs/base/gp_psync.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,11 +64,11 @@ gp_semaphore_open(gp_semaphore * sema)
int scode;
if (!sema)
- return -1; /* semaphores are not movable */
+ return -1; /* semaphores are not movable */
sem->count = 0;
scode = pthread_mutex_init(&sem->mutex, NULL);
if (scode == 0)
- scode = pthread_cond_init(&sem->cond, NULL);
+ scode = pthread_cond_init(&sem->cond, NULL);
return SEM_ERROR_CODE(scode);
}
@@ -81,7 +81,7 @@ gp_semaphore_close(gp_semaphore * sema)
scode = pthread_cond_destroy(&sem->cond);
scode2 = pthread_mutex_destroy(&sem->mutex);
if (scode == 0)
- scode = scode2;
+ scode = scode2;
return SEM_ERROR_CODE(scode);
}
@@ -93,17 +93,17 @@ gp_semaphore_wait(gp_semaphore * sema)
scode = pthread_mutex_lock(&sem->mutex);
if (scode != 0)
- return SEM_ERROR_CODE(scode);
+ return SEM_ERROR_CODE(scode);
while (sem->count == 0) {
scode = pthread_cond_wait(&sem->cond, &sem->mutex);
if (scode != 0)
- break;
+ break;
}
if (scode == 0)
- --sem->count;
+ --sem->count;
scode2 = pthread_mutex_unlock(&sem->mutex);
if (scode == 0)
- scode = scode2;
+ scode = scode2;
return SEM_ERROR_CODE(scode);
}
@@ -115,16 +115,15 @@ gp_semaphore_signal(gp_semaphore * sema)
scode = pthread_mutex_lock(&sem->mutex);
if (scode != 0)
- return SEM_ERROR_CODE(scode);
+ return SEM_ERROR_CODE(scode);
if (sem->count++ == 0)
- scode = pthread_cond_signal(&sem->cond);
+ scode = pthread_cond_signal(&sem->cond);
scode2 = pthread_mutex_unlock(&sem->mutex);
if (scode == 0)
- scode = scode2;
+ scode = scode2;
return SEM_ERROR_CODE(scode);
}
-
/* Monitor supports enter/leave semantics */
/*
@@ -150,7 +149,7 @@ gp_monitor_open(gp_monitor * mona)
int scode;
if (!mona)
- return -1; /* monitors are not movable */
+ return -1; /* monitors are not movable */
mon = &((gp_pthread_recursive_t *)mona)->mutex;
((gp_pthread_recursive_t *)mona)->self_id = 0; /* Not valid unless mutex is locked */
scode = pthread_mutex_init(mon, NULL);
@@ -174,17 +173,17 @@ gp_monitor_enter(gp_monitor * mona)
int scode;
if ((scode = pthread_mutex_trylock(mon)) == 0) {
- ((gp_pthread_recursive_t *)mona)->self_id = pthread_self();
- return SEM_ERROR_CODE(scode);
+ ((gp_pthread_recursive_t *)mona)->self_id = pthread_self();
+ return SEM_ERROR_CODE(scode);
} else {
- if (pthread_equal(pthread_self(),((gp_pthread_recursive_t *)mona)->self_id))
- return 0;
- else {
- /* we were not the owner, wait */
- scode = pthread_mutex_lock(mon);
- ((gp_pthread_recursive_t *)mona)->self_id = pthread_self();
- return SEM_ERROR_CODE(scode);
- }
+ if (pthread_equal(pthread_self(),((gp_pthread_recursive_t *)mona)->self_id))
+ return 0;
+ else {
+ /* we were not the owner, wait */
+ scode = pthread_mutex_lock(mon);
+ ((gp_pthread_recursive_t *)mona)->self_id = pthread_self();
+ return SEM_ERROR_CODE(scode);
+ }
}
}
@@ -199,7 +198,6 @@ gp_monitor_leave(gp_monitor * mona)
return SEM_ERROR_CODE(scode);
}
-
/* --------- Thread primitives ---------- */
/*
@@ -229,22 +227,22 @@ int
gp_create_thread(gp_thread_creation_callback_t proc, void *proc_data)
{
gp_thread_creation_closure_t *closure =
- (gp_thread_creation_closure_t *)malloc(sizeof(*closure));
+ (gp_thread_creation_closure_t *)malloc(sizeof(*closure));
pthread_t ignore_thread;
pthread_attr_t attr;
int code;
if (!closure)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
closure->proc = proc;
closure->proc_data = proc_data;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
code = pthread_create(&ignore_thread, &attr, gp_thread_begin_wrapper,
- closure);
+ closure);
if (code) {
- free(closure);
- return_error(gs_error_ioerror);
+ free(closure);
+ return_error(gs_error_ioerror);
}
return 0;
}
diff --git a/gs/base/gp_stdia.c b/gs/base/gp_stdia.c
index 3cfac67bd..03720abca 100644
--- a/gs/base/gp_stdia.c
+++ b/gs/base/gp_stdia.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,10 +21,8 @@
#include "gx.h"
#include "gp.h"
-
/* Read bytes from stdin, unbuffered if possible. */
int gp_stdin_read(char *buf, int len, int interactive, FILE *f)
{
return read(fileno(f), buf, len);
}
-
diff --git a/gs/base/gp_stdin.c b/gs/base/gp_stdin.c
index c3fe80eff..79b61cd63 100644
--- a/gs/base/gp_stdin.c
+++ b/gs/base/gp_stdin.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,11 +24,10 @@
#include "gp.h"
/* Read bytes from stdin, using unbuffered if possible.
- * This implementation doesn't do unbuffered, so if
+ * This implementation doesn't do unbuffered, so if
* interactive read one byte at a time.
*/
int gp_stdin_read(char *buf, int len, int interactive, FILE *f)
{
return fread(buf, 1, interactive ? 1 : len, f);
}
-
diff --git a/gs/base/gp_strdl.c b/gs/base/gp_strdl.c
index 5c8fc733b..ee3cbb6bd 100644
--- a/gs/base/gp_strdl.c
+++ b/gs/base/gp_strdl.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,12 +26,12 @@ gp_readline_init(void **preadline_data, gs_memory_t * mem)
int
gp_readline(stream *s_in, stream *s_out, void *readline_data,
- gs_const_string *prompt, gs_string * buf,
- gs_memory_t * bufmem, uint * pcount, bool *pin_eol,
- bool (*is_stdin)(const stream *))
+ gs_const_string *prompt, gs_string * buf,
+ gs_memory_t * bufmem, uint * pcount, bool *pin_eol,
+ bool (*is_stdin)(const stream *))
{
return sreadline(s_in, s_out, readline_data, prompt, buf, bufmem, pcount,
- pin_eol, is_stdin);
+ pin_eol, is_stdin);
}
void
diff --git a/gs/base/gp_sysv.c b/gs/base/gp_sysv.c
index a95aefa2e..57d745c1d 100644
--- a/gs/base/gp_sysv.c
+++ b/gs/base/gp_sysv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,13 +30,13 @@ int
rename(const char *a, const char *b)
{
if (access(a, 0) == -1)
- return (-1);
+ return (-1);
unlink(b);
if (link(a, b) == -1)
- return (-1);
+ return (-1);
if (unlink(a) == -1) {
- unlink(b); /* ??? */
- return (-1);
+ unlink(b); /* ??? */
+ return (-1);
}
return (0);
}
@@ -53,8 +53,8 @@ gettimeofday(struct timeval *tvp, struct timezone *tzp)
long ticks;
if (!offset) {
- time(&offset);
- offset -= (times(&tms) / HZ);
+ time(&offset);
+ offset -= (times(&tms) / HZ);
}
ticks = times(&tms);
tvp->tv_sec = ticks / HZ + offset;
diff --git a/gs/base/gp_unix.c b/gs/base/gp_unix.c
index 758b3bfd6..dc27916fa 100644
--- a/gs/base/gp_unix.c
+++ b/gs/base/gp_unix.c
@@ -232,7 +232,6 @@ gp_close_printer(const gs_memory_t *mem, FILE * pfile, const char *fname)
* building a custom fontmap file.
*/
-
/* Mangle the FontConfig family and style information into a
* PostScript font name */
#ifdef HAVE_FONTCONFIG
@@ -429,4 +428,3 @@ void gp_enumerate_fonts_free(void *enum_state)
}
#endif
}
-
diff --git a/gs/base/gp_unix_cache.c b/gs/base/gp_unix_cache.c
index 2fa03d941..a1fca2add 100644
--- a/gs/base/gp_unix_cache.c
+++ b/gs/base/gp_unix_cache.c
@@ -79,7 +79,7 @@ static char *gp_cache_prefix(void)
if (plen >= 1 && prefix[0] == '~') {
char *home, *path;
int hlen = 0;
- unsigned int pathlen = 0;
+ unsigned int pathlen = 0;
gp_file_name_combine_result result;
if (gp_getenv("HOME", (char *)NULL, &hlen) < 0) {
@@ -322,7 +322,6 @@ gp_cache_write_entry(FILE *file, gp_cache_entry *item)
return 0;
}
-
/* insert a buffer under a (type, key) pair */
int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
{
diff --git a/gs/base/gp_upapr.c b/gs/base/gp_upapr.c
index 720981f83..85af9dbad 100644
--- a/gs/base/gp_upapr.c
+++ b/gs/base/gp_upapr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
/* ------ Default paper size ------ */
/* Get the default paper size. See gp_paper.h for details. */
-int
+int
gp_defaultpapersize(char *ptr, int *plen)
{
#ifdef USE_LIBPAPER
@@ -36,38 +36,36 @@ gp_defaultpapersize(char *ptr, int *plen)
paperinit();
paper = systempapername();
- if (paper)
+ if (paper)
is_systempaper = true;
else {
paper = defaultpapername();
is_systempaper = false;
}
-
+
if (paper) {
- int rc, len = strlen(paper);
+ int rc, len = strlen(paper);
- if (len < *plen) {
- /* string fits */
- strcpy(ptr, paper);
- rc = 0;
- } else {
- /* string doesn't fit */
- rc = -1;
- }
- *plen = len + 1;
- paperdone();
- if (is_systempaper)
+ if (len < *plen) {
+ /* string fits */
+ strcpy(ptr, paper);
+ rc = 0;
+ } else {
+ /* string doesn't fit */
+ rc = -1;
+ }
+ *plen = len + 1;
+ paperdone();
+ if (is_systempaper)
free(paper);
- return rc;
+ return rc;
}
#endif
/* No default paper size */
if (*plen > 0)
- *ptr = 0;
+ *ptr = 0;
*plen = 1;
return 1;
}
-
-
diff --git a/gs/base/gp_vms.c b/gs/base/gp_vms.c
index 8a7a984ca..03919b072 100644
--- a/gs/base/gp_vms.c
+++ b/gs/base/gp_vms.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,6 @@ extern char *getenv(const char *);
# define fopen_VMS(name, mode, m1, m2) fopen(name, mode)
#endif
-
/* VMS string descriptor structure */
#define DSC$K_DTYPE_T 14
#define DSC$K_CLASS_S 1
@@ -58,11 +57,11 @@ struct file_enum_s {
gs_memory_t *memory;
};
gs_private_st_ptrs1(st_file_enum, struct file_enum_s, "file_enum",
- file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern.dsc$a_pointer);
+ file_enum_enum_ptrs, file_enum_reloc_ptrs, pattern.dsc$a_pointer);
extern uint
LIB$FIND_FILE(descrip *, descrip *, uint *, descrip *, descrip *,
- uint *, uint *),
+ uint *, uint *),
LIB$FIND_FILE_END(uint *),
SYS$FILESCAN(descrip *, uint *, uint *),
SYS$PUTMSG(uint *, int (*)(), descrip *, uint);
@@ -73,7 +72,7 @@ strlength(char *str, uint maxlen, char term)
uint i = 0;
while (i < maxlen && str[i] != term)
- i++;
+ i++;
return i;
}
@@ -95,10 +94,10 @@ gp_do_exit(int exit_status)
{ /* The program returns exit_status = 0 for OK, 1 for failure; */
/* VMS has different conventions. */
switch (exit_status) {
- case 0:
- exit(exit_OK);
- case 1:
- exit(exit_FAILED);
+ case 0:
+ exit(exit_OK);
+ case 1:
+ exit(exit_FAILED);
}
exit(exit_status);
}
@@ -111,7 +110,7 @@ void
gp_get_realtime(long *pdt)
{
struct {
- uint _l0, _l1;
+ uint _l0, _l1;
} binary_date, now, difference;
long LIB$EDIV(), LIB$SUBX(), SYS$BINTIM(), SYS$GETTIM();
long units_per_second = 10000000;
@@ -149,7 +148,6 @@ gp_get_usertime(long *pdt)
gp_get_realtime(pdt); /* Use an approximation for now. */
}
-
/* ------ Persistent data cache ------*/
/* insert a buffer under a (type, key) pair */
@@ -187,18 +185,18 @@ gp_open_printer(const gs_memory_t *mem,
int binary_mode)
{
if (strlen(fname) == 0)
- return 0;
+ return 0;
if (binary_mode) { /*
- * Printing must be done exactly byte to byte,
- * using "passall". However the standard VMS symbiont
- * does not treat stream-LF files correctly in this respect,
- * but throws away \n characters. Giving the file
- * the record type "undefined", but accessing it as a
- * normal stream-LF file does the trick.
- */
- return fopen_VMS(fname, "w", "rfm = udf", "ctx = stm");
+ * Printing must be done exactly byte to byte,
+ * using "passall". However the standard VMS symbiont
+ * does not treat stream-LF files correctly in this respect,
+ * but throws away \n characters. Giving the file
+ * the record type "undefined", but accessing it as a
+ * normal stream-LF file does the trick.
+ */
+ return fopen_VMS(fname, "w", "rfm = udf", "ctx = stm");
} else { /* Open as a normal text stream file. */
- return fopen_VMS(fname, "w", "rfm = var", "rat = cr");
+ return fopen_VMS(fname, "w", "rfm = var", "rat = cr");
}
}
@@ -237,7 +235,7 @@ FILE *
gp_open_scratch_file(const gs_memory_t *mem,
const char *prefix,
char fname[gp_file_name_sizeof],
- const char *mode)
+ const char *mode)
{
FILE *f;
char tmpdir[gp_file_name_sizeof];
@@ -245,24 +243,24 @@ gp_open_scratch_file(const gs_memory_t *mem,
int flen[1];
if (!gp_file_name_is_absolute(prefix, strlen(prefix)) &&
- gp_gettmpdir(tmpdir, &tdlen) == 0) {
+ gp_gettmpdir(tmpdir, &tdlen) == 0) {
flen[0] = gp_file_name_sizeof;
- if (gp_file_name_combine(tmpdir, tdlen, prefix, strlen(prefix),
- false, fname, flen ) != gp_combine_success ) {
- return NULL;
- }
+ if (gp_file_name_combine(tmpdir, tdlen, prefix, strlen(prefix),
+ false, fname, flen ) != gp_combine_success ) {
+ return NULL;
+ }
fname[ *flen ] = 0;
} else {
- strcpy(fname, prefix);
+ strcpy(fname, prefix);
}
if (strlen(fname) + 6 >= gp_file_name_sizeof)
- return 0; /* file name too long */
+ return 0; /* file name too long */
strcat(fname, "XXXXXX");
mktemp(fname);
f = fopen(fname, mode);
-
+
if (f == NULL)
- emprintf1(mem, "**** Could not open temporary file %s\n", fname);
+ emprintf1(mem, "**** Could not open temporary file %s\n", fname);
return f;
}
@@ -277,8 +275,8 @@ gp_fopen(const char *fname, const char *mode)
stat_t buffer;
if (stat((char *)fname, &buffer) == 0)
- if (buffer.st_fab_rfm == FAB$C_FIX)
- return fopen(fname, mode, "rfm=stmlf", "ctx=stm");
+ if (buffer.st_fab_rfm == FAB$C_FIX)
+ return fopen(fname, mode, "rfm=stmlf", "ctx=stm");
#endif
return fopen(fname, mode);
}
@@ -296,11 +294,11 @@ static void
gp_free_enumeration(file_enum * pfen)
{
if (pfen) {
- LIB$FIND_FILE_END(&pfen->context);
- gs_free_object(pfen->memory, pfen->pattern.dsc$a_pointer,
- "GP_ENUM(pattern)");
- gs_free_object(pfen->memory, pfen,
- "GP_ENUM(file_enum)");
+ LIB$FIND_FILE_END(&pfen->context);
+ gs_free_object(pfen->memory, pfen->pattern.dsc$a_pointer,
+ "GP_ENUM(pattern)");
+ gs_free_object(pfen->memory, pfen,
+ "GP_ENUM(file_enum)");
}
}
@@ -315,12 +313,12 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
bool dot_in_filename = false;
pfen = gs_alloc_struct(mem, file_enum, &st_file_enum,
- "GP_ENUM(file_enum)");
+ "GP_ENUM(file_enum)");
newpat = (char *)gs_alloc_bytes(mem, patlen + 2, "GP_ENUM(pattern)");
if (pfen == 0 || newpat == 0) {
- gs_free_object(mem, newpat, "GP_ENUM(pattern)");
- gs_free_object(mem, pfen, "GP_ENUM(file_enum)");
- return (file_enum *) 0;
+ gs_free_object(mem, newpat, "GP_ENUM(pattern)");
+ gs_free_object(mem, pfen, "GP_ENUM(file_enum)");
+ return (file_enum *) 0;
}
/* Copy the pattern removing backslash quoting characters and
* transforming unquoted question marks, '?', to percent signs, '%'.
@@ -335,34 +333,34 @@ gp_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
*/
c = newpat;
for (i = 0; i < patlen; pat++, i++)
- switch (*pat) {
- case '?':
- *c++ = '%';
- break;
- case '\\':
- i++;
- if (i < patlen)
- *c++ = *++pat;
- break;
- case '.':
- case ']':
- dot_in_filename = *pat == '.';
- default:
- *c++ = *pat;
- break;
- }
+ switch (*pat) {
+ case '?':
+ *c++ = '%';
+ break;
+ case '\\':
+ i++;
+ if (i < patlen)
+ *c++ = *++pat;
+ break;
+ case '.':
+ case ']':
+ dot_in_filename = *pat == '.';
+ default:
+ *c++ = *pat;
+ break;
+ }
/* Check for trailing "*" and see if we need to add ".*" */
if (pat[-1] == '*' && !dot_in_filename) {
- *c++ = '.';
- *c++ = '*';
+ *c++ = '.';
+ *c++ = '*';
}
len = c - newpat;
/* Pattern may not exceed 255 characters */
if (len > 255) {
- gs_free_object(mem, newpat, "GP_ENUM(pattern)");
- gs_free_object(mem, pfen, "GP_ENUM(file_enum)");
- return (file_enum *) 0;
+ gs_free_object(mem, newpat, "GP_ENUM(pattern)");
+ gs_free_object(mem, pfen, "GP_ENUM(file_enum)");
+ return (file_enum *) 0;
}
pfen->context = 0;
pfen->length = patlen;
@@ -393,19 +391,19 @@ gp_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
/* Find the next file which matches the pattern */
i = LIB$FIND_FILE(&pfen->pattern, &result, &pfen->context,
- (descrip *) 0, (descrip *) 0, (uint *) 0, (uint *) 0);
+ (descrip *) 0, (descrip *) 0, (uint *) 0, (uint *) 0);
/* Check the return status */
if (RMS_IS_ERROR_OR_NMF(i)) {
- gp_free_enumeration(pfen);
- return (uint)(-1);
+ gp_free_enumeration(pfen);
+ return (uint)(-1);
} else if ((len = strlength(filnam, NAM$C_MAXRSS, ' ')) > maxlen)
- return maxlen + 1;
+ return maxlen + 1;
/* Copy the returned filename over to the input string ptr */
c = ptr;
for (i = 0; i < len; i++)
- *c++ = filnam[i];
+ *c++ = filnam[i];
return len;
}
@@ -430,7 +428,7 @@ gp_strerror(int errnum)
/* -------------- Helpers for gp_file_name_combine_generic ------------- */
uint gp_file_name_root(const char *fname, uint len)
-{
+{
/*
* The root for device:[root.][directory.subdirectory]filename.extension;version
* is device:[root.][
@@ -442,52 +440,52 @@ uint gp_file_name_root(const char *fname, uint len)
int i, j;
if (len == 0)
- return 0;
+ return 0;
/* Search for ':' */
for (i = 0; i < len; i++)
- if (fname[i] == ':')
- break;
+ if (fname[i] == ':')
+ break;
if (i == len)
- return 0; /* No root. */
+ return 0; /* No root. */
if (fname[i] == ':')
- i++;
+ i++;
if (i == len || fname[i] != '[')
- return i;
+ return i;
/* Search for ']' */
i++;
for (j = i; j < len; j++)
- if (fname[j] == ']')
- break;
+ if (fname[j] == ']')
+ break;
if (j == len)
- return i; /* No ']'. Allowed as a Ghostscript specifics. */
+ return i; /* No ']'. Allowed as a Ghostscript specifics. */
j++;
if (j == len)
- return i; /* Appending "device:[directory.subdirectory]" with "filename.extension;version". */
+ return i; /* Appending "device:[directory.subdirectory]" with "filename.extension;version". */
if (fname[j] != '[')
- return i; /* Can't append anything, but pass through for checking an absolute path. */
+ return i; /* Can't append anything, but pass through for checking an absolute path. */
return j + 1; /* device:[root.][ */
}
uint gs_file_name_check_separator(const char *fname, int len, const char *item)
-{
+{
if (len > 0) {
- /*
- * Ghostscript specifics : an extended syntax like Mac OS.
- * We intentionally don't consider ':' and '[' as separators
- * in forward search, see gp_file_name_combine.
- */
- if (fname[0] == ']')
- return 1; /* It is a file separator. */
- if (fname[0] == '.')
- return 1; /* It is a directory separator. */
- if (fname[0] == '-') {
- if (fname == item + 1 && item[0] == '-')
- return 1; /* Two or more parents, cut the first one. */
- return 1;
- }
+ /*
+ * Ghostscript specifics : an extended syntax like Mac OS.
+ * We intentionally don't consider ':' and '[' as separators
+ * in forward search, see gp_file_name_combine.
+ */
+ if (fname[0] == ']')
+ return 1; /* It is a file separator. */
+ if (fname[0] == '.')
+ return 1; /* It is a directory separator. */
+ if (fname[0] == '-') {
+ if (fname == item + 1 && item[0] == '-')
+ return 1; /* Two or more parents, cut the first one. */
+ return 1;
+ }
} else if (len < 0) {
- if (fname[-1] == '.' || fname[-1] == ':' || fname[-1] == '[')
- return 1;
+ if (fname[-1] == '.' || fname[-1] == ':' || fname[-1] == '[')
+ return 1;
}
return 0;
}
@@ -527,137 +525,137 @@ bool gp_file_name_is_empty_item_meanful(void)
}
gp_file_name_combine_result
-gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
/*
* Reduce it to the general case.
*
- * Implementation restriction : fname must not contain a part of
+ * Implementation restriction : fname must not contain a part of
* "device:[root.]["
*/
uint rlen, flen1 = flen, plen1 = plen;
const char *fname1 = fname;
-
+
if ( plen > 0 && prefix[plen-1] == '\0' )
plen--;
-
+
if (plen == 0 && flen == 0) {
- /* Not sure that we need this case. */
- if (*blen == 0)
- return gp_combine_small_buffer;
- buffer[0] = '.';
- *blen = 1;
+ /* Not sure that we need this case. */
+ if (*blen == 0)
+ return gp_combine_small_buffer;
+ buffer[0] = '.';
+ *blen = 1;
}
rlen = gp_file_name_root(fname, flen);
if (rlen > 0 || plen == 0 || flen == 0) {
- if (rlen == 0 && plen != 0) {
- fname1 = prefix;
- flen1 = plen;
- }
- if (flen1 + 1 > *blen)
- return gp_combine_small_buffer;
- memcpy(buffer, fname1, flen1);
- buffer[flen1] = 0;
- *blen = flen1;
- return gp_combine_success;
+ if (rlen == 0 && plen != 0) {
+ fname1 = prefix;
+ flen1 = plen;
+ }
+ if (flen1 + 1 > *blen)
+ return gp_combine_small_buffer;
+ memcpy(buffer, fname1, flen1);
+ buffer[flen1] = 0;
+ *blen = flen1;
+ return gp_combine_success;
}
-
+
if ( prefix[plen - 1] == ']' && fname[ 0 ] == '-' )
{
- memcpy(buffer, prefix, plen - 1 );
- fname1 = fname + 1;
- flen1 = flen - 1;
- memcpy(buffer + plen - 1 , fname1, flen1);
- memcpy(buffer + plen + flen1 - 1 , "]" , 1 );
- buffer[plen + flen1] = 0;
- *blen = plen + flen1;
- return gp_combine_success;
+ memcpy(buffer, prefix, plen - 1 );
+ fname1 = fname + 1;
+ flen1 = flen - 1;
+ memcpy(buffer + plen - 1 , fname1, flen1);
+ memcpy(buffer + plen + flen1 - 1 , "]" , 1 );
+ buffer[plen + flen1] = 0;
+ *blen = plen + flen1;
+ return gp_combine_success;
}
if ( prefix[plen - 1] == ':' || (prefix[plen - 1] == ']' &&
- memchr(fname, ']', flen) == 0) )
+ memchr(fname, ']', flen) == 0) )
{
- /* Just concatenate. */
- if (plen + flen + 1 > *blen)
- return gp_combine_small_buffer;
- memcpy(buffer, prefix, plen);
- memcpy(buffer + plen, fname, flen);
- buffer[plen + flen] = 0;
- *blen = plen + flen;
- return gp_combine_success;
+ /* Just concatenate. */
+ if (plen + flen + 1 > *blen)
+ return gp_combine_small_buffer;
+ memcpy(buffer, prefix, plen);
+ memcpy(buffer + plen, fname, flen);
+ buffer[plen + flen] = 0;
+ *blen = plen + flen;
+ return gp_combine_success;
}
if ( memchr( prefix , '[' , plen ) == 0 &&
- memchr( prefix , '.' , plen ) == 0 )
+ memchr( prefix , '.' , plen ) == 0 )
{
- char* tmp_prefix;
- int tmp_plen;
-
- if ( prefix[0] == '/' )
- {
- tmp_prefix = prefix + 1;
- tmp_plen = plen - 1;
- }
- else
- {
- tmp_prefix = prefix;
- tmp_plen = plen;
- }
- if ( tmp_plen + flen + 2 > *blen)
- return gp_combine_small_buffer;
- memcpy(buffer, tmp_prefix, tmp_plen);
- memcpy(buffer + tmp_plen , ":" , 1 );
- memcpy(buffer + tmp_plen + 1, fname, flen);
- if ( memchr( fname , '.' , flen ) != 0 )
- {
- buffer[ tmp_plen + flen + 1] = 0;
- *blen = tmp_plen + flen + 1;
- }
- else
- {
- memcpy(buffer + tmp_plen + flen + 1 , "." , 1 );
- buffer[ tmp_plen + flen + 2] = 0;
- *blen = tmp_plen + flen + 2;
- }
- return gp_combine_success;
+ char* tmp_prefix;
+ int tmp_plen;
+
+ if ( prefix[0] == '/' )
+ {
+ tmp_prefix = prefix + 1;
+ tmp_plen = plen - 1;
+ }
+ else
+ {
+ tmp_prefix = prefix;
+ tmp_plen = plen;
+ }
+ if ( tmp_plen + flen + 2 > *blen)
+ return gp_combine_small_buffer;
+ memcpy(buffer, tmp_prefix, tmp_plen);
+ memcpy(buffer + tmp_plen , ":" , 1 );
+ memcpy(buffer + tmp_plen + 1, fname, flen);
+ if ( memchr( fname , '.' , flen ) != 0 )
+ {
+ buffer[ tmp_plen + flen + 1] = 0;
+ *blen = tmp_plen + flen + 1;
+ }
+ else
+ {
+ memcpy(buffer + tmp_plen + flen + 1 , "." , 1 );
+ buffer[ tmp_plen + flen + 2] = 0;
+ *blen = tmp_plen + flen + 2;
+ }
+ return gp_combine_success;
}
if (prefix[plen - 1] != ']' && fname[0] == '[')
return gp_combine_cant_handle;
/* Unclose "][" :*/
if (fname[0] == '[') {
- fname1 = fname + 1;
- flen1 = flen - 1;
+ fname1 = fname + 1;
+ flen1 = flen - 1;
}
if (prefix[plen - 1] == ']')
plen1 = plen - 1;
- return gp_file_name_combine_generic(prefix, plen1,
- fname1, flen1, no_sibling, buffer, blen);
+ return gp_file_name_combine_generic(prefix, plen1,
+ fname1, flen1, no_sibling, buffer, blen);
}
/* ------ Font enumeration ------ */
-
+
/* This is used to query the native os for a list of font names and
* corresponding paths. The general idea is to save the hassle of
* building a custom fontmap file.
*/
-
+
void *gp_enumerate_fonts_init(gs_memory_t *mem)
{
return NULL;
}
-
+
int gp_enumerate_fonts_next(void *enum_state, char **fontname, char **path)
{
return 0;
}
-
+
void gp_enumerate_fonts_free(void *enum_state)
{
}
/* --------- 64 bit file access ----------- */
/* fixme: Not implemented yet.
- * Currently we stub it with 32 bits access.
+ * Currently we stub it with 32 bits access.
*/
FILE *gp_fopen_64(const char *filename, const char *mode)
@@ -688,8 +686,8 @@ int64_t gp_ftell_64(FILE *strm)
int gp_fseek_64(FILE *strm, int64_t offset, int origin)
{
long offset1 = (long)offset;
-
+
if (offset != offset1)
- return -1;
+ return -1;
return fseek(strm, offset1, origin);
}
diff --git a/gs/base/gp_wgetv.c b/gs/base/gp_wgetv.c
index 2f3627425..904d10f71 100644
--- a/gs/base/gp_wgetv.c
+++ b/gs/base/gp_wgetv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,83 +21,82 @@
#include "gscdefs.h" /* for gs_productfamily and gs_revision */
/* prototypes */
-int gp_getenv_registry(HKEY hkeyroot, const char *key, const char *name,
+int gp_getenv_registry(HKEY hkeyroot, const char *key, const char *name,
char *ptr, int *plen);
/* ------ Environment variables ------ */
/* Get the value of an environment variable. See gp.h for details. */
-int
+int
gp_getenv(const char *name, char *ptr, int *plen)
{
const char *str = getenv(name);
if (str) {
- int len = strlen(str);
-
- if (len < *plen) {
- /* string fits */
- strcpy(ptr, str);
- *plen = len + 1;
- return 0;
- }
- /* string doesn't fit */
- *plen = len + 1;
- return -1;
+ int len = strlen(str);
+
+ if (len < *plen) {
+ /* string fits */
+ strcpy(ptr, str);
+ *plen = len + 1;
+ return 0;
+ }
+ /* string doesn't fit */
+ *plen = len + 1;
+ return -1;
}
/* environment variable was not found */
#ifdef __WIN32__
{
- /* If using Win32, look in the registry for a value with
- * the given name. The registry value will be under the key
- * HKEY_CURRENT_USER\Software\GPL Ghostscript\N.NN
- * or if that fails under the key
- * HKEY_LOCAL_MACHINE\Software\GPL Ghostscript\N.NN
- * where "GPL Ghostscript" is actually gs_productfamily
- * and N.NN is obtained from gs_revision.
- */
- DWORD version = GetVersion();
-
- if (!(((HIWORD(version) & 0x8000) != 0)
- && ((HIWORD(version) & 0x4000) == 0))) {
- /* not Win32s */
- int code;
- char key[256];
- char dotversion[16];
-
- sprintf(dotversion, "%d.%02d", (int)(gs_revision / 100),
- (int)(gs_revision % 100));
- sprintf(key, "Software\\%s\\%s", gs_productfamily, dotversion);
-
- code = gp_getenv_registry(HKEY_CURRENT_USER, key, name, ptr, plen);
- if ( code <= 0 )
- return code; /* found it */
-
- code = gp_getenv_registry(HKEY_LOCAL_MACHINE, key, name, ptr, plen);
- if ( code <= 0 )
- return code; /* found it */
- }
+ /* If using Win32, look in the registry for a value with
+ * the given name. The registry value will be under the key
+ * HKEY_CURRENT_USER\Software\GPL Ghostscript\N.NN
+ * or if that fails under the key
+ * HKEY_LOCAL_MACHINE\Software\GPL Ghostscript\N.NN
+ * where "GPL Ghostscript" is actually gs_productfamily
+ * and N.NN is obtained from gs_revision.
+ */
+ DWORD version = GetVersion();
+
+ if (!(((HIWORD(version) & 0x8000) != 0)
+ && ((HIWORD(version) & 0x4000) == 0))) {
+ /* not Win32s */
+ int code;
+ char key[256];
+ char dotversion[16];
+
+ sprintf(dotversion, "%d.%02d", (int)(gs_revision / 100),
+ (int)(gs_revision % 100));
+ sprintf(key, "Software\\%s\\%s", gs_productfamily, dotversion);
+
+ code = gp_getenv_registry(HKEY_CURRENT_USER, key, name, ptr, plen);
+ if ( code <= 0 )
+ return code; /* found it */
+
+ code = gp_getenv_registry(HKEY_LOCAL_MACHINE, key, name, ptr, plen);
+ if ( code <= 0 )
+ return code; /* found it */
+ }
}
#endif
/* nothing found at all */
if (*plen > 0)
- *ptr = 0;
+ *ptr = 0;
*plen = 1;
return 1;
}
-
/*
* Get a named registry value.
* Key = hkeyroot\\key, named value = name.
* name, ptr, plen and return values are the same as in gp_getenv();
*/
-int
-gp_getenv_registry(HKEY hkeyroot, const char *key, const char *name,
+int
+gp_getenv_registry(HKEY hkeyroot, const char *key, const char *name,
char *ptr, int *plen)
{
HKEY hkey;
@@ -107,22 +106,22 @@ gp_getenv_registry(HKEY hkeyroot, const char *key, const char *name,
BYTE *bptr = (BYTE *)ptr;
if (RegOpenKeyEx(hkeyroot, key, 0, KEY_READ, &hkey)
- == ERROR_SUCCESS) {
- keytype = REG_SZ;
- cbData = *plen;
- if (bptr == (char *)NULL)
- bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
- /* if ptr is NULL */
- rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
- RegCloseKey(hkey);
- if (rc == ERROR_SUCCESS) {
- *plen = cbData;
- return 0; /* found environment variable and copied it */
- } else if (rc == ERROR_MORE_DATA) {
- /* buffer wasn't large enough */
- *plen = cbData;
- return -1;
- }
+ == ERROR_SUCCESS) {
+ keytype = REG_SZ;
+ cbData = *plen;
+ if (bptr == (char *)NULL)
+ bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
+ /* if ptr is NULL */
+ rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
+ RegCloseKey(hkey);
+ if (rc == ERROR_SUCCESS) {
+ *plen = cbData;
+ return 0; /* found environment variable and copied it */
+ } else if (rc == ERROR_MORE_DATA) {
+ /* buffer wasn't large enough */
+ *plen = cbData;
+ return -1;
+ }
}
return 1; /* not found */
}
diff --git a/gs/base/gp_win32.c b/gs/base/gp_win32.c
index 6697556ad..1a42c6332 100644
--- a/gs/base/gp_win32.c
+++ b/gs/base/gp_win32.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,21 +45,21 @@ gp_get_realtime(long *pdt)
SYSTEMTIME st;
long idate;
static const int mstart[12] = {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
+ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
};
/* This gets UTC, not local time */
/* We have no way of knowing the time zone correction */
GetSystemTime(&st);
idate = (st.wYear - 1980) * 365 + /* days per year */
- ((st.wYear - 1) / 4 - 1979 / 4) + /* intervening leap days */
- (1979 / 100 - (st.wYear - 1) / 100) +
- ((st.wYear - 1) / 400 - 1979 / 400) +
- mstart[st.wMonth - 1] + /* month is 1-origin */
- st.wDay - 1; /* day of month is 1-origin */
+ ((st.wYear - 1) / 4 - 1979 / 4) + /* intervening leap days */
+ (1979 / 100 - (st.wYear - 1) / 100) +
+ ((st.wYear - 1) / 400 - 1979 / 400) +
+ mstart[st.wMonth - 1] + /* month is 1-origin */
+ st.wDay - 1; /* day of month is 1-origin */
idate += (2 < st.wMonth
- && (st.wYear % 4 == 0
- && (st.wYear % 100 != 0 || st.wYear % 400 == 0)));
+ && (st.wYear % 4 == 0
+ && (st.wYear % 100 != 0 || st.wYear % 400 == 0)));
pdt[0] = ((idate * 24 + st.wHour) * 60 + st.wMinute) * 60 + st.wSecond;
pdt[1] = st.wMilliseconds * 1000000;
}
@@ -83,13 +83,13 @@ gp_file_is_console(FILE * f)
{
#ifdef __DLL__
if (f == NULL)
- return 1;
+ return 1;
#else
if (f == NULL)
- return 0;
+ return 0;
#endif
if (fileno(f) <= 2)
- return 1;
+ return 1;
return 0;
}
diff --git a/gs/base/gp_wpapr.c b/gs/base/gp_wpapr.c
index bbdd81faa..e2faba459 100644
--- a/gs/base/gp_wpapr.c
+++ b/gs/base/gp_wpapr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,68 +27,66 @@
/* ------ Default paper size ------ */
/* Get the default paper size. See gp_paper.h for details. */
-int
+int
gp_defaultpapersize(char *ptr, int *plen)
{
char buf[6];
- char *paper = NULL;
-
+ char *paper = NULL;
+
/* Determine the default paper size using the Windows locale.
* LOCALE_IPAPERSIZE is only supported on Windows 2000 or later.
*/
- if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IPAPERSIZE,
- buf, sizeof(buf))) {
- int val = atoi(buf);
- if (val == 1)
- paper = "letter";
- else if (val == 5)
- paper = "legal";
- else if (val == 8)
- paper = "a3";
- else if (val == 9)
- paper = "a4";
+ if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_IPAPERSIZE,
+ buf, sizeof(buf))) {
+ int val = atoi(buf);
+ if (val == 1)
+ paper = "letter";
+ else if (val == 5)
+ paper = "legal";
+ else if (val == 8)
+ paper = "a3";
+ else if (val == 9)
+ paper = "a4";
}
/* Fall back to the default paper size method described in
* http://msdn.microsoft.com/en-us/library/ms801585.aspx
*/
- if ((paper == 0) &&
- GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY,
- buf, sizeof(buf))) {
- int country = atoi(buf);
- if ((country == CTRY_UNITED_STATES) ||
- (country == CTRY_CANADA) ||
- ((country >= 50) && (country < 60) && (country != CTRY_BRAZIL)) ||
- ((country >= 500) && (country < 600)) ) {
- /* Imperial measurement system */
- paper = "letter";
- }
- else {
- /* Metric measurement system */
- paper = "a4";
- }
+ if ((paper == 0) &&
+ GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY,
+ buf, sizeof(buf))) {
+ int country = atoi(buf);
+ if ((country == CTRY_UNITED_STATES) ||
+ (country == CTRY_CANADA) ||
+ ((country >= 50) && (country < 60) && (country != CTRY_BRAZIL)) ||
+ ((country >= 500) && (country < 600)) ) {
+ /* Imperial measurement system */
+ paper = "letter";
+ }
+ else {
+ /* Metric measurement system */
+ paper = "a4";
+ }
}
if (paper) {
- int len = strlen(paper);
+ int len = strlen(paper);
- if (len < *plen) {
- /* string fits */
- strcpy(ptr, paper);
- *plen = len + 1;
- return 0;
- }
- /* string doesn't fit */
- *plen = len + 1;
- return -1;
+ if (len < *plen) {
+ /* string fits */
+ strcpy(ptr, paper);
+ *plen = len + 1;
+ return 0;
+ }
+ /* string doesn't fit */
+ *plen = len + 1;
+ return -1;
}
/* No default paper size */
if (*plen > 0)
- *ptr = 0;
+ *ptr = 0;
*plen = 1;
return 1;
}
-
-
diff --git a/gs/base/gp_wsync.c b/gs/base/gp_wsync.c
index 65a2f3987..543b01f04 100644
--- a/gs/base/gp_wsync.c
+++ b/gs/base/gp_wsync.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,58 +57,57 @@ gp_semaphore_sizeof(void)
int /* if sema <> 0 rets -ve error, 0 ok; if sema == 0, 0 movable, 1 fixed */
gp_semaphore_open(
- gp_semaphore * sema /* create semaphore here */
+ gp_semaphore * sema /* create semaphore here */
)
{
win32_semaphore *const winSema = (win32_semaphore *)sema;
if (winSema) {
- winSema->handle = CreateSemaphore(NULL, 0, max_int, NULL);
- return
- (winSema->handle != NULL ? 0 :
- gs_note_error(gs_error_unknownerror));
+ winSema->handle = CreateSemaphore(NULL, 0, max_int, NULL);
+ return
+ (winSema->handle != NULL ? 0 :
+ gs_note_error(gs_error_unknownerror));
} else
- return 0; /* Win32 semaphores handles may be moved */
+ return 0; /* Win32 semaphores handles may be moved */
}
int
gp_semaphore_close(
- gp_semaphore * sema /* semaphore to affect */
+ gp_semaphore * sema /* semaphore to affect */
)
{
win32_semaphore *const winSema = (win32_semaphore *)sema;
if (winSema->handle != NULL)
- CloseHandle(winSema->handle);
+ CloseHandle(winSema->handle);
winSema->handle = NULL;
return 0;
}
int /* rets 0 ok, -ve error */
gp_semaphore_wait(
- gp_semaphore * sema /* semaphore to affect */
+ gp_semaphore * sema /* semaphore to affect */
)
{
win32_semaphore *const winSema = (win32_semaphore *)sema;
return
- (WaitForSingleObject(winSema->handle, INFINITE) == WAIT_OBJECT_0
- ? 0 : gs_error_unknownerror);
+ (WaitForSingleObject(winSema->handle, INFINITE) == WAIT_OBJECT_0
+ ? 0 : gs_error_unknownerror);
}
int /* rets 0 ok, -ve error */
gp_semaphore_signal(
- gp_semaphore * sema /* semaphore to affect */
+ gp_semaphore * sema /* semaphore to affect */
)
{
win32_semaphore *const winSema = (win32_semaphore *)sema;
return
- (ReleaseSemaphore(winSema->handle, 1, NULL) ? 0 :
- gs_error_unknownerror);
+ (ReleaseSemaphore(winSema->handle, 1, NULL) ? 0 :
+ gs_error_unknownerror);
}
-
/* Monitor supports enter/leave semantics */
typedef struct win32_monitor_s {
@@ -123,21 +122,21 @@ gp_monitor_sizeof(void)
int /* if sema <> 0 rets -ve error, 0 ok; if sema == 0, 0 movable, 1 fixed */
gp_monitor_open(
- gp_monitor * mon /* create monitor here */
+ gp_monitor * mon /* create monitor here */
)
{
win32_monitor *const winMon = (win32_monitor *)mon;
if (mon) {
- InitializeCriticalSection(&winMon->lock); /* returns no status */
- return 0;
+ InitializeCriticalSection(&winMon->lock); /* returns no status */
+ return 0;
} else
- return 1; /* Win32 critical sections mutsn't be moved */
+ return 1; /* Win32 critical sections mutsn't be moved */
}
int
gp_monitor_close(
- gp_monitor * mon /* monitor to affect */
+ gp_monitor * mon /* monitor to affect */
)
{
win32_monitor *const winMon = (win32_monitor *)mon;
@@ -148,7 +147,7 @@ gp_monitor_close(
int /* rets 0 ok, -ve error */
gp_monitor_enter(
- gp_monitor * mon /* monitor to affect */
+ gp_monitor * mon /* monitor to affect */
)
{
win32_monitor *const winMon = (win32_monitor *)mon;
@@ -159,7 +158,7 @@ gp_monitor_enter(
int /* rets 0 ok, -ve error */
gp_monitor_leave(
- gp_monitor * mon /* monitor to affect */
+ gp_monitor * mon /* monitor to affect */
)
{
win32_monitor *const winMon = (win32_monitor *)mon;
@@ -178,7 +177,7 @@ typedef struct gp_thread_creation_closure_s {
/* Origin of new threads started by gp_create_thread */
static void
gp_thread_begin_wrapper(
- void *thread_data /* gp_thread_creation_closure passed as magic data */
+ void *thread_data /* gp_thread_creation_closure passed as magic data */
)
{
gp_thread_creation_closure closure;
@@ -192,16 +191,16 @@ gp_thread_begin_wrapper(
/* Call a function on a brand new thread */
int /* 0 ok, -ve error */
gp_create_thread(
- gp_thread_creation_callback_t function, /* function to start */
- void *data /* magic data to pass to thread fn */
+ gp_thread_creation_callback_t function, /* function to start */
+ void *data /* magic data to pass to thread fn */
)
{
/* Create the magic closure that thread_wrapper gets passed */
gp_thread_creation_closure *closure =
- (gp_thread_creation_closure *)malloc(sizeof(*closure));
+ (gp_thread_creation_closure *)malloc(sizeof(*closure));
if (!closure)
- return gs_error_VMerror;
+ return gs_error_VMerror;
closure->function = function;
closure->data = data;
@@ -219,7 +218,7 @@ gp_create_thread(
if (~BEGIN_THREAD(gp_thread_begin_wrapper, 128*1024, closure) != 0)
{
free(closure);
- return 0;
+ return 0;
}
return_error(gs_error_unknownerror);
}
diff --git a/gs/base/gpcheck.h b/gs/base/gpcheck.h
index 794ec63de..064c79981 100644
--- a/gs/base/gpcheck.h
+++ b/gs/base/gpcheck.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@ int gp_check_interrupts(const gs_memory_t *mem);
# define return_if_interrupt(mem)\
{ int icode_ = gp_check_interrupts(mem); \
if ( icode_ )\
- return gs_note_error((icode_ > 0 ? gs_error_interrupt : icode_));\
+ return gs_note_error((icode_ > 0 ? gs_error_interrupt : icode_));\
}
# define return_check_interrupt(mem, code) \
return gs_return_check_interrupt(mem, code)
diff --git a/gs/base/gpgetenv.h b/gs/base/gpgetenv.h
index c8b08d449..8daa0df03 100644
--- a/gs/base/gpgetenv.h
+++ b/gs/base/gpgetenv.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gpmisc.c b/gs/base/gpmisc.c
index e33f26478..415b655a7 100644
--- a/gs/base/gpmisc.c
+++ b/gs/base/gpmisc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ gp_gettmpdir(char *ptr, int *plen)
int code = gp_getenv("TMPDIR", ptr, plen);
if (code != 1)
- return code;
+ return code;
*plen = max_len;
return gp_getenv("TEMP", ptr, plen);
}
@@ -57,37 +57,37 @@ gp_fopentemp_generic(const char *fname, const char *mode, bool b64)
#if defined (O_LARGEFILE)
/* It works for Linux/gcc. */
if (b64)
- flags |= O_LARGEFILE;
+ flags |= O_LARGEFILE;
#else
/* fixme : Not sure what to do. Unimplemented. */
/* MSVC has no O_LARGEFILE, but MSVC build never calls this function. */
#endif
while (*p)
- switch (*p++) {
- case 'a':
- flags |= O_CREAT | O_APPEND;
- break;
- case 'r':
- flags |= O_RDONLY;
- break;
- case 'w':
- flags |= O_CREAT | O_WRONLY | O_TRUNC;
- break;
+ switch (*p++) {
+ case 'a':
+ flags |= O_CREAT | O_APPEND;
+ break;
+ case 'r':
+ flags |= O_RDONLY;
+ break;
+ case 'w':
+ flags |= O_CREAT | O_WRONLY | O_TRUNC;
+ break;
#ifdef O_BINARY
- /* Watcom C insists on this non-ANSI flag being set. */
- case 'b':
- flags |= O_BINARY;
- break;
+ /* Watcom C insists on this non-ANSI flag being set. */
+ case 'b':
+ flags |= O_BINARY;
+ break;
#endif
- case '+':
- flags = (flags & ~(O_RDONLY | O_WRONLY)) | O_RDWR;
- break;
- default: /* e.g., 'b' */
- break;
- }
+ case '+':
+ flags = (flags & ~(O_RDONLY | O_WRONLY)) | O_RDWR;
+ break;
+ default: /* e.g., 'b' */
+ break;
+ }
fildes = open(fname, flags, S_IRUSR | S_IWUSR);
if (fildes < 0)
- return 0;
+ return 0;
/*
* The DEC VMS C compiler incorrectly defines the second argument of
* fdopen as (char *), rather than following the POSIX.1 standard,
@@ -95,7 +95,7 @@ gp_fopentemp_generic(const char *fname, const char *mode, bool b64)
*/
file = fdopen(fildes, (char *)mode); /* still really const */
if (file == 0)
- close(fildes);
+ close(fildes);
return file;
}
@@ -114,7 +114,7 @@ static inline bool
append(char **bp, const char *bpe, const char **ip, uint len)
{
if (bpe - *bp < len)
- return false;
+ return false;
memcpy(*bp, *ip, len);
*bp += len;
*ip += len;
@@ -126,15 +126,14 @@ static inline uint
search_separator(const char **ip, const char *ipe, const char *item, int direction)
{ uint slen = 0;
for (slen = 0; (*ip - ipe) * direction < 0; (*ip) += direction)
- if((slen = gs_file_name_check_separator(*ip, ipe - *ip, item)) != 0)
- break;
+ if((slen = gs_file_name_check_separator(*ip, ipe - *ip, item)) != 0)
+ break;
return slen;
}
-
/*
* Combine a file name with a prefix.
- * Concatenates two paths and reduce parent references and current
+ * Concatenates two paths and reduce parent references and current
* directory references from the concatenation when possible.
* The trailing zero byte is being added.
*
@@ -146,21 +145,21 @@ search_separator(const char **ip, const char *ipe, const char *item, int directi
* Also tolerates/skips leading IODevice specifiers such as %os% or %rom%
* When there is a leading '%' in the 'fname' no other processing is done.
*
- * Examples :
+ * Examples :
* "/gs/lib" + "../Resource/CMap/H" --> "/gs/Resource/CMap/H"
* "C:/gs/lib" + "../Resource/CMap/H" --> "C:/gs/Resource/CMap/H"
- * "hard disk:gs:lib" + "::Resource:CMap:H" -->
+ * "hard disk:gs:lib" + "::Resource:CMap:H" -->
* "hard disk:gs:Resource:CMap:H"
- * "DUA1:[GHOSTSCRIPT.LIB" + "-.RESOURCE.CMAP]H" -->
+ * "DUA1:[GHOSTSCRIPT.LIB" + "-.RESOURCE.CMAP]H" -->
* "DUA1:[GHOSTSCRIPT.RESOURCE.CMAP]H"
- * "\\server\share/a/b///c/../d.e/./" + "../x.e/././/../../y.z/v.v" -->
+ * "\\server\share/a/b///c/../d.e/./" + "../x.e/././/../../y.z/v.v" -->
* "\\server\share/a/y.z/v.v"
* "%rom%lib/" + "gs_init.ps" --> "%rom%lib/gs_init.ps
* "" + "%rom%lib/gs_init.ps" --> "%rom%lib/gs_init.ps"
*/
gp_file_name_combine_result
-gp_file_name_combine_generic(const char *prefix, uint plen, const char *fname, uint flen,
- bool no_sibling, char *buffer, uint *blen)
+gp_file_name_combine_generic(const char *prefix, uint plen, const char *fname, uint flen,
+ bool no_sibling, char *buffer, uint *blen)
{
/*
* THIS CODE IS SHARED FOR MULTIPLE PLATFORMS.
@@ -176,157 +175,157 @@ gp_file_name_combine_generic(const char *prefix, uint plen, const char *fname, u
/* We need a special handling of infixes only immediately after a drive. */
if ( flen > 0 && fname[0] == '%') {
- /* IoDevice -- just return the fname as-is since this */
- /* function only handles the default file system */
- /* NOTE: %os% will subvert the normal processing of prefix and fname */
- ip = fname;
- *blen = flen;
- if (!append(&bp, bpe, &ip, flen))
- return gp_combine_small_buffer;
- return gp_combine_success;
+ /* IoDevice -- just return the fname as-is since this */
+ /* function only handles the default file system */
+ /* NOTE: %os% will subvert the normal processing of prefix and fname */
+ ip = fname;
+ *blen = flen;
+ if (!append(&bp, bpe, &ip, flen))
+ return gp_combine_small_buffer;
+ return gp_combine_success;
}
if (rlen != 0) {
/* 'fname' is absolute, ignore the prefix. */
- ip = fname;
- ipe = fname + flen;
+ ip = fname;
+ ipe = fname + flen;
} else {
/* Concatenate with prefix. */
- ip = prefix;
- ipe = prefix + plen;
- rlen = gp_file_name_root(prefix, plen);
+ ip = prefix;
+ ipe = prefix + plen;
+ rlen = gp_file_name_root(prefix, plen);
}
if (!append(&bp, bpe, &ip, rlen))
- return gp_combine_small_buffer;
+ return gp_combine_small_buffer;
slen = gs_file_name_check_separator(bp, buffer - bp, bp); /* Backward search. */
if (rlen != 0 && slen == 0) {
- /* Patch it against names like "c:dir" on Windows. */
- const char *sep = gp_file_name_directory_separator();
+ /* Patch it against names like "c:dir" on Windows. */
+ const char *sep = gp_file_name_directory_separator();
- slen = strlen(sep);
- if (!append(&bp, bpe, &sep, slen))
- return gp_combine_small_buffer;
- rlen += slen;
+ slen = strlen(sep);
+ if (!append(&bp, bpe, &sep, slen))
+ return gp_combine_small_buffer;
+ rlen += slen;
}
for (;;) {
- const char *item = ip;
- uint ilen;
+ const char *item = ip;
+ uint ilen;
- slen = search_separator(&ip, ipe, item, 1);
- ilen = ip - item;
- if (ilen == 0 && !gp_file_name_is_empty_item_meanful()) {
- ip += slen;
- slen = 0;
- } else if (gp_file_name_is_current(item, ilen)) {
- /* Skip the reference to 'current', except the starting one.
- * We keep the starting 'current' for platforms, which
- * require relative paths to start with it.
- */
- if (bp == buffer) {
- if (!append(&bp, bpe, &item, ilen))
- return gp_combine_small_buffer;
- infix_type = 1;
- infix_len = ilen;
- } else {
- ip += slen;
- slen = 0;
- }
- } else if (!gp_file_name_is_parent(item, ilen)) {
- if (!append(&bp, bpe, &item, ilen))
- return gp_combine_small_buffer;
- /* The 'item' pointer is now broken; it may be restored using 'ilen'. */
- } else if (bp == buffer + rlen + infix_len) {
- /* Input is a parent and the output only contains a root and an infix. */
- if (rlen != 0)
- return gp_combine_cant_handle;
- switch (infix_type) {
- case 1:
- /* Replace the infix with parent. */
- bp = buffer + rlen; /* Drop the old infix, if any. */
- infix_len = 0;
- /* Falls through. */
- case 0:
- /* We have no infix, start with parent. */
- if ((no_sibling && ipe == fname + flen && flen != 0) ||
- !gp_file_name_is_partent_allowed())
- return gp_combine_cant_handle;
- /* Falls through. */
- case 2:
- /* Append one more parent - falls through. */
- DO_NOTHING;
- }
- if (!append(&bp, bpe, &item, ilen))
- return gp_combine_small_buffer;
- infix_type = 2;
- infix_len += ilen;
- /* Recompute the separator length. We cannot use the old slen on Mac OS. */
- slen = gs_file_name_check_separator(ip, ipe - ip, ip);
- } else {
- /* Input is a parent and the output continues after infix. */
- /* Unappend the last separator and the last item. */
- uint slen1 = gs_file_name_check_separator(bp, buffer + rlen - bp, bp); /* Backward search. */
- char *bie = bp - slen1;
+ slen = search_separator(&ip, ipe, item, 1);
+ ilen = ip - item;
+ if (ilen == 0 && !gp_file_name_is_empty_item_meanful()) {
+ ip += slen;
+ slen = 0;
+ } else if (gp_file_name_is_current(item, ilen)) {
+ /* Skip the reference to 'current', except the starting one.
+ * We keep the starting 'current' for platforms, which
+ * require relative paths to start with it.
+ */
+ if (bp == buffer) {
+ if (!append(&bp, bpe, &item, ilen))
+ return gp_combine_small_buffer;
+ infix_type = 1;
+ infix_len = ilen;
+ } else {
+ ip += slen;
+ slen = 0;
+ }
+ } else if (!gp_file_name_is_parent(item, ilen)) {
+ if (!append(&bp, bpe, &item, ilen))
+ return gp_combine_small_buffer;
+ /* The 'item' pointer is now broken; it may be restored using 'ilen'. */
+ } else if (bp == buffer + rlen + infix_len) {
+ /* Input is a parent and the output only contains a root and an infix. */
+ if (rlen != 0)
+ return gp_combine_cant_handle;
+ switch (infix_type) {
+ case 1:
+ /* Replace the infix with parent. */
+ bp = buffer + rlen; /* Drop the old infix, if any. */
+ infix_len = 0;
+ /* Falls through. */
+ case 0:
+ /* We have no infix, start with parent. */
+ if ((no_sibling && ipe == fname + flen && flen != 0) ||
+ !gp_file_name_is_partent_allowed())
+ return gp_combine_cant_handle;
+ /* Falls through. */
+ case 2:
+ /* Append one more parent - falls through. */
+ DO_NOTHING;
+ }
+ if (!append(&bp, bpe, &item, ilen))
+ return gp_combine_small_buffer;
+ infix_type = 2;
+ infix_len += ilen;
+ /* Recompute the separator length. We cannot use the old slen on Mac OS. */
+ slen = gs_file_name_check_separator(ip, ipe - ip, ip);
+ } else {
+ /* Input is a parent and the output continues after infix. */
+ /* Unappend the last separator and the last item. */
+ uint slen1 = gs_file_name_check_separator(bp, buffer + rlen - bp, bp); /* Backward search. */
+ char *bie = bp - slen1;
- bp = bie;
- DISCARD(search_separator((const char **)&bp, buffer + rlen, bp, -1));
- /* The cast above quiets a gcc warning. We believe it's a bug in the compiler. */
- /* Skip the input with separator. We cannot use slen on Mac OS. */
- ip += gs_file_name_check_separator(ip, ipe - ip, ip);
- if (no_sibling) {
- const char *p = ip;
+ bp = bie;
+ DISCARD(search_separator((const char **)&bp, buffer + rlen, bp, -1));
+ /* The cast above quiets a gcc warning. We believe it's a bug in the compiler. */
+ /* Skip the input with separator. We cannot use slen on Mac OS. */
+ ip += gs_file_name_check_separator(ip, ipe - ip, ip);
+ if (no_sibling) {
+ const char *p = ip;
- DISCARD(search_separator(&p, ipe, ip, 1));
- if (p - ip != bie - bp || memcmp(ip, bp, p - ip))
- return gp_combine_cant_handle;
- }
- slen = 0;
- }
- if (slen) {
- if (bp == buffer + rlen + infix_len)
- infix_len += slen;
- if (!append(&bp, bpe, &ip, slen))
- return gp_combine_small_buffer;
- }
- if (ip == ipe) {
- if (ipe == fname + flen) {
- /* All done.
- * Note that the case (prefix + plen == fname && flen == 0)
- * falls here without appending a separator.
- */
- const char *zero="";
+ DISCARD(search_separator(&p, ipe, ip, 1));
+ if (p - ip != bie - bp || memcmp(ip, bp, p - ip))
+ return gp_combine_cant_handle;
+ }
+ slen = 0;
+ }
+ if (slen) {
+ if (bp == buffer + rlen + infix_len)
+ infix_len += slen;
+ if (!append(&bp, bpe, &ip, slen))
+ return gp_combine_small_buffer;
+ }
+ if (ip == ipe) {
+ if (ipe == fname + flen) {
+ /* All done.
+ * Note that the case (prefix + plen == fname && flen == 0)
+ * falls here without appending a separator.
+ */
+ const char *zero="";
- if (bp == buffer) {
- /* Must not return empty path. */
- const char *current = gp_file_name_current();
- int clen = strlen(current);
+ if (bp == buffer) {
+ /* Must not return empty path. */
+ const char *current = gp_file_name_current();
+ int clen = strlen(current);
- if (!append(&bp, bpe, &current, clen))
- return gp_combine_small_buffer;
- }
- *blen = bp - buffer;
- if (!append(&bp, bpe, &zero, 1))
- return gp_combine_small_buffer;
- return gp_combine_success;
- } else {
- /* ipe == prefix + plen */
- /* Switch to fname. */
- ip = fname;
- ipe = fname + flen;
- if (slen == 0) {
- /* Insert a separator. */
- const char *sep;
-
- slen = search_separator(&ip, ipe, fname, 1);
- sep = (slen != 0 ? gp_file_name_directory_separator()
- : gp_file_name_separator());
- slen = strlen(sep);
- if (bp == buffer + rlen + infix_len)
- infix_len += slen;
- if (!append(&bp, bpe, &sep, slen))
- return gp_combine_small_buffer;
- ip = fname; /* Switch to fname. */
- }
- }
- }
+ if (!append(&bp, bpe, &current, clen))
+ return gp_combine_small_buffer;
+ }
+ *blen = bp - buffer;
+ if (!append(&bp, bpe, &zero, 1))
+ return gp_combine_small_buffer;
+ return gp_combine_success;
+ } else {
+ /* ipe == prefix + plen */
+ /* Switch to fname. */
+ ip = fname;
+ ipe = fname + flen;
+ if (slen == 0) {
+ /* Insert a separator. */
+ const char *sep;
+
+ slen = search_separator(&ip, ipe, fname, 1);
+ sep = (slen != 0 ? gp_file_name_directory_separator()
+ : gp_file_name_separator());
+ slen = strlen(sep);
+ if (bp == buffer + rlen + infix_len)
+ infix_len += slen;
+ if (!append(&bp, bpe, &sep, slen))
+ return gp_combine_small_buffer;
+ ip = fname; /* Switch to fname. */
+ }
+ }
+ }
}
}
@@ -334,14 +333,14 @@ gp_file_name_combine_generic(const char *prefix, uint plen, const char *fname, u
* Reduces parent references and current directory references when possible.
* The trailing zero byte is being added.
*
- * Examples :
+ * Examples :
* "/gs/lib/../Resource/CMap/H" --> "/gs/Resource/CMap/H"
* "C:/gs/lib/../Resource/CMap/H" --> "C:/gs/Resource/CMap/H"
- * "hard disk:gs:lib::Resource:CMap:H" -->
+ * "hard disk:gs:lib::Resource:CMap:H" -->
* "hard disk:gs:Resource:CMap:H"
- * "DUA1:[GHOSTSCRIPT.LIB.-.RESOURCE.CMAP]H" -->
+ * "DUA1:[GHOSTSCRIPT.LIB.-.RESOURCE.CMAP]H" -->
* "DUA1:[GHOSTSCRIPT.RESOURCE.CMAP]H"
- * "\\server\share/a/b///c/../d.e/./../x.e/././/../../y.z/v.v" -->
+ * "\\server\share/a/b///c/../d.e/./../x.e/././/../../y.z/v.v" -->
* "\\server\share/a/y.z/v.v"
*
*/
@@ -351,54 +350,54 @@ gp_file_name_reduce(const char *fname, uint flen, char *buffer, uint *blen)
return gp_file_name_combine(fname, flen, fname + flen, 0, false, buffer, blen);
}
-/*
- * Answers whether a file name is absolute (starts from a root).
+/*
+ * Answers whether a file name is absolute (starts from a root).
*/
-bool
+bool
gp_file_name_is_absolute(const char *fname, uint flen)
{
return (gp_file_name_root(fname, flen) > 0);
}
-/*
+/*
* Returns length of all starting parent references.
*/
-static uint
-gp_file_name_prefix(const char *fname, uint flen,
- bool (*test)(const char *fname, uint flen))
+static uint
+gp_file_name_prefix(const char *fname, uint flen,
+ bool (*test)(const char *fname, uint flen))
{
uint plen = gp_file_name_root(fname, flen), slen;
- const char *ip, *ipe;
+ const char *ip, *ipe;
const char *item = fname; /* plen == flen could cause an indeterminizm. */
if (plen > 0)
- return 0;
+ return 0;
ip = fname + plen;
ipe = fname + flen;
for (; ip < ipe; ) {
- item = ip;
- slen = search_separator(&ip, ipe, item, 1);
- if (!(*test)(item, ip - item))
- break;
- ip += slen;
+ item = ip;
+ slen = search_separator(&ip, ipe, item, 1);
+ if (!(*test)(item, ip - item))
+ break;
+ ip += slen;
}
return item - fname;
}
-/*
+/*
* Returns length of all starting parent references.
*/
-uint
+uint
gp_file_name_parents(const char *fname, uint flen)
{
- return gp_file_name_prefix(fname, flen, gp_file_name_is_parent);
+ return gp_file_name_prefix(fname, flen, gp_file_name_is_parent);
}
-/*
+/*
* Returns length of all starting cwd references.
*/
-uint
+uint
gp_file_name_cwds(const char *fname, uint flen)
{
- return gp_file_name_prefix(fname, flen, gp_file_name_is_current);
+ return gp_file_name_prefix(fname, flen, gp_file_name_is_current);
}
diff --git a/gs/base/gpmisc.h b/gs/base/gpmisc.h
index 37a20ee4e..57684e419 100644
--- a/gs/base/gpmisc.h
+++ b/gs/base/gpmisc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,31 +38,31 @@ FILE *gp_fopentemp_64(const char *fname, const char *mode);
/*
* Combine a file name with a prefix.
- * Concatenates two paths and reduce parent references and current
+ * Concatenates two paths and reduce parent references and current
* directory references from the concatenation when possible.
* The trailing zero byte is being added.
*/
-gp_file_name_combine_result gp_file_name_combine_generic(const char *prefix, uint plen,
- const char *fname, uint flen, bool no_sibling, char *buffer, uint *blen);
+gp_file_name_combine_result gp_file_name_combine_generic(const char *prefix, uint plen,
+ const char *fname, uint flen, bool no_sibling, char *buffer, uint *blen);
/*
* Reduces parent references and current directory references when possible.
* The trailing zero byte is being added.
*/
-gp_file_name_combine_result gp_file_name_reduce(const char *fname, uint flen,
- char *buffer, uint *blen);
+gp_file_name_combine_result gp_file_name_reduce(const char *fname, uint flen,
+ char *buffer, uint *blen);
-/*
- * Answers whether a file name is absolute (starts from a root).
+/*
+ * Answers whether a file name is absolute (starts from a root).
*/
bool gp_file_name_is_absolute(const char *fname, uint flen);
-/*
+/*
* Returns length of all starting parent references.
*/
uint gp_file_name_parents(const char *fname, uint flen);
-/*
+/*
* Returns length of all starting cwd references.
*/
uint gp_file_name_cwds(const char *fname, uint flen);
diff --git a/gs/base/gs_agl.h b/gs/base/gs_agl.h
index 880635233..e59f44c0d 100644
--- a/gs/base/gs_agl.h
+++ b/gs/base/gs_agl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,9 +14,9 @@
/* $Id: gs_agl_e.h 11951 2010-12-15 08:22:58Z ken */
/* Originally stored in gs/Resource/Init as gs_agl_e.ps and built into
* the ROM file system, this file was referenced by ps2write when
- * writing PostScript output. With the inclusion of ps2write in the
+ * writing PostScript output. With the inclusion of ps2write in the
* PCL and XPS interpreters we can no longer rely on the PostScript
- * resources being present, and so this file has been converted to
+ * resources being present, and so this file has been converted to
* 'C' and included as a header. The original file is now stored
* in gs/lib with the comments intact.
*/
diff --git a/gs/base/gs_dll_call.h b/gs/base/gs_dll_call.h
index 761f173b6..047a08ae5 100644
--- a/gs/base/gs_dll_call.h
+++ b/gs/base/gs_dll_call.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -13,11 +13,10 @@
/*$Id$ */
/* calling convention macros for windows style dlls.
- */
+ */
#ifndef GS_DLL_CALL_H
#define GS_DLL_CALL_H
-
#ifdef __WINDOWS__
#ifndef _Windows
# define _Windows
@@ -64,7 +63,7 @@
# define GSDLLCALLPTR * GSDLLCALL
#else
# define GSDLLAPIPTR GSDLLAPI *
-# define GSDLLCALLPTR GSDLLCALL *
+# define GSDLLCALLPTR GSDLLCALL *
#endif
#endif /* GS_DLL_CALL_H */
diff --git a/gs/base/gs_mgl_e.h b/gs/base/gs_mgl_e.h
index 4fd5c846b..81656e5cd 100644
--- a/gs/base/gs_mgl_e.h
+++ b/gs/base/gs_mgl_e.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,9 +14,9 @@
/* $Id: gs_mgl_e.h 11951 2010-12-15 08:22:58Z ken */
/* Originally stored in gs/Resource/Init as gs_mgl_e.ps and built into
* the ROM file system, this file was referenced by ps2write when
- * writing PostScript output. With the inclusion of ps2write in the
+ * writing PostScript output. With the inclusion of ps2write in the
* PCL and XPS interpreters we can no longer rely on the PostScript
- * resources being present, and so this file has been converted to
+ * resources being present, and so this file has been converted to
* 'C' and included as a header. The original file is now stored
* in gs/lib with the comments intact.
*/
diff --git a/gs/base/gs_mro_e.h b/gs/base/gs_mro_e.h
index 10fe3eff9..7fdd70c73 100644
--- a/gs/base/gs_mro_e.h
+++ b/gs/base/gs_mro_e.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,9 +14,9 @@
/* $Id: gs_mor_e.h 11951 2010-12-15 08:22:58Z ken */
/* Originally stored in gs/Resource/Init as gs_mro_e.ps and built into
* the ROM file system, this file was referenced by ps2write when
- * writing PostScript output. With the inclusion of ps2write in the
+ * writing PostScript output. With the inclusion of ps2write in the
* PCL and XPS interpreters we can no longer rely on the PostScript
- * resources being present, and so this file has been converted to
+ * resources being present, and so this file has been converted to
* 'C' and included as a header. The original file is now stored
* in gs/lib with the comments intact.
*/
diff --git a/gs/base/gsalloc.c b/gs/base/gsalloc.c
index f210fa856..a903fe01d 100644
--- a/gs/base/gsalloc.c
+++ b/gs/base/gsalloc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,6 @@
*/
/*#define CONSOLIDATE_BEFORE_ADDING_CHUNK */
-
/*
* This allocator produces tracing messages of the form
* [aNMOTS]...
@@ -50,13 +49,13 @@ alloc_trace_space(const gs_ref_memory_t *imem)
}
static void
alloc_trace(const char *chars, gs_ref_memory_t * imem, client_name_t cname,
- gs_memory_type_ptr_t stype, uint size, const void *ptr)
+ gs_memory_type_ptr_t stype, uint size, const void *ptr)
{
if_debug7('A', "[a%d%s]%s %s(%u) %s0x%lx\n",
- alloc_trace_space(imem), chars, client_name_string(cname),
- (ptr == 0 || stype == 0 ? "" :
- struct_type_name_string(stype)),
- size, (chars[1] == '+' ? "= " : ""), (ulong) ptr);
+ alloc_trace_space(imem), chars, client_name_string(cname),
+ (ptr == 0 || stype == 0 ? "" :
+ struct_type_name_string(stype)),
+ size, (chars[1] == '+' ? "= " : ""), (ulong) ptr);
}
static bool
alloc_size_is_ok(gs_memory_type_ptr_t stype)
@@ -66,9 +65,9 @@ alloc_size_is_ok(gs_memory_type_ptr_t stype)
# define ALLOC_CHECK_SIZE(stype)\
BEGIN\
if (!alloc_size_is_ok(stype)) {\
- lprintf2("size of struct type 0x%lx is 0x%lx!\n",\
- (ulong)(stype), (ulong)((stype)->ssize));\
- return 0;\
+ lprintf2("size of struct type 0x%lx is 0x%lx!\n",\
+ (ulong)(stype), (ulong)((stype)->ssize));\
+ return 0;\
}\
END
#else
@@ -81,7 +80,7 @@ alloc_size_is_ok(gs_memory_type_ptr_t stype)
* are allocated outside GC space, they reference objects within it.
*/
public_st_ref_memory();
-static
+static
ENUM_PTRS_BEGIN(ref_memory_enum_ptrs) return 0;
ENUM_PTR3(0, gs_ref_memory_t, streams, names_array, changes);
ENUM_PTR(3, gs_ref_memory_t, saved);
@@ -185,7 +184,7 @@ const gs_memory_procs_t gs_ref_memory_procs =
* or local). Does not initialize global or space.
*/
static void *ialloc_solo(gs_memory_t *, gs_memory_type_ptr_t,
- chunk_t **);
+ chunk_t **);
gs_ref_memory_t *
ialloc_alloc_state(gs_memory_t * parent, uint chunk_size)
{
@@ -193,7 +192,7 @@ ialloc_alloc_state(gs_memory_t * parent, uint chunk_size)
gs_ref_memory_t *iimem = ialloc_solo(parent, &st_ref_memory, &cp);
if (iimem == 0)
- return 0;
+ return 0;
iimem->stable_memory = (gs_memory_t *)iimem;
iimem->procs = gs_ref_memory_procs;
iimem->gs_lib_ctx = parent->gs_lib_ctx;
@@ -230,24 +229,24 @@ ialloc_alloc_state(gs_memory_t * parent, uint chunk_size)
/* Allocate a 'solo' object with its own chunk. */
static void *
ialloc_solo(gs_memory_t * parent, gs_memory_type_ptr_t pstype,
- chunk_t ** pcp)
+ chunk_t ** pcp)
{ /*
- * We can't assume that the parent uses the same object header
- * that we do, but the GC requires that allocators have
- * such a header. Therefore, we prepend one explicitly.
- */
+ * We can't assume that the parent uses the same object header
+ * that we do, but the GC requires that allocators have
+ * such a header. Therefore, we prepend one explicitly.
+ */
chunk_t *cp =
- gs_raw_alloc_struct_immovable(parent, &st_chunk,
- "ialloc_solo(chunk)");
+ gs_raw_alloc_struct_immovable(parent, &st_chunk,
+ "ialloc_solo(chunk)");
uint csize =
- ROUND_UP(sizeof(chunk_head_t) + sizeof(obj_header_t) +
- pstype->ssize,
- obj_align_mod);
+ ROUND_UP(sizeof(chunk_head_t) + sizeof(obj_header_t) +
+ pstype->ssize,
+ obj_align_mod);
byte *cdata = gs_alloc_bytes_immovable(parent, csize, "ialloc_solo");
obj_header_t *obj = (obj_header_t *) (cdata + sizeof(chunk_head_t));
if (cp == 0 || cdata == 0)
- return 0;
+ return 0;
alloc_init_chunk(cp, cdata, cdata + csize, false, (chunk_t *) NULL);
cp->cbot = cp->ctop;
cp->cprev = cp->cnext = 0;
@@ -302,14 +301,14 @@ ialloc_add_chunk(gs_ref_memory_t *imem, ulong space, client_name_t cname)
void
ialloc_gc_prepare(gs_ref_memory_t * mem)
{ /*
- * We have to unlink every stream from its neighbors,
- * so that referenced streams don't keep all streams around.
- */
+ * We have to unlink every stream from its neighbors,
+ * so that referenced streams don't keep all streams around.
+ */
while (mem->streams != 0) {
- stream *s = mem->streams;
+ stream *s = mem->streams;
- mem->streams = s->next;
- s->prev = s->next = 0;
+ mem->streams = s->next;
+ s->prev = s->next = 0;
}
}
@@ -342,7 +341,7 @@ ialloc_reset_free(gs_ref_memory_t * mem)
mem->lost.strings = 0;
mem->cfreed.cp = 0;
for (i = 0, p = &mem->freelists[0]; i < num_freelists; i++, p++)
- *p = 0;
+ *p = 0;
mem->largest_free_size = 0;
}
@@ -359,33 +358,33 @@ ialloc_reset_free(gs_ref_memory_t * mem)
void
ialloc_set_limit(register gs_ref_memory_t * mem)
{ /*
- * The following code is intended to set the limit so that
- * we stop allocating when allocated + previous_status.allocated
- * exceeds the lesser of max_vm or (if GC is enabled)
- * gc_allocated + vm_threshold.
- */
+ * The following code is intended to set the limit so that
+ * we stop allocating when allocated + previous_status.allocated
+ * exceeds the lesser of max_vm or (if GC is enabled)
+ * gc_allocated + vm_threshold.
+ */
ulong max_allocated =
(mem->gc_status.max_vm > mem->previous_status.allocated ?
mem->gc_status.max_vm - mem->previous_status.allocated :
0);
if (mem->gc_status.enabled) {
- ulong limit = mem->gc_allocated + mem->gc_status.vm_threshold;
-
- if (limit < mem->previous_status.allocated)
- mem->limit = 0;
- else {
- limit -= mem->previous_status.allocated;
- mem->limit = min(limit, max_allocated);
- }
+ ulong limit = mem->gc_allocated + mem->gc_status.vm_threshold;
+
+ if (limit < mem->previous_status.allocated)
+ mem->limit = 0;
+ else {
+ limit -= mem->previous_status.allocated;
+ mem->limit = min(limit, max_allocated);
+ }
} else
- mem->limit = min(max_allocated, mem->gc_allocated + FORCE_GC_LIMIT);
+ mem->limit = min(max_allocated, mem->gc_allocated + FORCE_GC_LIMIT);
if_debug7('0', "[0]space=%d, max_vm=%ld, prev.alloc=%ld, enabled=%d,\n\
gc_alloc=%ld, threshold=%ld => limit=%ld\n",
- mem->space, (long)mem->gc_status.max_vm,
- (long)mem->previous_status.allocated,
- mem->gc_status.enabled, (long)mem->gc_allocated,
- (long)mem->gc_status.vm_threshold, (long)mem->limit);
+ mem->space, (long)mem->gc_status.max_vm,
+ (long)mem->previous_status.allocated,
+ mem->gc_status.enabled, (long)mem->gc_allocated,
+ (long)mem->gc_status.vm_threshold, (long)mem->limit);
}
/*
@@ -400,25 +399,25 @@ i_free_all(gs_memory_t * mem, uint free_mask, client_name_t cname)
chunk_t *cp;
if (free_mask & FREE_ALL_DATA) {
- chunk_t *csucc;
-
- /*
- * Free the chunks in reverse order, to encourage LIFO behavior.
- * Don't free the chunk holding the allocator itself.
- */
- for (cp = imem->clast; cp != 0; cp = csucc) {
- csucc = cp->cprev; /* save before freeing */
- if (cp->cbase + sizeof(obj_header_t) != (byte *)mem)
- alloc_free_chunk(cp, imem);
- }
+ chunk_t *csucc;
+
+ /*
+ * Free the chunks in reverse order, to encourage LIFO behavior.
+ * Don't free the chunk holding the allocator itself.
+ */
+ for (cp = imem->clast; cp != 0; cp = csucc) {
+ csucc = cp->cprev; /* save before freeing */
+ if (cp->cbase + sizeof(obj_header_t) != (byte *)mem)
+ alloc_free_chunk(cp, imem);
+ }
}
if (free_mask & FREE_ALL_ALLOCATOR) {
- /* Free the chunk holding the allocator itself. */
- for (cp = imem->clast; cp != 0; cp = cp->cprev)
- if (cp->cbase + sizeof(obj_header_t) == (byte *)mem) {
- alloc_free_chunk(cp, imem);
- break;
- }
+ /* Free the chunk holding the allocator itself. */
+ for (cp = imem->clast; cp != 0; cp = cp->cprev)
+ if (cp->cbase + sizeof(obj_header_t) == (byte *)mem) {
+ alloc_free_chunk(cp, imem);
+ break;
+ }
}
}
@@ -490,41 +489,41 @@ gs_memory_set_vm_reclaim(gs_ref_memory_t * mem, bool enabled)
/* ptr must be declared as obj_header_t *. */
/* pfl must be declared as obj_header_t **. */
#define IF_FREELIST_ALLOC(ptr, imem, size, pstype, pfl)\
- if ( size <= max_freelist_size &&\
- *(pfl = &imem->freelists[(size + obj_align_mask) >> log2_obj_align_mod]) != 0\
- )\
- { ptr = *pfl;\
- *pfl = *(obj_header_t **)ptr;\
- ptr[-1].o_size = size;\
- ptr[-1].o_type = pstype;\
- /* If debugging, clear the block in an attempt to */\
- /* track down uninitialized data errors. */\
- gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
+ if ( size <= max_freelist_size &&\
+ *(pfl = &imem->freelists[(size + obj_align_mask) >> log2_obj_align_mod]) != 0\
+ )\
+ { ptr = *pfl;\
+ *pfl = *(obj_header_t **)ptr;\
+ ptr[-1].o_size = size;\
+ ptr[-1].o_type = pstype;\
+ /* If debugging, clear the block in an attempt to */\
+ /* track down uninitialized data errors. */\
+ gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
#define ELSEIF_BIG_FREELIST_ALLOC(ptr, imem, size, pstype)\
- }\
- else if (size > max_freelist_size &&\
- (ptr = large_freelist_alloc(imem, size)) != 0)\
- { ptr[-1].o_type = pstype;\
- /* If debugging, clear the block in an attempt to */\
- /* track down uninitialized data errors. */\
- gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
+ }\
+ else if (size > max_freelist_size &&\
+ (ptr = large_freelist_alloc(imem, size)) != 0)\
+ { ptr[-1].o_type = pstype;\
+ /* If debugging, clear the block in an attempt to */\
+ /* track down uninitialized data errors. */\
+ gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
#define ELSEIF_LIFO_ALLOC(ptr, imem, size, pstype)\
- }\
- else if ( (imem->cc.ctop - (byte *)(ptr = (obj_header_t *)imem->cc.cbot))\
- >= size + (obj_align_mod + sizeof(obj_header_t) * 2) &&\
- size < imem->large_size\
- )\
- { imem->cc.cbot = (byte *)ptr + obj_size_round(size);\
- ptr->o_alone = 0;\
- ptr->o_size = size;\
- ptr->o_type = pstype;\
- ptr++;\
- /* If debugging, clear the block in an attempt to */\
- /* track down uninitialized data errors. */\
- gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
+ }\
+ else if ( (imem->cc.ctop - (byte *)(ptr = (obj_header_t *)imem->cc.cbot))\
+ >= size + (obj_align_mod + sizeof(obj_header_t) * 2) &&\
+ size < imem->large_size\
+ )\
+ { imem->cc.cbot = (byte *)ptr + obj_size_round(size);\
+ ptr->o_alone = 0;\
+ ptr->o_size = size;\
+ ptr->o_type = pstype;\
+ ptr++;\
+ /* If debugging, clear the block in an attempt to */\
+ /* track down uninitialized data errors. */\
+ gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
#define ELSE_ALLOC\
- }\
- else
+ }\
+ else
static byte *
i_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
@@ -534,20 +533,20 @@ i_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
obj_header_t **pfl;
IF_FREELIST_ALLOC(obj, imem, size, &st_bytes, pfl)
- alloc_trace(":+bf", imem, cname, NULL, size, obj);
+ alloc_trace(":+bf", imem, cname, NULL, size, obj);
ELSEIF_BIG_FREELIST_ALLOC(obj, imem, size, &st_bytes)
- alloc_trace(":+bF", imem, cname, NULL, size, obj);
+ alloc_trace(":+bF", imem, cname, NULL, size, obj);
ELSEIF_LIFO_ALLOC(obj, imem, size, &st_bytes)
- alloc_trace(":+b ", imem, cname, NULL, size, obj);
+ alloc_trace(":+b ", imem, cname, NULL, size, obj);
ELSE_ALLOC
{
- obj = alloc_obj(imem, size, &st_bytes, 0, cname);
- if (obj == 0)
- return 0;
- alloc_trace(":+b.", imem, cname, NULL, size, obj);
+ obj = alloc_obj(imem, size, &st_bytes, 0, cname);
+ if (obj == 0)
+ return 0;
+ alloc_trace(":+b.", imem, cname, NULL, size, obj);
}
#if IGC_PTR_STABILITY_CHECK
- obj[-1].d.o.space_id = imem->space_id;
+ obj[-1].d.o.space_id = imem->space_id;
#endif
return (byte *) obj;
}
@@ -556,16 +555,16 @@ i_alloc_bytes_immovable(gs_memory_t * mem, uint size, client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj = alloc_obj(imem, size, &st_bytes,
- ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
+ ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
if (obj == 0)
- return 0;
+ return 0;
alloc_trace("|+b.", imem, cname, NULL, size, obj);
return (byte *) obj;
}
static void *
i_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
uint size = pstype->ssize;
@@ -574,26 +573,26 @@ i_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
ALLOC_CHECK_SIZE(pstype);
IF_FREELIST_ALLOC(obj, imem, size, pstype, pfl)
- alloc_trace(":+<f", imem, cname, pstype, size, obj);
+ alloc_trace(":+<f", imem, cname, pstype, size, obj);
ELSEIF_BIG_FREELIST_ALLOC(obj, imem, size, pstype)
- alloc_trace(":+<F", imem, cname, pstype, size, obj);
+ alloc_trace(":+<F", imem, cname, pstype, size, obj);
ELSEIF_LIFO_ALLOC(obj, imem, size, pstype)
- alloc_trace(":+< ", imem, cname, pstype, size, obj);
+ alloc_trace(":+< ", imem, cname, pstype, size, obj);
ELSE_ALLOC
{
- obj = alloc_obj(imem, size, pstype, 0, cname);
- if (obj == 0)
- return 0;
- alloc_trace(":+<.", imem, cname, pstype, size, obj);
+ obj = alloc_obj(imem, size, pstype, 0, cname);
+ if (obj == 0)
+ return 0;
+ alloc_trace(":+<.", imem, cname, pstype, size, obj);
}
#if IGC_PTR_STABILITY_CHECK
- obj[-1].d.o.space_id = imem->space_id;
+ obj[-1].d.o.space_id = imem->space_id;
#endif
return obj;
}
static void *
i_alloc_struct_immovable(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
uint size = pstype->ssize;
@@ -606,36 +605,36 @@ i_alloc_struct_immovable(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
}
static byte *
i_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj = alloc_obj(imem, (ulong) num_elements * elt_size,
- &st_bytes, ALLOC_DIRECT, cname);
+ &st_bytes, ALLOC_DIRECT, cname);
if_debug6('A', "[a%d:+b.]%s -bytes-*(%lu=%u*%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname),
- (ulong) num_elements * elt_size,
- num_elements, elt_size, (ulong) obj);
+ alloc_trace_space(imem), client_name_string(cname),
+ (ulong) num_elements * elt_size,
+ num_elements, elt_size, (ulong) obj);
return (byte *) obj;
}
static byte *
i_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj = alloc_obj(imem, (ulong) num_elements * elt_size,
- &st_bytes, ALLOC_IMMOVABLE | ALLOC_DIRECT,
- cname);
+ &st_bytes, ALLOC_IMMOVABLE | ALLOC_DIRECT,
+ cname);
if_debug6('A', "[a%d|+b.]%s -bytes-*(%lu=%u*%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname),
- (ulong) num_elements * elt_size,
- num_elements, elt_size, (ulong) obj);
+ alloc_trace_space(imem), client_name_string(cname),
+ (ulong) num_elements * elt_size,
+ num_elements, elt_size, (ulong) obj);
return (byte *) obj;
}
static void *
i_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj;
@@ -643,42 +642,42 @@ i_alloc_struct_array(gs_memory_t * mem, uint num_elements,
ALLOC_CHECK_SIZE(pstype);
#ifdef DEBUG
if (pstype->enum_ptrs == basic_enum_ptrs) {
- dprintf2(" i_alloc_struct_array: called with incorrect structure type (not element), struct='%s', client='%s'\n",
- pstype->sname, cname);
- return NULL; /* fail */
+ dprintf2(" i_alloc_struct_array: called with incorrect structure type (not element), struct='%s', client='%s'\n",
+ pstype->sname, cname);
+ return NULL; /* fail */
}
#endif
obj = alloc_obj(imem,
- (ulong) num_elements * pstype->ssize,
- pstype, ALLOC_DIRECT, cname);
+ (ulong) num_elements * pstype->ssize,
+ pstype, ALLOC_DIRECT, cname);
if_debug7('A', "[a%d:+<.]%s %s*(%lu=%u*%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname),
- struct_type_name_string(pstype),
- (ulong) num_elements * pstype->ssize,
- num_elements, pstype->ssize, (ulong) obj);
+ alloc_trace_space(imem), client_name_string(cname),
+ struct_type_name_string(pstype),
+ (ulong) num_elements * pstype->ssize,
+ num_elements, pstype->ssize, (ulong) obj);
return (char *)obj;
}
static void *
i_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj;
ALLOC_CHECK_SIZE(pstype);
obj = alloc_obj(imem,
- (ulong) num_elements * pstype->ssize,
- pstype, ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
+ (ulong) num_elements * pstype->ssize,
+ pstype, ALLOC_IMMOVABLE | ALLOC_DIRECT, cname);
if_debug7('A', "[a%d|+<.]%s %s*(%lu=%u*%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname),
- struct_type_name_string(pstype),
- (ulong) num_elements * pstype->ssize,
- num_elements, pstype->ssize, (ulong) obj);
+ alloc_trace_space(imem), client_name_string(cname),
+ struct_type_name_string(pstype),
+ (ulong) num_elements * pstype->ssize,
+ num_elements, pstype->ssize, (ulong) obj);
return (char *)obj;
}
static void *
i_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *pp = (obj_header_t *) obj - 1;
@@ -690,34 +689,34 @@ i_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements,
void *new_obj = NULL;
if (old_size_rounded == new_size_rounded) {
- pp->o_size = new_size;
- new_obj = obj;
+ pp->o_size = new_size;
+ new_obj = obj;
} else
- if ((byte *)obj + old_size_rounded == imem->cc.cbot &&
- imem->cc.ctop - (byte *)obj >= new_size_rounded ) {
- imem->cc.cbot = (byte *)obj + new_size_rounded;
- pp->o_size = new_size;
- new_obj = obj;
- } else /* try and trim the object -- but only if room for a dummy header */
- if (new_size_rounded + sizeof(obj_header_t) <= old_size_rounded) {
- trim_obj(imem, obj, new_size, (chunk_t *)0);
- new_obj = obj;
- }
+ if ((byte *)obj + old_size_rounded == imem->cc.cbot &&
+ imem->cc.ctop - (byte *)obj >= new_size_rounded ) {
+ imem->cc.cbot = (byte *)obj + new_size_rounded;
+ pp->o_size = new_size;
+ new_obj = obj;
+ } else /* try and trim the object -- but only if room for a dummy header */
+ if (new_size_rounded + sizeof(obj_header_t) <= old_size_rounded) {
+ trim_obj(imem, obj, new_size, (chunk_t *)0);
+ new_obj = obj;
+ }
if (new_obj) {
- if_debug8('A', "[a%d:%c%c ]%s %s(%lu=>%lu) 0x%lx\n",
- alloc_trace_space(imem),
- (new_size > old_size ? '>' : '<'),
- (pstype == &st_bytes ? 'b' : '<'),
- client_name_string(cname),
- struct_type_name_string(pstype),
- old_size, new_size, (ulong) obj);
- return new_obj;
+ if_debug8('A', "[a%d:%c%c ]%s %s(%lu=>%lu) 0x%lx\n",
+ alloc_trace_space(imem),
+ (new_size > old_size ? '>' : '<'),
+ (pstype == &st_bytes ? 'b' : '<'),
+ client_name_string(cname),
+ struct_type_name_string(pstype),
+ old_size, new_size, (ulong) obj);
+ return new_obj;
}
/* Punt. */
new_obj = gs_alloc_struct_array(mem, new_num_elements, void,
- pstype, cname);
+ pstype, cname);
if (new_obj == 0)
- return 0;
+ return 0;
memcpy(new_obj, obj, min(old_size, new_size));
gs_free_object(mem, obj, cname);
return new_obj;
@@ -734,45 +733,45 @@ i_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
uint size, rounded_size;
if (ptr == 0)
- return;
+ return;
pp = (obj_header_t *) ptr - 1;
pstype = pp->o_type;
#ifdef DEBUG
if (gs_debug_c('?')) {
- chunk_locator_t cld;
-
- if (pstype == &st_free) {
- lprintf2("%s: object 0x%lx already free!\n",
- client_name_string(cname), (ulong) ptr);
- return; /*gs_abort(); */
- }
- /* Check that this allocator owns the object being freed. */
- cld.memory = imem;
- while ((cld.cp = cld.memory->clast),
- !chunk_locate_ptr(ptr, &cld)
- ) {
- if (!cld.memory->saved) {
- lprintf3("%s: freeing 0x%lx, not owned by memory 0x%lx!\n",
- client_name_string(cname), (ulong) ptr,
- (ulong) mem);
- return; /*gs_abort(); */
- }
- /****** HACK: we know the saved state is the first ******
- ****** member of an alloc_save_t. ******/
- cld.memory = (gs_ref_memory_t *) cld.memory->saved;
- }
- /* Check that the object is in the allocated region. */
- if (cld.memory == imem && cld.cp == imem->pcc)
- cld.cp = &imem->cc;
- if (!(PTR_BETWEEN((const byte *)pp, cld.cp->cbase,
- cld.cp->cbot))
- ) {
- lprintf5("%s: freeing 0x%lx,\n\toutside chunk 0x%lx cbase=0x%lx, cbot=0x%lx!\n",
- client_name_string(cname), (ulong) ptr,
- (ulong) cld.cp, (ulong) cld.cp->cbase,
- (ulong) cld.cp->cbot);
- return; /*gs_abort(); */
- }
+ chunk_locator_t cld;
+
+ if (pstype == &st_free) {
+ lprintf2("%s: object 0x%lx already free!\n",
+ client_name_string(cname), (ulong) ptr);
+ return; /*gs_abort(); */
+ }
+ /* Check that this allocator owns the object being freed. */
+ cld.memory = imem;
+ while ((cld.cp = cld.memory->clast),
+ !chunk_locate_ptr(ptr, &cld)
+ ) {
+ if (!cld.memory->saved) {
+ lprintf3("%s: freeing 0x%lx, not owned by memory 0x%lx!\n",
+ client_name_string(cname), (ulong) ptr,
+ (ulong) mem);
+ return; /*gs_abort(); */
+ }
+ /****** HACK: we know the saved state is the first ******
+ ****** member of an alloc_save_t. ******/
+ cld.memory = (gs_ref_memory_t *) cld.memory->saved;
+ }
+ /* Check that the object is in the allocated region. */
+ if (cld.memory == imem && cld.cp == imem->pcc)
+ cld.cp = &imem->cc;
+ if (!(PTR_BETWEEN((const byte *)pp, cld.cp->cbase,
+ cld.cp->cbot))
+ ) {
+ lprintf5("%s: freeing 0x%lx,\n\toutside chunk 0x%lx cbase=0x%lx, cbot=0x%lx!\n",
+ client_name_string(cname), (ulong) ptr,
+ (ulong) cld.cp, (ulong) cld.cp->cbase,
+ (ulong) cld.cp->cbot);
+ return; /*gs_abort(); */
+ }
}
#endif
size = pre_obj_contents_size(pp);
@@ -786,88 +785,88 @@ i_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
if (gs_debug['a'] || gs_debug['A'])
saved_stype = *pstype;
- if_debug3('u', "[u]finalizing %s 0x%lx (%s)\n",
- struct_type_name_string(pstype),
- (ulong) ptr, client_name_string(cname));
- (*finalize) (ptr);
+ if_debug3('u', "[u]finalizing %s 0x%lx (%s)\n",
+ struct_type_name_string(pstype),
+ (ulong) ptr, client_name_string(cname));
+ (*finalize) (ptr);
if (gs_debug['a'] || gs_debug['A'])
pstype = &saved_stype;
}
if ((byte *) ptr + rounded_size == imem->cc.cbot) {
- alloc_trace(":-o ", imem, cname, pstype, size, ptr);
- gs_alloc_fill(ptr, gs_alloc_fill_free, size);
- imem->cc.cbot = (byte *) pp;
- /* IFF this object is adjacent to (or below) the byte after the
- * highest free object, do the consolidation within this chunk. */
- if ((byte *)pp <= imem->cc.int_freed_top) {
- consolidate_chunk_free(&(imem->cc), imem);
- }
- return;
+ alloc_trace(":-o ", imem, cname, pstype, size, ptr);
+ gs_alloc_fill(ptr, gs_alloc_fill_free, size);
+ imem->cc.cbot = (byte *) pp;
+ /* IFF this object is adjacent to (or below) the byte after the
+ * highest free object, do the consolidation within this chunk. */
+ if ((byte *)pp <= imem->cc.int_freed_top) {
+ consolidate_chunk_free(&(imem->cc), imem);
+ }
+ return;
}
if (pp->o_alone) {
- /*
- * We gave this object its own chunk. Free the entire chunk,
- * unless it belongs to an older save level, in which case
- * we mustn't overwrite it.
- */
- chunk_locator_t cl;
+ /*
+ * We gave this object its own chunk. Free the entire chunk,
+ * unless it belongs to an older save level, in which case
+ * we mustn't overwrite it.
+ */
+ chunk_locator_t cl;
#ifdef DEBUG
- {
- chunk_locator_t cld;
-
- cld.memory = imem;
- cld.cp = 0;
- if (gs_debug_c('a'))
- alloc_trace(
- (chunk_locate_ptr(ptr, &cld) ? ":-oL" : ":-o~"),
- imem, cname, pstype, size, ptr);
- }
+ {
+ chunk_locator_t cld;
+
+ cld.memory = imem;
+ cld.cp = 0;
+ if (gs_debug_c('a'))
+ alloc_trace(
+ (chunk_locate_ptr(ptr, &cld) ? ":-oL" : ":-o~"),
+ imem, cname, pstype, size, ptr);
+ }
#endif
- cl.memory = imem;
- cl.cp = 0;
- if (chunk_locate_ptr(ptr, &cl)) {
- if (!imem->is_controlled)
- alloc_free_chunk(cl.cp, imem);
- return;
- }
- /* Don't overwrite even if gs_alloc_debug is set. */
+ cl.memory = imem;
+ cl.cp = 0;
+ if (chunk_locate_ptr(ptr, &cl)) {
+ if (!imem->is_controlled)
+ alloc_free_chunk(cl.cp, imem);
+ return;
+ }
+ /* Don't overwrite even if gs_alloc_debug is set. */
}
if (rounded_size >= sizeof(obj_header_t *)) {
- /*
- * Put the object on a freelist, unless it belongs to
- * an older save level, in which case we mustn't
- * overwrite it.
- */
- imem->cfreed.memory = imem;
- if (chunk_locate(ptr, &imem->cfreed)) {
- obj_header_t **pfl;
-
- if (size > max_freelist_size) {
- pfl = &imem->freelists[LARGE_FREELIST_INDEX];
- if (rounded_size > imem->largest_free_size)
- imem->largest_free_size = rounded_size;
- } else {
- pfl = &imem->freelists[(size + obj_align_mask) >>
- log2_obj_align_mod];
- }
- /* keep track of highest object on a freelist */
- if ((byte *)pp >= imem->cc.int_freed_top)
- imem->cc.int_freed_top = (byte *)ptr + rounded_size;
- pp->o_type = &st_free; /* don't confuse GC */
- o_set_unmarked(pp);
- gs_alloc_fill(ptr, gs_alloc_fill_free, size);
- *(obj_header_t **) ptr = *pfl;
- *pfl = (obj_header_t *) ptr;
- alloc_trace((size > max_freelist_size ? ":-oF" : ":-of"),
- imem, cname, pstype, size, ptr);
- return;
- }
- /* Don't overwrite even if gs_alloc_debug is set. */
+ /*
+ * Put the object on a freelist, unless it belongs to
+ * an older save level, in which case we mustn't
+ * overwrite it.
+ */
+ imem->cfreed.memory = imem;
+ if (chunk_locate(ptr, &imem->cfreed)) {
+ obj_header_t **pfl;
+
+ if (size > max_freelist_size) {
+ pfl = &imem->freelists[LARGE_FREELIST_INDEX];
+ if (rounded_size > imem->largest_free_size)
+ imem->largest_free_size = rounded_size;
+ } else {
+ pfl = &imem->freelists[(size + obj_align_mask) >>
+ log2_obj_align_mod];
+ }
+ /* keep track of highest object on a freelist */
+ if ((byte *)pp >= imem->cc.int_freed_top)
+ imem->cc.int_freed_top = (byte *)ptr + rounded_size;
+ pp->o_type = &st_free; /* don't confuse GC */
+ o_set_unmarked(pp);
+ gs_alloc_fill(ptr, gs_alloc_fill_free, size);
+ *(obj_header_t **) ptr = *pfl;
+ *pfl = (obj_header_t *) ptr;
+ alloc_trace((size > max_freelist_size ? ":-oF" : ":-of"),
+ imem, cname, pstype, size, ptr);
+ return;
+ }
+ /* Don't overwrite even if gs_alloc_debug is set. */
} else {
- pp->o_type = &st_free; /* don't confuse GC */
- gs_alloc_fill(ptr, gs_alloc_fill_free, size);
+ pp->o_type = &st_free; /* don't confuse GC */
+ gs_alloc_fill(ptr, gs_alloc_fill_free, size);
}
alloc_trace(":-o#", imem, cname, pstype, size, ptr);
imem->lost.objects += obj_size_round(size);
@@ -884,50 +883,50 @@ i_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
chunk_t *cp_orig = imem->pcc;
if (cp_orig == 0) {
- /* Open an arbitrary chunk. */
- cp_orig = imem->pcc = imem->cfirst;
- alloc_open_chunk(imem);
+ /* Open an arbitrary chunk. */
+ cp_orig = imem->pcc = imem->cfirst;
+ alloc_open_chunk(imem);
}
top:
if (imem->cc.ctop - imem->cc.cbot > nbytes) {
- if_debug4('A', "[a%d:+> ]%s(%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname), nbytes,
- (ulong) (imem->cc.ctop - nbytes));
- str = imem->cc.ctop -= nbytes;
- gs_alloc_fill(str, gs_alloc_fill_alloc, nbytes);
- return str;
+ if_debug4('A', "[a%d:+> ]%s(%u) = 0x%lx\n",
+ alloc_trace_space(imem), client_name_string(cname), nbytes,
+ (ulong) (imem->cc.ctop - nbytes));
+ str = imem->cc.ctop -= nbytes;
+ gs_alloc_fill(str, gs_alloc_fill_alloc, nbytes);
+ return str;
}
/* Try the next chunk. */
{
- chunk_t *cp = imem->cc.cnext;
-
- alloc_close_chunk(imem);
- if (cp == 0)
- cp = imem->cfirst;
- imem->pcc = cp;
- alloc_open_chunk(imem);
- if (cp != cp_orig)
- goto top;
+ chunk_t *cp = imem->cc.cnext;
+
+ alloc_close_chunk(imem);
+ if (cp == 0)
+ cp = imem->cfirst;
+ imem->pcc = cp;
+ alloc_open_chunk(imem);
+ if (cp != cp_orig)
+ goto top;
}
if (nbytes > string_space_quanta(max_uint - sizeof(chunk_head_t)) *
- string_data_quantum
- ) { /* Can't represent the size in a uint! */
- return 0;
+ string_data_quantum
+ ) { /* Can't represent the size in a uint! */
+ return 0;
}
if (nbytes >= imem->large_size) { /* Give it a chunk all its own. */
- return i_alloc_string_immovable(mem, nbytes, cname);
+ return i_alloc_string_immovable(mem, nbytes, cname);
} else { /* Add another chunk. */
- chunk_t *cp =
- alloc_acquire_chunk(imem, (ulong) imem->chunk_size, true, "chunk");
-
- if (cp == 0)
- return 0;
- alloc_close_chunk(imem);
- imem->pcc = cp;
- imem->cc = *imem->pcc;
- gs_alloc_fill(imem->cc.cbase, gs_alloc_fill_free,
- imem->cc.climit - imem->cc.cbase);
- goto top;
+ chunk_t *cp =
+ alloc_acquire_chunk(imem, (ulong) imem->chunk_size, true, "chunk");
+
+ if (cp == 0)
+ return 0;
+ alloc_close_chunk(imem);
+ imem->pcc = cp;
+ imem->cc = *imem->pcc;
+ gs_alloc_fill(imem->cc.cbase, gs_alloc_fill_free,
+ imem->cc.climit - imem->cc.cbase);
+ goto top;
}
}
static byte *
@@ -938,20 +937,20 @@ i_alloc_string_immovable(gs_memory_t * mem, uint nbytes, client_name_t cname)
/* Give it a chunk all its own. */
uint asize = string_chunk_space(nbytes) + sizeof(chunk_head_t);
chunk_t *cp = alloc_acquire_chunk(imem, (ulong) asize, true,
- "large string chunk");
+ "large string chunk");
if (cp == 0)
- return 0;
+ return 0;
str = cp->ctop = cp->climit - nbytes;
if_debug4('a', "[a%d|+>L]%s(%u) = 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname), nbytes,
- (ulong) str);
+ alloc_trace_space(imem), client_name_string(cname), nbytes,
+ (ulong) str);
gs_alloc_fill(str, gs_alloc_fill_alloc, nbytes);
return str;
}
static byte *
i_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
byte *ptr;
@@ -959,59 +958,59 @@ i_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
if (old_num == new_num) /* same size returns the same string */
return data;
if (data == imem->cc.ctop && /* bottom-most string */
- (new_num < old_num ||
- imem->cc.ctop - imem->cc.cbot > new_num - old_num)
- ) { /* Resize in place. */
- ptr = data + old_num - new_num;
- if_debug6('A', "[a%d:%c> ]%s(%u->%u) 0x%lx\n",
- alloc_trace_space(imem),
- (new_num > old_num ? '>' : '<'),
- client_name_string(cname), old_num, new_num,
- (ulong) ptr);
- imem->cc.ctop = ptr;
- memmove(ptr, data, min(old_num, new_num));
+ (new_num < old_num ||
+ imem->cc.ctop - imem->cc.cbot > new_num - old_num)
+ ) { /* Resize in place. */
+ ptr = data + old_num - new_num;
+ if_debug6('A', "[a%d:%c> ]%s(%u->%u) 0x%lx\n",
+ alloc_trace_space(imem),
+ (new_num > old_num ? '>' : '<'),
+ client_name_string(cname), old_num, new_num,
+ (ulong) ptr);
+ imem->cc.ctop = ptr;
+ memmove(ptr, data, min(old_num, new_num));
#ifdef DEBUG
- if (new_num > old_num)
- gs_alloc_fill(ptr + old_num, gs_alloc_fill_alloc,
- new_num - old_num);
- else
- gs_alloc_fill(data, gs_alloc_fill_free, old_num - new_num);
+ if (new_num > old_num)
+ gs_alloc_fill(ptr + old_num, gs_alloc_fill_alloc,
+ new_num - old_num);
+ else
+ gs_alloc_fill(data, gs_alloc_fill_free, old_num - new_num);
#endif
} else
- if (new_num < old_num) {
- /* trim the string and create a free space hole */
- ptr = data;
- imem->lost.strings += old_num - new_num;
- gs_alloc_fill(data + new_num, gs_alloc_fill_free,
- old_num - new_num);
- if_debug5('A', "[a%d:<> ]%s(%u->%u) 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname),
- old_num, new_num, (ulong)ptr);
+ if (new_num < old_num) {
+ /* trim the string and create a free space hole */
+ ptr = data;
+ imem->lost.strings += old_num - new_num;
+ gs_alloc_fill(data + new_num, gs_alloc_fill_free,
+ old_num - new_num);
+ if_debug5('A', "[a%d:<> ]%s(%u->%u) 0x%lx\n",
+ alloc_trace_space(imem), client_name_string(cname),
+ old_num, new_num, (ulong)ptr);
} else { /* Punt. */
- ptr = gs_alloc_string(mem, new_num, cname);
- if (ptr == 0)
- return 0;
- memcpy(ptr, data, min(old_num, new_num));
- gs_free_string(mem, data, old_num, cname);
- }
+ ptr = gs_alloc_string(mem, new_num, cname);
+ if (ptr == 0)
+ return 0;
+ memcpy(ptr, data, min(old_num, new_num));
+ gs_free_string(mem, data, old_num, cname);
+ }
return ptr;
}
static void
i_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
if (data == imem->cc.ctop) {
- if_debug4('A', "[a%d:-> ]%s(%u) 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname), nbytes,
- (ulong) data);
- imem->cc.ctop += nbytes;
+ if_debug4('A', "[a%d:-> ]%s(%u) 0x%lx\n",
+ alloc_trace_space(imem), client_name_string(cname), nbytes,
+ (ulong) data);
+ imem->cc.ctop += nbytes;
} else {
- if_debug4('A', "[a%d:->#]%s(%u) 0x%lx\n",
- alloc_trace_space(imem), client_name_string(cname), nbytes,
- (ulong) data);
- imem->lost.strings += nbytes;
+ if_debug4('A', "[a%d:->#]%s(%u) 0x%lx\n",
+ alloc_trace_space(imem), client_name_string(cname), nbytes,
+ (ulong) data);
+ imem->lost.strings += nbytes;
}
gs_alloc_fill(data, gs_alloc_fill_free, nbytes);
}
@@ -1034,20 +1033,20 @@ i_status(gs_memory_t * mem, gs_memory_status_t * pstat)
/* Also keep track of space allocated to inner chunks, */
/* which are included in previous_status.allocated. */
{
- const chunk_t *cp = imem->cfirst;
-
- while (cp != 0) {
- unused += cp->ctop - cp->cbot;
- if (cp->outer)
- inner += cp->cend - (byte *) cp->chead;
- cp = cp->cnext;
- }
+ const chunk_t *cp = imem->cfirst;
+
+ while (cp != 0) {
+ unused += cp->ctop - cp->cbot;
+ if (cp->outer)
+ inner += cp->cend - (byte *) cp->chead;
+ cp = cp->cnext;
+ }
}
unused += compute_free_objects(imem);
pstat->used = imem->allocated + inner - unused +
- imem->previous_status.used;
+ imem->previous_status.used;
pstat->allocated = imem->allocated +
- imem->previous_status.allocated;
+ imem->previous_status.allocated;
pstat->is_thread_safe = false; /* this allocator is not thread safe */
}
@@ -1055,11 +1054,11 @@ static void
i_enable_free(gs_memory_t * mem, bool enable)
{
if (enable)
- mem->procs.free_object = i_free_object,
- mem->procs.free_string = i_free_string;
+ mem->procs.free_object = i_free_object,
+ mem->procs.free_string = i_free_string;
else
- mem->procs.free_object = gs_ignore_free_object,
- mem->procs.free_string = gs_ignore_free_string;
+ mem->procs.free_object = gs_ignore_free_object,
+ mem->procs.free_string = gs_ignore_free_string;
}
/* ------ Internal procedures ------ */
@@ -1073,16 +1072,16 @@ compute_free_objects(gs_ref_memory_t * mem)
/* Add up space on free lists. */
for (i = 0; i < num_freelists; i++) {
- const obj_header_t *pfree;
+ const obj_header_t *pfree;
- for (pfree = mem->freelists[i]; pfree != 0;
- pfree = *(const obj_header_t * const *)pfree
- )
- unused += obj_align_round(pfree[-1].o_size);
+ for (pfree = mem->freelists[i]; pfree != 0;
+ pfree = *(const obj_header_t * const *)pfree
+ )
+ unused += obj_align_round(pfree[-1].o_size);
}
return unused;
}
-
+
/* Allocate an object from the large-block freelist. */
static obj_header_t * /* rets obj if allocated, else 0 */
large_freelist_alloc(gs_ref_memory_t *mem, uint size)
@@ -1092,7 +1091,7 @@ large_freelist_alloc(gs_ref_memory_t *mem, uint size)
uint aligned_size = obj_align_round(size);
uint aligned_min_size = aligned_size + sizeof(obj_header_t);
uint aligned_max_size =
- aligned_min_size + obj_align_round(aligned_min_size / 8);
+ aligned_min_size + obj_align_round(aligned_min_size / 8);
obj_header_t *best_fit = 0;
obj_header_t **best_fit_prev = NULL; /* Initialize against indeteminizm. */
uint best_fit_size = max_uint;
@@ -1101,32 +1100,32 @@ large_freelist_alloc(gs_ref_memory_t *mem, uint size)
uint largest_size = 0;
if (aligned_size > mem->largest_free_size)
- return 0; /* definitely no block large enough */
+ return 0; /* definitely no block large enough */
while ((pfree = *ppfprev) != 0) {
- uint free_size = obj_align_round(pfree[-1].o_size);
+ uint free_size = obj_align_round(pfree[-1].o_size);
if (free_size == aligned_size ||
- (free_size >= aligned_min_size && free_size < best_fit_size)
- ) {
- best_fit = pfree;
- best_fit_prev = ppfprev;
- best_fit_size = pfree[-1].o_size;
- if (best_fit_size <= aligned_max_size)
- break; /* good enough fit to spare scan of entire list */
- }
- ppfprev = (obj_header_t **) pfree;
- if (free_size > largest_size)
- largest_size = free_size;
+ (free_size >= aligned_min_size && free_size < best_fit_size)
+ ) {
+ best_fit = pfree;
+ best_fit_prev = ppfprev;
+ best_fit_size = pfree[-1].o_size;
+ if (best_fit_size <= aligned_max_size)
+ break; /* good enough fit to spare scan of entire list */
+ }
+ ppfprev = (obj_header_t **) pfree;
+ if (free_size > largest_size)
+ largest_size = free_size;
}
if (best_fit == 0) {
- /*
- * No single free chunk is large enough, but since we scanned the
- * entire list, we now have an accurate updated value for
- * largest_free_size.
- */
- mem->largest_free_size = largest_size;
- return 0;
+ /*
+ * No single free chunk is large enough, but since we scanned the
+ * entire list, we now have an accurate updated value for
+ * largest_free_size.
+ */
+ mem->largest_free_size = largest_size;
+ return 0;
}
/* Remove from freelist & return excess memory to free */
@@ -1142,145 +1141,145 @@ large_freelist_alloc(gs_ref_memory_t *mem, uint size)
/* Allocate an object. This handles all but the fastest, simplest case. */
static obj_header_t *
alloc_obj(gs_ref_memory_t *mem, ulong lsize, gs_memory_type_ptr_t pstype,
- alloc_flags_t flags, client_name_t cname)
+ alloc_flags_t flags, client_name_t cname)
{
obj_header_t *ptr;
if (lsize >= mem->large_size || (flags & ALLOC_IMMOVABLE)) {
- /*
- * Give the object a chunk all its own. Note that this case does
- * not occur if is_controlled is true.
- */
- ulong asize =
- ((lsize + obj_align_mask) & -obj_align_mod) +
- sizeof(obj_header_t);
- chunk_t *cp =
- alloc_acquire_chunk(mem, asize + sizeof(chunk_head_t), false,
- "large object chunk");
-
- if (
+ /*
+ * Give the object a chunk all its own. Note that this case does
+ * not occur if is_controlled is true.
+ */
+ ulong asize =
+ ((lsize + obj_align_mask) & -obj_align_mod) +
+ sizeof(obj_header_t);
+ chunk_t *cp =
+ alloc_acquire_chunk(mem, asize + sizeof(chunk_head_t), false,
+ "large object chunk");
+
+ if (
#if arch_sizeof_long > arch_sizeof_int
- asize > max_uint
+ asize > max_uint
#else
- asize < lsize
+ asize < lsize
#endif
- )
- return 0;
- if (cp == 0)
- return 0;
- ptr = (obj_header_t *) cp->cbot;
- cp->cbot += asize;
- ptr->o_alone = 1;
- ptr->o_size = lsize;
+ )
+ return 0;
+ if (cp == 0)
+ return 0;
+ ptr = (obj_header_t *) cp->cbot;
+ cp->cbot += asize;
+ ptr->o_alone = 1;
+ ptr->o_size = lsize;
} else {
- /*
- * Cycle through the chunks at the current save level, starting
- * with the currently open one.
- */
- chunk_t *cp_orig = mem->pcc;
- uint asize = obj_size_round((uint) lsize);
- bool allocate_success = false;
-
- if (lsize > max_freelist_size && (flags & ALLOC_DIRECT)) {
- /* We haven't checked the large block freelist yet. */
- if ((ptr = large_freelist_alloc(mem, lsize)) != 0) {
- --ptr; /* must point to header */
- goto done;
- }
- }
-
- if (cp_orig == 0) {
- /* Open an arbitrary chunk. */
- cp_orig = mem->pcc = mem->cfirst;
- alloc_open_chunk(mem);
- }
+ /*
+ * Cycle through the chunks at the current save level, starting
+ * with the currently open one.
+ */
+ chunk_t *cp_orig = mem->pcc;
+ uint asize = obj_size_round((uint) lsize);
+ bool allocate_success = false;
+
+ if (lsize > max_freelist_size && (flags & ALLOC_DIRECT)) {
+ /* We haven't checked the large block freelist yet. */
+ if ((ptr = large_freelist_alloc(mem, lsize)) != 0) {
+ --ptr; /* must point to header */
+ goto done;
+ }
+ }
+
+ if (cp_orig == 0) {
+ /* Open an arbitrary chunk. */
+ cp_orig = mem->pcc = mem->cfirst;
+ alloc_open_chunk(mem);
+ }
#define CAN_ALLOC_AT_END(cp)\
((cp)->ctop - (byte *) (ptr = (obj_header_t *) (cp)->cbot)\
> asize + sizeof(obj_header_t))
- do {
- if (CAN_ALLOC_AT_END(&mem->cc)) {
- allocate_success = true;
- break;
- } else if (mem->is_controlled) {
- /* Try consolidating free space. */
- gs_consolidate_free((gs_memory_t *)mem);
- if (CAN_ALLOC_AT_END(&mem->cc)) {
- allocate_success = true;
- break;
- }
- }
- /* No luck, go on to the next chunk. */
- {
- chunk_t *cp = mem->cc.cnext;
-
- alloc_close_chunk(mem);
- if (cp == 0)
- cp = mem->cfirst;
- mem->pcc = cp;
- alloc_open_chunk(mem);
- }
- } while (mem->pcc != cp_orig);
+ do {
+ if (CAN_ALLOC_AT_END(&mem->cc)) {
+ allocate_success = true;
+ break;
+ } else if (mem->is_controlled) {
+ /* Try consolidating free space. */
+ gs_consolidate_free((gs_memory_t *)mem);
+ if (CAN_ALLOC_AT_END(&mem->cc)) {
+ allocate_success = true;
+ break;
+ }
+ }
+ /* No luck, go on to the next chunk. */
+ {
+ chunk_t *cp = mem->cc.cnext;
+
+ alloc_close_chunk(mem);
+ if (cp == 0)
+ cp = mem->cfirst;
+ mem->pcc = cp;
+ alloc_open_chunk(mem);
+ }
+ } while (mem->pcc != cp_orig);
#ifdef CONSOLIDATE_BEFORE_ADDING_CHUNK
- if (!allocate_success) {
- /*
- * Try consolidating free space before giving up.
- * It's not clear this is a good idea, since it requires quite
- * a lot of computation and doesn't seem to improve things much.
- */
- if (!mem->is_controlled) { /* already did this if controlled */
- chunk_t *cp = cp_orig;
-
- alloc_close_chunk(mem);
- do {
- consolidate_chunk_free(cp, mem);
- if (CAN_ALLOC_AT_END(cp)) {
- mem->pcc = cp;
- alloc_open_chunk(mem);
- allocate_success = true;
- break;
- }
- if ((cp = cp->cnext) == 0)
- cp = mem->cfirst;
- } while (cp != cp_orig);
- }
- }
+ if (!allocate_success) {
+ /*
+ * Try consolidating free space before giving up.
+ * It's not clear this is a good idea, since it requires quite
+ * a lot of computation and doesn't seem to improve things much.
+ */
+ if (!mem->is_controlled) { /* already did this if controlled */
+ chunk_t *cp = cp_orig;
+
+ alloc_close_chunk(mem);
+ do {
+ consolidate_chunk_free(cp, mem);
+ if (CAN_ALLOC_AT_END(cp)) {
+ mem->pcc = cp;
+ alloc_open_chunk(mem);
+ allocate_success = true;
+ break;
+ }
+ if ((cp = cp->cnext) == 0)
+ cp = mem->cfirst;
+ } while (cp != cp_orig);
+ }
+ }
#endif
#undef CAN_ALLOC_AT_END
- if (!allocate_success) {
- /* Add another chunk. */
- chunk_t *cp =
- alloc_add_chunk(mem, (ulong)mem->chunk_size, "chunk");
-
- if (cp) {
- /* mem->pcc == cp, mem->cc == *mem->pcc. */
- ptr = (obj_header_t *)cp->cbot;
- allocate_success = true;
- }
- }
-
- /*
- * If no success, try to scavenge from low free memory. This is
- * only enabled for controlled memory (currently only async
- * renderer) because it's too much work to prevent it from
- * examining outer save levels in the general case.
- */
- if (allocate_success)
- mem->cc.cbot = (byte *) ptr + asize;
- else if (!mem->is_controlled ||
- (ptr = scavenge_low_free(mem, (uint)lsize)) == 0)
- return 0; /* allocation failed */
- ptr->o_alone = 0;
- ptr->o_size = (uint) lsize;
+ if (!allocate_success) {
+ /* Add another chunk. */
+ chunk_t *cp =
+ alloc_add_chunk(mem, (ulong)mem->chunk_size, "chunk");
+
+ if (cp) {
+ /* mem->pcc == cp, mem->cc == *mem->pcc. */
+ ptr = (obj_header_t *)cp->cbot;
+ allocate_success = true;
+ }
+ }
+
+ /*
+ * If no success, try to scavenge from low free memory. This is
+ * only enabled for controlled memory (currently only async
+ * renderer) because it's too much work to prevent it from
+ * examining outer save levels in the general case.
+ */
+ if (allocate_success)
+ mem->cc.cbot = (byte *) ptr + asize;
+ else if (!mem->is_controlled ||
+ (ptr = scavenge_low_free(mem, (uint)lsize)) == 0)
+ return 0; /* allocation failed */
+ ptr->o_alone = 0;
+ ptr->o_size = (uint) lsize;
}
done:
ptr->o_type = pstype;
# if IGC_PTR_STABILITY_CHECK
- ptr->d.o.space_id = mem->space_id;
+ ptr->d.o.space_id = mem->space_id;
# endif
ptr++;
gs_alloc_fill(ptr, gs_alloc_fill_alloc, lsize);
@@ -1300,23 +1299,23 @@ consolidate_chunk_free(chunk_t *cp, gs_ref_memory_t *mem)
cp->int_freed_top = cp->cbase; /* below all objects in chunk */
SCAN_CHUNK_OBJECTS(cp)
DO_ALL
- if (pre->o_type == &st_free) {
- if (begin_free == 0)
- begin_free = pre;
- } else {
- if (begin_free)
- cp->int_freed_top = (byte *)pre; /* first byte following internal free */
- begin_free = 0;
+ if (pre->o_type == &st_free) {
+ if (begin_free == 0)
+ begin_free = pre;
+ } else {
+ if (begin_free)
+ cp->int_freed_top = (byte *)pre; /* first byte following internal free */
+ begin_free = 0;
}
END_OBJECTS_SCAN
if (begin_free) {
- /* We found free objects at the top of the object area. */
- /* Remove the free objects from the freelists. */
- remove_range_from_freelist(mem, begin_free, cp->cbot);
- if_debug4('a', "[a]resetting chunk 0x%lx cbot from 0x%lx to 0x%lx (%lu free)\n",
- (ulong) cp, (ulong) cp->cbot, (ulong) begin_free,
- (ulong) ((byte *) cp->cbot - (byte *) begin_free));
- cp->cbot = (byte *) begin_free;
+ /* We found free objects at the top of the object area. */
+ /* Remove the free objects from the freelists. */
+ remove_range_from_freelist(mem, begin_free, cp->cbot);
+ if_debug4('a', "[a]resetting chunk 0x%lx cbot from 0x%lx to 0x%lx (%lu free)\n",
+ (ulong) cp, (ulong) cp->cbot, (ulong) begin_free,
+ (ulong) ((byte *) cp->cbot - (byte *) begin_free));
+ cp->cbot = (byte *) begin_free;
}
}
@@ -1331,22 +1330,22 @@ ialloc_consolidate_free(gs_ref_memory_t *mem)
/* Visit chunks in reverse order to encourage LIFO behavior. */
for (cp = mem->clast; cp != 0; cp = cprev) {
- cprev = cp->cprev;
- consolidate_chunk_free(cp, mem);
- if (cp->cbot == cp->cbase && cp->ctop == cp->climit) {
- /* The entire chunk is free. */
- chunk_t *cnext = cp->cnext;
-
- if (!mem->is_controlled) {
- alloc_free_chunk(cp, mem);
- if (mem->pcc == cp)
- mem->pcc =
- (cnext == 0 ? cprev : cprev == 0 ? cnext :
- cprev->cbot - cprev->ctop >
- cnext->cbot - cnext->ctop ? cprev :
- cnext);
- }
- }
+ cprev = cp->cprev;
+ consolidate_chunk_free(cp, mem);
+ if (cp->cbot == cp->cbase && cp->ctop == cp->climit) {
+ /* The entire chunk is free. */
+ chunk_t *cnext = cp->cnext;
+
+ if (!mem->is_controlled) {
+ alloc_free_chunk(cp, mem);
+ if (mem->pcc == cp)
+ mem->pcc =
+ (cnext == 0 ? cprev : cprev == 0 ? cnext :
+ cprev->cbot - cprev->ctop >
+ cnext->cbot - cnext->ctop ? cprev :
+ cnext);
+ }
+ }
}
alloc_open_chunk(mem);
}
@@ -1371,37 +1370,37 @@ scavenge_low_free(gs_ref_memory_t *mem, unsigned request_size)
chunk_t *cp;
for (cp = mem->cfirst; cp != 0; cp = cp->cnext) {
- begin_free = 0;
- found_free = 0;
- SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- if (pre->o_type == &st_free) {
- if (begin_free == 0) {
- found_free = 0;
- begin_free = pre;
- }
- found_free += pre_obj_rounded_size(pre);
- if (begin_free != 0 && found_free >= need_free)
- break;
- } else
- begin_free = 0;
- END_OBJECTS_SCAN_NO_ABORT
-
- /* Found sufficient range of empty memory */
- if (begin_free != 0 && found_free >= need_free) {
-
- /* Fish found pieces out of various freelists */
- remove_range_from_freelist(mem, (char*)begin_free,
- (char*)begin_free + found_free);
-
- /* Prepare found object */
- found_pre = begin_free;
- found_pre->o_type = &st_free; /* don't confuse GC if gets lost */
- found_pre->o_size = found_free - sizeof(obj_header_t);
-
- /* Chop off excess tail piece & toss it back into free pool */
- trim_obj(mem, found_pre + 1, request_size, cp);
- }
+ begin_free = 0;
+ found_free = 0;
+ SCAN_CHUNK_OBJECTS(cp)
+ DO_ALL
+ if (pre->o_type == &st_free) {
+ if (begin_free == 0) {
+ found_free = 0;
+ begin_free = pre;
+ }
+ found_free += pre_obj_rounded_size(pre);
+ if (begin_free != 0 && found_free >= need_free)
+ break;
+ } else
+ begin_free = 0;
+ END_OBJECTS_SCAN_NO_ABORT
+
+ /* Found sufficient range of empty memory */
+ if (begin_free != 0 && found_free >= need_free) {
+
+ /* Fish found pieces out of various freelists */
+ remove_range_from_freelist(mem, (char*)begin_free,
+ (char*)begin_free + found_free);
+
+ /* Prepare found object */
+ found_pre = begin_free;
+ found_pre->o_type = &st_free; /* don't confuse GC if gets lost */
+ found_pre->o_size = found_free - sizeof(obj_header_t);
+
+ /* Chop off excess tail piece & toss it back into free pool */
+ trim_obj(mem, found_pre + 1, request_size, cp);
+ }
}
return found_pre;
}
@@ -1423,31 +1422,31 @@ remove_range_from_freelist(gs_ref_memory_t *mem, void* bottom, void* top)
*/
for (cur = bottom; cur != top;
- cur = (const obj_header_t *)
- ((const byte *)cur + obj_size_round(size))
- ) {
- size = cur->o_size;
- i = (size > max_freelist_size ? LARGE_FREELIST_INDEX :
- (size + obj_align_mask) >> log2_obj_align_mod);
- if (i < smallest) {
- /*
- * 0-length free blocks aren't kept on any list, because
- * they don't have room for a pointer.
- */
- if (i == 0)
- continue;
- if (smallest < num_freelists)
- memset(&num_free[i], 0, (smallest - i) * sizeof(int));
- else
- num_free[i] = 0;
- smallest = i;
- }
- if (i > largest) {
- if (largest >= 0)
- memset(&num_free[largest + 1], 0, (i - largest) * sizeof(int));
- largest = i;
- }
- num_free[i]++;
+ cur = (const obj_header_t *)
+ ((const byte *)cur + obj_size_round(size))
+ ) {
+ size = cur->o_size;
+ i = (size > max_freelist_size ? LARGE_FREELIST_INDEX :
+ (size + obj_align_mask) >> log2_obj_align_mod);
+ if (i < smallest) {
+ /*
+ * 0-length free blocks aren't kept on any list, because
+ * they don't have room for a pointer.
+ */
+ if (i == 0)
+ continue;
+ if (smallest < num_freelists)
+ memset(&num_free[i], 0, (smallest - i) * sizeof(int));
+ else
+ num_free[i] = 0;
+ smallest = i;
+ }
+ if (i > largest) {
+ if (largest >= 0)
+ memset(&num_free[largest + 1], 0, (i - largest) * sizeof(int));
+ largest = i;
+ }
+ num_free[i]++;
}
/*
@@ -1457,24 +1456,24 @@ remove_range_from_freelist(gs_ref_memory_t *mem, void* bottom, void* top)
*/
for (i = smallest; i <= largest; i++) {
- int count = num_free[i];
+ int count = num_free[i];
obj_header_t *pfree;
- obj_header_t **ppfprev;
-
- if (!count)
- continue;
- ppfprev = &mem->freelists[i];
- for (;;) {
- pfree = *ppfprev;
- if (PTR_GE(pfree, bottom) && PTR_LT(pfree, top)) {
- /* We're removing an object. */
- *ppfprev = *(obj_header_t **) pfree;
- removed += obj_align_round(pfree[-1].o_size);
- if (!--count)
- break;
- } else
- ppfprev = (obj_header_t **) pfree;
- }
+ obj_header_t **ppfprev;
+
+ if (!count)
+ continue;
+ ppfprev = &mem->freelists[i];
+ for (;;) {
+ pfree = *ppfprev;
+ if (PTR_GE(pfree, bottom) && PTR_LT(pfree, top)) {
+ /* We're removing an object. */
+ *ppfprev = *(obj_header_t **) pfree;
+ removed += obj_align_round(pfree[-1].o_size);
+ if (!--count)
+ break;
+ } else
+ ppfprev = (obj_header_t **) pfree;
+ }
}
mem->lost.objects -= (char*)top - (char*)bottom - removed;
}
@@ -1494,85 +1493,85 @@ trim_obj(gs_ref_memory_t *mem, obj_header_t *obj, uint size, chunk_t *cp)
/* trim object's size to desired */
pre_obj->o_size = size;
if (old_rounded_size == rounded_size)
- return; /* nothing more to do here */
+ return; /* nothing more to do here */
/*
* If the object is alone in its chunk, move cbot to point to the end
* of the object.
*/
if (pre_obj->o_alone) {
- if (!cp) {
- mem->cfreed.memory = mem;
- if (chunk_locate(obj, &mem->cfreed)) {
- cp = mem->cfreed.cp;
- }
- }
- if (cp) {
+ if (!cp) {
+ mem->cfreed.memory = mem;
+ if (chunk_locate(obj, &mem->cfreed)) {
+ cp = mem->cfreed.cp;
+ }
+ }
+ if (cp) {
#ifdef DEBUG
- if (cp->cbot != (byte *)obj + old_rounded_size) {
- lprintf3("resizing 0x%lx, old size %u, new size %u, cbot wrong!\n",
- (ulong)obj, old_rounded_size, size);
- /* gs_abort */
- } else
+ if (cp->cbot != (byte *)obj + old_rounded_size) {
+ lprintf3("resizing 0x%lx, old size %u, new size %u, cbot wrong!\n",
+ (ulong)obj, old_rounded_size, size);
+ /* gs_abort */
+ } else
#endif
- {
- cp->cbot = (byte *)excess_pre;
- return;
- }
- }
- /*
- * Something very weird is going on. This probably shouldn't
- * ever happen, but if it does....
- */
- pre_obj->o_alone = 0;
+ {
+ cp->cbot = (byte *)excess_pre;
+ return;
+ }
+ }
+ /*
+ * Something very weird is going on. This probably shouldn't
+ * ever happen, but if it does....
+ */
+ pre_obj->o_alone = 0;
}
/* make excess into free obj */
excess_pre->o_type = &st_free; /* don't confuse GC */
excess_pre->o_size = excess_size;
excess_pre->o_alone = 0;
if (excess_size >= obj_align_mod) {
- /* Put excess object on a freelist */
- obj_header_t **pfl;
-
- if ((byte *)excess_pre >= mem->cc.int_freed_top)
- mem->cc.int_freed_top = (byte *)excess_pre + excess_size;
- if (excess_size <= max_freelist_size)
- pfl = &mem->freelists[(excess_size + obj_align_mask) >>
- log2_obj_align_mod];
- else {
- uint rounded_size = obj_align_round(excess_size);
-
- pfl = &mem->freelists[LARGE_FREELIST_INDEX];
- if (rounded_size > mem->largest_free_size)
- mem->largest_free_size = rounded_size;
- }
- *(obj_header_t **) (excess_pre + 1) = *pfl;
- *pfl = excess_pre + 1;
- mem->cfreed.memory = mem;
+ /* Put excess object on a freelist */
+ obj_header_t **pfl;
+
+ if ((byte *)excess_pre >= mem->cc.int_freed_top)
+ mem->cc.int_freed_top = (byte *)excess_pre + excess_size;
+ if (excess_size <= max_freelist_size)
+ pfl = &mem->freelists[(excess_size + obj_align_mask) >>
+ log2_obj_align_mod];
+ else {
+ uint rounded_size = obj_align_round(excess_size);
+
+ pfl = &mem->freelists[LARGE_FREELIST_INDEX];
+ if (rounded_size > mem->largest_free_size)
+ mem->largest_free_size = rounded_size;
+ }
+ *(obj_header_t **) (excess_pre + 1) = *pfl;
+ *pfl = excess_pre + 1;
+ mem->cfreed.memory = mem;
} else {
- /* excess piece will be "lost" memory */
- mem->lost.objects += excess_size + sizeof(obj_header_t);
+ /* excess piece will be "lost" memory */
+ mem->lost.objects += excess_size + sizeof(obj_header_t);
}
-}
+}
/* ================ Roots ================ */
/* Register a root. */
static int
i_register_root(gs_memory_t * mem, gs_gc_root_t * rp, gs_ptr_type_t ptype,
- void **up, client_name_t cname)
+ void **up, client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
if (rp == NULL) {
- rp = gs_raw_alloc_struct_immovable(imem->non_gc_memory, &st_gc_root_t,
- "i_register_root");
- if (rp == 0)
- return_error(gs_error_VMerror);
- rp->free_on_unregister = true;
+ rp = gs_raw_alloc_struct_immovable(imem->non_gc_memory, &st_gc_root_t,
+ "i_register_root");
+ if (rp == 0)
+ return_error(gs_error_VMerror);
+ rp->free_on_unregister = true;
} else
- rp->free_on_unregister = false;
+ rp->free_on_unregister = false;
if_debug3('8', "[8]register root(%s) 0x%lx -> 0x%lx\n",
- client_name_string(cname), (ulong)rp, (ulong)up);
+ client_name_string(cname), (ulong)rp, (ulong)up);
rp->ptype = ptype;
rp->p = up;
rp->next = imem->roots;
@@ -1588,12 +1587,12 @@ i_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp, client_name_t cname)
gs_gc_root_t **rpp = &imem->roots;
if_debug2('8', "[8]unregister root(%s) 0x%lx\n",
- client_name_string(cname), (ulong) rp);
+ client_name_string(cname), (ulong) rp);
while (*rpp != rp)
- rpp = &(*rpp)->next;
+ rpp = &(*rpp)->next;
*rpp = (*rpp)->next;
if (rp->free_on_unregister)
- gs_free_object(imem->non_gc_memory, rp, "i_unregister_root");
+ gs_free_object(imem->non_gc_memory, rp, "i_unregister_root");
}
/* ================ Chunks ================ */
@@ -1615,27 +1614,27 @@ alloc_link_chunk(chunk_t * cp, gs_ref_memory_t * imem)
* the former first.
*/
if (imem->clast && PTR_GE(cdata, imem->clast->ctop))
- icp = 0;
+ icp = 0;
else
- for (icp = imem->cfirst; icp != 0 && PTR_GE(cdata, icp->ctop);
- icp = icp->cnext
- );
+ for (icp = imem->cfirst; icp != 0 && PTR_GE(cdata, icp->ctop);
+ icp = icp->cnext
+ );
cp->cnext = icp;
if (icp == 0) { /* add at end of chain */
- prev = imem->clast;
- imem->clast = cp;
+ prev = imem->clast;
+ imem->clast = cp;
} else { /* insert before icp */
- prev = icp->cprev;
- icp->cprev = cp;
+ prev = icp->cprev;
+ icp->cprev = cp;
}
cp->cprev = prev;
if (prev == 0)
- imem->cfirst = cp;
+ imem->cfirst = cp;
else
- prev->cnext = cp;
+ prev->cnext = cp;
if (imem->pcc != 0) {
- imem->cc.cnext = imem->pcc->cnext;
- imem->cc.cprev = imem->pcc->cprev;
+ imem->cc.cnext = imem->pcc->cnext;
+ imem->cc.cprev = imem->pcc->cprev;
}
}
@@ -1646,11 +1645,11 @@ alloc_add_chunk(gs_ref_memory_t * mem, ulong csize, client_name_t cname)
chunk_t *cp = alloc_acquire_chunk(mem, csize, true, cname);
if (cp) {
- alloc_close_chunk(mem);
- mem->pcc = cp;
- mem->cc = *mem->pcc;
- gs_alloc_fill(mem->cc.cbase, gs_alloc_fill_free,
- mem->cc.climit - mem->cc.cbase);
+ alloc_close_chunk(mem);
+ mem->pcc = cp;
+ mem->cc = *mem->pcc;
+ gs_alloc_fill(mem->cc.cbase, gs_alloc_fill_free,
+ mem->cc.climit - mem->cc.cbase);
}
return cp;
}
@@ -1661,7 +1660,7 @@ alloc_add_chunk(gs_ref_memory_t * mem, ulong csize, client_name_t cname)
/* just set the signal and return successfully. */
static chunk_t *
alloc_acquire_chunk(gs_ref_memory_t * mem, ulong csize, bool has_strings,
- client_name_t cname)
+ client_name_t cname)
{
gs_memory_t *parent = mem->non_gc_memory;
chunk_t *cp;
@@ -1670,30 +1669,30 @@ alloc_acquire_chunk(gs_ref_memory_t * mem, ulong csize, bool has_strings,
#if arch_sizeof_long > arch_sizeof_int
/* If csize is larger than max_uint, punt. */
if (csize != (uint) csize)
- return 0;
+ return 0;
#endif
cp = gs_raw_alloc_struct_immovable(parent, &st_chunk, cname);
- if( mem->gc_status.psignal != 0) {
- /* we have a garbage collector */
- if ((ulong) (mem->allocated) >= mem->limit) {
- mem->gc_status.requested += csize;
- if (mem->limit >= mem->gc_status.max_vm) {
- gs_free_object(parent, cp, cname);
- return 0;
- }
- if_debug4('0', "[0]signaling space=%d, allocated=%ld, limit=%ld, requested=%ld\n",
- mem->space, (long)mem->allocated,
- (long)mem->limit, (long)mem->gc_status.requested);
- *mem->gc_status.psignal = mem->gc_status.signal_value;
- }
+ if( mem->gc_status.psignal != 0) {
+ /* we have a garbage collector */
+ if ((ulong) (mem->allocated) >= mem->limit) {
+ mem->gc_status.requested += csize;
+ if (mem->limit >= mem->gc_status.max_vm) {
+ gs_free_object(parent, cp, cname);
+ return 0;
+ }
+ if_debug4('0', "[0]signaling space=%d, allocated=%ld, limit=%ld, requested=%ld\n",
+ mem->space, (long)mem->allocated,
+ (long)mem->limit, (long)mem->gc_status.requested);
+ *mem->gc_status.psignal = mem->gc_status.signal_value;
+ }
}
cdata = gs_alloc_bytes_immovable(parent, csize, cname);
if (cp == 0 || cdata == 0) {
- gs_free_object(parent, cdata, cname);
- gs_free_object(parent, cp, cname);
- mem->gc_status.requested = csize;
- return 0;
+ gs_free_object(parent, cdata, cname);
+ gs_free_object(parent, cp, cname);
+ mem->gc_status.requested = csize;
+ return 0;
}
alloc_init_chunk(cp, cdata, cdata + csize, has_strings, (chunk_t *) 0);
alloc_link_chunk(cp, mem);
@@ -1706,12 +1705,12 @@ alloc_acquire_chunk(gs_ref_memory_t * mem, ulong csize, bool has_strings,
/* be aligned. */
void
alloc_init_chunk(chunk_t * cp, byte * bot, byte * top, bool has_strings,
- chunk_t * outer)
+ chunk_t * outer)
{
byte *cdata = bot;
if (outer != 0)
- outer->inner_count++;
+ outer->inner_count++;
cp->chead = (chunk_head_t *) cdata;
cdata += sizeof(chunk_head_t);
cp->cbot = cp->cbase = cp->int_freed_top = cdata;
@@ -1723,25 +1722,25 @@ alloc_init_chunk(chunk_t * cp, byte * bot, byte * top, bool has_strings,
cp->has_refs = false;
cp->sbase = cdata;
if (has_strings && top - cdata >= string_space_quantum + sizeof(long) - 1) {
- /*
- * We allocate a large enough string marking and reloc table
- * to cover the entire chunk.
- */
- uint nquanta = string_space_quanta(top - cdata);
-
- cp->climit = cdata + nquanta * string_data_quantum;
- cp->smark = cp->climit;
- cp->smark_size = string_quanta_mark_size(nquanta);
- cp->sreloc =
- (string_reloc_offset *) (cp->smark + cp->smark_size);
- cp->sfree1 = (uint *) cp->sreloc;
+ /*
+ * We allocate a large enough string marking and reloc table
+ * to cover the entire chunk.
+ */
+ uint nquanta = string_space_quanta(top - cdata);
+
+ cp->climit = cdata + nquanta * string_data_quantum;
+ cp->smark = cp->climit;
+ cp->smark_size = string_quanta_mark_size(nquanta);
+ cp->sreloc =
+ (string_reloc_offset *) (cp->smark + cp->smark_size);
+ cp->sfree1 = (uint *) cp->sreloc;
} else {
- /* No strings, don't need the string GC tables. */
- cp->climit = cp->cend;
- cp->sfree1 = 0;
- cp->smark = 0;
- cp->smark_size = 0;
- cp->sreloc = 0;
+ /* No strings, don't need the string GC tables. */
+ cp->climit = cp->cend;
+ cp->sfree1 = 0;
+ cp->smark = 0;
+ cp->smark_size = 0;
+ cp->sreloc = 0;
}
cp->ctop = cp->climit;
alloc_init_free_strings(cp);
@@ -1752,7 +1751,7 @@ void
alloc_init_free_strings(chunk_t * cp)
{
if (cp->sfree1)
- memset(cp->sfree1, 0, STRING_FREELIST_SPACE(cp));
+ memset(cp->sfree1, 0, STRING_FREELIST_SPACE(cp));
cp->sfree = 0;
}
@@ -1762,12 +1761,12 @@ void
alloc_close_chunk(gs_ref_memory_t * mem)
{
if (mem->pcc != 0) {
- *mem->pcc = mem->cc;
+ *mem->pcc = mem->cc;
#ifdef DEBUG
- if (gs_debug_c('a')) {
- dlprintf1("[a%d]", alloc_trace_space(mem));
- dprintf_chunk("closing chunk", mem->pcc);
- }
+ if (gs_debug_c('a')) {
+ dlprintf1("[a%d]", alloc_trace_space(mem));
+ dprintf_chunk("closing chunk", mem->pcc);
+ }
#endif
}
}
@@ -1777,12 +1776,12 @@ void
alloc_open_chunk(gs_ref_memory_t * mem)
{
if (mem->pcc != 0) {
- mem->cc = *mem->pcc;
+ mem->cc = *mem->pcc;
#ifdef DEBUG
- if (gs_debug_c('a')) {
- dlprintf1("[a%d]", alloc_trace_space(mem));
- dprintf_chunk("opening chunk", mem->pcc);
- }
+ if (gs_debug_c('a')) {
+ dlprintf1("[a%d]", alloc_trace_space(mem));
+ dprintf_chunk("opening chunk", mem->pcc);
+ }
#endif
}
}
@@ -1793,32 +1792,32 @@ alloc_unlink_chunk(chunk_t * cp, gs_ref_memory_t * mem)
{
#ifdef DEBUG
if (gs_alloc_debug) { /* Check to make sure this chunk belongs to this allocator. */
- const chunk_t *ap = mem->cfirst;
-
- while (ap != 0 && ap != cp)
- ap = ap->cnext;
- if (ap != cp) {
- lprintf2("unlink_chunk 0x%lx not owned by memory 0x%lx!\n",
- (ulong) cp, (ulong) mem);
- return; /*gs_abort(); */
- }
+ const chunk_t *ap = mem->cfirst;
+
+ while (ap != 0 && ap != cp)
+ ap = ap->cnext;
+ if (ap != cp) {
+ lprintf2("unlink_chunk 0x%lx not owned by memory 0x%lx!\n",
+ (ulong) cp, (ulong) mem);
+ return; /*gs_abort(); */
+ }
}
#endif
if (cp->cprev == 0)
- mem->cfirst = cp->cnext;
+ mem->cfirst = cp->cnext;
else
- cp->cprev->cnext = cp->cnext;
+ cp->cprev->cnext = cp->cnext;
if (cp->cnext == 0)
- mem->clast = cp->cprev;
+ mem->clast = cp->cprev;
else
- cp->cnext->cprev = cp->cprev;
+ cp->cnext->cprev = cp->cprev;
if (mem->pcc != 0) {
- mem->cc.cnext = mem->pcc->cnext;
- mem->cc.cprev = mem->pcc->cprev;
- if (mem->pcc == cp) {
- mem->pcc = 0;
- mem->cc.cbot = mem->cc.ctop = 0;
- }
+ mem->cc.cnext = mem->pcc->cnext;
+ mem->cc.cprev = mem->pcc->cprev;
+ if (mem->pcc == cp) {
+ mem->pcc = 0;
+ mem->cc.cbot = mem->cc.ctop = 0;
+ }
}
}
@@ -1838,13 +1837,13 @@ alloc_free_chunk(chunk_t * cp, gs_ref_memory_t * mem)
alloc_unlink_chunk(cp, mem);
mem->allocated -= st_chunk.ssize;
if (mem->cfreed.cp == cp)
- mem->cfreed.cp = 0;
+ mem->cfreed.cp = 0;
if (cp->outer == 0) {
- mem->allocated -= csize;
- gs_free_object(parent, cdata, "alloc_free_chunk(data)");
+ mem->allocated -= csize;
+ gs_free_object(parent, cdata, "alloc_free_chunk(data)");
} else {
- cp->outer->inner_count--;
- gs_alloc_fill(cdata, gs_alloc_fill_free, csize);
+ cp->outer->inner_count--;
+ gs_alloc_fill(cdata, gs_alloc_fill_free, csize);
}
gs_free_object(parent, cp, "alloc_free_chunk(chunk struct)");
}
@@ -1860,30 +1859,30 @@ chunk_locate_ptr(const void *ptr, chunk_locator_t * clp)
register chunk_t *cp = clp->cp;
if (cp == 0) {
- cp = clp->memory->cfirst;
- if (cp == 0)
- return false;
- /* ptr is in the last chunk often enough to be worth checking for. */
- if (PTR_GE(ptr, clp->memory->clast->cbase))
- cp = clp->memory->clast;
+ cp = clp->memory->cfirst;
+ if (cp == 0)
+ return false;
+ /* ptr is in the last chunk often enough to be worth checking for. */
+ if (PTR_GE(ptr, clp->memory->clast->cbase))
+ cp = clp->memory->clast;
}
if (PTR_LT(ptr, cp->cbase)) {
- do {
- cp = cp->cprev;
- if (cp == 0)
- return false;
- }
- while (PTR_LT(ptr, cp->cbase));
- if (PTR_GE(ptr, cp->cend))
- return false;
+ do {
+ cp = cp->cprev;
+ if (cp == 0)
+ return false;
+ }
+ while (PTR_LT(ptr, cp->cbase));
+ if (PTR_GE(ptr, cp->cend))
+ return false;
} else {
- while (PTR_GE(ptr, cp->cend)) {
- cp = cp->cnext;
- if (cp == 0)
- return false;
- }
- if (PTR_LT(ptr, cp->cbase))
- return false;
+ while (PTR_GE(ptr, cp->cend)) {
+ cp = cp->cnext;
+ if (cp == 0)
+ return false;
+ }
+ if (PTR_LT(ptr, cp->cbase))
+ return false;
}
clp->cp = cp;
return !ptr_is_in_inner_chunk(ptr, cp);
@@ -1897,11 +1896,11 @@ chunk_locate_ptr(const void *ptr, chunk_locator_t * clp)
static inline bool
obj_in_control_region(const void *obot, const void *otop,
- const dump_control_t *pdc)
+ const dump_control_t *pdc)
{
return
- ((pdc->bottom == NULL || PTR_GT(otop, pdc->bottom)) &&
- (pdc->top == NULL || PTR_LT(obot, pdc->top)));
+ ((pdc->bottom == NULL || PTR_GT(otop, pdc->bottom)) &&
+ (pdc->top == NULL || PTR_LT(obot, pdc->top)));
}
const dump_control_t dump_control_default =
@@ -1914,7 +1913,7 @@ const dump_control_t dump_control_all =
dump_do_pointed_strings | dump_do_contents, NULL, NULL
};
-const dump_control_t dump_control_no_contents =
+const dump_control_t dump_control_no_contents =
{
dump_do_strings | dump_do_type_addresses | dump_do_pointers |
dump_do_pointed_strings, NULL, NULL
@@ -1930,67 +1929,67 @@ debug_indent(int indent)
int i;
for (i = indent; i > 0; --i)
- dputc(' ');
+ dputc(' ');
}
static void
debug_dump_contents(const byte * bot, const byte * top, int indent,
- bool as_chars)
+ bool as_chars)
{
const byte *block;
#define block_size 16
if (bot >= top)
- return;
+ return;
for (block = bot - ((bot - (byte *) 0) & (block_size - 1));
- block < top; block += block_size
- ) {
- int i;
- char label[12];
-
- /* Check for repeated blocks. */
- if (block >= bot + block_size &&
- block <= top - (block_size * 2) &&
- !memcmp(block, block - block_size, block_size) &&
- !memcmp(block, block + block_size, block_size)
- ) {
- if (block < bot + block_size * 2 ||
- memcmp(block, block - block_size * 2, block_size)
- ) {
- debug_indent(indent);
- dputs(" ...\n");
- }
- continue;
- }
- sprintf(label, "0x%lx:", (ulong) block);
- debug_indent(indent);
- dputs(label);
- for (i = 0; i < block_size; ++i) {
- const char *sepr = ((i & 3) == 0 && i != 0 ? " " : " ");
-
- dputs(sepr);
- if (block + i >= bot && block + i < top)
- dprintf1("%02x", block[i]);
- else
- dputs(" ");
- }
- dputc('\n');
- if (as_chars) {
- debug_indent(indent + strlen(label));
- for (i = 0; i < block_size; ++i) {
- byte ch;
-
- if ((i & 3) == 0 && i != 0)
- dputc(' ');
- if (block + i >= bot && block + i < top &&
- (ch = block[i]) >= 32 && ch <= 126
- )
- dprintf1(" %c", ch);
- else
- dputs(" ");
- }
- dputc('\n');
- }
+ block < top; block += block_size
+ ) {
+ int i;
+ char label[12];
+
+ /* Check for repeated blocks. */
+ if (block >= bot + block_size &&
+ block <= top - (block_size * 2) &&
+ !memcmp(block, block - block_size, block_size) &&
+ !memcmp(block, block + block_size, block_size)
+ ) {
+ if (block < bot + block_size * 2 ||
+ memcmp(block, block - block_size * 2, block_size)
+ ) {
+ debug_indent(indent);
+ dputs(" ...\n");
+ }
+ continue;
+ }
+ sprintf(label, "0x%lx:", (ulong) block);
+ debug_indent(indent);
+ dputs(label);
+ for (i = 0; i < block_size; ++i) {
+ const char *sepr = ((i & 3) == 0 && i != 0 ? " " : " ");
+
+ dputs(sepr);
+ if (block + i >= bot && block + i < top)
+ dprintf1("%02x", block[i]);
+ else
+ dputs(" ");
+ }
+ dputc('\n');
+ if (as_chars) {
+ debug_indent(indent + strlen(label));
+ for (i = 0; i < block_size; ++i) {
+ byte ch;
+
+ if ((i & 3) == 0 && i != 0)
+ dputc(' ');
+ if (block + i >= bot && block + i < top &&
+ (ch = block[i]) >= 32 && ch <= 126
+ )
+ dprintf1(" %c", ch);
+ else
+ dputs(" ");
+ }
+ dputc('\n');
+ }
}
#undef block_size
}
@@ -2007,7 +2006,7 @@ debug_print_object(const gs_memory_t *mem, const void *obj, const dump_control_t
dump_options_t options = control->options;
dprintf3(" pre=0x%lx(obj=0x%lx) size=%lu", (ulong) pre, (ulong) obj,
- size);
+ size);
switch (options & (dump_do_type_addresses | dump_do_no_types)) {
case dump_do_type_addresses + dump_do_no_types: /* addresses only */
dprintf1(" type=0x%lx", (ulong) type);
@@ -2022,18 +2021,18 @@ debug_print_object(const gs_memory_t *mem, const void *obj, const dump_control_t
;
}
if (options & dump_do_marks) {
- dprintf2(" smark/back=%u (0x%x)", pre->o_smark, pre->o_smark);
+ dprintf2(" smark/back=%u (0x%x)", pre->o_smark, pre->o_smark);
}
dputc('\n');
if (type == &st_free)
- return;
+ return;
if (options & dump_do_pointers) {
- struct_proc_enum_ptrs((*proc)) = type->enum_ptrs;
- uint index = 0;
- enum_ptr_t eptr;
- gs_ptr_type_t ptype;
+ struct_proc_enum_ptrs((*proc)) = type->enum_ptrs;
+ uint index = 0;
+ enum_ptr_t eptr;
+ gs_ptr_type_t ptype;
- if (proc != gs_no_struct_enum_ptrs) {
+ if (proc != gs_no_struct_enum_ptrs) {
if (proc != 0) {
for (; (ptype = (*proc)(mem, pre + 1, size, index, &eptr, type, NULL)) != 0;
++index
@@ -2068,8 +2067,8 @@ debug_print_object(const gs_memory_t *mem, const void *obj, const dump_control_t
} /* proc != gs_no_struct_enum_ptrs */
}
if (options & dump_do_contents) {
- debug_dump_contents((const byte *)obj, (const byte *)obj + size,
- 0, false);
+ debug_dump_contents((const byte *)obj, (const byte *)obj + size,
+ 0, false);
}
}
@@ -2080,37 +2079,37 @@ debug_dump_chunk(const gs_memory_t *mem, const chunk_t * cp, const dump_control_
{
dprintf1("chunk at 0x%lx:\n", (ulong) cp);
dprintf3(" chead=0x%lx cbase=0x%lx sbase=0x%lx\n",
- (ulong) cp->chead, (ulong) cp->cbase, (ulong) cp->sbase);
+ (ulong) cp->chead, (ulong) cp->cbase, (ulong) cp->sbase);
dprintf3(" rcur=0x%lx rtop=0x%lx cbot=0x%lx\n",
- (ulong) cp->rcur, (ulong) cp->rtop, (ulong) cp->cbot);
+ (ulong) cp->rcur, (ulong) cp->rtop, (ulong) cp->cbot);
dprintf4(" ctop=0x%lx climit=0x%lx smark=0x%lx, size=%u\n",
- (ulong) cp->ctop, (ulong) cp->climit, (ulong) cp->smark,
- cp->smark_size);
+ (ulong) cp->ctop, (ulong) cp->climit, (ulong) cp->smark,
+ cp->smark_size);
dprintf2(" sreloc=0x%lx cend=0x%lx\n",
- (ulong) cp->sreloc, (ulong) cp->cend);
+ (ulong) cp->sreloc, (ulong) cp->cend);
dprintf5("cprev=0x%lx cnext=0x%lx outer=0x%lx inner_count=%u has_refs=%s\n",
- (ulong) cp->cprev, (ulong) cp->cnext, (ulong) cp->outer,
- cp->inner_count, (cp->has_refs ? "true" : "false"));
+ (ulong) cp->cprev, (ulong) cp->cnext, (ulong) cp->outer,
+ cp->inner_count, (cp->has_refs ? "true" : "false"));
dprintf2(" sfree1=0x%lx sfree=0x%x\n",
- (ulong) cp->sfree1, cp->sfree);
+ (ulong) cp->sfree1, cp->sfree);
if (control->options & dump_do_strings) {
- debug_dump_contents((control->bottom == 0 ? cp->ctop :
- max(control->bottom, cp->ctop)),
- (control->top == 0 ? cp->climit :
- min(control->top, cp->climit)),
- 0, true);
+ debug_dump_contents((control->bottom == 0 ? cp->ctop :
+ max(control->bottom, cp->ctop)),
+ (control->top == 0 ? cp->climit :
+ min(control->top, cp->climit)),
+ 0, true);
}
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- if (obj_in_control_region(pre + 1,
- (const byte *)(pre + 1) + size,
- control)
- )
- debug_print_object(mem, pre + 1, control);
+ DO_ALL
+ if (obj_in_control_region(pre + 1,
+ (const byte *)(pre + 1) + size,
+ control)
+ )
+ debug_print_object(mem, pre + 1, control);
END_OBJECTS_SCAN_NO_ABORT
}
-void
+void
debug_print_chunk(const gs_memory_t *mem, const chunk_t * cp)
{
dump_control_t control;
@@ -2127,10 +2126,10 @@ debug_dump_memory(const gs_ref_memory_t * mem, const dump_control_t * control)
const chunk_t *mcp;
for (mcp = mem->cfirst; mcp != 0; mcp = mcp->cnext) {
- const chunk_t *cp = (mcp == mem->pcc ? &mem->cc : mcp);
+ const chunk_t *cp = (mcp == mem->pcc ? &mem->cc : mcp);
- if (obj_in_control_region(cp->cbase, cp->cend, control))
- debug_dump_chunk((const gs_memory_t *)mem, cp, control);
+ if (obj_in_control_region(cp->cbase, cp->cend, control))
+ debug_dump_chunk((const gs_memory_t *)mem, cp, control);
}
}
@@ -2149,23 +2148,23 @@ debug_find_pointers(const gs_ref_memory_t *mem, const void *target)
control.options = 0;
for (mcp = mem->cfirst; mcp != 0; mcp = mcp->cnext) {
- const chunk_t *cp = (mcp == mem->pcc ? &mem->cc : mcp);
-
- SCAN_CHUNK_OBJECTS(cp);
- DO_ALL
- struct_proc_enum_ptrs((*proc)) = pre->o_type->enum_ptrs;
- uint index = 0;
- enum_ptr_t eptr;
-
- if (proc) /* doesn't trace refs NB fix me. */
- for (; (*proc)((const gs_memory_t *)mem, pre + 1, size, index,
- &eptr, pre->o_type, NULL);
- ++index)
- if (eptr.ptr == target) {
- dprintf1("Index %d in", index);
- debug_print_object((const gs_memory_t *)mem, pre + 1, &control);
- }
- END_OBJECTS_SCAN_NO_ABORT
+ const chunk_t *cp = (mcp == mem->pcc ? &mem->cc : mcp);
+
+ SCAN_CHUNK_OBJECTS(cp);
+ DO_ALL
+ struct_proc_enum_ptrs((*proc)) = pre->o_type->enum_ptrs;
+ uint index = 0;
+ enum_ptr_t eptr;
+
+ if (proc) /* doesn't trace refs NB fix me. */
+ for (; (*proc)((const gs_memory_t *)mem, pre + 1, size, index,
+ &eptr, pre->o_type, NULL);
+ ++index)
+ if (eptr.ptr == target) {
+ dprintf1("Index %d in", index);
+ debug_print_object((const gs_memory_t *)mem, pre + 1, &control);
+ }
+ END_OBJECTS_SCAN_NO_ABORT
}
}
diff --git a/gs/base/gsalloc.h b/gs/base/gsalloc.h
index e8555997b..4d80fa742 100644
--- a/gs/base/gsalloc.h
+++ b/gs/base/gsalloc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,14 +28,14 @@ typedef struct gs_ref_memory_s gs_ref_memory_t;
* Define a structure and interface for GC-related allocator state.
*/
typedef struct gs_memory_gc_status_s {
- /* Set by client */
+ /* Set by client */
long vm_threshold; /* GC interval */
long max_vm; /* maximum allowed allocation */
int *psignal; /* if not NULL, store signal_value */
- /* here if we go over the vm_threshold */
+ /* here if we go over the vm_threshold */
int signal_value; /* value to store in *psignal */
bool enabled; /* auto GC enabled if true */
- /* Set by allocator */
+ /* Set by allocator */
long requested; /* amount of last failing request */
} gs_memory_gc_status_t;
void gs_memory_gc_status(const gs_ref_memory_t *, gs_memory_gc_status_t *);
diff --git a/gs/base/gsalpha.c b/gs/base/gsalpha.c
index 07784c6e6..98a4f1942 100644
--- a/gs/base/gsalpha.c
+++ b/gs/base/gsalpha.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,8 +23,8 @@ int
gs_setalpha(gs_state * pgs, floatp alpha)
{
pgs->alpha =
- (gx_color_value) (alpha < 0 ? 0 : alpha > 1 ? gx_max_color_value :
- alpha * gx_max_color_value);
+ (gx_color_value) (alpha < 0 ? 0 : alpha > 1 ? gx_max_color_value :
+ alpha * gx_max_color_value);
gx_unset_dev_color(pgs);
return 0;
}
diff --git a/gs/base/gsalpha.h b/gs/base/gsalpha.h
index 03acba43d..c40a6d347 100644
--- a/gs/base/gsalpha.h
+++ b/gs/base/gsalpha.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsalphac.c b/gs/base/gsalphac.c
index d8977c229..f1c28b75f 100644
--- a/gs/base/gsalphac.c
+++ b/gs/base/gsalphac.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -60,9 +60,9 @@ typedef struct const_pixel_row_s {
* generate a non-unity alpha result.
*/
int composite_values(const pixel_row_t * pdest,
- const const_pixel_row_t * psource,
- int values_per_pixel, uint num_pixels,
- const gs_composite_params_t * pcp);
+ const const_pixel_row_t * psource,
+ int values_per_pixel, uint num_pixels,
+ const gs_composite_params_t * pcp);
/* ---------------- Alpha-compositing objects ---------------- */
@@ -96,16 +96,16 @@ const gs_composite_type_t gs_composite_alpha_type =
{
GX_COMPOSITOR_ALPHA,
{
- c_alpha_create_default_compositor,
- c_alpha_equal,
- c_alpha_write,
- c_alpha_read,
- gx_default_composite_adjust_ctm,
- gx_default_composite_is_closing,
- gx_default_composite_is_friendly,
- gx_default_composite_clist_write_update,
- gx_default_composite_clist_read_update,
- gx_default_composite_get_cropping
+ c_alpha_create_default_compositor,
+ c_alpha_equal,
+ c_alpha_write,
+ c_alpha_read,
+ gx_default_composite_adjust_ctm,
+ gx_default_composite_is_closing,
+ gx_default_composite_is_friendly,
+ gx_default_composite_clist_write_update,
+ gx_default_composite_clist_read_update,
+ gx_default_composite_get_cropping
}
};
typedef struct gs_composite_alpha_s {
@@ -114,19 +114,19 @@ typedef struct gs_composite_alpha_s {
} gs_composite_alpha_t;
gs_private_st_simple(st_composite_alpha, gs_composite_alpha_t,
- "gs_composite_alpha_t");
+ "gs_composite_alpha_t");
/* Create an alpha-compositing object. */
int
gs_create_composite_alpha(gs_composite_t ** ppcte,
- const gs_composite_alpha_params_t * params, gs_memory_t * mem)
+ const gs_composite_alpha_params_t * params, gs_memory_t * mem)
{
gs_composite_alpha_t *pcte;
pcte = gs_alloc_struct(mem, gs_composite_alpha_t, &st_composite_alpha,
- "gs_create_composite_alpha");
+ "gs_create_composite_alpha");
if (pcte == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcte->type = &gs_composite_alpha_type;
pcte->id = gs_next_ids(mem, 1);
pcte->params = *params;
@@ -144,9 +144,9 @@ c_alpha_equal(const gs_composite_t * pcte, const gs_composite_t * pcte2)
{
return (pcte2->type == pcte->type &&
#define pacte2 ((const gs_composite_alpha_t *)pcte2)
- pacte2->params.op == pacte->params.op &&
- (pacte->params.op != composite_Dissolve ||
- pacte2->params.delta == pacte->params.delta));
+ pacte2->params.op == pacte->params.op &&
+ (pacte->params.op != composite_Dissolve ||
+ pacte2->params.delta == pacte->params.delta));
#undef pacte2
}
@@ -158,18 +158,18 @@ c_alpha_write(const gs_composite_t * pcte, byte * data, uint * psize, gx_device_
if_debug1('v', "[v]c_alpha_write(%d)\n", pacte->params.op);
if (pacte->params.op == composite_Dissolve) {
- used = 1 + sizeof(pacte->params.delta);
- if (size < used) {
- *psize = used;
- return_error(gs_error_rangecheck);
- }
- memcpy(data + 1, &pacte->params.delta, sizeof(pacte->params.delta));
+ used = 1 + sizeof(pacte->params.delta);
+ if (size < used) {
+ *psize = used;
+ return_error(gs_error_rangecheck);
+ }
+ memcpy(data + 1, &pacte->params.delta, sizeof(pacte->params.delta));
} else {
- used = 1;
- if (size < used) {
- *psize = used;
- return_error(gs_error_rangecheck);
- }
+ used = 1;
+ if (size < used) {
+ *psize = used;
+ return_error(gs_error_rangecheck);
+ }
}
*data = (byte) pacte->params.op;
*psize = used;
@@ -178,20 +178,20 @@ c_alpha_write(const gs_composite_t * pcte, byte * data, uint * psize, gx_device_
static int
c_alpha_read(gs_composite_t ** ppcte, const byte * data, uint size,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
gs_composite_alpha_params_t params;
int code, nbytes = 1;
if (size < 1 || *data > composite_op_last)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
params.op = *data;
if_debug1('v', "[v]c_alpha_read(%d)\n", params.op);
if (params.op == composite_Dissolve) {
- if (size < 1 + sizeof(params.delta))
- return_error(gs_error_rangecheck);
- memcpy(&params.delta, data + 1, sizeof(params.delta));
- nbytes += sizeof(params.delta);
+ if (size < 1 + sizeof(params.delta))
+ return_error(gs_error_rangecheck);
+ memcpy(&params.delta, data + 1, sizeof(params.delta));
+ nbytes += sizeof(params.delta);
}
code = gs_create_composite_alpha(ppcte, &params, mem);
return code < 0 ? code : nbytes;
@@ -206,9 +206,9 @@ typedef struct gx_device_composite_alpha_s {
} gx_device_composite_alpha;
gs_private_st_suffix_add0_final(st_device_composite_alpha,
- gx_device_composite_alpha, "gx_device_composite_alpha",
+ gx_device_composite_alpha, "gx_device_composite_alpha",
device_c_alpha_enum_ptrs, device_c_alpha_reloc_ptrs, gx_device_finalize,
- st_device_forward);
+ st_device_forward);
/* The device descriptor. */
static dev_proc_close_device(dca_close);
static dev_proc_fill_rectangle(dca_fill_rectangle);
@@ -221,7 +221,7 @@ static dev_proc_map_color_rgb_alpha(dca_map_color_rgb_alpha);
static dev_proc_copy_alpha(dca_copy_alpha);
static const gx_device_composite_alpha gs_composite_alpha_device =
{std_device_std_body_open(gx_device_composite_alpha, 0,
- "alpha compositor", 0, 0, 1, 1),
+ "alpha compositor", 0, 0, 1, 1),
{gx_default_open_device,
gx_forward_get_initial_matrix,
gx_default_sync_output,
@@ -269,25 +269,25 @@ static const gx_device_composite_alpha gs_composite_alpha_device =
/* Create an alpha compositor. */
static int
c_alpha_create_default_compositor(const gs_composite_t * pcte,
- gx_device ** pcdev, gx_device * dev, gs_imager_state * pis,
- gs_memory_t * mem)
+ gx_device ** pcdev, gx_device * dev, gs_imager_state * pis,
+ gs_memory_t * mem)
{
gx_device_composite_alpha *cdev;
if (pacte->params.op == composite_Copy) {
- /* Just use the original device. */
- *pcdev = dev;
- return 0;
+ /* Just use the original device. */
+ *pcdev = dev;
+ return 0;
}
cdev =
- gs_alloc_struct_immovable(mem, gx_device_composite_alpha,
- &st_device_composite_alpha,
- "create default alpha compositor");
+ gs_alloc_struct_immovable(mem, gx_device_composite_alpha,
+ &st_device_composite_alpha,
+ "create default alpha compositor");
*pcdev = (gx_device *)cdev;
if (cdev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_device_init((gx_device *)cdev,
- (const gx_device *)&gs_composite_alpha_device, mem, true);
+ (const gx_device *)&gs_composite_alpha_device, mem, true);
gx_device_copy_params((gx_device *)cdev, dev);
/*
* Set the color_info and depth to be compatible with the target,
@@ -295,8 +295,8 @@ c_alpha_create_default_compositor(const gs_composite_t * pcte,
****** CURRENTLY ALWAYS USE 8-BIT COLOR ******
*/
cdev->color_info.depth =
- (dev->color_info.num_components == 4 ? 32 /* CMYK, no alpha */ :
- (dev->color_info.num_components + 1) * 8);
+ (dev->color_info.num_components == 4 ? 32 /* CMYK, no alpha */ :
+ (dev->color_info.num_components + 1) * 8);
cdev->color_info.max_gray = cdev->color_info.max_color = 255;
/* No halftoning will occur, but we fill these in anyway.... */
cdev->color_info.dither_grays = cdev->color_info.dither_colors = 256;
@@ -314,8 +314,8 @@ c_alpha_create_default_compositor(const gs_composite_t * pcte,
static int
dca_close(gx_device * dev)
{ /*
- * Finalization will call close again: avoid a recursion loop.
- */
+ * Finalization will call close again: avoid a recursion loop.
+ */
set_dev_proc(dev, close_device, gx_default_close_device);
gs_free_object(dev->memory, dev, "dca_close");
return 0;
@@ -330,12 +330,12 @@ dca_map_rgb_color(gx_device * dev, const gx_color_value cv[])
}
static gx_color_index
dca_map_rgb_alpha_color(gx_device * dev,
- gx_color_value red, gx_color_value green, gx_color_value blue,
- gx_color_value alpha)
+ gx_color_value red, gx_color_value green, gx_color_value blue,
+ gx_color_value alpha)
{ /*
- * We work exclusively with premultiplied color values, so we
- * have to premultiply the color components by alpha here.
- */
+ * We work exclusively with premultiplied color values, so we
+ * have to premultiply the color components by alpha here.
+ */
byte a = gx_color_value_to_byte(alpha);
#define premult_(c)\
@@ -350,31 +350,31 @@ dca_map_rgb_alpha_color(gx_device * dev,
gx_color_index color;
if (dev->color_info.num_components == 1) {
- uint lum =
- (red * lum_red_weight + green * lum_green_weight +
- blue * lum_blue_weight + lum_all_weights / 2) /
- lum_all_weights;
-
- if (a == 0xff)
- color = gx_color_value_to_byte(lum);
- else /* Premultiplication is necessary. */
- color = premult(lum);
+ uint lum =
+ (red * lum_red_weight + green * lum_green_weight +
+ blue * lum_blue_weight + lum_all_weights / 2) /
+ lum_all_weights;
+
+ if (a == 0xff)
+ color = gx_color_value_to_byte(lum);
+ else /* Premultiplication is necessary. */
+ color = premult(lum);
} else {
- if (a == 0xff)
- color =
- ((uint) gx_color_value_to_byte(red) << 16) +
- ((uint) gx_color_value_to_byte(green) << 8) +
- gx_color_value_to_byte(blue);
- else /* Premultiplication is necessary. */
- color =
- (premult(red) << 16) + (premult(green) << 8) + premult(blue);
+ if (a == 0xff)
+ color =
+ ((uint) gx_color_value_to_byte(red) << 16) +
+ ((uint) gx_color_value_to_byte(green) << 8) +
+ gx_color_value_to_byte(blue);
+ else /* Premultiplication is necessary. */
+ color =
+ (premult(red) << 16) + (premult(green) << 8) + premult(blue);
}
#undef premult
return (color << 8) + a;
}
static int
dca_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
gx_color_value red = gx_color_value_from_byte((byte) (color >> 24));
byte a = (byte) color;
@@ -390,38 +390,38 @@ dca_map_color_rgb(gx_device * dev, gx_color_index color,
#endif
if (dev->color_info.num_components == 1) {
- if (a != 0xff) {
- /* Undo premultiplication. */
- if (a == 0)
- red = 0;
- else
- red = postdiv(red);
- }
- prgb[0] = prgb[1] = prgb[2] = red;
+ if (a != 0xff) {
+ /* Undo premultiplication. */
+ if (a == 0)
+ red = 0;
+ else
+ red = postdiv(red);
+ }
+ prgb[0] = prgb[1] = prgb[2] = red;
} else {
- gx_color_value
- green = gx_color_value_from_byte((byte) (color >> 16)),
- blue = gx_color_value_from_byte((byte) (color >> 8));
+ gx_color_value
+ green = gx_color_value_from_byte((byte) (color >> 16)),
+ blue = gx_color_value_from_byte((byte) (color >> 8));
- if (a != 0xff) {
- /* Undo premultiplication. */
+ if (a != 0xff) {
+ /* Undo premultiplication. */
/****** WHAT TO DO ABOUT BIG LOSS OF PRECISION? ******/
- if (a == 0)
- red = green = blue = 0;
- else {
- red = postdiv(red);
- green = postdiv(green);
- blue = postdiv(blue);
- }
- }
- prgb[0] = red, prgb[1] = green, prgb[2] = blue;
+ if (a == 0)
+ red = green = blue = 0;
+ else {
+ red = postdiv(red);
+ green = postdiv(green);
+ blue = postdiv(blue);
+ }
+ }
+ prgb[0] = red, prgb[1] = green, prgb[2] = blue;
}
#undef postdiv
return 0;
}
static int
dca_map_color_rgb_alpha(gx_device * dev, gx_color_index color,
- gx_color_value prgba[4])
+ gx_color_value prgba[4])
{
prgba[3] = gx_color_value_from_byte((byte) color);
return dca_map_color_rgb(dev, color, prgba);
@@ -431,7 +431,7 @@ dca_map_color_rgb_alpha(gx_device * dev, gx_color_index color,
static int
dca_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{ /* This is where all the real work gets done! */
gx_device_composite_alpha *adev = (gx_device_composite_alpha *) dev;
gx_device *target = adev->target;
@@ -447,77 +447,77 @@ dca_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
fit_fill(dev, x, y, w, h);
std_row = gs_alloc_bytes(dev->memory,
- (dev->color_info.depth * w + 7) >> 3,
- "dca_fill_rectangle(std)");
+ (dev->color_info.depth * w + 7) >> 3,
+ "dca_fill_rectangle(std)");
native_row = gs_alloc_bytes(dev->memory,
- (target->color_info.depth * w + 7) >> 3,
- "dca_fill_rectangle(native)");
+ (target->color_info.depth * w + 7) >> 3,
+ "dca_fill_rectangle(native)");
if (std_row == 0 || native_row == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
rect.p.x = x, rect.q.x = x + w;
std_params.options =
- GB_COLORS_NATIVE |
- (GB_ALPHA_LAST | GB_DEPTH_8 | GB_PACKING_CHUNKY |
- GB_RETURN_COPY | GB_RETURN_POINTER | GB_ALIGN_ANY |
- GB_OFFSET_0 | GB_OFFSET_ANY | GB_RASTER_STANDARD |
- GB_RASTER_ANY);
+ GB_COLORS_NATIVE |
+ (GB_ALPHA_LAST | GB_DEPTH_8 | GB_PACKING_CHUNKY |
+ GB_RETURN_COPY | GB_RETURN_POINTER | GB_ALIGN_ANY |
+ GB_OFFSET_0 | GB_OFFSET_ANY | GB_RASTER_STANDARD |
+ GB_RASTER_ANY);
cp.cop = adev->params.op;
if (cp.cop == composite_Dissolve)
- cp.delta = adev->params.delta;
+ cp.delta = adev->params.delta;
{
- gx_color_value rgba[4];
+ gx_color_value rgba[4];
/****** DOESN'T HANDLE CMYK ******/
- (*dev_proc(dev, map_color_rgb_alpha)) (dev, color, rgba);
- cp.source_values[0] = gx_color_value_to_byte(rgba[0]);
- cp.source_values[1] = gx_color_value_to_byte(rgba[1]);
- cp.source_values[2] = gx_color_value_to_byte(rgba[2]);
- cp.source_alpha = gx_color_value_to_byte(rgba[3]);
+ (*dev_proc(dev, map_color_rgb_alpha)) (dev, color, rgba);
+ cp.source_values[0] = gx_color_value_to_byte(rgba[0]);
+ cp.source_values[1] = gx_color_value_to_byte(rgba[1]);
+ cp.source_values[2] = gx_color_value_to_byte(rgba[2]);
+ cp.source_alpha = gx_color_value_to_byte(rgba[3]);
}
source.data = 0;
source.bits_per_value = 8;
source.alpha = gs_image_alpha_none;
for (yi = y; yi < y + h; ++yi) {
- /* Read a row in standard representation. */
- rect.p.y = yi, rect.q.y = yi + 1;
- std_params.data[0] = std_row;
- code = (*dev_proc(target, get_bits_rectangle))
- (target, &rect, &std_params, NULL);
- if (code < 0)
- break;
- /* Do the work. */
- dest.data = std_params.data[0];
- dest.bits_per_value = 8;
- dest.initial_x =
- (std_params.options & GB_OFFSET_ANY ? std_params.x_offset : 0);
- dest.alpha =
- (std_params.options & GB_ALPHA_FIRST ? gs_image_alpha_first :
- std_params.options & GB_ALPHA_LAST ? gs_image_alpha_last :
- gs_image_alpha_none);
- code = composite_values(&dest, &source,
- dev->color_info.num_components, w, &cp);
- if (code < 0)
- break;
- if (std_params.data[0] == std_row) {
- /* Convert the row back to native representation. */
- /* (Otherwise, we had a direct pointer to device data.) */
- native_params.options =
- (GB_COLORS_NATIVE | GB_PACKING_CHUNKY | GB_RETURN_COPY |
- GB_OFFSET_0 | GB_RASTER_ALL | GB_ALIGN_STANDARD);
- native_params.data[0] = native_row;
- code = gx_get_bits_copy(target, 0, w, 1, &native_params,
- &std_params, std_row,
- 0 /* raster is irrelevant */ );
- if (code < 0)
- break;
- code = (*dev_proc(target, copy_color))
- (target, native_row, 0, 0 /* raster is irrelevant */ ,
- gx_no_bitmap_id, x, yi, w, 1);
- if (code < 0)
- break;
- }
+ /* Read a row in standard representation. */
+ rect.p.y = yi, rect.q.y = yi + 1;
+ std_params.data[0] = std_row;
+ code = (*dev_proc(target, get_bits_rectangle))
+ (target, &rect, &std_params, NULL);
+ if (code < 0)
+ break;
+ /* Do the work. */
+ dest.data = std_params.data[0];
+ dest.bits_per_value = 8;
+ dest.initial_x =
+ (std_params.options & GB_OFFSET_ANY ? std_params.x_offset : 0);
+ dest.alpha =
+ (std_params.options & GB_ALPHA_FIRST ? gs_image_alpha_first :
+ std_params.options & GB_ALPHA_LAST ? gs_image_alpha_last :
+ gs_image_alpha_none);
+ code = composite_values(&dest, &source,
+ dev->color_info.num_components, w, &cp);
+ if (code < 0)
+ break;
+ if (std_params.data[0] == std_row) {
+ /* Convert the row back to native representation. */
+ /* (Otherwise, we had a direct pointer to device data.) */
+ native_params.options =
+ (GB_COLORS_NATIVE | GB_PACKING_CHUNKY | GB_RETURN_COPY |
+ GB_OFFSET_0 | GB_RASTER_ALL | GB_ALIGN_STANDARD);
+ native_params.data[0] = native_row;
+ code = gx_get_bits_copy(target, 0, w, 1, &native_params,
+ &std_params, std_row,
+ 0 /* raster is irrelevant */ );
+ if (code < 0)
+ break;
+ code = (*dev_proc(target, copy_color))
+ (target, native_row, 0, 0 /* raster is irrelevant */ ,
+ gx_no_bitmap_id, x, yi, w, 1);
+ if (code < 0)
+ break;
+ }
}
out:gs_free_object(dev->memory, native_row, "dca_fill_rectangle(native)");
gs_free_object(dev->memory, std_row, "dca_fill_rectangle(std)");
@@ -526,18 +526,18 @@ dca_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
static int
dca_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
/****** TEMPORARY ******/
return gx_default_copy_mono(dev, data, dx, raster, id, x, y, w, h,
- zero, one);
+ zero, one);
}
static int
dca_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ int dx, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
/****** TEMPORARY ******/
return gx_default_copy_color(dev, data, dx, raster, id, x, y, w, h);
@@ -545,12 +545,12 @@ dca_copy_color(gx_device * dev, const byte * data,
static int
dca_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int x, int y, int width, int height,
+ gx_color_index color, int depth)
{
/****** TEMPORARY ******/
return gx_default_copy_alpha(dev, data, data_x, raster, id, x, y,
- width, height, color, depth);
+ width, height, color, depth);
}
/*
@@ -593,57 +593,57 @@ composite_values(const pixel_row_t * pdest, const const_pixel_row_t * psource,
sample_store_declare(dptr, dbit, dbyte);
{
- uint xbit = pdest->initial_x * dest_bpv * dest_vpp;
+ uint xbit = pdest->initial_x * dest_bpv * dest_vpp;
- sample_store_setup(dbit, xbit & 7, dest_bpv);
- dptr = pdest->data + (xbit >> 3);
+ sample_store_setup(dbit, xbit & 7, dest_bpv);
+ dptr = pdest->data + (xbit >> 3);
}
{
- uint xbit = psource->initial_x * source_bpv * source_vpp;
+ uint xbit = psource->initial_x * source_bpv * source_vpp;
- sbit = xbit & 7;
- sptr = psource->data + (xbit >> 3);
+ sbit = xbit & 7;
+ sptr = psource->data + (xbit >> 3);
}
{
- uint source_max = (1 << source_bpv) - 1;
- uint dest_max = (1 << dest_bpv) - 1;
-
- /*
- * We could save a little work by only setting up source_delta
- * and dest_delta if the operation is Dissolve.
- */
- float source_delta = pcp->delta * dest_max / source_max;
- float dest_delta = 1.0 - pcp->delta;
- uint source_alpha = pcp->source_alpha;
- uint dest_alpha = dest_max;
+ uint source_max = (1 << source_bpv) - 1;
+ uint dest_max = (1 << dest_bpv) - 1;
+
+ /*
+ * We could save a little work by only setting up source_delta
+ * and dest_delta if the operation is Dissolve.
+ */
+ float source_delta = pcp->delta * dest_max / source_max;
+ float dest_delta = 1.0 - pcp->delta;
+ uint source_alpha = pcp->source_alpha;
+ uint dest_alpha = dest_max;
#ifdef PREMULTIPLY_TOWARDS_WHITE
- uint source_bias = source_max - source_alpha;
- uint dest_bias = 0;
- uint result_bias = 0;
+ uint source_bias = source_max - source_alpha;
+ uint dest_bias = 0;
+ uint result_bias = 0;
#endif
- uint x;
-
- if (!pdest->alpha) {
- uint mask =
- (psource->alpha || source_alpha != source_max ?
- alpha_out_S_notD : alpha_out_notS_notD);
-
- if ((mask >> pcp->cop) & 1) {
- /*
- * The operation could produce non-unity alpha values, but
- * the destination can't store them. Return an error.
- */
- return_error(gs_error_rangecheck);
- }
- }
- /* Preload the output byte buffer if necessary. */
- sample_store_preload(dbyte, dptr, dbit, dest_bpv);
-
- for (x = 0; x < num_pixels; ++x) {
- int j;
- uint result_alpha = dest_alpha;
+ uint x;
+
+ if (!pdest->alpha) {
+ uint mask =
+ (psource->alpha || source_alpha != source_max ?
+ alpha_out_S_notD : alpha_out_notS_notD);
+
+ if ((mask >> pcp->cop) & 1) {
+ /*
+ * The operation could produce non-unity alpha values, but
+ * the destination can't store them. Return an error.
+ */
+ return_error(gs_error_rangecheck);
+ }
+ }
+ /* Preload the output byte buffer if necessary. */
+ sample_store_preload(dbyte, dptr, dbit, dest_bpv);
+
+ for (x = 0; x < num_pixels; ++x) {
+ int j;
+ uint result_alpha = dest_alpha;
/* get_value does not increment the source pointer. */
#define get_value(v, ptr, bit, bpv, vmax)\
@@ -656,30 +656,30 @@ composite_values(const pixel_row_t * pdest, const const_pixel_row_t * psource,
#define advance(ptr, bit, bpv)\
sample_next(ptr, bit, bpv)
- /* Get destination alpha value. */
- if (dest_alpha_j >= 0) {
- int dabit = dbit + dest_bpv * dest_alpha_j;
- const byte *daptr = dptr + (dabit >> 3);
+ /* Get destination alpha value. */
+ if (dest_alpha_j >= 0) {
+ int dabit = dbit + dest_bpv * dest_alpha_j;
+ const byte *daptr = dptr + (dabit >> 3);
- get_value(dest_alpha, daptr, dabit & 7, dest_bpv, dest_max);
+ get_value(dest_alpha, daptr, dabit & 7, dest_bpv, dest_max);
#ifdef PREMULTIPLY_TOWARDS_WHITE
- dest_bias = dest_max - dest_alpha;
+ dest_bias = dest_max - dest_alpha;
#endif
- }
- /* Get source alpha value. */
- if (source_alpha_j >= 0) {
- int sabit = sbit;
- const byte *saptr = sptr;
-
- if (source_alpha_j == 0)
- advance(sptr, sbit, source_bpv);
- else
- advance(saptr, sabit, source_bpv * source_alpha_j);
- get_value(source_alpha, saptr, sabit, source_bpv, source_max);
+ }
+ /* Get source alpha value. */
+ if (source_alpha_j >= 0) {
+ int sabit = sbit;
+ const byte *saptr = sptr;
+
+ if (source_alpha_j == 0)
+ advance(sptr, sbit, source_bpv);
+ else
+ advance(saptr, sabit, source_bpv * source_alpha_j);
+ get_value(source_alpha, saptr, sabit, source_bpv, source_max);
#ifdef PREMULTIPLY_TOWARDS_WHITE
- source_bias = source_max - source_alpha;
+ source_bias = source_max - source_alpha;
#endif
- }
+ }
/*
* We are always multiplying a dest value by a source value to compute a
* dest value, so the denominator is always source_max. (Dissolve is the
@@ -688,146 +688,146 @@ composite_values(const pixel_row_t * pdest, const const_pixel_row_t * psource,
#define fr(v, a) ((v) * (a) / source_max)
#define nfr(v, a, maxv) ((v) * (maxv - (a)) / source_max)
- /*
- * Iterate over the components of a single pixel.
- * j = 0 for alpha, 1 .. values_per_pixel for color
- * components, regardless of the actual storage order;
- * we arrange things so that sptr/sbit and dptr/dbit
- * always point to the right place.
- */
- for (j = 0; j <= values_per_pixel; ++j) {
- uint dest_v, source_v, result;
+ /*
+ * Iterate over the components of a single pixel.
+ * j = 0 for alpha, 1 .. values_per_pixel for color
+ * components, regardless of the actual storage order;
+ * we arrange things so that sptr/sbit and dptr/dbit
+ * always point to the right place.
+ */
+ for (j = 0; j <= values_per_pixel; ++j) {
+ uint dest_v, source_v, result;
#define set_clamped(r, v)\
BEGIN if ( (r = (v)) > dest_max ) r = dest_max; END
- if (j == 0) {
- source_v = source_alpha;
- dest_v = dest_alpha;
- } else {
- if (constant_colors)
- source_v = pcp->source_values[j - 1];
- else {
- get_value(source_v, sptr, sbit, source_bpv, source_max);
- advance(sptr, sbit, source_bpv);
- }
- get_value(dest_v, dptr, dbit, dest_bpv, dest_max);
+ if (j == 0) {
+ source_v = source_alpha;
+ dest_v = dest_alpha;
+ } else {
+ if (constant_colors)
+ source_v = pcp->source_values[j - 1];
+ else {
+ get_value(source_v, sptr, sbit, source_bpv, source_max);
+ advance(sptr, sbit, source_bpv);
+ }
+ get_value(dest_v, dptr, dbit, dest_bpv, dest_max);
#ifdef PREMULTIPLY_TOWARDS_WHITE
- source_v -= source_bias;
- dest_v -= dest_bias;
+ source_v -= source_bias;
+ dest_v -= dest_bias;
#endif
- }
-
- switch (pcp->cop) {
- case composite_Clear:
- /*
- * The NeXT documentation doesn't say this, but the CLEAR
- * operation sets not only alpha but also all the color
- * values to 0.
- */
- result = 0;
- break;
- case composite_Copy:
- result = source_v;
- break;
- case composite_PlusD:
- /*
- * This is the only case where we have to worry about
- * clamping a possibly negative result.
- */
- result = source_v + dest_v;
- result = (result < dest_max ? 0 : result - dest_max);
- break;
- case composite_PlusL:
- set_clamped(result, source_v + dest_v);
- break;
- case composite_Sover:
- set_clamped(result, source_v + nfr(dest_v, source_alpha, source_max));
- break;
- case composite_Dover:
- set_clamped(result, nfr(source_v, dest_alpha, dest_max) + dest_v);
- break;
- case composite_Sin:
- result = fr(source_v, dest_alpha);
- break;
- case composite_Din:
- result = fr(dest_v, source_alpha);
- break;
- case composite_Sout:
- result = nfr(source_v, dest_alpha, dest_max);
- break;
- case composite_Dout:
- result = nfr(dest_v, source_alpha, source_max);
- break;
- case composite_Satop:
- set_clamped(result, fr(source_v, dest_alpha) +
- nfr(dest_v, source_alpha, source_max));
- break;
- case composite_Datop:
- set_clamped(result, nfr(source_v, dest_alpha, dest_max) +
- fr(dest_v, source_alpha));
- break;
- case composite_Xor:
- set_clamped(result, nfr(source_v, dest_alpha, dest_max) +
- nfr(dest_v, source_alpha, source_max));
- break;
- case composite_Highlight:
- /*
- * Bizarre but true: this operation converts white and
- * light gray into each other, and leaves all other values
- * unchanged. We only implement it properly for gray-scale
- * devices.
- */
- if (j != 0 && !((source_v ^ highlight_value) & ~1))
- result = source_v ^ 1;
- else
- result = source_v;
- break;
- case composite_Dissolve:
- /*
- * In this case, and only this case, we need to worry about
- * source and dest having different bpv values. For the
- * moment, we wimp out and do everything in floating point.
- */
- result = (uint) (source_v * source_delta + dest_v * dest_delta);
- break;
- default:
- return_error(gs_error_rangecheck);
- }
- /*
- * Store the result. We don't have to worry about
- * destinations that don't store alpha, because we don't
- * even compute an alpha value in that case.
- */
+ }
+
+ switch (pcp->cop) {
+ case composite_Clear:
+ /*
+ * The NeXT documentation doesn't say this, but the CLEAR
+ * operation sets not only alpha but also all the color
+ * values to 0.
+ */
+ result = 0;
+ break;
+ case composite_Copy:
+ result = source_v;
+ break;
+ case composite_PlusD:
+ /*
+ * This is the only case where we have to worry about
+ * clamping a possibly negative result.
+ */
+ result = source_v + dest_v;
+ result = (result < dest_max ? 0 : result - dest_max);
+ break;
+ case composite_PlusL:
+ set_clamped(result, source_v + dest_v);
+ break;
+ case composite_Sover:
+ set_clamped(result, source_v + nfr(dest_v, source_alpha, source_max));
+ break;
+ case composite_Dover:
+ set_clamped(result, nfr(source_v, dest_alpha, dest_max) + dest_v);
+ break;
+ case composite_Sin:
+ result = fr(source_v, dest_alpha);
+ break;
+ case composite_Din:
+ result = fr(dest_v, source_alpha);
+ break;
+ case composite_Sout:
+ result = nfr(source_v, dest_alpha, dest_max);
+ break;
+ case composite_Dout:
+ result = nfr(dest_v, source_alpha, source_max);
+ break;
+ case composite_Satop:
+ set_clamped(result, fr(source_v, dest_alpha) +
+ nfr(dest_v, source_alpha, source_max));
+ break;
+ case composite_Datop:
+ set_clamped(result, nfr(source_v, dest_alpha, dest_max) +
+ fr(dest_v, source_alpha));
+ break;
+ case composite_Xor:
+ set_clamped(result, nfr(source_v, dest_alpha, dest_max) +
+ nfr(dest_v, source_alpha, source_max));
+ break;
+ case composite_Highlight:
+ /*
+ * Bizarre but true: this operation converts white and
+ * light gray into each other, and leaves all other values
+ * unchanged. We only implement it properly for gray-scale
+ * devices.
+ */
+ if (j != 0 && !((source_v ^ highlight_value) & ~1))
+ result = source_v ^ 1;
+ else
+ result = source_v;
+ break;
+ case composite_Dissolve:
+ /*
+ * In this case, and only this case, we need to worry about
+ * source and dest having different bpv values. For the
+ * moment, we wimp out and do everything in floating point.
+ */
+ result = (uint) (source_v * source_delta + dest_v * dest_delta);
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
+ /*
+ * Store the result. We don't have to worry about
+ * destinations that don't store alpha, because we don't
+ * even compute an alpha value in that case.
+ */
#ifdef PREMULTIPLY_TOWARDS_WHITE
- if (j == 0) {
- result_alpha = result;
- result_bias = dest_max - result_alpha;
- if (dest_alpha_j != 0)
- continue;
- } else {
- result += result_bias;
- }
+ if (j == 0) {
+ result_alpha = result;
+ result_bias = dest_max - result_alpha;
+ if (dest_alpha_j != 0)
+ continue;
+ } else {
+ result += result_bias;
+ }
#else
- if (j == 0 && dest_alpha_j != 0) {
- result_alpha = result;
- continue;
- }
+ if (j == 0 && dest_alpha_j != 0) {
+ result_alpha = result;
+ continue;
+ }
#endif
- put_value(result, dptr, dbit, dest_bpv, dbyte);
- }
- /* Skip a trailing source alpha value. */
- if (source_alpha_j > 0)
- advance(sptr, sbit, source_bpv);
- /* Store a trailing destination alpha value. */
- if (dest_alpha_j > 0)
- put_value(result_alpha, dptr, dbit, dest_bpv, dbyte);
+ put_value(result, dptr, dbit, dest_bpv, dbyte);
+ }
+ /* Skip a trailing source alpha value. */
+ if (source_alpha_j > 0)
+ advance(sptr, sbit, source_bpv);
+ /* Store a trailing destination alpha value. */
+ if (dest_alpha_j > 0)
+ put_value(result_alpha, dptr, dbit, dest_bpv, dbyte);
#undef get_value
#undef put_value
#undef advance
- }
- /* Store any partial output byte. */
- sample_store_flush(dptr, dbit, dest_bpv, dbyte);
+ }
+ /* Store any partial output byte. */
+ sample_store_flush(dptr, dbit, dest_bpv, dbyte);
}
return 0;
}
diff --git a/gs/base/gsalphac.h b/gs/base/gsalphac.h
index fa614a2fb..bc480b899 100644
--- a/gs/base/gsalphac.h
+++ b/gs/base/gsalphac.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,7 +54,7 @@ typedef struct gs_composite_alpha_params_s {
/* Create an alpha-compositing object. */
int gs_create_composite_alpha(gs_composite_t ** ppcte,
- const gs_composite_alpha_params_t * params,
- gs_memory_t * mem);
+ const gs_composite_alpha_params_t * params,
+ gs_memory_t * mem);
#endif /* gsalphac_INCLUDED */
diff --git a/gs/base/gsargs.c b/gs/base/gsargs.c
index 552f06620..4853b8bf5 100644
--- a/gs/base/gsargs.c
+++ b/gs/base/gsargs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,8 +24,8 @@
/* Initialize an arg list. */
void
arg_init(arg_list * pal, const char **argv, int argc,
- FILE * (*arg_fopen) (const char *fname, void *fopen_data),
- void *fopen_data)
+ FILE * (*arg_fopen) (const char *fname, void *fopen_data),
+ void *fopen_data)
{
pal->expand_ats = true;
pal->arg_fopen = arg_fopen;
@@ -42,8 +42,8 @@ arg_push_memory_string(arg_list * pal, char *str, bool parsed, gs_memory_t * mem
arg_source *pas;
if (pal->depth == arg_depth_max) {
- lprintf("Too much nesting of @-files.\n");
- return 1;
+ lprintf("Too much nesting of @-files.\n");
+ return 1;
}
pas = &pal->sources[pal->depth];
pas->is_file = false;
@@ -60,12 +60,12 @@ void
arg_finit(arg_list * pal)
{
while (pal->depth) {
- arg_source *pas = &pal->sources[--(pal->depth)];
+ arg_source *pas = &pal->sources[--(pal->depth)];
- if (pas->is_file)
- fclose(pas->u.file);
- else if (pas->u.s.memory)
- gs_free_object(pas->u.s.memory, pas->u.s.chars, "arg_finit");
+ if (pas->is_file)
+ fclose(pas->u.file);
+ else if (pas->u.s.memory)
+ gs_free_object(pas->u.s.memory, pas->u.s.chars, "arg_finit");
}
}
@@ -85,32 +85,32 @@ arg_next(arg_list * pal, int *code)
top:pas = &pal->sources[pal->depth - 1];
if (pal->depth == 0) {
- if (pal->argn <= 0) /* all done */
- return 0;
- pal->argn--;
- result = *(pal->argp++);
- goto at;
+ if (pal->argn <= 0) /* all done */
+ return 0;
+ pal->argn--;
+ result = *(pal->argp++);
+ goto at;
}
if (pas->is_file)
- f = pas->u.file, endc = EOF;
+ f = pas->u.file, endc = EOF;
else if (pas->u.s.parsed)
- /* this string is a "pushed-back" argument */
- /* (retrieved by a precedeing arg_next(), but not processed) */
- if (strlen(pas->u.s.str) >= arg_str_max) {
- errprintf(pas->u.s.memory, "Command too long: %s\n", pas->u.s.str);
- *code = gs_error_Fatal;
- return NULL;
- } else {
- strcpy(pal->cstr, pas->u.s.str);
- result = pal->cstr;
- if (pas->u.s.memory)
- gs_free_object(pas->u.s.memory, pas->u.s.chars, "arg_next");
- pal->depth--;
- pas--;
- goto at;
- }
+ /* this string is a "pushed-back" argument */
+ /* (retrieved by a precedeing arg_next(), but not processed) */
+ if (strlen(pas->u.s.str) >= arg_str_max) {
+ errprintf(pas->u.s.memory, "Command too long: %s\n", pas->u.s.str);
+ *code = gs_error_Fatal;
+ return NULL;
+ } else {
+ strcpy(pal->cstr, pas->u.s.str);
+ result = pal->cstr;
+ if (pas->u.s.memory)
+ gs_free_object(pas->u.s.memory, pas->u.s.chars, "arg_next");
+ pal->depth--;
+ pas--;
+ goto at;
+ }
else
- astr = pas->u.s.str, f = NULL, endc = 0;
+ astr = pas->u.s.str, f = NULL, endc = 0;
result = cstr = pal->cstr;
#define cfsgetc() (f == NULL ? (*astr ? *astr++ : 0) : fgetc(f))
#define is_eol(c) (c == '\r' || c == '\n')
@@ -119,107 +119,107 @@ arg_next(arg_list * pal, int *code)
eol = true;
c = cfsgetc();
for (i = 0;;) {
- if (c == endc) {
- if (in_quote) {
- cstr[i] = 0;
- errprintf(pas->u.s.memory,
+ if (c == endc) {
+ if (in_quote) {
+ cstr[i] = 0;
+ errprintf(pas->u.s.memory,
"Unterminated quote in @-file: %s\n", cstr);
- *code = gs_error_Fatal;
- return NULL;
- }
- if (i == 0) {
- /* EOF before any argument characters. */
- if (f != NULL)
- fclose(f);
- else if (pas->u.s.memory)
- gs_free_object(pas->u.s.memory, pas->u.s.chars,
- "arg_next");
- pal->depth--;
- goto top;
- }
- break;
- }
- /* c != endc */
- if (isspace(c)) {
- if (i == 0) {
- c = cfsgetc();
- continue;
- }
- if (!in_quote)
- break;
- }
- /* c isn't leading or terminating whitespace. */
- if (c == '#' && eol) {
- /* Skip a comment. */
- do {
- c = cfsgetc();
- } while (!(c == endc || is_eol(c)));
- if (c == '\r')
- c = cfsgetc();
- if (c == '\n')
- c = cfsgetc();
- continue;
- }
- if (c == '\\') {
- /* Check for \ followed by newline. */
- c = cfsgetc();
- if (is_eol(c)) {
- if (c == '\r')
- c = cfsgetc();
- if (c == '\n')
- c = cfsgetc();
- eol = true;
- continue;
- }
- /* \ anywhere else is treated as a printing character. */
- /* This is different from the Unix shells. */
- if (i == arg_str_max - 1) {
- cstr[i] = 0;
- errprintf(pas->u.s.memory, "Command too long: %s\n", cstr);
- *code = gs_error_Fatal;
- return NULL;
- }
- cstr[i++] = '\\';
- eol = false;
- continue;
- }
- /* c will become part of the argument */
- if (i == arg_str_max - 1) {
- cstr[i] = 0;
- errprintf(pas->u.s.memory, "Command too long: %s\n", cstr);
- *code = gs_error_Fatal;
- return NULL;
- }
- /* Allow quotes to protect whitespace. */
- /* (special cases have already been handled and don't reach this point) */
- if (c == '"')
- in_quote = !in_quote;
- else
- cstr[i++] = c;
- eol = is_eol(c);
- c = cfsgetc();
+ *code = gs_error_Fatal;
+ return NULL;
+ }
+ if (i == 0) {
+ /* EOF before any argument characters. */
+ if (f != NULL)
+ fclose(f);
+ else if (pas->u.s.memory)
+ gs_free_object(pas->u.s.memory, pas->u.s.chars,
+ "arg_next");
+ pal->depth--;
+ goto top;
+ }
+ break;
+ }
+ /* c != endc */
+ if (isspace(c)) {
+ if (i == 0) {
+ c = cfsgetc();
+ continue;
+ }
+ if (!in_quote)
+ break;
+ }
+ /* c isn't leading or terminating whitespace. */
+ if (c == '#' && eol) {
+ /* Skip a comment. */
+ do {
+ c = cfsgetc();
+ } while (!(c == endc || is_eol(c)));
+ if (c == '\r')
+ c = cfsgetc();
+ if (c == '\n')
+ c = cfsgetc();
+ continue;
+ }
+ if (c == '\\') {
+ /* Check for \ followed by newline. */
+ c = cfsgetc();
+ if (is_eol(c)) {
+ if (c == '\r')
+ c = cfsgetc();
+ if (c == '\n')
+ c = cfsgetc();
+ eol = true;
+ continue;
+ }
+ /* \ anywhere else is treated as a printing character. */
+ /* This is different from the Unix shells. */
+ if (i == arg_str_max - 1) {
+ cstr[i] = 0;
+ errprintf(pas->u.s.memory, "Command too long: %s\n", cstr);
+ *code = gs_error_Fatal;
+ return NULL;
+ }
+ cstr[i++] = '\\';
+ eol = false;
+ continue;
+ }
+ /* c will become part of the argument */
+ if (i == arg_str_max - 1) {
+ cstr[i] = 0;
+ errprintf(pas->u.s.memory, "Command too long: %s\n", cstr);
+ *code = gs_error_Fatal;
+ return NULL;
+ }
+ /* Allow quotes to protect whitespace. */
+ /* (special cases have already been handled and don't reach this point) */
+ if (c == '"')
+ in_quote = !in_quote;
+ else
+ cstr[i++] = c;
+ eol = is_eol(c);
+ c = cfsgetc();
}
cstr[i] = 0;
if (f == NULL)
- pas->u.s.str = astr;
+ pas->u.s.str = astr;
at:if (pal->expand_ats && result[0] == '@') {
- if (pal->depth == arg_depth_max) {
- errprintf(pas->u.s.memory, "Too much nesting of @-files.\n");
- *code = gs_error_Fatal;
- return NULL;
- }
- result++; /* skip @ */
- f = (*pal->arg_fopen) (result, pal->fopen_data);
- if (f == NULL) {
- errprintf(pas->u.s.memory, "Unable to open command line file %s\n", result);
- *code = gs_error_Fatal;
- return NULL;
- }
- pal->depth++;
- pas++;
- pas->is_file = true;
- pas->u.file = f;
- goto top;
+ if (pal->depth == arg_depth_max) {
+ errprintf(pas->u.s.memory, "Too much nesting of @-files.\n");
+ *code = gs_error_Fatal;
+ return NULL;
+ }
+ result++; /* skip @ */
+ f = (*pal->arg_fopen) (result, pal->fopen_data);
+ if (f == NULL) {
+ errprintf(pas->u.s.memory, "Unable to open command line file %s\n", result);
+ *code = gs_error_Fatal;
+ return NULL;
+ }
+ pal->depth++;
+ pas++;
+ pas->is_file = true;
+ pas->u.file = f;
+ goto top;
}
return result;
}
@@ -231,8 +231,8 @@ arg_copy(const char *str, gs_memory_t * mem)
char *sstr = (char *)gs_alloc_bytes(mem, strlen(str) + 1, "arg_copy");
if (sstr == 0) {
- lprintf("Out of memory!\n");
- return NULL;
+ lprintf("Out of memory!\n");
+ return NULL;
}
strcpy(sstr, str);
return sstr;
diff --git a/gs/base/gsargs.h b/gs/base/gsargs.h
index 72b450137..4d5ef1aa7 100644
--- a/gs/base/gsargs.h
+++ b/gs/base/gsargs.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,13 +28,13 @@
typedef struct arg_source_s {
bool is_file;
union _u {
- struct _su {
- bool parsed; /* true for "pushed-back" argument, not to be parsed again */
- char *chars; /* original string */
- gs_memory_t *memory; /* if non-0, free chars when done with it */
- const char *str; /* string being read */
- } s;
- FILE *file;
+ struct _su {
+ bool parsed; /* true for "pushed-back" argument, not to be parsed again */
+ char *chars; /* original string */
+ gs_memory_t *memory; /* if non-0, free chars when done with it */
+ const char *str; /* string being read */
+ } s;
+ FILE *file;
} u;
} arg_source;
typedef struct arg_list_s {
@@ -50,8 +50,8 @@ typedef struct arg_list_s {
/* Initialize an arg list. */
void arg_init(arg_list * pal, const char **argv, int argc,
- FILE * (*arg_fopen) (const char *fname, void *fopen_data),
- void *fopen_data);
+ FILE * (*arg_fopen) (const char *fname, void *fopen_data),
+ void *fopen_data);
/*
* Push a string onto an arg list.
diff --git a/gs/base/gsbitcom.c b/gs/base/gsbitcom.c
index 11c7a91b5..38e90c023 100644
--- a/gs/base/gsbitcom.c
+++ b/gs/base/gsbitcom.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -94,8 +94,8 @@ static const byte *const compress_tables[4][4] = {
*/
void
bits_compress_scaled(const byte * src, int srcx, uint width, uint height,
- uint sraster, byte * dest, uint draster,
- const gs_log2_scale_point *plog2_scale, int log2_out_bits)
+ uint sraster, byte * dest, uint draster,
+ const gs_log2_scale_point *plog2_scale, int log2_out_bits)
{
int log2_x = plog2_scale->x, log2_y = plog2_scale->y;
int xscale = 1 << log2_x;
@@ -110,7 +110,7 @@ bits_compress_scaled(const byte * src, int srcx, uint width, uint height,
int input_byte_out_bits = out_bits << (3 - log2_x);
byte input_byte_out_mask = (1 << input_byte_out_bits) - 1;
const byte *table =
- compress_tables[log2_out_bits][log2_x + log2_y - 1];
+ compress_tables[log2_out_bits][log2_x + log2_y - 1];
uint sskip = sraster << log2_y;
uint dwidth = (width >> log2_x) << log2_out_bits;
uint dskip = draster - ((dwidth + 7) >> 3);
@@ -127,7 +127,7 @@ bits_compress_scaled(const byte * src, int srcx, uint width, uint height,
uint h;
for (h = height; h; srow += sskip, h -= yscale) {
- const byte *s = srow;
+ const byte *s = srow;
#if ALPHA_LSB_FIRST
# define out_shift_initial 0
@@ -136,161 +136,161 @@ bits_compress_scaled(const byte * src, int srcx, uint width, uint height,
# define out_shift_initial (8 - out_bits)
# define out_shift_update(out_shift, nbits) ((out_shift -= (nbits)) < 0)
#endif
- int out_shift = out_shift_initial;
- byte out = 0;
- int in_shift = in_shift_initial;
- int dw = 8 - (srcx & 7);
- int w;
+ int out_shift = out_shift_initial;
+ byte out = 0;
+ int in_shift = in_shift_initial;
+ int dw = 8 - (srcx & 7);
+ int w;
- /* Loop over source bytes. */
- for (w = width; w > 0; w -= dw, dw = 8) {
- int index;
- int in_shift_final = (w >= dw ? 0 : dw - w);
+ /* Loop over source bytes. */
+ for (w = width; w > 0; w -= dw, dw = 8) {
+ int index;
+ int in_shift_final = (w >= dw ? 0 : dw - w);
- /*
- * Check quickly for all-0s or all-1s, but only if each
- * input byte generates no more than one output byte,
- * we're at an input byte boundary, and we're processing
- * an entire input byte (i.e., this isn't a final
- * partial byte.)
- */
- if (in_shift == in_shift_check && in_shift_final == 0)
- switch (*s) {
- case 0:
- for (index = sraster; index != sskip; index += sraster)
- if (s[index] != 0)
- goto p;
- if (out_shift_update(out_shift, input_byte_out_bits))
- *d++ = out, out_shift &= 7, out = 0;
- s++;
- continue;
+ /*
+ * Check quickly for all-0s or all-1s, but only if each
+ * input byte generates no more than one output byte,
+ * we're at an input byte boundary, and we're processing
+ * an entire input byte (i.e., this isn't a final
+ * partial byte.)
+ */
+ if (in_shift == in_shift_check && in_shift_final == 0)
+ switch (*s) {
+ case 0:
+ for (index = sraster; index != sskip; index += sraster)
+ if (s[index] != 0)
+ goto p;
+ if (out_shift_update(out_shift, input_byte_out_bits))
+ *d++ = out, out_shift &= 7, out = 0;
+ s++;
+ continue;
#if !ALPHA_LSB_FIRST /* too messy to make it work */
- case 0xff:
- for (index = sraster; index != sskip; index += sraster)
- if (s[index] != 0xff)
- goto p;
- {
- int shift =
- (out_shift -= input_byte_out_bits) + out_bits;
+ case 0xff:
+ for (index = sraster; index != sskip; index += sraster)
+ if (s[index] != 0xff)
+ goto p;
+ {
+ int shift =
+ (out_shift -= input_byte_out_bits) + out_bits;
- if (shift > 0)
- out |= input_byte_out_mask << shift;
- else {
- out |= input_byte_out_mask >> -shift;
- *d++ = out;
- out_shift += 8;
- out = input_byte_out_mask << (8 + shift);
- }
- }
- s++;
- continue;
+ if (shift > 0)
+ out |= input_byte_out_mask << shift;
+ else {
+ out |= input_byte_out_mask >> -shift;
+ *d++ = out;
+ out_shift += 8;
+ out = input_byte_out_mask << (8 + shift);
+ }
+ }
+ s++;
+ continue;
#endif
- default:
- ;
- }
- p: /* Loop over source pixels within a byte. */
- do {
- uint count;
+ default:
+ ;
+ }
+ p: /* Loop over source pixels within a byte. */
+ do {
+ uint count;
- for (index = 0, count = 0; index != sskip;
- index += sraster
- )
- count += half_byte_1s[(s[index] >> in_shift) & mask];
- if (count != 0 && table[count] == 0) { /* Look at adjacent cells to help prevent */
- /* dropouts. */
- uint orig_count = count;
- uint shifted_mask = mask << in_shift;
- byte in;
+ for (index = 0, count = 0; index != sskip;
+ index += sraster
+ )
+ count += half_byte_1s[(s[index] >> in_shift) & mask];
+ if (count != 0 && table[count] == 0) { /* Look at adjacent cells to help prevent */
+ /* dropouts. */
+ uint orig_count = count;
+ uint shifted_mask = mask << in_shift;
+ byte in;
- if_debug3('B', "[B]count(%d,%d)=%d\n",
- (width - w) / xscale,
- (height - h) / yscale, count);
- if (yscale > 1) { /* Look at the next "lower" cell. */
- if (h < height && (in = s[0] & shifted_mask) != 0) {
- uint lower;
+ if_debug3('B', "[B]count(%d,%d)=%d\n",
+ (width - w) / xscale,
+ (height - h) / yscale, count);
+ if (yscale > 1) { /* Look at the next "lower" cell. */
+ if (h < height && (in = s[0] & shifted_mask) != 0) {
+ uint lower;
- for (index = 0, lower = 0;
- -(index -= sraster) <= sskip &&
- (in &= s[index]) != 0;
- )
- lower += half_byte_1s[in >> in_shift];
- if_debug1('B', "[B] lower adds %d\n",
- lower);
- if (lower <= orig_count)
- count += lower;
- }
- /* Look at the next "higher" cell. */
- if (h > yscale && (in = s[sskip - sraster] & shifted_mask) != 0) {
- uint upper;
+ for (index = 0, lower = 0;
+ -(index -= sraster) <= sskip &&
+ (in &= s[index]) != 0;
+ )
+ lower += half_byte_1s[in >> in_shift];
+ if_debug1('B', "[B] lower adds %d\n",
+ lower);
+ if (lower <= orig_count)
+ count += lower;
+ }
+ /* Look at the next "higher" cell. */
+ if (h > yscale && (in = s[sskip - sraster] & shifted_mask) != 0) {
+ uint upper;
- for (index = sskip, upper = 0;
- index < sskip << 1 &&
- (in &= s[index]) != 0;
- index += sraster
- )
- upper += half_byte_1s[in >> in_shift];
- if_debug1('B', "[B] upper adds %d\n",
- upper);
- if (upper < orig_count)
- count += upper;
- }
- }
- if (xscale > 1) {
- uint mask1 = (mask << 1) + 1;
+ for (index = sskip, upper = 0;
+ index < sskip << 1 &&
+ (in &= s[index]) != 0;
+ index += sraster
+ )
+ upper += half_byte_1s[in >> in_shift];
+ if_debug1('B', "[B] upper adds %d\n",
+ upper);
+ if (upper < orig_count)
+ count += upper;
+ }
+ }
+ if (xscale > 1) {
+ uint mask1 = (mask << 1) + 1;
- /* Look at the next cell to the left. */
- if (w < width) {
- int lshift = in_shift + xscale - 1;
- uint left;
+ /* Look at the next cell to the left. */
+ if (w < width) {
+ int lshift = in_shift + xscale - 1;
+ uint left;
- for (index = 0, left = 0;
- index < sskip; index += sraster
- ) {
- uint bits =
- ((s[index - 1] << 8) +
- s[index]) >> lshift;
+ for (index = 0, left = 0;
+ index < sskip; index += sraster
+ ) {
+ uint bits =
+ ((s[index - 1] << 8) +
+ s[index]) >> lshift;
- left += bits5_trailing_1s[bits & mask1];
- }
- if_debug1('B', "[B] left adds %d\n",
- left);
- if (left < orig_count)
- count += left;
- }
- /* Look at the next cell to the right. */
- if (w > xscale) {
- int rshift = in_shift - xscale + 8;
- uint right;
+ left += bits5_trailing_1s[bits & mask1];
+ }
+ if_debug1('B', "[B] left adds %d\n",
+ left);
+ if (left < orig_count)
+ count += left;
+ }
+ /* Look at the next cell to the right. */
+ if (w > xscale) {
+ int rshift = in_shift - xscale + 8;
+ uint right;
- for (index = 0, right = 0;
- index < sskip; index += sraster
- ) {
- uint bits =
- ((s[index] << 8) +
- s[index + 1]) >> rshift;
+ for (index = 0, right = 0;
+ index < sskip; index += sraster
+ ) {
+ uint bits =
+ ((s[index] << 8) +
+ s[index + 1]) >> rshift;
- right += bits5_leading_1s[(bits & mask1) << (4 - xscale)];
- }
- if_debug1('B', "[B] right adds %d\n",
- right);
- if (right <= orig_count)
- count += right;
- }
- }
- if (count > count_max)
- count = count_max;
- }
- out += table[count] << out_shift;
- if (out_shift_update(out_shift, out_bits))
- *d++ = out, out_shift &= 7, out = 0;
- }
- while ((in_shift -= xscale) >= in_shift_final);
- s++, in_shift += 8;
- }
- if (out_shift != out_shift_initial)
- *d++ = out;
- for (w = dskip; w != 0; w--)
- *d++ = 0;
+ right += bits5_leading_1s[(bits & mask1) << (4 - xscale)];
+ }
+ if_debug1('B', "[B] right adds %d\n",
+ right);
+ if (right <= orig_count)
+ count += right;
+ }
+ }
+ if (count > count_max)
+ count = count_max;
+ }
+ out += table[count] << out_shift;
+ if (out_shift_update(out_shift, out_bits))
+ *d++ = out, out_shift &= 7, out = 0;
+ }
+ while ((in_shift -= xscale) >= in_shift_final);
+ s++, in_shift += 8;
+ }
+ if (out_shift != out_shift_initial)
+ *d++ = out;
+ for (w = dskip; w != 0; w--)
+ *d++ = 0;
#undef out_shift_initial
#undef out_shift_update
}
diff --git a/gs/base/gsbitmap.h b/gs/base/gsbitmap.h
index 0fb18fa7c..d895601f3 100644
--- a/gs/base/gsbitmap.h
+++ b/gs/base/gsbitmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -166,29 +166,29 @@ extern_st(st_gs_tile_depth_bitmap);
#define public_st_gs_tile_bitmap() /* in gspcolor.c */ \
gs_public_st_suffix_add0_local( st_gs_tile_bitmap, \
- gs_tile_bitmap, \
- "client tile bitmap", \
- bitmap_enum_ptrs, \
- bitmap_reloc_ptrs, \
- st_gs_bitmap \
- )
+ gs_tile_bitmap, \
+ "client tile bitmap", \
+ bitmap_enum_ptrs, \
+ bitmap_reloc_ptrs, \
+ st_gs_bitmap \
+ )
#define public_st_gs_depth_bitmap() /* in gspcolor.c */ \
gs_public_st_suffix_add0_local( st_gs_depth_bitmap, \
- gs_depth_bitmap, \
- "client depth bitmap", \
- bitmap_enum_ptrs, \
- bitmap_reloc_ptrs, \
- st_gs_bitmap \
- )
+ gs_depth_bitmap, \
+ "client depth bitmap", \
+ bitmap_enum_ptrs, \
+ bitmap_reloc_ptrs, \
+ st_gs_bitmap \
+ )
#define public_st_gs_tile_depth_bitmap()/* in gspcolor.c */ \
gs_public_st_suffix_add0_local( st_gs_tile_depth_bitmap, \
- gs_tile_depth_bitmap, \
- "client tile_depth bitmap", \
- bitmap_enum_ptrs, \
- bitmap_reloc_ptrs, \
- st_gs_tile_bitmap \
- )
+ gs_tile_depth_bitmap, \
+ "client tile_depth bitmap", \
+ bitmap_enum_ptrs, \
+ bitmap_reloc_ptrs, \
+ st_gs_tile_bitmap \
+ )
#endif /* gsbitmap_INCLUDED */
diff --git a/gs/base/gsbitops.c b/gs/base/gsbitops.c
index 74eb5bb23..11652e226 100644
--- a/gs/base/gsbitops.c
+++ b/gs/base/gsbitops.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,7 +57,7 @@ const bits32 mono_fill_masks[33] = {
#define mono_masks mono_fill_masks
void
bits_fill_rectangle(byte * dest, int dest_bit, uint draster,
- mono_fill_chunk pattern, int width_bits, int height)
+ mono_fill_chunk pattern, int width_bits, int height)
{
uint bit;
chunk right_mask;
@@ -66,7 +66,7 @@ bits_fill_rectangle(byte * dest, int dest_bit, uint draster,
int last_bit;
#define FOR_EACH_LINE(stat)\
- do { stat } while ( inc_ptr(ptr, draster), --line_count )
+ do { stat } while ( inc_ptr(ptr, draster), --line_count )
dest += (dest_bit >> 3) & -chunk_align_bytes;
ptr = (chunk *) dest;
@@ -74,64 +74,64 @@ bits_fill_rectangle(byte * dest, int dest_bit, uint draster,
last_bit = width_bits + bit - (chunk_bits + 1);
if (last_bit < 0) { /* <=1 chunk */
- set_mono_thin_mask(right_mask, width_bits, bit);
- if (pattern == 0)
- FOR_EACH_LINE(*ptr &= ~right_mask;);
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE(*ptr |= right_mask;);
- else
- FOR_EACH_LINE(
- *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
+ set_mono_thin_mask(right_mask, width_bits, bit);
+ if (pattern == 0)
+ FOR_EACH_LINE(*ptr &= ~right_mask;);
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE(*ptr |= right_mask;);
+ else
+ FOR_EACH_LINE(
+ *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
} else {
- chunk mask;
- int last = last_bit >> chunk_log2_bits;
-
- set_mono_left_mask(mask, bit);
- set_mono_right_mask(right_mask, (last_bit & chunk_bit_mask) + 1);
- switch (last) {
- case 0: /* 2 chunks */
- if (pattern == 0)
- FOR_EACH_LINE(*ptr &= ~mask; ptr[1] &= ~right_mask;);
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE(*ptr |= mask; ptr[1] |= right_mask;);
- else
- FOR_EACH_LINE(
- *ptr = (*ptr & ~mask) | (pattern & mask);
- ptr[1] = (ptr[1] & ~right_mask) | (pattern & right_mask); );
- break;
- case 1: /* 3 chunks */
- if (pattern == 0)
- FOR_EACH_LINE( *ptr &= ~mask;
- ptr[1] = 0;
- ptr[2] &= ~right_mask; );
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE( *ptr |= mask;
- ptr[1] = ~(chunk) 0;
- ptr[2] |= right_mask; );
- else
- FOR_EACH_LINE( *ptr = (*ptr & ~mask) | (pattern & mask);
- ptr[1] = pattern;
- ptr[2] = (ptr[2] & ~right_mask) | (pattern & right_mask); );
- break;
- default:{ /* >3 chunks */
- uint byte_count = (last_bit >> 3) & -chunk_bytes;
-
- if (pattern == 0)
- FOR_EACH_LINE( *ptr &= ~mask;
- memset(ptr + 1, 0, byte_count);
- ptr[last + 1] &= ~right_mask; );
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE( *ptr |= mask;
- memset(ptr + 1, 0xff, byte_count);
- ptr[last + 1] |= right_mask; );
- else
- FOR_EACH_LINE(
- *ptr = (*ptr & ~mask) | (pattern & mask);
- memset(ptr + 1, (byte) pattern, byte_count);
- ptr[last + 1] = (ptr[last + 1] & ~right_mask) |
- (pattern & right_mask); );
- }
- }
+ chunk mask;
+ int last = last_bit >> chunk_log2_bits;
+
+ set_mono_left_mask(mask, bit);
+ set_mono_right_mask(right_mask, (last_bit & chunk_bit_mask) + 1);
+ switch (last) {
+ case 0: /* 2 chunks */
+ if (pattern == 0)
+ FOR_EACH_LINE(*ptr &= ~mask; ptr[1] &= ~right_mask;);
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE(*ptr |= mask; ptr[1] |= right_mask;);
+ else
+ FOR_EACH_LINE(
+ *ptr = (*ptr & ~mask) | (pattern & mask);
+ ptr[1] = (ptr[1] & ~right_mask) | (pattern & right_mask); );
+ break;
+ case 1: /* 3 chunks */
+ if (pattern == 0)
+ FOR_EACH_LINE( *ptr &= ~mask;
+ ptr[1] = 0;
+ ptr[2] &= ~right_mask; );
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE( *ptr |= mask;
+ ptr[1] = ~(chunk) 0;
+ ptr[2] |= right_mask; );
+ else
+ FOR_EACH_LINE( *ptr = (*ptr & ~mask) | (pattern & mask);
+ ptr[1] = pattern;
+ ptr[2] = (ptr[2] & ~right_mask) | (pattern & right_mask); );
+ break;
+ default:{ /* >3 chunks */
+ uint byte_count = (last_bit >> 3) & -chunk_bytes;
+
+ if (pattern == 0)
+ FOR_EACH_LINE( *ptr &= ~mask;
+ memset(ptr + 1, 0, byte_count);
+ ptr[last + 1] &= ~right_mask; );
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE( *ptr |= mask;
+ memset(ptr + 1, 0xff, byte_count);
+ ptr[last + 1] |= right_mask; );
+ else
+ FOR_EACH_LINE(
+ *ptr = (*ptr & ~mask) | (pattern & mask);
+ memset(ptr + 1, (byte) pattern, byte_count);
+ ptr[last + 1] = (ptr[last + 1] & ~right_mask) |
+ (pattern & right_mask); );
+ }
+ }
}
#undef FOR_EACH_LINE
}
@@ -144,8 +144,8 @@ bits_fill_rectangle(byte * dest, int dest_bit, uint draster,
*/
void
bits_fill_rectangle_masked(byte * dest, int dest_bit, uint draster,
- mono_fill_chunk pattern, mono_fill_chunk src_mask,
- int width_bits, int height)
+ mono_fill_chunk pattern, mono_fill_chunk src_mask,
+ int width_bits, int height)
{
uint bit;
chunk right_mask;
@@ -154,7 +154,7 @@ bits_fill_rectangle_masked(byte * dest, int dest_bit, uint draster,
int last_bit;
#define FOR_EACH_LINE(stat)\
- do { stat } while ( inc_ptr(ptr, draster), --line_count )
+ do { stat } while ( inc_ptr(ptr, draster), --line_count )
dest += (dest_bit >> 3) & -chunk_align_bytes;
ptr = (chunk *) dest;
@@ -162,71 +162,71 @@ bits_fill_rectangle_masked(byte * dest, int dest_bit, uint draster,
last_bit = width_bits + bit - (chunk_bits + 1);
if (last_bit < 0) { /* <=1 chunk */
- set_mono_thin_mask(right_mask, width_bits, bit);
- right_mask &= ~src_mask;
- if (pattern == 0)
- FOR_EACH_LINE(*ptr &= ~right_mask;);
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE(*ptr |= right_mask;);
- else
- FOR_EACH_LINE(
- *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
+ set_mono_thin_mask(right_mask, width_bits, bit);
+ right_mask &= ~src_mask;
+ if (pattern == 0)
+ FOR_EACH_LINE(*ptr &= ~right_mask;);
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE(*ptr |= right_mask;);
+ else
+ FOR_EACH_LINE(
+ *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
} else {
- chunk mask;
- int last = last_bit >> chunk_log2_bits;
-
- set_mono_left_mask(mask, bit);
- set_mono_right_mask(right_mask, (last_bit & chunk_bit_mask) + 1);
- mask &= ~src_mask;
- right_mask &= ~src_mask;
- switch (last) {
- case 0: /* 2 chunks */
- if (pattern == 0)
- FOR_EACH_LINE(*ptr &= ~mask; ptr[1] &= ~right_mask;);
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE(*ptr |= mask; ptr[1] |= right_mask;);
- else
- FOR_EACH_LINE(
- *ptr = (*ptr & ~mask) | (pattern & mask);
- ptr[1] = (ptr[1] & ~right_mask) | (pattern & right_mask); );
- break;
- case 1: /* 3 chunks */
- if (pattern == 0)
- FOR_EACH_LINE( *ptr &= ~mask;
- ptr[1] &= src_mask;
- ptr[2] &= ~right_mask; );
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE( *ptr |= mask;
- ptr[1] |= ~src_mask;
- ptr[2] |= right_mask; );
- else
- FOR_EACH_LINE( *ptr = (*ptr & ~mask) | (pattern & mask);
- ptr[1] =(ptr[1] & src_mask) | pattern;
- ptr[2] = (ptr[2] & ~right_mask) | (pattern & right_mask); );
- break;
- default:{ /* >3 chunks */
+ chunk mask;
+ int last = last_bit >> chunk_log2_bits;
+
+ set_mono_left_mask(mask, bit);
+ set_mono_right_mask(right_mask, (last_bit & chunk_bit_mask) + 1);
+ mask &= ~src_mask;
+ right_mask &= ~src_mask;
+ switch (last) {
+ case 0: /* 2 chunks */
+ if (pattern == 0)
+ FOR_EACH_LINE(*ptr &= ~mask; ptr[1] &= ~right_mask;);
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE(*ptr |= mask; ptr[1] |= right_mask;);
+ else
+ FOR_EACH_LINE(
+ *ptr = (*ptr & ~mask) | (pattern & mask);
+ ptr[1] = (ptr[1] & ~right_mask) | (pattern & right_mask); );
+ break;
+ case 1: /* 3 chunks */
+ if (pattern == 0)
+ FOR_EACH_LINE( *ptr &= ~mask;
+ ptr[1] &= src_mask;
+ ptr[2] &= ~right_mask; );
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE( *ptr |= mask;
+ ptr[1] |= ~src_mask;
+ ptr[2] |= right_mask; );
+ else
+ FOR_EACH_LINE( *ptr = (*ptr & ~mask) | (pattern & mask);
+ ptr[1] =(ptr[1] & src_mask) | pattern;
+ ptr[2] = (ptr[2] & ~right_mask) | (pattern & right_mask); );
+ break;
+ default:{ /* >3 chunks */
int i;
- if (pattern == 0)
- FOR_EACH_LINE( *ptr++ &= ~mask;
- for (i = 0; i < last; i++)
- *ptr++ &= src_mask;
- *ptr &= ~right_mask; );
- else if (pattern == (mono_fill_chunk)(-1))
- FOR_EACH_LINE( *ptr++ |= mask;
- for (i = 0; i < last; i++)
- *ptr++ |= ~src_mask;
- *ptr |= right_mask; );
- else
- FOR_EACH_LINE(
- /* note: we know (pattern & ~src_mask) == pattern */
- *ptr = (*ptr & ~mask) | (pattern & mask);
- ++ptr;
- for (i = 0; i < last; i++, ptr++)
+ if (pattern == 0)
+ FOR_EACH_LINE( *ptr++ &= ~mask;
+ for (i = 0; i < last; i++)
+ *ptr++ &= src_mask;
+ *ptr &= ~right_mask; );
+ else if (pattern == (mono_fill_chunk)(-1))
+ FOR_EACH_LINE( *ptr++ |= mask;
+ for (i = 0; i < last; i++)
+ *ptr++ |= ~src_mask;
+ *ptr |= right_mask; );
+ else
+ FOR_EACH_LINE(
+ /* note: we know (pattern & ~src_mask) == pattern */
+ *ptr = (*ptr & ~mask) | (pattern & mask);
+ ++ptr;
+ for (i = 0; i < last; i++, ptr++)
*ptr = (*ptr & src_mask) | pattern;
- *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
- }
- }
+ *ptr = (*ptr & ~right_mask) | (pattern & right_mask); );
+ }
+ }
}
#undef FOR_EACH_LINE
}
@@ -234,7 +234,7 @@ bits_fill_rectangle_masked(byte * dest, int dest_bit, uint draster,
/* Replicate a bitmap horizontally in place. */
void
bits_replicate_horizontally(byte * data, uint width, uint height,
- uint raster, uint replicated_width, uint replicated_raster)
+ uint raster, uint replicated_width, uint replicated_raster)
{
/* The current algorithm is extremely inefficient! */
const byte *orig_row = data + (height - 1) * raster;
@@ -242,70 +242,70 @@ bits_replicate_horizontally(byte * data, uint width, uint height,
uint y;
if (!(width & 7)) {
- uint src_bytes = width >> 3;
- uint dest_bytes = replicated_width >> 3;
-
- for (y = height; y-- > 0;
- orig_row -= raster, tile_row -= replicated_raster
- ) {
- uint move = src_bytes;
- const byte *from = orig_row;
- byte *to = tile_row + dest_bytes - src_bytes;
-
- memmove(to, from, move);
- while (to - tile_row >= move) {
- from = to;
- to -= move;
- memmove(to, from, move);
- move <<= 1;
- }
- if (to != tile_row)
- memmove(tile_row, to, to - tile_row);
- }
+ uint src_bytes = width >> 3;
+ uint dest_bytes = replicated_width >> 3;
+
+ for (y = height; y-- > 0;
+ orig_row -= raster, tile_row -= replicated_raster
+ ) {
+ uint move = src_bytes;
+ const byte *from = orig_row;
+ byte *to = tile_row + dest_bytes - src_bytes;
+
+ memmove(to, from, move);
+ while (to - tile_row >= move) {
+ from = to;
+ to -= move;
+ memmove(to, from, move);
+ move <<= 1;
+ }
+ if (to != tile_row)
+ memmove(tile_row, to, to - tile_row);
+ }
} else {
- /*
- * This algorithm is inefficient, but probably not worth improving.
- */
- uint bit_count = width & (uint)(-(int)width); /* lowest bit: 1, 2, or 4 */
- uint left_mask = (0xff00 >> bit_count) & 0xff;
-
- for (y = height; y-- > 0;
- orig_row -= raster, tile_row -= replicated_raster
- ) {
- uint sx;
-
- for (sx = width; sx > 0;) {
- uint bits, dx;
-
- sx -= bit_count;
- bits = (orig_row[sx >> 3] << (sx & 7)) & left_mask;
- for (dx = sx + replicated_width; dx >= width;) {
- byte *dp;
- int dbit;
-
- dx -= width;
- dbit = dx & 7;
- dp = tile_row + (dx >> 3);
- *dp = (*dp & ~(left_mask >> dbit)) | (bits >> dbit);
- }
- }
- }
+ /*
+ * This algorithm is inefficient, but probably not worth improving.
+ */
+ uint bit_count = width & (uint)(-(int)width); /* lowest bit: 1, 2, or 4 */
+ uint left_mask = (0xff00 >> bit_count) & 0xff;
+
+ for (y = height; y-- > 0;
+ orig_row -= raster, tile_row -= replicated_raster
+ ) {
+ uint sx;
+
+ for (sx = width; sx > 0;) {
+ uint bits, dx;
+
+ sx -= bit_count;
+ bits = (orig_row[sx >> 3] << (sx & 7)) & left_mask;
+ for (dx = sx + replicated_width; dx >= width;) {
+ byte *dp;
+ int dbit;
+
+ dx -= width;
+ dbit = dx & 7;
+ dp = tile_row + (dx >> 3);
+ *dp = (*dp & ~(left_mask >> dbit)) | (bits >> dbit);
+ }
+ }
+ }
}
}
/* Replicate a bitmap vertically in place. */
void
bits_replicate_vertically(byte * data, uint height, uint raster,
- uint replicated_height)
+ uint replicated_height)
{
byte *dest = data;
uint h = replicated_height;
uint size = raster * height;
while (h > height) {
- memcpy(dest + size, dest, size);
- dest += size;
- h -= height;
+ memcpy(dest + size, dest, size);
+ dest += size;
+ h -= height;
}
}
@@ -313,14 +313,14 @@ bits_replicate_vertically(byte * data, uint height, uint raster,
/* Assume bits beyond the width are zero. */
void
bits_bounding_box(const byte * data, uint height, uint raster,
- gs_int_rect * pbox)
+ gs_int_rect * pbox)
{
register const ulong *lp;
static const byte first_1[16] = {
- 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
+ 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
};
static const byte last_1[16] = {
- 0, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4
+ 0, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4
};
/* Count trailing blank rows. */
@@ -329,10 +329,10 @@ bits_bounding_box(const byte * data, uint height, uint raster,
lp = (const ulong *)(data + raster * height);
while ((const byte *)lp > data && !lp[-1])
- --lp;
+ --lp;
if ((const byte *)lp == data) {
- pbox->p.x = pbox->q.x = pbox->p.y = pbox->q.y = 0;
- return;
+ pbox->p.x = pbox->q.x = pbox->p.y = pbox->q.y = 0;
+ return;
}
pbox->q.y = height = ((const byte *)lp - data + raster - 1) / raster;
@@ -340,49 +340,49 @@ bits_bounding_box(const byte * data, uint height, uint raster,
lp = (const ulong *)data;
while (!*lp)
- ++lp;
+ ++lp;
{
- uint n = ((const byte *)lp - data) / raster;
+ uint n = ((const byte *)lp - data) / raster;
- pbox->p.y = n;
- if (n)
- height -= n, data += n * raster;
+ pbox->p.y = n;
+ if (n)
+ height -= n, data += n * raster;
}
/* Find the left and right edges. */
/* We know that the first and last rows are non-blank. */
{
- uint raster_longs = raster >> arch_log2_sizeof_long;
- uint left = raster_longs - 1, right = 0;
- ulong llong = 0, rlong = 0;
- const byte *q;
- uint h, n;
-
- for (q = data, h = height; h-- > 0; q += raster) { /* Work from the left edge by longs. */
- for (lp = (const ulong *)q, n = 0;
- n < left && !*lp; lp++, n++
- );
- if (n < left)
- left = n, llong = *lp;
- else
- llong |= *lp;
- /* Work from the right edge by longs. */
- for (lp = (const ulong *)(q + raster - sizeof(long)),
- n = raster_longs - 1;
-
- n > right && !*lp; lp--, n--
- );
- if (n > right)
- right = n, rlong = *lp;
- else
- rlong |= *lp;
- }
-
- /* Do binary subdivision on edge longs. We assume that */
- /* sizeof(long) = 4 or 8. */
+ uint raster_longs = raster >> arch_log2_sizeof_long;
+ uint left = raster_longs - 1, right = 0;
+ ulong llong = 0, rlong = 0;
+ const byte *q;
+ uint h, n;
+
+ for (q = data, h = height; h-- > 0; q += raster) { /* Work from the left edge by longs. */
+ for (lp = (const ulong *)q, n = 0;
+ n < left && !*lp; lp++, n++
+ );
+ if (n < left)
+ left = n, llong = *lp;
+ else
+ llong |= *lp;
+ /* Work from the right edge by longs. */
+ for (lp = (const ulong *)(q + raster - sizeof(long)),
+ n = raster_longs - 1;
+
+ n > right && !*lp; lp--, n--
+ );
+ if (n > right)
+ right = n, rlong = *lp;
+ else
+ rlong |= *lp;
+ }
+
+ /* Do binary subdivision on edge longs. We assume that */
+ /* sizeof(long) = 4 or 8. */
#if arch_sizeof_long > 8
- Error_longs_are_too_large();
+ Error_longs_are_too_large();
#endif
#if arch_is_big_endian
@@ -395,50 +395,50 @@ bits_bounding_box(const byte * data, uint height, uint raster,
# define right_justify_last(x,n) (x) >>= ((arch_sizeof_long * 8) - (n))
#endif
- left <<= arch_log2_sizeof_long + 3;
+ left <<= arch_log2_sizeof_long + 3;
#if arch_sizeof_long == 8
- if (llong & ~last_bits(32))
- shift_out_last(llong, 32);
- else
- left += 32;
+ if (llong & ~last_bits(32))
+ shift_out_last(llong, 32);
+ else
+ left += 32;
#endif
- if (llong & ~last_bits(16))
- shift_out_last(llong, 16);
- else
- left += 16;
- if (llong & ~last_bits(8))
- shift_out_last(llong, 8);
- else
- left += 8;
- right_justify_last(llong, 8);
- if (llong & 0xf0)
- left += first_1[(byte) llong >> 4];
- else
- left += first_1[(byte) llong] + 4;
-
- right <<= arch_log2_sizeof_long + 3;
+ if (llong & ~last_bits(16))
+ shift_out_last(llong, 16);
+ else
+ left += 16;
+ if (llong & ~last_bits(8))
+ shift_out_last(llong, 8);
+ else
+ left += 8;
+ right_justify_last(llong, 8);
+ if (llong & 0xf0)
+ left += first_1[(byte) llong >> 4];
+ else
+ left += first_1[(byte) llong] + 4;
+
+ right <<= arch_log2_sizeof_long + 3;
#if arch_sizeof_long == 8
- if (!(rlong & last_bits(32)))
- shift_out_last(rlong, 32);
- else
- right += 32;
+ if (!(rlong & last_bits(32)))
+ shift_out_last(rlong, 32);
+ else
+ right += 32;
#endif
- if (!(rlong & last_bits(16)))
- shift_out_last(rlong, 16);
- else
- right += 16;
- if (!(rlong & last_bits(8)))
- shift_out_last(rlong, 8);
- else
- right += 8;
- right_justify_last(rlong, 8);
- if (!(rlong & 0xf))
- right += last_1[(byte) rlong >> 4];
- else
- right += last_1[(uint) rlong & 0xf] + 4;
-
- pbox->p.x = left;
- pbox->q.x = right;
+ if (!(rlong & last_bits(16)))
+ shift_out_last(rlong, 16);
+ else
+ right += 16;
+ if (!(rlong & last_bits(8)))
+ shift_out_last(rlong, 8);
+ else
+ right += 8;
+ right_justify_last(rlong, 8);
+ if (!(rlong & 0xf))
+ right += last_1[(byte) rlong >> 4];
+ else
+ right += last_1[(uint) rlong & 0xf] + 4;
+
+ pbox->p.x = left;
+ pbox->q.x = right;
}
}
@@ -455,9 +455,9 @@ bits_extract_plane(const bits_plane_t *dest /*write*/,
int dest_bit = dest->x * dest_depth;
byte *dest_row = dest->data.write + (dest_bit >> 3);
enum {
- EXTRACT_SLOW = 0,
- EXTRACT_4_TO_1,
- EXTRACT_32_TO_8
+ EXTRACT_SLOW = 0,
+ EXTRACT_4_TO_1,
+ EXTRACT_32_TO_8
} loop_case = EXTRACT_SLOW;
int y;
@@ -465,86 +465,86 @@ bits_extract_plane(const bits_plane_t *dest /*write*/,
dest_bit &= 7;
/* Check for the fast CMYK cases. */
if (!(source_bit | dest_bit)) {
- switch (source_depth) {
- case 4:
- loop_case =
- (dest_depth == 1 && !(source->raster & 3) &&
- !(source->x & 1) ? EXTRACT_4_TO_1 :
- EXTRACT_SLOW);
- break;
- case 32:
- if (dest_depth == 8 && !(shift & 7)) {
- loop_case = EXTRACT_32_TO_8;
- source_row += 3 - (shift >> 3);
- }
- break;
- }
+ switch (source_depth) {
+ case 4:
+ loop_case =
+ (dest_depth == 1 && !(source->raster & 3) &&
+ !(source->x & 1) ? EXTRACT_4_TO_1 :
+ EXTRACT_SLOW);
+ break;
+ case 32:
+ if (dest_depth == 8 && !(shift & 7)) {
+ loop_case = EXTRACT_32_TO_8;
+ source_row += 3 - (shift >> 3);
+ }
+ break;
+ }
}
for (y = 0; y < height;
- ++y, source_row += source->raster, dest_row += dest->raster
- ) {
- int x;
-
- switch (loop_case) {
- case EXTRACT_4_TO_1: {
- const byte *src = source_row;
- byte *dst = dest_row;
-
- /* Do groups of 8 pixels. */
- for (x = width; x >= 8; src += 4, x -= 8) {
- bits32 sword =
- (*(const bits32 *)src >> shift) & 0x11111111;
-
- *dst++ =
- byte_acegbdfh_to_abcdefgh[(
+ ++y, source_row += source->raster, dest_row += dest->raster
+ ) {
+ int x;
+
+ switch (loop_case) {
+ case EXTRACT_4_TO_1: {
+ const byte *src = source_row;
+ byte *dst = dest_row;
+
+ /* Do groups of 8 pixels. */
+ for (x = width; x >= 8; src += 4, x -= 8) {
+ bits32 sword =
+ (*(const bits32 *)src >> shift) & 0x11111111;
+
+ *dst++ =
+ byte_acegbdfh_to_abcdefgh[(
#if arch_is_big_endian
- (sword >> 21) | (sword >> 14) | (sword >> 7) | sword
+ (sword >> 21) | (sword >> 14) | (sword >> 7) | sword
#else
- (sword << 3) | (sword >> 6) | (sword >> 15) | (sword >> 24)
+ (sword << 3) | (sword >> 6) | (sword >> 15) | (sword >> 24)
#endif
- ) & 0xff];
- }
- if (x) {
- /* Do the final 1-7 pixels. */
- uint test = 0x10 << shift, store = 0x80;
-
- do {
- *dst = (*src & test ? *dst | store : *dst & ~store);
- if (test >= 0x10)
- test >>= 4;
- else
- test <<= 4, ++src;
- store >>= 1;
- } while (--x > 0);
- }
- break;
- }
- case EXTRACT_32_TO_8: {
- const byte *src = source_row;
- byte *dst = dest_row;
-
- for (x = width; x > 0; src += 4, --x)
- *dst++ = *src;
- break;
- }
- default: {
- sample_load_declare_setup(sptr, sbit, source_row, source_bit,
- source_depth);
- sample_store_declare_setup(dptr, dbit, dbbyte, dest_row, dest_bit,
- dest_depth);
-
- sample_store_preload(dbbyte, dptr, dbit, dest_depth);
- for (x = width; x > 0; --x) {
- gx_color_index color;
- uint pixel;
-
- sample_load_next_any(color, sptr, sbit, source_depth);
- pixel = (color >> shift) & plane_mask;
- sample_store_next8(pixel, dptr, dbit, dest_depth, dbbyte);
- }
- sample_store_flush(dptr, dbit, dest_depth, dbbyte);
- }
- }
+ ) & 0xff];
+ }
+ if (x) {
+ /* Do the final 1-7 pixels. */
+ uint test = 0x10 << shift, store = 0x80;
+
+ do {
+ *dst = (*src & test ? *dst | store : *dst & ~store);
+ if (test >= 0x10)
+ test >>= 4;
+ else
+ test <<= 4, ++src;
+ store >>= 1;
+ } while (--x > 0);
+ }
+ break;
+ }
+ case EXTRACT_32_TO_8: {
+ const byte *src = source_row;
+ byte *dst = dest_row;
+
+ for (x = width; x > 0; src += 4, --x)
+ *dst++ = *src;
+ break;
+ }
+ default: {
+ sample_load_declare_setup(sptr, sbit, source_row, source_bit,
+ source_depth);
+ sample_store_declare_setup(dptr, dbit, dbbyte, dest_row, dest_bit,
+ dest_depth);
+
+ sample_store_preload(dbbyte, dptr, dbit, dest_depth);
+ for (x = width; x > 0; --x) {
+ gx_color_index color;
+ uint pixel;
+
+ sample_load_next_any(color, sptr, sbit, source_depth);
+ pixel = (color >> shift) & plane_mask;
+ sample_store_next8(pixel, dptr, dbit, dest_depth, dbbyte);
+ }
+ sample_store_flush(dptr, dbit, dest_depth, dbbyte);
+ }
+ }
}
return 0;
}
@@ -564,25 +564,25 @@ bits_expand_plane(const bits_plane_t *dest /*write*/,
int dest_bit = dest->x * dest_depth;
byte *dest_row = dest->data.write + (dest_bit >> 3);
enum {
- EXPAND_SLOW = 0,
- EXPAND_1_TO_4,
- EXPAND_8_TO_32
+ EXPAND_SLOW = 0,
+ EXPAND_1_TO_4,
+ EXPAND_8_TO_32
} loop_case = EXPAND_SLOW;
int y;
source_bit &= 7;
/* Check for the fast CMYK cases. */
if (!(source_bit || (dest_bit & 31) || (dest->raster & 3))) {
- switch (dest_depth) {
- case 4:
- if (source_depth == 1)
- loop_case = EXPAND_1_TO_4;
- break;
- case 32:
- if (source_depth == 8 && !(shift & 7))
- loop_case = EXPAND_8_TO_32;
- break;
- }
+ switch (dest_depth) {
+ case 4:
+ if (source_depth == 1)
+ loop_case = EXPAND_1_TO_4;
+ break;
+ case 32:
+ if (source_depth == 8 && !(shift & 7))
+ loop_case = EXPAND_8_TO_32;
+ break;
+ }
}
dest_bit &= 7;
switch (loop_case) {
@@ -591,45 +591,45 @@ bits_expand_plane(const bits_plane_t *dest /*write*/,
#if arch_is_big_endian
# define word_shift (shift)
#else
- int word_shift = 24 - shift;
+ int word_shift = 24 - shift;
#endif
- for (y = 0; y < height;
- ++y, source_row += source->raster, dest_row += dest->raster
- ) {
- int x;
- const byte *src = source_row;
- bits32 *dst = (bits32 *)dest_row;
-
- for (x = width; x > 0; --x)
- *dst++ = (bits32)(*src++) << word_shift;
- }
+ for (y = 0; y < height;
+ ++y, source_row += source->raster, dest_row += dest->raster
+ ) {
+ int x;
+ const byte *src = source_row;
+ bits32 *dst = (bits32 *)dest_row;
+
+ for (x = width; x > 0; --x)
+ *dst++ = (bits32)(*src++) << word_shift;
+ }
#undef word_shift
}
- break;
+ break;
case EXPAND_1_TO_4:
default:
- for (y = 0; y < height;
- ++y, source_row += source->raster, dest_row += dest->raster
- ) {
- int x;
- sample_load_declare_setup(sptr, sbit, source_row, source_bit,
- source_depth);
- sample_store_declare_setup(dptr, dbit, dbbyte, dest_row, dest_bit,
- dest_depth);
-
- sample_store_preload(dbbyte, dptr, dbit, dest_depth);
- for (x = width; x > 0; --x) {
- uint color;
- gx_color_index pixel;
-
- sample_load_next8(color, sptr, sbit, source_depth);
- pixel = color << shift;
- sample_store_next_any(pixel, dptr, dbit, dest_depth, dbbyte);
- }
- sample_store_flush(dptr, dbit, dest_depth, dbbyte);
- }
- break;
+ for (y = 0; y < height;
+ ++y, source_row += source->raster, dest_row += dest->raster
+ ) {
+ int x;
+ sample_load_declare_setup(sptr, sbit, source_row, source_bit,
+ source_depth);
+ sample_store_declare_setup(dptr, dbit, dbbyte, dest_row, dest_bit,
+ dest_depth);
+
+ sample_store_preload(dbbyte, dptr, dbit, dest_depth);
+ for (x = width; x > 0; --x) {
+ uint color;
+ gx_color_index pixel;
+
+ sample_load_next8(color, sptr, sbit, source_depth);
+ pixel = color << shift;
+ sample_store_next_any(pixel, dptr, dbit, dest_depth, dbbyte);
+ }
+ sample_store_flush(dptr, dbit, dest_depth, dbbyte);
+ }
+ break;
}
return 0;
@@ -640,30 +640,30 @@ bits_expand_plane(const bits_plane_t *dest /*write*/,
/* Fill a rectangle of bytes. */
void
bytes_fill_rectangle(byte * dest, uint raster,
- byte value, int width_bytes, int height)
+ byte value, int width_bytes, int height)
{
while (height-- > 0) {
- memset(dest, value, width_bytes);
- dest += raster;
+ memset(dest, value, width_bytes);
+ dest += raster;
}
}
/* Copy a rectangle of bytes. */
void
bytes_copy_rectangle(byte * dest, uint dest_raster,
- const byte * src, uint src_raster, int width_bytes, int height)
+ const byte * src, uint src_raster, int width_bytes, int height)
{
while (height-- > 0) {
- memcpy(dest, src, width_bytes);
- src += src_raster;
- dest += dest_raster;
+ memcpy(dest, src, width_bytes);
+ src += src_raster;
+ dest += dest_raster;
}
}
/* Copy a rectangle of bytes zeroing any padding bytes. */
void
bytes_copy_rectangle_zero_padding(byte * dest, uint dest_raster,
- const byte * src, uint src_raster, int width_bytes, int height)
+ const byte * src, uint src_raster, int width_bytes, int height)
{
int padlen = dest_raster;
if (padlen < 0)
diff --git a/gs/base/gsbittab.c b/gs/base/gsbittab.c
index f65af7739..2c2aa483b 100644
--- a/gs/base/gsbittab.c
+++ b/gs/base/gsbittab.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsbittab.h b/gs/base/gsbittab.h
index 5e56bdc8d..b76218adf 100644
--- a/gs/base/gsbittab.h
+++ b/gs/base/gsbittab.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsccode.h b/gs/base/gsccode.h
index b4abec356..45df816c7 100644
--- a/gs/base/gsccode.h
+++ b/gs/base/gsccode.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,11 +32,11 @@ typedef ulong gs_char;
* Define a character glyph code, a.k.a. character name. The space of
* glyph codes is divided into five sections:
*
- * - Codes >= GS_MIN_GLYPH_INDEX represent (non-negative)
+ * - Codes >= GS_MIN_GLYPH_INDEX represent (non-negative)
* integers biased by GS_MIN_CID_GLYPH. They represent glyph indices
* of a specific font.
*
- * - Codes within [GS_MIN_CID_GLYPH, GS_MIN_GLYPH_INDEX) represent (non-negative)
+ * - Codes within [GS_MIN_CID_GLYPH, GS_MIN_GLYPH_INDEX) represent (non-negative)
* integers biased by GS_MIN_CID_GLYPH. They represent PostScript CIDs
* of a specific Ordering.
*
@@ -92,7 +92,7 @@ typedef bool (*gs_glyph_mark_proc_t)(const gs_memory_t *mem, gs_glyph glyph, voi
/* Define the indices for known encodings. */
typedef enum {
ENCODING_INDEX_UNKNOWN = -1,
- /* Real encodings. These must come first. */
+ /* Real encodings. These must come first. */
ENCODING_INDEX_STANDARD = 0,
ENCODING_INDEX_ISOLATIN1,
ENCODING_INDEX_SYMBOL,
@@ -101,7 +101,7 @@ typedef enum {
ENCODING_INDEX_MACROMAN,
ENCODING_INDEX_MACEXPERT,
#define NUM_KNOWN_REAL_ENCODINGS 7
- /* Pseudo-encodings (glyph sets). */
+ /* Pseudo-encodings (glyph sets). */
ENCODING_INDEX_MACGLYPH, /* Mac glyphs */
ENCODING_INDEX_ALOGLYPH, /* Adobe Latin glyph set */
ENCODING_INDEX_ALXGLYPH, /* Adobe Latin Extended glyph set */
@@ -131,8 +131,8 @@ typedef enum gs_glyph_space_s {
* currently used only for CMaps: it is *not* the same as the glyph_name
* procedure in fonts.
*/
-typedef int (*gs_glyph_name_proc_t)(const gs_memory_t *mem,
- gs_glyph glyph, gs_const_string *pstr,
- void *proc_data);
+typedef int (*gs_glyph_name_proc_t)(const gs_memory_t *mem,
+ gs_glyph glyph, gs_const_string *pstr,
+ void *proc_data);
#endif /* gsccode_INCLUDED */
diff --git a/gs/base/gsccolor.h b/gs/base/gsccolor.h
index b03024729..da89704cb 100644
--- a/gs/base/gsccolor.h
+++ b/gs/base/gsccolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@ typedef struct gs_pattern_instance_s gs_pattern_instance_t;
/* Paint (non-Pattern) colors */
typedef struct gs_paint_color_s {
float values[GS_CLIENT_COLOR_MAX_COMPONENTS];
- /* CAUTION: The shading decomposition algorithm may allocate
+ /* CAUTION: The shading decomposition algorithm may allocate
a smaller space when a small number of color components is in use.
*/
} gs_paint_color;
@@ -52,8 +52,8 @@ typedef struct gs_client_color_s gs_client_color;
struct gs_client_color_s {
gs_pattern_instance_t *pattern;
gs_paint_color paint; /* also color for uncolored pattern */
- /* CAUTION: gs_paint_color structure must be the last field in
- gs_client_color_s to allow allocating a smaller space when
+ /* CAUTION: gs_paint_color structure must be the last field in
+ gs_client_color_s to allow allocating a smaller space when
a small number of color components is in use.
*/
};
@@ -79,5 +79,4 @@ typedef enum {
OTHER
} gs_transparency_color_t;
-
#endif /* gsccolor_INCLUDED */
diff --git a/gs/base/gscdef.c b/gs/base/gscdef.c
index f4be05999..883190424 100644
--- a/gs/base/gscdef.c
+++ b/gs/base/gscdef.c
@@ -25,25 +25,25 @@
#ifndef GS_BUILDTIME
# define GS_BUILDTIME\
- 0 /* should be set in the makefile */
+ 0 /* should be set in the makefile */
#endif
const long gs_buildtime = GS_BUILDTIME;
#ifndef GS_COPYRIGHT
# define GS_COPYRIGHT\
- "Copyright (C) 2010 Artifex Software, Inc. All rights reserved."
+ "Copyright (C) 2010 Artifex Software, Inc. All rights reserved."
#endif
const char *const gs_copyright = GS_COPYRIGHT;
#ifndef GS_PRODUCTFAMILY
# define GS_PRODUCTFAMILY\
- "GPL Ghostscript"
+ "GPL Ghostscript"
#endif
const char *const gs_productfamily = GS_PRODUCTFAMILY;
#ifndef GS_PRODUCT
# define GS_PRODUCT\
- GS_PRODUCTFAMILY " SVN PRERELEASE"
+ GS_PRODUCTFAMILY " SVN PRERELEASE"
#endif
const char *const gs_product = GS_PRODUCT;
@@ -67,7 +67,7 @@ const long gs_revisiondate = GS_REVISIONDATE;
#ifndef GS_SERIALNUMBER
# define GS_SERIALNUMBER\
- 42 /* a famous number */
+ 42 /* a famous number */
#endif
const long gs_serialnumber = GS_SERIALNUMBER;
diff --git a/gs/base/gscdefs.h b/gs/base/gscdefs.h
index df51799e8..2cdce8a0e 100644
--- a/gs/base/gscdefs.h
+++ b/gs/base/gscdefs.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -68,7 +68,7 @@ extern const unsigned gx_io_device_table_count;
/* descriptors (no longer used), and (as the value) the length of the lists. */
#define extern_gs_lib_device_list()\
int gs_lib_device_list(const gx_device * const **plist,\
- gs_memory_struct_type_t **pst)
+ gs_memory_struct_type_t **pst)
/* find a compositor by name */
#define extern_gs_find_compositor() \
diff --git a/gs/base/gscdevn.c b/gs/base/gscdevn.c
index 4c3ac134b..7c376b1d5 100644
--- a/gs/base/gscdevn.c
+++ b/gs/base/gscdevn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -73,7 +73,7 @@ const gs_color_space_type gs_color_space_type_DeviceN = {
/* GC procedures */
-static
+static
ENUM_PTRS_BEGIN(cs_DeviceN_enum_ptrs) return 0;
ENUM_PTR(0, gs_color_space, params.device_n.names);
ENUM_PTR(1, gs_color_space, params.device_n.map);
@@ -106,11 +106,11 @@ gs_cspace_new_DeviceN(
int code;
if (palt_cspace == 0 || !palt_cspace->type->can_be_alt_space)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pcs = gs_cspace_alloc(pmem, &gs_color_space_type_DeviceN);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcsdevn = &pcs->params.device_n;
pcsdevn->names = NULL;
pcsdevn->map = NULL;
@@ -119,17 +119,17 @@ gs_cspace_new_DeviceN(
/* Allocate space for color names list. */
code = alloc_device_n_map(&pcsdevn->map, pmem, "gs_cspace_build_DeviceN");
if (code < 0) {
- gs_free_object(pmem, pcs, "gs_cspace_new_DeviceN");
- return code;
+ gs_free_object(pmem, pcs, "gs_cspace_new_DeviceN");
+ return code;
}
/* Allocate space for color names list. */
pnames = (gs_separation_name *)
- gs_alloc_byte_array(pmem, num_components, sizeof(gs_separation_name),
- ".gs_cspace_build_DeviceN(names)");
+ gs_alloc_byte_array(pmem, num_components, sizeof(gs_separation_name),
+ ".gs_cspace_build_DeviceN(names)");
if (pnames == 0) {
- gs_free_object(pmem, pcsdevn->map, ".gs_cspace_build_DeviceN(map)");
- gs_free_object(pmem, pcs, "gs_cspace_new_DeviceN");
- return_error(gs_error_VMerror);
+ gs_free_object(pmem, pcsdevn->map, ".gs_cspace_build_DeviceN(map)");
+ gs_free_object(pmem, pcs, "gs_cspace_new_DeviceN");
+ return_error(gs_error_VMerror);
}
pcs->base_space = palt_cspace;
rc_increment_cs(palt_cspace);
@@ -142,12 +142,12 @@ gs_cspace_new_DeviceN(
/* Allocate and initialize a DeviceN map. */
int
alloc_device_n_map(gs_device_n_map ** ppmap, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
gs_device_n_map *pimap;
rc_alloc_struct_1(pimap, gs_device_n_map, &st_device_n_map, mem,
- return_error(gs_error_VMerror), cname);
+ return_error(gs_error_VMerror), cname);
pimap->tint_transform = 0;
pimap->tint_transform_data = 0;
pimap->cache_valid = false;
@@ -173,15 +173,15 @@ gs_attachattributecolorspace(gs_separation_name sep_name, gs_state * pgs)
/* Verify that we have a DeviceN color space */
if (!pgs->saved)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pdevncs = gs_currentcolorspace_inline(pgs->saved);
if (pdevncs->type != &gs_color_space_type_DeviceN)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Allocate an attribute list element for our linked list of attributes */
rc_alloc_struct_1(patt, gs_device_n_attributes, &st_device_n_attributes,
- pgs->memory, return_error(gs_error_VMerror),
- "gs_attachattributrescolorspace");
+ pgs->memory, return_error(gs_error_VMerror),
+ "gs_attachattributrescolorspace");
/* Point our attribute list entry to the attribute color space */
patt->colorant_name = sep_name;
@@ -201,18 +201,18 @@ gs_attachattributecolorspace(gs_separation_name sep_name, gs_state * pgs)
*/
int
gs_cspace_set_devn_proc(gs_color_space * pcspace,
- int (*proc)(const float *,
+ int (*proc)(const float *,
float *,
const gs_imager_state *,
void *
- ),
- void *proc_data
- )
+ ),
+ void *proc_data
+ )
{
gs_device_n_map *pimap;
if (gs_color_space_get_index(pcspace) != gs_color_space_index_DeviceN)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pimap = pcspace->params.device_n.map;
pimap->tint_transform = proc;
pimap->tint_transform_data = proc_data;
@@ -233,7 +233,7 @@ using_alt_color_space(const gs_state * pgs)
/* Map a DeviceN color using a Function. */
int
map_devn_using_function(const float *in, float *out,
- const gs_imager_state *pis, void *data)
+ const gs_imager_state *pis, void *data)
{
gs_function_t *const pfn = data;
@@ -250,10 +250,10 @@ gs_cspace_set_devn_function(gs_color_space *pcspace, gs_function_t *pfn)
gs_device_n_map *pimap;
if (gs_color_space_get_index(pcspace) != gs_color_space_index_DeviceN ||
- pfn->params.m != pcspace->params.device_n.num_components ||
- pfn->params.n != gs_color_space_num_components(pcspace->base_space)
- )
- return_error(gs_error_rangecheck);
+ pfn->params.m != pcspace->params.device_n.num_components ||
+ pfn->params.n != gs_color_space_num_components(pcspace->base_space)
+ )
+ return_error(gs_error_rangecheck);
pimap = pcspace->params.device_n.map;
pimap->tint_transform = map_devn_using_function;
pimap->tint_transform_data = pfn;
@@ -269,9 +269,9 @@ gs_function_t *
gs_cspace_get_devn_function(const gs_color_space *pcspace)
{
if (gs_color_space_get_index(pcspace) == gs_color_space_index_DeviceN &&
- pcspace->params.device_n.map->tint_transform ==
- map_devn_using_function)
- return pcspace->params.device_n.map->tint_transform_data;
+ pcspace->params.device_n.map->tint_transform ==
+ map_devn_using_function)
+ return pcspace->params.device_n.map->tint_transform_data;
return 0;
}
@@ -291,7 +291,7 @@ gx_init_DeviceN(gs_client_color * pcc, const gs_color_space * pcs)
uint i;
for (i = 0; i < pcs->params.device_n.num_components; ++i)
- pcc->paint.values[i] = 1.0;
+ pcc->paint.values[i] = 1.0;
}
/* Force a DeviceN color into legal range. */
@@ -301,23 +301,23 @@ gx_restrict_DeviceN(gs_client_color * pcc, const gs_color_space * pcs)
uint i;
for (i = 0; i < pcs->params.device_n.num_components; ++i) {
- floatp value = pcc->paint.values[i];
- pcc->paint.values[i] = (value <= 0 ? 0 : value >= 1 ? 1 : value);
+ floatp value = pcc->paint.values[i];
+ pcc->paint.values[i] = (value <= 0 ? 0 : value >= 1 ? 1 : value);
}
}
/* Remap a DeviceN color. */
static const gs_color_space *
gx_concrete_space_DeviceN(const gs_color_space * pcs,
- const gs_imager_state * pis)
+ const gs_imager_state * pis)
{
bool is_lab = false;
#ifdef DEBUG
- /*
+ /*
* Verify that the color space and imager state info match.
*/
if (pcs->id != pis->color_component_map.cspace_id)
- dprintf("gx_concrete_space_DeviceN: color space id mismatch");
+ dprintf("gx_concrete_space_DeviceN: color space id mismatch");
#endif
/*
* Check if we are using the alternate color space.
@@ -326,11 +326,11 @@ gx_concrete_space_DeviceN(const gs_color_space * pcs,
/* Need to handle PS CIE space */
if (gs_color_space_is_PSCIE(pcs->base_space)) {
if (pcs->base_space->icc_equivalent == NULL) {
- gs_colorspace_set_icc_equivalent(pcs->base_space,
+ gs_colorspace_set_icc_equivalent(pcs->base_space,
&is_lab, pis->memory);
}
return (pcs->base_space->icc_equivalent);
- }
+ }
return cs_concrete_space(pcs->base_space, pis);
}
/*
@@ -341,8 +341,8 @@ gx_concrete_space_DeviceN(const gs_color_space * pcs,
static int
gx_remap_DeviceN(const gs_client_color * pcc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
frac conc[GS_CLIENT_COLOR_MAX_COMPONENTS];
const gs_color_space *pconcs;
@@ -352,7 +352,7 @@ gx_remap_DeviceN(const gs_client_color * pcc, const gs_color_space * pcs,
gs_client_color temp;
if ( pcs->cmm_icc_profile_data != NULL && pis->color_component_map.use_alt_cspace) {
- /* If needed, reorganize the data. The ICC colorants tag drives the
+ /* If needed, reorganize the data. The ICC colorants tag drives the
the laydown order */
if (pcs->cmm_icc_profile_data->devicen_permute_needed) {
for ( k = 0; k < i; k++) {
@@ -366,13 +366,13 @@ gx_remap_DeviceN(const gs_client_color * pcc, const gs_color_space * pcs,
} else {
code = (*pcs->type->concretize_color)(pcc, pcs, conc, pis, dev);
if (code < 0)
- return code;
+ return code;
pconcs = cs_concrete_space(pcs, pis);
code = (*pconcs->type->remap_concrete_color)(conc, pconcs, pdc, pis, dev, select);
/* Save original color space and color info into dev color */
i = any_abs(i);
for (i--; i >= 0; i--)
- pdc->ccolor.paint.values[i] = pcc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pcc->paint.values[i];
pdc->ccolor_valid = true;
return code;
}
@@ -380,7 +380,7 @@ gx_remap_DeviceN(const gs_client_color * pcc, const gs_color_space * pcs,
static int
gx_concretize_DeviceN(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
int code, tcode = 0;
gs_client_color cc;
@@ -389,11 +389,11 @@ gx_concretize_DeviceN(const gs_client_color * pc, const gs_color_space * pcs,
bool is_lab;
#ifdef DEBUG
- /*
+ /*
* Verify that the color space and imager state info match.
*/
if (pcs->id != pis->color_component_map.cspace_id)
- dprintf("gx_concretize_DeviceN: color space id mismatch");
+ dprintf("gx_concretize_DeviceN: color space id mismatch");
#endif
/*
@@ -403,27 +403,27 @@ gx_concretize_DeviceN(const gs_client_color * pc, const gs_color_space * pcs,
if (pis->color_component_map.use_alt_cspace) {
- /* Check the 1-element cache first. */
- if (map->cache_valid) {
- int i;
-
- for (i = pcs->params.device_n.num_components; --i >= 0;) {
- if (map->tint[i] != pc->paint.values[i])
- break;
- }
- if (i < 0) {
- int num_out = gs_color_space_num_components(pacs);
-
- for (i = 0; i < num_out; ++i)
- pconc[i] = map->conc[i];
- return 0;
- }
- }
+ /* Check the 1-element cache first. */
+ if (map->cache_valid) {
+ int i;
+
+ for (i = pcs->params.device_n.num_components; --i >= 0;) {
+ if (map->tint[i] != pc->paint.values[i])
+ break;
+ }
+ if (i < 0) {
+ int num_out = gs_color_space_num_components(pacs);
+
+ for (i = 0; i < num_out; ++i)
+ pconc[i] = map->conc[i];
+ return 0;
+ }
+ }
tcode = (*pcs->params.device_n.map->tint_transform)
- (pc->paint.values, &cc.paint.values[0],
- pis, pcs->params.device_n.map->tint_transform_data);
+ (pc->paint.values, &cc.paint.values[0],
+ pis, pcs->params.device_n.map->tint_transform_data);
if (tcode < 0)
- return tcode;
+ return tcode;
/* First check if this was PS based. */
if (gs_color_space_is_PSCIE(pacs)) {
/* If we have not yet create the profile do that now */
@@ -438,40 +438,40 @@ gx_concretize_DeviceN(const gs_client_color * pc, const gs_color_space * pcs,
cc.paint.values[0] /= 100.0;
cc.paint.values[1] = (cc.paint.values[1]+128)/255.0;
cc.paint.values[2] = (cc.paint.values[2]+128)/255.0;
- }
+ }
code = cs_concretize_color(&cc, pacs, pconc, pis, dev);
}
else {
- int i;
+ int i;
- for (i = pcs->params.device_n.num_components; --i >= 0;)
- pconc[i] = gx_unit_frac(pc->paint.values[i]);
- return 0;
+ for (i = pcs->params.device_n.num_components; --i >= 0;)
+ pconc[i] = gx_unit_frac(pc->paint.values[i]);
+ return 0;
}
return (code < 0 || tcode == 0 ? code : tcode);
}
static int
gx_remap_concrete_DeviceN(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
#ifdef DEBUG
- /*
+ /*
* Verify that the color space and imager state info match.
*/
if (pcs->id != pis->color_component_map.cspace_id)
- dprintf("gx_remap_concrete_DeviceN: color space id mismatch");
+ dprintf("gx_remap_concrete_DeviceN: color space id mismatch");
#endif
if (pis->color_component_map.use_alt_cspace) {
const gs_color_space *pacs = pcs->base_space;
- return (*pacs->type->remap_concrete_color)
- (pconc, pacs, pdc, pis, dev, select);
+ return (*pacs->type->remap_concrete_color)
+ (pconc, pacs, pdc, pis, dev, select);
}
else {
- gx_remap_concrete_devicen(pconc, pdc, pis, dev, select);
- return 0;
+ gx_remap_concrete_devicen(pconc, pdc, pis, dev, select);
+ return 0;
}
}
@@ -490,7 +490,7 @@ check_DeviceN_component_names(const gs_color_space * pcs, gs_state * pgs)
byte * pname;
uint name_size;
gs_devicen_color_map * pcolor_component_map
- = &pgs->color_component_map;
+ = &pgs->color_component_map;
gx_device * dev = pgs->device;
bool non_match = false;
@@ -503,33 +503,33 @@ check_DeviceN_component_names(const gs_color_space * pcs, gs_state * pgs)
* using an additive color model.
*/
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) {
- pcolor_component_map->use_alt_cspace = true;
- return 0;
+ pcolor_component_map->use_alt_cspace = true;
+ return 0;
}
/*
* Now check the names of the color components.
*/
non_match = false;
for(i = 0; i < num_comp; i++ ) {
- /*
- * Get the character string and length for the component name.
- */
- pcs->params.device_n.get_colorname_string(dev->memory, names[i], &pname, &name_size);
- /*
- * Compare the colorant name to the device's. If the device's
- * compare routine returns GX_DEVICE_COLOR_MAX_COMPONENTS then the
- * colorant is in the SeparationNames list but not in the
- * SeparationOrder list.
- */
- colorant_number = (*dev_proc(dev, get_color_comp_index))
- (dev, (const char *)pname, name_size, SEPARATION_NAME);
- if (colorant_number >= 0) { /* If valid colorant name */
- pcolor_component_map->color_map[i] =
- (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) ? -1
- : colorant_number;
- }
- else
- non_match = true;
+ /*
+ * Get the character string and length for the component name.
+ */
+ pcs->params.device_n.get_colorname_string(dev->memory, names[i], &pname, &name_size);
+ /*
+ * Compare the colorant name to the device's. If the device's
+ * compare routine returns GX_DEVICE_COLOR_MAX_COMPONENTS then the
+ * colorant is in the SeparationNames list but not in the
+ * SeparationOrder list.
+ */
+ colorant_number = (*dev_proc(dev, get_color_comp_index))
+ (dev, (const char *)pname, name_size, SEPARATION_NAME);
+ if (colorant_number >= 0) { /* If valid colorant name */
+ pcolor_component_map->color_map[i] =
+ (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) ? -1
+ : colorant_number;
+ }
+ else
+ non_match = true;
}
pcolor_component_map->use_alt_cspace = non_match;
return 0;
@@ -554,11 +554,11 @@ gx_install_DeviceN(gs_color_space * pcs, gs_state * pgs)
}
/* {csrc} was pgs->color_space->params.device_n.use_alt_cspace */
((gs_color_space *)pcs)->params.device_n.use_alt_cspace =
- using_alt_color_space(pgs);
+ using_alt_color_space(pgs);
if (pcs->params.device_n.use_alt_cspace && pcs->cmm_icc_profile_data == NULL ) {
/* No nclr ICC profile */
code = (pcs->base_space->type->install_cspace)
- (pcs->base_space, pgs);
+ (pcs->base_space, pgs);
} else if (pcs->params.device_n.use_alt_cspace) {
gs_color_space *nclr_pcs;
/* Need to install the nclr cspace */
@@ -574,7 +574,7 @@ gx_install_DeviceN(gs_color_space * pcs, gs_state * pgs)
*/
if (code >= 0)
code = dev_proc(pgs->device, update_spot_equivalent_colors)
- (pgs->device, pgs);
+ (pgs->device, pgs);
return code;
}
@@ -585,13 +585,13 @@ gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_state * pgs)
gs_devicen_color_map * pcmap = &pgs->color_component_map;
if (pcmap->use_alt_cspace) {
- const gs_color_space_type* base_type = pcs->base_space->type;
-
- /* If the base space is DeviceCMYK, handle overprint as DeviceCMYK */
- if ( base_type->index == gs_color_space_index_DeviceCMYK )
- return base_type->set_overprint( pcs->base_space, pgs );
- else
- return gx_spot_colors_set_overprint( pcs->base_space, pgs);
+ const gs_color_space_type* base_type = pcs->base_space->type;
+
+ /* If the base space is DeviceCMYK, handle overprint as DeviceCMYK */
+ if ( base_type->index == gs_color_space_index_DeviceCMYK )
+ return base_type->set_overprint( pcs->base_space, pgs );
+ else
+ return gx_spot_colors_set_overprint( pcs->base_space, pgs);
}
else {
gs_overprint_params_t params;
@@ -605,7 +605,7 @@ gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_state * pgs)
int mcomp = pcmap->color_map[i];
if (mcomp >= 0)
- gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
+ gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
}
}
@@ -622,27 +622,27 @@ gx_final_DeviceN(const gs_color_space * pcs)
rc_decrement_only(pcs->params.device_n.map, "gx_adjust_DeviceN");
while (patt != NULL) {
- pnextatt = patt->next;
- rc_decrement_cs(patt->cspace, "gx_final_DeviceN");
+ pnextatt = patt->next;
+ rc_decrement_cs(patt->cspace, "gx_final_DeviceN");
rc_decrement(patt, "gx_adjust_DeviceN");
- patt = pnextatt;
+ patt = pnextatt;
}
}
/* ---------------- Serialization. -------------------------------- */
-int
+int
gx_serialize_device_n_map(const gs_color_space * pcs, gs_device_n_map * m, stream * s)
{
const gs_function_t *pfn;
if (m->tint_transform != map_devn_using_function)
- return_error(gs_error_unregistered); /* Unimplemented. */
+ return_error(gs_error_unregistered); /* Unimplemented. */
pfn = (const gs_function_t *)m->tint_transform_data;
return gs_function_serialize(pfn, s);
}
-static int
+static int
gx_serialize_DeviceN(const gs_color_space * pcs, stream * s)
{
const gs_device_n_params * p = &pcs->params.device_n;
@@ -650,16 +650,16 @@ gx_serialize_DeviceN(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->num_components, sizeof(p->num_components), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->names[0], sizeof(p->names[0]) * p->num_components, &n);
if (code < 0)
- return code;
+ return code;
code = cs_serialize(pcs->base_space, s);
if (code < 0)
- return code;
+ return code;
return gx_serialize_device_n_map(pcs, p->map, s);
/* p->use_alt_cspace isn't a property of the space. */
}
diff --git a/gs/base/gscdevn.h b/gs/base/gscdevn.h
index b36069cf6..d4e22d836 100644
--- a/gs/base/gscdevn.h
+++ b/gs/base/gscdevn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,19 +33,18 @@ gs_cspace_new_DeviceN(
gs_memory_t *pmem
);
-
/* Set the tint transformation procedure for a DeviceN color space. */
/* VMS limits procedure names to 31 characters, and some systems only */
/* compare the first 23 characters. */
extern int gs_cspace_set_devn_proc(
- gs_color_space * pcspace,
- int (*proc)(const float *,
- float *,
- const gs_imager_state *,
- void *
- ),
- void *proc_data
- );
+ gs_color_space * pcspace,
+ int (*proc)(const float *,
+ float *,
+ const gs_imager_state *,
+ void *
+ ),
+ void *proc_data
+ );
/* Set the DeviceN tint transformation procedure to a Function. */
#ifndef gs_function_DEFINED
@@ -53,7 +52,7 @@ typedef struct gs_function_s gs_function_t;
# define gs_function_DEFINED
#endif
int gs_cspace_set_devn_function(gs_color_space *pcspace,
- gs_function_t *pfn);
+ gs_function_t *pfn);
/*
* If the DeviceN tint transformation procedure is a Function,
@@ -63,7 +62,7 @@ gs_function_t *gs_cspace_get_devn_function(const gs_color_space *pcspace);
/* Map a DeviceN color using a Function. */
int map_devn_using_function(const float *in, float *out,
- const gs_imager_state *pis, void *data);
+ const gs_imager_state *pis, void *data);
/* Serialize a DeviceN map. */
int gx_serialize_device_n_map(const gs_color_space * pcs, gs_device_n_map * m, stream * s);
diff --git a/gs/base/gscedata.c b/gs/base/gscedata.c
index 1bd634829..6a308cbb2 100644
--- a/gs/base/gscedata.c
+++ b/gs/base/gscedata.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscedata.h b/gs/base/gscedata.h
index e341d4961..2c80b4f9a 100644
--- a/gs/base/gscedata.h
+++ b/gs/base/gscedata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscencs.c b/gs/base/gscencs.c
index e5077aafa..3f77be4f0 100644
--- a/gs/base/gscencs.c
+++ b/gs/base/gscencs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,13 +53,12 @@ gs_glyph
gs_c_known_encode(gs_char ch, int ei)
{
if (ei < 0 || ei >= gs_c_known_encoding_count ||
- ch >= gs_c_known_encoding_lengths[ei]
- )
- return gs_no_glyph;
+ ch >= gs_c_known_encoding_lengths[ei]
+ )
+ return gs_no_glyph;
return gs_c_min_std_encoding_glyph + gs_c_known_encodings[ei][ch];
}
-
/*
* Decode a gs_c_glyph_name glyph with a known encoding.
*/
@@ -85,7 +84,6 @@ gs_c_decode(gs_glyph glyph, int ei)
return GS_NO_CHAR;
}
-
/*
* Convert a glyph number returned by gs_c_known_encode to a string.
*/
@@ -98,14 +96,14 @@ gs_c_glyph_name(gs_glyph glyph, gs_const_string *pstr)
#ifdef DEBUG
if (len == 0 || len > gs_c_known_encoding_max_length ||
- off >= gs_c_known_encoding_offsets[len + 1] -
- gs_c_known_encoding_offsets[len] ||
- off % len != 0
- )
- return_error(gs_error_rangecheck);
+ off >= gs_c_known_encoding_offsets[len + 1] -
+ gs_c_known_encoding_offsets[len] ||
+ off % len != 0
+ )
+ return_error(gs_error_rangecheck);
#endif
pstr->data = (const byte *)
- &gs_c_known_encoding_chars[gs_c_known_encoding_offsets[len] + off];
+ &gs_c_known_encoding_chars[gs_c_known_encoding_offsets[len] + off];
pstr->size = len;
return 0;
}
@@ -117,7 +115,7 @@ bool
gs_is_c_glyph_name(const byte *str, uint len)
{
return str >= (const byte *)gs_c_known_encoding_chars &&
- str < (const byte *)gs_c_known_encoding_chars + gs_c_known_encoding_total_chars;
+ str < (const byte *)gs_c_known_encoding_chars + gs_c_known_encoding_total_chars;
}
/*
@@ -128,28 +126,28 @@ gs_glyph
gs_c_name_glyph(const byte *str, uint len)
{
if (len == 0 || len > gs_c_known_encoding_max_length)
- return gs_no_glyph;
+ return gs_no_glyph;
/* Binary search the character table. */
{
- uint base = gs_c_known_encoding_offsets[len];
- const byte *bot = (const byte *)&gs_c_known_encoding_chars[base];
- uint count = (gs_c_known_encoding_offsets[len + 1] - base) / len;
- uint a = 0, b = count; /* know b > 0 */
- const byte *probe;
-
- while (a < b) { /* know will execute at least once */
- uint m = (a + b) >> 1;
- int cmp;
-
- probe = bot + m * len;
- cmp = memcmp(str, probe, len);
- if (cmp == 0)
- return gs_c_min_std_encoding_glyph + N(len, probe - bot);
- else if (cmp > 0)
- a = m + 1;
- else
- b = m;
- }
+ uint base = gs_c_known_encoding_offsets[len];
+ const byte *bot = (const byte *)&gs_c_known_encoding_chars[base];
+ uint count = (gs_c_known_encoding_offsets[len + 1] - base) / len;
+ uint a = 0, b = count; /* know b > 0 */
+ const byte *probe;
+
+ while (a < b) { /* know will execute at least once */
+ uint m = (a + b) >> 1;
+ int cmp;
+
+ probe = bot + m * len;
+ cmp = memcmp(str, probe, len);
+ if (cmp == 0)
+ return gs_c_min_std_encoding_glyph + N(len, probe - bot);
+ else if (cmp > 0)
+ a = m + 1;
+ else
+ b = m;
+ }
}
return gs_no_glyph;
@@ -170,13 +168,13 @@ gs_c_name_glyph(const byte *str, uint len)
main()
{
gs_glyph g;
- gs_char c;
- gs_const_string str;
+ gs_char c;
+ gs_const_string str;
/* Test with a short name. */
g = gs_c_known_encode((gs_char)0237, 1); /* caron */
printf("caron is %u, should be %u\n",
- g - gs_c_min_std_encoding_glyph, I_caron);
+ g - gs_c_min_std_encoding_glyph, I_caron);
gs_c_glyph_name(g, &str);
fwrite(str.data, 1, str.size, stdout);
printf(" should be caron\n");
@@ -184,7 +182,7 @@ main()
/* Test with a long name. */
g = gs_c_known_encode((gs_char)0277, 2); /* carriagereturn */
printf("carriagereturn is %u, should be %u\n",
- g - gs_c_min_std_encoding_glyph, I_carriagereturn);
+ g - gs_c_min_std_encoding_glyph, I_carriagereturn);
gs_c_glyph_name(g, &str);
fwrite(str.data, 1, str.size, stdout);
printf(" should be carriagereturn\n");
@@ -192,13 +190,13 @@ main()
/* Test lookup with 3 kinds of names. */
g = gs_c_name_glyph((const byte *)"circlemultiply", 14);
printf("circlemultiply is %u, should be %u\n",
- g - gs_c_min_std_encoding_glyph, I_circlemultiply);
+ g - gs_c_min_std_encoding_glyph, I_circlemultiply);
g = gs_c_name_glyph((const byte *)"numbersign", 10);
printf("numbersign is %u, should be %u\n",
- g - gs_c_min_std_encoding_glyph, I_numbersign);
+ g - gs_c_min_std_encoding_glyph, I_numbersign);
g = gs_c_name_glyph((const byte *)"copyright", 9);
printf("copyright is %u, should be %u\n",
- g - gs_c_min_std_encoding_glyph, I_copyright);
+ g - gs_c_min_std_encoding_glyph, I_copyright);
/* Test reverse lookup */
c = gs_c_decode(I_caron + gs_c_min_std_encoding_glyph, 1);
diff --git a/gs/base/gscencs.h b/gs/base/gscencs.h
index 590f65b5e..e1ed5a085 100644
--- a/gs/base/gscencs.h
+++ b/gs/base/gscencs.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gschar.c b/gs/base/gschar.c
index 588e4ea12..05afc618f 100644
--- a/gs/base/gschar.c
+++ b/gs/base/gschar.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
/* Forward declarations */
static int show_n_begin(gs_show_enum *penum, gs_state *pgs, int code,
- gs_text_enum_t *pte);
+ gs_text_enum_t *pte);
/* Structure descriptors */
extern_st(st_gs_show_enum);
@@ -38,15 +38,15 @@ void
gs_show_enum_release(gs_show_enum * penum, gs_memory_t * emem)
{
if (penum->text.operation) /* otherwise, never initialized */
- penum->procs->release((gs_text_enum_t *)penum, "gs_show_enum_release");
+ penum->procs->release((gs_text_enum_t *)penum, "gs_show_enum_release");
if (emem != 0)
- gs_free_object(emem, penum, "gs_show_enum_release");
+ gs_free_object(emem, penum, "gs_show_enum_release");
}
/* show[_n] */
int
gs_show_n_init(gs_show_enum * penum, gs_state * pgs,
- const char *str, uint size)
+ const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_show_begin(pgs, (const byte *)str, size, pgs->memory, &pte);
@@ -57,11 +57,11 @@ gs_show_n_init(gs_show_enum * penum, gs_state * pgs,
/* ashow[_n] */
int
gs_ashow_n_init(gs_show_enum * penum, gs_state * pgs,
- floatp ax, floatp ay, const char *str, uint size)
+ floatp ax, floatp ay, const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_ashow_begin(pgs, ax, ay, (const byte *)str, size,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -69,12 +69,12 @@ gs_ashow_n_init(gs_show_enum * penum, gs_state * pgs,
/* widthshow[_n] */
int
gs_widthshow_n_init(gs_show_enum * penum, gs_state * pgs,
- floatp cx, floatp cy, gs_char chr,
- const char *str, uint size)
+ floatp cx, floatp cy, gs_char chr,
+ const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_widthshow_begin(pgs, cx, cy, chr, (const byte *)str, size,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -82,12 +82,12 @@ gs_widthshow_n_init(gs_show_enum * penum, gs_state * pgs,
/* awidthshow[_n] */
int
gs_awidthshow_n_init(gs_show_enum * penum, gs_state * pgs,
- floatp cx, floatp cy, gs_char chr, floatp ax, floatp ay,
- const char *str, uint size)
+ floatp cx, floatp cy, gs_char chr, floatp ax, floatp ay,
+ const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_awidthshow_begin(pgs, cx, cy, chr, ax, ay,
- (const byte *)str, size, pgs->memory, &pte);
+ (const byte *)str, size, pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -95,7 +95,7 @@ gs_awidthshow_n_init(gs_show_enum * penum, gs_state * pgs,
/* kshow[_n] */
int
gs_kshow_n_init(gs_show_enum * penum,
- gs_state * pgs, const char *str, uint size)
+ gs_state * pgs, const char *str, uint size)
{
gs_text_enum_t *pte;
int code;
@@ -106,9 +106,9 @@ gs_kshow_n_init(gs_show_enum * penum,
case ft_CID_user_defined:
case ft_CID_TrueType:
case ft_CID_bitmap:
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
default:
- break;
+ break;
}
code = gs_kshow_begin(pgs, (const byte *)str, size, pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
@@ -117,11 +117,11 @@ gs_kshow_n_init(gs_show_enum * penum,
/* xyshow[_n] */
int
gs_xyshow_n_init(gs_show_enum * penum,
- gs_state * pgs, const char *str, uint size)
+ gs_state * pgs, const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_xyshow_begin(pgs, (const byte *)str, size, NULL, NULL, 0,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -137,7 +137,7 @@ gs_glyphshow_init(gs_show_enum * penum, gs_state * pgs, gs_glyph glyph)
}
int
gs_glyphpath_init(gs_show_enum * penum, gs_state * pgs, gs_glyph glyph,
- bool stroke_path)
+ bool stroke_path)
{
gs_text_enum_t *pte;
int code = gs_glyphpath_begin(pgs, glyph, stroke_path, pgs->memory, &pte);
@@ -158,7 +158,7 @@ gs_glyphwidth_init(gs_show_enum * penum, gs_state * pgs, gs_glyph glyph)
/* cshow[_n] */
int
gs_cshow_n_init(gs_show_enum * penum,
- gs_state * pgs, const char *str, uint size)
+ gs_state * pgs, const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_cshow_begin(pgs, (const byte *)str, size, pgs->memory, &pte);
@@ -169,11 +169,11 @@ gs_cshow_n_init(gs_show_enum * penum,
/* stringwidth[_n] */
int
gs_stringwidth_n_init(gs_show_enum * penum, gs_state * pgs,
- const char *str, uint size)
+ const char *str, uint size)
{
gs_text_enum_t *pte;
int code = gs_stringwidth_begin(pgs, (const byte *)str, size,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -181,11 +181,11 @@ gs_stringwidth_n_init(gs_show_enum * penum, gs_state * pgs,
/* charpath[_n] */
int
gs_charpath_n_init(gs_show_enum * penum, gs_state * pgs,
- const char *str, uint size, bool stroke_path)
+ const char *str, uint size, bool stroke_path)
{
gs_text_enum_t *pte;
int code = gs_charpath_begin(pgs, (const byte *)str, size, stroke_path,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -193,11 +193,11 @@ gs_charpath_n_init(gs_show_enum * penum, gs_state * pgs,
/* charboxpath[_n] */
int
gs_charboxpath_n_init(gs_show_enum * penum, gs_state * pgs,
- const char *str, uint size, bool use_boxes)
+ const char *str, uint size, bool use_boxes)
{
gs_text_enum_t *pte;
int code = gs_charboxpath_begin(pgs, (const byte *)str, size, use_boxes,
- pgs->memory, &pte);
+ pgs->memory, &pte);
return show_n_begin(penum, pgs, code, pte);
}
@@ -211,7 +211,7 @@ int
gs_setcachedevice_double(gs_show_enum *penum, gs_state *pgs, const double *pw)
{
if (penum->pgs != pgs)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gs_text_setcachedevice((gs_text_enum_t *)penum, pw);
}
/* The _float procedure is strictly for backward compatibility. */
@@ -222,7 +222,7 @@ gs_setcachedevice_float(gs_show_enum * penum, gs_state * pgs, const float *pw)
int i;
for (i = 0; i < 6; ++i)
- w[i] = pw[i];
+ w[i] = pw[i];
return gs_setcachedevice_double(penum, pgs, w);
}
@@ -231,10 +231,10 @@ gs_setcachedevice_float(gs_show_enum * penum, gs_state * pgs, const float *pw)
/* Note that this returns 1 if we just set up the cache device. */
int
gs_setcachedevice2_double(gs_show_enum * penum, gs_state * pgs,
- const double *pw2)
+ const double *pw2)
{
if (penum->pgs != pgs)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gs_text_setcachedevice2((gs_text_enum_t *)penum, pw2);
}
/* The _float procedure is strictly for backward compatibility. */
@@ -245,7 +245,7 @@ gs_setcachedevice2_float(gs_show_enum * penum, gs_state * pgs, const float *pw2)
int i;
for (i = 0; i < 10; ++i)
- w2[i] = pw2[i];
+ w2[i] = pw2[i];
return gs_setcachedevice2_double(penum, pgs, w2);
}
@@ -254,12 +254,12 @@ gs_setcachedevice2_float(gs_show_enum * penum, gs_state * pgs, const float *pw2)
/* non-displaying (stringwidth or cshow). */
int
gs_setcharwidth(gs_show_enum * penum, gs_state * pgs,
- floatp wx, floatp wy)
+ floatp wx, floatp wy)
{
double w[2];
if (penum->pgs != pgs)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
w[0] = wx, w[1] = wy;
return gs_text_setcharwidth((gs_text_enum_t *)penum, w);
}
@@ -338,22 +338,22 @@ static int
show_n_begin(gs_show_enum *penum, gs_state *pgs, int code, gs_text_enum_t *pte)
{
if (code < 0)
- return code;
+ return code;
if (gs_object_type(pgs->memory, pte) != &st_gs_show_enum) {
- /* Use the default implementation. */
- gx_device *dev = pgs->device;
- gs_text_params_t text;
- gs_memory_t *mem = pte->memory;
- dev_proc_text_begin((*text_begin)) = dev_proc(dev, text_begin);
-
- text = pte->text;
- gs_text_release(pte, "show_n_begin");
- /* Temporarily reset the text_begin procedure to the default. */
- set_dev_proc(dev, text_begin, gx_default_text_begin);
- code = gs_text_begin(pgs, &text, mem, &pte);
- set_dev_proc(dev, text_begin, text_begin);
- if (code < 0)
- return code;
+ /* Use the default implementation. */
+ gx_device *dev = pgs->device;
+ gs_text_params_t text;
+ gs_memory_t *mem = pte->memory;
+ dev_proc_text_begin((*text_begin)) = dev_proc(dev, text_begin);
+
+ text = pte->text;
+ gs_text_release(pte, "show_n_begin");
+ /* Temporarily reset the text_begin procedure to the default. */
+ set_dev_proc(dev, text_begin, gx_default_text_begin);
+ code = gs_text_begin(pgs, &text, mem, &pte);
+ set_dev_proc(dev, text_begin, text_begin);
+ if (code < 0)
+ return code;
}
/* Now we know pte points to a gs_show_enum. */
*penum = *(gs_show_enum *)pte;
diff --git a/gs/base/gschar.h b/gs/base/gschar.h
index 6ab90c4b3..acc676c13 100644
--- a/gs/base/gschar.h
+++ b/gs/base/gschar.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,21 +64,21 @@ int gs_show_use_glyph(gs_show_enum *, gs_glyph);
/* a zero (successful completion) or negative (error) value. */
/* Other values indicate the following situations: */
- /* The client must render a character: obtain the code from */
- /* gs_show_current_char, do whatever is necessary, and then */
- /* call gs_show_next again. */
+ /* The client must render a character: obtain the code from */
+ /* gs_show_current_char, do whatever is necessary, and then */
+ /* call gs_show_next again. */
#define gs_show_render TEXT_PROCESS_RENDER
- /* The client has asked to intervene between characters (kshow). */
- /* Obtain the previous and next codes from gs_kshow_previous_char */
- /* and gs_kshow_next_char, do whatever is necessary, and then */
- /* call gs_show_next again. */
+ /* The client has asked to intervene between characters (kshow). */
+ /* Obtain the previous and next codes from gs_kshow_previous_char */
+ /* and gs_kshow_next_char, do whatever is necessary, and then */
+ /* call gs_show_next again. */
#define gs_show_kern TEXT_PROCESS_INTERVENE
- /* The client has asked to handle characters individually */
- /* (xshow, yshow, xyshow, cshow). Obtain the current code */
- /* from gs_show_current_char, do whatever is necessary, and then */
- /* call gs_show_next again. */
+ /* The client has asked to handle characters individually */
+ /* (xshow, yshow, xyshow, cshow). Obtain the current code */
+ /* from gs_show_current_char, do whatever is necessary, and then */
+ /* call gs_show_next again. */
#define gs_show_move TEXT_PROCESS_INTERVENE
int gs_show_next(gs_show_enum *);
diff --git a/gs/base/gschar0.c b/gs/base/gschar0.c
index 058ff09eb..6e3b71feb 100644
--- a/gs/base/gschar0.c
+++ b/gs/base/gschar0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,18 +34,18 @@ gs_stack_modal_fonts(gs_text_enum_t *pte)
gs_font *cfont = pte->fstack.items[fdepth].font;
while (cfont->FontType == ft_composite) {
- gs_font_type0 *const cmfont = (gs_font_type0 *) cfont;
-
- if (!fmap_type_is_modal(cmfont->data.FMapType))
- break;
- if (fdepth == MAX_FONT_STACK)
- return_error(gs_error_invalidfont);
- fdepth++;
- cfont = cmfont->data.FDepVector[cmfont->data.Encoding[0]];
- pte->fstack.items[fdepth].font = cfont;
- pte->fstack.items[fdepth - 1].index = 0;
- if_debug2('j', "[j]stacking depth=%d font=0x%lx\n",
- fdepth, (ulong) cfont);
+ gs_font_type0 *const cmfont = (gs_font_type0 *) cfont;
+
+ if (!fmap_type_is_modal(cmfont->data.FMapType))
+ break;
+ if (fdepth == MAX_FONT_STACK)
+ return_error(gs_error_invalidfont);
+ fdepth++;
+ cfont = cmfont->data.FDepVector[cmfont->data.Encoding[0]];
+ pte->fstack.items[fdepth].font = cfont;
+ pte->fstack.items[fdepth - 1].index = 0;
+ if_debug2('j', "[j]stacking depth=%d font=0x%lx\n",
+ fdepth, (ulong) cfont);
}
pte->fstack.depth = fdepth;
return 0;
@@ -56,9 +56,9 @@ int
gs_type0_init_fstack(gs_text_enum_t *pte, gs_font * pfont)
{
if (!(pte->text.operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES)))
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
if_debug1('j', "[j]stacking depth=0 font=0x%lx\n",
- (ulong) pfont);
+ (ulong) pfont);
pte->fstack.depth = 0;
pte->fstack.items[0].font = pfont;
pte->fstack.items[0].index = 0;
@@ -127,132 +127,132 @@ gs_type0_next_char_glyph(gs_text_enum_t *pte, gs_char *pchr, gs_glyph *pglyph)
*/
if (pte->index == 0) {
- int idepth = 0;
-
- pfont = pte->fstack.items[0].font;
- for (; pfont->FontType == ft_composite;) {
- fmap_type fmt = (pdata = &pfont0->data)->FMapType;
-
- if (p == end)
- return 2;
- chr = *p;
- switch (fmt) {
- case fmap_escape:
- if (chr != root_esc_char(pte))
- break;
- need_left(2);
- fidx = p[1];
- p += 2;
- if_debug1('j', "[j]from root: escape %d\n", fidx);
- rdown:select_descendant(pfont, pdata, fidx, idepth);
- if_debug2('j', "[j]... new depth=%d, new font=0x%lx\n",
- idepth, (ulong) pfont);
- continue;
- case fmap_double_escape:
- if (chr != root_esc_char(pte))
- break;
- need_left(2);
- fidx = p[1];
- p += 2;
- if (fidx == chr) {
- need_left(1);
- fidx = *p++ + 256;
- }
- if_debug1('j', "[j]from root: double escape %d\n", fidx);
- goto rdown;
- case fmap_shift:
- if (chr == pdata->ShiftIn)
- fidx = 0;
- else if (chr == pdata->ShiftOut)
- fidx = 1;
- else
- break;
- p++;
- if_debug1('j', "[j]from root: shift %d\n", fidx);
- goto rdown;
- default:
- break;
- }
- break;
- }
- /* If we saw any initial escapes or shifts, */
- /* compute a new initial base font. */
- if (idepth != 0) {
- int code;
-
- pte->fstack.depth = idepth;
- code = gs_stack_modal_fonts(pte);
- if (code < 0)
- return code;
- if (pte->fstack.depth > idepth)
- changed = 1;
- orig_depth = fdepth = pte->fstack.depth;
- }
+ int idepth = 0;
+
+ pfont = pte->fstack.items[0].font;
+ for (; pfont->FontType == ft_composite;) {
+ fmap_type fmt = (pdata = &pfont0->data)->FMapType;
+
+ if (p == end)
+ return 2;
+ chr = *p;
+ switch (fmt) {
+ case fmap_escape:
+ if (chr != root_esc_char(pte))
+ break;
+ need_left(2);
+ fidx = p[1];
+ p += 2;
+ if_debug1('j', "[j]from root: escape %d\n", fidx);
+ rdown:select_descendant(pfont, pdata, fidx, idepth);
+ if_debug2('j', "[j]... new depth=%d, new font=0x%lx\n",
+ idepth, (ulong) pfont);
+ continue;
+ case fmap_double_escape:
+ if (chr != root_esc_char(pte))
+ break;
+ need_left(2);
+ fidx = p[1];
+ p += 2;
+ if (fidx == chr) {
+ need_left(1);
+ fidx = *p++ + 256;
+ }
+ if_debug1('j', "[j]from root: double escape %d\n", fidx);
+ goto rdown;
+ case fmap_shift:
+ if (chr == pdata->ShiftIn)
+ fidx = 0;
+ else if (chr == pdata->ShiftOut)
+ fidx = 1;
+ else
+ break;
+ p++;
+ if_debug1('j', "[j]from root: shift %d\n", fidx);
+ goto rdown;
+ default:
+ break;
+ }
+ break;
+ }
+ /* If we saw any initial escapes or shifts, */
+ /* compute a new initial base font. */
+ if (idepth != 0) {
+ int code;
+
+ pte->fstack.depth = idepth;
+ code = gs_stack_modal_fonts(pte);
+ if (code < 0)
+ return code;
+ if (pte->fstack.depth > idepth)
+ changed = 1;
+ orig_depth = fdepth = pte->fstack.depth;
+ }
}
/* Handle initial escapes or shifts. */
up:if (p == end)
- return 2;
+ return 2;
chr = *p;
while (fdepth > 0) {
- pfont = pte->fstack.items[fdepth - 1].font;
- pdata = &pfont0->data;
- switch (pdata->FMapType) {
- default: /* non-modal */
- fdepth--;
- continue;
-
- case fmap_escape:
- if (chr != root_esc_char(pte))
- break;
- need_left(2);
- fidx = *++p;
- if_debug1('j', "[j]next: escape %d\n", fidx);
- /* Per Adobe, if we get an escape at the root, */
- /* treat it as an ordinary character (font index). */
- if (fidx == chr && fdepth > 1) {
- fdepth--;
- goto up;
- }
- down:if (++p == end)
- return 2;
- chr = *p;
- fdepth--;
- do {
- select_descendant(pfont, pdata, fidx, fdepth);
- if_debug3('j', "[j]down from modal: new depth=%d, index=%d, new font=0x%lx\n",
- fdepth, fidx, (ulong) pfont);
- if (pfont->FontType != ft_composite)
- break;
- pdata = &pfont0->data;
- fidx = 0;
- }
- while (pdata->FMapType == fmap_escape);
- continue;
-
- case fmap_double_escape:
- if (chr != root_esc_char(pte))
- break;
- need_left(2);
- fidx = *++p;
- if (fidx == chr) {
- need_left(2);
- fidx = *++p + 256;
- }
- if_debug1('j', "[j]next: double escape %d\n", fidx);
- goto down;
-
- case fmap_shift:
- if (chr == pdata->ShiftIn)
- fidx = 0;
- else if (chr == pdata->ShiftOut)
- fidx = 1;
- else
- break;
- if_debug1('j', "[j]next: shift %d\n", fidx);
- goto down;
- }
- break;
+ pfont = pte->fstack.items[fdepth - 1].font;
+ pdata = &pfont0->data;
+ switch (pdata->FMapType) {
+ default: /* non-modal */
+ fdepth--;
+ continue;
+
+ case fmap_escape:
+ if (chr != root_esc_char(pte))
+ break;
+ need_left(2);
+ fidx = *++p;
+ if_debug1('j', "[j]next: escape %d\n", fidx);
+ /* Per Adobe, if we get an escape at the root, */
+ /* treat it as an ordinary character (font index). */
+ if (fidx == chr && fdepth > 1) {
+ fdepth--;
+ goto up;
+ }
+ down:if (++p == end)
+ return 2;
+ chr = *p;
+ fdepth--;
+ do {
+ select_descendant(pfont, pdata, fidx, fdepth);
+ if_debug3('j', "[j]down from modal: new depth=%d, index=%d, new font=0x%lx\n",
+ fdepth, fidx, (ulong) pfont);
+ if (pfont->FontType != ft_composite)
+ break;
+ pdata = &pfont0->data;
+ fidx = 0;
+ }
+ while (pdata->FMapType == fmap_escape);
+ continue;
+
+ case fmap_double_escape:
+ if (chr != root_esc_char(pte))
+ break;
+ need_left(2);
+ fidx = *++p;
+ if (fidx == chr) {
+ need_left(2);
+ fidx = *++p + 256;
+ }
+ if_debug1('j', "[j]next: double escape %d\n", fidx);
+ goto down;
+
+ case fmap_shift:
+ if (chr == pdata->ShiftIn)
+ fidx = 0;
+ else if (chr == pdata->ShiftOut)
+ fidx = 1;
+ else
+ break;
+ if_debug1('j', "[j]next: shift %d\n", fidx);
+ goto down;
+ }
+ break;
}
/* At this point, chr == *p. */
/* (This is important to know for CMap'ed fonts.) */
@@ -268,98 +268,98 @@ gs_type0_next_char_glyph(gs_text_enum_t *pte, gs_char *pchr, gs_glyph *pglyph)
*/
while ((pfont = pte->fstack.items[fdepth].font)->FontType == ft_composite) {
- pdata = &pfont0->data;
- switch (pdata->FMapType) {
- default: /* can't happen */
- return_error(gs_error_invalidfont);
-
- case fmap_8_8:
- need_left(1);
- fidx = chr;
- chr = *p++;
- if_debug2('J', "[J]8/8 index=%d, char=%ld\n",
- fidx, chr);
- break;
-
- case fmap_1_7:
- fidx = chr >> 7;
- chr &= 0x7f;
- if_debug2('J', "[J]1/7 index=%d, char=%ld\n",
- fidx, chr);
- break;
-
- case fmap_9_7:
- need_left(1);
- fidx = ((uint) chr << 1) + (*p >> 7);
- chr = *p & 0x7f;
- if_debug2('J', "[J]9/7 index=%d, char=%ld\n",
- fidx, chr);
- p++;
- break;
-
- case fmap_SubsVector:
- {
- int width = pdata->subs_width;
- uint subs_count = pdata->subs_size;
- const byte *psv = pdata->SubsVector.data;
+ pdata = &pfont0->data;
+ switch (pdata->FMapType) {
+ default: /* can't happen */
+ return_error(gs_error_invalidfont);
+
+ case fmap_8_8:
+ need_left(1);
+ fidx = chr;
+ chr = *p++;
+ if_debug2('J', "[J]8/8 index=%d, char=%ld\n",
+ fidx, chr);
+ break;
+
+ case fmap_1_7:
+ fidx = chr >> 7;
+ chr &= 0x7f;
+ if_debug2('J', "[J]1/7 index=%d, char=%ld\n",
+ fidx, chr);
+ break;
+
+ case fmap_9_7:
+ need_left(1);
+ fidx = ((uint) chr << 1) + (*p >> 7);
+ chr = *p & 0x7f;
+ if_debug2('J', "[J]9/7 index=%d, char=%ld\n",
+ fidx, chr);
+ p++;
+ break;
+
+ case fmap_SubsVector:
+ {
+ int width = pdata->subs_width;
+ uint subs_count = pdata->subs_size;
+ const byte *psv = pdata->SubsVector.data;
#define subs_loop(subs_elt, width)\
while ( subs_count != 0 && tchr >= (schr = subs_elt) )\
subs_count--, tchr -= schr, psv += width;\
chr = tchr; p += width - 1; break
- switch (width) {
- default: /* can't happen */
- return_error(gs_error_invalidfont);
- case 1:
- {
- byte tchr = (byte) chr, schr;
-
- subs_loop(*psv, 1);
- }
- case 2:
- need_left(1);
+ switch (width) {
+ default: /* can't happen */
+ return_error(gs_error_invalidfont);
+ case 1:
+ {
+ byte tchr = (byte) chr, schr;
+
+ subs_loop(*psv, 1);
+ }
+ case 2:
+ need_left(1);
#define w2(p) (((ushort)*p << 8) + p[1])
- {
- ushort tchr = ((ushort) chr << 8) + *p,
- schr;
-
- subs_loop(w2(psv), 2);
- }
- case 3:
- need_left(2);
+ {
+ ushort tchr = ((ushort) chr << 8) + *p,
+ schr;
+
+ subs_loop(w2(psv), 2);
+ }
+ case 3:
+ need_left(2);
#define w3(p) (((ulong)*p << 16) + ((uint)p[1] << 8) + p[2])
- {
- ulong tchr = ((ulong) chr << 16) + w2(p),
- schr;
-
- subs_loop(w3(psv), 3);
- }
- case 4:
- need_left(3);
+ {
+ ulong tchr = ((ulong) chr << 16) + w2(p),
+ schr;
+
+ subs_loop(w3(psv), 3);
+ }
+ case 4:
+ need_left(3);
#define w4(p) (((ulong)*p << 24) + ((ulong)p[1] << 16) + ((uint)p[2] << 8) + p[3])
- {
- ulong tchr = ((ulong) chr << 24) + w3(p),
- schr;
+ {
+ ulong tchr = ((ulong) chr << 24) + w3(p),
+ schr;
- subs_loop(w4(psv), 4);
- }
+ subs_loop(w4(psv), 4);
+ }
#undef w2
#undef w3
#undef w4
#undef subs_loop
- }
- fidx = pdata->subs_size - subs_count;
- if_debug2('J', "[J]SubsVector index=%d, char=%ld\n",
- fidx, chr);
- break;
- }
-
- case fmap_CMap:
- {
- gs_const_string cstr;
- uint mindex = p - str - 1; /* p was incremented */
- int code;
+ }
+ fidx = pdata->subs_size - subs_count;
+ if_debug2('J', "[J]SubsVector index=%d, char=%ld\n",
+ fidx, chr);
+ break;
+ }
+
+ case fmap_CMap:
+ {
+ gs_const_string cstr;
+ uint mindex = p - str - 1; /* p was incremented */
+ int code;
/*
* When decoding an FMapType4 or 5, the value
@@ -369,84 +369,84 @@ gs_type0_next_char_glyph(gs_text_enum_t *pte, gs_char *pchr, gs_glyph *pglyph)
* chr. Check whether chr has been modified, and
* if so, construct and pass a modified buffer.
*/
- if (*(p - 1) != chr) {
- byte substr[MAX_CMAP_CODE_SIZE];
- int submindex = 0;
- if_debug2('j', "[j] *(p-1) 0x%02x != chr 0x%02x, modified str should be passed\n",
- *(p-1), (byte)chr);
- memcpy(substr, p - 1,
- min(MAX_CMAP_CODE_SIZE, end - p + 1));
- substr[0] = chr;
- cstr.data = substr;
- cstr.size = min(MAX_CMAP_CODE_SIZE, end - p + 1);
- if (gs_debug_c('j')) {
- dlprintf("[j] original str(");
- debug_print_string_hex(str, end - str);
- dlprintf(") -> modified substr(");
- debug_print_string_hex(cstr.data, cstr.size);
- dlprintf(")\n");
- }
- code = gs_cmap_decode_next(pdata->CMap, &cstr,
- (uint*) &submindex, &fidx, &chr, &glyph);
- mindex += submindex;
- } else {
- cstr.data = str;
- cstr.size = end - str;
- code = gs_cmap_decode_next(pdata->CMap, &cstr, &mindex,
- &fidx, &chr, &glyph);
- }
- if (code < 0)
- return code;
- pte->cmap_code = code; /* hack for widthshow */
- p = str + mindex;
- if_debug3('J', "[J]CMap returns %d, chr=0x%lx, glyph=0x%lx\n",
- code, (ulong) chr, (ulong) glyph);
- if (code == 0) {
- if (glyph == gs_no_glyph) {
- glyph = gs_min_cid_glyph;
- if_debug0('J', "... undefined\n");
- /* Must select a descendant font anyway, we can't use the type 0
- * even for the /.notdef...
- */
- select_descendant(pfont, pdata, fidx, fdepth);
- goto done;
- }
- } else
- chr = (gs_char) glyph, glyph = gs_no_glyph;
- /****** RESCAN chr IF DESCENDANT IS CMAP'ED ******/
- break;
- }
- }
-
- select_descendant(pfont, pdata, fidx, fdepth);
- if_debug2('J', "... new depth=%d, new font=0x%lx\n",
- fdepth, (ulong) pfont);
+ if (*(p - 1) != chr) {
+ byte substr[MAX_CMAP_CODE_SIZE];
+ int submindex = 0;
+ if_debug2('j', "[j] *(p-1) 0x%02x != chr 0x%02x, modified str should be passed\n",
+ *(p-1), (byte)chr);
+ memcpy(substr, p - 1,
+ min(MAX_CMAP_CODE_SIZE, end - p + 1));
+ substr[0] = chr;
+ cstr.data = substr;
+ cstr.size = min(MAX_CMAP_CODE_SIZE, end - p + 1);
+ if (gs_debug_c('j')) {
+ dlprintf("[j] original str(");
+ debug_print_string_hex(str, end - str);
+ dlprintf(") -> modified substr(");
+ debug_print_string_hex(cstr.data, cstr.size);
+ dlprintf(")\n");
+ }
+ code = gs_cmap_decode_next(pdata->CMap, &cstr,
+ (uint*) &submindex, &fidx, &chr, &glyph);
+ mindex += submindex;
+ } else {
+ cstr.data = str;
+ cstr.size = end - str;
+ code = gs_cmap_decode_next(pdata->CMap, &cstr, &mindex,
+ &fidx, &chr, &glyph);
+ }
+ if (code < 0)
+ return code;
+ pte->cmap_code = code; /* hack for widthshow */
+ p = str + mindex;
+ if_debug3('J', "[J]CMap returns %d, chr=0x%lx, glyph=0x%lx\n",
+ code, (ulong) chr, (ulong) glyph);
+ if (code == 0) {
+ if (glyph == gs_no_glyph) {
+ glyph = gs_min_cid_glyph;
+ if_debug0('J', "... undefined\n");
+ /* Must select a descendant font anyway, we can't use the type 0
+ * even for the /.notdef...
+ */
+ select_descendant(pfont, pdata, fidx, fdepth);
+ goto done;
+ }
+ } else
+ chr = (gs_char) glyph, glyph = gs_no_glyph;
+ /****** RESCAN chr IF DESCENDANT IS CMAP'ED ******/
+ break;
+ }
+ }
+
+ select_descendant(pfont, pdata, fidx, fdepth);
+ if_debug2('J', "... new depth=%d, new font=0x%lx\n",
+ fdepth, (ulong) pfont);
}
done:
/* FontBBox may be used as metrics2 with WMode=1 :
*/
if (pte->fstack.items[fdepth].font->FontType == ft_CID_encrypted ||
- pte->fstack.items[fdepth].font->FontType == ft_CID_TrueType
- ) {
- gs_font_base *pfb = (gs_font_base *)pte->fstack.items[fdepth].font;
+ pte->fstack.items[fdepth].font->FontType == ft_CID_TrueType
+ ) {
+ gs_font_base *pfb = (gs_font_base *)pte->fstack.items[fdepth].font;
- pte->FontBBox_as_Metrics2 = pfb->FontBBox.q;
+ pte->FontBBox_as_Metrics2 = pfb->FontBBox.q;
}
/* Set fstack.items[fdepth].index to CIDFont FDArray index or 0 otherwise */
fidx = 0;
if (pte->fstack.items[fdepth].font->FontType == ft_CID_encrypted) {
- int code, font_index;
- pfont = pte->fstack.items[fdepth].font;
- code = ((gs_font_cid0 *)pfont)->cidata.glyph_data((gs_font_base *)pfont,
- glyph, NULL, &font_index);
- if (code < 0) { /* failed to load glyph data, reload glyph for CID 0 */
- code = ((gs_font_cid0 *)pfont)->cidata.glyph_data((gs_font_base *)pfont,
- (gs_glyph)(gs_min_cid_glyph + 0), NULL, &font_index);
- if (code < 0)
- return_error(gs_error_invalidfont);
- }
- fidx = (uint)font_index;
+ int code, font_index;
+ pfont = pte->fstack.items[fdepth].font;
+ code = ((gs_font_cid0 *)pfont)->cidata.glyph_data((gs_font_base *)pfont,
+ glyph, NULL, &font_index);
+ if (code < 0) { /* failed to load glyph data, reload glyph for CID 0 */
+ code = ((gs_font_cid0 *)pfont)->cidata.glyph_data((gs_font_base *)pfont,
+ (gs_glyph)(gs_min_cid_glyph + 0), NULL, &font_index);
+ if (code < 0)
+ return_error(gs_error_invalidfont);
+ }
+ fidx = (uint)font_index;
if (!changed && pte->fstack.items[fdepth].index != fidx)
changed = 1;
}
@@ -457,11 +457,11 @@ done:
/* Update the pointer into the original string, but only if */
/* we didn't switch over to parsing a code from a CMap. */
if (str == pte->text.data.bytes)
- pte->index = p - str;
+ pte->index = p - str;
pte->fstack.depth = fdepth;
if_debug4('J', "[J]depth=%d font=0x%lx index=%d changed=%d\n",
- fdepth, (ulong) pte->fstack.items[fdepth].font,
- pte->fstack.items[fdepth].index, changed);
+ fdepth, (ulong) pte->fstack.items[fdepth].font,
+ pte->fstack.items[fdepth].index, changed);
return changed;
}
#undef pfont0
diff --git a/gs/base/gscicach.c b/gs/base/gscicach.c
index 812005bd0..c314459c3 100644
--- a/gs/base/gscicach.c
+++ b/gs/base/gscicach.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,32 +54,30 @@ struct gs_color_index_cache_s {
# define MYNULL 0
};
-
-
gs_private_st_ptrs6(st_color_index_cache, gs_color_index_cache_t, "gs_color_index_cache_t",
- gs_color_index_cache_elem_ptrs, gs_color_index_cache_reloc_ptrs,
- direct_space, memory, buf, paint_values, frac_values, trans_dev);
+ gs_color_index_cache_elem_ptrs, gs_color_index_cache_reloc_ptrs,
+ direct_space, memory, buf, paint_values, frac_values, trans_dev);
gs_color_index_cache_t *
-gs_color_index_cache_create(gs_memory_t *memory, const gs_color_space *direct_space, gx_device *dev,
+gs_color_index_cache_create(gs_memory_t *memory, const gs_color_space *direct_space, gx_device *dev,
gs_imager_state *pis, bool need_frac, gx_device *trans_dev)
{
int client_num_components = cs_num_components(direct_space);
int device_num_components = trans_dev->color_info.num_components;
- gs_color_index_cache_elem_t *buf = ( gs_color_index_cache_elem_t *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE,
- sizeof(gs_color_index_cache_elem_t), "gs_color_index_cache_create");
- float *paint_values = (float *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE * client_num_components,
- sizeof(float), "gs_color_index_cache_create");
- frac31 *frac_values = (need_frac ? (frac31 *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE * device_num_components,
- sizeof(frac31), "gs_color_index_cache_create") : NULL);
+ gs_color_index_cache_elem_t *buf = ( gs_color_index_cache_elem_t *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE,
+ sizeof(gs_color_index_cache_elem_t), "gs_color_index_cache_create");
+ float *paint_values = (float *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE * client_num_components,
+ sizeof(float), "gs_color_index_cache_create");
+ frac31 *frac_values = (need_frac ? (frac31 *)gs_alloc_byte_array(memory, COLOR_INDEX_CACHE_SIZE * device_num_components,
+ sizeof(frac31), "gs_color_index_cache_create") : NULL);
gs_color_index_cache_t *pcic = gs_alloc_struct(memory, gs_color_index_cache_t, &st_color_index_cache, "gs_color_index_cache_create");
if (buf == NULL || paint_values == NULL || (need_frac && frac_values == NULL) || pcic == NULL) {
- gs_free_object(memory, buf, "gs_color_index_cache_create");
- gs_free_object(memory, paint_values, "gs_color_index_cache_create");
- gs_free_object(memory, frac_values, "gs_color_index_cache_create");
- gs_free_object(memory, pcic, "gs_color_index_cache_create");
- return NULL;
+ gs_free_object(memory, buf, "gs_color_index_cache_create");
+ gs_free_object(memory, paint_values, "gs_color_index_cache_create");
+ gs_free_object(memory, frac_values, "gs_color_index_cache_create");
+ gs_free_object(memory, pcic, "gs_color_index_cache_create");
+ return NULL;
}
memset(pcic, 0, sizeof(*pcic));
memset(buf, 0, COLOR_INDEX_CACHE_SIZE * sizeof(gs_color_index_cache_elem_t));
@@ -98,7 +96,7 @@ gs_color_index_cache_create(gs_memory_t *memory, const gs_color_space *direct_sp
return pcic;
}
-void
+void
gs_color_index_cache_destroy(gs_color_index_cache_t *pcic)
{
gs_free_object(pcic->memory, pcic->buf, "gs_color_index_cache_create");
@@ -110,7 +108,7 @@ gs_color_index_cache_destroy(gs_color_index_cache_t *pcic)
gs_free_object(pcic->memory, pcic, "gs_color_index_cache_create");
}
-static inline int
+static inline int
hash_paint_values(const gs_color_index_cache_t *this, const float *paint_values)
{
int i;
@@ -118,11 +116,11 @@ hash_paint_values(const gs_color_index_cache_t *this, const float *paint_values)
uint k = 0;
const uint a_prime = 79;
- for (i = 0; i < this->client_num_components; i++)
- v = v * a_prime + paint_values[i];
+ for (i = 0; i < this->client_num_components; i++)
+ v = v * a_prime + paint_values[i];
/* Don't know the range of v, so hash its bytes : */
for(i = 0; i < sizeof(v); i++)
- k = k * a_prime + ((byte *)&v)[i];
+ k = k * a_prime + ((byte *)&v)[i];
return k % COLOR_INDEX_CACHE_CHAINS;
}
@@ -135,21 +133,21 @@ exclude_from_chain(gs_color_index_cache_t *this, uint i)
this->buf[ip].next = in;
this->buf[in].prev = ip;
if (this->chains[co] == i)
- this->chains[co] = in;
+ this->chains[co] = in;
}
static inline void
include_into_chain(gs_color_index_cache_t *this, uint i, uint c)
{
if (this->chains[c] != MYNULL) {
- uint in = this->chains[c], ip = this->buf[in].prev;
+ uint in = this->chains[c], ip = this->buf[in].prev;
- this->buf[i].next = in;
- this->buf[i].prev = ip;
- this->buf[in].prev = i;
- this->buf[ip].next = i;
+ this->buf[i].next = in;
+ this->buf[i].prev = ip;
+ this->buf[in].prev = i;
+ this->buf[ip].next = i;
} else
- this->buf[i].prev = this->buf[i].next = i;
+ this->buf[i].prev = this->buf[i].next = i;
this->chains[c] = i;
this->buf[i].chain = c;
}
@@ -162,10 +160,10 @@ exclude_from_touch_list(gs_color_index_cache_t *this, uint i)
this->buf[ip].touch_next = in;
this->buf[in].touch_prev = ip;
if (this->recent_touch == i) {
- if (i == in)
- this->recent_touch = MYNULL;
- else
- this->recent_touch = in;
+ if (i == in)
+ this->recent_touch = MYNULL;
+ else
+ this->recent_touch = in;
}
}
@@ -173,18 +171,18 @@ static inline void
include_into_touch_list(gs_color_index_cache_t *this, uint i)
{
if (this->recent_touch != MYNULL) {
- uint in = this->recent_touch, ip = this->buf[in].touch_prev;
+ uint in = this->recent_touch, ip = this->buf[in].touch_prev;
- this->buf[i].touch_next = in;
- this->buf[i].touch_prev = ip;
- this->buf[in].touch_prev = i;
- this->buf[ip].touch_next = i;
+ this->buf[i].touch_next = in;
+ this->buf[i].touch_prev = ip;
+ this->buf[in].touch_prev = i;
+ this->buf[ip].touch_next = i;
} else
- this->buf[i].touch_prev = this->buf[i].touch_next = i;
+ this->buf[i].touch_prev = this->buf[i].touch_next = i;
this->recent_touch = i;
}
-static int
+static int
get_color_index_cache_elem(gs_color_index_cache_t *this, const float *paint_values, uint *pi)
{
int client_num_components = this->client_num_components;
@@ -192,39 +190,39 @@ get_color_index_cache_elem(gs_color_index_cache_t *this, const float *paint_valu
uint i = this->chains[c], j;
if (i != MYNULL) {
- uint tries = 16; /* Arbitrary. */
+ uint tries = 16; /* Arbitrary. */
- if (!memcmp(paint_values, this->paint_values + i * client_num_components, sizeof(*paint_values) * client_num_components)) {
- if (this->recent_touch != i) {
- exclude_from_touch_list(this, i);
- include_into_touch_list(this, i);
- }
- *pi = i;
- return 1;
- }
- for (j = this->buf[i].next; tries -- && j != i; j = this->buf[j].next) {
- if (!memcmp(paint_values, this->paint_values + j * client_num_components, sizeof(*paint_values) * client_num_components)) {
- exclude_from_chain(this, j);
- include_into_chain(this, j, c);
- if (this->recent_touch != j) {
- exclude_from_touch_list(this, j);
- include_into_touch_list(this, j);
- }
- *pi = j;
- return 1;
- }
- }
- tries+=0;
+ if (!memcmp(paint_values, this->paint_values + i * client_num_components, sizeof(*paint_values) * client_num_components)) {
+ if (this->recent_touch != i) {
+ exclude_from_touch_list(this, i);
+ include_into_touch_list(this, i);
+ }
+ *pi = i;
+ return 1;
+ }
+ for (j = this->buf[i].next; tries -- && j != i; j = this->buf[j].next) {
+ if (!memcmp(paint_values, this->paint_values + j * client_num_components, sizeof(*paint_values) * client_num_components)) {
+ exclude_from_chain(this, j);
+ include_into_chain(this, j, c);
+ if (this->recent_touch != j) {
+ exclude_from_touch_list(this, j);
+ include_into_touch_list(this, j);
+ }
+ *pi = j;
+ return 1;
+ }
+ }
+ tries+=0;
}
if (this->used < COLOR_INDEX_CACHE_SIZE) {
- /* Use a new one */
- i = this->used++;
- include_into_touch_list(this, i);
+ /* Use a new one */
+ i = this->used++;
+ include_into_touch_list(this, i);
} else {
- i = this->recent_touch;
- this->recent_touch = this->buf[i].touch_prev; /* Assuming the cyclic list,
- just move the head pointer to the last element. */
- exclude_from_chain(this, i);
+ i = this->recent_touch;
+ this->recent_touch = this->buf[i].touch_prev; /* Assuming the cyclic list,
+ just move the head pointer to the last element. */
+ exclude_from_chain(this, i);
}
include_into_chain(this, i, c);
*pi = i;
@@ -240,18 +238,18 @@ compute_frac_values(gs_color_index_cache_t *this, uint i)
int j;
for (j = 0; j < device_num_components; j++) {
- int shift = cinfo->comp_shift[j];
- int bits = cinfo->comp_bits[j];
+ int shift = cinfo->comp_shift[j];
+ int bits = cinfo->comp_bits[j];
- this->frac_values[i * device_num_components + j] = ((c >> shift) & ((1 << bits) - 1)) << (sizeof(frac31) * 8 - 1 - bits);
+ this->frac_values[i * device_num_components + j] = ((c >> shift) & ((1 << bits) - 1)) << (sizeof(frac31) * 8 - 1 - bits);
}
this->buf[i].frac_values_done = true;
}
-int
+int
gs_cached_color_index(gs_color_index_cache_t *this, const float *paint_values, gx_device_color *pdevc, frac31 *frac_values)
{
- /* Must return 2 if the color is not pure.
+ /* Must return 2 if the color is not pure.
See patch_color_to_device_color. */
const gs_color_space *pcs = this->direct_space;
int client_num_components = this->client_num_components;
@@ -260,36 +258,36 @@ gs_cached_color_index(gs_color_index_cache_t *this, const float *paint_values, g
int code;
if (get_color_index_cache_elem(this, paint_values, &i)) {
- if (pdevc != NULL) {
- pdevc->colors.pure = this->buf[i].cindex;
- pdevc->type = &gx_dc_type_data_pure;
- memcpy(pdevc->ccolor.paint.values, paint_values, sizeof(*paint_values) * client_num_components);
- pdevc->ccolor_valid = true;
- }
- if (frac_values != NULL && !this->buf[i].frac_values_done)
- compute_frac_values(this, i);
+ if (pdevc != NULL) {
+ pdevc->colors.pure = this->buf[i].cindex;
+ pdevc->type = &gx_dc_type_data_pure;
+ memcpy(pdevc->ccolor.paint.values, paint_values, sizeof(*paint_values) * client_num_components);
+ pdevc->ccolor_valid = true;
+ }
+ if (frac_values != NULL && !this->buf[i].frac_values_done)
+ compute_frac_values(this, i);
} else {
- gx_device_color devc_local;
- gs_client_color fcc;
+ gx_device_color devc_local;
+ gs_client_color fcc;
- if (pdevc == NULL)
- pdevc = &devc_local;
- memcpy(this->paint_values + i * client_num_components, paint_values, sizeof(*paint_values) * client_num_components);
- memcpy(fcc.paint.values, paint_values, sizeof(*paint_values) * client_num_components);
- code = pcs->type->remap_color(&fcc, pcs, pdevc, this->pis, this->trans_dev,
+ if (pdevc == NULL)
+ pdevc = &devc_local;
+ memcpy(this->paint_values + i * client_num_components, paint_values, sizeof(*paint_values) * client_num_components);
+ memcpy(fcc.paint.values, paint_values, sizeof(*paint_values) * client_num_components);
+ code = pcs->type->remap_color(&fcc, pcs, pdevc, this->pis, this->trans_dev,
gs_color_select_texture);
- if (code < 0)
- return code;
- if (pdevc->type != &gx_dc_type_data_pure)
- return 2;
- this->buf[i].cindex = pdevc->colors.pure;
-
- if (frac_values != NULL)
- compute_frac_values(this, i);
- else
- this->buf[i].frac_values_done = false;
+ if (code < 0)
+ return code;
+ if (pdevc->type != &gx_dc_type_data_pure)
+ return 2;
+ this->buf[i].cindex = pdevc->colors.pure;
+
+ if (frac_values != NULL)
+ compute_frac_values(this, i);
+ else
+ this->buf[i].frac_values_done = false;
}
if (frac_values != NULL)
- memcpy(frac_values, this->frac_values + i * device_num_components, sizeof(*frac_values) * device_num_components);
+ memcpy(frac_values, this->frac_values + i * device_num_components, sizeof(*frac_values) * device_num_components);
return 0;
}
diff --git a/gs/base/gscicach.h b/gs/base/gscicach.h
index a5acb9639..b11ab7f40 100644
--- a/gs/base/gscicach.h
+++ b/gs/base/gscicach.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,8 +24,8 @@
typedef struct gs_color_index_cache_s gs_color_index_cache_t;
#endif
-gs_color_index_cache_t *gs_color_index_cache_create(gs_memory_t *memory,
- const gs_color_space *direct_space, gx_device *dev, gs_imager_state *pis, bool need_frac, gx_device *trans_dev);
+gs_color_index_cache_t *gs_color_index_cache_create(gs_memory_t *memory,
+ const gs_color_space *direct_space, gx_device *dev, gs_imager_state *pis, bool need_frac, gx_device *trans_dev);
void gs_color_index_cache_destroy(gs_color_index_cache_t *this);
int gs_cached_color_index(gs_color_index_cache_t *this, const float *paint_values, gx_device_color *pdevc, frac31 *frac_values);
diff --git a/gs/base/gscie.c b/gs/base/gscie.c
index c87fa674a..5c621c3ff 100644
--- a/gs/base/gscie.c
+++ b/gs/base/gscie.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,12 +36,12 @@
/* Forward references */
static int cie_joint_caches_init(gx_cie_joint_caches *,
- const gs_cie_common *,
- gs_cie_render *);
+ const gs_cie_common *,
+ gs_cie_render *);
static void cie_joint_caches_complete(gx_cie_joint_caches *,
- const gs_cie_common *,
- const gs_cie_abc *,
- const gs_cie_render *);
+ const gs_cie_common *,
+ const gs_cie_abc *,
+ const gs_cie_render *);
static void cie_cache_restrict(cie_cache_floats *, const gs_range *);
static void cie_invert3(const gs_matrix3 *, gs_matrix3 *);
static void cie_matrix_init(gs_matrix3 *);
@@ -84,36 +84,36 @@ cache_is_linear(cie_linear_params_t *params, const cie_cache_floats *pcf)
double test = origin + scale;
for (i = 1; i < countof(pcf->values) - 1; ++i, test += scale)
- if (fabs(pcf->values[i] - test) >= 0.5 / countof(pcf->values))
- return (params->is_linear = false);
+ if (fabs(pcf->values[i] - test) >= 0.5 / countof(pcf->values))
+ return (params->is_linear = false);
params->origin = origin - pcf->params.base;
params->scale =
- diff * pcf->params.factor / (countof(pcf->values) - 1);
+ diff * pcf->params.factor / (countof(pcf->values) - 1);
return (params->is_linear = true);
}
static void
cache_set_linear(cie_cache_floats *pcf)
{
- if (pcf->params.is_identity) {
- if_debug1('c', "[c]is_linear(0x%lx) = true (is_identity)\n",
- (ulong)pcf);
- pcf->params.linear.is_linear = true;
- pcf->params.linear.origin = 0;
- pcf->params.linear.scale = 1;
- } else if (cache_is_linear(&pcf->params.linear, pcf)) {
- if (pcf->params.linear.origin == 0 &&
- fabs(pcf->params.linear.scale - 1) < 0.00001)
- pcf->params.is_identity = true;
- if_debug4('c',
- "[c]is_linear(0x%lx) = true, origin = %g, scale = %g%s\n",
- (ulong)pcf, pcf->params.linear.origin,
- pcf->params.linear.scale,
- (pcf->params.is_identity ? " (=> is_identity)" : ""));
- }
+ if (pcf->params.is_identity) {
+ if_debug1('c', "[c]is_linear(0x%lx) = true (is_identity)\n",
+ (ulong)pcf);
+ pcf->params.linear.is_linear = true;
+ pcf->params.linear.origin = 0;
+ pcf->params.linear.scale = 1;
+ } else if (cache_is_linear(&pcf->params.linear, pcf)) {
+ if (pcf->params.linear.origin == 0 &&
+ fabs(pcf->params.linear.scale - 1) < 0.00001)
+ pcf->params.is_identity = true;
+ if_debug4('c',
+ "[c]is_linear(0x%lx) = true, origin = %g, scale = %g%s\n",
+ (ulong)pcf, pcf->params.linear.origin,
+ pcf->params.linear.scale,
+ (pcf->params.is_identity ? " (=> is_identity)" : ""));
+ }
#ifdef DEBUG
- else
- if_debug1('c', "[c]linear(0x%lx) = false\n", (ulong)pcf);
+ else
+ if_debug1('c', "[c]linear(0x%lx) = false\n", (ulong)pcf);
#endif
}
static void
@@ -134,9 +134,9 @@ static void
if_debug_matrix3(const char *str, const gs_matrix3 *mat)
{
if_debug10('c', "%s [%g %g %g] [%g %g %g] [%g %g %g]\n", str,
- mat->cu.u, mat->cu.v, mat->cu.w,
- mat->cv.u, mat->cv.v, mat->cv.w,
- mat->cw.u, mat->cw.v, mat->cw.w);
+ mat->cu.u, mat->cu.v, mat->cu.w,
+ mat->cv.u, mat->cv.v, mat->cv.w,
+ mat->cw.u, mat->cw.v, mat->cw.w);
}
#else
# define if_debug_vector3(str, vec) DO_NOTHING
@@ -257,7 +257,7 @@ gs_cie_cached_value(floatp in, const cie_cache_floats *pcache)
* cache, so we need to round the index just a tiny bit.
*/
int index =
- (int)((in - pcache->params.base) * pcache->params.factor + 0.0001);
+ (int)((in - pcache->params.base) * pcache->params.factor + 0.0001);
CIE_CLAMP_INDEX(index);
return pcache->values[index];
@@ -323,9 +323,9 @@ static inline void
cie_restrict(float *pv, const gs_range *range)
{
if (*pv <= range->rmin)
- *pv = range->rmin;
+ *pv = range->rmin;
else if (*pv >= range->rmax)
- *pv = range->rmax;
+ *pv = range->rmax;
}
void
@@ -369,9 +369,9 @@ gx_restrict_CIEA(gs_client_color * pcc, const gs_color_space * pcs)
/* ------ Install a CIE color space ------ */
static void cie_cache_mult(gx_cie_vector_cache *, const gs_vector3 *,
- const cie_cache_floats *, floatp);
+ const cie_cache_floats *, floatp);
static bool cie_cache_mult3(gx_cie_vector_cache3_t *,
- const gs_matrix3 *, floatp);
+ const gs_matrix3 *, floatp);
int
gx_install_cie_abc(gs_cie_abc *pcie, gs_state * pgs)
@@ -379,8 +379,8 @@ gx_install_cie_abc(gs_cie_abc *pcie, gs_state * pgs)
if_debug_matrix3("[c]CIE MatrixABC =", &pcie->MatrixABC);
cie_matrix_init(&pcie->MatrixABC);
CIE_LOAD_CACHE_BODY(pcie->caches.DecodeABC.caches, pcie->RangeABC.ranges,
- &pcie->DecodeABC, DecodeABC_default, pcie,
- "DecodeABC");
+ &pcie->DecodeABC, DecodeABC_default, pcie,
+ "DecodeABC");
gx_cie_load_common_cache(&pcie->common, pgs);
gs_cie_abc_complete(pcie);
return gs_cie_cs_complete(pgs, true);
@@ -392,8 +392,8 @@ gx_install_CIEDEFG(gs_color_space * pcs, gs_state * pgs)
gs_cie_defg *pcie = pcs->params.defg;
CIE_LOAD_CACHE_BODY(pcie->caches_defg.DecodeDEFG, pcie->RangeDEFG.ranges,
- &pcie->DecodeDEFG, DecodeDEFG_default, pcie,
- "DecodeDEFG");
+ &pcie->DecodeDEFG, DecodeDEFG_default, pcie,
+ "DecodeDEFG");
return gx_install_cie_abc((gs_cie_abc *)pcie, pgs);
}
@@ -403,8 +403,8 @@ gx_install_CIEDEF(gs_color_space * pcs, gs_state * pgs)
gs_cie_def *pcie = pcs->params.def;
CIE_LOAD_CACHE_BODY(pcie->caches_def.DecodeDEF, pcie->RangeDEF.ranges,
- &pcie->DecodeDEF, DecodeDEF_default, pcie,
- "DecodeDEF");
+ &pcie->DecodeDEF, DecodeDEF_default, pcie,
+ "DecodeDEF");
return gx_install_cie_abc((gs_cie_abc *)pcie, pgs);
}
@@ -422,13 +422,13 @@ gx_install_CIEA(gs_color_space * pcs, gs_state * pgs)
int i;
gs_cie_cache_init(&pcie->caches.DecodeA.floats.params, &lp,
- &pcie->RangeA, "DecodeA");
+ &pcie->RangeA, "DecodeA");
for (i = 0; i <= lp.N; ++i) {
- float in = SAMPLE_LOOP_VALUE(i, lp);
+ float in = SAMPLE_LOOP_VALUE(i, lp);
- pcie->caches.DecodeA.floats.values[i] = (*pcie->DecodeA)(in, pcie);
- if_debug3('C', "[C]DecodeA[%d] = %g => %g\n",
- i, in, pcie->caches.DecodeA.floats.values[i]);
+ pcie->caches.DecodeA.floats.values[i] = (*pcie->DecodeA)(in, pcie);
+ if_debug3('C', "[C]DecodeA[%d] = %g => %g\n",
+ i, in, pcie->caches.DecodeA.floats.values[i]);
}
gx_cie_load_common_cache(&pcie->common, pgs);
gs_cie_a_complete(pcie);
@@ -443,8 +443,8 @@ gx_cie_load_common_cache(gs_cie_common * pcie, gs_state * pgs)
if_debug_matrix3("[c]CIE MatrixLMN =", &pcie->MatrixLMN);
cie_matrix_init(&pcie->MatrixLMN);
CIE_LOAD_CACHE_BODY(pcie->caches.DecodeLMN, pcie->RangeLMN.ranges,
- &pcie->DecodeLMN, DecodeLMN_default, pcie,
- "DecodeLMN");
+ &pcie->DecodeLMN, DecodeLMN_default, pcie,
+ "DecodeLMN");
}
/* Complete loading the common caches. */
@@ -455,7 +455,7 @@ gx_cie_common_complete(gs_cie_common *pcie)
int i;
for (i = 0; i < 3; ++i)
- cache_set_linear(&pcie->caches.DecodeLMN[i].floats);
+ cache_set_linear(&pcie->caches.DecodeLMN[i].floats);
}
/*
@@ -469,12 +469,12 @@ gs_cie_defx_scale(float *values, const gs_range *range, int dim)
int i;
for (i = 0; i < gx_cie_cache_size; ++i) {
- float value = values[i];
+ float value = values[i];
- values[i] =
- (value <= range->rmin ? 0 :
- value >= range->rmax ? dim - 1 :
- (value - range->rmin) * scale);
+ values[i] =
+ (value <= range->rmin ? 0 :
+ value >= range->rmax ? dim - 1 :
+ (value - range->rmin) * scale);
}
}
@@ -486,8 +486,8 @@ gs_cie_defg_complete(gs_cie_defg * pcie)
int j;
for (j = 0; j < 4; ++j)
- gs_cie_defx_scale(pcie->caches_defg.DecodeDEFG[j].floats.values,
- &pcie->RangeHIJK.ranges[j], pcie->Table.dims[j]);
+ gs_cie_defx_scale(pcie->caches_defg.DecodeDEFG[j].floats.values,
+ &pcie->RangeHIJK.ranges[j], pcie->Table.dims[j]);
gs_cie_abc_complete((gs_cie_abc *)pcie);
}
@@ -499,8 +499,8 @@ gs_cie_def_complete(gs_cie_def * pcie)
int j;
for (j = 0; j < 3; ++j)
- gs_cie_defx_scale(pcie->caches_def.DecodeDEF[j].floats.values,
- &pcie->RangeHIJ.ranges[j], pcie->Table.dims[j]);
+ gs_cie_defx_scale(pcie->caches_def.DecodeDEF[j].floats.values,
+ &pcie->RangeHIJ.ranges[j], pcie->Table.dims[j]);
gs_cie_abc_complete((gs_cie_abc *)pcie);
}
@@ -511,8 +511,8 @@ gs_cie_abc_complete(gs_cie_abc * pcie)
{
cache3_set_linear(&pcie->caches.DecodeABC);
pcie->caches.skipABC =
- cie_cache_mult3(&pcie->caches.DecodeABC, &pcie->MatrixABC,
- CACHE_THRESHOLD);
+ cie_cache_mult3(&pcie->caches.DecodeABC, &pcie->MatrixABC,
+ CACHE_THRESHOLD);
gx_cie_common_complete((gs_cie_common *)pcie);
}
@@ -522,8 +522,8 @@ void
gs_cie_a_complete(gs_cie_a * pcie)
{
cie_cache_mult(&pcie->caches.DecodeA, &pcie->MatrixA,
- &pcie->caches.DecodeA.floats,
- CACHE_THRESHOLD);
+ &pcie->caches.DecodeA.floats,
+ CACHE_THRESHOLD);
cache_set_linear(&pcie->caches.DecodeA.floats);
gx_cie_common_complete((gs_cie_common *)pcie);
}
@@ -538,15 +538,15 @@ typedef struct cie_cache_range_temp_s {
} cie_cache_range_temp_t;
static inline void
check_interpolation_required(cie_cache_range_temp_t *pccr,
- cie_cached_value cur, int i, floatp threshold)
+ cie_cached_value cur, int i, floatp threshold)
{
cie_cached_value prev = pccr->prev;
if (cie_cached_abs(cur - prev) > threshold * min(cie_cached_abs(prev), cie_cached_abs(cur))) {
- if (i - 1 < pccr->imin)
- pccr->imin = i - 1;
- if (i > pccr->imax)
- pccr->imax = i;
+ if (i - 1 < pccr->imin)
+ pccr->imin = i - 1;
+ if (i > pccr->imax)
+ pccr->imax = i;
}
pccr->prev = cur;
}
@@ -559,28 +559,28 @@ cie_cache_set_interpolation(gx_cie_vector_cache *pcache, floatp threshold)
int i, j;
for (j = 0; j < 3; ++j)
- temp[j].imin = gx_cie_cache_size, temp[j].imax = -1;
+ temp[j].imin = gx_cie_cache_size, temp[j].imax = -1;
temp[0].prev = pcache->vecs.values[0].u;
temp[1].prev = pcache->vecs.values[0].v;
temp[2].prev = pcache->vecs.values[0].w;
for (i = 0; i < gx_cie_cache_size; ++i) {
- check_interpolation_required(&temp[0], pcache->vecs.values[i].u, i,
- threshold);
- check_interpolation_required(&temp[1], pcache->vecs.values[i].v, i,
- threshold);
- check_interpolation_required(&temp[2], pcache->vecs.values[i].w, i,
- threshold);
+ check_interpolation_required(&temp[0], pcache->vecs.values[i].u, i,
+ threshold);
+ check_interpolation_required(&temp[1], pcache->vecs.values[i].v, i,
+ threshold);
+ check_interpolation_required(&temp[2], pcache->vecs.values[i].w, i,
+ threshold);
}
for (j = 0; j < 3; ++j) {
- pcache->vecs.params.interpolation_ranges[j].rmin =
- base + (cie_cached_value)((double)temp[j].imin / factor);
- pcache->vecs.params.interpolation_ranges[j].rmax =
- base + (cie_cached_value)((double)temp[j].imax / factor);
- if_debug3('c', "[c]interpolation_ranges[%d] = %g, %g\n", j,
- cie_cached2float(pcache->vecs.params.interpolation_ranges[j].rmin),
- cie_cached2float(pcache->vecs.params.interpolation_ranges[j].rmax));
+ pcache->vecs.params.interpolation_ranges[j].rmin =
+ base + (cie_cached_value)((double)temp[j].imin / factor);
+ pcache->vecs.params.interpolation_ranges[j].rmax =
+ base + (cie_cached_value)((double)temp[j].imax / factor);
+ if_debug3('c', "[c]interpolation_ranges[%d] = %g, %g\n", j,
+ cie_cached2float(pcache->vecs.params.interpolation_ranges[j].rmin),
+ cie_cached2float(pcache->vecs.params.interpolation_ranges[j].rmax));
}
}
@@ -592,7 +592,7 @@ cie_cache_set_interpolation(gx_cie_vector_cache *pcache, floatp threshold)
*/
static void
cie_cache_mult(gx_cie_vector_cache * pcache, const gs_vector3 * pvec,
- const cie_cache_floats * pcf, floatp threshold)
+ const cie_cache_floats * pcf, floatp threshold)
{
float u = pvec->u, v = pvec->v, w = pvec->w;
int i;
@@ -600,14 +600,14 @@ cie_cache_mult(gx_cie_vector_cache * pcache, const gs_vector3 * pvec,
pcache->vecs.params.base = float2cie_cached(pcf->params.base);
pcache->vecs.params.factor = float2cie_cached(pcf->params.factor);
pcache->vecs.params.limit =
- float2cie_cached((gx_cie_cache_size - 1) / pcf->params.factor +
- pcf->params.base);
+ float2cie_cached((gx_cie_cache_size - 1) / pcf->params.factor +
+ pcf->params.base);
for (i = 0; i < gx_cie_cache_size; ++i) {
- float f = pcf->values[i];
+ float f = pcf->values[i];
- pcache->vecs.values[i].u = float2cie_cached(f * u);
- pcache->vecs.values[i].v = float2cie_cached(f * v);
- pcache->vecs.values[i].w = float2cie_cached(f * w);
+ pcache->vecs.values[i].u = float2cie_cached(f * u);
+ pcache->vecs.values[i].v = float2cie_cached(f * v);
+ pcache->vecs.values[i].w = float2cie_cached(f * w);
}
cie_cache_set_interpolation(pcache, threshold);
}
@@ -623,19 +623,19 @@ cie_cache3_set_interpolation(gx_cie_vector_cache3_t * pvc)
/* Iterate over output components. */
for (j = 0; j < 3; ++j) {
- /* Iterate over sub-caches. */
- cie_interpolation_range_t *p =
- &pvc->caches[0].vecs.params.interpolation_ranges[j];
+ /* Iterate over sub-caches. */
+ cie_interpolation_range_t *p =
+ &pvc->caches[0].vecs.params.interpolation_ranges[j];
cie_cached_value rmin = p->rmin, rmax = p->rmax;
- for (k = 1; k < 3; ++k) {
- p = &pvc->caches[k].vecs.params.interpolation_ranges[j];
- rmin = min(rmin, p->rmin), rmax = max(rmax, p->rmax);
- }
- pvc->interpolation_ranges[j].rmin = rmin;
- pvc->interpolation_ranges[j].rmax = rmax;
- if_debug3('c', "[c]Merged interpolation_ranges[%d] = %g, %g\n",
- j, rmin, rmax);
+ for (k = 1; k < 3; ++k) {
+ p = &pvc->caches[k].vecs.params.interpolation_ranges[j];
+ rmin = min(rmin, p->rmin), rmax = max(rmax, p->rmax);
+ }
+ pvc->interpolation_ranges[j].rmin = rmin;
+ pvc->interpolation_ranges[j].rmax = rmax;
+ if_debug3('c', "[c]Merged interpolation_ranges[%d] = %g, %g\n",
+ j, rmin, rmax);
}
}
@@ -646,15 +646,15 @@ cie_cache3_set_interpolation(gx_cie_vector_cache3_t * pvc)
*/
static bool
cie_cache_mult3(gx_cie_vector_cache3_t * pvc, const gs_matrix3 * pmat,
- floatp threshold)
+ floatp threshold)
{
cie_cache_mult(&pvc->caches[0], &pmat->cu, &pvc->caches[0].floats, threshold);
cie_cache_mult(&pvc->caches[1], &pmat->cv, &pvc->caches[1].floats, threshold);
cie_cache_mult(&pvc->caches[2], &pmat->cw, &pvc->caches[2].floats, threshold);
cie_cache3_set_interpolation(pvc);
return pmat->is_identity & pvc->caches[0].floats.params.is_identity &
- pvc->caches[1].floats.params.is_identity &
- pvc->caches[2].floats.params.is_identity;
+ pvc->caches[1].floats.params.is_identity &
+ pvc->caches[2].floats.params.is_identity;
}
/* ------ Install a rendering dictionary ------ */
@@ -668,20 +668,20 @@ gs_setcolorrendering(gs_state * pgs, gs_cie_render * pcrd)
bool joint_ok;
if (code < 0)
- return code;
+ return code;
if (pcrd_old != 0 && pcrd->id == pcrd_old->id)
- return 0; /* detect needless reselecting */
+ return 0; /* detect needless reselecting */
joint_ok =
- pcrd_old != 0 &&
+ pcrd_old != 0 &&
#define CRD_SAME(elt) !memcmp(&pcrd->elt, &pcrd_old->elt, sizeof(pcrd->elt))
- CRD_SAME(points.WhitePoint) && CRD_SAME(points.BlackPoint) &&
- CRD_SAME(MatrixPQR) && CRD_SAME(RangePQR) &&
- CRD_SAME(TransformPQR);
+ CRD_SAME(points.WhitePoint) && CRD_SAME(points.BlackPoint) &&
+ CRD_SAME(MatrixPQR) && CRD_SAME(RangePQR) &&
+ CRD_SAME(TransformPQR);
#undef CRD_SAME
rc_assign(pgs->cie_render, pcrd, "gs_setcolorrendering");
/* Initialize the joint caches if needed. */
if (!joint_ok)
- code = gs_cie_cs_complete(pgs, true);
+ code = gs_cie_cs_complete(pgs, true);
gx_unset_dev_color(pgs);
return code;
}
@@ -700,12 +700,12 @@ gx_unshare_cie_caches(gs_state * pgs)
gx_cie_joint_caches *pjc = pgs->cie_joint_caches;
rc_unshare_struct(pgs->cie_joint_caches, gx_cie_joint_caches,
- &st_joint_caches, pgs->memory,
- return 0, "gx_unshare_cie_caches");
+ &st_joint_caches, pgs->memory,
+ return 0, "gx_unshare_cie_caches");
if (pgs->cie_joint_caches != pjc) {
- pjc = pgs->cie_joint_caches;
- pjc->cspace_id = pjc->render_id = gs_no_id;
- pjc->id_status = pjc->status = CIE_JC_STATUS_BUILT;
+ pjc = pgs->cie_joint_caches;
+ pjc->cspace_id = pjc->render_id = gs_no_id;
+ pjc->id_status = pjc->status = CIE_JC_STATUS_BUILT;
}
return pjc;
}
@@ -720,7 +720,7 @@ gx_currentciecaches(gs_state * pgs)
/* This procedure is idempotent. */
void
gs_cie_cache_init(cie_cache_params * pcache, gs_sample_loop_params_t * pslp,
- const gs_range * domain, client_name_t cname)
+ const gs_range * domain, client_name_t cname)
{
/*
We need to map the values in the range [domain->rmin..domain->rmax].
@@ -771,24 +771,24 @@ gs_cie_cache_init(cie_cache_params * pcache, gs_sample_loop_params_t * pslp,
/* Adjust the range if necessary. */
if (A < 0 && B >= 0) {
- const double X = -N * A / R; /* know X > 0 */
- /* Choose K to minimize range expansion. */
- const int K = (int)(A + B < 0 ? floor(X) : ceil(X)); /* know 0 < K < N */
- const double Ca = -A / K, Cb = B / (N - K); /* know Ca, Cb > 0 */
- double C = max(Ca, Cb); /* know C > 0 */
- const int M = ARCH_FLOAT_MANTISSA_BITS - CEIL_LOG2_N;
- int cexp;
- const double cfrac = frexp(C, &cexp);
-
- if_debug4('c', "[c]adjusting cache_init(%8g, %8g), X = %8g, K = %d:\n",
- A, B, X, K);
- /* Round C to no more than M significant bits. See above. */
- C = ldexp(ceil(ldexp(cfrac, M)), cexp - M);
- /* Finally, compute A' and B'. */
- A = -K * C;
- B = (N - K) * C;
- if_debug2('c', "[c] => %8g, %8g\n", A, B);
- R = B - A;
+ const double X = -N * A / R; /* know X > 0 */
+ /* Choose K to minimize range expansion. */
+ const int K = (int)(A + B < 0 ? floor(X) : ceil(X)); /* know 0 < K < N */
+ const double Ca = -A / K, Cb = B / (N - K); /* know Ca, Cb > 0 */
+ double C = max(Ca, Cb); /* know C > 0 */
+ const int M = ARCH_FLOAT_MANTISSA_BITS - CEIL_LOG2_N;
+ int cexp;
+ const double cfrac = frexp(C, &cexp);
+
+ if_debug4('c', "[c]adjusting cache_init(%8g, %8g), X = %8g, K = %d:\n",
+ A, B, X, K);
+ /* Round C to no more than M significant bits. See above. */
+ C = ldexp(ceil(ldexp(cfrac, M)), cexp - M);
+ /* Finally, compute A' and B'. */
+ A = -K * C;
+ B = (N - K) * C;
+ if_debug2('c', "[c] => %8g, %8g\n", A, B);
+ R = B - A;
}
delta = R / N;
#ifdef CIE_CACHE_INTERPOLATE
@@ -804,8 +804,8 @@ gs_cie_cache_init(cie_cache_params * pcache, gs_sample_loop_params_t * pslp,
*/
pcache->factor = (any_abs(delta) < 1e-30 ? 1.0 : N / R);
if_debug4('c', "[c]cache %s 0x%lx base=%g, factor=%g\n",
- (const char *)cname, (ulong) pcache,
- pcache->base, pcache->factor);
+ (const char *)cname, (ulong) pcache,
+ pcache->base, pcache->factor);
pslp->A = A;
pslp->B = B;
#undef N
@@ -820,14 +820,14 @@ gs_cie_cache_init(cie_cache_params * pcache, gs_sample_loop_params_t * pslp,
* procedure values. This procedure is idempotent.
*/
static void cie_transform_range3(const gs_range3 *, const gs_matrix3 *,
- gs_range3 *);
+ gs_range3 *);
int
gs_cie_render_init(gs_cie_render * pcrd)
{
gs_matrix3 PQR_inverse;
if (pcrd->status >= CIE_RENDER_STATUS_INITED)
- return 0; /* init already done */
+ return 0; /* init already done */
if_debug_matrix3("[c]CRD MatrixLMN =", &pcrd->MatrixLMN);
cie_matrix_init(&pcrd->MatrixLMN);
if_debug_matrix3("[c]CRD MatrixABC =", &pcrd->MatrixABC);
@@ -836,11 +836,11 @@ gs_cie_render_init(gs_cie_render * pcrd)
cie_matrix_init(&pcrd->MatrixPQR);
cie_invert3(&pcrd->MatrixPQR, &PQR_inverse);
cie_matrix_mult3(&pcrd->MatrixLMN, &PQR_inverse,
- &pcrd->MatrixPQR_inverse_LMN);
+ &pcrd->MatrixPQR_inverse_LMN);
cie_transform_range3(&pcrd->RangePQR, &pcrd->MatrixPQR_inverse_LMN,
- &pcrd->DomainLMN);
+ &pcrd->DomainLMN);
cie_transform_range3(&pcrd->RangeLMN, &pcrd->MatrixABC,
- &pcrd->DomainABC);
+ &pcrd->DomainABC);
cie_mult3(&pcrd->points.WhitePoint, &pcrd->MatrixPQR, &pcrd->wdpqr);
cie_mult3(&pcrd->points.BlackPoint, &pcrd->MatrixPQR, &pcrd->bdpqr);
pcrd->status = CIE_RENDER_STATUS_INITED;
@@ -857,51 +857,51 @@ gs_cie_render_sample(gs_cie_render * pcrd)
int code;
if (pcrd->status >= CIE_RENDER_STATUS_SAMPLED)
- return 0; /* sampling already done */
+ return 0; /* sampling already done */
code = gs_cie_render_init(pcrd);
if (code < 0)
- return code;
+ return code;
CIE_LOAD_CACHE_BODY(pcrd->caches.EncodeLMN.caches, pcrd->DomainLMN.ranges,
- &pcrd->EncodeLMN, Encode_default, pcrd, "EncodeLMN");
+ &pcrd->EncodeLMN, Encode_default, pcrd, "EncodeLMN");
cache3_set_linear(&pcrd->caches.EncodeLMN);
CIE_LOAD_CACHE_BODY(pcrd->caches.EncodeABC, pcrd->DomainABC.ranges,
- &pcrd->EncodeABC, Encode_default, pcrd, "EncodeABC");
+ &pcrd->EncodeABC, Encode_default, pcrd, "EncodeABC");
if (pcrd->RenderTable.lookup.table != 0) {
- int i, j, m = pcrd->RenderTable.lookup.m;
- gs_sample_loop_params_t lp;
- bool is_identity = true;
-
- for (j = 0; j < m; j++) {
- gs_cie_cache_init(&pcrd->caches.RenderTableT[j].fracs.params,
- &lp, &Range3_default.ranges[0],
- "RenderTableT");
- is_identity &= pcrd->RenderTable.T.procs[j] ==
- RenderTableT_default.procs[j];
- }
- pcrd->caches.RenderTableT_is_identity = is_identity;
- /*
- * Unfortunately, we defined the first argument of the RenderTable
- * T procedures as being a byte, limiting the number of distinct
- * cache entries to 256 rather than gx_cie_cache_size.
- * We confine this decision to this loop, rather than propagating
- * it to the procedures that use the cached data, so that we can
- * change it more easily at some future time.
- */
- for (i = 0; i < gx_cie_cache_size; i++) {
+ int i, j, m = pcrd->RenderTable.lookup.m;
+ gs_sample_loop_params_t lp;
+ bool is_identity = true;
+
+ for (j = 0; j < m; j++) {
+ gs_cie_cache_init(&pcrd->caches.RenderTableT[j].fracs.params,
+ &lp, &Range3_default.ranges[0],
+ "RenderTableT");
+ is_identity &= pcrd->RenderTable.T.procs[j] ==
+ RenderTableT_default.procs[j];
+ }
+ pcrd->caches.RenderTableT_is_identity = is_identity;
+ /*
+ * Unfortunately, we defined the first argument of the RenderTable
+ * T procedures as being a byte, limiting the number of distinct
+ * cache entries to 256 rather than gx_cie_cache_size.
+ * We confine this decision to this loop, rather than propagating
+ * it to the procedures that use the cached data, so that we can
+ * change it more easily at some future time.
+ */
+ for (i = 0; i < gx_cie_cache_size; i++) {
#if gx_cie_log2_cache_size >= 8
- byte value = i >> (gx_cie_log2_cache_size - 8);
+ byte value = i >> (gx_cie_log2_cache_size - 8);
#else
- byte value = (i << (8 - gx_cie_log2_cache_size)) +
- (i >> (gx_cie_log2_cache_size * 2 - 8));
+ byte value = (i << (8 - gx_cie_log2_cache_size)) +
+ (i >> (gx_cie_log2_cache_size * 2 - 8));
#endif
- for (j = 0; j < m; j++) {
- pcrd->caches.RenderTableT[j].fracs.values[i] =
- (*pcrd->RenderTable.T.procs[j])(value, pcrd);
- if_debug3('C', "[C]RenderTableT[%d,%d] = %g\n",
- i, j,
- frac2float(pcrd->caches.RenderTableT[j].fracs.values[i]));
- }
- }
+ for (j = 0; j < m; j++) {
+ pcrd->caches.RenderTableT[j].fracs.values[i] =
+ (*pcrd->RenderTable.T.procs[j])(value, pcrd);
+ if_debug3('C', "[C]RenderTableT[%d,%d] = %g\n",
+ i, j,
+ frac2float(pcrd->caches.RenderTableT[j].fracs.values[i]));
+ }
+ }
}
pcrd->status = CIE_RENDER_STATUS_SAMPLED;
return 0;
@@ -910,7 +910,7 @@ gs_cie_render_sample(gs_cie_render * pcrd)
/* Transform a set of ranges. */
static void
cie_transform_range(const gs_range3 * in, floatp mu, floatp mv, floatp mw,
- gs_range * out)
+ gs_range * out)
{
float umin = mu * in->ranges[0].rmin, umax = mu * in->ranges[0].rmax;
float vmin = mv * in->ranges[1].rmin, vmax = mv * in->ranges[1].rmax;
@@ -918,24 +918,24 @@ cie_transform_range(const gs_range3 * in, floatp mu, floatp mv, floatp mw,
float temp;
if (umin > umax)
- temp = umin, umin = umax, umax = temp;
+ temp = umin, umin = umax, umax = temp;
if (vmin > vmax)
- temp = vmin, vmin = vmax, vmax = temp;
+ temp = vmin, vmin = vmax, vmax = temp;
if (wmin > wmax)
- temp = wmin, wmin = wmax, wmax = temp;
+ temp = wmin, wmin = wmax, wmax = temp;
out->rmin = umin + vmin + wmin;
out->rmax = umax + vmax + wmax;
}
static void
cie_transform_range3(const gs_range3 * in, const gs_matrix3 * mat,
- gs_range3 * out)
+ gs_range3 * out)
{
cie_transform_range(in, mat->cu.u, mat->cv.u, mat->cw.u,
- &out->ranges[0]);
+ &out->ranges[0]);
cie_transform_range(in, mat->cu.v, mat->cv.v, mat->cw.v,
- &out->ranges[1]);
+ &out->ranges[1]);
cie_transform_range(in, mat->cu.w, mat->cv.w, mat->cw.w,
- &out->ranges[2]);
+ &out->ranges[2]);
}
/*
@@ -949,10 +949,10 @@ gs_cie_render_complete(gs_cie_render * pcrd)
int code;
if (pcrd->status >= CIE_RENDER_STATUS_COMPLETED)
- return 0; /* completion already done */
+ return 0; /* completion already done */
code = gs_cie_render_sample(pcrd);
if (code < 0)
- return code;
+ return code;
/*
* Since range restriction happens immediately after
* the cache lookup, we can save a step by restricting
@@ -964,63 +964,63 @@ gs_cie_render_complete(gs_cie_render * pcrd)
*/
pcrd->MatrixABCEncode = pcrd->MatrixABC;
{
- int c;
- double f;
-
- for (c = 0; c < 3; c++) {
- gx_cie_float_fixed_cache *pcache = &pcrd->caches.EncodeABC[c];
-
- cie_cache_restrict(&pcrd->caches.EncodeLMN.caches[c].floats,
- &pcrd->RangeLMN.ranges[c]);
- cie_cache_restrict(&pcrd->caches.EncodeABC[c].floats,
- &pcrd->RangeABC.ranges[c]);
- if (pcrd->RenderTable.lookup.table == 0) {
- cie_cache_restrict(&pcache->floats,
- &Range3_default.ranges[0]);
- gs_cie_cache_to_fracs(&pcache->floats, &pcache->fixeds.fracs);
- pcache->fixeds.fracs.params.is_identity = false;
- } else {
- int i;
- int n = pcrd->RenderTable.lookup.dims[c];
+ int c;
+ double f;
+
+ for (c = 0; c < 3; c++) {
+ gx_cie_float_fixed_cache *pcache = &pcrd->caches.EncodeABC[c];
+
+ cie_cache_restrict(&pcrd->caches.EncodeLMN.caches[c].floats,
+ &pcrd->RangeLMN.ranges[c]);
+ cie_cache_restrict(&pcrd->caches.EncodeABC[c].floats,
+ &pcrd->RangeABC.ranges[c]);
+ if (pcrd->RenderTable.lookup.table == 0) {
+ cie_cache_restrict(&pcache->floats,
+ &Range3_default.ranges[0]);
+ gs_cie_cache_to_fracs(&pcache->floats, &pcache->fixeds.fracs);
+ pcache->fixeds.fracs.params.is_identity = false;
+ } else {
+ int i;
+ int n = pcrd->RenderTable.lookup.dims[c];
#ifdef CIE_RENDER_TABLE_INTERPOLATE
# define SCALED_INDEX(f, n, itemp)\
RESTRICTED_INDEX(f * (1 << _cie_interpolate_bits),\
- (n) << _cie_interpolate_bits, itemp)
+ (n) << _cie_interpolate_bits, itemp)
#else
- int m = pcrd->RenderTable.lookup.m;
- int k =
- (c == 0 ? 1 : c == 1 ?
- m * pcrd->RenderTable.lookup.dims[2] : m);
+ int m = pcrd->RenderTable.lookup.m;
+ int k =
+ (c == 0 ? 1 : c == 1 ?
+ m * pcrd->RenderTable.lookup.dims[2] : m);
# define SCALED_INDEX(f, n, itemp)\
(RESTRICTED_INDEX(f, n, itemp) * k)
#endif
- const gs_range *prange = pcrd->RangeABC.ranges + c;
- double scale = (n - 1) / (prange->rmax - prange->rmin);
+ const gs_range *prange = pcrd->RangeABC.ranges + c;
+ double scale = (n - 1) / (prange->rmax - prange->rmin);
- for (i = 0; i < gx_cie_cache_size; ++i) {
- float v =
- (pcache->floats.values[i] - prange->rmin) * scale
+ for (i = 0; i < gx_cie_cache_size; ++i) {
+ float v =
+ (pcache->floats.values[i] - prange->rmin) * scale
#ifndef CIE_RENDER_TABLE_INTERPOLATE
- + 0.5
+ + 0.5
#endif
- ;
- int itemp;
-
- if_debug5('c',
- "[c]cache[%d][%d] = %g => %g => %d\n",
- c, i, pcache->floats.values[i], v,
- SCALED_INDEX(v, n, itemp));
- pcache->fixeds.ints.values[i] =
- SCALED_INDEX(v, n, itemp);
- }
- pcache->fixeds.ints.params = pcache->floats.params;
- pcache->fixeds.ints.params.is_identity = false;
+ ;
+ int itemp;
+
+ if_debug5('c',
+ "[c]cache[%d][%d] = %g => %g => %d\n",
+ c, i, pcache->floats.values[i], v,
+ SCALED_INDEX(v, n, itemp));
+ pcache->fixeds.ints.values[i] =
+ SCALED_INDEX(v, n, itemp);
+ }
+ pcache->fixeds.ints.params = pcache->floats.params;
+ pcache->fixeds.ints.params.is_identity = false;
#undef SCALED_INDEX
- }
- }
- /* Fold the scaling of the EncodeABC cache index */
- /* into MatrixABC. */
+ }
+ }
+ /* Fold the scaling of the EncodeABC cache index */
+ /* into MatrixABC. */
#define MABC(i, t)\
f = pcrd->caches.EncodeABC[i].floats.params.factor;\
pcrd->MatrixABCEncode.cu.t *= f;\
@@ -1028,14 +1028,14 @@ gs_cie_render_complete(gs_cie_render * pcrd)
pcrd->MatrixABCEncode.cw.t *= f;\
pcrd->EncodeABC_base[i] =\
float2cie_cached(pcrd->caches.EncodeABC[i].floats.params.base * f)
- MABC(0, u);
- MABC(1, v);
- MABC(2, w);
+ MABC(0, u);
+ MABC(1, v);
+ MABC(2, w);
#undef MABC
- pcrd->MatrixABCEncode.is_identity = 0;
+ pcrd->MatrixABCEncode.is_identity = 0;
}
cie_cache_mult3(&pcrd->caches.EncodeLMN, &pcrd->MatrixABCEncode,
- CACHE_THRESHOLD);
+ CACHE_THRESHOLD);
pcrd->status = CIE_RENDER_STATUS_COMPLETED;
return 0;
}
@@ -1047,12 +1047,12 @@ cie_cache_restrict(cie_cache_floats * pcache, const gs_range * prange)
int i;
for (i = 0; i < gx_cie_cache_size; i++) {
- float v = pcache->values[i];
+ float v = pcache->values[i];
- if (v < prange->rmin)
- pcache->values[i] = prange->rmin;
- else if (v > prange->rmax)
- pcache->values[i] = prange->rmax;
+ if (v < prange->rmin)
+ pcache->values[i] = prange->rmin;
+ else if (v > prange->rmax)
+ pcache->values[i] = prange->rmax;
}
}
@@ -1066,7 +1066,7 @@ gs_cie_cache_to_fracs(const cie_cache_floats *pfloats, cie_cache_fracs *pfracs)
/* Loop from bottom to top so that we don't */
/* overwrite elements before they're used. */
for (i = 0; i < gx_cie_cache_size; ++i)
- pfracs->values[i] = float2frac(pfloats->values[i]);
+ pfracs->values[i] = float2frac(pfloats->values[i]);
pfracs->params = pfloats->params;
}
@@ -1082,18 +1082,18 @@ cie_cs_common_abc(const gs_color_space *pcs_orig, const gs_cie_abc **ppabc)
*ppabc = 0;
do {
switch (pcs->type->index) {
- case gs_color_space_index_CIEDEF:
- *ppabc = (const gs_cie_abc *)pcs->params.def;
- return &pcs->params.def->common;
- case gs_color_space_index_CIEDEFG:
- *ppabc = (const gs_cie_abc *)pcs->params.defg;
- return &pcs->params.defg->common;
- case gs_color_space_index_CIEABC:
- *ppabc = pcs->params.abc;
- return &pcs->params.abc->common;
- case gs_color_space_index_CIEA:
- return &pcs->params.a->common;
- default:
+ case gs_color_space_index_CIEDEF:
+ *ppabc = (const gs_cie_abc *)pcs->params.def;
+ return &pcs->params.def->common;
+ case gs_color_space_index_CIEDEFG:
+ *ppabc = (const gs_cie_abc *)pcs->params.defg;
+ return &pcs->params.defg->common;
+ case gs_color_space_index_CIEABC:
+ *ppabc = pcs->params.abc;
+ return &pcs->params.abc->common;
+ case gs_color_space_index_CIEA:
+ return &pcs->params.a->common;
+ default:
pcs = gs_cspace_base_space(pcs);
break;
}
@@ -1120,7 +1120,7 @@ gs_cie_cs_complete(gs_state * pgs, bool init)
gx_cie_joint_caches *pjc = gx_unshare_cie_caches(pgs);
if (pjc == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pjc->status = (init ? CIE_JC_STATUS_BUILT : CIE_JC_STATUS_INITED);
return 0;
}
@@ -1134,24 +1134,24 @@ gs_cie_jc_complete(const gs_imager_state *pis, const gs_color_space *pcs)
gx_cie_joint_caches *pjc = pis->cie_joint_caches;
if (pjc->cspace_id == pcs->id &&
- pjc->render_id == pcrd->id)
- pjc->status = pjc->id_status;
+ pjc->render_id == pcrd->id)
+ pjc->status = pjc->id_status;
switch (pjc->status) {
case CIE_JC_STATUS_BUILT: {
- int code = cie_joint_caches_init(pjc, common, pcrd);
+ int code = cie_joint_caches_init(pjc, common, pcrd);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
- /* falls through */
+ /* falls through */
case CIE_JC_STATUS_INITED:
- cie_joint_caches_complete(pjc, common, pabc, pcrd);
- pjc->cspace_id = pcs->id;
- pjc->render_id = pcrd->id;
- pjc->id_status = pjc->status = CIE_JC_STATUS_COMPLETED;
- /* falls through */
+ cie_joint_caches_complete(pjc, common, pabc, pcrd);
+ pjc->cspace_id = pcs->id;
+ pjc->render_id = pcrd->id;
+ pjc->id_status = pjc->status = CIE_JC_STATUS_COMPLETED;
+ /* falls through */
case CIE_JC_STATUS_COMPLETED:
- break;
+ break;
}
return 0;
}
@@ -1160,10 +1160,10 @@ gs_cie_jc_complete(const gs_imager_state *pis, const gs_color_space *pcs)
* Compute the source and destination WhitePoint and BlackPoint for
* the TransformPQR procedure.
*/
-int
+int
gs_cie_compute_points_sd(gx_cie_joint_caches *pjc,
- const gs_cie_common * pcie,
- const gs_cie_render * pcrd)
+ const gs_cie_common * pcie,
+ const gs_cie_render * pcrd)
{
gs_cie_wbsd *pwbsd = &pjc->points_sd;
@@ -1184,8 +1184,8 @@ gs_cie_compute_points_sd(gx_cie_joint_caches *pjc,
*/
static int
cie_joint_caches_init(gx_cie_joint_caches * pjc,
- const gs_cie_common * pcie,
- gs_cie_render * pcrd)
+ const gs_cie_common * pcie,
+ gs_cie_render * pcrd)
{
bool is_identity;
int j;
@@ -1196,27 +1196,27 @@ cie_joint_caches_init(gx_cie_joint_caches * pjc,
* ****** WRONG ******
*/
if (pcrd->TransformPQR.proc == TransformPQR_from_cache.proc)
- return 0;
+ return 0;
is_identity = pcrd->TransformPQR.proc == TransformPQR_default.proc;
for (j = 0; j < 3; j++) {
- int i;
- gs_sample_loop_params_t lp;
-
- gs_cie_cache_init(&pjc->TransformPQR.caches[j].floats.params, &lp,
- &pcrd->RangePQR.ranges[j], "TransformPQR");
- for (i = 0; i <= lp.N; ++i) {
- float in = SAMPLE_LOOP_VALUE(i, lp);
- float out;
- int code = (*pcrd->TransformPQR.proc)(j, in, &pjc->points_sd,
- pcrd, &out);
-
- if (code < 0)
- return code;
- pjc->TransformPQR.caches[j].floats.values[i] = out;
- if_debug4('C', "[C]TransformPQR[%d,%d] = %g => %g\n",
- j, i, in, out);
- }
- pjc->TransformPQR.caches[j].floats.params.is_identity = is_identity;
+ int i;
+ gs_sample_loop_params_t lp;
+
+ gs_cie_cache_init(&pjc->TransformPQR.caches[j].floats.params, &lp,
+ &pcrd->RangePQR.ranges[j], "TransformPQR");
+ for (i = 0; i <= lp.N; ++i) {
+ float in = SAMPLE_LOOP_VALUE(i, lp);
+ float out;
+ int code = (*pcrd->TransformPQR.proc)(j, in, &pjc->points_sd,
+ pcrd, &out);
+
+ if (code < 0)
+ return code;
+ pjc->TransformPQR.caches[j].floats.values[i] = out;
+ if_debug4('C', "[C]TransformPQR[%d,%d] = %g => %g\n",
+ j, i, in, out);
+ }
+ pjc->TransformPQR.caches[j].floats.params.is_identity = is_identity;
}
return 0;
}
@@ -1227,9 +1227,9 @@ cie_joint_caches_init(gx_cie_joint_caches * pjc,
*/
static void
cie_joint_caches_complete(gx_cie_joint_caches * pjc,
- const gs_cie_common * pcie,
- const gs_cie_abc * pabc /* NULL if CIEA */,
- const gs_cie_render * pcrd)
+ const gs_cie_common * pcie,
+ const gs_cie_abc * pabc /* NULL if CIEA */,
+ const gs_cie_render * pcrd)
{
gs_matrix3 mat3, mat2;
gs_matrix3 MatrixLMN_PQR;
@@ -1250,102 +1250,102 @@ cie_joint_caches_complete(gx_cie_joint_caches * pjc,
* A project for another day....
*/
- /* Step 4 */
+ /* Step 4 */
#ifdef OPTIMIZE_CIE_MAPPING
if (pcrd->caches.EncodeLMN.caches[0].floats.params.is_identity &&
- pcrd->caches.EncodeLMN.caches[1].floats.params.is_identity &&
- pcrd->caches.EncodeLMN.caches[2].floats.params.is_identity
- ) {
- /* Fold step 4 into step 3. */
- if_debug0('c', "[c]EncodeLMN is identity, folding MatrixABC(Encode) into MatrixPQR'+LMN.\n");
- cie_matrix_mult3(&pcrd->MatrixABCEncode, &pcrd->MatrixPQR_inverse_LMN,
- &mat3);
- pjc->skipEncodeLMN = true;
+ pcrd->caches.EncodeLMN.caches[1].floats.params.is_identity &&
+ pcrd->caches.EncodeLMN.caches[2].floats.params.is_identity
+ ) {
+ /* Fold step 4 into step 3. */
+ if_debug0('c', "[c]EncodeLMN is identity, folding MatrixABC(Encode) into MatrixPQR'+LMN.\n");
+ cie_matrix_mult3(&pcrd->MatrixABCEncode, &pcrd->MatrixPQR_inverse_LMN,
+ &mat3);
+ pjc->skipEncodeLMN = true;
} else
#endif /* OPTIMIZE_CIE_MAPPING */
{
- if_debug0('c', "[c]EncodeLMN is not identity.\n");
- mat3 = pcrd->MatrixPQR_inverse_LMN;
- pjc->skipEncodeLMN = false;
+ if_debug0('c', "[c]EncodeLMN is not identity.\n");
+ mat3 = pcrd->MatrixPQR_inverse_LMN;
+ pjc->skipEncodeLMN = false;
}
- /* Step 3 */
+ /* Step 3 */
cache3_set_linear(&pjc->TransformPQR);
cie_matrix_mult3(&pcrd->MatrixPQR, &pcie->MatrixLMN,
- &MatrixLMN_PQR);
+ &MatrixLMN_PQR);
#ifdef OPTIMIZE_CIE_MAPPING
if (pjc->TransformPQR.caches[0].floats.params.is_identity &
- pjc->TransformPQR.caches[1].floats.params.is_identity &
- pjc->TransformPQR.caches[2].floats.params.is_identity
- ) {
- /* Fold step 3 into step 2. */
- if_debug0('c', "[c]TransformPQR is identity, folding MatrixPQR'+LMN into MatrixLMN+PQR.\n");
- cie_matrix_mult3(&mat3, &MatrixLMN_PQR, &mat2);
- pjc->skipPQR = true;
+ pjc->TransformPQR.caches[1].floats.params.is_identity &
+ pjc->TransformPQR.caches[2].floats.params.is_identity
+ ) {
+ /* Fold step 3 into step 2. */
+ if_debug0('c', "[c]TransformPQR is identity, folding MatrixPQR'+LMN into MatrixLMN+PQR.\n");
+ cie_matrix_mult3(&mat3, &MatrixLMN_PQR, &mat2);
+ pjc->skipPQR = true;
} else
#endif /* OPTIMIZE_CIE_MAPPING */
{
- if_debug0('c', "[c]TransformPQR is not identity.\n");
- mat2 = MatrixLMN_PQR;
- for (j = 0; j < 3; j++) {
- cie_cache_restrict(&pjc->TransformPQR.caches[j].floats,
- &pcrd->RangePQR.ranges[j]);
- }
- cie_cache_mult3(&pjc->TransformPQR, &mat3, CACHE_THRESHOLD);
- pjc->skipPQR = false;
+ if_debug0('c', "[c]TransformPQR is not identity.\n");
+ mat2 = MatrixLMN_PQR;
+ for (j = 0; j < 3; j++) {
+ cie_cache_restrict(&pjc->TransformPQR.caches[j].floats,
+ &pcrd->RangePQR.ranges[j]);
+ }
+ cie_cache_mult3(&pjc->TransformPQR, &mat3, CACHE_THRESHOLD);
+ pjc->skipPQR = false;
}
- /* Steps 2 & 1 */
+ /* Steps 2 & 1 */
#ifdef OPTIMIZE_CIE_MAPPING
if (pcie->caches.DecodeLMN[0].floats.params.is_identity &
- pcie->caches.DecodeLMN[1].floats.params.is_identity &
- pcie->caches.DecodeLMN[2].floats.params.is_identity
- ) {
- if_debug0('c', "[c]DecodeLMN is identity, folding MatrixLMN+PQR into MatrixABC.\n");
- if (!pabc) {
- pjc->skipDecodeLMN = mat2.is_identity;
- pjc->skipDecodeABC = false;
- if (!pjc->skipDecodeLMN) {
- for (j = 0; j < 3; j++) {
- cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat2.cu + j,
- &pcie->caches.DecodeLMN[j].floats,
- CACHE_THRESHOLD);
- }
- cie_cache3_set_interpolation(&pjc->DecodeLMN);
- }
- } else {
- /*
- * Fold step 2 into step 1. This is a little different because
- * the data for step 1 are in the color space structure.
- */
- gs_matrix3 mat1;
-
- cie_matrix_mult3(&mat2, &pabc->MatrixABC, &mat1);
- for (j = 0; j < 3; j++) {
- cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat1.cu + j,
- &pabc->caches.DecodeABC.caches[j].floats,
- CACHE_THRESHOLD);
- }
- cie_cache3_set_interpolation(&pjc->DecodeLMN);
- pjc->skipDecodeLMN = false;
- pjc->skipDecodeABC = true;
- }
+ pcie->caches.DecodeLMN[1].floats.params.is_identity &
+ pcie->caches.DecodeLMN[2].floats.params.is_identity
+ ) {
+ if_debug0('c', "[c]DecodeLMN is identity, folding MatrixLMN+PQR into MatrixABC.\n");
+ if (!pabc) {
+ pjc->skipDecodeLMN = mat2.is_identity;
+ pjc->skipDecodeABC = false;
+ if (!pjc->skipDecodeLMN) {
+ for (j = 0; j < 3; j++) {
+ cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat2.cu + j,
+ &pcie->caches.DecodeLMN[j].floats,
+ CACHE_THRESHOLD);
+ }
+ cie_cache3_set_interpolation(&pjc->DecodeLMN);
+ }
+ } else {
+ /*
+ * Fold step 2 into step 1. This is a little different because
+ * the data for step 1 are in the color space structure.
+ */
+ gs_matrix3 mat1;
+
+ cie_matrix_mult3(&mat2, &pabc->MatrixABC, &mat1);
+ for (j = 0; j < 3; j++) {
+ cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat1.cu + j,
+ &pabc->caches.DecodeABC.caches[j].floats,
+ CACHE_THRESHOLD);
+ }
+ cie_cache3_set_interpolation(&pjc->DecodeLMN);
+ pjc->skipDecodeLMN = false;
+ pjc->skipDecodeABC = true;
+ }
} else
#endif /* OPTIMIZE_CIE_MAPPING */
{
- if_debug0('c', "[c]DecodeLMN is not identity.\n");
- for (j = 0; j < 3; j++) {
- cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat2.cu + j,
- &pcie->caches.DecodeLMN[j].floats,
- CACHE_THRESHOLD);
- }
- cie_cache3_set_interpolation(&pjc->DecodeLMN);
- pjc->skipDecodeLMN = false;
- pjc->skipDecodeABC = pabc != 0 && pabc->caches.skipABC;
+ if_debug0('c', "[c]DecodeLMN is not identity.\n");
+ for (j = 0; j < 3; j++) {
+ cie_cache_mult(&pjc->DecodeLMN.caches[j], &mat2.cu + j,
+ &pcie->caches.DecodeLMN[j].floats,
+ CACHE_THRESHOLD);
+ }
+ cie_cache3_set_interpolation(&pjc->DecodeLMN);
+ pjc->skipDecodeLMN = false;
+ pjc->skipDecodeABC = pabc != 0 && pabc->caches.skipABC;
}
}
@@ -1357,30 +1357,30 @@ cie_joint_caches_complete(gx_cie_joint_caches * pjc,
*/
int
gx_cie_to_xyz_alloc(gs_imager_state **ppis, const gs_color_space *pcs,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
/*
* In addition to the imager state itself, we need the joint caches.
*/
gs_imager_state *pis =
- gs_alloc_struct(mem, gs_imager_state, &st_imager_state,
- "gx_cie_to_xyz_alloc(imager state)");
+ gs_alloc_struct(mem, gs_imager_state, &st_imager_state,
+ "gx_cie_to_xyz_alloc(imager state)");
gx_cie_joint_caches *pjc;
const gs_cie_abc *pabc;
const gs_cie_common *pcie = cie_cs_common_abc(pcs, &pabc);
int j;
if (pis == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(pis, 0, sizeof(*pis)); /* mostly paranoia */
pis->memory = mem;
gs_imager_state_initialize(pis, mem);
pjc = gs_alloc_struct(mem, gx_cie_joint_caches, &st_joint_caches,
- "gx_cie_to_xyz_free(joint caches)");
+ "gx_cie_to_xyz_free(joint caches)");
if (pjc == 0) {
- gs_free_object(mem, pis, "gx_cie_to_xyz_alloc(imager state)");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, pis, "gx_cie_to_xyz_alloc(imager state)");
+ return_error(gs_error_VMerror);
}
/*
@@ -1388,9 +1388,9 @@ gx_cie_to_xyz_alloc(gs_imager_state **ppis, const gs_color_space *pcs,
* Don't bother with any optimizations.
*/
for (j = 0; j < 3; j++) {
- cie_cache_mult(&pjc->DecodeLMN.caches[j], &pcie->MatrixLMN.cu + j,
- &pcie->caches.DecodeLMN[j].floats,
- CACHE_THRESHOLD);
+ cie_cache_mult(&pjc->DecodeLMN.caches[j], &pcie->MatrixLMN.cu + j,
+ &pcie->caches.DecodeLMN[j].floats,
+ CACHE_THRESHOLD);
}
cie_cache3_set_interpolation(&pjc->DecodeLMN);
pjc->skipDecodeLMN = false;
@@ -1410,7 +1410,7 @@ gx_cie_to_xyz_free(gs_imager_state *pis)
gs_memory_t *mem = pis->memory;
gs_free_object(mem, pis->cie_joint_caches,
- "gx_cie_to_xyz_free(joint caches)");
+ "gx_cie_to_xyz_free(joint caches)");
/* Free up the ICC objects if created */
if (pis->icc_link_cache != NULL) {
rc_decrement(pis->icc_link_cache,"gx_cie_to_xyz_free");
@@ -1430,16 +1430,16 @@ gx_cie_to_xyz_free(gs_imager_state *pis)
/* Note that we are computing M * V where v is a column vector. */
void
cie_mult3(const gs_vector3 * in, register const gs_matrix3 * mat,
- gs_vector3 * out)
+ gs_vector3 * out)
{
if_debug_vector3("[c]mult", in);
if_debug_matrix3(" *", mat);
{
- float u = in->u, v = in->v, w = in->w;
+ float u = in->u, v = in->v, w = in->w;
- out->u = (u * mat->cu.u) + (v * mat->cv.u) + (w * mat->cw.u);
- out->v = (u * mat->cu.v) + (v * mat->cv.v) + (w * mat->cw.v);
- out->w = (u * mat->cu.w) + (v * mat->cv.w) + (w * mat->cw.w);
+ out->u = (u * mat->cu.u) + (v * mat->cv.u) + (w * mat->cw.u);
+ out->v = (u * mat->cu.v) + (v * mat->cv.v) + (w * mat->cw.v);
+ out->w = (u * mat->cu.w) + (v * mat->cv.w) + (w * mat->cw.w);
}
if_debug_vector3(" =", out);
}
@@ -1462,7 +1462,7 @@ cie_matrix_mult3(const gs_matrix3 *ma, const gs_matrix3 *mb, gs_matrix3 *mc)
cie_matrix_init(mp);
if_debug_matrix3(" =", mp);
if (mp != mc)
- *mc = *mp;
+ *mc = *mp;
}
/*
@@ -1535,29 +1535,29 @@ static void
cie_matrix_init(register gs_matrix3 * mat)
{
mat->is_identity =
- mat->cu.u == 1.0 && is_fzero2(mat->cu.v, mat->cu.w) &&
- mat->cv.v == 1.0 && is_fzero2(mat->cv.u, mat->cv.w) &&
- mat->cw.w == 1.0 && is_fzero2(mat->cw.u, mat->cw.v);
+ mat->cu.u == 1.0 && is_fzero2(mat->cu.v, mat->cu.w) &&
+ mat->cv.v == 1.0 && is_fzero2(mat->cv.u, mat->cv.w) &&
+ mat->cw.w == 1.0 && is_fzero2(mat->cw.u, mat->cw.v);
}
-bool
+bool
gx_color_space_needs_cie_caches(const gs_color_space * pcs)
{
switch (pcs->type->index) {
- case gs_color_space_index_CIEDEFG:
- case gs_color_space_index_CIEDEF:
- case gs_color_space_index_CIEABC:
- case gs_color_space_index_CIEA:
- return true;
- case gs_color_space_index_ICC:
+ case gs_color_space_index_CIEDEFG:
+ case gs_color_space_index_CIEDEF:
+ case gs_color_space_index_CIEABC:
+ case gs_color_space_index_CIEA:
+ return true;
+ case gs_color_space_index_ICC:
+ return false;
+ case gs_color_space_index_DevicePixel:
+ case gs_color_space_index_DeviceN:
+ case gs_color_space_index_Separation:
+ case gs_color_space_index_Indexed:
+ case gs_color_space_index_Pattern:
+ return gx_color_space_needs_cie_caches(pcs->base_space);
+ default:
return false;
- case gs_color_space_index_DevicePixel:
- case gs_color_space_index_DeviceN:
- case gs_color_space_index_Separation:
- case gs_color_space_index_Indexed:
- case gs_color_space_index_Pattern:
- return gx_color_space_needs_cie_caches(pcs->base_space);
- default:
- return false;
}
}
diff --git a/gs/base/gscie.h b/gs/base/gscie.h
index d75b0c6fc..ca5864c07 100644
--- a/gs/base/gscie.h
+++ b/gs/base/gscie.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -96,8 +96,8 @@
# define _cif(i) ((int)(i) & ((1 << _cie_interpolate_bits) - 1))
# define cie_interpolate_between(v0, v1, i)\
((v0) + cie_cached_rshift(((v1) - (v0)) * _cif(i) +\
- (1 << (_cie_interpolate_bits - 1)),\
- _cie_interpolate_bits))
+ (1 << (_cie_interpolate_bits - 1)),\
+ _cie_interpolate_bits))
# define cie_interpolate(p, i)\
((i) >= (gx_cie_cache_size - 1) << _cie_interpolate_bits ? \
(p)[gx_cie_cache_size - 1] : \
@@ -132,9 +132,9 @@ typedef long cie_cached_value;
# define cie_cached_product2int(v, factor, fbits)\
(_cie_product_excess_bits > 0 ?\
arith_rshift( (v) * arith_rshift(factor, _cie_product_excess_bits) +\
- arith_rshift(v, _cie_product_excess_bits) *\
- ((factor) & ((1 << _cie_product_excess_bits) - 1)),\
- _cie_fixed_shift * 2 - _cie_product_excess_bits - (fbits)) :\
+ arith_rshift(v, _cie_product_excess_bits) *\
+ ((factor) & ((1 << _cie_product_excess_bits) - 1)),\
+ _cie_fixed_shift * 2 - _cie_product_excess_bits - (fbits)) :\
arith_rshift((v) * (factor), _cie_fixed_shift * 2 - (fbits)))
# define cie_cached_rshift(v, n) arith_rshift(v, n)
# define cie_cached_abs(v) any_abs(v) /* labs() is C89 extension */
@@ -250,7 +250,7 @@ typedef struct gs_cie_render_proc3_s {
* recognize the proc_name), it must return a failure code.
*/
typedef int (*gs_cie_transform_proc)(int, floatp, const gs_cie_wbsd *,
- gs_cie_render *, float *);
+ gs_cie_render *, float *);
typedef struct gs_cie_transform_proc3_s {
gs_cie_transform_proc proc;
const char *proc_name;
@@ -290,7 +290,7 @@ typedef struct gs_cie_wb_s {
rendering TransformPQR RangePQR
(but depends on color space White/BlackPoints)
rendering EncodeLMN RangePQR transformed by the inverse of
- MatrixPQR and then by MatrixLMN
+ MatrixPQR and then by MatrixLMN
rendering EncodeABC RangeLMN transformed by MatrixABC
rendering RenderTable.T [0..1]*m
@@ -375,31 +375,31 @@ struct gs_cie_common_s {
gs_cie_wb points;
/* Following are computed when structure is initialized. */
struct {
- gx_cie_scalar_cache DecodeLMN[3];
+ gx_cie_scalar_cache DecodeLMN[3];
} caches;
};
/* st_cie_common and st_cie_common_elements_t are exported for gsicc.c */
#define public_st_cie_common() /* in gscscie.c */\
gs_public_st_ptrs1(st_cie_common, gs_cie_common, "gs_cie_common",\
- cie_common_enum_ptrs, cie_common_reloc_ptrs, client_data)
+ cie_common_enum_ptrs, cie_common_reloc_ptrs, client_data)
/* extern_st(st_cie_common); */ /* in gxcie.h */
#define gs_cie_common_elements\
- gs_cie_common common; /* must be first */\
- rc_header rc
+ gs_cie_common common; /* must be first */\
+ rc_header rc
typedef struct gs_cie_common_elements_s {
gs_cie_common_elements;
} gs_cie_common_elements_t;
#define public_st_cie_common_elements() /* in gscscie.c */ \
gs_public_st_suffix_add0_local( st_cie_common_elements_t,\
- gs_cie_common_elements_t,\
- "gs_cie_common_elements_t",\
- cie_common_enum_ptrs,\
- cie_common_reloc_ptrs,\
- st_cie_common)
+ gs_cie_common_elements_t,\
+ "gs_cie_common_elements_t",\
+ cie_common_enum_ptrs,\
+ cie_common_reloc_ptrs,\
+ st_cie_common)
/* extern_st(st_cie_common_elements_t); */ /* in gxcie.h */
@@ -411,27 +411,27 @@ struct gs_cie_a_s {
gs_vector3 MatrixA;
/* Following are computed when structure is initialized. */
struct {
- gx_cie_vector_cache DecodeA; /* mult. by MatrixA */
+ gx_cie_vector_cache DecodeA; /* mult. by MatrixA */
} caches;
};
#define private_st_cie_a() /* in gscscie.c */\
gs_private_st_suffix_add0_local(st_cie_a, gs_cie_a, "gs_cie_a",\
- cie_common_enum_ptrs,\
- cie_common_reloc_ptrs,\
- st_cie_common_elements_t)
+ cie_common_enum_ptrs,\
+ cie_common_reloc_ptrs,\
+ st_cie_common_elements_t)
/* Common elements for CIEBasedABC, DEF, and DEFG dictionaries. */
#define gs_cie_abc_elements\
- gs_cie_common_elements; /* must be first */\
- gs_range3 RangeABC;\
- gs_cie_abc_proc3 DecodeABC;\
- gs_matrix3 MatrixABC;\
- /* Following are computed when structure is initialized. */\
- struct {\
- bool skipABC;\
- gx_cie_vector_cache3_t DecodeABC; /* mult. by MatrixABC */\
- } caches
+ gs_cie_common_elements; /* must be first */\
+ gs_range3 RangeABC;\
+ gs_cie_abc_proc3 DecodeABC;\
+ gs_matrix3 MatrixABC;\
+ /* Following are computed when structure is initialized. */\
+ struct {\
+ bool skipABC;\
+ gx_cie_vector_cache3_t DecodeABC; /* mult. by MatrixABC */\
+ } caches
/* A CIEBasedABC dictionary. */
struct gs_cie_abc_s {
@@ -440,8 +440,8 @@ struct gs_cie_abc_s {
#define private_st_cie_abc() /* in gscscie.c */\
gs_private_st_suffix_add0_local(st_cie_abc, gs_cie_abc, "gs_cie_abc",\
- cie_common_enum_ptrs, cie_common_reloc_ptrs,\
- st_cie_common_elements_t)
+ cie_common_enum_ptrs, cie_common_reloc_ptrs,\
+ st_cie_common_elements_t)
/* A CIEBasedDEF dictionary. */
struct gs_cie_def_s {
@@ -451,7 +451,7 @@ struct gs_cie_def_s {
gs_range3 RangeHIJ;
gx_color_lookup_table Table; /* [NH][NI * NJ * 3] */
struct {
- gx_cie_scalar_cache DecodeDEF[3];
+ gx_cie_scalar_cache DecodeDEF[3];
} caches_def;
};
@@ -468,14 +468,14 @@ struct gs_cie_defg_s {
gs_range4 RangeHIJK;
gx_color_lookup_table Table; /* [NH * NI][NJ * NK * 3] */
struct {
- gx_cie_scalar_cache DecodeDEFG[4];
+ gx_cie_scalar_cache DecodeDEFG[4];
} caches_defg;
};
#define private_st_cie_defg() /* in gscscie.c */\
gs_private_st_suffix_add1(st_cie_defg, gs_cie_defg, "gs_cie_defg",\
- cie_defg_enum_ptrs, cie_defg_reloc_ptrs,\
- st_cie_abc, Table.table)
+ cie_defg_enum_ptrs, cie_defg_reloc_ptrs,\
+ st_cie_abc, Table.table)
/*
* Default values for components. Note that for some components, there are
@@ -511,7 +511,7 @@ extern const gs_cie_render_table_procs RenderTableT_from_cache;
struct gs_cie_wbsd_s {
struct {
- gs_vector3 xyz, pqr;
+ gs_vector3 xyz, pqr;
} ws, bs, wd, bd;
};
typedef struct gs_cie_render_table_s {
@@ -533,8 +533,8 @@ typedef enum {
typedef struct gx_cie_float_fixed_cache_s {
cie_cache_floats floats;
union if_ {
- cie_cache_fracs fracs;
- cie_cache_ints ints;
+ cie_cache_fracs fracs;
+ cie_cache_ints ints;
} fixeds;
} gx_cie_float_fixed_cache;
@@ -563,10 +563,10 @@ struct gs_cie_render_s {
gs_matrix3 MatrixPQR_inverse_LMN;
gs_vector3 wdpqr, bdpqr;
struct {
- gx_cie_vector_cache3_t EncodeLMN; /* mult. by M'ABCEncode */
- gx_cie_float_fixed_cache EncodeABC[3];
- gx_cie_scalar_cache RenderTableT[4];
- bool RenderTableT_is_identity;
+ gx_cie_vector_cache3_t EncodeLMN; /* mult. by M'ABCEncode */
+ gx_cie_float_fixed_cache EncodeABC[3];
+ gx_cie_scalar_cache RenderTableT[4];
+ bool RenderTableT_is_identity;
} caches;
};
@@ -574,7 +574,7 @@ struct gs_cie_render_s {
extern_st(st_cie_render1);
#define public_st_cie_render1() /* in gscrd.c */\
gs_public_st_composite(st_cie_render1, gs_cie_render, "gs_cie_render",\
- cie_render1_enum_ptrs, cie_render1_reloc_ptrs)
+ cie_render1_enum_ptrs, cie_render1_reloc_ptrs)
/* ------ Joint caches ------ */
@@ -594,7 +594,7 @@ typedef enum {
*/
#define GX_CIE_REMAP_FINISH_PROC(proc)\
int proc(cie_cached_vector3 vec3, frac *pconc,\
- const gs_imager_state *pis, const gs_color_space *pcs)
+ const gs_imager_state *pis, const gs_color_space *pcs)
struct gx_cie_joint_caches_s {
/*
@@ -641,7 +641,6 @@ struct gx_cie_joint_caches_s {
typedef struct gx_cie_joint_caches_s gx_cie_joint_caches;
#endif
-
#define private_st_joint_caches() /* in gscie.c */\
gs_private_st_simple(st_joint_caches, gx_cie_joint_caches,\
"gx_cie_joint_caches")
@@ -672,7 +671,7 @@ typedef struct gs_sample_loop_params_s {
#define SAMPLE_LOOP_VALUE(i, lp)\
( (((lp).N - (i)) * (lp).A + (i) * (lp).B) / (lp).N )
void gs_cie_cache_init(cie_cache_params *, gs_sample_loop_params_t *,
- const gs_range *, client_name_t);
+ const gs_range *, client_name_t);
void gs_cie_cache_to_fracs(const cie_cache_floats *, cie_cache_fracs *);
void gs_cie_defg_complete(gs_cie_defg *);
@@ -689,30 +688,30 @@ int gx_install_cie_abc(gs_cie_abc *, gs_state *);
#define CIE_CLAMP_INDEX(index)\
index = (index < 0 ? 0 :\
- index >= gx_cie_cache_size ? gx_cie_cache_size - 1 : index)
+ index >= gx_cie_cache_size ? gx_cie_cache_size - 1 : index)
/* Define the template for loading a cache. */
/* If we had parameterized types, or a more flexible type system, */
/* this could be done with a single procedure. */
#define CIE_LOAD_CACHE_BODY(pcache, domains, rprocs, dprocs, pcie, cname)\
BEGIN\
- int j;\
+ int j;\
\
- for (j = 0; j < countof(pcache); j++) {\
- cie_cache_floats *pcf = &(pcache)[j].floats;\
- int i;\
- gs_sample_loop_params_t lp;\
+ for (j = 0; j < countof(pcache); j++) {\
+ cie_cache_floats *pcf = &(pcache)[j].floats;\
+ int i;\
+ gs_sample_loop_params_t lp;\
\
- gs_cie_cache_init(&pcf->params, &lp, &(domains)[j], cname);\
- for (i = 0; i <= lp.N; ++i) {\
- float v = SAMPLE_LOOP_VALUE(i, lp);\
- pcf->values[i] = (*(rprocs)->procs[j])(v, pcie);\
- if_debug5('C', "[C]%s[%d,%d] = %g => %g\n",\
- cname, j, i, v, pcf->values[i]);\
- }\
- pcf->params.is_identity =\
- (rprocs)->procs[j] == (dprocs).procs[j];\
- }\
+ gs_cie_cache_init(&pcf->params, &lp, &(domains)[j], cname);\
+ for (i = 0; i <= lp.N; ++i) {\
+ float v = SAMPLE_LOOP_VALUE(i, lp);\
+ pcf->values[i] = (*(rprocs)->procs[j])(v, pcie);\
+ if_debug5('C', "[C]%s[%d,%d] = %g => %g\n",\
+ cname, j, i, v, pcf->values[i]);\
+ }\
+ pcf->params.is_identity =\
+ (rprocs)->procs[j] == (dprocs).procs[j];\
+ }\
END
/*
@@ -720,8 +719,8 @@ int gx_install_cie_abc(gs_cie_abc *, gs_state *);
* the TransformPQR procedure.
*/
int gs_cie_compute_points_sd(gx_cie_joint_caches *pjc,
- const gs_cie_common * pcie,
- const gs_cie_render * pcrd);
+ const gs_cie_common * pcie,
+ const gs_cie_render * pcrd);
/*
* Compute the derived values in a CRD that don't involve the cached
@@ -764,13 +763,13 @@ int gs_cie_render_complete(gs_cie_render *);
*/
extern int
gs_cspace_build_CIEA(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem),
+ gs_memory_t * pmem),
gs_cspace_build_CIEABC(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem),
+ gs_memory_t * pmem),
gs_cspace_build_CIEDEF(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem),
+ gs_memory_t * pmem),
gs_cspace_build_CIEDEFG(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem);
+ gs_memory_t * pmem);
/* ------ Accessors ------ */
@@ -824,14 +823,14 @@ extern int
* 3 * pdims[1] * pdims[2].
*
* For a 4 component color space (CIEBasedDEFG), ptable points to an array of
- * pdims[0] * pdims[1] strings, each of which is of length
+ * pdims[0] * pdims[1] strings, each of which is of length
* 3 * pdims[2] * pdims[3].
*
* NB: the caller is responsible for deallocating the color table data
* when no longer needed. */
extern int
gs_cie_defx_set_lookup_table(gs_color_space * pcspace, int *pdims,
- const gs_const_string * ptable);
+ const gs_const_string * ptable);
/* Serialize common CIE elements. */
int gx_serialize_cie_common_elements(const gs_color_space * pcs, stream * s);
@@ -844,9 +843,9 @@ float common_identity(floatp in, const gs_cie_common * pcie);
float abc_identity(floatp in, const gs_cie_abc * pcie);
float a_identity(floatp in, const gs_cie_a * pcie);
void cie_mult3(const gs_vector3 * in, register const gs_matrix3 * mat,
- gs_vector3 * out);
+ gs_vector3 * out);
void cie_matrix_mult3(const gs_matrix3 *, const gs_matrix3 *,
- gs_matrix3 *);
+ gs_matrix3 *);
void cie_matrix_transpose3(const gs_matrix3 *, gs_matrix3 *);
#endif /* gscie_INCLUDED */
diff --git a/gs/base/gsciemap.c b/gs/base/gsciemap.c
index d91b5b3c5..b2694cf45 100644
--- a/gs/base/gsciemap.c
+++ b/gs/base/gsciemap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,13 +41,13 @@
((vin) <= (pcache)->vecs.params.base ? 0 :\
(vin) >= (pcache)->vecs.params.limit ? (gx_cie_cache_size - 1) << (fbits) :\
cie_cached_product2int( ((vin) - (pcache)->vecs.params.base),\
- (pcache)->vecs.params.factor, fbits ))
+ (pcache)->vecs.params.factor, fbits ))
#define LOOKUP_ENTRY_(vin, pcache)\
(&(pcache)->vecs.values[(int)LOOKUP_INDEX(vin, pcache, 0)])
#ifdef DEBUG
static cie_cached_value
LOOKUP_INDEX(cie_cached_value vin, const gx_cie_vector_cache *pcache,
- int fbits)
+ int fbits)
{
return LOOKUP_INDEX_(vin, pcache, fbits);
}
@@ -75,21 +75,21 @@ LOOKUP_ENTRY(cie_cached_value vin, const gx_cie_vector_cache *pcache)
/* Forward references */
static void cie_lookup_mult3(cie_cached_vector3 *,
- const gx_cie_vector_cache3_t *);
+ const gx_cie_vector_cache3_t *);
#ifdef DEBUG
static void
cie_lookup_map3(cie_cached_vector3 * pvec,
- const gx_cie_vector_cache3_t * pc, const char *cname)
+ const gx_cie_vector_cache3_t * pc, const char *cname)
{
if_debug5('c', "[c]lookup %s 0x%lx [%g %g %g]\n",
- (const char *)cname, (ulong) pc,
- cie_cached2float(pvec->u), cie_cached2float(pvec->v),
- cie_cached2float(pvec->w));
+ (const char *)cname, (ulong) pc,
+ cie_cached2float(pvec->u), cie_cached2float(pvec->v),
+ cie_cached2float(pvec->w));
cie_lookup_mult3(pvec, pc);
if_debug3('c', " =[%g %g %g]\n",
- cie_cached2float(pvec->u), cie_cached2float(pvec->v),
- cie_cached2float(pvec->w));
+ cie_cached2float(pvec->u), cie_cached2float(pvec->v),
+ cie_cached2float(pvec->w));
}
#else
# define cie_lookup_map3(pvec, pc, cname) cie_lookup_mult3(pvec, pc)
@@ -123,7 +123,7 @@ check_cie_range( const gs_color_space * pcs )
return(check_range(&(pcs->params.abc->RangeABC.ranges[0]), 3));
case gs_color_space_index_CIEA:
return(check_range(&(pcs->params.a->RangeA), 1));
- default:
+ default:
return true;
}
}
@@ -140,7 +140,7 @@ get_cie_range( const gs_color_space * pcs )
return(&(pcs->params.abc->RangeABC.ranges[0]));
case gs_color_space_index_CIEA:
return(&(pcs->params.a->RangeA));
- default:
+ default:
return NULL;
}
}
@@ -152,39 +152,38 @@ rescale_input_color(gs_range *ranges, int num_colorants, gs_client_color *src,
int k;
for (k = 0; k < num_colorants; k++) {
- des->paint.values[k] =
+ des->paint.values[k] =
(src->paint.values[k]-ranges[k].rmin)/
(ranges[k].rmax-ranges[k].rmin);
}
}
-
/*
* Test whether a CIE rendering has been defined; ensure that the joint
* caches are loaded. Note that the procedure may return 1 if no rendering
* has been defined. The 'cie_to_xyz' flag indicates that we don't need a CRD
*/
-static inline int
+static inline int
gx_cie_check_rendering_inline(const gs_color_space * pcs, frac * pconc, const gs_imager_state * pis)
{
if (pis->cie_render == 0 && !pis->cie_to_xyz) {
- /* No rendering has been defined yet: return black. */
- pconc[0] = pconc[1] = pconc[2] = frac_0;
- return 1;
+ /* No rendering has been defined yet: return black. */
+ pconc[0] = pconc[1] = pconc[2] = frac_0;
+ return 1;
}
if (pis->cie_joint_caches->status == CIE_JC_STATUS_COMPLETED) {
- if (pis->cie_joint_caches->cspace_id != pcs->id)
- pis->cie_joint_caches->status = CIE_JC_STATUS_BUILT;
+ if (pis->cie_joint_caches->cspace_id != pcs->id)
+ pis->cie_joint_caches->status = CIE_JC_STATUS_BUILT;
}
if (pis->cie_joint_caches->status != CIE_JC_STATUS_COMPLETED) {
- int code = gs_cie_jc_complete(pis, pcs);
+ int code = gs_cie_jc_complete(pis, pcs);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
-int
+int
gx_cie_check_rendering(const gs_color_space * pcs, frac * pconc, const gs_imager_state * pis)
{
return gx_cie_check_rendering_inline(pcs, pconc, pis);
@@ -206,8 +205,8 @@ gx_ciedefg_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *m
(*ppcs_icc)->base_space = palt_cs;
rc_increment_cs(palt_cs);
(*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0);
- code = gsicc_create_fromdefg(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
- &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
+ code = gsicc_create_fromdefg(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
+ &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
abc_caches, lmn_caches, defg_caches);
gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data);
(*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEFG;
@@ -217,16 +216,16 @@ gx_ciedefg_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *m
int
gx_remap_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
gs_color_space *pcs_icc;
int code, i;
gs_client_color scale_pc;
if_debug4('c', "[c]remap CIEDEFG [%g %g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2], pc->paint.values[3]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2], pc->paint.values[3]);
/* If we are comming in here then we have not completed
the conversion of the DEFG space to an ICC type. We
will finish that process now. */
@@ -246,7 +245,7 @@ gx_remap_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
code = (pcs_icc->type->remap_color)(&scale_pc,pcs_icc,pdc,pis,dev,select);
/* Save unscaled data for high level device (e.g. pdfwrite) */
for (i = 0; i < 4; i++)
- pdc->ccolor.paint.values[i] = pc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pc->paint.values[i];
pdc->ccolor_valid = true;
return(code);
}
@@ -254,7 +253,7 @@ gx_remap_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
/* Render a CIEBasedDEFG color. */
int
gx_concretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
const gs_cie_defg *pcie = pcs->params.defg;
int code;
@@ -262,8 +261,8 @@ gx_concretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
gs_client_color scale_pc;
if_debug4('c', "[c]concretize DEFG [%g %g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2], pc->paint.values[3]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2], pc->paint.values[3]);
/* If we are comming in here then we have not completed
the conversion of the DEFG space to an ICC type. We
will finish that process now. */
@@ -286,7 +285,7 @@ gx_concretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
/* Used for when we have to mash entire transform to CIEXYZ */
int
gx_psconcretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis)
+ frac * pconc, const gs_imager_state * pis)
{
const gs_cie_a *pcie = pcs->params.a;
cie_cached_value a = float2cie_cached(pc->paint.values[0]);
@@ -296,15 +295,15 @@ gx_psconcretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
if_debug1('c', "[c]concretize CIEA %g\n", pc->paint.values[0]);
code = gx_cie_check_rendering_inline(pcs, pconc, pis);
if (code < 0)
- return code;
+ return code;
if (code == 1)
- return 0;
+ return 0;
/* Apply DecodeA and MatrixA. */
if (!pis->cie_joint_caches->skipDecodeABC)
- vlmn = *LOOKUP_ENTRY(a, &pcie->caches.DecodeA);
+ vlmn = *LOOKUP_ENTRY(a, &pcie->caches.DecodeA);
else
- vlmn.u = vlmn.v = vlmn.w = a;
+ vlmn.u = vlmn.v = vlmn.w = a;
GX_CIE_REMAP_FINISH(vlmn, pconc, pis, pcs);
return 0;
}
@@ -312,27 +311,27 @@ gx_psconcretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
/* Used for when we have to mash entire transform to CIEXYZ */
int
gx_psconcretize_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis)
+ frac * pconc, const gs_imager_state * pis)
{
const gs_cie_abc *pcie = pcs->params.abc;
cie_cached_vector3 vec3;
int code;
if_debug3('c', "[c]concretize CIEABC [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
code = gx_cie_check_rendering_inline(pcs, pconc, pis);
if (code < 0)
- return code;
+ return code;
if (code == 1)
- return 0;
+ return 0;
vec3.u = float2cie_cached(pc->paint.values[0]);
vec3.v = float2cie_cached(pc->paint.values[1]);
vec3.w = float2cie_cached(pc->paint.values[2]);
if (!pis->cie_joint_caches->skipDecodeABC)
- cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
- "Decode/MatrixABC");
+ cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
+ "Decode/MatrixABC");
GX_CIE_REMAP_FINISH(vec3, pconc, pis, pcs);
return 0;
}
@@ -340,7 +339,7 @@ gx_psconcretize_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
/* Used for when we have to mash entire transform to CIEXYZ */
int
gx_psconcretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis)
+ frac * pconc, const gs_imager_state * pis)
{
const gs_cie_defg *pcie = pcs->params.defg;
int i;
@@ -350,51 +349,51 @@ gx_psconcretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
int code;
if_debug4('c', "[c]concretize DEFG [%g %g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2], pc->paint.values[3]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2], pc->paint.values[3]);
code = gx_cie_check_rendering_inline(pcs, pconc, pis);
if (code < 0)
- return code;
+ return code;
if (code == 1)
- return 0;
+ return 0;
/*
* Apply DecodeDEFG, including restriction to RangeHIJK and scaling to
* the Table dimensions.
*/
for (i = 0; i < 4; ++i) {
- int tdim = pcie->Table.dims[i] - 1;
- double factor = pcie->caches_defg.DecodeDEFG[i].floats.params.factor;
- double v0 = pc->paint.values[i];
- const gs_range *const rangeDEFG = &pcie->RangeDEFG.ranges[i];
- double value =
- (v0 < rangeDEFG->rmin ? 0.0 : factor *
- (v0 > rangeDEFG->rmax ? rangeDEFG->rmax - rangeDEFG->rmin :
- v0 - rangeDEFG->rmin ));
- int vi = (int)value;
- double vf = value - vi;
- double v = pcie->caches_defg.DecodeDEFG[i].floats.values[vi];
-
- if (vf != 0 && vi < factor)
- v += vf *
- (pcie->caches_defg.DecodeDEFG[i].floats.values[vi + 1] - v);
- v = (v < 0 ? 0 : v > tdim ? tdim : v);
- hijk[i] = float2fixed(v);
+ int tdim = pcie->Table.dims[i] - 1;
+ double factor = pcie->caches_defg.DecodeDEFG[i].floats.params.factor;
+ double v0 = pc->paint.values[i];
+ const gs_range *const rangeDEFG = &pcie->RangeDEFG.ranges[i];
+ double value =
+ (v0 < rangeDEFG->rmin ? 0.0 : factor *
+ (v0 > rangeDEFG->rmax ? rangeDEFG->rmax - rangeDEFG->rmin :
+ v0 - rangeDEFG->rmin ));
+ int vi = (int)value;
+ double vf = value - vi;
+ double v = pcie->caches_defg.DecodeDEFG[i].floats.values[vi];
+
+ if (vf != 0 && vi < factor)
+ v += vf *
+ (pcie->caches_defg.DecodeDEFG[i].floats.values[vi + 1] - v);
+ v = (v < 0 ? 0 : v > tdim ? tdim : v);
+ hijk[i] = float2fixed(v);
}
/* Apply Table. */
gx_color_interpolate_linear(hijk, &pcie->Table, abc);
#define SCALE_TO_RANGE(range, frac) ( \
float2cie_cached(((range).rmax - (range).rmin) * frac2float(frac) + \
- (range).rmin) \
+ (range).rmin) \
)
/* Scale the abc[] frac values to RangeABC cie_cached result */
- vec3.u = SCALE_TO_RANGE(pcie->RangeABC.ranges[0], abc[0]);
- vec3.v = SCALE_TO_RANGE(pcie->RangeABC.ranges[1], abc[1]);
- vec3.w = SCALE_TO_RANGE(pcie->RangeABC.ranges[2], abc[2]);
+ vec3.u = SCALE_TO_RANGE(pcie->RangeABC.ranges[0], abc[0]);
+ vec3.v = SCALE_TO_RANGE(pcie->RangeABC.ranges[1], abc[1]);
+ vec3.w = SCALE_TO_RANGE(pcie->RangeABC.ranges[2], abc[2]);
/* Apply DecodeABC and MatrixABC. */
if (!pis->cie_joint_caches->skipDecodeABC)
- cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
- "Decode/MatrixABC");
+ cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
+ "Decode/MatrixABC");
GX_CIE_REMAP_FINISH(vec3, pconc, pis, pcs);
return 0;
}
@@ -402,7 +401,7 @@ gx_psconcretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
/* Render a CIEBasedDEF color. */
int
gx_psconcretize_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis)
+ frac * pconc, const gs_imager_state * pis)
{
const gs_cie_def *pcie = pcs->params.def;
int i;
@@ -412,47 +411,47 @@ gx_psconcretize_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
int code;
if_debug3('c', "[c]concretize DEF [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
code = gx_cie_check_rendering_inline(pcs, pconc, pis);
if (code < 0)
- return code;
+ return code;
if (code == 1)
- return 0;
+ return 0;
/*
* Apply DecodeDEF, including restriction to RangeHIJ and scaling to
* the Table dimensions.
*/
for (i = 0; i < 3; ++i) {
- int tdim = pcie->Table.dims[i] - 1;
- double factor = pcie->caches_def.DecodeDEF[i].floats.params.factor;
- double v0 = pc->paint.values[i];
- const gs_range *const rangeDEF = &pcie->RangeDEF.ranges[i];
- double value =
- (v0 < rangeDEF->rmin ? 0.0 : factor *
- (v0 > rangeDEF->rmax ? rangeDEF->rmax - rangeDEF->rmin :
- v0 - rangeDEF->rmin ));
- int vi = (int)value;
- double vf = value - vi;
- double v = pcie->caches_def.DecodeDEF[i].floats.values[vi];
-
- if (vf != 0 && vi < factor)
- v += vf *
- (pcie->caches_def.DecodeDEF[i].floats.values[vi + 1] - v);
- v = (v < 0 ? 0 : v > tdim ? tdim : v);
- hij[i] = float2fixed(v);
+ int tdim = pcie->Table.dims[i] - 1;
+ double factor = pcie->caches_def.DecodeDEF[i].floats.params.factor;
+ double v0 = pc->paint.values[i];
+ const gs_range *const rangeDEF = &pcie->RangeDEF.ranges[i];
+ double value =
+ (v0 < rangeDEF->rmin ? 0.0 : factor *
+ (v0 > rangeDEF->rmax ? rangeDEF->rmax - rangeDEF->rmin :
+ v0 - rangeDEF->rmin ));
+ int vi = (int)value;
+ double vf = value - vi;
+ double v = pcie->caches_def.DecodeDEF[i].floats.values[vi];
+
+ if (vf != 0 && vi < factor)
+ v += vf *
+ (pcie->caches_def.DecodeDEF[i].floats.values[vi + 1] - v);
+ v = (v < 0 ? 0 : v > tdim ? tdim : v);
+ hij[i] = float2fixed(v);
}
/* Apply Table. */
gx_color_interpolate_linear(hij, &pcie->Table, abc);
/* Scale the abc[] frac values to RangeABC cie_cached result */
- vec3.u = SCALE_TO_RANGE(pcie->RangeABC.ranges[0], abc[0]);
- vec3.v = SCALE_TO_RANGE(pcie->RangeABC.ranges[1], abc[1]);
- vec3.w = SCALE_TO_RANGE(pcie->RangeABC.ranges[2], abc[2]);
+ vec3.u = SCALE_TO_RANGE(pcie->RangeABC.ranges[0], abc[0]);
+ vec3.v = SCALE_TO_RANGE(pcie->RangeABC.ranges[1], abc[1]);
+ vec3.w = SCALE_TO_RANGE(pcie->RangeABC.ranges[2], abc[2]);
/* Apply DecodeABC and MatrixABC. */
if (!pis->cie_joint_caches->skipDecodeABC)
- cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
- "Decode/MatrixABC");
+ cie_lookup_map3(&vec3 /* ABC => LMN */, &pcie->caches.DecodeABC,
+ "Decode/MatrixABC");
GX_CIE_REMAP_FINISH(vec3, pconc, pis, pcs);
return 0;
}
@@ -474,8 +473,8 @@ gx_ciedef_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *me
(*ppcs_icc)->base_space = palt_cs;
rc_increment_cs(palt_cs);
(*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0);
- code = gsicc_create_fromdef(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
- &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
+ code = gsicc_create_fromdef(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
+ &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
abc_caches, lmn_caches, def_caches);
gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data);
(*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEF;
@@ -486,16 +485,16 @@ gx_ciedef_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *me
int
gx_remap_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
gs_color_space *pcs_icc;
gs_client_color scale_pc;
int i,code;
if_debug3('c', "[c]remap CIEDEF [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
/* If we are comming in here then we have not completed
the conversion of the DEF space to an ICC type. We
will finish that process now. */
@@ -515,7 +514,7 @@ gx_remap_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
code = (pcs_icc->type->remap_color)(&scale_pc,pcs_icc,pdc,pis,dev,select);
/* Save unscaled data for high level device (e.g. pdfwrite) */
for (i = 0; i < 3; i++)
- pdc->ccolor.paint.values[i] = pc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pc->paint.values[i];
pdc->ccolor_valid = true;
return(code);
}
@@ -523,7 +522,7 @@ gx_remap_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
/* Render a CIEBasedDEF color. */
int
gx_concretize_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
const gs_cie_def *pcie = pcs->params.def;
int code;
@@ -531,8 +530,8 @@ gx_concretize_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
gs_client_color scale_pc;
if_debug3('c', "[c]concretize DEF [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
/* If we are comming in here then we have not completed
the conversion of the DEF space to an ICC type. We
will finish that process now. */
@@ -561,7 +560,7 @@ gx_cieabc_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, bool *islab,
int code = 0;
gs_color_space *palt_cs = pcs->base_space;
gx_cie_vector_cache *abc_caches = &(pcs->params.abc->caches.DecodeABC.caches[0]);
- gx_cie_scalar_cache *lmn_caches = &(pcs->params.abc->common.caches.DecodeLMN[0]);
+ gx_cie_scalar_cache *lmn_caches = &(pcs->params.abc->common.caches.DecodeLMN[0]);
/* build the ICC color space object */
code = gs_cspace_build_ICC(ppcs_icc, NULL, memory);
@@ -569,8 +568,8 @@ gx_cieabc_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, bool *islab,
(*ppcs_icc)->base_space = palt_cs;
rc_increment_cs(palt_cs);
(*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0);
- code = gsicc_create_fromabc(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
- &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
+ code = gsicc_create_fromabc(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
+ &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
abc_caches, lmn_caches, islab);
gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data);
(*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_ABC;
@@ -584,8 +583,8 @@ gx_cieabc_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, bool *islab,
/* needs to be efficient. */
int
gx_remap_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
gs_color_space *pcs_icc;
gs_client_color scale_pc;
@@ -593,8 +592,8 @@ gx_remap_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
int i,code;
if_debug3('c', "[c]remap CIEABC [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
/* If we are comming in here then we have not completed
the conversion of the ABC space to an ICC type. We
will finish that process now. */
@@ -602,7 +601,7 @@ gx_remap_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
gx_cieabc_to_icc(&pcs_icc, pcs, &islab, pis->memory->stable_memory);
} else {
pcs_icc = pcs->icc_equivalent;
- }
+ }
/* Rescale the input based upon the input range since profile is
created to remap this range from 0 to 1 */
if (check_range(&(pcs->params.abc->RangeABC.ranges[0]), 3)) {
@@ -614,7 +613,7 @@ gx_remap_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
code = (pcs_icc->type->remap_color)(&scale_pc,pcs_icc,pdc,pis,dev,select);
/* Save unscaled data for high level device (e.g. pdfwrite) */
for (i = 0; i < 3; i++)
- pdc->ccolor.paint.values[i] = pc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pc->paint.values[i];
pdc->ccolor_valid = true;
/* Now the icc remap */
return(code);
@@ -622,15 +621,15 @@ gx_remap_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
int
gx_concretize_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
gs_color_space *pcs_icc;
gs_client_color scale_pc;
bool islab;
if_debug3('c', "[c]concretize CIEABC [%g %g %g]\n",
- pc->paint.values[0], pc->paint.values[1],
- pc->paint.values[2]);
+ pc->paint.values[0], pc->paint.values[1],
+ pc->paint.values[2]);
/* If we are comming in here then we have not completed
the conversion of the ABC space to an ICC type. We
will finish that process now. */
@@ -665,8 +664,8 @@ gx_ciea_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *memo
(*ppcs_icc)->base_space = palt_cs;
rc_increment_cs(palt_cs);
(*ppcs_icc)->cmm_icc_profile_data = gsicc_profile_new(NULL, memory, NULL, 0);
- code = gsicc_create_froma(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
- &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
+ code = gsicc_create_froma(pcs, &((*ppcs_icc)->cmm_icc_profile_data->buffer),
+ &((*ppcs_icc)->cmm_icc_profile_data->buffer_size), memory,
a_cache, lmn_caches);
gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data);
(*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_A;
@@ -677,8 +676,8 @@ gx_ciea_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *memo
int
gx_remap_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
int code;
gs_color_space *pcs_icc;
@@ -712,7 +711,7 @@ gx_remap_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
/* Render a CIEBasedA color. */
int
gx_concretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
int code;
gs_color_space *pcs_icc;
@@ -741,7 +740,7 @@ gx_concretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
/* Call for cases where the equivalent icc color space needs to be set */
int
-gs_colorspace_set_icc_equivalent(gs_color_space *pcs, bool *islab,
+gs_colorspace_set_icc_equivalent(gs_color_space *pcs, bool *islab,
gs_memory_t *memory)
{
gs_color_space_index color_space_index = gs_color_space_get_index(pcs);
@@ -767,15 +766,15 @@ gs_colorspace_set_icc_equivalent(gs_color_space *pcs, bool *islab,
default:
/* do nothing. Sould never happen */
break;
- }
+ }
return(0);
}
/* Call the remap_finish procedure in the joint_caches structure. */
int
gx_cie_remap_finish(cie_cached_vector3 vec3, frac * pconc,
- const gs_imager_state * pis,
- const gs_color_space *pcs)
+ const gs_imager_state * pis,
+ const gs_color_space *pcs)
{
return pis->cie_joint_caches->remap_finish(vec3, pconc, pis, pcs);
}
@@ -785,8 +784,8 @@ gx_cie_remap_finish(cie_cached_vector3 vec3, frac * pconc,
/* this procedure is exported for the benefit of gsicc.c */
int
gx_cie_real_remap_finish(cie_cached_vector3 vec3, frac * pconc,
- const gs_imager_state * pis,
- const gs_color_space *pcs)
+ const gs_imager_state * pis,
+ const gs_color_space *pcs)
{
const gs_cie_render *pcrd = pis->cie_render;
const gx_cie_joint_caches *pjc = pis->cie_joint_caches;
@@ -795,116 +794,116 @@ gx_cie_real_remap_finish(cie_cached_vector3 vec3, frac * pconc,
/* Apply DecodeLMN, MatrixLMN(decode), and MatrixPQR. */
if (!pjc->skipDecodeLMN)
- cie_lookup_map3(&vec3 /* LMN => PQR */, &pjc->DecodeLMN,
- "Decode/MatrixLMN+MatrixPQR");
+ cie_lookup_map3(&vec3 /* LMN => PQR */, &pjc->DecodeLMN,
+ "Decode/MatrixLMN+MatrixPQR");
/* Apply TransformPQR, MatrixPQR', and MatrixLMN(encode). */
if (!pjc->skipPQR)
- cie_lookup_map3(&vec3 /* PQR => LMN */, &pjc->TransformPQR,
- "Transform/Matrix'PQR+MatrixLMN");
+ cie_lookup_map3(&vec3 /* PQR => LMN */, &pjc->TransformPQR,
+ "Transform/Matrix'PQR+MatrixLMN");
/* Apply EncodeLMN and MatrixABC(encode). */
if (!pjc->skipEncodeLMN)
- cie_lookup_map3(&vec3 /* LMN => ABC */, &pcrd->caches.EncodeLMN,
- "EncodeLMN+MatrixABC");
+ cie_lookup_map3(&vec3 /* LMN => ABC */, &pcrd->caches.EncodeLMN,
+ "EncodeLMN+MatrixABC");
/* MatrixABCEncode includes the scaling of the EncodeABC */
/* cache index. */
#define SET_TABC(i, t)\
BEGIN\
tabc[i] = cie_cached2int(vec3 /*ABC*/.t - pcrd->EncodeABC_base[i],\
- _cie_interpolate_bits);\
+ _cie_interpolate_bits);\
if ((uint)tabc[i] > (gx_cie_cache_size - 1) << _cie_interpolate_bits)\
- tabc[i] = (tabc[i] < 0 ? 0 :\
- (gx_cie_cache_size - 1) << _cie_interpolate_bits);\
+ tabc[i] = (tabc[i] < 0 ? 0 :\
+ (gx_cie_cache_size - 1) << _cie_interpolate_bits);\
END
SET_TABC(0, u);
SET_TABC(1, v);
SET_TABC(2, w);
#undef SET_TABC
if (table == 0) {
- /*
- * No further transformation.
- * The final mapping step includes both restriction to
- * the range [0..1] and conversion to fracs.
- */
+ /*
+ * No further transformation.
+ * The final mapping step includes both restriction to
+ * the range [0..1] and conversion to fracs.
+ */
#define EABC(i)\
cie_interpolate_fracs(pcrd->caches.EncodeABC[i].fixeds.fracs.values, tabc[i])
- pconc[0] = EABC(0);
- pconc[1] = EABC(1);
- pconc[2] = EABC(2);
+ pconc[0] = EABC(0);
+ pconc[1] = EABC(1);
+ pconc[2] = EABC(2);
#undef EABC
- return 3;
+ return 3;
} else {
- /*
- * Use the RenderTable.
- */
- int m = pcrd->RenderTable.lookup.m;
+ /*
+ * Use the RenderTable.
+ */
+ int m = pcrd->RenderTable.lookup.m;
#define RT_LOOKUP(j, i) pcrd->caches.RenderTableT[j].fracs.values[i]
#ifdef CIE_RENDER_TABLE_INTERPOLATE
- /*
- * The final mapping step includes restriction to the
- * ranges [0..dims[c]] as ints with interpolation bits.
- */
- fixed rfix[3];
- const int s = _fixed_shift - _cie_interpolate_bits;
+ /*
+ * The final mapping step includes restriction to the
+ * ranges [0..dims[c]] as ints with interpolation bits.
+ */
+ fixed rfix[3];
+ const int s = _fixed_shift - _cie_interpolate_bits;
#define EABC(i)\
cie_interpolate_fracs(pcrd->caches.EncodeABC[i].fixeds.ints.values, tabc[i])
#define FABC(i, s)\
((s) > 0) ? (EABC(i) << (s)) : (EABC(i) >> -(s))
- rfix[0] = FABC(0, s);
- rfix[1] = FABC(1, s);
- rfix[2] = FABC(2, s);
+ rfix[0] = FABC(0, s);
+ rfix[1] = FABC(1, s);
+ rfix[2] = FABC(2, s);
#undef FABC
#undef EABC
- if_debug6('c', "[c]ABC=%g,%g,%g => iabc=%g,%g,%g\n",
- cie_cached2float(vec3.u), cie_cached2float(vec3.v),
- cie_cached2float(vec3.w), fixed2float(rfix[0]),
- fixed2float(rfix[1]), fixed2float(rfix[2]));
- gx_color_interpolate_linear(rfix, &pcrd->RenderTable.lookup,
- pconc);
- if_debug3('c', "[c] interpolated => %g,%g,%g\n",
- frac2float(pconc[0]), frac2float(pconc[1]),
- frac2float(pconc[2]));
- if (!pcrd->caches.RenderTableT_is_identity) {
- /* Map the interpolated values. */
+ if_debug6('c', "[c]ABC=%g,%g,%g => iabc=%g,%g,%g\n",
+ cie_cached2float(vec3.u), cie_cached2float(vec3.v),
+ cie_cached2float(vec3.w), fixed2float(rfix[0]),
+ fixed2float(rfix[1]), fixed2float(rfix[2]));
+ gx_color_interpolate_linear(rfix, &pcrd->RenderTable.lookup,
+ pconc);
+ if_debug3('c', "[c] interpolated => %g,%g,%g\n",
+ frac2float(pconc[0]), frac2float(pconc[1]),
+ frac2float(pconc[2]));
+ if (!pcrd->caches.RenderTableT_is_identity) {
+ /* Map the interpolated values. */
#define frac2cache_index(v) frac2bits(v, gx_cie_log2_cache_size)
- pconc[0] = RT_LOOKUP(0, frac2cache_index(pconc[0]));
- pconc[1] = RT_LOOKUP(1, frac2cache_index(pconc[1]));
- pconc[2] = RT_LOOKUP(2, frac2cache_index(pconc[2]));
- if (m > 3)
- pconc[3] = RT_LOOKUP(3, frac2cache_index(pconc[3]));
+ pconc[0] = RT_LOOKUP(0, frac2cache_index(pconc[0]));
+ pconc[1] = RT_LOOKUP(1, frac2cache_index(pconc[1]));
+ pconc[2] = RT_LOOKUP(2, frac2cache_index(pconc[2]));
+ if (m > 3)
+ pconc[3] = RT_LOOKUP(3, frac2cache_index(pconc[3]));
#undef frac2cache_index
- }
+ }
#else /* !CIE_RENDER_TABLE_INTERPOLATE */
- /*
- * The final mapping step includes restriction to the ranges
- * [0..dims[c]], plus scaling of the indices in the strings.
- */
+ /*
+ * The final mapping step includes restriction to the ranges
+ * [0..dims[c]], plus scaling of the indices in the strings.
+ */
#define RI(i)\
pcrd->caches.EncodeABC[i].ints.values[tabc[i] >> _cie_interpolate_bits]
- int ia = RI(0);
- int ib = RI(1); /* pre-multiplied by m * NC */
- int ic = RI(2); /* pre-multiplied by m */
- const byte *prtc = table[ia].data + ib + ic;
-
- /* (*pcrd->RenderTable.T)(prtc, m, pcrd, pconc); */
-
- if_debug6('c', "[c]ABC=%g,%g,%g => iabc=%d,%d,%d\n",
- cie_cached2float(vec3.u), cie_cached2float(vec3.v),
- cie_cached2float(vec3.w), ia, ib, ic);
- if (pcrd->caches.RenderTableT_is_identity) {
- pconc[0] = byte2frac(prtc[0]);
- pconc[1] = byte2frac(prtc[1]);
- pconc[2] = byte2frac(prtc[2]);
- if (m > 3)
- pconc[3] = byte2frac(prtc[3]);
- } else {
+ int ia = RI(0);
+ int ib = RI(1); /* pre-multiplied by m * NC */
+ int ic = RI(2); /* pre-multiplied by m */
+ const byte *prtc = table[ia].data + ib + ic;
+
+ /* (*pcrd->RenderTable.T)(prtc, m, pcrd, pconc); */
+
+ if_debug6('c', "[c]ABC=%g,%g,%g => iabc=%d,%d,%d\n",
+ cie_cached2float(vec3.u), cie_cached2float(vec3.v),
+ cie_cached2float(vec3.w), ia, ib, ic);
+ if (pcrd->caches.RenderTableT_is_identity) {
+ pconc[0] = byte2frac(prtc[0]);
+ pconc[1] = byte2frac(prtc[1]);
+ pconc[2] = byte2frac(prtc[2]);
+ if (m > 3)
+ pconc[3] = byte2frac(prtc[3]);
+ } else {
#if gx_cie_log2_cache_size == 8
# define byte2cache_index(b) (b)
#else
@@ -916,18 +915,18 @@ gx_cie_real_remap_finish(cie_cached_vector3 vec3, frac * pconc,
# define byte2cache_index(b) ((b) >> (8 - gx_cie_log2_cache_size))
# endif
#endif
- pconc[0] = RT_LOOKUP(0, byte2cache_index(prtc[0]));
- pconc[1] = RT_LOOKUP(1, byte2cache_index(prtc[1]));
- pconc[2] = RT_LOOKUP(2, byte2cache_index(prtc[2]));
- if (m > 3)
- pconc[3] = RT_LOOKUP(3, byte2cache_index(prtc[3]));
+ pconc[0] = RT_LOOKUP(0, byte2cache_index(prtc[0]));
+ pconc[1] = RT_LOOKUP(1, byte2cache_index(prtc[1]));
+ pconc[2] = RT_LOOKUP(2, byte2cache_index(prtc[2]));
+ if (m > 3)
+ pconc[3] = RT_LOOKUP(3, byte2cache_index(prtc[3]));
#undef byte2cache_index
- }
+ }
#endif /* !CIE_RENDER_TABLE_INTERPOLATE */
#undef RI
#undef RT_LOOKUP
- return m;
+ return m;
}
}
@@ -943,8 +942,8 @@ float2frac_clamp(floatp x)
}
int
gx_cie_xyz_remap_finish(cie_cached_vector3 vec3, frac * pconc,
- const gs_imager_state * pis,
- const gs_color_space *pcs)
+ const gs_imager_state * pis,
+ const gs_color_space *pcs)
{
const gx_cie_joint_caches *pjc = pis->cie_joint_caches;
@@ -953,9 +952,8 @@ gx_cie_xyz_remap_finish(cie_cached_vector3 vec3, frac * pconc,
* vec3 is LMN values. Just apply DecodeLMN/MatrixLMN.
*/
if (!pjc->skipDecodeLMN)
- cie_lookup_map3(&vec3 /* LMN => XYZ */, &pjc->DecodeLMN,
- "Decode/MatrixLMN");
-
+ cie_lookup_map3(&vec3 /* LMN => XYZ */, &pjc->DecodeLMN,
+ "Decode/MatrixLMN");
pconc[0] = float2frac_clamp(cie_cached2float(vec3.u));
pconc[1] = float2frac_clamp(cie_cached2float(vec3.v));
@@ -966,7 +964,7 @@ gx_cie_xyz_remap_finish(cie_cached_vector3 vec3, frac * pconc,
/* Look up 3 values in a cache, with cached post-multiplication. */
static void
cie_lookup_mult3(cie_cached_vector3 * pvec,
- const gx_cie_vector_cache3_t * pc)
+ const gx_cie_vector_cache3_t * pc)
{
#ifdef CIE_CACHE_INTERPOLATE
cie_cached_value u, v, w;
@@ -982,13 +980,13 @@ cie_lookup_mult3(cie_cached_vector3 * pvec,
((ftemp = float_rshift(i, _cie_interpolate_bits)), ftemp - (int)ftemp))
#endif
- /*
- * Defining a macro for the entire component calculation would
- * minimize source code, but it would make the result impossible
- * to trace or debug. We use smaller macros instead, and run
- * the usual risks associated with having 3 copies of the code.
- * Note that pvec and pc are free variables in these macros.
- */
+ /*
+ * Defining a macro for the entire component calculation would
+ * minimize source code, but it would make the result impossible
+ * to trace or debug. We use smaller macros instead, and run
+ * the usual risks associated with having 3 copies of the code.
+ * Note that pvec and pc are free variables in these macros.
+ */
#define I_IN_RANGE(j, n)\
(pvec->n >= pc->interpolation_ranges[j].rmin &&\
@@ -1001,51 +999,51 @@ cie_lookup_mult3(cie_cached_vector3 * pvec,
(i >= (gx_cie_cache_size - 1) << _cie_interpolate_bits ? p : p + 1)
if (I_IN_RANGE(0, u)) {
- cie_cached_value i = I_INDEX(0, u);
- const cie_cached_vector3 *p = I_ENTRY(i, 0);
- const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
-
- if_debug0('C', "[c]Interpolating u.\n");
- u = LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
- v = LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
- w = LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
+ cie_cached_value i = I_INDEX(0, u);
+ const cie_cached_vector3 *p = I_ENTRY(i, 0);
+ const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
+
+ if_debug0('C', "[c]Interpolating u.\n");
+ u = LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
+ v = LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
+ w = LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
} else {
- const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->u, &pc->caches[0]);
+ const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->u, &pc->caches[0]);
- if_debug0('C', "[c]Not interpolating u.\n");
- u = p->u, v = p->v, w = p->w;
+ if_debug0('C', "[c]Not interpolating u.\n");
+ u = p->u, v = p->v, w = p->w;
}
if (I_IN_RANGE(1, v)) {
- cie_cached_value i = I_INDEX(1, v);
- const cie_cached_vector3 *p = I_ENTRY(i, 1);
- const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
-
- if_debug0('C', "[c]Interpolating v.\n");
- u += LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
- v += LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
- w += LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
+ cie_cached_value i = I_INDEX(1, v);
+ const cie_cached_vector3 *p = I_ENTRY(i, 1);
+ const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
+
+ if_debug0('C', "[c]Interpolating v.\n");
+ u += LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
+ v += LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
+ w += LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
} else {
- const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->v, &pc->caches[1]);
+ const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->v, &pc->caches[1]);
- if_debug0('C', "[c]Not interpolating v.\n");
- u += p->u, v += p->v, w += p->w;
+ if_debug0('C', "[c]Not interpolating v.\n");
+ u += p->u, v += p->v, w += p->w;
}
if (I_IN_RANGE(2, w)) {
- cie_cached_value i = I_INDEX(2, w);
- const cie_cached_vector3 *p = I_ENTRY(i, 2);
- const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
-
- if_debug0('C', "[c]Interpolating w.\n");
- u += LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
- v += LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
- w += LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
+ cie_cached_value i = I_INDEX(2, w);
+ const cie_cached_vector3 *p = I_ENTRY(i, 2);
+ const cie_cached_vector3 *p1 = I_ENTRY1(i, p);
+
+ if_debug0('C', "[c]Interpolating w.\n");
+ u += LOOKUP_INTERPOLATE_BETWEEN(p->u, p1->u, i);
+ v += LOOKUP_INTERPOLATE_BETWEEN(p->v, p1->v, i);
+ w += LOOKUP_INTERPOLATE_BETWEEN(p->w, p1->w, i);
} else {
- const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->w, &pc->caches[2]);
+ const cie_cached_vector3 *p = LOOKUP_ENTRY(pvec->w, &pc->caches[2]);
- if_debug0('C', "[c]Not interpolating w.\n");
- u += p->u, v += p->v, w += p->w;
+ if_debug0('C', "[c]Not interpolating w.\n");
+ u += p->u, v += p->v, w += p->w;
}
#undef I_IN_RANGE
diff --git a/gs/base/gscindex.h b/gs/base/gscindex.h
index 6a75f414a..31bac7b70 100644
--- a/gs/base/gscindex.h
+++ b/gs/base/gscindex.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,40 +44,40 @@
* few instances in which the client would need to replace them.
*/
extern int gs_cspace_build_Indexed(
- gs_color_space ** ppcspace,
- gs_color_space * pbase_cspace,
- uint num_entries,
- const gs_const_string * ptbl,
- gs_memory_t * pmem
- );
+ gs_color_space ** ppcspace,
+ gs_color_space * pbase_cspace,
+ uint num_entries,
+ const gs_const_string * ptbl,
+ gs_memory_t * pmem
+ );
/* Return the number of entries in the palette of an indexed color space. */
extern int gs_cspace_indexed_num_entries(
- const gs_color_space * pcspace
- );
+ const gs_color_space * pcspace
+ );
/* In the case of a procedure-based indexed color space, get a pointer to */
/* the array of cached values. */
extern float *gs_cspace_indexed_value_array(
- const gs_color_space * pcspace
- );
+ const gs_color_space * pcspace
+ );
/* Set the lookup procedure to be used for an Indexed color space. */
extern int gs_cspace_indexed_set_proc(
- gs_color_space * pcspace,
- int (*proc) (const gs_color_space *, int, float *)
- );
+ gs_color_space * pcspace,
+ int (*proc) (const gs_color_space *, int, float *)
+ );
/* Look up an index in an Indexed color space. */
int gs_cspace_indexed_lookup(const gs_color_space *, int,
- gs_client_color *);
+ gs_client_color *);
/* Look up an index in an Indexed color space. Return as a byte */
int gs_cspace_indexed_lookup_bytes(const gs_color_space *pcs, float index_float,
- unsigned char *output);
+ unsigned char *output);
/* Look up an index in an Indexed color space. Return as a frac */
int gs_cspace_indexed_lookup_frac(const gs_color_space *pcs, float index_float,
- frac *output);
+ frac *output);
#endif /* gscindex_INCLUDED */
diff --git a/gs/base/gsclipsr.c b/gs/base/gsclipsr.c
index 1c2dd7705..171c41622 100644
--- a/gs/base/gsclipsr.c
+++ b/gs/base/gsclipsr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,8 +36,8 @@ rc_free_clip_stack(gs_memory_t * mem, void *vstack, client_name_t cname)
if (stack->rc.ref_count <= 1 ) {
gx_clip_path *pcpath = stack->clip_path;
- gs_free_object(stack->rc.memory, stack, cname);
- gx_cpath_free(pcpath, "rc_free_clip_stack");
+ gs_free_object(stack->rc.memory, stack, cname);
+ gx_cpath_free(pcpath, "rc_free_clip_stack");
}
}
@@ -47,15 +47,15 @@ gs_clipsave(gs_state *pgs)
{
gs_memory_t *mem = pgs->memory;
gx_clip_path *copy =
- gx_cpath_alloc_shared(pgs->clip_path, mem, "gs_clipsave(clip_path)");
+ gx_cpath_alloc_shared(pgs->clip_path, mem, "gs_clipsave(clip_path)");
gx_clip_stack_t *stack =
- gs_alloc_struct(mem, gx_clip_stack_t, &st_clip_stack,
- "gs_clipsave(stack)");
+ gs_alloc_struct(mem, gx_clip_stack_t, &st_clip_stack,
+ "gs_clipsave(stack)");
if (copy == 0 || stack == 0) {
- gs_free_object(mem, stack, "gs_clipsave(stack)");
- gs_free_object(mem, copy, "gs_clipsave(clip_path)");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, stack, "gs_clipsave(stack)");
+ gs_free_object(mem, copy, "gs_clipsave(clip_path)");
+ return_error(gs_error_VMerror);
}
rc_init_free(stack, mem, 1, rc_free_clip_stack);
stack->clip_path = copy;
@@ -71,23 +71,23 @@ gs_cliprestore(gs_state *pgs)
gx_clip_stack_t *stack = pgs->clip_stack;
if (stack) {
- gx_clip_stack_t *next = stack->next;
- gx_clip_path *pcpath = stack->clip_path;
- int code;
+ gx_clip_stack_t *next = stack->next;
+ gx_clip_path *pcpath = stack->clip_path;
+ int code;
- if (stack->rc.ref_count == 1) {
- /* Use assign_free rather than assign_preserve. */
- gs_free_object(stack->rc.memory, stack, "cliprestore");
- code = gx_cpath_assign_free(pgs->clip_path, pcpath);
- } else {
- code = gx_cpath_assign_preserve(pgs->clip_path, pcpath);
- if (code < 0)
- return code;
- --(stack->rc.ref_count);
- }
- pgs->clip_stack = next;
- return code;
+ if (stack->rc.ref_count == 1) {
+ /* Use assign_free rather than assign_preserve. */
+ gs_free_object(stack->rc.memory, stack, "cliprestore");
+ code = gx_cpath_assign_free(pgs->clip_path, pcpath);
+ } else {
+ code = gx_cpath_assign_preserve(pgs->clip_path, pcpath);
+ if (code < 0)
+ return code;
+ --(stack->rc.ref_count);
+ }
+ pgs->clip_stack = next;
+ return code;
} else {
- return gx_cpath_assign_preserve(pgs->clip_path, pgs->saved->clip_path);
+ return gx_cpath_assign_preserve(pgs->clip_path, pgs->saved->clip_path);
}
}
diff --git a/gs/base/gsclipsr.h b/gs/base/gsclipsr.h
index 20c8f5b5e..e7d57a1f5 100644
--- a/gs/base/gsclipsr.h
+++ b/gs/base/gsclipsr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscms.h b/gs/base/gscms.h
index 3908c043f..c4c030c4b 100644
--- a/gs/base/gscms.h
+++ b/gs/base/gscms.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,13 +27,13 @@
#define ICC_MAX_CHANNELS 15
/* Define the preferred size of the output by the CMS */
-/* This can be different than the size of gx_color_value
+/* This can be different than the size of gx_color_value
which can range between 8 and 16. Here we can only
have 8 or 16 bits */
typedef unsigned short icc_output_type;
-#define icc_byte_count sizeof(icc_output_type)
+#define icc_byte_count sizeof(icc_output_type)
#define icc_bits_count (icc_byte_count * 8)
#define icc_max_color_value ((gx_color_value)((1L << icc_bits_count) - 1))
#define icc_value_to_byte(cv)\
@@ -83,7 +83,7 @@ typedef struct gsicc_bufferdesc_s {
int plane_stride;
int row_stride;
int num_rows;
- int pixels_per_row;
+ int pixels_per_row;
} gsicc_bufferdesc_t;
/* Enumerate the ICC rendering intents */
@@ -103,7 +103,7 @@ typedef enum {
BP_OFF,
} gsicc_black_point_comp_t;
-/* Used so that we can specify if we want to link with Device input color spaces
+/* Used so that we can specify if we want to link with Device input color spaces
during the link creation process. For the DeviceN case, the DeviceN profile
must match the DeviceN profile in colorant order and number of colorants.
Also, used to indicate if the profile matches one of the default profiles in
@@ -138,8 +138,8 @@ typedef enum {
unsigned char num_comps; /* number of device dependent values */\
unsigned char num_comps_out; /* usually 3 but could be more if device link type */\
bool islab; /* Needed since we want to detect this to avoid */\
- /* expensive decode on LAB images. Is true */\
- /* if PDF color space is \Lab */\
+ /* expensive decode on LAB images. Is true */\
+ /* if PDF color space is \Lab */\
gsicc_profile_t default_match; /* Used for detecting a match to a default space */\
gsicc_colorbuffer_t data_cs; /* The data color space of the profile (not the PCS) */\
gs_range_icc_t Range;\
@@ -148,7 +148,7 @@ typedef enum {
int devicen_permute[ICC_MAX_CHANNELS]; /* Permutation vector for deviceN laydown order */\
bool devicen_permute_needed; /* Check if we need to permute the DeviceN values */\
int buffer_size /* size of ICC profile buffer */
-
+
/* A subset of the profile information which is used when writing and reading
* out to the c-list
*/
@@ -180,13 +180,13 @@ struct cmm_profile_s {
gx_device *dev; /* A pointer to the clist device in which the ICC data may be contained */
gsicc_namelist_t *spotnames; /* Only used with NCLR ICC input profiles with named color tag */
void *profile_handle; /* The profile handle */
- rc_header rc; /* Reference count. So we know when to free */
+ rc_header rc; /* Reference count. So we know when to free */
int name_length; /* Length of file name */
char *name; /* Name of file name (if there is one) where profile is found.
- * If it was embedded in the stream, there will not be a file
- * name. This is primarily here for the system profiles, and
- * so that we avoid resetting them everytime the user params
- * are reloaded. */
+ * If it was embedded in the stream, there will not be a file
+ * name. This is primarily here for the system profiles, and
+ * so that we avoid resetting them everytime the user params
+ * are reloaded. */
gs_memory_t *memory; /* In case we have some in non-gc and some in gc memory */
};
@@ -197,13 +197,13 @@ typedef struct cmm_profile_s cmm_profile_t;
/* A linked list structure for storing profiles in a table in which we
can store and refer to from the clist and also when creating icc profiles
- from ps object. Right now it is not clear to me if we really need a
+ from ps object. Right now it is not clear to me if we really need a
cache in the traditional sense or a list since I believe the number of entries will
in general be very small (i.e. there will not be at MOST more than 2 to 3 internal
ICC profiles in a file). The default GRAY, RGB, and CMYK profiles are not
stored here but are maintained in the ICC manager. This is for profiles
that are in the content and for profiles we generate from PS and PDF CIE (NonICC)
- color spaces.
+ color spaces.
*/
typedef struct gsicc_profile_entry_s gsicc_profile_entry_t;
@@ -223,7 +223,7 @@ typedef struct gsicc_profile_cache_s {
} gsicc_profile_cache_t;
/* These are the types that we can potentially have linked together by the CMS.
- * If the CMS does not have understanding of PS color space types, then we
+ * If the CMS does not have understanding of PS color space types, then we
* will need to convert them to an ICC type. */
typedef enum {
DEVICETYPE,
@@ -240,7 +240,7 @@ typedef enum {
typedef struct gsicc_link_s gsicc_link_t;
typedef struct gsicc_hashlink_s {
- int64_t link_hashcode;
+ int64_t link_hashcode;
int64_t src_hash;
int64_t des_hash;
int64_t rend_hash;
@@ -260,7 +260,6 @@ struct gsicc_link_s {
bool valid; /* true once link is completely built and usable */
};
-
/* ICC Cache. The size of the cache is limited by max_memory_size.
* Links are added if there is sufficient memory and if the number
* of links does not exceed a (soft) limit.
@@ -289,7 +288,7 @@ typedef struct gsicc_link_cache_s {
* in the code where the DeviceN colors are processed. If
* there is no ICC color management of the DeviceN colors
* and the DeviceN colors are NOT the native colors
- * for the device, then the colors will be transformed to
+ * for the device, then the colors will be transformed to
* the alternate CS using the alternate tint transform
*/
@@ -300,7 +299,6 @@ struct gsicc_devicen_entry_s {
gsicc_devicen_entry_t *next;
};
-
typedef struct gsicc_devicen_s gsicc_devicen_t;
struct gsicc_devicen_s {
@@ -313,7 +311,7 @@ typedef struct gsicc_smask_s {
cmm_profile_t *smask_gray;
cmm_profile_t *smask_rgb;
cmm_profile_t *smask_cmyk;
- gs_memory_t *memory;
+ gs_memory_t *memory;
} gsicc_smask_t;
/* The manager object */
@@ -326,18 +324,18 @@ typedef struct gsicc_manager_s {
cmm_profile_t *proof_profile; /* Proofing profile */
cmm_profile_t *output_link; /* Output device Link profile */
cmm_profile_t *lab_profile; /* Colorspace type ICC profile from LAB to LAB */
- gsicc_devicen_t *device_n; /* A linked list of profiles used for DeviceN support */
+ gsicc_devicen_t *device_n; /* A linked list of profiles used for DeviceN support */
gsicc_smask_t *smask_profiles; /* Profiles used when we are in a softmask group */
char *profiledir; /* Directory used in searching for ICC profiles */
uint namelen;
- gs_memory_t *memory;
+ gs_memory_t *memory;
rc_header rc;
} gsicc_manager_t;
typedef struct gsicc_rendering_param_s {
gsicc_rendering_intents_t rendering_intent;
gs_object_tag_type_t object_type;
- gsicc_black_point_comp_t black_point_comp;
+ gsicc_black_point_comp_t black_point_comp;
} gsicc_rendering_param_t;
#endif /* ifndef gscms_INCLUDED */
diff --git a/gs/base/gscolor.c b/gs/base/gscolor.c
index dcb2f4ee0..cea4a784b 100644
--- a/gs/base/gscolor.c
+++ b/gs/base/gscolor.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,14 +33,14 @@ public_st_client_color();
public_st_transfer_map();
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(transfer_map_enum_ptrs, gx_transfer_map *mptr) return 0;
case 0: ENUM_RETURN((mptr->proc == 0 ? mptr->closure.data : 0));
ENUM_PTRS_END
static RELOC_PTRS_WITH(transfer_map_reloc_ptrs, gx_transfer_map *mptr)
{
if (mptr->proc == 0)
- RELOC_PTR(gx_transfer_map, closure.data);
+ RELOC_PTR(gx_transfer_map, closure.data);
}
RELOC_PTRS_END
@@ -92,7 +92,7 @@ gx_restrict01_paint_4(gs_client_color * pcc, const gs_color_space * pcs)
/* Null reference count adjustment procedure. */
void
gx_no_adjust_color_count(const gs_client_color * pcc,
- const gs_color_space * pcs, int delta)
+ const gs_color_space * pcs, int delta)
{
}
@@ -108,7 +108,7 @@ gs_setgray(gs_state * pgs, floatp gray)
pcs = gs_cspace_new_DeviceGray(pgs->memory);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if ((code = gs_setcolorspace(pgs, pcs)) >= 0) {
gs_client_color *pcc = gs_currentcolor_inline(pgs);
@@ -130,7 +130,7 @@ gs_setrgbcolor(gs_state * pgs, floatp r, floatp g, floatp b)
pcs = gs_cspace_new_DeviceRGB(pgs->memory);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if ((code = gs_setcolorspace(pgs, pcs)) >= 0) {
gs_client_color *pcc = gs_currentcolor_inline(pgs);
@@ -145,13 +145,12 @@ gs_setrgbcolor(gs_state * pgs, floatp r, floatp g, floatp b)
return code;
}
-
/* setnullcolor */
int
gs_setnullcolor(gs_state * pgs)
{
if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
gs_setgray(pgs, 0.0); /* set color space to something harmless */
color_set_null(gs_currentdevicecolor_inline(pgs));
return 0;
@@ -178,18 +177,18 @@ gs_settransfer_remap(gs_state * pgs, gs_mapping_proc tproc, bool remap)
rc_decrement(ptran->green, "gs_settransfer");
rc_decrement(ptran->blue, "gs_settransfer");
rc_unshare_struct(ptran->gray, gx_transfer_map, &st_transfer_map,
- pgs->memory, goto fail, "gs_settransfer");
+ pgs->memory, goto fail, "gs_settransfer");
ptran->gray->proc = tproc;
ptran->gray->id = gs_next_ids(pgs->memory, 1);
ptran->red = 0;
ptran->green = 0;
ptran->blue = 0;
if (remap) {
- load_transfer_map(pgs, ptran->gray, 0.0);
- gx_set_effective_transfer(pgs);
- gx_unset_dev_color(pgs);
+ load_transfer_map(pgs, ptran->gray, 0.0);
+ gx_set_effective_transfer(pgs);
+ gx_unset_dev_color(pgs);
} else
- gx_set_effective_transfer(pgs);
+ gx_set_effective_transfer(pgs);
return 0;
fail:
rc_increment(ptran->red);
@@ -218,10 +217,10 @@ gx_set_device_color_1(gs_state * pgs)
gs_setoverprintmode(pgs, 0);
pcs = gs_cspace_new_DeviceGray(pgs->memory);
if (pcs) {
- gs_setcolorspace(pgs, pcs);
- rc_decrement_only_cs(pcs, "gx_set_device_color_1");
+ gs_setcolorspace(pgs, pcs);
+ rc_decrement_only_cs(pcs, "gx_set_device_color_1");
} else {
- /* {csrc} really need to signal an error here */
+ /* {csrc} really need to signal an error here */
}
set_nonclient_dev_color(gs_currentdevicecolor_inline(pgs), 1);
pgs->log_op = lop_default;
@@ -230,7 +229,7 @@ gx_set_device_color_1(gs_state * pgs)
* update the overprint information.
*/
if (pgs->effective_overprint_mode == 1)
- (void)gs_do_set_overprint(pgs);
+ (void)gs_do_set_overprint(pgs);
}
@@ -242,7 +241,7 @@ gx_set_device_color_1(gs_state * pgs)
*/
static float
transfer_use_proc(floatp value, const gx_transfer_map * pmap,
- const void *ignore_proc_data)
+ const void *ignore_proc_data)
{
return (*pmap->proc) (value, pmap);
}
@@ -256,16 +255,16 @@ load_transfer_map(gs_state * pgs, gx_transfer_map * pmap, floatp min_value)
int i;
if (pmap->proc == 0) /* use closure */
- proc = pmap->closure.proc, proc_data = pmap->closure.data;
+ proc = pmap->closure.proc, proc_data = pmap->closure.data;
else /* use proc */
- proc = transfer_use_proc, proc_data = 0 /* not used */;
+ proc = transfer_use_proc, proc_data = 0 /* not used */;
for (i = 0; i < transfer_map_size; i++) {
- float fval =
- (*proc) ((float)i / (transfer_map_size - 1), pmap, proc_data);
+ float fval =
+ (*proc) ((float)i / (transfer_map_size - 1), pmap, proc_data);
- values[i] =
- (fval < min_value ? fmin :
- fval >= 1.0 ? frac_1 :
- float2frac(fval));
+ values[i] =
+ (fval < min_value ? fmin :
+ fval >= 1.0 ? frac_1 :
+ float2frac(fval));
}
}
diff --git a/gs/base/gscolor.h b/gs/base/gscolor.h
index 6d917e83c..ff0c4b6f0 100644
--- a/gs/base/gscolor.h
+++ b/gs/base/gscolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscolor1.c b/gs/base/gscolor1.c
index d97b2faf3..1793affba 100644
--- a/gs/base/gscolor1.c
+++ b/gs/base/gscolor1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ gs_setcmykcolor(gs_state * pgs, floatp c, floatp m, floatp y, floatp k)
pcs = gs_cspace_new_DeviceCMYK(pgs->memory);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if ((code = gs_setcolorspace(pgs, pcs)) >= 0) {
gs_client_color *pcc = gs_currentcolor_inline(pgs);
@@ -62,7 +62,6 @@ gs_setcmykcolor(gs_state * pgs, floatp c, floatp m, floatp y, floatp k)
return code;
}
-
/* setblackgeneration */
/* Remap=0 is used by the interpreter. */
int
@@ -74,14 +73,14 @@ int
gs_setblackgeneration_remap(gs_state * pgs, gs_mapping_proc proc, bool remap)
{
rc_unshare_struct(pgs->black_generation, gx_transfer_map,
- &st_transfer_map, pgs->memory,
- return_error(gs_error_VMerror),
- "gs_setblackgeneration");
+ &st_transfer_map, pgs->memory,
+ return_error(gs_error_VMerror),
+ "gs_setblackgeneration");
pgs->black_generation->proc = proc;
pgs->black_generation->id = gs_next_ids(pgs->memory, 1);
if (remap) {
- load_transfer_map(pgs, pgs->black_generation, 0.0);
- gx_unset_dev_color(pgs);
+ load_transfer_map(pgs, pgs->black_generation, 0.0);
+ gx_unset_dev_color(pgs);
}
return 0;
}
@@ -104,14 +103,14 @@ int
gs_setundercolorremoval_remap(gs_state * pgs, gs_mapping_proc proc, bool remap)
{
rc_unshare_struct(pgs->undercolor_removal, gx_transfer_map,
- &st_transfer_map, pgs->memory,
- return_error(gs_error_VMerror),
- "gs_setundercolorremoval");
+ &st_transfer_map, pgs->memory,
+ return_error(gs_error_VMerror),
+ "gs_setundercolorremoval");
pgs->undercolor_removal->proc = proc;
pgs->undercolor_removal->id = gs_next_ids(pgs->memory, 1);
if (remap) {
- load_transfer_map(pgs, pgs->undercolor_removal, -1.0);
- gx_unset_dev_color(pgs);
+ load_transfer_map(pgs, pgs->undercolor_removal, -1.0);
+ gx_unset_dev_color(pgs);
}
return 0;
}
@@ -127,9 +126,9 @@ gs_currentundercolorremoval(const gs_state * pgs)
/* Remap=0 is used by the interpreter. */
int
gs_setcolortransfer_remap(gs_state * pgs, gs_mapping_proc red_proc,
- gs_mapping_proc green_proc,
- gs_mapping_proc blue_proc,
- gs_mapping_proc gray_proc, bool remap)
+ gs_mapping_proc green_proc,
+ gs_mapping_proc blue_proc,
+ gs_mapping_proc gray_proc, bool remap)
{
gx_transfer *ptran = &pgs->set_transfer;
gx_transfer old;
@@ -138,13 +137,13 @@ gs_setcolortransfer_remap(gs_state * pgs, gs_mapping_proc red_proc,
old = *ptran;
rc_unshare_struct(ptran->gray, gx_transfer_map, &st_transfer_map,
- pgs->memory, goto fgray, "gs_setcolortransfer");
+ pgs->memory, goto fgray, "gs_setcolortransfer");
rc_unshare_struct(ptran->red, gx_transfer_map, &st_transfer_map,
- pgs->memory, goto fred, "gs_setcolortransfer");
+ pgs->memory, goto fred, "gs_setcolortransfer");
rc_unshare_struct(ptran->green, gx_transfer_map, &st_transfer_map,
- pgs->memory, goto fgreen, "gs_setcolortransfer");
+ pgs->memory, goto fgreen, "gs_setcolortransfer");
rc_unshare_struct(ptran->blue, gx_transfer_map, &st_transfer_map,
- pgs->memory, goto fblue, "gs_setcolortransfer");
+ pgs->memory, goto fblue, "gs_setcolortransfer");
ptran->gray->proc = gray_proc;
ptran->gray->id = new_ids;
ptran->red->proc = red_proc;
@@ -153,23 +152,23 @@ gs_setcolortransfer_remap(gs_state * pgs, gs_mapping_proc red_proc,
ptran->green->id = new_ids + 2;
ptran->blue->proc = blue_proc;
ptran->blue->id = new_ids + 3;
- ptran->red_component_num =
+ ptran->red_component_num =
gs_color_name_component_number(dev, "Red", 3, ht_type_colorscreen);
- ptran->green_component_num =
+ ptran->green_component_num =
gs_color_name_component_number(dev, "Green", 5, ht_type_colorscreen);
- ptran->blue_component_num =
+ ptran->blue_component_num =
gs_color_name_component_number(dev, "Blue", 4, ht_type_colorscreen);
- ptran->gray_component_num =
+ ptran->gray_component_num =
gs_color_name_component_number(dev, "Gray", 4, ht_type_colorscreen);
if (remap) {
- load_transfer_map(pgs, ptran->red, 0.0);
- load_transfer_map(pgs, ptran->green, 0.0);
- load_transfer_map(pgs, ptran->blue, 0.0);
- load_transfer_map(pgs, ptran->gray, 0.0);
- gx_set_effective_transfer(pgs);
- gx_unset_dev_color(pgs);
+ load_transfer_map(pgs, ptran->red, 0.0);
+ load_transfer_map(pgs, ptran->green, 0.0);
+ load_transfer_map(pgs, ptran->blue, 0.0);
+ load_transfer_map(pgs, ptran->gray, 0.0);
+ gx_set_effective_transfer(pgs);
+ gx_unset_dev_color(pgs);
} else
- gx_set_effective_transfer(pgs);
+ gx_set_effective_transfer(pgs);
return 0;
fblue:
rc_assign(ptran->green, old.green, "setcolortransfer");
@@ -182,11 +181,11 @@ gs_setcolortransfer_remap(gs_state * pgs, gs_mapping_proc red_proc,
}
int
gs_setcolortransfer(gs_state * pgs, gs_mapping_proc red_proc,
- gs_mapping_proc green_proc, gs_mapping_proc blue_proc,
- gs_mapping_proc gray_proc)
+ gs_mapping_proc green_proc, gs_mapping_proc blue_proc,
+ gs_mapping_proc gray_proc)
{
return gs_setcolortransfer_remap(pgs, red_proc, green_proc,
- blue_proc, gray_proc, true);
+ blue_proc, gray_proc, true);
}
/* currentcolortransfer */
diff --git a/gs/base/gscolor1.h b/gs/base/gscolor1.h
index cc8e02a9e..9943beb44 100644
--- a/gs/base/gscolor1.h
+++ b/gs/base/gscolor1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,13 +30,13 @@ gs_mapping_proc gs_currentundercolorremoval(const gs_state *);
/* Transfer function */
int gs_setcolortransfer(gs_state *, gs_mapping_proc /*red */ ,
- gs_mapping_proc /*green */ ,
- gs_mapping_proc /*blue */ ,
- gs_mapping_proc /*gray */ ),
+ gs_mapping_proc /*green */ ,
+ gs_mapping_proc /*blue */ ,
+ gs_mapping_proc /*gray */ ),
gs_setcolortransfer_remap(gs_state *, gs_mapping_proc /*red */ ,
- gs_mapping_proc /*green */ ,
- gs_mapping_proc /*blue */ ,
- gs_mapping_proc /*gray */ , bool);
+ gs_mapping_proc /*green */ ,
+ gs_mapping_proc /*blue */ ,
+ gs_mapping_proc /*gray */ , bool);
void gs_currentcolortransfer(const gs_state *, gs_mapping_proc[4]);
#endif /* gscolor1_INCLUDED */
diff --git a/gs/base/gscolor2.c b/gs/base/gscolor2.c
index 47d59c00c..0d066f006 100644
--- a/gs/base/gscolor2.c
+++ b/gs/base/gscolor2.c
@@ -220,7 +220,6 @@ static RELOC_PTRS_WITH(cs_Indexed_reloc_ptrs, gs_color_space *pcs)
}
RELOC_PTRS_END
-
/* Color space installation for an Indexed color space. */
static int
@@ -574,7 +573,6 @@ gs_cspace_indexed_lookup_bytes(const gs_color_space *pcs, float index_float,
}
}
-
/* Look up an index in an Indexed color space, return value as frac value(s). */
int
gs_cspace_indexed_lookup_frac(const gs_color_space *pcs, float index_float,
@@ -648,9 +646,6 @@ gs_cspace_indexed_lookup_frac(const gs_color_space *pcs, float index_float,
}
}
-
-
-
/* Look up with restriction */
int
@@ -667,7 +662,6 @@ gs_indexed_limit_and_lookup(const gs_client_color * pc,const gs_color_space *pcs
}
-
/* ---------------- Serialization. -------------------------------- */
static int
diff --git a/gs/base/gscolor2.h b/gs/base/gscolor2.h
index 3a12446b5..497c2514a 100644
--- a/gs/base/gscolor2.h
+++ b/gs/base/gscolor2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ const gx_device_color *gs_currentdevicecolor(const gs_state *);
/* Look up with restriction */
int
gs_indexed_limit_and_lookup(const gs_client_color * pc,const gs_color_space *pcs,
- gs_client_color *pcc);
+ gs_client_color *pcc);
/* Declare the Indexed color space type. */
extern const gs_color_space_type gs_color_space_type_Indexed;
diff --git a/gs/base/gscolor3.c b/gs/base/gscolor3.c
index 41cf39810..bafcb2491 100644
--- a/gs/base/gscolor3.c
+++ b/gs/base/gscolor3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@ int
gs_setsmoothness(gs_state * pgs, floatp smoothness)
{
pgs->smoothness =
- (smoothness < 0 ? 0 : smoothness > 1 ? 1 : smoothness);
+ (smoothness < 0 ? 0 : smoothness > 1 ? 1 : smoothness);
return 0;
}
@@ -53,7 +53,7 @@ gs_shfill(gs_state * pgs, const gs_shading_t * psh)
* shfill is equivalent to filling the current clipping path (or, if
* clipping, its bounding box) with the shading, disregarding the
* Background if any. In order to produce reasonable high-level output,
- * we must implement this by calling gs_fill_path.
+ * we must implement this by calling gs_fill_path.
*/
gs_pattern2_template_t pat;
gs_matrix imat;
@@ -72,45 +72,45 @@ gs_shfill(gs_state * pgs, const gs_shading_t * psh)
see gs/lib . */
code = gs_setcolorspace(pgs, psh->params.ColorSpace);
if (code < 0)
- return 0;
+ return 0;
if (psh->params.cie_joint_caches != NULL) {
- pgs->cie_joint_caches = psh->params.cie_joint_caches;
- rc_increment(pgs->cie_joint_caches);
+ pgs->cie_joint_caches = psh->params.cie_joint_caches;
+ rc_increment(pgs->cie_joint_caches);
}
gs_pattern2_init(&pat);
pat.Shading = psh;
gs_make_identity(&imat);
code = gs_make_pattern(&cc, (gs_pattern_template_t *)&pat, &imat, pgs,
- pgs->memory);
+ pgs->memory);
if (code < 0)
- return code;
+ return code;
code = gs_pattern2_set_shfill(&cc);
if (code < 0)
- return code;
+ return code;
pcs = gs_cspace_alloc(pgs->memory, &gs_color_space_type_Pattern);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcs->params.pattern.has_base_space = false;
code = pcs->type->remap_color(&cc, pcs, &devc, (gs_imager_state *)pgs,
- pgs->device, gs_color_select_texture);
+ pgs->device, gs_color_select_texture);
if (code >= 0) {
- gx_device *dev = pgs->device;
- bool need_path = !dev_proc(dev, dev_spec_op)(dev,
+ gx_device *dev = pgs->device;
+ bool need_path = !dev_proc(dev, dev_spec_op)(dev,
gxdso_pattern_shfill_doesnt_need_path, NULL, 0);
- if (need_path) {
- gx_path cpath;
+ if (need_path) {
+ gx_path cpath;
- gx_path_init_local(&cpath, pgs->memory);
- code = gx_cpath_to_path(pgs->clip_path, &cpath);
- if (code >= 0)
- code = gx_fill_path(&cpath, &devc, pgs, gx_rule_winding_number,
- pgs->fill_adjust.x, pgs->fill_adjust.y);
- gx_path_free(&cpath, "gs_shfill");
- } else
- code = gx_fill_path(NULL, &devc, pgs, gx_rule_winding_number,
- pgs->fill_adjust.x, pgs->fill_adjust.y);
+ gx_path_init_local(&cpath, pgs->memory);
+ code = gx_cpath_to_path(pgs->clip_path, &cpath);
+ if (code >= 0)
+ code = gx_fill_path(&cpath, &devc, pgs, gx_rule_winding_number,
+ pgs->fill_adjust.x, pgs->fill_adjust.y);
+ gx_path_free(&cpath, "gs_shfill");
+ } else
+ code = gx_fill_path(NULL, &devc, pgs, gx_rule_winding_number,
+ pgs->fill_adjust.x, pgs->fill_adjust.y);
}
rc_decrement_cs(pcs, "gs_shfill");
gs_pattern_reference(&cc, -1);
diff --git a/gs/base/gscolor3.h b/gs/base/gscolor3.h
index f36b96a47..3304e3b5d 100644
--- a/gs/base/gscolor3.h
+++ b/gs/base/gscolor3.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscolorbuffer.c b/gs/base/gscolorbuffer.c
index a219a331b..b31904780 100644
--- a/gs/base/gscolorbuffer.c
+++ b/gs/base/gscolorbuffer.c
@@ -11,7 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
/* Simple operators and place holding support for doing conversions on buffers
of data. These functions perform device (non CIE or ICC color conversions)
on buffers of data. Eventually these will be replaced with functions for
@@ -27,8 +26,8 @@
#define float_color_to_byte_color(float_color) ( \
(0.0 < (float_color) && (float_color) < 1.0) ? \
- ((unsigned char) ((float_color) * 255.0)) : \
- (((float_color) <= 0.0) ? 0x00 : 0xFF) \
+ ((unsigned char) ((float_color) * 255.0)) : \
+ (((float_color) <= 0.0) ? 0x00 : 0xFF) \
)
/* We could use the conversions that are defined in gxdcconv.c,
@@ -46,7 +45,7 @@ rgb_to_cmyk(byte rgb[],byte cmyk[])
cmyk[2] = 255 - rgb[2];
cmyk[3] = (cmyk[0] < cmyk[1]) ?
- min(cmyk[0], cmyk[2]) : min(cmyk[1], cmyk[2]);
+ min(cmyk[0], cmyk[2]) : min(cmyk[1], cmyk[2]);
}
@@ -82,7 +81,7 @@ cmyk_to_gray(byte cmyk[], byte gray[])
float temp_value;
temp_value = ((255 - cmyk[0])*0.3 +
- (255 - cmyk[1])*0.59 +
+ (255 - cmyk[1])*0.59 +
(255 - cmyk[2]) * 0.11) * (255 - cmyk[3]);
temp_value = temp_value * (1.0 / 65025.0 );
@@ -112,12 +111,11 @@ gray_to_rgb(byte gray[], byte rgb[])
}
-
void
gs_transform_color_buffer_generic(byte *inputbuffer,
- int row_stride, int plane_stride,
+ int row_stride, int plane_stride,
int input_num_color, gs_int_rect rect, byte *outputbuffer,
- int output_num_color, int num_noncolor_planes)
+ int output_num_color, int num_noncolor_planes)
{
int num_rows, num_cols, x, y, z;
@@ -200,7 +198,7 @@ gs_transform_color_buffer_generic(byte *inputbuffer,
/* data is planar */
max_num_channels = max(input_num_color, output_num_color) +
- num_noncolor_planes;
+ num_noncolor_planes;
for (z = 0; z < max_num_channels; z++)
plane_offset[z] = z * plane_stride;
diff --git a/gs/base/gscolorbuffer.h b/gs/base/gscolorbuffer.h
index 2593d9d16..136f3914d 100644
--- a/gs/base/gscolorbuffer.h
+++ b/gs/base/gscolorbuffer.h
@@ -20,6 +20,6 @@
/* This just does planar data for now */
void gs_transform_color_buffer_generic(byte *inputbuffer,
- int rowstride, int planestride,
- int input_num_color, gs_int_rect rect,byte *outputbuffer,
- int output_num_color,int num_noncolor_planes);
+ int rowstride, int planestride,
+ int input_num_color, gs_int_rect rect,byte *outputbuffer,
+ int output_num_color,int num_noncolor_planes);
diff --git a/gs/base/gscompt.h b/gs/base/gscompt.h
index 54bcc28ad..e49d555b2 100644
--- a/gs/base/gscompt.h
+++ b/gs/base/gscompt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscoord.c b/gs/base/gscoord.c
index 3d9e9614d..1d3438551 100644
--- a/gs/base/gscoord.c
+++ b/gs/base/gscoord.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,10 +46,10 @@ static void trace_matrix(const gs_matrix *);
# define print_inverse(pgs) DO_NOTHING
#endif
#define ensure_inverse_valid(pgs)\
- if ( !pgs->ctm_inverse_valid )\
- { int code = ctm_set_inverse(pgs);\
- if ( code < 0 ) return code;\
- }
+ if ( !pgs->ctm_inverse_valid )\
+ { int code = ctm_set_inverse(pgs);\
+ if ( code < 0 ) return code;\
+ }
static int
ctm_set_inverse(gs_state * pgs)
@@ -58,7 +58,7 @@ ctm_set_inverse(gs_state * pgs)
print_inverse(pgs);
if (code < 0)
- return code;
+ return code;
pgs->ctm_inverse_valid = true;
return 0;
}
@@ -83,9 +83,9 @@ ctm_set_inverse(gs_state * pgs)
#define f_fits_in_fixed(f) f_fits_in_bits(f, fixed_int_bits)
#define update_matrix_fixed(mat, xt, yt)\
((mat).txy_fixed_valid = (f_fits_in_fixed(xt) && f_fits_in_fixed(yt) ?\
- (update_t_fixed(mat, tx, tx_fixed, xt),\
- update_t_fixed(mat, ty, ty_fixed, yt), true) :\
- ((mat).tx = (xt), (mat).ty = (yt), false)))
+ (update_t_fixed(mat, tx, tx_fixed, xt),\
+ update_t_fixed(mat, ty, ty_fixed, yt), true) :\
+ ((mat).tx = (xt), (mat).ty = (yt), false)))
#define update_ctm(pgs, xt, yt)\
(pgs->ctm_inverse_valid = false,\
pgs->char_tm_valid = false,\
@@ -103,7 +103,7 @@ gs_initmatrix(gs_state * pgs)
set_ctm_only(pgs, imat);
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf("[x]initmatrix:\n"), trace_ctm(pgs);
+ dlprintf("[x]initmatrix:\n"), trace_ctm(pgs);
#endif
return 0;
}
@@ -114,16 +114,16 @@ gs_defaultmatrix(const gs_state * pgs, gs_matrix * pmat)
gx_device *dev;
if (pgs->ctm_default_set) { /* set after Install */
- *pmat = pgs->ctm_default;
- return 1;
+ *pmat = pgs->ctm_default;
+ return 1;
}
dev = gs_currentdevice_inline(pgs);
gs_deviceinitialmatrix(dev, pmat);
/* Add in the translation for the Margins. */
pmat->tx += dev->Margins[0] *
- dev->HWResolution[0] / dev->MarginsHWResolution[0];
+ dev->HWResolution[0] / dev->MarginsHWResolution[0];
pmat->ty += dev->Margins[1] *
- dev->HWResolution[1] / dev->MarginsHWResolution[1];
+ dev->HWResolution[1] / dev->MarginsHWResolution[1];
return 0;
}
@@ -131,10 +131,10 @@ int
gs_setdefaultmatrix(gs_state * pgs, const gs_matrix * pmat)
{
if (pmat == NULL)
- pgs->ctm_default_set = false;
+ pgs->ctm_default_set = false;
else {
- pgs->ctm_default = *pmat;
- pgs->ctm_default_set = true;
+ pgs->ctm_default = *pmat;
+ pgs->ctm_default_set = true;
}
return 0;
}
@@ -155,12 +155,12 @@ gs_setcharmatrix(gs_state * pgs, const gs_matrix * pmat)
int code = gs_matrix_multiply(pmat, &ctm_only(pgs), &cmat);
if (code < 0)
- return code;
+ return code;
update_matrix_fixed(pgs->char_tm, cmat.tx, cmat.ty);
char_tm_only(pgs) = cmat;
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf("[x]setting char_tm:"), trace_matrix_fixed(&pgs->char_tm);
+ dlprintf("[x]setting char_tm:"), trace_matrix_fixed(&pgs->char_tm);
#endif
pgs->char_tm_valid = true;
return 0;
@@ -173,16 +173,16 @@ int
gs_currentcharmatrix(gs_state * pgs, gs_matrix * ptm, bool force)
{
if (!pgs->char_tm_valid) {
- int code;
+ int code;
- if (!force)
- return_error(gs_error_undefinedresult);
- code = gs_setcharmatrix(pgs, &pgs->font->FontMatrix);
- if (code < 0)
- return code;
+ if (!force)
+ return_error(gs_error_undefinedresult);
+ code = gs_setcharmatrix(pgs, &pgs->font->FontMatrix);
+ if (code < 0)
+ return code;
}
if (ptm != NULL)
- *ptm = char_tm_only(pgs);
+ *ptm = char_tm_only(pgs);
return 0;
}
@@ -193,7 +193,7 @@ gs_setmatrix(gs_state * pgs, const gs_matrix * pmat)
set_ctm_only(pgs, *pmat);
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf("[x]setmatrix:\n"), trace_ctm(pgs);
+ dlprintf("[x]setmatrix:\n"), trace_ctm(pgs);
#endif
return 0;
}
@@ -205,7 +205,7 @@ gs_imager_setmatrix(gs_imager_state * pis, const gs_matrix * pmat)
set_ctm_only(pis, *pmat);
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf("[x]imager_setmatrix:\n"), trace_ctm(pis);
+ dlprintf("[x]imager_setmatrix:\n"), trace_ctm(pis);
#endif
return 0;
}
@@ -214,11 +214,11 @@ int
gs_settocharmatrix(gs_state * pgs)
{
if (pgs->char_tm_valid) {
- pgs->ctm = pgs->char_tm;
- pgs->ctm_inverse_valid = false;
- return 0;
+ pgs->ctm = pgs->char_tm;
+ pgs->ctm_inverse_valid = false;
+ return 0;
} else
- return_error(gs_error_undefinedresult);
+ return_error(gs_error_undefinedresult);
}
int
@@ -228,15 +228,15 @@ gs_translate(gs_state * pgs, floatp dx, floatp dy)
int code;
if ((code = gs_distance_transform(dx, dy, &ctm_only(pgs), &pt)) < 0)
- return code;
+ return code;
pt.x = (float)pt.x + pgs->ctm.tx;
pt.y = (float)pt.y + pgs->ctm.ty;
update_ctm(pgs, pt.x, pt.y);
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf4("[x]translate: %f %f -> %f %f\n",
- dx, dy, pt.x, pt.y),
- trace_ctm(pgs);
+ dlprintf4("[x]translate: %f %f -> %f %f\n",
+ dx, dy, pt.x, pt.y),
+ trace_ctm(pgs);
#endif
return 0;
}
@@ -251,7 +251,7 @@ gs_scale(gs_state * pgs, floatp sx, floatp sy)
pgs->ctm_inverse_valid = false, pgs->char_tm_valid = false;
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf2("[x]scale: %f %f\n", sx, sy), trace_ctm(pgs);
+ dlprintf2("[x]scale: %f %f\n", sx, sy), trace_ctm(pgs);
#endif
return 0;
}
@@ -260,12 +260,12 @@ int
gs_rotate(gs_state * pgs, floatp ang)
{
int code = gs_matrix_rotate(&ctm_only(pgs), ang,
- &ctm_only_writable(pgs));
+ &ctm_only_writable(pgs));
pgs->ctm_inverse_valid = false, pgs->char_tm_valid = false;
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf1("[x]rotate: %f\n", ang), trace_ctm(pgs);
+ dlprintf1("[x]rotate: %f\n", ang), trace_ctm(pgs);
#endif
return code;
}
@@ -277,12 +277,12 @@ gs_concat(gs_state * pgs, const gs_matrix * pmat)
int code = gs_matrix_multiply(pmat, &ctm_only(pgs), &cmat);
if (code < 0)
- return code;
+ return code;
update_ctm(pgs, cmat.tx, cmat.ty);
set_ctm_only(pgs, cmat);
#ifdef DEBUG
if (gs_debug_c('x'))
- dlprintf("[x]concat:\n"), trace_matrix(pmat), trace_ctm(pgs);
+ dlprintf("[x]concat:\n"), trace_matrix(pmat), trace_ctm(pgs);
#endif
return code;
}
@@ -308,10 +308,10 @@ gs_itransform(gs_state * pgs, floatp x, floatp y, gs_point * pt)
{ /* If the matrix isn't skewed, we get more accurate results */
/* by using transform_inverse than by using the inverse matrix. */
if (!is_skewed(&pgs->ctm)) {
- return gs_point_transform_inverse(x, y, &ctm_only(pgs), pt);
+ return gs_point_transform_inverse(x, y, &ctm_only(pgs), pt);
} else {
- ensure_inverse_valid(pgs);
- return gs_point_transform(x, y, &pgs->ctm_inverse, pt);
+ ensure_inverse_valid(pgs);
+ return gs_point_transform(x, y, &pgs->ctm_inverse, pt);
}
}
@@ -320,17 +320,17 @@ gs_idtransform(gs_state * pgs, floatp dx, floatp dy, gs_point * pt)
{ /* If the matrix isn't skewed, we get more accurate results */
/* by using transform_inverse than by using the inverse matrix. */
if (!is_skewed(&pgs->ctm)) {
- return gs_distance_transform_inverse(dx, dy,
- &ctm_only(pgs), pt);
+ return gs_distance_transform_inverse(dx, dy,
+ &ctm_only(pgs), pt);
} else {
- ensure_inverse_valid(pgs);
- return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt);
+ ensure_inverse_valid(pgs);
+ return gs_distance_transform(dx, dy, &pgs->ctm_inverse, pt);
}
}
int
gs_imager_idtransform(const gs_imager_state * pis, floatp dx, floatp dy,
- gs_point * pt)
+ gs_point * pt)
{
return gs_distance_transform_inverse(dx, dy, &ctm_only(pis), pt);
}
@@ -350,17 +350,17 @@ gx_translate_to_fixed(register gs_state * pgs, fixed px, fixed py)
int code;
if (pgs->ctm.txy_fixed_valid) {
- dx = float2fixed(fdx);
- dy = float2fixed(fdy);
- code = gx_path_translate(pgs->path, dx, dy);
- if (code < 0)
- return code;
- if (pgs->char_tm_valid && pgs->char_tm.txy_fixed_valid)
- pgs->char_tm.tx_fixed += dx,
- pgs->char_tm.ty_fixed += dy;
+ dx = float2fixed(fdx);
+ dy = float2fixed(fdy);
+ code = gx_path_translate(pgs->path, dx, dy);
+ if (code < 0)
+ return code;
+ if (pgs->char_tm_valid && pgs->char_tm.txy_fixed_valid)
+ pgs->char_tm.tx_fixed += dx,
+ pgs->char_tm.ty_fixed += dy;
} else {
- if (!gx_path_is_null(pgs->path))
- return_error(gs_error_limitcheck);
+ if (!gx_path_is_null(pgs->path))
+ return_error(gs_error_limitcheck);
}
pgs->ctm.tx = fpx;
pgs->ctm.tx_fixed = px;
@@ -369,16 +369,16 @@ gx_translate_to_fixed(register gs_state * pgs, fixed px, fixed py)
pgs->ctm.txy_fixed_valid = true;
pgs->ctm_inverse_valid = false;
if (pgs->char_tm_valid) { /* Update char_tm now, leaving it valid. */
- pgs->char_tm.tx += fdx;
- pgs->char_tm.ty += fdy;
+ pgs->char_tm.tx += fdx;
+ pgs->char_tm.ty += fdy;
}
#ifdef DEBUG
if (gs_debug_c('x')) {
- dlprintf2("[x]translate_to_fixed %g, %g:\n",
- fixed2float(px), fixed2float(py));
- trace_ctm(pgs);
- dlprintf("[x] char_tm:\n");
- trace_matrix_fixed(&pgs->char_tm);
+ dlprintf2("[x]translate_to_fixed %g, %g:\n",
+ fixed2float(px), fixed2float(py));
+ trace_ctm(pgs);
+ dlprintf("[x] char_tm:\n");
+ trace_matrix_fixed(&pgs->char_tm);
}
#endif
gx_setcurrentpoint(pgs, fixed2float(pgs->ctm.tx_fixed), fixed2float(pgs->ctm.ty_fixed));
@@ -393,12 +393,12 @@ gx_scale_char_matrix(register gs_state * pgs, int sx, int sy)
#define scale_cxy(s, vx, vy)\
if ( s != 1 )\
{ pgs->ctm.vx *= s;\
- pgs->ctm.vy *= s;\
- pgs->ctm_inverse_valid = false;\
- if ( pgs->char_tm_valid )\
- { pgs->char_tm.vx *= s;\
- pgs->char_tm.vy *= s;\
- }\
+ pgs->ctm.vy *= s;\
+ pgs->ctm_inverse_valid = false;\
+ if ( pgs->char_tm_valid )\
+ { pgs->char_tm.vx *= s;\
+ pgs->char_tm.vy *= s;\
+ }\
}
scale_cxy(sx, xx, yx);
scale_cxy(sy, xy, yy);
@@ -412,7 +412,7 @@ gx_scale_char_matrix(register gs_state * pgs, int sx, int sy)
/* We should cache the coefficients with the ctm.... */
int
gx_matrix_to_fixed_coeff(const gs_matrix * pmat, register fixed_coeff * pfc,
- int max_bits)
+ int max_bits)
{
gs_matrix ctm;
int scale = -10000;
@@ -421,24 +421,24 @@ gx_matrix_to_fixed_coeff(const gs_matrix * pmat, register fixed_coeff * pfc,
ctm = *pmat;
pfc->skewed = 0;
if (!is_fzero(ctm.xx)) {
- discard(frexp(ctm.xx, &scale));
+ discard(frexp(ctm.xx, &scale));
}
if (!is_fzero(ctm.xy)) {
- discard(frexp(ctm.xy, &expt));
- if (expt > scale)
- scale = expt;
- pfc->skewed = 1;
+ discard(frexp(ctm.xy, &expt));
+ if (expt > scale)
+ scale = expt;
+ pfc->skewed = 1;
}
if (!is_fzero(ctm.yx)) {
- discard(frexp(ctm.yx, &expt));
- if (expt > scale)
- scale = expt;
- pfc->skewed = 1;
+ discard(frexp(ctm.yx, &expt));
+ if (expt > scale)
+ scale = expt;
+ pfc->skewed = 1;
}
if (!is_fzero(ctm.yy)) {
- discard(frexp(ctm.yy, &expt));
- if (expt > scale)
- scale = expt;
+ discard(frexp(ctm.yy, &expt));
+ if (expt > scale)
+ scale = expt;
}
/*
* There are two multiplications in fixed_coeff_mult: one involves a
@@ -447,17 +447,17 @@ gx_matrix_to_fixed_coeff(const gs_matrix * pmat, register fixed_coeff * pfc,
* will overflow.
*/
if (max_bits < fixed_fraction_bits)
- max_bits = fixed_fraction_bits;
+ max_bits = fixed_fraction_bits;
scale = sizeof(long) * 8 - 1 - max_bits - scale;
shift = scale - _fixed_shift;
if (shift > 0) {
- pfc->shift = shift;
- pfc->round = (fixed) 1 << (shift - 1);
+ pfc->shift = shift;
+ pfc->round = (fixed) 1 << (shift - 1);
} else {
- pfc->shift = 0;
- pfc->round = 0;
- scale -= shift;
+ pfc->shift = 0;
+ pfc->round = 0;
+ scale -= shift;
}
#define SET_C(c)\
if ( is_fzero(ctm.c) ) pfc->c = 0;\
@@ -469,11 +469,11 @@ gx_matrix_to_fixed_coeff(const gs_matrix * pmat, register fixed_coeff * pfc,
#undef SET_C
#ifdef DEBUG
if (gs_debug_c('x')) {
- dlprintf6("[x]ctm: [%6g %6g %6g %6g %6g %6g]\n",
- ctm.xx, ctm.xy, ctm.yx, ctm.yy, ctm.tx, ctm.ty);
- dlprintf6(" scale=%d fc: [0x%lx 0x%lx 0x%lx 0x%lx] shift=%d\n",
- scale, pfc->xx, pfc->xy, pfc->yx, pfc->yy,
- pfc->shift);
+ dlprintf6("[x]ctm: [%6g %6g %6g %6g %6g %6g]\n",
+ ctm.xx, ctm.xy, ctm.yx, ctm.yy, ctm.tx, ctm.ty);
+ dlprintf6(" scale=%d fc: [0x%lx 0x%lx 0x%lx 0x%lx] shift=%d\n",
+ scale, pfc->xx, pfc->xy, pfc->yx, pfc->yy,
+ pfc->shift);
}
#endif
pfc->max_bits = max_bits;
@@ -493,20 +493,20 @@ fixed_coeff_mult(fixed value, long coeff, const fixed_coeff *pfc, int maxb)
* Test if the value is too large for simple long math.
*/
if ((value + (fixed_1 << (maxb - 1))) & (-fixed_1 << maxb)) {
- /* The second argument of fixed_mult_quo must be non-negative. */
- return
- (coeff < 0 ?
- -fixed_mult_quo(value, -coeff, fixed_1 << shift) :
- fixed_mult_quo(value, coeff, fixed_1 << shift));
+ /* The second argument of fixed_mult_quo must be non-negative. */
+ return
+ (coeff < 0 ?
+ -fixed_mult_quo(value, -coeff, fixed_1 << shift) :
+ fixed_mult_quo(value, coeff, fixed_1 << shift));
} else {
- /*
- * The construction above guarantees that the multiplications
- * won't overflow the capacity of an int.
- */
+ /*
+ * The construction above guarantees that the multiplications
+ * won't overflow the capacity of an int.
+ */
return (fixed)
- arith_rshift(fixed2int_var(value) * coeff
- + fixed2int(fixed_fraction(value) * coeff)
- + pfc->round, shift);
+ arith_rshift(fixed2int_var(value) * coeff
+ + fixed2int(fixed_fraction(value) * coeff)
+ + pfc->round, shift);
}
}
@@ -520,18 +520,18 @@ trace_matrix_fixed(const gs_matrix_fixed * pmat)
{
trace_matrix((const gs_matrix *)pmat);
if (pmat->txy_fixed_valid) {
- dprintf2("\t\tt_fixed: [%6g %6g]\n",
- fixed2float(pmat->tx_fixed),
- fixed2float(pmat->ty_fixed));
+ dprintf2("\t\tt_fixed: [%6g %6g]\n",
+ fixed2float(pmat->tx_fixed),
+ fixed2float(pmat->ty_fixed));
} else {
- dputs("\t\tt_fixed not valid\n");
+ dputs("\t\tt_fixed not valid\n");
}
}
static void
trace_matrix(register const gs_matrix * pmat)
{
dlprintf6("\t[%6g %6g %6g %6g %6g %6g]\n",
- pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
+ pmat->xx, pmat->xy, pmat->yx, pmat->yy, pmat->tx, pmat->ty);
}
#endif
diff --git a/gs/base/gscoord.h b/gs/base/gscoord.h
index 0d6d4ae1a..f087c7cb5 100644
--- a/gs/base/gscoord.h
+++ b/gs/base/gscoord.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscparam.c b/gs/base/gscparam.c
index cb61bf9c0..53553dddf 100644
--- a/gs/base/gscparam.c
+++ b/gs/base/gscparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,23 +55,23 @@ struct gs_c_param_s {
/* GC descriptor and procedures */
gs_private_st_composite(st_c_param, gs_c_param, "gs_c_param",
- c_param_enum_ptrs, c_param_reloc_ptrs);
+ c_param_enum_ptrs, c_param_reloc_ptrs);
ENUM_PTRS_WITH(c_param_enum_ptrs, gs_c_param *param) {
index -= 3;
switch (param->type) {
- /* Only the aggregate types are handled specially. */
+ /* Only the aggregate types are handled specially. */
case gs_param_type_dict:
case gs_param_type_dict_int_keys:
case gs_param_type_array:
- return ENUM_USING(st_c_param_list, &param->value.d,
- sizeof(param->value.d), index);
+ return ENUM_USING(st_c_param_list, &param->value.d,
+ sizeof(param->value.d), index);
default: {
- gs_param_typed_value value;
+ gs_param_typed_value value;
- value.value = *(const gs_param_value *)&param->value;
- value.type = param->type;
- return gs_param_typed_value_enum_ptrs(mem, &value, sizeof(value), index,
- pep, NULL, gcst);
+ value.value = *(const gs_param_value *)&param->value;
+ value.type = param->type;
+ return gs_param_typed_value_enum_ptrs(mem, &value, sizeof(value), index,
+ pep, NULL, gcst);
}
}
}
@@ -79,39 +79,39 @@ case 0: return ENUM_OBJ(param->next);
case 1: return ENUM_OBJ(param->alternate_typed_data);
case 2:
if (!param->key.persistent) {
- gs_const_string key;
+ gs_const_string key;
- key.data = param->key.data;
- key.size = param->key.size;
- return ENUM_STRING(&key);
+ key.data = param->key.data;
+ key.size = param->key.size;
+ return ENUM_STRING(&key);
} else
- return ENUM_OBJ(0); /* keep going */
+ return ENUM_OBJ(0); /* keep going */
ENUM_PTRS_END
RELOC_PTRS_WITH(c_param_reloc_ptrs, gs_c_param *param) {
RELOC_VAR(param->next);
RELOC_VAR(param->alternate_typed_data);
if (!param->key.persistent) {
- gs_const_string key;
+ gs_const_string key;
- key.data = param->key.data;
- key.size = param->key.size;
- RELOC_CONST_STRING_VAR(key);
- param->key.data = key.data;
+ key.data = param->key.data;
+ key.size = param->key.size;
+ RELOC_CONST_STRING_VAR(key);
+ param->key.data = key.data;
}
switch (param->type) {
- /* Only the aggregate types are handled specially. */
+ /* Only the aggregate types are handled specially. */
case gs_param_type_dict:
case gs_param_type_dict_int_keys:
case gs_param_type_array:
- RELOC_USING(st_c_param_list, &param->value.d, sizeof(param->value.d));
- break;
+ RELOC_USING(st_c_param_list, &param->value.d, sizeof(param->value.d));
+ break;
default: {
- gs_param_typed_value value;
+ gs_param_typed_value value;
- value.value = *(gs_param_value *)&param->value;
- value.type = param->type;
- gs_param_typed_value_reloc_ptrs(&value, sizeof(value), NULL, gcst);
- *(gs_param_value *)&param->value = value.value;
+ value.value = *(gs_param_value *)&param->value;
+ value.type = param->type;
+ gs_param_typed_value_reloc_ptrs(&value, sizeof(value), NULL, gcst);
+ *(gs_param_value *)&param->value = value.value;
}
}
}
@@ -132,8 +132,8 @@ c_param_find(const gs_c_param_list *plist, gs_param_name pkey, bool any)
uint len = strlen(pkey);
for (; pparam != 0; pparam = pparam->next)
- if (pparam->key.size == len && !memcmp(pparam->key.data, pkey, len))
- return (pparam->type != gs_param_type_any || any ? pparam : 0);
+ if (pparam->key.size == len && !memcmp(pparam->key.data, pkey, len))
+ return (pparam->type != gs_param_type_any || any ? pparam : 0);
return 0;
}
@@ -191,38 +191,38 @@ gs_c_param_list_release(gs_c_param_list * plist)
gs_c_param *pparam;
while ((pparam = plist->head) != 0) {
- gs_c_param *next = pparam->next;
-
- switch (pparam->type) {
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- case gs_param_type_array:
- gs_c_param_list_release(&pparam->value.d);
- break;
- case gs_param_type_string:
- case gs_param_type_name:
- case gs_param_type_int_array:
- case gs_param_type_float_array:
- case gs_param_type_string_array:
- case gs_param_type_name_array:
- if (!pparam->value.s.persistent)
- gs_free_const_object(mem, pparam->value.s.data,
- "gs_c_param_list_release data");
- break;
- default:
- break;
- }
- if (pparam->free_key) {
- /* We allocated this, so we must free it. */
- gs_free_const_string(mem, pparam->key.data, pparam->key.size,
- "gs_c_param_list_release key");
- }
- gs_free_object(mem, pparam->alternate_typed_data,
- "gs_c_param_list_release alternate data");
- gs_free_object(mem, pparam,
- "gs_c_param_list_release entry");
- plist->head = next;
- plist->count--;
+ gs_c_param *next = pparam->next;
+
+ switch (pparam->type) {
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ case gs_param_type_array:
+ gs_c_param_list_release(&pparam->value.d);
+ break;
+ case gs_param_type_string:
+ case gs_param_type_name:
+ case gs_param_type_int_array:
+ case gs_param_type_float_array:
+ case gs_param_type_string_array:
+ case gs_param_type_name_array:
+ if (!pparam->value.s.persistent)
+ gs_free_const_object(mem, pparam->value.s.data,
+ "gs_c_param_list_release data");
+ break;
+ default:
+ break;
+ }
+ if (pparam->free_key) {
+ /* We allocated this, so we must free it. */
+ gs_free_const_string(mem, pparam->key.data, pparam->key.size,
+ "gs_c_param_list_release key");
+ }
+ gs_free_object(mem, pparam->alternate_typed_data,
+ "gs_c_param_list_release alternate data");
+ gs_free_object(mem, pparam,
+ "gs_c_param_list_release entry");
+ plist->head = next;
+ plist->count--;
}
}
@@ -231,29 +231,29 @@ static gs_c_param *
c_param_add(gs_c_param_list * plist, gs_param_name pkey)
{
gs_c_param *pparam =
- gs_alloc_struct(plist->memory, gs_c_param, &st_c_param,
- "c_param_add entry");
+ gs_alloc_struct(plist->memory, gs_c_param, &st_c_param,
+ "c_param_add entry");
uint len = strlen(pkey);
if (pparam == 0)
- return 0;
+ return 0;
pparam->next = plist->head;
if (!plist->persistent_keys) {
- /* We must copy the key. */
- byte *str = gs_alloc_string(plist->memory, len, "c_param_add key");
-
- if (str == 0) {
- gs_free_object(plist->memory, pparam, "c_param_add entry");
- return 0;
- }
- memcpy(str, pkey, len);
- pparam->key.data = str;
- pparam->key.persistent = false; /* we will free it */
- pparam->free_key = true;
+ /* We must copy the key. */
+ byte *str = gs_alloc_string(plist->memory, len, "c_param_add key");
+
+ if (str == 0) {
+ gs_free_object(plist->memory, pparam, "c_param_add entry");
+ return 0;
+ }
+ memcpy(str, pkey, len);
+ pparam->key.data = str;
+ pparam->key.persistent = false; /* we will free it */
+ pparam->free_key = true;
} else {
- pparam->key.data = (const byte *)pkey;
- pparam->key.persistent = true;
- pparam->free_key = false;
+ pparam->key.data = (const byte *)pkey;
+ pparam->key.persistent = true;
+ pparam->free_key = false;
}
pparam->key.size = len;
pparam->alternate_typed_data = 0;
@@ -263,75 +263,75 @@ c_param_add(gs_c_param_list * plist, gs_param_name pkey)
/* Write a dynamically typed parameter to a list. */
static int
c_param_write(gs_c_param_list * plist, gs_param_name pkey, void *pvalue,
- gs_param_type type)
+ gs_param_type type)
{
unsigned top_level_sizeof = 0;
unsigned second_level_sizeof = 0;
gs_c_param *pparam = c_param_add(plist, pkey);
if (pparam == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(&pparam->value, pvalue, gs_param_type_sizes[(int)type]);
pparam->type = type;
/* Need deeper copies of data if it's not persistent */
switch (type) {
- gs_param_string const *curr_string;
- gs_param_string const *end_string;
-
- case gs_param_type_string_array:
- case gs_param_type_name_array:
- /* Determine how much mem needed to hold actual string data */
- curr_string = pparam->value.sa.data;
- end_string = curr_string + pparam->value.sa.size;
- for (; curr_string < end_string; ++curr_string)
- if (!curr_string->persistent)
- second_level_sizeof += curr_string->size;
- /* fall thru */
-
- case gs_param_type_string:
- case gs_param_type_name:
- case gs_param_type_int_array:
- case gs_param_type_float_array:
- if (!pparam->value.s.persistent) { /* Allocate & copy object pointed to by array or string */
- byte *top_level_memory = NULL;
-
- top_level_sizeof =
- pparam->value.s.size * gs_param_type_base_sizes[type];
- if (top_level_sizeof + second_level_sizeof > 0) {
- top_level_memory =
- gs_alloc_bytes_immovable(plist->memory,
- top_level_sizeof + second_level_sizeof,
- "c_param_write data");
- if (top_level_memory == 0) {
- gs_free_object(plist->memory, pparam, "c_param_write entry");
- return_error(gs_error_VMerror);
- }
- memcpy(top_level_memory, pparam->value.s.data, top_level_sizeof);
- }
- pparam->value.s.data = top_level_memory;
-
- /* String/name arrays need to copy actual str data */
-
- if (second_level_sizeof > 0) {
- byte *second_level_memory =
- top_level_memory + top_level_sizeof;
-
- curr_string = pparam->value.sa.data;
- end_string = curr_string + pparam->value.sa.size;
- for (; curr_string < end_string; ++curr_string)
- if (!curr_string->persistent) {
- memcpy(second_level_memory,
- curr_string->data, curr_string->size);
- ((gs_param_string *) curr_string)->data
- = second_level_memory;
- second_level_memory += curr_string->size;
- }
- }
- }
- break;
- default:
- break;
+ gs_param_string const *curr_string;
+ gs_param_string const *end_string;
+
+ case gs_param_type_string_array:
+ case gs_param_type_name_array:
+ /* Determine how much mem needed to hold actual string data */
+ curr_string = pparam->value.sa.data;
+ end_string = curr_string + pparam->value.sa.size;
+ for (; curr_string < end_string; ++curr_string)
+ if (!curr_string->persistent)
+ second_level_sizeof += curr_string->size;
+ /* fall thru */
+
+ case gs_param_type_string:
+ case gs_param_type_name:
+ case gs_param_type_int_array:
+ case gs_param_type_float_array:
+ if (!pparam->value.s.persistent) { /* Allocate & copy object pointed to by array or string */
+ byte *top_level_memory = NULL;
+
+ top_level_sizeof =
+ pparam->value.s.size * gs_param_type_base_sizes[type];
+ if (top_level_sizeof + second_level_sizeof > 0) {
+ top_level_memory =
+ gs_alloc_bytes_immovable(plist->memory,
+ top_level_sizeof + second_level_sizeof,
+ "c_param_write data");
+ if (top_level_memory == 0) {
+ gs_free_object(plist->memory, pparam, "c_param_write entry");
+ return_error(gs_error_VMerror);
+ }
+ memcpy(top_level_memory, pparam->value.s.data, top_level_sizeof);
+ }
+ pparam->value.s.data = top_level_memory;
+
+ /* String/name arrays need to copy actual str data */
+
+ if (second_level_sizeof > 0) {
+ byte *second_level_memory =
+ top_level_memory + top_level_sizeof;
+
+ curr_string = pparam->value.sa.data;
+ end_string = curr_string + pparam->value.sa.size;
+ for (; curr_string < end_string; ++curr_string)
+ if (!curr_string->persistent) {
+ memcpy(second_level_memory,
+ curr_string->data, curr_string->size);
+ ((gs_param_string *) curr_string)->data
+ = second_level_memory;
+ second_level_memory += curr_string->size;
+ }
+ }
+ }
+ break;
+ default:
+ break;
}
plist->head = pparam;
@@ -342,15 +342,15 @@ c_param_write(gs_c_param_list * plist, gs_param_name pkey, void *pvalue,
/* Individual writing routines. */
static int
c_param_begin_write_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue, gs_param_collection_type_t coll_type)
+ gs_param_dict * pvalue, gs_param_collection_type_t coll_type)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_c_param_list *dlist =
- gs_c_param_list_alloc(cplist->memory,
- "c_param_begin_write_collection");
+ gs_c_param_list_alloc(cplist->memory,
+ "c_param_begin_write_collection");
if (dlist == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gs_c_param_list_write(dlist, cplist->memory);
dlist->coll_type = coll_type;
pvalue->list = (gs_param_list *) dlist;
@@ -358,39 +358,39 @@ c_param_begin_write_collection(gs_param_list * plist, gs_param_name pkey,
}
static int
c_param_end_write_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue)
+ gs_param_dict * pvalue)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_c_param_list *dlist = (gs_c_param_list *) pvalue->list;
return c_param_write(cplist, pkey, pvalue->list,
- (dlist->coll_type == gs_param_collection_dict_int_keys ?
- gs_param_type_dict_int_keys :
- dlist->coll_type == gs_param_collection_array ?
- gs_param_type_array : gs_param_type_dict));
+ (dlist->coll_type == gs_param_collection_dict_int_keys ?
+ gs_param_type_dict_int_keys :
+ dlist->coll_type == gs_param_collection_array ?
+ gs_param_type_array : gs_param_type_dict));
}
static int
c_param_write_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_param_collection_type_t coll_type;
switch (pvalue->type) {
- case gs_param_type_dict:
- coll_type = gs_param_collection_dict_any;
- break;
- case gs_param_type_dict_int_keys:
- coll_type = gs_param_collection_dict_int_keys;
- break;
- case gs_param_type_array:
- coll_type = gs_param_collection_array;
- break;
- default:
- return c_param_write(cplist, pkey, &pvalue->value, pvalue->type);
+ case gs_param_type_dict:
+ coll_type = gs_param_collection_dict_any;
+ break;
+ case gs_param_type_dict_int_keys:
+ coll_type = gs_param_collection_dict_int_keys;
+ break;
+ case gs_param_type_array:
+ coll_type = gs_param_collection_array;
+ break;
+ default:
+ return c_param_write(cplist, pkey, &pvalue->value, pvalue->type);
}
return c_param_begin_write_collection
- (plist, pkey, &pvalue->value.d, coll_type);
+ (plist, pkey, &pvalue->value.d, coll_type);
}
/* Other procedures */
@@ -403,10 +403,10 @@ c_param_request(gs_param_list * plist, gs_param_name pkey)
cplist->any_requested = true;
if (c_param_find(cplist, pkey, true))
- return 0;
+ return 0;
pparam = c_param_add(cplist, pkey);
if (pparam == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pparam->type = gs_param_type_any; /* mark as undefined */
cplist->head = pparam;
return 0;
@@ -420,11 +420,11 @@ c_param_requested(const gs_param_list * plist, gs_param_name pkey)
int code;
if (!cplist->any_requested)
- return (target ? param_requested(target, pkey) : -1);
+ return (target ? param_requested(target, pkey) : -1);
if (c_param_find(cplist, pkey, true) != 0)
- return 1;
+ return 1;
if (!target)
- return 0;
+ return 0;
code = param_requested(target, pkey);
return (code < 0 ? 0 : 1);
}
@@ -462,7 +462,7 @@ gs_c_param_list_read(gs_c_param_list * plist)
static int
c_param_read_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_param_type req_type = pvalue->type;
@@ -470,50 +470,50 @@ c_param_read_typed(gs_param_list * plist, gs_param_name pkey,
int code;
if (pparam == 0)
- return (cplist->target ?
- param_read_typed(cplist->target, pkey, pvalue) : 1);
+ return (cplist->target ?
+ param_read_typed(cplist->target, pkey, pvalue) : 1);
pvalue->type = pparam->type;
switch (pvalue->type) {
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- case gs_param_type_array:
- gs_c_param_list_read(&pparam->value.d);
- pvalue->value.d.list = (gs_param_list *) & pparam->value.d;
- pvalue->value.d.size = pparam->value.d.count;
- return 0;
- default:
- break;
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ case gs_param_type_array:
+ gs_c_param_list_read(&pparam->value.d);
+ pvalue->value.d.list = (gs_param_list *) & pparam->value.d;
+ pvalue->value.d.size = pparam->value.d.count;
+ return 0;
+ default:
+ break;
}
memcpy(&pvalue->value, &pparam->value,
- gs_param_type_sizes[(int)pparam->type]);
+ gs_param_type_sizes[(int)pparam->type]);
code = param_coerce_typed(pvalue, req_type, NULL);
/****** SHOULD LET param_coerce_typed DO THIS ******/
if (code == gs_error_typecheck &&
- req_type == gs_param_type_float_array &&
- pvalue->type == gs_param_type_int_array
- ) {
- /* Convert int array to float dest */
- gs_param_float_array fa;
- int element;
-
- fa.size = pparam->value.ia.size;
- fa.persistent = false;
-
- if (pparam->alternate_typed_data == 0) {
- if ((pparam->alternate_typed_data
- = (void *)gs_alloc_bytes_immovable(cplist->memory,
- fa.size * sizeof(float),
- "gs_c_param_read alternate float array")) == 0)
- return_error(gs_error_VMerror);
-
- for (element = 0; element < fa.size; ++element)
- ((float *)(pparam->alternate_typed_data))[element]
- = (float)pparam->value.ia.data[element];
- }
- fa.data = (float *)pparam->alternate_typed_data;
-
- pvalue->value.fa = fa;
- return 0;
+ req_type == gs_param_type_float_array &&
+ pvalue->type == gs_param_type_int_array
+ ) {
+ /* Convert int array to float dest */
+ gs_param_float_array fa;
+ int element;
+
+ fa.size = pparam->value.ia.size;
+ fa.persistent = false;
+
+ if (pparam->alternate_typed_data == 0) {
+ if ((pparam->alternate_typed_data
+ = (void *)gs_alloc_bytes_immovable(cplist->memory,
+ fa.size * sizeof(float),
+ "gs_c_param_read alternate float array")) == 0)
+ return_error(gs_error_VMerror);
+
+ for (element = 0; element < fa.size; ++element)
+ ((float *)(pparam->alternate_typed_data))[element]
+ = (float)pparam->value.ia.data[element];
+ }
+ fa.data = (float *)pparam->alternate_typed_data;
+
+ pvalue->value.fa = fa;
+ return 0;
}
return code;
}
@@ -521,30 +521,30 @@ c_param_read_typed(gs_param_list * plist, gs_param_name pkey,
/* Individual reading routines. */
static int
c_param_begin_read_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue, gs_param_collection_type_t coll_type)
+ gs_param_dict * pvalue, gs_param_collection_type_t coll_type)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_c_param *pparam = c_param_find(cplist, pkey, false);
if (pparam == 0)
- return
- (cplist->target ?
- param_begin_read_collection(cplist->target,
- pkey, pvalue, coll_type) :
- 1);
+ return
+ (cplist->target ?
+ param_begin_read_collection(cplist->target,
+ pkey, pvalue, coll_type) :
+ 1);
switch (pparam->type) {
- case gs_param_type_dict:
- if (coll_type != gs_param_collection_dict_any)
- return_error(gs_error_typecheck);
- break;
- case gs_param_type_dict_int_keys:
- if (coll_type == gs_param_collection_array)
- return_error(gs_error_typecheck);
- break;
- case gs_param_type_array:
- break;
- default:
- return_error(gs_error_typecheck);
+ case gs_param_type_dict:
+ if (coll_type != gs_param_collection_dict_any)
+ return_error(gs_error_typecheck);
+ break;
+ case gs_param_type_dict_int_keys:
+ if (coll_type == gs_param_collection_array)
+ return_error(gs_error_typecheck);
+ break;
+ case gs_param_type_array:
+ break;
+ default:
+ return_error(gs_error_typecheck);
}
gs_c_param_list_read(&pparam->value.d);
pvalue->list = (gs_param_list *) & pparam->value.d;
@@ -553,7 +553,7 @@ c_param_begin_read_collection(gs_param_list * plist, gs_param_name pkey,
}
static int
c_param_end_read_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue)
+ gs_param_dict * pvalue)
{
return 0;
}
@@ -561,7 +561,7 @@ c_param_end_read_collection(gs_param_list * plist, gs_param_name pkey,
/* Other procedures */
static int /* ret 0 ok, 1 if EOF, or -ve err */
c_param_get_next_key(gs_param_list * plist, gs_param_enumerator_t * penum,
- gs_param_key_t * key)
+ gs_param_key_t * key)
{
gs_c_param_list *const cplist = (gs_c_param_list *)plist;
gs_c_param *pparam =
@@ -569,7 +569,7 @@ c_param_get_next_key(gs_param_list * plist, gs_param_enumerator_t * penum,
cplist->head);
if (pparam == 0)
- return 1;
+ return 1;
penum->pvoid = pparam;
*key = pparam->key;
return 0;
diff --git a/gs/base/gscpixel.c b/gs/base/gscpixel.c
index 37d03fca7..25a52ff0f 100644
--- a/gs/base/gscpixel.c
+++ b/gs/base/gscpixel.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,20 +51,20 @@ gs_cspace_new_DevicePixel(gs_memory_t *mem, gs_color_space **ppcs, int depth)
gs_color_space *pcs;
switch (depth) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 16:
- case 24:
- case 32:
- break;
- default:
- return_error(gs_error_rangecheck);
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
pcs = gs_cspace_alloc(mem, &gs_color_space_type_DevicePixel);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcs->params.pixel.depth = depth;
*ppcs = pcs;
return 0;
@@ -83,12 +83,11 @@ gx_restrict_DevicePixel(gs_client_color * pcc, const gs_color_space * pcs)
pcc->paint.values[0] = (pixel < 0 ? 0 : min(pixel, max_value));
}
-
/* Remap a DevicePixel color. */
static int
gx_concretize_DevicePixel(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
/****** NOT ENOUGH BITS IN float OR frac ******/
pconc[0] = (frac) (ulong) pc->paint.values[0];
@@ -97,8 +96,8 @@ gx_concretize_DevicePixel(const gs_client_color * pc, const gs_color_space * pcs
static int
gx_remap_concrete_DevicePixel(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
color_set_pure(pdc, pconc[0] & ((1 << dev->color_info.depth) - 1));
return 0;
@@ -115,10 +114,9 @@ gx_set_overprint_DevicePixel(const gs_color_space * pcs, gs_state * pgs)
return gs_state_update_overprint(pgs, &params);
}
-
/* ---------------- Serialization. -------------------------------- */
-static int
+static int
gx_serialize_DevicePixel(const gs_color_space * pcs, stream * s)
{
const gs_device_pixel_params * p = &pcs->params.pixel;
@@ -126,6 +124,6 @@ gx_serialize_DevicePixel(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->depth, sizeof(p->depth), &n);
}
diff --git a/gs/base/gscpixel.h b/gs/base/gscpixel.h
index e9a0d12e1..b4fddc626 100644
--- a/gs/base/gscpixel.h
+++ b/gs/base/gscpixel.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,6 +20,6 @@
/* Construct a new DevicePixel color space. */
int gs_cspace_new_DevicePixel(gs_memory_t *mem, gs_color_space **ppcs,
- int depth);
+ int depth);
#endif /* gscpixel_INCLUDED */
diff --git a/gs/base/gscpm.h b/gs/base/gscpm.h
index a53e0eb59..2fce307d0 100644
--- a/gs/base/gscpm.h
+++ b/gs/base/gscpm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscrd.c b/gs/base/gscrd.c
index 802d002f4..ddc9da181 100644
--- a/gs/base/gscrd.c
+++ b/gs/base/gscrd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,13 +33,13 @@ extern_gs_lib_device_list();
/* Allocator structure type */
public_st_cie_render1();
-static
+static
ENUM_PTRS_WITH(cie_render1_enum_ptrs, gs_cie_render *pcrd) return 0;
case 0: return ENUM_OBJ(pcrd->client_data);
case 1: return ENUM_OBJ(pcrd->RenderTable.lookup.table);
case 2: return (pcrd->RenderTable.lookup.table ?
- ENUM_CONST_STRING(&pcrd->TransformPQR.proc_data) :
- 0);
+ ENUM_CONST_STRING(&pcrd->TransformPQR.proc_data) :
+ 0);
ENUM_PTRS_END
static RELOC_PTRS_WITH(cie_render1_reloc_ptrs, gs_cie_render *pcrd);
RELOC_OBJ_VAR(pcrd->client_data);
@@ -54,7 +54,7 @@ RELOC_PTRS_END
static int
tpqr_identity(int index, floatp in, const gs_cie_wbsd * pwbsd,
- gs_cie_render * pcrd, float *out)
+ gs_cie_render * pcrd, float *out)
{
*out = in;
return 0;
@@ -62,7 +62,7 @@ tpqr_identity(int index, floatp in, const gs_cie_wbsd * pwbsd,
static int
tpqr_from_cache(int index, floatp in, const gs_cie_wbsd * pwbsd,
- gs_cie_render * pcrd, float *out)
+ gs_cie_render * pcrd, float *out)
{
/*
* Since the TransformPQR cache is in the joint caches, not in the
@@ -121,7 +121,7 @@ static frac
RTT_cached(byte in, const gs_cie_render * pcrd, int i)
{
return pcrd->caches.RenderTableT[i].fracs.values[
- in * (gx_cie_cache_size - 1) / 255
+ in * (gx_cie_cache_size - 1) / 255
];
}
static frac
@@ -159,23 +159,23 @@ tpqr_do_lookup(gs_cie_render *pcrd, const gx_device *dev_proto)
/* Device prototypes are const, so we must create a copy. */
code = gs_copydevice(&dev, dev_proto, mem);
if (code < 0)
- return code;
+ return code;
gs_c_param_list_write(&list, mem);
code = param_request((gs_param_list *)&list,
- pcrd->TransformPQR.proc_name);
+ pcrd->TransformPQR.proc_name);
if (code >= 0) {
- code = gs_getdeviceparams(dev, (gs_param_list *)&list);
- if (code >= 0) {
- gs_c_param_list_read(&list);
- code = param_read_string((gs_param_list *)&list,
- pcrd->TransformPQR.proc_name,
- &proc_addr);
- if (code == 0 && proc_addr.size == sizeof(gs_cie_transform_proc)) {
- memcpy(&pcrd->TransformPQR.proc, proc_addr.data,
- sizeof(gs_cie_transform_proc));
- } else
- code = gs_note_error(gs_error_rangecheck);
- }
+ code = gs_getdeviceparams(dev, (gs_param_list *)&list);
+ if (code >= 0) {
+ gs_c_param_list_read(&list);
+ code = param_read_string((gs_param_list *)&list,
+ pcrd->TransformPQR.proc_name,
+ &proc_addr);
+ if (code == 0 && proc_addr.size == sizeof(gs_cie_transform_proc)) {
+ memcpy(&pcrd->TransformPQR.proc, proc_addr.data,
+ sizeof(gs_cie_transform_proc));
+ } else
+ code = gs_note_error(gs_error_rangecheck);
+ }
}
gs_c_param_list_release(&list);
gs_free_object(mem, dev, "tpqr_do_lookup(device)");
@@ -183,7 +183,7 @@ tpqr_do_lookup(gs_cie_render *pcrd, const gx_device *dev_proto)
}
static int
tpqr_lookup(int index, floatp in, const gs_cie_wbsd * pwbsd,
- gs_cie_render * pcrd, float *out)
+ gs_cie_render * pcrd, float *out)
{
const gx_device *const *dev_list;
int count = gs_lib_device_list(&dev_list, NULL);
@@ -191,19 +191,18 @@ tpqr_lookup(int index, floatp in, const gs_cie_wbsd * pwbsd,
int code;
for (i = 0; i < count; ++i)
- if (!strcmp(gs_devicename(dev_list[i]),
- pcrd->TransformPQR.driver_name))
- break;
+ if (!strcmp(gs_devicename(dev_list[i]),
+ pcrd->TransformPQR.driver_name))
+ break;
if (i < count)
- code = tpqr_do_lookup(pcrd, dev_list[i]);
+ code = tpqr_do_lookup(pcrd, dev_list[i]);
else
- code = gs_note_error(gs_error_undefined);
+ code = gs_note_error(gs_error_undefined);
if (code < 0)
- return code;
+ return code;
return pcrd->TransformPQR.proc(index, in, pwbsd, pcrd, out);
}
-
/* Default vectors. */
const gs_cie_transform_proc3 TransformPQR_default = {
tpqr_identity,
@@ -246,12 +245,12 @@ const gs_cie_render_table_procs RenderTableT_from_cache = {
*/
int
gs_cie_render1_build(gs_cie_render ** ppcrd, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
gs_cie_render *pcrd;
rc_alloc_struct_1(pcrd, gs_cie_render, &st_cie_render1, mem,
- return_error(gs_error_VMerror), cname);
+ return_error(gs_error_VMerror), cname);
pcrd->id = gs_next_ids(mem, 1);
/* Initialize pointers for the GC. */
pcrd->client_data = 0;
@@ -277,63 +276,63 @@ gs_cie_render1_build(gs_cie_render ** ppcrd, gs_memory_t * mem,
*/
int
gs_cie_render1_init_from(const gs_memory_t *mem,
- gs_cie_render * pcrd,
- void *client_data,
- const gs_cie_render * pfrom_crd,
- const gs_vector3 * WhitePoint,
- const gs_vector3 * BlackPoint,
- const gs_matrix3 * MatrixPQR,
- const gs_range3 * RangePQR,
- const gs_cie_transform_proc3 * TransformPQR,
- const gs_matrix3 * MatrixLMN,
- const gs_cie_render_proc3 * EncodeLMN,
- const gs_range3 * RangeLMN,
- const gs_matrix3 * MatrixABC,
- const gs_cie_render_proc3 * EncodeABC,
- const gs_range3 * RangeABC,
- const gs_cie_render_table_t * RenderTable)
+ gs_cie_render * pcrd,
+ void *client_data,
+ const gs_cie_render * pfrom_crd,
+ const gs_vector3 * WhitePoint,
+ const gs_vector3 * BlackPoint,
+ const gs_matrix3 * MatrixPQR,
+ const gs_range3 * RangePQR,
+ const gs_cie_transform_proc3 * TransformPQR,
+ const gs_matrix3 * MatrixLMN,
+ const gs_cie_render_proc3 * EncodeLMN,
+ const gs_range3 * RangeLMN,
+ const gs_matrix3 * MatrixABC,
+ const gs_cie_render_proc3 * EncodeABC,
+ const gs_range3 * RangeABC,
+ const gs_cie_render_table_t * RenderTable)
{
pcrd->id = gs_next_ids(mem, 1);
pcrd->client_data = client_data;
pcrd->points.WhitePoint = *WhitePoint;
pcrd->points.BlackPoint =
- *(BlackPoint ? BlackPoint : &BlackPoint_default);
+ *(BlackPoint ? BlackPoint : &BlackPoint_default);
pcrd->MatrixPQR = *(MatrixPQR ? MatrixPQR : &Matrix3_default);
pcrd->RangePQR = *(RangePQR ? RangePQR : &Range3_default);
pcrd->TransformPQR =
- *(TransformPQR ? TransformPQR : &TransformPQR_default);
+ *(TransformPQR ? TransformPQR : &TransformPQR_default);
pcrd->MatrixLMN = *(MatrixLMN ? MatrixLMN : &Matrix3_default);
pcrd->EncodeLMN = *(EncodeLMN ? EncodeLMN : &Encode_default);
if (pfrom_crd &&
- !memcmp(&pcrd->EncodeLMN, &EncodeLMN_from_cache,
- sizeof(EncodeLMN_from_cache))
- )
- memcpy(&pcrd->caches.EncodeLMN, &pfrom_crd->caches.EncodeLMN,
- sizeof(pcrd->caches.EncodeLMN));
+ !memcmp(&pcrd->EncodeLMN, &EncodeLMN_from_cache,
+ sizeof(EncodeLMN_from_cache))
+ )
+ memcpy(&pcrd->caches.EncodeLMN, &pfrom_crd->caches.EncodeLMN,
+ sizeof(pcrd->caches.EncodeLMN));
pcrd->RangeLMN = *(RangeLMN ? RangeLMN : &Range3_default);
pcrd->MatrixABC = *(MatrixABC ? MatrixABC : &Matrix3_default);
pcrd->EncodeABC = *(EncodeABC ? EncodeABC : &Encode_default);
if (pfrom_crd &&
- !memcmp(&pcrd->EncodeABC, &EncodeABC_from_cache,
- sizeof(EncodeABC_from_cache))
- )
- memcpy(pcrd->caches.EncodeABC, pfrom_crd->caches.EncodeABC,
- sizeof(pcrd->caches.EncodeABC));
+ !memcmp(&pcrd->EncodeABC, &EncodeABC_from_cache,
+ sizeof(EncodeABC_from_cache))
+ )
+ memcpy(pcrd->caches.EncodeABC, pfrom_crd->caches.EncodeABC,
+ sizeof(pcrd->caches.EncodeABC));
pcrd->RangeABC = *(RangeABC ? RangeABC : &Range3_default);
if (RenderTable) {
- pcrd->RenderTable = *RenderTable;
- if (pfrom_crd &&
- !memcmp(&pcrd->RenderTable.T, &RenderTableT_from_cache,
- sizeof(RenderTableT_from_cache))
- ) {
- memcpy(pcrd->caches.RenderTableT, pfrom_crd->caches.RenderTableT,
- sizeof(pcrd->caches.RenderTableT));
- pcrd->caches.RenderTableT_is_identity =
- pfrom_crd->caches.RenderTableT_is_identity;
- }
+ pcrd->RenderTable = *RenderTable;
+ if (pfrom_crd &&
+ !memcmp(&pcrd->RenderTable.T, &RenderTableT_from_cache,
+ sizeof(RenderTableT_from_cache))
+ ) {
+ memcpy(pcrd->caches.RenderTableT, pfrom_crd->caches.RenderTableT,
+ sizeof(pcrd->caches.RenderTableT));
+ pcrd->caches.RenderTableT_is_identity =
+ pfrom_crd->caches.RenderTableT_is_identity;
+ }
} else {
- pcrd->RenderTable.lookup.table = 0;
- pcrd->RenderTable.T = RenderTableT_default;
+ pcrd->RenderTable.lookup.table = 0;
+ pcrd->RenderTable.T = RenderTableT_default;
}
pcrd->status = CIE_RENDER_STATUS_BUILT;
return 0;
@@ -343,24 +342,24 @@ gs_cie_render1_init_from(const gs_memory_t *mem,
*/
int
gs_cie_render1_initialize(const gs_memory_t *mem,
- gs_cie_render * pcrd, void *client_data,
- const gs_vector3 * WhitePoint,
- const gs_vector3 * BlackPoint,
- const gs_matrix3 * MatrixPQR,
- const gs_range3 * RangePQR,
- const gs_cie_transform_proc3 * TransformPQR,
- const gs_matrix3 * MatrixLMN,
- const gs_cie_render_proc3 * EncodeLMN,
- const gs_range3 * RangeLMN,
- const gs_matrix3 * MatrixABC,
- const gs_cie_render_proc3 * EncodeABC,
- const gs_range3 * RangeABC,
- const gs_cie_render_table_t * RenderTable)
+ gs_cie_render * pcrd, void *client_data,
+ const gs_vector3 * WhitePoint,
+ const gs_vector3 * BlackPoint,
+ const gs_matrix3 * MatrixPQR,
+ const gs_range3 * RangePQR,
+ const gs_cie_transform_proc3 * TransformPQR,
+ const gs_matrix3 * MatrixLMN,
+ const gs_cie_render_proc3 * EncodeLMN,
+ const gs_range3 * RangeLMN,
+ const gs_matrix3 * MatrixABC,
+ const gs_cie_render_proc3 * EncodeABC,
+ const gs_range3 * RangeABC,
+ const gs_cie_render_table_t * RenderTable)
{
return gs_cie_render1_init_from(mem, pcrd, client_data, NULL,
- WhitePoint, BlackPoint,
- MatrixPQR, RangePQR, TransformPQR,
- MatrixLMN, EncodeLMN, RangeLMN,
- MatrixABC, EncodeABC, RangeABC,
- RenderTable);
+ WhitePoint, BlackPoint,
+ MatrixPQR, RangePQR, TransformPQR,
+ MatrixLMN, EncodeLMN, RangeLMN,
+ MatrixABC, EncodeABC, RangeABC,
+ RenderTable);
}
diff --git a/gs/base/gscrd.h b/gs/base/gscrd.h
index eb89e5791..1eb1b66d3 100644
--- a/gs/base/gscrd.h
+++ b/gs/base/gscrd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
*/
int
gs_cie_render1_build(gs_cie_render ** ppcrd, gs_memory_t * mem,
- client_name_t cname);
+ client_name_t cname);
/*
* Initialize a CRD given all of the relevant parameters.
@@ -48,40 +48,40 @@ int
*/
int
gs_cie_render1_init_from(const gs_memory_t *mem,
- gs_cie_render *pcrd,
- void *client_data,
- const gs_cie_render * pfrom_crd,
- const gs_vector3 * WhitePoint,
- const gs_vector3 * BlackPoint,
- const gs_matrix3 * MatrixPQR,
- const gs_range3 * RangePQR,
- const gs_cie_transform_proc3 * TransformPQR,
- const gs_matrix3 * MatrixLMN,
- const gs_cie_render_proc3 * EncodeLMN,
- const gs_range3 * RangeLMN,
- const gs_matrix3 * MatrixABC,
- const gs_cie_render_proc3 * EncodeABC,
- const gs_range3 * RangeABC,
- const gs_cie_render_table_t * RenderTable);
+ gs_cie_render *pcrd,
+ void *client_data,
+ const gs_cie_render * pfrom_crd,
+ const gs_vector3 * WhitePoint,
+ const gs_vector3 * BlackPoint,
+ const gs_matrix3 * MatrixPQR,
+ const gs_range3 * RangePQR,
+ const gs_cie_transform_proc3 * TransformPQR,
+ const gs_matrix3 * MatrixLMN,
+ const gs_cie_render_proc3 * EncodeLMN,
+ const gs_range3 * RangeLMN,
+ const gs_matrix3 * MatrixABC,
+ const gs_cie_render_proc3 * EncodeABC,
+ const gs_range3 * RangeABC,
+ const gs_cie_render_table_t * RenderTable);
/*
* Initialize a CRD without the option of copying cached values.
*/
int
- gs_cie_render1_initialize(const gs_memory_t *mem,
- gs_cie_render *pcrd,
- void *client_data,
- const gs_vector3 * WhitePoint,
- const gs_vector3 * BlackPoint,
- const gs_matrix3 * MatrixPQR,
- const gs_range3 * RangePQR,
- const gs_cie_transform_proc3 * TransformPQR,
- const gs_matrix3 * MatrixLMN,
- const gs_cie_render_proc3 * EncodeLMN,
- const gs_range3 * RangeLMN,
- const gs_matrix3 * MatrixABC,
- const gs_cie_render_proc3 * EncodeABC,
- const gs_range3 * RangeABC,
- const gs_cie_render_table_t * RenderTable);
+ gs_cie_render1_initialize(const gs_memory_t *mem,
+ gs_cie_render *pcrd,
+ void *client_data,
+ const gs_vector3 * WhitePoint,
+ const gs_vector3 * BlackPoint,
+ const gs_matrix3 * MatrixPQR,
+ const gs_range3 * RangePQR,
+ const gs_cie_transform_proc3 * TransformPQR,
+ const gs_matrix3 * MatrixLMN,
+ const gs_cie_render_proc3 * EncodeLMN,
+ const gs_range3 * RangeLMN,
+ const gs_matrix3 * MatrixABC,
+ const gs_cie_render_proc3 * EncodeABC,
+ const gs_range3 * RangeABC,
+ const gs_cie_render_table_t * RenderTable);
/*
* Set or access the client_data pointer in a CRD.
diff --git a/gs/base/gscrdp.c b/gs/base/gscrdp.c
index 15daa6086..8b92fccb4 100644
--- a/gs/base/gscrdp.c
+++ b/gs/base/gscrdp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,14 +36,14 @@ store_vector3(float *p, const gs_vector3 * pvec)
}
static int
write_floats(gs_param_list * plist, gs_param_name key,
- const float *values, int size, gs_memory_t * mem)
+ const float *values, int size, gs_memory_t * mem)
{
float *p = (float *)
- gs_alloc_byte_array(mem, size, sizeof(float), "write_floats");
+ gs_alloc_byte_array(mem, size, sizeof(float), "write_floats");
gs_param_float_array fa;
if (p == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(p, values, size * sizeof(float));
fa.data = p;
@@ -53,7 +53,7 @@ write_floats(gs_param_list * plist, gs_param_name key,
}
static int
write_vector3(gs_param_list * plist, gs_param_name key,
- const gs_vector3 * pvec, gs_memory_t * mem)
+ const gs_vector3 * pvec, gs_memory_t * mem)
{
float values[3];
@@ -62,12 +62,12 @@ write_vector3(gs_param_list * plist, gs_param_name key,
}
static int
write_matrix3(gs_param_list * plist, gs_param_name key,
- const gs_matrix3 * pmat, gs_memory_t * mem)
+ const gs_matrix3 * pmat, gs_memory_t * mem)
{
float values[9];
if (!memcmp(pmat, &Matrix3_default, sizeof(*pmat)))
- return 0;
+ return 0;
store_vector3(values, &pmat->cu);
store_vector3(values + 3, &pmat->cv);
store_vector3(values + 6, &pmat->cw);
@@ -75,12 +75,12 @@ write_matrix3(gs_param_list * plist, gs_param_name key,
}
static int
write_range3(gs_param_list * plist, gs_param_name key,
- const gs_range3 * prange, gs_memory_t * mem)
+ const gs_range3 * prange, gs_memory_t * mem)
{
float values[6];
if (!memcmp(prange, &Range3_default, sizeof(*prange)))
- return 0;
+ return 0;
values[0] = prange->ranges[0].rmin, values[1] = prange->ranges[0].rmax;
values[2] = prange->ranges[1].rmin, values[3] = prange->ranges[1].rmax;
values[4] = prange->ranges[2].rmin, values[5] = prange->ranges[2].rmax;
@@ -88,8 +88,8 @@ write_range3(gs_param_list * plist, gs_param_name key,
}
static int
write_proc3(gs_param_list * plist, gs_param_name key,
- const gs_cie_render * pcrd, const gs_cie_render_proc3 * procs,
- const gs_range3 * domain, gs_memory_t * mem)
+ const gs_cie_render * pcrd, const gs_cie_render_proc3 * procs,
+ const gs_range3 * domain, gs_memory_t * mem)
{
float *values;
uint size = gx_cie_cache_size;
@@ -97,20 +97,20 @@ write_proc3(gs_param_list * plist, gs_param_name key,
int i;
if (!memcmp(procs, &Encode_default, sizeof(*procs)))
- return 0;
+ return 0;
values = (float *)gs_alloc_byte_array(mem, size * 3, sizeof(float),
- "write_proc3");
+ "write_proc3");
if (values == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < 3; ++i) {
- double base = domain->ranges[i].rmin;
- double scale = (domain->ranges[i].rmax - base) / (size - 1);
- int j;
+ double base = domain->ranges[i].rmin;
+ double scale = (domain->ranges[i].rmax - base) / (size - 1);
+ int j;
- for (j = 0; j < size; ++j)
- values[i * size + j] =
- (*procs->procs[i]) (j * scale + base, pcrd);
+ for (j = 0; j < size; ++j)
+ values[i * size + j] =
+ (*procs->procs[i]) (j * scale + base, pcrd);
}
fa.data = values;
fa.size = size * 3;
@@ -121,14 +121,14 @@ write_proc3(gs_param_list * plist, gs_param_name key,
/* Write a CRD as a device parameter. */
int
param_write_cie_render1(gs_param_list * plist, gs_param_name key,
- gs_cie_render * pcrd, gs_memory_t * mem)
+ gs_cie_render * pcrd, gs_memory_t * mem)
{
gs_param_dict dict;
int code, dcode;
dict.size = 20;
if ((code = param_begin_write_dict(plist, key, &dict, false)) < 0)
- return code;
+ return code;
code = param_put_cie_render1(dict.list, pcrd, mem);
dcode = param_end_write_dict(plist, key, &dict);
return (code < 0 ? code : dcode);
@@ -137,128 +137,128 @@ param_write_cie_render1(gs_param_list * plist, gs_param_name key,
/* Write a CRD directly to a parameter list. */
int
param_put_cie_render1(gs_param_list * plist, gs_cie_render * pcrd,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int crd_type = GX_DEVICE_CRD1_TYPE;
int code = gs_cie_render_sample(pcrd); /* we need RenderTableT_is_id' */
if (code < 0)
- return code;
+ return code;
if (pcrd->TransformPQR.proc_name) {
- gs_param_string pn, pd;
-
- param_string_from_string(pn, pcrd->TransformPQR.proc_name);
- pn.size++; /* include terminating null */
- pd.data = pcrd->TransformPQR.proc_data.data;
- pd.size = pcrd->TransformPQR.proc_data.size;
- pd.persistent = true; /****** WRONG ******/
- if ((code = param_write_name(plist, "TransformPQRName", &pn)) < 0 ||
- (code = param_write_string(plist, "TransformPQRData", &pd)) < 0
- )
- return code;
+ gs_param_string pn, pd;
+
+ param_string_from_string(pn, pcrd->TransformPQR.proc_name);
+ pn.size++; /* include terminating null */
+ pd.data = pcrd->TransformPQR.proc_data.data;
+ pd.size = pcrd->TransformPQR.proc_data.size;
+ pd.persistent = true; /****** WRONG ******/
+ if ((code = param_write_name(plist, "TransformPQRName", &pn)) < 0 ||
+ (code = param_write_string(plist, "TransformPQRData", &pd)) < 0
+ )
+ return code;
}
else if (pcrd->TransformPQR.proc != TransformPQR_default.proc) {
- /* We have no way to represent the procedure, so return an error. */
- return_error(gs_error_rangecheck);
+ /* We have no way to represent the procedure, so return an error. */
+ return_error(gs_error_rangecheck);
}
if ((code = param_write_int(plist, "ColorRenderingType", &crd_type)) < 0 ||
- (code = write_vector3(plist, "WhitePoint", &pcrd->points.WhitePoint, mem)) < 0
- )
- return code;
+ (code = write_vector3(plist, "WhitePoint", &pcrd->points.WhitePoint, mem)) < 0
+ )
+ return code;
if (memcmp(&pcrd->points.BlackPoint, &BlackPoint_default,
- sizeof(pcrd->points.BlackPoint))) {
- if ((code = write_vector3(plist, "BlackPoint", &pcrd->points.BlackPoint, mem)) < 0)
- return code;
+ sizeof(pcrd->points.BlackPoint))) {
+ if ((code = write_vector3(plist, "BlackPoint", &pcrd->points.BlackPoint, mem)) < 0)
+ return code;
}
if ((code = write_matrix3(plist, "MatrixPQR", &pcrd->MatrixPQR, mem)) < 0 ||
- (code = write_range3(plist, "RangePQR", &pcrd->RangePQR, mem)) < 0 ||
+ (code = write_range3(plist, "RangePQR", &pcrd->RangePQR, mem)) < 0 ||
/* TransformPQR is handled separately */
(code = write_matrix3(plist, "MatrixLMN", &pcrd->MatrixLMN, mem)) < 0 ||
- (code = write_proc3(plist, "EncodeLMNValues", pcrd,
- &pcrd->EncodeLMN, &pcrd->DomainLMN, mem)) < 0 ||
- (code = write_range3(plist, "RangeLMN", &pcrd->RangeLMN, mem)) < 0 ||
+ (code = write_proc3(plist, "EncodeLMNValues", pcrd,
+ &pcrd->EncodeLMN, &pcrd->DomainLMN, mem)) < 0 ||
+ (code = write_range3(plist, "RangeLMN", &pcrd->RangeLMN, mem)) < 0 ||
(code = write_matrix3(plist, "MatrixABC", &pcrd->MatrixABC, mem)) < 0 ||
- (code = write_proc3(plist, "EncodeABCValues", pcrd,
- &pcrd->EncodeABC, &pcrd->DomainABC, mem)) < 0 ||
- (code = write_range3(plist, "RangeABC", &pcrd->RangeABC, mem)) < 0
- )
- return code;
+ (code = write_proc3(plist, "EncodeABCValues", pcrd,
+ &pcrd->EncodeABC, &pcrd->DomainABC, mem)) < 0 ||
+ (code = write_range3(plist, "RangeABC", &pcrd->RangeABC, mem)) < 0
+ )
+ return code;
if (pcrd->RenderTable.lookup.table) {
- int n = pcrd->RenderTable.lookup.n;
- int m = pcrd->RenderTable.lookup.m;
- int na = pcrd->RenderTable.lookup.dims[0];
- int *size = (int *)
- gs_alloc_byte_array(mem, n + 1, sizeof(int), "RenderTableSize");
-
- /*
- * In principle, we should use gs_alloc_struct_array with a
- * type descriptor for gs_param_string. However, it is widely
- * assumed that parameter lists are transient, and don't require
- * accurate GC information; so we can get away with allocating
- * the string table as bytes.
- */
- gs_param_string *table =
- (gs_param_string *)
- gs_alloc_byte_array(mem, na, sizeof(gs_param_string),
- "RenderTableTable");
- gs_param_int_array ia;
-
- if (size == 0 || table == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- memcpy(size, pcrd->RenderTable.lookup.dims, sizeof(int) * n);
-
- size[n] = m;
- ia.data = size;
- ia.size = n + 1;
- ia.persistent = true;
- code = param_write_int_array(plist, "RenderTableSize", &ia);
- }
- if (code >= 0) {
- gs_param_string_array sa;
- int a;
-
- for (a = 0; a < na; ++a)
- table[a].data = pcrd->RenderTable.lookup.table[a].data,
- table[a].size = pcrd->RenderTable.lookup.table[a].size,
- table[a].persistent = true;
- sa.data = table;
- sa.size = na;
- sa.persistent = true;
- code = param_write_string_array(plist, "RenderTableTable", &sa);
- if (code >= 0 && !pcrd->caches.RenderTableT_is_identity) {
- /****** WRITE RenderTableTValues LIKE write_proc3 ******/
- uint size = gx_cie_cache_size;
- float *values =
- (float *)gs_alloc_byte_array(mem, size * m,
- sizeof(float),
- "write_proc3");
- gs_param_float_array fa;
- int i;
-
- if (values == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < m; ++i) {
- double scale = 255.0 / (size - 1);
- int j;
-
- for (j = 0; j < size; ++j)
- values[i * size + j] =
- frac2float((*pcrd->RenderTable.T.procs[i])
- ((byte)(j * scale), pcrd));
- }
- fa.data = values;
- fa.size = size * m;
- fa.persistent = true;
- code = param_write_float_array(plist, "RenderTableTValues",
- &fa);
- }
- }
- if (code < 0) {
- gs_free_object(mem, table, "RenderTableTable");
- gs_free_object(mem, size, "RenderTableSize");
- return code;
- }
+ int n = pcrd->RenderTable.lookup.n;
+ int m = pcrd->RenderTable.lookup.m;
+ int na = pcrd->RenderTable.lookup.dims[0];
+ int *size = (int *)
+ gs_alloc_byte_array(mem, n + 1, sizeof(int), "RenderTableSize");
+
+ /*
+ * In principle, we should use gs_alloc_struct_array with a
+ * type descriptor for gs_param_string. However, it is widely
+ * assumed that parameter lists are transient, and don't require
+ * accurate GC information; so we can get away with allocating
+ * the string table as bytes.
+ */
+ gs_param_string *table =
+ (gs_param_string *)
+ gs_alloc_byte_array(mem, na, sizeof(gs_param_string),
+ "RenderTableTable");
+ gs_param_int_array ia;
+
+ if (size == 0 || table == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ memcpy(size, pcrd->RenderTable.lookup.dims, sizeof(int) * n);
+
+ size[n] = m;
+ ia.data = size;
+ ia.size = n + 1;
+ ia.persistent = true;
+ code = param_write_int_array(plist, "RenderTableSize", &ia);
+ }
+ if (code >= 0) {
+ gs_param_string_array sa;
+ int a;
+
+ for (a = 0; a < na; ++a)
+ table[a].data = pcrd->RenderTable.lookup.table[a].data,
+ table[a].size = pcrd->RenderTable.lookup.table[a].size,
+ table[a].persistent = true;
+ sa.data = table;
+ sa.size = na;
+ sa.persistent = true;
+ code = param_write_string_array(plist, "RenderTableTable", &sa);
+ if (code >= 0 && !pcrd->caches.RenderTableT_is_identity) {
+ /****** WRITE RenderTableTValues LIKE write_proc3 ******/
+ uint size = gx_cie_cache_size;
+ float *values =
+ (float *)gs_alloc_byte_array(mem, size * m,
+ sizeof(float),
+ "write_proc3");
+ gs_param_float_array fa;
+ int i;
+
+ if (values == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < m; ++i) {
+ double scale = 255.0 / (size - 1);
+ int j;
+
+ for (j = 0; j < size; ++j)
+ values[i * size + j] =
+ frac2float((*pcrd->RenderTable.T.procs[i])
+ ((byte)(j * scale), pcrd));
+ }
+ fa.data = values;
+ fa.size = size * m;
+ fa.persistent = true;
+ code = param_write_float_array(plist, "RenderTableTValues",
+ &fa);
+ }
+ }
+ if (code < 0) {
+ gs_free_object(mem, table, "RenderTableTable");
+ gs_free_object(mem, size, "RenderTableSize");
+ return code;
+ }
}
return code;
}
@@ -278,29 +278,29 @@ read_floats(gs_param_list * plist, gs_param_name key, float *values, int count)
int code = param_read_float_array(plist, key, &fa);
if (code)
- return code;
+ return code;
if (fa.size != count)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
memcpy(values, fa.data, sizeof(float) * count);
return 0;
}
static int
read_vector3(gs_param_list * plist, gs_param_name key,
- gs_vector3 * pvec, const gs_vector3 * dflt)
+ gs_vector3 * pvec, const gs_vector3 * dflt)
{
float values[3];
int code = read_floats(plist, key, values, 3);
switch (code) {
- case 1: /* not defined */
- if (dflt)
- *pvec = *dflt;
- break;
- case 0:
- load_vector3(pvec, values);
- default: /* error */
- break;
+ case 1: /* not defined */
+ if (dflt)
+ *pvec = *dflt;
+ break;
+ case 0:
+ load_vector3(pvec, values);
+ default: /* error */
+ break;
}
return code;
}
@@ -311,15 +311,15 @@ read_matrix3(gs_param_list * plist, gs_param_name key, gs_matrix3 * pmat)
int code = read_floats(plist, key, values, 9);
switch (code) {
- case 1: /* not defined */
- *pmat = Matrix3_default;
- break;
- case 0:
- load_vector3(&pmat->cu, values);
- load_vector3(&pmat->cv, values + 3);
- load_vector3(&pmat->cw, values + 6);
- default: /* error */
- break;
+ case 1: /* not defined */
+ *pmat = Matrix3_default;
+ break;
+ case 0:
+ load_vector3(&pmat->cu, values);
+ load_vector3(&pmat->cv, values + 3);
+ load_vector3(&pmat->cw, values + 6);
+ default: /* error */
+ break;
}
return code;
}
@@ -330,24 +330,24 @@ read_range3(gs_param_list * plist, gs_param_name key, gs_range3 * prange)
int code = read_floats(plist, key, values, 6);
switch (code) {
- case 1: /* not defined */
- *prange = Range3_default;
- break;
- case 0:
- prange->ranges[0].rmin = values[0];
- prange->ranges[0].rmax = values[1];
- prange->ranges[1].rmin = values[2];
- prange->ranges[1].rmax = values[3];
- prange->ranges[2].rmin = values[4];
- prange->ranges[2].rmax = values[5];
- default: /* error */
- break;
+ case 1: /* not defined */
+ *prange = Range3_default;
+ break;
+ case 0:
+ prange->ranges[0].rmin = values[0];
+ prange->ranges[0].rmax = values[1];
+ prange->ranges[1].rmin = values[2];
+ prange->ranges[1].rmax = values[3];
+ prange->ranges[2].rmin = values[4];
+ prange->ranges[2].rmax = values[5];
+ default: /* error */
+ break;
}
return code;
}
static int
read_proc3(gs_param_list * plist, gs_param_name key,
- float values[gx_cie_cache_size * 3])
+ float values[gx_cie_cache_size * 3])
{
return read_floats(plist, key, values, gx_cie_cache_size * 3);
}
@@ -355,20 +355,20 @@ read_proc3(gs_param_list * plist, gs_param_name key,
/* Read a CRD from a device parameter. */
int
gs_cie_render1_param_initialize(gs_cie_render * pcrd, gs_param_list * plist,
- gs_param_name key, gx_device * dev)
+ gs_param_name key, gx_device * dev)
{
gs_param_dict dict;
int code = param_begin_read_dict(plist, key, &dict, false);
int dcode;
if (code < 0)
- return code;
+ return code;
code = param_get_cie_render1(pcrd, dict.list, dev);
dcode = param_end_read_dict(plist, key, &dict);
if (code < 0)
- return code;
+ return code;
if (dcode < 0)
- return dcode;
+ return dcode;
gs_cie_render_init(pcrd);
gs_cie_render_sample(pcrd);
return gs_cie_render_complete(pcrd);
@@ -384,12 +384,12 @@ typedef struct encode_data_s {
/* Define procedures that retrieve the Encode values read from the list. */
static float
encode_from_data(floatp v, const float values[gx_cie_cache_size],
- const gs_range * range)
+ const gs_range * range)
{
return (v <= range->rmin ? values[0] :
- v >= range->rmax ? values[gx_cie_cache_size - 1] :
- values[(int)((v - range->rmin) / (range->rmax - range->rmin) *
- (gx_cie_cache_size - 1) + 0.5)]);
+ v >= range->rmax ? values[gx_cie_cache_size - 1] :
+ values[(int)((v - range->rmin) / (range->rmax - range->rmin) *
+ (gx_cie_cache_size - 1) + 0.5)]);
}
/*
* The repetitive boilerplate in the next 10 procedures really sticks in
@@ -401,7 +401,7 @@ encode_lmn_0_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->lmn[0],
- &pcrd->DomainLMN.ranges[0]);
+ &pcrd->DomainLMN.ranges[0]);
}
static float
encode_lmn_1_from_data(floatp v, const gs_cie_render * pcrd)
@@ -409,7 +409,7 @@ encode_lmn_1_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->lmn[gx_cie_cache_size],
- &pcrd->DomainLMN.ranges[1]);
+ &pcrd->DomainLMN.ranges[1]);
}
static float
encode_lmn_2_from_data(floatp v, const gs_cie_render * pcrd)
@@ -417,7 +417,7 @@ encode_lmn_2_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->lmn[gx_cie_cache_size * 2],
- &pcrd->DomainLMN.ranges[2]);
+ &pcrd->DomainLMN.ranges[2]);
}
static float
encode_abc_0_from_data(floatp v, const gs_cie_render * pcrd)
@@ -425,7 +425,7 @@ encode_abc_0_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->abc[0],
- &pcrd->DomainABC.ranges[0]);
+ &pcrd->DomainABC.ranges[0]);
}
static float
encode_abc_1_from_data(floatp v, const gs_cie_render * pcrd)
@@ -433,7 +433,7 @@ encode_abc_1_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->abc[gx_cie_cache_size],
- &pcrd->DomainABC.ranges[1]);
+ &pcrd->DomainABC.ranges[1]);
}
static float
encode_abc_2_from_data(floatp v, const gs_cie_render * pcrd)
@@ -441,7 +441,7 @@ encode_abc_2_from_data(floatp v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return encode_from_data(v, &data->abc[gx_cie_cache_size * 2],
- &pcrd->DomainABC.ranges[2]);
+ &pcrd->DomainABC.ranges[2]);
}
static frac
render_table_t_0_from_data(byte v, const gs_cie_render * pcrd)
@@ -449,8 +449,8 @@ render_table_t_0_from_data(byte v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return float2frac(encode_from_data(v / 255.0,
- &data->t[0],
- &Range3_default.ranges[0]));
+ &data->t[0],
+ &Range3_default.ranges[0]));
}
static frac
render_table_t_1_from_data(byte v, const gs_cie_render * pcrd)
@@ -458,8 +458,8 @@ render_table_t_1_from_data(byte v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return float2frac(encode_from_data(v / 255.0,
- &data->t[gx_cie_cache_size],
- &Range3_default.ranges[0]));
+ &data->t[gx_cie_cache_size],
+ &Range3_default.ranges[0]));
}
static frac
render_table_t_2_from_data(byte v, const gs_cie_render * pcrd)
@@ -467,8 +467,8 @@ render_table_t_2_from_data(byte v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return float2frac(encode_from_data(v / 255.0,
- &data->t[gx_cie_cache_size * 2],
- &Range3_default.ranges[0]));
+ &data->t[gx_cie_cache_size * 2],
+ &Range3_default.ranges[0]));
}
static frac
render_table_t_3_from_data(byte v, const gs_cie_render * pcrd)
@@ -476,8 +476,8 @@ render_table_t_3_from_data(byte v, const gs_cie_render * pcrd)
const encode_data_t *data = pcrd->client_data;
return float2frac(encode_from_data(v / 255.0,
- &data->t[gx_cie_cache_size * 3],
- &Range3_default.ranges[0]));
+ &data->t[gx_cie_cache_size * 3],
+ &Range3_default.ranges[0]));
}
static const gs_cie_render_proc3 EncodeLMN_from_data = {
{encode_lmn_0_from_data, encode_lmn_1_from_data, encode_lmn_2_from_data}
@@ -494,7 +494,7 @@ static const gs_cie_render_table_procs RenderTableT_from_data = {
/* Read a CRD directly from a parameter list. */
int
param_get_cie_render1(gs_cie_render * pcrd, gs_param_list * plist,
- gx_device * dev)
+ gx_device * dev)
{
encode_data_t data;
gs_param_int_array rt_size;
@@ -505,129 +505,129 @@ param_get_cie_render1(gs_cie_render * pcrd, gs_param_list * plist,
/* Reset the status to invalidate cached information. */
pcrd->status = CIE_RENDER_STATUS_BUILT;
if ((code = param_read_int(plist, "ColorRenderingType", &crd_type)) < 0 ||
- crd_type != GX_DEVICE_CRD1_TYPE ||
- (code = read_vector3(plist, "WhitePoint", &pcrd->points.WhitePoint,
- NULL)) < 0 ||
- (code = read_vector3(plist, "BlackPoint", &pcrd->points.BlackPoint,
- &BlackPoint_default)) < 0 ||
- (code = read_matrix3(plist, "MatrixPQR", &pcrd->MatrixPQR)) < 0 ||
- (code = read_range3(plist, "RangePQR", &pcrd->RangePQR)) < 0 ||
- /* TransformPQR is handled specially below. */
- (code = read_matrix3(plist, "MatrixLMN", &pcrd->MatrixLMN)) < 0 ||
- (code_lmn = code =
- read_proc3(plist, "EncodeLMNValues", data.lmn)) < 0 ||
- (code = read_range3(plist, "RangeLMN", &pcrd->RangeLMN)) < 0 ||
- (code = read_matrix3(plist, "MatrixABC", &pcrd->MatrixABC)) < 0 ||
- (code_abc = code =
- read_proc3(plist, "EncodeABCValues", data.abc)) < 0 ||
- (code = read_range3(plist, "RangeABC", &pcrd->RangeABC)) < 0
- )
- return code;
+ crd_type != GX_DEVICE_CRD1_TYPE ||
+ (code = read_vector3(plist, "WhitePoint", &pcrd->points.WhitePoint,
+ NULL)) < 0 ||
+ (code = read_vector3(plist, "BlackPoint", &pcrd->points.BlackPoint,
+ &BlackPoint_default)) < 0 ||
+ (code = read_matrix3(plist, "MatrixPQR", &pcrd->MatrixPQR)) < 0 ||
+ (code = read_range3(plist, "RangePQR", &pcrd->RangePQR)) < 0 ||
+ /* TransformPQR is handled specially below. */
+ (code = read_matrix3(plist, "MatrixLMN", &pcrd->MatrixLMN)) < 0 ||
+ (code_lmn = code =
+ read_proc3(plist, "EncodeLMNValues", data.lmn)) < 0 ||
+ (code = read_range3(plist, "RangeLMN", &pcrd->RangeLMN)) < 0 ||
+ (code = read_matrix3(plist, "MatrixABC", &pcrd->MatrixABC)) < 0 ||
+ (code_abc = code =
+ read_proc3(plist, "EncodeABCValues", data.abc)) < 0 ||
+ (code = read_range3(plist, "RangeABC", &pcrd->RangeABC)) < 0
+ )
+ return code;
/* Handle the sampled functions. */
switch (code = param_read_string(plist, "TransformPQRName", &pname)) {
- default: /* error */
- return code;
- case 1: /* missing */
- pcrd->TransformPQR = TransformPQR_default;
- break;
- case 0: /* specified */
- /* The procedure name must be null-terminated: */
- /* see param_put_cie_render1 above. */
- if (pname.size < 1 || pname.data[pname.size - 1] != 0)
- return_error(gs_error_rangecheck);
- pcrd->TransformPQR.proc = TransformPQR_lookup_proc_name;
- pcrd->TransformPQR.proc_name = (const char *)pname.data;
- switch (code = param_read_string(plist, "TransformPQRData", &pdata)) {
- default: /* error */
- return code;
- case 1: /* missing */
- pcrd->TransformPQR.proc_data.data = 0;
- pcrd->TransformPQR.proc_data.size = 0;
- break;
- case 0:
- pcrd->TransformPQR.proc_data.data = pdata.data;
- pcrd->TransformPQR.proc_data.size = pdata.size;
- }
- pcrd->TransformPQR.driver_name = gs_devicename(dev);
- break;
+ default: /* error */
+ return code;
+ case 1: /* missing */
+ pcrd->TransformPQR = TransformPQR_default;
+ break;
+ case 0: /* specified */
+ /* The procedure name must be null-terminated: */
+ /* see param_put_cie_render1 above. */
+ if (pname.size < 1 || pname.data[pname.size - 1] != 0)
+ return_error(gs_error_rangecheck);
+ pcrd->TransformPQR.proc = TransformPQR_lookup_proc_name;
+ pcrd->TransformPQR.proc_name = (const char *)pname.data;
+ switch (code = param_read_string(plist, "TransformPQRData", &pdata)) {
+ default: /* error */
+ return code;
+ case 1: /* missing */
+ pcrd->TransformPQR.proc_data.data = 0;
+ pcrd->TransformPQR.proc_data.size = 0;
+ break;
+ case 0:
+ pcrd->TransformPQR.proc_data.data = pdata.data;
+ pcrd->TransformPQR.proc_data.size = pdata.size;
+ }
+ pcrd->TransformPQR.driver_name = gs_devicename(dev);
+ break;
}
pcrd->client_data = &data;
if (code_lmn > 0)
- pcrd->EncodeLMN = Encode_default;
+ pcrd->EncodeLMN = Encode_default;
else
- pcrd->EncodeLMN = EncodeLMN_from_data;
+ pcrd->EncodeLMN = EncodeLMN_from_data;
if (code_abc > 0)
- pcrd->EncodeABC = Encode_default;
+ pcrd->EncodeABC = Encode_default;
else
- pcrd->EncodeABC = EncodeABC_from_data;
+ pcrd->EncodeABC = EncodeABC_from_data;
code_rt = code = param_read_int_array(plist, "RenderTableSize", &rt_size);
if (code == 1) {
- if (pcrd->RenderTable.lookup.table) {
- gs_free_object(pcrd->rc.memory,
- (void *)pcrd->RenderTable.lookup.table, /* break const */
- "param_get_cie_render1(RenderTable)");
- pcrd->RenderTable.lookup.table = 0;
- }
- pcrd->RenderTable.T = RenderTableT_default;
- code_t = 1;
+ if (pcrd->RenderTable.lookup.table) {
+ gs_free_object(pcrd->rc.memory,
+ (void *)pcrd->RenderTable.lookup.table, /* break const */
+ "param_get_cie_render1(RenderTable)");
+ pcrd->RenderTable.lookup.table = 0;
+ }
+ pcrd->RenderTable.T = RenderTableT_default;
+ code_t = 1;
} else if (code < 0)
- return code;
+ return code;
else if (rt_size.size != 4)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else {
- gs_param_string_array rt_values;
- gs_const_string *table;
- int n, m, j;
-
- for (j = 0; j < rt_size.size; ++j)
- if (rt_size.data[j] < 1)
- return_error(gs_error_rangecheck);
- code = param_read_string_array(plist, "RenderTableTable", &rt_values);
- if (code < 0)
- return code;
- if (code > 0 || rt_values.size != rt_size.data[0])
- return_error(gs_error_rangecheck);
- /* Note: currently n = 3 (rt_size.size = 4) always. */
- for (j = 0; j < rt_values.size; ++j)
- if (rt_values.data[j].size !=
- rt_size.data[1] * rt_size.data[2] * rt_size.data[3])
- return_error(gs_error_rangecheck);
- pcrd->RenderTable.lookup.n = n = rt_size.size - 1;
- pcrd->RenderTable.lookup.m = m = rt_size.data[n];
- if (n > 4 || m > 4)
- return_error(gs_error_rangecheck);
- memcpy(pcrd->RenderTable.lookup.dims, rt_size.data, n * sizeof(int));
- table =
- gs_alloc_struct_array(pcrd->rc.memory,
- pcrd->RenderTable.lookup.dims[0],
- gs_const_string, &st_const_string_element,
- "RenderTable table");
- if (table == 0)
- return_error(gs_error_VMerror);
- for (j = 0; j < pcrd->RenderTable.lookup.dims[0]; ++j) {
- table[j].data = rt_values.data[j].data;
- table[j].size = rt_values.data[j].size;
- }
- pcrd->RenderTable.lookup.table = table;
- pcrd->RenderTable.T = RenderTableT_from_data;
- code_t = code = read_floats(plist, "RenderTableTValues", data.t,
- gx_cie_cache_size * m);
- if (code > 0)
- pcrd->RenderTable.T = RenderTableT_default;
- else if (code == 0)
- pcrd->RenderTable.T = RenderTableT_from_data;
+ gs_param_string_array rt_values;
+ gs_const_string *table;
+ int n, m, j;
+
+ for (j = 0; j < rt_size.size; ++j)
+ if (rt_size.data[j] < 1)
+ return_error(gs_error_rangecheck);
+ code = param_read_string_array(plist, "RenderTableTable", &rt_values);
+ if (code < 0)
+ return code;
+ if (code > 0 || rt_values.size != rt_size.data[0])
+ return_error(gs_error_rangecheck);
+ /* Note: currently n = 3 (rt_size.size = 4) always. */
+ for (j = 0; j < rt_values.size; ++j)
+ if (rt_values.data[j].size !=
+ rt_size.data[1] * rt_size.data[2] * rt_size.data[3])
+ return_error(gs_error_rangecheck);
+ pcrd->RenderTable.lookup.n = n = rt_size.size - 1;
+ pcrd->RenderTable.lookup.m = m = rt_size.data[n];
+ if (n > 4 || m > 4)
+ return_error(gs_error_rangecheck);
+ memcpy(pcrd->RenderTable.lookup.dims, rt_size.data, n * sizeof(int));
+ table =
+ gs_alloc_struct_array(pcrd->rc.memory,
+ pcrd->RenderTable.lookup.dims[0],
+ gs_const_string, &st_const_string_element,
+ "RenderTable table");
+ if (table == 0)
+ return_error(gs_error_VMerror);
+ for (j = 0; j < pcrd->RenderTable.lookup.dims[0]; ++j) {
+ table[j].data = rt_values.data[j].data;
+ table[j].size = rt_values.data[j].size;
+ }
+ pcrd->RenderTable.lookup.table = table;
+ pcrd->RenderTable.T = RenderTableT_from_data;
+ code_t = code = read_floats(plist, "RenderTableTValues", data.t,
+ gx_cie_cache_size * m);
+ if (code > 0)
+ pcrd->RenderTable.T = RenderTableT_default;
+ else if (code == 0)
+ pcrd->RenderTable.T = RenderTableT_from_data;
}
if ((code = gs_cie_render_init(pcrd)) >= 0 &&
- (code = gs_cie_render_sample(pcrd)) >= 0
- )
- code = gs_cie_render_complete(pcrd);
+ (code = gs_cie_render_sample(pcrd)) >= 0
+ )
+ code = gs_cie_render_complete(pcrd);
/* Clean up before exiting. */
pcrd->client_data = 0;
if (code_lmn == 0)
- pcrd->EncodeLMN = EncodeLMN_from_cache;
+ pcrd->EncodeLMN = EncodeLMN_from_cache;
if (code_abc == 0)
- pcrd->EncodeABC = EncodeABC_from_cache;
+ pcrd->EncodeABC = EncodeABC_from_cache;
if (code_t == 0)
- pcrd->RenderTable.T = RenderTableT_from_cache;
+ pcrd->RenderTable.T = RenderTableT_from_cache;
return code;
}
diff --git a/gs/base/gscrdp.h b/gs/base/gscrdp.h
index ea10cb924..822f641bb 100644
--- a/gs/base/gscrdp.h
+++ b/gs/base/gscrdp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,8 +37,8 @@ typedef struct gx_device_s gx_device;
* cause certain cached (idempotent) values to be computed.
*/
int param_write_cie_render1(gs_param_list * plist, gs_param_name key,
- gs_cie_render * pcrd,
- gs_memory_t * mem);
+ gs_cie_render * pcrd,
+ gs_memory_t * mem);
/*
* For internal use, we also provide an API that writes the CRD directly
@@ -46,7 +46,7 @@ int param_write_cie_render1(gs_param_list * plist, gs_param_name key,
* list.
*/
int param_put_cie_render1(gs_param_list * plist, gs_cie_render * pcrd,
- gs_memory_t * mem);
+ gs_memory_t * mem);
/*
* Client code that wants to initialize a CRD from a device parameter
@@ -67,17 +67,17 @@ int param_put_cie_render1(gs_param_list * plist, gs_cie_render * pcrd,
* where "ParamName" is the parameter name, e.g., "CRDDefault".
*/
int gs_cie_render1_param_initialize(gs_cie_render * pcrd,
- gs_param_list * plist,
- gs_param_name key,
- gx_device * dev);
+ gs_param_list * plist,
+ gs_param_name key,
+ gx_device * dev);
/*
* Again, we provide an internal procedure that doesn't involve a
* parameter name.
*/
int param_get_cie_render1(gs_cie_render * pcrd,
- gs_param_list * plist,
- gx_device * dev);
+ gs_param_list * plist,
+ gx_device * dev);
/*
* The actual representation of the CRD is a slightly modified PostScript
diff --git a/gs/base/gscrypt1.c b/gs/base/gscrypt1.c
index cda1640bd..66629811a 100644
--- a/gs/base/gscrypt1.c
+++ b/gs/base/gscrypt1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,8 +27,8 @@ gs_type1_encrypt(byte * dest, const byte * src, uint len, crypt_state * pstate)
uint count = len;
while (count) {
- encrypt_next(*from, state, *to);
- from++, to++, count--;
+ encrypt_next(*from, state, *to);
+ from++, to++, count--;
}
*pstate = state;
return 0;
@@ -43,12 +43,12 @@ gs_type1_decrypt(byte * dest, const byte * src, uint len, crypt_state * pstate)
uint count = len;
while (count) {
- /* If from == to, we can't use the obvious */
- /* decrypt_next(*from, state, *to); */
- byte ch = *from++;
+ /* If from == to, we can't use the obvious */
+ /* decrypt_next(*from, state, *to); */
+ byte ch = *from++;
- decrypt_next(ch, state, *to);
- to++, count--;
+ decrypt_next(ch, state, *to);
+ to++, count--;
}
*pstate = state;
return 0;
diff --git a/gs/base/gscrypt1.h b/gs/base/gscrypt1.h
index db1bdf650..cde3508da 100644
--- a/gs/base/gscrypt1.h
+++ b/gs/base/gscrypt1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,9 +20,9 @@
/* Normal public interface */
typedef ushort crypt_state;
int gs_type1_encrypt(byte * dest, const byte * src, uint len,
- crypt_state * pstate);
+ crypt_state * pstate);
int gs_type1_decrypt(byte * dest, const byte * src, uint len,
- crypt_state * pstate);
+ crypt_state * pstate);
/* Define the encryption parameters and procedures. */
#define crypt_c1 ((ushort)52845)
diff --git a/gs/base/gscscie.c b/gs/base/gscscie.c
index ce3f77e2d..80dbd59f0 100644
--- a/gs/base/gscscie.c
+++ b/gs/base/gscscie.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,7 @@ private_st_cie_defg();
/* CIEBasedDEFG */
gs_private_st_ptrs1(st_color_space_CIEDEFG, gs_color_space,
"gs_color_space(CIEDEFG)", cs_CIEDEFG_enum_ptrs, cs_CIEDEFG_reloc_ptrs,
- params.defg);
+ params.defg);
static cs_proc_final(gx_final_CIEDEFG);
static cs_proc_serialize(gx_serialize_CIEDEFG);
const gs_color_space_type gs_color_space_type_CIEDEFG = {
@@ -61,8 +61,8 @@ const gs_color_space_type gs_color_space_type_CIEDEFG = {
/* CIEBasedDEF */
gs_private_st_ptrs1(st_color_space_CIEDEF, gs_color_space,
- "gs_color_space(CIEDEF)", cs_CIEDEF_enum_ptrs, cs_CIEDEF_reloc_ptrs,
- params.def);
+ "gs_color_space(CIEDEF)", cs_CIEDEF_enum_ptrs, cs_CIEDEF_reloc_ptrs,
+ params.def);
static cs_proc_final(gx_final_CIEDEF);
static cs_proc_serialize(gx_serialize_CIEDEF);
const gs_color_space_type gs_color_space_type_CIEDEF = {
@@ -81,8 +81,8 @@ const gs_color_space_type gs_color_space_type_CIEDEF = {
/* CIEBasedABC */
gs_private_st_ptrs1(st_color_space_CIEABC, gs_color_space,
- "gs_color_space(CIEABC)", cs_CIEABC_enum_ptrs, cs_CIEABC_reloc_ptrs,
- params.abc);
+ "gs_color_space(CIEABC)", cs_CIEABC_enum_ptrs, cs_CIEABC_reloc_ptrs,
+ params.abc);
static cs_proc_final(gx_final_CIEABC);
static cs_proc_serialize(gx_serialize_CIEABC);
const gs_color_space_type gs_color_space_type_CIEABC = {
@@ -100,8 +100,8 @@ const gs_color_space_type gs_color_space_type_CIEABC = {
/* CIEBasedA */
gs_private_st_ptrs1(st_color_space_CIEA, gs_color_space,
- "gs_color_space(CIEA)", cs_CIEA_enum_ptrs, cs_CIEA_reloc_ptrs,
- params.a);
+ "gs_color_space(CIEA)", cs_CIEA_enum_ptrs, cs_CIEA_reloc_ptrs,
+ params.a);
static cs_proc_final(gx_final_CIEA);
static cs_proc_serialize(gx_serialize_CIEA);
const gs_color_space_type gs_color_space_type_CIEA = {
@@ -125,11 +125,11 @@ gx_concrete_space_CIE(const gs_color_space * pcs, const gs_imager_state * pis)
const gs_cie_render *pcie = pis->cie_render;
if (pcie == 0 || pcie->RenderTable.lookup.table == 0 ||
- pcie->RenderTable.lookup.m == 3
- ) {
- return pis->devicergb_cs;
+ pcie->RenderTable.lookup.m == 3
+ ) {
+ return pis->devicergb_cs;
} else { /* pcie->RenderTable.lookup.m == 4 */
- return pis->devicecmyk_cs;
+ return pis->devicecmyk_cs;
}
}
@@ -236,7 +236,7 @@ set_ctbl_defaults(gx_color_lookup_table * plktblp, int num_comps)
plktblp->n = num_comps;
plktblp->m = 3; /* always output CIE ABC */
for (i = 0; i < countof(plktblp->dims); i++)
- plktblp->dims[i] = 0;
+ plktblp->dims[i] = 0;
plktblp->table = 0;
}
@@ -248,21 +248,21 @@ set_ctbl_defaults(gx_color_lookup_table * plktblp, int num_comps)
*/
void *
gx_build_cie_space(gs_color_space ** ppcspace,
- const gs_color_space_type * pcstype,
- gs_memory_type_ptr_t stype, gs_memory_t * pmem)
+ const gs_color_space_type * pcstype,
+ gs_memory_type_ptr_t stype, gs_memory_t * pmem)
{
gs_color_space *pcspace = gs_cspace_alloc(pmem, pcstype);
gs_cie_common_elements_t *pdata;
if (pcspace == NULL)
- return NULL;
+ return NULL;
rc_alloc_struct_1(pdata, gs_cie_common_elements_t, stype, pmem,
- {
- gs_free_object(pmem, pcspace, "gx_build_cie_space");
- return 0;
- }
- ,
- "gx_build_cie_space(data)");
+ {
+ gs_free_object(pmem, pcspace, "gx_build_cie_space");
+ return 0;
+ }
+ ,
+ "gx_build_cie_space(data)");
*ppcspace = pcspace;
return (void *)pdata;
}
@@ -271,13 +271,13 @@ gx_build_cie_space(gs_color_space ** ppcspace,
int
gs_cspace_build_CIEA(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem)
+ gs_memory_t * pmem)
{
gs_cie_a *pciea =
gx_build_cie_space(ppcspace, &gs_color_space_type_CIEA, &st_cie_a, pmem);
if (pciea == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_set_common_cie_defaults(&pciea->common, client_data);
pciea->common.install_cspace = gx_install_CIEA;
@@ -291,14 +291,14 @@ gs_cspace_build_CIEA(gs_color_space ** ppcspace, void *client_data,
int
gs_cspace_build_CIEABC(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem)
+ gs_memory_t * pmem)
{
gs_cie_abc *pabc =
gx_build_cie_space(ppcspace, &gs_color_space_type_CIEABC, &st_cie_abc,
- pmem);
+ pmem);
if (pabc == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
set_cie_abc_defaults(pabc, client_data);
pabc->common.install_cspace = gx_install_CIEABC;
@@ -309,14 +309,14 @@ gs_cspace_build_CIEABC(gs_color_space ** ppcspace, void *client_data,
int
gs_cspace_build_CIEDEF(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem)
+ gs_memory_t * pmem)
{
gs_cie_def *pdef =
gx_build_cie_space(ppcspace, &gs_color_space_type_CIEDEF, &st_cie_def,
- pmem);
+ pmem);
if (pdef == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
set_cie_abc_defaults((gs_cie_abc *) pdef, client_data);
pdef->common.install_cspace = gx_install_CIEDEF;
@@ -331,14 +331,14 @@ gs_cspace_build_CIEDEF(gs_color_space ** ppcspace, void *client_data,
int
gs_cspace_build_CIEDEFG(gs_color_space ** ppcspace, void *client_data,
- gs_memory_t * pmem)
+ gs_memory_t * pmem)
{
gs_cie_defg *pdefg =
gx_build_cie_space(ppcspace, &gs_color_space_type_CIEDEFG, &st_cie_defg,
- pmem);
+ pmem);
if (pdefg == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
set_cie_abc_defaults((gs_cie_abc *) pdefg, client_data);
pdefg->common.install_cspace = gx_install_CIEDEFG;
@@ -355,20 +355,20 @@ gs_cspace_build_CIEDEFG(gs_color_space ** ppcspace, void *client_data,
int
gs_cie_defx_set_lookup_table(gs_color_space * pcspace, int *pdims,
- const gs_const_string * ptable)
+ const gs_const_string * ptable)
{
gx_color_lookup_table *plktblp;
switch (gs_color_space_get_index(pcspace)) {
- case gs_color_space_index_CIEDEF:
- plktblp = &pcspace->params.def->Table;
- break;
- case gs_color_space_index_CIEDEFG:
- plktblp = &pcspace->params.defg->Table;
- plktblp->dims[3] = pdims[3];
- break;
- default:
- return_error(gs_error_rangecheck);
+ case gs_color_space_index_CIEDEF:
+ plktblp = &pcspace->params.def->Table;
+ break;
+ case gs_color_space_index_CIEDEFG:
+ plktblp = &pcspace->params.defg->Table;
+ plktblp->dims[3] = pdims[3];
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
plktblp->dims[0] = pdims[0];
@@ -389,14 +389,14 @@ gx_serialize_cie_cache(const cie_cache_floats *c, stream * s)
code = sputs(s, (const byte *)&c->params.is_identity, sizeof(c->params.is_identity), &n);
if (c->params.is_identity)
- return 0;
+ return 0;
code = sputs(s, (const byte *)&cache_size, sizeof(cache_size), &n);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)c->values, sizeof(c->values), &n);
}
-int
+int
gx_serialize_cie_common_elements(const gs_color_space * pcs, stream * s)
{
const gs_cie_a * p = pcs->params.a;
@@ -404,24 +404,24 @@ gx_serialize_cie_common_elements(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
- code = sputs(s, (const byte *)&p->common.RangeLMN,
- sizeof(p->common.RangeLMN), &n);
+ return code;
+ code = sputs(s, (const byte *)&p->common.RangeLMN,
+ sizeof(p->common.RangeLMN), &n);
if (code < 0)
- return code;
+ return code;
for (k = 0; k < 3 && code >= 0; k++)
- code = gx_serialize_cie_cache(&p->common.caches.DecodeLMN[k].floats, s);
+ code = gx_serialize_cie_cache(&p->common.caches.DecodeLMN[k].floats, s);
if (code < 0)
- return code;
- code = sputs(s, (const byte *)&p->common.MatrixLMN,
- sizeof(p->common.MatrixLMN), &n);
+ return code;
+ code = sputs(s, (const byte *)&p->common.MatrixLMN,
+ sizeof(p->common.MatrixLMN), &n);
if (code < 0)
- return code;
- return sputs(s, (const byte *)&p->common.points,
- sizeof(p->common.points), &n);
+ return code;
+ return sputs(s, (const byte *)&p->common.points,
+ sizeof(p->common.points), &n);
}
-static int
+static int
gx_serialize_CIEA(const gs_color_space * pcs, stream * s)
{
const gs_cie_a * p = pcs->params.a;
@@ -429,17 +429,17 @@ gx_serialize_CIEA(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cie_common_elements(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeA, sizeof(p->RangeA), &n);
if (code < 0)
- return code;
+ return code;
code = gx_serialize_cie_cache(&p->caches.DecodeA.floats, s);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->MatrixA, sizeof(p->MatrixA), &n);
}
-static int
+static int
gx_serialize_CIEABC(const gs_color_space * pcs, stream * s)
{
const gs_cie_abc * p = pcs->params.abc;
@@ -447,43 +447,43 @@ gx_serialize_CIEABC(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cie_common_elements(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeABC, sizeof(p->RangeABC), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->caches.skipABC, sizeof(p->caches.skipABC), &n);
if (code < 0)
- return code;
+ return code;
if (p->caches.skipABC)
- return 0;
+ return 0;
for (k = 0; k < 3 && code >= 0; k++)
- code = gx_serialize_cie_cache(&p->caches.DecodeABC.caches[k].floats, s);
+ code = gx_serialize_cie_cache(&p->caches.DecodeABC.caches[k].floats, s);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->MatrixABC, sizeof(p->MatrixABC), &n);
}
-static int
+static int
gx_serialize_lookup_table(const gx_color_lookup_table * t, stream * s)
{
uint n;
int code = sputs(s, (const byte *)&t->n, sizeof(t->n), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&t->dims[0], sizeof(t->dims[0]) * t->n, &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&t->m, sizeof(t->m), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&t->table->size, sizeof(t->table->size), &n);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&t->table->data, t->table->size, &n);
}
-static int
+static int
gx_serialize_CIEDEF(const gs_color_space * pcs, stream * s)
{
const gs_cie_def * p = pcs->params.def;
@@ -491,21 +491,21 @@ gx_serialize_CIEDEF(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cie_common_elements(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeDEF, sizeof(p->RangeDEF), &n);
if (code < 0)
- return code;
+ return code;
for (k = 0; k < 3 && code >= 0; k++)
- code = gx_serialize_cie_cache(&p->caches_def.DecodeDEF[k].floats, s);
+ code = gx_serialize_cie_cache(&p->caches_def.DecodeDEF[k].floats, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeHIJ, sizeof(p->RangeHIJ), &n);
if (code < 0)
- return code;
+ return code;
return gx_serialize_lookup_table(&p->Table, s);
}
-static int
+static int
gx_serialize_CIEDEFG(const gs_color_space * pcs, stream * s)
{
const gs_cie_defg * p = pcs->params.defg;
@@ -513,16 +513,16 @@ gx_serialize_CIEDEFG(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cie_common_elements(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeDEFG, sizeof(p->RangeDEFG), &n);
if (code < 0)
- return code;
+ return code;
for (k = 0; k < 3 && code >= 0; k++)
- code = gx_serialize_cie_cache(&p->caches_defg.DecodeDEFG[k].floats, s);
+ code = gx_serialize_cie_cache(&p->caches_defg.DecodeDEFG[k].floats, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->RangeHIJK, sizeof(p->RangeHIJK), &n);
if (code < 0)
- return code;
+ return code;
return gx_serialize_lookup_table(&p->Table, s);
}
diff --git a/gs/base/gscsel.h b/gs/base/gscsel.h
index 00f52fb90..3386489c9 100644
--- a/gs/base/gscsel.h
+++ b/gs/base/gscsel.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gscsepr.c b/gs/base/gscsepr.c
index 5b9b229ff..ba6c70423 100644
--- a/gs/base/gscsepr.c
+++ b/gs/base/gscsepr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,8 +35,8 @@
/* ---------------- Color space ---------------- */
gs_private_st_composite(st_color_space_Separation, gs_color_space,
- "gs_color_space_Separation",
- cs_Separation_enum_ptrs, cs_Separation_reloc_ptrs);
+ "gs_color_space_Separation",
+ cs_Separation_enum_ptrs, cs_Separation_reloc_ptrs);
/* Define the Separation color space type. */
static cs_proc_init_color(gx_init_Separation);
@@ -63,7 +63,7 @@ const gs_color_space_type gs_color_space_type_Separation = {
/* GC procedures */
-static
+static
ENUM_PTRS_BEGIN(cs_Separation_enum_ptrs) return 0;
ENUM_PTR(0, gs_color_space, params.separation.map);
ENUM_PTRS_END
@@ -76,15 +76,15 @@ RELOC_PTRS_END
/* Get the concrete space for a Separation space. */
static const gs_color_space *
gx_concrete_space_Separation(const gs_color_space * pcs,
- const gs_imager_state * pis)
+ const gs_imager_state * pis)
{
bool is_lab = false;
#ifdef DEBUG
- /*
+ /*
* Verify that the color space and imager state info match.
*/
if (pcs->id != pis->color_component_map.cspace_id)
- dprintf("gx_concretze_space_Separation: color space id mismatch");
+ dprintf("gx_concretze_space_Separation: color space id mismatch");
#endif
/*
@@ -94,11 +94,11 @@ gx_concrete_space_Separation(const gs_color_space * pcs,
/* Need to handle PS CIE space */
if (gs_color_space_is_PSCIE(pcs->base_space)) {
if (pcs->base_space->icc_equivalent == NULL) {
- gs_colorspace_set_icc_equivalent(pcs->base_space,
+ gs_colorspace_set_icc_equivalent(pcs->base_space,
&is_lab, pis->memory);
}
return (pcs->base_space->icc_equivalent);
- }
+ }
return cs_concrete_space(pcs->base_space, pis);
}
/*
@@ -120,17 +120,17 @@ gx_install_Separation(gs_color_space * pcs, gs_state * pgs)
if (code < 0)
return code;
gs_currentcolorspace_inline(pgs)->params.separation.use_alt_cspace =
- using_alt_color_space(pgs);
+ using_alt_color_space(pgs);
if (gs_currentcolorspace_inline(pgs)->params.separation.use_alt_cspace)
code = (pcs->base_space->type->install_cspace)
- (pcs->base_space, pgs);
+ (pcs->base_space, pgs);
/*
* Give the device an opportunity to capture equivalent colors for any
* spot colors which might be present in the color space.
*/
if (code >= 0)
code = dev_proc(pgs->device, update_spot_equivalent_colors)
- (pgs->device, pgs);
+ (pgs->device, pgs);
return code;
}
@@ -154,7 +154,7 @@ gx_set_overprint_Separation(const gs_color_space * pcs, gs_state * pgs)
int mcomp = pcmap->color_map[0];
if (mcomp >= 0)
- gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
+ gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
}
}
@@ -168,7 +168,7 @@ static void
gx_final_Separation(const gs_color_space * pcs)
{
rc_adjust_const(pcs->params.separation.map, -1,
- "gx_adjust_Separation");
+ "gx_adjust_Separation");
}
/* ------ Constructors/accessors ------ */
@@ -187,18 +187,18 @@ gs_cspace_new_Separation(
int code;
if (palt_cspace == 0 || !palt_cspace->type->can_be_alt_space)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pcs = gs_cspace_alloc(pmem, &gs_color_space_type_Separation);
if (pcs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pcs->params.separation.map = NULL;
code = alloc_device_n_map(&pcs->params.separation.map, pmem,
- "gs_cspace_build_Separation");
+ "gs_cspace_build_Separation");
if (code < 0) {
- gs_free_object(pmem, pcs, "gs_cspace_build_Separation");
- return_error(code);
+ gs_free_object(pmem, pcs, "gs_cspace_build_Separation");
+ return_error(code);
}
pcs->base_space = palt_cspace;
rc_increment_cs(palt_cspace);
@@ -212,18 +212,18 @@ gs_cspace_new_Separation(
*/
int
gs_cspace_set_sepr_proc(gs_color_space * pcspace,
- int (*proc)(const float *,
+ int (*proc)(const float *,
float *,
const gs_imager_state *,
void *
- ),
- void *proc_data
- )
+ ),
+ void *proc_data
+ )
{
gs_device_n_map *pimap;
if (gs_color_space_get_index(pcspace) != gs_color_space_index_Separation)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pimap = pcspace->params.separation.map;
pimap->tint_transform = proc;
pimap->tint_transform_data = proc_data;
@@ -242,10 +242,10 @@ gs_cspace_set_sepr_function(const gs_color_space *pcspace, gs_function_t *pfn)
gs_device_n_map *pimap;
if (gs_color_space_get_index(pcspace) != gs_color_space_index_Separation ||
- pfn->params.m != 1 || pfn->params.n !=
- gs_color_space_num_components(pcspace->base_space)
- )
- return_error(gs_error_rangecheck);
+ pfn->params.m != 1 || pfn->params.n !=
+ gs_color_space_num_components(pcspace->base_space)
+ )
+ return_error(gs_error_rangecheck);
pimap = pcspace->params.separation.map;
pimap->tint_transform = map_devn_using_function;
pimap->tint_transform_data = pfn;
@@ -261,9 +261,9 @@ gs_function_t *
gs_cspace_get_sepr_function(const gs_color_space *pcspace)
{
if (gs_color_space_get_index(pcspace) == gs_color_space_index_Separation &&
- pcspace->params.separation.map->tint_transform ==
- map_devn_using_function)
- return pcspace->params.separation.map->tint_transform_data;
+ pcspace->params.separation.map->tint_transform ==
+ map_devn_using_function)
+ return pcspace->params.separation.map->tint_transform_data;
return 0;
}
@@ -280,13 +280,13 @@ gx_init_Separation(gs_client_color * pcc, const gs_color_space * pcs)
static int
gx_remap_Separation(const gs_client_color * pcc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
int code = 0;
if (pcs->params.separation.sep_type != SEP_NONE)
- code = gx_default_remap_color(pcc, pcs, pdc, pis, dev, select);
+ code = gx_default_remap_color(pcc, pcs, pdc, pis, dev, select);
else {
color_set_null(pdc);
}
@@ -298,18 +298,18 @@ gx_remap_Separation(const gs_client_color * pcc, const gs_color_space * pcs,
static int
gx_concretize_Separation(const gs_client_color *pc, const gs_color_space *pcs,
- frac *pconc, const gs_imager_state *pis, gx_device *dev)
+ frac *pconc, const gs_imager_state *pis, gx_device *dev)
{
int code;
gs_client_color cc;
gs_color_space *pacs = pcs->base_space;
bool is_lab;
int k;
-
+
if (pcs->params.separation.sep_type == SEP_OTHER &&
- pcs->params.separation.use_alt_cspace) {
+ pcs->params.separation.use_alt_cspace) {
gs_device_n_map *map = pcs->params.separation.map;
- /* First see if we have a named color object that we can use to try
+ /* First see if we have a named color object that we can use to try
to map from the spot color into device values. */
if (pis->icc_manager->device_named != NULL) {
/* There is a table present. If we have the colorant name
@@ -326,9 +326,9 @@ gx_concretize_Separation(const gs_client_color *pc, const gs_color_space *pcs,
rendering_params.rendering_intent = pis->renderingintent;
pcs->params.separation.get_colorname_string(pis->memory, name,
- &pname, &name_size);
- code = gsicc_transform_named_color(pc->paint.values[0], pname,
- name_size, device_values, pis, dev, NULL,
+ &pname, &name_size);
+ code = gsicc_transform_named_color(pc->paint.values[0], pname,
+ name_size, device_values, pis, dev, NULL,
&rendering_params, false);
if (code == 0) {
for (k = 0; k < dev->device_icc_profile->num_comps; k++){
@@ -337,19 +337,19 @@ gx_concretize_Separation(const gs_client_color *pc, const gs_color_space *pcs,
return(0);
}
}
- /* Check the 1-element cache first. */
- if (map->cache_valid && map->tint[0] == pc->paint.values[0]) {
- int i, num_out = gs_color_space_num_components(pacs);
-
- for (i = 0; i < num_out; ++i)
- pconc[i] = map->conc[i];
- return 0;
- }
+ /* Check the 1-element cache first. */
+ if (map->cache_valid && map->tint[0] == pc->paint.values[0]) {
+ int i, num_out = gs_color_space_num_components(pacs);
+
+ for (i = 0; i < num_out; ++i)
+ pconc[i] = map->conc[i];
+ return 0;
+ }
code = (*pcs->params.separation.map->tint_transform)
- (pc->paint.values, &cc.paint.values[0],
- pis, pcs->params.separation.map->tint_transform_data);
+ (pc->paint.values, &cc.paint.values[0],
+ pis, pcs->params.separation.map->tint_transform_data);
if (code < 0)
- return code;
+ return code;
/* First check if this was PS based. */
if (gs_color_space_is_PSCIE(pacs)) {
/* If we have not yet create the profile do that now */
@@ -364,33 +364,33 @@ gx_concretize_Separation(const gs_client_color *pc, const gs_color_space *pcs,
cc.paint.values[0] /= 100.0;
cc.paint.values[1] = (cc.paint.values[1]+128)/255.0;
cc.paint.values[2] = (cc.paint.values[2]+128)/255.0;
- }
- return cs_concretize_color(&cc, pacs, pconc, pis, dev);
+ }
+ return cs_concretize_color(&cc, pacs, pconc, pis, dev);
}
else {
- pconc[0] = gx_unit_frac(pc->paint.values[0]);
+ pconc[0] = gx_unit_frac(pc->paint.values[0]);
}
return 0;
}
static int
gx_remap_concrete_Separation(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
#ifdef DEBUG
- /*
+ /*
* Verify that the color space and imager state info match.
*/
if (pcs->id != pis->color_component_map.cspace_id)
- dprintf("gx_remap_concrete_Separation: color space id mismatch");
+ dprintf("gx_remap_concrete_Separation: color space id mismatch");
#endif
if (pis->color_component_map.use_alt_cspace) {
const gs_color_space *pacs = pcs->base_space;
- return (*pacs->type->remap_concrete_color)
- (pconc, pacs, pdc, pis, dev, select);
+ return (*pacs->type->remap_concrete_color)
+ (pconc, pacs, pdc, pis, dev, select);
}
else {
gx_remap_concrete_separation(pconc[0], pdc, pis, dev, select);
@@ -411,7 +411,7 @@ check_Separation_component_name(const gs_color_space * pcs, gs_state * pgs)
byte * pname;
uint name_size;
gs_devicen_color_map * pcolor_component_map
- = &pgs->color_component_map;
+ = &pgs->color_component_map;
gx_device * dev = pgs->device;
pcolor_component_map->num_components = 1;
@@ -423,8 +423,8 @@ check_Separation_component_name(const gs_color_space * pcs, gs_state * pgs)
* use the alternate color space.
*/
if (pcs->params.separation.sep_type != SEP_OTHER) {
- pcolor_component_map->use_alt_cspace = false;
- return 0;
+ pcolor_component_map->use_alt_cspace = false;
+ return 0;
}
/*
* Always use the alternate color space if the current device is
@@ -432,8 +432,8 @@ check_Separation_component_name(const gs_color_space * pcs, gs_state * pgs)
* with a subtractive color model.
*/
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE) {
- pcolor_component_map->use_alt_cspace = true;
- return 0;
+ pcolor_component_map->use_alt_cspace = true;
+ return 0;
}
/*
* Get the character string and length for the component name.
@@ -446,19 +446,18 @@ check_Separation_component_name(const gs_color_space * pcs, gs_state * pgs)
* SeparationOrder list.
*/
colorant_number = (*dev_proc(dev, get_color_comp_index))
- (dev, (const char *)pname, name_size, SEPARATION_NAME);
+ (dev, (const char *)pname, name_size, SEPARATION_NAME);
if (colorant_number >= 0) { /* If valid colorant name */
- pcolor_component_map->color_map[0] =
- (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) ? -1
- : colorant_number;
- pcolor_component_map->use_alt_cspace = false;
+ pcolor_component_map->color_map[0] =
+ (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) ? -1
+ : colorant_number;
+ pcolor_component_map->use_alt_cspace = false;
}
else
- pcolor_component_map->use_alt_cspace = true;
+ pcolor_component_map->use_alt_cspace = true;
return 0;
}
-
/* ---------------- Notes on real Separation colors ---------------- */
typedef ulong gs_separation; /* BOGUS */
@@ -494,7 +493,7 @@ typedef ulong gs_separation; /* BOGUS */
/* ---------------- Serialization. -------------------------------- */
-static int
+static int
gx_serialize_Separation(const gs_color_space * pcs, stream * s)
{
const gs_separation_params * p = &pcs->params.separation;
@@ -502,16 +501,16 @@ gx_serialize_Separation(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->sep_name, sizeof(p->sep_name), &n);
if (code < 0)
- return code;
+ return code;
code = cs_serialize(pcs->base_space, s);
if (code < 0)
- return code;
+ return code;
code = gx_serialize_device_n_map(pcs, p->map, s);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->sep_type, sizeof(p->sep_type), &n);
/* p->use_alt_cspace isn't a property of the space. */
}
diff --git a/gs/base/gscsepr.h b/gs/base/gscsepr.h
index 563336c07..3e1dc5b4f 100644
--- a/gs/base/gscsepr.h
+++ b/gs/base/gscsepr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,6 @@
#include "gscspace.h"
-
/*
* Separation color spaces.
*
@@ -51,18 +50,18 @@ typedef struct gs_function_s gs_function_t;
# define gs_function_DEFINED
#endif
int gs_cspace_set_sepr_proc(gs_color_space * pcspace,
- int (*proc)(const float *,
- float *,
- const gs_imager_state *,
- void *
- ),
- void *proc_data
- );
+ int (*proc)(const float *,
+ float *,
+ const gs_imager_state *,
+ void *
+ ),
+ void *proc_data
+ );
/*
* Set the Separation tint transformation procedure to a Function.
*/
int gs_cspace_set_sepr_function(const gs_color_space *pcspace,
- gs_function_t *pfn);
+ gs_function_t *pfn);
/*
* If the Separation tint transformation procedure is a Function,
* return the function object, otherwise return 0.
diff --git a/gs/base/gscspace.c b/gs/base/gscspace.c
index f5a6d682f..937386466 100644
--- a/gs/base/gscspace.c
+++ b/gs/base/gscspace.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -87,33 +87,32 @@ public_st_base_color_space();
/* ------ Create/copy/destroy ------ */
-
static void
gs_cspace_final(void *vptr)
{
gs_color_space *pcs = (gs_color_space *)vptr;
if (pcs->type->final)
- pcs->type->final(pcs);
+ pcs->type->final(pcs);
if_debug2('c', "[c]cspace final %08x %d\n", pcs, pcs->id);
rc_decrement_only_cs(pcs->base_space, "gs_cspace_final");
-
+
/* No need to decrement the ICC profile data. It is handled
by the finalize of the ICC space which is called above using
pcs->type->final(pcs); */
-
+
}
static gs_color_space *
gs_cspace_alloc_with_id(gs_memory_t *mem, ulong id,
- const gs_color_space_type *pcstype)
+ const gs_color_space_type *pcstype)
{
gs_color_space *pcs;
rc_alloc_struct_1(pcs, gs_color_space, &st_color_space, mem, return NULL,
- "gs_cspace_alloc_with_id");
+ "gs_cspace_alloc_with_id");
if_debug3('c', "[c]cspace alloc %08x %s %d\n",
- pcs, pcstype->stype->sname, pcstype->index);
+ pcs, pcstype->stype->sname, pcstype->index);
pcs->type = pcstype;
pcs->id = id;
pcs->base_space = NULL;
@@ -143,23 +142,22 @@ gs_color_space *
gs_cspace_new_DeviceGray(gs_memory_t *mem)
{
return gs_cspace_alloc_with_id(mem, cs_DeviceGray_id,
- &gs_color_space_type_DeviceGray);
+ &gs_color_space_type_DeviceGray);
}
gs_color_space *
gs_cspace_new_DeviceRGB(gs_memory_t *mem)
{
return gs_cspace_alloc_with_id(mem, cs_DeviceRGB_id,
- &gs_color_space_type_DeviceRGB);
+ &gs_color_space_type_DeviceRGB);
}
gs_color_space *
gs_cspace_new_DeviceCMYK(gs_memory_t *mem)
{
return gs_cspace_alloc_with_id(mem, cs_DeviceCMYK_id,
- &gs_color_space_type_DeviceCMYK);
+ &gs_color_space_type_DeviceCMYK);
}
-
/* ------ Accessors ------ */
/* Get the index of a color space. */
@@ -195,7 +193,7 @@ bool gs_color_space_is_PSCIE(const gs_color_space * pcs)
case gs_color_space_index_CIEA:
return true;
break;
- default:
+ default:
return false;
}
}
@@ -226,13 +224,13 @@ gx_install_DeviceGray(gs_color_space * pcs, gs_state * pgs)
{
if (pcs->cmm_icc_profile_data == NULL) {
if (pgs->icc_manager->default_gray == NULL) {
- /* User params have not yet been set for the icc manager
+ /* User params have not yet been set for the icc manager
go ahead and init */
gsicc_init_iccmanager(pgs);
}
pcs->cmm_icc_profile_data = pgs->icc_manager->default_gray;
pcs->type = &gs_color_space_type_ICC;
- rc_adjust(pgs->icc_manager->default_gray, pcs->rc.ref_count, "gx_install_DeviceGray");
+ rc_adjust(pgs->icc_manager->default_gray, pcs->rc.ref_count, "gx_install_DeviceGray");
}
return 0;
}
@@ -263,7 +261,6 @@ gs_cspace_base_space(const gs_color_space * pcspace)
return pcspace->base_space;
}
-
/* Abstract the reference counting for color spaces
so that we can also increment the ICC profile
if there is one associated with the color space */
@@ -304,13 +301,12 @@ void cs_adjust_counts_icc(gs_state *pgs, int delta)
if (pcs) {
if (pcs->cmm_icc_profile_data != NULL) {
- rc_adjust(pcs->cmm_icc_profile_data, delta, "cs_adjust_counts_icc");
+ rc_adjust(pcs->cmm_icc_profile_data, delta, "cs_adjust_counts_icc");
}
cs_adjust_counts(pgs, delta);
}
}
-
/* ------ Other implementation procedures ------ */
/* Null color space installation procedure. */
@@ -319,20 +315,20 @@ gx_no_install_cspace(gs_color_space * pcs, gs_state * pgs)
{
return 0;
}
-
+
/* Install a DeviceRGB color space. */
static int
gx_install_DeviceRGB(gs_color_space * pcs, gs_state * pgs)
{
if (pcs->cmm_icc_profile_data == NULL) {
if (pgs->icc_manager->default_rgb == NULL) {
- /* User params have not yet been set for the icc manager
+ /* User params have not yet been set for the icc manager
go ahead and init */
gsicc_init_iccmanager(pgs);
}
pcs->cmm_icc_profile_data = pgs->icc_manager->default_rgb;
pcs->type = &gs_color_space_type_ICC;
- rc_adjust(pgs->icc_manager->default_rgb, pcs->rc.ref_count, "gx_install_DeviceRGB");
+ rc_adjust(pgs->icc_manager->default_rgb, pcs->rc.ref_count, "gx_install_DeviceRGB");
}
return 0;
}
@@ -343,13 +339,13 @@ gx_install_DeviceCMYK(gs_color_space * pcs, gs_state * pgs)
{
if (pcs->cmm_icc_profile_data == NULL) {
if (pgs->icc_manager->default_cmyk == NULL) {
- /* User params have not yet been set for the icc manager
+ /* User params have not yet been set for the icc manager
go ahead and init */
gsicc_init_iccmanager(pgs);
}
pcs->cmm_icc_profile_data = pgs->icc_manager->default_cmyk;
pcs->type = &gs_color_space_type_ICC;
- rc_adjust(pgs->icc_manager->default_cmyk, pcs->rc.ref_count, "gx_install_DeviceCMYK");
+ rc_adjust(pgs->icc_manager->default_cmyk, pcs->rc.ref_count, "gx_install_DeviceCMYK");
}
return 0;
}
@@ -374,7 +370,6 @@ gx_spot_colors_set_overprint(const gs_color_space * pcs, gs_state * pgs)
return gs_state_update_overprint(pgs, &params);
}
-
static bool
check_single_comp(int comp, frac targ_val, int ncomps, const frac * pval)
{
@@ -534,69 +529,69 @@ int gx_set_overprint_cmyk(const gs_color_space * pcs, gs_state * pgs)
/* A stub for a color mapping linearity check, when it is inapplicable. */
int
gx_cspace_no_linear(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device * dev,
- const gs_client_color *c0, const gs_client_color *c1,
- const gs_client_color *c2, const gs_client_color *c3,
- float smoothness, gsicc_link_t *icclink)
+ gx_device * dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ const gs_client_color *c2, const gs_client_color *c3,
+ float smoothness, gsicc_link_t *icclink)
{
return_error(gs_error_rangecheck);
}
static inline int
cc2dc(const gs_color_space *cs, const gs_imager_state * pis, gx_device *dev,
- gx_device_color *dc, const gs_client_color *cc)
+ gx_device_color *dc, const gs_client_color *cc)
{
return cs->type->remap_color(cc, cs, dc, pis, dev, gs_color_select_texture);
}
static inline void
-interpolate_cc(gs_client_color *c,
- const gs_client_color *c0, const gs_client_color *c1, double t, int n)
+interpolate_cc(gs_client_color *c,
+ const gs_client_color *c0, const gs_client_color *c1, double t, int n)
{
int i;
for (i = 0; i < n; i++)
- c->paint.values[i] = c0->paint.values[i] * t + c1->paint.values[i] * (1 - t);
+ c->paint.values[i] = c0->paint.values[i] * t + c1->paint.values[i] * (1 - t);
}
static inline bool
-is_dc_nearly_linear(const gx_device *dev, const gx_device_color *c,
- const gx_device_color *c0, const gx_device_color *c1,
- double t, int n, float smoothness)
+is_dc_nearly_linear(const gx_device *dev, const gx_device_color *c,
+ const gx_device_color *c0, const gx_device_color *c1,
+ double t, int n, float smoothness)
{
if (c0->type == &gx_dc_type_data_pure) {
- int i;
- gx_color_index pure0 = c0->colors.pure;
- gx_color_index pure1 = c1->colors.pure;
- gx_color_index pure = c->colors.pure;
-
- for (i = 0; i < n; i++) {
- int shift = dev->color_info.comp_shift[i];
- int mask = (1 << dev->color_info.comp_bits[i]) - 1;
- int max_color = (i == dev->color_info.gray_index ? dev->color_info.max_gray
- : dev->color_info.max_color);
- float max_diff = max(1, max_color * smoothness);
- int b0 = (pure0 >> shift) & mask, b1 = (pure1 >> shift) & mask;
- int b = (pure >> shift) & mask;
- double bb = b0 * t + b1 * (1 - t);
-
- if (any_abs(b - bb) > max_diff)
- return false;
- }
- return true;
+ int i;
+ gx_color_index pure0 = c0->colors.pure;
+ gx_color_index pure1 = c1->colors.pure;
+ gx_color_index pure = c->colors.pure;
+
+ for (i = 0; i < n; i++) {
+ int shift = dev->color_info.comp_shift[i];
+ int mask = (1 << dev->color_info.comp_bits[i]) - 1;
+ int max_color = (i == dev->color_info.gray_index ? dev->color_info.max_gray
+ : dev->color_info.max_color);
+ float max_diff = max(1, max_color * smoothness);
+ int b0 = (pure0 >> shift) & mask, b1 = (pure1 >> shift) & mask;
+ int b = (pure >> shift) & mask;
+ double bb = b0 * t + b1 * (1 - t);
+
+ if (any_abs(b - bb) > max_diff)
+ return false;
+ }
+ return true;
} else {
- /* Halftones must not paint with fill_linear_color_*. */
- return false;
+ /* Halftones must not paint with fill_linear_color_*. */
+ return false;
}
}
/* Default color mapping linearity check, a 2-points case. */
static int
gx_cspace_is_linear_in_line(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- float smoothness)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ float smoothness)
{
gs_client_color c01a, c01b;
gx_device_color d[2], d01a, d01b;
@@ -606,34 +601,34 @@ gx_cspace_is_linear_in_line(const gs_color_space *cs, const gs_imager_state * pi
code = cc2dc(cs, pis, dev, &d[0], c0);
if (code < 0)
- return code;
+ return code;
code = cc2dc(cs, pis, dev, &d[1], c1);
if (code < 0)
- return code;
+ return code;
interpolate_cc(&c01a, c0, c1, 0.3, n);
code = cc2dc(cs, pis, dev, &d01a, &c01a);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d01a, &d[0], &d[1], 0.3, ndev, smoothness))
- return 0;
+ return 0;
interpolate_cc(&c01b, c0, c1, 0.7, n);
code = cc2dc(cs, pis, dev, &d01b, &c01b);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d01b, &d[0], &d[1], 0.7, ndev, smoothness))
- return 0;
+ return 0;
return 1;
}
/* Default color mapping linearity check, a triangle case. */
static int
gx_cspace_is_linear_in_triangle(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- const gs_client_color *c2, float smoothness)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ const gs_client_color *c2, float smoothness)
{
- /* We check 4 points - the median center, and middle points of 3 sides.
- Hopely this is enough for reasonable color spaces and color renderings.
+ /* We check 4 points - the median center, and middle points of 3 sides.
+ Hopely this is enough for reasonable color spaces and color renderings.
Note it gives 7 points for a quadrangle. */
gs_client_color c01, c12, c20, c012;
gx_device_color d[3], d01, d12, d20, d012;
@@ -648,71 +643,70 @@ gx_cspace_is_linear_in_triangle(const gs_color_space *cs, const gs_imager_state
code = cc2dc(cs, pis, dev, &d[0], c0);
if (code < 0)
- return code;
+ return code;
code = cc2dc(cs, pis, dev, &d[1], c1);
if (code < 0)
- return code;
+ return code;
code = cc2dc(cs, pis, dev, &d[2], c2);
if (code < 0)
- return code;
+ return code;
interpolate_cc(&c01, c0, c1, 0.5, n);
code = cc2dc(cs, pis, dev, &d01, &c01);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d01, &d[0], &d[1], 0.5, ndev, smoothness))
- return 0;
+ return 0;
interpolate_cc(&c012, c2, &c01, 2.0 / 3, n);
code = cc2dc(cs, pis, dev, &d012, &c012);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d012, &d[2], &d01, 2.0 / 3, ndev, smoothness))
- return 0;
+ return 0;
interpolate_cc(&c12, c1, c2, 0.5, n);
code = cc2dc(cs, pis, dev, &d12, &c12);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d12, &d[1], &d[2], 0.5, ndev, smoothness))
- return 0;
+ return 0;
interpolate_cc(&c20, c2, c0, 0.5, n);
code = cc2dc(cs, pis, dev, &d20, &c20);
if (code < 0)
- return code;
+ return code;
if (!is_dc_nearly_linear(dev, &d20, &d[2], &d[0], 0.5, ndev, smoothness))
- return 0;
+ return 0;
return 1;
}
-
/* Default color mapping linearity check. */
int
gx_cspace_is_linear_default(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- const gs_client_color *c2, const gs_client_color *c3,
- float smoothness, gsicc_link_t *icclink)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ const gs_client_color *c2, const gs_client_color *c3,
+ float smoothness, gsicc_link_t *icclink)
{
/* Assuming 2 <= nc <= 4. We don't need other cases. */
/* With nc == 4 assuming a convex plain quadrangle in the client color space. */
int code;
if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (c2 == NULL)
- return gx_cspace_is_linear_in_line(cs, pis, dev, c0, c1, smoothness);
+ return gx_cspace_is_linear_in_line(cs, pis, dev, c0, c1, smoothness);
code = gx_cspace_is_linear_in_triangle(cs, pis, dev, c0, c1, c2, smoothness);
if (code <= 0)
- return code;
+ return code;
if (c3 == NULL)
- return 1;
+ return 1;
return gx_cspace_is_linear_in_triangle(cs, pis, dev, c1, c2, c3, smoothness);
}
/* Serialization. */
-int
+int
gx_serialize_cspace_type(const gs_color_space * pcs, stream * s)
{
const gs_color_space_type * type = pcs->type;
@@ -722,21 +716,21 @@ gx_serialize_cspace_type(const gs_color_space * pcs, stream * s)
/* GC procedures */
-static
+static
ENUM_PTRS_BEGIN_PROC(color_space_enum_ptrs)
{
EV_CONST gs_color_space *pcs = vptr;
if (index == 0)
- return ENUM_OBJ(pcs->base_space);
+ return ENUM_OBJ(pcs->base_space);
if (index == 1)
- return ENUM_OBJ(pcs->pclient_color_space_data);
+ return ENUM_OBJ(pcs->pclient_color_space_data);
if (index == 2)
return ENUM_OBJ(pcs->icc_equivalent);
return ENUM_USING(*pcs->type->stype, vptr, size, index - 3);
ENUM_PTRS_END_PROC
}
-static
+static
RELOC_PTRS_WITH(color_space_reloc_ptrs, gs_color_space *pcs)
{
RELOC_VAR(pcs->base_space);
@@ -745,4 +739,3 @@ RELOC_PTRS_WITH(color_space_reloc_ptrs, gs_color_space *pcs)
RELOC_USING(*pcs->type->stype, vptr, size);
}
RELOC_PTRS_END
-
diff --git a/gs/base/gscspace.h b/gs/base/gscspace.h
index df12d1463..259113f5f 100644
--- a/gs/base/gscspace.h
+++ b/gs/base/gscspace.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -75,31 +75,30 @@
* uncolored: base_space dictionary + base space params
*/
-
/* In moving to a pure ICC based color management every color space
(or its base space) will be defined by an ICC profile. All modern
- CMMs provide a handle to a profile structure when handed an
+ CMMs provide a handle to a profile structure when handed an
ICC profile. This handle will become a new member variable for
ghostscripts color space structure. When that profile is initialized
depends upon the color space type.
- a) If the color space is defined to be ICC based, then the profile handle
- will be obtained during the installation of this space.
-
+ a) If the color space is defined to be ICC based, then the profile handle
+ will be obtained during the installation of this space.
+
b) If the color space is a defined as deviceRGB, CMYK or Gray color space, then
the profile handle will be populated with the handle for the ICC profile that
- is in the ICC manager for that color space type.
+ is in the ICC manager for that color space type.
c) If the color space is defined as one of the Postscript or PDF CIE (nonICC)
color spaces, then the profile handle will only be obtained once a request is made
- to obtain a link that includes this color space. At that point
+ to obtain a link that includes this color space. At that point
we will convert the nonICC colorspace to an ICC color space.
d) DevicePixel color space appears to only be used by the image3x code
for the softmask. Really this should be a Gray color space that is
- never really linked as we do not want a pure alpha image to be
- colorimetrically managed. Need to do a bit of code/history review to
- understand what this space is. It may need to be specially managed. It never
+ never really linked as we do not want a pure alpha image to be
+ colorimetrically managed. Need to do a bit of code/history review to
+ understand what this space is. It may need to be specially managed. It never
is used in a linked transformation.
e) DeviceN is related somewhat to the colorspaces in b) but a bit different.
@@ -107,7 +106,7 @@
with an ICC profile. XPS and OpenXPS do, and it is likely that SVG will
do so too. Also, it may become possible in future PDF versions to define
DeviceN source colors with and ICC profile.
- To support these cases when creating a deviceN color space, it
+ To support these cases when creating a deviceN color space, it
will need to be possible to include the ICC information related to that
color space. When it is provided, the handle for that color space will
be obtained from the CMM similar to the ICC spaces in a) . Note that the
@@ -118,7 +117,7 @@
f) Indexed and Pattern. These will not have an ICC CMM handle. Their base
space will however.
- g) Separation. These can have an ICC CMM handle. The exact capabilities
+ g) Separation. These can have an ICC CMM handle. The exact capabilities
depend upon the form of the Named color structure that the CMM is going
to use. If it is using a traditional ICC named color profile and the entry
for the color name is there, then we will have a handle to the named
@@ -267,8 +266,8 @@ typedef struct gs_indexed_params_s {
int hival; /* num_entries - 1 */
int n_comps;
union {
- gs_const_string table; /* size is implicit */
- gs_indexed_map *map;
+ gs_const_string table; /* size is implicit */
+ gs_indexed_map *map;
} lookup;
bool use_proc; /* 0 = use table, 1 = use proc & map */
} gs_indexed_params;
@@ -303,28 +302,27 @@ struct gs_color_space_s {
client_color_space_data_t *pclient_color_space_data;
cmm_profile_t *cmm_icc_profile_data;
union {
- gs_device_pixel_params pixel;
- gs_cie_defg * defg;
- gs_cie_def * def;
- gs_cie_abc * abc;
- gs_cie_a * a;
- gs_separation_params separation;
- gs_device_n_params device_n;
- gs_indexed_params indexed;
- gs_pattern_params pattern;
+ gs_device_pixel_params pixel;
+ gs_cie_defg * defg;
+ gs_cie_def * def;
+ gs_cie_abc * abc;
+ gs_cie_a * a;
+ gs_separation_params separation;
+ gs_device_n_params device_n;
+ gs_indexed_params indexed;
+ gs_pattern_params pattern;
} params;
};
-
- /*extern_st(st_color_space); *//* in gxcspace.h */
+ /*extern_st(st_color_space); *//* in gxcspace.h */
#define public_st_color_space() /* in gscspace.c */ \
gs_public_st_composite_final( st_color_space, \
- gs_color_space, \
- "gs_color_space", \
- color_space_enum_ptrs, \
- color_space_reloc_ptrs, \
- gs_cspace_final \
+ gs_color_space, \
+ "gs_color_space", \
+ color_space_enum_ptrs, \
+ color_space_reloc_ptrs, \
+ gs_cspace_final \
)
/* ---------------- Procedures ---------------- */
@@ -336,7 +334,6 @@ gs_color_space *gs_cspace_new_DeviceGray(gs_memory_t *mem);
gs_color_space *gs_cspace_new_DeviceRGB(gs_memory_t *mem);
gs_color_space *gs_cspace_new_DeviceCMYK(gs_memory_t *mem);
-
/* ------ Accessors ------ */
/* Get the index of a color space. */
@@ -358,7 +355,7 @@ int gs_color_space_num_components(const gs_color_space *);
* equal, while if it returns false, they might still be equivalent.
*/
bool gs_color_space_equal(const gs_color_space *pcs1,
- const gs_color_space *pcs2);
+ const gs_color_space *pcs2);
/* Restrict a color to its legal range. */
#ifndef gs_client_color_DEFINED
@@ -374,7 +371,7 @@ void gs_color_space_restrict_color(gs_client_color *, const gs_color_space *);
*/
const gs_color_space *gs_cspace_base_space(const gs_color_space * pcspace);
-/* Abstract the rc_increment and rc_decrement for color spaces so that we also rc_increment
+/* Abstract the rc_increment and rc_decrement for color spaces so that we also rc_increment
the ICC profile if there is one associated with the color space */
void rc_increment_cs(gs_color_space *pcs);
diff --git a/gs/base/gscssub.c b/gs/base/gscssub.c
index a5b7415e3..b7bd66bbe 100644
--- a/gs/base/gscssub.c
+++ b/gs/base/gscssub.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,22 +26,22 @@
* be used for this purpose). */
int
gs_setsubstitutecolorspace(gs_state *pgs, gs_color_space_index csi,
- const gs_color_space *pcs)
+ const gs_color_space *pcs)
{
int index = (int)csi;
static const uint masks[3] = {
- (1 << gs_color_space_index_DeviceGray) |
- (1 << gs_color_space_index_CIEA),
- (1 << gs_color_space_index_DeviceRGB) |
- (1 << gs_color_space_index_CIEABC) |
- (1 << gs_color_space_index_CIEDEF),
- (1 << gs_color_space_index_DeviceCMYK) |
- (1 << gs_color_space_index_CIEDEFG)
+ (1 << gs_color_space_index_DeviceGray) |
+ (1 << gs_color_space_index_CIEA),
+ (1 << gs_color_space_index_DeviceRGB) |
+ (1 << gs_color_space_index_CIEABC) |
+ (1 << gs_color_space_index_CIEDEF),
+ (1 << gs_color_space_index_DeviceCMYK) |
+ (1 << gs_color_space_index_CIEDEFG)
};
const gs_color_space *pcs_old;
if (index < 0 || index > 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pcs) {
if (gs_color_space_get_index(pcs) == gs_color_space_index_CIEICC) {
static const byte dev_ncomps[3] = {1, 3, 4};
@@ -49,15 +49,15 @@ gs_setsubstitutecolorspace(gs_state *pgs, gs_color_space_index csi,
if (dev_ncomps[index] != cs_num_components(pcs))
return_error(gs_error_rangecheck);
} else if (!masks[index] && (1 << gs_color_space_get_index(pcs)))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
pcs_old = pgs->device_color_spaces.indexed[index];
if (pcs_old == 0 && (pcs == 0 || gs_color_space_get_index(pcs) == csi))
- return 0;
+ return 0;
rc_assign(pgs->device_color_space.indexed[index],
- (pcs ? pcs :
- pgs->shared->device_color_spaces.indexed[index]),
- "gs_setsubstitutecolorspace");
+ (pcs ? pcs :
+ pgs->shared->device_color_spaces.indexed[index]),
+ "gs_setsubstitutecolorspace");
return 0;
}
@@ -68,8 +68,8 @@ gs_current_DeviceGray_space(const gs_state *pgs)
const gs_color_space *pcs;
return (!pgs->device->UseCIEColor ||
- (pcs = pgs->device_color_spaces.named.Gray) == 0 ?
- pgs->shared->device_color_spaces.named.Gray : pcs);
+ (pcs = pgs->device_color_spaces.named.Gray) == 0 ?
+ pgs->shared->device_color_spaces.named.Gray : pcs);
}
const gs_color_space *
gs_current_DeviceRGB_space(const gs_state *pgs)
@@ -77,8 +77,8 @@ gs_current_DeviceRGB_space(const gs_state *pgs)
const gs_color_space *pcs;
return (!pgs->device->UseCIEColor ||
- (pcs = pgs->device_color_spaces.named.RGB) == 0 ?
- pgs->shared->device_color_spaces.named.RGB : pcs);
+ (pcs = pgs->device_color_spaces.named.RGB) == 0 ?
+ pgs->shared->device_color_spaces.named.RGB : pcs);
}
const gs_color_space *
gs_current_DeviceCMYK_space(const gs_state *pgs)
@@ -86,8 +86,8 @@ gs_current_DeviceCMYK_space(const gs_state *pgs)
const gs_color_space *pcs;
return (!pgs->device->UseCIEColor ||
- (pcs = pgs->device_color_spaces.named.CMYK) == 0 ?
- pgs->shared->device_color_spaces.named.CMYK : pcs);
+ (pcs = pgs->device_color_spaces.named.CMYK) == 0 ?
+ pgs->shared->device_color_spaces.named.CMYK : pcs);
}
/* .currentsubstitutecolorspace */
@@ -96,12 +96,12 @@ gs_currentsubstitutecolorspace(const gs_state *pgs, gs_color_space_index csi)
{
switch (csi) {
case gs_color_space_index_DeviceGray:
- return gs_current_DeviceGray_space(pgs);
+ return gs_current_DeviceGray_space(pgs);
case gs_color_space_index_DeviceRGB:
- return gs_current_DeviceRGB_space(pgs);
+ return gs_current_DeviceRGB_space(pgs);
case gs_color_space_index_DeviceCMYK:
- return gs_current_DeviceCMYK_space(pgs);
+ return gs_current_DeviceCMYK_space(pgs);
default:
- return 0;
+ return 0;
}
}
diff --git a/gs/base/gscssub.h b/gs/base/gscssub.h
index f3da63f2e..4b373f166 100644
--- a/gs/base/gscssub.h
+++ b/gs/base/gscssub.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,10 +52,10 @@
/* If pcs is NULL, it means undo any substitution. */
int gs_setsubstitutecolorspace(gs_state *pgs, gs_color_space_index csi,
- const gs_color_space *pcs);
+ const gs_color_space *pcs);
const gs_color_space *
gs_currentsubstitutecolorspace(const gs_state *pgs,
- gs_color_space_index csi);
+ gs_color_space_index csi);
/*
* The following procedures are primarily for internal use, to provide
diff --git a/gs/base/gsdcolor.h b/gs/base/gsdcolor.h
index e8da04b50..a2661fe22 100644
--- a/gs/base/gsdcolor.h
+++ b/gs/base/gsdcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -85,7 +85,7 @@ typedef struct gx_device_halftone_s gx_device_halftone;
* about the equality of the two device colors.
*/
bool gx_device_color_equal(const gx_device_color *pdevc1,
- const gx_device_color *pdevc2);
+ const gx_device_color *pdevc2);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* The definitions in the following section of the file, plus the ones
@@ -266,41 +266,41 @@ struct gx_device_color_s {
* members even when it's unambiguous.
*/
union _c {
- gx_color_index pure;
- struct _bin {
- const gx_device_halftone *b_ht;
- gx_color_index color[2];
- uint b_level;
- int b_index;
- gx_ht_tile *b_tile;
- } binary;
- struct _col {
- gx_device_halftone *c_ht; /* non-const for setting cache ptr */
- ushort num_components;
- byte c_base[GX_DEVICE_COLOR_MAX_COMPONENTS];
- uint c_level[GX_DEVICE_COLOR_MAX_COMPONENTS];
- ushort /*gx_color_value */ alpha;
+ gx_color_index pure;
+ struct _bin {
+ const gx_device_halftone *b_ht;
+ gx_color_index color[2];
+ uint b_level;
+ int b_index;
+ gx_ht_tile *b_tile;
+ } binary;
+ struct _col {
+ gx_device_halftone *c_ht; /* non-const for setting cache ptr */
+ ushort num_components;
+ byte c_base[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ uint c_level[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ ushort /*gx_color_value */ alpha;
#if GX_DEVICE_COLOR_MAX_COMPONENTS <= ARCH_SIZEOF_SHORT * 8
- ushort plane_mask;
+ ushort plane_mask;
#else
#if GX_DEVICE_COLOR_MAX_COMPONENTS <= ARCH_SIZEOF_INT * 8
- uint plane_mask;
+ uint plane_mask;
#else
- gx_color_index plane_mask;
+ gx_color_index plane_mask;
#endif
#endif
- } colored;
- struct _wts {
- const gx_device_halftone *w_ht;
- wts_screen_sample_t levels[GX_DEVICE_COLOR_MAX_COMPONENTS];
- ushort num_components;
-
- /* plane_mask and base_color would be an optimization */
- gx_color_index plane_vector[GX_DEVICE_COLOR_MAX_COMPONENTS];
- } wts;
- struct _pat {
- gx_color_tile *p_tile;
- } /*(colored) */ pattern;
+ } colored;
+ struct _wts {
+ const gx_device_halftone *w_ht;
+ wts_screen_sample_t levels[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ ushort num_components;
+
+ /* plane_mask and base_color would be an optimization */
+ gx_color_index plane_vector[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ } wts;
+ struct _pat {
+ gx_color_tile *p_tile;
+ } /*(colored) */ pattern;
} colors;
gs_int_point phase;
/*
@@ -320,11 +320,11 @@ struct gx_device_color_s {
gs_client_color ccolor;
struct _mask {
- struct mp_ {
- short x, y;
- } m_phase;
- gx_bitmap_id id;
- gx_color_tile *m_tile;
+ struct mp_ {
+ short x, y;
+ } m_phase;
+ gx_bitmap_id id;
+ gx_color_tile *m_tile;
} mask;
};
@@ -388,19 +388,18 @@ struct gx_device_color_saved_s {
struct _swts {
wts_screen_sample_t levels[GX_DEVICE_COLOR_MAX_COMPONENTS];
} wts;
- struct _pattern {
- gs_id id;
- gs_int_point phase;
- } pattern;
- struct _pattern2 {
- gs_id id;
- bool shfill;
- } pattern2;
+ struct _pattern {
+ gs_id id;
+ gs_int_point phase;
+ } pattern;
+ struct _pattern2 {
+ gs_id id;
+ bool shfill;
+ } pattern2;
} colors;
gs_int_point phase;
};
-
/*
* Define the standard device color types.
* We define them here as pointers to the real types only because a few
@@ -419,10 +418,10 @@ extern const gx_device_color_type_t *const gx_dc_type_null; /* gxdcolor.c */
#ifndef gx_dc_type_pure
extern const gx_device_color_type_t *const gx_dc_type_pure; /* gxdcolor.c */
#endif
- /*
- * We don't declare gx_dc_pattern here, so as not to create
- * a spurious external reference in Level 1 systems.
- */
+ /*
+ * We don't declare gx_dc_pattern here, so as not to create
+ * a spurious external reference in Level 1 systems.
+ */
#ifndef gx_dc_type_pattern
/*extern const gx_device_color_type_t * const gx_dc_type_pattern; *//* gspcolor.c */
#endif
diff --git a/gs/base/gsdevice.c b/gs/base/gsdevice.c
index 1c0664a0e..767c1e259 100644
--- a/gs/base/gsdevice.c
+++ b/gs/base/gsdevice.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,11 +50,11 @@ gx_device_finalize(void *vptr)
rc_decrement(dev->device_icc_profile, "gx_device_finalize(icc_profile)");
}
if (dev->finalize)
- dev->finalize(dev);
+ dev->finalize(dev);
discard(gs_closedevice(dev));
if (dev->stype_is_dynamic)
- gs_free_const_object(dev->memory->non_gc_memory, dev->stype,
- "gx_device_finalize");
+ gs_free_const_object(dev->memory->non_gc_memory, dev->stype,
+ "gx_device_finalize");
}
/* "Free" a device locally allocated on the stack, by finalizing it. */
@@ -65,7 +65,7 @@ gx_device_free_local(gx_device *dev)
}
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(device_forward_enum_ptrs, gx_device_forward *fdev) return 0;
case 0: ENUM_RETURN(gx_device_enum_ptr(fdev->target));
ENUM_PTRS_END
@@ -90,14 +90,14 @@ gx_device *
gx_device_enum_ptr(gx_device * dev)
{
if (dev == 0 || dev->memory == 0)
- return 0;
+ return 0;
return dev;
}
gx_device *
gx_device_reloc_ptr(gx_device * dev, gc_state_t * gcst)
{
if (dev == 0 || dev->memory == 0)
- return dev;
+ return dev;
return RELOC_OBJ(dev); /* gcst implicit */
}
@@ -107,8 +107,8 @@ void
gx_device_set_procs(gx_device * dev)
{
if (dev->static_procs != 0) { /* 0 if already populated */
- dev->procs = *dev->static_procs;
- dev->static_procs = 0;
+ dev->procs = *dev->static_procs;
+ dev->static_procs = 0;
}
}
@@ -143,7 +143,7 @@ gs_output_page(gs_state * pgs, int num_copies, int flush)
gs_grestore(pgs);
if (dev->IgnoreNumCopies)
- num_copies = 1;
+ num_copies = 1;
return (*dev_proc(dev, output_page)) (dev, num_copies, flush);
}
@@ -161,7 +161,7 @@ gx_finish_output_page(gx_device *dev, int num_copies, int flush)
/* Copy scan lines from an image device */
int
gs_copyscanlines(gx_device * dev, int start_y, byte * data, uint size,
- int *plines_copied, uint * pbytes_copied)
+ int *plines_copied, uint * pbytes_copied)
{
uint line_size = gx_device_raster(dev, 0);
uint count = size / line_size;
@@ -169,19 +169,19 @@ gs_copyscanlines(gx_device * dev, int start_y, byte * data, uint size,
byte *dest = data;
for (i = 0; i < count; i++, dest += line_size) {
- int code = (*dev_proc(dev, get_bits)) (dev, start_y + i, dest, NULL);
-
- if (code < 0) {
- /* Might just be an overrun. */
- if (start_y + i == dev->height)
- break;
- return_error(code);
- }
+ int code = (*dev_proc(dev, get_bits)) (dev, start_y + i, dest, NULL);
+
+ if (code < 0) {
+ /* Might just be an overrun. */
+ if (start_y + i == dev->height)
+ break;
+ return_error(code);
+ }
}
if (plines_copied != NULL)
- *plines_copied = i;
+ *plines_copied = i;
if (pbytes_copied != NULL)
- *pbytes_copied = i * line_size;
+ *pbytes_copied = i * line_size;
return 0;
}
@@ -215,7 +215,7 @@ gs_getdevice(int index)
int count = gs_lib_device_list(&list, NULL);
if (index < 0 || index >= count)
- return 0; /* index out of range */
+ return 0; /* index out of range */
return list[index];
}
@@ -236,17 +236,17 @@ gs_getdefaultdevice(void)
while (name < fin) {
/* split a name from any whitespace */
- while ((name < fin) && (*name == ' ' || *name == '\t'))
- name++;
+ while ((name < fin) && (*name == ' ' || *name == '\t'))
+ name++;
end = name;
while ((end < fin) && (*end != ' ') && (*end != '\t'))
- end++;
+ end++;
/* return any matches */
for (i = 0; i < count; i++)
if ((end - name) == strlen(list[i]->dname))
- if (!memcmp(name, list[i]->dname, end - name))
- return gs_getdevice(i);
+ if (!memcmp(name, list[i]->dname, end - name))
+ return gs_getdevice(i);
/* otherwise, try the next device name */
name = end;
@@ -259,7 +259,7 @@ gs_getdefaultdevice(void)
/* Fill in the GC structure descriptor for a device. */
static void
gx_device_make_struct_type(gs_memory_struct_type_t *st,
- const gx_device *dev)
+ const gx_device *dev)
{
const gx_device_procs *procs = dev->static_procs;
@@ -271,20 +271,20 @@ gx_device_make_struct_type(gs_memory_struct_type_t *st,
* best we can come up with.
*/
if (procs == 0)
- procs = &dev->procs;
+ procs = &dev->procs;
if (dev->stype)
- *st = *dev->stype;
+ *st = *dev->stype;
else if (procs->get_xfont_procs == gx_forward_get_xfont_procs)
- *st = st_device_forward;
+ *st = st_device_forward;
else
- *st = st_device;
+ *st = st_device;
st->ssize = dev->params_size;
}
/* Clone an existing device. */
int
gs_copydevice2(gx_device ** pnew_dev, const gx_device * dev, bool keep_open,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
gx_device *new_dev;
const gs_memory_struct_type_t *std = dev->stype;
@@ -293,38 +293,38 @@ gs_copydevice2(gx_device ** pnew_dev, const gx_device * dev, bool keep_open,
int code;
if (dev->stype_is_dynamic) {
- /*
- * We allocated the stype for this device previously.
- * Just allocate a new stype and copy the old one into it.
- */
- a_std = (gs_memory_struct_type_t *)
- gs_alloc_bytes_immovable(mem->non_gc_memory, sizeof(*std),
- "gs_copydevice(stype)");
- if (!a_std)
- return_error(gs_error_VMerror);
- *a_std = *std;
- new_std = a_std;
+ /*
+ * We allocated the stype for this device previously.
+ * Just allocate a new stype and copy the old one into it.
+ */
+ a_std = (gs_memory_struct_type_t *)
+ gs_alloc_bytes_immovable(mem->non_gc_memory, sizeof(*std),
+ "gs_copydevice(stype)");
+ if (!a_std)
+ return_error(gs_error_VMerror);
+ *a_std = *std;
+ new_std = a_std;
} else if (std != 0 && std->ssize == dev->params_size) {
- /* Use the static stype. */
- new_std = std;
+ /* Use the static stype. */
+ new_std = std;
} else {
- /* We need to figure out or adjust the stype. */
- a_std = (gs_memory_struct_type_t *)
- gs_alloc_bytes_immovable(mem->non_gc_memory, sizeof(*std),
- "gs_copydevice(stype)");
- if (!a_std)
- return_error(gs_error_VMerror);
- gx_device_make_struct_type(a_std, dev);
- new_std = a_std;
+ /* We need to figure out or adjust the stype. */
+ a_std = (gs_memory_struct_type_t *)
+ gs_alloc_bytes_immovable(mem->non_gc_memory, sizeof(*std),
+ "gs_copydevice(stype)");
+ if (!a_std)
+ return_error(gs_error_VMerror);
+ gx_device_make_struct_type(a_std, dev);
+ new_std = a_std;
}
/*
* Because command list devices have complicated internal pointer
* structures, we allocate all device instances as immovable.
*/
new_dev = gs_alloc_struct_immovable(mem, gx_device, new_std,
- "gs_copydevice(device)");
+ "gs_copydevice(device)");
if (new_dev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_device_init(new_dev, dev, mem, false);
gx_device_set_procs(new_dev);
new_dev->stype = new_std;
@@ -340,13 +340,13 @@ gs_copydevice2(gx_device ** pnew_dev, const gx_device * dev, bool keep_open,
fill_dev_proc(new_dev, finish_copydevice, gx_default_finish_copydevice);
code = dev_proc(new_dev, finish_copydevice)(new_dev, dev);
if (code < 0) {
- gs_free_object(mem, new_dev, "gs_copydevice(device)");
+ gs_free_object(mem, new_dev, "gs_copydevice(device)");
#if 0 /* gs_free_object above calls gx_device_finalize,
- which closes the device and releaszes its stype, i.e. a_std. */
- if (a_std)
- gs_free_object(dev->memory->non_gc_memory, a_std, "gs_copydevice(stype)");
+ which closes the device and releaszes its stype, i.e. a_std. */
+ if (a_std)
+ gs_free_object(dev->memory->non_gc_memory, a_std, "gs_copydevice(stype)");
#endif
- return code;
+ return code;
}
*pnew_dev = new_dev;
return 0;
@@ -363,28 +363,28 @@ int
gs_opendevice(gx_device *dev)
{
if (dev->is_open)
- return 0;
+ return 0;
check_device_separable(dev);
gx_device_fill_in_procs(dev);
{
- int code = (*dev_proc(dev, open_device))(dev);
+ int code = (*dev_proc(dev, open_device))(dev);
- if (code < 0)
- return_error(code);
- dev->is_open = true;
- return 1;
+ if (code < 0)
+ return_error(code);
+ dev->is_open = true;
+ return 1;
}
}
/* Set device parameters, updating a graphics state or imager state. */
int
gs_imager_putdeviceparams(gs_imager_state *pis, gx_device *dev,
- gs_param_list *plist)
+ gs_param_list *plist)
{
int code = gs_putdeviceparams(dev, plist);
if (code >= 0)
- gx_set_cmap_procs(pis, dev);
+ gx_set_cmap_procs(pis, dev);
return code;
}
static void
@@ -399,7 +399,7 @@ gs_state_putdeviceparams(gs_state *pgs, gs_param_list *plist)
int code = gs_putdeviceparams(pgs->device, plist);
if (code >= 0)
- gs_state_update_device(pgs);
+ gs_state_update_device(pgs);
return code;
}
@@ -410,7 +410,7 @@ gs_setdevice(gs_state * pgs, gx_device * dev)
int code = gs_setdevice_no_erase(pgs, dev);
if (code == 1)
- code = gs_erasepage(pgs);
+ code = gs_erasepage(pgs);
return code;
}
int
@@ -420,25 +420,25 @@ gs_setdevice_no_erase(gs_state * pgs, gx_device * dev)
/* Initialize the device */
if (!dev->is_open) {
- gx_device_fill_in_procs(dev);
- if (gs_device_is_memory(dev)) {
- /* Set the target to the current device. */
- gx_device *odev = gs_currentdevice_inline(pgs);
-
- while (odev != 0 && gs_device_is_memory(odev))
- odev = ((gx_device_memory *)odev)->target;
- gx_device_set_target(((gx_device_forward *)dev), odev);
- }
- code = open_code = gs_opendevice(dev);
- if (code < 0)
- return code;
+ gx_device_fill_in_procs(dev);
+ if (gs_device_is_memory(dev)) {
+ /* Set the target to the current device. */
+ gx_device *odev = gs_currentdevice_inline(pgs);
+
+ while (odev != 0 && gs_device_is_memory(odev))
+ odev = ((gx_device_memory *)odev)->target;
+ gx_device_set_target(((gx_device_forward *)dev), odev);
+ }
+ code = open_code = gs_opendevice(dev);
+ if (code < 0)
+ return code;
}
gs_setdevice_no_init(pgs, dev);
pgs->ctm_default_set = false;
if ((code = gs_initmatrix(pgs)) < 0 ||
- (code = gs_initclip(pgs)) < 0
- )
- return code;
+ (code = gs_initclip(pgs)) < 0
+ )
+ return code;
/* If we were in a charpath or a setcachedevice, */
/* we aren't any longer. */
pgs->in_cachedevice = 0;
@@ -451,7 +451,7 @@ gs_setdevice_no_init(gs_state * pgs, gx_device * dev)
/*
* Just set the device, possibly changing color space but no other
* device parameters.
- *
+ *
* Make sure we don't close the device if dev == pgs->device
* This could be done by allowing the rc_assign to close the
* old 'dev' if the rc goes to 0 (via the device structure's
@@ -461,11 +461,11 @@ gs_setdevice_no_init(gs_state * pgs, gx_device * dev)
* device.
*/
if (pgs->device != NULL && pgs->device->rc.ref_count == 1 &&
- pgs->device != dev) {
- int code = gs_closedevice(pgs->device);
+ pgs->device != dev) {
+ int code = gs_closedevice(pgs->device);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
rc_assign(pgs->device, dev, "gs_setdevice_no_init");
gs_state_update_device(pgs);
@@ -475,7 +475,7 @@ gs_setdevice_no_init(gs_state * pgs, gx_device * dev)
/* Initialize a just-allocated device. */
void
gx_device_init(gx_device * dev, const gx_device * proto, gs_memory_t * mem,
- bool internal)
+ bool internal)
{
memcpy(dev, proto, proto->params_size);
dev->memory = mem;
@@ -486,24 +486,24 @@ gx_device_init(gx_device * dev, const gx_device * proto, gs_memory_t * mem,
/* Make a null device. */
void
gs_make_null_device(gx_device_null *dev_null, gx_device *dev,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
gx_device_init((gx_device *)dev_null, (const gx_device *)&gs_null_device,
- mem, true);
+ mem, true);
gx_device_set_target((gx_device_forward *)dev_null, dev);
if (dev) {
- /* The gx_device_copy_color_params() call below should
- probably copy over these new-style color mapping procs, as
- well as the old-style (map_rgb_color and friends). However,
- the change was made here instead, to minimize the potential
- impact of the patch.
- */
- gx_device *dn = (gx_device *)dev_null;
- set_dev_proc(dn, get_color_mapping_procs, gx_forward_get_color_mapping_procs);
- set_dev_proc(dn, get_color_comp_index, gx_forward_get_color_comp_index);
- set_dev_proc(dn, encode_color, gx_forward_encode_color);
- set_dev_proc(dn, decode_color, gx_forward_decode_color);
- gx_device_copy_color_params(dn, dev);
+ /* The gx_device_copy_color_params() call below should
+ probably copy over these new-style color mapping procs, as
+ well as the old-style (map_rgb_color and friends). However,
+ the change was made here instead, to minimize the potential
+ impact of the patch.
+ */
+ gx_device *dn = (gx_device *)dev_null;
+ set_dev_proc(dn, get_color_mapping_procs, gx_forward_get_color_mapping_procs);
+ set_dev_proc(dn, get_color_comp_index, gx_forward_get_color_comp_index);
+ set_dev_proc(dn, encode_color, gx_forward_encode_color);
+ set_dev_proc(dn, decode_color, gx_forward_decode_color);
+ gx_device_copy_color_params(dn, dev);
}
}
@@ -521,8 +521,8 @@ gx_device_retain(gx_device *dev, bool retained)
int delta = (int)retained - (int)dev->retained;
if (delta) {
- dev->retained = retained; /* do first in case dev is freed */
- rc_adjust_only(dev, delta, "gx_device_retain");
+ dev->retained = retained; /* do first in case dev is freed */
+ rc_adjust_only(dev, delta, "gx_device_retain");
}
}
@@ -531,22 +531,22 @@ int
gs_nulldevice(gs_state * pgs)
{
if (pgs->device == 0 || !gx_device_is_null(pgs->device)) {
- gx_device *ndev;
- int code = gs_copydevice(&ndev, (const gx_device *)&gs_null_device,
- pgs->memory);
-
- if (code < 0)
- return code;
- /*
- * Internal devices have a reference count of 0, not 1,
- * aside from references from graphics states.
- */
- rc_init(ndev, pgs->memory, 0);
+ gx_device *ndev;
+ int code = gs_copydevice(&ndev, (const gx_device *)&gs_null_device,
+ pgs->memory);
+
+ if (code < 0)
+ return code;
+ /*
+ * Internal devices have a reference count of 0, not 1,
+ * aside from references from graphics states.
+ */
+ rc_init(ndev, pgs->memory, 0);
if (pgs->device != NULL && pgs->device->device_icc_profile != NULL) {
ndev->device_icc_profile = pgs->device->device_icc_profile;
rc_increment(ndev->device_icc_profile);
}
- return gs_setdevice_no_erase(pgs, ndev);
+ return gs_setdevice_no_erase(pgs, ndev);
}
return 0;
}
@@ -559,10 +559,10 @@ gs_closedevice(gx_device * dev)
int code = 0;
if (dev->is_open) {
- code = (*dev_proc(dev, close_device))(dev);
- dev->is_open = false;
- if (code < 0)
- return_error(code);
+ code = (*dev_proc(dev, close_device))(dev);
+ dev->is_open = false;
+ if (code < 0)
+ return_error(code);
}
return code;
}
@@ -593,7 +593,7 @@ gx_device_raster(const gx_device * dev, bool pad)
/* if fit=0, one dimension fits, but the other one is clipped. */
int
gx_device_adjust_resolution(gx_device * dev,
- int actual_width, int actual_height, int fit)
+ int actual_width, int actual_height, int fit)
{
double width_ratio = (double)actual_width / dev->width;
double height_ratio = (double)actual_height / dev->height;
@@ -612,15 +612,15 @@ gx_device_adjust_resolution(gx_device * dev,
/* Note that this assumes a printer-type device (Y axis inverted). */
void
gx_device_set_margins(gx_device * dev, const float *margins /*[4] */ ,
- bool move_origin)
+ bool move_origin)
{
int i;
for (i = 0; i < 4; ++i)
- dev->HWMargins[i] = margins[i] * 72.0;
+ dev->HWMargins[i] = margins[i] * 72.0;
if (move_origin) {
- dev->Margins[0] = -margins[0] * dev->MarginsHWResolution[0];
- dev->Margins[1] = -margins[3] * dev->MarginsHWResolution[1];
+ dev->Margins[0] = -margins[0] * dev->MarginsHWResolution[0];
+ dev->Margins[1] = -margins[3] * dev->MarginsHWResolution[1];
}
}
@@ -643,11 +643,11 @@ gx_device_set_media_from_hwsize(gx_device *dev)
floatp y = dev->height * 72.0 / dev->HWResolution[1];
if (rot) {
- dev->MediaSize[1] = x;
- dev->MediaSize[0] = y;
+ dev->MediaSize[1] = x;
+ dev->MediaSize[0] = y;
} else {
- dev->MediaSize[0] = x;
- dev->MediaSize[1] = y;
+ dev->MediaSize[0] = x;
+ dev->MediaSize[1] = y;
}
}
@@ -686,11 +686,11 @@ void
gx_device_copy_color_procs(gx_device *dev, const gx_device *target)
{
dev_proc_map_cmyk_color((*from_cmyk)) =
- dev_proc(dev, map_cmyk_color);
+ dev_proc(dev, map_cmyk_color);
dev_proc_map_rgb_color((*from_rgb)) =
- dev_proc(dev, map_rgb_color);
+ dev_proc(dev, map_rgb_color);
dev_proc_map_color_rgb((*to_rgb)) =
- dev_proc(dev, map_color_rgb);
+ dev_proc(dev, map_color_rgb);
/* The logic in this function seems a bit stale; it sets the
old-style color procs, but not the new ones
@@ -698,29 +698,29 @@ gx_device_copy_color_procs(gx_device *dev, const gx_device *target)
and decode_color). It should probably copy those as well.
*/
if (from_cmyk == gx_forward_map_cmyk_color ||
- from_cmyk == cmyk_1bit_map_cmyk_color ||
- from_cmyk == cmyk_8bit_map_cmyk_color) {
- from_cmyk = dev_proc(target, map_cmyk_color);
- set_dev_proc(dev, map_cmyk_color,
- (from_cmyk == cmyk_1bit_map_cmyk_color ||
- from_cmyk == cmyk_8bit_map_cmyk_color ?
- from_cmyk : gx_forward_map_cmyk_color));
+ from_cmyk == cmyk_1bit_map_cmyk_color ||
+ from_cmyk == cmyk_8bit_map_cmyk_color) {
+ from_cmyk = dev_proc(target, map_cmyk_color);
+ set_dev_proc(dev, map_cmyk_color,
+ (from_cmyk == cmyk_1bit_map_cmyk_color ||
+ from_cmyk == cmyk_8bit_map_cmyk_color ?
+ from_cmyk : gx_forward_map_cmyk_color));
}
if (from_rgb == gx_forward_map_rgb_color ||
- from_rgb == gx_default_rgb_map_rgb_color) {
- from_rgb = dev_proc(target, map_rgb_color);
- set_dev_proc(dev, map_rgb_color,
- (from_rgb == gx_default_rgb_map_rgb_color ?
- from_rgb : gx_forward_map_rgb_color));
+ from_rgb == gx_default_rgb_map_rgb_color) {
+ from_rgb = dev_proc(target, map_rgb_color);
+ set_dev_proc(dev, map_rgb_color,
+ (from_rgb == gx_default_rgb_map_rgb_color ?
+ from_rgb : gx_forward_map_rgb_color));
}
if (to_rgb == gx_forward_map_color_rgb ||
- to_rgb == cmyk_1bit_map_color_rgb ||
- to_rgb == cmyk_8bit_map_color_rgb) {
- to_rgb = dev_proc(target, map_color_rgb);
- set_dev_proc(dev, map_color_rgb,
- (to_rgb == cmyk_1bit_map_color_rgb ||
- to_rgb == cmyk_8bit_map_color_rgb ?
- to_rgb : gx_forward_map_color_rgb));
+ to_rgb == cmyk_1bit_map_color_rgb ||
+ to_rgb == cmyk_8bit_map_color_rgb) {
+ to_rgb = dev_proc(target, map_color_rgb);
+ set_dev_proc(dev, map_color_rgb,
+ (to_rgb == cmyk_1bit_map_color_rgb ||
+ to_rgb == cmyk_8bit_map_color_rgb ?
+ to_rgb : gx_forward_map_color_rgb));
}
}
@@ -733,9 +733,9 @@ gx_device_copy_color_procs(gx_device *dev, const gx_device *target)
void
gx_device_copy_color_params(gx_device *dev, const gx_device *target)
{
- COPY_PARAM(color_info);
- COPY_PARAM(cached_colors);
- gx_device_copy_color_procs(dev, target);
+ COPY_PARAM(color_info);
+ COPY_PARAM(cached_colors);
+ gx_device_copy_color_procs(dev, target);
}
/*
@@ -747,21 +747,21 @@ void
gx_device_copy_params(gx_device *dev, const gx_device *target)
{
#define COPY_ARRAY_PARAM(p) memcpy(dev->p, target->p, sizeof(dev->p))
- COPY_PARAM(width);
- COPY_PARAM(height);
- COPY_ARRAY_PARAM(MediaSize);
- COPY_ARRAY_PARAM(ImagingBBox);
- COPY_PARAM(ImagingBBox_set);
- COPY_ARRAY_PARAM(HWResolution);
- COPY_ARRAY_PARAM(MarginsHWResolution);
- COPY_ARRAY_PARAM(Margins);
- COPY_ARRAY_PARAM(HWMargins);
- COPY_PARAM(PageCount);
- COPY_PARAM(MaxPatternBitmap);
+ COPY_PARAM(width);
+ COPY_PARAM(height);
+ COPY_ARRAY_PARAM(MediaSize);
+ COPY_ARRAY_PARAM(ImagingBBox);
+ COPY_PARAM(ImagingBBox_set);
+ COPY_ARRAY_PARAM(HWResolution);
+ COPY_ARRAY_PARAM(MarginsHWResolution);
+ COPY_ARRAY_PARAM(Margins);
+ COPY_ARRAY_PARAM(HWMargins);
+ COPY_PARAM(PageCount);
+ COPY_PARAM(MaxPatternBitmap);
COPY_PARAM(device_icc_profile);
rc_increment(dev->device_icc_profile);
#undef COPY_ARRAY_PARAM
- gx_device_copy_color_params(dev, target);
+ gx_device_copy_color_params(dev, target);
}
#undef COPY_PARAM
@@ -785,57 +785,57 @@ gx_parse_output_format(gs_parsed_file_name_t *pfn, const char **pfmt)
/* Scan the file name for a format string, and validate it if present. */
width[0] = width[1] = 0;
for (i = 0; i < pfn->len; ++i)
- if (pfn->fname[i] == '%') {
- if (i + 1 < pfn->len && pfn->fname[i + 1] == '%') {
- i++;
- continue;
- }
- if (have_format) /* more than one % */
- return_error(gs_error_undefinedfilename);
- have_format = true;
- field = -1; /* -1..3 for the 5 components of "%[flags][width][.precision][l]type" */
- for (;;)
- if (++i == pfn->len)
- return_error(gs_error_undefinedfilename);
- else {
- switch (field) {
- case -1: /* flags */
- if (strchr(" #+-", pfn->fname[i]))
- continue;
- else
- field++;
- /* falls through */
- default: /* width (field = 0) and precision (field = 1) */
- if (strchr("0123456789", pfn->fname[i])) {
- width[field] = width[field] * 10 + pfn->fname[i] - '0';
- continue;
- } else if (0 == field && '.' == pfn->fname[i]) {
- field++;
- continue;
- } else
- field = 2;
- /* falls through */
- case 2: /* "long" indicator */
- field++;
- if ('l' == pfn->fname[i]) {
- int_width = sizeof(long) * 3;
- continue;
- }
- /* falls through */
- case 3: /* type */
- if (strchr("diuoxX", pfn->fname[i])) {
- *pfmt = &pfn->fname[i];
- break;
- } else
- return_error(gs_error_undefinedfilename);
- }
- break;
- }
- }
+ if (pfn->fname[i] == '%') {
+ if (i + 1 < pfn->len && pfn->fname[i + 1] == '%') {
+ i++;
+ continue;
+ }
+ if (have_format) /* more than one % */
+ return_error(gs_error_undefinedfilename);
+ have_format = true;
+ field = -1; /* -1..3 for the 5 components of "%[flags][width][.precision][l]type" */
+ for (;;)
+ if (++i == pfn->len)
+ return_error(gs_error_undefinedfilename);
+ else {
+ switch (field) {
+ case -1: /* flags */
+ if (strchr(" #+-", pfn->fname[i]))
+ continue;
+ else
+ field++;
+ /* falls through */
+ default: /* width (field = 0) and precision (field = 1) */
+ if (strchr("0123456789", pfn->fname[i])) {
+ width[field] = width[field] * 10 + pfn->fname[i] - '0';
+ continue;
+ } else if (0 == field && '.' == pfn->fname[i]) {
+ field++;
+ continue;
+ } else
+ field = 2;
+ /* falls through */
+ case 2: /* "long" indicator */
+ field++;
+ if ('l' == pfn->fname[i]) {
+ int_width = sizeof(long) * 3;
+ continue;
+ }
+ /* falls through */
+ case 3: /* type */
+ if (strchr("diuoxX", pfn->fname[i])) {
+ *pfmt = &pfn->fname[i];
+ break;
+ } else
+ return_error(gs_error_undefinedfilename);
+ }
+ break;
+ }
+ }
if (have_format) {
- /* Calculate a conservative maximum width. */
- w = max(width[0], width[1]);
- w = max(w, int_width) + 5;
+ /* Calculate a conservative maximum width. */
+ w = max(width[0], width[1]);
+ w = max(w, int_width) + 5;
}
return w;
}
@@ -849,7 +849,7 @@ gx_parse_output_format(gs_parsed_file_name_t *pfn, const char **pfmt)
*/
int
gx_parse_output_file_name(gs_parsed_file_name_t *pfn, const char **pfmt,
- const char *fname, uint fnlen, gs_memory_t *memory)
+ const char *fname, uint fnlen, gs_memory_t *memory)
{
int code;
@@ -859,48 +859,48 @@ gx_parse_output_file_name(gs_parsed_file_name_t *pfn, const char **pfmt,
pfn->fname = NULL; /* irrelevant since length = 0 */
pfn->len = 0;
if (fnlen == 0) /* allow null name */
- return 0;
+ return 0;
/*
* If the file name begins with a %, it might be either an IODevice
* or a %nnd format. Check (carefully) for this case.
*/
code = gs_parse_file_name(pfn, fname, fnlen, memory);
if (code < 0) {
- if (fname[0] == '%') {
- /* not a recognized iodev -- may be a leading format descriptor */
- pfn->len = fnlen;
- pfn->fname = fname;
- code = gx_parse_output_format(pfn, pfmt);
- }
- if (code < 0)
- return code;
+ if (fname[0] == '%') {
+ /* not a recognized iodev -- may be a leading format descriptor */
+ pfn->len = fnlen;
+ pfn->fname = fname;
+ code = gx_parse_output_format(pfn, pfmt);
+ }
+ if (code < 0)
+ return code;
}
if (!pfn->iodev) {
- if ( (pfn->len == 1) && (pfn->fname[0] == '-') ) {
- pfn->iodev = gs_findiodevice(memory, (const byte *)"%stdout", 7);
- pfn->fname = NULL;
- } else if (pfn->fname[0] == '|') {
- pfn->iodev = gs_findiodevice(memory, (const byte *)"%pipe", 5);
- pfn->fname++, pfn->len--;
- } else
- pfn->iodev = iodev_default(memory);
- if (!pfn->iodev)
- return_error(gs_error_undefinedfilename);
+ if ( (pfn->len == 1) && (pfn->fname[0] == '-') ) {
+ pfn->iodev = gs_findiodevice(memory, (const byte *)"%stdout", 7);
+ pfn->fname = NULL;
+ } else if (pfn->fname[0] == '|') {
+ pfn->iodev = gs_findiodevice(memory, (const byte *)"%pipe", 5);
+ pfn->fname++, pfn->len--;
+ } else
+ pfn->iodev = iodev_default(memory);
+ if (!pfn->iodev)
+ return_error(gs_error_undefinedfilename);
}
if (!pfn->fname)
- return 0;
+ return 0;
code = gx_parse_output_format(pfn, pfmt);
if (code < 0)
return code;
if (strlen(pfn->iodev->dname) + pfn->len + code >= gp_file_name_sizeof)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
return 0;
}
/* Open the output file for a device. */
int
gx_device_open_output_file(const gx_device * dev, char *fname,
- bool binary, bool positionable, FILE ** pfile)
+ bool binary, bool positionable, FILE ** pfile)
{
gs_parsed_file_name_t parsed;
const char *fmt;
@@ -909,52 +909,52 @@ gx_device_open_output_file(const gx_device * dev, char *fname,
dev->memory);
if (code < 0)
- return code;
+ return code;
if (parsed.iodev && !strcmp(parsed.iodev->dname, "%stdout%")) {
- if (parsed.fname)
- return_error(gs_error_undefinedfilename);
- *pfile = dev->memory->gs_lib_ctx->fstdout;
- /* Force stdout to binary. */
- return gp_setmode_binary(*pfile, true);
+ if (parsed.fname)
+ return_error(gs_error_undefinedfilename);
+ *pfile = dev->memory->gs_lib_ctx->fstdout;
+ /* Force stdout to binary. */
+ return gp_setmode_binary(*pfile, true);
} else if (parsed.iodev && !strcmp(parsed.iodev->dname, "%pipe%")) {
- positionable = false;
+ positionable = false;
}
if (fmt) { /* filename includes "%nnd" */
- long count1 = dev->PageCount + 1;
-
- while (*fmt != 'l' && *fmt != '%')
- --fmt;
- if (*fmt == 'l')
- sprintf(pfname, parsed.fname, count1);
- else
- sprintf(pfname, parsed.fname, (int)count1);
+ long count1 = dev->PageCount + 1;
+
+ while (*fmt != 'l' && *fmt != '%')
+ --fmt;
+ if (*fmt == 'l')
+ sprintf(pfname, parsed.fname, count1);
+ else
+ sprintf(pfname, parsed.fname, (int)count1);
} else if (parsed.len && strchr(parsed.fname, '%')) /* filename with "%%" but no "%nnd" */
- sprintf(pfname, parsed.fname);
+ sprintf(pfname, parsed.fname);
else
- pfname[0] = 0; /* 0 to use "fname", not "pfname" */
+ pfname[0] = 0; /* 0 to use "fname", not "pfname" */
if (pfname[0]) {
- parsed.fname = pfname;
- parsed.len = strlen(parsed.fname);
+ parsed.fname = pfname;
+ parsed.len = strlen(parsed.fname);
}
if (positionable || (parsed.iodev && parsed.iodev != iodev_default(dev->memory))) {
- char fmode[4];
-
- if (!parsed.fname)
- return_error(gs_error_undefinedfilename);
- strcpy(fmode, gp_fmode_wb);
- if (positionable)
- strcat(fmode, "+");
- code = parsed.iodev->procs.fopen(parsed.iodev, parsed.fname, fmode,
- pfile, NULL, 0);
- if (code)
- emprintf1(dev->memory,
+ char fmode[4];
+
+ if (!parsed.fname)
+ return_error(gs_error_undefinedfilename);
+ strcpy(fmode, gp_fmode_wb);
+ if (positionable)
+ strcat(fmode, "+");
+ code = parsed.iodev->procs.fopen(parsed.iodev, parsed.fname, fmode,
+ pfile, NULL, 0);
+ if (code)
+ emprintf1(dev->memory,
"**** Could not open the file %s .\n",
parsed.fname);
- return code;
+ return code;
}
*pfile = gp_open_printer(dev->memory, (pfname[0] ? pfname : fname), binary);
if (*pfile)
- return 0;
+ return 0;
emprintf1(dev->memory,
"**** Could not open the file %s .\n",
(pfname[0] ? pfname : fname));
@@ -964,7 +964,7 @@ gx_device_open_output_file(const gx_device * dev, char *fname,
/* Close the output file for a device. */
int
gx_device_close_output_file(const gx_device * dev, const char *fname,
- FILE *file)
+ FILE *file)
{
gs_parsed_file_name_t parsed;
const char *fmt;
@@ -972,13 +972,13 @@ gx_device_close_output_file(const gx_device * dev, const char *fname,
dev->memory);
if (code < 0)
- return code;
+ return code;
if (parsed.iodev) {
- if (!strcmp(parsed.iodev->dname, "%stdout%"))
- return 0;
- /* NOTE: fname is unsubstituted if the name has any %nnd formats. */
- if (parsed.iodev != iodev_default(dev->memory))
- return parsed.iodev->procs.fclose(parsed.iodev, file);
+ if (!strcmp(parsed.iodev->dname, "%stdout%"))
+ return 0;
+ /* NOTE: fname is unsubstituted if the name has any %nnd formats. */
+ if (parsed.iodev != iodev_default(dev->memory))
+ return parsed.iodev->procs.fclose(parsed.iodev, file);
}
gp_close_printer(dev->memory, file, (parsed.fname ? parsed.fname : fname));
return 0;
diff --git a/gs/base/gsdevice.h b/gs/base/gsdevice.h
index 3fe21ba16..b10671226 100644
--- a/gs/base/gsdevice.h
+++ b/gs/base/gsdevice.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,24 +51,24 @@ int gs_copydevice(gx_device **, const gx_device *, gs_memory_t *);
* copydevice is equivalent to copydevice2 with keep_open = false.
*/
int gs_copydevice2(gx_device **pnew_dev, const gx_device *dev,
- bool keep_open, gs_memory_t *mem);
+ bool keep_open, gs_memory_t *mem);
#define gs_makeimagedevice(pdev, pmat, w, h, colors, colors_size, mem)\
gs_makewordimagedevice(pdev, pmat, w, h, colors, colors_size, false, true, mem)
int gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat,
- uint width, uint height,
- const byte * colors, int num_colors,
- bool word_oriented, bool page_device,
- gs_memory_t * mem);
+ uint width, uint height,
+ const byte * colors, int num_colors,
+ bool word_oriented, bool page_device,
+ gs_memory_t * mem);
#define gs_initialize_imagedevice(mdev, pmat, w, h, colors, colors_size, mem)\
gs_initialize_wordimagedevice(mdev, pmat, w, h, colors, color_size, false, true, mem)
int gs_initialize_wordimagedevice(gx_device_memory * new_dev,
- const gs_matrix * pmat,
- uint width, uint height,
- const byte * colors, int colors_size,
- bool word_oriented, bool page_device,
- gs_memory_t * mem);
+ const gs_matrix * pmat,
+ uint width, uint height,
+ const byte * colors, int colors_size,
+ bool word_oriented, bool page_device,
+ gs_memory_t * mem);
const char *gs_devicename(const gx_device *);
void gs_deviceinitialmatrix(gx_device *, gs_matrix *);
@@ -92,7 +92,7 @@ typedef struct gs_imager_state_s gs_imager_state;
#endif
int gs_imager_putdeviceparams(gs_imager_state *pis, gx_device *dev,
- gs_param_list *plist);
+ gs_param_list *plist);
/* Device procedures involving a graphics state. */
@@ -107,7 +107,7 @@ int gs_output_page(gs_state *, int, int);
int gs_nulldevice(gs_state *);
int gs_setdevice(gs_state *, gx_device *);
int gs_setdevice_no_erase(gs_state *, gx_device *); /* returns 1 */
- /* if erasepage required */
+ /* if erasepage required */
int gs_setdevice_no_init(gs_state *, gx_device *);
gx_device *gs_currentdevice(const gs_state *);
diff --git a/gs/base/gsdevmem.c b/gs/base/gsdevmem.c
index f2041e089..77afc63b5 100644
--- a/gs/base/gsdevmem.c
+++ b/gs/base/gsdevmem.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,8 +29,8 @@
/* We separate device allocation and initialization at customer request. */
int
gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat,
- uint width, uint height, const byte * colors, int colors_size,
- bool word_oriented, bool page_device, gs_memory_t * mem)
+ uint width, uint height, const byte * colors, int colors_size,
+ bool word_oriented, bool page_device, gs_memory_t * mem)
{
const gx_device_memory *proto_dev;
int palette_count = colors_size;
@@ -42,94 +42,94 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
bool has_color;
switch (colors_size) {
- case 3 * 2:
- palette_count = 2;
- num_components = 3;
- case 2:
- bits_per_pixel = 1;
- break;
- case 3 * 4:
- palette_count = 4;
- num_components = 3;
- case 4:
- bits_per_pixel = 2;
- break;
- case 3 * 16:
- palette_count = 16;
- num_components = 3;
- case 16:
- bits_per_pixel = 4;
- break;
- case 3 * 256:
- palette_count = 256;
- num_components = 3;
- case 256:
- bits_per_pixel = 8;
- break;
- case -16:
- bits_per_pixel = 16;
- palette_count = 0;
- break;
- case -24:
- bits_per_pixel = 24;
- palette_count = 0;
- break;
- case -32:
- bits_per_pixel = 32;
- palette_count = 0;
- break;
- default:
- return_error(gs_error_rangecheck);
+ case 3 * 2:
+ palette_count = 2;
+ num_components = 3;
+ case 2:
+ bits_per_pixel = 1;
+ break;
+ case 3 * 4:
+ palette_count = 4;
+ num_components = 3;
+ case 4:
+ bits_per_pixel = 2;
+ break;
+ case 3 * 16:
+ palette_count = 16;
+ num_components = 3;
+ case 16:
+ bits_per_pixel = 4;
+ break;
+ case 3 * 256:
+ palette_count = 256;
+ num_components = 3;
+ case 256:
+ bits_per_pixel = 8;
+ break;
+ case -16:
+ bits_per_pixel = 16;
+ palette_count = 0;
+ break;
+ case -24:
+ bits_per_pixel = 24;
+ palette_count = 0;
+ break;
+ case -32:
+ bits_per_pixel = 32;
+ palette_count = 0;
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
proto_dev = (word_oriented ?
- gdev_mem_word_device_for_bits(bits_per_pixel) :
- gdev_mem_device_for_bits(bits_per_pixel));
+ gdev_mem_word_device_for_bits(bits_per_pixel) :
+ gdev_mem_device_for_bits(bits_per_pixel));
if (proto_dev == 0) /* no suitable device */
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pcount = palette_count * 3;
/* Check to make sure the palette contains white and black, */
/* and, if it has any colors, the six primaries. */
if (bits_per_pixel <= 8) {
- const byte *p;
- byte *q;
- int primary_mask = 0;
- int i;
+ const byte *p;
+ byte *q;
+ int primary_mask = 0;
+ int i;
- has_color = false;
- for (i = 0, p = colors, q = palette;
- i < palette_count; i++, q += 3
- ) {
- int mask = 1;
+ has_color = false;
+ for (i = 0, p = colors, q = palette;
+ i < palette_count; i++, q += 3
+ ) {
+ int mask = 1;
- switch (num_components) {
- case 1: /* gray */
- q[0] = q[1] = q[2] = *p++;
- break;
- default /* case 3 */ : /* RGB */
- q[0] = p[0], q[1] = p[1], q[2] = p[2];
- p += 3;
- }
+ switch (num_components) {
+ case 1: /* gray */
+ q[0] = q[1] = q[2] = *p++;
+ break;
+ default /* case 3 */ : /* RGB */
+ q[0] = p[0], q[1] = p[1], q[2] = p[2];
+ p += 3;
+ }
#define shift_mask(b,n)\
switch ( b ) { case 0xff: mask <<= n; case 0: break; default: mask = 0; }
- shift_mask(q[0], 4);
- shift_mask(q[1], 2);
- shift_mask(q[2], 1);
+ shift_mask(q[0], 4);
+ shift_mask(q[1], 2);
+ shift_mask(q[2], 1);
#undef shift_mask
- primary_mask |= mask;
- if (q[0] != q[1] || q[0] != q[2])
- has_color = true;
- }
- switch (primary_mask) {
- case 129: /* just black and white */
- if (has_color) /* color but no primaries */
- return_error(gs_error_rangecheck);
- case 255: /* full color */
- break;
- default:
- return_error(gs_error_rangecheck);
- }
+ primary_mask |= mask;
+ if (q[0] != q[1] || q[0] != q[2])
+ has_color = true;
+ }
+ switch (primary_mask) {
+ case 129: /* just black and white */
+ if (has_color) /* color but no primaries */
+ return_error(gs_error_rangecheck);
+ case 255: /* full color */
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
} else
- has_color = true;
+ has_color = true;
/*
* The initial transformation matrix must map 1 user unit to
* 1/72". Let W and H be the width and height in pixels, and
@@ -145,37 +145,37 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
* matrices.
*/
if (is_fzero2(pmat->xy, pmat->yx))
- x_pixels_per_unit = pmat->xx, y_pixels_per_unit = pmat->yy;
+ x_pixels_per_unit = pmat->xx, y_pixels_per_unit = pmat->yy;
else if (is_fzero2(pmat->xx, pmat->yy))
- x_pixels_per_unit = pmat->yx, y_pixels_per_unit = pmat->xy;
+ x_pixels_per_unit = pmat->yx, y_pixels_per_unit = pmat->xy;
else
- return_error(gs_error_undefinedresult);
+ return_error(gs_error_undefinedresult);
/* All checks done, initialize the device. */
if (bits_per_pixel == 1) {
- /* Determine the polarity from the palette. */
- gs_make_mem_device(new_dev, proto_dev, mem,
- (page_device ? 1 : -1), 0);
- /* This is somewhat bogus, but does the right thing */
- /* in the only cases we care about. */
- gdev_mem_mono_set_inverted(new_dev,
- (palette[0] | palette[1] | palette[2]) != 0);
+ /* Determine the polarity from the palette. */
+ gs_make_mem_device(new_dev, proto_dev, mem,
+ (page_device ? 1 : -1), 0);
+ /* This is somewhat bogus, but does the right thing */
+ /* in the only cases we care about. */
+ gdev_mem_mono_set_inverted(new_dev,
+ (palette[0] | palette[1] | palette[2]) != 0);
} else {
- byte *dev_palette = gs_alloc_string(mem, pcount,
- "gs_makeimagedevice(palette)");
+ byte *dev_palette = gs_alloc_string(mem, pcount,
+ "gs_makeimagedevice(palette)");
- if (dev_palette == 0)
- return_error(gs_error_VMerror);
- gs_make_mem_device(new_dev, proto_dev, mem,
- (page_device ? 1 : -1), 0);
- new_dev->palette.size = pcount;
- new_dev->palette.data = dev_palette;
- memcpy(dev_palette, palette, pcount);
- if (!has_color) {
- new_dev->color_info.num_components = 1;
- new_dev->color_info.max_color = 0;
- new_dev->color_info.dither_colors = 0;
- new_dev->color_info.gray_index = 0;
- }
+ if (dev_palette == 0)
+ return_error(gs_error_VMerror);
+ gs_make_mem_device(new_dev, proto_dev, mem,
+ (page_device ? 1 : -1), 0);
+ new_dev->palette.size = pcount;
+ new_dev->palette.data = dev_palette;
+ memcpy(dev_palette, palette, pcount);
+ if (!has_color) {
+ new_dev->color_info.num_components = 1;
+ new_dev->color_info.max_color = 0;
+ new_dev->color_info.dither_colors = 0;
+ new_dev->color_info.gray_index = 0;
+ }
}
/* Memory defice is always initialised as an internal device but */
/* this is an external device */
@@ -184,24 +184,24 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
new_dev->initial_matrix = *pmat;
new_dev->MarginsHWResolution[0] = new_dev->HWResolution[0] =
- fabs(x_pixels_per_unit) * 72;
+ fabs(x_pixels_per_unit) * 72;
new_dev->MarginsHWResolution[1] = new_dev->HWResolution[1] =
- fabs(y_pixels_per_unit) * 72;
+ fabs(y_pixels_per_unit) * 72;
gx_device_set_width_height((gx_device *) new_dev, width, height);
/* Set the ImagingBBox so we get a correct clipping region. */
{
- gs_rect bbox;
+ gs_rect bbox;
- bbox.p.x = 0;
- bbox.p.y = 0;
- bbox.q.x = width;
- bbox.q.y = height;
- gs_bbox_transform_inverse(&bbox, pmat, &bbox);
- new_dev->ImagingBBox[0] = bbox.p.x;
- new_dev->ImagingBBox[1] = bbox.p.y;
- new_dev->ImagingBBox[2] = bbox.q.x;
- new_dev->ImagingBBox[3] = bbox.q.y;
- new_dev->ImagingBBox_set = true;
+ bbox.p.x = 0;
+ bbox.p.y = 0;
+ bbox.q.x = width;
+ bbox.q.y = height;
+ gs_bbox_transform_inverse(&bbox, pmat, &bbox);
+ new_dev->ImagingBBox[0] = bbox.p.x;
+ new_dev->ImagingBBox[1] = bbox.p.y;
+ new_dev->ImagingBBox[2] = bbox.q.x;
+ new_dev->ImagingBBox[3] = bbox.q.y;
+ new_dev->ImagingBBox_set = true;
}
/* The bitmap will be allocated when the device is opened. */
new_dev->is_open = false;
@@ -211,22 +211,22 @@ gs_initialize_wordimagedevice(gx_device_memory * new_dev, const gs_matrix * pmat
int
gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat,
- uint width, uint height, const byte * colors, int num_colors,
- bool word_oriented, bool page_device, gs_memory_t * mem)
+ uint width, uint height, const byte * colors, int num_colors,
+ bool word_oriented, bool page_device, gs_memory_t * mem)
{
int code;
gx_device_memory *pnew =
gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "gs_makeimagedevice(device)");
+ "gs_makeimagedevice(device)");
if (pnew == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = gs_initialize_wordimagedevice(pnew, pmat, width, height,
- colors, num_colors, word_oriented,
- page_device, mem);
+ colors, num_colors, word_oriented,
+ page_device, mem);
if (code < 0) {
- gs_free_object(mem, pnew, "gs_makeimagedevice(device)");
- return code;
+ gs_free_object(mem, pnew, "gs_makeimagedevice(device)");
+ return code;
}
*pnew_dev = (gx_device *) pnew;
return 0;
diff --git a/gs/base/gsdfilt.c b/gs/base/gsdfilt.c
index ff5e7d3d5..83a3007e0 100644
--- a/gs/base/gsdfilt.c
+++ b/gs/base/gsdfilt.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,13 +35,13 @@
#include "gsdfilt.h"
gs_private_st_ptrs3(st_gs_device_filter_stack, gs_device_filter_stack_t,
- "gs_device_filter_stack",
- gs_device_filter_stack_enum_ptrs,
- gs_device_filter_stack_reloc_ptrs,
- next, df, next_device);
+ "gs_device_filter_stack",
+ gs_device_filter_stack_enum_ptrs,
+ gs_device_filter_stack_reloc_ptrs,
+ next, df, next_device);
gs_public_st_simple(st_gs_device_filter, gs_device_filter_t,
- "gs_device_filter");
+ "gs_device_filter");
int
gs_push_device_filter(gs_memory_t *mem, gs_state *pgs, gs_device_filter_t *df)
@@ -51,15 +51,15 @@ gs_push_device_filter(gs_memory_t *mem, gs_state *pgs, gs_device_filter_t *df)
int code;
dfs = gs_alloc_struct(mem, gs_device_filter_stack_t,
- &st_gs_device_filter_stack, "gs_push_device_filter");
+ &st_gs_device_filter_stack, "gs_push_device_filter");
if (dfs == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
rc_increment(pgs->device);
dfs->next_device = pgs->device;
code = df->push(df, mem, pgs, &new_dev, pgs->device);
if (code < 0) {
- gs_free_object(mem, dfs, "gs_push_device_filter");
- return code;
+ gs_free_object(mem, dfs, "gs_push_device_filter");
+ return code;
}
dfs->next = pgs->dfilter_stack;
pgs->dfilter_stack = dfs;
@@ -79,7 +79,7 @@ gs_pop_device_filter(gs_memory_t *mem, gs_state *pgs)
int code;
if (dfs_tos == NULL)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
df = dfs_tos->df;
pgs->dfilter_stack = dfs_tos->next;
code = df->prepop(df, mem, pgs, tos_device);
@@ -99,8 +99,8 @@ gs_clear_device_filters(gs_memory_t *mem, gs_state *pgs)
int code;
while (pgs->dfilter_stack != NULL) {
- if ((code = gs_pop_device_filter(mem, pgs)) < 0)
- return code;
+ if ((code = gs_pop_device_filter(mem, pgs)) < 0)
+ return code;
}
return 0;
}
diff --git a/gs/base/gsdfilt.h b/gs/base/gsdfilt.h
index d23d6087e..f80a3de7e 100644
--- a/gs/base/gsdfilt.h
+++ b/gs/base/gsdfilt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,11 +37,11 @@ typedef struct gs_device_filter_s gs_device_filter_t;
struct gs_device_filter_s {
int (*push)(gs_device_filter_t *self, gs_memory_t *mem, gs_state *pgs,
- gx_device **pdev, gx_device *target);
+ gx_device **pdev, gx_device *target);
int (*prepop)(gs_device_filter_t *self, gs_memory_t *mem, gs_state *pgs,
- gx_device *dev);
+ gx_device *dev);
int (*postpop)(gs_device_filter_t *self, gs_memory_t *mem, gs_state *pgs,
- gx_device *dev);
+ gx_device *dev);
};
extern_st(st_gs_device_filter);
@@ -81,5 +81,4 @@ int gs_pop_device_filter(gs_memory_t *mem, gs_state *pgs);
**/
int gs_clear_device_filters(gs_memory_t *mem, gs_state *pgs);
-
#endif /* gsdfilt_INCLUDED */
diff --git a/gs/base/gsdll.h b/gs/base/gsdll.h
index 727ac48db..090425732 100644
--- a/gs/base/gsdll.h
+++ b/gs/base/gsdll.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,7 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
/* $Id$ */
/* This interface is deprecated and will be removed in future
@@ -46,29 +45,28 @@ extern GSDLL_CALLBACK pgsdll_callback;
/* message values for callback */
#define GSDLL_STDIN 1 /* get count characters to str from stdin */
- /* return number of characters read */
+ /* return number of characters read */
#define GSDLL_STDOUT 2 /* put count characters from str to stdout */
- /* return number of characters written */
+ /* return number of characters written */
#define GSDLL_DEVICE 3 /* device = str has been opened if count=1 */
- /* or closed if count=0 */
+ /* or closed if count=0 */
#define GSDLL_SYNC 4 /* sync_output for device str */
#define GSDLL_PAGE 5 /* output_page for device str */
#define GSDLL_SIZE 6 /* resize for device str */
- /* LOWORD(count) is new xsize */
- /* HIWORD(count) is new ysize */
+ /* LOWORD(count) is new xsize */
+ /* HIWORD(count) is new ysize */
#define GSDLL_POLL 7 /* Called from gp_check_interrupt */
- /* Can be used by caller to poll the message queue */
- /* Normally returns 0 */
- /* To abort gsdll_execute_cont(), return a */
- /* non zero error code until gsdll_execute_cont() */
- /* returns */
+ /* Can be used by caller to poll the message queue */
+ /* Normally returns 0 */
+ /* To abort gsdll_execute_cont(), return a */
+ /* non zero error code until gsdll_execute_cont() */
+ /* returns */
/* return values from gsdll_init() */
#define GSDLL_INIT_IN_USE 100 /* DLL is in use */
#define GSDLL_INIT_QUIT 101 /* quit or EOF during init */
- /* This is not an error. */
- /* gsdll_exit() must not be called */
-
+ /* This is not an error. */
+ /* gsdll_exit() must not be called */
/* DLL exported functions */
/* for load time dynamic linking */
@@ -82,7 +80,7 @@ GSDLLEXPORT int GSDLLAPI gsdll_lock_device(unsigned char *device, int flag);
/* Function pointer typedefs */
/* for run time dynamic linking */
-typedef int (GSDLLAPIPTR PFN_gsdll_revision)(const char ** product,
+typedef int (GSDLLAPIPTR PFN_gsdll_revision)(const char ** product,
const char ** copyright, long * revision, long * revisiondate);
typedef int (GSDLLAPIPTR PFN_gsdll_init) (GSDLL_CALLBACK, HWND, int argc, char * * argv);
typedef int (GSDLLAPIPTR PFN_gsdll_execute_begin) (void);
diff --git a/gs/base/gsdllwin.h b/gs/base/gsdllwin.h
index a16282e00..d14c96e42 100644
--- a/gs/base/gsdllwin.h
+++ b/gs/base/gsdllwin.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,18 +22,18 @@
GSDLLEXPORT HGLOBAL GSDLLAPI gsdll_copy_dib(unsigned char * device);
GSDLLEXPORT HPALETTE GSDLLAPI gsdll_copy_palette(unsigned char * device);
GSDLLEXPORT void GSDLLAPI gsdll_draw(unsigned char * device, HDC hdc, LPRECT dest,
- LPRECT src);
+ LPRECT src);
GSDLLEXPORT int GSDLLAPI gsdll_get_bitmap_row(unsigned char *device,
- LPBITMAPINFOHEADER pbmih,
- LPRGBQUAD prgbquad, LPBYTE * ppbyte,
- unsigned int row);
+ LPBITMAPINFOHEADER pbmih,
+ LPRGBQUAD prgbquad, LPBYTE * ppbyte,
+ unsigned int row);
/* Function pointer typedefs */
/* for run time dynamic linking */
typedef HGLOBAL (GSDLLAPI * PFN_gsdll_copy_dib)(unsigned char *);
typedef HPALETTE (GSDLLAPI * PFN_gsdll_copy_palette)(unsigned char *);
typedef void (GSDLLAPI * PFN_gsdll_draw) (unsigned char *, HDC, LPRECT,
- LPRECT);
+ LPRECT);
typedef int (GSDLLAPI * PFN_gsdll_get_bitmap_row)
(unsigned char *device, LPBITMAPINFOHEADER pbmih, LPRGBQUAD prgbquad,
LPBYTE * ppbyte, unsigned int row);
diff --git a/gs/base/gsdparam.c b/gs/base/gsdparam.c
index 4155012b7..30089b8a6 100644
--- a/gs/base/gsdparam.c
+++ b/gs/base/gsdparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@ static bool param_HWColorMap(gx_device *, byte *);
/* Get the device parameters. */
int
gs_get_device_or_hw_params(gx_device * orig_dev, gs_param_list * plist,
- bool is_hardware)
+ bool is_hardware)
{
/*
* We must be prepared to copy the device if it is the read-only
@@ -44,21 +44,21 @@ gs_get_device_or_hw_params(gx_device * orig_dev, gs_param_list * plist,
int code;
if (orig_dev->memory)
- dev = orig_dev;
+ dev = orig_dev;
else {
- code = gs_copydevice(&dev, orig_dev, plist->memory);
- if (code < 0)
- return code;
+ code = gs_copydevice(&dev, orig_dev, plist->memory);
+ if (code < 0)
+ return code;
}
gx_device_set_procs(dev);
fill_dev_proc(dev, get_params, gx_default_get_params);
fill_dev_proc(dev, get_page_device, gx_default_get_page_device);
fill_dev_proc(dev, get_alpha_bits, gx_default_get_alpha_bits);
code = (is_hardware ?
- (*dev_proc(dev, get_hardware_params)) (dev, plist) :
- (*dev_proc(dev, get_params)) (dev, plist));
+ (*dev_proc(dev, get_hardware_params)) (dev, plist) :
+ (*dev_proc(dev, get_params)) (dev, plist));
if (dev != orig_dev)
- gx_device_retain(dev, false); /* frees the copy */
+ gx_device_retain(dev, false); /* frees the copy */
return code;
}
@@ -92,14 +92,14 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist)
param_string_from_string(dns, dev->dname);
{
- const char *cms = get_process_color_model_name(dev);
+ const char *cms = get_process_color_model_name(dev);
- /* We might have an uninitialized device with */
- /* color_info.num_components = 0.... */
- if ((cms != NULL) && (*cms != '\0'))
- param_string_from_string(pcms, cms);
- else
- pcms.data = 0;
+ /* We might have an uninitialized device with */
+ /* color_info.num_components = 0.... */
+ if ((cms != NULL) && (*cms != '\0'))
+ param_string_from_string(pcms, cms);
+ else
+ pcms.data = 0;
}
param_string_from_string(icc, dev->color_info.icc_profile);
@@ -122,84 +122,84 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist)
if (
- /* Standard parameters */
+ /* Standard parameters */
- (code = param_write_name(plist, "OutputDevice", &dns)) < 0 ||
+ (code = param_write_name(plist, "OutputDevice", &dns)) < 0 ||
(code = param_write_name(plist,"OutputICCProfile", &icc)) < 0 ||
#ifdef PAGESIZE_IS_MEDIASIZE
- (code = param_write_float_array(plist, "PageSize", &msa)) < 0 ||
+ (code = param_write_float_array(plist, "PageSize", &msa)) < 0 ||
#endif
- (code = (pcms.data == 0 ? 0 :
- param_write_name(plist, "ProcessColorModel", &pcms))) < 0 ||
- (code = param_write_float_array(plist, "HWResolution", &hwra)) < 0 ||
- (code = (dev->ImagingBBox_set ?
- param_write_float_array(plist, "ImagingBBox", &ibba) :
- param_write_null(plist, "ImagingBBox"))) < 0 ||
- (code = param_write_float_array(plist, "Margins", &ma)) < 0 ||
- (code = param_write_int(plist, "MaxSeparations", &mns)) < 0 ||
- (code = (dev->NumCopies_set < 0 ||
- (*dev_proc(dev, get_page_device))(dev) == 0 ? 0:
- dev->NumCopies_set ?
- param_write_int(plist, "NumCopies", &dev->NumCopies) :
- param_write_null(plist, "NumCopies"))) < 0 ||
- (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
- (code = param_write_bool(plist, "Separations", &seprs)) < 0 ||
- (code = param_write_bool(plist, "UseCIEColor", &dev->UseCIEColor)) < 0 ||
-
- /* Non-standard parameters */
-
- (code = param_write_int_array(plist, "HWSize", &hwsa)) < 0 ||
- (code = param_write_float_array(plist, ".HWMargins", &hwma)) < 0 ||
- (code = param_write_float_array(plist, ".MarginsHWResolution", &mhwra)) < 0 ||
- (code = param_write_float_array(plist, ".MediaSize", &msa)) < 0 ||
- (code = param_write_string(plist, "Name", &dns)) < 0 ||
- (code = param_write_int(plist, "Colors", &colors)) < 0 ||
- (code = param_write_int(plist, "BitsPerPixel", &depth)) < 0 ||
- (code = param_write_int(plist, "GrayValues", &GrayValues)) < 0 ||
- (code = param_write_long(plist, "PageCount", &dev->PageCount)) < 0 ||
- (code = param_write_bool(plist, ".IgnoreNumCopies", &dev->IgnoreNumCopies)) < 0 ||
- (code = param_write_int(plist, "TextAlphaBits",
- &dev->color_info.anti_alias.text_bits)) < 0 ||
- (code = param_write_int(plist, "GraphicsAlphaBits",
- &dev->color_info.anti_alias.graphics_bits)) < 0 ||
- (code = param_write_bool(plist, ".LockSafetyParams", &dev->LockSafetyParams)) < 0 ||
- (code = param_write_int(plist, "MaxPatternBitmap", &dev->MaxPatternBitmap)) < 0
-
- )
- return code;
+ (code = (pcms.data == 0 ? 0 :
+ param_write_name(plist, "ProcessColorModel", &pcms))) < 0 ||
+ (code = param_write_float_array(plist, "HWResolution", &hwra)) < 0 ||
+ (code = (dev->ImagingBBox_set ?
+ param_write_float_array(plist, "ImagingBBox", &ibba) :
+ param_write_null(plist, "ImagingBBox"))) < 0 ||
+ (code = param_write_float_array(plist, "Margins", &ma)) < 0 ||
+ (code = param_write_int(plist, "MaxSeparations", &mns)) < 0 ||
+ (code = (dev->NumCopies_set < 0 ||
+ (*dev_proc(dev, get_page_device))(dev) == 0 ? 0:
+ dev->NumCopies_set ?
+ param_write_int(plist, "NumCopies", &dev->NumCopies) :
+ param_write_null(plist, "NumCopies"))) < 0 ||
+ (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
+ (code = param_write_bool(plist, "Separations", &seprs)) < 0 ||
+ (code = param_write_bool(plist, "UseCIEColor", &dev->UseCIEColor)) < 0 ||
+
+ /* Non-standard parameters */
+
+ (code = param_write_int_array(plist, "HWSize", &hwsa)) < 0 ||
+ (code = param_write_float_array(plist, ".HWMargins", &hwma)) < 0 ||
+ (code = param_write_float_array(plist, ".MarginsHWResolution", &mhwra)) < 0 ||
+ (code = param_write_float_array(plist, ".MediaSize", &msa)) < 0 ||
+ (code = param_write_string(plist, "Name", &dns)) < 0 ||
+ (code = param_write_int(plist, "Colors", &colors)) < 0 ||
+ (code = param_write_int(plist, "BitsPerPixel", &depth)) < 0 ||
+ (code = param_write_int(plist, "GrayValues", &GrayValues)) < 0 ||
+ (code = param_write_long(plist, "PageCount", &dev->PageCount)) < 0 ||
+ (code = param_write_bool(plist, ".IgnoreNumCopies", &dev->IgnoreNumCopies)) < 0 ||
+ (code = param_write_int(plist, "TextAlphaBits",
+ &dev->color_info.anti_alias.text_bits)) < 0 ||
+ (code = param_write_int(plist, "GraphicsAlphaBits",
+ &dev->color_info.anti_alias.graphics_bits)) < 0 ||
+ (code = param_write_bool(plist, ".LockSafetyParams", &dev->LockSafetyParams)) < 0 ||
+ (code = param_write_int(plist, "MaxPatternBitmap", &dev->MaxPatternBitmap)) < 0
+
+ )
+ return code;
/* If LeadingEdge was set explicitly, report it here. */
if (dev->LeadingEdge & LEADINGEDGE_SET_MASK) {
- int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
- code = param_write_int(plist, "LeadingEdge", &leadingedge);
+ int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
+ code = param_write_int(plist, "LeadingEdge", &leadingedge);
}
if (code < 0)
- return code;
+ return code;
/* Fill in color information. */
if (colors > 1) {
- int RGBValues = dev->color_info.max_color + 1;
- long ColorValues = (depth >= 32 ? -1 : 1L << depth); /* value can only be 32 bits */
+ int RGBValues = dev->color_info.max_color + 1;
+ long ColorValues = (depth >= 32 ? -1 : 1L << depth); /* value can only be 32 bits */
- if ((code = param_write_int(plist, "RedValues", &RGBValues)) < 0 ||
- (code = param_write_int(plist, "GreenValues", &RGBValues)) < 0 ||
- (code = param_write_int(plist, "BlueValues", &RGBValues)) < 0 ||
- (code = param_write_long(plist, "ColorValues", &ColorValues)) < 0
- )
- return code;
+ if ((code = param_write_int(plist, "RedValues", &RGBValues)) < 0 ||
+ (code = param_write_int(plist, "GreenValues", &RGBValues)) < 0 ||
+ (code = param_write_int(plist, "BlueValues", &RGBValues)) < 0 ||
+ (code = param_write_long(plist, "ColorValues", &ColorValues)) < 0
+ )
+ return code;
}
if (param_requested(plist, "HWColorMap")) {
- byte palette[3 << 8];
+ byte palette[3 << 8];
- if (param_HWColorMap(dev, palette)) {
- gs_param_string hwcms;
+ if (param_HWColorMap(dev, palette)) {
+ gs_param_string hwcms;
- hwcms.data = palette, hwcms.size = colors << depth,
- hwcms.persistent = false;
- if ((code = param_write_string(plist, "HWColorMap", &hwcms)) < 0)
- return code;
- }
+ hwcms.data = palette, hwcms.size = colors << depth,
+ hwcms.persistent = false;
+ if ((code = param_write_string(plist, "HWColorMap", &hwcms)) < 0)
+ return code;
+ }
}
return 0;
@@ -213,20 +213,20 @@ param_HWColorMap(gx_device * dev, byte * palette /* 3 << 8 */ )
int colors = dev->color_info.num_components;
if (depth <= 8 && colors <= 3) {
- byte *p = palette;
- gx_color_value rgb[3];
- gx_color_index i;
+ byte *p = palette;
+ gx_color_value rgb[3];
+ gx_color_index i;
- fill_dev_proc(dev, map_color_rgb, gx_default_map_color_rgb);
- for (i = 0; (i >> depth) == 0; i++) {
- int j;
+ fill_dev_proc(dev, map_color_rgb, gx_default_map_color_rgb);
+ for (i = 0; (i >> depth) == 0; i++) {
+ int j;
- if ((*dev_proc(dev, map_color_rgb)) (dev, i, rgb) < 0)
- return false;
- for (j = 0; j < colors; j++)
- *p++ = gx_color_value_to_byte(rgb[j]);
- }
- return true;
+ if ((*dev_proc(dev, map_color_rgb)) (dev, i, rgb) < 0)
+ return false;
+ for (j = 0; j < colors; j++)
+ *p++ = gx_color_value_to_byte(rgb[j]);
+ }
+ return true;
}
return false;
}
@@ -247,10 +247,10 @@ finish_media(gs_param_list * mlist, gs_param_name key, const char *media_type)
int code = 0;
if (media_type != 0) {
- gs_param_string as;
+ gs_param_string as;
- param_string_from_string(as, media_type);
- code = param_write_string(mlist, key, &as);
+ param_string_from_string(as, media_type);
+ code = param_write_string(mlist, key, &as);
}
return code;
}
@@ -262,9 +262,9 @@ const gdev_input_media_t gdev_input_media_default =
gdev_input_media_default_values
};
-int
+int
gdev_begin_input_media(gs_param_list * mlist, gs_param_dict * pdict,
- int count)
+ int count)
{
pdict->size = count;
return param_begin_write_dict(mlist, "InputAttributes", pdict, true);
@@ -272,7 +272,7 @@ gdev_begin_input_media(gs_param_list * mlist, gs_param_dict * pdict,
int
gdev_write_input_media(int index, gs_param_dict * pdict,
- const gdev_input_media_t * pim)
+ const gdev_input_media_t * pim)
{
char key[25];
gs_param_dict mdict;
@@ -283,50 +283,50 @@ gdev_write_input_media(int index, gs_param_dict * pdict,
mdict.size = 4;
code = param_begin_write_dict(pdict->list, key, &mdict, false);
if (code < 0)
- return code;
+ return code;
if ((pim->PageSize[0] != 0 && pim->PageSize[1] != 0) ||
- (pim->PageSize[2] != 0 && pim->PageSize[3] != 0)
- ) {
- gs_param_float_array psa;
-
- psa.data = pim->PageSize;
- psa.size =
- (pim->PageSize[0] == pim->PageSize[2] &&
- pim->PageSize[1] == pim->PageSize[3] ? 2 : 4);
- psa.persistent = false;
- code = param_write_float_array(mdict.list, "PageSize",
- &psa);
- if (code < 0)
- return code;
+ (pim->PageSize[2] != 0 && pim->PageSize[3] != 0)
+ ) {
+ gs_param_float_array psa;
+
+ psa.data = pim->PageSize;
+ psa.size =
+ (pim->PageSize[0] == pim->PageSize[2] &&
+ pim->PageSize[1] == pim->PageSize[3] ? 2 : 4);
+ psa.persistent = false;
+ code = param_write_float_array(mdict.list, "PageSize",
+ &psa);
+ if (code < 0)
+ return code;
}
if (pim->MediaColor != 0) {
- param_string_from_string(as, pim->MediaColor);
- code = param_write_string(mdict.list, "MediaColor",
- &as);
- if (code < 0)
- return code;
+ param_string_from_string(as, pim->MediaColor);
+ code = param_write_string(mdict.list, "MediaColor",
+ &as);
+ if (code < 0)
+ return code;
}
if (pim->MediaWeight != 0) {
- /*
- * We do the following silly thing in order to avoid
- * having to work around the 'const' in the arg list.
- */
- float weight = pim->MediaWeight;
+ /*
+ * We do the following silly thing in order to avoid
+ * having to work around the 'const' in the arg list.
+ */
+ float weight = pim->MediaWeight;
- code = param_write_float(mdict.list, "MediaWeight",
- &weight);
- if (code < 0)
- return code;
+ code = param_write_float(mdict.list, "MediaWeight",
+ &weight);
+ if (code < 0)
+ return code;
}
code = finish_media(mdict.list, "MediaType", pim->MediaType);
if (code < 0)
- return code;
+ return code;
return param_end_write_dict(pdict->list, key, &mdict);
}
int
gdev_write_input_page_size(int index, gs_param_dict * pdict,
- floatp width_points, floatp height_points)
+ floatp width_points, floatp height_points)
{
gdev_input_media_t media;
@@ -338,7 +338,7 @@ gdev_write_input_page_size(int index, gs_param_dict * pdict,
return gdev_write_input_media(index, pdict, &media);
}
-int
+int
gdev_end_input_media(gs_param_list * mlist, gs_param_dict * pdict)
{
return param_end_write_dict(mlist, "InputAttributes", pdict);
@@ -351,9 +351,9 @@ const gdev_output_media_t gdev_output_media_default =
gdev_output_media_default_values
};
-int
+int
gdev_begin_output_media(gs_param_list * mlist, gs_param_dict * pdict,
- int count)
+ int count)
{
pdict->size = count;
return param_begin_write_dict(mlist, "OutputAttributes", pdict, true);
@@ -361,7 +361,7 @@ gdev_begin_output_media(gs_param_list * mlist, gs_param_dict * pdict,
int
gdev_write_output_media(int index, gs_param_dict * pdict,
- const gdev_output_media_t * pom)
+ const gdev_output_media_t * pom)
{
char key[25];
gs_param_dict mdict;
@@ -371,14 +371,14 @@ gdev_write_output_media(int index, gs_param_dict * pdict,
mdict.size = 4;
code = param_begin_write_dict(pdict->list, key, &mdict, false);
if (code < 0)
- return code;
+ return code;
code = finish_media(mdict.list, "OutputType", pom->OutputType);
if (code < 0)
- return code;
+ return code;
return param_end_write_dict(pdict->list, key, &mdict);
}
-int
+int
gdev_end_output_media(gs_param_list * mlist, gs_param_dict * pdict)
{
return param_end_write_dict(mlist, "OutputAttributes", pdict);
@@ -390,14 +390,14 @@ gdev_end_output_media(gs_param_list * mlist, gs_param_dict * pdict)
static int param_normalize_anti_alias_bits( uint max_gray, int bits );
static int param_anti_alias_bits(gs_param_list *, gs_param_name, int *);
static int param_MediaSize(gs_param_list *, gs_param_name,
- const float *, gs_param_float_array *);
+ const float *, gs_param_float_array *);
static int param_check_bool(gs_param_list *, gs_param_name, bool, bool);
static int param_check_long(gs_param_list *, gs_param_name, long, bool);
#define param_check_int(plist, pname, ival, is_defined)\
param_check_long(plist, pname, (long)(ival), is_defined)
static int param_check_bytes(gs_param_list *, gs_param_name, const byte *,
- uint, bool);
+ uint, bool);
#define param_check_string(plist, pname, str, is_defined)\
param_check_bytes(plist, pname, (const byte *)(str), \
(is_defined) ? strlen(str) : 0, is_defined)
@@ -469,17 +469,17 @@ gx_default_put_params(gx_device * dev, gs_param_list * plist)
BEGIN\
switch (code = pread(plist, (param_name = pname), &(pa))) {\
case 0:\
- if ((pa).size != psize) {\
- ecode = gs_note_error(gs_error_rangecheck);\
- (pa).data = 0; /* mark as not filled */\
- } else
+ if ((pa).size != psize) {\
+ ecode = gs_note_error(gs_error_rangecheck);\
+ (pa).data = 0; /* mark as not filled */\
+ } else
#define END_ARRAY_PARAM(pa, e)\
- goto e;\
+ goto e;\
default:\
- ecode = code;\
+ ecode = code;\
e: param_signal_error(plist, param_name, ecode);\
case 1:\
- (pa).data = 0; /* mark as not filled */\
+ (pa).data = 0; /* mark as not filled */\
}\
END
@@ -490,8 +490,8 @@ e: param_signal_error(plist, param_name, ecode);\
* now executed.
*/
if (leadingedge & LEADINGEDGE_REQ_BIT) {
- leadingedge = (leadingedge & LEADINGEDGE_SET_MASK) |
- ((leadingedge >> LEADINGEDGE_REQ_VAL_SHIFT) & LEADINGEDGE_MASK);
+ leadingedge = (leadingedge & LEADINGEDGE_SET_MASK) |
+ ((leadingedge >> LEADINGEDGE_REQ_VAL_SHIFT) & LEADINGEDGE_MASK);
}
/*
@@ -514,320 +514,319 @@ e: param_signal_error(plist, param_name, ecode);\
*/
BEGIN_ARRAY_PARAM(param_read_float_array, "HWResolution", hwra, 2, hwre) {
- if (hwra.data[0] <= 0 || hwra.data[1] <= 0)
- ecode = gs_note_error(gs_error_rangecheck);
- else
- break;
+ if (hwra.data[0] <= 0 || hwra.data[1] <= 0)
+ ecode = gs_note_error(gs_error_rangecheck);
+ else
+ break;
} END_ARRAY_PARAM(hwra, hwre);
BEGIN_ARRAY_PARAM(param_read_int_array, "HWSize", hwsa, 2, hwsa) {
- /* We need a special check to handle the nullpage device, */
- /* whose size is legitimately [0 0]. */
- if ((hwsa.data[0] <= 0 && hwsa.data[0] != dev->width) ||
- (hwsa.data[1] <= 0 && hwsa.data[1] != dev->height)
- )
- ecode = gs_note_error(gs_error_rangecheck);
+ /* We need a special check to handle the nullpage device, */
+ /* whose size is legitimately [0 0]. */
+ if ((hwsa.data[0] <= 0 && hwsa.data[0] != dev->width) ||
+ (hwsa.data[1] <= 0 && hwsa.data[1] != dev->height)
+ )
+ ecode = gs_note_error(gs_error_rangecheck);
#define max_coord (max_fixed / fixed_1)
#if max_coord < max_int
- else if (hwsa.data[0] > max_coord || hwsa.data[1] > max_coord)
- ecode = gs_note_error(gs_error_limitcheck);
+ else if (hwsa.data[0] > max_coord || hwsa.data[1] > max_coord)
+ ecode = gs_note_error(gs_error_limitcheck);
#endif
#undef max_coord
- else
- break;
+ else
+ break;
} END_ARRAY_PARAM(hwsa, hwse);
{
- int t;
-
- code = param_read_int(plist, "LeadingEdge", &t);
- if (code < 0) {
- if (param_read_null(plist, "LeadingEdge") == 0) {
- /* if param is null, clear explicitly-set flag */
- leadingedge &= ~LEADINGEDGE_SET_MASK;
- code = 0;
- } else {
- ecode = code;
- }
- } else if (code == 0) {
- if (t < 0 || t > 3)
- param_signal_error(plist, "LeadingEdge",
- ecode = gs_error_rangecheck);
- else
- leadingedge = LEADINGEDGE_SET_MASK | t;
- }
+ int t;
+
+ code = param_read_int(plist, "LeadingEdge", &t);
+ if (code < 0) {
+ if (param_read_null(plist, "LeadingEdge") == 0) {
+ /* if param is null, clear explicitly-set flag */
+ leadingedge &= ~LEADINGEDGE_SET_MASK;
+ code = 0;
+ } else {
+ ecode = code;
+ }
+ } else if (code == 0) {
+ if (t < 0 || t > 3)
+ param_signal_error(plist, "LeadingEdge",
+ ecode = gs_error_rangecheck);
+ else
+ leadingedge = LEADINGEDGE_SET_MASK | t;
+ }
}
{
- const float *res = (hwra.data == 0 ? dev->HWResolution : hwra.data);
+ const float *res = (hwra.data == 0 ? dev->HWResolution : hwra.data);
#ifdef PAGESIZE_IS_MEDIASIZE
- const float *data;
-
- /* .MediaSize takes precedence over PageSize, so */
- /* we read PageSize first. */
- code = param_MediaSize(plist, "PageSize", res, &msa);
- if (code < 0)
- ecode = code;
- /* Prevent data from being set to 0 if PageSize is specified */
- /* but .MediaSize is not. */
- data = msa.data;
- code = param_MediaSize(plist, ".MediaSize", res, &msa);
- if (code < 0)
- ecode = code;
- else if (msa.data == 0)
- msa.data = data;
+ const float *data;
+
+ /* .MediaSize takes precedence over PageSize, so */
+ /* we read PageSize first. */
+ code = param_MediaSize(plist, "PageSize", res, &msa);
+ if (code < 0)
+ ecode = code;
+ /* Prevent data from being set to 0 if PageSize is specified */
+ /* but .MediaSize is not. */
+ data = msa.data;
+ code = param_MediaSize(plist, ".MediaSize", res, &msa);
+ if (code < 0)
+ ecode = code;
+ else if (msa.data == 0)
+ msa.data = data;
#else
- code = param_MediaSize(plist, ".MediaSize", res, &msa);
- if (code < 0)
- ecode = code;
+ code = param_MediaSize(plist, ".MediaSize", res, &msa);
+ if (code < 0)
+ ecode = code;
#endif
}
BEGIN_ARRAY_PARAM(param_read_float_array, "Margins", ma, 2, me) {
- break;
+ break;
} END_ARRAY_PARAM(ma, me);
BEGIN_ARRAY_PARAM(param_read_float_array, ".HWMargins", hwma, 4, hwme) {
- break;
+ break;
} END_ARRAY_PARAM(hwma, hwme);
/* MarginsHWResolution cannot be changed, only checked. */
BEGIN_ARRAY_PARAM(param_read_float_array, ".MarginsHWResolution", mhwra, 2, mhwre) {
- if (mhwra.data[0] != dev->MarginsHWResolution[0] ||
- mhwra.data[1] != dev->MarginsHWResolution[1]
- )
- ecode = gs_note_error(gs_error_rangecheck);
- else
- break;
+ if (mhwra.data[0] != dev->MarginsHWResolution[0] ||
+ mhwra.data[1] != dev->MarginsHWResolution[1]
+ )
+ ecode = gs_note_error(gs_error_rangecheck);
+ else
+ break;
} END_ARRAY_PARAM(mhwra, mhwre);
switch (code = param_read_bool(plist, (param_name = ".IgnoreNumCopies"), &ignc)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
if (dev->NumCopies_set >= 0 &&
- (*dev_proc(dev, get_page_device))(dev) != 0
- ) {
- switch (code = param_read_int(plist, (param_name = "NumCopies"), &nci)) {
- case 0:
- if (nci < 0)
- ecode = gs_error_rangecheck;
- else {
- ncset = 1;
- break;
- }
- goto nce;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- ncset = 0;
- break;
- }
- ecode = code; /* can't be 1 */
+ (*dev_proc(dev, get_page_device))(dev) != 0
+ ) {
+ switch (code = param_read_int(plist, (param_name = "NumCopies"), &nci)) {
+ case 0:
+ if (nci < 0)
+ ecode = gs_error_rangecheck;
+ else {
+ ncset = 1;
+ break;
+ }
+ goto nce;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ ncset = 0;
+ break;
+ }
+ ecode = code; /* can't be 1 */
nce:
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
}
if (param_read_string(plist, "OutputICCProfile", &icc_pro) != 1) {
if (icc_pro.size < gp_file_name_sizeof) {
/* Copy device ICC profile name in the device */
if (&(dev->color_info.icc_profile[0]) != (char *)(icc_pro.data)) {
- memcpy(&(dev->color_info.icc_profile[0]), icc_pro.data, icc_pro.size);
+ memcpy(&(dev->color_info.icc_profile[0]), icc_pro.data, icc_pro.size);
/* Set last position to NULL. In case of profile reset */
dev->color_info.icc_profile[icc_pro.size] = 0;
}
- }
+ }
}
if ((code = param_read_bool(plist, (param_name = "UseCIEColor"), &ucc)) < 0) {
- ecode = code;
- param_signal_error(plist, param_name, ecode);
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
}
if ((code = param_anti_alias_bits(plist, "TextAlphaBits", &tab)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_anti_alias_bits(plist, "GraphicsAlphaBits", &gab)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_read_int(plist, "MaxPatternBitmap", &mpbm)) < 0)
- ecode = code;
+ ecode = code;
switch (code = param_read_bool(plist, (param_name = ".LockSafetyParams"), &locksafe)) {
- case 0:
- if (dev->LockSafetyParams && !locksafe)
- code = gs_note_error(gs_error_invalidaccess);
- else
- break;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 0:
+ if (dev->LockSafetyParams && !locksafe)
+ code = gs_note_error(gs_error_invalidaccess);
+ else
+ break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
/* Ignore parameters that only have meaning for printers. */
#define IGNORE_INT_PARAM(pname)\
{ int igni;\
switch ( code = param_read_int(plist, (param_name = pname), &igni) )\
{ default:\
- ecode = code;\
- param_signal_error(plist, param_name, ecode);\
- case 0:\
- case 1:\
- break;\
+ ecode = code;\
+ param_signal_error(plist, param_name, ecode);\
+ case 0:\
+ case 1:\
+ break;\
}\
}
IGNORE_INT_PARAM("%MediaSource")
- IGNORE_INT_PARAM("%MediaDestination")
- switch (code = param_read_float_array(plist, (param_name = "ImagingBBox"), &ibba)) {
- case 0:
- if (ibba.size != 4 ||
- ibba.data[2] < ibba.data[0] || ibba.data[3] < ibba.data[1]
- )
- ecode = gs_note_error(gs_error_rangecheck);
- else
- break;
- goto ibbe;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- ibbnull = true;
- ibba.data = 0;
- break;
- }
- ecode = code; /* can't be 1 */
- ibbe:param_signal_error(plist, param_name, ecode);
- case 1:
- ibba.data = 0;
- break;
+ IGNORE_INT_PARAM("%MediaDestination")
+ switch (code = param_read_float_array(plist, (param_name = "ImagingBBox"), &ibba)) {
+ case 0:
+ if (ibba.size != 4 ||
+ ibba.data[2] < ibba.data[0] || ibba.data[3] < ibba.data[1]
+ )
+ ecode = gs_note_error(gs_error_rangecheck);
+ else
+ break;
+ goto ibbe;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ ibbnull = true;
+ ibba.data = 0;
+ break;
+ }
+ ecode = code; /* can't be 1 */
+ ibbe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ ibba.data = 0;
+ break;
}
/* Separation, DeviceN Color, and ProcessColorModel related parameters. */
{
- const char * pcms = get_process_color_model_name(dev);
+ const char * pcms = get_process_color_model_name(dev);
/* the device should have set a process model name at this point */
- if ((code = param_check_string(plist, "ProcessColorModel", pcms, (pcms != NULL))) < 0)
- ecode = code;
+ if ((code = param_check_string(plist, "ProcessColorModel", pcms, (pcms != NULL))) < 0)
+ ecode = code;
}
IGNORE_INT_PARAM("MaxSeparations")
if ((code = param_check_bool(plist, "Separations", false, true)) < 0)
- ecode = code;
+ ecode = code;
BEGIN_ARRAY_PARAM(param_read_name_array, "SeparationColorNames", scna, scna.size, scne) {
- break;
+ break;
} END_ARRAY_PARAM(scna, scne);
-
/* Now check nominally read-only parameters. */
if ((code = param_check_string(plist, "OutputDevice", dev->dname, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_string(plist, "Name", dev->dname, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "Colors", colors, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "BitsPerPixel", depth, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "GrayValues", GrayValues, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_long(plist, "PageCount", dev->PageCount, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "RedValues", RGBValues, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "GreenValues", RGBValues, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_int(plist, "BlueValues", RGBValues, true)) < 0)
- ecode = code;
+ ecode = code;
if ((code = param_check_long(plist, "ColorValues", ColorValues, true)) < 0)
- ecode = code;
+ ecode = code;
if (param_read_string(plist, "HWColorMap", &cms) != 1) {
- byte palette[3 << 8];
+ byte palette[3 << 8];
- if (param_HWColorMap(dev, palette))
- code = param_check_bytes(plist, "HWColorMap", palette,
- colors << depth, true);
- else
- code = param_check_bytes(plist, "HWColorMap", 0, 0, false);
- if (code < 0)
- ecode = code;
+ if (param_HWColorMap(dev, palette))
+ code = param_check_bytes(plist, "HWColorMap", palette,
+ colors << depth, true);
+ else
+ code = param_check_bytes(plist, "HWColorMap", 0, 0, false);
+ if (code < 0)
+ ecode = code;
}
/* We must 'commit', in order to detect unknown parameters, */
/* even if there were errors. */
code = param_commit(plist);
if (ecode < 0)
- return ecode;
+ return ecode;
if (code < 0)
- return code;
+ return code;
- /*
+ /*
* Now actually make the changes. Changing resolution, rotation
* (through LeadingEdge) or page size requires closing the device,
* but changing margins or ImagingBBox does not. In order not to
* close and reopen the device unnecessarily, we check for
* replacing the values with the same ones.
*/
-
+
if (hwra.data != 0 &&
- (dev->HWResolution[0] != hwra.data[0] ||
- dev->HWResolution[1] != hwra.data[1])
- ) {
- if (dev->is_open)
- gs_closedevice(dev);
- gx_device_set_resolution(dev, hwra.data[0], hwra.data[1]);
+ (dev->HWResolution[0] != hwra.data[0] ||
+ dev->HWResolution[1] != hwra.data[1])
+ ) {
+ if (dev->is_open)
+ gs_closedevice(dev);
+ gx_device_set_resolution(dev, hwra.data[0], hwra.data[1]);
}
if ((leadingedge & LEADINGEDGE_MASK) !=
- (dev->LeadingEdge & LEADINGEDGE_MASK)) {
- /* If the LeadingEdge_set flag changes but the value of LeadingEdge
- itself does not, don't close device and recompute page size. */
- dev->LeadingEdge = leadingedge;
- if (dev->is_open)
- gs_closedevice(dev);
- gx_device_set_resolution(dev, dev->HWResolution[0], dev->HWResolution[1]);
+ (dev->LeadingEdge & LEADINGEDGE_MASK)) {
+ /* If the LeadingEdge_set flag changes but the value of LeadingEdge
+ itself does not, don't close device and recompute page size. */
+ dev->LeadingEdge = leadingedge;
+ if (dev->is_open)
+ gs_closedevice(dev);
+ gx_device_set_resolution(dev, dev->HWResolution[0], dev->HWResolution[1]);
}
/* clear leadingedge request, preserve "set" flag */
dev->LeadingEdge &= LEADINGEDGE_MASK;
dev->LeadingEdge |= (leadingedge & LEADINGEDGE_SET_MASK);
if (hwsa.data != 0 &&
- (dev->width != hwsa.data[0] ||
- dev->height != hwsa.data[1])
- ) {
- if (dev->is_open)
- gs_closedevice(dev);
- gx_device_set_width_height(dev, hwsa.data[0], hwsa.data[1]);
+ (dev->width != hwsa.data[0] ||
+ dev->height != hwsa.data[1])
+ ) {
+ if (dev->is_open)
+ gs_closedevice(dev);
+ gx_device_set_width_height(dev, hwsa.data[0], hwsa.data[1]);
}
if (msa.data != 0 &&
- (dev->MediaSize[0] != msa.data[0] ||
- dev->MediaSize[1] != msa.data[1])
- ) {
- if (dev->is_open)
- gs_closedevice(dev);
- gx_device_set_page_size(dev, msa.data[0], msa.data[1]);
+ (dev->MediaSize[0] != msa.data[0] ||
+ dev->MediaSize[1] != msa.data[1])
+ ) {
+ if (dev->is_open)
+ gs_closedevice(dev);
+ gx_device_set_page_size(dev, msa.data[0], msa.data[1]);
}
if (ma.data != 0) {
- dev->Margins[0] = ma.data[0];
- dev->Margins[1] = ma.data[1];
+ dev->Margins[0] = ma.data[0];
+ dev->Margins[1] = ma.data[1];
}
if (hwma.data != 0) {
- dev->HWMargins[0] = hwma.data[0];
- dev->HWMargins[1] = hwma.data[1];
- dev->HWMargins[2] = hwma.data[2];
- dev->HWMargins[3] = hwma.data[3];
+ dev->HWMargins[0] = hwma.data[0];
+ dev->HWMargins[1] = hwma.data[1];
+ dev->HWMargins[2] = hwma.data[2];
+ dev->HWMargins[3] = hwma.data[3];
}
dev->NumCopies = nci;
dev->NumCopies_set = ncset;
dev->IgnoreNumCopies = ignc;
if (ibba.data != 0) {
- dev->ImagingBBox[0] = ibba.data[0];
- dev->ImagingBBox[1] = ibba.data[1];
- dev->ImagingBBox[2] = ibba.data[2];
- dev->ImagingBBox[3] = ibba.data[3];
- dev->ImagingBBox_set = true;
+ dev->ImagingBBox[0] = ibba.data[0];
+ dev->ImagingBBox[1] = ibba.data[1];
+ dev->ImagingBBox[2] = ibba.data[2];
+ dev->ImagingBBox[3] = ibba.data[3];
+ dev->ImagingBBox_set = true;
} else if (ibbnull) {
- dev->ImagingBBox_set = false;
+ dev->ImagingBBox_set = false;
}
dev->UseCIEColor = ucc;
- dev->color_info.anti_alias.text_bits =
- param_normalize_anti_alias_bits(max(dev->color_info.max_gray,
- dev->color_info.max_color), tab);
- dev->color_info.anti_alias.graphics_bits =
- param_normalize_anti_alias_bits(max(dev->color_info.max_gray,
- dev->color_info.max_color), gab);
+ dev->color_info.anti_alias.text_bits =
+ param_normalize_anti_alias_bits(max(dev->color_info.max_gray,
+ dev->color_info.max_color), tab);
+ dev->color_info.anti_alias.graphics_bits =
+ param_normalize_anti_alias_bits(max(dev->color_info.max_gray,
+ dev->color_info.max_color), gab);
dev->LockSafetyParams = locksafe;
dev->MaxPatternBitmap = mpbm;
gx_device_decache_colors(dev);
@@ -838,8 +837,8 @@ void
gx_device_request_leadingedge(gx_device *dev, int le_req)
{
dev->LeadingEdge = (dev->LeadingEdge & ~LEADINGEDGE_REQ_VAL) |
- ((le_req << LEADINGEDGE_REQ_VAL_SHIFT) & LEADINGEDGE_REQ_VAL) |
- LEADINGEDGE_REQ_BIT;
+ ((le_req << LEADINGEDGE_REQ_VAL_SHIFT) & LEADINGEDGE_REQ_VAL) |
+ LEADINGEDGE_REQ_BIT;
}
/* Limit the anti-alias bit values to the maximum legal value for the
@@ -848,9 +847,9 @@ gx_device_request_leadingedge(gx_device *dev, int le_req)
static int
param_normalize_anti_alias_bits( uint max_gray, int bits )
{
- int max_bits = ilog2( max_gray + 1);
-
- return (bits > max_bits ? max_bits : bits);
+ int max_bits = ilog2( max_gray + 1);
+
+ return (bits > max_bits ? max_bits : bits);
}
/* Read TextAlphaBits or GraphicsAlphaBits. */
@@ -861,44 +860,43 @@ param_anti_alias_bits(gs_param_list * plist, gs_param_name param_name, int *pa)
switch (code) {
case 0:
- switch (*pa) {
- case 1: case 2: case 4:
- return 0;
- default:
- code = gs_error_rangecheck;
- }
+ switch (*pa) {
+ case 1: case 2: case 4:
+ return 0;
+ default:
+ code = gs_error_rangecheck;
+ }
default:
- param_signal_error(plist, param_name, code);
+ param_signal_error(plist, param_name, code);
case 1:
- ;
+ ;
}
return code;
}
-
/* Read .MediaSize or, if supported as a synonym, PageSize. */
static int
param_MediaSize(gs_param_list * plist, gs_param_name pname,
- const float *res, gs_param_float_array * pa)
+ const float *res, gs_param_float_array * pa)
{
gs_param_name param_name;
int ecode = 0;
int code;
BEGIN_ARRAY_PARAM(param_read_float_array, pname, *pa, 2, mse) {
- float width_new = pa->data[0] * res[0] / 72;
- float height_new = pa->data[1] * res[1] / 72;
+ float width_new = pa->data[0] * res[0] / 72;
+ float height_new = pa->data[1] * res[1] / 72;
- if (width_new < 0 || height_new < 0)
- ecode = gs_note_error(gs_error_rangecheck);
+ if (width_new < 0 || height_new < 0)
+ ecode = gs_note_error(gs_error_rangecheck);
#define max_coord (max_fixed / fixed_1)
#if max_coord < max_int
- else if (width_new > max_coord || height_new > max_coord)
- ecode = gs_note_error(gs_error_limitcheck);
+ else if (width_new > max_coord || height_new > max_coord)
+ ecode = gs_note_error(gs_error_limitcheck);
#endif
#undef max_coord
- else
- break;
+ else
+ break;
} END_ARRAY_PARAM(*pa, mse);
return ecode;
}
@@ -907,70 +905,70 @@ param_MediaSize(gs_param_list * plist, gs_param_name pname,
/* its existing value. */
static int
param_check_bool(gs_param_list * plist, gs_param_name pname, bool value,
- bool is_defined)
+ bool is_defined)
{
int code;
bool new_value;
switch (code = param_read_bool(plist, pname, &new_value)) {
- case 0:
- if (is_defined && new_value == value)
- break;
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e:param_signal_error(plist, pname, code);
- case 1:
- ;
+ case 0:
+ if (is_defined && new_value == value)
+ break;
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if (param_read_null(plist, pname) == 0)
+ return 1;
+ e:param_signal_error(plist, pname, code);
+ case 1:
+ ;
}
return code;
}
static int
param_check_long(gs_param_list * plist, gs_param_name pname, long value,
- bool is_defined)
+ bool is_defined)
{
int code;
long new_value;
switch (code = param_read_long(plist, pname, &new_value)) {
- case 0:
- if (is_defined && new_value == value)
- break;
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e:param_signal_error(plist, pname, code);
- case 1:
- ;
+ case 0:
+ if (is_defined && new_value == value)
+ break;
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if (param_read_null(plist, pname) == 0)
+ return 1;
+ e:param_signal_error(plist, pname, code);
+ case 1:
+ ;
}
return code;
}
static int
param_check_bytes(gs_param_list * plist, gs_param_name pname, const byte * str,
- uint size, bool is_defined)
+ uint size, bool is_defined)
{
int code;
gs_param_string new_value;
switch (code = param_read_string(plist, pname, &new_value)) {
- case 0:
- if (is_defined && new_value.size == size &&
- !memcmp((const char *)str, (const char *)new_value.data,
- size)
- )
- break;
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e:param_signal_error(plist, pname, code);
- case 1:
- ;
+ case 0:
+ if (is_defined && new_value.size == size &&
+ !memcmp((const char *)str, (const char *)new_value.data,
+ size)
+ )
+ break;
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if (param_read_null(plist, pname) == 0)
+ return 1;
+ e:param_signal_error(plist, pname, code);
+ case 1:
+ ;
}
return code;
}
diff --git a/gs/base/gsdpnext.h b/gs/base/gsdpnext.h
index 9be5c154c..828b0ac5d 100644
--- a/gs/base/gsdpnext.h
+++ b/gs/base/gsdpnext.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsdps.c b/gs/base/gsdps.c
index 75f04b7f4..5d5125c6d 100644
--- a/gs/base/gsdps.c
+++ b/gs/base/gsdps.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,8 +33,8 @@ gs_initviewclip(gs_state * pgs)
gx_clip_path *pcpath = pgs->view_clip;
if (pcpath != 0 && pcpath->rule != 0) {
- gx_cpath_reset(pcpath);
- pcpath->rule = 0;
+ gx_cpath_reset(pcpath);
+ pcpath->rule = 0;
}
return 0;
}
@@ -62,20 +62,20 @@ common_viewclip(gs_state * pgs, int rule)
gx_clip_path *pcpath = pgs->view_clip;
if (pcpath == 0) {
- pcpath = gx_cpath_alloc(pgs->memory, "gs_[eo]viewclip");
- if (pcpath == 0)
- return_error(gs_error_VMerror);
- pgs->view_clip = pcpath;
+ pcpath = gx_cpath_alloc(pgs->memory, "gs_[eo]viewclip");
+ if (pcpath == 0)
+ return_error(gs_error_VMerror);
+ pgs->view_clip = pcpath;
}
if ((code = gx_path_bbox(pgs->path, &bbox)) < 0)
- return code;
+ return code;
gx_cpath_init_local(&rpath, pgs->memory);
code = gx_cpath_from_rectangle(&rpath, &bbox);
if (code >= 0)
- code = gx_cpath_clip(pgs, &rpath, pgs->path, rule);
+ code = gx_cpath_clip(pgs, &rpath, pgs->path, rule);
if (code < 0) {
- gx_cpath_free(&rpath, "gs_[eo]viewclip");
- return code;
+ gx_cpath_free(&rpath, "gs_[eo]viewclip");
+ return code;
}
rpath.rule = rule;
gx_cpath_assign_free(pcpath, &rpath);
@@ -92,18 +92,18 @@ gs_viewclippath(gs_state * pgs)
gx_path_init_local(&cpath, pgs->memory);
if (pcpath == 0 || pcpath->rule == 0) {
- /* No view clip path is active: fabricate one. */
- gs_fixed_rect box;
+ /* No view clip path is active: fabricate one. */
+ gs_fixed_rect box;
- code = gx_default_clip_box(pgs, &box);
- if (code < 0)
- return code;
- code = gx_path_add_rectangle(&cpath, box.p.x, box.p.y,
- box.q.x, box.q.y);
+ code = gx_default_clip_box(pgs, &box);
+ if (code < 0)
+ return code;
+ code = gx_path_add_rectangle(&cpath, box.p.x, box.p.y,
+ box.q.x, box.q.y);
} else {
- code = gx_cpath_to_path(pcpath, &cpath);
+ code = gx_cpath_to_path(pcpath, &cpath);
}
if (code < 0)
- return code;
+ return code;
return gx_path_assign_free(pgs->path, &cpath);
}
diff --git a/gs/base/gsdps.h b/gs/base/gsdps.h
index cba4ddcc2..5a661239c 100644
--- a/gs/base/gsdps.h
+++ b/gs/base/gsdps.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsdps1.c b/gs/base/gsdps1.c
index 928d2aacb..0844a2ac2 100644
--- a/gs/base/gsdps1.c
+++ b/gs/base/gsdps1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,38 +54,38 @@ gs_setbbox(gs_state * pgs, floatp llx, floatp lly, floatp urx, floatp ury)
int code;
if (llx > urx || lly > ury)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Transform box to device coordinates. */
ubox.p.x = llx;
ubox.p.y = lly;
ubox.q.x = urx;
ubox.q.y = ury;
if ((code = gs_bbox_transform(&ubox, &ctm_only(pgs), &dbox)) < 0)
- return code;
+ return code;
/* Round the corners in opposite directions. */
/* Because we can't predict the magnitude of the dbox values, */
/* we add/subtract the slop after fixing. */
if (dbox.p.x < fixed2float(min_fixed + box_rounding_slop_fixed) ||
- dbox.p.y < fixed2float(min_fixed + box_rounding_slop_fixed) ||
- dbox.q.x >= fixed2float(max_fixed - box_rounding_slop_fixed + fixed_epsilon) ||
- dbox.q.y >= fixed2float(max_fixed - box_rounding_slop_fixed + fixed_epsilon)
- )
- return_error(gs_error_limitcheck);
+ dbox.p.y < fixed2float(min_fixed + box_rounding_slop_fixed) ||
+ dbox.q.x >= fixed2float(max_fixed - box_rounding_slop_fixed + fixed_epsilon) ||
+ dbox.q.y >= fixed2float(max_fixed - box_rounding_slop_fixed + fixed_epsilon)
+ )
+ return_error(gs_error_limitcheck);
bbox.p.x =
- (fixed) floor(dbox.p.x * fixed_scale) - box_rounding_slop_fixed;
+ (fixed) floor(dbox.p.x * fixed_scale) - box_rounding_slop_fixed;
bbox.p.y =
- (fixed) floor(dbox.p.y * fixed_scale) - box_rounding_slop_fixed;
+ (fixed) floor(dbox.p.y * fixed_scale) - box_rounding_slop_fixed;
bbox.q.x =
- (fixed) ceil(dbox.q.x * fixed_scale) + box_rounding_slop_fixed;
+ (fixed) ceil(dbox.q.x * fixed_scale) + box_rounding_slop_fixed;
bbox.q.y =
- (fixed) ceil(dbox.q.y * fixed_scale) + box_rounding_slop_fixed;
+ (fixed) ceil(dbox.q.y * fixed_scale) + box_rounding_slop_fixed;
if (gx_path_bbox_set(ppath, &obox) >= 0) { /* Take the union of the bboxes. */
- ppath->bbox.p.x = min(obox.p.x, bbox.p.x);
- ppath->bbox.p.y = min(obox.p.y, bbox.p.y);
- ppath->bbox.q.x = max(obox.q.x, bbox.q.x);
- ppath->bbox.q.y = max(obox.q.y, bbox.q.y);
+ ppath->bbox.p.x = min(obox.p.x, bbox.p.x);
+ ppath->bbox.p.y = min(obox.p.y, bbox.p.y);
+ ppath->bbox.q.x = max(obox.q.x, bbox.q.x);
+ ppath->bbox.q.y = max(obox.q.y, bbox.q.y);
} else { /* empty path *//* Just set the bbox. */
- ppath->bbox = bbox;
+ ppath->bbox = bbox;
}
ppath->bbox_set = 1;
return 0;
@@ -100,55 +100,55 @@ gs_rectappend_compat(gs_state * pgs, const gs_rect * pr, uint count, bool clip)
bool CPSI_mode = gs_currentcpsimode(pgs->memory);
for (; count != 0; count--, pr++) {
- floatp px = pr->p.x, py = pr->p.y, qx = pr->q.x, qy = pr->q.y;
- int code;
+ floatp px = pr->p.x, py = pr->p.y, qx = pr->q.x, qy = pr->q.y;
+ int code;
- if (CPSI_mode) {
- /* We believe that the result must be independent
- on the device initial matrix.
- Particularly for the correct dashing
- the starting point and the contour direction
- must be same with any device initial matrix.
- Only way to provide it is to choose the starting point
- and the direction in the user space. */
- if (clip) {
- /* CPSI starts a clippath with the upper right corner. */
- /* Debugged with CET 11-11.PS page 6 item much13.*/
- if ((code = gs_moveto(pgs, qx, qy)) < 0 ||
- (code = gs_lineto(pgs, qx, py)) < 0 ||
- (code = gs_lineto(pgs, px, py)) < 0 ||
- (code = gs_lineto(pgs, px, qy)) < 0 ||
- (code = gs_closepath(pgs)) < 0
- )
- return code;
- } else {
- /* Debugged with CET 12-12.PS page 10 item more20.*/
- if (px > qx) {
- px = qx; qx = pr->p.x;
- }
- if (py > qy) {
- py = qy; qy = pr->p.y;
- }
- if ((code = gs_moveto(pgs, px, py)) < 0 ||
- (code = gs_lineto(pgs, qx, py)) < 0 ||
- (code = gs_lineto(pgs, qx, qy)) < 0 ||
- (code = gs_lineto(pgs, px, qy)) < 0 ||
- (code = gs_closepath(pgs)) < 0
- )
- return code;
- }
- } else {
- /* Ensure counter-clockwise drawing. */
- if ((qx >= px) != (qy >= py))
- qx = px, px = pr->q.x; /* swap x values */
- if ((code = gs_moveto(pgs, px, py)) < 0 ||
- (code = gs_lineto(pgs, qx, py)) < 0 ||
- (code = gs_lineto(pgs, qx, qy)) < 0 ||
- (code = gs_lineto(pgs, px, qy)) < 0 ||
- (code = gs_closepath(pgs)) < 0
- )
- return code;
- }
+ if (CPSI_mode) {
+ /* We believe that the result must be independent
+ on the device initial matrix.
+ Particularly for the correct dashing
+ the starting point and the contour direction
+ must be same with any device initial matrix.
+ Only way to provide it is to choose the starting point
+ and the direction in the user space. */
+ if (clip) {
+ /* CPSI starts a clippath with the upper right corner. */
+ /* Debugged with CET 11-11.PS page 6 item much13.*/
+ if ((code = gs_moveto(pgs, qx, qy)) < 0 ||
+ (code = gs_lineto(pgs, qx, py)) < 0 ||
+ (code = gs_lineto(pgs, px, py)) < 0 ||
+ (code = gs_lineto(pgs, px, qy)) < 0 ||
+ (code = gs_closepath(pgs)) < 0
+ )
+ return code;
+ } else {
+ /* Debugged with CET 12-12.PS page 10 item more20.*/
+ if (px > qx) {
+ px = qx; qx = pr->p.x;
+ }
+ if (py > qy) {
+ py = qy; qy = pr->p.y;
+ }
+ if ((code = gs_moveto(pgs, px, py)) < 0 ||
+ (code = gs_lineto(pgs, qx, py)) < 0 ||
+ (code = gs_lineto(pgs, qx, qy)) < 0 ||
+ (code = gs_lineto(pgs, px, qy)) < 0 ||
+ (code = gs_closepath(pgs)) < 0
+ )
+ return code;
+ }
+ } else {
+ /* Ensure counter-clockwise drawing. */
+ if ((qx >= px) != (qy >= py))
+ qx = px, px = pr->q.x; /* swap x values */
+ if ((code = gs_moveto(pgs, px, py)) < 0 ||
+ (code = gs_lineto(pgs, qx, py)) < 0 ||
+ (code = gs_lineto(pgs, qx, qy)) < 0 ||
+ (code = gs_lineto(pgs, px, qy)) < 0 ||
+ (code = gs_closepath(pgs)) < 0
+ )
+ return code;
+ }
}
return 0;
}
@@ -169,10 +169,10 @@ gs_rectclip(gs_state * pgs, const gs_rect * pr, uint count)
gx_path_assign_preserve(&save, pgs->path);
gs_newpath(pgs);
if ((code = gs_rectappend_compat(pgs, pr, count, true)) < 0 ||
- (code = gs_clip(pgs)) < 0
- ) {
- gx_path_assign_free(pgs->path, &save);
- return code;
+ (code = gs_clip(pgs)) < 0
+ ) {
+ gx_path_assign_free(pgs->path, &save);
+ return code;
}
gx_path_free(&save, "gs_rectclip");
gs_newpath(pgs);
@@ -193,9 +193,9 @@ gs_rectfill(gs_state * pgs, const gs_rect * pr, uint count)
const gs_imager_state *pis = (const gs_imager_state *)pgs;
bool hl_color_available = gx_hld_is_hl_color_available(pis, pdc);
gs_fixed_rect empty = {{0, 0}, {0, 0}};
- bool hl_color = (hl_color_available &&
- dev_proc(pdev, fill_rectangle_hl_color)(pdev,
- &empty, pis, pdc, NULL) == 0);
+ bool hl_color = (hl_color_available &&
+ dev_proc(pdev, fill_rectangle_hl_color)(pdev,
+ &empty, pis, pdc, NULL) == 0);
bool center_of_pixel = (pgs->fill_adjust.x == 0 && pgs->fill_adjust.y == 0);
/* Processing a fill object operation */
@@ -203,59 +203,59 @@ gs_rectfill(gs_state * pgs, const gs_rect * pr, uint count)
gx_set_dev_color(pgs);
if ((is_fzero2(pgs->ctm.xy, pgs->ctm.yx) ||
- is_fzero2(pgs->ctm.xx, pgs->ctm.yy)) &&
- gx_effective_clip_path(pgs, &pcpath) >= 0 &&
- clip_list_is_rectangle(gx_cpath_list(pcpath)) &&
- (hl_color ||
- pdc->type == gx_dc_type_pure ||
- pdc->type == gx_dc_type_ht_binary ||
- pdc->type == gx_dc_type_ht_colored
- /* DeviceN todo: add wts case */) &&
- gs_state_color_load(pgs) >= 0 &&
- (*dev_proc(pdev, get_alpha_bits)) (pdev, go_graphics)
- <= 1 &&
+ is_fzero2(pgs->ctm.xx, pgs->ctm.yy)) &&
+ gx_effective_clip_path(pgs, &pcpath) >= 0 &&
+ clip_list_is_rectangle(gx_cpath_list(pcpath)) &&
+ (hl_color ||
+ pdc->type == gx_dc_type_pure ||
+ pdc->type == gx_dc_type_ht_binary ||
+ pdc->type == gx_dc_type_ht_colored
+ /* DeviceN todo: add wts case */) &&
+ gs_state_color_load(pgs) >= 0 &&
+ (*dev_proc(pdev, get_alpha_bits)) (pdev, go_graphics)
+ <= 1 &&
(!pgs->overprint || !pgs->effective_overprint_mode)
- ) {
- uint i;
- gs_fixed_rect clip_rect;
+ ) {
+ uint i;
+ gs_fixed_rect clip_rect;
- gx_cpath_inner_box(pcpath, &clip_rect);
- /* We should never plot anything for an empty clip rectangle */
- if ((clip_rect.p.x >= clip_rect.q.x) &&
- (clip_rect.p.y >= clip_rect.q.y))
- return 0;
- for (i = 0; i < count; ++i) {
- gs_fixed_point p, q;
- gs_fixed_rect draw_rect;
-
- if (gs_point_transform2fixed(&pgs->ctm, pr[i].p.x, pr[i].p.y, &p) < 0 ||
- gs_point_transform2fixed(&pgs->ctm, pr[i].q.x, pr[i].q.y, &q) < 0
- ) { /* Switch to the slow algorithm. */
- goto slow;
- }
- draw_rect.p.x = min(p.x, q.x);
- draw_rect.p.y = min(p.y, q.y);
- draw_rect.q.x = max(p.x, q.x);
- draw_rect.q.y = max(p.y, q.y);
- if (hl_color) {
- rect_intersect(draw_rect, clip_rect);
+ gx_cpath_inner_box(pcpath, &clip_rect);
+ /* We should never plot anything for an empty clip rectangle */
+ if ((clip_rect.p.x >= clip_rect.q.x) &&
+ (clip_rect.p.y >= clip_rect.q.y))
+ return 0;
+ for (i = 0; i < count; ++i) {
+ gs_fixed_point p, q;
+ gs_fixed_rect draw_rect;
+
+ if (gs_point_transform2fixed(&pgs->ctm, pr[i].p.x, pr[i].p.y, &p) < 0 ||
+ gs_point_transform2fixed(&pgs->ctm, pr[i].q.x, pr[i].q.y, &q) < 0
+ ) { /* Switch to the slow algorithm. */
+ goto slow;
+ }
+ draw_rect.p.x = min(p.x, q.x);
+ draw_rect.p.y = min(p.y, q.y);
+ draw_rect.q.x = max(p.x, q.x);
+ draw_rect.q.y = max(p.y, q.y);
+ if (hl_color) {
+ rect_intersect(draw_rect, clip_rect);
/* We do pass on 0 extant rectangles to high level
devices. It isn't clear how a client and an output
device should interact if one uses a center of
pixel algorithm and the other uses any part of
pixel. For now we punt and just pass the high
level rectangle on without adjustment. */
- if (draw_rect.p.x <= draw_rect.q.x &&
- draw_rect.p.y <= draw_rect.q.y) {
- code = dev_proc(pdev, fill_rectangle_hl_color)(pdev,
- &draw_rect, pis, pdc, pcpath);
- if (code < 0)
- return code;
- }
- } else {
- int x, y, w, h;
+ if (draw_rect.p.x <= draw_rect.q.x &&
+ draw_rect.p.y <= draw_rect.q.y) {
+ code = dev_proc(pdev, fill_rectangle_hl_color)(pdev,
+ &draw_rect, pis, pdc, pcpath);
+ if (code < 0)
+ return code;
+ }
+ } else {
+ int x, y, w, h;
- rect_intersect(draw_rect, clip_rect);
+ rect_intersect(draw_rect, clip_rect);
if (center_of_pixel) {
draw_rect.p.x = fixed_rounded(draw_rect.p.x);
draw_rect.p.y = fixed_rounded(draw_rect.p.y);
@@ -267,10 +267,10 @@ gs_rectfill(gs_state * pgs, const gs_rect * pr, uint count)
draw_rect.q.x = fixed_ceiling(draw_rect.q.x);
draw_rect.q.y = fixed_ceiling(draw_rect.q.y);
}
- x = fixed2int(draw_rect.p.x);
- y = fixed2int(draw_rect.p.y);
- w = fixed2int(draw_rect.q.x - draw_rect.p.x);
- h = fixed2int(draw_rect.q.y - draw_rect.p.y);
+ x = fixed2int(draw_rect.p.x);
+ y = fixed2int(draw_rect.p.y);
+ w = fixed2int(draw_rect.q.x - draw_rect.p.x);
+ h = fixed2int(draw_rect.q.y - draw_rect.p.y);
/* clients that use the "any part of pixel" rule also
fill 0 areas. This is true of current graphics
library clients but not a general rule. */
@@ -286,27 +286,27 @@ gs_rectfill(gs_state * pgs, const gs_rect * pr, uint count)
}
if (gx_fill_rectangle(x, y, w, h, pdc, pgs) < 0)
goto slow;
- }
- }
- return 0;
+ }
+ }
+ return 0;
slow:rlist = pr + i;
- rcount = count - i;
+ rcount = count - i;
} {
- bool do_save = !gx_path_is_null(pgs->path);
+ bool do_save = !gx_path_is_null(pgs->path);
- if (do_save) {
- if ((code = gs_gsave(pgs)) < 0)
- return code;
- gs_newpath(pgs);
- }
- if ((code = gs_rectappend(pgs, rlist, rcount)) < 0 ||
- (code = gs_fill(pgs)) < 0
- )
- DO_NOTHING;
- if (do_save)
- gs_grestore(pgs);
- else if (code < 0)
- gs_newpath(pgs);
+ if (do_save) {
+ if ((code = gs_gsave(pgs)) < 0)
+ return code;
+ gs_newpath(pgs);
+ }
+ if ((code = gs_rectappend(pgs, rlist, rcount)) < 0 ||
+ (code = gs_fill(pgs)) < 0
+ )
+ DO_NOTHING;
+ if (do_save)
+ gs_grestore(pgs);
+ else if (code < 0)
+ gs_newpath(pgs);
}
return code;
}
@@ -315,24 +315,24 @@ gs_rectfill(gs_state * pgs, const gs_rect * pr, uint count)
/* (We could do this a lot more efficiently.) */
int
gs_rectstroke(gs_state * pgs, const gs_rect * pr, uint count,
- const gs_matrix * pmat)
+ const gs_matrix * pmat)
{
bool do_save = pmat != NULL || !gx_path_is_null(pgs->path);
int code;
if (do_save) {
- if ((code = gs_gsave(pgs)) < 0)
- return code;
- gs_newpath(pgs);
+ if ((code = gs_gsave(pgs)) < 0)
+ return code;
+ gs_newpath(pgs);
}
if ((code = gs_rectappend(pgs, pr, count)) < 0 ||
- (pmat != NULL && (code = gs_concat(pgs, pmat)) < 0) ||
- (code = gs_stroke(pgs)) < 0
- )
- DO_NOTHING;
+ (pmat != NULL && (code = gs_concat(pgs, pmat)) < 0) ||
+ (code = gs_stroke(pgs)) < 0
+ )
+ DO_NOTHING;
if (do_save)
- gs_grestore(pgs);
+ gs_grestore(pgs);
else if (code < 0)
- gs_newpath(pgs);
+ gs_newpath(pgs);
return code;
}
diff --git a/gs/base/gsdsrc.c b/gs/base/gsdsrc.c
index 11b64965d..d11905e84 100644
--- a/gs/base/gsdsrc.c
+++ b/gs/base/gsdsrc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,25 +22,25 @@
/* GC descriptor */
public_st_data_source();
-static
+static
ENUM_PTRS_WITH(data_source_enum_ptrs, gs_data_source_t *psrc)
{
if (psrc->type == data_source_type_string)
- ENUM_RETURN_CONST_STRING_PTR(gs_data_source_t, data.str);
+ ENUM_RETURN_CONST_STRING_PTR(gs_data_source_t, data.str);
else if (psrc->type == data_source_type_stream)
- ENUM_RETURN_PTR(gs_data_source_t, data.strm);
+ ENUM_RETURN_PTR(gs_data_source_t, data.strm);
else /* bytes or floats */
- ENUM_RETURN_PTR(gs_data_source_t, data.str.data);
+ ENUM_RETURN_PTR(gs_data_source_t, data.str.data);
}
ENUM_PTRS_END
static RELOC_PTRS_WITH(data_source_reloc_ptrs, gs_data_source_t *psrc)
{
if (psrc->type == data_source_type_string)
- RELOC_CONST_STRING_PTR(gs_data_source_t, data.str);
+ RELOC_CONST_STRING_PTR(gs_data_source_t, data.str);
else if (psrc->type == data_source_type_stream)
- RELOC_PTR(gs_data_source_t, data.strm);
+ RELOC_PTR(gs_data_source_t, data.strm);
else /* bytes or floats */
- RELOC_PTR(gs_data_source_t, data.str.data);
+ RELOC_PTR(gs_data_source_t, data.str.data);
}
RELOC_PTRS_END
@@ -49,24 +49,24 @@ RELOC_PTRS_END
but CPSI implementation silently gives (bogus) data. */
int
data_source_access_string(const gs_data_source_t * psrc, ulong start,
- uint length, byte * buf, const byte ** ptr)
+ uint length, byte * buf, const byte ** ptr)
{
const byte *p = psrc->data.str.data + start;
if (start + length <= psrc->data.str.size) {
- if (ptr)
- *ptr = p;
- else
- memcpy(buf, p, length);
+ if (ptr)
+ *ptr = p;
+ else
+ memcpy(buf, p, length);
} else {
- if (start < psrc->data.str.size) {
- uint oklen = psrc->data.str.size - start;
- memcpy(buf, p, oklen);
- memset(buf + oklen, 0, length - oklen);
- } else {
- memset(buf, 0, length);
- }
- *ptr = buf;
+ if (start < psrc->data.str.size) {
+ uint oklen = psrc->data.str.size - start;
+ memcpy(buf, p, oklen);
+ memset(buf + oklen, 0, length - oklen);
+ } else {
+ memset(buf, 0, length);
+ }
+ *ptr = buf;
}
return 0;
}
@@ -74,14 +74,14 @@ data_source_access_string(const gs_data_source_t * psrc, ulong start,
/* GC procedure. */
int
data_source_access_bytes(const gs_data_source_t * psrc, ulong start,
- uint length, byte * buf, const byte ** ptr)
+ uint length, byte * buf, const byte ** ptr)
{
const byte *p = psrc->data.str.data + start;
if (ptr)
- *ptr = p;
+ *ptr = p;
else
- memcpy(buf, p, length);
+ memcpy(buf, p, length);
return 0;
}
@@ -89,32 +89,32 @@ data_source_access_bytes(const gs_data_source_t * psrc, ulong start,
/* Returns gs_error_rangecheck if out of bounds. */
int
data_source_access_stream(const gs_data_source_t * psrc, ulong start,
- uint length, byte * buf, const byte ** ptr)
+ uint length, byte * buf, const byte ** ptr)
{
stream *s = psrc->data.strm;
const byte *p;
if (start >= s->position &&
- (p = start - s->position + s->cbuf) + length <=
- s->cursor.r.limit + 1
- ) {
- if (ptr)
- *ptr = p;
- else
- memcpy(buf, p, length);
+ (p = start - s->position + s->cbuf) + length <=
+ s->cursor.r.limit + 1
+ ) {
+ if (ptr)
+ *ptr = p;
+ else
+ memcpy(buf, p, length);
} else {
- uint nread;
- int code = sseek(s, start);
+ uint nread;
+ int code = sseek(s, start);
- if (code < 0)
- return_error(gs_error_rangecheck);
- code = sgets(s, buf, length, &nread);
- if (code < 0)
- return_error(gs_error_rangecheck);
- if (nread != length)
- return_error(gs_error_rangecheck);
- if (ptr)
- *ptr = buf;
+ if (code < 0)
+ return_error(gs_error_rangecheck);
+ code = sgets(s, buf, length, &nread);
+ if (code < 0)
+ return_error(gs_error_rangecheck);
+ if (nread != length)
+ return_error(gs_error_rangecheck);
+ if (ptr)
+ *ptr = buf;
}
return 0;
}
diff --git a/gs/base/gsdsrc.h b/gs/base/gsdsrc.h
index 29ccd5dc7..433f97ae8 100644
--- a/gs/base/gsdsrc.h
+++ b/gs/base/gsdsrc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ typedef struct stream_s stream;
*/
#define data_source_proc_access(proc)\
int proc(const gs_data_source_t *psrc, ulong start, uint length,\
- byte *buf, const byte **ptr)
+ byte *buf, const byte **ptr)
typedef enum {
data_source_type_string,
@@ -62,8 +62,8 @@ struct gs_data_source_s {
data_source_proc_access((*access));
gs_data_source_type_t type;
union d_ {
- gs_const_string str; /* also used for byte objects */
- stream *strm;
+ gs_const_string str; /* also used for byte objects */
+ stream *strm;
} data;
};
diff --git a/gs/base/gsequivc.c b/gs/base/gsequivc.c
index 2bfc04fcc..206260201 100644
--- a/gs/base/gsequivc.c
+++ b/gs/base/gsequivc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -103,54 +103,54 @@
#define compare_color_names(name, name_size, str, str_size) \
(name_size == str_size && \
- (strncmp((const char *)name, (const char *)str, name_size) == 0))
+ (strncmp((const char *)name, (const char *)str, name_size) == 0))
static void
update_Separation_spot_equivalent_cmyk_colors(gx_device * pdev,
- const gs_state * pgs, const gs_color_space * pcs,
- gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pparams)
+ const gs_state * pgs, const gs_color_space * pcs,
+ gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pparams)
{
int i;
- /*
+ /*
* Check if the color space's separation name matches any of the
* separations for which we need an equivalent CMYK color.
*/
for (i = 0; i < pdevn_params->separations.num_separations; i++) {
- if (pparams->color[i].color_info_valid == false) {
- const devn_separation_name * dev_sep_name =
- &(pdevn_params->separations.names[i]);
- unsigned int cs_sep_name_size;
- unsigned char * pcs_sep_name;
-
- pcs->params.separation.get_colorname_string
- (pdev->memory, pcs->params.separation.sep_name, &pcs_sep_name,
- &cs_sep_name_size);
- if (compare_color_names(dev_sep_name->data, dev_sep_name->size,
- pcs_sep_name, cs_sep_name_size)) {
- gs_color_space temp_cs = *pcs;
- gs_client_color client_color;
-
- /*
- * Create a copy of the color space and then modify it
- * to force the use of the alternate color space.
- */
- temp_cs.params.separation.use_alt_cspace = true;
- client_color.paint.values[0] = 1.0;
- capture_spot_equivalent_cmyk_colors(pdev, pgs, &client_color,
- &temp_cs, i, pparams);
- break;
- }
- }
+ if (pparams->color[i].color_info_valid == false) {
+ const devn_separation_name * dev_sep_name =
+ &(pdevn_params->separations.names[i]);
+ unsigned int cs_sep_name_size;
+ unsigned char * pcs_sep_name;
+
+ pcs->params.separation.get_colorname_string
+ (pdev->memory, pcs->params.separation.sep_name, &pcs_sep_name,
+ &cs_sep_name_size);
+ if (compare_color_names(dev_sep_name->data, dev_sep_name->size,
+ pcs_sep_name, cs_sep_name_size)) {
+ gs_color_space temp_cs = *pcs;
+ gs_client_color client_color;
+
+ /*
+ * Create a copy of the color space and then modify it
+ * to force the use of the alternate color space.
+ */
+ temp_cs.params.separation.use_alt_cspace = true;
+ client_color.paint.values[0] = 1.0;
+ capture_spot_equivalent_cmyk_colors(pdev, pgs, &client_color,
+ &temp_cs, i, pparams);
+ break;
+ }
+ }
}
}
static void
update_DeviceN_spot_equivalent_cmyk_colors(gx_device * pdev,
- const gs_state * pgs, const gs_color_space * pcs,
- gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pparams)
+ const gs_state * pgs, const gs_color_space * pcs,
+ gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pparams)
{
int i;
unsigned int j;
@@ -162,58 +162,58 @@ update_DeviceN_spot_equivalent_cmyk_colors(gx_device * pdev,
* our capture logic does not work properly. When present, the 'None'
* components contain alternate color information. However this info is
* specified as part of the 'color' and not part of the color space. Thus
- * we do not have this data when this routine is called. See the
+ * we do not have this data when this routine is called. See the
* description of DeviceN color spaces in section 4.5 of the PDF spec.
* In this situation we exit rather than produce invalid values.
*/
for (j = 0; j < pcs->params.device_n.num_components; j++) {
- pcs->params.device_n.get_colorname_string
- (pdev->memory, pcs->params.device_n.names[j],
- &pcs_sep_name, &cs_sep_name_size);
- if (compare_color_names("None", 4, pcs_sep_name, cs_sep_name_size))
- return;
+ pcs->params.device_n.get_colorname_string
+ (pdev->memory, pcs->params.device_n.names[j],
+ &pcs_sep_name, &cs_sep_name_size);
+ if (compare_color_names("None", 4, pcs_sep_name, cs_sep_name_size))
+ return;
}
- /*
+ /*
* Check if the color space's separation names matches any of the
* separations for which we need an equivalent CMYK color.
*/
for (i = 0; i < pdevn_params->separations.num_separations; i++) {
- if (pparams->color[i].color_info_valid == false) {
- const devn_separation_name * dev_sep_name =
- &(pdevn_params->separations.names[i]);
-
- for (j = 0; j < pcs->params.device_n.num_components; j++) {
- pcs->params.device_n.get_colorname_string
- (pdev->memory, pcs->params.device_n.names[j], &pcs_sep_name,
- &cs_sep_name_size);
- if (compare_color_names(dev_sep_name->data, dev_sep_name->size,
- pcs_sep_name, cs_sep_name_size)) {
- gs_color_space temp_cs = *pcs;
- gs_client_color client_color;
-
- /*
- * Create a copy of the color space and then modify it
- * to force the use of the alternate color space.
- */
- memset(&client_color, 0, sizeof(client_color));
- temp_cs.params.device_n.use_alt_cspace = true;
- client_color.paint.values[j] = 1.0;
- capture_spot_equivalent_cmyk_colors(pdev, pgs, &client_color,
- &temp_cs, i, pparams);
- break;
- }
- }
- }
+ if (pparams->color[i].color_info_valid == false) {
+ const devn_separation_name * dev_sep_name =
+ &(pdevn_params->separations.names[i]);
+
+ for (j = 0; j < pcs->params.device_n.num_components; j++) {
+ pcs->params.device_n.get_colorname_string
+ (pdev->memory, pcs->params.device_n.names[j], &pcs_sep_name,
+ &cs_sep_name_size);
+ if (compare_color_names(dev_sep_name->data, dev_sep_name->size,
+ pcs_sep_name, cs_sep_name_size)) {
+ gs_color_space temp_cs = *pcs;
+ gs_client_color client_color;
+
+ /*
+ * Create a copy of the color space and then modify it
+ * to force the use of the alternate color space.
+ */
+ memset(&client_color, 0, sizeof(client_color));
+ temp_cs.params.device_n.use_alt_cspace = true;
+ client_color.paint.values[j] = 1.0;
+ capture_spot_equivalent_cmyk_colors(pdev, pgs, &client_color,
+ &temp_cs, i, pparams);
+ break;
+ }
+ }
+ }
}
}
static bool check_all_colors_known(int num_spot,
- equivalent_cmyk_color_params * pparams)
+ equivalent_cmyk_color_params * pparams)
{
for (num_spot--; num_spot >= 0; num_spot--)
- if (pparams->color[num_spot].color_info_valid == false)
- return false;
+ if (pparams->color[num_spot].color_info_valid == false)
+ return false;
return true;
}
@@ -226,12 +226,12 @@ update_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_state * pgs,
/* If all of the color_info is valid then there is nothing to do. */
if (pparams->all_color_info_valid)
- return;
+ return;
/* Verify that we really have some separations. */
if (pdevn_params->separations.num_separations == 0) {
- pparams->all_color_info_valid = true;
- return;
+ pparams->all_color_info_valid = true;
+ return;
}
/*
* Verify that the given color space is a Separation or a DeviceN color
@@ -240,24 +240,24 @@ update_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_state * pgs,
*/
pcs = gs_currentcolorspace_inline(pgs);
if (pcs != NULL) {
- if (pcs->type->index == gs_color_space_index_Separation) {
- update_Separation_spot_equivalent_cmyk_colors(pdev, pgs, pcs,
- pdevn_params, pparams);
- pparams->all_color_info_valid = check_all_colors_known
- (pdevn_params->separations.num_separations, pparams);
- }
- else if (pcs->type->index == gs_color_space_index_DeviceN) {
- update_DeviceN_spot_equivalent_cmyk_colors(pdev, pgs, pcs,
- pdevn_params, pparams);
- pparams->all_color_info_valid = check_all_colors_known
- (pdevn_params->separations.num_separations, pparams);
- }
+ if (pcs->type->index == gs_color_space_index_Separation) {
+ update_Separation_spot_equivalent_cmyk_colors(pdev, pgs, pcs,
+ pdevn_params, pparams);
+ pparams->all_color_info_valid = check_all_colors_known
+ (pdevn_params->separations.num_separations, pparams);
+ }
+ else if (pcs->type->index == gs_color_space_index_DeviceN) {
+ update_DeviceN_spot_equivalent_cmyk_colors(pdev, pgs, pcs,
+ pdevn_params, pparams);
+ pparams->all_color_info_valid = check_all_colors_known
+ (pdevn_params->separations.num_separations, pparams);
+ }
}
}
static void
save_spot_equivalent_cmyk_color(int sep_num,
- equivalent_cmyk_color_params * pparams, frac cmyk[4])
+ equivalent_cmyk_color_params * pparams, frac cmyk[4])
{
pparams->color[sep_num].c = cmyk[0];
pparams->color[sep_num].m = cmyk[1];
@@ -291,8 +291,8 @@ static cmap_proc_separation(cmap_separation_capture_cmyk_color);
static cmap_proc_devicen(cmap_devicen_capture_cmyk_color);
static const gx_color_map_procs cmap_capture_cmyk_color = {
- cmap_gray_capture_cmyk_color,
- cmap_rgb_capture_cmyk_color,
+ cmap_gray_capture_cmyk_color,
+ cmap_rgb_capture_cmyk_color,
cmap_cmyk_capture_cmyk_color,
cmap_rgb_alpha_capture_cmyk_color,
cmap_separation_capture_cmyk_color,
@@ -301,10 +301,10 @@ static const gx_color_map_procs cmap_capture_cmyk_color = {
static void
cmap_gray_capture_cmyk_color(frac gray, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
equivalent_cmyk_color_params * pparams =
- ((color_capture_device *)dev)->pequiv_cmyk_colors;
+ ((color_capture_device *)dev)->pequiv_cmyk_colors;
int sep_num = ((color_capture_device *)dev)->sep_num;
frac cmyk[4];
@@ -318,7 +318,7 @@ cmap_rgb_capture_cmyk_color(frac r, frac g, frac b, gx_device_color * pdc,
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
equivalent_cmyk_color_params * pparams =
- ((color_capture_device *)dev)->pequiv_cmyk_colors;
+ ((color_capture_device *)dev)->pequiv_cmyk_colors;
int sep_num = ((color_capture_device *)dev)->sep_num;
frac cmyk[4];
@@ -331,7 +331,7 @@ cmap_cmyk_capture_cmyk_color(frac c, frac m, frac y, frac k, gx_device_color * p
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
equivalent_cmyk_color_params * pparams =
- ((color_capture_device *)dev)->pequiv_cmyk_colors;
+ ((color_capture_device *)dev)->pequiv_cmyk_colors;
int sep_num = ((color_capture_device *)dev)->sep_num;
frac cmyk[4];
@@ -344,8 +344,8 @@ cmap_cmyk_capture_cmyk_color(frac c, frac m, frac y, frac k, gx_device_color * p
static void
cmap_rgb_alpha_capture_cmyk_color(frac r, frac g, frac b, frac alpha,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
cmap_rgb_capture_cmyk_color(r, g, b, pdc, pis, dev, select);
}
@@ -400,5 +400,5 @@ capture_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_state * pgs,
/* Now capture the color */
pcs->type->remap_color (pcc, pcs, &dev_color, &temp_state,
- (gx_device *)&temp_device, gs_color_select_texture);
+ (gx_device *)&temp_device, gs_color_select_texture);
}
diff --git a/gs/base/gsequivc.h b/gs/base/gsequivc.h
index 95616fbaf..097c5e137 100644
--- a/gs/base/gsequivc.h
+++ b/gs/base/gsequivc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,16 +43,16 @@ typedef struct equivalent_cmyk_color_params_s {
* If possible, update the equivalent CMYK color for spot colors.
*/
void update_spot_equivalent_cmyk_colors(gx_device * pdev,
- const gs_state * pgs, gs_devn_params * pdevn_params,
- equivalent_cmyk_color_params * pparams);
+ const gs_state * pgs, gs_devn_params * pdevn_params,
+ equivalent_cmyk_color_params * pparams);
/*
* Utiliy routine: Capture equivalent color when given a modified
* color space.
*/
void capture_spot_equivalent_cmyk_colors(gx_device * pdev,
- const gs_state * pgs, const gs_client_color * pcc,
- const gs_color_space * pcs, int sep_num,
- equivalent_cmyk_color_params * pparams);
+ const gs_state * pgs, const gs_client_color * pcc,
+ const gs_color_space * pcs, int sep_num,
+ equivalent_cmyk_color_params * pparams);
#endif /* define gsequivc_INCLUDED */
diff --git a/gs/base/gserror.h b/gs/base/gserror.h
index 4154fdb15..f38eec695 100644
--- a/gs/base/gserror.h
+++ b/gs/base/gserror.h
@@ -55,8 +55,6 @@ const char *gs_errstr(int code);
int gs_throw_imp(const char *func, const char *file, int line,
int op, int code, const char *fmt, ...) __printflike(6, 7);
-
-
/* Use throw at origin of error
*/
#define gs_throw_code(code) \
@@ -83,7 +81,6 @@ int gs_throw_imp(const char *func, const char *file, int line,
#define gs_throw9(code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
gs_throw_imp(__func__, __FILE__, __LINE__, 0, code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
-
/* Bubble the code up the stack
*/
#define gs_rethrow_code(code) \
@@ -110,8 +107,6 @@ int gs_throw_imp(const char *func, const char *file, int line,
#define gs_rethrow9(code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
gs_throw_imp(__func__, __FILE__, __LINE__, 1, code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
-
-
/* This will cause trouble, as it implies you are fixing an error
* the system will spew messages
*/
@@ -136,7 +131,6 @@ int gs_throw_imp(const char *func, const char *file, int line,
#define gs_catch9(code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
gs_throw_imp(__func__, __FILE__, __LINE__, 2, code, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
-
/* gs_warn is a printf
*/
#define gs_warn(fmt) \
@@ -160,7 +154,6 @@ int gs_throw_imp(const char *func, const char *file, int line,
#define gs_warn9(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
(void)gs_throw_imp(__func__, __FILE__, __LINE__, 3, 0, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)
-
/* just in case you don't know 0 means no error
* other return codes are errors.
*/
diff --git a/gs/base/gserrors.h b/gs/base/gserrors.h
index 8780878fc..10c046b53 100644
--- a/gs/base/gserrors.h
+++ b/gs/base/gserrors.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsexit.h b/gs/base/gsexit.h
index 0e850985d..b10b4b64c 100644
--- a/gs/base/gsexit.h
+++ b/gs/base/gsexit.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,7 +17,6 @@
#ifndef gsexit_INCLUDED
# define gsexit_INCLUDED
-
/** The client must provide this.
* normally they do exit cleanup and error messaging
* without calling system exit() returning to the caller.
@@ -29,7 +28,7 @@ int gs_to_exit(const gs_memory_t *mem, int exit_status);
*/
int gs_to_exit_with_code(const gs_memory_t *mem, int exit_status, int code);
-/** The client must provide this.
+/** The client must provide this.
* After possible cleanup it may call gp_do_exit() which calls exit() in a platform
* independent way. This is a fatal error so returning is not a good idea.
*/
diff --git a/gs/base/gsfcid.c b/gs/base/gsfcid.c
index d172829f1..becfb4c69 100644
--- a/gs/base/gsfcid.c
+++ b/gs/base/gsfcid.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,8 +32,8 @@ ENUM_PTRS_WITH(font_cid0_enum_ptrs, gs_font_cid0 *pfcid0)
{
index -= 2;
if (index < st_gs_font_cid_data_num_ptrs)
- return ENUM_USING(st_gs_font_cid_data, &pfcid0->cidata.common,
- sizeof(gs_font_cid_data), index);
+ return ENUM_USING(st_gs_font_cid_data, &pfcid0->cidata.common,
+ sizeof(gs_font_cid_data), index);
ENUM_PREFIX(st_gs_font_base, st_gs_font_cid_data_num_ptrs);
}
ENUM_PTR(0, gs_font_cid0, cidata.FDArray);
@@ -43,7 +43,7 @@ static
RELOC_PTRS_WITH(font_cid0_reloc_ptrs, gs_font_cid0 *pfcid0);
RELOC_PREFIX(st_gs_font_base);
RELOC_USING(st_gs_font_cid_data, &pfcid0->cidata.common,
- sizeof(st_gs_font_cid_data));
+ sizeof(st_gs_font_cid_data));
RELOC_VAR(pfcid0->cidata.FDArray);
RELOC_VAR(pfcid0->cidata.proc_data);
RELOC_PTRS_END
@@ -52,8 +52,8 @@ static
ENUM_PTRS_WITH(font_cid1_enum_ptrs, gs_font_cid1 *pfcid1)
{
if (index < st_cid_system_info_num_ptrs)
- return ENUM_USING(st_cid_system_info, &pfcid1->cidata.CIDSystemInfo,
- sizeof(st_cid_system_info), index);
+ return ENUM_USING(st_cid_system_info, &pfcid1->cidata.CIDSystemInfo,
+ sizeof(st_cid_system_info), index);
ENUM_PREFIX(st_gs_font_base, st_cid_system_info_num_ptrs);
}
ENUM_PTRS_END
@@ -61,17 +61,17 @@ static
RELOC_PTRS_WITH(font_cid1_reloc_ptrs, gs_font_cid1 *pfcid1);
RELOC_PREFIX(st_gs_font_base);
RELOC_USING(st_cid_system_info, &pfcid1->cidata.CIDSystemInfo,
- sizeof(st_cid_system_info));
+ sizeof(st_cid_system_info));
RELOC_PTRS_END
public_st_gs_font_cid2();
static
ENUM_PTRS_WITH(font_cid2_enum_ptrs, gs_font_cid2 *pfcid2)
{
if (index < st_gs_font_cid2_own_ptrs)
- ENUM_PTR(0, gs_font_cid2, subst_CID_on_WMode);
+ ENUM_PTR(0, gs_font_cid2, subst_CID_on_WMode);
if (index < st_gs_font_cid_data_num_ptrs + st_gs_font_cid2_own_ptrs)
- return ENUM_USING(st_gs_font_cid_data, &pfcid2->cidata.common,
- sizeof(gs_font_cid_data), index - st_gs_font_cid2_own_ptrs);
+ return ENUM_USING(st_gs_font_cid_data, &pfcid2->cidata.common,
+ sizeof(gs_font_cid_data), index - st_gs_font_cid2_own_ptrs);
ENUM_PREFIX(st_gs_font_type42, st_gs_font_cid_data_num_ptrs + st_gs_font_cid2_own_ptrs);
}
ENUM_PTRS_END
@@ -79,7 +79,7 @@ static
RELOC_PTRS_WITH(font_cid2_reloc_ptrs, gs_font_cid2 *pfcid2);
RELOC_PREFIX(st_gs_font_type42);
RELOC_USING(st_gs_font_cid_data, &pfcid2->cidata.common,
- sizeof(st_gs_font_cid_data));
+ sizeof(st_gs_font_cid_data));
RELOC_VAR(pfcid2->subst_CID_on_WMode);
RELOC_PTRS_END
@@ -130,7 +130,7 @@ bool
cid_system_info_is_null(const gs_cid_system_info_t *pcidsi)
{
return (pcidsi->Registry.size == 0 && pcidsi->Ordering.size == 0 &&
- pcidsi->Supplement == 0);
+ pcidsi->Supplement == 0);
}
/*
@@ -142,35 +142,35 @@ gs_font_cid_system_info(const gs_font *pfont)
{
switch (pfont->FontType) {
case ft_CID_encrypted:
- return &((const gs_font_cid0 *)pfont)->cidata.common.CIDSystemInfo;
+ return &((const gs_font_cid0 *)pfont)->cidata.common.CIDSystemInfo;
case ft_CID_user_defined:
- return &((const gs_font_cid1 *)pfont)->cidata.CIDSystemInfo;
+ return &((const gs_font_cid1 *)pfont)->cidata.CIDSystemInfo;
case ft_CID_TrueType:
- return &((const gs_font_cid2 *)pfont)->cidata.common.CIDSystemInfo;
+ return &((const gs_font_cid2 *)pfont)->cidata.common.CIDSystemInfo;
default:
- return 0;
+ return 0;
}
}
/*
* Check CIDSystemInfo compatibility.
*/
-bool
-gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
- const gs_cid_system_info_t *info1)
+bool
+gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
+ const gs_cid_system_info_t *info1)
{
if (info0 == NULL || info1 == NULL)
- return false;
+ return false;
if (info0->Registry.size != info1->Registry.size)
- return false;
+ return false;
if (info0->Ordering.size != info1->Ordering.size)
- return false;
- if (memcmp(info0->Registry.data, info1->Registry.data,
- info0->Registry.size))
- return false;
+ return false;
+ if (memcmp(info0->Registry.data, info1->Registry.data,
+ info0->Registry.size))
+ return false;
if (memcmp(info0->Ordering.data, info1->Ordering.data,
- info0->Ordering.size))
- return false;
+ info0->Ordering.size))
+ return false;
return true;
}
@@ -181,25 +181,25 @@ gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph); /* check prototype */
int
gs_font_cid0_enumerate_glyph(gs_font *font, int *pindex,
- gs_glyph_space_t ignore_glyph_space,
- gs_glyph *pglyph)
+ gs_glyph_space_t ignore_glyph_space,
+ gs_glyph *pglyph)
{
gs_font_cid0 *const pfont = (gs_font_cid0 *)font;
while (*pindex < pfont->cidata.common.CIDCount) {
- gs_glyph_data_t gdata;
- int fidx;
- gs_glyph glyph = (gs_glyph)(gs_min_cid_glyph + (*pindex)++);
- int code;
-
- gdata.memory = pfont->memory;
- code = pfont->cidata.glyph_data((gs_font_base *)pfont, glyph,
- &gdata, &fidx);
- if (code < 0 || gdata.bits.size == 0)
- continue;
- *pglyph = glyph;
- gs_glyph_data_free(&gdata, "gs_font_cid0_enumerate_glyphs");
- return 0;
+ gs_glyph_data_t gdata;
+ int fidx;
+ gs_glyph glyph = (gs_glyph)(gs_min_cid_glyph + (*pindex)++);
+ int code;
+
+ gdata.memory = pfont->memory;
+ code = pfont->cidata.glyph_data((gs_font_base *)pfont, glyph,
+ &gdata, &fidx);
+ if (code < 0 || gdata.bits.size == 0)
+ continue;
+ *pglyph = glyph;
+ gs_glyph_data_free(&gdata, "gs_font_cid0_enumerate_glyphs");
+ return 0;
}
*pindex = 0;
return 0;
@@ -212,7 +212,7 @@ gs_cid0_indexed_font(const gs_font *font, int fidx)
gs_font_cid0 *const pfont = (gs_font_cid0 *)font;
if (font->FontType != ft_CID_encrypted) {
- emprintf1(font->memory,
+ emprintf1(font->memory,
"Unexpected font type: %d\n",
font->FontType);
return 0;
@@ -228,13 +228,13 @@ gs_cid0_has_type2(const gs_font *font)
int i;
if (font->FontType != ft_CID_encrypted) {
- emprintf1(font->memory,
+ emprintf1(font->memory,
"Unexpected font type: %d\n",
font->FontType);
return false;
}
for (i = 0; i < pfont->cidata.FDArray_size; i++)
- if (((const gs_font *)pfont->cidata.FDArray[i])->FontType == ft_encrypted2)
- return true;
+ if (((const gs_font *)pfont->cidata.FDArray[i])->FontType == ft_encrypted2)
+ return true;
return false;
}
diff --git a/gs/base/gsfcid2.c b/gs/base/gsfcid2.c
index 73e48427d..19cb2cd3f 100644
--- a/gs/base/gsfcid2.c
+++ b/gs/base/gsfcid2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,19 +32,19 @@ identity_CIDMap_proc(gs_font_cid2 *pfont, gs_glyph glyph)
ulong cid = glyph - gs_min_cid_glyph;
if (cid >= pfont->cidata.common.CIDCount)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return (int)cid;
}
int
gs_font_cid2_from_type42(gs_font_cid2 **ppfcid, gs_font_type42 *pfont42,
- int wmode, gs_memory_t *mem)
+ int wmode, gs_memory_t *mem)
{
gs_font_cid2 *pfcid =
- gs_alloc_struct(mem, gs_font_cid2, &st_gs_font_cid2,
- "gs_font_cid2_from_type42");
+ gs_alloc_struct(mem, gs_font_cid2, &st_gs_font_cid2,
+ "gs_font_cid2_from_type42");
if (pfcid == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* CIDFontType 2 is a subclass (extension) of FontType 42. */
memcpy(pfcid, pfont42, sizeof(*pfont42));
@@ -89,12 +89,12 @@ gs_private_st_suffix_add1(st_cmap_tt_16bit_format4, gs_cmap_tt_16bit_format4_t,
static int
tt_16bit_format4_decode_next(const gs_cmap_t * pcmap_in,
- const gs_const_string * pstr,
- uint * pindex, uint * pfidx,
- gs_char * pchr, gs_glyph * pglyph)
+ const gs_const_string * pstr,
+ uint * pindex, uint * pfidx,
+ gs_char * pchr, gs_glyph * pglyph)
{
const gs_cmap_tt_16bit_format4_t *pcmap =
- (const gs_cmap_tt_16bit_format4_t *)pcmap_in;
+ (const gs_cmap_tt_16bit_format4_t *)pcmap_in;
gs_font_type42 *pfont = pcmap->font;
byte ttdata[2];
int code;
@@ -102,36 +102,36 @@ tt_16bit_format4_decode_next(const gs_cmap_t * pcmap_in,
uint segment2;
if (pstr->size < *pindex + 2) {
- *pglyph = gs_no_glyph;
- return (*pindex == pstr->size ? 2 : -1);
+ *pglyph = gs_no_glyph;
+ return (*pindex == pstr->size ? 2 : -1);
}
chr = U16(pstr->data + *pindex);
/* The table is sorted, but we use linear search for simplicity. */
for (segment2 = 0; segment2 < pcmap->segCount2; segment2 += 2) {
- uint start, delta, roff;
+ uint start, delta, roff;
- READ_SFNTS(pfont, pcmap->endCount + segment2, 2, ttdata);
- if (chr > U16(ttdata))
- continue;
- READ_SFNTS(pfont, pcmap->startCount + segment2, 2, ttdata);
- start = U16(ttdata);
- if (chr < start)
- continue;
- READ_SFNTS(pfont, pcmap->idDelta + segment2, 2, ttdata);
- delta = U16(ttdata);
- READ_SFNTS(pfont, pcmap->idRangeOffset + segment2, 2, ttdata);
- roff = U16(ttdata);
- if (roff) {
- ulong gidoff = pcmap->idRangeOffset + segment2 + roff +
- (chr - start) * 2;
+ READ_SFNTS(pfont, pcmap->endCount + segment2, 2, ttdata);
+ if (chr > U16(ttdata))
+ continue;
+ READ_SFNTS(pfont, pcmap->startCount + segment2, 2, ttdata);
+ start = U16(ttdata);
+ if (chr < start)
+ continue;
+ READ_SFNTS(pfont, pcmap->idDelta + segment2, 2, ttdata);
+ delta = U16(ttdata);
+ READ_SFNTS(pfont, pcmap->idRangeOffset + segment2, 2, ttdata);
+ roff = U16(ttdata);
+ if (roff) {
+ ulong gidoff = pcmap->idRangeOffset + segment2 + roff +
+ (chr - start) * 2;
- READ_SFNTS(pfont, gidoff, 2, ttdata);
- value = U16(ttdata);
- if (value != 0)
- value += delta;
- } else
- value = chr + delta;
- break;
+ READ_SFNTS(pfont, gidoff, 2, ttdata);
+ value = U16(ttdata);
+ if (value != 0)
+ value += delta;
+ } else
+ value = chr + delta;
+ break;
}
*pglyph = gs_min_cid_glyph + (value & 0xffff);
*pchr = chr;
@@ -144,11 +144,11 @@ tt_16bit_format4_next_range(gs_cmap_ranges_enum_t *penum)
{
/* There is just a single 2-byte range. */
if (penum->index == 0) {
- penum->range.first[0] = penum->range.first[1] = 0;
- penum->range.last[0] = penum->range.last[1] = 0xff;
- penum->range.size = 2;
- penum->index = 1;
- return 0;
+ penum->range.first[0] = penum->range.first[1] = 0;
+ penum->range.last[0] = penum->range.last[1] = 0xff;
+ penum->range.size = 2;
+ penum->index = 1;
+ return 0;
}
return 1;
}
@@ -157,7 +157,7 @@ static const gs_cmap_ranges_enum_procs_t tt_16bit_format4_range_procs = {
};
static void
tt_16bit_format4_enum_ranges(const gs_cmap_t *pcmap,
- gs_cmap_ranges_enum_t *pre)
+ gs_cmap_ranges_enum_t *pre)
{
gs_cmap_ranges_enum_setup(pre, pcmap, &tt_16bit_format4_range_procs);
}
@@ -165,13 +165,13 @@ static int
tt_16bit_format4_next_lookup(gs_cmap_lookups_enum_t *penum)
{
if (penum->index[0] == 0) {
- penum->entry.key_size = 2;
- penum->entry.key_is_range = true;
- penum->entry.value_type = CODE_VALUE_CID;
- penum->entry.value.size = 2;
- penum->entry.font_index = 0;
- penum->index[0] = 1;
- return 0;
+ penum->entry.key_size = 2;
+ penum->entry.key_is_range = true;
+ penum->entry.value_type = CODE_VALUE_CID;
+ penum->entry.value.size = 2;
+ penum->entry.font_index = 0;
+ penum->index[0] = 1;
+ return 0;
}
return 1;
}
@@ -182,7 +182,7 @@ tt_16bit_format4_next_entry(gs_cmap_lookups_enum_t *penum)
uint segment2 = penum->index[1] >> 16;
uint next = penum->index[1] & 0xffff;
const gs_cmap_tt_16bit_format4_t *pcmap =
- (const gs_cmap_tt_16bit_format4_t *)penum->cmap;
+ (const gs_cmap_tt_16bit_format4_t *)penum->cmap;
gs_font_type42 *pfont = pcmap->font;
byte ttdata[2];
int code;
@@ -191,35 +191,35 @@ tt_16bit_format4_next_entry(gs_cmap_lookups_enum_t *penum)
top:
if (segment2 >= pcmap->segCount2)
- return 1;
+ return 1;
READ_SFNTS(pfont, pcmap->endCount + segment2, 2, ttdata);
end = U16(ttdata);
if (next > end) {
- segment2 += 2;
- goto top;
+ segment2 += 2;
+ goto top;
}
READ_SFNTS(pfont, pcmap->startCount + segment2, 2, ttdata);
start = U16(ttdata);
if (next < start)
- next = start;
+ next = start;
PUT16(penum->entry.key[0], next);
READ_SFNTS(pfont, pcmap->idDelta + segment2, 2, ttdata);
delta = U16(ttdata);
READ_SFNTS(pfont, pcmap->idRangeOffset + segment2, 2, ttdata);
roff = U16(ttdata);
if (roff) {
- /* Non-zero offset, table lookup. */
- ulong gidoff = pcmap->idRangeOffset + segment2 + roff;
+ /* Non-zero offset, table lookup. */
+ ulong gidoff = pcmap->idRangeOffset + segment2 + roff;
- READ_SFNTS(pfont, gidoff, 2, ttdata);
- value = U16(ttdata);
- if (value != 0)
- value += delta;
- ++next;
+ READ_SFNTS(pfont, gidoff, 2, ttdata);
+ value = U16(ttdata);
+ if (value != 0)
+ value += delta;
+ ++next;
} else {
- /* Zero offset, account for high-order byte changes. */
- value = next + delta;
- next = min(end, (next | 0xff)) + 1;
+ /* Zero offset, account for high-order byte changes. */
+ value = next + delta;
+ next = min(end, (next | 0xff)) + 1;
}
PUT16(penum->entry.key[1], next - 1);
PUT16(penum->temp_value, value);
@@ -233,11 +233,11 @@ static const gs_cmap_lookups_enum_procs_t tt_16bit_format4_lookup_procs = {
};
static void
tt_16bit_format4_enum_lookups(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *pre)
+ gs_cmap_lookups_enum_t *pre)
{
gs_cmap_lookups_enum_setup(pre, pcmap,
- (which ? &gs_cmap_no_lookups_procs :
- &tt_16bit_format4_lookup_procs));
+ (which ? &gs_cmap_no_lookups_procs :
+ &tt_16bit_format4_lookup_procs));
}
static const gs_cmap_procs_t tt_16bit_format4_procs = {
@@ -252,7 +252,7 @@ static const gs_cmap_procs_t tt_16bit_format4_procs = {
*/
int
gs_cmap_from_type42_cmap(gs_cmap_t **ppcmap, gs_font_type42 *pfont,
- int wmode, gs_memory_t *mem)
+ int wmode, gs_memory_t *mem)
{
ulong origin = pfont->data.cmap;
gs_cmap_tt_16bit_format4_t *pcmap;
@@ -262,47 +262,47 @@ gs_cmap_from_type42_cmap(gs_cmap_t **ppcmap, gs_font_type42 *pfont,
uint segCount2;
if (origin == 0)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
/*
* Find the desired cmap sub-table, if any.
*/
{
- uint cmap_count;
- uint i;
-
- READ_SFNTS(pfont, origin + 2, 2, ttdata);
- cmap_count = U16(ttdata);
- for (i = 0; i < cmap_count; ++i) {
- READ_SFNTS(pfont, origin + 4 + i * 8, 8, ttdata);
- if (U16(ttdata) != 3 || /* platform ID */
- U16(ttdata + 2) != 1 /* encoding ID */
- )
- continue;
- offset = origin + U32(ttdata + 4);
- READ_SFNTS(pfont, offset, 2, ttdata);
- if (U16(ttdata) != 4 /* format */)
- continue;
- break;
- }
- if (i >= cmap_count) /* not found */
- return_error(gs_error_invalidfont);
- READ_SFNTS(pfont, offset + 6, 2, ttdata);
- segCount2 = U16(ttdata);
+ uint cmap_count;
+ uint i;
+
+ READ_SFNTS(pfont, origin + 2, 2, ttdata);
+ cmap_count = U16(ttdata);
+ for (i = 0; i < cmap_count; ++i) {
+ READ_SFNTS(pfont, origin + 4 + i * 8, 8, ttdata);
+ if (U16(ttdata) != 3 || /* platform ID */
+ U16(ttdata + 2) != 1 /* encoding ID */
+ )
+ continue;
+ offset = origin + U32(ttdata + 4);
+ READ_SFNTS(pfont, offset, 2, ttdata);
+ if (U16(ttdata) != 4 /* format */)
+ continue;
+ break;
+ }
+ if (i >= cmap_count) /* not found */
+ return_error(gs_error_invalidfont);
+ READ_SFNTS(pfont, offset + 6, 2, ttdata);
+ segCount2 = U16(ttdata);
}
/* Allocate the CMap. */
{
- static const gs_cid_system_info_t null_cidsi = {
- { (const byte*) "none", 4 },
- { (const byte*) "none", 4 },
- 0
- };
- code = gs_cmap_alloc(ppcmap, &st_cmap_tt_16bit_format4, wmode,
- (const byte *)"none", 4, &null_cidsi, 1,
- &tt_16bit_format4_procs, mem);
- if (code < 0)
- return code;
+ static const gs_cid_system_info_t null_cidsi = {
+ { (const byte*) "none", 4 },
+ { (const byte*) "none", 4 },
+ 0
+ };
+ code = gs_cmap_alloc(ppcmap, &st_cmap_tt_16bit_format4, wmode,
+ (const byte *)"none", 4, &null_cidsi, 1,
+ &tt_16bit_format4_procs, mem);
+ if (code < 0)
+ return code;
}
pcmap = (gs_cmap_tt_16bit_format4_t *)*ppcmap;
pcmap->from_Unicode = true;
diff --git a/gs/base/gsfcmap.c b/gs/base/gsfcmap.c
index 4e98ff117..fbdfc43a6 100644
--- a/gs/base/gsfcmap.c
+++ b/gs/base/gsfcmap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,8 +31,8 @@ typedef struct gs_cmap_identity_s {
/* GC descriptors */
public_st_cmap();
gs_private_st_suffix_add0_local(st_cmap_identity, gs_cmap_identity_t,
- "gs_cmap_identity_t", cmap_ptrs, cmap_data,
- st_cmap);
+ "gs_cmap_identity_t", cmap_ptrs, cmap_data,
+ st_cmap);
/* ---------------- Client procedures ---------------- */
@@ -48,22 +48,22 @@ get_integer_bytes(const byte *src, int count)
int i;
for (i = 0; i < count; ++i)
- v = (v << 8) + src[i];
+ v = (v << 8) + src[i];
return v;
}
static int
identity_decode_next(const gs_cmap_t *pcmap, const gs_const_string *str,
- uint *pindex, uint *pfidx,
- gs_char *pchr, gs_glyph *pglyph)
+ uint *pindex, uint *pfidx,
+ gs_char *pchr, gs_glyph *pglyph)
{
const gs_cmap_identity_t *const pcimap =
- (const gs_cmap_identity_t *)pcmap;
+ (const gs_cmap_identity_t *)pcmap;
int num_bytes = pcimap->num_bytes;
uint value;
if (str->size < *pindex + num_bytes) {
- *pglyph = gs_no_glyph;
- return (*pindex == str->size ? 2 : -1);
+ *pglyph = gs_no_glyph;
+ return (*pindex == str->size ? 2 : -1);
}
value = get_integer_bytes(str->data + *pindex, num_bytes);
*pglyph = gs_min_cid_glyph + value;
@@ -76,14 +76,14 @@ static int
identity_next_range(gs_cmap_ranges_enum_t *penum)
{
if (penum->index == 0) {
- const gs_cmap_identity_t *const pcimap =
- (const gs_cmap_identity_t *)penum->cmap;
-
- memset(penum->range.first, 0, pcimap->num_bytes);
- memset(penum->range.last, 0xff, pcimap->num_bytes);
- penum->range.size = pcimap->num_bytes;
- penum->index = 1;
- return 0;
+ const gs_cmap_identity_t *const pcimap =
+ (const gs_cmap_identity_t *)penum->cmap;
+
+ memset(penum->range.first, 0, pcimap->num_bytes);
+ memset(penum->range.last, 0xff, pcimap->num_bytes);
+ penum->range.size = pcimap->num_bytes;
+ penum->index = 1;
+ return 0;
}
return 1;
}
@@ -99,21 +99,21 @@ static int
identity_next_lookup(gs_cmap_lookups_enum_t *penum)
{
if (penum->index[0] == 0) {
- const gs_cmap_identity_t *const pcimap =
- (const gs_cmap_identity_t *)penum->cmap;
- int num_bytes = pcimap->num_bytes;
-
- memset(penum->entry.key[0], 0, num_bytes);
- memset(penum->entry.key[1], 0xff, num_bytes);
- memset(penum->entry.key[1], 0, num_bytes - pcimap->varying_bytes);
- penum->entry.key_size = num_bytes;
- penum->entry.key_is_range = true;
- penum->entry.value_type =
- (pcimap->code ? CODE_VALUE_CHARS : CODE_VALUE_CID);
- penum->entry.value.size = num_bytes;
- penum->entry.font_index = 0;
- penum->index[0] = 1;
- return 0;
+ const gs_cmap_identity_t *const pcimap =
+ (const gs_cmap_identity_t *)penum->cmap;
+ int num_bytes = pcimap->num_bytes;
+
+ memset(penum->entry.key[0], 0, num_bytes);
+ memset(penum->entry.key[1], 0xff, num_bytes);
+ memset(penum->entry.key[1], 0, num_bytes - pcimap->varying_bytes);
+ penum->entry.key_size = num_bytes;
+ penum->entry.key_is_range = true;
+ penum->entry.value_type =
+ (pcimap->code ? CODE_VALUE_CHARS : CODE_VALUE_CID);
+ penum->entry.value.size = num_bytes;
+ penum->entry.font_index = 0;
+ penum->index[0] = 1;
+ return 0;
}
return 1;
}
@@ -126,17 +126,17 @@ static int
identity_next_entry(gs_cmap_lookups_enum_t *penum)
{
const gs_cmap_identity_t *const pcimap =
- (const gs_cmap_identity_t *)penum->cmap;
+ (const gs_cmap_identity_t *)penum->cmap;
int num_bytes = pcimap->num_bytes;
int i = num_bytes - pcimap->varying_bytes;
memcpy(penum->temp_value, penum->entry.key[0], num_bytes);
memcpy(penum->entry.key[0], penum->entry.key[1], i);
while (--i >= 0)
- if (++(penum->entry.key[1][i]) != 0) {
- penum->entry.value.data = penum->temp_value;
- return 0;
- }
+ if (++(penum->entry.key[1][i]) != 0) {
+ penum->entry.value.data = penum->temp_value;
+ return 0;
+ }
return 1;
}
@@ -148,11 +148,11 @@ const gs_cmap_lookups_enum_procs_t gs_cmap_no_lookups_procs = {
};
static void
identity_enum_lookups(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *pre)
+ gs_cmap_lookups_enum_t *pre)
{
gs_cmap_lookups_enum_setup(pre, pcmap,
- (which ? &gs_cmap_no_lookups_procs :
- &identity_lookup_procs));
+ (which ? &gs_cmap_no_lookups_procs :
+ &identity_lookup_procs));
}
static bool
identity_is_identity(const gs_cmap_t *pcmap, int font_index_only)
@@ -166,8 +166,8 @@ static const gs_cmap_procs_t identity_procs = {
static int
gs_cmap_identity_alloc(gs_cmap_t **ppcmap, int num_bytes, int varying_bytes,
- int return_code, const char *cmap_name, int wmode,
- gs_memory_t *mem)
+ int return_code, const char *cmap_name, int wmode,
+ gs_memory_t *mem)
{
/*
* We could allow any value of num_bytes between 1 and
@@ -175,20 +175,20 @@ gs_cmap_identity_alloc(gs_cmap_t **ppcmap, int num_bytes, int varying_bytes,
* the result "Identity-[HV]".
*/
static const gs_cid_system_info_t identity_cidsi = {
- { (const byte *)"Adobe", 5 },
- { (const byte *)"Identity", 8 },
- 0
+ { (const byte *)"Adobe", 5 },
+ { (const byte *)"Identity", 8 },
+ 0
};
int code;
gs_cmap_identity_t *pcimap;
if (num_bytes != 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = gs_cmap_alloc(ppcmap, &st_cmap_identity, wmode,
- (const byte *)cmap_name, strlen(cmap_name),
- &identity_cidsi, 1, &identity_procs, mem);
+ (const byte *)cmap_name, strlen(cmap_name),
+ &identity_cidsi, 1, &identity_procs, mem);
if (code < 0)
- return code;
+ return code;
pcimap = (gs_cmap_identity_t *)*ppcmap;
pcimap->num_bytes = num_bytes;
pcimap->varying_bytes = varying_bytes;
@@ -197,19 +197,19 @@ gs_cmap_identity_alloc(gs_cmap_t **ppcmap, int num_bytes, int varying_bytes,
}
int
gs_cmap_create_identity(gs_cmap_t **ppcmap, int num_bytes, int wmode,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
return gs_cmap_identity_alloc(ppcmap, num_bytes, num_bytes, 0,
- (wmode ? "Identity-V" : "Identity-H"),
- wmode, mem);
+ (wmode ? "Identity-V" : "Identity-H"),
+ wmode, mem);
}
int
gs_cmap_create_char_identity(gs_cmap_t **ppcmap, int num_bytes, int wmode,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
return gs_cmap_identity_alloc(ppcmap, num_bytes, 1, num_bytes,
- (wmode ? "Identity-BF-V" : "Identity-BF-H"),
- wmode, mem);
+ (wmode ? "Identity-BF-V" : "Identity-BF-H"),
+ wmode, mem);
}
/* ------ Check identity ------ */
@@ -231,8 +231,8 @@ gs_cmap_is_identity(const gs_cmap_t *pcmap, int font_index_only)
*/
int
gs_cmap_decode_next(const gs_cmap_t *pcmap, const gs_const_string *str,
- uint *pindex, uint *pfidx,
- gs_char *pchr, gs_glyph *pglyph)
+ uint *pindex, uint *pfidx,
+ gs_char *pchr, gs_glyph *pglyph)
{
return pcmap->procs->decode_next(pcmap, str, pindex, pfidx, pchr, pglyph);
}
@@ -260,7 +260,7 @@ gs_cmap_enum_next_range(gs_cmap_ranges_enum_t *penum)
*/
void
gs_cmap_lookups_enum_init(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *penum)
+ gs_cmap_lookups_enum_t *penum)
{
pcmap->procs->enum_lookups(pcmap, which, penum);
}
@@ -300,30 +300,30 @@ gs_cmap_init(const gs_memory_t *mem, gs_cmap_t *pcmap, int num_fonts)
*/
int
gs_cmap_alloc(gs_cmap_t **ppcmap, const gs_memory_struct_type_t *pstype,
- int wmode, const byte *map_name, uint name_size,
- const gs_cid_system_info_t *pcidsi_in, int num_fonts,
- const gs_cmap_procs_t *procs, gs_memory_t *mem)
+ int wmode, const byte *map_name, uint name_size,
+ const gs_cid_system_info_t *pcidsi_in, int num_fonts,
+ const gs_cmap_procs_t *procs, gs_memory_t *mem)
{
gs_cmap_t *pcmap =
- gs_alloc_struct(mem, gs_cmap_t, pstype, "gs_cmap_alloc(CMap)");
+ gs_alloc_struct(mem, gs_cmap_t, pstype, "gs_cmap_alloc(CMap)");
gs_cid_system_info_t *pcidsi =
- gs_alloc_struct_array(mem, num_fonts, gs_cid_system_info_t,
- &st_cid_system_info_element,
- "gs_cmap_alloc(CIDSystemInfo)");
+ gs_alloc_struct_array(mem, num_fonts, gs_cid_system_info_t,
+ &st_cid_system_info_element,
+ "gs_cmap_alloc(CIDSystemInfo)");
if (pcmap == 0 || pcidsi == 0) {
- gs_free_object(mem, pcidsi, "gs_cmap_alloc(CIDSystemInfo)");
- gs_free_object(mem, pcmap, "gs_cmap_alloc(CMap)");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, pcidsi, "gs_cmap_alloc(CIDSystemInfo)");
+ gs_free_object(mem, pcmap, "gs_cmap_alloc(CMap)");
+ return_error(gs_error_VMerror);
}
gs_cmap_init(mem, pcmap, num_fonts); /* id, uid, num_fonts */
pcmap->CMapType = 1;
pcmap->CMapName.data = map_name;
pcmap->CMapName.size = name_size;
if (pcidsi_in)
- memcpy(pcidsi, pcidsi_in, sizeof(*pcidsi) * num_fonts);
+ memcpy(pcidsi, pcidsi_in, sizeof(*pcidsi) * num_fonts);
else
- memset(pcidsi, 0, sizeof(*pcidsi) * num_fonts);
+ memset(pcidsi, 0, sizeof(*pcidsi) * num_fonts);
pcmap->CIDSystemInfo = pcidsi;
pcmap->CMapVersion = 1.0;
/* uid = 0, UIDOffset = 0 */
@@ -340,8 +340,8 @@ gs_cmap_alloc(gs_cmap_t **ppcmap, const gs_memory_struct_type_t *pstype,
*/
void
gs_cmap_ranges_enum_setup(gs_cmap_ranges_enum_t *penum,
- const gs_cmap_t *pcmap,
- const gs_cmap_ranges_enum_procs_t *procs)
+ const gs_cmap_t *pcmap,
+ const gs_cmap_ranges_enum_procs_t *procs)
{
penum->cmap = pcmap;
penum->procs = procs;
@@ -349,15 +349,15 @@ gs_cmap_ranges_enum_setup(gs_cmap_ranges_enum_t *penum,
}
void
gs_cmap_lookups_enum_setup(gs_cmap_lookups_enum_t *penum,
- const gs_cmap_t *pcmap,
- const gs_cmap_lookups_enum_procs_t *procs)
+ const gs_cmap_t *pcmap,
+ const gs_cmap_lookups_enum_procs_t *procs)
{
penum->cmap = pcmap;
penum->procs = procs;
penum->index[0] = penum->index[1] = 0;
}
-/*
+/*
* For a random CMap, compute whether it is identity.
* It is not applicable to gs_cmap_ToUnicode_t due to
* different sizes of domain keys and range values.
@@ -373,31 +373,31 @@ gs_cmap_compute_identity(const gs_cmap_t *pcmap, int font_index_only)
int code;
if (!bytes_compare(pcmap->CIDSystemInfo->Registry.data, pcmap->CIDSystemInfo->Registry.size,
- (const byte *)"Artifex", 7))
- return false;
+ (const byte *)"Artifex", 7))
+ return false;
for (gs_cmap_lookups_enum_init(pcmap, which, &lenum);
- (code = gs_cmap_enum_next_lookup(&lenum)) == 0; ) {
- if (font_index_only >= 0 && lenum.entry.font_index != font_index_only)
- continue;
- if (font_index_only < 0 && lenum.entry.font_index > 0)
- return false;
- while (gs_cmap_enum_next_entry(&lenum) == 0) {
- switch (lenum.entry.value_type) {
- case CODE_VALUE_CID:
- break;
- case CODE_VALUE_CHARS:
- return false; /* Not implemented yet. */
- case CODE_VALUE_GLYPH:
- return false;
- default :
- return false; /* Must not happen. */
- }
- if (lenum.entry.key_size != lenum.entry.value.size)
- return false;
- if (memcmp(lenum.entry.key[0], lenum.entry.value.data,
- lenum.entry.key_size))
- return false;
- }
+ (code = gs_cmap_enum_next_lookup(&lenum)) == 0; ) {
+ if (font_index_only >= 0 && lenum.entry.font_index != font_index_only)
+ continue;
+ if (font_index_only < 0 && lenum.entry.font_index > 0)
+ return false;
+ while (gs_cmap_enum_next_entry(&lenum) == 0) {
+ switch (lenum.entry.value_type) {
+ case CODE_VALUE_CID:
+ break;
+ case CODE_VALUE_CHARS:
+ return false; /* Not implemented yet. */
+ case CODE_VALUE_GLYPH:
+ return false;
+ default :
+ return false; /* Must not happen. */
+ }
+ if (lenum.entry.key_size != lenum.entry.value.size)
+ return false;
+ if (memcmp(lenum.entry.key[0], lenum.entry.value.data,
+ lenum.entry.key_size))
+ return false;
+ }
}
return true;
}
@@ -407,7 +407,7 @@ gs_cmap_compute_identity(const gs_cmap_t *pcmap, int font_index_only)
/*
* This kind of CMaps keeps character a mapping from a random
* PS encoding to Unicode, being defined in PDF reference, "ToUnicode CMaps".
- * It represents ranges in a closure data, without using
+ * It represents ranges in a closure data, without using
* gx_cmap_lookup_range_t. A special function gs_cmap_ToUnicode_set
* allows to write code pairs into the closure data.
*/
@@ -429,11 +429,11 @@ static int
gs_cmap_ToUnicode_next_range(gs_cmap_ranges_enum_t *penum)
{ const gs_cmap_ToUnicode_t *cmap = (gs_cmap_ToUnicode_t *)penum->cmap;
if (penum->index == 0) {
- memset(penum->range.first, 0, cmap->key_size);
- memset(penum->range.last, 0xff, cmap->key_size);
- penum->range.size = cmap->key_size;
- penum->index = 1;
- return 0;
+ memset(penum->range.first, 0, cmap->key_size);
+ memset(penum->range.last, 0xff, cmap->key_size);
+ penum->range.size = cmap->key_size;
+ penum->index = 1;
+ return 0;
}
return 1;
}
@@ -444,8 +444,8 @@ static const gs_cmap_ranges_enum_procs_t gs_cmap_ToUnicode_range_procs = {
static int
gs_cmap_ToUnicode_decode_next(const gs_cmap_t *pcmap, const gs_const_string *str,
- uint *pindex, uint *pfidx,
- gs_char *pchr, gs_glyph *pglyph)
+ uint *pindex, uint *pfidx,
+ gs_char *pchr, gs_glyph *pglyph)
{
return_error(gs_error_unregistered);
}
@@ -459,9 +459,9 @@ gs_cmap_ToUnicode_enum_ranges(const gs_cmap_t *pcmap, gs_cmap_ranges_enum_t *pre
static int
gs_cmap_ToUnicode_next_lookup(gs_cmap_lookups_enum_t *penum)
{ const gs_cmap_ToUnicode_t *cmap = (gs_cmap_ToUnicode_t *)penum->cmap;
-
+
if (penum->index[0]++ > 0)
- return 1;
+ return 1;
penum->entry.value.data = penum->temp_value;
penum->entry.value.size = gs_cmap_ToUnicode_code_bytes;
penum->index[1] = 0;
@@ -482,34 +482,34 @@ gs_cmap_ToUnicode_next_entry(gs_cmap_lookups_enum_t *penum)
uchar c0, c1, c2;
for (i = index; i < num_codes; i++)
- if (map[i + i + 0] != 0 || map[i + i + 1] != 0)
- break;
+ if (map[i + i + 0] != 0 || map[i + i + 1] != 0)
+ break;
if (i >= num_codes)
- return 1;
+ return 1;
c0 = map[i + i + 0];
c1 = map[i + i + 1];
for (j = i + 1, c2 = c1 + 1; j < num_codes; j++, c2++) {
- /* Due to PDF spec, *bfrange boundaries may differ
- in the last byte only. */
- if (j % 256 == 0)
- break;
- if ((uchar)c2 == 0)
- break;
- if (map[j + j + 0] != c0 || map[j + j + 1] != c2)
- break;
+ /* Due to PDF spec, *bfrange boundaries may differ
+ in the last byte only. */
+ if (j % 256 == 0)
+ break;
+ if ((uchar)c2 == 0)
+ break;
+ if (map[j + j + 0] != c0 || map[j + j + 1] != c2)
+ break;
}
penum->index[1] = j;
if (cmap->key_size > 1) {
- penum->entry.key[0][0] = (uchar)(i >> 8);
- penum->entry.key[0][cmap->key_size - 1] = (uchar)(i & 0xFF);
- penum->entry.key[1][0] = (uchar)(j >> 8);
- penum->entry.key[1][cmap->key_size - 1] = (uchar)((j - 1) & 0xFF);
+ penum->entry.key[0][0] = (uchar)(i >> 8);
+ penum->entry.key[0][cmap->key_size - 1] = (uchar)(i & 0xFF);
+ penum->entry.key[1][0] = (uchar)(j >> 8);
+ penum->entry.key[1][cmap->key_size - 1] = (uchar)((j - 1) & 0xFF);
} else {
- penum->entry.key[0][0] = (uchar)(i);
- penum->entry.key[1][0] = (uchar)(j - 1);
+ penum->entry.key[0][0] = (uchar)(i);
+ penum->entry.key[1][0] = (uchar)(j - 1);
}
- memcpy(penum->temp_value, map + i * gs_cmap_ToUnicode_code_bytes,
- gs_cmap_ToUnicode_code_bytes);
+ memcpy(penum->temp_value, map + i * gs_cmap_ToUnicode_code_bytes,
+ gs_cmap_ToUnicode_code_bytes);
return 0;
}
@@ -519,11 +519,11 @@ static const gs_cmap_lookups_enum_procs_t gs_cmap_ToUnicode_lookup_procs = {
static void
gs_cmap_ToUnicode_enum_lookups(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *pre)
+ gs_cmap_lookups_enum_t *pre)
{
gs_cmap_lookups_enum_setup(pre, pcmap,
- (which ? &gs_cmap_no_lookups_procs : /* fixme */
- &gs_cmap_ToUnicode_lookup_procs));
+ (which ? &gs_cmap_no_lookups_procs : /* fixme */
+ &gs_cmap_ToUnicode_lookup_procs));
}
static bool
@@ -549,32 +549,32 @@ gs_cmap_ToUnicode_alloc(gs_memory_t *mem, int id, int num_codes, int key_size, g
gs_cmap_ToUnicode_t *cmap;
int name_len = 0;
# if 0
- /* We don't write a CMap name to ToUnicode CMaps,
- * becsue (1) there is no conventional method for
- * generating them, and (2) Acrobat Reader ignores them.
- * But we'd like to keep this code until beta-testing completes,
- * and we ensure that other viewers do not need the names.
- */
- char sid[10], *pref = "aux-";
- int sid_len, pref_len = strlen(pref);
-
- sprintf(sid, "%d", id);
- sid_len = strlen(sid);
- name_len = pref_len + sid_len;
- cmap_name = gs_alloc_string(mem, name_len, "gs_cmap_ToUnicode_alloc");
- if (cmap_name == 0)
- return_error(gs_error_VMerror);
- memcpy(cmap_name, pref, pref_len);
- memcpy(cmap_name + pref_len, sid, sid_len);
+ /* We don't write a CMap name to ToUnicode CMaps,
+ * becsue (1) there is no conventional method for
+ * generating them, and (2) Acrobat Reader ignores them.
+ * But we'd like to keep this code until beta-testing completes,
+ * and we ensure that other viewers do not need the names.
+ */
+ char sid[10], *pref = "aux-";
+ int sid_len, pref_len = strlen(pref);
+
+ sprintf(sid, "%d", id);
+ sid_len = strlen(sid);
+ name_len = pref_len + sid_len;
+ cmap_name = gs_alloc_string(mem, name_len, "gs_cmap_ToUnicode_alloc");
+ if (cmap_name == 0)
+ return_error(gs_error_VMerror);
+ memcpy(cmap_name, pref, pref_len);
+ memcpy(cmap_name + pref_len, sid, sid_len);
# endif
code = gs_cmap_alloc(ppcmap, &st_cmap_ToUnicode,
- 0, cmap_name, name_len, NULL, 0, &gs_cmap_ToUnicode_procs, mem);
+ 0, cmap_name, name_len, NULL, 0, &gs_cmap_ToUnicode_procs, mem);
if (code < 0)
- return code;
- map = (uchar *)gs_alloc_bytes(mem, num_codes * gs_cmap_ToUnicode_code_bytes,
+ return code;
+ map = (uchar *)gs_alloc_bytes(mem, num_codes * gs_cmap_ToUnicode_code_bytes,
"gs_cmap_ToUnicode_alloc");
if (map == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(map, 0, num_codes * gs_cmap_ToUnicode_code_bytes);
cmap = (gs_cmap_ToUnicode_t *)*ppcmap;
cmap->glyph_name_data = map;
@@ -595,9 +595,9 @@ gs_cmap_ToUnicode_add_pair(gs_cmap_t *pcmap, int code0, int code1)
{ gs_cmap_ToUnicode_t *cmap = (gs_cmap_ToUnicode_t *)pcmap;
uchar *map = pcmap->glyph_name_data;
const int num_codes = ((gs_cmap_ToUnicode_t *)pcmap)->num_codes;
-
+
if (code0 >= num_codes)
- return; /* must not happen. */
+ return; /* must not happen. */
map[code0 * gs_cmap_ToUnicode_code_bytes + 0] = (uchar)(code1 >> 8);
map[code0 * gs_cmap_ToUnicode_code_bytes + 1] = (uchar)(code1 & 0xFF);
cmap->is_identity &= (code0 == code1);
diff --git a/gs/base/gsfcmap.h b/gs/base/gsfcmap.h
index 93f1156ef..aea028c4e 100644
--- a/gs/base/gsfcmap.h
+++ b/gs/base/gsfcmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@ typedef struct gs_cmap_s gs_cmap_t;
* Create an Identity CMap.
*/
int gs_cmap_create_identity(gs_cmap_t **ppcmap, int num_bytes, int wmode,
- gs_memory_t *mem);
+ gs_memory_t *mem);
/*
* Create an Identity CMap where each entry varies only in the lowest byte,
@@ -39,7 +39,7 @@ int gs_cmap_create_identity(gs_cmap_t **ppcmap, int num_bytes, int wmode,
* (This is suitable for use as a ToUnicode CMap, for example.)
*/
int gs_cmap_create_char_identity(gs_cmap_t **ppcmap, int num_bytes,
- int wmode, gs_memory_t *mem);
+ int wmode, gs_memory_t *mem);
/*
* Decode a character from a string using a CMap, updating the index.
@@ -48,14 +48,14 @@ int gs_cmap_create_char_identity(gs_cmap_t **ppcmap, int num_bytes,
* *pchr. For undefined characters, set *pglyph = gs_no_glyph and return 0.
*/
int gs_cmap_decode_next(const gs_cmap_t *pcmap, const gs_const_string *str,
- uint *pindex, uint *pfidx,
- gs_char *pchr, gs_glyph *pglyph);
+ uint *pindex, uint *pfidx,
+ gs_char *pchr, gs_glyph *pglyph);
/*
* Allocate and initialize a ToUnicode CMap.
*/
-int gs_cmap_ToUnicode_alloc(gs_memory_t *mem, int id, int num_codes, int key_size,
- gs_cmap_t **ppcmap);
+int gs_cmap_ToUnicode_alloc(gs_memory_t *mem, int id, int num_codes, int key_size,
+ gs_cmap_t **ppcmap);
/*
* Write a code pair to ToUnicode CMap.
diff --git a/gs/base/gsfcmap1.c b/gs/base/gsfcmap1.c
index a7f7c9d17..ae775b795 100644
--- a/gs/base/gsfcmap1.c
+++ b/gs/base/gsfcmap1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,13 +38,13 @@ bytes2int(const byte *p, int n)
public_st_cmap_adobe1();
/* Because lookup ranges can be elements of arrays, */
/* their enum_ptrs procedure must never return 0 prematurely. */
-static
+static
ENUM_PTRS_WITH(cmap_lookup_range_enum_ptrs,
gx_cmap_lookup_range_t *pclr) return 0;
case 0:
if (pclr->value_type == CODE_VALUE_GLYPH) {
const byte *pv = pclr->values.data;
- int size = pclr->value_size;
+ int size = pclr->value_size;
int k;
for (k = 0; k < pclr->num_entries; ++k, pv += size) {
@@ -115,7 +115,7 @@ gs_cmap_get_shortest_chr(const gx_code_map_t * pcmap, uint *pfidx)
static int
gs_multidim_CID_offset(const byte *key_str,
const byte *key_lo, const byte *key_hi,
- int key_size)
+ int key_size)
{
int i; /* index for current dimension */
@@ -132,7 +132,7 @@ gs_multidim_CID_offset(const byte *key_str,
CID_offset = CID_offset * (key_hi[i] - key_lo[i] + 1) +
key_str[i] - key_lo[i];
-#ifdef DEBUG
+#ifdef DEBUG
if_debug1('J', "[J]gmCo() CID_offset = %d\n", CID_offset);
#endif
@@ -179,20 +179,20 @@ code_map_decode_next_multidim_regime(const gx_code_map_t * pcmap,
dlprintf("[J]CMDNmr() is called: str=(");
debug_print_string_hex(str, ssize);
dlprintf3(") @ 0x%lx ssize=%d, %d ranges to check\n",
- (ulong)str, ssize, pcmap->num_lookup);
+ (ulong)str, ssize, pcmap->num_lookup);
}
#endif
for (i = pcmap->num_lookup - 1; i >= 0; --i) {
- /* main loop - scan the map passed via pcmap */
- /* reverse scan order due to 'usecmap' */
+ /* main loop - scan the map passed via pcmap */
+ /* reverse scan order due to 'usecmap' */
const gx_cmap_lookup_range_t *pclr = &pcmap->lookup[i];
int pre_size = pclr->key_prefix_size, key_size = pclr->key_size,
chr_size = pre_size + key_size;
int j = 0;
- /* length of the given byte stream is shorter than
+ /* length of the given byte stream is shorter than
* chr-length of current range, no need for further check,
* skip to the next range.
*/
@@ -240,14 +240,14 @@ code_map_decode_next_multidim_regime(const gx_code_map_t * pcmap,
int k, l;
const byte *pvalue = NULL;
- /* when range is "range", 2 keys for lo-end and hi-end
+ /* when range is "range", 2 keys for lo-end and hi-end
* are stacked. So twice the step. current "key" points
* lo-end of current range, and the pointer for hi-end
* is calculated by (key + step - key_size).
*/
if (pclr->key_is_range)
- step <<=1; /* step = step * 2; */
+ step <<=1; /* step = step * 2; */
for (k = 0; k < pclr->num_entries; ++k, key += step) {
@@ -264,7 +264,7 @@ code_map_decode_next_multidim_regime(const gx_code_map_t * pcmap,
break;
}
- if (pm_maxlen < pre_size + l) {
+ if (pm_maxlen < pre_size + l) {
pm_maxlen = chr_size;
pm_chr = bytes2int(str, chr_size);
pm_index = (*pindex) + chr_size;
@@ -272,7 +272,7 @@ code_map_decode_next_multidim_regime(const gx_code_map_t * pcmap,
}
if (l == key_size)
break;
- }
+ }
/* all keys are tried, but found no match. */
/* go to next prefix. */
@@ -345,9 +345,9 @@ code_map_decode_next_multidim_regime(const gx_code_map_t * pcmap,
*/
static int
gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
- const gs_const_string * pstr,
- uint * pindex, uint * pfidx,
- gs_char * pchr, gs_glyph * pglyph)
+ const gs_const_string * pstr,
+ uint * pindex, uint * pfidx,
+ gs_char * pchr, gs_glyph * pglyph)
{
const gs_cmap_adobe1_t *pcmap = (const gs_cmap_adobe1_t *)pcmap_in;
uint save_index = *pindex;
@@ -376,7 +376,7 @@ gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
if_debug0('J', "[J]GCDN() check notdef CMap\n");
*pindex = save_index;
code =
- code_map_decode_next_multidim_regime(&pcmap->notdef, pstr, pindex, pfidx, pchr, pglyph);
+ code_map_decode_next_multidim_regime(&pcmap->notdef, pstr, pindex, pfidx, pchr, pglyph);
/* This is defined "notdef" character. */
if (code != 0 || *pglyph != gs_no_glyph)
@@ -385,10 +385,10 @@ gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
/*
* This is undefined in def & undef maps,
* use partially matched result with default notdef (CID = 0).
- */
+ */
if (save_index < pm_index) {
- /* there was some partially matched */
+ /* there was some partially matched */
*pglyph = gs_min_cid_glyph; /* CID = 0 */
*pindex = pm_index;
@@ -397,25 +397,25 @@ gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
return 0; /* should return some error for partial matched .notdef? */
}
else {
- /* no match */
+ /* no match */
- /* Even partial match is failed.
+ /* Even partial match is failed.
* Getting the shortest length from defined characters,
* and take the leading bytes (with same length of the shortest
* defined chr) as an unidentified character: CID = 0.
- * Also this procedure is specified in PS Ref. Manual v3,
- * at the end of Fonts chapter.
+ * Also this procedure is specified in PS Ref. Manual v3,
+ * at the end of Fonts chapter.
*/
- const byte *str = pstr->data + save_index;
- uint ssize = pstr->size - save_index;
- int chr_size_shortest =
- gs_cmap_get_shortest_chr(&pcmap->def, pfidx);
+ const byte *str = pstr->data + save_index;
+ uint ssize = pstr->size - save_index;
+ int chr_size_shortest =
+ gs_cmap_get_shortest_chr(&pcmap->def, pfidx);
- if (chr_size_shortest <= ssize) {
+ if (chr_size_shortest <= ssize) {
*pglyph = gs_min_cid_glyph; /* CID = 0, this is CMap fallback */
*pindex = save_index + chr_size_shortest;
- *pchr = '\0';
+ *pchr = '\0';
#ifdef DEBUG
if (gs_debug_c('J')) {
dlprintf1("[J]GCDN() no partial match, skip %d byte (",
@@ -425,10 +425,10 @@ gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
}
#endif
return 0; /* should return some error for fallback .notdef? */
- }
- else {
+ }
+ else {
/* Undecodable string is shorter than the shortest character,
- * return 'gs_no_glyph' and update index to end-of-string
+ * return 'gs_no_glyph' and update index to end-of-string
*/
#ifdef DEBUG
if (gs_debug_c('J')) {
@@ -437,9 +437,9 @@ gs_cmap_adobe1_decode_next(const gs_cmap_t * pcmap_in,
}
#endif
*pglyph = gs_no_glyph;
- *pindex += ssize;
+ *pindex += ssize;
return 0; /* fixme: should return a code != 0 if caller needs to know */
- }
+ }
}
}
@@ -454,10 +454,10 @@ static int
adobe1_next_range(gs_cmap_ranges_enum_t *penum)
{
const gs_cmap_adobe1_t *const pcmap =
- (const gs_cmap_adobe1_t *)penum->cmap;
+ (const gs_cmap_adobe1_t *)penum->cmap;
if (penum->index >= pcmap->code_space.num_ranges)
- return 1;
+ return 1;
penum->range = pcmap->code_space.ranges[penum->index++];
return 0;
}
@@ -475,7 +475,7 @@ adobe1_next_lookup(gs_cmap_lookups_enum_t *penum, const gx_code_map_t *pcm)
const gx_cmap_lookup_range_t *lookup = &pcm->lookup[penum->index[0]];
if (penum->index[0] >= pcm->num_lookup)
- return 1;
+ return 1;
penum->entry.key_size = lookup->key_prefix_size + lookup->key_size;
penum->entry.key_is_range = lookup->key_is_range;
penum->entry.value_type = lookup->value_type;
@@ -489,13 +489,13 @@ static int
adobe1_next_lookup_def(gs_cmap_lookups_enum_t *penum)
{
return adobe1_next_lookup(penum,
- &((const gs_cmap_adobe1_t *)penum->cmap)->def);
+ &((const gs_cmap_adobe1_t *)penum->cmap)->def);
}
static int
adobe1_next_lookup_notdef(gs_cmap_lookups_enum_t *penum)
{
return adobe1_next_lookup(penum,
- &((const gs_cmap_adobe1_t *)penum->cmap)->notdef);
+ &((const gs_cmap_adobe1_t *)penum->cmap)->notdef);
}
static int
adobe1_next_entry(gs_cmap_lookups_enum_t *penum, const gx_code_map_t *pcm)
@@ -504,20 +504,20 @@ adobe1_next_entry(gs_cmap_lookups_enum_t *penum, const gx_code_map_t *pcm)
int psize = lookup->key_prefix_size;
int ksize = lookup->key_size;
const byte *key =
- lookup->keys.data + penum->index[1] * ksize *
- (lookup->key_is_range ? 2 : 1);
+ lookup->keys.data + penum->index[1] * ksize *
+ (lookup->key_is_range ? 2 : 1);
int i;
if (penum->index[1] >= lookup->num_entries)
- return 1;
+ return 1;
if (psize + ksize > MAX_CMAP_CODE_SIZE)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; i < 2; ++i, key += ksize) {
- memcpy(penum->entry.key[i], lookup->key_prefix, psize);
- memcpy(penum->entry.key[i] + psize, key, ksize);
+ memcpy(penum->entry.key[i], lookup->key_prefix, psize);
+ memcpy(penum->entry.key[i] + psize, key, ksize);
}
penum->entry.value.data =
- lookup->values.data + penum->index[1] * lookup->value_size;
+ lookup->values.data + penum->index[1] * lookup->value_size;
penum->entry.value.size = lookup->value_size;
penum->index[1]++;
return 0;
@@ -526,13 +526,13 @@ static int
adobe1_next_entry_def(gs_cmap_lookups_enum_t *penum)
{
return adobe1_next_entry(penum,
- &((const gs_cmap_adobe1_t *)penum->cmap)->def);
+ &((const gs_cmap_adobe1_t *)penum->cmap)->def);
}
static int
adobe1_next_entry_notdef(gs_cmap_lookups_enum_t *penum)
{
return adobe1_next_entry(penum,
- &((const gs_cmap_adobe1_t *)penum->cmap)->notdef);
+ &((const gs_cmap_adobe1_t *)penum->cmap)->notdef);
}
static const gs_cmap_lookups_enum_procs_t adobe1_lookup_def_procs = {
adobe1_next_lookup_def, adobe1_next_entry_def
@@ -542,11 +542,11 @@ static const gs_cmap_lookups_enum_procs_t adobe1_lookup_notdef_procs = {
};
static void
gs_cmap_adobe1_enum_lookups(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *pre)
+ gs_cmap_lookups_enum_t *pre)
{
gs_cmap_lookups_enum_setup(pre, pcmap,
- (which ? &adobe1_lookup_notdef_procs :
- &adobe1_lookup_def_procs));
+ (which ? &adobe1_lookup_notdef_procs :
+ &adobe1_lookup_def_procs));
}
static const gs_cmap_procs_t cmap_adobe1_procs = {
@@ -558,52 +558,52 @@ static const gs_cmap_procs_t cmap_adobe1_procs = {
int
gs_cmap_adobe1_alloc(gs_cmap_adobe1_t **ppcmap, int wmode,
- const byte *map_name, uint name_size,
- uint num_fonts, uint num_ranges, uint num_lookups,
- uint keys_size, uint values_size,
- const gs_cid_system_info_t *pcidsi_in, gs_memory_t *mem)
+ const byte *map_name, uint name_size,
+ uint num_fonts, uint num_ranges, uint num_lookups,
+ uint keys_size, uint values_size,
+ const gs_cid_system_info_t *pcidsi_in, gs_memory_t *mem)
{
gs_cmap_t *pcmap;
gs_cmap_adobe1_t *pcmap1;
gx_code_space_range_t *ranges = (gx_code_space_range_t *)
- gs_alloc_byte_array(mem, num_ranges, sizeof(gx_code_space_range_t),
- "gs_cmap_alloc(code space ranges)");
+ gs_alloc_byte_array(mem, num_ranges, sizeof(gx_code_space_range_t),
+ "gs_cmap_alloc(code space ranges)");
gx_cmap_lookup_range_t *lookups =
- (num_lookups == 0 ? NULL :
- gs_alloc_struct_array(mem, num_lookups, gx_cmap_lookup_range_t,
- &st_cmap_lookup_range,
- "gs_cmap_alloc(lookup ranges)"));
+ (num_lookups == 0 ? NULL :
+ gs_alloc_struct_array(mem, num_lookups, gx_cmap_lookup_range_t,
+ &st_cmap_lookup_range,
+ "gs_cmap_alloc(lookup ranges)"));
byte *keys =
- (keys_size == 0 ? NULL :
- gs_alloc_string(mem, keys_size, "gs_cmap_alloc(keys)"));
+ (keys_size == 0 ? NULL :
+ gs_alloc_string(mem, keys_size, "gs_cmap_alloc(keys)"));
byte *values =
- (values_size == 0 ? NULL :
- gs_alloc_string(mem, values_size, "gs_cmap_alloc(values)"));
+ (values_size == 0 ? NULL :
+ gs_alloc_string(mem, values_size, "gs_cmap_alloc(values)"));
int code =
- gs_cmap_alloc(&pcmap, &st_cmap_adobe1, wmode, map_name, name_size,
- pcidsi_in, num_fonts, &cmap_adobe1_procs, mem);
+ gs_cmap_alloc(&pcmap, &st_cmap_adobe1, wmode, map_name, name_size,
+ pcidsi_in, num_fonts, &cmap_adobe1_procs, mem);
uint i;
if (code < 0 || ranges == 0 || (num_lookups != 0 && lookups == 0) ||
- (keys_size != 0 && keys == 0) || (values_size != 0 && values == 0)) {
- gs_free_string(mem, values, values_size, "gs_cmap_alloc(values)");
- gs_free_string(mem, keys, keys_size, "gs_cmap_alloc(keys)");
- gs_free_object(mem, lookups, "gs_cmap_alloc(lookup ranges)");
- gs_free_object(mem, ranges, "gs_cmap_alloc(code space ranges)");
- return_error(gs_error_VMerror);
+ (keys_size != 0 && keys == 0) || (values_size != 0 && values == 0)) {
+ gs_free_string(mem, values, values_size, "gs_cmap_alloc(values)");
+ gs_free_string(mem, keys, keys_size, "gs_cmap_alloc(keys)");
+ gs_free_object(mem, lookups, "gs_cmap_alloc(lookup ranges)");
+ gs_free_object(mem, ranges, "gs_cmap_alloc(code space ranges)");
+ return_error(gs_error_VMerror);
}
*ppcmap = pcmap1 = (gs_cmap_adobe1_t *)pcmap;
pcmap1->code_space.ranges = ranges;
pcmap1->code_space.num_ranges = num_ranges;
if (num_lookups > 0) {
- for (i = 0; i < num_lookups; ++i) {
- memset(&lookups[i], 0, sizeof(*lookups));
- lookups[i].cmap = pcmap1;
- }
- lookups[0].keys.data = keys;
- lookups[0].keys.size = keys_size;
- lookups[0].values.data = values;
- lookups[0].values.size = values_size;
+ for (i = 0; i < num_lookups; ++i) {
+ memset(&lookups[i], 0, sizeof(*lookups));
+ lookups[i].cmap = pcmap1;
+ }
+ lookups[0].keys.data = keys;
+ lookups[0].keys.size = keys_size;
+ lookups[0].values.data = values;
+ lookups[0].values.size = values_size;
}
pcmap1->def.lookup = lookups;
pcmap1->def.num_lookup = num_lookups;
diff --git a/gs/base/gsflip.c b/gs/base/gsflip.c
index 8654d1c0e..9afcaaf6a 100644
--- a/gs/base/gsflip.c
+++ b/gs/base/gsflip.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,15 +47,15 @@ flip3x1(byte * buffer, const byte ** planes, int offset, int nbytes)
const byte *in3 = planes[2] + offset;
int n = nbytes;
static const bits32 tab3x1[256] = {
- VTAB(0x800000, 0x100000, 0x20000, 0x4000, 0x800, 0x100, 0x20, 4)
+ VTAB(0x800000, 0x100000, 0x20000, 0x4000, 0x800, 0x100, 0x20, 4)
};
for (; n > 0; out += 3, ++in1, ++in2, ++in3, --n) {
- bits32 b24 = tab3x1[*in1] | (tab3x1[*in2] >> 1) | (tab3x1[*in3] >> 2);
+ bits32 b24 = tab3x1[*in1] | (tab3x1[*in2] >> 1) | (tab3x1[*in3] >> 2);
- out[0] = (byte) (b24 >> 16);
- out[1] = (byte) (b24 >> 8);
- out[2] = (byte) b24;
+ out[0] = (byte) (b24 >> 16);
+ out[1] = (byte) (b24 >> 8);
+ out[2] = (byte) b24;
}
return 0;
}
@@ -70,15 +70,15 @@ flip3x2(byte * buffer, const byte ** planes, int offset, int nbytes)
const byte *in3 = planes[2] + offset;
int n = nbytes;
static const bits32 tab3x2[256] = {
- VTAB(0x800000, 0x400000, 0x20000, 0x10000, 0x800, 0x400, 0x20, 0x10)
+ VTAB(0x800000, 0x400000, 0x20000, 0x10000, 0x800, 0x400, 0x20, 0x10)
};
for (; n > 0; out += 3, ++in1, ++in2, ++in3, --n) {
- bits32 b24 = tab3x2[*in1] | (tab3x2[*in2] >> 2) | (tab3x2[*in3] >> 4);
+ bits32 b24 = tab3x2[*in1] | (tab3x2[*in2] >> 2) | (tab3x2[*in3] >> 4);
- out[0] = (byte) (b24 >> 16);
- out[1] = (byte) (b24 >> 8);
- out[2] = (byte) b24;
+ out[0] = (byte) (b24 >> 16);
+ out[1] = (byte) (b24 >> 8);
+ out[2] = (byte) b24;
}
return 0;
}
@@ -94,11 +94,11 @@ flip3x4(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 3, ++in1, ++in2, ++in3, --n) {
- byte_var b1 = *in1, b2 = *in2, b3 = *in3;
+ byte_var b1 = *in1, b2 = *in2, b3 = *in3;
- out[0] = (b1 & 0xf0) | (b2 >> 4);
- out[1] = (b3 & 0xf0) | (b1 & 0xf);
- out[2] = (byte) (b2 << 4) | (b3 & 0xf);
+ out[0] = (b1 & 0xf0) | (b2 >> 4);
+ out[1] = (b3 & 0xf0) | (b1 & 0xf);
+ out[2] = (byte) (b2 << 4) | (b3 & 0xf);
}
return 0;
}
@@ -114,9 +114,9 @@ flip3x8(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 3, ++in1, ++in2, ++in3, --n) {
- out[0] = *in1;
- out[1] = *in2;
- out[2] = *in3;
+ out[0] = *in1;
+ out[1] = *in2;
+ out[2] = *in3;
}
return 0;
}
@@ -136,17 +136,17 @@ flip3x12(byte * buffer, const byte ** planes, int offset, int nbytes)
* round up n to a multiple of 3.
*/
for (; n > 0; out += 9, pa += 3, pb += 3, pc += 3, n -= 3) {
- byte_var a1 = pa[1], b0 = pb[0], b1 = pb[1], b2 = pb[2], c1 = pc[1];
-
- out[0] = pa[0];
- out[1] = (a1 & 0xf0) | (b0 >> 4);
- out[2] = (byte) ((b0 << 4) | (b1 >> 4));
- out[3] = pc[0];
- out[4] = (c1 & 0xf0) | (a1 & 0xf);
- out[5] = pa[2];
- out[6] = (byte) ((b1 << 4) | (b2 >> 4));
- out[7] = (byte) ((b2 << 4) | (c1 & 0xf));
- out[8] = pc[2];
+ byte_var a1 = pa[1], b0 = pb[0], b1 = pb[1], b2 = pb[2], c1 = pc[1];
+
+ out[0] = pa[0];
+ out[1] = (a1 & 0xf0) | (b0 >> 4);
+ out[2] = (byte) ((b0 << 4) | (b1 >> 4));
+ out[3] = pc[0];
+ out[4] = (c1 & 0xf0) | (a1 & 0xf);
+ out[5] = pa[2];
+ out[6] = (byte) ((b1 << 4) | (b2 >> 4));
+ out[7] = (byte) ((b2 << 4) | (c1 & 0xf));
+ out[8] = pc[2];
}
return 0;
}
@@ -163,20 +163,20 @@ flip4x1(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 4, ++in1, ++in2, ++in3, ++in4, --n) {
- byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
- byte_var temp;
-
- /* Transpose blocks of 1 */
- TRANSPOSE(b1, b2, 0x55, 1);
- TRANSPOSE(b3, b4, 0x55, 1);
- /* Transpose blocks of 2 */
- TRANSPOSE(b1, b3, 0x33, 2);
- TRANSPOSE(b2, b4, 0x33, 2);
- /* There's probably a faster way to do this.... */
- out[0] = (b1 & 0xf0) | (b2 >> 4);
- out[1] = (b3 & 0xf0) | (b4 >> 4);
- out[2] = (byte) ((b1 << 4) | (b2 & 0xf));
- out[3] = (byte) ((b3 << 4) | (b4 & 0xf));
+ byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
+ byte_var temp;
+
+ /* Transpose blocks of 1 */
+ TRANSPOSE(b1, b2, 0x55, 1);
+ TRANSPOSE(b3, b4, 0x55, 1);
+ /* Transpose blocks of 2 */
+ TRANSPOSE(b1, b3, 0x33, 2);
+ TRANSPOSE(b2, b4, 0x33, 2);
+ /* There's probably a faster way to do this.... */
+ out[0] = (b1 & 0xf0) | (b2 >> 4);
+ out[1] = (b3 & 0xf0) | (b4 >> 4);
+ out[2] = (byte) ((b1 << 4) | (b2 & 0xf));
+ out[3] = (byte) ((b3 << 4) | (b4 & 0xf));
}
return 0;
}
@@ -193,19 +193,19 @@ flip4x2(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 4, ++in1, ++in2, ++in3, ++in4, --n) {
- byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
- byte_var temp;
-
- /* Transpose blocks of 4x2 */
- TRANSPOSE(b1, b3, 0x0f, 4);
- TRANSPOSE(b2, b4, 0x0f, 4);
- /* Transpose blocks of 2x1 */
- TRANSPOSE(b1, b2, 0x33, 2);
- TRANSPOSE(b3, b4, 0x33, 2);
- out[0] = b1;
- out[1] = b2;
- out[2] = b3;
- out[3] = b4;
+ byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
+ byte_var temp;
+
+ /* Transpose blocks of 4x2 */
+ TRANSPOSE(b1, b3, 0x0f, 4);
+ TRANSPOSE(b2, b4, 0x0f, 4);
+ /* Transpose blocks of 2x1 */
+ TRANSPOSE(b1, b2, 0x33, 2);
+ TRANSPOSE(b3, b4, 0x33, 2);
+ out[0] = b1;
+ out[1] = b2;
+ out[2] = b3;
+ out[3] = b4;
}
return 0;
}
@@ -222,12 +222,12 @@ flip4x4(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 4, ++in1, ++in2, ++in3, ++in4, --n) {
- byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
+ byte_var b1 = *in1, b2 = *in2, b3 = *in3, b4 = *in4;
- out[0] = (b1 & 0xf0) | (b2 >> 4);
- out[1] = (b3 & 0xf0) | (b4 >> 4);
- out[2] = (byte) ((b1 << 4) | (b2 & 0xf));
- out[3] = (byte) ((b3 << 4) | (b4 & 0xf));
+ out[0] = (b1 & 0xf0) | (b2 >> 4);
+ out[1] = (b3 & 0xf0) | (b4 >> 4);
+ out[2] = (byte) ((b1 << 4) | (b2 & 0xf));
+ out[3] = (byte) ((b3 << 4) | (b4 & 0xf));
}
return 0;
}
@@ -244,10 +244,10 @@ flip4x8(byte * buffer, const byte ** planes, int offset, int nbytes)
int n = nbytes;
for (; n > 0; out += 4, ++in1, ++in2, ++in3, ++in4, --n) {
- out[0] = *in1;
- out[1] = *in2;
- out[2] = *in3;
- out[3] = *in4;
+ out[0] = *in1;
+ out[1] = *in2;
+ out[2] = *in3;
+ out[3] = *in4;
}
return 0;
}
@@ -268,32 +268,32 @@ flip4x12(byte * buffer, const byte ** planes, int offset, int nbytes)
* round up n to a multiple of 3.
*/
for (; n > 0; out += 12, pa += 3, pb += 3, pc += 3, pd += 3, n -= 3) {
- byte_var a1 = pa[1], b1 = pb[1], c1 = pc[1], d1 = pd[1];
-
- {
- byte_var v0;
-
- out[0] = pa[0];
- v0 = pb[0];
- out[1] = (a1 & 0xf0) | (v0 >> 4);
- out[2] = (byte) ((v0 << 4) | (b1 >> 4));
- out[3] = pc[0];
- v0 = pd[0];
- out[4] = (c1 & 0xf0) | (v0 >> 4);
- out[5] = (byte) ((v0 << 4) | (d1 >> 4));
- }
- {
- byte_var v2;
-
- v2 = pa[2];
- out[6] = (byte) ((a1 << 4) | (v2 >> 4));
- out[7] = (byte) ((v2 << 4) | (b1 & 0xf));
- out[8] = pb[2];
- v2 = pc[2];
- out[9] = (byte) ((c1 << 4) | (v2 >> 4));
- out[10] = (byte) ((v2 << 4) | (d1 & 0xf));
- out[11] = pd[2];
- }
+ byte_var a1 = pa[1], b1 = pb[1], c1 = pc[1], d1 = pd[1];
+
+ {
+ byte_var v0;
+
+ out[0] = pa[0];
+ v0 = pb[0];
+ out[1] = (a1 & 0xf0) | (v0 >> 4);
+ out[2] = (byte) ((v0 << 4) | (b1 >> 4));
+ out[3] = pc[0];
+ v0 = pd[0];
+ out[4] = (c1 & 0xf0) | (v0 >> 4);
+ out[5] = (byte) ((v0 << 4) | (d1 >> 4));
+ }
+ {
+ byte_var v2;
+
+ v2 = pa[2];
+ out[6] = (byte) ((a1 << 4) | (v2 >> 4));
+ out[7] = (byte) ((v2 << 4) | (b1 & 0xf));
+ out[8] = pb[2];
+ v2 = pc[2];
+ out[9] = (byte) ((c1 << 4) | (v2 >> 4));
+ out[10] = (byte) ((v2 << 4) | (d1 & 0xf));
+ out[11] = pd[2];
+ }
}
return 0;
}
@@ -301,7 +301,7 @@ flip4x12(byte * buffer, const byte ** planes, int offset, int nbytes)
/* Convert NMx{1,2,4,8} to Nx{1,2,4,8}. */
static int
flipNx1to8(byte * buffer, const byte ** planes, int offset, int nbytes,
- int num_planes, int bits_per_sample)
+ int num_planes, int bits_per_sample)
{
/* This is only needed for DeviceN colors, so it can be slow. */
uint mask = (1 << bits_per_sample) - 1;
@@ -309,12 +309,12 @@ flipNx1to8(byte * buffer, const byte ** planes, int offset, int nbytes,
sample_store_declare_setup(dptr, dbit, dbbyte, buffer, 0, bits_per_sample);
for (bi = 0; bi < nbytes * 8; bi += bits_per_sample) {
- for (pi = 0; pi < num_planes; ++pi) {
- const byte *sptr = planes[pi] + offset + (bi >> 3);
- uint value = (*sptr >> (8 - (bi & 7) - bits_per_sample)) & mask;
+ for (pi = 0; pi < num_planes; ++pi) {
+ const byte *sptr = planes[pi] + offset + (bi >> 3);
+ uint value = (*sptr >> (8 - (bi & 7) - bits_per_sample)) & mask;
- sample_store_next8(value, dptr, dbit, bits_per_sample, dbbyte);
- }
+ sample_store_next8(value, dptr, dbit, bits_per_sample, dbbyte);
+ }
}
sample_store_flush(dptr, dbit, bits_per_sample, dbbyte);
return 0;
@@ -323,21 +323,21 @@ flipNx1to8(byte * buffer, const byte ** planes, int offset, int nbytes,
/* Convert NMx12 to Nx12. */
static int
flipNx12(byte * buffer, const byte ** planes, int offset, int nbytes,
- int num_planes, int ignore_bits_per_sample)
+ int num_planes, int ignore_bits_per_sample)
{
/* This is only needed for DeviceN colors, so it can be slow. */
int bi, pi;
sample_store_declare_setup(dptr, dbit, dbbyte, buffer, 0, 12);
for (bi = 0; bi < nbytes * 8; bi += 12) {
- for (pi = 0; pi < num_planes; ++pi) {
- const byte *sptr = planes[pi] + offset + (bi >> 3);
- uint value =
- (bi & 4 ? ((*sptr & 0xf) << 8) | sptr[1] :
- (*sptr << 4) | (sptr[1] >> 4));
-
- sample_store_next_12(value, dptr, dbit, dbbyte);
- }
+ for (pi = 0; pi < num_planes; ++pi) {
+ const byte *sptr = planes[pi] + offset + (bi >> 3);
+ uint value =
+ (bi & 4 ? ((*sptr & 0xf) << 8) | sptr[1] :
+ (*sptr << 4) | (sptr[1] >> 4));
+
+ sample_store_next_12(value, dptr, dbit, dbbyte);
+ }
}
sample_store_flush(dptr, dbit, 12, dbbyte);
return 0;
@@ -363,7 +363,7 @@ static const image_flip_proc image_flip4_procs[13] = {
typedef int (*image_flipN_proc) (byte *, const byte **, int, int, int, int);
static int
flipN_fail(byte * buffer, const byte ** planes, int offset, int nbytes,
- int num_planes, int bits_per_sample)
+ int num_planes, int bits_per_sample)
{
return -1;
}
@@ -376,22 +376,22 @@ static const image_flipN_proc image_flipN_procs[13] = {
/* Here is the public interface to all of the above. */
int
image_flip_planes(byte * buffer, const byte ** planes, int offset, int nbytes,
- int num_planes, int bits_per_sample)
+ int num_planes, int bits_per_sample)
{
if (bits_per_sample < 1 || bits_per_sample > 12)
- return -1;
+ return -1;
switch (num_planes) {
case 3:
- return image_flip3_procs[bits_per_sample]
- (buffer, planes, offset, nbytes);
+ return image_flip3_procs[bits_per_sample]
+ (buffer, planes, offset, nbytes);
case 4:
- return image_flip4_procs[bits_per_sample]
- (buffer, planes, offset, nbytes);
+ return image_flip4_procs[bits_per_sample]
+ (buffer, planes, offset, nbytes);
default:
- if (num_planes < 0)
- return -1;
- return image_flipN_procs[bits_per_sample]
- (buffer, planes, offset, nbytes, num_planes, bits_per_sample);
+ if (num_planes < 0)
+ return -1;
+ return image_flipN_procs[bits_per_sample]
+ (buffer, planes, offset, nbytes, num_planes, bits_per_sample);
}
}
diff --git a/gs/base/gsflip.h b/gs/base/gsflip.h
index d6bac411f..f79b11ec3 100644
--- a/gs/base/gsflip.h
+++ b/gs/base/gsflip.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,7 +27,7 @@
* bits_per_sample is invalid, otherwise 0.
*/
extern int image_flip_planes(byte * buffer, const byte ** planes,
- int offset, int nbytes,
- int num_planes, int bits_per_sample);
+ int offset, int nbytes,
+ int num_planes, int bits_per_sample);
#endif /* gsflip_INCLUDED */
diff --git a/gs/base/gsfname.c b/gs/base/gsfname.c
index 8ec2ceb55..7a0c9849e 100644
--- a/gs/base/gsfname.c
+++ b/gs/base/gsfname.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,27 +34,27 @@ gs_parse_file_name(gs_parsed_file_name_t * pfn, const char *pname, uint len,
gx_io_device *iodev;
if (len == 0)
- return_error(gs_error_undefinedfilename); /* null name not allowed */
+ return_error(gs_error_undefinedfilename); /* null name not allowed */
if (pname[0] != '%') { /* no device */
- pfn->memory = 0;
- pfn->iodev = NULL;
- pfn->fname = pname;
- pfn->len = len;
- return 0;
+ pfn->memory = 0;
+ pfn->iodev = NULL;
+ pfn->fname = pname;
+ pfn->len = len;
+ return 0;
}
pdelim = memchr(pname + 1, '%', len - 1);
if (pdelim == NULL) /* %device */
- dlen = len;
+ dlen = len;
else if (pdelim[1] == 0) { /* %device% */
- pdelim = NULL;
- dlen = len;
+ pdelim = NULL;
+ dlen = len;
} else {
- dlen = pdelim - pname;
- pdelim++, len--;
+ dlen = pdelim - pname;
+ pdelim++, len--;
}
iodev = gs_findiodevice(memory, (const byte *)pname, dlen);
if (iodev == 0)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
pfn->memory = 0;
pfn->iodev = iodev;
pfn->fname = pdelim;
@@ -65,33 +65,33 @@ gs_parse_file_name(gs_parsed_file_name_t * pfn, const char *pname, uint len,
/* Parse a real (non-device) file name and convert to a C string. */
int
gs_parse_real_file_name(gs_parsed_file_name_t * pfn, const char *pname,
- uint len, gs_memory_t *mem, client_name_t cname)
+ uint len, gs_memory_t *mem, client_name_t cname)
{
int code = gs_parse_file_name(pfn, pname, len, mem);
if (code < 0)
- return code;
+ return code;
if (pfn->len == 0) /* device only */
- return_error(gs_error_undefinedfilename); /* for CET 23-23.ps */
+ return_error(gs_error_undefinedfilename); /* for CET 23-23.ps */
return gs_terminate_file_name(pfn, mem, cname);
}
/* Convert a file name to a C string by adding a null terminator. */
int
gs_terminate_file_name(gs_parsed_file_name_t * pfn, gs_memory_t *mem,
- client_name_t cname)
+ client_name_t cname)
{
uint len = pfn->len;
char *fname;
if (pfn->iodev == NULL) /* no device */
- pfn->iodev = iodev_default(mem);
+ pfn->iodev = iodev_default(mem);
if (pfn->memory)
- return 0; /* already copied */
+ return 0; /* already copied */
/* Copy the file name to a C string. */
fname = (char *)gs_alloc_string(mem, len + 1, cname);
if (fname == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(fname, pfn->fname, len);
fname[len] = 0;
pfn->memory = mem;
@@ -105,6 +105,6 @@ void
gs_free_file_name(gs_parsed_file_name_t * pfn, client_name_t cname)
{
if (pfn->fname != 0)
- gs_free_const_string(pfn->memory, (const byte *)pfn->fname, pfn->len,
- cname);
+ gs_free_const_string(pfn->memory, (const byte *)pfn->fname, pfn->len,
+ cname);
}
diff --git a/gs/base/gsfname.h b/gs/base/gsfname.h
index cc6bac3a0..5c80cfa52 100644
--- a/gs/base/gsfname.h
+++ b/gs/base/gsfname.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,11 +44,11 @@ int gs_parse_file_name(gs_parsed_file_name_t *, const char *, uint,
/* Parse a real (non-device) file name and convert to a C string. */
int gs_parse_real_file_name(gs_parsed_file_name_t *, const char *, uint,
- gs_memory_t *, client_name_t);
+ gs_memory_t *, client_name_t);
/* Convert a file name to a C string by adding a null terminator. */
int gs_terminate_file_name(gs_parsed_file_name_t *, gs_memory_t *,
- client_name_t);
+ client_name_t);
/* Free a file name that was copied to a C string. */
void gs_free_file_name(gs_parsed_file_name_t *, client_name_t);
diff --git a/gs/base/gsfont.c b/gs/base/gsfont.c
index 437d6ca57..d4c7acba7 100644
--- a/gs/base/gsfont.c
+++ b/gs/base/gsfont.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -85,7 +85,7 @@ public_st_gs_font_ptr_element();
* relocation phase of the GC. */
/* Font directory GC procedures */
-static
+static
ENUM_PTRS_WITH(font_dir_enum_ptrs, gs_font_dir *dir)
{
/* Enumerate pointers from cached characters to f/m pairs, */
@@ -96,22 +96,22 @@ ENUM_PTRS_WITH(font_dir_enum_ptrs, gs_font_dir *dir)
uint tmask = dir->ccache.table_mask;
if (cci == 0)
- offset = 0, count = 1;
+ offset = 0, count = 1;
else if (cci == dir->enum_index + 1)
- offset = dir->enum_offset + 1, count = 1;
+ offset = dir->enum_offset + 1, count = 1;
else
- offset = 0, count = cci;
+ offset = 0, count = cci;
for (; offset <= tmask; ++offset) {
- cached_char *cc = dir->ccache.table[offset];
-
- if (cc != 0 && !--count) {
- (*dir->ccache.mark_glyph)
- (mem, cc->code, dir->ccache.mark_glyph_data);
- /****** HACK: break const. We'll fix this someday. ******/
- ((gs_font_dir *)dir)->enum_index = cci;
- ((gs_font_dir *)dir)->enum_offset = offset;
- ENUM_RETURN(cc_pair(cc) - cc->pair_index);
- }
+ cached_char *cc = dir->ccache.table[offset];
+
+ if (cc != 0 && !--count) {
+ (*dir->ccache.mark_glyph)
+ (mem, cc->code, dir->ccache.mark_glyph_data);
+ /****** HACK: break const. We'll fix this someday. ******/
+ ((gs_font_dir *)dir)->enum_index = cci;
+ ((gs_font_dir *)dir)->enum_offset = offset;
+ ENUM_RETURN(cc_pair(cc) - cc->pair_index);
+ }
}
}
return 0;
@@ -126,13 +126,13 @@ static RELOC_PTRS_WITH(font_dir_reloc_ptrs, gs_font_dir *dir);
int chi;
for (chi = dir->ccache.table_mask; chi >= 0; --chi) {
- cached_char *cc = dir->ccache.table[chi];
+ cached_char *cc = dir->ccache.table[chi];
- if (cc != 0)
- cc_set_pair_only(cc,
- (cached_fm_pair *)
- RELOC_OBJ(cc_pair(cc) - cc->pair_index) +
- cc->pair_index);
+ if (cc != 0)
+ cc_set_pair_only(cc,
+ (cached_fm_pair *)
+ RELOC_OBJ(cc_pair(cc) - cc->pair_index) +
+ cc->pair_index);
}
}
/* We have to relocate the cached characters before we */
@@ -158,48 +158,48 @@ gs_font_finalize(void *vptr)
gs_font *prev = pfont->prev;
if_debug4('u', "[u]unlinking font 0x%lx, base=0x%lx, prev=0x%lx, next=0x%lx\n",
- (ulong) pfont, (ulong) pfont->base, (ulong) prev, (ulong) next);
+ (ulong) pfont, (ulong) pfont->base, (ulong) prev, (ulong) next);
/* Notify clients that the font is being freed. */
gs_notify_all(&pfont->notify_list, NULL);
gs_purge_font_from_char_caches(pfont);
if (pfont->dir == 0)
- ppfirst = 0;
+ ppfirst = 0;
else if (pfont->base == pfont)
- ppfirst = &pfont->dir->orig_fonts;
+ ppfirst = &pfont->dir->orig_fonts;
else {
- /*
- * Track the number of cached scaled fonts. Only decrement the
- * count if we didn't do this already in gs_makefont.
- */
- if (next || prev || pfont->dir->scaled_fonts == pfont)
- pfont->dir->ssize--;
- ppfirst = &pfont->dir->scaled_fonts;
+ /*
+ * Track the number of cached scaled fonts. Only decrement the
+ * count if we didn't do this already in gs_makefont.
+ */
+ if (next || prev || pfont->dir->scaled_fonts == pfont)
+ pfont->dir->ssize--;
+ ppfirst = &pfont->dir->scaled_fonts;
}
/*
* gs_purge_font may have unlinked this font already:
* don't unlink it twice.
*/
if (next != 0 && next->prev == pfont)
- next->prev = prev;
+ next->prev = prev;
if (prev != 0) {
- if (prev->next == pfont)
- prev->next = next;
+ if (prev->next == pfont)
+ prev->next = next;
} else if (ppfirst != 0 && *ppfirst == pfont)
- *ppfirst = next;
+ *ppfirst = next;
gs_notify_release(&pfont->notify_list);
}
-static
+static
ENUM_PTRS_WITH(font_enum_ptrs, gs_font *pfont) return ENUM_USING(st_gs_notify_list, &pfont->notify_list, sizeof(gs_notify_list_t), index - 5);
- /* We don't enumerate next or prev of base fonts. */
- /* See above for details. */
+ /* We don't enumerate next or prev of base fonts. */
+ /* See above for details. */
case 0: ENUM_RETURN((pfont->base == pfont ? 0 : pfont->next));
case 1: ENUM_RETURN((pfont->base == pfont ? 0 : pfont->prev));
ENUM_PTR3(2, gs_font, dir, base, client_data);
ENUM_PTRS_END
static RELOC_PTRS_WITH(font_reloc_ptrs, gs_font *pfont);
RELOC_USING(st_gs_notify_list, &pfont->notify_list, sizeof(gs_notify_list_t));
- /* We *do* always relocate next and prev. */
- /* Again, see above for details. */
+ /* We *do* always relocate next and prev. */
+ /* Again, see above for details. */
RELOC_PTR(gs_font, next);
RELOC_PTR(gs_font, prev);
RELOC_PTR3(gs_font, dir, base, client_data);
@@ -221,38 +221,38 @@ gs_font_dir_alloc2(gs_memory_t * struct_mem, gs_memory_t * bits_mem)
if (!gs_debug_c('.'))
# endif
{ /* Try allocating a very large cache. */
- /* If this fails, allocate a small one. */
- pdir = gs_font_dir_alloc2_limits(struct_mem, bits_mem,
- smax_LARGE, bmax_LARGE, mmax_LARGE,
- cmax_LARGE, blimit_LARGE);
+ /* If this fails, allocate a small one. */
+ pdir = gs_font_dir_alloc2_limits(struct_mem, bits_mem,
+ smax_LARGE, bmax_LARGE, mmax_LARGE,
+ cmax_LARGE, blimit_LARGE);
}
if (pdir == 0)
#endif
- pdir = gs_font_dir_alloc2_limits(struct_mem, bits_mem,
- smax_SMALL, bmax_SMALL, mmax_SMALL,
- cmax_SMALL, blimit_SMALL);
+ pdir = gs_font_dir_alloc2_limits(struct_mem, bits_mem,
+ smax_SMALL, bmax_SMALL, mmax_SMALL,
+ cmax_SMALL, blimit_SMALL);
if (pdir == 0)
- return 0;
+ return 0;
pdir->ccache.mark_glyph = cc_no_mark_glyph;
pdir->ccache.mark_glyph_data = 0;
return pdir;
}
gs_font_dir *
gs_font_dir_alloc2_limits(gs_memory_t * struct_mem, gs_memory_t * bits_mem,
- uint smax, uint bmax, uint mmax, uint cmax, uint upper)
+ uint smax, uint bmax, uint mmax, uint cmax, uint upper)
{
gs_font_dir *pdir =
- gs_alloc_struct(struct_mem, gs_font_dir, &st_font_dir,
- "font_dir_alloc(dir)");
+ gs_alloc_struct(struct_mem, gs_font_dir, &st_font_dir,
+ "font_dir_alloc(dir)");
int code;
if (pdir == 0)
- return 0;
+ return 0;
code = gx_char_cache_alloc(struct_mem, bits_mem, pdir,
- bmax, mmax, cmax, upper);
+ bmax, mmax, cmax, upper);
if (code < 0) {
- gs_free_object(struct_mem, pdir, "font_dir_alloc(dir)");
- return 0;
+ gs_free_object(struct_mem, pdir, "font_dir_alloc(dir)");
+ return 0;
}
pdir->orig_fonts = 0;
pdir->scaled_fonts = 0;
@@ -274,14 +274,14 @@ gs_font_dir_alloc2_limits(gs_memory_t * struct_mem, gs_memory_t * bits_mem,
/* Allocate and minimally initialize a font. */
gs_font *
gs_font_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
- const gs_font_procs *procs, gs_font_dir *dir,
- client_name_t cname)
+ const gs_font_procs *procs, gs_font_dir *dir,
+ client_name_t cname)
{
gs_font *pfont = gs_alloc_struct(mem, gs_font, pstype, cname);
if (pfont == 0)
- return 0;
-#if 1 /* Clear entire structure to avoid unitialized pointers
+ return 0;
+#if 1 /* Clear entire structure to avoid unitialized pointers
when the initialization exits prematurely by error. */
memset(pfont, 0, pstype->ssize);
pfont->memory = mem;
@@ -290,7 +290,7 @@ gs_font_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
pfont->id = gs_next_ids(mem, 1);
pfont->base = pfont;
pfont->ExactSize = pfont->InBetweenSize = pfont->TransformedChar =
- fbit_use_outlines;
+ fbit_use_outlines;
pfont->procs = *procs;
#else
/* For clarity we leave old initializations here
@@ -306,7 +306,7 @@ gs_font_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
/* not FontMatrix, FontType */
pfont->BitmapWidths = false;
pfont->ExactSize = pfont->InBetweenSize = pfont->TransformedChar =
- fbit_use_outlines;
+ fbit_use_outlines;
pfont->WMode = 0;
pfont->PaintType = 0;
pfont->StrokeWidth = 0;
@@ -320,16 +320,16 @@ gs_font_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
/* Allocate and minimally initialize a base font. */
gs_font_base *
gs_font_base_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
- const gs_font_procs *procs, gs_font_dir *dir,
- client_name_t cname)
+ const gs_font_procs *procs, gs_font_dir *dir,
+ client_name_t cname)
{
gs_font_base *pfont =
- (gs_font_base *)gs_font_alloc(mem, pstype, procs, dir, cname);
+ (gs_font_base *)gs_font_alloc(mem, pstype, procs, dir, cname);
if (pfont == 0)
- return 0;
+ return 0;
pfont->FontBBox.p.x = pfont->FontBBox.p.y =
- pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
+ pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
uid_set_invalid(&pfont->UID);
pfont->encoding_index = pfont->nearest_encoding_index = -1;
return pfont;
@@ -358,7 +358,6 @@ gs_font_notify_init(gs_font *font)
gs_notify_init(&font->notify_list, gs_memory_stable(font->memory));
}
-
/*
* Register/unregister a client for notification by a font. Currently
* the clients are only notified when a font is freed. Note that any
@@ -382,7 +381,7 @@ font_link_first(gs_font **pfirst, gs_font *elt)
gs_font *first = elt->next = *pfirst;
if (first)
- first->prev = elt;
+ first->prev = elt;
elt->prev = 0;
*pfirst = elt;
}
@@ -399,31 +398,31 @@ gs_definefont(gs_font_dir * pdir, gs_font * pfont)
pfont->base = pfont;
code = (*pfont->procs.define_font) (pdir, pfont);
if (code < 0) { /* Make sure we don't try to finalize this font. */
- pfont->base = 0;
- return code;
+ pfont->base = 0;
+ return code;
}
font_link_first(&pdir->orig_fonts, pfont);
if_debug2('m', "[m]defining font 0x%lx, next=0x%lx\n",
- (ulong) pfont, (ulong) pfont->next);
+ (ulong) pfont, (ulong) pfont->next);
return 0;
}
/* Find a sililar registered font of same type. */
int
-gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
- int (*similar)(const gs_font *, const gs_font *))
+gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
+ int (*similar)(const gs_font *, const gs_font *))
{
const gs_font *pfont0 = *ppfont;
const gs_font *pfont1 = pdir->orig_fonts;
for (; pfont1 != NULL; pfont1 = pfont1->next) {
- if (pfont1 != pfont0 && pfont1->FontType == pfont0->FontType) {
- int code = similar(pfont0, pfont1);
- if (code != 0) {
- *ppfont = pfont1;
- return code;
- }
- }
+ if (pfont1 != pfont0 && pfont1->FontType == pfont0->FontType) {
+ int code = similar(pfont0, pfont1);
+ if (code != 0) {
+ *ppfont = pfont1;
+ return code;
+ }
+ }
}
return 0;
}
@@ -431,7 +430,7 @@ gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
/* scalefont */
int
gs_scalefont(gs_font_dir * pdir, const gs_font * pfont, floatp scale,
- gs_font ** ppfont)
+ gs_font ** ppfont)
{
gs_matrix mat;
@@ -442,7 +441,7 @@ gs_scalefont(gs_font_dir * pdir, const gs_font * pfont, floatp scale,
/* makefont */
int
gs_makefont(gs_font_dir * pdir, const gs_font * pfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
int code;
gs_font *prev = 0;
@@ -452,7 +451,7 @@ gs_makefont(gs_font_dir * pdir, const gs_font * pfont,
bool can_cache;
if ((code = gs_matrix_multiply(&pfont->FontMatrix, pmat, &newmat)) < 0)
- return code;
+ return code;
/*
* Check for the font already being in the scaled font cache.
* Until version 5.97, we only cached scaled fonts if the base
@@ -461,20 +460,20 @@ gs_makefont(gs_font_dir * pdir, const gs_font * pfont,
*/
#ifdef DEBUG
if (gs_debug_c('m')) {
- const gs_font_base *const pbfont = (const gs_font_base *)pfont;
-
- if (pfont->FontType == ft_composite)
- dlprintf("[m]composite");
- else if (uid_is_UniqueID(&pbfont->UID))
- dlprintf1("[m]UniqueID=%ld", pbfont->UID.id);
- else if (uid_is_XUID(&pbfont->UID))
- dlprintf1("[m]XUID(%u)", (uint) (-pbfont->UID.id));
- else
- dlprintf("[m]no UID");
- dprintf8(", FontType=%d, base=0x%lx,\n[m] new FontMatrix=[%g %g %g %g %g %g]\n",
- pfont->FontType, (ulong)pfont->base,
- pmat->xx, pmat->xy, pmat->yx, pmat->yy,
- pmat->tx, pmat->ty);
+ const gs_font_base *const pbfont = (const gs_font_base *)pfont;
+
+ if (pfont->FontType == ft_composite)
+ dlprintf("[m]composite");
+ else if (uid_is_UniqueID(&pbfont->UID))
+ dlprintf1("[m]UniqueID=%ld", pbfont->UID.id);
+ else if (uid_is_XUID(&pbfont->UID))
+ dlprintf1("[m]XUID(%u)", (uint) (-pbfont->UID.id));
+ else
+ dlprintf("[m]no UID");
+ dprintf8(", FontType=%d, base=0x%lx,\n[m] new FontMatrix=[%g %g %g %g %g %g]\n",
+ pfont->FontType, (ulong)pfont->base,
+ pmat->xx, pmat->xy, pmat->yx, pmat->yy,
+ pmat->tx, pmat->ty);
}
#endif
/*
@@ -482,27 +481,27 @@ gs_makefont(gs_font_dir * pdir, const gs_font * pfont,
* effects on FDepVector and descendant fonts that occur in makefont.
*/
if (pfont->FontType != ft_composite) {
- for (; pf_out != 0; prev = pf_out, pf_out = pf_out->next)
- if (pf_out->FontType == pfont->FontType &&
- pf_out->base == pfont->base &&
- pf_out->FontMatrix.xx == newmat.xx &&
- pf_out->FontMatrix.xy == newmat.xy &&
- pf_out->FontMatrix.yx == newmat.yx &&
- pf_out->FontMatrix.yy == newmat.yy &&
- pf_out->FontMatrix.tx == newmat.tx &&
- pf_out->FontMatrix.ty == newmat.ty
- ) {
- *ppfont = pf_out;
- if_debug1('m', "[m]found font=0x%lx\n", (ulong) pf_out);
- return 0;
- }
- can_cache = true;
+ for (; pf_out != 0; prev = pf_out, pf_out = pf_out->next)
+ if (pf_out->FontType == pfont->FontType &&
+ pf_out->base == pfont->base &&
+ pf_out->FontMatrix.xx == newmat.xx &&
+ pf_out->FontMatrix.xy == newmat.xy &&
+ pf_out->FontMatrix.yx == newmat.yx &&
+ pf_out->FontMatrix.yy == newmat.yy &&
+ pf_out->FontMatrix.tx == newmat.tx &&
+ pf_out->FontMatrix.ty == newmat.ty
+ ) {
+ *ppfont = pf_out;
+ if_debug1('m', "[m]found font=0x%lx\n", (ulong) pf_out);
+ return 0;
+ }
+ can_cache = true;
} else
- can_cache = false;
+ can_cache = false;
pf_out = gs_alloc_struct(mem, gs_font, gs_object_type(mem, pfont),
- "gs_makefont");
+ "gs_makefont");
if (!pf_out)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(pf_out, pfont, gs_object_size(mem, pfont));
gs_font_notify_init(pf_out);
pf_out->FontMatrix = newmat;
@@ -512,75 +511,75 @@ gs_makefont(gs_font_dir * pdir, const gs_font * pfont,
*ppfont = pf_out;
code = (*pf_out->procs.make_font) (pdir, pfont, pmat, ppfont);
if (code < 0)
- return code;
+ return code;
if (can_cache) {
- if (pdir->ssize >= pdir->smax && prev != 0) {
- /*
- * We must discard a cached scaled font.
- * prev points to the last (oldest) font.
- * (We can't free it, because there might be
- * other references to it.)
- */
- if_debug1('m', "[m]discarding font 0x%lx\n",
- (ulong) prev);
- if (prev->prev != 0)
- prev->prev->next = 0;
- else
- pdir->scaled_fonts = 0;
- pdir->ssize--;
- prev->prev = 0;
- /* This comment is a relatively new reconstruction of old assumptions,
- which were done 5+ years ago (see gsfont.c revision 1.1).
- Here the font is only removed from the pdir->scaled_fonts list
- to prevent the latter to grow huge. Thus the list is used only to
- merge scaled font duplicates by the 'for' loop in the beginning
- of this function. We do not discard related character rasters
- from character cache due to 3 reasons :
- 1. At this point a cached_char instance may be referred
- by one or more gs_show_enum instances, which may exist on the
- PS estack while execution of a Type 3 BuildChar or BuildGlyph.
- Such event really happens while rendering a re-distilled tpc2.ps .
- We must not remove those isntances, but currently there is no
- mechanizm for distinguishing them from othgers.
- 2. If the font has an UID, another scaled font may use same fm_pair
- instance due to different CTMs. Therefore same character rasters
- may be useful for another scaled font.
- 3. We don't know whether the font will be used again in nearest
- future. Maybe it will be used again in the next 'show' operation.
- Therefore we delay the decision about discarding character
- rasters untill we need to release memory from them.
- 4. Also note that the last created font, rather than the last used one,
- is being discarded. An useful improvement would be
- to move a font t the beginning of the list whenever it
- appears in a show-like operation.
- */
+ if (pdir->ssize >= pdir->smax && prev != 0) {
+ /*
+ * We must discard a cached scaled font.
+ * prev points to the last (oldest) font.
+ * (We can't free it, because there might be
+ * other references to it.)
+ */
+ if_debug1('m', "[m]discarding font 0x%lx\n",
+ (ulong) prev);
+ if (prev->prev != 0)
+ prev->prev->next = 0;
+ else
+ pdir->scaled_fonts = 0;
+ pdir->ssize--;
+ prev->prev = 0;
+ /* This comment is a relatively new reconstruction of old assumptions,
+ which were done 5+ years ago (see gsfont.c revision 1.1).
+ Here the font is only removed from the pdir->scaled_fonts list
+ to prevent the latter to grow huge. Thus the list is used only to
+ merge scaled font duplicates by the 'for' loop in the beginning
+ of this function. We do not discard related character rasters
+ from character cache due to 3 reasons :
+ 1. At this point a cached_char instance may be referred
+ by one or more gs_show_enum instances, which may exist on the
+ PS estack while execution of a Type 3 BuildChar or BuildGlyph.
+ Such event really happens while rendering a re-distilled tpc2.ps .
+ We must not remove those isntances, but currently there is no
+ mechanizm for distinguishing them from othgers.
+ 2. If the font has an UID, another scaled font may use same fm_pair
+ instance due to different CTMs. Therefore same character rasters
+ may be useful for another scaled font.
+ 3. We don't know whether the font will be used again in nearest
+ future. Maybe it will be used again in the next 'show' operation.
+ Therefore we delay the decision about discarding character
+ rasters untill we need to release memory from them.
+ 4. Also note that the last created font, rather than the last used one,
+ is being discarded. An useful improvement would be
+ to move a font t the beginning of the list whenever it
+ appears in a show-like operation.
+ */
#if 0 /* We disabled this code portion due to Bug 688392.
- The problem was dangling pointers, which appear in fm_pair instances
- after uid_free is applied to a font's UID,
- because they share same xvalues array. We're unable to guess
- for which reason uid_free was applied to the font's UID here
- 5+ years ago (see gsfont.c revision 1.1).
- We do not remove this code portion until we get
- a complete understanding.
- */
- if (prev->FontType != ft_composite) {
- if_debug1('m', "[m]discarding UID 0x%lx\n",
- (ulong) ((gs_font_base *) prev)->
- UID.xvalues);
- uid_free(&((gs_font_base *) prev)->UID,
- prev->memory,
- "gs_makefont(discarding)");
- uid_set_invalid(&((gs_font_base *) prev)->UID);
- }
+ The problem was dangling pointers, which appear in fm_pair instances
+ after uid_free is applied to a font's UID,
+ because they share same xvalues array. We're unable to guess
+ for which reason uid_free was applied to the font's UID here
+ 5+ years ago (see gsfont.c revision 1.1).
+ We do not remove this code portion until we get
+ a complete understanding.
+ */
+ if (prev->FontType != ft_composite) {
+ if_debug1('m', "[m]discarding UID 0x%lx\n",
+ (ulong) ((gs_font_base *) prev)->
+ UID.xvalues);
+ uid_free(&((gs_font_base *) prev)->UID,
+ prev->memory,
+ "gs_makefont(discarding)");
+ uid_set_invalid(&((gs_font_base *) prev)->UID);
+ }
#endif
- }
- pdir->ssize++;
- font_link_first(&pdir->scaled_fonts, pf_out);
+ }
+ pdir->ssize++;
+ font_link_first(&pdir->scaled_fonts, pf_out);
} else { /* Prevent garbage pointers. */
- pf_out->next = pf_out->prev = 0;
+ pf_out->next = pf_out->prev = 0;
}
if_debug2('m', "[m]new font=0x%lx can_cache=%s\n",
- (ulong) * ppfont, (can_cache ? "true" : "false"));
+ (ulong) * ppfont, (can_cache ? "true" : "false"));
return 1;
}
@@ -652,7 +651,7 @@ gs_setcachelower(gs_font_dir * pdir, uint size)
}
int
gs_setcacheupper(gs_font_dir * pdir, uint size)
-{
+{
pdir->ccache.upper = ((int)size < 0) ? 0 : size; /* ?: for CET 27-06 */
return 0;
}
@@ -709,27 +708,27 @@ gs_purge_font(gs_font * pfont)
gs_font *next = pfont->next;
if (next != 0)
- next->prev = prev, pfont->next = 0;
+ next->prev = prev, pfont->next = 0;
if (prev != 0)
- prev->next = next, pfont->prev = 0;
+ prev->next = next, pfont->prev = 0;
else if (pdir->orig_fonts == pfont)
- pdir->orig_fonts = next;
+ pdir->orig_fonts = next;
else if (pdir->scaled_fonts == pfont)
- pdir->scaled_fonts = next;
+ pdir->scaled_fonts = next;
else { /* Shouldn't happen! */
- lprintf1("purged font 0x%lx not found\n", (ulong) pfont);
+ lprintf1("purged font 0x%lx not found\n", (ulong) pfont);
}
/* Purge the font from the scaled font cache. */
for (pf = pdir->scaled_fonts; pf != 0;) {
- if (pf->base == pfont) {
- int code = gs_purge_font(pf);
-
- if (code < 0)
- return code;
- pf = pdir->scaled_fonts; /* start over */
- } else
- pf = pf->next;
+ if (pf->base == pfont) {
+ int code = gs_purge_font(pf);
+
+ if (code < 0)
+ return code;
+ pf = pdir->scaled_fonts; /* start over */
+ } else
+ pf = pf->next;
}
/* Purge the font from the font/matrix pair cache, */
@@ -744,9 +743,9 @@ gs_find_font_by_id(gs_font_dir *pdir, gs_id id, gs_matrix *FontMatrix)
gs_font *pfont = pdir->orig_fonts;
for(; pfont != NULL; pfont = pfont->next)
- if(pfont->id == id &&
- !memcmp(&pfont->FontMatrix, FontMatrix, sizeof(pfont->FontMatrix)))
- return pfont;
+ if(pfont->id == id &&
+ !memcmp(&pfont->FontMatrix, FontMatrix, sizeof(pfont->FontMatrix)))
+ return pfont;
return NULL;
}
@@ -764,23 +763,23 @@ gs_no_define_font(gs_font_dir * pdir, gs_font * pfont)
/* Default (vacuous) makefont handler. */
int
gs_no_make_font(gs_font_dir * pdir, const gs_font * pfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
return 0;
}
/* Makefont handler for base fonts, which must copy the XUID. */
int
gs_base_make_font(gs_font_dir * pdir, const gs_font * pfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
return uid_copy(&((gs_font_base *)*ppfont)->UID, (*ppfont)->memory,
- "gs_base_make_font(XUID)");
+ "gs_base_make_font(XUID)");
}
/* Default font info procedure */
int
gs_default_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
int wmode = font->WMode;
gs_font_base *bfont = (gs_font_base *)font;
@@ -789,102 +788,102 @@ gs_default_font_info(gs_font *font, const gs_point *pscale, int members,
const gs_matrix *pmat;
if (pscale == 0) {
- scale.x = scale.y = 0;
- pmat = 0;
+ scale.x = scale.y = 0;
+ pmat = 0;
} else {
- scale = *pscale;
- gs_make_scaling(scale.x, scale.y, &smat);
- pmat = &smat;
+ scale = *pscale;
+ gs_make_scaling(scale.x, scale.y, &smat);
+ pmat = &smat;
}
info->members = 0;
if (members & FONT_INFO_FLAGS)
- info->Flags_returned = 0;
+ info->Flags_returned = 0;
if (font->FontType == ft_composite)
- return 0; /* nothing available */
+ return 0; /* nothing available */
if (members & FONT_INFO_BBOX) {
- info->BBox.p.x = (int)bfont->FontBBox.p.x;
- info->BBox.p.y = (int)bfont->FontBBox.p.y;
- info->BBox.q.x = (int)bfont->FontBBox.q.x;
- info->BBox.q.y = (int)bfont->FontBBox.q.y;
- info->Flags_returned |= FONT_INFO_BBOX;
+ info->BBox.p.x = (int)bfont->FontBBox.p.x;
+ info->BBox.p.y = (int)bfont->FontBBox.p.y;
+ info->BBox.q.x = (int)bfont->FontBBox.q.x;
+ info->BBox.q.y = (int)bfont->FontBBox.q.y;
+ info->Flags_returned |= FONT_INFO_BBOX;
}
if ((members & FONT_INFO_FLAGS) &&
- (info->Flags_requested & FONT_IS_FIXED_WIDTH)
- ) {
- /*
- * Scan the glyph space to compute the fixed width if any.
- */
- gs_glyph notdef = gs_no_glyph;
- gs_glyph glyph;
- int fixed_width = 0;
- int index;
- int code = 0; /* Quiet compiler. */
- int ecode = 0;
- bool has_glyphs = false;
-
- for (index = 0;
- fixed_width >= 0 &&
- (code = font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME, &glyph)) >= 0 &&
- index != 0;
- ) {
- gs_glyph_info_t glyph_info;
-
- code = font->procs.glyph_info(font, glyph, pmat,
- (GLYPH_INFO_WIDTH0 << wmode),
- &glyph_info);
- if (code < 0) {
- ecode = code;
- continue;
- }
- if (notdef == gs_no_glyph && gs_font_glyph_is_notdef(bfont, glyph)) {
- notdef = glyph;
- info->MissingWidth = (int)glyph_info.width[wmode].x;
- info->members |= FONT_INFO_MISSING_WIDTH;
- }
- if (glyph_info.width[wmode].y != 0)
- fixed_width = min_int;
- else if (fixed_width == 0)
- fixed_width = (int)glyph_info.width[wmode].x;
- else if (glyph_info.width[wmode].x != fixed_width)
- fixed_width = min_int;
- has_glyphs = true;
- }
- if (ecode < 0 && !has_glyphs)
- return ecode;
- if (fixed_width > 0) {
- info->Flags |= FONT_IS_FIXED_WIDTH;
- info->members |= FONT_INFO_AVG_WIDTH | FONT_INFO_MAX_WIDTH |
- FONT_INFO_MISSING_WIDTH;
- info->AvgWidth = info->MaxWidth = info->MissingWidth = fixed_width;
- }
- info->Flags_returned |= FONT_IS_FIXED_WIDTH;
+ (info->Flags_requested & FONT_IS_FIXED_WIDTH)
+ ) {
+ /*
+ * Scan the glyph space to compute the fixed width if any.
+ */
+ gs_glyph notdef = gs_no_glyph;
+ gs_glyph glyph;
+ int fixed_width = 0;
+ int index;
+ int code = 0; /* Quiet compiler. */
+ int ecode = 0;
+ bool has_glyphs = false;
+
+ for (index = 0;
+ fixed_width >= 0 &&
+ (code = font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME, &glyph)) >= 0 &&
+ index != 0;
+ ) {
+ gs_glyph_info_t glyph_info;
+
+ code = font->procs.glyph_info(font, glyph, pmat,
+ (GLYPH_INFO_WIDTH0 << wmode),
+ &glyph_info);
+ if (code < 0) {
+ ecode = code;
+ continue;
+ }
+ if (notdef == gs_no_glyph && gs_font_glyph_is_notdef(bfont, glyph)) {
+ notdef = glyph;
+ info->MissingWidth = (int)glyph_info.width[wmode].x;
+ info->members |= FONT_INFO_MISSING_WIDTH;
+ }
+ if (glyph_info.width[wmode].y != 0)
+ fixed_width = min_int;
+ else if (fixed_width == 0)
+ fixed_width = (int)glyph_info.width[wmode].x;
+ else if (glyph_info.width[wmode].x != fixed_width)
+ fixed_width = min_int;
+ has_glyphs = true;
+ }
+ if (ecode < 0 && !has_glyphs)
+ return ecode;
+ if (fixed_width > 0) {
+ info->Flags |= FONT_IS_FIXED_WIDTH;
+ info->members |= FONT_INFO_AVG_WIDTH | FONT_INFO_MAX_WIDTH |
+ FONT_INFO_MISSING_WIDTH;
+ info->AvgWidth = info->MaxWidth = info->MissingWidth = fixed_width;
+ }
+ info->Flags_returned |= FONT_IS_FIXED_WIDTH;
} else if (members & FONT_INFO_MISSING_WIDTH) {
- gs_glyph glyph;
- int index;
-
- for (index = 0;
- font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME, &glyph) >= 0 &&
- index != 0;
- ) {
- /*
- * If this is a CIDFont or TrueType font that uses integers as
- * glyph names, check for glyph 0; otherwise, check for .notdef.
- */
- if (!gs_font_glyph_is_notdef(bfont, glyph))
- continue;
- {
- gs_glyph_info_t glyph_info;
- int code = font->procs.glyph_info(font, glyph, pmat,
- (GLYPH_INFO_WIDTH0 << wmode),
- &glyph_info);
-
- if (code < 0)
- return code;
- info->MissingWidth = (int)glyph_info.width[wmode].x;
- info->members |= FONT_INFO_MISSING_WIDTH;
- break;
- }
- }
+ gs_glyph glyph;
+ int index;
+
+ for (index = 0;
+ font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME, &glyph) >= 0 &&
+ index != 0;
+ ) {
+ /*
+ * If this is a CIDFont or TrueType font that uses integers as
+ * glyph names, check for glyph 0; otherwise, check for .notdef.
+ */
+ if (!gs_font_glyph_is_notdef(bfont, glyph))
+ continue;
+ {
+ gs_glyph_info_t glyph_info;
+ int code = font->procs.glyph_info(font, glyph, pmat,
+ (GLYPH_INFO_WIDTH0 << wmode),
+ &glyph_info);
+
+ if (code < 0)
+ return code;
+ info->MissingWidth = (int)glyph_info.width[wmode].x;
+ info->members |= FONT_INFO_MISSING_WIDTH;
+ break;
+ }
+ }
}
return 0;
}
@@ -894,11 +893,11 @@ int
gs_default_same_font(const gs_font *font, const gs_font *ofont, int mask)
{
while (font->base != font)
- font = font->base;
+ font = font->base;
while (ofont->base != ofont)
- ofont = ofont->base;
+ ofont = ofont->base;
if (ofont == font)
- return mask;
+ return mask;
/* In general, we can't determine similarity. */
return 0;
}
@@ -908,17 +907,17 @@ gs_base_same_font(const gs_font *font, const gs_font *ofont, int mask)
int same = gs_default_same_font(font, ofont, mask);
if (!same) {
- const gs_font_base *const bfont = (const gs_font_base *)font;
- const gs_font_base *const obfont = (const gs_font_base *)ofont;
-
- if (mask & FONT_SAME_ENCODING) {
- if (bfont->encoding_index != ENCODING_INDEX_UNKNOWN ||
- obfont->encoding_index != ENCODING_INDEX_UNKNOWN
- ) {
- if (bfont->encoding_index == obfont->encoding_index)
- same |= FONT_SAME_ENCODING;
- }
- }
+ const gs_font_base *const bfont = (const gs_font_base *)font;
+ const gs_font_base *const obfont = (const gs_font_base *)ofont;
+
+ if (mask & FONT_SAME_ENCODING) {
+ if (bfont->encoding_index != ENCODING_INDEX_UNKNOWN ||
+ obfont->encoding_index != ENCODING_INDEX_UNKNOWN
+ ) {
+ if (bfont->encoding_index == obfont->encoding_index)
+ same |= FONT_SAME_ENCODING;
+ }
+ }
}
return same;
}
@@ -935,11 +934,11 @@ gs_font_glyph_is_notdef(gs_font_base *bfont, gs_glyph glyph)
gs_const_string gnstr;
if (glyph == gs_no_glyph)
- return false;
+ return false;
if (glyph >= gs_min_cid_glyph)
- return (glyph == gs_min_cid_glyph);
+ return (glyph == gs_min_cid_glyph);
return (bfont->procs.glyph_name((gs_font *)bfont, glyph, &gnstr) >= 0 &&
- gnstr.size == 7 && !memcmp(gnstr.data, ".notdef", 7));
+ gnstr.size == 7 && !memcmp(gnstr.data, ".notdef", 7));
}
/* Dummy character encoding procedure */
@@ -959,7 +958,7 @@ gs_no_decode_glyph(gs_font *pfont, gs_glyph glyph, int ch)
/* Dummy glyph enumeration procedure */
int
gs_no_enumerate_glyph(gs_font *font, int *pindex, gs_glyph_space_t glyph_space,
- gs_glyph *pglyph)
+ gs_glyph *pglyph)
{
return_error(gs_error_undefined);
}
@@ -967,7 +966,7 @@ gs_no_enumerate_glyph(gs_font *font, int *pindex, gs_glyph_space_t glyph_space,
/* Default glyph info procedure */
int
gs_default_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{ /* WMode may be inherited from an upper font. */
gx_path path;
int returned = 0;
@@ -975,69 +974,69 @@ gs_default_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
int wmode = ((members & GLYPH_INFO_WIDTH1) != 0);
double sbw[4] = {0, 0, 0, 0};
/* Currently glyph_outline retrieves sbw only with type 1,2,9 fonts. */
- bool charstrings_font = (font->FontType == ft_encrypted ||
- font->FontType == ft_encrypted2 ||
- font->FontType == ft_CID_encrypted);
+ bool charstrings_font = (font->FontType == ft_encrypted ||
+ font->FontType == ft_encrypted2 ||
+ font->FontType == ft_CID_encrypted);
gx_path_init_bbox_accumulator(&path);
code = gx_path_add_point(&path, fixed_0, fixed_0);
if (code < 0)
- goto out;
+ goto out;
code = font->procs.glyph_outline(font, wmode, glyph, pmat, &path, sbw);
if (code < 0)
- goto out;
+ goto out;
if (members & GLYPH_INFO_WIDTHS) {
- int wmode = font->WMode;
- int wmask = GLYPH_INFO_WIDTH0 << wmode;
-
- if (members & wmask) {
- gs_fixed_point pt;
-
- code = gx_path_current_point(&path, &pt);
- if (code < 0)
- goto out;
- info->width[wmode].x = fixed2float(pt.x);
- info->width[wmode].y = fixed2float(pt.y);
- returned |= wmask;
- }
+ int wmode = font->WMode;
+ int wmask = GLYPH_INFO_WIDTH0 << wmode;
+
+ if (members & wmask) {
+ gs_fixed_point pt;
+
+ code = gx_path_current_point(&path, &pt);
+ if (code < 0)
+ goto out;
+ info->width[wmode].x = fixed2float(pt.x);
+ info->width[wmode].y = fixed2float(pt.y);
+ returned |= wmask;
+ }
}
if (members & GLYPH_INFO_BBOX) {
- gs_fixed_rect bbox;
-
- code = gx_path_bbox(&path, &bbox);
- if (code < 0)
- goto out;
- info->bbox.p.x = fixed2float(bbox.p.x);
- info->bbox.p.y = fixed2float(bbox.p.y);
- info->bbox.q.x = fixed2float(bbox.q.x);
- info->bbox.q.y = fixed2float(bbox.q.y);
- returned |= GLYPH_INFO_BBOX;
+ gs_fixed_rect bbox;
+
+ code = gx_path_bbox(&path, &bbox);
+ if (code < 0)
+ goto out;
+ info->bbox.p.x = fixed2float(bbox.p.x);
+ info->bbox.p.y = fixed2float(bbox.p.y);
+ info->bbox.q.x = fixed2float(bbox.q.x);
+ info->bbox.q.y = fixed2float(bbox.q.y);
+ returned |= GLYPH_INFO_BBOX;
}
if (members & (GLYPH_INFO_WIDTH0 << wmode) && charstrings_font) {
- if (pmat == 0) {
- info->width[wmode].x = sbw[2];
- info->width[wmode].y = sbw[3];
- } else {
- code = gs_distance_transform(sbw[2], sbw[3], pmat, &info->width[wmode]);
- if (code < 0)
- return code;
- }
- returned |= GLYPH_INFO_WIDTH0 << wmode;
+ if (pmat == 0) {
+ info->width[wmode].x = sbw[2];
+ info->width[wmode].y = sbw[3];
+ } else {
+ code = gs_distance_transform(sbw[2], sbw[3], pmat, &info->width[wmode]);
+ if (code < 0)
+ return code;
+ }
+ returned |= GLYPH_INFO_WIDTH0 << wmode;
}
if (members & (GLYPH_INFO_VVECTOR0 << wmode) && charstrings_font) {
- if (pmat == 0) {
- info->v.x = sbw[0];
- info->v.y = sbw[1];
- } else {
- code = gs_distance_transform(sbw[0], sbw[1], pmat, &info->v);
- if (code < 0)
- return code;
- }
- returned |= GLYPH_INFO_VVECTOR0 << wmode;
+ if (pmat == 0) {
+ info->v.x = sbw[0];
+ info->v.y = sbw[1];
+ } else {
+ code = gs_distance_transform(sbw[0], sbw[1], pmat, &info->v);
+ if (code < 0)
+ return code;
+ }
+ returned |= GLYPH_INFO_VVECTOR0 << wmode;
}
if (members & GLYPH_INFO_NUM_PIECES) {
- info->num_pieces = 0;
- returned |= GLYPH_INFO_NUM_PIECES;
+ info->num_pieces = 0;
+ returned |= GLYPH_INFO_NUM_PIECES;
}
returned |= members & GLYPH_INFO_PIECES; /* no pieces stored */
out:
@@ -1048,7 +1047,7 @@ gs_default_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
/* Dummy glyph outline procedure */
int
gs_no_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
return_error(gs_error_undefined);
}
diff --git a/gs/base/gsfont.h b/gs/base/gsfont.h
index 0f5d728ea..e1815f15b 100644
--- a/gs/base/gsfont.h
+++ b/gs/base/gsfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,11 +40,11 @@ typedef struct gs_font_s gs_font;
/* Initialization */
/* These procedures return 0 if they fail. */
gs_font_dir *gs_font_dir_alloc2(gs_memory_t * struct_mem,
- gs_memory_t * bits_mem);
+ gs_memory_t * bits_mem);
gs_font_dir *gs_font_dir_alloc2_limits(gs_memory_t * struct_mem,
- gs_memory_t * bits_mem,
- uint smax, uint bmax, uint mmax,
- uint cmax, uint upper);
+ gs_memory_t * bits_mem,
+ uint smax, uint bmax, uint mmax,
+ uint cmax, uint upper);
/* Backward compatibility */
#define gs_font_dir_alloc(mem) gs_font_dir_alloc2(mem, mem)
@@ -56,8 +56,8 @@ gs_font_dir *gs_font_dir_alloc2_limits(gs_memory_t * struct_mem,
int gs_definefont(gs_font_dir *, gs_font *);
/* Find a sililar registered font of same type. */
-int gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
- int (*similar)(const gs_font *, const gs_font *));
+int gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
+ int (*similar)(const gs_font *, const gs_font *));
/* gs_scalefont and gs_makefont return 0 if the scaled font */
/* was already in the cache, 1 if a new font was created. */
diff --git a/gs/base/gsfont0.c b/gs/base/gsfont0.c
index 273c4e886..7326e3526 100644
--- a/gs/base/gsfont0.c
+++ b/gs/base/gsfont0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ static struct_proc_enum_ptrs(font_type0_enum_ptrs);
static struct_proc_reloc_ptrs(font_type0_reloc_ptrs);
public_st_gs_font_type0();
-static
+static
ENUM_PTRS_WITH(font_type0_enum_ptrs, gs_font_type0 *pfont)
ENUM_PREFIX(st_gs_font, gs_type0_data_max_ptrs);
ENUM_PTR(0, gs_font_type0, data.Encoding);
@@ -39,12 +39,12 @@ case 2:
switch (pfont->data.FMapType)
{
case fmap_SubsVector:
- ENUM_RETURN_CONST_STRING_PTR(gs_font_type0,
- data.SubsVector);
+ ENUM_RETURN_CONST_STRING_PTR(gs_font_type0,
+ data.SubsVector);
case fmap_CMap:
- ENUM_RETURN_PTR(gs_font_type0, data.CMap);
+ ENUM_RETURN_PTR(gs_font_type0, data.CMap);
default:
- ENUM_RETURN(0);
+ ENUM_RETURN(0);
}
ENUM_PTRS_END
static RELOC_PTRS_WITH(font_type0_reloc_ptrs, gs_font_type0 *pfont)
@@ -68,7 +68,7 @@ RELOC_PTRS_END
/* to the FontMatrix of all descendant composite fonts. */
static int
gs_type0_adjust_matrix(gs_font_dir * pdir, gs_font_type0 * pfont,
- const gs_matrix * pmat)
+ const gs_matrix * pmat)
{
gs_font **pdep = pfont->data.FDepVector;
uint fdep_size = pfont->data.fdep_size;
@@ -77,23 +77,23 @@ gs_type0_adjust_matrix(gs_font_dir * pdir, gs_font_type0 * pfont,
/* Check for any descendant composite fonts. */
for (i = 0; i < fdep_size; i++)
- if (pdep[i]->FontType == ft_composite)
- break;
+ if (pdep[i]->FontType == ft_composite)
+ break;
if (i == fdep_size)
- return 0;
+ return 0;
ptdep = gs_alloc_struct_array(pfont->memory, fdep_size, gs_font *,
- &st_gs_font_ptr_element,
- "gs_type0_adjust_font(FDepVector)");
+ &st_gs_font_ptr_element,
+ "gs_type0_adjust_font(FDepVector)");
if (ptdep == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(ptdep, pdep, sizeof(gs_font *) * fdep_size);
for (; i < fdep_size; i++)
- if (pdep[i]->FontType == ft_composite) {
- int code = gs_makefont(pdir, pdep[i], pmat, &ptdep[i]);
+ if (pdep[i]->FontType == ft_composite) {
+ int code = gs_makefont(pdir, pdep[i], pmat, &ptdep[i]);
- if (code < 0)
- return code;
- }
+ if (code < 0)
+ return code;
+ }
pfont->data.FDepVector = ptdep;
return 0;
}
@@ -107,17 +107,17 @@ gs_type0_define_font(gs_font_dir * pdir, gs_font * pfont)
/* Check for the identity matrix, which is common in root fonts. */
if (pmat->xx == 1.0 && pmat->yy == 1.0 &&
- pmat->xy == 0.0 && pmat->yx == 0.0 &&
- pmat->tx == 0.0 && pmat->ty == 0.0
- )
- return 0;
+ pmat->xy == 0.0 && pmat->yx == 0.0 &&
+ pmat->tx == 0.0 && pmat->ty == 0.0
+ )
+ return 0;
return gs_type0_adjust_matrix(pdir, (gs_font_type0 *) pfont, pmat);
}
/* Finish scaling a composite font similarly. */
int
gs_type0_make_font(gs_font_dir * pdir, const gs_font * pfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
return gs_type0_adjust_matrix(pdir, (gs_font_type0 *) * ppfont, pmat);
}
diff --git a/gs/base/gsfont0c.c b/gs/base/gsfont0c.c
index e708335ea..43f426256 100644
--- a/gs/base/gsfont0c.c
+++ b/gs/base/gsfont0c.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,30 +27,30 @@
/* Create a Type 0 wrapper for a CIDFont/CMap pair. */
static int
type0_from_cidfont_cmap(gs_font_type0 **ppfont0, gs_font *font,
- gs_cmap_t *pcmap, int wmode, const gs_matrix *psmat,
- gs_memory_t *mem)
+ gs_cmap_t *pcmap, int wmode, const gs_matrix *psmat,
+ gs_memory_t *mem)
{
gs_font_type0 *font0 = (gs_font_type0 *)
- gs_font_alloc(mem, &st_gs_font_type0, &gs_font_procs_default, NULL,
- "gs_type0_from_cidfont(font)");
+ gs_font_alloc(mem, &st_gs_font_type0, &gs_font_procs_default, NULL,
+ "gs_type0_from_cidfont(font)");
/* We allocate Encoding dynamically only for the sake of the GC. */
uint *encoding = (uint *)
- gs_alloc_bytes(mem, sizeof(uint), "gs_type0_from_cidfont(Encoding)");
+ gs_alloc_bytes(mem, sizeof(uint), "gs_type0_from_cidfont(Encoding)");
gs_font **fdep =
- gs_alloc_struct_array(mem, 1, gs_font *, &st_gs_font_ptr_element,
- "gs_type0_from_cidfont(FDepVector)");
+ gs_alloc_struct_array(mem, 1, gs_font *, &st_gs_font_ptr_element,
+ "gs_type0_from_cidfont(FDepVector)");
int code;
if (font0 == 0 || encoding == 0 || fdep == 0) {
- gs_free_object(mem, fdep, "gs_type0_from_cidfont(FDepVector)");
- gs_free_object(mem, encoding, "gs_type0_from_cidfont(Encoding)");
- gs_free_object(mem, font0, "gs_type0_from_cidfont(font)");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, fdep, "gs_type0_from_cidfont(FDepVector)");
+ gs_free_object(mem, encoding, "gs_type0_from_cidfont(Encoding)");
+ gs_free_object(mem, font0, "gs_type0_from_cidfont(font)");
+ return_error(gs_error_VMerror);
}
if (psmat)
- font0->FontMatrix = *psmat;
+ font0->FontMatrix = *psmat;
else
- gs_make_identity(&font0->FontMatrix);
+ gs_make_identity(&font0->FontMatrix);
font0->FontType = ft_composite;
font0->procs.init_fstack = gs_type0_init_fstack;
font0->procs.define_font = gs_no_define_font;
@@ -70,7 +70,7 @@ type0_from_cidfont_cmap(gs_font_type0 **ppfont0, gs_font *font,
font0->data.SubsVector.size = 0;
code = gs_definefont(font->dir, (gs_font *)font0);
if (code < 0)
- return code;
+ return code;
*ppfont0 = font0;
return 0;
}
@@ -80,17 +80,17 @@ type0_from_cidfont_cmap(gs_font_type0 **ppfont0, gs_font *font,
/* Create a Type 0 wrapper for a CIDFont. */
int
gs_font_type0_from_cidfont(gs_font_type0 **ppfont0, gs_font *font, int wmode,
- const gs_matrix *psmat, gs_memory_t *mem)
+ const gs_matrix *psmat, gs_memory_t *mem)
{
gs_cmap_t *pcmap;
int code = gs_cmap_create_identity(&pcmap, 2, wmode, mem);
if (code < 0)
- return code;
+ return code;
code = type0_from_cidfont_cmap(ppfont0, font, pcmap, wmode, psmat, mem);
if (code < 0) {
- gs_free_object(mem, pcmap, "gs_font_type0_from_cidfont(CMap)");
- /****** FREE SUBSTRUCTURES -- HOW? ******/
+ gs_free_object(mem, pcmap, "gs_font_type0_from_cidfont(CMap)");
+ /****** FREE SUBSTRUCTURES -- HOW? ******/
}
return code;
}
@@ -102,30 +102,30 @@ gs_font_type0_from_cidfont(gs_font_type0 **ppfont0, gs_font *font, int wmode,
*/
int
gs_font_type0_from_type42(gs_font_type0 **ppfont0, gs_font_type42 *pfont42,
- int wmode, bool use_cmap, gs_memory_t *mem)
+ int wmode, bool use_cmap, gs_memory_t *mem)
{
gs_font_cid2 *pfcid;
gs_font_type0 *pfont0;
int code = gs_font_cid2_from_type42(&pfcid, pfont42, wmode, mem);
if (code < 0)
- return code;
+ return code;
if (use_cmap) {
- gs_cmap_t *pcmap;
+ gs_cmap_t *pcmap;
- code = gs_cmap_from_type42_cmap(&pcmap, pfont42, wmode, mem);
- if (code < 0)
- return code;
- code = type0_from_cidfont_cmap(&pfont0, (gs_font *)pfcid, pcmap,
- wmode, NULL, mem);
+ code = gs_cmap_from_type42_cmap(&pcmap, pfont42, wmode, mem);
+ if (code < 0)
+ return code;
+ code = type0_from_cidfont_cmap(&pfont0, (gs_font *)pfcid, pcmap,
+ wmode, NULL, mem);
} else {
- code = gs_font_type0_from_cidfont(&pfont0, (gs_font *)pfcid, wmode,
- NULL, mem);
+ code = gs_font_type0_from_cidfont(&pfont0, (gs_font *)pfcid, wmode,
+ NULL, mem);
}
if (code < 0) {
- gs_free_object(mem, pfcid, "gs_type0_from_type42(CIDFont)");
- /****** FREE SUBSTRUCTURES -- HOW? ******/
- return code;
+ gs_free_object(mem, pfcid, "gs_type0_from_type42(CIDFont)");
+ /****** FREE SUBSTRUCTURES -- HOW? ******/
+ return code;
}
*ppfont0 = pfont0;
diff --git a/gs/base/gsfunc.c b/gs/base/gsfunc.c
index c980ffc27..78a2382cc 100644
--- a/gs/base/gsfunc.c
+++ b/gs/base/gsfunc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,24 +23,24 @@
/* GC descriptors */
public_st_function();
gs_private_st_ptr(st_function_ptr, gs_function_t *, "gs_function_t *",
- function_ptr_enum_ptrs, function_ptr_reloc_ptrs);
+ function_ptr_enum_ptrs, function_ptr_reloc_ptrs);
gs_private_st_element(st_function_ptr_element, gs_function_t *,
- "gs_function_t *[]", function_ptr_element_enum_ptrs,
- function_ptr_element_reloc_ptrs, st_function_ptr);
+ "gs_function_t *[]", function_ptr_element_enum_ptrs,
+ function_ptr_element_reloc_ptrs, st_function_ptr);
/* Allocate an array of function pointers. */
int
alloc_function_array(uint count, gs_function_t *** pFunctions,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
gs_function_t **ptr;
if (count == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
ptr = gs_alloc_struct_array(mem, count, gs_function_t *,
- &st_function_ptr_element, "Functions");
+ &st_function_ptr_element, "Functions");
if (ptr == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(ptr, 0, sizeof(*ptr) * count);
*pFunctions = ptr;
return 0;
@@ -59,7 +59,7 @@ void
fn_common_free(gs_function_t * pfn, bool free_params, gs_memory_t * mem)
{
if (free_params)
- gs_function_free_params(pfn, mem);
+ gs_function_free_params(pfn, mem);
gs_free_object(mem, pfn, "fn_common_free");
}
@@ -70,14 +70,14 @@ fn_check_mnDR(const gs_function_params_t * params, int m, int n)
int i;
if (m <= 0 || n <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; i < m; ++i)
- if (params->Domain[2 * i] > params->Domain[2 * i + 1])
- return_error(gs_error_rangecheck);
+ if (params->Domain[2 * i] > params->Domain[2 * i + 1])
+ return_error(gs_error_rangecheck);
if (params->Range != 0)
- for (i = 0; i < n; ++i)
- if (params->Range[2 * i] > params->Range[2 * i + 1])
- return_error(gs_error_rangecheck);
+ for (i = 0; i < n; ++i)
+ if (params->Range[2 * i] > params->Range[2 * i + 1])
+ return_error(gs_error_rangecheck);
return 0;
}
@@ -99,16 +99,16 @@ fn_common_get_params(const gs_function_t *pfn, gs_param_list *plist)
int code;
if (pfn->params.Domain) {
- code = param_write_float_values(plist, "Domain", pfn->params.Domain,
- 2 * pfn->params.m, false);
- if (code < 0)
- ecode = code;
+ code = param_write_float_values(plist, "Domain", pfn->params.Domain,
+ 2 * pfn->params.m, false);
+ if (code < 0)
+ ecode = code;
}
if (pfn->params.Range) {
- code = param_write_float_values(plist, "Range", pfn->params.Range,
- 2 * pfn->params.n, false);
- if (code < 0)
- ecode = code;
+ code = param_write_float_values(plist, "Range", pfn->params.Range,
+ 2 * pfn->params.n, false);
+ if (code < 0)
+ ecode = code;
}
return ecode;
}
@@ -120,13 +120,13 @@ void *
fn_copy_values(const void *pvalues, int count, int size, gs_memory_t *mem)
{
if (pvalues) {
- void *values = gs_alloc_byte_array(mem, count, size, "fn_copy_values");
+ void *values = gs_alloc_byte_array(mem, count, size, "fn_copy_values");
- if (values)
- memcpy(values, pvalues, count * size);
- return values;
+ if (values)
+ memcpy(values, pvalues, count * size);
+ return values;
} else
- return 0; /* caller must check */
+ return 0; /* caller must check */
}
/*
@@ -135,29 +135,29 @@ fn_copy_values(const void *pvalues, int count, int size, gs_memory_t *mem)
*/
int
fn_scale_pairs(const float **ppvalues, const float *pvalues, int npairs,
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
{
if (pvalues == 0)
- *ppvalues = 0;
+ *ppvalues = 0;
else {
- float *out = (float *)
- gs_alloc_byte_array(mem, 2 * npairs, sizeof(*pvalues),
- "fn_scale_pairs");
-
- *ppvalues = out;
- if (out == 0)
- return_error(gs_error_VMerror);
- if (pranges) {
- /* Allocate and compute scaled ranges. */
- int i;
- for (i = 0; i < npairs; ++i) {
- double base = pranges[i].rmin, factor = pranges[i].rmax - base;
-
- out[2 * i] = pvalues[2 * i] * factor + base;
- out[2 * i + 1] = pvalues[2 * i + 1] * factor + base;
- }
- } else
- memcpy(out, pvalues, 2 * sizeof(*pvalues) * npairs);
+ float *out = (float *)
+ gs_alloc_byte_array(mem, 2 * npairs, sizeof(*pvalues),
+ "fn_scale_pairs");
+
+ *ppvalues = out;
+ if (out == 0)
+ return_error(gs_error_VMerror);
+ if (pranges) {
+ /* Allocate and compute scaled ranges. */
+ int i;
+ for (i = 0; i < npairs; ++i) {
+ double base = pranges[i].rmin, factor = pranges[i].rmax - base;
+
+ out[2 * i] = pvalues[2 * i] * factor + base;
+ out[2 * i + 1] = pvalues[2 * i + 1] * factor + base;
+ }
+ } else
+ memcpy(out, pvalues, 2 * sizeof(*pvalues) * npairs);
}
return 0;
}
@@ -168,7 +168,7 @@ fn_scale_pairs(const float **ppvalues, const float *pvalues, int npairs,
*/
int
fn_common_scale(gs_function_t *psfn, const gs_function_t *pfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
{
int code;
@@ -176,10 +176,10 @@ fn_common_scale(gs_function_t *psfn, const gs_function_t *pfn,
psfn->params.Domain = 0; /* in case of failure */
psfn->params.Range = 0;
if ((code = fn_scale_pairs(&psfn->params.Domain, pfn->params.Domain,
- pfn->params.m, NULL, mem)) < 0 ||
- (code = fn_scale_pairs(&psfn->params.Range, pfn->params.Range,
- pfn->params.n, pranges, mem)) < 0)
- return code;
+ pfn->params.m, NULL, mem)) < 0 ||
+ (code = fn_scale_pairs(&psfn->params.Range, pfn->params.Range,
+ pfn->params.n, pranges, mem)) < 0)
+ return code;
return 0;
}
@@ -193,19 +193,18 @@ fn_common_serialize(const gs_function_t * pfn, stream *s)
const float dummy[8] = {0, 0, 0, 0, 0, 0, 0, 0};
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->m, sizeof(p->m), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->Domain[0], sizeof(p->Domain[0]) * p->m * 2, &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->n, sizeof(p->n), &n);
if (code < 0)
- return code;
+ return code;
if (p->Range == NULL && p->n * 2 > count_of(dummy))
- return_error(gs_error_unregistered); /* Unimplemented. */
- return sputs(s, (const byte *)(p->Range != NULL ? &p->Range[0] : dummy),
- sizeof(p->Range[0]) * p->n * 2, &n);
+ return_error(gs_error_unregistered); /* Unimplemented. */
+ return sputs(s, (const byte *)(p->Range != NULL ? &p->Range[0] : dummy),
+ sizeof(p->Range[0]) * p->n * 2, &n);
}
-
diff --git a/gs/base/gsfunc.h b/gs/base/gsfunc.h
index c82c25ec2..315a46c49 100644
--- a/gs/base/gsfunc.h
+++ b/gs/base/gsfunc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -77,7 +77,7 @@ typedef FN_EVALUATE_PROC((*fn_evaluate_proc_t));
/* Test whether a function is monotonic. */
#define FN_IS_MONOTONIC_PROC(proc)\
int proc(const gs_function_t * pfn, const float *lower,\
- const float *upper, uint *mask)
+ const float *upper, uint *mask)
typedef FN_IS_MONOTONIC_PROC((*fn_is_monotonic_proc_t));
/* Get function information. */
@@ -102,7 +102,7 @@ typedef FN_GET_PARAMS_PROC((*fn_get_params_proc_t));
*/
#define FN_MAKE_SCALED_PROC(proc)\
int proc(const gs_function_t *pfn, gs_function_t **ppsfn,\
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
typedef FN_MAKE_SCALED_PROC((*fn_make_scaled_proc_t));
/* Free function parameters. */
@@ -168,17 +168,17 @@ typedef struct gs_function_XxYy_params_s {
* and one to free the parameters of that type.
int gs_function_XxYy_init(gs_function_t **ppfn,
- const gs_function_XxYy_params_t *params,
- gs_memory_t *mem));
+ const gs_function_XxYy_params_t *params,
+ gs_memory_t *mem));
void gs_function_XxYy_free_params(gs_function_XxYy_params_t *params,
- gs_memory_t *mem);
+ gs_memory_t *mem);
*/
/* Allocate an array of function pointers. */
int alloc_function_array(uint count, gs_function_t *** pFunctions,
- gs_memory_t *mem);
+ gs_memory_t *mem);
/* Evaluate a function. */
#define gs_function_evaluate(pfn, in, out)\
@@ -187,8 +187,8 @@ int alloc_function_array(uint count, gs_function_t *** pFunctions,
/*
* Test whether a function is monotonic on a given (closed) interval.
* return 1 = monotonic, 0 = not or don't know, <0 = error..
- * Sets mask : 1 bit per dimension :
- * 1 - non-monotonic or don't know,
+ * Sets mask : 1 bit per dimension :
+ * 1 - non-monotonic or don't know,
* 0 - monotonic.
* If lower[i] > upper[i], the result may be not defined.
*/
diff --git a/gs/base/gsfunc0.c b/gs/base/gsfunc0.c
index 45938a9de..cc87c9a45 100644
--- a/gs/base/gsfunc0.c
+++ b/gs/base/gsfunc0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,12 +22,12 @@
#include "gxfunc.h"
#include "stream.h"
-#define POLE_CACHE_DEBUG 0 /* A temporary development technology need.
- Remove after the beta testing. */
-#define POLE_CACHE_GENERIC_1D 1 /* A temporary development technology need.
- Didn't decide yet - see fn_Sd_evaluate_cubic_cached_1d. */
-#define POLE_CACHE_IGNORE 0 /* A temporary development technology need.
- Remove after the beta testing. */
+#define POLE_CACHE_DEBUG 0 /* A temporary development technology need.
+ Remove after the beta testing. */
+#define POLE_CACHE_GENERIC_1D 1 /* A temporary development technology need.
+ Didn't decide yet - see fn_Sd_evaluate_cubic_cached_1d. */
+#define POLE_CACHE_IGNORE 0 /* A temporary development technology need.
+ Remove after the beta testing. */
#define MAX_FAST_COMPS 8
@@ -43,8 +43,8 @@ ENUM_PTRS_WITH(function_Sd_enum_ptrs, gs_function_Sd_t *pfn)
{
index -= 6;
if (index < st_data_source_max_ptrs)
- return ENUM_USING(st_data_source, &pfn->params.DataSource,
- sizeof(pfn->params.DataSource), index);
+ return ENUM_USING(st_data_source, &pfn->params.DataSource,
+ sizeof(pfn->params.DataSource), index);
return ENUM_USING_PREFIX(st_function, st_data_source_max_ptrs);
}
ENUM_PTR3(0, gs_function_Sd_t, params.Encode, params.Decode, params.Size);
@@ -55,7 +55,7 @@ RELOC_PTRS_WITH(function_Sd_reloc_ptrs, gs_function_Sd_t *pfn)
{
RELOC_PREFIX(st_function);
RELOC_USING(st_data_source, &pfn->params.DataSource,
- sizeof(pfn->params.DataSource));
+ sizeof(pfn->params.DataSource));
RELOC_PTR3(gs_function_Sd_t, params.Encode, params.Decode, params.Size);
RELOC_PTR3(gs_function_Sd_t, params.pole, params.array_step, params.stream_step);
}
@@ -68,22 +68,22 @@ RELOC_PTRS_END
/* Get one set of sample values. */
#define SETUP_SAMPLES(bps, nbytes)\
- int n = pfn->params.n;\
- byte buf[max_Sd_n * ((bps + 7) >> 3)];\
- const byte *p;\
- int i;\
+ int n = pfn->params.n;\
+ byte buf[max_Sd_n * ((bps + 7) >> 3)];\
+ const byte *p;\
+ int i;\
\
- data_source_access(&pfn->params.DataSource, offset >> 3,\
- nbytes, buf, &p)
+ data_source_access(&pfn->params.DataSource, offset >> 3,\
+ nbytes, buf, &p)
static int
fn_gets_1(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(1, ((offset & 7) + n + 7) >> 3);
for (i = 0; i < n; ++i) {
- samples[i] = (*p >> (~offset & 7)) & 1;
- if (!(++offset & 7))
- p++;
+ samples[i] = (*p >> (~offset & 7)) & 1;
+ if (!(++offset & 7))
+ p++;
}
return 0;
}
@@ -92,9 +92,9 @@ fn_gets_2(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(2, (((offset & 7) >> 1) + n + 3) >> 2);
for (i = 0; i < n; ++i) {
- samples[i] = (*p >> (6 - (offset & 7))) & 3;
- if (!((offset += 2) & 7))
- p++;
+ samples[i] = (*p >> (6 - (offset & 7))) & 3;
+ if (!((offset += 2) & 7))
+ p++;
}
return 0;
}
@@ -103,7 +103,7 @@ fn_gets_4(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(4, (((offset & 7) >> 2) + n + 1) >> 1);
for (i = 0; i < n; ++i) {
- samples[i] = ((offset ^= 4) & 4 ? *p >> 4 : *p++ & 0xf);
+ samples[i] = ((offset ^= 4) & 4 ? *p >> 4 : *p++ & 0xf);
}
return 0;
}
@@ -112,7 +112,7 @@ fn_gets_8(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(8, n);
for (i = 0; i < n; ++i) {
- samples[i] = *p++;
+ samples[i] = *p++;
}
return 0;
}
@@ -121,11 +121,11 @@ fn_gets_12(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(12, (((offset & 7) >> 2) + 3 * n + 1) >> 1);
for (i = 0; i < n; ++i) {
- if (offset & 4)
- samples[i] = ((*p & 0xf) << 8) + p[1], p += 2;
- else
- samples[i] = (*p << 4) + (p[1] >> 4), p++;
- offset ^= 4;
+ if (offset & 4)
+ samples[i] = ((*p & 0xf) << 8) + p[1], p += 2;
+ else
+ samples[i] = (*p << 4) + (p[1] >> 4), p++;
+ offset ^= 4;
}
return 0;
}
@@ -134,8 +134,8 @@ fn_gets_16(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(16, n * 2);
for (i = 0; i < n; ++i) {
- samples[i] = (*p << 8) + p[1];
- p += 2;
+ samples[i] = (*p << 8) + p[1];
+ p += 2;
}
return 0;
}
@@ -144,8 +144,8 @@ fn_gets_24(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(24, n * 3);
for (i = 0; i < n; ++i) {
- samples[i] = (*p << 16) + (p[1] << 8) + p[2];
- p += 3;
+ samples[i] = (*p << 16) + (p[1] << 8) + p[2];
+ p += 3;
}
return 0;
}
@@ -154,20 +154,20 @@ fn_gets_32(const gs_function_Sd_t * pfn, ulong offset, uint * samples)
{
SETUP_SAMPLES(32, n * 4);
for (i = 0; i < n; ++i) {
- samples[i] = (*p << 24) + (p[1] << 16) + (p[2] << 8) + p[3];
- p += 4;
+ samples[i] = (*p << 24) + (p[1] << 16) + (p[2] << 8) + p[3];
+ p += 4;
}
return 0;
}
static int (*const fn_get_samples[]) (const gs_function_Sd_t * pfn,
- ulong offset, uint * samples) =
+ ulong offset, uint * samples) =
{
0, fn_gets_1, fn_gets_2, 0, fn_gets_4, 0, 0, 0,
- fn_gets_8, 0, 0, 0, fn_gets_12, 0, 0, 0,
- fn_gets_16, 0, 0, 0, 0, 0, 0, 0,
- fn_gets_24, 0, 0, 0, 0, 0, 0, 0,
- fn_gets_32
+ fn_gets_8, 0, 0, 0, fn_gets_12, 0, 0, 0,
+ fn_gets_16, 0, 0, 0, 0, 0, 0, 0,
+ fn_gets_24, 0, 0, 0, 0, 0, 0, 0,
+ fn_gets_32
};
/*
@@ -184,18 +184,18 @@ interpolate_cubic(floatp x, floatp f0, floatp f1, floatp f2, floatp f3)
* The parameter 'a' affects the contribution of the high-frequency
* components. The abovementioned source suggests a = -0.5.
*/
-#define a (-0.5)
+#define a (-0.5)
#define SQR(v) ((v) * (v))
#define CUBE(v) ((v) * (v) * (v))
const double xm1 = x - 1, m2x = 2 - x, m3x = 3 - x;
const double c =
- (a * CUBE(x) - 5 * a * SQR(x) + 8 * a * x - 4 * a) * f0 +
- ((a+2) * CUBE(xm1) - (a+3) * SQR(xm1) + 1) * f1 +
- ((a+2) * CUBE(m2x) - (a+3) * SQR(m2x) + 1) * f2 +
- (a * CUBE(m3x) - 5 * a * SQR(m3x) + 8 * a * m3x - 4 * a) * f3;
+ (a * CUBE(x) - 5 * a * SQR(x) + 8 * a * x - 4 * a) * f0 +
+ ((a+2) * CUBE(xm1) - (a+3) * SQR(xm1) + 1) * f1 +
+ ((a+2) * CUBE(m2x) - (a+3) * SQR(m2x) + 1) * f2 +
+ (a * CUBE(m3x) - 5 * a * SQR(m3x) + 8 * a * m3x - 4 * a) * f3;
if_debug6('~', "[~](%g, %g, %g, %g)order3(%g) => %g\n",
- f0, f1, f2, f3, x, c);
+ f0, f1, f2, f3, x, c);
return c;
#undef a
#undef SQR
@@ -219,107 +219,107 @@ interpolate_quadratic(floatp x, floatp f0, floatp f1, floatp f2)
/* Calculate a result by multicubic interpolation. */
static void
fn_interpolate_cubic(const gs_function_Sd_t *pfn, const float *fparts,
- const int *iparts, const ulong *factors,
- float *samples, ulong offset, int m)
+ const int *iparts, const ulong *factors,
+ float *samples, ulong offset, int m)
{
int j;
top:
if (m == 0) {
- uint sdata[max_Sd_n];
+ uint sdata[max_Sd_n];
- (*fn_get_samples[pfn->params.BitsPerSample])(pfn, offset, sdata);
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] = (float)sdata[j];
+ (*fn_get_samples[pfn->params.BitsPerSample])(pfn, offset, sdata);
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] = (float)sdata[j];
} else {
- float fpart = *fparts++;
- int ipart = *iparts++;
- ulong delta = *factors++;
- int size = pfn->params.Size[pfn->params.m - m];
- float samples1[max_Sd_n], samplesm1[max_Sd_n], samples2[max_Sd_n];
-
- --m;
- if (is_fzero(fpart))
- goto top;
- fn_interpolate_cubic(pfn, fparts, iparts, factors, samples,
- offset, m);
- fn_interpolate_cubic(pfn, fparts, iparts, factors, samples1,
- offset + delta, m);
- /* Ensure we don't try to access out of bounds. */
- /*
- * If size == 1, the only possible value for ipart and fpart is
- * 0, so we've already handled this case.
- */
- if (size == 2) { /* ipart = 0 */
- /* Use linear interpolation. */
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] += (samples1[j] - samples[j]) * fpart;
- return;
- }
- if (ipart == 0) {
- /* Use quadratic interpolation. */
- fn_interpolate_cubic(pfn, fparts, iparts, factors,
- samples2, offset + delta * 2, m);
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] =
- interpolate_quadratic(fpart, samples[j],
- samples1[j], samples2[j]);
- return;
- }
- /* At this point we know ipart > 0, size >= 3. */
- fn_interpolate_cubic(pfn, fparts, iparts, factors, samplesm1,
- offset - delta, m);
- if (ipart == size - 2) {
- /* Use quadratic interpolation. */
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] =
- interpolate_quadratic(1 - fpart, samples1[j],
- samples[j], samplesm1[j]);
- return;
- }
- /* Now we know 0 < ipart < size - 2, size > 3. */
- fn_interpolate_cubic(pfn, fparts, iparts, factors,
- samples2, offset + delta * 2, m);
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] =
- interpolate_cubic(fpart + 1, samplesm1[j], samples[j],
- samples1[j], samples2[j]);
+ float fpart = *fparts++;
+ int ipart = *iparts++;
+ ulong delta = *factors++;
+ int size = pfn->params.Size[pfn->params.m - m];
+ float samples1[max_Sd_n], samplesm1[max_Sd_n], samples2[max_Sd_n];
+
+ --m;
+ if (is_fzero(fpart))
+ goto top;
+ fn_interpolate_cubic(pfn, fparts, iparts, factors, samples,
+ offset, m);
+ fn_interpolate_cubic(pfn, fparts, iparts, factors, samples1,
+ offset + delta, m);
+ /* Ensure we don't try to access out of bounds. */
+ /*
+ * If size == 1, the only possible value for ipart and fpart is
+ * 0, so we've already handled this case.
+ */
+ if (size == 2) { /* ipart = 0 */
+ /* Use linear interpolation. */
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] += (samples1[j] - samples[j]) * fpart;
+ return;
+ }
+ if (ipart == 0) {
+ /* Use quadratic interpolation. */
+ fn_interpolate_cubic(pfn, fparts, iparts, factors,
+ samples2, offset + delta * 2, m);
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] =
+ interpolate_quadratic(fpart, samples[j],
+ samples1[j], samples2[j]);
+ return;
+ }
+ /* At this point we know ipart > 0, size >= 3. */
+ fn_interpolate_cubic(pfn, fparts, iparts, factors, samplesm1,
+ offset - delta, m);
+ if (ipart == size - 2) {
+ /* Use quadratic interpolation. */
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] =
+ interpolate_quadratic(1 - fpart, samples1[j],
+ samples[j], samplesm1[j]);
+ return;
+ }
+ /* Now we know 0 < ipart < size - 2, size > 3. */
+ fn_interpolate_cubic(pfn, fparts, iparts, factors,
+ samples2, offset + delta * 2, m);
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] =
+ interpolate_cubic(fpart + 1, samplesm1[j], samples[j],
+ samples1[j], samples2[j]);
}
}
/* Calculate a result by multilinear interpolation. */
static void
fn_interpolate_linear(const gs_function_Sd_t *pfn, const float *fparts,
- const ulong *factors, float *samples, ulong offset, int m)
+ const ulong *factors, float *samples, ulong offset, int m)
{
int j;
top:
if (m == 0) {
- uint sdata[max_Sd_n];
+ uint sdata[max_Sd_n];
- (*fn_get_samples[pfn->params.BitsPerSample])(pfn, offset, sdata);
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] = (float)sdata[j];
+ (*fn_get_samples[pfn->params.BitsPerSample])(pfn, offset, sdata);
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] = (float)sdata[j];
} else {
- float fpart = *fparts++;
- float samples1[max_Sd_n];
-
- if (is_fzero(fpart)) {
- ++factors;
- --m;
- goto top;
- }
- fn_interpolate_linear(pfn, fparts, factors + 1, samples,
- offset, m - 1);
- fn_interpolate_linear(pfn, fparts, factors + 1, samples1,
- offset + *factors, m - 1);
- for (j = pfn->params.n - 1; j >= 0; --j)
- samples[j] += (samples1[j] - samples[j]) * fpart;
+ float fpart = *fparts++;
+ float samples1[max_Sd_n];
+
+ if (is_fzero(fpart)) {
+ ++factors;
+ --m;
+ goto top;
+ }
+ fn_interpolate_linear(pfn, fparts, factors + 1, samples,
+ offset, m - 1);
+ fn_interpolate_linear(pfn, fparts, factors + 1, samples1,
+ offset + *factors, m - 1);
+ for (j = pfn->params.n - 1; j >= 0; --j)
+ samples[j] += (samples1[j] - samples[j]) * fpart;
}
}
-static inline double
+static inline double
fn_Sd_encode(const gs_function_Sd_t *pfn, int i, double sample)
{
float d0, d1, r0, r1;
@@ -329,19 +329,19 @@ fn_Sd_encode(const gs_function_Sd_t *pfn, int i, double sample)
uint max_samp = (bps < (sizeof(uint) * 8)) ? ((1 << bps) - 1) : max_uint;
if (pfn->params.Range)
- r0 = pfn->params.Range[2 * i], r1 = pfn->params.Range[2 * i + 1];
+ r0 = pfn->params.Range[2 * i], r1 = pfn->params.Range[2 * i + 1];
else
- r0 = 0, r1 = (float)((1 << bps) - 1);
+ r0 = 0, r1 = (float)((1 << bps) - 1);
if (pfn->params.Decode)
- d0 = pfn->params.Decode[2 * i], d1 = pfn->params.Decode[2 * i + 1];
+ d0 = pfn->params.Decode[2 * i], d1 = pfn->params.Decode[2 * i + 1];
else
- d0 = r0, d1 = r1;
+ d0 = r0, d1 = r1;
value = sample * (d1 - d0) / max_samp + d0;
if (value < r0)
- value = r0;
+ value = r0;
else if (value > r1)
- value = r1;
+ value = r1;
return value;
}
@@ -362,56 +362,56 @@ fn_Sd_evaluate_general(const gs_function_t * pfn_common, const float *in, float
/* Encode the input values. */
for (i = 0; i < pfn->params.m; ++i) {
- float d0 = pfn->params.Domain[2 * i],
- d1 = pfn->params.Domain[2 * i + 1];
- float arg = in[i], enc;
-
- if (arg < d0)
- arg = d0;
- else if (arg > d1)
- arg = d1;
- if (pfn->params.Encode) {
- float e0 = pfn->params.Encode[2 * i];
- float e1 = pfn->params.Encode[2 * i + 1];
-
- enc = (arg - d0) * (e1 - e0) / (d1 - d0) + e0;
- if (enc < 0)
- encoded[i] = 0;
- else if (enc >= pfn->params.Size[i] - 1)
- encoded[i] = (float)pfn->params.Size[i] - 1;
- else
- encoded[i] = enc;
- } else {
- /* arg is guaranteed to be in bounds, ergo so is enc */
- /* TODO: possible issue here. if (pfn->params.Size[i] == 1 */
- encoded[i] = (arg - d0) * (pfn->params.Size[i] - 1) / (d1 - d0);
- }
+ float d0 = pfn->params.Domain[2 * i],
+ d1 = pfn->params.Domain[2 * i + 1];
+ float arg = in[i], enc;
+
+ if (arg < d0)
+ arg = d0;
+ else if (arg > d1)
+ arg = d1;
+ if (pfn->params.Encode) {
+ float e0 = pfn->params.Encode[2 * i];
+ float e1 = pfn->params.Encode[2 * i + 1];
+
+ enc = (arg - d0) * (e1 - e0) / (d1 - d0) + e0;
+ if (enc < 0)
+ encoded[i] = 0;
+ else if (enc >= pfn->params.Size[i] - 1)
+ encoded[i] = (float)pfn->params.Size[i] - 1;
+ else
+ encoded[i] = enc;
+ } else {
+ /* arg is guaranteed to be in bounds, ergo so is enc */
+ /* TODO: possible issue here. if (pfn->params.Size[i] == 1 */
+ encoded[i] = (arg - d0) * (pfn->params.Size[i] - 1) / (d1 - d0);
+ }
}
/* Look up and interpolate the output values. */
{
- ulong factor = bps * pfn->params.n;
+ ulong factor = bps * pfn->params.n;
- for (i = 0; i < pfn->params.m; factor *= pfn->params.Size[i++]) {
- int ipart = (int)encoded[i];
+ for (i = 0; i < pfn->params.m; factor *= pfn->params.Size[i++]) {
+ int ipart = (int)encoded[i];
- offset += (factors[i] = factor) * ipart;
- iparts[i] = ipart; /* only needed for cubic interpolation */
- encoded[i] -= ipart;
- }
+ offset += (factors[i] = factor) * ipart;
+ iparts[i] = ipart; /* only needed for cubic interpolation */
+ encoded[i] -= ipart;
+ }
}
if (pfn->params.Order == 3)
- fn_interpolate_cubic(pfn, encoded, iparts, factors, samples,
- offset, pfn->params.m);
+ fn_interpolate_cubic(pfn, encoded, iparts, factors, samples,
+ offset, pfn->params.m);
else
- fn_interpolate_linear(pfn, encoded, factors, samples, offset,
- pfn->params.m);
+ fn_interpolate_linear(pfn, encoded, factors, samples, offset,
+ pfn->params.m);
/* Encode the output values. */
for (i = 0; i < pfn->params.n; ++i)
- out[i] = (float)fn_Sd_encode(pfn, i, samples[i]);
+ out[i] = (float)fn_Sd_encode(pfn, i, samples[i]);
return 0;
}
@@ -419,8 +419,8 @@ fn_Sd_evaluate_general(const gs_function_t * pfn_common, const float *in, float
static const double double_stub = 1e90;
static inline void
-fn_make_cubic_poles(double *p, double f0, double f1, double f2, double f3,
- const int pole_step_minor)
+fn_make_cubic_poles(double *p, double f0, double f1, double f2, double f3,
+ const int pole_step_minor)
{ /* The following is poles of the polinomial,
which represents interpolate_cubic in [1,2]. */
const double a = -0.5;
@@ -434,34 +434,34 @@ fn_make_poles(double *p, const int pole_step, int power, int bias)
{
const int pole_step_minor = pole_step / 3;
switch(power) {
- case 1: /* A linear 3d power curve. */
- /* bias must be 0. */
- p[pole_step_minor * 1] = (2 * p[pole_step * 0] + 1 * p[pole_step * 1]) / 3;
- p[pole_step_minor * 2] = (1 * p[pole_step * 0] + 2 * p[pole_step * 1]) / 3;
- break;
- case 2:
- /* bias may be be 0 or 1. */
- /* Duplicate the beginning or the ending pole (the old code compatible). */
- fn_make_cubic_poles(p + pole_step * bias,
- p[pole_step * 0], p[pole_step * bias],
- p[pole_step * (1 + bias)], p[pole_step * 2],
- pole_step_minor);
- break;
- case 3:
- /* bias must be 1. */
- fn_make_cubic_poles(p + pole_step * bias,
- p[pole_step * 0], p[pole_step * 1], p[pole_step * 2], p[pole_step * 3],
- pole_step_minor);
- break;
- default: /* Must not happen. */
- DO_NOTHING;
+ case 1: /* A linear 3d power curve. */
+ /* bias must be 0. */
+ p[pole_step_minor * 1] = (2 * p[pole_step * 0] + 1 * p[pole_step * 1]) / 3;
+ p[pole_step_minor * 2] = (1 * p[pole_step * 0] + 2 * p[pole_step * 1]) / 3;
+ break;
+ case 2:
+ /* bias may be be 0 or 1. */
+ /* Duplicate the beginning or the ending pole (the old code compatible). */
+ fn_make_cubic_poles(p + pole_step * bias,
+ p[pole_step * 0], p[pole_step * bias],
+ p[pole_step * (1 + bias)], p[pole_step * 2],
+ pole_step_minor);
+ break;
+ case 3:
+ /* bias must be 1. */
+ fn_make_cubic_poles(p + pole_step * bias,
+ p[pole_step * 0], p[pole_step * 1], p[pole_step * 2], p[pole_step * 3],
+ pole_step_minor);
+ break;
+ default: /* Must not happen. */
+ DO_NOTHING;
}
}
/* Evaluate a Sampled function.
A cubic interpolation with a pole cache.
Allows a fast check for extreme suspection. */
-/* This implementation is a particular case of 1 dimension.
+/* This implementation is a particular case of 1 dimension.
maybe we'll use as an optimisation of the generic case,
so keep it for a while. */
static int
@@ -477,47 +477,47 @@ fn_Sd_evaluate_cubic_cached_1d(const gs_function_Sd_t *pfn, const float *in, flo
double *p, t0, t1, tt;
if (x0 < d0)
- x0 = d0;
+ x0 = d0;
if (x0 > d1)
- x0 = d1;
+ x0 = d1;
tt = (in[0] - d0) * (pfn->params.Size[0] - 1) / (d1 - d0);
i0 = (int)floor(tt);
ib = max(i0 - 1, 0);
ie = min(pfn->params.Size[0], i0 + 3);
for (i = ib; i < ie; i++) {
- if (pfn->params.pole[i * pole_step] == double_stub) {
- uint sdata[max_Sd_n];
- int bps = pfn->params.BitsPerSample;
-
- p = &pfn->params.pole[i * pole_step];
- fn_get_samples[pfn->params.BitsPerSample](pfn, i * bps * pfn->params.n, sdata);
- for (k = 0; k < pfn->params.n; k++, p++)
- *p = fn_Sd_encode(pfn, k, (double)sdata[k]);
- }
+ if (pfn->params.pole[i * pole_step] == double_stub) {
+ uint sdata[max_Sd_n];
+ int bps = pfn->params.BitsPerSample;
+
+ p = &pfn->params.pole[i * pole_step];
+ fn_get_samples[pfn->params.BitsPerSample](pfn, i * bps * pfn->params.n, sdata);
+ for (k = 0; k < pfn->params.n; k++, p++)
+ *p = fn_Sd_encode(pfn, k, (double)sdata[k]);
+ }
}
p = &pfn->params.pole[i0 * pole_step];
t0 = tt - i0;
if (t0 == 0) {
- for (k = 0; k < pfn->params.n; k++, p++)
- out[k] = *p;
+ for (k = 0; k < pfn->params.n; k++, p++)
+ out[k] = *p;
} else {
- if (p[1 * pole_step_minor] == double_stub) {
- for (k = 0; k < pfn->params.n; k++)
- fn_make_poles(&pfn->params.pole[ib * pole_step + k], pole_step,
- ie - ib - 1, i0 - ib);
- }
- t1 = 1 - t0;
- for (k = 0; k < pfn->params.n; k++, p++) {
- double y = p[0 * pole_step_minor] * t1 * t1 * t1 +
- p[1 * pole_step_minor] * t1 * t1 * t0 * 3 +
- p[2 * pole_step_minor] * t1 * t0 * t0 * 3 +
- p[3 * pole_step_minor] * t0 * t0 * t0;
- if (y < pfn->params.Range[0])
- y = pfn->params.Range[0];
- if (y > pfn->params.Range[1])
- y = pfn->params.Range[1];
- out[k] = y;
- }
+ if (p[1 * pole_step_minor] == double_stub) {
+ for (k = 0; k < pfn->params.n; k++)
+ fn_make_poles(&pfn->params.pole[ib * pole_step + k], pole_step,
+ ie - ib - 1, i0 - ib);
+ }
+ t1 = 1 - t0;
+ for (k = 0; k < pfn->params.n; k++, p++) {
+ double y = p[0 * pole_step_minor] * t1 * t1 * t1 +
+ p[1 * pole_step_minor] * t1 * t1 * t0 * 3 +
+ p[2 * pole_step_minor] * t1 * t0 * t0 * 3 +
+ p[3 * pole_step_minor] * t0 * t0 * t0;
+ if (y < pfn->params.Range[0])
+ y = pfn->params.Range[0];
+ if (y > pfn->params.Range[1])
+ y = pfn->params.Range[1];
+ out[k] = y;
+ }
}
return 0;
}
@@ -528,18 +528,18 @@ decode_argument(const gs_function_Sd_t *pfn, const float *in, double T[max_Sd_m]
int i;
for (i = 0; i < pfn->params.m; i++) {
- float xi = in[i];
- float d0 = pfn->params.Domain[2 * i + 0];
- float d1 = pfn->params.Domain[2 * i + 1];
- double t;
-
- if (xi < d0)
- xi = d0;
- if (xi > d1)
- xi = d1;
- t = (xi - d0) * (pfn->params.Size[i] - 1) / (d1 - d0);
- I[i] = (int)floor(t);
- T[i] = t - I[i];
+ float xi = in[i];
+ float d0 = pfn->params.Domain[2 * i + 0];
+ float d1 = pfn->params.Domain[2 * i + 1];
+ double t;
+
+ if (xi < d0)
+ xi = d0;
+ if (xi > d1)
+ xi = d1;
+ t = (xi - d0) * (pfn->params.Size[i] - 1) / (d1 - d0);
+ I[i] = (int)floor(t);
+ T[i] = t - I[i];
}
}
@@ -548,11 +548,11 @@ index_span(const gs_function_Sd_t *pfn, int *I, double *T, int ii, int *Ii, int
{
*Ii = I[ii];
if (T[ii] != 0) {
- *ib = max(*Ii - 1, 0);
- *ie = min(pfn->params.Size[ii], *Ii + 3);
+ *ib = max(*Ii - 1, 0);
+ *ie = min(pfn->params.Size[ii], *Ii + 3);
} else {
- *ib = *Ii;
- *ie = *Ii + 1;
+ *ib = *Ii;
+ *ie = *Ii + 1;
}
}
@@ -564,9 +564,9 @@ load_vector_to(const gs_function_Sd_t *pfn, int s_offset, double *V)
code = fn_get_samples[pfn->params.BitsPerSample](pfn, s_offset, sdata);
if (code < 0)
- return code;
+ return code;
for (k = 0; k < pfn->params.n; k++)
- V[k] = fn_Sd_encode(pfn, k, (double)sdata[k]);
+ V[k] = fn_Sd_encode(pfn, k, (double)sdata[k]);
return 0;
}
@@ -574,14 +574,14 @@ static inline int
load_vector(const gs_function_Sd_t *pfn, int a_offset, int s_offset)
{
if (*(pfn->params.pole + a_offset) == double_stub) {
- uint sdata[max_Sd_n];
- int k, code;
-
- code = fn_get_samples[pfn->params.BitsPerSample](pfn, s_offset, sdata);
- if (code < 0)
- return code;
- for (k = 0; k < pfn->params.n; k++)
- *(pfn->params.pole + a_offset + k) = fn_Sd_encode(pfn, k, (double)sdata[k]);
+ uint sdata[max_Sd_n];
+ int k, code;
+
+ code = fn_get_samples[pfn->params.BitsPerSample](pfn, s_offset, sdata);
+ if (code < 0)
+ return code;
+ for (k = 0; k < pfn->params.n; k++)
+ *(pfn->params.pole + a_offset + k) = fn_Sd_encode(pfn, k, (double)sdata[k]);
}
return 0;
}
@@ -592,60 +592,60 @@ interpolate_vector(const gs_function_Sd_t *pfn, int offset, int pole_step, int p
int k;
for (k = 0; k < pfn->params.n; k++)
- fn_make_poles(pfn->params.pole + offset + k, pole_step, power, bias);
+ fn_make_poles(pfn->params.pole + offset + k, pole_step, power, bias);
}
static inline void
-interpolate_tensors(const gs_function_Sd_t *pfn, int *I, double *T,
- int offset, int pole_step, int power, int bias, int ii)
+interpolate_tensors(const gs_function_Sd_t *pfn, int *I, double *T,
+ int offset, int pole_step, int power, int bias, int ii)
{
if (ii < 0)
- interpolate_vector(pfn, offset, pole_step, power, bias);
+ interpolate_vector(pfn, offset, pole_step, power, bias);
else {
- int s = pfn->params.array_step[ii];
- int Ii = I[ii];
+ int s = pfn->params.array_step[ii];
+ int Ii = I[ii];
- if (T[ii] == 0) {
- interpolate_tensors(pfn, I, T, offset + Ii * s, pole_step, power, bias, ii - 1);
- } else {
- int l;
+ if (T[ii] == 0) {
+ interpolate_tensors(pfn, I, T, offset + Ii * s, pole_step, power, bias, ii - 1);
+ } else {
+ int l;
- for (l = 0; l < 4; l++)
- interpolate_tensors(pfn, I, T, offset + Ii * s + l * s / 3, pole_step, power, bias, ii - 1);
- }
+ for (l = 0; l < 4; l++)
+ interpolate_tensors(pfn, I, T, offset + Ii * s + l * s / 3, pole_step, power, bias, ii - 1);
+ }
}
}
-static inline bool
+static inline bool
is_tensor_done(const gs_function_Sd_t *pfn, int *I, double *T, int a_offset, int ii)
{
/* Check an inner pole of the cell. */
int i, o = 0;
for (i = ii; i >= 0; i--) {
- o += I[i] * pfn->params.array_step[i];
- if (T[i] != 0)
- o += pfn->params.array_step[i] / 3;
+ o += I[i] * pfn->params.array_step[i];
+ if (T[i] != 0)
+ o += pfn->params.array_step[i] / 3;
}
if (*(pfn->params.pole + a_offset + o) != double_stub)
- return true;
+ return true;
return false;
}
/* Creates a tensor of Bezier coefficients by node interpolation. */
static inline int
make_interpolation_tensor(const gs_function_Sd_t *pfn, int *I, double *T,
- int a_offset, int s_offset, int ii)
+ int a_offset, int s_offset, int ii)
{
/* Well, this function isn't obvious. Trying to explain what it does.
Suppose we have a 4x4x4...x4 hypercube of nodes, and we want to build
a multicubic interpolation function for the inner 2x2x2...x2 hypercube.
We represent the multicubic function with a tensor of Besier poles,
- and the size of the tensor is 4x4x....x4. Note that the corners
+ and the size of the tensor is 4x4x....x4. Note that the corners
of the tensor are equal to the corners of the 2x2x...x2 hypercube.
- We organize the 'pole' array so that a tensor of a cell
+ We organize the 'pole' array so that a tensor of a cell
occupies the cell, and tensors for neighbour cells have a common hyperplane.
For a 1-dimentional case let the nodes are n0, n1, n2, n3.
@@ -654,7 +654,7 @@ make_interpolation_tensor(const gs_function_Sd_t *pfn, int *I, double *T,
We choose a cubic approximation, in which tangents at nodes n1, n2
are parallel to (n2 - n0) and (n3 - n1) correspondingly.
(Well, this doesn't give a the minimal curvity, but likely it is
- what Adobe implementations do, see the bug 687352,
+ what Adobe implementations do, see the bug 687352,
and we agree that it's some reasonable).
Then we have :
@@ -667,51 +667,51 @@ make_interpolation_tensor(const gs_function_Sd_t *pfn, int *I, double *T,
When the source node array have an insufficient nomber of nodes
along a dimension to determine tangents a cell
(this happens near the array boundaries),
- we simply duplicate ending nodes. This solution is done
- for the compatibility to the old code, and definitely
+ we simply duplicate ending nodes. This solution is done
+ for the compatibility to the old code, and definitely
there exists a better one. Likely Adobe does the same.
For a 2-dimensional case we apply the 1-dimentional case through
the first dimension, and then construct a surface by varying the
second coordinate as a parameter. It gives a bicubic surface,
- and the result doesn't depend on the order of coordinates
+ and the result doesn't depend on the order of coordinates
(I proved the latter with Matematica 3.0).
Then we know that an interpolation by one coordinate and
a differentiation by another coordinate are interchangeble operators.
- Due to that poles of the interpolated function are same as
+ Due to that poles of the interpolated function are same as
interpolated poles of the function (well, we didn't spend time
- for a strong proof, but this fact was confirmed with testing the
+ for a strong proof, but this fact was confirmed with testing the
implementation with POLE_CACHE_DEBUG).
- Then we apply the 2-dimentional considerations recursively
+ Then we apply the 2-dimentional considerations recursively
to all dimensions. This is exactly what the function does.
*/
int code;
-
+
if (ii < 0) {
- if (POLE_CACHE_IGNORE || *(pfn->params.pole + a_offset) == double_stub) {
- code = load_vector(pfn, a_offset, s_offset);
- if (code < 0)
- return code;
- }
+ if (POLE_CACHE_IGNORE || *(pfn->params.pole + a_offset) == double_stub) {
+ code = load_vector(pfn, a_offset, s_offset);
+ if (code < 0)
+ return code;
+ }
} else {
- int Ii, ib, ie, i;
- int sa = pfn->params.array_step[ii];
- int ss = pfn->params.stream_step[ii];
-
- index_span(pfn, I, T, ii, &Ii, &ib, &ie);
- if (POLE_CACHE_IGNORE || !is_tensor_done(pfn, I, T, a_offset, ii)) {
- for (i = ib; i < ie; i++) {
- code = make_interpolation_tensor(pfn, I, T,
- a_offset + i * sa, s_offset + i * ss, ii - 1);
- if (code < 0)
- return code;
- }
- if (T[ii] != 0)
- interpolate_tensors(pfn, I, T, a_offset + ib * sa, sa, ie - ib - 1,
- Ii - ib, ii - 1);
- }
+ int Ii, ib, ie, i;
+ int sa = pfn->params.array_step[ii];
+ int ss = pfn->params.stream_step[ii];
+
+ index_span(pfn, I, T, ii, &Ii, &ib, &ie);
+ if (POLE_CACHE_IGNORE || !is_tensor_done(pfn, I, T, a_offset, ii)) {
+ for (i = ib; i < ie; i++) {
+ code = make_interpolation_tensor(pfn, I, T,
+ a_offset + i * sa, s_offset + i * ss, ii - 1);
+ if (code < 0)
+ return code;
+ }
+ if (T[ii] != 0)
+ interpolate_tensors(pfn, I, T, a_offset + ib * sa, sa, ie - ib - 1,
+ Ii - ib, ii - 1);
+ }
}
return 0;
}
@@ -719,39 +719,39 @@ make_interpolation_tensor(const gs_function_Sd_t *pfn, int *I, double *T,
/* Creates a subarray of samples. */
static inline int
make_interpolation_nodes(const gs_function_Sd_t *pfn, double *T0, double *T1,
- int *I, double *T,
- int a_offset, int s_offset, int ii)
+ int *I, double *T,
+ int a_offset, int s_offset, int ii)
{
int code;
if (ii < 0) {
- if (POLE_CACHE_IGNORE || *(pfn->params.pole + a_offset) == double_stub) {
- code = load_vector(pfn, a_offset, s_offset);
- if (code < 0)
- return code;
- }
- if (pfn->params.Order == 3) {
- code = make_interpolation_tensor(pfn, I, T, 0, 0, pfn->params.m - 1);
- }
+ if (POLE_CACHE_IGNORE || *(pfn->params.pole + a_offset) == double_stub) {
+ code = load_vector(pfn, a_offset, s_offset);
+ if (code < 0)
+ return code;
+ }
+ if (pfn->params.Order == 3) {
+ code = make_interpolation_tensor(pfn, I, T, 0, 0, pfn->params.m - 1);
+ }
} else {
- int i;
- int i0 = (int)floor(T0[ii]);
- int i1 = (int)ceil(T1[ii]);
- int sa = pfn->params.array_step[ii];
- int ss = pfn->params.stream_step[ii];
-
- if (i0 < 0 || i0 >= pfn->params.Size[ii])
- return_error(gs_error_unregistered); /* Must not happen. */
- if (i1 < 0 || i1 >= pfn->params.Size[ii])
- return_error(gs_error_unregistered); /* Must not happen. */
- I[ii] = i0;
- T[ii] = (i1 > i0 ? 1 : 0);
- for (i = i0; i <= i1; i++) {
- code = make_interpolation_nodes(pfn, T0, T1, I, T,
- a_offset + i * sa, s_offset + i * ss, ii - 1);
- if (code < 0)
- return code;
- }
+ int i;
+ int i0 = (int)floor(T0[ii]);
+ int i1 = (int)ceil(T1[ii]);
+ int sa = pfn->params.array_step[ii];
+ int ss = pfn->params.stream_step[ii];
+
+ if (i0 < 0 || i0 >= pfn->params.Size[ii])
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (i1 < 0 || i1 >= pfn->params.Size[ii])
+ return_error(gs_error_unregistered); /* Must not happen. */
+ I[ii] = i0;
+ T[ii] = (i1 > i0 ? 1 : 0);
+ for (i = i0; i <= i1; i++) {
+ code = make_interpolation_nodes(pfn, T0, T1, I, T,
+ a_offset + i * sa, s_offset + i * ss, ii - 1);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
@@ -762,29 +762,28 @@ evaluate_from_tenzor(const gs_function_Sd_t *pfn, int *I, double *T, int offset,
int s = pfn->params.array_step[ii], k, l, code;
if (ii < 0) {
- for (k = 0; k < pfn->params.n; k++)
- y[k] = *(pfn->params.pole + offset + k);
+ for (k = 0; k < pfn->params.n; k++)
+ y[k] = *(pfn->params.pole + offset + k);
} else if (T[ii] == 0) {
- return evaluate_from_tenzor(pfn, I, T, offset + s * I[ii], ii - 1, y);
+ return evaluate_from_tenzor(pfn, I, T, offset + s * I[ii], ii - 1, y);
} else {
- double t0 = T[ii], t1 = 1 - t0;
- double p[4][max_Sd_n];
-
- for (l = 0; l < 4; l++) {
- code = evaluate_from_tenzor(pfn, I, T, offset + s * I[ii] + l * (s / 3), ii - 1, p[l]);
- if (code < 0)
- return code;
- }
- for (k = 0; k < pfn->params.n; k++)
- y[k] = p[0][k] * t1 * t1 * t1 +
- p[1][k] * t1 * t1 * t0 * 3 +
- p[2][k] * t1 * t0 * t0 * 3 +
- p[3][k] * t0 * t0 * t0;
+ double t0 = T[ii], t1 = 1 - t0;
+ double p[4][max_Sd_n];
+
+ for (l = 0; l < 4; l++) {
+ code = evaluate_from_tenzor(pfn, I, T, offset + s * I[ii] + l * (s / 3), ii - 1, p[l]);
+ if (code < 0)
+ return code;
+ }
+ for (k = 0; k < pfn->params.n; k++)
+ y[k] = p[0][k] * t1 * t1 * t1 +
+ p[1][k] * t1 * t1 * t0 * 3 +
+ p[2][k] * t1 * t0 * t0 * 3 +
+ p[3][k] * t0 * t0 * t0;
}
return 0;
}
-
/* Evaluate a Sampled function. */
/* A cubic interpolation with pole cache. */
/* Allows a fast check for extreme suspection with is_tensor_monotonic. */
@@ -797,16 +796,16 @@ fn_Sd_evaluate_multicubic_cached(const gs_function_Sd_t *pfn, const float *in, f
decode_argument(pfn, in, T, I);
code = make_interpolation_tensor(pfn, I, T, 0, 0, pfn->params.m - 1);
if (code < 0)
- return code;
+ return code;
evaluate_from_tenzor(pfn, I, T, 0, pfn->params.m - 1, y);
for (k = 0; k < pfn->params.n; k++) {
- double yk = y[k];
+ double yk = y[k];
- if (yk < pfn->params.Range[k * 2 + 0])
- yk = pfn->params.Range[k * 2 + 0];
- if (yk > pfn->params.Range[k * 2 + 1])
- yk = pfn->params.Range[k * 2 + 1];
- out[k] = yk;
+ if (yk < pfn->params.Range[k * 2 + 0])
+ yk = pfn->params.Range[k * 2 + 0];
+ if (yk > pfn->params.Range[k * 2 + 1])
+ yk = pfn->params.Range[k * 2 + 1];
+ out[k] = yk;
}
return 0;
}
@@ -819,33 +818,33 @@ fn_Sd_evaluate(const gs_function_t * pfn_common, const float *in, float *out)
int code;
if (pfn->params.Order == 3) {
- if (POLE_CACHE_GENERIC_1D || pfn->params.m > 1)
- code = fn_Sd_evaluate_multicubic_cached(pfn, in, out);
- else
- code = fn_Sd_evaluate_cubic_cached_1d(pfn, in, out);
+ if (POLE_CACHE_GENERIC_1D || pfn->params.m > 1)
+ code = fn_Sd_evaluate_multicubic_cached(pfn, in, out);
+ else
+ code = fn_Sd_evaluate_cubic_cached_1d(pfn, in, out);
# if POLE_CACHE_DEBUG
- { float y[max_Sd_n];
- int k, code1;
-
- code1 = fn_Sd_evaluate_general(pfn_common, in, y);
- if (code != code1)
- return_error(gs_error_unregistered); /* Must not happen. */
- for (k = 0; k < pfn->params.n; k++) {
- if (any_abs(y[k] - out[k]) > 1e-6 * (pfn->params.Range[k * 2 + 1] - pfn->params.Range[k * 2 + 0]))
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- }
+ { float y[max_Sd_n];
+ int k, code1;
+
+ code1 = fn_Sd_evaluate_general(pfn_common, in, y);
+ if (code != code1)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ for (k = 0; k < pfn->params.n; k++) {
+ if (any_abs(y[k] - out[k]) > 1e-6 * (pfn->params.Range[k * 2 + 1] - pfn->params.Range[k * 2 + 0]))
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ }
# endif
} else
- code = fn_Sd_evaluate_general(pfn_common, in, out);
+ code = fn_Sd_evaluate_general(pfn_common, in, out);
return code;
}
/* Map a function subdomain to the sample index subdomain. */
static inline int
get_scaled_range(const gs_function_Sd_t *const pfn,
- const float *lower, const float *upper,
- int i, float *pw0, float *pw1)
+ const float *lower, const float *upper,
+ int i, float *pw0, float *pw1)
{
float d0 = pfn->params.Domain[i * 2 + 0], d1 = pfn->params.Domain[i * 2 + 1];
float v0 = lower[i], v1 = upper[i];
@@ -853,30 +852,30 @@ get_scaled_range(const gs_function_Sd_t *const pfn,
const float small_noise = (float)1e-6;
if (v0 < d0 || v0 > d1)
- return gs_error_rangecheck;
+ return gs_error_rangecheck;
if (pfn->params.Encode)
- e0 = pfn->params.Encode[i * 2 + 0], e1 = pfn->params.Encode[i * 2 + 1];
+ e0 = pfn->params.Encode[i * 2 + 0], e1 = pfn->params.Encode[i * 2 + 1];
else
- e0 = 0, e1 = (float)pfn->params.Size[i] - 1;
+ e0 = 0, e1 = (float)pfn->params.Size[i] - 1;
w0 = (v0 - d0) * (e1 - e0) / (d1 - d0) + e0;
if (w0 < 0)
- w0 = 0;
+ w0 = 0;
else if (w0 >= pfn->params.Size[i] - 1)
- w0 = (float)pfn->params.Size[i] - 1;
+ w0 = (float)pfn->params.Size[i] - 1;
w1 = (v1 - d0) * (e1 - e0) / (d1 - d0) + e0;
if (w1 < 0)
- w1 = 0;
+ w1 = 0;
else if (w1 >= pfn->params.Size[i] - 1)
- w1 = (float)pfn->params.Size[i] - 1;
+ w1 = (float)pfn->params.Size[i] - 1;
if (w0 > w1) {
- w = w0; w0 = w1; w1 = w;
+ w = w0; w0 = w1; w1 = w;
}
if (floor(w0 + 1) - w0 < small_noise * any_abs(e1 - e0))
- w0 = (floor(w0) + 1);
+ w0 = (floor(w0) + 1);
if (w1 - floor(w1) < small_noise * any_abs(e1 - e0))
- w1 = floor(w1);
+ w1 = floor(w1);
if (w0 > w1)
- w0 = w1;
+ w0 = w1;
*pw0 = w0;
*pw1 = w1;
return 0;
@@ -885,26 +884,26 @@ get_scaled_range(const gs_function_Sd_t *const pfn,
/* Copy a tensor to a differently indexed pole array. */
static int
copy_poles(const gs_function_Sd_t *pfn, int *I, double *T0, double *T1, int a_offset,
- int ii, double *pole, int p_offset, int pole_step)
+ int ii, double *pole, int p_offset, int pole_step)
{
int i, ei, sa, code;
int order = pfn->params.Order;
if (pole_step <= 0)
- return_error(gs_error_limitcheck); /* Too small buffer. */
+ return_error(gs_error_limitcheck); /* Too small buffer. */
ei = (T0[ii] == T1[ii] ? 1 : order + 1);
sa = pfn->params.array_step[ii];
if (ii == 0) {
- for (i = 0; i < ei; i++)
- *(pole + p_offset + i * pole_step) =
- *(pfn->params.pole + a_offset + I[ii] * sa + i * (sa / order));
+ for (i = 0; i < ei; i++)
+ *(pole + p_offset + i * pole_step) =
+ *(pfn->params.pole + a_offset + I[ii] * sa + i * (sa / order));
} else {
- for (i = 0; i < ei; i++) {
- code = copy_poles(pfn, I, T0, T1, a_offset + I[ii] * sa + i * (sa / order), ii - 1,
- pole, p_offset + i * pole_step, pole_step / 4);
- if (code < 0)
- return code;
- }
+ for (i = 0; i < ei; i++) {
+ code = copy_poles(pfn, I, T0, T1, a_offset + I[ii] * sa + i * (sa / order), ii - 1,
+ pole, p_offset + i * pole_step, pole_step / 4);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
@@ -923,18 +922,18 @@ subcurve(double *pole, int pole_step, double t0, double t1)
#define Power2(a) (a) * (a)
#define Power3(a) (a) * (a) * (a)
pole[pole_step * 0] = t0*(t0*(q3*t0 - 3*q2*t01) + 3*q1*Power2(t01)) - q0*Power3(t01);
- pole[pole_step * 1] = q1*t01*(-2*t0 - t1 + 3*t0*t1) + t0*(q2*t0 + 2*q2*t1 -
- 3*q2*t0*t1 + q3*t0*t1) - q0*t11*Power2(t01);
- pole[pole_step * 2] = t1*(2*q2*t0 + q2*t1 - 3*q2*t0*t1 + q3*t0*t1) +
- q1*(-t0 - 2*t1 + 3*t0*t1)*t11 - q0*t01*Power2(t11);
- pole[pole_step * 3] = t1*(t1*(3*q2 - 3*q2*t1 + q3*t1) +
- 3*q1*Power2(t11)) - q0*Power3(t11);
+ pole[pole_step * 1] = q1*t01*(-2*t0 - t1 + 3*t0*t1) + t0*(q2*t0 + 2*q2*t1 -
+ 3*q2*t0*t1 + q3*t0*t1) - q0*t11*Power2(t01);
+ pole[pole_step * 2] = t1*(2*q2*t0 + q2*t1 - 3*q2*t0*t1 + q3*t0*t1) +
+ q1*(-t0 - 2*t1 + 3*t0*t1)*t11 - q0*t01*Power2(t11);
+ pole[pole_step * 3] = t1*(t1*(3*q2 - 3*q2*t1 + q3*t1) +
+ 3*q1*Power2(t11)) - q0*Power3(t11);
#undef Power2
#undef Power3
if (any_abs(pole[pole_step * 1] - pole[pole_step * 0]) < small)
- pole[pole_step * 1] = pole[pole_step * 0];
+ pole[pole_step * 1] = pole[pole_step * 0];
if (any_abs(pole[pole_step * 2] - pole[pole_step * 3]) < small)
- pole[pole_step * 2] = pole[pole_step * 3];
+ pole[pole_step * 2] = pole[pole_step * 3];
}
static inline void
@@ -948,22 +947,22 @@ subline(double *pole, int pole_step, double t0, double t1)
}
static void
-clamp_poles(double *T0, double *T1, int ii, int i, double * pole,
- int p_offset, int pole_step, int pole_step_i, int order)
+clamp_poles(double *T0, double *T1, int ii, int i, double * pole,
+ int p_offset, int pole_step, int pole_step_i, int order)
{
if (ii < 0) {
- if (order == 3)
- subcurve(pole + p_offset, pole_step_i, T0[i], T1[i]);
- else
- subline(pole + p_offset, pole_step_i, T0[i], T1[i]);
+ if (order == 3)
+ subcurve(pole + p_offset, pole_step_i, T0[i], T1[i]);
+ else
+ subline(pole + p_offset, pole_step_i, T0[i], T1[i]);
} else if (i == ii) {
- clamp_poles(T0, T1, ii - 1, i, pole, p_offset, pole_step / 4, pole_step, order);
+ clamp_poles(T0, T1, ii - 1, i, pole, p_offset, pole_step / 4, pole_step, order);
} else {
- int j, ei = (T0[ii] == T1[ii] ? 1 : order + 1);
+ int j, ei = (T0[ii] == T1[ii] ? 1 : order + 1);
- for (j = 0; j < ei; j++)
- clamp_poles(T0, T1, ii - 1, i, pole, p_offset + j * pole_step,
- pole_step / 4, pole_step_i, order);
+ for (j = 0; j < ei; j++)
+ clamp_poles(T0, T1, ii - 1, i, pole, p_offset + j * pole_step,
+ pole_step / 4, pole_step_i, order);
}
}
@@ -976,13 +975,13 @@ curve_monotonity(double *pole, int pole_step)
double p3 = pole[pole_step * 3];
if (p0 == p1 && any_abs(p1 - p2) < 1e-13 && p2 == p3)
- return 0;
+ return 0;
if (p0 <= p1 && p1 <= p2 && p2 <= p3)
- return 1;
+ return 1;
if (p0 >= p1 && p1 >= p2 && p2 >= p3)
- return 2;
- /* Maybe not monotonic.
- Don't want to solve quadratic equations, so return "don't know".
+ return 2;
+ /* Maybe not monotonic.
+ Don't want to solve quadratic equations, so return "don't know".
This case should be rare.
*/
return 3;
@@ -995,197 +994,197 @@ line_monotonity(double *pole, int pole_step)
double p1 = pole[pole_step * 1];
if (p1 - p0 > 1e-13)
- return 1;
+ return 1;
if (p0 - p1 > 1e-13)
- return 2;
+ return 2;
return 0;
}
-static int /* 3 bits per guide : 3 - non-monotonic or don't know,
- 2 - decreesing, 0 - constant, 1 - increasing.
- The number of guides is order+1. */
-tensor_dimension_monotonity(const double *T0, const double *T1, int ii, int i0, double *pole,
- int p_offset, int pole_step, int pole_step_i, int order)
+static int /* 3 bits per guide : 3 - non-monotonic or don't know,
+ 2 - decreesing, 0 - constant, 1 - increasing.
+ The number of guides is order+1. */
+tensor_dimension_monotonity(const double *T0, const double *T1, int ii, int i0, double *pole,
+ int p_offset, int pole_step, int pole_step_i, int order)
{
if (ii < 0) {
- if (order == 3)
- return curve_monotonity(pole + p_offset, pole_step_i);
- else
- return line_monotonity(pole + p_offset, pole_step_i);
+ if (order == 3)
+ return curve_monotonity(pole + p_offset, pole_step_i);
+ else
+ return line_monotonity(pole + p_offset, pole_step_i);
} else if (i0 == ii) {
- /* Delay the dimension till the end, and adjust pole_step. */
- return tensor_dimension_monotonity(T0, T1, ii - 1, i0, pole, p_offset,
- pole_step / 4, pole_step, order);
+ /* Delay the dimension till the end, and adjust pole_step. */
+ return tensor_dimension_monotonity(T0, T1, ii - 1, i0, pole, p_offset,
+ pole_step / 4, pole_step, order);
} else {
- int j, ei = (T0[ii] == T1[ii] ? 1 : order + 1), m = 0, mm;
-
- for (j = 0; j < ei; j++) {
- mm = tensor_dimension_monotonity(T0, T1, ii - 1, i0, pole, p_offset + j * pole_step,
- pole_step/ 4, pole_step_i, order);
- m |= mm << (j * 3);
- if (mm == 3) {
- /* If one guide is not monotonic, the dimension is not monotonic.
- Can return early. */
- break;
- }
- }
- return m;
+ int j, ei = (T0[ii] == T1[ii] ? 1 : order + 1), m = 0, mm;
+
+ for (j = 0; j < ei; j++) {
+ mm = tensor_dimension_monotonity(T0, T1, ii - 1, i0, pole, p_offset + j * pole_step,
+ pole_step/ 4, pole_step_i, order);
+ m |= mm << (j * 3);
+ if (mm == 3) {
+ /* If one guide is not monotonic, the dimension is not monotonic.
+ Can return early. */
+ break;
+ }
+ }
+ return m;
}
}
static inline int
is_tensor_monotonic_by_dimension(const gs_function_Sd_t *pfn, int *I, double *T0, double *T1, int i0, int k,
- uint *mask /* 3 bits per guide : 3 - non-monotonic or don't know,
- 2 - decreesing, 0 - constant, 1 - increasing.
- The number of guides is order+1. */)
+ uint *mask /* 3 bits per guide : 3 - non-monotonic or don't know,
+ 2 - decreesing, 0 - constant, 1 - increasing.
+ The number of guides is order+1. */)
{
- double pole[4*4*4]; /* For a while restricting with 3-in cubic functions.
+ double pole[4*4*4]; /* For a while restricting with 3-in cubic functions.
More arguments need a bigger buffer, but the rest of code is same. */
int i, code, ii = pfn->params.m - 1;
double TT0[3], TT1[3];
*mask = 0;
if (ii >= 3) {
- /* Unimplemented. We don't know practical cases,
- because currently it is only called while decomposing a shading. */
- return_error(gs_error_limitcheck);
+ /* Unimplemented. We don't know practical cases,
+ because currently it is only called while decomposing a shading. */
+ return_error(gs_error_limitcheck);
}
code = copy_poles(pfn, I, T0, T1, k, ii, pole, 0, count_of(pole) / 4);
if (code < 0)
- return code;
+ return code;
for (i = ii; i >= 0; i--) {
- TT0[i] = 0;
- if (T0[i] != T1[i]) {
- if (T0[i] != 0 || T1[i] != 1)
- clamp_poles(T0, T1, ii, i, pole, 0, count_of(pole) / 4, -1, pfn->params.Order);
- TT1[i] = 1;
- } else
- TT1[i] = 0;
+ TT0[i] = 0;
+ if (T0[i] != T1[i]) {
+ if (T0[i] != 0 || T1[i] != 1)
+ clamp_poles(T0, T1, ii, i, pole, 0, count_of(pole) / 4, -1, pfn->params.Order);
+ TT1[i] = 1;
+ } else
+ TT1[i] = 0;
}
- *mask = tensor_dimension_monotonity(TT0, TT1, ii, i0, pole, 0,
- count_of(pole) / 4, -1, pfn->params.Order);
+ *mask = tensor_dimension_monotonity(TT0, TT1, ii, i0, pole, 0,
+ count_of(pole) / 4, -1, pfn->params.Order);
return 0;
}
static int /* error code */
-is_lattice_monotonic_by_dimension(const gs_function_Sd_t *pfn, const double *T0, const double *T1,
- int *I, double *S0, double *S1, int ii, int i0, int k,
- uint *mask /* 3 bits per guide : 1 - non-monotonic or don't know, 0 - monotonic;
- The number of guides is order+1. */)
+is_lattice_monotonic_by_dimension(const gs_function_Sd_t *pfn, const double *T0, const double *T1,
+ int *I, double *S0, double *S1, int ii, int i0, int k,
+ uint *mask /* 3 bits per guide : 1 - non-monotonic or don't know, 0 - monotonic;
+ The number of guides is order+1. */)
{
if (ii == -1) {
- /* fixme : could cache the cell monotonity against redundant evaluation. */
- return is_tensor_monotonic_by_dimension(pfn, I, S0, S1, i0, k, mask);
+ /* fixme : could cache the cell monotonity against redundant evaluation. */
+ return is_tensor_monotonic_by_dimension(pfn, I, S0, S1, i0, k, mask);
} else {
- int i1 = (ii > i0 ? ii : ii == 0 ? i0 : ii - 1); /* Delay the dimension i0 till the end of recursion. */
- int j, code;
- int bi = (int)floor(T0[i1]);
- int ei = (int)floor(T1[i1]);
- uint m, mm, m1 = 0x49249249 & ((1 << ((pfn->params.Order + 1) * 3)) - 1);
-
- if (floor(T1[i1]) == T1[i1])
- ei --;
- m = 0;
- for (j = bi; j <= ei; j++) {
- /* fixme : A better performance may be obtained with comparing central nodes with side ones. */
- I[i1] = j;
- S0[i1] = max(T0[i1] - j, 0);
- S1[i1] = min(T1[i1] - j, 1);
- code = is_lattice_monotonic_by_dimension(pfn, T0, T1, I, S0, S1, ii - 1, i0, k, &mm);
- if (code < 0)
- return code;
- m |= mm;
- if (m == m1) /* Don't return early - shadings need to know about all dimensions. */
- break;
- }
- if (ii == 0) {
- /* Detect non-monotonic guides. */
- m = m & (m >> 1);
- }
- *mask = m;
- return 0;
+ int i1 = (ii > i0 ? ii : ii == 0 ? i0 : ii - 1); /* Delay the dimension i0 till the end of recursion. */
+ int j, code;
+ int bi = (int)floor(T0[i1]);
+ int ei = (int)floor(T1[i1]);
+ uint m, mm, m1 = 0x49249249 & ((1 << ((pfn->params.Order + 1) * 3)) - 1);
+
+ if (floor(T1[i1]) == T1[i1])
+ ei --;
+ m = 0;
+ for (j = bi; j <= ei; j++) {
+ /* fixme : A better performance may be obtained with comparing central nodes with side ones. */
+ I[i1] = j;
+ S0[i1] = max(T0[i1] - j, 0);
+ S1[i1] = min(T1[i1] - j, 1);
+ code = is_lattice_monotonic_by_dimension(pfn, T0, T1, I, S0, S1, ii - 1, i0, k, &mm);
+ if (code < 0)
+ return code;
+ m |= mm;
+ if (m == m1) /* Don't return early - shadings need to know about all dimensions. */
+ break;
+ }
+ if (ii == 0) {
+ /* Detect non-monotonic guides. */
+ m = m & (m >> 1);
+ }
+ *mask = m;
+ return 0;
}
}
static inline int /* error code */
-is_lattice_monotonic(const gs_function_Sd_t *pfn, const double *T0, const double *T1,
- int *I, double *S0, double *S1,
- int k, uint *mask /* 1 bit per dimension : 1 - non-monotonic or don't know,
- 0 - monotonic. */)
+is_lattice_monotonic(const gs_function_Sd_t *pfn, const double *T0, const double *T1,
+ int *I, double *S0, double *S1,
+ int k, uint *mask /* 1 bit per dimension : 1 - non-monotonic or don't know,
+ 0 - monotonic. */)
{
uint m, mm = 0;
int i, code;
for (i = 0; i < pfn->params.m; i++) {
- if (T0[i] != T1[i]) {
- code = is_lattice_monotonic_by_dimension(pfn, T0, T1, I, S0, S1, pfn->params.m - 1, i, k, &m);
- if (code < 0)
- return code;
- if (m)
- mm |= 1 << i;
- }
+ if (T0[i] != T1[i]) {
+ code = is_lattice_monotonic_by_dimension(pfn, T0, T1, I, S0, S1, pfn->params.m - 1, i, k, &m);
+ if (code < 0)
+ return code;
+ if (m)
+ mm |= 1 << i;
+ }
}
*mask = mm;
return 0;
}
-static int /* 3 bits per result : 3 - non-monotonic or don't know,
- 2 - decreesing, 0 - constant, 1 - increasing,
- <0 - error. */
-fn_Sd_1arg_linear_monotonic_rec(const gs_function_Sd_t *const pfn, int i0, int i1,
- const double *V0, const double *V1)
+static int /* 3 bits per result : 3 - non-monotonic or don't know,
+ 2 - decreesing, 0 - constant, 1 - increasing,
+ <0 - error. */
+fn_Sd_1arg_linear_monotonic_rec(const gs_function_Sd_t *const pfn, int i0, int i1,
+ const double *V0, const double *V1)
{
if (i1 - i0 <= 1) {
- int code = 0, i;
-
- for (i = 0; i < pfn->params.n; i++) {
- if (V0[i] < V1[i])
- code |= 1 << (i * 3);
- else if (V0[i] > V1[i])
- code |= 2 << (i * 3);
- }
- return code;
+ int code = 0, i;
+
+ for (i = 0; i < pfn->params.n; i++) {
+ if (V0[i] < V1[i])
+ code |= 1 << (i * 3);
+ else if (V0[i] > V1[i])
+ code |= 2 << (i * 3);
+ }
+ return code;
} else {
- double VV[MAX_FAST_COMPS];
- int ii = (i0 + i1) / 2, code, cod1;
-
- code = load_vector_to(pfn, ii * pfn->params.n * pfn->params.BitsPerSample, VV);
- if (code < 0)
- return code;
- if (code & (code >> 1))
- return code; /* Not monotonic by some component of the result. */
- code = fn_Sd_1arg_linear_monotonic_rec(pfn, i0, ii, V0, VV);
- if (code < 0)
- return code;
- cod1 = fn_Sd_1arg_linear_monotonic_rec(pfn, ii, i1, VV, V1);
- if (cod1 < 0)
- return cod1;
- return code | cod1;
+ double VV[MAX_FAST_COMPS];
+ int ii = (i0 + i1) / 2, code, cod1;
+
+ code = load_vector_to(pfn, ii * pfn->params.n * pfn->params.BitsPerSample, VV);
+ if (code < 0)
+ return code;
+ if (code & (code >> 1))
+ return code; /* Not monotonic by some component of the result. */
+ code = fn_Sd_1arg_linear_monotonic_rec(pfn, i0, ii, V0, VV);
+ if (code < 0)
+ return code;
+ cod1 = fn_Sd_1arg_linear_monotonic_rec(pfn, ii, i1, VV, V1);
+ if (cod1 < 0)
+ return cod1;
+ return code | cod1;
}
}
static int
fn_Sd_1arg_linear_monotonic(const gs_function_Sd_t *const pfn, double T0, double T1,
- uint *mask /* 1 - non-monotonic or don't know, 0 - monotonic. */)
+ uint *mask /* 1 - non-monotonic or don't know, 0 - monotonic. */)
{
int i0 = (int)floor(T0);
int i1 = (int)ceil(T1), code;
double V0[MAX_FAST_COMPS], V1[MAX_FAST_COMPS];
if (i1 - i0 > 1) {
- code = load_vector_to(pfn, i0 * pfn->params.n * pfn->params.BitsPerSample, V0);
- if (code < 0)
- return code;
- code = load_vector_to(pfn, i1 * pfn->params.n * pfn->params.BitsPerSample, V1);
- if (code < 0)
- return code;
- code = fn_Sd_1arg_linear_monotonic_rec(pfn, i0, i1, V0, V1);
- if (code < 0)
- return code;
- if (code & (code >> 1)) {
- *mask = 1;
- return 0;
- }
+ code = load_vector_to(pfn, i0 * pfn->params.n * pfn->params.BitsPerSample, V0);
+ if (code < 0)
+ return code;
+ code = load_vector_to(pfn, i1 * pfn->params.n * pfn->params.BitsPerSample, V1);
+ if (code < 0)
+ return code;
+ code = fn_Sd_1arg_linear_monotonic_rec(pfn, i0, i1, V0, V1);
+ if (code < 0)
+ return code;
+ if (code & (code >> 1)) {
+ *mask = 1;
+ return 0;
+ }
}
*mask = 0;
return 1;
@@ -1196,60 +1195,60 @@ fn_Sd_1arg_linear_monotonic(const gs_function_Sd_t *const pfn, double T0, double
/* Test whether a Sampled function is monotonic. */
static int /* 1 = monotonic, 0 = not or don't know, <0 = error. */
fn_Sd_is_monotonic_aux(const gs_function_Sd_t *const pfn,
- const float *lower, const float *upper,
- uint *mask /* 1 bit per dimension : 1 - non-monotonic or don't know,
- 0 - monotonic. */)
+ const float *lower, const float *upper,
+ uint *mask /* 1 bit per dimension : 1 - non-monotonic or don't know,
+ 0 - monotonic. */)
{
int i, code, ii = pfn->params.m - 1;
int I[4];
double T0[count_of(I)], T1[count_of(I)];
- double S0[count_of(I)], S1[count_of(I)];
+ double S0[count_of(I)], S1[count_of(I)];
uint m, mm, m1;
# if DEBUG_Sd_1arg
int code1, mask1;
# endif
if (ii >= count_of(T0)) {
- /* Unimplemented. We don't know practical cases,
- because currently it is only called while decomposing a shading. */
- return_error(gs_error_limitcheck);
+ /* Unimplemented. We don't know practical cases,
+ because currently it is only called while decomposing a shading. */
+ return_error(gs_error_limitcheck);
}
for (i = 0; i <= ii; i++) {
- float w0, w1;
+ float w0, w1;
- code = get_scaled_range(pfn, lower, upper, i, &w0, &w1);
- if (code < 0)
- return code;
- T0[i] = w0;
- T1[i] = w1;
+ code = get_scaled_range(pfn, lower, upper, i, &w0, &w1);
+ if (code < 0)
+ return code;
+ T0[i] = w0;
+ T1[i] = w1;
}
if (pfn->params.m == 1 && pfn->params.Order == 1 && pfn->params.n <= MAX_FAST_COMPS) {
- code = fn_Sd_1arg_linear_monotonic(pfn, T0[0], T1[0], mask);
+ code = fn_Sd_1arg_linear_monotonic(pfn, T0[0], T1[0], mask);
# if !DEBUG_Sd_1arg
- return code;
+ return code;
# else
- mask1 = *mask;
- code1 = code;
+ mask1 = *mask;
+ code1 = code;
# endif
}
m1 = (1 << pfn->params.m )- 1;
code = make_interpolation_nodes(pfn, T0, T1, I, S0, 0, 0, ii);
if (code < 0)
- return code;
+ return code;
mm = 0;
for (i = 0; i < pfn->params.n; i++) {
- code = is_lattice_monotonic(pfn, T0, T1, I, S0, S1, i, &m);
- if (code < 0)
- return code;
- mm |= m;
- if (mm == m1) /* Don't return early - shadings need to know about all dimensions. */
- break;
+ code = is_lattice_monotonic(pfn, T0, T1, I, S0, S1, i, &m);
+ if (code < 0)
+ return code;
+ mm |= m;
+ if (mm == m1) /* Don't return early - shadings need to know about all dimensions. */
+ break;
}
# if DEBUG_Sd_1arg
- if (mask1 != mm)
- return_error(gs_error_unregistered);
- if (code1 != !mm)
- return_error(gs_error_unregistered);
+ if (mask1 != mm)
+ return_error(gs_error_unregistered);
+ if (code1 != !mm)
+ return_error(gs_error_unregistered);
# endif
*mask = mm;
return !mm;
@@ -1259,10 +1258,10 @@ fn_Sd_is_monotonic_aux(const gs_function_Sd_t *const pfn,
/* 1 = monotonic, 0 = don't know, <0 = error. */
static int
fn_Sd_is_monotonic(const gs_function_t * pfn_common,
- const float *lower, const float *upper, uint *mask)
+ const float *lower, const float *upper, uint *mask)
{
const gs_function_Sd_t *const pfn =
- (const gs_function_Sd_t *)pfn_common;
+ (const gs_function_Sd_t *)pfn_common;
return fn_Sd_is_monotonic_aux(pfn, lower, upper, mask);
}
@@ -1272,16 +1271,16 @@ static void
fn_Sd_get_info(const gs_function_t *pfn_common, gs_function_info_t *pfi)
{
const gs_function_Sd_t *const pfn =
- (const gs_function_Sd_t *)pfn_common;
+ (const gs_function_Sd_t *)pfn_common;
long size;
int i;
gs_function_get_info_default(pfn_common, pfi);
pfi->DataSource = &pfn->params.DataSource;
for (i = 0, size = 1; i < pfn->params.m; ++i)
- size *= pfn->params.Size[i];
+ size *= pfn->params.Size[i];
pfi->data_size =
- (size * pfn->params.n * pfn->params.BitsPerSample + 7) >> 3;
+ (size * pfn->params.n * pfn->params.BitsPerSample + 7) >> 3;
}
/* Write Sampled function parameters on a parameter list. */
@@ -1289,33 +1288,33 @@ static int
fn_Sd_get_params(const gs_function_t *pfn_common, gs_param_list *plist)
{
const gs_function_Sd_t *const pfn =
- (const gs_function_Sd_t *)pfn_common;
+ (const gs_function_Sd_t *)pfn_common;
int ecode = fn_common_get_params(pfn_common, plist);
int code;
if (pfn->params.Order != 1) {
- if ((code = param_write_int(plist, "Order", &pfn->params.Order)) < 0)
- ecode = code;
+ if ((code = param_write_int(plist, "Order", &pfn->params.Order)) < 0)
+ ecode = code;
}
if ((code = param_write_int(plist, "BitsPerSample",
- &pfn->params.BitsPerSample)) < 0)
- ecode = code;
+ &pfn->params.BitsPerSample)) < 0)
+ ecode = code;
if (pfn->params.Encode) {
- if ((code = param_write_float_values(plist, "Encode",
- pfn->params.Encode,
- 2 * pfn->params.m, false)) < 0)
- ecode = code;
+ if ((code = param_write_float_values(plist, "Encode",
+ pfn->params.Encode,
+ 2 * pfn->params.m, false)) < 0)
+ ecode = code;
}
if (pfn->params.Decode) {
- if ((code = param_write_float_values(plist, "Decode",
- pfn->params.Decode,
- 2 * pfn->params.n, false)) < 0)
- ecode = code;
+ if ((code = param_write_float_values(plist, "Decode",
+ pfn->params.Decode,
+ 2 * pfn->params.n, false)) < 0)
+ ecode = code;
}
if (pfn->params.Size) {
- if ((code = param_write_int_values(plist, "Size", pfn->params.Size,
- pfn->params.m, false)) < 0)
- ecode = code;
+ if ((code = param_write_int_values(plist, "Size", pfn->params.Size,
+ pfn->params.m, false)) < 0)
+ ecode = code;
}
return ecode;
}
@@ -1323,32 +1322,32 @@ fn_Sd_get_params(const gs_function_t *pfn_common, gs_param_list *plist)
/* Make a scaled copy of a Sampled function. */
static int
fn_Sd_make_scaled(const gs_function_Sd_t *pfn, gs_function_Sd_t **ppsfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
{
gs_function_Sd_t *psfn =
- gs_alloc_struct(mem, gs_function_Sd_t, &st_function_Sd,
- "fn_Sd_make_scaled");
+ gs_alloc_struct(mem, gs_function_Sd_t, &st_function_Sd,
+ "fn_Sd_make_scaled");
int code;
if (psfn == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
psfn->params = pfn->params;
psfn->params.Encode = 0; /* in case of failure */
psfn->params.Decode = 0;
psfn->params.Size =
- fn_copy_values(pfn->params.Size, pfn->params.m, sizeof(int), mem);
+ fn_copy_values(pfn->params.Size, pfn->params.m, sizeof(int), mem);
if ((code = (psfn->params.Size == 0 ?
- gs_note_error(gs_error_VMerror) : 0)) < 0 ||
- (code = fn_common_scale((gs_function_t *)psfn,
- (const gs_function_t *)pfn,
- pranges, mem)) < 0 ||
- (code = fn_scale_pairs(&psfn->params.Encode, pfn->params.Encode,
- pfn->params.m, NULL, mem)) < 0 ||
- (code = fn_scale_pairs(&psfn->params.Decode, pfn->params.Decode,
- pfn->params.n, pranges, mem)) < 0) {
- gs_function_free((gs_function_t *)psfn, true, mem);
+ gs_note_error(gs_error_VMerror) : 0)) < 0 ||
+ (code = fn_common_scale((gs_function_t *)psfn,
+ (const gs_function_t *)pfn,
+ pranges, mem)) < 0 ||
+ (code = fn_scale_pairs(&psfn->params.Encode, pfn->params.Encode,
+ pfn->params.m, NULL, mem)) < 0 ||
+ (code = fn_scale_pairs(&psfn->params.Decode, pfn->params.Decode,
+ pfn->params.n, pranges, mem)) < 0) {
+ gs_function_free((gs_function_t *)psfn, true, mem);
} else
- *ppsfn = psfn;
+ *ppsfn = psfn;
return code;
}
@@ -1373,11 +1372,11 @@ static int serialize_array(const float *a, int half_size, stream *s)
int i, code;
if (a != NULL)
- return sputs(s, (const byte *)a, sizeof(a[0]) * half_size * 2, &n);
+ return sputs(s, (const byte *)a, sizeof(a[0]) * half_size * 2, &n);
for (i = 0; i < half_size; i++) {
- code = sputs(s, (const byte *)dummy, sizeof(dummy), &n);
- if (code < 0)
- return code;
+ code = sputs(s, (const byte *)dummy, sizeof(dummy), &n);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -1396,29 +1395,29 @@ gs_function_Sd_serialize(const gs_function_t * pfn, stream *s)
const byte *ptr;
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->Order, sizeof(p->Order), &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->BitsPerSample, sizeof(p->BitsPerSample), &n);
if (code < 0)
- return code;
+ return code;
code = serialize_array(p->Encode, p->m, s);
if (code < 0)
- return code;
+ return code;
code = serialize_array(p->Decode, p->n, s);
if (code < 0)
- return code;
+ return code;
gs_function_get_info(pfn, &info);
code = sputs(s, (const byte *)&info.data_size, sizeof(info.data_size), &n);
if (code < 0)
- return code;
+ return code;
for (pos = 0; pos < info.data_size; pos += count) {
- count = min(sizeof(buf), info.data_size - pos);
- data_source_access_only(info.DataSource, pos, count, buf, &ptr);
- code = sputs(s, ptr, count, &n);
- if (code < 0)
- return code;
+ count = min(sizeof(buf), info.data_size - pos);
+ data_source_access_only(info.DataSource, pos, count, buf, &ptr);
+ code = sputs(s, ptr, count, &n);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -1426,99 +1425,99 @@ gs_function_Sd_serialize(const gs_function_t * pfn, stream *s)
/* Allocate and initialize a Sampled function. */
int
gs_function_Sd_init(gs_function_t ** ppfn,
- const gs_function_Sd_params_t * params, gs_memory_t * mem)
+ const gs_function_Sd_params_t * params, gs_memory_t * mem)
{
static const gs_function_head_t function_Sd_head = {
- function_type_Sampled,
- {
- (fn_evaluate_proc_t) fn_Sd_evaluate,
- (fn_is_monotonic_proc_t) fn_Sd_is_monotonic,
- (fn_get_info_proc_t) fn_Sd_get_info,
- (fn_get_params_proc_t) fn_Sd_get_params,
- (fn_make_scaled_proc_t) fn_Sd_make_scaled,
- (fn_free_params_proc_t) gs_function_Sd_free_params,
- fn_common_free,
- (fn_serialize_proc_t) gs_function_Sd_serialize,
- }
+ function_type_Sampled,
+ {
+ (fn_evaluate_proc_t) fn_Sd_evaluate,
+ (fn_is_monotonic_proc_t) fn_Sd_is_monotonic,
+ (fn_get_info_proc_t) fn_Sd_get_info,
+ (fn_get_params_proc_t) fn_Sd_get_params,
+ (fn_make_scaled_proc_t) fn_Sd_make_scaled,
+ (fn_free_params_proc_t) gs_function_Sd_free_params,
+ fn_common_free,
+ (fn_serialize_proc_t) gs_function_Sd_serialize,
+ }
};
int code;
int i;
*ppfn = 0; /* in case of error */
code = fn_check_mnDR((const gs_function_params_t *)params,
- params->m, params->n);
+ params->m, params->n);
if (code < 0)
- return code;
+ return code;
if (params->m > max_Sd_m)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
switch (params->Order) {
- case 0: /* use default */
- case 1:
- case 3:
- break;
- default:
- return_error(gs_error_rangecheck);
+ case 0: /* use default */
+ case 1:
+ case 3:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
switch (params->BitsPerSample) {
- case 1:
- case 2:
- case 4:
- case 8:
- case 12:
- case 16:
- case 24:
- case 32:
- break;
- default:
- return_error(gs_error_rangecheck);
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ case 12:
+ case 16:
+ case 24:
+ case 32:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
for (i = 0; i < params->m; ++i)
- if (params->Size[i] <= 0)
- return_error(gs_error_rangecheck);
+ if (params->Size[i] <= 0)
+ return_error(gs_error_rangecheck);
{
- gs_function_Sd_t *pfn =
- gs_alloc_struct(mem, gs_function_Sd_t, &st_function_Sd,
- "gs_function_Sd_init");
- int bps, sa, ss, i, order;
-
- if (pfn == 0)
- return_error(gs_error_VMerror);
- pfn->params = *params;
- if (params->Order == 0)
- pfn->params.Order = 1; /* default */
- pfn->params.pole = NULL;
- pfn->params.array_step = NULL;
- pfn->params.stream_step = NULL;
- pfn->head = function_Sd_head;
- pfn->params.array_size = 0;
- if (pfn->params.m == 1 && pfn->params.Order == 1 && pfn->params.n <= MAX_FAST_COMPS && !DEBUG_Sd_1arg) {
- /* Won't use pole cache. Call fn_Sd_1arg_linear_monotonic instead. */
- } else {
- pfn->params.array_step = (int *)gs_alloc_byte_array(mem,
- max_Sd_m, sizeof(int), "gs_function_Sd_init");
- pfn->params.stream_step = (int *)gs_alloc_byte_array(mem,
- max_Sd_m, sizeof(int), "gs_function_Sd_init");
- if (pfn->params.array_step == NULL || pfn->params.stream_step == NULL)
- return_error(gs_error_VMerror);
- bps = pfn->params.BitsPerSample;
- sa = pfn->params.n;
- ss = pfn->params.n * bps;
- order = pfn->params.Order;
- for (i = 0; i < pfn->params.m; i++) {
- pfn->params.array_step[i] = sa * order;
- sa = (pfn->params.Size[i] * order - (order - 1)) * sa;
- pfn->params.stream_step[i] = ss;
- ss = pfn->params.Size[i] * ss;
- }
- pfn->params.pole = (double *)gs_alloc_byte_array(mem,
- sa, sizeof(double), "gs_function_Sd_init");
- if (pfn->params.pole == NULL)
- return_error(gs_error_VMerror);
- for (i = 0; i < sa; i++)
- pfn->params.pole[i] = double_stub;
- pfn->params.array_size = sa;
- }
- *ppfn = (gs_function_t *) pfn;
+ gs_function_Sd_t *pfn =
+ gs_alloc_struct(mem, gs_function_Sd_t, &st_function_Sd,
+ "gs_function_Sd_init");
+ int bps, sa, ss, i, order;
+
+ if (pfn == 0)
+ return_error(gs_error_VMerror);
+ pfn->params = *params;
+ if (params->Order == 0)
+ pfn->params.Order = 1; /* default */
+ pfn->params.pole = NULL;
+ pfn->params.array_step = NULL;
+ pfn->params.stream_step = NULL;
+ pfn->head = function_Sd_head;
+ pfn->params.array_size = 0;
+ if (pfn->params.m == 1 && pfn->params.Order == 1 && pfn->params.n <= MAX_FAST_COMPS && !DEBUG_Sd_1arg) {
+ /* Won't use pole cache. Call fn_Sd_1arg_linear_monotonic instead. */
+ } else {
+ pfn->params.array_step = (int *)gs_alloc_byte_array(mem,
+ max_Sd_m, sizeof(int), "gs_function_Sd_init");
+ pfn->params.stream_step = (int *)gs_alloc_byte_array(mem,
+ max_Sd_m, sizeof(int), "gs_function_Sd_init");
+ if (pfn->params.array_step == NULL || pfn->params.stream_step == NULL)
+ return_error(gs_error_VMerror);
+ bps = pfn->params.BitsPerSample;
+ sa = pfn->params.n;
+ ss = pfn->params.n * bps;
+ order = pfn->params.Order;
+ for (i = 0; i < pfn->params.m; i++) {
+ pfn->params.array_step[i] = sa * order;
+ sa = (pfn->params.Size[i] * order - (order - 1)) * sa;
+ pfn->params.stream_step[i] = ss;
+ ss = pfn->params.Size[i] * ss;
+ }
+ pfn->params.pole = (double *)gs_alloc_byte_array(mem,
+ sa, sizeof(double), "gs_function_Sd_init");
+ if (pfn->params.pole == NULL)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < sa; i++)
+ pfn->params.pole[i] = double_stub;
+ pfn->params.array_size = sa;
+ }
+ *ppfn = (gs_function_t *) pfn;
}
return 0;
}
diff --git a/gs/base/gsfunc0.h b/gs/base/gsfunc0.h
index 3ec3be7a6..c50344e04 100644
--- a/gs/base/gsfunc0.h
+++ b/gs/base/gsfunc0.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,11 +48,11 @@ typedef struct gs_function_Sd_params_s {
/* Allocate and initialize a Sampled function. */
int gs_function_Sd_init(gs_function_t ** ppfn,
- const gs_function_Sd_params_t * params,
- gs_memory_t * mem);
+ const gs_function_Sd_params_t * params,
+ gs_memory_t * mem);
/* Free the parameters of a Sampled function. */
void gs_function_Sd_free_params(gs_function_Sd_params_t * params,
- gs_memory_t * mem);
+ gs_memory_t * mem);
#endif /* gsfunc0_INCLUDED */
diff --git a/gs/base/gsfunc3.c b/gs/base/gsfunc3.c
index 990a6b0df..30f4c603d 100644
--- a/gs/base/gsfunc3.c
+++ b/gs/base/gsfunc3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,13 +35,13 @@
*/
static void
fn_free_functions(const gs_function_t *const * Functions, int count,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int i;
for (i = count; --i >= 0;)
- if (Functions[i])
- gs_function_free((gs_function_t *)Functions[i], true, mem);
+ if (Functions[i])
+ gs_function_free((gs_function_t *)Functions[i], true, mem);
gs_free_const_object(mem, Functions, "Functions");
}
@@ -52,25 +52,25 @@ fn_free_functions(const gs_function_t *const * Functions, int count,
*/
static int
fn_scale_functions(gs_function_t ***ppsfns, const gs_function_t *const *pfns,
- int count, const gs_range_t *pranges, bool step_ranges,
- gs_memory_t *mem)
+ int count, const gs_range_t *pranges, bool step_ranges,
+ gs_memory_t *mem)
{
gs_function_t **psfns;
int code = alloc_function_array(count, &psfns, mem);
const gs_range_t *ranges = pranges;
int i;
-
+
if (code < 0)
- return code;
+ return code;
for (i = 0; i < count; ++i) {
- int code = gs_function_make_scaled(pfns[i], &psfns[i], ranges, mem);
-
- if (code < 0) {
- fn_free_functions((const gs_function_t *const *)psfns, count, mem);
- return code;
- }
- if (step_ranges)
- ++ranges;
+ int code = gs_function_make_scaled(pfns[i], &psfns[i], ranges, mem);
+
+ if (code < 0) {
+ fn_free_functions((const gs_function_t *const *)psfns, count, mem);
+ return code;
+ }
+ if (step_ranges)
+ ++ranges;
}
*ppsfns = psfns;
return 0;
@@ -90,31 +90,31 @@ static int
fn_ElIn_evaluate(const gs_function_t * pfn_common, const float *in, float *out)
{
const gs_function_ElIn_t *const pfn =
- (const gs_function_ElIn_t *)pfn_common;
+ (const gs_function_ElIn_t *)pfn_common;
double arg = in[0], raised;
int i;
if (arg < pfn->params.Domain[0])
- arg = pfn->params.Domain[0];
+ arg = pfn->params.Domain[0];
else if (arg > pfn->params.Domain[1])
- arg = pfn->params.Domain[1];
+ arg = pfn->params.Domain[1];
raised = pow(arg, pfn->params.N);
for (i = 0; i < pfn->params.n; ++i) {
- float v0 = (pfn->params.C0 == 0 ? 0.0 : pfn->params.C0[i]);
- float v1 = (pfn->params.C1 == 0 ? 1.0 : pfn->params.C1[i]);
- double value = v0 + raised * (v1 - v0);
-
- if (pfn->params.Range) {
- float r0 = pfn->params.Range[2 * i],
- r1 = pfn->params.Range[2 * i + 1];
-
- if (value < r0)
- value = r0;
- else if (value > r1)
- value = r1;
- }
- out[i] = value;
- if_debug3('~', "[~]ElIn %g => [%d]%g\n", arg, i, out[i]);
+ float v0 = (pfn->params.C0 == 0 ? 0.0 : pfn->params.C0[i]);
+ float v1 = (pfn->params.C1 == 0 ? 1.0 : pfn->params.C1[i]);
+ double value = v0 + raised * (v1 - v0);
+
+ if (pfn->params.Range) {
+ float r0 = pfn->params.Range[2 * i],
+ r1 = pfn->params.Range[2 * i + 1];
+
+ if (value < r0)
+ value = r0;
+ else if (value > r1)
+ value = r1;
+ }
+ out[i] = value;
+ if_debug3('~', "[~]ElIn %g => [%d]%g\n", arg, i, out[i]);
}
return 0;
}
@@ -122,15 +122,15 @@ fn_ElIn_evaluate(const gs_function_t * pfn_common, const float *in, float *out)
/* Test whether an Exponential function is monotonic. (They always are.) */
static int
fn_ElIn_is_monotonic(const gs_function_t * pfn_common,
- const float *lower, const float *upper, uint *mask)
+ const float *lower, const float *upper, uint *mask)
{
const gs_function_ElIn_t *const pfn =
- (const gs_function_ElIn_t *)pfn_common;
+ (const gs_function_ElIn_t *)pfn_common;
if (lower[0] > pfn->params.Domain[1] ||
- upper[0] < pfn->params.Domain[0]
- )
- return_error(gs_error_rangecheck);
+ upper[0] < pfn->params.Domain[0]
+ )
+ return_error(gs_error_rangecheck);
*mask = 0;
return 1;
}
@@ -140,59 +140,59 @@ static int
fn_ElIn_get_params(const gs_function_t *pfn_common, gs_param_list *plist)
{
const gs_function_ElIn_t *const pfn =
- (const gs_function_ElIn_t *)pfn_common;
+ (const gs_function_ElIn_t *)pfn_common;
int ecode = fn_common_get_params(pfn_common, plist);
int code;
if (pfn->params.C0) {
- if ((code = param_write_float_values(plist, "C0", pfn->params.C0,
- pfn->params.n, false)) < 0)
- ecode = code;
+ if ((code = param_write_float_values(plist, "C0", pfn->params.C0,
+ pfn->params.n, false)) < 0)
+ ecode = code;
}
if (pfn->params.C1) {
- if ((code = param_write_float_values(plist, "C1", pfn->params.C1,
- pfn->params.n, false)) < 0)
- ecode = code;
+ if ((code = param_write_float_values(plist, "C1", pfn->params.C1,
+ pfn->params.n, false)) < 0)
+ ecode = code;
}
if ((code = param_write_float(plist, "N", &pfn->params.N)) < 0)
- ecode = code;
+ ecode = code;
return ecode;
}
/* Make a scaled copy of an Exponential Interpolation function. */
static int
fn_ElIn_make_scaled(const gs_function_ElIn_t *pfn,
- gs_function_ElIn_t **ppsfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ gs_function_ElIn_t **ppsfn,
+ const gs_range_t *pranges, gs_memory_t *mem)
{
gs_function_ElIn_t *psfn =
- gs_alloc_struct(mem, gs_function_ElIn_t, &st_function_ElIn,
- "fn_ElIn_make_scaled");
+ gs_alloc_struct(mem, gs_function_ElIn_t, &st_function_ElIn,
+ "fn_ElIn_make_scaled");
float *c0;
float *c1;
int code, i;
if (psfn == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
psfn->params = pfn->params;
psfn->params.C0 = c0 =
- fn_copy_values(pfn->params.C0, pfn->params.n, sizeof(float), mem);
+ fn_copy_values(pfn->params.C0, pfn->params.n, sizeof(float), mem);
psfn->params.C1 = c1 =
- fn_copy_values(pfn->params.C1, pfn->params.n, sizeof(float), mem);
+ fn_copy_values(pfn->params.C1, pfn->params.n, sizeof(float), mem);
if ((code = ((c0 == 0 && pfn->params.C0 != 0) ||
- (c1 == 0 && pfn->params.C1 != 0) ?
- gs_note_error(gs_error_VMerror) : 0)) < 0 ||
- (code = fn_common_scale((gs_function_t *)psfn,
- (const gs_function_t *)pfn,
- pranges, mem)) < 0) {
- gs_function_free((gs_function_t *)psfn, true, mem);
- return code;
+ (c1 == 0 && pfn->params.C1 != 0) ?
+ gs_note_error(gs_error_VMerror) : 0)) < 0 ||
+ (code = fn_common_scale((gs_function_t *)psfn,
+ (const gs_function_t *)pfn,
+ pranges, mem)) < 0) {
+ gs_function_free((gs_function_t *)psfn, true, mem);
+ return code;
}
for (i = 0; i < pfn->params.n; ++i) {
- double base = pranges[i].rmin, factor = pranges[i].rmax - base;
+ double base = pranges[i].rmin, factor = pranges[i].rmax - base;
- c1[i] = c1[i] * factor + base;
- c0[i] = c0[i] * factor + base;
+ c1[i] = c1[i] * factor + base;
+ c0[i] = c0[i] * factor + base;
}
*ppsfn = psfn;
return 0;
@@ -201,7 +201,7 @@ fn_ElIn_make_scaled(const gs_function_ElIn_t *pfn,
/* Free the parameters of an Exponential Interpolation function. */
void
gs_function_ElIn_free_params(gs_function_ElIn_params_t * params,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
gs_free_const_object(mem, params->C1, "C1");
gs_free_const_object(mem, params->C0, "C0");
@@ -217,63 +217,63 @@ gs_function_ElIn_serialize(const gs_function_t * pfn, stream *s)
int code = fn_common_serialize(pfn, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->C0[0], sizeof(p->C0[0]) * p->n, &n);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->C1[0], sizeof(p->C1[0]) * p->n, &n);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->N, sizeof(p->N), &n);
}
/* Allocate and initialize an Exponential Interpolation function. */
int
gs_function_ElIn_init(gs_function_t ** ppfn,
- const gs_function_ElIn_params_t * params,
- gs_memory_t * mem)
+ const gs_function_ElIn_params_t * params,
+ gs_memory_t * mem)
{
static const gs_function_head_t function_ElIn_head = {
- function_type_ExponentialInterpolation,
- {
- (fn_evaluate_proc_t) fn_ElIn_evaluate,
- (fn_is_monotonic_proc_t) fn_ElIn_is_monotonic,
- gs_function_get_info_default,
- (fn_get_params_proc_t) fn_ElIn_get_params,
- (fn_make_scaled_proc_t) fn_ElIn_make_scaled,
- (fn_free_params_proc_t) gs_function_ElIn_free_params,
- fn_common_free,
- (fn_serialize_proc_t) gs_function_ElIn_serialize,
- }
+ function_type_ExponentialInterpolation,
+ {
+ (fn_evaluate_proc_t) fn_ElIn_evaluate,
+ (fn_is_monotonic_proc_t) fn_ElIn_is_monotonic,
+ gs_function_get_info_default,
+ (fn_get_params_proc_t) fn_ElIn_get_params,
+ (fn_make_scaled_proc_t) fn_ElIn_make_scaled,
+ (fn_free_params_proc_t) gs_function_ElIn_free_params,
+ fn_common_free,
+ (fn_serialize_proc_t) gs_function_ElIn_serialize,
+ }
};
int code;
*ppfn = 0; /* in case of error */
code = fn_check_mnDR((const gs_function_params_t *)params, 1, params->n);
if (code < 0)
- return code;
+ return code;
if ((params->C0 == 0 || params->C1 == 0) && params->n != 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (params->N != floor(params->N)) {
- /* Non-integral exponent, all inputs must be non-negative. */
- if (params->Domain[0] < 0)
- return_error(gs_error_rangecheck);
+ /* Non-integral exponent, all inputs must be non-negative. */
+ if (params->Domain[0] < 0)
+ return_error(gs_error_rangecheck);
}
if (params->N < 0) {
- /* Negative exponent, input must not be zero. */
- if (params->Domain[0] <= 0 && params->Domain[1] >= 0)
- return_error(gs_error_rangecheck);
+ /* Negative exponent, input must not be zero. */
+ if (params->Domain[0] <= 0 && params->Domain[1] >= 0)
+ return_error(gs_error_rangecheck);
} {
- gs_function_ElIn_t *pfn =
- gs_alloc_struct(mem, gs_function_ElIn_t, &st_function_ElIn,
- "gs_function_ElIn_init");
-
- if (pfn == 0)
- return_error(gs_error_VMerror);
- pfn->params = *params;
- pfn->params.m = 1;
- pfn->head = function_ElIn_head;
- *ppfn = (gs_function_t *) pfn;
+ gs_function_ElIn_t *pfn =
+ gs_alloc_struct(mem, gs_function_ElIn_t, &st_function_ElIn,
+ "gs_function_ElIn_init");
+
+ if (pfn == 0)
+ return_error(gs_error_VMerror);
+ pfn->params = *params;
+ pfn->params.m = 1;
+ pfn->head = function_ElIn_head;
+ *ppfn = (gs_function_t *) pfn;
}
return 0;
}
@@ -292,30 +292,30 @@ static int
fn_1ItSg_evaluate(const gs_function_t * pfn_common, const float *in, float *out)
{
const gs_function_1ItSg_t *const pfn =
- (const gs_function_1ItSg_t *)pfn_common;
+ (const gs_function_1ItSg_t *)pfn_common;
float arg = in[0], b0, b1, e0, encoded;
int k = pfn->params.k;
int i;
if (arg < pfn->params.Domain[0]) {
- arg = pfn->params.Domain[0];
- i = 0;
+ arg = pfn->params.Domain[0];
+ i = 0;
} else if (arg > pfn->params.Domain[1]) {
- arg = pfn->params.Domain[1];
- i = k - 1;
+ arg = pfn->params.Domain[1];
+ i = k - 1;
} else {
- for (i = 0; i < k - 1; ++i)
- if (arg <= pfn->params.Bounds[i])
- break;
+ for (i = 0; i < k - 1; ++i)
+ if (arg <= pfn->params.Bounds[i])
+ break;
}
b0 = (i == 0 ? pfn->params.Domain[0] : pfn->params.Bounds[i - 1]);
b1 = (i == k - 1 ? pfn->params.Domain[1] : pfn->params.Bounds[i]);
e0 = pfn->params.Encode[2 * i];
if (b1 == b0)
- encoded = e0;
+ encoded = e0;
else
- encoded =
- (arg - b0) * (pfn->params.Encode[2 * i + 1] - e0) / (b1 - b0) + e0;
+ encoded =
+ (arg - b0) * (pfn->params.Encode[2 * i + 1] - e0) / (b1 - b0) + e0;
if_debug3('~', "[~]1ItSg %g in %d => %g\n", arg, i, encoded);
return gs_function_evaluate(pfn->params.Functions[i], &encoded, out);
}
@@ -323,10 +323,10 @@ fn_1ItSg_evaluate(const gs_function_t * pfn_common, const float *in, float *out)
/* Test whether a 1-Input Stitching function is monotonic. */
static int
fn_1ItSg_is_monotonic(const gs_function_t * pfn_common,
- const float *lower, const float *upper, uint *mask)
+ const float *lower, const float *upper, uint *mask)
{
const gs_function_1ItSg_t *const pfn =
- (const gs_function_1ItSg_t *)pfn_common;
+ (const gs_function_1ItSg_t *)pfn_common;
float v0 = lower[0], v1 = upper[0];
float d0 = pfn->params.Domain[0], d1 = pfn->params.Domain[1];
int k = pfn->params.k;
@@ -334,67 +334,67 @@ fn_1ItSg_is_monotonic(const gs_function_t * pfn_common,
*mask = 0;
if (v0 > v1) {
- v0 = v1; v1 = lower[0];
+ v0 = v1; v1 = lower[0];
}
if (v0 > d1 || v1 < d0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (v0 < d0)
- v0 = d0;
+ v0 = d0;
if (v1 > d1)
- v1 = d1;
+ v1 = d1;
for (i = 0; i < pfn->params.k; ++i) {
- float b0 = (i == 0 ? d0 : pfn->params.Bounds[i - 1]);
- float b1 = (i == k - 1 ? d1 : pfn->params.Bounds[i]);
- const float bsmall = (float)1e-6 * (b1 - b0);
- float esmall;
- float e0, e1;
- float w0, w1;
- float vv0, vv1;
- double vb0, vb1;
-
- if (v0 >= b1)
- continue;
- if (v0 >= b1 - bsmall)
- continue; /* Ignore a small noise */
- vv0 = max(b0, v0);
- vv1 = v1;
- if (vv1 > b1 && v1 < b1 + bsmall)
- vv1 = b1; /* Ignore a small noise */
- if (vv0 == vv1)
- return 1;
- if (vv0 < b1 && vv1 > b1) {
- *mask = 1;
- return 0; /* Consider stitches as monotonity breaks. */
- }
- e0 = pfn->params.Encode[2 * i];
- e1 = pfn->params.Encode[2 * i + 1];
- esmall = (float)1e-6 * any_abs(e1 - e0);
- vb0 = max(vv0, b0);
- vb1 = min(vv1, b1);
- w0 = (float)(vb0 - b0) * (e1 - e0) / (b1 - b0) + e0;
- w1 = (float)(vb1 - b0) * (e1 - e0) / (b1 - b0) + e0;
- /* Note that w0 > w1 is now possible if e0 > e1. */
- if (e0 > e1) {
- if (w0 > e0 && w0 - esmall <= e0)
- w0 = e0; /* Suppress a small noise */
- if (w1 < e1 && w1 + esmall >= e1)
- w1 = e1; /* Suppress a small noise */
- } else {
- if (w0 < e0 && w0 + esmall >= e0)
- w0 = e0; /* Suppress a small noise */
- if (w1 > e1 && w1 - esmall <= e1)
- w1 = e1; /* Suppress a small noise */
- }
- if (w0 > w1)
- return gs_function_is_monotonic(pfn->params.Functions[i],
- &w1, &w0, mask);
- else
- return gs_function_is_monotonic(pfn->params.Functions[i],
- &w0, &w1, mask);
+ float b0 = (i == 0 ? d0 : pfn->params.Bounds[i - 1]);
+ float b1 = (i == k - 1 ? d1 : pfn->params.Bounds[i]);
+ const float bsmall = (float)1e-6 * (b1 - b0);
+ float esmall;
+ float e0, e1;
+ float w0, w1;
+ float vv0, vv1;
+ double vb0, vb1;
+
+ if (v0 >= b1)
+ continue;
+ if (v0 >= b1 - bsmall)
+ continue; /* Ignore a small noise */
+ vv0 = max(b0, v0);
+ vv1 = v1;
+ if (vv1 > b1 && v1 < b1 + bsmall)
+ vv1 = b1; /* Ignore a small noise */
+ if (vv0 == vv1)
+ return 1;
+ if (vv0 < b1 && vv1 > b1) {
+ *mask = 1;
+ return 0; /* Consider stitches as monotonity breaks. */
+ }
+ e0 = pfn->params.Encode[2 * i];
+ e1 = pfn->params.Encode[2 * i + 1];
+ esmall = (float)1e-6 * any_abs(e1 - e0);
+ vb0 = max(vv0, b0);
+ vb1 = min(vv1, b1);
+ w0 = (float)(vb0 - b0) * (e1 - e0) / (b1 - b0) + e0;
+ w1 = (float)(vb1 - b0) * (e1 - e0) / (b1 - b0) + e0;
+ /* Note that w0 > w1 is now possible if e0 > e1. */
+ if (e0 > e1) {
+ if (w0 > e0 && w0 - esmall <= e0)
+ w0 = e0; /* Suppress a small noise */
+ if (w1 < e1 && w1 + esmall >= e1)
+ w1 = e1; /* Suppress a small noise */
+ } else {
+ if (w0 < e0 && w0 + esmall >= e0)
+ w0 = e0; /* Suppress a small noise */
+ if (w1 > e1 && w1 - esmall <= e1)
+ w1 = e1; /* Suppress a small noise */
+ }
+ if (w0 > w1)
+ return gs_function_is_monotonic(pfn->params.Functions[i],
+ &w1, &w0, mask);
+ else
+ return gs_function_is_monotonic(pfn->params.Functions[i],
+ &w0, &w1, mask);
}
/* v0 is equal to the range end. */
*mask = 0;
- return 1;
+ return 1;
}
/* Return 1-Input Stitching function information. */
@@ -402,7 +402,7 @@ static void
fn_1ItSg_get_info(const gs_function_t *pfn_common, gs_function_info_t *pfi)
{
const gs_function_1ItSg_t *const pfn =
- (const gs_function_1ItSg_t *)pfn_common;
+ (const gs_function_1ItSg_t *)pfn_common;
gs_function_get_info_default(pfn_common, pfi);
pfi->Functions = pfn->params.Functions;
@@ -414,50 +414,50 @@ static int
fn_1ItSg_get_params(const gs_function_t *pfn_common, gs_param_list *plist)
{
const gs_function_1ItSg_t *const pfn =
- (const gs_function_1ItSg_t *)pfn_common;
+ (const gs_function_1ItSg_t *)pfn_common;
int ecode = fn_common_get_params(pfn_common, plist);
int code;
if ((code = param_write_float_values(plist, "Bounds", pfn->params.Bounds,
- pfn->params.k - 1, false)) < 0)
- ecode = code;
+ pfn->params.k - 1, false)) < 0)
+ ecode = code;
if ((code = param_write_float_values(plist, "Encode", pfn->params.Encode,
- 2 * pfn->params.k, false)) < 0)
- ecode = code;
+ 2 * pfn->params.k, false)) < 0)
+ ecode = code;
return ecode;
}
/* Make a scaled copy of a 1-Input Stitching function. */
static int
fn_1ItSg_make_scaled(const gs_function_1ItSg_t *pfn,
- gs_function_1ItSg_t **ppsfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ gs_function_1ItSg_t **ppsfn,
+ const gs_range_t *pranges, gs_memory_t *mem)
{
gs_function_1ItSg_t *psfn =
- gs_alloc_struct(mem, gs_function_1ItSg_t, &st_function_1ItSg,
- "fn_1ItSg_make_scaled");
+ gs_alloc_struct(mem, gs_function_1ItSg_t, &st_function_1ItSg,
+ "fn_1ItSg_make_scaled");
int code;
if (psfn == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
psfn->params = pfn->params;
psfn->params.Functions = 0; /* in case of failure */
psfn->params.Bounds =
- fn_copy_values(pfn->params.Bounds, pfn->params.k - 1, sizeof(float),
- mem);
+ fn_copy_values(pfn->params.Bounds, pfn->params.k - 1, sizeof(float),
+ mem);
psfn->params.Encode =
- fn_copy_values(pfn->params.Encode, 2 * pfn->params.k, sizeof(float),
- mem);
+ fn_copy_values(pfn->params.Encode, 2 * pfn->params.k, sizeof(float),
+ mem);
if ((code = (psfn->params.Bounds == 0 || psfn->params.Encode == 0 ?
- gs_note_error(gs_error_VMerror) : 0)) < 0 ||
- (code = fn_common_scale((gs_function_t *)psfn,
- (const gs_function_t *)pfn,
- pranges, mem)) < 0 ||
- (code = fn_scale_functions((gs_function_t ***)&psfn->params.Functions,
- pfn->params.Functions,
- pfn->params.n, pranges, false, mem)) < 0) {
- gs_function_free((gs_function_t *)psfn, true, mem);
- return code;
+ gs_note_error(gs_error_VMerror) : 0)) < 0 ||
+ (code = fn_common_scale((gs_function_t *)psfn,
+ (const gs_function_t *)pfn,
+ pranges, mem)) < 0 ||
+ (code = fn_scale_functions((gs_function_t ***)&psfn->params.Functions,
+ pfn->params.Functions,
+ pfn->params.n, pranges, false, mem)) < 0) {
+ gs_function_free((gs_function_t *)psfn, true, mem);
+ return code;
}
*ppsfn = psfn;
return 0;
@@ -466,7 +466,7 @@ fn_1ItSg_make_scaled(const gs_function_1ItSg_t *pfn,
/* Free the parameters of a 1-Input Stitching function. */
void
gs_function_1ItSg_free_params(gs_function_1ItSg_params_t * params,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
gs_free_const_object(mem, params->Encode, "Encode");
gs_free_const_object(mem, params->Bounds, "Bounds");
@@ -484,38 +484,38 @@ gs_function_1ItSg_serialize(const gs_function_t * pfn, stream *s)
int k;
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->k, sizeof(p->k), &n);
if (code < 0)
- return code;
+ return code;
- for (k = 0; k < p->k && code >= 0; k++)
- code = gs_function_serialize(p->Functions[k], s);
+ for (k = 0; k < p->k && code >= 0; k++)
+ code = gs_function_serialize(p->Functions[k], s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->Bounds[0], sizeof(p->Bounds[0]) * (p->k - 1), &n);
if (code < 0)
- return code;
+ return code;
return sputs(s, (const byte *)&p->Encode[0], sizeof(p->Encode[0]) * (p->k * 2), &n);
}
/* Allocate and initialize a 1-Input Stitching function. */
int
gs_function_1ItSg_init(gs_function_t ** ppfn,
- const gs_function_1ItSg_params_t * params, gs_memory_t * mem)
+ const gs_function_1ItSg_params_t * params, gs_memory_t * mem)
{
static const gs_function_head_t function_1ItSg_head = {
- function_type_1InputStitching,
- {
- (fn_evaluate_proc_t) fn_1ItSg_evaluate,
- (fn_is_monotonic_proc_t) fn_1ItSg_is_monotonic,
- (fn_get_info_proc_t) fn_1ItSg_get_info,
- (fn_get_params_proc_t) fn_1ItSg_get_params,
- (fn_make_scaled_proc_t) fn_1ItSg_make_scaled,
- (fn_free_params_proc_t) gs_function_1ItSg_free_params,
- fn_common_free,
- (fn_serialize_proc_t) gs_function_1ItSg_serialize,
- }
+ function_type_1InputStitching,
+ {
+ (fn_evaluate_proc_t) fn_1ItSg_evaluate,
+ (fn_is_monotonic_proc_t) fn_1ItSg_is_monotonic,
+ (fn_get_info_proc_t) fn_1ItSg_get_info,
+ (fn_get_params_proc_t) fn_1ItSg_get_params,
+ (fn_make_scaled_proc_t) fn_1ItSg_make_scaled,
+ (fn_free_params_proc_t) gs_function_1ItSg_free_params,
+ fn_common_free,
+ (fn_serialize_proc_t) gs_function_1ItSg_serialize,
+ }
};
int n = (params->Range == 0 ? 0 : params->n);
float prev = params->Domain[0];
@@ -523,36 +523,36 @@ gs_function_1ItSg_init(gs_function_t ** ppfn,
*ppfn = 0; /* in case of error */
for (i = 0; i < params->k; ++i) {
- const gs_function_t *psubfn = params->Functions[i];
-
- if (psubfn->params.m != 1)
- return_error(gs_error_rangecheck);
- if (n == 0)
- n = psubfn->params.n;
- else if (psubfn->params.n != n)
- return_error(gs_error_rangecheck);
- /* There are only k - 1 Bounds, not k. */
- if (i < params->k - 1) {
- if (params->Bounds[i] < prev)
- return_error(gs_error_rangecheck);
- prev = params->Bounds[i];
- }
+ const gs_function_t *psubfn = params->Functions[i];
+
+ if (psubfn->params.m != 1)
+ return_error(gs_error_rangecheck);
+ if (n == 0)
+ n = psubfn->params.n;
+ else if (psubfn->params.n != n)
+ return_error(gs_error_rangecheck);
+ /* There are only k - 1 Bounds, not k. */
+ if (i < params->k - 1) {
+ if (params->Bounds[i] < prev)
+ return_error(gs_error_rangecheck);
+ prev = params->Bounds[i];
+ }
}
if (params->Domain[1] < prev)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
fn_check_mnDR((const gs_function_params_t *)params, 1, n);
{
- gs_function_1ItSg_t *pfn =
- gs_alloc_struct(mem, gs_function_1ItSg_t, &st_function_1ItSg,
- "gs_function_1ItSg_init");
-
- if (pfn == 0)
- return_error(gs_error_VMerror);
- pfn->params = *params;
- pfn->params.m = 1;
- pfn->params.n = n;
- pfn->head = function_1ItSg_head;
- *ppfn = (gs_function_t *) pfn;
+ gs_function_1ItSg_t *pfn =
+ gs_alloc_struct(mem, gs_function_1ItSg_t, &st_function_1ItSg,
+ "gs_function_1ItSg_init");
+
+ if (pfn == 0)
+ return_error(gs_error_VMerror);
+ pfn->params = *params;
+ pfn->params.m = 1;
+ pfn->params.n = n;
+ pfn->head = function_1ItSg_head;
+ *ppfn = (gs_function_t *) pfn;
}
return 0;
}
@@ -571,7 +571,7 @@ static int
fn_AdOt_evaluate(const gs_function_t *pfn_common, const float *in0, float *out)
{
const gs_function_AdOt_t *const pfn =
- (const gs_function_AdOt_t *)pfn_common;
+ (const gs_function_AdOt_t *)pfn_common;
const float *in = in0;
#define MAX_ADOT_IN 16
float in_buf[MAX_ADOT_IN];
@@ -583,17 +583,17 @@ fn_AdOt_evaluate(const gs_function_t *pfn_common, const float *in0, float *out)
* input values.
*/
if (in <= out + (pfn->params.n - 1) && out <= in + (pfn->params.m - 1)) {
- if (pfn->params.m > MAX_ADOT_IN)
- return_error(gs_error_rangecheck);
- memcpy(in_buf, in, pfn->params.m * sizeof(*in));
- in = in_buf;
+ if (pfn->params.m > MAX_ADOT_IN)
+ return_error(gs_error_rangecheck);
+ memcpy(in_buf, in, pfn->params.m * sizeof(*in));
+ in = in_buf;
}
for (i = 0; i < pfn->params.n; ++i) {
- int code =
- gs_function_evaluate(pfn->params.Functions[i], in, out + i);
+ int code =
+ gs_function_evaluate(pfn->params.Functions[i], in, out + i);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
#undef MAX_ADOT_IN
@@ -602,18 +602,18 @@ fn_AdOt_evaluate(const gs_function_t *pfn_common, const float *in0, float *out)
/* Test whether an Arrayed Output function is monotonic. */
static int
fn_AdOt_is_monotonic(const gs_function_t * pfn_common,
- const float *lower, const float *upper, uint *mask)
+ const float *lower, const float *upper, uint *mask)
{
const gs_function_AdOt_t *const pfn =
- (const gs_function_AdOt_t *)pfn_common;
+ (const gs_function_AdOt_t *)pfn_common;
int i;
for (i = 0; i < pfn->params.n; ++i) {
- int code =
- gs_function_is_monotonic(pfn->params.Functions[i], lower, upper, mask);
+ int code =
+ gs_function_is_monotonic(pfn->params.Functions[i], lower, upper, mask);
- if (code <= 0)
- return code;
+ if (code <= 0)
+ return code;
}
return 1;
}
@@ -623,7 +623,7 @@ static void
fn_AdOt_get_info(const gs_function_t *pfn_common, gs_function_info_t *pfi)
{
const gs_function_AdOt_t *const pfn =
- (const gs_function_AdOt_t *)pfn_common;
+ (const gs_function_AdOt_t *)pfn_common;
gs_function_get_info_default(pfn_common, pfi);
pfi->Functions = pfn->params.Functions;
@@ -633,25 +633,25 @@ fn_AdOt_get_info(const gs_function_t *pfn_common, gs_function_info_t *pfi)
/* Make a scaled copy of an Arrayed Output function. */
static int
fn_AdOt_make_scaled(const gs_function_AdOt_t *pfn, gs_function_AdOt_t **ppsfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
{
gs_function_AdOt_t *psfn =
- gs_alloc_struct(mem, gs_function_AdOt_t, &st_function_AdOt,
- "fn_AdOt_make_scaled");
+ gs_alloc_struct(mem, gs_function_AdOt_t, &st_function_AdOt,
+ "fn_AdOt_make_scaled");
int code;
if (psfn == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
psfn->params = pfn->params;
psfn->params.Functions = 0; /* in case of failure */
if ((code = fn_common_scale((gs_function_t *)psfn,
- (const gs_function_t *)pfn,
- pranges, mem)) < 0 ||
- (code = fn_scale_functions((gs_function_t ***)&psfn->params.Functions,
- pfn->params.Functions,
- pfn->params.n, pranges, true, mem)) < 0) {
- gs_function_free((gs_function_t *)psfn, true, mem);
- return code;
+ (const gs_function_t *)pfn,
+ pranges, mem)) < 0 ||
+ (code = fn_scale_functions((gs_function_t ***)&psfn->params.Functions,
+ pfn->params.Functions,
+ pfn->params.n, pranges, true, mem)) < 0) {
+ gs_function_free((gs_function_t *)psfn, true, mem);
+ return code;
}
*ppsfn = psfn;
return 0;
@@ -660,7 +660,7 @@ fn_AdOt_make_scaled(const gs_function_AdOt_t *pfn, gs_function_AdOt_t **ppsfn,
/* Free the parameters of an Arrayed Output function. */
void
gs_function_AdOt_free_params(gs_function_AdOt_params_t * params,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
fn_free_functions(params->Functions, params->n, mem);
fn_common_free_params((gs_function_params_t *) params, mem);
@@ -675,74 +675,74 @@ gs_function_AdOt_serialize(const gs_function_t * pfn, stream *s)
int k;
if (code < 0)
- return code;
- for (k = 0; k < p->n && code >= 0; k++)
- code = gs_function_serialize(p->Functions[k], s);
+ return code;
+ for (k = 0; k < p->n && code >= 0; k++)
+ code = gs_function_serialize(p->Functions[k], s);
return code;
}
/* Allocate and initialize an Arrayed Output function. */
int
gs_function_AdOt_init(gs_function_t ** ppfn,
- const gs_function_AdOt_params_t * params, gs_memory_t * mem)
+ const gs_function_AdOt_params_t * params, gs_memory_t * mem)
{
static const gs_function_head_t function_AdOt_head = {
- function_type_ArrayedOutput,
- {
- (fn_evaluate_proc_t) fn_AdOt_evaluate,
- (fn_is_monotonic_proc_t) fn_AdOt_is_monotonic,
- (fn_get_info_proc_t) fn_AdOt_get_info,
- fn_common_get_params, /****** WHAT TO DO ABOUT THIS? ******/
- (fn_make_scaled_proc_t) fn_AdOt_make_scaled,
- (fn_free_params_proc_t) gs_function_AdOt_free_params,
- fn_common_free,
- (fn_serialize_proc_t) gs_function_AdOt_serialize,
- }
+ function_type_ArrayedOutput,
+ {
+ (fn_evaluate_proc_t) fn_AdOt_evaluate,
+ (fn_is_monotonic_proc_t) fn_AdOt_is_monotonic,
+ (fn_get_info_proc_t) fn_AdOt_get_info,
+ fn_common_get_params, /****** WHAT TO DO ABOUT THIS? ******/
+ (fn_make_scaled_proc_t) fn_AdOt_make_scaled,
+ (fn_free_params_proc_t) gs_function_AdOt_free_params,
+ fn_common_free,
+ (fn_serialize_proc_t) gs_function_AdOt_serialize,
+ }
};
int m = params->m, n = params->n;
*ppfn = 0; /* in case of error */
if (m <= 0 || n <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
{
- gs_function_AdOt_t *pfn =
- gs_alloc_struct(mem, gs_function_AdOt_t, &st_function_AdOt,
- "gs_function_AdOt_init");
- float *domain = (float *)
- gs_alloc_byte_array(mem, 2 * m, sizeof(float),
- "gs_function_AdOt_init(Domain)");
- int i, j;
-
- if (pfn == 0)
- return_error(gs_error_VMerror);
- pfn->params = *params;
- pfn->params.Domain = domain;
- pfn->params.Range = 0;
- pfn->head = function_AdOt_head;
- if (domain == 0) {
- gs_function_free((gs_function_t *)pfn, true, mem);
- return_error(gs_error_VMerror);
- }
- /*
- * We compute the Domain as the intersection of the Domains of
- * the individual subfunctions. This isn't quite right: some
- * subfunction might actually make use of a larger domain of
- * input values. However, the only place that Arrayed Output
- * functions are used is in Shading and similar dictionaries,
- * where the input values are clamped to the intersection of
- * the individual Domains anyway.
- */
- memcpy(domain, params->Functions[0]->params.Domain,
- 2 * sizeof(float) * m);
- for (i = 1; i < n; ++i) {
- const float *dom = params->Functions[i]->params.Domain;
-
- for (j = 0; j < 2 * m; j += 2, dom += 2) {
- domain[j] = max(domain[j], dom[0]);
- domain[j + 1] = min(domain[j + 1], dom[1]);
- }
- }
- *ppfn = (gs_function_t *) pfn;
+ gs_function_AdOt_t *pfn =
+ gs_alloc_struct(mem, gs_function_AdOt_t, &st_function_AdOt,
+ "gs_function_AdOt_init");
+ float *domain = (float *)
+ gs_alloc_byte_array(mem, 2 * m, sizeof(float),
+ "gs_function_AdOt_init(Domain)");
+ int i, j;
+
+ if (pfn == 0)
+ return_error(gs_error_VMerror);
+ pfn->params = *params;
+ pfn->params.Domain = domain;
+ pfn->params.Range = 0;
+ pfn->head = function_AdOt_head;
+ if (domain == 0) {
+ gs_function_free((gs_function_t *)pfn, true, mem);
+ return_error(gs_error_VMerror);
+ }
+ /*
+ * We compute the Domain as the intersection of the Domains of
+ * the individual subfunctions. This isn't quite right: some
+ * subfunction might actually make use of a larger domain of
+ * input values. However, the only place that Arrayed Output
+ * functions are used is in Shading and similar dictionaries,
+ * where the input values are clamped to the intersection of
+ * the individual Domains anyway.
+ */
+ memcpy(domain, params->Functions[0]->params.Domain,
+ 2 * sizeof(float) * m);
+ for (i = 1; i < n; ++i) {
+ const float *dom = params->Functions[i]->params.Domain;
+
+ for (j = 0; j < 2 * m; j += 2, dom += 2) {
+ domain[j] = max(domain[j], dom[0]);
+ domain[j + 1] = min(domain[j + 1], dom[1]);
+ }
+ }
+ *ppfn = (gs_function_t *) pfn;
}
return 0;
}
diff --git a/gs/base/gsfunc3.h b/gs/base/gsfunc3.h
index 9381811e3..cec0edd15 100644
--- a/gs/base/gsfunc3.h
+++ b/gs/base/gsfunc3.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -83,21 +83,21 @@ typedef struct gs_function_AdOt_params_s {
/* Allocate and initialize functions of specific types. */
int gs_function_ElIn_init(gs_function_t ** ppfn,
- const gs_function_ElIn_params_t * params,
- gs_memory_t * mem);
+ const gs_function_ElIn_params_t * params,
+ gs_memory_t * mem);
int gs_function_1ItSg_init(gs_function_t ** ppfn,
- const gs_function_1ItSg_params_t * params,
- gs_memory_t * mem);
+ const gs_function_1ItSg_params_t * params,
+ gs_memory_t * mem);
int gs_function_AdOt_init(gs_function_t ** ppfn,
- const gs_function_AdOt_params_t * params,
- gs_memory_t * mem);
+ const gs_function_AdOt_params_t * params,
+ gs_memory_t * mem);
/* Free parameters of specific types. */
void gs_function_ElIn_free_params(gs_function_ElIn_params_t * params,
- gs_memory_t * mem);
+ gs_memory_t * mem);
void gs_function_1ItSg_free_params(gs_function_1ItSg_params_t * params,
- gs_memory_t * mem);
+ gs_memory_t * mem);
void gs_function_AdOt_free_params(gs_function_AdOt_params_t * params,
- gs_memory_t * mem);
+ gs_memory_t * mem);
#endif /* gsfunc3_INCLUDED */
diff --git a/gs/base/gsfunc4.c b/gs/base/gsfunc4.c
index 70bfd50ac..04bba439d 100644
--- a/gs/base/gsfunc4.c
+++ b/gs/base/gsfunc4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,9 +39,9 @@ private_st_function_PtCr();
/* Define the maximum stack depth. */
#define MAX_VSTACK 256 /* Max 100 is enough per PDF spec, but we use this
- * for DeviceN handling. Must be at least as large
- * as the number of components
- */
+ * for DeviceN handling. Must be at least as large
+ * as the number of components
+ */
/* Define the structure of values on the stack. */
typedef enum {
@@ -53,8 +53,8 @@ typedef enum {
typedef struct calc_value_s {
calc_value_type_t type;
union {
- int i; /* also used for Boolean */
- float f;
+ int i; /* also used for Boolean */
+ float f;
} value;
} calc_value_t;
@@ -72,7 +72,7 @@ store_float(calc_value_t *vsp, floatp f)
*/
typedef enum {
- /* Typed variants */
+ /* Typed variants */
PtCr_abs_int = PtCr_NUM_OPCODES,
PtCr_add_int,
@@ -87,13 +87,13 @@ typedef enum {
PtCr_lt_int,
PtCr_ne_int,
- /* Coerce and re-dispatch */
+ /* Coerce and re-dispatch */
PtCr_int_to_float,
PtCr_2nd_int_to_float,
PtCr_int2_to_float,
- /* Miscellaneous */
+ /* Miscellaneous */
PtCr_no_op,
PtCr_typecheck
@@ -120,18 +120,18 @@ fn_PtCr_evaluate(const gs_function_t *pfn_common, const float *in, float *out)
* values on the stack.
*/
static const struct op_defn_s {
- byte opcode[16]; /* 4 * type[-1] + type[0] */
+ byte opcode[16]; /* 4 * type[-1] + type[0] */
} op_defn_table[] = {
- /* Keep this consistent with opcodes in gsfunc4.h! */
+ /* Keep this consistent with opcodes in gsfunc4.h! */
#define O4(op) op,op,op,op
#define E PtCr_typecheck
#define E4 O4(E)
#define N PtCr_no_op
- /* 0-operand operators */
+ /* 0-operand operators */
#define OP_NONE(op)\
{{O4(op), O4(op), O4(op), O4(op)}}
- /* 1-operand operators */
+ /* 1-operand operators */
#define OP1(b, i, f)\
{{E,b,i,f, E,b,i,f, E,b,i,f, E,b,i,f}}
#define OP_NUM1(i, f)\
@@ -140,7 +140,7 @@ fn_PtCr_evaluate(const gs_function_t *pfn_common, const float *in, float *out)
OP1(E, PtCr_int_to_float, f)
#define OP_ANY1(op)\
OP1(op, op, op)
- /* 2-operand operators */
+ /* 2-operand operators */
#define OP_NUM2(i, f)\
{{E4, E4, E,E,i,PtCr_2nd_int_to_float, E,E,PtCr_int_to_float,f}}
#define OP_INT_BOOL2(i)\
@@ -157,404 +157,404 @@ fn_PtCr_evaluate(const gs_function_t *pfn_common, const float *in, float *out)
/* Arithmetic operators */
- OP_NUM1(PtCr_abs_int, PtCr_abs), /* abs */
- OP_NUM2(PtCr_add_int, PtCr_add), /* add */
- OP_INT_BOOL2(PtCr_and), /* and */
- OP_MATH2(PtCr_atan), /* atan */
- OP_INT2(PtCr_bitshift), /* bitshift */
- OP_NUM1(N, PtCr_ceiling), /* ceiling */
- OP_MATH1(PtCr_cos), /* cos */
- OP_NUM1(N, PtCr_cvi), /* cvi */
- OP_NUM1(PtCr_int_to_float, N), /* cvr */
- OP_MATH2(PtCr_div), /* div */
- OP_MATH2(PtCr_exp), /* exp */
- OP_NUM1(N, PtCr_floor), /* floor */
- OP_INT2(PtCr_idiv), /* idiv */
- OP_MATH1(PtCr_ln), /* ln */
- OP_MATH1(PtCr_log), /* log */
- OP_INT2(PtCr_mod), /* mod */
- OP_NUM2(PtCr_mul_int, PtCr_mul), /* mul */
- OP_NUM1(PtCr_neg_int, PtCr_neg), /* neg */
- OP1(PtCr_not, PtCr_not, E), /* not */
- OP_INT_BOOL2(PtCr_or), /* or */
- OP_NUM1(N, PtCr_round), /* round */
- OP_MATH1(PtCr_sin), /* sin */
- OP_MATH1(PtCr_sqrt), /* sqrt */
- OP_NUM2(PtCr_sub_int, PtCr_sub), /* sub */
- OP_NUM1(N, PtCr_truncate), /* truncate */
- OP_INT_BOOL2(PtCr_xor), /* xor */
+ OP_NUM1(PtCr_abs_int, PtCr_abs), /* abs */
+ OP_NUM2(PtCr_add_int, PtCr_add), /* add */
+ OP_INT_BOOL2(PtCr_and), /* and */
+ OP_MATH2(PtCr_atan), /* atan */
+ OP_INT2(PtCr_bitshift), /* bitshift */
+ OP_NUM1(N, PtCr_ceiling), /* ceiling */
+ OP_MATH1(PtCr_cos), /* cos */
+ OP_NUM1(N, PtCr_cvi), /* cvi */
+ OP_NUM1(PtCr_int_to_float, N), /* cvr */
+ OP_MATH2(PtCr_div), /* div */
+ OP_MATH2(PtCr_exp), /* exp */
+ OP_NUM1(N, PtCr_floor), /* floor */
+ OP_INT2(PtCr_idiv), /* idiv */
+ OP_MATH1(PtCr_ln), /* ln */
+ OP_MATH1(PtCr_log), /* log */
+ OP_INT2(PtCr_mod), /* mod */
+ OP_NUM2(PtCr_mul_int, PtCr_mul), /* mul */
+ OP_NUM1(PtCr_neg_int, PtCr_neg), /* neg */
+ OP1(PtCr_not, PtCr_not, E), /* not */
+ OP_INT_BOOL2(PtCr_or), /* or */
+ OP_NUM1(N, PtCr_round), /* round */
+ OP_MATH1(PtCr_sin), /* sin */
+ OP_MATH1(PtCr_sqrt), /* sqrt */
+ OP_NUM2(PtCr_sub_int, PtCr_sub), /* sub */
+ OP_NUM1(N, PtCr_truncate), /* truncate */
+ OP_INT_BOOL2(PtCr_xor), /* xor */
/* Comparison operators */
- OP_REL2(PtCr_eq_int, PtCr_eq), /* eq */
- OP_NUM2(PtCr_ge_int, PtCr_ge), /* ge */
- OP_NUM2(PtCr_gt_int, PtCr_gt), /* gt */
- OP_NUM2(PtCr_le_int, PtCr_le), /* le */
- OP_NUM2(PtCr_lt_int, PtCr_lt), /* lt */
- OP_REL2(PtCr_ne_int, PtCr_ne), /* ne */
+ OP_REL2(PtCr_eq_int, PtCr_eq), /* eq */
+ OP_NUM2(PtCr_ge_int, PtCr_ge), /* ge */
+ OP_NUM2(PtCr_gt_int, PtCr_gt), /* gt */
+ OP_NUM2(PtCr_le_int, PtCr_le), /* le */
+ OP_NUM2(PtCr_lt_int, PtCr_lt), /* lt */
+ OP_REL2(PtCr_ne_int, PtCr_ne), /* ne */
/* Stack operators */
- OP1(E, PtCr_copy, E), /* copy */
- OP_ANY1(PtCr_dup), /* dup */
- OP_ANY2(PtCr_exch), /* exch */
- OP1(E, PtCr_index, E), /* index */
- OP_ANY1(PtCr_pop), /* pop */
- OP_INT2(PtCr_roll), /* roll */
+ OP1(E, PtCr_copy, E), /* copy */
+ OP_ANY1(PtCr_dup), /* dup */
+ OP_ANY2(PtCr_exch), /* exch */
+ OP1(E, PtCr_index, E), /* index */
+ OP_ANY1(PtCr_pop), /* pop */
+ OP_INT2(PtCr_roll), /* roll */
/* Constants */
- OP_NONE(PtCr_byte), /* byte */
- OP_NONE(PtCr_int), /* int */
- OP_NONE(PtCr_float), /* float */
- OP_NONE(PtCr_true), /* true */
- OP_NONE(PtCr_false), /* false */
+ OP_NONE(PtCr_byte), /* byte */
+ OP_NONE(PtCr_int), /* int */
+ OP_NONE(PtCr_float), /* float */
+ OP_NONE(PtCr_true), /* true */
+ OP_NONE(PtCr_false), /* false */
/* Special */
- OP1(PtCr_if, E, E), /* if */
- OP_NONE(PtCr_else), /* else */
- OP_NONE(PtCr_return), /* return */
- OP1(E, PtCr_repeat, E), /* repeat */
- OP_NONE(PtCr_repeat_end) /* repeat_end */
+ OP1(PtCr_if, E, E), /* if */
+ OP_NONE(PtCr_else), /* else */
+ OP_NONE(PtCr_return), /* return */
+ OP1(E, PtCr_repeat, E), /* repeat */
+ OP_NONE(PtCr_repeat_end) /* repeat_end */
};
vstack[-1].type = CVT_NONE; /* for type dispatch in empty stack case */
vstack[0].type = CVT_NONE; /* catch underflow */
for (i = 0; i < pfn->params.m; ++i)
- store_float(&vstack[i + 1], in[i]);
+ store_float(&vstack[i + 1], in[i]);
for (; ; ) {
- int code, n;
+ int code, n;
sw:
- switch (op_defn_table[*p++].opcode[(vsp[-1].type << 2) + vsp->type]) {
-
- /* Miscellaneous */
-
- case PtCr_no_op:
- continue;
- case PtCr_typecheck:
- return_error(gs_error_typecheck);
-
- /* Coerce and re-dispatch */
-
- case PtCr_int_to_float:
- store_float(vsp, (floatp)vsp->value.i);
- --p; goto sw;
- case PtCr_int2_to_float:
- store_float(vsp, (floatp)vsp->value.i);
- case PtCr_2nd_int_to_float:
- store_float(vsp - 1, (floatp)vsp[-1].value.i);
- --p; goto sw;
-
- /* Arithmetic operators */
-
- case PtCr_abs_int:
- if (vsp->value.i < 0)
- goto neg_int;
- continue;
- case PtCr_abs:
- vsp->value.f = fabs(vsp->value.f);
- continue;
- case PtCr_add_int: {
- int int1 = vsp[-1].value.i, int2 = vsp->value.i;
-
- if ((int1 ^ int2) >= 0 && ((int1 + int2) ^ int1) < 0)
- store_float(vsp - 1, (double)int1 + int2);
- else
- vsp[-1].value.i = int1 + int2;
- --vsp; continue;
- }
- case PtCr_add:
- vsp[-1].value.f += vsp->value.f;
- --vsp; continue;
- case PtCr_and:
- vsp[-1].value.i &= vsp->value.i;
- --vsp; continue;
- case PtCr_atan: {
- double result;
-
- code = gs_atan2_degrees(vsp[-1].value.f, vsp->value.f,
- &result);
- if (code < 0)
- return code;
- vsp[-1].value.f = result;
- --vsp; continue;
- }
- case PtCr_bitshift:
+ switch (op_defn_table[*p++].opcode[(vsp[-1].type << 2) + vsp->type]) {
+
+ /* Miscellaneous */
+
+ case PtCr_no_op:
+ continue;
+ case PtCr_typecheck:
+ return_error(gs_error_typecheck);
+
+ /* Coerce and re-dispatch */
+
+ case PtCr_int_to_float:
+ store_float(vsp, (floatp)vsp->value.i);
+ --p; goto sw;
+ case PtCr_int2_to_float:
+ store_float(vsp, (floatp)vsp->value.i);
+ case PtCr_2nd_int_to_float:
+ store_float(vsp - 1, (floatp)vsp[-1].value.i);
+ --p; goto sw;
+
+ /* Arithmetic operators */
+
+ case PtCr_abs_int:
+ if (vsp->value.i < 0)
+ goto neg_int;
+ continue;
+ case PtCr_abs:
+ vsp->value.f = fabs(vsp->value.f);
+ continue;
+ case PtCr_add_int: {
+ int int1 = vsp[-1].value.i, int2 = vsp->value.i;
+
+ if ((int1 ^ int2) >= 0 && ((int1 + int2) ^ int1) < 0)
+ store_float(vsp - 1, (double)int1 + int2);
+ else
+ vsp[-1].value.i = int1 + int2;
+ --vsp; continue;
+ }
+ case PtCr_add:
+ vsp[-1].value.f += vsp->value.f;
+ --vsp; continue;
+ case PtCr_and:
+ vsp[-1].value.i &= vsp->value.i;
+ --vsp; continue;
+ case PtCr_atan: {
+ double result;
+
+ code = gs_atan2_degrees(vsp[-1].value.f, vsp->value.f,
+ &result);
+ if (code < 0)
+ return code;
+ vsp[-1].value.f = result;
+ --vsp; continue;
+ }
+ case PtCr_bitshift:
#define MAX_SHIFT (ARCH_SIZEOF_INT * 8 - 1)
- if (vsp->value.i < -MAX_SHIFT || vsp->value.i > MAX_SHIFT)
- vsp[-1].value.i = 0;
+ if (vsp->value.i < -MAX_SHIFT || vsp->value.i > MAX_SHIFT)
+ vsp[-1].value.i = 0;
#undef MAX_SHIFT
- else if ((n = vsp->value.i) < 0)
- vsp[-1].value.i = ((uint)(vsp[-1].value.i)) >> -n;
- else
- vsp[-1].value.i <<= n;
- --vsp; continue;
- case PtCr_ceiling:
- vsp->value.f = ceil(vsp->value.f);
- continue;
- case PtCr_cos:
- vsp->value.f = gs_cos_degrees(vsp->value.f);
- continue;
- case PtCr_cvi:
- vsp->value.i = (int)(vsp->value.f);
- vsp->type = CVT_INT;
- continue;
- case PtCr_cvr:
- continue; /* prepare handled it */
- case PtCr_div:
- if (vsp->value.f == 0)
- return_error(gs_error_undefinedresult);
- vsp[-1].value.f /= vsp->value.f;
- --vsp; continue;
- case PtCr_exp:
- vsp[-1].value.f = pow(vsp[-1].value.f, vsp->value.f);
- --vsp; continue;
- case PtCr_floor:
- vsp->value.f = floor(vsp->value.f);
- continue;
- case PtCr_idiv:
- if (vsp->value.i == 0)
- return_error(gs_error_undefinedresult);
- if ((vsp[-1].value.i /= vsp->value.i) == min_int &&
- vsp->value.i == -1) /* anomalous boundary case, fail */
- return_error(gs_error_rangecheck);
- --vsp; continue;
- case PtCr_ln:
- vsp->value.f = log(vsp->value.f);
- continue;
- case PtCr_log:
- vsp->value.f = log10(vsp->value.f);
- continue;
- case PtCr_mod:
- if (vsp->value.i == 0)
- return_error(gs_error_undefinedresult);
- vsp[-1].value.i %= vsp->value.i;
- --vsp; continue;
- case PtCr_mul_int: {
- /* We don't bother to optimize this. */
- double prod = (double)vsp[-1].value.i * vsp->value.i;
-
- if (prod < min_int || prod > max_int)
- store_float(vsp - 1, prod);
- else
- vsp[-1].value.i = (int)prod;
- --vsp; continue;
- }
- case PtCr_mul:
- vsp[-1].value.f *= vsp->value.f;
- --vsp; continue;
- case PtCr_neg_int:
- neg_int:
- if (vsp->value.i == min_int)
- store_float(vsp, (floatp)vsp->value.i); /* =self negated */
- else
- vsp->value.i = -vsp->value.i;
- continue;
- case PtCr_neg:
- vsp->value.f = -vsp->value.f;
- continue;
- case PtCr_not_bool:
- vsp->value.i = !vsp->value.i;
- continue;
- case PtCr_not:
- vsp->value.i = ~vsp->value.i;
- continue;
- case PtCr_or:
- vsp[-1].value.i |= vsp->value.i;
- --vsp; continue;
- case PtCr_round:
- vsp->value.f = floor(vsp->value.f + 0.5);
- continue;
- case PtCr_sin:
- vsp->value.f = gs_sin_degrees(vsp->value.f);
- continue;
- case PtCr_sqrt:
- vsp->value.f = sqrt(vsp->value.f);
- continue;
- case PtCr_sub_int: {
- int int1 = vsp[-1].value.i, int2 = vsp->value.i;
-
- if ((int1 ^ int2) < 0 && ((int1 - int2) ^ int1) >= 0)
- store_float(vsp - 1, (double)int1 - int2);
- else
- vsp[-1].value.i = int1 - int2;
- --vsp; continue;
- }
- case PtCr_sub:
- vsp[-1].value.f -= vsp->value.f;
- --vsp; continue;
- case PtCr_truncate:
- vsp->value.f = (vsp->value.f < 0 ? ceil(vsp->value.f) :
- floor(vsp->value.f));
- continue;
- case PtCr_xor:
- vsp[-1].value.i ^= vsp->value.i;
- --vsp; continue;
-
- /* Boolean operators */
+ else if ((n = vsp->value.i) < 0)
+ vsp[-1].value.i = ((uint)(vsp[-1].value.i)) >> -n;
+ else
+ vsp[-1].value.i <<= n;
+ --vsp; continue;
+ case PtCr_ceiling:
+ vsp->value.f = ceil(vsp->value.f);
+ continue;
+ case PtCr_cos:
+ vsp->value.f = gs_cos_degrees(vsp->value.f);
+ continue;
+ case PtCr_cvi:
+ vsp->value.i = (int)(vsp->value.f);
+ vsp->type = CVT_INT;
+ continue;
+ case PtCr_cvr:
+ continue; /* prepare handled it */
+ case PtCr_div:
+ if (vsp->value.f == 0)
+ return_error(gs_error_undefinedresult);
+ vsp[-1].value.f /= vsp->value.f;
+ --vsp; continue;
+ case PtCr_exp:
+ vsp[-1].value.f = pow(vsp[-1].value.f, vsp->value.f);
+ --vsp; continue;
+ case PtCr_floor:
+ vsp->value.f = floor(vsp->value.f);
+ continue;
+ case PtCr_idiv:
+ if (vsp->value.i == 0)
+ return_error(gs_error_undefinedresult);
+ if ((vsp[-1].value.i /= vsp->value.i) == min_int &&
+ vsp->value.i == -1) /* anomalous boundary case, fail */
+ return_error(gs_error_rangecheck);
+ --vsp; continue;
+ case PtCr_ln:
+ vsp->value.f = log(vsp->value.f);
+ continue;
+ case PtCr_log:
+ vsp->value.f = log10(vsp->value.f);
+ continue;
+ case PtCr_mod:
+ if (vsp->value.i == 0)
+ return_error(gs_error_undefinedresult);
+ vsp[-1].value.i %= vsp->value.i;
+ --vsp; continue;
+ case PtCr_mul_int: {
+ /* We don't bother to optimize this. */
+ double prod = (double)vsp[-1].value.i * vsp->value.i;
+
+ if (prod < min_int || prod > max_int)
+ store_float(vsp - 1, prod);
+ else
+ vsp[-1].value.i = (int)prod;
+ --vsp; continue;
+ }
+ case PtCr_mul:
+ vsp[-1].value.f *= vsp->value.f;
+ --vsp; continue;
+ case PtCr_neg_int:
+ neg_int:
+ if (vsp->value.i == min_int)
+ store_float(vsp, (floatp)vsp->value.i); /* =self negated */
+ else
+ vsp->value.i = -vsp->value.i;
+ continue;
+ case PtCr_neg:
+ vsp->value.f = -vsp->value.f;
+ continue;
+ case PtCr_not_bool:
+ vsp->value.i = !vsp->value.i;
+ continue;
+ case PtCr_not:
+ vsp->value.i = ~vsp->value.i;
+ continue;
+ case PtCr_or:
+ vsp[-1].value.i |= vsp->value.i;
+ --vsp; continue;
+ case PtCr_round:
+ vsp->value.f = floor(vsp->value.f + 0.5);
+ continue;
+ case PtCr_sin:
+ vsp->value.f = gs_sin_degrees(vsp->value.f);
+ continue;
+ case PtCr_sqrt:
+ vsp->value.f = sqrt(vsp->value.f);
+ continue;
+ case PtCr_sub_int: {
+ int int1 = vsp[-1].value.i, int2 = vsp->value.i;
+
+ if ((int1 ^ int2) < 0 && ((int1 - int2) ^ int1) >= 0)
+ store_float(vsp - 1, (double)int1 - int2);
+ else
+ vsp[-1].value.i = int1 - int2;
+ --vsp; continue;
+ }
+ case PtCr_sub:
+ vsp[-1].value.f -= vsp->value.f;
+ --vsp; continue;
+ case PtCr_truncate:
+ vsp->value.f = (vsp->value.f < 0 ? ceil(vsp->value.f) :
+ floor(vsp->value.f));
+ continue;
+ case PtCr_xor:
+ vsp[-1].value.i ^= vsp->value.i;
+ --vsp; continue;
+
+ /* Boolean operators */
#define DO_REL(rel, m)\
vsp[-1].value.i = vsp[-1].value.m rel vsp->value.m
- case PtCr_eq_int:
- DO_REL(==, i);
- goto rel;
- case PtCr_eq:
- DO_REL(==, f);
- rel:
- vsp[-1].type = CVT_BOOL;
- --vsp; continue;
- case PtCr_ge_int:
- DO_REL(>=, i);
- goto rel;
- case PtCr_ge:
- DO_REL(>=, f);
- goto rel;
- case PtCr_gt_int:
- DO_REL(>, i);
- goto rel;
- case PtCr_gt:
- DO_REL(>, f);
- goto rel;
- case PtCr_le_int:
- DO_REL(<=, i);
- goto rel;
- case PtCr_le:
- DO_REL(<=, f);
- goto rel;
- case PtCr_lt_int:
- DO_REL(<, i);
- goto rel;
- case PtCr_lt:
- DO_REL(<, f);
- goto rel;
- case PtCr_ne_int:
- DO_REL(!=, i);
- goto rel;
- case PtCr_ne:
- DO_REL(!=, f);
- goto rel;
+ case PtCr_eq_int:
+ DO_REL(==, i);
+ goto rel;
+ case PtCr_eq:
+ DO_REL(==, f);
+ rel:
+ vsp[-1].type = CVT_BOOL;
+ --vsp; continue;
+ case PtCr_ge_int:
+ DO_REL(>=, i);
+ goto rel;
+ case PtCr_ge:
+ DO_REL(>=, f);
+ goto rel;
+ case PtCr_gt_int:
+ DO_REL(>, i);
+ goto rel;
+ case PtCr_gt:
+ DO_REL(>, f);
+ goto rel;
+ case PtCr_le_int:
+ DO_REL(<=, i);
+ goto rel;
+ case PtCr_le:
+ DO_REL(<=, f);
+ goto rel;
+ case PtCr_lt_int:
+ DO_REL(<, i);
+ goto rel;
+ case PtCr_lt:
+ DO_REL(<, f);
+ goto rel;
+ case PtCr_ne_int:
+ DO_REL(!=, i);
+ goto rel;
+ case PtCr_ne:
+ DO_REL(!=, f);
+ goto rel;
#undef DO_REL
- /* Stack operators */
-
- case PtCr_copy:
- i = vsp->value.i;
- n = vsp - vstack;
- if (i < 0 || i >= n)
- return_error(gs_error_rangecheck);
- if (i > MAX_VSTACK - (n - 1))
- return_error(gs_error_limitcheck);
- memcpy(vsp, vsp - i, i * sizeof(*vsp));
- vsp += i - 1;
- continue;
- case PtCr_dup:
- vsp[1] = *vsp;
- goto push;
- case PtCr_exch:
- vstack[MAX_VSTACK] = *vsp;
- *vsp = vsp[-1];
- vsp[-1] = vstack[MAX_VSTACK];
- continue;
- case PtCr_index:
- i = vsp->value.i;
- if (i < 0 || i >= vsp - vstack - 1)
- return_error(gs_error_rangecheck);
- *vsp = vsp[-i - 1];
- continue;
- case PtCr_pop:
- --vsp;
- continue;
- case PtCr_roll:
- n = vsp[-1].value.i;
- i = vsp->value.i;
- if (n < 0 || n > vsp - vstack - 2)
- return_error(gs_error_rangecheck);
- /* We don't bother to do this efficiently. */
- for (; i > 0; i--) {
- memmove(vsp - n, vsp - (n + 1), n * sizeof(*vsp));
- vsp[-(n + 1)] = vsp[-1];
- }
- for (; i < 0; i++) {
- vsp[-1] = vsp[-(n + 1)];
- memmove(vsp - (n + 1), vsp - n, n * sizeof(*vsp));
- }
- vsp -= 2;
- continue;
-
- /* Constants */
-
- case PtCr_byte:
- vsp[1].value.i = *p++, vsp[1].type = CVT_INT;
- goto push;
- case PtCr_int /* native */:
- memcpy(&vsp[1].value.i, p, sizeof(int));
- vsp[1].type = CVT_INT;
- p += sizeof(int);
- goto push;
- case PtCr_float /* native */:
- memcpy(&vsp[1].value.f, p, sizeof(float));
- vsp[1].type = CVT_FLOAT;
- p += sizeof(float);
- goto push;
- case PtCr_true:
- vsp[1].value.i = true, vsp[1].type = CVT_BOOL;
- goto push;
- case PtCr_false:
- vsp[1].value.i = false, vsp[1].type = CVT_BOOL;
- push:
- if (vsp == &vstack[MAX_VSTACK])
- return_error(gs_error_limitcheck);
- ++vsp;
- continue;
-
- /* Special */
-
- case PtCr_if:
- if ((vsp--)->value.i) { /* value is true, execute body */
- p += 2;
- continue;
- }
- /* falls through */
- case PtCr_else:
- p += 2 + (p[0] << 8) + p[1]; /* skip the past body */
- continue;
- case PtCr_return:
- goto fin;
- case PtCr_repeat:
- repeat_nesting_level++;
- repeat_count[repeat_nesting_level] = vsp->value.i;
- repeat_proc_size[repeat_nesting_level] = 1 + (p[0] << 8) + p[1]; /* body size */
- --vsp; /* pop the counter */
- p += 3 + (p[0] <<8) + p[1]; /* advance just past the repeat_end */
- /* falls through */
- case PtCr_repeat_end:
- if ((repeat_count[repeat_nesting_level])-- <= 0)
- repeat_nesting_level--;
- else
- p -= repeat_proc_size[repeat_nesting_level];
- continue;
- }
+ /* Stack operators */
+
+ case PtCr_copy:
+ i = vsp->value.i;
+ n = vsp - vstack;
+ if (i < 0 || i >= n)
+ return_error(gs_error_rangecheck);
+ if (i > MAX_VSTACK - (n - 1))
+ return_error(gs_error_limitcheck);
+ memcpy(vsp, vsp - i, i * sizeof(*vsp));
+ vsp += i - 1;
+ continue;
+ case PtCr_dup:
+ vsp[1] = *vsp;
+ goto push;
+ case PtCr_exch:
+ vstack[MAX_VSTACK] = *vsp;
+ *vsp = vsp[-1];
+ vsp[-1] = vstack[MAX_VSTACK];
+ continue;
+ case PtCr_index:
+ i = vsp->value.i;
+ if (i < 0 || i >= vsp - vstack - 1)
+ return_error(gs_error_rangecheck);
+ *vsp = vsp[-i - 1];
+ continue;
+ case PtCr_pop:
+ --vsp;
+ continue;
+ case PtCr_roll:
+ n = vsp[-1].value.i;
+ i = vsp->value.i;
+ if (n < 0 || n > vsp - vstack - 2)
+ return_error(gs_error_rangecheck);
+ /* We don't bother to do this efficiently. */
+ for (; i > 0; i--) {
+ memmove(vsp - n, vsp - (n + 1), n * sizeof(*vsp));
+ vsp[-(n + 1)] = vsp[-1];
+ }
+ for (; i < 0; i++) {
+ vsp[-1] = vsp[-(n + 1)];
+ memmove(vsp - (n + 1), vsp - n, n * sizeof(*vsp));
+ }
+ vsp -= 2;
+ continue;
+
+ /* Constants */
+
+ case PtCr_byte:
+ vsp[1].value.i = *p++, vsp[1].type = CVT_INT;
+ goto push;
+ case PtCr_int /* native */:
+ memcpy(&vsp[1].value.i, p, sizeof(int));
+ vsp[1].type = CVT_INT;
+ p += sizeof(int);
+ goto push;
+ case PtCr_float /* native */:
+ memcpy(&vsp[1].value.f, p, sizeof(float));
+ vsp[1].type = CVT_FLOAT;
+ p += sizeof(float);
+ goto push;
+ case PtCr_true:
+ vsp[1].value.i = true, vsp[1].type = CVT_BOOL;
+ goto push;
+ case PtCr_false:
+ vsp[1].value.i = false, vsp[1].type = CVT_BOOL;
+ push:
+ if (vsp == &vstack[MAX_VSTACK])
+ return_error(gs_error_limitcheck);
+ ++vsp;
+ continue;
+
+ /* Special */
+
+ case PtCr_if:
+ if ((vsp--)->value.i) { /* value is true, execute body */
+ p += 2;
+ continue;
+ }
+ /* falls through */
+ case PtCr_else:
+ p += 2 + (p[0] << 8) + p[1]; /* skip the past body */
+ continue;
+ case PtCr_return:
+ goto fin;
+ case PtCr_repeat:
+ repeat_nesting_level++;
+ repeat_count[repeat_nesting_level] = vsp->value.i;
+ repeat_proc_size[repeat_nesting_level] = 1 + (p[0] << 8) + p[1]; /* body size */
+ --vsp; /* pop the counter */
+ p += 3 + (p[0] <<8) + p[1]; /* advance just past the repeat_end */
+ /* falls through */
+ case PtCr_repeat_end:
+ if ((repeat_count[repeat_nesting_level])-- <= 0)
+ repeat_nesting_level--;
+ else
+ p -= repeat_proc_size[repeat_nesting_level];
+ continue;
+ }
}
fin:
if (vsp != vstack + pfn->params.n)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; i < pfn->params.n; ++i) {
- switch (vstack[i + 1].type) {
- case CVT_INT:
- out[i] = (float)vstack[i + 1].value.i;
- break;
- case CVT_FLOAT:
- out[i] = vstack[i + 1].value.f;
- break;
- default:
- return_error(gs_error_typecheck);
- }
+ switch (vstack[i + 1].type) {
+ case CVT_INT:
+ out[i] = (float)vstack[i + 1].value.i;
+ break;
+ case CVT_FLOAT:
+ out[i] = vstack[i + 1].value.f;
+ break;
+ default:
+ return_error(gs_error_typecheck);
+ }
}
return 0;
}
@@ -562,7 +562,7 @@ fn_PtCr_evaluate(const gs_function_t *pfn_common, const float *in, float *out)
/* Test whether a PostScript Calculator function is monotonic. */
static int
fn_PtCr_is_monotonic(const gs_function_t * pfn_common,
- const float *lower, const float *upper, uint *mask)
+ const float *lower, const float *upper, uint *mask)
{
/*
* No reasonable way to tell. Eventually we should check for
@@ -582,75 +582,75 @@ calc_put_ops(stream *s, const byte *ops, uint size)
spputc(s, '{');
for (p = ops; p < ops + size; )
- switch (*p++) {
- case PtCr_byte:
- pprintd1(s, "%d ", *p++);
- break;
- case PtCr_int: {
- int i;
-
- memcpy(&i, p, sizeof(int));
- pprintd1(s, "%d ", i);
- p += sizeof(int);
- break;
- }
- case PtCr_float: {
- float f;
-
- memcpy(&f, p, sizeof(float));
- pprintg1(s, "%g ", f);
- p += sizeof(float);
- break;
- }
- case PtCr_true:
- stream_puts(s, "true ");
- break;
- case PtCr_false:
- stream_puts(s, "false ");
- break;
- case PtCr_if: {
- int skip = (p[0] << 8) + p[1];
- int code;
-
- code = calc_put_ops(s, p += 2, skip);
- p += skip;
- if (code < 0)
- return code;
- if (code > 0) { /* else */
- skip = (p[-2] << 8) + p[-1];
- code = calc_put_ops(s, p, skip);
- p += skip;
- if (code < 0)
- return code;
- stream_puts(s, " ifelse ");
- } else
- stream_puts(s, " if ");
- break;
- }
- case PtCr_else:
- if (p != ops + size - 2)
- return_error(gs_error_rangecheck);
- spputc(s, '}');
- return 1;
- /*case PtCr_return:*/ /* not possible */
- case PtCr_repeat: /* We shouldn't encounter this, but just in case */
- case PtCr_repeat_end:
- return_error(gs_error_rangecheck);
- default: { /* must be < PtCr_NUM_OPS */
- static const char *const op_names[] = {
- /* Keep this consistent with opcodes in gsfunc4.h! */
- "abs", "add", "and", "atan", "bitshift",
- "ceiling", "cos", "cvi", "cvr", "div", "exp",
- "floor", "idiv", "ln", "log", "mod", "mul",
- "neg", "not", "or", "round", "sin", "sqrt", "sub",
- "truncate", "xor",
- "eq", "ge", "gt", "le", "lt", "ne",
- "copy", "dup", "exch", "index", "pop", "roll"
- };
-
- pprints1(s, "%s ", op_names[p[-1]]);
- }
- }
+ switch (*p++) {
+ case PtCr_byte:
+ pprintd1(s, "%d ", *p++);
+ break;
+ case PtCr_int: {
+ int i;
+
+ memcpy(&i, p, sizeof(int));
+ pprintd1(s, "%d ", i);
+ p += sizeof(int);
+ break;
+ }
+ case PtCr_float: {
+ float f;
+
+ memcpy(&f, p, sizeof(float));
+ pprintg1(s, "%g ", f);
+ p += sizeof(float);
+ break;
+ }
+ case PtCr_true:
+ stream_puts(s, "true ");
+ break;
+ case PtCr_false:
+ stream_puts(s, "false ");
+ break;
+ case PtCr_if: {
+ int skip = (p[0] << 8) + p[1];
+ int code;
+
+ code = calc_put_ops(s, p += 2, skip);
+ p += skip;
+ if (code < 0)
+ return code;
+ if (code > 0) { /* else */
+ skip = (p[-2] << 8) + p[-1];
+ code = calc_put_ops(s, p, skip);
+ p += skip;
+ if (code < 0)
+ return code;
+ stream_puts(s, " ifelse ");
+ } else
+ stream_puts(s, " if ");
+ break;
+ }
+ case PtCr_else:
+ if (p != ops + size - 2)
+ return_error(gs_error_rangecheck);
+ spputc(s, '}');
+ return 1;
+ /*case PtCr_return:*/ /* not possible */
+ case PtCr_repeat: /* We shouldn't encounter this, but just in case */
+ case PtCr_repeat_end:
+ return_error(gs_error_rangecheck);
+ default: { /* must be < PtCr_NUM_OPS */
+ static const char *const op_names[] = {
+ /* Keep this consistent with opcodes in gsfunc4.h! */
+ "abs", "add", "and", "atan", "bitshift",
+ "ceiling", "cos", "cvi", "cvr", "div", "exp",
+ "floor", "idiv", "ln", "log", "mod", "mul",
+ "neg", "not", "or", "round", "sin", "sqrt", "sub",
+ "truncate", "xor",
+ "eq", "ge", "gt", "le", "lt", "ne",
+ "copy", "dup", "exch", "index", "pop", "roll"
+ };
+
+ pprints1(s, "%s ", op_names[p[-1]]);
+ }
+ }
spputc(s, '}');
return 0;
}
@@ -664,11 +664,11 @@ calc_put(stream *s, const gs_function_PtCr_t *pfn)
/* Access the symbolic definition as a DataSource. */
static int
calc_access(const gs_data_source_t *psrc, ulong start, uint length,
- byte *buf, const byte **ptr)
+ byte *buf, const byte **ptr)
{
const gs_function_PtCr_t *const pfn =
- (const gs_function_PtCr_t *)
- ((const char *)psrc - offset_of(gs_function_PtCr_t, data_source));
+ (const gs_function_PtCr_t *)
+ ((const char *)psrc - offset_of(gs_function_PtCr_t, data_source));
/*
* The caller wants a specific substring of the symbolic definition.
* Generate the entire definition, using a SubFileDecode filter (in an
@@ -694,7 +694,7 @@ calc_access(const gs_data_source_t *psrc, ulong start, uint length,
calc_put(&ds, pfn);
sclose(&ds);
if (ptr)
- *ptr = buf;
+ *ptr = buf;
return 0;
}
@@ -703,28 +703,28 @@ static void
fn_PtCr_get_info(const gs_function_t *pfn_common, gs_function_info_t *pfi)
{
const gs_function_PtCr_t *const pfn =
- (const gs_function_PtCr_t *)pfn_common;
+ (const gs_function_PtCr_t *)pfn_common;
gs_function_get_info_default(pfn_common, pfi);
pfi->DataSource = &pfn->data_source;
{
- stream s;
+ stream s;
- s_init(&s, NULL);
- swrite_position_only(&s);
- calc_put(&s, pfn);
- pfi->data_size = stell(&s);
+ s_init(&s, NULL);
+ swrite_position_only(&s);
+ calc_put(&s, pfn);
+ pfi->data_size = stell(&s);
}
}
/* Make a scaled copy of a PostScript Calculator function. */
static int
fn_PtCr_make_scaled(const gs_function_PtCr_t *pfn, gs_function_PtCr_t **ppsfn,
- const gs_range_t *pranges, gs_memory_t *mem)
+ const gs_range_t *pranges, gs_memory_t *mem)
{
gs_function_PtCr_t *psfn =
- gs_alloc_struct(mem, gs_function_PtCr_t, &st_function_PtCr,
- "fn_PtCr_make_scaled");
+ gs_alloc_struct(mem, gs_function_PtCr_t, &st_function_PtCr,
+ "fn_PtCr_make_scaled");
/* We are adding {<int> 1 roll <float> mul <float> add} for each output. */
int n = pfn->params.n;
uint opsize = pfn->params.ops.size + (9 + 2 * sizeof(float)) * n;
@@ -733,53 +733,52 @@ fn_PtCr_make_scaled(const gs_function_PtCr_t *pfn, gs_function_PtCr_t **ppsfn,
int code, i;
if (psfn == 0 || ops == 0) {
- gs_free_string(mem, ops, opsize, "fn_PtCr_make_scaled(ops)");
- gs_free_object(mem, psfn, "fn_PtCr_make_scaled");
- return_error(gs_error_VMerror);
+ gs_free_string(mem, ops, opsize, "fn_PtCr_make_scaled(ops)");
+ gs_free_object(mem, psfn, "fn_PtCr_make_scaled");
+ return_error(gs_error_VMerror);
}
psfn->params = pfn->params;
psfn->params.ops.data = ops;
psfn->params.ops.size = opsize;
psfn->data_source = pfn->data_source;
code = fn_common_scale((gs_function_t *)psfn, (const gs_function_t *)pfn,
- pranges, mem);
+ pranges, mem);
if (code < 0) {
- gs_function_free((gs_function_t *)psfn, true, mem);
- return code;
+ gs_function_free((gs_function_t *)psfn, true, mem);
+ return code;
}
memcpy(ops, pfn->params.ops.data, pfn->params.ops.size - 1); /* minus return */
p = ops + pfn->params.ops.size - 1;
for (i = n; --i >= 0; ) {
- float base = pranges[i].rmin;
- float factor = pranges[i].rmax - base;
-
- if (factor != 1) {
- p[0] = PtCr_float; memcpy(p + 1, &factor, sizeof(float));
- p += 1 + sizeof(float);
- *p++ = PtCr_mul;
- }
- if (base != 0) {
- p[0] = PtCr_float; memcpy(p + 1, &base, sizeof(float));
- p += 1 + sizeof(float);
- *p++ = PtCr_add;
- }
- if (n != 1) {
- p[0] = PtCr_byte; p[1] = (byte)n;
- p[2] = PtCr_byte; p[3] = 1;
- p[4] = PtCr_roll;
- p += 5;
- }
+ float base = pranges[i].rmin;
+ float factor = pranges[i].rmax - base;
+
+ if (factor != 1) {
+ p[0] = PtCr_float; memcpy(p + 1, &factor, sizeof(float));
+ p += 1 + sizeof(float);
+ *p++ = PtCr_mul;
+ }
+ if (base != 0) {
+ p[0] = PtCr_float; memcpy(p + 1, &base, sizeof(float));
+ p += 1 + sizeof(float);
+ *p++ = PtCr_add;
+ }
+ if (n != 1) {
+ p[0] = PtCr_byte; p[1] = (byte)n;
+ p[2] = PtCr_byte; p[3] = 1;
+ p[4] = PtCr_roll;
+ p += 5;
+ }
}
*p++ = PtCr_return;
psfn->params.ops.size = p - ops;
psfn->params.ops.data =
- gs_resize_string(mem, ops, opsize, psfn->params.ops.size,
- "fn_PtCr_make_scaled");
+ gs_resize_string(mem, ops, opsize, psfn->params.ops.size,
+ "fn_PtCr_make_scaled");
*ppsfn = psfn;
return 0;
}
-
/* Free the parameters of a PostScript Calculator function. */
void
gs_function_PtCr_free_params(gs_function_PtCr_params_t * params, gs_memory_t * mem)
@@ -797,86 +796,86 @@ gs_function_PtCr_serialize(const gs_function_t * pfn, stream *s)
int code = fn_common_serialize(pfn, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->ops.size, sizeof(p->ops.size), &n);
if (code < 0)
- return code;
+ return code;
return sputs(s, p->ops.data, p->ops.size, &n);
}
/* Allocate and initialize a PostScript Calculator function. */
int
gs_function_PtCr_init(gs_function_t ** ppfn,
- const gs_function_PtCr_params_t * params, gs_memory_t * mem)
+ const gs_function_PtCr_params_t * params, gs_memory_t * mem)
{
static const gs_function_head_t function_PtCr_head = {
- function_type_PostScript_Calculator,
- {
- (fn_evaluate_proc_t) fn_PtCr_evaluate,
- (fn_is_monotonic_proc_t) fn_PtCr_is_monotonic,
- (fn_get_info_proc_t) fn_PtCr_get_info,
- fn_common_get_params,
- (fn_make_scaled_proc_t) fn_PtCr_make_scaled,
- (fn_free_params_proc_t) gs_function_PtCr_free_params,
- fn_common_free,
- (fn_serialize_proc_t) gs_function_PtCr_serialize,
- }
+ function_type_PostScript_Calculator,
+ {
+ (fn_evaluate_proc_t) fn_PtCr_evaluate,
+ (fn_is_monotonic_proc_t) fn_PtCr_is_monotonic,
+ (fn_get_info_proc_t) fn_PtCr_get_info,
+ fn_common_get_params,
+ (fn_make_scaled_proc_t) fn_PtCr_make_scaled,
+ (fn_free_params_proc_t) gs_function_PtCr_free_params,
+ fn_common_free,
+ (fn_serialize_proc_t) gs_function_PtCr_serialize,
+ }
};
int code;
*ppfn = 0; /* in case of error */
code = fn_check_mnDR((const gs_function_params_t *)params,
- params->m, params->n);
+ params->m, params->n);
if (code < 0)
- return code;
+ return code;
if (params->m > MAX_VSTACK || params->n > MAX_VSTACK)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
/*
* Pre-validate the operation string to reduce evaluation overhead.
*/
{
- const byte *p = params->ops.data;
-
- for (; *p != PtCr_return; ++p)
- switch ((gs_PtCr_opcode_t)*p) {
- case PtCr_byte:
- ++p; break;
- case PtCr_int:
- p += sizeof(int); break;
- case PtCr_float:
- p += sizeof(float); break;
- case PtCr_repeat:
- case PtCr_if:
- case PtCr_else:
- p += 2;
- case PtCr_repeat_end:
- case PtCr_true:
- case PtCr_false:
- break;
- default:
- if (*p >= PtCr_NUM_OPS)
- return_error(gs_error_rangecheck);
- }
- if (p != params->ops.data + params->ops.size - 1)
- return_error(gs_error_rangecheck);
+ const byte *p = params->ops.data;
+
+ for (; *p != PtCr_return; ++p)
+ switch ((gs_PtCr_opcode_t)*p) {
+ case PtCr_byte:
+ ++p; break;
+ case PtCr_int:
+ p += sizeof(int); break;
+ case PtCr_float:
+ p += sizeof(float); break;
+ case PtCr_repeat:
+ case PtCr_if:
+ case PtCr_else:
+ p += 2;
+ case PtCr_repeat_end:
+ case PtCr_true:
+ case PtCr_false:
+ break;
+ default:
+ if (*p >= PtCr_NUM_OPS)
+ return_error(gs_error_rangecheck);
+ }
+ if (p != params->ops.data + params->ops.size - 1)
+ return_error(gs_error_rangecheck);
}
{
- gs_function_PtCr_t *pfn =
- gs_alloc_struct(mem, gs_function_PtCr_t, &st_function_PtCr,
- "gs_function_PtCr_init");
-
- if (pfn == 0)
- return_error(gs_error_VMerror);
- pfn->params = *params;
- /*
- * We claim to have a DataSource, in order to write the function
- * definition in symbolic form for embedding in PDF files.
- * ****** THIS IS A HACK. ******
- */
- data_source_init_string2(&pfn->data_source, NULL, 0);
- pfn->data_source.access = calc_access;
- pfn->head = function_PtCr_head;
- *ppfn = (gs_function_t *) pfn;
+ gs_function_PtCr_t *pfn =
+ gs_alloc_struct(mem, gs_function_PtCr_t, &st_function_PtCr,
+ "gs_function_PtCr_init");
+
+ if (pfn == 0)
+ return_error(gs_error_VMerror);
+ pfn->params = *params;
+ /*
+ * We claim to have a DataSource, in order to write the function
+ * definition in symbolic form for embedding in PDF files.
+ * ****** THIS IS A HACK. ******
+ */
+ data_source_init_string2(&pfn->data_source, NULL, 0);
+ pfn->data_source.access = calc_access;
+ pfn->head = function_PtCr_head;
+ *ppfn = (gs_function_t *) pfn;
}
return 0;
}
diff --git a/gs/base/gsfunc4.h b/gs/base/gsfunc4.h
index faebd44f9..25c2b705a 100644
--- a/gs/base/gsfunc4.h
+++ b/gs/base/gsfunc4.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -75,11 +75,11 @@ typedef struct gs_function_PtCr_params_s {
/* Allocate and initialize a PostScript Calculator function. */
int gs_function_PtCr_init(gs_function_t ** ppfn,
- const gs_function_PtCr_params_t * params,
- gs_memory_t * mem);
+ const gs_function_PtCr_params_t * params,
+ gs_memory_t * mem);
/* Free the parameters of a PostScript Calculator function. */
void gs_function_PtCr_free_params(gs_function_PtCr_params_t * params,
- gs_memory_t * mem);
+ gs_memory_t * mem);
#endif /* gsfunc4_INCLUDED */
diff --git a/gs/base/gsgc.h b/gs/base/gsgc.h
index ad59d753a..28e414582 100644
--- a/gs/base/gsgc.h
+++ b/gs/base/gsgc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -70,13 +70,13 @@ typedef struct vm_spaces_s vm_spaces;
struct vm_spaces_s {
vm_reclaim_proc((*vm_reclaim));
union {
- gs_ref_memory_t *indexed[4 /*1 << r_space_bits */ ];
- struct _ssn {
- gs_ref_memory_t *foreign;
- gs_ref_memory_t *system;
- gs_ref_memory_t *global;
- gs_ref_memory_t *local;
- } named;
+ gs_ref_memory_t *indexed[4 /*1 << r_space_bits */ ];
+ struct _ssn {
+ gs_ref_memory_t *foreign;
+ gs_ref_memory_t *system;
+ gs_ref_memory_t *global;
+ gs_ref_memory_t *local;
+ } named;
} memories;
};
diff --git a/gs/base/gsgcache.c b/gs/base/gsgcache.c
index 26598b78f..65f9133b5 100644
--- a/gs/base/gsgcache.c
+++ b/gs/base/gsgcache.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,15 +23,15 @@
#include "gxfont.h"
#include "gxfont42.h"
-/*
+/*
* This implementation hardcodes the type 42 font type.
* We could generalize it, but since CIDFontType 0 uses
* a PS procedure for reading glyphs, it is hardly applicable.
- *
+ *
* The caching is mostly useful for glyphs with multiple components,
* but CIDFontType 0 has 2 components max, which are relatively seldom.
* Also it is low useful for fonts, which fully loaded into RAM.
- * FAPI does not need a caching, because renderer pludins access
+ * FAPI does not need a caching, because renderer pludins access
* font data through a file handle by own means.
*
* Due to all above, currently the caching is applied
@@ -48,12 +48,12 @@ struct gs_glyph_cache_elem_s {
gs_public_st_composite(st_glyph_cache_elem, gs_glyph_cache_elem, "gs_glyph_cache_elem",
gs_glyph_cache_elem_enum_ptrs, gs_glyph_cache_elem_reloc_ptrs);
-static
+static
ENUM_PTRS_WITH(gs_glyph_cache_elem_enum_ptrs, gs_glyph_cache_elem *e)
{
index --;
if (index < ST_GLYPH_DATA_NUM_PTRS)
- return ENUM_USING(st_glyph_data, &e->gd, sizeof(e->gd), index);
+ return ENUM_USING(st_glyph_data, &e->gd, sizeof(e->gd), index);
return 0;
}
ENUM_PTR(0, gs_glyph_cache_elem, next);
@@ -79,13 +79,13 @@ GS_NOTIFY_PROC(gs_glpyh_cache__release);
gs_glyph_cache *
gs_glyph_cache__alloc(gs_font_type42 *pfont, stream *s,
- get_glyph_data_from_file read_data)
-{
+ get_glyph_data_from_file read_data)
+{
gs_memory_t *mem = pfont->memory->stable_memory;
gs_glyph_cache *gdcache = (gs_glyph_cache *)gs_alloc_struct(mem,
- gs_glyph_cache, &st_glyph_cache, "gs_glyph_cache");
+ gs_glyph_cache, &st_glyph_cache, "gs_glyph_cache");
if (gdcache == 0)
- return 0;
+ return 0;
gdcache->total_size = 0;
gdcache->list = NULL;
gdcache->pfont = pfont;
@@ -103,20 +103,20 @@ gs_glyph_cache__alloc(gs_font_type42 *pfont, stream *s,
int
gs_glyph_cache__release(void *data, void *event)
-{
+{
gs_glyph_cache *this = (gs_glyph_cache *)data;
gs_glyph_cache_elem *e = this->list;
gs_font_type42 *pfont = this->pfont;
while (e != NULL) {
- gs_glyph_cache_elem *next_e;
+ gs_glyph_cache_elem *next_e;
- next_e = e->next;
- e->gd.procs->free(&e->gd, "gs_glyph_cache__release");
- gs_free_object(this->memory, e, "gs_glyph_cache_elem__release");
- e = next_e;
+ next_e = e->next;
+ e->gd.procs->free(&e->gd, "gs_glyph_cache__release");
+ gs_free_object(this->memory, e, "gs_glyph_cache_elem__release");
+ e = next_e;
}
- this->list = NULL;
+ this->list = NULL;
gs_font_notify_unregister((gs_font *)pfont, gs_glyph_cache__release, (void *)this);
gs_free_object(this->memory, this, "gs_glyph_cache__release");
return 0;
@@ -124,16 +124,16 @@ gs_glyph_cache__release(void *data, void *event)
static gs_glyph_cache_elem **
gs_glyph_cache_elem__locate(gs_glyph_cache *this, uint glyph_index)
-{ /* If not fond, returns an unlocked element. */
+{ /* If not fond, returns an unlocked element. */
gs_glyph_cache_elem **e = &this->list, **p_unlocked = NULL;
int count = 0; /* debug purpose only */
for (; *e != 0; e = &(*e)->next, count++) {
- if ((*e)->glyph_index == glyph_index) {
- return e;
- }
- if ((*e)->lock_count == 0)
- p_unlocked = e;
+ if ((*e)->glyph_index == glyph_index) {
+ return e;
+ }
+ if ((*e)->lock_count == 0)
+ p_unlocked = e;
}
return p_unlocked;
}
@@ -160,49 +160,49 @@ gs_glyph_cache_elem__substring(gs_glyph_data_t *pgd, uint offset, uint size)
e->lock_count++;
return_error(gs_error_unregistered); /* Unsupported; should not happen. */
-}
+}
static const gs_glyph_data_procs_t gs_glyph_cache_elem_procs = {
gs_glyph_cache_elem__free_data, gs_glyph_cache_elem__substring
};
-int
+int
gs_get_glyph_data_cached(gs_font_type42 *pfont, uint glyph_index, gs_glyph_data_t *pgd)
{ gs_glyph_cache *gdcache = pfont->data.gdcache;
gs_glyph_cache_elem **pe = gs_glyph_cache_elem__locate(gdcache, glyph_index);
gs_glyph_cache_elem *e = NULL;
if (pe == NULL || (*pe)->glyph_index != glyph_index) {
- int code;
-
- if (pe != NULL && gdcache->total_size > 32767 /* arbitrary */ &&
- (*pe)->lock_count <= 0) {
- /* Release the element's data, and move it : */
- e = *pe;
- gdcache->total_size -= e->gd.bits.size + sizeof(*e);
- e->gd.procs->free(&e->gd, "gs_get_glyph_data_cached");
- gs_glyph_cache_elem__move_to_head(gdcache, pe);
- } else {
- /* Allocate new head element. */
- e = (gs_glyph_cache_elem *)gs_alloc_struct(gdcache->memory,
- gs_glyph_cache_elem, &st_glyph_cache_elem, "gs_glyph_cache_elem");
- if (e == NULL)
- return_error(gs_error_VMerror);
- memset(e, 0, sizeof(*e));
- e->next = gdcache->list;
- gdcache->list = e;
- e->gd.memory = gdcache->memory;
- }
+ int code;
+
+ if (pe != NULL && gdcache->total_size > 32767 /* arbitrary */ &&
+ (*pe)->lock_count <= 0) {
+ /* Release the element's data, and move it : */
+ e = *pe;
+ gdcache->total_size -= e->gd.bits.size + sizeof(*e);
+ e->gd.procs->free(&e->gd, "gs_get_glyph_data_cached");
+ gs_glyph_cache_elem__move_to_head(gdcache, pe);
+ } else {
+ /* Allocate new head element. */
+ e = (gs_glyph_cache_elem *)gs_alloc_struct(gdcache->memory,
+ gs_glyph_cache_elem, &st_glyph_cache_elem, "gs_glyph_cache_elem");
+ if (e == NULL)
+ return_error(gs_error_VMerror);
+ memset(e, 0, sizeof(*e));
+ e->next = gdcache->list;
+ gdcache->list = e;
+ e->gd.memory = gdcache->memory;
+ }
/* Load the element's data : */
- code = (*gdcache->read_data)(pfont, gdcache->s, glyph_index, &e->gd);
- if (code < 0)
- return code;
+ code = (*gdcache->read_data)(pfont, gdcache->s, glyph_index, &e->gd);
+ if (code < 0)
+ return code;
gdcache->total_size += e->gd.bits.size + sizeof(*e);
- e->glyph_index = glyph_index;
+ e->glyph_index = glyph_index;
} else {
/* Move the element : */
- e = *pe;
- gs_glyph_cache_elem__move_to_head(gdcache, pe);
+ e = *pe;
+ gs_glyph_cache_elem__move_to_head(gdcache, pe);
}
/* Copy data and set procs : */
pgd->bits = e->gd.bits;
@@ -211,7 +211,3 @@ gs_get_glyph_data_cached(gs_font_type42 *pfont, uint glyph_index, gs_glyph_data_
e->lock_count++;
return 0;
}
-
-
-
-
diff --git a/gs/base/gsgcache.h b/gs/base/gsgcache.h
index 2837cfe2e..f3be34017 100644
--- a/gs/base/gsgcache.h
+++ b/gs/base/gsgcache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,13 +42,12 @@ typedef struct gs_glyph_cache_s gs_glyph_cache;
#endif
typedef int (*get_glyph_data_from_file)(gs_font_type42 *pfont, stream *s, uint glyph_index,
- gs_glyph_data_t *pgd);
-
+ gs_glyph_data_t *pgd);
/* Methods : */
gs_glyph_cache *gs_glyph_cache__alloc(gs_font_type42 *pfont, stream *s,
- get_glyph_data_from_file read_data);
+ get_glyph_data_from_file read_data);
int gs_glyph_cache__release(void /* gs_glyph_cache */ *data, void*);
int gs_get_glyph_data_cached(gs_font_type42 *pfont, uint glyph_index, gs_glyph_data_t *pgd);
diff --git a/gs/base/gsgdata.c b/gs/base/gsgdata.c
index 21efa7192..8942cc8ee 100644
--- a/gs/base/gsgdata.c
+++ b/gs/base/gsgdata.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ static RELOC_PTRS_WITH(gs_glyph_data_reloc_ptrs, gs_glyph_data_t *pgd)
RELOC_OBJ_VAR(pgd->proc_data);
} RELOC_PTRS_END
gs_public_st_composite(st_glyph_data, gs_glyph_data_t, "gs_glyph_data_t",
- gs_glyph_data_enum_ptrs, gs_glyph_data_reloc_ptrs);
+ gs_glyph_data_enum_ptrs, gs_glyph_data_reloc_ptrs);
/* ------ Client facilities ------ */
@@ -42,7 +42,7 @@ int
gs_glyph_data_substring(gs_glyph_data_t *pgd, uint offset, uint size)
{
if (offset > pgd->bits.size || size > pgd->bits.size - offset)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return pgd->procs->substring(pgd, offset, size);
}
@@ -51,9 +51,9 @@ void
gs_glyph_data_free(gs_glyph_data_t *pgd, client_name_t cname)
{
if (pgd != 0) {
- if (pgd->procs != 0)
- pgd->procs->free(pgd, cname);
- gs_glyph_data_from_null(pgd);
+ if (pgd->procs != 0)
+ pgd->procs->free(pgd, cname);
+ gs_glyph_data_from_null(pgd);
}
}
@@ -70,14 +70,14 @@ glyph_data_substring_permanent(gs_glyph_data_t *pgd, uint offset, uint size)
pgd->bits.data += offset;
pgd->bits.size = size;
return 0;
-}
+}
/* Manage the glyph data using the font's allocator. */
static void
glyph_data_free_by_font(gs_glyph_data_t *pgd, client_name_t cname)
{
gs_free_const_bytestring(((gs_font *)pgd->proc_data)->memory,
- &pgd->bits, cname);
+ &pgd->bits, cname);
}
static int
glyph_data_substring_by_font(gs_glyph_data_t *pgd, uint offset, uint size)
@@ -86,15 +86,15 @@ glyph_data_substring_by_font(gs_glyph_data_t *pgd, uint offset, uint size)
byte *data = (byte *)pgd->bits.data; /* break const */
if (pgd->bits.bytes) /* object, not string */
- return glyph_data_substring_permanent(pgd, offset, size);
+ return glyph_data_substring_permanent(pgd, offset, size);
if (offset > 0)
- memmove(data, data + offset, size);
- pgd->bits.data =
- gs_resize_string(font->memory, data, pgd->bits.size, size,
- "glyph_data_substring"); /* shortening, can't fail */
+ memmove(data, data + offset, size);
+ pgd->bits.data =
+ gs_resize_string(font->memory, data, pgd->bits.size, size,
+ "glyph_data_substring"); /* shortening, can't fail */
pgd->bits.size = size;
return 0;
-}
+}
static const gs_glyph_data_procs_t no_free_procs = {
glyph_data_free_permanent, glyph_data_substring_permanent
@@ -112,7 +112,7 @@ static const gs_glyph_data_procs_t free_by_font_procs = {
*/
void
gs_glyph_data_from_string(gs_glyph_data_t *pgd, const byte *data,
- uint size, gs_font *font)
+ uint size, gs_font *font)
{
gs_bytestring_from_string(&pgd->bits, data, size);
pgd->proc_data = font;
@@ -120,7 +120,7 @@ gs_glyph_data_from_string(gs_glyph_data_t *pgd, const byte *data,
}
void
gs_glyph_data_from_bytes(gs_glyph_data_t *pgd, const byte *bytes,
- uint offset, uint size, gs_font *font)
+ uint offset, uint size, gs_font *font)
{
gs_bytestring_from_bytes(&pgd->bits, bytes, offset, size);
pgd->proc_data = font;
diff --git a/gs/base/gsgdata.h b/gs/base/gsgdata.h
index 294e6c72e..c95acf5ef 100644
--- a/gs/base/gsgdata.h
+++ b/gs/base/gsgdata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,10 +31,10 @@
* Clients that get glyph data (for example, using the get_outline procedure
* of a Type 42 or a CIDFontType 2 font) do so as follows:
- gs_glyph_data_t gdata;
- int code;
- ...
- code = ...get_outline(...&gdata...);
+ gs_glyph_data_t gdata;
+ int code;
+ ...
+ code = ...get_outline(...&gdata...);
*
* If code >= 0 (no error), gdata.bits.{data,size} point to the outline data.
@@ -42,7 +42,7 @@
* Since the data may have been allocated in response to the request,
* when the client is finished with the data, it should call:
- gs_glyph_data_free(&gdata, "client name");
+ gs_glyph_data_free(&gdata, "client name");
* This is a no-op if the data are stored in the font, but an actual freeing
* procedure if they were allocated by get_outline.
@@ -96,16 +96,16 @@ void gs_glyph_data_free(gs_glyph_data_t *pgd, client_name_t cname);
* The implementor of get_outline or similar procedures should set the
* client's glyph_data_t structure as follows:
- ...get_outline...(...gs_font *pfont...gs_glyph_data_t *pgd...)
- {
- ...
- gs_glyph_data_from_string(pgd, odata, osize, NULL);
+ ...get_outline...(...gs_font *pfont...gs_glyph_data_t *pgd...)
+ {
+ ...
+ gs_glyph_data_from_string(pgd, odata, osize, NULL);
(or) gs_glyph_data_from_string(pgd, odata, osize, pfont);
- }
+ }
* If the data are in an object rather then a string, use
- gs_glyph_data_from_bytes(pgd, obase, ooffset, osize, <NULL|pfont>);
+ gs_glyph_data_from_bytes(pgd, obase, ooffset, osize, <NULL|pfont>);
* The last argument of gs_glyph_data_from_{string|bytes} should be pfont
* iff odata/osize were allocated by this call and will not be retained
@@ -121,9 +121,9 @@ void gs_glyph_data_free(gs_glyph_data_t *pgd, client_name_t cname);
typedef struct gs_font_s gs_font;
#endif
void gs_glyph_data_from_string(gs_glyph_data_t *pgd, const byte *data,
- uint size, gs_font *font);
+ uint size, gs_font *font);
void gs_glyph_data_from_bytes(gs_glyph_data_t *pgd, const byte *bytes,
- uint offset, uint size, gs_font *font);
+ uint offset, uint size, gs_font *font);
/* from_null(pgd) is a shortcut for from_string(pgd, NULL, 0, NULL). */
void gs_glyph_data_from_null(gs_glyph_data_t *pgd);
diff --git a/gs/base/gshsb.c b/gs/base/gshsb.c
index 5ab444027..7fe72a89a 100644
--- a/gs/base/gshsb.c
+++ b/gs/base/gshsb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -61,31 +61,31 @@ color_rgb_to_hsb(floatp r, floatp g, floatp b, float hsb[3])
#define rsat hsb[1]
#define rbri hsb[2]
if (red == green && green == blue) {
- rhue = 0; /* arbitrary */
- rsat = 0;
- rbri = r; /* pick any one */
+ rhue = 0; /* arbitrary */
+ rsat = 0;
+ rbri = r; /* pick any one */
} else { /* Convert rgb to hsb */
- frac V, Temp, diff;
- long H;
-
- V = (red > green ? red : green);
- if (blue > V)
- V = blue;
- Temp = (red > green ? green : red);
- if (blue < Temp)
- Temp = blue;
- diff = V - Temp;
- if (V == red)
- H = (green - blue) * frac_1_long / diff;
- else if (V == green)
- H = (blue - red) * frac_1_long / diff + 2 * frac_1_long;
- else /* V == blue */
- H = (red - green) * frac_1_long / diff + 4 * frac_1_long;
- if (H < 0)
- H += 6 * frac_1_long;
- rhue = H / (frac_1 * 6.0);
- rsat = diff / (float)V;
- rbri = frac2float(V);
+ frac V, Temp, diff;
+ long H;
+
+ V = (red > green ? red : green);
+ if (blue > V)
+ V = blue;
+ Temp = (red > green ? green : red);
+ if (blue < Temp)
+ Temp = blue;
+ diff = V - Temp;
+ if (V == red)
+ H = (green - blue) * frac_1_long / diff;
+ else if (V == green)
+ H = (blue - red) * frac_1_long / diff + 2 * frac_1_long;
+ else /* V == blue */
+ H = (red - green) * frac_1_long / diff + 4 * frac_1_long;
+ if (H < 0)
+ H += 6 * frac_1_long;
+ rhue = H / (frac_1 * 6.0);
+ rsat = diff / (float)V;
+ rbri = frac2float(V);
}
#undef rhue
#undef rsat
@@ -97,64 +97,64 @@ static void
color_hsb_to_rgb(floatp hue, floatp saturation, floatp brightness, float rgb[3])
{
if (saturation == 0) {
- rgb[0] = rgb[1] = rgb[2] = brightness;
+ rgb[0] = rgb[1] = rgb[2] = brightness;
} else { /* Convert hsb to rgb. */
- /* We rely on the fact that the product of two */
- /* fracs fits into an unsigned long. */
- floatp h6 = hue * 6;
- ulong V = float2frac(brightness); /* force arithmetic to long */
- frac S = float2frac(saturation);
- int I = (int)h6;
- ulong F = float2frac(h6 - I); /* ditto */
-
- /* M = V*(1-S), N = V*(1-S*F), K = V*(1-S*(1-F)) = M-N+V */
- frac M = V * (frac_1_long - S) / frac_1_long;
- frac N = V * (frac_1_long - S * F / frac_1_long) / frac_1_long;
- frac K = M - N + V;
- frac R, G, B;
-
- switch (I) {
- default:
- R = V;
- G = K;
- B = M;
- break;
- case 1:
- R = N;
- G = V;
- B = M;
- break;
- case 2:
- R = M;
- G = V;
- B = K;
- break;
- case 3:
- R = M;
- G = N;
- B = V;
- break;
- case 4:
- R = K;
- G = M;
- B = V;
- break;
- case 5:
- R = V;
- G = M;
- B = N;
- break;
- }
- rgb[0] = frac2float(R);
- rgb[1] = frac2float(G);
- rgb[2] = frac2float(B);
+ /* We rely on the fact that the product of two */
+ /* fracs fits into an unsigned long. */
+ floatp h6 = hue * 6;
+ ulong V = float2frac(brightness); /* force arithmetic to long */
+ frac S = float2frac(saturation);
+ int I = (int)h6;
+ ulong F = float2frac(h6 - I); /* ditto */
+
+ /* M = V*(1-S), N = V*(1-S*F), K = V*(1-S*(1-F)) = M-N+V */
+ frac M = V * (frac_1_long - S) / frac_1_long;
+ frac N = V * (frac_1_long - S * F / frac_1_long) / frac_1_long;
+ frac K = M - N + V;
+ frac R, G, B;
+
+ switch (I) {
+ default:
+ R = V;
+ G = K;
+ B = M;
+ break;
+ case 1:
+ R = N;
+ G = V;
+ B = M;
+ break;
+ case 2:
+ R = M;
+ G = V;
+ B = K;
+ break;
+ case 3:
+ R = M;
+ G = N;
+ B = V;
+ break;
+ case 4:
+ R = K;
+ G = M;
+ B = V;
+ break;
+ case 5:
+ R = V;
+ G = M;
+ B = N;
+ break;
+ }
+ rgb[0] = frac2float(R);
+ rgb[1] = frac2float(G);
+ rgb[2] = frac2float(B);
#ifdef DEBUG
- if (gs_debug_c('c')) {
- dlprintf7("[c]hsb(%g,%g,%g)->VSFI(%ld,%d,%ld,%d)->\n",
- hue, saturation, brightness, V, S, F, I);
- dlprintf6(" RGB(%d,%d,%d)->rgb(%g,%g,%g)\n",
- R, G, B, rgb[0], rgb[1], rgb[2]);
- }
+ if (gs_debug_c('c')) {
+ dlprintf7("[c]hsb(%g,%g,%g)->VSFI(%ld,%d,%ld,%d)->\n",
+ hue, saturation, brightness, V, S, F, I);
+ dlprintf6(" RGB(%d,%d,%d)->rgb(%g,%g,%g)\n",
+ R, G, B, rgb[0], rgb[1], rgb[2]);
+ }
#endif
}
}
diff --git a/gs/base/gshsb.h b/gs/base/gshsb.h
index 2845c8614..758ed85ec 100644
--- a/gs/base/gshsb.h
+++ b/gs/base/gshsb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsht.c b/gs/base/gsht.c
index 185695567..4308a48a1 100644
--- a/gs/base/gsht.c
+++ b/gs/base/gsht.c
@@ -61,7 +61,6 @@ void gx_set_effective_transfer(gs_state *);
*/
static const ushort ht_wts_suppress_release = (ushort)(-1);
-
/* Structure types */
public_st_ht_order();
private_st_ht_order_component();
@@ -393,7 +392,6 @@ gx_ht_move_ht_order(gx_ht_order * pdest, gx_ht_order * psrc)
pdest->transfer = psrc->transfer;
}
-
/* Allocate and initialize the contents of a halftone order. */
/* The client must have set the defining values in porder->params. */
int
@@ -1373,9 +1371,9 @@ gx_set_effective_transfer(gs_state * pgs)
that it is built into the threshold values. This only works correctly
for monotonic curves. */
static int
-gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
+gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
gs_imager_state * pis, int plane_index,
- bool *is_inverting)
+ bool *is_inverting)
{
frac frac_val;
float float_val;
@@ -1390,8 +1388,8 @@ gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
is_monotonic = true;
/* First construct a representation of the forward curve */
- transfer_sampled = (frac *)gs_malloc(memory, TRANSFER_INVERSE_SIZE,
- sizeof(frac),
+ transfer_sampled = (frac *)gs_malloc(memory, TRANSFER_INVERSE_SIZE,
+ sizeof(frac),
"gx_ht_construct_transfer_inverse");
if (transfer_sampled == NULL) {
return -1 ; /* error if allocation failed */
@@ -1411,10 +1409,10 @@ gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
for (k = 0; k < TRANSFER_INVERSE_SIZE; k++) {
float_val = (float) (offset - k)/(float) (TRANSFER_INVERSE_SIZE - 1);
frac_val = float2frac(float_val);
- transfer_sampled[k] = gx_map_color_frac(pis, frac_val,
+ transfer_sampled[k] = gx_map_color_frac(pis, frac_val,
effective_transfer[plane_index]);
if (prev_value > transfer_sampled[k]) {
- is_monotonic = false;
+ is_monotonic = false;
}
prev_value = transfer_sampled[k];
/* Take note of any leading zeros and ending ones for the inversion */
@@ -1428,10 +1426,10 @@ gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
for (k = 0; k < TRANSFER_INVERSE_SIZE; k++) {
float_val = (float) k / (float) (TRANSFER_INVERSE_SIZE - 1);
frac_val = float2frac(float_val);
- transfer_sampled[k] = gx_map_color_frac(pis, frac_val,
+ transfer_sampled[k] = gx_map_color_frac(pis, frac_val,
effective_transfer[plane_index]);
if (prev_value > transfer_sampled[k]) {
- is_monotonic = false;
+ is_monotonic = false;
}
prev_value = transfer_sampled[k];
/* Take note of any leading zeros and ending ones for the inversion */
@@ -1470,31 +1468,31 @@ gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
/* OK found the point go ahead and interpolate if needed */
if (*is_inverting) {
if (hit) {
- transfer_inverse[255 - k] =
- round((float) mid_pos * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
+ transfer_inverse[255 - k] =
+ round((float) mid_pos * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
} else {
/* Interpolate */
min_val = transfer_sampled[min_pos];
max_val = transfer_sampled[max_pos];
- float_val = (float) min_pos +
- (float) (max_pos - min_pos) * (float) (frac_val - min_val) /
+ float_val = (float) min_pos +
+ (float) (max_pos - min_pos) * (float) (frac_val - min_val) /
(float) (max_val - min_val);
- transfer_inverse[255 - k] =
- round(float_val * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
+ transfer_inverse[255 - k] =
+ round(float_val * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
}
} else {
if (hit) {
- transfer_inverse[k] =
- round((float) mid_pos * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
+ transfer_inverse[k] =
+ round((float) mid_pos * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
} else {
/* Interpolate */
min_val = transfer_sampled[min_pos];
max_val = transfer_sampled[max_pos];
- float_val = (float) min_pos +
- (float) (max_pos - min_pos) * (float) (frac_val - min_val) /
+ float_val = (float) min_pos +
+ (float) (max_pos - min_pos) * (float) (frac_val - min_val) /
(float) (max_val - min_val);
- transfer_inverse[k] =
- round(float_val * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
+ transfer_inverse[k] =
+ round(float_val * 255.0 / (float) (TRANSFER_INVERSE_SIZE - 1));
}
}
}
@@ -1516,7 +1514,7 @@ gx_ht_construct_transfer_inverse(gs_memory_t *memory, byte *transfer_inverse,
array from the tiles. Threshold is allocated in non-gc memory and is
not known to the gc */
int
-gx_ht_construct_threshold( gx_ht_order *d_order, gx_device *dev,
+gx_ht_construct_threshold( gx_ht_order *d_order, gx_device *dev,
const gs_imager_state * pis, int plane_index)
{
int i, j, l, prev_l;
@@ -1545,14 +1543,14 @@ gx_ht_construct_threshold( gx_ht_order *d_order, gx_device *dev,
#if TRANSFER_IN_THRESHOLDS
/* Check if we need to apply a transfer function to the values */
if (pis->effective_transfer[plane_index]->proc != gs_identity_transfer) {
- transfer_inverse = (byte *)gs_malloc(memory, 256, 1,
+ transfer_inverse = (byte *)gs_malloc(memory, 256, 1,
"gx_ht_construct_threshold");
if (transfer_inverse == NULL) {
return -1 ; /* error if allocation failed */
}
/* Create an inverse of the transfer. Hopefully it is invertible. If
not, we will get some strange results... */
- code = gx_ht_construct_transfer_inverse(memory, transfer_inverse, pis,
+ code = gx_ht_construct_transfer_inverse(memory, transfer_inverse, pis,
plane_index, &is_inverting);
d_order->threshold_inverts = is_inverting;
if (code < 0) {
@@ -1640,4 +1638,3 @@ gx_ht_construct_threshold( gx_ht_order *d_order, gx_device *dev,
}
return 0;
}
-
diff --git a/gs/base/gsht.h b/gs/base/gsht.h
index dd4309c0b..c12e74eb1 100644
--- a/gs/base/gsht.h
+++ b/gs/base/gsht.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,10 +33,10 @@ typedef struct gs_screen_halftone_s {
/* Client definition of color (Type 2) halftones */
typedef struct gs_colorscreen_halftone_s {
union _css {
- gs_screen_halftone indexed[4];
- struct _csc {
- gs_screen_halftone red, green, blue, gray;
- } colored;
+ gs_screen_halftone indexed[4];
+ struct _csc {
+ gs_screen_halftone red, green, blue, gray;
+ } colored;
} screens;
} gs_colorscreen_halftone;
diff --git a/gs/base/gsht1.c b/gs/base/gsht1.c
index 5b5986dcf..c9cf76661 100644
--- a/gs/base/gsht1.c
+++ b/gs/base/gsht1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,16 +31,16 @@ void load_transfer_map(gs_state *, gx_transfer_map *, floatp);
/* Forward declarations */
static int process_spot(gx_ht_order *, gs_state *,
- gs_spot_halftone *, gs_memory_t *);
+ gs_spot_halftone *, gs_memory_t *);
static int process_threshold(gx_ht_order *, gs_state *,
- gs_threshold_halftone *, gs_memory_t *);
+ gs_threshold_halftone *, gs_memory_t *);
static int process_threshold2(gx_ht_order *, gs_state *,
- gs_threshold2_halftone *, gs_memory_t *);
+ gs_threshold2_halftone *, gs_memory_t *);
static int process_client_order(gx_ht_order *, gs_state *,
- gs_client_order_halftone *, gs_memory_t *);
+ gs_client_order_halftone *, gs_memory_t *);
static int
gs_sethalftone_try_wts(gs_halftone *pht, gs_state *pgs,
- gx_device_halftone *pdht);
+ gx_device_halftone *pdht);
/* Structure types */
public_st_halftone_component();
@@ -48,18 +48,18 @@ public_st_ht_component_element();
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(halftone_component_enum_ptrs, gs_halftone_component *hptr) return 0;
case 0:
switch (hptr->type)
{
case ht_type_spot:
ENUM_RETURN((hptr->params.spot.transfer == 0 ?
- hptr->params.spot.transfer_closure.data :
- 0));
+ hptr->params.spot.transfer_closure.data :
+ 0));
case ht_type_threshold:
ENUM_RETURN_CONST_STRING_PTR(gs_halftone_component,
- params.threshold.thresholds);
+ params.threshold.thresholds);
case ht_type_threshold2:
return ENUM_CONST_BYTESTRING(&hptr->params.threshold2.thresholds);
case ht_type_client_order:
@@ -70,39 +70,39 @@ return 0;
case 1:
switch (hptr->type) {
case ht_type_threshold:
- ENUM_RETURN((hptr->params.threshold.transfer == 0 ?
- hptr->params.threshold.transfer_closure.data :
- 0));
+ ENUM_RETURN((hptr->params.threshold.transfer == 0 ?
+ hptr->params.threshold.transfer_closure.data :
+ 0));
case ht_type_threshold2:
- ENUM_RETURN(hptr->params.threshold2.transfer_closure.data);
+ ENUM_RETURN(hptr->params.threshold2.transfer_closure.data);
case ht_type_client_order:
- ENUM_RETURN(hptr->params.client_order.transfer_closure.data);
+ ENUM_RETURN(hptr->params.client_order.transfer_closure.data);
default:
- return 0;
+ return 0;
}
ENUM_PTRS_END
static RELOC_PTRS_WITH(halftone_component_reloc_ptrs, gs_halftone_component *hptr)
{
switch (hptr->type) {
- case ht_type_spot:
- if (hptr->params.spot.transfer == 0)
- RELOC_VAR(hptr->params.spot.transfer_closure.data);
- break;
- case ht_type_threshold:
- RELOC_CONST_STRING_VAR(hptr->params.threshold.thresholds);
- if (hptr->params.threshold.transfer == 0)
- RELOC_VAR(hptr->params.threshold.transfer_closure.data);
- break;
- case ht_type_threshold2:
- RELOC_CONST_BYTESTRING_VAR(hptr->params.threshold2.thresholds);
- RELOC_OBJ_VAR(hptr->params.threshold2.transfer_closure.data);
- break;
- case ht_type_client_order:
- RELOC_VAR(hptr->params.client_order.client_data);
- RELOC_VAR(hptr->params.client_order.transfer_closure.data);
- break;
- default:
- break;
+ case ht_type_spot:
+ if (hptr->params.spot.transfer == 0)
+ RELOC_VAR(hptr->params.spot.transfer_closure.data);
+ break;
+ case ht_type_threshold:
+ RELOC_CONST_STRING_VAR(hptr->params.threshold.thresholds);
+ if (hptr->params.threshold.transfer == 0)
+ RELOC_VAR(hptr->params.threshold.transfer_closure.data);
+ break;
+ case ht_type_threshold2:
+ RELOC_CONST_BYTESTRING_VAR(hptr->params.threshold2.thresholds);
+ RELOC_OBJ_VAR(hptr->params.threshold2.transfer_closure.data);
+ break;
+ case ht_type_client_order:
+ RELOC_VAR(hptr->params.client_order.client_data);
+ RELOC_VAR(hptr->params.client_order.transfer_closure.data);
+ break;
+ default:
+ break;
}
}
RELOC_PTRS_END
@@ -125,17 +125,17 @@ gs_currentcolorscreen(gs_state * pgs, gs_colorscreen_halftone * pht)
int code;
switch (pgs->halftone->type) {
- case ht_type_colorscreen:
- *pht = pgs->halftone->params.colorscreen;
- return 0;
- default:
- code = gs_currentscreen(pgs, &pht->screens.colored.gray);
- if (code < 0)
- return code;
- pht->screens.colored.red = pht->screens.colored.gray;
- pht->screens.colored.green = pht->screens.colored.gray;
- pht->screens.colored.blue = pht->screens.colored.gray;
- return 0;
+ case ht_type_colorscreen:
+ *pht = pgs->halftone->params.colorscreen;
+ return 0;
+ default:
+ code = gs_currentscreen(pgs, &pht->screens.colored.gray);
+ if (code < 0)
+ return code;
+ pht->screens.colored.red = pht->screens.colored.gray;
+ pht->screens.colored.green = pht->screens.colored.gray;
+ pht->screens.colored.blue = pht->screens.colored.gray;
+ return 0;
}
}
@@ -156,7 +156,7 @@ gs_sethalftone_allocated(gs_state * pgs, gs_halftone * pht)
int code = gs_sethalftone_prepare(pgs, pht, &dev_ht);
if (code < 0)
- return code;
+ return code;
dev_ht.rc.memory = pht->rc.memory;
if ((code = gx_ht_install(pgs, pht, &dev_ht)) < 0)
gx_device_halftone_release(&dev_ht, pht->rc.memory);
@@ -166,159 +166,159 @@ gs_sethalftone_allocated(gs_state * pgs, gs_halftone * pht)
/* Prepare the halftone, but don't install it. */
int
gs_sethalftone_prepare(gs_state * pgs, gs_halftone * pht,
- gx_device_halftone * pdht)
+ gx_device_halftone * pdht)
{
gs_memory_t *mem = pht->rc.memory;
gx_ht_order_component *pocs = 0;
int code = 0;
if (gs_currentusewts(mem) && gs_sethalftone_try_wts(pht, pgs, pdht) == 0)
- return 0;
+ return 0;
switch (pht->type) {
- case ht_type_colorscreen:
- {
- gs_screen_halftone *phc =
- pht->params.colorscreen.screens.indexed;
- static const int cindex[4] = {3, 0, 1, 2};
- static const char * color_names[4] = {"Gray", "Red", "Green", "Blue"};
- int i;
-
- pocs = gs_alloc_struct_array(mem, 4,
- gx_ht_order_component,
- &st_ht_order_component_element,
- "gs_sethalftone");
- if (pocs == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < 4; i++) {
- gs_screen_enum senum;
- int ci = cindex[i];
- gx_ht_order_component *poc = &pocs[i];
-
- code = gx_ht_process_screen_memory(&senum, pgs, &phc[ci],
- gs_currentaccuratescreens(mem), mem);
- if (code < 0)
- break;
- poc->corder = senum.order;
- poc->comp_number = gs_color_name_component_number(pgs->device,
- color_names[i], strlen(color_names[i]), pht->type);
- poc->cname = 0; /* name index values are not known (or needed) */
- if (i == 0) /* Gray = Default */
- pdht->order = poc->corder; /* Save default value */
- }
- if (code < 0)
- break;
- pdht->components = pocs;
- pdht->num_comp = 4;
- }
- break;
- case ht_type_spot:
- code = process_spot(&pdht->order, pgs, &pht->params.spot, mem);
- if (code < 0)
- return code;
- pdht->components = 0;
- break;
- case ht_type_threshold:
- code = process_threshold(&pdht->order, pgs,
- &pht->params.threshold, mem);
- if (code < 0)
- return code;
- pdht->components = 0;
- break;
- case ht_type_threshold2:
- code = process_threshold2(&pdht->order, pgs,
- &pht->params.threshold2, mem);
- if (code < 0)
- return code;
- pdht->components = 0;
- break;
- case ht_type_client_order:
- code = process_client_order(&pdht->order, pgs,
- &pht->params.client_order, mem);
- if (code < 0)
- return code;
- pdht->components = 0;
- break;
- case ht_type_multiple:
- case ht_type_multiple_colorscreen:
- {
- uint count = pht->params.multiple.num_comp;
- bool have_Default = false;
- uint i;
- gs_halftone_component *phc = pht->params.multiple.components;
- gx_ht_order_component *poc_next;
-
- pocs = gs_alloc_struct_array(mem, count,
- gx_ht_order_component,
- &st_ht_order_component_element,
- "gs_sethalftone");
- if (pocs == 0)
- return_error(gs_error_VMerror);
- poc_next = pocs + 1;
- for (i = 0; i < count; i++, phc++) {
- gx_ht_order_component *poc = poc_next;
-
- if (phc->comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
- if (have_Default) {
- /* Duplicate Default */
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- poc = pocs;
- have_Default = true;
- } else if (i == count - 1 && !have_Default) {
- /* No Default */
- code = gs_note_error(gs_error_rangecheck);
- break;
- } else
- poc = poc_next++;
-
- poc->comp_number = phc->comp_number;
- poc->cname = phc->cname;
- switch (phc->type) {
- case ht_type_spot:
- code = process_spot(&poc->corder, pgs,
- &phc->params.spot, mem);
- break;
- case ht_type_threshold:
- code = process_threshold(&poc->corder, pgs,
- &phc->params.threshold, mem);
- break;
- case ht_type_threshold2:
- code = process_threshold2(&poc->corder, pgs,
- &phc->params.threshold2, mem);
- break;
- case ht_type_client_order:
- code = process_client_order(&poc->corder, pgs,
- &phc->params.client_order, mem);
- break;
- default:
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- if (code < 0)
- break;
- }
- if (code < 0)
- break;
- pdht->order = pocs[0].corder; /* Default */
- if (count == 1) {
- /* We have only a Default; */
- /* we don't need components. */
- gs_free_object(mem, pocs, "gs_sethalftone");
- pdht->components = 0;
- pdht->num_comp = 0;
- } else {
- pdht->components = pocs;
- pdht->num_comp = count;
- }
- }
- break;
- default:
- return_error(gs_error_rangecheck);
+ case ht_type_colorscreen:
+ {
+ gs_screen_halftone *phc =
+ pht->params.colorscreen.screens.indexed;
+ static const int cindex[4] = {3, 0, 1, 2};
+ static const char * color_names[4] = {"Gray", "Red", "Green", "Blue"};
+ int i;
+
+ pocs = gs_alloc_struct_array(mem, 4,
+ gx_ht_order_component,
+ &st_ht_order_component_element,
+ "gs_sethalftone");
+ if (pocs == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < 4; i++) {
+ gs_screen_enum senum;
+ int ci = cindex[i];
+ gx_ht_order_component *poc = &pocs[i];
+
+ code = gx_ht_process_screen_memory(&senum, pgs, &phc[ci],
+ gs_currentaccuratescreens(mem), mem);
+ if (code < 0)
+ break;
+ poc->corder = senum.order;
+ poc->comp_number = gs_color_name_component_number(pgs->device,
+ color_names[i], strlen(color_names[i]), pht->type);
+ poc->cname = 0; /* name index values are not known (or needed) */
+ if (i == 0) /* Gray = Default */
+ pdht->order = poc->corder; /* Save default value */
+ }
+ if (code < 0)
+ break;
+ pdht->components = pocs;
+ pdht->num_comp = 4;
+ }
+ break;
+ case ht_type_spot:
+ code = process_spot(&pdht->order, pgs, &pht->params.spot, mem);
+ if (code < 0)
+ return code;
+ pdht->components = 0;
+ break;
+ case ht_type_threshold:
+ code = process_threshold(&pdht->order, pgs,
+ &pht->params.threshold, mem);
+ if (code < 0)
+ return code;
+ pdht->components = 0;
+ break;
+ case ht_type_threshold2:
+ code = process_threshold2(&pdht->order, pgs,
+ &pht->params.threshold2, mem);
+ if (code < 0)
+ return code;
+ pdht->components = 0;
+ break;
+ case ht_type_client_order:
+ code = process_client_order(&pdht->order, pgs,
+ &pht->params.client_order, mem);
+ if (code < 0)
+ return code;
+ pdht->components = 0;
+ break;
+ case ht_type_multiple:
+ case ht_type_multiple_colorscreen:
+ {
+ uint count = pht->params.multiple.num_comp;
+ bool have_Default = false;
+ uint i;
+ gs_halftone_component *phc = pht->params.multiple.components;
+ gx_ht_order_component *poc_next;
+
+ pocs = gs_alloc_struct_array(mem, count,
+ gx_ht_order_component,
+ &st_ht_order_component_element,
+ "gs_sethalftone");
+ if (pocs == 0)
+ return_error(gs_error_VMerror);
+ poc_next = pocs + 1;
+ for (i = 0; i < count; i++, phc++) {
+ gx_ht_order_component *poc = poc_next;
+
+ if (phc->comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ if (have_Default) {
+ /* Duplicate Default */
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ poc = pocs;
+ have_Default = true;
+ } else if (i == count - 1 && !have_Default) {
+ /* No Default */
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ } else
+ poc = poc_next++;
+
+ poc->comp_number = phc->comp_number;
+ poc->cname = phc->cname;
+ switch (phc->type) {
+ case ht_type_spot:
+ code = process_spot(&poc->corder, pgs,
+ &phc->params.spot, mem);
+ break;
+ case ht_type_threshold:
+ code = process_threshold(&poc->corder, pgs,
+ &phc->params.threshold, mem);
+ break;
+ case ht_type_threshold2:
+ code = process_threshold2(&poc->corder, pgs,
+ &phc->params.threshold2, mem);
+ break;
+ case ht_type_client_order:
+ code = process_client_order(&poc->corder, pgs,
+ &phc->params.client_order, mem);
+ break;
+ default:
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ if (code < 0)
+ break;
+ }
+ if (code < 0)
+ break;
+ pdht->order = pocs[0].corder; /* Default */
+ if (count == 1) {
+ /* We have only a Default; */
+ /* we don't need components. */
+ gs_free_object(mem, pocs, "gs_sethalftone");
+ pdht->components = 0;
+ pdht->num_comp = 0;
+ } else {
+ pdht->components = pocs;
+ pdht->num_comp = count;
+ }
+ }
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
if (code < 0)
- gs_free_object(mem, pocs, "gs_sethalftone");
+ gs_free_object(mem, pocs, "gs_sethalftone");
return code;
}
@@ -327,20 +327,20 @@ gs_sethalftone_prepare(gs_state * pgs, gs_halftone * pht,
/* Process a transfer function override, if any. */
static int
process_transfer(gx_ht_order * porder, gs_state * pgs,
- gs_mapping_proc proc, gs_mapping_closure_t * pmc,
- gs_memory_t * mem)
+ gs_mapping_proc proc, gs_mapping_closure_t * pmc,
+ gs_memory_t * mem)
{
gx_transfer_map *pmap;
if (proc == 0 && pmc->proc == 0)
- return 0;
+ return 0;
/*
* The transfer funtion is referenced by the order, so start the
* reference count at 1.
*/
rc_alloc_struct_1(pmap, gx_transfer_map, &st_transfer_map, mem,
- return_error(gs_error_VMerror),
- "process_transfer");
+ return_error(gs_error_VMerror),
+ "process_transfer");
pmap->proc = proc; /* 0 => use closure */
pmap->closure = *pmc;
pmap->id = gs_next_ids(mem, 1);
@@ -354,18 +354,18 @@ process_transfer(gx_ht_order * porder, gs_state * pgs,
/* Process a spot plane. */
static int
process_spot(gx_ht_order * porder, gs_state * pgs,
- gs_spot_halftone * phsp, gs_memory_t * mem)
+ gs_spot_halftone * phsp, gs_memory_t * mem)
{
gs_screen_enum senum;
int code = gx_ht_process_screen_memory(&senum, pgs, &phsp->screen,
- phsp->accurate_screens, mem);
+ phsp->accurate_screens, mem);
if (code < 0)
- return code;
+ return code;
*porder = senum.order;
return process_transfer(porder, pgs, phsp->transfer,
- &phsp->transfer_closure, mem);
+ &phsp->transfer_closure, mem);
}
/* Construct the halftone order from a threshold array. */
@@ -383,15 +383,15 @@ gx_ht_complete_threshold_order(gx_ht_order * porder)
/* We want to set levels[j] to the lowest value of i */
/* such that bits[i].mask > j. */
for (i = 0, j = 0; i < size; i++) {
- if (bits[i].mask != j) {
- if_debug3('h', "[h]levels[%u..%u] = %u\n",
- j, (uint) bits[i].mask, i);
- while (j < bits[i].mask)
- levels[j++] = i;
- }
+ if (bits[i].mask != j) {
+ if_debug3('h', "[h]levels[%u..%u] = %u\n",
+ j, (uint) bits[i].mask, i);
+ while (j < bits[i].mask)
+ levels[j++] = i;
+ }
}
while (j < num_levels)
- levels[j++] = size;
+ levels[j++] = size;
gx_ht_construct_bits(porder);
}
int
@@ -403,7 +403,7 @@ gx_ht_construct_threshold_order(gx_ht_order * porder, const byte * thresholds)
/* Process a threshold plane. */
static int
process_threshold(gx_ht_order * porder, gs_state * pgs,
- gs_threshold_halftone * phtp, gs_memory_t * mem)
+ gs_threshold_halftone * phtp, gs_memory_t * mem)
{
int code;
@@ -412,18 +412,18 @@ process_threshold(gx_ht_order * porder, gs_state * pgs,
porder->params.M1 = phtp->height, porder->params.N1 = 0;
porder->params.R1 = 1;
code = gx_ht_alloc_threshold_order(porder, phtp->width, phtp->height,
- 256, mem);
+ 256, mem);
if (code < 0)
- return code;
+ return code;
gx_ht_construct_threshold_order(porder, phtp->thresholds.data);
return process_transfer(porder, pgs, phtp->transfer,
- &phtp->transfer_closure, mem);
+ &phtp->transfer_closure, mem);
}
/* Process an extended threshold plane. */
static int
process_threshold2(gx_ht_order * porder, gs_state * pgs,
- gs_threshold2_halftone * phtp, gs_memory_t * mem)
+ gs_threshold2_halftone * phtp, gs_memory_t * mem)
{
int code;
/*
@@ -447,20 +447,20 @@ process_threshold2(gx_ht_order * porder, gs_state * pgs,
int shift;
{
- uint mask = 0, max_thr = 0;
-
- for (i = 0; i < size; ++i) {
- uint thr =
- (bps == 1 ? data[i] : (data[i * 2] << 8) + data[i * 2 + 1]);
-
- mask |= thr;
- max_thr = max(max_thr, thr);
- }
- if (mask == 0)
- mask = 1, max_thr = 1;
- while (!(mask & 1) || max_thr > MAX_HT_LEVELS)
- mask >>= 1, max_thr >>= 1, rshift++;
- num_levels = max_thr + 1;
+ uint mask = 0, max_thr = 0;
+
+ for (i = 0; i < size; ++i) {
+ uint thr =
+ (bps == 1 ? data[i] : (data[i * 2] << 8) + data[i * 2 + 1]);
+
+ mask |= thr;
+ max_thr = max(max_thr, thr);
+ }
+ if (mask == 0)
+ mask = 1, max_thr = 1;
+ while (!(mask & 1) || max_thr > MAX_HT_LEVELS)
+ mask >>= 1, max_thr >>= 1, rshift++;
+ num_levels = max_thr + 1;
}
/*
* Set nominal values for the params, and don't bother to call
@@ -477,58 +477,58 @@ process_threshold2(gx_ht_order * porder, gs_state * pgs,
*/
shift = 0;
{
- int x = 0, y = 0;
-
- do {
- if (y < h1)
- x += w1, y += h2;
- else
- x += w2, y -= h1;
- } while (y > d);
- if (y)
- shift = x;
+ int x = 0, y = 0;
+
+ do {
+ if (y < h1)
+ x += w1, y += h2;
+ else
+ x += w2, y -= h1;
+ } while (y > d);
+ if (y)
+ shift = x;
}
code = gx_ht_alloc_ht_order(porder, sod, d, num_levels, size, shift,
- &ht_order_procs_default, mem);
+ &ht_order_procs_default, mem);
if (code < 0)
- return code;
+ return code;
{
- gx_ht_bit *bits = (gx_ht_bit *)porder->bit_data;
- int row, di;
-
- if_debug7('h', "[h]rect1=(%d,%d), rect2=(%d,%d), strip=(%d,%d), shift=%d\n",
- w1, h1, w2, h2, sod, d, shift);
- for (row = 0, di = 0; row < d; ++row) {
- /* Iterate over destination rows. */
- int dx, sy = row; /* sy = row mod d */
- int w;
-
- for (dx = 0; dx < sod; dx += w) {
- /* Iterate within a destination row, over source rows. */
- int si, j;
-
- if (sy < h1) {
- /* Copy a row from rect1. */
- si = sy * w1;
- w = w1;
- sy += h2;
- } else {
- /* Copy a row from rect2. */
- si = size1 + (sy - h1) * w2;
- w = w2;
- sy -= h1;
- }
- for (j = 0; j < w; ++j, ++si, ++di) {
- uint thr =
- (bps == 1 ? data[si] :
- (data[si * 2] << 8) + data[si * 2 + 1])
- >> rshift;
-
- if_debug3('H', "[H]sy=%d, si=%d, di=%d\n", sy, si, di);
- bits[di].mask = max(thr, 1);
- }
- }
- }
+ gx_ht_bit *bits = (gx_ht_bit *)porder->bit_data;
+ int row, di;
+
+ if_debug7('h', "[h]rect1=(%d,%d), rect2=(%d,%d), strip=(%d,%d), shift=%d\n",
+ w1, h1, w2, h2, sod, d, shift);
+ for (row = 0, di = 0; row < d; ++row) {
+ /* Iterate over destination rows. */
+ int dx, sy = row; /* sy = row mod d */
+ int w;
+
+ for (dx = 0; dx < sod; dx += w) {
+ /* Iterate within a destination row, over source rows. */
+ int si, j;
+
+ if (sy < h1) {
+ /* Copy a row from rect1. */
+ si = sy * w1;
+ w = w1;
+ sy += h2;
+ } else {
+ /* Copy a row from rect2. */
+ si = size1 + (sy - h1) * w2;
+ w = w2;
+ sy -= h1;
+ }
+ for (j = 0; j < w; ++j, ++si, ++di) {
+ uint thr =
+ (bps == 1 ? data[si] :
+ (data[si * 2] << 8) + data[si * 2 + 1])
+ >> rshift;
+
+ if_debug3('H', "[H]sy=%d, si=%d, di=%d\n", sy, si, di);
+ bits[di].mask = max(thr, 1);
+ }
+ }
+ }
}
gx_ht_complete_threshold_order(porder);
return process_transfer(porder, pgs, NULL, &phtp->transfer_closure, mem);
@@ -539,14 +539,14 @@ process_threshold2(gx_ht_order * porder, gs_state * pgs,
/* Process a client-order plane. */
static int
process_client_order(gx_ht_order * porder, gs_state * pgs,
- gs_client_order_halftone * phcop, gs_memory_t * mem)
+ gs_client_order_halftone * phcop, gs_memory_t * mem)
{
int code = (*phcop->procs->create_order) (porder, pgs, phcop, mem);
if (code < 0)
- return code;
+ return code;
return process_transfer(porder, pgs, NULL,
- &phcop->transfer_closure, mem);
+ &phcop->transfer_closure, mem);
}
static const gx_ht_order_procs_t wts_order_procs = { 0
@@ -565,115 +565,115 @@ static const gx_ht_order_procs_t wts_order_procs = { 0
**/
static int
gs_sethalftone_try_wts(gs_halftone *pht, gs_state *pgs,
- gx_device_halftone *pdht)
+ gx_device_halftone *pdht)
{
gx_device *dev = pgs->device;
int num_comps = dev->color_info.num_components;
int depth = dev->color_info.depth;
if (pht->type != ht_type_multiple)
- /* Only work with Type 5 halftones. todo: we probably want
- to relax this. */
- return 1;
+ /* Only work with Type 5 halftones. todo: we probably want
+ to relax this. */
+ return 1;
if_debug2('h', "[h]%s, num_comp = %d\n",
- dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN ? "Separable and linear" : "Not separable and linear!",
- pht->params.multiple.num_comp);
+ dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN ? "Separable and linear" : "Not separable and linear!",
+ pht->params.multiple.num_comp);
if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN &&
- pht->params.multiple.num_comp > 1)
- /* WTS is only enabled for separable or monochrome devices. */
- return 1;
+ pht->params.multiple.num_comp > 1)
+ /* WTS is only enabled for separable or monochrome devices. */
+ return 1;
/* only work with bilevel (not multilevel) devices */
if (depth > num_comps) {
if (depth >= 2 * num_comps)
- return 1;
+ return 1;
if (dev->color_info.gray_index != GX_CINFO_COMP_NO_INDEX &&
- (dev->color_info.max_gray > 1 ||
- (num_comps > 1 && dev->color_info.max_color > 1)))
+ (dev->color_info.max_gray > 1 ||
+ (num_comps > 1 && dev->color_info.max_color > 1)))
return 1;
}
if (pht->type == ht_type_multiple) {
- gs_halftone_component *components = pht->params.multiple.components;
- uint num_comp = pht->params.multiple.num_comp;
- int i;
- gx_ht_order_component *pocs;
- gx_ht_order_component *poc_next;
- int code = 0;
- bool have_Default = false;
-
- for (i = 0; i < num_comp; i++) {
- if (components[i].type != ht_type_spot)
- return 1;
- else {
- gs_spot_halftone *spot = &components[i].params.spot;
- if (!spot->accurate_screens)
- return 1;
- }
- }
-
- pocs = gs_alloc_struct_array( pgs->memory,
+ gs_halftone_component *components = pht->params.multiple.components;
+ uint num_comp = pht->params.multiple.num_comp;
+ int i;
+ gx_ht_order_component *pocs;
+ gx_ht_order_component *poc_next;
+ int code = 0;
+ bool have_Default = false;
+
+ for (i = 0; i < num_comp; i++) {
+ if (components[i].type != ht_type_spot)
+ return 1;
+ else {
+ gs_spot_halftone *spot = &components[i].params.spot;
+ if (!spot->accurate_screens)
+ return 1;
+ }
+ }
+
+ pocs = gs_alloc_struct_array( pgs->memory,
num_comp,
gx_ht_order_component,
&st_ht_order_component_element,
"gs_sethalftone_try_wts" );
- /* pocs = malloc(num_comp * sizeof(gx_ht_order_component)); */
- poc_next = &pocs[1];
- for (i = 0; i < num_comp; i++) {
- gs_halftone_component *component = &components[i];
- gs_spot_halftone *spot = &component->params.spot;
- gs_screen_halftone *h = &spot->screen;
- gx_wts_cell_params_t *wcp;
- gs_wts_screen_enum_t *wse;
- gs_matrix imat;
- gx_ht_order_component *poc;
-
- if (component->comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
- if (have_Default) {
- /* Duplicate Default */
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- poc = pocs;
- have_Default = true;
- } else if (i == num_comp - 1 && !have_Default) {
- /* No Default */
- code = gs_note_error(gs_error_rangecheck);
- break;
- } else
- poc = poc_next++;
-
- gs_deviceinitialmatrix(gs_currentdevice(pgs), &imat);
-
- wcp = wts_pick_cell_size(h, &imat);
- wse = gs_wts_screen_enum_new(wcp);
-
- poc->corder.wse = wse;
- poc->corder.wts = NULL;
- poc->corder.procs = &wts_order_procs;
- poc->corder.data_memory = NULL;
- poc->corder.num_levels = 0;
- poc->corder.num_bits = 0;
- poc->corder.levels = NULL;
- poc->corder.bit_data = NULL;
- poc->corder.cache = NULL;
- poc->corder.transfer = NULL;
- poc->comp_number = component->comp_number;
- poc->cname = component->cname;
- code = process_transfer( &poc->corder,
+ /* pocs = malloc(num_comp * sizeof(gx_ht_order_component)); */
+ poc_next = &pocs[1];
+ for (i = 0; i < num_comp; i++) {
+ gs_halftone_component *component = &components[i];
+ gs_spot_halftone *spot = &component->params.spot;
+ gs_screen_halftone *h = &spot->screen;
+ gx_wts_cell_params_t *wcp;
+ gs_wts_screen_enum_t *wse;
+ gs_matrix imat;
+ gx_ht_order_component *poc;
+
+ if (component->comp_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ if (have_Default) {
+ /* Duplicate Default */
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ poc = pocs;
+ have_Default = true;
+ } else if (i == num_comp - 1 && !have_Default) {
+ /* No Default */
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ } else
+ poc = poc_next++;
+
+ gs_deviceinitialmatrix(gs_currentdevice(pgs), &imat);
+
+ wcp = wts_pick_cell_size(h, &imat);
+ wse = gs_wts_screen_enum_new(wcp);
+
+ poc->corder.wse = wse;
+ poc->corder.wts = NULL;
+ poc->corder.procs = &wts_order_procs;
+ poc->corder.data_memory = NULL;
+ poc->corder.num_levels = 0;
+ poc->corder.num_bits = 0;
+ poc->corder.levels = NULL;
+ poc->corder.bit_data = NULL;
+ poc->corder.cache = NULL;
+ poc->corder.transfer = NULL;
+ poc->comp_number = component->comp_number;
+ poc->cname = component->cname;
+ code = process_transfer( &poc->corder,
pgs,
spot->transfer,
&spot->transfer_closure,
pgs->memory );
- if (code < 0)
- break;
- }
- /* todo: cleanup on error */
- pdht->components = pocs;
- pdht->num_comp = num_comp;
- return code;
+ if (code < 0)
+ break;
+ }
+ /* todo: cleanup on error */
+ pdht->components = pocs;
+ pdht->num_comp = num_comp;
+ return code;
}
return 1;
}
diff --git a/gs/base/gsht1.h b/gs/base/gsht1.h
index e5ebb7058..c33619688 100644
--- a/gs/base/gsht1.h
+++ b/gs/base/gsht1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gshtscr.c b/gs/base/gshtscr.c
index d385d2d2c..47bbef120 100644
--- a/gs/base/gshtscr.c
+++ b/gs/base/gshtscr.c
@@ -182,7 +182,7 @@ gx_compute_cell_values(gx_ht_cell_params_t * phcp)
/* Forward references */
static int pick_cell_size(gs_screen_halftone * ph,
const gs_matrix * pmat, ulong max_size, uint min_levels, bool accurate,
- gx_ht_cell_params_t * phcp);
+ gx_ht_cell_params_t * phcp);
/* Allocate a screen enumerator. */
gs_screen_enum *
@@ -420,18 +420,18 @@ pick_cell_size(gs_screen_halftone * ph, const gs_matrix * pmat, ulong max_size,
{
/*
- * Compute the error in position between ideal location.
- * and the current integer location.
- */
-
- double error =
- (fn0 - p.N) * (fn0 - p.N) + (fm0 - p.M) * (fm0 - p.M);
- /*
- * Adjust the error by the length of the vector. This gives
- * a slight bias toward larger cell sizzes.
- */
- error /= p.N * p.N + p.M * p.M;
- error = sqrt(error); /* The previous calcs. gave value squared */
+ * Compute the error in position between ideal location.
+ * and the current integer location.
+ */
+
+ double error =
+ (fn0 - p.N) * (fn0 - p.N) + (fm0 - p.M) * (fm0 - p.M);
+ /*
+ * Adjust the error by the length of the vector. This gives
+ * a slight bias toward larger cell sizzes.
+ */
+ error /= p.N * p.N + p.M * p.M;
+ error = sqrt(error); /* The previous calcs. gave value squared */
if (error > e_best)
continue;
e_best = error;
@@ -493,44 +493,44 @@ gs_screen_enum_init_memory(gs_screen_enum * penum, const gx_ht_order * porder,
penum->x = penum->y = 0;
if (porder->wse == NULL) {
- penum->strip = porder->num_levels / porder->width;
- penum->shift = porder->shift;
- /*
- * We want a transformation matrix that maps the parallelogram
- * (0,0), (U,V), (U-V',V+U'), (-V',U') to the square (+/-1, +/-1).
- * If the coefficients are [a b c d e f] and we let
- * u = U = M/R, v = V = N/R,
- * r = -V' = -N'/R', s = U' = M'/R',
- * then we just need to solve the equations:
- * a*0 + c*0 + e = -1 b*0 + d*0 + f = -1
- * a*u + c*v + e = 1 b*u + d*v + f = 1
- * a*r + c*s + e = -1 b*r + d*s + f = 1
- * This has the following solution:
- * Q = 2 / (M*M' + N*N')
- * a = Q * R * M'
- * b = -Q * R' * N
- * c = Q * R * N'
- * d = Q * R' * M
- * e = -1
- * f = -1
- */
- {
- const int M = porder->params.M, N = porder->params.N, R = porder->params.R;
- const int M1 = porder->params.M1, N1 = porder->params.N1, R1 = porder->params.R1;
- double Q = 2.0 / ((long)M * M1 + (long)N * N1);
-
- penum->mat.xx = Q * (R * M1);
- penum->mat.xy = Q * (-R1 * N);
- penum->mat.yx = Q * (R * N1);
- penum->mat.yy = Q * (R1 * M);
- penum->mat.tx = -1.0;
- penum->mat.ty = -1.0;
- gs_matrix_invert(&penum->mat, &penum->mat_inv);
- }
- if_debug7('h', "[h]Screen: (%dx%d)/%d [%f %f %f %f]\n",
- porder->width, porder->height, porder->params.R,
- penum->mat.xx, penum->mat.xy,
- penum->mat.yx, penum->mat.yy);
+ penum->strip = porder->num_levels / porder->width;
+ penum->shift = porder->shift;
+ /*
+ * We want a transformation matrix that maps the parallelogram
+ * (0,0), (U,V), (U-V',V+U'), (-V',U') to the square (+/-1, +/-1).
+ * If the coefficients are [a b c d e f] and we let
+ * u = U = M/R, v = V = N/R,
+ * r = -V' = -N'/R', s = U' = M'/R',
+ * then we just need to solve the equations:
+ * a*0 + c*0 + e = -1 b*0 + d*0 + f = -1
+ * a*u + c*v + e = 1 b*u + d*v + f = 1
+ * a*r + c*s + e = -1 b*r + d*s + f = 1
+ * This has the following solution:
+ * Q = 2 / (M*M' + N*N')
+ * a = Q * R * M'
+ * b = -Q * R' * N
+ * c = Q * R * N'
+ * d = Q * R' * M
+ * e = -1
+ * f = -1
+ */
+ {
+ const int M = porder->params.M, N = porder->params.N, R = porder->params.R;
+ const int M1 = porder->params.M1, N1 = porder->params.N1, R1 = porder->params.R1;
+ double Q = 2.0 / ((long)M * M1 + (long)N * N1);
+
+ penum->mat.xx = Q * (R * M1);
+ penum->mat.xy = Q * (-R1 * N);
+ penum->mat.yx = Q * (R * N1);
+ penum->mat.yy = Q * (R1 * M);
+ penum->mat.tx = -1.0;
+ penum->mat.ty = -1.0;
+ gs_matrix_invert(&penum->mat, &penum->mat_inv);
+ }
+ if_debug7('h', "[h]Screen: (%dx%d)/%d [%f %f %f %f]\n",
+ porder->width, porder->height, porder->params.R,
+ penum->mat.xx, penum->mat.xy,
+ penum->mat.yx, penum->mat.yy);
}
return 0;
}
@@ -545,9 +545,9 @@ gs_screen_currentpoint(gs_screen_enum * penum, gs_point * ppt)
gs_point spot_center; /* device coords */
if (penum->order.wse) {
- int code;
- code = gs_wts_screen_enum_currentpoint(penum->order.wse, ppt);
- return code;
+ int code;
+ code = gs_wts_screen_enum_currentpoint(penum->order.wse, ppt);
+ return code;
}
if (penum->y >= penum->strip) { /* all done */
@@ -595,28 +595,28 @@ int
gs_screen_next(gs_screen_enum * penum, floatp value)
{
if (penum->order.wse) {
- return gs_wts_screen_enum_next (penum->order.wse, value);
+ return gs_wts_screen_enum_next (penum->order.wse, value);
} else {
- ht_sample_t sample;
- int width = penum->order.width;
- gx_ht_bit *bits = (gx_ht_bit *)penum->order.bit_data;
+ ht_sample_t sample;
+ int width = penum->order.width;
+ gx_ht_bit *bits = (gx_ht_bit *)penum->order.bit_data;
- if (value < -1.0 || value > 1.0)
- return_error(gs_error_rangecheck);
- sample = (ht_sample_t) ((value + 1) * max_ht_sample);
+ if (value < -1.0 || value > 1.0)
+ return_error(gs_error_rangecheck);
+ sample = (ht_sample_t) ((value + 1) * max_ht_sample);
#ifdef DEBUG
- if (gs_debug_c('H')) {
- gs_point pt;
+ if (gs_debug_c('H')) {
+ gs_point pt;
- gs_screen_currentpoint(penum, &pt);
- dlprintf6("[H]sample x=%d y=%d (%f,%f): %f -> %u\n",
- penum->x, penum->y, pt.x, pt.y, value, sample);
- }
+ gs_screen_currentpoint(penum, &pt);
+ dlprintf6("[H]sample x=%d y=%d (%f,%f): %f -> %u\n",
+ penum->x, penum->y, pt.x, pt.y, value, sample);
+ }
#endif
- bits[penum->y * width + penum->x].mask = sample;
- if (++(penum->x) >= width)
- penum->x = 0, ++(penum->y);
- return 0;
+ bits[penum->y * width + penum->x].mask = sample;
+ if (++(penum->x) >= width)
+ penum->x = 0, ++(penum->y);
+ return 0;
}
}
diff --git a/gs/base/gshtx.c b/gs/base/gshtx.c
index ae767c2cc..0199bb2e9 100644
--- a/gs/base/gshtx.c
+++ b/gs/base/gshtx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,9 +28,9 @@
*/
static void
free_comps(
- gs_memory_t * pmem,
- void *pvht,
- client_name_t cname
+ gs_memory_t * pmem,
+ void *pvht,
+ client_name_t cname
)
{
gs_ht *pht = (gs_ht *) pvht;
@@ -45,23 +45,22 @@ free_comps(
*/
static float
null_closure_transfer(
- floatp val,
- const gx_transfer_map * pmap_dummy, /* NOTUSED */
- const void *dummy /* NOTUSED */
+ floatp val,
+ const gx_transfer_map * pmap_dummy, /* NOTUSED */
+ const void *dummy /* NOTUSED */
)
{
return val;
}
-
/*
* Build a gs_ht halftone structure.
*/
int
gs_ht_build(
- gs_ht ** ppht,
- uint num_comps,
- gs_memory_t * pmem
+ gs_ht ** ppht,
+ uint num_comps,
+ gs_memory_t * pmem
)
{
gs_ht *pht;
@@ -71,25 +70,25 @@ gs_ht_build(
/* must have at least one component */
*ppht = 0;
if (num_comps == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* allocate the halftone and the array of components */
rc_alloc_struct_1(pht,
- gs_ht,
- &st_gs_ht,
- pmem,
- return_error(gs_error_VMerror),
- "gs_ht_build"
- );
+ gs_ht,
+ &st_gs_ht,
+ pmem,
+ return_error(gs_error_VMerror),
+ "gs_ht_build"
+ );
phtc = gs_alloc_struct_array(pmem,
- num_comps,
- gs_ht_component,
- &st_ht_comp_element,
- "gs_ht_build"
- );
+ num_comps,
+ gs_ht_component,
+ &st_ht_comp_element,
+ "gs_ht_build"
+ );
if (phtc == 0) {
- gs_free_object(pmem, pht, "gs_ht_build");
- return_error(gs_error_VMerror);
+ gs_free_object(pmem, pht, "gs_ht_build");
+ return_error(gs_error_VMerror);
}
/* initialize the halftone */
pht->type = ht_type_multiple;
@@ -99,8 +98,8 @@ gs_ht_build(
for (i = 0; i < num_comps; i++) {
phtc[i].comp_number = i;
- phtc[i].cname = 0;
- phtc[i].type = ht_type_none;
+ phtc[i].cname = 0;
+ phtc[i].type = ht_type_none;
}
*ppht = pht;
@@ -113,22 +112,22 @@ gs_ht_build(
*/
int
gs_ht_set_spot_comp(
- gs_ht * pht,
- int comp,
- floatp freq,
- floatp angle,
- float (*spot_func) (floatp, floatp),
- bool accurate,
- gs_ht_transfer_proc transfer,
- const void *client_data
+ gs_ht * pht,
+ int comp,
+ floatp freq,
+ floatp angle,
+ float (*spot_func) (floatp, floatp),
+ bool accurate,
+ gs_ht_transfer_proc transfer,
+ const void *client_data
)
{
gs_ht_component *phtc = &(pht->params.ht_multiple.components[comp]);
if (comp >= pht->params.ht_multiple.num_comp)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (phtc->type != ht_type_none)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
phtc->type = ht_type_spot;
phtc->params.ht_spot.screen.frequency = freq;
@@ -138,7 +137,7 @@ gs_ht_set_spot_comp(
phtc->params.ht_spot.transfer = gs_mapped_transfer;
phtc->params.ht_spot.transfer_closure.proc =
- (transfer == 0 ? null_closure_transfer : transfer);
+ (transfer == 0 ? null_closure_transfer : transfer);
phtc->params.ht_spot.transfer_closure.data = client_data;
return 0;
@@ -150,21 +149,21 @@ gs_ht_set_spot_comp(
*/
int
gs_ht_set_threshold_comp(
- gs_ht * pht,
- int comp,
- int width,
- int height,
- const gs_const_string * thresholds,
- gs_ht_transfer_proc transfer,
- const void *client_data
+ gs_ht * pht,
+ int comp,
+ int width,
+ int height,
+ const gs_const_string * thresholds,
+ gs_ht_transfer_proc transfer,
+ const void *client_data
)
{
gs_ht_component *phtc = &(pht->params.ht_multiple.components[comp]);
if (comp >= pht->params.ht_multiple.num_comp)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (phtc->type != ht_type_none)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
phtc->type = ht_type_threshold;
phtc->params.ht_threshold.width = width;
@@ -173,7 +172,7 @@ gs_ht_set_threshold_comp(
phtc->params.ht_threshold.transfer = gs_mapped_transfer;
phtc->params.ht_threshold.transfer_closure.proc =
- (transfer == 0 ? null_closure_transfer : transfer);
+ (transfer == 0 ? null_closure_transfer : transfer);
phtc->params.ht_threshold.transfer_closure.data = client_data;
return 0;
@@ -184,7 +183,7 @@ gs_ht_set_threshold_comp(
*/
void
gs_ht_reference(
- gs_ht * pht
+ gs_ht * pht
)
{
rc_increment(pht);
@@ -196,30 +195,29 @@ gs_ht_reference(
*/
void
gs_ht_release(
- gs_ht * pht
+ gs_ht * pht
)
{
rc_decrement_only(pht, "gs_ht_release");
}
-
/*
* Verify that a gs_ht halftone is legitimate.
*/
static int
check_ht(
- gs_ht * pht
+ gs_ht * pht
)
{
int i;
int num_comps = pht->params.ht_multiple.num_comp;
if (pht->type != ht_type_multiple)
- return_error(gs_error_unregistered);
+ return_error(gs_error_unregistered);
for (i = 0; i < num_comps; i++) {
- gs_ht_component *phtc = &(pht->params.ht_multiple.components[i]);
- if ((phtc->type != ht_type_spot) && (phtc->type != ht_type_threshold))
- return_error(gs_error_unregistered);
+ gs_ht_component *phtc = &(pht->params.ht_multiple.components[i]);
+ if ((phtc->type != ht_type_spot) && (phtc->type != ht_type_threshold))
+ return_error(gs_error_unregistered);
}
return 0;
}
@@ -229,8 +227,8 @@ check_ht(
*/
static void
build_transfer_map(
- gs_ht_component * phtc,
- gx_transfer_map * pmap
+ gs_ht_component * phtc,
+ gx_transfer_map * pmap
)
{
gs_ht_transfer_proc proc;
@@ -239,20 +237,20 @@ build_transfer_map(
frac *values = pmap->values;
if (phtc->type == ht_type_spot) {
- proc = phtc->params.ht_spot.transfer_closure.proc;
- client_info = phtc->params.ht_spot.transfer_closure.data;
+ proc = phtc->params.ht_spot.transfer_closure.proc;
+ client_info = phtc->params.ht_spot.transfer_closure.data;
} else {
- proc = phtc->params.ht_threshold.transfer_closure.proc;
- client_info = phtc->params.ht_threshold.transfer_closure.data;
+ proc = phtc->params.ht_threshold.transfer_closure.proc;
+ client_info = phtc->params.ht_threshold.transfer_closure.data;
}
for (i = 0; i < transfer_map_size; i++) {
- float fval =
- proc(i * (1 / (double)(transfer_map_size - 1)), pmap, client_info);
+ float fval =
+ proc(i * (1 / (double)(transfer_map_size - 1)), pmap, client_info);
- values[i] =
- (fval <= 0.0 ? frac_0 : fval >= 1.0 ? frac_1 :
- float2frac(fval));
+ values[i] =
+ (fval <= 0.0 ? frac_0 : fval >= 1.0 ? frac_1 :
+ float2frac(fval));
}
}
@@ -263,51 +261,51 @@ build_transfer_map(
*/
static gx_ht_order_component *
alloc_ht_order(
- const gs_ht * pht,
- gs_memory_t * pmem,
- byte * comp2order
+ const gs_ht * pht,
+ gs_memory_t * pmem,
+ byte * comp2order
)
{
int num_comps = pht->params.ht_multiple.num_comp;
gx_ht_order_component *pocs = gs_alloc_struct_array(
- pmem,
- pht->params.ht_multiple.num_comp,
- gx_ht_order_component,
- &st_ht_order_component_element,
- "alloc_ht_order"
+ pmem,
+ pht->params.ht_multiple.num_comp,
+ gx_ht_order_component,
+ &st_ht_order_component_element,
+ "alloc_ht_order"
);
int inext = 0;
int i;
if (pocs == 0)
- return 0;
+ return 0;
pocs->corder.transfer = 0;
for (i = 0; i < num_comps; i++) {
- gs_ht_component *phtc = &(pht->params.ht_multiple.components[i]);
- gx_transfer_map *pmap = gs_alloc_struct(pmem,
- gx_transfer_map,
- &st_transfer_map,
- "alloc_ht_order"
- );
-
- if (pmap == 0) {
- int j;
-
- for (j = 0; j < inext; j++)
- gs_free_object(pmem, pocs[j].corder.transfer, "alloc_ht_order");
- gs_free_object(pmem, pocs, "alloc_ht_order");
- return 0;
- }
- pmap->proc = gs_mapped_transfer;
- pmap->id = gs_next_ids(pmem, 1);
- pocs[inext].corder.levels = 0;
- pocs[inext].corder.bit_data = 0;
- pocs[inext].corder.cache = 0;
- pocs[inext].corder.transfer = pmap;
- pocs[inext].cname = phtc->cname;
+ gs_ht_component *phtc = &(pht->params.ht_multiple.components[i]);
+ gx_transfer_map *pmap = gs_alloc_struct(pmem,
+ gx_transfer_map,
+ &st_transfer_map,
+ "alloc_ht_order"
+ );
+
+ if (pmap == 0) {
+ int j;
+
+ for (j = 0; j < inext; j++)
+ gs_free_object(pmem, pocs[j].corder.transfer, "alloc_ht_order");
+ gs_free_object(pmem, pocs, "alloc_ht_order");
+ return 0;
+ }
+ pmap->proc = gs_mapped_transfer;
+ pmap->id = gs_next_ids(pmem, 1);
+ pocs[inext].corder.levels = 0;
+ pocs[inext].corder.bit_data = 0;
+ pocs[inext].corder.cache = 0;
+ pocs[inext].corder.transfer = pmap;
+ pocs[inext].cname = phtc->cname;
pocs[inext].comp_number = phtc->comp_number;
- comp2order[i] = inext++;
+ comp2order[i] = inext++;
}
return pocs;
@@ -318,56 +316,56 @@ alloc_ht_order(
*/
static int
build_component(
- gs_ht_component * phtc,
- gx_ht_order * porder,
- gs_state * pgs,
- gs_memory_t * pmem
+ gs_ht_component * phtc,
+ gx_ht_order * porder,
+ gs_state * pgs,
+ gs_memory_t * pmem
)
{
if (phtc->type == ht_type_spot) {
- gs_screen_enum senum;
- int code;
-
- code = gx_ht_process_screen_memory(&senum,
- pgs,
- &phtc->params.ht_spot.screen,
- phtc->params.ht_spot.accurate_screens,
- pmem
- );
- if (code < 0)
- return code;
-
- /* avoid wiping out the transfer structure pointer */
- senum.order.transfer = porder->transfer;
- *porder = senum.order;
+ gs_screen_enum senum;
+ int code;
+
+ code = gx_ht_process_screen_memory(&senum,
+ pgs,
+ &phtc->params.ht_spot.screen,
+ phtc->params.ht_spot.accurate_screens,
+ pmem
+ );
+ if (code < 0)
+ return code;
+
+ /* avoid wiping out the transfer structure pointer */
+ senum.order.transfer = porder->transfer;
+ *porder = senum.order;
} else { /* ht_type_threshold */
- int code;
- gx_transfer_map *transfer = porder->transfer;
-
- porder->params.M = phtc->params.ht_threshold.width;
- porder->params.N = 0;
- porder->params.R = 1;
- porder->params.M1 = phtc->params.ht_threshold.height;
- porder->params.N1 = 0;
- porder->params.R1 = 1;
- code = gx_ht_alloc_threshold_order(porder,
- phtc->params.ht_threshold.width,
- phtc->params.ht_threshold.height,
- 256,
- pmem
- );
- if (code < 0)
- return code;
- gx_ht_construct_threshold_order(
- porder,
- phtc->params.ht_threshold.thresholds.data
- );
- /*
- * gx_ht_construct_threshold_order wipes out transfer map pointer,
- * restore it here.
- */
- porder->transfer = transfer;
+ int code;
+ gx_transfer_map *transfer = porder->transfer;
+
+ porder->params.M = phtc->params.ht_threshold.width;
+ porder->params.N = 0;
+ porder->params.R = 1;
+ porder->params.M1 = phtc->params.ht_threshold.height;
+ porder->params.N1 = 0;
+ porder->params.R1 = 1;
+ code = gx_ht_alloc_threshold_order(porder,
+ phtc->params.ht_threshold.width,
+ phtc->params.ht_threshold.height,
+ 256,
+ pmem
+ );
+ if (code < 0)
+ return code;
+ gx_ht_construct_threshold_order(
+ porder,
+ phtc->params.ht_threshold.thresholds.data
+ );
+ /*
+ * gx_ht_construct_threshold_order wipes out transfer map pointer,
+ * restore it here.
+ */
+ porder->transfer = transfer;
}
build_transfer_map(phtc, porder->transfer);
@@ -379,26 +377,25 @@ build_component(
*/
static void
free_order_array(
- gx_ht_order_component * pocs,
- int num_comps,
- gs_memory_t * pmem
+ gx_ht_order_component * pocs,
+ int num_comps,
+ gs_memory_t * pmem
)
{
int i;
for (i = 0; i < num_comps; i++)
- gx_ht_order_release(&(pocs[i].corder), pmem, true);
+ gx_ht_order_release(&(pocs[i].corder), pmem, true);
gs_free_object(pmem, pocs, "gs_ht_install");
}
-
/*
* Install a gs_ht halftone as the current halftone in the graphic state.
*/
int
gs_ht_install(
- gs_state * pgs,
- gs_ht * pht
+ gs_state * pgs,
+ gs_ht * pht
)
{
int code = 0;
@@ -411,57 +408,57 @@ gs_ht_install(
/* perform so sanity checks (must have one default component) */
if ((code = check_ht(pht)) != 0)
- return code;
+ return code;
/* allocate the halftone order structure and transfer maps */
if ((pocs = alloc_ht_order(pht, pmem, comp2order)) == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* build all of the order for each component */
for (i = 0; i < num_comps; i++) {
- int j = comp2order[i];
-
- code = build_component(&(pht->params.ht_multiple.components[i]),
- &(pocs[j].corder),
- pgs,
- pmem
- );
-
- if ((code >= 0) && (j != 0)) {
- gx_ht_cache *pcache;
-
- pcache = gx_ht_alloc_cache(pmem,
- 4,
- pocs[j].corder.raster *
- (pocs[j].corder.num_bits /
- pocs[j].corder.width) * 4
- );
-
- if (pcache == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- pocs[j].corder.cache = pcache;
- gx_ht_init_cache(pmem, pcache, &(pocs[j].corder));
- }
- }
- if (code < 0)
- break;
+ int j = comp2order[i];
+
+ code = build_component(&(pht->params.ht_multiple.components[i]),
+ &(pocs[j].corder),
+ pgs,
+ pmem
+ );
+
+ if ((code >= 0) && (j != 0)) {
+ gx_ht_cache *pcache;
+
+ pcache = gx_ht_alloc_cache(pmem,
+ 4,
+ pocs[j].corder.raster *
+ (pocs[j].corder.num_bits /
+ pocs[j].corder.width) * 4
+ );
+
+ if (pcache == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ pocs[j].corder.cache = pcache;
+ gx_ht_init_cache(pmem, pcache, &(pocs[j].corder));
+ }
+ }
+ if (code < 0)
+ break;
}
if (code < 0) {
- free_order_array(pocs, num_comps, pmem);
- return code;
+ free_order_array(pocs, num_comps, pmem);
+ return code;
}
/* initialize the device halftone structure */
dev_ht.rc.memory = pmem;
dev_ht.order = pocs[0].corder; /* Default */
if (num_comps == 1) {
- /* we have only a Default; we don't need components. */
- gs_free_object(pmem, pocs, "gs_ht_install");
- dev_ht.components = 0;
+ /* we have only a Default; we don't need components. */
+ gs_free_object(pmem, pocs, "gs_ht_install");
+ dev_ht.components = 0;
} else {
- dev_ht.components = pocs;
- dev_ht.num_comp = num_comps;
+ dev_ht.components = pocs;
+ dev_ht.num_comp = num_comps;
}
/* at last, actually install the halftone in the graphic state */
@@ -479,7 +476,7 @@ gs_ht_install(
*/
static int
create_mask_bits(const byte * mask1, const byte * mask2,
- int width, int height, gx_ht_bit * bits)
+ int width, int height, gx_ht_bit * bits)
{
/*
* We do this with the slowest, simplest possible algorithm....
@@ -489,22 +486,22 @@ create_mask_bits(const byte * mask1, const byte * mask2,
int count = 0;
for (y = 0; y < height; ++y)
- for (x = 0; x < width; ++x) {
- int offset = y * width_bytes + (x >> 3);
- byte bit_mask = 0x80 >> (x & 7);
-
- if ((mask1[offset] ^ mask2[offset]) & bit_mask) {
- if (bits)
- gx_ht_construct_bit(&bits[count], width, y * width + x);
- ++count;
- }
- }
+ for (x = 0; x < width; ++x) {
+ int offset = y * width_bytes + (x >> 3);
+ byte bit_mask = 0x80 >> (x & 7);
+
+ if ((mask1[offset] ^ mask2[offset]) & bit_mask) {
+ if (bits)
+ gx_ht_construct_bit(&bits[count], width, y * width + x);
+ ++count;
+ }
+ }
return count;
}
static int
create_mask_order(gx_ht_order * porder, gs_state * pgs,
- const gs_client_order_halftone * phcop,
- gs_memory_t * mem)
+ const gs_client_order_halftone * phcop,
+ gs_memory_t * mem)
{
int width_bytes = (phcop->width + 7) >> 3;
const byte *masks = (const byte *)phcop->client_data;
@@ -517,25 +514,25 @@ create_mask_order(gx_ht_order * porder, gs_state * pgs,
/* Do a first pass to compute how many bits entries will be needed. */
for (prev_mask = masks, num_bits = 0, i = 0;
- i < num_levels - 1;
- ++i, prev_mask += bytes_per_mask
- )
- num_bits += create_mask_bits(prev_mask, prev_mask + bytes_per_mask,
- phcop->width, phcop->height, NULL);
+ i < num_levels - 1;
+ ++i, prev_mask += bytes_per_mask
+ )
+ num_bits += create_mask_bits(prev_mask, prev_mask + bytes_per_mask,
+ phcop->width, phcop->height, NULL);
code = gx_ht_alloc_client_order(porder, phcop->width, phcop->height,
- num_levels, num_bits, mem);
+ num_levels, num_bits, mem);
if (code < 0)
- return code;
+ return code;
/* Fill in the bits and levels entries. */
for (prev_mask = masks, num_bits = 0, i = 0;
- i < num_levels - 1;
- ++i, prev_mask += bytes_per_mask
- ) {
- porder->levels[i] = num_bits;
- num_bits += create_mask_bits(prev_mask, prev_mask + bytes_per_mask,
- phcop->width, phcop->height,
- ((gx_ht_bit *)porder->bit_data) +
- num_bits);
+ i < num_levels - 1;
+ ++i, prev_mask += bytes_per_mask
+ ) {
+ porder->levels[i] = num_bits;
+ num_bits += create_mask_bits(prev_mask, prev_mask + bytes_per_mask,
+ phcop->width, phcop->height,
+ ((gx_ht_bit *)porder->bit_data) +
+ num_bits);
}
porder->levels[num_levels - 1] = num_bits;
return 0;
@@ -554,19 +551,19 @@ static const gs_client_order_ht_procs_t mask_order_procs =
*/
int
gs_ht_set_mask_comp(gs_ht * pht,
- int component_index,
- int width, int height, int num_levels,
- const byte * masks, /* width x height x num_levels bits */
- gs_ht_transfer_proc transfer,
- const void *client_data)
+ int component_index,
+ int width, int height, int num_levels,
+ const byte * masks, /* width x height x num_levels bits */
+ gs_ht_transfer_proc transfer,
+ const void *client_data)
{
gs_ht_component *phtc =
&(pht->params.ht_multiple.components[component_index]);
if (component_index >= pht->params.ht_multiple.num_comp)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (phtc->type != ht_type_none)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
phtc->type = ht_type_client_order;
phtc->params.client_order.width = width;
@@ -575,7 +572,7 @@ gs_ht_set_mask_comp(gs_ht * pht,
phtc->params.client_order.procs = &mask_order_procs;
phtc->params.client_order.client_data = masks;
phtc->params.client_order.transfer_closure.proc =
- (transfer == 0 ? null_closure_transfer : transfer);
+ (transfer == 0 ? null_closure_transfer : transfer);
phtc->params.client_order.transfer_closure.data = client_data;
return 0;
diff --git a/gs/base/gshtx.h b/gs/base/gshtx.h
index ab5db52aa..4ac902a99 100644
--- a/gs/base/gshtx.h
+++ b/gs/base/gshtx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,7 +24,7 @@
/*
* The stand-alone halftone structures are opaque, and are placed in an opaque
- * graphic state.
+ * graphic state.
*/
/* Alias type names */
@@ -78,32 +78,32 @@ typedef gs_mapping_closure_proc_t gs_ht_transfer_proc; /* see gxtmap.h */
* Individual component halftones of a gs_ht structure must always be
* provided with transfer functions.
*
- * Releasing the gs_ht structure will NOT release the client data
+ * Releasing the gs_ht structure will NOT release the client data
* (the client must do that directly).
*/
extern int gs_ht_build(gs_ht ** ppht, uint num_comps, gs_memory_t * pmem);
extern int gs_ht_set_spot_comp(
- gs_ht * pht,
- int component_index,
- floatp freq,
- floatp angle,
- float (*spot_func) (floatp, floatp),
- bool accurate,
- gs_ht_transfer_proc transfer,
- const void *client_data
- );
+ gs_ht * pht,
+ int component_index,
+ floatp freq,
+ floatp angle,
+ float (*spot_func) (floatp, floatp),
+ bool accurate,
+ gs_ht_transfer_proc transfer,
+ const void *client_data
+ );
extern int gs_ht_set_threshold_comp(
- gs_ht * pht,
- int component_index,
- int width,
- int height,
- const gs_const_string * thresholds,
- gs_ht_transfer_proc transfer,
- const void *client_data
- );
+ gs_ht * pht,
+ int component_index,
+ int width,
+ int height,
+ const gs_const_string * thresholds,
+ gs_ht_transfer_proc transfer,
+ const void *client_data
+ );
/*
* This procedure specifies a (possibly non-monotonic) halftone of size
@@ -115,15 +115,15 @@ extern int gs_ht_set_threshold_comp(
* Note that the client is responsible for releasing the mask data.
*/
extern int gs_ht_set_mask_comp(
- gs_ht * pht,
- int component_index,
- int width,
- int height,
- int num_levels,
- const byte * masks, /* width x height x num_levels */
- gs_ht_transfer_proc transfer,
- const void *client_data
- );
+ gs_ht * pht,
+ int component_index,
+ int width,
+ int height,
+ int num_levels,
+ const byte * masks, /* width x height x num_levels */
+ gs_ht_transfer_proc transfer,
+ const void *client_data
+ );
extern void gs_ht_reference(gs_ht * pht);
extern void gs_ht_release(gs_ht * pht);
diff --git a/gs/base/gsicc.c b/gs/base/gsicc.c
index 8d56f6e13..62d6028d5 100644
--- a/gs/base/gsicc.c
+++ b/gs/base/gsicc.c
@@ -50,7 +50,7 @@ cie_icc_finalize(void * pvicc_info)
they always provide a mapping to a specified destination
profile. As such they will have their own remap functions.
These will simply potentially implement the transfer function,
- apply any alpha value, and or end up going through halftoning.
+ apply any alpha value, and or end up going through halftoning.
There will not be any heuristic remap of rgb to gray etc */
static cs_proc_num_components(gx_num_components_ICC);
@@ -85,11 +85,9 @@ const gs_color_space_type gs_color_space_type_ICC = {
gx_cspace_is_linear_ICC
};
-
-
static inline void
gsicc_remap_fast(unsigned short *psrc, unsigned short *psrc_cm,
- gsicc_link_t *icc_link)
+ gsicc_link_t *icc_link)
{
gscms_transform_color(icc_link, psrc, psrc_cm, 2, NULL);
}
@@ -97,9 +95,9 @@ gsicc_remap_fast(unsigned short *psrc, unsigned short *psrc_cm,
/* ICC color mapping linearity check, a 2-points case. Check only the 1/2 point */
static int
gx_icc_is_linear_in_line(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- float smoothness, gsicc_link_t *icclink)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ float smoothness, gsicc_link_t *icclink)
{
int nsrc = cs->type->num_components(cs);
int ndes = dev->color_info.num_components;
@@ -135,9 +133,9 @@ gx_icc_is_linear_in_line(const gs_color_space *cs, const gs_imager_state * pis,
/* Default icc color mapping linearity check, a triangle case. */
static int
gx_icc_is_linear_in_triangle(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- const gs_client_color *c2, float smoothness, gsicc_link_t *icclink)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ const gs_client_color *c2, float smoothness, gsicc_link_t *icclink)
{
/* Check 4 points middle points of 3 sides and middle of one side with
other point. We avoid divisions this way. */
@@ -167,9 +165,9 @@ gx_icc_is_linear_in_triangle(const gs_color_space *cs, const gs_imager_state * p
src1[k] = (unsigned short) (c1->paint.values[k]*65535);
src2[k] = (unsigned short) (c2->paint.values[k]*65535);
src01[k] = (src0[k] + src1[k]) >> 1;
- src02[k] = (src0[k] + src2[k]) >> 1;
+ src02[k] = (src0[k] + src2[k]) >> 1;
src12[k] = (src1[k] + src2[k]) >> 1;
- src012[k] = (src12[k] + src0[k]) >> 1;
+ src012[k] = (src12[k] + src0[k]) >> 1;
}
/* Map the points */
gsicc_remap_fast(&(src0[0]), &(des0[0]), icclink);
@@ -201,31 +199,31 @@ gx_icc_is_linear_in_triangle(const gs_color_space *cs, const gs_imager_state * p
/* ICC color mapping linearity check. */
int
gx_cspace_is_linear_ICC(const gs_color_space *cs, const gs_imager_state * pis,
- gx_device *dev,
- const gs_client_color *c0, const gs_client_color *c1,
- const gs_client_color *c2, const gs_client_color *c3,
- float smoothness, gsicc_link_t *icclink)
+ gx_device *dev,
+ const gs_client_color *c0, const gs_client_color *c1,
+ const gs_client_color *c2, const gs_client_color *c3,
+ float smoothness, gsicc_link_t *icclink)
{
/* Assuming 2 <= nc <= 4. We don't need other cases. */
/* With nc == 4 assuming a convex plain quadrangle in the client color space. */
int code;
-
+
/* Do a quick check if we are in a halftone situation. If yes,
then we should not be doing this linear check */
if (gx_device_must_halftone(dev)) return 0;
if (icclink->is_identity) return 1; /* Transform is identity, linear! */
if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (c2 == NULL)
- return gx_icc_is_linear_in_line(cs, pis, dev, c0, c1, smoothness, icclink);
- code = gx_icc_is_linear_in_triangle(cs, pis, dev, c0, c1, c2,
+ return gx_icc_is_linear_in_line(cs, pis, dev, c0, c1, smoothness, icclink);
+ code = gx_icc_is_linear_in_triangle(cs, pis, dev, c0, c1, c2,
smoothness, icclink);
if (code <= 0)
- return code;
+ return code;
if (c3 == NULL)
- return 1;
- return gx_icc_is_linear_in_triangle(cs, pis, dev, c1, c2, c3,
+ return 1;
+ return gx_icc_is_linear_in_triangle(cs, pis, dev, c1, c2, c3,
smoothness, icclink);
}
/*
@@ -247,7 +245,7 @@ gx_init_ICC(gs_client_color * pcc, const gs_color_space * pcs)
int i, ncomps = pcs->cmm_icc_profile_data->num_comps;
for (i = 0; i < ncomps; ++i)
- pcc->paint.values[i] = 0.0;
+ pcc->paint.values[i] = 0.0;
/* make sure that [ 0, ... 0] is in range */
gx_restrict_ICC(pcc, pcs);
@@ -273,22 +271,22 @@ gx_restrict_ICC(gs_client_color * pcc, const gs_color_space * pcs)
}
}
-/* If the color is already concretized, then we are in the color space
+/* If the color is already concretized, then we are in the color space
defined by the device profile. The remaining things to do would
be to potentially apply alpha, apply the transfer function, and
do any halftoning. The remap is based upon the ICC profile defined
in the device profile entry of the profile manager. */
int
gx_remap_concrete_ICC(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
const cmm_profile_t *icc_profile = dev->device_icc_profile;
int num_colorants = icc_profile->num_comps;
int code;
switch( num_colorants ) {
- case 1:
+ case 1:
code = gx_remap_concrete_DGray(pconc, pcs, pdc, pis, dev, select);
break;
case 3:
@@ -311,8 +309,8 @@ gx_remap_concrete_ICC(const frac * pconc, const gs_color_space * pcs,
*/
int
gx_remap_ICC(const gs_client_color * pcc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
gsicc_link_t *icc_link;
gsicc_rendering_param_t rendering_params;
@@ -381,7 +379,7 @@ gx_remap_ICC(const gs_client_color * pcc, const gs_color_space * pcs,
/* Save original color space and color info into dev color */
i = pcs->cmm_icc_profile_data->num_comps;
for (i--; i >= 0; i--)
- pdc->ccolor.paint.values[i] = pcc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pcc->paint.values[i];
pdc->ccolor_valid = true;
return 0;
}
@@ -410,7 +408,7 @@ gx_concretize_ICC(
rendering_params.rendering_intent = pis->renderingintent;
for (k = 0; k < pcs->cmm_icc_profile_data->num_comps; k++){
psrc[k] = (unsigned short) (pcc->paint.values[k]*65535.0);
- }
+ }
/* Get a link from the cache, or create if it is not there. Get 16 bit profile */
icc_link = gsicc_get_link(pis, dev, pcs, NULL, &rendering_params, pis->memory, false);
/* Transform the color */
@@ -430,13 +428,13 @@ gx_concretize_ICC(
return 0;
}
- /*
+ /*
* Finalize the contents of an ICC color space. Now that color space
* objects have straightforward reference counting discipline, there's
* nothing special about it. In the previous state of affairs, the
* argument in favor of correct reference counting spoke of "an
* unintuitive but otherwise legitimate state of affairs".
- */
+ */
static void
gx_final_ICC(const gs_color_space * pcs)
{
@@ -456,7 +454,7 @@ static int
gx_install_ICC(gs_color_space * pcs, gs_state * pgs)
{
/* update the stub information used by the joint caches */
- return 0;
+ return 0;
}
/*
@@ -485,7 +483,7 @@ gx_serialize_ICC(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
+ return code;
profile__serial = (gsicc_serialized_profile_t*) pcs->cmm_icc_profile_data;
code = sputs(s, (byte *)profile__serial, sizeof(gsicc_serialized_profile_t), &n);
return(code);
@@ -508,4 +506,3 @@ gx_set_overprint_ICC(const gs_color_space * pcs, gs_state * pgs)
return gx_set_overprint_cmyk(pcs, pgs);
}
-
diff --git a/gs/base/gsicc.h b/gs/base/gsicc.h
index ef51f233b..c8f75ff74 100644
--- a/gs/base/gsicc.h
+++ b/gs/base/gsicc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,14 +19,14 @@
# define gsicc_INCLUDED
#include "gscie.h"
-#include "gxcspace.h"
+#include "gxcspace.h"
/*
* Build an ICCBased color space.
*
*/
extern int gs_cspace_build_ICC( gs_color_space ** ppcspace,
- void * client_data,
- gs_memory_t * pmem );
+ void * client_data,
+ gs_memory_t * pmem );
extern const gs_color_space_type gs_color_space_type_ICC;
diff --git a/gs/base/gsicc_cache.c b/gs/base/gsicc_cache.c
index 8ed68fd69..f0816f5c2 100644
--- a/gs/base/gsicc_cache.c
+++ b/gs/base/gsicc_cache.c
@@ -31,7 +31,7 @@
#include "gxsync.h"
#include "gzstate.h"
/*
- * Note that the the external memory used to maintain
+ * Note that the the external memory used to maintain
* links in the CMS is generally not visible to GS.
* For most CMS's the links are 33x33x33x33x4 bytes at worst
* for a CMYK to CMYK MLUT which is about 4.5Mb per link.
@@ -40,12 +40,11 @@
* memory used based upon how the CMS is configured.
* This will be done later. For now, just limit the number
* of links.
- */
+ */
#define ICC_CACHE_MAXLINKS 50
/* Static prototypes */
-
static gsicc_link_t * gsicc_alloc_link(gs_memory_t *memory, gsicc_hashlink_t hashcode);
static void gsicc_link_free(gsicc_link_t *icc_link, gs_memory_t *memory);
@@ -72,17 +71,13 @@ static void rc_gsicc_link_cache_free(gs_memory_t * mem, void *ptr_in, client_nam
/* Structure pointer information */
-
-
gs_private_st_ptrs4(st_icc_link, gsicc_link_t, "gsiccmanage_link",
- icc_link_enum_ptrs, icc_link_reloc_ptrs,
- contextptr, icc_link_cache, next, wait);
-
+ icc_link_enum_ptrs, icc_link_reloc_ptrs,
+ contextptr, icc_link_cache, next, wait);
gs_private_st_ptrs3(st_icc_linkcache, gsicc_link_cache_t, "gsiccmanage_linkcache",
- icc_linkcache_enum_ptrs, icc_linkcache_reloc_ptrs,
- head, lock, wait);
-
+ icc_linkcache_enum_ptrs, icc_linkcache_reloc_ptrs,
+ head, lock, wait);
/* These are used to construct a hash for the ICC link based upon the
render parameters */
@@ -104,14 +99,14 @@ gsicc_cache_new(gs_memory_t *memory)
/* We want this to be maintained in stable_memory. It should be be effected by the
save and restores */
result = gs_alloc_struct(memory->stable_memory, gsicc_link_cache_t, &st_icc_linkcache,
- "gsicc_cache_new");
+ "gsicc_cache_new");
if ( result == NULL )
return(NULL);
result->lock = gx_monitor_alloc(memory->stable_memory);
result->wait = gx_semaphore_alloc(memory->stable_memory);
if (result->lock == NULL || result->wait == NULL) {
- gs_free_object(memory->stable_memory, result, "gsicc_cache_new");
- return(NULL);
+ gs_free_object(memory->stable_memory, result, "gsicc_cache_new");
+ return(NULL);
}
result->num_waiting = 0;
rc_init_free(result, memory->stable_memory, 1, rc_gsicc_link_cache_free);
@@ -133,7 +128,7 @@ rc_gsicc_link_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname)
}
#ifdef DEBUG
if (link_cache->num_links != 0) {
- eprintf1("num_links is %d, should be 0.\n", link_cache->num_links);
+ eprintf1("num_links is %d, should be 0.\n", link_cache->num_links);
}
#endif
gs_free_object(mem->stable_memory, link_cache->lock, "rc_gsicc_link_cache_free(lock)");
@@ -150,27 +145,27 @@ gsicc_alloc_link(gs_memory_t *memory, gsicc_hashlink_t hashcode)
/* The link has to be added in stable memory. We want them
to be maintained across the gsave and grestore process */
result = gs_alloc_struct(memory->stable_memory, gsicc_link_t, &st_icc_link,
- "gsicc_alloc_link");
+ "gsicc_alloc_link");
wait = gx_semaphore_alloc(memory->stable_memory);
if (wait == NULL) {
- gs_free_object(memory, result, "gsicc_alloc_link(wait)");
- result = NULL;
+ gs_free_object(memory, result, "gsicc_alloc_link(wait)");
+ result = NULL;
}
if (result != NULL) {
- /* set up placeholder values */
- result->next = NULL;
- result->contextptr = NULL;
- result->link_handle = NULL;
- result->hashcode.link_hashcode = hashcode.link_hashcode;
- result->hashcode.des_hash = 0;
- result->hashcode.src_hash = 0;
- result->hashcode.rend_hash = 0;
- result->ref_count = 1; /* prevent it from being freed */
- result->includes_softproof = 0;
- result->is_identity = false;
- result->valid = false; /* not yet complete */
- result->num_waiting = 0;
- result->wait = wait;
+ /* set up placeholder values */
+ result->next = NULL;
+ result->contextptr = NULL;
+ result->link_handle = NULL;
+ result->hashcode.link_hashcode = hashcode.link_hashcode;
+ result->hashcode.des_hash = 0;
+ result->hashcode.src_hash = 0;
+ result->hashcode.rend_hash = 0;
+ result->ref_count = 1; /* prevent it from being freed */
+ result->includes_softproof = 0;
+ result->is_identity = false;
+ result->valid = false; /* not yet complete */
+ result->num_waiting = 0;
+ result->wait = wait;
}
return(result);
}
@@ -196,8 +191,8 @@ gsicc_set_link_data(gsicc_link_t *icc_link, void *link_handle, void *contextptr,
/* Now release any tasks/threads waiting for these contents */
while (icc_link->num_waiting > 0) {
- gx_semaphore_signal(icc_link->wait);
- icc_link->num_waiting--;
+ gx_semaphore_signal(icc_link->wait);
+ icc_link->num_waiting--;
}
gx_monitor_leave(lock); /* done with updating, let everyone run */
}
@@ -210,8 +205,6 @@ gsicc_link_free(gsicc_link_t *icc_link, gs_memory_t *memory)
gs_free_object(memory->stable_memory, icc_link, "gsicc_link_free");
}
-
-
static void
gsicc_get_gscs_hash(gsicc_manager_t *icc_manager, gs_color_space *colorspace, int64_t *hash)
{
@@ -219,17 +212,17 @@ gsicc_get_gscs_hash(gsicc_manager_t *icc_manager, gs_color_space *colorspace, in
const gs_color_space_type *pcst = colorspace->type;
switch(pcst->index) {
- case gs_color_space_index_DeviceGray:
+ case gs_color_space_index_DeviceGray:
*hash = icc_manager->default_gray->hashcode;
break;
- case gs_color_space_index_DeviceRGB:
+ case gs_color_space_index_DeviceRGB:
*hash = icc_manager->default_rgb->hashcode;
break;
case gs_color_space_index_DeviceCMYK:
*hash = icc_manager->default_cmyk->hashcode;
break;
- default:
- break;
+ default:
+ break;
}
}
@@ -312,7 +305,7 @@ gsicc_get_cspace_hash(gsicc_manager_t *icc_manager, gx_device *dev,
} else {
/* We need to compute for this color space */
gsicc_get_icc_buff_hash(cmm_icc_profile_data->buffer, hash,
- cmm_icc_profile_data->buffer_size);
+ cmm_icc_profile_data->buffer_size);
cmm_icc_profile_data->hashcode = *hash;
cmm_icc_profile_data->hash_is_valid = true;
return;
@@ -335,23 +328,23 @@ gsicc_findcachelink(gsicc_hashlink_t hash, gsicc_link_cache_t *icc_link_cache, b
while (curr != NULL ) {
if (curr->hashcode.link_hashcode == hashcode && includes_proof == curr->includes_softproof) {
- /* move this one to the front of the list hoping we will use it again soon */
- if (prev != NULL) { /* if prev == NULL, curr is already the head */
- prev->next = curr->next;
- curr->next = icc_link_cache->head;
- icc_link_cache->head = curr;
- }
- curr->ref_count++; /* bump the ref_count since we will be using this one */
- while (curr->valid == false) {
- curr->num_waiting++;
- gx_monitor_leave(icc_link_cache->lock);
- gx_semaphore_wait(curr->wait);
- gx_monitor_enter(icc_link_cache->lock); /* re-enter breifly */
- }
- gx_monitor_leave(icc_link_cache->lock);
+ /* move this one to the front of the list hoping we will use it again soon */
+ if (prev != NULL) { /* if prev == NULL, curr is already the head */
+ prev->next = curr->next;
+ curr->next = icc_link_cache->head;
+ icc_link_cache->head = curr;
+ }
+ curr->ref_count++; /* bump the ref_count since we will be using this one */
+ while (curr->valid == false) {
+ curr->num_waiting++;
+ gx_monitor_leave(icc_link_cache->lock);
+ gx_semaphore_wait(curr->wait);
+ gx_monitor_enter(icc_link_cache->lock); /* re-enter breifly */
+ }
+ gx_monitor_leave(icc_link_cache->lock);
return(curr); /* success */
}
- prev = curr;
+ prev = curr;
curr = curr->next;
}
gx_monitor_leave(icc_link_cache->lock);
@@ -378,8 +371,8 @@ gsicc_find_zeroref_cache(gsicc_link_cache_t *icc_link_cache)
curr = icc_link_cache->head;
while (curr != NULL ) {
if (curr->ref_count == 0) {
- curr->ref_count++; /* we will use this one */
- break;
+ curr->ref_count++; /* we will use this one */
+ break;
}
curr = curr->next;
}
@@ -400,14 +393,14 @@ gsicc_remove_link(gsicc_link_t *link, gs_memory_t *memory)
while (curr != NULL ) {
if (curr == link) {
- /* remove this one from the list */
- if (prev == NULL)
- icc_link_cache->head = curr->next;
- else
- prev->next = curr->next;
+ /* remove this one from the list */
+ if (prev == NULL)
+ icc_link_cache->head = curr->next;
+ else
+ prev->next = curr->next;
break;
}
- prev = curr;
+ prev = curr;
curr = curr->next;
}
/* if curr != link we didn't find it: assert ? */
@@ -498,31 +491,31 @@ gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
gx_monitor_enter(icc_link_cache->lock);
while (icc_link_cache->num_links >= ICC_CACHE_MAXLINKS) {
/* If not, see if there is anything we can remove from cache. */
- while ((link = gsicc_find_zeroref_cache(icc_link_cache)) == NULL) {
- icc_link_cache->num_waiting++;
- /* safe to unlock since above will make sure semaphore is signalled */
- gx_monitor_leave(icc_link_cache->lock);
- /* we get signalled (released from wait) when a link goes to zero ref */
- gx_semaphore_wait(icc_link_cache->wait);
-
- /* repeat the findcachelink to see if some other thread has */
- /*already started building the link we need */
- found_link = gsicc_findcachelink(hash, icc_link_cache, include_softproof);
-
- /* Got a hit, return link (ref_count for the link was already bumped */
- if (found_link != NULL)
- return(found_link); /* TO FIX: We are really not going to want to have the members
- of this object visible outside gsiccmange */
-
- gx_monitor_enter(icc_link_cache->lock); /* restore the lock */
- /* we will re-test the num_links above while locked to insure */
- /* that some other thread didn't grab the slot and max us out */
- }
- /* Remove the zero ref_count link profile we found. */
- /* Even if we remove this link, we may still be maxed out so */
- /* the outermost 'while' will check to make sure some other */
- /* thread did not grab the one we remove. */
- gsicc_remove_link(link, cache_mem);
+ while ((link = gsicc_find_zeroref_cache(icc_link_cache)) == NULL) {
+ icc_link_cache->num_waiting++;
+ /* safe to unlock since above will make sure semaphore is signalled */
+ gx_monitor_leave(icc_link_cache->lock);
+ /* we get signalled (released from wait) when a link goes to zero ref */
+ gx_semaphore_wait(icc_link_cache->wait);
+
+ /* repeat the findcachelink to see if some other thread has */
+ /*already started building the link we need */
+ found_link = gsicc_findcachelink(hash, icc_link_cache, include_softproof);
+
+ /* Got a hit, return link (ref_count for the link was already bumped */
+ if (found_link != NULL)
+ return(found_link); /* TO FIX: We are really not going to want to have the members
+ of this object visible outside gsiccmange */
+
+ gx_monitor_enter(icc_link_cache->lock); /* restore the lock */
+ /* we will re-test the num_links above while locked to insure */
+ /* that some other thread didn't grab the slot and max us out */
+ }
+ /* Remove the zero ref_count link profile we found. */
+ /* Even if we remove this link, we may still be maxed out so */
+ /* the outermost 'while' will check to make sure some other */
+ /* thread did not grab the one we remove. */
+ gsicc_remove_link(link, cache_mem);
icc_link_cache->num_links--;
}
/* insert an empty link that we will reserve so we */
@@ -533,7 +526,7 @@ gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
icc_link_cache->head = link;
icc_link_cache->num_links++;
gx_monitor_leave(icc_link_cache->lock); /* now that we own this link we can release */
- /* the lock since it is not valid */
+ /* the lock since it is not valid */
/* Now compute the link contents */
cms_input_profile = gs_input_profile->profile_handle;
@@ -558,7 +551,7 @@ gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
/* Cant create the link. No profile present,
nor any defaults to use for this. Really
need to throw an error for this case. */
- gsicc_remove_link(link, cache_mem);
+ gsicc_remove_link(link, cache_mem);
icc_link_cache->num_links--;
return(NULL);
}
@@ -585,7 +578,7 @@ gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
/* Cant create the link. No profile present,
nor any defaults to use for this. Really
need to throw an error for this case. */
- gsicc_remove_link(link, cache_mem);
+ gsicc_remove_link(link, cache_mem);
icc_link_cache->num_links--;
return(NULL);
}
@@ -594,9 +587,9 @@ gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
link_handle = gscms_get_link(cms_input_profile, cms_output_profile,
rendering_params);
if (link_handle != NULL) {
- gsicc_set_link_data(link, link_handle, contextptr, hash, icc_link_cache->lock);
+ gsicc_set_link_data(link, link_handle, contextptr, hash, icc_link_cache->lock);
} else {
- gsicc_remove_link(link, cache_mem);
+ gsicc_remove_link(link, cache_mem);
icc_link_cache->num_links--;
return(NULL);
}
@@ -879,44 +872,43 @@ gsicc_release_link(gsicc_link_t *icclink)
/* Decrement the reference count */
if (--(icclink->ref_count) == 0) {
- gsicc_link_t *curr, *prev;
-
-
- /* Find link in cache, and move it to the end of the list. */
- /* This way zero ref_count links are found LRU first */
- curr = icc_link_cache->head;
- prev = NULL;
- while (curr != icclink) {
- prev = curr;
- curr = curr->next;
- };
- if (prev == NULL) {
- /* this link was the head */
- icc_link_cache->head = curr->next;
- } else {
- prev->next = curr->next; /* de-link this one */
- }
- /* Find the first zero-ref entry on the list */
- curr = icc_link_cache->head;
- prev = NULL;
- while (curr != NULL && curr->ref_count > 0) {
- prev = curr;
- curr = curr->next;
- }
- /* Found where to link this one into the tail of the list */
- if (prev == NULL) {
- icc_link_cache->head = icclink;
- icclink->next = icc_link_cache->head->next;
- } else {
- /* link this one in here */
- prev->next = icclink;
- icclink->next = curr;
- }
-
- /* now release any tasks waiting for a cache slot */
+ gsicc_link_t *curr, *prev;
+
+ /* Find link in cache, and move it to the end of the list. */
+ /* This way zero ref_count links are found LRU first */
+ curr = icc_link_cache->head;
+ prev = NULL;
+ while (curr != icclink) {
+ prev = curr;
+ curr = curr->next;
+ };
+ if (prev == NULL) {
+ /* this link was the head */
+ icc_link_cache->head = curr->next;
+ } else {
+ prev->next = curr->next; /* de-link this one */
+ }
+ /* Find the first zero-ref entry on the list */
+ curr = icc_link_cache->head;
+ prev = NULL;
+ while (curr != NULL && curr->ref_count > 0) {
+ prev = curr;
+ curr = curr->next;
+ }
+ /* Found where to link this one into the tail of the list */
+ if (prev == NULL) {
+ icc_link_cache->head = icclink;
+ icclink->next = icc_link_cache->head->next;
+ } else {
+ /* link this one in here */
+ prev->next = icclink;
+ icclink->next = curr;
+ }
+
+ /* now release any tasks waiting for a cache slot */
while (icclink->icc_link_cache->num_waiting > 0) {
- gx_semaphore_signal(icclink->icc_link_cache->wait);
- icclink->icc_link_cache->num_waiting--;
+ gx_semaphore_signal(icclink->icc_link_cache->wait);
+ icclink->icc_link_cache->num_waiting--;
}
}
gx_monitor_leave(icc_link_cache->lock);
@@ -943,4 +935,3 @@ gsicc_init_buffer(gsicc_bufferdesc_t *buffer_desc, unsigned char num_chan, unsig
buffer_desc->little_endian = true;
}
-
diff --git a/gs/base/gsicc_cache.h b/gs/base/gsicc_cache.h
index da950ff0a..a74f4e3a1 100644
--- a/gs/base/gsicc_cache.h
+++ b/gs/base/gsicc_cache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,7 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
/* Header for the ICC profile link cache */
#ifndef gsicccache_INCLUDED
# define gsicccache_INCLUDED
@@ -28,28 +27,27 @@ typedef struct gx_device_s gx_device;
gsicc_link_cache_t* gsicc_cache_new(gs_memory_t *memory);
void
-gsicc_init_buffer(gsicc_bufferdesc_t *buffer_desc, unsigned char num_chan,
- unsigned char bytes_per_chan, bool has_alpha, bool alpha_first,
- bool is_planar, int plane_stride, int row_stride, int num_rows,
+gsicc_init_buffer(gsicc_bufferdesc_t *buffer_desc, unsigned char num_chan,
+ unsigned char bytes_per_chan, bool has_alpha, bool alpha_first,
+ bool is_planar, int plane_stride, int row_stride, int num_rows,
int pixels_per_row);
-gsicc_link_t* gsicc_get_link(const gs_imager_state * pis, gx_device *dev,
+gsicc_link_t* gsicc_get_link(const gs_imager_state * pis, gx_device *dev,
const gs_color_space *input_colorspace,
gs_color_space *output_colorspace,
- gsicc_rendering_param_t *rendering_params,
+ gsicc_rendering_param_t *rendering_params,
gs_memory_t *memory, bool include_softproof);
-gsicc_link_t* gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
+gsicc_link_t* gsicc_get_link_profile(gs_imager_state *pis, gx_device *dev,
cmm_profile_t *gs_input_profile,
cmm_profile_t *gs_output_profile,
- gsicc_rendering_param_t *rendering_params,
+ gsicc_rendering_param_t *rendering_params,
gs_memory_t *memory, bool include_softproof);
void gsicc_release_link(gsicc_link_t *icclink);
void gsicc_get_icc_buff_hash(unsigned char *buffer, int64_t *hash, unsigned int buff_size);
int gsicc_transform_named_color(float tint_value, byte *color_name, uint name_size,
- gx_color_value device_values[],
- const gs_imager_state *pis, gx_device *dev,
- cmm_profile_t *gs_output_profile,
- gsicc_rendering_param_t *rendering_params,
+ gx_color_value device_values[],
+ const gs_imager_state *pis, gx_device *dev,
+ cmm_profile_t *gs_output_profile,
+ gsicc_rendering_param_t *rendering_params,
bool include_softproof);
#endif
-
diff --git a/gs/base/gsicc_cms.h b/gs/base/gsicc_cms.h
index 5a49b7b15..b5bc42a3b 100644
--- a/gs/base/gsicc_cms.h
+++ b/gs/base/gsicc_cms.h
@@ -11,10 +11,8 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
/* Header for the GS interface to littleCMS */
-
#ifndef gsicc_littlecms_INCLUDED
# define gsicc_littlecms_INCLUDED
@@ -72,4 +70,3 @@ int gscms_get_input_channel_count(gcmmhprofile_t profile);
int gscms_get_output_channel_count(gcmmhprofile_t profile);
#endif
-
diff --git a/gs/base/gsicc_create.c b/gs/base/gsicc_create.c
index c8fc891ec..7656461b3 100644
--- a/gs/base/gsicc_create.c
+++ b/gs/base/gsicc_create.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@
CalRGB --> ICC 1-D LUTS and Matrix
CalGray --> ICC 1-D LUT
- LAB --> ICC MLUT with a 2x2 sized table
+ LAB --> ICC MLUT with a 2x2 sized table
From PS
@@ -36,8 +36,7 @@
%% Output Spaces
- Type1 CRD --> ICC will have MLUT if render table present.
-
+ Type1 CRD --> ICC will have MLUT if render table present.
A few notes:
@@ -52,7 +51,7 @@
Required if N-component LUT-based:
- AToB0Tag (NOTE ONE WAY! BtoA0Tag is optional. Not true for
+ AToB0Tag (NOTE ONE WAY! BtoA0Tag is optional. Not true for
display profiles.)
Required if 3 component matrix based:
@@ -64,8 +63,8 @@
greenTRCTag
blueTRCTag
- Notes:
-
+ Notes:
+
3-component can include AToB0Tag.
Only CIEXYZ encoding can be used with matrix/TRC models.
If CIELAB encoding is to be used, we must use LUT-based.
@@ -78,11 +77,10 @@
Optional
AToB0Tag
-
For Color Display Profiles:
Required if N-Component LUT-Based
-
+
AtoB0Tag
BToA0Tag (Note inverse required here).
@@ -95,7 +93,7 @@
greenTRCTag
blueTRCTag
- Optional
+ Optional
AtoB0Tag
BToA0Tag (Note inverse required here).
@@ -106,17 +104,16 @@
grayTRCTag
- Optional
+ Optional
AtoB0Tag
- BtoA0Tag
+ BtoA0Tag
+Note: All profile data must be encoded as big-endian
-Note: All profile data must be encoded as big-endian
-
*/
-#include "icc34.h" /* Note this header is needed even if lcms is not
+#include "icc34.h" /* Note this header is needed even if lcms is not
compiled as default CMS */
#include "string_.h"
#include "gsmemory.h"
@@ -144,7 +141,7 @@ add_xyzdata(unsigned char *input_ptr, icS15Fixed16Number temp_XYZ[]);
#define DATATYPE_SIZE 8
#define CURVE_SIZE 512
#define IDENT_CURVE_SIZE 0
-#define NUMBER_COMMON_TAGS 2
+#define NUMBER_COMMON_TAGS 2
#define icMultiUnicodeText 0x6d6c7563 /* 'mluc' v4 text type */
#define icMultiFunctionAtoBType 0x6d414220 /* 'mAB ' v4 lutAtoBtype type */
#define icSigChromaticAdaptationTag 0x63686164 /* 'chad' */
@@ -170,13 +167,13 @@ static const char copy_right[] = "Copyright Artifex Software 2009";
typedef struct {
icTagSignature sig; /* The tag signature */
- icUInt32Number offset; /* Start of tag relative to
- * start of header, Spec
+ icUInt32Number offset; /* Start of tag relative to
+ * start of header, Spec
* Clause 5 */
icUInt32Number size; /* Size in bytes */
unsigned char byte_padding;
} gsicc_tag;
-/* In generating 2x2x2 approximations as well as cases
+/* In generating 2x2x2 approximations as well as cases
where we will need to squash components together we
will go to float and then to 16 bit tables, hence the
float pointer. Otherwise we will keep the data
@@ -184,10 +181,10 @@ typedef struct {
tables of postscript */
typedef struct {
unsigned short *data_short;
- unsigned char *data_byte; /* Used for cases where we can
+ unsigned char *data_byte; /* Used for cases where we can
use the table as is */
int clut_dims[4];
- int clut_num_input;
+ int clut_num_input;
int clut_num_output;
int clut_num_entries; /* Number of entries */
int clut_word_width; /* Word width of table, 1 or 2 */
@@ -209,7 +206,7 @@ typedef struct {
static int
get_padding(int x)
{
- return( (4 -x%4)%4 );
+ return( (4 -x%4)%4 );
}
/* For some weird reason I cant link to the one in gscie.c */
@@ -217,9 +214,9 @@ static void
gsicc_matrix_init(register gs_matrix3 * mat)
{
mat->is_identity =
- mat->cu.u == 1.0 && is_fzero2(mat->cu.v, mat->cu.w) &&
- mat->cv.v == 1.0 && is_fzero2(mat->cv.u, mat->cv.w) &&
- mat->cw.w == 1.0 && is_fzero2(mat->cw.u, mat->cw.v);
+ mat->cu.u == 1.0 && is_fzero2(mat->cu.v, mat->cu.w) &&
+ mat->cv.v == 1.0 && is_fzero2(mat->cv.u, mat->cv.w) &&
+ mat->cw.w == 1.0 && is_fzero2(mat->cw.u, mat->cw.v);
}
static void
@@ -243,7 +240,7 @@ gsicc_diagmatrix_init(gs_vector3 * vec)
return(vec->u == 1.0 && vec->v == 1.0 && vec->w == 1.0);
}
-/* The following were borrowed from static functions in gdevpdfc.c
+/* The following were borrowed from static functions in gdevpdfc.c
for detecting CIELAB PS definitions */
#define CC_KEY(i) ((i) / (double)CC_INDEX_1)
@@ -255,19 +252,19 @@ cie_vector_cache_is_lab_abc(const gx_cie_vector_cache3_t *pvc, int i)
const gx_cie_vector_cache *const pc3 = pvc->caches;
double k = CC_KEY(i);
double l0 = pc3[0].vecs.params.base,
- l = l0 + k * (pc3[0].vecs.params.limit - l0);
+ l = l0 + k * (pc3[0].vecs.params.limit - l0);
double a0 = pc3[1].vecs.params.base,
- a = a0 + k * (pc3[1].vecs.params.limit - a0);
+ a = a0 + k * (pc3[1].vecs.params.limit - a0);
double b0 = pc3[2].vecs.params.base,
- b = b0 + k * (pc3[2].vecs.params.limit - b0);
+ b = b0 + k * (pc3[2].vecs.params.limit - b0);
return (fabs(cie_cached2float(pc3[0].vecs.values[i].u) -
- (l + 16) / 116) < 0.001 &&
- fabs(cie_cached2float(pc3[1].vecs.values[i].u) -
- a / 500) < 0.001 &&
- fabs(cie_cached2float(pc3[2].vecs.values[i].w) -
- b / -200) < 0.001
- );
+ (l + 16) / 116) < 0.001 &&
+ fabs(cie_cached2float(pc3[1].vecs.values[i].u) -
+ a / 500) < 0.001 &&
+ fabs(cie_cached2float(pc3[2].vecs.values[i].w) -
+ b / -200) < 0.001
+ );
}
static bool
@@ -275,15 +272,15 @@ cie_scalar_cache_is_lab_lmn(const gs_cie_abc *pcie, int i)
{
double k = CC_KEY(i);
double g = (k >= 6.0 / 29 ? k * k * k :
- (k - 4.0 / 29) * (108.0 / 841));
+ (k - 4.0 / 29) * (108.0 / 841));
#define CC_V(j,i) (pcie->common.caches.DecodeLMN[j].floats.values[i])
#define CC_WP(uvw) (pcie->common.points.WhitePoint.uvw)
-
+
return (fabs(CC_V(0, i) - g * CC_WP(u)) < 0.001 &&
- fabs(CC_V(1, i) - g * CC_WP(v)) < 0.001 &&
- fabs(CC_V(2, i) - g * CC_WP(w)) < 0.001
- );
+ fabs(CC_V(1, i) - g * CC_WP(v)) < 0.001 &&
+ fabs(CC_V(2, i) - g * CC_WP(w)) < 0.001
+ );
#undef CC_V
#undef CC_WP
@@ -296,20 +293,20 @@ cie_is_lab(const gs_cie_abc *pcie)
/* Check MatrixABC and MatrixLMN. */
if (!(pcie->MatrixABC.cu.u == 1 && pcie->MatrixABC.cu.v == 1 &&
- pcie->MatrixABC.cu.w == 1 &&
- pcie->MatrixABC.cv.u == 1 && pcie->MatrixABC.cv.v == 0 &&
- pcie->MatrixABC.cv.w == 0 &&
- pcie->MatrixABC.cw.u == 0 && pcie->MatrixABC.cw.v == 0 &&
- pcie->MatrixABC.cw.w == -1 &&
- pcie->common.MatrixLMN.is_identity
- ))
- return false;
+ pcie->MatrixABC.cu.w == 1 &&
+ pcie->MatrixABC.cv.u == 1 && pcie->MatrixABC.cv.v == 0 &&
+ pcie->MatrixABC.cv.w == 0 &&
+ pcie->MatrixABC.cw.u == 0 && pcie->MatrixABC.cw.v == 0 &&
+ pcie->MatrixABC.cw.w == -1 &&
+ pcie->common.MatrixLMN.is_identity
+ ))
+ return false;
/* Check DecodeABC and DecodeLMN. */
for (i = 0; i <= CC_INDEX_1; ++i)
- if (!(cie_vector_cache_is_lab_abc(&pcie->caches.DecodeABC, i) &&
- cie_scalar_cache_is_lab_lmn(pcie, i)
- ))
- return false;
+ if (!(cie_vector_cache_is_lab_abc(&pcie->caches.DecodeABC, i) &&
+ cie_scalar_cache_is_lab_lmn(pcie, i)
+ ))
+ return false;
return true;
}
@@ -319,7 +316,7 @@ cie_is_lab(const gs_cie_abc *pcie)
forms for postscript management, which the ICC does not
support (at least the older versions). clut is allocated
externally */
-static void
+static void
gsicc_matrix3_to_mlut(gs_matrix3 *mat, unsigned short *clut)
{
/* Step through the grid values */
@@ -343,27 +340,27 @@ gsicc_matrix3_to_mlut(gs_matrix3 *mat, unsigned short *clut)
cie_mult3(&input, mat, &output);
valueflt = output.u;
if (valueflt < 0) valueflt = 0;
- if (valueflt > 1) valueflt = 1;
+ if (valueflt > 1) valueflt = 1;
value = (unsigned short) (valueflt*65535.0);
*curr_ptr ++= value;
valueflt = output.v;
if (valueflt < 0) valueflt = 0;
- if (valueflt > 1) valueflt = 1;
+ if (valueflt > 1) valueflt = 1;
value = (unsigned short) (valueflt*65535.0);
*curr_ptr ++= value;
valueflt = output.w;
if (valueflt < 0) valueflt = 0;
- if (valueflt > 1) valueflt = 1;
+ if (valueflt > 1) valueflt = 1;
value = (unsigned short) (valueflt*65535.0);
*curr_ptr ++= value;
- }
+ }
}
static u1Fixed15Number
double2u1Fixed15Number(float number_in)
{
float value;
-
+
value = number_in/(1.0 + (32767.0/32768.0));
value = value * 65535.0;
if (value < 0) {
@@ -376,7 +373,7 @@ double2u1Fixed15Number(float number_in)
}
/* This function mashes all the elements together into a single CLUT
- for the ICC profile. This is an approach of last resort, but
+ for the ICC profile. This is an approach of last resort, but
guaranteed to work. */
static int
gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
@@ -397,13 +394,13 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
float temp;
gs_color_space_index cs_index;
- /* This completes the joint cache inefficiently so that
+ /* This completes the joint cache inefficiently so that
we can sample through it and get our table entries */
code = gx_cie_to_xyz_alloc(&pis, pcs, memory);
cs_index = gs_color_space_get_index(pcs);
if (code < 0)
- return code;
- /* Create the sample indices across the input ranges
+ return code;
+ /* Create the sample indices across the input ranges
for each color component. When the concretization/remap occurs
to be fed into this icc profile, we may will need to apply a linear
map to the input if the range is something other than 0 to 1 */
@@ -413,11 +410,11 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
fltptr = input_samples[i];
curr_range = &(ranges[i]);
for (j = 0; j < table_size; j++ ) {
- *fltptr ++= ((float) j/ (float) (table_size-1)) *
+ *fltptr ++= ((float) j/ (float) (table_size-1)) *
(curr_range->rmax - curr_range->rmin) + curr_range->rmin;
}
}
- /* Go through all the entries.
+ /* Go through all the entries.
Uniformly from min range to max range */
ptr_short = clut->data_short;
for (i = 0; i < num_points; i++) {
@@ -439,7 +436,7 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
index = (unsigned int) floor((float) i/(float) (table_size*
table_size))%table_size;
cc.paint.values[0] = fltptr[index];
- }
+ }
if (num_components == 4) {
/* The first channel varies least rapidly in the ICC table */
fltptr = input_samples[3];
@@ -492,7 +489,7 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
temp = frac2float(xyz[j])/(1 + 32767.0/32768);
}
if (temp < 0) temp = 0;
- if (temp > 1) temp = 1;
+ if (temp > 1) temp = 1;
*ptr_short ++= (unsigned int)(temp * 65535);
}
}
@@ -507,7 +504,7 @@ gsicc_create_clut(const gs_color_space *pcs, gsicc_clut *clut, gs_range *ranges,
This is used in the CIEA type. clut is allocated
externally. We may need to replace this with a range value.
For now we are mapping to an output between 0 and the vector */
-static void
+static void
gsicc_vec_to_mlut(gs_vector3 *vec, unsigned short *clut)
{
unsigned short *curr_ptr = clut;
@@ -520,7 +517,6 @@ gsicc_vec_to_mlut(gs_vector3 *vec, unsigned short *clut)
*curr_ptr ++= double2u1Fixed15Number(vec->w);
}
-
#if SAVEICCPROFILE
/* Debug dump of internally created ICC profile for testing */
static void
@@ -537,7 +533,7 @@ save_profile(unsigned char *buffer, char filename[], int buffer_size)
}
#endif
-static
+static
ulong swapbytes32(ulong input)
{
ulong output = (((0x000000ff) & (input >> 24))
@@ -546,7 +542,7 @@ ulong swapbytes32(ulong input)
| ((0xff000000) & (input << 24)));
return output;
}
-
+
static void
write_bigendian_4bytes(unsigned char *curr_ptr,ulong input)
{
@@ -626,13 +622,13 @@ float2u8Fixed8(float number_in)
static unsigned short
lstar2_16bit(float number_in)
{
- unsigned short returnval;
+ unsigned short returnval;
float temp;
temp = number_in/((float) 100.0);
- if (temp > 1)
+ if (temp > 1)
temp = 1;
- if (temp < 0)
+ if (temp < 0)
temp = 0;
returnval = (unsigned short) ( (float) temp * (float) 0xff00);
return(returnval);
@@ -644,15 +640,14 @@ abstar2_16bit(float number_in)
float temp;
temp = number_in + ((float) 128.0);
- if (temp < 0)
+ if (temp < 0)
temp = 0;
temp = (0x8000 * temp)/ (float) 128.0;
- if (temp > 0xffff)
+ if (temp > 0xffff)
temp = 0xffff;
return((unsigned short) temp);
}
-
static
void init_common_tags(gsicc_tag tag_list[],int num_tags, int *last_tag)
{
@@ -676,7 +671,7 @@ void init_common_tags(gsicc_tag tag_list[],int num_tags, int *last_tag)
curr_tag++;
- tag_list[curr_tag].offset = tag_list[curr_tag-1].offset +
+ tag_list[curr_tag].offset = tag_list[curr_tag-1].offset +
tag_list[curr_tag-1].size;
tag_list[curr_tag].sig = icSigCopyrightTag;
/* temp_size = DATATYPE_SIZE + strlen(copy_right) + 1; */
@@ -687,7 +682,7 @@ void init_common_tags(gsicc_tag tag_list[],int num_tags, int *last_tag)
}
static void
-add_desc_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
+add_desc_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
int curr_tag)
{
ulong value;
@@ -709,7 +704,7 @@ add_desc_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
}
static void
-add_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
+add_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
int curr_tag)
{
ulong value;
@@ -723,7 +718,7 @@ add_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
value = strlen(text);
memcpy(curr_ptr,text,value);
curr_ptr += value;
- memset(curr_ptr,0,1); /* Null */
+ memset(curr_ptr,0,1); /* Null */
curr_ptr++;
memset(curr_ptr,0,tag_list[curr_tag].byte_padding); /* padding */
}
@@ -731,7 +726,7 @@ add_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
/* Code to write out v4 text type which is a table of unicode text
for different regions */
static void
-add_v4_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
+add_v4_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
int curr_tag)
{
unsigned char *curr_ptr;
@@ -765,7 +760,7 @@ add_v4_text_tag(unsigned char *buffer,const char text[], gsicc_tag tag_list[],
static void
add_common_tag_data(unsigned char *buffer,gsicc_tag tag_list[])
{
-#if USE_V4
+#if USE_V4
unsigned char *curr_ptr;
curr_ptr = buffer;
@@ -783,18 +778,18 @@ add_common_tag_data(unsigned char *buffer,gsicc_tag tag_list[])
}
static
-void init_tag(gsicc_tag tag_list[], int *last_tag, icTagSignature tagsig,
+void init_tag(gsicc_tag tag_list[], int *last_tag, icTagSignature tagsig,
int datasize)
{
/* This should never be called first. Common tags should be taken care of */
-
+
int curr_tag = (*last_tag)+1;
- tag_list[curr_tag].offset = tag_list[curr_tag-1].offset +
+ tag_list[curr_tag].offset = tag_list[curr_tag-1].offset +
tag_list[curr_tag-1].size;
tag_list[curr_tag].sig = tagsig;
tag_list[curr_tag].byte_padding = get_padding(DATATYPE_SIZE + datasize);
- tag_list[curr_tag].size = DATATYPE_SIZE + datasize +
+ tag_list[curr_tag].size = DATATYPE_SIZE + datasize +
tag_list[curr_tag].byte_padding;
*last_tag = curr_tag;
}
@@ -818,8 +813,8 @@ setheader_common(icHeader *header)
header->illuminant.Y = double2XYZtype((float) 1.0);
header->illuminant.Z = double2XYZtype((float) 0.8249);
header->creator = 0;
- /* Version 4 includes a profile id, field which is an md5 sum */
- memset(header->reserved,0,44);
+ /* Version 4 includes a profile id, field which is an md5 sum */
+ memset(header->reserved,0,44);
}
static void
@@ -855,7 +850,7 @@ copy_header(unsigned char *buffer,icHeader *header)
write_bigendian_4bytes(curr_ptr,header->illuminant.Y);
curr_ptr += 4;
write_bigendian_4bytes(curr_ptr,header->illuminant.Z);
- curr_ptr += 4;
+ curr_ptr += 4;
memset(curr_ptr,0,48);
}
@@ -936,7 +931,7 @@ scale_matrix(float *matrix_input,float scale_factor)
}
static void
-add_gammadata(unsigned char *input_ptr, unsigned short gamma,
+add_gammadata(unsigned char *input_ptr, unsigned short gamma,
icTagSignature curveType)
{
unsigned char *curr_ptr;
@@ -954,7 +949,7 @@ add_gammadata(unsigned char *input_ptr, unsigned short gamma,
/* The encode (8frac8) gamma, with padding */
write_bigendian_2bytes(curr_ptr, gamma);
curr_ptr += 2;
-
+
/* pad two bytes */
memset(curr_ptr,0,2);
}
@@ -978,15 +973,13 @@ add_xyzdata(unsigned char *input_ptr, icS15Fixed16Number temp_XYZ[])
/* If abc matrix is identity the abc and lmn curves can be mashed together */
static void
-merge_abc_lmn_curves(gx_cie_vector_cache *DecodeABC_caches,
+merge_abc_lmn_curves(gx_cie_vector_cache *DecodeABC_caches,
gx_cie_scalar_cache *DecodeLMN)
{
-
-
}
-static void
+static void
add_matrixwithbias(unsigned char *input_ptr, float *float_ptr_in, bool has_bias)
{
unsigned char *curr_ptr;
@@ -1006,7 +999,7 @@ add_matrixwithbias(unsigned char *input_ptr, float *float_ptr_in, bool has_bias)
}
static void
-matrixmult(float leftmatrix[], int nlrow, int nlcol,
+matrixmult(float leftmatrix[], int nlrow, int nlcol,
float rightmatrix[], int nrrow, int nrcol, float result[])
{
float *curr_row;
@@ -1026,7 +1019,7 @@ matrixmult(float leftmatrix[], int nlrow, int nlcol,
result[k*ncols+l] = sum;
}
}
- }
+ }
}
static void
@@ -1036,7 +1029,7 @@ gsicc_create_copy_matrix3(float *src, float *des)
}
static void
-gsicc_create_compute_cam( gs_vector3 *white_src, gs_vector3 *white_des,
+gsicc_create_compute_cam( gs_vector3 *white_src, gs_vector3 *white_des,
float *cam)
{
float cat02matrix[] = {0.7328f, 0.4296f, -0.1624f,
@@ -1061,12 +1054,11 @@ gsicc_create_compute_cam( gs_vector3 *white_src, gs_vector3 *white_des,
vonkries_diag[k*3+k] = 1;
}
}
- matrixmult(&(vonkries_diag[0]), 3, 3, &(cat02matrix[0]), 3, 3,
+ matrixmult(&(vonkries_diag[0]), 3, 3, &(cat02matrix[0]), 3, 3,
&(temp_matrix[0]));
matrixmult(&(cat02matrixinv[0]), 3, 3, &(temp_matrix[0]), 3, 3, &(cam[0]));
}
-
/* Hardcoded chad for D65 to D50. This should be computed on the fly
based upon the PS specified white point and ICC D50. We don't use
the chad tag with littleCMS since it takes care of the chromatic
@@ -1076,7 +1068,7 @@ add_chad_data(unsigned char *input_ptr, float *data)
{
unsigned char *curr_ptr = input_ptr;
/* float data[] = {1.04790738171017, 0.0229333845542104, -0.0502016347980104,
- 0.0296059594177168, 0.990456039910785, -0.01707552919587,
+ 0.0296059594177168, 0.990456039910785, -0.01707552919587,
-0.00924679432678241, 0.0150626801401488, 0.751791232609078};*/
/* Signature should be sf32 */
@@ -1160,18 +1152,18 @@ add_curve(unsigned char *input_ptr, float *curve_data, int num_samples)
/* Count */
write_bigendian_4bytes(curr_ptr, num_samples);
curr_ptr += 4;
- /* Now the data uInt16 Number 0 to 65535. For now assume input is 0 to 1.
+ /* Now the data uInt16 Number 0 to 65535. For now assume input is 0 to 1.
Need to fix this. MJV */
for (k = 0; k < num_samples; k++) {
if (curve_data[k] < 0) curve_data[k] = 0;
- if (curve_data[k] > 1) curve_data[k] = 1;
+ if (curve_data[k] > 1) curve_data[k] = 1;
value = (unsigned int) (curve_data[k]*65535.0);
write_bigendian_2bytes(curr_ptr,value);
curr_ptr+=2;
}
}
-/* See comments before add_lutAtoBtype about allowable forms, which will
+/* See comments before add_lutAtoBtype about allowable forms, which will
explain much of these size calculations */
static int
getsize_lutAtoBtype(gsicc_lutatob *lutatobparts)
@@ -1181,7 +1173,7 @@ getsize_lutAtoBtype(gsicc_lutatob *lutatobparts)
int numin = lutatobparts->num_in;
int pad_bytes;
- data_offset = 32;
+ data_offset = 32;
/* B curves always present */
if (lutatobparts->b_curves != NULL) {
data_offset += (numout*(CURVE_SIZE*2+12));
@@ -1197,7 +1189,7 @@ getsize_lutAtoBtype(gsicc_lutatob *lutatobparts)
} else {
data_offset += (numout*(IDENT_CURVE_SIZE*2+12));
}
- }
+ }
/* A curves present if clut is present */
if (lutatobparts->clut != NULL) {
/* We may need to pad the clut to make sure we are on a 4 byte boundary */
@@ -1214,19 +1206,19 @@ getsize_lutAtoBtype(gsicc_lutatob *lutatobparts)
return(data_offset);
}
-/* Note: ICC V4 fomat allows ONLY these forms
+/* Note: ICC V4 fomat allows ONLY these forms
B
M - Matrix - B
A - CLUT - B
A - CLUT - M - Matrix - B
-Other forms are created by making some of these items identity. In other words
-the B curves must always be included. If CLUT is present, A curves must be present.
-Also, if Matrix is present M curves must be present. A curves cannot be
+Other forms are created by making some of these items identity. In other words
+the B curves must always be included. If CLUT is present, A curves must be present.
+Also, if Matrix is present M curves must be present. A curves cannot be
present if CLUT is not present. */
static void
add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
{
-/* We need to figure out all the offsets to the various objects based upon
+/* We need to figure out all the offsets to the various objects based upon
which ones are actually present */
unsigned char *curr_ptr;
long mlut_size;
@@ -1250,7 +1242,7 @@ add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
curr_ptr += 2;
/* Note if data offset is zero, element is not present */
/* offset to B curves (last curves) */
- data_offset = 32;
+ data_offset = 32;
if (lutatobparts->b_curves == NULL) {
/* identity curve must be present */
write_bigendian_4bytes(curr_ptr,data_offset);
@@ -1287,7 +1279,7 @@ add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
memset(curr_ptr,0,4); /* A curves */
} else {
write_bigendian_4bytes(curr_ptr,data_offset);
- mlut_size = lutatobparts->clut->clut_num_entries *
+ mlut_size = lutatobparts->clut->clut_num_entries *
lutatobparts->clut->clut_word_width * 3;
pad_bytes = (4 - mlut_size%4)%4;
data_offset += (mlut_size + pad_bytes + 20);
@@ -1300,8 +1292,8 @@ add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
} else {
write_bigendian_4bytes(curr_ptr,data_offset);
data_offset += (numin*(CURVE_SIZE*2+12));
- }
- }
+ }
+ }
curr_ptr += 4;
/* Header is completed */
/* Now write out the various parts (i.e. curves, matrix and clut) */
@@ -1339,7 +1331,7 @@ add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
/* The A curves */
if (lutatobparts->a_curves != NULL) {
for (k = 0; k < numin; k++) {
- add_curve(curr_ptr, (lutatobparts->a_curves)+k*CURVE_SIZE,
+ add_curve(curr_ptr, (lutatobparts->a_curves)+k*CURVE_SIZE,
CURVE_SIZE);
curr_ptr += (12 + CURVE_SIZE*2);
}
@@ -1352,7 +1344,7 @@ add_lutAtoBtype(unsigned char *input_ptr, gsicc_lutatob *lutatobparts)
}
static void
-add_clut_labdata_16bit(unsigned char *input_ptr, cielab_t *cielab,
+add_clut_labdata_16bit(unsigned char *input_ptr, cielab_t *cielab,
int num_colors, int num_samples)
{
int k;
@@ -1377,7 +1369,7 @@ add_clut_labdata_16bit(unsigned char *input_ptr, cielab_t *cielab,
/* Add 16bit CLUT data that is in CIELAB color space */
static void
-add_tabledata(unsigned char *input_ptr, cielab_t *cielab, int num_colors,
+add_tabledata(unsigned char *input_ptr, cielab_t *cielab, int num_colors,
int num_samples)
{
int gridsize, numin, numout, numinentries, numoutentries;
@@ -1423,7 +1415,7 @@ add_tabledata(unsigned char *input_ptr, cielab_t *cielab, int num_colors,
}
/* Now the CLUT data */
- add_clut_labdata_16bit(curr_ptr, cielab, num_colors, num_samples);
+ add_clut_labdata_16bit(curr_ptr, cielab, num_colors, num_samples);
mlut_size = (int) pow((float) num_samples, (int) num_colors) * 2 * numout;
curr_ptr += mlut_size;
/* Now the output curve data */
@@ -1437,7 +1429,7 @@ add_tabledata(unsigned char *input_ptr, cielab_t *cielab, int num_colors,
/* This creates an ICC profile from the PDF calGray and calRGB definitions */
cmm_profile_t*
-gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
+gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
gs_memory_t *memory, int num_colors)
{
icProfile iccprofile;
@@ -1450,7 +1442,7 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
int last_tag;
icS15Fixed16Number temp_XYZ[3];
int tag_location;
- icTagSignature TRC_Tags[3] = {icSigRedTRCTag, icSigGreenTRCTag,
+ icTagSignature TRC_Tags[3] = {icSigRedTRCTag, icSigGreenTRCTag,
icSigBlueTRCTag};
int trc_tag_size;
unsigned char *buffer;
@@ -1463,21 +1455,21 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
header->deviceClass = icSigInputClass;
if (num_colors == 3) {
header->colorSpace = icSigRgbData;
- num_tags = 10; /* common (2) + rXYZ,gXYZ,bXYZ,rTRC,gTRC,bTRC,bkpt,wtpt */
+ num_tags = 10; /* common (2) + rXYZ,gXYZ,bXYZ,rTRC,gTRC,bTRC,bkpt,wtpt */
} else if (num_colors == 1) {
header->colorSpace = icSigGrayData;
- num_tags = 5; /* common (2) + GrayTRC,bkpt,wtpt */
+ num_tags = 5; /* common (2) + GrayTRC,bkpt,wtpt */
TRC_Tags[0] = icSigGrayTRCTag;
} else {
return(NULL);
}
- tag_list = (gsicc_tag*) gs_alloc_bytes(memory,
- sizeof(gsicc_tag)*num_tags,"gsicc_create_from_cal");
+ tag_list = (gsicc_tag*) gs_alloc_bytes(memory,
+ sizeof(gsicc_tag)*num_tags,"gsicc_create_from_cal");
/* Let us precompute the sizes of everything and all our offsets */
profile_size += TAG_SIZE*num_tags;
profile_size += 4; /* number of tags.... */
last_tag = -1;
- init_common_tags(tag_list, num_tags, &last_tag);
+ init_common_tags(tag_list, num_tags, &last_tag);
if (num_colors == 3) {
init_tag(tag_list, &last_tag, icSigRedColorantTag, XYZPT_SIZE);
init_tag(tag_list, &last_tag, icSigGreenColorantTag, XYZPT_SIZE);
@@ -1485,8 +1477,8 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
}
init_tag(tag_list, &last_tag, icSigMediaWhitePointTag, XYZPT_SIZE);
init_tag(tag_list, &last_tag, icSigMediaBlackPointTag, XYZPT_SIZE);
- /* 4 for count, 2 for gamma, Extra 2 bytes for 4 byte alignment requirement */
- trc_tag_size = 8;
+ /* 4 for count, 2 for gamma, Extra 2 bytes for 4 byte alignment requirement */
+ trc_tag_size = 8;
for (k = 0; k < num_colors; k++) {
init_tag(tag_list, &last_tag, TRC_Tags[k], trc_tag_size);
}
@@ -1495,7 +1487,7 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
}
/* Now we can go ahead and fill our buffer with the data. Profile
buffer data is in non-gc memory */
- buffer = gs_alloc_bytes(memory->non_gc_memory,
+ buffer = gs_alloc_bytes(memory->non_gc_memory,
profile_size, "gsicc_create_from_cal");
curr_ptr = buffer;
/* The header */
@@ -1540,7 +1532,7 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
curr_ptr += tag_list[tag_location].size;
tag_location++;
}
- result = gsicc_profile_new(NULL, memory, NULL, 0);
+ result = gsicc_profile_new(NULL, memory, NULL, 0);
result->buffer = buffer;
result->buffer_size = profile_size;
result->num_comps = num_colors;
@@ -1550,7 +1542,7 @@ gsicc_create_from_cal(float *white, float *black, float *gamma, float *matrix,
} else {
result->data_cs = gsGRAY;
result->default_match = CAL_GRAY;
- }
+ }
/* Set the hash code */
gsicc_get_icc_buff_hash(buffer, &(result->hashcode), result->buffer_size);
result->hash_is_valid = true;
@@ -1572,19 +1564,19 @@ gsicc_create_free_luta2bpart(gs_memory_t *memory, gsicc_lutatob *icc_luta2bparts
{
/* Note that white_point, black_point and matrix are not allocated but
are on the local stack */
- gs_free_object(memory, icc_luta2bparts->a_curves,
+ gs_free_object(memory, icc_luta2bparts->a_curves,
"gsicc_create_free_luta2bpart");
- gs_free_object(memory, icc_luta2bparts->b_curves,
+ gs_free_object(memory, icc_luta2bparts->b_curves,
"gsicc_create_free_luta2bpart");
- gs_free_object(memory, icc_luta2bparts->m_curves,
+ gs_free_object(memory, icc_luta2bparts->m_curves,
"gsicc_create_free_luta2bpart");
- gs_free_object(memory, icc_luta2bparts->cam,
+ gs_free_object(memory, icc_luta2bparts->cam,
"gsicc_create_free_luta2bpart");
if (icc_luta2bparts->clut) {
/* Note, data_byte is handled externally. We do not free that member here */
- gs_free_object(memory, icc_luta2bparts->clut->data_short,
+ gs_free_object(memory, icc_luta2bparts->clut->data_short,
"gsicc_create_free_luta2bpart");
- gs_free_object(memory, icc_luta2bparts->clut,
+ gs_free_object(memory, icc_luta2bparts->clut,
"gsicc_create_free_luta2bpart");
}
}
@@ -1619,8 +1611,8 @@ gsicc_create_initialize_clut(gsicc_clut *clut)
/* A common form used for most of the PS CIE color spaces */
static void
-create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
- gsicc_lutatob *lutatobparts, bool yonly,
+create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
+ gsicc_lutatob *lutatobparts, bool yonly,
gs_memory_t *memory)
{
int num_tags = 6; /* common (2), AToB0Tag,bkpt, wtpt and chad.*/
@@ -1641,7 +1633,7 @@ create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
profile_size += TAG_SIZE*num_tags;
profile_size += 4; /* number of tags.... */
last_tag = -1;
- init_common_tags(tag_list, num_tags, &last_tag);
+ init_common_tags(tag_list, num_tags, &last_tag);
init_tag(tag_list, &last_tag, icSigMediaWhitePointTag, XYZPT_SIZE);
init_tag(tag_list, &last_tag, icSigMediaBlackPointTag, XYZPT_SIZE);
@@ -1658,7 +1650,7 @@ create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
/* End of tag table information */
/* Now we can go ahead and fill our buffer with the data. Profile
is in non-gc memory */
- buffer = gs_alloc_bytes(memory->non_gc_memory, profile_size,
+ buffer = gs_alloc_bytes(memory->non_gc_memory, profile_size,
"create_lutAtoBprofile");
curr_ptr = buffer;
/* The header */
@@ -1676,14 +1668,14 @@ create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
curr_ptr += tag_list[k].size;
}
tag_location = NUMBER_COMMON_TAGS;
- /* Here we take care of chromatic adapatation. Compute the
+ /* Here we take care of chromatic adapatation. Compute the
matrix. We will need to hit the data with the matrix and
store it in the profile. */
d50.u = D50_X;
d50.v = D50_Y;
d50.w = D50_Z;
cam = (float*) gs_alloc_bytes(memory,9*sizeof(float),"create_lutAtoBprofile");
- gsicc_create_compute_cam(lutatobparts->white_point, &(d50), cam);
+ gsicc_create_compute_cam(lutatobparts->white_point, &(d50), cam);
lutatobparts->cam = cam;
get_D50(temp_XYZ); /* See Appendix D6 in spec */
/* get_XYZ(temp_XYZ,lutatobparts->white_point); */
@@ -1696,39 +1688,39 @@ create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
tag_location++;
add_chad_data(curr_ptr, cam);
curr_ptr += tag_list[tag_location].size;
- tag_location++;
+ tag_location++;
/* Multiply the matrix in the AtoB object by the cam so that the data
is in D50 */
if (lutatobparts->matrix == NULL) {
gsicc_create_copy_matrix3(cam,&(temp_matrix.cu.u));
lutatobparts->matrix = &temp_matrix;
- } else {
+ } else {
if (yonly) {
/* Used for CIEBaseA case. Studies of CIEBasedA spaces
and AR rendering of these reveals that they only look
at the product sum of the MatrixA and the 2nd column of
the LM Matrix (if there is one). This is used as a Y
decode value from which to map between the black point
- and the white point. The black point is actually ignored
+ and the white point. The black point is actually ignored
and a black point of 0 is used. Essentialy we have
weighted versions of D50 in each column of the matrix
which ensures we stay on the achromatic axis */
- lmn_vector[0] = lutatobparts->matrix->cv.u;
- lmn_vector[1] = lutatobparts->matrix->cv.v;
- lmn_vector[2] = lutatobparts->matrix->cv.w;
+ lmn_vector[0] = lutatobparts->matrix->cv.u;
+ lmn_vector[1] = lutatobparts->matrix->cv.v;
+ lmn_vector[2] = lutatobparts->matrix->cv.w;
d50_cieA[0] = D50_X;
d50_cieA[1] = D50_Y;
d50_cieA[2] = D50_Z;
- matrixmult(&(d50_cieA[0]),3,1,&(lmn_vector[0]), 1, 3,
+ matrixmult(&(d50_cieA[0]),3,1,&(lmn_vector[0]), 1, 3,
&(lutatobparts->matrix->cu.u));
} else {
- matrixmult(cam, 3, 3, &(lutatobparts->matrix->cu.u), 3, 3,
+ matrixmult(cam, 3, 3, &(lutatobparts->matrix->cu.u), 3, 3,
&(temp_matrix.cu.u));
lutatobparts->matrix = &temp_matrix;
}
}
- /* Now the AToB0Tag Data. Here this will include the M curves, the matrix
- and the B curves. We may need to do some adustements with respect
+ /* Now the AToB0Tag Data. Here this will include the M curves, the matrix
+ and the B curves. We may need to do some adustements with respect
to encode and decode. For now assume all is between 0 and 1. */
add_lutAtoBtype(curr_ptr, lutatobparts);
*pp_buffer_in = buffer;
@@ -1740,11 +1732,11 @@ create_lutAtoBprofile(unsigned char **pp_buffer_in, icHeader *header,
components into a single CLUT. Not preferable in general but necessary
when the PS components do not map easily into the ICC forms */
static void
-gsicc_create_mashed_clut(gsicc_lutatob *icc_luta2bparts,
+gsicc_create_mashed_clut(gsicc_lutatob *icc_luta2bparts,
icHeader *header, gx_color_lookup_table *Table,
- const gs_color_space *pcs, gs_range *ranges,
+ const gs_color_space *pcs, gs_range *ranges,
unsigned char **pp_buffer_in, int *profile_size_out,
- bool range_adjust, gs_memory_t* memory)
+ bool range_adjust, gs_memory_t* memory)
{
int k;
int code;
@@ -1756,14 +1748,14 @@ gsicc_create_mashed_clut(gsicc_lutatob *icc_luta2bparts,
/* Allocate space for the clut */
clut = (gsicc_clut*) gs_alloc_bytes(memory,sizeof(gsicc_clut),
"gsicc_create_mashed_clut");
- icc_luta2bparts->clut = clut;
+ icc_luta2bparts->clut = clut;
if ( icc_luta2bparts->num_in == 1 ) {
/* Use a larger sample for 1-D input */
clut->clut_dims[0] = DEFAULT_TABLE_GRAYSIZE;
} else {
for (k = 0; k < icc_luta2bparts->num_in; k++) {
if (Table != NULL && Table->dims[k] > DEFAULT_TABLE_NSIZE ) {
- /* If it has a table use the existing table size if
+ /* If it has a table use the existing table size if
it is larger than our default size */
clut->clut_dims[k] = Table->dims[k];
} else {
@@ -1777,11 +1769,11 @@ gsicc_create_mashed_clut(gsicc_lutatob *icc_luta2bparts,
clut->clut_word_width = 2; /* 16 bit */
gsicc_create_initialize_clut(clut);
/* Allocate space for the table data */
- clut->data_short =
+ clut->data_short =
(unsigned short*) gs_alloc_bytes(memory,
clut->clut_num_entries*3*sizeof(unsigned short),"gsicc_create_mashed_clut");
/* Create the table */
- code = gsicc_create_clut(pcs, clut, ranges, icc_luta2bparts->white_point,
+ code = gsicc_create_clut(pcs, clut, ranges, icc_luta2bparts->white_point,
range_adjust, memory);
/* Initialize other parts. Also make sure acurves are reset since
they have been mashed into the table. */
@@ -1804,13 +1796,13 @@ gsicc_create_mashed_clut(gsicc_lutatob *icc_luta2bparts,
}
/* Shared code by ABC, DEF and DEFG compaction of ABC/LMN parts. This is used
- when we either MatrixABC is identity, LMN Decode is identity or MatrixLMN
+ when we either MatrixABC is identity, LMN Decode is identity or MatrixLMN
is identity */
static void
-gsicc_create_abc_merge(gsicc_lutatob *atob_parts, gs_matrix3 *matrixLMN,
+gsicc_create_abc_merge(gsicc_lutatob *atob_parts, gs_matrix3 *matrixLMN,
gs_matrix3 *matrixABC, bool has_abc_procs,
- bool has_lmn_procs, gx_cie_vector_cache *abc_caches,
- gx_cie_scalar_cache *lmn_caches, gs_memory_t *memory)
+ bool has_lmn_procs, gx_cie_vector_cache *abc_caches,
+ gx_cie_scalar_cache *lmn_caches, gs_memory_t *memory)
{
gs_matrix3 temp_matrix;
gs_matrix3 *matrix_ptr;
@@ -1884,25 +1876,25 @@ gsicc_create_abc_merge(gsicc_lutatob *atob_parts, gs_matrix3 *matrixLMN,
memcpy(curr_pos,&(lmn_caches[2].floats.values[0]),CURVE_SIZE*sizeof(float));
}
}
- /* Note that if the b_curves are null and we have a matrix we need to scale
- the matrix values by 2. Otherwise an input value of 50% gray, which is
- 32767 would get mapped to 32767 by the matrix. This will be interpreted
- as a max XYZ value (s15.16) when it is eventually mapped to u16.16 due
- to the mapping of X=Y by the identity table. If there are b_curves
+ /* Note that if the b_curves are null and we have a matrix we need to scale
+ the matrix values by 2. Otherwise an input value of 50% gray, which is
+ 32767 would get mapped to 32767 by the matrix. This will be interpreted
+ as a max XYZ value (s15.16) when it is eventually mapped to u16.16 due
+ to the mapping of X=Y by the identity table. If there are b_curves
these have an output that is 16 bit. */
if (atob_parts->b_curves == NULL) {
scale_matrix(&(atob_parts->matrix->cu.u),2.0);
}
}
-/* The ABC color space is modeled using the V4 lutAtoBType which has the
- flexibility to model the various parameters. Simplified versions are used
- it possible when certain parameters in the ABC color space definition are
+/* The ABC color space is modeled using the V4 lutAtoBType which has the
+ flexibility to model the various parameters. Simplified versions are used
+ it possible when certain parameters in the ABC color space definition are
the identity. */
int
-gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
- int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *abc_caches,
+gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+ int *profile_size_out, gs_memory_t *memory,
+ gx_cie_vector_cache *abc_caches,
gx_cie_scalar_cache *lmn_caches, bool *islab)
{
icProfile iccprofile;
@@ -1915,10 +1907,10 @@ gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
gsicc_lutatob icc_luta2bparts;
float *curr_pos;
bool has_abc_procs = !((abc_caches->floats.params.is_identity &&
- (abc_caches)[1].floats.params.is_identity &&
+ (abc_caches)[1].floats.params.is_identity &&
(abc_caches)[2].floats.params.is_identity));
bool has_lmn_procs = !((lmn_caches->floats.params.is_identity &&
- (lmn_caches)[1].floats.params.is_identity &&
+ (lmn_caches)[1].floats.params.is_identity &&
(lmn_caches)[2].floats.params.is_identity));
gs_cie_abc *pcie = pcs->params.abc;
bool input_range_ok;
@@ -1930,7 +1922,7 @@ gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
setheader_common(header);
/* We will use an input type class which keeps us from having to
- create an inverse. We will keep the data a generic 3 color.
+ create an inverse. We will keep the data a generic 3 color.
Since we are doing PS color management the PCS is XYZ */
header->colorSpace = icSigRgbData;
header->deviceClass = icSigInputClass;
@@ -1949,26 +1941,26 @@ gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
may be able to use a standard 3 channel input profile type. If we
do not have the LMN decode we can mash together the ABC and LMN
matrix. Also, if ABC is identity we can mash the ABC and LMN
- decode procs. If we have an ABC matrix, LMN procs and an LMN
+ decode procs. If we have an ABC matrix, LMN procs and an LMN
matrix we will need to create a small (2x2x2) CLUT for the ICC format. */
input_range_ok = check_range(&(pcie->RangeABC.ranges[0]),3);
if (!input_range_ok) {
/* We have a range problem at input */
gsicc_create_mashed_clut(&icc_luta2bparts, header, NULL, pcs,
- &(pcie->RangeABC.ranges[0]), pp_buffer_in,
+ &(pcie->RangeABC.ranges[0]), pp_buffer_in,
profile_size_out, true, memory);
} else {
- if (pcie->MatrixABC.is_identity || !has_lmn_procs ||
+ if (pcie->MatrixABC.is_identity || !has_lmn_procs ||
pcie->common.MatrixLMN.is_identity) {
- /* The merging of these parts into the curves/matrix/curves of the
+ /* The merging of these parts into the curves/matrix/curves of the
lutAtoBtype portion can be used by abc, def and defg */
icc_luta2bparts.matrix = &matrix_input_trans;
- gsicc_create_abc_merge(&(icc_luta2bparts), &(pcie->common.MatrixLMN),
+ gsicc_create_abc_merge(&(icc_luta2bparts), &(pcie->common.MatrixLMN),
&(pcie->MatrixABC), has_abc_procs,
- has_lmn_procs, pcie->caches.DecodeABC.caches,
+ has_lmn_procs, pcie->caches.DecodeABC.caches,
pcie->common.caches.DecodeLMN, memory);
icc_luta2bparts.clut = NULL;
- /* Create the profile. This is for the common generic form we will use
+ /* Create the profile. This is for the common generic form we will use
for almost everything. */
create_lutAtoBprofile(pp_buffer_in, header,&icc_luta2bparts,false, memory);
} else {
@@ -2014,9 +2006,9 @@ gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
icc_luta2bparts.clut->clut_word_width = 2;
gsicc_create_initialize_clut(icc_luta2bparts.clut);
/* 8 grid points, 3 outputs */
- icc_luta2bparts.clut->data_short =
+ icc_luta2bparts.clut->data_short =
(unsigned short*) gs_alloc_bytes(memory,
- 8*3*sizeof(short),"gsicc_create_fromabc");
+ 8*3*sizeof(short),"gsicc_create_fromabc");
gsicc_matrix3_to_mlut(&(pcie->MatrixABC), icc_luta2bparts.clut->data_short);
/* LMN Matrix */
cie_matrix_transpose3(&(pcie->common.MatrixLMN), &matrix_input_trans);
@@ -2036,8 +2028,8 @@ gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **pp_buffer_in,
}
int
-gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
- int *profile_size_out, gs_memory_t *memory,
+gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+ int *profile_size_out, gs_memory_t *memory,
gx_cie_vector_cache *a_cache, gx_cie_scalar_cache *lmn_caches)
{
icProfile iccprofile;
@@ -2049,18 +2041,18 @@ gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
float *curr_pos;
bool has_a_proc = !(a_cache->floats.params.is_identity);
bool has_lmn_procs = !(lmn_caches->floats.params.is_identity &&
- (lmn_caches)[1].floats.params.is_identity &&
+ (lmn_caches)[1].floats.params.is_identity &&
(lmn_caches)[2].floats.params.is_identity);
gsicc_lutatob icc_luta2bparts;
bool common_range_ok;
gs_cie_a *pcie = pcs->params.a;
- bool input_range_ok;
-
+ bool input_range_ok;
+
gsicc_create_init_luta2bpart(&icc_luta2bparts);
/* Fill in the common stuff */
setheader_common(header);
/* We will use an input type class which keeps us from having to
- create an inverse. We will keep the data a generic 3 color.
+ create an inverse. We will keep the data a generic 3 color.
Since we are doing PS color management the PCS is XYZ */
header->colorSpace = icSigGrayData;
header->deviceClass = icSigInputClass;
@@ -2081,10 +2073,10 @@ gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
&(pcie->RangeA), pp_buffer_in, profile_size_out,
!input_range_ok, memory);
} else {
- /* We do not need to create a massive CLUT. Try to maintain
+ /* We do not need to create a massive CLUT. Try to maintain
the objects as best we can */
- /* Since we are going from 1 gray input to 3 XYZ values, we will need
- to include the MLUT for the 1 to 3 conversion applied by the matrix A.
+ /* Since we are going from 1 gray input to 3 XYZ values, we will need
+ to include the MLUT for the 1 to 3 conversion applied by the matrix A.
Depending upon the other parameters we may have simpiler forms, but this
is required even when Matrix A is the identity. */
if (has_a_proc) {
@@ -2116,21 +2108,21 @@ gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
icc_luta2bparts.clut->clut_word_width = 2;
gsicc_create_initialize_clut(icc_luta2bparts.clut);
/* 2 grid points 3 outputs */
- icc_luta2bparts.clut->data_short = (unsigned short*)
- gs_alloc_bytes(memory,2*3*sizeof(short),"gsicc_create_froma");
+ icc_luta2bparts.clut->data_short = (unsigned short*)
+ gs_alloc_bytes(memory,2*3*sizeof(short),"gsicc_create_froma");
/* Studies of CIEBasedA spaces
and AR rendering of these reveals that they only look
at the product sum of the MatrixA and the 2nd column of
the LM Matrix (if there is one). This is used as a Y
decode value from which to map between the black point
- and the white point. The black point is actually ignored
+ and the white point. The black point is actually ignored
and a black point of 0 is used. */
gsicc_vec_to_mlut(&(pcie->MatrixA), icc_luta2bparts.clut->data_short);
cie_matrix_transpose3(&(pcie->common.MatrixLMN), &matrix_input);
icc_luta2bparts.matrix = &matrix_input;
icc_luta2bparts.num_in = 1;
icc_luta2bparts.num_out = 3;
- /* Create the profile */
+ /* Create the profile */
/* Note Adobe only looks at the Y value for CIEBasedA spaces.
we will do the same */
create_lutAtoBprofile(pp_buffer_in, header, &icc_luta2bparts, true, memory);
@@ -2147,12 +2139,12 @@ gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
/* Common code shared by def and defg generation */
static int
-gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
- bool has_lmn_procs, bool has_abc_procs,
+gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
+ bool has_lmn_procs, bool has_abc_procs,
icHeader *header, gx_color_lookup_table *Table,
- const gs_color_space *pcs, gs_range *ranges,
- unsigned char **pp_buffer_in, int *profile_size_out,
- gs_memory_t* memory)
+ const gs_color_space *pcs, gs_range *ranges,
+ unsigned char **pp_buffer_in, int *profile_size_out,
+ gs_memory_t* memory)
{
gs_matrix3 matrix_input_trans;
int k;
@@ -2163,7 +2155,7 @@ gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
setheader_common(header);
/* We will use an input type class which keeps us from having to
- create an inverse. We will keep the data a generic 3 color.
+ create an inverse. We will keep the data a generic 3 color.
Since we are doing PS color management the PCS is XYZ */
header->deviceClass = icSigInputClass;
header->pcs = icSigXYZData;
@@ -2171,14 +2163,14 @@ gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
icc_luta2bparts->white_point = &(pcie->common.points.WhitePoint);
icc_luta2bparts->black_point = &(pcie->common.points.BlackPoint);
- /* question now is, can we keep the table as it is, or do we need to merge
+ /* question now is, can we keep the table as it is, or do we need to merge
some of the def(g) parts. Some merging or operators into the table must occur
- if we have MatrixABC, LMN Decode and Matrix LMN, otherwise we can encode
+ if we have MatrixABC, LMN Decode and Matrix LMN, otherwise we can encode
the table directly and squash the rest into the curves matrix curve portion
of the ICC form */
- if ( !(pcie->MatrixABC.is_identity) && has_lmn_procs &&
+ if ( !(pcie->MatrixABC.is_identity) && has_lmn_procs &&
!(pcie->common.MatrixLMN.is_identity) || 1 ) {
- /* Table must take over some of the other elements. We are going to
+ /* Table must take over some of the other elements. We are going to
go to a 16 bit table in this case. For now, we are going to
mash all the elements in the table. We may want to revisit this later. */
/* We must complete the defg or def decode function such that it is within
@@ -2191,15 +2183,15 @@ gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
input_range_ok = check_range(&(pcs->params.defg->RangeDEFG.ranges[0]),4);
}
gsicc_create_mashed_clut(icc_luta2bparts, header, Table,
- pcs, ranges, pp_buffer_in, profile_size_out,
- !input_range_ok, memory);
- } else {
- /* Table can stay as is. Handle the ABC/LMN portions via the curves
+ pcs, ranges, pp_buffer_in, profile_size_out,
+ !input_range_ok, memory);
+ } else {
+ /* Table can stay as is. Handle the ABC/LMN portions via the curves
matrix curves operation */
icc_luta2bparts->matrix = &matrix_input_trans;
- gsicc_create_abc_merge(icc_luta2bparts, &(pcie->common.MatrixLMN),
+ gsicc_create_abc_merge(icc_luta2bparts, &(pcie->common.MatrixLMN),
&(pcie->MatrixABC), has_abc_procs,
- has_lmn_procs, pcie->caches.DecodeABC.caches,
+ has_lmn_procs, pcie->caches.DecodeABC.caches,
pcie->common.caches.DecodeLMN, memory);
/* Get the table data */
icc_luta2bparts->clut = (gsicc_clut*) gs_alloc_bytes(memory,
@@ -2221,13 +2213,13 @@ gsicc_create_defg_common(gs_cie_abc *pcie, gsicc_lutatob *icc_luta2bparts,
return(0);
}
-/* If we have an ABC matrix, a DecodeLMN and an LMN matrix we have to mash
+/* If we have an ABC matrix, a DecodeLMN and an LMN matrix we have to mash
together the table, Decode ABC (if present) and ABC matrix. */
int
-gsicc_create_fromdefg(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+gsicc_create_fromdefg(const gs_color_space *pcs, unsigned char **pp_buffer_in,
int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *abc_caches,
- gx_cie_scalar_cache *lmn_caches,
+ gx_cie_vector_cache *abc_caches,
+ gx_cie_scalar_cache *lmn_caches,
gx_cie_scalar_cache *defg_caches)
{
gs_cie_defg *pcie = pcs->params.defg;
@@ -2239,13 +2231,13 @@ gsicc_create_fromdefg(const gs_color_space *pcs, unsigned char **pp_buffer_in,
#endif
float *curr_pos;
bool has_abc_procs = !((abc_caches->floats.params.is_identity &&
- (abc_caches)[1].floats.params.is_identity &&
+ (abc_caches)[1].floats.params.is_identity &&
(abc_caches)[2].floats.params.is_identity));
bool has_lmn_procs = !((lmn_caches->floats.params.is_identity &&
- (lmn_caches)[1].floats.params.is_identity &&
+ (lmn_caches)[1].floats.params.is_identity &&
(lmn_caches)[2].floats.params.is_identity));
bool has_defg_procs = !((defg_caches->floats.params.is_identity &&
- (defg_caches)[1].floats.params.is_identity &&
+ (defg_caches)[1].floats.params.is_identity &&
(defg_caches)[2].floats.params.is_identity &&
(defg_caches)[3].floats.params.is_identity));
int code;
@@ -2273,9 +2265,9 @@ gsicc_create_fromdefg(const gs_color_space *pcs, unsigned char **pp_buffer_in,
CURVE_SIZE*sizeof(float));
}
/* Note the recast. Should be OK since we only access common stuff in there */
- code = gsicc_create_defg_common((gs_cie_abc*) pcie, &icc_luta2bparts,
+ code = gsicc_create_defg_common((gs_cie_abc*) pcie, &icc_luta2bparts,
has_lmn_procs, has_abc_procs,
- header, &(pcie->Table), pcs,
+ header, &(pcie->Table), pcs,
&(pcie->RangeDEFG.ranges[0]),
pp_buffer_in, profile_size_out, memory);
#if SAVEICCPROFILE
@@ -2287,10 +2279,10 @@ gsicc_create_fromdefg(const gs_color_space *pcs, unsigned char **pp_buffer_in,
}
int
-gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
- int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *abc_caches,
- gx_cie_scalar_cache *lmn_caches,
+gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+ int *profile_size_out, gs_memory_t *memory,
+ gx_cie_vector_cache *abc_caches,
+ gx_cie_scalar_cache *lmn_caches,
gx_cie_scalar_cache *def_caches)
{
gs_cie_def *pcie = pcs->params.def;
@@ -2302,16 +2294,16 @@ gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
#endif
float *curr_pos;
bool has_abc_procs = !((abc_caches->floats.params.is_identity &&
- (abc_caches)[1].floats.params.is_identity &&
+ (abc_caches)[1].floats.params.is_identity &&
(abc_caches)[2].floats.params.is_identity));
bool has_lmn_procs = !((lmn_caches->floats.params.is_identity &&
- (lmn_caches)[1].floats.params.is_identity &&
+ (lmn_caches)[1].floats.params.is_identity &&
(lmn_caches)[2].floats.params.is_identity));
bool has_def_procs = !((def_caches->floats.params.is_identity &&
- (def_caches)[1].floats.params.is_identity &&
+ (def_caches)[1].floats.params.is_identity &&
(def_caches)[2].floats.params.is_identity));
int code;
-
+
gsicc_create_init_luta2bpart(&icc_luta2bparts);
header->colorSpace = icSig3colorData;
@@ -2330,11 +2322,11 @@ gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
curr_pos += CURVE_SIZE;
memcpy(curr_pos,&((pcie->caches_def.DecodeDEF[2]).floats.values[0]),
CURVE_SIZE*sizeof(float));
- }
- code = gsicc_create_defg_common((gs_cie_abc*) pcie, &icc_luta2bparts,
- has_lmn_procs, has_abc_procs, header,
+ }
+ code = gsicc_create_defg_common((gs_cie_abc*) pcie, &icc_luta2bparts,
+ has_lmn_procs, has_abc_procs, header,
&(pcie->Table), pcs, &(pcie->RangeDEF.ranges[0]),
- pp_buffer_in, profile_size_out, memory);
+ pp_buffer_in, profile_size_out, memory);
#if SAVEICCPROFILE
/* Dump the buffer to a file for testing if its a valid ICC profile */
if(debug_catch)
@@ -2350,4 +2342,4 @@ gsicc_create_fromcrd(unsigned char *buffer, gs_memory_t *memory)
icHeader *header = &(iccprofile.header);
setheader_common(header);
-} \ No newline at end of file
+}
diff --git a/gs/base/gsicc_create.h b/gs/base/gsicc_create.h
index 4c75c5d02..7328ac7f4 100644
--- a/gs/base/gsicc_create.h
+++ b/gs/base/gsicc_create.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,26 +17,26 @@
#include "gscie.h"
void gsicc_create_fromcrd(unsigned char *buffer, gs_memory_t *memory);
-int gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+int gsicc_create_froma(const gs_color_space *pcs, unsigned char **pp_buffer_in,
int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *a_cache,
+ gx_cie_vector_cache *a_cache,
gx_cie_scalar_cache *lmn_caches);
-int gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **buffer,
+int gsicc_create_fromabc(const gs_color_space *pcs, unsigned char **buffer,
int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *abc_caches,
+ gx_cie_vector_cache *abc_caches,
gx_cie_scalar_cache *lmn_caches, bool *islab);
-int gsicc_create_fromdefg(const gs_color_space *pcs,
- unsigned char **pp_buffer_in, int *profile_size_out,
- gs_memory_t *memory, gx_cie_vector_cache *abc_caches,
- gx_cie_scalar_cache *lmn_caches,
+int gsicc_create_fromdefg(const gs_color_space *pcs,
+ unsigned char **pp_buffer_in, int *profile_size_out,
+ gs_memory_t *memory, gx_cie_vector_cache *abc_caches,
+ gx_cie_scalar_cache *lmn_caches,
gx_cie_scalar_cache *defg_caches);
-int gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
+int gsicc_create_fromdef(const gs_color_space *pcs, unsigned char **pp_buffer_in,
int *profile_size_out, gs_memory_t *memory,
- gx_cie_vector_cache *abc_caches,
- gx_cie_scalar_cache *lmn_caches,
+ gx_cie_vector_cache *abc_caches,
+ gx_cie_scalar_cache *lmn_caches,
gx_cie_scalar_cache *def_caches);
-cmm_profile_t* gsicc_create_from_cal(float *white, float *black, float *gamma,
- float *matrix, gs_memory_t *memory,
+cmm_profile_t* gsicc_create_from_cal(float *white, float *black, float *gamma,
+ float *matrix, gs_memory_t *memory,
int num_colors);
#endif
diff --git a/gs/base/gsicc_lcms.c b/gs/base/gsicc_lcms.c
index 138a3c23f..299b40989 100644
--- a/gs/base/gsicc_lcms.c
+++ b/gs/base/gsicc_lcms.c
@@ -109,7 +109,6 @@ gscms_get_profile_handle_mem(unsigned char *buffer, unsigned int input_size)
return(cmsOpenProfileFromMem(buffer,input_size));
}
-
/* Get ICC Profile handle from file ptr */
gcmmhprofile_t
gscms_get_profile_handle_file(const char *filename)
@@ -347,7 +346,6 @@ gscms_release_link(gsicc_link_t *icclink)
cmsDeleteTransform(icclink->link_handle);
}
-
/* Have the CMS release the profile handle */
void
gscms_release_profile(void *profile)
@@ -359,7 +357,6 @@ gscms_release_profile(void *profile)
notok = cmsCloseProfile(profile_handle);
}
-
/* Named color, color management */
/* Get a device value for the named color. Since there exist named color
ICC profiles and littleCMS supports them, we will use
diff --git a/gs/base/gsicc_lcms2.c b/gs/base/gsicc_lcms2.c
index 3294e1309..d6054d38e 100644
--- a/gs/base/gsicc_lcms2.c
+++ b/gs/base/gsicc_lcms2.c
@@ -25,7 +25,6 @@
typedef struct gsicc_lcms2_link_s gsicc_lcms2_link_t;
-
/* Only provide warning about issues in lcms if debug build */
static void
gscms_error(cmsContext ContextID,
@@ -70,17 +69,17 @@ void gs_lcms2_free(cmsContext id, void *ptr)
static cmsPluginMemHandler gs_cms_memhandler =
{
- {
- cmsPluginMagicNumber,
- 2000,
- cmsPluginMemHandlerSig,
- NULL
- },
- gs_lcms2_malloc,
- gs_lcms2_free,
- gs_lcms2_realloc,
- NULL,
- NULL,
+ {
+ cmsPluginMagicNumber,
+ 2000,
+ cmsPluginMemHandlerSig,
+ NULL
+ },
+ gs_lcms2_malloc,
+ gs_lcms2_free,
+ gs_lcms2_realloc,
+ NULL,
+ NULL,
NULL
};
@@ -171,7 +170,6 @@ gscms_get_profile_handle_mem(unsigned char *buffer, unsigned int input_size)
return(cmsOpenProfileFromMem(buffer,input_size));
}
-
/* Get ICC Profile handle from file ptr */
gcmmhprofile_t
gscms_get_profile_handle_file(const char *filename)
@@ -409,7 +407,6 @@ gscms_release_link(gsicc_link_t *icclink)
cmsDeleteTransform(icclink->link_handle);
}
-
/* Have the CMS release the profile handle */
void
gscms_release_profile(void *profile)
@@ -421,7 +418,6 @@ gscms_release_profile(void *profile)
notok = cmsCloseProfile(profile_handle);
}
-
/* Named color, color management */
/* Get a device value for the named color. Since there exist named color
ICC profiles and littleCMS supports them, we will use
diff --git a/gs/base/gsicc_manage.c b/gs/base/gsicc_manage.c
index 213b6e7f1..2c5a6da2b 100644
--- a/gs/base/gsicc_manage.c
+++ b/gs/base/gsicc_manage.c
@@ -70,7 +70,6 @@ static int64_t gsicc_search_icc_table(clist_icctable_t *icc_table,
static int gsicc_load_namedcolor_buffer(cmm_profile_t *profile, stream *s,
gs_memory_t *memory);
-
/* profile data structure */
/* profile_handle should NOT be garbage collected since it is allocated by the external CMS */
gs_private_st_ptrs2(st_gsicc_colorname, gsicc_colorname_t, "gsicc_colorname",
@@ -195,7 +194,6 @@ gsicc_new_iccsmask(gs_memory_t *memory)
return(result);
}
-
/* Allocate a new structure to hold the profiles that contains the profiles
used when we are in a softmask group */
int
@@ -1083,7 +1081,6 @@ gsicc_manager_new(gs_memory_t *memory)
return(result);
}
-
static void
rc_gsicc_manager_free(gs_memory_t * mem, void *ptr_in, client_name_t cname)
{
diff --git a/gs/base/gsicc_manage.h b/gs/base/gsicc_manage.h
index dd7ac86eb..c314f02ff 100644
--- a/gs/base/gsicc_manage.h
+++ b/gs/base/gsicc_manage.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,37 +45,36 @@ void gsicc_profile_reference(cmm_profile_t *icc_profile, int delta);
int gsicc_getsrc_channel_count(cmm_profile_t *icc_profile);
int gsicc_init_iccmanager(gs_state * pgs);
int gsicc_init_gs_colors(gs_state *pgs);
-void gsicc_profile_serialize(gsicc_serialized_profile_t *profile_data,
+void gsicc_profile_serialize(gsicc_serialized_profile_t *profile_data,
cmm_profile_t *iccprofile);
int gsicc_init_device_profile(const gs_state *pgs, gx_device * dev);
-int gsicc_set_profile(gsicc_manager_t *icc_manager, const char *pname,
+int gsicc_set_profile(gsicc_manager_t *icc_manager, const char *pname,
int namelen, gsicc_profile_t defaulttype);
-cmm_profile_t* gsicc_get_profile_handle_file(const char* pname, int namelen,
+cmm_profile_t* gsicc_get_profile_handle_file(const char* pname, int namelen,
gs_memory_t *mem);
void gsicc_init_profile_info(cmm_profile_t *profile);
gsicc_manager_t* gsicc_manager_new(gs_memory_t *memory);
-cmm_profile_t* gsicc_profile_new(stream *s, gs_memory_t *memory,
+cmm_profile_t* gsicc_profile_new(stream *s, gs_memory_t *memory,
const char* pname, int namelen);
-int gsicc_set_gscs_profile(gs_color_space *pcs, cmm_profile_t *icc_profile,
+int gsicc_set_gscs_profile(gs_color_space *pcs, cmm_profile_t *icc_profile,
gs_memory_t * mem);
-cmm_profile_t* gsicc_get_gscs_profile(gs_color_space *gs_colorspace,
+cmm_profile_t* gsicc_get_gscs_profile(gs_color_space *gs_colorspace,
gsicc_manager_t *icc_manager);
void gsicc_init_hash_cs(cmm_profile_t *picc_profile, gs_imager_state *pis);
-gcmmhprofile_t gsicc_get_profile_handle_clist(cmm_profile_t *picc_profile,
+gcmmhprofile_t gsicc_get_profile_handle_clist(cmm_profile_t *picc_profile,
gs_memory_t *memory);
-gcmmhprofile_t gsicc_get_profile_handle_buffer(unsigned char *buffer,
+gcmmhprofile_t gsicc_get_profile_handle_buffer(unsigned char *buffer,
int profile_size);
-void gsicc_set_icc_directory(const gs_imager_state *pis, const char* pname,
+void gsicc_set_icc_directory(const gs_imager_state *pis, const char* pname,
int namelen);
gsicc_smask_t* gsicc_new_iccsmask(gs_memory_t *memory);
int gsicc_initialize_iccsmask(gsicc_manager_t *icc_manager);
unsigned int gsicc_getprofilesize(unsigned char *buffer);
cmm_profile_t* gsicc_read_serial_icc(gx_device * dev, int64_t icc_hashcode);
-cmm_profile_t* gsicc_finddevicen(const gs_color_space *pcs,
+cmm_profile_t* gsicc_finddevicen(const gs_color_space *pcs,
gsicc_manager_t *icc_manager);
gs_color_space_index gsicc_get_default_type(cmm_profile_t *profile_data);
#if ICC_DUMP
static void dump_icc_buffer(int buffersize, char filename[],byte *Buffer);
#endif
#endif
-
diff --git a/gs/base/gsicc_profilecache.c b/gs/base/gsicc_profilecache.c
index 3aad8d3ce..fcf01bdd7 100644
--- a/gs/base/gsicc_profilecache.c
+++ b/gs/base/gsicc_profilecache.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,7 +18,7 @@
#include "stdpre.h"
#include "gstypes.h"
#include "gsmemory.h"
-#include "gsstruct.h"
+#include "gsstruct.h"
#include "scommon.h"
#include "gx.h"
#include "gzstate.h"
@@ -26,18 +26,18 @@
#include "gsicc_profilecache.h"
#include "gserrors.h"
-#define ICC_CACHE_MAXPROFILE 50
+#define ICC_CACHE_MAXPROFILE 50
/* Static prototypes */
-static void rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in,
+static void rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in,
client_name_t cname);
static void gsicc_remove_cs_entry(gsicc_profile_cache_t *profile_cache);
-gs_private_st_ptrs2(st_profile_entry, gsicc_profile_entry_t,
- "gsicc_profile_entry", profile_entry_enum_ptrs,
+gs_private_st_ptrs2(st_profile_entry, gsicc_profile_entry_t,
+ "gsicc_profile_entry", profile_entry_enum_ptrs,
profile_entry_reloc_ptrs, color_space, next);
-gs_private_st_ptrs1(st_profile_cache, gsicc_profile_cache_t,
- "gsicc_profile_cache", profile_list_enum_ptrs,
+gs_private_st_ptrs1(st_profile_cache, gsicc_profile_cache_t,
+ "gsicc_profile_cache", profile_list_enum_ptrs,
profile_list_reloc_ptrs, head);
/**
@@ -49,9 +49,9 @@ gsicc_profilecache_new(gs_memory_t *memory)
{
gsicc_profile_cache_t *result;
- /* We want this to be maintained in stable_memory. It should not be effected by the
+ /* We want this to be maintained in stable_memory. It should not be effected by the
save and restores */
- result = gs_alloc_struct(memory->stable_memory, gsicc_profile_cache_t,
+ result = gs_alloc_struct(memory->stable_memory, gsicc_profile_cache_t,
&st_profile_cache, "gsicc_profilecache_new");
if ( result == NULL )
return(NULL);
@@ -70,18 +70,18 @@ rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname
while (curr != NULL ){
rc_decrement(curr->color_space, "rc_gsicc_profile_cache_free");
- gs_free_object(mem->stable_memory, curr,
+ gs_free_object(mem->stable_memory, curr,
"rc_gsicc_profile_cache_free");
profile_cache->num_entries--;
curr = curr->next;
}
#ifdef DEBUG
if (profile_cache->num_entries != 0)
- eprintf1("gsicc_profile_cache_free, num_entries is %d (should be 0).\n",
- profile_cache->num_entries);
+ eprintf1("gsicc_profile_cache_free, num_entries is %d (should be 0).\n",
+ profile_cache->num_entries);
#endif
- gs_free_object(mem->stable_memory, profile_cache,
- "rc_gsicc_profile_cache_free");
+ gs_free_object(mem->stable_memory, profile_cache,
+ "rc_gsicc_profile_cache_free");
}
void
@@ -93,7 +93,7 @@ gsicc_add_cs(gs_state * pgs, gs_color_space * colorspace, ulong dictkey)
/* The entry has to be added in stable memory. We want them
to be maintained across the gsave and grestore process */
- result = gs_alloc_struct(memory->stable_memory, gsicc_profile_entry_t,
+ result = gs_alloc_struct(memory->stable_memory, gsicc_profile_entry_t,
&st_profile_entry, "gsicc_add_cs");
/* If needed, remove an entry (the last one) */
if (profile_cache->num_entries >= ICC_CACHE_MAXPROFILE) {
@@ -120,11 +120,11 @@ gsicc_find_cs(ulong key_test, gs_state * pgs)
if (curr->key == key_test){
/* If not already at head of list, move this one there */
if (curr != profile_cache->head) {
- /* We need to move found one to the top of the list. */
- prev->next = curr->next;
- curr->next = profile_cache->head;
- profile_cache->head = curr;
- }
+ /* We need to move found one to the top of the list. */
+ prev->next = curr->next;
+ curr->next = profile_cache->head;
+ profile_cache->head = curr;
+ }
return(curr->color_space);
}
prev = curr;
@@ -144,13 +144,13 @@ gsicc_remove_cs_entry(gsicc_profile_cache_t *profile_cache)
#ifdef DEBUG
if (curr == NULL) {
- eprintf(" attempt to remove from an empty profile cache.\n");
- return; /* gs_abort(); */
+ eprintf(" attempt to remove from an empty profile cache.\n");
+ return; /* gs_abort(); */
}
#endif
while (curr->next != NULL) {
prev = curr;
- curr = curr->next;
+ curr = curr->next;
}
profile_cache->num_entries--;
if (prev == NULL) {
@@ -158,15 +158,15 @@ gsicc_remove_cs_entry(gsicc_profile_cache_t *profile_cache)
profile_cache->head = NULL;
#ifdef DEBUG
if (profile_cache->num_entries != 0) {
- eprintf1("profile cache list empty, but list has num_entries=%d.\n",
- profile_cache->num_entries);
+ eprintf1("profile cache list empty, but list has num_entries=%d.\n",
+ profile_cache->num_entries);
}
#endif
} else {
- prev->next = NULL; /* new tail */
+ prev->next = NULL; /* new tail */
}
/* Decremented, but someone could still be referencing this */
- /* If found again in the source document, it will be regenerated
+ /* If found again in the source document, it will be regenerated
and added back into the cache. */
rc_decrement(curr->color_space, "gsicc_remove_cs_entry");
gs_free_object(memory->stable_memory, curr, "gsicc_remove_cs_entry");
diff --git a/gs/base/gsicc_profilecache.h b/gs/base/gsicc_profilecache.h
index 94b5f6e33..4f65f02bb 100644
--- a/gs/base/gsicc_profilecache.h
+++ b/gs/base/gsicc_profilecache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,11 +11,9 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
/* Header for the profile cache. Not really a cache but a double linked
list for now. We need to see what is going to work best for this. */
-
#ifndef gsicc_profilecache_INCLUDED
# define gsicc_profilecache_INCLUDED
@@ -24,4 +22,3 @@ gs_color_space* gsicc_find_cs(ulong key_test, gs_state * pgs);
void gsicc_add_cs(gs_state * pgs, gs_color_space * pcs, ulong dictkey);
#endif
-
diff --git a/gs/base/gsimage.c b/gs/base/gsimage.c
index bc8debd3d..665d11076 100644
--- a/gs/base/gsimage.c
+++ b/gs/base/gsimage.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -100,7 +100,7 @@ struct gs_image_enum_s {
bool wanted_varies;
/* The following are updated dynamically. */
int plane_index; /* index of next plane of data, */
- /* only needed for gs_image_next */
+ /* only needed for gs_image_next */
int y;
bool error;
byte wanted[GS_IMAGE_MAX_COMPONENTS]; /* cache gx_image_planes_wanted */
@@ -117,20 +117,20 @@ struct gs_image_enum_s {
};
gs_private_st_composite(st_gs_image_enum, gs_image_enum, "gs_image_enum",
- gs_image_enum_enum_ptrs, gs_image_enum_reloc_ptrs);
+ gs_image_enum_enum_ptrs, gs_image_enum_reloc_ptrs);
#define gs_image_enum_num_ptrs 2
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(gs_image_enum_enum_ptrs, gs_image_enum *eptr)
{
/* Enumerate the data planes. */
index -= gs_image_enum_num_ptrs;
if (index < eptr->num_planes)
- ENUM_RETURN_STRING_PTR(gs_image_enum, planes[index].source);
+ ENUM_RETURN_STRING_PTR(gs_image_enum, planes[index].source);
index -= eptr->num_planes;
if (index < eptr->num_planes)
- ENUM_RETURN_STRING_PTR(gs_image_enum, planes[index].row);
+ ENUM_RETURN_STRING_PTR(gs_image_enum, planes[index].row);
return 0;
}
ENUM_PTR(0, gs_image_enum, dev);
@@ -143,31 +143,31 @@ static RELOC_PTRS_WITH(gs_image_enum_reloc_ptrs, gs_image_enum *eptr)
RELOC_PTR(gs_image_enum, dev);
RELOC_PTR(gs_image_enum, info);
for (i = 0; i < eptr->num_planes; i++)
- RELOC_CONST_STRING_PTR(gs_image_enum, planes[i].source);
+ RELOC_CONST_STRING_PTR(gs_image_enum, planes[i].source);
for (i = 0; i < eptr->num_planes; i++)
- RELOC_STRING_PTR(gs_image_enum, planes[i].row);
+ RELOC_STRING_PTR(gs_image_enum, planes[i].row);
}
RELOC_PTRS_END
static int
is_image_visible(const gs_image_common_t * pic, gs_state * pgs, gx_clip_path *pcpath)
{
- /* HACK : We need the source image size here,
+ /* HACK : We need the source image size here,
but gs_image_common_t doesn't pass it.
We would like to move Width, Height to gs_image_common,
but gs_image2_t appears to have those fields of double type.
*/
if (pic->type->begin_typed_image == gx_begin_image1) {
- gs_image1_t *pim = (gs_image1_t *) pic;
- gs_rect image_rect = {{0, 0}, {0, 0}};
- gs_rect device_rect;
- gs_int_rect device_int_rect;
- gs_matrix mat;
- int code;
-
- image_rect.q.x = pim->Width;
- image_rect.q.y = pim->Height;
- if (pic->ImageMatrix.xx == ctm_only(pgs).xx &&
+ gs_image1_t *pim = (gs_image1_t *) pic;
+ gs_rect image_rect = {{0, 0}, {0, 0}};
+ gs_rect device_rect;
+ gs_int_rect device_int_rect;
+ gs_matrix mat;
+ int code;
+
+ image_rect.q.x = pim->Width;
+ image_rect.q.y = pim->Height;
+ if (pic->ImageMatrix.xx == ctm_only(pgs).xx &&
pic->ImageMatrix.xy == ctm_only(pgs).xy &&
pic->ImageMatrix.yx == ctm_only(pgs).yx &&
pic->ImageMatrix.yy == ctm_only(pgs).yy) {
@@ -178,21 +178,21 @@ is_image_visible(const gs_image_common_t * pic, gs_state * pgs, gx_clip_path *pc
mat.ty = ctm_only(pgs).ty - pic->ImageMatrix.ty;
} else {
code = gs_matrix_invert(&pic->ImageMatrix, &mat);
- if (code < 0)
- return code;
- code = gs_matrix_multiply(&mat, &ctm_only(pgs), &mat);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
+ code = gs_matrix_multiply(&mat, &ctm_only(pgs), &mat);
+ if (code < 0)
+ return code;
}
- code = gs_bbox_transform(&image_rect, &mat, &device_rect);
- if (code < 0)
- return code;
- device_int_rect.p.x = (int)floor(device_rect.p.x);
- device_int_rect.p.y = (int)floor(device_rect.p.y);
- device_int_rect.q.x = (int)ceil(device_rect.q.x);
- device_int_rect.q.y = (int)ceil(device_rect.q.y);
- if (!gx_cpath_rect_visible(pcpath, &device_int_rect))
- return 0;
+ code = gs_bbox_transform(&image_rect, &mat, &device_rect);
+ if (code < 0)
+ return code;
+ device_int_rect.p.x = (int)floor(device_rect.p.x);
+ device_int_rect.p.y = (int)floor(device_rect.p.y);
+ device_int_rect.q.x = (int)ceil(device_rect.q.x);
+ device_int_rect.q.y = (int)ceil(device_rect.q.y);
+ if (!gx_cpath_rect_visible(pcpath, &device_int_rect))
+ return 0;
}
return 1;
}
@@ -200,7 +200,7 @@ is_image_visible(const gs_image_common_t * pic, gs_state * pgs, gx_clip_path *pc
/* Create an image enumerator given image parameters and a graphics state. */
int
gs_image_begin_typed(const gs_image_common_t * pic, gs_state * pgs,
- bool uses_color, gx_image_enum_common_t ** ppie)
+ bool uses_color, gx_image_enum_common_t ** ppie)
{
gx_device *dev = gs_currentdevice(pgs);
gx_clip_path *pcpath;
@@ -209,43 +209,43 @@ gs_image_begin_typed(const gs_image_common_t * pic, gs_state * pgs,
gx_device_color dc_temp, *pdevc = gs_currentdevicecolor_inline(pgs);
if (code < 0)
- return code;
+ return code;
/* Processing an image object operation */
gs_set_object_tag((gs_imager_state*) pgs, GS_IMAGE_TAG);
if (uses_color) {
- gx_set_dev_color(pgs);
+ gx_set_dev_color(pgs);
code = gs_state_color_load(pgs);
if (code < 0)
- return code;
+ return code;
}
/* Imagemask with shading color needs a special optimization
- with converting the image into a clipping.
+ with converting the image into a clipping.
Check for such case after gs_state_color_load is done,
because it can cause interpreter callout.
*/
if (pic->type->begin_typed_image == &gx_begin_image1) {
- gs_image_t *image = (gs_image_t *)pic;
-
- if(image->ImageMask) {
- code = gx_image_fill_masked_start(dev, gs_currentdevicecolor_inline(pgs), pcpath, pgs->memory, &dev2);
- if (code < 0)
- return code;
- }
- if (dev2 != dev) {
- set_nonclient_dev_color(&dc_temp, 1);
- pdevc = &dc_temp;
- }
+ gs_image_t *image = (gs_image_t *)pic;
+
+ if(image->ImageMask) {
+ code = gx_image_fill_masked_start(dev, gs_currentdevicecolor_inline(pgs), pcpath, pgs->memory, &dev2);
+ if (code < 0)
+ return code;
+ }
+ if (dev2 != dev) {
+ set_nonclient_dev_color(&dc_temp, 1);
+ pdevc = &dc_temp;
+ }
}
code = gx_device_begin_typed_image(dev2, (const gs_imager_state *)pgs,
- NULL, pic, NULL, pdevc, pcpath, pgs->memory, ppie);
+ NULL, pic, NULL, pdevc, pcpath, pgs->memory, ppie);
if (code < 0)
- return code;
+ return code;
code = is_image_visible(pic, pgs, pcpath);
if (code < 0)
- return code;
- if (!code)
- (*ppie)->skipping = true;
+ return code;
+ if (!code)
+ (*ppie)->skipping = true;
return 0;
}
@@ -263,11 +263,11 @@ gs_image_enum *
gs_image_enum_alloc(gs_memory_t * mem, client_name_t cname)
{
gs_image_enum *penum =
- gs_alloc_struct(mem, gs_image_enum, &st_gs_image_enum, cname);
+ gs_alloc_struct(mem, gs_image_enum, &st_gs_image_enum, cname);
if (penum != 0) {
- penum->memory = mem;
- image_enum_init(penum);
+ penum->memory = mem;
+ image_enum_init(penum);
}
return penum;
}
@@ -275,7 +275,7 @@ gs_image_enum_alloc(gs_memory_t * mem, client_name_t cname)
/* Start processing an ImageType 1 image. */
int
gs_image_init(gs_image_enum * penum, const gs_image_t * pim, bool multi,
- gs_state * pgs)
+ gs_state * pgs)
{
gs_image_t image;
gx_image_enum_common_t *pie;
@@ -283,27 +283,27 @@ gs_image_init(gs_image_enum * penum, const gs_image_t * pim, bool multi,
image = *pim;
if (image.ImageMask) {
- image.ColorSpace = NULL;
- if (pgs->in_cachedevice <= 1)
- image.adjust = false;
+ image.ColorSpace = NULL;
+ if (pgs->in_cachedevice <= 1)
+ image.adjust = false;
} else {
- if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
- if (image.ColorSpace == NULL) {
+ if (pgs->in_cachedevice)
+ return_error(gs_error_undefined);
+ if (image.ColorSpace == NULL) {
/*
* Use of a non-current color space is potentially
* incorrect, but it appears this case doesn't arise.
*/
- image.ColorSpace = gs_cspace_new_DeviceGray(pgs->memory);
+ image.ColorSpace = gs_cspace_new_DeviceGray(pgs->memory);
}
}
code = gs_image_begin_typed((const gs_image_common_t *)&image, pgs,
- image.ImageMask | image.CombineWithColor,
- &pie);
+ image.ImageMask | image.CombineWithColor,
+ &pie);
if (code < 0)
- return code;
+ return code;
return gs_image_enum_init(penum, pie, (const gs_data_image_t *)&image,
- pgs);
+ pgs);
}
/*
@@ -324,14 +324,14 @@ cache_planes(gs_image_enum *penum)
int i;
if (penum->wanted_varies) {
- penum->wanted_varies =
- !gx_image_planes_wanted(penum->info, penum->wanted);
- for (i = 0; i < penum->num_planes; ++i)
- if (penum->wanted[i])
- penum->image_planes[i].raster =
- gs_image_bytes_per_plane_row(penum, i);
- else
- penum->image_planes[i].data = 0;
+ penum->wanted_varies =
+ !gx_image_planes_wanted(penum->info, penum->wanted);
+ for (i = 0; i < penum->num_planes; ++i)
+ if (penum->wanted[i])
+ penum->image_planes[i].raster =
+ gs_image_bytes_per_plane_row(penum, i);
+ else
+ penum->image_planes[i].data = 0;
}
}
/* Advance to the next wanted plane. */
@@ -341,8 +341,8 @@ next_plane(gs_image_enum *penum)
int px = penum->plane_index;
do {
- if (++px == penum->num_planes)
- px = 0;
+ if (++px == penum->num_planes)
+ px = 0;
} while (!penum->wanted[px]);
penum->plane_index = px;
}
@@ -360,18 +360,18 @@ begin_planes(gs_image_enum *penum)
int
gs_image_common_init(gs_image_enum * penum, gx_image_enum_common_t * pie,
- const gs_data_image_t * pim, gx_device * dev)
+ const gs_data_image_t * pim, gx_device * dev)
{
/*
* HACK : For a compatibility with gs_image_cleanup_and_free_enum,
- * penum->memory must be initialized in advance
+ * penum->memory must be initialized in advance
* with the memory heap that owns *penum.
*/
int i;
if (pim->Width == 0 || pim->Height == 0) {
- gx_image_end(pie, false);
- return 1;
+ gx_image_end(pie, false);
+ return 1;
}
image_enum_init(penum);
penum->dev = dev;
@@ -387,12 +387,12 @@ gs_image_common_init(gs_image_enum * penum, gx_image_enum_common_t * pie,
*/
penum->height = pim->Height;
for (i = 0; i < pie->num_planes; ++i) {
- penum->planes[i].pos = 0;
- penum->planes[i].source.size = 0; /* for gs_image_next_planes */
- penum->planes[i].source.data = 0; /* for GC */
+ penum->planes[i].pos = 0;
+ penum->planes[i].source.size = 0; /* for gs_image_next_planes */
+ penum->planes[i].source.data = 0; /* for GC */
penum->planes[i].row.data = 0; /* for GC */
- penum->planes[i].row.size = 0; /* ditto */
- penum->image_planes[i].data_x = 0; /* just init once, never changes */
+ penum->planes[i].row.size = 0; /* ditto */
+ penum->image_planes[i].data_x = 0; /* just init once, never changes */
}
/* Initialize the dynamic part of the state. */
penum->y = 0;
@@ -402,17 +402,17 @@ gs_image_common_init(gs_image_enum * penum, gx_image_enum_common_t * pie,
return 0;
}
-/* Initialize an enumerator for a general image.
+/* Initialize an enumerator for a general image.
penum->memory must be initialized in advance.
*/
int
gs_image_enum_init(gs_image_enum * penum, gx_image_enum_common_t * pie,
- const gs_data_image_t * pim, gs_state *pgs)
+ const gs_data_image_t * pim, gs_state *pgs)
{
pgs->device->sgr.stroke_stored = false;
return gs_image_common_init(penum, pie, pim,
- (pgs->in_charpath ? NULL :
- gs_currentdevice_inline(pgs)));
+ (pgs->in_charpath ? NULL :
+ gs_currentdevice_inline(pgs)));
}
/* Return the set of planes wanted. */
@@ -426,10 +426,10 @@ gs_image_planes_wanted(gs_image_enum *penum)
* underlying machinery and has no buffered or retained data.
*/
for (i = 0; i < penum->num_planes; ++i)
- penum->client_wanted[i] =
- (penum->wanted[i] &&
- penum->planes[i].pos + penum->planes[i].source.size <
- penum->image_planes[i].raster);
+ penum->client_wanted[i] =
+ (penum->wanted[i] &&
+ penum->planes[i].pos + penum->planes[i].source.size <
+ penum->image_planes[i].raster);
return penum->client_wanted;
}
@@ -451,20 +451,20 @@ free_row_buffers(gs_image_enum *penum, int num_planes, client_name_t cname)
int i;
for (i = num_planes - 1; i >= 0; --i) {
- if_debug3('b', "[b]free plane %d row (0x%lx,%u)\n",
- i, (ulong)penum->planes[i].row.data,
- penum->planes[i].row.size);
- gs_free_string(gs_image_row_memory(penum), penum->planes[i].row.data,
- penum->planes[i].row.size, cname);
- penum->planes[i].row.data = 0;
- penum->planes[i].row.size = 0;
+ if_debug3('b', "[b]free plane %d row (0x%lx,%u)\n",
+ i, (ulong)penum->planes[i].row.data,
+ penum->planes[i].row.size);
+ gs_free_string(gs_image_row_memory(penum), penum->planes[i].row.data,
+ penum->planes[i].row.size, cname);
+ penum->planes[i].row.data = 0;
+ penum->planes[i].row.size = 0;
}
}
/* Process the next piece of an image. */
int
gs_image_next(gs_image_enum * penum, const byte * dbytes, uint dsize,
- uint * pused)
+ uint * pused)
{
int px = penum->plane_index;
int num_planes = penum->num_planes;
@@ -473,23 +473,23 @@ gs_image_next(gs_image_enum * penum, const byte * dbytes, uint dsize,
gs_const_string plane_data[GS_IMAGE_MAX_COMPONENTS];
if (penum->planes[px].source.size != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
for (i = 0; i < num_planes; i++)
- plane_data[i].size = 0;
+ plane_data[i].size = 0;
plane_data[px].data = dbytes;
plane_data[px].size = dsize;
penum->error = false;
code = gs_image_next_planes(penum, plane_data, used);
*pused = used[px];
if (code >= 0)
- next_plane(penum);
+ next_plane(penum);
return code;
}
int
gs_image_next_planes(gs_image_enum * penum,
- gs_const_string *plane_data /*[num_planes]*/,
- uint *used /*[num_planes]*/)
+ gs_const_string *plane_data /*[num_planes]*/,
+ uint *used /*[num_planes]*/)
{
const int num_planes = penum->num_planes;
int i;
@@ -501,135 +501,135 @@ gs_image_next_planes(gs_image_enum * penum,
vd_set_scale(0.01);
vd_set_origin(0, 0);
if (gs_debug_c('b')) {
- int pi;
+ int pi;
- for (pi = 0; pi < num_planes; ++pi)
- dprintf6("[b]plane %d source=0x%lx,%u pos=%u data=0x%lx,%u\n",
- pi, (ulong)penum->planes[pi].source.data,
- penum->planes[pi].source.size, penum->planes[pi].pos,
- (ulong)plane_data[pi].data, plane_data[pi].size);
+ for (pi = 0; pi < num_planes; ++pi)
+ dprintf6("[b]plane %d source=0x%lx,%u pos=%u data=0x%lx,%u\n",
+ pi, (ulong)penum->planes[pi].source.data,
+ penum->planes[pi].source.size, penum->planes[pi].pos,
+ (ulong)plane_data[pi].data, plane_data[pi].size);
}
#endif
for (i = 0; i < num_planes; ++i) {
used[i] = 0;
- if (penum->wanted[i] && plane_data[i].size != 0) {
- penum->planes[i].source.size = plane_data[i].size;
- penum->planes[i].source.data = plane_data[i].data;
- }
+ if (penum->wanted[i] && plane_data[i].size != 0) {
+ penum->planes[i].source.size = plane_data[i].size;
+ penum->planes[i].source.data = plane_data[i].data;
+ }
}
for (;;) {
- /* If wanted can vary, only transfer 1 row at a time. */
- int h = (penum->wanted_varies ? 1 : max_int);
-
- /* Move partial rows from source[] to row[]. */
- for (i = 0; i < num_planes; ++i) {
- int pos, size;
- uint raster;
-
- if (!penum->wanted[i])
- continue; /* skip unwanted planes */
- pos = penum->planes[i].pos;
- size = penum->planes[i].source.size;
- raster = penum->image_planes[i].raster;
- if (size > 0) {
- if (pos < raster && (pos != 0 || size < raster)) {
- /* Buffer a partial row. */
- int copy = min(size, raster - pos);
- uint old_size = penum->planes[i].row.size;
-
- /* Make sure the row buffer is fully allocated. */
- if (raster > old_size) {
- gs_memory_t *mem = gs_image_row_memory(penum);
- byte *old_data = penum->planes[i].row.data;
- byte *row =
- (old_data == 0 ?
- gs_alloc_string(mem, raster,
- "gs_image_next(row)") :
- gs_resize_string(mem, old_data, old_size, raster,
- "gs_image_next(row)"));
-
- if_debug5('b', "[b]plane %d row (0x%lx,%u) => (0x%lx,%u)\n",
- i, (ulong)old_data, old_size,
- (ulong)row, raster);
- if (row == 0) {
- code = gs_note_error(gs_error_VMerror);
- free_row_buffers(penum, i, "gs_image_next(row)");
- break;
- }
- penum->planes[i].row.data = row;
- penum->planes[i].row.size = raster;
- }
- memcpy(penum->planes[i].row.data + pos,
- penum->planes[i].source.data, copy);
- penum->planes[i].source.data += copy;
- penum->planes[i].source.size = size -= copy;
- penum->planes[i].pos = pos += copy;
- used[i] += copy;
- }
- }
- if (h == 0)
- continue; /* can't transfer any data this cycle */
- if (pos == raster) {
- /*
- * This plane will be transferred from the row buffer,
- * so we can only transfer one row.
- */
- h = min(h, 1);
- penum->image_planes[i].data = penum->planes[i].row.data;
- } else if (pos == 0 && size >= raster) {
- /* We can transfer 1 or more planes from the source. */
- h = min(h, size / raster);
- penum->image_planes[i].data = penum->planes[i].source.data;
- } else
- h = 0; /* not enough data in this plane */
- }
- if (h == 0 || code != 0)
- break;
- /* Pass rows to the device. */
- if (penum->dev == 0) {
- /*
- * ****** NOTE: THE FOLLOWING IS NOT CORRECT FOR ImageType 3
- * ****** InterleaveType 2, SINCE MASK HEIGHT AND IMAGE HEIGHT
- * ****** MAY DIFFER (BY AN INTEGER FACTOR). ALSO, plane_depths[0]
- * ****** AND plane_widths[0] ARE NOT UPDATED.
- */
- if (penum->y + h < penum->height)
- code = 0;
- else
- h = penum->height - penum->y, code = 1;
- } else {
- code = gx_image_plane_data_rows(penum->info, penum->image_planes,
- h, &h);
- if_debug2('b', "[b]used %d, code=%d\n", h, code);
- penum->error = code < 0;
- }
- penum->y += h;
- /* Update positions and sizes. */
- if (h == 0)
- break;
- for (i = 0; i < num_planes; ++i) {
- int count;
-
- if (!penum->wanted[i])
- continue;
- count = penum->image_planes[i].raster * h;
- if (penum->planes[i].pos) {
- /* We transferred the row from the row buffer. */
- penum->planes[i].pos = 0;
- } else {
- /* We transferred the row(s) from the source. */
- penum->planes[i].source.data += count;
- penum->planes[i].source.size -= count;
- used[i] += count;
- }
- }
- cache_planes(penum);
- if (code > 0)
- break;
+ /* If wanted can vary, only transfer 1 row at a time. */
+ int h = (penum->wanted_varies ? 1 : max_int);
+
+ /* Move partial rows from source[] to row[]. */
+ for (i = 0; i < num_planes; ++i) {
+ int pos, size;
+ uint raster;
+
+ if (!penum->wanted[i])
+ continue; /* skip unwanted planes */
+ pos = penum->planes[i].pos;
+ size = penum->planes[i].source.size;
+ raster = penum->image_planes[i].raster;
+ if (size > 0) {
+ if (pos < raster && (pos != 0 || size < raster)) {
+ /* Buffer a partial row. */
+ int copy = min(size, raster - pos);
+ uint old_size = penum->planes[i].row.size;
+
+ /* Make sure the row buffer is fully allocated. */
+ if (raster > old_size) {
+ gs_memory_t *mem = gs_image_row_memory(penum);
+ byte *old_data = penum->planes[i].row.data;
+ byte *row =
+ (old_data == 0 ?
+ gs_alloc_string(mem, raster,
+ "gs_image_next(row)") :
+ gs_resize_string(mem, old_data, old_size, raster,
+ "gs_image_next(row)"));
+
+ if_debug5('b', "[b]plane %d row (0x%lx,%u) => (0x%lx,%u)\n",
+ i, (ulong)old_data, old_size,
+ (ulong)row, raster);
+ if (row == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ free_row_buffers(penum, i, "gs_image_next(row)");
+ break;
+ }
+ penum->planes[i].row.data = row;
+ penum->planes[i].row.size = raster;
+ }
+ memcpy(penum->planes[i].row.data + pos,
+ penum->planes[i].source.data, copy);
+ penum->planes[i].source.data += copy;
+ penum->planes[i].source.size = size -= copy;
+ penum->planes[i].pos = pos += copy;
+ used[i] += copy;
+ }
+ }
+ if (h == 0)
+ continue; /* can't transfer any data this cycle */
+ if (pos == raster) {
+ /*
+ * This plane will be transferred from the row buffer,
+ * so we can only transfer one row.
+ */
+ h = min(h, 1);
+ penum->image_planes[i].data = penum->planes[i].row.data;
+ } else if (pos == 0 && size >= raster) {
+ /* We can transfer 1 or more planes from the source. */
+ h = min(h, size / raster);
+ penum->image_planes[i].data = penum->planes[i].source.data;
+ } else
+ h = 0; /* not enough data in this plane */
+ }
+ if (h == 0 || code != 0)
+ break;
+ /* Pass rows to the device. */
+ if (penum->dev == 0) {
+ /*
+ * ****** NOTE: THE FOLLOWING IS NOT CORRECT FOR ImageType 3
+ * ****** InterleaveType 2, SINCE MASK HEIGHT AND IMAGE HEIGHT
+ * ****** MAY DIFFER (BY AN INTEGER FACTOR). ALSO, plane_depths[0]
+ * ****** AND plane_widths[0] ARE NOT UPDATED.
+ */
+ if (penum->y + h < penum->height)
+ code = 0;
+ else
+ h = penum->height - penum->y, code = 1;
+ } else {
+ code = gx_image_plane_data_rows(penum->info, penum->image_planes,
+ h, &h);
+ if_debug2('b', "[b]used %d, code=%d\n", h, code);
+ penum->error = code < 0;
+ }
+ penum->y += h;
+ /* Update positions and sizes. */
+ if (h == 0)
+ break;
+ for (i = 0; i < num_planes; ++i) {
+ int count;
+
+ if (!penum->wanted[i])
+ continue;
+ count = penum->image_planes[i].raster * h;
+ if (penum->planes[i].pos) {
+ /* We transferred the row from the row buffer. */
+ penum->planes[i].pos = 0;
+ } else {
+ /* We transferred the row(s) from the source. */
+ penum->planes[i].source.data += count;
+ penum->planes[i].source.size -= count;
+ used[i] += count;
+ }
+ }
+ cache_planes(penum);
+ if (code > 0)
+ break;
}
/* Return the retained data pointers. */
for (i = 0; i < num_planes; ++i)
- plane_data[i] = penum->planes[i].source;
+ plane_data[i] = penum->planes[i].source;
vd_release_dc;
return code;
}
@@ -643,17 +643,17 @@ gs_image_cleanup(gs_image_enum * penum, gs_state *pgs)
free_row_buffers(penum, penum->num_planes, "gs_image_cleanup(row)");
if (penum->info != 0) {
- if (dev_proc(penum->info->dev, dev_spec_op)(penum->info->dev,
- gxdso_pattern_is_cpath_accum, NULL, 0)) {
- /* Performing a conversion of imagemask into a clipping path. */
- gx_device *cdev = penum->info->dev;
-
- code = gx_image_end(penum->info, !penum->error); /* Releases penum->info . */
- code1 = gx_image_fill_masked_end(cdev, penum->dev, gs_currentdevicecolor_inline(pgs));
- if (code == 0)
- code = code1;
- } else
- code = gx_image_end(penum->info, !penum->error);
+ if (dev_proc(penum->info->dev, dev_spec_op)(penum->info->dev,
+ gxdso_pattern_is_cpath_accum, NULL, 0)) {
+ /* Performing a conversion of imagemask into a clipping path. */
+ gx_device *cdev = penum->info->dev;
+
+ code = gx_image_end(penum->info, !penum->error); /* Releases penum->info . */
+ code1 = gx_image_fill_masked_end(cdev, penum->dev, gs_currentdevicecolor_inline(pgs));
+ if (code == 0)
+ code = code1;
+ } else
+ code = gx_image_end(penum->info, !penum->error);
}
/* Don't free the local enumerator -- the client does that. */
@@ -669,4 +669,3 @@ gs_image_cleanup_and_free_enum(gs_image_enum * penum, gs_state *pgs)
gs_free_object(penum->memory, penum, "gs_image_cleanup_and_free_enum");
return code;
}
-
diff --git a/gs/base/gsimage.h b/gs/base/gsimage.h
index c57ef3de1..3e40c8779 100644
--- a/gs/base/gsimage.h
+++ b/gs/base/gsimage.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -118,7 +118,7 @@ typedef struct gx_image_enum_common_s gx_image_enum_common_t;
typedef struct gs_image_enum_s gs_image_enum;
int gs_image_begin_typed(const gs_image_common_t * pic, gs_state * pgs,
- bool uses_color, gx_image_enum_common_t ** ppie);
+ bool uses_color, gx_image_enum_common_t ** ppie);
gs_image_enum *gs_image_enum_alloc(gs_memory_t *, client_name_t);
@@ -138,19 +138,19 @@ typedef struct gx_device_color_s gx_device_color;
/* Initialize the common part of the image class */
int gs_image_common_init(gs_image_enum * penum,
- gx_image_enum_common_t * pie,
- const gs_data_image_t * pim, gx_device * dev);
+ gx_image_enum_common_t * pie,
+ const gs_data_image_t * pim, gx_device * dev);
/* Initialize an enumerator for an ImageType 1 image. */
int gs_image_init(gs_image_enum * penum, const gs_image_t * pim,
- bool MultipleDataSources, gs_state * pgs);
+ bool MultipleDataSources, gs_state * pgs);
-/* Initialize an enumerator for a general image.
+/* Initialize an enumerator for a general image.
penum->memory must be initialized in advance.
*/
int gs_image_enum_init(gs_image_enum * penum,
- gx_image_enum_common_t * pie,
- const gs_data_image_t * pim, gs_state *pgs);
+ gx_image_enum_common_t * pie,
+ const gs_data_image_t * pim, gs_state *pgs);
/*
* Return the number of bytes of data per row
@@ -187,11 +187,11 @@ const byte *gs_image_planes_wanted(gs_image_enum *penum);
* used[] and plane_data[] are set even in the error or end-of-image case.
*/
int gs_image_next_planes(gs_image_enum *penum, gs_const_string *plane_data,
- uint *used);
+ uint *used);
/* Pass the next plane of data for an image. See above for details. */
int gs_image_next(gs_image_enum * penum, const byte * dbytes,
- uint dsize, uint * pused);
+ uint dsize, uint * pused);
/* Clean up after processing an image. */
int gs_image_cleanup(gs_image_enum * penum, gs_state *pgs);
diff --git a/gs/base/gsimpath.c b/gs/base/gsimpath.c
index f3daae66e..581934c1c 100644
--- a/gs/base/gsimpath.c
+++ b/gs/base/gsimpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -61,20 +61,20 @@ gs_imagepath(gs_state * pgs, int width, int height, const byte * data)
/* Trace the cells to form an outline. The trace goes in clockwise */
/* order, always starting by going west along a bottom edge. */
for (y = height - 1; y >= 0; y--)
- for (x = width - 1; x >= 0; x--) {
- if (get_pixel(out, x, y) && !get_pixel(out, x, y - 1) &&
- (!get_pixel(out, x + 1, y) || get_pixel(out, x + 1, y - 1)) &&
- !trace_from(out, x, y, 1)
- ) { /* Found a starting point */
- stat.count = 0;
- stat.dx = stat.dy = 0;
- if ((code = trace_from(out, x, y, 0)) < 0)
- return code;
- add_deltas(out, 0, 0, 1); /* force out last segment */
- if ((code = gs_closepath(pgs)) < 0)
- return code;
- }
- }
+ for (x = width - 1; x >= 0; x--) {
+ if (get_pixel(out, x, y) && !get_pixel(out, x, y - 1) &&
+ (!get_pixel(out, x + 1, y) || get_pixel(out, x + 1, y - 1)) &&
+ !trace_from(out, x, y, 1)
+ ) { /* Found a starting point */
+ stat.count = 0;
+ stat.dx = stat.dy = 0;
+ if ((code = trace_from(out, x, y, 0)) < 0)
+ return code;
+ add_deltas(out, 0, 0, 1); /* force out last segment */
+ if ((code = gs_closepath(pgs)) < 0)
+ return code;
+ }
+ }
return 0;
}
@@ -83,7 +83,7 @@ static int
get_pixel(register const status * out, int x, int y)
{
if (x < 0 || x >= out->width || y < 0 || y >= out->height)
- return 0;
+ return 0;
return (out->data[y * out->raster + (x >> 3)] >> (~x & 7)) & 1;
}
@@ -101,58 +101,58 @@ trace_from(register status * out, int x0, int y0, int detect)
int code;
if (!detect) {
- part = (get_pixel(out, x + 1, y - 1) ?
- outline_scale - step : step);
- code = gs_moveto(out->pgs,
- x + 1 - part / (float)outline_scale,
- (float)y);
- if (code < 0)
- return code;
+ part = (get_pixel(out, x + 1, y - 1) ?
+ outline_scale - step : step);
+ code = gs_moveto(out->pgs,
+ x + 1 - part / (float)outline_scale,
+ (float)y);
+ if (code < 0)
+ return code;
}
while (1) { /* Relative to the current direction, */
- /* -dy,dx is at +90 degrees (counter-clockwise); */
- /* tx,ty is at +45 degrees; */
- /* ty,-tx is at -45 degrees (clockwise); */
- /* dy,-dx is at -90 degrees. */
- int tx = dx - dy, ty = dy + dx;
+ /* -dy,dx is at +90 degrees (counter-clockwise); */
+ /* tx,ty is at +45 degrees; */
+ /* ty,-tx is at -45 degrees (clockwise); */
+ /* dy,-dx is at -90 degrees. */
+ int tx = dx - dy, ty = dy + dx;
- if (get_pixel(out, x + tx, y + ty)) { /* Cell at 45 degrees is full, */
- /* go counter-clockwise. */
- if (!detect) { /* If this is a 90 degree corner set at a */
- /* 45 degree angle, avoid backtracking. */
- if (out->dx == ty && out->dy == -tx) {
+ if (get_pixel(out, x + tx, y + ty)) { /* Cell at 45 degrees is full, */
+ /* go counter-clockwise. */
+ if (!detect) { /* If this is a 90 degree corner set at a */
+ /* 45 degree angle, avoid backtracking. */
+ if (out->dx == ty && out->dy == -tx) {
#define half_scale (outline_scale / 2 - step)
- out->count -= half_scale;
- add_deltas(out, tx, ty, outline_scale / 2);
+ out->count -= half_scale;
+ add_deltas(out, tx, ty, outline_scale / 2);
#undef half_scale
- } else {
- add_deltas(out, dx, dy, step - part);
- add_deltas(out, tx, ty, outline_scale - step);
- }
- part = outline_scale - step;
- }
- x += tx, y += ty;
- dx = -dy, dy += tx;
- } else if (!get_pixel(out, x + dx, y + dy)) { /* Cell straight ahead is empty, go clockwise. */
- if (!detect) {
- add_deltas(out, dx, dy, outline_scale - step - part);
- add_deltas(out, ty, -tx, step);
- part = step;
- }
- dx = dy, dy -= ty;
- } else { /* Neither of the above, go in same direction. */
- if (!detect) {
- add_deltas(out, dx, dy, outline_scale);
- }
- x += dx, y += dy;
- }
- if (dx == -step && dy == 0 && !(tx == -step && ty == -step)) { /* We just turned a corner and are going west, */
- /* so the previous pixel is a starting point pixel. */
- if (x == x0 && y == y0)
- return 0;
- if (detect && (y > y0 || (y == y0 && x > x0)))
- return 1;
- }
+ } else {
+ add_deltas(out, dx, dy, step - part);
+ add_deltas(out, tx, ty, outline_scale - step);
+ }
+ part = outline_scale - step;
+ }
+ x += tx, y += ty;
+ dx = -dy, dy += tx;
+ } else if (!get_pixel(out, x + dx, y + dy)) { /* Cell straight ahead is empty, go clockwise. */
+ if (!detect) {
+ add_deltas(out, dx, dy, outline_scale - step - part);
+ add_deltas(out, ty, -tx, step);
+ part = step;
+ }
+ dx = dy, dy -= ty;
+ } else { /* Neither of the above, go in same direction. */
+ if (!detect) {
+ add_deltas(out, dx, dy, outline_scale);
+ }
+ x += dx, y += dy;
+ }
+ if (dx == -step && dy == 0 && !(tx == -step && ty == -step)) { /* We just turned a corner and are going west, */
+ /* so the previous pixel is a starting point pixel. */
+ if (x == x0 && y == y0)
+ return 0;
+ if (detect && (y > y0 || (y == y0 && x > x0)))
+ return 1;
+ }
}
}
@@ -162,20 +162,20 @@ static int
add_dxdy(register status * out, int dx, int dy, int count)
{
if (count != 0) {
- if (dx == out->dx && dy == out->dy)
- out->count += count;
- else {
- if (out->count != 0) {
- int code = gs_rlineto(out->pgs,
- out->dx * out->count / (float)outline_scale,
- out->dy * out->count / (float)outline_scale);
+ if (dx == out->dx && dy == out->dy)
+ out->count += count;
+ else {
+ if (out->count != 0) {
+ int code = gs_rlineto(out->pgs,
+ out->dx * out->count / (float)outline_scale,
+ out->dy * out->count / (float)outline_scale);
- if (code < 0)
- return code;
- }
- out->dx = dx, out->dy = dy;
- out->count = count;
- }
+ if (code < 0)
+ return code;
+ }
+ out->dx = dx, out->dy = dy;
+ out->count = count;
+ }
}
return 0;
}
diff --git a/gs/base/gsinit.c b/gs/base/gsinit.c
index 43a6192e1..4f83e3d0b 100644
--- a/gs/base/gsinit.c
+++ b/gs/base/gsinit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,8 +51,8 @@ gs_lib_init1(gs_memory_t * mem)
int code;
for (ipp = gx_init_table; *ipp != 0; ++ipp)
- if ((code = (**ipp)(mem)) < 0)
- return code;
+ if ((code = (**ipp)(mem)) < 0)
+ return code;
return 0;
}
@@ -68,6 +68,6 @@ gs_lib_finit(int exit_status, int code, gs_memory_t *mem)
* gs_malloc_release(mem);
* else
* someone else has control of mem so we can't free it.
- * gs_view and iapi.h interface
+ * gs_view and iapi.h interface
*/
}
diff --git a/gs/base/gsio.h b/gs/base/gsio.h
index c88553339..1c44d8467 100644
--- a/gs/base/gsio.h
+++ b/gs/base/gsio.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsiodev.c b/gs/base/gsiodev.c
index f211d5abc..65b279d05 100644
--- a/gs/base/gsiodev.c
+++ b/gs/base/gsiodev.c
@@ -30,10 +30,10 @@ extern_gx_io_device_table();
private_st_io_device();
gs_private_st_ptr(st_io_device_ptr, gx_io_device *, "gx_io_device *",
- iodev_ptr_enum_ptrs, iodev_ptr_reloc_ptrs);
+ iodev_ptr_enum_ptrs, iodev_ptr_reloc_ptrs);
gs_private_st_element(st_io_device_ptr_element, gx_io_device *,
"gx_io_device *[]", iodev_ptr_elt_enum_ptrs, iodev_ptr_elt_reloc_ptrs,
- st_io_device_ptr);
+ st_io_device_ptr);
/* Define the OS (%os%) device. */
iodev_proc_fopen(iodev_os_fopen);
@@ -61,42 +61,42 @@ int
gs_iodev_init(gs_memory_t * mem)
{ /* Make writable copies of all IODevices. */
gx_io_device **table =
- gs_alloc_struct_array(mem, gx_io_device_table_count,
- gx_io_device *, &st_io_device_ptr_element,
- "gs_iodev_init(table)");
+ gs_alloc_struct_array(mem, gx_io_device_table_count,
+ gx_io_device *, &st_io_device_ptr_element,
+ "gs_iodev_init(table)");
gs_lib_ctx_t *libctx = gs_lib_ctx_get_interp_instance(mem);
int i, j;
int code = 0;
if ((table == NULL) || (libctx == NULL))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < gx_io_device_table_count; ++i) {
- gx_io_device *iodev =
- gs_alloc_struct(mem, gx_io_device, &st_io_device,
- "gs_iodev_init(iodev)");
-
- if (iodev == 0)
- goto fail;
- table[i] = iodev;
- memcpy(table[i], gx_io_device_table[i], sizeof(gx_io_device));
+ gx_io_device *iodev =
+ gs_alloc_struct(mem, gx_io_device, &st_io_device,
+ "gs_iodev_init(iodev)");
+
+ if (iodev == 0)
+ goto fail;
+ table[i] = iodev;
+ memcpy(table[i], gx_io_device_table[i], sizeof(gx_io_device));
}
libctx->io_device_table = table;
code = gs_register_struct_root(mem, NULL,
(void **)&libctx->io_device_table,
- "io_device_table");
+ "io_device_table");
if (code < 0)
- goto fail;
+ goto fail;
/* Run the one-time initialization of each IODevice. */
for (j = 0; j < gx_io_device_table_count; ++j)
- if ((code = (table[j]->procs.init)(table[j], mem)) < 0)
- goto f2;
+ if ((code = (table[j]->procs.init)(table[j], mem)) < 0)
+ goto f2;
return 0;
f2:
/****** CAN'T FIND THE ROOT ******/
/*gs_unregister_root(mem, root, "io_device_table");*/
fail:
for (; i >= 0; --i)
- gs_free_object(mem, table[i - 1], "gs_iodev_init(iodev)");
+ gs_free_object(mem, table[i - 1], "gs_iodev_init(iodev)");
gs_free_object(mem, table, "gs_iodev_init(table)");
libctx->io_device_table = 0;
return (code < 0 ? code : gs_note_error(gs_error_VMerror));
@@ -112,21 +112,21 @@ iodev_no_init(gx_io_device * iodev, gs_memory_t * mem)
int
iodev_no_open_device(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
return_error(gs_error_invalidfileaccess);
}
int
iodev_no_open_file(gx_io_device * iodev, const char *fname, uint namelen,
- const char *access, stream ** ps, gs_memory_t * mem)
+ const char *access, stream ** ps, gs_memory_t * mem)
{
return_error(gs_error_invalidfileaccess);
}
int
iodev_no_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
return_error(gs_error_invalidfileaccess);
}
@@ -157,7 +157,7 @@ iodev_no_file_status(gx_io_device * iodev, const char *fname, struct stat *pstat
file_enum *
iodev_no_enumerate_files(gx_io_device * iodev, const char *pat, uint patlen,
- gs_memory_t * memory)
+ gs_memory_t * memory)
{
return NULL;
}
@@ -179,14 +179,14 @@ iodev_no_put_params(gx_io_device * iodev, gs_param_list * plist)
/* The fopen routine is exported for %null. */
int
iodev_os_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
errno = 0;
*pfile = gp_fopen(fname, access);
if (*pfile == NULL)
- return_error(gs_fopen_errno_to_code(errno));
+ return_error(gs_fopen_errno_to_code(errno));
if (rfname != NULL && rfname != fname)
- strcpy(rfname, fname);
+ strcpy(rfname, fname);
return 0;
}
@@ -219,7 +219,7 @@ os_status(gx_io_device * iodev, const char *fname, struct stat *pstat)
static file_enum *
os_enumerate(gx_io_device * iodev, const char *pat, uint patlen,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
return gp_enumerate_files_init(pat, patlen, mem);
}
@@ -242,18 +242,18 @@ os_get_params(gx_io_device * iodev, gs_param_list * plist)
Free = LogicalSize * 3 / 4; /* about 1.5 Gb */
if (
- (code = param_write_bool(plist, "HasNames", &btrue)) < 0 ||
- (code = param_write_int(plist, "BlockSize", &BlockSize)) < 0 ||
- (code = param_write_long(plist, "Free", &Free)) < 0 ||
- (code = param_write_int(plist, "InitializeAction", &i0)) < 0 ||
- (code = param_write_bool(plist, "Mounted", &btrue)) < 0 ||
- (code = param_write_bool(plist, "Removable", &bfalse)) < 0 ||
- (code = param_write_bool(plist, "Searchable", &btrue)) < 0 ||
- (code = param_write_int(plist, "SearchOrder", &i2)) < 0 ||
- (code = param_write_bool(plist, "Writeable", &btrue)) < 0 ||
- (code = param_write_long(plist, "LogicalSize", &LogicalSize)) < 0
- )
- return code;
+ (code = param_write_bool(plist, "HasNames", &btrue)) < 0 ||
+ (code = param_write_int(plist, "BlockSize", &BlockSize)) < 0 ||
+ (code = param_write_long(plist, "Free", &Free)) < 0 ||
+ (code = param_write_int(plist, "InitializeAction", &i0)) < 0 ||
+ (code = param_write_bool(plist, "Mounted", &btrue)) < 0 ||
+ (code = param_write_bool(plist, "Removable", &bfalse)) < 0 ||
+ (code = param_write_bool(plist, "Searchable", &btrue)) < 0 ||
+ (code = param_write_int(plist, "SearchOrder", &i2)) < 0 ||
+ (code = param_write_bool(plist, "Writeable", &btrue)) < 0 ||
+ (code = param_write_long(plist, "LogicalSize", &LogicalSize)) < 0
+ )
+ return code;
return 0;
}
@@ -267,7 +267,7 @@ gs_getiodevice(const gs_memory_t *mem, int index)
if (libctx == NULL || libctx->io_device_table == NULL ||
index < 0 || index >= gx_io_device_table_count)
- return 0; /* index out of range */
+ return 0; /* index out of range */
return libctx->io_device_table[index];
}
@@ -280,13 +280,13 @@ gs_findiodevice(const gs_memory_t *mem, const byte * str, uint len)
gs_lib_ctx_t *libctx = gs_lib_ctx_get_interp_instance(mem);
if (len > 1 && str[len - 1] == '%')
- len--;
+ len--;
for (i = 0; i < gx_io_device_table_count; ++i) {
- gx_io_device *iodev = libctx->io_device_table[i];
- const char *dname = iodev->dname;
+ gx_io_device *iodev = libctx->io_device_table[i];
+ const char *dname = iodev->dname;
- if (dname && strlen(dname) == len + 1 && !memcmp(str, dname, len))
- return iodev;
+ if (dname && strlen(dname) == len + 1 && !memcmp(str, dname, len))
+ return iodev;
}
return 0;
}
@@ -303,7 +303,7 @@ gs_getdevparams(gx_io_device * iodev, gs_param_list * plist)
param_string_from_string(ts, iodev->dtype);
code = param_write_name(plist, "Type", &ts);
if (code < 0)
- return code;
+ return code;
return (*iodev->procs.get_params) (iodev, plist);
}
@@ -322,36 +322,36 @@ gs_fopen_errno_to_code(int eno)
/* We try to cover as many variations as we know about. */
switch (eno) {
#ifdef ENOENT
- case ENOENT:
- return_error(gs_error_undefinedfilename);
+ case ENOENT:
+ return_error(gs_error_undefinedfilename);
#endif
#ifdef ENOFILE
# ifndef ENOENT
# define ENOENT ENOFILE
# endif
# if ENOFILE != ENOENT
- case ENOFILE:
- return_error(gs_error_undefinedfilename);
+ case ENOFILE:
+ return_error(gs_error_undefinedfilename);
# endif
#endif
#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
- return_error(gs_error_undefinedfilename);
+ case ENAMETOOLONG:
+ return_error(gs_error_undefinedfilename);
#endif
#ifdef EACCES
- case EACCES:
- return_error(gs_error_invalidfileaccess);
+ case EACCES:
+ return_error(gs_error_invalidfileaccess);
#endif
#ifdef EMFILE
- case EMFILE:
- return_error(gs_error_limitcheck);
+ case EMFILE:
+ return_error(gs_error_limitcheck);
#endif
#ifdef ENFILE
- case ENFILE:
- return_error(gs_error_limitcheck);
+ case ENFILE:
+ return_error(gs_error_limitcheck);
#endif
- default:
- return_error(gs_error_ioerror);
+ default:
+ return_error(gs_error_ioerror);
}
}
@@ -367,7 +367,7 @@ struct gs_file_enum_s {
};
gs_private_st_ptrs1(st_gs_file_enum, gs_file_enum, "gs_file_enum",
- gs_file_enum_enum_ptrs, gs_file_enum_reloc_ptrs, pfile_enum);
+ gs_file_enum_enum_ptrs, gs_file_enum_reloc_ptrs, pfile_enum);
file_enum *
gs_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
@@ -381,7 +381,7 @@ gs_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
/* Get the iodevice */
code = gs_parse_file_name(&pfn, pat, patlen, mem);
if (code < 0)
- return NULL;
+ return NULL;
iodev = (pfn.iodev == NULL) ? iodev_default(mem) : pfn.iodev;
/* Check for several conditions that just cause us to return success */
@@ -389,13 +389,13 @@ gs_enumerate_files_init(const char *pat, uint patlen, gs_memory_t * mem)
return NULL; /* no pattern, or device not found -- just return */
}
pfen = iodev->procs.enumerate_files(iodev, (const char *)pfn.fname,
- pfn.len, mem);
+ pfn.len, mem);
if (pfen == 0)
- return NULL;
+ return NULL;
pgs_file_enum = gs_alloc_struct(mem, gs_file_enum, &st_gs_file_enum,
- "gs_enumerate_files_init");
+ "gs_enumerate_files_init");
if (pgs_file_enum == 0)
- return NULL;
+ return NULL;
pgs_file_enum->memory = mem;
pgs_file_enum->piodev = iodev;
pgs_file_enum->pfile_enum = pfen;
@@ -408,20 +408,20 @@ gs_enumerate_files_next(file_enum * pfen, char *ptr, uint maxlen)
{
gs_file_enum *pgs_file_enum = (gs_file_enum *)pfen;
int iodev_name_len = pgs_file_enum->prepend_iodev_name ?
- strlen(pgs_file_enum->piodev->dname) : 0;
+ strlen(pgs_file_enum->piodev->dname) : 0;
uint return_len;
if (iodev_name_len > maxlen)
- return maxlen + 1; /* signal overflow error */
+ return maxlen + 1; /* signal overflow error */
if (iodev_name_len > 0)
- memcpy(ptr, pgs_file_enum->piodev->dname, iodev_name_len);
+ memcpy(ptr, pgs_file_enum->piodev->dname, iodev_name_len);
return_len = pgs_file_enum->piodev->procs.enumerate_next(pgs_file_enum->pfile_enum,
- ptr + iodev_name_len, maxlen - iodev_name_len);
+ ptr + iodev_name_len, maxlen - iodev_name_len);
if (return_len == ~0) {
gs_memory_t *mem = pgs_file_enum->memory;
gs_free_object(mem, pgs_file_enum, "gs_enumerate_files_close");
- return ~0;
+ return ~0;
}
return return_len+iodev_name_len;
}
diff --git a/gs/base/gsiodevs.c b/gs/base/gsiodevs.c
index 364167c36..ba80d0616 100644
--- a/gs/base/gsiodevs.c
+++ b/gs/base/gsiodevs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,12 +22,12 @@
const char iodev_dtype_stdio[] = "Special";
#define iodev_stdio(dname, open) {\
dname, iodev_dtype_stdio,\
- { iodev_no_init, open, iodev_no_open_file,\
- iodev_no_fopen, iodev_no_fclose,\
- iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
- iodev_no_enumerate_files, NULL, NULL,\
- iodev_no_get_params, iodev_no_put_params\
- }\
+ { iodev_no_init, open, iodev_no_open_file,\
+ iodev_no_fopen, iodev_no_fclose,\
+ iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
+ iodev_no_enumerate_files, NULL, NULL,\
+ iodev_no_get_params, iodev_no_put_params\
+ }\
}
#define STDIO_BUF_SIZE 128
@@ -43,20 +43,20 @@ stdio_close_file(stream *s)
}
static int
stdio_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem, char rw, FILE *file,
- void (*srw_file)(stream *, FILE *, byte *, uint))
+ gs_memory_t * mem, char rw, FILE *file,
+ void (*srw_file)(stream *, FILE *, byte *, uint))
{
stream *s;
byte *buf;
if (!streq1(access, rw))
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
s = s_alloc(mem, "stdio_open(stream)");
buf = gs_alloc_bytes(mem, STDIO_BUF_SIZE, "stdio_open(buffer)");
if (s == 0 || buf == 0) {
- gs_free_object(mem, buf, "stdio_open(buffer)");
- gs_free_object(mem, s, "stdio_open(stream)");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, buf, "stdio_open(buffer)");
+ gs_free_object(mem, s, "stdio_open(stream)");
+ return_error(gs_error_VMerror);
}
srw_file(s, file, buf, STDIO_BUF_SIZE);
s->procs.close = stdio_close_file;
@@ -66,27 +66,27 @@ stdio_open(gx_io_device * iodev, const char *access, stream ** ps,
static int
stdin_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
- return stdio_open(iodev, access, ps, mem, 'r',
- mem->gs_lib_ctx->fstdin, sread_file);
+ return stdio_open(iodev, access, ps, mem, 'r',
+ mem->gs_lib_ctx->fstdin, sread_file);
}
const gx_io_device gs_iodev_stdin = iodev_stdio("%stdin%", stdin_open);
static int
stdout_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
- return stdio_open(iodev, access, ps, mem, 'w',
- mem->gs_lib_ctx->fstdout, swrite_file);
+ return stdio_open(iodev, access, ps, mem, 'w',
+ mem->gs_lib_ctx->fstdout, swrite_file);
}
const gx_io_device gs_iodev_stdout = iodev_stdio("%stdout%", stdout_open);
static int
stderr_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
- return stdio_open(iodev, access, ps, mem, 'w',
- mem->gs_lib_ctx->fstderr, swrite_file);
+ return stdio_open(iodev, access, ps, mem, 'w',
+ mem->gs_lib_ctx->fstderr, swrite_file);
}
const gx_io_device gs_iodev_stderr = iodev_stdio("%stderr%", stderr_open);
diff --git a/gs/base/gsiodisk.c b/gs/base/gsiodisk.c
index 5cfa10b52..0d28f7f4a 100644
--- a/gs/base/gsiodisk.c
+++ b/gs/base/gsiodisk.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -92,7 +92,7 @@
* there simply because it is being used as a terminator for the file name.
* It could easily be eliminated by adding a zero as the name terminator.
* The only disadvantage is that the file is no longer totally printable ascii.
- */
+ */
#include "errno_.h"
#include "string_.h"
@@ -185,7 +185,7 @@ static int
iodev_diskn_init(gx_io_device * iodev, gs_memory_t * mem)
{
diskn_state * pstate = gs_alloc_struct(mem, diskn_state, &st_diskn_state,
- "iodev_diskn_init(state)");
+ "iodev_diskn_init(state)");
if (!pstate)
return gs_error_VMerror;
pstate->root_size = 0;
@@ -195,14 +195,13 @@ iodev_diskn_init(gx_io_device * iodev, gs_memory_t * mem)
return 0;
}
-
static int
iodev_diskn_fopen(gx_io_device * iodev, const char *fname, const char *access,
- FILE ** pfile, char *rfname, uint rnamelen)
+ FILE ** pfile, char *rfname, uint rnamelen)
{
char realname[gp_file_name_sizeof];
diskn_state * pstate = (diskn_state *)iodev->state;
-
+
/* Exit if we do not have a root location */
if (!pstate->root)
return_error(gs_error_undefinedfilename);
@@ -211,9 +210,9 @@ iodev_diskn_fopen(gx_io_device * iodev, const char *fname, const char *access,
if (!map_file_name_get((char *)pstate->root, fname, realname)) {
if (strchr(access, 'w')) {
map_file_name_add(pstate->root, fname);
- map_file_name_get(pstate->root, fname, realname);
- }
- else
+ map_file_name_get(pstate->root, fname, realname);
+ }
+ else
return_error(gs_error_undefinedfilename);
}
@@ -225,7 +224,7 @@ diskn_delete(gx_io_device * iodev, const char *fname)
{
char realname[gp_file_name_sizeof];
diskn_state * pstate = (diskn_state *)iodev->state;
-
+
/* Exit if we do not have a root location */
if (!pstate->root)
return_error(gs_error_undefinedfilename);
@@ -244,7 +243,7 @@ diskn_rename(gx_io_device * iodev, const char *from, const char *to)
char toreal[gp_file_name_sizeof];
int code = 0;
diskn_state * pstate = (diskn_state *)iodev->state;
-
+
/* Exit if we do not have a root location */
if (!pstate->root)
return_error(gs_error_undefinedfilename);
@@ -258,7 +257,7 @@ diskn_rename(gx_io_device * iodev, const char *from, const char *to)
*/
if (map_file_name_get((char *)pstate->root, to, toreal)) {
map_file_name_del((char *)pstate->root, to);
- code = unlink(toreal) == 0 ? 0 : gs_error_ioerror;
+ code = unlink(toreal) == 0 ? 0 : gs_error_ioerror;
}
map_file_name_ren((char *)pstate->root, from, to);
@@ -270,7 +269,7 @@ diskn_status(gx_io_device * iodev, const char *fname, struct stat *pstat)
{
char realname[gp_file_name_sizeof];
diskn_state * pstate = (diskn_state *)iodev->state;
-
+
/* Exit if we do not have a root location */
if (!pstate->root)
return_error(gs_error_undefinedfilename);
@@ -284,7 +283,7 @@ diskn_status(gx_io_device * iodev, const char *fname, struct stat *pstat)
static file_enum *
diskn_enumerate_files_init(gx_io_device * iodev, const char *pat, uint patlen,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
char patstr[gp_file_name_sizeof];
diskn_state * pstate = (diskn_state *)iodev->state;
@@ -331,18 +330,18 @@ diskn_get_params(gx_io_device * iodev, gs_param_list * plist)
Free = LogicalSize * 3 / 4; /* about 1.5 Gb */
if (
- (code = param_write_bool(plist, "HasNames", &btrue)) < 0 ||
- (code = param_write_int(plist, "BlockSize", &BlockSize)) < 0 ||
- (code = param_write_long(plist, "Free", &Free)) < 0 ||
- (code = param_write_int(plist, "InitializeAction", &i0)) < 0 ||
- (code = param_write_bool(plist, "Mounted", &bsearch)) < 0 ||
- (code = param_write_bool(plist, "Removable", &bfalse)) < 0 ||
- (code = param_write_bool(plist, "Searchable", &bsearch)) < 0 ||
- (code = param_write_int(plist, "SearchOrder", &so)) < 0 ||
- (code = param_write_bool(plist, "Writeable", &bsearch)) < 0 ||
- (code = param_write_long(plist, "LogicalSize", &LogicalSize)) < 0
- )
- return code;
+ (code = param_write_bool(plist, "HasNames", &btrue)) < 0 ||
+ (code = param_write_int(plist, "BlockSize", &BlockSize)) < 0 ||
+ (code = param_write_long(plist, "Free", &Free)) < 0 ||
+ (code = param_write_int(plist, "InitializeAction", &i0)) < 0 ||
+ (code = param_write_bool(plist, "Mounted", &bsearch)) < 0 ||
+ (code = param_write_bool(plist, "Removable", &bfalse)) < 0 ||
+ (code = param_write_bool(plist, "Searchable", &bsearch)) < 0 ||
+ (code = param_write_int(plist, "SearchOrder", &so)) < 0 ||
+ (code = param_write_bool(plist, "Writeable", &bsearch)) < 0 ||
+ (code = param_write_long(plist, "LogicalSize", &LogicalSize)) < 0
+ )
+ return code;
if (pstate->root) {
rootstring.data = (const byte *)pstate->root;
@@ -361,15 +360,15 @@ diskn_put_params(gx_io_device *iodev, gs_param_list *plist)
gs_param_string rootstr;
int code;
diskn_state * pstate = (diskn_state *)iodev->state;
-
+
switch (code = param_read_string(plist, "Root", &rootstr)) {
- case 0:
- break;
- default:
- param_signal_error(plist, "Root", code);
- case 1:
- rootstr.data = 0;
- break;
+ case 0:
+ break;
+ default:
+ param_signal_error(plist, "Root", code);
+ case 1:
+ rootstr.data = 0;
+ break;
}
/* Process the other device parameters */
@@ -380,21 +379,21 @@ diskn_put_params(gx_io_device *iodev, gs_param_list *plist)
/* Process parameter changes */
if (rootstr.data) {
- /* Make sure that we have room for the root string */
- if (!pstate->root || pstate->root_size <= rootstr.size) {
- if (pstate->root) /* The current storge is too small */
- gs_free_object(pstate->memory, pstate->root, "diskn(rootdir)");
- pstate->root = (char *)gs_alloc_byte_array(pstate->memory,
- gp_file_name_sizeof, sizeof(char), "diskn(rootdir)");
- if (!pstate->root)
- return gs_error_VMerror;
- pstate->root_size = rootstr.size + 1;
- /* Now allow enumeration of files on the disk */
- iodev->procs.enumerate_files = diskn_enumerate_files_init;
- }
-
- memcpy(pstate->root, rootstr.data, rootstr.size);
- pstate->root[rootstr.size] = 0;
+ /* Make sure that we have room for the root string */
+ if (!pstate->root || pstate->root_size <= rootstr.size) {
+ if (pstate->root) /* The current storge is too small */
+ gs_free_object(pstate->memory, pstate->root, "diskn(rootdir)");
+ pstate->root = (char *)gs_alloc_byte_array(pstate->memory,
+ gp_file_name_sizeof, sizeof(char), "diskn(rootdir)");
+ if (!pstate->root)
+ return gs_error_VMerror;
+ pstate->root_size = rootstr.size + 1;
+ /* Now allow enumeration of files on the disk */
+ iodev->procs.enumerate_files = diskn_enumerate_files_init;
+ }
+
+ memcpy(pstate->root, rootstr.data, rootstr.size);
+ pstate->root[rootstr.size] = 0;
}
return 0;
}
@@ -433,12 +432,12 @@ MapFileReadVersion(FILE * mapfile, int * value)
/* Skip comment on version line. */
do {
- c = fgetc(mapfile);
+ c = fgetc(mapfile);
} while (c != EOF && c != '\n' && c != '\r');
/* Clean up any trailing linefeeds or carriage returns */
while (c != EOF && (c == '\n' || c == '\r')) {
- c = fgetc(mapfile);
+ c = fgetc(mapfile);
}
return code;
}
@@ -453,8 +452,8 @@ static void
MapFileWriteVersion(FILE * mapfile, int value)
{
fprintf(mapfile,
- "FileVersion\t%d\tThis file is machine generated. Do not edit.\n",
- value);
+ "FileVersion\t%d\tThis file is machine generated. Do not edit.\n",
+ value);
}
/*
@@ -473,17 +472,17 @@ MapFileRead(FILE * mapfile, char * namebuf, int * value)
/* Get the file number */
if (fscanf(mapfile, "%d\t", value) != 1)
- return 0;
-
+ return 0;
+
/* Get the file name */
do {
- namebuf[count++] = c = fgetc(mapfile);
+ namebuf[count++] = c = fgetc(mapfile);
} while (count < BUFFER_LENGTH && c != EOF && c != '\n' && c != '\r');
namebuf[--count] = 0; /* Terminate file name */
/* Clean up any trailing linefeeds or carriage returns */
while (c != EOF && (c == '\n' || c == '\r')) {
- c = fgetc(mapfile);
+ c = fgetc(mapfile);
}
return count != 0 ? 1: 0;
@@ -503,7 +502,7 @@ MapFileWrite(FILE * mapfile, const char * namebuf, int value)
}
/*
- * Remove the specified file
+ * Remove the specified file
*
* rootpath - Path to base disk location.
* filename - File name string
@@ -565,13 +564,13 @@ MapToFile(const char* rootpath, const char* name)
/* Verify the mapping file version number */
if (MapFileReadVersion(mapfile, &file_version)
- && file_version == MAP_FILE_VERSION) {
+ && file_version == MAP_FILE_VERSION) {
/* Scan the file looking for the given name */
while (MapFileRead(mapfile, filename, &d)) {
if (strcmp(filename, name) == 0)
- break;
+ break;
d = -1;
}
}
@@ -594,7 +593,7 @@ map_file_enum_init(gs_memory_t * mem, const char * root_name, const char * searc
{
int file_version;
map_file_enum * mapfileenum = gs_alloc_struct(mem, map_file_enum, &st_map_file_enum,
- "diskn:enum_init(file_enum)");
+ "diskn:enum_init(file_enum)");
if (mapfileenum == NULL)
return NULL;
@@ -603,18 +602,18 @@ map_file_enum_init(gs_memory_t * mem, const char * root_name, const char * searc
if (search_pattern) {
mapfileenum->pattern = (char *)gs_alloc_bytes(mem, strlen(search_pattern) + 1,
- "diskn:enum_init(pattern)");
+ "diskn:enum_init(pattern)");
if (mapfileenum->pattern == NULL) {
- map_file_enum_close((file_enum *) mapfileenum);
+ map_file_enum_close((file_enum *) mapfileenum);
return NULL;
}
strcpy(mapfileenum->pattern, search_pattern);
}
- mapfileenum->root = (char *)gs_alloc_bytes(mem, strlen(root_name) + 1,
- "diskn:enum_init(root)");
+ mapfileenum->root = (char *)gs_alloc_bytes(mem, strlen(root_name) + 1,
+ "diskn:enum_init(root)");
if (mapfileenum->root == NULL) {
- map_file_enum_close((file_enum *) mapfileenum);
+ map_file_enum_close((file_enum *) mapfileenum);
return NULL;
}
@@ -625,9 +624,9 @@ map_file_enum_init(gs_memory_t * mem, const char * root_name, const char * searc
/* Check the mapping file version number */
if (mapfileenum->stream != NULL
- && (!MapFileReadVersion(mapfileenum->stream, &file_version)
- || file_version != MAP_FILE_VERSION)) {
- fclose(mapfileenum->stream); /* Invalid file version */
+ && (!MapFileReadVersion(mapfileenum->stream, &file_version)
+ || file_version != MAP_FILE_VERSION)) {
+ fclose(mapfileenum->stream); /* Invalid file version */
mapfileenum->stream = NULL;
}
@@ -647,20 +646,20 @@ map_file_enum_next(void * enum_mem, char* target)
map_file_enum * mapfileenum;
if (enum_mem == NULL)
- return false;
+ return false;
mapfileenum = (map_file_enum*)enum_mem;
if (mapfileenum->stream == NULL)
- return false;
+ return false;
if (mapfileenum->pattern) {
/* Search for next entry that matches pattern */
while (MapFileRead(mapfileenum->stream, target, &d)) {
if (string_match((byte *)target, strlen(target),
- (byte *)mapfileenum->pattern,
- strlen(mapfileenum->pattern), 0))
- return true;
- }
+ (byte *)mapfileenum->pattern,
+ strlen(mapfileenum->pattern), 0))
+ return true;
+ }
}
else {
/* Just get next */
@@ -670,7 +669,7 @@ map_file_enum_next(void * enum_mem, char* target)
return false;
}
-/*
+/*
* map_file_enum_close
*
* cleans up after an enumeration, this may only be called
@@ -687,7 +686,7 @@ map_file_enum_close(void * enum_mem)
if (mapfileenum->root)
gs_free_object(mem, mapfileenum->root, "diskn_enum_init(root)");
if (mapfileenum->pattern)
- gs_free_object(mem, mapfileenum->pattern, "diskn_enum_init(pattern)");
+ gs_free_object(mem, mapfileenum->pattern, "diskn_enum_init(pattern)");
gs_free_object(mem, mapfileenum, "diskn_enum_init(mapfileenum)");
}
@@ -708,11 +707,11 @@ map_file_name_get(const char * root_name, const char * Fname, char * osname)
int d = MapToFile(root_name, Fname);
if (d != -1) {
- /* 20 characters are enough for even a 64 bit integer */
+ /* 20 characters are enough for even a 64 bit integer */
if ((strlen(root_name) + 20) < BUFFER_LENGTH) {
- sprintf(osname, "%s%d", root_name, d);
- return true;
- }
+ sprintf(osname, "%s%d", root_name, d);
+ return true;
+ }
}
*osname = 0;
@@ -739,25 +738,25 @@ map_file_name_del(const char * root_name, const char * Fname)
FILE* newMap;
FILE* oldMap;
- /* Open current map file and a working file */
+ /* Open current map file and a working file */
MapFileUnlink(root_name, TEMP_FILE_NAME );
newMap = MapFileOpen(root_name, TEMP_FILE_NAME, "w");
if (newMap == NULL)
- return;
+ return;
oldMap = MapFileOpen(root_name, MAP_FILE_NAME, "r");
if (oldMap != NULL && (!MapFileReadVersion(oldMap, &file_version)
- || file_version != MAP_FILE_VERSION)) {
+ || file_version != MAP_FILE_VERSION)) {
fclose(oldMap);
- oldMap= NULL;
- }
+ oldMap= NULL;
+ }
if (oldMap == NULL) {
fclose(newMap);
MapFileUnlink(root_name, TEMP_FILE_NAME);
- return;
+ return;
}
- /* Copy every line of the map file except the one with given name */
+ /* Copy every line of the map file except the one with given name */
MapFileWriteVersion(newMap, MAP_FILE_VERSION);
while (MapFileRead(oldMap, name, &d))
@@ -781,7 +780,7 @@ map_file_name_del(const char * root_name, const char * Fname)
static void
map_file_name_add(const char * root_name, const char * Fname)
{
- /*
+ /*
* add entry to map file
* entry number is one greater than biggest number
*/
@@ -791,17 +790,17 @@ map_file_name_add(const char * root_name, const char * Fname)
int file_version;
FILE* newMap;
FILE* oldMap;
-
+
oldMap = MapFileOpen(root_name, MAP_FILE_NAME, "r");
if (oldMap != NULL && (!MapFileReadVersion(oldMap, &file_version)
- || file_version != MAP_FILE_VERSION)) {
+ || file_version != MAP_FILE_VERSION)) {
fclose(oldMap);
- oldMap = NULL;
+ oldMap = NULL;
}
if (oldMap == NULL) {
oldMap = MapFileOpen(root_name, MAP_FILE_NAME, "w");
- if (!oldMap)
- return;
+ if (!oldMap)
+ return;
MapFileWriteVersion(oldMap, MAP_FILE_VERSION);
MapFileWrite(oldMap, Fname, InitialNumber);
fclose(oldMap);
@@ -812,7 +811,7 @@ map_file_name_add(const char * root_name, const char * Fname)
if (newMap != NULL) {
MapFileWriteVersion(newMap, MAP_FILE_VERSION);
while (MapFileRead(oldMap, name, &d)) {
- MapFileWrite(newMap, name, d);
+ MapFileWrite(newMap, name, d);
if (dmax < d)
dmax = d;
}
@@ -838,7 +837,7 @@ map_file_name_add(const char * root_name, const char * Fname)
*/
static void
map_file_name_ren(const char* root_name, const char * oldname, const char * newname)
-{
+{
/* search for target entry */
int d = MapToFile(root_name, oldname);
@@ -848,26 +847,26 @@ map_file_name_ren(const char* root_name, const char * oldname, const char * newn
char name[BUFFER_LENGTH];
FILE* newMap;
FILE* oldMap;
-
- /* Open current map file and a working file */
+
+ /* Open current map file and a working file */
MapFileUnlink(root_name, TEMP_FILE_NAME );
newMap = MapFileOpen(root_name, TEMP_FILE_NAME, "w");
if (newMap == NULL)
- return;
+ return;
oldMap = MapFileOpen(root_name, MAP_FILE_NAME, "r");
if (oldMap != NULL && (!MapFileReadVersion(oldMap, &file_version)
- || file_version != MAP_FILE_VERSION)) {
+ || file_version != MAP_FILE_VERSION)) {
fclose(oldMap);
- oldMap= NULL;
- }
+ oldMap= NULL;
+ }
if (oldMap == NULL) {
fclose(newMap);
MapFileUnlink(root_name, TEMP_FILE_NAME);
- return;
+ return;
}
- /* Now copy data from old to new, change file name when found */
+ /* Now copy data from old to new, change file name when found */
MapFileWriteVersion(newMap, MAP_FILE_VERSION); /* Copy the version number */
while (MapFileRead(oldMap, name, &d))
diff --git a/gs/base/gsiomacres.c b/gs/base/gsiomacres.c
index ba828a605..c3e499e4c 100644
--- a/gs/base/gsiomacres.c
+++ b/gs/base/gsiomacres.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,20 +54,20 @@
#define TYPE_vers 0x76657273
typedef struct {
- unsigned int data_offset;
- unsigned int map_offset;
- unsigned int data_length;
- unsigned int map_length;
+ unsigned int data_offset;
+ unsigned int map_offset;
+ unsigned int data_length;
+ unsigned int map_length;
} resource_header;
typedef struct {
- unsigned int type;
- unsigned int offset;
- unsigned int length;
- byte *data;
- char *name;
- unsigned short id;
- byte flags;
+ unsigned int type;
+ unsigned int offset;
+ unsigned int length;
+ byte *data;
+ char *name;
+ unsigned short id;
+ byte flags;
} resource;
typedef struct {
@@ -93,45 +93,45 @@ int get_int16(byte *p) {
static
int read_int32(FILE *in, void *p)
{
- byte w[4], err;
+ byte w[4], err;
- err = fread(w, 1, 4, in);
- if (err != 4) return -1;
+ err = fread(w, 1, 4, in);
+ if (err != 4) return -1;
- *(unsigned int*)p = get_int32(w);
- return 0;
+ *(unsigned int*)p = get_int32(w);
+ return 0;
}
static
int read_int24(FILE *in, void *p)
{
- byte w[3], err;
-
- err = fread(w, 1, 3, in);
- if (err != 3) return -1;
-
- *(unsigned int*)p = get_int24(w);
- return 0;
+ byte w[3], err;
+
+ err = fread(w, 1, 3, in);
+ if (err != 3) return -1;
+
+ *(unsigned int*)p = get_int24(w);
+ return 0;
}
static
int read_int16(FILE *in, void *p)
{
- byte w[2], err;
-
- err = fread(w, 1, 2, in);
- if (err != 2) return -1;
-
- *(unsigned short*)p = get_int16(w);
- return 0;
+ byte w[2], err;
+
+ err = fread(w, 1, 2, in);
+ if (err != 2) return -1;
+
+ *(unsigned short*)p = get_int16(w);
+ return 0;
}
static
int read_int8(FILE *in, void *p)
{
- byte c = fgetc(in);
- if (c < 0) return -1;
-
+ byte c = fgetc(in);
+ if (c < 0) return -1;
+
*(byte*)p = (c&0xFF);
return 0;
}
@@ -139,22 +139,22 @@ int read_int8(FILE *in, void *p)
/* convert a 4-character typecode from C string to uint32 representation */
static unsigned int res_string2type(const char *type_string)
{
- unsigned int type = type_string[0] << 24 |
- type_string[1] << 16 |
- type_string[2] << 8 |
- type_string[3];
+ unsigned int type = type_string[0] << 24 |
+ type_string[1] << 16 |
+ type_string[2] << 8 |
+ type_string[3];
return (type);
}
/* convert a 4-character typecode from unsigned int to C string representation */
static char * res_type2string(const unsigned int type, char *type_string)
{
- if (type_string == NULL) return NULL;
-
- type_string[0] = (type >> 24) & 0xFF;
+ if (type_string == NULL) return NULL;
+
+ type_string[0] = (type >> 24) & 0xFF;
type_string[1] = (type >> 16) & 0xFF;
type_string[2] = (type >> 8) & 0xFF;
type_string[3] = (type) & 0xFF;
- type_string[4] = '\0';
+ type_string[4] = '\0';
return (type_string);
}
@@ -162,21 +162,21 @@ static char * res_type2string(const unsigned int type, char *type_string)
static
resource_header *read_resource_header(FILE *in, int offset)
{
- resource_header *header = malloc(sizeof(*header));
+ resource_header *header = malloc(sizeof(*header));
- fseek(in, offset, SEEK_SET);
+ fseek(in, offset, SEEK_SET);
- read_int32(in, &(header->data_offset));
- read_int32(in, &(header->map_offset));
- read_int32(in, &(header->data_length));
- read_int32(in, &(header->map_length));
+ read_int32(in, &(header->data_offset));
+ read_int32(in, &(header->map_offset));
+ read_int32(in, &(header->data_length));
+ read_int32(in, &(header->map_length));
if (feof(in)) {
free (header);
header = NULL;
}
-
- return header;
+
+ return header;
}
static
@@ -184,7 +184,7 @@ resource_list *read_resource_map(FILE *in, resource_header *header)
{
resource_list *list;
int n_resources;
- int type_offset, name_offset, this_name_offset;
+ int type_offset, name_offset, this_name_offset;
unsigned int *types;
int *number, *ref_offsets;
int n_types;
@@ -197,18 +197,18 @@ resource_list *read_resource_map(FILE *in, resource_header *header)
if_debug1('s', "error: could not allocate %d bytes for resource map\n", header->map_length);
return NULL;
}
-
+
/* read in the whole resource map */
- fseek(in, header->map_offset, SEEK_SET);
+ fseek(in, header->map_offset, SEEK_SET);
fread(buf, 1, header->map_length, in);
-
+
type_offset = get_int16(buf + 24);
name_offset = get_int16(buf + 26);
n_types = get_int16(buf + 28); n_types++;
-
+
if (type_offset != 30)
if_debug1('s', "[s] warning! resource type list offset is %d, not 30!\n", type_offset);
-
+
/* determine the total number of resources */
types = malloc(sizeof(*types)*n_types);
number = malloc(sizeof(*number)*n_types);
@@ -223,15 +223,15 @@ resource_list *read_resource_map(FILE *in, resource_header *header)
p += 8;
n_resources += number[i];
}
-
+
/* parse the individual resources */
list = malloc(sizeof(resource_list));
list->resources = malloc(sizeof(resource)*n_resources);
list->n_resources = n_resources;
k = 0;
for (i = 0; i < n_types; i++) {
- res_type2string(types[i], type_string);
- if_debug2('s', "[s] %d resources of type '%s':\n", number[i], type_string);
+ res_type2string(types[i], type_string);
+ if_debug2('s', "[s] %d resources of type '%s':\n", number[i], type_string);
p = buf + type_offset + ref_offsets[i]; /* FIXME: also off? */
/* p = buf + 32 + ref_offsets[i]; */
for (j = 0; j < number[i]; j++) {
@@ -252,18 +252,18 @@ resource_list *read_resource_map(FILE *in, resource_header *header)
/* load the actual resource data separately */
list->resources[k].length = 0;
list->resources[k].data = NULL;
-
+
p += 12;
if_debug4('s', "\tid %d offset 0x%08x flags 0x%02x '%s'\n",
list->resources[k].id, list->resources[k].offset,
list->resources[k].flags, list->resources[k].name);
k++;
}
- }
-
+ }
+
free(buf);
-
- return list;
+
+ return list;
}
static
@@ -271,15 +271,15 @@ void load_resource(FILE *in, resource_header *header, resource *res)
{
unsigned int len;
byte *buf;
-
+
fseek(in, header->data_offset + res->offset, SEEK_SET);
read_int32(in, &len);
-
+
buf = malloc(len);
fread(buf, 1, len, in);
res->data = buf;
res->length = len;
-
+
return;
}
@@ -291,7 +291,6 @@ int read_datafork_resource(byte *buf, const char *fname, const uint type, const
FILE *in;
int i;
-
in = fopen(fname, "rb");
if (in == NULL) {
if_debug1('s', "[s] couldn't open '%s'\n", fname);
@@ -304,19 +303,19 @@ int read_datafork_resource(byte *buf, const char *fname, const uint type, const
if_debug0('s', "[s] not a serialized data fork resource file?\n");
return 0;
}
-
+
if_debug0('s', "[s] loading resource map\n");
- list = read_resource_map(in, header);
+ list = read_resource_map(in, header);
if (list == NULL) {
if_debug0('s', "[s] couldn't read resource map.\n");
return 0;
}
-
+
/* load the resource data we're interested in */
for (i = 0; i < list->n_resources; i++) {
- if ((list->resources[i].type == type) &&
- (list->resources[i].id == id)) {
- if_debug2('s', "[s] loading '%s' resource id %d",
+ if ((list->resources[i].type == type) &&
+ (list->resources[i].id == id)) {
+ if_debug2('s', "[s] loading '%s' resource id %d",
list->resources[i].name, list->resources[i].id);
load_resource(in, header, &(list->resources[i]));
if_debug1('s', " (%d bytes)\n", list->resources[i].length);
@@ -325,17 +324,16 @@ int read_datafork_resource(byte *buf, const char *fname, const uint type, const
return (list->resources[i].length);
}
}
-
+
fclose(in);
free(list);
free(header);
-
+
return (0);
}
/* end dfont loading code */
-
/* prototypes */
static iodev_proc_init(iodev_macresource_init);
static iodev_proc_open_file(iodev_macresource_open_file);
@@ -345,7 +343,7 @@ static iodev_proc_open_file(iodev_macresource_open_file);
/* Define the %macresource% device */
const gx_io_device gs_iodev_macresource =
{
- "%macresource%", "FileSystem",
+ "%macresource%", "FileSystem",
{
iodev_macresource_init, iodev_no_open_device,
iodev_macresource_open_file,
@@ -376,10 +374,10 @@ iodev_macresource_open_file(gx_io_device *iodev, const char *fname, uint namelen
bool datafork = 0;
int size;
byte *buf;
-
+
/* return NULL if there's an error */
*ps = NULL;
-
+
strncpy(filename, fname, min(namelen, gp_file_name_sizeof));
if (namelen < gp_file_name_sizeof) filename[namelen] = '\0';
/* parse out the resource type and id. they're appended to the pathname
@@ -399,7 +397,7 @@ iodev_macresource_open_file(gx_io_device *iodev, const char *fname, uint namelen
type = res_string2type(res_type_string);
id = (ushort)atoi(res_id_string);
if_debug3('s', "[s] opening resource fork of '%s' for type '%s' id '%d'\n", filename, res_type_string, id);
-
+
/* we call with a NULL buffer to get the size */
size = gp_read_macresource(NULL, filename, type, id);
if (size == 0) {
@@ -407,15 +405,15 @@ iodev_macresource_open_file(gx_io_device *iodev, const char *fname, uint namelen
/* try to open as a .dfont from here */
if_debug0('s', "[s] trying to open as a datafork file instead...\n");
size = read_datafork_resource(NULL, filename, type, id);
- if (size != 0) {
+ if (size != 0) {
datafork = true;
- } else {
+ } else {
if_debug0('s', "could not get resource size\n");
- return_error(e_invalidfileaccess);
- }
+ return_error(e_invalidfileaccess);
+ }
}
if_debug1('s', "[s] got resource size %d bytes\n", size);
- /* allocate a buffer */
+ /* allocate a buffer */
buf = gs_alloc_string(mem, size, "macresource buffer");
if (buf == NULL) {
if_debug0('s', "macresource: could not allocate buffer for resource data\n");
@@ -427,7 +425,7 @@ iodev_macresource_open_file(gx_io_device *iodev, const char *fname, uint namelen
} else {
size = read_datafork_resource(buf, filename, type, id);
}
-
+
/* allocate stream *ps and set it up with the buffered data */
*ps = s_alloc(mem, "macresource");
sread_string(*ps, buf, size);
diff --git a/gs/base/gsiorom.c b/gs/base/gsiorom.c
index 5d46da19b..394b533fe 100644
--- a/gs/base/gsiorom.c
+++ b/gs/base/gsiorom.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -13,7 +13,7 @@
/* $Id$ */
/* %rom% IODevice implementation for a compressed in-memory filesystem */
-
+
/*
* This file implements a special %rom% IODevice designed for embedded
* use. It accesses a compressed filesytem image which may be stored
@@ -55,7 +55,7 @@ const gx_io_device gs_iodev_rom =
iodev_no_fopen, iodev_no_fclose,
iodev_no_delete_file, iodev_no_rename_file,
romfs_file_status,
- romfs_enumerate_files_init, romfs_enumerate_next, romfs_enumerate_close,
+ romfs_enumerate_files_init, romfs_enumerate_next, romfs_enumerate_close,
iodev_no_get_params, iodev_no_put_params
}
};
@@ -96,20 +96,20 @@ static int
s_block_read_seek(stream *, long),
s_block_read_close(stream *),
s_block_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
/* Initialize a stream for reading from a collection of blocks */
static void
sread_block(register stream *s, const byte *ptr, uint len, const uint32_t *node )
{
static const stream_procs p = {
- s_block_read_available, s_block_read_seek, s_std_read_reset,
- s_std_read_flush, s_block_read_close, s_block_read_process,
- NULL /* no read_switch */
+ s_block_read_available, s_block_read_seek, s_std_read_reset,
+ s_std_read_flush, s_block_read_close, s_block_read_process,
+ NULL /* no read_switch */
};
s_std_init(s, (byte *)ptr, len, &p, s_mode_read + s_mode_seek);
s->end_status = 0;
- s->file = (FILE *)node; /* convenient place to put it for %rom% files */
+ s->file = (FILE *)node; /* convenient place to put it for %rom% files */
s->file_modes = s->modes;
s->file_offset = 0;
s->file_limit = max_long;
@@ -124,7 +124,7 @@ s_block_read_available(stream *s, long *pl)
*pl = filelen - s->position - (sbufptr(s) - s->cbuf);
if (*pl == 0 && s->close_at_eod) /* EOF */
- *pl = -1;
+ *pl = -1;
return 0;
}
@@ -138,24 +138,24 @@ s_block_read_seek(register stream * s, long pos)
long offset = pos - s->position;
if (pos < 0 || pos > filelen)
- return ERRC;
+ return ERRC;
if (offset < 0 || offset > end) {
- /* Need to pull a different block into the buffer */
- stream_cursor_write pw;
-
- /* buffer stays aligned to blocks */
- offset = (s->file_offset + pos) % ROMFS_BLOCKSIZE;
- s->position = pos - offset;
- pw.ptr = s->cbuf - 1;
- pw.limit = pw.ptr + s->cbsize;
- s->srptr = s->srlimit = s->cbuf - 1;
- if ((s->end_status = s_block_read_process((stream_state *)s, NULL, &pw, 0)) == ERRC)
- return ERRC;
- if (s->end_status == 1)
- s->end_status = 0;
- s->srptr = s->cbuf - 1;
- s->srlimit = pw.ptr; /* limit of the block just read */
- }
+ /* Need to pull a different block into the buffer */
+ stream_cursor_write pw;
+
+ /* buffer stays aligned to blocks */
+ offset = (s->file_offset + pos) % ROMFS_BLOCKSIZE;
+ s->position = pos - offset;
+ pw.ptr = s->cbuf - 1;
+ pw.limit = pw.ptr + s->cbsize;
+ s->srptr = s->srlimit = s->cbuf - 1;
+ if ((s->end_status = s_block_read_process((stream_state *)s, NULL, &pw, 0)) == ERRC)
+ return ERRC;
+ if (s->end_status == 1)
+ s->end_status = 0;
+ s->srptr = s->cbuf - 1;
+ s->srlimit = pw.ptr; /* limit of the block just read */
+ }
/* Now set the read pointer to the correct place in the buffer */
s->srptr = s->cbuf + offset - 1;
return 0;
@@ -173,7 +173,7 @@ s_block_read_close(stream * s)
static int
s_block_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
int code;
stream *s = (stream *)st; /* no separate state */
@@ -190,53 +190,53 @@ s_block_read_process(stream_state * st, stream_cursor_read * ignore_pr,
int count = iblock < (blocks - 1) ? ROMFS_BLOCKSIZE : filelen - (ROMFS_BLOCKSIZE * iblock);
if (s->position + (s->cursor.r.limit - s->cbuf + 1) >= filelen || block_data == NULL)
- return EOFC; /* at EOF */
+ return EOFC; /* at EOF */
if (s->file_limit < max_long) {
- /* Adjust count for subfile limit */
- uint32_t limit_count = s->file_offset + s->file_limit - s->position;
+ /* Adjust count for subfile limit */
+ uint32_t limit_count = s->file_offset + s->file_limit - s->position;
- if (count > limit_count)
- count = limit_count;
+ if (count > limit_count)
+ count = limit_count;
}
/* get the block into the buffer */
if (compression) {
- unsigned long buflen = ROMFS_BLOCKSIZE;
- byte *dest = (pw->ptr + 1); /* destination for unpack */
- int need_copy = false;
-
- /* If the dest is not in our buffer, we can only use it if there */
- /* is enough space in it */
- if ((dest < s->cbuf) || (dest >= (s->cbuf + s->cbsize))) {
- /* the destination is _not_ in our buffer. If the area isn't */
- /* big enough we need to ucompress to our buffer, then copy */
- /* the data afterward. INVARIANT: if the buffer is outside */
- /* the cbuf, then the cbuf must be empty. */
- if (max_count < count) {
+ unsigned long buflen = ROMFS_BLOCKSIZE;
+ byte *dest = (pw->ptr + 1); /* destination for unpack */
+ int need_copy = false;
+
+ /* If the dest is not in our buffer, we can only use it if there */
+ /* is enough space in it */
+ if ((dest < s->cbuf) || (dest >= (s->cbuf + s->cbsize))) {
+ /* the destination is _not_ in our buffer. If the area isn't */
+ /* big enough we need to ucompress to our buffer, then copy */
+ /* the data afterward. INVARIANT: if the buffer is outside */
+ /* the cbuf, then the cbuf must be empty. */
+ if (max_count < count) {
#ifdef DEBUG
- if ((sbufptr(s)) != s->srlimit)
- emprintf(s->memory, "cbuf not empty as expected\n.");
+ if ((sbufptr(s)) != s->srlimit)
+ emprintf(s->memory, "cbuf not empty as expected\n.");
#endif
- dest = s->cbuf;
- need_copy = true;
- }
- }
- /* Decompress the data into this block */
- code = uncompress (dest, &buflen, block_data, block_length);
- if (count != buflen)
- return ERRC;
- if (need_copy) {
- memcpy(pw->ptr+1, dest, max_count);
- count = max_count;
- }
+ dest = s->cbuf;
+ need_copy = true;
+ }
+ }
+ /* Decompress the data into this block */
+ code = uncompress (dest, &buflen, block_data, block_length);
+ if (count != buflen)
+ return ERRC;
+ if (need_copy) {
+ memcpy(pw->ptr+1, dest, max_count);
+ count = max_count;
+ }
} else {
- /* not compressed -- just copy it */
- count = block_length;
- if (count > max_count)
- count = max_count;
- memcpy(pw->ptr+1, block_data, count);
+ /* not compressed -- just copy it */
+ count = block_length;
+ if (count > max_count)
+ count = max_count;
+ memcpy(pw->ptr+1, block_data, count);
}
if (count < 0)
- count = 0;
+ count = 0;
pw->ptr += count;
process_interrupts(s->memory);
return status;
@@ -245,10 +245,10 @@ s_block_read_process(stream_state * st, stream_cursor_read * ignore_pr,
static int
romfs_init(gx_io_device *iodev, gs_memory_t *mem)
{
- romfs_state *state = gs_alloc_struct(mem, romfs_state, &st_romfs_state,
+ romfs_state *state = gs_alloc_struct(mem, romfs_state, &st_romfs_state,
"romfs_init(state)");
if (!state)
- return gs_error_VMerror;
+ return gs_error_VMerror;
iodev->state = state;
return 0;
}
@@ -270,26 +270,26 @@ romfs_open_file(gx_io_device *iodev, const char *fname, uint namelen,
/* scan the inodes to find the requested file */
for (i=0; node_scan != 0; i++, node_scan = gs_romfs[i]) {
- filelen = get_u32_big_endian(node_scan) & 0x7fffffff; /* ignore compression bit */
- blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
- filename = (char *)(&(node_scan[1+(2*blocks)]));
- if ((namelen == strlen(filename)) &&
- (strncmp(filename, fname, namelen) == 0)) {
- node = node_scan;
- break;
- }
+ filelen = get_u32_big_endian(node_scan) & 0x7fffffff; /* ignore compression bit */
+ blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
+ filename = (char *)(&(node_scan[1+(2*blocks)]));
+ if ((namelen == strlen(filename)) &&
+ (strncmp(filename, fname, namelen) == 0)) {
+ node = node_scan;
+ break;
+ }
}
/* inode points to the file (or NULL if not found */
if (node == NULL)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
/* Initialize a stream for reading this romfs file using a common function */
/* we get a buffer that is larger than what we need for decompression */
/* we need extra space since some filters may leave data in the buffer when */
/* calling 'read_process' */
code = file_prepare_stream(fname, namelen, access, ROMFS_BLOCKSIZE+256, ps, fmode, mem);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
sread_block(*ps, (*ps)->cbuf, (*ps)->cbsize, node);
/* return success */
return 0;
@@ -309,18 +309,18 @@ romfs_file_status(gx_io_device * iodev, const char *fname, struct stat *pstat)
memset(pstat, 0, sizeof(struct stat));
/* scan the inodes to find the requested file */
for (i=0; node_scan != 0; i++, node_scan = gs_romfs[i]) {
- filelen = get_u32_big_endian(node_scan) & 0x7fffffff; /* ignore compression bit */
- blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
- filename = (char *)(&(node_scan[1+(2*blocks)]));
- if ((namelen == strlen(filename)) &&
- (strncmp(filename, fname, namelen) == 0)) {
- node = node_scan;
- break;
- }
+ filelen = get_u32_big_endian(node_scan) & 0x7fffffff; /* ignore compression bit */
+ blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
+ filename = (char *)(&(node_scan[1+(2*blocks)]));
+ if ((namelen == strlen(filename)) &&
+ (strncmp(filename, fname, namelen) == 0)) {
+ node = node_scan;
+ break;
+ }
}
/* inode points to the file (or NULL if not found */
if (node == NULL)
- return_error(gs_error_undefinedfilename);
+ return_error(gs_error_undefinedfilename);
/* fill in the values used by zstatus */
pstat->st_size = filelen;
@@ -331,10 +331,10 @@ romfs_file_status(gx_io_device * iodev, const char *fname, struct stat *pstat)
static file_enum *
romfs_enumerate_files_init(gx_io_device *iodev, const char *pat, uint patlen,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
romfs_file_enum *penum = gs_alloc_struct(mem, romfs_file_enum, &st_romfs_file_enum,
- "romfs_enumerate_files_init(file_enum)");
+ "romfs_enumerate_files_init(file_enum)");
if (penum == NULL)
return NULL;
memset(penum, 0, sizeof(romfs_file_enum));
@@ -342,8 +342,8 @@ romfs_enumerate_files_init(gx_io_device *iodev, const char *pat, uint patlen,
penum->list_index = 0; /* start at first node */
penum->memory = mem;
if (penum->pattern == NULL) {
- romfs_enumerate_close((file_enum *) penum);
- return NULL;
+ romfs_enumerate_close((file_enum *) penum);
+ return NULL;
}
memcpy(penum->pattern, pat, patlen); /* Copy string to buffer */
penum->pattern[patlen]=0; /* Terminate string */
@@ -358,7 +358,7 @@ romfs_enumerate_close(file_enum *pfen)
gs_memory_t *mem = penum->memory;
if (penum->pattern)
- gs_free_object(mem, penum->pattern, "romfs_enum_init(pattern)");
+ gs_free_object(mem, penum->pattern, "romfs_enum_init(pattern)");
gs_free_object(mem, penum, "romfs_enum_init(romfs_enum)");
}
@@ -367,21 +367,21 @@ romfs_enumerate_next(file_enum *pfen, char *ptr, uint maxlen)
{
extern const uint32_t *gs_romfs[];
romfs_file_enum *penum = (romfs_file_enum *)pfen;
-
+
while (gs_romfs[penum->list_index] != 0) {
- const uint32_t *node = gs_romfs[penum->list_index];
- uint32_t filelen = get_u32_big_endian(node) & 0x7fffffff; /* ignore compression bit */
- uint32_t blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
- char *filename = (char *)(&(node[1+(2*blocks)]));
-
- penum->list_index++; /* bump to next unconditionally */
- if (string_match((byte *)filename, strlen(filename),
- (byte *)penum->pattern,
- strlen(penum->pattern), 0)) {
- if (strlen(filename) < maxlen)
- memcpy(ptr, filename, strlen(filename));
- return strlen(filename); /* if > maxlen, caller will detect rangecheck */
- }
+ const uint32_t *node = gs_romfs[penum->list_index];
+ uint32_t filelen = get_u32_big_endian(node) & 0x7fffffff; /* ignore compression bit */
+ uint32_t blocks = (filelen+ROMFS_BLOCKSIZE-1)/ ROMFS_BLOCKSIZE;
+ char *filename = (char *)(&(node[1+(2*blocks)]));
+
+ penum->list_index++; /* bump to next unconditionally */
+ if (string_match((byte *)filename, strlen(filename),
+ (byte *)penum->pattern,
+ strlen(penum->pattern), 0)) {
+ if (strlen(filename) < maxlen)
+ memcpy(ptr, filename, strlen(filename));
+ return strlen(filename); /* if > maxlen, caller will detect rangecheck */
+ }
}
/* ran off end of list, close the enum */
romfs_enumerate_close(pfen);
diff --git a/gs/base/gsiorom.h b/gs/base/gsiorom.h
index 720706d79..3c099a43d 100644
--- a/gs/base/gsiorom.h
+++ b/gs/base/gsiorom.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsipar3x.h b/gs/base/gsipar3x.h
index f1d9dfb63..a2b47c33a 100644
--- a/gs/base/gsipar3x.h
+++ b/gs/base/gsipar3x.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsiparam.h b/gs/base/gsiparam.h
index eb6eed3bb..97dd81889 100644
--- a/gs/base/gsiparam.h
+++ b/gs/base/gsiparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,11 +44,11 @@ typedef struct gx_image_type_s gx_image_type_t;
#endif
#define gs_image_common\
- const gx_image_type_t *type;\
- /*\
- * Define the transformation from user space to image space.\
- */\
- gs_matrix ImageMatrix
+ const gx_image_type_t *type;\
+ /*\
+ * Define the transformation from user space to image space.\
+ */\
+ gs_matrix ImageMatrix
typedef struct gs_image_common_s {
gs_image_common;
} gs_image_common_t;
@@ -57,8 +57,8 @@ typedef struct gs_image_common_s {
gs_public_st_simple(st_gs_image_common, gs_image_common_t,\
"gs_image_common_t")
-/* Parent image type enumerations. Since type3 images can give rise to
- type 1 image types, we want to know the origin of these to avoid
+/* Parent image type enumerations. Since type3 images can give rise to
+ type 1 image types, we want to know the origin of these to avoid
doing different halftone methods to the image and the mask. */
typedef enum {
gs_image_type1,
@@ -87,34 +87,34 @@ typedef enum {
* how the data are actually supplied.
*/
#define gs_data_image_common\
- gs_image_common;\
- /*\
- * Define the width of source image in pixels.\
- */\
- int Width;\
- /*\
- * Define the height of source image in pixels.\
- */\
- int Height;\
- /*\
- * Define B, the number of bits per pixel component.\
- * Currently this must be 1 for masks.\
- */\
- int BitsPerComponent;\
- /*\
- * Define the linear remapping of the input values.\
- * For the I'th pixel component, we start by treating\
- * the B bits of component data as a fraction F between\
- * 0 and 1; the actual component value is then\
- * Decode[I*2] + F * (Decode[I*2+1] - Decode[I*2]).\
- * For masks, only the first two entries are used;\
- * they must be 1,0 for write-0s masks, 0,1 for write-1s.\
- */\
- float Decode[GS_IMAGE_MAX_COMPONENTS * 2];\
- /*\
- * Define whether to smooth the image.\
- */\
- bool Interpolate
+ gs_image_common;\
+ /*\
+ * Define the width of source image in pixels.\
+ */\
+ int Width;\
+ /*\
+ * Define the height of source image in pixels.\
+ */\
+ int Height;\
+ /*\
+ * Define B, the number of bits per pixel component.\
+ * Currently this must be 1 for masks.\
+ */\
+ int BitsPerComponent;\
+ /*\
+ * Define the linear remapping of the input values.\
+ * For the I'th pixel component, we start by treating\
+ * the B bits of component data as a fraction F between\
+ * 0 and 1; the actual component value is then\
+ * Decode[I*2] + F * (Decode[I*2+1] - Decode[I*2]).\
+ * For masks, only the first two entries are used;\
+ * they must be 1,0 for write-0s masks, 0,1 for write-1s.\
+ */\
+ float Decode[GS_IMAGE_MAX_COMPONENTS * 2];\
+ /*\
+ * Define whether to smooth the image.\
+ */\
+ bool Interpolate
typedef struct gs_data_image_s {
gs_data_image_common;
} gs_data_image_t;
@@ -155,27 +155,26 @@ typedef struct gs_color_space_s gs_color_space;
#endif
#define gs_pixel_image_common\
- gs_data_image_common;\
- /*\
- * Define how the pixels are divided up into planes.\
- */\
- gs_image_format_t format;\
- /*\
- * Define whether to use the drawing color as the\
- * "texture" for RasterOp. For more information,\
- * see the discussion of RasterOp in Language.htm.\
- */\
- bool CombineWithColor;\
- /*\
- * Define the source color space (must be NULL for masks).\
- *\
+ gs_data_image_common;\
+ /*\
+ * Define how the pixels are divided up into planes.\
+ */\
+ gs_image_format_t format;\
+ /*\
+ * Define whether to use the drawing color as the\
+ * "texture" for RasterOp. For more information,\
+ * see the discussion of RasterOp in Language.htm.\
+ */\
+ bool CombineWithColor;\
+ /*\
+ * Define the source color space (must be NULL for masks).\
+ *\
* Make the pointer the last element of the structure.\
* Otherwise, the padding at the end overwrites the 1st\
* member of the subclass, when the base structure is assigned\
* to the subclass structure. Bugs 613909, 688725\
*/\
- gs_color_space *ColorSpace
-
+ gs_color_space *ColorSpace
typedef struct gs_pixel_image_s {
gs_pixel_image_common;
@@ -219,8 +218,8 @@ typedef struct gs_image1_s {
*/
gs_image_alpha_t Alpha;
/*
- * Define the parent image type that gave rise to this.
- * Used to avoid the use of mixed halftoning methods
+ * Define the parent image type that gave rise to this.
+ * Used to avoid the use of mixed halftoning methods
* between images and their masks, which
* can cause misalignment issues in pixel replications.
*/
@@ -265,7 +264,7 @@ void
* (Decode is not initialized).
*/
gs_pixel_image_t_init(gs_pixel_image_t * pim,
- gs_color_space * color_space);
+ gs_color_space * color_space);
/*
* Initialize an ImageType 1 image (or imagemask). Also sets ImageMask,
@@ -280,11 +279,11 @@ void
* pim->ImageMask is true.
*/
void gs_image_t_init_adjust(gs_image_t * pim, gs_color_space * pcs,
- bool adjust);
+ bool adjust);
#define gs_image_t_init(pim, pcs)\
gs_image_t_init_adjust(pim, pcs, true)
void gs_image_t_init_mask_adjust(gs_image_t * pim, bool write_1s,
- bool adjust);
+ bool adjust);
#define gs_image_t_init_mask(pim, write_1s)\
gs_image_t_init_mask_adjust(pim, write_1s, true)
@@ -301,7 +300,6 @@ typedef struct ht_landscape_info_s {
int y_pos;
} ht_landscape_info_t;
-
/****** REMAINDER OF FILE UNDER CONSTRUCTION. PROCEED AT YOUR OWN RISK. ******/
#if 0
@@ -314,10 +312,10 @@ typedef struct ht_landscape_info_s {
*/
int gx_map_image_color(gx_device * dev,
- const gs_image_t * pim,
- const gx_color_rendering_info * pcri,
- const uint components[GS_IMAGE_MAX_COMPONENTS],
- gx_drawing_color * pdcolor);
+ const gs_image_t * pim,
+ const gx_color_rendering_info * pcri,
+ const uint components[GS_IMAGE_MAX_COMPONENTS],
+ gx_drawing_color * pdcolor);
/*
Map a source color to a drawing color. The components are simply the
diff --git a/gs/base/gsiparm2.h b/gs/base/gsiparm2.h
index 72f3da83d..90e5ad7e7 100644
--- a/gs/base/gsiparm2.h
+++ b/gs/base/gsiparm2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsiparm3.h b/gs/base/gsiparm3.h
index 5cab5a4a2..d5efae044 100644
--- a/gs/base/gsiparm3.h
+++ b/gs/base/gsiparm3.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,6 +50,6 @@ typedef struct gs_image3_s {
* Initialize an ImageType 3 image.
*/
void gs_image3_t_init(gs_image3_t * pim, gs_color_space * color_space,
- gs_image3_interleave_type_t interleave_type);
+ gs_image3_interleave_type_t interleave_type);
#endif /* gsiparm3_INCLUDED */
diff --git a/gs/base/gsiparm4.h b/gs/base/gsiparm4.h
index 6a0d93d7d..9b6a8024b 100644
--- a/gs/base/gsiparm4.h
+++ b/gs/base/gsiparm4.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,8 +38,8 @@ typedef struct gs_image4_s {
bool MaskColor_is_range;
uint MaskColor[GS_IMAGE_MAX_COMPONENTS * 2];
/*
- * Define the parent image type that gave rise to this.
- * Used to avoid the use of mixed halftoning methods
+ * Define the parent image type that gave rise to this.
+ * Used to avoid the use of mixed halftoning methods
* between images and their masks, which
* can cause misalignment issues in pixel replications.
*/
diff --git a/gs/base/gsistate.c b/gs/base/gsistate.c
index 3306fbb69..ea2b8ac09 100644
--- a/gs/base/gsistate.c
+++ b/gs/base/gsistate.c
@@ -44,12 +44,12 @@ extern /*const*/ gx_color_map_procs *const cmap_procs_default;
static
ENUM_PTRS_WITH(line_params_enum_ptrs, gx_line_params *plp) return 0;
case 0: return ENUM_OBJ((plp->dash.pattern_size == 0 ?
- NULL : plp->dash.pattern));
+ NULL : plp->dash.pattern));
ENUM_PTRS_END
static RELOC_PTRS_WITH(line_params_reloc_ptrs, gx_line_params *plp)
{
if (plp->dash.pattern_size)
- RELOC_VAR(plp->dash.pattern);
+ RELOC_VAR(plp->dash.pattern);
} RELOC_PTRS_END
private_st_line_params();
@@ -94,7 +94,6 @@ static RELOC_PTRS_BEGIN(imager_state_reloc_ptrs)
}
} RELOC_PTRS_END
-
/* Initialize an imager state, other than the parts covered by */
/* gs_imager_state_initial. */
int
@@ -108,10 +107,10 @@ gs_imager_state_initialize(gs_imager_state * pis, gs_memory_t * mem)
/* Color rendering state */
pis->halftone = 0;
{
- int i;
+ int i;
- for (i = 0; i < gs_color_select_count; ++i)
- pis->screen_phase[i].x = pis->screen_phase[i].y = 0;
+ for (i = 0; i < gs_color_select_count; ++i)
+ pis->screen_phase[i].x = pis->screen_phase[i].y = 0;
}
pis->dev_ht = 0;
pis->cie_render = 0;
@@ -120,17 +119,17 @@ gs_imager_state_initialize(gs_imager_state * pis, gs_memory_t * mem)
pis->undercolor_removal = 0;
/* Allocate an initial transfer map. */
rc_alloc_struct_n(pis->set_transfer.gray,
- gx_transfer_map, &st_transfer_map,
- mem, return_error(gs_error_VMerror),
- "gs_imager_state_init(transfer)", 1);
+ gx_transfer_map, &st_transfer_map,
+ mem, return_error(gs_error_VMerror),
+ "gs_imager_state_init(transfer)", 1);
pis->set_transfer.gray->proc = gs_identity_transfer;
pis->set_transfer.gray->id = gs_next_ids(pis->memory, 1);
pis->set_transfer.gray->values[0] = frac_0;
pis->set_transfer.red =
- pis->set_transfer.green =
- pis->set_transfer.blue = NULL;
+ pis->set_transfer.green =
+ pis->set_transfer.blue = NULL;
for (i = 0; i < GX_DEVICE_COLOR_MAX_COMPONENTS; i++)
- pis->effective_transfer[i] = pis->set_transfer.gray;
+ pis->effective_transfer[i] = pis->set_transfer.gray;
pis->cie_joint_caches = NULL;
pis->cie_joint_caches_alt = NULL;
pis->cmap_procs = cmap_procs_default;
@@ -153,12 +152,12 @@ gs_imager_state *
gs_imager_state_copy(const gs_imager_state * pis, gs_memory_t * mem)
{
gs_imager_state *pis_copy =
- gs_alloc_struct(mem, gs_imager_state, &st_imager_state,
- "gs_imager_state_copy");
+ gs_alloc_struct(mem, gs_imager_state, &st_imager_state,
+ "gs_imager_state_copy");
if (pis_copy) {
- *pis_copy = *pis;
- pis_copy->transparency_stack = 0;
+ *pis_copy = *pis;
+ pis_copy->transparency_stack = 0;
}
return pis_copy;
}
@@ -236,7 +235,7 @@ gs_imager_state_release(gs_imager_state * pis)
* dependent structures as well.
*/
if (pdht != 0 && pdht->rc.ref_count == 1) {
- gx_device_halftone_release(pdht, pdht->rc.memory);
+ gx_device_halftone_release(pdht, pdht->rc.memory);
}
RCDECR(dev_ht);
RCDECR(halftone);
diff --git a/gs/base/gsjconf.h b/gs/base/gsjconf.h
index ba0036cb4..4658b9914 100644
--- a/gs/base/gsjconf.h
+++ b/gs/base/gsjconf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsjmorec.h b/gs/base/gsjmorec.h
index 743e42d4f..973d0dad8 100644
--- a/gs/base/gsjmorec.h
+++ b/gs/base/gsjmorec.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gslib.c b/gs/base/gslib.c
index 3c03c7bc6..2f578a6f4 100644
--- a/gs/base/gslib.c
+++ b/gs/base/gslib.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,9 +67,9 @@ static int test10(gs_state *, gs_memory_t *); /* captured data */
static int (*tests[]) (gs_state *, gs_memory_t *) =
{
test1, test2, test3, test4, test5,
- test6, test7, test8, 0
+ test6, test7, test8, 0
#ifdef CAPTURE
- test10
+ test10
#endif
};
@@ -97,10 +97,10 @@ main(int argc, const char *argv[])
mem = gs_malloc_init();
gs_lib_init1(mem);
if (argc < 2 || (achar = argv[1][0]) < '1' ||
- achar > '0' + countof(tests) - 1
- ) {
- lprintf1("Usage: gslib 1..%c\n", '0' + (char)countof(tests) - 1);
- gs_abort(mem);
+ achar > '0' + countof(tests) - 1
+ ) {
+ lprintf1("Usage: gslib 1..%c\n", '0' + (char)countof(tests) - 1);
+ gs_abort(mem);
}
gs_debug['@'] = 1;
gs_debug['?'] = 1;
@@ -117,66 +117,66 @@ main(int argc, const char *argv[])
check_device_separable(dev);
gx_device_fill_in_procs(dev);
bbdev =
- gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
- "bbox");
+ gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
+ "bbox");
gx_device_bbox_init(bbdev, dev, mem);
/* Print out the device name just to test the gsparam.c API. */
{
- gs_c_param_list list;
- gs_param_string nstr;
-
- gs_c_param_list_write(&list, mem);
- code = gs_getdeviceparams(dev, (gs_param_list *) & list);
- if (code < 0) {
- lprintf1("getdeviceparams failed! code = %d\n", code);
- gs_abort(mem);
- }
- gs_c_param_list_read(&list);
- code = param_read_string((gs_param_list *) & list, "Name", &nstr);
- if (code < 0) {
- lprintf1("reading Name failed! code = %d\n", code);
- gs_abort(mem);
- }
- dputs("Device name = ");
- debug_print_string(nstr.data, nstr.size);
- dputs("\n");
- gs_c_param_list_release(&list);
+ gs_c_param_list list;
+ gs_param_string nstr;
+
+ gs_c_param_list_write(&list, mem);
+ code = gs_getdeviceparams(dev, (gs_param_list *) & list);
+ if (code < 0) {
+ lprintf1("getdeviceparams failed! code = %d\n", code);
+ gs_abort(mem);
+ }
+ gs_c_param_list_read(&list);
+ code = param_read_string((gs_param_list *) & list, "Name", &nstr);
+ if (code < 0) {
+ lprintf1("reading Name failed! code = %d\n", code);
+ gs_abort(mem);
+ }
+ dputs("Device name = ");
+ debug_print_string(nstr.data, nstr.size);
+ dputs("\n");
+ gs_c_param_list_release(&list);
}
/*
* If this is a device that takes an OutputFile, set the OutputFile
* to "-" in the copy.
*/
{
- gs_c_param_list list;
- gs_param_string nstr;
-
- gs_c_param_list_write(&list, mem);
- param_string_from_string(nstr, "-");
- code = param_write_string((gs_param_list *)&list, "OutputFile", &nstr);
- if (code < 0) {
- lprintf1("writing OutputFile failed! code = %d\n", code);
- gs_abort(mem);
- }
- gs_c_param_list_read(&list);
- code = gs_putdeviceparams(dev, (gs_param_list *)&list);
- gs_c_param_list_release(&list);
- if (code < 0 && code != gs_error_undefined) {
- lprintf1("putdeviceparams failed! code = %d\n", code);
- gs_abort(mem);
- }
+ gs_c_param_list list;
+ gs_param_string nstr;
+
+ gs_c_param_list_write(&list, mem);
+ param_string_from_string(nstr, "-");
+ code = param_write_string((gs_param_list *)&list, "OutputFile", &nstr);
+ if (code < 0) {
+ lprintf1("writing OutputFile failed! code = %d\n", code);
+ gs_abort(mem);
+ }
+ gs_c_param_list_read(&list);
+ code = gs_putdeviceparams(dev, (gs_param_list *)&list);
+ gs_c_param_list_release(&list);
+ if (code < 0 && code != gs_error_undefined) {
+ lprintf1("putdeviceparams failed! code = %d\n", code);
+ gs_abort(mem);
+ }
}
dev = (gx_device *) bbdev;
pgs = gs_state_alloc(mem);
gs_setdevice_no_erase(pgs, dev); /* can't erase yet */
{
- gs_point dpi;
- gs_screen_halftone ht;
-
- gs_dtransform(pgs, 72.0, 72.0, &dpi);
- ht.frequency = min(fabs(dpi.x), fabs(dpi.y)) / 16.001;
- ht.angle = 0;
- ht.spot_function = odsf;
- gs_setscreen(pgs, &ht);
+ gs_point dpi;
+ gs_screen_halftone ht;
+
+ gs_dtransform(pgs, 72.0, 72.0, &dpi);
+ ht.frequency = min(fabs(dpi.x), fabs(dpi.y)) / 16.001;
+ ht.angle = 0;
+ ht.spot_function = odsf;
+ gs_setscreen(pgs, &ht);
}
/* gsave and grestore (among other places) assume that */
/* there are at least 2 gstates on the graphics stack. */
@@ -187,14 +187,14 @@ main(int argc, const char *argv[])
code = (*tests[achar - '1']) (pgs, mem);
gs_output_page(pgs, 1, 1);
{
- gs_rect bbox;
+ gs_rect bbox;
- gx_device_bbox_bbox(bbdev, &bbox);
- dprintf4("Bounding box: [%g %g %g %g]\n",
- bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
+ gx_device_bbox_bbox(bbdev, &bbox);
+ dprintf4("Bounding box: [%g %g %g %g]\n",
+ bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
}
if (code)
- dprintf1("**** Test returned code = %d.\n", code);
+ dprintf1("**** Test returned code = %d.\n", code);
dputs("Done. Press <enter> to exit.");
fgetc(mem->gs_lib_ctx->fstdin);
gs_lib_finit(0, 0, mem);
@@ -207,22 +207,22 @@ odsf(floatp x, floatp y)
{
static const byte dither[256] =
{
- 0x0E, 0x8E, 0x2E, 0xAE, 0x06, 0x86, 0x26, 0xA6, 0x0C, 0x8C, 0x2C, 0xAC, 0x04, 0x84, 0x24, 0xA4,
- 0xCE, 0x4E, 0xEE, 0x6E, 0xC6, 0x46, 0xE6, 0x66, 0xCC, 0x4C, 0xEC, 0x6C, 0xC4, 0x44, 0xE4, 0x64,
- 0x3E, 0xBE, 0x1E, 0x9E, 0x36, 0xB6, 0x16, 0x96, 0x3C, 0xBC, 0x1C, 0x9C, 0x34, 0xB4, 0x14, 0x94,
- 0xFE, 0x7E, 0xDE, 0x5E, 0xF6, 0x76, 0xD6, 0x56, 0xFC, 0x7C, 0xDC, 0x5C, 0xF4, 0x74, 0xD4, 0x54,
- 0x01, 0x81, 0x21, 0xA1, 0x09, 0x89, 0x29, 0xA9, 0x03, 0x83, 0x23, 0xA3, 0x0B, 0x8B, 0x2B, 0xAB,
- 0xC1, 0x41, 0xE1, 0x61, 0xC9, 0x49, 0xE9, 0x69, 0xC3, 0x43, 0xE3, 0x63, 0xCB, 0x4B, 0xEB, 0x6B,
- 0x31, 0xB1, 0x11, 0x91, 0x39, 0xB9, 0x19, 0x99, 0x33, 0xB3, 0x13, 0x93, 0x3B, 0xBB, 0x1B, 0x9B,
- 0xF1, 0x71, 0xD1, 0x51, 0xF9, 0x79, 0xD9, 0x59, 0xF3, 0x73, 0xD3, 0x53, 0xFB, 0x7B, 0xDB, 0x5B,
- 0x0D, 0x8D, 0x2D, 0xAD, 0x05, 0x85, 0x25, 0xA5, 0x0F, 0x8F, 0x2F, 0xAF, 0x07, 0x87, 0x27, 0xA7,
- 0xCD, 0x4D, 0xED, 0x6D, 0xC5, 0x45, 0xE5, 0x65, 0xCF, 0x4F, 0xEF, 0x6F, 0xC7, 0x47, 0xE7, 0x67,
- 0x3D, 0xBD, 0x1D, 0x9D, 0x35, 0xB5, 0x15, 0x95, 0x3F, 0xBF, 0x1F, 0x9F, 0x37, 0xB7, 0x17, 0x97,
- 0xFD, 0x7D, 0xDD, 0x5D, 0xF5, 0x75, 0xD5, 0x55, 0xFF, 0x7F, 0xDF, 0x5F, 0xF7, 0x77, 0xD7, 0x57,
- 0x02, 0x82, 0x22, 0xA2, 0x0A, 0x8A, 0x2A, 0xAA, 0x00, 0x80, 0x20, 0xA0, 0x08, 0x88, 0x28, 0xA8,
- 0xC2, 0x42, 0xE2, 0x62, 0xCA, 0x4A, 0xEA, 0x6A, 0xC0, 0x40, 0xE0, 0x60, 0xC8, 0x48, 0xE8, 0x68,
- 0x32, 0xB2, 0x12, 0x92, 0x3A, 0xBA, 0x1A, 0x9A, 0x30, 0xB0, 0x10, 0x90, 0x38, 0xB8, 0x18, 0x98,
- 0xF2, 0x72, 0xD2, 0x52, 0xFA, 0x7A, 0xDA, 0x5A, 0xF0, 0x70, 0xD0, 0x50, 0xF8, 0x78, 0xD8, 0x58
+ 0x0E, 0x8E, 0x2E, 0xAE, 0x06, 0x86, 0x26, 0xA6, 0x0C, 0x8C, 0x2C, 0xAC, 0x04, 0x84, 0x24, 0xA4,
+ 0xCE, 0x4E, 0xEE, 0x6E, 0xC6, 0x46, 0xE6, 0x66, 0xCC, 0x4C, 0xEC, 0x6C, 0xC4, 0x44, 0xE4, 0x64,
+ 0x3E, 0xBE, 0x1E, 0x9E, 0x36, 0xB6, 0x16, 0x96, 0x3C, 0xBC, 0x1C, 0x9C, 0x34, 0xB4, 0x14, 0x94,
+ 0xFE, 0x7E, 0xDE, 0x5E, 0xF6, 0x76, 0xD6, 0x56, 0xFC, 0x7C, 0xDC, 0x5C, 0xF4, 0x74, 0xD4, 0x54,
+ 0x01, 0x81, 0x21, 0xA1, 0x09, 0x89, 0x29, 0xA9, 0x03, 0x83, 0x23, 0xA3, 0x0B, 0x8B, 0x2B, 0xAB,
+ 0xC1, 0x41, 0xE1, 0x61, 0xC9, 0x49, 0xE9, 0x69, 0xC3, 0x43, 0xE3, 0x63, 0xCB, 0x4B, 0xEB, 0x6B,
+ 0x31, 0xB1, 0x11, 0x91, 0x39, 0xB9, 0x19, 0x99, 0x33, 0xB3, 0x13, 0x93, 0x3B, 0xBB, 0x1B, 0x9B,
+ 0xF1, 0x71, 0xD1, 0x51, 0xF9, 0x79, 0xD9, 0x59, 0xF3, 0x73, 0xD3, 0x53, 0xFB, 0x7B, 0xDB, 0x5B,
+ 0x0D, 0x8D, 0x2D, 0xAD, 0x05, 0x85, 0x25, 0xA5, 0x0F, 0x8F, 0x2F, 0xAF, 0x07, 0x87, 0x27, 0xA7,
+ 0xCD, 0x4D, 0xED, 0x6D, 0xC5, 0x45, 0xE5, 0x65, 0xCF, 0x4F, 0xEF, 0x6F, 0xC7, 0x47, 0xE7, 0x67,
+ 0x3D, 0xBD, 0x1D, 0x9D, 0x35, 0xB5, 0x15, 0x95, 0x3F, 0xBF, 0x1F, 0x9F, 0x37, 0xB7, 0x17, 0x97,
+ 0xFD, 0x7D, 0xDD, 0x5D, 0xF5, 0x75, 0xD5, 0x55, 0xFF, 0x7F, 0xDF, 0x5F, 0xF7, 0x77, 0xD7, 0x57,
+ 0x02, 0x82, 0x22, 0xA2, 0x0A, 0x8A, 0x2A, 0xAA, 0x00, 0x80, 0x20, 0xA0, 0x08, 0x88, 0x28, 0xA8,
+ 0xC2, 0x42, 0xE2, 0x62, 0xCA, 0x4A, 0xEA, 0x6A, 0xC0, 0x40, 0xE0, 0x60, 0xC8, 0x48, 0xE8, 0x68,
+ 0x32, 0xB2, 0x12, 0x92, 0x3A, 0xBA, 0x1A, 0x9A, 0x30, 0xB0, 0x10, 0x90, 0x38, 0xB8, 0x18, 0x98,
+ 0xF2, 0x72, 0xD2, 0x52, 0xFA, 0x7A, 0xDA, 0x5A, 0xF0, 0x70, 0xD0, 0x50, 0xF8, 0x78, 0xD8, 0x58
};
int i = (int)((x + 1) * 7.9999);
int j = (int)((y + 1) * 7.9999);
@@ -269,7 +269,7 @@ gs_abort(const gs_memory_t *mem)
int exit_status = 1;
gs_lib_finit(exit_status, 0, mem);
- gp_do_exit(exit_status); /* system independent exit() */
+ gp_do_exit(exit_status); /* system independent exit() */
}
/* Return the number with the magnitude of x and the sign of y. */
@@ -280,7 +280,6 @@ gs_copysign(floatp x, floatp y)
return ( y >= 0 ? fabs(x) : -fabs(x) );
}
-
/* ---------------- Test program 1 ---------------- */
/* Draw a colored kaleidoscope. */
@@ -296,7 +295,7 @@ rand(void)
rand_state = A * (rand_state % Q) - R * (rand_state / Q);
/* Note that rand_state cannot be 0 here. */
if (rand_state <= 0)
- rand_state += M;
+ rand_state += M;
#undef A
#undef M
#undef Q
@@ -313,22 +312,22 @@ test1(gs_state * pgs, gs_memory_t * mem)
gs_scale(pgs, 4.0, 4.0);
gs_newpath(pgs);
for (n = 200; --n >= 0;) {
- int j;
+ int j;
#define rf() (rand() / (1.0 * 0x10000 * 0x8000))
- double r = rf(), g = rf(), b = rf();
- double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();
-
- gs_setrgbcolor(pgs, r, g, b);
- for (j = 0; j < 6; j++) {
- gs_gsave(pgs);
- gs_rotate(pgs, 60.0 * j);
- gs_moveto(pgs, x0, y0);
- gs_lineto(pgs, x1, y1);
- gs_lineto(pgs, x2, y2);
- gs_fill(pgs);
- gs_grestore(pgs);
- }
+ double r = rf(), g = rf(), b = rf();
+ double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();
+
+ gs_setrgbcolor(pgs, r, g, b);
+ for (j = 0; j < 6; j++) {
+ gs_gsave(pgs);
+ gs_rotate(pgs, 60.0 * j);
+ gs_moveto(pgs, x0, y0);
+ gs_lineto(pgs, x1, y1);
+ gs_lineto(pgs, x2, y2);
+ gs_fill(pgs);
+ gs_grestore(pgs);
+ }
}
#undef mem
return 0;
@@ -352,8 +351,8 @@ test2(gs_state * pgs, gs_memory_t * mem)
.x....
x.....
*/
- 0x3c, 0, 0, 0, 0x04, 0, 0, 0, 0x04, 0, 0, 0, 0x3c, 0, 0, 0,
- 0x40, 0, 0, 0, 0x80, 0, 0, 0
+ 0x3c, 0, 0, 0, 0x04, 0, 0, 0, 0x04, 0, 0, 0, 0x3c, 0, 0, 0,
+ 0x40, 0, 0, 0, 0x80, 0, 0, 0
};
gs_newpath(pgs);
@@ -425,14 +424,14 @@ test3(gs_state * pgs, gs_memory_t * mem)
tile.id = gs_next_ids(mem, 1);
tile.rep_width = tile.rep_height = 4;
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- &tile, white_black, 100, 100, 150, 150, 0, 0, rop3_T);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ &tile, white_black, 100, 100, 150, 150, 0, 0, rop3_T);
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- NULL, NULL, 120, 120, 110, 110, 0, 0, ~rop3_S & rop3_1);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ NULL, NULL, 120, 120, 110, 110, 0, 0, ~rop3_S & rop3_1);
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- &tile, white_black, 110, 110, 130, 130, 0, 0, rop3_T ^ rop3_D);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ &tile, white_black, 110, 110, 130, 130, 0, 0, rop3_T ^ rop3_D);
#undef pbytes
return 0;
}
@@ -455,26 +454,26 @@ test4(gs_state * pgs, gs_memory_t * mem)
ares.size = 2;
ares.persistent = true;
code = param_write_float_array((gs_param_list *) & list,
- "HWResolution", &ares);
+ "HWResolution", &ares);
if (code < 0) {
- lprintf1("Writing HWResolution failed: %d\n", code);
- gs_abort(mem);
+ lprintf1("Writing HWResolution failed: %d\n", code);
+ gs_abort(mem);
}
gs_c_param_list_read(&list);
code = gs_putdeviceparams(dev, (gs_param_list *) & list);
gs_c_param_list_release(&list);
if (code < 0) {
- lprintf1("Setting HWResolution failed: %d\n", code);
- gs_abort(mem);
+ lprintf1("Setting HWResolution failed: %d\n", code);
+ gs_abort(mem);
}
gs_initmatrix(pgs);
gs_initclip(pgs);
if (code == 1) {
- code = (*dev_proc(dev, open_device)) (dev);
- if (code < 0) {
- lprintf1("Reopening device failed: %d\n", code);
- gs_abort(mem);
- }
+ code = (*dev_proc(dev, open_device)) (dev);
+ if (code < 0) {
+ lprintf1("Reopening device failed: %d\n", code);
+ gs_abort(mem);
+ }
}
gs_moveto(pgs, 0.0, 72.0);
gs_rlineto(pgs, 72.0, 0.0);
@@ -497,10 +496,10 @@ test5(gs_state * pgs, gs_memory_t * mem)
int code;
static const byte data3[] =
{
- 0x00, 0x44, 0x88, 0xcc,
- 0x44, 0x88, 0xcc, 0x00,
- 0x88, 0xcc, 0x00, 0x44,
- 0xcc, 0x00, 0x44, 0x88
+ 0x00, 0x44, 0x88, 0xcc,
+ 0x44, 0x88, 0xcc, 0x00,
+ 0x88, 0xcc, 0x00, 0x44,
+ 0xcc, 0x00, 0x44, 0x88
};
gs_color_space *gray_cs = gs_cspace_new_DeviceGray(mem);
@@ -512,14 +511,14 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Scale everything up, and fill the background. */
{
- gs_matrix mat;
-
- gs_currentmatrix(pgs, &mat);
- mat.xx = gs_copysign(98.6, mat.xx);
- mat.yy = gs_copysign(98.6, mat.yy);
- mat.tx = floor(mat.tx) + 0.499;
- mat.ty = floor(mat.ty) + 0.499;
- gs_setmatrix(pgs, &mat);
+ gs_matrix mat;
+
+ gs_currentmatrix(pgs, &mat);
+ mat.xx = gs_copysign(98.6, mat.xx);
+ mat.yy = gs_copysign(98.6, mat.yy);
+ mat.tx = floor(mat.tx) + 0.499;
+ mat.ty = floor(mat.ty) + 0.499;
+ gs_setmatrix(pgs, &mat);
}
gs_setrgbcolor(pgs, 1.0, 0.9, 0.9);
fill_rect1(pgs, 0.25, 0.25, 4.0, 6.0);
@@ -552,124 +551,124 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Test an unmasked image. */
gs_gsave(pgs);
{
- gs_image1_t image1;
- void *info1;
+ gs_image1_t image1;
+ void *info1;
gs_color_space *cs;
- cs = gs_cspace_new_DeviceGray(mem);
- gs_image_t_init(&image1, cs);
- /* image */
- image1.ImageMatrix.xx = W;
- image1.ImageMatrix.yy = -H;
- image1.ImageMatrix.ty = H;
- /* data_image */
- image1.Width = W;
- image1.Height = H;
- image1.BitsPerComponent = 8;
-
- gs_translate(pgs, 0.5, 4.0);
- code = gx_device_begin_image(dev, (gs_imager_state *) pgs,
- &image1, gs_image_format_chunky,
- NULL, &dcolor, NULL, mem, &info1);
+ cs = gs_cspace_new_DeviceGray(mem);
+ gs_image_t_init(&image1, cs);
+ /* image */
+ image1.ImageMatrix.xx = W;
+ image1.ImageMatrix.yy = -H;
+ image1.ImageMatrix.ty = H;
+ /* data_image */
+ image1.Width = W;
+ image1.Height = H;
+ image1.BitsPerComponent = 8;
+
+ gs_translate(pgs, 0.5, 4.0);
+ code = gx_device_begin_image(dev, (gs_imager_state *) pgs,
+ &image1, gs_image_format_chunky,
+ NULL, &dcolor, NULL, mem, &info1);
/****** TEST code >= 0 ******/
- planes[0].data = data3;
- planes[0].data_x = 0;
- planes[0].raster =
- (image1.Height * image1.BitsPerComponent + 7) >> 3;
- /* Use the old image_data API. */
- code = gx_image_data(info1, &planes[0].data, 0,
- planes[0].raster, image1.Height);
+ planes[0].data = data3;
+ planes[0].data_x = 0;
+ planes[0].raster =
+ (image1.Height * image1.BitsPerComponent + 7) >> 3;
+ /* Use the old image_data API. */
+ code = gx_image_data(info1, &planes[0].data, 0,
+ planes[0].raster, image1.Height);
/****** TEST code == 1 ******/
- code = gx_image_end(info1, true);
+ code = gx_image_end(info1, true);
/****** TEST code >= 0 ******/
- gs_free_object(mem, cs, "colorspace");
+ gs_free_object(mem, cs, "colorspace");
}
gs_grestore(pgs);
/* Test an explicitly masked image. */
gs_gsave(pgs);
{
- gs_image3_t image3;
- static const byte data3mask[] =
- {
- 0x60,
- 0x90,
- 0x90,
- 0x60
- };
- static const byte data3x2mask[] =
- {
- 0x66,
- 0x99,
- 0x99,
- 0x66,
- 0x66,
- 0x99,
- 0x99,
- 0x66
- };
-
- gs_image3_t_init(&image3, gray_cs, interleave_scan_lines);
- /* image */
- image3.ImageMatrix.xx = W;
- image3.ImageMatrix.yy = -H;
- image3.ImageMatrix.ty = H;
- /* data_image */
- image3.Width = W;
- image3.Height = H;
- image3.BitsPerComponent = 8;
- /* MaskDict */
- image3.MaskDict.ImageMatrix = image3.ImageMatrix;
- image3.MaskDict.Width = image3.Width;
- image3.MaskDict.Height = image3.Height;
-
- /* Display with 1-for-1 mask and image. */
- gs_translate(pgs, 0.5, 2.0);
- code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
- NULL, (gs_image_common_t *) & image3,
- NULL, &dcolor, NULL, mem, &info);
+ gs_image3_t image3;
+ static const byte data3mask[] =
+ {
+ 0x60,
+ 0x90,
+ 0x90,
+ 0x60
+ };
+ static const byte data3x2mask[] =
+ {
+ 0x66,
+ 0x99,
+ 0x99,
+ 0x66,
+ 0x66,
+ 0x99,
+ 0x99,
+ 0x66
+ };
+
+ gs_image3_t_init(&image3, gray_cs, interleave_scan_lines);
+ /* image */
+ image3.ImageMatrix.xx = W;
+ image3.ImageMatrix.yy = -H;
+ image3.ImageMatrix.ty = H;
+ /* data_image */
+ image3.Width = W;
+ image3.Height = H;
+ image3.BitsPerComponent = 8;
+ /* MaskDict */
+ image3.MaskDict.ImageMatrix = image3.ImageMatrix;
+ image3.MaskDict.Width = image3.Width;
+ image3.MaskDict.Height = image3.Height;
+
+ /* Display with 1-for-1 mask and image. */
+ gs_translate(pgs, 0.5, 2.0);
+ code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
+ NULL, (gs_image_common_t *) & image3,
+ NULL, &dcolor, NULL, mem, &info);
/****** TEST code >= 0 ******/
- planes[0].data = data3mask;
- planes[0].data_x = 0;
- planes[0].raster = (image3.MaskDict.Height + 7) >> 3;
- planes[1].data = data3;
- planes[1].data_x = 0;
- planes[1].raster =
- (image3.Height * image3.BitsPerComponent + 7) >> 3;
- code = gx_image_plane_data(info, planes, image3.Height);
+ planes[0].data = data3mask;
+ planes[0].data_x = 0;
+ planes[0].raster = (image3.MaskDict.Height + 7) >> 3;
+ planes[1].data = data3;
+ planes[1].data_x = 0;
+ planes[1].raster =
+ (image3.Height * image3.BitsPerComponent + 7) >> 3;
+ code = gx_image_plane_data(info, planes, image3.Height);
/****** TEST code == 1 ******/
- code = gx_image_end(info, true);
+ code = gx_image_end(info, true);
/****** TEST code >= 0 ******/
- /* Display with 2-for-1 mask and image. */
- image3.MaskDict.ImageMatrix.xx *= 2;
- image3.MaskDict.ImageMatrix.yy *= 2;
- image3.MaskDict.ImageMatrix.ty *= 2;
- image3.MaskDict.Width *= 2;
- image3.MaskDict.Height *= 2;
- gs_translate(pgs, 1.5, 0.0);
- code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
- NULL, (gs_image_common_t *) & image3,
- NULL, &dcolor, NULL, mem, &info);
+ /* Display with 2-for-1 mask and image. */
+ image3.MaskDict.ImageMatrix.xx *= 2;
+ image3.MaskDict.ImageMatrix.yy *= 2;
+ image3.MaskDict.ImageMatrix.ty *= 2;
+ image3.MaskDict.Width *= 2;
+ image3.MaskDict.Height *= 2;
+ gs_translate(pgs, 1.5, 0.0);
+ code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
+ NULL, (gs_image_common_t *) & image3,
+ NULL, &dcolor, NULL, mem, &info);
/****** TEST code >= 0 ******/
- planes[0].data = data3x2mask;
- planes[0].raster = (image3.MaskDict.Width + 7) >> 3;
- {
- int i;
-
- for (i = 0; i < H; ++i) {
- planes[1].data = 0;
- code = gx_image_plane_data(info, planes, 1);
- planes[0].data += planes[0].raster;
+ planes[0].data = data3x2mask;
+ planes[0].raster = (image3.MaskDict.Width + 7) >> 3;
+ {
+ int i;
+
+ for (i = 0; i < H; ++i) {
+ planes[1].data = 0;
+ code = gx_image_plane_data(info, planes, 1);
+ planes[0].data += planes[0].raster;
/****** TEST code == 0 ******/
- planes[1].data = data3 + i * planes[1].raster;
- code = gx_image_plane_data(info, planes, 1);
- planes[0].data += planes[0].raster;
+ planes[1].data = data3 + i * planes[1].raster;
+ code = gx_image_plane_data(info, planes, 1);
+ planes[0].data += planes[0].raster;
/****** TEST code >= 0 ******/
- }
- }
+ }
+ }
/****** TEST code == 1 ******/
- code = gx_image_end(info, true);
+ code = gx_image_end(info, true);
/****** TEST code >= 0 ******/
}
gs_grestore(pgs);
@@ -677,31 +676,31 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Test a chroma-keyed masked image. */
gs_gsave(pgs);
{
- gs_image4_t image4;
- const byte *data4 = data3;
-
- gs_image4_t_init(&image4, gray_cs);
- /* image */
- image4.ImageMatrix.xx = W;
- image4.ImageMatrix.yy = -H;
- image4.ImageMatrix.ty = H;
- /* data_image */
- image4.Width = W;
- image4.Height = H;
- image4.BitsPerComponent = 8;
-
- /* Display with a single mask color. */
- gs_translate(pgs, 0.5, 0.5);
- image4.MaskColor_is_range = false;
- image4.MaskColor[0] = 0xcc;
- do_image(image4, data4);
-
- /* Display a second time with a color range. */
- gs_translate(pgs, 1.5, 0.0);
- image4.MaskColor_is_range = true;
- image4.MaskColor[0] = 0x40;
- image4.MaskColor[1] = 0x90;
- do_image(image4, data4);
+ gs_image4_t image4;
+ const byte *data4 = data3;
+
+ gs_image4_t_init(&image4, gray_cs);
+ /* image */
+ image4.ImageMatrix.xx = W;
+ image4.ImageMatrix.yy = -H;
+ image4.ImageMatrix.ty = H;
+ /* data_image */
+ image4.Width = W;
+ image4.Height = H;
+ image4.BitsPerComponent = 8;
+
+ /* Display with a single mask color. */
+ gs_translate(pgs, 0.5, 0.5);
+ image4.MaskColor_is_range = false;
+ image4.MaskColor[0] = 0xcc;
+ do_image(image4, data4);
+
+ /* Display a second time with a color range. */
+ gs_translate(pgs, 1.5, 0.0);
+ image4.MaskColor_is_range = true;
+ image4.MaskColor[0] = 0x40;
+ image4.MaskColor[1] = 0x90;
+ do_image(image4, data4);
}
gs_grestore(pgs);
gs_free_object(mem, gray_cs, "test5 gray_cs");
@@ -723,19 +722,19 @@ spectrum(gs_state * pgs, int n)
int a, b, c;
for (a = 0; a < n; ++a)
- for (b = 0; b < n; ++b)
- for (c = 0; c < n; ++c) {
- double size = (n * 2 - c * 2 - 1) / den2;
- gs_client_color cc;
-
- cc.paint.values[0] = a / den1;
- cc.paint.values[1] = b / den1;
- cc.paint.values[2] = c / den1;
- gs_setcolor(pgs, &cc);
- fill_rect1(pgs,
- a / den + c / den2, b / den + c / den2,
- size, size);
- }
+ for (b = 0; b < n; ++b)
+ for (c = 0; c < n; ++c) {
+ double size = (n * 2 - c * 2 - 1) / den2;
+ gs_client_color cc;
+
+ cc.paint.values[0] = a / den1;
+ cc.paint.values[1] = b / den1;
+ cc.paint.values[2] = c / den1;
+ gs_setcolor(pgs, &cc);
+ fill_rect1(pgs,
+ a / den + c / den2, b / den + c / den2,
+ size, size);
+ }
}
static float
render_abc(floatp v, const gs_cie_render * ignore_crd)
@@ -752,7 +751,7 @@ test6(gs_state * pgs, gs_memory_t * mem)
{1, 1, 1};
static const gs_cie_render_proc3 encode_abc =
{
- {render_abc, render_abc, render_abc}
+ {render_abc, render_abc, render_abc}
};
int code;
gs_color_space *rgb_cs;
@@ -767,12 +766,12 @@ test6(gs_state * pgs, gs_memory_t * mem)
/* We must set the CRD before the color space. */
code = gs_cie_render1_build(&pcrd, mem, "test6");
if (code < 0)
- return code;
+ return code;
gs_cie_render1_initialize(mem, pcrd, NULL, &white_point, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, &encode_abc, NULL,
- NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, &encode_abc, NULL,
+ NULL);
gs_setcolorrendering(pgs, pcrd);
gs_cspace_build_CIEABC(&pcs, NULL, mem);
/* There should be an API for initializing CIE color spaces too.... */
@@ -796,13 +795,13 @@ test7(gs_state * pgs, gs_memory_t * mem)
static const byte masks[1 * 4 * 4] =
{
/* 0% */
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
/* 25% */
- 0x80, 0x40, 0x20, 0x10,
+ 0x80, 0x40, 0x20, 0x10,
/* 50% */
- 0xa0, 0xa0, 0x50, 0x50,
+ 0xa0, 0xa0, 0x50, 0x50,
/* 75% */
- 0xd0, 0xe0, 0x70, 0xb0
+ 0xd0, 0xe0, 0x70, 0xb0
};
gs_ht *pht;
int code;
@@ -812,13 +811,13 @@ test7(gs_state * pgs, gs_memory_t * mem)
code = gs_ht_build(&pht, 1, mem);
dprintf1("ht build code = %d\n", code);
code = gs_ht_set_mask_comp(pht, 0,
- 4, 4, 4, masks, NULL, NULL);
+ 4, 4, 4, masks, NULL, NULL);
dprintf1("set mask code = %d\n", code);
code = gs_sethalftone(pgs, pht);
dprintf1("sethalftone code = %d\n", code);
for (i = 0; i <= 4; ++i) {
- gs_setgray(pgs, i / 4.0);
- fill_rect1(pgs, 100 + i * 100, 100, 50, 50);
+ gs_setgray(pgs, i / 4.0);
+ fill_rect1(pgs, 100 + i * 100, 100, 50, 50);
}
return 0;
}
@@ -835,22 +834,22 @@ test8(gs_state * pgs, gs_memory_t * mem)
*/
static const byte pdata[] =
{
- 0x7f, 0xff, 0x00, 0x03,
- 0x7f, 0xff, 0x00, 0x0c,
- 0x50, 0x00, 0x00, 0x30,
- 0x50, 0x00, 0x00, 0xc0,
- 0x50, 0x00, 0x03, 0x00,
- 0x50, 0x00, 0x0c, 0x00,
- 0x50, 0x00, 0x30, 0x00,
- 0x50, 0x00, 0xc0, 0x00,
- 0xf0, 0x00, 0xc0, 0x00,
- 0xf0, 0x00, 0x30, 0x00,
- 0xf0, 0x00, 0x0c, 0x00,
- 0xf0, 0x00, 0x03, 0x00,
- 0xf0, 0x00, 0x00, 0xc0,
- 0xf0, 0x00, 0x00, 0x30,
- 0xea, 0x55, 0xaa, 0x5c,
- 0xea, 0x55, 0xaa, 0x57,
+ 0x7f, 0xff, 0x00, 0x03,
+ 0x7f, 0xff, 0x00, 0x0c,
+ 0x50, 0x00, 0x00, 0x30,
+ 0x50, 0x00, 0x00, 0xc0,
+ 0x50, 0x00, 0x03, 0x00,
+ 0x50, 0x00, 0x0c, 0x00,
+ 0x50, 0x00, 0x30, 0x00,
+ 0x50, 0x00, 0xc0, 0x00,
+ 0xf0, 0x00, 0xc0, 0x00,
+ 0xf0, 0x00, 0x30, 0x00,
+ 0xf0, 0x00, 0x0c, 0x00,
+ 0xf0, 0x00, 0x03, 0x00,
+ 0xf0, 0x00, 0x00, 0xc0,
+ 0xf0, 0x00, 0x00, 0x30,
+ 0xea, 0x55, 0xaa, 0x5c,
+ 0xea, 0x55, 0xaa, 0x57,
};
gs_depth_bitmap ptile;
gs_const_string table;
@@ -861,7 +860,7 @@ test8(gs_state * pgs, gs_memory_t * mem)
rgb_cs = gs_cspace_new_DeviceRGB(mem);
table.data =
- (const byte *)"\377\377\377\377\000\000\000\377\000\000\000\000";
+ (const byte *)"\377\377\377\377\000\000\000\377\000\000\000\000";
table.size = 12;
gs_cspace_build_Indexed(&pcs, rgb_cs, 4, &table, mem);
ptile.data = pdata;
@@ -871,32 +870,31 @@ test8(gs_state * pgs, gs_memory_t * mem)
ptile.pix_depth = 2;
ptile.num_comps = 1;
gs_makepixmappattern(&ccolor, &ptile, false /*mask */ , NULL /*pmat */ ,
- gs_no_id, pcs, 0 /*white_index */ , pgs, mem);
+ gs_no_id, pcs, 0 /*white_index */ , pgs, mem);
{
- gs_rect r;
-
- r.p.x = 100;
- r.p.y = 100;
- r.q.x = 200;
- r.q.y = 200;
- gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
- gs_rectfill(pgs, &r, 1);
- gs_setpattern(pgs, &ccolor);
- gs_settexturetransparent(pgs, true);
- gs_rectfill(pgs, &r, 1);
- r.p.x += 150;
- r.q.x += 150;
- gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
- gs_rectfill(pgs, &r, 1);
- gs_setpattern(pgs, &ccolor);
- gs_settexturetransparent(pgs, false);
- gs_rectfill(pgs, &r, 1);
+ gs_rect r;
+
+ r.p.x = 100;
+ r.p.y = 100;
+ r.q.x = 200;
+ r.q.y = 200;
+ gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
+ gs_rectfill(pgs, &r, 1);
+ gs_setpattern(pgs, &ccolor);
+ gs_settexturetransparent(pgs, true);
+ gs_rectfill(pgs, &r, 1);
+ r.p.x += 150;
+ r.q.x += 150;
+ gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
+ gs_rectfill(pgs, &r, 1);
+ gs_setpattern(pgs, &ccolor);
+ gs_settexturetransparent(pgs, false);
+ gs_rectfill(pgs, &r, 1);
}
gs_free_object(mem, rgb_cs, "test8 rgb_cs");
return 0;
}
-
#ifdef CAPTURE
/* ---------------- Test program 10 ---------------- */
@@ -930,44 +928,44 @@ test10(gs_state * pgs, gs_memory_t * mem)
gs_c_param_list_write(&list, mem);
code = gs_getdeviceparams(dev, (gs_param_list *) & list);
if (code < 0) {
- lprintf1("getdeviceparams failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("getdeviceparams failed! code = %d\n", code);
+ gs_abort(mem);
}
gs_c_param_list_read(&list);
code = param_read_string((gs_param_list *) & list, "Name", &nstr);
if (code < 0) {
- lprintf1("reading Name failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("reading Name failed! code = %d\n", code);
+ gs_abort(mem);
}
code = param_read_int_array((gs_param_list *) & list,
- "HWSize", &HWSa);
+ "HWSize", &HWSa);
if (code < 0) {
- lprintf1("reading HWSize failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("reading HWSize failed! code = %d\n", code);
+ gs_abort(mem);
}
emprintf3(mem, "HWSize[%d] = [ %d, %d ]\n", HWSa.size,
HWSa.data[0], HWSa.data[1]);
code = param_read_float_array((gs_param_list *) & list,
- "HWResolution", &HWRa);
+ "HWResolution", &HWRa);
if (code < 0) {
- lprintf1("reading Resolution failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("reading Resolution failed! code = %d\n", code);
+ gs_abort(mem);
}
emprintf3(mem, "HWResolution[%d] = [ %f, %f ]\n", HWRa.size,
HWRa.data[0], HWRa.data[1]);
code = param_read_float_array((gs_param_list *) & list,
- "PageSize", &PSa);
+ "PageSize", &PSa);
if (code < 0) {
- lprintf1("reading PageSize failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("reading PageSize failed! code = %d\n", code);
+ gs_abort(mem);
}
emprintf3(mem, "PageSize[%d] = [ %f, %f ]\n", PSa.size,
PSa.data[0], PSa.data[1]);
code = param_read_long((gs_param_list *) & list,
- "MaxBitmap", &MaxBitmap);
+ "MaxBitmap", &MaxBitmap);
if (code < 0) {
- lprintf1("reading MaxBitmap failed! code = %d\n", code);
- gs_abort(mem);
+ lprintf1("reading MaxBitmap failed! code = %d\n", code);
+ gs_abort(mem);
}
emprintf1(mem, "MaxBitmap = %ld\n", MaxBitmap);
/* Switch to param list functions to "write" */
@@ -977,37 +975,37 @@ test10(gs_state * pgs, gs_memory_t * mem)
PageSize[1] = 72.0 * xpage_len;
PSa.data = PageSize;
code = param_write_float_array((gs_param_list *) & list,
- "PageSize", &PSa);
+ "PageSize", &PSa);
if (nstr.data[0] != 'v') {
- /* Set the OutputFile string file name */
- OFstr.persistent = false;
- OFstr.data = outfile;
- OFstr.size = strlen(outfile);
- code = param_write_string((gs_param_list *) & list,
- "OutputFile", &OFstr);
- if (code < 0) {
- lprintf1("setting OutputFile name failed, code=%d\n",
- code);
- gs_abort(mem);
- }
- if (nstr.data[0] == 'x') {
- HWResolution[0] = HWResolution[1] = 72.0;
- } else {
- HWResolution[0] = HWResolution[1] = 360.0;
- }
- HWRa.data = HWResolution;
- HWSize[0] = (int)(HWResolution[0] * ypage_wid);
- HWSize[1] = (int)(HWResolution[1] * xpage_len);
- emprintf3(mem, "\tHWSize = [%d,%d], HWResolution = %f dpi\n",
+ /* Set the OutputFile string file name */
+ OFstr.persistent = false;
+ OFstr.data = outfile;
+ OFstr.size = strlen(outfile);
+ code = param_write_string((gs_param_list *) & list,
+ "OutputFile", &OFstr);
+ if (code < 0) {
+ lprintf1("setting OutputFile name failed, code=%d\n",
+ code);
+ gs_abort(mem);
+ }
+ if (nstr.data[0] == 'x') {
+ HWResolution[0] = HWResolution[1] = 72.0;
+ } else {
+ HWResolution[0] = HWResolution[1] = 360.0;
+ }
+ HWRa.data = HWResolution;
+ HWSize[0] = (int)(HWResolution[0] * ypage_wid);
+ HWSize[1] = (int)(HWResolution[1] * xpage_len);
+ emprintf3(mem, "\tHWSize = [%d,%d], HWResolution = %f dpi\n",
HWSize[0], HWSize[1], HWResolution[0]);
- HWSa.data = HWSize;
- code = param_write_float_array((gs_param_list *) & list,
- "HWResolution", &HWRa);
- code = param_write_int_array((gs_param_list *) & list,
- "HWSize", &HWSa);
- MaxBitmap = 1000000L;
- code = param_write_long((gs_param_list *) & list,
- "MaxBitmap", &MaxBitmap);
+ HWSa.data = HWSize;
+ code = param_write_float_array((gs_param_list *) & list,
+ "HWResolution", &HWRa);
+ code = param_write_int_array((gs_param_list *) & list,
+ "HWSize", &HWSa);
+ MaxBitmap = 1000000L;
+ code = param_write_long((gs_param_list *) & list,
+ "MaxBitmap", &MaxBitmap);
}
gs_c_param_list_read(&list);
code = gs_putdeviceparams(dev, (gs_param_list *) & list);
@@ -1021,9 +1019,9 @@ test10(gs_state * pgs, gs_memory_t * mem)
gs_color_space *cs = gs_cspace_new_DeviceGray(mem);
gs_setcolorspace(pgs, cs);
gs_setcolorspace(pgs, cs);
- gs_decrement(cs, "test10 DeviceGray");
+ gs_decrement(cs, "test10 DeviceGray");
}
-
+
gs_clippath(pgs);
gs_pathbbox(pgs, &cliprect);
emprintf4(mem, "\tcliprect = [[%g,%g],[%g,%g]]\n",
@@ -1031,23 +1029,23 @@ test10(gs_state * pgs, gs_memory_t * mem)
gs_newpath(pgs);
switch (((rotate_value + 270) / 90) & 3) {
- default:
- case 0: /* 0 = 360 degrees in PS == 90 degrees in printer */
- xlate_x = cliprect.p.x;
- xlate_y = cliprect.p.y;
- break;
- case 1: /* 90 degrees in PS = 180 degrees printer */
- xlate_x = cliprect.q.x;
- xlate_y = cliprect.p.y;
- break;
- case 2: /* 180 degrees in PS == 270 degrees in printer */
- xlate_x = cliprect.q.x;
- xlate_y = cliprect.q.y;
- break;
- case 3: /* 270 degrees in PS == 0 degrees in printer */
- xlate_x = cliprect.p.x;
- xlate_y = cliprect.q.y;
- break;
+ default:
+ case 0: /* 0 = 360 degrees in PS == 90 degrees in printer */
+ xlate_x = cliprect.p.x;
+ xlate_y = cliprect.p.y;
+ break;
+ case 1: /* 90 degrees in PS = 180 degrees printer */
+ xlate_x = cliprect.q.x;
+ xlate_y = cliprect.p.y;
+ break;
+ case 2: /* 180 degrees in PS == 270 degrees in printer */
+ xlate_x = cliprect.q.x;
+ xlate_y = cliprect.q.y;
+ break;
+ case 3: /* 270 degrees in PS == 0 degrees in printer */
+ xlate_x = cliprect.p.x;
+ xlate_y = cliprect.q.y;
+ break;
}
emprintf2(mem, "translate origin to [ %f, %f ]\n", xlate_x, xlate_y);
gs_translate(pgs, xlate_x, xlate_y);
@@ -1057,7 +1055,7 @@ test10(gs_state * pgs, gs_memory_t * mem)
gs_rotate(pgs, (float)rotate_value + 270.0);
gs_scale(pgs, scale_x * 72.0 / 2032.0,
- scale_y * 72.0 / 2032.0);
+ scale_y * 72.0 / 2032.0);
gs_setlinecap(pgs, gs_cap_butt);
gs_setlinejoin(pgs, gs_join_bevel);
gs_setfilladjust(pgs, 0.0, 0.0);
diff --git a/gs/base/gslib.h b/gs/base/gslib.h
index d92bc49b0..5ee520227 100644
--- a/gs/base/gslib.h
+++ b/gs/base/gslib.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gslibctx.c b/gs/base/gslibctx.c
index 01d174d14..ea01e23cf 100644
--- a/gs/base/gslibctx.c
+++ b/gs/base/gslibctx.c
@@ -30,20 +30,17 @@ gs_lib_ctx_get_real_stdio(FILE **in, FILE **out, FILE **err)
*err = stderr;
}
-
#include "gslibctx.h"
#include "gsmemory.h"
static gs_memory_t *mem_err_print = NULL;
-
gs_memory_t *
gs_lib_ctx_get_non_gc_memory_t()
{
return mem_err_print ? mem_err_print->non_gc_memory : NULL;
}
-
int gs_lib_ctx_init( gs_memory_t *mem )
{
gs_lib_ctx_t *pio = 0;
@@ -155,5 +152,3 @@ void errflush(const gs_memory_t *mem)
fflush(mem->gs_lib_ctx->fstderr);
/* else nothing to flush */
}
-
-
diff --git a/gs/base/gslibctx.h b/gs/base/gslibctx.h
index 237181f8d..b856df467 100644
--- a/gs/base/gslibctx.h
+++ b/gs/base/gslibctx.h
@@ -19,7 +19,6 @@
#include "stdio_.h"
#include "gs_dll_call.h"
-
typedef struct name_table_s *name_table_ptr;
#ifndef gs_font_dir_DEFINED
@@ -55,11 +54,11 @@ typedef struct gs_lib_ctx_s
int (GSDLLCALL *poll_fn)(void *caller_handle);
ulong gs_next_id; /* gs_id initialized here, private variable of gs_next_ids() */
void *top_of_system; /* use accessor functions to walk down the system
- * to the desired structure gs_lib_ctx_get_*()
- */
+ * to the desired structure gs_lib_ctx_get_*()
+ */
name_table_ptr gs_name_table; /* hack this is the ps interpreters name table
- * doesn't belong here
- */
+ * doesn't belong here
+ */
/* Define whether dictionaries expand automatically when full. */
bool dict_auto_expand; /* ps dictionary: false level 1 true level 2 or 3 */
/* A table of local copies of the IODevices */
diff --git a/gs/base/gsline.c b/gs/base/gsline.c
index 1eb10e82c..e068d6e8b 100644
--- a/gs/base/gsline.c
+++ b/gs/base/gsline.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,7 @@ int
gs_setlinecap(gs_state * pgs, gs_line_cap cap)
{
if ((uint) cap > gs_line_cap_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->start_cap = cap;
pgs_lp->end_cap = cap;
pgs_lp->dash_cap = cap;
@@ -60,7 +60,7 @@ int
gs_setlinestartcap(gs_state * pgs, gs_line_cap cap)
{
if ((uint) cap > gs_line_cap_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->start_cap = cap;
return 0;
}
@@ -70,7 +70,7 @@ int
gs_setlineendcap(gs_state * pgs, gs_line_cap cap)
{
if ((uint) cap > gs_line_cap_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->end_cap = cap;
return 0;
}
@@ -80,7 +80,7 @@ int
gs_setlinedashcap(gs_state * pgs, gs_line_cap cap)
{
if ((uint) cap > gs_line_cap_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->dash_cap = cap;
return 0;
}
@@ -99,7 +99,7 @@ int
gs_setlinejoin(gs_state * pgs, gs_line_join join)
{
if ((uint) join > gs_line_join_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->join = join;
return 0;
}
@@ -116,7 +116,7 @@ int
gx_set_miter_limit(gx_line_params * plp, floatp limit)
{
if (limit < 1.0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
plp->miter_limit = limit;
/*
* Compute the miter check value. The supplied miter limit is an
@@ -127,13 +127,13 @@ gx_set_miter_limit(gx_line_params * plp, floatp limit)
* Some C compilers can't handle this as a conditional expression....
*/
{
- double limit_squared = limit * limit;
+ double limit_squared = limit * limit;
- if (limit_squared < 2.0001 && limit_squared > 1.9999)
- plp->miter_check = 1.0e6;
- else
- plp->miter_check =
- sqrt(limit_squared - 1) * 2 / (limit_squared - 2);
+ if (limit_squared < 2.0001 && limit_squared > 1.9999)
+ plp->miter_check = 1.0e6;
+ else
+ plp->miter_check =
+ sqrt(limit_squared - 1) * 2 / (limit_squared - 2);
}
return 0;
}
@@ -153,7 +153,7 @@ gs_currentmiterlimit(const gs_state * pgs)
/* setdash */
int
gx_set_dash(gx_dash_params * dash, const float *pattern, uint length,
- floatp offset, gs_memory_t * mem)
+ floatp offset, gs_memory_t * mem)
{
uint n = length;
const float *dfrom = pattern;
@@ -165,51 +165,51 @@ gx_set_dash(gx_dash_params * dash, const float *pattern, uint length,
/* Check the dash pattern. */
while (n--) {
- float elt = *dfrom++;
+ float elt = *dfrom++;
- if (elt < 0)
- return_error(gs_error_rangecheck);
- pattern_length += elt;
+ if (elt < 0)
+ return_error(gs_error_rangecheck);
+ pattern_length += elt;
}
if (length == 0) { /* empty pattern */
- dist_left = 0.0;
- if (mem && ppat) {
- gs_free_object(mem, ppat, "gx_set_dash(old pattern)");
- ppat = 0;
- }
+ dist_left = 0.0;
+ if (mem && ppat) {
+ gs_free_object(mem, ppat, "gx_set_dash(old pattern)");
+ ppat = 0;
+ }
} else {
- uint size = length * sizeof(float);
+ uint size = length * sizeof(float);
- if (pattern_length == 0)
- return_error(gs_error_rangecheck);
- /* Compute the initial index, ink_on, and distance left */
- /* in the pattern, according to the offset. */
+ if (pattern_length == 0)
+ return_error(gs_error_rangecheck);
+ /* Compute the initial index, ink_on, and distance left */
+ /* in the pattern, according to the offset. */
#define f_mod(a, b) ((a) - floor((a) / (b)) * (b))
- if (length & 1) { /* Odd and even repetitions of the pattern */
- /* have opposite ink values! */
- float length2 = pattern_length * 2;
-
- dist_left = f_mod(offset, length2);
- if (dist_left >= pattern_length)
- dist_left -= pattern_length, ink = !ink;
- } else
- dist_left = f_mod(offset, pattern_length);
- while ((dist_left -= pattern[index]) >= 0 &&
- (dist_left > 0 || pattern[index] != 0)
- )
- ink = !ink, index++;
- if (mem) {
- if (ppat == 0)
- ppat = (float *)gs_alloc_bytes(mem, size,
- "gx_set_dash(pattern)");
- else if (length != dash->pattern_size)
- ppat = gs_resize_object(mem, ppat, size,
- "gx_set_dash(pattern)");
- if (ppat == 0)
- return_error(gs_error_VMerror);
- }
+ if (length & 1) { /* Odd and even repetitions of the pattern */
+ /* have opposite ink values! */
+ float length2 = pattern_length * 2;
+
+ dist_left = f_mod(offset, length2);
+ if (dist_left >= pattern_length)
+ dist_left -= pattern_length, ink = !ink;
+ } else
+ dist_left = f_mod(offset, pattern_length);
+ while ((dist_left -= pattern[index]) >= 0 &&
+ (dist_left > 0 || pattern[index] != 0)
+ )
+ ink = !ink, index++;
+ if (mem) {
+ if (ppat == 0)
+ ppat = (float *)gs_alloc_bytes(mem, size,
+ "gx_set_dash(pattern)");
+ else if (length != dash->pattern_size)
+ ppat = gs_resize_object(mem, ppat, size,
+ "gx_set_dash(pattern)");
+ if (ppat == 0)
+ return_error(gs_error_VMerror);
+ }
if (ppat != pattern)
- memcpy(ppat, pattern, length * sizeof(float));
+ memcpy(ppat, pattern, length * sizeof(float));
}
dash->pattern = ppat;
dash->pattern_size = length;
@@ -224,7 +224,7 @@ int
gs_setdash(gs_state * pgs, const float *pattern, uint length, floatp offset)
{
return gx_set_dash(&pgs_lp->dash, pattern, length, offset,
- pgs->memory);
+ pgs->memory);
}
/* currentdash */
@@ -258,9 +258,9 @@ int
gs_imager_setflat(gs_imager_state * pis, floatp flat)
{
if (flat <= 0.2)
- flat = 0.2;
+ flat = 0.2;
else if (flat > 100)
- flat = 100;
+ flat = 100;
pis->flatness = flat;
return 0;
}
@@ -320,7 +320,7 @@ int
gs_setcurvejoin(gs_state * pgs, int join)
{
if (join < -1 || join > gs_line_join_max)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pgs_lp->curve_join = join;
return 0;
}
@@ -358,7 +358,7 @@ int
gx_set_dot_length(gx_line_params * plp, floatp length, bool absolute)
{
if (length < 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
plp->dot_length = length;
plp->dot_length_absolute = absolute;
return 0;
@@ -386,7 +386,7 @@ int
gs_setdotorientation(gs_state *pgs)
{
if (is_xxyy(&pgs->ctm) || is_xyyx(&pgs->ctm))
- return gs_currentmatrix(pgs, &pgs_lp->dot_orientation);
+ return gs_currentmatrix(pgs, &pgs_lp->dot_orientation);
return_error(gs_error_rangecheck);
}
diff --git a/gs/base/gsline.h b/gs/base/gsline.h
index cd56c9209..5adc23f79 100644
--- a/gs/base/gsline.h
+++ b/gs/base/gsline.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gslparam.h b/gs/base/gslparam.h
index 58e685e5b..3825d9698 100644
--- a/gs/base/gslparam.h
+++ b/gs/base/gslparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsmalloc.c b/gs/base/gsmalloc.c
index b3340f4ec..1236317f5 100644
--- a/gs/base/gsmalloc.c
+++ b/gs/base/gsmalloc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,7 +24,6 @@
#include "gsmalloc.h"
#include "gsmemret.h" /* retrying wrapper */
-
/* ------ Heap allocator ------ */
/*
@@ -84,11 +83,11 @@ static const gs_memory_procs_t gs_malloc_memory_procs =
/* We must make sure that malloc_blocks leave the block aligned. */
/*typedef struct gs_malloc_block_s gs_malloc_block_t; */
#define malloc_block_data\
- gs_malloc_block_t *next;\
- gs_malloc_block_t *prev;\
- uint size;\
- gs_memory_type_ptr_t type;\
- client_name_t cname
+ gs_malloc_block_t *next;\
+ gs_malloc_block_t *prev;\
+ uint size;\
+ gs_memory_type_ptr_t type;\
+ client_name_t cname
struct malloc_block_data_s {
malloc_block_data;
};
@@ -107,7 +106,7 @@ gs_malloc_memory_t *
gs_malloc_memory_init(void)
{
gs_malloc_memory_t *mem =
- (gs_malloc_memory_t *)malloc(sizeof(gs_malloc_memory_t));
+ (gs_malloc_memory_t *)malloc(sizeof(gs_malloc_memory_t));
if (mem == NULL)
return NULL;
@@ -142,14 +141,14 @@ heap_available()
uint n;
for (n = 0; n < max_malloc_probes; n++) {
- if ((probes[n] = malloc(malloc_probe_size)) == 0)
- break;
- if_debug2('a', "[a]heap_available probe[%d]=0x%lx\n",
- n, (ulong) probes[n]);
- avail += malloc_probe_size;
+ if ((probes[n] = malloc(malloc_probe_size)) == 0)
+ break;
+ if_debug2('a', "[a]heap_available probe[%d]=0x%lx\n",
+ n, (ulong) probes[n]);
+ avail += malloc_probe_size;
}
while (n)
- free(probes[--n]);
+ free(probes[--n]);
return avail;
}
@@ -169,125 +168,125 @@ gs_heap_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
# define set_msg(str) DO_NOTHING
#endif
- /* Exclusive acces so our decisions and changes are 'atomic' */
+ /* Exclusive acces so our decisions and changes are 'atomic' */
if (mmem->monitor)
- gx_monitor_enter(mmem->monitor);
+ gx_monitor_enter(mmem->monitor);
if (size > mmem->limit - sizeof(gs_malloc_block_t)) {
- /* Definitely too large to allocate; also avoids overflow. */
- set_msg("exceeded limit");
+ /* Definitely too large to allocate; also avoids overflow. */
+ set_msg("exceeded limit");
} else {
- uint added = size + sizeof(gs_malloc_block_t);
-
- if (mmem->limit - added < mmem->used)
- set_msg("exceeded limit");
- else if ((ptr = (byte *) malloc(added)) == 0)
- set_msg("failed");
- else {
- gs_malloc_block_t *bp = (gs_malloc_block_t *) ptr;
-
- /*
- * We would like to check that malloc aligns blocks at least as
- * strictly as the compiler (as defined by ARCH_ALIGN_MEMORY_MOD).
- * However, Microsoft VC 6 does not satisfy this requirement.
- * See gsmemory.h for more explanation.
- */
- set_msg(ok_msg);
- if (mmem->allocated)
- mmem->allocated->prev = bp;
- bp->next = mmem->allocated;
- bp->prev = 0;
- bp->size = size;
- bp->type = &st_bytes;
- bp->cname = cname;
- mmem->allocated = bp;
- ptr = (byte *) (bp + 1);
- mmem->used += size + sizeof(gs_malloc_block_t);
- if (mmem->used > mmem->max_used)
- mmem->max_used = mmem->used;
- }
+ uint added = size + sizeof(gs_malloc_block_t);
+
+ if (mmem->limit - added < mmem->used)
+ set_msg("exceeded limit");
+ else if ((ptr = (byte *) malloc(added)) == 0)
+ set_msg("failed");
+ else {
+ gs_malloc_block_t *bp = (gs_malloc_block_t *) ptr;
+
+ /*
+ * We would like to check that malloc aligns blocks at least as
+ * strictly as the compiler (as defined by ARCH_ALIGN_MEMORY_MOD).
+ * However, Microsoft VC 6 does not satisfy this requirement.
+ * See gsmemory.h for more explanation.
+ */
+ set_msg(ok_msg);
+ if (mmem->allocated)
+ mmem->allocated->prev = bp;
+ bp->next = mmem->allocated;
+ bp->prev = 0;
+ bp->size = size;
+ bp->type = &st_bytes;
+ bp->cname = cname;
+ mmem->allocated = bp;
+ ptr = (byte *) (bp + 1);
+ mmem->used += size + sizeof(gs_malloc_block_t);
+ if (mmem->used > mmem->max_used)
+ mmem->max_used = mmem->used;
+ }
}
if (mmem->monitor)
- gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
+ gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
/* We don't want to 'fill' under mutex to keep the window smaller */
if (ptr)
- gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
+ gs_alloc_fill(ptr, gs_alloc_fill_alloc, size);
#ifdef DEBUG
if (gs_debug_c('a') || msg != ok_msg)
- dlprintf6("[a+]gs_malloc(%s)(%u) = 0x%lx: %s, used=%ld, max=%ld\n",
- client_name_string(cname), size, (ulong) ptr, msg, mmem->used, mmem->max_used);
+ dlprintf6("[a+]gs_malloc(%s)(%u) = 0x%lx: %s, used=%ld, max=%ld\n",
+ client_name_string(cname), size, (ulong) ptr, msg, mmem->used, mmem->max_used);
#endif
return ptr;
#undef set_msg
}
static void *
gs_heap_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
void *ptr =
gs_heap_alloc_bytes(mem, gs_struct_type_size(pstype), cname);
if (ptr == 0)
- return 0;
+ return 0;
((gs_malloc_block_t *) ptr)[-1].type = pstype;
return ptr;
}
static byte *
gs_heap_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
ulong lsize = (ulong) num_elements * elt_size;
if (lsize != (uint) lsize)
- return 0;
+ return 0;
return gs_heap_alloc_bytes(mem, (uint) lsize, cname);
}
static void *
gs_heap_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
void *ptr =
gs_heap_alloc_byte_array(mem, num_elements,
- gs_struct_type_size(pstype), cname);
+ gs_struct_type_size(pstype), cname);
if (ptr == 0)
- return 0;
+ return 0;
((gs_malloc_block_t *) ptr)[-1].type = pstype;
return ptr;
}
static void *
gs_heap_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements,
- client_name_t cname)
+ client_name_t cname)
{
gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;
gs_malloc_block_t *ptr = (gs_malloc_block_t *) obj - 1;
gs_memory_type_ptr_t pstype = ptr->type;
uint old_size = gs_object_size(mem, obj) + sizeof(gs_malloc_block_t);
uint new_size =
- gs_struct_type_size(pstype) * new_num_elements +
- sizeof(gs_malloc_block_t);
+ gs_struct_type_size(pstype) * new_num_elements +
+ sizeof(gs_malloc_block_t);
gs_malloc_block_t *new_ptr;
if (new_size == old_size)
return obj;
if (mmem->monitor)
- gx_monitor_enter(mmem->monitor); /* Exclusive access */
+ gx_monitor_enter(mmem->monitor); /* Exclusive access */
new_ptr = (gs_malloc_block_t *) gs_realloc(ptr, old_size, new_size);
if (new_ptr == 0)
- return 0;
+ return 0;
if (new_ptr->prev)
- new_ptr->prev->next = new_ptr;
+ new_ptr->prev->next = new_ptr;
else
- mmem->allocated = new_ptr;
+ mmem->allocated = new_ptr;
if (new_ptr->next)
- new_ptr->next->prev = new_ptr;
+ new_ptr->next->prev = new_ptr;
new_ptr->size = new_size - sizeof(gs_malloc_block_t);
mmem->used -= old_size;
mmem->used += new_size;
if (mmem->monitor)
- gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
+ gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
if (new_size > old_size)
- gs_alloc_fill((byte *) new_ptr + old_size,
- gs_alloc_fill_alloc, new_size - old_size);
+ gs_alloc_fill((byte *) new_ptr + old_size,
+ gs_alloc_fill_alloc, new_size - old_size);
return new_ptr + 1;
}
static uint
@@ -309,62 +308,62 @@ gs_heap_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
struct_proc_finalize((*finalize));
if_debug3('a', "[a-]gs_free(%s) 0x%lx(%u)\n",
- client_name_string(cname), (ulong) ptr,
- (ptr == 0 ? 0 : ((gs_malloc_block_t *) ptr)[-1].size));
+ client_name_string(cname), (ulong) ptr,
+ (ptr == 0 ? 0 : ((gs_malloc_block_t *) ptr)[-1].size));
if (ptr == 0)
- return;
+ return;
pstype = ((gs_malloc_block_t *) ptr)[-1].type;
finalize = pstype->finalize;
if (finalize != 0) {
- if_debug3('u', "[u]finalizing %s 0x%lx (%s)\n",
- struct_type_name_string(pstype),
- (ulong) ptr, client_name_string(cname));
- (*finalize) (ptr);
+ if_debug3('u', "[u]finalizing %s 0x%lx (%s)\n",
+ struct_type_name_string(pstype),
+ (ulong) ptr, client_name_string(cname));
+ (*finalize) (ptr);
}
if (mmem->monitor)
- gx_monitor_enter(mmem->monitor); /* Exclusive access */
+ gx_monitor_enter(mmem->monitor); /* Exclusive access */
bp = mmem->allocated; /* If 'finalize' releases a memory,
- this function could be called recursively and
- change mmem->allocated. */
+ this function could be called recursively and
+ change mmem->allocated. */
if (ptr == bp + 1) {
- mmem->allocated = bp->next;
- mmem->used -= bp->size + sizeof(gs_malloc_block_t);
-
- if (mmem->allocated)
- mmem->allocated->prev = 0;
- if (mmem->monitor)
- gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
- gs_alloc_fill(bp, gs_alloc_fill_free,
- bp->size + sizeof(gs_malloc_block_t));
- free(bp);
+ mmem->allocated = bp->next;
+ mmem->used -= bp->size + sizeof(gs_malloc_block_t);
+
+ if (mmem->allocated)
+ mmem->allocated->prev = 0;
+ if (mmem->monitor)
+ gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
+ gs_alloc_fill(bp, gs_alloc_fill_free,
+ bp->size + sizeof(gs_malloc_block_t));
+ free(bp);
} else {
- gs_malloc_block_t *np;
-
- /*
- * bp == 0 at this point is an error, but we'd rather have an
- * error message than an invalid access.
- */
- if (bp) {
- for (; (np = bp->next) != 0; bp = np) {
- if (ptr == np + 1) {
- bp->next = np->next;
- if (np->next)
- np->next->prev = bp;
- mmem->used -= np->size + sizeof(gs_malloc_block_t);
- if (mmem->monitor)
- gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
- gs_alloc_fill(np, gs_alloc_fill_free,
- np->size + sizeof(gs_malloc_block_t));
- free(np);
- return;
- }
- }
- }
- if (mmem->monitor)
- gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
- lprintf2("%s: free 0x%lx not found!\n",
- client_name_string(cname), (ulong) ptr);
- free((char *)((gs_malloc_block_t *) ptr - 1));
+ gs_malloc_block_t *np;
+
+ /*
+ * bp == 0 at this point is an error, but we'd rather have an
+ * error message than an invalid access.
+ */
+ if (bp) {
+ for (; (np = bp->next) != 0; bp = np) {
+ if (ptr == np + 1) {
+ bp->next = np->next;
+ if (np->next)
+ np->next->prev = bp;
+ mmem->used -= np->size + sizeof(gs_malloc_block_t);
+ if (mmem->monitor)
+ gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
+ gs_alloc_fill(np, gs_alloc_fill_free,
+ np->size + sizeof(gs_malloc_block_t));
+ free(np);
+ return;
+ }
+ }
+ }
+ if (mmem->monitor)
+ gx_monitor_leave(mmem->monitor); /* Done with exclusive access */
+ lprintf2("%s: free 0x%lx not found!\n",
+ client_name_string(cname), (ulong) ptr);
+ free((char *)((gs_malloc_block_t *) ptr - 1));
}
}
static byte *
@@ -374,29 +373,29 @@ gs_heap_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
}
static byte *
gs_heap_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
- client_name_t cname)
+ client_name_t cname)
{
if (gs_heap_object_type(mem, data) != &st_bytes)
- lprintf2("%s: resizing non-string 0x%lx!\n",
- client_name_string(cname), (ulong) data);
+ lprintf2("%s: resizing non-string 0x%lx!\n",
+ client_name_string(cname), (ulong) data);
return gs_heap_resize_object(mem, data, new_num, cname);
}
static void
gs_heap_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
/****** SHOULD CHECK SIZE IF DEBUGGING ******/
gs_heap_free_object(mem, data, cname);
}
static int
gs_heap_register_root(gs_memory_t * mem, gs_gc_root_t * rp,
- gs_ptr_type_t ptype, void **up, client_name_t cname)
+ gs_ptr_type_t ptype, void **up, client_name_t cname)
{
return 0;
}
static void
gs_heap_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp,
- client_name_t cname)
+ client_name_t cname)
{
}
static gs_memory_t *
@@ -423,11 +422,11 @@ static void
gs_heap_enable_free(gs_memory_t * mem, bool enable)
{
if (enable)
- mem->procs.free_object = gs_heap_free_object,
- mem->procs.free_string = gs_heap_free_string;
+ mem->procs.free_object = gs_heap_free_object,
+ mem->procs.free_string = gs_heap_free_string;
else
- mem->procs.free_object = gs_ignore_free_object,
- mem->procs.free_string = gs_ignore_free_string;
+ mem->procs.free_object = gs_ignore_free_object,
+ mem->procs.free_string = gs_ignore_free_string;
}
/* Release all memory acquired by this allocator. */
@@ -446,20 +445,20 @@ gs_heap_free_all(gs_memory_t * mem, uint free_mask, client_name_t cname)
mmem->monitor = NULL; /* delete reference to this monitor */
gx_monitor_free(mon); /* free the monitor */
if (free_mask & FREE_ALL_DATA) {
- gs_malloc_block_t *bp = mmem->allocated;
- gs_malloc_block_t *np;
-
- for (; bp != 0; bp = np) {
- np = bp->next;
- if_debug3('a', "[a]gs_heap_free_all(%s) 0x%lx(%u)\n",
- client_name_string(bp->cname), (ulong) (bp + 1),
- bp->size);
- gs_alloc_fill(bp + 1, gs_alloc_fill_free, bp->size);
- free(bp);
- }
+ gs_malloc_block_t *bp = mmem->allocated;
+ gs_malloc_block_t *np;
+
+ for (; bp != 0; bp = np) {
+ np = bp->next;
+ if_debug3('a', "[a]gs_heap_free_all(%s) 0x%lx(%u)\n",
+ client_name_string(bp->cname), (ulong) (bp + 1),
+ bp->size);
+ gs_alloc_fill(bp + 1, gs_alloc_fill_free, bp->size);
+ free(bp);
+ }
}
if (free_mask & FREE_ALL_ALLOCATOR)
- free(mem);
+ free(mem);
}
/* ------ Wrapping ------ */
@@ -475,25 +474,25 @@ gs_malloc_wrap(gs_memory_t **wrapped, gs_malloc_memory_t *contents)
* color device and not for PDF or XPS with transparency
*/
{
- gs_memory_retrying_t *rmem;
- rmem = (gs_memory_retrying_t *)
- gs_alloc_bytes_immovable((gs_memory_t *)lmem,
- sizeof(gs_memory_retrying_t),
- "gs_malloc_wrap(retrying)");
- if (rmem == 0) {
- gs_memory_locked_release(lmem);
- gs_free_object(cmem, lmem, "gs_malloc_wrap(locked)");
- return_error(gs_error_VMerror);
- }
- code = gs_memory_retrying_init(rmem, (gs_memory_t *)lmem);
- if (code < 0) {
- gs_free_object((gs_memory_t *)lmem, rmem, "gs_malloc_wrap(retrying)");
- gs_memory_locked_release(lmem);
- gs_free_object(cmem, lmem, "gs_malloc_wrap(locked)");
- return code;
- }
-
- *wrapped = (gs_memory_t *)rmem;
+ gs_memory_retrying_t *rmem;
+ rmem = (gs_memory_retrying_t *)
+ gs_alloc_bytes_immovable((gs_memory_t *)lmem,
+ sizeof(gs_memory_retrying_t),
+ "gs_malloc_wrap(retrying)");
+ if (rmem == 0) {
+ gs_memory_locked_release(lmem);
+ gs_free_object(cmem, lmem, "gs_malloc_wrap(locked)");
+ return_error(gs_error_VMerror);
+ }
+ code = gs_memory_retrying_init(rmem, (gs_memory_t *)lmem);
+ if (code < 0) {
+ gs_free_object((gs_memory_t *)lmem, rmem, "gs_malloc_wrap(retrying)");
+ gs_memory_locked_release(lmem);
+ gs_free_object(cmem, lmem, "gs_malloc_wrap(locked)");
+ return code;
+ }
+
+ *wrapped = (gs_memory_t *)rmem;
}
# endif /* retrying */
return 0;
@@ -527,7 +526,6 @@ gs_malloc_unwrap(gs_memory_t *wrapped)
#endif
}
-
/* Create the default allocator, and return it. */
gs_memory_t *
gs_malloc_init(void)
@@ -554,7 +552,7 @@ gs_malloc_init(void)
void
gs_malloc_release(gs_memory_t *mem)
{
-#ifdef USE_RETRY_MEMORY_WRAPPER
+#ifdef USE_RETRY_MEMORY_WRAPPER
gs_malloc_memory_t * malloc_memory_default = gs_malloc_unwrap(mem);
#else
gs_malloc_memory_t * malloc_memory_default = (gs_malloc_memory_t *)mem;
diff --git a/gs/base/gsmalloc.h b/gs/base/gsmalloc.h
index 08156c82c..1c6fc15ee 100644
--- a/gs/base/gsmalloc.h
+++ b/gs/base/gsmalloc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@ gs_malloc_memory_t *gs_malloc_memory_init(void);
/* The cast is unfortunate, but unavoidable. */
#define gs_malloc_memory_release(mem)\
gs_memory_free_all((gs_memory_t *)mem, FREE_ALL_EVERYTHING,\
- "gs_malloc_memory_release")
+ "gs_malloc_memory_release")
gs_memory_t * gs_malloc_init(void);
void gs_malloc_release(gs_memory_t *mem);
diff --git a/gs/base/gsmatrix.c b/gs/base/gsmatrix.c
index 295d61b58..744497e17 100644
--- a/gs/base/gsmatrix.c
+++ b/gs/base/gsmatrix.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -84,29 +84,29 @@ gs_matrix_multiply(const gs_matrix * pm1, const gs_matrix * pm2, gs_matrix * pmr
double xy2 = pm2->xy, yx2 = pm2->yx;
if (is_xxyy(pm1)) {
- pmr->tx = tx1 * xx2 + pm2->tx;
- pmr->ty = ty1 * yy2 + pm2->ty;
- if (is_fzero(xy2))
- pmr->xy = 0;
- else
- pmr->xy = xx1 * xy2,
- pmr->ty += tx1 * xy2;
- pmr->xx = xx1 * xx2;
- if (is_fzero(yx2))
- pmr->yx = 0;
- else
- pmr->yx = yy1 * yx2,
- pmr->tx += ty1 * yx2;
- pmr->yy = yy1 * yy2;
+ pmr->tx = tx1 * xx2 + pm2->tx;
+ pmr->ty = ty1 * yy2 + pm2->ty;
+ if (is_fzero(xy2))
+ pmr->xy = 0;
+ else
+ pmr->xy = xx1 * xy2,
+ pmr->ty += tx1 * xy2;
+ pmr->xx = xx1 * xx2;
+ if (is_fzero(yx2))
+ pmr->yx = 0;
+ else
+ pmr->yx = yy1 * yx2,
+ pmr->tx += ty1 * yx2;
+ pmr->yy = yy1 * yy2;
} else {
- double xy1 = pm1->xy, yx1 = pm1->yx;
-
- pmr->xx = xx1 * xx2 + xy1 * yx2;
- pmr->xy = xx1 * xy2 + xy1 * yy2;
- pmr->yy = yx1 * xy2 + yy1 * yy2;
- pmr->yx = yx1 * xx2 + yy1 * yx2;
- pmr->tx = tx1 * xx2 + ty1 * yx2 + pm2->tx;
- pmr->ty = tx1 * xy2 + ty1 * yy2 + pm2->ty;
+ double xy1 = pm1->xy, yx1 = pm1->yx;
+
+ pmr->xx = xx1 * xx2 + xy1 * yx2;
+ pmr->xy = xx1 * xy2 + xy1 * yy2;
+ pmr->yy = yx1 * xy2 + yy1 * yy2;
+ pmr->yx = yx1 * xx2 + yy1 * yx2;
+ pmr->tx = tx1 * xx2 + ty1 * yx2 + pm2->tx;
+ pmr->ty = tx1 * xy2 + ty1 * yy2 + pm2->ty;
}
return 0;
}
@@ -119,29 +119,29 @@ gs_matrix_multiply_double(const gs_matrix_double * pm1, const gs_matrix * pm2, g
double xy2 = pm2->xy, yx2 = pm2->yx;
if (is_xxyy(pm1)) {
- pmr->tx = tx1 * xx2 + pm2->tx;
- pmr->ty = ty1 * yy2 + pm2->ty;
- if (is_fzero(xy2))
- pmr->xy = 0;
- else
- pmr->xy = xx1 * xy2,
- pmr->ty += tx1 * xy2;
- pmr->xx = xx1 * xx2;
- if (is_fzero(yx2))
- pmr->yx = 0;
- else
- pmr->yx = yy1 * yx2,
- pmr->tx += ty1 * yx2;
- pmr->yy = yy1 * yy2;
+ pmr->tx = tx1 * xx2 + pm2->tx;
+ pmr->ty = ty1 * yy2 + pm2->ty;
+ if (is_fzero(xy2))
+ pmr->xy = 0;
+ else
+ pmr->xy = xx1 * xy2,
+ pmr->ty += tx1 * xy2;
+ pmr->xx = xx1 * xx2;
+ if (is_fzero(yx2))
+ pmr->yx = 0;
+ else
+ pmr->yx = yy1 * yx2,
+ pmr->tx += ty1 * yx2;
+ pmr->yy = yy1 * yy2;
} else {
- double xy1 = pm1->xy, yx1 = pm1->yx;
-
- pmr->xx = xx1 * xx2 + xy1 * yx2;
- pmr->xy = xx1 * xy2 + xy1 * yy2;
- pmr->yy = yx1 * xy2 + yy1 * yy2;
- pmr->yx = yx1 * xx2 + yy1 * yx2;
- pmr->tx = tx1 * xx2 + ty1 * yx2 + pm2->tx;
- pmr->ty = tx1 * xy2 + ty1 * yy2 + pm2->ty;
+ double xy1 = pm1->xy, yx1 = pm1->yx;
+
+ pmr->xx = xx1 * xx2 + xy1 * yx2;
+ pmr->xy = xx1 * xy2 + xy1 * yy2;
+ pmr->yy = yx1 * xy2 + yy1 * yy2;
+ pmr->yx = yx1 * xx2 + yy1 * yx2;
+ pmr->tx = tx1 * xx2 + ty1 * yx2 + pm2->tx;
+ pmr->ty = tx1 * xy2 + ty1 * yy2 + pm2->ty;
}
return 0;
}
@@ -152,37 +152,37 @@ gs_matrix_invert(const gs_matrix * pm, gs_matrix * pmr)
{ /* We have to be careful about fetch/store order, */
/* because pm might be the same as pmr. */
if (is_xxyy(pm)) {
- if (is_fzero(pm->xx) || is_fzero(pm->yy))
- return_error(gs_error_undefinedresult);
- pmr->tx = -(pmr->xx = 1.0 / pm->xx) * pm->tx;
- pmr->xy = 0.0;
- pmr->yx = 0.0;
- pmr->ty = -(pmr->yy = 1.0 / pm->yy) * pm->ty;
+ if (is_fzero(pm->xx) || is_fzero(pm->yy))
+ return_error(gs_error_undefinedresult);
+ pmr->tx = -(pmr->xx = 1.0 / pm->xx) * pm->tx;
+ pmr->xy = 0.0;
+ pmr->yx = 0.0;
+ pmr->ty = -(pmr->yy = 1.0 / pm->yy) * pm->ty;
} else {
- float mxx = pm->xx, myy = pm->yy, mxy = pm->xy, myx = pm->yx;
+ float mxx = pm->xx, myy = pm->yy, mxy = pm->xy, myx = pm->yx;
float mtx = pm->tx, mty = pm->ty;
/* we declare det as double since on at least some computer (i.e. peeves)
declaring it as a float results in different values for pmr depending
on whether or not optimization is turned on. I believe this is caused
- by the compiler keeping the det value in an internal register when
- optimization is enable. As evidence of this if you add a debugging
- statement to print out det the optimized code acts the same as the
- unoptimized code. declearing det as double does not change the CET 10-09.ps
+ by the compiler keeping the det value in an internal register when
+ optimization is enable. As evidence of this if you add a debugging
+ statement to print out det the optimized code acts the same as the
+ unoptimized code. declearing det as double does not change the CET 10-09.ps
output. */
- double det = (float)(mxx * myy) - (float)(mxy * myx);
+ double det = (float)(mxx * myy) - (float)(mxy * myx);
/*
* We are doing the math as floats instead of doubles to reproduce
- * the results in page 1 of CET 10-09.ps
+ * the results in page 1 of CET 10-09.ps
*/
- if (det == 0)
- return_error(gs_error_undefinedresult);
- pmr->xx = myy / det;
- pmr->xy = -mxy / det;
- pmr->yx = -myx / det;
- pmr->yy = mxx / det;
- pmr->tx = (((float)(mty * myx) - (float)(mtx * myy))) / det;
- pmr->ty = (((float)(mtx * mxy) - (float)(mty * mxx))) / det;
+ if (det == 0)
+ return_error(gs_error_undefinedresult);
+ pmr->xx = myy / det;
+ pmr->xy = -mxy / det;
+ pmr->yx = -myx / det;
+ pmr->yy = mxx / det;
+ pmr->tx = (((float)(mty * myx) - (float)(mtx * myy))) / det;
+ pmr->ty = (((float)(mtx * mxy) - (float)(mty * mxx))) / det;
}
return 0;
}
@@ -191,29 +191,29 @@ gs_matrix_invert_to_double(const gs_matrix * pm, gs_matrix_double * pmr)
{ /* We have to be careful about fetch/store order, */
/* because pm might be the same as pmr. */
if (is_xxyy(pm)) {
- if (is_fzero(pm->xx) || is_fzero(pm->yy))
- return_error(gs_error_undefinedresult);
- pmr->tx = -(pmr->xx = 1.0 / pm->xx) * pm->tx;
- pmr->xy = 0.0;
- pmr->yx = 0.0;
- pmr->ty = -(pmr->yy = 1.0 / pm->yy) * pm->ty;
+ if (is_fzero(pm->xx) || is_fzero(pm->yy))
+ return_error(gs_error_undefinedresult);
+ pmr->tx = -(pmr->xx = 1.0 / pm->xx) * pm->tx;
+ pmr->xy = 0.0;
+ pmr->yx = 0.0;
+ pmr->ty = -(pmr->yy = 1.0 / pm->yy) * pm->ty;
} else {
- double mxx = pm->xx, myy = pm->yy, mxy = pm->xy, myx = pm->yx;
+ double mxx = pm->xx, myy = pm->yy, mxy = pm->xy, myx = pm->yx;
double mtx = pm->tx, mty = pm->ty;
- double det = (mxx * myy) - (mxy * myx);
+ double det = (mxx * myy) - (mxy * myx);
/*
* We are doing the math as floats instead of doubles to reproduce
- * the results in page 1 of CET 10-09.ps
+ * the results in page 1 of CET 10-09.ps
*/
- if (det == 0)
- return_error(gs_error_undefinedresult);
- pmr->xx = myy / det;
- pmr->xy = -mxy / det;
- pmr->yx = -myx / det;
- pmr->yy = mxx / det;
- pmr->tx = (((mty * myx) - (mtx * myy))) / det;
- pmr->ty = (((mtx * mxy) - (mty * mxx))) / det;
+ if (det == 0)
+ return_error(gs_error_undefinedresult);
+ pmr->xx = myy / det;
+ pmr->xy = -mxy / det;
+ pmr->yx = -myx / det;
+ pmr->yy = mxx / det;
+ pmr->tx = (((mty * myx) - (mtx * myy))) / det;
+ pmr->ty = (((mtx * mxy) - (mty * mxx))) / det;
}
return 0;
}
@@ -226,9 +226,9 @@ gs_matrix_translate(const gs_matrix * pm, floatp dx, floatp dy, gs_matrix * pmr)
int code = gs_distance_transform(dx, dy, pm, &trans);
if (code < 0)
- return code;
+ return code;
if (pmr != pm)
- *pmr = *pm;
+ *pmr = *pm;
pmr->tx += trans.x;
pmr->ty += trans.y;
return 0;
@@ -243,8 +243,8 @@ gs_matrix_scale(const gs_matrix * pm, floatp sx, floatp sy, gs_matrix * pmr)
pmr->yx = pm->yx * sy;
pmr->yy = pm->yy * sy;
if (pmr != pm) {
- pmr->tx = pm->tx;
- pmr->ty = pm->ty;
+ pmr->tx = pm->tx;
+ pmr->ty = pm->ty;
}
return 0;
}
@@ -263,8 +263,8 @@ gs_matrix_rotate(const gs_matrix * pm, floatp ang, gs_matrix * pmr)
pmr->yx = sincos.cos * pm->yx - sincos.sin * mxx;
pmr->yy = sincos.cos * pm->yy - sincos.sin * mxy;
if (pmr != pm) {
- pmr->tx = pm->tx;
- pmr->ty = pm->ty;
+ pmr->tx = pm->tx;
+ pmr->ty = pm->ty;
}
return 0;
}
@@ -277,7 +277,7 @@ gs_matrix_rotate(const gs_matrix * pm, floatp ang, gs_matrix * pmr)
/* Transform a point. */
int
gs_point_transform(floatp x, floatp y, const gs_matrix * pmat,
- gs_point * ppt)
+ gs_point * ppt)
{
/*
* The float casts are there to reproduce results in CET 10-01.ps
@@ -286,9 +286,9 @@ gs_point_transform(floatp x, floatp y, const gs_matrix * pmat,
ppt->x = (float)(x * pmat->xx) + pmat->tx;
ppt->y = (float)(y * pmat->yy) + pmat->ty;
if (!is_fzero(pmat->yx))
- ppt->x += (float)(y * pmat->yx);
+ ppt->x += (float)(y * pmat->yx);
if (!is_fzero(pmat->xy))
- ppt->y += (float)(x * pmat->xy);
+ ppt->y += (float)(x * pmat->xy);
return 0;
}
@@ -296,42 +296,42 @@ gs_point_transform(floatp x, floatp y, const gs_matrix * pmat,
/* Return gs_error_undefinedresult if the matrix is not invertible. */
int
gs_point_transform_inverse(floatp x, floatp y, const gs_matrix * pmat,
- gs_point * ppt)
+ gs_point * ppt)
{
if (is_xxyy(pmat)) {
- if (is_fzero(pmat->xx) || is_fzero(pmat->yy))
- return_error(gs_error_undefinedresult);
- ppt->x = (x - pmat->tx) / pmat->xx;
- ppt->y = (y - pmat->ty) / pmat->yy;
- return 0;
+ if (is_fzero(pmat->xx) || is_fzero(pmat->yy))
+ return_error(gs_error_undefinedresult);
+ ppt->x = (x - pmat->tx) / pmat->xx;
+ ppt->y = (y - pmat->ty) / pmat->yy;
+ return 0;
} else if (is_xyyx(pmat)) {
- if (is_fzero(pmat->xy) || is_fzero(pmat->yx))
- return_error(gs_error_undefinedresult);
- ppt->x = (y - pmat->ty) / pmat->xy;
- ppt->y = (x - pmat->tx) / pmat->yx;
- return 0;
+ if (is_fzero(pmat->xy) || is_fzero(pmat->yx))
+ return_error(gs_error_undefinedresult);
+ ppt->x = (y - pmat->ty) / pmat->xy;
+ ppt->y = (x - pmat->tx) / pmat->yx;
+ return 0;
} else { /* There are faster ways to do this, */
- /* but we won't implement one unless we have to. */
- gs_matrix imat;
- int code = gs_matrix_invert(pmat, &imat);
+ /* but we won't implement one unless we have to. */
+ gs_matrix imat;
+ int code = gs_matrix_invert(pmat, &imat);
- if (code < 0)
- return code;
- return gs_point_transform(x, y, &imat, ppt);
+ if (code < 0)
+ return code;
+ return gs_point_transform(x, y, &imat, ppt);
}
}
/* Transform a distance. */
int
gs_distance_transform(floatp dx, floatp dy, const gs_matrix * pmat,
- gs_point * pdpt)
+ gs_point * pdpt)
{
pdpt->x = dx * pmat->xx;
pdpt->y = dy * pmat->yy;
if (!is_fzero(pmat->yx))
- pdpt->x += dy * pmat->yx;
+ pdpt->x += dy * pmat->yx;
if (!is_fzero(pmat->xy))
- pdpt->y += dx * pmat->xy;
+ pdpt->y += dx * pmat->xy;
return 0;
}
@@ -339,25 +339,25 @@ gs_distance_transform(floatp dx, floatp dy, const gs_matrix * pmat,
/* Return gs_error_undefinedresult if the matrix is not invertible. */
int
gs_distance_transform_inverse(floatp dx, floatp dy,
- const gs_matrix * pmat, gs_point * pdpt)
+ const gs_matrix * pmat, gs_point * pdpt)
{
if (is_xxyy(pmat)) {
- if (is_fzero(pmat->xx) || is_fzero(pmat->yy))
- return_error(gs_error_undefinedresult);
- pdpt->x = dx / pmat->xx;
- pdpt->y = dy / pmat->yy;
+ if (is_fzero(pmat->xx) || is_fzero(pmat->yy))
+ return_error(gs_error_undefinedresult);
+ pdpt->x = dx / pmat->xx;
+ pdpt->y = dy / pmat->yy;
} else if (is_xyyx(pmat)) {
- if (is_fzero(pmat->xy) || is_fzero(pmat->yx))
- return_error(gs_error_undefinedresult);
- pdpt->x = dy / pmat->xy;
- pdpt->y = dx / pmat->yx;
+ if (is_fzero(pmat->xy) || is_fzero(pmat->yx))
+ return_error(gs_error_undefinedresult);
+ pdpt->x = dy / pmat->xy;
+ pdpt->y = dx / pmat->yx;
} else {
- double det = pmat->xx * pmat->yy - pmat->xy * pmat->yx;
+ double det = pmat->xx * pmat->yy - pmat->xy * pmat->yx;
- if (det == 0)
- return_error(gs_error_undefinedresult);
- pdpt->x = (dx * pmat->yy - dy * pmat->yx) / det;
- pdpt->y = (dy * pmat->xx - dx * pmat->xy) / det;
+ if (det == 0)
+ return_error(gs_error_undefinedresult);
+ pdpt->x = (dx * pmat->yy - dy * pmat->yx) / det;
+ pdpt->y = (dy * pmat->xx - dx * pmat->xy) / det;
}
return 0;
}
@@ -376,9 +376,9 @@ gs_points_bbox(const gs_point pts[4], gs_rect * pbox)
vmax = max(max01, max23);\
}
assign_min_max_4(pbox->p.x, pbox->q.x,
- pts[0].x, pts[1].x, pts[2].x, pts[3].x);
+ pts[0].x, pts[1].x, pts[2].x, pts[3].x);
assign_min_max_4(pbox->p.y, pbox->q.y,
- pts[0].y, pts[1].y, pts[2].y, pts[3].y);
+ pts[0].y, pts[1].y, pts[2].y, pts[3].y);
#undef assign_min_max
#undef assign_min_max_4
return 0;
@@ -388,23 +388,23 @@ gs_points_bbox(const gs_point pts[4], gs_rect * pbox)
/* Return gs_error_undefinedresult if the matrix is not invertible. */
static int
bbox_transform_either_only(const gs_rect * pbox_in, const gs_matrix * pmat,
- gs_point pts[4],
+ gs_point pts[4],
int (*point_xform) (floatp, floatp, const gs_matrix *, gs_point *))
{
int code;
if ((code = (*point_xform) (pbox_in->p.x, pbox_in->p.y, pmat, &pts[0])) < 0 ||
- (code = (*point_xform) (pbox_in->p.x, pbox_in->q.y, pmat, &pts[1])) < 0 ||
- (code = (*point_xform) (pbox_in->q.x, pbox_in->p.y, pmat, &pts[2])) < 0 ||
+ (code = (*point_xform) (pbox_in->p.x, pbox_in->q.y, pmat, &pts[1])) < 0 ||
+ (code = (*point_xform) (pbox_in->q.x, pbox_in->p.y, pmat, &pts[2])) < 0 ||
(code = (*point_xform) (pbox_in->q.x, pbox_in->q.y, pmat, &pts[3])) < 0
- )
- DO_NOTHING;
+ )
+ DO_NOTHING;
return code;
}
static int
bbox_transform_either(const gs_rect * pbox_in, const gs_matrix * pmat,
- gs_rect * pbox_out,
+ gs_rect * pbox_out,
int (*point_xform) (floatp, floatp, const gs_matrix *, gs_point *))
{
int code;
@@ -419,29 +419,29 @@ bbox_transform_either(const gs_rect * pbox_in, const gs_matrix * pmat,
gs_point pts[4];
if ((code = bbox_transform_either_only(pbox_in, pmat, pts, point_xform)) < 0)
- return code;
+ return code;
return gs_points_bbox(pts, pbox_out);
}
int
gs_bbox_transform(const gs_rect * pbox_in, const gs_matrix * pmat,
- gs_rect * pbox_out)
+ gs_rect * pbox_out)
{
return bbox_transform_either(pbox_in, pmat, pbox_out,
- gs_point_transform);
+ gs_point_transform);
}
int
gs_bbox_transform_only(const gs_rect * pbox_in, const gs_matrix * pmat,
- gs_point points[4])
+ gs_point points[4])
{
return bbox_transform_either_only(pbox_in, pmat, points,
- gs_point_transform);
+ gs_point_transform);
}
int
gs_bbox_transform_inverse(const gs_rect * pbox_in, const gs_matrix * pmat,
- gs_rect * pbox_out)
+ gs_rect * pbox_out)
{
return bbox_transform_either(pbox_in, pmat, pbox_out,
- gs_point_transform_inverse);
+ gs_point_transform_inverse);
}
/* ------ Coordinate transformations (to fixed point) ------ */
@@ -454,11 +454,11 @@ gs_matrix_fixed_from_matrix(gs_matrix_fixed *pfmat, const gs_matrix *pmat)
{
*(gs_matrix *)pfmat = *pmat;
if (f_fits_in_fixed(pmat->tx) && f_fits_in_fixed(pmat->ty)) {
- pfmat->tx = fixed2float(pfmat->tx_fixed = float2fixed(pmat->tx));
- pfmat->ty = fixed2float(pfmat->ty_fixed = float2fixed(pmat->ty));
- pfmat->txy_fixed_valid = true;
+ pfmat->tx = fixed2float(pfmat->tx_fixed = float2fixed(pmat->tx));
+ pfmat->ty = fixed2float(pfmat->ty_fixed = float2fixed(pmat->ty));
+ pfmat->txy_fixed_valid = true;
} else {
- pfmat->txy_fixed_valid = false;
+ pfmat->txy_fixed_valid = false;
}
return 0;
}
@@ -466,59 +466,59 @@ gs_matrix_fixed_from_matrix(gs_matrix_fixed *pfmat, const gs_matrix *pmat)
/* Transform a point with a fixed-point result. */
int
gs_point_transform2fixed(const gs_matrix_fixed * pmat,
- floatp x, floatp y, gs_fixed_point * ppt)
+ floatp x, floatp y, gs_fixed_point * ppt)
{
fixed px, py, t;
double xtemp, ytemp;
int code;
if (!pmat->txy_fixed_valid) { /* The translation is out of range. Do the */
- /* computation in floating point, and convert to */
- /* fixed at the end. */
- gs_point fpt;
-
- gs_point_transform(x, y, (const gs_matrix *)pmat, &fpt);
- if (!(f_fits_in_fixed(fpt.x) && f_fits_in_fixed(fpt.y)))
- return_error(gs_error_limitcheck);
- ppt->x = float2fixed(fpt.x);
- ppt->y = float2fixed(fpt.y);
- return 0;
+ /* computation in floating point, and convert to */
+ /* fixed at the end. */
+ gs_point fpt;
+
+ gs_point_transform(x, y, (const gs_matrix *)pmat, &fpt);
+ if (!(f_fits_in_fixed(fpt.x) && f_fits_in_fixed(fpt.y)))
+ return_error(gs_error_limitcheck);
+ ppt->x = float2fixed(fpt.x);
+ ppt->y = float2fixed(fpt.y);
+ return 0;
}
if (!is_fzero(pmat->xy)) { /* Hope for 90 degree rotation */
- if ((code = CHECK_DFMUL2FIXED_VARS(px, y, pmat->yx, xtemp)) < 0 ||
- (code = CHECK_DFMUL2FIXED_VARS(py, x, pmat->xy, ytemp)) < 0
- )
- return code;
- FINISH_DFMUL2FIXED_VARS(px, xtemp);
- FINISH_DFMUL2FIXED_VARS(py, ytemp);
- if (!is_fzero(pmat->xx)) {
- if ((code = CHECK_DFMUL2FIXED_VARS(t, x, pmat->xx, xtemp)) < 0)
- return code;
- FINISH_DFMUL2FIXED_VARS(t, xtemp);
- if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
- return code;
- }
- if (!is_fzero(pmat->yy)) {
- if ((code = CHECK_DFMUL2FIXED_VARS(t, y, pmat->yy, ytemp)) < 0)
- return code;
- FINISH_DFMUL2FIXED_VARS(t, ytemp);
- if ((code = CHECK_SET_FIXED_SUM(py, py, t)) < 0)
- return code;
- }
+ if ((code = CHECK_DFMUL2FIXED_VARS(px, y, pmat->yx, xtemp)) < 0 ||
+ (code = CHECK_DFMUL2FIXED_VARS(py, x, pmat->xy, ytemp)) < 0
+ )
+ return code;
+ FINISH_DFMUL2FIXED_VARS(px, xtemp);
+ FINISH_DFMUL2FIXED_VARS(py, ytemp);
+ if (!is_fzero(pmat->xx)) {
+ if ((code = CHECK_DFMUL2FIXED_VARS(t, x, pmat->xx, xtemp)) < 0)
+ return code;
+ FINISH_DFMUL2FIXED_VARS(t, xtemp);
+ if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
+ return code;
+ }
+ if (!is_fzero(pmat->yy)) {
+ if ((code = CHECK_DFMUL2FIXED_VARS(t, y, pmat->yy, ytemp)) < 0)
+ return code;
+ FINISH_DFMUL2FIXED_VARS(t, ytemp);
+ if ((code = CHECK_SET_FIXED_SUM(py, py, t)) < 0)
+ return code;
+ }
} else {
- if ((code = CHECK_DFMUL2FIXED_VARS(px, x, pmat->xx, xtemp)) < 0 ||
- (code = CHECK_DFMUL2FIXED_VARS(py, y, pmat->yy, ytemp)) < 0
- )
- return code;
- FINISH_DFMUL2FIXED_VARS(px, xtemp);
- FINISH_DFMUL2FIXED_VARS(py, ytemp);
- if (!is_fzero(pmat->yx)) {
- if ((code = CHECK_DFMUL2FIXED_VARS(t, y, pmat->yx, ytemp)) < 0)
- return code;
- FINISH_DFMUL2FIXED_VARS(t, ytemp);
- if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
- return code;
- }
+ if ((code = CHECK_DFMUL2FIXED_VARS(px, x, pmat->xx, xtemp)) < 0 ||
+ (code = CHECK_DFMUL2FIXED_VARS(py, y, pmat->yy, ytemp)) < 0
+ )
+ return code;
+ FINISH_DFMUL2FIXED_VARS(px, xtemp);
+ FINISH_DFMUL2FIXED_VARS(py, ytemp);
+ if (!is_fzero(pmat->yx)) {
+ if ((code = CHECK_DFMUL2FIXED_VARS(t, y, pmat->yx, ytemp)) < 0)
+ return code;
+ FINISH_DFMUL2FIXED_VARS(t, ytemp);
+ if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
+ return code;
+ }
}
if (((code = CHECK_SET_FIXED_SUM(ppt->x, px, pmat->tx_fixed)) < 0) ||
((code = CHECK_SET_FIXED_SUM(ppt->y, py, pmat->ty_fixed)) < 0) )
@@ -532,13 +532,13 @@ gs_point_transform2fixed(const gs_matrix_fixed * pmat,
see comment in clamp_point_aux. */
int
gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat,
- floatp x, floatp y, gs_fixed_point * ppt)
+ floatp x, floatp y, gs_fixed_point * ppt)
{
gs_point fpt;
gs_point_transform(x, y, (const gs_matrix *)pmat, &fpt);
if (!(f_fits_in_fixed(fpt.x) && f_fits_in_fixed(fpt.y)))
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
ppt->x = float2fixed_rounded(fpt.x);
ppt->y = float2fixed_rounded(fpt.y);
return 0;
@@ -548,31 +548,31 @@ gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat,
/* Transform a distance with a fixed-point result. */
int
gs_distance_transform2fixed(const gs_matrix_fixed * pmat,
- floatp dx, floatp dy, gs_fixed_point * ppt)
+ floatp dx, floatp dy, gs_fixed_point * ppt)
{
fixed px, py, t;
double xtemp, ytemp;
int code;
if ((code = CHECK_DFMUL2FIXED_VARS(px, dx, pmat->xx, xtemp)) < 0 ||
- (code = CHECK_DFMUL2FIXED_VARS(py, dy, pmat->yy, ytemp)) < 0
- )
- return code;
+ (code = CHECK_DFMUL2FIXED_VARS(py, dy, pmat->yy, ytemp)) < 0
+ )
+ return code;
FINISH_DFMUL2FIXED_VARS(px, xtemp);
FINISH_DFMUL2FIXED_VARS(py, ytemp);
if (!is_fzero(pmat->yx)) {
- if ((code = CHECK_DFMUL2FIXED_VARS(t, dy, pmat->yx, ytemp)) < 0)
- return code;
- FINISH_DFMUL2FIXED_VARS(t, ytemp);
- if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
- return code;
+ if ((code = CHECK_DFMUL2FIXED_VARS(t, dy, pmat->yx, ytemp)) < 0)
+ return code;
+ FINISH_DFMUL2FIXED_VARS(t, ytemp);
+ if ((code = CHECK_SET_FIXED_SUM(px, px, t)) < 0)
+ return code;
}
if (!is_fzero(pmat->xy)) {
- if ((code = CHECK_DFMUL2FIXED_VARS(t, dx, pmat->xy, xtemp)) < 0)
- return code;
- FINISH_DFMUL2FIXED_VARS(t, xtemp);
- if ((code = CHECK_SET_FIXED_SUM(py, py, t)) < 0)
- return code;
+ if ((code = CHECK_DFMUL2FIXED_VARS(t, dx, pmat->xy, xtemp)) < 0)
+ return code;
+ FINISH_DFMUL2FIXED_VARS(t, xtemp);
+ if ((code = CHECK_SET_FIXED_SUM(py, py, t)) < 0)
+ return code;
}
ppt->x = px;
ppt->y = py;
@@ -613,33 +613,33 @@ sput_matrix(stream *s, const gs_matrix *pmat)
coeff[4] = pmat->tx;
coeff[5] = pmat->ty;
for (i = 0; i < 4; i += 2) {
- float u = coeff[i], v = coeff[i ^ 3];
-
- b <<= 2;
- if (u != 0 || v != 0) {
- memcpy(cp, &u, sizeof(float));
- cp += sizeof(float);
-
- if (v == u)
- b += 1;
- else if (v == -u)
- b += 2;
- else {
- b += 3;
- memcpy(cp, &v, sizeof(float));
- cp += sizeof(float);
- }
- }
+ float u = coeff[i], v = coeff[i ^ 3];
+
+ b <<= 2;
+ if (u != 0 || v != 0) {
+ memcpy(cp, &u, sizeof(float));
+ cp += sizeof(float);
+
+ if (v == u)
+ b += 1;
+ else if (v == -u)
+ b += 2;
+ else {
+ b += 3;
+ memcpy(cp, &v, sizeof(float));
+ cp += sizeof(float);
+ }
+ }
}
for (; i < 6; ++i) {
- float v = coeff[i];
-
- b <<= 1;
- if (v != 0) {
- ++b;
- memcpy(cp, &v, sizeof(float));
- cp += sizeof(float);
- }
+ float v = coeff[i];
+
+ b <<= 1;
+ if (v != 0) {
+ ++b;
+ memcpy(cp, &v, sizeof(float));
+ cp += sizeof(float);
+ }
}
buf[0] = b << 2;
return sputs(s, buf, cp - buf, &ignore);
@@ -656,38 +656,38 @@ sget_matrix(stream *s, gs_matrix *pmat)
uint nread;
if (b < 0)
- return b;
+ return b;
for (i = 0; i < 4; i += 2, b <<= 2)
- if (!(b & 0xc0))
- coeff[i] = coeff[i ^ 3] = 0.0;
- else {
- float value;
-
- status = sgets(s, (byte *)&value, sizeof(value), &nread);
- if (status < 0 && status != EOFC)
- return_error(gs_error_ioerror);
- coeff[i] = value;
- switch ((b >> 6) & 3) {
- case 1:
- coeff[i ^ 3] = value;
- break;
- case 2:
- coeff[i ^ 3] = -value;
- break;
- case 3:
- status = sgets(s, (byte *)&coeff[i ^ 3],
- sizeof(coeff[0]), &nread);
- if (status < 0 && status != EOFC)
- return_error(gs_error_ioerror);
- }
- }
+ if (!(b & 0xc0))
+ coeff[i] = coeff[i ^ 3] = 0.0;
+ else {
+ float value;
+
+ status = sgets(s, (byte *)&value, sizeof(value), &nread);
+ if (status < 0 && status != EOFC)
+ return_error(gs_error_ioerror);
+ coeff[i] = value;
+ switch ((b >> 6) & 3) {
+ case 1:
+ coeff[i ^ 3] = value;
+ break;
+ case 2:
+ coeff[i ^ 3] = -value;
+ break;
+ case 3:
+ status = sgets(s, (byte *)&coeff[i ^ 3],
+ sizeof(coeff[0]), &nread);
+ if (status < 0 && status != EOFC)
+ return_error(gs_error_ioerror);
+ }
+ }
for (; i < 6; ++i, b <<= 1)
- if (b & 0x80) {
- status = sgets(s, (byte *)&coeff[i], sizeof(coeff[0]), &nread);
- if (status < 0 && status != EOFC)
- return_error(gs_error_ioerror);
- } else
- coeff[i] = 0.0;
+ if (b & 0x80) {
+ status = sgets(s, (byte *)&coeff[i], sizeof(coeff[0]), &nread);
+ if (status < 0 && status != EOFC)
+ return_error(gs_error_ioerror);
+ } else
+ coeff[i] = 0.0;
pmat->xx = coeff[0];
pmat->xy = coeff[1];
pmat->yx = coeff[2];
diff --git a/gs/base/gsmatrix.h b/gs/base/gsmatrix.h
index 09be6d2b2..b20d5e6cc 100644
--- a/gs/base/gsmatrix.h
+++ b/gs/base/gsmatrix.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsmchunk.c b/gs/base/gsmchunk.c
index 9cf9cf189..63d941fe1 100644
--- a/gs/base/gsmchunk.c
+++ b/gs/base/gsmchunk.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -117,16 +117,16 @@ typedef struct gs_memory_chunk_s {
/* Initialize a gs_memory_chunk_t */
int /* -ve error code or 0 */
gs_memory_chunk_wrap( gs_memory_t **wrapped, /* chunk allocator init */
- gs_memory_t * target ) /* base allocator */
+ gs_memory_t * target ) /* base allocator */
{
/* Use the non-GC allocator of the target. */
gs_memory_t *non_gc_target = target->non_gc_memory;
gs_memory_chunk_t *cmem = NULL;
*wrapped = NULL; /* don't leave garbage in case we fail */
- if (non_gc_target)
- cmem = (gs_memory_chunk_t *) gs_alloc_bytes_immovable(non_gc_target,
- sizeof(gs_memory_chunk_t), "gs_malloc_wrap(chunk)");
+ if (non_gc_target)
+ cmem = (gs_memory_chunk_t *) gs_alloc_bytes_immovable(non_gc_target,
+ sizeof(gs_memory_chunk_t), "gs_malloc_wrap(chunk)");
if (cmem == 0)
return_error(gs_error_VMerror);
cmem->stable_memory = (gs_memory_t *)cmem; /* we are stable */
@@ -155,7 +155,7 @@ void
gs_memory_chunk_release(gs_memory_t *mem)
{
gs_memory_free_all((gs_memory_t *)mem, FREE_ALL_EVERYTHING,
- "gs_memory_chunk_release");
+ "gs_memory_chunk_release");
}
/* ---------- Accessors ------------- */
@@ -180,22 +180,22 @@ gs_memory_chunk_dump_memory(const gs_memory_t *mem)
dprintf2("chunk_dump_memory: current used=%d, max_used=%d\n", cmem->used, cmem->max_used);
if (cmem->in_use != 0)
- dprintf1("*** this memory allocator is not idle, used for: %s\n",
- cmem->in_use < 0 ? "free" : "alloc");
+ dprintf1("*** this memory allocator is not idle, used for: %s\n",
+ cmem->in_use < 0 ? "free" : "alloc");
for (i=0; i<2; i++) {
- current = head;
- while ( current != NULL ) {
- if (current->objlist != NULL) {
- chunk_obj_node_t *obj;
-
- for (obj= current->objlist; obj != NULL; obj=obj->next)
- dprintf4("chunk_mem leak, obj=0x%lx, size=%d, type=%s, sequence#=%ld\n",
- (ulong)obj, obj->size, obj->type->sname, obj->sequence);
- }
- next = current->next;
- current = next;
- }
- head = cmem->head_so_chunk; /* switch to single object chunk list */
+ current = head;
+ while ( current != NULL ) {
+ if (current->objlist != NULL) {
+ chunk_obj_node_t *obj;
+
+ for (obj= current->objlist; obj != NULL; obj=obj->next)
+ dprintf4("chunk_mem leak, obj=0x%lx, size=%d, type=%s, sequence#=%ld\n",
+ (ulong)obj, obj->size, obj->type->sname, obj->sequence);
+ }
+ next = current->next;
+ current = next;
+ }
+ head = cmem->head_so_chunk; /* switch to single object chunk list */
}
}
#endif
@@ -219,18 +219,18 @@ chunk_mem_node_free_all_remaining(gs_memory_chunk_t *cmem)
#ifdef DEBUG
if (cmem->in_use != 0)
- dprintf1("*** chunk_mem_node_free_all_remaining: this memory allocator is not idle, used for: %s\n",
- cmem->in_use < 0 ? "free" : "alloc");
+ dprintf1("*** chunk_mem_node_free_all_remaining: this memory allocator is not idle, used for: %s\n",
+ cmem->in_use < 0 ? "free" : "alloc");
#endif
for (i=0; i<2; i++) {
- current = head;
- while ( current != NULL ) {
- next = current->next;
- gs_free_object(target, current, "chunk_mem_node_remove");
- current = next;
- }
- cmem->head_mo_chunk = NULL;
- head = cmem->head_so_chunk; /* switch to single object chunk list */
+ current = head;
+ while ( current != NULL ) {
+ next = current->next;
+ gs_free_object(target, current, "chunk_mem_node_remove");
+ current = next;
+ }
+ cmem->head_mo_chunk = NULL;
+ head = cmem->head_so_chunk; /* switch to single object chunk list */
}
cmem->head_so_chunk = NULL;
}
@@ -243,24 +243,24 @@ chunk_free_all(gs_memory_t * mem, uint free_mask, client_name_t cname)
#ifdef DEBUG
if (cmem->in_use != 0)
- dprintf1("*** chunk_free_all: this memory allocator is not idle, used for: %s\n",
- cmem->in_use < 0 ? "free" : "alloc");
+ dprintf1("*** chunk_free_all: this memory allocator is not idle, used for: %s\n",
+ cmem->in_use < 0 ? "free" : "alloc");
#endif
/* Only free the structures and the allocator itself. */
if (mem->stable_memory) {
- if (mem->stable_memory != mem)
- gs_memory_free_all(mem->stable_memory, free_mask, cname);
- if (free_mask & FREE_ALL_ALLOCATOR)
- mem->stable_memory = 0;
+ if (mem->stable_memory != mem)
+ gs_memory_free_all(mem->stable_memory, free_mask, cname);
+ if (free_mask & FREE_ALL_ALLOCATOR)
+ mem->stable_memory = 0;
}
if (free_mask & FREE_ALL_DATA) {
- chunk_mem_node_free_all_remaining(cmem);
+ chunk_mem_node_free_all_remaining(cmem);
}
if (free_mask & FREE_ALL_STRUCTURES) {
- cmem->target = 0;
+ cmem->target = 0;
}
if (free_mask & FREE_ALL_ALLOCATOR)
- gs_free_object(target, cmem, cname);
+ gs_free_object(target, cmem, cname);
}
extern const gs_memory_struct_type_t st_bytes;
@@ -279,11 +279,10 @@ round_up_to_align(uint size)
#define MULTIPLE_OBJ_CHUNK_SIZE \
(sizeof(chunk_mem_node_t) + round_up_to_align(CHUNK_SIZE))
-
/* return -1 on error, 0 on success */
-static int
+static int
chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_object_chunk,
- chunk_mem_node_t **newchunk)
+ chunk_mem_node_t **newchunk)
{
chunk_mem_node_t *node;
gs_memory_t *target = cmem->target;
@@ -294,10 +293,10 @@ chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_o
/* caller tells us whether or not to use a single object chunk */
if (is_multiple_object_chunk && (chunk_size < MULTIPLE_OBJ_CHUNK_SIZE)) {
- chunk_size = MULTIPLE_OBJ_CHUNK_SIZE; /* the size for collections of objects */
- is_multiple_object_chunk = true;
+ chunk_size = MULTIPLE_OBJ_CHUNK_SIZE; /* the size for collections of objects */
+ is_multiple_object_chunk = true;
} else
- is_multiple_object_chunk = false;
+ is_multiple_object_chunk = false;
*newchunk = NULL;
node = (chunk_mem_node_t *)gs_alloc_bytes_immovable(target, chunk_size, "chunk_mem_node_add");
@@ -306,7 +305,7 @@ chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_o
cmem->used += chunk_size;
#ifdef DEBUG
if (cmem->used > cmem->max_used)
- cmem->max_used = cmem->used;
+ cmem->max_used = cmem->used;
#endif
node->size = chunk_size; /* how much we allocated */
node->largest_free = chunk_size - sizeof(chunk_mem_node_t);
@@ -319,35 +318,35 @@ chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_o
/* Put the node at the head of the list (so=single object, mo=multiple object) */
/* only multiple objects will be have any room in them */
if (is_multiple_object_chunk) {
- if (cmem->head_mo_chunk == NULL) {
- cmem->head_mo_chunk = node;
- node->next = NULL;
- } else {
- node->next = cmem->head_mo_chunk;
- cmem->head_mo_chunk = node;
- }
+ if (cmem->head_mo_chunk == NULL) {
+ cmem->head_mo_chunk = node;
+ node->next = NULL;
+ } else {
+ node->next = cmem->head_mo_chunk;
+ cmem->head_mo_chunk = node;
+ }
} else {
- if (cmem->head_so_chunk == NULL) {
- cmem->head_so_chunk = node;
- node->next = NULL;
- } else {
- node->next = cmem->head_so_chunk;
- cmem->head_so_chunk = node;
- }
+ if (cmem->head_so_chunk == NULL) {
+ cmem->head_so_chunk = node;
+ node->next = NULL;
+ } else {
+ node->next = cmem->head_so_chunk;
+ cmem->head_so_chunk = node;
+ }
}
*newchunk = node; /* return the chunk we just allocated */
return 0;
}
-static int
+static int
chunk_mem_node_remove(gs_memory_chunk_t *cmem, chunk_mem_node_t *addr)
{
chunk_mem_node_t **p_head = addr->is_multiple_object_chunk ?
- &(cmem->head_mo_chunk) : &(cmem->head_so_chunk);
+ &(cmem->head_mo_chunk) : &(cmem->head_so_chunk);
chunk_mem_node_t *head = *p_head;
gs_memory_t * const target = cmem->target;
-
+
cmem->used -= addr->size;
#ifdef DEBUG
#endif
@@ -359,28 +358,28 @@ chunk_mem_node_remove(gs_memory_chunk_t *cmem, chunk_mem_node_t *addr)
}
if (head == addr) {
*p_head = head->next;
- gs_free_object(target, head, "chunk_mem_node_remove");
+ gs_free_object(target, head, "chunk_mem_node_remove");
} else {
- chunk_mem_node_t *current;
+ chunk_mem_node_t *current;
bool found = false;
/* scan the list, stopping in front of element */
for (current = head; current != NULL; current = current->next) {
if ( current->next && (current->next == addr) ) {
current->next = current->next->next; /* de-link it */
- gs_free_object(target, addr, "chunk_mem_node_remove");
+ gs_free_object(target, addr, "chunk_mem_node_remove");
found = true;
break;
}
}
if ( !found ) {
dprintf1("FAIL freeing wild pointer freed address 0x%lx not found\n", (ulong)addr );
- return -1;
- }
+ return -1;
+ }
}
return 0;
}
-
+
/* all of the allocation routines reduce to the this function */
static byte *
chunk_obj_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_name_t cname)
@@ -396,47 +395,47 @@ chunk_obj_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_n
#ifdef DEBUG
if (cmem->in_use != 0)
- dprintf1("*** chunk_obj_alloc: this memory allocator is not idle, used for: %s\n",
- cmem->in_use < 0 ? "free" : "alloc");
+ dprintf1("*** chunk_obj_alloc: this memory allocator is not idle, used for: %s\n",
+ cmem->in_use < 0 ? "free" : "alloc");
cmem->in_use = 1; /* alloc */
#endif
newsize = round_up_to_align(size + sizeof(chunk_obj_node_t)); /* space we will need */
is_multiple_object_size = ! IS_SINGLE_OBJ_SIZE(newsize);
-
+
if ( is_multiple_object_size ) {
- /* Search the multiple object chunks for one with a large enough free area */
- for (current = head; current != NULL; current = current->next) {
- if ( current->largest_free >= newsize)
- break;
- }
+ /* Search the multiple object chunks for one with a large enough free area */
+ for (current = head; current != NULL; current = current->next) {
+ if ( current->largest_free >= newsize)
+ break;
+ }
}
if (current == NULL) {
- /* No chunks with enough space or size makes this a single object, allocate one */
- if (chunk_mem_node_add(cmem, newsize, is_multiple_object_size, &current) < 0) {
+ /* No chunks with enough space or size makes this a single object, allocate one */
+ if (chunk_mem_node_add(cmem, newsize, is_multiple_object_size, &current) < 0) {
#ifdef DEBUG
- if (gs_debug_c('a'))
- dlprintf1("[a+]chunk_obj_alloc(chunk_mem_node_add)(%u) Failed.\n", size);
- cmem->in_use = 0; /* idle */
+ if (gs_debug_c('a'))
+ dlprintf1("[a+]chunk_obj_alloc(chunk_mem_node_add)(%u) Failed.\n", size);
+ cmem->in_use = 0; /* idle */
#endif
- return NULL;
- }
+ return NULL;
+ }
}
/* Find the first free area in the current chunk that is big enough */
/* LATER: might be better to find the 'best fit' */
prev_free = NULL; /* NULL means chunk */
for (free_obj = current->freelist; free_obj != NULL; free_obj=free_obj->next) {
- if (free_obj->size >= newsize)
- break;
- prev_free = free_obj; /* keep track so we can update link */
+ if (free_obj->size >= newsize)
+ break;
+ prev_free = free_obj; /* keep track so we can update link */
}
if (free_obj == NULL) {
- dprintf2("largest_free value = %d is too large, cannot find room for size = %d\n",
- current->largest_free, newsize);
+ dprintf2("largest_free value = %d is too large, cannot find room for size = %d\n",
+ current->largest_free, newsize);
#ifdef DEBUG
- cmem->in_use = 0; /* idle */
+ cmem->in_use = 0; /* idle */
#endif
- return NULL;
+ return NULL;
}
/* If this free object's size == largest_free, we'll have to re-scan */
@@ -448,18 +447,18 @@ chunk_obj_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_n
free_size = free_obj->size - newsize; /* amount remaining */
new_free = (chunk_obj_node_t *)((byte *)(free_obj) + newsize); /* start of remaining free area */
if (free_size >= sizeof(chunk_obj_node_t)) {
- if (prev_free != NULL)
- prev_free->next = new_free;
- else
- current->freelist = new_free;
- new_free->next = free_obj->next;
- new_free->size = free_size;
+ if (prev_free != NULL)
+ prev_free->next = new_free;
+ else
+ current->freelist = new_free;
+ new_free->next = free_obj->next;
+ new_free->size = free_size;
} else {
/* Not enough space remaining, just skip around it */
- if (prev_free != NULL)
- prev_free->next = free_obj->next;
- else
- current->freelist = free_obj->next;
+ if (prev_free != NULL)
+ prev_free->next = free_obj->next;
+ else
+ current->freelist = free_obj->next;
}
#ifdef DEBUG
@@ -475,17 +474,17 @@ chunk_obj_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_n
/* If we flagged for re-scan to find the new largest_free, do it now */
if (rescan_free_list) {
- current->largest_free = 0;
- for (free_obj = current->freelist; free_obj != NULL; free_obj=free_obj->next)
- if (free_obj->size > current->largest_free)
- current->largest_free = free_obj->size;
+ current->largest_free = 0;
+ for (free_obj = current->freelist; free_obj != NULL; free_obj=free_obj->next)
+ if (free_obj->size > current->largest_free)
+ current->largest_free = free_obj->size;
}
/* return the client area of the object we allocated */
#ifdef DEBUG
if (gs_debug_c('A'))
- dlprintf3("[a+]chunk_obj_alloc (%s)(%u) = 0x%lx: OK.\n",
- client_name_string(cname), size, (ulong) newobj);
+ dlprintf3("[a+]chunk_obj_alloc (%s)(%u) = 0x%lx: OK.\n",
+ client_name_string(cname), size, (ulong) newobj);
cmem->in_use = 0; /* idle */
#endif
return (byte *)(newobj) + sizeof(chunk_obj_node_t);
@@ -505,47 +504,46 @@ chunk_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
static void *
chunk_alloc_struct_immovable(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
return chunk_obj_alloc(mem, pstype->ssize, pstype, cname);
}
static void *
chunk_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
return chunk_obj_alloc(mem, pstype->ssize, pstype, cname);
}
static byte *
chunk_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
return chunk_alloc_bytes(mem, num_elements * elt_size, cname);
}
static byte *
chunk_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
return chunk_alloc_bytes(mem, num_elements * elt_size, cname);
}
static void *
chunk_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
return chunk_obj_alloc(mem, num_elements * pstype->ssize, pstype, cname);
}
static void *
chunk_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
return chunk_obj_alloc(mem, num_elements * pstype->ssize, pstype, cname);
}
-
static void *
chunk_resize_object(gs_memory_t * mem, void *ptr, uint new_num_elements, client_name_t cname)
{
@@ -562,178 +560,178 @@ chunk_resize_object(gs_memory_t * mem, void *ptr, uint new_num_elements, client_
#endif
if (new_size == old_size)
- return ptr;
+ return ptr;
if ((new_ptr = chunk_obj_alloc(mem, new_size, type, cname)) == 0)
- return 0;
+ return 0;
memcpy(new_ptr, ptr, min(old_size, new_size));
chunk_free_object(mem, ptr, cname);
#ifdef DEBUG
cmem->max_used = save_max_used;
if (cmem->used > cmem->max_used)
- cmem->max_used = cmem->used;
+ cmem->max_used = cmem->used;
#endif
return new_ptr;
}
-
+
static void
chunk_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
{
gs_memory_chunk_t * const cmem = (gs_memory_chunk_t *)mem;
- if (ptr == NULL )
- return;
+ if (ptr == NULL )
+ return;
{
- /* back up to obj header */
- chunk_obj_node_t *obj = ((chunk_obj_node_t *)ptr) - 1;
- void (*finalize)(void *ptr) = obj->type->finalize;
- chunk_mem_node_t *current;
- chunk_obj_node_t *free_obj, *prev_free;
- chunk_obj_node_t *scan_obj, *prev_obj;
- /* space we will free */
- uint freed_size = round_up_to_align(obj->size + sizeof(chunk_obj_node_t));
-
- if ( finalize != NULL )
- finalize(ptr);
+ /* back up to obj header */
+ chunk_obj_node_t *obj = ((chunk_obj_node_t *)ptr) - 1;
+ void (*finalize)(void *ptr) = obj->type->finalize;
+ chunk_mem_node_t *current;
+ chunk_obj_node_t *free_obj, *prev_free;
+ chunk_obj_node_t *scan_obj, *prev_obj;
+ /* space we will free */
+ uint freed_size = round_up_to_align(obj->size + sizeof(chunk_obj_node_t));
+
+ if ( finalize != NULL )
+ finalize(ptr);
#ifdef DEBUG
- if (cmem->in_use != 0)
- dprintf1("*** chunk_obj_alloc: this memory allocator is not idle, used for: %s\n",
- cmem->in_use < 0 ? "free" : "alloc");
- cmem->in_use = -1; /* free */
+ if (cmem->in_use != 0)
+ dprintf1("*** chunk_obj_alloc: this memory allocator is not idle, used for: %s\n",
+ cmem->in_use < 0 ? "free" : "alloc");
+ cmem->in_use = -1; /* free */
#endif
- /* finalize may change the head_**_chunk doing free of stuff */
- current = IS_SINGLE_OBJ_SIZE(freed_size) ?
- cmem->head_so_chunk : cmem->head_mo_chunk;
- /* Find the chunk containing this object */
- for ( ; current != NULL; current = current->next) {
- if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size))
- break;
- }
- if (current == NULL) {
- /* We _may_have searched the wrong list -- if so find out. */
- current = cmem->head_so_chunk;
- /* Find the chunk containing this object */
- for ( ; current != NULL; current = current->next) {
- if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size)) {
- dprintf1("chunk_free_obj: OOPS! found it on the single_object list, size=%d\n",
- obj->size);
- break;
- }
- }
- if (current == NULL) {
- current = cmem->head_mo_chunk;
- /* Find the chunk containing this object */
- for ( ; current != NULL; current = current->next) {
- if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size)) {
- dprintf1("chunk_free_obj: OOPS! found it on the multiple_object list, size=%d\n",
- obj->size);
- break;
- }
- }
- }
- if (current == NULL) {
- /* Object not found in any chunk */
- dprintf2("chunk_free_obj failed, object 0x%lx not in any chunk, size=%d\n", ((ulong)obj), obj->size);
+ /* finalize may change the head_**_chunk doing free of stuff */
+ current = IS_SINGLE_OBJ_SIZE(freed_size) ?
+ cmem->head_so_chunk : cmem->head_mo_chunk;
+ /* Find the chunk containing this object */
+ for ( ; current != NULL; current = current->next) {
+ if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size))
+ break;
+ }
+ if (current == NULL) {
+ /* We _may_have searched the wrong list -- if so find out. */
+ current = cmem->head_so_chunk;
+ /* Find the chunk containing this object */
+ for ( ; current != NULL; current = current->next) {
+ if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size)) {
+ dprintf1("chunk_free_obj: OOPS! found it on the single_object list, size=%d\n",
+ obj->size);
+ break;
+ }
+ }
+ if (current == NULL) {
+ current = cmem->head_mo_chunk;
+ /* Find the chunk containing this object */
+ for ( ; current != NULL; current = current->next) {
+ if (((byte *)obj > (byte *)current) && ((byte *)obj < (byte *)(current) + current->size)) {
+ dprintf1("chunk_free_obj: OOPS! found it on the multiple_object list, size=%d\n",
+ obj->size);
+ break;
+ }
+ }
+ }
+ if (current == NULL) {
+ /* Object not found in any chunk */
+ dprintf2("chunk_free_obj failed, object 0x%lx not in any chunk, size=%d\n", ((ulong)obj), obj->size);
#ifdef DEBUG
- cmem->in_use = 0; /* idle */
+ cmem->in_use = 0; /* idle */
#endif
- return;
- }
- }
- /* For large objects, they were given their own chunk -- just remove the node */
- if (IS_SINGLE_OBJ_SIZE(freed_size)) {
- chunk_mem_node_remove(cmem, current);
+ return;
+ }
+ }
+ /* For large objects, they were given their own chunk -- just remove the node */
+ if (IS_SINGLE_OBJ_SIZE(freed_size)) {
+ chunk_mem_node_remove(cmem, current);
#ifdef DEBUG
- cmem->in_use = 0; /* idle */
+ cmem->in_use = 0; /* idle */
#endif
- return;
- }
-
- /* Scan obj list to find this element */
- prev_obj = NULL; /* object is head, linked to mem node */
- for (scan_obj = current->objlist; scan_obj != NULL; scan_obj = scan_obj->next) {
- if (scan_obj == obj)
- break;
- prev_obj = scan_obj;
- }
- if (scan_obj == NULL) {
- /* Object not found in expected chunk */
- dprintf3("chunk_free_obj failed, object 0x%lx not in chunk at 0x%lx, size = %d\n",
- ((ulong)obj), ((ulong)current), current->size);
+ return;
+ }
+
+ /* Scan obj list to find this element */
+ prev_obj = NULL; /* object is head, linked to mem node */
+ for (scan_obj = current->objlist; scan_obj != NULL; scan_obj = scan_obj->next) {
+ if (scan_obj == obj)
+ break;
+ prev_obj = scan_obj;
+ }
+ if (scan_obj == NULL) {
+ /* Object not found in expected chunk */
+ dprintf3("chunk_free_obj failed, object 0x%lx not in chunk at 0x%lx, size = %d\n",
+ ((ulong)obj), ((ulong)current), current->size);
#ifdef DEBUG
- cmem->in_use = 0; /* idle */
+ cmem->in_use = 0; /* idle */
#endif
- return;
- }
- /* link around the object being freed */
- if (prev_obj == NULL)
- current->objlist = obj->next;
- else
- prev_obj->next = obj->next;
-
- if_debug3('A', "[a-]chunk_free_object(%s) 0x%lx(%u)\n",
- client_name_string(cname), (ulong) ptr, obj->size);
-
- /* Add this object's space (including the header) to the free list */
-
- /* Scan free list to find where this element goes */
- obj->size = freed_size; /* adjust size to include chunk_obj_node and pad */
-
- prev_free = NULL;
- for (free_obj = current->freelist; free_obj != NULL; free_obj = free_obj->next) {
- if (obj < free_obj)
- break;
- prev_free = free_obj;
- }
- if (prev_free == NULL) {
- /* this object is before any other free objects */
- obj->next = current->freelist;
- current->freelist = obj;
- } else {
- obj->next = free_obj;
- prev_free->next = obj;
- }
- /* If the end of this object is adjacent to the next free space,
- * merge the two. Next we'll merge with predecessor (prev_free)
- */
- if (free_obj != NULL) {
- byte *after_obj = (byte*)(obj) + freed_size;
-
- if (free_obj <= (chunk_obj_node_t *)after_obj) {
- /* Object is adjacent to following free space block -- merge it */
- obj->next = free_obj->next; /* link around the one being absorbed */
- obj->size = (byte *)(free_obj) - (byte *)(obj) + free_obj->size;
- }
- }
- /* the prev_free object precedes this object that is now free,
- * it _may_ be adjacent
- */
- if (prev_free != NULL) {
- byte *after_free = (byte*)(prev_free) + prev_free->size;
-
- if (obj <= (chunk_obj_node_t *)after_free) {
- /* Object is adjacent to prior free space block -- merge it */
- /* NB: this is the common case with LIFO alloc-free patterns */
- /* (LIFO: Last-allocated, first freed) */
- prev_free->size = (byte *)(obj) - (byte *)(prev_free) + obj->size;
- prev_free->next = obj->next; /* link around 'obj' area */
- obj = prev_free;
- }
- }
+ return;
+ }
+ /* link around the object being freed */
+ if (prev_obj == NULL)
+ current->objlist = obj->next;
+ else
+ prev_obj->next = obj->next;
+
+ if_debug3('A', "[a-]chunk_free_object(%s) 0x%lx(%u)\n",
+ client_name_string(cname), (ulong) ptr, obj->size);
+
+ /* Add this object's space (including the header) to the free list */
+
+ /* Scan free list to find where this element goes */
+ obj->size = freed_size; /* adjust size to include chunk_obj_node and pad */
+
+ prev_free = NULL;
+ for (free_obj = current->freelist; free_obj != NULL; free_obj = free_obj->next) {
+ if (obj < free_obj)
+ break;
+ prev_free = free_obj;
+ }
+ if (prev_free == NULL) {
+ /* this object is before any other free objects */
+ obj->next = current->freelist;
+ current->freelist = obj;
+ } else {
+ obj->next = free_obj;
+ prev_free->next = obj;
+ }
+ /* If the end of this object is adjacent to the next free space,
+ * merge the two. Next we'll merge with predecessor (prev_free)
+ */
+ if (free_obj != NULL) {
+ byte *after_obj = (byte*)(obj) + freed_size;
+
+ if (free_obj <= (chunk_obj_node_t *)after_obj) {
+ /* Object is adjacent to following free space block -- merge it */
+ obj->next = free_obj->next; /* link around the one being absorbed */
+ obj->size = (byte *)(free_obj) - (byte *)(obj) + free_obj->size;
+ }
+ }
+ /* the prev_free object precedes this object that is now free,
+ * it _may_ be adjacent
+ */
+ if (prev_free != NULL) {
+ byte *after_free = (byte*)(prev_free) + prev_free->size;
+
+ if (obj <= (chunk_obj_node_t *)after_free) {
+ /* Object is adjacent to prior free space block -- merge it */
+ /* NB: this is the common case with LIFO alloc-free patterns */
+ /* (LIFO: Last-allocated, first freed) */
+ prev_free->size = (byte *)(obj) - (byte *)(prev_free) + obj->size;
+ prev_free->next = obj->next; /* link around 'obj' area */
+ obj = prev_free;
+ }
+ }
#ifdef DEBUG
memset((byte *)(obj) + sizeof(chunk_obj_node_t), 0xf1, obj->size - sizeof(chunk_obj_node_t));
#endif
- if (current->largest_free < obj->size)
- current->largest_free = obj->size;
-
- /* If this chunk is now totally empty, free it */
- if (current->objlist == NULL) {
- if (current->size != current->freelist->size + sizeof(chunk_mem_node_t))
- dprintf2("chunk freelist size not correct, is: %d, should be: %d\n",
- round_up_to_align(current->freelist->size + sizeof(chunk_mem_node_t)), current->size);
- chunk_mem_node_remove(cmem, current);
- }
+ if (current->largest_free < obj->size)
+ current->largest_free = obj->size;
+
+ /* If this chunk is now totally empty, free it */
+ if (current->objlist == NULL) {
+ if (current->size != current->freelist->size + sizeof(chunk_mem_node_t))
+ dprintf2("chunk freelist size not correct, is: %d, should be: %d\n",
+ round_up_to_align(current->freelist->size + sizeof(chunk_mem_node_t)), current->size);
+ chunk_mem_node_remove(cmem, current);
+ }
#ifdef DEBUG
- cmem->in_use = 0; /* idle */
+ cmem->in_use = 0; /* idle */
#endif
}
}
@@ -754,7 +752,7 @@ chunk_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
static byte *
chunk_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
- client_name_t cname)
+ client_name_t cname)
{
/* just resize object - ignores old_num */
return chunk_resize_object(mem, data, new_num, cname);
@@ -762,7 +760,7 @@ chunk_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
static void
chunk_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
chunk_free_object(mem, data, cname);
}
@@ -778,8 +776,8 @@ chunk_status(gs_memory_t * mem, gs_memory_status_t * pstat)
pstat->allocated = cmem->used;
/* Scan all chunks for free space to calculate the actual amount 'used' */
for ( ; current != NULL; current = current->next) {
- for (free_obj = current->freelist; free_obj != NULL; free_obj=free_obj->next)
- tot_free += free_obj->size;
+ for (free_obj = current->freelist; free_obj != NULL; free_obj=free_obj->next)
+ tot_free += free_obj->size;
}
pstat->used = cmem->used - tot_free;
@@ -820,7 +818,7 @@ chunk_object_type(const gs_memory_t * mem, const void *ptr)
static int
chunk_register_root(gs_memory_t * mem, gs_gc_root_t * rp, gs_ptr_type_t ptype,
- void **up, client_name_t cname)
+ void **up, client_name_t cname)
{
return 0;
}
@@ -834,7 +832,7 @@ chunk_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp, client_name_t cname)
#define A(obj, size) \
if ((obj = gs_alloc_bytes(cmem, size, "chunk_alloc_unit_test")) == NULL) { \
- dprintf("chunk alloc failed\n"); \
+ dprintf("chunk alloc failed\n"); \
return_error(gs_error_VMerror); \
}
@@ -846,11 +844,11 @@ chunk_allocator_unit_test(gs_memory_t *mem)
{
int code;
gs_memory_t *cmem;
- byte *obj1, *obj2, *obj3, *obj4, *obj5, *obj6, *obj7;
+ byte *obj1, *obj2, *obj3, *obj4, *obj5, *obj6, *obj7;
if ((code = gs_memory_chunk_wrap(&cmem, mem )) < 0) {
- dprintf1("chunk_wrap returned error code: %d\n", code);
- return code;
+ dprintf1("chunk_wrap returned error code: %d\n", code);
+ return code;
}
/* Allocate a large object */
diff --git a/gs/base/gsmchunk.h b/gs/base/gsmchunk.h
index 23575c205..d45065b7f 100644
--- a/gs/base/gsmchunk.h
+++ b/gs/base/gsmchunk.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,9 +22,9 @@
/* ---------- Public constructors/destructors ---------- */
/* Initialize a gs_memory_chunk_t */
- /* -ve error code or 0 */
+ /* -ve error code or 0 */
int gs_memory_chunk_wrap(gs_memory_t **wrapped, /* chunk allocator init */
- gs_memory_t * target ); /* base allocator */
+ gs_memory_t * target ); /* base allocator */
/* Release a chunk memory manager and all of the memory it held */
void gs_memory_chunk_release(gs_memory_t *cmem);
diff --git a/gs/base/gsmdebug.h b/gs/base/gsmdebug.h
index 1c422ce3b..5c65fb260 100644
--- a/gs/base/gsmdebug.h
+++ b/gs/base/gsmdebug.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsmemlok.c b/gs/base/gsmemlok.c
index a357bf9c4..28114c081 100644
--- a/gs/base/gsmemlok.c
+++ b/gs/base/gsmemlok.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -83,8 +83,8 @@ static const gs_memory_procs_t locked_procs =
/* Initialize a gs_memory_locked_t */
int /* -ve error code or 0 */
gs_memory_locked_init(
- gs_memory_locked_t * lmem, /* allocator to init */
- gs_memory_t * target /* allocator to monitor lock */
+ gs_memory_locked_t * lmem, /* allocator to init */
+ gs_memory_t * target /* allocator to monitor lock */
)
{
lmem->stable_memory = 0;
@@ -92,7 +92,7 @@ gs_memory_locked_init(
lmem->target = target;
lmem->gs_lib_ctx = target->gs_lib_ctx;
lmem->non_gc_memory = (gs_memory_t *)lmem; /* WRONG: THIS IS QUESTIONABLE since this will not */
- /* be non_gc_memory if the target was a GC memory */
+ /* be non_gc_memory if the target was a GC memory */
lmem->thread_safe_memory = (gs_memory_t *)lmem; /* this allocator is thread safe */
/* Allocate a monitor to serialize access to structures within */
@@ -106,7 +106,7 @@ void
gs_memory_locked_release(gs_memory_locked_t *lmem)
{
gs_memory_free_all((gs_memory_t *)lmem, FREE_ALL_STRUCTURES,
- "gs_memory_locked_release");
+ "gs_memory_locked_release");
gx_monitor_free(lmem->monitor);
}
@@ -127,20 +127,20 @@ gs_memory_locked_target(const gs_memory_locked_t *lmem)
*/
#define DO_MONITORED(call_target)\
- gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;\
+ gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;\
\
- gx_monitor_enter(lmem->monitor);\
- call_target;\
- gx_monitor_leave(lmem->monitor)
+ gx_monitor_enter(lmem->monitor);\
+ call_target;\
+ gx_monitor_leave(lmem->monitor)
#define RETURN_MONITORED(result_type, call_target)\
- gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;\
- result_type temp;\
+ gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;\
+ result_type temp;\
\
- gx_monitor_enter(lmem->monitor);\
- temp = call_target;\
- gx_monitor_leave(lmem->monitor);\
- return temp
+ gx_monitor_enter(lmem->monitor);\
+ temp = call_target;\
+ gx_monitor_leave(lmem->monitor);\
+ return temp
/* Procedures */
static void
@@ -151,229 +151,229 @@ gs_locked_free_all(gs_memory_t * mem, uint free_mask, client_name_t cname)
/* Only free the structures and the allocator itself. */
if (mem->stable_memory) {
- if (mem->stable_memory != mem)
- gs_memory_free_all(mem->stable_memory, free_mask, cname);
- if (free_mask & FREE_ALL_ALLOCATOR)
- mem->stable_memory = 0;
+ if (mem->stable_memory != mem)
+ gs_memory_free_all(mem->stable_memory, free_mask, cname);
+ if (free_mask & FREE_ALL_ALLOCATOR)
+ mem->stable_memory = 0;
}
if (free_mask & FREE_ALL_STRUCTURES) {
- /*
- * Check for monitor == 0, in case this is called after a
- * failure during initialization.
- */
- if (lmem->monitor)
- gx_monitor_free(lmem->monitor);
- lmem->monitor = 0;
- lmem->target = 0;
+ /*
+ * Check for monitor == 0, in case this is called after a
+ * failure during initialization.
+ */
+ if (lmem->monitor)
+ gx_monitor_free(lmem->monitor);
+ lmem->monitor = 0;
+ lmem->target = 0;
}
if (free_mask & FREE_ALL_ALLOCATOR)
- gs_free_object(target, lmem, cname);
+ gs_free_object(target, lmem, cname);
}
static void
gs_locked_consolidate_free(gs_memory_t * mem)
{
DO_MONITORED(
- (*lmem->target->procs.consolidate_free)(lmem->target)
- );
+ (*lmem->target->procs.consolidate_free)(lmem->target)
+ );
}
static byte *
gs_locked_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_bytes)
- (lmem->target, size, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_bytes)
+ (lmem->target, size, cname)
+ );
}
static byte *
gs_locked_alloc_bytes_immovable(gs_memory_t * mem, uint size,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_bytes_immovable)
- (lmem->target, size, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_bytes_immovable)
+ (lmem->target, size, cname)
+ );
}
static void *
gs_locked_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_MONITORED(
- void *,
- (*lmem->target->procs.alloc_struct)
- (lmem->target, pstype, cname)
- );
+ void *,
+ (*lmem->target->procs.alloc_struct)
+ (lmem->target, pstype, cname)
+ );
}
static void *
gs_locked_alloc_struct_immovable(gs_memory_t * mem,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_MONITORED(
- void *,
- (*lmem->target->procs.alloc_struct_immovable)
- (lmem->target, pstype, cname)
- );
+ void *,
+ (*lmem->target->procs.alloc_struct_immovable)
+ (lmem->target, pstype, cname)
+ );
}
static byte *
gs_locked_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_byte_array)
- (lmem->target, num_elements, elt_size, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_byte_array)
+ (lmem->target, num_elements, elt_size, cname)
+ );
}
static byte *
gs_locked_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_byte_array_immovable)
- (lmem->target, num_elements, elt_size, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_byte_array_immovable)
+ (lmem->target, num_elements, elt_size, cname)
+ );
}
static void *
gs_locked_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_MONITORED(
- void *,
- (*lmem->target->procs.alloc_struct_array)
- (lmem->target, num_elements, pstype, cname)
- );
+ void *,
+ (*lmem->target->procs.alloc_struct_array)
+ (lmem->target, num_elements, pstype, cname)
+ );
}
static void *
gs_locked_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_MONITORED(
- void *,
- (*lmem->target->procs.alloc_struct_array_immovable)
- (lmem->target, num_elements, pstype, cname)
- );
+ void *,
+ (*lmem->target->procs.alloc_struct_array_immovable)
+ (lmem->target, num_elements, pstype, cname)
+ );
}
static void *
gs_locked_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_MONITORED(
- void *,
- (*lmem->target->procs.resize_object)
- (lmem->target, obj, new_num_elements, cname)
- );
+ void *,
+ (*lmem->target->procs.resize_object)
+ (lmem->target, obj, new_num_elements, cname)
+ );
}
static uint
gs_locked_object_size(gs_memory_t * mem, const void *ptr)
{
RETURN_MONITORED(
- uint,
- (*lmem->target->procs.object_size)
- (lmem->target, ptr)
- );
+ uint,
+ (*lmem->target->procs.object_size)
+ (lmem->target, ptr)
+ );
}
static gs_memory_type_ptr_t
gs_locked_object_type(const gs_memory_t * mem, const void *ptr)
{
RETURN_MONITORED(
- gs_memory_type_ptr_t,
- (*lmem->target->procs.object_type)
- (lmem->target, ptr)
- );
+ gs_memory_type_ptr_t,
+ (*lmem->target->procs.object_type)
+ (lmem->target, ptr)
+ );
}
static void
gs_locked_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
{
DO_MONITORED(
- (*lmem->target->procs.free_object)
- (lmem->target, ptr, cname)
- );
+ (*lmem->target->procs.free_object)
+ (lmem->target, ptr, cname)
+ );
}
static byte *
gs_locked_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_string)
- (lmem->target, nbytes, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_string)
+ (lmem->target, nbytes, cname)
+ );
}
static byte *
gs_locked_alloc_string_immovable(gs_memory_t * mem, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.alloc_string_immovable)
- (lmem->target, nbytes, cname)
- );
+ byte *,
+ (*lmem->target->procs.alloc_string_immovable)
+ (lmem->target, nbytes, cname)
+ );
}
static byte *
gs_locked_resize_string(gs_memory_t * mem, byte * data, uint old_num,
- uint new_num,
- client_name_t cname)
+ uint new_num,
+ client_name_t cname)
{
RETURN_MONITORED(
- byte *,
- (*lmem->target->procs.resize_string)
- (lmem->target, data, old_num, new_num, cname)
- );
+ byte *,
+ (*lmem->target->procs.resize_string)
+ (lmem->target, data, old_num, new_num, cname)
+ );
}
static void
gs_locked_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
DO_MONITORED(
- (*lmem->target->procs.free_string)
- (lmem->target, data, nbytes, cname)
- );
+ (*lmem->target->procs.free_string)
+ (lmem->target, data, nbytes, cname)
+ );
}
static int
gs_locked_register_root(gs_memory_t * mem, gs_gc_root_t * rp,
- gs_ptr_type_t ptype, void **up, client_name_t cname)
+ gs_ptr_type_t ptype, void **up, client_name_t cname)
{
RETURN_MONITORED(
- int,
- (*lmem->target->procs.register_root)
- (lmem->target, rp, ptype, up, cname)
- );
+ int,
+ (*lmem->target->procs.register_root)
+ (lmem->target, rp, ptype, up, cname)
+ );
}
static void
gs_locked_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp,
- client_name_t cname)
+ client_name_t cname)
{
DO_MONITORED(
- (*lmem->target->procs.unregister_root)
- (lmem->target, rp, cname)
- );
+ (*lmem->target->procs.unregister_root)
+ (lmem->target, rp, cname)
+ );
}
static gs_memory_t *
gs_locked_stable(gs_memory_t * mem)
{
if (!mem->stable_memory) {
- gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;
- gs_memory_t *stable;
+ gs_memory_locked_t * const lmem = (gs_memory_locked_t *)mem;
+ gs_memory_t *stable;
- gx_monitor_enter(lmem->monitor);
- stable = gs_memory_stable(lmem->target);
- if (stable == lmem->target)
- mem->stable_memory = mem;
- else {
- gs_memory_locked_t *locked_stable = (gs_memory_locked_t *)
- gs_alloc_bytes(stable, sizeof(*lmem), "gs_locked_stable");
+ gx_monitor_enter(lmem->monitor);
+ stable = gs_memory_stable(lmem->target);
+ if (stable == lmem->target)
+ mem->stable_memory = mem;
+ else {
+ gs_memory_locked_t *locked_stable = (gs_memory_locked_t *)
+ gs_alloc_bytes(stable, sizeof(*lmem), "gs_locked_stable");
- if (locked_stable) {
- int code = gs_memory_locked_init(locked_stable, stable);
+ if (locked_stable) {
+ int code = gs_memory_locked_init(locked_stable, stable);
- if (code < 0)
- gs_free_object(stable, locked_stable, "gs_locked_stable");
- else
- mem->stable_memory = (gs_memory_t *)locked_stable;
- }
- }
- gx_monitor_leave(lmem->monitor);
+ if (code < 0)
+ gs_free_object(stable, locked_stable, "gs_locked_stable");
+ else
+ mem->stable_memory = (gs_memory_t *)locked_stable;
+ }
+ }
+ gx_monitor_leave(lmem->monitor);
}
return mem->stable_memory;
}
@@ -381,14 +381,14 @@ static void
gs_locked_status(gs_memory_t * mem, gs_memory_status_t * pstat)
{
DO_MONITORED(
- (*lmem->target->procs.status)(lmem->target, pstat)
- );
+ (*lmem->target->procs.status)(lmem->target, pstat)
+ );
pstat->is_thread_safe = true; /* the monitor (mutex) makes this thread safe */
}
static void
gs_locked_enable_free(gs_memory_t * mem, bool enable)
{
DO_MONITORED(
- (*lmem->target->procs.enable_free)(lmem->target, enable)
- );
+ (*lmem->target->procs.enable_free)(lmem->target, enable)
+ );
}
diff --git a/gs/base/gsmemlok.h b/gs/base/gsmemlok.h
index 7cd610d56..287341b8b 100644
--- a/gs/base/gsmemlok.h
+++ b/gs/base/gsmemlok.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,9 +38,9 @@ typedef struct gs_memory_locked_s {
/* Initialize a locked memory manager. */
int gs_memory_locked_init(
- gs_memory_locked_t * lmem, /* allocator to init */
- gs_memory_t * target /* allocator to monitor lock */
- );
+ gs_memory_locked_t * lmem, /* allocator to init */
+ gs_memory_t * target /* allocator to monitor lock */
+ );
/* Release a locked memory manager. */
/* Note that this has no effect on the target. */
diff --git a/gs/base/gsmemory.c b/gs/base/gsmemory.c
index 621b67c27..3c9e8278d 100644
--- a/gs/base/gsmemory.c
+++ b/gs/base/gsmemory.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,25 +56,25 @@ void
reloc_bytestring(gs_bytestring *pbs, gc_state_t *gcst)
{
if (pbs->bytes) {
- byte *bytes = pbs->bytes;
- long offset = pbs->data - bytes;
+ byte *bytes = pbs->bytes;
+ long offset = pbs->data - bytes;
- pbs->bytes = bytes = RELOC_OBJ(bytes);
- pbs->data = bytes + offset;
+ pbs->bytes = bytes = RELOC_OBJ(bytes);
+ pbs->data = bytes + offset;
} else
- RELOC_STRING_VAR(*(gs_string *)pbs);
+ RELOC_STRING_VAR(*(gs_string *)pbs);
}
void
reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst)
{
if (pbs->bytes) {
- const byte *bytes = pbs->bytes;
- long offset = pbs->data - bytes;
+ const byte *bytes = pbs->bytes;
+ long offset = pbs->data - bytes;
- pbs->bytes = bytes = RELOC_OBJ(bytes);
- pbs->data = bytes + offset;
+ pbs->bytes = bytes = RELOC_OBJ(bytes);
+ pbs->data = bytes + offset;
} else
- RELOC_CONST_STRING_VAR(*(gs_const_string *)pbs);
+ RELOC_CONST_STRING_VAR(*(gs_const_string *)pbs);
}
/* Fill an unoccupied block with a pattern. */
@@ -87,8 +87,8 @@ gs_alloc_memset(void *ptr, int /*byte */ fill, ulong lsize)
int isize;
for (; msize; msize -= isize, p += isize) {
- isize = min(msize, max_int);
- memset(p, fill, isize);
+ isize = min(msize, max_int);
+ memset(p, fill, isize);
}
}
@@ -98,30 +98,29 @@ gs_alloc_memset(void *ptr, int /*byte */ fill, ulong lsize)
*/
void *
gs_resize_struct_array(gs_memory_t *mem, void *obj, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
if (obj == 0)
- return gs_alloc_struct_array(mem, num_elements, void, pstype, cname);
+ return gs_alloc_struct_array(mem, num_elements, void, pstype, cname);
#ifdef DEBUG
if (gs_object_type(mem, obj) != pstype) {
- lprintf3("resize_struct_array 0x%lx, type was 0x%lx, expected 0x%lx!\n",
- (ulong)obj, (ulong)gs_object_type(mem, obj), (ulong)pstype);
- return 0;
+ lprintf3("resize_struct_array 0x%lx, type was 0x%lx, expected 0x%lx!\n",
+ (ulong)obj, (ulong)gs_object_type(mem, obj), (ulong)pstype);
+ return 0;
}
#endif
return gs_resize_object(mem, obj, num_elements, cname);
}
-
/* Allocate a structure using a "raw memory" allocator.
- * really just an alias for gs_alloc_struct_immovable
- * with the clients false expectation that it is saving memory
+ * really just an alias for gs_alloc_struct_immovable
+ * with the clients false expectation that it is saving memory
*/
-
+
void *
gs_raw_alloc_struct_immovable(gs_memory_t * rmem,
- gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ gs_memory_type_ptr_t pstype,
+ client_name_t cname)
{
return gs_alloc_bytes_immovable(rmem, gs_struct_type_size(pstype), cname);
}
@@ -133,7 +132,7 @@ gs_ignore_free_object(gs_memory_t * mem, void *data, client_name_t cname)
}
void
gs_ignore_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
}
@@ -149,7 +148,7 @@ gs_free_const_object(gs_memory_t * mem, const void *data, client_name_t cname)
}
void
gs_free_const_string(gs_memory_t * mem, const byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
union { const byte *r; byte *w; } u;
@@ -162,18 +161,18 @@ void
gs_free_bytestring(gs_memory_t *mem, gs_bytestring *pbs, client_name_t cname)
{
if (pbs->bytes)
- gs_free_object(mem, pbs->bytes, cname);
+ gs_free_object(mem, pbs->bytes, cname);
else
- gs_free_string(mem, pbs->data, pbs->size, cname);
+ gs_free_string(mem, pbs->data, pbs->size, cname);
}
void
gs_free_const_bytestring(gs_memory_t *mem, gs_const_bytestring *pbs,
- client_name_t cname)
+ client_name_t cname)
{
if (pbs->bytes)
- gs_free_const_object(mem, pbs->bytes, cname);
+ gs_free_const_object(mem, pbs->bytes, cname);
else
- gs_free_const_string(mem, pbs->data, pbs->size, cname);
+ gs_free_const_string(mem, pbs->data, pbs->size, cname);
}
/* No-op consolidation procedure */
@@ -212,7 +211,7 @@ gs_struct_type_name(gs_memory_type_ptr_t pstype)
/* Register a structure root. */
int
gs_register_struct_root(gs_memory_t *mem, gs_gc_root_t *root,
- void **pp, client_name_t cname)
+ void **pp, client_name_t cname)
{
return gs_register_root(mem, root, ptr_struct_type, pp, cname);
}
@@ -227,21 +226,21 @@ rc_object_type_name(const void *vp, const rc_header *prc)
gs_memory_type_ptr_t pstype;
if (prc->memory == 0)
- return "(unknown)";
+ return "(unknown)";
pstype = gs_object_type(prc->memory, vp);
if (prc->free != rc_free_struct_only) {
- /*
- * This object might be stack-allocated or have other unusual memory
- * management properties. Make some reasonableness checks.
- * ****** THIS IS A HACK. ******
- */
- long dist;
-
- dist = (const char *)&dist - (const char *)vp;
- if (dist < 10000 && dist > -10000)
- return "(on stack)";
- if ((ulong)pstype < 0x10000 || (long)pstype < 0)
- return "(anomalous)";
+ /*
+ * This object might be stack-allocated or have other unusual memory
+ * management properties. Make some reasonableness checks.
+ * ****** THIS IS A HACK. ******
+ */
+ long dist;
+
+ dist = (const char *)&dist - (const char *)vp;
+ if (dist < 10000 && dist > -10000)
+ return "(on stack)";
+ if ((ulong)pstype < 0x10000 || (long)pstype < 0)
+ return "(anomalous)";
}
return client_name_string(gs_struct_type_name(pstype));
}
@@ -251,28 +250,28 @@ void
rc_trace_init_free(const void *vp, const rc_header *prc)
{
dprintf3("[^]%s 0x%lx init = %ld\n",
- rc_object_type_name(vp, prc), (ulong)vp, (long)prc->ref_count);
+ rc_object_type_name(vp, prc), (ulong)vp, (long)prc->ref_count);
}
void
rc_trace_free_struct(const void *vp, const rc_header *prc, client_name_t cname)
{
dprintf3("[^]%s 0x%lx => free (%s)\n",
- rc_object_type_name(vp, prc),
- (ulong)vp, client_name_string(cname));
+ rc_object_type_name(vp, prc),
+ (ulong)vp, client_name_string(cname));
}
void
rc_trace_increment(const void *vp, const rc_header *prc)
{
dprintf3("[^]%s 0x%lx ++ => %ld\n",
- rc_object_type_name(vp, prc),
- (ulong)vp, (long)prc->ref_count);
+ rc_object_type_name(vp, prc),
+ (ulong)vp, (long)prc->ref_count);
}
void
rc_trace_adjust(const void *vp, const rc_header *prc, int delta)
{
dprintf4("[^]%s 0x%lx %+d => %ld\n",
- rc_object_type_name(vp, prc),
- (ulong)vp, delta, (long)(prc->ref_count + delta));
+ rc_object_type_name(vp, prc),
+ (ulong)vp, delta, (long)(prc->ref_count + delta));
}
#endif /* DEBUG */
@@ -282,7 +281,7 @@ void
rc_free_struct_only(gs_memory_t * mem, void *data, client_name_t cname)
{
if (mem != 0)
- gs_free_object(mem, data, cname);
+ gs_free_object(mem, data, cname);
}
/* ---------------- Basic-structure GC procedures ---------------- */
@@ -296,38 +295,38 @@ ENUM_PTRS_BEGIN_PROC(basic_enum_ptrs)
/* with number of elements 0 and allocation not passing 'element' */
if (size == 0) {
#ifdef DEBUG
- dprintf2(" basic_enum_ptrs: Attempt to enum 0 size structure at 0x%lx, type: %s\n",
- (ulong)vptr, pstype->sname);
+ dprintf2(" basic_enum_ptrs: Attempt to enum 0 size structure at 0x%lx, type: %s\n",
+ (ulong)vptr, pstype->sname);
#endif
- return 0;
+ return 0;
}
if (index < psd->num_ptrs) {
- const gc_ptr_element_t *ppe = &psd->ptrs[index];
- EV_CONST char *pptr = (EV_CONST char *)vptr + ppe->offset;
+ const gc_ptr_element_t *ppe = &psd->ptrs[index];
+ EV_CONST char *pptr = (EV_CONST char *)vptr + ppe->offset;
#ifdef DEBUG
- /* some extra checking to make sure we aren't out of bounds */
- if (ppe->offset > size - sizeof(void *)) {
- dprintf4(" basic_enum_ptrs: Attempt to enum ptr with offset=%d beyond size=%d: structure at 0x%lx, type: %s\n",
- ppe->offset, size, (ulong)vptr, pstype->sname);
- return 0;
- }
+ /* some extra checking to make sure we aren't out of bounds */
+ if (ppe->offset > size - sizeof(void *)) {
+ dprintf4(" basic_enum_ptrs: Attempt to enum ptr with offset=%d beyond size=%d: structure at 0x%lx, type: %s\n",
+ ppe->offset, size, (ulong)vptr, pstype->sname);
+ return 0;
+ }
#endif
- switch ((gc_ptr_type_index_t)ppe->type) {
- case GC_ELT_OBJ:
- return ENUM_OBJ(*(const void *EV_CONST *)pptr);
- case GC_ELT_STRING:
- return ENUM_STRING((const gs_string *)pptr);
- case GC_ELT_CONST_STRING:
- return ENUM_CONST_STRING((const gs_const_string *)pptr);
- }
+ switch ((gc_ptr_type_index_t)ppe->type) {
+ case GC_ELT_OBJ:
+ return ENUM_OBJ(*(const void *EV_CONST *)pptr);
+ case GC_ELT_STRING:
+ return ENUM_STRING((const gs_string *)pptr);
+ case GC_ELT_CONST_STRING:
+ return ENUM_CONST_STRING((const gs_const_string *)pptr);
+ }
}
if (!psd->super_type)
- return 0;
+ return 0;
return ENUM_USING(*(psd->super_type),
- (EV_CONST void *)
- ((EV_CONST char *)vptr + psd->super_offset),
- pstype->ssize, index - psd->num_ptrs);
+ (EV_CONST void *)
+ ((EV_CONST char *)vptr + psd->super_offset),
+ pstype->ssize, index - psd->num_ptrs);
}
ENUM_PTRS_END_PROC
@@ -338,23 +337,23 @@ RELOC_PTRS_BEGIN(basic_reloc_ptrs)
uint i;
for (i = 0; i < psd->num_ptrs; ++i) {
- const gc_ptr_element_t *ppe = &psd->ptrs[i];
- char *pptr = (char *)vptr + ppe->offset;
-
- switch ((gc_ptr_type_index_t) ppe->type) {
- case GC_ELT_OBJ:
- RELOC_OBJ_VAR(*(void **)pptr);
- break;
- case GC_ELT_STRING:
- RELOC_STRING_VAR(*(gs_string *)pptr);
- break;
- case GC_ELT_CONST_STRING:
- RELOC_CONST_STRING_VAR(*(gs_const_string *)pptr);
- break;
- }
+ const gc_ptr_element_t *ppe = &psd->ptrs[i];
+ char *pptr = (char *)vptr + ppe->offset;
+
+ switch ((gc_ptr_type_index_t) ppe->type) {
+ case GC_ELT_OBJ:
+ RELOC_OBJ_VAR(*(void **)pptr);
+ break;
+ case GC_ELT_STRING:
+ RELOC_STRING_VAR(*(gs_string *)pptr);
+ break;
+ case GC_ELT_CONST_STRING:
+ RELOC_CONST_STRING_VAR(*(gs_const_string *)pptr);
+ break;
+ }
}
if (psd->super_type)
- RELOC_USING(*(psd->super_type),
- (void *)((char *)vptr + psd->super_offset),
- pstype->ssize);
+ RELOC_USING(*(psd->super_type),
+ (void *)((char *)vptr + psd->super_offset),
+ pstype->ssize);
} RELOC_PTRS_END
diff --git a/gs/base/gsmemory.h b/gs/base/gsmemory.h
index fb34c13cd..7462d9bf9 100644
--- a/gs/base/gsmemory.h
+++ b/gs/base/gsmemory.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -58,7 +58,7 @@ typedef const gs_ptr_procs_t *gs_ptr_type_t;
/* Define the opaque type for a GC root. */
typedef struct gs_gc_root_s gs_gc_root_t;
- /* Accessors for structure types. */
+ /* Accessors for structure types. */
typedef client_name_t struct_name_t;
@@ -90,14 +90,14 @@ typedef struct gs_memory_status_s {
bool is_thread_safe;
} gs_memory_status_t;
- /*
- * Allocate bytes. The bytes are always aligned maximally
- * if the processor requires alignment.
- *
- * Note that the object memory level can allocate bytes as
- * either movable or immovable: raw memory blocks are
- * always immovable.
- */
+ /*
+ * Allocate bytes. The bytes are always aligned maximally
+ * if the processor requires alignment.
+ *
+ * Note that the object memory level can allocate bytes as
+ * either movable or immovable: raw memory blocks are
+ * always immovable.
+ */
#define gs_memory_t_proc_alloc_bytes(proc, mem_t)\
byte *proc(mem_t *mem, uint nbytes, client_name_t cname)
@@ -105,29 +105,29 @@ typedef struct gs_memory_status_s {
#define gs_alloc_bytes_immovable(mem, nbytes, cname)\
((mem)->procs.alloc_bytes_immovable(mem, nbytes, cname))
- /*
- * Resize an object to a new number of elements. At the raw
- * memory level, the "element" is a byte; for object memory
- * (gsmemory.h), the object may be an an array of either
- * bytes or structures. The new size may be larger than,
- * the same as, or smaller than the old. If the new size is
- * the same as the old, resize_object returns the same
- * object; otherwise, it preserves the first min(old_size,
- * new_size) bytes of the object's contents.
- */
+ /*
+ * Resize an object to a new number of elements. At the raw
+ * memory level, the "element" is a byte; for object memory
+ * (gsmemory.h), the object may be an an array of either
+ * bytes or structures. The new size may be larger than,
+ * the same as, or smaller than the old. If the new size is
+ * the same as the old, resize_object returns the same
+ * object; otherwise, it preserves the first min(old_size,
+ * new_size) bytes of the object's contents.
+ */
#define gs_memory_t_proc_resize_object(proc, mem_t)\
void *proc(mem_t *mem, void *obj, uint new_num_elements,\
- client_name_t cname)
+ client_name_t cname)
#define gs_resize_object(mem, obj, newn, cname)\
((mem)->procs.resize_object(mem, obj, newn, cname))
- /*
- * Free an object (at the object memory level, this includes
- * everything except strings). Note: data == 0 must be
- * allowed, and must be a no-op.
- */
+ /*
+ * Free an object (at the object memory level, this includes
+ * everything except strings). Note: data == 0 must be
+ * allowed, and must be a no-op.
+ */
#define gs_memory_t_proc_free_object(proc, mem_t)\
void proc(mem_t *mem, void *data, client_name_t cname)
@@ -135,9 +135,9 @@ typedef struct gs_memory_status_s {
#define gs_free_object(mem, data, cname)\
((mem)->procs.free_object(mem, data, cname))
- /*
- * Report status (assigned, used).
- */
+ /*
+ * Report status (assigned, used).
+ */
#define gs_memory_t_proc_status(proc, mem_t)\
void proc(mem_t *mem, gs_memory_status_t *status)
@@ -145,16 +145,16 @@ typedef struct gs_memory_status_s {
#define gs_memory_status(mem, pst)\
((mem)->procs.status(mem, pst))
- /*
- * Return the stable allocator for this allocator. The
- * stable allocator allocates from the same heap and in
- * the same VM space, but is not subject to save and restore.
- * (It is the client's responsibility to avoid creating
- * dangling pointers.)
- *
- * Note that the stable allocator may be the same allocator
- * as this one.
- */
+ /*
+ * Return the stable allocator for this allocator. The
+ * stable allocator allocates from the same heap and in
+ * the same VM space, but is not subject to save and restore.
+ * (It is the client's responsibility to avoid creating
+ * dangling pointers.)
+ *
+ * Note that the stable allocator may be the same allocator
+ * as this one.
+ */
#define gs_memory_t_proc_stable(proc, mem_t)\
mem_t *proc(mem_t *mem)
@@ -162,16 +162,16 @@ typedef struct gs_memory_status_s {
#define gs_memory_stable(mem)\
((mem)->procs.stable(mem))
- /*
- * Free one or more of: data memory acquired by the allocator
- * (FREE_ALL_DATA), overhead structures other than the
- * allocator itself (FREE_ALL_STRUCTURES), and the allocator
- * itself (FREE_ALL_ALLOCATOR). Note that this requires
- * allocators to keep track of all the memory they have ever
- * acquired, and where they acquired it. Note that this
- * operation propagates to the stable allocator (if
- * different).
- */
+ /*
+ * Free one or more of: data memory acquired by the allocator
+ * (FREE_ALL_DATA), overhead structures other than the
+ * allocator itself (FREE_ALL_STRUCTURES), and the allocator
+ * itself (FREE_ALL_ALLOCATOR). Note that this requires
+ * allocators to keep track of all the memory they have ever
+ * acquired, and where they acquired it. Note that this
+ * operation propagates to the stable allocator (if
+ * different).
+ */
#define FREE_ALL_DATA 1
#define FREE_ALL_STRUCTURES 2
@@ -188,11 +188,11 @@ typedef struct gs_memory_status_s {
#define gs_free_all(mem)\
gs_memory_free_all(mem, FREE_ALL_DATA, "(free_all)")
- /*
- * Consolidate free space. This may be used as part of (or
- * as an alternative to) garbage collection, or before
- * giving up on an attempt to allocate.
- */
+ /*
+ * Consolidate free space. This may be used as part of (or
+ * as an alternative to) garbage collection, or before
+ * giving up on an attempt to allocate.
+ */
#define gs_memory_t_proc_consolidate_free(proc, mem_t)\
void proc(mem_t *mem)
@@ -210,20 +210,12 @@ typedef struct gs_memory_status_s {
gs_memory_t_proc_free_all((*free_all), mem_t);\
gs_memory_t_proc_consolidate_free((*consolidate_free), mem_t)
-
-
-
-
-
-
-
-
/*
* Define the memory manager procedural interface.
*/
typedef struct gs_memory_procs_s {
- gs_raw_memory_procs(gs_memory_t);
+ gs_raw_memory_procs(gs_memory_t);
/* Redefine inherited procedures with the new allocator type. */
@@ -400,30 +392,30 @@ typedef struct gs_memory_procs_s {
* because it is const for all ordinary clients.
*/
void gs_free_const_object(gs_memory_t *mem, const void *data,
- client_name_t cname);
+ client_name_t cname);
void gs_free_const_string(gs_memory_t *mem, const byte *data, uint nbytes,
- client_name_t cname);
+ client_name_t cname);
/*
* Free a [const] bytestring. Note that this is *not* a member procedure of
* the allocator: it calls the free_object or free_string procedure.
*/
void gs_free_bytestring(gs_memory_t *mem, gs_bytestring *pbs,
- client_name_t cname);
+ client_name_t cname);
void gs_free_const_bytestring(gs_memory_t *mem, gs_const_bytestring *pbs,
- client_name_t cname);
+ client_name_t cname);
/*
* Either allocate (if obj == 0) or resize (if obj != 0) a structure array.
* If obj != 0, pstype is used only for checking (in DEBUG configurations).
*/
void *gs_resize_struct_array(gs_memory_t *mem, void *obj, uint num_elements,
- gs_memory_type_ptr_t pstype,
- client_name_t cname);
+ gs_memory_type_ptr_t pstype,
+ client_name_t cname);
/* Register a structure root. This just calls gs_register_root. */
int gs_register_struct_root(gs_memory_t *mem, gs_gc_root_t *root,
- void **pp, client_name_t cname);
+ void **pp, client_name_t cname);
/* Define no-op freeing procedures for use by enable_free. */
gs_memory_proc_free_object(gs_ignore_free_object);
@@ -439,8 +431,8 @@ gs_memory_proc_consolidate_free(gs_ignore_consolidate_free);
* parameter.
*/
void *gs_raw_alloc_struct_immovable(gs_memory_t * rmem,
- gs_memory_type_ptr_t pstype,
- client_name_t cname);
+ gs_memory_type_ptr_t pstype,
+ client_name_t cname);
typedef struct pl_mem_node_s pl_mem_node_t;
@@ -449,22 +441,22 @@ typedef struct pl_mem_node_s pl_mem_node_t;
* Subclasses may have state as well
*
* stable_memory: no save or restore, maybe gc-ed
- * non-gc allocators stable_memory == this
+ * non-gc allocators stable_memory == this
*
- * gs_lib_ctx: pointer to a library context
+ * gs_lib_ctx: pointer to a library context
*
* non_gc_memory: a garabge collecting allocator requires a "parent" who doesn't gc
- * non-gc allocators non_gc_memory == this
+ * non-gc allocators non_gc_memory == this
*
* thread_safe_memory: use with multiple threads must provide for a thread safe allocator
- * that will most likely use a monitor (mutex) to serialize actions.
+ * that will most likely use a monitor (mutex) to serialize actions.
*/
#define gs_memory_common\
- gs_memory_t *stable_memory;\
- gs_memory_procs_t procs;\
+ gs_memory_t *stable_memory;\
+ gs_memory_procs_t procs;\
gs_lib_ctx_t *gs_lib_ctx;\
gs_memory_t *non_gc_memory;\
- gs_memory_t *thread_safe_memory
+ gs_memory_t *thread_safe_memory
struct gs_memory_s {
gs_memory_common;
diff --git a/gs/base/gsmemraw.h b/gs/base/gsmemraw.h
index 7783360ff..0ea7f7eb3 100644
--- a/gs/base/gsmemraw.h
+++ b/gs/base/gsmemraw.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,13 +22,12 @@
#if 0
-/* gsmemraw was an abstract base class.
- * it is no longer in use, instead use the concrete base class is gs_memory_t
+/* gsmemraw was an abstract base class.
+ * it is no longer in use, instead use the concrete base class is gs_memory_t
* since gs_memory_t contains interfaces that must be availiable throughout the system
* is is unadvisable to have a class below it without these.
*/
-
/*
* This interface provides minimal memory allocation and freeing capability.
* It is meant to be used for "wholesale" allocation of blocks -- typically,
@@ -95,14 +94,14 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
* actual alignment of the data in memory.
*/
- /*
- * Allocate bytes. The bytes are always aligned maximally
- * if the processor requires alignment.
- *
- * Note that the object memory level can allocate bytes as
- * either movable or immovable: raw memory blocks are
- * always immovable.
- */
+ /*
+ * Allocate bytes. The bytes are always aligned maximally
+ * if the processor requires alignment.
+ *
+ * Note that the object memory level can allocate bytes as
+ * either movable or immovable: raw memory blocks are
+ * always immovable.
+ */
#define gs_memory_t_proc_alloc_bytes(proc, mem_t)\
byte *proc(mem_t *mem, uint nbytes, client_name_t cname)
@@ -110,29 +109,29 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
#define gs_alloc_bytes_immovable(mem, nbytes, cname)\
((mem)->procs.alloc_bytes_immovable(mem, nbytes, cname))
- /*
- * Resize an object to a new number of elements. At the raw
- * memory level, the "element" is a byte; for object memory
- * (gsmemory.h), the object may be an an array of either
- * bytes or structures. The new size may be larger than,
- * the same as, or smaller than the old. If the new size is
- * the same as the old, resize_object returns the same
- * object; otherwise, it preserves the first min(old_size,
- * new_size) bytes of the object's contents.
- */
+ /*
+ * Resize an object to a new number of elements. At the raw
+ * memory level, the "element" is a byte; for object memory
+ * (gsmemory.h), the object may be an an array of either
+ * bytes or structures. The new size may be larger than,
+ * the same as, or smaller than the old. If the new size is
+ * the same as the old, resize_object returns the same
+ * object; otherwise, it preserves the first min(old_size,
+ * new_size) bytes of the object's contents.
+ */
#define gs_memory_t_proc_resize_object(proc, mem_t)\
void *proc(mem_t *mem, void *obj, uint new_num_elements,\
- client_name_t cname)
+ client_name_t cname)
#define gs_resize_object(mem, obj, newn, cname)\
((mem)->procs.resize_object(mem, obj, newn, cname))
- /*
- * Free an object (at the object memory level, this includes
- * everything except strings). Note: data == 0 must be
- * allowed, and must be a no-op.
- */
+ /*
+ * Free an object (at the object memory level, this includes
+ * everything except strings). Note: data == 0 must be
+ * allowed, and must be a no-op.
+ */
#define gs_memory_t_proc_free_object(proc, mem_t)\
void proc(mem_t *mem, void *data, client_name_t cname)
@@ -140,9 +139,9 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
#define gs_free_object(mem, data, cname)\
((mem)->procs.free_object(mem, data, cname))
- /*
- * Report status (assigned, used).
- */
+ /*
+ * Report status (assigned, used).
+ */
#define gs_memory_t_proc_status(proc, mem_t)\
void proc(mem_t *mem, gs_memory_status_t *status)
@@ -150,16 +149,16 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
#define gs_memory_status(mem, pst)\
((mem)->procs.status(mem, pst))
- /*
- * Return the stable allocator for this allocator. The
- * stable allocator allocates from the same heap and in
- * the same VM space, but is not subject to save and restore.
- * (It is the client's responsibility to avoid creating
- * dangling pointers.)
- *
- * Note that the stable allocator may be the same allocator
- * as this one.
- */
+ /*
+ * Return the stable allocator for this allocator. The
+ * stable allocator allocates from the same heap and in
+ * the same VM space, but is not subject to save and restore.
+ * (It is the client's responsibility to avoid creating
+ * dangling pointers.)
+ *
+ * Note that the stable allocator may be the same allocator
+ * as this one.
+ */
#define gs_memory_t_proc_stable(proc, mem_t)\
mem_t *proc(mem_t *mem)
@@ -167,16 +166,16 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
#define gs_memory_stable(mem)\
((mem)->procs.stable(mem))
- /*
- * Free one or more of: data memory acquired by the allocator
- * (FREE_ALL_DATA), overhead structures other than the
- * allocator itself (FREE_ALL_STRUCTURES), and the allocator
- * itself (FREE_ALL_ALLOCATOR). Note that this requires
- * allocators to keep track of all the memory they have ever
- * acquired, and where they acquired it. Note that this
- * operation propagates to the stable allocator (if
- * different).
- */
+ /*
+ * Free one or more of: data memory acquired by the allocator
+ * (FREE_ALL_DATA), overhead structures other than the
+ * allocator itself (FREE_ALL_STRUCTURES), and the allocator
+ * itself (FREE_ALL_ALLOCATOR). Note that this requires
+ * allocators to keep track of all the memory they have ever
+ * acquired, and where they acquired it. Note that this
+ * operation propagates to the stable allocator (if
+ * different).
+ */
#define FREE_ALL_DATA 1
#define FREE_ALL_STRUCTURES 2
@@ -193,11 +192,11 @@ typedef struct gs_raw_memory_s gs_raw_memory_t;
#define gs_free_all(mem)\
gs_memory_free_all(mem, FREE_ALL_DATA, "(free_all)")
- /*
- * Consolidate free space. This may be used as part of (or
- * as an alternative to) garbage collection, or before
- * giving up on an attempt to allocate.
- */
+ /*
+ * Consolidate free space. This may be used as part of (or
+ * as an alternative to) garbage collection, or before
+ * giving up on an attempt to allocate.
+ */
#define gs_memory_t_proc_consolidate_free(proc, mem_t)\
void proc(mem_t *mem)
@@ -223,11 +222,9 @@ typedef struct gs_raw_memory_procs_s {
gs_raw_memory_procs(gs_raw_memory_t);
} gs_raw_memory_procs_t;
-
-
struct gs_raw_memory_s {
gs_raw_memory_t *stable_memory; /* cache the stable allocator */
- gs_raw_memory_procs_t procs;
+ gs_raw_memory_procs_t procs;
};
#endif /* 0 */
diff --git a/gs/base/gsmemret.c b/gs/base/gsmemret.c
index c53a09fb2..9a9db5b7c 100644
--- a/gs/base/gsmemret.c
+++ b/gs/base/gsmemret.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -84,8 +84,8 @@ no_recover_proc(gs_memory_retrying_t *rmem, void *proc_data)
/* Initialize a gs_memory_retrying_t */
int /* -ve error code or 0 */
gs_memory_retrying_init(
- gs_memory_retrying_t * rmem, /* allocator to init */
- gs_memory_t * target /* allocator to wrap */
+ gs_memory_retrying_t * rmem, /* allocator to init */
+ gs_memory_t * target /* allocator to wrap */
)
{
rmem->stable_memory = 0;
@@ -93,7 +93,7 @@ gs_memory_retrying_init(
rmem->target = target;
rmem->gs_lib_ctx = target->gs_lib_ctx;
rmem->non_gc_memory = (gs_memory_t *)rmem; /* WRONG: not necessarily non_gc since */
- /* the target may be GC memory */
+ /* the target may be GC memory */
rmem->thread_safe_memory = (gs_memory_t *)target->thread_safe_memory; /* WRONG: this won't retry */
gs_memory_retrying_set_recover(rmem, no_recover_proc, NULL);
return 0;
@@ -102,8 +102,8 @@ gs_memory_retrying_init(
/* Set the recovery closure of a retrying memory manager. */
void
gs_memory_retrying_set_recover(gs_memory_retrying_t *rmem,
- gs_memory_recover_proc_t recover_proc,
- void *recover_proc_data)
+ gs_memory_recover_proc_t recover_proc,
+ void *recover_proc_data)
{
rmem->recover_proc = recover_proc;
rmem->recover_proc_data = recover_proc_data;
@@ -115,7 +115,7 @@ void
gs_memory_retrying_release(gs_memory_retrying_t *rmem)
{
gs_memory_free_all((gs_memory_t *)rmem, FREE_ALL_STRUCTURES,
- "gs_memory_retrying_release");
+ "gs_memory_retrying_release");
}
/* ---------- Accessors ------------- */
@@ -135,24 +135,24 @@ gs_memory_retrying_target(const gs_memory_retrying_t *rmem)
*/
#define DO_FORWARD(call_target)\
- gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;\
- gs_memory_t *const target = rmem->target;\
+ gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;\
+ gs_memory_t *const target = rmem->target;\
\
- call_target
+ call_target
#define RETURN_RETRYING(result_type, call_target)\
- gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;\
- gs_memory_t *const target = rmem->target;\
- result_type temp;\
- gs_memory_recover_status_t retry = RECOVER_STATUS_RETRY_OK;\
+ gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;\
+ gs_memory_t *const target = rmem->target;\
+ result_type temp;\
+ gs_memory_recover_status_t retry = RECOVER_STATUS_RETRY_OK;\
\
- for (;;) {\
- temp = call_target;\
- if (temp != 0 || retry != RECOVER_STATUS_RETRY_OK)\
- break;\
- retry = rmem->recover_proc(rmem, rmem->recover_proc_data);\
- }\
- return temp
+ for (;;) {\
+ temp = call_target;\
+ if (temp != 0 || retry != RECOVER_STATUS_RETRY_OK)\
+ break;\
+ retry = rmem->recover_proc(rmem, rmem->recover_proc_data);\
+ }\
+ return temp
/* Procedures */
static void
@@ -164,7 +164,7 @@ gs_forward_free_all(gs_memory_t * mem, uint free_mask, client_name_t cname)
/* Only free the structures and the allocator itself. */
rmem->target = 0;
if (free_mask & FREE_ALL_ALLOCATOR)
- gs_free_object(target, rmem, cname);
+ gs_free_object(target, rmem, cname);
}
static void
gs_forward_consolidate_free(gs_memory_t * mem)
@@ -175,88 +175,88 @@ static byte *
gs_retrying_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_bytes(target, size, cname)
- );
+ byte *,
+ target->procs.alloc_bytes(target, size, cname)
+ );
}
static byte *
gs_retrying_alloc_bytes_immovable(gs_memory_t * mem, uint size,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_bytes_immovable(target, size, cname)
- );
+ byte *,
+ target->procs.alloc_bytes_immovable(target, size, cname)
+ );
}
static void *
gs_retrying_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_RETRYING(
- void *,
- target->procs.alloc_struct(target, pstype, cname)
- );
+ void *,
+ target->procs.alloc_struct(target, pstype, cname)
+ );
}
static void *
gs_retrying_alloc_struct_immovable(gs_memory_t * mem,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_RETRYING(
- void *,
- target->procs.alloc_struct_immovable(target, pstype, cname)
- );
+ void *,
+ target->procs.alloc_struct_immovable(target, pstype, cname)
+ );
}
static byte *
gs_retrying_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_byte_array(target, num_elements,
- elt_size, cname)
- );
+ byte *,
+ target->procs.alloc_byte_array(target, num_elements,
+ elt_size, cname)
+ );
}
static byte *
gs_retrying_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_byte_array_immovable(target,
- num_elements, elt_size,
- cname)
- );
+ byte *,
+ target->procs.alloc_byte_array_immovable(target,
+ num_elements, elt_size,
+ cname)
+ );
}
static void *
gs_retrying_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_RETRYING(
- void *,
- target->procs.alloc_struct_array(target, num_elements,
- pstype, cname)
- );
+ void *,
+ target->procs.alloc_struct_array(target, num_elements,
+ pstype, cname)
+ );
}
static void *
gs_retrying_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
RETURN_RETRYING(
- void *,
- target->procs.alloc_struct_array_immovable(target,
- num_elements, pstype,
- cname)
- );
+ void *,
+ target->procs.alloc_struct_array_immovable(target,
+ num_elements, pstype,
+ cname)
+ );
}
static void *
gs_retrying_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_RETRYING(
- void *,
- target->procs.resize_object(target, obj, new_num_elements,
- cname)
- );
+ void *,
+ target->procs.resize_object(target, obj, new_num_elements,
+ cname)
+ );
}
static uint
gs_forward_object_size(gs_memory_t * mem, const void *ptr)
@@ -277,48 +277,48 @@ static byte *
gs_retrying_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_string(target, nbytes, cname)
- );
+ byte *,
+ target->procs.alloc_string(target, nbytes, cname)
+ );
}
static byte *
gs_retrying_alloc_string_immovable(gs_memory_t * mem, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.alloc_string_immovable(target, nbytes, cname)
- );
+ byte *,
+ target->procs.alloc_string_immovable(target, nbytes, cname)
+ );
}
static byte *
gs_retrying_resize_string(gs_memory_t * mem, byte * data, uint old_num,
- uint new_num,
- client_name_t cname)
+ uint new_num,
+ client_name_t cname)
{
RETURN_RETRYING(
- byte *,
- target->procs.resize_string(target, data, old_num, new_num,
- cname)
- );
+ byte *,
+ target->procs.resize_string(target, data, old_num, new_num,
+ cname)
+ );
}
static void
gs_forward_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
DO_FORWARD(target->procs.free_string(target, data, nbytes, cname));
}
static int
gs_retrying_register_root(gs_memory_t * mem, gs_gc_root_t * rp,
- gs_ptr_type_t ptype, void **up, client_name_t cname)
+ gs_ptr_type_t ptype, void **up, client_name_t cname)
{
RETURN_RETRYING(
- int,
- target->procs.register_root(target, rp, ptype, up, cname)
- );
+ int,
+ target->procs.register_root(target, rp, ptype, up, cname)
+ );
}
static void
gs_forward_unregister_root(gs_memory_t * mem, gs_gc_root_t * rp,
- client_name_t cname)
+ client_name_t cname)
{
DO_FORWARD(target->procs.unregister_root(target, rp, cname));
}
@@ -326,24 +326,24 @@ static gs_memory_t *
gs_retrying_stable(gs_memory_t * mem)
{
if (!mem->stable_memory) {
- gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;
- gs_memory_t *stable = gs_memory_stable(rmem->target);
+ gs_memory_retrying_t * const rmem = (gs_memory_retrying_t *)mem;
+ gs_memory_t *stable = gs_memory_stable(rmem->target);
- if (stable == rmem->target)
- mem->stable_memory = mem;
- else {
- gs_memory_retrying_t *retrying_stable = (gs_memory_retrying_t *)
- gs_alloc_bytes(stable, sizeof(*rmem), "gs_retrying_stable");
+ if (stable == rmem->target)
+ mem->stable_memory = mem;
+ else {
+ gs_memory_retrying_t *retrying_stable = (gs_memory_retrying_t *)
+ gs_alloc_bytes(stable, sizeof(*rmem), "gs_retrying_stable");
- if (retrying_stable) {
- int code = gs_memory_retrying_init(retrying_stable, stable);
+ if (retrying_stable) {
+ int code = gs_memory_retrying_init(retrying_stable, stable);
- if (code < 0)
- gs_free_object(stable, retrying_stable, "gs_retrying_stable");
- else
- mem->stable_memory = (gs_memory_t *)retrying_stable;
- }
- }
+ if (code < 0)
+ gs_free_object(stable, retrying_stable, "gs_retrying_stable");
+ else
+ mem->stable_memory = (gs_memory_t *)retrying_stable;
+ }
+ }
}
return mem->stable_memory;
}
diff --git a/gs/base/gsmemret.h b/gs/base/gsmemret.h
index aed149dc2..5ffce80ba 100644
--- a/gs/base/gsmemret.h
+++ b/gs/base/gsmemret.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,9 +48,9 @@ struct gs_memory_retrying_s {
/* Initialize a retrying memory manager. */
int gs_memory_retrying_init(
- gs_memory_retrying_t * rmem, /* allocator to init */
- gs_memory_t * target /* allocator to wrap */
- );
+ gs_memory_retrying_t * rmem, /* allocator to init */
+ gs_memory_t * target /* allocator to wrap */
+ );
/* Release a retrying memory manager. */
/* Note that this has no effect on the target. */
@@ -58,8 +58,8 @@ void gs_memory_retrying_release(gs_memory_retrying_t *rmem);
/* Set the recovery closure of a retrying memory manager. */
void gs_memory_retrying_set_recover(gs_memory_retrying_t *rmem,
- gs_memory_recover_proc_t recover_proc,
- void *recover_proc_data);
+ gs_memory_recover_proc_t recover_proc,
+ void *recover_proc_data);
/* Get the target of a retrying memory manager. */
gs_memory_t * gs_memory_retrying_target(const gs_memory_retrying_t *rmem);
diff --git a/gs/base/gsmisc.c b/gs/base/gsmisc.c
index 426313094..37e59d1bb 100644
--- a/gs/base/gsmisc.c
+++ b/gs/base/gsmisc.c
@@ -14,7 +14,6 @@
/* $Id$ */
/* Miscellaneous utilities for Ghostscript library */
-
/*
* In order to capture the original definition of sqrt, which might be
* either a procedure or a macro and might not have an ANSI-compliant
@@ -253,7 +252,6 @@ gs_return_check_interrupt(const gs_memory_t *mem, int code)
}
}
-
int gs_throw_imp(const char *func, const char *file, int line, int op, int code, const char *fmt, ...)
{
char msg[1024];
@@ -272,7 +270,6 @@ int gs_throw_imp(const char *func, const char *file, int line, int op, int code,
*/
}
-
/* throw */
if (op == 0)
errprintf_nomem("+ %s:%d: %s(): %s\n", file, line, func, msg);
@@ -316,7 +313,6 @@ const char *gs_errstr(int code)
}
}
-
/* ------ Substitutes for missing C library functions ------ */
#ifdef MEMORY__NEED_MEMMOVE /* see memory_.h */
diff --git a/gs/base/gsnamecl.c b/gs/base/gsnamecl.c
index 4f6435d69..628dfc2a5 100644
--- a/gs/base/gsnamecl.c
+++ b/gs/base/gsnamecl.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@
#include "gsnamecl.h" /* Custom color call back define */
#if ENABLE_CUSTOM_COLOR_CALLBACK /* Defined in src/gsnamecl.h */
-
+
/*
* Check if we want to use the callback color processing logic for the given
* Separation color space.
@@ -51,11 +51,11 @@
bool
custom_color_callback_install_Separation(gs_color_space * pcs, gs_state * pgs)
{
- client_custom_color_params_t * pcb =
- (client_custom_color_params_t *) pgs->memory->gs_lib_ctx->custom_color_callback;
+ client_custom_color_params_t * pcb =
+ (client_custom_color_params_t *) pgs->memory->gs_lib_ctx->custom_color_callback;
return (pcb == NULL) ? false
- : pcb->client_procs->install_Separation(pcb, pcs, pgs);
+ : pcb->client_procs->install_Separation(pcb, pcs, pgs);
}
/*
@@ -66,30 +66,30 @@ bool
custom_color_callback_install_DeviceN(gs_color_space * pcs, gs_state * pgs)
{
client_custom_color_params_t * pcb =
- (client_custom_color_params_t *) pgs->memory->gs_lib_ctx->custom_color_callback;
-
+ (client_custom_color_params_t *) pgs->memory->gs_lib_ctx->custom_color_callback;
+
return (pcb == NULL) ? false
- : pcb->client_procs->install_DeviceN(pcb, pcs, pgs);
+ : pcb->client_procs->install_DeviceN(pcb, pcs, pgs);
}
-
+
/*
* Convert a Separation color using the 'custom color' callback into
* device color.
*/
int
gx_remap_concrete_custom_color_Separation(const frac * pconc,
- const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
client_custom_color_params_t * pcb =
- (client_custom_color_params_t *) pis->memory->gs_lib_ctx->custom_color_callback;
-
+ (client_custom_color_params_t *) pis->memory->gs_lib_ctx->custom_color_callback;
+
if (pcb == NULL) {
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
else
- return pcb->client_procs->remap_Separation(pcb, pconc,
- pcs, pdc, pis, dev, select);
+ return pcb->client_procs->remap_Separation(pcb, pconc,
+ pcs, pdc, pis, dev, select);
}
/*
@@ -98,18 +98,18 @@ gx_remap_concrete_custom_color_Separation(const frac * pconc,
*/
int
gx_remap_concrete_custom_color_DeviceN(const frac * pconc,
- const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
client_custom_color_params_t * pcb =
- (client_custom_color_params_t *) pis->memory->gs_lib_ctx->custom_color_callback;
-
- if (pcb == NULL) {
- return_error(gs_error_rangecheck);
+ (client_custom_color_params_t *) pis->memory->gs_lib_ctx->custom_color_callback;
+
+ if (pcb == NULL) {
+ return_error(gs_error_rangecheck);
}
else
- return pcb->client_procs->remap_DeviceN(pcb, pconc,
- pcs, pdc, pis, dev, select);
+ return pcb->client_procs->remap_DeviceN(pcb, pconc,
+ pcs, pdc, pis, dev, select);
}
/*
@@ -129,21 +129,21 @@ custom_color_callback_get_params(gs_state * pgs, gs_param_list * plist)
int idx;
int val;
size_t iptr;
-
+
idx = ((int)sizeof(size_t)) * 8 - 4;
iptr = (size_t)(pgs->memory->gs_lib_ctx->custom_color_callback);
while (idx >= 0) {
- val = (int)(iptr >> idx) & 0xf;
+ val = (int)(iptr >> idx) & 0xf;
if (val <= 9)
- buf[buf_pos++] = '0' + val;
- else
- buf[buf_pos++] = 'a' - 10 + val;
- idx -= 4;
+ buf[buf_pos++] = '0' + val;
+ else
+ buf[buf_pos++] = 'a' - 10 + val;
+ idx -= 4;
}
param_string_from_transient_string(custom_color_param, buf);
return param_write_string(plist, CustomColorCallbackParamName,
- &custom_color_param);
+ &custom_color_param);
}
/*
@@ -161,52 +161,52 @@ custom_color_callback_put_params(gs_state * pgs, gs_param_list * plist)
gs_param_string dh = { 0 };
switch (code = param_read_string(plist, CustomColorCallbackParamName, &dh)) {
- case 0:
- {
- /*
- * Convert from a string to a pointer.
+ case 0:
+ {
+ /*
+ * Convert from a string to a pointer.
* It is assumed that size_t has the same size as a pointer.
* Allow formats (1234), (10#1234) or (16#04d2).
*/
- uint i;
- int base = 10;
- int val;
- code = 0;
- for (i = 0; i < dh.size; i++) {
- val = dh.data[i];
- if ((val >= '0') && (val <= '9'))
- val = val - '0';
- else if ((val >= 'A') && (val <= 'F'))
- val = val - 'A' + 10;
- else if ((val >= 'a') && (val <= 'f'))
- val = val - 'a' + 10;
- else if (val == '#' && ((iptr == 10) || (iptr == 16))) {
- base = (int) iptr;
- iptr = 0;
- continue;
- }
- else {
- code = gs_error_rangecheck;
- break;
- }
- iptr = iptr * base + val;
- }
- }
- break;
- default:
- case 1:
- dh.data = 0;
- break;
+ uint i;
+ int base = 10;
+ int val;
+ code = 0;
+ for (i = 0; i < dh.size; i++) {
+ val = dh.data[i];
+ if ((val >= '0') && (val <= '9'))
+ val = val - '0';
+ else if ((val >= 'A') && (val <= 'F'))
+ val = val - 'A' + 10;
+ else if ((val >= 'a') && (val <= 'f'))
+ val = val - 'a' + 10;
+ else if (val == '#' && ((iptr == 10) || (iptr == 16))) {
+ base = (int) iptr;
+ iptr = 0;
+ continue;
+ }
+ else {
+ code = gs_error_rangecheck;
+ break;
+ }
+ iptr = iptr * base + val;
+ }
+ }
+ break;
+ default:
+ case 1:
+ dh.data = 0;
+ break;
}
if (code < 0) {
- param_signal_error(plist, "CustomColorCallback", code);
+ param_signal_error(plist, "CustomColorCallback", code);
}
else if (pgs->memory->gs_lib_ctx->custom_color_callback != (void *)iptr) {
pgs->memory->gs_lib_ctx->custom_color_callback = (void *)iptr;
- /*
- * Custom color processing can depend upon the type of object
- * being imaged so we enable object type tagging.
- */
+ /*
+ * Custom color processing can depend upon the type of object
+ * being imaged so we enable object type tagging.
+ */
gs_enable_object_tagging(pgs->memory);
}
diff --git a/gs/base/gsnamecl.h b/gs/base/gsnamecl.h
index 3da50cb07..1eb3c9d38 100644
--- a/gs/base/gsnamecl.h
+++ b/gs/base/gsnamecl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,7 @@
/*
* For comments upon the client API for working with the custom client
- * callback logic see the section labeled: "CLIENT COLOR CALLBACK
+ * callback logic see the section labeled: "CLIENT COLOR CALLBACK
* APPLICATION INTERFACE" below.
*
* Also see the comments at the start of src/gsnamecl.c
@@ -110,7 +110,7 @@ int custom_color_callback_get_params(gs_state * pgs, gs_param_list * plist);
* Separation color space.
*/
bool custom_color_callback_install_Separation(gs_color_space * pcs,
- gs_state * pgs);
+ gs_state * pgs);
/*
* Check if we want to use the custom client callback processing logic for the
@@ -123,16 +123,16 @@ bool custom_color_callback_install_DeviceN(gs_color_space * pcs, gs_state * pgs)
* client callback.
*/
int gx_remap_concrete_custom_color_Separation(const frac * pconc,
- const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
+ const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
/*
* Convert a DeviceN color into device colorants using the custom client
* client callback.
*/
int gx_remap_concrete_custom_color_DeviceN(const frac * pconc,
- const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
+ const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select);
/* "CLIENT COLOR CALLBACK APPLICATION INTERFACE" */
/*
@@ -158,7 +158,6 @@ typedef struct client_custom_color_params_s {
} client_custom_color_params_t;
#endif
-
/*
* Define a base type for client color space data. Most clients will
* overload this type with a structure of their own. That type must
@@ -166,7 +165,7 @@ typedef struct client_custom_color_params_s {
* reference count.
*/
typedef struct client_color_space_data_s {
- cs_proc_adjust_client_cspace_count((*client_adjust_cspace_count));
+ cs_proc_adjust_client_cspace_count((*client_adjust_cspace_count));
} client_color_space__data_t;
/*
@@ -177,70 +176,70 @@ typedef struct client_custom_color_procs_s {
* Install a DeviceGray color space.
*/
bool (* install_DeviceGray)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a DeviceGray color into device color.
*/
int (* remap_DeviceGray)(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const frac * pconc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Install a DeviceRGB color space.
*/
bool (* install_DeviceRGB)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a DeviceRGB color into device color.
*/
int (* remap_DeviceRGB)(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const frac * pconc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Install a DeviceCMYK color space.
*/
bool (* install_DeviceCMYK)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a DeviceGray color into device color.
*/
int (* remap_DeviceCMYK)(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const frac * pconc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given Separation color space.
*/
bool (* install_Separation)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a Separation color into device color.
*/
int (* remap_Separation)(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const frac * pconc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given DeviceN color space.
*/
bool (* install_DeviceN)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a DeviceN color into device color.
*/
int (* remap_DeviceN)(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const frac * pconc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given CIEBasedA color space.
*/
bool (* install_CIEBasedA)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Please note that the 'complex' color spaces (CIEBasedA, CIEBasedABC,
* CIEBasedDEF, CIEBasedDEFG, and ICCBased) have a different prototype,
@@ -251,62 +250,62 @@ typedef struct client_custom_color_procs_s {
* Convert a CIEBasedA color into device color.
*/
int (* remap_CIEBasedA)(client_custom_color_params_t * pparams,
- const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const gs_client_color * pc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given CIEBasedABC color space.
*/
bool (* install_CIEBasedABC)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a CIEBasedABC color into device color.
*/
int (* remap_CIEBasedABC)(client_custom_color_params_t * pparams,
- const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const gs_client_color * pc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given CIEBasedDEF color space.
*/
bool (* install_CIEBasedDEF)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a CIEBasedDEF color into device color.
*/
int (* remap_CIEBasedDEF)(client_custom_color_params_t * pparams,
- const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const gs_client_color * pc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given CIEBasedDEFG color space.
*/
bool (* install_CIEBasedDEFG)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a CIEBasedDEFG color into device color.
*/
int (* remap_CIEBasedDEFG)(client_custom_color_params_t * pparams,
- const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const gs_client_color * pc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
/*
* Check if we want to use the callback color processing logic for the
* given ICCBased color space.
*/
bool (* install_ICCBased)(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs);
+ gs_color_space * pcs, gs_state * pgs);
/*
* Convert a ICCBased color into device color.
*/
int (* remap_ICCBased)(client_custom_color_params_t * pparams,
- const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select);
+ const gs_client_color * pc, const gs_color_space * pcs,
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select);
} client_custom_color_procs_t;
-
+
#endif /* ifndef gsnamecl_INCLUDED */
diff --git a/gs/base/gsncdummy.c b/gs/base/gsncdummy.c
index 06abb8d34..14abca246 100644
--- a/gs/base/gsncdummy.c
+++ b/gs/base/gsncdummy.c
@@ -74,7 +74,6 @@
#include "gxcie.h"
#include "gsncdummy.h"
-
#if ENABLE_CUSTOM_COLOR_CALLBACK /* Defined in src/gsnamecl.h */
/*
@@ -106,7 +105,7 @@ const pantone_list_t pantone_list[] = {
/* Compare two names */
#define compare_names(name1, name_size1, name2, name_size2) \
(name_size1 == name_size2 && \
- (memcmp((const char *)name1, (const char *)name2, name_size1) == 0))
+ (memcmp((const char *)name1, (const char *)name2, name_size1) == 0))
/*
* Define a structure for holding our client specific data. In our demo,
@@ -136,19 +135,19 @@ typedef struct demo_color_space_data_s {
*/
int color_index[GS_CLIENT_COLOR_MAX_COMPONENTS];
gs_imager_state *CIEtoXYZ_pis; /* Used to map CIE spaces to XYZ */
- /* refer to gx_cie_to_xyz_alloc */
+ /* refer to gx_cie_to_xyz_alloc */
} demo_color_space_data_t;
gs_private_st_ptrs1(st_demo_color_space_data, demo_color_space_data_t,
- "demo_color_space_data_t", demo_color_space_enum_ptrs,
- demo_color_space_reloc_ptrs, CIEtoXYZ_pis);
+ "demo_color_space_data_t", demo_color_space_enum_ptrs,
+ demo_color_space_reloc_ptrs, CIEtoXYZ_pis);
/*
* Dummy install routine for color spaces which are not handled by the client.
*/
static bool
client_install_no_op(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
return false; /* Do nothing */
}
@@ -161,15 +160,15 @@ static void
client_adjust_cspace_count(const gs_color_space * pcs, int delta)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
pdata->ref_count += delta;
if (pdata->ref_count <= 0) {
- /* Free up the CIE to XYZ imager state if it was allocated */
- if (pdata->CIEtoXYZ_pis) {
- gx_cie_to_xyz_free(pdata->CIEtoXYZ_pis);
- }
- gs_free_object(pdata->memory, pdata, "client_adjust_cspace_count(pdata)");
+ /* Free up the CIE to XYZ imager state if it was allocated */
+ if (pdata->CIEtoXYZ_pis) {
+ gx_cie_to_xyz_free(pdata->CIEtoXYZ_pis);
+ }
+ gs_free_object(pdata->memory, pdata, "client_adjust_cspace_count(pdata)");
}
}
@@ -191,18 +190,18 @@ allocate_client_data_block(int initial_ref_count, gs_memory_t *mem)
* See client_adjust_cspace_count.
*/
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)gs_alloc_struct(mem, demo_color_space_data_t,
- &st_demo_color_space_data, "allocate_client_data_block(pdata)");
+ (demo_color_space_data_t *)gs_alloc_struct(mem, demo_color_space_data_t,
+ &st_demo_color_space_data, "allocate_client_data_block(pdata)");
if (pdata != NULL) {
- memset(pdata, 0, sizeof(demo_color_space_data_t));
- /*
- * All client color space data blocks must have a pointer to a
- * reference count adjust routine as their first field.
- */
- pdata->client_adjust_cspace_count = client_adjust_cspace_count;
- pdata->ref_count = 1;
- pdata->memory = mem;
+ memset(pdata, 0, sizeof(demo_color_space_data_t));
+ /*
+ * All client color space data blocks must have a pointer to a
+ * reference count adjust routine as their first field.
+ */
+ pdata->client_adjust_cspace_count = client_adjust_cspace_count;
+ pdata->ref_count = 1;
+ pdata->memory = mem;
}
return pdata;
@@ -210,22 +209,22 @@ allocate_client_data_block(int initial_ref_count, gs_memory_t *mem)
static bool
client_install_generic(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
- demo_color_space_data_t * pclient_data;
-
- /* Exit if we have already installed this color space. */
- if (pcs->pclient_color_space_data != NULL)
- return true;
-
- pclient_data = allocate_client_data_block(1, pcs->rc.memory->stable_memory);
- pcs->pclient_color_space_data = (client_color_space_data_t *) pclient_data;
- if (pclient_data)
- {
- pclient_data->client_is_going_to_handle_color_space = 1;
- return true;
- }
- return false;
+ demo_color_space_data_t * pclient_data;
+
+ /* Exit if we have already installed this color space. */
+ if (pcs->pclient_color_space_data != NULL)
+ return true;
+
+ pclient_data = allocate_client_data_block(1, pcs->rc.memory->stable_memory);
+ pcs->pclient_color_space_data = (client_color_space_data_t *) pclient_data;
+ if (pclient_data)
+ {
+ pclient_data->client_is_going_to_handle_color_space = 1;
+ return true;
+ }
+ return false;
}
/*
@@ -234,7 +233,7 @@ client_install_generic(client_custom_color_params_t * pparams,
*/
static bool
client_pantone_install_Separation(client_custom_color_params_t * pparam,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
const gs_separation_name name = pcs->params.separation.sep_name;
int pan_index;
@@ -246,34 +245,34 @@ client_pantone_install_Separation(client_custom_color_params_t * pparam,
/* Exit if we have already installed this color space. */
if (pcs->pclient_color_space_data != NULL)
- return true;
+ return true;
/*
* Get the character string and length for the component name.
*/
pcs->params.separation.get_colorname_string(dev->memory, name,
- &pname, &name_size);
+ &pname, &name_size);
/*
* Compare the colorant name to those in our PANTONE color list.
*/
for (pan_index = 0; pan_index < num_pantone_colors ; pan_index++) {
- const char * pan_name = pantone_list[pan_index].name;
+ const char * pan_name = pantone_list[pan_index].name;
- if (compare_names(pname, name_size, pan_name, strlen(pan_name))) {
- use_custom_color_callback = true;
- break;
- }
+ if (compare_names(pname, name_size, pan_name, strlen(pan_name))) {
+ use_custom_color_callback = true;
+ break;
+ }
}
if (use_custom_color_callback) {
demo_color_space_data_t * pclient_data =
- allocate_client_data_block(1, pcs->rc.memory->stable_memory);
+ allocate_client_data_block(1, pcs->rc.memory->stable_memory);
- if (pclient_data == NULL)
- return false;
- pclient_data->color_index[0] = pan_index;
+ if (pclient_data == NULL)
+ return false;
+ pclient_data->color_index[0] = pan_index;
pcs->pclient_color_space_data =
- (client_color_space_data_t *) pclient_data;
+ (client_color_space_data_t *) pclient_data;
}
return use_custom_color_callback;
}
@@ -284,7 +283,7 @@ client_pantone_install_Separation(client_custom_color_params_t * pparam,
*/
static bool
client_pantone_install_DeviceN(client_custom_color_params_t * pparam,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
const gs_separation_name *names = pcs->params.device_n.names;
int num_comp = pcs->params.device_n.num_components;
@@ -311,63 +310,63 @@ client_pantone_install_DeviceN(client_custom_color_params_t * pparam,
/* Exit if we have already installed this color space. */
if (pcs->pclient_color_space_data != NULL)
- return true;
+ return true;
/*
* Now check the names of the color components.
*/
for(i = 0; i < num_comp; i++ ) {
- bool match = false;
-
- /*
- * Get the character string and length for the component name.
- */
- pcs->params.device_n.get_colorname_string(dev->memory, names[i],
- &pname, &name_size);
- /*
+ bool match = false;
+
+ /*
+ * Get the character string and length for the component name.
+ */
+ pcs->params.device_n.get_colorname_string(dev->memory, names[i],
+ &pname, &name_size);
+ /*
* Postscript does not include /None as a color component but it is
* allowed in PDF so we accept it. We simply skip components named
- * 'None'.
+ * 'None'.
+ */
+ if (compare_names(none_str, none_size, pname, name_size)) {
+ pantone_color_index[i] = PANTONE_NONE;
+ continue;
+ }
+ /*
+ * Check if our color space includes the CMYK process colors.
+ */
+ if (compare_names(cyan_str, cyan_size, pname, name_size)) {
+ pantone_color_index[i] = PANTONE_CYAN;
+ continue;
+ }
+ if (compare_names(magenta_str, magenta_size, pname, name_size)) {
+ pantone_color_index[i] = PANTONE_MAGENTA;
+ continue;
+ }
+ if (compare_names(yellow_str, yellow_size, pname, name_size)) {
+ pantone_color_index[i] = PANTONE_YELLOW;
+ continue;
+ }
+ if (compare_names(black_str, black_size, pname, name_size)) {
+ pantone_color_index[i] = PANTONE_BLACK;
+ continue;
+ }
+ /*
+ * Compare the colorant name to those in our Pantone color list.
*/
- if (compare_names(none_str, none_size, pname, name_size)) {
- pantone_color_index[i] = PANTONE_NONE;
- continue;
- }
- /*
- * Check if our color space includes the CMYK process colors.
- */
- if (compare_names(cyan_str, cyan_size, pname, name_size)) {
- pantone_color_index[i] = PANTONE_CYAN;
- continue;
- }
- if (compare_names(magenta_str, magenta_size, pname, name_size)) {
- pantone_color_index[i] = PANTONE_MAGENTA;
- continue;
- }
- if (compare_names(yellow_str, yellow_size, pname, name_size)) {
- pantone_color_index[i] = PANTONE_YELLOW;
- continue;
- }
- if (compare_names(black_str, black_size, pname, name_size)) {
- pantone_color_index[i] = PANTONE_BLACK;
- continue;
- }
- /*
- * Compare the colorant name to those in our Pantone color list.
- */
- for (pan_index = 0; pan_index < num_pantone_colors ; pan_index++) {
- const char * pan_name = pantone_list[pan_index].name;
-
- if (compare_names(pname, name_size, pan_name, strlen(pan_name))) {
- pantone_color_index[i] = pan_index;
- match = pantone_found = true;
- break;
- }
- }
- if (!match) { /* Exit if we find a non Pantone color */
- other_separation_found = true;
- break;
- }
+ for (pan_index = 0; pan_index < num_pantone_colors ; pan_index++) {
+ const char * pan_name = pantone_list[pan_index].name;
+
+ if (compare_names(pname, name_size, pan_name, strlen(pan_name))) {
+ pantone_color_index[i] = pan_index;
+ match = pantone_found = true;
+ break;
+ }
+ }
+ if (!match) { /* Exit if we find a non Pantone color */
+ other_separation_found = true;
+ break;
+ }
}
/*
* Handle this color space as a 'pantone color space' if we have only
@@ -377,19 +376,18 @@ client_pantone_install_DeviceN(client_custom_color_params_t * pparam,
use_pantone = pantone_found && !other_separation_found;
if (use_pantone) {
demo_color_space_data_t * pclient_data =
- allocate_client_data_block(1, pcs->rc.memory->stable_memory);
+ allocate_client_data_block(1, pcs->rc.memory->stable_memory);
if (pclient_data == NULL)
- return false;
+ return false;
for(i = 0; i < num_comp; i++ )
- pclient_data->color_index[i] = pantone_color_index[i];
+ pclient_data->color_index[i] = pantone_color_index[i];
pcs->pclient_color_space_data =
- (client_color_space_data_t *) pclient_data;
+ (client_color_space_data_t *) pclient_data;
}
return use_pantone;
}
-
/*
* Convert a set of color values in a 'PANTONE color space' into a device
* color values.
@@ -405,9 +403,9 @@ client_pantone_install_DeviceN(client_custom_color_params_t * pparam,
*/
static int
client_pantone_remap_color(client_custom_color_params_t * pparam,
- const frac * pconc, const demo_color_space_data_t * pparams,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select, int num_comp)
+ const frac * pconc, const demo_color_space_data_t * pparams,
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select, int num_comp)
{
int i, pantone_index, cvalue;
int cyan = 0;
@@ -423,7 +421,7 @@ client_pantone_remap_color(client_custom_color_params_t * pparam,
* its normal color space processing.
*/
if (pparams == NULL)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/*
* Create a CMYK representation of the various colors in our color space.
@@ -432,31 +430,31 @@ client_pantone_remap_color(client_custom_color_params_t * pparam,
* left to the user.
*/
for (i = 0; i < num_comp; i++) {
- cvalue = pconc[i];
- pantone_index = pparams->color_index[i];
- switch (pantone_index) {
- case PANTONE_NONE:
- break;
- case PANTONE_CYAN:
- cyan += cvalue;
- break;
- case PANTONE_MAGENTA:
- magenta += cvalue;
- break;
- case PANTONE_YELLOW:
- yellow += cvalue;
- break;
- case PANTONE_BLACK:
- black += cvalue;
- break;
- default:
- plist = &(pantone_list[pantone_index]);
- cyan += (int) floor(cvalue * plist->c);
- magenta += (int) floor(cvalue * plist->m);
- yellow += (int) floor(cvalue * plist->y);
- black += (int) floor(cvalue * plist->k);
- break;
- }
+ cvalue = pconc[i];
+ pantone_index = pparams->color_index[i];
+ switch (pantone_index) {
+ case PANTONE_NONE:
+ break;
+ case PANTONE_CYAN:
+ cyan += cvalue;
+ break;
+ case PANTONE_MAGENTA:
+ magenta += cvalue;
+ break;
+ case PANTONE_YELLOW:
+ yellow += cvalue;
+ break;
+ case PANTONE_BLACK:
+ black += cvalue;
+ break;
+ default:
+ plist = &(pantone_list[pantone_index]);
+ cyan += (int) floor(cvalue * plist->c);
+ magenta += (int) floor(cvalue * plist->m);
+ yellow += (int) floor(cvalue * plist->y);
+ black += (int) floor(cvalue * plist->k);
+ break;
+ }
}
/* Clamp our color values */
cc = (cyan > frac_1) ? frac_1 : (cyan < frac_0) ? frac_0 : cyan;
@@ -472,12 +470,12 @@ client_pantone_remap_color(client_custom_color_params_t * pparam,
*/
static int
client_pantone_remap_Separation(client_custom_color_params_t * pparam,
- const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
return client_pantone_remap_color(pparam, pconc,
- (demo_color_space_data_t *)(pcs->pclient_color_space_data),
- pdc, pis, dev, select, 1);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data),
+ pdc, pis, dev, select, 1);
}
/*
@@ -485,15 +483,14 @@ client_pantone_remap_Separation(client_custom_color_params_t * pparam,
*/
static int
client_pantone_remap_DeviceN(client_custom_color_params_t * pparam,
- const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- return client_pantone_remap_color(pparam, pconc,
- (demo_color_space_data_t *)(pcs->pclient_color_space_data),
- pdc, pis, dev, select, gs_color_space_num_components(pcs));
+ return client_pantone_remap_color(pparam, pconc,
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data),
+ pdc, pis, dev, select, gs_color_space_num_components(pcs));
}
-
#if !PANTONE_ONLY
/*
@@ -501,7 +498,7 @@ client_pantone_remap_DeviceN(client_custom_color_params_t * pparam,
*/
static bool
client_install_DeviceGray(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
/* Nothing to do in our demo */
return true;
@@ -513,25 +510,25 @@ client_install_DeviceGray(client_custom_color_params_t * pparams,
*/
static int
convert_intensity_into_device_color(const frac intensity,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
frac cc, cm, cy, ck;
switch (pis->object_tag) {
- case GS_TEXT_TAG: /* Make text red. */
- cc = ck = 0;
- cm = cy = frac_1 - intensity;
- break;
- case GS_IMAGE_TAG: /* Make images green. */
- cm = ck = 0;
- cc = cy = frac_1 - intensity;
- break;
- case GS_PATH_TAG: /* Make lines and fills blue. */
- default:
- cy = ck = 0;
- cc = cm = frac_1 - intensity;
- break;
+ case GS_TEXT_TAG: /* Make text red. */
+ cc = ck = 0;
+ cm = cy = frac_1 - intensity;
+ break;
+ case GS_IMAGE_TAG: /* Make images green. */
+ cm = ck = 0;
+ cc = cy = frac_1 - intensity;
+ break;
+ case GS_PATH_TAG: /* Make lines and fills blue. */
+ default:
+ cy = ck = 0;
+ cc = cm = frac_1 - intensity;
+ break;
}
/* Send CMYK colors to the device */
@@ -548,22 +545,21 @@ client_remap_DeviceGray(client_custom_color_params_t * pparams,
const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- #if OBJECT_TYPE_EXAMPLE
-
- /* For demo and debug purposes, make our colors a function of the
- * intensity of the given colors and the object type. */
+ #if OBJECT_TYPE_EXAMPLE
- frac intensity = pconc[0];
- convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
+ /* For demo and debug purposes, make our colors a function of the
+ * intensity of the given colors and the object type. */
- #else
+ frac intensity = pconc[0];
+ convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
- /* If desired, replace with your own color transformation */
+ #else
- gx_remap_concrete_gray(pconc[0], pdc, pis, dev, select);
+ /* If desired, replace with your own color transformation */
- #endif
+ gx_remap_concrete_gray(pconc[0], pdc, pis, dev, select);
+ #endif
return 0;
}
@@ -573,7 +569,7 @@ client_remap_DeviceGray(client_custom_color_params_t * pparams,
*/
static bool
client_install_DeviceRGB(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
/* Nothing to do in our demo */
dlprintf1("client_install_DeviceRGB ri = %d\n", pgs->renderingintent);
@@ -585,25 +581,25 @@ client_install_DeviceRGB(client_custom_color_params_t * pparams,
*/
static int
client_remap_DeviceRGB(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- #if OBJECT_TYPE_EXAMPLE
+ #if OBJECT_TYPE_EXAMPLE
- /* For demo and debug purposes, make our colors a function of the
- * intensity of the given colors and the object type. */
+ /* For demo and debug purposes, make our colors a function of the
+ * intensity of the given colors and the object type. */
- frac intensity = (frac)(pconc[0] * 0.30 + pconc[1] * 0.59 + pconc[2] * 0.11);
- convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
+ frac intensity = (frac)(pconc[0] * 0.30 + pconc[1] * 0.59 + pconc[2] * 0.11);
+ convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
- #else
+ #else
- /* If desired, replace with your own color transformation */
+ /* If desired, replace with your own color transformation */
- gx_remap_concrete_rgb(pconc[0], pconc[1], pconc[2], pdc, pis, dev, select);
+ gx_remap_concrete_rgb(pconc[0], pconc[1], pconc[2], pdc, pis, dev, select);
- #endif
+ #endif
return 0;
}
@@ -613,7 +609,7 @@ client_remap_DeviceRGB(client_custom_color_params_t * pparams,
*/
static bool
client_install_DeviceCMYK(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
/* Nothing to do in our demo */
return true;
@@ -624,29 +620,29 @@ client_install_DeviceCMYK(client_custom_color_params_t * pparams,
*/
static int
client_remap_DeviceCMYK(client_custom_color_params_t * pparams,
- const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
+ const frac * pconc, const gs_color_space * pcs, gx_device_color * pdc,
+ const gs_imager_state * pis, gx_device * dev, gs_color_select_t select)
{
- #if OBJECT_TYPE_EXAMPLE
+ #if OBJECT_TYPE_EXAMPLE
- /*
- * For demo and debug purposes, make our colors a function of the
- * intensity of the given colors and the object type. */
+ /*
+ * For demo and debug purposes, make our colors a function of the
+ * intensity of the given colors and the object type. */
- frac intensity = frac_1 - (frac)(pconc[0] * 0.30 + pconc[1] * 0.59
- + pconc[2] * 0.11 + pconc[3]);
+ frac intensity = frac_1 - (frac)(pconc[0] * 0.30 + pconc[1] * 0.59
+ + pconc[2] * 0.11 + pconc[3]);
- if (intensity < frac_0)
- intensity = frac_0;
- convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
+ if (intensity < frac_0)
+ intensity = frac_0;
+ convert_intensity_into_device_color(intensity, pdc, pis, dev, select);
- #else
+ #else
- /* If desired, replace with your own color transformation */
- gx_remap_concrete_cmyk(pconc[0], pconc[1], pconc[2], pconc[3],pdc, pis, dev, select);
+ /* If desired, replace with your own color transformation */
+ gx_remap_concrete_cmyk(pconc[0], pconc[1], pconc[2], pconc[3],pdc, pis, dev, select);
- #endif
+ #endif
return 0;
}
@@ -656,122 +652,121 @@ client_remap_DeviceCMYK(client_custom_color_params_t * pparams,
* given a specified floating point range.
*/
#define convert2frac(color, range) \
- (color <= range.rmin) ? frac_0 \
- : (color >= range.rmax) ? frac_1 \
- : (frac) (frac_1 * \
- (color - range.rmin) / (range.rmax - range.rmin))
+ (color <= range.rmin) ? frac_0 \
+ : (color >= range.rmax) ? frac_1 \
+ : (frac) (frac_1 * \
+ (color - range.rmin) / (range.rmax - range.rmin))
static bool
client_install_CIEtoA(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
/* get ready for converting to XYZ */
demo_color_space_data_t * pdata;
/* Exit if we have already installed this color space. */
if (pcs->pclient_color_space_data != NULL)
- return true;
+ return true;
pdata = allocate_client_data_block(1, pcs->rc.memory->stable_memory);
pcs->pclient_color_space_data = (client_color_space_data_t *) pdata;
if (pdata)
{
- int code;
- gs_cie_a *pcie = pcs->params.a;
- gs_sample_loop_params_t lp;
- int i;
-
- pdata->client_is_going_to_handle_color_space = 1;
-
- /* Fill the caches we need in the CIE color space */
- gs_cie_cache_init(&pcie->caches.DecodeA.floats.params, &lp,
- &pcie->RangeA, "DecodeA");
- for (i = 0; i <= lp.N; ++i) {
- float in = SAMPLE_LOOP_VALUE(i, lp);
-
- pcie->caches.DecodeA.floats.values[i] = (*pcie->DecodeA)(in, pcie);
- }
- gx_cie_load_common_cache(&pcie->common, pgs);
- gs_cie_a_complete(pcie);
- if ((code=gs_cie_cs_complete(pgs, true)) >= 0) {
- /* Now allocate the conversion imager state in stable_memory */
- /* so that the garbage collector won't free it */
- code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
- pcs->rc.memory->stable_memory);
- }
- if (code < 0) {
- client_adjust_cspace_count(pcs, -1); /* free it up */
- return false;
- }
+ int code;
+ gs_cie_a *pcie = pcs->params.a;
+ gs_sample_loop_params_t lp;
+ int i;
+
+ pdata->client_is_going_to_handle_color_space = 1;
+
+ /* Fill the caches we need in the CIE color space */
+ gs_cie_cache_init(&pcie->caches.DecodeA.floats.params, &lp,
+ &pcie->RangeA, "DecodeA");
+ for (i = 0; i <= lp.N; ++i) {
+ float in = SAMPLE_LOOP_VALUE(i, lp);
+
+ pcie->caches.DecodeA.floats.values[i] = (*pcie->DecodeA)(in, pcie);
+ }
+ gx_cie_load_common_cache(&pcie->common, pgs);
+ gs_cie_a_complete(pcie);
+ if ((code=gs_cie_cs_complete(pgs, true)) >= 0) {
+ /* Now allocate the conversion imager state in stable_memory */
+ /* so that the garbage collector won't free it */
+ code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
+ pcs->rc.memory->stable_memory);
+ }
+ if (code < 0) {
+ client_adjust_cspace_count(pcs, -1); /* free it up */
+ return false;
+ }
}
return true;
}
static bool
client_install_CIEtoXYZ(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
/* get ready for converting to XYZ */
demo_color_space_data_t * pdata;
/* Exit if we have already installed this color space. */
if (pcs->pclient_color_space_data != NULL)
- return true;
+ return true;
pdata = allocate_client_data_block(1, pcs->rc.memory->stable_memory);
pcs->pclient_color_space_data = (client_color_space_data_t *) pdata;
if (pdata)
{
- int code;
- const gs_cie_abc *pcie;
+ int code;
+ const gs_cie_abc *pcie;
- pdata->client_is_going_to_handle_color_space = 1;
+ pdata->client_is_going_to_handle_color_space = 1;
switch (pcs->type->index) {
- case gs_color_space_index_CIEDEF: {
- gs_cie_def *pcie_def = pcs->params.def;
-
- pcie = (gs_cie_abc *)pcie_def;
- CIE_LOAD_CACHE_BODY(pcie_def->caches_def.DecodeDEF, pcie_def->RangeDEF.ranges,
- &pcie_def->DecodeDEF, DecodeDEF_default, pcie_def,
- "DecodeDEF");
- break;
- }
- case gs_color_space_index_CIEDEFG: {
- gs_cie_defg *pcie_defg = pcs->params.defg;
-
- pcie = (gs_cie_abc *)pcie_defg;
- CIE_LOAD_CACHE_BODY(pcie_defg->caches_defg.DecodeDEFG, pcie_defg->RangeDEFG.ranges,
- &pcie_defg->DecodeDEFG, DecodeDEFG_default, pcie_defg,
- "DecodeDEFG");
- break;
- }
- case gs_color_space_index_CIEABC: {
- pcie = pcs->params.abc;
- break;
- }
- default:
- /* can't happen since we only come here for certain color spaces */
- return false;
- }
- /* Fill the caches we need in the CIE color space */
+ case gs_color_space_index_CIEDEF: {
+ gs_cie_def *pcie_def = pcs->params.def;
+
+ pcie = (gs_cie_abc *)pcie_def;
+ CIE_LOAD_CACHE_BODY(pcie_def->caches_def.DecodeDEF, pcie_def->RangeDEF.ranges,
+ &pcie_def->DecodeDEF, DecodeDEF_default, pcie_def,
+ "DecodeDEF");
+ break;
+ }
+ case gs_color_space_index_CIEDEFG: {
+ gs_cie_defg *pcie_defg = pcs->params.defg;
+
+ pcie = (gs_cie_abc *)pcie_defg;
+ CIE_LOAD_CACHE_BODY(pcie_defg->caches_defg.DecodeDEFG, pcie_defg->RangeDEFG.ranges,
+ &pcie_defg->DecodeDEFG, DecodeDEFG_default, pcie_defg,
+ "DecodeDEFG");
+ break;
+ }
+ case gs_color_space_index_CIEABC: {
+ pcie = pcs->params.abc;
+ break;
+ }
+ default:
+ /* can't happen since we only come here for certain color spaces */
+ return false;
+ }
+ /* Fill the caches we need in the CIE color space */
if ((code=gx_install_cie_abc((gs_cie_abc *)pcie, pgs)) >= 0) {
- /* Now allocate the conversion imager state in stable_memory */
- /* so that the garbage collector won't free it */
- code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
- pcs->rc.memory->stable_memory);
- }
- if (code < 0) {
- client_adjust_cspace_count(pcs, -1); /* free it up */
- return false;
- }
+ /* Now allocate the conversion imager state in stable_memory */
+ /* so that the garbage collector won't free it */
+ code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
+ pcs->rc.memory->stable_memory);
+ }
+ if (code < 0) {
+ client_adjust_cspace_count(pcs, -1); /* free it up */
+ return false;
+ }
}
return true;
}
-
static bool
client_install_ICCtoXYZ(client_custom_color_params_t * pparams,
- gs_color_space * pcs, gs_state * pgs)
+ gs_color_space * pcs, gs_state * pgs)
{
int code;
const gs_icc_params * picc_params = (const gs_icc_params *)&pcs->params.icc;
@@ -779,36 +774,35 @@ client_install_ICCtoXYZ(client_custom_color_params_t * pparams,
demo_color_space_data_t * pdata;
if (pcs->pclient_color_space_data != NULL)
- return true;
+ return true;
pdata = allocate_client_data_block(1, pcs->rc.memory->stable_memory);
pcs->pclient_color_space_data = (client_color_space_data_t *) pdata;
- /* Need to initialize the client data. The imager_state is what is needed in pdata->CIEtoXZY_ps */
+ /* Need to initialize the client data. The imager_state is what is needed in pdata->CIEtoXZY_ps */
/* update the stub information used by the joint caches */
gx_cie_load_common_cache(&picc_info->common, pgs);
gx_cie_common_complete(&picc_info->common);
if ((code=gs_cie_cs_complete(pgs, true)) < 0) {
- client_adjust_cspace_count(pcs, -1); /* free it up */
- return false;
+ client_adjust_cspace_count(pcs, -1); /* free it up */
+ return false;
}
- /* Now allocate the conversion imager state in stable_memory */
- /* so that the garbage collector won't free it */
- code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
- pcs->rc.memory->stable_memory);
+ /* Now allocate the conversion imager state in stable_memory */
+ /* so that the garbage collector won't free it */
+ code = gx_cie_to_xyz_alloc(&pdata->CIEtoXYZ_pis, pcs,
+ pcs->rc.memory->stable_memory);
- if (code < 0) {
- client_adjust_cspace_count(pcs, -1); /* free it up */
- return false;
- }
+ if (code < 0) {
+ client_adjust_cspace_count(pcs, -1); /* free it up */
+ return false;
+ }
return true;
}
-
/*
* Convert a CIEBasedA color into device color.
*/
@@ -819,19 +813,19 @@ client_remap_CIEBasedA(client_custom_color_params_t * pparams,
gs_color_select_t select)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
frac gray = convert2frac(pc->paint.values[0], pcs->params.a->RangeA);
/*** Demonstrate method to convert to XYZ ***/
if (pdata->CIEtoXYZ_pis) {
- frac xyz[3];
+ frac xyz[3];
- cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
- /* We don't really do anything with these values, but this */
- /* is where a real client could convert to a device color */
- if_debug4('|', "[c]client_remap CIEA [%g] -> XYZ [%g, %g, %g]\n",
- pc->paint.values[0],
- frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
+ cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
+ /* We don't really do anything with these values, but this */
+ /* is where a real client could convert to a device color */
+ if_debug4('|', "[c]client_remap CIEA [%g] -> XYZ [%g, %g, %g]\n",
+ pc->paint.values[0],
+ frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
}
/*
@@ -851,20 +845,20 @@ client_remap_CIEBasedABC(client_custom_color_params_t * pparams,
gs_color_select_t select)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
frac rgb[3];
int i;
/*** Demonstrate method to convert to XYZ ***/
if (pdata->CIEtoXYZ_pis) {
- frac xyz[3];
-
- cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
- /* We don't really do anything with these values, but this */
- /* is where a real client could convert to a device color */
- if_debug6('|', "[c]client_remap CIEABC [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
- pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
- frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
+ frac xyz[3];
+
+ cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
+ /* We don't really do anything with these values, but this */
+ /* is where a real client could convert to a device color */
+ if_debug6('|', "[c]client_remap CIEABC [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
+ pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
+ frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
}
/*
* For demo and debug purposes, make our colors a function of the
@@ -873,8 +867,8 @@ client_remap_CIEBasedABC(client_custom_color_params_t * pparams,
* that they are RGB values.
*/
for (i = 0; i < 3; i++)
- rgb[i] = convert2frac(pc->paint.values[i],
- pcs->params.abc->RangeABC.ranges[i]);
+ rgb[i] = convert2frac(pc->paint.values[i],
+ pcs->params.abc->RangeABC.ranges[i]);
return client_remap_DeviceRGB(pparams, rgb, pcs, pdc, pis, dev, select);
}
@@ -888,20 +882,20 @@ client_remap_CIEBasedDEF(client_custom_color_params_t * pparams,
gs_color_select_t select)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
frac rgb[3];
int i;
/*** Demonstrate method to convert to XYZ ***/
if (pdata->CIEtoXYZ_pis) {
- frac xyz[3];
-
- cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
- /* We don't really do anything with these values, but this */
- /* is where a real client could convert to a device color */
- if_debug6('|', "[c]client_remap CIEDEF [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
- pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
- frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
+ frac xyz[3];
+
+ cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
+ /* We don't really do anything with these values, but this */
+ /* is where a real client could convert to a device color */
+ if_debug6('|', "[c]client_remap CIEDEF [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
+ pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
+ frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
}
/*
* For demo and debug purposes, make our colors a function of the
@@ -910,8 +904,8 @@ client_remap_CIEBasedDEF(client_custom_color_params_t * pparams,
* that they are RGB values.
*/
for (i = 0; i < 3; i++)
- rgb[i] = convert2frac(pc->paint.values[i],
- pcs->params.def->RangeDEF.ranges[i]);
+ rgb[i] = convert2frac(pc->paint.values[i],
+ pcs->params.def->RangeDEF.ranges[i]);
return client_remap_DeviceRGB(pparams, rgb, pcs, pdc, pis, dev, select);
}
@@ -925,21 +919,21 @@ client_remap_CIEBasedDEFG(client_custom_color_params_t * pparams,
gs_color_select_t select)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
frac cmyk[4];
int i;
/*** Demonstrate method to convert to XYZ ***/
if (pdata->CIEtoXYZ_pis) {
- frac xyz[3];
-
- cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
- /* We don't really do anything with these values, but this */
- /* is where a real client could convert to a device color */
- if_debug7('|', "[c]client_remap CIEDEFG [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
- pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
- pc->paint.values[3],
- frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
+ frac xyz[3];
+
+ cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
+ /* We don't really do anything with these values, but this */
+ /* is where a real client could convert to a device color */
+ if_debug7('|', "[c]client_remap CIEDEFG [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
+ pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
+ pc->paint.values[3],
+ frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
}
/*
* For demo and debug purposes, make our colors a function of the
@@ -948,8 +942,8 @@ client_remap_CIEBasedDEFG(client_custom_color_params_t * pparams,
* that they are CMYK values.
*/
for (i = 0; i < 4; i++)
- cmyk[i] = convert2frac(pc->paint.values[i],
- pcs->params.defg->RangeDEFG.ranges[i]);
+ cmyk[i] = convert2frac(pc->paint.values[i],
+ pcs->params.defg->RangeDEFG.ranges[i]);
return client_remap_DeviceRGB(pparams, cmyk, pcs, pdc, pis, dev, select);
}
@@ -963,21 +957,21 @@ client_remap_ICCBased(client_custom_color_params_t * pparams,
gs_color_select_t select)
{
demo_color_space_data_t * pdata =
- (demo_color_space_data_t *)(pcs->pclient_color_space_data);
+ (demo_color_space_data_t *)(pcs->pclient_color_space_data);
frac frac_color[GS_CLIENT_COLOR_MAX_COMPONENTS];
int i, num_values = pcs->params.icc.picc_info->num_components;
/*** Demonstrate method to convert to XYZ ***/
if (pdata->CIEtoXYZ_pis) {
- frac xyz[3];
+ frac xyz[3];
- cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
- /* We don't really do anything with these values, but this */
- /* is where a real client could convert to a device color */
- if_debug6('|', "[c]client_remap ICCBased [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
- pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
- frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
+ cs_concretize_color(pc, pcs, xyz, pdata->CIEtoXYZ_pis);
+ /* We don't really do anything with these values, but this */
+ /* is where a real client could convert to a device color */
+ if_debug6('|', "[c]client_remap ICCBased [%g, %g, %g] -> XYZ [%g, %g, %g]\n",
+ pc->paint.values[0], pc->paint.values[1], pc->paint.values[2],
+ frac2float(xyz[0]), frac2float(xyz[1]), frac2float(xyz[2]));
}
/*
@@ -988,22 +982,22 @@ client_remap_ICCBased(client_custom_color_params_t * pparams,
* gray, RGB, or CMYK values.
*/
for (i = 0; i < num_values; i++)
- frac_color[i] = convert2frac(pc->paint.values[i],
- pcs->params.icc.picc_info->Range.ranges[i]);
+ frac_color[i] = convert2frac(pc->paint.values[i],
+ pcs->params.icc.picc_info->Range.ranges[i]);
switch (num_values) {
- case 0:
- case 2:
- return_error(gs_error_rangecheck);
- case 1:
- return client_remap_DeviceGray(pparams, frac_color, pcs,
- pdc, pis, dev, select);
- case 3:
- return client_remap_DeviceRGB(pparams, frac_color, pcs,
- pdc, pis, dev, select);
- case 4:
- default:
- return client_remap_DeviceCMYK(pparams, frac_color, pcs,
- pdc, pis, dev, select);
+ case 0:
+ case 2:
+ return_error(gs_error_rangecheck);
+ case 1:
+ return client_remap_DeviceGray(pparams, frac_color, pcs,
+ pdc, pis, dev, select);
+ case 3:
+ return client_remap_DeviceRGB(pparams, frac_color, pcs,
+ pdc, pis, dev, select);
+ case 4:
+ default:
+ return client_remap_DeviceCMYK(pparams, frac_color, pcs,
+ pdc, pis, dev, select);
}
}
@@ -1013,33 +1007,33 @@ client_remap_ICCBased(client_custom_color_params_t * pparams,
#if PANTONE_ONLY
- /*
- * For PANTONE colors, we only need to handle Separation and DeviceN
- * color spaces. These are the only color spaces that can have PANTONE
- * colors.
- */
- client_custom_color_procs_t demo_procs = {
- client_install_no_op, /* DeviceGray */
- NULL,
- client_install_no_op, /* DeviceRGB */
- NULL,
- client_install_no_op, /* DeviceCMYK */
- NULL,
- client_pantone_install_Separation, /* Separation */
- client_pantone_remap_Separation,
- client_pantone_install_DeviceN, /* DeviceN */
- client_pantone_remap_DeviceN,
- client_install_no_op, /* CIEBasedA */
- NULL,
- client_install_no_op, /* CIEBasedABC */
- NULL,
- client_install_no_op, /* CIEBasedDEF */
- NULL,
- client_install_no_op, /* CIEBasedDEFG */
- NULL,
- client_install_no_op, /* ICCBased */
- NULL
- };
+ /*
+ * For PANTONE colors, we only need to handle Separation and DeviceN
+ * color spaces. These are the only color spaces that can have PANTONE
+ * colors.
+ */
+ client_custom_color_procs_t demo_procs = {
+ client_install_no_op, /* DeviceGray */
+ NULL,
+ client_install_no_op, /* DeviceRGB */
+ NULL,
+ client_install_no_op, /* DeviceCMYK */
+ NULL,
+ client_pantone_install_Separation, /* Separation */
+ client_pantone_remap_Separation,
+ client_pantone_install_DeviceN, /* DeviceN */
+ client_pantone_remap_DeviceN,
+ client_install_no_op, /* CIEBasedA */
+ NULL,
+ client_install_no_op, /* CIEBasedABC */
+ NULL,
+ client_install_no_op, /* CIEBasedDEF */
+ NULL,
+ client_install_no_op, /* CIEBasedDEFG */
+ NULL,
+ client_install_no_op, /* ICCBased */
+ NULL
+ };
#else /* Not PANTONE_ONLY special */
diff --git a/gs/base/gsncdummy.h b/gs/base/gsncdummy.h
index 542668a0e..07718da95 100644
--- a/gs/base/gsncdummy.h
+++ b/gs/base/gsncdummy.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,6 @@ typedef struct pantone_list_s {
double c, m, y, k; /* Equivalent CMYK values */
} pantone_list_t;
-
#endif /* if ENABLE_CUSTOM_COLOR_CALLBACK */
#endif /* if gsncdummy_INCLUDED */
diff --git a/gs/base/gsnogc.c b/gs/base/gsnogc.c
index 3096920c4..884aad52e 100644
--- a/gs/base/gsnogc.c
+++ b/gs/base/gsnogc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,6 @@
#include "gsstruct.h"
#include "gxalloc.h"
-
/* String allocations reduces to simple byte allocations. */
static byte *
nogc_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
@@ -73,17 +72,17 @@ gs_nogc_reclaim(vm_spaces * pspaces, bool global)
gs_ref_memory_t *mem_prev = 0;
for (space = 0; space < countof(pspaces->memories.indexed); ++space) {
- gs_ref_memory_t *mem = pspaces->memories.indexed[space];
+ gs_ref_memory_t *mem = pspaces->memories.indexed[space];
- if (mem == 0 || mem == mem_prev)
- continue;
+ if (mem == 0 || mem == mem_prev)
+ continue;
- mem_prev = mem;
+ mem_prev = mem;
set_procs(mem);
gs_consolidate_free((gs_memory_t *)mem);
- if (mem->stable_memory != (gs_memory_t *)mem &&
- mem->stable_memory != 0
- ) {
+ if (mem->stable_memory != (gs_memory_t *)mem &&
+ mem->stable_memory != 0
+ ) {
set_procs((gs_ref_memory_t *)mem->stable_memory);
gs_consolidate_free((gs_memory_t *)mem->stable_memory);
}
diff --git a/gs/base/gsnogc.h b/gs/base/gsnogc.h
index b8666983e..0e3d3c048 100644
--- a/gs/base/gsnogc.h
+++ b/gs/base/gsnogc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsnorop.c b/gs/base/gsnorop.c
index e3a48d821..fe26b4353 100644
--- a/gs/base/gsnorop.c
+++ b/gs/base/gsnorop.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,33 +40,33 @@ gs_set_logical_op(gs_state * pgs, gs_logical_operation_t lop)
int
mem_mono_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_rangecheck);
}
int
mem_gray_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_rangecheck);
}
int
mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_rangecheck);
}
@@ -75,33 +75,33 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
int
gx_default_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_tile_bitmap * texture, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_unknownerror); /* not implemented */
}
int
gx_default_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_unknownerror); /* not implemented */
}
int
mem_default_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
return_error(gs_error_unknownerror); /* not implemented */
}
@@ -110,13 +110,13 @@ mem_default_strip_copy_rop(gx_device * dev,
int
gx_alloc_rop_texture_device(gx_device_rop_texture ** prsdev, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
return_error(gs_error_rangecheck);
}
void
gx_make_rop_texture_device(gx_device_rop_texture * dev, gx_device * target,
- gs_logical_operation_t log_op, const gx_device_color * texture)
+ gs_logical_operation_t log_op, const gx_device_color * texture)
{ /* Never called. */
}
diff --git a/gs/base/gsnotify.c b/gs/base/gsnotify.c
index 170fa485a..82c36674a 100644
--- a/gs/base/gsnotify.c
+++ b/gs/base/gsnotify.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,14 +33,14 @@ gs_notify_init(gs_notify_list_t *nlist, gs_memory_t *mem)
/* Register a client. */
int
gs_notify_register(gs_notify_list_t *nlist, gs_notify_proc_t proc,
- void *proc_data)
+ void *proc_data)
{
gs_notify_registration_t *nreg =
- gs_alloc_struct(nlist->memory, gs_notify_registration_t,
- &st_gs_notify_registration, "gs_notify_register");
+ gs_alloc_struct(nlist->memory, gs_notify_registration_t,
+ &st_gs_notify_registration, "gs_notify_register");
if (nreg == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
nreg->proc = proc;
nreg->proc_data = proc_data;
nreg->next = nlist->first;
@@ -59,28 +59,28 @@ no_unreg_proc(void *pdata)
}
int
gs_notify_unregister_calling(gs_notify_list_t *nlist, gs_notify_proc_t proc,
- void *proc_data,
- void (*unreg_proc)(void *pdata))
+ void *proc_data,
+ void (*unreg_proc)(void *pdata))
{
gs_notify_registration_t **prev = &nlist->first;
gs_notify_registration_t *cur;
bool found = 0;
while ((cur = *prev) != 0)
- if (cur->proc == proc &&
- (proc_data == 0 || cur->proc_data == proc_data)
- ) {
- *prev = cur->next;
- unreg_proc(cur->proc_data);
- gs_free_object(nlist->memory, cur, "gs_notify_unregister");
- found = 1;
- } else
- prev = &cur->next;
+ if (cur->proc == proc &&
+ (proc_data == 0 || cur->proc_data == proc_data)
+ ) {
+ *prev = cur->next;
+ unreg_proc(cur->proc_data);
+ gs_free_object(nlist->memory, cur, "gs_notify_unregister");
+ found = 1;
+ } else
+ prev = &cur->next;
return found;
}
int
gs_notify_unregister(gs_notify_list_t *nlist, gs_notify_proc_t proc,
- void *proc_data)
+ void *proc_data)
{
return gs_notify_unregister_calling(nlist, proc, proc_data, no_unreg_proc);
}
@@ -97,12 +97,12 @@ gs_notify_all(gs_notify_list_t *nlist, void *event_data)
int ecode = 0;
for (next = nlist->first; (cur = next) != 0;) {
- int code;
+ int code;
- next = cur->next;
- code = cur->proc(cur->proc_data, event_data);
- if (code < 0 && ecode == 0)
- ecode = code;
+ next = cur->next;
+ code = cur->proc(cur->proc_data, event_data);
+ if (code < 0 && ecode == 0)
+ ecode = code;
}
return ecode;
}
@@ -114,9 +114,9 @@ gs_notify_release(gs_notify_list_t *nlist)
gs_memory_t *mem = nlist->memory;
while (nlist->first) {
- gs_notify_registration_t *next = nlist->first->next;
+ gs_notify_registration_t *next = nlist->first->next;
- gs_free_object(mem, nlist->first, "gs_notify_release");
- nlist->first = next;
+ gs_free_object(mem, nlist->first, "gs_notify_release");
+ nlist->first = next;
}
}
diff --git a/gs/base/gsnotify.h b/gs/base/gsnotify.h
index b94308869..e77173b7c 100644
--- a/gs/base/gsnotify.h
+++ b/gs/base/gsnotify.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -61,7 +61,7 @@ void gs_notify_init(gs_notify_list_t *nlist, gs_memory_t *mem);
/* Register a client. */
int gs_notify_register(gs_notify_list_t *nlist, gs_notify_proc_t proc,
- void *proc_data);
+ void *proc_data);
/*
* Unregister a client. Return 1 if the client was registered, 0 if not.
@@ -69,12 +69,12 @@ int gs_notify_register(gs_notify_list_t *nlist, gs_notify_proc_t proc,
* unregister only the registration of that procedure with that proc_data.
*/
int gs_notify_unregister(gs_notify_list_t *nlist, gs_notify_proc_t proc,
- void *proc_data);
+ void *proc_data);
/* Unregister a client, calling a procedure for each unregistration. */
int gs_notify_unregister_calling(gs_notify_list_t *nlist,
- gs_notify_proc_t proc, void *proc_data,
- void (*unreg_proc)(void *pdata));
+ gs_notify_proc_t proc, void *proc_data,
+ void (*unreg_proc)(void *pdata));
/*
* Notify the clients on a list. If an error occurs, return the first
diff --git a/gs/base/gsovrc.c b/gs/base/gsovrc.c
index 3f9fa4a5e..245e993f8 100644
--- a/gs/base/gsovrc.c
+++ b/gs/base/gsovrc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,7 +28,6 @@
#include "gsbitops.h"
#include "gxistate.h"
-
/* GC descriptor for gs_overprint_t */
private_st_gs_overprint_t();
@@ -152,7 +151,7 @@ c_overprint_write(const gs_composite_t * pct, byte * data, uint * psize, gx_devi
if (code < 0 && code != gs_error_rangecheck)
return code;
used += tmp_size;
- }
+ }
}
/* check for overflow */
@@ -201,13 +200,13 @@ c_overprint_read(
}
/*
- * Check for closing compositor.
+ * Check for closing compositor.
*/
static int
c_overprint_is_closing(const gs_composite_t *this, gs_composite_t **ppcte, gx_device *dev)
{
if (*ppcte != NULL && (*ppcte)->type->comp_id != GX_COMPOSITOR_OVERPRINT)
- return 0;
+ return 0;
return 3;
}
@@ -226,16 +225,15 @@ const gs_composite_type_t gs_composite_overprint_type = {
c_overprint_equal, /* procs.equal */
c_overprint_write, /* procs.write */
c_overprint_read, /* procs.read */
- gx_default_composite_adjust_ctm,
- c_overprint_is_closing,
- gx_default_composite_is_friendly,
- gx_default_composite_clist_write_update,/* procs.composite_clist_write_update */
- gx_default_composite_clist_read_update, /* procs.composite_clist_reade_update */
- gx_default_composite_get_cropping /* procs.composite_get_cropping */
+ gx_default_composite_adjust_ctm,
+ c_overprint_is_closing,
+ gx_default_composite_is_friendly,
+ gx_default_composite_clist_write_update,/* procs.composite_clist_write_update */
+ gx_default_composite_clist_read_update, /* procs.composite_clist_reade_update */
+ gx_default_composite_get_cropping /* procs.composite_get_cropping */
} /* procs */
};
-
/*
* Create an overprint compositor data structure.
*
@@ -250,9 +248,9 @@ gs_create_overprint(
gs_overprint_t * pct;
pct = gs_alloc_struct(mem, gs_overprint_t, &st_overprint,
- "gs_create_overprint");
+ "gs_create_overprint");
if (pct == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pct->type = &gs_composite_overprint_type;
pct->id = gs_next_ids(mem, 1);
pct->params = *pparams;
@@ -261,7 +259,6 @@ gs_create_overprint(
return 0;
}
-
/*
* Verify that a compositor data structure is for the overprint compositor.
* This is used by the gs_pdf1.4_device (and eventually the PDFWrite
@@ -273,7 +270,6 @@ gs_is_overprint_compositor(const gs_composite_t * pct)
return pct->type == &gs_composite_overprint_type;
}
-
/*
* The overprint device.
*
@@ -339,7 +335,6 @@ gs_private_st_suffix_add0_final( st_overprint_device_t,
gx_device_finalize,
st_device_forward );
-
/*
* In the default (overprint false) case, the overprint device is almost
* a pure forwarding device: only the open_device and create_compositor
@@ -425,7 +420,7 @@ static const gx_device_procs no_overprint_procs = {
gx_forward_fillpage,
0, /* push_transparency_state */
0, /* pop_transparency_state */
- 0 /* put_image */
+ 0 /* put_image */
};
/*
@@ -584,8 +579,6 @@ const overprint_device_t gs_overprint_device = {
{ 0 } /* procs */
};
-
-
/*
* Utility to reorder bytes in a color or mask based on the endianness of
* the current device. This is required on little-endian machines if the
@@ -764,7 +757,6 @@ update_overprint_params(
return 0;
}
-
/*
* The open_device method for the overprint device is about as close to
* a pure "forwarding" open_device operation as is possible. Its only
@@ -800,7 +792,6 @@ overprint_put_params(gx_device * dev, gs_param_list * plist)
gx_device * tdev = opdev->target;
int code = 0;
-
if (tdev != 0 && (code = dev_proc(tdev, put_params)(tdev, plist)) >= 0) {
gx_device_decache_colors(dev);
if (!tdev->is_open)
@@ -815,18 +806,18 @@ overprint_put_params(gx_device * dev, gs_param_list * plist)
*/
int
overprint_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
overprint_device_t * opdev = (overprint_device_t *)dev;
gx_device * tdev = opdev->target;
int code;
if (tdev == 0)
- code = gx_error_get_color_comp_index(dev, pname,
- name_size, component_type);
+ code = gx_error_get_color_comp_index(dev, pname,
+ name_size, component_type);
else {
- code = dev_proc(tdev, get_color_comp_index)(tdev, pname,
- name_size, component_type);
+ code = dev_proc(tdev, get_color_comp_index)(tdev, pname,
+ name_size, component_type);
opdev->color_info = tdev->color_info;
}
return code;
@@ -862,10 +853,10 @@ overprint_create_compositor(
if (pct->type != &gs_composite_overprint_type)
return gx_default_create_compositor(dev, pcdev, pct, pis, memory, cdev);
else {
- gs_overprint_params_t params = ((const gs_overprint_t *)pct)->params;
+ gs_overprint_params_t params = ((const gs_overprint_t *)pct)->params;
int code;
- params.idle = pct->idle;
+ params.idle = pct->idle;
/* device must already exist, so just update the parameters */
code = update_overprint_params(
(overprint_device_t *)dev,
@@ -876,7 +867,6 @@ overprint_create_compositor(
}
}
-
/*
* The two rectangle-filling routines (which do the actual work) are just
* stubbs for the time being. The actual routines would allocate a buffer,
@@ -963,7 +953,6 @@ overprint_sep_fill_rectangle(
}
}
-
/* complete a procedure set */
static void
fill_in_procs(gx_device_procs * pprocs)
@@ -1024,7 +1013,7 @@ c_overprint_create_default_compositor(
}
if (pct->idle) {
*popdev = tdev;
- return 0;
+ return 0;
}
/* build the overprint device */
@@ -1035,7 +1024,7 @@ c_overprint_create_default_compositor(
*popdev = (gx_device *)opdev;
if (opdev == NULL)
return_error(gs_error_VMerror);
- gx_device_init( (gx_device *)opdev,
+ gx_device_init( (gx_device *)opdev,
(const gx_device *)&gs_overprint_device,
mem,
true );
diff --git a/gs/base/gsovrc.h b/gs/base/gsovrc.h
index 6fefada3a..cc59deb66 100644
--- a/gs/base/gsovrc.h
+++ b/gs/base/gsovrc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,7 +59,7 @@
* these devices both overprint and overprint mode require a form
* of mixing of the drawing color with any existing output. This
* mixing is mechanically similar to that required for transparency
- * or raster op support, but differs from these because it affects
+ * or raster op support, but differs from these because it affects
* different color components differently (transparency and raster
* operations are applied uniformly to all color components).
*
@@ -67,7 +67,7 @@
* either trivial or essentially impossible (short of dealing with them
* as low level devices), the discussion below is restricted to the
* implementation for low level devices.
- *
+ *
* In principle, the effects of overprint and overprint mode are
* modified by changes to the current color, the current color space,
* and the process color model.
@@ -96,8 +96,8 @@
* of two additional types of the devices for rendering. Forwarding
* devices do not generate output of their own; they merely forward
* rendering commands to a target device. Accumulating devices render
- * output to a special buffer (often part of clipping or a caching
- * operation), which is subsequently sent to the primary output device
+ * output to a special buffer (often part of clipping or a caching
+ * operation), which is subsequently sent to the primary output device
* in a lower-level form.
*
* It is conceivable that a forwarding device could be dependent on the
@@ -129,7 +129,7 @@
* the high-level rendering methods (fill_path, etc.). Actual
* rendering is done with a separate marking device, an instance
* of which is created for each graphic object rendered. The
- * marking device renders into the output buffer of the
+ * marking device renders into the output buffer of the
* gs_pdf14_device, which contains the results of prior rendering
* operations. Thus, overprint is significant to the marking
* device. The interaction of transparency and overprint are,
@@ -260,8 +260,8 @@ struct gs_overprint_params_s {
*/
bool retain_spot_comps;
- /*
- * Don't we print anything with overprint ?
+ /*
+ * Don't we print anything with overprint ?
* This info may come from the clist reader.
*/
bool idle;
@@ -296,8 +296,6 @@ typedef struct gs_overprint_s {
#define private_st_gs_overprint_t() /* In gsovrc.c */\
gs_private_st_simple(st_overprint, gs_overprint_t, "gs_overprint_t")
-
-
/* some elementary macros for manipulating drawn_comps */
#define gs_overprint_set_drawn_comp(drawn_comps, i) \
((drawn_comps) |= (gx_color_index)1 << (i))
@@ -311,7 +309,6 @@ typedef struct gs_overprint_s {
#define gs_overprint_get_drawn_comp(drawn_comps, i) \
(((drawn_comps) & ((gx_color_index)1 << (i))) != 0)
-
/*
* In the unlikely event that the overprint parameters will ever be
* allocated on the heap, we provide GC structure descriptors for
@@ -324,7 +321,6 @@ extern_st(st_overprint_params);
gs_overprint_params_t, \
"gs_overprint_params_t" )
-
/* create an overprint composition object */
extern int gs_create_overprint(
gs_composite_t ** ppct,
diff --git a/gs/base/gspaint.c b/gs/base/gspaint.c
index 680d718a8..82e060e3a 100644
--- a/gs/base/gspaint.c
+++ b/gs/base/gspaint.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,10 +57,10 @@ gs_erasepage(gs_state * pgs)
int code;
if ((code = gs_gsave(pgs)) < 0)
- return code;
+ return code;
if ((code = gs_setgray(pgs, 1.0)) >= 0) {
- /* Fill the page directly, ignoring clipping. */
- code = gs_fillpage(pgs);
+ /* Fill the page directly, ignoring clipping. */
+ code = gs_fillpage(pgs);
}
gs_grestore(pgs);
return code;
@@ -74,12 +74,12 @@ gs_fillpage(gs_state * pgs)
int code;
/* If we get here without a valid get_color_mapping_procs, fail */
- if (dev_proc(dev, get_color_mapping_procs) == NULL ||
+ if (dev_proc(dev, get_color_mapping_procs) == NULL ||
dev_proc(dev, get_color_mapping_procs) == gx_error_get_color_mapping_procs) {
- emprintf1(dev->memory,
+ emprintf1(dev->memory,
"\n *** Error: No get_color_mapping_procs for device: %s\n",
dev->dname);
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
}
/* Processing a fill object operation */
gs_set_object_tag((gs_imager_state*) pgs, GS_PATH_TAG);
@@ -87,9 +87,9 @@ gs_fillpage(gs_state * pgs)
gx_set_dev_color(pgs);
code = (*dev_proc(dev, fillpage))(dev, (gs_imager_state *)pgs,
- gs_currentdevicecolor_inline(pgs));
+ gs_currentdevicecolor_inline(pgs));
if (code < 0)
- return code;
+ return code;
return (*dev_proc(dev, sync_output)) (dev);
}
/*
@@ -114,44 +114,44 @@ scale_paths(gs_state * pgs, int log2_scale_x, int log2_scale_y, bool do_path)
* aliased.
*/
const gx_path_segments *seg_clip =
- (pgs->clip_path->path_valid ? pgs->clip_path->path.segments : 0);
+ (pgs->clip_path->path_valid ? pgs->clip_path->path.segments : 0);
const gx_clip_rect_list *list_clip = pgs->clip_path->rect_list;
const gx_path_segments *seg_view_clip;
const gx_clip_rect_list *list_view_clip;
const gx_path_segments *seg_effective_clip =
- (pgs->effective_clip_path->path_valid ?
- pgs->effective_clip_path->path.segments : 0);
+ (pgs->effective_clip_path->path_valid ?
+ pgs->effective_clip_path->path.segments : 0);
const gx_clip_rect_list *list_effective_clip =
- pgs->effective_clip_path->rect_list;
+ pgs->effective_clip_path->rect_list;
gx_cpath_scale_exp2_shared(pgs->clip_path, log2_scale_x, log2_scale_y,
- false, false);
+ false, false);
if (pgs->view_clip != 0 && pgs->view_clip != pgs->clip_path) {
- seg_view_clip =
- (pgs->view_clip->path_valid ? pgs->view_clip->path.segments : 0);
- list_view_clip = pgs->view_clip->rect_list;
- gx_cpath_scale_exp2_shared(pgs->view_clip, log2_scale_x, log2_scale_y,
- list_view_clip == list_clip,
- seg_view_clip && seg_view_clip == seg_clip);
+ seg_view_clip =
+ (pgs->view_clip->path_valid ? pgs->view_clip->path.segments : 0);
+ list_view_clip = pgs->view_clip->rect_list;
+ gx_cpath_scale_exp2_shared(pgs->view_clip, log2_scale_x, log2_scale_y,
+ list_view_clip == list_clip,
+ seg_view_clip && seg_view_clip == seg_clip);
} else
- seg_view_clip = 0, list_view_clip = 0;
+ seg_view_clip = 0, list_view_clip = 0;
if (pgs->effective_clip_path != pgs->clip_path &&
- pgs->effective_clip_path != pgs->view_clip
- )
- gx_cpath_scale_exp2_shared(pgs->effective_clip_path, log2_scale_x,
- log2_scale_y,
- list_effective_clip == list_clip ||
- list_effective_clip == list_view_clip,
- seg_effective_clip &&
- (seg_effective_clip == seg_clip ||
- seg_effective_clip == seg_view_clip));
+ pgs->effective_clip_path != pgs->view_clip
+ )
+ gx_cpath_scale_exp2_shared(pgs->effective_clip_path, log2_scale_x,
+ log2_scale_y,
+ list_effective_clip == list_clip ||
+ list_effective_clip == list_view_clip,
+ seg_effective_clip &&
+ (seg_effective_clip == seg_clip ||
+ seg_effective_clip == seg_view_clip));
if (do_path) {
- const gx_path_segments *seg_path = pgs->path->segments;
+ const gx_path_segments *seg_path = pgs->path->segments;
- gx_path_scale_exp2_shared(pgs->path, log2_scale_x, log2_scale_y,
- seg_path == seg_clip ||
- seg_path == seg_view_clip ||
- seg_path == seg_effective_clip);
+ gx_path_scale_exp2_shared(pgs->path, log2_scale_x, log2_scale_y,
+ seg_path == seg_clip ||
+ seg_path == seg_view_clip ||
+ seg_path == seg_effective_clip);
}
return 0;
}
@@ -161,12 +161,12 @@ scale_dash_pattern(gs_state * pgs, floatp scale)
int i;
for (i = 0; i < pgs->line_params.dash.pattern_size; ++i)
- pgs->line_params.dash.pattern[i] *= scale;
+ pgs->line_params.dash.pattern[i] *= scale;
pgs->line_params.dash.offset *= scale;
pgs->line_params.dash.pattern_length *= scale;
pgs->line_params.dash.init_dist_left *= scale;
if (pgs->line_params.dot_length_absolute)
- pgs->line_params.dot_length *= scale;
+ pgs->line_params.dot_length *= scale;
}
static int
alpha_buffer_init(gs_state * pgs, fixed extra_x, fixed extra_y, int alpha_bits)
@@ -192,26 +192,26 @@ alpha_buffer_init(gs_state * pgs, fixed extra_x, fixed extra_y, int alpha_bits)
band_space = raster << log2_scale.y;
height = (abuf_nominal / band_space) << log2_scale.y;
if (height == 0)
- height = 1 << log2_scale.y;
+ height = 1 << log2_scale.y;
mem = pgs->memory;
mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "alpha_buffer_init");
+ "alpha_buffer_init");
if (mdev == 0)
- return 0; /* if no room, don't buffer */
+ return 0; /* if no room, don't buffer */
/* We may have to update the marking parameters if we have a pdf14 device
as our target. Need to do while dev is still active in pgs */
if (dev_proc(dev, dev_spec_op)(dev, gxdso_is_pdf14_device, NULL, 0)) {
gs_update_trans_marking_params(pgs);
}
gs_make_mem_abuf_device(mdev, mem, dev, &log2_scale,
- alpha_bits, ibox.p.x << log2_scale.x);
+ alpha_bits, ibox.p.x << log2_scale.x);
mdev->width = width;
mdev->height = height;
mdev->bitmap_memory = mem;
if ((*dev_proc(mdev, open_device)) ((gx_device *) mdev) < 0) {
- /* No room for bits, punt. */
- gs_free_object(mem, mdev, "alpha_buffer_init");
- return 0;
+ /* No room for bits, punt. */
+ gs_free_object(mem, mdev, "alpha_buffer_init");
+ return 0;
}
gx_set_device_only(pgs, (gx_device *) mdev);
scale_paths(pgs, log2_scale.x, log2_scale.y, true);
@@ -223,12 +223,12 @@ static int
alpha_buffer_release(gs_state * pgs, bool newpath)
{
gx_device_memory *mdev =
- (gx_device_memory *) gs_currentdevice_inline(pgs);
+ (gx_device_memory *) gs_currentdevice_inline(pgs);
int code = (*dev_proc(mdev, close_device)) ((gx_device *) mdev);
if (code >= 0)
- scale_paths(pgs, -mdev->log2_scale.x, -mdev->log2_scale.y,
- !(newpath && !gx_path_is_shared(pgs->path)));
+ scale_paths(pgs, -mdev->log2_scale.x, -mdev->log2_scale.y,
+ !(newpath && !gx_path_is_shared(pgs->path)));
/* Reference counting will free mdev. */
gx_set_device_only(pgs, mdev->target);
return code;
@@ -243,7 +243,7 @@ static int do_fill(gs_state *pgs, int rule)
or to rasterize a vector graphics to the output device.
Currently we assume it works for the bitrgbtags device only,
which is a low level device with a 4-component color model.
- We use the fact that with printers a character is usually being rendered
+ We use the fact that with printers a character is usually being rendered
to a 1bpp cache device rather than to the output device.
Therefore we hackly look whether the target device
"has a color" : either it's a multicomponent color model,
@@ -252,45 +252,45 @@ static int do_fill(gs_state *pgs, int rule)
This check has several limitations :
1. It doesn't work with -dNOCACHE.
2. It doesn't work with large characters,
- which cannot fit into a cache cell and thus they
- render directly to the output device.
+ which cannot fit into a cache cell and thus they
+ render directly to the output device.
3. It doesn't work for TextAlphaBits=2 or 4.
- We don't care of this case because
- text antialiasing usually usn't applied to printers.
+ We don't care of this case because
+ text antialiasing usually usn't applied to printers.
4. It doesn't work for things like with "(xyz) true charpath stroke".
- That's unfortunate, we'd like to improve someday.
+ That's unfortunate, we'd like to improve someday.
5. It doesn't work for high level devices when a Type 3 character is being constructed.
- This case is not important for low level devices
- (which a printer is), because low level device doesn't accept
- Type 3 charproc streams immediately.
+ This case is not important for low level devices
+ (which a printer is), because low level device doesn't accept
+ Type 3 charproc streams immediately.
6. It doesn't work properly while an insiding testing,
- which sets gs_hit_device, which is uncolored.
+ which sets gs_hit_device, which is uncolored.
*/
if (gx_device_has_color(gs_currentdevice(pgs))) {
- gs_set_object_tag((gs_imager_state*) pgs, GS_PATH_TAG);
+ gs_set_object_tag((gs_imager_state*) pgs, GS_PATH_TAG);
}
else {
- gs_set_object_tag((gs_imager_state*) pgs, GS_TEXT_TAG);
+ gs_set_object_tag((gs_imager_state*) pgs, GS_TEXT_TAG);
}
gx_set_dev_color(pgs);
code = gs_state_color_load(pgs);
if (code < 0)
- return code;
+ return code;
abits = alpha_buffer_bits(pgs);
if (!color_is_pure(gs_currentdevicecolor_inline(pgs))) {
abits = 0;
}
if (abits > 1) {
- acode = alpha_buffer_init(pgs, pgs->fill_adjust.x,
- pgs->fill_adjust.y, abits);
- if (acode < 0)
- return acode;
+ acode = alpha_buffer_init(pgs, pgs->fill_adjust.x,
+ pgs->fill_adjust.y, abits);
+ if (acode < 0)
+ return acode;
} else
- acode = 0;
+ acode = 0;
code = gx_fill_path(pgs->path, gs_currentdevicecolor_inline(pgs), pgs, rule,
- pgs->fill_adjust.x, pgs->fill_adjust.y);
+ pgs->fill_adjust.x, pgs->fill_adjust.y);
if (acode > 0)
- rcode = alpha_buffer_release(pgs, code >= 0);
+ rcode = alpha_buffer_release(pgs, code >= 0);
if (code >= 0 && rcode < 0)
code = rcode;
@@ -306,8 +306,8 @@ fill_with_rule(gs_state * pgs, int rule)
/* If we're inside a charpath, just merge the current path */
/* into the parent's path. */
if (pgs->in_charpath)
- code = gx_path_add_char_path(pgs->show_gstate->path, pgs->path,
- pgs->in_charpath);
+ code = gx_path_add_char_path(pgs->show_gstate->path, pgs->path,
+ pgs->in_charpath);
/* If we're rendering a glyph cached, the show machinery decides
* whether to actually image it on the output or not, but uncached
* will render directly to the output, so for text rendering
@@ -317,13 +317,13 @@ fill_with_rule(gs_state * pgs, int rule)
else if (gs_is_null_device(pgs->device)
|| (pgs->show_gstate && pgs->text_rendering_mode == 3
&& pgs->in_cachedevice == CACHE_DEVICE_NOT_CACHING)) {
- /* Handle separately to prevent gs_state_color_load - bug 688308. */
- gs_newpath(pgs);
- code = 0;
+ /* Handle separately to prevent gs_state_color_load - bug 688308. */
+ gs_newpath(pgs);
+ code = 0;
} else {
code = do_fill(pgs, rule);
- if (code >= 0)
- gs_newpath(pgs);
+ if (code >= 0)
+ gs_newpath(pgs);
}
return code;
}
@@ -360,7 +360,7 @@ do_stroke(gs_state * pgs)
or to rasterize a vector graphics to the output device.
Currently we assume it works for the bitrgbtags device only,
which is a low level device with a 4-component color model.
- We use the fact that with printers a character is usually being rendered
+ We use the fact that with printers a character is usually being rendered
to a 1bpp cache device rather than to the output device.
Therefore we hackly look whether the target device
"has a color" : either it's a multicomponent color model,
@@ -382,69 +382,69 @@ do_stroke(gs_state * pgs)
Type 3 charproc streams immediately.
*/
if (gx_device_has_color(gs_currentdevice(pgs))) {
- gs_set_object_tag((gs_imager_state*) pgs, GS_PATH_TAG);
+ gs_set_object_tag((gs_imager_state*) pgs, GS_PATH_TAG);
}
else {
- gs_set_object_tag((gs_imager_state*) pgs, GS_TEXT_TAG);
+ gs_set_object_tag((gs_imager_state*) pgs, GS_TEXT_TAG);
}
/* Evil: The following call is a macro that might return! */
gx_set_dev_color(pgs);
code = gs_state_color_load(pgs);
if (code < 0)
- return code;
+ return code;
abits = alpha_buffer_bits(pgs);
if (!color_is_pure(gs_currentdevicecolor_inline(pgs))) {
abits = 0;
}
if (abits > 1) {
- /*
- * Expand the bounding box by the line width.
- * This is expensive to compute, so we only do it
- * if we know we're going to buffer.
- */
- float xxyy = fabs(pgs->ctm.xx) + fabs(pgs->ctm.yy);
- float xyyx = fabs(pgs->ctm.xy) + fabs(pgs->ctm.yx);
- float scale = (float)(1 << (abits / 2));
- float orig_width = gs_currentlinewidth(pgs);
- float new_width = orig_width * scale;
- fixed extra_adjust =
- float2fixed(max(xxyy, xyyx) * new_width / 2);
- float orig_flatness = gs_currentflat(pgs);
- gx_path spath;
-
- /* Scale up the line width, dash pattern, and flatness. */
- if (extra_adjust < fixed_1)
- extra_adjust = fixed_1;
- acode = alpha_buffer_init(pgs,
- pgs->fill_adjust.x + extra_adjust,
- pgs->fill_adjust.y + extra_adjust,
- abits);
- if (acode < 0)
- return acode;
- gs_setlinewidth(pgs, new_width);
- scale_dash_pattern(pgs, scale);
- gs_setflat(pgs, orig_flatness * scale);
- /*
- * The alpha-buffer device requires that we fill the
- * entire path as a single unit.
- */
- gx_path_init_local(&spath, pgs->memory);
- code = gx_stroke_add(pgs->path, &spath, pgs, false);
- gs_setlinewidth(pgs, orig_width);
- scale_dash_pattern(pgs, 1.0 / scale);
- if (code >= 0)
- code = gx_fill_path(&spath, gs_currentdevicecolor_inline(pgs), pgs,
- gx_rule_winding_number,
- pgs->fill_adjust.x,
- pgs->fill_adjust.y);
- gs_setflat(pgs, orig_flatness);
- gx_path_free(&spath, "gs_stroke");
- if (acode > 0)
- rcode = alpha_buffer_release(pgs, code >= 0);
+ /*
+ * Expand the bounding box by the line width.
+ * This is expensive to compute, so we only do it
+ * if we know we're going to buffer.
+ */
+ float xxyy = fabs(pgs->ctm.xx) + fabs(pgs->ctm.yy);
+ float xyyx = fabs(pgs->ctm.xy) + fabs(pgs->ctm.yx);
+ float scale = (float)(1 << (abits / 2));
+ float orig_width = gs_currentlinewidth(pgs);
+ float new_width = orig_width * scale;
+ fixed extra_adjust =
+ float2fixed(max(xxyy, xyyx) * new_width / 2);
+ float orig_flatness = gs_currentflat(pgs);
+ gx_path spath;
+
+ /* Scale up the line width, dash pattern, and flatness. */
+ if (extra_adjust < fixed_1)
+ extra_adjust = fixed_1;
+ acode = alpha_buffer_init(pgs,
+ pgs->fill_adjust.x + extra_adjust,
+ pgs->fill_adjust.y + extra_adjust,
+ abits);
+ if (acode < 0)
+ return acode;
+ gs_setlinewidth(pgs, new_width);
+ scale_dash_pattern(pgs, scale);
+ gs_setflat(pgs, orig_flatness * scale);
+ /*
+ * The alpha-buffer device requires that we fill the
+ * entire path as a single unit.
+ */
+ gx_path_init_local(&spath, pgs->memory);
+ code = gx_stroke_add(pgs->path, &spath, pgs, false);
+ gs_setlinewidth(pgs, orig_width);
+ scale_dash_pattern(pgs, 1.0 / scale);
+ if (code >= 0)
+ code = gx_fill_path(&spath, gs_currentdevicecolor_inline(pgs), pgs,
+ gx_rule_winding_number,
+ pgs->fill_adjust.x,
+ pgs->fill_adjust.y);
+ gs_setflat(pgs, orig_flatness);
+ gx_path_free(&spath, "gs_stroke");
+ if (acode > 0)
+ rcode = alpha_buffer_release(pgs, code >= 0);
} else
- code = gx_stroke_fill(pgs->path, pgs);
+ code = gx_stroke_fill(pgs->path, pgs);
if (code >= 0 && rcode < 0)
- code = rcode;
+ code = rcode;
return code;
}
@@ -459,26 +459,26 @@ gs_stroke(gs_state * pgs)
* into the parent's path.
*/
if (pgs->in_charpath) {
- if (pgs->in_charpath == cpm_true_charpath) {
- /*
- * A stroke inside a true charpath should do the
- * equivalent of strokepath.
- */
- code = gs_strokepath(pgs);
- if (code < 0)
- return code;
- }
- code = gx_path_add_char_path(pgs->show_gstate->path, pgs->path,
- pgs->in_charpath);
+ if (pgs->in_charpath == cpm_true_charpath) {
+ /*
+ * A stroke inside a true charpath should do the
+ * equivalent of strokepath.
+ */
+ code = gs_strokepath(pgs);
+ if (code < 0)
+ return code;
+ }
+ code = gx_path_add_char_path(pgs->show_gstate->path, pgs->path,
+ pgs->in_charpath);
}
if (gs_is_null_device(pgs->device)) {
- /* Handle separately to prevent gs_state_color_load. */
- gs_newpath(pgs);
- code = 0;
+ /* Handle separately to prevent gs_state_color_load. */
+ gs_newpath(pgs);
+ code = 0;
} else {
code = do_stroke(pgs);
- if (code >= 0)
- gs_newpath(pgs);
+ if (code >= 0)
+ gs_newpath(pgs);
}
return code;
}
@@ -493,13 +493,13 @@ gs_strokepath_aux(gs_state * pgs, bool traditional)
gx_path_init_local(&spath, pgs->path->memory);
code = gx_stroke_add(pgs->path, &spath, pgs, traditional);
if (code < 0) {
- gx_path_free(&spath, "gs_strokepath");
- return code;
+ gx_path_free(&spath, "gs_strokepath");
+ return code;
}
pgs->device->sgr.stroke_stored = false;
code = gx_path_assign_free(pgs->path, &spath);
if (code < 0)
- return code;
+ return code;
/* NB: needs testing with PCL */
if (gs_currentcpsimode(pgs->memory) && gx_path_is_void(pgs->path))
pgs->current_point_valid = false;
diff --git a/gs/base/gspaint.h b/gs/base/gspaint.h
index f4fecc893..64778481d 100644
--- a/gs/base/gspaint.h
+++ b/gs/base/gspaint.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsparam.c b/gs/base/gsparam.c
index 75ca001a4..2ce63564c 100644
--- a/gs/base/gsparam.c
+++ b/gs/base/gsparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,47 +25,47 @@ ENUM_PTRS_WITH(gs_param_typed_value_enum_ptrs, gs_param_typed_value *pvalue) ret
case 0:
switch (pvalue->type) {
case gs_param_type_string:
- return ENUM_STRING(&pvalue->value.s);
+ return ENUM_STRING(&pvalue->value.s);
case gs_param_type_name:
- return ENUM_STRING(&pvalue->value.n);
+ return ENUM_STRING(&pvalue->value.n);
case gs_param_type_int_array:
- return ENUM_OBJ(pvalue->value.ia.data);
+ return ENUM_OBJ(pvalue->value.ia.data);
case gs_param_type_float_array:
- return ENUM_OBJ(pvalue->value.fa.data);
+ return ENUM_OBJ(pvalue->value.fa.data);
case gs_param_type_string_array:
- return ENUM_OBJ(pvalue->value.sa.data);
+ return ENUM_OBJ(pvalue->value.sa.data);
case gs_param_type_name_array:
- return ENUM_OBJ(pvalue->value.na.data);
+ return ENUM_OBJ(pvalue->value.na.data);
default:
- return ENUM_OBJ(0); /* don't stop early */
+ return ENUM_OBJ(0); /* don't stop early */
}
ENUM_PTRS_END
RELOC_PTRS_WITH(gs_param_typed_value_reloc_ptrs, gs_param_typed_value *pvalue) {
switch (pvalue->type) {
case gs_param_type_string:
case gs_param_type_name: {
- gs_const_string str;
+ gs_const_string str;
- str.data = pvalue->value.s.data; /* n == s */
- str.size = pvalue->value.s.size;
- RELOC_CONST_STRING_VAR(str);
- pvalue->value.s.data = str.data;
- break;
+ str.data = pvalue->value.s.data; /* n == s */
+ str.size = pvalue->value.s.size;
+ RELOC_CONST_STRING_VAR(str);
+ pvalue->value.s.data = str.data;
+ break;
}
case gs_param_type_int_array:
- RELOC_VAR(pvalue->value.ia.data);
- break;
+ RELOC_VAR(pvalue->value.ia.data);
+ break;
case gs_param_type_float_array:
- RELOC_VAR(pvalue->value.fa.data);
- break;
+ RELOC_VAR(pvalue->value.fa.data);
+ break;
case gs_param_type_string_array:
- RELOC_VAR(pvalue->value.sa.data);
- break;
+ RELOC_VAR(pvalue->value.sa.data);
+ break;
case gs_param_type_name_array:
- RELOC_VAR(pvalue->value.na.data);
- break;
+ RELOC_VAR(pvalue->value.na.data);
+ break;
default:
- break;
+ break;
}
}
RELOC_PTRS_END
@@ -73,7 +73,7 @@ RELOC_PTRS_END
/* Internal procedure to initialize the common part of a parameter list. */
void
gs_param_list_init(gs_param_list *plist, const gs_param_list_procs *procs,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
plist->procs = procs;
plist->memory = mem;
@@ -100,57 +100,57 @@ static const byte xfer_item_sizes[] = {
};
int
gs_param_read_items(gs_param_list * plist, void *obj,
- const gs_param_item_t * items)
+ const gs_param_item_t * items)
{
const gs_param_item_t *pi;
int ecode = 0;
for (pi = items; pi->key != 0; ++pi) {
- const char *key = pi->key;
- void *pvalue = (void *)((char *)obj + pi->offset);
- gs_param_typed_value typed;
- int code;
-
- typed.type = pi->type;
- code = param_read_requested_typed(plist, key, &typed);
- switch (code) {
- default: /* < 0 */
- ecode = code;
- case 1:
- break;
- case 0:
- if (typed.type != pi->type) /* shouldn't happen! */
- ecode = gs_note_error(gs_error_typecheck);
- else
- memcpy(pvalue, &typed.value, xfer_item_sizes[pi->type]);
- }
+ const char *key = pi->key;
+ void *pvalue = (void *)((char *)obj + pi->offset);
+ gs_param_typed_value typed;
+ int code;
+
+ typed.type = pi->type;
+ code = param_read_requested_typed(plist, key, &typed);
+ switch (code) {
+ default: /* < 0 */
+ ecode = code;
+ case 1:
+ break;
+ case 0:
+ if (typed.type != pi->type) /* shouldn't happen! */
+ ecode = gs_note_error(gs_error_typecheck);
+ else
+ memcpy(pvalue, &typed.value, xfer_item_sizes[pi->type]);
+ }
}
return ecode;
}
int
gs_param_write_items(gs_param_list * plist, const void *obj,
- const void *default_obj, const gs_param_item_t * items)
+ const void *default_obj, const gs_param_item_t * items)
{
const gs_param_item_t *pi;
int ecode = 0;
for (pi = items; pi->key != 0; ++pi) {
- const char *key = pi->key;
- const void *pvalue = (const void *)((const char *)obj + pi->offset);
- int size = xfer_item_sizes[pi->type];
- gs_param_typed_value typed;
- int code;
-
- if (default_obj != 0 &&
- !memcmp((const void *)((const char *)default_obj + pi->offset),
- pvalue, size)
- )
- continue;
- memcpy(&typed.value, pvalue, size);
- typed.type = pi->type;
- code = (*plist->procs->xmit_typed) (plist, key, &typed);
- if (code < 0)
- ecode = code;
+ const char *key = pi->key;
+ const void *pvalue = (const void *)((const char *)obj + pi->offset);
+ int size = xfer_item_sizes[pi->type];
+ gs_param_typed_value typed;
+ int code;
+
+ if (default_obj != 0 &&
+ !memcmp((const void *)((const char *)default_obj + pi->offset),
+ pvalue, size)
+ )
+ continue;
+ memcpy(&typed.value, pvalue, size);
+ typed.type = pi->type;
+ code = (*plist->procs->xmit_typed) (plist, key, &typed);
+ if (code < 0)
+ ecode = code;
}
return ecode;
}
@@ -159,10 +159,10 @@ gs_param_write_items(gs_param_list * plist, const void *obj,
/* If mem != 0, we can coerce int arrays to float arrays. */
int
param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
if (req_type == gs_param_type_any || pvalue->type == req_type)
- return 0;
+ return 0;
/*
* Look for coercion opportunities. It would be wonderful if we
* could convert int/float arrays and name/string arrays, but
@@ -170,85 +170,85 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type,
* will satisfy a request for any specific type.
*/
switch (pvalue->type /* actual type */ ) {
- case gs_param_type_int:
- switch (req_type) {
- case gs_param_type_long:
- pvalue->value.l = pvalue->value.i;
- goto ok;
- case gs_param_type_float:
- pvalue->value.f = (float)pvalue->value.l;
- goto ok;
- default:
- break;
- }
- break;
- case gs_param_type_long:
- switch (req_type) {
- case gs_param_type_int:
+ case gs_param_type_int:
+ switch (req_type) {
+ case gs_param_type_long:
+ pvalue->value.l = pvalue->value.i;
+ goto ok;
+ case gs_param_type_float:
+ pvalue->value.f = (float)pvalue->value.l;
+ goto ok;
+ default:
+ break;
+ }
+ break;
+ case gs_param_type_long:
+ switch (req_type) {
+ case gs_param_type_int:
#if arch_sizeof_int < arch_sizeof_long
- if (pvalue->value.l != (int)pvalue->value.l)
- return_error(gs_error_rangecheck);
+ if (pvalue->value.l != (int)pvalue->value.l)
+ return_error(gs_error_rangecheck);
#endif
- pvalue->value.i = (int)pvalue->value.l;
- goto ok;
- case gs_param_type_float:
- pvalue->value.f = (float)pvalue->value.l;
- goto ok;
- default:
- break;
- }
- break;
- case gs_param_type_string:
- if (req_type == gs_param_type_name)
- goto ok;
- break;
- case gs_param_type_name:
- if (req_type == gs_param_type_string)
- goto ok;
- break;
- case gs_param_type_int_array:
- switch (req_type) {
- case gs_param_type_float_array:{
- uint size = pvalue->value.ia.size;
- float *fv;
- uint i;
-
- if (mem == 0)
- break;
- fv = (float *)gs_alloc_byte_array(mem, size, sizeof(float),
- "int array => float array");
-
- if (fv == 0)
- return_error(gs_error_VMerror);
- for (i = 0; i < size; ++i)
- fv[i] = (float)pvalue->value.ia.data[i];
- pvalue->value.fa.data = fv;
- pvalue->value.fa.persistent = false;
- goto ok;
- }
- default:
- break;
- }
- break;
- case gs_param_type_string_array:
- if (req_type == gs_param_type_name_array)
- goto ok;
- break;
- case gs_param_type_name_array:
- if (req_type == gs_param_type_string_array)
- goto ok;
- break;
- case gs_param_type_array:
- if (pvalue->value.d.size == 0 &&
- (req_type == gs_param_type_int_array ||
- req_type == gs_param_type_float_array ||
- req_type == gs_param_type_string_array ||
- req_type == gs_param_type_name_array)
- )
- goto ok;
- break;
- default:
- break;
+ pvalue->value.i = (int)pvalue->value.l;
+ goto ok;
+ case gs_param_type_float:
+ pvalue->value.f = (float)pvalue->value.l;
+ goto ok;
+ default:
+ break;
+ }
+ break;
+ case gs_param_type_string:
+ if (req_type == gs_param_type_name)
+ goto ok;
+ break;
+ case gs_param_type_name:
+ if (req_type == gs_param_type_string)
+ goto ok;
+ break;
+ case gs_param_type_int_array:
+ switch (req_type) {
+ case gs_param_type_float_array:{
+ uint size = pvalue->value.ia.size;
+ float *fv;
+ uint i;
+
+ if (mem == 0)
+ break;
+ fv = (float *)gs_alloc_byte_array(mem, size, sizeof(float),
+ "int array => float array");
+
+ if (fv == 0)
+ return_error(gs_error_VMerror);
+ for (i = 0; i < size; ++i)
+ fv[i] = (float)pvalue->value.ia.data[i];
+ pvalue->value.fa.data = fv;
+ pvalue->value.fa.persistent = false;
+ goto ok;
+ }
+ default:
+ break;
+ }
+ break;
+ case gs_param_type_string_array:
+ if (req_type == gs_param_type_name_array)
+ goto ok;
+ break;
+ case gs_param_type_name_array:
+ if (req_type == gs_param_type_string_array)
+ goto ok;
+ break;
+ case gs_param_type_array:
+ if (pvalue->value.d.size == 0 &&
+ (req_type == gs_param_type_int_array ||
+ req_type == gs_param_type_float_array ||
+ req_type == gs_param_type_string_array ||
+ req_type == gs_param_type_name_array)
+ )
+ goto ok;
+ break;
+ default:
+ break;
}
return_error(gs_error_typecheck);
ok:pvalue->type = req_type;
@@ -256,17 +256,16 @@ param_coerce_typed(gs_param_typed_value * pvalue, gs_param_type req_type,
}
int
param_read_requested_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
gs_param_type req_type = pvalue->type;
int code = (*plist->procs->xmit_typed) (plist, pkey, pvalue);
if (code != 0)
- return code;
+ return code;
return param_coerce_typed(pvalue, req_type, plist->memory);
}
-
/* ---------------- Fixed-type reading procedures ---------------- */
#define RETURN_READ_TYPED(alt, ptype)\
@@ -309,37 +308,37 @@ param_read_float(gs_param_list * plist, gs_param_name pkey, float *pvalue)
}
int
param_read_string(gs_param_list * plist, gs_param_name pkey,
- gs_param_string * pvalue)
+ gs_param_string * pvalue)
{
RETURN_READ_TYPED(s, gs_param_type_string);
}
int
param_read_name(gs_param_list * plist, gs_param_name pkey,
- gs_param_string * pvalue)
+ gs_param_string * pvalue)
{
RETURN_READ_TYPED(n, gs_param_type_string);
}
int
param_read_int_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_int_array * pvalue)
+ gs_param_int_array * pvalue)
{
RETURN_READ_TYPED(ia, gs_param_type_int_array);
}
int
param_read_float_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_float_array * pvalue)
+ gs_param_float_array * pvalue)
{
RETURN_READ_TYPED(fa, gs_param_type_float_array);
}
int
param_read_string_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_string_array * pvalue)
+ gs_param_string_array * pvalue)
{
RETURN_READ_TYPED(sa, gs_param_type_string_array);
}
int
param_read_name_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_string_array * pvalue)
+ gs_param_string_array * pvalue)
{
RETURN_READ_TYPED(na, gs_param_type_name_array);
}
@@ -380,31 +379,31 @@ param_write_long(gs_param_list * plist, gs_param_name pkey, const long *pvalue)
}
int
param_write_float(gs_param_list * plist, gs_param_name pkey,
- const float *pvalue)
+ const float *pvalue)
{
RETURN_WRITE_TYPED(f, gs_param_type_float);
}
int
param_write_string(gs_param_list * plist, gs_param_name pkey,
- const gs_param_string * pvalue)
+ const gs_param_string * pvalue)
{
RETURN_WRITE_TYPED(s, gs_param_type_string);
}
int
param_write_name(gs_param_list * plist, gs_param_name pkey,
- const gs_param_string * pvalue)
+ const gs_param_string * pvalue)
{
RETURN_WRITE_TYPED(n, gs_param_type_name);
}
int
param_write_int_array(gs_param_list * plist, gs_param_name pkey,
- const gs_param_int_array * pvalue)
+ const gs_param_int_array * pvalue)
{
RETURN_WRITE_TYPED(ia, gs_param_type_int_array);
}
int
param_write_int_values(gs_param_list * plist, gs_param_name pkey,
- const int *values, uint size, bool persistent)
+ const int *values, uint size, bool persistent)
{
gs_param_int_array ia;
@@ -413,13 +412,13 @@ param_write_int_values(gs_param_list * plist, gs_param_name pkey,
}
int
param_write_float_array(gs_param_list * plist, gs_param_name pkey,
- const gs_param_float_array * pvalue)
+ const gs_param_float_array * pvalue)
{
RETURN_WRITE_TYPED(fa, gs_param_type_float_array);
}
int
param_write_float_values(gs_param_list * plist, gs_param_name pkey,
- const float *values, uint size, bool persistent)
+ const float *values, uint size, bool persistent)
{
gs_param_float_array fa;
@@ -428,13 +427,13 @@ param_write_float_values(gs_param_list * plist, gs_param_name pkey,
}
int
param_write_string_array(gs_param_list * plist, gs_param_name pkey,
- const gs_param_string_array * pvalue)
+ const gs_param_string_array * pvalue)
{
RETURN_WRITE_TYPED(sa, gs_param_type_string_array);
}
int
param_write_name_array(gs_param_list * plist, gs_param_name pkey,
- const gs_param_string_array * pvalue)
+ const gs_param_string_array * pvalue)
{
RETURN_WRITE_TYPED(na, gs_param_type_name_array);
}
diff --git a/gs/base/gsparam.h b/gs/base/gsparam.h
index 8b51b3ecc..332d3def5 100644
--- a/gs/base/gsparam.h
+++ b/gs/base/gsparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -120,17 +120,17 @@ extern const byte gs_param_type_base_sizes[];
/* Define a union capable of holding any parameter value. */
#define GS_PARAM_VALUE_UNION(dict_type)\
- bool b;\
- int i;\
- long l;\
- float f;\
- gs_param_string s;\
- gs_param_string n;\
- gs_param_int_array ia;\
- gs_param_float_array fa;\
- gs_param_string_array sa;\
- gs_param_string_array na;\
- dict_type d
+ bool b;\
+ int i;\
+ long l;\
+ float f;\
+ gs_param_string s;\
+ gs_param_string n;\
+ gs_param_int_array ia;\
+ gs_param_float_array fa;\
+ gs_param_string_array sa;\
+ gs_param_string_array na;\
+ dict_type d
typedef union gs_param_value_s {
GS_PARAM_VALUE_UNION(gs_param_collection);
} gs_param_value;
@@ -263,122 +263,122 @@ typedef struct gs_param_list_procs_s {
#define param_proc_xmit_typed(proc)\
int proc(gs_param_list *, gs_param_name, gs_param_typed_value *)
- param_proc_xmit_typed((*xmit_typed));
- /* See below for param_read_[requested_]typed */
+ param_proc_xmit_typed((*xmit_typed));
+ /* See below for param_read_[requested_]typed */
#define param_write_typed(plist, pkey, pvalue)\
- (*(plist)->procs->xmit_typed)(plist, pkey, pvalue)
+ (*(plist)->procs->xmit_typed)(plist, pkey, pvalue)
- /* Start transmitting a dictionary or heterogenous value. */
+ /* Start transmitting a dictionary or heterogenous value. */
#define param_proc_begin_xmit_collection(proc)\
- int proc(gs_param_list *, gs_param_name, gs_param_dict *,\
- gs_param_collection_type_t)
- param_proc_begin_xmit_collection((*begin_xmit_collection));
+ int proc(gs_param_list *, gs_param_name, gs_param_dict *,\
+ gs_param_collection_type_t)
+ param_proc_begin_xmit_collection((*begin_xmit_collection));
#define param_begin_read_collection(plist, pkey, pvalue, coll_type)\
- (*(plist)->procs->begin_xmit_collection)(plist, pkey, pvalue, coll_type)
+ (*(plist)->procs->begin_xmit_collection)(plist, pkey, pvalue, coll_type)
#define param_begin_read_dict(l, k, v, int_keys)\
- param_begin_read_collection(l, k, v,\
- (int_keys ? gs_param_collection_dict_int_keys :\
- gs_param_collection_dict_any))
+ param_begin_read_collection(l, k, v,\
+ (int_keys ? gs_param_collection_dict_int_keys :\
+ gs_param_collection_dict_any))
#define param_begin_write_collection(plist, pkey, pvalue, coll_type)\
- (*(plist)->procs->begin_xmit_collection)(plist, pkey, pvalue, coll_type)
+ (*(plist)->procs->begin_xmit_collection)(plist, pkey, pvalue, coll_type)
#define param_begin_write_dict(l, k, v, int_keys)\
- param_begin_write_collection(l, k, v,\
- (int_keys ? gs_param_collection_dict_int_keys :\
- gs_param_collection_dict_any))
+ param_begin_write_collection(l, k, v,\
+ (int_keys ? gs_param_collection_dict_int_keys :\
+ gs_param_collection_dict_any))
- /* Finish transmitting a collection value. */
+ /* Finish transmitting a collection value. */
#define param_proc_end_xmit_collection(proc)\
- int proc(gs_param_list *, gs_param_name, gs_param_dict *)
- param_proc_end_xmit_collection((*end_xmit_collection));
+ int proc(gs_param_list *, gs_param_name, gs_param_dict *)
+ param_proc_end_xmit_collection((*end_xmit_collection));
#define param_end_read_collection(plist, pkey, pvalue)\
- (*(plist)->procs->end_xmit_collection)(plist, pkey, pvalue)
+ (*(plist)->procs->end_xmit_collection)(plist, pkey, pvalue)
#define param_end_read_dict(l, k, v) param_end_read_collection(l, k, v)
#define param_end_write_collection(plist, pkey, pvalue)\
- (*(plist)->procs->end_xmit_collection)(plist, pkey, pvalue)
+ (*(plist)->procs->end_xmit_collection)(plist, pkey, pvalue)
#define param_end_write_dict(l, k, v) param_end_write_collection(l, k, v)
- /*
- * Get the next key in sequence.
- * (Only used when reading.)
- * Use param_init_enumerator(...) to reset to first key.
- */
+ /*
+ * Get the next key in sequence.
+ * (Only used when reading.)
+ * Use param_init_enumerator(...) to reset to first key.
+ */
#define param_proc_next_key(proc)\
- int proc(gs_param_list *, gs_param_enumerator_t *, gs_param_key_t *)
- param_proc_next_key((*next_key));
+ int proc(gs_param_list *, gs_param_enumerator_t *, gs_param_key_t *)
+ param_proc_next_key((*next_key));
#define param_get_next_key(plist, penum, pkey)\
- (*(plist)->procs->next_key)(plist, penum, pkey)
+ (*(plist)->procs->next_key)(plist, penum, pkey)
- /*
- * Request a specific parameter. (Only used when writing, before
- * writing any values.) If no specific parameters are requested,
- * param_requested always returns -1; if specific parameters
- * are requested, param_requested will return 1 for those,
- * and may return either 0 or 1 for others.
- */
+ /*
+ * Request a specific parameter. (Only used when writing, before
+ * writing any values.) If no specific parameters are requested,
+ * param_requested always returns -1; if specific parameters
+ * are requested, param_requested will return 1 for those,
+ * and may return either 0 or 1 for others.
+ */
#define param_proc_request(proc)\
int proc(gs_param_list *, gs_param_name)
- param_proc_request((*request));
+ param_proc_request((*request));
#define param_request(plist, pkey)\
((plist)->procs->request(plist, pkey))
- /*
- * Determine whether a given key has been requested. (Only used
- * when writing.) A return value of -1 means that no specific
- * parameters have been requested; 0 means specific parameters have
- * been requested, but not this one; 1 means this parameter has
- * been requested specifically.
- */
+ /*
+ * Determine whether a given key has been requested. (Only used
+ * when writing.) A return value of -1 means that no specific
+ * parameters have been requested; 0 means specific parameters have
+ * been requested, but not this one; 1 means this parameter has
+ * been requested specifically.
+ */
#define param_proc_requested(proc)\
- int proc(const gs_param_list *, gs_param_name)
- param_proc_requested((*requested));
+ int proc(const gs_param_list *, gs_param_name)
+ param_proc_requested((*requested));
#define param_requested(plist, pkey)\
- (*(plist)->procs->requested)(plist, pkey)
+ (*(plist)->procs->requested)(plist, pkey)
- /* Get the 'policy' associated with an out-of-range parameter value. */
- /* (Only used when reading.) */
+ /* Get the 'policy' associated with an out-of-range parameter value. */
+ /* (Only used when reading.) */
#define param_proc_get_policy(proc)\
- int proc(gs_param_list *, gs_param_name)
- param_proc_get_policy((*get_policy));
+ int proc(gs_param_list *, gs_param_name)
+ param_proc_get_policy((*get_policy));
#define param_get_policy(plist, pkey)\
- (*(plist)->procs->get_policy)(plist, pkey)
+ (*(plist)->procs->get_policy)(plist, pkey)
- /*
- * Signal an error. (Only used when reading.)
- * The procedure may return a different error code,
- * or may return 0 indicating that the error is to be ignored.
- */
+ /*
+ * Signal an error. (Only used when reading.)
+ * The procedure may return a different error code,
+ * or may return 0 indicating that the error is to be ignored.
+ */
#define param_proc_signal_error(proc)\
- int proc(gs_param_list *, gs_param_name, int)
- param_proc_signal_error((*signal_error));
+ int proc(gs_param_list *, gs_param_name, int)
+ param_proc_signal_error((*signal_error));
#define param_signal_error(plist, pkey, code)\
- (*(plist)->procs->signal_error)(plist, pkey, code)
+ (*(plist)->procs->signal_error)(plist, pkey, code)
#define param_return_error(plist, pkey, code)\
- return_error(param_signal_error(plist, pkey, code))
+ return_error(param_signal_error(plist, pkey, code))
- /*
- * "Commit" a set of changes. (Only used when reading.)
- * This is called at the end of the first phase.
- */
+ /*
+ * "Commit" a set of changes. (Only used when reading.)
+ * This is called at the end of the first phase.
+ */
#define param_proc_commit(proc)\
- int proc(gs_param_list *)
- param_proc_commit((*commit));
+ int proc(gs_param_list *)
+ param_proc_commit((*commit));
#define param_commit(plist)\
- (*(plist)->procs->commit)(plist)
+ (*(plist)->procs->commit)(plist)
} gs_param_list_procs;
/* Transmit typed parameters. */
int param_read_requested_typed(gs_param_list *, gs_param_name,
- gs_param_typed_value *);
+ gs_param_typed_value *);
#define param_read_typed(plist, pkey, pvalue)\
((pvalue)->type = gs_param_type_any,\
@@ -397,30 +397,30 @@ int param_read_float(gs_param_list *, gs_param_name, float *);
int param_write_float(gs_param_list *, gs_param_name, const float *);
int param_read_string(gs_param_list *, gs_param_name, gs_param_string *);
int param_write_string(gs_param_list *, gs_param_name,
- const gs_param_string *);
+ const gs_param_string *);
int param_read_name(gs_param_list *, gs_param_name, gs_param_string *);
int param_write_name(gs_param_list *, gs_param_name,
- const gs_param_string *);
+ const gs_param_string *);
int param_read_int_array(gs_param_list *, gs_param_name,
- gs_param_int_array *);
+ gs_param_int_array *);
int param_write_int_array(gs_param_list *, gs_param_name,
- const gs_param_int_array *);
+ const gs_param_int_array *);
int param_write_int_values(gs_param_list *, gs_param_name,
- const int *, uint, bool);
+ const int *, uint, bool);
int param_read_float_array(gs_param_list *, gs_param_name,
- gs_param_float_array *);
+ gs_param_float_array *);
int param_write_float_array(gs_param_list *, gs_param_name,
- const gs_param_float_array *);
+ const gs_param_float_array *);
int param_write_float_values(gs_param_list *, gs_param_name,
- const float *, uint, bool);
+ const float *, uint, bool);
int param_read_string_array(gs_param_list *, gs_param_name,
- gs_param_string_array *);
+ gs_param_string_array *);
int param_write_string_array(gs_param_list *, gs_param_name,
- const gs_param_string_array *);
+ const gs_param_string_array *);
int param_read_name_array(gs_param_list *, gs_param_name,
- gs_param_string_array *);
+ gs_param_string_array *);
int param_write_name_array(gs_param_list *, gs_param_name,
- const gs_param_string_array *);
+ const gs_param_string_array *);
/*
* Define an abstract parameter list. Implementations are concrete
@@ -463,14 +463,14 @@ typedef struct gs_param_item_s {
* the optional default_obj, the item isn't transferred.
*/
int gs_param_read_items(gs_param_list * plist, void *obj,
- const gs_param_item_t * items);
+ const gs_param_item_t * items);
int gs_param_write_items(gs_param_list * plist, const void *obj,
- const void *default_obj,
- const gs_param_item_t * items);
+ const void *default_obj,
+ const gs_param_item_t * items);
/* Internal procedure to initialize the common part of a parameter list. */
void gs_param_list_init(gs_param_list *, const gs_param_list_procs *,
- gs_memory_t *);
+ gs_memory_t *);
/*
* Internal procedure to read a value, with coercion if requested, needed,
@@ -478,7 +478,7 @@ void gs_param_list_init(gs_param_list *, const gs_param_list_procs *,
* possibly do other coercions later.
*/
int param_coerce_typed(gs_param_typed_value * pvalue,
- gs_param_type req_type, gs_memory_t * mem);
+ gs_param_type req_type, gs_memory_t * mem);
/* ---------------- Default implementation ---------------- */
@@ -492,21 +492,21 @@ param_proc_requested(gs_param_requested_default); /* always returns true */
/*
* Define a default implementation, intended to be usable easily
* from C code. The intended usage pattern is:
- gs_c_param_list list;
- [... other code here ...]
- gs_c_param_list_write(&list, mem);
- [As many as needed:]
- code = param_write_XXX(&list, "ParamName", &param_value);
- [Check code for <0]
- gs_c_param_list_read(&list);
- code = gs_putdeviceparams(dev, &list);
- gs_c_param_list_release(&list);
- [Check code for <0]
- if ( code == 1 )
- {
- code = (*dev_proc(dev, open_device))(dev);
- [Check code for <0]
- }
+ gs_c_param_list list;
+ [... other code here ...]
+ gs_c_param_list_write(&list, mem);
+ [As many as needed:]
+ code = param_write_XXX(&list, "ParamName", &param_value);
+ [Check code for <0]
+ gs_c_param_list_read(&list);
+ code = gs_putdeviceparams(dev, &list);
+ gs_c_param_list_release(&list);
+ [Check code for <0]
+ if ( code == 1 )
+ {
+ code = (*dev_proc(dev, open_device))(dev);
+ [Check code for <0]
+ }
*
* This implementation also has the special property that it can forward
* unrecognized param_read_ calls to another parameter list, called the
@@ -532,7 +532,7 @@ typedef struct gs_c_param_list_s {
/* This structure descriptor is only for non persistent gs_param_strings. */
#define private_st_gs_param_string() /* in gdevdevn.c */\
gs_private_st_composite(st_gs_param_string, gs_param_string, "gs_param_string",\
- param_string_enum_ptrs, param_string_reloc_ptrs)
+ param_string_enum_ptrs, param_string_reloc_ptrs)
/* Set the target of a C parameter list. */
void gs_c_param_list_set_target(gs_c_param_list *, gs_param_list *);
diff --git a/gs/base/gsparam2.c b/gs/base/gsparam2.c
index 90ea31bf0..a9610b9c2 100644
--- a/gs/base/gsparam2.c
+++ b/gs/base/gsparam2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ gs_param_list_puts(stream *dest, gs_param_list *list)
/* Each item is serialized as ("word" means compressed word):
* word: key sizeof + 1, or 0 if end of list/dict
* word: data type(gs_param_type_xxx)
- * byte[]: key, including trailing \0
+ * byte[]: key, including trailing \0
* (if simple type)
* byte[]: unpacked representation of data
* (if simple array or string)
@@ -63,94 +63,94 @@ gs_param_list_puts(stream *dest, gs_param_list *list)
*/
/* Enumerate all the keys; use keys to get their typed values */
while ((code = param_get_next_key(list, &key_enum, &key)) == 0) {
- int value_top_sizeof;
- int value_base_sizeof;
- const void *data;
- uint size;
-
- /* Get next datum & put its type & key to stream */
- gs_param_typed_value value;
- char string_key[MAX_PARAM_KEY + 1];
-
- if (sizeof(string_key) < key.size + 1) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- memcpy(string_key, key.data, key.size);
- string_key[key.size] = 0;
- if ((code = param_read_typed(list, string_key, &value)) != 0) {
- if (code > 0)
- code = gs_note_error(gs_error_unknownerror);
- break;
- }
- sput_word(dest, (unsigned)key.size + 1);
- sput_word(dest, (unsigned)value.type);
- sput_bytes(dest, (byte *)string_key, key.size + 1);
-
- /* Put value & its size to stream */
- value_top_sizeof = gs_param_type_sizes[value.type];
- value_base_sizeof = gs_param_type_base_sizes[value.type];
- switch (value.type) {
- case gs_param_type_bool:
- case gs_param_type_int:
- case gs_param_type_long:
- case gs_param_type_float:
- sput_bytes(dest, (byte *)&value.value, value_top_sizeof);
- case gs_param_type_null:
- break;
-
- case gs_param_type_string:
- data = value.value.s.data, size = value.value.s.size;
- goto scalar_array;
- case gs_param_type_name:
- data = value.value.n.data, size = value.value.n.size;
- goto scalar_array;
- case gs_param_type_int_array:
- data = value.value.ia.data, size = value.value.ia.size;
- goto scalar_array;
- case gs_param_type_float_array:
- data = value.value.fa.data, size = value.value.fa.size;
+ int value_top_sizeof;
+ int value_base_sizeof;
+ const void *data;
+ uint size;
+
+ /* Get next datum & put its type & key to stream */
+ gs_param_typed_value value;
+ char string_key[MAX_PARAM_KEY + 1];
+
+ if (sizeof(string_key) < key.size + 1) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ memcpy(string_key, key.data, key.size);
+ string_key[key.size] = 0;
+ if ((code = param_read_typed(list, string_key, &value)) != 0) {
+ if (code > 0)
+ code = gs_note_error(gs_error_unknownerror);
+ break;
+ }
+ sput_word(dest, (unsigned)key.size + 1);
+ sput_word(dest, (unsigned)value.type);
+ sput_bytes(dest, (byte *)string_key, key.size + 1);
+
+ /* Put value & its size to stream */
+ value_top_sizeof = gs_param_type_sizes[value.type];
+ value_base_sizeof = gs_param_type_base_sizes[value.type];
+ switch (value.type) {
+ case gs_param_type_bool:
+ case gs_param_type_int:
+ case gs_param_type_long:
+ case gs_param_type_float:
+ sput_bytes(dest, (byte *)&value.value, value_top_sizeof);
+ case gs_param_type_null:
+ break;
+
+ case gs_param_type_string:
+ data = value.value.s.data, size = value.value.s.size;
+ goto scalar_array;
+ case gs_param_type_name:
+ data = value.value.n.data, size = value.value.n.size;
+ goto scalar_array;
+ case gs_param_type_int_array:
+ data = value.value.ia.data, size = value.value.ia.size;
+ goto scalar_array;
+ case gs_param_type_float_array:
+ data = value.value.fa.data, size = value.value.fa.size;
scalar_array: sput_word(dest, size);
- sput_bytes(dest, data, value_base_sizeof * size);
- break;
-
- case gs_param_type_string_array:
- data = value.value.sa.data, size = value.value.sa.size;
- goto string_array;
- case gs_param_type_name_array:
- data = value.value.na.data, size = value.value.na.size;
+ sput_bytes(dest, data, value_base_sizeof * size);
+ break;
+
+ case gs_param_type_string_array:
+ data = value.value.sa.data, size = value.value.sa.size;
+ goto string_array;
+ case gs_param_type_name_array:
+ data = value.value.na.data, size = value.value.na.size;
string_array: sput_word(dest, size);
- {
- uint count;
- const gs_param_string *sa;
-
- for (count = size, sa = data; count-- > 0; ++sa) {
- sput_word(dest, sa->size);
- sput_bytes(dest, sa->data, sa->size);
- }
- }
- break;
-
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- case gs_param_type_array:
- sput_word(dest, value.value.d.size);
- code = gs_param_list_puts(dest, value.value.d.list);
- {
- int end_code =
- param_end_read_dict(list, key.data, &value.value.d);
-
- if (code >= 0)
- code = end_code;
- }
- break;
-
- default:
- code = gs_note_error(gs_error_unknownerror);
- break;
- }
- if (code < 0)
- break;
+ {
+ uint count;
+ const gs_param_string *sa;
+
+ for (count = size, sa = data; count-- > 0; ++sa) {
+ sput_word(dest, sa->size);
+ sput_bytes(dest, sa->data, sa->size);
+ }
+ }
+ break;
+
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ case gs_param_type_array:
+ sput_word(dest, value.value.d.size);
+ code = gs_param_list_puts(dest, value.value.d.list);
+ {
+ int end_code =
+ param_end_read_dict(list, key.data, &value.value.d);
+
+ if (code >= 0)
+ code = end_code;
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_unknownerror);
+ break;
+ }
+ if (code < 0)
+ break;
}
/* Write end marker, which is an (illegal) 0 key length */
@@ -164,12 +164,12 @@ sput_word(stream *dest, uint value)
int code = 0;
do {
- byte chunk = value & 0x7f;
+ byte chunk = value & 0x7f;
- if ((value >>= 7) != 0)
- chunk |= 0x80;
- if ((code = sputc(dest, chunk)) < 0)
- break;
+ if ((value >>= 7) != 0)
+ chunk |= 0x80;
+ if ((code = sputc(dest, chunk)) < 0)
+ break;
}
while (value != 0);
return code;
@@ -200,148 +200,147 @@ gs_param_list_gets(stream *src, gs_param_list *list, gs_memory_t *mem)
int code = 0;
do {
- gs_param_typed_value typed;
- uint key_sizeof;
- int value_top_sizeof;
- int value_base_sizeof;
- uint temp;
- void *data;
- uint size;
- gs_param_type type;
- char string_key[MAX_PARAM_KEY + 1];
-
- /* key length 0 indicates end of data */
- if ((code = sget_word(src, &key_sizeof)) < 0 ||
- key_sizeof == 0 ||
- /* data type */
- (code = sget_word(src, &temp)) < 0)
- break;
-
- if (key_sizeof > sizeof(string_key)) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- /* key */
- code = sget_bytes(src, (byte *)string_key, key_sizeof);
- if (code < 0)
- break;
-
- /* Data values */
- type = (gs_param_type)temp;
- value_top_sizeof = gs_param_type_sizes[type];
- value_base_sizeof = gs_param_type_base_sizes[type];
- typed.type = type;
- switch (type) {
- case gs_param_type_bool:
- case gs_param_type_int:
- case gs_param_type_long:
- case gs_param_type_float:
- code = sget_bytes(src, (byte *)&typed.value, value_top_sizeof);
- case gs_param_type_null:
- goto put;
- default:
- ;
- }
- /* All other data values start with a size. */
- code = sget_word(src, &size);
- if (code < 0)
- break;
-
- switch (type) {
- case gs_param_type_string:
- case gs_param_type_name:
- case gs_param_type_int_array:
- case gs_param_type_float_array:
- data =
- (value_base_sizeof == 1 ?
- gs_alloc_string(mem, size, "param string/name") :
- gs_alloc_byte_array(mem, size, value_base_sizeof,
- "param scalar array"));
- if (data == 0) {
- code = gs_note_error(gs_error_VMerror);
- break;
- }
- typed.value.s.data = data;
- typed.value.s.persistent = false;
- typed.value.s.size = size;
- code = sget_bytes(src, data, size * value_base_sizeof);
- break;
-
- case gs_param_type_string_array:
- case gs_param_type_name_array:
- /****** SHOULD BE STRUCT ARRAY ******/
- data = gs_alloc_byte_array(mem, size, value_top_sizeof,
- "param string/name array");
- if (data == 0) {
- code = gs_note_error(gs_error_VMerror);
- break;
- }
- typed.value.sa.data = data;
- typed.value.sa.persistent = false;
- typed.value.sa.size = size;
- {
- gs_param_string *sa = data;
- byte *str_data;
- uint index, str_size;
-
- /* Clean pointers in case we bail out. */
- for (index = 0; index < size; ++index)
- sa[index].data = 0, sa[index].size = 0;
- for (index = 0; index < size; ++index, ++sa) {
- code = sget_word(src, &str_size);
- if (code < 0)
- break;
- str_data = gs_alloc_string(mem, str_size,
- "param string/name element");
- if (str_data == 0) {
- code = gs_note_error(gs_error_VMerror);
- break;
- }
- code = sget_bytes(src, str_data, str_size);
- if (code < 0)
- break;
- }
- }
- break;
-
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- case gs_param_type_array:
- typed.value.d.size = size;
- code = param_begin_write_collection
- (list, string_key, &typed.value.d,
- type - gs_param_type_dict);
- if (code < 0)
- break;
- code = gs_param_list_gets(src, typed.value.d.list, mem);
- {
- int end_code =
- param_end_write_collection(list, string_key,
- &typed.value.d);
-
- if (code >= 0)
- code = end_code;
- }
- break;
-
- default:
- code = gs_note_error(gs_error_unknownerror);
- break;
- }
+ gs_param_typed_value typed;
+ uint key_sizeof;
+ int value_top_sizeof;
+ int value_base_sizeof;
+ uint temp;
+ void *data;
+ uint size;
+ gs_param_type type;
+ char string_key[MAX_PARAM_KEY + 1];
+
+ /* key length 0 indicates end of data */
+ if ((code = sget_word(src, &key_sizeof)) < 0 ||
+ key_sizeof == 0 ||
+ /* data type */
+ (code = sget_word(src, &temp)) < 0)
+ break;
+
+ if (key_sizeof > sizeof(string_key)) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ /* key */
+ code = sget_bytes(src, (byte *)string_key, key_sizeof);
+ if (code < 0)
+ break;
+
+ /* Data values */
+ type = (gs_param_type)temp;
+ value_top_sizeof = gs_param_type_sizes[type];
+ value_base_sizeof = gs_param_type_base_sizes[type];
+ typed.type = type;
+ switch (type) {
+ case gs_param_type_bool:
+ case gs_param_type_int:
+ case gs_param_type_long:
+ case gs_param_type_float:
+ code = sget_bytes(src, (byte *)&typed.value, value_top_sizeof);
+ case gs_param_type_null:
+ goto put;
+ default:
+ ;
+ }
+ /* All other data values start with a size. */
+ code = sget_word(src, &size);
+ if (code < 0)
+ break;
+
+ switch (type) {
+ case gs_param_type_string:
+ case gs_param_type_name:
+ case gs_param_type_int_array:
+ case gs_param_type_float_array:
+ data =
+ (value_base_sizeof == 1 ?
+ gs_alloc_string(mem, size, "param string/name") :
+ gs_alloc_byte_array(mem, size, value_base_sizeof,
+ "param scalar array"));
+ if (data == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ break;
+ }
+ typed.value.s.data = data;
+ typed.value.s.persistent = false;
+ typed.value.s.size = size;
+ code = sget_bytes(src, data, size * value_base_sizeof);
+ break;
+
+ case gs_param_type_string_array:
+ case gs_param_type_name_array:
+ /****** SHOULD BE STRUCT ARRAY ******/
+ data = gs_alloc_byte_array(mem, size, value_top_sizeof,
+ "param string/name array");
+ if (data == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ break;
+ }
+ typed.value.sa.data = data;
+ typed.value.sa.persistent = false;
+ typed.value.sa.size = size;
+ {
+ gs_param_string *sa = data;
+ byte *str_data;
+ uint index, str_size;
+
+ /* Clean pointers in case we bail out. */
+ for (index = 0; index < size; ++index)
+ sa[index].data = 0, sa[index].size = 0;
+ for (index = 0; index < size; ++index, ++sa) {
+ code = sget_word(src, &str_size);
+ if (code < 0)
+ break;
+ str_data = gs_alloc_string(mem, str_size,
+ "param string/name element");
+ if (str_data == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ break;
+ }
+ code = sget_bytes(src, str_data, str_size);
+ if (code < 0)
+ break;
+ }
+ }
+ break;
+
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ case gs_param_type_array:
+ typed.value.d.size = size;
+ code = param_begin_write_collection
+ (list, string_key, &typed.value.d,
+ type - gs_param_type_dict);
+ if (code < 0)
+ break;
+ code = gs_param_list_gets(src, typed.value.d.list, mem);
+ {
+ int end_code =
+ param_end_write_collection(list, string_key,
+ &typed.value.d);
+
+ if (code >= 0)
+ code = end_code;
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_unknownerror);
+ break;
+ }
put: if (code < 0)
- break;
- if (typed.type != gs_param_type_dict &&
- typed.type != gs_param_type_dict_int_keys &&
- typed.type != gs_param_type_array
- )
- code = param_write_typed(list, string_key, &typed);
+ break;
+ if (typed.type != gs_param_type_dict &&
+ typed.type != gs_param_type_dict_int_keys &&
+ typed.type != gs_param_type_array
+ )
+ code = param_write_typed(list, string_key, &typed);
}
while (code >= 0);
return code;
}
-
/* ---------- Utility functions -------- */
/* Get a value stored with sput_word */
@@ -353,11 +352,11 @@ sget_word(stream *src, uint *pvalue)
uint shift = 0;
do {
- chunk = sgetc(src);
- if (chunk < 0)
- return chunk;
- value |= (chunk & 0x7f) << shift;
- shift += 7;
+ chunk = sgetc(src);
+ if (chunk < 0)
+ return chunk;
+ value |= (chunk & 0x7f) << shift;
+ shift += 7;
}
while (chunk & 0x80);
@@ -374,7 +373,7 @@ sget_bytes(stream *src, byte *data, uint size)
int status = sgets(src, data, size, &ignore_count);
if (status < 0 && status != EOFC) {
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
};
return 0;
diff --git a/gs/base/gsparams.c b/gs/base/gsparams.c
index 910b679ea..cf1384135 100644
--- a/gs/base/gsparams.c
+++ b/gs/base/gsparams.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,32 +33,31 @@ typedef struct {
/* ---------- Forward refs ----------- */
static void
ptr_align_to(
- const byte ** src, /* pointer to align */
- unsigned alignment /* alignment, must be power of 2 */
- );
+ const byte ** src, /* pointer to align */
+ unsigned alignment /* alignment, must be power of 2 */
+ );
static void
wb_put_word(
- unsigned source, /* number to put to buffer */
- WriteBuffer * dest /* destination descriptor */
- );
+ unsigned source, /* number to put to buffer */
+ WriteBuffer * dest /* destination descriptor */
+ );
static void
wb_put_bytes(
- const byte * source, /* bytes to put to buffer */
- unsigned source_sizeof, /* # bytes to put */
- WriteBuffer * dest /* destination descriptor */
- );
+ const byte * source, /* bytes to put to buffer */
+ unsigned source_sizeof, /* # bytes to put */
+ WriteBuffer * dest /* destination descriptor */
+ );
static void
wb_put_alignment(
- unsigned alignment, /* alignment to match, must be power 2 */
- WriteBuffer * dest /* destination descriptor */
- );
+ unsigned alignment, /* alignment to match, must be power 2 */
+ WriteBuffer * dest /* destination descriptor */
+ );
/* Get word compressed with wb_put_word */
static unsigned /* decompressed word */
buf_get_word(
- const byte ** src /* UPDATES: ptr to src buf ptr */
- );
-
+ const byte ** src /* UPDATES: ptr to src buf ptr */
+ );
/* ------------ Serializer ------------ */
/* Serialize the contents of a gs_param_list (including sub-dicts) */
@@ -68,10 +67,10 @@ int /* ret -ve err, else # bytes needed to represent param list, whether */
/* serialized only if if this # is <= supplied buf size. */
gs_param_list_serialize(
- gs_param_list * list, /* root of list to serialize */
- /* list MUST BE IN READ MODE */
- byte * buf, /* destination buffer (can be 0) */
- int buf_sizeof /* # bytes available in buf (can be 0) */
+ gs_param_list * list, /* root of list to serialize */
+ /* list MUST BE IN READ MODE */
+ byte * buf, /* destination buffer (can be 0) */
+ int buf_sizeof /* # bytes available in buf (can be 0) */
)
{
int code = 0;
@@ -88,7 +87,7 @@ gs_param_list_serialize(
/* Each item is serialized as ("word" means compressed word):
* word: key sizeof + 1, or 0 if end of list/dict
* word: data type(gs_param_type_xxx)
- * byte[]: key, including trailing \0
+ * byte[]: key, including trailing \0
* (if simple type)
* byte[]: unpacked representation of data
* (if simple array or string)
@@ -111,227 +110,225 @@ gs_param_list_serialize(
*/
/* Enumerate all the keys; use keys to get their typed values */
while ((code = param_get_next_key(list, &key_enum, &key)) == 0) {
- int value_top_sizeof;
- int value_base_sizeof;
-
- /* Get next datum & put its type & key to buffer */
- gs_param_typed_value value;
- char string_key[256];
-
- if (sizeof(string_key) < key.size + 1) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- memcpy(string_key, key.data, key.size);
- string_key[key.size] = 0;
- if ((code = param_read_typed(list, string_key, &value)) != 0) {
- code = code > 0 ? gs_note_error(gs_error_unknownerror) : code;
- break;
- }
- wb_put_word((unsigned)key.size + 1, &write_buf);
- wb_put_word((unsigned)value.type, &write_buf);
- wb_put_bytes((byte *) string_key, key.size + 1, &write_buf);
-
- /* Put value & its size to buffer */
- value_top_sizeof = gs_param_type_sizes[value.type];
- value_base_sizeof = gs_param_type_base_sizes[value.type];
- switch (value.type) {
- case gs_param_type_null:
- case gs_param_type_bool:
- case gs_param_type_int:
- case gs_param_type_long:
- case gs_param_type_float:
- wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
- break;
-
- case gs_param_type_string:
- case gs_param_type_name:
- case gs_param_type_int_array:
- case gs_param_type_float_array:
- wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
- wb_put_alignment(value_base_sizeof, &write_buf);
- value_base_sizeof *= value.value.s.size;
- wb_put_bytes(value.value.s.data, value_base_sizeof, &write_buf);
- break;
-
- case gs_param_type_string_array:
- case gs_param_type_name_array:
- value_base_sizeof *= value.value.sa.size;
- wb_put_bytes((const byte *)&value.value, value_top_sizeof, &write_buf);
- wb_put_alignment(sizeof(void *), &write_buf);
-
- wb_put_bytes((const byte *)value.value.sa.data, value_base_sizeof,
- &write_buf);
- {
- int str_count;
- const gs_param_string *sa;
-
- for (str_count = value.value.sa.size,
- sa = value.value.sa.data; str_count-- > 0; ++sa)
- wb_put_bytes(sa->data, sa->size, &write_buf);
- }
- break;
-
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- wb_put_word(value.value.d.size, &write_buf);
- wb_put_alignment(sizeof(void *), &write_buf);
-
- {
- int bytes_written =
- gs_param_list_serialize(value.value.d.list,
- write_buf.buf,
- write_buf.buf ? write_buf.buf_end - write_buf.buf : 0);
-
- temp_code = param_end_read_dict(list,
- (const char *)key.data,
- &value.value.d);
- if (bytes_written < 0)
- code = bytes_written;
- else {
- code = temp_code;
- if (bytes_written)
- wb_put_bytes(write_buf.buf, bytes_written, &write_buf);
- }
- }
- break;
-
- default:
- code = gs_note_error(gs_error_unknownerror);
- break;
- }
- if (code < 0)
- break;
+ int value_top_sizeof;
+ int value_base_sizeof;
+
+ /* Get next datum & put its type & key to buffer */
+ gs_param_typed_value value;
+ char string_key[256];
+
+ if (sizeof(string_key) < key.size + 1) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ memcpy(string_key, key.data, key.size);
+ string_key[key.size] = 0;
+ if ((code = param_read_typed(list, string_key, &value)) != 0) {
+ code = code > 0 ? gs_note_error(gs_error_unknownerror) : code;
+ break;
+ }
+ wb_put_word((unsigned)key.size + 1, &write_buf);
+ wb_put_word((unsigned)value.type, &write_buf);
+ wb_put_bytes((byte *) string_key, key.size + 1, &write_buf);
+
+ /* Put value & its size to buffer */
+ value_top_sizeof = gs_param_type_sizes[value.type];
+ value_base_sizeof = gs_param_type_base_sizes[value.type];
+ switch (value.type) {
+ case gs_param_type_null:
+ case gs_param_type_bool:
+ case gs_param_type_int:
+ case gs_param_type_long:
+ case gs_param_type_float:
+ wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
+ break;
+
+ case gs_param_type_string:
+ case gs_param_type_name:
+ case gs_param_type_int_array:
+ case gs_param_type_float_array:
+ wb_put_bytes((byte *) & value.value, value_top_sizeof, &write_buf);
+ wb_put_alignment(value_base_sizeof, &write_buf);
+ value_base_sizeof *= value.value.s.size;
+ wb_put_bytes(value.value.s.data, value_base_sizeof, &write_buf);
+ break;
+
+ case gs_param_type_string_array:
+ case gs_param_type_name_array:
+ value_base_sizeof *= value.value.sa.size;
+ wb_put_bytes((const byte *)&value.value, value_top_sizeof, &write_buf);
+ wb_put_alignment(sizeof(void *), &write_buf);
+
+ wb_put_bytes((const byte *)value.value.sa.data, value_base_sizeof,
+ &write_buf);
+ {
+ int str_count;
+ const gs_param_string *sa;
+
+ for (str_count = value.value.sa.size,
+ sa = value.value.sa.data; str_count-- > 0; ++sa)
+ wb_put_bytes(sa->data, sa->size, &write_buf);
+ }
+ break;
+
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ wb_put_word(value.value.d.size, &write_buf);
+ wb_put_alignment(sizeof(void *), &write_buf);
+
+ {
+ int bytes_written =
+ gs_param_list_serialize(value.value.d.list,
+ write_buf.buf,
+ write_buf.buf ? write_buf.buf_end - write_buf.buf : 0);
+
+ temp_code = param_end_read_dict(list,
+ (const char *)key.data,
+ &value.value.d);
+ if (bytes_written < 0)
+ code = bytes_written;
+ else {
+ code = temp_code;
+ if (bytes_written)
+ wb_put_bytes(write_buf.buf, bytes_written, &write_buf);
+ }
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_unknownerror);
+ break;
+ }
+ if (code < 0)
+ break;
}
/* Write end marker, which is an (illegal) 0 key length */
if (code >= 0) {
- wb_put_word(0, &write_buf);
- code = write_buf.total_sizeof;
+ wb_put_word(0, &write_buf);
+ code = write_buf.total_sizeof;
}
return code;
}
-
/* ------------ Expander --------------- */
/* Expand a buffer into a gs_param_list (including sub-dicts) */
int /* ret -ve err, +ve # of chars read from buffer */
gs_param_list_unserialize(
- gs_param_list * list, /* root of list to expand to */
- /* list MUST BE IN WRITE MODE */
- const byte * buf /* source buffer */
+ gs_param_list * list, /* root of list to expand to */
+ /* list MUST BE IN WRITE MODE */
+ const byte * buf /* source buffer */
)
{
int code = 0;
const byte *orig_buf = buf;
do {
- gs_param_typed_value typed;
- gs_param_name key;
- unsigned key_sizeof;
- int value_top_sizeof;
- int value_base_sizeof;
- int temp_code;
- gs_param_type type;
-
- /* key length, 0 indicates end of data */
- key_sizeof = buf_get_word(&buf);
- if (key_sizeof == 0) /* end of data */
- break;
-
- /* data type */
- type = (gs_param_type) buf_get_word(&buf);
-
- /* key */
- key = (gs_param_name) buf;
- buf += key_sizeof;
-
- /* Data values */
- value_top_sizeof = gs_param_type_sizes[type];
- value_base_sizeof = gs_param_type_base_sizes[type];
- typed.type = type;
- if (type != gs_param_type_dict && type != gs_param_type_dict_int_keys) {
- memcpy(&typed.value, buf, value_top_sizeof);
- buf += value_top_sizeof;
- }
- switch (type) {
- case gs_param_type_null:
- case gs_param_type_bool:
- case gs_param_type_int:
- case gs_param_type_long:
- case gs_param_type_float:
- break;
-
- case gs_param_type_string:
- case gs_param_type_name:
- case gs_param_type_int_array:
- case gs_param_type_float_array:
- ptr_align_to(&buf, value_base_sizeof);
- typed.value.s.data = buf;
- typed.value.s.persistent = false;
- buf += typed.value.s.size * value_base_sizeof;
- break;
-
- case gs_param_type_string_array:
- case gs_param_type_name_array:
- ptr_align_to(&buf, sizeof(void *));
-
- typed.value.sa.data = (const gs_param_string *)buf;
- typed.value.sa.persistent = false;
- buf += typed.value.s.size * value_base_sizeof;
- {
- int str_count;
- gs_param_string *sa;
-
- for (str_count = typed.value.sa.size,
- sa = (gs_param_string *) typed.value.sa.data;
- str_count-- > 0; ++sa) {
- sa->data = buf;
- sa->persistent = false;
- buf += sa->size;
- }
- }
- break;
-
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- typed.value.d.size = buf_get_word(&buf);
- code = param_begin_write_dict
- (list, key, &typed.value.d, type == gs_param_type_dict_int_keys);
- if (code < 0)
- break;
- ptr_align_to(&buf, sizeof(void *));
-
- code = gs_param_list_unserialize(typed.value.d.list, buf);
- temp_code = param_end_write_dict(list, key, &typed.value.d);
- if (code >= 0) {
- buf += code;
- code = temp_code;
- }
- break;
-
- default:
- code = gs_note_error(gs_error_unknownerror);
- break;
- }
- if (code < 0)
- break;
- if (typed.type != gs_param_type_dict && typed.type != gs_param_type_dict_int_keys)
- code = param_write_typed(list, key, &typed);
+ gs_param_typed_value typed;
+ gs_param_name key;
+ unsigned key_sizeof;
+ int value_top_sizeof;
+ int value_base_sizeof;
+ int temp_code;
+ gs_param_type type;
+
+ /* key length, 0 indicates end of data */
+ key_sizeof = buf_get_word(&buf);
+ if (key_sizeof == 0) /* end of data */
+ break;
+
+ /* data type */
+ type = (gs_param_type) buf_get_word(&buf);
+
+ /* key */
+ key = (gs_param_name) buf;
+ buf += key_sizeof;
+
+ /* Data values */
+ value_top_sizeof = gs_param_type_sizes[type];
+ value_base_sizeof = gs_param_type_base_sizes[type];
+ typed.type = type;
+ if (type != gs_param_type_dict && type != gs_param_type_dict_int_keys) {
+ memcpy(&typed.value, buf, value_top_sizeof);
+ buf += value_top_sizeof;
+ }
+ switch (type) {
+ case gs_param_type_null:
+ case gs_param_type_bool:
+ case gs_param_type_int:
+ case gs_param_type_long:
+ case gs_param_type_float:
+ break;
+
+ case gs_param_type_string:
+ case gs_param_type_name:
+ case gs_param_type_int_array:
+ case gs_param_type_float_array:
+ ptr_align_to(&buf, value_base_sizeof);
+ typed.value.s.data = buf;
+ typed.value.s.persistent = false;
+ buf += typed.value.s.size * value_base_sizeof;
+ break;
+
+ case gs_param_type_string_array:
+ case gs_param_type_name_array:
+ ptr_align_to(&buf, sizeof(void *));
+
+ typed.value.sa.data = (const gs_param_string *)buf;
+ typed.value.sa.persistent = false;
+ buf += typed.value.s.size * value_base_sizeof;
+ {
+ int str_count;
+ gs_param_string *sa;
+
+ for (str_count = typed.value.sa.size,
+ sa = (gs_param_string *) typed.value.sa.data;
+ str_count-- > 0; ++sa) {
+ sa->data = buf;
+ sa->persistent = false;
+ buf += sa->size;
+ }
+ }
+ break;
+
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ typed.value.d.size = buf_get_word(&buf);
+ code = param_begin_write_dict
+ (list, key, &typed.value.d, type == gs_param_type_dict_int_keys);
+ if (code < 0)
+ break;
+ ptr_align_to(&buf, sizeof(void *));
+
+ code = gs_param_list_unserialize(typed.value.d.list, buf);
+ temp_code = param_end_write_dict(list, key, &typed.value.d);
+ if (code >= 0) {
+ buf += code;
+ code = temp_code;
+ }
+ break;
+
+ default:
+ code = gs_note_error(gs_error_unknownerror);
+ break;
+ }
+ if (code < 0)
+ break;
+ if (typed.type != gs_param_type_dict && typed.type != gs_param_type_dict_int_keys)
+ code = param_write_typed(list, key, &typed);
}
while (code >= 0);
return code >= 0 ? buf - orig_buf : code;
}
-
/* ---------- Utility functions -------- */
/* Align a byte pointer on the next Nth byte */
static void
ptr_align_to(
- const byte ** src, /* pointer to align */
- unsigned alignment /* alignment, must be power of 2 */
+ const byte ** src, /* pointer to align */
+ unsigned alignment /* alignment, must be power of 2 */
)
{
*src += -(int)ALIGNMENT_MOD(*src, alignment) & (alignment - 1);
@@ -340,19 +337,19 @@ ptr_align_to(
/* Put compressed word repr to a buffer */
static void
wb_put_word(
- unsigned source, /* number to put to buffer */
- WriteBuffer * dest /* destination descriptor */
+ unsigned source, /* number to put to buffer */
+ WriteBuffer * dest /* destination descriptor */
)
{
do {
- byte chunk = source & 0x7f;
-
- if (source >= 0x80)
- chunk |= 0x80;
- source >>= 7;
- ++dest->total_sizeof;
- if (dest->buf && dest->buf < dest->buf_end)
- *dest->buf++ = chunk;
+ byte chunk = source & 0x7f;
+
+ if (source >= 0x80)
+ chunk |= 0x80;
+ source >>= 7;
+ ++dest->total_sizeof;
+ if (dest->buf && dest->buf < dest->buf_end)
+ *dest->buf++ = chunk;
}
while (source != 0);
}
@@ -360,37 +357,37 @@ wb_put_word(
/* Put array of bytes to buffer */
static void
wb_put_bytes(
- const byte * source, /* bytes to put to buffer */
- unsigned source_sizeof, /* # bytes to put */
- WriteBuffer * dest /* destination descriptor */
+ const byte * source, /* bytes to put to buffer */
+ unsigned source_sizeof, /* # bytes to put */
+ WriteBuffer * dest /* destination descriptor */
)
{
dest->total_sizeof += source_sizeof;
if (dest->buf && dest->buf + source_sizeof <= dest->buf_end) {
- if (dest->buf != source)
- memcpy(dest->buf, source, source_sizeof);
- dest->buf += source_sizeof;
+ if (dest->buf != source)
+ memcpy(dest->buf, source, source_sizeof);
+ dest->buf += source_sizeof;
}
}
/* Pad destination out to req'd alignment w/zeros */
static void
wb_put_alignment(
- unsigned alignment, /* alignment to match, must be power 2 */
- WriteBuffer * dest /* destination descriptor */
+ unsigned alignment, /* alignment to match, must be power 2 */
+ WriteBuffer * dest /* destination descriptor */
)
{
static const byte zero =
{0};
while ((dest->total_sizeof & (alignment - 1)) != 0)
- wb_put_bytes(&zero, 1, dest);
+ wb_put_bytes(&zero, 1, dest);
}
/* Get word compressed with wb_put_word */
static unsigned /* decompressed word */
buf_get_word(
- const byte ** src /* UPDATES: ptr to src buf ptr */
+ const byte ** src /* UPDATES: ptr to src buf ptr */
)
{
unsigned dest = 0;
@@ -398,9 +395,9 @@ buf_get_word(
unsigned shift = 0;
do {
- chunk = *(*src)++;
- dest |= (chunk & 0x7f) << shift;
- shift += 7;
+ chunk = *(*src)++;
+ dest |= (chunk & 0x7f) << shift;
+ shift += 7;
}
while (chunk & 0x80);
diff --git a/gs/base/gsparams.h b/gs/base/gsparams.h
index e93f8032c..446cd47c8 100644
--- a/gs/base/gsparams.h
+++ b/gs/base/gsparams.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsparamx.c b/gs/base/gsparamx.c
index d88a1a10b..6f8f8d865 100644
--- a/gs/base/gsparamx.c
+++ b/gs/base/gsparamx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,34 +26,34 @@ bool
gs_param_string_eq(const gs_param_string * pcs, const char *str)
{
return (strlen(str) == pcs->size &&
- !strncmp(str, (const char *)pcs->data, pcs->size));
+ !strncmp(str, (const char *)pcs->data, pcs->size));
}
/* Put an enumerated value. */
int
param_put_enum(gs_param_list * plist, gs_param_name param_name,
- int *pvalue, const char *const pnames[], int ecode)
+ int *pvalue, const char *const pnames[], int ecode)
{
gs_param_string ens;
int code = param_read_name(plist, param_name, &ens);
switch (code) {
- case 1:
- return ecode;
- case 0:
- {
- int i;
-
- for (i = 0; pnames[i] != 0; ++i)
- if (gs_param_string_eq(&ens, pnames[i])) {
- *pvalue = i;
- return 0;
- }
- }
- code = gs_error_rangecheck;
- default:
- ecode = code;
- param_signal_error(plist, param_name, code);
+ case 1:
+ return ecode;
+ case 0:
+ {
+ int i;
+
+ for (i = 0; pnames[i] != 0; ++i)
+ if (gs_param_string_eq(&ens, pnames[i])) {
+ *pvalue = i;
+ return 0;
+ }
+ }
+ code = gs_error_rangecheck;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, code);
}
return code;
}
@@ -61,17 +61,17 @@ param_put_enum(gs_param_list * plist, gs_param_name param_name,
/* Put a Boolean value. */
int
param_put_bool(gs_param_list * plist, gs_param_name param_name,
- bool * pval, int ecode)
+ bool * pval, int ecode)
{
int code;
switch (code = param_read_bool(plist, param_name, pval)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
return ecode;
}
@@ -79,17 +79,17 @@ param_put_bool(gs_param_list * plist, gs_param_name param_name,
/* Put an integer value. */
int
param_put_int(gs_param_list * plist, gs_param_name param_name,
- int *pval, int ecode)
+ int *pval, int ecode)
{
int code;
switch (code = param_read_int(plist, param_name, pval)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
return ecode;
}
@@ -97,17 +97,17 @@ param_put_int(gs_param_list * plist, gs_param_name param_name,
/* Put a long value. */
int
param_put_long(gs_param_list * plist, gs_param_name param_name,
- long *pval, int ecode)
+ long *pval, int ecode)
{
int code;
switch (code = param_read_long(plist, param_name, pval)) {
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 0:
- case 1:
- break;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 0:
+ case 1:
+ break;
}
return ecode;
}
@@ -127,60 +127,60 @@ param_list_copy(gs_param_list *plto, gs_param_list *plfrom)
param_init_enumerator(&key_enum);
while ((code = param_get_next_key(plfrom, &key_enum, &key)) == 0) {
- char string_key[256]; /* big enough for any reasonable key */
- gs_param_typed_value value;
- gs_param_collection_type_t coll_type;
- gs_param_typed_value copy;
-
- if (key.size > sizeof(string_key) - 1) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- memcpy(string_key, key.data, key.size);
- string_key[key.size] = 0;
- if ((code = param_read_typed(plfrom, string_key, &value)) != 0) {
- code = (code > 0 ? gs_note_error(gs_error_unknownerror) : code);
- break;
- }
- gs_param_list_set_persistent_keys(plto, key.persistent);
- switch (value.type) {
- case gs_param_type_dict:
- coll_type = gs_param_collection_dict_any;
- goto cc;
- case gs_param_type_dict_int_keys:
- coll_type = gs_param_collection_dict_int_keys;
- goto cc;
- case gs_param_type_array:
- coll_type = gs_param_collection_array;
- cc:
- copy.value.d.size = value.value.d.size;
- if ((code = param_begin_write_collection(plto, string_key,
- &copy.value.d,
- coll_type)) < 0 ||
- (code = param_list_copy(copy.value.d.list,
- value.value.d.list)) < 0 ||
- (code = param_end_write_collection(plto, string_key,
- &copy.value.d)) < 0)
- break;
- code = param_end_read_collection(plfrom, string_key,
- &value.value.d);
- break;
- case gs_param_type_string:
- value.value.s.persistent &= copy_persists; goto ca;
- case gs_param_type_name:
- value.value.n.persistent &= copy_persists; goto ca;
- case gs_param_type_int_array:
- value.value.ia.persistent &= copy_persists; goto ca;
- case gs_param_type_float_array:
- value.value.fa.persistent &= copy_persists; goto ca;
- case gs_param_type_string_array:
- value.value.sa.persistent &= copy_persists;
- ca:
- default:
- code = param_write_typed(plto, string_key, &value);
- }
- if (code < 0)
- break;
+ char string_key[256]; /* big enough for any reasonable key */
+ gs_param_typed_value value;
+ gs_param_collection_type_t coll_type;
+ gs_param_typed_value copy;
+
+ if (key.size > sizeof(string_key) - 1) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ memcpy(string_key, key.data, key.size);
+ string_key[key.size] = 0;
+ if ((code = param_read_typed(plfrom, string_key, &value)) != 0) {
+ code = (code > 0 ? gs_note_error(gs_error_unknownerror) : code);
+ break;
+ }
+ gs_param_list_set_persistent_keys(plto, key.persistent);
+ switch (value.type) {
+ case gs_param_type_dict:
+ coll_type = gs_param_collection_dict_any;
+ goto cc;
+ case gs_param_type_dict_int_keys:
+ coll_type = gs_param_collection_dict_int_keys;
+ goto cc;
+ case gs_param_type_array:
+ coll_type = gs_param_collection_array;
+ cc:
+ copy.value.d.size = value.value.d.size;
+ if ((code = param_begin_write_collection(plto, string_key,
+ &copy.value.d,
+ coll_type)) < 0 ||
+ (code = param_list_copy(copy.value.d.list,
+ value.value.d.list)) < 0 ||
+ (code = param_end_write_collection(plto, string_key,
+ &copy.value.d)) < 0)
+ break;
+ code = param_end_read_collection(plfrom, string_key,
+ &value.value.d);
+ break;
+ case gs_param_type_string:
+ value.value.s.persistent &= copy_persists; goto ca;
+ case gs_param_type_name:
+ value.value.n.persistent &= copy_persists; goto ca;
+ case gs_param_type_int_array:
+ value.value.ia.persistent &= copy_persists; goto ca;
+ case gs_param_type_float_array:
+ value.value.fa.persistent &= copy_persists; goto ca;
+ case gs_param_type_string_array:
+ value.value.sa.persistent &= copy_persists;
+ ca:
+ default:
+ code = param_write_typed(plto, string_key, &value);
+ }
+ if (code < 0)
+ break;
}
return code;
}
diff --git a/gs/base/gsparamx.h b/gs/base/gsparamx.h
index 90dfc58c0..55cc384c8 100644
--- a/gs/base/gsparamx.h
+++ b/gs/base/gsparamx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,13 +25,13 @@ bool gs_param_string_eq(const gs_param_string *pcs, const char *str);
* the previous accumulated error code.
*/
int param_put_enum(gs_param_list * plist, gs_param_name param_name,
- int *pvalue, const char *const pnames[], int ecode);
+ int *pvalue, const char *const pnames[], int ecode);
int param_put_bool(gs_param_list * plist, gs_param_name param_name,
- bool * pval, int ecode);
+ bool * pval, int ecode);
int param_put_int(gs_param_list * plist, gs_param_name param_name,
- int * pval, int ecode);
+ int * pval, int ecode);
int param_put_long(gs_param_list * plist, gs_param_name param_name,
- long * pval, int ecode);
+ long * pval, int ecode);
/* Copy one parameter list to another, recursively if necessary. */
int param_list_copy(gs_param_list *plto, gs_param_list *plfrom);
diff --git a/gs/base/gspath.c b/gs/base/gspath.c
index 853e25438..4964b2a08 100644
--- a/gs/base/gspath.c
+++ b/gs/base/gspath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,7 @@ gs_closepath(gs_state * pgs)
int code = gx_path_close_subpath(ppath);
if (code < 0)
- return code;
+ return code;
pgs->current_point = pgs->subpath_start;
return code;
}
@@ -61,11 +61,11 @@ gs_upmergepath(gs_state * pgs)
code = gx_path_add_path(saved->path, pgs->path);
if (code < 0)
- return code;
+ return code;
if (pgs->current_point_valid) {
- saved->current_point = pgs->current_point;
- saved->subpath_start = pgs->subpath_start;
- saved->current_point_valid = true;
+ saved->current_point = pgs->current_point;
+ saved->subpath_start = pgs->subpath_start;
+ saved->current_point_valid = true;
}
return code;
}
@@ -90,12 +90,12 @@ int
gs_currentpoint(gs_state * pgs, gs_point * ppt)
{
if (!pgs->current_point_valid)
- return_error(gs_error_nocurrentpoint);
- return gs_itransform(pgs, pgs->current_point.x,
- pgs->current_point.y, ppt);
+ return_error(gs_error_nocurrentpoint);
+ return gs_itransform(pgs, pgs->current_point.x,
+ pgs->current_point.y, ppt);
}
-static inline int
+static inline int
gs_point_transform_compat(floatp x, floatp y, const gs_matrix_fixed *m, gs_point *pt)
{
#if !PRECISE_CURRENTPOINT
@@ -103,7 +103,7 @@ gs_point_transform_compat(floatp x, floatp y, const gs_matrix_fixed *m, gs_point
int code = gs_point_transform2fixed(m, x, y, &p);
if (code < 0)
- return code;
+ return code;
pt->x = fixed2float(p.x);
pt->y = fixed2float(p.y);
return 0;
@@ -112,7 +112,7 @@ gs_point_transform_compat(floatp x, floatp y, const gs_matrix_fixed *m, gs_point
#endif
}
-static inline int
+static inline int
gs_distance_transform_compat(floatp x, floatp y, const gs_matrix_fixed *m, gs_point *pt)
{
#if !PRECISE_CURRENTPOINT
@@ -120,7 +120,7 @@ gs_distance_transform_compat(floatp x, floatp y, const gs_matrix_fixed *m, gs_po
int code = gs_distance_transform2fixed(m, x, y, &p);
if (code < 0)
- return code;
+ return code;
pt->x = fixed2float(p.x);
pt->y = fixed2float(p.y);
return 0;
@@ -133,14 +133,14 @@ static inline int
clamp_point_aux(bool clamp_coordinates, gs_fixed_point *ppt, floatp x, floatp y)
{
if (!f_fits_in_bits(x, fixed_int_bits) || !f_fits_in_bits(y, fixed_int_bits)) {
- if (!clamp_coordinates)
- return_error(gs_error_limitcheck);
- clamp_point(ppt, x, y);
+ if (!clamp_coordinates)
+ return_error(gs_error_limitcheck);
+ clamp_point(ppt, x, y);
} else {
- /* 181-01.ps" fails with no rounding in
- "Verify as last element of a userpath and effect on setbbox." */
- ppt->x = float2fixed_rounded(x);
- ppt->y = float2fixed_rounded(y);
+ /* 181-01.ps" fails with no rounding in
+ "Verify as last element of a userpath and effect on setbbox." */
+ ppt->x = float2fixed_rounded(x);
+ ppt->y = float2fixed_rounded(y);
}
return 0;
}
@@ -153,10 +153,10 @@ gs_moveto_aux(gs_imager_state *pis, gx_path *ppath, floatp x, floatp y)
code = clamp_point_aux(pis->clamp_coordinates, &pt, x, y);
if (code < 0)
- return code;
+ return code;
code = gx_path_add_point(ppath, pt.x, pt.y);
if (code < 0)
- return code;
+ return code;
ppath->start_flags = ppath->state_flags;
gx_setcurrentpoint(pis, x, y);
pis->subpath_start = pis->current_point;
@@ -171,7 +171,7 @@ gs_moveto(gs_state * pgs, floatp x, floatp y)
int code = gs_point_transform_compat(x, y, &pgs->ctm, &pt);
if (code < 0)
- return code;
+ return code;
return gs_moveto_aux((gs_imager_state *)pgs, pgs->path, pt.x, pt.y);
}
@@ -179,16 +179,16 @@ int
gs_rmoveto(gs_state * pgs, floatp x, floatp y)
{
gs_point dd;
- int code;
+ int code;
if (!pgs->current_point_valid)
- return_error(gs_error_nocurrentpoint);
+ return_error(gs_error_nocurrentpoint);
code = gs_distance_transform_compat(x, y, &pgs->ctm, &dd);
if (code < 0)
- return code;
+ return code;
/* fixme : check in range. */
- return gs_moveto_aux((gs_imager_state *)pgs, pgs->path,
- dd.x + pgs->current_point.x, dd.y + pgs->current_point.y);
+ return gs_moveto_aux((gs_imager_state *)pgs, pgs->path,
+ dd.x + pgs->current_point.x, dd.y + pgs->current_point.y);
}
static inline int
@@ -200,10 +200,10 @@ gs_lineto_aux(gs_state * pgs, floatp x, floatp y)
code = clamp_point_aux(pgs->clamp_coordinates, &pt, x, y);
if (code < 0)
- return code;
+ return code;
code = gx_path_add_line(ppath, pt.x, pt.y);
if (code < 0)
- return code;
+ return code;
gx_setcurrentpoint(pgs, x, y);
return 0;
}
@@ -215,7 +215,7 @@ gs_lineto(gs_state * pgs, floatp x, floatp y)
int code = gs_point_transform_compat(x, y, &pgs->ctm, &pt);
if (code < 0)
- return code;
+ return code;
return gs_lineto_aux(pgs, pt.x, pt.y);
}
@@ -223,15 +223,15 @@ int
gs_rlineto(gs_state * pgs, floatp x, floatp y)
{
gs_point dd;
- int code;
+ int code;
if (!pgs->current_point_valid)
- return_error(gs_error_nocurrentpoint);
+ return_error(gs_error_nocurrentpoint);
code = gs_distance_transform_compat(x, y, &pgs->ctm, &dd);
if (code < 0)
- return code;
+ return code;
/* fixme : check in range. */
- return gs_lineto_aux(pgs, dd.x + pgs->current_point.x,
+ return gs_lineto_aux(pgs, dd.x + pgs->current_point.x,
dd.y + pgs->current_point.y);
}
@@ -239,7 +239,7 @@ gs_rlineto(gs_state * pgs, floatp x, floatp y)
static inline int
gs_curveto_aux(gs_state * pgs,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3)
{
gs_fixed_point p1, p2, p3;
int code;
@@ -247,36 +247,36 @@ gs_curveto_aux(gs_state * pgs,
code = clamp_point_aux(pgs->clamp_coordinates, &p1, x1, y1);
if (code < 0)
- return code;
+ return code;
code = clamp_point_aux(pgs->clamp_coordinates, &p2, x2, y2);
if (code < 0)
- return code;
+ return code;
code = clamp_point_aux(pgs->clamp_coordinates, &p3, x3, y3);
if (code < 0)
- return code;
+ return code;
code = gx_path_add_curve(ppath, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y);
if (code < 0)
- return code;
+ return code;
gx_setcurrentpoint(pgs, x3, y3);
return 0;
}
int
gs_curveto(gs_state * pgs,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3)
{
gs_point pt1, pt2, pt3;
int code;
code = gs_point_transform_compat(x1, y1, &pgs->ctm, &pt1);
if (code < 0)
- return code;
+ return code;
code = gs_point_transform_compat(x2, y2, &pgs->ctm, &pt2);
if (code < 0)
- return code;
+ return code;
code = gs_point_transform_compat(x3, y3, &pgs->ctm, &pt3);
if (code < 0)
- return code;
+ return code;
return gs_curveto_aux(pgs, pt1.x, pt1.y, pt2.x, pt2.y, pt3.x, pt3.y);
}
@@ -285,23 +285,23 @@ gs_rcurveto(gs_state * pgs,
floatp dx1, floatp dy1, floatp dx2, floatp dy2, floatp dx3, floatp dy3)
{
gs_point dd1, dd2, dd3;
- int code;
+ int code;
if (!pgs->current_point_valid)
- return_error(gs_error_nocurrentpoint);
+ return_error(gs_error_nocurrentpoint);
code = gs_distance_transform_compat(dx1, dy1, &pgs->ctm, &dd1);
if (code < 0)
- return code;
+ return code;
code = gs_distance_transform_compat(dx2, dy2, &pgs->ctm, &dd2);
if (code < 0)
- return code;
+ return code;
code = gs_distance_transform_compat(dx3, dy3, &pgs->ctm, &dd3);
if (code < 0)
- return code;
+ return code;
/* fixme : check in range. */
- return gs_curveto_aux(pgs, dd1.x + pgs->current_point.x, dd1.y + pgs->current_point.y,
- dd2.x + pgs->current_point.x, dd2.y + pgs->current_point.y,
- dd3.x + pgs->current_point.x, dd3.y + pgs->current_point.y);
+ return gs_curveto_aux(pgs, dd1.x + pgs->current_point.x, dd1.y + pgs->current_point.y,
+ dd2.x + pgs->current_point.x, dd2.y + pgs->current_point.y,
+ dd3.x + pgs->current_point.x, dd3.y + pgs->current_point.y);
}
/* ------ Clipping ------ */
@@ -321,67 +321,67 @@ int
gx_effective_clip_path(gs_state * pgs, gx_clip_path ** ppcpath)
{
gs_id view_clip_id =
- (pgs->view_clip == 0 || pgs->view_clip->rule == 0 ? gs_no_id :
- pgs->view_clip->id);
+ (pgs->view_clip == 0 || pgs->view_clip->rule == 0 ? gs_no_id :
+ pgs->view_clip->id);
if (gs_device_is_memory(pgs->device)) {
- *ppcpath = pgs->clip_path;
- return 0;
+ *ppcpath = pgs->clip_path;
+ return 0;
}
if (pgs->effective_clip_id == pgs->clip_path->id &&
- pgs->effective_view_clip_id == view_clip_id
- ) {
- *ppcpath = pgs->effective_clip_path;
- return 0;
+ pgs->effective_view_clip_id == view_clip_id
+ ) {
+ *ppcpath = pgs->effective_clip_path;
+ return 0;
}
/* Update the cache. */
if (view_clip_id == gs_no_id) {
- if (!pgs->effective_clip_shared)
- gx_cpath_free(pgs->effective_clip_path, "gx_effective_clip_path");
- pgs->effective_clip_path = pgs->clip_path;
- pgs->effective_clip_shared = true;
+ if (!pgs->effective_clip_shared)
+ gx_cpath_free(pgs->effective_clip_path, "gx_effective_clip_path");
+ pgs->effective_clip_path = pgs->clip_path;
+ pgs->effective_clip_shared = true;
} else {
- gs_fixed_rect cbox, vcbox;
-
- gx_cpath_inner_box(pgs->clip_path, &cbox);
- gx_cpath_outer_box(pgs->view_clip, &vcbox);
- if (rect_within(vcbox, cbox)) {
- if (!pgs->effective_clip_shared)
- gx_cpath_free(pgs->effective_clip_path,
- "gx_effective_clip_path");
- pgs->effective_clip_path = pgs->view_clip;
- pgs->effective_clip_shared = true;
- } else {
- /* Construct the intersection of the two clip paths. */
- int code;
- gx_clip_path ipath;
- gx_path vpath;
- gx_clip_path *npath = pgs->effective_clip_path;
-
- if (pgs->effective_clip_shared) {
- npath = gx_cpath_alloc(pgs->memory, "gx_effective_clip_path");
- if (npath == 0)
- return_error(gs_error_VMerror);
- }
- gx_cpath_init_local(&ipath, pgs->memory);
- code = gx_cpath_assign_preserve(&ipath, pgs->clip_path);
- if (code < 0)
- return code;
- gx_path_init_local(&vpath, pgs->memory);
- code = gx_cpath_to_path(pgs->view_clip, &vpath);
- if (code < 0 ||
- (code = gx_cpath_clip(pgs, &ipath, &vpath,
- gx_rule_winding_number)) < 0 ||
- (code = gx_cpath_assign_free(npath, &ipath)) < 0
- )
- DO_NOTHING;
- gx_path_free(&vpath, "gx_effective_clip_path");
- gx_cpath_free(&ipath, "gx_effective_clip_path");
- if (code < 0)
- return code;
- pgs->effective_clip_path = npath;
- pgs->effective_clip_shared = false;
- }
+ gs_fixed_rect cbox, vcbox;
+
+ gx_cpath_inner_box(pgs->clip_path, &cbox);
+ gx_cpath_outer_box(pgs->view_clip, &vcbox);
+ if (rect_within(vcbox, cbox)) {
+ if (!pgs->effective_clip_shared)
+ gx_cpath_free(pgs->effective_clip_path,
+ "gx_effective_clip_path");
+ pgs->effective_clip_path = pgs->view_clip;
+ pgs->effective_clip_shared = true;
+ } else {
+ /* Construct the intersection of the two clip paths. */
+ int code;
+ gx_clip_path ipath;
+ gx_path vpath;
+ gx_clip_path *npath = pgs->effective_clip_path;
+
+ if (pgs->effective_clip_shared) {
+ npath = gx_cpath_alloc(pgs->memory, "gx_effective_clip_path");
+ if (npath == 0)
+ return_error(gs_error_VMerror);
+ }
+ gx_cpath_init_local(&ipath, pgs->memory);
+ code = gx_cpath_assign_preserve(&ipath, pgs->clip_path);
+ if (code < 0)
+ return code;
+ gx_path_init_local(&vpath, pgs->memory);
+ code = gx_cpath_to_path(pgs->view_clip, &vpath);
+ if (code < 0 ||
+ (code = gx_cpath_clip(pgs, &ipath, &vpath,
+ gx_rule_winding_number)) < 0 ||
+ (code = gx_cpath_assign_free(npath, &ipath)) < 0
+ )
+ DO_NOTHING;
+ gx_path_free(&vpath, "gx_effective_clip_path");
+ gx_cpath_free(&ipath, "gx_effective_clip_path");
+ if (code < 0)
+ return code;
+ pgs->effective_clip_path = npath;
+ pgs->effective_clip_shared = false;
+ }
}
pgs->effective_clip_id = pgs->effective_clip_path->id;
pgs->effective_view_clip_id = view_clip_id;
@@ -395,8 +395,8 @@ static void
note_set_clip_path(const gs_state * pgs)
{
if (gs_debug_c('P')) {
- dlprintf("[P]Clipping path:\n");
- gx_cpath_print(pgs->clip_path);
+ dlprintf("[P]Clipping path:\n");
+ gx_cpath_print(pgs->clip_path);
}
}
#else
@@ -412,13 +412,13 @@ gs_clippath(gs_state * pgs)
gx_path_init_local(&cpath, pgs->path->memory);
code = gx_cpath_to_path(pgs->clip_path, &cpath);
if (code >= 0) {
- code = gx_path_assign_free(pgs->path, &cpath);
- pgs->current_point.x = fixed2float(pgs->path->position.x);
- pgs->current_point.y = fixed2float(pgs->path->position.y);
- pgs->current_point_valid = true;
+ code = gx_path_assign_free(pgs->path, &cpath);
+ pgs->current_point.x = fixed2float(pgs->path->position.x);
+ pgs->current_point.y = fixed2float(pgs->path->position.y);
+ pgs->current_point_valid = true;
}
if (code < 0)
- gx_path_free(&cpath, "gs_clippath");
+ gx_path_free(&cpath, "gs_clippath");
return code;
}
@@ -429,7 +429,7 @@ gs_initclip(gs_state * pgs)
int code = gx_default_clip_box(pgs, &box);
if (code < 0)
- return code;
+ return code;
return gx_clip_to_rectangle(pgs, &box);
}
@@ -450,7 +450,7 @@ common_clip(gs_state * pgs, int rule)
{
int code = gx_cpath_clip(pgs, pgs->clip_path, pgs->path, rule);
if (code < 0)
- return code;
+ return code;
pgs->clip_path->rule = rule;
note_set_clip_path(pgs);
return 0;
@@ -464,7 +464,7 @@ gx_clip_to_rectangle(gs_state * pgs, gs_fixed_rect * pbox)
int code = gx_cpath_from_rectangle(pgs->clip_path, pbox);
if (code < 0)
- return code;
+ return code;
pgs->clip_path->rule = gx_rule_winding_number;
note_set_clip_path(pgs);
return 0;
@@ -479,10 +479,10 @@ gx_clip_to_path(gs_state * pgs)
int code;
if ((code = gx_path_bbox(pgs->path, &bbox)) < 0 ||
- (code = gx_clip_to_rectangle(pgs, &bbox)) < 0 ||
- (code = gs_clip(pgs)) < 0
- )
- return code;
+ (code = gx_clip_to_rectangle(pgs, &bbox)) < 0 ||
+ (code = gs_clip(pgs)) < 0
+ )
+ return code;
note_set_clip_path(pgs);
return 0;
}
@@ -497,30 +497,30 @@ gx_default_clip_box(const gs_state * pgs, gs_fixed_rect * pbox)
int code;
if (dev->ImagingBBox_set) { /* Use the ImagingBBox, relative to default user space. */
- gs_defaultmatrix(pgs, &imat);
- bbox.p.x = dev->ImagingBBox[0];
- bbox.p.y = dev->ImagingBBox[1];
- bbox.q.x = dev->ImagingBBox[2];
- bbox.q.y = dev->ImagingBBox[3];
+ gs_defaultmatrix(pgs, &imat);
+ bbox.p.x = dev->ImagingBBox[0];
+ bbox.p.y = dev->ImagingBBox[1];
+ bbox.q.x = dev->ImagingBBox[2];
+ bbox.q.y = dev->ImagingBBox[3];
} else { /* Use the MediaSize indented by the HWMargins, */
- /* relative to unrotated user space adjusted by */
- /* the Margins. (We suspect this isn't quite right, */
- /* but the whole issue of "margins" is such a mess that */
- /* we don't think we can do any better.) */
- (*dev_proc(dev, get_initial_matrix)) (dev, &imat);
- /* Adjust for the Margins. */
- imat.tx += dev->Margins[0] * dev->HWResolution[0] /
- dev->MarginsHWResolution[0];
- imat.ty += dev->Margins[1] * dev->HWResolution[1] /
- dev->MarginsHWResolution[1];
- bbox.p.x = dev->HWMargins[0];
- bbox.p.y = dev->HWMargins[1];
- bbox.q.x = dev->MediaSize[0] - dev->HWMargins[2];
- bbox.q.y = dev->MediaSize[1] - dev->HWMargins[3];
+ /* relative to unrotated user space adjusted by */
+ /* the Margins. (We suspect this isn't quite right, */
+ /* but the whole issue of "margins" is such a mess that */
+ /* we don't think we can do any better.) */
+ (*dev_proc(dev, get_initial_matrix)) (dev, &imat);
+ /* Adjust for the Margins. */
+ imat.tx += dev->Margins[0] * dev->HWResolution[0] /
+ dev->MarginsHWResolution[0];
+ imat.ty += dev->Margins[1] * dev->HWResolution[1] /
+ dev->MarginsHWResolution[1];
+ bbox.p.x = dev->HWMargins[0];
+ bbox.p.y = dev->HWMargins[1];
+ bbox.q.x = dev->MediaSize[0] - dev->HWMargins[2];
+ bbox.q.y = dev->MediaSize[1] - dev->HWMargins[3];
}
code = gs_bbox_transform(&bbox, &imat, &bbox);
if (code < 0)
- return code;
+ return code;
/* Round the clipping box so that it doesn't get ceilinged. */
pbox->p.x = fixed_rounded(float2fixed(bbox.p.x));
pbox->p.y = fixed_rounded(float2fixed(bbox.p.y));
diff --git a/gs/base/gspath.h b/gs/base/gspath.h
index 61759d0ee..1c20ab593 100644
--- a/gs/base/gspath.h
+++ b/gs/base/gspath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,8 +65,8 @@ typedef struct gs_matrix_fixed_s gs_matrix_fixed;
#endif
/* Imager-level procedures */
-void make_quadrant_arc(gs_point *p, const gs_point *c,
- const gs_point *p0, const gs_point *p1, double r);
+void make_quadrant_arc(gs_point *p, const gs_point *c,
+ const gs_point *p0, const gs_point *p1, double r);
/* Add the current path to the path in the previous graphics state. */
int gs_upmergepath(gs_state *);
diff --git a/gs/base/gspath1.c b/gs/base/gspath1.c
index 45350d3fc..4f4d760ae 100644
--- a/gs/base/gspath1.c
+++ b/gs/base/gspath1.c
@@ -61,7 +61,6 @@ static int gs_imager_arc_add(gx_path * ppath, gs_imager_state * pis, bool clockw
floatp axc, floatp ayc, floatp arad, floatp aang1, floatp aang2,
bool add_line, gs_point *p3);
-
int
gx_setcurrentpoint_from_path(gs_imager_state *pis, gx_path *path)
{
@@ -478,7 +477,6 @@ make_quadrant_arc(gs_point *p, const gs_point *c,
p[3].y = c->y + p1->y * r;
}
-
/* ------ Path transformers ------ */
int
diff --git a/gs/base/gspath2.h b/gs/base/gspath2.h
index 6762839b1..6c3b3a90b 100644
--- a/gs/base/gspath2.h
+++ b/gs/base/gspath2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gspcolor.c b/gs/base/gspcolor.c
index 6a40b6ac5..494edd8e3 100644
--- a/gs/base/gspcolor.c
+++ b/gs/base/gspcolor.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -69,7 +69,7 @@ const gs_color_space_type gs_color_space_type_Pattern = {
/* Initialize a generic pattern template. */
void
gs_pattern_common_init(gs_pattern_template_t * ppat,
- const gs_pattern_type_t *type)
+ const gs_pattern_type_t *type)
{
ppat->type = type;
ppat->PatternType = type->PatternType;
@@ -80,7 +80,7 @@ gs_pattern_common_init(gs_pattern_template_t * ppat,
/* Generic makepattern */
int
gs_make_pattern(gs_client_color * pcc, const gs_pattern_template_t * pcp,
- const gs_matrix * pmat, gs_state * pgs, gs_memory_t * mem)
+ const gs_matrix * pmat, gs_state * pgs, gs_memory_t * mem)
{
return pcp->type->procs.make_pattern(pcc, pcp, pmat, pgs, mem);
}
@@ -91,24 +91,24 @@ gs_make_pattern(gs_client_color * pcc, const gs_pattern_template_t * pcp,
*/
int
gs_make_pattern_common(gs_client_color *pcc,
- const gs_pattern_template_t *ptemp,
- const gs_matrix *pmat, gs_state *pgs, gs_memory_t *mem,
- gs_memory_type_ptr_t pstype)
+ const gs_pattern_template_t *ptemp,
+ const gs_matrix *pmat, gs_state *pgs, gs_memory_t *mem,
+ gs_memory_type_ptr_t pstype)
{
gs_pattern_instance_t *pinst;
gs_state *saved;
if (mem == 0)
- mem = gs_state_memory(pgs);
+ mem = gs_state_memory(pgs);
rc_alloc_struct_1(pinst, gs_pattern_instance_t, pstype, mem,
- return_error(gs_error_VMerror),
- "gs_make_pattern_common");
+ return_error(gs_error_VMerror),
+ "gs_make_pattern_common");
pinst->rc.free = rc_free_pattern_instance;
pinst->type = ptemp->type;
saved = gs_state_copy(pgs, mem);
if (saved == 0) {
- gs_free_object(mem, pinst, "gs_make_pattern_common");
- return_error(gs_error_VMerror);
+ gs_free_object(mem, pinst, "gs_make_pattern_common");
+ return_error(gs_error_VMerror);
}
gs_concat(saved, pmat);
gs_newpath(saved);
@@ -121,7 +121,7 @@ gs_make_pattern_common(gs_client_color *pcc,
/* Free the saved gstate when freeing a Pattern instance. */
void
rc_free_pattern_instance(gs_memory_t * mem, void *pinst_void,
- client_name_t cname)
+ client_name_t cname)
{
gs_pattern_instance_t *pinst = pinst_void;
@@ -136,7 +136,7 @@ gs_setpattern(gs_state * pgs, const gs_client_color * pcc)
int code = gs_setpatternspace(pgs);
if (code < 0)
- return code;
+ return code;
return gs_setcolor(pgs, pcc);
}
@@ -149,20 +149,20 @@ gs_setpatternspace(gs_state * pgs)
gs_color_space *ccs_old;
if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
ccs_old = gs_currentcolorspace_inline(pgs);
if (ccs_old->type->index != gs_color_space_index_Pattern) {
- gs_color_space *pcs;
-
- pcs = gs_cspace_alloc(pgs->memory, &gs_color_space_type_Pattern);
- if (pcs == NULL)
- return_error(gs_error_VMerror);
- /* reference to base space shifts from pgs to pcs with no net change */
- pcs->base_space = ccs_old;
- pcs->params.pattern.has_base_space = true;
- pgs->color[0].color_space = pcs;
- cs_full_init_color(pgs->color[0].ccolor, pcs);
- gx_unset_dev_color(pgs);
+ gs_color_space *pcs;
+
+ pcs = gs_cspace_alloc(pgs->memory, &gs_color_space_type_Pattern);
+ if (pcs == NULL)
+ return_error(gs_error_VMerror);
+ /* reference to base space shifts from pgs to pcs with no net change */
+ pcs->base_space = ccs_old;
+ pcs->params.pattern.has_base_space = true;
+ pgs->color[0].color_space = pcs;
+ cs_full_init_color(pgs->color[0].ccolor, pcs);
+ gx_unset_dev_color(pgs);
}
return code;
}
@@ -200,25 +200,25 @@ static int
gx_num_components_Pattern(const gs_color_space * pcs)
{
return
- (pcs->params.pattern.has_base_space ?
- -1 - cs_num_components(pcs->base_space) :
- -1 /* Pattern dictionary only */ );
+ (pcs->params.pattern.has_base_space ?
+ -1 - cs_num_components(pcs->base_space) :
+ -1 /* Pattern dictionary only */ );
}
/* Remap a Pattern color. */
static int
gx_remap_Pattern(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select)
{
if (pc->pattern == 0) {
pdc->ccolor_valid = false;
pdc->ccolor.pattern = 0; /* for GC */
- color_set_null_pattern(pdc);
- return 0;
+ color_set_null_pattern(pdc);
+ return 0;
}
return
- pc->pattern->type->procs.remap_color(pc, pcs, pdc, pis, dev, select);
+ pc->pattern->type->procs.remap_color(pc, pcs, pdc, pis, dev, select);
}
/* Initialize a Pattern color. */
@@ -226,9 +226,9 @@ static void
gx_init_Pattern(gs_client_color * pcc, const gs_color_space * pcs)
{
if (pcs->params.pattern.has_base_space) {
- const gs_color_space *pbcs = pcs->base_space;
+ const gs_color_space *pbcs = pcs->base_space;
- cs_init_color(pcc, pbcs);
+ cs_init_color(pcc, pbcs);
}
/*pcc->pattern = 0; *//* cs_full_init_color handles this */
}
@@ -243,12 +243,12 @@ gx_restrict_Pattern(gs_client_color * pcc, const gs_color_space * pcs)
{
/* We need a special check for the null pattern. */
if (pcc->pattern &&
- pcc->pattern->type->procs.uses_base_space(gs_get_pattern(pcc)) &&
- pcs->params.pattern.has_base_space
- ) {
- const gs_color_space *pbcs = pcs->base_space;
+ pcc->pattern->type->procs.uses_base_space(gs_get_pattern(pcc)) &&
+ pcs->params.pattern.has_base_space
+ ) {
+ const gs_color_space *pbcs = pcs->base_space;
- (*pbcs->type->restrict_color) (pcc, pbcs);
+ (*pbcs->type->restrict_color) (pcc, pbcs);
}
}
@@ -257,7 +257,7 @@ static int
gx_install_Pattern(gs_color_space * pcs, gs_state * pgs)
{
if (!pcs->params.pattern.has_base_space)
- return 0;
+ return 0;
return (pcs->base_space->type->install_cspace)(pcs->base_space, pgs);
}
@@ -280,19 +280,19 @@ gx_final_Pattern(const gs_color_space * pcs)
static void
gx_adjust_color_Pattern(const gs_client_color * pcc,
- const gs_color_space * pcs, int delta)
+ const gs_color_space * pcs, int delta)
{
gs_pattern_instance_t *pinst = pcc->pattern;
rc_adjust_only(pinst, delta, "gx_adjust_color_Pattern");
if (pcs && pcs->params.pattern.has_base_space)
- (pcs->base_space->type->adjust_color_count)
- (pcc, pcs->base_space, delta);
+ (pcs->base_space->type->adjust_color_count)
+ (pcc, pcs->base_space, delta);
}
/* GC procedures */
-static
+static
ENUM_PTRS_BEGIN_PROC(cs_Pattern_enum_ptrs)
{
return 0;
@@ -307,7 +307,7 @@ RELOC_PTRS_END
/* ---------------- Serialization. -------------------------------- */
-static int
+static int
gx_serialize_Pattern(const gs_color_space * pcs, stream * s)
{
const gs_pattern_params * p = &pcs->params.pattern;
@@ -315,11 +315,11 @@ gx_serialize_Pattern(const gs_color_space * pcs, stream * s)
int code = gx_serialize_cspace_type(pcs, s);
if (code < 0)
- return code;
+ return code;
code = sputs(s, (const byte *)&p->has_base_space, sizeof(p->has_base_space), &n);
if (code < 0)
- return code;
+ return code;
if (!p->has_base_space)
- return 0;
+ return 0;
return cs_serialize(pcs->base_space, s);
}
diff --git a/gs/base/gspcolor.h b/gs/base/gspcolor.h
index 2b608e279..0e95fce79 100644
--- a/gs/base/gspcolor.h
+++ b/gs/base/gspcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -108,7 +108,7 @@ int gs_setpatternspace(gs_state *);
* uses rc_alloc_struct_1 to allocate pattern instances.
*/
int gs_make_pattern(gs_client_color *, const gs_pattern_template_t *,
- const gs_matrix *, gs_state *, gs_memory_t *);
+ const gs_matrix *, gs_state *, gs_memory_t *);
const gs_pattern_template_t *gs_get_pattern(const gs_client_color *);
/*
diff --git a/gs/base/gspenum.h b/gs/base/gspenum.h
index 0e480feec..920a72d92 100644
--- a/gs/base/gspenum.h
+++ b/gs/base/gspenum.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gspmdrv.c b/gs/base/gspmdrv.c
index 1bc7e6812..3c4a04816 100644
--- a/gs/base/gspmdrv.c
+++ b/gs/base/gspmdrv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,7 +78,6 @@ typedef struct tagOPTIONS {
#define CW_USEDEFAULT 32768
-
BMAP bitmap;
DISPLAY display;
OPTIONS option;
@@ -97,7 +96,6 @@ TID update_tid;
#define SB_TOP 20
#define SB_BOTTOM 21
-
MRESULT EXPENTRY ClientWndProc(HWND, ULONG, MPARAM, MPARAM);
MRESULT EXPENTRY AboutDlgProc(HWND, ULONG, MPARAM, MPARAM);
APIRET init_window(void);
@@ -123,22 +121,21 @@ debugbeep(int type)
/* 3. GpiDrawBits() or WinDrawBitmap() failed */
/* 4. Null handle PS from WinBeginPaint() */
for (i = 0; i < type; i++) {
- DosBeep(400 + 100 * type, 50);
- DosSleep(50);
+ DosBeep(400 + 100 * type, 50);
+ DosSleep(50);
}
#endif
}
-
/* display message */
int
message_box(char *str, int icon)
{
return WinMessageBox(HWND_DESKTOP, hwnd_frame ? hwnd_frame : HWND_DESKTOP,
- str, "gspmdrv.exe", 0, icon | MB_MOVEABLE | MB_OK);
+ str, "gspmdrv.exe", 0, icon | MB_MOVEABLE | MB_OK);
}
-void
+void
error_message(char *str)
{
WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "gspmdrv.exe", 0, MB_MOVEABLE | MB_ICONHAND | MB_OK);
@@ -149,7 +146,7 @@ error_message(char *str)
/* This thread waits for the update event semaphore from gs.exe */
/* then generates a WM_PAINT message for the bitmap */
/* This thread must NOT call C library functions */
-VOID APIENTRY
+VOID APIENTRY
update_func(ULONG unused)
{
APIRET rc;
@@ -158,14 +155,14 @@ update_func(ULONG unused)
unused = unused; /* to shut up warning */
while (!DosQueryEventSem(update_event_sem, &count)) {
- /* loop while semaphore exists */
- DosWaitEventSem(update_event_sem, SEM_INDEFINITE_WAIT);
- DosResetEventSem(update_event_sem, &count);
- WinPostMsg(hwnd_bmp, WM_GSUPDATE, MPFROMLONG(0), MPFROMLONG(0));
+ /* loop while semaphore exists */
+ DosWaitEventSem(update_event_sem, SEM_INDEFINITE_WAIT);
+ DosResetEventSem(update_event_sem, &count);
+ WinPostMsg(hwnd_bmp, WM_GSUPDATE, MPFROMLONG(0), MPFROMLONG(0));
}
}
-VOID APIENTRY
+VOID APIENTRY
exit_func(ULONG code)
{
write_profile();
@@ -207,14 +204,13 @@ find_hwnd_gs(char *gsid)
pswblk = (PSWBLOCK) malloc(cbBuf + 32768);
ulCount = WinQuerySwitchList(hab, pswblk, cbBuf); /* get num of items */
for (i = 0; i < ulCount; i++) {
- pswentry = &pswblk->aswentry[i];
- pswc = &pswentry->swctl;
- if (pid == pswc->idProcess)
- hwnd_gs = pswc->hwnd; /* save window handle */
+ pswentry = &pswblk->aswentry[i];
+ pswc = &pswentry->swctl;
+ if (pid == pswc->idProcess)
+ hwnd_gs = pswc->hwnd; /* save window handle */
}
}
-
int
main(int argc, char *argv[])
{
@@ -222,46 +218,45 @@ main(int argc, char *argv[])
QMSG q_mess; /* message queue */
APIRET rc = 0;
-
hab = WinInitialize(0); /* Get the Anchor Block */
hand_mq = WinCreateMsgQueue(hab, 0); /* start a queue */
if (argc < 2) {
- rc = 1;
- error_message("Usage: gspmdrv -d id_string");
+ rc = 1;
+ error_message("Usage: gspmdrv -d id_string");
}
if (!rc) {
- if (strcmp(argv[1], "-d") == 0) {
- rc = init_display(argc, argv);
- } else if (strcmp(argv[1], "-b") == 0) {
- rc = init_bitmap(argc, argv);
- } else {
- rc = 1;
- error_message("Usage: gspmdrv -d id_string");
- }
+ if (strcmp(argv[1], "-d") == 0) {
+ rc = init_display(argc, argv);
+ } else if (strcmp(argv[1], "-b") == 0) {
+ rc = init_bitmap(argc, argv);
+ } else {
+ rc = 1;
+ error_message("Usage: gspmdrv -d id_string");
+ }
}
if (!rc) {
- rc = DosCreateThread(&update_tid, update_func, 0, 0, 8192);
- if (rc)
- error_message("Failed to create update thread");
+ rc = DosCreateThread(&update_tid, update_func, 0, 0, 8192);
+ if (rc)
+ error_message("Failed to create update thread");
}
if (!rc)
- rc = init_window();
+ rc = init_window();
if (!rc)
- WinShowWindow(hwnd_frame, TRUE);
+ WinShowWindow(hwnd_frame, TRUE);
if (!rc) {
- /* keep gspmdrv.exe in memory for number of minutes specified in */
- /* environment variable GS_LOAD */
- _emxload_env("GS_LOAD");
+ /* keep gspmdrv.exe in memory for number of minutes specified in */
+ /* environment variable GS_LOAD */
+ _emxload_env("GS_LOAD");
}
DosExitList(EXLST_ADD, exit_func);
/* message loop */
while (!rc && WinGetMsg(hab, &q_mess, 0L, 0, 0))
- WinDispatchMsg(hab, &q_mess);
+ WinDispatchMsg(hab, &q_mess);
/* Shut down the application window and queue */
DosKillThread(update_tid);
@@ -281,69 +276,68 @@ init_window()
unsigned char class[] = "gspmdrvClass"; /* class name */
if (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_REVISION, &version, sizeof(version)))
- os_version = 201000; /* a guess */
+ os_version = 201000; /* a guess */
else {
- os_version = version[0] * 10000 + version[1] * 100 + version[2];
+ os_version = version[0] * 10000 + version[1] * 100 + version[2];
}
/* define the frame constants */
flFlags = FCF_TITLEBAR | /* have a title bar */
- FCF_SIZEBORDER | /* have a sizeable window */
- FCF_MINMAX | /* have a min and max button */
- FCF_SYSMENU | /* include a system menu */
- FCF_VERTSCROLL | /* vertical scroll bar */
- FCF_HORZSCROLL | /* horizontal scroll bar */
- FCF_TASKLIST | /* show it in window list */
- FCF_ICON; /* Load icon from resources */
+ FCF_SIZEBORDER | /* have a sizeable window */
+ FCF_MINMAX | /* have a min and max button */
+ FCF_SYSMENU | /* include a system menu */
+ FCF_VERTSCROLL | /* vertical scroll bar */
+ FCF_HORZSCROLL | /* horizontal scroll bar */
+ FCF_TASKLIST | /* show it in window list */
+ FCF_ICON; /* Load icon from resources */
/* save SHELL default size and location */
rc = WinQueryTaskSizePos(hab, 0, &swp);
if (rc)
- return rc;
+ return rc;
read_profile();
if ((option.img_size.x == 0) || (option.img_size.y == 0))
- option.img_size.x = option.img_size.y = CW_USEDEFAULT;
+ option.img_size.x = option.img_size.y = CW_USEDEFAULT;
if (!rc) {
- HPS ps = WinGetPS(HWND_DESKTOP);
- HDC hdc = GpiQueryDevice(ps);
-
- DevQueryCaps(hdc, CAPS_COLOR_PLANES, 1, &display.planes);
- DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &display.bitcount);
- DevQueryCaps(hdc, CAPS_ADDITIONAL_GRAPHICS, 1, &display.hasPalMan);
- display.hasPalMan &= CAPS_PALETTE_MANAGER;
- WinReleasePS(ps);
+ HPS ps = WinGetPS(HWND_DESKTOP);
+ HDC hdc = GpiQueryDevice(ps);
+
+ DevQueryCaps(hdc, CAPS_COLOR_PLANES, 1, &display.planes);
+ DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &display.bitcount);
+ DevQueryCaps(hdc, CAPS_ADDITIONAL_GRAPHICS, 1, &display.hasPalMan);
+ display.hasPalMan &= CAPS_PALETTE_MANAGER;
+ WinReleasePS(ps);
}
if (!rc) {
- if (!WinRegisterClass( /* register this window class */
- hab, /* anchor block */
- (PSZ) class, /* class name */
- (PFNWP) ClientWndProc, /* window function */
- CS_SIZEREDRAW | /* window style */
- CS_MOVENOTIFY,
- 0)) /* no storage */
- exit(1);
-
- hwnd_frame = WinCreateStdWindow(
- HWND_DESKTOP, /* window type */
- 0, /* frame style is not WS_VISIBLE */
- &flFlags, /* definitions */
- (PSZ) class, /* client class */
- (PSZ) "Ghostscript Image", /* title */
- WS_VISIBLE, /* client style */
- 0, /* resource module */
- ID_GSPMDRV, /* resource identifier */
- &hwnd_bmp); /* pointer to client */
-
- fix_sysmenu(hwnd_frame);
+ if (!WinRegisterClass( /* register this window class */
+ hab, /* anchor block */
+ (PSZ) class, /* class name */
+ (PFNWP) ClientWndProc, /* window function */
+ CS_SIZEREDRAW | /* window style */
+ CS_MOVENOTIFY,
+ 0)) /* no storage */
+ exit(1);
+
+ hwnd_frame = WinCreateStdWindow(
+ HWND_DESKTOP, /* window type */
+ 0, /* frame style is not WS_VISIBLE */
+ &flFlags, /* definitions */
+ (PSZ) class, /* client class */
+ (PSZ) "Ghostscript Image", /* title */
+ WS_VISIBLE, /* client style */
+ 0, /* resource module */
+ ID_GSPMDRV, /* resource identifier */
+ &hwnd_bmp); /* pointer to client */
+
+ fix_sysmenu(hwnd_frame);
}
rc = restore_window_position(&swp);
return rc;
}
-
void
write_profile(void)
{
@@ -364,17 +358,17 @@ read_profile(void)
PrfQueryProfileString(HINI_USERPROFILE, section, "Origin", "", profile, sizeof(profile));
if (sscanf(profile, "%d %d", &option.img_origin.x, &option.img_origin.y) != 2) {
- option.img_origin.x = CW_USEDEFAULT;
- option.img_origin.y = CW_USEDEFAULT;
+ option.img_origin.x = CW_USEDEFAULT;
+ option.img_origin.y = CW_USEDEFAULT;
}
PrfQueryProfileString(HINI_USERPROFILE, section, "Size", "", profile, sizeof(profile));
if (sscanf(profile, "%d %d", &option.img_size.x, &option.img_size.y) != 2) {
- option.img_size.x = CW_USEDEFAULT;
- option.img_size.y = CW_USEDEFAULT;
+ option.img_size.x = CW_USEDEFAULT;
+ option.img_size.y = CW_USEDEFAULT;
}
PrfQueryProfileString(HINI_USERPROFILE, section, "Maximized", "", profile, sizeof(profile));
if (sscanf(profile, "%d", &option.img_max) != 1)
- option.img_max = 0;
+ option.img_max = 0;
}
void
@@ -384,9 +378,9 @@ fix_sysmenu(HWND hwnd)
HWND hwndSysMenu;
if (!WinSendMsg(WinWindowFromID(hwnd, FID_SYSMENU), MM_QUERYITEM,
- MPFROM2SHORT(SC_SYSMENU, TRUE), MPFROMP(&mi))) {
- message_box("failed getting system menu handle", 0);
- return;
+ MPFROM2SHORT(SC_SYSMENU, TRUE), MPFROMP(&mi))) {
+ message_box("failed getting system menu handle", 0);
+ return;
}
hwndSysMenu = mi.hwndSubMenu;
mi.iPosition = MIT_END;
@@ -411,75 +405,75 @@ restore_window_position(SWP * pswp)
swp.fl = SWP_MOVE | SWP_SIZE | SWP_SHOW;
if (option.img_max) {
- /* Get maximized frame window position and size. */
- if (!WinGetMaxPosition(hwnd_frame, &swp))
- return 1;
- swp.fl |= SWP_MAXIMIZE;
+ /* Get maximized frame window position and size. */
+ if (!WinGetMaxPosition(hwnd_frame, &swp))
+ return 1;
+ swp.fl |= SWP_MAXIMIZE;
} else if ((option.img_size.x != CW_USEDEFAULT) &&
- (option.img_size.y != CW_USEDEFAULT) &&
- (option.img_origin.y != CW_USEDEFAULT) &&
- (option.img_origin.y != CW_USEDEFAULT)) {
- LONG cxClientMax;
- LONG cyClientMax;
- LONG cyTitleBar;
- LONG cxSizeBorder;
- LONG cySizeBorder;
-
- /* get maximum client window size */
- cxClientMax = WinQuerySysValue(HWND_DESKTOP, SV_CXFULLSCREEN);
- cyClientMax = WinQuerySysValue(HWND_DESKTOP, SV_CYFULLSCREEN);
- cyTitleBar = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
- cxSizeBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
- cySizeBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
- cyClientMax += cyTitleBar;
-
- /* Make sure x origin is within display boundaries */
- swp.x = option.img_origin.x;
- if (swp.x < -cxSizeBorder)
- swp.x = 0;
-
- /* Make sure window isn't too wide, or negative value */
- swp.cx = option.img_size.x;
- if (swp.cx >= cxClientMax || swp.cx < 0) {
- swp.cx = cxClientMax;
- swp.x = 0;
- }
- if ((swp.x + swp.cx) > (cxClientMax + cxSizeBorder))
- swp.x = cxClientMax + cxSizeBorder - swp.cx;
-
- /* Make sure y origin is within display boundaries */
- swp.y = option.img_origin.y;
- if (swp.y < -cySizeBorder)
- swp.y = 0;
-
- /* Make sure window isn't too high, or negative value */
- swp.cy = option.img_size.y;
- if (swp.cy > cyClientMax || swp.cy < 0) {
- swp.cy = cyClientMax;
- swp.y = 0;
- }
- if ((swp.y + swp.cy) > (cyClientMax + cySizeBorder))
- swp.y = cyClientMax + cySizeBorder - swp.cy;
+ (option.img_size.y != CW_USEDEFAULT) &&
+ (option.img_origin.y != CW_USEDEFAULT) &&
+ (option.img_origin.y != CW_USEDEFAULT)) {
+ LONG cxClientMax;
+ LONG cyClientMax;
+ LONG cyTitleBar;
+ LONG cxSizeBorder;
+ LONG cySizeBorder;
+
+ /* get maximum client window size */
+ cxClientMax = WinQuerySysValue(HWND_DESKTOP, SV_CXFULLSCREEN);
+ cyClientMax = WinQuerySysValue(HWND_DESKTOP, SV_CYFULLSCREEN);
+ cyTitleBar = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
+ cxSizeBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
+ cySizeBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
+ cyClientMax += cyTitleBar;
+
+ /* Make sure x origin is within display boundaries */
+ swp.x = option.img_origin.x;
+ if (swp.x < -cxSizeBorder)
+ swp.x = 0;
+
+ /* Make sure window isn't too wide, or negative value */
+ swp.cx = option.img_size.x;
+ if (swp.cx >= cxClientMax || swp.cx < 0) {
+ swp.cx = cxClientMax;
+ swp.x = 0;
+ }
+ if ((swp.x + swp.cx) > (cxClientMax + cxSizeBorder))
+ swp.x = cxClientMax + cxSizeBorder - swp.cx;
+
+ /* Make sure y origin is within display boundaries */
+ swp.y = option.img_origin.y;
+ if (swp.y < -cySizeBorder)
+ swp.y = 0;
+
+ /* Make sure window isn't too high, or negative value */
+ swp.cy = option.img_size.y;
+ if (swp.cy > cyClientMax || swp.cy < 0) {
+ swp.cy = cyClientMax;
+ swp.y = 0;
+ }
+ if ((swp.y + swp.cy) > (cyClientMax + cySizeBorder))
+ swp.y = cyClientMax + cySizeBorder - swp.cy;
} else { /* No saved position -- use supplied position */
- swp = *pswp;
- option.img_origin.x = swp.x;
- option.img_origin.y = swp.y;
- option.img_size.x = swp.cx;
- option.img_size.y = swp.cy;
- option.img_max = FALSE;
- swp.fl = SWP_MOVE | SWP_SIZE | SWP_SHOW;
+ swp = *pswp;
+ option.img_origin.x = swp.x;
+ option.img_origin.y = swp.y;
+ option.img_size.x = swp.cx;
+ option.img_size.y = swp.cy;
+ option.img_max = FALSE;
+ swp.fl = SWP_MOVE | SWP_SIZE | SWP_SHOW;
}
if (hwnd_gs)
- swp.fl |= SWP_ZORDER;
+ swp.fl |= SWP_ZORDER;
/* Position and size this frame window */
if (!WinSetWindowPos(hwnd_frame, hwnd_gs,
- swp.x, swp.y, swp.cx, swp.cy, swp.fl))
- return 1;
+ swp.x, swp.y, swp.cx, swp.cy, swp.fl))
+ return 1;
return 0;
}
-APIRET
+APIRET
init_display(int argc, char *argv[])
{
char buf[256];
@@ -487,44 +481,43 @@ init_display(int argc, char *argv[])
APIRET rc = 0;
if (argc != 3) {
- rc = 1;
- error_message("Usage: gspmdrv -d id_string");
+ rc = 1;
+ error_message("Usage: gspmdrv -d id_string");
}
find_hwnd_gs(argv[2]);
if (!rc) {
- sprintf(name, SHARED_NAME, argv[2]);
- rc = DosGetNamedSharedMem((PVOID *) & bitmap.pbmi, name, PAG_READ | PAG_WRITE);
- if (rc) {
- sprintf(buf, "Failed to open: bmp shared memory \"%s\" rc = %d", argv[0], rc);
- error_message(buf);
- }
+ sprintf(name, SHARED_NAME, argv[2]);
+ rc = DosGetNamedSharedMem((PVOID *) & bitmap.pbmi, name, PAG_READ | PAG_WRITE);
+ if (rc) {
+ sprintf(buf, "Failed to open: bmp shared memory \"%s\" rc = %d", argv[0], rc);
+ error_message(buf);
+ }
}
if (!rc) {
- sprintf(name, SYNC_NAME, argv[2]);
- rc = DosOpenEventSem(name, &update_event_sem);
- if (rc) {
- sprintf(buf, "Failed to open: update event semaphore \"%s\" rc = %d", argv[1], rc);
- error_message(buf);
- }
+ sprintf(name, SYNC_NAME, argv[2]);
+ rc = DosOpenEventSem(name, &update_event_sem);
+ if (rc) {
+ sprintf(buf, "Failed to open: update event semaphore \"%s\" rc = %d", argv[1], rc);
+ error_message(buf);
+ }
}
if (!rc) {
- sprintf(name, MUTEX_NAME, argv[2]);
- rc = DosOpenMutexSem(name, &bmp_mutex_sem);
- if (rc) {
- sprintf(buf, "Failed to open: bmp mutex semaphore \"%s\" rc = %d", argv[1], rc);
- error_message(buf);
- }
+ sprintf(name, MUTEX_NAME, argv[2]);
+ rc = DosOpenMutexSem(name, &bmp_mutex_sem);
+ if (rc) {
+ sprintf(buf, "Failed to open: bmp mutex semaphore \"%s\" rc = %d", argv[1], rc);
+ error_message(buf);
+ }
}
if (!rc) {
- scan_bitmap(&bitmap);
- bitmap.valid = TRUE;
+ scan_bitmap(&bitmap);
+ bitmap.valid = TRUE;
}
return rc;
}
-
-APIRET
+APIRET
init_bitmap(int argc, char *argv[])
{
char buf[256];
@@ -534,42 +527,42 @@ init_bitmap(int argc, char *argv[])
PBITMAPFILEHEADER2 pbmfh;
if (argc != 3)
- return 1; /* error - no filename */
+ return 1; /* error - no filename */
/* open bitmap */
if ((rc = DosOpen(argv[2], &hf, &action, 0, FILE_NORMAL, FILE_OPEN,
- OPEN_ACCESS_READONLY | OPEN_SHARE_DENYREADWRITE, 0))
- != (APIRET) 0) {
- sprintf(buf, "Error opening: %s", argv[2]);
- error_message(buf);
- return rc;
+ OPEN_ACCESS_READONLY | OPEN_SHARE_DENYREADWRITE, 0))
+ != (APIRET) 0) {
+ sprintf(buf, "Error opening: %s", argv[2]);
+ error_message(buf);
+ return rc;
}
rc = DosSetFilePtr(hf, 0, FILE_END, &length);
if (rc) {
- sprintf(buf, "failed seeking to EOF: error = %d", rc);
- error_message(buf);
- return rc;
+ sprintf(buf, "failed seeking to EOF: error = %d", rc);
+ error_message(buf);
+ return rc;
}
rc = DosSetFilePtr(hf, 0, FILE_BEGIN, &count);
if (rc) {
- sprintf(buf, "failed seeking to BOF: error = %d", rc);
- error_message(buf);
- return rc;
+ sprintf(buf, "failed seeking to BOF: error = %d", rc);
+ error_message(buf);
+ return rc;
};
/* allocate memory for bitmap */
if ((rc = DosAllocMem((PPVOID) & bbuffer, length, PAG_READ | PAG_WRITE | PAG_COMMIT))
- != (APIRET) 0) {
- sprintf(buf, "failed allocating memory");
- error_message(buf);
- return rc;
+ != (APIRET) 0) {
+ sprintf(buf, "failed allocating memory");
+ error_message(buf);
+ return rc;
}
rc = DosRead(hf, bbuffer, length, &count);
DosClose(hf);
if (rc) {
- sprintf(buf, "failed reading bitmap, error = %u, count = %u", rc, count);
- error_message(buf);
- return rc;
+ sprintf(buf, "failed reading bitmap, error = %u, count = %u", rc, count);
+ error_message(buf);
+ return rc;
}
/* extract some info about bitmap */
pbmfh = (PBITMAPFILEHEADER2) bbuffer;
@@ -595,24 +588,22 @@ make_palette(BMAP * pbm)
BOOL old_bmp = (pbm->pbmi->cbFix == sizeof(BITMAPINFOHEADER));
if (old_bmp) {
- for (i = 0; i < palcount; i++) {
- tbl[i] = (old_palptr->bRed << 16) + (old_palptr->bGreen << 8) + (old_palptr->bBlue);
- palptr++;
- }
+ for (i = 0; i < palcount; i++) {
+ tbl[i] = (old_palptr->bRed << 16) + (old_palptr->bGreen << 8) + (old_palptr->bBlue);
+ palptr++;
+ }
} else {
- for (i = 0; i < palcount; i++) {
- tbl[i] = (palptr->bRed << 16) + (palptr->bGreen << 8) + (palptr->bBlue);
- palptr++;
- }
+ for (i = 0; i < palcount; i++) {
+ tbl[i] = (palptr->bRed << 16) + (palptr->bGreen << 8) + (palptr->bBlue);
+ palptr++;
+ }
}
if (display.hpal_exists)
- GpiDeletePalette(display.hpal);
+ GpiDeletePalette(display.hpal);
display.hpal = GpiCreatePalette(hab, 0L, LCOLF_CONSECRGB, palcount, tbl);
display.hpal_exists = TRUE;
}
-
-
/* scan bitmap */
/* update bitmap structure */
/* return value is TRUE if bitmap dimension has changed */
@@ -624,79 +615,79 @@ scan_bitmap(BMAP * pbm)
BOOL old_bmp = (pbmi->cbFix == sizeof(BITMAPINFOHEADER));
if (old_bmp) {
- /* it is a BITMAPINFO */
- switch (old_pbmi->cBitCount) {
- case 24:
- pbm->palsize = 0;
- break;
- case 8:
- pbm->palsize = 256;
- break;
- case 4:
- pbm->palsize = 16;
- break;
- case 1:
- pbm->palsize = 2;
- break;
- default:
- pbm->valid = FALSE;
- error_message("scan_bitmap: wrong number of bits"); /* panic */
- return FALSE;
- }
- pbm->palimportant = pbm->palsize;
- pbm->palsize = pbm->palsize * sizeof(RGB);
- pbm->bits = (PBYTE) old_pbmi + old_pbmi->cbFix + pbm->palsize;
- pbm->width = old_pbmi->cx;
- pbm->height = old_pbmi->cy;
- pbm->planes = old_pbmi->cPlanes;
- pbm->depth = old_pbmi->cBitCount;
+ /* it is a BITMAPINFO */
+ switch (old_pbmi->cBitCount) {
+ case 24:
+ pbm->palsize = 0;
+ break;
+ case 8:
+ pbm->palsize = 256;
+ break;
+ case 4:
+ pbm->palsize = 16;
+ break;
+ case 1:
+ pbm->palsize = 2;
+ break;
+ default:
+ pbm->valid = FALSE;
+ error_message("scan_bitmap: wrong number of bits"); /* panic */
+ return FALSE;
+ }
+ pbm->palimportant = pbm->palsize;
+ pbm->palsize = pbm->palsize * sizeof(RGB);
+ pbm->bits = (PBYTE) old_pbmi + old_pbmi->cbFix + pbm->palsize;
+ pbm->width = old_pbmi->cx;
+ pbm->height = old_pbmi->cy;
+ pbm->planes = old_pbmi->cPlanes;
+ pbm->depth = old_pbmi->cBitCount;
} else {
- /* it is a BITMAPINFO2 */
- switch (pbmi->cBitCount) {
- case 24:
- pbm->palsize = 0;
- break;
- case 8:
- pbm->palsize = 256;
- break;
- case 4:
- pbm->palsize = 16;
- break;
- case 1:
- pbm->palsize = 2;
- break;
- default:
- pbm->valid = FALSE;
- error_message("scan_bitmap: wrong number of bits"); /* panic */
- return FALSE;
- }
- if ((pbmi->cbFix > (&(pbmi->cclrUsed) - &(pbmi->cbFix)))
- && (pbmi->cclrUsed != 0) && (pbmi->cBitCount != 24))
- pbm->palsize = pbmi->cclrUsed;
- pbm->palimportant = pbm->palsize;
- if ((pbmi->cbFix > (&(pbmi->cclrImportant) - &(pbmi->cbFix)))
- && (pbmi->cclrImportant != 0) && (pbmi->cBitCount != 24))
- pbm->palimportant = pbmi->cclrImportant;
- pbm->palsize = pbm->palsize * sizeof(RGB2);
- pbm->bits = (PBYTE) pbmi + pbmi->cbFix + pbm->palsize;
- pbm->width = pbmi->cx;
- pbm->height = pbmi->cy;
- pbm->planes = pbmi->cPlanes;
- pbm->depth = pbmi->cBitCount;
+ /* it is a BITMAPINFO2 */
+ switch (pbmi->cBitCount) {
+ case 24:
+ pbm->palsize = 0;
+ break;
+ case 8:
+ pbm->palsize = 256;
+ break;
+ case 4:
+ pbm->palsize = 16;
+ break;
+ case 1:
+ pbm->palsize = 2;
+ break;
+ default:
+ pbm->valid = FALSE;
+ error_message("scan_bitmap: wrong number of bits"); /* panic */
+ return FALSE;
+ }
+ if ((pbmi->cbFix > (&(pbmi->cclrUsed) - &(pbmi->cbFix)))
+ && (pbmi->cclrUsed != 0) && (pbmi->cBitCount != 24))
+ pbm->palsize = pbmi->cclrUsed;
+ pbm->palimportant = pbm->palsize;
+ if ((pbmi->cbFix > (&(pbmi->cclrImportant) - &(pbmi->cbFix)))
+ && (pbmi->cclrImportant != 0) && (pbmi->cBitCount != 24))
+ pbm->palimportant = pbmi->cclrImportant;
+ pbm->palsize = pbm->palsize * sizeof(RGB2);
+ pbm->bits = (PBYTE) pbmi + pbmi->cbFix + pbm->palsize;
+ pbm->width = pbmi->cx;
+ pbm->height = pbmi->cy;
+ pbm->planes = pbmi->cPlanes;
+ pbm->depth = pbmi->cBitCount;
}
if ((pbm->palsize != pbm->old_palsize) || (pbm->palimportant != pbm->old_palimportant)) {
- if ((pbm->depth == 8) && display.hasPalMan)
- make_palette(pbm);
- pbm->old_palimportant = pbm->palimportant;
+ if ((pbm->depth == 8) && display.hasPalMan)
+ make_palette(pbm);
+ pbm->old_palimportant = pbm->palimportant;
}
if ((pbm->width == pbm->old_width) &&
- (pbm->height == pbm->old_height) &&
- (pbm->planes == pbm->old_planes) &&
- (pbm->depth == pbm->old_depth) &&
- (pbm->palsize == pbm->old_palsize) &&
- (pbm->old_bmp == old_bmp))
- return FALSE;
+ (pbm->height == pbm->old_height) &&
+ (pbm->planes == pbm->old_planes) &&
+ (pbm->depth == pbm->old_depth) &&
+ (pbm->palsize == pbm->old_palsize) &&
+ (pbm->old_bmp == old_bmp))
+ return FALSE;
/* bitmap has changed */
pbm->old_width = pbm->width;
@@ -708,7 +699,6 @@ scan_bitmap(BMAP * pbm)
return TRUE;
}
-
void
update_scroll_bars(void)
{
@@ -719,7 +709,6 @@ update_scroll_bars(void)
WinSendMsg(hwnd_bmp, WM_SIZE, MPFROM2SHORT(swp.cx, swp.cy), MPFROM2SHORT(swp.cx, swp.cy));
}
-
/* copy bitmap to the clipboard */
void
copy_clipboard(void)
@@ -727,27 +716,26 @@ copy_clipboard(void)
HBITMAP hbmp;
if (!bitmap.valid) {
- message_box("Cannot copy to clipboard:\nNo Bitmap displayed", 0);
- return;
+ message_box("Cannot copy to clipboard:\nNo Bitmap displayed", 0);
+ return;
}
if (WinOpenClipbrd(hab)) {
- /* get bmp mutex to stop gs.exe changing bitmap while we copy it */
- DosRequestMutexSem(bmp_mutex_sem, 10000);
- if (scan_bitmap(&bitmap)) {
- /* bitmap has changed */
- update_scroll_bars();
- }
- hbmp = make_bitmap(&bitmap, 0, 0, bitmap.width, bitmap.height, bitmap.depth);
- if (hbmp) {
- WinEmptyClipbrd(hab);
- WinSetClipbrdData(hab, (ULONG) hbmp, CF_BITMAP, CFI_HANDLE);
- }
- DosReleaseMutexSem(bmp_mutex_sem);
- WinCloseClipbrd(hab);
+ /* get bmp mutex to stop gs.exe changing bitmap while we copy it */
+ DosRequestMutexSem(bmp_mutex_sem, 10000);
+ if (scan_bitmap(&bitmap)) {
+ /* bitmap has changed */
+ update_scroll_bars();
+ }
+ hbmp = make_bitmap(&bitmap, 0, 0, bitmap.width, bitmap.height, bitmap.depth);
+ if (hbmp) {
+ WinEmptyClipbrd(hab);
+ WinSetClipbrdData(hab, (ULONG) hbmp, CF_BITMAP, CFI_HANDLE);
+ }
+ DosReleaseMutexSem(bmp_mutex_sem);
+ WinCloseClipbrd(hab);
}
}
-
HBITMAP
make_bitmap(BMAP * pbm, ULONG left, ULONG bottom, ULONG right, ULONG top, ULONG depth)
{
@@ -758,16 +746,16 @@ make_bitmap(BMAP * pbm, ULONG left, ULONG bottom, ULONG right, ULONG top, ULONG
BITMAPINFOHEADER2 bmih;
if ((left == right) || (bottom == top))
- return (HBITMAP) NULL;
+ return (HBITMAP) NULL;
if (right > pbm->width)
- right = pbm->width;
+ right = pbm->width;
if (left > pbm->width)
- left = 0;
+ left = 0;
if (top > pbm->height)
- top = pbm->height;
+ top = pbm->height;
if (bottom > pbm->height)
- bottom = 0;
+ bottom = 0;
memset(&bmih, 0, sizeof(bmih));
bmih.cbFix = sizeof(BITMAPINFOHEADER2);
@@ -782,57 +770,56 @@ make_bitmap(BMAP * pbm, ULONG left, ULONG bottom, ULONG right, ULONG top, ULONG
sizePS.cx = right - left;
sizePS.cy = top - bottom;
if (hdcMem != DEV_ERROR)
- hps = GpiCreatePS(hab, hdcMem, &sizePS,
- PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC);
+ hps = GpiCreatePS(hab, hdcMem, &sizePS,
+ PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC);
if (hps != GPI_ERROR)
- hbmp = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
+ hbmp = GpiCreateBitmap(hps, &bmih, 0L, NULL, NULL);
if (hbmp != GPI_ERROR)
- hbmr = GpiSetBitmap(hps, hbmp);
-
+ hbmr = GpiSetBitmap(hps, hbmp);
if (hbmr != HBM_ERROR) {
- LONG rc;
- ERRORID eid;
- POINTL apts[4];
-
- /* target is inclusive */
- apts[0].x = 0;
- apts[0].y = 0;
- apts[1].x = right - left - 1;
- apts[1].y = top - bottom - 1;
- /* source is not inclusive of top & right borders */
- apts[2].x = left;
- apts[2].y = bottom;
- apts[3].x = right;
- apts[3].y = top;
-
- rc = 0;
- eid = WinGetLastError(hab);
- rc = GpiDrawBits(hps, pbm->bits, pbm->pbmi, 4, apts,
- (bitmap.depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
- if (rc == 0) {
- char buf[256];
-
- eid = WinGetLastError(hab);
- sprintf(buf, "make_bitmap: GpiDrawBits rc = %08x, eid = %08x", rc, eid);
- message_box(buf, 0);
- }
+ LONG rc;
+ ERRORID eid;
+ POINTL apts[4];
+
+ /* target is inclusive */
+ apts[0].x = 0;
+ apts[0].y = 0;
+ apts[1].x = right - left - 1;
+ apts[1].y = top - bottom - 1;
+ /* source is not inclusive of top & right borders */
+ apts[2].x = left;
+ apts[2].y = bottom;
+ apts[3].x = right;
+ apts[3].y = top;
+
+ rc = 0;
+ eid = WinGetLastError(hab);
+ rc = GpiDrawBits(hps, pbm->bits, pbm->pbmi, 4, apts,
+ (bitmap.depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
+ if (rc == 0) {
+ char buf[256];
+
+ eid = WinGetLastError(hab);
+ sprintf(buf, "make_bitmap: GpiDrawBits rc = %08x, eid = %08x", rc, eid);
+ message_box(buf, 0);
+ }
}
if (hbmr != HBM_ERROR)
- GpiSetBitmap(hps, (ULONG) 0);
+ GpiSetBitmap(hps, (ULONG) 0);
if (hps != GPI_ERROR)
- GpiDestroyPS(hps);
+ GpiDestroyPS(hps);
if (hdcMem != DEV_ERROR)
- DevCloseDC(hdcMem);
+ DevCloseDC(hdcMem);
if ((hbmr == HBM_ERROR) || (hdcMem == DEV_ERROR) ||
- (hbmp == GPI_ERROR) || (hps == GPI_ERROR)) {
- if (hbmp != GPI_ERROR)
- GpiDeleteBitmap(hbmp);
- debugbeep(2);
- return 0;
+ (hbmp == GPI_ERROR) || (hps == GPI_ERROR)) {
+ if (hbmp != GPI_ERROR)
+ GpiDeleteBitmap(hbmp);
+ debugbeep(2);
+ return 0;
}
return hbmp;
}
@@ -844,9 +831,9 @@ paint_bitmap(HPS ps, PRECTL prect, int scrollx, int scrolly)
int wx, wy;
if (WinIsRectEmpty(hab, prect))
- return 0;
+ return 0;
if (ps == NULLHANDLE) {
- debugbeep(1);
+ debugbeep(1);
}
/* source is not inclusive of top & right borders */
wx = prect->xRight - prect->xLeft; /* update width */
@@ -854,14 +841,14 @@ paint_bitmap(HPS ps, PRECTL prect, int scrollx, int scrolly)
apts[2].x = prect->xLeft + scrollx;
apts[2].y = prect->yBottom + scrolly;
if (apts[2].x > bitmap.width)
- apts[2].x = bitmap.width;
+ apts[2].x = bitmap.width;
if (apts[2].x + wx > bitmap.width)
- wx = bitmap.width - apts[2].x;
+ wx = bitmap.width - apts[2].x;
apts[3].x = apts[2].x + wx;
if (apts[2].y > bitmap.height)
- apts[2].y = bitmap.height;
+ apts[2].y = bitmap.height;
if (apts[2].y + wy > bitmap.height)
- wy = bitmap.height - apts[2].y;
+ wy = bitmap.height - apts[2].y;
apts[3].y = apts[2].y + wy;
/* target is inclusive */
apts[0].x = prect->xLeft;
@@ -870,40 +857,39 @@ paint_bitmap(HPS ps, PRECTL prect, int scrollx, int scrolly)
apts[1].y = prect->yBottom + wy - 1;
if ((display.bitcount == 4) /* standard VGA is buggy */
- ||((os_version == 201100) && (display.bitcount == 8) && (bitmap.depth == 1)) /* S3 and ATI GU are buggy */
- ) {
- /* slow code to dodge OS/2 bugs */
- /* this code double buffers the bitmap and works on a standard VGA
- * but didn't work on an ATI Ultra Graphics Pro in 8514 emulation
- */
- /* This won't work for version 2.11, S3 or ATI GU, 8bit/pixel display, 8bit/pixel bitmap */
- HBITMAP hbmp;
-
- /* create a bitmap */
- hbmp = make_bitmap(&bitmap, apts[2].x, apts[2].y, apts[3].x, apts[3].y, bitmap.depth);
- /* Draw it to the display */
- if (hbmp) {
- WinDrawBitmap(ps, hbmp, NULL, &apts[0], CLR_BLACK, CLR_WHITE, DBM_NORMAL);
- GpiDeleteBitmap(hbmp);
- }
+ ||((os_version == 201100) && (display.bitcount == 8) && (bitmap.depth == 1)) /* S3 and ATI GU are buggy */
+ ) {
+ /* slow code to dodge OS/2 bugs */
+ /* this code double buffers the bitmap and works on a standard VGA
+ * but didn't work on an ATI Ultra Graphics Pro in 8514 emulation
+ */
+ /* This won't work for version 2.11, S3 or ATI GU, 8bit/pixel display, 8bit/pixel bitmap */
+ HBITMAP hbmp;
+
+ /* create a bitmap */
+ hbmp = make_bitmap(&bitmap, apts[2].x, apts[2].y, apts[3].x, apts[3].y, bitmap.depth);
+ /* Draw it to the display */
+ if (hbmp) {
+ WinDrawBitmap(ps, hbmp, NULL, &apts[0], CLR_BLACK, CLR_WHITE, DBM_NORMAL);
+ GpiDeleteBitmap(hbmp);
+ }
} else {
- /* fast code which doesn't always work */
- /* This code works on the Trident SVGA and 8514 in 256 color mode,
- * but GpiDrawBits fails with a SYS3175 on the standard VGA.
- */
- /* This won't work for version 2.11, S3 or ATI GU, 8bit/pixel display, 1bit/pixel bitmap */
- GpiDrawBits(ps, bitmap.bits, bitmap.pbmi, 4, apts,
- (bitmap.depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
+ /* fast code which doesn't always work */
+ /* This code works on the Trident SVGA and 8514 in 256 color mode,
+ * but GpiDrawBits fails with a SYS3175 on the standard VGA.
+ */
+ /* This won't work for version 2.11, S3 or ATI GU, 8bit/pixel display, 1bit/pixel bitmap */
+ GpiDrawBits(ps, bitmap.bits, bitmap.pbmi, 4, apts,
+ (bitmap.depth != 1) ? ROP_SRCCOPY : ROP_NOTSRCCOPY, 0);
}
return 0;
}
-
/* This is the window function */
-MRESULT EXPENTRY
+MRESULT EXPENTRY
ClientWndProc(HWND hwnd, ULONG mess,
- MPARAM mp1, MPARAM mp2)
+ MPARAM mp1, MPARAM mp2)
{
char buf[256];
static int cxClient, cyClient;
@@ -918,327 +904,325 @@ ClientWndProc(HWND hwnd, ULONG mess,
ULONG ulclr;
switch (mess) {
- case WM_CREATE:
- break;
- case WM_ERASEBACKGROUND:
- /* by returning TRUE, the Presentation Manager automatically clears
- * the window each time the window is resized or moved.
- */
- return (MRESULT) TRUE;
- case WM_GSUPDATE:
- if (!WinInvalidateRect(hwnd_bmp, (PRECTL) NULL, TRUE))
- error_message("error invalidating rect");
- if (!WinUpdateWindow(hwnd_bmp))
- error_message("error updating window");
- return 0;
- case WM_COMMAND:
- switch (LONGFROMMP(mp1)) {
- case IDM_ABOUT:
- WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, 0, IDD_ABOUT, 0);
- break;
- case IDM_COPY:
- copy_clipboard();
- break;
- }
- break;
- case WM_REALIZEPALETTE:
- if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
- hps = WinGetPS(hwnd);
- if (hps == NULLHANDLE)
- debugbeep(1);
- GpiSelectPalette(hps, display.hpal);
- if (WinRealizePalette(hwnd, hps, &ulclr) > 0)
- WinInvalidateRect(hwnd, NULL, FALSE);
- GpiSelectPalette(hps, (HPAL) NULL);
- WinReleasePS(hps);
- return 0;
- }
- break; /* use default processing */
- case WM_PAINT:
- /* Refresh the window each time the WM_PAINT message is received */
-
- /* get bmp mutex to stop gs.exe changing bitmap while we paint */
- DosRequestMutexSem(bmp_mutex_sem, 10000);
- if (scan_bitmap(&bitmap))
- update_scroll_bars(); /* bitmap has changed */
-
- if (!bitmap.valid) {
- DosReleaseMutexSem(bmp_mutex_sem);
- hps = WinBeginPaint(hwnd, (ULONG) 0, &rect);
- if (hps == NULLHANDLE)
- debugbeep(4);
- WinFillRect(hps, &rect, CLR_BACKGROUND);
- WinEndPaint(hwnd);
- return 0;
- }
- hps = WinBeginPaint(hwnd, (HPS) NULL, &rect);
- if (hps == NULLHANDLE)
- debugbeep(4);
- if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
- GpiSelectPalette(hps, display.hpal);
- WinRealizePalette(hwnd, hps, &ulclr);
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- GpiSelectPalette(hps, (HPAL) NULL);
- } else
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- WinEndPaint(hwnd);
-
- DosReleaseMutexSem(bmp_mutex_sem);
- return 0;
- case WM_MOVE:
- /* don't interrogate the window location immediately since */
- /* it causes the Diamond Stealth VL24 with IBM S3 drivers */
- /* to corrupt the display */
- DosSleep(50);
- if (hwnd_frame) { /* save window position for INI file */
- SWP swp;
-
- WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
- if (!(swp.fl & SWP_MINIMIZE)) {
- option.img_origin.x = swp.x;
- option.img_origin.y = swp.y;
- option.img_max = ((swp.fl & SWP_MAXIMIZE) != 0);
- }
- }
- return 0;
- case WM_SIZE:
- cyClient = SHORT2FROMMP(mp2);
- cxClient = SHORT1FROMMP(mp2);
-
- cyAdjust = min(bitmap.height, cyClient) - cyClient;
- cyClient += cyAdjust;
-
- nVscrollMax = max(0, bitmap.height - cyClient);
- nVscrollPos = min(nVscrollPos, nVscrollMax);
- scroll_pos.y = nVscrollMax - nVscrollPos;
-
- if (!bitmap.valid)
- cyClient = cyAdjust = nVscrollMax = nVscrollPos;
-
- hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_VERTSCROLL);
- WinSendMsg(hwndScroll, SBM_SETSCROLLBAR, MPFROMLONG(nVscrollPos),
- MPFROM2SHORT(0, nVscrollMax));
- if (bitmap.valid)
- WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(cyClient, bitmap.height),
- MPFROMLONG(0));
- else
- WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
- MPFROMLONG(0));
-
- cxAdjust = min(bitmap.width, cxClient) - cxClient;
- cxClient += cxAdjust;
-
- nHscrollMax = max(0, bitmap.width - cxClient);
- nHscrollPos = min(nHscrollPos, nHscrollMax);
- scroll_pos.x = nHscrollPos;
-
- if (!bitmap.valid)
- cxClient = cxAdjust = nHscrollMax = nHscrollPos;
-
- hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_HORZSCROLL);
- WinSendMsg(hwndScroll, SBM_SETSCROLLBAR, MPFROMLONG(nHscrollPos),
- MPFROM2SHORT(0, nHscrollMax));
- if (bitmap.valid)
- WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(cxClient, bitmap.width),
- MPFROMLONG(0));
- else
- WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
- MPFROMLONG(0));
-
- if ((cxAdjust != 0 || cyAdjust != 0)) {
- SWP swp;
-
- WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
- WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), 0,
- swp.x, swp.y - cyAdjust,
- swp.cx + cxAdjust, swp.cy + cyAdjust, SWP_SIZE | SWP_MOVE);
- cxAdjust = cyAdjust = 0;
- }
- if (hwnd_frame) { /* save window size for INI file */
- SWP swp;
-
- WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
- if (!(swp.fl & SWP_MINIMIZE)) {
- option.img_size.x = swp.cx;
- option.img_size.y = swp.cy;
- option.img_max = ((swp.fl & SWP_MAXIMIZE) != 0);
- }
- }
- break;
- case WM_VSCROLL:
- switch (SHORT2FROMMP(mp2)) {
- case SB_LINEUP:
- nVscrollInc = -cyClient / 16;
- break;
- case SB_LINEDOWN:
- nVscrollInc = cyClient / 16;
- break;
- case SB_PAGEUP:
- nVscrollInc = min(-1, -cyClient);
- break;
- case SB_PAGEDOWN:
- nVscrollInc = max(1, cyClient);
- break;
- case SB_SLIDERPOSITION:
- nVscrollInc = SHORT1FROMMP(mp2) - nVscrollPos;
- break;
- case SB_TOP:
- nVscrollInc = -nVscrollPos;
- break;
- case SB_BOTTOM:
- nVscrollInc = nVscrollMax - nVscrollPos;
- break;
- default:
- nVscrollInc = 0;
- }
- if ((nVscrollInc = max(-nVscrollPos,
- min(nVscrollInc, nVscrollMax - nVscrollPos))) != 0) {
- LONG lComplexity;
-
- hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_VERTSCROLL);
- nVscrollPos += nVscrollInc;
- scroll_pos.y = nVscrollMax - nVscrollPos;
- lComplexity = WinScrollWindow(hwnd, 0, nVscrollInc, (PRECTL) NULL, (PRECTL) NULL,
- (HRGN) NULLHANDLE, (PRECTL) & rect, 0);
- WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMLONG(nVscrollPos), 0);
- if (lComplexity != RGN_RECT) {
- WinInvalidateRect(hwnd, (PRECTL) NULL, FALSE);
- WinUpdateWindow(hwnd);
- } else {
- /* redraw exposed area */
- hps = WinGetPS(hwnd);
- if (hps == NULLHANDLE)
- debugbeep(1);
- if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
- GpiSelectPalette(hps, display.hpal);
- WinRealizePalette(hwnd, hps, &ulclr);
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- GpiSelectPalette(hps, (HPAL) NULL);
- } else
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- WinReleasePS(hps);
- }
- }
- break;
- case WM_HSCROLL:
- switch (SHORT2FROMMP(mp2)) {
- case SB_LINELEFT:
- nHscrollInc = -cxClient / 16;
- break;
- case SB_LINERIGHT:
- nHscrollInc = cyClient / 16;
- break;
- case SB_PAGELEFT:
- nHscrollInc = min(-1, -cxClient);
- break;
- case SB_PAGERIGHT:
- nHscrollInc = max(1, cxClient);
- break;
- case SB_SLIDERPOSITION:
- nHscrollInc = SHORT1FROMMP(mp2) - nHscrollPos;
- break;
- default:
- nHscrollInc = 0;
- }
- if ((nHscrollInc = max(-nHscrollPos,
- min(nHscrollInc, nHscrollMax - nHscrollPos))) != 0) {
- LONG lComplexity;
-
- hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_HORZSCROLL);
- nHscrollPos += nHscrollInc;
- scroll_pos.x = nHscrollPos;
- lComplexity = WinScrollWindow(hwnd, -nHscrollInc, 0, (PRECTL) NULL, (PRECTL) NULL,
- (HRGN) NULLHANDLE, (PRECTL) & rect, 0);
- /* need to send next message BEFORE redrawing, otherwise S3 driver screws up */
- WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMLONG(nHscrollPos), 0);
- if (lComplexity != RGN_RECT) {
- WinInvalidateRect(hwnd, (PRECTL) NULL, FALSE);
- WinUpdateWindow(hwnd);
- } else {
- /* redraw exposed area */
- hps = WinGetPS(hwnd);
- if (hps == NULLHANDLE)
- debugbeep(1);
- if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
- GpiSelectPalette(hps, display.hpal);
- WinRealizePalette(hwnd, hps, &ulclr);
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- GpiSelectPalette(hps, (HPAL) NULL);
- } else
- paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
- WinReleasePS(hps);
- }
- }
- break;
- case WM_CHAR: /* process keystrokes here */
- if (SHORT1FROMMP(mp1) & KC_CHAR) {
- /* pass control to gs if ENTER pressed */
- if (hwnd_gs && (SHORT1FROMMP(mp2) == '\r'))
- WinSetActiveWindow(HWND_DESKTOP, hwnd_gs);
- }
- /* Process only key presses, not key releases */
- if (SHORT1FROMMP(mp1) & KC_KEYUP)
- break;
- if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
- USHORT vkey = SHORT2FROMMP(mp2);
-
- switch (vkey) {
- case VK_HOME:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_TOP));
- break;
- case VK_END:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_BOTTOM));
- break;
- case VK_UP:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINEUP));
- break;
- case VK_DOWN:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINEDOWN));
- break;
- case VK_PAGEUP:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGEUP));
- break;
- case VK_PAGEDOWN:
- WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGEDOWN));
- break;
- case VK_LEFT:
- if (SHORT1FROMMP(mp1) & KC_CTRL)
- WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGELEFT));
- else
- WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINELEFT));
- break;
- case VK_RIGHT:
- if (SHORT1FROMMP(mp1) & KC_CTRL)
- WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGERIGHT));
- else
- WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINERIGHT));
- break;
- }
- }
- break;
- default:
- /* All messages not handled by the ClientWndProc must be passed
- * along to the Presentation Manager for default processing
- */
- return WinDefWindowProc(hwnd, mess, mp1, mp2);
+ case WM_CREATE:
+ break;
+ case WM_ERASEBACKGROUND:
+ /* by returning TRUE, the Presentation Manager automatically clears
+ * the window each time the window is resized or moved.
+ */
+ return (MRESULT) TRUE;
+ case WM_GSUPDATE:
+ if (!WinInvalidateRect(hwnd_bmp, (PRECTL) NULL, TRUE))
+ error_message("error invalidating rect");
+ if (!WinUpdateWindow(hwnd_bmp))
+ error_message("error updating window");
+ return 0;
+ case WM_COMMAND:
+ switch (LONGFROMMP(mp1)) {
+ case IDM_ABOUT:
+ WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, 0, IDD_ABOUT, 0);
+ break;
+ case IDM_COPY:
+ copy_clipboard();
+ break;
+ }
+ break;
+ case WM_REALIZEPALETTE:
+ if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
+ hps = WinGetPS(hwnd);
+ if (hps == NULLHANDLE)
+ debugbeep(1);
+ GpiSelectPalette(hps, display.hpal);
+ if (WinRealizePalette(hwnd, hps, &ulclr) > 0)
+ WinInvalidateRect(hwnd, NULL, FALSE);
+ GpiSelectPalette(hps, (HPAL) NULL);
+ WinReleasePS(hps);
+ return 0;
+ }
+ break; /* use default processing */
+ case WM_PAINT:
+ /* Refresh the window each time the WM_PAINT message is received */
+
+ /* get bmp mutex to stop gs.exe changing bitmap while we paint */
+ DosRequestMutexSem(bmp_mutex_sem, 10000);
+ if (scan_bitmap(&bitmap))
+ update_scroll_bars(); /* bitmap has changed */
+
+ if (!bitmap.valid) {
+ DosReleaseMutexSem(bmp_mutex_sem);
+ hps = WinBeginPaint(hwnd, (ULONG) 0, &rect);
+ if (hps == NULLHANDLE)
+ debugbeep(4);
+ WinFillRect(hps, &rect, CLR_BACKGROUND);
+ WinEndPaint(hwnd);
+ return 0;
+ }
+ hps = WinBeginPaint(hwnd, (HPS) NULL, &rect);
+ if (hps == NULLHANDLE)
+ debugbeep(4);
+ if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
+ GpiSelectPalette(hps, display.hpal);
+ WinRealizePalette(hwnd, hps, &ulclr);
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ GpiSelectPalette(hps, (HPAL) NULL);
+ } else
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ WinEndPaint(hwnd);
+
+ DosReleaseMutexSem(bmp_mutex_sem);
+ return 0;
+ case WM_MOVE:
+ /* don't interrogate the window location immediately since */
+ /* it causes the Diamond Stealth VL24 with IBM S3 drivers */
+ /* to corrupt the display */
+ DosSleep(50);
+ if (hwnd_frame) { /* save window position for INI file */
+ SWP swp;
+
+ WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
+ if (!(swp.fl & SWP_MINIMIZE)) {
+ option.img_origin.x = swp.x;
+ option.img_origin.y = swp.y;
+ option.img_max = ((swp.fl & SWP_MAXIMIZE) != 0);
+ }
+ }
+ return 0;
+ case WM_SIZE:
+ cyClient = SHORT2FROMMP(mp2);
+ cxClient = SHORT1FROMMP(mp2);
+
+ cyAdjust = min(bitmap.height, cyClient) - cyClient;
+ cyClient += cyAdjust;
+
+ nVscrollMax = max(0, bitmap.height - cyClient);
+ nVscrollPos = min(nVscrollPos, nVscrollMax);
+ scroll_pos.y = nVscrollMax - nVscrollPos;
+
+ if (!bitmap.valid)
+ cyClient = cyAdjust = nVscrollMax = nVscrollPos;
+
+ hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_VERTSCROLL);
+ WinSendMsg(hwndScroll, SBM_SETSCROLLBAR, MPFROMLONG(nVscrollPos),
+ MPFROM2SHORT(0, nVscrollMax));
+ if (bitmap.valid)
+ WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(cyClient, bitmap.height),
+ MPFROMLONG(0));
+ else
+ WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
+ MPFROMLONG(0));
+
+ cxAdjust = min(bitmap.width, cxClient) - cxClient;
+ cxClient += cxAdjust;
+
+ nHscrollMax = max(0, bitmap.width - cxClient);
+ nHscrollPos = min(nHscrollPos, nHscrollMax);
+ scroll_pos.x = nHscrollPos;
+
+ if (!bitmap.valid)
+ cxClient = cxAdjust = nHscrollMax = nHscrollPos;
+
+ hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_HORZSCROLL);
+ WinSendMsg(hwndScroll, SBM_SETSCROLLBAR, MPFROMLONG(nHscrollPos),
+ MPFROM2SHORT(0, nHscrollMax));
+ if (bitmap.valid)
+ WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(cxClient, bitmap.width),
+ MPFROMLONG(0));
+ else
+ WinSendMsg(hwndScroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1),
+ MPFROMLONG(0));
+
+ if ((cxAdjust != 0 || cyAdjust != 0)) {
+ SWP swp;
+
+ WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
+ WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), 0,
+ swp.x, swp.y - cyAdjust,
+ swp.cx + cxAdjust, swp.cy + cyAdjust, SWP_SIZE | SWP_MOVE);
+ cxAdjust = cyAdjust = 0;
+ }
+ if (hwnd_frame) { /* save window size for INI file */
+ SWP swp;
+
+ WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
+ if (!(swp.fl & SWP_MINIMIZE)) {
+ option.img_size.x = swp.cx;
+ option.img_size.y = swp.cy;
+ option.img_max = ((swp.fl & SWP_MAXIMIZE) != 0);
+ }
+ }
+ break;
+ case WM_VSCROLL:
+ switch (SHORT2FROMMP(mp2)) {
+ case SB_LINEUP:
+ nVscrollInc = -cyClient / 16;
+ break;
+ case SB_LINEDOWN:
+ nVscrollInc = cyClient / 16;
+ break;
+ case SB_PAGEUP:
+ nVscrollInc = min(-1, -cyClient);
+ break;
+ case SB_PAGEDOWN:
+ nVscrollInc = max(1, cyClient);
+ break;
+ case SB_SLIDERPOSITION:
+ nVscrollInc = SHORT1FROMMP(mp2) - nVscrollPos;
+ break;
+ case SB_TOP:
+ nVscrollInc = -nVscrollPos;
+ break;
+ case SB_BOTTOM:
+ nVscrollInc = nVscrollMax - nVscrollPos;
+ break;
+ default:
+ nVscrollInc = 0;
+ }
+ if ((nVscrollInc = max(-nVscrollPos,
+ min(nVscrollInc, nVscrollMax - nVscrollPos))) != 0) {
+ LONG lComplexity;
+
+ hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_VERTSCROLL);
+ nVscrollPos += nVscrollInc;
+ scroll_pos.y = nVscrollMax - nVscrollPos;
+ lComplexity = WinScrollWindow(hwnd, 0, nVscrollInc, (PRECTL) NULL, (PRECTL) NULL,
+ (HRGN) NULLHANDLE, (PRECTL) & rect, 0);
+ WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMLONG(nVscrollPos), 0);
+ if (lComplexity != RGN_RECT) {
+ WinInvalidateRect(hwnd, (PRECTL) NULL, FALSE);
+ WinUpdateWindow(hwnd);
+ } else {
+ /* redraw exposed area */
+ hps = WinGetPS(hwnd);
+ if (hps == NULLHANDLE)
+ debugbeep(1);
+ if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
+ GpiSelectPalette(hps, display.hpal);
+ WinRealizePalette(hwnd, hps, &ulclr);
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ GpiSelectPalette(hps, (HPAL) NULL);
+ } else
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ WinReleasePS(hps);
+ }
+ }
+ break;
+ case WM_HSCROLL:
+ switch (SHORT2FROMMP(mp2)) {
+ case SB_LINELEFT:
+ nHscrollInc = -cxClient / 16;
+ break;
+ case SB_LINERIGHT:
+ nHscrollInc = cyClient / 16;
+ break;
+ case SB_PAGELEFT:
+ nHscrollInc = min(-1, -cxClient);
+ break;
+ case SB_PAGERIGHT:
+ nHscrollInc = max(1, cxClient);
+ break;
+ case SB_SLIDERPOSITION:
+ nHscrollInc = SHORT1FROMMP(mp2) - nHscrollPos;
+ break;
+ default:
+ nHscrollInc = 0;
+ }
+ if ((nHscrollInc = max(-nHscrollPos,
+ min(nHscrollInc, nHscrollMax - nHscrollPos))) != 0) {
+ LONG lComplexity;
+
+ hwndScroll = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_HORZSCROLL);
+ nHscrollPos += nHscrollInc;
+ scroll_pos.x = nHscrollPos;
+ lComplexity = WinScrollWindow(hwnd, -nHscrollInc, 0, (PRECTL) NULL, (PRECTL) NULL,
+ (HRGN) NULLHANDLE, (PRECTL) & rect, 0);
+ /* need to send next message BEFORE redrawing, otherwise S3 driver screws up */
+ WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMLONG(nHscrollPos), 0);
+ if (lComplexity != RGN_RECT) {
+ WinInvalidateRect(hwnd, (PRECTL) NULL, FALSE);
+ WinUpdateWindow(hwnd);
+ } else {
+ /* redraw exposed area */
+ hps = WinGetPS(hwnd);
+ if (hps == NULLHANDLE)
+ debugbeep(1);
+ if ((bitmap.depth == 8) && display.hasPalMan && display.hpal_exists) {
+ GpiSelectPalette(hps, display.hpal);
+ WinRealizePalette(hwnd, hps, &ulclr);
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ GpiSelectPalette(hps, (HPAL) NULL);
+ } else
+ paint_bitmap(hps, &rect, nHscrollPos, nVscrollMax - nVscrollPos);
+ WinReleasePS(hps);
+ }
+ }
+ break;
+ case WM_CHAR: /* process keystrokes here */
+ if (SHORT1FROMMP(mp1) & KC_CHAR) {
+ /* pass control to gs if ENTER pressed */
+ if (hwnd_gs && (SHORT1FROMMP(mp2) == '\r'))
+ WinSetActiveWindow(HWND_DESKTOP, hwnd_gs);
+ }
+ /* Process only key presses, not key releases */
+ if (SHORT1FROMMP(mp1) & KC_KEYUP)
+ break;
+ if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
+ USHORT vkey = SHORT2FROMMP(mp2);
+
+ switch (vkey) {
+ case VK_HOME:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_TOP));
+ break;
+ case VK_END:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_BOTTOM));
+ break;
+ case VK_UP:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINEUP));
+ break;
+ case VK_DOWN:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINEDOWN));
+ break;
+ case VK_PAGEUP:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGEUP));
+ break;
+ case VK_PAGEDOWN:
+ WinSendMsg(hwnd, WM_VSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGEDOWN));
+ break;
+ case VK_LEFT:
+ if (SHORT1FROMMP(mp1) & KC_CTRL)
+ WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGELEFT));
+ else
+ WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINELEFT));
+ break;
+ case VK_RIGHT:
+ if (SHORT1FROMMP(mp1) & KC_CTRL)
+ WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_PAGERIGHT));
+ else
+ WinSendMsg(hwnd, WM_HSCROLL, MPFROMLONG(0), MPFROM2SHORT(0, SB_LINERIGHT));
+ break;
+ }
+ }
+ break;
+ default:
+ /* All messages not handled by the ClientWndProc must be passed
+ * along to the Presentation Manager for default processing
+ */
+ return WinDefWindowProc(hwnd, mess, mp1, mp2);
}
return (MRESULT) FALSE;
}
-
-
/* About Dialog Box */
-MRESULT EXPENTRY
+MRESULT EXPENTRY
AboutDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
switch (msg) {
- case WM_COMMAND:
- switch (COMMANDMSG(&msg)->cmd) {
- case DID_OK:
- WinDismissDlg(hwnd, TRUE);
- return (MRESULT) TRUE;
- }
- break;
+ case WM_COMMAND:
+ switch (COMMANDMSG(&msg)->cmd) {
+ case DID_OK:
+ WinDismissDlg(hwnd, TRUE);
+ return (MRESULT) TRUE;
+ }
+ break;
}
return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
diff --git a/gs/base/gspmdrv.h b/gs/base/gspmdrv.h
index 5c01b22b2..9905d92b1 100644
--- a/gs/base/gspmdrv.h
+++ b/gs/base/gspmdrv.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsptype1.c b/gs/base/gsptype1.c
index af8471e29..12b9e224f 100644
--- a/gs/base/gsptype1.c
+++ b/gs/base/gsptype1.c
@@ -510,7 +510,6 @@ gs_pattern1_get_pattern(const gs_pattern_instance_t *pinst)
&((const gs_pattern1_instance_t *)pinst)->template;
}
-
/* Get transparency object pointer */
void *
gx_pattern1_get_transptr(const gx_device_color *pdevc)
@@ -518,7 +517,6 @@ gx_pattern1_get_transptr(const gx_device_color *pdevc)
return pdevc->colors.pattern.p_tile->ttrans;
}
-
/* Check device color for Pattern Type 1. */
bool
gx_dc_is_pattern1_color_clist_based(const gx_device_color *pdevc)
@@ -539,7 +537,6 @@ gs_dc_get_pattern_id(const gx_device_color *pdevc)
return pdevc->colors.pattern.p_tile->id;
}
-
/*
* Perform actions required at setcolor time. This procedure resets the
* overprint information (almost) as required by the pattern. The logic
@@ -599,7 +596,6 @@ gs_pattern1_set_color(const gs_client_color * pcc, gs_state * pgs)
}
}
-
const gs_pattern1_template_t *
gs_getpattern(const gs_client_color * pcc)
{
@@ -922,7 +918,6 @@ gs_makebitmappattern_xform(
return gs_makepixmappattern(pcc, &bitmap, mask, pmat, id, 0, 0, pgs, mem);
}
-
/* ------ Color space implementation ------ */
/*
@@ -1078,7 +1073,6 @@ static RELOC_PTRS_BEGIN(dc_binary_masked_reloc_ptrs)
}
RELOC_PTRS_END
-
/*
* Currently patterns cannot be passed through the command list,
* however vector devices need to save a color for comparing
@@ -1139,7 +1133,6 @@ gx_dc_colored_masked_get_dev_halftone(const gx_device_color * pdevc)
return pdevc->colors.colored.c_ht;
}
-
/* Macros for pattern loading */
#define FINISH_PATTERN_LOAD\
while ( !gx_pattern_cache_lookup(pdevc, pis, dev, select) )\
@@ -1270,7 +1263,6 @@ gx_dc_pattern_get_nonzero_comps(
return 1;
}
-
static bool
gx_dc_pure_masked_equal(const gx_device_color * pdevc1,
const gx_device_color * pdevc2)
@@ -1399,7 +1391,6 @@ gx_dc_pattern_write_raster(gx_color_tile *ptile, uint offset, byte *data, uint *
return 0;
}
-
/* This is for the case of writing into the clist the pattern that includes transparency.
Transparency with patterns is handled a bit differently since the data is coming from
a pdf14 device that includes planar data with an alpha channel */
@@ -1495,8 +1486,6 @@ gx_dc_pattern_trans_write_raster(gx_color_tile *ptile, uint offset, byte *data,
return 0;
}
-
-
/* Write a pattern into command list, possibly dividing into portions. */
int
gx_dc_pattern_write(
@@ -1668,7 +1657,6 @@ gx_dc_pattern_read_raster(gx_color_tile *ptile, const gx_dc_serialized_tile_t *b
return size - left;
}
-
/* This reads in the transparency buffer from the clist */
static int
gx_dc_pattern_read_trans_buff(gx_color_tile *ptile, uint offset,
@@ -1709,8 +1697,6 @@ gx_dc_pattern_read_trans_buff(gx_color_tile *ptile, uint offset,
return size - left;
}
-
-
int
gx_dc_pattern_read(
gx_device_color * pdevc,
@@ -1908,5 +1894,3 @@ gx_dc_is_pattern1_color(const gx_device_color *pdevc)
{
return (pdevc->type == &gx_dc_pattern || pdevc->type == &gx_dc_pattern_trans);
}
-
-
diff --git a/gs/base/gsptype1.h b/gs/base/gsptype1.h
index 941b6c5ab..fa985bc93 100644
--- a/gs/base/gsptype1.h
+++ b/gs/base/gsptype1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,10 +65,10 @@ typedef gs_pattern1_template_t gs_client_pattern;
* NULL, the color space can only be used with colored patterns.
*/
extern int gs_cspace_build_Pattern1(
- gs_color_space ** ppcspace,
- gs_color_space * pbase_cspace,
- gs_memory_t * pmem
- );
+ gs_color_space ** ppcspace,
+ gs_color_space * pbase_cspace,
+ gs_memory_t * pmem
+ );
/* Initialize a PatternType 1 pattern. */
void gs_pattern1_init(gs_pattern1_template_t *);
@@ -85,7 +85,7 @@ void gs_pattern1_init(gs_pattern1_template_t *);
* uses rc_alloc_struct_1 to allocate pattern instances.
*/
int gs_makepattern(gs_client_color *, const gs_client_pattern *,
- const gs_matrix *, gs_state *, gs_memory_t *);
+ const gs_matrix *, gs_state *, gs_memory_t *);
const gs_client_pattern *gs_getpattern(const gs_client_color *);
/* Check device color for Pattern Type 1. */
@@ -139,30 +139,30 @@ gs_id gs_dc_get_pattern_id(const gx_device_color *pdevc);
* index.
*/
extern int gs_makepixmappattern(
- gs_client_color * pcc,
- const gs_depth_bitmap * pbitmap,
- bool mask,
- const gs_matrix * pmat,
- long id,
- gs_color_space * pcspace,
- uint white_index,
- gs_state * pgs,
- gs_memory_t * mem
- );
+ gs_client_color * pcc,
+ const gs_depth_bitmap * pbitmap,
+ bool mask,
+ const gs_matrix * pmat,
+ long id,
+ gs_color_space * pcspace,
+ uint white_index,
+ gs_state * pgs,
+ gs_memory_t * mem
+ );
/*
* Backwards compatibility feature, to allow the existing
* gs_makebitmappattern operation to still function.
*/
extern int gs_makebitmappattern_xform(
- gs_client_color * pcc,
- const gx_tile_bitmap * ptile,
- bool mask,
- const gs_matrix * pmat,
- long id,
- gs_state * pgs,
- gs_memory_t * mem
- );
+ gs_client_color * pcc,
+ const gx_tile_bitmap * ptile,
+ bool mask,
+ const gs_matrix * pmat,
+ long id,
+ gs_state * pgs,
+ gs_memory_t * mem
+ );
#define gs_makebitmappattern(pcc, tile, mask, pgs, mem) \
gs_makebitmappattern_xform(pcc, tile, mask, 0, no_UniqueID, pgs, mem)
diff --git a/gs/base/gsptype2.c b/gs/base/gsptype2.c
index 5160f5ca2..d74cc471a 100644
--- a/gs/base/gsptype2.c
+++ b/gs/base/gsptype2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -116,13 +116,12 @@ gs_pattern2_set_shfill(gs_client_color * pcc)
gs_pattern2_instance_t *pinst;
if (pcc->pattern->type != &gs_pattern2_type)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
pinst = (gs_pattern2_instance_t *)pcc->pattern;
pinst->shfill = true;
return 0;
}
-
/* ---------------- Rendering ---------------- */
/* GC descriptor */
@@ -145,7 +144,7 @@ const gx_device_color_type_t gx_dc_pattern2 = {
gx_dc_ht_get_phase,
gx_dc_pattern2_load, gx_dc_pattern2_fill_rectangle,
gx_dc_default_fill_masked, gx_dc_pattern2_equal,
- gx_dc_cannot_write, gx_dc_cannot_read,
+ gx_dc_cannot_write, gx_dc_cannot_read,
gx_dc_pattern_get_nonzero_comps
};
@@ -208,7 +207,7 @@ gs_pattern2_set_color(const gs_client_color * pcc, gs_state * pgs)
/* Fill a rectangle with a PatternType 2 color. */
/* WARNING: This function doesn't account the shading BBox
- to allow the clipent to optimize the clipping
+ to allow the clipent to optimize the clipping
with changing the order of clip paths and rects.
The client must clip with the shading BBox before calling this function. */
static int
@@ -218,20 +217,20 @@ gx_dc_pattern2_fill_rectangle(const gx_device_color * pdevc, int x, int y,
const gx_rop_source_t * source)
{
if (dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_is_cpath_accum, NULL, 0)) {
- /* Performing a conversion of imagemask into a clipping path.
- Fall back to the device procedure. */
- return dev_proc(dev, fill_rectangle)(dev, x, y, w, h, (gx_color_index)0/*any*/);
+ /* Performing a conversion of imagemask into a clipping path.
+ Fall back to the device procedure. */
+ return dev_proc(dev, fill_rectangle)(dev, x, y, w, h, (gx_color_index)0/*any*/);
} else {
- gs_fixed_rect rect;
- gs_pattern2_instance_t *pinst =
- (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
-
- rect.p.x = int2fixed(x);
- rect.p.y = int2fixed(y);
- rect.q.x = int2fixed(x + w);
- rect.q.y = int2fixed(y + h);
- return gs_shading_do_fill_rectangle(pinst->template.Shading, &rect, dev,
- (gs_imager_state *)pinst->saved, !pinst->shfill);
+ gs_fixed_rect rect;
+ gs_pattern2_instance_t *pinst =
+ (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
+
+ rect.p.x = int2fixed(x);
+ rect.p.y = int2fixed(y);
+ rect.q.x = int2fixed(x + w);
+ rect.q.y = int2fixed(y + h);
+ return gs_shading_do_fill_rectangle(pinst->template.Shading, &rect, dev,
+ (gs_imager_state *)pinst->saved, !pinst->shfill);
}
}
@@ -254,7 +253,7 @@ gx_dc_pattern2_equal(const gx_device_color * pdevc1,
*/
static void
gx_dc_pattern2_save_dc(
- const gx_device_color * pdevc,
+ const gx_device_color * pdevc,
gx_device_color_saved * psdc )
{
gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
@@ -268,16 +267,16 @@ gx_dc_pattern2_save_dc(
/* This is just a bridge to an old code. */
int
gx_dc_pattern2_shade_bbox_transform2fixed(const gs_rect * rect, const gs_imager_state * pis,
- gs_fixed_rect * rfixed)
+ gs_fixed_rect * rfixed)
{
gs_rect dev_rect;
int code = gs_bbox_transform(rect, &ctm_only(pis), &dev_rect);
if (code >= 0) {
- rfixed->p.x = float2fixed(dev_rect.p.x);
- rfixed->p.y = float2fixed(dev_rect.p.y);
- rfixed->q.x = float2fixed(dev_rect.q.x);
- rfixed->q.y = float2fixed(dev_rect.q.y);
+ rfixed->p.x = float2fixed(dev_rect.p.x);
+ rfixed->p.y = float2fixed(dev_rect.p.y);
+ rfixed->q.x = float2fixed(dev_rect.q.x);
+ rfixed->q.y = float2fixed(dev_rect.q.y);
}
return code;
}
@@ -291,11 +290,11 @@ gx_dc_pattern2_get_bbox(const gx_device_color * pdevc, gs_fixed_rect *bbox)
int code;
if (!pinst->template.Shading->params.have_BBox)
- return 0;
+ return 0;
code = gx_dc_pattern2_shade_bbox_transform2fixed(
- &pinst->template.Shading->params.BBox, (gs_imager_state *)pinst->saved, bbox);
+ &pinst->template.Shading->params.BBox, (gs_imager_state *)pinst->saved, bbox);
if (code < 0)
- return code;
+ return code;
return 1;
}
@@ -316,11 +315,11 @@ gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc)
const gs_shading_t *psh = pinst->template.Shading;
if (!psh->params.have_BBox)
- return_error(gs_error_unregistered); /* Do not call in this case. */
+ return_error(gs_error_unregistered); /* Do not call in this case. */
else {
- gs_state *pis = pinst->saved;
+ gs_state *pis = pinst->saved;
- return gs_shading_path_add_box(ppath, &psh->params.BBox, &pis->ctm);
+ return gs_shading_path_add_box(ppath, &psh->params.BBox, &pis->ctm);
}
}
@@ -355,26 +354,26 @@ gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
/* Intersect a clipping path a shading BBox. */
int
-gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
- gx_clip_path *cpath_local)
+gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
+ gx_clip_path *cpath_local)
{
int code = 0;
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
- (*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
- gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
- gx_path box_path;
- gs_memory_t *mem = cpath_local->path.memory;
-
- gx_path_init_local(&box_path, mem);
- code = gx_dc_shading_path_add_box(&box_path, pdevc);
- if (code == gs_error_limitcheck) {
- /* Ignore huge BBox - bug 689027. */
- code = 0;
- } else if (code >= 0) {
- code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_imager_state *)pinst->saved);
- }
- gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
+ (*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
+ gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
+ gx_path box_path;
+ gs_memory_t *mem = cpath_local->path.memory;
+
+ gx_path_init_local(&box_path, mem);
+ code = gx_dc_shading_path_add_box(&box_path, pdevc);
+ if (code == gs_error_limitcheck) {
+ /* Ignore huge BBox - bug 689027. */
+ code = 0;
+ } else if (code >= 0) {
+ code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_imager_state *)pinst->saved);
+ }
+ gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
}
return code;
}
@@ -384,36 +383,35 @@ int
gx_dc_pattern2_is_rectangular_cell(const gx_device_color * pdevc, gx_device * pdev, gs_fixed_rect *rect)
{
if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
- (*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
- gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
- const gs_shading_t *psh = pinst->template.Shading;
- gs_fixed_point p, q;
-
- if (is_xxyy(&ctm_only(pinst->saved)))
- if (psh->params.have_BBox) {
- int code = gs_point_transform2fixed(&pinst->saved->ctm,
- psh->params.BBox.p.x, psh->params.BBox.p.y, &p);
- if (code < 0)
- return code;
- code = gs_point_transform2fixed(&pinst->saved->ctm,
- psh->params.BBox.q.x, psh->params.BBox.q.y, &q);
- if (code < 0)
- return code;
- if (p.x > q.x) {
- p.x ^= q.x; q.x ^= p.x; p.x ^= q.x;
- }
- if (p.y > q.y) {
- p.y ^= q.y; q.y ^= p.y; p.y ^= q.y;
- }
- rect->p = p;
- rect->q = q;
- return 1;
- }
+ (*dev_proc(pdev, dev_spec_op))(pdev, gxdso_pattern_shading_area, NULL, 0) == 0) {
+ gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
+ const gs_shading_t *psh = pinst->template.Shading;
+ gs_fixed_point p, q;
+
+ if (is_xxyy(&ctm_only(pinst->saved)))
+ if (psh->params.have_BBox) {
+ int code = gs_point_transform2fixed(&pinst->saved->ctm,
+ psh->params.BBox.p.x, psh->params.BBox.p.y, &p);
+ if (code < 0)
+ return code;
+ code = gs_point_transform2fixed(&pinst->saved->ctm,
+ psh->params.BBox.q.x, psh->params.BBox.q.y, &q);
+ if (code < 0)
+ return code;
+ if (p.x > q.x) {
+ p.x ^= q.x; q.x ^= p.x; p.x ^= q.x;
+ }
+ if (p.y > q.y) {
+ p.y ^= q.y; q.y ^= p.y; p.y ^= q.y;
+ }
+ rect->p = p;
+ rect->q = q;
+ return 1;
+ }
}
return 0;
}
-
/* Get a shading color space. */
const gs_color_space *
gx_dc_pattern2_get_color_space(const gx_device_color * pdevc)
@@ -425,7 +423,6 @@ gx_dc_pattern2_get_color_space(const gx_device_color * pdevc)
return psh->params.ColorSpace;
}
-
/* Check device color for a possibly self-overlapping shading. */
bool
gx_dc_pattern2_can_overlap(const gx_device_color *pdevc)
@@ -433,13 +430,13 @@ gx_dc_pattern2_can_overlap(const gx_device_color *pdevc)
gs_pattern2_instance_t * pinst;
if (pdevc->type != &gx_dc_pattern2)
- return false;
+ return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
switch (pinst->template.Shading->head.type) {
- case 3: case 6: case 7:
- return true;
- default:
- return false;
+ case 3: case 6: case 7:
+ return true;
+ default:
+ return false;
}
}
@@ -450,7 +447,7 @@ bool gx_dc_pattern2_has_background(const gx_device_color *pdevc)
const gs_shading_t *Shading;
if (pdevc->type != &gx_dc_pattern2)
- return false;
+ return false;
pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
Shading = pinst->template.Shading;
return !pinst->shfill && Shading->params.Background != NULL;
diff --git a/gs/base/gsptype2.h b/gs/base/gsptype2.h
index 4f9ee6721..2847cb0fb 100644
--- a/gs/base/gsptype2.h
+++ b/gs/base/gsptype2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -102,7 +102,7 @@ int gs_pattern2_set_shfill(gs_client_color * pcc);
/* Transform a shading bounding box into device space. */
int gx_dc_pattern2_shade_bbox_transform2fixed(const gs_rect * rect,
- const gs_imager_state * pis, gs_fixed_rect * rfixed);
+ const gs_imager_state * pis, gs_fixed_rect * rfixed);
/* Get a shading bbox. Returns 1 on success. */
int gx_dc_pattern2_get_bbox(const gx_device_color * pdevc, gs_fixed_rect *bbox);
@@ -114,8 +114,8 @@ int gx_dc_pattern2_color_has_bbox(const gx_device_color * pdevc);
int gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local, const gx_clip_path **cpath1);
/* Intersect a clipping path a shading BBox. */
-int gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
- gx_clip_path *cpath);
+int gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
+ gx_clip_path *cpath);
/* Check whether color is a shading with BBox. */
int gx_dc_pattern2_is_rectangular_cell(const gx_device_color * pdevc, gx_device * pdev, gs_fixed_rect *rect);
diff --git a/gs/base/gsrect.h b/gs/base/gsrect.h
index d550756b0..a6bb88c21 100644
--- a/gs/base/gsrect.h
+++ b/gs/base/gsrect.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,7 +59,7 @@
* the variations that we need.
*/
int int_rect_difference(gs_int_rect * outer, const gs_int_rect * inner,
- gs_int_rect * diffs /*[4] */ );
+ gs_int_rect * diffs /*[4] */ );
/*
* Check whether a parallelogram is a rectangle.
diff --git a/gs/base/gsrefct.h b/gs/base/gsrefct.h
index c6d957815..73a1758c6 100644
--- a/gs/base/gsrefct.h
+++ b/gs/base/gsrefct.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,10 +38,10 @@
* rc_decrement(pobj);
* rc_decrement_only(pobj);
* Both decrement the reference count, and free the object if that
- * was the last reference. The difference is that rc_decrement()
- * also assigns zero to its argument, while rc_decrement_only()
- * does not. The first must be used if the argument could be traceable
- * by the allocator to avoid examining stale memory when a garbage
+ * was the last reference. The difference is that rc_decrement()
+ * also assigns zero to its argument, while rc_decrement_only()
+ * does not. The first must be used if the argument could be traceable
+ * by the allocator to avoid examining stale memory when a garbage
* collector runs. The second must be used if the pointer argument
* is read-only.
*/
@@ -57,7 +57,7 @@ struct rc_header_s {
#ifdef DEBUG
void rc_trace_init_free(const void *vp, const rc_header *prc);
void rc_trace_free_struct(const void *vp, const rc_header *prc,
- client_name_t cname);
+ client_name_t cname);
void rc_trace_increment(const void *vp, const rc_header *prc);
void rc_trace_adjust(const void *vp, const rc_header *prc, int delta);
#define IF_RC_DEBUG(call) if (gs_debug_c('^')) dlputs(""), call
@@ -72,7 +72,7 @@ rc_free_proc(rc_free_struct_only);
* rc_init[_free] really should be used only to initialize
* stack-allocated structures; with heap-allocated structures, it's
* better to use a finalize method so that the garbage collector can
- * clean them up if the refcount fails to reach zero.
+ * clean them up if the refcount fails to reach zero.
*/
#define rc_init_free(vp, mem, rcinit, proc)\
BEGIN\
@@ -146,8 +146,8 @@ rc_free_proc(rc_free_struct_only);
# define rc_check_(vp)\
BEGIN\
if (gs_debug_c('?') && (vp)->rc.ref_count < 0)\
- lprintf2("0x%lx has ref_count of %ld!\n", (ulong)(vp),\
- (vp)->rc.ref_count);\
+ lprintf2("0x%lx has ref_count of %ld!\n", (ulong)(vp),\
+ (vp)->rc.ref_count);\
END
#else
# define rc_check_(vp) DO_NOTHING
@@ -157,10 +157,10 @@ rc_free_proc(rc_free_struct_only);
if (vp) {\
RC_DO_ADJUST(vp, delta);\
if (!(vp)->rc.ref_count) {\
- rc_free_struct(vp, cname);\
- body;\
+ rc_free_struct(vp, cname);\
+ body;\
} else\
- rc_check_(vp);\
+ rc_check_(vp);\
}\
END
#define rc_adjust(vp, delta, cname)\
diff --git a/gs/base/gsromfs0.c b/gs/base/gsromfs0.c
index c22c57689..a4009dda4 100644
--- a/gs/base/gsromfs0.c
+++ b/gs/base/gsromfs0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,4 +17,4 @@
#include "stdint_.h"
uint32_t *gs_romfs[] = {
- 0 };
+ 0 };
diff --git a/gs/base/gsrop.c b/gs/base/gsrop.c
index 2c5461527..ff3e0c8a5 100644
--- a/gs/base/gsrop.c
+++ b/gs/base/gsrop.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@ int
gs_setrasterop(gs_state * pgs, gs_rop3_t rop)
{
if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
pgs->log_op = (rop & rop3_1) | (pgs->log_op & ~rop3_1);
return 0;
}
@@ -40,10 +40,10 @@ int
gs_setsourcetransparent(gs_state * pgs, bool transparent)
{
if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
pgs->log_op =
- (transparent ? pgs->log_op | lop_S_transparent :
- pgs->log_op & ~lop_S_transparent);
+ (transparent ? pgs->log_op | lop_S_transparent :
+ pgs->log_op & ~lop_S_transparent);
return 0;
}
@@ -59,10 +59,10 @@ int
gs_settexturetransparent(gs_state * pgs, bool transparent)
{
if (pgs->in_cachedevice)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
pgs->log_op =
- (transparent ? pgs->log_op | lop_T_transparent :
- pgs->log_op & ~lop_T_transparent);
+ (transparent ? pgs->log_op | lop_T_transparent :
+ pgs->log_op & ~lop_T_transparent);
return 0;
}
diff --git a/gs/base/gsrop.h b/gs/base/gsrop.h
index 6c4303ce8..c8cb03ce1 100644
--- a/gs/base/gsrop.h
+++ b/gs/base/gsrop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsroprun.c b/gs/base/gsroprun.c
index 01a1f2274..195133f4d 100644
--- a/gs/base/gsroprun.c
+++ b/gs/base/gsroprun.c
@@ -111,7 +111,7 @@ static void unrecord(int rop)
static void invert_rop_run1(rop_run_op *op, byte *d, int len)
{
byte lmask, rmask;
-
+
len = len * op->depth + op->dpos;
/* lmask = the set of bits to alter in the output bitmap on the left
* hand edge of the run. rmask = the set of bits NOT to alter in the
@@ -205,7 +205,7 @@ static void notT_rop_run1_const_s(rop_run_op *op, byte *d, int len)
const byte *t = op->t.b.ptr;
byte T;
int t_skew;
-
+
len = len * op->depth + op->dpos;
/* lmask = the set of bits to alter in the output bitmap on the left
* hand edge of the run. rmask = the set of bits NOT to alter in the
@@ -281,7 +281,7 @@ static void dors_rop_run1_const_t(rop_run_op *op, byte *d, int len)
const byte *s = op->s.b.ptr;
byte S, D;
int s_skew;
-
+
len = len * op->depth + op->dpos;
/* lmask = the set of bits to alter in the output bitmap on the left
* hand edge of the run. rmask = the set of bits NOT to alter in the
@@ -361,7 +361,7 @@ static void dort_rop_run1_const_s(rop_run_op *op, byte *d, int len)
const byte *t = op->t.b.ptr;
byte T, D;
int t_skew;
-
+
len = len * op->depth + op->dpos;
/* lmask = the set of bits to alter in the output bitmap on the left
* hand edge of the run. rmask = the set of bits NOT to alter in the
@@ -441,7 +441,7 @@ static void xor_rop_run1_const_s(rop_run_op *op, byte *d, int len)
const byte *t = op->t.b.ptr;
byte T, D;
int t_skew;
-
+
len = len * op->depth + op->dpos;
/* lmask = the set of bits to alter in the output bitmap on the left
* hand edge of the run. rmask = the set of bits NOT to alter in the
@@ -1394,7 +1394,7 @@ static void record_run(rop_run_op *op, byte *d, int len)
local.flags = op->flags;
local.dpos = op->dpos;
local.release = op->release;
- local.opaque = op->opaque;
+ local.opaque = op->opaque;
op->runswap(&local, d, len);
}
@@ -1716,4 +1716,3 @@ void (rop_release_run_op)(rop_run_op *op)
{
rop_release_run_op(op);
}
-
diff --git a/gs/base/gsropt.h b/gs/base/gsropt.h
index ab03f2ee1..41c6fa11f 100644
--- a/gs/base/gsropt.h
+++ b/gs/base/gsropt.h
@@ -300,7 +300,7 @@ struct rop_run_op_s {
const byte *scolors;
const byte *tcolors;
void (*release)(rop_run_op *);
- void *opaque;
+ void *opaque;
};
/* Flags for passing into rop_get_run_op */
diff --git a/gs/base/gsroptab.c b/gs/base/gsroptab.c
index 6cbab7920..265f4c65c 100644
--- a/gs/base/gsroptab.c
+++ b/gs/base/gsroptab.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -289,38 +289,38 @@ ROP_PROC(rop255, ~(rop_operand) 0) /* 1 */
#undef ROP_PROC
const rop_proc rop_proc_table[256] = {
- rop0, rop1, rop2, rop3, rop4, rop5, rop6, rop7,
- rop8, rop9, rop10, rop11, rop12, rop13, rop14, rop15,
- rop16, rop17, rop18, rop19, rop20, rop21, rop22, rop23,
- rop24, rop25, rop26, rop27, rop28, rop29, rop30, rop31,
- rop32, rop33, rop34, rop35, rop36, rop37, rop38, rop39,
- rop40, rop41, rop42, rop43, rop44, rop45, rop46, rop47,
- rop48, rop49, rop50, rop51, rop52, rop53, rop54, rop55,
- rop56, rop57, rop58, rop59, rop60, rop61, rop62, rop63,
- rop64, rop65, rop66, rop67, rop68, rop69, rop70, rop71,
- rop72, rop73, rop74, rop75, rop76, rop77, rop78, rop79,
- rop80, rop81, rop82, rop83, rop84, rop85, rop86, rop87,
- rop88, rop89, rop90, rop91, rop92, rop93, rop94, rop95,
- rop96, rop97, rop98, rop99, rop100, rop101, rop102, rop103,
- rop104, rop105, rop106, rop107, rop108, rop109, rop110, rop111,
- rop112, rop113, rop114, rop115, rop116, rop117, rop118, rop119,
- rop120, rop121, rop122, rop123, rop124, rop125, rop126, rop127,
- rop128, rop129, rop130, rop131, rop132, rop133, rop134, rop135,
- rop136, rop137, rop138, rop139, rop140, rop141, rop142, rop143,
- rop144, rop145, rop146, rop147, rop148, rop149, rop150, rop151,
- rop152, rop153, rop154, rop155, rop156, rop157, rop158, rop159,
- rop160, rop161, rop162, rop163, rop164, rop165, rop166, rop167,
- rop168, rop169, rop170, rop171, rop172, rop173, rop174, rop175,
- rop176, rop177, rop178, rop179, rop180, rop181, rop182, rop183,
- rop184, rop185, rop186, rop187, rop188, rop189, rop190, rop191,
- rop192, rop193, rop194, rop195, rop196, rop197, rop198, rop199,
- rop200, rop201, rop202, rop203, rop204, rop205, rop206, rop207,
- rop208, rop209, rop210, rop211, rop212, rop213, rop214, rop215,
- rop216, rop217, rop218, rop219, rop220, rop221, rop222, rop223,
- rop224, rop225, rop226, rop227, rop228, rop229, rop230, rop231,
- rop232, rop233, rop234, rop235, rop236, rop237, rop238, rop239,
- rop240, rop241, rop242, rop243, rop244, rop245, rop246, rop247,
- rop248, rop249, rop250, rop251, rop252, rop253, rop254, rop255
+ rop0, rop1, rop2, rop3, rop4, rop5, rop6, rop7,
+ rop8, rop9, rop10, rop11, rop12, rop13, rop14, rop15,
+ rop16, rop17, rop18, rop19, rop20, rop21, rop22, rop23,
+ rop24, rop25, rop26, rop27, rop28, rop29, rop30, rop31,
+ rop32, rop33, rop34, rop35, rop36, rop37, rop38, rop39,
+ rop40, rop41, rop42, rop43, rop44, rop45, rop46, rop47,
+ rop48, rop49, rop50, rop51, rop52, rop53, rop54, rop55,
+ rop56, rop57, rop58, rop59, rop60, rop61, rop62, rop63,
+ rop64, rop65, rop66, rop67, rop68, rop69, rop70, rop71,
+ rop72, rop73, rop74, rop75, rop76, rop77, rop78, rop79,
+ rop80, rop81, rop82, rop83, rop84, rop85, rop86, rop87,
+ rop88, rop89, rop90, rop91, rop92, rop93, rop94, rop95,
+ rop96, rop97, rop98, rop99, rop100, rop101, rop102, rop103,
+ rop104, rop105, rop106, rop107, rop108, rop109, rop110, rop111,
+ rop112, rop113, rop114, rop115, rop116, rop117, rop118, rop119,
+ rop120, rop121, rop122, rop123, rop124, rop125, rop126, rop127,
+ rop128, rop129, rop130, rop131, rop132, rop133, rop134, rop135,
+ rop136, rop137, rop138, rop139, rop140, rop141, rop142, rop143,
+ rop144, rop145, rop146, rop147, rop148, rop149, rop150, rop151,
+ rop152, rop153, rop154, rop155, rop156, rop157, rop158, rop159,
+ rop160, rop161, rop162, rop163, rop164, rop165, rop166, rop167,
+ rop168, rop169, rop170, rop171, rop172, rop173, rop174, rop175,
+ rop176, rop177, rop178, rop179, rop180, rop181, rop182, rop183,
+ rop184, rop185, rop186, rop187, rop188, rop189, rop190, rop191,
+ rop192, rop193, rop194, rop195, rop196, rop197, rop198, rop199,
+ rop200, rop201, rop202, rop203, rop204, rop205, rop206, rop207,
+ rop208, rop209, rop210, rop211, rop212, rop213, rop214, rop215,
+ rop216, rop217, rop218, rop219, rop220, rop221, rop222, rop223,
+ rop224, rop225, rop226, rop227, rop228, rop229, rop230, rop231,
+ rop232, rop233, rop234, rop235, rop236, rop237, rop238, rop239,
+ rop240, rop241, rop242, rop243, rop244, rop245, rop246, rop247,
+ rop248, rop249, rop250, rop251, rop252, rop253, rop254, rop255
};
/*
@@ -341,20 +341,20 @@ ROP_PROC(rop255, ~(rop_operand) 0) /* 1 */
const byte /*rop_usage_t */ rop_usage_table[256] =
{
- 0, 7, 7, 6, 7, 5, 7, 7, 7, 7, 5, 7, 6, 7, 7, 4,
- 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 6, 7, 7, 2, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, 6,
- 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 5, 7, 7, 7, 7, 1, 7, 7, 7, 7, 5, 7, 7, 7, 7, 5,
- 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7,
- 5, 7, 7, 7, 7, 5, 7, 7, 7, 7, 1, 7, 7, 7, 7, 5,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7,
- 6, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 2, 7, 7, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7,
- 4, 7, 7, 6, 7, 5, 7, 7, 7, 7, 5, 7, 6, 7, 7, 0
+ 0, 7, 7, 6, 7, 5, 7, 7, 7, 7, 5, 7, 6, 7, 7, 4,
+ 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 6, 7, 7, 2, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, 6,
+ 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 5, 7, 7, 7, 7, 1, 7, 7, 7, 7, 5, 7, 7, 7, 7, 5,
+ 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7,
+ 5, 7, 7, 7, 7, 5, 7, 7, 7, 7, 1, 7, 7, 7, 7, 5,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7, 7, 7,
+ 6, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 2, 7, 7, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 7,
+ 4, 7, 7, 6, 7, 5, 7, 7, 7, 7, 5, 7, 6, 7, 7, 0
};
diff --git a/gs/base/gsserial.c b/gs/base/gsserial.c
index b84d6296f..c3b28f306 100644
--- a/gs/base/gsserial.c
+++ b/gs/base/gsserial.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,7 +17,6 @@
#include "gstypes.h"
#include "gsserial.h"
-
/*
* Procedures for converint between integers and a variable-length,
* little-endian string representation thereof. This scheme uses a
@@ -93,7 +92,6 @@ enc_s_put_int(int ival, byte * ptr)
}
}
-
/*
* Decode an integer string for a signed or unsigned integer. Note that
* two forms of this procedure are provide, to allow both const and non-
@@ -110,7 +108,7 @@ enc_u_get_uint(uint * pval, const byte * ptr)
shift += enc_u_shift;
}
*pval = uval | (tmp_val << shift);
-
+
return ptr;
}
@@ -161,7 +159,6 @@ enc_s_get_int_nc(int * pval, byte * ptr)
#include <stdio.h>
#include <string.h>
-
/*
* Encoding and decoding of integers is verified using a round-trip process,
* integer ==> string ==> integer. The string size is separately checked to
@@ -337,7 +334,6 @@ check_s_vals(int ival)
}
}
-
int
main(void)
{
diff --git a/gs/base/gsserial.h b/gs/base/gsserial.h
index 4d67f92cc..e0cefc167 100644
--- a/gs/base/gsserial.h
+++ b/gs/base/gsserial.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,7 +27,7 @@
* where:
*
* s[i] & 0x80 == 0x80 for i = 0, ..., n - 1,
- * s[n] & 0x80 == 0x00
+ * s[n] & 0x80 == 0x00
*
* and
*
@@ -57,7 +57,7 @@ extern int enc_u_size_uint(uint);
#define enc_u_sizew(w) \
( (uint)(w) < enc_u_lim_1b \
? 1 \
- : (uint)(w) < enc_u_lim_2b ? 2 : enc_u_size_uint(w) )
+ : (uint)(w) < enc_u_lim_2b ? 2 : enc_u_size_uint(w) )
/* similarly, for a pair of values (frequently used for points) */
#define enc_u_size2w(w1, w2) \
@@ -100,7 +100,6 @@ extern byte * enc_u_get_uint_nc(uint *, byte *);
#define enc_u_putxy(xy, p) enc_u_put2w((xy).x, (xy).y, (p))
-
/* decode an unsigned integer */
#define enc_u_getw(w, p) \
BEGIN \
@@ -140,7 +139,6 @@ extern byte * enc_u_get_uint_nc(uint *, byte *);
#define enc_u_getxy(xy, p) enc_u_get2w((xy).x, (xy).y, (p))
#define enc_u_getxy_nc(xy, p) enc_u_get2w_nc((xy).x, (xy).y, (p))
-
/*
* An encoding mechanism similar to that above for signed integers. This
* makes use of the next-to-highest order bit of the first byte to encode
@@ -186,7 +184,6 @@ extern int enc_s_size_int(int);
#define enc_s_sizexy(xy) (enc_s_sizew((xy).x) + enc_s_sizew((xy).y))
-
/* encode and decode a signed integfer; note special handling of const */
extern byte * enc_s_put_int(int, byte *);
extern const byte * enc_s_get_int(int *, const byte *);
diff --git a/gs/base/gsshade.c b/gs/base/gsshade.c
index c0eb5eddb..00e301a8d 100644
--- a/gs/base/gsshade.c
+++ b/gs/base/gsshade.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,8 +43,8 @@ ENUM_PTRS_WITH(shading_mesh_enum_ptrs, gs_shading_mesh_t *psm)
{
index -= 2;
if (index < st_data_source_max_ptrs)
- return ENUM_USING(st_data_source, &psm->params.DataSource,
- sizeof(psm->params.DataSource), index);
+ return ENUM_USING(st_data_source, &psm->params.DataSource,
+ sizeof(psm->params.DataSource), index);
return ENUM_USING_PREFIX(st_shading, st_data_source_max_ptrs);
}
ENUM_PTR2(0, gs_shading_mesh_t, params.Function, params.Decode);
@@ -55,7 +55,7 @@ RELOC_PTRS_WITH(shading_mesh_reloc_ptrs, gs_shading_mesh_t *psm)
{
RELOC_PREFIX(st_shading);
RELOC_USING(st_data_source, &psm->params.DataSource,
- sizeof(psm->params.DataSource));
+ sizeof(psm->params.DataSource));
RELOC_PTR2(gs_shading_mesh_t, params.Function, params.Decode);
}
RELOC_PTRS_END
@@ -64,25 +64,25 @@ RELOC_PTRS_END
/* Free variables: params. */
static int
check_CBFD(const gs_shading_params_t * params,
- const gs_function_t * function, const float *domain, int m)
+ const gs_function_t * function, const float *domain, int m)
{
int ncomp = gs_color_space_num_components(params->ColorSpace);
if (ncomp < 0 ||
- (params->have_BBox &&
- (params->BBox.p.x > params->BBox.q.x ||
- params->BBox.p.y > params->BBox.q.y))
- )
- return_error(gs_error_rangecheck);
+ (params->have_BBox &&
+ (params->BBox.p.x > params->BBox.q.x ||
+ params->BBox.p.y > params->BBox.q.y))
+ )
+ return_error(gs_error_rangecheck);
if (function != 0) {
- if (function->params.m != m || function->params.n != ncomp)
- return_error(gs_error_rangecheck);
- /*
- * The Adobe documentation says that the function's domain must
- * be a superset of the domain defined in the shading dictionary.
- * However, Adobe implementations apparently don't necessarily
- * check this ahead of time; therefore, we do the same.
- */
+ if (function->params.m != m || function->params.n != ncomp)
+ return_error(gs_error_rangecheck);
+ /*
+ * The Adobe documentation says that the function's domain must
+ * be a superset of the domain defined in the shading dictionary.
+ * However, Adobe implementations apparently don't necessarily
+ * check this ahead of time; therefore, we do the same.
+ */
}
return 0;
}
@@ -94,26 +94,26 @@ check_mesh(const gs_shading_mesh_params_t * params)
const float *domain;
if (data_source_is_array(params->DataSource))
- domain = 0;
+ domain = 0;
else {
- domain = params->Decode;
- switch (params->BitsPerCoordinate) {
- case 1: case 2: case 4: case 8:
- case 12: case 16: case 24: case 32:
- break;
- default:
- return_error(gs_error_rangecheck);
- }
- switch (params->BitsPerComponent) {
- case 1: case 2: case 4: case 8:
- case 12: case 16:
- break;
- default:
- return_error(gs_error_rangecheck);
- }
+ domain = params->Decode;
+ switch (params->BitsPerCoordinate) {
+ case 1: case 2: case 4: case 8:
+ case 12: case 16: case 24: case 32:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
+ switch (params->BitsPerComponent) {
+ case 1: case 2: case 4: case 8:
+ case 12: case 16:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
}
return check_CBFD((const gs_shading_params_t *)params,
- params->Function, domain, 1);
+ params->Function, domain, 1);
}
/* Check the BitsPerFlag value. Return the value or an error code. */
@@ -121,12 +121,12 @@ static int
check_BPF(const gs_data_source_t *pds, int bpf)
{
if (data_source_is_array(*pds))
- return 2;
+ return 2;
switch (bpf) {
case 2: case 4: case 8:
- return bpf;
+ return bpf;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
}
@@ -187,19 +187,19 @@ static const gs_shading_procs_t shading_Fb_procs = {
};
int
gs_shading_Fb_init(gs_shading_t ** ppsh,
- const gs_shading_Fb_params_t * params, gs_memory_t * mem)
+ const gs_shading_Fb_params_t * params, gs_memory_t * mem)
{
gs_shading_Fb_t *psh;
gs_matrix imat;
int code = check_CBFD((const gs_shading_params_t *)params,
- params->Function, params->Domain, 2);
+ params->Function, params->Domain, 2);
if (code < 0 ||
- (code = gs_matrix_invert(&params->Matrix, &imat)) < 0
- )
- return code;
+ (code = gs_matrix_invert(&params->Matrix, &imat)) < 0
+ )
+ return code;
ALLOC_SHADING(&st_shading_Fb, shading_type_Function_based,
- shading_Fb_procs, "gs_shading_Fb_init");
+ shading_Fb_procs, "gs_shading_Fb_init");
return 0;
}
@@ -225,16 +225,16 @@ static const gs_shading_procs_t shading_A_procs = {
};
int
gs_shading_A_init(gs_shading_t ** ppsh,
- const gs_shading_A_params_t * params, gs_memory_t * mem)
+ const gs_shading_A_params_t * params, gs_memory_t * mem)
{
gs_shading_A_t *psh;
int code = check_CBFD((const gs_shading_params_t *)params,
- params->Function, params->Domain, 1);
+ params->Function, params->Domain, 1);
if (code < 0)
- return code;
+ return code;
ALLOC_SHADING(&st_shading_A, shading_type_Axial,
- shading_A_procs, "gs_shading_A_init");
+ shading_A_procs, "gs_shading_A_init");
return 0;
}
@@ -260,20 +260,20 @@ static const gs_shading_procs_t shading_R_procs = {
};
int
gs_shading_R_init(gs_shading_t ** ppsh,
- const gs_shading_R_params_t * params, gs_memory_t * mem)
+ const gs_shading_R_params_t * params, gs_memory_t * mem)
{
gs_shading_R_t *psh;
int code = check_CBFD((const gs_shading_params_t *)params,
- params->Function, params->Domain, 1);
+ params->Function, params->Domain, 1);
if (code < 0)
- return code;
+ return code;
if ((params->Domain != 0 && params->Domain[0] == params->Domain[1]) ||
- params->Coords[2] < 0 || params->Coords[5] < 0
- )
- return_error(gs_error_rangecheck);
+ params->Coords[2] < 0 || params->Coords[5] < 0
+ )
+ return_error(gs_error_rangecheck);
ALLOC_SHADING(&st_shading_R, shading_type_Radial,
- shading_R_procs, "gs_shading_R_init");
+ shading_R_procs, "gs_shading_R_init");
return 0;
}
@@ -295,19 +295,19 @@ static const gs_shading_procs_t shading_FfGt_procs = {
};
int
gs_shading_FfGt_init(gs_shading_t ** ppsh,
- const gs_shading_FfGt_params_t * params,
- gs_memory_t * mem)
+ const gs_shading_FfGt_params_t * params,
+ gs_memory_t * mem)
{
gs_shading_FfGt_t *psh;
int code = check_mesh((const gs_shading_mesh_params_t *)params);
int bpf = check_BPF(&params->DataSource, params->BitsPerFlag);
if (code < 0)
- return code;
+ return code;
if (bpf < 0)
- return bpf;
+ return bpf;
ALLOC_SHADING(&st_shading_FfGt, shading_type_Free_form_Gouraud_triangle,
- shading_FfGt_procs, "gs_shading_FfGt_init");
+ shading_FfGt_procs, "gs_shading_FfGt_init");
psh->params.BitsPerFlag = bpf;
return 0;
}
@@ -330,17 +330,17 @@ static const gs_shading_procs_t shading_LfGt_procs = {
};
int
gs_shading_LfGt_init(gs_shading_t ** ppsh,
- const gs_shading_LfGt_params_t * params, gs_memory_t * mem)
+ const gs_shading_LfGt_params_t * params, gs_memory_t * mem)
{
gs_shading_LfGt_t *psh;
int code = check_mesh((const gs_shading_mesh_params_t *)params);
if (code < 0)
- return code;
+ return code;
if (params->VerticesPerRow < 2)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
ALLOC_SHADING(&st_shading_LfGt, shading_type_Lattice_form_Gouraud_triangle,
- shading_LfGt_procs, "gs_shading_LfGt_init");
+ shading_LfGt_procs, "gs_shading_LfGt_init");
return 0;
}
@@ -362,18 +362,18 @@ static const gs_shading_procs_t shading_Cp_procs = {
};
int
gs_shading_Cp_init(gs_shading_t ** ppsh,
- const gs_shading_Cp_params_t * params, gs_memory_t * mem)
+ const gs_shading_Cp_params_t * params, gs_memory_t * mem)
{
gs_shading_Cp_t *psh;
int code = check_mesh((const gs_shading_mesh_params_t *)params);
int bpf = check_BPF(&params->DataSource, params->BitsPerFlag);
if (code < 0)
- return code;
+ return code;
if (bpf < 0)
- return bpf;
+ return bpf;
ALLOC_SHADING(&st_shading_Cp, shading_type_Coons_patch,
- shading_Cp_procs, "gs_shading_Cp_init");
+ shading_Cp_procs, "gs_shading_Cp_init");
psh->params.BitsPerFlag = bpf;
return 0;
}
@@ -396,18 +396,18 @@ static const gs_shading_procs_t shading_Tpp_procs = {
};
int
gs_shading_Tpp_init(gs_shading_t ** ppsh,
- const gs_shading_Tpp_params_t * params, gs_memory_t * mem)
+ const gs_shading_Tpp_params_t * params, gs_memory_t * mem)
{
gs_shading_Tpp_t *psh;
int code = check_mesh((const gs_shading_mesh_params_t *)params);
int bpf = check_BPF(&params->DataSource, params->BitsPerFlag);
if (code < 0)
- return code;
+ return code;
if (bpf < 0)
- return bpf;
+ return bpf;
ALLOC_SHADING(&st_shading_Tpp, shading_type_Tensor_product_patch,
- shading_Tpp_procs, "gs_shading_Tpp_init");
+ shading_Tpp_procs, "gs_shading_Tpp_init");
psh->params.BitsPerFlag = bpf;
return 0;
}
@@ -417,32 +417,32 @@ gs_shading_Tpp_init(gs_shading_t ** ppsh,
/* Add a user-space rectangle to a path. */
int
gs_shading_path_add_box(gx_path *ppath, const gs_rect *pbox,
- const gs_matrix_fixed *pmat)
+ const gs_matrix_fixed *pmat)
{
gs_fixed_point pt;
gs_fixed_point pts[3];
int code;
if ((code = gs_point_transform2fixed(pmat, pbox->p.x, pbox->p.y,
- &pt)) < 0 ||
- (code = gx_path_add_point(ppath, pt.x, pt.y)) < 0 ||
- (code = gs_point_transform2fixed(pmat, pbox->q.x, pbox->p.y,
- &pts[0])) < 0 ||
- (code = gs_point_transform2fixed(pmat, pbox->q.x, pbox->q.y,
- &pts[1])) < 0 ||
- (code = gs_point_transform2fixed(pmat, pbox->p.x, pbox->q.y,
- &pts[2])) < 0 ||
- (code = gx_path_add_lines(ppath, pts, 3)) < 0
- )
- DO_NOTHING;
+ &pt)) < 0 ||
+ (code = gx_path_add_point(ppath, pt.x, pt.y)) < 0 ||
+ (code = gs_point_transform2fixed(pmat, pbox->q.x, pbox->p.y,
+ &pts[0])) < 0 ||
+ (code = gs_point_transform2fixed(pmat, pbox->q.x, pbox->q.y,
+ &pts[1])) < 0 ||
+ (code = gs_point_transform2fixed(pmat, pbox->p.x, pbox->q.y,
+ &pts[2])) < 0 ||
+ (code = gx_path_add_lines(ppath, pts, 3)) < 0
+ )
+ DO_NOTHING;
return code;
}
/* Fill a path with a shading. */
int
gs_shading_do_fill_rectangle(const gs_shading_t *psh,
- const gs_fixed_rect *prect, gx_device *dev,
- gs_imager_state *pis, bool fill_background)
+ const gs_fixed_rect *prect, gx_device *dev,
+ gs_imager_state *pis, bool fill_background)
{ /* If you need to fill a path, clip the output device before calling this function. */
const gs_matrix_fixed *pmat = &pis->ctm;
gs_fixed_rect path_box;
@@ -452,27 +452,27 @@ gs_shading_do_fill_rectangle(const gs_shading_t *psh,
dev_proc(dev, get_clipping_box)(dev, &path_box);
if (prect)
- rect_intersect(path_box, *prect);
+ rect_intersect(path_box, *prect);
if (psh->params.Background && fill_background) {
- const gs_color_space *pcs = psh->params.ColorSpace;
- gs_client_color cc;
- gx_device_color dev_color;
+ const gs_color_space *pcs = psh->params.ColorSpace;
+ gs_client_color cc;
+ gx_device_color dev_color;
- cc = *psh->params.Background;
- (*pcs->type->restrict_color)(&cc, pcs);
- (*pcs->type->remap_color)(&cc, pcs, &dev_color, pis,
- dev, gs_color_select_texture);
+ cc = *psh->params.Background;
+ (*pcs->type->restrict_color)(&cc, pcs);
+ (*pcs->type->remap_color)(&cc, pcs, &dev_color, pis,
+ dev, gs_color_select_texture);
- /****** WRONG IF NON-IDEMPOTENT RasterOp ******/
- code = gx_shade_background(dev, &path_box, &dev_color, pis->log_op);
+ /****** WRONG IF NON-IDEMPOTENT RasterOp ******/
+ code = gx_shade_background(dev, &path_box, &dev_color, pis->log_op);
}
if (code >= 0) {
- path_rect.p.x = fixed2float(path_box.p.x);
- path_rect.p.y = fixed2float(path_box.p.y);
- path_rect.q.x = fixed2float(path_box.q.x);
- path_rect.q.y = fixed2float(path_box.q.y);
- gs_bbox_transform_inverse(&path_rect, (const gs_matrix *)pmat, &rect);
- code = gs_shading_fill_rectangle(psh, &rect, &path_box, dev, pis);
+ path_rect.p.x = fixed2float(path_box.p.x);
+ path_rect.p.y = fixed2float(path_box.p.y);
+ path_rect.q.x = fixed2float(path_box.q.x);
+ path_rect.q.y = fixed2float(path_box.q.y);
+ gs_bbox_transform_inverse(&path_rect, (const gs_matrix *)pmat, &rect);
+ code = gs_shading_fill_rectangle(psh, &rect, &path_box, dev, pis);
}
return code;
}
diff --git a/gs/base/gsshade.h b/gs/base/gsshade.h
index 47d092ccf..911d648c2 100644
--- a/gs/base/gsshade.h
+++ b/gs/base/gsshade.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,8 +78,8 @@ typedef struct gx_device_s gx_device;
*/
#define SHADING_FILL_RECTANGLE_PROC(proc)\
int proc(const gs_shading_t *psh, const gs_rect *prect,\
- const gs_fixed_rect *prect_clip, gx_device *dev,\
- gs_imager_state *pis)
+ const gs_fixed_rect *prect_clip, gx_device *dev,\
+ gs_imager_state *pis)
typedef SHADING_FILL_RECTANGLE_PROC((*shading_fill_rectangle_proc_t));
#define gs_shading_fill_rectangle(psh, prect, prect_clip, dev, pis)\
((psh)->head.procs.fill_rectangle(psh, prect, prect_clip, dev, pis))
@@ -219,26 +219,26 @@ void gs_shading_Tpp_params_init(gs_shading_Tpp_params_t * params);
/* Create (initialize) shadings of specific types. */
int gs_shading_Fb_init(gs_shading_t ** ppsh,
- const gs_shading_Fb_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_Fb_params_t * params,
+ gs_memory_t * mem);
int gs_shading_A_init(gs_shading_t ** ppsh,
- const gs_shading_A_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_A_params_t * params,
+ gs_memory_t * mem);
int gs_shading_R_init(gs_shading_t ** ppsh,
- const gs_shading_R_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_R_params_t * params,
+ gs_memory_t * mem);
int gs_shading_FfGt_init(gs_shading_t ** ppsh,
- const gs_shading_FfGt_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_FfGt_params_t * params,
+ gs_memory_t * mem);
int gs_shading_LfGt_init(gs_shading_t ** ppsh,
- const gs_shading_LfGt_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_LfGt_params_t * params,
+ gs_memory_t * mem);
int gs_shading_Cp_init(gs_shading_t ** ppsh,
- const gs_shading_Cp_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_Cp_params_t * params,
+ gs_memory_t * mem);
int gs_shading_Tpp_init(gs_shading_t ** ppsh,
- const gs_shading_Tpp_params_t * params,
- gs_memory_t * mem);
+ const gs_shading_Tpp_params_t * params,
+ gs_memory_t * mem);
/*
* Fill a path or a (device-space) rectangle with a shading. Both the path
@@ -258,12 +258,12 @@ typedef struct gx_path_s gx_path;
typedef struct gs_matrix_fixed_s gs_matrix_fixed;
#endif
/* Fill a rectangle with a shading. */
-int gs_shading_do_fill_rectangle(const gs_shading_t *psh,
- const gs_fixed_rect *prect, gx_device *dev,
- gs_imager_state *pis, bool fill_background);
+int gs_shading_do_fill_rectangle(const gs_shading_t *psh,
+ const gs_fixed_rect *prect, gx_device *dev,
+ gs_imager_state *pis, bool fill_background);
/* Add a shading bbox to a path. */
int gs_shading_path_add_box(gx_path *ppath, const gs_rect *pbox,
- const gs_matrix_fixed *pmat);
+ const gs_matrix_fixed *pmat);
#endif /* gsshade_INCLUDED */
diff --git a/gs/base/gsstate.c b/gs/base/gsstate.c
index 244935e3e..1534749e7 100644
--- a/gs/base/gsstate.c
+++ b/gs/base/gsstate.c
@@ -471,7 +471,6 @@ gs_grestoreall_for_restore(gs_state * pgs, gs_state * saved)
return gs_grestore(pgs);
}
-
/* Restore to the bottommost graphics state (at this save level). */
int
gs_grestoreall(gs_state * pgs)
@@ -997,7 +996,6 @@ gstate_clone(gs_state * pfrom, gs_memory_t * mem, client_name_t cname,
return 0;
}
-
/* Adjust reference counters for the whole clip stack */
/* accessible from the given point */
static void
diff --git a/gs/base/gsstate.h b/gs/base/gsstate.h
index 486427224..5b6bea5a0 100644
--- a/gs/base/gsstate.h
+++ b/gs/base/gsstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsstruct.h b/gs/base/gsstruct.h
index b79919698..cd33da11a 100644
--- a/gs/base/gsstruct.h
+++ b/gs/base/gsstruct.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -144,7 +144,7 @@ struct gs_gc_root_s {
/* Print a root debugging message. */
#define if_debug_root(c, msg, rp)\
if_debug4(c, "%s 0x%lx: 0x%lx -> 0x%lx\n",\
- msg, (ulong)(rp), (ulong)(rp)->p, (ulong)*(rp)->p)
+ msg, (ulong)(rp), (ulong)(rp)->p, (ulong)*(rp)->p)
/*
* We don't want to tie the allocator to using a single garbage collector,
@@ -163,13 +163,13 @@ struct gs_gc_root_s {
#define param_string_proc_reloc(proc)\
void proc(gs_param_string *, gc_state_t *)
#define gc_procs_common\
- /* Relocate a pointer to an object. */\
+ /* Relocate a pointer to an object. */\
ptr_proc_reloc((*reloc_struct_ptr), void /*obj_header_t*/);\
- /* Relocate a pointer to a string. */\
+ /* Relocate a pointer to a string. */\
string_proc_reloc((*reloc_string));\
- /* Relocate a pointer to a const string. */\
+ /* Relocate a pointer to a const string. */\
const_string_proc_reloc((*reloc_const_string));\
- /* Relocate a pointer to a parameter string. */\
+ /* Relocate a pointer to a parameter string. */\
param_string_proc_reloc((*reloc_param_string))
typedef struct gc_procs_common_s {
gc_procs_common;
@@ -533,8 +533,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define CLEAR_MARKS_PROC(proc)\
void proc(const gs_memory_t *cmem, void *vptr, uint size, const gs_memory_struct_type_t *pstype)
- /* Complex structures with their own clear_marks, */
- /* enum, reloc, and finalize procedures. */
+ /* Complex structures with their own clear_marks, */
+ /* enum, reloc, and finalize procedures. */
#define gs__st_complex_only(scope_st, stname, stype, sname, pclear, penum, preloc, pfinal)\
scope_st stname = { sizeof(stype), sname, 0, pclear, penum, preloc, pfinal, 0 }
@@ -554,7 +554,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_complex(stname, stype, sname, pclear, penum, preloc, pfinal)\
gs__st_complex(private_st, stname, stype, sname, pclear, penum, preloc, pfinal)
- /* Composite structures with their own enum and reloc procedures. */
+ /* Composite structures with their own enum and reloc procedures. */
#define gs__st_composite(scope_st, stname, stype, sname, penum, preloc)\
static struct_proc_enum_ptrs(penum);\
@@ -565,7 +565,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_composite(stname, stype, sname, penum, preloc)\
gs__st_composite(private_st, stname, stype, sname, penum, preloc)
- /* Composite structures with inherited finalization. */
+ /* Composite structures with inherited finalization. */
#define gs__st_composite_use_final(scope_st, stname, stype, sname, penum, preloc, pfinal)\
static struct_proc_enum_ptrs(penum);\
@@ -576,7 +576,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_composite_use_final(stname, stype, sname, penum, preloc, pfinal)\
gs__st_composite_use_final(private_st, stname, stype, sname, penum, preloc, pfinal)
- /* Composite structures with finalization. */
+ /* Composite structures with finalization. */
#define gs__st_composite_final(scope_st, stname, stype, sname, penum, preloc, pfinal)\
static struct_proc_finalize(pfinal);\
@@ -586,8 +586,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_composite_final(stname, stype, sname, penum, preloc, pfinal)\
gs__st_composite_final(private_st, stname, stype, sname, penum, preloc, pfinal)
- /* Composite structures with enum and reloc procedures */
- /* already declared. */
+ /* Composite structures with enum and reloc procedures */
+ /* already declared. */
#define gs__st_composite_only(scope_st, stname, stype, sname, penum, preloc)\
gs__st_complex_only(scope_st, stname, stype, sname, 0, penum, preloc, 0)
@@ -598,9 +598,9 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
/* ---------------- Special kinds of structures ---------------- */
- /* Element structures, for use in arrays of structures. */
- /* Note that these require that the underlying structure's */
- /* enum_ptrs procedure always return the same number of pointers. */
+ /* Element structures, for use in arrays of structures. */
+ /* Note that these require that the underlying structure's */
+ /* enum_ptrs procedure always return the same number of pointers. */
#define gs__st_element(scope_st, stname, stype, sname, penum, preloc, basest)\
static ENUM_PTRS_BEGIN_PROC(penum) {\
@@ -620,9 +620,9 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_element(stname, stype, sname, penum, preloc, basest)\
gs__st_element(private_st, stname, stype, sname, penum, preloc, basest)
- /* A "structure" just consisting of a pointer. */
- /* Note that in this case only, stype is a pointer type. */
- /* Fortunately, C's bizarre 'const' syntax does what we want here. */
+ /* A "structure" just consisting of a pointer. */
+ /* Note that in this case only, stype is a pointer type. */
+ /* Fortunately, C's bizarre 'const' syntax does what we want here. */
#define gs__st_ptr(scope_st, stname, stype, sname, penum, preloc)\
static ENUM_PTRS_BEGIN(penum) return 0;\
@@ -640,7 +640,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
/* ---------- Ordinary structures with a fixed set of pointers ----------- */
/* Note that we "cannibalize" the penum and preloc names for elts and sdata. */
- /* Structures with 1 pointer. */
+ /* Structures with 1 pointer. */
#define gs__st_ptrs1(scope_st, stname, stype, sname, penum, preloc, e1)\
BASIC_PTRS(penum) {\
@@ -652,7 +652,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs1(stname, stype, sname, penum, preloc, e1)\
gs__st_ptrs1(private_st, stname, stype, sname, penum, preloc, e1)
- /* Structures with 1 string. */
+ /* Structures with 1 string. */
#define gs__st_strings1(scope_st, stname, stype, sname, penum, preloc, e1)\
BASIC_PTRS(penum) {\
@@ -664,7 +664,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_strings1(stname, stype, sname, penum, preloc, e1)\
gs__st_strings1(private_st, stname, stype, sname, penum, preloc, e1)
- /* Structures with 1 const string. */
+ /* Structures with 1 const string. */
#define gs__st_const_strings1(scope_st, stname, stype, sname, penum, preloc, e1)\
BASIC_PTRS(penum) {\
@@ -676,7 +676,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_const_strings1(stname, stype, sname, penum, preloc, e1)\
gs__st_const_strings1(private_st, stname, stype, sname, penum, preloc, e1)
- /* Structures with 2 const strings. */
+ /* Structures with 2 const strings. */
#define gs__st_const_strings2(scope_st, stname, stype, sname, penum, preloc, e1, e2)\
BASIC_PTRS(penum) {\
@@ -688,7 +688,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_const_strings2(stname, stype, sname, penum, preloc, e1, e2)\
gs__st_const_strings2(private_st, stname, stype, sname, penum, preloc, e1, e2)
- /* Structures with 2 pointers. */
+ /* Structures with 2 pointers. */
#define gs__st_ptrs2(scope_st, stname, stype, sname, penum, preloc, e1, e2)\
BASIC_PTRS(penum) {\
@@ -700,7 +700,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs2(stname, stype, sname, penum, preloc, e1, e2)\
gs__st_ptrs2(private_st, stname, stype, sname, penum, preloc, e1, e2)
- /* Structures with 3 pointers. */
+ /* Structures with 3 pointers. */
#define gs__st_ptrs3(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3)\
BASIC_PTRS(penum) {\
@@ -712,7 +712,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs3(stname, stype, sname, penum, preloc, e1, e2, e3)\
gs__st_ptrs3(private_st, stname, stype, sname, penum, preloc, e1, e2, e3)
- /* Structures with 4 pointers. */
+ /* Structures with 4 pointers. */
#define gs__st_ptrs4(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4)\
BASIC_PTRS(penum) {\
@@ -724,7 +724,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs4(stname, stype, sname, penum, preloc, e1, e2, e3, e4)\
gs__st_ptrs4(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4)
- /* Structures with 5 pointers. */
+ /* Structures with 5 pointers. */
#define gs__st_ptrs5(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)\
BASIC_PTRS(penum) {\
@@ -736,7 +736,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs5(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)\
gs__st_ptrs5(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)
- /* Structures with 6 pointers. */
+ /* Structures with 6 pointers. */
#define gs__st_ptrs6(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6)\
BASIC_PTRS(penum) {\
@@ -748,8 +748,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs6(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6)\
gs__st_ptrs6(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6)
-
- /* Structures with 7 pointers. */
+ /* Structures with 7 pointers. */
#define gs__st_ptrs7(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7)\
BASIC_PTRS(penum) {\
@@ -761,7 +760,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs7(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7)\
gs__st_ptrs7(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7)
- /* Structures with 8 pointers. */
+ /* Structures with 8 pointers. */
#define gs__st_ptrs8(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8)\
BASIC_PTRS(penum) {\
@@ -773,7 +772,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs8(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8)\
gs__st_ptrs8(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8)
- /* Structures with 9 pointers. */
+ /* Structures with 9 pointers. */
#define gs__st_ptrs9(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9)\
BASIC_PTRS(penum) {\
@@ -785,7 +784,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs9(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9)\
gs__st_ptrs9(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9)
- /* Structures with 10 pointers. */
+ /* Structures with 10 pointers. */
#define gs__st_ptrs10(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)\
BASIC_PTRS(penum) {\
@@ -797,7 +796,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs10(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)\
gs__st_ptrs10(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)
- /* Structures with 11 pointers. */
+ /* Structures with 11 pointers. */
#define gs__st_ptrs11(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)\
BASIC_PTRS(penum) {\
@@ -809,8 +808,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs11(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)\
gs__st_ptrs11(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)
-
- /* Structures with 1 const string and 1 pointer. */
+ /* Structures with 1 const string and 1 pointer. */
#define gs__st_const_strings1_ptrs1(scope_st, stname, stype, sname, penum, preloc, e1, e2)\
BASIC_PTRS(penum) {\
@@ -822,7 +820,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_const_strings1_ptrs1(stname, stype, sname, penum, preloc, e1, e2)\
gs__st_const_strings1_ptrs1(private_st, stname, stype, sname, penum, preloc, e1, e2)
- /* Structures with 1 const string and 4 pointers. */
+ /* Structures with 1 const string and 4 pointers. */
#define gs__st_strings1_ptrs4(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)\
BASIC_PTRS(penum) {\
@@ -835,7 +833,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_strings1_ptrs4(stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)\
gs__st_strings1_ptrs4(private_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5)
- /* Structures with 1 const string and 7 pointers. */
+ /* Structures with 1 const string and 7 pointers. */
#define gs__st_strings1_ptrs7(scope_st, stname, stype, sname, penum, preloc, e1, e2, e3, e4, e5, e6, e7, e8)\
BASIC_PTRS(penum) {\
@@ -850,7 +848,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
/* ---------------- Suffix subclasses ---------------- */
- /* Suffix subclasses with no additional pointers. */
+ /* Suffix subclasses with no additional pointers. */
#define gs__st_suffix_add0(scope_st, stname, stype, sname, penum, preloc, supstname)\
gs__st_basic_with_super_final(scope_st, stname, stype, sname, 0, 0, preloc, &supstname, 0, 0)
@@ -859,10 +857,10 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add0(stname, stype, sname, penum, preloc, supstname)\
gs__st_suffix_add0(private_st, stname, stype, sname, penum, preloc, supstname)
- /* Suffix subclasses with no additional pointers, */
- /* and with the superclass defined earlier in the same file */
- /* as a 'basic' type. */
- /* In this case, we don't even need new procedures. */
+ /* Suffix subclasses with no additional pointers, */
+ /* and with the superclass defined earlier in the same file */
+ /* as a 'basic' type. */
+ /* In this case, we don't even need new procedures. */
#define gs__st_suffix_add0_local(scope_st, stname, stype, sname, supenum, supreloc, supstname)\
scope_st stname = {\
@@ -874,10 +872,10 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add0_local(stname, stype, sname, supenum, supreloc, supstname)\
gs__st_suffix_add0_local(private_st, stname, stype, sname, supenum, supreloc, supstname)
- /* Suffix subclasses with no additional pointers and finalization. */
- /* This is a hack -- subclasses should inherit finalization, */
- /* but that would require a superclass pointer in the descriptor, */
- /* which would perturb things too much right now. */
+ /* Suffix subclasses with no additional pointers and finalization. */
+ /* This is a hack -- subclasses should inherit finalization, */
+ /* but that would require a superclass pointer in the descriptor, */
+ /* which would perturb things too much right now. */
#define gs__st_suffix_add0_final(scope_st, stname, stype, sname, penum, preloc, pfinal, supstname)\
static ENUM_PTRS_BEGIN_PROC(penum) {\
@@ -892,7 +890,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add0_final(stname, stype, sname, penum, preloc, pfinal, supstname)\
gs__st_suffix_add0_final(private_st, stname, stype, sname, penum, preloc, pfinal, supstname)
- /* Suffix subclasses with 1 additional pointer. */
+ /* Suffix subclasses with 1 additional pointer. */
#define gs__st_suffix_add1(scope_st, stname, stype, sname, penum, preloc, supstname, e1)\
BASIC_PTRS(penum) {\
@@ -904,8 +902,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add1(stname, stype, sname, penum, preloc, supstname, e1)\
gs__st_suffix_add1(private_st, stname, stype, sname, penum, preloc, supstname, e1)
- /* Suffix subclasses with 1 additional pointer and finalization. */
- /* See above regarding finalization and subclasses. */
+ /* Suffix subclasses with 1 additional pointer and finalization. */
+ /* See above regarding finalization and subclasses. */
#define gs__st_suffix_add1_final(scope_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1)\
BASIC_PTRS(penum) {\
@@ -917,7 +915,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add1_final(stname, stype, sname, penum, preloc, pfinal, supstname, e1)\
gs__st_suffix_add1_final(private_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1)
- /* Suffix subclasses with 1 additional string. */
+ /* Suffix subclasses with 1 additional string. */
#define gs__st_suffix_add_strings1(scope_st, stname, stype, sname, penum, preloc, supstname, e1)\
BASIC_PTRS(penum) {\
@@ -929,7 +927,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add_strings1(stname, stype, sname, penum, preloc, supstname, e1)\
gs__st_suffix_add_strings1(private_st, stname, stype, sname, penum, preloc, supstname, e1)
- /* Suffix subclasses with 2 additional pointers. */
+ /* Suffix subclasses with 2 additional pointers. */
#define gs__st_suffix_add2(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2)\
BASIC_PTRS(penum) {\
@@ -941,7 +939,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add2(stname, stype, sname, penum, preloc, supstname, e1, e2)\
gs__st_suffix_add2(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2)
- /* Suffix subclasses with 1 additional pointers and 1 string. */
+ /* Suffix subclasses with 1 additional pointers and 1 string. */
#define gs__st_suffix_add1_string1(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2)\
BASIC_PTRS(penum) {\
@@ -953,7 +951,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
gs__st_suffix_add1_string1(public_st, stname, stype, sname, penum, preloc, supstname, e1, e2)
#define gs_private_st_suffix_add1_string1(stname, stype, sname, penum, preloc, supstname, e1, e2)\
gs__st_suffix_add1_string1(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2)
- /* Suffix subclasses with 2 additional pointers and 1 string. */
+ /* Suffix subclasses with 2 additional pointers and 1 string. */
#define gs__st_suffix_add2_string1(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3)\
BASIC_PTRS(penum) {\
@@ -966,8 +964,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add2_string1(stname, stype, sname, penum, preloc, supstname, e1, e2, e3)\
gs__st_suffix_add2_string1(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3)
- /* Suffix subclasses with 2 additional pointers and finalization. */
- /* See above regarding finalization and subclasses. */
+ /* Suffix subclasses with 2 additional pointers and finalization. */
+ /* See above regarding finalization and subclasses. */
#define gs__st_suffix_add2_final(scope_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2)\
BASIC_PTRS(penum) {\
@@ -990,7 +988,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_string2_final(stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2)\
gs__st_suffix_string2_final(private_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2)
- /* Suffix subclasses with 3 additional pointers. */
+ /* Suffix subclasses with 3 additional pointers. */
#define gs__st_suffix_add3(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3)\
BASIC_PTRS(penum) {\
@@ -1002,7 +1000,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add3(stname, stype, sname, penum, preloc, supstname, e1, e2, e3)\
gs__st_suffix_add3(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3)
- /* Suffix subclasses with 3 additional pointers and 1 string. */
+ /* Suffix subclasses with 3 additional pointers and 1 string. */
#define gs__st_suffix_add3_string1(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)\
BASIC_PTRS(penum) {\
@@ -1015,8 +1013,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add3_string1(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)\
gs__st_suffix_add3_string1(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)
- /* Suffix subclasses with 3 additional pointers and finalization. */
- /* See above regarding finalization and subclasses. */
+ /* Suffix subclasses with 3 additional pointers and finalization. */
+ /* See above regarding finalization and subclasses. */
#define gs__st_suffix_add3_final(scope_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3)\
BASIC_PTRS(penum) {\
@@ -1028,7 +1026,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add3_final(stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3)\
gs__st_suffix_add3_final(private_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3)
- /* Suffix subclasses with 4 additional pointers. */
+ /* Suffix subclasses with 4 additional pointers. */
#define gs__st_suffix_add4(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)\
BASIC_PTRS(penum) {\
@@ -1040,8 +1038,8 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add4(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)\
gs__st_suffix_add4(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4)
- /* Suffix subclasses with 4 additional pointers and finalization. */
- /* See above regarding finalization and subclasses. */
+ /* Suffix subclasses with 4 additional pointers and finalization. */
+ /* See above regarding finalization and subclasses. */
#define gs__st_suffix_add4_final(scope_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3, e4)\
BASIC_PTRS(penum) {\
@@ -1053,7 +1051,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add4_final(stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3, e4)\
gs__st_suffix_add4_final(private_st, stname, stype, sname, penum, preloc, pfinal, supstname, e1, e2, e3, e4)
- /* Suffix subclasses with 5 additional pointers. */
+ /* Suffix subclasses with 5 additional pointers. */
#define gs__st_suffix_add5(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5)\
BASIC_PTRS(penum) {\
@@ -1065,7 +1063,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add5(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5)\
gs__st_suffix_add5(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5)
- /* Suffix subclasses with 6 additional pointers. */
+ /* Suffix subclasses with 6 additional pointers. */
#define gs__st_suffix_add6(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6)\
BASIC_PTRS(penum) {\
@@ -1077,7 +1075,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add6(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6)\
gs__st_suffix_add6(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6)
- /* Suffix subclasses with 7 additional pointers. */
+ /* Suffix subclasses with 7 additional pointers. */
#define gs__st_suffix_add7(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7)\
BASIC_PTRS(penum) {\
@@ -1090,7 +1088,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add7(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7)\
gs__st_suffix_add7(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7)
- /* Suffix subclasses with 8 additional pointers. */
+ /* Suffix subclasses with 8 additional pointers. */
#define gs__st_suffix_add8(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8)\
BASIC_PTRS(penum) {\
@@ -1103,7 +1101,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add8(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8)\
gs__st_suffix_add8(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8)
- /* Suffix subclasses with 9 additional pointers. */
+ /* Suffix subclasses with 9 additional pointers. */
#define gs__st_suffix_add9(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9)\
BASIC_PTRS(penum) {\
@@ -1116,7 +1114,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add9(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9)\
gs__st_suffix_add9(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9)
- /* Suffix subclasses with 10 additional pointers. */
+ /* Suffix subclasses with 10 additional pointers. */
#define gs__st_suffix_add10(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)\
BASIC_PTRS(penum) {\
@@ -1129,7 +1127,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_suffix_add10(stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)\
gs__st_suffix_add10(private_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10)
- /* Suffix subclasses with 11 additional pointers. */
+ /* Suffix subclasses with 11 additional pointers. */
#define gs__st_suffix_add11(scope_st, stname, stype, sname, penum, preloc, supstname, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11)\
BASIC_PTRS(penum) {\
@@ -1144,7 +1142,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
/* ---------------- General subclasses ---------------- */
- /* General subclasses with no additional pointers. */
+ /* General subclasses with no additional pointers. */
#define gs__st_ptrs_add0(scope_st, stname, stype, sname, penum, preloc, supstname, member)\
gs__st_basic_with_super_final(scope_st, stname, stype, sname, 0, 0, preloc, &supstname, offset_of(stype, member), 0)
@@ -1153,7 +1151,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs_add0(stname, stype, sname, penum, preloc, supstname, member)\
gs__st_ptrs_add0(private_st, stname, stype, sname, penum, preloc, supstname, member)
- /* General subclasses with 1 additional pointer. */
+ /* General subclasses with 1 additional pointer. */
#define gs__st_ptrs_add1(scope_st, stname, stype, sname, penum, preloc, supstname, member, e1)\
BASIC_PTRS(penum) {\
@@ -1165,7 +1163,7 @@ extern void reloc_const_bytestring(gs_const_bytestring *pbs, gc_state_t *gcst);
#define gs_private_st_ptrs_add1(stname, stype, sname, penum, preloc, supstname, member, e1)\
gs__st_ptrs_add1(private_st, stname, stype, sname, penum, preloc, supstname, member, e1)
- /* General subclasses with 2 additional pointers. */
+ /* General subclasses with 2 additional pointers. */
#define gs__st_ptrs_add2(scope_st, stname, stype, sname, penum, preloc, supstname, member, e1, e2)\
BASIC_PTRS(penum) {\
diff --git a/gs/base/gsstype.h b/gs/base/gsstype.h
index f881cb788..65c0583fc 100644
--- a/gs/base/gsstype.h
+++ b/gs/base/gsstype.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,36 +39,36 @@ typedef struct enum_ptr_s {
/* Define the procedures for structure types. */
- /* Clear the marks of a structure. */
+ /* Clear the marks of a structure. */
#define struct_proc_clear_marks(proc)\
void proc(const gs_memory_t *cmem, void /*obj_header_t*/ *pre, uint size,\
const gs_memory_struct_type_t *pstype)
- /* Enumerate the pointers in a structure. */
+ /* Enumerate the pointers in a structure. */
#define struct_proc_enum_ptrs(proc)\
gs_ptr_type_t proc(const gs_memory_t *mem, EV_CONST void /*obj_header_t*/ *ptr, uint size,\
int index, enum_ptr_t *pep, const gs_memory_struct_type_t *pstype,\
gc_state_t *gcst)
- /* Relocate all the pointers in this structure. */
+ /* Relocate all the pointers in this structure. */
#define struct_proc_reloc_ptrs(proc)\
void proc(void /*obj_header_t*/ *ptr, uint size,\
const gs_memory_struct_type_t *pstype, gc_state_t *gcst)
- /*
- * Finalize this structure just before freeing it.
- * Finalization procedures must not allocate or resize
- * any objects in any space managed by the allocator,
- * and must not assume that any objects in such spaces
- * referenced by this structure still exist. However,
- * finalization procedures may free such objects, and
- * may allocate, free, and reference objects allocated
- * in other ways, such as objects allocated with malloc
- * by libraries.
- */
+ /*
+ * Finalize this structure just before freeing it.
+ * Finalization procedures must not allocate or resize
+ * any objects in any space managed by the allocator,
+ * and must not assume that any objects in such spaces
+ * referenced by this structure still exist. However,
+ * finalization procedures may free such objects, and
+ * may allocate, free, and reference objects allocated
+ * in other ways, such as objects allocated with malloc
+ * by libraries.
+ */
#define struct_proc_finalize(proc)\
void proc(void /*obj_header_t*/ *ptr)
@@ -79,24 +79,24 @@ typedef struct enum_ptr_s {
typedef struct struct_shared_procs_s struct_shared_procs_t;
struct gs_memory_struct_type_s {
- uint ssize;
- struct_name_t sname;
+ uint ssize;
+ struct_name_t sname;
- /* ------ Procedures shared among many structure types. ------ */
- /* Note that this pointer is usually 0. */
+ /* ------ Procedures shared among many structure types. ------ */
+ /* Note that this pointer is usually 0. */
- const struct_shared_procs_t *shared;
+ const struct_shared_procs_t *shared;
- /* ------ Procedures specific to this structure type. ------ */
+ /* ------ Procedures specific to this structure type. ------ */
- struct_proc_clear_marks((*clear_marks));
- struct_proc_enum_ptrs((*enum_ptrs));
- struct_proc_reloc_ptrs((*reloc_ptrs));
- struct_proc_finalize((*finalize));
+ struct_proc_clear_marks((*clear_marks));
+ struct_proc_enum_ptrs((*enum_ptrs));
+ struct_proc_reloc_ptrs((*reloc_ptrs));
+ struct_proc_finalize((*finalize));
- /* A pointer to additional data for the above procedures. */
+ /* A pointer to additional data for the above procedures. */
- const void *proc_data;
+ const void *proc_data;
};
/*
diff --git a/gs/base/gstext.c b/gs/base/gstext.c
index 04a3bd148..6369de23e 100644
--- a/gs/base/gstext.c
+++ b/gs/base/gstext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@
public_st_gs_text_params();
public_st_gs_text_enum();
-static
+static
ENUM_PTRS_WITH(text_params_enum_ptrs, gs_text_params_t *tptr) return 0;
case 0:
if (tptr->operation & TEXT_FROM_STRING) {
@@ -50,29 +50,29 @@ if (tptr->operation & TEXT_FROM_GLYPHS)
return ENUM_OBJ(NULL);
case 1:
return ENUM_OBJ(tptr->operation & TEXT_REPLACE_WIDTHS ?
- tptr->x_widths : NULL);
+ tptr->x_widths : NULL);
case 2:
return ENUM_OBJ(tptr->operation & TEXT_REPLACE_WIDTHS ?
- tptr->y_widths : NULL);
+ tptr->y_widths : NULL);
ENUM_PTRS_END
static RELOC_PTRS_WITH(text_params_reloc_ptrs, gs_text_params_t *tptr)
{
if (tptr->operation & TEXT_FROM_STRING) {
- gs_const_string str;
+ gs_const_string str;
- str.data = tptr->data.bytes;
- str.size = tptr->size;
- RELOC_CONST_STRING_VAR(str);
- tptr->data.bytes = str.data;
+ str.data = tptr->data.bytes;
+ str.size = tptr->size;
+ RELOC_CONST_STRING_VAR(str);
+ tptr->data.bytes = str.data;
} else if (tptr->operation & TEXT_FROM_BYTES)
- RELOC_OBJ_VAR(tptr->data.bytes);
+ RELOC_OBJ_VAR(tptr->data.bytes);
else if (tptr->operation & TEXT_FROM_CHARS)
- RELOC_OBJ_VAR(tptr->data.chars);
+ RELOC_OBJ_VAR(tptr->data.chars);
else if (tptr->operation & TEXT_FROM_GLYPHS)
- RELOC_OBJ_VAR(tptr->data.glyphs);
+ RELOC_OBJ_VAR(tptr->data.glyphs);
if (tptr->operation & TEXT_REPLACE_WIDTHS) {
- RELOC_OBJ_VAR(tptr->x_widths);
- RELOC_OBJ_VAR(tptr->y_widths);
+ RELOC_OBJ_VAR(tptr->x_widths);
+ RELOC_OBJ_VAR(tptr->y_widths);
}
}
RELOC_PTRS_END
@@ -80,14 +80,14 @@ RELOC_PTRS_END
static ENUM_PTRS_WITH(text_enum_enum_ptrs, gs_text_enum_t *eptr)
{
if (index == 8) {
- if (eptr->pair != 0)
- ENUM_RETURN(eptr->pair - eptr->pair->index);
- else
- ENUM_RETURN(0);
+ if (eptr->pair != 0)
+ ENUM_RETURN(eptr->pair - eptr->pair->index);
+ else
+ ENUM_RETURN(0);
}
index -= 9;
if (index <= eptr->fstack.depth)
- ENUM_RETURN(eptr->fstack.items[index].font);
+ ENUM_RETURN(eptr->fstack.items[index].font);
index -= eptr->fstack.depth + 1;
return ENUM_USING(st_gs_text_params, &eptr->text, sizeof(eptr->text), index);
}
@@ -107,41 +107,41 @@ static RELOC_PTRS_WITH(text_enum_reloc_ptrs, gs_text_enum_t *eptr)
RELOC_PTR3(gs_text_enum_t, pis, orig_font, path);
RELOC_PTR3(gs_text_enum_t, pdcolor, pcpath, current_font);
if (eptr->pair != NULL)
- eptr->pair = (cached_fm_pair *)RELOC_OBJ(eptr->pair - eptr->pair->index) +
- eptr->pair->index;
+ eptr->pair = (cached_fm_pair *)RELOC_OBJ(eptr->pair - eptr->pair->index) +
+ eptr->pair->index;
for (i = 0; i <= eptr->fstack.depth; i++)
- RELOC_PTR(gs_text_enum_t, fstack.items[i].font);
+ RELOC_PTR(gs_text_enum_t, fstack.items[i].font);
}
RELOC_PTRS_END
/* Begin processing text. */
int
gx_device_text_begin(gx_device * dev, gs_imager_state * pis,
- const gs_text_params_t * text, gs_font * font,
- gx_path * path, /* unless DO_NONE & !RETURN_WIDTH */
- const gx_device_color * pdcolor, /* DO_DRAW */
- const gx_clip_path * pcpath, /* DO_DRAW */
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ const gs_text_params_t * text, gs_font * font,
+ gx_path * path, /* unless DO_NONE & !RETURN_WIDTH */
+ const gx_device_color * pdcolor, /* DO_DRAW */
+ const gx_clip_path * pcpath, /* DO_DRAW */
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
if (TEXT_PARAMS_ARE_INVALID(text))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
{
- gx_path *tpath =
- ((text->operation & TEXT_DO_NONE) &&
- !(text->operation & TEXT_RETURN_WIDTH) ? 0 : path);
- const gx_clip_path *tcpath =
- (text->operation & TEXT_DO_DRAW ? pcpath : 0);
-
- /* A high level device need to know an initial device color
- for accumulates a charstring of a Type 3 font.
- Since the accumulation may happen while stringwidth.
- we pass the device color unconditionally. */
- return dev_proc(dev, text_begin)
- (dev, pis, text, font, tpath, pdcolor, tcpath, mem, ppte);
+ gx_path *tpath =
+ ((text->operation & TEXT_DO_NONE) &&
+ !(text->operation & TEXT_RETURN_WIDTH) ? 0 : path);
+ const gx_clip_path *tcpath =
+ (text->operation & TEXT_DO_DRAW ? pcpath : 0);
+
+ /* A high level device need to know an initial device color
+ for accumulates a charstring of a Type 3 font.
+ Since the accumulation may happen while stringwidth.
+ we pass the device color unconditionally. */
+ return dev_proc(dev, text_begin)
+ (dev, pis, text, font, tpath, pdcolor, tcpath, mem, ppte);
}
}
-/*
+/*
* Initialize a newly created text enumerator. Implementations of
* text_begin must call this just after allocating the enumerator.
*/
@@ -159,10 +159,10 @@ gs_text_enum_init_dynamic(gs_text_enum_t *pte, gs_font *font)
}
int
gs_text_enum_init(gs_text_enum_t *pte, const gs_text_enum_procs_t *procs,
- gx_device *dev, gs_imager_state *pis,
- const gs_text_params_t *text, gs_font *font, gx_path *path,
- const gx_device_color *pdcolor, const gx_clip_path *pcpath,
- gs_memory_t *mem)
+ gx_device *dev, gs_imager_state *pis,
+ const gs_text_params_t *text, gs_font *font, gx_path *path,
+ const gx_device_color *pdcolor, const gx_clip_path *pcpath,
+ gs_memory_t *mem)
{
int code;
@@ -189,7 +189,7 @@ gs_text_enum_init(gs_text_enum_t *pte, const gs_text_enum_procs_t *procs,
/* init_dynamic sets index, xy_index, fstack */
code = gs_text_enum_init_dynamic(pte, font);
if (code >= 0)
- rc_increment(dev);
+ rc_increment(dev);
return code;
}
@@ -200,7 +200,7 @@ gs_text_enum_init(gs_text_enum_t *pte, const gs_text_enum_procs_t *procs,
*/
void
gs_text_enum_copy_dynamic(gs_text_enum_t *pto, const gs_text_enum_t *pfrom,
- bool for_return)
+ bool for_return)
{
int depth = pfrom->fstack.depth;
@@ -213,18 +213,18 @@ gs_text_enum_copy_dynamic(gs_text_enum_t *pto, const gs_text_enum_t *pfrom,
pto->device_disabled_grid_fitting = pfrom->device_disabled_grid_fitting;
pto->outer_CID = pfrom->outer_CID;
if (depth >= 0)
- memcpy(pto->fstack.items, pfrom->fstack.items,
- (depth + 1) * sizeof(pto->fstack.items[0]));
+ memcpy(pto->fstack.items, pfrom->fstack.items,
+ (depth + 1) * sizeof(pto->fstack.items[0]));
if (for_return) {
- pto->cmap_code = pfrom->cmap_code;
- pto->returned = pfrom->returned;
+ pto->cmap_code = pfrom->cmap_code;
+ pto->returned = pfrom->returned;
}
}
/* Begin processing text based on a graphics state. */
int
gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gx_clip_path *pcpath = 0;
int code;
@@ -234,26 +234,26 @@ gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
* compatibility.
*/
if (text->operation & (TEXT_DO_DRAW | TEXT_DO_ANY_CHARPATH)) {
- if (!pgs->current_point_valid)
- return_error(gs_error_nocurrentpoint);
+ if (!pgs->current_point_valid)
+ return_error(gs_error_nocurrentpoint);
}
/* Detect zero FontNatrix now for Adobe compatibility with CET tests.
Note that matrixe\\ces like [1 0 0 0 0 0] are used in comparefiles
- to compute a text width.
+ to compute a text width.
Note : FontType 3 throws error in setcachedevice. */
if (pgs->font->FontType != ft_user_defined &&
- pgs->font->FontMatrix.xx == 0 && pgs->font->FontMatrix.xy == 0 &&
- pgs->font->FontMatrix.yx == 0 && pgs->font->FontMatrix.yy == 0)
- return_error(gs_error_undefinedresult); /* sic! : CPSI compatibility */
+ pgs->font->FontMatrix.xx == 0 && pgs->font->FontMatrix.xy == 0 &&
+ pgs->font->FontMatrix.yx == 0 && pgs->font->FontMatrix.yy == 0)
+ return_error(gs_error_undefinedresult); /* sic! : CPSI compatibility */
if (text->operation & TEXT_DO_DRAW) {
- code = gx_effective_clip_path(pgs, &pcpath);
+ code = gx_effective_clip_path(pgs, &pcpath);
gs_set_object_tag((gs_imager_state*) pgs, GS_TEXT_TAG);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
/* We must load device color even with no TEXT_DO_DRAW,
- because a high level device accumulates a charstring
- of a Type 3 font while stringwidth.
+ because a high level device accumulates a charstring
+ of a Type 3 font while stringwidth.
Unfortunately we can't effectively know a leaf font type here,
so we load the color unconditionally . */
/* Processing a text object operation */
@@ -262,12 +262,12 @@ gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
gx_set_dev_color(pgs);
code = gs_state_color_load(pgs);
if (code < 0)
- return code;
+ return code;
pgs->device->sgr.stroke_stored = false;
return gx_device_text_begin(pgs->device, (gs_imager_state *) pgs,
- text, pgs->font, pgs->path,
- gs_currentdevicecolor_inline(pgs),
- pcpath, mem, ppte);
+ text, pgs->font, pgs->path,
+ gs_currentdevicecolor_inline(pgs),
+ pcpath, mem, ppte);
}
/*
@@ -302,7 +302,7 @@ static inline uint text_do_draw(gs_state * pgs)
/* Begin PostScript-equivalent text operations. */
int
gs_show_begin(gs_state * pgs, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
@@ -312,12 +312,12 @@ gs_show_begin(gs_state * pgs, const byte * str, uint size,
}
int
gs_ashow_begin(gs_state * pgs, floatp ax, floatp ay, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
text.operation = TEXT_FROM_STRING | TEXT_ADD_TO_ALL_WIDTHS |
- text_do_draw(pgs) | TEXT_RETURN_WIDTH;
+ text_do_draw(pgs) | TEXT_RETURN_WIDTH;
text.data.bytes = str, text.size = size;
text.delta_all.x = ax;
text.delta_all.y = ay;
@@ -325,13 +325,13 @@ gs_ashow_begin(gs_state * pgs, floatp ax, floatp ay, const byte * str, uint size
}
int
gs_widthshow_begin(gs_state * pgs, floatp cx, floatp cy, gs_char chr,
- const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ const byte * str, uint size,
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
text.operation = TEXT_FROM_STRING | TEXT_ADD_TO_SPACE_WIDTH |
- text_do_draw(pgs) | TEXT_RETURN_WIDTH;
+ text_do_draw(pgs) | TEXT_RETURN_WIDTH;
text.data.bytes = str, text.size = size;
text.delta_space.x = cx;
text.delta_space.y = cy;
@@ -340,14 +340,14 @@ gs_widthshow_begin(gs_state * pgs, floatp cx, floatp cy, gs_char chr,
}
int
gs_awidthshow_begin(gs_state * pgs, floatp cx, floatp cy, gs_char chr,
- floatp ax, floatp ay, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ floatp ax, floatp ay, const byte * str, uint size,
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
text.operation = TEXT_FROM_STRING |
- TEXT_ADD_TO_ALL_WIDTHS | TEXT_ADD_TO_SPACE_WIDTH |
- text_do_draw(pgs) | TEXT_RETURN_WIDTH;
+ TEXT_ADD_TO_ALL_WIDTHS | TEXT_ADD_TO_SPACE_WIDTH |
+ text_do_draw(pgs) | TEXT_RETURN_WIDTH;
text.data.bytes = str, text.size = size;
text.delta_space.x = cx;
text.delta_space.y = cy;
@@ -358,15 +358,15 @@ gs_awidthshow_begin(gs_state * pgs, floatp cx, floatp cy, gs_char chr,
}
int
gs_kshow_begin(gs_state * pgs, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
/* Detect degenerate CTM now for Adobe compatibility with CET 13-12-4. */
if (pgs->ctm.xx * pgs->ctm.yy - pgs->ctm.yx * pgs->ctm.xy == 0)
- return_error(gs_error_undefinedresult); /* sic! : CPSI compatibility */
+ return_error(gs_error_undefinedresult); /* sic! : CPSI compatibility */
text.operation = TEXT_FROM_STRING | text_do_draw(pgs) | TEXT_INTERVENE |
- TEXT_RETURN_WIDTH;
+ TEXT_RETURN_WIDTH;
text.data.bytes = str, text.size = size;
return gs_text_begin(pgs, &text, mem, ppte);
}
@@ -380,15 +380,15 @@ gs_get_text_params(gs_text_enum_t *pte)
int
gs_xyshow_begin(gs_state * pgs, const byte * str, uint size,
- const float *x_widths, const float *y_widths,
- uint widths_size, gs_memory_t * mem, gs_text_enum_t ** ppte)
+ const float *x_widths, const float *y_widths,
+ uint widths_size, gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
uint widths_needed;
int code;
text.operation = TEXT_FROM_STRING | TEXT_REPLACE_WIDTHS |
- text_do_draw(pgs) | TEXT_RETURN_WIDTH;
+ text_do_draw(pgs) | TEXT_RETURN_WIDTH;
text.data.bytes = str, text.size = size;
text.x_widths = x_widths;
text.y_widths = y_widths;
@@ -404,12 +404,12 @@ gs_xyshow_begin(gs_state * pgs, const byte * str, uint size,
*/
code = gs_text_count_chars(pgs, &text, mem);
if (code < 0)
- return code;
+ return code;
widths_needed = code;
if (x_widths && y_widths)
- widths_needed <<= 1;
+ widths_needed <<= 1;
if (widths_size < widths_needed)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gs_text_begin(pgs, &text, mem, ppte);
}
@@ -424,13 +424,13 @@ setup_FontBBox_as_Metrics2 (gs_text_enum_t * pte, gs_font * pfont)
For the later case, we set up FontBBox_as_Metrics2 with using
this procedure.. */
if (pfont->FontType == ft_CID_encrypted
- || pfont->FontType == ft_CID_TrueType)
+ || pfont->FontType == ft_CID_TrueType)
pte->FontBBox_as_Metrics2 = ((gs_font_base *)pfont)->FontBBox.q;
}
int
gs_glyphshow_begin(gs_state * pgs, gs_glyph glyph,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
int result;
@@ -445,7 +445,7 @@ gs_glyphshow_begin(gs_state * pgs, gs_glyph glyph,
}
int
gs_cshow_begin(gs_state * pgs, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
@@ -455,7 +455,7 @@ gs_cshow_begin(gs_state * pgs, const byte * str, uint size,
}
int
gs_stringwidth_begin(gs_state * pgs, const byte * str, uint size,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
@@ -465,35 +465,35 @@ gs_stringwidth_begin(gs_state * pgs, const byte * str, uint size,
}
int
gs_charpath_begin(gs_state * pgs, const byte * str, uint size, bool stroke_path,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
text.operation = TEXT_FROM_STRING | TEXT_RETURN_WIDTH |
- (stroke_path ? TEXT_DO_TRUE_CHARPATH : TEXT_DO_FALSE_CHARPATH);
+ (stroke_path ? TEXT_DO_TRUE_CHARPATH : TEXT_DO_FALSE_CHARPATH);
text.data.bytes = str, text.size = size;
return gs_text_begin(pgs, &text, mem, ppte);
}
int
gs_charboxpath_begin(gs_state * pgs, const byte * str, uint size,
- bool stroke_path, gs_memory_t * mem, gs_text_enum_t ** ppte)
+ bool stroke_path, gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
text.operation = TEXT_FROM_STRING | TEXT_RETURN_WIDTH |
- (stroke_path ? TEXT_DO_TRUE_CHARBOXPATH : TEXT_DO_FALSE_CHARBOXPATH);
+ (stroke_path ? TEXT_DO_TRUE_CHARBOXPATH : TEXT_DO_FALSE_CHARBOXPATH);
text.data.bytes = str, text.size = size;
return gs_text_begin(pgs, &text, mem, ppte);
}
int
gs_glyphpath_begin(gs_state * pgs, gs_glyph glyph, bool stroke_path,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
int result;
text.operation = TEXT_FROM_SINGLE_GLYPH | TEXT_RETURN_WIDTH |
- (stroke_path ? TEXT_DO_TRUE_CHARPATH : TEXT_DO_FALSE_CHARPATH);
+ (stroke_path ? TEXT_DO_TRUE_CHARPATH : TEXT_DO_FALSE_CHARPATH);
text.data.d_glyph = glyph;
text.size = 1;
result = gs_text_begin(pgs, &text, mem, ppte);
@@ -503,7 +503,7 @@ gs_glyphpath_begin(gs_state * pgs, gs_glyph glyph, bool stroke_path,
}
int
gs_glyphwidth_begin(gs_state * pgs, gs_glyph glyph,
- gs_memory_t * mem, gs_text_enum_t ** ppte)
+ gs_memory_t * mem, gs_text_enum_t ** ppte)
{
gs_text_params_t text;
int result;
@@ -563,11 +563,11 @@ gs_text_next_char(const gs_text_enum_t *pte)
const uint operation = pte->text.operation;
if (pte->index >= pte->text.size)
- return gs_no_char; /* rangecheck */
+ return gs_no_char; /* rangecheck */
if (operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES))
- return pte->text.data.bytes[pte->index];
+ return pte->text.data.bytes[pte->index];
if (operation & TEXT_FROM_CHARS)
- return pte->text.data.chars[pte->index];
+ return pte->text.data.chars[pte->index];
return gs_no_char; /* rangecheck */
}
gs_glyph
@@ -575,7 +575,7 @@ gs_text_current_glyph(const gs_text_enum_t *pte)
{
return pte->returned.current_glyph;
}
-int
+int
gs_text_total_width(const gs_text_enum_t *pte, gs_point *pwidth)
{
*pwidth = pte->returned.total_width;
@@ -585,26 +585,26 @@ gs_text_total_width(const gs_text_enum_t *pte, gs_point *pwidth)
/* Assuming REPLACE_WIDTHS is set, return the width of the i'th character. */
int
gs_text_replaced_width(const gs_text_params_t *text, uint index,
- gs_point *pwidth)
+ gs_point *pwidth)
{
const float *x_widths = text->x_widths;
const float *y_widths = text->y_widths;
if (x_widths == y_widths) {
- if (x_widths) {
- index *= 2;
- if (index + 1 >= text->widths_size)
- return_error(gs_error_rangecheck);
- pwidth->x = x_widths[index];
- pwidth->y = x_widths[index + 1];
- }
- else
- pwidth->x = pwidth->y = 0;
+ if (x_widths) {
+ index *= 2;
+ if (index + 1 >= text->widths_size)
+ return_error(gs_error_rangecheck);
+ pwidth->x = x_widths[index];
+ pwidth->y = x_widths[index + 1];
+ }
+ else
+ pwidth->x = pwidth->y = 0;
} else {
- if (index >= text->widths_size)
- return_error(gs_error_rangecheck);
- pwidth->x = (x_widths ? x_widths[index] : 0.0);
- pwidth->y = (y_widths ? y_widths[index] : 0.0);
+ if (index >= text->widths_size)
+ return_error(gs_error_rangecheck);
+ pwidth->x = (x_widths ? x_widths[index] : 0.0);
+ pwidth->y = (y_widths ? y_widths[index] : 0.0);
}
return 0;
}
@@ -626,7 +626,7 @@ gs_text_current_width(const gs_text_enum_t * pte, gs_point *pwidth)
/* Set text metrics and optionally enable caching. */
int
gs_text_set_cache(gs_text_enum_t * pte, const double *values,
- gs_text_cache_control_t control)
+ gs_text_cache_control_t control)
{
return pte->procs->set_cache(pte, values, control);
}
@@ -689,29 +689,29 @@ int
gs_default_next_char_glyph(gs_text_enum_t *pte, gs_char *pchr, gs_glyph *pglyph)
{
if (pte->index >= pte->text.size)
- return 2;
+ return 2;
if (pte->text.operation & (TEXT_FROM_STRING | TEXT_FROM_BYTES)) {
- /* ordinary string */
- *pchr = pte->text.data.bytes[pte->index];
- if (pte->outer_CID != GS_NO_GLYPH)
- *pglyph = pte->outer_CID;
- else
- *pglyph = gs_no_glyph;
+ /* ordinary string */
+ *pchr = pte->text.data.bytes[pte->index];
+ if (pte->outer_CID != GS_NO_GLYPH)
+ *pglyph = pte->outer_CID;
+ else
+ *pglyph = gs_no_glyph;
} else if (pte->text.operation & TEXT_FROM_SINGLE_GLYPH) {
- /* glyphshow or glyphpath */
- *pchr = gs_no_char;
- *pglyph = pte->text.data.d_glyph;
+ /* glyphshow or glyphpath */
+ *pchr = gs_no_char;
+ *pglyph = pte->text.data.d_glyph;
} else if (pte->text.operation & TEXT_FROM_GLYPHS) {
- *pchr = gs_no_char;
- *pglyph = pte->text.data.glyphs[pte->index];
+ *pchr = gs_no_char;
+ *pglyph = pte->text.data.glyphs[pte->index];
} else if (pte->text.operation & TEXT_FROM_SINGLE_CHAR) {
- *pchr = pte->text.data.d_char;
- *pglyph = gs_no_glyph;
+ *pchr = pte->text.data.d_char;
+ *pglyph = gs_no_glyph;
} else if (pte->text.operation & TEXT_FROM_CHARS) {
- *pchr = pte->text.data.chars[pte->index];
- *pglyph = gs_no_glyph;
+ *pchr = pte->text.data.chars[pte->index];
+ *pglyph = gs_no_glyph;
} else
- return_error(gs_error_rangecheck); /* shouldn't happen */
+ return_error(gs_error_rangecheck); /* shouldn't happen */
pte->index++;
return 0;
}
@@ -719,7 +719,7 @@ gs_default_next_char_glyph(gs_text_enum_t *pte, gs_char *pchr, gs_glyph *pglyph)
/* Dummy (ineffective) BuildChar/BuildGlyph procedure */
int
gs_no_build_char(gs_show_enum *pte, gs_state *pgs, gs_font *pfont,
- gs_char chr, gs_glyph glyph)
+ gs_char chr, gs_glyph glyph)
{
return 1; /* failure, but not error */
}
diff --git a/gs/base/gstext.h b/gs/base/gstext.h
index 00b12e705..603c5f497 100644
--- a/gs/base/gstext.h
+++ b/gs/base/gstext.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,7 +51,7 @@
( ((params)->operation & TEXT_FROM_ANY_SINGLE) && ((params)->size != 1) )\
)
- /* Define the representation of the text itself. */
+ /* Define the representation of the text itself. */
#define TEXT_FROM_STRING 0x00001
#define TEXT_FROM_BYTES 0x00002
#define TEXT_FROM_CHARS 0x00004
@@ -63,13 +63,13 @@
#define TEXT_FROM_ANY /* only for testing and masking */\
(TEXT_FROM_STRING | TEXT_FROM_BYTES | TEXT_FROM_CHARS | TEXT_FROM_GLYPHS |\
TEXT_FROM_ANY_SINGLE)
- /* Define how to compute escapements. */
+ /* Define how to compute escapements. */
#define TEXT_ADD_TO_ALL_WIDTHS 0x00040
#define TEXT_ADD_TO_SPACE_WIDTH 0x00080
#define TEXT_ADD_ANY /* only for testing and masking */\
(TEXT_ADD_TO_ALL_WIDTHS | TEXT_ADD_TO_SPACE_WIDTH)
#define TEXT_REPLACE_WIDTHS 0x00100
- /* Define what result should be produced. */
+ /* Define what result should be produced. */
#define TEXT_DO_NONE 0x00200 /* stringwidth or cshow only */
#define TEXT_DO_DRAW 0x00400
#define TEXT_DO_CHARWIDTH 0x00800 /* rmoveto by width */
@@ -82,11 +82,11 @@
TEXT_DO_FALSE_CHARBOXPATH | TEXT_DO_TRUE_CHARBOXPATH)
#define TEXT_DO_ANY /* only for testing and masking */\
(TEXT_DO_NONE | TEXT_DO_DRAW | TEXT_DO_ANY_CHARPATH)
- /* Define whether the client intervenes between characters. */
+ /* Define whether the client intervenes between characters. */
#define TEXT_INTERVENE 0x10000
- /* Define whether to return the width. */
+ /* Define whether to return the width. */
#define TEXT_RETURN_WIDTH 0x20000
- /* PDF mode "3 Tr" */
+ /* PDF mode "3 Tr" */
#define TEXT_RENDER_MODE_3 0x40000
/*
@@ -98,20 +98,20 @@ typedef struct gs_text_params_s {
/* The client must set the following in all cases. */
uint operation; /* TEXT_xxx mask */
union sd_ {
- const byte *bytes; /* FROM_STRING, FROM_BYTES */
- const gs_char *chars; /* FROM_CHARS */
- const gs_glyph *glyphs; /* FROM_GLYPHS */
- gs_char d_char; /* FROM_SINGLE_CHAR */
- gs_glyph d_glyph; /* FROM_SINGLE_GLYPH */
+ const byte *bytes; /* FROM_STRING, FROM_BYTES */
+ const gs_char *chars; /* FROM_CHARS */
+ const gs_glyph *glyphs; /* FROM_GLYPHS */
+ gs_char d_char; /* FROM_SINGLE_CHAR */
+ gs_glyph d_glyph; /* FROM_SINGLE_GLYPH */
} data;
uint size; /* number of data elements, */
- /* must be 1 if FROM_SINGLE */
+ /* must be 1 if FROM_SINGLE */
/* The following are used only in the indicated cases. */
gs_point delta_all; /* ADD_TO_ALL_WIDTHS */
gs_point delta_space; /* ADD_TO_SPACE_WIDTH */
union s_ {
- gs_char s_char; /* ADD_TO_SPACE_WIDTH & !FROM_GLYPHS */
- gs_glyph s_glyph; /* ADD_TO_SPACE_WIDTH & FROM_GLYPHS */
+ gs_char s_char; /* ADD_TO_SPACE_WIDTH & !FROM_GLYPHS */
+ gs_glyph s_glyph; /* ADD_TO_SPACE_WIDTH & FROM_GLYPHS */
} space;
/*
* If x_widths == y_widths, widths are taken in pairs; note that in this
@@ -131,7 +131,7 @@ typedef struct gs_text_params_s {
/* Assuming REPLACE_WIDTHS is set, return the width of the i'th character. */
int gs_text_replaced_width(const gs_text_params_t *text, uint index,
- gs_point *pwidth);
+ gs_point *pwidth);
/*
* Define the abstract type for the structure that tracks the state of text
@@ -197,7 +197,7 @@ dev_proc_text_begin(gx_device_text_begin);
typedef struct gs_state_s gs_state;
#endif
int gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
- gs_memory_t * mem, gs_text_enum_t ** ppenum);
+ gs_memory_t * mem, gs_text_enum_t ** ppenum);
/*
* Update the device color to be used with text (because a kshow or
@@ -205,45 +205,43 @@ int gs_text_begin(gs_state * pgs, const gs_text_params_t * text,
*/
int gs_text_update_dev_color(gs_state * pgs, gs_text_enum_t * pte);
-
/* Begin the PostScript-equivalent text operators. */
int
gs_show_begin(gs_state *, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_ashow_begin(gs_state *, floatp, floatp, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_widthshow_begin(gs_state *, floatp, floatp, gs_char,
- const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ const byte *, uint,
+ gs_memory_t *, gs_text_enum_t **),
gs_awidthshow_begin(gs_state *, floatp, floatp, gs_char,
- floatp, floatp, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ floatp, floatp, const byte *, uint,
+ gs_memory_t *, gs_text_enum_t **),
gs_kshow_begin(gs_state *, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_xyshow_begin(gs_state *, const byte *, uint,
- const float *, const float *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ const float *, const float *, uint,
+ gs_memory_t *, gs_text_enum_t **),
gs_glyphshow_begin(gs_state *, gs_glyph,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_cshow_begin(gs_state *, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_stringwidth_begin(gs_state *, const byte *, uint,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_charpath_begin(gs_state *, const byte *, uint, bool,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_glyphpath_begin(gs_state *, gs_glyph, bool,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_glyphwidth_begin(gs_state *, gs_glyph,
- gs_memory_t *, gs_text_enum_t **),
+ gs_memory_t *, gs_text_enum_t **),
gs_charboxpath_begin(gs_state *, const byte *, uint, bool,
- gs_memory_t *, gs_text_enum_t **);
+ gs_memory_t *, gs_text_enum_t **);
/* Compute the number of characters in a text. */
int gs_text_size(gs_state * pgs, gs_text_params_t *text, gs_memory_t * mem);
/* Retrieve text params from enumerator. */
gs_text_params_t *gs_get_text_params(gs_text_enum_t *pte);
-
/*
* Restart text processing with new parameters.
*/
@@ -260,27 +258,27 @@ int gs_text_resync(gs_text_enum_t *pte, const gs_text_enum_t *pfrom);
* negative (error) value.
*/
- /*
- * The client must render a character: obtain the code from
- * gs_text_current_char/glyph, do whatever is necessary, and then
- * call gs_text_process again.
- */
+ /*
+ * The client must render a character: obtain the code from
+ * gs_text_current_char/glyph, do whatever is necessary, and then
+ * call gs_text_process again.
+ */
#define TEXT_PROCESS_RENDER 1
- /*
- * The client has asked to intervene between characters.
- * Obtain the current and next codes from gs_text_current_char/glyph
- * and gs_text_next_char, do whatever is necessary, and then
- * call gs_text_process again.
- */
+ /*
+ * The client has asked to intervene between characters.
+ * Obtain the current and next codes from gs_text_current_char/glyph
+ * and gs_text_next_char, do whatever is necessary, and then
+ * call gs_text_process again.
+ */
#define TEXT_PROCESS_INTERVENE 2
- /*
- * The device has asked to execute CDevProc.
- * Obtain the current codes from gs_text_current_char/glyph,
- * do whatever is necessary and put CDevProc results to pte->cdevproc_result,
- * and then call gs_text_process again with pte->cdevproc_result_valid=true.
- */
+ /*
+ * The device has asked to execute CDevProc.
+ * Obtain the current codes from gs_text_current_char/glyph,
+ * do whatever is necessary and put CDevProc results to pte->cdevproc_result,
+ * and then call gs_text_process again with pte->cdevproc_result_valid=true.
+ */
#define TEXT_PROCESS_CDEVPROC 3
/* Process text after 'begin'. */
@@ -316,7 +314,7 @@ typedef enum {
} gs_text_cache_control_t;
int
gs_text_set_cache(gs_text_enum_t *pte, const double *values,
- gs_text_cache_control_t control),
+ gs_text_cache_control_t control),
gs_text_setcharwidth(gs_text_enum_t *pte, const double wxy[2]),
gs_text_setcachedevice(gs_text_enum_t *pte, const double wbox[6]),
gs_text_setcachedevice2(gs_text_enum_t *pte, const double wbox2[10]);
diff --git a/gs/base/gstparam.h b/gs/base/gstparam.h
index 202491c1e..128a0131d 100644
--- a/gs/base/gstparam.h
+++ b/gs/base/gstparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -91,7 +91,7 @@ typedef struct gs_transparency_group_params_s {
int group_color_numcomps;
gs_transparency_color_t group_color;
int64_t icc_hashcode; /* Needed when we are doing clist reading */
- cmm_profile_t *iccprofile; /* The profile */
+ cmm_profile_t *iccprofile; /* The profile */
} gs_transparency_group_params_t;
/* Define the parameter structure for a transparency mask. */
@@ -115,7 +115,7 @@ typedef struct gs_transparency_mask_params_s {
gs_function_t *TransferFunction_data;
bool replacing;
int64_t icc_hashcode; /* Needed when we are doing clist reading */
- cmm_profile_t *iccprofile; /* The profile */
+ cmm_profile_t *iccprofile; /* The profile */
} gs_transparency_mask_params_t;
#define MASK_TRANSFER_FUNCTION_SIZE 256
@@ -134,7 +134,7 @@ typedef struct gx_transparency_mask_params_s {
uint mask_id;
byte transfer_fn[MASK_TRANSFER_FUNCTION_SIZE];
int64_t icc_hashcode; /* Needed when we are doing clist reading */
- cmm_profile_t *iccprofile; /* The profile */
+ cmm_profile_t *iccprofile; /* The profile */
} gx_transparency_mask_params_t;
/*
@@ -148,14 +148,14 @@ typedef struct gx_transparency_mask_params_s {
sizeof(((gs_pdf14trans_params_t *)0)->subtype) + \
sizeof(((gs_pdf14trans_params_t *)0)->group_color_numcomps) + \
4 /* group color, replacing, function_is_identity, Background_components */ + \
- sizeof(((gs_pdf14trans_params_t *)0)->bbox) + \
- sizeof(((gs_pdf14trans_params_t *)0)->mask_id) + \
- sizeof(((gs_pdf14trans_params_t *)0)->Background) + \
+ sizeof(((gs_pdf14trans_params_t *)0)->bbox) + \
+ sizeof(((gs_pdf14trans_params_t *)0)->mask_id) + \
+ sizeof(((gs_pdf14trans_params_t *)0)->Background) + \
sizeof(float)*4 + /* If cmyk background */ \
- sizeof(((gs_pdf14trans_params_t *)0)->GrayBackground) + \
+ sizeof(((gs_pdf14trans_params_t *)0)->GrayBackground) + \
sizeof(int64_t)) /* ICC band information */
#define MAX_CLIST_TRANSPARENCY_COMPOSITOR_SIZE (MAX_CLIST_TRANSPARENCY_BUFFER_SIZE + \
- sizeof(((gs_pdf14trans_params_t *)0)->transfer_fn))
+ sizeof(((gs_pdf14trans_params_t *)0)->transfer_fn))
#define MAX_CLIST_COMPOSITOR_SIZE MAX_CLIST_TRANSPARENCY_COMPOSITOR_SIZE
/* Select the opacity or shape parameters. */
diff --git a/gs/base/gstrans.c b/gs/base/gstrans.c
index bd12b4f1c..a2334024b 100644
--- a/gs/base/gstrans.c
+++ b/gs/base/gstrans.c
@@ -433,7 +433,6 @@ gx_end_transparency_group(gs_imager_state * pis, gx_device * pdev)
return 0;
}
-
/* Commands for handling q softmask Q in graphic states */
int
diff --git a/gs/base/gstrans.h b/gs/base/gstrans.h
index 441de2a35..85e83bc33 100644
--- a/gs/base/gstrans.h
+++ b/gs/base/gstrans.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -89,10 +89,10 @@ struct gs_pdf14trans_params_s {
int Background_components;
bool function_is_identity;
float Background[GS_CLIENT_COLOR_MAX_COMPONENTS];
- float GrayBackground; /* This is used to determine if the
+ float GrayBackground; /* This is used to determine if the
softmask's bbox needs to be adjusted
to the parent groups bbox. Since
- the soft mask can affect areas
+ the soft mask can affect areas
outside its own groups bounding
box in such a case */
gs_function_t *transfer_function;
@@ -105,8 +105,8 @@ struct gs_pdf14trans_params_s {
bool mask_is_image;
gs_matrix ctm;
bool replacing;
- bool overprint;
- bool overprint_mode;
+ bool overprint;
+ bool overprint_mode;
bool idle; /* For clist reader.*/
uint mask_id; /* For clist reader.*/
int group_color_numcomps;
@@ -133,7 +133,6 @@ typedef struct gs_pdf14trans_s {
gs_pdf14trans_params_t params;
} gs_pdf14trans_t;
-
/* Access transparency-related graphics state elements. */
int gs_setblendmode(gs_state *, gs_blend_mode_t);
gs_blend_mode_t gs_currentblendmode(const gs_state *);
@@ -165,20 +164,20 @@ void gs_trans_group_params_init(gs_transparency_group_params_t *ptgp);
int gs_update_trans_marking_params(gs_state * pgs);
int gs_begin_transparency_group(gs_state * pgs,
- const gs_transparency_group_params_t *ptgp,
- const gs_rect *pbbox);
+ const gs_transparency_group_params_t *ptgp,
+ const gs_rect *pbbox);
int gs_end_transparency_group(gs_state *pgs);
void gs_trans_mask_params_init(gs_transparency_mask_params_t *ptmp,
- gs_transparency_mask_subtype_t subtype);
+ gs_transparency_mask_subtype_t subtype);
int gs_begin_transparency_mask(gs_state *pgs,
- const gs_transparency_mask_params_t *ptmp,
- const gs_rect *pbbox, bool mask_is_image);
+ const gs_transparency_mask_params_t *ptmp,
+ const gs_rect *pbbox, bool mask_is_image);
int gs_end_transparency_mask(gs_state *pgs,
- gs_transparency_channel_selector_t csel);
+ gs_transparency_channel_selector_t csel);
int gs_discard_transparency_layer(gs_state *pgs);
@@ -186,19 +185,19 @@ int gs_discard_transparency_layer(gs_state *pgs);
* Imager level routines for the PDF 1.4 transparency operations.
*/
int gx_begin_transparency_group(gs_imager_state * pis, gx_device * pdev,
- const gs_pdf14trans_params_t * pparams);
+ const gs_pdf14trans_params_t * pparams);
int gx_end_transparency_group(gs_imager_state * pis, gx_device * pdev);
int gx_begin_transparency_mask(gs_imager_state * pis, gx_device * pdev,
- const gs_pdf14trans_params_t * pparams);
+ const gs_pdf14trans_params_t * pparams);
int gx_end_transparency_mask(gs_imager_state * pis, gx_device * pdev,
- const gs_pdf14trans_params_t * pparams);
+ const gs_pdf14trans_params_t * pparams);
int gx_discard_transparency_layer(gs_imager_state *pis);
-/* These are used for watching for q Smask Q events. We need to
+/* These are used for watching for q Smask Q events. We need to
send special compositor commands to keep the bands in sync
with the current softmask during clist rendering. Like the
other transparency operations the gs functions occur on the
@@ -213,7 +212,6 @@ int gx_push_transparency_state(gs_imager_state * pis, gx_device * pdev);
int gx_pop_transparency_state(gs_imager_state * pis, gx_device * pdev);
-
/*
* Verify that a compositor data structure is for the PDF 1.4 compositor.
*/
@@ -238,9 +236,9 @@ int gs_is_pdf14trans_compositor(const gs_composite_t * pct);
#define BITS_PER_CHANNEL 8
/* The estimated size of an individual PDF 1.4 buffer row (in bits) */
#define ESTIMATED_PDF14_ROW_SIZE(width) ((width) * BITS_PER_CHANNEL\
- * (NUM_ALPHA_CHANNELS + NUM_COLOR_CHANNELS))
+ * (NUM_ALPHA_CHANNELS + NUM_COLOR_CHANNELS))
/* The estimated size of one row in all PDF 1.4 buffers (in bits) */
#define ESTIMATED_PDF14_ROW_SPACE(width) \
- (NUM_PDF14_BUFFERS * ESTIMATED_PDF14_ROW_SIZE(width))
+ (NUM_PDF14_BUFFERS * ESTIMATED_PDF14_ROW_SIZE(width))
#endif /* gstrans_INCLUDED */
diff --git a/gs/base/gstrap.c b/gs/base/gstrap.c
index 94faba4a9..393e54b18 100644
--- a/gs/base/gstrap.c
+++ b/gs/base/gstrap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,21 +32,21 @@ check_positive(float *pval)
}
static int
trap_put_float_param(gs_param_list * plist, gs_param_name param_name,
- float *pval, bool(*check) (float *pval), int ecode)
+ float *pval, bool(*check) (float *pval), int ecode)
{
int code;
switch (code = param_read_float(plist, param_name, pval)) {
- case 0:
- if ((*check) (pval))
- return 0;
- code = gs_error_rangecheck;
- default:
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- break;
- case 1:
- break;
+ case 0:
+ if ((*check) (pval))
+ return 0;
+ code = gs_error_rangecheck;
+ default:
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ break;
+ case 1:
+ break;
}
return ecode;
}
@@ -58,47 +58,47 @@ gs_settrapparams(gs_trap_params_t * pparams, gs_param_list * plist)
gs_trap_params_t params;
int ecode = 0;
static const char *const trap_placement_names[] = {
- gs_trap_placement_names, 0
+ gs_trap_placement_names, 0
};
params = *pparams;
ecode = trap_put_float_param(plist, "BlackColorLimit",
- &params.BlackColorLimit, check_unit, ecode);
+ &params.BlackColorLimit, check_unit, ecode);
ecode = trap_put_float_param(plist, "BlackDensityLimit",
- &params.BlackDensityLimit,
- check_positive, ecode);
+ &params.BlackDensityLimit,
+ check_positive, ecode);
ecode = trap_put_float_param(plist, "BlackWidth",
- &params.BlackWidth, check_positive, ecode);
+ &params.BlackWidth, check_positive, ecode);
ecode = param_put_bool(plist, "Enabled",
- &params.Enabled, ecode);
+ &params.Enabled, ecode);
ecode = param_put_bool(plist, "ImageInternalTrapping",
- &params.ImageInternalTrapping, ecode);
+ &params.ImageInternalTrapping, ecode);
ecode = param_put_bool(plist, "ImagemaskTrapping",
- &params.ImagemaskTrapping, ecode);
+ &params.ImagemaskTrapping, ecode);
ecode = param_put_int(plist, "ImageResolution",
- &params.ImageResolution, ecode);
+ &params.ImageResolution, ecode);
if (params.ImageResolution <= 0)
- param_signal_error(plist, "ImageResolution",
- ecode = gs_error_rangecheck);
+ param_signal_error(plist, "ImageResolution",
+ ecode = gs_error_rangecheck);
ecode = param_put_bool(plist, "ImageToObjectTrapping",
- &params.ImageToObjectTrapping, ecode);
+ &params.ImageToObjectTrapping, ecode);
{
- int placement = params.ImageTrapPlacement;
+ int placement = params.ImageTrapPlacement;
- ecode = param_put_enum(plist, "ImageTrapPlacement",
- &placement, trap_placement_names, ecode);
- params.ImageTrapPlacement = placement;
+ ecode = param_put_enum(plist, "ImageTrapPlacement",
+ &placement, trap_placement_names, ecode);
+ params.ImageTrapPlacement = placement;
}
ecode = trap_put_float_param(plist, "SlidingTrapLimit",
- &params.SlidingTrapLimit, check_unit, ecode);
+ &params.SlidingTrapLimit, check_unit, ecode);
ecode = trap_put_float_param(plist, "StepLimit",
- &params.StepLimit, check_unit, ecode);
+ &params.StepLimit, check_unit, ecode);
ecode = trap_put_float_param(plist, "TrapColorScaling",
- &params.TrapColorScaling, check_unit, ecode);
+ &params.TrapColorScaling, check_unit, ecode);
ecode = trap_put_float_param(plist, "TrapWidth",
- &params.TrapWidth, check_positive, ecode);
+ &params.TrapWidth, check_positive, ecode);
if (ecode < 0)
- return ecode;
+ return ecode;
*pparams = params;
return 0;
}
diff --git a/gs/base/gstrap.h b/gs/base/gstrap.h
index 8d979b3af..7cc7d781a 100644
--- a/gs/base/gstrap.h
+++ b/gs/base/gstrap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gstype1.c b/gs/base/gstype1.c
index 3617b0f8a..52082c2fb 100644
--- a/gs/base/gstype1.c
+++ b/gs/base/gstype1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,12 +41,12 @@
/* ------ Interpreter subroutines ------ */
/*
- * According to "Adobe Type 1 Font Format",
- * Section 6.2 "CharString Number Encoding", in particular the Note at
+ * According to "Adobe Type 1 Font Format",
+ * Section 6.2 "CharString Number Encoding", in particular the Note at
* the end of the section:
- * "Numbers with absolute values larger than 32,000 must be followed by a
+ * "Numbers with absolute values larger than 32,000 must be followed by a
* div operator such that the result of the div is less than 32,000."
- *
+ *
* This function looks ahead for the div operator
* and applies it in the compile time, so that the big numbers
* are not placed onto the stack.
@@ -61,31 +61,31 @@ int gs_type1_check_float(crypt_state *state, bool encrypted, const byte **ci, cs
c0 = *cip++;
charstring_next(c0, *state, c, encrypted);
if (c < c_num1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (c < c_pos2_0)
- decode_num1(denom, c);
+ decode_num1(denom, c);
else if (c < cx_num4)
- decode_num2(denom, c, cip, *state, encrypted);
+ decode_num2(denom, c, cip, *state, encrypted);
else if (c == cx_num4)
- decode_num4(denom, cip, *state, encrypted);
+ decode_num4(denom, cip, *state, encrypted);
else
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
c0 = *cip++;
charstring_next(c0, *state, c, encrypted);
if (c != cx_escape)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
c0 = *cip++;
charstring_next(c0, *state, c, encrypted);
if (c != ce1_div)
- return_error(gs_error_rangecheck);
- /* Rather "Adobe Type 1 Font Format" restricts the div result with 32,000,
+ return_error(gs_error_rangecheck);
+ /* Rather "Adobe Type 1 Font Format" restricts the div result with 32,000,
We don't want to check it here as a compatibility to the old code,
and because Type 2 doesn't set this limitation.
Instead that we're checking here just for 'fixed' overflow,
which is a weaker limit.
*/
if (any_abs(lw / denom) > max_int_in_fixed) {
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
*csp = float2fixed((double)lw / denom);
*ci = cip;
@@ -102,7 +102,7 @@ int gs_type1_check_float(crypt_state *state, bool encrypted, const byte **ci, cs
*/
int
gs_type1_interpret(gs_type1_state * pcis, const gs_glyph_data_t *pgd,
- int *pindex)
+ int *pindex)
{
gs_font_type1 *pfont = pcis->pfont;
gs_type1_data *pdata = &pfont->data;
@@ -132,438 +132,438 @@ gs_type1_interpret(gs_type1_state * pcis, const gs_glyph_data_t *pgd,
fixed ftx = pcis->origin.x, fty = pcis->origin.y;
switch (pcis->init_done) {
- case -1:
- t1_hinter__init(h, pcis->path);
- break;
- case 0:
- gs_type1_finish_init(pcis); /* sets origin */
- ftx = pcis->origin.x, fty = pcis->origin.y;
+ case -1:
+ t1_hinter__init(h, pcis->path);
+ break;
+ case 0:
+ gs_type1_finish_init(pcis); /* sets origin */
+ ftx = pcis->origin.x, fty = pcis->origin.y;
code = t1_hinter__set_mapping(h, &pcis->pis->ctm,
- &pfont->FontMatrix, &pfont->base->FontMatrix,
- pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
- pcis->scale.x.log2_unit - pcis->log2_subpixels.x,
- pcis->scale.y.log2_unit - pcis->log2_subpixels.y,
- pcis->origin.x, pcis->origin.y,
- gs_currentaligntopixels(pfont->dir));
- if (code < 0)
- return code;
- code = t1_hinter__set_font_data(h, 1, pdata, pcis->no_grid_fitting,
- pcis->pfont->is_resource);
- if (code < 0)
- return code;
- break;
- default /*case 1 */ :
- break;
+ &pfont->FontMatrix, &pfont->base->FontMatrix,
+ pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
+ pcis->scale.x.log2_unit - pcis->log2_subpixels.x,
+ pcis->scale.y.log2_unit - pcis->log2_subpixels.y,
+ pcis->origin.x, pcis->origin.y,
+ gs_currentaligntopixels(pfont->dir));
+ if (code < 0)
+ return code;
+ code = t1_hinter__set_font_data(h, 1, pdata, pcis->no_grid_fitting,
+ pcis->pfont->is_resource);
+ if (code < 0)
+ return code;
+ break;
+ default /*case 1 */ :
+ break;
}
INIT_CSTACK(cstack, csp, pcis);
if (pgd == 0)
- goto cont;
+ goto cont;
ipsp->cs_data = *pgd;
cip = pgd->bits.data;
if (cip == 0)
- return (gs_note_error(gs_error_invalidfont));
+ return (gs_note_error(gs_error_invalidfont));
call:state = crypt_charstring_seed;
if (encrypted) {
- int skip = pdata->lenIV;
+ int skip = pdata->lenIV;
- /* Skip initial random bytes */
- for (; skip > 0; ++cip, --skip)
- decrypt_skip_next(*cip, state);
+ /* Skip initial random bytes */
+ for (; skip > 0; ++cip, --skip)
+ decrypt_skip_next(*cip, state);
}
goto top;
cont:if (ipsp < pcis->ipstack || ipsp->ip == 0)
- return (gs_note_error(gs_error_invalidfont));
+ return (gs_note_error(gs_error_invalidfont));
cip = ipsp->ip;
state = ipsp->dstate;
top:for (;;) {
- uint c0 = *cip++;
+ uint c0 = *cip++;
- charstring_next(c0, state, c, encrypted);
- if (c >= c_num1) {
- /* This is a number, decode it and push it on the stack. */
+ charstring_next(c0, state, c, encrypted);
+ if (c >= c_num1) {
+ /* This is a number, decode it and push it on the stack. */
- if (c < c_pos2_0) { /* 1-byte number */
- decode_push_num1(csp, cstack, c);
- } else if (c < cx_num4) { /* 2-byte number */
- decode_push_num2(csp, cstack, c, cip, state, encrypted);
- } else if (c == cx_num4) { /* 4-byte number */
- long lw;
+ if (c < c_pos2_0) { /* 1-byte number */
+ decode_push_num1(csp, cstack, c);
+ } else if (c < cx_num4) { /* 2-byte number */
+ decode_push_num2(csp, cstack, c, cip, state, encrypted);
+ } else if (c == cx_num4) { /* 4-byte number */
+ long lw;
- decode_num4(lw, cip, state, encrypted);
- CS_CHECK_PUSH(csp, cstack);
- *++csp = int2fixed(lw);
- if (lw != fixed2long(*csp)) {
- /*
- * The integer was too large to handle in fixed point.
- * Handle this case specially.
- */
- code = gs_type1_check_float(&state, encrypted, &cip, csp, lw);
- if (code < 0)
- return code;
- }
- } else /* not possible */
- return_error(gs_error_invalidfont);
- pushed:if_debug3('1', "[1]%d: (%d) %f\n",
- (int)(csp - cstack), c, fixed2float(*csp));
- continue;
- }
+ decode_num4(lw, cip, state, encrypted);
+ CS_CHECK_PUSH(csp, cstack);
+ *++csp = int2fixed(lw);
+ if (lw != fixed2long(*csp)) {
+ /*
+ * The integer was too large to handle in fixed point.
+ * Handle this case specially.
+ */
+ code = gs_type1_check_float(&state, encrypted, &cip, csp, lw);
+ if (code < 0)
+ return code;
+ }
+ } else /* not possible */
+ return_error(gs_error_invalidfont);
+ pushed:if_debug3('1', "[1]%d: (%d) %f\n",
+ (int)(csp - cstack), c, fixed2float(*csp));
+ continue;
+ }
#ifdef DEBUG
- if (gs_debug['1']) {
- static const char *const c1names[] =
- {char1_command_names};
+ if (gs_debug['1']) {
+ static const char *const c1names[] =
+ {char1_command_names};
- if (c1names[c] == 0)
- dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
- else
- dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
- c1names[c]);
- }
+ if (c1names[c] == 0)
+ dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
+ else
+ dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
+ c1names[c]);
+ }
#endif
- switch ((char_command) c) {
+ switch ((char_command) c) {
#define cnext clear; goto top
#define inext goto top
- /* Commands with identical functions in Type 1 and Type 2, */
- /* except for 'escape'. */
+ /* Commands with identical functions in Type 1 and Type 2, */
+ /* except for 'escape'. */
- case c_undef0:
- case c_undef2:
- case c_undef17:
- return_error(gs_error_invalidfont);
- case c_callsubr:
- c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
- code = pdata->procs.subr_data
- (pfont, c, false, &ipsp[1].cs_data);
- if (code < 0)
- return_error(code);
- --csp;
- ipsp->ip = cip, ipsp->dstate = state;
- ++ipsp;
- cip = ipsp->cs_data.bits.data;
- goto call;
- case c_return:
- gs_glyph_data_free(&ipsp->cs_data, "gs_type1_interpret");
- --ipsp;
- goto cont;
- case c_undoc15:
- /* See gstype1.h for information on this opcode. */
- cnext;
+ case c_undef0:
+ case c_undef2:
+ case c_undef17:
+ return_error(gs_error_invalidfont);
+ case c_callsubr:
+ c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
+ code = pdata->procs.subr_data
+ (pfont, c, false, &ipsp[1].cs_data);
+ if (code < 0)
+ return_error(code);
+ --csp;
+ ipsp->ip = cip, ipsp->dstate = state;
+ ++ipsp;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ case c_return:
+ gs_glyph_data_free(&ipsp->cs_data, "gs_type1_interpret");
+ --ipsp;
+ goto cont;
+ case c_undoc15:
+ /* See gstype1.h for information on this opcode. */
+ cnext;
- /* Commands with similar but not identical functions */
- /* in Type 1 and Type 2 charstrings. */
+ /* Commands with similar but not identical functions */
+ /* in Type 1 and Type 2 charstrings. */
- case cx_hstem:
+ case cx_hstem:
code = t1_hinter__hstem(h, cs0, cs1);
- if (code < 0)
- return code;
- cnext;
- case cx_vstem:
+ if (code < 0)
+ return code;
+ cnext;
+ case cx_vstem:
code = t1_hinter__vstem(h, cs0, cs1);
- if (code < 0)
- return code;
- cnext;
- case cx_vmoveto:
- cs1 = cs0;
- cs0 = 0;
- move: /* cs0 = dx, cs1 = dy for hint checking. */
+ if (code < 0)
+ return code;
+ cnext;
+ case cx_vmoveto:
+ cs1 = cs0;
+ cs0 = 0;
+ move: /* cs0 = dx, cs1 = dy for hint checking. */
code = t1_hinter__rmoveto(h, cs0, cs1);
- goto cc;
- case cx_rlineto:
- line: /* cs0 = dx, cs1 = dy for hint checking. */
+ goto cc;
+ case cx_rlineto:
+ line: /* cs0 = dx, cs1 = dy for hint checking. */
code = t1_hinter__rlineto(h, cs0, cs1);
- cc:if (code < 0)
- return code;
- cnext;
- case cx_hlineto:
- cs1 = 0;
- goto line;
- case cx_vlineto:
- cs1 = cs0;
- cs0 = 0;
- goto line;
- case cx_rrcurveto:
+ cc:if (code < 0)
+ return code;
+ cnext;
+ case cx_hlineto:
+ cs1 = 0;
+ goto line;
+ case cx_vlineto:
+ cs1 = cs0;
+ cs0 = 0;
+ goto line;
+ case cx_rrcurveto:
code = t1_hinter__rcurveto(h, cs0, cs1, cs2, cs3, cs4, cs5);
- goto cc;
- case cx_endchar:
+ goto cc;
+ case cx_endchar:
if (pcis->seac_accent < 0) {
- if(!pcis->sb_set && !pcis->width_set) {
- /* No sbw/hsbw op, error condition but Adobe interpreters ignore it.
- Rewind the data pointer to the beginning of the glyph, re-initialise
- the hinter, execute a '0' sbw op, and then carry on as if we had
- actually received one. */
- cip = pgd->bits.data;
- t1_hinter__init(h, pcis->path);
- code = t1_hinter__sbw(h, fixed_0, fixed_0, fixed_0, fixed_0);
- if (code < 0)
- return code;
- gs_type1_sbw(pcis, fixed_0, fixed_0, fixed_0, fixed_0);
- goto rsbw;
- }
+ if(!pcis->sb_set && !pcis->width_set) {
+ /* No sbw/hsbw op, error condition but Adobe interpreters ignore it.
+ Rewind the data pointer to the beginning of the glyph, re-initialise
+ the hinter, execute a '0' sbw op, and then carry on as if we had
+ actually received one. */
+ cip = pgd->bits.data;
+ t1_hinter__init(h, pcis->path);
+ code = t1_hinter__sbw(h, fixed_0, fixed_0, fixed_0, fixed_0);
+ if (code < 0)
+ return code;
+ gs_type1_sbw(pcis, fixed_0, fixed_0, fixed_0, fixed_0);
+ goto rsbw;
+ }
code = t1_hinter__endglyph(h);
- if (code < 0)
- return code;
- code = gx_setcurrentpoint_from_path(pcis->pis, pcis->path);
- if (code < 0)
- return code;
- } else {
- code = t1_hinter__end_subglyph(h);
- if (code < 0)
- return code;
- pcis->seac_flag = true;
- }
- code = gs_type1_endchar(pcis);
- if (code == 1) {
- /* do accent of seac */
- ipsp = &pcis->ipstack[pcis->ips_count - 1];
- cip = ipsp->cs_data.bits.data;
- goto call;
- }
- return code;
- case cx_rmoveto:
- goto move;
- case cx_hmoveto:
- cs1 = 0;
- goto move;
- case cx_vhcurveto:
+ if (code < 0)
+ return code;
+ code = gx_setcurrentpoint_from_path(pcis->pis, pcis->path);
+ if (code < 0)
+ return code;
+ } else {
+ code = t1_hinter__end_subglyph(h);
+ if (code < 0)
+ return code;
+ pcis->seac_flag = true;
+ }
+ code = gs_type1_endchar(pcis);
+ if (code == 1) {
+ /* do accent of seac */
+ ipsp = &pcis->ipstack[pcis->ips_count - 1];
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ }
+ return code;
+ case cx_rmoveto:
+ goto move;
+ case cx_hmoveto:
+ cs1 = 0;
+ goto move;
+ case cx_vhcurveto:
code = t1_hinter__rcurveto(h, 0, cs0, cs1, cs2, cs3, 0);
- goto cc;
- case cx_hvcurveto:
+ goto cc;
+ case cx_hvcurveto:
code = t1_hinter__rcurveto(h, cs0, 0, cs1, cs2, 0, cs3);
- goto cc;
+ goto cc;
- /* Commands only recognized in Type 1 charstrings, */
- /* plus 'escape'. */
+ /* Commands only recognized in Type 1 charstrings, */
+ /* plus 'escape'. */
- case c1_closepath:
+ case c1_closepath:
code = t1_hinter__closepath(h);
- goto cc;
- case c1_hsbw:
+ goto cc;
+ case c1_hsbw:
if (!pcis->seac_flag) {
- fixed sbx = cs0, sby = fixed_0, wx = cs1, wy = fixed_0;
+ fixed sbx = cs0, sby = fixed_0, wx = cs1, wy = fixed_0;
- if (pcis->seac_accent < 0) {
- if (pcis->sb_set) {
- pcis->origin_offset.x = pcis->lsb.x - sbx;
- pcis->origin_offset.y = pcis->lsb.y - sby;
- sbx = pcis->lsb.x;
- sby = pcis->lsb.y;
- }
- if (pcis->width_set) {
- wx = pcis->width.x;
- wy = pcis->width.y;
- }
- } else
- pcis->base_lsb = sbx;
- code = t1_hinter__sbw(h, sbx, sby, wx, wy);
- } else {
- fixed accent_lsb = cs0;
- fixed overall_x_offset = pcis->compound_lsb.x + pcis->adxy.x - pcis->asb + accent_lsb - pcis->base_lsb;
+ if (pcis->seac_accent < 0) {
+ if (pcis->sb_set) {
+ pcis->origin_offset.x = pcis->lsb.x - sbx;
+ pcis->origin_offset.y = pcis->lsb.y - sby;
+ sbx = pcis->lsb.x;
+ sby = pcis->lsb.y;
+ }
+ if (pcis->width_set) {
+ wx = pcis->width.x;
+ wy = pcis->width.y;
+ }
+ } else
+ pcis->base_lsb = sbx;
+ code = t1_hinter__sbw(h, sbx, sby, wx, wy);
+ } else {
+ fixed accent_lsb = cs0;
+ fixed overall_x_offset = pcis->compound_lsb.x + pcis->adxy.x - pcis->asb + accent_lsb - pcis->base_lsb;
code = t1_hinter__sbw_seac(h, overall_x_offset, pcis->adxy.y);
- }
- if (code < 0)
- return code;
- gs_type1_sbw(pcis, cs0, fixed_0, cs1, fixed_0);
- cs1 = fixed_0;
+ }
+ if (code < 0)
+ return code;
+ gs_type1_sbw(pcis, cs0, fixed_0, cs1, fixed_0);
+ cs1 = fixed_0;
rsbw: /* Give the caller the opportunity to intervene. */
- pcis->os_count = 0; /* clear */
- ipsp->ip = cip, ipsp->dstate = state;
- pcis->ips_count = ipsp - &pcis->ipstack[0] + 1;
- /* If we aren't in a seac, do nothing else now; */
- /* finish_init will take care of the rest. */
- if (pcis->init_done < 0) {
- /* Finish init when we return. */
- pcis->init_done = 0;
- }
- return type1_result_sbw;
- case cx_escape:
- charstring_next(*cip, state, c, encrypted);
- ++cip;
+ pcis->os_count = 0; /* clear */
+ ipsp->ip = cip, ipsp->dstate = state;
+ pcis->ips_count = ipsp - &pcis->ipstack[0] + 1;
+ /* If we aren't in a seac, do nothing else now; */
+ /* finish_init will take care of the rest. */
+ if (pcis->init_done < 0) {
+ /* Finish init when we return. */
+ pcis->init_done = 0;
+ }
+ return type1_result_sbw;
+ case cx_escape:
+ charstring_next(*cip, state, c, encrypted);
+ ++cip;
#ifdef DEBUG
- if (gs_debug['1'] && c < char1_extended_command_count) {
- static const char *const ce1names[] =
- {char1_extended_command_names};
+ if (gs_debug['1'] && c < char1_extended_command_count) {
+ static const char *const ce1names[] =
+ {char1_extended_command_names};
- if (ce1names[c] == 0)
- dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
- else
- dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
- ce1names[c]);
- }
+ if (ce1names[c] == 0)
+ dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
+ else
+ dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
+ ce1names[c]);
+ }
#endif
- switch ((char1_extended_command) c) {
- case ce1_dotsection:
+ switch ((char1_extended_command) c) {
+ case ce1_dotsection:
code = t1_hinter__dotsection(h);
- if (code < 0)
- return code;
- cnext;
- case ce1_vstem3:
+ if (code < 0)
+ return code;
+ cnext;
+ case ce1_vstem3:
code = t1_hinter__vstem3(h, cs0, cs1, cs2, cs3, cs4, cs5);
- if (code < 0)
- return code;
- cnext;
- case ce1_hstem3:
+ if (code < 0)
+ return code;
+ cnext;
+ case ce1_hstem3:
code = t1_hinter__hstem3(h, cs0, cs1, cs2, cs3, cs4, cs5);
- if (code < 0)
- return code;
- cnext;
- case ce1_seac:
- code = gs_type1_seac(pcis, cstack + 1, cstack[0],
- ipsp);
- if (code != 0) {
- *pindex = ics3;
- return code;
- }
- clear;
- cip = ipsp->cs_data.bits.data;
- goto call;
- case ce1_sbw:
+ if (code < 0)
+ return code;
+ cnext;
+ case ce1_seac:
+ code = gs_type1_seac(pcis, cstack + 1, cstack[0],
+ ipsp);
+ if (code != 0) {
+ *pindex = ics3;
+ return code;
+ }
+ clear;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ case ce1_sbw:
if (!pcis->seac_flag)
code = t1_hinter__sbw(h, cs0, cs1, cs2, cs3);
- else
+ else
code = t1_hinter__sbw_seac(h, cs0 + pcis->adxy.x , cs1 + pcis->adxy.y);
- if (code < 0)
- return code;
- gs_type1_sbw(pcis, cs0, cs1, cs2, cs3);
- goto rsbw;
- case ce1_div:
- csp[-1] = float2fixed((double)csp[-1] / (double)*csp);
- --csp;
- goto pushed;
- case ce1_undoc15:
- /* See gstype1.h for information on this opcode. */
- cnext;
- case ce1_callothersubr:
- {
- int num_results;
- /* We must remember to pop both the othersubr # */
- /* and the argument count off the stack. */
- switch (*pindex = fixed2int_var(*csp)) {
- case 0:
- {
- fixed fheight = csp[-4];
- /* Assume the next two opcodes */
- /* are `pop' `pop'. Unfortunately, some */
- /* Monotype fonts put these in a Subr, */
- /* so we can't just look ahead in the */
- /* opcode stream. */
- pcis->ignore_pops = 2;
- csp[-4] = csp[-3] - pcis->asb_diff;
- csp[-3] = csp[-2];
- csp -= 3;
- code = t1_hinter__flex_end(h, fheight);
- }
- if (code < 0)
- return code;
- pcis->flex_count = flex_max; /* not inside flex */
- inext;
- case 1:
- code = t1_hinter__flex_beg(h);
- if (code < 0)
- return code;
- pcis->flex_count = 1;
- csp -= 2;
- inext;
- case 2:
- if (pcis->flex_count >= flex_max)
- return_error(gs_error_invalidfont);
- code = t1_hinter__flex_point(h);
- if (code < 0)
- return code;
- csp -= 2;
- inext;
- case 3:
- /* Assume the next opcode is a `pop'. */
- /* See above as to why we don't just */
- /* look ahead in the opcode stream. */
- pcis->ignore_pops = 1;
+ if (code < 0)
+ return code;
+ gs_type1_sbw(pcis, cs0, cs1, cs2, cs3);
+ goto rsbw;
+ case ce1_div:
+ csp[-1] = float2fixed((double)csp[-1] / (double)*csp);
+ --csp;
+ goto pushed;
+ case ce1_undoc15:
+ /* See gstype1.h for information on this opcode. */
+ cnext;
+ case ce1_callothersubr:
+ {
+ int num_results;
+ /* We must remember to pop both the othersubr # */
+ /* and the argument count off the stack. */
+ switch (*pindex = fixed2int_var(*csp)) {
+ case 0:
+ {
+ fixed fheight = csp[-4];
+ /* Assume the next two opcodes */
+ /* are `pop' `pop'. Unfortunately, some */
+ /* Monotype fonts put these in a Subr, */
+ /* so we can't just look ahead in the */
+ /* opcode stream. */
+ pcis->ignore_pops = 2;
+ csp[-4] = csp[-3] - pcis->asb_diff;
+ csp[-3] = csp[-2];
+ csp -= 3;
+ code = t1_hinter__flex_end(h, fheight);
+ }
+ if (code < 0)
+ return code;
+ pcis->flex_count = flex_max; /* not inside flex */
+ inext;
+ case 1:
+ code = t1_hinter__flex_beg(h);
+ if (code < 0)
+ return code;
+ pcis->flex_count = 1;
+ csp -= 2;
+ inext;
+ case 2:
+ if (pcis->flex_count >= flex_max)
+ return_error(gs_error_invalidfont);
+ code = t1_hinter__flex_point(h);
+ if (code < 0)
+ return code;
+ csp -= 2;
+ inext;
+ case 3:
+ /* Assume the next opcode is a `pop'. */
+ /* See above as to why we don't just */
+ /* look ahead in the opcode stream. */
+ pcis->ignore_pops = 1;
code = t1_hinter__drop_hints(h);
- if (code < 0)
- return code;
- csp -= 2;
- inext;
- case 12:
- case 13:
- /* Counter control isn't implemented. */
- cnext;
- case 14:
- num_results = 1;
- blend:
- code = gs_type1_blend(pcis, csp,
- num_results);
- if (code < 0)
- return code;
- csp -= code;
- inext;
- case 15:
- num_results = 2;
- goto blend;
- case 16:
- num_results = 3;
- goto blend;
- case 17:
- num_results = 4;
- goto blend;
- case 18:
- num_results = 6;
- goto blend;
- }
- }
- /* Not a recognized othersubr, */
- /* let the client handle it. */
- {
- int scount = csp - cstack;
- int n;
+ if (code < 0)
+ return code;
+ csp -= 2;
+ inext;
+ case 12:
+ case 13:
+ /* Counter control isn't implemented. */
+ cnext;
+ case 14:
+ num_results = 1;
+ blend:
+ code = gs_type1_blend(pcis, csp,
+ num_results);
+ if (code < 0)
+ return code;
+ csp -= code;
+ inext;
+ case 15:
+ num_results = 2;
+ goto blend;
+ case 16:
+ num_results = 3;
+ goto blend;
+ case 17:
+ num_results = 4;
+ goto blend;
+ case 18:
+ num_results = 6;
+ goto blend;
+ }
+ }
+ /* Not a recognized othersubr, */
+ /* let the client handle it. */
+ {
+ int scount = csp - cstack;
+ int n;
- /* Copy the arguments to the caller's stack. */
- if (scount < 1 || csp[-1] < 0 ||
- csp[-1] > int2fixed(scount - 1)
- )
- return_error(gs_error_invalidfont);
- n = fixed2int_var(csp[-1]);
- code = (*pdata->procs.push_values)
- (pcis->callback_data, csp - (n + 1), n);
- if (code < 0)
- return_error(code);
- scount -= n + 1;
- /* Exit to caller */
- ipsp->ip = cip, ipsp->dstate = state;
- pcis->os_count = scount;
- pcis->ips_count = ipsp - &pcis->ipstack[0] + 1;
- if (scount)
- memcpy(pcis->ostack, cstack, scount * sizeof(fixed));
- return type1_result_callothersubr;
- }
- case ce1_pop:
- /* Check whether we're ignoring the pops after */
- /* a known othersubr. */
- if (pcis->ignore_pops != 0) {
- pcis->ignore_pops--;
- inext;
- }
- CS_CHECK_PUSH(csp, cstack);
- ++csp;
- code = (*pdata->procs.pop_value)
- (pcis->callback_data, csp);
- if (code < 0)
- return_error(code);
- goto pushed;
- case ce1_setcurrentpoint:
- cs0 += pcis->adxy.x + pcis->origin_offset.x;
- cs1 += pcis->adxy.y + pcis->origin_offset.y;
- t1_hinter__setcurrentpoint(h, cs0, cs1);
- cnext;
- default:
- return_error(gs_error_invalidfont);
- }
- /*NOTREACHED */
+ /* Copy the arguments to the caller's stack. */
+ if (scount < 1 || csp[-1] < 0 ||
+ csp[-1] > int2fixed(scount - 1)
+ )
+ return_error(gs_error_invalidfont);
+ n = fixed2int_var(csp[-1]);
+ code = (*pdata->procs.push_values)
+ (pcis->callback_data, csp - (n + 1), n);
+ if (code < 0)
+ return_error(code);
+ scount -= n + 1;
+ /* Exit to caller */
+ ipsp->ip = cip, ipsp->dstate = state;
+ pcis->os_count = scount;
+ pcis->ips_count = ipsp - &pcis->ipstack[0] + 1;
+ if (scount)
+ memcpy(pcis->ostack, cstack, scount * sizeof(fixed));
+ return type1_result_callothersubr;
+ }
+ case ce1_pop:
+ /* Check whether we're ignoring the pops after */
+ /* a known othersubr. */
+ if (pcis->ignore_pops != 0) {
+ pcis->ignore_pops--;
+ inext;
+ }
+ CS_CHECK_PUSH(csp, cstack);
+ ++csp;
+ code = (*pdata->procs.pop_value)
+ (pcis->callback_data, csp);
+ if (code < 0)
+ return_error(code);
+ goto pushed;
+ case ce1_setcurrentpoint:
+ cs0 += pcis->adxy.x + pcis->origin_offset.x;
+ cs1 += pcis->adxy.y + pcis->origin_offset.y;
+ t1_hinter__setcurrentpoint(h, cs0, cs1);
+ cnext;
+ default:
+ return_error(gs_error_invalidfont);
+ }
+ /*NOTREACHED */
- /* Fill up the dispatch up to 32. */
+ /* Fill up the dispatch up to 32. */
- case_c1_undefs:
- default: /* pacify compiler */
- return_error(gs_error_invalidfont);
- }
+ case_c1_undefs:
+ default: /* pacify compiler */
+ return_error(gs_error_invalidfont);
+ }
}
}
diff --git a/gs/base/gstype1.h b/gs/base/gstype1.h
index 5112fd8b5..b695b81d6 100644
--- a/gs/base/gstype1.h
+++ b/gs/base/gstype1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,9 +34,9 @@ typedef struct gs_font_type1_s gs_font_type1;
struct gs_type1_data_s;
#endif
int gs_type1_interp_init(gs_type1_state * pcis, gs_imager_state * pis,
- gx_path * ppath, const gs_log2_scale_point * pscale,
- const gs_log2_scale_point * psubpixels, bool no_grid_fitting,
- int paint_type, gs_font_type1 * pfont);
+ gx_path * ppath, const gs_log2_scale_point * pscale,
+ const gs_log2_scale_point * psubpixels, bool no_grid_fitting,
+ int paint_type, gs_font_type1 * pfont);
void gs_type1_set_callback_data(gs_type1_state *pcis, void *callback_data);
void gs_type1_set_lsb(gs_type1_state * pcis, const gs_point * psbpt);
void gs_type1_set_width(gs_type1_state * pcis, const gs_point * pwpt);
@@ -44,8 +44,8 @@ void gs_type1_set_width(gs_type1_state * pcis, const gs_point * pwpt);
/* Backward compatibility */
#define gs_type1_init(pcis, penum, psbpt, charpath_flag, paint_type, pfont)\
(gs_type1_interp_init(pcis, (gs_imager_state *)((penum)->pgs),\
- (penum)->pgs->path, &(penum)->log2_current_scale,\
- charpath_flag, paint_type, pfont) |\
+ (penum)->pgs->path, &(penum)->log2_current_scale,\
+ charpath_flag, paint_type, pfont) |\
((psbpt) == 0 ? 0 : (gs_type1_set_lsb(pcis, psbpt), 0)))
/*
* Continue interpreting a (Type 1) CharString. If str != 0, it is taken as
@@ -140,9 +140,9 @@ typedef enum {
/* Commands not recognized in Type 1 charstrings. */
#define case_c1_undefs\
- case 16: case 18: case 19:\
- case 20: case 23: case 24:\
- case 25: case 26: case 27: case 28: case 29
+ case 16: case 18: case 19:\
+ case 20: case 23: case 24:\
+ case 25: case 26: case 27: case 28: case 29
/* Commands only recognized in Type 2 charstrings. */
@@ -161,7 +161,7 @@ typedef enum {
/* Commands not recognized in Type 2 charstrings. */
#define case_c2_undefs\
- case 9: case 13
+ case 9: case 13
} char_command;
diff --git a/gs/base/gstype2.c b/gs/base/gstype2.c
index 21e3a335c..2c04e1b02 100644
--- a/gs/base/gstype2.c
+++ b/gs/base/gstype2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,38 +47,38 @@
BEGIN\
if ( pcis->init_done < 0 )\
{ ipsp->ip = cip, ipsp->dstate = state;\
- return type2_sbw(pcis, csp, cstack, ipsp, explicit_width);\
+ return type2_sbw(pcis, csp, cstack, ipsp, explicit_width);\
}\
END
static int
type2_sbw(gs_type1_state * pcis, cs_ptr csp, cs_ptr cstack, ip_state_t * ipsp,
- bool explicit_width)
+ bool explicit_width)
{
t1_hinter *h = &pcis->h;
fixed sbx = fixed_0, sby = fixed_0, wx, wy = fixed_0;
int code;
if (explicit_width) {
- wx = cstack[0] + pcis->pfont->data.nominalWidthX;
- memmove(cstack, cstack + 1, (csp - cstack) * sizeof(*cstack));
- --csp;
+ wx = cstack[0] + pcis->pfont->data.nominalWidthX;
+ memmove(cstack, cstack + 1, (csp - cstack) * sizeof(*cstack));
+ --csp;
} else
- wx = pcis->pfont->data.defaultWidthX;
+ wx = pcis->pfont->data.defaultWidthX;
if (pcis->seac_accent < 0) {
- if (pcis->sb_set) {
- pcis->origin_offset.x = pcis->lsb.x - sbx;
- pcis->origin_offset.y = pcis->lsb.y - sby;
- sbx = pcis->lsb.x;
- sby = pcis->lsb.y;
- }
- if (pcis->width_set) {
- wx = pcis->width.x;
- wy = pcis->width.y;
- }
+ if (pcis->sb_set) {
+ pcis->origin_offset.x = pcis->lsb.x - sbx;
+ pcis->origin_offset.y = pcis->lsb.y - sby;
+ sbx = pcis->lsb.x;
+ sby = pcis->lsb.y;
+ }
+ if (pcis->width_set) {
+ wx = pcis->width.x;
+ wy = pcis->width.y;
+ }
}
code = t1_hinter__sbw(h, sbx, sby, wx, wy);
if (code < 0)
- return code;
+ return code;
gs_type1_sbw(pcis, fixed_0, fixed_0, wx, fixed_0);
/* Back up the interpretation pointer. */
ipsp->ip--;
@@ -88,7 +88,7 @@ type2_sbw(gs_type1_state * pcis, cs_ptr csp, cs_ptr cstack, ip_state_t * ipsp,
pcis->ips_count = ipsp - &pcis->ipstack[0] + 1;
memcpy(pcis->ostack, cstack, pcis->os_count * sizeof(cstack[0]));
if (pcis->init_done < 0) { /* Finish init when we return. */
- pcis->init_done = 0;
+ pcis->init_done = 0;
}
return type1_result_sbw;
}
@@ -102,8 +102,8 @@ type2_vstem(gs_type1_state * pcis, cs_ptr csp, cs_ptr cstack)
for (ap = cstack; ap + 1 <= csp; x += ap[1], ap += 2) {
code = t1_hinter__vstem(h, x += ap[0], ap[1]);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
pcis->num_hints += (csp + 1 - cstack) >> 1;
return 0;
@@ -119,7 +119,7 @@ type2_vstem(gs_type1_state * pcis, cs_ptr csp, cs_ptr cstack)
*/
int
gs_type2_interpret(gs_type1_state * pcis, const gs_glyph_data_t *pgd,
- int *ignore_pindex)
+ int *ignore_pindex)
{
gs_font_type1 *pfont = pcis->pfont;
gs_type1_data *pdata = &pfont->data;
@@ -138,659 +138,659 @@ gs_type2_interpret(gs_type1_state * pcis, const gs_glyph_data_t *pgd,
/****** FAKE THE REGISTRY ******/
struct {
- float *values;
- uint size;
+ float *values;
+ uint size;
} Registry[1];
Registry[0].values = pcis->pfont->data.WeightVector.values;
switch (pcis->init_done) {
- case -1:
- t1_hinter__init(h, pcis->path);
- break;
- case 0:
- gs_type1_finish_init(pcis); /* sets origin */
+ case -1:
+ t1_hinter__init(h, pcis->path);
+ break;
+ case 0:
+ gs_type1_finish_init(pcis); /* sets origin */
code = t1_hinter__set_mapping(h, &pcis->pis->ctm,
- &pfont->FontMatrix, &pfont->base->FontMatrix,
- pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
- pcis->scale.x.log2_unit - pcis->log2_subpixels.x,
- pcis->scale.y.log2_unit - pcis->log2_subpixels.y,
- pcis->origin.x, pcis->origin.y,
- gs_currentaligntopixels(pfont->dir));
- if (code < 0)
- return code;
- code = t1_hinter__set_font_data(h, 2, pdata, pcis->no_grid_fitting,
- pcis->pfont->is_resource);
- if (code < 0)
- return code;
- break;
- default /*case 1 */ :
- break;
+ &pfont->FontMatrix, &pfont->base->FontMatrix,
+ pcis->scale.x.log2_unit, pcis->scale.x.log2_unit,
+ pcis->scale.x.log2_unit - pcis->log2_subpixels.x,
+ pcis->scale.y.log2_unit - pcis->log2_subpixels.y,
+ pcis->origin.x, pcis->origin.y,
+ gs_currentaligntopixels(pfont->dir));
+ if (code < 0)
+ return code;
+ code = t1_hinter__set_font_data(h, 2, pdata, pcis->no_grid_fitting,
+ pcis->pfont->is_resource);
+ if (code < 0)
+ return code;
+ break;
+ default /*case 1 */ :
+ break;
}
INIT_CSTACK(cstack, csp, pcis);
if (pgd == 0)
- goto cont;
+ goto cont;
ipsp->cs_data = *pgd;
cip = pgd->bits.data;
if (cip == 0)
- return (gs_note_error(gs_error_invalidfont));
+ return (gs_note_error(gs_error_invalidfont));
call:state = crypt_charstring_seed;
if (encrypted) {
- int skip = pdata->lenIV;
+ int skip = pdata->lenIV;
- /* Skip initial random bytes */
- for (; skip > 0; ++cip, --skip)
- decrypt_skip_next(*cip, state);
+ /* Skip initial random bytes */
+ for (; skip > 0; ++cip, --skip)
+ decrypt_skip_next(*cip, state);
}
goto top;
cont:if (ipsp < pcis->ipstack || ipsp->ip == 0)
- return (gs_note_error(gs_error_invalidfont));
+ return (gs_note_error(gs_error_invalidfont));
cip = ipsp->ip;
state = ipsp->dstate;
top:for (;;) {
- uint c0 = *cip++;
-
- charstring_next(c0, state, c, encrypted);
- if (c >= c_num1) {
- /* This is a number, decode it and push it on the stack. */
-
- if (c < c_pos2_0) { /* 1-byte number */
- decode_push_num1(csp, cstack, c);
- } else if (c < cx_num4) { /* 2-byte number */
- decode_push_num2(csp, cstack, c, cip, state, encrypted);
- } else if (c == cx_num4) { /* 4-byte number */
- long lw;
-
- decode_num4(lw, cip, state, encrypted);
- /* 32-bit numbers are 16:16. */
- CS_CHECK_PUSH(csp, cstack);
- *++csp = arith_rshift(lw, 16 - _fixed_shift);
- } else /* not possible */
- return_error(gs_error_invalidfont);
- pushed:if_debug3('1', "[1]%d: (%d) %f\n",
- (int)(csp - cstack), c, fixed2float(*csp));
- continue;
- }
+ uint c0 = *cip++;
+
+ charstring_next(c0, state, c, encrypted);
+ if (c >= c_num1) {
+ /* This is a number, decode it and push it on the stack. */
+
+ if (c < c_pos2_0) { /* 1-byte number */
+ decode_push_num1(csp, cstack, c);
+ } else if (c < cx_num4) { /* 2-byte number */
+ decode_push_num2(csp, cstack, c, cip, state, encrypted);
+ } else if (c == cx_num4) { /* 4-byte number */
+ long lw;
+
+ decode_num4(lw, cip, state, encrypted);
+ /* 32-bit numbers are 16:16. */
+ CS_CHECK_PUSH(csp, cstack);
+ *++csp = arith_rshift(lw, 16 - _fixed_shift);
+ } else /* not possible */
+ return_error(gs_error_invalidfont);
+ pushed:if_debug3('1', "[1]%d: (%d) %f\n",
+ (int)(csp - cstack), c, fixed2float(*csp));
+ continue;
+ }
#ifdef DEBUG
- if (gs_debug['1']) {
- static const char *const c2names[] =
- {char2_command_names};
-
- if (c2names[c] == 0)
- dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
- else
- dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
- c2names[c]);
- }
+ if (gs_debug['1']) {
+ static const char *const c2names[] =
+ {char2_command_names};
+
+ if (c2names[c] == 0)
+ dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
+ else
+ dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
+ c2names[c]);
+ }
#endif
- switch ((char_command) c) {
+ switch ((char_command) c) {
#define cnext clear; goto top
- /* Commands with identical functions in Type 1 and Type 2, */
- /* except for 'escape'. */
-
- case c_undef0:
- case c_undef2:
- case c_undef17:
- return_error(gs_error_invalidfont);
- case c_callsubr:
- c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
- code = pdata->procs.subr_data
- (pfont, c, false, &ipsp[1].cs_data);
- subr:if (code < 0) {
- /* Calling a Subr with an out-of-range index is clearly a error:
- * the Adobe documentation says the results of doing this are
- * undefined. However, we have seen a PDF file produced by Adobe
- * PDF Library 4.16 that included a Type 2 font that called an
- * out-of-range Subr, and Acrobat Reader did not signal an error.
- * Therefore, we ignore such calls.
- */
+ /* Commands with identical functions in Type 1 and Type 2, */
+ /* except for 'escape'. */
+
+ case c_undef0:
+ case c_undef2:
+ case c_undef17:
+ return_error(gs_error_invalidfont);
+ case c_callsubr:
+ c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
+ code = pdata->procs.subr_data
+ (pfont, c, false, &ipsp[1].cs_data);
+ subr:if (code < 0) {
+ /* Calling a Subr with an out-of-range index is clearly a error:
+ * the Adobe documentation says the results of doing this are
+ * undefined. However, we have seen a PDF file produced by Adobe
+ * PDF Library 4.16 that included a Type 2 font that called an
+ * out-of-range Subr, and Acrobat Reader did not signal an error.
+ * Therefore, we ignore such calls.
+ */
cip++;
goto top;
}
- --csp;
- ipsp->ip = cip, ipsp->dstate = state;
- ++ipsp;
- cip = ipsp->cs_data.bits.data;
- goto call;
- case c_return:
- gs_glyph_data_free(&ipsp->cs_data, "gs_type2_interpret");
- --ipsp;
- goto cont;
- case c_undoc15:
- /* See gstype1.h for information on this opcode. */
- cnext;
-
- /* Commands with similar but not identical functions */
- /* in Type 1 and Type 2 charstrings. */
-
- case cx_hstem:
- goto hstem;
- case cx_vstem:
- goto vstem;
- case cx_vmoveto:
- check_first_operator(csp > cstack);
+ --csp;
+ ipsp->ip = cip, ipsp->dstate = state;
+ ++ipsp;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ case c_return:
+ gs_glyph_data_free(&ipsp->cs_data, "gs_type2_interpret");
+ --ipsp;
+ goto cont;
+ case c_undoc15:
+ /* See gstype1.h for information on this opcode. */
+ cnext;
+
+ /* Commands with similar but not identical functions */
+ /* in Type 1 and Type 2 charstrings. */
+
+ case cx_hstem:
+ goto hstem;
+ case cx_vstem:
+ goto vstem;
+ case cx_vmoveto:
+ check_first_operator(csp > cstack);
code = t1_hinter__rmoveto(h, 0, *csp);
- move:
- cc:
- if (code < 0)
- return code;
- goto pp;
- case cx_rlineto:
- for (ap = cstack; ap + 1 <= csp; ap += 2) {
- code = t1_hinter__rlineto(h, ap[0], ap[1]);
- if (code < 0)
- return code;
- }
- pp:
- cnext;
- case cx_hlineto:
- vertical = false;
- goto hvl;
- case cx_vlineto:
- vertical = true;
- hvl:for (ap = cstack; ap <= csp; vertical = !vertical, ++ap) {
- if (vertical) {
- code = t1_hinter__rlineto(h, 0, ap[0]);
- } else {
- code = t1_hinter__rlineto(h, ap[0], 0);
- }
- if (code < 0)
- return code;
- }
- goto pp;
- case cx_rrcurveto:
- for (ap = cstack; ap + 5 <= csp; ap += 6) {
- code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2],
- ap[3], ap[4], ap[5]);
- if (code < 0)
- return code;
- }
- goto pp;
- case cx_endchar:
- /*
- * It is a feature of Type 2 CharStrings that if endchar is
- * invoked with 4 or 5 operands, it is equivalent to the
- * Type 1 seac operator. In this case, the asb operand of
- * seac is missing: we assume it is the same as the
- * l.s.b. of the accented character. This feature was
- * undocumented until the 16 March 2000 version of the Type
- * 2 Charstring Format specification, but, thankfully, is
- * described in that revision.
- */
- if (csp >= cstack + 3) {
- check_first_operator(csp > cstack + 3);
- code = gs_type1_seac(pcis, cstack, 0, ipsp);
- if (code < 0)
- return code;
- clear;
- cip = ipsp->cs_data.bits.data;
- goto call;
- }
- /*
- * This might be the only operator in the charstring.
- * In this case, there might be a width on the stack.
- */
- check_first_operator(csp >= cstack);
- if (pcis->seac_accent < 0) {
- code = t1_hinter__endglyph(h);
- if (code < 0)
- return code;
- code = gx_setcurrentpoint_from_path(pcis->pis, pcis->path);
- if (code < 0)
- return code;
- } else {
- t1_hinter__setcurrentpoint(h, pcis->save_adxy.x + pcis->origin_offset.x,
- pcis->save_adxy.y + pcis->origin_offset.y);
- code = t1_hinter__end_subglyph(h);
- if (code < 0)
- return code;
- }
- code = gs_type1_endchar(pcis);
- if (code == 1) {
- /*
- * Reset the total hint count so that hintmask will
- * parse its following data correctly.
- * (gs_type1_endchar already reset the actual hint
- * tables.)
- */
- pcis->num_hints = 0;
- /* do accent of seac */
- ipsp = &pcis->ipstack[pcis->ips_count - 1];
- cip = ipsp->cs_data.bits.data;
- goto call;
- }
- return code;
- case cx_rmoveto:
- /* See vmoveto above re closing the subpath. */
- check_first_operator(!((csp - cstack) & 1));
- if (csp > cstack + 1) {
- /* Some Type 2 charstrings omit the vstemhm operator before rmoveto,
- even though this is only allowed before hintmask and cntrmask.
- Thanks to Felix Pahl.
- */
- type2_vstem(pcis, csp - 2, cstack);
- cstack [0] = csp [-1];
- cstack [1] = csp [ 0];
- csp = cstack + 1;
- }
+ move:
+ cc:
+ if (code < 0)
+ return code;
+ goto pp;
+ case cx_rlineto:
+ for (ap = cstack; ap + 1 <= csp; ap += 2) {
+ code = t1_hinter__rlineto(h, ap[0], ap[1]);
+ if (code < 0)
+ return code;
+ }
+ pp:
+ cnext;
+ case cx_hlineto:
+ vertical = false;
+ goto hvl;
+ case cx_vlineto:
+ vertical = true;
+ hvl:for (ap = cstack; ap <= csp; vertical = !vertical, ++ap) {
+ if (vertical) {
+ code = t1_hinter__rlineto(h, 0, ap[0]);
+ } else {
+ code = t1_hinter__rlineto(h, ap[0], 0);
+ }
+ if (code < 0)
+ return code;
+ }
+ goto pp;
+ case cx_rrcurveto:
+ for (ap = cstack; ap + 5 <= csp; ap += 6) {
+ code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2],
+ ap[3], ap[4], ap[5]);
+ if (code < 0)
+ return code;
+ }
+ goto pp;
+ case cx_endchar:
+ /*
+ * It is a feature of Type 2 CharStrings that if endchar is
+ * invoked with 4 or 5 operands, it is equivalent to the
+ * Type 1 seac operator. In this case, the asb operand of
+ * seac is missing: we assume it is the same as the
+ * l.s.b. of the accented character. This feature was
+ * undocumented until the 16 March 2000 version of the Type
+ * 2 Charstring Format specification, but, thankfully, is
+ * described in that revision.
+ */
+ if (csp >= cstack + 3) {
+ check_first_operator(csp > cstack + 3);
+ code = gs_type1_seac(pcis, cstack, 0, ipsp);
+ if (code < 0)
+ return code;
+ clear;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ }
+ /*
+ * This might be the only operator in the charstring.
+ * In this case, there might be a width on the stack.
+ */
+ check_first_operator(csp >= cstack);
+ if (pcis->seac_accent < 0) {
+ code = t1_hinter__endglyph(h);
+ if (code < 0)
+ return code;
+ code = gx_setcurrentpoint_from_path(pcis->pis, pcis->path);
+ if (code < 0)
+ return code;
+ } else {
+ t1_hinter__setcurrentpoint(h, pcis->save_adxy.x + pcis->origin_offset.x,
+ pcis->save_adxy.y + pcis->origin_offset.y);
+ code = t1_hinter__end_subglyph(h);
+ if (code < 0)
+ return code;
+ }
+ code = gs_type1_endchar(pcis);
+ if (code == 1) {
+ /*
+ * Reset the total hint count so that hintmask will
+ * parse its following data correctly.
+ * (gs_type1_endchar already reset the actual hint
+ * tables.)
+ */
+ pcis->num_hints = 0;
+ /* do accent of seac */
+ ipsp = &pcis->ipstack[pcis->ips_count - 1];
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ }
+ return code;
+ case cx_rmoveto:
+ /* See vmoveto above re closing the subpath. */
+ check_first_operator(!((csp - cstack) & 1));
+ if (csp > cstack + 1) {
+ /* Some Type 2 charstrings omit the vstemhm operator before rmoveto,
+ even though this is only allowed before hintmask and cntrmask.
+ Thanks to Felix Pahl.
+ */
+ type2_vstem(pcis, csp - 2, cstack);
+ cstack [0] = csp [-1];
+ cstack [1] = csp [ 0];
+ csp = cstack + 1;
+ }
code = t1_hinter__rmoveto(h, csp[-1], *csp);
- goto move;
- case cx_hmoveto:
- /* See vmoveto above re closing the subpath. */
- check_first_operator(csp > cstack);
+ goto move;
+ case cx_hmoveto:
+ /* See vmoveto above re closing the subpath. */
+ check_first_operator(csp > cstack);
code = t1_hinter__rmoveto(h, *csp, 0);
- goto move;
- case cx_vhcurveto:
- vertical = true;
- goto hvc;
- case cx_hvcurveto:
- vertical = false;
- hvc:for (ap = cstack; ap + 3 <= csp; vertical = !vertical, ap += 4) {
- gs_fixed_point pt[2] = {{0, 0}, {0, 0}};
- if (vertical) {
- pt[0].y = ap[0];
- pt[1].x = ap[3];
- if (ap + 4 == csp)
- pt[1].y = ap[4];
- } else {
- pt[0].x = ap[0];
- if (ap + 4 == csp)
- pt[1].x = ap[4];
- pt[1].y = ap[3];
- }
- code = t1_hinter__rcurveto(h, pt[0].x, pt[0].y, ap[1], ap[2], pt[1].x, pt[1].y);
- if (code < 0)
- return code;
- }
- goto pp;
-
- /***********************
- * New Type 2 commands *
- ***********************/
-
- case c2_blend:
- {
- int n = fixed2int_var(*csp);
- int num_values = csp - cstack;
- gs_font_type1 *pfont = pcis->pfont;
- int k = pfont->data.WeightVector.count;
- int i, j;
- cs_ptr base, deltas;
-
- base = csp - 1 - num_values;
- deltas = base + n - 1;
- for (j = 0; j < n; j++, base++, deltas += k - 1)
- for (i = 1; i < k; i++)
- *base += (fixed)(deltas[i] *
- pfont->data.WeightVector.values[i]);
- }
- cnext;
- case c2_hstemhm:
- hstem:check_first_operator(!((csp - cstack) & 1));
- {
- fixed x = 0;
-
- for (ap = cstack; ap + 1 <= csp; x += ap[1], ap += 2) {
- code = t1_hinter__hstem(h, x += ap[0], ap[1]);
- if (code < 0)
- return code;
- }
- }
- pcis->num_hints += (csp + 1 - cstack) >> 1;
- cnext;
- case c2_hintmask:
- /*
- * A hintmask at the beginning of the CharString is
- * equivalent to vstemhm + hintmask. For simplicity, we use
- * this interpretation everywhere.
- */
- case c2_cntrmask:
- check_first_operator(!((csp - cstack) & 1));
- type2_vstem(pcis, csp, cstack);
- /*
- * We should clear the stack here only if this is the
- * initial mask operator that includes the implicit
- * vstemhm, but currently this is too much trouble to
- * detect.
- */
- clear;
- {
- byte mask[max_total_stem_hints / 8];
- int i;
-
- for (i = 0; i < pcis->num_hints; ++cip, i += 8) {
- charstring_next(*cip, state, mask[i >> 3], encrypted);
- if_debug1('1', " 0x%02x", mask[i >> 3]);
- }
- if_debug0('1', "\n");
- ipsp->ip = cip;
- ipsp->dstate = state;
- if (c == c2_cntrmask) {
- /****** NYI ******/
- } else { /* hintmask or equivalent */
- if_debug0('1', "[1]hstem hints:\n");
- if_debug0('1', "[1]vstem hints:\n");
- code = t1_hinter__hint_mask(h, mask);
- if (code < 0)
- return code;
- }
- }
- break;
- case c2_vstemhm:
- vstem:check_first_operator(!((csp - cstack) & 1));
- type2_vstem(pcis, csp, cstack);
- cnext;
- case c2_rcurveline:
- for (ap = cstack; ap + 5 <= csp; ap += 6) {
- code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2], ap[3],
- ap[4], ap[5]);
- if (code < 0)
- return code;
- }
- code = t1_hinter__rlineto(h, ap[0], ap[1]);
- goto cc;
- case c2_rlinecurve:
- for (ap = cstack; ap + 7 <= csp; ap += 2) {
- code = t1_hinter__rlineto(h, ap[0], ap[1]);
- if (code < 0)
- return code;
- }
- code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2], ap[3],
- ap[4], ap[5]);
- goto cc;
- case c2_vvcurveto:
- ap = cstack;
- {
- int n = csp + 1 - cstack;
- fixed dxa = (n & 1 ? *ap++ : 0);
-
- for (; ap + 3 <= csp; ap += 4) {
- code = t1_hinter__rcurveto(h, dxa, ap[0], ap[1], ap[2],
- fixed_0, ap[3]);
- if (code < 0)
- return code;
- dxa = 0;
- }
- }
- goto pp;
- case c2_hhcurveto:
- ap = cstack;
- {
- int n = csp + 1 - cstack;
- fixed dya = (n & 1 ? *ap++ : 0);
-
- for (; ap + 3 <= csp; ap += 4) {
- code = t1_hinter__rcurveto(h, ap[0], dya, ap[1], ap[2],
- ap[3], fixed_0);
- if (code < 0)
- return code;
- dya = 0;
- }
- }
- goto pp;
- case c2_shortint:
- {
- int c1, c2;
-
- charstring_next(*cip, state, c1, encrypted);
- ++cip;
- charstring_next(*cip, state, c2, encrypted);
- ++cip;
- CS_CHECK_PUSH(csp, cstack);
- *++csp = int2fixed((((c1 ^ 0x80) - 0x80) << 8) + c2);
- }
- goto pushed;
- case c2_callgsubr:
- c = fixed2int_var(*csp) + pdata->gsubrNumberBias;
- code = pdata->procs.subr_data
- (pfont, c, true, &ipsp[1].cs_data);
- goto subr;
- case cx_escape:
- charstring_next(*cip, state, c, encrypted);
- ++cip;
+ goto move;
+ case cx_vhcurveto:
+ vertical = true;
+ goto hvc;
+ case cx_hvcurveto:
+ vertical = false;
+ hvc:for (ap = cstack; ap + 3 <= csp; vertical = !vertical, ap += 4) {
+ gs_fixed_point pt[2] = {{0, 0}, {0, 0}};
+ if (vertical) {
+ pt[0].y = ap[0];
+ pt[1].x = ap[3];
+ if (ap + 4 == csp)
+ pt[1].y = ap[4];
+ } else {
+ pt[0].x = ap[0];
+ if (ap + 4 == csp)
+ pt[1].x = ap[4];
+ pt[1].y = ap[3];
+ }
+ code = t1_hinter__rcurveto(h, pt[0].x, pt[0].y, ap[1], ap[2], pt[1].x, pt[1].y);
+ if (code < 0)
+ return code;
+ }
+ goto pp;
+
+ /***********************
+ * New Type 2 commands *
+ ***********************/
+
+ case c2_blend:
+ {
+ int n = fixed2int_var(*csp);
+ int num_values = csp - cstack;
+ gs_font_type1 *pfont = pcis->pfont;
+ int k = pfont->data.WeightVector.count;
+ int i, j;
+ cs_ptr base, deltas;
+
+ base = csp - 1 - num_values;
+ deltas = base + n - 1;
+ for (j = 0; j < n; j++, base++, deltas += k - 1)
+ for (i = 1; i < k; i++)
+ *base += (fixed)(deltas[i] *
+ pfont->data.WeightVector.values[i]);
+ }
+ cnext;
+ case c2_hstemhm:
+ hstem:check_first_operator(!((csp - cstack) & 1));
+ {
+ fixed x = 0;
+
+ for (ap = cstack; ap + 1 <= csp; x += ap[1], ap += 2) {
+ code = t1_hinter__hstem(h, x += ap[0], ap[1]);
+ if (code < 0)
+ return code;
+ }
+ }
+ pcis->num_hints += (csp + 1 - cstack) >> 1;
+ cnext;
+ case c2_hintmask:
+ /*
+ * A hintmask at the beginning of the CharString is
+ * equivalent to vstemhm + hintmask. For simplicity, we use
+ * this interpretation everywhere.
+ */
+ case c2_cntrmask:
+ check_first_operator(!((csp - cstack) & 1));
+ type2_vstem(pcis, csp, cstack);
+ /*
+ * We should clear the stack here only if this is the
+ * initial mask operator that includes the implicit
+ * vstemhm, but currently this is too much trouble to
+ * detect.
+ */
+ clear;
+ {
+ byte mask[max_total_stem_hints / 8];
+ int i;
+
+ for (i = 0; i < pcis->num_hints; ++cip, i += 8) {
+ charstring_next(*cip, state, mask[i >> 3], encrypted);
+ if_debug1('1', " 0x%02x", mask[i >> 3]);
+ }
+ if_debug0('1', "\n");
+ ipsp->ip = cip;
+ ipsp->dstate = state;
+ if (c == c2_cntrmask) {
+ /****** NYI ******/
+ } else { /* hintmask or equivalent */
+ if_debug0('1', "[1]hstem hints:\n");
+ if_debug0('1', "[1]vstem hints:\n");
+ code = t1_hinter__hint_mask(h, mask);
+ if (code < 0)
+ return code;
+ }
+ }
+ break;
+ case c2_vstemhm:
+ vstem:check_first_operator(!((csp - cstack) & 1));
+ type2_vstem(pcis, csp, cstack);
+ cnext;
+ case c2_rcurveline:
+ for (ap = cstack; ap + 5 <= csp; ap += 6) {
+ code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2], ap[3],
+ ap[4], ap[5]);
+ if (code < 0)
+ return code;
+ }
+ code = t1_hinter__rlineto(h, ap[0], ap[1]);
+ goto cc;
+ case c2_rlinecurve:
+ for (ap = cstack; ap + 7 <= csp; ap += 2) {
+ code = t1_hinter__rlineto(h, ap[0], ap[1]);
+ if (code < 0)
+ return code;
+ }
+ code = t1_hinter__rcurveto(h, ap[0], ap[1], ap[2], ap[3],
+ ap[4], ap[5]);
+ goto cc;
+ case c2_vvcurveto:
+ ap = cstack;
+ {
+ int n = csp + 1 - cstack;
+ fixed dxa = (n & 1 ? *ap++ : 0);
+
+ for (; ap + 3 <= csp; ap += 4) {
+ code = t1_hinter__rcurveto(h, dxa, ap[0], ap[1], ap[2],
+ fixed_0, ap[3]);
+ if (code < 0)
+ return code;
+ dxa = 0;
+ }
+ }
+ goto pp;
+ case c2_hhcurveto:
+ ap = cstack;
+ {
+ int n = csp + 1 - cstack;
+ fixed dya = (n & 1 ? *ap++ : 0);
+
+ for (; ap + 3 <= csp; ap += 4) {
+ code = t1_hinter__rcurveto(h, ap[0], dya, ap[1], ap[2],
+ ap[3], fixed_0);
+ if (code < 0)
+ return code;
+ dya = 0;
+ }
+ }
+ goto pp;
+ case c2_shortint:
+ {
+ int c1, c2;
+
+ charstring_next(*cip, state, c1, encrypted);
+ ++cip;
+ charstring_next(*cip, state, c2, encrypted);
+ ++cip;
+ CS_CHECK_PUSH(csp, cstack);
+ *++csp = int2fixed((((c1 ^ 0x80) - 0x80) << 8) + c2);
+ }
+ goto pushed;
+ case c2_callgsubr:
+ c = fixed2int_var(*csp) + pdata->gsubrNumberBias;
+ code = pdata->procs.subr_data
+ (pfont, c, true, &ipsp[1].cs_data);
+ goto subr;
+ case cx_escape:
+ charstring_next(*cip, state, c, encrypted);
+ ++cip;
#ifdef DEBUG
- if (gs_debug['1'] && c < char2_extended_command_count) {
- static const char *const ce2names[] =
- {char2_extended_command_names};
-
- if (ce2names[c] == 0)
- dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
- else
- dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
- ce2names[c]);
- }
+ if (gs_debug['1'] && c < char2_extended_command_count) {
+ static const char *const ce2names[] =
+ {char2_extended_command_names};
+
+ if (ce2names[c] == 0)
+ dlprintf2("[1]0x%lx: %02x??\n", (ulong) (cip - 1), c);
+ else
+ dlprintf3("[1]0x%lx: %02x %s\n", (ulong) (cip - 1), c,
+ ce2names[c]);
+ }
#endif
- switch ((char2_extended_command) c) {
- case ce2_and:
- csp[-1] = ((csp[-1] != 0) & (*csp != 0) ? fixed_1 : 0);
- --csp;
- break;
- case ce2_or:
- csp[-1] = (csp[-1] | *csp ? fixed_1 : 0);
- --csp;
- break;
- case ce2_not:
- *csp = (*csp ? 0 : fixed_1);
- break;
- case ce2_store:
- {
- int i, n = fixed2int_var(*csp);
- float *to = Registry[fixed2int_var(csp[-3])].values +
- fixed2int_var(csp[-2]);
- const fixed *from =
- pcis->transient_array + fixed2int_var(csp[-1]);
-
- for (i = 0; i < n; ++i)
- to[i] = fixed2float(from[i]);
- }
- csp -= 4;
- break;
- case ce2_abs:
- if (*csp < 0)
- *csp = -*csp;
- break;
- case ce2_add:
- csp[-1] += *csp;
- --csp;
- break;
- case ce2_sub:
- csp[-1] -= *csp;
- --csp;
- break;
- case ce2_div:
- csp[-1] = float2fixed((double)csp[-1] / *csp);
- --csp;
- break;
- case ce2_load:
- /* The specification says there is no j (starting index */
- /* in registry array) argument.... */
- {
- int i, n = fixed2int_var(*csp);
- const float *from = Registry[fixed2int_var(csp[-2])].values;
- fixed *to =
- pcis->transient_array + fixed2int_var(csp[-1]);
-
- for (i = 0; i < n; ++i)
- to[i] = float2fixed(from[i]);
- }
- csp -= 3;
- break;
- case ce2_neg:
- *csp = -*csp;
- break;
- case ce2_eq:
- csp[-1] = (csp[-1] == *csp ? fixed_1 : 0);
- --csp;
- break;
- case ce2_drop:
- --csp;
- break;
- case ce2_put:
- pcis->transient_array[fixed2int_var(*csp)] = csp[-1];
- csp -= 2;
- break;
- case ce2_get:
- *csp = pcis->transient_array[fixed2int_var(*csp)];
- break;
- case ce2_ifelse:
- if (csp[-1] > *csp)
- csp[-3] = csp[-2];
- csp -= 3;
- break;
- case ce2_random:
- CS_CHECK_PUSH(csp, cstack);
- ++csp;
- /****** NYI ******/
- break;
- case ce2_mul:
- {
- double prod = fixed2float(csp[-1]) * *csp;
-
- csp[-1] =
- (prod > max_fixed ? max_fixed :
- prod < min_fixed ? min_fixed : (fixed)prod);
- }
- --csp;
- break;
- case ce2_sqrt:
- if (*csp >= 0)
- *csp = float2fixed(sqrt(fixed2float(*csp)));
- break;
- case ce2_dup:
- CS_CHECK_PUSH(csp, cstack);
- csp[1] = *csp;
- ++csp;
- break;
- case ce2_exch:
- {
- fixed top = *csp;
-
- *csp = csp[-1], csp[-1] = top;
- }
- break;
- case ce2_index:
- *csp =
- (*csp < 0 ? csp[-1] : csp[-1 - fixed2int_var(csp[-1])]);
- break;
- case ce2_roll:
- {
- int distance = fixed2int_var(*csp);
- int count = fixed2int_var(csp[-1]);
- cs_ptr bot;
-
- csp -= 2;
- if (count < 0 || count > csp + 1 - cstack)
- return_error(gs_error_invalidfont);
- if (count == 0)
- break;
- if (distance < 0)
- distance = count - (-distance % count);
- bot = csp + 1 - count;
- while (--distance >= 0) {
- fixed top = *csp;
-
- memmove(bot + 1, bot,
- (count - 1) * sizeof(fixed));
- *bot = top;
- }
- }
- break;
- case ce2_hflex:
- csp[6] = fixed_half; /* fd/100 */
- csp[4] = *csp, csp[5] = 0; /* dx6, dy6 */
- csp[2] = csp[-1], csp[3] = -csp[-4]; /* dx5, dy5 */
- *csp = csp[-2], csp[1] = 0; /* dx4, dy4 */
- csp[-2] = csp[-3], csp[-1] = 0; /* dx3, dy3 */
- csp[-3] = csp[-4], csp[-4] = csp[-5]; /* dx2, dy2 */
- csp[-5] = 0; /* dy1 */
- csp += 6;
- goto flex;
- case ce2_flex:
- *csp /= 100; /* fd/100 */
+ switch ((char2_extended_command) c) {
+ case ce2_and:
+ csp[-1] = ((csp[-1] != 0) & (*csp != 0) ? fixed_1 : 0);
+ --csp;
+ break;
+ case ce2_or:
+ csp[-1] = (csp[-1] | *csp ? fixed_1 : 0);
+ --csp;
+ break;
+ case ce2_not:
+ *csp = (*csp ? 0 : fixed_1);
+ break;
+ case ce2_store:
+ {
+ int i, n = fixed2int_var(*csp);
+ float *to = Registry[fixed2int_var(csp[-3])].values +
+ fixed2int_var(csp[-2]);
+ const fixed *from =
+ pcis->transient_array + fixed2int_var(csp[-1]);
+
+ for (i = 0; i < n; ++i)
+ to[i] = fixed2float(from[i]);
+ }
+ csp -= 4;
+ break;
+ case ce2_abs:
+ if (*csp < 0)
+ *csp = -*csp;
+ break;
+ case ce2_add:
+ csp[-1] += *csp;
+ --csp;
+ break;
+ case ce2_sub:
+ csp[-1] -= *csp;
+ --csp;
+ break;
+ case ce2_div:
+ csp[-1] = float2fixed((double)csp[-1] / *csp);
+ --csp;
+ break;
+ case ce2_load:
+ /* The specification says there is no j (starting index */
+ /* in registry array) argument.... */
+ {
+ int i, n = fixed2int_var(*csp);
+ const float *from = Registry[fixed2int_var(csp[-2])].values;
+ fixed *to =
+ pcis->transient_array + fixed2int_var(csp[-1]);
+
+ for (i = 0; i < n; ++i)
+ to[i] = float2fixed(from[i]);
+ }
+ csp -= 3;
+ break;
+ case ce2_neg:
+ *csp = -*csp;
+ break;
+ case ce2_eq:
+ csp[-1] = (csp[-1] == *csp ? fixed_1 : 0);
+ --csp;
+ break;
+ case ce2_drop:
+ --csp;
+ break;
+ case ce2_put:
+ pcis->transient_array[fixed2int_var(*csp)] = csp[-1];
+ csp -= 2;
+ break;
+ case ce2_get:
+ *csp = pcis->transient_array[fixed2int_var(*csp)];
+ break;
+ case ce2_ifelse:
+ if (csp[-1] > *csp)
+ csp[-3] = csp[-2];
+ csp -= 3;
+ break;
+ case ce2_random:
+ CS_CHECK_PUSH(csp, cstack);
+ ++csp;
+ /****** NYI ******/
+ break;
+ case ce2_mul:
+ {
+ double prod = fixed2float(csp[-1]) * *csp;
+
+ csp[-1] =
+ (prod > max_fixed ? max_fixed :
+ prod < min_fixed ? min_fixed : (fixed)prod);
+ }
+ --csp;
+ break;
+ case ce2_sqrt:
+ if (*csp >= 0)
+ *csp = float2fixed(sqrt(fixed2float(*csp)));
+ break;
+ case ce2_dup:
+ CS_CHECK_PUSH(csp, cstack);
+ csp[1] = *csp;
+ ++csp;
+ break;
+ case ce2_exch:
+ {
+ fixed top = *csp;
+
+ *csp = csp[-1], csp[-1] = top;
+ }
+ break;
+ case ce2_index:
+ *csp =
+ (*csp < 0 ? csp[-1] : csp[-1 - fixed2int_var(csp[-1])]);
+ break;
+ case ce2_roll:
+ {
+ int distance = fixed2int_var(*csp);
+ int count = fixed2int_var(csp[-1]);
+ cs_ptr bot;
+
+ csp -= 2;
+ if (count < 0 || count > csp + 1 - cstack)
+ return_error(gs_error_invalidfont);
+ if (count == 0)
+ break;
+ if (distance < 0)
+ distance = count - (-distance % count);
+ bot = csp + 1 - count;
+ while (--distance >= 0) {
+ fixed top = *csp;
+
+ memmove(bot + 1, bot,
+ (count - 1) * sizeof(fixed));
+ *bot = top;
+ }
+ }
+ break;
+ case ce2_hflex:
+ csp[6] = fixed_half; /* fd/100 */
+ csp[4] = *csp, csp[5] = 0; /* dx6, dy6 */
+ csp[2] = csp[-1], csp[3] = -csp[-4]; /* dx5, dy5 */
+ *csp = csp[-2], csp[1] = 0; /* dx4, dy4 */
+ csp[-2] = csp[-3], csp[-1] = 0; /* dx3, dy3 */
+ csp[-3] = csp[-4], csp[-4] = csp[-5]; /* dx2, dy2 */
+ csp[-5] = 0; /* dy1 */
+ csp += 6;
+ goto flex;
+ case ce2_flex:
+ *csp /= 100; /* fd/100 */
flex: {
- fixed x_join = csp[-12] + csp[-10] + csp[-8];
- fixed y_join = csp[-11] + csp[-9] + csp[-7];
- fixed x_end = x_join + csp[-6] + csp[-4] + csp[-2];
- fixed y_end = y_join + csp[-5] + csp[-3] + csp[-1];
- gs_point join, end;
- double flex_depth;
-
- if ((code =
- gs_distance_transform(fixed2float(x_join),
- fixed2float(y_join),
- &ctm_only(pcis->pis),
- &join)) < 0 ||
- (code =
- gs_distance_transform(fixed2float(x_end),
- fixed2float(y_end),
- &ctm_only(pcis->pis),
- &end)) < 0
- )
- return code;
- /*
- * Use the X or Y distance depending on whether
- * the curve is more horizontal or more
- * vertical.
- */
- if (any_abs(end.y) > any_abs(end.x))
- flex_depth = join.x;
- else
- flex_depth = join.y;
- if (fabs(flex_depth) < fixed2float(*csp)) {
- /* Do flex as line. */
- code = t1_hinter__rlineto(h, x_end, y_end);
- } else {
- /*
- * Do flex as curve. We can't jump to rrc,
- * because the flex operators don't clear
- * the stack (!).
- */
- code = t1_hinter__rcurveto(h,
- csp[-12], csp[-11], csp[-10],
- csp[-9], csp[-8], csp[-7]);
- if (code < 0)
- return code;
- code = t1_hinter__rcurveto(h,
- csp[-6], csp[-5], csp[-4],
- csp[-3], csp[-2], csp[-1]);
- }
- if (code < 0)
- return code;
- csp -= 13;
- }
- cnext;
- case ce2_hflex1:
- csp[4] = fixed_half; /* fd/100 */
- csp[2] = *csp; /* dx6 */
- csp[3] = -(csp[-7] + csp[-5] + csp[-1]); /* dy6 */
- *csp = csp[-2], csp[1] = csp[-1]; /* dx5, dy5 */
- csp[-2] = csp[-3], csp[-1] = 0; /* dx4, dy4 */
- csp[-3] = 0; /* dy3 */
- csp += 4;
- goto flex;
- case ce2_flex1:
- {
- fixed dx = csp[-10] + csp[-8] + csp[-6] + csp[-4] + csp[-2];
- fixed dy = csp[-9] + csp[-7] + csp[-5] + csp[-3] + csp[-1];
-
- if (any_abs(dx) > any_abs(dy))
- csp[1] = -dy; /* d6 is dx6 */
- else
- csp[1] = *csp, *csp = -dx; /* d6 is dy6 */
- }
- csp[2] = fixed_half; /* fd/100 */
- csp += 2;
- goto flex;
- }
- break;
-
- /* Fill up the dispatch up to 32. */
-
- case_c2_undefs:
- default: /* pacify compiler */
- return_error(gs_error_invalidfont);
- }
+ fixed x_join = csp[-12] + csp[-10] + csp[-8];
+ fixed y_join = csp[-11] + csp[-9] + csp[-7];
+ fixed x_end = x_join + csp[-6] + csp[-4] + csp[-2];
+ fixed y_end = y_join + csp[-5] + csp[-3] + csp[-1];
+ gs_point join, end;
+ double flex_depth;
+
+ if ((code =
+ gs_distance_transform(fixed2float(x_join),
+ fixed2float(y_join),
+ &ctm_only(pcis->pis),
+ &join)) < 0 ||
+ (code =
+ gs_distance_transform(fixed2float(x_end),
+ fixed2float(y_end),
+ &ctm_only(pcis->pis),
+ &end)) < 0
+ )
+ return code;
+ /*
+ * Use the X or Y distance depending on whether
+ * the curve is more horizontal or more
+ * vertical.
+ */
+ if (any_abs(end.y) > any_abs(end.x))
+ flex_depth = join.x;
+ else
+ flex_depth = join.y;
+ if (fabs(flex_depth) < fixed2float(*csp)) {
+ /* Do flex as line. */
+ code = t1_hinter__rlineto(h, x_end, y_end);
+ } else {
+ /*
+ * Do flex as curve. We can't jump to rrc,
+ * because the flex operators don't clear
+ * the stack (!).
+ */
+ code = t1_hinter__rcurveto(h,
+ csp[-12], csp[-11], csp[-10],
+ csp[-9], csp[-8], csp[-7]);
+ if (code < 0)
+ return code;
+ code = t1_hinter__rcurveto(h,
+ csp[-6], csp[-5], csp[-4],
+ csp[-3], csp[-2], csp[-1]);
+ }
+ if (code < 0)
+ return code;
+ csp -= 13;
+ }
+ cnext;
+ case ce2_hflex1:
+ csp[4] = fixed_half; /* fd/100 */
+ csp[2] = *csp; /* dx6 */
+ csp[3] = -(csp[-7] + csp[-5] + csp[-1]); /* dy6 */
+ *csp = csp[-2], csp[1] = csp[-1]; /* dx5, dy5 */
+ csp[-2] = csp[-3], csp[-1] = 0; /* dx4, dy4 */
+ csp[-3] = 0; /* dy3 */
+ csp += 4;
+ goto flex;
+ case ce2_flex1:
+ {
+ fixed dx = csp[-10] + csp[-8] + csp[-6] + csp[-4] + csp[-2];
+ fixed dy = csp[-9] + csp[-7] + csp[-5] + csp[-3] + csp[-1];
+
+ if (any_abs(dx) > any_abs(dy))
+ csp[1] = -dy; /* d6 is dx6 */
+ else
+ csp[1] = *csp, *csp = -dx; /* d6 is dy6 */
+ }
+ csp[2] = fixed_half; /* fd/100 */
+ csp += 2;
+ goto flex;
+ }
+ break;
+
+ /* Fill up the dispatch up to 32. */
+
+ case_c2_undefs:
+ default: /* pacify compiler */
+ return_error(gs_error_invalidfont);
+ }
}
}
diff --git a/gs/base/gstype42.c b/gs/base/gstype42.c
index d69d23382..3482d84dd 100644
--- a/gs/base/gstype42.c
+++ b/gs/base/gstype42.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,11 +42,11 @@ public_st_gs_font_type42();
/* Forward references */
static int append_outline_fitted(uint glyph_index, const gs_matrix * pmat,
- gx_path * ppath, cached_fm_pair * pair,
- const gs_log2_scale_point * pscale, bool design_grid);
+ gx_path * ppath, cached_fm_pair * pair,
+ const gs_log2_scale_point * pscale, bool design_grid);
static uint default_get_glyph_index(gs_font_type42 *pfont, gs_glyph glyph);
static int default_get_outline(gs_font_type42 *pfont, uint glyph_index,
- gs_glyph_data_t *pgd);
+ gs_glyph_data_t *pgd);
font_proc_font_info(gs_type42_font_info); /* Type check. */
font_proc_font_info(gs_truetype_font_info); /* Type check. */
@@ -67,41 +67,41 @@ int
gs_type42_read_data(gs_font_type42 * pfont, ulong pos, uint length, byte *buf)
{
int (*string_proc)(gs_font_type42 *, ulong, uint, const byte **) =
- pfont->data.string_proc;
+ pfont->data.string_proc;
uint left = length;
const byte *data;
int code;
do {
- code = (*string_proc)(pfont, (ulong)(pos + length - left), left, &data);
- if (code < 0)
- return code;
- if (code == 0)
- code = left;
- memcpy(buf + length - left, data, code);
- left -= code;
+ code = (*string_proc)(pfont, (ulong)(pos + length - left), left, &data);
+ if (code < 0)
+ return code;
+ if (code == 0)
+ code = left;
+ memcpy(buf + length - left, data, code);
+ left -= code;
} while (left);
return 0;
}
/* Get the offset to a glyph using the loca table */
static inline ulong
-get_glyph_offset(gs_font_type42 *pfont, uint glyph_index)
+get_glyph_offset(gs_font_type42 *pfont, uint glyph_index)
{
ulong result;
byte buf[4];
int code;
- /* Hack : when reading fails, we return a huge offset.
- Then gs_type42_font_init will fails because it is greater than loca size.
+ /* Hack : when reading fails, we return a huge offset.
+ Then gs_type42_font_init will fails because it is greater than loca size.
Fixme : improve with changing the function prototype.
*/
if (pfont->data.indexToLocFormat) {
- code = gs_type42_read_data(pfont, pfont->data.loca + glyph_index * 4, 4, buf);
- result = (code < 0 ? 0xffffffff : u32(buf));
+ code = gs_type42_read_data(pfont, pfont->data.loca + glyph_index * 4, 4, buf);
+ result = (code < 0 ? 0xffffffff : u32(buf));
} else {
- code = gs_type42_read_data(pfont, pfont->data.loca + glyph_index * 2, 2, buf);
- result = (code < 0 ? 0xffffffff : (ulong) U16(buf) << 1);
+ code = gs_type42_read_data(pfont, pfont->data.loca + glyph_index * 2, 2, buf);
+ result = (code < 0 ? 0xffffffff : (ulong) U16(buf) << 1);
}
return result;
}
@@ -118,13 +118,13 @@ gs_type42_font_init_compare (const void *a, const void *b)
ulong a_offset = ((const gs_type42_font_init_sort_t *)a)->glyph_offset;
ulong b_offset = ((const gs_type42_font_init_sort_t *)b)->glyph_offset;
if (a_offset < b_offset)
- return -1;
+ return -1;
else if (a_offset > b_offset)
- return +1;
+ return +1;
else
- /* make the sort stable */
- return ((const gs_type42_font_init_sort_t *)a)->glyph_num -
- ((const gs_type42_font_init_sort_t *)b)->glyph_num;
+ /* make the sort stable */
+ return ((const gs_type42_font_init_sort_t *)a)->glyph_num -
+ ((const gs_type42_font_init_sort_t *)b)->glyph_num;
}
/*
@@ -137,7 +137,7 @@ int
gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
{
int (*string_proc)(gs_font_type42 *, ulong, uint, const byte **) =
- pfont->data.string_proc;
+ pfont->data.string_proc;
byte OffsetTable[12];
uint numTables;
byte TableDirectory[MAX_NUM_TT_TABLES * 16];
@@ -155,150 +155,150 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
READ_SFNTS(pfont, 0, 12, OffsetTable);
if (!memcmp(OffsetTable, version_ttcf, 4)) {
- version = u32(OffsetTable + 4);
- if (version != 0x00010000 && version !=0x00020000) {
+ version = u32(OffsetTable + 4);
+ if (version != 0x00010000 && version !=0x00020000) {
emprintf2(pfont->memory,
- "Unknown TTC header version %08X in the font %s.\n",
+ "Unknown TTC header version %08X in the font %s.\n",
version, pfont->key_name.chars);
- return_error(gs_error_invalidfont);
- }
- numFonts = u32(OffsetTable + 8);
- if (subfontID < 0 || subfontID >= numFonts)
- return_error(gs_error_rangecheck);
- READ_SFNTS(pfont, 12 + subfontID * 4, 4, OffsetTable);
- OffsetTableOffset = u32(OffsetTable);
- READ_SFNTS(pfont, OffsetTableOffset, 12, OffsetTable);
+ return_error(gs_error_invalidfont);
+ }
+ numFonts = u32(OffsetTable + 8);
+ if (subfontID < 0 || subfontID >= numFonts)
+ return_error(gs_error_rangecheck);
+ READ_SFNTS(pfont, 12 + subfontID * 4, 4, OffsetTable);
+ OffsetTableOffset = u32(OffsetTable);
+ READ_SFNTS(pfont, OffsetTableOffset, 12, OffsetTable);
} else {
- OffsetTableOffset = 0;
+ OffsetTableOffset = 0;
}
if (memcmp(OffsetTable, version1_0, 4) &&
- memcmp(OffsetTable, version_true, 4))
- return_error(gs_error_invalidfont);
+ memcmp(OffsetTable, version_true, 4))
+ return_error(gs_error_invalidfont);
numTables = U16(OffsetTable + 4);
if (numTables > MAX_NUM_TT_TABLES)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
READ_SFNTS(pfont, OffsetTableOffset + 12, numTables * 16, TableDirectory);
/* Clear all non-client-supplied data. */
{
- void *proc_data = pfont->data.proc_data;
+ void *proc_data = pfont->data.proc_data;
- memset(&pfont->data, 0, sizeof(pfont->data));
- pfont->data.string_proc = string_proc;
- pfont->data.proc_data = proc_data;
+ memset(&pfont->data, 0, sizeof(pfont->data));
+ pfont->data.string_proc = string_proc;
+ pfont->data.proc_data = proc_data;
}
for (i = 0; i < numTables; ++i) {
- const byte *tab = TableDirectory + i * 16;
- ulong offset = u32(tab + 8);
-
- if (!memcmp(tab, "cmap", 4))
- pfont->data.cmap = offset;
- else if (!memcmp(tab, "glyf", 4)) {
- pfont->data.glyf = offset;
- glyph_size = (uint)u32(tab + 12);
- } else if (!memcmp(tab, "GSUB", 4)) {
- pfont->data.gsub_size = u32(tab + 12);
- pfont->data.gsub = gs_alloc_byte_array(pfont->memory, pfont->data.gsub_size, 1,
- "gs_type42_font_init(GSUB)");
- if (pfont->data.gsub == 0)
- return_error(gs_error_VMerror);
-
- code = gs_font_notify_register((gs_font *)pfont, gs_gsub_release, (void *)pfont);
- if (code < 0)
- return code;
-
- code = gs_type42_read_data(pfont, offset, pfont->data.gsub_size, pfont->data.gsub);
- if ( code < 0 )
- return code;
- } else if (!memcmp(tab, "head", 4)) {
- byte head[54];
-
- READ_SFNTS(pfont, offset, 54, head);
- pfont->data.unitsPerEm = U16(head + 18);
- memcpy(head_box, head + 36, 8);
- pfont->data.indexToLocFormat = U16(head + 50);
- } else if (!memcmp(tab, "hhea", 4)) {
- byte hhea[36];
-
- READ_SFNTS(pfont, offset, 36, hhea);
- pfont->data.metrics[0].numMetrics = U16(hhea + 34);
- } else if (!memcmp(tab, "hmtx", 4)) {
- pfont->data.metrics[0].offset = offset;
- pfont->data.metrics[0].length = (uint)u32(tab + 12);
- } else if (!memcmp(tab, "loca", 4)) {
- pfont->data.loca = offset;
- loca_size = u32(tab + 12);
- } else if (!memcmp(tab, "maxp", 4)) {
- byte maxp[30];
-
- READ_SFNTS(pfont, offset, 30, maxp);
- pfont->data.trueNumGlyphs = U16(maxp + 4);
- } else if (!memcmp(tab, "name", 4)) {
- pfont->data.name_offset = offset;
- } else if (!memcmp(tab, "vhea", 4)) {
- byte vhea[36];
-
- READ_SFNTS(pfont, offset, 36, vhea);
- pfont->data.metrics[1].numMetrics = U16(vhea + 34);
- } else if (!memcmp(tab, "vmtx", 4)) {
- pfont->data.metrics[1].offset = offset;
- pfont->data.metrics[1].length = (uint)u32(tab + 12);
- } else if (!memcmp(tab, "OS/2", 4)) {
- pfont->data.os2_offset = offset;
- }
+ const byte *tab = TableDirectory + i * 16;
+ ulong offset = u32(tab + 8);
+
+ if (!memcmp(tab, "cmap", 4))
+ pfont->data.cmap = offset;
+ else if (!memcmp(tab, "glyf", 4)) {
+ pfont->data.glyf = offset;
+ glyph_size = (uint)u32(tab + 12);
+ } else if (!memcmp(tab, "GSUB", 4)) {
+ pfont->data.gsub_size = u32(tab + 12);
+ pfont->data.gsub = gs_alloc_byte_array(pfont->memory, pfont->data.gsub_size, 1,
+ "gs_type42_font_init(GSUB)");
+ if (pfont->data.gsub == 0)
+ return_error(gs_error_VMerror);
+
+ code = gs_font_notify_register((gs_font *)pfont, gs_gsub_release, (void *)pfont);
+ if (code < 0)
+ return code;
+
+ code = gs_type42_read_data(pfont, offset, pfont->data.gsub_size, pfont->data.gsub);
+ if ( code < 0 )
+ return code;
+ } else if (!memcmp(tab, "head", 4)) {
+ byte head[54];
+
+ READ_SFNTS(pfont, offset, 54, head);
+ pfont->data.unitsPerEm = U16(head + 18);
+ memcpy(head_box, head + 36, 8);
+ pfont->data.indexToLocFormat = U16(head + 50);
+ } else if (!memcmp(tab, "hhea", 4)) {
+ byte hhea[36];
+
+ READ_SFNTS(pfont, offset, 36, hhea);
+ pfont->data.metrics[0].numMetrics = U16(hhea + 34);
+ } else if (!memcmp(tab, "hmtx", 4)) {
+ pfont->data.metrics[0].offset = offset;
+ pfont->data.metrics[0].length = (uint)u32(tab + 12);
+ } else if (!memcmp(tab, "loca", 4)) {
+ pfont->data.loca = offset;
+ loca_size = u32(tab + 12);
+ } else if (!memcmp(tab, "maxp", 4)) {
+ byte maxp[30];
+
+ READ_SFNTS(pfont, offset, 30, maxp);
+ pfont->data.trueNumGlyphs = U16(maxp + 4);
+ } else if (!memcmp(tab, "name", 4)) {
+ pfont->data.name_offset = offset;
+ } else if (!memcmp(tab, "vhea", 4)) {
+ byte vhea[36];
+
+ READ_SFNTS(pfont, offset, 36, vhea);
+ pfont->data.metrics[1].numMetrics = U16(vhea + 34);
+ } else if (!memcmp(tab, "vmtx", 4)) {
+ pfont->data.metrics[1].offset = offset;
+ pfont->data.metrics[1].length = (uint)u32(tab + 12);
+ } else if (!memcmp(tab, "OS/2", 4)) {
+ pfont->data.os2_offset = offset;
+ }
}
loca_size >>= pfont->data.indexToLocFormat + 1;
pfont->data.numGlyphs = (loca_size == 0 ? 0 : loca_size - 1);
if (pfont->data.numGlyphs > pfont->data.trueNumGlyphs) {
- /* Some fonts have excessive data at end of 'loca' table -
- see bug 688467.
- We're not sure why old versions of Ghostscript maintain
- two different fileds - numGlyphs and trueNumGlyphs.
- (A related comment in gxfont42.h isn't explanatory about important cases.)
- Our reading of TrueType specification and FreeType experience
- is that only trueNumGlyphs should be used.
- Maybe (I guess) sometimes somebody observed a font,
- in which trueNumGlyphs counts real glyphs,
- and numGlyphs counts all subglyphs ?
- Continue using trueNumGlyphs since the document of
- the bug 688467 fails otherwise.
- */
- /* pfont->key_name.chars is ASCIIZ due to copy_font_name. */
- char buf[gs_font_name_max + 2];
-
- if (pfont->key_name.size) {
- int l = min(sizeof(buf) - 1, pfont->key_name.size);
-
- memcpy(buf, pfont->key_name.chars, l);
- buf[l] = 0;
- } else if (pfont->font_name.size) {
- int l = min(sizeof(buf) - 1, pfont->font_name.size);
-
- memcpy(buf, pfont->font_name.chars, l);
- buf[l] = 0;
- } else
- buf[0] = 0;
-
- emprintf3(pfont->memory,
- "Warning: 'loca' length %d is greater than numGlyphs %d in the font %s.\n",
+ /* Some fonts have excessive data at end of 'loca' table -
+ see bug 688467.
+ We're not sure why old versions of Ghostscript maintain
+ two different fileds - numGlyphs and trueNumGlyphs.
+ (A related comment in gxfont42.h isn't explanatory about important cases.)
+ Our reading of TrueType specification and FreeType experience
+ is that only trueNumGlyphs should be used.
+ Maybe (I guess) sometimes somebody observed a font,
+ in which trueNumGlyphs counts real glyphs,
+ and numGlyphs counts all subglyphs ?
+ Continue using trueNumGlyphs since the document of
+ the bug 688467 fails otherwise.
+ */
+ /* pfont->key_name.chars is ASCIIZ due to copy_font_name. */
+ char buf[gs_font_name_max + 2];
+
+ if (pfont->key_name.size) {
+ int l = min(sizeof(buf) - 1, pfont->key_name.size);
+
+ memcpy(buf, pfont->key_name.chars, l);
+ buf[l] = 0;
+ } else if (pfont->font_name.size) {
+ int l = min(sizeof(buf) - 1, pfont->font_name.size);
+
+ memcpy(buf, pfont->font_name.chars, l);
+ buf[l] = 0;
+ } else
+ buf[0] = 0;
+
+ emprintf3(pfont->memory,
+ "Warning: 'loca' length %d is greater than numGlyphs %d in the font %s.\n",
pfont->data.numGlyphs + 1, pfont->data.trueNumGlyphs, buf);
- if (loca_size > pfont->data.trueNumGlyphs + 1) {
- /* Bug 689516 demonstrates a font, in which numGlyps is smaller than loca size,
- and there are useful glyphs behind maxp.numGlyphs. */
- for (i = loca_size - 1; i > pfont->data.trueNumGlyphs; i--) {
- glyph_offset = get_glyph_offset(pfont, i);
- if (glyph_offset < glyph_size)
- break;
- }
- if (i > pfont->data.trueNumGlyphs) {
- /* loca contains more good offsets, fix maxp.numGlyphs.
- Note a code below will fix bad offsets if any. */
- pfont->data.numGlyphs = pfont->data.trueNumGlyphs = loca_size - 1;
- }
- }
- pfont->data.numGlyphs = pfont->data.trueNumGlyphs;
- loca_size = pfont->data.numGlyphs + 1;
+ if (loca_size > pfont->data.trueNumGlyphs + 1) {
+ /* Bug 689516 demonstrates a font, in which numGlyps is smaller than loca size,
+ and there are useful glyphs behind maxp.numGlyphs. */
+ for (i = loca_size - 1; i > pfont->data.trueNumGlyphs; i--) {
+ glyph_offset = get_glyph_offset(pfont, i);
+ if (glyph_offset < glyph_size)
+ break;
+ }
+ if (i > pfont->data.trueNumGlyphs) {
+ /* loca contains more good offsets, fix maxp.numGlyphs.
+ Note a code below will fix bad offsets if any. */
+ pfont->data.numGlyphs = pfont->data.trueNumGlyphs = loca_size - 1;
+ }
+ }
+ pfont->data.numGlyphs = pfont->data.trueNumGlyphs;
+ loca_size = pfont->data.numGlyphs + 1;
}
pfont->data.warning_patented = false;
@@ -308,103 +308,103 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
pfont->procs.enumerate_glyph = gs_type42_enumerate_glyph;
pfont->procs.font_info = gs_type42_font_info;
- /* default data.get routines require a ram version of a ttf file */
+ /* default data.get routines require a ram version of a ttf file */
pfont->data.get_glyph_index = default_get_glyph_index;
pfont->data.get_outline = default_get_outline;
pfont->data.get_metrics = gs_type42_default_get_metrics;
if (pfont->FontType == ft_CID_TrueType && pfont->is_resource) {
- /* This font was load with .load_tt_font_stripped,
- (it's only the case when bf_has_font_file is set because font file
- presents with True Type - see zbuildfont11).
- Can't use get_glyph_offset because 'loca' does not present in sfnt.
- So we skip the unsorted 'loca' check.
-
- A better way would be to perform the unsorted loca check
- after glyph cache is initialized in zbuildfont11 with gs_glyph_cache__alloc.
- But we're doing this fix under a rush of 8.63 release,
- so have no time for deeper changes.
- */
- pfont->data.len_glyphs = NULL;
+ /* This font was load with .load_tt_font_stripped,
+ (it's only the case when bf_has_font_file is set because font file
+ presents with True Type - see zbuildfont11).
+ Can't use get_glyph_offset because 'loca' does not present in sfnt.
+ So we skip the unsorted 'loca' check.
+
+ A better way would be to perform the unsorted loca check
+ after glyph cache is initialized in zbuildfont11 with gs_glyph_cache__alloc.
+ But we're doing this fix under a rush of 8.63 release,
+ so have no time for deeper changes.
+ */
+ pfont->data.len_glyphs = NULL;
} else {
- /* Now build the len_glyphs array since 'loca' may not be properly sorted */
- pfont->data.len_glyphs = (uint *)gs_alloc_byte_array(pfont->memory, loca_size, sizeof(uint),
- "gs_type42_font_init");
- if (pfont->data.len_glyphs == 0)
- return_error(gs_error_VMerror);
- code = gs_font_notify_register((gs_font *)pfont, gs_len_glyphs_release, (void *)pfont);
- if (code < 0)
- return code;
-
- /* The 'loca' may not be in order, so we construct a glyph length array */
- /* Since 'loca' is usually sorted, first try the simple linear scan to */
- /* avoid the need to perform the more expensive process. */
- glyph_start = get_glyph_offset(pfont, 0);
- for (i = 1; i < loca_size; i++) {
- glyph_offset = get_glyph_offset(pfont, i);
- glyph_length = glyph_offset - glyph_start;
- if (glyph_length > 0x80000000)
- break;
- if (glyph_offset > glyph_size)
- break;
- /* out of order loca */
- pfont->data.len_glyphs[i - 1] = glyph_length;
- glyph_start = glyph_offset;
- }
- if (i < loca_size) {
- /*
- * loca was out of order, build the len_glyphs the hard way.
- * For each glyph, we use the next higher or equal
- * glyph offset to compute the glyph length.
- * It assumes no overlapping and no duplicate glyphs.
- */
- ulong last_glyph_offset = glyph_size;
- ulong num_valid_loca_elm = loca_size;
- long last_offset = 0;
- gs_type42_font_init_sort_t *psort;
- gs_type42_font_init_sort_t *psortary =
- (gs_type42_font_init_sort_t *)gs_alloc_byte_array(pfont->memory,
- loca_size, sizeof(gs_type42_font_init_sort_t), "gs_type42_font_init(sort loca)");
-
- if (psortary == 0)
- return_error(gs_error_VMerror);
- /* loca_size > 0 due to condition above, so we always have the 0th element. */
- psortary->glyph_num = 0;
- psortary->glyph_offset = get_glyph_offset(pfont, 0);
- for (i = 1, psort = psortary + 1; i < loca_size; i++, psort++) {
- psort->glyph_num = i;
- psort->glyph_offset = get_glyph_offset(pfont, i);
- psort[-1].glyph_length = psort->glyph_offset - last_offset;
- last_offset = psort->glyph_offset;
- }
- psort[-1].glyph_length = 0; /* Dummy element. */
- qsort(psortary, loca_size, sizeof(gs_type42_font_init_sort_t), gs_type42_font_init_compare);
- while (num_valid_loca_elm > 0 && psortary[num_valid_loca_elm - 1].glyph_offset > glyph_size)
- num_valid_loca_elm --;
- if (0 == num_valid_loca_elm)
- return_error(gs_error_invalidfont);
- for (i = num_valid_loca_elm; i--;) {
- long old_length;
-
- psort = psortary + i;
- old_length = psort->glyph_length;
- if (old_length < 0 || old_length > 2000 /* arbitrary */) {
- pfont->data.len_glyphs[psort->glyph_num] = last_glyph_offset - psort->glyph_offset;
- /* Note the new length may be so big as old_length. */
- } else
- pfont->data.len_glyphs[psort->glyph_num] = old_length;
- last_glyph_offset = psort->glyph_offset;
- }
- for (i = num_valid_loca_elm; i < loca_size; i++) {
- psort = psortary + i;
- pfont->data.len_glyphs[psort->glyph_num] = 0;
- }
- /* Well the last element of len_glyphs is never used.
- We compute it because we're interesting whether it is not zero sometimes.
- To know that, set a conditional breakpoint at the next statement.
- */
- gs_free_object(pfont->memory, psortary, "gs_type42_font_init(sort loca)");
- }
+ /* Now build the len_glyphs array since 'loca' may not be properly sorted */
+ pfont->data.len_glyphs = (uint *)gs_alloc_byte_array(pfont->memory, loca_size, sizeof(uint),
+ "gs_type42_font_init");
+ if (pfont->data.len_glyphs == 0)
+ return_error(gs_error_VMerror);
+ code = gs_font_notify_register((gs_font *)pfont, gs_len_glyphs_release, (void *)pfont);
+ if (code < 0)
+ return code;
+
+ /* The 'loca' may not be in order, so we construct a glyph length array */
+ /* Since 'loca' is usually sorted, first try the simple linear scan to */
+ /* avoid the need to perform the more expensive process. */
+ glyph_start = get_glyph_offset(pfont, 0);
+ for (i = 1; i < loca_size; i++) {
+ glyph_offset = get_glyph_offset(pfont, i);
+ glyph_length = glyph_offset - glyph_start;
+ if (glyph_length > 0x80000000)
+ break;
+ if (glyph_offset > glyph_size)
+ break;
+ /* out of order loca */
+ pfont->data.len_glyphs[i - 1] = glyph_length;
+ glyph_start = glyph_offset;
+ }
+ if (i < loca_size) {
+ /*
+ * loca was out of order, build the len_glyphs the hard way.
+ * For each glyph, we use the next higher or equal
+ * glyph offset to compute the glyph length.
+ * It assumes no overlapping and no duplicate glyphs.
+ */
+ ulong last_glyph_offset = glyph_size;
+ ulong num_valid_loca_elm = loca_size;
+ long last_offset = 0;
+ gs_type42_font_init_sort_t *psort;
+ gs_type42_font_init_sort_t *psortary =
+ (gs_type42_font_init_sort_t *)gs_alloc_byte_array(pfont->memory,
+ loca_size, sizeof(gs_type42_font_init_sort_t), "gs_type42_font_init(sort loca)");
+
+ if (psortary == 0)
+ return_error(gs_error_VMerror);
+ /* loca_size > 0 due to condition above, so we always have the 0th element. */
+ psortary->glyph_num = 0;
+ psortary->glyph_offset = get_glyph_offset(pfont, 0);
+ for (i = 1, psort = psortary + 1; i < loca_size; i++, psort++) {
+ psort->glyph_num = i;
+ psort->glyph_offset = get_glyph_offset(pfont, i);
+ psort[-1].glyph_length = psort->glyph_offset - last_offset;
+ last_offset = psort->glyph_offset;
+ }
+ psort[-1].glyph_length = 0; /* Dummy element. */
+ qsort(psortary, loca_size, sizeof(gs_type42_font_init_sort_t), gs_type42_font_init_compare);
+ while (num_valid_loca_elm > 0 && psortary[num_valid_loca_elm - 1].glyph_offset > glyph_size)
+ num_valid_loca_elm --;
+ if (0 == num_valid_loca_elm)
+ return_error(gs_error_invalidfont);
+ for (i = num_valid_loca_elm; i--;) {
+ long old_length;
+
+ psort = psortary + i;
+ old_length = psort->glyph_length;
+ if (old_length < 0 || old_length > 2000 /* arbitrary */) {
+ pfont->data.len_glyphs[psort->glyph_num] = last_glyph_offset - psort->glyph_offset;
+ /* Note the new length may be so big as old_length. */
+ } else
+ pfont->data.len_glyphs[psort->glyph_num] = old_length;
+ last_glyph_offset = psort->glyph_offset;
+ }
+ for (i = num_valid_loca_elm; i < loca_size; i++) {
+ psort = psortary + i;
+ pfont->data.len_glyphs[psort->glyph_num] = 0;
+ }
+ /* Well the last element of len_glyphs is never used.
+ We compute it because we're interesting whether it is not zero sometimes.
+ To know that, set a conditional breakpoint at the next statement.
+ */
+ gs_free_object(pfont->memory, psortary, "gs_type42_font_init(sort loca)");
+ }
}
/*
* If the font doesn't have a valid FontBBox, compute one from the
@@ -413,16 +413,16 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
* here.
*/
if (pfont->FontBBox.p.x >= pfont->FontBBox.q.x ||
- pfont->FontBBox.p.y >= pfont->FontBBox.q.y ||
- pfont->FontBBox.p.x < -0.5 || pfont->FontBBox.p.x > 0.5 ||
- pfont->FontBBox.p.y < -0.5 || pfont->FontBBox.p.y > 0.5
- ) {
- float upem = (float)pfont->data.unitsPerEm;
-
- pfont->FontBBox.p.x = S16(head_box) / upem;
- pfont->FontBBox.p.y = S16(head_box + 2) / upem;
- pfont->FontBBox.q.x = S16(head_box + 4) / upem;
- pfont->FontBBox.q.y = S16(head_box + 6) / upem;
+ pfont->FontBBox.p.y >= pfont->FontBBox.q.y ||
+ pfont->FontBBox.p.x < -0.5 || pfont->FontBBox.p.x > 0.5 ||
+ pfont->FontBBox.p.y < -0.5 || pfont->FontBBox.p.y > 0.5
+ ) {
+ float upem = (float)pfont->data.unitsPerEm;
+
+ pfont->FontBBox.p.x = S16(head_box) / upem;
+ pfont->FontBBox.p.y = S16(head_box + 2) / upem;
+ pfont->FontBBox.q.x = S16(head_box + 4) / upem;
+ pfont->FontBBox.q.y = S16(head_box + 6) / upem;
}
pfont->data.warning_patented = false;
pfont->data.warning_bad_instruction = false;
@@ -438,7 +438,7 @@ gs_type42_font_init(gs_font_type42 * pfont, int subfontID)
int
gs_len_glyphs_release(void *data, void *event)
-{
+{
gs_font_type42 *pfont = (gs_font_type42 *)data;
gs_font_notify_unregister((gs_font *)pfont, gs_len_glyphs_release, (void *)data);
@@ -448,7 +448,7 @@ gs_len_glyphs_release(void *data, void *event)
int
gs_gsub_release(void *data, void *event)
-{
+{
gs_font_type42 *pfont = (gs_font_type42 *)data;
gs_font_notify_unregister((gs_font *)pfont, gs_gsub_release, (void *)data);
@@ -478,59 +478,59 @@ gs_type42_parse_component(const byte **pdata, uint *pflags, gs_matrix_fixed *psm
gdata += 4;
mat = *pmat;
if (flags & TT_CG_ARGS_ARE_XY_VALUES) {
- int arg1, arg2;
- gs_fixed_point pt;
-
- if (flags & TT_CG_ARGS_ARE_WORDS)
- arg1 = S16(gdata), arg2 = S16(gdata + 2), gdata += 4;
- else
- arg1 = S8(gdata), arg2 = S8(gdata + 1), gdata += 2;
- if (flags & TT_CG_ROUND_XY_TO_GRID) {
- /* We should do something here, but we don't. */
- }
- gs_point_transform2fixed(pmat, arg1 * factor,
- arg2 * factor, &pt);
- /****** HACK: WE KNOW ABOUT FIXED MATRICES ******/
- mat.tx = fixed2float(mat.tx_fixed = pt.x);
- mat.ty = fixed2float(mat.ty_fixed = pt.y);
- if (pmp)
- pmp[0] = pmp[1] = -1;
+ int arg1, arg2;
+ gs_fixed_point pt;
+
+ if (flags & TT_CG_ARGS_ARE_WORDS)
+ arg1 = S16(gdata), arg2 = S16(gdata + 2), gdata += 4;
+ else
+ arg1 = S8(gdata), arg2 = S8(gdata + 1), gdata += 2;
+ if (flags & TT_CG_ROUND_XY_TO_GRID) {
+ /* We should do something here, but we don't. */
+ }
+ gs_point_transform2fixed(pmat, arg1 * factor,
+ arg2 * factor, &pt);
+ /****** HACK: WE KNOW ABOUT FIXED MATRICES ******/
+ mat.tx = fixed2float(mat.tx_fixed = pt.x);
+ mat.ty = fixed2float(mat.ty_fixed = pt.y);
+ if (pmp)
+ pmp[0] = pmp[1] = -1;
} else {
- if (flags & TT_CG_ARGS_ARE_WORDS) {
- if (pmp)
- pmp[0] = U16(gdata), pmp[1] = S16(gdata + 2);
- gdata += 4;
- } else {
- if (pmp)
- pmp[0] = U8(gdata), pmp[1] = U8(gdata + 1);
- gdata += 2;
- }
+ if (flags & TT_CG_ARGS_ARE_WORDS) {
+ if (pmp)
+ pmp[0] = U16(gdata), pmp[1] = S16(gdata + 2);
+ gdata += 4;
+ } else {
+ if (pmp)
+ pmp[0] = U8(gdata), pmp[1] = U8(gdata + 1);
+ gdata += 2;
+ }
}
#define S2_14(p) (S16(p) / 16384.0)
if (flags & TT_CG_HAVE_SCALE) {
- scale_mat.xx = scale_mat.yy = S2_14(gdata);
- scale_mat.xy = scale_mat.yx = 0;
- gdata += 2;
+ scale_mat.xx = scale_mat.yy = S2_14(gdata);
+ scale_mat.xy = scale_mat.yx = 0;
+ gdata += 2;
} else if (flags & TT_CG_HAVE_XY_SCALE) {
- scale_mat.xx = S2_14(gdata);
- scale_mat.yy = S2_14(gdata + 2);
- scale_mat.xy = scale_mat.yx = 0;
- gdata += 4;
+ scale_mat.xx = S2_14(gdata);
+ scale_mat.yy = S2_14(gdata + 2);
+ scale_mat.xy = scale_mat.yx = 0;
+ gdata += 4;
} else if (flags & TT_CG_HAVE_2X2) {
- scale_mat.xx = S2_14(gdata);
- scale_mat.xy = S2_14(gdata + 2);
- scale_mat.yx = S2_14(gdata + 4);
- scale_mat.yy = S2_14(gdata + 6);
- gdata += 8;
+ scale_mat.xx = S2_14(gdata);
+ scale_mat.xy = S2_14(gdata + 2);
+ scale_mat.yx = S2_14(gdata + 4);
+ scale_mat.yy = S2_14(gdata + 6);
+ gdata += 8;
} else
- goto no_scale;
+ goto no_scale;
#undef S2_14
scale_mat.tx = 0;
scale_mat.ty = 0;
/* The scale doesn't affect mat.t{x,y}, so we don't */
/* need to update the fixed components. */
gs_matrix_multiply(&scale_mat, (const gs_matrix *)&mat,
- (gs_matrix *)&mat);
+ (gs_matrix *)&mat);
no_scale:
*pdata = gdata;
*pflags = flags;
@@ -550,33 +550,33 @@ total_points(gs_font_type42 *pfont, uint glyph_index)
glyph_data.memory = pfont->memory;
ocode = pfont->data.get_outline(pfont, glyph_index, &glyph_data);
if (ocode < 0)
- return ocode;
+ return ocode;
if (glyph_data.bits.size == 0)
- return 0;
+ return 0;
gdata = glyph_data.bits.data;
if (S16(gdata) != -1) {
- /* This is a simple glyph. */
- int numContours = S16(gdata);
- const byte *pends = gdata + 10;
- const byte *pinstr = pends + numContours * 2;
+ /* This is a simple glyph. */
+ int numContours = S16(gdata);
+ const byte *pends = gdata + 10;
+ const byte *pinstr = pends + numContours * 2;
- total = (numContours == 0 ? 0 : U16(pinstr - 2) + 1);
+ total = (numContours == 0 ? 0 : U16(pinstr - 2) + 1);
} else {
- /* This is a composite glyph. Add up the components. */
- uint flags;
- gs_matrix_fixed mat;
-
- gdata += 10;
- memset(&mat, 0, sizeof(mat)); /* arbitrary */
- total = 0;
- do {
- code = total_points(pfont, U16(gdata + 2));
- if (code < 0)
- return code;
- total += code;
- gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
- }
- while (flags & TT_CG_MORE_COMPONENTS);
+ /* This is a composite glyph. Add up the components. */
+ uint flags;
+ gs_matrix_fixed mat;
+
+ gdata += 10;
+ memset(&mat, 0, sizeof(mat)); /* arbitrary */
+ total = 0;
+ do {
+ code = total_points(pfont, U16(gdata + 2));
+ if (code < 0)
+ return code;
+ total += code;
+ gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
+ }
+ while (flags & TT_CG_MORE_COMPONENTS);
}
gs_glyph_data_free(&glyph_data, "total_points");
return total;
@@ -591,7 +591,7 @@ static uint
default_get_glyph_index(gs_font_type42 *pfont, gs_glyph glyph)
{
return (glyph < GS_MIN_CID_GLYPH ? 0 : /* undefined */
- glyph - GS_MIN_CID_GLYPH);
+ glyph - GS_MIN_CID_GLYPH);
}
/* Define the default implementation for getting the outline data for */
@@ -599,47 +599,47 @@ default_get_glyph_index(gs_font_type42 *pfont, gs_glyph glyph)
/* Set pglyph->data = 0 if the glyph is empty. */
static int
default_get_outline(gs_font_type42 * pfont, uint glyph_index,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
int (*string_proc) (gs_font_type42 *, ulong, uint, const byte **) =
- pfont->data.string_proc;
+ pfont->data.string_proc;
ulong glyph_start;
uint glyph_length;
int code;
if (glyph_index >= pfont->data.trueNumGlyphs)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
glyph_start = get_glyph_offset(pfont, glyph_index);
glyph_length = pfont->data.len_glyphs[glyph_index];
if (glyph_length == 0)
- gs_glyph_data_from_null(pgd);
+ gs_glyph_data_from_null(pgd);
else {
- const byte *data;
- byte *buf;
-
- code = (*string_proc)(pfont, (ulong)(pfont->data.glyf + glyph_start),
- glyph_length, &data);
- if (code < 0)
- return code;
- if (code == 0)
- gs_glyph_data_from_string(pgd, data, glyph_length, NULL);
- else {
- /*
- * The glyph is segmented in sfnts.
- * It is not allowed with Type 42 specification.
- * Perhaps we can handle it (with a low performance),
- * making a contiguous copy.
- */
-
- /* 'code' is the returned length */
- buf = (byte *)gs_alloc_string(pgd->memory, glyph_length, "default_get_outline");
- if (buf == 0)
- return_error(gs_error_VMerror);
- gs_glyph_data_from_string(pgd, buf, glyph_length, (gs_font *)pfont);
- memcpy(buf, data, code);
- return gs_type42_read_data(pfont, pfont->data.glyf + glyph_start + code,
- glyph_length - code, buf + code);
- }
+ const byte *data;
+ byte *buf;
+
+ code = (*string_proc)(pfont, (ulong)(pfont->data.glyf + glyph_start),
+ glyph_length, &data);
+ if (code < 0)
+ return code;
+ if (code == 0)
+ gs_glyph_data_from_string(pgd, data, glyph_length, NULL);
+ else {
+ /*
+ * The glyph is segmented in sfnts.
+ * It is not allowed with Type 42 specification.
+ * Perhaps we can handle it (with a low performance),
+ * making a contiguous copy.
+ */
+
+ /* 'code' is the returned length */
+ buf = (byte *)gs_alloc_string(pgd->memory, glyph_length, "default_get_outline");
+ if (buf == 0)
+ return_error(gs_error_VMerror);
+ gs_glyph_data_from_string(pgd, buf, glyph_length, (gs_font *)pfont);
+ memcpy(buf, data, code);
+ return gs_type42_read_data(pfont, pfont->data.glyf + glyph_start + code,
+ glyph_length - code, buf + code);
+ }
}
return 0;
}
@@ -647,7 +647,7 @@ default_get_outline(gs_font_type42 * pfont, uint glyph_index,
/* Take outline data from a True Type font file. */
int
gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
uchar lbuf[8];
ulong glyph_start;
@@ -657,119 +657,119 @@ gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph
* we should cache glyph data in a buffer associated with the font.
*/
if (pfont->data.indexToLocFormat) {
- sseek(s, pfont->data.loca + glyph_index * 4);
+ sseek(s, pfont->data.loca + glyph_index * 4);
sgets(s, lbuf, 8, &count);
- if (count < 8)
- return_error(gs_error_invalidfont);
- glyph_start = u32(lbuf);
- glyph_length = u32(lbuf + 4) - glyph_start;
+ if (count < 8)
+ return_error(gs_error_invalidfont);
+ glyph_start = u32(lbuf);
+ glyph_length = u32(lbuf + 4) - glyph_start;
} else {
- sseek(s, pfont->data.loca + glyph_index * 2);
+ sseek(s, pfont->data.loca + glyph_index * 2);
sgets(s, lbuf, 4, &count);
- if (count < 4)
- return_error(gs_error_invalidfont);
- glyph_start = (ulong) U16(lbuf) << 1;
- glyph_length = ((ulong) U16(lbuf + 2) << 1) - glyph_start;
+ if (count < 4)
+ return_error(gs_error_invalidfont);
+ glyph_start = (ulong) U16(lbuf) << 1;
+ glyph_length = ((ulong) U16(lbuf + 2) << 1) - glyph_start;
}
if (glyph_length == 0)
- gs_glyph_data_from_null(pgd);
+ gs_glyph_data_from_null(pgd);
else {
- byte *buf;
+ byte *buf;
- sseek(s, pfont->data.glyf + glyph_start);
- buf = (byte *)gs_alloc_string(pgd->memory, glyph_length, "default_get_outline");
- if (buf == 0)
- return_error(gs_error_VMerror);
- gs_glyph_data_from_string(pgd, buf, glyph_length, (gs_font *)pfont);
+ sseek(s, pfont->data.glyf + glyph_start);
+ buf = (byte *)gs_alloc_string(pgd->memory, glyph_length, "default_get_outline");
+ if (buf == 0)
+ return_error(gs_error_VMerror);
+ gs_glyph_data_from_string(pgd, buf, glyph_length, (gs_font *)pfont);
sgets(s, buf, glyph_length, &count);
- if (count < glyph_length)
- return_error(gs_error_invalidfont);
+ if (count < glyph_length)
+ return_error(gs_error_invalidfont);
}
return 0;
}
uint
gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_index,
- int WMode, gs_glyph cid)
+ int WMode, gs_glyph cid)
{ /* A rough trial implementation, possibly needs improvements or optimization. */
/* Fixme: optimize : Initialize subtable_ptr when the font is defined. */
byte *gsub_ptr = pfont->data.gsub;
typedef struct GSUB_s {
- uint32_t Version;
- uint16_t ScriptList;
- uint16_t FeatureList;
- uint16_t LookupList;
+ uint32_t Version;
+ uint16_t ScriptList;
+ uint16_t FeatureList;
+ uint16_t LookupList;
} GSUB;
#if 0 /* Currently unused, but maybe useful for future. */
ulong gsub_size = pfont->data.gsub_size;
typedef struct ScriptRecord_s {
- byte Tag[4];
- uint16_t Offset; /* Offset to Script table from beginning of ScriptList */
+ byte Tag[4];
+ uint16_t Offset; /* Offset to Script table from beginning of ScriptList */
} ScriptRecord;
typedef struct ScriptList_s {
- uint16_t ScriptCount;
- ScriptRecord records[1 /* ScriptCount */];
+ uint16_t ScriptCount;
+ ScriptRecord records[1 /* ScriptCount */];
} ScriptList;
typedef struct LangSysRecord_s {
- byte Tag[4];
- uint16_t Offset; /* Offset to LangSys table from beginning of Script table */
+ byte Tag[4];
+ uint16_t Offset; /* Offset to LangSys table from beginning of Script table */
} LangSysRecord;
typedef struct ScriptTable_s {
- uint16_t DefaultLangSys;
- uint16_t LangSysCount;
- LangSysRecord records[1/* LangSysCount */];
+ uint16_t DefaultLangSys;
+ uint16_t LangSysCount;
+ LangSysRecord records[1/* LangSysCount */];
} ScriptTable;
typedef struct LangSysTable_s {
- uint16_t LookupOrder;
- uint16_t ReqFeatureIndex;
- uint16_t FeatureCount;
- uint16_t FeatureIndex[1/* FeatureCount */];
+ uint16_t LookupOrder;
+ uint16_t ReqFeatureIndex;
+ uint16_t FeatureCount;
+ uint16_t FeatureIndex[1/* FeatureCount */];
} LangSysTable;
typedef struct FeatureRecord_s {
- byte Tag[4];
- uint16_t Feature; /* Offset to Feature table from beginning of FeatureList */
+ byte Tag[4];
+ uint16_t Feature; /* Offset to Feature table from beginning of FeatureList */
} FeatureRecord;
typedef struct FeatureListTable_s {
- uint16_t FeatureCount;
- FeatureRecord records[1/* FeatureCount */];
+ uint16_t FeatureCount;
+ FeatureRecord records[1/* FeatureCount */];
} FeatureListTable;
#endif
typedef struct LookupListTable_s {
- uint16_t LookupCount;
- uint16_t Lookup[1/* LookupCount */]; /* offsets to Lookup tables-from beginning of LookupList */
+ uint16_t LookupCount;
+ uint16_t Lookup[1/* LookupCount */]; /* offsets to Lookup tables-from beginning of LookupList */
} LookupListTable;
typedef struct LookupTable_s {
- uint16_t LookupType;
- uint16_t LookupFlag;
- uint16_t SubTableCount;
- uint16_t SubTable[1/* SubTableCount */]; /* offsets to Lookup tables-from beginning of LookupList */
+ uint16_t LookupType;
+ uint16_t LookupFlag;
+ uint16_t SubTableCount;
+ uint16_t SubTable[1/* SubTableCount */]; /* offsets to Lookup tables-from beginning of LookupList */
} LookupTable;
typedef struct SingleSubstFormat1_s {
- uint16_t SubstFormat; /* ==1 */
- uint16_t Coverage; /* Offset to Coverage table-from beginning of Substitution table */
- uint16_t DeltaGlyphId;
+ uint16_t SubstFormat; /* ==1 */
+ uint16_t Coverage; /* Offset to Coverage table-from beginning of Substitution table */
+ uint16_t DeltaGlyphId;
} SingleSubstFormat1;
typedef uint16_t GlyphID;
typedef struct SingleSubstFormat2_s {
- uint16_t SubstFormat; /* ==2 */
- uint16_t Coverage; /* Offset to Coverage table-from beginning of Substitution table */
- uint16_t GlyphCount;
- GlyphID Substitute[1/* GlyphCount */];
+ uint16_t SubstFormat; /* ==2 */
+ uint16_t Coverage; /* Offset to Coverage table-from beginning of Substitution table */
+ uint16_t GlyphCount;
+ GlyphID Substitute[1/* GlyphCount */];
} SingleSubstFormat2;
typedef struct CoverageFormat1_s {
- uint16_t CoverageFormat; /* ==1 */
- uint16_t GlyphCount;
- GlyphID GlyphArray[1/*GlyphCount*/]; /* Array of GlyphIDs-in numerical order */
+ uint16_t CoverageFormat; /* ==1 */
+ uint16_t GlyphCount;
+ GlyphID GlyphArray[1/*GlyphCount*/]; /* Array of GlyphIDs-in numerical order */
} CoverageFormat1;
typedef struct RangeRecord_s {
- GlyphID Start; /* First GlyphID in the range */
- GlyphID End; /* Last GlyphID in the range */
- uint16_t StartCoverageIndex; /* Coverage Index of first GlyphID in range */
+ GlyphID Start; /* First GlyphID in the range */
+ GlyphID End; /* Last GlyphID in the range */
+ uint16_t StartCoverageIndex; /* Coverage Index of first GlyphID in range */
} RangeRecord;
typedef struct CoverageFormat2_s {
- uint16_t CoverageFormat; /* ==2 */
- uint16_t RangeCount;
- RangeRecord RangeArray[1/*RangeCount*/]; /* Array of GlyphIDs-in numerical order */
+ uint16_t CoverageFormat; /* ==2 */
+ uint16_t RangeCount;
+ RangeRecord RangeArray[1/*RangeCount*/]; /* Array of GlyphIDs-in numerical order */
} CoverageFormat2;
int i, j;
GSUB gsub;
@@ -777,7 +777,7 @@ gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_inde
byte *lookup_list_ptr;
if (WMode == 0)
- return glyph_index;
+ return glyph_index;
/* GSUB header */
gsub.Version = u32(gsub_ptr + offset_of(GSUB, Version));
@@ -788,117 +788,117 @@ gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_inde
lookup_list_ptr = gsub_ptr + gsub.LookupList;
lookup_list_table.LookupCount = U16(lookup_list_ptr + offset_of(LookupListTable, LookupCount));
for (i = 0; i < lookup_list_table.LookupCount; i++) {
- byte *lookup_table_offset_ptr = lookup_list_ptr + offset_of(LookupListTable, Lookup)
- + i * sizeof(uint16_t);
- byte *lookup_table_ptr = lookup_list_ptr + U16(lookup_table_offset_ptr);
- LookupTable lookup_table;
-
- lookup_table.LookupType = U16(lookup_table_ptr + offset_of(LookupTable, LookupType));
- lookup_table.LookupFlag = U16(lookup_table_ptr + offset_of(LookupTable, LookupFlag));
- lookup_table.SubTableCount = U16(lookup_table_ptr + offset_of(LookupTable, SubTableCount));
-
- if (lookup_table.LookupType == 1) {
- /* Currently we're interesting in Format 1 only, which is only useful
- for single glyph substitution for vertical fonts.
- We copied the logic of this choice from the CJK patch attached to bug 689304,
- and we think that it may need a further improvement. */
- byte *subtable_offset_ptr = lookup_table_ptr + offset_of(LookupTable, SubTable);
- for (j = 0; j < lookup_table.SubTableCount; j++) {
- byte *subtable_ptr = lookup_table_ptr + U16(subtable_offset_ptr + j * sizeof(uint16_t));
- uint16_t format = U16(subtable_ptr);
-
- if (format == 1) {
- SingleSubstFormat1 subst;
-
- subst.SubstFormat = format; /* Debug purpose. */
- subst.Coverage = U16(subtable_ptr + offset_of(SingleSubstFormat1, Coverage));
- subst.DeltaGlyphId = U16(subtable_ptr + offset_of(SingleSubstFormat1, DeltaGlyphId));
- } else {
- SingleSubstFormat2 subst;
- byte *coverage_ptr;
- uint16_t coverage_format;
-
- subst.SubstFormat = format; /* Debug purpose. */
- subst.Coverage = U16(subtable_ptr + offset_of(SingleSubstFormat2, Coverage));
- subst.GlyphCount = U16(subtable_ptr + offset_of(SingleSubstFormat2, GlyphCount));
- coverage_ptr = subtable_ptr + subst.Coverage;
- coverage_format = U16(coverage_ptr);
- if (coverage_format == 1) {
- CoverageFormat1 cov;
-
- cov.CoverageFormat = coverage_format; /* Debug purpose only. */
- cov.GlyphCount = U16(coverage_ptr + offset_of(CoverageFormat1, GlyphCount));
- { /* Binary search. */
- int k0 = 0, k1 = cov.GlyphCount;
-
- for (;;) {
- int k = (k0 + k1) / 2;
- GlyphID glyph = U16(coverage_ptr + offset_of(CoverageFormat1, GlyphArray)
- + sizeof(GlyphID) * k);
- if (glyph_index == glyph) {
- /* Found. */
- if (k >= cov.GlyphCount)
- break; /* Wrong data ? (not sure). */
- else {
- GlyphID new_glyph = U16(subtable_ptr + offset_of(SingleSubstFormat2, Substitute)
- + sizeof(GlyphID) * k);
-
- return new_glyph;
- }
- } else if (k0 >= k1 - 1) {
- k += 0; /* A place for breakpoint. */
- break; /* Not found. */
- } else if (glyph_index < glyph)
- k1 = k;
- else
- k0 = k + 1;
- }
- }
- } else if (coverage_format == 2) {
- CoverageFormat2 cov;
-
- cov.CoverageFormat = coverage_format; /* Debug purpose only. */
- cov.RangeCount = U16(coverage_ptr + offset_of(CoverageFormat2, RangeCount));
- { /* Binary search. */
- int k0 = 0, k1 = cov.RangeCount;
-
- for (;;) {
- int k = (k0 + k1) / 2;
- RangeRecord rr;
-
- rr.Start = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
- + sizeof(RangeRecord) * k + offset_of(RangeRecord, Start));
- rr.End = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
- + sizeof(RangeRecord) * k + offset_of(RangeRecord, End));
- rr.StartCoverageIndex = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
- + sizeof(RangeRecord) * k + offset_of(RangeRecord, StartCoverageIndex));
-
- if (rr.Start <= glyph_index && glyph_index <= rr.End) {
- /* Found. */
- if (k >= cov.RangeCount)
- break; /* Wrong data ? (not sure). */
- else {
- uint16_t subst_index = rr.StartCoverageIndex + (glyph_index - rr.Start);
- GlyphID new_glyph = U16(subtable_ptr + offset_of(SingleSubstFormat2, Substitute)
- + sizeof(GlyphID) * subst_index);
-
- return new_glyph;
- }
- } else if (k0 >= k1 - 1) {
- k += 0; /* A place for breakpoint. */
- break; /* Not found. */
- } else if (glyph_index < rr.Start)
- k1 = k;
- else
- k0 = k + 1;
- }
- }
- } else {
- /* Not implemented yet. */
- }
- }
- }
- }
+ byte *lookup_table_offset_ptr = lookup_list_ptr + offset_of(LookupListTable, Lookup)
+ + i * sizeof(uint16_t);
+ byte *lookup_table_ptr = lookup_list_ptr + U16(lookup_table_offset_ptr);
+ LookupTable lookup_table;
+
+ lookup_table.LookupType = U16(lookup_table_ptr + offset_of(LookupTable, LookupType));
+ lookup_table.LookupFlag = U16(lookup_table_ptr + offset_of(LookupTable, LookupFlag));
+ lookup_table.SubTableCount = U16(lookup_table_ptr + offset_of(LookupTable, SubTableCount));
+
+ if (lookup_table.LookupType == 1) {
+ /* Currently we're interesting in Format 1 only, which is only useful
+ for single glyph substitution for vertical fonts.
+ We copied the logic of this choice from the CJK patch attached to bug 689304,
+ and we think that it may need a further improvement. */
+ byte *subtable_offset_ptr = lookup_table_ptr + offset_of(LookupTable, SubTable);
+ for (j = 0; j < lookup_table.SubTableCount; j++) {
+ byte *subtable_ptr = lookup_table_ptr + U16(subtable_offset_ptr + j * sizeof(uint16_t));
+ uint16_t format = U16(subtable_ptr);
+
+ if (format == 1) {
+ SingleSubstFormat1 subst;
+
+ subst.SubstFormat = format; /* Debug purpose. */
+ subst.Coverage = U16(subtable_ptr + offset_of(SingleSubstFormat1, Coverage));
+ subst.DeltaGlyphId = U16(subtable_ptr + offset_of(SingleSubstFormat1, DeltaGlyphId));
+ } else {
+ SingleSubstFormat2 subst;
+ byte *coverage_ptr;
+ uint16_t coverage_format;
+
+ subst.SubstFormat = format; /* Debug purpose. */
+ subst.Coverage = U16(subtable_ptr + offset_of(SingleSubstFormat2, Coverage));
+ subst.GlyphCount = U16(subtable_ptr + offset_of(SingleSubstFormat2, GlyphCount));
+ coverage_ptr = subtable_ptr + subst.Coverage;
+ coverage_format = U16(coverage_ptr);
+ if (coverage_format == 1) {
+ CoverageFormat1 cov;
+
+ cov.CoverageFormat = coverage_format; /* Debug purpose only. */
+ cov.GlyphCount = U16(coverage_ptr + offset_of(CoverageFormat1, GlyphCount));
+ { /* Binary search. */
+ int k0 = 0, k1 = cov.GlyphCount;
+
+ for (;;) {
+ int k = (k0 + k1) / 2;
+ GlyphID glyph = U16(coverage_ptr + offset_of(CoverageFormat1, GlyphArray)
+ + sizeof(GlyphID) * k);
+ if (glyph_index == glyph) {
+ /* Found. */
+ if (k >= cov.GlyphCount)
+ break; /* Wrong data ? (not sure). */
+ else {
+ GlyphID new_glyph = U16(subtable_ptr + offset_of(SingleSubstFormat2, Substitute)
+ + sizeof(GlyphID) * k);
+
+ return new_glyph;
+ }
+ } else if (k0 >= k1 - 1) {
+ k += 0; /* A place for breakpoint. */
+ break; /* Not found. */
+ } else if (glyph_index < glyph)
+ k1 = k;
+ else
+ k0 = k + 1;
+ }
+ }
+ } else if (coverage_format == 2) {
+ CoverageFormat2 cov;
+
+ cov.CoverageFormat = coverage_format; /* Debug purpose only. */
+ cov.RangeCount = U16(coverage_ptr + offset_of(CoverageFormat2, RangeCount));
+ { /* Binary search. */
+ int k0 = 0, k1 = cov.RangeCount;
+
+ for (;;) {
+ int k = (k0 + k1) / 2;
+ RangeRecord rr;
+
+ rr.Start = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
+ + sizeof(RangeRecord) * k + offset_of(RangeRecord, Start));
+ rr.End = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
+ + sizeof(RangeRecord) * k + offset_of(RangeRecord, End));
+ rr.StartCoverageIndex = U16(coverage_ptr + offset_of(CoverageFormat2, RangeArray)
+ + sizeof(RangeRecord) * k + offset_of(RangeRecord, StartCoverageIndex));
+
+ if (rr.Start <= glyph_index && glyph_index <= rr.End) {
+ /* Found. */
+ if (k >= cov.RangeCount)
+ break; /* Wrong data ? (not sure). */
+ else {
+ uint16_t subst_index = rr.StartCoverageIndex + (glyph_index - rr.Start);
+ GlyphID new_glyph = U16(subtable_ptr + offset_of(SingleSubstFormat2, Substitute)
+ + sizeof(GlyphID) * subst_index);
+
+ return new_glyph;
+ }
+ } else if (k0 >= k1 - 1) {
+ k += 0; /* A place for breakpoint. */
+ break; /* Not found. */
+ } else if (glyph_index < rr.Start)
+ k1 = k;
+ else
+ k0 = k + 1;
+ }
+ }
+ } else {
+ /* Not implemented yet. */
+ }
+ }
+ }
+ }
}
return glyph_index;
}
@@ -906,34 +906,34 @@ gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_inde
/* Parse a glyph into pieces, if any. */
static int
parse_pieces(gs_font_type42 *pfont, gs_glyph glyph, gs_glyph *pieces,
- int *pnum_pieces)
+ int *pnum_pieces)
{
- uint glyph_index = (glyph >= GS_MIN_GLYPH_INDEX
- ? glyph - GS_MIN_GLYPH_INDEX
- : pfont->data.get_glyph_index(pfont, glyph));
+ uint glyph_index = (glyph >= GS_MIN_GLYPH_INDEX
+ ? glyph - GS_MIN_GLYPH_INDEX
+ : pfont->data.get_glyph_index(pfont, glyph));
gs_glyph_data_t glyph_data;
int code;
glyph_data.memory = pfont->memory;
code = pfont->data.get_outline(pfont, glyph_index, &glyph_data);
if (code < 0)
- return code;
+ return code;
if (glyph_data.bits.size != 0 && S16(glyph_data.bits.data) == -1) {
- /* This is a composite glyph. */
- int i = 0;
- uint flags = TT_CG_MORE_COMPONENTS;
- const byte *gdata = glyph_data.bits.data + 10;
- gs_matrix_fixed mat;
-
- memset(&mat, 0, sizeof(mat)); /* arbitrary */
- for (i = 0; flags & TT_CG_MORE_COMPONENTS; ++i) {
- if (pieces)
- pieces[i] = U16(gdata + 2) + GS_MIN_GLYPH_INDEX;
- gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
- }
- *pnum_pieces = i;
+ /* This is a composite glyph. */
+ int i = 0;
+ uint flags = TT_CG_MORE_COMPONENTS;
+ const byte *gdata = glyph_data.bits.data + 10;
+ gs_matrix_fixed mat;
+
+ memset(&mat, 0, sizeof(mat)); /* arbitrary */
+ for (i = 0; flags & TT_CG_MORE_COMPONENTS; ++i) {
+ if (pieces)
+ pieces[i] = U16(gdata + 2) + GS_MIN_GLYPH_INDEX;
+ gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
+ }
+ *pnum_pieces = i;
} else
- *pnum_pieces = 0;
+ *pnum_pieces = 0;
gs_glyph_data_free(&glyph_data, "parse_pieces");
return 0;
}
@@ -941,7 +941,7 @@ parse_pieces(gs_font_type42 *pfont, gs_glyph glyph, gs_glyph *pieces,
/* Define the font procedures for a Type 42 font. */
int
gs_type42_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
gs_font_type42 *const pfont = (gs_font_type42 *)font;
uint glyph_index;
@@ -950,7 +950,7 @@ gs_type42_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matri
gs_glyph_info_t info;
static const gs_matrix imat = { identity_matrix_body };
bool design_grid = true;
- const gs_log2_scale_point log2_scale = {0, 0};
+ const gs_log2_scale_point log2_scale = {0, 0};
/* fixme : The subpixel numbers doesn't pass through the font_proc_glyph_outline interface.
High level devices can't get a proper grid fitting with AlignToPixels = 1.
Currently font_proc_glyph_outline is only used by pdfwrite for computing a
@@ -958,143 +958,143 @@ gs_type42_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matri
We apply design grid here.
*/
cached_fm_pair *pair;
-
- if (glyph >= GS_MIN_GLYPH_INDEX)
- glyph_index = glyph - GS_MIN_GLYPH_INDEX;
+
+ if (glyph >= GS_MIN_GLYPH_INDEX)
+ glyph_index = glyph - GS_MIN_GLYPH_INDEX;
else {
- glyph_index = pfont->data.get_glyph_index(pfont, glyph);
- if (pfont->data.gsub_size) {
- if (pfont->data.substitute_glyph_index_vertical != NULL)
- glyph_index = pfont->data.substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
- else
- glyph_index = gs_type42_substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
- }
+ glyph_index = pfont->data.get_glyph_index(pfont, glyph);
+ if (pfont->data.gsub_size) {
+ if (pfont->data.substitute_glyph_index_vertical != NULL)
+ glyph_index = pfont->data.substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
+ else
+ glyph_index = gs_type42_substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
+ }
}
code = gx_lookup_fm_pair(font, pmat, &log2_scale, design_grid, &pair);
if (code < 0)
- return code;
+ return code;
if (pmat == 0)
- pmat = &imat;
+ pmat = &imat;
if ((code = gx_path_current_point(ppath, &origin)) < 0 ||
- (code = append_outline_fitted(glyph_index, pmat, ppath, pair,
- &log2_scale, design_grid)) < 0 ||
- (code = font->procs.glyph_info(font, glyph, pmat,
- GLYPH_INFO_WIDTH0 << WMode, &info)) < 0
- )
- return code;
+ (code = append_outline_fitted(glyph_index, pmat, ppath, pair,
+ &log2_scale, design_grid)) < 0 ||
+ (code = font->procs.glyph_info(font, glyph, pmat,
+ GLYPH_INFO_WIDTH0 << WMode, &info)) < 0
+ )
+ return code;
return gx_path_add_point(ppath, origin.x + float2fixed(info.width[WMode].x),
- origin.y + float2fixed(info.width[WMode].y));
+ origin.y + float2fixed(info.width[WMode].y));
}
/* Get glyph info by glyph index. */
int
gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info, uint glyph_index)
+ int members, gs_glyph_info_t *info, uint glyph_index)
{
gs_font_type42 *const pfont = (gs_font_type42 *)font;
int default_members =
- members & ~(GLYPH_INFO_WIDTHS | GLYPH_INFO_NUM_PIECES |
- GLYPH_INFO_PIECES | GLYPH_INFO_OUTLINE_WIDTHS |
- GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1);
+ members & ~(GLYPH_INFO_WIDTHS | GLYPH_INFO_NUM_PIECES |
+ GLYPH_INFO_PIECES | GLYPH_INFO_OUTLINE_WIDTHS |
+ GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1);
gs_glyph_data_t outline;
int code = 0;
outline.memory = pfont->memory;
if (default_members) {
- code = gs_default_glyph_info(font, glyph, pmat, default_members, info);
+ code = gs_default_glyph_info(font, glyph, pmat, default_members, info);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
} else if ((code = pfont->data.get_outline(pfont, glyph_index, &outline)) < 0)
- return code; /* non-existent glyph */
+ return code; /* non-existent glyph */
else {
- gs_glyph_data_free(&outline, "gs_type42_glyph_info");
- info->members = 0;
+ gs_glyph_data_free(&outline, "gs_type42_glyph_info");
+ info->members = 0;
}
if (members & GLYPH_INFO_WIDTHS) {
- int i;
-
- for (i = 0; i < 2; ++i)
- if (members & (GLYPH_INFO_WIDTH0 << i)) {
- float sbw[4];
-
- code = pfont->data.get_metrics(pfont, glyph_index, i, sbw);
- if (code < 0) {
- code = 0;
- continue;
- }
- if (pmat) {
- code = gs_point_transform(sbw[2], sbw[3], pmat,
- &info->width[i]);
- if (code < 0)
- return code;
- code = gs_point_transform(sbw[0], sbw[1], pmat,
- &info->v);
- } else {
- info->width[i].x = sbw[2], info->width[i].y = sbw[3];
- info->v.x = sbw[0], info->v.y = sbw[1];
- }
- info->members |= (GLYPH_INFO_VVECTOR0 << i);
- info->members |= (GLYPH_INFO_WIDTH << i);
- }
-
+ int i;
+
+ for (i = 0; i < 2; ++i)
+ if (members & (GLYPH_INFO_WIDTH0 << i)) {
+ float sbw[4];
+
+ code = pfont->data.get_metrics(pfont, glyph_index, i, sbw);
+ if (code < 0) {
+ code = 0;
+ continue;
+ }
+ if (pmat) {
+ code = gs_point_transform(sbw[2], sbw[3], pmat,
+ &info->width[i]);
+ if (code < 0)
+ return code;
+ code = gs_point_transform(sbw[0], sbw[1], pmat,
+ &info->v);
+ } else {
+ info->width[i].x = sbw[2], info->width[i].y = sbw[3];
+ info->v.x = sbw[0], info->v.y = sbw[1];
+ }
+ info->members |= (GLYPH_INFO_VVECTOR0 << i);
+ info->members |= (GLYPH_INFO_WIDTH << i);
+ }
+
}
if (members & (GLYPH_INFO_NUM_PIECES | GLYPH_INFO_PIECES)) {
- gs_glyph *pieces =
- (members & GLYPH_INFO_PIECES ? info->pieces : (gs_glyph *)0);
- int code = parse_pieces(pfont, glyph, pieces, &info->num_pieces);
+ gs_glyph *pieces =
+ (members & GLYPH_INFO_PIECES ? info->pieces : (gs_glyph *)0);
+ int code = parse_pieces(pfont, glyph, pieces, &info->num_pieces);
- if (code < 0)
- return code;
- info->members |= members & (GLYPH_INFO_NUM_PIECES | GLYPH_INFO_PIECES);
+ if (code < 0)
+ return code;
+ info->members |= members & (GLYPH_INFO_NUM_PIECES | GLYPH_INFO_PIECES);
}
return code;
}
int
gs_type42_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
gs_font_type42 *const pfont = (gs_font_type42 *)font;
uint glyph_index;
-
+
if (glyph >= GS_MIN_GLYPH_INDEX)
- glyph_index = glyph - GS_MIN_GLYPH_INDEX;
+ glyph_index = glyph - GS_MIN_GLYPH_INDEX;
else {
- glyph_index = pfont->data.get_glyph_index(pfont, glyph);
- if (glyph_index == GS_NO_GLYPH)
- return_error(gs_error_undefined);
- if (pfont->data.gsub_size) {
- int WMode = ((members & (GLYPH_INFO_WIDTH1 | GLYPH_INFO_VVECTOR1)) ? 1 : 0);
-
- if (pfont->data.substitute_glyph_index_vertical != NULL)
- glyph_index = pfont->data.substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
- else
- glyph_index = gs_type42_substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
- }
+ glyph_index = pfont->data.get_glyph_index(pfont, glyph);
+ if (glyph_index == GS_NO_GLYPH)
+ return_error(gs_error_undefined);
+ if (pfont->data.gsub_size) {
+ int WMode = ((members & (GLYPH_INFO_WIDTH1 | GLYPH_INFO_VVECTOR1)) ? 1 : 0);
+
+ if (pfont->data.substitute_glyph_index_vertical != NULL)
+ glyph_index = pfont->data.substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
+ else
+ glyph_index = gs_type42_substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
+ }
}
return gs_type42_glyph_info_by_gid(font, glyph, pmat, members, info, glyph_index);
}
int
gs_type42_enumerate_glyph(gs_font *font, int *pindex,
- gs_glyph_space_t glyph_space, gs_glyph *pglyph)
+ gs_glyph_space_t glyph_space, gs_glyph *pglyph)
{
gs_font_type42 *const pfont = (gs_font_type42 *)font;
while (++*pindex <= pfont->data.numGlyphs) {
- gs_glyph_data_t outline;
- uint glyph_index = *pindex - 1;
- int code;
-
- outline.memory = pfont->memory;
- code = pfont->data.get_outline(pfont, glyph_index, &outline);
- if (code < 0)
- return code;
- if (outline.bits.data == 0)
- continue; /* empty (undefined) glyph */
- *pglyph = glyph_index + GS_MIN_GLYPH_INDEX;
- gs_glyph_data_free(&outline, "gs_type42_enumerate_glyph");
- return 0;
+ gs_glyph_data_t outline;
+ uint glyph_index = *pindex - 1;
+ int code;
+
+ outline.memory = pfont->memory;
+ code = pfont->data.get_outline(pfont, glyph_index, &outline);
+ if (code < 0)
+ return code;
+ if (outline.bits.data == 0)
+ continue; /* empty (undefined) glyph */
+ *pglyph = glyph_index + GS_MIN_GLYPH_INDEX;
+ gs_glyph_data_free(&outline, "gs_type42_enumerate_glyph");
+ return 0;
}
/* We are done. */
*pindex = 0;
@@ -1104,7 +1104,7 @@ gs_type42_enumerate_glyph(gs_font *font, int *pindex,
/* Get the metrics of a simple glyph. */
static int
simple_glyph_metrics(gs_font_type42 * pfont, uint glyph_index, int wmode,
- float sbw[4])
+ float sbw[4])
{
double factor = 1.0 / pfont->data.unitsPerEm;
uint width;
@@ -1112,47 +1112,47 @@ simple_glyph_metrics(gs_font_type42 * pfont, uint glyph_index, int wmode,
int code;
{
- const gs_type42_mtx_t *pmtx = &pfont->data.metrics[wmode];
- uint num_metrics = pmtx->numMetrics;
- byte pmetrics[4];
-
- if (pmtx->length == 0)
- return_error(gs_error_rangecheck);
- if (glyph_index < num_metrics) {
- READ_SFNTS(pfont, pmtx->offset + glyph_index * 4, 4, pmetrics);
- width = U16(pmetrics);
- lsb = S16(pmetrics + 2);
- } else {
- uint offset = pmtx->offset + num_metrics * 4;
- uint glyph_offset = (glyph_index - num_metrics) * 2;
- byte plsb[2];
-
- READ_SFNTS(pfont, offset - 4, 4, pmetrics);
- width = U16(pmetrics);
- if (glyph_offset >= pmtx->length)
- glyph_offset = pmtx->length - 2;
- READ_SFNTS(pfont, offset + glyph_offset, 2, plsb);
- lsb = S16(plsb);
- }
+ const gs_type42_mtx_t *pmtx = &pfont->data.metrics[wmode];
+ uint num_metrics = pmtx->numMetrics;
+ byte pmetrics[4];
+
+ if (pmtx->length == 0)
+ return_error(gs_error_rangecheck);
+ if (glyph_index < num_metrics) {
+ READ_SFNTS(pfont, pmtx->offset + glyph_index * 4, 4, pmetrics);
+ width = U16(pmetrics);
+ lsb = S16(pmetrics + 2);
+ } else {
+ uint offset = pmtx->offset + num_metrics * 4;
+ uint glyph_offset = (glyph_index - num_metrics) * 2;
+ byte plsb[2];
+
+ READ_SFNTS(pfont, offset - 4, 4, pmetrics);
+ width = U16(pmetrics);
+ if (glyph_offset >= pmtx->length)
+ glyph_offset = pmtx->length - 2;
+ READ_SFNTS(pfont, offset + glyph_offset, 2, plsb);
+ lsb = S16(plsb);
+ }
}
if (wmode) {
- factor = -factor; /* lsb and width go down the page */
- sbw[0] = 0, sbw[1] = lsb * factor;
- sbw[2] = 0, sbw[3] = width * factor;
+ factor = -factor; /* lsb and width go down the page */
+ sbw[0] = 0, sbw[1] = lsb * factor;
+ sbw[2] = 0, sbw[3] = width * factor;
} else {
- sbw[0] = lsb * factor, sbw[1] = 0;
- sbw[2] = width * factor, sbw[3] = 0;
+ sbw[0] = lsb * factor, sbw[1] = 0;
+ sbw[2] = width * factor, sbw[3] = 0;
}
return 0;
}
-/* Export the default get_metrics procedure.
+/* Export the default get_metrics procedure.
The length of sbw is >=4 when bbox in not requested,
and 8 otherwise.
*/
int
gs_type42_default_get_metrics(gs_font_type42 * pfont, uint glyph_index,
- gs_type42_metrics_options_t options, float sbw[4])
+ gs_type42_metrics_options_t options, float sbw[4])
{
gs_glyph_data_t glyph_data;
int code;
@@ -1164,41 +1164,41 @@ gs_type42_default_get_metrics(gs_font_type42 * pfont, uint glyph_index,
glyph_data.memory = pfont->memory;
code = pfont->data.get_outline(pfont, glyph_index, &glyph_data);
if (code < 0)
- return code;
+ return code;
if (bbox_requested) {
- if (glyph_data.bits.size >= 10 && bbox_requested) {
- /* Note: The glyph bbox usn't useful for Dynalab fonts,
- which stretch subglyphs. Therefore we don't
- process subglyphs here. */
- double factor = 1.0 / pfont->data.unitsPerEm;
-
- sbw[4] = S16(glyph_data.bits.data + 2) * factor;
- sbw[5] = S16(glyph_data.bits.data + 4) * factor;
- sbw[6] = S16(glyph_data.bits.data + 6) * factor;
- sbw[7] = S16(glyph_data.bits.data + 8) * factor;
- } else
- sbw[4] = sbw[5] = sbw[6] = sbw[7] = 0;
+ if (glyph_data.bits.size >= 10 && bbox_requested) {
+ /* Note: The glyph bbox usn't useful for Dynalab fonts,
+ which stretch subglyphs. Therefore we don't
+ process subglyphs here. */
+ double factor = 1.0 / pfont->data.unitsPerEm;
+
+ sbw[4] = S16(glyph_data.bits.data + 2) * factor;
+ sbw[5] = S16(glyph_data.bits.data + 4) * factor;
+ sbw[6] = S16(glyph_data.bits.data + 6) * factor;
+ sbw[7] = S16(glyph_data.bits.data + 8) * factor;
+ } else
+ sbw[4] = sbw[5] = sbw[6] = sbw[7] = 0;
}
if (sbw_requested) {
- if (glyph_data.bits.size != 0 && S16(glyph_data.bits.data) == -1) {
- /* This is a composite glyph. */
- uint flags;
- const byte *gdata = glyph_data.bits.data + 10;
- gs_matrix_fixed mat;
+ if (glyph_data.bits.size != 0 && S16(glyph_data.bits.data) == -1) {
+ /* This is a composite glyph. */
+ uint flags;
+ const byte *gdata = glyph_data.bits.data + 10;
+ gs_matrix_fixed mat;
- memset(&mat, 0, sizeof(mat)); /* arbitrary */
- do {
- uint comp_index = U16(gdata + 2);
+ memset(&mat, 0, sizeof(mat)); /* arbitrary */
+ do {
+ uint comp_index = U16(gdata + 2);
- gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
+ gs_type42_parse_component(&gdata, &flags, &mat, NULL, pfont, &mat);
if (flags & TT_CG_USE_MY_METRICS) {
result = pfont->data.get_metrics(pfont, comp_index, wmode, sbw);
goto done;
- }
- }
- while (flags & TT_CG_MORE_COMPONENTS);
- }
- result = simple_glyph_metrics(pfont, glyph_index, wmode, sbw);
+ }
+ }
+ while (flags & TT_CG_MORE_COMPONENTS);
+ }
+ result = simple_glyph_metrics(pfont, glyph_index, wmode, sbw);
}
done:
gs_glyph_data_free(&glyph_data, "gs_type42_default_get_metrics");
@@ -1206,7 +1206,7 @@ gs_type42_default_get_metrics(gs_font_type42 * pfont, uint glyph_index,
}
int
gs_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
- float sbw[4])
+ float sbw[4])
{
return pfont->data.get_metrics(pfont, glyph_index, pfont->WMode, sbw);
}
@@ -1225,36 +1225,36 @@ gs_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
/* Note that this does not append the final moveto for the width. */
int
gs_type42_append(uint glyph_index, gs_state * pgs,
- gx_path * ppath, gs_text_enum_t *penum, gs_font *pfont,
- bool charpath_flag)
+ gx_path * ppath, gs_text_enum_t *penum, gs_font *pfont,
+ bool charpath_flag)
{
const gs_log2_scale_point * pscale = &penum->log2_scale;
cached_fm_pair *pair = penum->pair;
- int code = append_outline_fitted(glyph_index, &ctm_only(pgs), ppath,
- pair, pscale, charpath_flag);
+ int code = append_outline_fitted(glyph_index, &ctm_only(pgs), ppath,
+ pair, pscale, charpath_flag);
if (code < 0) {
- if (pgs->in_cachedevice == CACHE_DEVICE_CACHING) {
- /* Perform the cache cleanup, when the cached character data
- has been allocated (gx_alloc_char_bits) but
- the character has not been added to the cache (gx_add_cached_char)
- due to a falure in the character renderer.
- */
- gs_show_enum *const penum_s = (gs_show_enum *)penum;
-
- if (penum_s->cc != NULL) {
- gx_free_cached_char(pfont->dir, penum_s->cc);
- penum_s->cc = NULL;
- }
- }
- return code;
+ if (pgs->in_cachedevice == CACHE_DEVICE_CACHING) {
+ /* Perform the cache cleanup, when the cached character data
+ has been allocated (gx_alloc_char_bits) but
+ the character has not been added to the cache (gx_add_cached_char)
+ due to a falure in the character renderer.
+ */
+ gs_show_enum *const penum_s = (gs_show_enum *)penum;
+
+ if (penum_s->cc != NULL) {
+ gx_free_cached_char(pfont->dir, penum_s->cc);
+ penum_s->cc = NULL;
+ }
+ }
+ return code;
}
code = gx_setcurrentpoint_from_path((gs_imager_state *)pgs, ppath);
if (code < 0)
- return code;
+ return code;
/* Set the flatness for curve rendering. */
- return gs_imager_setflat((gs_imager_state *)pgs,
- gs_char_flatness((gs_imager_state *)pgs, 1.0));
+ return gs_imager_setflat((gs_imager_state *)pgs,
+ gs_char_flatness((gs_imager_state *)pgs, 1.0));
}
#if 0
/* Used only by add_simple below, which has been removed as unused. */
@@ -1264,7 +1264,7 @@ add_quadratic_curve(gx_path * const ppath, const gs_fixed_point * const a,
const gs_fixed_point * const b, const gs_fixed_point * const c)
{
return gx_path_add_curve(ppath, (a->x + 2*b->x)/3, (a->y + 2*b->y)/3,
- (c->x + 2*b->x)/3, (c->y + 2*b->y)/3, c->x, c->y);
+ (c->x + 2*b->x)/3, (c->y + 2*b->y)/3, c->x, c->y);
}
#endif
#if 0
@@ -1275,8 +1275,8 @@ add_quadratic_curve(gx_path * const ppath, const gs_fixed_point * const a,
*/
static int
append_simple(const byte *gdata, float sbw[4], const gs_matrix_fixed *pmat,
- gx_path *ppath, gs_fixed_point *ppts, gs_font_type42 * pfont,
- bool subglyph)
+ gx_path *ppath, gs_fixed_point *ppts, gs_font_type42 * pfont,
+ bool subglyph)
{
int numContours = S16(gdata);
const byte *pends = gdata + 10;
@@ -1287,181 +1287,181 @@ append_simple(const byte *gdata, float sbw[4], const gs_matrix_fixed *pmat,
int code;
if (numContours == 0)
- return 0;
+ return 0;
/*
* It appears that the only way to find the X and Y coordinate
* tables is to parse the flags. If this is true, it is an
* incredible piece of bad design.
*/
{
- const byte *pf = pflags = pinstr + 2 + U16(pinstr);
- uint xbytes = npoints = U16(pinstr - 2) + 1;
- uint np = npoints;
-
- while (np > 0) {
- byte flags = *pf++;
- uint reps = (flags & gf_Repeat ? *pf++ + 1 : 1);
-
- if (!(flags & gf_xShort)) {
- if (flags & gf_xSame)
- xbytes -= reps;
- else
- xbytes += reps;
- }
- np -= reps;
- }
- pxc = pf;
- pyc = pxc + xbytes;
+ const byte *pf = pflags = pinstr + 2 + U16(pinstr);
+ uint xbytes = npoints = U16(pinstr - 2) + 1;
+ uint np = npoints;
+
+ while (np > 0) {
+ byte flags = *pf++;
+ uint reps = (flags & gf_Repeat ? *pf++ + 1 : 1);
+
+ if (!(flags & gf_xShort)) {
+ if (flags & gf_xSame)
+ xbytes -= reps;
+ else
+ xbytes += reps;
+ }
+ np -= reps;
+ }
+ pxc = pf;
+ pyc = pxc + xbytes;
}
/* Interpret the contours. */
{
- uint i, np;
- float offset = 0;
- gs_fixed_point pt;
- double factor = 1.0 / pfont->data.unitsPerEm;
- /*
- * Decode the first flag byte outside the loop, to avoid a
- * compiler warning about uninitialized variables.
- */
- byte flags = *pflags++;
- uint reps = (flags & gf_Repeat ? *pflags++ + 1 : 1);
-
- if (!subglyph) {
- int xmin = S16(gdata + 2); /* We like to see it with debugger. */
-
- offset = sbw[0] - xmin * factor;
- }
- gs_point_transform2fixed(pmat, offset, 0.0, &pt);
- for (i = 0, np = 0; i < numContours; ++i) {
- bool move = true;
- bool off_curve = false;
+ uint i, np;
+ float offset = 0;
+ gs_fixed_point pt;
+ double factor = 1.0 / pfont->data.unitsPerEm;
+ /*
+ * Decode the first flag byte outside the loop, to avoid a
+ * compiler warning about uninitialized variables.
+ */
+ byte flags = *pflags++;
+ uint reps = (flags & gf_Repeat ? *pflags++ + 1 : 1);
+
+ if (!subglyph) {
+ int xmin = S16(gdata + 2); /* We like to see it with debugger. */
+
+ offset = sbw[0] - xmin * factor;
+ }
+ gs_point_transform2fixed(pmat, offset, 0.0, &pt);
+ for (i = 0, np = 0; i < numContours; ++i) {
+ bool move = true;
+ bool off_curve = false;
bool is_start_off = false;
uint last_point = U16(pends + i * 2);
- float dx, dy;
- gs_fixed_point start,pt_start_off;
- gs_fixed_point cpoints[2];
+ float dx, dy;
+ gs_fixed_point start,pt_start_off;
+ gs_fixed_point cpoints[2];
if_debug1('1', "[1t]start %d\n", i);
-
+
for (; np <= last_point; --reps, ++np) {
- gs_fixed_point dpt;
-
- if (reps == 0) {
- flags = *pflags++;
- reps = (flags & gf_Repeat ? *pflags++ + 1 : 1);
- }
- if (flags & gf_xShort) {
- /*
- * A bug in the Watcom compiler prevents us from doing
- * the following with the obvious conditional expression.
- */
- if (flags & gf_xPos)
- dx = *pxc++ * factor;
- else
- dx = -(int)*pxc++ * factor;
- } else if (!(flags & gf_xSame))
- dx = S16(pxc) * factor, pxc += 2;
- else
- dx = 0;
- if (flags & gf_yShort) {
- /* See above under dx. */
- if (flags & gf_yPos)
- dy = *pyc++ * factor;
- else
- dy = -(int)*pyc++ * factor;
- } else if (!(flags & gf_ySame))
- dy = S16(pyc) * factor, pyc += 2;
- else
- dy = 0;
- code = gs_distance_transform2fixed(pmat, dx, dy, &dpt);
- if (code < 0)
- return code;
- pt.x += dpt.x, pt.y += dpt.y;
-
+ gs_fixed_point dpt;
+
+ if (reps == 0) {
+ flags = *pflags++;
+ reps = (flags & gf_Repeat ? *pflags++ + 1 : 1);
+ }
+ if (flags & gf_xShort) {
+ /*
+ * A bug in the Watcom compiler prevents us from doing
+ * the following with the obvious conditional expression.
+ */
+ if (flags & gf_xPos)
+ dx = *pxc++ * factor;
+ else
+ dx = -(int)*pxc++ * factor;
+ } else if (!(flags & gf_xSame))
+ dx = S16(pxc) * factor, pxc += 2;
+ else
+ dx = 0;
+ if (flags & gf_yShort) {
+ /* See above under dx. */
+ if (flags & gf_yPos)
+ dy = *pyc++ * factor;
+ else
+ dy = -(int)*pyc++ * factor;
+ } else if (!(flags & gf_ySame))
+ dy = S16(pyc) * factor, pyc += 2;
+ else
+ dy = 0;
+ code = gs_distance_transform2fixed(pmat, dx, dy, &dpt);
+ if (code < 0)
+ return code;
+ pt.x += dpt.x, pt.y += dpt.y;
+
if (ppts) /* return the points */
- ppts[np] = pt;
-
+ ppts[np] = pt;
+
if (ppath) {
/* append to a path */
- if_debug3('1', "[1t]%s (%g %g)\n",
- (flags & gf_OnCurve ? "on " : "off"), fixed2float(pt.x), fixed2float(pt.y));
-
+ if_debug3('1', "[1t]%s (%g %g)\n",
+ (flags & gf_OnCurve ? "on " : "off"), fixed2float(pt.x), fixed2float(pt.y));
+
if (move) {
if(is_start_off) {
if(flags & gf_OnCurve)
start = pt;
- else {
+ else {
start.x = (pt_start_off.x + pt.x)/2;
- start.y = (pt_start_off.y + pt.y)/2;
+ start.y = (pt_start_off.y + pt.y)/2;
cpoints[1]=pt;
- off_curve=true;
+ off_curve=true;
}
move = false;
cpoints[0] = start;
code = gx_path_add_point(ppath, start.x, start.y);
- } else {
- if(flags & gf_OnCurve) {
+ } else {
+ if(flags & gf_OnCurve) {
cpoints[0] = start = pt;
- code = gx_path_add_point(ppath, pt.x, pt.y);
- move = false;
- } else {
+ code = gx_path_add_point(ppath, pt.x, pt.y);
+ move = false;
+ } else {
is_start_off = true;
pt_start_off = pt;
}
}
- } else if (flags & gf_OnCurve) {
+ } else if (flags & gf_OnCurve) {
if (off_curve)
- code = add_quadratic_curve(ppath, cpoints, cpoints+1, &pt);
- else
- code = gx_path_add_line(ppath, pt.x, pt.y);
- cpoints[0] = pt;
- off_curve = false;
- } else {
+ code = add_quadratic_curve(ppath, cpoints, cpoints+1, &pt);
+ else
+ code = gx_path_add_line(ppath, pt.x, pt.y);
+ cpoints[0] = pt;
+ off_curve = false;
+ } else {
if(off_curve) {
- gs_fixed_point p;
+ gs_fixed_point p;
p.x = (cpoints[1].x + pt.x)/2;
- p.y = (cpoints[1].y + pt.y)/2;
- code = add_quadratic_curve(ppath, cpoints, cpoints+1, &p);
- cpoints[0] = p;
- }
+ p.y = (cpoints[1].y + pt.y)/2;
+ code = add_quadratic_curve(ppath, cpoints, cpoints+1, &p);
+ cpoints[0] = p;
+ }
off_curve = true;
- cpoints[1] = pt;
- }
- if (code < 0)
- return code;
- }
- }
- if (ppath) {
- if (is_start_off) {
- if (off_curve) {
+ cpoints[1] = pt;
+ }
+ if (code < 0)
+ return code;
+ }
+ }
+ if (ppath) {
+ if (is_start_off) {
+ if (off_curve) {
gs_fixed_point p;
p.x = (cpoints[1].x + pt_start_off.x)/2;
- p.y = (cpoints[1].y + pt_start_off.y)/2;
+ p.y = (cpoints[1].y + pt_start_off.y)/2;
code = add_quadratic_curve(ppath, cpoints, cpoints+1, &p);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
code = add_quadratic_curve(ppath, &p, &pt_start_off, &start);
- if (code < 0)
- return code;
- } else {
+ if (code < 0)
+ return code;
+ } else {
code = add_quadratic_curve(ppath, cpoints, &pt_start_off, &start);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
- } else {
- if (off_curve) {
+ } else {
+ if (off_curve) {
code = add_quadratic_curve(ppath, cpoints, cpoints+1, &start);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
}
code = gx_path_close_subpath(ppath);
- if (code < 0)
- return code;
- }
- }
+ if (code < 0)
+ return code;
+ }
+ }
}
return 0;
}
@@ -1473,8 +1473,8 @@ append_simple(const byte *gdata, float sbw[4], const gs_matrix_fixed *pmat,
/* Append a glyph outline. */
static int
check_component(uint glyph_index, const gs_matrix_fixed *pmat,
- gx_path *ppath, gs_font_type42 *pfont, gs_fixed_point *ppts,
- gs_glyph_data_t *pgd, bool subglyph)
+ gx_path *ppath, gs_font_type42 *pfont, gs_fixed_point *ppts,
+ gs_glyph_data_t *pgd, bool subglyph)
{
gs_glyph_data_t glyph_data;
const byte *gdata;
@@ -1485,19 +1485,19 @@ check_component(uint glyph_index, const gs_matrix_fixed *pmat,
glyph_data.memory = pfont->memory;
code = pfont->data.get_outline(pfont, glyph_index, &glyph_data);
if (code < 0)
- return code;
+ return code;
gdata = glyph_data.bits.data;
if (gdata == 0 || glyph_data.bits.size == 0) /* empty glyph */
- return 0;
+ return 0;
numContours = S16(gdata);
if (numContours >= 0) {
- gs_type42_get_metrics(pfont, glyph_index, sbw);
- code = append_simple(gdata, sbw, pmat, ppath, ppts, pfont, subglyph);
- gs_glyph_data_free(&glyph_data, "check_component");
- return (code < 0 ? code : 0); /* simple */
+ gs_type42_get_metrics(pfont, glyph_index, sbw);
+ code = append_simple(gdata, sbw, pmat, ppath, ppts, pfont, subglyph);
+ gs_glyph_data_free(&glyph_data, "check_component");
+ return (code < 0 ? code : 0); /* simple */
}
if (numContours != -1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
*pgd = glyph_data;
return 1; /* composite */
}
@@ -1506,59 +1506,59 @@ check_component(uint glyph_index, const gs_matrix_fixed *pmat,
/* RJW: Does not appear to be used */
static int
append_component(uint glyph_index, const gs_matrix_fixed * pmat,
- gx_path * ppath, gs_fixed_point *ppts, int point_index,
- gs_font_type42 * pfont, bool subglyph)
+ gx_path * ppath, gs_fixed_point *ppts, int point_index,
+ gs_font_type42 * pfont, bool subglyph)
{
gs_glyph_data_t glyph_data;
int code;
glyph_data.memory = pfont->memory;
code = check_component(glyph_index, pmat, ppath, pfont, ppts + point_index,
- &glyph_data, subglyph);
+ &glyph_data, subglyph);
if (code != 1)
- return code;
+ return code;
/*
* This is a composite glyph. Because of the "point matching" feature,
* we have to do an extra pass over each component to fill in the
* table of points.
*/
{
- uint flags;
- const byte *gdata = glyph_data.bits.data + 10;
-
- do {
- uint comp_index = U16(gdata + 2);
- gs_matrix_fixed mat;
- int mp[2];
-
- gs_type42_parse_component(&gdata, &flags, &mat, mp, pfont, pmat);
- if (mp[0] >= 0) {
- /* Match up points. What a nuisance! */
- const gs_fixed_point *const pfrom = ppts + mp[0];
- /*
- * Contrary to the TrueType documentation, mp[1] is not
- * relative to the start of the compound glyph, but is
- * relative to the start of the component.
- */
- const gs_fixed_point *const pto = ppts + point_index + mp[1];
- gs_fixed_point diff;
-
- code = append_component(comp_index, &mat, NULL, ppts,
- point_index, pfont, true);
- if (code < 0)
- break;
- diff.x = pfrom->x - pto->x;
- diff.y = pfrom->y - pto->y;
- mat.tx = fixed2float(mat.tx_fixed += diff.x);
- mat.ty = fixed2float(mat.ty_fixed += diff.y);
- }
- code = append_component(comp_index, &mat, ppath, ppts,
- point_index, pfont, true);
- if (code < 0)
- break;
- point_index += total_points(pfont, comp_index);
- }
- while (flags & TT_CG_MORE_COMPONENTS);
+ uint flags;
+ const byte *gdata = glyph_data.bits.data + 10;
+
+ do {
+ uint comp_index = U16(gdata + 2);
+ gs_matrix_fixed mat;
+ int mp[2];
+
+ gs_type42_parse_component(&gdata, &flags, &mat, mp, pfont, pmat);
+ if (mp[0] >= 0) {
+ /* Match up points. What a nuisance! */
+ const gs_fixed_point *const pfrom = ppts + mp[0];
+ /*
+ * Contrary to the TrueType documentation, mp[1] is not
+ * relative to the start of the compound glyph, but is
+ * relative to the start of the component.
+ */
+ const gs_fixed_point *const pto = ppts + point_index + mp[1];
+ gs_fixed_point diff;
+
+ code = append_component(comp_index, &mat, NULL, ppts,
+ point_index, pfont, true);
+ if (code < 0)
+ break;
+ diff.x = pfrom->x - pto->x;
+ diff.y = pfrom->y - pto->y;
+ mat.tx = fixed2float(mat.tx_fixed += diff.x);
+ mat.ty = fixed2float(mat.ty_fixed += diff.y);
+ }
+ code = append_component(comp_index, &mat, ppath, ppts,
+ point_index, pfont, true);
+ if (code < 0)
+ break;
+ point_index += total_points(pfont, comp_index);
+ }
+ while (flags & TT_CG_MORE_COMPONENTS);
}
gs_glyph_data_free(&glyph_data, "append_component");
return code;
@@ -1567,26 +1567,26 @@ append_component(uint glyph_index, const gs_matrix_fixed * pmat,
static int
append_outline_fitted(uint glyph_index, const gs_matrix * pmat,
- gx_path * ppath, cached_fm_pair * pair,
- const gs_log2_scale_point * pscale, bool design_grid)
+ gx_path * ppath, cached_fm_pair * pair,
+ const gs_log2_scale_point * pscale, bool design_grid)
{
gs_font_type42 *pfont = (gs_font_type42 *)pair->font;
int code;
gx_ttfReader__set_font(pair->ttr, pfont);
- code = gx_ttf_outline(pair->ttf, pair->ttr, pfont, (uint)glyph_index,
- pmat, pscale, ppath, design_grid);
+ code = gx_ttf_outline(pair->ttf, pair->ttr, pfont, (uint)glyph_index,
+ pmat, pscale, ppath, design_grid);
gx_ttfReader__set_font(pair->ttr, NULL);
return code;
}
/* ---------------------------------------------- */
-static int get_from_names_table(gs_font_type42 *pfont, gs_font_info_t *info,
- gs_const_string *pmember, int member, uint name_id)
+static int get_from_names_table(gs_font_type42 *pfont, gs_font_info_t *info,
+ gs_const_string *pmember, int member, uint name_id)
{
int (*string_proc)(gs_font_type42 *, ulong, uint, const byte **) =
- pfont->data.string_proc;
+ pfont->data.string_proc;
byte t[12];
ushort num_records, strings_offset, i, language_id = 0xffff, length0 = 0, offset0 = 0;
int code;
@@ -1595,31 +1595,31 @@ static int get_from_names_table(gs_font_type42 *pfont, gs_font_info_t *info,
num_records = U16(t);
strings_offset = U16(t + 2);
for (i = 0; i < num_records; i++) {
- ushort platformID, specificID, languageID, nameID, length, offset;
-
- READ_SFNTS(pfont, pfont->data.name_offset + 6 + i * 12, 12, t);
- platformID = U16(t + 0);
- specificID = U16(t + 2);
- languageID = U16(t + 4);
- nameID = U16(t + 6);
- length = U16(t + 8);
- offset = U16(t + 10);
- if (nameID == name_id) {
- DISCARD(platformID);
- DISCARD(specificID);
- /* Hack : choose the minimal language id. */
- if (language_id > languageID) {
- language_id = languageID;
- length0 = length;
- offset0 = offset;
- }
- }
+ ushort platformID, specificID, languageID, nameID, length, offset;
+
+ READ_SFNTS(pfont, pfont->data.name_offset + 6 + i * 12, 12, t);
+ platformID = U16(t + 0);
+ specificID = U16(t + 2);
+ languageID = U16(t + 4);
+ nameID = U16(t + 6);
+ length = U16(t + 8);
+ offset = U16(t + 10);
+ if (nameID == name_id) {
+ DISCARD(platformID);
+ DISCARD(specificID);
+ /* Hack : choose the minimal language id. */
+ if (language_id > languageID) {
+ language_id = languageID;
+ length0 = length;
+ offset0 = offset;
+ }
+ }
}
if (language_id == 0xffff)
- return 0;
- if ((*string_proc)(pfont, pfont->data.name_offset + strings_offset + offset0,
- length0, &pmember->data) != 0)
- return_error(gs_error_invalidfont);
+ return 0;
+ if ((*string_proc)(pfont, pfont->data.name_offset + strings_offset + offset0,
+ length0, &pmember->data) != 0)
+ return_error(gs_error_invalidfont);
pmember->size = length0;
info->members |= member;
return 0;
@@ -1627,36 +1627,36 @@ static int get_from_names_table(gs_font_type42 *pfont, gs_font_info_t *info,
int
gs_truetype_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
gs_font_type42 *pfont = (gs_font_type42 *)font;
int code;
if (!(info->members & FONT_INFO_EMBEDDING_RIGHTS) && (members & FONT_INFO_EMBEDDING_RIGHTS)) {
- if(pfont->data.os2_offset != 0) {
- unsigned char fstype[2];
+ if(pfont->data.os2_offset != 0) {
+ unsigned char fstype[2];
- READ_SFNTS(pfont, pfont->data.os2_offset + 8, 2, fstype);
- info->EmbeddingRights = U16(fstype);
- info->members |= FONT_INFO_EMBEDDING_RIGHTS;
- }
+ READ_SFNTS(pfont, pfont->data.os2_offset + 8, 2, fstype);
+ info->EmbeddingRights = U16(fstype);
+ info->members |= FONT_INFO_EMBEDDING_RIGHTS;
+ }
}
if (pfont->data.name_offset == 0)
- return 0;
+ return 0;
if (!(info->members & FONT_INFO_COPYRIGHT) && (members & FONT_INFO_COPYRIGHT)) {
- code = get_from_names_table(pfont, info, &info->Copyright, FONT_INFO_COPYRIGHT, 0);
- if (code < 0)
- return code;
+ code = get_from_names_table(pfont, info, &info->Copyright, FONT_INFO_COPYRIGHT, 0);
+ if (code < 0)
+ return code;
}
if (!(info->members & FONT_INFO_FAMILY_NAME) && (members & FONT_INFO_FAMILY_NAME)) {
- code = get_from_names_table(pfont, info, &info->FamilyName, FONT_INFO_FAMILY_NAME, 1);
- if (code < 0)
- return code;
+ code = get_from_names_table(pfont, info, &info->FamilyName, FONT_INFO_FAMILY_NAME, 1);
+ if (code < 0)
+ return code;
}
if (!(info->members & FONT_INFO_FULL_NAME) && (members & FONT_INFO_FULL_NAME)) {
- code = get_from_names_table(pfont, info, &info->FullName, FONT_INFO_FULL_NAME, 4);
- if (code < 0)
- return code;
+ code = get_from_names_table(pfont, info, &info->FullName, FONT_INFO_FULL_NAME, 4);
+ if (code < 0)
+ return code;
}
return 0;
@@ -1664,12 +1664,11 @@ gs_truetype_font_info(gs_font *font, const gs_point *pscale, int members,
int
gs_type42_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
int code = gs_default_font_info(font, pscale, members, info);
if (code < 0)
- return code;
+ return code;
return gs_truetype_font_info(font, pscale, members, info);
}
-
diff --git a/gs/base/gstypes.h b/gs/base/gstypes.h
index 2eb457381..ce8307fe6 100644
--- a/gs/base/gstypes.h
+++ b/gs/base/gstypes.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsuid.h b/gs/base/gsuid.h
index 40ef8d086..89fc36d56 100644
--- a/gs/base/gsuid.h
+++ b/gs/base/gsuid.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsutil.c b/gs/base/gsutil.c
index e705317fb..6701bd516 100644
--- a/gs/base/gsutil.c
+++ b/gs/base/gsutil.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,8 +26,6 @@
#include "gzstate.h"
#include "gxdcolor.h"
-
-
/* ------ Unique IDs ------ */
ulong
@@ -50,35 +48,35 @@ memflip8x8(const byte * inp, int line_size, byte * outp, int dist)
uint aceg, bdfh;
{
- const byte *ptr4 = inp + (line_size << 2);
- const int ls2 = line_size << 1;
-
- aceg = ((uint)*inp) | ((uint)inp[ls2] << 8) |
- ((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
- inp += line_size, ptr4 += line_size;
- bdfh = ((uint)*inp) | ((uint)inp[ls2] << 8) |
- ((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
+ const byte *ptr4 = inp + (line_size << 2);
+ const int ls2 = line_size << 1;
+
+ aceg = ((uint)*inp) | ((uint)inp[ls2] << 8) |
+ ((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
+ inp += line_size, ptr4 += line_size;
+ bdfh = ((uint)*inp) | ((uint)inp[ls2] << 8) |
+ ((uint)*ptr4 << 16) | ((uint)ptr4[ls2] << 24);
}
/* Check for all 8 bytes being the same. */
/* This is especially worth doing for the case where all are zero. */
if (aceg == bdfh && (aceg >> 8) == (aceg & 0xffffff)) {
- if (aceg == 0 || aceg == 0xffffffff)
- goto store;
- *outp = (byte)-(int)((aceg >> 7) & 1);
- outp[dist] = (byte)-(int)((aceg >> 6) & 1);
- outp += dist << 1;
- *outp = (byte)-(int)((aceg >> 5) & 1);
- outp[dist] = (byte)-(int)((aceg >> 4) & 1);
- outp += dist << 1;
- *outp = (byte)-(int)((aceg >> 3) & 1);
- outp[dist] = (byte)-(int)((aceg >> 2) & 1);
- outp += dist << 1;
- *outp = (byte)-(int)((aceg >> 1) & 1);
- outp[dist] = (byte)-(int)(aceg & 1);
- return;
+ if (aceg == 0 || aceg == 0xffffffff)
+ goto store;
+ *outp = (byte)-(int)((aceg >> 7) & 1);
+ outp[dist] = (byte)-(int)((aceg >> 6) & 1);
+ outp += dist << 1;
+ *outp = (byte)-(int)((aceg >> 5) & 1);
+ outp[dist] = (byte)-(int)((aceg >> 4) & 1);
+ outp += dist << 1;
+ *outp = (byte)-(int)((aceg >> 3) & 1);
+ outp[dist] = (byte)-(int)((aceg >> 2) & 1);
+ outp += dist << 1;
+ *outp = (byte)-(int)((aceg >> 1) & 1);
+ outp[dist] = (byte)-(int)(aceg & 1);
+ return;
} {
- register uint temp;
+ register uint temp;
/* Transpose a block of bits between registers. */
#define TRANSPOSE(r,s,mask,shift)\
@@ -86,15 +84,15 @@ memflip8x8(const byte * inp, int line_size, byte * outp, int dist)
s ^= temp << shift)
/* Transpose blocks of 4 x 4 */
- TRANSPOSE(aceg, aceg, 0x00000f0f, 20);
- TRANSPOSE(bdfh, bdfh, 0x00000f0f, 20);
+ TRANSPOSE(aceg, aceg, 0x00000f0f, 20);
+ TRANSPOSE(bdfh, bdfh, 0x00000f0f, 20);
/* Transpose blocks of 2 x 2 */
- TRANSPOSE(aceg, aceg, 0x00330033, 10);
- TRANSPOSE(bdfh, bdfh, 0x00330033, 10);
+ TRANSPOSE(aceg, aceg, 0x00330033, 10);
+ TRANSPOSE(bdfh, bdfh, 0x00330033, 10);
/* Transpose blocks of 1 x 1 */
- TRANSPOSE(aceg, bdfh, 0x55555555, 1);
+ TRANSPOSE(aceg, bdfh, 0x55555555, 1);
#undef TRANSPOSE
}
@@ -131,14 +129,14 @@ bytes_compare(const byte * s1, uint len1, const byte * s2, uint len2)
register uint len = len1;
if (len2 < len)
- len = len2;
+ len = len2;
{
- register const byte *p1 = s1;
- register const byte *p2 = s2;
+ register const byte *p1 = s1;
+ register const byte *p2 = s2;
- while (len--)
- if (*p1++ != *p2++)
- return (p1[-1] < p2[-1] ? -1 : 1);
+ while (len--)
+ if (*p1++ != *p2++)
+ return (p1[-1] < p2[-1] ? -1 : 1);
}
/* Now check for differing lengths */
return (len1 == len2 ? 0 : len1 < len2 ? -1 : 1);
@@ -152,7 +150,7 @@ const string_match_params string_match_params_default = {
bool
string_match(const byte * str, uint len, const byte * pstr, uint plen,
- register const string_match_params * psmp)
+ register const string_match_params * psmp)
{
const byte *pback = 0;
const byte *spback = 0; /* initialized only to pacify gcc */
@@ -160,48 +158,48 @@ string_match(const byte * str, uint len, const byte * pstr, uint plen,
const byte *sp = str, *spend = str + len;
if (psmp == 0)
- psmp = &string_match_params_default;
+ psmp = &string_match_params_default;
again:while (p < pend) {
- register byte ch = *p;
-
- if (ch == psmp->any_substring) {
- pback = ++p, spback = sp;
- continue;
- } else if (ch == psmp->any_char) {
- if (sp == spend)
- return false; /* str too short */
- p++, sp++;
- continue;
- } else if (ch == psmp->quote_next) {
- if (++p == pend)
- return true; /* bad pattern */
- ch = *p;
- }
- if (sp == spend)
- return false; /* str too short */
- if (*sp == ch ||
- (psmp->ignore_case && (*sp ^ ch) == 0x20 &&
- (ch &= ~0x20) >= 0x41 && ch <= 0x5a) ||
- (psmp->slash_equiv && ((ch == '\\' && *sp == '/') ||
- (ch == '/' && *sp == '\\')))
- )
- p++, sp++;
- else if (pback == 0)
- return false; /* no * to back up to */
- else {
- sp = ++spback;
- p = pback;
- }
+ register byte ch = *p;
+
+ if (ch == psmp->any_substring) {
+ pback = ++p, spback = sp;
+ continue;
+ } else if (ch == psmp->any_char) {
+ if (sp == spend)
+ return false; /* str too short */
+ p++, sp++;
+ continue;
+ } else if (ch == psmp->quote_next) {
+ if (++p == pend)
+ return true; /* bad pattern */
+ ch = *p;
+ }
+ if (sp == spend)
+ return false; /* str too short */
+ if (*sp == ch ||
+ (psmp->ignore_case && (*sp ^ ch) == 0x20 &&
+ (ch &= ~0x20) >= 0x41 && ch <= 0x5a) ||
+ (psmp->slash_equiv && ((ch == '\\' && *sp == '/') ||
+ (ch == '/' && *sp == '\\')))
+ )
+ p++, sp++;
+ else if (pback == 0)
+ return false; /* no * to back up to */
+ else {
+ sp = ++spback;
+ p = pback;
+ }
}
if (sp < spend) { /* We got a match, but there are chars left over. */
- /* If we can back up, back up to the only place that */
- /* could produce a complete match, otherwise fail. */
- if (pback == 0)
- return false;
- p = pback;
- pback = 0;
- sp = spend - (pend - p);
- goto again;
+ /* If we can back up, back up to the only place that */
+ /* could produce a complete match, otherwise fail. */
+ if (pback == 0)
+ return false;
+ p = pback;
+ pback = 0;
+ sp = spend - (pend - p);
+ goto again;
}
return true;
}
@@ -214,13 +212,13 @@ bool
uid_equal(register const gs_uid * puid1, register const gs_uid * puid2)
{
if (puid1->id != puid2->id)
- return false;
+ return false;
if (puid1->id >= 0)
- return true; /* UniqueID */
+ return true; /* UniqueID */
return
- !memcmp((const char *)puid1->xvalues,
- (const char *)puid2->xvalues,
- (uint) - (puid1->id) * sizeof(long));
+ !memcmp((const char *)puid1->xvalues,
+ (const char *)puid2->xvalues,
+ (uint) - (puid1->id) * sizeof(long));
}
/* Copy the XUID data for a uid, if needed, updating the uid in place. */
@@ -228,14 +226,14 @@ int
uid_copy(gs_uid *puid, gs_memory_t *mem, client_name_t cname)
{
if (uid_is_XUID(puid)) {
- uint xsize = uid_XUID_size(puid);
- long *xvalues = (long *)
- gs_alloc_byte_array(mem, xsize, sizeof(long), cname);
-
- if (xvalues == 0)
- return_error(gs_error_VMerror);
- memcpy(xvalues, uid_XUID_values(puid), xsize * sizeof(long));
- puid->xvalues = xvalues;
+ uint xsize = uid_XUID_size(puid);
+ long *xvalues = (long *)
+ gs_alloc_byte_array(mem, xsize, sizeof(long), cname);
+
+ if (xvalues == 0)
+ return_error(gs_error_VMerror);
+ memcpy(xvalues, uid_XUID_values(puid), xsize * sizeof(long));
+ puid->xvalues = xvalues;
}
return 0;
}
@@ -249,35 +247,35 @@ uid_copy(gs_uid *puid, gs_memory_t *mem, client_name_t cname)
*/
int
int_rect_difference(gs_int_rect * outer, const gs_int_rect * inner,
- gs_int_rect * diffs /*[4] */ )
+ gs_int_rect * diffs /*[4] */ )
{
int x0 = outer->p.x, y0 = outer->p.y;
int x1 = outer->q.x, y1 = outer->q.y;
int count = 0;
if (y0 < inner->p.y) {
- diffs[0].p.x = x0, diffs[0].p.y = y0;
- diffs[0].q.x = x1, diffs[0].q.y = min(y1, inner->p.y);
- outer->p.y = y0 = diffs[0].q.y;
- ++count;
+ diffs[0].p.x = x0, diffs[0].p.y = y0;
+ diffs[0].q.x = x1, diffs[0].q.y = min(y1, inner->p.y);
+ outer->p.y = y0 = diffs[0].q.y;
+ ++count;
}
if (y1 > inner->q.y) {
- diffs[count].p.x = x0, diffs[count].p.y = max(y0, inner->q.y);
- diffs[count].q.x = x1, diffs[count].q.y = y1;
- outer->q.y = y1 = diffs[count].p.y;
- ++count;
+ diffs[count].p.x = x0, diffs[count].p.y = max(y0, inner->q.y);
+ diffs[count].q.x = x1, diffs[count].q.y = y1;
+ outer->q.y = y1 = diffs[count].p.y;
+ ++count;
}
if (x0 < inner->p.x) {
- diffs[0].p.x = x0, diffs[0].p.y = y0;
- diffs[0].q.x = min(x1, inner->p.x), diffs[0].q.y = y1;
- outer->p.x = x0 = diffs[count].q.x;
- ++count;
+ diffs[0].p.x = x0, diffs[0].p.y = y0;
+ diffs[0].q.x = min(x1, inner->p.x), diffs[0].q.y = y1;
+ outer->p.x = x0 = diffs[count].q.x;
+ ++count;
}
if (x1 > inner->q.x) {
- diffs[count].p.x = max(x0, inner->q.x), diffs[count].p.y = y0;
- diffs[count].q.x = x1, diffs[count].q.y = y1;
- outer->q.x = x1 = diffs[count].p.x;
- ++count;
+ diffs[count].p.x = max(x0, inner->q.x), diffs[count].p.y = y0;
+ diffs[count].q.x = x1, diffs[count].q.y = y1;
+ outer->q.x = x1 = diffs[count].p.x;
+ ++count;
}
return count;
}
@@ -294,7 +292,7 @@ gs_set_object_tag(gs_imager_state * pis, const gs_object_tag_type_t tag)
{
if (pis->memory->gs_lib_ctx->BITTAG != GS_DEVICE_DOESNT_SUPPORT_TAGS) {
pis->object_tag = tag;
- /* mkromfs breaks this dependance
+ /* mkromfs breaks this dependance
NB: needs to be fixed.
gx_unset_dev_color(pgs);
**/
@@ -310,4 +308,3 @@ gs_current_object_tag(gs_memory_t * mem)
{
return mem->gs_lib_ctx->BITTAG;
}
-
diff --git a/gs/base/gsutil.h b/gs/base/gsutil.h
index 8e822bf35..83efca690 100644
--- a/gs/base/gsutil.h
+++ b/gs/base/gsutil.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,7 +41,7 @@ ulong get_u32_msb(const byte *p);
/* 0 if they are equal, and 1 if first is greater. */
/* We can't use memcmp, because we always use unsigned characters. */
int bytes_compare(const byte * str1, uint len1,
- const byte * str2, uint len2);
+ const byte * str2, uint len2);
/* Test whether a string matches a pattern with wildcards. */
/* If psmp == NULL, use standard parameters: '*' = any substring, */
@@ -55,8 +55,8 @@ typedef struct string_match_params_s {
} string_match_params;
extern const string_match_params string_match_params_default;
bool string_match(const byte * str, uint len,
- const byte * pstr, uint plen,
- const string_match_params * psmp);
+ const byte * pstr, uint plen,
+ const string_match_params * psmp);
#include "gslibctx.h"
diff --git a/gs/base/gswts.c b/gs/base/gswts.c
index c4fd133a0..854e8803a 100644
--- a/gs/base/gswts.c
+++ b/gs/base/gswts.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -173,45 +173,45 @@ wts_vec_gcd3(wts_vec_t *a, wts_vec_t *b, wts_vec_t *c)
wts_vec_set(&d, 0, 0, 0, 0);
wts_vec_set(&e, 0, 0, 0, 0);
for (;;) {
- ra = wts_vec_smag(a);
- rb = wts_vec_smag(b);
- rc = wts_vec_smag(c);
- wts_vec_sub(&d, a, b);
- wts_vec_add(&e, a, b);
- rd = wts_vec_smag(&d);
- re = wts_vec_smag(&e);
- if (re && re < rd) {
- d = e;
- rd = re;
- }
- if (rd && rd < ra && ra >= rb) *a = d;
- else if (rd < rb && rb > ra) *b = d;
- else {
- wts_vec_sub(&d, a, c);
- wts_vec_add(&e, a, c);
- rd = wts_vec_smag(&d);
- re = wts_vec_smag(&e);
- if (re < rd) {
- d = e;
- rd = re;
- }
- if (rd && rd < ra && ra >= rc) *a = d;
- else if (rd < rc && rc > ra) *c = d;
- else {
- wts_vec_sub(&d, b, c);
- wts_vec_add(&e, b, c);
- rd = wts_vec_smag(&d);
- re = wts_vec_smag(&e);
- if (re < rd) {
- d = e;
- rd = re;
- }
- if (rd && rd < rb && rb >= rc) *b = d;
- else if (rd < rc && rc > rb) *c = d;
- else
- break;
- }
- }
+ ra = wts_vec_smag(a);
+ rb = wts_vec_smag(b);
+ rc = wts_vec_smag(c);
+ wts_vec_sub(&d, a, b);
+ wts_vec_add(&e, a, b);
+ rd = wts_vec_smag(&d);
+ re = wts_vec_smag(&e);
+ if (re && re < rd) {
+ d = e;
+ rd = re;
+ }
+ if (rd && rd < ra && ra >= rb) *a = d;
+ else if (rd < rb && rb > ra) *b = d;
+ else {
+ wts_vec_sub(&d, a, c);
+ wts_vec_add(&e, a, c);
+ rd = wts_vec_smag(&d);
+ re = wts_vec_smag(&e);
+ if (re < rd) {
+ d = e;
+ rd = re;
+ }
+ if (rd && rd < ra && ra >= rc) *a = d;
+ else if (rd < rc && rc > ra) *c = d;
+ else {
+ wts_vec_sub(&d, b, c);
+ wts_vec_add(&e, b, c);
+ rd = wts_vec_smag(&d);
+ re = wts_vec_smag(&e);
+ if (re < rd) {
+ d = e;
+ rd = re;
+ }
+ if (rd && rd < rb && rb >= rc) *b = d;
+ else if (rd < rc && rc > rb) *c = d;
+ else
+ break;
+ }
+ }
}
}
@@ -247,12 +247,12 @@ static void
wts_vec_modkls(wts_vec_t *a, int m, int i, int s)
{
while (a->l < 0) {
- a->l += i;
- a->k -= s;
+ a->l += i;
+ a->k -= s;
}
while (a->l >= i) {
- a->l -= i;
- a->k += s;
+ a->l -= i;
+ a->k += s;
}
while (a->k < 0) a->k += m;
while (a->k >= m) a->k -= m;
@@ -260,7 +260,7 @@ wts_vec_modkls(wts_vec_t *a, int m, int i, int s)
static void
wts_set_mat(gx_wts_cell_params_t *wcp, double sratiox, double sratioy,
- double sangledeg)
+ double sangledeg)
{
double sangle = sangledeg * M_PI / 180;
@@ -270,7 +270,6 @@ wts_set_mat(gx_wts_cell_params_t *wcp, double sratiox, double sratioy,
wcp->vslow = cos(sangle) / sratioy;
}
-
/**
* Calculate Screen H cell sizes.
**/
@@ -286,32 +285,32 @@ wts_cell_calc_h(double inc, int *px1, int *pxwidth, double *pp1, double memw)
e1 = 1e5;
e2 = 1e5;
for (uacc = (int)ceil(minrep * inc); uacc <= floor(2 * minrep * inc); uacc++) {
- int mt;
- double et;
-
- mt = (int)floor(uacc / inc + 1e-5);
- et = uacc / inc - mt + mt * 0.001;
- if (et < e1) {
- e1 = et;
- m1 = mt;
- }
- mt = (int)ceil(uacc / inc - 1e-5);
- et = mt - uacc / inc + mt * 0.001;
- if (et < e2) {
- e2 = et;
- m2 = mt;
- }
+ int mt;
+ double et;
+
+ mt = (int)floor(uacc / inc + 1e-5);
+ et = uacc / inc - mt + mt * 0.001;
+ if (et < e1) {
+ e1 = et;
+ m1 = mt;
+ }
+ mt = (int)ceil(uacc / inc - 1e-5);
+ et = mt - uacc / inc + mt * 0.001;
+ if (et < e2) {
+ e2 = et;
+ m2 = mt;
+ }
}
if (m1 == m2) {
- *px1 = m1;
- *pxwidth = m1;
- *pp1 = 1.0;
+ *px1 = m1;
+ *pxwidth = m1;
+ *pp1 = 1.0;
} else {
- *px1 = m1;
- *pxwidth = m1 + m2;
- e1 = fabs(m1 * inc - floor(0.5 + m1 * inc));
- e2 = fabs(m2 * inc - floor(0.5 + m2 * inc));
- *pp1 = e2 / (e1 + e2);
+ *px1 = m1;
+ *pxwidth = m1 + m2;
+ e1 = fabs(m1 * inc - floor(0.5 + m1 * inc));
+ e2 = fabs(m2 * inc - floor(0.5 + m2 * inc));
+ *pp1 = e2 / (e1 + e2);
}
}
@@ -319,27 +318,27 @@ wts_cell_calc_h(double inc, int *px1, int *pxwidth, double *pp1, double memw)
rotations. */
static gx_wts_cell_params_t *
wts_pick_cell_size_h(double sratiox, double sratioy, double sangledeg,
- double memw)
+ double memw)
{
gx_wts_cell_params_h_t *wcph;
double xinc, yinc;
wcph = malloc(sizeof(gx_wts_cell_params_h_t));
if (wcph == NULL)
- return NULL;
+ return NULL;
wcph->base.t = WTS_SCREEN_H;
wts_set_mat(&wcph->base, sratiox, sratioy, sangledeg);
xinc = fabs(wcph->base.ufast);
if (xinc == 0)
- xinc = fabs(wcph->base.vfast);
+ xinc = fabs(wcph->base.vfast);
wts_cell_calc_h(xinc, &wcph->x1, &wcph->base.width, &wcph->px, memw);
yinc = fabs(wcph->base.uslow);
if (yinc == 0)
- yinc = fabs(wcph->base.vslow);
+ yinc = fabs(wcph->base.vslow);
wts_cell_calc_h(yinc, &wcph->y1, &wcph->base.height, &wcph->py, memw);
return &wcph->base;
@@ -358,17 +357,17 @@ wts_qart(double r, double rbase, double p, double pbase)
#ifdef VERBOSE
static void
wts_print_j_jump(const gx_wts_cell_params_j_t *wcpj, const char *name,
- double pa, int xa, int ya)
+ double pa, int xa, int ya)
{
dlprintf6("jump %s: (%d, %d) %f, actual (%f, %f)\n",
- name, xa, ya, pa,
- wcpj->ufast_a * xa + wcpj->uslow_a * ya,
- wcpj->vfast_a * xa + wcpj->vslow_a * ya);
+ name, xa, ya, pa,
+ wcpj->ufast_a * xa + wcpj->uslow_a * ya,
+ wcpj->vfast_a * xa + wcpj->vslow_a * ya);
}
static void
-wts_j_add_jump(const gx_wts_cell_params_j_t *wcpj, double *pu, double *pv,
- double pa, int xa, int ya)
+wts_j_add_jump(const gx_wts_cell_params_j_t *wcpj, double *pu, double *pv,
+ double pa, int xa, int ya)
{
double jump_u = wcpj->ufast_a * xa + wcpj->uslow_a * ya;
double jump_v = wcpj->vfast_a * xa + wcpj->vslow_a * ya;
@@ -385,7 +384,7 @@ wts_print_j(const gx_wts_cell_params_j_t *wcpj)
double us, vs;
dlprintf3("cell = %d x %d, shift = %d\n",
- wcpj->base.width, wcpj->base.height, wcpj->shift);
+ wcpj->base.width, wcpj->base.height, wcpj->shift);
wts_print_j_jump(wcpj, "a", wcpj->pa, wcpj->xa, wcpj->ya);
wts_print_j_jump(wcpj, "b", wcpj->pb, wcpj->xb, wcpj->yb);
wts_print_j_jump(wcpj, "c", wcpj->pc, wcpj->xc, wcpj->yc);
@@ -399,13 +398,13 @@ wts_print_j(const gx_wts_cell_params_j_t *wcpj)
wts_j_add_jump(wcpj, &us, &vs, wcpj->pc, wcpj->xc, wcpj->yc);
wts_j_add_jump(wcpj, &us, &vs, wcpj->pd, wcpj->xd, wcpj->yd);
dlprintf6("d: %f, %f; a: %f, %f; err: %g, %g\n",
- wcpj->base.ufast, wcpj->base.vfast,
- wcpj->ufast_a, wcpj->vfast_a,
- wcpj->base.ufast - uf, wcpj->base.vfast - vf);
+ wcpj->base.ufast, wcpj->base.vfast,
+ wcpj->ufast_a, wcpj->vfast_a,
+ wcpj->base.ufast - uf, wcpj->base.vfast - vf);
dlprintf6("d: %f, %f; a: %f, %f; err: %g, %g\n",
- wcpj->base.uslow, wcpj->base.vslow,
- wcpj->uslow_a, wcpj->vslow_a,
- wcpj->base.uslow - us, wcpj->base.vslow - vs);
+ wcpj->base.uslow, wcpj->base.vslow,
+ wcpj->uslow_a, wcpj->vslow_a,
+ wcpj->base.uslow - us, wcpj->base.vslow - vs);
}
#endif
@@ -425,7 +424,7 @@ wts_print_j(const gx_wts_cell_params_j_t *wcpj)
**/
static double
wts_set_scr_jxi_try(gx_wts_cell_params_j_t *wcpj, int m, double qb,
- double jmem)
+ double jmem)
{
const double uf = wcpj->base.ufast;
const double vf = wcpj->base.vfast;
@@ -446,8 +445,8 @@ wts_set_scr_jxi_try(gx_wts_cell_params_j_t *wcpj, int m, double qb,
wts_vec_set(&a, (int)floor(uf * m + 0.5), (int)floor(vf * m + 0.5), 1, 0);
if (a.u == 0 && a.v == 0)
- return qb + 1;
-
+ return qb + 1;
+
ufj = a.u / (double)m;
vfj = a.v / (double)m;
/* (ufj, vfj) = movement in UV space from (0, 1) in XY space */
@@ -461,12 +460,12 @@ wts_set_scr_jxi_try(gx_wts_cell_params_j_t *wcpj, int m, double qb,
pa = (b.u * vg - ug * b.v) * pp;
pb = (ug * a.v - a.u * vg) * pp;
if (pa < 0) {
- wts_vec_neg(&a);
- pa = -pa;
+ wts_vec_neg(&a);
+ pa = -pa;
}
if (pb < 0) {
- wts_vec_neg(&b);
- pb = -pb;
+ wts_vec_neg(&b);
+ pb = -pb;
}
wts_vec_modk(&a, m);
wts_vec_modk(&b, m);
@@ -484,18 +483,18 @@ wts_set_scr_jxi_try(gx_wts_cell_params_j_t *wcpj, int m, double qb,
ra = sqrt(xa * xa + 0.0625 * ya * ya);
rb = sqrt(xb * xb + 0.0625 * yb * yb);
qx = 0.5 * (wts_qart(ra, rbase, pa, pbase) +
- wts_qart(rb, rbase, pb, pbase));
+ wts_qart(rb, rbase, pb, pbase));
if (qx < 1.0 / 4000.0)
- qx *= 0.25;
+ qx *= 0.25;
else
- qx -= 0.75 / 4000.0;
+ qx -= 0.75 / 4000.0;
if (m < 7500)
- qw = 0;
+ qw = 0;
else
- qw = 0.00025; /* cache penalty */
+ qw = 0.00025; /* cache penalty */
qxl = qx + qw;
if (qxl > qb)
- return qxl;
+ return qxl;
/* width is ok, now try heights */
@@ -505,165 +504,165 @@ wts_set_scr_jxi_try(gx_wts_cell_params_j_t *wcpj, int m, double qb,
qbi = qb;
for (i = 1; qxl + m * i * jmem < qbi; i++) {
- int s = m * i;
- int ca, cb;
- double usj, vsj;
- double usg, vsg;
- wts_vec_t a1, b1, a2, b2;
- double pc, pd;
- int ck;
- double qy, qm;
-
- ca = (int)floor(i * pya + 0.5);
- cb = (int)floor(i * pyb + 0.5);
- wts_vec_set(&c, ca * a.u + cb * b.u, ca * a.v + cb * b.v, 0, 1);
- usj = c.u / (double)s;
- vsj = c.v / (double)s;
- usg = (us - usj);
- vsg = (vs - vsj);
-
- a1 = a;
- b1 = b;
- a1.u *= i;
- a1.v *= i;
- b1.u *= i;
- b1.v *= i;
- wts_vec_gcd3(&a1, &b1, &c);
- a2 = a1;
- b2 = b1;
- pp = s / (double)wts_vec_cross(&b1, &a1);
- pc = (b1.u * vsg - usg * b1.v) * pp;
- pd = (usg * a1.v - a1.u * vsg) * pp;
- if (pc < 0) {
- wts_vec_neg(&a1);
- pc = -pc;
- }
- if (pd < 0) {
- wts_vec_neg(&b1);
- pd = -pd;
- }
- ck = ca * a.k + cb * b.k;
- while (ck < 0) ck += m;
- while (ck >= m) ck -= m;
- wts_vec_modkls(&a1, m, i, ck);
- wts_vec_modkls(&b1, m, i, ck);
- rf = (us * us - vs * vs) * s;
- xa = (a1.u * us + a1.v * vs) / rf;
- ya = (a1.v * us - a1.u * vs) / rf;
- xb = (b1.u * us + b1.v * vs) / rf;
- yb = (b1.v * us - b1.u * vs) / rf;
- ra = sqrt(xa * xa + 0.0625 * ya * ya);
- rb = sqrt(xb * xb + 0.0625 * yb * yb);
- qy = 0.5 * (wts_qart(ra, rbase, pc, pbase) +
- wts_qart(rb, rbase, pd, pbase));
- if (qy < 1.0 / 100.0)
- qy *= 0.025;
- else
- qy -= 0.75 / 100.0;
- qm = s * jmem;
-
- /* first try a and b jumps within the scanline */
- q = qm + qw + qx + qy;
- if (q < qbi && jumpok) {
+ int s = m * i;
+ int ca, cb;
+ double usj, vsj;
+ double usg, vsg;
+ wts_vec_t a1, b1, a2, b2;
+ double pc, pd;
+ int ck;
+ double qy, qm;
+
+ ca = (int)floor(i * pya + 0.5);
+ cb = (int)floor(i * pyb + 0.5);
+ wts_vec_set(&c, ca * a.u + cb * b.u, ca * a.v + cb * b.v, 0, 1);
+ usj = c.u / (double)s;
+ vsj = c.v / (double)s;
+ usg = (us - usj);
+ vsg = (vs - vsj);
+
+ a1 = a;
+ b1 = b;
+ a1.u *= i;
+ a1.v *= i;
+ b1.u *= i;
+ b1.v *= i;
+ wts_vec_gcd3(&a1, &b1, &c);
+ a2 = a1;
+ b2 = b1;
+ pp = s / (double)wts_vec_cross(&b1, &a1);
+ pc = (b1.u * vsg - usg * b1.v) * pp;
+ pd = (usg * a1.v - a1.u * vsg) * pp;
+ if (pc < 0) {
+ wts_vec_neg(&a1);
+ pc = -pc;
+ }
+ if (pd < 0) {
+ wts_vec_neg(&b1);
+ pd = -pd;
+ }
+ ck = ca * a.k + cb * b.k;
+ while (ck < 0) ck += m;
+ while (ck >= m) ck -= m;
+ wts_vec_modkls(&a1, m, i, ck);
+ wts_vec_modkls(&b1, m, i, ck);
+ rf = (us * us - vs * vs) * s;
+ xa = (a1.u * us + a1.v * vs) / rf;
+ ya = (a1.v * us - a1.u * vs) / rf;
+ xb = (b1.u * us + b1.v * vs) / rf;
+ yb = (b1.v * us - b1.u * vs) / rf;
+ ra = sqrt(xa * xa + 0.0625 * ya * ya);
+ rb = sqrt(xb * xb + 0.0625 * yb * yb);
+ qy = 0.5 * (wts_qart(ra, rbase, pc, pbase) +
+ wts_qart(rb, rbase, pd, pbase));
+ if (qy < 1.0 / 100.0)
+ qy *= 0.025;
+ else
+ qy -= 0.75 / 100.0;
+ qm = s * jmem;
+
+ /* first try a and b jumps within the scanline */
+ q = qm + qw + qx + qy;
+ if (q < qbi && jumpok) {
#ifdef VERBOSE
- dlprintf7("m = %d, n = %d, q = %d, qx = %d, qy = %d, qm = %d, qw = %d\n",
- m, i, (int)(q * 1e6), (int)(qx * 1e6), (int)(qy * 1e6), (int)(qm * 1e6), (int)(qw * 1e6));
+ dlprintf7("m = %d, n = %d, q = %d, qx = %d, qy = %d, qm = %d, qw = %d\n",
+ m, i, (int)(q * 1e6), (int)(qx * 1e6), (int)(qy * 1e6), (int)(qm * 1e6), (int)(qw * 1e6));
#endif
- qbi = q;
- wcpj->base.width = m;
- wcpj->base.height = i;
- wcpj->shift = ck;
- wcpj->ufast_a = ufj;
- wcpj->vfast_a = vfj;
- wcpj->uslow_a = usj;
- wcpj->vslow_a = vsj;
- wcpj->xa = a.k;
- wcpj->ya = 0;
- wcpj->xb = b.k;
- wcpj->yb = 0;
- wcpj->xc = a1.k;
- wcpj->yc = a1.l;
- wcpj->xd = b1.k;
- wcpj->yd = b1.l;
- wcpj->pa = pa;
- wcpj->pb = pb;
- wcpj->pc = pc;
- wcpj->pd = pd;
+ qbi = q;
+ wcpj->base.width = m;
+ wcpj->base.height = i;
+ wcpj->shift = ck;
+ wcpj->ufast_a = ufj;
+ wcpj->vfast_a = vfj;
+ wcpj->uslow_a = usj;
+ wcpj->vslow_a = vsj;
+ wcpj->xa = a.k;
+ wcpj->ya = 0;
+ wcpj->xb = b.k;
+ wcpj->yb = 0;
+ wcpj->xc = a1.k;
+ wcpj->yc = a1.l;
+ wcpj->xd = b1.k;
+ wcpj->yd = b1.l;
+ wcpj->pa = pa;
+ wcpj->pb = pb;
+ wcpj->pc = pc;
+ wcpj->pd = pd;
#ifdef VERBOSE
- wts_print_j(wcpj);
+ wts_print_j(wcpj);
#endif
- }
-
- /* then try unconstrained a and b jumps */
- if (i > 1) {
- double pa2, pb2, pp2;
- double qx2, qw2, q2;
-
- pp2 = pp;
- pa2 = (b2.u * vg - ug * b2.v) * pp2;
- pb2 = (ug * a2.v - a2.u * vg) * pp2;
- rf = (uf * uf + vf * vf) * s;
- xa = (a2.u * uf + a2.v * vf) / rf;
- ya = (a2.v * uf - a2.u * vf) / rf;
- xb = (b2.u * uf + b2.v * vf) / rf;
- yb = (b2.v * uf - b2.u * vf) / rf;
- ra = sqrt(xa * xa + 0.0625 * ya * ya);
- rb = sqrt(xb * xb + 0.0625 * yb * yb);
- if (pa2 < 0) {
- pa2 = -pa2;
- wts_vec_neg(&a2);
- }
- if (pb2 < 0) {
- pb2 = -pb2;
- wts_vec_neg(&b2);
- }
- wts_vec_modkls(&a2, m, i, ck);
- wts_vec_modkls(&b2, m, i, ck);
- qx2 = 0.5 * (wts_qart(ra, rbase, pa2, pbase) +
- wts_qart(rb, rbase, pb2, pbase));
- if (qx2 < 1.0 / 4000.0)
- qx2 *= 0.25;
- else
- qx2 -= 0.75 / 4000.0;
- if (s < 7500)
- qw2 = 0;
- else
- qw2 = 0.00025; /* cache penalty */
- q2 = qm + qw2 + qx2 + qy;
- if (q2 < qbi) {
+ }
+
+ /* then try unconstrained a and b jumps */
+ if (i > 1) {
+ double pa2, pb2, pp2;
+ double qx2, qw2, q2;
+
+ pp2 = pp;
+ pa2 = (b2.u * vg - ug * b2.v) * pp2;
+ pb2 = (ug * a2.v - a2.u * vg) * pp2;
+ rf = (uf * uf + vf * vf) * s;
+ xa = (a2.u * uf + a2.v * vf) / rf;
+ ya = (a2.v * uf - a2.u * vf) / rf;
+ xb = (b2.u * uf + b2.v * vf) / rf;
+ yb = (b2.v * uf - b2.u * vf) / rf;
+ ra = sqrt(xa * xa + 0.0625 * ya * ya);
+ rb = sqrt(xb * xb + 0.0625 * yb * yb);
+ if (pa2 < 0) {
+ pa2 = -pa2;
+ wts_vec_neg(&a2);
+ }
+ if (pb2 < 0) {
+ pb2 = -pb2;
+ wts_vec_neg(&b2);
+ }
+ wts_vec_modkls(&a2, m, i, ck);
+ wts_vec_modkls(&b2, m, i, ck);
+ qx2 = 0.5 * (wts_qart(ra, rbase, pa2, pbase) +
+ wts_qart(rb, rbase, pb2, pbase));
+ if (qx2 < 1.0 / 4000.0)
+ qx2 *= 0.25;
+ else
+ qx2 -= 0.75 / 4000.0;
+ if (s < 7500)
+ qw2 = 0;
+ else
+ qw2 = 0.00025; /* cache penalty */
+ q2 = qm + qw2 + qx2 + qy;
+ if (q2 < qbi) {
#ifdef VERBOSE
- dlprintf7("m = %d, n = %d, q = %d, qx2 = %d, qy = %d, qm = %d, qw2 = %d\n",
- m, i, (int)(q * 1e6), (int)(qx * 1e6), (int)(qy * 1e6), (int)(qm * 1e6), (int)(qw2 * 1e6));
+ dlprintf7("m = %d, n = %d, q = %d, qx2 = %d, qy = %d, qm = %d, qw2 = %d\n",
+ m, i, (int)(q * 1e6), (int)(qx * 1e6), (int)(qy * 1e6), (int)(qm * 1e6), (int)(qw2 * 1e6));
#endif
- if (qxl > qw2 + qx2)
- qxl = qw2 + qx2;
- qbi = q2;
- wcpj->base.width = m;
- wcpj->base.height = i;
- wcpj->shift = ck;
- wcpj->ufast_a = ufj;
- wcpj->vfast_a = vfj;
- wcpj->uslow_a = usj;
- wcpj->vslow_a = vsj;
- wcpj->xa = a2.k;
- wcpj->ya = a2.l;
- wcpj->xb = b2.k;
- wcpj->yb = a2.l;
- wcpj->xc = a1.k;
- wcpj->yc = a1.l;
- wcpj->xd = b1.k;
- wcpj->yd = b1.l;
- wcpj->pa = pa2;
- wcpj->pb = pb2;
- wcpj->pc = pc;
- wcpj->pd = pd;
+ if (qxl > qw2 + qx2)
+ qxl = qw2 + qx2;
+ qbi = q2;
+ wcpj->base.width = m;
+ wcpj->base.height = i;
+ wcpj->shift = ck;
+ wcpj->ufast_a = ufj;
+ wcpj->vfast_a = vfj;
+ wcpj->uslow_a = usj;
+ wcpj->vslow_a = vsj;
+ wcpj->xa = a2.k;
+ wcpj->ya = a2.l;
+ wcpj->xb = b2.k;
+ wcpj->yb = a2.l;
+ wcpj->xc = a1.k;
+ wcpj->yc = a1.l;
+ wcpj->xd = b1.k;
+ wcpj->yd = b1.l;
+ wcpj->pa = pa2;
+ wcpj->pb = pb2;
+ wcpj->pc = pc;
+ wcpj->pd = pd;
#ifdef VERBOSE
- wts_print_j(wcpj);
+ wts_print_j(wcpj);
#endif
- }
- } /* if (i > 1) */
- if (qx > 10 * qy)
- break;
+ }
+ } /* if (i > 1) */
+ if (qx > 10 * qy)
+ break;
}
return qbi;
}
@@ -672,7 +671,7 @@ static int
wts_double_to_int_cap(double d)
{
if (d > 0x7fffffff)
- return 0x7fffffff;
+ return 0x7fffffff;
else return (int)d;
}
@@ -707,18 +706,18 @@ wts_set_scr_jxi(gx_wts_cell_params_j_t *wcpj, double jmem)
qb = 1.0;
imax = wts_double_to_int_cap(qb / jmem);
for (i = 1; i <= imax; i++) {
- if (i > 1) {
- q = wts_set_scr_jxi_try(wcpj, i, qb, jmem);
- if (q < qb) {
- qb = q;
- imax = wts_double_to_int_cap(q / jmem);
- if (imax >= 7500)
- imax = wts_double_to_int_cap((q - 0.00025) / jmem);
- if (imax < 7500) {
- imax = 7500;
- }
- }
- }
+ if (i > 1) {
+ q = wts_set_scr_jxi_try(wcpj, i, qb, jmem);
+ if (q < qb) {
+ qb = q;
+ imax = wts_double_to_int_cap(q / jmem);
+ if (imax >= 7500)
+ imax = wts_double_to_int_cap((q - 0.00025) / jmem);
+ if (imax < 7500) {
+ imax = 7500;
+ }
+ }
+ }
}
return qb;
}
@@ -726,22 +725,22 @@ wts_set_scr_jxi(gx_wts_cell_params_j_t *wcpj, double jmem)
/* Implementation for Screen J. This is optimized for general angles. */
static gx_wts_cell_params_t *
wts_pick_cell_size_j(double sratiox, double sratioy, double sangledeg,
- double memw)
+ double memw)
{
gx_wts_cell_params_j_t *wcpj;
double code;
wcpj = malloc(sizeof(gx_wts_cell_params_j_t));
if (wcpj == NULL)
- return NULL;
+ return NULL;
wcpj->base.t = WTS_SCREEN_J;
wts_set_mat(&wcpj->base, sratiox, sratioy, sangledeg);
code = wts_set_scr_jxi(wcpj, pow(0.1, memw));
if (code < 0) {
- free(wcpj);
- return NULL;
+ free(wcpj);
+ return NULL;
}
return &wcpj->base;
@@ -799,51 +798,51 @@ wts_pick_cell_size(gs_screen_halftone *ph, const gs_matrix *pmat)
/* try persistent cache */
if (sangledeg == 45.0) {
- int srxi, sryi;
-
- srxi = (int)floor(sratiox / sqrt(2) + 0.5);
- sryi = (int)floor(sratioy / sqrt(2) + 0.5);
- if (fabs(srxi * sqrt(2) - sratiox) < 2e-6 &&
- fabs(sryi * sqrt(2) - sratioy) < 2e-6) {
- store_be32(intkey, (int)sangledeg);
- store_be32(intkey + 4, srxi);
- store_be32(intkey + 8, sryi);
- keyptr = intkey;
- keysize = sizeof(intkey);
- }
+ int srxi, sryi;
+
+ srxi = (int)floor(sratiox / sqrt(2) + 0.5);
+ sryi = (int)floor(sratioy / sqrt(2) + 0.5);
+ if (fabs(srxi * sqrt(2) - sratiox) < 2e-6 &&
+ fabs(sryi * sqrt(2) - sratioy) < 2e-6) {
+ store_be32(intkey, (int)sangledeg);
+ store_be32(intkey + 4, srxi);
+ store_be32(intkey + 8, sryi);
+ keyptr = intkey;
+ keysize = sizeof(intkey);
+ }
}
if (keyptr == NULL) {
- key.sratiox = sratiox;
- key.sratioy = sratioy;
- key.sangledeg = sangledeg;
- key.memw = memw;
- keyptr = (byte *)&key;
- keysize = sizeof(key);
+ key.sratiox = sratiox;
+ key.sratioy = sratioy;
+ key.sangledeg = sangledeg;
+ key.memw = memw;
+ keyptr = (byte *)&key;
+ keysize = sizeof(key);
}
len = gp_cache_query(GP_CACHE_TYPE_WTS_SIZE, keyptr, keysize,
- (void **)&result, wts_cache_alloc_callback, NULL);
+ (void **)&result, wts_cache_alloc_callback, NULL);
if (len >= 0)
- return result;
+ return result;
if (fabs(octangle) < 1e-4)
- result = wts_pick_cell_size_h(sratiox, sratioy, sangledeg, memw);
+ result = wts_pick_cell_size_h(sratiox, sratioy, sangledeg, memw);
else
- result = wts_pick_cell_size_j(sratiox, sratioy, sangledeg, memw);
+ result = wts_pick_cell_size_j(sratiox, sratioy, sangledeg, memw);
if (result != NULL) {
- int resultsize = 0;
-
- /* insert computed cell size into cache */
- if (result->t == WTS_SCREEN_H)
- resultsize = sizeof(gx_wts_cell_params_h_t);
- else if (result->t == WTS_SCREEN_J)
- resultsize = sizeof(gx_wts_cell_params_j_t);
- if (resultsize)
- gp_cache_insert(GP_CACHE_TYPE_WTS_SIZE, (byte *)&key, sizeof(key),
- (void *)result, resultsize);
-
- ph->actual_frequency = ph->frequency;
- ph->actual_angle = ph->angle;
+ int resultsize = 0;
+
+ /* insert computed cell size into cache */
+ if (result->t == WTS_SCREEN_H)
+ resultsize = sizeof(gx_wts_cell_params_h_t);
+ else if (result->t == WTS_SCREEN_J)
+ resultsize = sizeof(gx_wts_cell_params_j_t);
+ if (resultsize)
+ gp_cache_insert(GP_CACHE_TYPE_WTS_SIZE, (byte *)&key, sizeof(key),
+ (void *)result, resultsize);
+
+ ph->actual_frequency = ph->frequency;
+ ph->actual_angle = ph->angle;
}
return result;
}
@@ -893,16 +892,16 @@ gs_wts_screen_enum_j_new(gx_wts_cell_params_t *wcp)
static int
gs_wts_screen_enum_j_currentpoint(gs_wts_screen_enum_t *self,
- gs_point *ppt)
+ gs_point *ppt)
{
gs_wts_screen_enum_j_t *z = (gs_wts_screen_enum_j_t *)self;
const gx_wts_cell_params_j_t *wcpj = z->wcpj;
-
+
int x, y;
double u, v;
if (z->base.idx == z->base.size) {
- return 1;
+ return 1;
}
x = z->base.idx % wcpj->base.width;
y = z->base.idx / wcpj->base.width;
@@ -937,14 +936,14 @@ gs_wts_screen_enum_h_new(gx_wts_cell_params_t *wcp)
wseh->ufast1 = floor(0.5 + wcp->ufast * x1) / x1;
wseh->vfast1 = floor(0.5 + wcp->vfast * x1) / x1;
if (x2 > 0) {
- wseh->ufast2 = floor(0.5 + wcp->ufast * x2) / x2;
- wseh->vfast2 = floor(0.5 + wcp->vfast * x2) / x2;
+ wseh->ufast2 = floor(0.5 + wcp->ufast * x2) / x2;
+ wseh->vfast2 = floor(0.5 + wcp->vfast * x2) / x2;
}
wseh->uslow1 = floor(0.5 + wcp->uslow * y1) / y1;
wseh->vslow1 = floor(0.5 + wcp->vslow * y1) / y1;
if (y2 > 0) {
- wseh->uslow2 = floor(0.5 + wcp->uslow * y2) / y2;
- wseh->vslow2 = floor(0.5 + wcp->vslow * y2) / y2;
+ wseh->uslow2 = floor(0.5 + wcp->uslow * y2) / y2;
+ wseh->vslow2 = floor(0.5 + wcp->vslow * y2) / y2;
}
return &wseh->base;
@@ -952,32 +951,32 @@ gs_wts_screen_enum_h_new(gx_wts_cell_params_t *wcp)
static int
gs_wts_screen_enum_h_currentpoint(gs_wts_screen_enum_t *self,
- gs_point *ppt)
+ gs_point *ppt)
{
gs_wts_screen_enum_h_t *z = (gs_wts_screen_enum_h_t *)self;
const gx_wts_cell_params_h_t *wcph = z->wcph;
-
+
int x, y;
double u, v;
if (self->idx == self->size) {
- return 1;
+ return 1;
}
x = self->idx % wcph->base.width;
y = self->idx / wcph->base.width;
if (x < wcph->x1) {
- u = z->ufast1 * x;
- v = z->vfast1 * x;
+ u = z->ufast1 * x;
+ v = z->vfast1 * x;
} else {
- u = z->ufast2 * (x - wcph->x1);
- v = z->vfast2 * (x - wcph->x1);
+ u = z->ufast2 * (x - wcph->x1);
+ v = z->vfast2 * (x - wcph->x1);
}
if (y < wcph->y1) {
- u += z->uslow1 * y;
- v += z->vslow1 * y;
+ u += z->uslow1 * y;
+ v += z->vslow1 * y;
} else {
- u += z->uslow2 * (y - wcph->y1);
- v += z->vslow2 * (y - wcph->y1);
+ u += z->uslow2 * (y - wcph->y1);
+ v += z->vslow2 * (y - wcph->y1);
}
u -= floor(u);
v -= floor(v);
@@ -990,22 +989,22 @@ gs_wts_screen_enum_t *
gs_wts_screen_enum_new(gx_wts_cell_params_t *wcp)
{
if (wcp->t == WTS_SCREEN_J)
- return gs_wts_screen_enum_j_new(wcp);
+ return gs_wts_screen_enum_j_new(wcp);
else if (wcp->t == WTS_SCREEN_H)
- return gs_wts_screen_enum_h_new(wcp);
+ return gs_wts_screen_enum_h_new(wcp);
else
- return NULL;
+ return NULL;
}
int
gs_wts_screen_enum_currentpoint(gs_wts_screen_enum_t *wse, gs_point *ppt)
{
if (wse->t == WTS_SCREEN_J)
- return gs_wts_screen_enum_j_currentpoint(wse, ppt);
+ return gs_wts_screen_enum_j_currentpoint(wse, ppt);
if (wse->t == WTS_SCREEN_H)
- return gs_wts_screen_enum_h_currentpoint(wse, ppt);
+ return gs_wts_screen_enum_h_currentpoint(wse, ppt);
else
- return -1;
+ return -1;
}
int
@@ -1014,7 +1013,7 @@ gs_wts_screen_enum_next(gs_wts_screen_enum_t *wse, floatp value)
bits32 sample;
if (value < -1.0 || value > 1.0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
sample = (bits32) ((value + 1) * 0x7fffffff);
wse->cell[wse->idx] = sample;
wse->idx++;
@@ -1031,11 +1030,11 @@ wts_run_enum_squaredot(gs_wts_screen_enum_t *wse)
floatp spot;
for (;;) {
- code = gs_wts_screen_enum_currentpoint(wse, &pt);
- if (code)
- break;
- spot = 0.5 * (cos(pt.x * M_PI) + cos(pt.y * M_PI));
- gs_wts_screen_enum_next(wse, spot);
+ code = gs_wts_screen_enum_currentpoint(wse, &pt);
+ if (code)
+ break;
+ spot = 0.5 * (cos(pt.x * M_PI) + cos(pt.y * M_PI));
+ gs_wts_screen_enum_next(wse, spot);
}
}
#endif /* UNIT_TEST */
@@ -1062,12 +1061,12 @@ wts_sort_cell(gs_wts_screen_enum_t *wse)
pcell = malloc(size * sizeof(bits32 *));
if (pcell == NULL)
- return -1;
+ return -1;
for (i = 0; i < size; i++)
- pcell[i] = &cell[i];
+ pcell[i] = &cell[i];
qsort(pcell, size, sizeof(bits32 *), wts_sample_cmp);
for (i = 0; i < size; i++)
- *pcell[i] = (bits32)floor(WTS_SORTED_MAX * (i + 0.5) / size);
+ *pcell[i] = (bits32)floor(WTS_SORTED_MAX * (i + 0.5) / size);
free(pcell);
return 0;
}
@@ -1094,22 +1093,22 @@ wts_blue_bump(const gs_wts_screen_enum_t *wse)
int x, y;
if (wse->t == WTS_SCREEN_J) {
- gs_wts_screen_enum_j_t *wsej = (gs_wts_screen_enum_j_t *)wse;
- shift = wsej->wcpj->shift;
- wcp = &wsej->wcpj->base;
+ gs_wts_screen_enum_j_t *wsej = (gs_wts_screen_enum_j_t *)wse;
+ shift = wsej->wcpj->shift;
+ wcp = &wsej->wcpj->base;
} else if (wse->t == WTS_SCREEN_H) {
- gs_wts_screen_enum_h_t *wseh = (gs_wts_screen_enum_h_t *)wse;
- shift = 0;
- wcp = &wseh->wcph->base;
+ gs_wts_screen_enum_h_t *wseh = (gs_wts_screen_enum_h_t *)wse;
+ shift = 0;
+ wcp = &wseh->wcph->base;
} else
- return NULL;
+ return NULL;
bump = (bits32 *)malloc(size * sizeof(bits32));
if (bump == NULL)
- return NULL;
+ return NULL;
for (i = 0; i < size; i++)
- bump[i] = 0;
+ bump[i] = 0;
/* todo: more intelligence for anisotropic scaling */
uf = wcp->ufast;
vf = wcp->vfast;
@@ -1121,24 +1120,24 @@ wts_blue_bump(const gs_wts_screen_enum_t *wse)
x0 = -(z / width) * shift - z;
y0 = -(z % width);
while (y0 < 0) {
- x0 -= shift;
- y0 += height;
+ x0 -= shift;
+ y0 += height;
}
while (x0 < 0) x0 += width;
for (y = -z; y <= z; y++) {
- int x1 = x0;
- for (x = -z; x <= z; x++) {
- bump[y0 * width + x1] += (bits32)(eg * exp (-am * (x * x + y * y)));
- x1++;
- if (x1 == width)
- x1 = 0;
- }
- y0++;
- if (y0 == height) {
- x0 += shift;
- if (x0 >= width) x0 -= width;
- y0 = 0;
- }
+ int x1 = x0;
+ for (x = -z; x <= z; x++) {
+ bump[y0 * width + x1] += (bits32)(eg * exp (-am * (x * x + y * y)));
+ x1++;
+ if (x1 == width)
+ x1 = 0;
+ }
+ y0++;
+ if (y0 == height) {
+ x0 += shift;
+ if (x0 >= width) x0 -= width;
+ y0 = 0;
+ }
}
return bump;
}
@@ -1160,90 +1159,90 @@ wts_sort_blue(const gs_wts_screen_enum_t *wse)
int i;
if (wse->t == WTS_SCREEN_J) {
- gs_wts_screen_enum_j_t *wsej = (gs_wts_screen_enum_j_t *)wse;
- shift = wsej->wcpj->shift;
+ gs_wts_screen_enum_j_t *wsej = (gs_wts_screen_enum_j_t *)wse;
+ shift = wsej->wcpj->shift;
} else
- shift = 0;
+ shift = 0;
ref = (bits32 *)malloc(size * sizeof(bits32));
pcell = (bits32 **)malloc(size * sizeof(bits32 *));
bump = wts_blue_bump(wse);
if (ref == NULL || pcell == NULL || bump == NULL) {
- free(ref);
- free(pcell);
- free(bump);
- return -1;
+ free(ref);
+ free(pcell);
+ free(bump);
+ return -1;
}
for (i = 0; i < size; i++)
- pcell[i] = &cell[i];
+ pcell[i] = &cell[i];
qsort(pcell, size, sizeof(bits32 *), wts_sample_cmp);
/* set ref to sorted cell; pcell will now point to ref */
for (i = 0; i < size; i++) {
- pcell[i] = (pcell[i] - cell) + ref;
- *pcell[i] = (bits32)floor((1 << 24) * (i + 0.5) / size);
- cell[i] = 0;
+ pcell[i] = (pcell[i] - cell) + ref;
+ *pcell[i] = (bits32)floor((1 << 24) * (i + 0.5) / size);
+ cell[i] = 0;
}
for (i = 0; i < size; i++) {
- bits32 gmin = *pcell[i];
- int j;
- int j_end = i + 5000;
- int jmin = i;
- int ix;
- int x0, y0;
- int x, y;
- int ref_ix, bump_ix;
-
- /* find minimum cell value, but prune search */
- if (j_end > size) j_end = size;
- for (j = i + 1; j < j_end; j++) {
- if (*pcell[j] < gmin) {
- gmin = *pcell[j];
- jmin = j;
- }
- }
- ix = pcell[jmin] - ref;
- pcell[jmin] = pcell[i];
- cell[ix] = (bits32)floor(WTS_SORTED_MAX * (i + 0.5) / size);
-
- x0 = ix % width;
- y0 = ix / width;
-
- /* Add in bump, centered at (x0, y0) */
- ref_ix = y0 * width;
- bump_ix = 0;
- for (y = 0; y < height; y++) {
- for (x = x0; x < width; x++)
- ref[ref_ix + x] += bump[bump_ix++];
- for (x = 0; x < x0; x++)
- ref[ref_ix + x] += bump[bump_ix++];
- ref_ix += width;
- y0++;
- if (y0 == height) {
- x0 += shift;
- if (x0 >= width) x0 -= width;
- y0 = 0;
- ref_ix = 0;
- }
- }
-
- /* Remove DC component to avoid integer overflow. */
- if ((i & 255) == 255 && i + 1 < size) {
- bits32 gmin = *pcell[i + 1];
- int j;
-
- for (j = i + 2; j < size; j++) {
- if (*pcell[j] < gmin) {
- gmin = *pcell[j];
- }
- }
+ bits32 gmin = *pcell[i];
+ int j;
+ int j_end = i + 5000;
+ int jmin = i;
+ int ix;
+ int x0, y0;
+ int x, y;
+ int ref_ix, bump_ix;
+
+ /* find minimum cell value, but prune search */
+ if (j_end > size) j_end = size;
+ for (j = i + 1; j < j_end; j++) {
+ if (*pcell[j] < gmin) {
+ gmin = *pcell[j];
+ jmin = j;
+ }
+ }
+ ix = pcell[jmin] - ref;
+ pcell[jmin] = pcell[i];
+ cell[ix] = (bits32)floor(WTS_SORTED_MAX * (i + 0.5) / size);
+
+ x0 = ix % width;
+ y0 = ix / width;
+
+ /* Add in bump, centered at (x0, y0) */
+ ref_ix = y0 * width;
+ bump_ix = 0;
+ for (y = 0; y < height; y++) {
+ for (x = x0; x < width; x++)
+ ref[ref_ix + x] += bump[bump_ix++];
+ for (x = 0; x < x0; x++)
+ ref[ref_ix + x] += bump[bump_ix++];
+ ref_ix += width;
+ y0++;
+ if (y0 == height) {
+ x0 += shift;
+ if (x0 >= width) x0 -= width;
+ y0 = 0;
+ ref_ix = 0;
+ }
+ }
+
+ /* Remove DC component to avoid integer overflow. */
+ if ((i & 255) == 255 && i + 1 < size) {
+ bits32 gmin = *pcell[i + 1];
+ int j;
+
+ for (j = i + 2; j < size; j++) {
+ if (*pcell[j] < gmin) {
+ gmin = *pcell[j];
+ }
+ }
#ifdef VERBOSE
- if_debug1('h', "[h]gmin = %d\n", gmin);
+ if_debug1('h', "[h]gmin = %d\n", gmin);
#endif
- for (j = i + 1; j < size; j++)
- *pcell[j] -= gmin;
-
- }
+ for (j = i + 1; j < size; j++)
+ *pcell[j] -= gmin;
+
+ }
}
free(ref);
@@ -1283,14 +1282,14 @@ wts_screen_from_enum_j(const gs_wts_screen_enum_t *wse)
samples = malloc(sizeof(wts_screen_sample_t) * size);
wsj->base.samples = samples;
for (i = 0; i < size; i++) {
- samples[i] = wsej->base.cell[i] >> WTS_EXTRA_SORT_BITS;
+ samples[i] = wsej->base.cell[i] >> WTS_EXTRA_SORT_BITS;
}
#ifdef WTS_CACHE_SIZE_X
for (i = 0; i < WTS_CACHE_SIZE_X; i++)
- wsj->xcache[i].tag = -1;
+ wsj->xcache[i].tag = -1;
for (i = 0; i < WTS_CACHE_SIZE_Y; i++)
- wsj->ycache[i].tag = -1;
+ wsj->ycache[i].tag = -1;
#endif
return &wsj->base;
@@ -1320,7 +1319,7 @@ wts_screen_from_enum_h(const gs_wts_screen_enum_t *wse)
samples = malloc(sizeof(wts_screen_sample_t) * size);
wsh->base.samples = samples;
for (i = 0; i < size; i++) {
- samples[i] = wseh->base.cell[i] >> WTS_EXTRA_SORT_BITS;
+ samples[i] = wseh->base.cell[i] >> WTS_EXTRA_SORT_BITS;
}
return &wsh->base;
@@ -1349,62 +1348,62 @@ wts_screen_from_enum(const gs_wts_screen_enum_t *wse)
byte *cell_result;
if (wse->t == WTS_SCREEN_J) {
- wts_key_j k;
- k.t = wse->t;
- k.width = wse->width;
- k.height = wse->height;
- cell_off = sizeof(k);
-
- key_size = cell_off + wse->size * sizeof(bits32);
- key = (byte *)malloc(key_size);
- /* todo: more params */
- memcpy(key, &k, cell_off);
- memcpy(key + cell_off, wse->cell, wse->size * sizeof(bits32));
+ wts_key_j k;
+ k.t = wse->t;
+ k.width = wse->width;
+ k.height = wse->height;
+ cell_off = sizeof(k);
+
+ key_size = cell_off + wse->size * sizeof(bits32);
+ key = (byte *)malloc(key_size);
+ /* todo: more params */
+ memcpy(key, &k, cell_off);
+ memcpy(key + cell_off, wse->cell, wse->size * sizeof(bits32));
} else if (wse->t == WTS_SCREEN_H) {
- wts_key_h k;
- k.t = wse->t;
- k.width = wse->width;
- k.height = wse->height;
- key_size = sizeof(k);
- key = (byte *)malloc(key_size);
- /* todo: more params */
- memcpy(key, &k, key_size);
+ wts_key_h k;
+ k.t = wse->t;
+ k.width = wse->width;
+ k.height = wse->height;
+ key_size = sizeof(k);
+ key = (byte *)malloc(key_size);
+ /* todo: more params */
+ memcpy(key, &k, key_size);
}
if (key != NULL)
- cell_len = gp_cache_query(GP_CACHE_TYPE_WTS_CELL, key, key_size,
- (void **)&cell_result,
- wts_cache_alloc_callback, NULL);
+ cell_len = gp_cache_query(GP_CACHE_TYPE_WTS_CELL, key, key_size,
+ (void **)&cell_result,
+ wts_cache_alloc_callback, NULL);
if (cell_len >= 0) {
- memcpy(wse->cell, cell_result, cell_len);
- free(cell_result);
+ memcpy(wse->cell, cell_result, cell_len);
+ free(cell_result);
} else {
- wts_sort_blue(wse);
- cell_len = wse->size * sizeof(bits32);
- gp_cache_insert(GP_CACHE_TYPE_WTS_CELL, key, key_size,
- (void *)wse->cell, cell_len);
+ wts_sort_blue(wse);
+ cell_len = wse->size * sizeof(bits32);
+ gp_cache_insert(GP_CACHE_TYPE_WTS_CELL, key, key_size,
+ (void *)wse->cell, cell_len);
}
free(key);
if (wse->t == WTS_SCREEN_J)
- result = wts_screen_from_enum_j(wse);
+ result = wts_screen_from_enum_j(wse);
else if (wse->t == WTS_SCREEN_H)
- result = wts_screen_from_enum_h(wse);
+ result = wts_screen_from_enum_h(wse);
#ifdef DUMP_WTS
{
- static int dump_idx = 0;
- char dump_fn[128];
- int dump_fd;
- byte *buf;
- int size;
-
- size = gs_wts_to_buf(result, &buf);
- sprintf(dump_fn, "wts_dump_%d", dump_idx++);
- dump_fd = open(dump_fn, O_WRONLY | O_CREAT | O_TRUNC, 0666);
- write(dump_fd, buf, size);
- close(dump_fd);
- free(buf);
+ static int dump_idx = 0;
+ char dump_fn[128];
+ int dump_fd;
+ byte *buf;
+ int size;
+
+ size = gs_wts_to_buf(result, &buf);
+ sprintf(dump_fn, "wts_dump_%d", dump_idx++);
+ dump_fd = open(dump_fn, O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ write(dump_fd, buf, size);
+ close(dump_fd);
+ free(buf);
}
#endif
@@ -1443,11 +1442,11 @@ wts_size(const wts_screen_t *ws)
int type = le_s32(&ws->type);
if (type == WTS_SCREEN_RAT) {
- size = sizeof(wts_screen_t);
+ size = sizeof(wts_screen_t);
} else if (type == WTS_SCREEN_J) {
- size = sizeof(wts_screen_j_t);
+ size = sizeof(wts_screen_j_t);
} else if (type == WTS_SCREEN_H) {
- size = sizeof(wts_screen_h_t);
+ size = sizeof(wts_screen_h_t);
}
return size;
}
@@ -1463,12 +1462,12 @@ gs_wts_from_buf(const byte *buf, int bufsize)
result = (wts_screen_t *)malloc(size);
if (result == NULL)
- return NULL;
+ return NULL;
hdr_size = offset_of(wts_screen_t, samples) + sizeof(int);
if (bufsize < hdr_size ) {
- free(result);
- return NULL;
+ free(result);
+ return NULL;
}
result->type = le_s32(&ws->type);
result->cell_width = le_s32(&ws->cell_width);
@@ -1476,60 +1475,60 @@ gs_wts_from_buf(const byte *buf, int bufsize)
result->cell_shift = le_s32(&ws->cell_shift);
result->samples = NULL;
if (result->type == WTS_SCREEN_J) {
- wts_screen_j_t *wsj = (wts_screen_j_t *)result;
- const int *wsj_params = (const int *)((const byte *)ws + hdr_size);
-
- hdr_size += sizeof(int) * 12;
- if (bufsize < hdr_size ) {
- free(result);
- return NULL;
- }
- wsj->pa = le_s32(&wsj_params[0]);
- wsj->pb = le_s32(&wsj_params[1]);
- wsj->pc = le_s32(&wsj_params[2]);
- wsj->pd = le_s32(&wsj_params[3]);
- wsj->XA = le_s32(&wsj_params[4]);
- wsj->YA = le_s32(&wsj_params[5]);
- wsj->XB = le_s32(&wsj_params[6]);
- wsj->YB = le_s32(&wsj_params[7]);
- wsj->XC = le_s32(&wsj_params[8]);
- wsj->YC = le_s32(&wsj_params[9]);
- wsj->XD = le_s32(&wsj_params[10]);
- wsj->YD = le_s32(&wsj_params[11]);
- /* 20090929:mu: In last version, we didn't copied these entries unless
- WTS_SCREEN_J_SIZE_NOCACHE has been defined.
- But, judging from gs_wts_to_buf() code below,
- those are written into file even WTS_SCREEN_J_SIZE_NOCACHE haven't defined
- and thereofore I think these should be read. */
+ wts_screen_j_t *wsj = (wts_screen_j_t *)result;
+ const int *wsj_params = (const int *)((const byte *)ws + hdr_size);
+
+ hdr_size += sizeof(int) * 12;
+ if (bufsize < hdr_size ) {
+ free(result);
+ return NULL;
+ }
+ wsj->pa = le_s32(&wsj_params[0]);
+ wsj->pb = le_s32(&wsj_params[1]);
+ wsj->pc = le_s32(&wsj_params[2]);
+ wsj->pd = le_s32(&wsj_params[3]);
+ wsj->XA = le_s32(&wsj_params[4]);
+ wsj->YA = le_s32(&wsj_params[5]);
+ wsj->XB = le_s32(&wsj_params[6]);
+ wsj->YB = le_s32(&wsj_params[7]);
+ wsj->XC = le_s32(&wsj_params[8]);
+ wsj->YC = le_s32(&wsj_params[9]);
+ wsj->XD = le_s32(&wsj_params[10]);
+ wsj->YD = le_s32(&wsj_params[11]);
+ /* 20090929:mu: In last version, we didn't copied these entries unless
+ WTS_SCREEN_J_SIZE_NOCACHE has been defined.
+ But, judging from gs_wts_to_buf() code below,
+ those are written into file even WTS_SCREEN_J_SIZE_NOCACHE haven't defined
+ and thereofore I think these should be read. */
}
/* 20090929:mu: This code doesn't care about WTS_SCREEN_H type file.
If you attenpt to read such files, probably end up with errors. */
cell_size = result->cell_width * result->cell_height * sizeof(wts_screen_sample_t);
if (bufsize < (cell_size + hdr_size) ||
- (result->samples = (wts_screen_sample_t *)malloc(cell_size)) == NULL) {
- free(result);
- return NULL;
+ (result->samples = (wts_screen_sample_t *)malloc(cell_size)) == NULL) {
+ free(result);
+ return NULL;
}
#ifdef WTS_SCREEN_J_SIZE_NOCACHE
if (ws->type == WTS_SCREEN_J) {
- wts_screen_j_t *wsj = (wts_screen_j_t *)result;
- int i;
+ wts_screen_j_t *wsj = (wts_screen_j_t *)result;
+ int i;
- for (i = 0; i < WTS_CACHE_SIZE_X; i++)
- wsj->xcache[i].tag = -1;
- for (i = 0; i < WTS_CACHE_SIZE_Y; i++)
- wsj->ycache[i].tag = -1;
+ for (i = 0; i < WTS_CACHE_SIZE_X; i++)
+ wsj->xcache[i].tag = -1;
+ for (i = 0; i < WTS_CACHE_SIZE_Y; i++)
+ wsj->ycache[i].tag = -1;
}
#endif
{ /* 20090929:mu: memcpy(result->samples, buf + hdr_size, cell_size); */
- /* assuming wts_screen_sample_t == ushort */
- wts_screen_sample_t *p = result->samples, *q = (wts_screen_sample_t *)(buf + hdr_size);
- int i = result->cell_width * result->cell_height;
- for ( ; i > 0; i-- ) {
- *p++ = le_u16(q);
- q++;
- }
+ /* assuming wts_screen_sample_t == ushort */
+ wts_screen_sample_t *p = result->samples, *q = (wts_screen_sample_t *)(buf + hdr_size);
+ int i = result->cell_width * result->cell_height;
+ for ( ; i > 0; i-- ) {
+ *p++ = le_u16(q);
+ q++;
+ }
}
return result;
@@ -1546,7 +1545,7 @@ gs_wts_to_buf(const wts_screen_t *ws, byte **pbuf)
buf = (byte *)malloc(size + cell_size);
if (buf == NULL)
- return -1;
+ return -1;
memcpy(buf, ws, size);
((wts_screen_t *)buf)->samples = NULL;
memcpy(buf + size, ws->samples, cell_size);
@@ -1570,21 +1569,21 @@ dump_thresh(const wts_screen_t *ws, int width, int height)
printf("P5\n%d %d\n255\n", width, height);
for (y = 0; y < height; y++) {
- for (x = 0; x < width;) {
- wts_screen_sample_t *samples;
- int n_samples, i;
+ for (x = 0; x < width;) {
+ wts_screen_sample_t *samples;
+ int n_samples, i;
- wts_get_samples(ws, x, y, &cx, &cy, &n_samples);
- samples = ws->samples + cy * ws->cell_width + cx;
+ wts_get_samples(ws, x, y, &cx, &cy, &n_samples);
+ samples = ws->samples + cy * ws->cell_width + cx;
#if 1
- for (i = 0; x + i < width && i < n_samples; i++)
- fputc(samples[i] >> 7, stdout);
+ for (i = 0; x + i < width && i < n_samples; i++)
+ fputc(samples[i] >> 7, stdout);
#else
- printf("(%d, %d): %d samples at %d\n",
- x, y, n_samples, samples - s0);
+ printf("(%d, %d): %d samples at %d\n",
+ x, y, n_samples, samples - s0);
#endif
- x += n_samples;
- }
+ x += n_samples;
+ }
}
return 0;
}
diff --git a/gs/base/gswts.h b/gs/base/gswts.h
index 14e99d09a..788f466b1 100644
--- a/gs/base/gswts.h
+++ b/gs/base/gswts.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gsxfont.h b/gs/base/gsxfont.h
index 474db1edc..c9949432d 100644
--- a/gs/base/gsxfont.h
+++ b/gs/base/gsxfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gx.h b/gs/base/gx.h
index 10ba4f355..66bcb4965 100644
--- a/gs/base/gx.h
+++ b/gs/base/gx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxacpath.c b/gs/base/gxacpath.c
index 629eb5adb..163cebd5f 100644
--- a/gs/base/gxacpath.c
+++ b/gs/base/gxacpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ extern_st(st_clip_list);
static
ENUM_PTRS_WITH(device_cpath_accum_enum_ptrs, gx_device_cpath_accum *pdev)
if (index >= st_device_max_ptrs)
- return ENUM_USING(st_clip_list, &pdev->list, sizeof(gx_clip_list), index - st_device_max_ptrs);
+ return ENUM_USING(st_clip_list, &pdev->list, sizeof(gx_clip_list), index - st_device_max_ptrs);
ENUM_PREFIX(st_device, 0);
ENUM_PTRS_END
static
@@ -55,7 +55,7 @@ public_st_device_cpath_accum();
/* Many of these procedures won't be called; they are set to NULL. */
static const gx_device_cpath_accum gs_cpath_accum_device =
{std_device_std_body(gx_device_cpath_accum, 0, "clip list accumulator",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{accum_open_device,
NULL,
NULL,
@@ -130,17 +130,17 @@ void
gx_cpath_accum_begin(gx_device_cpath_accum * padev, gs_memory_t * mem)
{
gx_device_init((gx_device *) padev,
- (const gx_device *) & gs_cpath_accum_device,
- NULL /* allocated on stack */ , true);
+ (const gx_device *) & gs_cpath_accum_device,
+ NULL /* allocated on stack */ , true);
padev->list_memory = mem;
- padev->memory = mem; /* gx_general_fill_path may need a storage
- for dropout prevention buffer. */
+ padev->memory = mem; /* gx_general_fill_path may need a storage
+ for dropout prevention buffer. */
(*dev_proc(padev, open_device)) ((gx_device *) padev);
}
void
gx_cpath_accum_set_cbox(gx_device_cpath_accum * padev,
- const gs_fixed_rect * pbox)
+ const gs_fixed_rect * pbox)
{
padev->clip_box.p.x = fixed2int_var(pbox->p.x);
padev->clip_box.p.y = fixed2int_var(pbox->p.y);
@@ -157,17 +157,17 @@ gx_cpath_accum_end(const gx_device_cpath_accum * padev, gx_clip_path * pcpath)
gx_clip_path apath;
if (code < 0)
- return code;
+ return code;
gx_cpath_init_local(&apath, padev->list_memory);
apath.rect_list->list = padev->list;
if (padev->list.count == 0)
- apath.path.bbox.p.x = apath.path.bbox.p.y =
- apath.path.bbox.q.x = apath.path.bbox.q.y = 0;
+ apath.path.bbox.p.x = apath.path.bbox.p.y =
+ apath.path.bbox.q.x = apath.path.bbox.q.y = 0;
else {
- apath.path.bbox.p.x = int2fixed(padev->bbox.p.x);
- apath.path.bbox.p.y = int2fixed(padev->bbox.p.y);
- apath.path.bbox.q.x = int2fixed(padev->bbox.q.x);
- apath.path.bbox.q.y = int2fixed(padev->bbox.q.y);
+ apath.path.bbox.p.x = int2fixed(padev->bbox.p.x);
+ apath.path.bbox.p.y = int2fixed(padev->bbox.p.y);
+ apath.path.bbox.q.x = int2fixed(padev->bbox.q.x);
+ apath.path.bbox.q.y = int2fixed(padev->bbox.q.y);
}
/* indicate that the bbox is accurate */
apath.path.bbox_accurate = 1;
@@ -176,11 +176,11 @@ gx_cpath_accum_end(const gx_device_cpath_accum * padev, gx_clip_path * pcpath)
/* to return true. This, in turn, requires that */
/* we set apath.inner_box correctly. */
if (clip_list_is_rectangle(&padev->list))
- apath.inner_box = apath.path.bbox;
+ apath.inner_box = apath.path.bbox;
else {
- /* The quick check must fail. */
- apath.inner_box.p.x = apath.inner_box.p.y = 0;
- apath.inner_box.q.x = apath.inner_box.q.y = 0;
+ /* The quick check must fail. */
+ apath.inner_box.p.x = apath.inner_box.p.y = 0;
+ apath.inner_box.q.x = apath.inner_box.q.y = 0;
}
gx_cpath_set_outer_box(&apath);
apath.path_valid = false;
@@ -199,8 +199,8 @@ gx_cpath_accum_discard(gx_device_cpath_accum * padev)
/* Intersect two clipping paths using an accumulator. */
int
gx_cpath_intersect_path_slow(gx_clip_path * pcpath, gx_path * ppath,
- int rule, gs_imager_state *pis,
- const gx_fill_params * params0)
+ int rule, gs_imager_state *pis,
+ const gx_fill_params * params0)
{
gs_logical_operation_t save_lop = gs_current_logical_op_inline(pis);
gx_device_cpath_accum adev;
@@ -212,19 +212,19 @@ gx_cpath_intersect_path_slow(gx_clip_path * pcpath, gx_path * ppath,
set_nonclient_dev_color(&devc, 0); /* arbitrary, but not transparent */
gs_set_logical_op_inline(pis, lop_default);
if (params0 != 0)
- params = *params0;
+ params = *params0;
else {
gs_point fadjust;
- params.rule = rule;
+ params.rule = rule;
gs_currentfilladjust((gs_state *)pis, &fadjust);
params.adjust.x = float2fixed(fadjust.x);
params.adjust.y = float2fixed(fadjust.y);
- params.flatness = gs_currentflat_inline(pis);
+ params.flatness = gs_currentflat_inline(pis);
}
code = gx_fill_path_only(ppath, (gx_device *)&adev, pis,
- &params, &devc, pcpath);
+ &params, &devc, pcpath);
if (code < 0 || (code = gx_cpath_accum_end(&adev, pcpath)) < 0)
- gx_cpath_accum_discard(&adev);
+ gx_cpath_accum_discard(&adev);
gs_set_logical_op_inline(pis, save_lop);
return code;
}
@@ -237,27 +237,27 @@ static bool
clip_list_validate(const gx_clip_list * clp)
{
if (clp->count <= 1)
- return (clp->head == 0 && clp->tail == 0 &&
- clp->single.next == 0 && clp->single.prev == 0);
+ return (clp->head == 0 && clp->tail == 0 &&
+ clp->single.next == 0 && clp->single.prev == 0);
else {
- const gx_clip_rect *prev = clp->head;
- const gx_clip_rect *ptr;
- bool ok = true;
-
- while ((ptr = prev->next) != 0) {
- if (ptr->ymin > ptr->ymax || ptr->xmin > ptr->xmax ||
- !(ptr->ymin >= prev->ymax ||
- (ptr->ymin == prev->ymin &&
- ptr->ymax == prev->ymax &&
- ptr->xmin >= prev->xmax)) ||
- ptr->prev != prev
- ) {
- clip_rect_print('q', "WRONG:", ptr);
- ok = false;
- }
- prev = ptr;
- }
- return ok && prev == clp->tail;
+ const gx_clip_rect *prev = clp->head;
+ const gx_clip_rect *ptr;
+ bool ok = true;
+
+ while ((ptr = prev->next) != 0) {
+ if (ptr->ymin > ptr->ymax || ptr->xmin > ptr->xmax ||
+ !(ptr->ymin >= prev->ymax ||
+ (ptr->ymin == prev->ymin &&
+ ptr->ymax == prev->ymax &&
+ ptr->xmin >= prev->xmax)) ||
+ ptr->prev != prev
+ ) {
+ clip_rect_print('q', "WRONG:", ptr);
+ ok = false;
+ }
+ prev = ptr;
+ }
+ return ok && prev == clp->tail;
}
}
#endif /* DEBUG */
@@ -286,34 +286,33 @@ accum_close(gx_device * dev)
adev->list.xmax = adev->bbox.q.x;
#ifdef DEBUG
if (gs_debug_c('q')) {
- gx_clip_rect *rp =
- (adev->list.count <= 1 ? &adev->list.single : adev->list.head);
-
- dlprintf6("[q]list at 0x%lx, count=%d, head=0x%lx, tail=0x%lx, xrange=(%d,%d):\n",
- (ulong) & adev->list, adev->list.count,
- (ulong) adev->list.head, (ulong) adev->list.tail,
- adev->list.xmin, adev->list.xmax);
- while (rp != 0) {
- clip_rect_print('q', " ", rp);
- rp = rp->next;
- }
+ gx_clip_rect *rp =
+ (adev->list.count <= 1 ? &adev->list.single : adev->list.head);
+
+ dlprintf6("[q]list at 0x%lx, count=%d, head=0x%lx, tail=0x%lx, xrange=(%d,%d):\n",
+ (ulong) & adev->list, adev->list.count,
+ (ulong) adev->list.head, (ulong) adev->list.tail,
+ adev->list.xmin, adev->list.xmax);
+ while (rp != 0) {
+ clip_rect_print('q', " ", rp);
+ rp = rp->next;
+ }
}
if (!clip_list_validate(&adev->list)) {
- lprintf1("[q]Bad clip list 0x%lx!\n", (ulong) & adev->list);
- return_error(gs_error_Fatal);
+ lprintf1("[q]Bad clip list 0x%lx!\n", (ulong) & adev->list);
+ return_error(gs_error_Fatal);
}
#endif
return 0;
}
-
/*
The pattern management device method.
See gxdevcli.h about return codes.
*/
int
accum_dev_spec_op(gx_device *pdev1, int dev_spec_op,
- void *data, int size)
+ void *data, int size)
{
switch (dev_spec_op) {
case gxdso_pattern_is_cpath_accum:
@@ -330,7 +329,6 @@ accum_dev_spec_op(gx_device *pdev1, int dev_spec_op,
return gx_default_dev_spec_op(pdev1, dev_spec_op, data, size);
}
-
/* Accumulate one rectangle. */
/* Allocate a rectangle to be added to the list. */
static const gx_clip_rect clip_head_rect = {
@@ -344,68 +342,68 @@ accum_alloc_rect(gx_device_cpath_accum * adev)
{
gs_memory_t *mem = adev->list_memory;
gx_clip_rect *ar = gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
- "accum_alloc_rect");
+ "accum_alloc_rect");
if (ar == 0)
- return 0;
+ return 0;
if (adev->list.count == 2) {
- /* We're switching from a single rectangle to a list. */
- /* Allocate the head and tail entries. */
- gx_clip_rect *head = ar;
- gx_clip_rect *tail =
- gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
- "accum_alloc_rect(tail)");
- gx_clip_rect *single =
- gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
- "accum_alloc_rect(single)");
-
- ar = gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
- "accum_alloc_rect(head)");
- if (tail == 0 || single == 0 || ar == 0) {
- gs_free_object(mem, ar, "accum_alloc_rect");
- gs_free_object(mem, single, "accum_alloc_rect(single)");
- gs_free_object(mem, tail, "accum_alloc_rect(tail)");
- gs_free_object(mem, head, "accum_alloc_rect(head)");
- return 0;
- }
- *head = clip_head_rect;
- head->next = single;
- *single = adev->list.single;
- single->prev = head;
- single->next = tail;
- *tail = clip_tail_rect;
- tail->prev = single;
- adev->list.head = head;
- adev->list.tail = tail;
+ /* We're switching from a single rectangle to a list. */
+ /* Allocate the head and tail entries. */
+ gx_clip_rect *head = ar;
+ gx_clip_rect *tail =
+ gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
+ "accum_alloc_rect(tail)");
+ gx_clip_rect *single =
+ gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
+ "accum_alloc_rect(single)");
+
+ ar = gs_alloc_struct(mem, gx_clip_rect, &st_clip_rect,
+ "accum_alloc_rect(head)");
+ if (tail == 0 || single == 0 || ar == 0) {
+ gs_free_object(mem, ar, "accum_alloc_rect");
+ gs_free_object(mem, single, "accum_alloc_rect(single)");
+ gs_free_object(mem, tail, "accum_alloc_rect(tail)");
+ gs_free_object(mem, head, "accum_alloc_rect(head)");
+ return 0;
+ }
+ *head = clip_head_rect;
+ head->next = single;
+ *single = adev->list.single;
+ single->prev = head;
+ single->next = tail;
+ *tail = clip_tail_rect;
+ tail->prev = single;
+ adev->list.head = head;
+ adev->list.tail = tail;
}
return ar;
}
#define ACCUM_ALLOC(s, ar, px, py, qx, qy)\
- if (++(adev->list.count) == 1)\
- ar = &adev->list.single;\
- else if ((ar = accum_alloc_rect(adev)) == 0)\
- return_error(gs_error_VMerror);\
- ACCUM_SET(s, ar, px, py, qx, qy)
+ if (++(adev->list.count) == 1)\
+ ar = &adev->list.single;\
+ else if ((ar = accum_alloc_rect(adev)) == 0)\
+ return_error(gs_error_VMerror);\
+ ACCUM_SET(s, ar, px, py, qx, qy)
#define ACCUM_SET(s, ar, px, py, qx, qy)\
- (ar)->xmin = px, (ar)->ymin = py, (ar)->xmax = qx, (ar)->ymax = qy;\
- clip_rect_print('Q', s, ar)
+ (ar)->xmin = px, (ar)->ymin = py, (ar)->xmax = qx, (ar)->ymax = qy;\
+ clip_rect_print('Q', s, ar)
/* Link or unlink a rectangle in the list. */
#define ACCUM_ADD_LAST(ar)\
- ACCUM_ADD_BEFORE(ar, adev->list.tail)
+ ACCUM_ADD_BEFORE(ar, adev->list.tail)
#define ACCUM_ADD_AFTER(ar, rprev)\
- ar->prev = (rprev), (ar->next = (rprev)->next)->prev = ar,\
- (rprev)->next = ar
+ ar->prev = (rprev), (ar->next = (rprev)->next)->prev = ar,\
+ (rprev)->next = ar
#define ACCUM_ADD_BEFORE(ar, rnext)\
- (ar->prev = (rnext)->prev)->next = ar, ar->next = (rnext),\
- (rnext)->prev = ar
+ (ar->prev = (rnext)->prev)->next = ar, ar->next = (rnext),\
+ (rnext)->prev = ar
#define ACCUM_REMOVE(ar)\
- ar->next->prev = ar->prev, ar->prev->next = ar->next
+ ar->next->prev = ar->prev, ar->prev->next = ar->next
/* Free a rectangle that was removed from the list. */
#define ACCUM_FREE(s, ar)\
- if (--(adev->list.count)) {\
- clip_rect_print('Q', s, ar);\
- gs_free_object(adev->list_memory, ar, "accum_rect");\
- }
+ if (--(adev->list.count)) {\
+ clip_rect_print('Q', s, ar);\
+ gs_free_object(adev->list_memory, ar, "accum_rect");\
+ }
/*
* Add a rectangle to the list. It would be wonderful if rectangles
* were always disjoint and always presented in the correct order,
@@ -420,7 +418,7 @@ accum_alloc_rect(gx_device_cpath_accum * adev)
*/
static int
accum_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_cpath_accum * const adev = (gx_device_cpath_accum *)dev;
int xe = x + w, ye = y + h;
@@ -431,166 +429,166 @@ accum_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Clip the rectangle being added. */
if (y < adev->clip_box.p.y)
- y = adev->clip_box.p.y;
+ y = adev->clip_box.p.y;
if (ye > adev->clip_box.q.y)
- ye = adev->clip_box.q.y;
+ ye = adev->clip_box.q.y;
if (y >= ye)
- return 0;
+ return 0;
if (x < adev->clip_box.p.x)
- x = adev->clip_box.p.x;
+ x = adev->clip_box.p.x;
if (xe > adev->clip_box.q.x)
- xe = adev->clip_box.q.x;
+ xe = adev->clip_box.q.x;
if (x >= xe)
- return 0;
+ return 0;
/* Update the bounding box. */
if (x < adev->bbox.p.x)
- adev->bbox.p.x = x;
+ adev->bbox.p.x = x;
if (y < adev->bbox.p.y)
- adev->bbox.p.y = y;
+ adev->bbox.p.y = y;
if (xe > adev->bbox.q.x)
- adev->bbox.q.x = xe;
+ adev->bbox.q.x = xe;
if (ye > adev->bbox.q.y)
- adev->bbox.q.y = ye;
+ adev->bbox.q.y = ye;
top:
if (adev->list.count == 0) { /* very first rectangle */
- adev->list.count = 1;
- ACCUM_SET("single", &adev->list.single, x, y, xe, ye);
- return 0;
+ adev->list.count = 1;
+ ACCUM_SET("single", &adev->list.single, x, y, xe, ye);
+ return 0;
}
if (adev->list.count == 1) { /* check for Y merging */
- rptr = &adev->list.single;
- if (x == rptr->xmin && xe == rptr->xmax &&
- y <= rptr->ymax && ye >= rptr->ymin
- ) {
- if (y < rptr->ymin)
- rptr->ymin = y;
- if (ye > rptr->ymax)
- rptr->ymax = ye;
- return 0;
- }
+ rptr = &adev->list.single;
+ if (x == rptr->xmin && xe == rptr->xmax &&
+ y <= rptr->ymax && ye >= rptr->ymin
+ ) {
+ if (y < rptr->ymin)
+ rptr->ymin = y;
+ if (ye > rptr->ymax)
+ rptr->ymax = ye;
+ return 0;
+ }
}
else
- rptr = adev->list.tail->prev;
+ rptr = adev->list.tail->prev;
if (y >= rptr->ymax) {
- if (y == rptr->ymax && x == rptr->xmin && xe == rptr->xmax &&
- (rptr->prev == 0 || y != rptr->prev->ymax)
- ) {
- rptr->ymax = ye;
- return 0;
- }
- ACCUM_ALLOC("app.y", nr, x, y, xe, ye);
- ACCUM_ADD_LAST(nr);
- return 0;
+ if (y == rptr->ymax && x == rptr->xmin && xe == rptr->xmax &&
+ (rptr->prev == 0 || y != rptr->prev->ymax)
+ ) {
+ rptr->ymax = ye;
+ return 0;
+ }
+ ACCUM_ALLOC("app.y", nr, x, y, xe, ye);
+ ACCUM_ADD_LAST(nr);
+ return 0;
} else if (y == rptr->ymin && ye == rptr->ymax && x >= rptr->xmin) {
- if (x <= rptr->xmax) {
- if (xe > rptr->xmax)
- rptr->xmax = xe;
- return 0;
- }
- ACCUM_ALLOC("app.x", nr, x, y, xe, ye);
- ACCUM_ADD_LAST(nr);
- return 0;
+ if (x <= rptr->xmax) {
+ if (xe > rptr->xmax)
+ rptr->xmax = xe;
+ return 0;
+ }
+ ACCUM_ALLOC("app.x", nr, x, y, xe, ye);
+ ACCUM_ADD_LAST(nr);
+ return 0;
}
ACCUM_ALLOC("accum", nr, x, y, xe, ye);
rptr = adev->list.tail->prev;
/* Work backwards till we find the insertion point. */
while (ye <= rptr->ymin)
- rptr = rptr->prev;
+ rptr = rptr->prev;
ymin = rptr->ymin;
ymax = rptr->ymax;
if (ye > ymax) {
- if (y >= ymax) { /* Insert between two bands. */
- ACCUM_ADD_AFTER(nr, rptr);
- return 0;
- }
- /* Split off the top part of the new rectangle. */
- ACCUM_ALLOC("a.top", ar, x, ymax, xe, ye);
- ACCUM_ADD_AFTER(ar, rptr);
- ye = nr->ymax = ymax;
- clip_rect_print('Q', " ymax", nr);
+ if (y >= ymax) { /* Insert between two bands. */
+ ACCUM_ADD_AFTER(nr, rptr);
+ return 0;
+ }
+ /* Split off the top part of the new rectangle. */
+ ACCUM_ALLOC("a.top", ar, x, ymax, xe, ye);
+ ACCUM_ADD_AFTER(ar, rptr);
+ ye = nr->ymax = ymax;
+ clip_rect_print('Q', " ymax", nr);
}
/* Here we know ymin < ye <= ymax; */
/* rptr points to the last node with this value of ymin/ymax. */
/* If necessary, split off the part of the existing band */
/* that is above the new band. */
if (ye < ymax) {
- gx_clip_rect *rsplit = rptr;
-
- while (rsplit->ymax == ymax) {
- ACCUM_ALLOC("s.top", ar, rsplit->xmin, ye, rsplit->xmax, ymax);
- ACCUM_ADD_AFTER(ar, rptr);
- rsplit->ymax = ye;
- rsplit = rsplit->prev;
- }
- ymax = ye;
+ gx_clip_rect *rsplit = rptr;
+
+ while (rsplit->ymax == ymax) {
+ ACCUM_ALLOC("s.top", ar, rsplit->xmin, ye, rsplit->xmax, ymax);
+ ACCUM_ADD_AFTER(ar, rptr);
+ rsplit->ymax = ye;
+ rsplit = rsplit->prev;
+ }
+ ymax = ye;
}
/* Now ye = ymax. If necessary, split off the part of the */
/* existing band that is below the new band. */
if (y > ymin) {
- gx_clip_rect *rbot = rptr, *rsplit;
-
- while (rbot->prev->ymin == ymin)
- rbot = rbot->prev;
- for (rsplit = rbot;;) {
- ACCUM_ALLOC("s.bot", ar, rsplit->xmin, ymin, rsplit->xmax, y);
- ACCUM_ADD_BEFORE(ar, rbot);
- rsplit->ymin = y;
- if (rsplit == rptr)
- break;
- rsplit = rsplit->next;
- }
- ymin = y;
+ gx_clip_rect *rbot = rptr, *rsplit;
+
+ while (rbot->prev->ymin == ymin)
+ rbot = rbot->prev;
+ for (rsplit = rbot;;) {
+ ACCUM_ALLOC("s.bot", ar, rsplit->xmin, ymin, rsplit->xmax, y);
+ ACCUM_ADD_BEFORE(ar, rbot);
+ rsplit->ymin = y;
+ if (rsplit == rptr)
+ break;
+ rsplit = rsplit->next;
+ }
+ ymin = y;
}
/* Now y <= ymin as well. (y < ymin is possible.) */
nr->ymin = ymin;
/* Search for the X insertion point. */
for (; rptr->ymin == ymin; rptr = rptr->prev) {
- if (xe < rptr->xmin)
- continue; /* still too far to right */
- if (x > rptr->xmax)
- break; /* disjoint */
- /* The new rectangle overlaps an existing one. Merge them. */
- if (xe > rptr->xmax) {
- rptr->xmax = nr->xmax; /* might be > xe if */
- /* we already did a merge */
- clip_rect_print('Q', "widen", rptr);
- }
- ACCUM_FREE("free", nr);
- if (x >= rptr->xmin)
- goto out;
- /* Might overlap other rectangles to the left. */
- rptr->xmin = x;
- nr = rptr;
- ACCUM_REMOVE(rptr);
- clip_rect_print('Q', "merge", nr);
+ if (xe < rptr->xmin)
+ continue; /* still too far to right */
+ if (x > rptr->xmax)
+ break; /* disjoint */
+ /* The new rectangle overlaps an existing one. Merge them. */
+ if (xe > rptr->xmax) {
+ rptr->xmax = nr->xmax; /* might be > xe if */
+ /* we already did a merge */
+ clip_rect_print('Q', "widen", rptr);
+ }
+ ACCUM_FREE("free", nr);
+ if (x >= rptr->xmin)
+ goto out;
+ /* Might overlap other rectangles to the left. */
+ rptr->xmin = x;
+ nr = rptr;
+ ACCUM_REMOVE(rptr);
+ clip_rect_print('Q', "merge", nr);
}
ACCUM_ADD_AFTER(nr, rptr);
out:
/* Check whether there are only 0 or 1 rectangles left. */
if (adev->list.count <= 1) {
- /* We're switching from a list to at most 1 rectangle. */
- /* Free the head and tail entries. */
- gs_memory_t *mem = adev->list_memory;
- gx_clip_rect *single = adev->list.head->next;
-
- if (single != adev->list.tail) {
- adev->list.single = *single;
- gs_free_object(mem, single, "accum_free_rect(single)");
- adev->list.single.next = adev->list.single.prev = 0;
- }
- gs_free_object(mem, adev->list.tail, "accum_free_rect(tail)");
- gs_free_object(mem, adev->list.head, "accum_free_rect(head)");
- adev->list.head = 0;
- adev->list.tail = 0;
+ /* We're switching from a list to at most 1 rectangle. */
+ /* Free the head and tail entries. */
+ gs_memory_t *mem = adev->list_memory;
+ gx_clip_rect *single = adev->list.head->next;
+
+ if (single != adev->list.tail) {
+ adev->list.single = *single;
+ gs_free_object(mem, single, "accum_free_rect(single)");
+ adev->list.single.next = adev->list.single.prev = 0;
+ }
+ gs_free_object(mem, adev->list.tail, "accum_free_rect(tail)");
+ gs_free_object(mem, adev->list.head, "accum_free_rect(head)");
+ adev->list.head = 0;
+ adev->list.tail = 0;
}
/* Check whether there is still more of the new band to process. */
if (y < ymin) {
- /* Continue with the bottom part of the new rectangle. */
- clip_rect_print('Q', " ymin", nr);
- ye = ymin;
- goto top;
+ /* Continue with the bottom part of the new rectangle. */
+ clip_rect_print('Q', " ymin", nr);
+ ye = ymin;
+ goto top;
}
return 0;
}
diff --git a/gs/base/gxalloc.h b/gs/base/gxalloc.h
index 25036b1f2..988bf14f5 100644
--- a/gs/base/gxalloc.h
+++ b/gs/base/gxalloc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -134,23 +134,23 @@ struct chunk_s {
/* (aligned objects) and from the top down (strings). */
byte *cbase; /* bottom of chunk data area */
byte *int_freed_top; /* top of most recent internal free area */
- /* in chunk (which may no longer be free), */
- /* used to decide when to consolidate */
- /* trailing free space in allocated area */
+ /* in chunk (which may no longer be free), */
+ /* used to decide when to consolidate */
+ /* trailing free space in allocated area */
byte *cbot; /* bottom of free area */
- /* (top of aligned objects) */
+ /* (top of aligned objects) */
obj_header_t *rcur; /* current refs object, 0 if none */
byte *rtop; /* top of rcur */
byte *ctop; /* top of free area */
- /* (bottom of strings) */
+ /* (bottom of strings) */
byte *climit; /* top of strings */
byte *cend; /* top of chunk */
chunk_t *cprev; /* chain chunks together, */
chunk_t *cnext; /* sorted by address */
chunk_t *outer; /* the chunk of which this is */
- /* an inner chunk, if any */
+ /* an inner chunk, if any */
uint inner_count; /* number of chunks of which this is */
- /* the outer chunk, if any */
+ /* the outer chunk, if any */
bool has_refs; /* true if any refs in chunk */
/*
* Free lists for single bytes in blocks of 1 to 2*N-1 bytes, one per
@@ -179,7 +179,7 @@ struct chunk_s {
string_reloc_offset *sreloc; /* relocation for string blocks */
byte *sdest; /* destination for (top of) strings */
byte *rescan_bot; /* bottom of rescanning range if */
- /* the GC mark stack overflows */
+ /* the GC mark stack overflows */
byte *rescan_top; /* top of range ditto */
};
@@ -200,31 +200,31 @@ extern_st(st_chunk);
* NB on error END_OBJECTS_SCAN calls gs_abort in debug systems.
*/
#define SCAN_CHUNK_OBJECTS(cp)\
- { obj_header_t *pre = (obj_header_t *)((cp)->cbase);\
- obj_header_t *end = (obj_header_t *)((cp)->cbot);\
- uint size;\
+ { obj_header_t *pre = (obj_header_t *)((cp)->cbase);\
+ obj_header_t *end = (obj_header_t *)((cp)->cbot);\
+ uint size;\
\
- for ( ; pre < end;\
- pre = (obj_header_t *)((char *)pre + obj_size_round(size))\
- )\
- {
+ for ( ; pre < end;\
+ pre = (obj_header_t *)((char *)pre + obj_size_round(size))\
+ )\
+ {
#define DO_ALL\
- size = pre_obj_contents_size(pre);\
- {
+ size = pre_obj_contents_size(pre);\
+ {
#define END_OBJECTS_SCAN_NO_ABORT\
- }\
- }\
- }
+ }\
+ }\
+ }
#ifdef DEBUG
# define END_OBJECTS_SCAN\
- }\
- }\
- if ( pre != end )\
- { lprintf2("Chunk parsing error, 0x%lx != 0x%lx\n",\
- (ulong)pre, (ulong)end);\
- /*gs_abort((const gs_memory_t *)NULL);*/ \
- }\
- }
+ }\
+ }\
+ if ( pre != end )\
+ { lprintf2("Chunk parsing error, 0x%lx != 0x%lx\n",\
+ (ulong)pre, (ulong)end);\
+ /*gs_abort((const gs_memory_t *)NULL);*/ \
+ }\
+ }
#else
# define END_OBJECTS_SCAN END_OBJECTS_SCAN_NO_ABORT
#endif
@@ -278,12 +278,12 @@ void alloc_free_chunk(chunk_t *, gs_ref_memory_t *);
"%s 0x%lx (0x%lx..0x%lx, 0x%lx..0x%lx..0x%lx)\n"
#define dprintf_chunk(msg, cp)\
dprintf7(dprintf_chunk_format,\
- msg, (ulong)(cp), (ulong)(cp)->cbase, (ulong)(cp)->cbot,\
- (ulong)(cp)->ctop, (ulong)(cp)->climit, (ulong)(cp)->cend)
+ msg, (ulong)(cp), (ulong)(cp)->cbase, (ulong)(cp)->cbot,\
+ (ulong)(cp)->ctop, (ulong)(cp)->climit, (ulong)(cp)->cend)
#define if_debug_chunk(c, msg, cp)\
if_debug7(c, dprintf_chunk_format,\
- msg, (ulong)(cp), (ulong)(cp)->cbase, (ulong)(cp)->cbot,\
- (ulong)(cp)->ctop, (ulong)(cp)->climit, (ulong)(cp)->cend)
+ msg, (ulong)(cp), (ulong)(cp)->cbase, (ulong)(cp)->cbot,\
+ (ulong)(cp)->ctop, (ulong)(cp)->climit, (ulong)(cp)->cend)
/* ================ Allocator state ================ */
@@ -332,8 +332,8 @@ struct gs_ref_memory_s {
gs_memory_common;
uint chunk_size;
uint large_size; /* min size to give large object */
- /* its own chunk: must be */
- /* 1 mod obj_align_mod */
+ /* its own chunk: must be */
+ /* 1 mod obj_align_mod */
uint space; /* a_local, a_global, a_system */
# if IGC_PTR_STABILITY_CHECK
unsigned space_id:3; /* r_space_bits + 1 bit for "instability". */
@@ -343,23 +343,23 @@ struct gs_ref_memory_s {
gs_memory_gc_status_t gc_status;
/* The following are updated dynamically. */
bool is_controlled; /* if true, this allocator doesn't manage */
- /* its own chunks */
+ /* its own chunks */
ulong limit; /* signal a VMerror when total */
- /* allocated exceeds this */
+ /* allocated exceeds this */
chunk_t *cfirst; /* head of chunk list */
chunk_t *clast; /* tail of chunk list */
chunk_t cc; /* current chunk */
chunk_t *pcc; /* where to store cc */
chunk_locator_t cfreed; /* chunk where last object freed */
ulong allocated; /* total size of all chunks */
- /* allocated at this save level */
+ /* allocated at this save level */
ulong gc_allocated; /* value of (allocated + */
- /* previous_status.allocated) after last GC */
+ /* previous_status.allocated) after last GC */
struct lost_ { /* space freed and 'lost' (not put on a */
- /* freelist) */
- ulong objects;
- ulong refs;
- ulong strings;
+ /* freelist) */
+ ulong objects;
+ ulong refs;
+ ulong strings;
} lost;
/*
* The following are for the interpreter's convenience: the
@@ -381,7 +381,7 @@ struct gs_ref_memory_s {
long total_scanned_after_compacting;
struct alloc_save_s *reloc_saved; /* for GC */
gs_memory_status_t previous_status; /* total allocated & used */
- /* in outer save levels */
+ /* in outer save levels */
uint largest_free_size; /* largest (aligned) size on large block list */
/* We put the freelists last to keep the scalar offsets small. */
obj_header_t *freelists[num_freelists];
@@ -406,12 +406,12 @@ extern const gs_memory_procs_t gs_ref_memory_procs;
* END_CHUNKS_SCAN
*/
#define SCAN_MEM_CHUNKS(mem, cp)\
- { chunk_t *cp = (mem)->cfirst;\
- for ( ; cp != 0; cp = cp->cnext )\
- {
+ { chunk_t *cp = (mem)->cfirst;\
+ for ( ; cp != 0; cp = cp->cnext )\
+ {
#define END_CHUNKS_SCAN\
- }\
- }
+ }\
+ }
/* ================ Debugging ================ */
@@ -459,7 +459,7 @@ void debug_print_chunk(const gs_memory_t *mem, const chunk_t * cp); /* default o
/* Print the contents of all chunks managed by an allocator. */
/* Relevant options: all. */
void debug_dump_memory(const gs_ref_memory_t *mem,
- const dump_control_t *control);
+ const dump_control_t *control);
/* convenience routine to call debug_dump_memory(), defaults
dump_control_t to dump_control_all. */
diff --git a/gs/base/gxalpha.h b/gs/base/gxalpha.h
index 6769cf398..2d9d50ade 100644
--- a/gs/base/gxalpha.h
+++ b/gs/base/gxalpha.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxarith.h b/gs/base/gxarith.h
index 4ab0e445c..d7d965bd4 100644
--- a/gs/base/gxarith.h
+++ b/gs/base/gxarith.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxband.h b/gs/base/gxband.h
index 2138a3b74..25873cf8a 100644
--- a/gs/base/gxband.h
+++ b/gs/base/gxband.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ typedef struct gx_band_params_s {
typedef struct gx_colors_used_s {
gx_color_index or; /* the "or" of all the used colors */
bool slow_rop; /* true if any RasterOps that can't be */
- /* executed plane-by-plane on CMYK devices */
+ /* executed plane-by-plane on CMYK devices */
} gx_colors_used_t;
/*
@@ -65,9 +65,9 @@ typedef struct gx_band_page_info_s {
uint tile_cache_size; /* size of tile cache */
int64_t bfile_end_pos; /* ftell at end of bfile */
gx_band_params_t band_params; /* parameters used when writing band list */
- /* (actual values, no 0s) */
+ /* (actual values, no 0s) */
int scan_lines_per_colors_used; /* number of scan lines per colors_used */
- /* entry (a multiple of the band height) */
+ /* entry (a multiple of the band height) */
gx_colors_used_t band_colors_used[PAGE_INFO_NUM_COLORS_USED]; /* colors used on the page */
} gx_band_page_info_t;
#define PAGE_INFO_NULL_VALUES\
diff --git a/gs/base/gxbcache.c b/gs/base/gxbcache.c
index 35a5c9c4c..f8e26712a 100644
--- a/gs/base/gxbcache.c
+++ b/gs/base/gxbcache.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,10 +43,10 @@ gx_bits_cache_chunk_init(gx_bits_cache_chunk * bck, byte * data, uint size)
bck->size = size;
bck->allocated = 0;
if (data != 0) {
- gx_cached_bits_head *cbh = (gx_cached_bits_head *) data;
+ gx_cached_bits_head *cbh = (gx_cached_bits_head *) data;
- cbh->size = size;
- cb_head_set_free(cbh);
+ cbh->size = size;
+ cb_head_set_free(cbh);
}
}
@@ -70,29 +70,29 @@ gx_bits_cache_alloc(gx_bits_cache * bc, ulong lsize, gx_cached_bits_head ** pcbh
uint fsize = 0;
if (lsize1 > bck->size - cnext && lsize != left) { /* Not enough room to allocate in this chunk. */
- *pcbh = 0;
- return -1;
+ *pcbh = 0;
+ return -1;
}
/* Look for and/or free enough space. */
cbh = cbh_next = (gx_cached_bits_head *) (bck->data + cnext);
while (fsize < ssize1 && fsize != ssize) {
- if (!cb_head_is_free(cbh_next)) { /* Ask the caller to free the entry. */
- if (fsize)
- cbh->size = fsize;
- *pcbh = cbh_next;
- return -1;
- }
- fsize += cbh_next->size;
- if_debug2('K', "[K]merging free bits 0x%lx(%u)\n",
- (ulong) cbh_next, cbh_next->size);
- cbh_next = (gx_cached_bits_head *) ((byte *) cbh + fsize);
+ if (!cb_head_is_free(cbh_next)) { /* Ask the caller to free the entry. */
+ if (fsize)
+ cbh->size = fsize;
+ *pcbh = cbh_next;
+ return -1;
+ }
+ fsize += cbh_next->size;
+ if_debug2('K', "[K]merging free bits 0x%lx(%u)\n",
+ (ulong) cbh_next, cbh_next->size);
+ cbh_next = (gx_cached_bits_head *) ((byte *) cbh + fsize);
}
if (fsize > ssize) { /* fsize >= ssize1 */
- cbh_next = (gx_cached_bits_head *) ((byte *) cbh + ssize);
- cbh_next->size = fsize - ssize;
- cb_head_set_free(cbh_next);
- if_debug2('K', "[K]shortening bits 0x%lx by %u (initial)\n",
- (ulong) cbh, fsize - ssize);
+ cbh_next = (gx_cached_bits_head *) ((byte *) cbh + ssize);
+ cbh_next->size = fsize - ssize;
+ cb_head_set_free(cbh_next);
+ if_debug2('K', "[K]shortening bits 0x%lx by %u (initial)\n",
+ (ulong) cbh, fsize - ssize);
}
gs_alloc_fill(cbh, gs_alloc_fill_block, ssize);
cbh->size = ssize;
@@ -109,14 +109,14 @@ gx_bits_cache_alloc(gx_bits_cache * bc, ulong lsize, gx_cached_bits_head ** pcbh
/* Shorten an entry by a given amount. */
void
gx_bits_cache_shorten(gx_bits_cache * bc, gx_cached_bits_head * cbh,
- uint diff, gx_bits_cache_chunk * bck)
+ uint diff, gx_bits_cache_chunk * bck)
{
gx_cached_bits_head *next;
if ((byte *) cbh + cbh->size == bck->data + bc->cnext &&
- bck == bc->chunks
- )
- bc->cnext -= diff;
+ bck == bc->chunks
+ )
+ bc->cnext -= diff;
bc->bsize -= diff;
bck->allocated -= diff;
cbh->size -= diff;
@@ -129,7 +129,7 @@ gx_bits_cache_shorten(gx_bits_cache * bc, gx_cached_bits_head * cbh,
/* from any other structures (like a hash table). */
void
gx_bits_cache_free(gx_bits_cache * bc, gx_cached_bits_head * cbh,
- gx_bits_cache_chunk * bck)
+ gx_bits_cache_chunk * bck)
{
uint size = cbh->size;
diff --git a/gs/base/gxbcache.h b/gs/base/gxbcache.h
index 5f7d8c9d9..36295da91 100644
--- a/gs/base/gxbcache.h
+++ b/gs/base/gxbcache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,12 +39,12 @@ typedef struct gx_cached_bits_head_s {
#define cb_head_is_free(cbh) ((cbh)->depth == 0)
#define cb_head_set_free(cbh) ((cbh)->depth = 0)
#define gx_cached_bits_common\
- gx_cached_bits_head head; /* must be first */\
- /* The rest of the entry is an abbreviation of */\
- /* gx_strip_bitmap, sans data. */\
- ushort width, height, shift;\
- ushort raster;\
- gx_bitmap_id id
+ gx_cached_bits_head head; /* must be first */\
+ /* The rest of the entry is an abbreviation of */\
+ /* gx_strip_bitmap, sans data. */\
+ ushort width, height, shift;\
+ ushort raster;\
+ gx_bitmap_id id
/* Define aliases for head members. */
#define cb_depth head.depth
/* Define aliases for common members formerly in the head. */
@@ -78,11 +78,11 @@ struct gx_bits_cache_chunk_s {
/* ---------------- Bitmap cache ---------------- */
#define gx_bits_cache_common\
- gx_bits_cache_chunk *chunks; /* current chunk in circular list */\
- uint cnext; /* rover for allocating entries */\
- /* in current chunk */\
- uint bsize; /* total # of bytes for all entries */\
- uint csize /* # of entries */
+ gx_bits_cache_chunk *chunks; /* current chunk in circular list */\
+ uint cnext; /* rover for allocating entries */\
+ /* in current chunk */\
+ uint bsize; /* total # of bytes for all entries */\
+ uint csize /* # of entries */
typedef struct gx_bits_cache_s {
gx_bits_cache_common;
} gx_bits_cache;
@@ -109,11 +109,11 @@ int gx_bits_cache_alloc(gx_bits_cache *, ulong, gx_cached_bits_head **);
/* Shorten an entry by a given amount. */
void gx_bits_cache_shorten(gx_bits_cache *, gx_cached_bits_head *,
- uint, gx_bits_cache_chunk *);
+ uint, gx_bits_cache_chunk *);
/* Free an entry. The caller is responsible for removing the entry */
/* from any other structures (like a hash table). */
void gx_bits_cache_free(gx_bits_cache *, gx_cached_bits_head *,
- gx_bits_cache_chunk *);
+ gx_bits_cache_chunk *);
#endif /* gxbcache_INCLUDED */
diff --git a/gs/base/gxbitfmt.h b/gs/base/gxbitfmt.h
index a4874d216..141489b57 100644
--- a/gs/base/gxbitfmt.h
+++ b/gs/base/gxbitfmt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -158,7 +158,7 @@ typedef ulong gx_bitmap_format_t;
#define GB_OFFSET_0 (1L<<24) /* no offsetting */
#define GB_OFFSET_SPECIFIED (1L<<25) /* client-specified offset */
#define GB_OFFSET_ANY (1L<<26) /* any offset is acceptable */
- /* (for GB_RETURN_POINTER only) */
+ /* (for GB_RETURN_POINTER only) */
/*unused*/ /*(1L<<27)*/
#define GB_OFFSET_ALL\
@@ -183,7 +183,7 @@ typedef ulong gx_bitmap_format_t;
#define GB_RASTER_STANDARD (1L<<28)
#define GB_RASTER_SPECIFIED (1L<<29) /* any client-specified raster */
#define GB_RASTER_ANY (1L<<30) /* any raster is acceptable (for */
- /* GB_RETURN_POINTER only) */
+ /* GB_RETURN_POINTER only) */
#define GB_RASTER_ALL\
(GB_RASTER_STANDARD | GB_RASTER_SPECIFIED | GB_RASTER_ANY)
diff --git a/gs/base/gxbitmap.h b/gs/base/gxbitmap.h
index 8b14deee7..04f67720e 100644
--- a/gs/base/gxbitmap.h
+++ b/gs/base/gxbitmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,7 +44,7 @@ typedef gs_bitmap_id gx_bitmap_id;
* assumption is not true in some MSVC implementations, but even in those
* implementations, the alignment is sufficient to satisfy the hardware.
* See gsmemraw.h for more information about this.)
- *
+ *
* The padding requirement is that if the last data byte being operated on
* is at offset B relative to the start of the scan line, bytes up to and
* including offset ROUND_UP(B + 1, align_bitmap_mod) - 1 may be accessed,
@@ -129,9 +129,9 @@ typedef struct gx_const_tile_bitmap_s {
* shift = (rep_shift * (size.y / rep_height)) % rep_width
*/
#define gx_strip_bitmap_common(data_type)\
- gx_tile_bitmap_common(data_type);\
- ushort rep_shift;\
- ushort shift
+ gx_tile_bitmap_common(data_type);\
+ ushort rep_shift;\
+ ushort shift
typedef struct gx_strip_bitmap_s {
gx_strip_bitmap_common(byte);
} gx_strip_bitmap;
diff --git a/gs/base/gxbitops.h b/gs/base/gxbitops.h
index 0e0c23de3..dfa7110da 100644
--- a/gs/base/gxbitops.h
+++ b/gs/base/gxbitops.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -75,7 +75,7 @@
/* Pointer arithmetic macros. */
#define inc_ptr(ptr,delta)\
- (ptr = (void *)((byte *)ptr + (delta)))
+ (ptr = (void *)((byte *)ptr + (delta)))
/* Define macros for setting up left- and right-end masks. */
/* These are used for monobit operations, and for filling */
@@ -87,20 +87,20 @@
#if arch_is_big_endian
# define mono_copy_chunk uint
# define set_mono_right_mask(var, w)\
- (var = ((w) == chunk_bits ? chunk_all_bits : chunk_hi_bits(w)))
+ (var = ((w) == chunk_bits ? chunk_all_bits : chunk_hi_bits(w)))
/*
* We have to split the following statement because of a bug in the Xenix C
* compiler (it produces a signed rather than an unsigned shift if we don't
* split).
*/
# define set_mono_thin_mask(var, w, bit)\
- set_mono_right_mask(var, w), var >>= (bit)
+ set_mono_right_mask(var, w), var >>= (bit)
/*
* We have to split the following statement in two because of a bug
* in the DEC VAX/VMS C compiler.
*/
# define set_mono_left_mask(var, bit)\
- (var = chunk_all_bits, var >>= (bit))
+ (var = chunk_all_bits, var >>= (bit))
#else
# define mono_copy_chunk bits16
extern const bits16 mono_copy_masks[17];
@@ -116,11 +116,11 @@ extern const bits32 mono_fill_masks[33];
* mono_copy_masks before using the following macros.
*/
# define set_mono_left_mask(var, bit)\
- (var = mono_masks[bit])
+ (var = mono_masks[bit])
# define set_mono_thin_mask(var, w, bit)\
- (var = ~mono_masks[(w) + (bit)] & mono_masks[bit])
+ (var = ~mono_masks[(w) + (bit)] & mono_masks[bit])
# define set_mono_right_mask(var, ebit)\
- (var = ~mono_masks[ebit])
+ (var = ~mono_masks[ebit])
#endif
#endif /* gxbitops_INCLUDED */
diff --git a/gs/base/gxblend.c b/gs/base/gxblend.c
index c09ccac7a..26428d37e 100644
--- a/gs/base/gxblend.c
+++ b/gs/base/gxblend.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,7 +21,6 @@
#include "gsicc_cache.h"
#include "gsicc_manage.h"
-
typedef int art_s32;
#if RAW_DUMP
@@ -30,14 +29,14 @@ extern unsigned int clist_band_count;
#endif
/* This function is used for mapping the SMask source to a
- monochrome luminosity value which basically is the alpha value
+ monochrome luminosity value which basically is the alpha value
Note, that separation colors are not allowed here. Everything
must be in CMYK, RGB or monochrome. */
/* Note, data is planar */
-void
-smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
+void
+smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
int plane_stride, byte *src, const byte *dst, bool isadditive,
gs_transparency_mask_subtype_t SMask_SubType)
{
@@ -48,7 +47,7 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
#if RAW_DUMP
dump_raw_buffer(num_rows, row_stride, n_chan,
- plane_stride, row_stride,
+ plane_stride, row_stride,
"Raw_Mask", src);
global_index++;
@@ -59,14 +58,14 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
memcpy(dst, &(src[plane_stride]), plane_stride);
return;
}
- /* If we are alpha type, then just grab that */
+ /* If we are alpha type, then just grab that */
/* We need to optimize this so that we are only drawing alpha in the rect fills */
if ( SMask_SubType == TRANSPARENCY_MASK_Alpha ){
mask_alpha_offset = (n_chan - 1) * plane_stride;
memcpy(dst, &(src[mask_alpha_offset]), plane_stride);
return;
}
- /* To avoid the if statement inside this loop,
+ /* To avoid the if statement inside this loop,
decide on additive or subractive now */
if (isadditive || n_chan == 2) {
/* Now we need to split Gray from RGB */
@@ -76,12 +75,12 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
mask_R_offset = 0;
for ( y = 0; y < num_rows; y++ ) {
for ( x = 0; x < num_cols; x++ ){
- /* With the current design this will indicate if
+ /* With the current design this will indicate if
we ever did a fill at this pixel. if not then move on.
This could have some serious optimization */
- if (src[x + mask_alpha_offset] != 0x00) {
+ if (src[x + mask_alpha_offset] != 0x00) {
dstptr[x] = src[x + mask_R_offset];
- }
+ }
}
dstptr += row_stride;
mask_alpha_offset += row_stride;
@@ -95,17 +94,17 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
mask_alpha_offset = (n_chan - 1) * plane_stride;
for ( y = 0; y < num_rows; y++ ) {
for ( x = 0; x < num_cols; x++ ){
- /* With the current design this will indicate if
+ /* With the current design this will indicate if
we ever did a fill at this pixel. if not then move on */
- if (src[x + mask_alpha_offset] != 0x00) {
- /* Get luminosity of Device RGB value */
+ if (src[x + mask_alpha_offset] != 0x00) {
+ /* Get luminosity of Device RGB value */
float temp;
- temp = ( 0.30 * src[x + mask_R_offset] +
- 0.59 * src[x + mask_G_offset] +
+ temp = ( 0.30 * src[x + mask_R_offset] +
+ 0.59 * src[x + mask_G_offset] +
0.11 * src[x + mask_B_offset] );
temp = temp * (1.0 / 255.0 ); /* May need to be optimized */
- dstptr[x] = float_color_to_byte_color(temp);
- }
+ dstptr[x] = float_color_to_byte_color(temp);
+ }
}
dstptr += row_stride;
mask_alpha_offset += row_stride;
@@ -123,20 +122,20 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
mask_K_offset = 3 * plane_stride;
for ( y = 0; y < num_rows; y++ ){
for ( x = 0; x < num_cols; x++ ){
- /* With the current design this will indicate if
+ /* With the current design this will indicate if
we ever did a fill at this pixel. if not then move on */
- if (src[x + mask_alpha_offset] != 0x00){
- /* PDF spec says to use Y = 0.30 (1 - C)(1 - K) +
+ if (src[x + mask_alpha_offset] != 0x00){
+ /* PDF spec says to use Y = 0.30 (1 - C)(1 - K) +
0.59 (1 - M)(1 - K) + 0.11 (1 - Y)(1 - K) */
/* For device CMYK */
float temp;
- temp = ( 0.30 * ( 0xff - src[x + mask_C_offset]) +
- 0.59 * ( 0xff - src[x + mask_M_offset]) +
- 0.11 * ( 0xff - src[x + mask_Y_offset]) ) *
+ temp = ( 0.30 * ( 0xff - src[x + mask_C_offset]) +
+ 0.59 * ( 0xff - src[x + mask_M_offset]) +
+ 0.11 * ( 0xff - src[x + mask_Y_offset]) ) *
( 0xff - src[x + mask_K_offset]);
temp = temp * (1.0 / 65025.0 ); /* May need to be optimized */
- dstptr[x] = float_color_to_byte_color(temp);
- }
+ dstptr[x] = float_color_to_byte_color(temp);
+ }
}
dstptr += row_stride;
mask_alpha_offset += row_stride;
@@ -150,10 +149,10 @@ smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
/* soft mask gray buffer should be blended with its transparency planar data
during the pop for a luminosity case if we have a soft mask within a soft
- mask. This situation is detected in the code so that we only do this
+ mask. This situation is detected in the code so that we only do this
blending in those rare situations */
void
-smask_blend(byte *src, int width, int height, int rowstride,
+smask_blend(byte *src, int width, int height, int rowstride,
int planestride)
{
int x, y;
@@ -180,7 +179,7 @@ smask_blend(byte *src, int width, int height, int rowstride,
}
}
-void smask_copy(int num_rows, int num_cols, int row_stride,
+void smask_copy(int num_rows, int num_cols, int row_stride,
byte *src, const byte *dst)
{
int y;
@@ -195,8 +194,8 @@ void smask_copy(int num_rows, int num_cols, int row_stride,
}
}
-void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
- int plane_stride, byte *src, const byte *dst,
+void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
+ int plane_stride, byte *src, const byte *dst,
gsicc_link_t *icclink)
{
gsicc_bufferdesc_t input_buff_desc;
@@ -204,29 +203,29 @@ void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
#if RAW_DUMP
dump_raw_buffer(num_rows, row_stride, n_chan,
- plane_stride, row_stride,
+ plane_stride, row_stride,
"Raw_Mask_ICC", src);
global_index++;
#endif
/* Set up the buffer descriptors. Note that pdf14 always has
- the alpha channels at the back end (last planes).
- We will just handle that here and let the CMM know
+ the alpha channels at the back end (last planes).
+ We will just handle that here and let the CMM know
nothing about it */
gsicc_init_buffer(&input_buff_desc, n_chan-1, 1,
false, false, true, plane_stride, row_stride,
num_rows, num_cols);
gsicc_init_buffer(&output_buff_desc, 1, 1,
- false, false, true, plane_stride,
+ false, false, true, plane_stride,
row_stride, num_rows, num_cols);
/* Transform the data */
- gscms_transform_color_buffer(icclink, &input_buff_desc,
+ gscms_transform_color_buffer(icclink, &input_buff_desc,
&output_buff_desc, (void*) src, (void*) dst);
}
void
art_blend_luminosity_rgb_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int rb = backdrop[0], gb = backdrop[1], bb = backdrop[2];
int rs = src[0], gs = src[1], bs = src[2];
@@ -242,26 +241,26 @@ art_blend_luminosity_rgb_8(int n_chan, byte *dst, const byte *backdrop,
g = gb + delta_y;
b = bb + delta_y;
if ((r | g | b) & 0x100) {
- int y;
- int scale;
-
- y = (rs * 77 + gs * 151 + bs * 28 + 0x80) >> 8;
- if (delta_y > 0) {
- int max;
-
- max = r > g ? r : g;
- max = b > max ? b : max;
- scale = ((255 - y) << 16) / (max - y);
- } else {
- int min;
-
- min = r < g ? r : g;
- min = b < min ? b : min;
- scale = (y << 16) / (y - min);
- }
- r = y + (((r - y) * scale + 0x8000) >> 16);
- g = y + (((g - y) * scale + 0x8000) >> 16);
- b = y + (((b - y) * scale + 0x8000) >> 16);
+ int y;
+ int scale;
+
+ y = (rs * 77 + gs * 151 + bs * 28 + 0x80) >> 8;
+ if (delta_y > 0) {
+ int max;
+
+ max = r > g ? r : g;
+ max = b > max ? b : max;
+ scale = ((255 - y) << 16) / (max - y);
+ } else {
+ int min;
+
+ min = r < g ? r : g;
+ min = b < min ? b : min;
+ scale = (y << 16) / (y - min);
+ }
+ r = y + (((r - y) * scale + 0x8000) >> 16);
+ g = y + (((g - y) * scale + 0x8000) >> 16);
+ b = y + (((b - y) * scale + 0x8000) >> 16);
}
dst[0] = r;
dst[1] = g;
@@ -270,7 +269,7 @@ art_blend_luminosity_rgb_8(int n_chan, byte *dst, const byte *backdrop,
void
art_blend_luminosity_custom_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int delta_y = 0, test = 0;
int r[ART_MAX_CHAN];
@@ -282,40 +281,40 @@ art_blend_luminosity_custom_8(int n_chan, byte *dst, const byte *backdrop,
* delta luminosity values.
*/
for (i = 0; i < n_chan; i++)
- delta_y += src[i] - backdrop[i];
+ delta_y += src[i] - backdrop[i];
delta_y = (delta_y + n_chan / 2) / n_chan;
for (i = 0; i < n_chan; i++) {
- r[i] = backdrop[i] + delta_y;
- test |= r[i];
+ r[i] = backdrop[i] + delta_y;
+ test |= r[i];
}
-
+
if (test & 0x100) {
- int y;
- int scale;
-
- /* Assume that the luminosity is simply the average of the backdrop. */
- y = src[0];
- for (i = 1; i < n_chan; i++)
- y += src[i];
- y = (y + n_chan / 2) / n_chan;
-
- if (delta_y > 0) {
- int max;
-
- max = r[0];
- for (i = 1; i < n_chan; i++)
- max = max(max, r[i]);
- scale = ((255 - y) << 16) / (max - y);
- } else {
- int min;
-
- min = r[0];
- for (i = 1; i < n_chan; i++)
- min = min(min, r[i]);
- scale = (y << 16) / (y - min);
- }
- for (i = 0; i < n_chan; i++)
- r[i] = y + (((r[i] - y) * scale + 0x8000) >> 16);
+ int y;
+ int scale;
+
+ /* Assume that the luminosity is simply the average of the backdrop. */
+ y = src[0];
+ for (i = 1; i < n_chan; i++)
+ y += src[i];
+ y = (y + n_chan / 2) / n_chan;
+
+ if (delta_y > 0) {
+ int max;
+
+ max = r[0];
+ for (i = 1; i < n_chan; i++)
+ max = max(max, r[i]);
+ scale = ((255 - y) << 16) / (max - y);
+ } else {
+ int min;
+
+ min = r[0];
+ for (i = 1; i < n_chan; i++)
+ min = min(min, r[i]);
+ scale = (y << 16) / (y - min);
+ }
+ for (i = 0; i < n_chan; i++)
+ r[i] = y + (((r[i] - y) * scale + 0x8000) >> 16);
}
for (i = 0; i < n_chan; i++)
dst[i] = r[i];
@@ -342,7 +341,7 @@ art_blend_luminosity_custom_8(int n_chan, byte *dst, const byte *backdrop,
*/
void
art_blend_luminosity_cmyk_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int i;
@@ -354,7 +353,7 @@ art_blend_luminosity_cmyk_8(int n_chan, byte *dst, const byte *backdrop,
void
art_blend_saturation_rgb_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int rb = backdrop[0], gb = backdrop[1], bb = backdrop[2];
int rs = src[0], gs = src[1], bs = src[2];
@@ -369,11 +368,11 @@ art_blend_saturation_rgb_8(int n_chan, byte *dst, const byte *backdrop,
maxb = rb > gb ? rb : gb;
maxb = maxb > bb ? maxb : bb;
if (minb == maxb) {
- /* backdrop has zero saturation, avoid divide by 0 */
- dst[0] = gb;
- dst[1] = gb;
- dst[2] = gb;
- return;
+ /* backdrop has zero saturation, avoid divide by 0 */
+ dst[0] = gb;
+ dst[1] = gb;
+ dst[2] = gb;
+ return;
}
mins = rs < gs ? rs : gs;
@@ -388,28 +387,28 @@ art_blend_saturation_rgb_8(int n_chan, byte *dst, const byte *backdrop,
b = y + ((((bb - y) * scale) + 0x8000) >> 16);
if ((r | g | b) & 0x100) {
- int scalemin, scalemax;
- int min, max;
-
- min = r < g ? r : g;
- min = min < b ? min : b;
- max = r > g ? r : g;
- max = max > b ? max : b;
-
- if (min < 0)
- scalemin = (y << 16) / (y - min);
- else
- scalemin = 0x10000;
-
- if (max > 255)
- scalemax = ((255 - y) << 16) / (max - y);
- else
- scalemax = 0x10000;
-
- scale = scalemin < scalemax ? scalemin : scalemax;
- r = y + (((r - y) * scale + 0x8000) >> 16);
- g = y + (((g - y) * scale + 0x8000) >> 16);
- b = y + (((b - y) * scale + 0x8000) >> 16);
+ int scalemin, scalemax;
+ int min, max;
+
+ min = r < g ? r : g;
+ min = min < b ? min : b;
+ max = r > g ? r : g;
+ max = max > b ? max : b;
+
+ if (min < 0)
+ scalemin = (y << 16) / (y - min);
+ else
+ scalemin = 0x10000;
+
+ if (max > 255)
+ scalemax = ((255 - y) << 16) / (max - y);
+ else
+ scalemax = 0x10000;
+
+ scale = scalemin < scalemax ? scalemin : scalemax;
+ r = y + (((r - y) * scale + 0x8000) >> 16);
+ g = y + (((g - y) * scale + 0x8000) >> 16);
+ b = y + (((b - y) * scale + 0x8000) >> 16);
}
dst[0] = r;
@@ -419,7 +418,7 @@ art_blend_saturation_rgb_8(int n_chan, byte *dst, const byte *backdrop,
void
art_blend_saturation_custom_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int minb, maxb;
int mins, maxs;
@@ -432,24 +431,24 @@ art_blend_saturation_custom_8(int n_chan, byte *dst, const byte *backdrop,
/* Determine min and max of the backdrop */
minb = maxb = temp = backdrop[0];
for (i = 1; i < n_chan; i++) {
- temp = backdrop[i];
- minb = min(minb, temp);
- maxb = max(maxb, temp);
+ temp = backdrop[i];
+ minb = min(minb, temp);
+ maxb = max(maxb, temp);
}
if (minb == maxb) {
- /* backdrop has zero saturation, avoid divide by 0 */
+ /* backdrop has zero saturation, avoid divide by 0 */
for (i = 0; i < n_chan; i++)
- dst[i] = temp;
- return;
+ dst[i] = temp;
+ return;
}
/* Determine min and max of the source */
mins = maxs = src[0];
for (i = 1; i < n_chan; i++) {
- temp = src[i];
- mins = min(minb, temp);
- maxs = max(minb, temp);
+ temp = src[i];
+ mins = min(minb, temp);
+ maxs = max(minb, temp);
}
scale = ((maxs - mins) << 16) / (maxb - minb);
@@ -457,50 +456,50 @@ art_blend_saturation_custom_8(int n_chan, byte *dst, const byte *backdrop,
/* Assume that the saturation is simply the average of the backdrop. */
y = backdrop[0];
for (i = 1; i < n_chan; i++)
- y += backdrop[i];
+ y += backdrop[i];
y = (y + n_chan / 2) / n_chan;
-
+
/* Calculate the saturated values */
for (i = 0; i < n_chan; i++) {
r[i] = y + ((((backdrop[i] - y) * scale) + 0x8000) >> 16);
- test |= r[i];
+ test |= r[i];
}
if (test & 0x100) {
- int scalemin, scalemax;
- int min, max;
+ int scalemin, scalemax;
+ int min, max;
/* Determine min and max of our blended values */
min = max = temp = r[0];
for (i = 1; i < n_chan; i++) {
- temp = src[i];
- min = min(min, temp);
- max = max(max, temp);
+ temp = src[i];
+ min = min(min, temp);
+ max = max(max, temp);
}
- if (min < 0)
- scalemin = (y << 16) / (y - min);
- else
- scalemin = 0x10000;
+ if (min < 0)
+ scalemin = (y << 16) / (y - min);
+ else
+ scalemin = 0x10000;
- if (max > 255)
- scalemax = ((255 - y) << 16) / (max - y);
- else
- scalemax = 0x10000;
+ if (max > 255)
+ scalemax = ((255 - y) << 16) / (max - y);
+ else
+ scalemax = 0x10000;
- scale = scalemin < scalemax ? scalemin : scalemax;
+ scale = scalemin < scalemax ? scalemin : scalemax;
for (i = 0; i < n_chan; i++)
- r[i] = y + (((r[i] - y) * scale + 0x8000) >> 16);
+ r[i] = y + (((r[i] - y) * scale + 0x8000) >> 16);
}
for (i = 0; i < n_chan; i++)
- dst[i] = r[i];
+ dst[i] = r[i];
}
/* Our component values have already been complemented, i.e. (1 - X). */
void
art_blend_saturation_cmyk_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src)
+ const byte *src)
{
int i;
@@ -574,286 +573,286 @@ const byte art_blend_soft_light_8[256] = {
void
art_blend_pixel_8(byte *dst, const byte *backdrop,
- const byte *src, int n_chan, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+ const byte *src, int n_chan, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
int i;
byte b, s;
bits32 t;
switch (blend_mode) {
- case BLEND_MODE_Normal:
- case BLEND_MODE_Compatible: /* todo */
- memcpy(dst, src, n_chan);
- break;
- case BLEND_MODE_Multiply:
- for (i = 0; i < n_chan; i++) {
- t = ((bits32) backdrop[i]) * ((bits32) src[i]);
- t += 0x80;
- t += (t >> 8);
- dst[i] = t >> 8;
- }
- break;
- case BLEND_MODE_Screen:
- for (i = 0; i < n_chan; i++) {
- t =
- ((bits32) (0xff - backdrop[i])) *
- ((bits32) (0xff - src[i]));
- t += 0x80;
- t += (t >> 8);
- dst[i] = 0xff - (t >> 8);
- }
- break;
- case BLEND_MODE_Overlay:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (b < 0x80)
- t = 2 * ((bits32) b) * ((bits32) s);
- else
- t = 0xfe01 -
- 2 * ((bits32) (0xff - b)) * ((bits32) (0xff - s));
- t += 0x80;
- t += (t >> 8);
- dst[i] = t >> 8;
- }
- break;
- case BLEND_MODE_SoftLight:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (s < 0x80) {
- t = (0xff - (s << 1)) * art_blend_sq_diff_8[b];
- t += 0x8000;
- dst[i] = b - (t >> 16);
- } else {
- t =
- ((s << 1) -
- 0xff) * ((bits32) (art_blend_soft_light_8[b]));
- t += 0x80;
- t += (t >> 8);
- dst[i] = b + (t >> 8);
- }
- }
- break;
- case BLEND_MODE_HardLight:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (s < 0x80)
- t = 2 * ((bits32) b) * ((bits32) s);
- else
- t = 0xfe01 -
- 2 * ((bits32) (0xff - b)) * ((bits32) (0xff - s));
- t += 0x80;
- t += (t >> 8);
- dst[i] = t >> 8;
- }
- break;
- case BLEND_MODE_ColorDodge:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = 0xff - src[i];
- if (b == 0)
- dst[i] = 0;
- else if (b >= s)
- dst[i] = 0xff;
- else
- dst[i] = (0x1fe * b + s) / (s << 1);
- }
- break;
- case BLEND_MODE_ColorBurn:
- for (i = 0; i < n_chan; i++) {
- b = 0xff - backdrop[i];
- s = src[i];
- if (b == 0)
- dst[i] = 0xff;
- else if (b >= s)
- dst[i] = 0;
- else
- dst[i] = 0xff - (0x1fe * b + s) / (s << 1);
- }
- break;
- case BLEND_MODE_Darken:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- dst[i] = b < s ? b : s;
- }
- break;
- case BLEND_MODE_Lighten:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- dst[i] = b > s ? b : s;
- }
- break;
- case BLEND_MODE_Difference:
- for (i = 0; i < n_chan; i++) {
- art_s32 tmp;
-
- tmp = ((art_s32) backdrop[i]) - ((art_s32) src[i]);
- dst[i] = tmp < 0 ? -tmp : tmp;
- }
- break;
- case BLEND_MODE_Exclusion:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- t = ((bits32) (0xff - b)) * ((bits32) s) +
- ((bits32) b) * ((bits32) (0xff - s));
- t += 0x80;
- t += (t >> 8);
- dst[i] = t >> 8;
- }
- break;
- case BLEND_MODE_Luminosity:
- pblend_procs->blend_luminosity(n_chan, dst, backdrop, src);
- break;
- case BLEND_MODE_Color:
- pblend_procs->blend_luminosity(n_chan, dst, src, backdrop);
- break;
- case BLEND_MODE_Saturation:
- pblend_procs->blend_saturation(n_chan, dst, backdrop, src);
- break;
- case BLEND_MODE_Hue:
- {
- byte tmp[4];
-
- pblend_procs->blend_luminosity(n_chan, tmp, src, backdrop);
- pblend_procs->blend_saturation(n_chan, dst, tmp, backdrop);
- }
- break;
- default:
- dlprintf1("art_blend_pixel_8: blend mode %d not implemented\n",
- blend_mode);
- memcpy(dst, src, n_chan);
- break;
+ case BLEND_MODE_Normal:
+ case BLEND_MODE_Compatible: /* todo */
+ memcpy(dst, src, n_chan);
+ break;
+ case BLEND_MODE_Multiply:
+ for (i = 0; i < n_chan; i++) {
+ t = ((bits32) backdrop[i]) * ((bits32) src[i]);
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = t >> 8;
+ }
+ break;
+ case BLEND_MODE_Screen:
+ for (i = 0; i < n_chan; i++) {
+ t =
+ ((bits32) (0xff - backdrop[i])) *
+ ((bits32) (0xff - src[i]));
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = 0xff - (t >> 8);
+ }
+ break;
+ case BLEND_MODE_Overlay:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (b < 0x80)
+ t = 2 * ((bits32) b) * ((bits32) s);
+ else
+ t = 0xfe01 -
+ 2 * ((bits32) (0xff - b)) * ((bits32) (0xff - s));
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = t >> 8;
+ }
+ break;
+ case BLEND_MODE_SoftLight:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (s < 0x80) {
+ t = (0xff - (s << 1)) * art_blend_sq_diff_8[b];
+ t += 0x8000;
+ dst[i] = b - (t >> 16);
+ } else {
+ t =
+ ((s << 1) -
+ 0xff) * ((bits32) (art_blend_soft_light_8[b]));
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = b + (t >> 8);
+ }
+ }
+ break;
+ case BLEND_MODE_HardLight:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (s < 0x80)
+ t = 2 * ((bits32) b) * ((bits32) s);
+ else
+ t = 0xfe01 -
+ 2 * ((bits32) (0xff - b)) * ((bits32) (0xff - s));
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = t >> 8;
+ }
+ break;
+ case BLEND_MODE_ColorDodge:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = 0xff - src[i];
+ if (b == 0)
+ dst[i] = 0;
+ else if (b >= s)
+ dst[i] = 0xff;
+ else
+ dst[i] = (0x1fe * b + s) / (s << 1);
+ }
+ break;
+ case BLEND_MODE_ColorBurn:
+ for (i = 0; i < n_chan; i++) {
+ b = 0xff - backdrop[i];
+ s = src[i];
+ if (b == 0)
+ dst[i] = 0xff;
+ else if (b >= s)
+ dst[i] = 0;
+ else
+ dst[i] = 0xff - (0x1fe * b + s) / (s << 1);
+ }
+ break;
+ case BLEND_MODE_Darken:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ dst[i] = b < s ? b : s;
+ }
+ break;
+ case BLEND_MODE_Lighten:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ dst[i] = b > s ? b : s;
+ }
+ break;
+ case BLEND_MODE_Difference:
+ for (i = 0; i < n_chan; i++) {
+ art_s32 tmp;
+
+ tmp = ((art_s32) backdrop[i]) - ((art_s32) src[i]);
+ dst[i] = tmp < 0 ? -tmp : tmp;
+ }
+ break;
+ case BLEND_MODE_Exclusion:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ t = ((bits32) (0xff - b)) * ((bits32) s) +
+ ((bits32) b) * ((bits32) (0xff - s));
+ t += 0x80;
+ t += (t >> 8);
+ dst[i] = t >> 8;
+ }
+ break;
+ case BLEND_MODE_Luminosity:
+ pblend_procs->blend_luminosity(n_chan, dst, backdrop, src);
+ break;
+ case BLEND_MODE_Color:
+ pblend_procs->blend_luminosity(n_chan, dst, src, backdrop);
+ break;
+ case BLEND_MODE_Saturation:
+ pblend_procs->blend_saturation(n_chan, dst, backdrop, src);
+ break;
+ case BLEND_MODE_Hue:
+ {
+ byte tmp[4];
+
+ pblend_procs->blend_luminosity(n_chan, tmp, src, backdrop);
+ pblend_procs->blend_saturation(n_chan, dst, tmp, backdrop);
+ }
+ break;
+ default:
+ dlprintf1("art_blend_pixel_8: blend mode %d not implemented\n",
+ blend_mode);
+ memcpy(dst, src, n_chan);
+ break;
}
}
void
art_blend_pixel(ArtPixMaxDepth* dst, const ArtPixMaxDepth *backdrop,
- const ArtPixMaxDepth* src, int n_chan,
- gs_blend_mode_t blend_mode)
+ const ArtPixMaxDepth* src, int n_chan,
+ gs_blend_mode_t blend_mode)
{
int i;
ArtPixMaxDepth b, s;
bits32 t;
switch (blend_mode) {
- case BLEND_MODE_Normal:
- case BLEND_MODE_Compatible: /* todo */
- memcpy(dst, src, n_chan * sizeof(ArtPixMaxDepth));
- break;
- case BLEND_MODE_Multiply:
- for (i = 0; i < n_chan; i++) {
- t = ((bits32) backdrop[i]) * ((bits32) src[i]);
- t += 0x8000;
- t += (t >> 16);
- dst[i] = t >> 16;
- }
- break;
- case BLEND_MODE_Screen:
- for (i = 0; i < n_chan; i++) {
- t =
- ((bits32) (0xffff - backdrop[i])) *
- ((bits32) (0xffff - src[i]));
- t += 0x8000;
- t += (t >> 16);
- dst[i] = 0xffff - (t >> 16);
- }
- break;
- case BLEND_MODE_Overlay:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (b < 0x8000)
- t = 2 * ((bits32) b) * ((bits32) s);
- else
- t = 0xfffe0001u -
- 2 * ((bits32) (0xffff - b)) * ((bits32) (0xffff - s));
- t += 0x8000;
- t += (t >> 16);
- dst[i] = t >> 16;
- }
- break;
- case BLEND_MODE_HardLight:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (s < 0x8000)
- t = 2 * ((bits32) b) * ((bits32) s);
- else
- t = 0xfffe0001u -
- 2 * ((bits32) (0xffff - b)) * ((bits32) (0xffff - s));
- t += 0x8000;
- t += (t >> 16);
- dst[i] = t >> 16;
- }
- break;
- case BLEND_MODE_ColorDodge:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- if (b == 0)
- dst[i] = 0;
- else if (s >= b)
- dst[i] = 0xffff;
- else
- dst[i] = (0x1fffe * s + b) / (b << 1);
- }
- break;
- case BLEND_MODE_ColorBurn:
- for (i = 0; i < n_chan; i++) {
- b = 0xffff - backdrop[i];
- s = src[i];
- if (b == 0)
- dst[i] = 0xffff;
- else if (b >= s)
- dst[i] = 0;
- else
- dst[i] = 0xffff - (0x1fffe * b + s) / (s << 1);
- }
+ case BLEND_MODE_Normal:
+ case BLEND_MODE_Compatible: /* todo */
+ memcpy(dst, src, n_chan * sizeof(ArtPixMaxDepth));
+ break;
+ case BLEND_MODE_Multiply:
+ for (i = 0; i < n_chan; i++) {
+ t = ((bits32) backdrop[i]) * ((bits32) src[i]);
+ t += 0x8000;
+ t += (t >> 16);
+ dst[i] = t >> 16;
+ }
+ break;
+ case BLEND_MODE_Screen:
+ for (i = 0; i < n_chan; i++) {
+ t =
+ ((bits32) (0xffff - backdrop[i])) *
+ ((bits32) (0xffff - src[i]));
+ t += 0x8000;
+ t += (t >> 16);
+ dst[i] = 0xffff - (t >> 16);
+ }
+ break;
+ case BLEND_MODE_Overlay:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (b < 0x8000)
+ t = 2 * ((bits32) b) * ((bits32) s);
+ else
+ t = 0xfffe0001u -
+ 2 * ((bits32) (0xffff - b)) * ((bits32) (0xffff - s));
+ t += 0x8000;
+ t += (t >> 16);
+ dst[i] = t >> 16;
+ }
+ break;
+ case BLEND_MODE_HardLight:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (s < 0x8000)
+ t = 2 * ((bits32) b) * ((bits32) s);
+ else
+ t = 0xfffe0001u -
+ 2 * ((bits32) (0xffff - b)) * ((bits32) (0xffff - s));
+ t += 0x8000;
+ t += (t >> 16);
+ dst[i] = t >> 16;
+ }
+ break;
+ case BLEND_MODE_ColorDodge:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ if (b == 0)
+ dst[i] = 0;
+ else if (s >= b)
+ dst[i] = 0xffff;
+ else
+ dst[i] = (0x1fffe * s + b) / (b << 1);
+ }
+ break;
+ case BLEND_MODE_ColorBurn:
+ for (i = 0; i < n_chan; i++) {
+ b = 0xffff - backdrop[i];
+ s = src[i];
+ if (b == 0)
+ dst[i] = 0xffff;
+ else if (b >= s)
+ dst[i] = 0;
+ else
+ dst[i] = 0xffff - (0x1fffe * b + s) / (s << 1);
+ }
+ break;
+ case BLEND_MODE_Darken:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ dst[i] = b < s ? b : s;
+ }
+ break;
+ case BLEND_MODE_Lighten:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ dst[i] = b > s ? b : s;
+ }
+ break;
+ case BLEND_MODE_Difference:
+ for (i = 0; i < n_chan; i++) {
+ art_s32 tmp;
+
+ tmp = ((art_s32) backdrop[i]) - ((art_s32) src[i]);
+ dst[i] = tmp < 0 ? -tmp : tmp;
+ }
+ break;
+ case BLEND_MODE_Exclusion:
+ for (i = 0; i < n_chan; i++) {
+ b = backdrop[i];
+ s = src[i];
+ t = ((bits32) (0xffff - b)) * ((bits32) s) +
+ ((bits32) b) * ((bits32) (0xffff - s));
+ t += 0x8000;
+ t += (t >> 16);
+ dst[i] = t >> 16;
+ }
+ break;
+ default:
+ dlprintf1("art_blend_pixel: blend mode %d not implemented\n",
+ blend_mode);
+ memcpy(dst, src, n_chan);
break;
- case BLEND_MODE_Darken:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- dst[i] = b < s ? b : s;
- }
- break;
- case BLEND_MODE_Lighten:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- dst[i] = b > s ? b : s;
- }
- break;
- case BLEND_MODE_Difference:
- for (i = 0; i < n_chan; i++) {
- art_s32 tmp;
-
- tmp = ((art_s32) backdrop[i]) - ((art_s32) src[i]);
- dst[i] = tmp < 0 ? -tmp : tmp;
- }
- break;
- case BLEND_MODE_Exclusion:
- for (i = 0; i < n_chan; i++) {
- b = backdrop[i];
- s = src[i];
- t = ((bits32) (0xffff - b)) * ((bits32) s) +
- ((bits32) b) * ((bits32) (0xffff - s));
- t += 0x8000;
- t += (t >> 16);
- dst[i] = t >> 16;
- }
- break;
- default:
- dlprintf1("art_blend_pixel: blend mode %d not implemented\n",
- blend_mode);
- memcpy(dst, src, n_chan);
- break;
}
}
@@ -872,20 +871,20 @@ art_pdf_union_mul_8(byte alpha1, byte alpha2, byte alpha_mask)
int tmp;
if (alpha_mask == 0xff) {
- tmp = (0xff - alpha1) * (0xff - alpha2) + 0x80;
- return 0xff - ((tmp + (tmp >> 8)) >> 8);
+ tmp = (0xff - alpha1) * (0xff - alpha2) + 0x80;
+ return 0xff - ((tmp + (tmp >> 8)) >> 8);
} else {
- tmp = alpha2 * alpha_mask + 0x80;
- tmp = (tmp + (tmp >> 8)) >> 8;
- tmp = (0xff - alpha1) * (0xff - tmp) + 0x80;
- return 0xff - ((tmp + (tmp >> 8)) >> 8);
+ tmp = alpha2 * alpha_mask + 0x80;
+ tmp = (tmp + (tmp >> 8)) >> 8;
+ tmp = (0xff - alpha1) * (0xff - tmp) + 0x80;
+ return 0xff - ((tmp + (tmp >> 8)) >> 8);
}
}
void
art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
- gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+ gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
byte a_b, a_s;
unsigned int a_r;
@@ -896,23 +895,23 @@ art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
a_s = src[n_chan];
if (a_s == 0) {
- /* source alpha is zero, avoid all computations and possible
- divide by zero errors. */
- return;
+ /* source alpha is zero, avoid all computations and possible
+ divide by zero errors. */
+ return;
}
a_b = dst[n_chan];
if (a_b == 0) {
- /* backdrop alpha is zero, just copy source pixels and avoid
- computation. */
+ /* backdrop alpha is zero, just copy source pixels and avoid
+ computation. */
- /* this idiom is faster than memcpy (dst, src, n_chan + 1); for
- expected small values of n_chan. */
- for (i = 0; i <= n_chan >> 2; i++) {
- ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
- }
+ /* this idiom is faster than memcpy (dst, src, n_chan + 1); for
+ expected small values of n_chan. */
+ for (i = 0; i <= n_chan >> 2; i++) {
+ ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
+ }
- return;
+ return;
}
/* Result alpha is Union of backdrop and source alpha */
@@ -924,30 +923,30 @@ art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
src_scale = ((a_s << 16) + (a_r >> 1)) / a_r;
if (blend_mode == BLEND_MODE_Normal) {
- /* Do simple compositing of source over backdrop */
- for (i = 0; i < n_chan; i++) {
- c_s = src[i];
- c_b = dst[i];
- tmp = (c_b << 16) + src_scale * (c_s - c_b) + 0x8000;
- dst[i] = tmp >> 16;
- }
+ /* Do simple compositing of source over backdrop */
+ for (i = 0; i < n_chan; i++) {
+ c_s = src[i];
+ c_b = dst[i];
+ tmp = (c_b << 16) + src_scale * (c_s - c_b) + 0x8000;
+ dst[i] = tmp >> 16;
+ }
} else {
- /* Do compositing with blending */
- byte blend[ART_MAX_CHAN];
-
- art_blend_pixel_8(blend, dst, src, n_chan, blend_mode, pblend_procs);
- for (i = 0; i < n_chan; i++) {
- int c_bl; /* Result of blend function */
- int c_mix; /* Blend result mixed with source color */
-
- c_s = src[i];
- c_b = dst[i];
- c_bl = blend[i];
- tmp = a_b * (c_bl - ((int)c_s)) + 0x80;
- c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
- tmp = (c_b << 16) + src_scale * (c_mix - c_b) + 0x8000;
- dst[i] = tmp >> 16;
- }
+ /* Do compositing with blending */
+ byte blend[ART_MAX_CHAN];
+
+ art_blend_pixel_8(blend, dst, src, n_chan, blend_mode, pblend_procs);
+ for (i = 0; i < n_chan; i++) {
+ int c_bl; /* Result of blend function */
+ int c_mix; /* Blend result mixed with source color */
+
+ c_s = src[i];
+ c_b = dst[i];
+ c_bl = blend[i];
+ tmp = a_b * (c_bl - ((int)c_s)) + 0x80;
+ c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
+ tmp = (c_b << 16) + src_scale * (c_mix - c_b) + 0x8000;
+ dst[i] = tmp >> 16;
+ }
}
dst[n_chan] = a_r;
}
@@ -981,8 +980,8 @@ art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
**/
void
art_pdf_composite_pixel_knockout_8(byte *dst,
- const byte *backdrop, const byte *src,
- int n_chan, gs_blend_mode_t blend_mode)
+ const byte *backdrop, const byte *src,
+ int n_chan, gs_blend_mode_t blend_mode)
{
int i;
byte ct[ART_MAX_CHAN + 1];
@@ -994,57 +993,56 @@ art_pdf_composite_pixel_knockout_8(byte *dst,
int tmp;
if (src[n_chan] == 0)
- return;
+ return;
if (src[n_chan + 1] == 255 && blend_mode == BLEND_MODE_Normal ||
- dst[n_chan] == 0) {
- /* this idiom is faster than memcpy (dst, src, n_chan + 2); for
- expected small values of n_chan. */
- for (i = 0; i <= (n_chan + 1) >> 2; i++) {
- ((bits32 *) dst)[i] = ((const bits32 *)src[i]);
- }
-
- return;
- }
+ dst[n_chan] == 0) {
+ /* this idiom is faster than memcpy (dst, src, n_chan + 2); for
+ expected small values of n_chan. */
+ for (i = 0; i <= (n_chan + 1) >> 2; i++) {
+ ((bits32 *) dst)[i] = ((const bits32 *)src[i]);
+ }
+ return;
+ }
src_shape = src[n_chan + 1]; /* $fs_i$ */
src_opacity = (255 * src[n_chan] + 0x80) / src_shape; /* $qs_i$ */
#if 0
for (i = 0; i < (n_chan + 3) >> 2; i++) {
- ((bits32 *) src_tmp)[i] = ((const bits32 *)src[i]);
+ ((bits32 *) src_tmp)[i] = ((const bits32 *)src[i]);
}
src_tmp[n_chan] = src_opacity;
for (i = 0; i <= n_chan >> 2; i++) {
- ((bits32 *) tmp)[i] = ((bits32 *) backdrop[i]);
+ ((bits32 *) tmp)[i] = ((bits32 *) backdrop[i]);
}
#endif
backdrop_scale = if (blend_mode == BLEND_MODE_Normal) {
- /* Do simple compositing of source over backdrop */
- for (i = 0; i < n_chan; i++) {
- c_s = src[i];
- c_b = dst[i];
- tmp = (c_b << 16) + ct_scale * (c_s - c_b) + 0x8000;
- ct[i] = tmp >> 16;
- }
+ /* Do simple compositing of source over backdrop */
+ for (i = 0; i < n_chan; i++) {
+ c_s = src[i];
+ c_b = dst[i];
+ tmp = (c_b << 16) + ct_scale * (c_s - c_b) + 0x8000;
+ ct[i] = tmp >> 16;
+ }
} else {
- /* Do compositing with blending */
- byte blend[ART_MAX_CHAN];
-
- art_blend_pixel_8(blend, backdrop, src, n_chan, blend_mode, pblend_procs);
- for (i = 0; i < n_chan; i++) {
- int c_bl; /* Result of blend function */
- int c_mix; /* Blend result mixed with source color */
-
- c_s = src[i];
- c_b = dst[i];
- c_bl = blend[i];
- tmp = a_b * (((int)c_bl) - ((int)c_s)) + 0x80;
- c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
- tmp = (c_b << 16) + ct_scale * (c_mix - c_b) + 0x8000;
- ct[i] = tmp >> 16;
- }
+ /* Do compositing with blending */
+ byte blend[ART_MAX_CHAN];
+
+ art_blend_pixel_8(blend, backdrop, src, n_chan, blend_mode, pblend_procs);
+ for (i = 0; i < n_chan; i++) {
+ int c_bl; /* Result of blend function */
+ int c_mix; /* Blend result mixed with source color */
+
+ c_s = src[i];
+ c_b = dst[i];
+ c_bl = blend[i];
+ tmp = a_b * (((int)c_bl) - ((int)c_s)) + 0x80;
+ c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
+ tmp = (c_b << 16) + ct_scale * (c_mix - c_b) + 0x8000;
+ ct[i] = tmp >> 16;
+ }
}
/* do weighted average of $Ct$ using relative alpha contribution as weight */
@@ -1061,8 +1059,8 @@ art_pdf_composite_pixel_knockout_8(byte *dst,
void
art_pdf_uncomposite_group_8(byte *dst,
- const byte *backdrop,
- const byte *src, byte src_alpha_g, int n_chan)
+ const byte *backdrop,
+ const byte *src, byte src_alpha_g, int n_chan)
{
byte backdrop_alpha = backdrop[n_chan];
int i;
@@ -1072,33 +1070,33 @@ art_pdf_uncomposite_group_8(byte *dst,
dst[n_chan] = src_alpha_g;
if (src_alpha_g == 0)
- return;
+ return;
scale = (backdrop_alpha * 255 * 2 + src_alpha_g) / (src_alpha_g << 1) -
- backdrop_alpha;
+ backdrop_alpha;
for (i = 0; i < n_chan; i++) {
- int si, di;
-
- si = src[i];
- di = backdrop[i];
- tmp = (si - di) * scale + 0x80;
- tmp = si + ((tmp + (tmp >> 8)) >> 8);
-
- /* todo: it should be possible to optimize these cond branches */
- if (tmp < 0)
- tmp = 0;
- if (tmp > 255)
- tmp = 255;
- dst[i] = tmp;
+ int si, di;
+
+ si = src[i];
+ di = backdrop[i];
+ tmp = (si - di) * scale + 0x80;
+ tmp = si + ((tmp + (tmp >> 8)) >> 8);
+
+ /* todo: it should be possible to optimize these cond branches */
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp > 255)
+ tmp = 255;
+ dst[i] = tmp;
}
}
void
art_pdf_recomposite_group_8(byte *dst, byte *dst_alpha_g,
- const byte *src, byte src_alpha_g, int n_chan,
- byte alpha, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+ const byte *src, byte src_alpha_g, int n_chan,
+ byte alpha, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
byte dst_alpha;
int i;
@@ -1106,72 +1104,72 @@ art_pdf_recomposite_group_8(byte *dst, byte *dst_alpha_g,
int scale;
if (src_alpha_g == 0)
- return;
+ return;
if (blend_mode == BLEND_MODE_Normal && alpha == 255) {
- /* In this case, uncompositing and recompositing cancel each
- other out. Note: if the reason that alpha == 255 is that
- there is no constant mask and no soft mask, then this
- operation should be optimized away at a higher level. */
- for (i = 0; i <= n_chan >> 2; i++)
- ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
- if (dst_alpha_g != NULL) {
- tmp = (255 - *dst_alpha_g) * (255 - src_alpha_g) + 0x80;
- *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
- return;
+ /* In this case, uncompositing and recompositing cancel each
+ other out. Note: if the reason that alpha == 255 is that
+ there is no constant mask and no soft mask, then this
+ operation should be optimized away at a higher level. */
+ for (i = 0; i <= n_chan >> 2; i++)
+ ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
+ if (dst_alpha_g != NULL) {
+ tmp = (255 - *dst_alpha_g) * (255 - src_alpha_g) + 0x80;
+ *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
+ return;
} else {
- /* "interesting" blend mode */
- byte ca[ART_MAX_CHAN + 1]; /* $C, \alpha$ */
-
- dst_alpha = dst[n_chan];
- if (src_alpha_g == 255 || dst_alpha == 0) {
- for (i = 0; i < (n_chan + 3) >> 2; i++)
- ((bits32 *) ca)[i] = ((const bits32 *)src)[i];
- } else {
- /* Uncomposite the color. In other words, solve
- "src = (ca, src_alpha_g) over dst" for ca */
-
- /* todo (maybe?): replace this code with call to
- art_pdf_uncomposite_group_8() to reduce code
- duplication. */
-
- scale = (dst_alpha * 255 * 2 + src_alpha_g) / (src_alpha_g << 1) -
- dst_alpha;
- for (i = 0; i < n_chan; i++) {
- int si, di;
-
- si = src[i];
- di = dst[i];
- tmp = (si - di) * scale + 0x80;
- tmp = si + ((tmp + (tmp >> 8)) >> 8);
-
- /* todo: it should be possible to optimize these cond branches */
- if (tmp < 0)
- tmp = 0;
- if (tmp > 255)
- tmp = 255;
- ca[i] = tmp;
- }
- }
-
- tmp = src_alpha_g * alpha + 0x80;
- tmp = (tmp + (tmp >> 8)) >> 8;
- ca[n_chan] = tmp;
- if (dst_alpha_g != NULL) {
- tmp = (255 - *dst_alpha_g) * (255 - tmp) + 0x80;
- *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
- art_pdf_composite_pixel_alpha_8(dst, ca, n_chan,
- blend_mode, pblend_procs);
+ /* "interesting" blend mode */
+ byte ca[ART_MAX_CHAN + 1]; /* $C, \alpha$ */
+
+ dst_alpha = dst[n_chan];
+ if (src_alpha_g == 255 || dst_alpha == 0) {
+ for (i = 0; i < (n_chan + 3) >> 2; i++)
+ ((bits32 *) ca)[i] = ((const bits32 *)src)[i];
+ } else {
+ /* Uncomposite the color. In other words, solve
+ "src = (ca, src_alpha_g) over dst" for ca */
+
+ /* todo (maybe?): replace this code with call to
+ art_pdf_uncomposite_group_8() to reduce code
+ duplication. */
+
+ scale = (dst_alpha * 255 * 2 + src_alpha_g) / (src_alpha_g << 1) -
+ dst_alpha;
+ for (i = 0; i < n_chan; i++) {
+ int si, di;
+
+ si = src[i];
+ di = dst[i];
+ tmp = (si - di) * scale + 0x80;
+ tmp = si + ((tmp + (tmp >> 8)) >> 8);
+
+ /* todo: it should be possible to optimize these cond branches */
+ if (tmp < 0)
+ tmp = 0;
+ if (tmp > 255)
+ tmp = 255;
+ ca[i] = tmp;
+ }
+ }
+
+ tmp = src_alpha_g * alpha + 0x80;
+ tmp = (tmp + (tmp >> 8)) >> 8;
+ ca[n_chan] = tmp;
+ if (dst_alpha_g != NULL) {
+ tmp = (255 - *dst_alpha_g) * (255 - tmp) + 0x80;
+ *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
+ art_pdf_composite_pixel_alpha_8(dst, ca, n_chan,
+ blend_mode, pblend_procs);
}
/* todo: optimize BLEND_MODE_Normal buf alpha != 255 case */
}
void
art_pdf_composite_group_8(byte *dst, byte *dst_alpha_g,
- const byte *src, int n_chan, byte alpha, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+ const byte *src, int n_chan, byte alpha, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
byte src_alpha; /* $\alpha g_n$ */
byte src_tmp[ART_MAX_CHAN + 1];
@@ -1179,26 +1177,26 @@ art_pdf_composite_group_8(byte *dst, byte *dst_alpha_g,
int tmp;
if (alpha == 255) {
- art_pdf_composite_pixel_alpha_8(dst, src, n_chan,
- blend_mode, pblend_procs);
- if (dst_alpha_g != NULL) {
- tmp = (255 - *dst_alpha_g) * (255 - src[n_chan]) + 0x80;
- *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
+ art_pdf_composite_pixel_alpha_8(dst, src, n_chan,
+ blend_mode, pblend_procs);
+ if (dst_alpha_g != NULL) {
+ tmp = (255 - *dst_alpha_g) * (255 - src[n_chan]) + 0x80;
+ *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
} else {
- src_alpha = src[n_chan];
- if (src_alpha == 0)
- return;
- for (i = 0; i < (n_chan + 3) >> 2; i++)
- ((bits32 *) src_tmp)[i] = ((const bits32 *)src)[i];
- tmp = src_alpha * alpha + 0x80;
- src_tmp[n_chan] = (tmp + (tmp >> 8)) >> 8;
- art_pdf_composite_pixel_alpha_8(dst, src_tmp, n_chan,
- blend_mode, pblend_procs);
- if (dst_alpha_g != NULL) {
- tmp = (255 - *dst_alpha_g) * (255 - src_tmp[n_chan]) + 0x80;
- *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
+ src_alpha = src[n_chan];
+ if (src_alpha == 0)
+ return;
+ for (i = 0; i < (n_chan + 3) >> 2; i++)
+ ((bits32 *) src_tmp)[i] = ((const bits32 *)src)[i];
+ tmp = src_alpha * alpha + 0x80;
+ src_tmp[n_chan] = (tmp + (tmp >> 8)) >> 8;
+ art_pdf_composite_pixel_alpha_8(dst, src_tmp, n_chan,
+ blend_mode, pblend_procs);
+ if (dst_alpha_g != NULL) {
+ tmp = (255 - *dst_alpha_g) * (255 - src_tmp[n_chan]) + 0x80;
+ *dst_alpha_g = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
}
}
@@ -1208,7 +1206,7 @@ void
art_pdf_knockoutisolated_group_8(byte *dst, const byte *src, int n_chan)
{
int i;
- byte src_alpha;
+ byte src_alpha;
src_alpha = src[n_chan];
if (src_alpha == 0)
@@ -1220,120 +1218,120 @@ art_pdf_knockoutisolated_group_8(byte *dst, const byte *src, int n_chan)
void
art_pdf_composite_knockout_simple_8(byte *dst,
- byte *dst_shape,
+ byte *dst_shape,
byte *dst_tag,
- const byte *src,
+ const byte *src,
byte tag,
- int n_chan, byte opacity)
+ int n_chan, byte opacity)
{
byte src_shape = src[n_chan];
int i;
if (src_shape == 0)
- return;
+ return;
else if (src_shape == 255) {
- for (i = 0; i < (n_chan + 3) >> 2; i++)
- ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
- dst[n_chan] = opacity;
- if (dst_shape != NULL)
- *dst_shape = 255;
+ for (i = 0; i < (n_chan + 3) >> 2; i++)
+ ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
+ dst[n_chan] = opacity;
+ if (dst_shape != NULL)
+ *dst_shape = 255;
} else {
- /* Use src_shape to interpolate (in premultiplied alpha space)
- between dst and (src, opacity). */
- int dst_alpha = dst[n_chan];
- byte result_alpha;
- int tmp;
-
- tmp = (opacity - dst_alpha) * src_shape + 0x80;
- result_alpha = dst_alpha + ((tmp + (tmp >> 8)) >> 8);
-
- if (result_alpha != 0)
- for (i = 0; i < n_chan; i++) {
- /* todo: optimize this - can strength-reduce so that
- inner loop is a single interpolation */
- tmp = dst[i] * dst_alpha * (255 - src_shape) +
- ((int)src[i]) * opacity * src_shape + (result_alpha << 7);
- dst[i] = tmp / (result_alpha * 255);
- }
- dst[n_chan] = result_alpha;
-
- /* union in dst_shape if non-null */
- if (dst_shape != NULL) {
- tmp = (255 - *dst_shape) * (255 - src_shape) + 0x80;
- *dst_shape = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
+ /* Use src_shape to interpolate (in premultiplied alpha space)
+ between dst and (src, opacity). */
+ int dst_alpha = dst[n_chan];
+ byte result_alpha;
+ int tmp;
+
+ tmp = (opacity - dst_alpha) * src_shape + 0x80;
+ result_alpha = dst_alpha + ((tmp + (tmp >> 8)) >> 8);
+
+ if (result_alpha != 0)
+ for (i = 0; i < n_chan; i++) {
+ /* todo: optimize this - can strength-reduce so that
+ inner loop is a single interpolation */
+ tmp = dst[i] * dst_alpha * (255 - src_shape) +
+ ((int)src[i]) * opacity * src_shape + (result_alpha << 7);
+ dst[i] = tmp / (result_alpha * 255);
+ }
+ dst[n_chan] = result_alpha;
+
+ /* union in dst_shape if non-null */
+ if (dst_shape != NULL) {
+ tmp = (255 - *dst_shape) * (255 - src_shape) + 0x80;
+ *dst_shape = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
}
}
void
art_pdf_composite_knockout_isolated_8(byte *dst,
- byte *dst_shape,
+ byte *dst_shape,
byte *dst_tag,
- const byte *src,
- int n_chan,
- byte shape,
+ const byte *src,
+ int n_chan,
+ byte shape,
byte tag,
- byte alpha_mask, byte shape_mask)
+ byte alpha_mask, byte shape_mask)
{
int tmp;
int i;
if (shape == 0)
- return;
+ return;
else if ((shape & shape_mask) == 255) {
- for (i = 0; i < (n_chan + 3) >> 2; i++)
- ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
- tmp = src[n_chan] * alpha_mask + 0x80;
- dst[n_chan] = (tmp + (tmp >> 8)) >> 8;
- if (dst_shape != NULL)
- *dst_shape = 255;
+ for (i = 0; i < (n_chan + 3) >> 2; i++)
+ ((bits32 *) dst)[i] = ((const bits32 *)src)[i];
+ tmp = src[n_chan] * alpha_mask + 0x80;
+ dst[n_chan] = (tmp + (tmp >> 8)) >> 8;
+ if (dst_shape != NULL)
+ *dst_shape = 255;
if (dst_tag != NULL)
*dst_tag = tag;
} else {
- /* Use src_shape to interpolate (in premultiplied alpha space)
- between dst and (src, opacity). */
- byte src_shape, src_alpha;
- int dst_alpha = dst[n_chan];
- byte result_alpha;
- int tmp;
-
- tmp = shape * shape_mask + 0x80;
- src_shape = (tmp + (tmp >> 8)) >> 8;
-
- tmp = src[n_chan] * alpha_mask + 0x80;
- src_alpha = (tmp + (tmp >> 8)) >> 8;
-
- tmp = (src_alpha - dst_alpha) * src_shape + 0x80;
- result_alpha = dst_alpha + ((tmp + (tmp >> 8)) >> 8);
-
- if (result_alpha != 0)
- for (i = 0; i < n_chan; i++) {
- /* todo: optimize this - can strength-reduce so that
- inner loop is a single interpolation */
- tmp = dst[i] * dst_alpha * (255 - src_shape) +
- ((int)src[i]) * src_alpha * src_shape +
- (result_alpha << 7);
- dst[i] = tmp / (result_alpha * 255);
- }
- dst[n_chan] = result_alpha;
-
- /* union in dst_shape if non-null */
- if (dst_shape != NULL) {
- tmp = (255 - *dst_shape) * (255 - src_shape) + 0x80;
- *dst_shape = 255 - ((tmp + (tmp >> 8)) >> 8);
- }
- if (dst_tag != NULL) {
+ /* Use src_shape to interpolate (in premultiplied alpha space)
+ between dst and (src, opacity). */
+ byte src_shape, src_alpha;
+ int dst_alpha = dst[n_chan];
+ byte result_alpha;
+ int tmp;
+
+ tmp = shape * shape_mask + 0x80;
+ src_shape = (tmp + (tmp >> 8)) >> 8;
+
+ tmp = src[n_chan] * alpha_mask + 0x80;
+ src_alpha = (tmp + (tmp >> 8)) >> 8;
+
+ tmp = (src_alpha - dst_alpha) * src_shape + 0x80;
+ result_alpha = dst_alpha + ((tmp + (tmp >> 8)) >> 8);
+
+ if (result_alpha != 0)
+ for (i = 0; i < n_chan; i++) {
+ /* todo: optimize this - can strength-reduce so that
+ inner loop is a single interpolation */
+ tmp = dst[i] * dst_alpha * (255 - src_shape) +
+ ((int)src[i]) * src_alpha * src_shape +
+ (result_alpha << 7);
+ dst[i] = tmp / (result_alpha * 255);
+ }
+ dst[n_chan] = result_alpha;
+
+ /* union in dst_shape if non-null */
+ if (dst_shape != NULL) {
+ tmp = (255 - *dst_shape) * (255 - src_shape) + 0x80;
+ *dst_shape = 255 - ((tmp + (tmp >> 8)) >> 8);
+ }
+ if (dst_tag != NULL) {
*dst_tag = (*dst_tag | tag) & ~GS_UNTOUCHED_TAG;
- }
+ }
}
}
void
art_pdf_composite_knockout_8(byte *dst,
- byte *dst_alpha_g, const byte *backdrop, const byte *src,
- int n_chan, byte shape, byte alpha_mask,
- byte shape_mask, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+ byte *dst_alpha_g, const byte *backdrop, const byte *src,
+ int n_chan, byte shape, byte alpha_mask,
+ byte shape_mask, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
/* This implementation follows the Adobe spec pretty closely, rather
than trying to do anything clever. For example, in the case of a
@@ -1352,7 +1350,7 @@ art_pdf_composite_knockout_8(byte *dst,
int scale_src;
if (shape == 0 || shape_mask == 0)
- return;
+ return;
tmp = shape * shape_mask + 0x80;
/* $f s_i$ */
@@ -1379,34 +1377,34 @@ art_pdf_composite_knockout_8(byte *dst,
/* Do simple compositing of source over backdrop */
if (blend_mode == BLEND_MODE_Normal) {
- for (i = 0; i < n_chan; i++) {
- int c_s;
- int c_b;
-
- c_s = src[i];
- c_b = backdrop[i];
- tmp = (c_b << 16) * scale_b + (c_s - c_b) + scale_src + 0x8000;
- ct[i] = tmp >> 16;
- }
+ for (i = 0; i < n_chan; i++) {
+ int c_s;
+ int c_b;
+
+ c_s = src[i];
+ c_b = backdrop[i];
+ tmp = (c_b << 16) * scale_b + (c_s - c_b) + scale_src + 0x8000;
+ ct[i] = tmp >> 16;
+ }
} else {
- byte blend[ART_MAX_CHAN];
-
- art_blend_pixel_8(blend, backdrop, src, n_chan,
- blend_mode, pblend_procs);
- for (i = 0; i < n_chan; i++) {
- int c_s;
- int c_b;
- int c_bl; /* Result of blend function */
- int c_mix; /* Blend result mixed with source color */
-
- c_s = src[i];
- c_b = backdrop[i];
- c_bl = blend[i];
- tmp = backdrop_alpha * (c_bl - ((int)c_s)) + 0x80;
- c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
- tmp = (c_b << 16) * scale_b + (c_mix - c_b) + scale_src + 0x8000;
- ct[i] = tmp >> 16;
- }
+ byte blend[ART_MAX_CHAN];
+
+ art_blend_pixel_8(blend, backdrop, src, n_chan,
+ blend_mode, pblend_procs);
+ for (i = 0; i < n_chan; i++) {
+ int c_s;
+ int c_b;
+ int c_bl; /* Result of blend function */
+ int c_mix; /* Blend result mixed with source color */
+
+ c_s = src[i];
+ c_b = backdrop[i];
+ c_bl = blend[i];
+ tmp = backdrop_alpha * (c_bl - ((int)c_s)) + 0x80;
+ c_mix = c_s + (((tmp >> 8) + tmp) >> 8);
+ tmp = (c_b << 16) * scale_b + (c_mix - c_b) + scale_src + 0x8000;
+ ct[i] = tmp >> 16;
+ }
}
/* $\alpha g_{i - 1}$ */
@@ -1421,25 +1419,25 @@ art_pdf_composite_knockout_8(byte *dst,
alpha_i = 0xff - ((tmp + (tmp >> 8)) >> 8);
if (alpha_i > 0) {
- int scale_dst;
- int scale_t;
- byte dst_alpha;
+ int scale_dst;
+ int scale_t;
+ byte dst_alpha;
- /* $f s_i / \alpha_i$ scaled by 2^16 */
- scale_t = ((src_shape << 17) + alpha_i) / (2 * alpha_i);
+ /* $f s_i / \alpha_i$ scaled by 2^16 */
+ scale_t = ((src_shape << 17) + alpha_i) / (2 * alpha_i);
- /* $\alpha_{i - 1}$ */
- dst_alpha = dst[n_chan];
+ /* $\alpha_{i - 1}$ */
+ dst_alpha = dst[n_chan];
- tmp = (1 - src_shape) * dst_alpha;
- tmp = (tmp << 9) + (tmp << 1) + (tmp >> 7) + alpha_i;
- scale_dst = tmp / (2 * alpha_i);
+ tmp = (1 - src_shape) * dst_alpha;
+ tmp = (tmp << 9) + (tmp << 1) + (tmp >> 7) + alpha_i;
+ scale_dst = tmp / (2 * alpha_i);
- for (i = 0; i < n_chan; i++) {
- tmp = dst[i] * scale_dst + ct[i] * scale_t + 0x8000;
- /* todo: clamp? */
- dst[i] = tmp >> 16;
- }
+ for (i = 0; i < n_chan; i++) {
+ tmp = dst[i] * scale_dst + ct[i] * scale_t + 0x8000;
+ /* todo: clamp? */
+ dst[i] = tmp >> 16;
+ }
}
dst[n_chan] = alpha_i;
*dst_alpha_g = alpha_g_i;
@@ -1451,7 +1449,7 @@ art_pdf_composite_knockout_8(byte *dst,
file name */
void
dump_raw_buffer(int num_rows, int width, int n_chan,
- int plane_stride, int rowstride,
+ int plane_stride, int rowstride,
char filename[],byte *Buffer)
{
char full_file_name[50];
diff --git a/gs/base/gxblend.h b/gs/base/gxblend.h
index b3761f16f..b83f8950c 100644
--- a/gs/base/gxblend.h
+++ b/gs/base/gxblend.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -70,17 +70,16 @@ typedef struct {
* Perform luminosity and color blending. (Also used for hue blending.)
*/
void (* blend_luminosity)(int n_chan, byte *dst,
- const byte *backdrop, const byte *src);
+ const byte *backdrop, const byte *src);
/*
* Perform saturation blending. (Also used for hue blending.)
*/
void (* blend_saturation)(int n_chan, byte *dst,
- const byte *backdrop, const byte *src);
+ const byte *backdrop, const byte *src);
} pdf14_nonseparable_blending_procs_s;
typedef pdf14_nonseparable_blending_procs_s
- pdf14_nonseparable_blending_procs_t;
-
+ pdf14_nonseparable_blending_procs_t;
/* This is used to so that we can change procedures based
* upon the Smask color space. previously we always
@@ -96,16 +95,16 @@ typedef struct {
typedef pdf14_parent_cs_params_s pdf14_parent_cs_params_t;
/* This function is used for mapping Smask CMYK or RGB data to a monochrome alpha buffer */
-void smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
+void smask_luminosity_mapping(int num_rows, int num_cols, int n_chan, int row_stride,
int plane_stride, byte *src, const byte *des, bool isadditive,
gs_transparency_mask_subtype_t SMask_SubType);
-void smask_blend(byte *src, int width, int height, int rowstride,
+void smask_blend(byte *src, int width, int height, int rowstride,
int planestride);
-void smask_copy(int num_rows, int num_cols, int row_stride,
+void smask_copy(int num_rows, int num_cols, int row_stride,
byte *src, const byte *des);
-void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
- int plane_stride, byte *src, const byte *des,
+void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
+ int plane_stride, byte *src, const byte *des,
gsicc_link_t *icclink);
/**
* art_blend_pixel: Compute PDF 1.4 blending function.
@@ -134,8 +133,8 @@ void smask_icc(int num_rows, int num_cols, int n_chan, int row_stride,
**/
void
art_blend_pixel(ArtPixMaxDepth * dst, const ArtPixMaxDepth * backdrop,
- const ArtPixMaxDepth * src, int n_chan,
- gs_blend_mode_t blend_mode);
+ const ArtPixMaxDepth * src, int n_chan,
+ gs_blend_mode_t blend_mode);
/**
* art_blend_pixel_8: Compute PDF 1.4 blending function on 8-bit pixels.
@@ -165,8 +164,8 @@ art_blend_pixel(ArtPixMaxDepth * dst, const ArtPixMaxDepth * backdrop,
**/
void
art_blend_pixel_8(byte *dst, const byte *backdrop,
- const byte *src, int n_chan, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+ const byte *src, int n_chan, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
/**
* art_pdf_union_8: Union together two alpha values.
@@ -210,8 +209,8 @@ byte art_pdf_union_mul_8(byte alpha1, byte alpha2, byte alpha_mask);
**/
void
art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
- gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+ gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
/**
* art_pdf_uncomposite_group_8: Uncomposite group pixel.
@@ -225,9 +224,9 @@ art_pdf_composite_pixel_alpha_8(byte *dst, const byte *src, int n_chan,
**/
void
art_pdf_uncomposite_group_8(byte *dst,
- const byte *backdrop,
+ const byte *backdrop,
- const byte *src, byte src_alpha_g, int n_chan);
+ const byte *src, byte src_alpha_g, int n_chan);
/**
* art_pdf_recomposite_group_8: Recomposite group pixel.
@@ -248,9 +247,9 @@ art_pdf_uncomposite_group_8(byte *dst,
**/
void
art_pdf_recomposite_group_8(byte *dst, byte *dst_alpha_g,
- const byte *src, byte src_alpha_g, int n_chan,
- byte alpha, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+ const byte *src, byte src_alpha_g, int n_chan,
+ byte alpha, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
/**
* art_pdf_composite_group_8: Composite group pixel.
@@ -268,12 +267,12 @@ art_pdf_recomposite_group_8(byte *dst, byte *dst_alpha_g,
**/
void
art_pdf_composite_group_8(byte *dst, byte *dst_alpha_g,
- const byte *src, int n_chan, byte alpha, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+ const byte *src, int n_chan, byte alpha, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
/**
* art_pdf_composite_knockout_simple_8: Simple knockout compositing.
- * @dst: Destination pixel.
+ * @dst: Destination pixel.
* @dst_shape: Shape associated with @dst.
* @src: Source pixel.
* @n_chan: Number of channels.
@@ -285,16 +284,14 @@ art_pdf_composite_group_8(byte *dst, byte *dst_alpha_g,
**/
void
art_pdf_composite_knockout_simple_8(byte *dst,
- byte *dst_shape,
+ byte *dst_shape,
byte *dst_tag,
- const byte *src, byte tag,
- int n_chan, byte opacity);
-
-
+ const byte *src, byte tag,
+ int n_chan, byte opacity);
/**
* art_pdf_knockoutisolated_group_8: Knockout for isolated group.
- * @dst: Destination pixel.
+ * @dst: Destination pixel.
* @src: Source pixel.
* @n_chan: Number of channels.
*
@@ -303,10 +300,9 @@ art_pdf_composite_knockout_simple_8(byte *dst,
void
art_pdf_knockoutisolated_group_8(byte *dst, const byte *src, int n_chan);
-
/**
* art_pdf_composite_knockout_isolated_8: Simple knockout compositing.
- * @dst: Destination pixel.
+ * @dst: Destination pixel.
* @dst_shape: Shape associated with @dst.
* @dst_tag: Tag associated with @dst.
* @src: Source pixel.
@@ -321,17 +317,17 @@ art_pdf_knockoutisolated_group_8(byte *dst, const byte *src, int n_chan);
**/
void
art_pdf_composite_knockout_isolated_8(byte *dst,
- byte *dst_shape,
+ byte *dst_shape,
byte *dst_tag,
- const byte *src,
- int n_chan,
- byte shape,
+ const byte *src,
+ int n_chan,
+ byte shape,
byte tag,
- byte alpha_mask, byte shape_mask);
+ byte alpha_mask, byte shape_mask);
/**
* art_pdf_composite_knockout_8: General knockout compositing.
- * @dst: Destination pixel.
+ * @dst: Destination pixel.
* @dst_alpha_g: Pointer to alpha g value associated with @dst.
* @backdrop: Backdrop pixel (initial backdrop of knockout group).
* @src: Source pixel.
@@ -349,46 +345,46 @@ art_pdf_composite_knockout_isolated_8(byte *dst,
**/
void
art_pdf_composite_knockout_8(byte *dst,
- byte *dst_alpha_g, const byte *backdrop, const byte *src,
- int n_chan, byte shape, byte alpha_mask,
- byte shape_mask, gs_blend_mode_t blend_mode,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+ byte *dst_alpha_g, const byte *backdrop, const byte *src,
+ int n_chan, byte shape, byte alpha_mask,
+ byte shape_mask, gs_blend_mode_t blend_mode,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
/*
* Routines for handling the non separable blending modes.
*/
/* RGB blending color space */
void art_blend_luminosity_rgb_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
void art_blend_saturation_rgb_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
/* CMYK and CMYK + spot blending color space */
void art_blend_saturation_cmyk_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
void art_blend_luminosity_cmyk_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
/* 'Custom' i.e. unknown blending color space. */
void art_blend_luminosity_custom_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
void art_blend_saturation_custom_8(int n_chan, byte *dst, const byte *backdrop,
- const byte *src);
+ const byte *src);
void pdf14_unpack_additive(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out);
+ pdf14_device * p14dev, byte * out);
void pdf14_unpack_subtractive(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out);
+ pdf14_device * p14dev, byte * out);
void pdf14_unpack_compressed(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out);
+ pdf14_device * p14dev, byte * out);
void pdf14_unpack_custom(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out);
+ pdf14_device * p14dev, byte * out);
void pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape);
-void pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
- int x0, int x1, int y0, int y1, int n_chan, bool additive,
- const pdf14_nonseparable_blending_procs_t * pblend_procs);
+void pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
+ int x0, int x1, int y0, int y1, int n_chan, bool additive,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs);
gx_color_index pdf14_encode_color(gx_device *dev, const gx_color_value colors[]);
gx_color_index pdf14_encode_color_tag(gx_device *dev, const gx_color_value colors[]);
@@ -396,28 +392,28 @@ gx_color_index pdf14_encode_color_tag(gx_device *dev, const gx_color_value color
int pdf14_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out);
gx_color_index pdf14_compressed_encode_color(gx_device *dev, const gx_color_value colors[]);
int pdf14_compressed_decode_color(gx_device * dev, gx_color_index color,
- gx_color_value * out);
+ gx_color_value * out);
void pdf14_gray_cs_to_cmyk_cm(gx_device * dev, frac gray, frac out[]);
void pdf14_rgb_cs_to_cmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[]);
+ frac r, frac g, frac b, frac out[]);
void pdf14_cmyk_cs_to_cmyk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[]);
-void gx_build_blended_image_row(byte *buf_ptr, int y, int planestride,
- int width, int num_comp, byte bg, byte *linebuf);
-void gx_blend_image_buffer(byte *buf_ptr, int width, int height,
+void gx_build_blended_image_row(byte *buf_ptr, int y, int planestride,
+ int width, int num_comp, byte bg, byte *linebuf);
+void gx_blend_image_buffer(byte *buf_ptr, int width, int height,
int rowstride, int planestride, int num_comp, byte bg);
-int gx_put_blended_image_cmykspot(gx_device *target, byte *buf_ptr,
- int planestride, int rowstride,
- int x0, int y0, int width, int height, int num_comp, byte bg,
- gs_separations *pseparations);
-int gx_put_blended_image_custom(gx_device *target, byte *buf_ptr,
- int planestride, int rowstride,
- int x0, int y0, int width, int height, int num_comp, byte bg);
+int gx_put_blended_image_cmykspot(gx_device *target, byte *buf_ptr,
+ int planestride, int rowstride,
+ int x0, int y0, int width, int height, int num_comp, byte bg,
+ gs_separations *pseparations);
+int gx_put_blended_image_custom(gx_device *target, byte *buf_ptr,
+ int planestride, int rowstride,
+ int x0, int y0, int width, int height, int num_comp, byte bg);
#if RAW_DUMP
void dump_raw_buffer(int num_rows, int width, int n_chan,
- int plane_stride, int rowstride,
+ int plane_stride, int rowstride,
char filename[],byte *Buffer);
#endif
diff --git a/gs/base/gxblend1.c b/gs/base/gxblend1.c
index 7d6d9cace..af3f52bd0 100644
--- a/gs/base/gxblend1.c
+++ b/gs/base/gxblend1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,13 +38,13 @@
*/
void
pdf14_unpack_additive(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out)
+ pdf14_device * p14dev, byte * out)
{
int i;
for (i = num_comp - 1; i >= 0; i--) {
- out[i] = (byte)(color & 0xff);
- color >>= 8;
+ out[i] = (byte)(color & 0xff);
+ color >>= 8;
}
}
@@ -57,13 +57,13 @@ pdf14_unpack_additive(int num_comp, gx_color_index color,
*/
void
pdf14_unpack_subtractive(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out)
+ pdf14_device * p14dev, byte * out)
{
int i;
for (i = num_comp - 1; i >= 0; i--) {
- out[i] = 0xff - (byte)(color & 0xff);
- color >>= 8;
+ out[i] = 0xff - (byte)(color & 0xff);
+ color >>= 8;
}
}
@@ -77,18 +77,18 @@ pdf14_unpack_subtractive(int num_comp, gx_color_index color,
*/
void
pdf14_unpack_compressed(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out)
+ pdf14_device * p14dev, byte * out)
{
int comp_num;
if (p14dev->devn_params.compressed_color_list == NULL) {
/*
* For 'uncompressed' data we simply have to unpack the gx_color_index
- * value directly.
+ * value directly.
*/
for (comp_num = num_comp - 1; comp_num >= 0; comp_num--) {
- out[comp_num] = 0xff - (byte)(color & 0xff);
- color >>= 8;
+ out[comp_num] = 0xff - (byte)(color & 0xff);
+ color >>= 8;
}
}
else {
@@ -96,26 +96,26 @@ pdf14_unpack_compressed(int num_comp, gx_color_index color,
comp_bit_map_list_t * pbitmap;
gx_color_value solid_color = 0xff;
- pbitmap = find_bit_map(color,
- p14dev->devn_params.compressed_color_list);
- bit_count = num_comp_bits[pbitmap->num_non_solid_comp];
- bit_mask = (1 << bit_count) - 1;
- factor = comp_bit_factor[pbitmap->num_non_solid_comp];
- if (pbitmap->solid_not_100) {
- solid_color = 0xff - ((factor * ((int)color & bit_mask)) >> 16);
- color >>= bit_count;
- }
+ pbitmap = find_bit_map(color,
+ p14dev->devn_params.compressed_color_list);
+ bit_count = num_comp_bits[pbitmap->num_non_solid_comp];
+ bit_mask = (1 << bit_count) - 1;
+ factor = comp_bit_factor[pbitmap->num_non_solid_comp];
+ if (pbitmap->solid_not_100) {
+ solid_color = 0xff - ((factor * ((int)color & bit_mask)) >> 16);
+ color >>= bit_count;
+ }
for (comp_num = 0; comp_num < num_comp; comp_num++) {
- if (colorant_present(pbitmap, colorants, comp_num)) {
- if (colorant_present(pbitmap, solid_colorants, comp_num))
- *out++ = (byte)solid_color;
- else {
- *out++ = 0xff - ((factor * ((int)color & bit_mask)) >> 16);
- color >>= bit_count;
- }
- }
- else
- *out++ = 0xff;
+ if (colorant_present(pbitmap, colorants, comp_num)) {
+ if (colorant_present(pbitmap, solid_colorants, comp_num))
+ *out++ = (byte)solid_color;
+ else {
+ *out++ = 0xff - ((factor * ((int)color & bit_mask)) >> 16);
+ color >>= bit_count;
+ }
+ }
+ else
+ *out++ = 0xff;
}
}
}
@@ -127,7 +127,7 @@ pdf14_unpack_compressed(int num_comp, gx_color_index color,
*/
void
pdf14_unpack_custom(int num_comp, gx_color_index color,
- pdf14_device * p14dev, byte * out)
+ pdf14_device * p14dev, byte * out)
{
int i;
gx_device * tdev = p14dev->target;
@@ -135,7 +135,7 @@ pdf14_unpack_custom(int num_comp, gx_color_index color,
dev_proc(tdev, decode_color)(tdev, color, cm_values);
for (i = 0; i < num_comp; i++)
- out[i] = 0xff - gx_color_value_to_byte(cm_values[i]);
+ out[i] = 0xff - gx_color_value_to_byte(cm_values[i]);
}
#if RAW_DUMP
@@ -152,26 +152,26 @@ pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape)
int y1 = min(buf->rect.q.y, tos->rect.q.y);
if (x0 < x1 && y0 < y1) {
- int width = x1 - x0;
- byte *buf_plane = buf->data + x0 - buf->rect.p.x + (y0 - buf->rect.p.y) * buf->rowstride;
- byte *tos_plane = tos->data + x0 - tos->rect.p.x + (y0 - tos->rect.p.y) * tos->rowstride;
- int i;
- /*int n_chan_copy = buf->n_chan + (tos->has_shape ? 1 : 0);*/
+ int width = x1 - x0;
+ byte *buf_plane = buf->data + x0 - buf->rect.p.x + (y0 - buf->rect.p.y) * buf->rowstride;
+ byte *tos_plane = tos->data + x0 - tos->rect.p.x + (y0 - tos->rect.p.y) * tos->rowstride;
+ int i;
+ /*int n_chan_copy = buf->n_chan + (tos->has_shape ? 1 : 0);*/
int n_chan_copy = tos->n_chan + (tos->has_shape ? 1 : 0) + (tos->has_tags ? 1 : 0);
- for (i = 0; i < n_chan_copy; i++) {
- byte *buf_ptr = buf_plane;
- byte *tos_ptr = tos_plane;
- int y;
-
- for (y = y0; y < y1; ++y) {
- memcpy (buf_ptr, tos_ptr, width);
- buf_ptr += buf->rowstride;
- tos_ptr += tos->rowstride;
- }
- buf_plane += buf->planestride;
- tos_plane += tos->planestride;
- }
+ for (i = 0; i < n_chan_copy; i++) {
+ byte *buf_ptr = buf_plane;
+ byte *tos_ptr = tos_plane;
+ int y;
+
+ for (y = y0; y < y1; ++y) {
+ memcpy (buf_ptr, tos_ptr, width);
+ buf_ptr += buf->rowstride;
+ tos_ptr += tos->rowstride;
+ }
+ buf_plane += buf->planestride;
+ tos_plane += tos->planestride;
+ }
if (has_shape && !tos->has_shape) {
if (tos->has_tags) {
buf_plane -= buf->planestride;
@@ -181,10 +181,10 @@ pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape)
}
#if RAW_DUMP
if (x0 < x1 && y0 < y1) {
- byte *buf_plane = buf->data + x0 - buf->rect.p.x +
+ byte *buf_plane = buf->data + x0 - buf->rect.p.x +
(y0 - buf->rect.p.y) * buf->rowstride;
dump_raw_buffer(y1-y0, x1 - x0, buf->n_planes,
- buf->planestride, buf->rowstride,
+ buf->planestride, buf->rowstride,
"BackDropInit",buf_plane);
global_index++;
}
@@ -192,18 +192,18 @@ pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool has_shape)
}
void
-pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
- int x0, int x1, int y0, int y1, int n_chan, bool additive,
- const pdf14_nonseparable_blending_procs_t * pblend_procs)
+pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
+ int x0, int x1, int y0, int y1, int n_chan, bool additive,
+ const pdf14_nonseparable_blending_procs_t * pblend_procs)
{
int num_comp = n_chan - 1;
byte alpha = tos->alpha;
byte shape = tos->shape;
byte blend_mode = tos->blend_mode;
byte *tos_ptr = tos->data + x0 - tos->rect.p.x +
- (y0 - tos->rect.p.y) * tos->rowstride;
+ (y0 - tos->rect.p.y) * tos->rowstride;
byte *nos_ptr = nos->data + x0 - nos->rect.p.x +
- (y0 - nos->rect.p.y) * nos->rowstride;
+ (y0 - nos->rect.p.y) * nos->rowstride;
byte *mask_ptr = NULL;
int tos_planestride = tos->planestride;
int nos_planestride = nos->planestride;
@@ -234,21 +234,20 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
rect_merge(nos->bbox, tos->bbox);
if_debug6('v', "pdf14_pop_transparency_group y0 = %d, y1 = %d, w = %d, alpha = %d, shape = %d, tag = bm = %d\n",
- y0, y1, width, alpha, shape, blend_mode);
+ y0, y1, width, alpha, shape, blend_mode);
if (nos->has_alpha_g)
- nos_alpha_g_ptr = nos_ptr + n_chan * nos_planestride;
+ nos_alpha_g_ptr = nos_ptr + n_chan * nos_planestride;
else
- nos_alpha_g_ptr = NULL;
+ nos_alpha_g_ptr = NULL;
+ if (maskbuf != NULL) {
- if (maskbuf != NULL) {
-
mask_tr_fn = maskbuf->transfer_fn;
if (maskbuf->data != NULL) {
- mask_ptr = maskbuf->data + x0 - maskbuf->rect.p.x +
- (y0 - maskbuf->rect.p.y) * maskbuf->rowstride;
+ mask_ptr = maskbuf->data + x0 - maskbuf->rect.p.x +
+ (y0 - maskbuf->rect.p.y) * maskbuf->rowstride;
mask_planestride = maskbuf->planestride;
} else {
@@ -268,152 +267,147 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
}
-
- }
-
+ }
#if RAW_DUMP
composed_ptr = nos_ptr;
dump_raw_buffer(y1-y0, width, tos->n_planes,
- tos_planestride, tos->rowstride,
+ tos_planestride, tos->rowstride,
"ImageTOS",tos_ptr);
dump_raw_buffer(y1-y0, width, nos->n_planes,
- nos_planestride, nos->rowstride,
+ nos_planestride, nos->rowstride,
"ImageNOS",nos_ptr);
if(mask_ptr != NULL){
dump_raw_buffer(y1-y0, width, maskbuf->n_planes,
- maskbuf->planestride, maskbuf->rowstride,
+ maskbuf->planestride, maskbuf->rowstride,
"Mask",mask_ptr);
}
#endif
for (y = y0; y < y1; ++y) {
- for (x = 0; x < width; ++x) {
- byte pix_alpha = alpha;
-
- /* Complement the components for subtractive color spaces */
- if (additive) {
- for (i = 0; i < n_chan; ++i) {
- tos_pixel[i] = tos_ptr[x + i * tos_planestride];
- nos_pixel[i] = nos_ptr[x + i * nos_planestride];
- }
- } else {
- for (i = 0; i < num_comp; ++i) {
- tos_pixel[i] = 255 - tos_ptr[x + i * tos_planestride];
- nos_pixel[i] = 255 - nos_ptr[x + i * nos_planestride];
- }
- tos_pixel[num_comp] = tos_ptr[x + num_comp * tos_planestride];
- nos_pixel[num_comp] = nos_ptr[x + num_comp * nos_planestride];
- }
-
- if (mask_ptr != NULL) {
+ for (x = 0; x < width; ++x) {
+ byte pix_alpha = alpha;
+
+ /* Complement the components for subtractive color spaces */
+ if (additive) {
+ for (i = 0; i < n_chan; ++i) {
+ tos_pixel[i] = tos_ptr[x + i * tos_planestride];
+ nos_pixel[i] = nos_ptr[x + i * nos_planestride];
+ }
+ } else {
+ for (i = 0; i < num_comp; ++i) {
+ tos_pixel[i] = 255 - tos_ptr[x + i * tos_planestride];
+ nos_pixel[i] = 255 - nos_ptr[x + i * nos_planestride];
+ }
+ tos_pixel[num_comp] = tos_ptr[x + num_comp * tos_planestride];
+ nos_pixel[num_comp] = nos_ptr[x + num_comp * nos_planestride];
+ }
+
+ if (mask_ptr != NULL) {
byte mask = mask_ptr[x];
- mask = mask_tr_fn[mask];
- tmp = pix_alpha * mask + 0x80;
- pix_alpha = (tmp + (tmp >> 8)) >> 8;
+ mask = mask_tr_fn[mask];
+ tmp = pix_alpha * mask + 0x80;
+ pix_alpha = (tmp + (tmp >> 8)) >> 8;
# if VD_PAINT_MASK
- vd_pixel(int2fixed(x), int2fixed(y), mask);
+ vd_pixel(int2fixed(x), int2fixed(y), mask);
# endif
- }
+ }
- if (nos_knockout) {
- byte *nos_shape_ptr = nos_has_shape ?
- &nos_ptr[x + nos_shape_offset] : NULL;
+ if (nos_knockout) {
+ byte *nos_shape_ptr = nos_has_shape ?
+ &nos_ptr[x + nos_shape_offset] : NULL;
byte *nos_tag_ptr = nos_has_tag ?
&nos_ptr[x + nos_tag_offset] : NULL;
- byte tos_shape = tos_ptr[x + tos_shape_offset];
- byte tos_tag = tos_ptr[x + tos_tag_offset];
- art_pdf_composite_knockout_isolated_8(nos_pixel,
- nos_shape_ptr,
+ byte tos_shape = tos_ptr[x + tos_shape_offset];
+ byte tos_tag = tos_ptr[x + tos_tag_offset];
+ art_pdf_composite_knockout_isolated_8(nos_pixel,
+ nos_shape_ptr,
nos_tag_ptr,
- tos_pixel,
- n_chan - 1,
- tos_shape,
+ tos_pixel,
+ n_chan - 1,
+ tos_shape,
tos_tag,
- pix_alpha, shape);
+ pix_alpha, shape);
} else {
if (tos_isolated) {
- art_pdf_composite_group_8(nos_pixel, nos_alpha_g_ptr,
- tos_pixel, n_chan - 1,
- pix_alpha, blend_mode, pblend_procs);
- } else {
- byte tos_alpha_g = tos_ptr[x + tos_alpha_g_offset];
- art_pdf_recomposite_group_8(nos_pixel, nos_alpha_g_ptr,
- tos_pixel, tos_alpha_g, n_chan - 1,
- pix_alpha, blend_mode, pblend_procs);
- }
+ art_pdf_composite_group_8(nos_pixel, nos_alpha_g_ptr,
+ tos_pixel, n_chan - 1,
+ pix_alpha, blend_mode, pblend_procs);
+ } else {
+ byte tos_alpha_g = tos_ptr[x + tos_alpha_g_offset];
+ art_pdf_recomposite_group_8(nos_pixel, nos_alpha_g_ptr,
+ tos_pixel, tos_alpha_g, n_chan - 1,
+ pix_alpha, blend_mode, pblend_procs);
+ }
if (tos_has_tag) {
if (pix_alpha == 255) {
- nos_ptr[x + nos_tag_offset] = tos_ptr[x + tos_tag_offset];
- } else if (pix_alpha != 0 && tos_ptr[x + tos_tag_offset] !=
- GS_UNTOUCHED_TAG) {
- nos_ptr[x + nos_tag_offset] =
- (nos_ptr[x + nos_tag_offset] |
+ nos_ptr[x + nos_tag_offset] = tos_ptr[x + tos_tag_offset];
+ } else if (pix_alpha != 0 && tos_ptr[x + tos_tag_offset] !=
+ GS_UNTOUCHED_TAG) {
+ nos_ptr[x + nos_tag_offset] =
+ (nos_ptr[x + nos_tag_offset] |
tos_ptr[x + tos_tag_offset]) &
- ~GS_UNTOUCHED_TAG;
+ ~GS_UNTOUCHED_TAG;
}
}
}
- if (nos_has_shape) {
- nos_ptr[x + nos_shape_offset] =
- art_pdf_union_mul_8 (nos_ptr[x + nos_shape_offset],
- tos_ptr[x + tos_shape_offset],
- shape);
-
- }
- /* Complement the results for subtractive color spaces */
- if (additive) {
- for (i = 0; i < n_chan; ++i) {
- nos_ptr[x + i * nos_planestride] = nos_pixel[i];
- }
- } else {
- for (i = 0; i < num_comp; ++i)
- nos_ptr[x + i * nos_planestride] = 255 - nos_pixel[i];
- nos_ptr[x + num_comp * nos_planestride] = nos_pixel[num_comp];
- }
+ if (nos_has_shape) {
+ nos_ptr[x + nos_shape_offset] =
+ art_pdf_union_mul_8 (nos_ptr[x + nos_shape_offset],
+ tos_ptr[x + tos_shape_offset],
+ shape);
+
+ }
+ /* Complement the results for subtractive color spaces */
+ if (additive) {
+ for (i = 0; i < n_chan; ++i) {
+ nos_ptr[x + i * nos_planestride] = nos_pixel[i];
+ }
+ } else {
+ for (i = 0; i < num_comp; ++i)
+ nos_ptr[x + i * nos_planestride] = 255 - nos_pixel[i];
+ nos_ptr[x + num_comp * nos_planestride] = nos_pixel[num_comp];
+ }
# if VD_PAINT_COLORS
- vd_pixel(int2fixed(x), int2fixed(y), n_chan == 1 ?
- (nos_pixel[0] << 16) + (nos_pixel[0] << 8) + nos_pixel[0] :
- (nos_pixel[0] << 16) + (nos_pixel[1] << 8) + nos_pixel[2]);
+ vd_pixel(int2fixed(x), int2fixed(y), n_chan == 1 ?
+ (nos_pixel[0] << 16) + (nos_pixel[0] << 8) + nos_pixel[0] :
+ (nos_pixel[0] << 16) + (nos_pixel[1] << 8) + nos_pixel[2]);
# endif
# if VD_PAINT_ALPHA
- vd_pixel(int2fixed(x), int2fixed(y),
- (nos_pixel[n_chan - 1] << 16) + (nos_pixel[n_chan - 1] << 8) +
- nos_pixel[n_chan - 1]);
+ vd_pixel(int2fixed(x), int2fixed(y),
+ (nos_pixel[n_chan - 1] << 16) + (nos_pixel[n_chan - 1] << 8) +
+ nos_pixel[n_chan - 1]);
# endif
- if (nos_alpha_g_ptr != NULL)
- ++nos_alpha_g_ptr;
- }
- tos_ptr += tos->rowstride;
- nos_ptr += nos->rowstride;
- if (nos_alpha_g_ptr != NULL)
- nos_alpha_g_ptr += nos->rowstride - width;
- if (mask_ptr != NULL)
- mask_ptr += maskbuf->rowstride;
+ if (nos_alpha_g_ptr != NULL)
+ ++nos_alpha_g_ptr;
+ }
+ tos_ptr += tos->rowstride;
+ nos_ptr += nos->rowstride;
+ if (nos_alpha_g_ptr != NULL)
+ nos_alpha_g_ptr += nos->rowstride - width;
+ if (mask_ptr != NULL)
+ mask_ptr += maskbuf->rowstride;
}
-
/* Lets look at composed result */
-
#if RAW_DUMP
- /* The group alpha should disappear */
+ /* The group alpha should disappear */
dump_raw_buffer(y1-y0, width, tos->n_planes - tos->has_alpha_g - tos->has_shape,
- nos_planestride, nos->rowstride,
+ nos_planestride, nos->rowstride,
"Composed",composed_ptr);
global_index++;
-
#endif
}
@@ -430,15 +424,15 @@ pdf14_encode_color(gx_device *dev, const gx_color_value colors[])
int ncomp = dev->color_info.num_components;
for (i = 0; i < ncomp; i++) {
- color <<= 8;
- color |= (colors[i] >> drop);
+ color <<= 8;
+ color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
}
/*
* Encode a list of colorant values into a gx_color_index_value.
- Stick the tag information at the end.
+ Stick the tag information at the end.
*/
gx_color_index
pdf14_encode_color_tag(gx_device *dev, const gx_color_value colors[])
@@ -452,8 +446,8 @@ pdf14_encode_color_tag(gx_device *dev, const gx_color_value colors[])
/* Add in the tag information */
color = gs_current_object_tag(dev->memory);
for (i = 0; i < ncomp; i++) {
- color <<= 8;
- color |= (colors[i] >> drop);
+ color <<= 8;
+ color |= (colors[i] >> drop);
}
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -468,8 +462,8 @@ pdf14_decode_color(gx_device * dev, gx_color_index color, gx_color_value * out)
int ncomp = dev->color_info.num_components;
for (i = 0; i < ncomp; i++) {
- out[ncomp - i - 1] = (gx_color_value) ((color & 0xff) * 0x101);
- color >>= 8;
+ out[ncomp - i - 1] = (gx_color_value) ((color & 0xff) * 0x101);
+ color >>= 8;
}
return 0;
}
@@ -485,16 +479,16 @@ pdf14_compressed_encode_color(gx_device *dev, const gx_color_value colors[])
gs_devn_params *pdevn_params = NULL;
if (dev->procs.ret_devn_params != NULL)
- pdevn_params = dev_proc(dev, ret_devn_params)(dev);
+ pdevn_params = dev_proc(dev, ret_devn_params)(dev);
/* If there was no dev_proc or it returned NULL, assume pdf14 device devn_params */
if (pdevn_params == NULL) {
#ifdef DEBUG
- if (strncmp(dev->dname, "pdf14", 5))
+ if (strncmp(dev->dname, "pdf14", 5))
emprintf1(dev->memory,
"pdf14_compressed_encode_color devn_params not from pdf14 device, device = '%s'\n",
dev->dname);
#endif
- pdevn_params = &(((pdf14_device *)dev)->devn_params);
+ pdevn_params = &(((pdf14_device *)dev)->devn_params);
}
return devn_encode_compressed_color(dev, colors, pdevn_params);
}
@@ -506,21 +500,21 @@ pdf14_compressed_encode_color(gx_device *dev, const gx_color_value colors[])
*/
int
pdf14_compressed_decode_color(gx_device * dev, gx_color_index color,
- gx_color_value * out)
+ gx_color_value * out)
{
gs_devn_params *pdevn_params = NULL;
if (dev->procs.ret_devn_params != NULL)
- pdevn_params = dev_proc(dev, ret_devn_params)(dev);
+ pdevn_params = dev_proc(dev, ret_devn_params)(dev);
/* If there was no dev_proc or it returned NULL, assume pdf14 device devn_params */
if (pdevn_params == NULL) {
#ifdef DEBUG
- if (strncmp(dev->dname, "pdf14", 5))
+ if (strncmp(dev->dname, "pdf14", 5))
emprintf1(dev->memory,
"pdf14_compressed_decode_color devn_params not from pdf14 device, device = '%s'\n",
dev->dname);
#endif
- pdevn_params = &(((pdf14_device *)dev)->devn_params);
+ pdevn_params = &(((pdf14_device *)dev)->devn_params);
}
return devn_decode_compressed_color(dev, color, out, pdevn_params);
}
@@ -533,7 +527,7 @@ pdf14_gray_cs_to_cmyk_cm(gx_device * dev, frac gray, frac out[])
out[0] = out[1] = out[2] = frac_0;
out[3] = frac_1 - gray;
for (--num_comp; num_comp > 3; num_comp--)
- out[num_comp] = 0;
+ out[num_comp] = 0;
}
/*
@@ -553,7 +547,7 @@ pdf14_gray_cs_to_cmyk_cm(gx_device * dev, frac gray, frac out[])
*/
void
pdf14_rgb_cs_to_cmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
int num_comp = dev->color_info.num_components;
@@ -569,7 +563,7 @@ pdf14_rgb_cs_to_cmyk_cm(gx_device * dev, const gs_imager_state *pis,
out[3] = k;
}
for (--num_comp; num_comp > 3; num_comp--)
- out[num_comp] = 0;
+ out[num_comp] = 0;
}
void
@@ -582,7 +576,7 @@ pdf14_cmyk_cs_to_cmyk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac o
out[2] = y;
out[3] = k;
for (--num_comp; num_comp > 3; num_comp--)
- out[num_comp] = 0;
+ out[num_comp] = 0;
}
#ifdef DUMP_TO_PNG
@@ -611,21 +605,21 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
int y;
if (buf->data == NULL)
- return 0;
+ return 0;
file = fopen ("c:\\temp\\tmp.png", "wb");
if_debug0('v', "[v]pnga_output_page\n");
if (row == 0 || png_ptr == 0 || info_ptr == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
/* set error handling */
if (setjmp(png_ptr->jmpbuf)) {
- /* If we get here, we had a problem reading the file */
- code = gs_note_error(gs_error_VMerror);
- goto done;
+ /* If we get here, we had a problem reading the file */
+ code = gs_note_error(gs_error_VMerror);
+ goto done;
}
code = 0; /* for normal path */
@@ -637,9 +631,9 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
info_ptr->height = height;
/* resolution is in pixels per meter vs. dpi */
info_ptr->x_pixels_per_unit =
- (png_uint_32) (96.0 * (100.0 / 2.54));
+ (png_uint_32) (96.0 * (100.0 / 2.54));
info_ptr->y_pixels_per_unit =
- (png_uint_32) (96.0 * (100.0 / 2.54));
+ (png_uint_32) (96.0 * (100.0 / 2.54));
info_ptr->phys_unit_type = PNG_RESOLUTION_METER;
info_ptr->valid |= PNG_INFO_pHYs;
@@ -649,7 +643,7 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
/* add comment */
sprintf(software_text, "%s %d.%02d", gs_product,
- (int)(gs_revision / 100), (int)(gs_revision % 100));
+ (int)(gs_revision / 100), (int)(gs_revision % 100));
text_png.compression = -1; /* uncompressed */
text_png.key = (char *)software_key; /* not const, unfortunately */
text_png.text = software_text;
@@ -666,16 +660,16 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
/* Write the contents of the image. */
for (y = 0; y < height; ++y) {
- int x;
-
- for (x = 0; x < width; ++x) {
- row[(x << 2)] = buf_ptr[x];
- row[(x << 2) + 1] = buf_ptr[x + planestride];
- row[(x << 2) + 2] = buf_ptr[x + planestride * 2];
- row[(x << 2) + 3] = buf_ptr[x + planestride * 3];
- }
- png_write_row(png_ptr, row);
- buf_ptr += rowstride;
+ int x;
+
+ for (x = 0; x < width; ++x) {
+ row[(x << 2)] = buf_ptr[x];
+ row[(x << 2) + 1] = buf_ptr[x + planestride];
+ row[(x << 2) + 2] = buf_ptr[x + planestride * 2];
+ row[(x << 2) + 3] = buf_ptr[x + planestride * 3];
+ }
+ png_write_row(png_ptr, row);
+ buf_ptr += rowstride;
}
/* write the rest of the file */
@@ -692,40 +686,40 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
#endif
void
-gx_build_blended_image_row(byte *buf_ptr, int y, int planestride,
- int width, int num_comp, byte bg, byte *linebuf)
+gx_build_blended_image_row(byte *buf_ptr, int y, int planestride,
+ int width, int num_comp, byte bg, byte *linebuf)
{
int x;
for (x = 0; x < width; x++) {
- byte comp, a;
- int tmp, comp_num;
-
- /* composite RGBA (or CMYKA, etc.) pixel with over solid background */
- a = buf_ptr[x + planestride * num_comp];
-
- if ((a + 1) & 0xfe) {
- a ^= 0xff;
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- comp = buf_ptr[x + planestride * comp_num];
- tmp = ((bg - comp) * a) + 0x80;
- comp += (tmp + (tmp >> 8)) >> 8;
- linebuf[x * num_comp + comp_num] = comp;
- }
- } else if (a == 0) {
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- linebuf[x * num_comp + comp_num] = bg;
- }
- } else {
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- comp = buf_ptr[x + planestride * comp_num];
- linebuf[x * num_comp + comp_num] = comp;
- }
- }
+ byte comp, a;
+ int tmp, comp_num;
+
+ /* composite RGBA (or CMYKA, etc.) pixel with over solid background */
+ a = buf_ptr[x + planestride * num_comp];
+
+ if ((a + 1) & 0xfe) {
+ a ^= 0xff;
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * comp_num];
+ tmp = ((bg - comp) * a) + 0x80;
+ comp += (tmp + (tmp >> 8)) >> 8;
+ linebuf[x * num_comp + comp_num] = comp;
+ }
+ } else if (a == 0) {
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ linebuf[x * num_comp + comp_num] = bg;
+ }
+ } else {
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * comp_num];
+ linebuf[x * num_comp + comp_num] = comp;
+ }
+ }
}
}
void
-gx_blend_image_buffer(byte *buf_ptr, int width, int height, int rowstride,
+gx_blend_image_buffer(byte *buf_ptr, int width, int height, int rowstride,
int planestride, int num_comp, byte bg)
{
int x, y;
@@ -736,31 +730,31 @@ gx_blend_image_buffer(byte *buf_ptr, int width, int height, int rowstride,
for (y = 0; y < height; y++) {
position = y * rowstride;
for (x = 0; x < width; x++) {
- /* composite RGBA (or CMYKA, etc.) pixel with over solid background */
+ /* composite RGBA (or CMYKA, etc.) pixel with over solid background */
a = buf_ptr[position + planestride * num_comp];
- if ((a + 1) & 0xfe) {
- a ^= 0xff;
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- comp = buf_ptr[position + planestride * comp_num];
- tmp = ((bg - comp) * a) + 0x80;
- comp += (tmp + (tmp >> 8)) >> 8;
- buf_ptr[position + planestride * comp_num] = comp;
- }
- } else if (a == 0) {
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- buf_ptr[position + planestride * comp_num] = bg;
- }
- }
+ if ((a + 1) & 0xfe) {
+ a ^= 0xff;
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ comp = buf_ptr[position + planestride * comp_num];
+ tmp = ((bg - comp) * a) + 0x80;
+ comp += (tmp + (tmp >> 8)) >> 8;
+ buf_ptr[position + planestride * comp_num] = comp;
+ }
+ } else if (a == 0) {
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ buf_ptr[position + planestride * comp_num] = bg;
+ }
+ }
position+=1;
}
}
}
int
-gx_put_blended_image_cmykspot(gx_device *target, byte *buf_ptr,
- int planestride, int rowstride,
- int x0, int y0, int width, int height, int num_comp, byte bg,
- gs_separations * pseparations)
+gx_put_blended_image_cmykspot(gx_device *target, byte *buf_ptr,
+ int planestride, int rowstride,
+ int x0, int y0, int width, int height, int num_comp, byte bg,
+ gs_separations * pseparations)
{
int code = 0;
int x, y, tmp, comp_num, output_comp_num;
@@ -784,74 +778,74 @@ gx_put_blended_image_cmykspot(gx_device *target, byte *buf_ptr,
*/
/* Check if target processes CMYK colorants. */
for (comp_num = 0; comp_num < 4; comp_num++) {
- const char * pcomp_name = (const char *)DeviceCMYKComponents[comp_num];
-
- output_comp_num = dev_proc(target, get_color_comp_index)
- (target, pcomp_name, strlen(pcomp_name), NO_COMP_NAME_TYPE);
- if (output_comp_num >=0 &&
- output_comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS) {
- output_map[num_known_comp] = output_comp_num;
- input_map[num_known_comp++] = comp_num;
- }
+ const char * pcomp_name = (const char *)DeviceCMYKComponents[comp_num];
+
+ output_comp_num = dev_proc(target, get_color_comp_index)
+ (target, pcomp_name, strlen(pcomp_name), NO_COMP_NAME_TYPE);
+ if (output_comp_num >=0 &&
+ output_comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ output_map[num_known_comp] = output_comp_num;
+ input_map[num_known_comp++] = comp_num;
+ }
}
/* Check if target processes our spot colorants. */
for (comp_num = 0; comp_num < num_sep; comp_num++) {
- output_comp_num = dev_proc(target, get_color_comp_index)
- (target, (const char *)(pseparations->names[comp_num].data),
- pseparations->names[comp_num].size, NO_COMP_NAME_TYPE);
- if (output_comp_num >= 0 &&
- output_comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS) {
- output_map[num_known_comp] = output_comp_num;
- input_map[num_known_comp++] = comp_num + 4;
- }
+ output_comp_num = dev_proc(target, get_color_comp_index)
+ (target, (const char *)(pseparations->names[comp_num].data),
+ pseparations->names[comp_num].size, NO_COMP_NAME_TYPE);
+ if (output_comp_num >= 0 &&
+ output_comp_num < GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ output_map[num_known_comp] = output_comp_num;
+ input_map[num_known_comp++] = comp_num + 4;
+ }
}
/* Clear all output colorants first */
for (comp_num = 0; comp_num < output_num_comp; comp_num++)
- cv[comp_num] = 0;
+ cv[comp_num] = 0;
/* Send pixel data to the target device. */
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
-
- /* composite CMYKA, etc. pixel with over solid background */
- a = buf_ptr[x + planestride * num_comp];
-
- if ((a + 1) & 0xfe) {
- /* a ^= 0xff; */ /* No inversion here! Bug 689895 */
- for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
- comp = buf_ptr[x + planestride * input_map[comp_num]];
- tmp = ((comp - bg) * a) + 0x80;
- comp += tmp + (tmp >> 8);
- cv[output_map[comp_num]] = comp;
- }
- } else if (a == 0) {
- for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
- cv[output_map[comp_num]] = bg;
- }
- } else {
- for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
- comp = buf_ptr[x + planestride * input_map[comp_num]];
- cv[output_map[comp_num]] = (comp << 8) + comp;
- }
- }
- color = dev_proc(target, encode_color)(target, cv);
- code = dev_proc(target, fill_rectangle)(target, x + x0,
- y + y0, 1, 1, color);
- if (code < 0)
- return code;
- }
-
- buf_ptr += rowstride;
+ for (x = 0; x < width; x++) {
+
+ /* composite CMYKA, etc. pixel with over solid background */
+ a = buf_ptr[x + planestride * num_comp];
+
+ if ((a + 1) & 0xfe) {
+ /* a ^= 0xff; */ /* No inversion here! Bug 689895 */
+ for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * input_map[comp_num]];
+ tmp = ((comp - bg) * a) + 0x80;
+ comp += tmp + (tmp >> 8);
+ cv[output_map[comp_num]] = comp;
+ }
+ } else if (a == 0) {
+ for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
+ cv[output_map[comp_num]] = bg;
+ }
+ } else {
+ for (comp_num = 0; comp_num < num_known_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * input_map[comp_num]];
+ cv[output_map[comp_num]] = (comp << 8) + comp;
+ }
+ }
+ color = dev_proc(target, encode_color)(target, cv);
+ code = dev_proc(target, fill_rectangle)(target, x + x0,
+ y + y0, 1, 1, color);
+ if (code < 0)
+ return code;
+ }
+
+ buf_ptr += rowstride;
}
return code;
}
int
-gx_put_blended_image_custom(gx_device *target, byte *buf_ptr,
- int planestride, int rowstride,
- int x0, int y0, int width, int height, int num_comp, byte bg)
+gx_put_blended_image_custom(gx_device *target, byte *buf_ptr,
+ int planestride, int rowstride,
+ int x0, int y0, int width, int height, int num_comp, byte bg)
{
int code = 0;
int x, y, tmp, comp_num;
@@ -860,38 +854,37 @@ gx_put_blended_image_custom(gx_device *target, byte *buf_ptr,
gx_color_value comp;
byte a;
-
/* Send pixel data to the target device. */
for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
-
- /* composite CMYKA, etc. pixel with over solid background */
- a = buf_ptr[x + planestride * num_comp];
-
- if ((a + 1) & 0xfe) {
- a ^= 0xff;
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- comp = buf_ptr[x + planestride * comp_num];
- tmp = ((bg - comp) * a) + 0x80;
- comp += tmp + (tmp >> 8);
- cv[comp_num] = comp;
- }
- } else if (a == 0) {
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- cv[comp_num] = bg;
- }
- } else {
- for (comp_num = 0; comp_num < num_comp; comp_num++) {
- comp = buf_ptr[x + planestride * comp_num];
- cv[comp_num] = (comp << 8) + comp;
- }
- }
- color = dev_proc(target, encode_color)(target, cv);
- code = dev_proc(target, fill_rectangle)(target, x + x0,
- y + y0, 1, 1, color);
- }
-
- buf_ptr += rowstride;
+ for (x = 0; x < width; x++) {
+
+ /* composite CMYKA, etc. pixel with over solid background */
+ a = buf_ptr[x + planestride * num_comp];
+
+ if ((a + 1) & 0xfe) {
+ a ^= 0xff;
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * comp_num];
+ tmp = ((bg - comp) * a) + 0x80;
+ comp += tmp + (tmp >> 8);
+ cv[comp_num] = comp;
+ }
+ } else if (a == 0) {
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ cv[comp_num] = bg;
+ }
+ } else {
+ for (comp_num = 0; comp_num < num_comp; comp_num++) {
+ comp = buf_ptr[x + planestride * comp_num];
+ cv[comp_num] = (comp << 8) + comp;
+ }
+ }
+ color = dev_proc(target, encode_color)(target, cv);
+ code = dev_proc(target, fill_rectangle)(target, x + x0,
+ y + y0, 1, 1, color);
+ }
+
+ buf_ptr += rowstride;
}
return code;
diff --git a/gs/base/gxccache.c b/gs/base/gxccache.c
index d897674b4..787a16513 100644
--- a/gs/base/gxccache.c
+++ b/gs/base/gxccache.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@ static const gs_log2_scale_point scale_log2_1 =
{0, 0};
void
-gx_compute_char_matrix(const gs_matrix *char_tm, const gs_log2_scale_point *log2_scale,
+gx_compute_char_matrix(const gs_matrix *char_tm, const gs_log2_scale_point *log2_scale,
float *mxx, float *mxy, float *myx, float *myy)
{
int scale_x = 1 << log2_scale->x;
@@ -56,28 +56,28 @@ gx_compute_char_matrix(const gs_matrix *char_tm, const gs_log2_scale_point *log2
}
void
-gx_compute_ccache_key(gs_font * pfont, const gs_matrix *char_tm,
+gx_compute_ccache_key(gs_font * pfont, const gs_matrix *char_tm,
const gs_log2_scale_point *log2_scale, bool design_grid,
float *mxx, float *mxy, float *myx, float *myy)
{
- if (design_grid &&
- (pfont->FontType == ft_TrueType || pfont->FontType == ft_CID_TrueType)) {
- /*
- * We need a special face for this case, because the TT interpreter
- * can't generate both grid_fitted and non-grid-fitted outlines
- * with a same face instance. This happens due to control
- * values in 'cvt' must be different.
- * Since a single face satisfies all font sizes,
- * we use a zero matrix as the cache entry key.
- */
- *mxx = *mxy = *myx = *myy = 0;
+ if (design_grid &&
+ (pfont->FontType == ft_TrueType || pfont->FontType == ft_CID_TrueType)) {
+ /*
+ * We need a special face for this case, because the TT interpreter
+ * can't generate both grid_fitted and non-grid-fitted outlines
+ * with a same face instance. This happens due to control
+ * values in 'cvt' must be different.
+ * Since a single face satisfies all font sizes,
+ * we use a zero matrix as the cache entry key.
+ */
+ *mxx = *mxy = *myx = *myy = 0;
} else
- gx_compute_char_matrix(char_tm, log2_scale, mxx, mxy, myx, myy);
+ gx_compute_char_matrix(char_tm, log2_scale, mxx, mxy, myx, myy);
}
/* Look up, and if necessary add, a font/matrix pair in the cache */
int
-gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
+gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
const gs_log2_scale_point *log2_scale, bool design_grid, cached_fm_pair **ppair)
{
float mxx, mxy, myx, myy;
@@ -88,51 +88,51 @@ gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
gs_uid uid;
gx_compute_ccache_key(pfont, char_tm, log2_scale, design_grid,
- &mxx, &mxy, &myx, &myy);
+ &mxx, &mxy, &myx, &myy);
if (font->FontType == ft_composite || font->PaintType != 0) { /* We can't cache by UID alone. */
- uid_set_invalid(&uid);
+ uid_set_invalid(&uid);
} else {
- uid = ((gs_font_base *) font)->UID;
- if (uid_is_valid(&uid))
- font = 0;
+ uid = ((gs_font_base *) font)->UID;
+ if (uid_is_valid(&uid))
+ font = 0;
}
for (;count--; pair = dir->fmcache.mdata + pair->next) {
- /* We have either a non-zero font and an invalid UID, */
- /* or a zero font and a valid UID. */
- /* We have to break up the test */
- /* because of a bug in the Zortech compiler. */
- if (font != 0) {
- if (pair->font != font)
- continue;
- } else {
- if (!uid_equal(&pair->UID, &uid) ||
- pair->FontType != pfont->FontType
- )
- continue;
- }
- if (pair->mxx == mxx && pair->mxy == mxy &&
- pair->myx == myx && pair->myy == myy
- && pair->design_grid == design_grid) {
- int code;
+ /* We have either a non-zero font and an invalid UID, */
+ /* or a zero font and a valid UID. */
+ /* We have to break up the test */
+ /* because of a bug in the Zortech compiler. */
+ if (font != 0) {
+ if (pair->font != font)
+ continue;
+ } else {
+ if (!uid_equal(&pair->UID, &uid) ||
+ pair->FontType != pfont->FontType
+ )
+ continue;
+ }
+ if (pair->mxx == mxx && pair->mxy == mxy &&
+ pair->myx == myx && pair->myy == myy
+ && pair->design_grid == design_grid) {
+ int code;
- if (pair->font == 0) {
- pair->font = pfont;
- if_debug2('k', "[k]updating pair 0x%lx with font 0x%lx\n",
- (ulong) pair, (ulong) pfont);
- } else {
- if_debug2('k', "[k]found pair 0x%lx: font=0x%lx\n",
- (ulong) pair, (ulong) pair->font);
- }
- code = gx_touch_fm_pair(dir, pair);
- if (code < 0)
- return code;
- code = gx_provide_fm_pair_attributes(dir, pfont, pair,
- char_tm, log2_scale, design_grid);
- if (code < 0)
- return code;
- *ppair = pair;
- return 0;
- }
+ if (pair->font == 0) {
+ pair->font = pfont;
+ if_debug2('k', "[k]updating pair 0x%lx with font 0x%lx\n",
+ (ulong) pair, (ulong) pfont);
+ } else {
+ if_debug2('k', "[k]found pair 0x%lx: font=0x%lx\n",
+ (ulong) pair, (ulong) pair->font);
+ }
+ code = gx_touch_fm_pair(dir, pair);
+ if (code < 0)
+ return code;
+ code = gx_provide_fm_pair_attributes(dir, pfont, pair,
+ char_tm, log2_scale, design_grid);
+ if (code < 0)
+ return code;
+ *ppair = pair;
+ return 0;
+ }
}
return gx_add_fm_pair(dir, pfont, &uid, char_tm, log2_scale, design_grid, ppair);
}
@@ -141,27 +141,27 @@ gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
/* Return the cached_char or 0. */
cached_char *
gx_lookup_cached_char(const gs_font * pfont, const cached_fm_pair * pair,
- gs_glyph glyph, int wmode, int depth,
- gs_fixed_point *subpix_origin)
+ gs_glyph glyph, int wmode, int depth,
+ gs_fixed_point *subpix_origin)
{
gs_font_dir *dir = pfont->dir;
uint chi = chars_head_index(glyph, pair);
register cached_char *cc;
while ((cc = dir->ccache.table[chi & dir->ccache.table_mask]) != 0) {
- if (cc->code == glyph && cc_pair(cc) == pair &&
- cc->subpix_origin.x == subpix_origin->x &&
- cc->subpix_origin.y == subpix_origin->y &&
- cc->wmode == wmode && cc_depth(cc) == depth
- ) {
- if_debug4('K', "[K]found 0x%lx (depth=%d) for glyph=0x%lx, wmode=%d\n",
- (ulong) cc, cc_depth(cc), (ulong) glyph, wmode);
- return cc;
- }
- chi++;
+ if (cc->code == glyph && cc_pair(cc) == pair &&
+ cc->subpix_origin.x == subpix_origin->x &&
+ cc->subpix_origin.y == subpix_origin->y &&
+ cc->wmode == wmode && cc_depth(cc) == depth
+ ) {
+ if_debug4('K', "[K]found 0x%lx (depth=%d) for glyph=0x%lx, wmode=%d\n",
+ (ulong) cc, cc_depth(cc), (ulong) glyph, wmode);
+ return cc;
+ }
+ chi++;
}
if_debug3('K', "[K]not found: glyph=0x%lx, wmode=%d, depth=%d\n",
- (ulong) glyph, wmode, depth);
+ (ulong) glyph, wmode, depth);
return 0;
}
@@ -171,7 +171,7 @@ gx_lookup_cached_char(const gs_font * pfont, const cached_fm_pair * pair,
/* Note it must initialise *pcc in any case. */
int
gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
- gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc)
+ gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc)
{
gs_font *font = pair->font;
int enc_index;
@@ -185,51 +185,51 @@ gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
*pcc = NULL;
if (font == 0)
- return 0;
+ return 0;
enc_index =
- (font->FontType == ft_composite ? -1 :
- ((gs_font_base *) font)->nearest_encoding_index);
+ (font->FontType == ft_composite ? -1 :
+ ((gs_font_base *) font)->nearest_encoding_index);
if (!pair->xfont_tried) { /* Look for an xfont now. */
- gx_lookup_xfont(pgs, pair, enc_index);
- pair->xfont_tried = true;
+ gx_lookup_xfont(pgs, pair, enc_index);
+ pair->xfont_tried = true;
}
xf = pair->xfont;
if (xf == 0)
- return 0;
+ return 0;
{
- const gx_xfont_procs *procs = xf->common.procs;
- gs_const_string gstr;
- int code = font->procs.glyph_name(font, glyph, &gstr);
+ const gx_xfont_procs *procs = xf->common.procs;
+ gs_const_string gstr;
+ int code = font->procs.glyph_name(font, glyph, &gstr);
- if (code < 0)
- return 0;
- if (enc_index >= 0 && ((gs_font_base *)font)->encoding_index < 0) {
- /*
- * Use the registered encoding only if this glyph
- * is the same as the one in the registered encoding.
- */
- gs_const_string kstr;
+ if (code < 0)
+ return 0;
+ if (enc_index >= 0 && ((gs_font_base *)font)->encoding_index < 0) {
+ /*
+ * Use the registered encoding only if this glyph
+ * is the same as the one in the registered encoding.
+ */
+ gs_const_string kstr;
- if (gs_c_glyph_name(gs_c_known_encode(chr, enc_index), &kstr) < 0 ||
- kstr.size != gstr.size ||
- memcmp(kstr.data, gstr.data, kstr.size)
- )
- enc_index = -1;
- }
- xg = procs->char_xglyph(xf, chr, enc_index, glyph, &gstr);
- if (xg == gx_no_xglyph)
- return 0;
- if ((*procs->char_metrics) (xf, xg, wmode, &wxy, &bbox) < 0)
- return 0;
+ if (gs_c_glyph_name(gs_c_known_encode(chr, enc_index), &kstr) < 0 ||
+ kstr.size != gstr.size ||
+ memcmp(kstr.data, gstr.data, kstr.size)
+ )
+ enc_index = -1;
+ }
+ xg = procs->char_xglyph(xf, chr, enc_index, glyph, &gstr);
+ if (xg == gx_no_xglyph)
+ return 0;
+ if ((*procs->char_metrics) (xf, xg, wmode, &wxy, &bbox) < 0)
+ return 0;
}
log2_scale.x = log2_scale.y = 1;
- code = gx_alloc_char_bits(font->dir, NULL, NULL,
- (ushort)(bbox.q.x - bbox.p.x), (ushort)(bbox.q.y - bbox.p.y),
- &log2_scale, 1, &cc);
+ code = gx_alloc_char_bits(font->dir, NULL, NULL,
+ (ushort)(bbox.q.x - bbox.p.x), (ushort)(bbox.q.y - bbox.p.y),
+ &log2_scale, 1, &cc);
if (code < 0)
- return code;
+ return code;
if (cc == 0)
- return 0;
+ return 0;
/* Success. Make the cache entry. */
cc->code = glyph;
cc->wmode = wmode;
@@ -240,13 +240,13 @@ gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
cc->offset.y = int2fixed(-bbox.p.y);
cc_set_pair(cc, pair);
if_debug5('k', "[k]xfont %s char %d/0x%x#0x%lx=>0x%lx\n",
- font->font_name.chars, enc_index, (int)chr,
- (ulong) glyph, (ulong) xg);
+ font->font_name.chars, enc_index, (int)chr,
+ (ulong) glyph, (ulong) xg);
if_debug6('k', " wxy=(%g,%g) bbox=(%d,%d),(%d,%d)\n",
- wxy.x, wxy.y, bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
+ wxy.x, wxy.y, bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y);
code = gx_add_cached_char(font->dir, NULL, cc, pair, &scale_log2_1);
if (code < 0)
- return code;
+ return code;
*pcc = cc;
return 1;
}
@@ -273,7 +273,7 @@ gx_image_cached_char(register gs_show_enum * penum, register cached_char * cc)
top:code = gx_path_current_point_inline(pgs, &pt);
if (code < 0)
- return code;
+ return code;
/*
* If the character doesn't lie entirely within the inner
* clipping rectangle, we set up an intermediate clipping device.
@@ -288,84 +288,84 @@ gx_image_cached_char(register gs_show_enum * penum, register cached_char * cc)
h = cc->height;
#ifdef DEBUG
if (gs_debug_c('K')) {
- if (cc_has_bits(cc))
- debug_dump_bitmap(cc_bits(cc), cc_raster(cc), h,
- "[K]bits");
- else
- dputs("[K]no bits\n");
- dlprintf3("[K]copying 0x%lx, offset=(%g,%g)\n", (ulong) cc,
- fixed2float(-cc->offset.x),
- fixed2float(-cc->offset.y));
- dlprintf6(" at (%g,%g)+(%d,%d)->(%d,%d)\n",
- fixed2float(pt.x), fixed2float(pt.y),
- penum->ftx, penum->fty, x, y);
+ if (cc_has_bits(cc))
+ debug_dump_bitmap(cc_bits(cc), cc_raster(cc), h,
+ "[K]bits");
+ else
+ dputs("[K]no bits\n");
+ dlprintf3("[K]copying 0x%lx, offset=(%g,%g)\n", (ulong) cc,
+ fixed2float(-cc->offset.x),
+ fixed2float(-cc->offset.y));
+ dlprintf6(" at (%g,%g)+(%d,%d)->(%d,%d)\n",
+ fixed2float(pt.x), fixed2float(pt.y),
+ penum->ftx, penum->fty, x, y);
}
#endif
if ((x < penum->ibox.p.x || x + w > penum->ibox.q.x ||
- y < penum->ibox.p.y || y + h > penum->ibox.q.y) &&
- imaging_dev != (gx_device *) & cdev /* might be 2nd time around */
- ) { /* Check for the character falling entirely outside */
- /* the clipping region. */
- gx_clip_path *pcpath;
+ y < penum->ibox.p.y || y + h > penum->ibox.q.y) &&
+ imaging_dev != (gx_device *) & cdev /* might be 2nd time around */
+ ) { /* Check for the character falling entirely outside */
+ /* the clipping region. */
+ gx_clip_path *pcpath;
- if (x >= penum->obox.q.x || x + w <= penum->obox.p.x ||
- y >= penum->obox.q.y || y + h <= penum->obox.p.y
- )
- return 0; /* nothing to do */
- code = gx_effective_clip_path(pgs, &pcpath);
- if (code < 0)
- return code;
- gx_make_clip_device_on_stack(&cdev, pcpath, imaging_dev);
- imaging_dev = (gx_device *) & cdev;
- if_debug0('K', "[K](clipping)\n");
+ if (x >= penum->obox.q.x || x + w <= penum->obox.p.x ||
+ y >= penum->obox.q.y || y + h <= penum->obox.p.y
+ )
+ return 0; /* nothing to do */
+ code = gx_effective_clip_path(pgs, &pcpath);
+ if (code < 0)
+ return code;
+ gx_make_clip_device_on_stack(&cdev, pcpath, imaging_dev);
+ imaging_dev = (gx_device *) & cdev;
+ if_debug0('K', "[K](clipping)\n");
}
gx_set_dev_color(pgs);
/* If an xfont can render this character, use it. */
if (xg != gx_no_xglyph && (xf = cc_pair(cc)->xfont) != 0) {
- int cx = x + fixed2int(cc->offset.x);
- int cy = y + fixed2int(cc->offset.y);
+ int cx = x + fixed2int(cc->offset.x);
+ int cy = y + fixed2int(cc->offset.y);
- /*
- * Note that we prefer a 1-bit xfont implementation over
- * a multi-bit cached bitmap. Eventually we should change
- * the xfont interface so it can deliver multi-bit bitmaps,
- * or else implement oversampling for xfonts.
- */
- if (gs_color_writes_pure(pgs)) {
- code = (*xf->common.procs->render_char) (xf, xg,
- imaging_dev, cx, cy,
- pdevc->colors.pure, 0);
- if_debug8('K', "[K]render_char display: xfont=0x%lx, glyph=0x%lx\n\tdev=0x%lx(%s) x,y=%d,%d, color=0x%lx => %d\n",
- (ulong) xf, (ulong) xg, (ulong) imaging_dev,
- imaging_dev->dname, cx, cy,
- (ulong) pdevc->colors.pure, code);
- if (code == 0)
- return_check_interrupt(penum->memory, 0);
- }
- /* Can't render directly. If we don't have a bitmap yet, */
- /* get it from the xfont now. */
- if (!cc_has_bits(cc)) {
- gx_device_memory mdev;
+ /*
+ * Note that we prefer a 1-bit xfont implementation over
+ * a multi-bit cached bitmap. Eventually we should change
+ * the xfont interface so it can deliver multi-bit bitmaps,
+ * or else implement oversampling for xfonts.
+ */
+ if (gs_color_writes_pure(pgs)) {
+ code = (*xf->common.procs->render_char) (xf, xg,
+ imaging_dev, cx, cy,
+ pdevc->colors.pure, 0);
+ if_debug8('K', "[K]render_char display: xfont=0x%lx, glyph=0x%lx\n\tdev=0x%lx(%s) x,y=%d,%d, color=0x%lx => %d\n",
+ (ulong) xf, (ulong) xg, (ulong) imaging_dev,
+ imaging_dev->dname, cx, cy,
+ (ulong) pdevc->colors.pure, code);
+ if (code == 0)
+ return_check_interrupt(penum->memory, 0);
+ }
+ /* Can't render directly. If we don't have a bitmap yet, */
+ /* get it from the xfont now. */
+ if (!cc_has_bits(cc)) {
+ gx_device_memory mdev;
- gs_make_mem_mono_device(&mdev, dev->memory, imaging_dev);
- gx_open_cache_device(&mdev, cc);
- code = (*xf->common.procs->render_char) (xf, xg,
- (gx_device *) & mdev, cx - x, cy - y,
- (gx_color_index) 1, 1);
- if_debug7('K', "[K]render_char to bits: xfont=0x%lx, glyph=0x%lx\n\tdev=0x%lx(%s) x,y=%d,%d => %d\n",
- (ulong) xf, (ulong) xg, (ulong) & mdev,
- mdev.dname, cx - x, cy - y, code);
- if (code != 0)
- return_check_interrupt(penum->memory, 1);
- gx_add_char_bits(cc_pair(cc)->font->dir,
- cc, &scale_log2_1);
- /* gx_add_char_bits may change width, height, */
- /* raster, and/or offset. It's easiest to */
- /* start over from the top. Clear xg so that */
- /* we don't waste time trying render_char again. */
- xg = gx_no_xglyph;
- goto top;
- }
+ gs_make_mem_mono_device(&mdev, dev->memory, imaging_dev);
+ gx_open_cache_device(&mdev, cc);
+ code = (*xf->common.procs->render_char) (xf, xg,
+ (gx_device *) & mdev, cx - x, cy - y,
+ (gx_color_index) 1, 1);
+ if_debug7('K', "[K]render_char to bits: xfont=0x%lx, glyph=0x%lx\n\tdev=0x%lx(%s) x,y=%d,%d => %d\n",
+ (ulong) xf, (ulong) xg, (ulong) & mdev,
+ mdev.dname, cx - x, cy - y, code);
+ if (code != 0)
+ return_check_interrupt(penum->memory, 1);
+ gx_add_char_bits(cc_pair(cc)->font->dir,
+ cc, &scale_log2_1);
+ /* gx_add_char_bits may change width, height, */
+ /* raster, and/or offset. It's easiest to */
+ /* start over from the top. Clear xg so that */
+ /* we don't waste time trying render_char again. */
+ xg = gx_no_xglyph;
+ goto top;
+ }
}
/*
* No xfont. Render from the cached bits. If the cached bits
@@ -374,98 +374,98 @@ gx_image_cached_char(register gs_show_enum * penum, register cached_char * cc)
* by taking the high-order alpha bit.
*/
bits = cc_bits(cc);
- /* With 4x2 scale, depth == 3.
+ /* With 4x2 scale, depth == 3.
* An example is -dTextAlphaBits=4 comparefiles/fonttest.pdf .
* We need to map 4 bitmap bits to 2 alpha bits.
*/
depth = (cc_depth(cc) == 3 ? 2 : cc_depth(cc));
if (dev_proc(orig_dev, fill_mask) != gx_default_fill_mask ||
- !lop_no_S_is_T(pgs->log_op)
- ) {
- gx_clip_path *pcpath;
+ !lop_no_S_is_T(pgs->log_op)
+ ) {
+ gx_clip_path *pcpath;
- if (penum) {
- penum->use_wxy_float = false;
- penum->wxy_float.x = penum->wxy_float.y = 0.0;
- penum->wxy = cc->wxy;
- }
+ if (penum) {
+ penum->use_wxy_float = false;
+ penum->wxy_float.x = penum->wxy_float.y = 0.0;
+ penum->wxy = cc->wxy;
+ }
- code = gx_effective_clip_path(pgs, &pcpath);
- if (code >= 0) {
- code = gx_image_fill_masked
- (orig_dev, bits, 0, cc_raster(cc), cc->id,
- x, y, w, h, pdevc, depth, pgs->log_op, pcpath);
- if (code >= 0)
- goto done;
- }
+ code = gx_effective_clip_path(pgs, &pcpath);
+ if (code >= 0) {
+ code = gx_image_fill_masked
+ (orig_dev, bits, 0, cc_raster(cc), cc->id,
+ x, y, w, h, pdevc, depth, pgs->log_op, pcpath);
+ if (code >= 0)
+ goto done;
+ }
} else if (gs_color_writes_pure(pgs)) {
- gx_color_index color = pdevc->colors.pure;
+ gx_color_index color = pdevc->colors.pure;
- if (depth > 1) {
- code = (*dev_proc(imaging_dev, copy_alpha))
- (imaging_dev, bits, 0, cc_raster(cc), cc->id,
- x, y, w, h, color, depth);
- if (code >= 0)
- return_check_interrupt(penum->memory, 0);
- /* copy_alpha failed, construct a monobit mask. */
- bits = compress_alpha_bits(cc, penum->memory->non_gc_memory);
- if (bits == 0)
- return 1; /* VMerror, but recoverable */
- }
- code = (*dev_proc(imaging_dev, copy_mono))
- (imaging_dev, bits, 0, bitmap_raster(w), gs_no_id,
- x, y, w, h, gx_no_color_index, color);
- goto done;
+ if (depth > 1) {
+ code = (*dev_proc(imaging_dev, copy_alpha))
+ (imaging_dev, bits, 0, cc_raster(cc), cc->id,
+ x, y, w, h, color, depth);
+ if (code >= 0)
+ return_check_interrupt(penum->memory, 0);
+ /* copy_alpha failed, construct a monobit mask. */
+ bits = compress_alpha_bits(cc, penum->memory->non_gc_memory);
+ if (bits == 0)
+ return 1; /* VMerror, but recoverable */
+ }
+ code = (*dev_proc(imaging_dev, copy_mono))
+ (imaging_dev, bits, 0, bitmap_raster(w), gs_no_id,
+ x, y, w, h, gx_no_color_index, color);
+ goto done;
}
if (depth > 1) { /* Complex color or fill_mask / copy_alpha failed, */
- /* construct a monobit mask. */
- bits = compress_alpha_bits(cc, penum->memory->non_gc_memory);
- if (bits == 0)
- return 1; /* VMerror, but recoverable */
+ /* construct a monobit mask. */
+ bits = compress_alpha_bits(cc, penum->memory->non_gc_memory);
+ if (bits == 0)
+ return 1; /* VMerror, but recoverable */
} { /* Use imagemask to render the character. */
- gs_memory_t *mem = penum->memory->non_gc_memory;
- gs_image_enum *pie =
- gs_image_enum_alloc(mem, "image_char(image_enum)");
- gs_image_t image;
- int iy;
- uint used, raster = (bits == cc_bits(cc) ? cc_raster(cc)
- : bitmap_raster(cc->width) );
- int code1;
+ gs_memory_t *mem = penum->memory->non_gc_memory;
+ gs_image_enum *pie =
+ gs_image_enum_alloc(mem, "image_char(image_enum)");
+ gs_image_t image;
+ int iy;
+ uint used, raster = (bits == cc_bits(cc) ? cc_raster(cc)
+ : bitmap_raster(cc->width) );
+ int code1;
- if (pie == 0) {
- if (bits != cc_bits(cc))
- gs_free_object(mem, bits,
- "compress_alpha_bits");
- return 1; /* VMerror, but recoverable */
- }
- /* Make a matrix that will place the image */
- /* at (x,y) with no transformation. */
- gs_image_t_init_mask(&image, true);
- gs_make_translation((floatp) - x, (floatp) - y, &image.ImageMatrix);
- gs_matrix_multiply(&ctm_only(pgs), &image.ImageMatrix, &image.ImageMatrix);
- image.Width = w;
- image.Height = h;
- image.adjust = false;
- code = gs_image_init(pie, &image, false, pgs);
- switch (code) {
- case 1: /* empty image */
- code = 0;
- default:
- break;
- case 0:
- for (iy = 0; iy < h && code >= 0; iy++)
- code = gs_image_next(pie, bits + iy * raster,
- (w + 7) >> 3, &used);
- }
- code1 = gs_image_cleanup_and_free_enum(pie, pgs);
- if (code >= 0 && code1 < 0)
- code = code1;
+ if (pie == 0) {
+ if (bits != cc_bits(cc))
+ gs_free_object(mem, bits,
+ "compress_alpha_bits");
+ return 1; /* VMerror, but recoverable */
+ }
+ /* Make a matrix that will place the image */
+ /* at (x,y) with no transformation. */
+ gs_image_t_init_mask(&image, true);
+ gs_make_translation((floatp) - x, (floatp) - y, &image.ImageMatrix);
+ gs_matrix_multiply(&ctm_only(pgs), &image.ImageMatrix, &image.ImageMatrix);
+ image.Width = w;
+ image.Height = h;
+ image.adjust = false;
+ code = gs_image_init(pie, &image, false, pgs);
+ switch (code) {
+ case 1: /* empty image */
+ code = 0;
+ default:
+ break;
+ case 0:
+ for (iy = 0; iy < h && code >= 0; iy++)
+ code = gs_image_next(pie, bits + iy * raster,
+ (w + 7) >> 3, &used);
+ }
+ code1 = gs_image_cleanup_and_free_enum(pie, pgs);
+ if (code >= 0 && code1 < 0)
+ code = code1;
}
done:if (bits != cc_bits(cc))
- gs_free_object(penum->memory->non_gc_memory, bits, "compress_alpha_bits");
+ gs_free_object(penum->memory->non_gc_memory, bits, "compress_alpha_bits");
if (code > 0)
- code = 0;
+ code = 0;
return_check_interrupt(penum->memory, code);
}
@@ -481,7 +481,7 @@ compress_alpha_bits(const cached_char * cc, gs_memory_t * mem)
const byte *data = cc_const_bits(cc);
uint width = cc->width;
uint height = cc->height;
- /* With 4x2 scale, depth == 3.
+ /* With 4x2 scale, depth == 3.
* An example is -dTextAlphaBits=4 comparefiles/fonttest.pdf .
* We need to map 4 bitmap bits to 2 alpha bits.
*/
@@ -491,36 +491,36 @@ compress_alpha_bits(const cached_char * cc, gs_memory_t * mem)
uint draster = bitmap_raster(width);
uint dskip = draster - ((width + 7) >> 3);
byte *mask = gs_alloc_bytes(mem, draster * height,
- "compress_alpha_bits");
+ "compress_alpha_bits");
const byte *sptr = data;
byte *dptr = mask;
uint h;
if (mask == 0)
- return 0;
+ return 0;
for (h = height; h; --h) {
- byte sbit = 0x80;
- byte d = 0;
- byte dbit = 0x80;
- uint w;
+ byte sbit = 0x80;
+ byte d = 0;
+ byte dbit = 0x80;
+ uint w;
- for (w = width; w; --w) {
- if (*sptr & sbit)
- d += dbit;
- if (!(sbit >>= depth))
- sbit = 0x80, sptr++;
- if (!(dbit >>= 1)) {
- *dptr++ = d;
- dbit = 0x80, d = 0;
- }
- }
- if (dbit != 0x80)
- *dptr++ = d;
- for (w = dskip; w != 0; --w)
- *dptr++ = 0;
- if (sbit != 0x80)
- ++sptr;
- sptr += sskip;
+ for (w = width; w; --w) {
+ if (*sptr & sbit)
+ d += dbit;
+ if (!(sbit >>= depth))
+ sbit = 0x80, sptr++;
+ if (!(dbit >>= 1)) {
+ *dptr++ = d;
+ dbit = 0x80, d = 0;
+ }
+ }
+ if (dbit != 0x80)
+ *dptr++ = d;
+ for (w = dskip; w != 0; --w)
+ *dptr++ = 0;
+ if (sbit != 0x80)
+ ++sptr;
+ sptr += sskip;
}
return mask;
}
diff --git a/gs/base/gxccman.c b/gs/base/gxccman.c
index 014c892e3..34cfecbc1 100644
--- a/gs/base/gxccman.c
+++ b/gs/base/gxccman.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,7 +47,7 @@ gs_private_st_simple(st_font_cache_bytes, byte, "font cache bytes");
/* GC procedures */
/* We do all the work in font_dir_enum/reloc_ptrs in gsfont.c. */
/* See gxfcache.h for details. */
-static
+static
ENUM_PTRS_BEGIN(cc_ptr_enum_ptrs) return 0;
ENUM_PTRS_END
@@ -68,7 +68,7 @@ static void shorten_cached_char(gs_font_dir *, cached_char *, uint);
/* Allocate and initialize the character cache elements of a font directory. */
int
gx_char_cache_alloc(gs_memory_t * struct_mem, gs_memory_t * bits_mem,
- gs_font_dir * pdir, uint bmax, uint mmax, uint cmax, uint upper)
+ gs_font_dir * pdir, uint bmax, uint mmax, uint cmax, uint upper)
{ /* Since we use open hashing, we must increase cmax somewhat. */
uint chsize = (cmax + (cmax >> 1)) | 31;
cached_fm_pair *mdata;
@@ -76,18 +76,18 @@ gx_char_cache_alloc(gs_memory_t * struct_mem, gs_memory_t * bits_mem,
/* Round up chsize to a power of 2. */
while (chsize & (chsize + 1))
- chsize |= chsize >> 1;
+ chsize |= chsize >> 1;
chsize++;
mdata = gs_alloc_struct_array(struct_mem, mmax, cached_fm_pair,
- &st_cached_fm_pair_element,
- "font_dir_alloc(mdata)");
+ &st_cached_fm_pair_element,
+ "font_dir_alloc(mdata)");
chars = gs_alloc_struct_array(struct_mem, chsize, cached_char *,
- &st_cached_char_ptr_element,
- "font_dir_alloc(chars)");
+ &st_cached_char_ptr_element,
+ "font_dir_alloc(chars)");
if (mdata == 0 || chars == 0) {
- gs_free_object(struct_mem, chars, "font_dir_alloc(chars)");
- gs_free_object(struct_mem, mdata, "font_dir_alloc(mdata)");
- return_error(gs_error_VMerror);
+ gs_free_object(struct_mem, chars, "font_dir_alloc(chars)");
+ gs_free_object(struct_mem, mdata, "font_dir_alloc(mdata)");
+ return_error(gs_error_VMerror);
}
pdir->fmcache.mmax = mmax;
pdir->fmcache.mdata = mdata;
@@ -111,8 +111,8 @@ gx_char_cache_init(register gs_font_dir * dir)
cached_fm_pair *pair;
char_cache_chunk *cck = (char_cache_chunk *)
gs_alloc_bytes_immovable(dir->ccache.bits_memory,
- sizeof(char_cache_chunk),
- "initial_chunk");
+ sizeof(char_cache_chunk),
+ "initial_chunk");
dir->fmcache.msize = 0;
dir->fmcache.used = dir->fmcache.mmax;
@@ -122,13 +122,13 @@ gx_char_cache_init(register gs_font_dir * dir)
gx_bits_cache_init((gx_bits_cache *) & dir->ccache, cck);
dir->ccache.bspace = 0;
memset((char *)dir->ccache.table, 0,
- (dir->ccache.table_mask + 1) * sizeof(cached_char *));
+ (dir->ccache.table_mask + 1) * sizeof(cached_char *));
for (i = 0, pair = dir->fmcache.mdata;
- i < dir->fmcache.mmax; i++, pair++) {
- pair->index = i;
- fm_pair_init(pair);
- pair->ttf = 0;
- pair->ttr = 0;
+ i < dir->fmcache.mmax; i++, pair++) {
+ pair->index = i;
+ fm_pair_init(pair);
+ pair->ttf = 0;
+ pair->ttr = 0;
}
}
@@ -138,25 +138,25 @@ gx_char_cache_init(register gs_font_dir * dir)
/* a client-supplied procedure. */
void
gx_purge_selected_cached_chars(gs_font_dir * dir,
- bool(*proc) (const gs_memory_t *mem,
- cached_char *, void *),
- void *proc_data)
+ bool(*proc) (const gs_memory_t *mem,
+ cached_char *, void *),
+ void *proc_data)
{
int chi;
int cmax = dir->ccache.table_mask;
for (chi = 0; chi <= cmax;) {
- cached_char *cc = dir->ccache.table[chi];
+ cached_char *cc = dir->ccache.table[chi];
- if (cc != 0 &&
+ if (cc != 0 &&
#ifdef GSLITE
- !cc->dont_evict &&
+ !cc->dont_evict &&
#endif
- (*proc) (dir->memory, cc, proc_data)) {
- hash_remove_cached_char(dir, chi);
- gx_free_cached_char(dir, cc);
- } else
- chi++;
+ (*proc) (dir->memory, cc, proc_data)) {
+ hash_remove_cached_char(dir, chi);
+ gx_free_cached_char(dir, cc);
+ } else
+ chi++;
}
}
@@ -166,24 +166,24 @@ static int
fm_pair_remove_from_list(gs_font_dir * dir, cached_fm_pair *pair, uint *head)
{
if (dir->fmcache.mdata + pair->index != pair)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pair->next == pair->index) {
- /* The list consists of single element. */
- if (pair->prev != pair->index)
- return_error(gs_error_unregistered); /* Must not happen. */
- *head = dir->fmcache.mmax;
+ /* The list consists of single element. */
+ if (pair->prev != pair->index)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ *head = dir->fmcache.mmax;
} else {
- cached_fm_pair *next = dir->fmcache.mdata + pair->next;
- cached_fm_pair *prev = dir->fmcache.mdata + pair->prev;
-
- if (next->prev != pair->index)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (prev->next != pair->index)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (*head == pair->index)
- *head = next->index;
- next->prev = prev->index;
- prev->next = next->index;
+ cached_fm_pair *next = dir->fmcache.mdata + pair->next;
+ cached_fm_pair *prev = dir->fmcache.mdata + pair->prev;
+
+ if (next->prev != pair->index)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (prev->next != pair->index)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (*head == pair->index)
+ *head = next->index;
+ next->prev = prev->index;
+ prev->next = next->index;
}
return 0;
}
@@ -192,32 +192,32 @@ static int
fm_pair_insert_into_list(gs_font_dir * dir, cached_fm_pair *pair, uint *head)
{
if (dir->fmcache.mdata + pair->index != pair)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (*head >= dir->fmcache.mmax) {
- *head = pair->next = pair->prev = pair->index;
+ *head = pair->next = pair->prev = pair->index;
} else {
- cached_fm_pair *first = dir->fmcache.mdata + *head;
- cached_fm_pair *last = dir->fmcache.mdata + first->prev;
-
- if (first->prev != last->index)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (last->next != first->index)
- return_error(gs_error_unregistered); /* Must not happen. */
- pair->next = first->index;
- pair->prev = last->index;
- first->prev = last->next = pair->index;
- *head = pair->index;
+ cached_fm_pair *first = dir->fmcache.mdata + *head;
+ cached_fm_pair *last = dir->fmcache.mdata + first->prev;
+
+ if (first->prev != last->index)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (last->next != first->index)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ pair->next = first->index;
+ pair->prev = last->index;
+ first->prev = last->next = pair->index;
+ *head = pair->index;
}
return 0;
}
/* ====== Font-level routines ====== */
-static int
+static int
gx_attach_tt_interpreter(gs_font_dir * dir,
- gs_font_type42 *font, cached_fm_pair *pair,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid)
+ gs_font_type42 *font, cached_fm_pair *pair,
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid)
{
float cxx, cxy, cyx, cyy;
gs_matrix m;
@@ -232,14 +232,14 @@ gx_attach_tt_interpreter(gs_font_dir * dir,
m.tx = m.ty = 0;
pair->ttr = gx_ttfReader__create(dir->memory->stable_memory);
if (!pair->ttr)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* We could use a single the reader instance for all fonts ... */
pair->ttf = ttfFont__create(dir);
if (!pair->ttf)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_ttfReader__set_font(pair->ttr, (gs_font_type42 *)font);
- code = ttfFont__Open_aux(pair->ttf, dir->tti, pair->ttr,
- (gs_font_type42 *)font, &m, log2_scale, design_grid);
+ code = ttfFont__Open_aux(pair->ttf, dir->tti, pair->ttr,
+ (gs_font_type42 *)font, &m, log2_scale, design_grid);
gx_ttfReader__set_font(pair->ttr, NULL);
return code;
}
@@ -248,25 +248,25 @@ static inline bool
does_font_need_tt_interpreter(gs_font *font)
{
if (font->FontType == ft_TrueType || font->FontType == ft_CID_TrueType) {
- gs_font_type42 *pfont = (gs_font_type42 *)font;
+ gs_font_type42 *pfont = (gs_font_type42 *)font;
- if (pfont->FAPI==NULL)
- return true;
+ if (pfont->FAPI==NULL)
+ return true;
}
return false;
}
-int
+int
gx_provide_fm_pair_attributes(gs_font_dir * dir,
- gs_font *font, cached_fm_pair *pair,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid)
+ gs_font *font, cached_fm_pair *pair,
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid)
{
if (does_font_need_tt_interpreter(font)) {
- if (pair->ttf != NULL)
- return 0; /* Already attached. */
- return gx_attach_tt_interpreter(dir, (gs_font_type42 *)font, pair,
- char_tm, log2_scale, design_grid);
+ if (pair->ttf != NULL)
+ return 0; /* Already attached. */
+ return gx_attach_tt_interpreter(dir, (gs_font_type42 *)font, pair,
+ char_tm, log2_scale, design_grid);
}
return 0;
}
@@ -275,62 +275,62 @@ gx_provide_fm_pair_attributes(gs_font_dir * dir,
/* (This is only exported for gxccache.c.) */
int
gx_add_fm_pair(register gs_font_dir * dir, gs_font * font, const gs_uid * puid,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid, cached_fm_pair **ppair)
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid, cached_fm_pair **ppair)
{
float mxx, mxy, myx, myy;
register cached_fm_pair *pair;
- int code;
+ int code;
gx_compute_ccache_key(font, char_tm, log2_scale, design_grid,
- &mxx, &mxy, &myx, &myy);
- if (dir->fmcache.msize == dir->fmcache.mmax) {
- /* cache is full, drop the older entry. */
- /* gx_touch_fm_pair must be called whenever
- a pair is used to move it to the top of the list.
- Since we drop a pair from the list bottom,
- and since the list is long enough,
- with a high probability it won't drop a pair,
- which currently is pointed by an active text enumerator.
-
- Note that with Type 3 fonts multiple text enumerators
- may be active (exist on estack) in same time,
- therefore the list length sets a constraint for
- the number of font-matrix pairs used within a charproc.
- If it uses too many ones, the outer text enumerator
- will fail with 'invalidfont' in gx_add_cached_char.
- */
- pair = dir->fmcache.mdata + dir->fmcache.used;
- pair = dir->fmcache.mdata + pair->prev; /* last touched. */
- code = gs_purge_fm_pair(dir, pair, 0);
- if (code < 0)
- return code;
+ &mxx, &mxy, &myx, &myy);
+ if (dir->fmcache.msize == dir->fmcache.mmax) {
+ /* cache is full, drop the older entry. */
+ /* gx_touch_fm_pair must be called whenever
+ a pair is used to move it to the top of the list.
+ Since we drop a pair from the list bottom,
+ and since the list is long enough,
+ with a high probability it won't drop a pair,
+ which currently is pointed by an active text enumerator.
+
+ Note that with Type 3 fonts multiple text enumerators
+ may be active (exist on estack) in same time,
+ therefore the list length sets a constraint for
+ the number of font-matrix pairs used within a charproc.
+ If it uses too many ones, the outer text enumerator
+ will fail with 'invalidfont' in gx_add_cached_char.
+ */
+ pair = dir->fmcache.mdata + dir->fmcache.used;
+ pair = dir->fmcache.mdata + pair->prev; /* last touched. */
+ code = gs_purge_fm_pair(dir, pair, 0);
+ if (code < 0)
+ return code;
}
if (dir->fmcache.free < dir->fmcache.mmax) {
- /* use a free entry. */
- pair = dir->fmcache.mdata + dir->fmcache.free;
- code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.free);
- if (code < 0)
- return code;
+ /* use a free entry. */
+ pair = dir->fmcache.mdata + dir->fmcache.free;
+ code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.free);
+ if (code < 0)
+ return code;
} else {
- /* reserve a new entry. */
- pair = dir->fmcache.mdata + dir->fmcache.unused;
- dir->fmcache.unused++;
+ /* reserve a new entry. */
+ pair = dir->fmcache.mdata + dir->fmcache.unused;
+ dir->fmcache.unused++;
}
- font->is_cached = true; /* Set this early to ensure
- gs_purge_font_from_char_caches works for it in case of errors. */
+ font->is_cached = true; /* Set this early to ensure
+ gs_purge_font_from_char_caches works for it in case of errors. */
dir->fmcache.msize++;
code = fm_pair_insert_into_list(dir, pair, &dir->fmcache.used);
if (code < 0)
- return code;
+ return code;
pair->font = font;
pair->UID = *puid;
/* Copy UID into a stable memory,
so that 'restore' may keep this pair. */
code = uid_copy(&pair->UID, dir->memory->stable_memory, "gx_add_fm_pair");
if (code < 0) {
- uid_set_invalid(&pair->UID);
- return code;
+ uid_set_invalid(&pair->UID);
+ return code;
}
pair->FontType = font->FontType;
pair->hash = (uint) (dir->hash % 549); /* scramble bits */
@@ -344,16 +344,16 @@ gx_add_fm_pair(register gs_font_dir * dir, gs_font * font, const gs_uid * puid,
pair->ttr = 0;
pair->design_grid = false;
if (does_font_need_tt_interpreter(font)) {
- code = gx_attach_tt_interpreter(dir, (gs_font_type42 *)font, pair,
- char_tm, log2_scale, design_grid);
- if (code < 0)
- return code;
- }
+ code = gx_attach_tt_interpreter(dir, (gs_font_type42 *)font, pair,
+ char_tm, log2_scale, design_grid);
+ if (code < 0)
+ return code;
+ }
pair->memory = 0;
if_debug8('k', "[k]adding pair 0x%lx: font=0x%lx [%g %g %g %g] UID %ld, 0x%lx\n",
- (ulong) pair, (ulong) font,
- pair->mxx, pair->mxy, pair->myx, pair->myy,
- (long)pair->UID.id, (ulong) pair->UID.xvalues);
+ (ulong) pair, (ulong) font,
+ pair->mxx, pair->mxy, pair->myx, pair->myy,
+ (long)pair->UID.id, (ulong) pair->UID.xvalues);
*ppair = pair;
return 0;
}
@@ -363,12 +363,12 @@ int
gx_touch_fm_pair(gs_font_dir *dir, cached_fm_pair *pair)
{
if (pair->index != dir->fmcache.used) {
- int code;
+ int code;
- code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.used);
- if (code < 0)
- return code;
- return fm_pair_insert_into_list(dir, pair, &dir->fmcache.used);
+ code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.used);
+ if (code < 0)
+ return code;
+ return fm_pair_insert_into_list(dir, pair, &dir->fmcache.used);
}
return 0;
}
@@ -383,62 +383,62 @@ gx_lookup_xfont(const gs_state * pgs, cached_fm_pair * pair, int encoding_index)
gs_font *font = pair->font;
const gx_xfont_procs *procs = (*dev_proc(fdev, get_xfont_procs)) (fdev);
gx_xfont *xf = 0;
-
+
/* We mustn't attempt to use xfonts for stroked characters, */
/* because such characters go outside their bounding box. */
if (procs != 0 && font->PaintType == 0) {
- gs_matrix mat;
-
- mat.xx = pair->mxx, mat.xy = pair->mxy;
- mat.yx = pair->myx, mat.yy = pair->myy;
- mat.tx = 0, mat.ty = 0;
- /* xfonts can outlive their invocations, */
- /* but restore purges them properly. */
- pair->memory = pgs->memory;
- if (font->key_name.size != 0)
- xf = lookup_xfont_by_name(fdev, procs,
- &font->key_name, encoding_index,
- pair, &mat);
+ gs_matrix mat;
+
+ mat.xx = pair->mxx, mat.xy = pair->mxy;
+ mat.yx = pair->myx, mat.yy = pair->myy;
+ mat.tx = 0, mat.ty = 0;
+ /* xfonts can outlive their invocations, */
+ /* but restore purges them properly. */
+ pair->memory = pgs->memory;
+ if (font->key_name.size != 0)
+ xf = lookup_xfont_by_name(fdev, procs,
+ &font->key_name, encoding_index,
+ pair, &mat);
#define font_name_eq(pfn1,pfn2)\
((pfn1)->size == (pfn2)->size && (pfn1)->size != 0 &&\
!memcmp((char *)(pfn1)->chars, (char *)(pfn2)->chars, (pfn1)->size))
- if (xf == 0 && font->font_name.size != 0 &&
- /* Avoid redundant lookup */
- !font_name_eq(&font->font_name, &font->key_name)
- )
- xf = lookup_xfont_by_name(fdev, procs,
- &font->font_name, encoding_index,
- pair, &mat);
- if (xf == 0 && font->FontType != ft_composite &&
- uid_is_valid(&((gs_font_base *) font)->UID)
- ) { /* Look for an original font with the same UID. */
- gs_font_dir *pdir = font->dir;
- gs_font *pfont;
-
- for (pfont = pdir->orig_fonts; pfont != 0;
- pfont = pfont->next
- ) {
- if (pfont->FontType != ft_composite &&
- uid_equal(&((gs_font_base *) pfont)->UID,
- &((gs_font_base *) font)->UID) &&
- pfont->key_name.size != 0 &&
- !font_name_eq(&font->key_name,
- &pfont->key_name)
- ) {
- xf = lookup_xfont_by_name(fdev, procs,
- &pfont->key_name,
- encoding_index, pair, &mat);
- if (xf != 0)
- break;
- }
- }
- }
+ if (xf == 0 && font->font_name.size != 0 &&
+ /* Avoid redundant lookup */
+ !font_name_eq(&font->font_name, &font->key_name)
+ )
+ xf = lookup_xfont_by_name(fdev, procs,
+ &font->font_name, encoding_index,
+ pair, &mat);
+ if (xf == 0 && font->FontType != ft_composite &&
+ uid_is_valid(&((gs_font_base *) font)->UID)
+ ) { /* Look for an original font with the same UID. */
+ gs_font_dir *pdir = font->dir;
+ gs_font *pfont;
+
+ for (pfont = pdir->orig_fonts; pfont != 0;
+ pfont = pfont->next
+ ) {
+ if (pfont->FontType != ft_composite &&
+ uid_equal(&((gs_font_base *) pfont)->UID,
+ &((gs_font_base *) font)->UID) &&
+ pfont->key_name.size != 0 &&
+ !font_name_eq(&font->key_name,
+ &pfont->key_name)
+ ) {
+ xf = lookup_xfont_by_name(fdev, procs,
+ &pfont->key_name,
+ encoding_index, pair, &mat);
+ if (xf != 0)
+ break;
+ }
+ }
+ }
}
-
+
if (xf) {
emprintf(pgs->memory, "Warning: the Xfonts feature is deprecated and will be removed in a future release.\n");
}
-
+
pair->xfont = xf;
}
@@ -463,10 +463,10 @@ static inline void
gs_clean_fm_pair_attributes(gs_font_dir * dir, cached_fm_pair * pair)
{
if (pair->ttr)
- gx_ttfReader__destroy(pair->ttr);
+ gx_ttfReader__destroy(pair->ttr);
pair->ttr = 0;
if (pair->ttf)
- ttfFont__destroy(pair->ttf, dir);
+ ttfFont__destroy(pair->ttf, dir);
pair->ttf = 0;
}
@@ -482,40 +482,40 @@ int
gs_purge_fm_pair(gs_font_dir * dir, cached_fm_pair * pair, int xfont_only)
{
if_debug2('k', "[k]purging pair 0x%lx%s\n",
- (ulong) pair, (xfont_only ? " (xfont only)" : ""));
+ (ulong) pair, (xfont_only ? " (xfont only)" : ""));
if (pair->xfont != 0) {
- (*pair->xfont->common.procs->release) (pair->xfont,
- pair->memory);
- pair->xfont_tried = false;
- pair->xfont = 0;
+ (*pair->xfont->common.procs->release) (pair->xfont,
+ pair->memory);
+ pair->xfont_tried = false;
+ pair->xfont = 0;
}
gx_purge_selected_cached_chars(dir,
- (xfont_only ? purge_fm_pair_char_xfont :
- purge_fm_pair_char),
- pair);
+ (xfont_only ? purge_fm_pair_char_xfont :
+ purge_fm_pair_char),
+ pair);
gs_clean_fm_pair_attributes(dir, pair);
if (!xfont_only) {
- int code;
+ int code;
#ifdef DEBUG
- if (pair->num_chars != 0) {
- lprintf1("Error in gs_purge_fm_pair: num_chars =%d\n",
- pair->num_chars);
- }
+ if (pair->num_chars != 0) {
+ lprintf1("Error in gs_purge_fm_pair: num_chars =%d\n",
+ pair->num_chars);
+ }
#endif
- { /* Free xvalues here because gx_add_fm_pair copied
- them into the stable memory dir->memory. */
- gs_free_object(dir->memory->stable_memory, pair->UID.xvalues, "gs_purge_fm_pair");
- pair->UID.xvalues = 0;
- }
- fm_pair_set_free(pair);
- code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.used);
- if (code < 0)
- return code;
- code = fm_pair_insert_into_list(dir, pair, &dir->fmcache.free);
- if (code < 0)
- return code;
- dir->fmcache.msize--;
+ { /* Free xvalues here because gx_add_fm_pair copied
+ them into the stable memory dir->memory. */
+ gs_free_object(dir->memory->stable_memory, pair->UID.xvalues, "gs_purge_fm_pair");
+ pair->UID.xvalues = 0;
+ }
+ fm_pair_set_free(pair);
+ code = fm_pair_remove_from_list(dir, pair, &dir->fmcache.used);
+ if (code < 0)
+ return code;
+ code = fm_pair_insert_into_list(dir, pair, &dir->fmcache.free);
+ if (code < 0)
+ return code;
+ dir->fmcache.msize--;
}
return 0;
}
@@ -526,16 +526,16 @@ gs_purge_fm_pair(gs_font_dir * dir, cached_fm_pair * pair, int xfont_only)
static gx_xfont *
lookup_xfont_by_name(gx_device * fdev, const gx_xfont_procs * procs,
gs_font_name * pfstr, int encoding_index, const cached_fm_pair * pair,
- const gs_matrix * pmat)
+ const gs_matrix * pmat)
{
gx_xfont *xf;
if_debug5('k', "[k]lookup xfont %s [%g %g %g %g]\n",
- pfstr->chars, pmat->xx, pmat->xy, pmat->yx, pmat->yy);
+ pfstr->chars, pmat->xx, pmat->xy, pmat->yx, pmat->yy);
xf = (*procs->lookup_font) (fdev,
- &pfstr->chars[0], pfstr->size,
- encoding_index, &pair->UID,
- pmat, pair->memory);
+ &pfstr->chars[0], pfstr->size,
+ encoding_index, &pair->UID,
+ pmat, pair->memory);
if_debug1('k', "[k]... xfont=0x%lx\n", (ulong) xf);
return xf;
}
@@ -557,10 +557,10 @@ lookup_xfont_by_name(gx_device * fdev, const gx_xfont_procs * procs,
* not NULL, dev should be an alpha-buffer device with dev2 (an alpha
* device) as target.
*/
-int
+int
gx_alloc_char_bits(gs_font_dir * dir, gx_device_memory * dev,
- gx_device_memory * dev2, ushort iwidth, ushort iheight,
- const gs_log2_scale_point * pscale, int depth, cached_char **pcc)
+ gx_device_memory * dev2, ushort iwidth, ushort iheight,
+ const gs_log2_scale_point * pscale, int depth, cached_char **pcc)
{
int log2_xscale = pscale->x;
int log2_yscale = pscale->y;
@@ -571,18 +571,18 @@ gx_alloc_char_bits(gs_font_dir * dir, gx_device_memory * dev,
cached_char *cc;
gx_device_memory mdev;
gx_device_memory *pdev = dev;
- gx_device_memory *pdev2;
+ gx_device_memory *pdev2;
float HWResolution0 = 72, HWResolution1 = 72; /* default for dev == NULL */
int code;
-
+
*pcc = 0;
if (dev == NULL) {
- mdev.memory = 0;
- mdev.target = 0;
- pdev = &mdev;
+ mdev.memory = 0;
+ mdev.target = 0;
+ pdev = &mdev;
} else {
- HWResolution0 = dev->HWResolution[0];
- HWResolution1 = dev->HWResolution[1];
+ HWResolution0 = dev->HWResolution[0];
+ HWResolution1 = dev->HWResolution[1];
}
pdev2 = (dev2 == 0 ? pdev : dev2);
@@ -592,67 +592,67 @@ gx_alloc_char_bits(gs_font_dir * dir, gx_device_memory * dev,
iraster = bitmap_raster(nwidth_bits);
if (iraster != 0 && iheight >> log2_yscale > dir->ccache.upper / iraster) {
- if_debug5('k', "[k]no cache bits: scale=%dx%d, raster/scale=%u, height/scale=%u, upper=%u\n",
- 1 << log2_xscale, 1 << log2_yscale,
- iraster, iheight, dir->ccache.upper);
- return 0; /* too big */
+ if_debug5('k', "[k]no cache bits: scale=%dx%d, raster/scale=%u, height/scale=%u, upper=%u\n",
+ 1 << log2_xscale, 1 << log2_yscale,
+ iraster, iheight, dir->ccache.upper);
+ return 0; /* too big */
}
/* Compute the actual bitmap size(s) and allocate the bits. */
if (dev2 == 0) {
- /*
- * Render to a full (possibly oversampled) bitmap; compress
- * (if needed) when done.
- *
- * HACK: Preserve the reference count and retained flag.
- */
- rc_header rc;
- bool retained = pdev->retained;
- gx_device *target = pdev->target;
-
- rc = pdev->rc;
- /* Pass the correct target, but decrement its refct afterwards. */
- gs_make_mem_mono_device(pdev, pdev->memory, target);
- rc_decrement_only(target, "gx_alloc_char_bits"); /* can't go to 0 */
+ /*
+ * Render to a full (possibly oversampled) bitmap; compress
+ * (if needed) when done.
+ *
+ * HACK: Preserve the reference count and retained flag.
+ */
+ rc_header rc;
+ bool retained = pdev->retained;
+ gx_device *target = pdev->target;
+
+ rc = pdev->rc;
+ /* Pass the correct target, but decrement its refct afterwards. */
+ gs_make_mem_mono_device(pdev, pdev->memory, target);
+ rc_decrement_only(target, "gx_alloc_char_bits"); /* can't go to 0 */
/* Decrement the ICC profile also. Same device is getting reinitialized */
if (target != NULL) rc_decrement(target->device_icc_profile,"gx_alloc_char_bits(icc profile)");
- pdev->rc = rc;
- pdev->retained = retained;
- pdev->width = iwidth;
- pdev->height = iheight;
- gdev_mem_bitmap_size(pdev, &isize); /* Assume less than max_ulong */
- pdev->HWResolution[0] = HWResolution0;
- pdev->HWResolution[1] = HWResolution1;
+ pdev->rc = rc;
+ pdev->retained = retained;
+ pdev->width = iwidth;
+ pdev->height = iheight;
+ gdev_mem_bitmap_size(pdev, &isize); /* Assume less than max_ulong */
+ pdev->HWResolution[0] = HWResolution0;
+ pdev->HWResolution[1] = HWResolution1;
} else {
- /* Use an alpha-buffer device to compress as we go. */
- /* Preserve the reference counts, if any. */
- rc_header rc;
-
- rc = dev2->rc;
- gs_make_mem_alpha_device(dev2, dev2->memory, NULL, depth);
- dev2->rc = rc;
- dev2->width = iwidth >> log2_xscale;
- dev2->height = iheight >> log2_yscale;
- rc = dev->rc;
- gs_make_mem_abuf_device(dev, dev->memory, (gx_device *) dev2,
- pscale, depth, 0);
- dev->rc = rc;
- dev->width = iwidth;
- dev->height = 2 << log2_yscale;
- gdev_mem_bitmap_size(dev, &isize); /* Assume less than max_ulong */
- gdev_mem_bitmap_size(dev2, &isize2); /* Assume less than max_ulong */
- isize += isize2; /* Assume less than max_ulong */
- dev->HWResolution[0] = HWResolution0 * (1 >> log2_xscale);
- dev->HWResolution[1] = HWResolution1 * (1 >> log2_yscale);
+ /* Use an alpha-buffer device to compress as we go. */
+ /* Preserve the reference counts, if any. */
+ rc_header rc;
+
+ rc = dev2->rc;
+ gs_make_mem_alpha_device(dev2, dev2->memory, NULL, depth);
+ dev2->rc = rc;
+ dev2->width = iwidth >> log2_xscale;
+ dev2->height = iheight >> log2_yscale;
+ rc = dev->rc;
+ gs_make_mem_abuf_device(dev, dev->memory, (gx_device *) dev2,
+ pscale, depth, 0);
+ dev->rc = rc;
+ dev->width = iwidth;
+ dev->height = 2 << log2_yscale;
+ gdev_mem_bitmap_size(dev, &isize); /* Assume less than max_ulong */
+ gdev_mem_bitmap_size(dev2, &isize2); /* Assume less than max_ulong */
+ isize += isize2; /* Assume less than max_ulong */
+ dev->HWResolution[0] = HWResolution0 * (1 >> log2_xscale);
+ dev->HWResolution[1] = HWResolution1 * (1 >> log2_yscale);
}
icdsize = isize + sizeof_cached_char;
code = alloc_char(dir, icdsize, &cc);
if (code < 0)
- return code;
+ return code;
*pcc = cc;
if (cc == 0)
- return 0;
+ return 0;
if_debug4('k', "[k]adding char 0x%lx:%u(%u,%u)\n",
- (ulong) cc, (uint) icdsize, iwidth, iheight);
+ (ulong) cc, (uint) icdsize, iwidth, iheight);
/* Fill in the entry. */
@@ -673,18 +673,18 @@ gx_alloc_char_bits(gs_font_dir * dir, gx_device_memory * dev,
/* Open the cache device(s). */
if (dev2) { /* The second device is an alpha device that targets */
- /* the real storage for the character. */
- byte *bits = cc_bits(cc);
- ulong bsize;
-
- gdev_mem_bitmap_size(dev2, &bsize);
- memset(bits, 0, bsize);
- dev2->base = bits;
- (*dev_proc(dev2, open_device)) ((gx_device *) dev2);
- dev->base = bits + bsize;
- (*dev_proc(dev, open_device)) ((gx_device *) dev);
+ /* the real storage for the character. */
+ byte *bits = cc_bits(cc);
+ ulong bsize;
+
+ gdev_mem_bitmap_size(dev2, &bsize);
+ memset(bits, 0, bsize);
+ dev2->base = bits;
+ (*dev_proc(dev2, open_device)) ((gx_device *) dev2);
+ dev->base = bits + bsize;
+ (*dev_proc(dev, open_device)) ((gx_device *) dev);
} else if (dev)
- gx_open_cache_device(dev, cc);
+ gx_open_cache_device(dev, cc);
return 0;
}
@@ -714,9 +714,9 @@ gx_free_cached_char(gs_font_dir * dir, cached_char * cc)
dir->ccache.chunks = cck;
dir->ccache.cnext = (byte *) cc - cck->data;
if (cc->linked)
- cc_pair(cc)->num_chars--;
+ cc_pair(cc)->num_chars--;
if_debug2('k', "[k]freeing char 0x%lx, pair=0x%lx\n",
- (ulong) cc, (ulong) cc_pair(cc));
+ (ulong) cc, (ulong) cc_pair(cc));
gx_bits_cache_free((gx_bits_cache *) & dir->ccache, &cc->head, cck);
}
@@ -726,43 +726,43 @@ gx_add_cached_char(gs_font_dir * dir, gx_device_memory * dev,
cached_char * cc, cached_fm_pair * pair, const gs_log2_scale_point * pscale)
{
if_debug5('k', "[k]chaining char 0x%lx: pair=0x%lx, glyph=0x%lx, wmode=%d, depth=%d\n",
- (ulong) cc, (ulong) pair, (ulong) cc->code,
- cc->wmode, cc_depth(cc));
+ (ulong) cc, (ulong) pair, (ulong) cc->code,
+ cc->wmode, cc_depth(cc));
if (dev != NULL) {
- static const gs_log2_scale_point no_scale =
- {0, 0};
-
- /* Close the device, to flush the alpha buffer if any. */
- (*dev_proc(dev, close_device)) ((gx_device *) dev);
- gx_add_char_bits(dir, cc,
- (gs_device_is_abuf((gx_device *) dev) ?
- &no_scale : pscale));
+ static const gs_log2_scale_point no_scale =
+ {0, 0};
+
+ /* Close the device, to flush the alpha buffer if any. */
+ (*dev_proc(dev, close_device)) ((gx_device *) dev);
+ gx_add_char_bits(dir, cc,
+ (gs_device_is_abuf((gx_device *) dev) ?
+ &no_scale : pscale));
}
/* Add the new character to the hash table. */
{
- uint chi = chars_head_index(cc->code, pair);
-
- while (dir->ccache.table[chi &= dir->ccache.table_mask] != 0)
- chi++;
- dir->ccache.table[chi] = cc;
- if (cc->pair == NULL) {
- /* gx_show_text_retry could reset it when bbox_draw
- discovered an insufficient FontBBox and enlarged it.
- Glyph raster params could change then. */
- cc->pair = pair;
- } else if (cc->pair != pair) {
- /* gx_add_fm_pair could drop the active font-matrix pair
- due to cache overflow during a charproc interpretation.
- Likely a single charproc renders too many characters
- for generating the character image.
- We have no mechanizm for locking font-matrix pairs in cache
- to avoud their dissipation. Therefore we consider this failure
- as an implementation limitation. */
- return_error(gs_error_invalidfont);
- }
- cc->linked = true;
- cc_set_pair(cc, pair);
- pair->num_chars++;
+ uint chi = chars_head_index(cc->code, pair);
+
+ while (dir->ccache.table[chi &= dir->ccache.table_mask] != 0)
+ chi++;
+ dir->ccache.table[chi] = cc;
+ if (cc->pair == NULL) {
+ /* gx_show_text_retry could reset it when bbox_draw
+ discovered an insufficient FontBBox and enlarged it.
+ Glyph raster params could change then. */
+ cc->pair = pair;
+ } else if (cc->pair != pair) {
+ /* gx_add_fm_pair could drop the active font-matrix pair
+ due to cache overflow during a charproc interpretation.
+ Likely a single charproc renders too many characters
+ for generating the character image.
+ We have no mechanizm for locking font-matrix pairs in cache
+ to avoud their dissipation. Therefore we consider this failure
+ as an implementation limitation. */
+ return_error(gs_error_invalidfont);
+ }
+ cc->linked = true;
+ cc_set_pair(cc, pair);
+ pair->num_chars++;
}
return 0;
}
@@ -771,7 +771,7 @@ cached_char * cc, cached_fm_pair * pair, const gs_log2_scale_point * pscale)
/* and compressing or converting to alpha values if necessary. */
void
gx_add_char_bits(gs_font_dir * dir, cached_char * cc,
- const gs_log2_scale_point * plog2_scale)
+ const gs_log2_scale_point * plog2_scale)
{
int log2_x = plog2_scale->x, log2_y = plog2_scale->y;
uint raster = cc_raster(cc);
@@ -783,13 +783,13 @@ gx_add_char_bits(gs_font_dir * dir, cached_char * cc,
#ifdef DEBUG
if (cc->width % (1 << log2_x) != 0 ||
- cc->height % (1 << log2_y) != 0
- ) {
- lprintf4("size %d,%d not multiple of scale %d,%d!\n",
- cc->width, cc->height,
- 1 << log2_x, 1 << log2_y);
- cc->width &= -1 << log2_x;
- cc->height &= -1 << log2_y;
+ cc->height % (1 << log2_y) != 0
+ ) {
+ lprintf4("size %d,%d not multiple of scale %d,%d!\n",
+ cc->width, cc->height,
+ 1 << log2_x, 1 << log2_y);
+ cc->width &= -1 << log2_x;
+ cc->height &= -1 << log2_y;
}
#endif
@@ -812,65 +812,65 @@ gx_add_char_bits(gs_font_dir * dir, cached_char * cc,
*/
if ((log2_x | log2_y) != 0) {
- if_debug5('k', "[k]compressing %dx%d by %dx%d to depth=%d\n",
- cc->width, cc->height, 1 << log2_x, 1 << log2_y,
- depth);
+ if_debug5('k', "[k]compressing %dx%d by %dx%d to depth=%d\n",
+ cc->width, cc->height, 1 << log2_x, 1 << log2_y,
+ depth);
#ifdef DEBUG
- if (gs_debug_c('K'))
- debug_dump_bitmap(bits, raster, cc->height,
- "[K]uncompressed bits");
+ if (gs_debug_c('K'))
+ debug_dump_bitmap(bits, raster, cc->height,
+ "[K]uncompressed bits");
#endif
- /* Truncate/round the bbox to a multiple of the scale. */
- {
- int scale_x = 1 << log2_x;
-
- bbox.p.x &= -scale_x;
- bbox.q.x = (bbox.q.x + scale_x - 1) & -scale_x;
- }
- {
- int scale_y = 1 << log2_y;
-
- bbox.p.y &= -scale_y;
- bbox.q.y = (bbox.q.y + scale_y - 1) & -scale_y;
- }
- cc->width = (bbox.q.x - bbox.p.x) >> log2_x;
- cc->height = (bbox.q.y - bbox.p.y) >> log2_y;
- nwidth_bits = cc->width << log2_depth;
- nraster = bitmap_raster(nwidth_bits);
- bits_compress_scaled(bits + raster * bbox.p.y, bbox.p.x,
- cc->width << log2_x,
- cc->height << log2_y,
- raster,
- bits, nraster, plog2_scale, log2_depth);
- bbox.p.x >>= log2_x;
- bbox.p.y >>= log2_y;
+ /* Truncate/round the bbox to a multiple of the scale. */
+ {
+ int scale_x = 1 << log2_x;
+
+ bbox.p.x &= -scale_x;
+ bbox.q.x = (bbox.q.x + scale_x - 1) & -scale_x;
+ }
+ {
+ int scale_y = 1 << log2_y;
+
+ bbox.p.y &= -scale_y;
+ bbox.q.y = (bbox.q.y + scale_y - 1) & -scale_y;
+ }
+ cc->width = (bbox.q.x - bbox.p.x) >> log2_x;
+ cc->height = (bbox.q.y - bbox.p.y) >> log2_y;
+ nwidth_bits = cc->width << log2_depth;
+ nraster = bitmap_raster(nwidth_bits);
+ bits_compress_scaled(bits + raster * bbox.p.y, bbox.p.x,
+ cc->width << log2_x,
+ cc->height << log2_y,
+ raster,
+ bits, nraster, plog2_scale, log2_depth);
+ bbox.p.x >>= log2_x;
+ bbox.p.y >>= log2_y;
} else {
- /* No oversampling, just remove white space on all 4 sides. */
- const byte *from = bits + raster * bbox.p.y + (bbox.p.x >> 3);
-
- cc->height = bbox.q.y - bbox.p.y;
- bbox.p.x &= ~7; /* adjust to byte boundary */
- bbox.p.x >>= log2_depth; /* bits => pixels */
- bbox.q.x = (bbox.q.x + depth - 1) >> log2_depth; /* ditto */
- cc->width = bbox.q.x - bbox.p.x;
- nwidth_bits = cc->width << log2_depth;
- nraster = bitmap_raster(nwidth_bits);
- if (bbox.p.x != 0 || nraster != raster) {
- /* Move the bits down and over. */
- byte *to = bits;
- uint n = cc->height;
-
- /* We'd like to move only
- uint nbytes = (nwidth_bits + 7) >> 3;
- * bytes per scan line, but unfortunately this drops
- * the guaranteed zero padding at the end.
- */
-
- for (; n--; from += raster, to += nraster)
- memmove(to, from, /*nbytes */ nraster);
- } else if (bbox.p.y != 0) { /* Just move the bits down. */
- memmove(bits, from, raster * cc->height);
- }
+ /* No oversampling, just remove white space on all 4 sides. */
+ const byte *from = bits + raster * bbox.p.y + (bbox.p.x >> 3);
+
+ cc->height = bbox.q.y - bbox.p.y;
+ bbox.p.x &= ~7; /* adjust to byte boundary */
+ bbox.p.x >>= log2_depth; /* bits => pixels */
+ bbox.q.x = (bbox.q.x + depth - 1) >> log2_depth; /* ditto */
+ cc->width = bbox.q.x - bbox.p.x;
+ nwidth_bits = cc->width << log2_depth;
+ nraster = bitmap_raster(nwidth_bits);
+ if (bbox.p.x != 0 || nraster != raster) {
+ /* Move the bits down and over. */
+ byte *to = bits;
+ uint n = cc->height;
+
+ /* We'd like to move only
+ uint nbytes = (nwidth_bits + 7) >> 3;
+ * bytes per scan line, but unfortunately this drops
+ * the guaranteed zero padding at the end.
+ */
+
+ for (; n--; from += raster, to += nraster)
+ memmove(to, from, /*nbytes */ nraster);
+ } else if (bbox.p.y != 0) { /* Just move the bits down. */
+ memmove(bits, from, raster * cc->height);
+ }
}
/* Adjust the offsets to account for removed white space. */
@@ -883,15 +883,15 @@ gx_add_char_bits(gs_font_dir * dir, cached_char * cc,
cc_set_raster(cc, nraster);
{
- uint diff = ROUND_DOWN(cc->head.size - sizeof_cached_char -
- nraster * cc->height,
- align_cached_char_mod);
-
- if (diff >= sizeof(cached_char_head)) {
- shorten_cached_char(dir, cc, diff);
- if_debug2('K', "[K]shortening char 0x%lx by %u (adding)\n",
- (ulong) cc, diff);
- }
+ uint diff = ROUND_DOWN(cc->head.size - sizeof_cached_char -
+ nraster * cc->height,
+ align_cached_char_mod);
+
+ if (diff >= sizeof(cached_char_head)) {
+ shorten_cached_char(dir, cc, diff);
+ if_debug2('K', "[K]shortening char 0x%lx by %u (adding)\n",
+ (ulong) cc, diff);
+ }
}
/* Assign a bitmap id. */
@@ -908,26 +908,26 @@ gs_purge_font_from_char_caches_forced(gs_font * font, bool force)
int count;
if (font->dir == NULL)
- return 0; /* The font was not properly build due to errors. */
+ return 0; /* The font was not properly build due to errors. */
if (!font->is_cached)
- return 0;
+ return 0;
dir = font->dir;
pair = dir->fmcache.mdata;
count = dir->fmcache.mmax;
font->is_cached = false; /* Prevent redundant execution. */
if_debug1('k', "[k]purging font 0x%lx\n",
- (ulong) font);
+ (ulong) font);
for (; count--; pair++) {
- if (pair->font == font) {
- if (!force && uid_is_valid(&pair->UID)) { /* Keep the entry. */
- gs_clean_fm_pair(dir, pair);
- } else {
- int code = gs_purge_fm_pair(dir, pair, 0);
-
- if (code < 0)
- return code;
- }
- }
+ if (pair->font == font) {
+ if (!force && uid_is_valid(&pair->UID)) { /* Keep the entry. */
+ gs_clean_fm_pair(dir, pair);
+ } else {
+ int code = gs_purge_fm_pair(dir, pair, 0);
+
+ if (code < 0)
+ return code;
+ }
+ }
}
return 0;
}
@@ -940,17 +940,17 @@ gs_purge_font_from_char_caches(gs_font * font)
/* This function is called when a font is being released.
The purpose is to remove all cache attributes,
which may point to the font data.
- Note : when a font has a valid XUID,
+ Note : when a font has a valid XUID,
it doesn't release cache entries and cached chars,
- so that they may be used in future
+ so that they may be used in future
if a font with same XUID appears again.
All this improves the performance when
a document executes a sequence like this :
n {
save /fontname findfont 10 scalefont
- (xyz) show
- restore
+ (xyz) show
+ restore
} repeat
*/
return gs_purge_font_from_char_caches_forced(font, false);
@@ -963,15 +963,13 @@ gs_purge_font_from_char_caches_completely(gs_font * font)
{
/* A client should call this finction
when it frees a font,
- and the client doesn't need to leave
+ and the client doesn't need to leave
persistent cache entries for this font
even if the font has a valid XUID.
*/
return gs_purge_font_from_char_caches_forced(font, true);
}
-
-
/* ------ Internal routines ------ */
/* Allocate data space for a cached character, adding a new chunk if needed. */
@@ -983,62 +981,62 @@ alloc_char(gs_font_dir * dir, ulong icdsize, cached_char **pcc)
*pcc = cc;
if (code < 0)
- return code;
+ return code;
if (cc == 0) {
- if (dir->ccache.bspace < dir->ccache.bmax) { /* Allocate another chunk. */
- gs_memory_t *mem = dir->ccache.bits_memory;
- char_cache_chunk *cck_prev = dir->ccache.chunks;
- char_cache_chunk *cck;
- uint cksize = dir->ccache.bmax / 5 + 1;
- uint tsize = dir->ccache.bmax - dir->ccache.bspace;
- byte *cdata;
-
- if (cksize > tsize)
- cksize = tsize;
- if (icdsize + sizeof(cached_char_head) > cksize) {
- if_debug2('k', "[k]no cache bits: cdsize+head=%lu, cksize=%u\n",
- icdsize + sizeof(cached_char_head),
- cksize);
- return 0; /* wouldn't fit */
- }
- cck = (char_cache_chunk *)
- gs_alloc_bytes_immovable(mem, sizeof(*cck),
- "char cache chunk");
- if (cck == 0)
- return 0;
- cdata =
- gs_alloc_struct_array_immovable(mem, cksize, byte,
- &st_font_cache_bytes,
- "char cache chunk(data)");
- if (cdata == 0) {
- gs_free_object(mem, cck, "char cache chunk");
- return 0;
- }
- gx_bits_cache_chunk_init(cck, cdata, cksize);
- cck->next = cck_prev->next;
- cck_prev->next = cck;
- dir->ccache.bspace += cksize;
- dir->ccache.chunks = cck;
- } else { /* Cycle through existing chunks. */
- char_cache_chunk *cck_init = dir->ccache.chunks;
- char_cache_chunk *cck = cck_init;
-
- while ((dir->ccache.chunks = cck = cck->next) != cck_init) {
- dir->ccache.cnext = 0;
- code = alloc_char_in_chunk(dir, icdsize, &cc);
- if (code < 0)
- return code;
- if (cc != 0) {
- *pcc = cc;
- return 0;
- }
- }
- }
- dir->ccache.cnext = 0;
- code = alloc_char_in_chunk(dir, icdsize, &cc);
- if (code < 0)
- return code;
- *pcc = cc;
+ if (dir->ccache.bspace < dir->ccache.bmax) { /* Allocate another chunk. */
+ gs_memory_t *mem = dir->ccache.bits_memory;
+ char_cache_chunk *cck_prev = dir->ccache.chunks;
+ char_cache_chunk *cck;
+ uint cksize = dir->ccache.bmax / 5 + 1;
+ uint tsize = dir->ccache.bmax - dir->ccache.bspace;
+ byte *cdata;
+
+ if (cksize > tsize)
+ cksize = tsize;
+ if (icdsize + sizeof(cached_char_head) > cksize) {
+ if_debug2('k', "[k]no cache bits: cdsize+head=%lu, cksize=%u\n",
+ icdsize + sizeof(cached_char_head),
+ cksize);
+ return 0; /* wouldn't fit */
+ }
+ cck = (char_cache_chunk *)
+ gs_alloc_bytes_immovable(mem, sizeof(*cck),
+ "char cache chunk");
+ if (cck == 0)
+ return 0;
+ cdata =
+ gs_alloc_struct_array_immovable(mem, cksize, byte,
+ &st_font_cache_bytes,
+ "char cache chunk(data)");
+ if (cdata == 0) {
+ gs_free_object(mem, cck, "char cache chunk");
+ return 0;
+ }
+ gx_bits_cache_chunk_init(cck, cdata, cksize);
+ cck->next = cck_prev->next;
+ cck_prev->next = cck;
+ dir->ccache.bspace += cksize;
+ dir->ccache.chunks = cck;
+ } else { /* Cycle through existing chunks. */
+ char_cache_chunk *cck_init = dir->ccache.chunks;
+ char_cache_chunk *cck = cck_init;
+
+ while ((dir->ccache.chunks = cck = cck->next) != cck_init) {
+ dir->ccache.cnext = 0;
+ code = alloc_char_in_chunk(dir, icdsize, &cc);
+ if (code < 0)
+ return code;
+ if (cc != 0) {
+ *pcc = cc;
+ return 0;
+ }
+ }
+ }
+ dir->ccache.cnext = 0;
+ code = alloc_char_in_chunk(dir, icdsize, &cc);
+ if (code < 0)
+ return code;
+ *pcc = cc;
}
return 0;
}
@@ -1054,34 +1052,34 @@ alloc_char_in_chunk(gs_font_dir * dir, ulong icdsize, cached_char **pcc)
*pcc = 0;
while (gx_bits_cache_alloc((gx_bits_cache *) & dir->ccache,
- icdsize, &cch) < 0
- ) {
- if (cch == 0) { /* Not enough room to allocate in this chunk. */
- return 0;
- }
+ icdsize, &cch) < 0
+ ) {
+ if (cch == 0) { /* Not enough room to allocate in this chunk. */
+ return 0;
+ }
#ifdef GSLITE
- /* We shouldn't free because it's used. */
- if (cc->dont_evict) {
- return 0;
- }
+ /* We shouldn't free because it's used. */
+ if (cc->dont_evict) {
+ return 0;
+ }
#endif
- else { /* Free the character */
- cached_fm_pair *pair = cc_pair(cc);
-
- if (pair != 0) {
- uint chi = chars_head_index(cc->code, pair);
- uint cnt = dir->ccache.table_mask + 1;
-
- while (dir->ccache.table[chi & dir->ccache.table_mask] != cc) {
- chi++;
- if (cnt-- == 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- hash_remove_cached_char(dir, chi);
- }
-
- gx_free_cached_char(dir, cc);
- }
+ else { /* Free the character */
+ cached_fm_pair *pair = cc_pair(cc);
+
+ if (pair != 0) {
+ uint chi = chars_head_index(cc->code, pair);
+ uint cnt = dir->ccache.table_mask + 1;
+
+ while (dir->ccache.table[chi & dir->ccache.table_mask] != cc) {
+ chi++;
+ if (cnt-- == 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ hash_remove_cached_char(dir, chi);
+ }
+
+ gx_free_cached_char(dir, cc);
+ }
}
#ifdef GSLITE
@@ -1107,19 +1105,19 @@ hash_remove_cached_char(gs_font_dir * dir, uint chi)
dir->ccache.table[chi] = 0;
while ((cc = dir->ccache.table[from]) != 0) { /* Loop invariants: chars[chi] == 0; */
- /* chars[chi+1..from] != 0. */
- uint fchi = chars_head_index(cc->code, cc_pair(cc));
-
- /* If chi <= fchi < from, we relocate the character. */
- /* Note that '<=' must take wraparound into account. */
- if ((chi < from ? chi <= fchi && fchi < from :
- chi <= fchi || fchi < from)
- ) {
- dir->ccache.table[chi] = cc;
- dir->ccache.table[from] = 0;
- chi = from;
- }
- from = (from + 1) & mask;
+ /* chars[chi+1..from] != 0. */
+ uint fchi = chars_head_index(cc->code, cc_pair(cc));
+
+ /* If chi <= fchi < from, we relocate the character. */
+ /* Note that '<=' must take wraparound into account. */
+ if ((chi < from ? chi <= fchi && fchi < from :
+ chi <= fchi || fchi < from)
+ ) {
+ dir->ccache.table[chi] = cc;
+ dir->ccache.table[from] = 0;
+ chi = from;
+ }
+ from = (from + 1) & mask;
}
}
@@ -1129,9 +1127,9 @@ static void
shorten_cached_char(gs_font_dir * dir, cached_char * cc, uint diff)
{
gx_bits_cache_shorten((gx_bits_cache *) & dir->ccache, &cc->head,
- diff, cc->chunk);
+ diff, cc->chunk);
if_debug2('K', "[K]shortening creates free block 0x%lx(%u)\n",
- (ulong) ((byte *) cc + cc->head.size), diff);
+ (ulong) ((byte *) cc + cc->head.size), diff);
}
#ifdef GSLITE
@@ -1147,4 +1145,3 @@ void gx_release_cached_char(cached_char *cc)
}
#endif
-
diff --git a/gs/base/gxcdevn.h b/gs/base/gxcdevn.h
index 6786b5912..c76dad5d7 100644
--- a/gs/base/gxcdevn.h
+++ b/gs/base/gxcdevn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxchar.h b/gs/base/gxchar.h
index 1fcd73092..b5c820bb2 100644
--- a/gs/base/gxchar.h
+++ b/gs/base/gxchar.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -72,19 +72,19 @@ struct gs_show_enum_s {
int level; /* save the level of pgs */
gs_char_path_mode charpath_flag;
gs_state *show_gstate; /* for setting pgs->show_gstate */
- /* at returns/callouts */
+ /* at returns/callouts */
int can_cache; /* -1 if can't use cache at all, */
- /* 0 if can read but not load, */
- /* 1 if can read and load */
+ /* 0 if can read but not load, */
+ /* 1 if can read and load */
gs_int_rect ibox; /* int version of quick-check */
- /* (inner) clipping box */
+ /* (inner) clipping box */
gs_int_rect obox; /* int version of (outer) clip box */
int ftx, fty; /* transformed font translation */
/* Following are updated dynamically */
gs_glyph (*encode_char)(gs_font *, gs_char, gs_glyph_space_t); /* copied from font */
gx_device_memory *dev_cache; /* cache device */
gx_device_memory *dev_cache2; /* underlying alpha memory device, */
- /* if dev_cache is an alpha buffer */
+ /* if dev_cache is an alpha buffer */
gx_device_null *dev_null; /* null device for stringwidth */
/*uint index; */ /* index within string */
/*uint xy_index;*/ /* index within X/Y widths */
@@ -94,8 +94,8 @@ struct gs_show_enum_s {
gs_point wxy_float; /* same for huge characters */
bool use_wxy_float;
gs_fixed_point origin; /* unrounded origin of current char */
- /* in device coords, needed for */
- /* charpath and WMode=1 */
+ /* in device coords, needed for */
+ /* charpath and WMode=1 */
cached_char *cc; /* being accumulated */
/*gs_point returned.total_width;*/ /* total width of string, set at end */
show_width_status width_status;
@@ -125,10 +125,10 @@ void gx_add_char_bits(gs_font_dir *, cached_char *, const gs_log2_scale_point *)
cached_char *
gx_lookup_cached_char(const gs_font *, const cached_fm_pair *, gs_glyph, int, int, gs_fixed_point *);
int gx_lookup_xfont_char(const gs_state * pgs, cached_fm_pair * pair,
- gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc);
+ gs_char chr, gs_glyph glyph, int wmode, cached_char **pcc);
int gx_image_cached_char(gs_show_enum *, cached_char *);
void gx_compute_text_oversampling(const gs_show_enum * penum, const gs_font *pfont,
- int alpha_bits, gs_log2_scale_point *p_log2_scale);
+ int alpha_bits, gs_log2_scale_point *p_log2_scale);
int set_char_width(gs_show_enum *penum, gs_state *pgs, floatp wx, floatp wy);
int gx_default_text_restore_state(gs_text_enum_t *pte);
int gx_hld_stringwidth_begin(gs_imager_state * pis, gx_path **path);
diff --git a/gs/base/gxchrout.c b/gs/base/gxchrout.c
index 3442ac14c..8366e17fb 100644
--- a/gs/base/gxchrout.c
+++ b/gs/base/gxchrout.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,22 +36,22 @@ gs_char_flatness(const gs_imager_state *pis, floatp default_scale)
double cxx = fabs(pis->ctm.xx), cyy = fabs(pis->ctm.yy);
if (is_fzero(cxx) || (cyy < cxx && !is_fzero(cyy)))
- cxx = cyy;
+ cxx = cyy;
if (!is_xxyy(&pis->ctm)) {
- double cxy = fabs(pis->ctm.xy), cyx = fabs(pis->ctm.yx);
+ double cxy = fabs(pis->ctm.xy), cyx = fabs(pis->ctm.yx);
- if (is_fzero(cxx) || (cxy < cxx && !is_fzero(cxy)))
- cxx = cxy;
- if (is_fzero(cxx) || (cyx < cxx && !is_fzero(cyx)))
- cxx = cyx;
+ if (is_fzero(cxx) || (cxy < cxx && !is_fzero(cxy)))
+ cxx = cxy;
+ if (is_fzero(cxx) || (cyx < cxx && !is_fzero(cyx)))
+ cxx = cyx;
}
/* Correct for the default scaling. */
cxx *= 0.001 / default_scale;
/* Don't let the flatness be worse than the default. */
if (cxx > pis->flatness)
- cxx = pis->flatness;
+ cxx = pis->flatness;
/* If the character is tiny, force accurate curves. */
if (cxx < 0.2)
- cxx = 0;
+ cxx = 0;
return cxx;
}
diff --git a/gs/base/gxchrout.h b/gs/base/gxchrout.h
index 2cc55e518..78b29f7f7 100644
--- a/gs/base/gxchrout.h
+++ b/gs/base/gxchrout.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxcht.c b/gs/base/gxcht.c
index c941f02a8..c6b9f90b4 100644
--- a/gs/base/gxcht.c
+++ b/gs/base/gxcht.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -73,7 +73,7 @@ const gx_device_color_type_t *const gx_dc_type_ht_colored =
/* save information about the operand device color */
static void
gx_dc_ht_colored_save_dc(const gx_device_color * pdevc,
- gx_device_color_saved * psdc)
+ gx_device_color_saved * psdc)
{
psdc->type = pdevc->type;
memcpy( psdc->colors.colored.c_base,
@@ -96,28 +96,27 @@ gx_dc_ht_colored_get_dev_halftone(const gx_device_color * pdevc)
/* Compare two colored halftones for equality. */
static bool
gx_dc_ht_colored_equal(const gx_device_color * pdevc1,
- const gx_device_color * pdevc2)
+ const gx_device_color * pdevc2)
{
uint num_comp = pdevc1->colors.colored.num_components;
if (pdevc2->type != pdevc1->type ||
- pdevc1->colors.colored.c_ht != pdevc2->colors.colored.c_ht ||
- pdevc1->colors.colored.alpha != pdevc2->colors.colored.alpha ||
- pdevc1->phase.x != pdevc2->phase.x ||
- pdevc1->phase.y != pdevc2->phase.y ||
+ pdevc1->colors.colored.c_ht != pdevc2->colors.colored.c_ht ||
+ pdevc1->colors.colored.alpha != pdevc2->colors.colored.alpha ||
+ pdevc1->phase.x != pdevc2->phase.x ||
+ pdevc1->phase.y != pdevc2->phase.y ||
num_comp != pdevc2->colors.colored.num_components
- )
- return false;
+ )
+ return false;
return
- !memcmp(pdevc1->colors.colored.c_base,
- pdevc2->colors.colored.c_base,
- num_comp * sizeof(pdevc1->colors.colored.c_base[0])) &&
- !memcmp(pdevc1->colors.colored.c_level,
- pdevc2->colors.colored.c_level,
- num_comp * sizeof(pdevc1->colors.colored.c_level[0]));
+ !memcmp(pdevc1->colors.colored.c_base,
+ pdevc2->colors.colored.c_base,
+ num_comp * sizeof(pdevc1->colors.colored.c_base[0])) &&
+ !memcmp(pdevc1->colors.colored.c_level,
+ pdevc2->colors.colored.c_level,
+ num_comp * sizeof(pdevc1->colors.colored.c_level[0]));
}
-
/*
* Flags to indicate the pieces of a colored halftone that are included
* in its string representation. The first byte of the string holds this
@@ -159,7 +158,7 @@ static const int dc_ht_colored_alpha_is_max = 0x08;
*
* psdc pointer ot saved version of last serialized color (for
* this band)
- *
+ *
* dev pointer to the current device, used to retrieve process
* color model information
*
@@ -189,7 +188,7 @@ gx_dc_ht_colored_write(
byte * pdata,
uint * psize )
{
- int req_size = 1;
+ int req_size = 1;
int flag_bits = 0;
int num_comps = dev->color_info.num_components;
int depth = dev->color_info.depth;
@@ -199,11 +198,11 @@ gx_dc_ht_colored_write(
byte * pdata0 = pdata;
if (offset != 0)
- return_error(gs_error_unregistered); /* Not implemented yet. */
+ return_error(gs_error_unregistered); /* Not implemented yet. */
/* sanity check */
if (pdevc->colors.colored.num_components != num_comps)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
/* check if saved color is of the same type */
if (psdc != 0 && psdc->type != pdevc->type)
@@ -366,7 +365,7 @@ gx_dc_ht_colored_read(
int flag_bits;
if (offset != 0)
- return_error(gs_error_unregistered); /* Not implemented yet. */
+ return_error(gs_error_unregistered); /* Not implemented yet. */
/* if prior information is available, use it */
if (prior_devc != 0 && prior_devc->type == gx_dc_type_ht_colored)
@@ -401,7 +400,7 @@ gx_dc_ht_colored_read(
if (size < num_bytes)
return_error(gs_error_rangecheck);
- size -= num_bytes;
+ size -= num_bytes;
for (i = 0; i < num_bytes; i++, shift += 8)
base_mask |= (gx_color_index)(*pdata++) << shift;
for (i = 0; i < num_comps; i++, base_mask >>= 1)
@@ -409,7 +408,7 @@ gx_dc_ht_colored_read(
} else {
if (size < num_comps)
return_error(gs_error_rangecheck);
- size -= num_comps;
+ size -= num_comps;
memcpy(devc.colors.colored.c_base, pdata, num_comps);
pdata += num_comps;
}
@@ -468,7 +467,6 @@ gx_dc_ht_colored_read(
return pdata - pdata0;
}
-
/*
* Get the nonzero components of a coloredhalftone. This is used to
* distinguish components that are given zero intensity due to halftoning
@@ -518,14 +516,14 @@ typedef struct color_values_pair_s {
} color_values_pair_t;
#define SET_HT_COLORS_PROC(proc)\
int proc(\
- color_values_pair_t *pvp,\
- gx_color_index colors[MAX_DCC_16],\
- const gx_const_strip_bitmap *sbits[MAX_DCC],\
- const gx_device_color *pdevc,\
- gx_device *dev,\
- gx_ht_cache *caches[MAX_DCC],\
- int nplanes\
- )
+ color_values_pair_t *pvp,\
+ gx_color_index colors[MAX_DCC_16],\
+ const gx_const_strip_bitmap *sbits[MAX_DCC],\
+ const gx_device_color *pdevc,\
+ gx_device *dev,\
+ gx_ht_cache *caches[MAX_DCC],\
+ int nplanes\
+ )
static SET_HT_COLORS_PROC(set_ht_colors_le_4);
static SET_HT_COLORS_PROC(set_cmyk_1bit_colors);
@@ -533,23 +531,23 @@ static SET_HT_COLORS_PROC(set_ht_colors_gt_4);
#define SET_COLOR_HT_PROC(proc)\
void proc(\
- byte *dest_data, /* the output tile */\
- uint dest_raster, /* ibid. */\
- int px, /* the initial phase of the output tile */\
- int py,\
- int w, /* how much of the tile to set */\
- int h,\
- int depth, /* depth of tile (4, 8, 16, 24, 32) */\
- int special, /* >0 means special 1-bit CMYK */\
- int nplanes,\
- gx_color_index plane_mask, /* which planes are halftoned */\
- gx_device *dev, /* in case we are mapping lazily */\
- const color_values_pair_t *pvp, /* color values ditto */\
- gx_color_index colors[MAX_DCC], /* the actual colors for the tile, */\
- /* actually [nplanes] */\
- const gx_const_strip_bitmap * sbits[MAX_DCC] /* the bitmaps for the planes, */\
- /* actually [nplanes] */\
- )
+ byte *dest_data, /* the output tile */\
+ uint dest_raster, /* ibid. */\
+ int px, /* the initial phase of the output tile */\
+ int py,\
+ int w, /* how much of the tile to set */\
+ int h,\
+ int depth, /* depth of tile (4, 8, 16, 24, 32) */\
+ int special, /* >0 means special 1-bit CMYK */\
+ int nplanes,\
+ gx_color_index plane_mask, /* which planes are halftoned */\
+ gx_device *dev, /* in case we are mapping lazily */\
+ const color_values_pair_t *pvp, /* color values ditto */\
+ gx_color_index colors[MAX_DCC], /* the actual colors for the tile, */\
+ /* actually [nplanes] */\
+ const gx_const_strip_bitmap * sbits[MAX_DCC] /* the bitmaps for the planes, */\
+ /* actually [nplanes] */\
+ )
static SET_COLOR_HT_PROC(set_color_ht_le_4);
static SET_COLOR_HT_PROC(set_color_ht_gt_4);
@@ -557,10 +555,10 @@ static SET_COLOR_HT_PROC(set_color_ht_gt_4);
/* Prepare to use a colored halftone, by loading the default cache. */
static int
gx_dc_ht_colored_load(gx_device_color * pdevc, const gs_imager_state * pis,
- gx_device * ignore_dev, gs_color_select_t select)
+ gx_device * ignore_dev, gs_color_select_t select)
{
/* TO_DO_DEVICEN */
-
+
return 0;
}
@@ -568,9 +566,9 @@ gx_dc_ht_colored_load(gx_device_color * pdevc, const gs_imager_state * pis,
/* Note that we treat this as "texture" for RasterOp. */
static int
gx_dc_ht_colored_fill_rectangle(const gx_device_color * pdevc,
- int x, int y, int w, int h,
- gx_device * dev, gs_logical_operation_t lop,
- const gx_rop_source_t * source)
+ int x, int y, int w, int h,
+ gx_device * dev, gs_logical_operation_t lop,
+ const gx_rop_source_t * source)
{
ulong tbits[tile_longs_allocated];
const uint tile_bytes = tile_longs * size_of(long);
@@ -581,25 +579,25 @@ gx_dc_ht_colored_fill_rectangle(const gx_device_color * pdevc,
int nplanes = dev->color_info.num_components;
SET_HT_COLORS_PROC((*set_ht_colors)) =
- (
+ (
#if USE_SLOW_CODE
- set_ht_colors_gt_4
+ set_ht_colors_gt_4
#else
- (dev_proc(dev, map_cmyk_color) == gx_default_encode_color &&
- dev->color_info.depth == 4) ?
- set_cmyk_1bit_colors :
- nplanes <= 4 ? set_ht_colors_le_4 :
- set_ht_colors_gt_4
+ (dev_proc(dev, map_cmyk_color) == gx_default_encode_color &&
+ dev->color_info.depth == 4) ?
+ set_cmyk_1bit_colors :
+ nplanes <= 4 ? set_ht_colors_le_4 :
+ set_ht_colors_gt_4
#endif
- );
+ );
SET_COLOR_HT_PROC((*set_color_ht)) =
- (
+ (
#if !USE_SLOW_CODE
- !(pdevc->colors.colored.plane_mask & ~(gx_color_index)15) &&
- set_ht_colors != set_ht_colors_gt_4 ?
- set_color_ht_le_4 :
+ !(pdevc->colors.colored.plane_mask & ~(gx_color_index)15) &&
+ set_ht_colors != set_ht_colors_gt_4 ?
+ set_color_ht_le_4 :
#endif
- set_color_ht_gt_4);
+ set_color_ht_gt_4);
color_values_pair_t vp;
gx_color_index colors[MAX_DCC_16];
const gx_const_strip_bitmap *sbits[MAX_DCC];
@@ -614,42 +612,41 @@ gx_dc_ht_colored_fill_rectangle(const gx_device_color * pdevc,
int i;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
if ((w | h) >= 16) {
- /* It's worth taking the trouble to check the clipping box. */
- gs_fixed_rect cbox;
- int t;
-
- dev_proc(dev, get_clipping_box)(dev, &cbox);
- if ((t = fixed2int(cbox.p.x)) > x) {
- if ((w += x - t) <= 0)
- return 0;
- x = t;
- }
- if ((t = fixed2int(cbox.p.y)) > y) {
- if ((h += y - t) <= 0)
- return 0;
- y = t;
- }
- if ((t = fixed2int(cbox.q.x)) < x + w)
- if ((w = t - x) <= 0)
- return 0;
- if ((t = fixed2int(cbox.q.y)) < y + h)
- if ((h = t - y) <= 0)
- return 0;
+ /* It's worth taking the trouble to check the clipping box. */
+ gs_fixed_rect cbox;
+ int t;
+
+ dev_proc(dev, get_clipping_box)(dev, &cbox);
+ if ((t = fixed2int(cbox.p.x)) > x) {
+ if ((w += x - t) <= 0)
+ return 0;
+ x = t;
+ }
+ if ((t = fixed2int(cbox.p.y)) > y) {
+ if ((h += y - t) <= 0)
+ return 0;
+ y = t;
+ }
+ if ((t = fixed2int(cbox.q.x)) < x + w)
+ if ((w = t - x) <= 0)
+ return 0;
+ if ((t = fixed2int(cbox.q.y)) < y + h)
+ if ((h = t - y) <= 0)
+ return 0;
}
/* Colored halftone patterns are unconditionally opaque. */
lop &= ~lop_T_transparent;
if (pdht->components == 0) {
- caches[0] = caches[1] = caches[2] = caches[3] = pdht->order.cache;
- for (i = 4; i < nplanes; ++i)
- caches[i] = pdht->order.cache;
+ caches[0] = caches[1] = caches[2] = caches[3] = pdht->order.cache;
+ for (i = 4; i < nplanes; ++i)
+ caches[i] = pdht->order.cache;
} else {
- gx_ht_order_component *pocs = pdht->components;
+ gx_ht_order_component *pocs = pdht->components;
-
- for (i = 0; i < nplanes; ++i)
- caches[i] = pocs[i].corder.cache;
+ for (i = 0; i < nplanes; ++i)
+ caches[i] = pocs[i].corder.cache;
}
special = set_ht_colors(&vp, colors, sbits, pdevc, dev, caches, nplanes);
no_rop = source == NULL && lop_no_S_is_T(lop);
@@ -659,116 +656,116 @@ gx_dc_ht_colored_fill_rectangle(const gx_device_color * pdevc,
* replication.
*/
if ((w > lw || h > lh) &&
- (raster = bitmap_raster(lw * depth)) <= tile_bytes / lh
- ) {
- /*
- * The only reason we need to do fit_fill here is that if the
- * device is a clipper, the caller might be counting on it to do
- * all necessary clipping. Actually, we should clip against the
- * device's clipping box, not the default....
- */
- fit_fill(dev, x, y, w, h);
- /* Check to make sure we still have a big rectangle. */
- if (w > lw || h > lh) {
- tiles.data = (byte *)tbits;
- tiles.raster = raster;
- tiles.rep_width = tiles.size.x = lw;
- tiles.rep_height = tiles.size.y = lh;
- tiles.id = gs_next_ids(pdht->rc.memory, 1);
- tiles.rep_shift = tiles.shift = 0;
- set_color_ht((byte *)tbits, raster, 0, 0, lw, lh, depth,
- special, nplanes, pdevc->colors.colored.plane_mask,
- dev, &vp, colors, sbits);
- if (no_rop)
- return (*dev_proc(dev, strip_tile_rectangle)) (dev, &tiles,
- x, y, w, h,
- gx_no_color_index, gx_no_color_index,
- pdevc->phase.x, pdevc->phase.y);
- if (source == NULL)
- set_rop_no_source(source, no_source, dev);
- return (*dev_proc(dev, strip_copy_rop)) (dev, source->sdata,
- source->sourcex, source->sraster, source->id,
- (source->use_scolors ? source->scolors : NULL),
- &tiles, NULL,
- x, y, w, h,
- pdevc->phase.x, pdevc->phase.y,
+ (raster = bitmap_raster(lw * depth)) <= tile_bytes / lh
+ ) {
+ /*
+ * The only reason we need to do fit_fill here is that if the
+ * device is a clipper, the caller might be counting on it to do
+ * all necessary clipping. Actually, we should clip against the
+ * device's clipping box, not the default....
+ */
+ fit_fill(dev, x, y, w, h);
+ /* Check to make sure we still have a big rectangle. */
+ if (w > lw || h > lh) {
+ tiles.data = (byte *)tbits;
+ tiles.raster = raster;
+ tiles.rep_width = tiles.size.x = lw;
+ tiles.rep_height = tiles.size.y = lh;
+ tiles.id = gs_next_ids(pdht->rc.memory, 1);
+ tiles.rep_shift = tiles.shift = 0;
+ set_color_ht((byte *)tbits, raster, 0, 0, lw, lh, depth,
+ special, nplanes, pdevc->colors.colored.plane_mask,
+ dev, &vp, colors, sbits);
+ if (no_rop)
+ return (*dev_proc(dev, strip_tile_rectangle)) (dev, &tiles,
+ x, y, w, h,
+ gx_no_color_index, gx_no_color_index,
+ pdevc->phase.x, pdevc->phase.y);
+ if (source == NULL)
+ set_rop_no_source(source, no_source, dev);
+ return (*dev_proc(dev, strip_copy_rop)) (dev, source->sdata,
+ source->sourcex, source->sraster, source->id,
+ (source->use_scolors ? source->scolors : NULL),
+ &tiles, NULL,
+ x, y, w, h,
+ pdevc->phase.x, pdevc->phase.y,
lop);
- }
+ }
}
size_x = w * depth;
raster = bitmap_raster(size_x);
if (raster > tile_bytes) {
- /*
- * We can't even do an entire line at once. See above for
- * why we do the X equivalent of fit_fill here.
- */
- if (x < 0)
- w += x, x = 0;
- if (x > dev->width - w)
- w = dev->width - x;
- if (w <= 0)
- return 0;
- size_x = w * depth;
- raster = bitmap_raster(size_x);
- if (raster > tile_bytes) {
- /* We'll have to do a partial line. */
- dw = tile_bytes * 8 / depth;
- size_x = dw * depth;
- raster = bitmap_raster(size_x);
- dh = 1;
- goto fit;
- }
+ /*
+ * We can't even do an entire line at once. See above for
+ * why we do the X equivalent of fit_fill here.
+ */
+ if (x < 0)
+ w += x, x = 0;
+ if (x > dev->width - w)
+ w = dev->width - x;
+ if (w <= 0)
+ return 0;
+ size_x = w * depth;
+ raster = bitmap_raster(size_x);
+ if (raster > tile_bytes) {
+ /* We'll have to do a partial line. */
+ dw = tile_bytes * 8 / depth;
+ size_x = dw * depth;
+ raster = bitmap_raster(size_x);
+ dh = 1;
+ goto fit;
+ }
}
/* Do as many lines as will fit. */
dw = w;
dh = tile_bytes / raster;
if (dh > h)
- dh = h;
+ dh = h;
fit: /* Now the tile will definitely fit. */
if (!no_rop) {
- tiles.data = (byte *)tbits;
- tiles.id = gx_no_bitmap_id;
- tiles.raster = raster;
- tiles.rep_width = tiles.size.x = size_x / depth;
- tiles.rep_shift = tiles.shift = 0;
+ tiles.data = (byte *)tbits;
+ tiles.id = gx_no_bitmap_id;
+ tiles.raster = raster;
+ tiles.rep_width = tiles.size.x = size_x / depth;
+ tiles.rep_shift = tiles.shift = 0;
}
while (w) {
- int cy = y, ch = dh, left = h;
-
- for (;;) {
- set_color_ht((byte *)tbits, raster,
- x + pdevc->phase.x, cy + pdevc->phase.y,
- dw, ch, depth, special, nplanes,
- pdevc->colors.colored.plane_mask,
- dev, &vp, colors, sbits);
- if (no_rop) {
- code = (*dev_proc(dev, copy_color))
- (dev, (byte *)tbits, 0, raster, gx_no_bitmap_id,
- x, cy, dw, ch);
- } else {
- tiles.rep_height = tiles.size.y = ch;
+ int cy = y, ch = dh, left = h;
+
+ for (;;) {
+ set_color_ht((byte *)tbits, raster,
+ x + pdevc->phase.x, cy + pdevc->phase.y,
+ dw, ch, depth, special, nplanes,
+ pdevc->colors.colored.plane_mask,
+ dev, &vp, colors, sbits);
+ if (no_rop) {
+ code = (*dev_proc(dev, copy_color))
+ (dev, (byte *)tbits, 0, raster, gx_no_bitmap_id,
+ x, cy, dw, ch);
+ } else {
+ tiles.rep_height = tiles.size.y = ch;
if (source == NULL)
set_rop_no_source(source, no_source, dev);
- /****** WRONG - MUST ADJUST source VALUES ******/
- code = (*dev_proc(dev, strip_copy_rop))
- (dev, source->sdata, source->sourcex, source->sraster,
- source->id,
- (source->use_scolors ? source->scolors : NULL),
- &tiles, NULL, x, cy, dw, ch, 0, 0, lop);
- }
- if (code < 0)
- return code;
- if (!(left -= ch))
- break;
- cy += ch;
- if (ch > left)
- ch = left;
- }
- if (!(w -= dw))
- break;
- x += dw;
- if (dw > w)
- dw = w;
+ /****** WRONG - MUST ADJUST source VALUES ******/
+ code = (*dev_proc(dev, strip_copy_rop))
+ (dev, source->sdata, source->sourcex, source->sraster,
+ source->id,
+ (source->use_scolors ? source->scolors : NULL),
+ &tiles, NULL, x, cy, dw, ch, 0, 0, lop);
+ }
+ if (code < 0)
+ return code;
+ if (!(left -= ch))
+ break;
+ cy += ch;
+ if (ch > left)
+ ch = left;
+ }
+ if (!(w -= dw))
+ break;
+ x += dw;
+ if (dw > w)
+ dw = w;
}
return code;
}
@@ -804,7 +801,7 @@ static const gx_const_strip_bitmap ht_no_bitmap = {
#define SET_PLANE_COLOR_CONSTANT(i)\
BEGIN\
pvp->values[1][i] = pvp->values[0][i] = \
- fractional_color(pdc->colors.colored.c_base[i], max_color);\
+ fractional_color(pdc->colors.colored.c_base[i], max_color);\
sbits[i] = &ht_no_bitmap;\
END
@@ -816,32 +813,32 @@ static const gx_const_strip_bitmap ht_no_bitmap = {
\
pvp->values[0][i] = fractional_color(q, max_color);\
if (r == 0)\
- pvp->values[1][i] = pvp->values[0][i], sbits[i] = &ht_no_bitmap;\
+ pvp->values[1][i] = pvp->values[0][i], sbits[i] = &ht_no_bitmap;\
else if (!invert) {\
- pvp->values[1][i] = fractional_color(q + 1, max_color);\
- sbits[i] = (const gx_const_strip_bitmap *)\
- &gx_render_ht(caches[i], r)->tiles;\
+ pvp->values[1][i] = fractional_color(q + 1, max_color);\
+ sbits[i] = (const gx_const_strip_bitmap *)\
+ &gx_render_ht(caches[i], r)->tiles;\
} else { \
- const gx_device_halftone *pdht = pdc->colors.colored.c_ht; \
- int nlevels =\
- (pdht->components ?\
- pdht->components[i].corder.num_levels :\
- pdht->order.num_levels);\
+ const gx_device_halftone *pdht = pdc->colors.colored.c_ht; \
+ int nlevels =\
+ (pdht->components ?\
+ pdht->components[i].corder.num_levels :\
+ pdht->order.num_levels);\
\
- pvp->values[1][i] = pvp->values[0][i]; \
- pvp->values[0][i] = fractional_color(q + 1, max_color); \
- sbits[i] = (const gx_const_strip_bitmap *)\
- &gx_render_ht(caches[i], nlevels - r)->tiles; \
+ pvp->values[1][i] = pvp->values[0][i]; \
+ pvp->values[0][i] = fractional_color(q + 1, max_color); \
+ sbits[i] = (const gx_const_strip_bitmap *)\
+ &gx_render_ht(caches[i], nlevels - r)->tiles; \
}\
END
/* Set up the colors and the individual plane halftone bitmaps. */
static int
set_ht_colors_le_4(color_values_pair_t *pvp /* only used internally */,
- gx_color_index colors[MAX_DCC_16] /* 16 used */,
- const gx_const_strip_bitmap * sbits[MAX_DCC],
- const gx_device_color * pdc, gx_device * dev,
- gx_ht_cache * caches[MAX_DCC], int nplanes)
+ gx_color_index colors[MAX_DCC_16] /* 16 used */,
+ const gx_const_strip_bitmap * sbits[MAX_DCC],
+ const gx_device_color * pdc, gx_device * dev,
+ gx_ht_cache * caches[MAX_DCC], int nplanes)
{
gx_color_value max_color = dev->color_info.dither_colors - 1;
gx_color_value cvalues[4];
@@ -863,45 +860,45 @@ set_ht_colors_le_4(color_values_pair_t *pvp /* only used internally */,
SET_PLANE_COLOR(2);
}
if (nplanes == 3) {
- gx_color_value alpha = pdc->colors.colored.alpha;
+ gx_color_value alpha = pdc->colors.colored.alpha;
- if (alpha == gx_max_color_value) {
+ if (alpha == gx_max_color_value) {
#define M(i)\
cvalues[0] = pvp->values[(i) & 1][0];\
cvalues[1] = pvp->values[((i) & 2) >> 1][1];\
cvalues[2] = pvp->values[(i) >> 2][2];\
colors[i] = dev_proc(dev, encode_color)(dev, cvalues);
- M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7);
+ M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7);
#undef M
- } else {
+ } else {
#define M(i)\
colors[i] = dev_proc(dev, map_rgb_alpha_color)(dev, pvp->values[(i) & 1][0],\
- pvp->values[((i) & 2) >> 1][1],\
- pvp->values[(i) >> 2][2], alpha)
- M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7);
+ pvp->values[((i) & 2) >> 1][1],\
+ pvp->values[(i) >> 2][2], alpha)
+ M(0); M(1); M(2); M(3); M(4); M(5); M(6); M(7);
#undef M
- }
+ }
} else if (nplanes > 3){
- SET_PLANE_COLOR(3);
- if (nplanes > 4) {
- /*
- * Set colors for any planes beyond the 4th. Since this code
- * only handles the case of at most 4 active planes, we know
- * that any further planes are constant.
- */
- /****** DOESN'T MAP COLORS RIGHT, DOESN'T HANDLE ALPHA ******/
- int pi;
-
- for (pi = 4; pi < nplanes; ++pi)
- SET_PLANE_COLOR_CONSTANT(pi);
- }
- /*
- * For CMYK output, especially if the input was RGB, it's
- * common for one or more of the components to be zero.
- * Each zero component can cut the cost of color mapping in
- * half, so it's worth doing a little checking here.
- */
+ SET_PLANE_COLOR(3);
+ if (nplanes > 4) {
+ /*
+ * Set colors for any planes beyond the 4th. Since this code
+ * only handles the case of at most 4 active planes, we know
+ * that any further planes are constant.
+ */
+ /****** DOESN'T MAP COLORS RIGHT, DOESN'T HANDLE ALPHA ******/
+ int pi;
+
+ for (pi = 4; pi < nplanes; ++pi)
+ SET_PLANE_COLOR_CONSTANT(pi);
+ }
+ /*
+ * For CMYK output, especially if the input was RGB, it's
+ * common for one or more of the components to be zero.
+ * Each zero component can cut the cost of color mapping in
+ * half, so it's worth doing a little checking here.
+ */
#define M(i)\
cvalues[0] = pvp->values[(i) & 1][0];\
cvalues[1] = pvp->values[((i) & 2) >> 1][1];\
@@ -910,49 +907,49 @@ set_ht_colors_le_4(color_values_pair_t *pvp /* only used internally */,
colors[i] = dev_proc(dev, encode_color)(dev, cvalues)
/* We know that plane_mask <= 15. */
- switch ((int)pdc->colors.colored.plane_mask) {
- case 15:
- M(15); M(14); M(13); M(12);
- M(11); M(10); M(9); M(8);
- case 7:
- M(7); M(6); M(5); M(4);
+ switch ((int)pdc->colors.colored.plane_mask) {
+ case 15:
+ M(15); M(14); M(13); M(12);
+ M(11); M(10); M(9); M(8);
+ case 7:
+ M(7); M(6); M(5); M(4);
c3: case 3:
- M(3); M(2);
+ M(3); M(2);
c1: case 1:
- M(1);
- break;
- case 14:
- M(14); M(12); M(10); M(8);
- case 6:
- M(6); M(4);
+ M(1);
+ break;
+ case 14:
+ M(14); M(12); M(10); M(8);
+ case 6:
+ M(6); M(4);
c2: case 2:
- M(2);
- break;
- case 13:
- M(13); M(12); M(9); M(8);
- case 5:
- M(5); M(4);
- goto c1;
- case 12:
- M(12); M(8);
- case 4:
- M(4);
- break;
- case 11:
- M(11); M(10); M(9); M(8);
- goto c3;
- case 10:
- M(10); M(8);
- goto c2;
- case 9:
- M(9); M(8);
- goto c1;
- case 8:
- M(8);
- break;
- case 0:;
- }
- M(0);
+ M(2);
+ break;
+ case 13:
+ M(13); M(12); M(9); M(8);
+ case 5:
+ M(5); M(4);
+ goto c1;
+ case 12:
+ M(12); M(8);
+ case 4:
+ M(4);
+ break;
+ case 11:
+ M(11); M(10); M(9); M(8);
+ goto c3;
+ case 10:
+ M(10); M(8);
+ goto c2;
+ case 9:
+ M(9); M(8);
+ goto c1;
+ case 8:
+ M(8);
+ break;
+ case 0:;
+ }
+ M(0);
#undef M
}
@@ -962,11 +959,11 @@ c2: case 2:
/* Set up colors using the standard 1-bit CMYK mapping. */
static int
set_cmyk_1bit_colors(color_values_pair_t *ignore_pvp,
- gx_color_index colors[MAX_DCC_16] /*2 used*/,
- const gx_const_strip_bitmap * sbits[MAX_DCC /*4 used*/],
- const gx_device_color * pdc, gx_device * dev,
- gx_ht_cache * caches[MAX_DCC /*4 used*/],
- int nplanes /*4*/)
+ gx_color_index colors[MAX_DCC_16] /*2 used*/,
+ const gx_const_strip_bitmap * sbits[MAX_DCC /*4 used*/],
+ const gx_device_color * pdc, gx_device * dev,
+ gx_ht_cache * caches[MAX_DCC /*4 used*/],
+ int nplanes /*4*/)
{
const gx_device_halftone *pdht = pdc->colors.colored.c_ht;
/*
@@ -986,21 +983,21 @@ set_cmyk_1bit_colors(color_values_pair_t *ignore_pvp,
uint r = pdc->colors.colored.c_level[i];\
\
if (r == 0) {\
- if (pdc->colors.colored.c_base[i])\
- mask0 |= mask, mask1 |= mask;\
- sbits[3 - i] = &ht_no_bitmap;\
+ if (pdc->colors.colored.c_base[i])\
+ mask0 |= mask, mask1 |= mask;\
+ sbits[3 - i] = &ht_no_bitmap;\
} else {\
- int nlevels =\
- (pdht->components ?\
- pdht->components[i].corder.num_levels :\
- pdht->order.num_levels);\
+ int nlevels =\
+ (pdht->components ?\
+ pdht->components[i].corder.num_levels :\
+ pdht->order.num_levels);\
\
- mask0 |= mask;\
- sbits[3 - i] = (const gx_const_strip_bitmap *)\
- &gx_render_ht(caches[i], nlevels - r)->tiles;\
+ mask0 |= mask;\
+ sbits[3 - i] = (const gx_const_strip_bitmap *)\
+ &gx_render_ht(caches[i], nlevels - r)->tiles;\
}\
END
- /* Suppress a compiler warning about signed/unsigned constants. */
+ /* Suppress a compiler warning about signed/unsigned constants. */
SET_PLANE_COLOR_CMYK(0, /*0x88888888*/ (bits32)~0x77777777);
SET_PLANE_COLOR_CMYK(1, 0x44444444);
SET_PLANE_COLOR_CMYK(2, 0x22222222);
@@ -1008,10 +1005,10 @@ set_cmyk_1bit_colors(color_values_pair_t *ignore_pvp,
#undef SET_PLANE_COLOR_CMYK
{
- gx_ht_cache *ctemp;
+ gx_ht_cache *ctemp;
- ctemp = caches[0], caches[0] = caches[3], caches[3] = ctemp;
- ctemp = caches[1], caches[1] = caches[2], caches[2] = ctemp;
+ ctemp = caches[0], caches[0] = caches[3], caches[3] = ctemp;
+ ctemp = caches[1], caches[1] = caches[2], caches[2] = ctemp;
}
colors[0] = mask0;
colors[1] = mask1;
@@ -1026,10 +1023,10 @@ set_cmyk_1bit_colors(color_values_pair_t *ignore_pvp,
*/
static int
set_ht_colors_gt_4(color_values_pair_t *pvp,
- gx_color_index colors[MAX_DCC_16 /* 2 * nplanes */],
- const gx_const_strip_bitmap * sbits[MAX_DCC],
- const gx_device_color * pdc, gx_device * dev,
- gx_ht_cache * caches[MAX_DCC], int nplanes)
+ gx_color_index colors[MAX_DCC_16 /* 2 * nplanes */],
+ const gx_const_strip_bitmap * sbits[MAX_DCC],
+ const gx_device_color * pdc, gx_device * dev,
+ gx_ht_cache * caches[MAX_DCC], int nplanes)
{
gx_color_value max_color = dev->color_info.dither_colors - 1;
bool invert = dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE;
@@ -1039,10 +1036,10 @@ set_ht_colors_gt_4(color_values_pair_t *pvp,
/* Set the color values and halftone caches. */
for (i = 0; i < nplanes; ++i)
- if ((plane_mask >> i) & 1)
- SET_PLANE_COLOR(i);
- else
- SET_PLANE_COLOR_CONSTANT(i);
+ if ((plane_mask >> i) & 1)
+ SET_PLANE_COLOR(i);
+ else
+ SET_PLANE_COLOR_CONSTANT(i);
/*
* Determine a gs_color_index value for each pair of component values.
@@ -1052,14 +1049,14 @@ set_ht_colors_gt_4(color_values_pair_t *pvp,
* in adjacent locations in 'colors'.
*/
for (i = 0; i < nplanes; i++ ) {
- cv[i] = pvp->values[0][i];
- colors[2 * i] = dev_proc(dev, encode_color)(dev, cv);
- /* We only need both values for components being halftoned */
- if ((plane_mask >> i) & 1) {
- cv[i] = pvp->values[1][i];
- colors[2 * i + 1] = dev_proc(dev, encode_color)(dev, cv);
- }
- cv[i] = 0;
+ cv[i] = pvp->values[0][i];
+ colors[2 * i] = dev_proc(dev, encode_color)(dev, cv);
+ /* We only need both values for components being halftoned */
+ if ((plane_mask >> i) & 1) {
+ cv[i] = pvp->values[1][i];
+ colors[2 * i + 1] = dev_proc(dev, encode_color)(dev, cv);
+ }
+ cv[i] = 0;
}
return 0;
@@ -1087,11 +1084,11 @@ typedef struct tile_cursor_s {
*/
static void
init_tile_cursor(int i, tile_cursor_t *ptc, const gx_const_strip_bitmap *btile,
- int endx, int lasty)
+ int endx, int lasty)
{
int tw = btile->size.x;
int bx = ((ptc->tile_shift = btile->shift) == 0 ? endx :
- endx + lasty / btile->size.y * ptc->tile_shift) % tw;
+ endx + lasty / btile->size.y * ptc->tile_shift) % tw;
int by = lasty % btile->size.y;
ptc->xoffset = bx >> 3;
@@ -1104,7 +1101,7 @@ init_tile_cursor(int i, tile_cursor_t *ptc, const gx_const_strip_bitmap *btile,
ptc->data = ptc->row + ptc->xoffset;
ptc->bit_shift = ptc->xshift;
if_debug6('h', "[h]plane %d: size=%d,%d shift=%d bx=%d by=%d\n",
- i, tw, btile->size.y, btile->shift, bx, by);
+ i, tw, btile->size.y, btile->shift, bx, by);
}
/* Step a cursor to the next row. */
@@ -1113,17 +1110,17 @@ wrap_shifted_cursor(tile_cursor_t *ptc, const gx_const_strip_bitmap *psbit)
{
ptc->row += ptc->raster * (psbit->size.y - 1);
if (ptc->tile_shift) {
- if ((ptc->xshift += ptc->tile_shift) >= 8) {
- if ((ptc->xoffset -= ptc->xshift >> 3) < 0) {
- /* wrap around in X */
- int bx = (ptc->xoffset << 3) + 8 - (ptc->xshift & 7) +
- psbit->size.x;
-
- ptc->xoffset = bx >> 3;
- ptc->xshift = 8 - (bx & 7);
- } else
- ptc->xshift &= 7;
- }
+ if ((ptc->xshift += ptc->tile_shift) >= 8) {
+ if ((ptc->xoffset -= ptc->xshift >> 3) < 0) {
+ /* wrap around in X */
+ int bx = (ptc->xoffset << 3) + 8 - (ptc->xshift & 7) +
+ psbit->size.x;
+
+ ptc->xoffset = bx >> 3;
+ ptc->xshift = 8 - (bx & 7);
+ } else
+ ptc->xshift &= 7;
+ }
}
}
#define STEP_ROW(c, i)\
@@ -1131,7 +1128,7 @@ wrap_shifted_cursor(tile_cursor_t *ptc, const gx_const_strip_bitmap *psbit)
if (c.row > c.tdata)\
c.row -= c.raster;\
else { /* wrap around to end of tile */\
- wrap_shifted_cursor(&c, sbits[i]);\
+ wrap_shifted_cursor(&c, sbits[i]);\
}\
c.data = c.row + c.xoffset;\
c.bit_shift = c.xshift;\
@@ -1154,11 +1151,11 @@ static const bits32 expand_8x1_to_8x4[256] = {
*/
static void
set_color_ht_le_4(byte *dest_data, uint dest_raster, int px, int py,
- int w, int h, int depth, int special, int nplanes,
- gx_color_index plane_mask, gx_device *ignore_dev,
- const color_values_pair_t *ignore_pvp,
- gx_color_index colors[MAX_DCC_16],
- const gx_const_strip_bitmap * sbits[MAX_DCC])
+ int w, int h, int depth, int special, int nplanes,
+ gx_color_index plane_mask, gx_device *ignore_dev,
+ const color_values_pair_t *ignore_pvp,
+ gx_color_index colors[MAX_DCC_16],
+ const gx_const_strip_bitmap * sbits[MAX_DCC])
{
/*
* Note that the planes are specified in the order RGB or CMYK, but
@@ -1169,41 +1166,41 @@ set_color_ht_le_4(byte *dest_data, uint dest_raster, int px, int py,
tile_cursor_t cursor[MAX_DCC];
int dbytes = depth >> 3;
byte *dest_row =
- dest_data + dest_raster * (h - 1) + (w * depth) / 8;
+ dest_data + dest_raster * (h - 1) + (w * depth) / 8;
if (special > 0) {
- /* Planes are in reverse order. */
- plane_mask =
- "\000\010\004\014\002\012\006\016\001\011\005\015\003\013\007\017"[plane_mask];
+ /* Planes are in reverse order. */
+ plane_mask =
+ "\000\010\004\014\002\012\006\016\001\011\005\015\003\013\007\017"[plane_mask];
}
if_debug6('h',
- "[h]color_ht_le_4: x=%d y=%d w=%d h=%d plane_mask=0x%lu depth=%d\n",
- px, py, w, h, (ulong)plane_mask, depth);
+ "[h]color_ht_le_4: x=%d y=%d w=%d h=%d plane_mask=0x%lu depth=%d\n",
+ px, py, w, h, (ulong)plane_mask, depth);
/* Do one-time cursor initialization. */
{
- int endx = w + px;
- int lasty = h - 1 + py;
-
- if (plane_mask & 1)
- init_tile_cursor(0, &cursor[0], sbits[0], endx, lasty);
- if (plane_mask & 2)
- init_tile_cursor(1, &cursor[1], sbits[1], endx, lasty);
- if (plane_mask & 4)
- init_tile_cursor(2, &cursor[2], sbits[2], endx, lasty);
- if (plane_mask & 8)
- init_tile_cursor(3, &cursor[3], sbits[3], endx, lasty);
+ int endx = w + px;
+ int lasty = h - 1 + py;
+
+ if (plane_mask & 1)
+ init_tile_cursor(0, &cursor[0], sbits[0], endx, lasty);
+ if (plane_mask & 2)
+ init_tile_cursor(1, &cursor[1], sbits[1], endx, lasty);
+ if (plane_mask & 4)
+ init_tile_cursor(2, &cursor[2], sbits[2], endx, lasty);
+ if (plane_mask & 8)
+ init_tile_cursor(3, &cursor[3], sbits[3], endx, lasty);
}
/* Now compute the actual tile. */
for (y = h; ; dest_row -= dest_raster) {
- byte *dest = dest_row;
+ byte *dest = dest_row;
- --y;
- for (x = w; x > 0;) {
- bits32 indices;
- int nx, i;
- register uint bits;
+ --y;
+ for (x = w; x > 0;) {
+ bits32 indices;
+ int nx, i;
+ register uint bits;
/* Get the next byte's worth of bits. Note that there may be */
/* excess bits set beyond the 8th. */
@@ -1216,125 +1213,125 @@ set_color_ht_le_4(byte *dest_data, uint dest_raster, int px, int py,
bits = *c.data >> c.bit_shift;\
c.data += c.xbytes;\
if ((c.bit_shift -= c.xbits) < 0) {\
- bits |= *c.data << -c.bit_shift;\
- c.bit_shift += 8;\
+ bits |= *c.data << -c.bit_shift;\
+ c.bit_shift += 8;\
} else {\
- bits |= ((c.data[-1] << 8) | *c.data) >> c.bit_shift;\
- c.data--;\
+ bits |= ((c.data[-1] << 8) | *c.data) >> c.bit_shift;\
+ c.data--;\
}\
}\
END
- if (plane_mask & 1) {
- NEXT_BITS(cursor[0]);
- indices = expand_8x1_to_8x4[bits & 0xff];
- } else
- indices = 0;
- if (plane_mask & 2) {
- NEXT_BITS(cursor[1]);
- indices |= expand_8x1_to_8x4[bits & 0xff] << 1;
- }
- if (plane_mask & 4) {
- NEXT_BITS(cursor[2]);
- indices |= expand_8x1_to_8x4[bits & 0xff] << 2;
- }
- if (plane_mask & 8) {
- NEXT_BITS(cursor[3]);
- indices |= expand_8x1_to_8x4[bits & 0xff] << 3;
- }
+ if (plane_mask & 1) {
+ NEXT_BITS(cursor[0]);
+ indices = expand_8x1_to_8x4[bits & 0xff];
+ } else
+ indices = 0;
+ if (plane_mask & 2) {
+ NEXT_BITS(cursor[1]);
+ indices |= expand_8x1_to_8x4[bits & 0xff] << 1;
+ }
+ if (plane_mask & 4) {
+ NEXT_BITS(cursor[2]);
+ indices |= expand_8x1_to_8x4[bits & 0xff] << 2;
+ }
+ if (plane_mask & 8) {
+ NEXT_BITS(cursor[3]);
+ indices |= expand_8x1_to_8x4[bits & 0xff] << 3;
+ }
#undef NEXT_BITS
- nx = min(x, 8); /* 1 <= nx <= 8 */
- x -= nx;
- switch (dbytes) {
- case 0: /* 4 */
- if (special > 0) {
- /* Special 1-bit CMYK. */
- /* Compute all the pixels at once! */
- indices =
- (indices & colors[1]) | (~indices & colors[0]);
- i = nx;
- if ((x + nx) & 1) {
- /* First pixel is even nibble. */
- *dest = (*dest & 0xf) +
- ((indices & 0xf) << 4);
- indices >>= 4;
- --i;
- }
- /* Now 0 <= i <= 8. */
- for (; (i -= 2) >= 0; indices >>= 8)
- *--dest = (byte)indices;
- /* Check for final odd nibble. */
- if (i & 1)
- *--dest = indices & 0xf;
- } else {
- /* Other 4-bit pixel */
- i = nx;
- if ((x + nx) & 1) {
- /* First pixel is even nibble. */
- *dest = (*dest & 0xf) +
- ((byte)colors[indices & 0xf] << 4);
- indices >>= 4;
- --i;
- }
- /* Now 0 <= i <= 8. */
- for (; (i -= 2) >= 0; indices >>= 8)
- *--dest =
- (byte)colors[indices & 0xf] +
- ((byte)colors[(indices >> 4) & 0xf]
- << 4);
- /* Check for final odd nibble. */
- if (i & 1)
- *--dest = (byte)colors[indices & 0xf];
- }
- break;
- case 4: /* 32 */
- for (i = nx; --i >= 0; indices >>= 4) {
- bits32 tcolor = (bits32)colors[indices & 0xf];
-
- dest -= 4;
- dest[3] = (byte)tcolor;
- dest[2] = (byte)(tcolor >> 8);
- tcolor >>= 16;
- dest[1] = (byte)tcolor;
- dest[0] = (byte)(tcolor >> 8);
- }
- break;
- case 3: /* 24 */
- for (i = nx; --i >= 0; indices >>= 4) {
- bits32 tcolor = (bits32)colors[indices & 0xf];
-
- dest -= 3;
- dest[2] = (byte) tcolor;
- dest[1] = (byte)(tcolor >> 8);
- dest[0] = (byte)(tcolor >> 16);
- }
- break;
- case 2: /* 16 */
- for (i = nx; --i >= 0; indices >>= 4) {
- uint tcolor =
- (uint)colors[indices & 0xf];
-
- dest -= 2;
- dest[1] = (byte)tcolor;
- dest[0] = (byte)(tcolor >> 8);
- }
- break;
- case 1: /* 8 */
- for (i = nx; --i >= 0; indices >>= 4)
- *--dest = (byte)colors[indices & 0xf];
- break;
- }
- }
- if (y == 0)
- break;
-
- if (plane_mask & 1)
- STEP_ROW(cursor[0], 0);
- if (plane_mask & 2)
- STEP_ROW(cursor[1], 1);
- if (plane_mask & 4)
- STEP_ROW(cursor[2], 2);
- if (plane_mask & 8)
- STEP_ROW(cursor[3], 3);
+ nx = min(x, 8); /* 1 <= nx <= 8 */
+ x -= nx;
+ switch (dbytes) {
+ case 0: /* 4 */
+ if (special > 0) {
+ /* Special 1-bit CMYK. */
+ /* Compute all the pixels at once! */
+ indices =
+ (indices & colors[1]) | (~indices & colors[0]);
+ i = nx;
+ if ((x + nx) & 1) {
+ /* First pixel is even nibble. */
+ *dest = (*dest & 0xf) +
+ ((indices & 0xf) << 4);
+ indices >>= 4;
+ --i;
+ }
+ /* Now 0 <= i <= 8. */
+ for (; (i -= 2) >= 0; indices >>= 8)
+ *--dest = (byte)indices;
+ /* Check for final odd nibble. */
+ if (i & 1)
+ *--dest = indices & 0xf;
+ } else {
+ /* Other 4-bit pixel */
+ i = nx;
+ if ((x + nx) & 1) {
+ /* First pixel is even nibble. */
+ *dest = (*dest & 0xf) +
+ ((byte)colors[indices & 0xf] << 4);
+ indices >>= 4;
+ --i;
+ }
+ /* Now 0 <= i <= 8. */
+ for (; (i -= 2) >= 0; indices >>= 8)
+ *--dest =
+ (byte)colors[indices & 0xf] +
+ ((byte)colors[(indices >> 4) & 0xf]
+ << 4);
+ /* Check for final odd nibble. */
+ if (i & 1)
+ *--dest = (byte)colors[indices & 0xf];
+ }
+ break;
+ case 4: /* 32 */
+ for (i = nx; --i >= 0; indices >>= 4) {
+ bits32 tcolor = (bits32)colors[indices & 0xf];
+
+ dest -= 4;
+ dest[3] = (byte)tcolor;
+ dest[2] = (byte)(tcolor >> 8);
+ tcolor >>= 16;
+ dest[1] = (byte)tcolor;
+ dest[0] = (byte)(tcolor >> 8);
+ }
+ break;
+ case 3: /* 24 */
+ for (i = nx; --i >= 0; indices >>= 4) {
+ bits32 tcolor = (bits32)colors[indices & 0xf];
+
+ dest -= 3;
+ dest[2] = (byte) tcolor;
+ dest[1] = (byte)(tcolor >> 8);
+ dest[0] = (byte)(tcolor >> 16);
+ }
+ break;
+ case 2: /* 16 */
+ for (i = nx; --i >= 0; indices >>= 4) {
+ uint tcolor =
+ (uint)colors[indices & 0xf];
+
+ dest -= 2;
+ dest[1] = (byte)tcolor;
+ dest[0] = (byte)(tcolor >> 8);
+ }
+ break;
+ case 1: /* 8 */
+ for (i = nx; --i >= 0; indices >>= 4)
+ *--dest = (byte)colors[indices & 0xf];
+ break;
+ }
+ }
+ if (y == 0)
+ break;
+
+ if (plane_mask & 1)
+ STEP_ROW(cursor[0], 0);
+ if (plane_mask & 2)
+ STEP_ROW(cursor[1], 1);
+ if (plane_mask & 4)
+ STEP_ROW(cursor[2], 2);
+ if (plane_mask & 8)
+ STEP_ROW(cursor[3], 3);
}
}
@@ -1345,106 +1342,106 @@ set_color_ht_le_4(byte *dest_data, uint dest_raster, int px, int py,
*/
static void
set_color_ht_gt_4(byte *dest_data, uint dest_raster, int px, int py,
- int w, int h, int depth, int special, int num_planes,
- gx_color_index plane_mask, gx_device *dev,
- const color_values_pair_t *pvp,
- gx_color_index colors[MAX_DCC_16],
- const gx_const_strip_bitmap * sbits[MAX_DCC])
+ int w, int h, int depth, int special, int num_planes,
+ gx_color_index plane_mask, gx_device *dev,
+ const color_values_pair_t *pvp,
+ gx_color_index colors[MAX_DCC_16],
+ const gx_const_strip_bitmap * sbits[MAX_DCC])
{
int x, y;
tile_cursor_t cursor[MAX_DCC];
int dbytes = depth >> 3;
byte *dest_row =
- dest_data + dest_raster * (h - 1) + (w * depth) / 8;
+ dest_data + dest_raster * (h - 1) + (w * depth) / 8;
int pmin, pmax;
gx_color_index base_color = 0;
/* Compute the range of active planes. */
if (plane_mask == 0)
- pmin = 0, pmax = -1;
+ pmin = 0, pmax = -1;
else {
- for (pmin = 0; !((plane_mask >> pmin) & 1); )
- ++pmin;
- for (pmax = 0; (plane_mask >> pmax) > 1; )
- ++pmax;
+ for (pmin = 0; !((plane_mask >> pmin) & 1); )
+ ++pmin;
+ for (pmax = 0; (plane_mask >> pmax) > 1; )
+ ++pmax;
}
if_debug6('h',
- "[h]color_ht_gt_4: x=%d y=%d w=%d h=%d plane_mask=0x%lu depth=%d\n",
- px, py, w, h, (ulong)plane_mask, depth);
+ "[h]color_ht_gt_4: x=%d y=%d w=%d h=%d plane_mask=0x%lu depth=%d\n",
+ px, py, w, h, (ulong)plane_mask, depth);
/* Do one-time cursor initialization. */
{
- int endx = w + px;
- int lasty = h - 1 + py;
- int i;
+ int endx = w + px;
+ int lasty = h - 1 + py;
+ int i;
- for (i = pmin; i <= pmax; ++i)
- if ((plane_mask >> i) & 1)
- init_tile_cursor(i, &cursor[i], sbits[i], endx, lasty);
+ for (i = pmin; i <= pmax; ++i)
+ if ((plane_mask >> i) & 1)
+ init_tile_cursor(i, &cursor[i], sbits[i], endx, lasty);
}
/* Pre-load the color value for the non halftoning planes. */
{
- int i;
+ int i;
- for (i = 0; i < num_planes; ++i)
- if ((~plane_mask >> i) & 1)
- base_color |= colors[2 * i];
+ for (i = 0; i < num_planes; ++i)
+ if ((~plane_mask >> i) & 1)
+ base_color |= colors[2 * i];
}
/* Now compute the actual tile. */
for (y = h; ; dest_row -= dest_raster) {
- byte *dest = dest_row;
- int i;
+ byte *dest = dest_row;
+ int i;
- --y;
- for (x = w; x > 0;) {
- gx_color_index tcolor = base_color;
+ --y;
+ for (x = w; x > 0;) {
+ gx_color_index tcolor = base_color;
- for (i = pmin; i <= pmax; ++i)
- if ((plane_mask >> i) & 1) {
- /* Get the next bit from an individual mask. */
- tile_cursor_t *ptc = &cursor[i];
- byte tile_bit;
+ for (i = pmin; i <= pmax; ++i)
+ if ((plane_mask >> i) & 1) {
+ /* Get the next bit from an individual mask. */
+ tile_cursor_t *ptc = &cursor[i];
+ byte tile_bit;
b: if (ptc->bit_shift < 8)
- tile_bit = *ptc->data >> ptc->bit_shift++;
- else if (ptc->data > ptc->row) {
- tile_bit = *--(ptc->data);
- ptc->bit_shift = 1;
- } else {
- /* Wrap around. */
- ptc->data += ptc->xbytes;
- ptc->bit_shift = 8 - ptc->xbits;
- goto b;
- }
- tcolor |= colors[2 * i + (tile_bit & 1)];
- }
- --x;
- switch (dbytes) {
- case 0: /* 4 -- might be 2, but we don't support this */
- if (x & 1) { /* odd nibble */
- *--dest = (byte)tcolor;
- } else { /* even nibble */
- *dest = (*dest & 0xf) + ((byte)tcolor << 4);
- }
- break;
- case 4: /* 32 */
- dest[-4] = (byte)(tcolor >> 24);
- case 3: /* 24 */
- dest[-3] = (byte)(tcolor >> 16);
- case 2: /* 16 */
- dest[-2] = (byte)(tcolor >> 8);
- case 1: /* 8 */
- dest[-1] = (byte)tcolor;
- dest -= dbytes;
- break;
- }
- }
- if (y == 0)
- break;
- for (i = pmin; i <= pmax; ++i)
- if ((plane_mask >> i) & 1)
- STEP_ROW(cursor[i], i);
+ tile_bit = *ptc->data >> ptc->bit_shift++;
+ else if (ptc->data > ptc->row) {
+ tile_bit = *--(ptc->data);
+ ptc->bit_shift = 1;
+ } else {
+ /* Wrap around. */
+ ptc->data += ptc->xbytes;
+ ptc->bit_shift = 8 - ptc->xbits;
+ goto b;
+ }
+ tcolor |= colors[2 * i + (tile_bit & 1)];
+ }
+ --x;
+ switch (dbytes) {
+ case 0: /* 4 -- might be 2, but we don't support this */
+ if (x & 1) { /* odd nibble */
+ *--dest = (byte)tcolor;
+ } else { /* even nibble */
+ *dest = (*dest & 0xf) + ((byte)tcolor << 4);
+ }
+ break;
+ case 4: /* 32 */
+ dest[-4] = (byte)(tcolor >> 24);
+ case 3: /* 24 */
+ dest[-3] = (byte)(tcolor >> 16);
+ case 2: /* 16 */
+ dest[-2] = (byte)(tcolor >> 8);
+ case 1: /* 8 */
+ dest[-1] = (byte)tcolor;
+ dest -= dbytes;
+ break;
+ }
+ }
+ if (y == 0)
+ break;
+ for (i = pmin; i <= pmax; ++i)
+ if ((plane_mask >> i) & 1)
+ STEP_ROW(cursor[i], i);
}
}
diff --git a/gs/base/gxcid.h b/gs/base/gxcid.h
index 3a0f83964..342d877b0 100644
--- a/gs/base/gxcid.h
+++ b/gs/base/gxcid.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxcie.h b/gs/base/gxcie.h
index a98ef97b5..c9ab8dd37 100644
--- a/gs/base/gxcie.h
+++ b/gs/base/gxcie.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,7 @@ cs_proc_install_cspace(gx_install_CIEA);
* semi-hack for the PDF writer.
*/
extern int gx_cie_to_xyz_alloc(gs_imager_state **,
- const gs_color_space *, gs_memory_t *);
+ const gs_color_space *, gs_memory_t *);
extern void gx_cie_to_xyz_free(gs_imager_state *);
extern int gx_cie_to_xyz_alloc2(gs_color_space * pcs, gs_state * pgs);
@@ -69,9 +69,9 @@ int gx_cie_check_rendering(const gs_color_space * pcs, frac * pconc, const gs_im
* structure.
*/
extern int gx_cie_remap_finish( cie_cached_vector3,
- frac *,
- const gs_imager_state *,
- const gs_color_space * );
+ frac *,
+ const gs_imager_state *,
+ const gs_color_space * );
/* Make sure the prototype matches the one defined in gscie.h. */
extern GX_CIE_REMAP_FINISH_PROC(gx_cie_remap_finish);
@@ -105,7 +105,7 @@ extern_st(st_cie_common_elements_t);
/* set up the common default values for a CIE color space */
extern void gx_set_common_cie_defaults( gs_cie_common *,
- void * client_data );
+ void * client_data );
/* Load the common caches for a CIE color space */
extern void gx_cie_load_common_cache(gs_cie_common *, gs_state *);
@@ -118,9 +118,9 @@ cs_proc_install_cspace(gx_install_CIE);
/* allocate and initialize the common part of a cie color space */
extern void * gx_build_cie_space( gs_color_space ** ppcspace,
- const gs_color_space_type * pcstype,
- gs_memory_type_ptr_t stype,
- gs_memory_t * pmem );
+ const gs_color_space_type * pcstype,
+ gs_memory_type_ptr_t stype,
+ gs_memory_t * pmem );
/*
* Determine the concrete space which underlies a CIE based space. For all
@@ -130,16 +130,16 @@ extern void * gx_build_cie_space( gs_color_space ** ppcspace,
*/
cs_proc_concrete_space(gx_concrete_space_CIE);
-/* Special operations used in the creation of ICC color spaces from PS
+/* Special operations used in the creation of ICC color spaces from PS
spaces. These are used to map from PS color to CIEXYZ */
int gx_psconcretize_CIEDEFG(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis);
+ frac * pconc, const gs_imager_state * pis);
int gx_psconcretize_CIEDEF(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis);
+ frac * pconc, const gs_imager_state * pis);
int gx_psconcretize_CIEABC(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis);
+ frac * pconc, const gs_imager_state * pis);
int gx_psconcretize_CIEA(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis);
+ frac * pconc, const gs_imager_state * pis);
bool check_range(gs_range *ranges, int num_colorants);
bool check_cie_range( const gs_color_space * pcs );
gs_range* get_cie_range( const gs_color_space * pcs );
diff --git a/gs/base/gxcindex.h b/gs/base/gxcindex.h
index 6598e33d7..ca7701e60 100644
--- a/gs/base/gxcindex.h
+++ b/gs/base/gxcindex.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -106,30 +106,30 @@ typedef gx_color_index_data gx_color_index;
* l_dbit. Other code in the loop may use these variables.
*/
#define DECLARE_LINE_ACCUM(line, bpp, xo)\
- sample_store_declare_setup(l_dptr, l_dbit, l_dbyte, line, 0, bpp)
+ sample_store_declare_setup(l_dptr, l_dbit, l_dbyte, line, 0, bpp)
#define LINE_ACCUM(color, bpp)\
- sample_store_next_any(color, l_dptr, l_dbit, bpp, l_dbyte)
+ sample_store_next_any(color, l_dptr, l_dbit, bpp, l_dbyte)
#define LINE_ACCUM_SKIP(bpp)\
- sample_store_skip_next(l_dptr, l_dbit, bpp, l_dbyte)
+ sample_store_skip_next(l_dptr, l_dbit, bpp, l_dbyte)
#define LINE_ACCUM_STORE(bpp)\
- sample_store_flush(l_dptr, l_dbit, bpp, l_dbyte)
+ sample_store_flush(l_dptr, l_dbit, bpp, l_dbyte)
/*
* Declare additional macros for accumulating a scan line with copying
* to a device. Note that DECLARE_LINE_ACCUM_COPY also declares l_xprev.
* LINE_ACCUM_COPY is called after the accumulation loop.
*/
#define DECLARE_LINE_ACCUM_COPY(line, bpp, xo)\
- DECLARE_LINE_ACCUM(line, bpp, xo);\
- int l_xprev = (xo)
+ DECLARE_LINE_ACCUM(line, bpp, xo);\
+ int l_xprev = (xo)
#define LINE_ACCUM_COPY(dev, line, bpp, xo, xe, raster, y)\
- if ( (xe) > l_xprev ) {\
- int code;\
- LINE_ACCUM_STORE(bpp);\
- code = (*dev_proc(dev, copy_color))\
- (dev, line, l_xprev - (xo), raster,\
- gx_no_bitmap_id, l_xprev, y, (xe) - l_xprev, 1);\
- if ( code < 0 )\
- return code;\
- }
+ if ( (xe) > l_xprev ) {\
+ int code;\
+ LINE_ACCUM_STORE(bpp);\
+ code = (*dev_proc(dev, copy_color))\
+ (dev, line, l_xprev - (xo), raster,\
+ gx_no_bitmap_id, l_xprev, y, (xe) - l_xprev, 1);\
+ if ( code < 0 )\
+ return code;\
+ }
#endif /* gxcindex_INCLUDED */
diff --git a/gs/base/gxclbits.c b/gs/base/gxclbits.c
index 0b624797d..ff8b34ef8 100644
--- a/gs/base/gxclbits.c
+++ b/gs/base/gxclbits.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,23 +43,23 @@
*/
uint
clist_bitmap_bytes(uint width_bits, uint height, int compression_mask,
- uint * width_bytes, uint * raster)
+ uint * width_bytes, uint * raster)
{
uint full_raster = *raster = bitmap_raster(width_bits);
uint short_raster = (width_bits + 7) >> 3;
uint width_bytes_last;
if (compression_mask & cmd_mask_compress_any)
- *width_bytes = width_bytes_last = full_raster;
+ *width_bytes = width_bytes_last = full_raster;
else if (short_raster <= cmd_max_short_width_bytes ||
- height <= 1 ||
- (compression_mask & decompress_spread) != 0
- )
- *width_bytes = width_bytes_last = short_raster;
+ height <= 1 ||
+ (compression_mask & decompress_spread) != 0
+ )
+ *width_bytes = width_bytes_last = short_raster;
else
- *width_bytes = full_raster, width_bytes_last = short_raster;
+ *width_bytes = full_raster, width_bytes_last = short_raster;
return
- (height == 0 ? 0 : *width_bytes * (height - 1) + width_bytes_last);
+ (height == 0 ? 0 : *width_bytes * (height - 1) + width_bytes_last);
}
/*
@@ -68,7 +68,7 @@ clist_bitmap_bytes(uint width_bits, uint height, int compression_mask,
*/
static int
cmd_compress_bitmap(stream_state * st, const byte * data, uint width_bits,
- uint raster, uint height, stream_cursor_write * pw)
+ uint raster, uint height, stream_cursor_write * pw)
{
uint width_bytes = bitmap_raster(width_bits);
int status = 0;
@@ -76,27 +76,27 @@ cmd_compress_bitmap(stream_state * st, const byte * data, uint width_bits,
r.ptr = data - 1;
if (raster == width_bytes) {
- r.limit = r.ptr + raster * height;
- status = (*st->template->process) (st, &r, pw, true);
+ r.limit = r.ptr + raster * height;
+ status = (*st->template->process) (st, &r, pw, true);
} else { /* Compress row-by-row. */
- uint y;
-
- for (y = 1; (r.limit = r.ptr + width_bytes), y < height; ++y) {
- status = (*st->template->process) (st, &r, pw, false);
- if (status)
- break;
- if (r.ptr != r.limit) { /* We don't attempt to handle compressors that */
- /* require >1 input byte to make progress. */
- status = -1;
- break;
- }
- r.ptr += raster - width_bytes;
- }
- if (status == 0)
- status = (*st->template->process) (st, &r, pw, true);
+ uint y;
+
+ for (y = 1; (r.limit = r.ptr + width_bytes), y < height; ++y) {
+ status = (*st->template->process) (st, &r, pw, false);
+ if (status)
+ break;
+ if (r.ptr != r.limit) { /* We don't attempt to handle compressors that */
+ /* require >1 input byte to make progress. */
+ status = -1;
+ break;
+ }
+ r.ptr += raster - width_bytes;
+ }
+ if (status == 0)
+ status = (*st->template->process) (st, &r, pw, true);
}
if (st->template->release)
- (*st->template->release) (st);
+ (*st->template->release) (st);
return status;
}
@@ -112,17 +112,17 @@ cmd_compress_bitmap(stream_state * st, const byte * data, uint width_bits,
int
cmd_put_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
const byte * data, uint width_bits, uint height, uint raster, int op_size,
- int compression_mask, byte ** pdp, uint * psize)
+ int compression_mask, byte ** pdp, uint * psize)
{
uint short_raster, full_raster;
uint short_size =
clist_bitmap_bytes(width_bits, height,
- compression_mask & ~cmd_mask_compress_any,
- &short_raster, &full_raster);
+ compression_mask & ~cmd_mask_compress_any,
+ &short_raster, &full_raster);
uint uncompressed_raster;
uint uncompressed_size =
clist_bitmap_bytes(width_bits, height, compression_mask,
- &uncompressed_raster, &full_raster);
+ &uncompressed_raster, &full_raster);
uint max_size = cbuf_size - op_size;
gs_memory_t *mem = cldev->memory;
byte *dp;
@@ -135,101 +135,101 @@ cmd_put_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
* in the buffer and decompress_elsewhere isn't set.
*/
if (short_size >= 50 &&
- (compression_mask & cmd_mask_compress_any) != 0 &&
- (uncompressed_size <= max_size ||
- (compression_mask & decompress_elsewhere) != 0)
- ) {
- union ss_ {
- stream_state ss;
- stream_CFE_state cf;
- stream_RLE_state rl;
- } sstate;
- int code;
- int try_size = op_size + min(uncompressed_size, max_size);
-
- *psize = try_size;
- code = (pcls != 0 ?
- set_cmd_put_op(dp, cldev, pcls, 0, try_size) :
- set_cmd_put_all_op(dp, cldev, 0, try_size));
- if (code < 0)
- return code;
- cmd_uncount_op(0, try_size);
- /*
- * Note that we currently keep all the padding if we are
- * compressing. This is ridiculous, but it's too hard to
- * change right now.
- */
- if (compression_mask & (1 << cmd_compress_cfe)) {
- /* Try CCITTFax compression. */
- clist_cfe_init(&sstate.cf,
- uncompressed_raster << 3 /*width_bits*/,
- mem);
- compress = cmd_compress_cfe;
- } else if (compression_mask & (1 << cmd_compress_rle)) {
- /* Try RLE compression. */
- clist_rle_init(&sstate.rl);
- compress = cmd_compress_rle;
- }
- if (compress) {
- byte *wbase = dp + (op_size - 1);
- stream_cursor_write w;
-
- /*
- * We can give up on compressing if we generate too much
- * output to fit in the command reading buffer, or too
- * much to make compression worthwhile.
- */
- uint wmax = min(uncompressed_size, max_size);
- int status;
-
- w.ptr = wbase;
- w.limit = w.ptr + min(wmax, short_size >> 1);
- status = cmd_compress_bitmap((stream_state *) & sstate, data,
- uncompressed_raster << 3 /*width_bits */ ,
- raster, height, &w);
- if (status == 0) { /* Use compressed representation. */
- uint wcount = w.ptr - wbase;
-
- cmd_shorten_list_op(cldev,
- (pcls ? &pcls->list : &cldev->band_range_list),
- try_size - (op_size + wcount));
- *psize = op_size + wcount;
- goto out;
- }
- }
- if (uncompressed_size > max_size) {
- /* Shorten to zero, erasing the operation altogether */
- if_debug1 ('L', "[L]Uncompressed bits %u too large for buffer\n",
- uncompressed_size);
- cmd_shorten_list_op(cldev,
- (pcls ? &pcls->list : &cldev->band_range_list),
- try_size);
- return_error(gs_error_limitcheck);
- }
- if (uncompressed_size != short_size) {
- if_debug2 ('L', "[L]Shortening bits from %u to %u\n",
- try_size, op_size + short_size);
- cmd_shorten_list_op(cldev,
- (pcls ? &pcls->list : &cldev->band_range_list),
- try_size - (op_size + short_size));
- *psize = op_size + short_size;
- }
- compress = 0;
+ (compression_mask & cmd_mask_compress_any) != 0 &&
+ (uncompressed_size <= max_size ||
+ (compression_mask & decompress_elsewhere) != 0)
+ ) {
+ union ss_ {
+ stream_state ss;
+ stream_CFE_state cf;
+ stream_RLE_state rl;
+ } sstate;
+ int code;
+ int try_size = op_size + min(uncompressed_size, max_size);
+
+ *psize = try_size;
+ code = (pcls != 0 ?
+ set_cmd_put_op(dp, cldev, pcls, 0, try_size) :
+ set_cmd_put_all_op(dp, cldev, 0, try_size));
+ if (code < 0)
+ return code;
+ cmd_uncount_op(0, try_size);
+ /*
+ * Note that we currently keep all the padding if we are
+ * compressing. This is ridiculous, but it's too hard to
+ * change right now.
+ */
+ if (compression_mask & (1 << cmd_compress_cfe)) {
+ /* Try CCITTFax compression. */
+ clist_cfe_init(&sstate.cf,
+ uncompressed_raster << 3 /*width_bits*/,
+ mem);
+ compress = cmd_compress_cfe;
+ } else if (compression_mask & (1 << cmd_compress_rle)) {
+ /* Try RLE compression. */
+ clist_rle_init(&sstate.rl);
+ compress = cmd_compress_rle;
+ }
+ if (compress) {
+ byte *wbase = dp + (op_size - 1);
+ stream_cursor_write w;
+
+ /*
+ * We can give up on compressing if we generate too much
+ * output to fit in the command reading buffer, or too
+ * much to make compression worthwhile.
+ */
+ uint wmax = min(uncompressed_size, max_size);
+ int status;
+
+ w.ptr = wbase;
+ w.limit = w.ptr + min(wmax, short_size >> 1);
+ status = cmd_compress_bitmap((stream_state *) & sstate, data,
+ uncompressed_raster << 3 /*width_bits */ ,
+ raster, height, &w);
+ if (status == 0) { /* Use compressed representation. */
+ uint wcount = w.ptr - wbase;
+
+ cmd_shorten_list_op(cldev,
+ (pcls ? &pcls->list : &cldev->band_range_list),
+ try_size - (op_size + wcount));
+ *psize = op_size + wcount;
+ goto out;
+ }
+ }
+ if (uncompressed_size > max_size) {
+ /* Shorten to zero, erasing the operation altogether */
+ if_debug1 ('L', "[L]Uncompressed bits %u too large for buffer\n",
+ uncompressed_size);
+ cmd_shorten_list_op(cldev,
+ (pcls ? &pcls->list : &cldev->band_range_list),
+ try_size);
+ return_error(gs_error_limitcheck);
+ }
+ if (uncompressed_size != short_size) {
+ if_debug2 ('L', "[L]Shortening bits from %u to %u\n",
+ try_size, op_size + short_size);
+ cmd_shorten_list_op(cldev,
+ (pcls ? &pcls->list : &cldev->band_range_list),
+ try_size - (op_size + short_size));
+ *psize = op_size + short_size;
+ }
+ compress = 0;
} else if (uncompressed_size > max_size)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
else {
- int code;
-
- *psize = op_size + short_size;
- code = (pcls != 0 ?
- set_cmd_put_op(dp, cldev, pcls, 0, *psize) :
- set_cmd_put_all_op(dp, cldev, 0, *psize));
- if (code < 0)
- return code;
- cmd_uncount_op(0, *psize);
+ int code;
+
+ *psize = op_size + short_size;
+ code = (pcls != 0 ?
+ set_cmd_put_op(dp, cldev, pcls, 0, *psize) :
+ set_cmd_put_all_op(dp, cldev, 0, *psize));
+ if (code < 0)
+ return code;
+ cmd_uncount_op(0, *psize);
}
bytes_copy_rectangle(dp + op_size, short_raster, data, raster,
- short_raster, height);
+ short_raster, height);
out:
*pdp = dp;
return compress;
@@ -240,36 +240,36 @@ static uint
cmd_size_tile_params(const gx_strip_bitmap * tile, bool for_pattern)
{
return 2 + (for_pattern ? cmd_size_w(tile->id) : 0) +
- cmd_size_w(tile->rep_width) + cmd_size_w(tile->rep_height) +
- (tile->rep_width == tile->size.x ? 0 :
- cmd_size_w(tile->size.x / tile->rep_width)) +
- (tile->rep_height == tile->size.y ? 0 :
- cmd_size_w(tile->size.y / tile->rep_height)) +
- (tile->rep_shift == 0 ? 0 : cmd_size_w(tile->rep_shift));
+ cmd_size_w(tile->rep_width) + cmd_size_w(tile->rep_height) +
+ (tile->rep_width == tile->size.x ? 0 :
+ cmd_size_w(tile->size.x / tile->rep_width)) +
+ (tile->rep_height == tile->size.y ? 0 :
+ cmd_size_w(tile->size.y / tile->rep_height)) +
+ (tile->rep_shift == 0 ? 0 : cmd_size_w(tile->rep_shift));
}
static void
cmd_store_tile_params(byte * dp, const gx_strip_bitmap * tile, int depth,
- uint csize, bool for_pattern)
+ uint csize, bool for_pattern)
{
byte *p = dp + 2;
byte bd = cmd_depth_to_code(depth);
*dp = cmd_count_op(cmd_opv_set_tile_size, csize);
if (for_pattern)
- p = cmd_put_w(tile->id, p);
+ p = cmd_put_w(tile->id, p);
p = cmd_put_w(tile->rep_width, p);
p = cmd_put_w(tile->rep_height, p);
if (tile->rep_width != tile->size.x) {
- p = cmd_put_w(tile->size.x / tile->rep_width, p);
- bd |= 0x20;
+ p = cmd_put_w(tile->size.x / tile->rep_width, p);
+ bd |= 0x20;
}
if (tile->rep_height != tile->size.y) {
- p = cmd_put_w(tile->size.y / tile->rep_height, p);
- bd |= 0x40;
+ p = cmd_put_w(tile->size.y / tile->rep_height, p);
+ bd |= 0x40;
}
if (tile->rep_shift != 0) {
- cmd_put_w(tile->rep_shift, p);
- bd |= 0x80;
+ cmd_put_w(tile->rep_shift, p);
+ bd |= 0x80;
}
dp[1] = bd;
}
@@ -278,67 +278,67 @@ cmd_store_tile_params(byte * dp, const gx_strip_bitmap * tile, int depth,
/* This is a relatively high-frequency operation, so we declare it `inline'. */
static inline int
cmd_put_tile_index(gx_device_clist_writer *cldev, gx_clist_state *pcls,
- uint indx)
+ uint indx)
{
int idelta = indx - pcls->tile_index + 8;
byte *dp;
int code;
if (!(idelta & ~15)) {
- code = set_cmd_put_op(dp, cldev, pcls,
- cmd_op_delta_tile_index + idelta, 1);
- if (code < 0)
- return code;
+ code = set_cmd_put_op(dp, cldev, pcls,
+ cmd_op_delta_tile_index + idelta, 1);
+ if (code < 0)
+ return code;
} else {
- code = set_cmd_put_op(dp, cldev, pcls,
- cmd_op_set_tile_index + (indx >> 8), 2);
- if (code < 0)
- return code;
- dp[1] = indx & 0xff;
+ code = set_cmd_put_op(dp, cldev, pcls,
+ cmd_op_set_tile_index + (indx >> 8), 2);
+ if (code < 0)
+ return code;
+ dp[1] = indx & 0xff;
}
if_debug2('L', "[L]writing index=%u, offset=%lu\n",
- indx, cldev->tile_table[indx].offset);
+ indx, cldev->tile_table[indx].offset);
return 0;
}
/* If necessary, write out data for a single color map. */
int
cmd_put_color_map(gx_device_clist_writer * cldev, cmd_map_index map_index,
- int comp_num, const gx_transfer_map * map, gs_id * pid)
+ int comp_num, const gx_transfer_map * map, gs_id * pid)
{
byte *dp;
int code;
if (map == 0) {
- if (pid && *pid == gs_no_id)
- return 0; /* no need to write */
- code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc, 3);
- if (code < 0)
- return code;
- dp[1] = cmd_set_misc_map + (cmd_map_none << 4) + map_index;
- dp[2] = comp_num;
- if (pid)
- *pid = gs_no_id;
+ if (pid && *pid == gs_no_id)
+ return 0; /* no need to write */
+ code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc, 3);
+ if (code < 0)
+ return code;
+ dp[1] = cmd_set_misc_map + (cmd_map_none << 4) + map_index;
+ dp[2] = comp_num;
+ if (pid)
+ *pid = gs_no_id;
} else {
- if (pid && map->id == *pid)
- return 0; /* no need to write */
- if (map->proc == gs_identity_transfer) {
- code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc, 3);
- if (code < 0)
- return code;
- dp[1] = cmd_set_misc_map + (cmd_map_identity << 4) + map_index;
- dp[2] = comp_num;
- } else {
- code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc,
- 3 + sizeof(map->values));
- if (code < 0)
- return code;
- dp[1] = cmd_set_misc_map + (cmd_map_other << 4) + map_index;
- dp[2] = comp_num;
- memcpy(dp + 3, map->values, sizeof(map->values));
- }
- if (pid)
- *pid = map->id;
+ if (pid && map->id == *pid)
+ return 0; /* no need to write */
+ if (map->proc == gs_identity_transfer) {
+ code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc, 3);
+ if (code < 0)
+ return code;
+ dp[1] = cmd_set_misc_map + (cmd_map_identity << 4) + map_index;
+ dp[2] = comp_num;
+ } else {
+ code = set_cmd_put_all_op(dp, cldev, cmd_opv_set_misc,
+ 3 + sizeof(map->values));
+ if (code < 0)
+ return code;
+ dp[1] = cmd_set_misc_map + (cmd_map_other << 4) + map_index;
+ dp[2] = comp_num;
+ memcpy(dp + 3, map->values, sizeof(map->values));
+ }
+ if (pid)
+ *pid = map->id;
}
return 0;
}
@@ -368,15 +368,15 @@ clist_find_bits(gx_device_clist_writer * cldev, gx_bitmap_id id, tile_loc * ploc
ulong offset;
for (; (offset = table[index &= mask].offset) != 0;
- index = tile_hash_next(index)
- ) {
- tile_slot *tile = (tile_slot *) (cldev->data + offset);
-
- if (tile->id == id) {
- ploc->index = index;
- ploc->tile = tile;
- return true;
- }
+ index = tile_hash_next(index)
+ ) {
+ tile_slot *tile = (tile_slot *) (cldev->data + offset);
+
+ if (tile->id == id) {
+ ploc->index = index;
+ ploc->tile = tile;
+ return true;
+ }
}
ploc->index = index;
return false;
@@ -392,9 +392,9 @@ clist_delete_tile(gx_device_clist_writer * cldev, tile_slot * slot)
ulong offset;
if_debug2('L', "[L]deleting index=%u, offset=%lu\n",
- index, (ulong) ((byte *) slot - cldev->data));
+ index, (ulong) ((byte *) slot - cldev->data));
gx_bits_cache_free(&cldev->bits, (gx_cached_bits_head *) slot,
- &cldev->chunk);
+ &cldev->chunk);
table[index].offset = 0;
/* Delete the entry from the hash table. */
/* We'd like to move up any later entries, so that we don't need */
@@ -402,18 +402,18 @@ clist_delete_tile(gx_device_clist_writer * cldev, tile_slot * slot)
/* band list, so instead, we just delete any entries that */
/* would need to be moved. */
while ((offset = table[index = tile_hash_next(index) & mask].offset) != 0) {
- tile_slot *tile = (tile_slot *) (cldev->data + offset);
- tile_loc loc;
-
- if (!clist_find_bits(cldev, tile->id, &loc)) { /* We didn't find it, so it should be moved into a slot */
- /* that we just vacated; instead, delete it. */
- if_debug2('L', "[L]move-deleting index=%u, offset=%lu\n",
- index, offset);
- gx_bits_cache_free(&cldev->bits,
- (gx_cached_bits_head *) (cldev->data + offset),
- &cldev->chunk);
- table[index].offset = 0;
- }
+ tile_slot *tile = (tile_slot *) (cldev->data + offset);
+ tile_loc loc;
+
+ if (!clist_find_bits(cldev, tile->id, &loc)) { /* We didn't find it, so it should be moved into a slot */
+ /* that we just vacated; instead, delete it. */
+ if_debug2('L', "[L]move-deleting index=%u, offset=%lu\n",
+ index, offset);
+ gx_bits_cache_free(&cldev->bits,
+ (gx_cached_bits_head *) (cldev->data + offset),
+ &cldev->chunk);
+ table[index].offset = 0;
+ }
}
}
@@ -422,7 +422,7 @@ clist_delete_tile(gx_device_clist_writer * cldev, tile_slot * slot)
/* we pass the raster of the actual data separately. */
static int
clist_add_tile(gx_device_clist_writer * cldev, const gx_strip_bitmap * tiles,
- uint sraster, int depth)
+ uint sraster, int depth)
{
uint raster = tiles->raster;
uint size_bytes = raster * tiles->size.y;
@@ -433,34 +433,34 @@ clist_add_tile(gx_device_clist_writer * cldev, const gx_strip_bitmap * tiles,
#define slot ((tile_slot *)slot_head)
if (cldev->bits.csize == cldev->tile_max_count) { /* Don't let the hash table get too full: delete an entry. */
- /* Since gx_bits_cache_alloc returns an entry to delete when */
- /* it fails, just force it to fail. */
- gx_bits_cache_alloc(&cldev->bits, (ulong) cldev->chunk.size,
- &slot_head);
- if (slot_head == 0) { /* Wrap around and retry. */
- cldev->bits.cnext = 0;
- gx_bits_cache_alloc(&cldev->bits, (ulong) cldev->chunk.size,
- &slot_head);
+ /* Since gx_bits_cache_alloc returns an entry to delete when */
+ /* it fails, just force it to fail. */
+ gx_bits_cache_alloc(&cldev->bits, (ulong) cldev->chunk.size,
+ &slot_head);
+ if (slot_head == 0) { /* Wrap around and retry. */
+ cldev->bits.cnext = 0;
+ gx_bits_cache_alloc(&cldev->bits, (ulong) cldev->chunk.size,
+ &slot_head);
#ifdef DEBUG
- if (slot_head == 0) {
- lprintf("No entry to delete!\n");
- return_error(gs_error_Fatal);
- }
+ if (slot_head == 0) {
+ lprintf("No entry to delete!\n");
+ return_error(gs_error_Fatal);
+ }
#endif
- }
- clist_delete_tile(cldev, slot);
+ }
+ clist_delete_tile(cldev, slot);
}
/* Allocate the space for the new entry, deleting entries as needed. */
while (gx_bits_cache_alloc(&cldev->bits, (ulong) tsize, &slot_head) < 0) {
- if (slot_head == 0) { /* Wrap around. */
- if (cldev->bits.cnext == 0) { /* Too big to fit. We should probably detect this */
- /* sooner, since if we get here, we've cleared the */
- /* cache. */
- return_error(gs_error_limitcheck);
- }
- cldev->bits.cnext = 0;
- } else
- clist_delete_tile(cldev, slot);
+ if (slot_head == 0) { /* Wrap around. */
+ if (cldev->bits.cnext == 0) { /* Too big to fit. We should probably detect this */
+ /* sooner, since if we get here, we've cleared the */
+ /* cache. */
+ return_error(gs_error_limitcheck);
+ }
+ cldev->bits.cnext = 0;
+ } else
+ clist_delete_tile(cldev, slot);
}
/* Fill in the entry. */
slot->cb_depth = depth;
@@ -477,20 +477,20 @@ clist_add_tile(gx_device_clist_writer * cldev, const gx_strip_bitmap * tiles,
tiles->rep_height);
/* Make the hash table entry. */
{
- tile_loc loc;
+ tile_loc loc;
#ifdef DEBUG
- if (clist_find_bits(cldev, tiles->id, &loc))
- lprintf1("clist_find_bits(0x%lx) should have failed!\n",
- (ulong) tiles->id);
+ if (clist_find_bits(cldev, tiles->id, &loc))
+ lprintf1("clist_find_bits(0x%lx) should have failed!\n",
+ (ulong) tiles->id);
#else
- clist_find_bits(cldev, tiles->id, &loc); /* always fails */
+ clist_find_bits(cldev, tiles->id, &loc); /* always fails */
#endif
- slot->index = loc.index;
- cldev->tile_table[loc.index].offset =
- (byte *) slot_head - cldev->data;
- if_debug2('L', "[L]adding index=%u, offset=%lu\n",
- loc.index, cldev->tile_table[loc.index].offset);
+ slot->index = loc.index;
+ cldev->tile_table[loc.index].offset =
+ (byte *) slot_head - cldev->data;
+ if_debug2('L', "[L]adding index=%u, offset=%lu\n",
+ loc.index, cldev->tile_table[loc.index].offset);
}
slot->num_bands = 0;
return 0;
@@ -502,15 +502,15 @@ clist_add_tile(gx_device_clist_writer * cldev, const gx_strip_bitmap * tiles,
/* Currently we do this for all bands at once. */
static void
clist_new_tile_params(gx_strip_bitmap * new_tile, const gx_strip_bitmap * tiles,
- int depth, const gx_device_clist_writer * cldev)
+ int depth, const gx_device_clist_writer * cldev)
{ /*
- * Adjust the replication factors. If we can, we replicate
- * the tile in X up to 32 bytes, and then in Y up to 4 copies,
- * as long as we don't exceed a total tile size of 256 bytes,
- * or more than 255 repetitions in X or Y, or make the tile so
- * large that not all possible tiles will fit in the cache.
- * Also, don't attempt Y replication if shifting is required.
- */
+ * Adjust the replication factors. If we can, we replicate
+ * the tile in X up to 32 bytes, and then in Y up to 4 copies,
+ * as long as we don't exceed a total tile size of 256 bytes,
+ * or more than 255 repetitions in X or Y, or make the tile so
+ * large that not all possible tiles will fit in the cache.
+ * Also, don't attempt Y replication if shifting is required.
+ */
#define max_tile_reps_x 255
#define max_tile_bytes_x 32
#define max_tile_reps_y 4
@@ -524,28 +524,28 @@ clist_new_tile_params(gx_strip_bitmap * new_tile, const gx_strip_bitmap * tiles,
max_bytes -= min(max_bytes, tile_overhead);
if (max_bytes > max_tile_bytes)
- max_bytes = max_tile_bytes;
+ max_bytes = max_tile_bytes;
*new_tile = *tiles;
{
- uint max_bits_x = max_bytes * 8 / rep_height;
- uint reps_x =
- min(max_bits_x, max_tile_bytes_x * 8) / rep_width_bits;
- uint reps_y;
-
- while (reps_x > max_tile_reps_x)
- reps_x >>= 1;
- new_tile->size.x = max(reps_x, 1) * rep_width;
- new_tile->raster = bitmap_raster(new_tile->size.x * depth);
- if (tiles->shift != 0)
- reps_y = 1;
- else {
- reps_y = max_bytes / (new_tile->raster * rep_height);
- if (reps_y > max_tile_reps_y)
- reps_y = max_tile_reps_y;
- else if (reps_y < 1)
- reps_y = 1;
- }
- new_tile->size.y = reps_y * rep_height;
+ uint max_bits_x = max_bytes * 8 / rep_height;
+ uint reps_x =
+ min(max_bits_x, max_tile_bytes_x * 8) / rep_width_bits;
+ uint reps_y;
+
+ while (reps_x > max_tile_reps_x)
+ reps_x >>= 1;
+ new_tile->size.x = max(reps_x, 1) * rep_width;
+ new_tile->raster = bitmap_raster(new_tile->size.x * depth);
+ if (tiles->shift != 0)
+ reps_y = 1;
+ else {
+ reps_y = max_bytes / (new_tile->raster * rep_height);
+ if (reps_y > max_tile_reps_y)
+ reps_y = max_tile_reps_y;
+ else if (reps_y < 1)
+ reps_y = 1;
+ }
+ new_tile->size.y = reps_y * rep_height;
}
#undef max_tile_reps_x
#undef max_tile_bytes_x
@@ -558,7 +558,7 @@ extern dev_proc_open_device(pattern_clist_open_device);
/* Change tile for clist_tile_rectangle. */
int
clist_change_tile(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_strip_bitmap * tiles, int depth)
+ const gx_strip_bitmap * tiles, int depth)
{
tile_loc loc;
int code;
@@ -570,112 +570,112 @@ clist_change_tile(gx_device_clist_writer * cldev, gx_clist_state * pcls,
(depth) != (cldev)->tile_depth)
top:if (clist_find_bits(cldev, tiles->id, &loc)) { /* The bitmap is in the cache. Check whether this band */
- /* knows about it. */
- int band_index = pcls - cldev->states;
- byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
- byte bmask = 1 << (band_index & 7);
- bool for_pattern = IS_CLIST_FOR_PATTERN(cldev);
-
- if (*bptr & bmask) { /* Already known. Just set the index. */
- if (pcls->tile_index == loc.index)
- return 0;
- if ((code = cmd_put_tile_index(cldev, pcls, loc.index)) < 0)
- return code;
- } else {
- uint extra = 0;
-
- if (tile_params_differ(cldev, tiles, depth) ||
- for_pattern) { /*
- * We have a cached tile whose parameters differ from
- * the current ones. Because of the way tile IDs are
- * managed, this is currently only possible when mixing
- * Patterns and halftones, but if we didn't generate new
- * IDs each time the main halftone cache needed to be
- * refreshed, this could also happen simply from
- * switching screens.
- */
- int band;
-
- clist_new_tile_params(&cldev->tile_params, tiles, depth,
- cldev);
- cldev->tile_depth = depth;
- /* No band knows about the new parameters. */
- for (band = cldev->tile_known_min;
- band <= cldev->tile_known_max;
- ++band
- )
- cldev->states[band].known &= ~tile_params_known;
- cldev->tile_known_min = cldev->nbands;
- cldev->tile_known_max = -1;
- }
- if (!(pcls->known & tile_params_known)) { /* We're going to have to write the tile parameters. */
- extra = cmd_size_tile_params(&cldev->tile_params, for_pattern);
- } { /*
- * This band doesn't know this tile yet, so output the
- * bits. Note that the offset we write is the one used by
- * the reading phase, not the writing phase. Note also
- * that the size of the cached and written tile may differ
- * from that of the client's tile. Finally, note that
- * this tile's size parameters are guaranteed to be
- * compatible with those stored in the device
- * (cldev->tile_params).
- */
- ulong offset = (byte *) loc.tile - cldev->chunk.data;
- uint rsize =
- extra + 1 + cmd_size_w(loc.index) + cmd_size_w(offset);
- byte *dp;
- uint csize;
- int code =
- cmd_put_bits(cldev, pcls, ts_bits(cldev, loc.tile),
- tiles->rep_width * depth, tiles->rep_height,
- loc.tile->cb_raster, rsize,
- (cldev->tile_params.size.x > tiles->rep_width ?
- decompress_elsewhere | decompress_spread :
- decompress_elsewhere),
- &dp, &csize);
-
- if (code < 0)
- return code;
- if (extra) { /* Write the tile parameters before writing the bits. */
- cmd_store_tile_params(dp, &cldev->tile_params, depth,
- extra, for_pattern);
- dp += extra;
- /* This band now knows the parameters. */
- pcls->known |= tile_params_known;
- if (band_index < cldev->tile_known_min)
- cldev->tile_known_min = band_index;
- if (band_index > cldev->tile_known_max)
- cldev->tile_known_max = band_index;
- }
- *dp = cmd_count_op(cmd_opv_set_tile_bits, csize - extra);
- dp++;
- dp = cmd_put_w(loc.index, dp);
- cmd_put_w(offset, dp);
- *bptr |= bmask;
- loc.tile->num_bands++;
- }
- }
- pcls->tile_index = loc.index;
- pcls->tile_id = loc.tile->id;
- return 0;
+ /* knows about it. */
+ int band_index = pcls - cldev->states;
+ byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
+ byte bmask = 1 << (band_index & 7);
+ bool for_pattern = IS_CLIST_FOR_PATTERN(cldev);
+
+ if (*bptr & bmask) { /* Already known. Just set the index. */
+ if (pcls->tile_index == loc.index)
+ return 0;
+ if ((code = cmd_put_tile_index(cldev, pcls, loc.index)) < 0)
+ return code;
+ } else {
+ uint extra = 0;
+
+ if (tile_params_differ(cldev, tiles, depth) ||
+ for_pattern) { /*
+ * We have a cached tile whose parameters differ from
+ * the current ones. Because of the way tile IDs are
+ * managed, this is currently only possible when mixing
+ * Patterns and halftones, but if we didn't generate new
+ * IDs each time the main halftone cache needed to be
+ * refreshed, this could also happen simply from
+ * switching screens.
+ */
+ int band;
+
+ clist_new_tile_params(&cldev->tile_params, tiles, depth,
+ cldev);
+ cldev->tile_depth = depth;
+ /* No band knows about the new parameters. */
+ for (band = cldev->tile_known_min;
+ band <= cldev->tile_known_max;
+ ++band
+ )
+ cldev->states[band].known &= ~tile_params_known;
+ cldev->tile_known_min = cldev->nbands;
+ cldev->tile_known_max = -1;
+ }
+ if (!(pcls->known & tile_params_known)) { /* We're going to have to write the tile parameters. */
+ extra = cmd_size_tile_params(&cldev->tile_params, for_pattern);
+ } { /*
+ * This band doesn't know this tile yet, so output the
+ * bits. Note that the offset we write is the one used by
+ * the reading phase, not the writing phase. Note also
+ * that the size of the cached and written tile may differ
+ * from that of the client's tile. Finally, note that
+ * this tile's size parameters are guaranteed to be
+ * compatible with those stored in the device
+ * (cldev->tile_params).
+ */
+ ulong offset = (byte *) loc.tile - cldev->chunk.data;
+ uint rsize =
+ extra + 1 + cmd_size_w(loc.index) + cmd_size_w(offset);
+ byte *dp;
+ uint csize;
+ int code =
+ cmd_put_bits(cldev, pcls, ts_bits(cldev, loc.tile),
+ tiles->rep_width * depth, tiles->rep_height,
+ loc.tile->cb_raster, rsize,
+ (cldev->tile_params.size.x > tiles->rep_width ?
+ decompress_elsewhere | decompress_spread :
+ decompress_elsewhere),
+ &dp, &csize);
+
+ if (code < 0)
+ return code;
+ if (extra) { /* Write the tile parameters before writing the bits. */
+ cmd_store_tile_params(dp, &cldev->tile_params, depth,
+ extra, for_pattern);
+ dp += extra;
+ /* This band now knows the parameters. */
+ pcls->known |= tile_params_known;
+ if (band_index < cldev->tile_known_min)
+ cldev->tile_known_min = band_index;
+ if (band_index > cldev->tile_known_max)
+ cldev->tile_known_max = band_index;
+ }
+ *dp = cmd_count_op(cmd_opv_set_tile_bits, csize - extra);
+ dp++;
+ dp = cmd_put_w(loc.index, dp);
+ cmd_put_w(offset, dp);
+ *bptr |= bmask;
+ loc.tile->num_bands++;
+ }
+ }
+ pcls->tile_index = loc.index;
+ pcls->tile_id = loc.tile->id;
+ return 0;
}
/* The tile is not in the cache, add it. */
{
- gx_strip_bitmap new_tile;
- gx_strip_bitmap *ptile;
-
- /* Ensure that the tile size is compatible. */
- if (tile_params_differ(cldev, tiles, depth)) { /* We'll reset cldev->tile_params when we write the bits. */
- clist_new_tile_params(&new_tile, tiles, depth, cldev);
- ptile = &new_tile;
- } else {
- cldev->tile_params.id = tiles->id;
- cldev->tile_params.data = tiles->data;
- ptile = &cldev->tile_params;
- }
- code = clist_add_tile(cldev, ptile, tiles->raster, depth);
- if (code < 0)
- return code;
+ gx_strip_bitmap new_tile;
+ gx_strip_bitmap *ptile;
+
+ /* Ensure that the tile size is compatible. */
+ if (tile_params_differ(cldev, tiles, depth)) { /* We'll reset cldev->tile_params when we write the bits. */
+ clist_new_tile_params(&new_tile, tiles, depth, cldev);
+ ptile = &new_tile;
+ } else {
+ cldev->tile_params.id = tiles->id;
+ cldev->tile_params.data = tiles->data;
+ ptile = &cldev->tile_params;
+ }
+ code = clist_add_tile(cldev, ptile, tiles->raster, depth);
+ if (code < 0)
+ return code;
}
goto top;
#undef tile_params_differ
@@ -684,67 +684,67 @@ clist_change_tile(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* Change "tile" for clist_copy_*. tiles->[rep_]shift must be zero. */
int
clist_change_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_strip_bitmap * tiles, int depth)
+ const gx_strip_bitmap * tiles, int depth)
{
tile_loc loc;
int code;
top:if (clist_find_bits(cldev, tiles->id, &loc)) { /* The bitmap is in the cache. Check whether this band */
- /* knows about it. */
- uint band_index = pcls - cldev->states;
- byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
- byte bmask = 1 << (band_index & 7);
-
- if (*bptr & bmask) { /* Already known. Just set the index. */
- if (pcls->tile_index == loc.index)
- return 0;
- cmd_put_tile_index(cldev, pcls, loc.index);
- } else { /* Not known yet. Output the bits. */
- /* Note that the offset we write is the one used by */
- /* the reading phase, not the writing phase. */
- ulong offset = (byte *) loc.tile - cldev->chunk.data;
- uint rsize = 2 + cmd_size_w(loc.tile->width) +
- cmd_size_w(loc.tile->height) + cmd_size_w(loc.index) +
- cmd_size_w(offset);
- byte *dp;
- uint csize;
- gx_clist_state *bit_pcls = pcls;
- int code;
-
- if (loc.tile->num_bands == CHAR_ALL_BANDS_COUNT)
- bit_pcls = NULL;
- code = cmd_put_bits(cldev, bit_pcls, ts_bits(cldev, loc.tile),
- loc.tile->width * depth,
- loc.tile->height, loc.tile->cb_raster,
- rsize,
- (1 << cmd_compress_cfe) | decompress_elsewhere,
- &dp, &csize);
-
- if (code < 0)
- return code;
- *dp = cmd_count_op(cmd_opv_set_bits, csize);
- dp[1] = (depth << 2) + code;
- dp += 2;
- dp = cmd_put_w(loc.tile->width, dp);
- dp = cmd_put_w(loc.tile->height, dp);
- dp = cmd_put_w(loc.index, dp);
- cmd_put_w(offset, dp);
- if (bit_pcls == NULL) {
- memset(ts_mask(loc.tile), 0xff,
- cldev->tile_band_mask_size);
- loc.tile->num_bands = cldev->nbands;
- } else {
- *bptr |= bmask;
- loc.tile->num_bands++;
- }
- }
- pcls->tile_index = loc.index;
- pcls->tile_id = loc.tile->id;
- return 0;
+ /* knows about it. */
+ uint band_index = pcls - cldev->states;
+ byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
+ byte bmask = 1 << (band_index & 7);
+
+ if (*bptr & bmask) { /* Already known. Just set the index. */
+ if (pcls->tile_index == loc.index)
+ return 0;
+ cmd_put_tile_index(cldev, pcls, loc.index);
+ } else { /* Not known yet. Output the bits. */
+ /* Note that the offset we write is the one used by */
+ /* the reading phase, not the writing phase. */
+ ulong offset = (byte *) loc.tile - cldev->chunk.data;
+ uint rsize = 2 + cmd_size_w(loc.tile->width) +
+ cmd_size_w(loc.tile->height) + cmd_size_w(loc.index) +
+ cmd_size_w(offset);
+ byte *dp;
+ uint csize;
+ gx_clist_state *bit_pcls = pcls;
+ int code;
+
+ if (loc.tile->num_bands == CHAR_ALL_BANDS_COUNT)
+ bit_pcls = NULL;
+ code = cmd_put_bits(cldev, bit_pcls, ts_bits(cldev, loc.tile),
+ loc.tile->width * depth,
+ loc.tile->height, loc.tile->cb_raster,
+ rsize,
+ (1 << cmd_compress_cfe) | decompress_elsewhere,
+ &dp, &csize);
+
+ if (code < 0)
+ return code;
+ *dp = cmd_count_op(cmd_opv_set_bits, csize);
+ dp[1] = (depth << 2) + code;
+ dp += 2;
+ dp = cmd_put_w(loc.tile->width, dp);
+ dp = cmd_put_w(loc.tile->height, dp);
+ dp = cmd_put_w(loc.index, dp);
+ cmd_put_w(offset, dp);
+ if (bit_pcls == NULL) {
+ memset(ts_mask(loc.tile), 0xff,
+ cldev->tile_band_mask_size);
+ loc.tile->num_bands = cldev->nbands;
+ } else {
+ *bptr |= bmask;
+ loc.tile->num_bands++;
+ }
+ }
+ pcls->tile_index = loc.index;
+ pcls->tile_id = loc.tile->id;
+ return 0;
}
/* The tile is not in the cache. */
code = clist_add_tile(cldev, tiles, tiles->raster, depth);
if (code < 0)
- return code;
+ return code;
goto top;
}
diff --git a/gs/base/gxcldev.h b/gs/base/gxcldev.h
index 346d85b97..99b58d365 100644
--- a/gs/base/gxcldev.h
+++ b/gs/base/gxcldev.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ void clist_rle_init(stream_RLE_state *ss);
void clist_rld_init(stream_RLD_state *ss);
void clist_cfe_init(stream_CFE_state *ss, int width, gs_memory_t *mem);
void clist_cfd_init(stream_CFD_state *ss, int width, int height,
- gs_memory_t *mem);
+ gs_memory_t *mem);
/*
* A command always consists of an operation followed by operands;
@@ -59,15 +59,15 @@ typedef enum {
cmd_op_misc = 0x00, /* (see below) */
cmd_opv_end_run = 0x00, /* (nothing) */
cmd_opv_set_tile_size = 0x01, /* rs?(1)nry?(1)nrx?(1)depth(5, encoded), */
- /* rep_width#, rep_height#, */
- /* [, nreps_x#][, nreps_y #] */
- /* [, rep_shift#] */
+ /* rep_width#, rep_height#, */
+ /* [, nreps_x#][, nreps_y #] */
+ /* [, rep_shift#] */
cmd_opv_set_tile_phase = 0x02, /* x#, y# */
cmd_opv_set_tile_bits = 0x03, /* index#, offset#, <bits> */
cmd_opv_set_bits = 0x04, /* depth*4+compress, width#, height#, */
- /* index#, offset#, <bits> */
+ /* index#, offset#, <bits> */
cmd_opv_set_tile_color = 0x05, /* (nothing; next set/delta_color */
- /* refers to tile) */
+ /* refers to tile) */
cmd_opv_set_misc = 0x06,
#define cmd_set_misc_lop (0 << 6) /* 00: lop_lsb(6), lop_msb# */
#define cmd_set_misc_data_x (1 << 6) /* 01: more(1)dx_lsb(5)[, dx_msb#] */
@@ -78,9 +78,9 @@ typedef enum {
cmd_opv_disable_lop = 0x08, /* (nothing) */
/* obsolete */
/* cmd_opv_set_ht_order = 0x09, */ /* component+1#[, cname#], */
- /* width#, height#, raster#, */
- /* shift#, num_levels#, num_bits#, */
- /* order_procs_index */
+ /* width#, height#, raster#, */
+ /* shift#, num_levels#, num_bits#, */
+ /* order_procs_index */
/* obsolete */
/* cmd_opv_set_ht_data = 0x0a, */ /* n, n x (uint|gx_ht_bit|ushort) */
cmd_opv_end_page = 0x0b, /* (nothing) */
@@ -98,17 +98,17 @@ typedef enum {
cmd_op_tile_rect_short = 0x70, /* +dh, dx, dw | +0, rect_short */
cmd_op_tile_rect_tiny = 0x80, /* +dw+0, rect_tiny | +dw+8 */
cmd_op_copy_mono = 0x90, /* +compress, x#, y#, (w+data_x)#, */
- /* h#, <bits> | */
+ /* h#, <bits> | */
#define cmd_copy_ht_color 4
- /* +4+compress, x#, y#, (w+data_x)#, */
- /* h#, <bits> | */
+ /* +4+compress, x#, y#, (w+data_x)#, */
+ /* h#, <bits> | */
#define cmd_copy_use_tile 8
- /* +8 (use tile), x#, y# | */
- /* +12 (use tile), x#, y# */
+ /* +8 (use tile), x#, y# | */
+ /* +12 (use tile), x#, y# */
cmd_op_copy_color_alpha = 0xa0, /* (same as copy_mono, except: */
- /* if color, ignore ht_color; */
- /* if alpha & !use_tile, depth is */
- /* first operand) */
+ /* if color, ignore ht_color; */
+ /* if alpha & !use_tile, depth is */
+ /* first operand) */
cmd_op_delta_tile_index = 0xb0, /* +delta+8 */
cmd_op_set_tile_index = 0xc0 /* +index[11:8], index[7:0] */
} gx_cmd_op;
@@ -200,8 +200,8 @@ typedef struct {
* Return the total size of the bitmap.
*/
uint clist_bitmap_bytes(uint width_bits, uint height,
- int compression_mask,
- uint * width_bytes, uint * raster);
+ int compression_mask,
+ uint * width_bytes, uint * raster);
/*
* For halftone cells, we always write an unreplicated bitmap, but we
@@ -216,8 +216,8 @@ typedef struct cmd_block_s {
int band_min, band_max;
#define cmd_band_end (-1) /* end of band file */
int64_t pos; /* starting position in cfile */
- gx_band_complexity_t band_complexity;
-
+ gx_band_complexity_t band_complexity;
+
} cmd_block;
/* ---------------- Band state ---------------- */
@@ -241,12 +241,12 @@ struct gx_clist_state_s {
gx_cmd_rect rect; /* most recent rectangle */
gs_logical_operation_t lop; /* most recent logical op */
short lop_enabled; /* 0 = don't use lop, 1 = use lop, */
- /* -1 is used internally */
+ /* -1 is used internally */
short clip_enabled; /* 0 = don't clip, 1 = do clip, */
- /* -1 is used internally */
+ /* -1 is used internally */
bool color_is_alpha; /* for copy_color_alpha */
uint known; /* flags for whether this band */
- /* knows various misc. parameters */
+ /* knows various misc. parameters */
/* We assign 'known' flags here from the high end; */
/* gxclpath.h assigns them from the low end. */
#define tile_params_known (1<<15)
@@ -255,19 +255,19 @@ struct gx_clist_state_s {
/* Following are only used when writing */
cmd_list list; /* list of commands for band */
/* Following are set when writing, read when reading */
- gx_band_complexity_t band_complexity;
+ gx_band_complexity_t band_complexity;
gx_colors_used_t colors_used;
};
/* The initial values for a band state */
/*static const gx_clist_state cls_initial */
#define cls_initial_values\
- { gx_no_color_index, gx_no_color_index },\
- { gx_dc_type_none },\
- 0, gx_no_bitmap_id, gs_no_id,\
- { 0, 0 }, { gx_no_color_index, gx_no_color_index },\
- { 0, 0, 0, 0 }, lop_default, 0, 0, 0, initial_known,\
- { 0, 0 }, { 0, 0 }, { 0, 0 }
+ { gx_no_color_index, gx_no_color_index },\
+ { gx_dc_type_none },\
+ 0, gx_no_bitmap_id, gs_no_id,\
+ { 0, 0 }, { gx_no_color_index, gx_no_color_index },\
+ { 0, 0, 0, 0 }, lop_default, 0, 0, 0, initial_known,\
+ { 0, 0 }, { 0, 0 }, { 0, 0 }
/* Define the size of the command buffer used for reading. */
/* This is needed to split up operations with a large amount of data, */
@@ -380,7 +380,7 @@ void cmd_print_stats(void);
/* and allocate space for its data. */
byte *cmd_put_list_op(gx_device_clist_writer * cldev, cmd_list * pcl, uint size);
-/* Request a space in the buffer.
+/* Request a space in the buffer.
Writes out the buffer if necessary.
Returns the size of available space. */
int cmd_get_buffer_space(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint size);
@@ -399,7 +399,7 @@ byte *cmd_put_op(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint siz
/* Add a command for all bands or a range of bands. */
byte *cmd_put_range_op(gx_device_clist_writer * cldev, int band_min,
- int band_max, uint size);
+ int band_max, uint size);
#define cmd_put_all_op(cldev, size)\
cmd_put_range_op(cldev, 0, (cldev)->nbands - 1, size)
@@ -480,14 +480,14 @@ extern const gx_color_index cmd_delta_offsets[]; /* In gxclutil.c */
/* Put out a command to set the tile colors. */
int cmd_set_tile_colors(gx_device_clist_writer *cldev, gx_clist_state * pcls,
- gx_color_index color0, gx_color_index color1);
+ gx_color_index color0, gx_color_index color1);
/* Put out a command to set the tile phase. */
int
cmd_set_tile_phase_generic(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int px, int py, bool all_bands);
+ int px, int py, bool all_bands);
int cmd_set_tile_phase(gx_device_clist_writer *cldev, gx_clist_state * pcls,
- int px, int py);
+ int px, int py);
/* Enable or disable the logical operation. */
int cmd_put_enable_lop(gx_device_clist_writer *, gx_clist_state *, int);
@@ -514,16 +514,16 @@ int cmd_put_enable_clip(gx_device_clist_writer *, gx_clist_state *, int);
/* Write a command to set the logical operation. */
int cmd_set_lop(gx_device_clist_writer *, gx_clist_state *,
- gs_logical_operation_t);
+ gs_logical_operation_t);
/* Disable (if default) or enable the logical operation, setting it if */
/* needed. */
int cmd_update_lop(gx_device_clist_writer *, gx_clist_state *,
- gs_logical_operation_t);
+ gs_logical_operation_t);
/*
* For dividing up an operation into bands, use the control pattern :
- *
+ *
* cmd_rects_enum_t re;
* RECT_ENUM_INIT(re, ry, rheight);
* do {
@@ -551,7 +551,7 @@ int cmd_update_lop(gx_device_clist_writer *, gx_clist_state *,
* and then restart emitting the entire band.
* Note that re.y must not change when restarting the band.
*
- * The band processing code may wrap a writing operation with a pattern like this :
+ * The band processing code may wrap a writing operation with a pattern like this :
*
* do {
* code = operation(...);
@@ -560,7 +560,7 @@ int cmd_update_lop(gx_device_clist_writer *, gx_clist_state *,
* goto error_in_rect;
*
*
- * This will
+ * This will
* perform local first-stage VMerror recovery, by waiting for some memory to
* become free and then retrying the failed operation starting at the
* TRY_RECT. If local recovery is unsuccessful, the local recovery code
@@ -572,7 +572,7 @@ int cmd_update_lop(gx_device_clist_writer *, gx_clist_state *,
* VMerror recovery. In such cases, the recursive call must not attempt
* second-stage VMerror recovery, since the caller would have no way of
* knowing that the writer state had been reset. Such recursive calls
- * should be wrapped in
+ * should be wrapped in
*
* ++cdev->driver_call_nesting; { ... } --cdev->driver_call_nesting;
*
@@ -589,30 +589,29 @@ int cmd_update_lop(gx_device_clist_writer *, gx_clist_state *,
*/
typedef struct cmd_rects_enum_s {
- int y;
- int height;
- int yend;
- int band_height;
- int band_code;
- int band;
- gx_clist_state *pcls;
- int band_end;
- int nbands;
+ int y;
+ int height;
+ int yend;
+ int band_height;
+ int band_code;
+ int band;
+ gx_clist_state *pcls;
+ int band_end;
+ int nbands;
} cmd_rects_enum_t;
#define RECT_ENUM_INIT(re, yvar, heightvar)\
- re.y = yvar;\
- re.height = heightvar;\
- re.yend = re.y + re.height;\
- re.band_height = cdev->page_band_height;\
- re.nbands = (re.yend - re.y + re.band_height - 1) / re.band_height;
+ re.y = yvar;\
+ re.height = heightvar;\
+ re.yend = re.y + re.height;\
+ re.band_height = cdev->page_band_height;\
+ re.nbands = (re.yend - re.y + re.band_height - 1) / re.band_height;
#define RECT_STEP_INIT(re)\
- re.band = re.y / re.band_height;\
- re.pcls = cdev->states + re.band;\
- re.band_end = (re.band + 1) * re.band_height;\
- re.height = min(re.band_end, re.yend) - re.y;
-
+ re.band = re.y / re.band_height;\
+ re.pcls = cdev->states + re.band;\
+ re.band_end = (re.band + 1) * re.band_height;\
+ re.height = min(re.band_end, re.yend) - re.y;
#define RECT_RECOVER(codevar) (codevar < 0 && (codevar = clist_VMerror_recover(cdev, codevar)) >= 0)
#define SET_BAND_CODE(codevar) (re.band_code = codevar)
@@ -620,12 +619,11 @@ typedef struct cmd_rects_enum_s {
/* Read a transformation matrix. */
const byte *cmd_read_matrix(gs_matrix * pmat, const byte * cbp);
-
/* ------ Exported by gxclrect.c ------ */
/* Put out a fill or tile rectangle command. */
int cmd_write_rect_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int op, int x, int y, int width, int height);
+ int op, int x, int y, int width, int height);
/* Put out a fill or tile rectangle command for fillpage. */
int cmd_write_page_rect_cmd(gx_device_clist_writer * cldev, int op);
@@ -655,9 +653,9 @@ int cmd_write_page_rect_cmd(gx_device_clist_writer * cldev, int op);
#define decompress_spread 0x200
int cmd_put_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const byte * data, uint width_bits, uint height,
- uint raster, int op_size, int compression_mask,
- byte ** pdp, uint * psize);
+ const byte * data, uint width_bits, uint height,
+ uint raster, int op_size, int compression_mask,
+ byte ** pdp, uint * psize);
/*
* Put out commands for a color map (transfer function, black generation, or
@@ -687,14 +685,14 @@ int cmd_put_color_map(gx_device_clist_writer * cldev,
* procedure primarily for readability.)
*/
int clist_change_tile(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_strip_bitmap * tiles, int depth);
+ const gx_strip_bitmap * tiles, int depth);
/*
* Change "tile" for clist_copy_*. Only uses tiles->{data, id, raster,
* rep_width, rep_height}. tiles->[rep_]shift must be zero.
*/
int clist_change_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_strip_bitmap * tiles, int depth);
+ const gx_strip_bitmap * tiles, int depth);
/* ------ Exported by gxclimag.c ------ */
@@ -702,13 +700,13 @@ int clist_change_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls,
* Write out any necessary color mapping data.
*/
int cmd_put_color_mapping(gx_device_clist_writer * cldev,
- const gs_imager_state * pis);
+ const gs_imager_state * pis);
/*
* Add commands to represent a full (device) halftone.
* (This routine should probably be in some other module.)
*/
int cmd_put_halftone(gx_device_clist_writer * cldev,
- const gx_device_halftone * pdht);
+ const gx_device_halftone * pdht);
/* ------ Exported by gxclrast.c for gxclread.c ------ */
@@ -723,16 +721,16 @@ typedef enum {
/* Play back and rasterize one band. */
int clist_playback_band(clist_playback_action action,
- gx_device_clist_reader *cdev,
- stream *s, gx_device *target,
- int x0, int y0, gs_memory_t *mem);
+ gx_device_clist_reader *cdev,
+ stream *s, gx_device *target,
+ int x0, int y0, gs_memory_t *mem);
/* Playback the band file, taking the indicated action w/ its contents. */
-int clist_playback_file_bands(clist_playback_action action,
- gx_device_clist_reader *crdev,
- gx_band_page_info_t *page_info, gx_device *target,
- int band_first, int band_last, int x0, int y0);
-#ifdef DEBUG
+int clist_playback_file_bands(clist_playback_action action,
+ gx_device_clist_reader *crdev,
+ gx_band_page_info_t *page_info, gx_device *target,
+ int band_first, int band_last, int x0, int y0);
+#ifdef DEBUG
int64_t clist_file_offset(const stream_state *st, uint buffer_offset);
int top_up_offset_map(stream_state * st, const byte *buf, const byte *ptr, const byte *end);
#endif
diff --git a/gs/base/gxclfile.c b/gs/base/gxclfile.c
index e4ef4006c..6c699f728 100644
--- a/gs/base/gxclfile.c
+++ b/gs/base/gxclfile.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,20 +29,20 @@
static int
clist_fopen(char fname[gp_file_name_sizeof], const char *fmode,
- clist_file_ptr * pcf, gs_memory_t * mem, gs_memory_t *data_mem,
- bool ok_to_compress)
+ clist_file_ptr * pcf, gs_memory_t * mem, gs_memory_t *data_mem,
+ bool ok_to_compress)
{
if (*fname == 0) {
- if (fmode[0] == 'r')
- return_error(gs_error_invalidfileaccess);
- *pcf = (clist_file_ptr)gp_open_scratch_file_64(mem,
+ if (fmode[0] == 'r')
+ return_error(gs_error_invalidfileaccess);
+ *pcf = (clist_file_ptr)gp_open_scratch_file_64(mem,
gp_scratch_file_name_prefix,
fname, fmode);
} else
- *pcf = gp_fopen(fname, fmode);
+ *pcf = gp_fopen(fname, fmode);
if (*pcf == NULL) {
- emprintf1(mem, "Could not open the scratch file %s.\n", fname);
- return_error(gs_error_invalidfileaccess);
+ emprintf1(mem, "Could not open the scratch file %s.\n", fname);
+ return_error(gs_error_invalidfileaccess);
}
return 0;
}
@@ -57,8 +57,8 @@ static int
clist_fclose(clist_file_ptr cf, const char *fname, bool delete)
{
return (fclose((FILE *) cf) != 0 ? gs_note_error(gs_error_ioerror) :
- delete ? clist_unlink(fname) :
- 0);
+ delete ? clist_unlink(fname) :
+ 0);
}
/* ------ Writing ------ */
@@ -81,24 +81,24 @@ clist_fread_chars(void *data, uint len, clist_file_ptr cf)
/* is extremely inefficient for small counts, */
/* so we just use straight-line code instead. */
switch (len) {
- default:
- return fread(str, 1, len, f);
- case 8:
- *str++ = (byte) getc(f);
- case 7:
- *str++ = (byte) getc(f);
- case 6:
- *str++ = (byte) getc(f);
- case 5:
- *str++ = (byte) getc(f);
- case 4:
- *str++ = (byte) getc(f);
- case 3:
- *str++ = (byte) getc(f);
- case 2:
- *str++ = (byte) getc(f);
- case 1:
- *str = (byte) getc(f);
+ default:
+ return fread(str, 1, len, f);
+ case 8:
+ *str++ = (byte) getc(f);
+ case 7:
+ *str++ = (byte) getc(f);
+ case 6:
+ *str++ = (byte) getc(f);
+ case 5:
+ *str++ = (byte) getc(f);
+ case 4:
+ *str++ = (byte) getc(f);
+ case 3:
+ *str++ = (byte) getc(f);
+ case 2:
+ *str++ = (byte) getc(f);
+ case 1:
+ *str = (byte) getc(f);
}
return len;
}
@@ -129,21 +129,21 @@ clist_rewind(clist_file_ptr cf, bool discard_data, const char *fname)
FILE *f = (FILE *) cf;
if (discard_data) {
- /*
- * The ANSI C stdio specification provides no operation for
- * truncating a file at a given position, or even just for
- * deleting its contents; we have to use a bizarre workaround to
- * get the same effect.
- */
- char fmode[4];
-
- /* Opening with "w" mode deletes the contents when closing. */
- (void)freopen(fname, gp_fmode_wb, f);
- strcpy(fmode, "w+");
- strcat(fmode, gp_fmode_binary_suffix);
- (void)freopen(fname, fmode, f);
+ /*
+ * The ANSI C stdio specification provides no operation for
+ * truncating a file at a given position, or even just for
+ * deleting its contents; we have to use a bizarre workaround to
+ * get the same effect.
+ */
+ char fmode[4];
+
+ /* Opening with "w" mode deletes the contents when closing. */
+ (void)freopen(fname, gp_fmode_wb, f);
+ strcpy(fmode, "w+");
+ strcat(fmode, gp_fmode_binary_suffix);
+ (void)freopen(fname, fmode, f);
} else {
- rewind(f);
+ rewind(f);
}
}
diff --git a/gs/base/gxclimag.c b/gs/base/gxclimag.c
index 71834cffe..75bd7e32c 100644
--- a/gs/base/gxclimag.c
+++ b/gs/base/gxclimag.c
@@ -481,20 +481,20 @@ clist_begin_typed_image(gx_device * dev,
/* Get the hash code of the ICC space */
if ( base_index == gs_color_space_index_ICC ) {
if (!indexed) {
- pie->color_space.icc_info.icc_hash =
+ pie->color_space.icc_info.icc_hash =
pim->ColorSpace->cmm_icc_profile_data->hashcode;
- pie->color_space.icc_info.icc_num_components =
+ pie->color_space.icc_info.icc_num_components =
pim->ColorSpace->cmm_icc_profile_data->num_comps;
- pie->color_space.icc_info.is_lab =
+ pie->color_space.icc_info.is_lab =
pim->ColorSpace->cmm_icc_profile_data->islab;
clist_icc_addentry(cdev, pim->ColorSpace->cmm_icc_profile_data->hashcode,
pim->ColorSpace->cmm_icc_profile_data);
} else {
- pie->color_space.icc_info.icc_hash =
+ pie->color_space.icc_info.icc_hash =
pim->ColorSpace->base_space->cmm_icc_profile_data->hashcode;
- pie->color_space.icc_info.icc_num_components =
+ pie->color_space.icc_info.icc_num_components =
pim->ColorSpace->base_space->cmm_icc_profile_data->num_comps;
- pie->color_space.icc_info.is_lab =
+ pie->color_space.icc_info.is_lab =
pim->ColorSpace->base_space->cmm_icc_profile_data->islab;
clist_icc_addentry(cdev, pim->ColorSpace->base_space->cmm_icc_profile_data->hashcode,
pim->ColorSpace->base_space->cmm_icc_profile_data);
@@ -962,7 +962,7 @@ clist_create_compositor(gx_device * dev,
return code;
cropping_op = code;
-
+
if (cropping_op == PUSHCROP || cropping_op == SAMEAS_PUSHCROP_BUTNOPUSH) {
first_band = ry / band_height;
last_band = (ry + rheight + band_height - 1) / band_height;
diff --git a/gs/base/gxclio.h b/gs/base/gxclio.h
index 038424c66..b233b1e93 100644
--- a/gs/base/gxclio.h
+++ b/gs/base/gxclio.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,9 +40,9 @@ struct clist_io_procs_s {
* Mode "r" with *fname = 0 is an error.
*/
int (*fopen)(char fname[gp_file_name_sizeof], const char *fmode,
- clist_file_ptr * pcf,
- gs_memory_t * mem, gs_memory_t *data_mem,
- bool ok_to_compress);
+ clist_file_ptr * pcf,
+ gs_memory_t * mem, gs_memory_t *data_mem,
+ bool ok_to_compress);
/*
* Close a file, optionally deleting it.
diff --git a/gs/base/gxclip.c b/gs/base/gxclip.c
index b8fa54eb7..5ba2b3af9 100644
--- a/gs/base/gxclip.c
+++ b/gs/base/gxclip.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,7 +41,7 @@ static dev_proc_get_bits_rectangle(clip_get_bits_rectangle);
/* The device descriptor. */
static const gx_device_clip gs_clip_device =
{std_device_std_body(gx_device_clip, 0, "clipper",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{clip_open,
gx_forward_get_initial_matrix,
gx_default_sync_output,
@@ -129,7 +129,7 @@ gx_make_clip_device_on_stack(gx_device_clip * dev, const gx_clip_path *pcpath, g
}
void
gx_make_clip_device_in_heap(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
gx_device_init((gx_device *)dev, (const gx_device *)&gs_clip_device, mem, true);
dev->list = *gx_cpath_list(pcpath);
@@ -164,10 +164,10 @@ static const uint clip_interval = 10000;
*/
static int
clip_enumerate_rest(gx_device_clip * rdev,
- int x, int y, int xe, int ye,
- int (*process)(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
- clip_callback_data_t * pccd)
+ int x, int y, int xe, int ye,
+ int (*process)(clip_callback_data_t * pccd,
+ int xc, int yc, int xec, int yec),
+ clip_callback_data_t * pccd)
{
gx_clip_rect *rptr = rdev->current; /* const within algorithm */
int yc;
@@ -175,12 +175,12 @@ clip_enumerate_rest(gx_device_clip * rdev,
#ifdef DEBUG
if (INCR(loops) % clip_interval == 0 && gs_debug_c('q')) {
- dprintf5("[q]loops=%ld out=%ld in_y=%ld in=%ld in1=%ld\n",
- stats_clip.loops, stats_clip.out, stats_clip.in,
- stats_clip.in_y, stats_clip.in1);
- dprintf4("[q] down=%ld up=%ld x=%ld no_x=%ld\n",
- stats_clip.down, stats_clip.up, stats_clip.x,
- stats_clip.no_x);
+ dprintf5("[q]loops=%ld out=%ld in_y=%ld in=%ld in1=%ld\n",
+ stats_clip.loops, stats_clip.out, stats_clip.in,
+ stats_clip.in_y, stats_clip.in1);
+ dprintf4("[q] down=%ld up=%ld x=%ld no_x=%ld\n",
+ stats_clip.down, stats_clip.up, stats_clip.x,
+ stats_clip.no_x);
}
#endif
pccd->x = x, pccd->y = y;
@@ -198,42 +198,42 @@ clip_enumerate_rest(gx_device_clip * rdev,
* the list.
*/
if (y >= rptr->ymax) {
- if ((rptr = rptr->next) != 0)
- while (INCR_THEN(up, y >= rptr->ymax))
- rptr = rptr->next;
+ if ((rptr = rptr->next) != 0)
+ while (INCR_THEN(up, y >= rptr->ymax))
+ rptr = rptr->next;
} else
- while (rptr->prev != 0 && y < rptr->prev->ymax)
- INCR_THEN(down, rptr = rptr->prev);
+ while (rptr->prev != 0 && y < rptr->prev->ymax)
+ INCR_THEN(down, rptr = rptr->prev);
if (rptr == 0 || (yc = rptr->ymin) >= ye) {
- INCR(out);
- if (rdev->list.count > 1)
- rdev->current =
- (rptr != 0 ? rptr :
- y >= rdev->current->ymax ? rdev->list.tail :
- rdev->list.head);
- return 0;
+ INCR(out);
+ if (rdev->list.count > 1)
+ rdev->current =
+ (rptr != 0 ? rptr :
+ y >= rdev->current->ymax ? rdev->list.tail :
+ rdev->list.head);
+ return 0;
}
rdev->current = rptr;
if (yc < y)
- yc = y;
+ yc = y;
do {
- const int ymax = rptr->ymax;
- int yec = min(ymax, ye);
-
- if_debug2('Q', "[Q]yc=%d yec=%d\n", yc, yec);
- do {
- int xc = rptr->xmin;
- int xec = rptr->xmax;
-
- if (xc < x)
- xc = x;
- if (xec > xe)
- xec = xe;
- if (xec > xc) {
- clip_rect_print('Q', "match", rptr);
- if_debug2('Q', "[Q]xc=%d xec=%d\n", xc, xec);
- INCR(x);
+ const int ymax = rptr->ymax;
+ int yec = min(ymax, ye);
+
+ if_debug2('Q', "[Q]yc=%d yec=%d\n", yc, yec);
+ do {
+ int xc = rptr->xmin;
+ int xec = rptr->xmax;
+
+ if (xc < x)
+ xc = x;
+ if (xec > xe)
+ xec = xe;
+ if (xec > xc) {
+ clip_rect_print('Q', "match", rptr);
+ if_debug2('Q', "[Q]xc=%d xec=%d\n", xc, xec);
+ INCR(x);
/*
* Conditionally look ahead to detect unclipped vertical strips. This is
* really only valuable for 90 degree rotated images or (nearly-)vertical
@@ -242,45 +242,45 @@ clip_enumerate_rest(gx_device_clip * rdev,
* take out the code here with no adverse effects.
*/
#ifdef CHECK_VERTICAL_CLIPPING
- if (xec - xc == pccd->w) { /* full width */
- /* Look ahead for a vertical swath. */
- while ((rptr = rptr->next) != 0 &&
- rptr->ymin == yec &&
- rptr->ymax <= ye &&
- rptr->xmin <= x &&
- rptr->xmax >= xe
- )
- yec = rptr->ymax;
- } else
- rptr = rptr->next;
+ if (xec - xc == pccd->w) { /* full width */
+ /* Look ahead for a vertical swath. */
+ while ((rptr = rptr->next) != 0 &&
+ rptr->ymin == yec &&
+ rptr->ymax <= ye &&
+ rptr->xmin <= x &&
+ rptr->xmax >= xe
+ )
+ yec = rptr->ymax;
+ } else
+ rptr = rptr->next;
#else
- rptr = rptr->next;
+ rptr = rptr->next;
#endif
- code = process(pccd, xc, yc, xec, yec);
- if (code < 0)
- return code;
- } else {
- INCR_THEN(no_x, rptr = rptr->next);
- }
- if (rptr == 0)
- return 0;
- }
- while (rptr->ymax == ymax);
+ code = process(pccd, xc, yc, xec, yec);
+ if (code < 0)
+ return code;
+ } else {
+ INCR_THEN(no_x, rptr = rptr->next);
+ }
+ if (rptr == 0)
+ return 0;
+ }
+ while (rptr->ymax == ymax);
} while ((yc = rptr->ymin) < ye);
return 0;
}
static int
clip_enumerate(gx_device_clip * rdev, int x, int y, int w, int h,
- int (*process)(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
- clip_callback_data_t * pccd)
+ int (*process)(clip_callback_data_t * pccd,
+ int xc, int yc, int xec, int yec),
+ clip_callback_data_t * pccd)
{
int xe, ye;
const gx_clip_rect *rptr = rdev->current;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
pccd->tdev = rdev->target;
x += rdev->translation.x;
xe = x + w;
@@ -288,10 +288,10 @@ clip_enumerate(gx_device_clip * rdev, int x, int y, int w, int h,
ye = y + h;
/* Check for the region being entirely within the current rectangle. */
if (y >= rptr->ymin && ye <= rptr->ymax &&
- x >= rptr->xmin && xe <= rptr->xmax
- ) {
- pccd->x = x, pccd->y = y, pccd->w = w, pccd->h = h;
- return INCR_THEN(in, process(pccd, x, y, xe, ye));
+ x >= rptr->xmin && xe <= rptr->xmax
+ ) {
+ pccd->x = x, pccd->y = y, pccd->w = w, pccd->h = h;
+ return INCR_THEN(in, process(pccd, x, y, xe, ye));
}
return clip_enumerate_rest(rdev, x, y, xe, ye, process, pccd);
}
@@ -305,7 +305,7 @@ clip_open(gx_device * dev)
/* Initialize the cursor. */
rdev->current =
- (rdev->list.head == 0 ? &rdev->list.single : rdev->list.head);
+ (rdev->list.head == 0 ? &rdev->list.single : rdev->list.head);
rdev->color_info = tdev->color_info;
rdev->cached_colors = tdev->cached_colors;
rdev->width = tdev->width;
@@ -321,11 +321,11 @@ int
clip_call_fill_rectangle(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, fill_rectangle))
- (pccd->tdev, xc, yc, xec - xc, yec - yc, pccd->color[0]);
+ (pccd->tdev, xc, yc, xec - xc, yec - yc, pccd->color[0]);
}
static int
clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
@@ -335,39 +335,39 @@ clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
int xe, ye;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
x += rdev->translation.x;
xe = x + w;
y += rdev->translation.y;
ye = y + h;
/* We open-code the most common cases here. */
if ((y >= rptr->ymin && ye <= rptr->ymax) ||
- ((rptr = rptr->next) != 0 &&
- y >= rptr->ymin && ye <= rptr->ymax)
- ) {
- rdev->current = rptr; /* may be redundant, but awkward to avoid */
- INCR(in_y);
- if (x >= rptr->xmin && xe <= rptr->xmax) {
- INCR(in);
- return dev_proc(tdev, fill_rectangle)(tdev, x, y, w, h, color);
- }
- else if ((rptr->prev == 0 || rptr->prev->ymax != rptr->ymax) &&
- (rptr->next == 0 || rptr->next->ymax != rptr->ymax)
- ) {
- INCR(in1);
- if (x < rptr->xmin)
- x = rptr->xmin;
- if (xe > rptr->xmax)
- xe = rptr->xmax;
- return
- (x >= xe ? 0 :
- dev_proc(tdev, fill_rectangle)(tdev, x, y, xe - x, h, color));
- }
+ ((rptr = rptr->next) != 0 &&
+ y >= rptr->ymin && ye <= rptr->ymax)
+ ) {
+ rdev->current = rptr; /* may be redundant, but awkward to avoid */
+ INCR(in_y);
+ if (x >= rptr->xmin && xe <= rptr->xmax) {
+ INCR(in);
+ return dev_proc(tdev, fill_rectangle)(tdev, x, y, w, h, color);
+ }
+ else if ((rptr->prev == 0 || rptr->prev->ymax != rptr->ymax) &&
+ (rptr->next == 0 || rptr->next->ymax != rptr->ymax)
+ ) {
+ INCR(in1);
+ if (x < rptr->xmin)
+ x = rptr->xmin;
+ if (xe > rptr->xmax)
+ xe = rptr->xmax;
+ return
+ (x >= xe ? 0 :
+ dev_proc(tdev, fill_rectangle)(tdev, x, y, xe - x, h, color));
+ }
}
ccdata.tdev = tdev;
ccdata.color[0] = color;
return clip_enumerate_rest(rdev, x, y, xe, ye,
- clip_call_fill_rectangle, &ccdata);
+ clip_call_fill_rectangle, &ccdata);
}
/* Copy a monochrome rectangle */
@@ -375,15 +375,15 @@ int
clip_call_copy_mono(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, copy_mono))
- (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
- pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
- xc, yc, xec - xc, yec - yc, pccd->color[0], pccd->color[1]);
+ (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
+ pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
+ xc, yc, xec - xc, yec - yc, pccd->color[0], pccd->color[1]);
}
static int
clip_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
@@ -393,24 +393,24 @@ clip_copy_mono(gx_device * dev,
int xe, ye;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
x += rdev->translation.x;
xe = x + w;
y += rdev->translation.y;
ye = y + h;
if (y >= rptr->ymin && ye <= rptr->ymax) {
- INCR(in_y);
- if (x >= rptr->xmin && xe <= rptr->xmax) {
- INCR(in);
- return dev_proc(tdev, copy_mono)
- (tdev, data, sourcex, raster, id, x, y, w, h, color0, color1);
- }
+ INCR(in_y);
+ if (x >= rptr->xmin && xe <= rptr->xmax) {
+ INCR(in);
+ return dev_proc(tdev, copy_mono)
+ (tdev, data, sourcex, raster, id, x, y, w, h, color0, color1);
+ }
}
ccdata.tdev = tdev;
ccdata.data = data, ccdata.sourcex = sourcex, ccdata.raster = raster;
ccdata.color[0] = color0, ccdata.color[1] = color1;
return clip_enumerate_rest(rdev, x, y, xe, ye,
- clip_call_copy_mono, &ccdata);
+ clip_call_copy_mono, &ccdata);
}
/* Copy a color rectangle */
@@ -418,14 +418,14 @@ int
clip_call_copy_color(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, copy_color))
- (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
- pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
- xc, yc, xec - xc, yec - yc);
+ (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
+ pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
+ xc, yc, xec - xc, yec - yc);
}
static int
clip_copy_color(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
@@ -439,15 +439,15 @@ int
clip_call_copy_alpha(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, copy_alpha))
- (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
- pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
- xc, yc, xec - xc, yec - yc, pccd->color[0], pccd->depth);
+ (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
+ pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
+ xc, yc, xec - xc, yec - yc, pccd->color[0], pccd->depth);
}
static int
clip_copy_alpha(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color, int depth)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color, int depth)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
@@ -462,25 +462,25 @@ int
clip_call_fill_mask(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, fill_mask))
- (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
- pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
- xc, yc, xec - xc, yec - yc, pccd->pdcolor, pccd->depth,
- pccd->lop, NULL);
+ (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
+ pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
+ xc, yc, xec - xc, yec - yc, pccd->pdcolor, pccd->depth,
+ pccd->lop, NULL);
}
static int
clip_fill_mask(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
if (pcpath != 0)
- return gx_default_fill_mask(dev, data, sourcex, raster, id,
- x, y, w, h, pdcolor, depth, lop,
- pcpath);
+ return gx_default_fill_mask(dev, data, sourcex, raster, id,
+ x, y, w, h, pdcolor, depth, lop,
+ pcpath);
ccdata.data = data, ccdata.sourcex = sourcex, ccdata.raster = raster;
ccdata.pdcolor = pdcolor, ccdata.depth = depth, ccdata.lop = lop;
return clip_enumerate(rdev, x, y, w, h, clip_call_fill_mask, &ccdata);
@@ -491,12 +491,12 @@ int
clip_call_strip_tile_rectangle(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, strip_tile_rectangle))
- (pccd->tdev, pccd->tiles, xc, yc, xec - xc, yec - yc,
- pccd->color[0], pccd->color[1], pccd->phase.x, pccd->phase.y);
+ (pccd->tdev, pccd->tiles, xc, yc, xec - xc, yec - yc,
+ pccd->color[0], pccd->color[1], pccd->phase.x, pccd->phase.y);
}
static int
clip_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
+ int x, int y, int w, int h,
gx_color_index color0, gx_color_index color1, int phase_x, int phase_y)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
@@ -513,26 +513,26 @@ int
clip_call_strip_copy_rop(clip_callback_data_t * pccd, int xc, int yc, int xec, int yec)
{
return (*dev_proc(pccd->tdev, strip_copy_rop))
- (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
- pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
- pccd->scolors, pccd->textures, pccd->tcolors,
- xc, yc, xec - xc, yec - yc, pccd->phase.x, pccd->phase.y,
- pccd->lop);
+ (pccd->tdev, pccd->data + (yc - pccd->y) * pccd->raster,
+ pccd->sourcex + xc - pccd->x, pccd->raster, gx_no_bitmap_id,
+ pccd->scolors, pccd->textures, pccd->tcolors,
+ xc, yc, xec - xc, yec - yc, pccd->phase.x, pccd->phase.y,
+ pccd->lop);
}
static int
clip_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint raster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int w, int h,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint raster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int w, int h,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
clip_callback_data_t ccdata;
ccdata.data = sdata, ccdata.sourcex = sourcex, ccdata.raster = raster;
ccdata.scolors = scolors, ccdata.textures = textures,
- ccdata.tcolors = tcolors;
+ ccdata.tcolors = tcolors;
ccdata.phase.x = phase_x, ccdata.phase.y = phase_y, ccdata.lop = lop;
return clip_enumerate(rdev, x, y, w, h, clip_call_strip_copy_rop, &ccdata);
}
@@ -544,42 +544,42 @@ clip_get_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
gx_device_clip *const rdev = (gx_device_clip *) dev;
if (!rdev->clipping_box_set) {
- gx_device *tdev = rdev->target;
- gs_fixed_rect tbox;
-
- (*dev_proc(tdev, get_clipping_box)) (tdev, &tbox);
- if (rdev->list.count != 0) {
- gs_fixed_rect cbox;
-
- if (rdev->list.count == 1) {
- cbox.p.x = int2fixed(rdev->list.single.xmin);
- cbox.p.y = int2fixed(rdev->list.single.ymin);
- cbox.q.x = int2fixed(rdev->list.single.xmax);
- cbox.q.y = int2fixed(rdev->list.single.ymax);
- } else {
- /* The head and tail elements are dummies.... */
- cbox.p.x = int2fixed(rdev->list.xmin);
- cbox.p.y = int2fixed(rdev->list.head->next->ymin);
- cbox.q.x = int2fixed(rdev->list.xmax);
- cbox.q.y = int2fixed(rdev->list.tail->prev->ymax);
- }
- rect_intersect(tbox, cbox);
- }
- if (rdev->translation.x | rdev->translation.y) {
- fixed tx = int2fixed(rdev->translation.x),
- ty = int2fixed(rdev->translation.y);
-
- if (tbox.p.x != min_fixed)
- tbox.p.x -= tx;
- if (tbox.p.y != min_fixed)
- tbox.p.y -= ty;
- if (tbox.q.x != max_fixed)
- tbox.q.x -= tx;
- if (tbox.q.y != max_fixed)
- tbox.q.y -= ty;
- }
- rdev->clipping_box = tbox;
- rdev->clipping_box_set = true;
+ gx_device *tdev = rdev->target;
+ gs_fixed_rect tbox;
+
+ (*dev_proc(tdev, get_clipping_box)) (tdev, &tbox);
+ if (rdev->list.count != 0) {
+ gs_fixed_rect cbox;
+
+ if (rdev->list.count == 1) {
+ cbox.p.x = int2fixed(rdev->list.single.xmin);
+ cbox.p.y = int2fixed(rdev->list.single.ymin);
+ cbox.q.x = int2fixed(rdev->list.single.xmax);
+ cbox.q.y = int2fixed(rdev->list.single.ymax);
+ } else {
+ /* The head and tail elements are dummies.... */
+ cbox.p.x = int2fixed(rdev->list.xmin);
+ cbox.p.y = int2fixed(rdev->list.head->next->ymin);
+ cbox.q.x = int2fixed(rdev->list.xmax);
+ cbox.q.y = int2fixed(rdev->list.tail->prev->ymax);
+ }
+ rect_intersect(tbox, cbox);
+ }
+ if (rdev->translation.x | rdev->translation.y) {
+ fixed tx = int2fixed(rdev->translation.x),
+ ty = int2fixed(rdev->translation.y);
+
+ if (tbox.p.x != min_fixed)
+ tbox.p.x -= tx;
+ if (tbox.p.y != min_fixed)
+ tbox.p.y -= ty;
+ if (tbox.q.x != max_fixed)
+ tbox.q.x -= tx;
+ if (tbox.q.y != max_fixed)
+ tbox.q.y -= ty;
+ }
+ rdev->clipping_box = tbox;
+ rdev->clipping_box_set = true;
}
*pbox = rdev->clipping_box;
}
@@ -587,7 +587,7 @@ clip_get_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
/* Get bits back from the device. */
static int
clip_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_clip *rdev = (gx_device_clip *) dev;
gx_device *tdev = rdev->target;
@@ -598,16 +598,16 @@ clip_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
rect.p.x = prect->p.x - tx, rect.p.y = prect->p.y - ty;
rect.q.x = prect->q.x - tx, rect.q.y = prect->q.y - ty;
code = (*dev_proc(tdev, get_bits_rectangle))
- (tdev, &rect, params, unread);
+ (tdev, &rect, params, unread);
if (code > 0) {
- /* Adjust unread rectangle coordinates */
- gs_int_rect *list = *unread;
- int i;
-
- for (i = 0; i < code; ++list, ++i) {
- list->p.x += tx, list->p.y += ty;
- list->q.x += tx, list->q.y += ty;
- }
+ /* Adjust unread rectangle coordinates */
+ gs_int_rect *list = *unread;
+ int i;
+
+ for (i = 0; i < code; ++list, ++i) {
+ list->p.x += tx, list->p.y += ty;
+ list->q.x += tx, list->q.y += ty;
+ }
}
return code;
}
diff --git a/gs/base/gxclip.h b/gs/base/gxclip.h
index 6e9ea367b..b112cce33 100644
--- a/gs/base/gxclip.h
+++ b/gs/base/gxclip.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,18 +50,18 @@ typedef struct clip_callback_data_s {
/* Declare the callback procedures. */
int
clip_call_fill_rectangle(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_copy_mono(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_copy_color(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_copy_alpha(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_fill_mask(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_strip_tile_rectangle(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec),
+ int xc, int yc, int xec, int yec),
clip_call_strip_copy_rop(clip_callback_data_t * pccd,
- int xc, int yc, int xec, int yec);
+ int xc, int yc, int xec, int yec);
#endif /* gxclip_INCLUDED */
diff --git a/gs/base/gxclip2.c b/gs/base/gxclip2.c
index 1549021bf..56ac44b6e 100644
--- a/gs/base/gxclip2.c
+++ b/gs/base/gxclip2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ static dev_proc_strip_copy_rop(tile_clip_strip_copy_rop);
/* The device descriptor. */
static const gx_device_tile_clip gs_tile_clip_device =
{std_device_std_body_open(gx_device_tile_clip, 0, "tile clipper",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{gx_default_open_device,
gx_forward_get_initial_matrix,
gx_default_sync_output,
@@ -106,16 +106,16 @@ static const gx_device_tile_clip gs_tile_clip_device =
/* Initialize a tile clipping device from a mask. */
int
tile_clip_initialize(gx_device_tile_clip * cdev, const gx_strip_bitmap * tiles,
- gx_device * tdev, int px, int py, gs_memory_t *mem)
+ gx_device * tdev, int px, int py, gs_memory_t *mem)
{
int code =
gx_mask_clip_initialize(cdev, &gs_tile_clip_device,
- (const gx_bitmap *)tiles,
- tdev, 0, 0, mem); /* phase will be reset */
+ (const gx_bitmap *)tiles,
+ tdev, 0, 0, mem); /* phase will be reset */
if (code >= 0) {
- cdev->tiles = *tiles;
- tile_clip_set_phase(cdev, px, py);
+ cdev->tiles = *tiles;
+ tile_clip_set_phase(cdev, px, py);
}
return code;
}
@@ -131,14 +131,14 @@ tile_clip_set_phase(gx_device_tile_clip * cdev, int px, int py)
/* Fill a rectangle by tiling with the mask. */
static int
tile_clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_tile_clip *cdev = (gx_device_tile_clip *) dev;
gx_device *tdev = cdev->target;
return (*dev_proc(tdev, strip_tile_rectangle)) (tdev, &cdev->tiles,
- x, y, w, h,
- gx_no_color_index, color, cdev->phase.x, cdev->phase.y);
+ x, y, w, h,
+ gx_no_color_index, color, cdev->phase.x, cdev->phase.y);
}
/* Calculate the X offset corresponding to a given Y, taking the phase */
@@ -152,9 +152,9 @@ tile_clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* combination of the tile mask and the source. */
static int
tile_clip_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_tile_clip *cdev = (gx_device_tile_clip *) dev;
gx_color_index color, mcolor0, mcolor1;
@@ -163,36 +163,36 @@ tile_clip_copy_mono(gx_device * dev,
setup_mask_copy_mono(cdev, color, mcolor0, mcolor1);
for (ty = y; ty < y + h; ty += ny) {
- int tx, nx;
- int cy = (ty + cdev->phase.y) % cdev->tiles.rep_height;
- int xoff = x_offset(ty, cdev);
+ int tx, nx;
+ int cy = (ty + cdev->phase.y) % cdev->tiles.rep_height;
+ int xoff = x_offset(ty, cdev);
- ny = min(y + h - ty, cdev->tiles.size.y - cy);
- if (ny > cdev->mdev.height)
- ny = cdev->mdev.height;
- for (tx = x; tx < x + w; tx += nx) {
- int cx = (tx + xoff) % cdev->tiles.rep_width;
+ ny = min(y + h - ty, cdev->tiles.size.y - cy);
+ if (ny > cdev->mdev.height)
+ ny = cdev->mdev.height;
+ for (tx = x; tx < x + w; tx += nx) {
+ int cx = (tx + xoff) % cdev->tiles.rep_width;
- nx = min(x + w - tx, cdev->tiles.size.x - cx);
- /* Copy a tile slice to the memory device buffer. */
- memcpy(cdev->buffer.bytes,
- cdev->tiles.data + cy * cdev->tiles.raster,
- cdev->tiles.raster * ny);
- /* Intersect the tile with the source data. */
- /* mcolor0 and mcolor1 invert the data if needed. */
- /* This call can't fail. */
- (*dev_proc(&cdev->mdev, copy_mono)) ((gx_device *) & cdev->mdev,
- data + (ty - y) * raster, sourcex + tx - x,
- raster, gx_no_bitmap_id,
- cx, 0, nx, ny, mcolor0, mcolor1);
- /* Now copy the color through the double mask. */
- code = (*dev_proc(cdev->target, copy_mono)) (cdev->target,
- cdev->buffer.bytes, cx, cdev->tiles.raster,
- gx_no_bitmap_id,
- tx, ty, nx, ny, gx_no_color_index, color);
- if (code < 0)
- return code;
- }
+ nx = min(x + w - tx, cdev->tiles.size.x - cx);
+ /* Copy a tile slice to the memory device buffer. */
+ memcpy(cdev->buffer.bytes,
+ cdev->tiles.data + cy * cdev->tiles.raster,
+ cdev->tiles.raster * ny);
+ /* Intersect the tile with the source data. */
+ /* mcolor0 and mcolor1 invert the data if needed. */
+ /* This call can't fail. */
+ (*dev_proc(&cdev->mdev, copy_mono)) ((gx_device *) & cdev->mdev,
+ data + (ty - y) * raster, sourcex + tx - x,
+ raster, gx_no_bitmap_id,
+ cx, 0, nx, ny, mcolor0, mcolor1);
+ /* Now copy the color through the double mask. */
+ code = (*dev_proc(cdev->target, copy_mono)) (cdev->target,
+ cdev->buffer.bytes, cx, cdev->tiles.raster,
+ gx_no_bitmap_id,
+ tx, ty, nx, ny, gx_no_color_index, color);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
@@ -216,60 +216,60 @@ tile_clip_copy_mono(gx_device * dev,
tx++;\
} END
#define FOR_RUNS(data_row, tx1, tx, ty)\
- const byte *data_row = data;\
- int cy = (y + cdev->phase.y) % cdev->tiles.rep_height;\
- const byte *tile_row = cdev->tiles.data + cy * cdev->tiles.raster;\
- int ty;\
+ const byte *data_row = data;\
+ int cy = (y + cdev->phase.y) % cdev->tiles.rep_height;\
+ const byte *tile_row = cdev->tiles.data + cy * cdev->tiles.raster;\
+ int ty;\
\
- for ( ty = y; ty < y + h; ty++, data_row += raster ) {\
- int cx = (x + x_offset(ty, cdev)) % cdev->tiles.rep_width;\
- const byte *tp = tile_row + (cx >> 3);\
- byte tbit = 0x80 >> (cx & 7);\
- int tx;\
+ for ( ty = y; ty < y + h; ty++, data_row += raster ) {\
+ int cx = (x + x_offset(ty, cdev)) % cdev->tiles.rep_width;\
+ const byte *tp = tile_row + (cx >> 3);\
+ byte tbit = 0x80 >> (cx & 7);\
+ int tx;\
\
- for ( tx = x; tx < x + w; ) {\
- int tx1;\
+ for ( tx = x; tx < x + w; ) {\
+ int tx1;\
\
- /* Skip a run of 0s. */\
- while ( tx < x + w && (*tp & tbit) == 0 )\
- t_next(tx);\
- if ( tx == x + w )\
- break;\
- /* Scan a run of 1s. */\
- tx1 = tx;\
- do {\
- t_next(tx);\
- } while ( tx < x + w && (*tp & tbit) != 0 );\
- if_debug3('T', "[T]run x=(%d,%d), y=%d\n", tx1, tx, ty);
+ /* Skip a run of 0s. */\
+ while ( tx < x + w && (*tp & tbit) == 0 )\
+ t_next(tx);\
+ if ( tx == x + w )\
+ break;\
+ /* Scan a run of 1s. */\
+ tx1 = tx;\
+ do {\
+ t_next(tx);\
+ } while ( tx < x + w && (*tp & tbit) != 0 );\
+ if_debug3('T', "[T]run x=(%d,%d), y=%d\n", tx1, tx, ty);
/* (body goes here) */
#define END_FOR_RUNS()\
- }\
- if ( ++cy == cdev->tiles.size.y )\
- cy = 0, tile_row = cdev->tiles.data;\
- else\
- tile_row += cdev->tiles.raster;\
- }
+ }\
+ if ( ++cy == cdev->tiles.size.y )\
+ cy = 0, tile_row = cdev->tiles.data;\
+ else\
+ tile_row += cdev->tiles.raster;\
+ }
/* Copy a color rectangle. */
static int
tile_clip_copy_color(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_tile_clip *cdev = (gx_device_tile_clip *) dev;
fit_copy(dev, data, sourcex, raster, id, x, y, w, h);
{
- FOR_RUNS(data_row, txrun, tx, ty) {
- /* Copy the run. */
- int code = (*dev_proc(cdev->target, copy_color))
- (cdev->target, data_row, sourcex + txrun - x, raster,
- gx_no_bitmap_id, txrun, ty, tx - txrun, 1);
+ FOR_RUNS(data_row, txrun, tx, ty) {
+ /* Copy the run. */
+ int code = (*dev_proc(cdev->target, copy_color))
+ (cdev->target, data_row, sourcex + txrun - x, raster,
+ gx_no_bitmap_id, txrun, ty, tx - txrun, 1);
- if (code < 0)
- return code;
- }
- END_FOR_RUNS();
+ if (code < 0)
+ return code;
+ }
+ END_FOR_RUNS();
}
return 0;
}
@@ -277,23 +277,23 @@ tile_clip_copy_color(gx_device * dev,
/* Copy an alpha rectangle similarly. */
static int
tile_clip_copy_alpha(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index color, int depth)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index color, int depth)
{
gx_device_tile_clip *cdev = (gx_device_tile_clip *) dev;
fit_copy(dev, data, sourcex, raster, id, x, y, w, h);
{
- FOR_RUNS(data_row, txrun, tx, ty) {
- /* Copy the run. */
- int code = (*dev_proc(cdev->target, copy_alpha))
- (cdev->target, data_row, sourcex + txrun - x, raster,
- gx_no_bitmap_id, txrun, ty, tx - txrun, 1, color, depth);
+ FOR_RUNS(data_row, txrun, tx, ty) {
+ /* Copy the run. */
+ int code = (*dev_proc(cdev->target, copy_alpha))
+ (cdev->target, data_row, sourcex + txrun - x, raster,
+ gx_no_bitmap_id, txrun, ty, tx - txrun, 1, color, depth);
- if (code < 0)
- return code;
- }
- END_FOR_RUNS();
+ if (code < 0)
+ return code;
+ }
+ END_FOR_RUNS();
}
return 0;
}
@@ -301,27 +301,27 @@ tile_clip_copy_alpha(gx_device * dev,
/* Copy a RasterOp rectangle similarly. */
static int
tile_clip_strip_copy_rop(gx_device * dev,
- const byte * data, int sourcex, uint raster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int w, int h,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * data, int sourcex, uint raster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int w, int h,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_tile_clip *cdev = (gx_device_tile_clip *) dev;
fit_copy(dev, data, sourcex, raster, id, x, y, w, h);
{
- FOR_RUNS(data_row, txrun, tx, ty) {
- /* Copy the run. */
- int code = (*dev_proc(cdev->target, strip_copy_rop))
- (cdev->target, data_row, sourcex + txrun - x, raster,
- gx_no_bitmap_id, scolors, textures, tcolors,
- txrun, ty, tx - txrun, 1, phase_x, phase_y, lop);
+ FOR_RUNS(data_row, txrun, tx, ty) {
+ /* Copy the run. */
+ int code = (*dev_proc(cdev->target, strip_copy_rop))
+ (cdev->target, data_row, sourcex + txrun - x, raster,
+ gx_no_bitmap_id, scolors, textures, tcolors,
+ txrun, ty, tx - txrun, 1, phase_x, phase_y, lop);
- if (code < 0)
- return code;
- }
- END_FOR_RUNS();
+ if (code < 0)
+ return code;
+ }
+ END_FOR_RUNS();
}
return 0;
}
diff --git a/gs/base/gxclip2.h b/gs/base/gxclip2.h
index 654007da5..b973f1630 100644
--- a/gs/base/gxclip2.h
+++ b/gs/base/gxclip2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,9 +36,9 @@ typedef gx_device_mask_clip gx_device_tile_clip;
* We supply an explicit phase.
*/
int tile_clip_initialize(gx_device_tile_clip * cdev,
- const gx_strip_bitmap * tiles,
- gx_device * tdev, int px, int py,
- gs_memory_t *mem);
+ const gx_strip_bitmap * tiles,
+ gx_device * tdev, int px, int py,
+ gs_memory_t *mem);
/*
* Set the phase of the tile -- used in the tiling loop when
diff --git a/gs/base/gxclipm.c b/gs/base/gxclipm.c
index 4c64d6845..4b5b633d5 100644
--- a/gs/base/gxclipm.c
+++ b/gs/base/gxclipm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ static dev_proc_get_clipping_box(mask_clip_get_clipping_box);
/* The device descriptor. */
const gx_device_mask_clip gs_mask_clip_device =
{std_device_std_body_open(gx_device_mask_clip, 0, "mask clipper",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{gx_default_open_device,
gx_forward_get_initial_matrix,
gx_default_sync_output,
@@ -105,7 +105,7 @@ const gx_device_mask_clip gs_mask_clip_device =
/* Fill a rectangle by painting through the mask. */
static int
mask_clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
gx_device *tdev = cdev->target;
@@ -115,18 +115,18 @@ mask_clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
int mx1 = mx0 + w, my1 = my0 + h;
if (mx0 < 0)
- mx0 = 0;
+ mx0 = 0;
if (my0 < 0)
- my0 = 0;
+ my0 = 0;
if (mx1 > cdev->tiles.size.x)
- mx1 = cdev->tiles.size.x;
+ mx1 = cdev->tiles.size.x;
if (my1 > cdev->tiles.size.y)
- my1 = cdev->tiles.size.y;
+ my1 = cdev->tiles.size.y;
return (*dev_proc(tdev, copy_mono))
- (tdev, cdev->tiles.data + my0 * cdev->tiles.raster, mx0,
- cdev->tiles.raster, cdev->tiles.id,
- mx0 - cdev->phase.x, my0 - cdev->phase.y,
- mx1 - mx0, my1 - my0, gx_no_color_index, color);
+ (tdev, cdev->tiles.data + my0 * cdev->tiles.raster, mx0,
+ cdev->tiles.raster, cdev->tiles.id,
+ mx0 - cdev->phase.x, my0 - cdev->phase.y,
+ mx1 - mx0, my1 - my0, gx_no_color_index, color);
}
/*
@@ -137,29 +137,29 @@ mask_clip_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
* References cdev, data, sourcex, raster, x, y, w, h.
*/
#define DECLARE_MASK_COPY\
- const byte *sdata;\
- int sx, mx0, my0, mx1, my1
+ const byte *sdata;\
+ int sx, mx0, my0, mx1, my1
#define FIT_MASK_COPY(data, sourcex, raster, vx, vy, vw, vh)\
- BEGIN\
- sdata = data, sx = sourcex;\
- mx0 = vx + cdev->phase.x, my0 = vy + cdev->phase.y;\
- mx1 = mx0 + vw, my1 = my0 + vh;\
- if ( mx0 < 0 )\
- sx -= mx0, mx0 = 0;\
- if ( my0 < 0 )\
- sdata -= my0 * raster, my0 = 0;\
- if ( mx1 > cdev->tiles.size.x )\
- mx1 = cdev->tiles.size.x;\
- if ( my1 > cdev->tiles.size.y )\
- my1 = cdev->tiles.size.y;\
- END
+ BEGIN\
+ sdata = data, sx = sourcex;\
+ mx0 = vx + cdev->phase.x, my0 = vy + cdev->phase.y;\
+ mx1 = mx0 + vw, my1 = my0 + vh;\
+ if ( mx0 < 0 )\
+ sx -= mx0, mx0 = 0;\
+ if ( my0 < 0 )\
+ sdata -= my0 * raster, my0 = 0;\
+ if ( mx1 > cdev->tiles.size.x )\
+ mx1 = cdev->tiles.size.x;\
+ if ( my1 > cdev->tiles.size.y )\
+ my1 = cdev->tiles.size.y;\
+ END
/* Copy a monochrome bitmap by playing Boolean games. */
static int
mask_clip_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
gx_device *tdev = cdev->target;
@@ -172,35 +172,35 @@ mask_clip_copy_mono(gx_device * dev,
setup_mask_copy_mono(cdev, color, mcolor0, mcolor1);
FIT_MASK_COPY(data, sourcex, raster, x, y, w, h);
for (cy = my0; cy < my1; cy += ny) {
- int ty = cy - cdev->phase.y;
- int cx, nx;
+ int ty = cy - cdev->phase.y;
+ int cx, nx;
- ny = my1 - cy;
- if (ny > cdev->mdev.height)
- ny = cdev->mdev.height;
- for (cx = mx0; cx < mx1; cx += nx) {
- int tx = cx - cdev->phase.x;
+ ny = my1 - cy;
+ if (ny > cdev->mdev.height)
+ ny = cdev->mdev.height;
+ for (cx = mx0; cx < mx1; cx += nx) {
+ int tx = cx - cdev->phase.x;
- nx = mx1 - cx; /* also should be min */
- /* Copy a tile slice to the memory device buffer. */
- memcpy(cdev->buffer.bytes,
- cdev->tiles.data + cy * cdev->tiles.raster,
- cdev->tiles.raster * ny);
- /* Intersect the tile with the source data. */
- /* mcolor0 and mcolor1 invert the data if needed. */
- /* This call can't fail. */
- (*dev_proc(&cdev->mdev, copy_mono)) ((gx_device *) & cdev->mdev,
- sdata + (ty - y) * raster, sx + tx - x,
- raster, gx_no_bitmap_id,
- cx, 0, nx, ny, mcolor0, mcolor1);
- /* Now copy the color through the double mask. */
- code = (*dev_proc(tdev, copy_mono)) (cdev->target,
- cdev->buffer.bytes, cx, cdev->tiles.raster,
- gx_no_bitmap_id,
- tx, ty, nx, ny, gx_no_color_index, color);
- if (code < 0)
- return code;
- }
+ nx = mx1 - cx; /* also should be min */
+ /* Copy a tile slice to the memory device buffer. */
+ memcpy(cdev->buffer.bytes,
+ cdev->tiles.data + cy * cdev->tiles.raster,
+ cdev->tiles.raster * ny);
+ /* Intersect the tile with the source data. */
+ /* mcolor0 and mcolor1 invert the data if needed. */
+ /* This call can't fail. */
+ (*dev_proc(&cdev->mdev, copy_mono)) ((gx_device *) & cdev->mdev,
+ sdata + (ty - y) * raster, sx + tx - x,
+ raster, gx_no_bitmap_id,
+ cx, 0, nx, ny, mcolor0, mcolor1);
+ /* Now copy the color through the double mask. */
+ code = (*dev_proc(tdev, copy_mono)) (cdev->target,
+ cdev->buffer.bytes, cx, cdev->tiles.raster,
+ gx_no_bitmap_id,
+ tx, ty, nx, ny, gx_no_color_index, color);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
@@ -212,8 +212,8 @@ mask_clip_copy_mono(gx_device * dev,
*/
static int
clip_runs_enumerate(gx_device_mask_clip * cdev,
- int (*process) (clip_callback_data_t * pccd, int xc, int yc, int xec, int yec),
- clip_callback_data_t * pccd)
+ int (*process) (clip_callback_data_t * pccd, int xc, int yc, int xec, int yec),
+ clip_callback_data_t * pccd)
{
DECLARE_MASK_COPY;
int cy;
@@ -222,82 +222,82 @@ clip_runs_enumerate(gx_device_mask_clip * cdev,
int code;
FIT_MASK_COPY(pccd->data, pccd->sourcex, pccd->raster,
- pccd->x, pccd->y, pccd->w, pccd->h);
+ pccd->x, pccd->y, pccd->w, pccd->h);
tile_row = cdev->tiles.data + my0 * cdev->tiles.raster + (mx0 >> 3);
prev.p.x = 0; /* arbitrary */
prev.q.x = prev.p.x - 1; /* an impossible rectangle */
prev.p.y = prev.q.y = -1; /* arbitrary */
for (cy = my0; cy < my1; cy++) {
- int cx = mx0;
- const byte *tp = tile_row;
+ int cx = mx0;
+ const byte *tp = tile_row;
- if_debug1('B', "[B]clip runs y=%d:", cy - cdev->phase.y);
- while (cx < mx1) {
- int len;
- int tx1, tx, ty;
+ if_debug1('B', "[B]clip runs y=%d:", cy - cdev->phase.y);
+ while (cx < mx1) {
+ int len;
+ int tx1, tx, ty;
- /* Skip a run of 0s. */
- len = byte_bit_run_length[cx & 7][*tp ^ 0xff];
- if (len < 8) {
- cx += len;
- if (cx >= mx1)
- break;
- } else {
- cx += len - 8;
- tp++;
- while (cx < mx1 && *tp == 0)
- cx += 8, tp++;
- if (cx >= mx1)
- break;
- cx += byte_bit_run_length_0[*tp ^ 0xff];
- if (cx >= mx1)
- break;
- }
- tx1 = cx - cdev->phase.x;
- /* Scan a run of 1s. */
- len = byte_bit_run_length[cx & 7][*tp];
- if (len < 8) {
- cx += len;
- if (cx > mx1)
- cx = mx1;
- } else {
- cx += len - 8;
- tp++;
- while (cx < mx1 && *tp == 0xff)
- cx += 8, tp++;
- if (cx > mx1)
- cx = mx1;
- else {
- cx += byte_bit_run_length_0[*tp];
- if (cx > mx1)
- cx = mx1;
- }
- }
- tx = cx - cdev->phase.x;
- if_debug2('B', " %d-%d,", tx1, tx);
- ty = cy - cdev->phase.y;
- /* Detect vertical rectangles. */
- if (prev.p.x == tx1 && prev.q.x == tx && prev.q.y == ty)
- prev.q.y = ty + 1;
- else {
- if (prev.q.y > prev.p.y) {
- code = (*process)(pccd, prev.p.x, prev.p.y, prev.q.x, prev.q.y);
- if (code < 0)
- return code;
- }
- prev.p.x = tx1;
- prev.p.y = ty;
- prev.q.x = tx;
- prev.q.y = ty + 1;
- }
- }
- if_debug0('B', "\n");
- tile_row += cdev->tiles.raster;
+ /* Skip a run of 0s. */
+ len = byte_bit_run_length[cx & 7][*tp ^ 0xff];
+ if (len < 8) {
+ cx += len;
+ if (cx >= mx1)
+ break;
+ } else {
+ cx += len - 8;
+ tp++;
+ while (cx < mx1 && *tp == 0)
+ cx += 8, tp++;
+ if (cx >= mx1)
+ break;
+ cx += byte_bit_run_length_0[*tp ^ 0xff];
+ if (cx >= mx1)
+ break;
+ }
+ tx1 = cx - cdev->phase.x;
+ /* Scan a run of 1s. */
+ len = byte_bit_run_length[cx & 7][*tp];
+ if (len < 8) {
+ cx += len;
+ if (cx > mx1)
+ cx = mx1;
+ } else {
+ cx += len - 8;
+ tp++;
+ while (cx < mx1 && *tp == 0xff)
+ cx += 8, tp++;
+ if (cx > mx1)
+ cx = mx1;
+ else {
+ cx += byte_bit_run_length_0[*tp];
+ if (cx > mx1)
+ cx = mx1;
+ }
+ }
+ tx = cx - cdev->phase.x;
+ if_debug2('B', " %d-%d,", tx1, tx);
+ ty = cy - cdev->phase.y;
+ /* Detect vertical rectangles. */
+ if (prev.p.x == tx1 && prev.q.x == tx && prev.q.y == ty)
+ prev.q.y = ty + 1;
+ else {
+ if (prev.q.y > prev.p.y) {
+ code = (*process)(pccd, prev.p.x, prev.p.y, prev.q.x, prev.q.y);
+ if (code < 0)
+ return code;
+ }
+ prev.p.x = tx1;
+ prev.p.y = ty;
+ prev.q.x = tx;
+ prev.q.y = ty + 1;
+ }
+ }
+ if_debug0('B', "\n");
+ tile_row += cdev->tiles.raster;
}
if (prev.q.y > prev.p.y) {
- code = (*process)(pccd, prev.p.x, prev.p.y, prev.q.x, prev.q.y);
- if (code < 0)
- return code;
+ code = (*process)(pccd, prev.p.x, prev.p.y, prev.q.x, prev.q.y);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -305,8 +305,8 @@ clip_runs_enumerate(gx_device_mask_clip * cdev,
/* Copy a color rectangle */
static int
mask_clip_copy_color(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
clip_callback_data_t ccdata;
@@ -320,8 +320,8 @@ mask_clip_copy_color(gx_device * dev,
/* Copy a rectangle with alpha */
static int
mask_clip_copy_alpha(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index color, int depth)
+ const byte * data, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index color, int depth)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
clip_callback_data_t ccdata;
@@ -335,9 +335,9 @@ mask_clip_copy_alpha(gx_device * dev,
static int
mask_clip_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1,
- int phase_x, int phase_y)
+ int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1,
+ int phase_x, int phase_y)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
clip_callback_data_t ccdata;
@@ -352,11 +352,11 @@ mask_clip_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
static int
mask_clip_strip_copy_rop(gx_device * dev,
- const byte * data, int sourcex, uint raster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int w, int h,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * data, int sourcex, uint raster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int x, int y, int w, int h,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_mask_clip *cdev = (gx_device_mask_clip *) dev;
clip_callback_data_t ccdata;
@@ -365,7 +365,7 @@ mask_clip_strip_copy_rop(gx_device * dev,
ccdata.x = x, ccdata.y = y, ccdata.w = w, ccdata.h = h;
ccdata.data = data, ccdata.sourcex = sourcex, ccdata.raster = raster;
ccdata.scolors = scolors, ccdata.textures = textures,
- ccdata.tcolors = tcolors;
+ ccdata.tcolors = tcolors;
ccdata.phase.x = phase_x, ccdata.phase.y = phase_y, ccdata.lop = lop;
return clip_runs_enumerate(cdev, clip_call_strip_copy_rop, &ccdata);
}
diff --git a/gs/base/gxclipm.h b/gs/base/gxclipm.h
index acd99a832..b6727ba24 100644
--- a/gs/base/gxclipm.h
+++ b/gs/base/gxclipm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxclipsr.h b/gs/base/gxclipsr.h
index 745995daa..00ada3055 100644
--- a/gs/base/gxclipsr.h
+++ b/gs/base/gxclipsr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxclist.c b/gs/base/gxclist.c
index 712f5e2b7..03a7ce4d9 100644
--- a/gs/base/gxclist.c
+++ b/gs/base/gxclist.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@ extern dev_proc_open_device(pattern_clist_open_device);
/* Where is the GC information for the common objects that are
shared between the reader and writer. I see pointers in
there, but they don't seem to be GC. This is why I have
- put the icc_table and the link cache in the reader and the
+ put the icc_table and the link cache in the reader and the
writer rather than the common. fixme: Also, if icc_cache_cl is not
included in the writer, 64bit builds will seg fault */
@@ -114,7 +114,6 @@ private_st_clist_writer_cropping_buffer();
private_st_clist_icctable_entry();
private_st_clist_icctable();
-
/* Forward declarations of driver procedures */
dev_proc_open_device(clist_open);
static dev_proc_output_page(clist_output_page);
@@ -204,9 +203,9 @@ const gx_device_procs gs_clist_device_procs = {
const clist_io_procs_t *clist_io_procs_file_global = NULL;
const clist_io_procs_t *clist_io_procs_memory_global = NULL;
-void
+void
clist_init_io_procs(gx_device_clist *pclist_dev, bool in_memory)
-{
+{
if (in_memory || clist_io_procs_file_global == NULL)
pclist_dev->common.page_info.io_procs = clist_io_procs_memory_global;
else
@@ -386,16 +385,16 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
gx_device *pbdev = (gx_device *)&bdev;
int code;
- /* the clist writer has its own color info that depends upon the
+ /* the clist writer has its own color info that depends upon the
transparency group color space (if transparency exists). The data that is
- used in the clist writing. Here it is initialized with
+ used in the clist writing. Here it is initialized with
the target device color info. The values will be pushed and popped
in a stack if we have changing color spaces in the transparency groups. */
cdev->clist_color_info.depth = dev->color_info.depth;
cdev->clist_color_info.polarity = dev->color_info.polarity;
cdev->clist_color_info.num_components = dev->color_info.num_components;
-
+
/* Call create_buf_device to get the memory planarity set up. */
cdev->buf_procs.create_buf_device(&pbdev, target, 0, NULL, NULL, clist_get_band_complexity(0, 0));
/* HACK - if the buffer device can't do copy_alpha, disallow */
@@ -413,7 +412,7 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
if (gdev_mem_data_size(&bdev, band_width, band_height, &band_data_size) < 0 ||
band_data_size >= band_space) {
- if (pbdev->finalize)
+ if (pbdev->finalize)
pbdev->finalize(pbdev);
return_error(gs_error_rangecheck);
}
@@ -428,7 +427,7 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
band_height = gdev_mem_max_height(&bdev, band_width,
band_space - bits_size, page_uses_transparency);
if (band_height == 0) {
- if (pbdev->finalize)
+ if (pbdev->finalize)
pbdev->finalize(pbdev);
return_error(gs_error_rangecheck);
}
@@ -436,7 +435,7 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
cdev->ins_count = 0;
code = clist_init_tile_cache(dev, data, bits_size);
if (code < 0) {
- if (pbdev->finalize)
+ if (pbdev->finalize)
pbdev->finalize(pbdev);
return code;
}
@@ -445,12 +444,12 @@ clist_init_data(gx_device * dev, byte * init_data, uint data_size)
size -= bits_size;
code = clist_init_bands(dev, &bdev, size, band_width, band_height);
if (code < 0) {
- if (pbdev->finalize)
+ if (pbdev->finalize)
pbdev->finalize(pbdev);
return code;
}
- if (pbdev->finalize)
+ if (pbdev->finalize)
pbdev->finalize(pbdev);
return clist_init_states(dev, data, data_size - bits_size);
@@ -706,7 +705,7 @@ clist_close(gx_device *dev)
&((gx_device_clist *)dev)->writer;
if (cdev->do_not_open_or_close_bandfiles)
- return 0;
+ return 0;
if (cdev->procs.open_device == pattern_clist_open_device) {
gs_free_object(cdev->bandlist_memory, cdev->data, "clist_close");
cdev->data = NULL;
@@ -740,7 +739,7 @@ clist_finish_page(gx_device *dev, bool flush)
/* Also free the icc_table at this time and the icc_cache */
if (!CLIST_IS_WRITER((gx_device_clist *)dev)) {
/* Free the icc table associated with this device.
- The threads that may have pointed to this were destroyed in
+ The threads that may have pointed to this were destroyed in
the above call to clist_teardown_render_threads. Since they
all maintained a copy of the cache and the table there should not
be any issues. */
@@ -829,11 +828,11 @@ clist_end_page(gx_device_clist_writer * cldev)
return 0;
}
-/* Compute the set of used colors in the page_info structure.
+/* Compute the set of used colors in the page_info structure.
*
* NB: Area for improvement, move states[band] and page_info to clist
- * rather than writer device, or remove completely as this is used by the old planar devices
- * to operate on a plane at a time.
+ * rather than writer device, or remove completely as this is used by the old planar devices
+ * to operate on a plane at a time.
*/
void
@@ -904,7 +903,7 @@ clist_VMerror_recover_flush(gx_device_clist_writer *cldev,
/* If the device has the ability to render partial pages, flush
* out the bandlist, and reset the writing state. Then, get the
* device to render this band. When done, see if there's now enough
- * memory to satisfy the minimum low-memory guarantees. If not,
+ * memory to satisfy the minimum low-memory guarantees. If not,
* get the device to render some more. If there's nothing left to
* render & still insufficient memory, declare an error condition.
*/
@@ -926,7 +925,7 @@ clist_VMerror_recover_flush(gx_device_clist_writer *cldev,
cldev->permanent_error = reset_code;
cldev->error_is_retryable = 0;
}
-
+
code = (reset_code < 0 ? reset_code : free_code < 0 ? old_error_code : 0);
if_debug1('L', "[L]hard flush of command list, status: %d\n", code);
return code;
@@ -981,7 +980,7 @@ clist_get_band(gx_device * dev, int y, int *band_start)
/* copy constructor if from != NULL
* default constructor if from == NULL
*/
-void
+void
clist_copy_band_complexity(gx_band_complexity_t *this, const gx_band_complexity_t *from)
{
if (from) {
@@ -999,10 +998,9 @@ clist_copy_band_complexity(gx_band_complexity_t *this, const gx_band_complexity_
}
}
-
/* ICC table operations. See gxclist.h for details */
/* This checks the table for a hash code entry */
-bool
+bool
clist_icc_searchtable(gx_device_clist_writer *cdev, int64_t hashcode)
{
clist_icctable_t *icc_table = cdev->icc_table;
@@ -1021,7 +1019,7 @@ clist_icc_searchtable(gx_device_clist_writer *cdev, int64_t hashcode)
}
/* Free the table */
-int
+int
clist_icc_freetable(clist_icctable_t *icc_table, gs_memory_t *memory)
{
@@ -1042,7 +1040,6 @@ clist_icc_freetable(clist_icctable_t *icc_table, gs_memory_t *memory)
return(0);
}
-
/* This serializes the ICC table and writes it out for maxband+1 */
int
clist_icc_writetable(gx_device_clist_writer *cldev)
@@ -1090,7 +1087,7 @@ clist_icc_writetable(gx_device_clist_writer *cldev)
int64_t
clist_icc_addprofile(gx_device_clist_writer *cldev, cmm_profile_t *iccprofile, int *size)
{
-
+
clist_file_ptr cfile = cldev->page_cfile;
int64_t fileposit;
gsicc_serialized_profile_t profile_data;
@@ -1123,7 +1120,7 @@ clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode_in, cmm_profil
/* If the hash code is not valid then compute it now */
if (icc_profile->hash_is_valid == false) {
- gsicc_get_icc_buff_hash(icc_profile->buffer, &hashcode,
+ gsicc_get_icc_buff_hash(icc_profile->buffer, &hashcode,
icc_profile->buffer_size);
icc_profile->hashcode = hashcode;
icc_profile->hash_is_valid = true;
@@ -1131,10 +1128,10 @@ clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode_in, cmm_profil
hashcode = hashcode_in;
}
if ( icc_table == NULL ) {
- entry = (clist_icctable_entry_t *) gs_alloc_struct(cdev->memory,
+ entry = (clist_icctable_entry_t *) gs_alloc_struct(cdev->memory,
clist_icctable_entry_t,
&st_clist_icctable_entry, "clist_icc_addentry");
- if (entry == NULL)
+ if (entry == NULL)
return gs_rethrow(-1, "insufficient memory to allocate entry in icc table");
entry->next = NULL;
entry->serial_data.hashcode = hashcode;
@@ -1142,17 +1139,17 @@ clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode_in, cmm_profil
entry->serial_data.file_position = -1;
entry->icc_profile = icc_profile;
rc_increment(icc_profile);
- icc_table = gs_alloc_struct(cdev->memory,
+ icc_table = gs_alloc_struct(cdev->memory,
clist_icctable_t,
&st_clist_icctable, "clist_icc_addentry");
- if (icc_table == NULL)
+ if (icc_table == NULL)
return gs_rethrow(-1, "insufficient memory to allocate icc table");
icc_table->tablesize = 1;
icc_table->head = entry;
icc_table->final = entry;
- /* For now, we are just going to put the icc_table itself
+ /* For now, we are just going to put the icc_table itself
at band_range_max + 1. The ICC profiles are written
in the cfile at the current stored file position*/
cdev->icc_table = icc_table;
@@ -1167,10 +1164,10 @@ clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode_in, cmm_profil
}
/* Add a new ICC profile */
- entry = (clist_icctable_entry_t *) gs_alloc_struct(cdev->memory,
+ entry = (clist_icctable_entry_t *) gs_alloc_struct(cdev->memory,
clist_icctable_entry_t,
&st_clist_icctable_entry, "clist_icc_addentry");
- if (entry == NULL)
+ if (entry == NULL)
return gs_rethrow(-1, "insufficient memory to allocate entry in icc table");
entry->next = NULL;
entry->serial_data.hashcode = hashcode;
@@ -1185,10 +1182,10 @@ clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode_in, cmm_profil
return(0);
}
-int
+int
clist_writer_push_no_cropping(gx_device_clist_writer *cdev)
{
- clist_writer_cropping_buffer_t *buf = gs_alloc_struct(cdev->memory,
+ clist_writer_cropping_buffer_t *buf = gs_alloc_struct(cdev->memory,
clist_writer_cropping_buffer_t,
&st_clist_writer_cropping_buffer, "clist_writer_transparency_push");
@@ -1205,11 +1202,11 @@ clist_writer_push_no_cropping(gx_device_clist_writer *cdev)
return 0;
}
-int
+int
clist_writer_push_cropping(gx_device_clist_writer *cdev, int ry, int rheight)
{
int code = clist_writer_push_no_cropping(cdev);
-
+
if (code < 0)
return 0;
cdev->cropping_min = max(cdev->cropping_min, ry);
@@ -1217,7 +1214,7 @@ clist_writer_push_cropping(gx_device_clist_writer *cdev, int ry, int rheight)
return 0;
}
-int
+int
clist_writer_pop_cropping(gx_device_clist_writer *cdev)
{
clist_writer_cropping_buffer_t *buf = cdev->cropping_stack;
@@ -1235,7 +1232,7 @@ clist_writer_pop_cropping(gx_device_clist_writer *cdev)
return 0;
}
-int
+int
clist_writer_check_empty_cropping_stack(gx_device_clist_writer *cdev)
{
if (cdev->cropping_stack != NULL) {
@@ -1299,4 +1296,3 @@ clist_put_data(const gx_device_clist *cdev, int select, int offset, const byte *
when the buffer is not fully written, except with an error. */
return pinfo->io_procs->fwrite_chars(buf, length, pfile);
}
-
diff --git a/gs/base/gxclist.h b/gs/base/gxclist.h
index d84955812..41b822575 100644
--- a/gs/base/gxclist.h
+++ b/gs/base/gxclist.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -83,7 +83,7 @@ typedef struct gx_placed_page_s {
gx_saved_page *page;
gs_int_point offset;
} gx_placed_page;
-
+
/*
* Define a procedure to cause some bandlist memory to be freed up,
* probably by rendering current bandlist contents.
@@ -159,49 +159,47 @@ extern const gs_imager_state clist_imager_state_initial;
typedef struct gx_clist_state_s gx_clist_state;
#define gx_device_clist_common_members\
- gx_device_forward_common; /* (see gxdevice.h) */\
- /* Following must be set before writing or reading. */\
- /* See gx_device_clist_writer, below, for more that must be init'd */\
- /* gx_device *target; */ /* device for which commands */\
- /* are being buffered */\
- gx_device_buf_procs_t buf_procs;\
- gs_memory_t *bandlist_memory; /* allocator for in-memory bandlist files */\
- byte *data; /* buffer area */\
- uint data_size; /* size of buffer */\
- gx_band_params_t band_params; /* band buffering parameters */\
- bool do_not_open_or_close_bandfiles; /* if true, do not open/close bandfiles */\
- bool page_uses_transparency; /* if true then page uses PDF 1.4 transparency */\
- /* Following are used for both writing and reading. */\
- gx_bits_cache_chunk chunk; /* the only chunk of bits */\
- gx_bits_cache bits;\
- uint tile_hash_mask; /* size of tile hash table -1 */\
- uint tile_band_mask_size; /* size of band mask preceding */\
- /* each tile in the cache */\
- tile_hash *tile_table; /* table for tile cache: */\
- /* see tile_hash above */\
- /* (a hash table when writing) */\
- int ymin, ymax; /* current band, <0 when writing */\
- /* Following are set when writing, read when reading. */\
- gx_band_page_info_t page_info; /* page information */\
- int nbands; /* # of bands */\
+ gx_device_forward_common; /* (see gxdevice.h) */\
+ /* Following must be set before writing or reading. */\
+ /* See gx_device_clist_writer, below, for more that must be init'd */\
+ /* gx_device *target; */ /* device for which commands */\
+ /* are being buffered */\
+ gx_device_buf_procs_t buf_procs;\
+ gs_memory_t *bandlist_memory; /* allocator for in-memory bandlist files */\
+ byte *data; /* buffer area */\
+ uint data_size; /* size of buffer */\
+ gx_band_params_t band_params; /* band buffering parameters */\
+ bool do_not_open_or_close_bandfiles; /* if true, do not open/close bandfiles */\
+ bool page_uses_transparency; /* if true then page uses PDF 1.4 transparency */\
+ /* Following are used for both writing and reading. */\
+ gx_bits_cache_chunk chunk; /* the only chunk of bits */\
+ gx_bits_cache bits;\
+ uint tile_hash_mask; /* size of tile hash table -1 */\
+ uint tile_band_mask_size; /* size of band mask preceding */\
+ /* each tile in the cache */\
+ tile_hash *tile_table; /* table for tile cache: */\
+ /* see tile_hash above */\
+ /* (a hash table when writing) */\
+ int ymin, ymax; /* current band, <0 when writing */\
+ /* Following are set when writing, read when reading. */\
+ gx_band_page_info_t page_info; /* page information */\
+ int nbands; /* # of bands */\
int64_t trans_dev_icc_hash; /* A special hash code for des color */\
clist_icctable_t *icc_table; /* Table that keeps track of ICC profiles.\
- It relates the hashcode to the cfile\
+ It relates the hashcode to the cfile\
file location. */\
gsicc_link_cache_t *icc_cache_cl /* Link cache */\
-
/*
* Chech whether a clist is used for storing a pattern command stream.
* Useful for both reader and writer.
*/
#define IS_CLIST_FOR_PATTERN(cdev) (cdev->procs.open_device == pattern_clist_open_device)
-
/* Define a structure to hold where the ICC profiles are stored in the clist
- Profiles are added into psuedo bands of the clist, these are bands that exist beyond
+ Profiles are added into psuedo bands of the clist, these are bands that exist beyond
the edge of the normal band list. A profile will occupy its own band. The structure
- here is a table that relates the hash code of the ICC profile to the pseudoband.
+ here is a table that relates the hash code of the ICC profile to the pseudoband.
This table will be added at the end of the clist writing process. */
/* Used when writing out the table at the end of the clist writing.
@@ -210,7 +208,7 @@ typedef struct gx_clist_state_s gx_clist_state;
typedef struct clist_icc_serial_entry_s clist_icc_serial_entry_t;
struct clist_icc_serial_entry_s {
-
+
int64_t hashcode; /* A hash code for the icc profile */
int64_t file_position; /* File position in cfile of the profile with header */
int size;
@@ -222,15 +220,15 @@ typedef struct clist_icctable_entry_s clist_icctable_entry_t;
struct clist_icctable_entry_s {
clist_icc_serial_entry_t serial_data;
- clist_icctable_entry_t *next; /* The next entry in the table */
- cmm_profile_t *icc_profile; /* The profile. In non-gc memory. This is
+ clist_icctable_entry_t *next; /* The next entry in the table */
+ cmm_profile_t *icc_profile; /* The profile. In non-gc memory. This is
written out at the end of the writer phase */
};
#define private_st_clist_icctable_entry()\
gs_private_st_ptrs1(st_clist_icctable_entry,\
- clist_icctable_entry_t, "clist_icctable_entry",\
- clist_icctable_entry_enum_ptrs, clist_icctable_entry_reloc_ptrs, next)
+ clist_icctable_entry_t, "clist_icctable_entry",\
+ clist_icctable_entry_enum_ptrs, clist_icctable_entry_reloc_ptrs, next)
typedef struct clist_icctable_s clist_icctable_t;
@@ -242,9 +240,8 @@ struct clist_icctable_s {
#define private_st_clist_icctable()\
gs_private_st_ptrs2(st_clist_icctable,\
- clist_icctable_t, "clist_icctable",\
- clist_icctable_enum_ptrs, clist_icctable_reloc_ptrs, head, final)
-
+ clist_icctable_t, "clist_icctable",\
+ clist_icctable_enum_ptrs, clist_icctable_reloc_ptrs, head, final)
typedef struct gx_device_clist_common_s {
gx_device_clist_common_members;
@@ -260,7 +257,7 @@ typedef struct gx_device_clist_common_s {
/* (Strokes with longer patterns are converted to fills.) */
#define cmd_max_dash 11
-/* Define a clist cropping buffer,
+/* Define a clist cropping buffer,
which represents a cropping stack element while clist writing. */
typedef struct clist_writer_cropping_buffer_s clist_writer_cropping_buffer_t;
@@ -272,11 +269,8 @@ struct clist_writer_cropping_buffer_s {
#define private_st_clist_writer_cropping_buffer()\
gs_private_st_ptrs1(st_clist_writer_cropping_buffer,\
- clist_writer_cropping_buffer_t, "clist_writer_transparency_buffer",\
- clist_writer_cropping_buffer_enum_ptrs, clist_writer_cropping_buffer_reloc_ptrs, next)
-
-
-
+ clist_writer_cropping_buffer_t, "clist_writer_transparency_buffer",\
+ clist_writer_cropping_buffer_enum_ptrs, clist_writer_cropping_buffer_reloc_ptrs, next)
/* Define the state of a band list when writing. */
typedef struct clist_icc_color_s {
@@ -307,7 +301,7 @@ struct gx_device_clist_writer_s {
gx_strip_bitmap tile_params; /* current tile parameters */
int tile_depth; /* current tile depth */
int tile_known_min, tile_known_max; /* range of bands that knows the */
- /* current tile parameters */
+ /* current tile parameters */
/*
* NOTE: we must not set the line_params.dash.pattern member of the
* imager state to point to the dash_pattern member of the writer
@@ -317,23 +311,23 @@ struct gx_device_clist_writer_s {
gs_imager_state imager_state; /* current values of imager params */
float dash_pattern[cmd_max_dash]; /* current dash pattern */
const gx_clip_path *clip_path; /* current clip path, */
- /* only non-transient for images */
+ /* only non-transient for images */
gs_id clip_path_id; /* id of current clip path */
clist_color_space_t color_space; /* current color space, */
- /* only used for non-mask images */
+ /* only used for non-mask images */
gs_id transfer_ids[4]; /* ids of transfer maps */
gs_id black_generation_id; /* id of black generation map */
gs_id undercolor_removal_id; /* id of u.c.r. map */
gs_id device_halftone_id; /* id of device halftone */
gs_id image_enum_id; /* non-0 if we are inside an image */
- /* that we are passing through */
+ /* that we are passing through */
int error_is_retryable; /* Extra status used to distinguish hard VMerrors */
- /* from warnings upgraded to VMerrors. */
- /* T if err ret'd by cmd_put_op et al can be retried */
+ /* from warnings upgraded to VMerrors. */
+ /* T if err ret'd by cmd_put_op et al can be retried */
int permanent_error; /* if < 0, error only cleared by clist_reset() */
int driver_call_nesting; /* nesting level of non-retryable driver calls */
int ignore_lo_mem_warnings; /* ignore warnings from clist file/mem */
- /* Following must be set before writing */
+ /* Following must be set before writing */
proc_free_up_bandlist_memory((*free_up_bandlist_memory)); /* if nz, proc to free some bandlist memory */
int disable_mask; /* mask of routines to disable clist_disable_xxx */
gs_pattern1_instance_t *pinst; /* Used when it is a pattern clist. */
@@ -347,14 +341,14 @@ struct gx_device_clist_writer_s {
uint mask_id;
uint temp_mask_id; /* Mask id of a mask of an image with SMask. */
bool is_fillpage;
- gx_device_color_info clist_color_info; /* color information to be used during clist writing.
- It may be different than the target device if we
- are in a transparency group. Since the fill rect
- commands use the forward procs and we have no
+ gx_device_color_info clist_color_info; /* color information to be used during clist writing.
+ It may be different than the target device if we
+ are in a transparency group. Since the fill rect
+ commands use the forward procs and we have no
access to the graphic state information in those
routines, this is the logical place to put this
information */
- /* clist_icctable_t *icc_table; */ /* Table that keeps track of ICC profiles. It
+ /* clist_icctable_t *icc_table; */ /* Table that keeps track of ICC profiles. It
relates the hashcode to the cfile file location.
I did not put this into gx_device_clist_common_members
since I dont see where those pointers are ever defined
@@ -387,7 +381,7 @@ typedef struct clist_render_thread_control_s clist_render_thread_control_t;
typedef struct gx_device_clist_reader_s {
gx_device_clist_common_members; /* (must be first) */
gx_render_plane_t yplane; /* current plane, index = -1 */
- /* means all planes */
+ /* means all planes */
const gx_placed_page *pages;
int num_pages;
gx_band_complexity_t *band_complexity_array; /* num_bands elements */
@@ -424,17 +418,17 @@ extern_st(st_device_clist);
/* setup before opening clist device */
#define clist_init_params(xclist, xdata, xdata_size, xtarget, xbuf_procs, xband_params, xexternal, xmemory, xfree_bandlist, xdisable, pageusestransparency)\
BEGIN\
- (xclist)->common.data = (xdata);\
- (xclist)->common.data_size = (xdata_size);\
- (xclist)->common.target = (xtarget);\
- (xclist)->common.buf_procs = (xbuf_procs);\
- (xclist)->common.band_params = (xband_params);\
- (xclist)->common.do_not_open_or_close_bandfiles = (xexternal);\
- (xclist)->common.bandlist_memory = (xmemory);\
- (xclist)->writer.free_up_bandlist_memory = (xfree_bandlist);\
- (xclist)->writer.disable_mask = (xdisable);\
- (xclist)->writer.page_uses_transparency = (pageusestransparency);\
- (xclist)->writer.pinst = NULL;\
+ (xclist)->common.data = (xdata);\
+ (xclist)->common.data_size = (xdata_size);\
+ (xclist)->common.target = (xtarget);\
+ (xclist)->common.buf_procs = (xbuf_procs);\
+ (xclist)->common.band_params = (xband_params);\
+ (xclist)->common.do_not_open_or_close_bandfiles = (xexternal);\
+ (xclist)->common.bandlist_memory = (xmemory);\
+ (xclist)->writer.free_up_bandlist_memory = (xfree_bandlist);\
+ (xclist)->writer.disable_mask = (xdisable);\
+ (xclist)->writer.page_uses_transparency = (pageusestransparency);\
+ (xclist)->writer.pinst = NULL;\
END
/* Determine whether this clist device is able to recover VMerrors */
@@ -478,7 +472,7 @@ int clist_setup_params(gx_device *dev);
/*
* Render a rectangle to a client-supplied image. This implements
* gdev_prn_render_rectangle for devices that are using banding.
- *
+ *
* Note that clist_render_rectangle only guarantees to render *at least* the
* requested rectangle to bdev, offset by (-prect->p.x, -prect->p.y):
* anything it does to avoid rendering regions outside the rectangle is
@@ -487,11 +481,11 @@ int clist_setup_params(gx_device *dev);
* must set up a clipping device.
*/
int clist_render_rectangle(gx_device_clist *cdev,
- const gs_int_rect *prect, gx_device *bdev,
- const gx_render_plane_t *render_plane,
- bool clear);
+ const gs_int_rect *prect, gx_device *bdev,
+ const gx_render_plane_t *render_plane,
+ bool clear);
-/* A null pointer is used to denote not banding.
+/* A null pointer is used to denote not banding.
* Since false == NULL the old usage of for_banding = false works even if it's hackish.
*
* returns the complexity for a band given the y offset from top of page.
@@ -505,7 +499,7 @@ void gx_clist_reader_free_band_complexity_array(gx_device_clist *cldev);
/* deep copy constructor if from != NULL
* default constructor if from == NULL
*/
-void
+void
clist_copy_band_complexity(gx_band_complexity_t *this, const gx_band_complexity_t *from);
/* Retrieve total size for cfile and bfile. */
@@ -527,7 +521,7 @@ int64_t clist_icc_addprofile(gx_device_clist_writer *cdev, cmm_profile_t *iccpro
bool clist_icc_searchtable(gx_device_clist_writer *cdev, int64_t hashcode);
/* Add another entry into the icc profile table */
-int clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode,
+int clist_icc_addentry(gx_device_clist_writer *cdev, int64_t hashcode,
cmm_profile_t *icc_profile);
/* Free the table and its entries */
@@ -545,17 +539,17 @@ int clist_read_chunk(gx_device_clist_reader *crdev, int64_t position, int size,
/* Initialize for reading. */
int clist_render_init(gx_device_clist *dev);
-int
+int
clist_close_writer_and_init_reader(gx_device_clist *cldev);
void
clist_select_render_plane(gx_device *dev, int y, int height,
- gx_render_plane_t *render_plane, int index);
+ gx_render_plane_t *render_plane, int index);
int clist_rasterize_lines(gx_device *dev, int y, int lineCount,
- gx_device *bdev,
- const gx_render_plane_t *render_plane,
- int *pmy);
+ gx_device *bdev,
+ const gx_render_plane_t *render_plane,
+ int *pmy);
/* Enable multi threaded rendering. Returns > 0 if supported, < 0 if single threaded */
int
@@ -565,7 +559,7 @@ clist_enable_multi_thread_render(gx_device *dev);
void
clist_teardown_render_threads(gx_device *dev);
-#ifdef DEBUG
+#ifdef DEBUG
#define clist_debug_rect clist_debug_rect_imp
void clist_debug_rect_imp(int x, int y, int width, int height);
#define clist_debug_image_rect clist_debug_image_rect_imp
@@ -591,40 +585,40 @@ void clist_debug_set_ctm_imp(const gs_matrix *m);
*/
#define crop_fill_y(cdev, ry, rheight)\
BEGIN\
- if (ry < cdev->cropping_min) {\
- rheight = ry + rheight - cdev->cropping_min;\
- ry = cdev->cropping_min;\
- }\
- if (ry + rheight > cdev->cropping_max)\
- rheight = cdev->cropping_max - ry;\
+ if (ry < cdev->cropping_min) {\
+ rheight = ry + rheight - cdev->cropping_min;\
+ ry = cdev->cropping_min;\
+ }\
+ if (ry + rheight > cdev->cropping_max)\
+ rheight = cdev->cropping_max - ry;\
END
#define crop_fill(dev, x, y, w, h)\
BEGIN\
- if ( x < 0 )\
- w += x, x = 0;\
- fit_fill_w(dev, x, w);\
- crop_fill_y(dev, y, h);\
+ if ( x < 0 )\
+ w += x, x = 0;\
+ fit_fill_w(dev, x, w);\
+ crop_fill_y(dev, y, h);\
END
#define crop_copy_y(cdev, data, data_x, raster, id, ry, rheight)\
BEGIN\
- if (ry < cdev->cropping_min) {\
- rheight = ry + rheight - cdev->cropping_min;\
- data += (cdev->cropping_min - ry) * raster;\
- id = gx_no_bitmap_id;\
- ry = cdev->cropping_min;\
- }\
- if (ry + rheight > cdev->cropping_max)\
- rheight = cdev->cropping_max - ry;\
+ if (ry < cdev->cropping_min) {\
+ rheight = ry + rheight - cdev->cropping_min;\
+ data += (cdev->cropping_min - ry) * raster;\
+ id = gx_no_bitmap_id;\
+ ry = cdev->cropping_min;\
+ }\
+ if (ry + rheight > cdev->cropping_max)\
+ rheight = cdev->cropping_max - ry;\
END
#define crop_copy(dev, data, data_x, raster, id, x, y, w, h)\
BEGIN\
- if ( x < 0 )\
- w += x, data_x -= x, x = 0;\
- fit_fill_w(dev, x, w);\
- crop_copy_y(dev, data, data_x, raster, id, y, h);\
+ if ( x < 0 )\
+ w += x, data_x -= x, x = 0;\
+ fit_fill_w(dev, x, w);\
+ crop_copy_y(dev, data, data_x, raster, id, y, h);\
END
#endif /* gxclist_INCLUDED */
diff --git a/gs/base/gxcllzw.c b/gs/base/gxcllzw.c
index e0e49e1f1..3fffd0cf9 100644
--- a/gs/base/gxcllzw.c
+++ b/gs/base/gxcllzw.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxclmem.c b/gs/base/gxclmem.c
index edea021e3..a091e7841 100644
--- a/gs/base/gxclmem.c
+++ b/gs/base/gxclmem.c
@@ -147,7 +147,7 @@ static const int64_t COMPRESSION_THRESHOLD =
/* FOR NOW ALLOCATE 1 raw buffer for every 32 blocks (at least 8, no more than 64) */
#define GET_NUM_RAW_BUFFERS( f ) \
- min(64, max(f->log_length/MEMFILE_DATA_SIZE/32, 8))
+ min(64, max(f->log_length/MEMFILE_DATA_SIZE/32, 8))
#define MALLOC(f, siz, cname)\
(void *)gs_alloc_bytes((f)->data_memory, siz, cname)
@@ -158,7 +158,7 @@ static const int64_t COMPRESSION_THRESHOLD =
/* Structure descriptor for GC */
private_st_MEMFILE();
- /* forward references */
+ /* forward references */
static void memfile_free_mem(MEMFILE * f);
static int memfile_init_empty(MEMFILE * f);
static int memfile_set_memory_warning(clist_file_ptr cf, int bytes_left);
@@ -190,40 +190,40 @@ const byte *decomp_rd_ptr1, *decomp_rd_limit1;
/* ----------------------------- Memory Allocation --------------------- */
static void * /* allocated memory's address, 0 if failure */
allocateWithReserve(
- MEMFILE *f, /* file to allocate mem to */
- int sizeofBlock, /* size of block to allocate */
- int *return_code, /* RET 0 ok, -ve GS-style error, or +1 if OK but low memory */
- const char *allocName, /* name to allocate by */
- const char *errorMessage /* error message to print */
+ MEMFILE *f, /* file to allocate mem to */
+ int sizeofBlock, /* size of block to allocate */
+ int *return_code, /* RET 0 ok, -ve GS-style error, or +1 if OK but low memory */
+ const char *allocName, /* name to allocate by */
+ const char *errorMessage /* error message to print */
)
{
int code = 0; /* assume success */
void *block = MALLOC(f, sizeofBlock, allocName);
if (block == NULL) {
- /* Try to recover block from reserve */
- if (sizeofBlock == sizeof(LOG_MEMFILE_BLK)) {
- if (f->reserveLogBlockCount > 0) {
- block = f->reserveLogBlockChain;
- f->reserveLogBlockChain = f->reserveLogBlockChain->link;
- --f->reserveLogBlockCount;
- }
- } else if (sizeofBlock == sizeof(PHYS_MEMFILE_BLK) ||
- sizeofBlock == sizeof(RAW_BUFFER)
- ) {
- if (f->reservePhysBlockCount > 0) {
- block = f->reservePhysBlockChain;
- f->reservePhysBlockChain = f->reservePhysBlockChain->link;
- --f->reservePhysBlockCount;
- }
- }
- if (block != NULL)
- code = 1; /* successful, but allocated from reserve */
+ /* Try to recover block from reserve */
+ if (sizeofBlock == sizeof(LOG_MEMFILE_BLK)) {
+ if (f->reserveLogBlockCount > 0) {
+ block = f->reserveLogBlockChain;
+ f->reserveLogBlockChain = f->reserveLogBlockChain->link;
+ --f->reserveLogBlockCount;
+ }
+ } else if (sizeofBlock == sizeof(PHYS_MEMFILE_BLK) ||
+ sizeofBlock == sizeof(RAW_BUFFER)
+ ) {
+ if (f->reservePhysBlockCount > 0) {
+ block = f->reservePhysBlockChain;
+ f->reservePhysBlockChain = f->reservePhysBlockChain->link;
+ --f->reservePhysBlockCount;
+ }
+ }
+ if (block != NULL)
+ code = 1; /* successful, but allocated from reserve */
}
if (block != NULL)
- f->total_space += sizeofBlock;
+ f->total_space += sizeofBlock;
else
- code = gs_note_error(gs_error_VMerror);
+ code = gs_note_error(gs_error_VMerror);
*return_code = code;
return block;
}
@@ -232,8 +232,8 @@ allocateWithReserve(
static int
memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
- clist_file_ptr /*MEMFILE * */ * pf,
- gs_memory_t *mem, gs_memory_t *data_mem, bool ok_to_compress)
+ clist_file_ptr /*MEMFILE * */ * pf,
+ gs_memory_t *mem, gs_memory_t *data_mem, bool ok_to_compress)
{
MEMFILE *f = NULL;
int code = 0;
@@ -243,103 +243,103 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
/* fname[0] == 0 if this is not reopening */
/* memfile file names begin with a flag byte == 0xff */
if (fname[0] == '\377' && (fmode[0] == 'r' || fmode[0] == 'a')) {
- MEMFILE *base_f = NULL;
-
- /* reopening an existing file. */
- code = sscanf(fname+1, "%p", &base_f);
- if (code != 1) {
- code = gs_note_error(gs_error_ioerror);
- goto finish;
- }
- /* Reopen an existing file for 'read' */
- if (base_f->is_open == false) {
- /* File is not is use, just re-use it. */
- f = base_f;
- code = 0;
- goto finish;
- } else {
- /* We need to 'clone' this memfile so that each reader instance */
- /* will be able to maintain it's own 'state' */
- f = gs_alloc_struct(mem, MEMFILE, &st_MEMFILE,
- "memfile_fopen_instance(MEMFILE)");
- if (f == NULL) {
- emprintf1(mem,
- "memfile_open_scratch(%s): gs_alloc_struct failed\n",
- fname);
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
- memcpy(f, base_f, sizeof(MEMFILE));
- f->memory = mem;
- f->data_memory = data_mem;
- f->compress_state = 0; /* Not used by reader instance */
- f->decompress_state = 0; /* make clean for GC, or alloc'n failure */
- f->reservePhysBlockChain = NULL;
- f->reservePhysBlockCount = 0;
- f->reserveLogBlockChain = NULL;
- f->reserveLogBlockCount = 0;
- f->openlist = base_f->openlist;
- base_f->openlist = f; /* link this one in to the base memfile */
- f->base_memfile = base_f;
- f->log_curr_pos = 0;
- f->raw_head = NULL;
- f->error_code = 0;
-
- if (f->log_head->phys_blk->data_limit != NULL) {
- /* The file is compressed, so we need to copy the logical block */
- /* list so that it is unique to this instance, and initialize */
- /* the decompressor. */
- LOG_MEMFILE_BLK *log_block, *new_log_block;
- int i;
- int num_log_blocks = (f->log_length + MEMFILE_DATA_SIZE - 1) / MEMFILE_DATA_SIZE;
- const stream_template *decompress_template = clist_decompressor_template();
-
- new_log_block = MALLOC(f, num_log_blocks * sizeof(LOG_MEMFILE_BLK), "memfile_fopen" );
- if (new_log_block == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
-
- /* copy the logical blocks to the new list just allocated */
- for (log_block=f->log_head, i=0; log_block != NULL; log_block=log_block->link, i++) {
- new_log_block[i].phys_blk = log_block->phys_blk;
- new_log_block[i].phys_pdata = log_block->phys_pdata;
- new_log_block[i].raw_block = NULL;
- new_log_block[i].link = log_block->link == NULL ? NULL : new_log_block + i + 1;
- }
- f->log_head = new_log_block;
-
- /* NB: don't need compress_state for reading */
- f->decompress_state =
- gs_alloc_struct(mem, stream_state, decompress_template->stype,
- "memfile_open_scratch(decompress_state)");
- if (f->decompress_state == 0) {
- emprintf1(mem,
- "memfile_open_scratch(%s): gs_alloc_struct failed\n",
- fname);
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
- clist_decompressor_init(f->decompress_state);
- f->decompress_state->memory = mem;
- if (decompress_template->set_defaults)
- (*decompress_template->set_defaults) (f->decompress_state);
- }
- f->log_curr_blk = f->log_head;
- memfile_get_pdata(f); /* set up the initial block */
-
- goto finish;
- }
+ MEMFILE *base_f = NULL;
+
+ /* reopening an existing file. */
+ code = sscanf(fname+1, "%p", &base_f);
+ if (code != 1) {
+ code = gs_note_error(gs_error_ioerror);
+ goto finish;
+ }
+ /* Reopen an existing file for 'read' */
+ if (base_f->is_open == false) {
+ /* File is not is use, just re-use it. */
+ f = base_f;
+ code = 0;
+ goto finish;
+ } else {
+ /* We need to 'clone' this memfile so that each reader instance */
+ /* will be able to maintain it's own 'state' */
+ f = gs_alloc_struct(mem, MEMFILE, &st_MEMFILE,
+ "memfile_fopen_instance(MEMFILE)");
+ if (f == NULL) {
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+ memcpy(f, base_f, sizeof(MEMFILE));
+ f->memory = mem;
+ f->data_memory = data_mem;
+ f->compress_state = 0; /* Not used by reader instance */
+ f->decompress_state = 0; /* make clean for GC, or alloc'n failure */
+ f->reservePhysBlockChain = NULL;
+ f->reservePhysBlockCount = 0;
+ f->reserveLogBlockChain = NULL;
+ f->reserveLogBlockCount = 0;
+ f->openlist = base_f->openlist;
+ base_f->openlist = f; /* link this one in to the base memfile */
+ f->base_memfile = base_f;
+ f->log_curr_pos = 0;
+ f->raw_head = NULL;
+ f->error_code = 0;
+
+ if (f->log_head->phys_blk->data_limit != NULL) {
+ /* The file is compressed, so we need to copy the logical block */
+ /* list so that it is unique to this instance, and initialize */
+ /* the decompressor. */
+ LOG_MEMFILE_BLK *log_block, *new_log_block;
+ int i;
+ int num_log_blocks = (f->log_length + MEMFILE_DATA_SIZE - 1) / MEMFILE_DATA_SIZE;
+ const stream_template *decompress_template = clist_decompressor_template();
+
+ new_log_block = MALLOC(f, num_log_blocks * sizeof(LOG_MEMFILE_BLK), "memfile_fopen" );
+ if (new_log_block == NULL) {
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+
+ /* copy the logical blocks to the new list just allocated */
+ for (log_block=f->log_head, i=0; log_block != NULL; log_block=log_block->link, i++) {
+ new_log_block[i].phys_blk = log_block->phys_blk;
+ new_log_block[i].phys_pdata = log_block->phys_pdata;
+ new_log_block[i].raw_block = NULL;
+ new_log_block[i].link = log_block->link == NULL ? NULL : new_log_block + i + 1;
+ }
+ f->log_head = new_log_block;
+
+ /* NB: don't need compress_state for reading */
+ f->decompress_state =
+ gs_alloc_struct(mem, stream_state, decompress_template->stype,
+ "memfile_open_scratch(decompress_state)");
+ if (f->decompress_state == 0) {
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+ clist_decompressor_init(f->decompress_state);
+ f->decompress_state->memory = mem;
+ if (decompress_template->set_defaults)
+ (*decompress_template->set_defaults) (f->decompress_state);
+ }
+ f->log_curr_blk = f->log_head;
+ memfile_get_pdata(f); /* set up the initial block */
+
+ goto finish;
+ }
}
fname[0] = 0; /* no file name yet */
f = gs_alloc_struct(mem, MEMFILE, &st_MEMFILE,
- "memfile_open_scratch(MEMFILE)");
+ "memfile_open_scratch(MEMFILE)");
if (f == NULL) {
- emprintf1(mem,
- "memfile_open_scratch(%s): gs_alloc_struct failed\n",
- fname);
- code = gs_note_error(gs_error_VMerror);
- goto finish;
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
}
f->memory = mem;
f->data_memory = data_mem;
@@ -355,9 +355,9 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
f->reserveLogBlockCount = 0;
/* init an empty file */
if ((code = memfile_init_empty(f)) < 0)
- goto finish;
+ goto finish;
if ((code = memfile_set_memory_warning(f, 0)) < 0)
- goto finish;
+ goto finish;
/*
* Disregard the ok_to_compress flag, since the size threshold gives us
* a much better criterion for deciding when compression is appropriate.
@@ -366,30 +366,30 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
f->compress_state = 0; /* make clean for GC */
f->decompress_state = 0;
if (f->ok_to_compress) {
- const stream_template *compress_template = clist_compressor_template();
- const stream_template *decompress_template = clist_decompressor_template();
-
- f->compress_state =
- gs_alloc_struct(mem, stream_state, compress_template->stype,
- "memfile_open_scratch(compress_state)");
- f->decompress_state =
- gs_alloc_struct(mem, stream_state, decompress_template->stype,
- "memfile_open_scratch(decompress_state)");
- if (f->compress_state == 0 || f->decompress_state == 0) {
- emprintf1(mem,
- "memfile_open_scratch(%s): gs_alloc_struct failed\n",
- fname);
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
- clist_compressor_init(f->compress_state);
- clist_decompressor_init(f->decompress_state);
- f->compress_state->memory = mem;
- f->decompress_state->memory = mem;
- if (compress_template->set_defaults)
- (*compress_template->set_defaults) (f->compress_state);
- if (decompress_template->set_defaults)
- (*decompress_template->set_defaults) (f->decompress_state);
+ const stream_template *compress_template = clist_compressor_template();
+ const stream_template *decompress_template = clist_decompressor_template();
+
+ f->compress_state =
+ gs_alloc_struct(mem, stream_state, compress_template->stype,
+ "memfile_open_scratch(compress_state)");
+ f->decompress_state =
+ gs_alloc_struct(mem, stream_state, decompress_template->stype,
+ "memfile_open_scratch(decompress_state)");
+ if (f->compress_state == 0 || f->decompress_state == 0) {
+ emprintf1(mem,
+ "memfile_open_scratch(%s): gs_alloc_struct failed\n",
+ fname);
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+ clist_compressor_init(f->compress_state);
+ clist_decompressor_init(f->decompress_state);
+ f->compress_state->memory = mem;
+ f->decompress_state->memory = mem;
+ if (compress_template->set_defaults)
+ (*compress_template->set_defaults) (f->compress_state);
+ if (decompress_template->set_defaults)
+ (*decompress_template->set_defaults) (f->decompress_state);
}
f->total_space = 0;
@@ -398,25 +398,25 @@ memfile_fopen(char fname[gp_file_name_sizeof], const char *fmode,
sprintf(fname+1, "%p", f);
#ifdef DEBUG
- tot_compressed = 0;
- tot_raw = 0;
- tot_cache_miss = 0;
- tot_cache_hits = 0;
- tot_swap_out = 0;
+ tot_compressed = 0;
+ tot_raw = 0;
+ tot_cache_miss = 0;
+ tot_cache_hits = 0;
+ tot_swap_out = 0;
#endif
finish:
/* 'f' shouldn't be NULL unless code < 0, but be careful */
if (code < 0 || f == NULL) {
- /* return failure, clean up memory before leaving */
- if (f != NULL)
- memfile_fclose((clist_file_ptr)f, fname, true);
- if (code >= 0)
- code = gs_error_ioerror;
+ /* return failure, clean up memory before leaving */
+ if (f != NULL)
+ memfile_fclose((clist_file_ptr)f, fname, true);
+ if (code >= 0)
+ code = gs_error_ioerror;
} else {
- /* return success */
- f->is_open = true;
- *pf = f;
+ /* return success */
+ f->is_open = true;
+ *pf = f;
}
return code;
}
@@ -428,95 +428,95 @@ memfile_fclose(clist_file_ptr cf, const char *fname, bool delete)
f->is_open = false;
if (!delete) {
- if (f->base_memfile) {
- MEMFILE *prev_f;
-
- /* Here we need to delete this instance from the 'openlist' */
- /* in case this file was opened for 'read' on a previously */
- /* written file (base_memfile != NULL) */
- for (prev_f = f->base_memfile; prev_f != NULL; prev_f = prev_f->openlist)
- if (prev_f->openlist == f)
- break;
- if (prev_f == NULL) {
- emprintf1(f->memory,
- "Could not find %p on memfile openlist\n",
- f);
- return_error(gs_error_invalidfileaccess);
- }
- prev_f->openlist = f->openlist; /* link around the one being fclosed */
- /* Now delete this MEMFILE reader instance */
- /* NB: we don't delete 'base' instances until we delete */
- /* If the file is compressed, free the logical blocks, but not */
- /* the phys_blk info (that is still used by the base memfile */
- if (f->log_head->phys_blk->data_limit != NULL) {
- LOG_MEMFILE_BLK *tmpbp, *bp = f->log_head;
-
- while (bp != NULL) {
- tmpbp = bp->link;
- FREE(f, bp, "memfile_free_mem(log_blk)");
- bp = tmpbp;
- }
- f->log_head = NULL;
-
- /* Free any internal compressor state. */
- if (f->compressor_initialized) {
- if (f->decompress_state->template->release != 0)
- (*f->decompress_state->template->release) (f->decompress_state);
- if (f->compress_state->template->release != 0)
- (*f->compress_state->template->release) (f->compress_state);
- f->compressor_initialized = false;
- }
- /* free the raw buffers */
- while (f->raw_head != NULL) {
- RAW_BUFFER *tmpraw = f->raw_head->fwd;
-
- FREE(f, f->raw_head, "memfile_free_mem(raw)");
- f->raw_head = tmpraw;
- }
- }
- /* deallocate the memfile object proper */
- gs_free_object(f->memory, f, "memfile_close_and_unlink(MEMFILE)");
- }
- return 0;
+ if (f->base_memfile) {
+ MEMFILE *prev_f;
+
+ /* Here we need to delete this instance from the 'openlist' */
+ /* in case this file was opened for 'read' on a previously */
+ /* written file (base_memfile != NULL) */
+ for (prev_f = f->base_memfile; prev_f != NULL; prev_f = prev_f->openlist)
+ if (prev_f->openlist == f)
+ break;
+ if (prev_f == NULL) {
+ emprintf1(f->memory,
+ "Could not find %p on memfile openlist\n",
+ f);
+ return_error(gs_error_invalidfileaccess);
+ }
+ prev_f->openlist = f->openlist; /* link around the one being fclosed */
+ /* Now delete this MEMFILE reader instance */
+ /* NB: we don't delete 'base' instances until we delete */
+ /* If the file is compressed, free the logical blocks, but not */
+ /* the phys_blk info (that is still used by the base memfile */
+ if (f->log_head->phys_blk->data_limit != NULL) {
+ LOG_MEMFILE_BLK *tmpbp, *bp = f->log_head;
+
+ while (bp != NULL) {
+ tmpbp = bp->link;
+ FREE(f, bp, "memfile_free_mem(log_blk)");
+ bp = tmpbp;
+ }
+ f->log_head = NULL;
+
+ /* Free any internal compressor state. */
+ if (f->compressor_initialized) {
+ if (f->decompress_state->template->release != 0)
+ (*f->decompress_state->template->release) (f->decompress_state);
+ if (f->compress_state->template->release != 0)
+ (*f->compress_state->template->release) (f->compress_state);
+ f->compressor_initialized = false;
+ }
+ /* free the raw buffers */
+ while (f->raw_head != NULL) {
+ RAW_BUFFER *tmpraw = f->raw_head->fwd;
+
+ FREE(f, f->raw_head, "memfile_free_mem(raw)");
+ f->raw_head = tmpraw;
+ }
+ }
+ /* deallocate the memfile object proper */
+ gs_free_object(f->memory, f, "memfile_close_and_unlink(MEMFILE)");
+ }
+ return 0;
}
/* TODO: If there are open read memfile structures, set them so that */
/* future accesses will use the current contents. This may result in */
/* leaks if other users of the memfile don't 'fclose with delete=true */
if (f->openlist != NULL || ((f->base_memfile != NULL) && f->base_memfile->is_open)) {
- /* TODO: do the cleanup rather than just giving an error */
- emprintf1(f->memory,
- "Attempt to delete a memfile still open for read: %p\n",
- f);
- return_error(gs_error_invalidfileaccess);
+ /* TODO: do the cleanup rather than just giving an error */
+ emprintf1(f->memory,
+ "Attempt to delete a memfile still open for read: %p\n",
+ f);
+ return_error(gs_error_invalidfileaccess);
} else {
- /* Free the memory used by this memfile */
- memfile_free_mem(f);
-
- /* Free reserve blocks; don't do it in memfile_free_mem because */
- /* that routine gets called to reinit file */
- while (f->reserveLogBlockChain != NULL) {
- LOG_MEMFILE_BLK *block = f->reserveLogBlockChain;
-
- f->reserveLogBlockChain = block->link;
- FREE(f, block, "memfile_set_block_size");
- }
- while (f->reservePhysBlockChain != NULL) {
- PHYS_MEMFILE_BLK *block = f->reservePhysBlockChain;
-
- f->reservePhysBlockChain = block->link;
- FREE(f, block, "memfile_set_block_size");
- }
-
- /* deallocate de/compress state */
- gs_free_object(f->memory, f->decompress_state,
- "memfile_close_and_unlink(decompress_state)");
- gs_free_object(f->memory, f->compress_state,
- "memfile_close_and_unlink(compress_state)");
-
- /* deallocate the memfile object proper */
- gs_free_object(f->memory, f, "memfile_close_and_unlink(MEMFILE)");
- return 0;
+ /* Free the memory used by this memfile */
+ memfile_free_mem(f);
+
+ /* Free reserve blocks; don't do it in memfile_free_mem because */
+ /* that routine gets called to reinit file */
+ while (f->reserveLogBlockChain != NULL) {
+ LOG_MEMFILE_BLK *block = f->reserveLogBlockChain;
+
+ f->reserveLogBlockChain = block->link;
+ FREE(f, block, "memfile_set_block_size");
+ }
+ while (f->reservePhysBlockChain != NULL) {
+ PHYS_MEMFILE_BLK *block = f->reservePhysBlockChain;
+
+ f->reservePhysBlockChain = block->link;
+ FREE(f, block, "memfile_set_block_size");
+ }
+
+ /* deallocate de/compress state */
+ gs_free_object(f->memory, f->decompress_state,
+ "memfile_close_and_unlink(decompress_state)");
+ gs_free_object(f->memory, f->compress_state,
+ "memfile_close_and_unlink(compress_state)");
+
+ /* deallocate the memfile object proper */
+ gs_free_object(f->memory, f, "memfile_close_and_unlink(MEMFILE)");
+ return 0;
}
}
@@ -528,9 +528,9 @@ memfile_unlink(const char *fname)
/* memfile file names begin with a flag byte == 0xff */
if (fname[0] == '\377' && (code = sscanf(fname+1, "0x%x", &f) == 1)) {
- return memfile_fclose((clist_file_ptr)f, fname, true);
+ return memfile_fclose((clist_file_ptr)f, fname, true);
} else
- return_error(gs_error_invalidfileaccess);
+ return_error(gs_error_invalidfileaccess);
}
/* ---------------- Writing ---------------- */
@@ -547,54 +547,54 @@ memfile_set_memory_warning(clist_file_ptr cf, int bytes_left)
* + 1 phys blk for compress_log_blk + 1 phys blk for decompress.
*/
int logNeeded =
- (bytes_left + MEMFILE_DATA_SIZE - 1) / MEMFILE_DATA_SIZE;
+ (bytes_left + MEMFILE_DATA_SIZE - 1) / MEMFILE_DATA_SIZE;
int physNeeded = logNeeded;
if (bytes_left > 0)
- ++physNeeded;
+ ++physNeeded;
if (f->raw_head == NULL)
- ++physNeeded; /* have yet to allocate read buffers */
+ ++physNeeded; /* have yet to allocate read buffers */
/* Allocate or free memory depending on need */
while (logNeeded > f->reserveLogBlockCount) {
- LOG_MEMFILE_BLK *block =
- MALLOC( f, sizeof(LOG_MEMFILE_BLK), "memfile_set_block_size" );
-
- if (block == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
- block->link = f->reserveLogBlockChain;
- f->reserveLogBlockChain = block;
- ++f->reserveLogBlockCount;
+ LOG_MEMFILE_BLK *block =
+ MALLOC( f, sizeof(LOG_MEMFILE_BLK), "memfile_set_block_size" );
+
+ if (block == NULL) {
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+ block->link = f->reserveLogBlockChain;
+ f->reserveLogBlockChain = block;
+ ++f->reserveLogBlockCount;
}
while (logNeeded < f->reserveLogBlockCount) {
- LOG_MEMFILE_BLK *block = f->reserveLogBlockChain;
+ LOG_MEMFILE_BLK *block = f->reserveLogBlockChain;
- f->reserveLogBlockChain = block->link;
- FREE(f, block, "memfile_set_block_size");
- --f->reserveLogBlockCount;
+ f->reserveLogBlockChain = block->link;
+ FREE(f, block, "memfile_set_block_size");
+ --f->reserveLogBlockCount;
}
while (physNeeded > f->reservePhysBlockCount) {
- PHYS_MEMFILE_BLK *block =
- MALLOC( f,
- max( sizeof(PHYS_MEMFILE_BLK), sizeof(RAW_BUFFER) ),
- "memfile_set_block_size");
-
- if (block == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto finish;
- }
- block->link = f->reservePhysBlockChain;
- f->reservePhysBlockChain = block;
- ++f->reservePhysBlockCount;
+ PHYS_MEMFILE_BLK *block =
+ MALLOC( f,
+ max( sizeof(PHYS_MEMFILE_BLK), sizeof(RAW_BUFFER) ),
+ "memfile_set_block_size");
+
+ if (block == NULL) {
+ code = gs_note_error(gs_error_VMerror);
+ goto finish;
+ }
+ block->link = f->reservePhysBlockChain;
+ f->reservePhysBlockChain = block;
+ ++f->reservePhysBlockCount;
}
while (physNeeded < f->reservePhysBlockCount) {
- PHYS_MEMFILE_BLK *block = f->reservePhysBlockChain;
+ PHYS_MEMFILE_BLK *block = f->reservePhysBlockChain;
- f->reservePhysBlockChain = block->link;
- FREE(f, block, "memfile_set_block_size");
- --f->reservePhysBlockCount;
+ f->reservePhysBlockChain = block->link;
+ FREE(f, block, "memfile_set_block_size");
+ --f->reservePhysBlockCount;
}
f->error_code = 0; /* memfile_set_block_size is how user resets this */
finish:
@@ -618,51 +618,51 @@ compress_log_blk(MEMFILE * f, LOG_MEMFILE_BLK * bp)
bp->phys_blk = f->phys_curr;
bp->phys_pdata = (char *)(f->wt.ptr) + 1;
if (f->compress_state->template->reinit != 0)
- (*f->compress_state->template->reinit)(f->compress_state);
+ (*f->compress_state->template->reinit)(f->compress_state);
compressed_size = 0;
start_ptr = f->wt.ptr;
status = (*f->compress_state->template->process)(f->compress_state,
- &(f->rd), &(f->wt), true);
+ &(f->rd), &(f->wt), true);
bp->phys_blk->data_limit = (char *)(f->wt.ptr);
if (status == 1) { /* More output space needed (see strimpl.h) */
- /* allocate another physical block, then compress remainder */
- compressed_size = f->wt.limit - start_ptr;
- newphys =
- allocateWithReserve(f, sizeof(*newphys), &code, "memfile newphys",
- "compress_log_blk : MALLOC for 'newphys' failed\n");
- if (code < 0)
- return code;
- ecode |= code; /* accumulate any low-memory warnings */
- newphys->link = NULL;
- bp->phys_blk->link = newphys;
- f->phys_curr = newphys;
- f->wt.ptr = (byte *) (newphys->data) - 1;
- f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
-
- start_ptr = f->wt.ptr;
- status =
- (*f->compress_state->template->process)(f->compress_state,
- &(f->rd), &(f->wt), true);
- if (status != 0) {
- /*
- * You'd think the above line is a bug, but in real life 1 src
- * block never ends up getting split across 3 dest blocks.
- */
- /* CHANGE memfile_set_memory_warning if this assumption changes. */
- emprintf(f->memory,
- "Compression required more than one full block!\n");
- return_error(gs_error_Fatal);
- }
- newphys->data_limit = (char *)(f->wt.ptr);
+ /* allocate another physical block, then compress remainder */
+ compressed_size = f->wt.limit - start_ptr;
+ newphys =
+ allocateWithReserve(f, sizeof(*newphys), &code, "memfile newphys",
+ "compress_log_blk : MALLOC for 'newphys' failed\n");
+ if (code < 0)
+ return code;
+ ecode |= code; /* accumulate any low-memory warnings */
+ newphys->link = NULL;
+ bp->phys_blk->link = newphys;
+ f->phys_curr = newphys;
+ f->wt.ptr = (byte *) (newphys->data) - 1;
+ f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
+
+ start_ptr = f->wt.ptr;
+ status =
+ (*f->compress_state->template->process)(f->compress_state,
+ &(f->rd), &(f->wt), true);
+ if (status != 0) {
+ /*
+ * You'd think the above line is a bug, but in real life 1 src
+ * block never ends up getting split across 3 dest blocks.
+ */
+ /* CHANGE memfile_set_memory_warning if this assumption changes. */
+ emprintf(f->memory,
+ "Compression required more than one full block!\n");
+ return_error(gs_error_Fatal);
+ }
+ newphys->data_limit = (char *)(f->wt.ptr);
}
compressed_size += f->wt.ptr - start_ptr;
if (compressed_size > MEMFILE_DATA_SIZE) {
- emprintf2(f->memory,
- "\nCompression didn't - raw=%d, compressed=%ld\n",
- MEMFILE_DATA_SIZE,
- compressed_size);
+ emprintf2(f->memory,
+ "\nCompression didn't - raw=%d, compressed=%ld\n",
+ MEMFILE_DATA_SIZE,
+ compressed_size);
}
#ifdef DEBUG
tot_compressed += compressed_size;
@@ -681,97 +681,97 @@ memfile_next_blk(MEMFILE * f)
int code;
if (f->phys_curr == NULL) { /* means NOT compressing */
- /* allocate a new block */
- newphys =
- allocateWithReserve(f, sizeof(*newphys), &code, "memfile newphys",
- "memfile_next_blk: MALLOC 1 for 'newphys' failed\n");
- if (code < 0)
- return code;
- ecode |= code; /* accumulate low-mem warnings */
- newphys->link = NULL;
- newphys->data_limit = NULL; /* raw */
-
- newbp =
- allocateWithReserve(f, sizeof(*newbp), &code, "memfile newbp",
- "memfile_next_blk: MALLOC 1 for 'newbp' failed\n");
- if (code < 0) {
- FREE(f, newphys, "memfile newphys");
- return code;
- }
- ecode |= code; /* accumulate low-mem warnings */
- bp->link = newbp;
- newbp->link = NULL;
- newbp->raw_block = NULL;
- f->log_curr_blk = newbp;
-
- /* check if need to start compressing */
- if (NEED_TO_COMPRESS(f)) {
- if_debug0(':', "[:]Beginning compression\n");
- /* compress the entire file up to this point */
- if (!f->compressor_initialized) {
- int code = 0;
-
- if (f->compress_state->template->init != 0)
- code = (*f->compress_state->template->init) (f->compress_state);
- if (code < 0)
- return_error(gs_error_VMerror); /****** BOGUS ******/
- f->compressor_initialized = true;
- }
- /* Write into the new physical block we just allocated, */
- /* replace it after the loop (after some blocks are freed) */
- f->phys_curr = newphys;
- f->wt.ptr = (byte *) (newphys->data) - 1;
- f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
- bp = f->log_head;
- while (bp != newbp) { /* don't compress last block */
- int code;
-
- oldphys = bp->phys_blk;
- if ((code = compress_log_blk(f, bp)) < 0)
- return code;
- ecode |= code;
- FREE(f, oldphys, "memfile_next_blk(oldphys)");
- bp = bp->link;
- } /* end while( ) compress loop */
- /* Allocate a physical block for this (last) logical block */
- newphys =
- allocateWithReserve(f, sizeof(*newphys), &code,
- "memfile newphys",
- "memfile_next_blk: MALLOC 2 for 'newphys' failed\n");
- if (code < 0)
- return code;
- ecode |= code; /* accumulate low-mem warnings */
- newphys->link = NULL;
- newphys->data_limit = NULL; /* raw */
-
- } /* end convert file to compressed */
- newbp->phys_blk = newphys;
- f->pdata = newphys->data;
- f->pdata_end = newphys->data + MEMFILE_DATA_SIZE;
+ /* allocate a new block */
+ newphys =
+ allocateWithReserve(f, sizeof(*newphys), &code, "memfile newphys",
+ "memfile_next_blk: MALLOC 1 for 'newphys' failed\n");
+ if (code < 0)
+ return code;
+ ecode |= code; /* accumulate low-mem warnings */
+ newphys->link = NULL;
+ newphys->data_limit = NULL; /* raw */
+
+ newbp =
+ allocateWithReserve(f, sizeof(*newbp), &code, "memfile newbp",
+ "memfile_next_blk: MALLOC 1 for 'newbp' failed\n");
+ if (code < 0) {
+ FREE(f, newphys, "memfile newphys");
+ return code;
+ }
+ ecode |= code; /* accumulate low-mem warnings */
+ bp->link = newbp;
+ newbp->link = NULL;
+ newbp->raw_block = NULL;
+ f->log_curr_blk = newbp;
+
+ /* check if need to start compressing */
+ if (NEED_TO_COMPRESS(f)) {
+ if_debug0(':', "[:]Beginning compression\n");
+ /* compress the entire file up to this point */
+ if (!f->compressor_initialized) {
+ int code = 0;
+
+ if (f->compress_state->template->init != 0)
+ code = (*f->compress_state->template->init) (f->compress_state);
+ if (code < 0)
+ return_error(gs_error_VMerror); /****** BOGUS ******/
+ f->compressor_initialized = true;
+ }
+ /* Write into the new physical block we just allocated, */
+ /* replace it after the loop (after some blocks are freed) */
+ f->phys_curr = newphys;
+ f->wt.ptr = (byte *) (newphys->data) - 1;
+ f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
+ bp = f->log_head;
+ while (bp != newbp) { /* don't compress last block */
+ int code;
+
+ oldphys = bp->phys_blk;
+ if ((code = compress_log_blk(f, bp)) < 0)
+ return code;
+ ecode |= code;
+ FREE(f, oldphys, "memfile_next_blk(oldphys)");
+ bp = bp->link;
+ } /* end while( ) compress loop */
+ /* Allocate a physical block for this (last) logical block */
+ newphys =
+ allocateWithReserve(f, sizeof(*newphys), &code,
+ "memfile newphys",
+ "memfile_next_blk: MALLOC 2 for 'newphys' failed\n");
+ if (code < 0)
+ return code;
+ ecode |= code; /* accumulate low-mem warnings */
+ newphys->link = NULL;
+ newphys->data_limit = NULL; /* raw */
+
+ } /* end convert file to compressed */
+ newbp->phys_blk = newphys;
+ f->pdata = newphys->data;
+ f->pdata_end = newphys->data + MEMFILE_DATA_SIZE;
} /* end if NOT compressing */
/* File IS being compressed */
else {
- int code;
-
- oldphys = bp->phys_blk; /* save raw phys block ID */
- /* compresses bp on phys list */
- if ((code = compress_log_blk(f, bp)) < 0)
- return code;
- ecode |= code;
- newbp =
- allocateWithReserve(f, sizeof(*newbp), &code, "memfile newbp",
- "memfile_next_blk: MALLOC 2 for 'newbp' failed\n");
- if (code < 0)
- return code;
- ecode |= code;
- bp->link = newbp;
- newbp->link = NULL;
- newbp->raw_block = NULL;
- /* Re-use the raw phys block for this new logical blk */
- newbp->phys_blk = oldphys;
- f->pdata = oldphys->data;
- f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
- f->log_curr_blk = newbp;
+ int code;
+
+ oldphys = bp->phys_blk; /* save raw phys block ID */
+ /* compresses bp on phys list */
+ if ((code = compress_log_blk(f, bp)) < 0)
+ return code;
+ ecode |= code;
+ newbp =
+ allocateWithReserve(f, sizeof(*newbp), &code, "memfile newbp",
+ "memfile_next_blk: MALLOC 2 for 'newbp' failed\n");
+ if (code < 0)
+ return code;
+ ecode |= code;
+ bp->link = newbp;
+ newbp->link = NULL;
+ newbp->raw_block = NULL;
+ /* Re-use the raw phys block for this new logical blk */
+ newbp->phys_blk = oldphys;
+ f->pdata = oldphys->data;
+ f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
+ f->log_curr_blk = newbp;
} /* end else (when we are compressing) */
return (ecode);
@@ -788,35 +788,35 @@ memfile_fwrite_chars(const void *data, uint len, clist_file_ptr cf)
/* check if we are writing to the start of the file. If so, then */
/* free the file memory and re-initialize it (frees memory) */
if (f->log_curr_pos == 0) {
- int code;
+ int code;
- memfile_free_mem(f);
- if ((code = memfile_init_empty(f)) < 0) {
- f->error_code = code;
- return 0;
- }
+ memfile_free_mem(f);
+ if ((code = memfile_init_empty(f)) < 0) {
+ f->error_code = code;
+ return 0;
+ }
}
if (f->log_curr_blk->link != 0) {
- emprintf(f->memory,
- " Write file truncate -- need to free physical blocks.\n");
+ emprintf(f->memory,
+ " Write file truncate -- need to free physical blocks.\n");
}
while (count) {
- uint move_count = f->pdata_end - f->pdata;
-
- if (move_count == 0) {
- if ((ecode = memfile_next_blk(f)) != 0) {
- f->error_code = ecode;
- if (ecode < 0)
- return 0;
- }
- } else {
- if (move_count > count)
- move_count = count;
- memmove(f->pdata, str, move_count);
- f->pdata += move_count;
- str += move_count;
- count -= move_count;
- }
+ uint move_count = f->pdata_end - f->pdata;
+
+ if (move_count == 0) {
+ if ((ecode = memfile_next_blk(f)) != 0) {
+ f->error_code = ecode;
+ if (ecode < 0)
+ return 0;
+ }
+ } else {
+ if (move_count > count)
+ move_count = count;
+ memmove(f->pdata, str, move_count);
+ f->pdata += move_count;
+ str += move_count;
+ count -= move_count;
+ }
}
f->log_curr_pos += len;
f->log_length = f->log_curr_pos; /* truncate length to here */
@@ -841,156 +841,156 @@ memfile_get_pdata(MEMFILE * f)
LOG_MEMFILE_BLK *bp = f->log_curr_blk;
if (bp->phys_blk->data_limit == NULL) {
- /* Not compressed, return this data pointer */
- f->pdata = (bp->phys_blk)->data;
- i = f->log_curr_pos % MEMFILE_DATA_SIZE; /* pos within block */
- i = f->log_curr_pos - i; /* base of block */
- if (i + MEMFILE_DATA_SIZE > f->log_length)
- f->pdata_end = f->pdata + f->log_length - i;
- else
- f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
+ /* Not compressed, return this data pointer */
+ f->pdata = (bp->phys_blk)->data;
+ i = f->log_curr_pos % MEMFILE_DATA_SIZE; /* pos within block */
+ i = f->log_curr_pos - i; /* base of block */
+ if (i + MEMFILE_DATA_SIZE > f->log_length)
+ f->pdata_end = f->pdata + f->log_length - i;
+ else
+ f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
} else {
- /* data was compressed */
- if (f->raw_head == NULL) {
- code = 0;
- /* need to allocate the raw buffer pool */
- num_raw_buffers = GET_NUM_RAW_BUFFERS(f);
- if (f->reservePhysBlockCount) {
- /* HACK: allocate reserve block that's been reserved for
- * decompression. This buffer's block was pre-allocated to make
- * sure we won't come up short here. Take from chain instead of
- * allocateWithReserve() since this buf would just be wasted if
- * allowed to remain preallocated. */
- f->raw_head = (RAW_BUFFER *)f->reservePhysBlockChain;
- f->reservePhysBlockChain = f->reservePhysBlockChain->link;
- --f->reservePhysBlockCount;
- } else {
- f->raw_head =
- allocateWithReserve(f, sizeof(*f->raw_head), &code,
- "memfile raw buffer",
- "memfile_get_pdata: MALLOC for 'raw_head' failed\n");
- if (code < 0)
- return code;
- }
- f->raw_head->back = NULL;
- f->raw_tail = f->raw_head;
- f->raw_tail->log_blk = NULL;
- for (i = 0; i < num_raw_buffers; i++) {
- f->raw_tail->fwd = (RAW_BUFFER *) MALLOC(f, sizeof(RAW_BUFFER),
- "memfile raw buffer");
- /* if MALLOC fails, then just stop allocating */
- if (!f->raw_tail->fwd)
- break;
- f->total_space += sizeof(RAW_BUFFER);
- f->raw_tail->fwd->back = f->raw_tail;
- f->raw_tail = f->raw_tail->fwd;
- f->raw_tail->log_blk = NULL;
- }
- f->raw_tail->fwd = NULL;
- num_raw_buffers = i + 1; /* if MALLOC failed, then OK */
- if_debug1(':', "[:]Number of raw buffers allocated=%d\n",
- num_raw_buffers);
- if (f->decompress_state->template->init != 0)
- code = (*f->decompress_state->template->init)
- (f->decompress_state);
- if (code < 0)
- return_error(gs_error_VMerror);
-
- } /* end allocating the raw buffer pool (first time only) */
- if (bp->raw_block == NULL) {
+ /* data was compressed */
+ if (f->raw_head == NULL) {
+ code = 0;
+ /* need to allocate the raw buffer pool */
+ num_raw_buffers = GET_NUM_RAW_BUFFERS(f);
+ if (f->reservePhysBlockCount) {
+ /* HACK: allocate reserve block that's been reserved for
+ * decompression. This buffer's block was pre-allocated to make
+ * sure we won't come up short here. Take from chain instead of
+ * allocateWithReserve() since this buf would just be wasted if
+ * allowed to remain preallocated. */
+ f->raw_head = (RAW_BUFFER *)f->reservePhysBlockChain;
+ f->reservePhysBlockChain = f->reservePhysBlockChain->link;
+ --f->reservePhysBlockCount;
+ } else {
+ f->raw_head =
+ allocateWithReserve(f, sizeof(*f->raw_head), &code,
+ "memfile raw buffer",
+ "memfile_get_pdata: MALLOC for 'raw_head' failed\n");
+ if (code < 0)
+ return code;
+ }
+ f->raw_head->back = NULL;
+ f->raw_tail = f->raw_head;
+ f->raw_tail->log_blk = NULL;
+ for (i = 0; i < num_raw_buffers; i++) {
+ f->raw_tail->fwd = (RAW_BUFFER *) MALLOC(f, sizeof(RAW_BUFFER),
+ "memfile raw buffer");
+ /* if MALLOC fails, then just stop allocating */
+ if (!f->raw_tail->fwd)
+ break;
+ f->total_space += sizeof(RAW_BUFFER);
+ f->raw_tail->fwd->back = f->raw_tail;
+ f->raw_tail = f->raw_tail->fwd;
+ f->raw_tail->log_blk = NULL;
+ }
+ f->raw_tail->fwd = NULL;
+ num_raw_buffers = i + 1; /* if MALLOC failed, then OK */
+ if_debug1(':', "[:]Number of raw buffers allocated=%d\n",
+ num_raw_buffers);
+ if (f->decompress_state->template->init != 0)
+ code = (*f->decompress_state->template->init)
+ (f->decompress_state);
+ if (code < 0)
+ return_error(gs_error_VMerror);
+
+ } /* end allocating the raw buffer pool (first time only) */
+ if (bp->raw_block == NULL) {
#ifdef DEBUG
- tot_cache_miss++; /* count every decompress */
+ tot_cache_miss++; /* count every decompress */
#endif
- /* find a raw buffer and decompress */
- if (f->raw_tail->log_blk != NULL) {
- /* This block was in use, grab it */
+ /* find a raw buffer and decompress */
+ if (f->raw_tail->log_blk != NULL) {
+ /* This block was in use, grab it */
#ifdef DEBUG
- tot_swap_out++;
+ tot_swap_out++;
#endif
- f->raw_tail->log_blk->raw_block = NULL; /* data no longer here */
- f->raw_tail->log_blk = NULL;
- }
- /* Use the last raw block in the chain (the oldest) */
- f->raw_tail->back->fwd = NULL; /* disconnect from tail */
- f->raw_tail->fwd = f->raw_head; /* new head */
- f->raw_head->back = f->raw_tail;
- f->raw_tail = f->raw_tail->back;
- f->raw_head = f->raw_head->back;
- f->raw_head->back = NULL;
- f->raw_head->log_blk = bp;
-
- /* Decompress the data into this raw block */
- /* Initialize the decompressor */
- if (f->decompress_state->template->reinit != 0)
- (*f->decompress_state->template->reinit) (f->decompress_state);
- /* Set pointers and call the decompress routine */
- f->wt.ptr = (byte *) (f->raw_head->data) - 1;
- f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
- f->rd.ptr = (const byte *)(bp->phys_pdata) - 1;
- f->rd.limit = (const byte *)bp->phys_blk->data_limit;
+ f->raw_tail->log_blk->raw_block = NULL; /* data no longer here */
+ f->raw_tail->log_blk = NULL;
+ }
+ /* Use the last raw block in the chain (the oldest) */
+ f->raw_tail->back->fwd = NULL; /* disconnect from tail */
+ f->raw_tail->fwd = f->raw_head; /* new head */
+ f->raw_head->back = f->raw_tail;
+ f->raw_tail = f->raw_tail->back;
+ f->raw_head = f->raw_head->back;
+ f->raw_head->back = NULL;
+ f->raw_head->log_blk = bp;
+
+ /* Decompress the data into this raw block */
+ /* Initialize the decompressor */
+ if (f->decompress_state->template->reinit != 0)
+ (*f->decompress_state->template->reinit) (f->decompress_state);
+ /* Set pointers and call the decompress routine */
+ f->wt.ptr = (byte *) (f->raw_head->data) - 1;
+ f->wt.limit = f->wt.ptr + MEMFILE_DATA_SIZE;
+ f->rd.ptr = (const byte *)(bp->phys_pdata) - 1;
+ f->rd.limit = (const byte *)bp->phys_blk->data_limit;
#ifdef DEBUG
- decomp_wt_ptr0 = f->wt.ptr;
- decomp_wt_limit0 = f->wt.limit;
- decomp_rd_ptr0 = f->rd.ptr;
- decomp_rd_limit0 = f->rd.limit;
+ decomp_wt_ptr0 = f->wt.ptr;
+ decomp_wt_limit0 = f->wt.limit;
+ decomp_rd_ptr0 = f->rd.ptr;
+ decomp_rd_limit0 = f->rd.limit;
#endif
- status = (*f->decompress_state->template->process)
- (f->decompress_state, &(f->rd), &(f->wt), true);
- if (status == 0) { /* More input data needed */
- /* switch to next block and continue decompress */
- int back_up = 0; /* adjust pointer backwards */
-
- if (f->rd.ptr != f->rd.limit) {
- /* transfer remainder bytes from the previous block */
- back_up = f->rd.limit - f->rd.ptr;
- for (i = 0; i < back_up; i++)
- *(bp->phys_blk->link->data - back_up + i) = *++f->rd.ptr;
- }
- f->rd.ptr = (const byte *)bp->phys_blk->link->data - back_up - 1;
- f->rd.limit = (const byte *)bp->phys_blk->link->data_limit;
+ status = (*f->decompress_state->template->process)
+ (f->decompress_state, &(f->rd), &(f->wt), true);
+ if (status == 0) { /* More input data needed */
+ /* switch to next block and continue decompress */
+ int back_up = 0; /* adjust pointer backwards */
+
+ if (f->rd.ptr != f->rd.limit) {
+ /* transfer remainder bytes from the previous block */
+ back_up = f->rd.limit - f->rd.ptr;
+ for (i = 0; i < back_up; i++)
+ *(bp->phys_blk->link->data - back_up + i) = *++f->rd.ptr;
+ }
+ f->rd.ptr = (const byte *)bp->phys_blk->link->data - back_up - 1;
+ f->rd.limit = (const byte *)bp->phys_blk->link->data_limit;
#ifdef DEBUG
- decomp_wt_ptr1 = f->wt.ptr;
- decomp_wt_limit1 = f->wt.limit;
- decomp_rd_ptr1 = f->rd.ptr;
- decomp_rd_limit1 = f->rd.limit;
+ decomp_wt_ptr1 = f->wt.ptr;
+ decomp_wt_limit1 = f->wt.limit;
+ decomp_rd_ptr1 = f->rd.ptr;
+ decomp_rd_limit1 = f->rd.limit;
#endif
- status = (*f->decompress_state->template->process)
- (f->decompress_state, &(f->rd), &(f->wt), true);
- if (status == 0) {
- emprintf(f->memory,
- "Decompression required more than one full block!\n");
- return_error(gs_error_Fatal);
- }
- }
- bp->raw_block = f->raw_head; /* point to raw block */
- }
- /* end if( raw_block == NULL ) meaning need to decompress data */
- else {
- /* data exists in the raw data cache, if not raw_head, move it */
- if (bp->raw_block != f->raw_head) {
- /* move to raw_head */
- /* prev.fwd = this.fwd */
- bp->raw_block->back->fwd = bp->raw_block->fwd;
- if (bp->raw_block->fwd != NULL)
- /* next.back = this.back */
- bp->raw_block->fwd->back = bp->raw_block->back;
- else
- f->raw_tail = bp->raw_block->back; /* tail = prev */
- f->raw_head->back = bp->raw_block; /* head.back = this */
- bp->raw_block->fwd = f->raw_head; /* this.fwd = orig head */
- f->raw_head = bp->raw_block; /* head = this */
- f->raw_head->back = NULL; /* this.back = NULL */
+ status = (*f->decompress_state->template->process)
+ (f->decompress_state, &(f->rd), &(f->wt), true);
+ if (status == 0) {
+ emprintf(f->memory,
+ "Decompression required more than one full block!\n");
+ return_error(gs_error_Fatal);
+ }
+ }
+ bp->raw_block = f->raw_head; /* point to raw block */
+ }
+ /* end if( raw_block == NULL ) meaning need to decompress data */
+ else {
+ /* data exists in the raw data cache, if not raw_head, move it */
+ if (bp->raw_block != f->raw_head) {
+ /* move to raw_head */
+ /* prev.fwd = this.fwd */
+ bp->raw_block->back->fwd = bp->raw_block->fwd;
+ if (bp->raw_block->fwd != NULL)
+ /* next.back = this.back */
+ bp->raw_block->fwd->back = bp->raw_block->back;
+ else
+ f->raw_tail = bp->raw_block->back; /* tail = prev */
+ f->raw_head->back = bp->raw_block; /* head.back = this */
+ bp->raw_block->fwd = f->raw_head; /* this.fwd = orig head */
+ f->raw_head = bp->raw_block; /* head = this */
+ f->raw_head->back = NULL; /* this.back = NULL */
#ifdef DEBUG
- tot_cache_hits++; /* counting here prevents repeats since */
- /* won't count if already at head */
+ tot_cache_hits++; /* counting here prevents repeats since */
+ /* won't count if already at head */
#endif
- }
- }
- f->pdata = bp->raw_block->data;
- f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
- /* NOTE: last block is never compressed, so a compressed block */
- /* is always full size. */
+ }
+ }
+ f->pdata = bp->raw_block->data;
+ f->pdata_end = f->pdata + MEMFILE_DATA_SIZE;
+ /* NOTE: last block is never compressed, so a compressed block */
+ /* is always full size. */
} /* end else (when data was compressed) */
return 0;
@@ -1007,23 +1007,23 @@ memfile_fread_chars(void *data, uint len, clist_file_ptr cf)
num_read = f->log_length - f->log_curr_pos;
if (count > num_read)
- count = num_read;
+ count = num_read;
num_read = count;
while (count) {
- f->log_curr_pos++; /* move into next byte */
- if (f->pdata == f->pdata_end) {
- f->log_curr_blk = (f->log_curr_blk)->link;
- memfile_get_pdata(f);
- }
- move_count = f->pdata_end - f->pdata;
- if (move_count > count)
- move_count = count;
- f->log_curr_pos += move_count - 1; /* new position */
- memmove(str, f->pdata, move_count);
- str += move_count;
- f->pdata += move_count;
- count -= move_count;
+ f->log_curr_pos++; /* move into next byte */
+ if (f->pdata == f->pdata_end) {
+ f->log_curr_blk = (f->log_curr_blk)->link;
+ memfile_get_pdata(f);
+ }
+ move_count = f->pdata_end - f->pdata;
+ if (move_count > count)
+ move_count = count;
+ f->log_curr_pos += move_count - 1; /* new position */
+ memmove(str, f->pdata, move_count);
+ str += move_count;
+ f->pdata += move_count;
+ count -= move_count;
}
return (num_read);
@@ -1049,23 +1049,23 @@ memfile_rewind(clist_file_ptr cf, bool discard_data, const char *ignore_fname)
MEMFILE *f = (MEMFILE *) cf;
if (discard_data) {
- /* This affects the memfile data, not just the MEMFILE * access struct */
- /* Check first to make sure that we have exclusive access */
- if (f->openlist != NULL || f->base_memfile != NULL) {
- /* TODO: Move the data so it is still connected to other open files */
- emprintf1(f->memory,
- "memfile_rewind(%p) with discard_data=true failed: ",
- f);
- f->error_code = gs_note_error(gs_error_ioerror);
- return;
- }
- memfile_free_mem(f);
- /* We have to call memfile_init_empty to preserve invariants. */
- memfile_init_empty(f);
+ /* This affects the memfile data, not just the MEMFILE * access struct */
+ /* Check first to make sure that we have exclusive access */
+ if (f->openlist != NULL || f->base_memfile != NULL) {
+ /* TODO: Move the data so it is still connected to other open files */
+ emprintf1(f->memory,
+ "memfile_rewind(%p) with discard_data=true failed: ",
+ f);
+ f->error_code = gs_note_error(gs_error_ioerror);
+ return;
+ }
+ memfile_free_mem(f);
+ /* We have to call memfile_init_empty to preserve invariants. */
+ memfile_init_empty(f);
} else {
- f->log_curr_blk = f->log_head;
- f->log_curr_pos = 0;
- memfile_get_pdata(f);
+ f->log_curr_blk = f->log_head;
+ f->log_curr_pos = 0;
+ memfile_get_pdata(f);
}
}
@@ -1076,35 +1076,35 @@ memfile_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fn
int64_t i, block_num, new_pos;
switch (mode) {
- case SEEK_SET: /* offset from the beginning of the file */
- new_pos = offset;
- break;
+ case SEEK_SET: /* offset from the beginning of the file */
+ new_pos = offset;
+ break;
- case SEEK_CUR: /* offset from the current position in the file */
- new_pos = offset + f->log_curr_pos;
- break;
+ case SEEK_CUR: /* offset from the current position in the file */
+ new_pos = offset + f->log_curr_pos;
+ break;
- case SEEK_END: /* offset back from the end of the file */
- new_pos = f->log_length - offset;
- break;
+ case SEEK_END: /* offset back from the end of the file */
+ new_pos = f->log_length - offset;
+ break;
- default:
- return (-1);
+ default:
+ return (-1);
}
if (new_pos < 0 || new_pos > f->log_length)
- return -1;
+ return -1;
if ((f->pdata == f->pdata_end) && (f->log_curr_blk->link != NULL)) {
- /* log_curr_blk is actually one block behind log_curr_pos */
- f->log_curr_blk = f->log_curr_blk->link;
+ /* log_curr_blk is actually one block behind log_curr_pos */
+ f->log_curr_blk = f->log_curr_blk->link;
}
block_num = new_pos / MEMFILE_DATA_SIZE;
i = f->log_curr_pos / MEMFILE_DATA_SIZE;
if (block_num < i) { /* if moving backwards, start at beginning */
- f->log_curr_blk = f->log_head;
- i = 0;
+ f->log_curr_blk = f->log_head;
+ i = 0;
}
for (; i < block_num; i++) {
- f->log_curr_blk = f->log_curr_blk->link;
+ f->log_curr_blk = f->log_curr_blk->link;
}
f->log_curr_pos = new_pos;
memfile_get_pdata(f); /* pointers to start of block */
@@ -1123,19 +1123,19 @@ memfile_free_mem(MEMFILE * f)
#ifdef DEBUG
/* output some diagnostics about the effectiveness */
if (tot_raw > 100) {
- if (tot_raw > 0xFFFFFFFF)
- if_debug4(':', "[:]tot_raw=%lu%0lu, tot_compressed=%lu%0lu\n",
- tot_raw >> 32, tot_raw & 0xFFFFFFFF,
- tot_compressed >> 32, tot_compressed & 0xFFFFFFFF);
- else
- if_debug2(':', "[:]tot_raw=%lu, tot_compressed=%lu\n",
- tot_raw, tot_compressed);
+ if (tot_raw > 0xFFFFFFFF)
+ if_debug4(':', "[:]tot_raw=%lu%0lu, tot_compressed=%lu%0lu\n",
+ tot_raw >> 32, tot_raw & 0xFFFFFFFF,
+ tot_compressed >> 32, tot_compressed & 0xFFFFFFFF);
+ else
+ if_debug2(':', "[:]tot_raw=%lu, tot_compressed=%lu\n",
+ tot_raw, tot_compressed);
}
if (tot_cache_hits != 0) {
- if_debug3(':', "[:]Cache hits=%lu, cache misses=%lu, swapouts=%lu\n",
- tot_cache_hits,
- (long)(tot_cache_miss - (f->log_length / MEMFILE_DATA_SIZE)),
- tot_swap_out);
+ if_debug3(':', "[:]Cache hits=%lu, cache misses=%lu, swapouts=%lu\n",
+ tot_cache_hits,
+ (long)(tot_cache_miss - (f->log_length / MEMFILE_DATA_SIZE)),
+ tot_swap_out);
}
tot_raw = 0;
tot_compressed = 0;
@@ -1148,51 +1148,51 @@ memfile_free_mem(MEMFILE * f)
bp = f->log_head;
if (bp != NULL) {
- /* Null out phys_blk pointers to compressed data. */
- PHYS_MEMFILE_BLK *pphys = bp->phys_blk;
-
- {
- for (tmpbp = bp; tmpbp != NULL; tmpbp = tmpbp->link)
- if (tmpbp->phys_blk->data_limit != NULL)
- tmpbp->phys_blk = 0;
- }
- /* Free the physical blocks that make up the compressed data */
- if (pphys->data_limit != NULL) {
- /* the data was compressed, free the chain of blocks */
- while (pphys != NULL) {
- PHYS_MEMFILE_BLK *tmpphys = pphys->link;
-
- FREE(f, pphys, "memfile_free_mem(pphys)");
- pphys = tmpphys;
- }
- }
+ /* Null out phys_blk pointers to compressed data. */
+ PHYS_MEMFILE_BLK *pphys = bp->phys_blk;
+
+ {
+ for (tmpbp = bp; tmpbp != NULL; tmpbp = tmpbp->link)
+ if (tmpbp->phys_blk->data_limit != NULL)
+ tmpbp->phys_blk = 0;
+ }
+ /* Free the physical blocks that make up the compressed data */
+ if (pphys->data_limit != NULL) {
+ /* the data was compressed, free the chain of blocks */
+ while (pphys != NULL) {
+ PHYS_MEMFILE_BLK *tmpphys = pphys->link;
+
+ FREE(f, pphys, "memfile_free_mem(pphys)");
+ pphys = tmpphys;
+ }
+ }
}
/* Now free the logical blocks, and any uncompressed physical blocks. */
while (bp != NULL) {
- if (bp->phys_blk != NULL) {
- FREE(f, bp->phys_blk, "memfile_free_mem(phys_blk)");
- }
- tmpbp = bp->link;
- FREE(f, bp, "memfile_free_mem(log_blk)");
- bp = tmpbp;
+ if (bp->phys_blk != NULL) {
+ FREE(f, bp->phys_blk, "memfile_free_mem(phys_blk)");
+ }
+ tmpbp = bp->link;
+ FREE(f, bp, "memfile_free_mem(log_blk)");
+ bp = tmpbp;
}
f->log_head = NULL;
/* Free any internal compressor state. */
if (f->compressor_initialized) {
- if (f->decompress_state->template->release != 0)
- (*f->decompress_state->template->release) (f->decompress_state);
- if (f->compress_state->template->release != 0)
- (*f->compress_state->template->release) (f->compress_state);
- f->compressor_initialized = false;
+ if (f->decompress_state->template->release != 0)
+ (*f->decompress_state->template->release) (f->decompress_state);
+ if (f->compress_state->template->release != 0)
+ (*f->compress_state->template->release) (f->compress_state);
+ f->compressor_initialized = false;
}
/* free the raw buffers */
while (f->raw_head != NULL) {
- RAW_BUFFER *tmpraw = f->raw_head->fwd;
+ RAW_BUFFER *tmpraw = f->raw_head->fwd;
- FREE(f, f->raw_head, "memfile_free_mem(raw)");
- f->raw_head = tmpraw;
+ FREE(f, f->raw_head, "memfile_free_mem(raw)");
+ f->raw_head = tmpraw;
}
}
@@ -1215,8 +1215,8 @@ memfile_init_empty(MEMFILE * f)
/* File empty - get a physical mem block (includes the buffer area) */
pphys = MALLOC(f, sizeof(*pphys), "memfile pphys");
if (!pphys) {
- emprintf(f->memory, "memfile_init_empty: MALLOC for 'pphys' failed\n");
- return_error(gs_error_VMerror);
+ emprintf(f->memory, "memfile_init_empty: MALLOC for 'pphys' failed\n");
+ return_error(gs_error_VMerror);
}
f->total_space += sizeof(*pphys);
pphys->data_limit = NULL; /* raw data for now */
@@ -1224,10 +1224,10 @@ memfile_init_empty(MEMFILE * f)
/* Get logical mem block to go with physical one */
plog = (LOG_MEMFILE_BLK *)MALLOC( f, sizeof(*plog), "memfile_init_empty" );
if (plog == NULL) {
- FREE(f, pphys, "memfile_init_empty");
- emprintf(f->memory,
- "memfile_init_empty: MALLOC for log_curr_blk failed\n");
- return_error(gs_error_VMerror);
+ FREE(f, pphys, "memfile_init_empty");
+ emprintf(f->memory,
+ "memfile_init_empty: MALLOC for log_curr_blk failed\n");
+ return_error(gs_error_VMerror);
}
f->total_space += sizeof(*plog);
f->log_head = f->log_curr_blk = plog;
diff --git a/gs/base/gxclmem.h b/gs/base/gxclmem.h
index d7779a1f0..2370f11d3 100644
--- a/gs/base/gxclmem.h
+++ b/gs/base/gxclmem.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,7 @@ typedef struct RAW_BUFFER {
typedef struct PHYS_MEMFILE_BLK {
struct PHYS_MEMFILE_BLK *link;
char *data_limit; /* end of data when compressed */
- /* data_limit is NULL if not compressed */
+ /* data_limit is NULL if not compressed */
char data_spare[4]; /* used during de-compress */
char data[MEMFILE_DATA_SIZE];
} PHYS_MEMFILE_BLK;
@@ -66,37 +66,37 @@ struct MEMFILE_s {
gs_memory_t *data_memory; /* storage allocator for data */
bool ok_to_compress; /* if true, OK to compress this file */
bool is_open; /* track open/closed for each access struct */
- /*
- * We need to maintain a linked list of other structs that
- * have beed opened on this 'file'. This allows for a writer
- * to create a file, close it (but not unlink it), then other
- * 'opens' of the same file, using the pseudo file-name that
- * consists of a flag 0xff byte followed by the address as
- * a 0x____ string.
- *
- * When the file is 'unlinked' it must check for other open
- * 'readers' and set the 'READER INSTANCE' values of the
- * cloned structures so that calls into 'read' and 'seek'
- * etc., will be harmless.
- */
- struct MEMFILE_s *openlist;
+ /*
+ * We need to maintain a linked list of other structs that
+ * have beed opened on this 'file'. This allows for a writer
+ * to create a file, close it (but not unlink it), then other
+ * 'opens' of the same file, using the pseudo file-name that
+ * consists of a flag 0xff byte followed by the address as
+ * a 0x____ string.
+ *
+ * When the file is 'unlinked' it must check for other open
+ * 'readers' and set the 'READER INSTANCE' values of the
+ * cloned structures so that calls into 'read' and 'seek'
+ * etc., will be harmless.
+ */
+ struct MEMFILE_s *openlist;
struct MEMFILE_s *base_memfile; /* reader instances set this to the file that was written */
- /*
- * Reserve memory blocks: these are used to guarantee that a
- * given-sized write (or sequence of writes) will always succeed.
- * More specifically, the guarantee is that N bytes can successfully
- * be written after a low-memory warning is first returned by
- * fwrite. The reserve of N bytes for a given file is (re)allocated
- * by a successful call to memfile_set_memory_warning(N). Fwrite
- * allocates memory only from the reserve when its normal allocation
- * attempts fail; in such cases, it allocates blocks from the
- * reserve pool as needed and completes normally, but returns a
- * low-memory warning status. Once a low-memory warning has been
- * returned, fwrite will continue to attempt to allocate memory from
- * the usual allocator on subsequent fwrites, but does *not* try to
- * "top up" the reserve if becomes available -- only an explicit
- * memfile_set_memory_warning does so.
- */
+ /*
+ * Reserve memory blocks: these are used to guarantee that a
+ * given-sized write (or sequence of writes) will always succeed.
+ * More specifically, the guarantee is that N bytes can successfully
+ * be written after a low-memory warning is first returned by
+ * fwrite. The reserve of N bytes for a given file is (re)allocated
+ * by a successful call to memfile_set_memory_warning(N). Fwrite
+ * allocates memory only from the reserve when its normal allocation
+ * attempts fail; in such cases, it allocates blocks from the
+ * reserve pool as needed and completes normally, but returns a
+ * low-memory warning status. Once a low-memory warning has been
+ * returned, fwrite will continue to attempt to allocate memory from
+ * the usual allocator on subsequent fwrites, but does *not* try to
+ * "top up" the reserve if becomes available -- only an explicit
+ * memfile_set_memory_warning does so.
+ */
PHYS_MEMFILE_BLK *reservePhysBlockChain; /* chain of reserve phys blks */
int reservePhysBlockCount; /* count of entries on reservePhysBlockChain */
LOG_MEMFILE_BLK *reserveLogBlockChain; /* chain of reserve log blks */
diff --git a/gs/base/gxclpage.c b/gs/base/gxclpage.c
index edc337597..3a95aaf00 100644
--- a/gs/base/gxclpage.c
+++ b/gs/base/gxclpage.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,32 +20,32 @@
/* Save a page. */
int
gdev_prn_save_page(gx_device_printer * pdev, gx_saved_page * page,
- int num_copies)
+ int num_copies)
{
gx_device_clist *cdev = (gx_device_clist *) pdev;
/* Make sure we are banding. */
if (!pdev->buffer_space)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (strlen(pdev->dname) >= sizeof(page->dname))
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
{
- gx_device_clist_writer * const pcldev =
- (gx_device_clist_writer *)pdev;
- int code;
+ gx_device_clist_writer * const pcldev =
+ (gx_device_clist_writer *)pdev;
+ int code;
- if ((code = clist_end_page(pcldev)) < 0 ||
- (code = cdev->common.page_info.io_procs->fclose(pcldev->page_cfile, pcldev->page_cfname, false)) < 0 ||
- (code = cdev->common.page_info.io_procs->fclose(pcldev->page_bfile, pcldev->page_bfname, false)) < 0
- )
- return code;
- /* Save the device information. */
- memcpy(&page->device, pdev, sizeof(gx_device));
- strcpy(page->dname, pdev->dname);
- /* Save the page information. */
- page->info = pcldev->page_info;
- page->info.cfile = 0;
- page->info.bfile = 0;
+ if ((code = clist_end_page(pcldev)) < 0 ||
+ (code = cdev->common.page_info.io_procs->fclose(pcldev->page_cfile, pcldev->page_cfname, false)) < 0 ||
+ (code = cdev->common.page_info.io_procs->fclose(pcldev->page_bfile, pcldev->page_bfname, false)) < 0
+ )
+ return code;
+ /* Save the device information. */
+ memcpy(&page->device, pdev, sizeof(gx_device));
+ strcpy(page->dname, pdev->dname);
+ /* Save the page information. */
+ page->info = pcldev->page_info;
+ page->info.cfile = 0;
+ page->info.bfile = 0;
}
/* Save other information. */
page->num_copies = num_copies;
@@ -55,40 +55,40 @@ gdev_prn_save_page(gx_device_printer * pdev, gx_saved_page * page,
/* Render an array of saved pages. */
int
gdev_prn_render_pages(gx_device_printer * pdev,
- const gx_placed_page * ppages, int count)
+ const gx_placed_page * ppages, int count)
{
gx_device_clist_reader * const pcldev =
- (gx_device_clist_reader *)pdev;
+ (gx_device_clist_reader *)pdev;
/* Check to make sure the pages are compatible with the device. */
{
- int i;
-
- for (i = 0; i < count; ++i) {
- const gx_saved_page *page = ppages[i].page;
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ const gx_saved_page *page = ppages[i].page;
- /* We would like to fully check the color representation, */
- /* but we don't have enough information to do that. */
- if (strcmp(page->dname, pdev->dname) != 0 ||
- memcmp(&page->device.color_info, &pdev->color_info,
- sizeof(pdev->color_info)) != 0
- )
- return_error(gs_error_rangecheck);
- /* Currently we don't allow translation in Y. */
- if (ppages[i].offset.y != 0)
- return_error(gs_error_rangecheck);
- /* Make sure the band parameters are compatible. */
- if (page->info.band_params.BandBufferSpace !=
- pdev->buffer_space ||
- page->info.band_params.BandWidth !=
- pdev->width
- )
- return_error(gs_error_rangecheck);
- /* Currently we require all band heights to be the same. */
- if (i > 0 && page->info.band_params.BandHeight !=
- ppages[0].page->info.band_params.BandHeight)
- return_error(gs_error_rangecheck);
- }
+ /* We would like to fully check the color representation, */
+ /* but we don't have enough information to do that. */
+ if (strcmp(page->dname, pdev->dname) != 0 ||
+ memcmp(&page->device.color_info, &pdev->color_info,
+ sizeof(pdev->color_info)) != 0
+ )
+ return_error(gs_error_rangecheck);
+ /* Currently we don't allow translation in Y. */
+ if (ppages[i].offset.y != 0)
+ return_error(gs_error_rangecheck);
+ /* Make sure the band parameters are compatible. */
+ if (page->info.band_params.BandBufferSpace !=
+ pdev->buffer_space ||
+ page->info.band_params.BandWidth !=
+ pdev->width
+ )
+ return_error(gs_error_rangecheck);
+ /* Currently we require all band heights to be the same. */
+ if (i > 0 && page->info.band_params.BandHeight !=
+ ppages[0].page->info.band_params.BandHeight)
+ return_error(gs_error_rangecheck);
+ }
}
/* Set up the page list in the device. */
/****** SHOULD FACTOR THIS OUT OF clist_render_init ******/
@@ -100,18 +100,18 @@ gdev_prn_render_pages(gx_device_printer * pdev,
pcldev->icc_cache_cl = NULL;
/* Render the pages. */
{
- int code = (*dev_proc(pdev, output_page))
- ((gx_device *) pdev, ppages[0].page->num_copies, true);
+ int code = (*dev_proc(pdev, output_page))
+ ((gx_device *) pdev, ppages[0].page->num_copies, true);
- /* Delete the temporary files. */
- int i;
+ /* Delete the temporary files. */
+ int i;
- for (i = 0; i < count; ++i) {
- const gx_saved_page *page = ppages[i].page;
+ for (i = 0; i < count; ++i) {
+ const gx_saved_page *page = ppages[i].page;
- pcldev->page_info.io_procs->unlink(page->info.cfname);
- pcldev->page_info.io_procs->unlink(page->info.bfname);
- }
- return code;
+ pcldev->page_info.io_procs->unlink(page->info.cfname);
+ pcldev->page_info.io_procs->unlink(page->info.bfname);
+ }
+ return code;
}
}
diff --git a/gs/base/gxclpage.h b/gs/base/gxclpage.h
index 636edb51e..a2206dc38 100644
--- a/gs/base/gxclpage.h
+++ b/gs/base/gxclpage.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@
* in-memory structure.
*/
int gdev_prn_save_page(gx_device_printer * pdev, gx_saved_page * page,
- int num_copies);
+ int num_copies);
/*
* Render an array of saved pages by setting up a modified get_bits
@@ -48,6 +48,6 @@ int gdev_prn_save_page(gx_device_printer * pdev, gx_saved_page * page,
* the device width is the same as the BandWidth value of the saved pages.
*/
int gdev_prn_render_pages(gx_device_printer * pdev,
- const gx_placed_page * ppages, int count);
+ const gx_placed_page * ppages, int count);
#endif /* gxclpage_INCLUDED */
diff --git a/gs/base/gxclpath.c b/gs/base/gxclpath.c
index b6bccc3e8..8a5bab6a3 100644
--- a/gs/base/gxclpath.c
+++ b/gs/base/gxclpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,16 +40,16 @@ ulong stats_cmd_diffs[5];
/* Forward declarations */
static int cmd_put_path(gx_device_clist_writer * cldev,
- gx_clist_state * pcls, const gx_path * ppath,
- fixed ymin, fixed ymax, byte op,
- bool implicit_close, segment_notes keep_notes);
+ gx_clist_state * pcls, const gx_path * ppath,
+ fixed ymin, fixed ymax, byte op,
+ bool implicit_close, segment_notes keep_notes);
/* ------ Utilities ------ */
/* Compute the colors used by a colored halftone. */
static gx_color_index
colored_halftone_colors_used(gx_device_clist_writer *cldev,
- const gx_drawing_color *pdcolor)
+ const gx_drawing_color *pdcolor)
{
/*
* We only know how to compute an accurate color set for the
@@ -57,18 +57,18 @@ colored_halftone_colors_used(gx_device_clist_writer *cldev,
*/
if (dev_proc(cldev, dev_spec_op)((gx_device *)cldev,
gxdso_is_std_cmyk_1bit, NULL, 0) <= 0)
- return ((gx_color_index)1 << cldev->color_info.depth) - 1; /* What about transparency? Need to check this */
+ return ((gx_color_index)1 << cldev->color_info.depth) - 1; /* What about transparency? Need to check this */
/*
* Note that c_base[0], and the low-order bit of plane_mask,
* correspond to cyan: this requires reversing the bit order of
* the plane mask.
*/
return
- ((pdcolor->colors.colored.c_base[0] << 3) |
- (pdcolor->colors.colored.c_base[1] << 2) |
- (pdcolor->colors.colored.c_base[2] << 1) |
- (pdcolor->colors.colored.c_base[3]) |
- (byte_reverse_bits[pdcolor->colors.colored.plane_mask] >> 4));
+ ((pdcolor->colors.colored.c_base[0] << 3) |
+ (pdcolor->colors.colored.c_base[1] << 2) |
+ (pdcolor->colors.colored.c_base[2] << 1) |
+ (pdcolor->colors.colored.c_base[3]) |
+ (byte_reverse_bits[pdcolor->colors.colored.plane_mask] >> 4));
}
/*
@@ -83,15 +83,15 @@ cmd_slow_rop(gx_device *dev, gs_logical_operation_t lop,
gs_rop3_t rop = lop_rop(lop);
if (pdcolor != 0 && gx_dc_is_pure(pdcolor)) {
- gx_color_index color = gx_dc_pure_color(pdcolor);
+ gx_color_index color = gx_dc_pure_color(pdcolor);
- if (color == gx_device_black(dev))
- rop = rop3_know_T_0(rop);
- else if (color == gx_device_white(dev))
- rop = rop3_know_T_1(rop);
+ if (color == gx_device_black(dev))
+ rop = rop3_know_T_0(rop);
+ else if (color == gx_device_white(dev))
+ rop = rop3_know_T_1(rop);
}
return !(rop == rop3_0 || rop == rop3_1 ||
- rop == rop3_S || rop == rop3_T);
+ rop == rop3_S || rop == rop3_T);
}
/* Write out the color for filling, stroking, or masking. */
@@ -100,7 +100,7 @@ cmd_slow_rop(gx_device *dev, gs_logical_operation_t lop,
/* If the pattern color is big, it can write to "all" bands. */
int
cmd_put_drawing_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_drawing_color * pdcolor, cmd_rects_enum_t *pre)
+ const gx_drawing_color * pdcolor, cmd_rects_enum_t *pre)
{
const gx_device_halftone * pdht = pdcolor->type->get_dev_halftone(pdcolor);
int code, di;
@@ -135,11 +135,11 @@ cmd_put_drawing_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
* length of serialized device color (enc_u_sizew(dc_size))
* the serialized device color itself (dc_size)
*/
- di = gx_get_dc_type_index(pdcolor);
+ di = gx_get_dc_type_index(pdcolor);
code = pdcolor->type->write( pdcolor,
psdc,
(gx_device *)cldev,
- 0,
+ 0,
0,
&dc_size );
@@ -149,19 +149,19 @@ cmd_put_drawing_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
else if (code < 0 && code != gs_error_rangecheck)
return code;
if (!all_bands && dc_size * pre->nbands > 1024*1024 /* arbitrary */)
- all_bands = true;
+ all_bands = true;
is_pattern = gx_dc_is_pattern1_color(pdcolor);
if (is_pattern)
- pattern_id = gs_dc_get_pattern_id(pdcolor);
+ pattern_id = gs_dc_get_pattern_id(pdcolor);
if (all_bands) {
- gx_clist_state * pcls1;
-
- for (pcls1 = cldev->states; pcls1 < cldev->states + cldev->nbands; pcls1++) {
- if (pcls1->pattern_id == pattern_id) {
- pcls->pattern_id = gs_no_id; /* Force writing entire pattern. */
- break;
- }
- }
+ gx_clist_state * pcls1;
+
+ for (pcls1 = cldev->states; pcls1 < cldev->states + cldev->nbands; pcls1++) {
+ if (pcls1->pattern_id == pattern_id) {
+ pcls->pattern_id = gs_no_id; /* Force writing entire pattern. */
+ break;
+ }
+ }
}
left = dc_size;
@@ -169,96 +169,96 @@ cmd_put_drawing_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
if ( pdcolor->type->get_phase(pdcolor, &color_phase) &&
(color_phase.x != pcls->tile_phase.x ||
color_phase.y != pcls->tile_phase.y || all_bands) &&
- (code = cmd_set_tile_phase_generic( cldev,
+ (code = cmd_set_tile_phase_generic( cldev,
pcls,
color_phase.x,
color_phase.y, all_bands)) < 0 )
return code;
if (is_pattern) {
- pattern_id = gs_dc_get_pattern_id(pdcolor);
-
- if (pattern_id != gs_no_id && pcls->pattern_id == pattern_id) {
- /* The pattern is known, write its id only.
- Note that gx_dc_pattern_write must process this case especially. */
- /* Note that id is gs_no_id when the pattern supplies an empty tile.
- In this case the full serialized pattern is shorter (left == 0),
- so go with it. */
- left = sizeof(pattern_id);
- }
+ pattern_id = gs_dc_get_pattern_id(pdcolor);
+
+ if (pattern_id != gs_no_id && pcls->pattern_id == pattern_id) {
+ /* The pattern is known, write its id only.
+ Note that gx_dc_pattern_write must process this case especially. */
+ /* Note that id is gs_no_id when the pattern supplies an empty tile.
+ In this case the full serialized pattern is shorter (left == 0),
+ so go with it. */
+ left = sizeof(pattern_id);
+ }
}
do {
- prefix_size = 2 + 1 + (offset > 0 ? enc_u_sizew(offset) : 0);
- req_size = left + prefix_size + enc_u_sizew(left);
- code = cmd_get_buffer_space(cldev, pcls, req_size);
- if (code < 0)
- return code;
- buffer_space = min(code, req_size);
- portion_size = buffer_space - prefix_size - enc_u_sizew(left);
- req_size_final = portion_size + prefix_size + enc_u_sizew(portion_size);
- if (req_size_final > buffer_space)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (all_bands)
- code = set_cmd_put_all_op(dp, cldev, cmd_opv_extend, req_size_final);
- else
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_extend, req_size_final);
- if (code < 0)
- return code;
- dp0 = dp;
- dp[1] = cmd_opv_ext_put_drawing_color;
- dp += 2;
- *dp++ = di | (offset > 0 ? 0x80 : 0);
- if (offset > 0)
- enc_u_putw(offset, dp);
- enc_u_putw(portion_size, dp);
- code = pdcolor->type->write( pdcolor,
- &pcls->sdc,
- (gx_device *)cldev,
- offset,
- dp,
- &portion_size);
- if (code < 0) {
- if (offset == 0)
- cldev->cnext = dp0;
- return code;
- }
- offset += portion_size;
- left -= portion_size;
+ prefix_size = 2 + 1 + (offset > 0 ? enc_u_sizew(offset) : 0);
+ req_size = left + prefix_size + enc_u_sizew(left);
+ code = cmd_get_buffer_space(cldev, pcls, req_size);
+ if (code < 0)
+ return code;
+ buffer_space = min(code, req_size);
+ portion_size = buffer_space - prefix_size - enc_u_sizew(left);
+ req_size_final = portion_size + prefix_size + enc_u_sizew(portion_size);
+ if (req_size_final > buffer_space)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (all_bands)
+ code = set_cmd_put_all_op(dp, cldev, cmd_opv_extend, req_size_final);
+ else
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_extend, req_size_final);
+ if (code < 0)
+ return code;
+ dp0 = dp;
+ dp[1] = cmd_opv_ext_put_drawing_color;
+ dp += 2;
+ *dp++ = di | (offset > 0 ? 0x80 : 0);
+ if (offset > 0)
+ enc_u_putw(offset, dp);
+ enc_u_putw(portion_size, dp);
+ code = pdcolor->type->write( pdcolor,
+ &pcls->sdc,
+ (gx_device *)cldev,
+ offset,
+ dp,
+ &portion_size);
+ if (code < 0) {
+ if (offset == 0)
+ cldev->cnext = dp0;
+ return code;
+ }
+ offset += portion_size;
+ left -= portion_size;
} while (left);
/* should properly calculate colors_used, but for now just punt */
pcls->colors_used.or = ((gx_color_index)1 << cldev->clist_color_info.depth) - 1;
- /* Here we can't know whether a pattern paints colors besides
+ /* Here we can't know whether a pattern paints colors besides
black and white, so assume that it does.
todo: provide this info with a pattern tile. */
- pcls->band_complexity.uses_color |= is_pattern ||
- (pdcolor->colors.pure != 0 && pdcolor->colors.pure != 0xffffff);
+ pcls->band_complexity.uses_color |= is_pattern ||
+ (pdcolor->colors.pure != 0 && pdcolor->colors.pure != 0xffffff);
/* record the color we have just serialized color */
pdcolor->type->save_dc(pdcolor, &pcls->sdc);
if (pattern_id) {
- /* Don't record empty tiles because they're not cached. */
- pcls->pattern_id = pattern_id;
+ /* Don't record empty tiles because they're not cached. */
+ pcls->pattern_id = pattern_id;
}
if (is_pattern) {
- /* HACK: since gx_dc_pattern_write identifies pattern by tile id,
- replace the client's pattern id with tile id in the saved color. */
- pcls->sdc.colors.pattern.id = pattern_id;
+ /* HACK: since gx_dc_pattern_write identifies pattern by tile id,
+ replace the client's pattern id with tile id in the saved color. */
+ pcls->sdc.colors.pattern.id = pattern_id;
}
if (is_pattern && all_bands) {
- /* Distribute the written pattern params to all bands.
- We know it is big, so it is not empty, so it has pattern_id and tile_phase.
- */
- gx_clist_state * pcls1;
-
- for (pcls1 = cldev->states; pcls1 < cldev->states + cldev->nbands; pcls1++) {
- pcls1->sdc = pcls->sdc;
- pcls1->pattern_id = pcls->pattern_id;
- pcls1->tile_phase.x = pcls->tile_phase.x;
- pcls1->tile_phase.y = pcls->tile_phase.y;
- }
+ /* Distribute the written pattern params to all bands.
+ We know it is big, so it is not empty, so it has pattern_id and tile_phase.
+ */
+ gx_clist_state * pcls1;
+
+ for (pcls1 = cldev->states; pcls1 < cldev->states + cldev->nbands; pcls1++) {
+ pcls1->sdc = pcls->sdc;
+ pcls1->pattern_id = pcls->pattern_id;
+ pcls1->tile_phase.x = pcls->tile_phase.x;
+ pcls1->tile_phase.y = pcls->tile_phase.y;
+ }
}
return code;
}
@@ -266,19 +266,18 @@ cmd_put_drawing_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* Compute the colors used by a drawing color. */
gx_color_index
cmd_drawing_colors_used(gx_device_clist_writer *cldev,
- const gx_drawing_color * pdcolor)
+ const gx_drawing_color * pdcolor)
{
if (gx_dc_is_pure(pdcolor))
- return gx_dc_pure_color(pdcolor);
+ return gx_dc_pure_color(pdcolor);
else if (gx_dc_is_binary_halftone(pdcolor))
- return gx_dc_binary_color0(pdcolor) | gx_dc_binary_color1(pdcolor);
+ return gx_dc_binary_color0(pdcolor) | gx_dc_binary_color1(pdcolor);
else if (gx_dc_is_colored_halftone(pdcolor))
- return colored_halftone_colors_used(cldev, pdcolor);
+ return colored_halftone_colors_used(cldev, pdcolor);
else
- return ((gx_color_index)1 << cldev->clist_color_info.depth) - 1;
+ return ((gx_color_index)1 << cldev->clist_color_info.depth) - 1;
}
-
/* Clear (a) specific 'known' flag(s) for all bands. */
/* We must do this whenever the value of a 'known' parameter changes. */
void
@@ -289,7 +288,7 @@ cmd_clear_known(gx_device_clist_writer * cldev, uint known)
int i;
for (i = cldev->nbands; --i >= 0; ++pcls)
- pcls->known &= unknown;
+ pcls->known &= unknown;
}
/* Check whether we need to change the clipping path in the device. */
@@ -297,12 +296,12 @@ bool
cmd_check_clip_path(gx_device_clist_writer * cldev, const gx_clip_path * pcpath)
{
if (pcpath == NULL)
- return false;
+ return false;
/* The clip path might have moved in memory, so even if the */
/* ids match, update the pointer. */
cldev->clip_path = pcpath;
if (pcpath->id == cldev->clip_path_id)
- return false;
+ return false;
cldev->clip_path_id = pcpath->id;
return true;
}
@@ -316,24 +315,24 @@ cmd_check_clip_path(gx_device_clist_writer * cldev, const gx_clip_path * pcpath)
shape_alpha_known | fill_adjust_known | alpha_known | clip_path_known)
static void
cmd_check_fill_known(gx_device_clist_writer *cdev, const gs_imager_state *pis,
- floatp flatness, const gs_fixed_point *padjust,
- const gx_clip_path *pcpath, uint *punknown)
+ floatp flatness, const gs_fixed_point *padjust,
+ const gx_clip_path *pcpath, uint *punknown)
{
/*
* stroke_adjust is not needed for fills, and none of these are needed
* if the path has no curves, but it's easier to update them all.
*/
if (state_neq(line_params.curve_join) || state_neq(accurate_curves) ||
- state_neq(stroke_adjust)
- ) {
- *punknown |= cj_ac_sa_known;
- state_update(line_params.curve_join);
- state_update(accurate_curves);
- state_update(stroke_adjust);
+ state_neq(stroke_adjust)
+ ) {
+ *punknown |= cj_ac_sa_known;
+ state_update(line_params.curve_join);
+ state_update(accurate_curves);
+ state_update(stroke_adjust);
}
if (cdev->imager_state.flatness != flatness) {
- *punknown |= flatness_known;
- cdev->imager_state.flatness = flatness;
+ *punknown |= flatness_known;
+ cdev->imager_state.flatness = flatness;
}
/*
* Note: overprint and overprint_mode are implemented via a compositor
@@ -342,34 +341,34 @@ cmd_check_fill_known(gx_device_clist_writer *cdev, const gs_imager_state *pis,
* has no effect.
*/
if (state_neq(overprint) || state_neq(overprint_mode) ||
- state_neq(blend_mode) || state_neq(text_knockout)
- ) {
- *punknown |= op_bm_tk_known;
- state_update(overprint);
- state_update(overprint_mode);
- state_update(blend_mode);
- state_update(text_knockout);
+ state_neq(blend_mode) || state_neq(text_knockout)
+ ) {
+ *punknown |= op_bm_tk_known;
+ state_update(overprint);
+ state_update(overprint_mode);
+ state_update(blend_mode);
+ state_update(text_knockout);
}
if (state_neq(opacity.alpha)) {
- *punknown |= opacity_alpha_known;
- state_update(opacity.alpha);
+ *punknown |= opacity_alpha_known;
+ state_update(opacity.alpha);
}
if (state_neq(shape.alpha)) {
- *punknown |= shape_alpha_known;
- state_update(shape.alpha);
+ *punknown |= shape_alpha_known;
+ state_update(shape.alpha);
}
if (cdev->imager_state.fill_adjust.x != padjust->x ||
- cdev->imager_state.fill_adjust.y != padjust->y
- ) {
- *punknown |= fill_adjust_known;
- cdev->imager_state.fill_adjust = *padjust;
+ cdev->imager_state.fill_adjust.y != padjust->y
+ ) {
+ *punknown |= fill_adjust_known;
+ cdev->imager_state.fill_adjust = *padjust;
}
if (cdev->imager_state.alpha != pis->alpha) {
- *punknown |= alpha_known;
- state_update(alpha);
+ *punknown |= alpha_known;
+ state_update(alpha);
}
if (cmd_check_clip_path(cdev, pcpath))
- *punknown |= clip_path_known;
+ *punknown |= clip_path_known;
}
/* Compute the written CTM length. */
@@ -411,7 +410,7 @@ cmd_write_ctm(const gs_matrix *m, byte *dp, int len)
/* Write out values of any unknown parameters. */
int
cmd_write_unknown(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- uint must_know)
+ uint must_know)
{
uint unknown = ~pcls->known & must_know;
uint misc2_unknown = unknown & misc2_all_known;
@@ -419,246 +418,246 @@ cmd_write_unknown(gx_device_clist_writer * cldev, gx_clist_state * pcls,
int code;
if (misc2_unknown) {
- byte buf[
- 1 + /* cap_join */
- 1 + /* cj_ac_sa */
- sizeof(float) + /* flatness */
- sizeof(float) + /* line width */
- sizeof(float) + /* miter limit */
- 1 + /* op_bm_tk */
- sizeof(float) * 2 + /* opacity/shape alpha */
- sizeof(cldev->imager_state.alpha)
- ];
- byte *bp = buf;
+ byte buf[
+ 1 + /* cap_join */
+ 1 + /* cj_ac_sa */
+ sizeof(float) + /* flatness */
+ sizeof(float) + /* line width */
+ sizeof(float) + /* miter limit */
+ 1 + /* op_bm_tk */
+ sizeof(float) * 2 + /* opacity/shape alpha */
+ sizeof(cldev->imager_state.alpha)
+ ];
+ byte *bp = buf;
/* Here we assume that all the caps are the same as start_cap */
- if (unknown & cap_join_known) {
- *bp++ = (cldev->imager_state.line_params.start_cap << 3) +
- cldev->imager_state.line_params.join;
- }
- if (unknown & cj_ac_sa_known) {
- *bp++ =
- ((cldev->imager_state.line_params.curve_join + 1) << 2) +
- (cldev->imager_state.accurate_curves ? 2 : 0) +
- (cldev->imager_state.stroke_adjust ? 1 : 0);
- }
- if (unknown & flatness_known) {
- memcpy(bp, &cldev->imager_state.flatness, sizeof(float));
- bp += sizeof(float);
- }
- if (unknown & line_width_known) {
- float width =
- gx_current_line_width(&cldev->imager_state.line_params);
-
- memcpy(bp, &width, sizeof(width));
- bp += sizeof(width);
- }
- if (unknown & miter_limit_known) {
- memcpy(bp, &cldev->imager_state.line_params.miter_limit,
- sizeof(float));
- bp += sizeof(float);
- }
- if (unknown & op_bm_tk_known) {
- *bp++ =
- ((int)cldev->imager_state.blend_mode << 3) +
- (cldev->imager_state.text_knockout << 2) +
- (cldev->imager_state.overprint_mode << 1) +
- cldev->imager_state.overprint;
- }
- if (unknown & opacity_alpha_known) {
- memcpy(bp, &cldev->imager_state.opacity.alpha, sizeof(float));
- bp += sizeof(float);
- }
- if (unknown & shape_alpha_known) {
- memcpy(bp, &cldev->imager_state.shape.alpha, sizeof(float));
- bp += sizeof(float);
- }
- if (unknown & alpha_known) {
- memcpy(bp, &cldev->imager_state.alpha,
- sizeof(cldev->imager_state.alpha));
- bp += sizeof(cldev->imager_state.alpha);
- }
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_misc2,
- 1 + cmd_sizew(misc2_unknown) + bp - buf);
- if (code < 0)
- return 0;
- memcpy(cmd_put_w(misc2_unknown, dp + 1), buf, bp - buf);
- pcls->known |= misc2_unknown;
+ if (unknown & cap_join_known) {
+ *bp++ = (cldev->imager_state.line_params.start_cap << 3) +
+ cldev->imager_state.line_params.join;
+ }
+ if (unknown & cj_ac_sa_known) {
+ *bp++ =
+ ((cldev->imager_state.line_params.curve_join + 1) << 2) +
+ (cldev->imager_state.accurate_curves ? 2 : 0) +
+ (cldev->imager_state.stroke_adjust ? 1 : 0);
+ }
+ if (unknown & flatness_known) {
+ memcpy(bp, &cldev->imager_state.flatness, sizeof(float));
+ bp += sizeof(float);
+ }
+ if (unknown & line_width_known) {
+ float width =
+ gx_current_line_width(&cldev->imager_state.line_params);
+
+ memcpy(bp, &width, sizeof(width));
+ bp += sizeof(width);
+ }
+ if (unknown & miter_limit_known) {
+ memcpy(bp, &cldev->imager_state.line_params.miter_limit,
+ sizeof(float));
+ bp += sizeof(float);
+ }
+ if (unknown & op_bm_tk_known) {
+ *bp++ =
+ ((int)cldev->imager_state.blend_mode << 3) +
+ (cldev->imager_state.text_knockout << 2) +
+ (cldev->imager_state.overprint_mode << 1) +
+ cldev->imager_state.overprint;
+ }
+ if (unknown & opacity_alpha_known) {
+ memcpy(bp, &cldev->imager_state.opacity.alpha, sizeof(float));
+ bp += sizeof(float);
+ }
+ if (unknown & shape_alpha_known) {
+ memcpy(bp, &cldev->imager_state.shape.alpha, sizeof(float));
+ bp += sizeof(float);
+ }
+ if (unknown & alpha_known) {
+ memcpy(bp, &cldev->imager_state.alpha,
+ sizeof(cldev->imager_state.alpha));
+ bp += sizeof(cldev->imager_state.alpha);
+ }
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_misc2,
+ 1 + cmd_sizew(misc2_unknown) + bp - buf);
+ if (code < 0)
+ return 0;
+ memcpy(cmd_put_w(misc2_unknown, dp + 1), buf, bp - buf);
+ pcls->known |= misc2_unknown;
}
if (unknown & fill_adjust_known) {
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_fill_adjust,
- 1 + sizeof(fixed) * 2);
- if (code < 0)
- return code;
- memcpy(dp + 1, &cldev->imager_state.fill_adjust.x, sizeof(fixed));
- memcpy(dp + 1 + sizeof(fixed), &cldev->imager_state.fill_adjust.y, sizeof(fixed));
- pcls->known |= fill_adjust_known;
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_fill_adjust,
+ 1 + sizeof(fixed) * 2);
+ if (code < 0)
+ return code;
+ memcpy(dp + 1, &cldev->imager_state.fill_adjust.x, sizeof(fixed));
+ memcpy(dp + 1 + sizeof(fixed), &cldev->imager_state.fill_adjust.y, sizeof(fixed));
+ pcls->known |= fill_adjust_known;
}
if (unknown & ctm_known) {
- int len = cmd_write_ctm_return_length(cldev, &ctm_only(&cldev->imager_state));
-
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_ctm, len + 1);
- if (code < 0)
- return code;
- code = cmd_write_ctm(&ctm_only(&cldev->imager_state), dp, len);
- if (code < 0)
- return code;
- pcls->known |= ctm_known;
+ int len = cmd_write_ctm_return_length(cldev, &ctm_only(&cldev->imager_state));
+
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_ctm, len + 1);
+ if (code < 0)
+ return code;
+ code = cmd_write_ctm(&ctm_only(&cldev->imager_state), dp, len);
+ if (code < 0)
+ return code;
+ pcls->known |= ctm_known;
}
if (unknown & dash_known) {
- int n = cldev->imager_state.line_params.dash.pattern_size;
-
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_dash,
- 2 + (n + 2) * sizeof(float));
- if (code < 0)
- return code;
- dp[1] = n + (cldev->imager_state.line_params.dash.adapt ? 0x80 : 0) +
- (cldev->imager_state.line_params.dot_length_absolute ? 0x40 : 0);
- memcpy(dp + 2, &cldev->imager_state.line_params.dot_length,
- sizeof(float));
- memcpy(dp + 2 + sizeof(float),
- &cldev->imager_state.line_params.dash.offset,
- sizeof(float));
- if (n != 0)
- memcpy(dp + 2 + sizeof(float) * 2,
- cldev->dash_pattern, n * sizeof(float));
- pcls->known |= dash_known;
+ int n = cldev->imager_state.line_params.dash.pattern_size;
+
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_dash,
+ 2 + (n + 2) * sizeof(float));
+ if (code < 0)
+ return code;
+ dp[1] = n + (cldev->imager_state.line_params.dash.adapt ? 0x80 : 0) +
+ (cldev->imager_state.line_params.dot_length_absolute ? 0x40 : 0);
+ memcpy(dp + 2, &cldev->imager_state.line_params.dot_length,
+ sizeof(float));
+ memcpy(dp + 2 + sizeof(float),
+ &cldev->imager_state.line_params.dash.offset,
+ sizeof(float));
+ if (n != 0)
+ memcpy(dp + 2 + sizeof(float) * 2,
+ cldev->dash_pattern, n * sizeof(float));
+ pcls->known |= dash_known;
}
if (unknown & clip_path_known) {
- /*
- * We can write out the clipping path either as rectangles
- * or as a real (filled) path.
- */
- const gx_clip_path *pcpath = cldev->clip_path;
- int band_height = cldev->page_band_height;
- int ymin = (pcls - cldev->states) * band_height;
- int ymax = min(ymin + band_height, cldev->height);
- gs_fixed_rect box;
- bool punt_to_outer_box = false;
- int code;
-
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_begin_clip, 1);
- if (code < 0)
- return code;
- if (pcpath->path_valid) {
- if (gx_path_is_rectangle(&pcpath->path, &box) &&
- fixed_is_int(box.p.x | box.p.y | box.q.x | box.q.y)
- ) {
- /* Write the path as a rectangle. */
- code = cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
- fixed2int_var(box.p.x),
- fixed2int_var(box.p.y),
- fixed2int(box.q.x - box.p.x),
- fixed2int(box.q.y - box.p.y));
- } else if ( !(cldev->disable_mask & clist_disable_complex_clip) ) {
- /* Write the path. */
- code = cmd_put_path(cldev, pcls, &pcpath->path,
- int2fixed(ymin - 1),
- int2fixed(ymax + 1),
- (byte)(pcpath->rule == gx_rule_even_odd ?
- cmd_opv_eofill : cmd_opv_fill),
- true, sn_not_first);
- } else {
- /* Complex paths disabled: write outer box as clip */
- punt_to_outer_box = true;
- }
- } else { /* Write out the rectangles. */
- const gx_clip_list *list = gx_cpath_list(pcpath);
- const gx_clip_rect *prect = list->head;
-
- if (prect == 0)
- prect = &list->single;
- else if (cldev->disable_mask & clist_disable_complex_clip)
- punt_to_outer_box = true;
- if (!punt_to_outer_box) {
- for (; prect != 0 && code >= 0; prect = prect->next)
- if (prect->xmax > prect->xmin &&
- prect->ymin < ymax && prect->ymax > ymin
- ) {
- code =
- cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
- prect->xmin, prect->ymin,
- prect->xmax - prect->xmin,
- prect->ymax - prect->ymin);
- }
- }
- }
- if (punt_to_outer_box) {
- /* Clip is complex, but disabled. Write out the outer box */
- gs_fixed_rect box;
-
- gx_cpath_outer_box(pcpath, &box);
- box.p.x = fixed_floor(box.p.x);
- box.p.y = fixed_floor(box.p.y);
- code = cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
- fixed2int_var(box.p.x),
- fixed2int_var(box.p.y),
- fixed2int_ceiling(box.q.x - box.p.x),
- fixed2int_ceiling(box.q.y - box.p.y));
- }
- {
- int end_code =
- set_cmd_put_op(dp, cldev, pcls, cmd_opv_end_clip, 1);
-
- if (code >= 0)
- code = end_code; /* take the first failure seen */
- if (end_code < 0 && cldev->error_is_retryable) {
- /*
- * end_clip has to work despite lo-mem to maintain consistency.
- * This isn't error recovery, but just to prevent dangling
- * cmd_opv_begin_clip's.
- */
- ++cldev->ignore_lo_mem_warnings;
- end_code =
- set_cmd_put_op(dp, cldev, pcls, cmd_opv_end_clip, 1);
- --cldev->ignore_lo_mem_warnings;
- }
- }
- if (code < 0)
- return code;
- pcls->clip_enabled = 1;
- pcls->known |= clip_path_known;
+ /*
+ * We can write out the clipping path either as rectangles
+ * or as a real (filled) path.
+ */
+ const gx_clip_path *pcpath = cldev->clip_path;
+ int band_height = cldev->page_band_height;
+ int ymin = (pcls - cldev->states) * band_height;
+ int ymax = min(ymin + band_height, cldev->height);
+ gs_fixed_rect box;
+ bool punt_to_outer_box = false;
+ int code;
+
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_begin_clip, 1);
+ if (code < 0)
+ return code;
+ if (pcpath->path_valid) {
+ if (gx_path_is_rectangle(&pcpath->path, &box) &&
+ fixed_is_int(box.p.x | box.p.y | box.q.x | box.q.y)
+ ) {
+ /* Write the path as a rectangle. */
+ code = cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
+ fixed2int_var(box.p.x),
+ fixed2int_var(box.p.y),
+ fixed2int(box.q.x - box.p.x),
+ fixed2int(box.q.y - box.p.y));
+ } else if ( !(cldev->disable_mask & clist_disable_complex_clip) ) {
+ /* Write the path. */
+ code = cmd_put_path(cldev, pcls, &pcpath->path,
+ int2fixed(ymin - 1),
+ int2fixed(ymax + 1),
+ (byte)(pcpath->rule == gx_rule_even_odd ?
+ cmd_opv_eofill : cmd_opv_fill),
+ true, sn_not_first);
+ } else {
+ /* Complex paths disabled: write outer box as clip */
+ punt_to_outer_box = true;
+ }
+ } else { /* Write out the rectangles. */
+ const gx_clip_list *list = gx_cpath_list(pcpath);
+ const gx_clip_rect *prect = list->head;
+
+ if (prect == 0)
+ prect = &list->single;
+ else if (cldev->disable_mask & clist_disable_complex_clip)
+ punt_to_outer_box = true;
+ if (!punt_to_outer_box) {
+ for (; prect != 0 && code >= 0; prect = prect->next)
+ if (prect->xmax > prect->xmin &&
+ prect->ymin < ymax && prect->ymax > ymin
+ ) {
+ code =
+ cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
+ prect->xmin, prect->ymin,
+ prect->xmax - prect->xmin,
+ prect->ymax - prect->ymin);
+ }
+ }
+ }
+ if (punt_to_outer_box) {
+ /* Clip is complex, but disabled. Write out the outer box */
+ gs_fixed_rect box;
+
+ gx_cpath_outer_box(pcpath, &box);
+ box.p.x = fixed_floor(box.p.x);
+ box.p.y = fixed_floor(box.p.y);
+ code = cmd_write_rect_cmd(cldev, pcls, cmd_op_fill_rect,
+ fixed2int_var(box.p.x),
+ fixed2int_var(box.p.y),
+ fixed2int_ceiling(box.q.x - box.p.x),
+ fixed2int_ceiling(box.q.y - box.p.y));
+ }
+ {
+ int end_code =
+ set_cmd_put_op(dp, cldev, pcls, cmd_opv_end_clip, 1);
+
+ if (code >= 0)
+ code = end_code; /* take the first failure seen */
+ if (end_code < 0 && cldev->error_is_retryable) {
+ /*
+ * end_clip has to work despite lo-mem to maintain consistency.
+ * This isn't error recovery, but just to prevent dangling
+ * cmd_opv_begin_clip's.
+ */
+ ++cldev->ignore_lo_mem_warnings;
+ end_code =
+ set_cmd_put_op(dp, cldev, pcls, cmd_opv_end_clip, 1);
+ --cldev->ignore_lo_mem_warnings;
+ }
+ }
+ if (code < 0)
+ return code;
+ pcls->clip_enabled = 1;
+ pcls->known |= clip_path_known;
}
if (unknown & color_space_known) {
- byte *dp;
-
- if (cldev->color_space.byte1 & 8) { /* indexed */
- const gs_color_space *pcs = cldev->color_space.space;
- int hival = pcs->params.indexed.hival;
- uint num_values = (hival + 1) *
- gs_color_space_num_components(pcs->base_space);
- bool use_proc = cldev->color_space.byte1 & 4;
- const void *map_data;
- uint map_size;
-
- if (use_proc) {
- map_data = pcs->params.indexed.lookup.map->values;
- map_size = num_values *
- sizeof(pcs->params.indexed.lookup.map->values[0]);
- } else {
- map_data = pcs->params.indexed.lookup.table.data;
- map_size = num_values;
- }
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_color_space,
- 2 + cmd_sizew(hival) + map_size +
+ byte *dp;
+
+ if (cldev->color_space.byte1 & 8) { /* indexed */
+ const gs_color_space *pcs = cldev->color_space.space;
+ int hival = pcs->params.indexed.hival;
+ uint num_values = (hival + 1) *
+ gs_color_space_num_components(pcs->base_space);
+ bool use_proc = cldev->color_space.byte1 & 4;
+ const void *map_data;
+ uint map_size;
+
+ if (use_proc) {
+ map_data = pcs->params.indexed.lookup.map->values;
+ map_size = num_values *
+ sizeof(pcs->params.indexed.lookup.map->values[0]);
+ } else {
+ map_data = pcs->params.indexed.lookup.table.data;
+ map_size = num_values;
+ }
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_color_space,
+ 2 + cmd_sizew(hival) + map_size +
sizeof(clist_icc_color_t));
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
/* Save the ICC information */
memcpy(dp + 2, &(cldev->color_space.icc_info),
sizeof(clist_icc_color_t));
- memcpy(cmd_put_w(hival, dp + 2 +
+ memcpy(cmd_put_w(hival, dp + 2 +
sizeof(clist_icc_color_t)), map_data, map_size);
- } else {
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_color_space,
+ } else {
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_color_space,
2 + sizeof(clist_icc_color_t));
memcpy(dp + 2, &(cldev->color_space.icc_info),
sizeof(clist_icc_color_t));
- if (code < 0)
- return code;
- }
- dp[1] = cldev->color_space.byte1;
- pcls->known |= color_space_known;
+ if (code < 0)
+ return code;
+ }
+ dp[1] = cldev->color_space.byte1;
+ pcls->known |= color_space_known;
}
/****** HANDLE masks ******/
return 0;
@@ -668,17 +667,17 @@ cmd_write_unknown(gx_device_clist_writer * cldev, gx_clist_state * pcls,
int
clist_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_fill_params * params, const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ const gx_fill_params * params, const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
uint unknown = 0;
int ry, rheight, y0, y1;
gs_logical_operation_t lop = pis->log_op;
byte op = (byte)
- (params->rule == gx_rule_even_odd ?
- cmd_opv_eofill : cmd_opv_fill);
+ (params->rule == gx_rule_even_odd ?
+ cmd_opv_eofill : cmd_opv_fill);
gs_fixed_point adjust;
bool slow_rop = cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor);
cmd_rects_enum_t re;
@@ -686,120 +685,120 @@ clist_fill_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
adjust = params->adjust;
{
- gs_fixed_rect bbox;
-
- if (ppath != NULL)
- gx_path_bbox(ppath, &bbox);
- else {
- /* gx_default_fill_path passes the clip path for shfill. */
- gx_cpath_outer_box(pcpath, &bbox);
- }
- ry = fixed2int(bbox.p.y) - 1;
- rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
- crop_fill_y(cdev, ry, rheight);
- if (rheight <= 0)
- return 0;
+ gs_fixed_rect bbox;
+
+ if (ppath != NULL)
+ gx_path_bbox(ppath, &bbox);
+ else {
+ /* gx_default_fill_path passes the clip path for shfill. */
+ gx_cpath_outer_box(pcpath, &bbox);
+ }
+ ry = fixed2int(bbox.p.y) - 1;
+ rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
+ crop_fill_y(cdev, ry, rheight);
+ if (rheight <= 0)
+ return 0;
}
if ( (cdev->disable_mask & clist_disable_fill_path) ||
- gs_debug_c(',')
- ) {
- /* Disable path-based banding. */
- return gx_default_fill_path(dev, pis, ppath, params, pdcolor,
- pcpath);
+ gs_debug_c(',')
+ ) {
+ /* Disable path-based banding. */
+ return gx_default_fill_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
}
if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor)) {
- /* Here we need to intersect *ppath, *pcpath and shading bbox.
- Call the default implementation, which has a special
- branch for processing a shading fill with the clip writer device.
- It will call us back with pdcolor=NULL for passing
- the intersected clipping path,
- and then will decompose the shading into trapezoids.
- See comment below about pdcolor == NULL.
- */
- cdev->cropping_saved = false;
- code = gx_default_fill_path(dev, pis, ppath, params, pdcolor, pcpath);
- if (cdev->cropping_saved) {
- cdev->cropping_min = cdev->save_cropping_min;
- cdev->cropping_max = cdev->save_cropping_max;
- if_debug2('v', "[v] clist_fill_path: restore cropping_min=%d croping_max=%d\n",
- cdev->save_cropping_min, cdev->save_cropping_max);
- }
- return code;
+ /* Here we need to intersect *ppath, *pcpath and shading bbox.
+ Call the default implementation, which has a special
+ branch for processing a shading fill with the clip writer device.
+ It will call us back with pdcolor=NULL for passing
+ the intersected clipping path,
+ and then will decompose the shading into trapezoids.
+ See comment below about pdcolor == NULL.
+ */
+ cdev->cropping_saved = false;
+ code = gx_default_fill_path(dev, pis, ppath, params, pdcolor, pcpath);
+ if (cdev->cropping_saved) {
+ cdev->cropping_min = cdev->save_cropping_min;
+ cdev->cropping_max = cdev->save_cropping_max;
+ if_debug2('v', "[v] clist_fill_path: restore cropping_min=%d croping_max=%d\n",
+ cdev->save_cropping_min, cdev->save_cropping_max);
+ }
+ return code;
}
y0 = ry;
y1 = ry + rheight;
cmd_check_fill_known(cdev, pis, params->flatness, &adjust, pcpath,
- &unknown);
+ &unknown);
if (unknown)
- cmd_clear_known(cdev, unknown);
+ cmd_clear_known(cdev, unknown);
if (cdev->permanent_error < 0)
- return (cdev->permanent_error);
+ return (cdev->permanent_error);
if (pdcolor == NULL) {
- /* See comment above about pattern2_color.
- Put the clipping path only.
- The graphics library will call us again with subdividing
- the shading into trapezoids and rectangles.
- Narrow cropping_min, croping_max for such calls. */
- cdev->cropping_saved = true;
- cdev->save_cropping_min = cdev->cropping_min;
- cdev->save_cropping_max = cdev->cropping_max;
- cdev->cropping_min = max(ry, cdev->cropping_min);
- cdev->cropping_max = min(ry + rheight, cdev->cropping_max);
- if_debug2('v', "[v] clist_fill_path: narrow cropping_min=%d croping_max=%d\n",
- cdev->save_cropping_min, cdev->save_cropping_max);
- RECT_ENUM_INIT(re, ry, rheight);
- do {
- RECT_STEP_INIT(re);
- if (pcpath != NULL) {
- code = cmd_do_write_unknown(cdev, re.pcls, clip_path_known);
- if (code < 0)
- return code;
- }
- code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL);
- if (code < 0)
- return code;
- re.y += re.height;
- } while (re.y < re.yend);
+ /* See comment above about pattern2_color.
+ Put the clipping path only.
+ The graphics library will call us again with subdividing
+ the shading into trapezoids and rectangles.
+ Narrow cropping_min, croping_max for such calls. */
+ cdev->cropping_saved = true;
+ cdev->save_cropping_min = cdev->cropping_min;
+ cdev->save_cropping_max = cdev->cropping_max;
+ cdev->cropping_min = max(ry, cdev->cropping_min);
+ cdev->cropping_max = min(ry + rheight, cdev->cropping_max);
+ if_debug2('v', "[v] clist_fill_path: narrow cropping_min=%d croping_max=%d\n",
+ cdev->save_cropping_min, cdev->save_cropping_max);
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ RECT_STEP_INIT(re);
+ if (pcpath != NULL) {
+ code = cmd_do_write_unknown(cdev, re.pcls, clip_path_known);
+ if (code < 0)
+ return code;
+ }
+ code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL);
+ if (code < 0)
+ return code;
+ re.y += re.height;
+ } while (re.y < re.yend);
} else {
- RECT_ENUM_INIT(re, ry, rheight);
- do {
- RECT_STEP_INIT(re);
- code = cmd_do_write_unknown(cdev, re.pcls, FILL_KNOWN);
- if (code < 0)
- return code;
- if ((code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
- (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
- )
- return code;
- code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
- if (code == gs_error_unregistered)
- return code;
- if (code < 0) {
- /* Something went wrong, use the default implementation. */
- return gx_default_fill_path(dev, pis, ppath, params, pdcolor,
- pcpath);
- }
- re.pcls->colors_used.slow_rop |= slow_rop;
- code = cmd_put_path(cdev, re.pcls, ppath,
- int2fixed(max(re.y - 1, y0)),
- int2fixed(min(re.y + re.height + 1, y1)),
- op,
- true, sn_none /* fill doesn't need the notes */ );
- if (code < 0)
- return code;
- re.y += re.height;
- } while (re.y < re.yend);
+ RECT_ENUM_INIT(re, ry, rheight);
+ do {
+ RECT_STEP_INIT(re);
+ code = cmd_do_write_unknown(cdev, re.pcls, FILL_KNOWN);
+ if (code < 0)
+ return code;
+ if ((code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
+ (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
+ )
+ return code;
+ code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
+ if (code == gs_error_unregistered)
+ return code;
+ if (code < 0) {
+ /* Something went wrong, use the default implementation. */
+ return gx_default_fill_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
+ }
+ re.pcls->colors_used.slow_rop |= slow_rop;
+ code = cmd_put_path(cdev, re.pcls, ppath,
+ int2fixed(max(re.y - 1, y0)),
+ int2fixed(min(re.y + re.height + 1, y1)),
+ op,
+ true, sn_none /* fill doesn't need the notes */ );
+ if (code < 0)
+ return code;
+ re.y += re.height;
+ } while (re.y < re.yend);
}
return 0;
}
int
clist_stroke_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
- const gx_stroke_params * params,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+ const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int pattern_size = pis->line_params.dash.pattern_size;
uint unknown = 0;
gs_fixed_rect bbox;
@@ -811,139 +810,139 @@ clist_stroke_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
cmd_rects_enum_t re;
if ((cdev->disable_mask & clist_disable_stroke_path) ||
- gs_debug_c(',')
- ) {
- /* Disable path-based banding. */
- return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
- pcpath);
+ gs_debug_c(',')
+ ) {
+ /* Disable path-based banding. */
+ return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
}
gx_path_bbox(ppath, &bbox);
/* We must use the supplied imager state, not our saved one, */
/* for computing the stroke expansion. */
expansion_code = gx_stroke_path_expansion(pis, ppath, &expansion);
if (expansion_code < 0) {
- /* Expansion is too large: use the entire page. */
- adjust_y = 0;
- ry = 0;
- rheight = dev->height;
+ /* Expansion is too large: use the entire page. */
+ adjust_y = 0;
+ ry = 0;
+ rheight = dev->height;
} else {
- adjust_y = fixed2int_ceiling(expansion.y) + 1;
- ry = fixed2int(bbox.p.y) - adjust_y;
- rheight = fixed2int_ceiling(bbox.q.y) - ry + adjust_y;
- fit_fill_y(dev, ry, rheight);
- fit_fill_h(dev, ry, rheight);
- if (rheight <= 0)
- return 0;
+ adjust_y = fixed2int_ceiling(expansion.y) + 1;
+ ry = fixed2int(bbox.p.y) - adjust_y;
+ rheight = fixed2int_ceiling(bbox.q.y) - ry + adjust_y;
+ fit_fill_y(dev, ry, rheight);
+ fit_fill_h(dev, ry, rheight);
+ if (rheight <= 0)
+ return 0;
}
/* Check the dash pattern, since we bail out if */
/* the pattern is too large. */
if (cdev->imager_state.line_params.dash.pattern_size != pattern_size ||
- (pattern_size != 0 &&
- memcmp(cdev->dash_pattern, pis->line_params.dash.pattern,
- pattern_size * sizeof(float))) ||
- cdev->imager_state.line_params.dash.offset !=
- pis->line_params.dash.offset ||
- cdev->imager_state.line_params.dash.adapt !=
- pis->line_params.dash.adapt ||
- cdev->imager_state.line_params.dot_length !=
- pis->line_params.dot_length ||
- cdev->imager_state.line_params.dot_length_absolute !=
- pis->line_params.dot_length_absolute
+ (pattern_size != 0 &&
+ memcmp(cdev->dash_pattern, pis->line_params.dash.pattern,
+ pattern_size * sizeof(float))) ||
+ cdev->imager_state.line_params.dash.offset !=
+ pis->line_params.dash.offset ||
+ cdev->imager_state.line_params.dash.adapt !=
+ pis->line_params.dash.adapt ||
+ cdev->imager_state.line_params.dot_length !=
+ pis->line_params.dot_length ||
+ cdev->imager_state.line_params.dot_length_absolute !=
+ pis->line_params.dot_length_absolute
) {
- /* Bail out if the dash pattern is too long. */
- if (pattern_size > cmd_max_dash)
- return gx_default_stroke_path(dev, pis, ppath, params,
- pdcolor, pcpath);
- unknown |= dash_known;
- /*
- * Temporarily reset the dash pattern pointer for gx_set_dash,
- * but don't leave it set, since that would confuse the GC.
- */
- cdev->imager_state.line_params.dash.pattern = cdev->dash_pattern;
- gx_set_dash(&cdev->imager_state.line_params.dash,
- pis->line_params.dash.pattern,
- pis->line_params.dash.pattern_size,
- pis->line_params.dash.offset, NULL);
- cdev->imager_state.line_params.dash.pattern = 0;
- gx_set_dash_adapt(&cdev->imager_state.line_params.dash,
- pis->line_params.dash.adapt);
- gx_set_dot_length(&cdev->imager_state.line_params,
- pis->line_params.dot_length,
- pis->line_params.dot_length_absolute);
+ /* Bail out if the dash pattern is too long. */
+ if (pattern_size > cmd_max_dash)
+ return gx_default_stroke_path(dev, pis, ppath, params,
+ pdcolor, pcpath);
+ unknown |= dash_known;
+ /*
+ * Temporarily reset the dash pattern pointer for gx_set_dash,
+ * but don't leave it set, since that would confuse the GC.
+ */
+ cdev->imager_state.line_params.dash.pattern = cdev->dash_pattern;
+ gx_set_dash(&cdev->imager_state.line_params.dash,
+ pis->line_params.dash.pattern,
+ pis->line_params.dash.pattern_size,
+ pis->line_params.dash.offset, NULL);
+ cdev->imager_state.line_params.dash.pattern = 0;
+ gx_set_dash_adapt(&cdev->imager_state.line_params.dash,
+ pis->line_params.dash.adapt);
+ gx_set_dot_length(&cdev->imager_state.line_params,
+ pis->line_params.dot_length,
+ pis->line_params.dot_length_absolute);
}
/* Here we assume that all the caps are the same as start_cap */
if (state_neq(line_params.start_cap) || state_neq(line_params.join)) {
- unknown |= cap_join_known;
- state_update(line_params.start_cap);
- state_update(line_params.join);
+ unknown |= cap_join_known;
+ state_update(line_params.start_cap);
+ state_update(line_params.join);
}
cmd_check_fill_known(cdev, pis, params->flatness, &pis->fill_adjust,
- pcpath, &unknown);
+ pcpath, &unknown);
if (state_neq(line_params.half_width)) {
- unknown |= line_width_known;
- state_update(line_params.half_width);
+ unknown |= line_width_known;
+ state_update(line_params.half_width);
}
if (state_neq(line_params.miter_limit)) {
- unknown |= miter_limit_known;
- gx_set_miter_limit(&cdev->imager_state.line_params,
- pis->line_params.miter_limit);
+ unknown |= miter_limit_known;
+ gx_set_miter_limit(&cdev->imager_state.line_params,
+ pis->line_params.miter_limit);
}
if (state_neq(ctm.xx) || state_neq(ctm.xy) ||
- state_neq(ctm.yx) || state_neq(ctm.yy) ||
+ state_neq(ctm.yx) || state_neq(ctm.yy) ||
/* We don't actually need tx or ty, but we don't want to bother */
/* tracking them separately from the other coefficients. */
- state_neq(ctm.tx) || state_neq(ctm.ty)
- ) {
- unknown |= ctm_known;
- state_update(ctm);
+ state_neq(ctm.tx) || state_neq(ctm.ty)
+ ) {
+ unknown |= ctm_known;
+ state_update(ctm);
}
if (unknown)
- cmd_clear_known(cdev, unknown);
+ cmd_clear_known(cdev, unknown);
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- int code;
-
- RECT_STEP_INIT(re);
- if ((code = cmd_do_write_unknown(cdev, re.pcls, stroke_all_known)) < 0 ||
- (code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
- (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
- )
- return code;
- code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
- if (code == gs_error_unregistered)
- return code;
- if (code < 0) {
- /* Something went wrong, use the default implementation. */
- return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
- pcpath);
- }
- re.pcls->colors_used.slow_rop |= slow_rop;
- {
- fixed ymin, ymax;
-
- /*
- * If a dash pattern is active, we can't skip segments
- * outside the clipping region, because that would throw off
- * the pattern.
+ int code;
+
+ RECT_STEP_INIT(re);
+ if ((code = cmd_do_write_unknown(cdev, re.pcls, stroke_all_known)) < 0 ||
+ (code = cmd_do_enable_clip(cdev, re.pcls, pcpath != NULL)) < 0 ||
+ (code = cmd_update_lop(cdev, re.pcls, lop)) < 0
+ )
+ return code;
+ code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
+ if (code == gs_error_unregistered)
+ return code;
+ if (code < 0) {
+ /* Something went wrong, use the default implementation. */
+ return gx_default_stroke_path(dev, pis, ppath, params, pdcolor,
+ pcpath);
+ }
+ re.pcls->colors_used.slow_rop |= slow_rop;
+ {
+ fixed ymin, ymax;
+
+ /*
+ * If a dash pattern is active, we can't skip segments
+ * outside the clipping region, because that would throw off
+ * the pattern.
* Don't skip segments when expansion is unknown.
- */
+ */
if (pattern_size || expansion_code < 0 ) {
- ymin = min_fixed;
- ymax = max_fixed;
- } else {
- ymin = int2fixed(re.y - adjust_y);
- ymax = int2fixed(re.y + re.height + adjust_y);
- }
- code = cmd_put_path(cdev, re.pcls, ppath, ymin, ymax,
- cmd_opv_stroke,
- false, (segment_notes)~0);
- if (code < 0)
- return code;
- }
- re.y += re.height;
+ ymin = min_fixed;
+ ymax = max_fixed;
+ } else {
+ ymin = int2fixed(re.y - adjust_y);
+ ymax = int2fixed(re.y + re.height + adjust_y);
+ }
+ code = cmd_put_path(cdev, re.pcls, ppath, ymin, ymax,
+ cmd_opv_stroke,
+ false, (segment_notes)~0);
+ if (code < 0)
+ return code;
+ }
+ re.y += re.height;
} while (re.y < re.yend);
return 0;
}
@@ -957,52 +956,52 @@ clist_stroke_path(gx_device * dev, const gs_imager_state * pis, gx_path * ppath,
static int
clist_put_polyfill(gx_device *dev, fixed px, fixed py,
- const gs_fixed_point *points, int num_points,
- const gx_drawing_color *pdcolor, gs_logical_operation_t lop)
+ const gs_fixed_point *points, int num_points,
+ const gx_drawing_color *pdcolor, gs_logical_operation_t lop)
{
gx_path path;
gs_memory_t *mem = dev->memory;
int code;
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
gs_fixed_rect bbox;
int ry, rheight, y0, y1;
bool slow_rop = cmd_slow_rop(dev, lop_know_S_0(lop), pdcolor);
cmd_rects_enum_t re;
if (gs_debug_c(','))
- return -1; /* path-based banding is disabled */
+ return -1; /* path-based banding is disabled */
gx_path_init_local(&path, mem);
if ((code = gx_path_add_point(&path, px, py)) < 0 ||
- (code = gx_path_add_lines(&path, points, num_points)) < 0
- )
- goto out;
+ (code = gx_path_add_lines(&path, points, num_points)) < 0
+ )
+ goto out;
gx_path_bbox(&path, &bbox);
ry = fixed2int(bbox.p.y) - 1;
rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
fit_fill_y(dev, ry, rheight);
fit_fill_h(dev, ry, rheight);
if (rheight <= 0)
- return 0;
+ return 0;
y0 = ry;
y1 = ry + rheight;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- RECT_STEP_INIT(re);
- if ((code = cmd_update_lop(cdev, re.pcls, lop)) < 0 ||
- (code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re)) < 0)
- goto out;
- re.pcls->colors_used.slow_rop |= slow_rop;
- code = cmd_put_path(cdev, re.pcls, &path,
- int2fixed(max(re.y - 1, y0)),
- int2fixed(min(re.y + re.height + 1, y1)),
- cmd_opv_polyfill,
- true, sn_none /* fill doesn't need the notes */ );
- if (code < 0)
- goto out;
- re.y += re.height;
+ RECT_STEP_INIT(re);
+ if ((code = cmd_update_lop(cdev, re.pcls, lop)) < 0 ||
+ (code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re)) < 0)
+ goto out;
+ re.pcls->colors_used.slow_rop |= slow_rop;
+ code = cmd_put_path(cdev, re.pcls, &path,
+ int2fixed(max(re.y - 1, y0)),
+ int2fixed(min(re.y + re.height + 1, y1)),
+ cmd_opv_polyfill,
+ true, sn_none /* fill doesn't need the notes */ );
+ if (code < 0)
+ goto out;
+ re.y += re.height;
} while (re.y < re.yend);
out:
gx_path_free(&path, "clist_put_polyfill");
@@ -1011,34 +1010,34 @@ out:
int
clist_fill_parallelogram(gx_device *dev, fixed px, fixed py,
- fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color *pdcolor,
- gs_logical_operation_t lop)
+ fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color *pdcolor,
+ gs_logical_operation_t lop)
{
gs_fixed_point pts[3];
int code;
if (PARALLELOGRAM_IS_RECT(ax, ay, bx, by)) {
- gs_int_rect r;
+ gs_int_rect r;
- INT_RECT_FROM_PARALLELOGRAM(&r, px, py, ax, ay, bx, by);
- return gx_fill_rectangle_device_rop(r.p.x, r.p.y, r.q.x - r.p.x,
- r.q.y - r.p.y, pdcolor, dev, lop);
+ INT_RECT_FROM_PARALLELOGRAM(&r, px, py, ax, ay, bx, by);
+ return gx_fill_rectangle_device_rop(r.p.x, r.p.y, r.q.x - r.p.x,
+ r.q.y - r.p.y, pdcolor, dev, lop);
}
pts[0].x = px + ax, pts[0].y = py + ay;
pts[1].x = pts[0].x + bx, pts[1].y = pts[0].y + by;
pts[2].x = px + bx, pts[2].y = py + by;
code = clist_put_polyfill(dev, px, py, pts, 3, pdcolor, lop);
return (code >= 0 ? code :
- gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
- pdcolor, lop));
+ gx_default_fill_parallelogram(dev, px, py, ax, ay, bx, by,
+ pdcolor, lop));
}
int
clist_fill_triangle(gx_device *dev, fixed px, fixed py,
- fixed ax, fixed ay, fixed bx, fixed by,
- const gx_drawing_color *pdcolor,
- gs_logical_operation_t lop)
+ fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color *pdcolor,
+ gs_logical_operation_t lop)
{
gs_fixed_point pts[2];
int code;
@@ -1047,8 +1046,8 @@ clist_fill_triangle(gx_device *dev, fixed px, fixed py,
pts[1].x = px + bx, pts[1].y = py + by;
code = clist_put_polyfill(dev, px, py, pts, 2, pdcolor, lop);
return (code >= 0 ? code :
- gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
- pdcolor, lop));
+ gx_default_fill_triangle(dev, px, py, ax, ay, bx, by,
+ pdcolor, lop));
}
/* ------ Path utilities ------ */
@@ -1070,12 +1069,12 @@ cmd_segment_writer;
/* Put out a path segment command. */
static int
cmd_put_segment(cmd_segment_writer * psw, byte op,
- const fixed * operands, segment_notes notes)
+ const fixed * operands, segment_notes notes)
{
const fixed *optr = operands;
/* Fetch num_operands before possible command merging. */
static const byte op_num_operands[] = {
- cmd_segment_op_num_operands_values
+ cmd_segment_op_num_operands_values
};
int i = op_num_operands[op & 0xf];
/* One picky compiler complains if we initialize to psw->cmd - 1. */
@@ -1085,112 +1084,112 @@ cmd_put_segment(cmd_segment_writer * psw, byte op,
#ifdef DEBUG
if (gs_debug_c('L')) {
- int j;
+ int j;
- dlprintf2("[L] %s:%d:", cmd_sub_op_names[op >> 4][op & 0xf],
- (int)notes);
- for (j = 0; j < i; ++j)
- dprintf1(" %g", fixed2float(operands[j]));
- dputs("\n");
+ dlprintf2("[L] %s:%d:", cmd_sub_op_names[op >> 4][op & 0xf],
+ (int)notes);
+ for (j = 0; j < i; ++j)
+ dprintf1(" %g", fixed2float(operands[j]));
+ dputs("\n");
}
#endif
/* Merge or shorten commands if possible. */
if (op == cmd_opv_rlineto) {
- if (operands[0] == 0)
- op = cmd_opv_vlineto, optr = ++operands, i = 1;
- else if (operands[1] == 0)
- op = cmd_opv_hlineto, i = 1;
- else
- switch (*psw->dp) {
- case cmd_opv_rmoveto:
- psw->delta_first.x = operands[0];
- psw->delta_first.y = operands[1];
- op = cmd_opv_rmlineto;
- merge:cmd_uncount_op(*psw->dp, psw->len);
- cmd_shorten_op(psw->cldev, psw->pcls, psw->len); /* delete it */
- q += psw->len - 1;
- break;
- case cmd_opv_rmlineto:
- if (notes != psw->notes)
- break;
- op = cmd_opv_rm2lineto;
- goto merge;
- case cmd_opv_rm2lineto:
- if (notes != psw->notes)
- break;
- if (operands[0] == -psw->delta_first.x &&
- operands[1] == -psw->delta_first.y
- ) {
- cmd_uncount_op(cmd_opv_rm2lineto, psw->len);
- *psw->dp = cmd_count_op(cmd_opv_rm3lineto, psw->len);
- return 0;
- }
- break;
- default:
- ;
- }
+ if (operands[0] == 0)
+ op = cmd_opv_vlineto, optr = ++operands, i = 1;
+ else if (operands[1] == 0)
+ op = cmd_opv_hlineto, i = 1;
+ else
+ switch (*psw->dp) {
+ case cmd_opv_rmoveto:
+ psw->delta_first.x = operands[0];
+ psw->delta_first.y = operands[1];
+ op = cmd_opv_rmlineto;
+ merge:cmd_uncount_op(*psw->dp, psw->len);
+ cmd_shorten_op(psw->cldev, psw->pcls, psw->len); /* delete it */
+ q += psw->len - 1;
+ break;
+ case cmd_opv_rmlineto:
+ if (notes != psw->notes)
+ break;
+ op = cmd_opv_rm2lineto;
+ goto merge;
+ case cmd_opv_rm2lineto:
+ if (notes != psw->notes)
+ break;
+ if (operands[0] == -psw->delta_first.x &&
+ operands[1] == -psw->delta_first.y
+ ) {
+ cmd_uncount_op(cmd_opv_rm2lineto, psw->len);
+ *psw->dp = cmd_count_op(cmd_opv_rm3lineto, psw->len);
+ return 0;
+ }
+ break;
+ default:
+ ;
+ }
}
for (; --i >= 0; ++optr) {
- fixed d = *optr, d2;
-
- if (is_bits(d, _fixed_shift + 11) &&
- !(d & (float2fixed(0.25) - 1))
- ) {
- cmd_count_add1(stats_cmd_diffs[3]);
- d = ((d >> (_fixed_shift - 2)) & 0x1fff) + 0xc000;
- q += 2;
- } else if (is_bits(d, 19) && i > 0 && is_bits(d2 = optr[1], 19)) {
- cmd_count_add1(stats_cmd_diffs[0]);
- q[1] = (byte) ((d >> 13) & 0x3f);
- q[2] = (byte) (d >> 5);
- q[3] = (byte) ((d << 3) + ((d2 >> 16) & 7));
- q[4] = (byte) (d2 >> 8);
- q[5] = (byte) d2;
- q += 5;
- --i, ++optr;
- continue;
- } else if (is_bits(d, 22)) {
- cmd_count_add1(stats_cmd_diffs[1]);
- q[1] = (byte) (((d >> 16) & 0x3f) + 0x40);
- q += 3;
- } else if (is_bits(d, 30)) {
- cmd_count_add1(stats_cmd_diffs[2]);
- q[1] = (byte) (((d >> 24) & 0x3f) + 0x80);
- q[2] = (byte) (d >> 16);
- q += 4;
- } else {
- int b;
-
- cmd_count_add1(stats_cmd_diffs[4]);
- *++q = 0xe0;
- for (b = sizeof(fixed) - 1; b > 1; --b)
- *++q = (byte) (d >> (b * 8));
- q += 2;
- }
- q[-1] = (byte) (d >> 8);
- *q = (byte) d;
+ fixed d = *optr, d2;
+
+ if (is_bits(d, _fixed_shift + 11) &&
+ !(d & (float2fixed(0.25) - 1))
+ ) {
+ cmd_count_add1(stats_cmd_diffs[3]);
+ d = ((d >> (_fixed_shift - 2)) & 0x1fff) + 0xc000;
+ q += 2;
+ } else if (is_bits(d, 19) && i > 0 && is_bits(d2 = optr[1], 19)) {
+ cmd_count_add1(stats_cmd_diffs[0]);
+ q[1] = (byte) ((d >> 13) & 0x3f);
+ q[2] = (byte) (d >> 5);
+ q[3] = (byte) ((d << 3) + ((d2 >> 16) & 7));
+ q[4] = (byte) (d2 >> 8);
+ q[5] = (byte) d2;
+ q += 5;
+ --i, ++optr;
+ continue;
+ } else if (is_bits(d, 22)) {
+ cmd_count_add1(stats_cmd_diffs[1]);
+ q[1] = (byte) (((d >> 16) & 0x3f) + 0x40);
+ q += 3;
+ } else if (is_bits(d, 30)) {
+ cmd_count_add1(stats_cmd_diffs[2]);
+ q[1] = (byte) (((d >> 24) & 0x3f) + 0x80);
+ q[2] = (byte) (d >> 16);
+ q += 4;
+ } else {
+ int b;
+
+ cmd_count_add1(stats_cmd_diffs[4]);
+ *++q = 0xe0;
+ for (b = sizeof(fixed) - 1; b > 1; --b)
+ *++q = (byte) (d >> (b * 8));
+ q += 2;
+ }
+ q[-1] = (byte) (d >> 8);
+ *q = (byte) d;
}
if (notes != psw->notes) {
- byte *dp;
- int code =
- set_cmd_put_op(dp, psw->cldev, psw->pcls, cmd_opv_set_misc2, 3);
-
- if (code < 0)
- return code;
- dp[1] = segment_notes_known;
- dp[2] = notes;
- psw->notes = notes;
+ byte *dp;
+ int code =
+ set_cmd_put_op(dp, psw->cldev, psw->pcls, cmd_opv_set_misc2, 3);
+
+ if (code < 0)
+ return code;
+ dp[1] = segment_notes_known;
+ dp[2] = notes;
+ psw->notes = notes;
} {
- int len = q + 2 - psw->cmd;
- byte *dp;
- int code = set_cmd_put_op(dp, psw->cldev, psw->pcls, op, len);
-
- if (code < 0)
- return code;
- memcpy(dp + 1, psw->cmd, len - 1);
- psw->len = len;
- psw->dp = dp;
+ int len = q + 2 - psw->cmd;
+ byte *dp;
+ int code = set_cmd_put_op(dp, psw->cldev, psw->pcls, op, len);
+
+ if (code < 0)
+ return code;
+ memcpy(dp + 1, psw->cmd, len - 1);
+ psw->len = len;
+ psw->dp = dp;
}
return 0;
}
@@ -1206,8 +1205,8 @@ cmd_put_segment(cmd_segment_writer * psw, byte op,
*/
static int
cmd_put_path(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const gx_path * ppath, fixed ymin, fixed ymax, byte path_op,
- bool implicit_close, segment_notes keep_notes)
+ const gx_path * ppath, fixed ymin, fixed ymax, byte path_op,
+ bool implicit_close, segment_notes keep_notes)
{
gs_path_enum cenum;
cmd_segment_writer writer;
@@ -1273,13 +1272,13 @@ cmd_put_path(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* Information about the last emitted operation: */
int open = 0; /* -1 if last was moveto, 1 if line/curveto, */
- /* 0 if newpath/closepath */
+ /* 0 if newpath/closepath */
struct { fixed vs[6]; } prev;
- first.x = first.y = out.x = out.y = start.x = start.y = 0; /* Quiet gcc warning. */
+ first.x = first.y = out.x = out.y = start.x = start.y = 0; /* Quiet gcc warning. */
if_debug4('p', "[p]initial (%g,%g), clip [%g..%g)\n",
- fixed2float(px), fixed2float(py),
- fixed2float(ymin), fixed2float(ymax));
+ fixed2float(px), fixed2float(py),
+ fixed2float(ymin), fixed2float(ymax));
gx_path_enum_init(&cenum, ppath);
writer.cldev = cldev;
writer.pcls = pcls;
@@ -1288,7 +1287,7 @@ cmd_put_path(gx_device_clist_writer * cldev, gx_clist_state * pcls,
#define first_point() (writer.dp == &initial_op)
set_first_point();
for (;;) {
- fixed vs[6];
+ fixed vs[6];
#define A vs[0]
#define B vs[1]
@@ -1296,266 +1295,266 @@ cmd_put_path(gx_device_clist_writer * cldev, gx_clist_state * pcls,
#define D vs[3]
#define E vs[4]
#define F vs[5]
- int pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
- byte *dp;
- int code;
-
- switch (pe_op) {
- case 0:
- /* If the path is open and needs an implicit close, */
- /* do the close and then come here again. */
- if (open > 0 && implicit_close)
- goto close;
- /* All done. */
- pcls->rect.x = fixed2int_var(px);
- pcls->rect.y = fixed2int_var(py);
- if_debug2('p', "[p]final (%d,%d)\n",
- pcls->rect.x, pcls->rect.y);
- return set_cmd_put_op(dp, cldev, pcls, path_op, 1);
- case gs_pe_moveto:
- /* If the path is open and needs an implicit close, */
- /* do a closepath and then redo the moveto. */
- if (open > 0 && implicit_close) {
- gx_path_enum_backup(&cenum);
- goto close;
- }
- open = -1;
- start.x = A, start.y = B;
- start_skip = false;
- if ((start_side = side = which_side(B)) != 0) {
- out.x = A, out.y = B;
- if_debug3('p', "[p]skip moveto (%g,%g) side %d\n",
- fixed2float(out.x), fixed2float(out.y),
- side);
- continue;
- }
- C = A - px, D = B - py;
- first.x = px = A, first.y = py = B;
- code = cmd_put_rmoveto(&writer, &C);
- if_debug2('p', "[p]moveto (%g,%g)\n",
- fixed2float(px), fixed2float(py));
- break;
- case gs_pe_lineto:
- {
- int next_side = which_side(B);
- segment_notes notes =
- gx_path_enum_notes(&cenum) & keep_notes;
-
- if (next_side == side && side != 0) { /* Skip a line completely outside the clip region. */
- if (open < 0)
- start_skip = true;
- out.x = A, out.y = B;
- out_notes = notes;
- if_debug3('p', "[p]skip lineto (%g,%g) side %d\n",
- fixed2float(out.x), fixed2float(out.y),
- side);
- continue;
- }
- /* If we skipped any segments, put out a moveto/lineto. */
- if (side && (px != out.x || py != out.y || first_point())) {
- C = out.x - px, D = out.y - py;
- if (open < 0) {
- first = out;
- code = cmd_put_rmoveto(&writer, &C);
- } else
- code = cmd_put_rlineto(&writer, &C, out_notes);
- if (code < 0)
- return code;
- px = out.x, py = out.y;
- if_debug3('p', "[p]catchup %s (%g,%g) for line\n",
- (open < 0 ? "moveto" : "lineto"),
- fixed2float(px), fixed2float(py));
- }
- if ((side = next_side) != 0) { /* Note a vertex going outside the clip region. */
- out.x = A, out.y = B;
- }
- C = A - px, D = B - py;
- px = A, py = B;
- open = 1;
- code = cmd_put_rlineto(&writer, &C, notes);
- }
- if_debug3('p', "[p]lineto (%g,%g) side %d\n",
- fixed2float(px), fixed2float(py), side);
- break;
- case gs_pe_closepath:
+ int pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
+ byte *dp;
+ int code;
+
+ switch (pe_op) {
+ case 0:
+ /* If the path is open and needs an implicit close, */
+ /* do the close and then come here again. */
+ if (open > 0 && implicit_close)
+ goto close;
+ /* All done. */
+ pcls->rect.x = fixed2int_var(px);
+ pcls->rect.y = fixed2int_var(py);
+ if_debug2('p', "[p]final (%d,%d)\n",
+ pcls->rect.x, pcls->rect.y);
+ return set_cmd_put_op(dp, cldev, pcls, path_op, 1);
+ case gs_pe_moveto:
+ /* If the path is open and needs an implicit close, */
+ /* do a closepath and then redo the moveto. */
+ if (open > 0 && implicit_close) {
+ gx_path_enum_backup(&cenum);
+ goto close;
+ }
+ open = -1;
+ start.x = A, start.y = B;
+ start_skip = false;
+ if ((start_side = side = which_side(B)) != 0) {
+ out.x = A, out.y = B;
+ if_debug3('p', "[p]skip moveto (%g,%g) side %d\n",
+ fixed2float(out.x), fixed2float(out.y),
+ side);
+ continue;
+ }
+ C = A - px, D = B - py;
+ first.x = px = A, first.y = py = B;
+ code = cmd_put_rmoveto(&writer, &C);
+ if_debug2('p', "[p]moveto (%g,%g)\n",
+ fixed2float(px), fixed2float(py));
+ break;
+ case gs_pe_lineto:
+ {
+ int next_side = which_side(B);
+ segment_notes notes =
+ gx_path_enum_notes(&cenum) & keep_notes;
+
+ if (next_side == side && side != 0) { /* Skip a line completely outside the clip region. */
+ if (open < 0)
+ start_skip = true;
+ out.x = A, out.y = B;
+ out_notes = notes;
+ if_debug3('p', "[p]skip lineto (%g,%g) side %d\n",
+ fixed2float(out.x), fixed2float(out.y),
+ side);
+ continue;
+ }
+ /* If we skipped any segments, put out a moveto/lineto. */
+ if (side && (px != out.x || py != out.y || first_point())) {
+ C = out.x - px, D = out.y - py;
+ if (open < 0) {
+ first = out;
+ code = cmd_put_rmoveto(&writer, &C);
+ } else
+ code = cmd_put_rlineto(&writer, &C, out_notes);
+ if (code < 0)
+ return code;
+ px = out.x, py = out.y;
+ if_debug3('p', "[p]catchup %s (%g,%g) for line\n",
+ (open < 0 ? "moveto" : "lineto"),
+ fixed2float(px), fixed2float(py));
+ }
+ if ((side = next_side) != 0) { /* Note a vertex going outside the clip region. */
+ out.x = A, out.y = B;
+ }
+ C = A - px, D = B - py;
+ px = A, py = B;
+ open = 1;
+ code = cmd_put_rlineto(&writer, &C, notes);
+ }
+ if_debug3('p', "[p]lineto (%g,%g) side %d\n",
+ fixed2float(px), fixed2float(py), side);
+ break;
+ case gs_pe_closepath:
#ifdef DEBUG
- {
- gs_path_enum cpenum;
- gs_fixed_point cvs[3];
- int op;
-
- cpenum = cenum;
- switch (op = gx_path_enum_next(&cpenum, cvs)) {
- case 0:
- case gs_pe_moveto:
- break;
- default:
- lprintf1("closepath followed by %d, not end/moveto!\n",
- op);
- }
- }
+ {
+ gs_path_enum cpenum;
+ gs_fixed_point cvs[3];
+ int op;
+
+ cpenum = cenum;
+ switch (op = gx_path_enum_next(&cpenum, cvs)) {
+ case 0:
+ case gs_pe_moveto:
+ break;
+ default:
+ lprintf1("closepath followed by %d, not end/moveto!\n",
+ op);
+ }
+ }
#endif
- /* A closepath may require drawing an explicit line if */
- /* we skipped any segments at the beginning of the path. */
- close:if (side != start_side) { /* If we skipped any segments, put out a moveto/lineto. */
- if (side && (px != out.x || py != out.y || first_point())) {
- C = out.x - px, D = out.y - py;
- code = cmd_put_rlineto(&writer, &C, out_notes);
- if (code < 0)
- return code;
- px = out.x, py = out.y;
- if_debug2('p', "[p]catchup line (%g,%g) for close\n",
- fixed2float(px), fixed2float(py));
- }
- if (open > 0 && start_skip) { /* Draw the closing line back to the start. */
- C = start.x - px, D = start.y - py;
- code = cmd_put_rlineto(&writer, &C, sn_none);
- if (code < 0)
- return code;
- px = start.x, py = start.y;
- if_debug2('p', "[p]draw close to (%g,%g)\n",
- fixed2float(px), fixed2float(py));
- }
- }
- /*
- * We don't bother to update side because we know that the
- * next element after a closepath, if any, must be a moveto.
- * We must handle explicitly the possibility that the entire
- * subpath was skipped.
- */
- if (implicit_close || open <= 0) {
- /*
- * Force writing an explicit moveto if the next subpath
- * starts with a moveto to the same point where this one
- * ends.
- */
- set_first_point();
- /*
- * If implicit_close == true, we don't need an explicit closepath,
- * because the filling algorithm will close subpath automatically.
- * Otherwise, if open < 0, we have an empty closed path.
- * If side != 0, it is outside the band, so we can
- * safely skip it, because the band has been expanded
- * with line width.
- */
- if (side != 0) {
- open = 0;
- continue;
- }
- }
- open = 0;
- px = first.x, py = first.y;
- code = cmd_put_segment(&writer, cmd_opv_closepath, &A, sn_none);
- if_debug0('p', "[p]close\n");
- break;
- case gs_pe_curveto:
- {
- segment_notes notes =
- gx_path_enum_notes(&cenum) & keep_notes;
-
- {
- fixed bpy, bqy;
- int all_side, out_side;
-
- /* Compute the Y bounds for the clipping check. */
- if (B < D)
- bpy = B, bqy = D;
- else
- bpy = D, bqy = B;
- if (F < bpy)
- bpy = F;
- else if (F > bqy)
- bqy = F;
- all_side = (bqy < ymin ? -1 : bpy > ymax ? 1 : 0);
- if (all_side != 0) {
- if (all_side == side) { /* Skip a curve entirely outside the clip region. */
- if (open < 0)
- start_skip = true;
- out.x = E, out.y = F;
- out_notes = notes;
- if_debug3('p', "[p]skip curveto (%g,%g) side %d\n",
- fixed2float(out.x), fixed2float(out.y),
- side);
- continue;
- }
- out_side = all_side;
- } else
- out_side = which_side(F);
- /* If we skipped any segments, put out a moveto/lineto. */
- if (side && (px != out.x || py != out.y || first_point())) {
- fixed diff[2];
-
- diff[0] = out.x - px, diff[1] = out.y - py;
- if (open < 0) {
- first = out;
- code = cmd_put_rmoveto(&writer, diff);
- } else
- code = cmd_put_rlineto(&writer, diff, out_notes);
- if (code < 0)
- return code;
- px = out.x, py = out.y;
- if_debug3('p', "[p]catchup %s (%g,%g) for curve\n",
- (open < 0 ? "moveto" : "lineto"),
- fixed2float(px), fixed2float(py));
- }
- if ((side = out_side) != 0) { /* Note a vertex going outside the clip region. */
- out.x = E, out.y = F;
- }
- }
- {
- fixed nx = E, ny = F;
- const fixed *optr = vs;
- byte op;
-
- if_debug7('p', "[p]curveto (%g,%g; %g,%g; %g,%g) side %d\n",
- fixed2float(A), fixed2float(B),
- fixed2float(C), fixed2float(D),
- fixed2float(E), fixed2float(F), side);
- E -= C, F -= D;
- C -= A, D -= B;
- A -= px, B -= py;
- if (*writer.dp >= cmd_opv_min_curveto &&
- *writer.dp <= cmd_opv_max_curveto &&
- ((prev.A == 0 &&
- A == prev.E && C == prev.C && E == prev.A &&
- B == -prev.F && D == -prev.D && F == -prev.B) ||
- (prev.A != 0 &&
- A == -prev.E && C == -prev.C && E == -prev.A &&
- B == prev.F && D == prev.D && F == prev.B))
- )
- op = cmd_opv_scurveto;
- else if (B == 0 && E == 0) {
- B = A, E = F, optr++, op = cmd_opv_hvcurveto;
- if ((B ^ D) >= 0) {
- if (C == D && E == B)
- op = cmd_opv_hqcurveto;
- } else if (C == -D && E == -B)
- C = D, op = cmd_opv_hqcurveto;
- } else if (A == 0 && F == 0) {
- optr++, op = cmd_opv_vhcurveto;
- if ((B ^ C) >= 0) {
- if (D == C && E == B)
- op = cmd_opv_vqcurveto;
- } else if (D == -C && E == -B)
- op = cmd_opv_vqcurveto;
- } else if (A == 0 && B == 0)
- optr += 2, op = cmd_opv_nrcurveto;
- else if (E == 0 && F == 0)
- op = cmd_opv_rncurveto;
- else
- op = cmd_opv_rrcurveto;
- memcpy(prev.vs, vs, sizeof(prev.vs));
- px = nx, py = ny;
- open = 1;
- code = cmd_put_segment(&writer, op, optr, notes);
- }
- }
- break;
- default:
- return_error(gs_error_rangecheck);
- }
- if (code < 0)
- return code;
+ /* A closepath may require drawing an explicit line if */
+ /* we skipped any segments at the beginning of the path. */
+ close:if (side != start_side) { /* If we skipped any segments, put out a moveto/lineto. */
+ if (side && (px != out.x || py != out.y || first_point())) {
+ C = out.x - px, D = out.y - py;
+ code = cmd_put_rlineto(&writer, &C, out_notes);
+ if (code < 0)
+ return code;
+ px = out.x, py = out.y;
+ if_debug2('p', "[p]catchup line (%g,%g) for close\n",
+ fixed2float(px), fixed2float(py));
+ }
+ if (open > 0 && start_skip) { /* Draw the closing line back to the start. */
+ C = start.x - px, D = start.y - py;
+ code = cmd_put_rlineto(&writer, &C, sn_none);
+ if (code < 0)
+ return code;
+ px = start.x, py = start.y;
+ if_debug2('p', "[p]draw close to (%g,%g)\n",
+ fixed2float(px), fixed2float(py));
+ }
+ }
+ /*
+ * We don't bother to update side because we know that the
+ * next element after a closepath, if any, must be a moveto.
+ * We must handle explicitly the possibility that the entire
+ * subpath was skipped.
+ */
+ if (implicit_close || open <= 0) {
+ /*
+ * Force writing an explicit moveto if the next subpath
+ * starts with a moveto to the same point where this one
+ * ends.
+ */
+ set_first_point();
+ /*
+ * If implicit_close == true, we don't need an explicit closepath,
+ * because the filling algorithm will close subpath automatically.
+ * Otherwise, if open < 0, we have an empty closed path.
+ * If side != 0, it is outside the band, so we can
+ * safely skip it, because the band has been expanded
+ * with line width.
+ */
+ if (side != 0) {
+ open = 0;
+ continue;
+ }
+ }
+ open = 0;
+ px = first.x, py = first.y;
+ code = cmd_put_segment(&writer, cmd_opv_closepath, &A, sn_none);
+ if_debug0('p', "[p]close\n");
+ break;
+ case gs_pe_curveto:
+ {
+ segment_notes notes =
+ gx_path_enum_notes(&cenum) & keep_notes;
+
+ {
+ fixed bpy, bqy;
+ int all_side, out_side;
+
+ /* Compute the Y bounds for the clipping check. */
+ if (B < D)
+ bpy = B, bqy = D;
+ else
+ bpy = D, bqy = B;
+ if (F < bpy)
+ bpy = F;
+ else if (F > bqy)
+ bqy = F;
+ all_side = (bqy < ymin ? -1 : bpy > ymax ? 1 : 0);
+ if (all_side != 0) {
+ if (all_side == side) { /* Skip a curve entirely outside the clip region. */
+ if (open < 0)
+ start_skip = true;
+ out.x = E, out.y = F;
+ out_notes = notes;
+ if_debug3('p', "[p]skip curveto (%g,%g) side %d\n",
+ fixed2float(out.x), fixed2float(out.y),
+ side);
+ continue;
+ }
+ out_side = all_side;
+ } else
+ out_side = which_side(F);
+ /* If we skipped any segments, put out a moveto/lineto. */
+ if (side && (px != out.x || py != out.y || first_point())) {
+ fixed diff[2];
+
+ diff[0] = out.x - px, diff[1] = out.y - py;
+ if (open < 0) {
+ first = out;
+ code = cmd_put_rmoveto(&writer, diff);
+ } else
+ code = cmd_put_rlineto(&writer, diff, out_notes);
+ if (code < 0)
+ return code;
+ px = out.x, py = out.y;
+ if_debug3('p', "[p]catchup %s (%g,%g) for curve\n",
+ (open < 0 ? "moveto" : "lineto"),
+ fixed2float(px), fixed2float(py));
+ }
+ if ((side = out_side) != 0) { /* Note a vertex going outside the clip region. */
+ out.x = E, out.y = F;
+ }
+ }
+ {
+ fixed nx = E, ny = F;
+ const fixed *optr = vs;
+ byte op;
+
+ if_debug7('p', "[p]curveto (%g,%g; %g,%g; %g,%g) side %d\n",
+ fixed2float(A), fixed2float(B),
+ fixed2float(C), fixed2float(D),
+ fixed2float(E), fixed2float(F), side);
+ E -= C, F -= D;
+ C -= A, D -= B;
+ A -= px, B -= py;
+ if (*writer.dp >= cmd_opv_min_curveto &&
+ *writer.dp <= cmd_opv_max_curveto &&
+ ((prev.A == 0 &&
+ A == prev.E && C == prev.C && E == prev.A &&
+ B == -prev.F && D == -prev.D && F == -prev.B) ||
+ (prev.A != 0 &&
+ A == -prev.E && C == -prev.C && E == -prev.A &&
+ B == prev.F && D == prev.D && F == prev.B))
+ )
+ op = cmd_opv_scurveto;
+ else if (B == 0 && E == 0) {
+ B = A, E = F, optr++, op = cmd_opv_hvcurveto;
+ if ((B ^ D) >= 0) {
+ if (C == D && E == B)
+ op = cmd_opv_hqcurveto;
+ } else if (C == -D && E == -B)
+ C = D, op = cmd_opv_hqcurveto;
+ } else if (A == 0 && F == 0) {
+ optr++, op = cmd_opv_vhcurveto;
+ if ((B ^ C) >= 0) {
+ if (D == C && E == B)
+ op = cmd_opv_vqcurveto;
+ } else if (D == -C && E == -B)
+ op = cmd_opv_vqcurveto;
+ } else if (A == 0 && B == 0)
+ optr += 2, op = cmd_opv_nrcurveto;
+ else if (E == 0 && F == 0)
+ op = cmd_opv_rncurveto;
+ else
+ op = cmd_opv_rrcurveto;
+ memcpy(prev.vs, vs, sizeof(prev.vs));
+ px = nx, py = ny;
+ open = 1;
+ code = cmd_put_segment(&writer, op, optr, notes);
+ }
+ }
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
+ if (code < 0)
+ return code;
#undef A
#undef B
#undef C
diff --git a/gs/base/gxclpath.h b/gs/base/gxclpath.h
index e5826a914..0c28f18d0 100644
--- a/gs/base/gxclpath.h
+++ b/gs/base/gxclpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -58,21 +58,21 @@ typedef enum {
cmd_op_misc2 = 0xd0, /* (see below) */
/* obsolete */
/* cmd_opv_set_color = 0xd0, */ /* Used if base values do not fit into 1 bit */
- /* #flags,#base[0],...#base[num_comp-1] if flags */
- /* colored halftone with base colors a,b,c,d */
+ /* #flags,#base[0],...#base[num_comp-1] if flags */
+ /* colored halftone with base colors a,b,c,d */
/* obsolete */
/* cmd_opv_set_color_short = 0xd1, */ /* Used if base values fit into 1 bit */
- /* If num_comp <= 4 then use: */
- /* pqrsabcd, where a = base[0] */
- /* b = base[1], c= base[2], d = base[3] */
- /* p = level[0], q = level[1] */
- /* r = level[2], s = level[3] */
- /* If num_comp > 4 then use: */
- /* #flags, #bases */
+ /* If num_comp <= 4 then use: */
+ /* pqrsabcd, where a = base[0] */
+ /* b = base[1], c= base[2], d = base[3] */
+ /* p = level[0], q = level[1] */
+ /* r = level[2], s = level[3] */
+ /* If num_comp > 4 then use: */
+ /* #flags, #bases */
cmd_opv_set_fill_adjust = 0xd2, /* adjust_x/y(fixed) */
cmd_opv_set_ctm = 0xd3, /* [per sput/sget_matrix] */
cmd_opv_set_color_space = 0xd4, /* base(4)Indexed?(2)0(2) */
- /* [, hival#, table|map] */
+ /* [, hival#, table|map] */
/*
* cmd_opv_set_misc2_value is followed by a mask (a variable-length
* integer), and then by parameter values for the parameters selected
@@ -89,22 +89,22 @@ typedef enum {
/* alpha: <<verbatim copy from imager state>> */
cmd_opv_set_misc2 = 0xd5, /* mask#, selected parameters */
cmd_opv_set_dash = 0xd6, /* adapt(1)abs.dot(1)n(6), dot */
- /* length(float), offset(float), */
- /* n x (float) */
+ /* length(float), offset(float), */
+ /* n x (float) */
cmd_opv_enable_clip = 0xd7, /* (nothing) */
cmd_opv_disable_clip = 0xd8, /* (nothing) */
cmd_opv_begin_clip = 0xd9, /* (nothing) */
cmd_opv_end_clip = 0xda, /* (nothing) */
cmd_opv_begin_image_rect = 0xdb, /* same as begin_image, followed by */
- /* x0#, w-x1#, y0#, h-y1# */
+ /* x0#, w-x1#, y0#, h-y1# */
cmd_opv_begin_image = 0xdc, /* image_type_table index, */
- /* [per image type] */
+ /* [per image type] */
cmd_opv_image_data = 0xdd, /* height# (premature EOD if 0), */
- /* raster#, <data> */
+ /* raster#, <data> */
cmd_opv_image_plane_data = 0xde, /* height# (premature EOD if 0), */
- /* flags# (0 = same raster & data_x, */
- /* 1 = new raster & data_x, lsb first), */
- /* [raster#, [data_x#,]]* <data> */
+ /* flags# (0 = same raster & data_x, */
+ /* 1 = new raster & data_x, lsb first), */
+ /* [raster#, [data_x#,]]* <data> */
cmd_opv_extend = 0xdf, /* command, varies */
cmd_op_segment = 0xe0, /* (see below) */
cmd_opv_rmoveto = 0xe0, /* dx%, dy% */
@@ -114,7 +114,7 @@ typedef enum {
cmd_opv_rmlineto = 0xe4, /* dx1%,dy1%, dx2%,dy2% */
cmd_opv_rm2lineto = 0xe5, /* dx1%,dy1%, dx2%,dy2%, dx3%,dy3% */
cmd_opv_rm3lineto = 0xe6, /* dx1%,dy1%, dx2%,dy2%, dx3%,dy3%, */
- /* [-dx2,-dy2 implicit] */
+ /* [-dx2,-dy2 implicit] */
cmd_opv_rrcurveto = 0xe7, /* dx1%,dy1%, dx2%,dy2%, dx3%,dy3% */
cmd_opv_min_curveto = cmd_opv_rrcurveto,
cmd_opv_hvcurveto = 0xe8, /* dx1%, dx2%,dy2%, dy3% */
@@ -122,14 +122,14 @@ typedef enum {
cmd_opv_nrcurveto = 0xea, /* dx2%,dy2%, dx3%,dy3% */
cmd_opv_rncurveto = 0xeb, /* dx1%,dy1%, dx2%,dy2% */
cmd_opv_vqcurveto = 0xec, /* dy1%, dx2%[,dy2=dx2 with sign */
- /* of dy1, dx3=dy1 with sign of dx2] */
+ /* of dy1, dx3=dy1 with sign of dx2] */
cmd_opv_hqcurveto = 0xed, /* dx1%, [dx2=dy2 with sign */
- /* of dx1,]%dy2, [dy3=dx1 with sign */
- /* of dy2] */
+ /* of dx1,]%dy2, [dy3=dx1 with sign */
+ /* of dy2] */
cmd_opv_scurveto = 0xee, /* all implicit: previous op must have been */
- /* *curveto with one or more of dx/y1/3 = 0. */
- /* If h*: -dx3,dy3, -dx2,dy2, -dx1,dy1. */
- /* If v*: dx3,-dy3, dx2,-dy2, dx1,-dy1. */
+ /* *curveto with one or more of dx/y1/3 = 0. */
+ /* If h*: -dx3,dy3, -dx2,dy2, -dx1,dy1. */
+ /* If v*: dx3,-dy3, dx2,-dy2, dx1,-dy1. */
cmd_opv_max_curveto = cmd_opv_scurveto,
cmd_opv_closepath = 0xef, /* (nothing) */
cmd_op_path = 0xf0, /* (see below) */
@@ -225,7 +225,7 @@ dev_proc_fill_triangle(clist_fill_triangle);
/* Compute the colors used by a drawing color. */
gx_color_index cmd_drawing_colors_used(gx_device_clist_writer *cldev,
- const gx_drawing_color *pdcolor);
+ const gx_drawing_color *pdcolor);
/*
* Compute whether a drawing operation will require the slow (full-pixel)
@@ -233,14 +233,14 @@ gx_color_index cmd_drawing_colors_used(gx_device_clist_writer *cldev,
* the RasterOp.
*/
bool cmd_slow_rop(gx_device *dev, gs_logical_operation_t lop,
- const gx_drawing_color *pdcolor);
+ const gx_drawing_color *pdcolor);
/* Write out the color for filling, stroking, or masking. */
/* Return a cmd_dc_type. */
int cmd_put_drawing_color(gx_device_clist_writer * cldev,
- gx_clist_state * pcls,
- const gx_drawing_color * pdcolor,
- cmd_rects_enum_t *pre);
+ gx_clist_state * pcls,
+ const gx_drawing_color * pdcolor,
+ cmd_rects_enum_t *pre);
/* Clear (a) specific 'known' flag(s) for all bands. */
/* We must do this whenever the value of a 'known' parameter changes. */
@@ -257,10 +257,10 @@ int cmd_write_ctm(const gs_matrix *m, byte *dp, int len);
( ~(pcls)->known & (must_know) ?\
cmd_write_unknown(cldev, pcls, must_know) : 0 )
int cmd_write_unknown(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- uint must_know);
+ uint must_know);
/* Check whether we need to change the clipping path in the device. */
bool cmd_check_clip_path(gx_device_clist_writer * cldev,
- const gx_clip_path * pcpath);
+ const gx_clip_path * pcpath);
#endif /* gxclpath_INCLUDED */
diff --git a/gs/base/gxclrast.c b/gs/base/gxclrast.c
index d8a157ddc..29f3da69f 100644
--- a/gs/base/gxclrast.c
+++ b/gs/base/gxclrast.c
@@ -117,7 +117,6 @@ cmd_get_frac31(const byte * p, const byte ** rp)
return val;
}
-
/*
* Define the structure for keeping track of the command reading buffer.
*
@@ -220,7 +219,6 @@ cmd_copy_value(void *pvar, int var_size, const byte *cbp)
#define cmd_get_value(var, cbp)\
cbp = cmd_copy_value(&var, sizeof(var), cbp)
-
/*
* Define a buffer structure to hold a serialized halftone. This is
* used only if the serialized halftone is too large to fit into
@@ -276,7 +274,6 @@ static int clist_do_polyfill(gx_device *, gx_path *,
const gx_drawing_color *,
gs_logical_operation_t);
-
static inline void
enqueue_compositor(gs_composite_t **ppcomp_first, gs_composite_t **ppcomp_last, gs_composite_t *pcomp)
{
@@ -2398,7 +2395,6 @@ read_ht_segment(
return code;
}
-
static int
read_set_misc2(command_buf_t *pcb, gs_imager_state *pis, segment_notes *pnotes)
{
diff --git a/gs/base/gxclread.c b/gs/base/gxclread.c
index 7d86db62f..ce5b85277 100644
--- a/gs/base/gxclread.c
+++ b/gs/base/gxclread.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -97,20 +97,20 @@ s_band_read_init_offset_map(gx_device_clist_reader *crdev, stream_state * st)
stream_band_read_state *const ss = (stream_band_read_state *) st;
if (gs_debug_c('L')) {
- ss->offset_map_length = 0;
- ss->offset_map_max_length = cbuf_size + 1; /* fixme: Wanted a more accurate implementation. */
- ss->offset_map = (cbuf_offset_map_elem *)gs_alloc_byte_array(crdev->memory,
- ss->offset_map_max_length, sizeof(*ss->offset_map), "s_band_read_init_offset_map");
- if (ss->offset_map == NULL)
- return_error(gs_error_VMerror);
- ss->offset_map[0].buffered = 0;
- crdev->offset_map = ss->offset_map; /* Prevent collecting it as garbage.
- Debugged with ppmraw -r300 014-09.ps . */
+ ss->offset_map_length = 0;
+ ss->offset_map_max_length = cbuf_size + 1; /* fixme: Wanted a more accurate implementation. */
+ ss->offset_map = (cbuf_offset_map_elem *)gs_alloc_byte_array(crdev->memory,
+ ss->offset_map_max_length, sizeof(*ss->offset_map), "s_band_read_init_offset_map");
+ if (ss->offset_map == NULL)
+ return_error(gs_error_VMerror);
+ ss->offset_map[0].buffered = 0;
+ crdev->offset_map = ss->offset_map; /* Prevent collecting it as garbage.
+ Debugged with ppmraw -r300 014-09.ps . */
} else {
- ss->offset_map_length = 0;
- ss->offset_map_max_length = 0;
- ss->offset_map = NULL;
- crdev->offset_map = NULL;
+ ss->offset_map_length = 0;
+ ss->offset_map_max_length = 0;
+ ss->offset_map = NULL;
+ crdev->offset_map = NULL;
}
ss->skip_first = true;
return 0;
@@ -120,18 +120,17 @@ static void
s_band_read_dnit_offset_map(gx_device_clist_reader *crdev, stream_state * st)
{
if (gs_debug_c('L')) {
- stream_band_read_state *const ss = (stream_band_read_state *) st;
+ stream_band_read_state *const ss = (stream_band_read_state *) st;
- gs_free_object(crdev->memory, ss->offset_map, "s_band_read_dnit_offset_map");
- crdev->offset_map = 0;
+ gs_free_object(crdev->memory, ss->offset_map, "s_band_read_dnit_offset_map");
+ crdev->offset_map = 0;
}
}
#endif
-
static int
s_band_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_band_read_state *const ss = (stream_band_read_state *) st;
register byte *q = pw->ptr;
@@ -144,66 +143,66 @@ s_band_read_process(stream_state * st, stream_cursor_read * ignore_pr,
const clist_io_procs_t *io_procs = ss->page_info.io_procs;
while ((count = wlimit - q) != 0) {
- if (left) { /* Read more data for the current run. */
- if (count > left)
- count = left;
+ if (left) { /* Read more data for the current run. */
+ if (count > left)
+ count = left;
# ifdef DEBUG
- if (gs_debug_c('L'))
- ss->offset_map[ss->offset_map_length - 1].buffered += count;
+ if (gs_debug_c('L'))
+ ss->offset_map[ss->offset_map_length - 1].buffered += count;
# endif
- io_procs->fread_chars(q + 1, count, cfile);
- if (io_procs->ferror_code(cfile) < 0) {
- status = ERRC;
- break;
- }
- q += count;
- left -= count;
- process_interrupts(st->memory);
- continue;
- }
+ io_procs->fread_chars(q + 1, count, cfile);
+ if (io_procs->ferror_code(cfile) < 0) {
+ status = ERRC;
+ break;
+ }
+ q += count;
+ left -= count;
+ process_interrupts(st->memory);
+ continue;
+ }
rb:
- /*
- * Scan for the next run for the current bands (or a band range
- * that includes a current band).
- */
- if (ss->b_this.band_min == cmd_band_end &&
- io_procs->ftell(bfile) == ss->page_bfile_end_pos
- ) {
- status = EOFC;
- break;
- } {
- int bmin = ss->b_this.band_min;
- int bmax = ss->b_this.band_max;
- int64_t pos = ss->b_this.pos;
- int nread;
-
- nread = io_procs->fread_chars(&ss->b_this, sizeof(ss->b_this), bfile);
- if (nread < sizeof(ss->b_this)) {
- DISCARD(gs_note_error(gs_error_unregistered)); /* Must not happen. */
- return ERRC;
- }
- if (!(ss->band_last >= bmin && ss->band_first <= bmax))
- goto rb;
- io_procs->fseek(cfile, pos, SEEK_SET, ss->page_cfname);
- left = (uint) (ss->b_this.pos - pos);
+ /*
+ * Scan for the next run for the current bands (or a band range
+ * that includes a current band).
+ */
+ if (ss->b_this.band_min == cmd_band_end &&
+ io_procs->ftell(bfile) == ss->page_bfile_end_pos
+ ) {
+ status = EOFC;
+ break;
+ } {
+ int bmin = ss->b_this.band_min;
+ int bmax = ss->b_this.band_max;
+ int64_t pos = ss->b_this.pos;
+ int nread;
+
+ nread = io_procs->fread_chars(&ss->b_this, sizeof(ss->b_this), bfile);
+ if (nread < sizeof(ss->b_this)) {
+ DISCARD(gs_note_error(gs_error_unregistered)); /* Must not happen. */
+ return ERRC;
+ }
+ if (!(ss->band_last >= bmin && ss->band_first <= bmax))
+ goto rb;
+ io_procs->fseek(cfile, pos, SEEK_SET, ss->page_cfname);
+ left = (uint) (ss->b_this.pos - pos);
# ifdef DEBUG
- if (left > 0 && gs_debug_c('L')) {
- if (ss->offset_map_length >= ss->offset_map_max_length) {
- DISCARD(gs_note_error(gs_error_unregistered)); /* Must not happen. */
- return ERRC;
- }
- ss->offset_map[ss->offset_map_length].file_offset = pos;
- ss->offset_map[ss->offset_map_length].buffered = 0;
- ss->offset_map_length++;
- }
+ if (left > 0 && gs_debug_c('L')) {
+ if (ss->offset_map_length >= ss->offset_map_max_length) {
+ DISCARD(gs_note_error(gs_error_unregistered)); /* Must not happen. */
+ return ERRC;
+ }
+ ss->offset_map[ss->offset_map_length].file_offset = pos;
+ ss->offset_map[ss->offset_map_length].buffered = 0;
+ ss->offset_map_length++;
+ }
# endif
- if_debug7('l',
- "[l]reading for bands (%d,%d) at bfile %ld, cfile %ld, length %u color %d rop %d\n",
- bmin, bmax,
- (long)(io_procs->ftell(bfile) - sizeof(ss->b_this)), /* stefan foo was: 2 * sizeof ?? */
- (long)pos, left, ss->b_this.band_complexity.uses_color,
- ss->b_this.band_complexity.nontrivial_rops);
- }
+ if_debug7('l',
+ "[l]reading for bands (%d,%d) at bfile %ld, cfile %ld, length %u color %d rop %d\n",
+ bmin, bmax,
+ (long)(io_procs->ftell(bfile) - sizeof(ss->b_this)), /* stefan foo was: 2 * sizeof ?? */
+ (long)pos, left, ss->b_this.band_complexity.uses_color,
+ ss->b_this.band_complexity.nontrivial_rops);
+ }
}
pw->ptr = q;
ss->left = left;
@@ -222,12 +221,12 @@ buffer_segment_index(const stream_band_read_state *ss, uint buffer_offset, uint
uint i, offset0, offset = 0;
for (i = 0; i < ss->offset_map_length; i++) {
- offset0 = offset;
- offset += ss->offset_map[i].buffered;
- if (buffer_offset < offset) {
- *poffset0 = offset0;
- return i;
- }
+ offset0 = offset;
+ offset += ss->offset_map[i].buffered;
+ if (buffer_offset < offset) {
+ *poffset0 = offset0;
+ return i;
+ }
}
gs_note_error(gs_error_unregistered); /* Must not happen. */
return -1;
@@ -241,48 +240,47 @@ clist_file_offset(const stream_state * st, uint buffer_offset)
int i = buffer_segment_index(ss, buffer_offset, &offset0);
if (i < 0)
- return -1;
+ return -1;
return ss->offset_map[i].file_offset + (uint)(buffer_offset - offset0);
}
int
top_up_offset_map(stream_state * st, const byte *buf, const byte *ptr, const byte *end)
{
- /* NOTE: The clist data are buffered in the clist reader buffer and in the
+ /* NOTE: The clist data are buffered in the clist reader buffer and in the
internal buffer of the clist stream. Since the 1st buffer is not accessible
from s_band_read_process, offset_map corresponds the union of the 2 buffers.
*/
stream_band_read_state *const ss = (stream_band_read_state *) st;
if (!gs_debug_c('L')) {
- return 0;
+ return 0;
} else if (ss->skip_first) {
- /* Work around the trick with initializing the buffer pointer with the buffer end. */
- ss->skip_first = false;
- return 0;
+ /* Work around the trick with initializing the buffer pointer with the buffer end. */
+ ss->skip_first = false;
+ return 0;
} else if (ptr == buf)
- return 0;
+ return 0;
else {
- uint buffer_offset = ptr - buf;
- uint offset0, consumed;
- int i = buffer_segment_index(ss, buffer_offset, &offset0);
-
- if (i < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- consumed = buffer_offset - offset0;
- ss->offset_map[i].buffered -= consumed;
- ss->offset_map[i].file_offset += consumed;
- if (i) {
- memmove(ss->offset_map, ss->offset_map + i,
- (ss->offset_map_length - i) * sizeof(*ss->offset_map));
- ss->offset_map_length -= i;
- }
+ uint buffer_offset = ptr - buf;
+ uint offset0, consumed;
+ int i = buffer_segment_index(ss, buffer_offset, &offset0);
+
+ if (i < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ consumed = buffer_offset - offset0;
+ ss->offset_map[i].buffered -= consumed;
+ ss->offset_map[i].file_offset += consumed;
+ if (i) {
+ memmove(ss->offset_map, ss->offset_map + i,
+ (ss->offset_map_length - i) * sizeof(*ss->offset_map));
+ ss->offset_map_length -= i;
+ }
}
return 0;
}
#endif /* DEBUG */
-
/* ------ Reading/rendering ------ */
/* Calculate the raster for a chunky or planar device. */
@@ -290,27 +288,27 @@ static int
clist_plane_raster(const gx_device *dev, const gx_render_plane_t *render_plane)
{
return bitmap_raster(dev->width *
- (render_plane && render_plane->index >= 0 ?
- render_plane->depth : dev->color_info.depth));
+ (render_plane && render_plane->index >= 0 ?
+ render_plane->depth : dev->color_info.depth));
}
/* Select full-pixel rendering if required for RasterOp. */
void
clist_select_render_plane(gx_device *dev, int y, int height,
- gx_render_plane_t *render_plane, int index)
+ gx_render_plane_t *render_plane, int index)
{
if (index >= 0) {
- gx_colors_used_t colors_used;
- int ignore_start;
+ gx_colors_used_t colors_used;
+ int ignore_start;
- gdev_prn_colors_used(dev, y, height, &colors_used, &ignore_start);
- if (colors_used.slow_rop)
- index = -1;
+ gdev_prn_colors_used(dev, y, height, &colors_used, &ignore_start);
+ if (colors_used.slow_rop)
+ index = -1;
}
if (index < 0)
- render_plane->index = index;
+ render_plane->index = index;
else
- gx_render_plane_init(render_plane, dev, index);
+ gx_render_plane_init(render_plane, dev, index);
}
/*
@@ -327,10 +325,10 @@ clist_setup_params(gx_device *dev)
int code = clist_render_init(cldev);
if (code < 0)
- return code;
+ return code;
code = clist_playback_file_bands(playback_action_setup,
- crdev, &crdev->page_info, 0, 0, 0, 0, 0);
+ crdev, &crdev->page_info, 0, 0, 0, 0, 0);
/* put_params may have reinitialized device into a writer */
clist_render_init(cldev);
@@ -338,7 +336,7 @@ clist_setup_params(gx_device *dev)
return code;
}
-int
+int
clist_close_writer_and_init_reader(gx_device_clist *cldev)
{
gx_device_clist_reader * const crdev = &cldev->reader;
@@ -348,21 +346,21 @@ clist_close_writer_and_init_reader(gx_device_clist *cldev)
/* Initialize for rendering if we haven't done so yet. */
if (crdev->ymin < 0) {
- code = clist_end_page(&cldev->writer);
- if (code < 0)
- return code;
- code = clist_render_init(cldev);
+ code = clist_end_page(&cldev->writer);
+ if (code < 0)
+ return code;
+ code = clist_render_init(cldev);
/* Check for and get ICC profile table */
code = clist_read_icctable(crdev);
/* Allocate the icc cache for the clist reader */
- /* Since we may be rendering in multiple threads, make sure the memory */
- /* is thread safe by using a known thread_safe memory allocator */
- gs_memory_status(base_mem, &mem_status);
+ /* Since we may be rendering in multiple threads, make sure the memory */
+ /* is thread safe by using a known thread_safe memory allocator */
+ gs_memory_status(base_mem, &mem_status);
if (mem_status.is_thread_safe == false) {
return_error(gs_error_VMerror);
}
- code = (crdev->icc_cache_cl = gsicc_cache_new(base_mem)) == NULL ? gs_error_VMerror : code;
+ code = (crdev->icc_cache_cl = gsicc_cache_new(base_mem)) == NULL ? gs_error_VMerror : code;
}
return code;
}
@@ -389,7 +387,7 @@ clist_find_pseudoband(gx_device_clist_reader *crdev, int band, cmd_block *cb)
if (cb->band_max == band && cb->band_min == band) {
crdev->page_info.io_procs->fseek(bfile, save_pos, SEEK_SET, crdev->page_info.bfname);
return(0); /* Found it */
- }
+ }
start_pos -= sizeof(cmd_block);
if (start_pos < 0) {
crdev->page_info.io_procs->fseek(bfile, save_pos, SEEK_SET, crdev->page_info.bfname);
@@ -430,7 +428,7 @@ clist_unserialize_icctable(gx_device_clist_reader *crdev, cmd_block *cb)
clist_icctable_entry_t *curr_entry;
int k;
- if ( icc_table != NULL )
+ if ( icc_table != NULL )
return(0);
save_pos = crdev->page_info.io_procs->ftell(cfile);
crdev->page_info.io_procs->fseek(cfile, cb->pos, SEEK_SET, crdev->page_info.cfname);
@@ -443,9 +441,9 @@ clist_unserialize_icctable(gx_device_clist_reader *crdev, cmd_block *cb)
return gs_rethrow(-1, "insufficient memory for icc table buffer reader");
/* Get the data */
clist_read_chunk(crdev, cb->pos + 4, size_data, buf);
- icc_table = gs_alloc_struct(crdev->memory,
- clist_icctable_t,
- &st_clist_icctable, "clist_read_icctable");
+ icc_table = gs_alloc_struct(crdev->memory,
+ clist_icctable_t,
+ &st_clist_icctable, "clist_read_icctable");
if (icc_table == NULL)
return gs_rethrow(-1, "insufficient memory for icc table buffer reader");
icc_table->head = NULL;
@@ -454,9 +452,9 @@ clist_unserialize_icctable(gx_device_clist_reader *crdev, cmd_block *cb)
icc_table->tablesize = number_entries;
crdev->icc_table = icc_table;
for (k = 0; k < number_entries; k++) {
- curr_entry = gs_alloc_struct(crdev->memory,
- clist_icctable_entry_t,
- &st_clist_icctable_entry, "clist_read_icctable");
+ curr_entry = gs_alloc_struct(crdev->memory,
+ clist_icctable_entry_t,
+ &st_clist_icctable_entry, "clist_read_icctable");
if (curr_entry == NULL)
return gs_rethrow(-1, "insufficient memory for icc table entry");
memcpy(&(curr_entry->serial_data), buf, sizeof(clist_icc_serial_entry_t));
@@ -483,7 +481,7 @@ clist_read_icctable(gx_device_clist_reader *crdev)
cmd_block cb;
int code;
- /* First get the command block which will tell us where the
+ /* First get the command block which will tell us where the
information is stored in the cfile */
code = clist_find_pseudoband(crdev, crdev->nbands + ICC_BAND_OFFSET - 1, &cb);
if (code < 0)
@@ -518,7 +516,7 @@ clist_render_init(gx_device_clist *dev)
/* Copy a rasterized rectangle to the client, rasterizing if needed. */
int
clist_get_bits_rectangle(gx_device *dev, const gs_int_rect * prect,
- gs_get_bits_params_t *params, gs_int_rect **unread)
+ gs_get_bits_params_t *params, gs_int_rect **unread)
{
gx_device_clist *cldev = (gx_device_clist *)dev;
gx_device_clist_common *cdev = (gx_device_clist_common *)dev;
@@ -530,21 +528,21 @@ clist_get_bits_rectangle(gx_device *dev, const gs_int_rect * prect,
int lines_rasterized;
gx_device *bdev;
int num_planes =
- (options & GB_PACKING_CHUNKY ? 1 :
- options & GB_PACKING_PLANAR ? dev->color_info.num_components :
- options & GB_PACKING_BIT_PLANAR ? dev->color_info.depth :
- 0 /****** NOT POSSIBLE ******/);
+ (options & GB_PACKING_CHUNKY ? 1 :
+ options & GB_PACKING_PLANAR ? dev->color_info.num_components :
+ options & GB_PACKING_BIT_PLANAR ? dev->color_info.depth :
+ 0 /****** NOT POSSIBLE ******/);
gx_render_plane_t render_plane;
int plane_index;
int my;
int code;
if (prect->p.x < 0 || prect->q.x > dev->width ||
- y < 0 || end_y > dev->height
- )
- return_error(gs_error_rangecheck);
+ y < 0 || end_y > dev->height
+ )
+ return_error(gs_error_rangecheck);
if (line_count <= 0 || prect->p.x >= prect->q.x)
- return 0;
+ return 0;
/*
* Calculate the render_plane from the params. There are two cases:
@@ -552,40 +550,40 @@ clist_get_bits_rectangle(gx_device *dev, const gs_int_rect * prect,
*/
plane_index = -1;
if (options & GB_SELECT_PLANES) {
- /* Look for the one selected plane. */
- int i;
-
- for (i = 0; i < num_planes; ++i)
- if (params->data[i]) {
- if (plane_index >= 0) /* >1 plane requested */
- return gx_default_get_bits_rectangle(dev, prect, params,
- unread);
- plane_index = i;
- }
+ /* Look for the one selected plane. */
+ int i;
+
+ for (i = 0; i < num_planes; ++i)
+ if (params->data[i]) {
+ if (plane_index >= 0) /* >1 plane requested */
+ return gx_default_get_bits_rectangle(dev, prect, params,
+ unread);
+ plane_index = i;
+ }
}
if (0 > (code = clist_close_writer_and_init_reader(cldev)))
- return code;
+ return code;
clist_select_render_plane(dev, y, line_count, &render_plane, plane_index);
code = gdev_create_buf_device(cdev->buf_procs.create_buf_device,
- &bdev, cdev->target, y, &render_plane,
- dev->memory, clist_get_band_complexity(dev,y));
+ &bdev, cdev->target, y, &render_plane,
+ dev->memory, clist_get_band_complexity(dev,y));
if (code < 0)
- return code;
+ return code;
code = clist_rasterize_lines(dev, y, line_count, bdev, &render_plane, &my);
if (code < 0)
- return code;
+ return code;
lines_rasterized = min(code, line_count);
/* Return as much of the rectangle as falls within the rasterized lines. */
band_rect = *prect;
band_rect.p.y = my;
band_rect.q.y = my + lines_rasterized;
code = dev_proc(bdev, get_bits_rectangle)
- (bdev, &band_rect, params, unread);
+ (bdev, &band_rect, params, unread);
cdev->buf_procs.destroy_buf_device(bdev);
if (code < 0 || lines_rasterized == line_count)
- return code;
+ return code;
/*
* We'll have to return the rectangle in pieces. Force GB_RETURN_COPY
* rather than GB_RETURN_POINTER, and require all subsequent pieces to
@@ -594,48 +592,48 @@ clist_get_bits_rectangle(gx_device *dev, const gs_int_rect * prect,
* rectangles, punt.
*/
if (!(options & GB_RETURN_COPY) || code > 0)
- return gx_default_get_bits_rectangle(dev, prect, params, unread);
+ return gx_default_get_bits_rectangle(dev, prect, params, unread);
options = params->options;
if (!(options & GB_RETURN_COPY)) {
- /* Redo the first piece with copying. */
- params->options = options =
- (params->options & ~GB_RETURN_ALL) | GB_RETURN_COPY;
- lines_rasterized = 0;
+ /* Redo the first piece with copying. */
+ params->options = options =
+ (params->options & ~GB_RETURN_ALL) | GB_RETURN_COPY;
+ lines_rasterized = 0;
}
{
- gs_get_bits_params_t band_params;
- uint raster = gx_device_raster(bdev, true);
-
- code = gdev_create_buf_device(cdev->buf_procs.create_buf_device,
- &bdev, cdev->target, y, &render_plane,
- dev->memory, clist_get_band_complexity(dev, y));
- if (code < 0)
- return code;
- band_params = *params;
- while ((y += lines_rasterized) < end_y) {
- int i;
-
- /* Increment data pointers by lines_rasterized. */
- for (i = 0; i < num_planes; ++i)
- if (band_params.data[i])
- band_params.data[i] += raster * lines_rasterized;
- line_count = end_y - y;
- code = clist_rasterize_lines(dev, y, line_count, bdev,
- &render_plane, &my);
- if (code < 0)
- break;
- lines_rasterized = min(code, line_count);
- band_rect.p.y = my;
- band_rect.q.y = my + lines_rasterized;
- code = dev_proc(bdev, get_bits_rectangle)
- (bdev, &band_rect, &band_params, unread);
- if (code < 0)
- break;
- params->options = options = band_params.options;
- if (lines_rasterized == line_count)
- break;
- }
- cdev->buf_procs.destroy_buf_device(bdev);
+ gs_get_bits_params_t band_params;
+ uint raster = gx_device_raster(bdev, true);
+
+ code = gdev_create_buf_device(cdev->buf_procs.create_buf_device,
+ &bdev, cdev->target, y, &render_plane,
+ dev->memory, clist_get_band_complexity(dev, y));
+ if (code < 0)
+ return code;
+ band_params = *params;
+ while ((y += lines_rasterized) < end_y) {
+ int i;
+
+ /* Increment data pointers by lines_rasterized. */
+ for (i = 0; i < num_planes; ++i)
+ if (band_params.data[i])
+ band_params.data[i] += raster * lines_rasterized;
+ line_count = end_y - y;
+ code = clist_rasterize_lines(dev, y, line_count, bdev,
+ &render_plane, &my);
+ if (code < 0)
+ break;
+ lines_rasterized = min(code, line_count);
+ band_rect.p.y = my;
+ band_rect.q.y = my + lines_rasterized;
+ code = dev_proc(bdev, get_bits_rectangle)
+ (bdev, &band_rect, &band_params, unread);
+ if (code < 0)
+ break;
+ params->options = options = band_params.options;
+ if (lines_rasterized == line_count)
+ break;
+ }
+ cdev->buf_procs.destroy_buf_device(bdev);
}
return code;
}
@@ -644,8 +642,8 @@ clist_get_bits_rectangle(gx_device *dev, const gs_int_rect * prect,
/* Processes min(requested # lines, # lines available thru end of band) */
int /* returns -ve error code, or # scan lines copied */
clist_rasterize_lines(gx_device *dev, int y, int line_count,
- gx_device *bdev, const gx_render_plane_t *render_plane,
- int *pmy)
+ gx_device *bdev, const gx_render_plane_t *render_plane,
+ int *pmy)
{
gx_device_clist * const cldev = (gx_device_clist *)dev;
gx_device_clist_reader * const crdev = &cldev->reader;
@@ -657,49 +655,49 @@ clist_rasterize_lines(gx_device *dev, int y, int line_count,
/* Render a band if necessary, and copy it incrementally. */
if (crdev->ymin < 0 || crdev->yplane.index != plane_index ||
- !(y >= crdev->ymin && y < crdev->ymax)
- ) {
- int band_height = crdev->page_band_height;
- int band = y / band_height;
- int band_begin_line = band * band_height;
- int band_end_line = band_begin_line + band_height;
- int band_num_lines;
- gs_int_rect band_rect;
-
- if (band_end_line > dev->height)
- band_end_line = dev->height;
- /* Clip line_count to current band */
- if (line_count > band_end_line - y)
- line_count = band_end_line - y;
- band_num_lines = band_end_line - band_begin_line;
-
- if (y < 0 || y > dev->height)
- return_error(gs_error_rangecheck);
- code = crdev->buf_procs.setup_buf_device
- (bdev, mdata, raster, NULL, 0, band_num_lines, band_num_lines);
- band_rect.p.x = 0;
- band_rect.p.y = band_begin_line;
- band_rect.q.x = dev->width;
- band_rect.q.y = band_end_line;
- if (code >= 0)
- code = clist_render_rectangle(cldev, &band_rect, bdev, render_plane,
- true);
- /* Reset the band boundaries now, so that we don't get */
- /* an infinite loop. */
- crdev->ymin = band_begin_line;
- crdev->ymax = band_end_line;
- crdev->offset_map = NULL;
- if (code < 0)
- return code;
+ !(y >= crdev->ymin && y < crdev->ymax)
+ ) {
+ int band_height = crdev->page_band_height;
+ int band = y / band_height;
+ int band_begin_line = band * band_height;
+ int band_end_line = band_begin_line + band_height;
+ int band_num_lines;
+ gs_int_rect band_rect;
+
+ if (band_end_line > dev->height)
+ band_end_line = dev->height;
+ /* Clip line_count to current band */
+ if (line_count > band_end_line - y)
+ line_count = band_end_line - y;
+ band_num_lines = band_end_line - band_begin_line;
+
+ if (y < 0 || y > dev->height)
+ return_error(gs_error_rangecheck);
+ code = crdev->buf_procs.setup_buf_device
+ (bdev, mdata, raster, NULL, 0, band_num_lines, band_num_lines);
+ band_rect.p.x = 0;
+ band_rect.p.y = band_begin_line;
+ band_rect.q.x = dev->width;
+ band_rect.q.y = band_end_line;
+ if (code >= 0)
+ code = clist_render_rectangle(cldev, &band_rect, bdev, render_plane,
+ true);
+ /* Reset the band boundaries now, so that we don't get */
+ /* an infinite loop. */
+ crdev->ymin = band_begin_line;
+ crdev->ymax = band_end_line;
+ crdev->offset_map = NULL;
+ if (code < 0)
+ return code;
}
if (line_count > crdev->ymax - y)
- line_count = crdev->ymax - y;
+ line_count = crdev->ymax - y;
code = crdev->buf_procs.setup_buf_device
- (bdev, mdata, raster, NULL, y - crdev->ymin, line_count,
- crdev->ymax - crdev->ymin);
+ (bdev, mdata, raster, NULL, y - crdev->ymin, line_count,
+ crdev->ymax - crdev->ymin);
if (code < 0)
- return code;
+ return code;
*pmy = 0;
return line_count;
@@ -711,8 +709,8 @@ clist_rasterize_lines(gx_device *dev, int y, int line_count,
*/
int
clist_render_rectangle(gx_device_clist *cldev, const gs_int_rect *prect,
- gx_device *bdev,
- const gx_render_plane_t *render_plane, bool clear)
+ gx_device *bdev,
+ const gx_render_plane_t *render_plane, bool clear)
{
gx_device_clist_reader * const crdev = &cldev->reader;
const gx_placed_page *ppages;
@@ -726,14 +724,14 @@ clist_render_rectangle(gx_device_clist *cldev, const gs_int_rect *prect,
int i;
if (render_plane)
- crdev->yplane = *render_plane;
+ crdev->yplane = *render_plane;
else
- crdev->yplane.index = -1;
+ crdev->yplane.index = -1;
if_debug2('l', "[l]rendering bands (%d,%d)\n", band_first, band_last);
#if 0 /* Disabled because it is slow and appears to have no useful effect. */
if (clear)
- dev_proc(bdev, fill_rectangle)
- (bdev, 0, 0, bdev->width, bdev->height, gx_device_white(bdev));
+ dev_proc(bdev, fill_rectangle)
+ (bdev, 0, 0, bdev->width, bdev->height, gx_device_white(bdev));
#endif
/*
@@ -743,48 +741,48 @@ clist_render_rectangle(gx_device_clist *cldev, const gs_int_rect *prect,
*/
ppages = crdev->pages;
if (ppages == 0) {
- current_page.info = crdev->page_info;
- placed_page.page = &current_page;
- placed_page.offset.x = placed_page.offset.y = 0;
- ppages = &placed_page;
- num_pages = 1;
+ current_page.info = crdev->page_info;
+ placed_page.page = &current_page;
+ placed_page.offset.x = placed_page.offset.y = 0;
+ ppages = &placed_page;
+ num_pages = 1;
}
for (i = 0; i < num_pages && code >= 0; ++i) {
- const gx_placed_page *ppage = &ppages[i];
-
- /*
- * Set the band_offset_? values in case the buffer device
- * needs this. Example, wtsimdi device needs to adjust the
- * phase of the dithering based on the page position, NOT
- * the position within the band buffer to avoid band stitch
- * lines in the dither pattern.
- *
- * The band_offset_x is not important for placed pages that
- * are nested on a 'master' page (imposition) since each
- * page expects to be dithered independently, but setting
- * this allows pages to be contiguous without a dithering
- * shift.
- *
- * The following sets the band_offset_? relative to the
- * master page.
- */
- bdev->band_offset_x = ppage->offset.x;
- bdev->band_offset_y = ppage->offset.y + (band_first * band_height);
- code = clist_playback_file_bands(playback_action_render,
- crdev, &ppage->page->info,
- bdev, band_first, band_last,
- prect->p.x - ppage->offset.x,
- prect->p.y);
+ const gx_placed_page *ppage = &ppages[i];
+
+ /*
+ * Set the band_offset_? values in case the buffer device
+ * needs this. Example, wtsimdi device needs to adjust the
+ * phase of the dithering based on the page position, NOT
+ * the position within the band buffer to avoid band stitch
+ * lines in the dither pattern.
+ *
+ * The band_offset_x is not important for placed pages that
+ * are nested on a 'master' page (imposition) since each
+ * page expects to be dithered independently, but setting
+ * this allows pages to be contiguous without a dithering
+ * shift.
+ *
+ * The following sets the band_offset_? relative to the
+ * master page.
+ */
+ bdev->band_offset_x = ppage->offset.x;
+ bdev->band_offset_y = ppage->offset.y + (band_first * band_height);
+ code = clist_playback_file_bands(playback_action_render,
+ crdev, &ppage->page->info,
+ bdev, band_first, band_last,
+ prect->p.x - ppage->offset.x,
+ prect->p.y);
}
return code;
}
/* Playback the band file, taking the indicated action w/ its contents. */
int
-clist_playback_file_bands(clist_playback_action action,
- gx_device_clist_reader *crdev,
- gx_band_page_info_t *page_info, gx_device *target,
- int band_first, int band_last, int x0, int y0)
+clist_playback_file_bands(clist_playback_action action,
+ gx_device_clist_reader *crdev,
+ gx_band_page_info_t *page_info, gx_device *target,
+ int band_first, int band_last, int x0, int y0)
{
int code = 0;
bool opened_bfile = false;
@@ -792,67 +790,67 @@ clist_playback_file_bands(clist_playback_action action,
/* We have to pick some allocator for rendering.... */
gs_memory_t *mem =crdev->memory;
-
+
stream_band_read_state rs;
/* setup stream */
s_init_state((stream_state *)&rs, &s_band_read_template,
- (gs_memory_t *)0);
+ (gs_memory_t *)0);
rs.band_first = band_first;
rs.band_last = band_last;
rs.page_info = *page_info;
/* If this is a saved page, open the files. */
if (rs.page_cfile == 0) {
- code = crdev->page_info.io_procs->fopen(rs.page_cfname,
- gp_fmode_rb, &rs.page_cfile, crdev->bandlist_memory,
- crdev->bandlist_memory, true);
- opened_cfile = (code >= 0);
+ code = crdev->page_info.io_procs->fopen(rs.page_cfname,
+ gp_fmode_rb, &rs.page_cfile, crdev->bandlist_memory,
+ crdev->bandlist_memory, true);
+ opened_cfile = (code >= 0);
}
if (rs.page_bfile == 0 && code >= 0) {
- code = crdev->page_info.io_procs->fopen(rs.page_bfname,
- gp_fmode_rb, &rs.page_bfile, crdev->bandlist_memory,
- crdev->bandlist_memory, false);
- opened_bfile = (code >= 0);
+ code = crdev->page_info.io_procs->fopen(rs.page_bfname,
+ gp_fmode_rb, &rs.page_bfile, crdev->bandlist_memory,
+ crdev->bandlist_memory, false);
+ opened_bfile = (code >= 0);
}
if (rs.page_cfile != 0 && rs.page_bfile != 0) {
- stream s;
- byte sbuf[cbuf_size];
- static const stream_procs no_procs = {
- s_std_noavailable, s_std_noseek, s_std_read_reset,
- s_std_read_flush, s_std_close, s_band_read_process
- };
-
- s_band_read_init((stream_state *)&rs);
+ stream s;
+ byte sbuf[cbuf_size];
+ static const stream_procs no_procs = {
+ s_std_noavailable, s_std_noseek, s_std_read_reset,
+ s_std_read_flush, s_std_close, s_band_read_process
+ };
+
+ s_band_read_init((stream_state *)&rs);
# ifdef DEBUG
- s_band_read_init_offset_map(crdev, (stream_state *)&rs);
+ s_band_read_init_offset_map(crdev, (stream_state *)&rs);
# endif
- /* The stream doesn't need a memory, but we'll need to access s.memory->gs_lib_ctx. */
- s_init(&s, mem);
- s_std_init(&s, sbuf, cbuf_size, &no_procs, s_mode_read);
- s.foreign = 1;
- s.state = (stream_state *)&rs;
-
- if (vd_allowed('s')) {
- vd_get_dc('s');
- } else if (vd_allowed('i')) {
- vd_get_dc('i');
- }
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
- code = clist_playback_band(action, crdev, &s, target, x0, y0, mem);
- vd_release_dc;
+ /* The stream doesn't need a memory, but we'll need to access s.memory->gs_lib_ctx. */
+ s_init(&s, mem);
+ s_std_init(&s, sbuf, cbuf_size, &no_procs, s_mode_read);
+ s.foreign = 1;
+ s.state = (stream_state *)&rs;
+
+ if (vd_allowed('s')) {
+ vd_get_dc('s');
+ } else if (vd_allowed('i')) {
+ vd_get_dc('i');
+ }
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
+ code = clist_playback_band(action, crdev, &s, target, x0, y0, mem);
+ vd_release_dc;
# ifdef DEBUG
- s_band_read_dnit_offset_map(crdev, (stream_state *)&rs);
+ s_band_read_dnit_offset_map(crdev, (stream_state *)&rs);
# endif
}
/* Close the files if we just opened them. */
if (opened_bfile && rs.page_bfile != 0)
- crdev->page_info.io_procs->fclose(rs.page_bfile, rs.page_bfname, false);
+ crdev->page_info.io_procs->fclose(rs.page_bfile, rs.page_bfname, false);
if (opened_cfile && rs.page_cfile != 0)
- crdev->page_info.io_procs->fclose(rs.page_cfile, rs.page_cfname, false);
+ crdev->page_info.io_procs->fclose(rs.page_cfile, rs.page_cfname, false);
return code;
}
@@ -865,12 +863,12 @@ gx_band_complexity_t *
clist_get_band_complexity(gx_device *dev, int y)
{
if (dev != NULL) {
- gx_device_clist *cldev = (gx_device_clist *)dev;
- gx_device_clist_reader * const crdev = &cldev->reader;
- int band_number = y / crdev->page_info.band_params.BandHeight;
-
- if (crdev->band_complexity_array == NULL)
- return NULL;
+ gx_device_clist *cldev = (gx_device_clist *)dev;
+ gx_device_clist_reader * const crdev = &cldev->reader;
+ int band_number = y / crdev->page_info.band_params.BandHeight;
+
+ if (crdev->band_complexity_array == NULL)
+ return NULL;
{
/* NB this is a temporary workaround until the band
@@ -881,7 +879,7 @@ clist_get_band_complexity(gx_device *dev, int y)
crdev->band_complexity_array[band_number].nontrivial_rops = (int)colors_used.slow_rop;
crdev->band_complexity_array[band_number].uses_color = (int)colors_used.or;
}
- return &crdev->band_complexity_array[band_number];
+ return &crdev->band_complexity_array[band_number];
}
return NULL;
}
@@ -889,18 +887,18 @@ clist_get_band_complexity(gx_device *dev, int y)
/* Free any band_complexity_array memory used by the clist reader device */
void gx_clist_reader_free_band_complexity_array( gx_device_clist *cldev )
{
- if (cldev != NULL) {
- gx_device_clist_reader * const crdev = &cldev->reader;
-
- if ( crdev->band_complexity_array ) {
- gs_free_object( crdev->memory, crdev->band_complexity_array,
- "gx_clist_reader_free_band_complexity_array" );
- crdev->band_complexity_array = NULL;
- }
- }
+ if (cldev != NULL) {
+ gx_device_clist_reader * const crdev = &cldev->reader;
+
+ if ( crdev->band_complexity_array ) {
+ gs_free_object( crdev->memory, crdev->band_complexity_array,
+ "gx_clist_reader_free_band_complexity_array" );
+ crdev->band_complexity_array = NULL;
+ }
+ }
}
-/* call once per read page to read the band complexity from clist file
+/* call once per read page to read the band complexity from clist file
*/
static int
gx_clist_reader_read_band_complexity(gx_device_clist *dev)
@@ -908,38 +906,38 @@ gx_clist_reader_read_band_complexity(gx_device_clist *dev)
int code = -1; /* no dev bad call */
if (dev) {
- gx_device_clist *cldev = (gx_device_clist *)dev;
- gx_device_clist_reader * const crdev = &cldev->reader;
- int i;
- stream_band_read_state rs;
- cmd_block cb;
- int64_t save_pos;
- int pos = 0;
-
- /* setup stream */
- s_init_state((stream_state *)&rs, &s_band_read_template, (gs_memory_t *)0);
- rs.band_first = 0;
- rs.band_last = crdev->nbands;
- rs.page_info = crdev->page_info;
-
- save_pos = crdev->page_info.io_procs->ftell(rs.page_bfile);
- crdev->page_info.io_procs->fseek(rs.page_bfile, pos, SEEK_SET, rs.page_bfname);
-
- if ( crdev->band_complexity_array == NULL )
- crdev->band_complexity_array = (gx_band_complexity_t*)
- gs_alloc_byte_array( crdev->memory, crdev->nbands,
- sizeof( gx_band_complexity_t ), "gx_clist_reader_read_band_complexity" );
-
- if ( crdev->band_complexity_array == NULL )
- return_error(gs_error_VMerror);
-
- for (i=0; i < crdev->nbands; i++) {
- crdev->page_info.io_procs->fread_chars(&cb, sizeof(cb), rs.page_bfile);
- crdev->band_complexity_array[i] = cb.band_complexity;
- }
-
- crdev->page_info.io_procs->fseek(rs.page_bfile, save_pos, SEEK_SET, rs.page_bfname);
- code = 0;
+ gx_device_clist *cldev = (gx_device_clist *)dev;
+ gx_device_clist_reader * const crdev = &cldev->reader;
+ int i;
+ stream_band_read_state rs;
+ cmd_block cb;
+ int64_t save_pos;
+ int pos = 0;
+
+ /* setup stream */
+ s_init_state((stream_state *)&rs, &s_band_read_template, (gs_memory_t *)0);
+ rs.band_first = 0;
+ rs.band_last = crdev->nbands;
+ rs.page_info = crdev->page_info;
+
+ save_pos = crdev->page_info.io_procs->ftell(rs.page_bfile);
+ crdev->page_info.io_procs->fseek(rs.page_bfile, pos, SEEK_SET, rs.page_bfname);
+
+ if ( crdev->band_complexity_array == NULL )
+ crdev->band_complexity_array = (gx_band_complexity_t*)
+ gs_alloc_byte_array( crdev->memory, crdev->nbands,
+ sizeof( gx_band_complexity_t ), "gx_clist_reader_read_band_complexity" );
+
+ if ( crdev->band_complexity_array == NULL )
+ return_error(gs_error_VMerror);
+
+ for (i=0; i < crdev->nbands; i++) {
+ crdev->page_info.io_procs->fread_chars(&cb, sizeof(cb), rs.page_bfile);
+ crdev->band_complexity_array[i] = cb.band_complexity;
+ }
+
+ crdev->page_info.io_procs->fseek(rs.page_bfile, save_pos, SEEK_SET, rs.page_bfname);
+ code = 0;
}
return code;
}
diff --git a/gs/base/gxclrect.c b/gs/base/gxclrect.c
index 0d33469ed..9bd88351c 100644
--- a/gs/base/gxclrect.c
+++ b/gs/base/gxclrect.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,6 @@
#include "gxclpath.h"
#include "gxdevsop.h"
-
/* ---------------- Writing utilities ---------------- */
#define cmd_set_rect(rect)\
@@ -34,8 +33,8 @@ static int
cmd_size_rect(register const gx_cmd_rect * prect)
{
return
- cmd_sizew(prect->x) + cmd_sizew(prect->y) +
- cmd_sizew(prect->width) + cmd_sizew(prect->height);
+ cmd_sizew(prect->x) + cmd_sizew(prect->y) +
+ cmd_sizew(prect->width) + cmd_sizew(prect->height);
}
static byte *
cmd_put_rect(register const gx_cmd_rect * prect, register byte * dp)
@@ -49,7 +48,7 @@ cmd_put_rect(register const gx_cmd_rect * prect, register byte * dp)
int
cmd_write_rect_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int op, int x, int y, int width, int height)
+ int op, int x, int y, int width, int height)
{
int dx = x - pcls->rect.x;
int dy = y - pcls->rect.y;
@@ -68,69 +67,69 @@ cmd_write_rect_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
(unsigned)(dheight - rmin) <= (rmax - rmin))
cmd_set_rect(pcls->rect);
if (dheight == 0 && check_range_w(cmd_min_dw_tiny, cmd_max_dw_tiny) &&
- check_range_xy(cmd_min_dxy_tiny, cmd_max_dxy_tiny)
- ) {
- byte op_tiny = op + 0x20 + dwidth - cmd_min_dw_tiny;
-
- if (dx == width - dwidth && dy == 0) {
- code = set_cmd_put_op(dp, cldev, pcls, op_tiny + 8, 1);
- if (code < 0)
- return code;
- } else {
- code = set_cmd_put_op(dp, cldev, pcls, op_tiny, 2);
- if (code < 0)
- return code;
- dp[1] = (dx << 4) + dy - (cmd_min_dxy_tiny * 0x11);
- }
+ check_range_xy(cmd_min_dxy_tiny, cmd_max_dxy_tiny)
+ ) {
+ byte op_tiny = op + 0x20 + dwidth - cmd_min_dw_tiny;
+
+ if (dx == width - dwidth && dy == 0) {
+ code = set_cmd_put_op(dp, cldev, pcls, op_tiny + 8, 1);
+ if (code < 0)
+ return code;
+ } else {
+ code = set_cmd_put_op(dp, cldev, pcls, op_tiny, 2);
+ if (code < 0)
+ return code;
+ dp[1] = (dx << 4) + dy - (cmd_min_dxy_tiny * 0x11);
+ }
}
#define rmin cmd_min_short
#define rmax cmd_max_short
else if (check_ranges(rmin, rmax)) {
- int dh = dheight - cmd_min_dxy_tiny;
-
- if ((unsigned)dh <= cmd_max_dxy_tiny - cmd_min_dxy_tiny &&
- dh != 0 && dy == 0
- ) {
- op += dh;
- code = set_cmd_put_op(dp, cldev, pcls, op + 0x10, 3);
- if (code < 0)
- return code;
- if_debug3('L', " rs2:%d,%d,0,%d\n",
- dx, dwidth, dheight);
- } else {
- code = set_cmd_put_op(dp, cldev, pcls, op + 0x10, 5);
- if (code < 0)
- return code;
- if_debug4('L', " rs4:%d,%d,%d,%d\n",
- dx, dwidth, dy, dheight);
- dp[3] = dy - rmin;
- dp[4] = dheight - rmin;
- }
- dp[1] = dx - rmin;
- dp[2] = dwidth - rmin;
+ int dh = dheight - cmd_min_dxy_tiny;
+
+ if ((unsigned)dh <= cmd_max_dxy_tiny - cmd_min_dxy_tiny &&
+ dh != 0 && dy == 0
+ ) {
+ op += dh;
+ code = set_cmd_put_op(dp, cldev, pcls, op + 0x10, 3);
+ if (code < 0)
+ return code;
+ if_debug3('L', " rs2:%d,%d,0,%d\n",
+ dx, dwidth, dheight);
+ } else {
+ code = set_cmd_put_op(dp, cldev, pcls, op + 0x10, 5);
+ if (code < 0)
+ return code;
+ if_debug4('L', " rs4:%d,%d,%d,%d\n",
+ dx, dwidth, dy, dheight);
+ dp[3] = dy - rmin;
+ dp[4] = dheight - rmin;
+ }
+ dp[1] = dx - rmin;
+ dp[2] = dwidth - rmin;
}
#undef rmin
#undef rmax
else if (dy >= -2 && dy <= 1 && dheight >= -2 && dheight <= 1 &&
- (dy + dheight) != -4
- ) {
- int rcsize = 1 + cmd_sizew(x) + cmd_sizew(width);
-
- code = set_cmd_put_op(dp, cldev, pcls,
- op + ((dy + 2) << 2) + dheight + 2, rcsize);
- if (code < 0)
- return code;
- ++dp;
- cmd_put2w(x, width, dp);
+ (dy + dheight) != -4
+ ) {
+ int rcsize = 1 + cmd_sizew(x) + cmd_sizew(width);
+
+ code = set_cmd_put_op(dp, cldev, pcls,
+ op + ((dy + 2) << 2) + dheight + 2, rcsize);
+ if (code < 0)
+ return code;
+ ++dp;
+ cmd_put2w(x, width, dp);
} else {
- int rcsize = 1 + cmd_size_rect(&pcls->rect);
-
- code = set_cmd_put_op(dp, cldev, pcls, op, rcsize);
- if (code < 0)
- return code;
- if_debug5('L', " r%d:%d,%d,%d,%d\n",
- rcsize - 1, dx, dwidth, dy, dheight);
- cmd_put_rect(&pcls->rect, dp + 1);
+ int rcsize = 1 + cmd_size_rect(&pcls->rect);
+
+ code = set_cmd_put_op(dp, cldev, pcls, op, rcsize);
+ if (code < 0)
+ return code;
+ if_debug5('L', " r%d:%d,%d,%d,%d\n",
+ rcsize - 1, dx, dwidth, dy, dheight);
+ cmd_put_rect(&pcls->rect, dp + 1);
}
return 0;
}
@@ -152,9 +151,9 @@ cmd_write_page_rect_cmd(gx_device_clist_writer * cldev, int op)
if_debug0('L', "[L]fillpage beg\n");
code = set_cmd_put_all_op(dp, cldev, op, rcsize);
if (code < 0)
- return code;
+ return code;
for (pcls1 = cldev->states; pcls1 < cldev->states + cldev->nbands; pcls1++)
- cmd_set_rect(pcls1->rect);
+ cmd_set_rect(pcls1->rect);
++dp;
cmd_putw(0, dp);
cmd_putw(0, dp);
@@ -164,14 +163,14 @@ cmd_write_page_rect_cmd(gx_device_clist_writer * cldev, int op)
return 0;
}
-static inline byte *
+static inline byte *
cmd_put_frac31_color(gx_device_clist_writer * cldev, const frac31 *c, byte *dp)
{
int num_components = cldev->clist_color_info.num_components;
int j;
for (j = 0; j < num_components; j++)
- dp = cmd_put_frac31(c[j], dp);
+ dp = cmd_put_frac31(c[j], dp);
return dp;
}
@@ -182,17 +181,17 @@ cmd_size_frac31_color(gx_device_clist_writer * cldev, const frac31 *c)
int num_components = cldev->clist_color_info.num_components;
for (j = 0; j < num_components; j++)
- s += cmd_size_frac31(c[j]);
+ s += cmd_size_frac31(c[j]);
return s;
}
static int
cmd_write_trapezoid_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int op, const gs_fixed_edge *left, const gs_fixed_edge *right,
- fixed ybot, fixed ytop, int options,
- const gs_fill_attributes *fa,
- const frac31 *c0, const frac31 *c1,
- const frac31 *c2, const frac31 *c3)
+ int op, const gs_fixed_edge *left, const gs_fixed_edge *right,
+ fixed ybot, fixed ytop, int options,
+ const gs_fill_attributes *fa,
+ const frac31 *c0, const frac31 *c1,
+ const frac31 *c2, const frac31 *c3)
{
byte *dp;
int rcsize;
@@ -200,37 +199,37 @@ cmd_write_trapezoid_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
int colors_mask = 0;
rcsize = 1 + cmd_sizew(left->start.x) + cmd_sizew(left->start.y)
- + cmd_sizew(left->end.x) + cmd_sizew(left->end.y)
- + cmd_sizew(right->start.x) + cmd_sizew(right->start.y)
- + cmd_sizew(right->end.x) + cmd_sizew(right->end.y)
- + cmd_sizew(options);
+ + cmd_sizew(left->end.x) + cmd_sizew(left->end.y)
+ + cmd_sizew(right->start.x) + cmd_sizew(right->start.y)
+ + cmd_sizew(right->end.x) + cmd_sizew(right->end.y)
+ + cmd_sizew(options);
if (!(options & 4))
- rcsize += cmd_sizew(ybot) + cmd_sizew(ytop);
+ rcsize += cmd_sizew(ybot) + cmd_sizew(ytop);
if (options & 2) {
- rcsize += cmd_sizew(fa->clip->p.x) + cmd_sizew(fa->clip->p.y)
- + cmd_sizew(fa->clip->q.x) + cmd_sizew(fa->clip->q.y);
- if (c0 != NULL) {
- colors_mask += 1;
- rcsize += cmd_size_frac31_color(cldev, c0);
- }
- if (c1 != NULL) {
- colors_mask += 2;
- rcsize += cmd_size_frac31_color(cldev, c1);
- }
- if (c2 != NULL) {
- colors_mask += 4;
- rcsize += cmd_size_frac31_color(cldev, c2);
- }
- if (c3 != NULL) {
- colors_mask += 8;
- rcsize += cmd_size_frac31_color(cldev, c3);
- }
- rcsize += cmd_sizew(colors_mask);
+ rcsize += cmd_sizew(fa->clip->p.x) + cmd_sizew(fa->clip->p.y)
+ + cmd_sizew(fa->clip->q.x) + cmd_sizew(fa->clip->q.y);
+ if (c0 != NULL) {
+ colors_mask += 1;
+ rcsize += cmd_size_frac31_color(cldev, c0);
+ }
+ if (c1 != NULL) {
+ colors_mask += 2;
+ rcsize += cmd_size_frac31_color(cldev, c1);
+ }
+ if (c2 != NULL) {
+ colors_mask += 4;
+ rcsize += cmd_size_frac31_color(cldev, c2);
+ }
+ if (c3 != NULL) {
+ colors_mask += 8;
+ rcsize += cmd_size_frac31_color(cldev, c3);
+ }
+ rcsize += cmd_sizew(colors_mask);
}
code = set_cmd_put_op(dp, cldev, pcls, op, rcsize);
if (code < 0)
- return code;
+ return code;
dp++;
cmd_putw(left->start.x, dp);
cmd_putw(left->start.y, dp);
@@ -242,27 +241,27 @@ cmd_write_trapezoid_cmd(gx_device_clist_writer * cldev, gx_clist_state * pcls,
cmd_putw(right->end.y, dp);
cmd_putw(options, dp);
if (!(options & 4)) {
- cmd_putw(ybot, dp);
- cmd_putw(ytop, dp);
+ cmd_putw(ybot, dp);
+ cmd_putw(ytop, dp);
}
if_debug6('L', " t%d:%ld,%ld,%ld,%ld %ld\n",
- rcsize - 1, left->start.x, left->start.y, left->end.x, left->end.y, ybot);
+ rcsize - 1, left->start.x, left->start.y, left->end.x, left->end.y, ybot);
if_debug6('L', " t%ld,%ld,%ld,%ld %ld o=%d\n",
- right->start.x, right->start.y, right->end.x, right->end.y, ytop, options);
+ right->start.x, right->start.y, right->end.x, right->end.y, ytop, options);
if (options & 2) {
- cmd_putw(fa->clip->p.x, dp);
- cmd_putw(fa->clip->p.y, dp);
- cmd_putw(fa->clip->q.x, dp);
- cmd_putw(fa->clip->q.y, dp);
- cmd_putw(colors_mask, dp);
- if (c0 != NULL)
- dp = cmd_put_frac31_color(cldev, c0, dp);
- if (c1 != NULL)
- dp = cmd_put_frac31_color(cldev, c1, dp);
- if (c2 != NULL)
- dp = cmd_put_frac31_color(cldev, c2, dp);
- if (c3 != NULL)
- cmd_put_frac31_color(cldev, c3, dp);
+ cmd_putw(fa->clip->p.x, dp);
+ cmd_putw(fa->clip->p.y, dp);
+ cmd_putw(fa->clip->q.x, dp);
+ cmd_putw(fa->clip->q.y, dp);
+ cmd_putw(colors_mask, dp);
+ if (c0 != NULL)
+ dp = cmd_put_frac31_color(cldev, c0, dp);
+ if (c1 != NULL)
+ dp = cmd_put_frac31_color(cldev, c1, dp);
+ if (c2 != NULL)
+ dp = cmd_put_frac31_color(cldev, c2, dp);
+ if (c3 != NULL)
+ cmd_put_frac31_color(cldev, c3, dp);
}
return 0;
}
@@ -277,56 +276,56 @@ clist_fillpage(gx_device * dev, gs_imager_state *pis, gx_drawing_color *pdcolor)
int code;
do {
- code = cmd_put_drawing_color(cdev, pcls, pdcolor, NULL);
- if (code >= 0)
- code = cmd_write_page_rect_cmd(cdev, cmd_op_fill_rect);
+ code = cmd_put_drawing_color(cdev, pcls, pdcolor, NULL);
+ if (code >= 0)
+ code = cmd_write_page_rect_cmd(cdev, cmd_op_fill_rect);
} while (RECT_RECOVER(code));
return code;
}
int
clist_fill_rectangle(gx_device * dev, int rx, int ry, int rwidth, int rheight,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int code;
cmd_rects_enum_t re;
crop_fill(cdev, rx, ry, rwidth, rheight);
if (rwidth <= 0 || rheight <= 0)
- return 0;
+ return 0;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- RECT_STEP_INIT(re);
- re.pcls->colors_used.or |= color;
- re.pcls->band_complexity.uses_color |= ((color != 0xffffff) && (color != 0));
- do {
- code = cmd_disable_lop(cdev, re.pcls);
- if (code >= 0 && color != re.pcls->colors[1]) {
- code = cmd_put_color(cdev, re.pcls, &clist_select_color1,
- color, &re.pcls->colors[1]);
- }
- if (code >= 0) {
- code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_fill_rect, rx, re.y,
- rwidth, re.height);
- }
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- re.y += re.height;
- continue;
+ RECT_STEP_INIT(re);
+ re.pcls->colors_used.or |= color;
+ re.pcls->band_complexity.uses_color |= ((color != 0xffffff) && (color != 0));
+ do {
+ code = cmd_disable_lop(cdev, re.pcls);
+ if (code >= 0 && color != re.pcls->colors[1]) {
+ code = cmd_put_color(cdev, re.pcls, &clist_select_color1,
+ color, &re.pcls->colors[1]);
+ }
+ if (code >= 0) {
+ code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_fill_rect, rx, re.y,
+ rwidth, re.height);
+ }
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ re.y += re.height;
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
} while (re.y < re.yend);
return 0;
}
-static inline int
+static inline int
clist_write_fill_trapezoid(gx_device * dev,
const gs_fixed_edge *left, const gs_fixed_edge *right,
fixed ybot, fixed ytop, int options,
@@ -336,68 +335,68 @@ clist_write_fill_trapezoid(gx_device * dev,
const frac31 *c2, const frac31 *c3)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int code;
cmd_rects_enum_t re;
int ry, rheight;
bool swap_axes = (options & 1);
if (options & 4) {
- if (swap_axes) {
- ry = fixed2int(max(min(min(left->start.x, left->end.x), right->start.x), fa->clip->p.x));
- rheight = fixed2int_ceiling(min(max(max(left->start.x, left->end.x), right->start.x), fa->clip->q.x)) - ry;
- } else {
- ry = fixed2int(max(min(min(left->start.y, left->end.y), right->start.y), fa->clip->p.y));
- rheight = fixed2int_ceiling(min(max(max(left->start.y, left->end.y), right->start.y), fa->clip->q.y)) - ry;
- }
+ if (swap_axes) {
+ ry = fixed2int(max(min(min(left->start.x, left->end.x), right->start.x), fa->clip->p.x));
+ rheight = fixed2int_ceiling(min(max(max(left->start.x, left->end.x), right->start.x), fa->clip->q.x)) - ry;
+ } else {
+ ry = fixed2int(max(min(min(left->start.y, left->end.y), right->start.y), fa->clip->p.y));
+ rheight = fixed2int_ceiling(min(max(max(left->start.y, left->end.y), right->start.y), fa->clip->q.y)) - ry;
+ }
} else {
- /* fixme: this may give a significant overestimation,
- so the command will be written to many bands.
- Would like to know a better range by X
- with computing intersections of sides with ybot, ytop. */
- if (swap_axes) {
- ry = fixed2int(min(left->start.x, left->end.x));
- rheight = fixed2int_ceiling(max(right->start.x, right->end.x)) - ry;
- } else {
- ry = fixed2int(ybot);
- rheight = fixed2int_ceiling(ytop) - ry;
- }
+ /* fixme: this may give a significant overestimation,
+ so the command will be written to many bands.
+ Would like to know a better range by X
+ with computing intersections of sides with ybot, ytop. */
+ if (swap_axes) {
+ ry = fixed2int(min(left->start.x, left->end.x));
+ rheight = fixed2int_ceiling(max(right->start.x, right->end.x)) - ry;
+ } else {
+ ry = fixed2int(ybot);
+ rheight = fixed2int_ceiling(ytop) - ry;
+ }
}
crop_fill_y(cdev, ry, rheight);
if (rheight <= 0)
- return 0;
+ return 0;
if (cdev->permanent_error < 0)
- return (cdev->permanent_error);
+ return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- RECT_STEP_INIT(re);
- do {
- if (pdcolor != NULL) {
- code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
- if (code == gs_error_unregistered)
- return code;
- if (code < 0) {
- /* Something went wrong, use the default implementation. */
- return gx_default_fill_trapezoid(dev, left, right, ybot, ytop, swap_axes, pdcolor, lop);
- }
- code = cmd_update_lop(cdev, re.pcls, lop);
- } else
- code = 0;
- if (code >= 0) {
- /* Dont't want to shorten the trapezoid by the band boundary,
- keeping in mind a further optimization with writing same data to all bands. */
- code = cmd_write_trapezoid_cmd(cdev, re.pcls, cmd_opv_fill_trapezoid, left, right,
- ybot, ytop, options, fa, c0, c1, c2, c3);
- }
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- re.y += re.height;
- continue;
+ RECT_STEP_INIT(re);
+ do {
+ if (pdcolor != NULL) {
+ code = cmd_put_drawing_color(cdev, re.pcls, pdcolor, &re);
+ if (code == gs_error_unregistered)
+ return code;
+ if (code < 0) {
+ /* Something went wrong, use the default implementation. */
+ return gx_default_fill_trapezoid(dev, left, right, ybot, ytop, swap_axes, pdcolor, lop);
+ }
+ code = cmd_update_lop(cdev, re.pcls, lop);
+ } else
+ code = 0;
+ if (code >= 0) {
+ /* Dont't want to shorten the trapezoid by the band boundary,
+ keeping in mind a further optimization with writing same data to all bands. */
+ code = cmd_write_trapezoid_cmd(cdev, re.pcls, cmd_opv_fill_trapezoid, left, right,
+ ybot, ytop, options, fa, c0, c1, c2, c3);
+ }
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ re.y += re.height;
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
} while (re.y < re.yend);
return 0;
}
@@ -409,15 +408,15 @@ clist_fill_trapezoid(gx_device * dev,
const gx_drawing_color *pdcolor, gs_logical_operation_t lop)
{
return clist_write_fill_trapezoid(dev, left, right,
- ybot, ytop, swap_axes, pdcolor, lop, NULL, NULL, NULL, NULL, NULL);
+ ybot, ytop, swap_axes, pdcolor, lop, NULL, NULL, NULL, NULL, NULL);
}
int
clist_fill_linear_color_trapezoid(gx_device * dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2, const gs_fixed_point *p3,
- const frac31 *c0, const frac31 *c1,
- const frac31 *c2, const frac31 *c3)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2, const gs_fixed_point *p3,
+ const frac31 *c0, const frac31 *c1,
+ const frac31 *c2, const frac31 *c3)
{
gs_fixed_edge left, right;
int code;
@@ -427,9 +426,9 @@ clist_fill_linear_color_trapezoid(gx_device * dev, const gs_fill_attributes *fa,
right.start = *p2;
right.end = *p3;
code = clist_write_fill_trapezoid(dev, &left, &right,
- fa->ystart, fa->yend, fa->swap_axes | 2, NULL, fa->lop, fa, c0, c1, c2, c3);
+ fa->ystart, fa->yend, fa->swap_axes | 2, NULL, fa->lop, fa, c0, c1, c2, c3);
if (code < 0)
- return code;
+ return code;
/* NOTE : The return value 0 for the fill_linear_color_trapezoid method means
that the device requests a further decomposition of the trapezoid.
Currently we have no interface for checking whether the target device
@@ -441,11 +440,11 @@ clist_fill_linear_color_trapezoid(gx_device * dev, const gs_fill_attributes *fa,
return 1;
}
-int
+int
clist_fill_linear_color_triangle(gx_device * dev, const gs_fill_attributes *fa,
- const gs_fixed_point *p0, const gs_fixed_point *p1,
- const gs_fixed_point *p2,
- const frac31 *c0, const frac31 *c1, const frac31 *c2)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const gs_fixed_point *p2,
+ const frac31 *c0, const frac31 *c1, const frac31 *c2)
{
gs_fixed_edge left, right;
int code;
@@ -456,9 +455,9 @@ clist_fill_linear_color_triangle(gx_device * dev, const gs_fill_attributes *fa,
right.end.x = right.end.y = 0; /* unused. */
code = clist_write_fill_trapezoid(dev, &left, &right,
- 0, 0, fa->swap_axes | 2 | 4, NULL, fa->lop, fa, c0, c1, c2, NULL);
+ 0, 0, fa->swap_axes | 2 | 4, NULL, fa->lop, fa, c0, c1, c2, NULL);
if (code < 0)
- return code;
+ return code;
/* NOTE : The return value 0 for the fill_linear_color_triangle method means
that the device requests a further decomposition of the trapezoid.
Currently we have no interface for checking whether the target device
@@ -470,234 +469,231 @@ clist_fill_linear_color_triangle(gx_device * dev, const gs_fill_attributes *fa,
return 1;
}
-
-int
+int
clist_dev_spec_op(gx_device *pdev, int dev_spec_op, void *data, int size)
{
- gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)data;
+ gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)data;
gx_bitmap_id id = (gx_bitmap_id)size;
if (dev_spec_op == gxdso_pattern_handles_clip_path)
- return 1;
+ return 1;
if (dev_spec_op == gxdso_pattern_shfill_doesnt_need_path)
- return 1;
+ return 1;
return gx_default_dev_spec_op(pdev, dev_spec_op, pinst, id);
}
#define dev_proc_pattern_manage(proc)\
dev_t_proc_pattern_manage(proc, gx_device)
-
int
clist_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tile,
- int rx, int ry, int rwidth, int rheight,
- gx_color_index color0, gx_color_index color1, int px, int py)
+ int rx, int ry, int rwidth, int rheight,
+ gx_color_index color0, gx_color_index color1, int px, int py)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int depth =
- (color1 == gx_no_color_index && color0 == gx_no_color_index ?
- cdev->clist_color_info.depth : 1);
+ (color1 == gx_no_color_index && color0 == gx_no_color_index ?
+ cdev->clist_color_info.depth : 1);
gx_color_index colors_used =
- (color1 == gx_no_color_index && color0 == gx_no_color_index ?
- /* We can't know what colors will be used: assume the worst. */
- ((gx_color_index)1 << depth) - 1 :
- (color0 == gx_no_color_index ? 0 : color0) |
- (color1 == gx_no_color_index ? 0 : color1));
+ (color1 == gx_no_color_index && color0 == gx_no_color_index ?
+ /* We can't know what colors will be used: assume the worst. */
+ ((gx_color_index)1 << depth) - 1 :
+ (color0 == gx_no_color_index ? 0 : color0) |
+ (color1 == gx_no_color_index ? 0 : color1));
int code;
cmd_rects_enum_t re;
crop_fill(cdev, rx, ry, rwidth, rheight);
if (rwidth <= 0 || rheight <= 0)
- return 0;
+ return 0;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- ulong offset_temp;
-
- RECT_STEP_INIT(re);
- re.pcls->colors_used.or |= colors_used;
- re.pcls->band_complexity.uses_color |=
- ((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
- ((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
-
- do {
- code = cmd_disable_lop(cdev, re.pcls);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- if (!cls_has_tile_id(cdev, re.pcls, tile->id, offset_temp)) {
- if (tile->id != gx_no_bitmap_id) {
- do {
- code = clist_change_tile(cdev, re.pcls, tile, depth);
- } while (RECT_RECOVER(code));
- if (code < 0 && !(code != gs_error_VMerror || !cdev->error_is_retryable) && SET_BAND_CODE(code))
- goto error_in_rect;
- } else
- code = -1; /* Force the default implementation. Should never happen. */
- if (code < 0) {
- /* ok if gx_default... does retries internally: */
- /* it's self-sufficient */
- code = gx_default_strip_tile_rectangle(dev, tile,
- rx, re.y, rwidth, re.height,
- color0, color1,
- px, py);
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- goto endr;
- }
- }
- do {
- code = 0;
- if (color0 != re.pcls->tile_colors[0] || color1 != re.pcls->tile_colors[1])
- code = cmd_set_tile_colors(cdev, re.pcls, color0, color1);
- if (px != re.pcls->tile_phase.x || py != re.pcls->tile_phase.y) {
- if (code >= 0)
- code = cmd_set_tile_phase(cdev, re.pcls, px, py);
- }
- if (code >= 0)
- code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_tile_rect, rx, re.y,
- rwidth, re.height);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
+ ulong offset_temp;
+
+ RECT_STEP_INIT(re);
+ re.pcls->colors_used.or |= colors_used;
+ re.pcls->band_complexity.uses_color |=
+ ((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
+ ((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
+
+ do {
+ code = cmd_disable_lop(cdev, re.pcls);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ if (!cls_has_tile_id(cdev, re.pcls, tile->id, offset_temp)) {
+ if (tile->id != gx_no_bitmap_id) {
+ do {
+ code = clist_change_tile(cdev, re.pcls, tile, depth);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && !(code != gs_error_VMerror || !cdev->error_is_retryable) && SET_BAND_CODE(code))
+ goto error_in_rect;
+ } else
+ code = -1; /* Force the default implementation. Should never happen. */
+ if (code < 0) {
+ /* ok if gx_default... does retries internally: */
+ /* it's self-sufficient */
+ code = gx_default_strip_tile_rectangle(dev, tile,
+ rx, re.y, rwidth, re.height,
+ color0, color1,
+ px, py);
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ goto endr;
+ }
+ }
+ do {
+ code = 0;
+ if (color0 != re.pcls->tile_colors[0] || color1 != re.pcls->tile_colors[1])
+ code = cmd_set_tile_colors(cdev, re.pcls, color0, color1);
+ if (px != re.pcls->tile_phase.x || py != re.pcls->tile_phase.y) {
+ if (code >= 0)
+ code = cmd_set_tile_phase(cdev, re.pcls, px, py);
+ }
+ if (code >= 0)
+ code = cmd_write_rect_cmd(cdev, re.pcls, cmd_op_tile_rect, rx, re.y,
+ rwidth, re.height);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
endr:;
- re.y += re.height;
- continue;
+ re.y += re.height;
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
} while (re.y < re.yend);
return 0;
}
int
clist_copy_mono(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int rx, int ry, int rwidth, int rheight,
- gx_color_index color0, gx_color_index color1)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int rx, int ry, int rwidth, int rheight,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int y0;
gx_bitmap_id orig_id = id;
gx_color_index colors_used =
- (color0 == gx_no_color_index ? 0 : color0) |
- (color1 == gx_no_color_index ? 0 : color1);
- bool uses_color =
- ((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
- ((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
+ (color0 == gx_no_color_index ? 0 : color0) |
+ (color1 == gx_no_color_index ? 0 : color1);
+ bool uses_color =
+ ((color0 != gx_no_color_index) && (color0 != 0xffffff) && (color0 != 0)) ||
+ ((color1 != gx_no_color_index) && (color1 != 0xffffff) && (color1 != 0));
cmd_rects_enum_t re;
-
fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
y0 = ry;
if (cdev->permanent_error < 0)
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- int dx = data_x & 7;
- int w1 = dx + rwidth;
- const byte *row = data + (re.y - y0) * raster + (data_x >> 3);
- int code;
-
- RECT_STEP_INIT(re);
- re.pcls->colors_used.or |= colors_used;
- re.pcls->band_complexity.uses_color |= uses_color;
- do {
- code = cmd_disable_lop(cdev, re.pcls);
- if (code >= 0)
- code = cmd_disable_clip(cdev, re.pcls);
- if (color0 != re.pcls->colors[0] && code >= 0)
- code = cmd_set_color0(cdev, re.pcls, color0);
- if (color1 != re.pcls->colors[1] && code >= 0)
- code = cmd_set_color1(cdev, re.pcls, color1);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- /* Don't bother to check for a possible cache hit: */
- /* tile_rectangle and fill_mask handle those cases. */
+ int dx = data_x & 7;
+ int w1 = dx + rwidth;
+ const byte *row = data + (re.y - y0) * raster + (data_x >> 3);
+ int code;
+
+ RECT_STEP_INIT(re);
+ re.pcls->colors_used.or |= colors_used;
+ re.pcls->band_complexity.uses_color |= uses_color;
+ do {
+ code = cmd_disable_lop(cdev, re.pcls);
+ if (code >= 0)
+ code = cmd_disable_clip(cdev, re.pcls);
+ if (color0 != re.pcls->colors[0] && code >= 0)
+ code = cmd_set_color0(cdev, re.pcls, color0);
+ if (color1 != re.pcls->colors[1] && code >= 0)
+ code = cmd_set_color1(cdev, re.pcls, color1);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ /* Don't bother to check for a possible cache hit: */
+ /* tile_rectangle and fill_mask handle those cases. */
copy:{
- gx_cmd_rect rect;
- int rsize;
- byte op = (byte) cmd_op_copy_mono;
- byte *dp;
- uint csize;
- uint compress;
- int code;
-
- rect.x = rx, rect.y = re.y;
- rect.width = w1, rect.height = re.height;
- rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
- do {
- code = cmd_put_bits(cdev, re.pcls, row, w1, re.height, raster,
- rsize, (orig_id == gx_no_bitmap_id ?
- 1 << cmd_compress_rle :
- cmd_mask_compress_any),
- &dp, &csize);
- } while (RECT_RECOVER(code));
- if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
- goto error_in_rect;
- compress = (uint)code;
- if (code < 0) {
- /* The bitmap was too large; split up the transfer. */
- if (re.height > 1) {
- /*
- * Split the transfer by reducing the height.
- * See the comment above FOR_RECTS in gxcldev.h.
- */
- re.height >>= 1;
- goto copy;
- } else {
- /* Split a single (very long) row. */
- int w2 = w1 >> 1;
-
- ++cdev->driver_call_nesting;
- {
- code = clist_copy_mono(dev, row, dx,
- raster, gx_no_bitmap_id, rx, re.y,
- w2, 1, color0, color1);
- if (code >= 0)
- code = clist_copy_mono(dev, row, dx + w2,
- raster, gx_no_bitmap_id,
- rx + w2, re.y,
- w1 - w2, 1, color0, color1);
- }
- --cdev->driver_call_nesting;
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- continue;
- }
- }
- op += compress;
- if (dx) {
- *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
- *dp++ = cmd_set_misc_data_x + dx;
- }
- *dp++ = cmd_count_op(op, csize);
- cmd_put2w(rx, re.y, dp);
- cmd_put2w(w1, re.height, dp);
- re.pcls->rect = rect;
- }
- continue;
+ gx_cmd_rect rect;
+ int rsize;
+ byte op = (byte) cmd_op_copy_mono;
+ byte *dp;
+ uint csize;
+ uint compress;
+ int code;
+
+ rect.x = rx, rect.y = re.y;
+ rect.width = w1, rect.height = re.height;
+ rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
+ do {
+ code = cmd_put_bits(cdev, re.pcls, row, w1, re.height, raster,
+ rsize, (orig_id == gx_no_bitmap_id ?
+ 1 << cmd_compress_rle :
+ cmd_mask_compress_any),
+ &dp, &csize);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
+ goto error_in_rect;
+ compress = (uint)code;
+ if (code < 0) {
+ /* The bitmap was too large; split up the transfer. */
+ if (re.height > 1) {
+ /*
+ * Split the transfer by reducing the height.
+ * See the comment above FOR_RECTS in gxcldev.h.
+ */
+ re.height >>= 1;
+ goto copy;
+ } else {
+ /* Split a single (very long) row. */
+ int w2 = w1 >> 1;
+
+ ++cdev->driver_call_nesting;
+ {
+ code = clist_copy_mono(dev, row, dx,
+ raster, gx_no_bitmap_id, rx, re.y,
+ w2, 1, color0, color1);
+ if (code >= 0)
+ code = clist_copy_mono(dev, row, dx + w2,
+ raster, gx_no_bitmap_id,
+ rx + w2, re.y,
+ w1 - w2, 1, color0, color1);
+ }
+ --cdev->driver_call_nesting;
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ continue;
+ }
+ }
+ op += compress;
+ if (dx) {
+ *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
+ *dp++ = cmd_set_misc_data_x + dx;
+ }
+ *dp++ = cmd_count_op(op, csize);
+ cmd_put2w(rx, re.y, dp);
+ cmd_put2w(w1, re.height, dp);
+ re.pcls->rect = rect;
+ }
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
- re.y -= re.height;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
+ re.y -= re.height;
} while ((re.y += re.height) < re.yend);
return 0;
}
int
clist_copy_color(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int rx, int ry, int rwidth, int rheight)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int rx, int ry, int rwidth, int rheight)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
int depth = cdev->clist_color_info.depth; /* Could be different than target
if 1.4 device */
int y0;
@@ -713,107 +709,107 @@ clist_copy_color(gx_device * dev,
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- int dx = (data_x_bit & 7) / depth;
- int w1 = dx + rwidth;
- const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
- int code;
-
- RECT_STEP_INIT(re);
- re.pcls->colors_used.or |= colors_used;
- re.pcls->band_complexity.uses_color = 1;
-
- do {
- code = cmd_disable_lop(cdev, re.pcls);
- if (code >= 0)
- code = cmd_disable_clip(cdev, re.pcls);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- if (re.pcls->color_is_alpha) {
- byte *dp;
-
- do {
- code =
- set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_color, 1);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- re.pcls->color_is_alpha = 0;
- }
+ int dx = (data_x_bit & 7) / depth;
+ int w1 = dx + rwidth;
+ const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
+ int code;
+
+ RECT_STEP_INIT(re);
+ re.pcls->colors_used.or |= colors_used;
+ re.pcls->band_complexity.uses_color = 1;
+
+ do {
+ code = cmd_disable_lop(cdev, re.pcls);
+ if (code >= 0)
+ code = cmd_disable_clip(cdev, re.pcls);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ if (re.pcls->color_is_alpha) {
+ byte *dp;
+
+ do {
+ code =
+ set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_color, 1);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ re.pcls->color_is_alpha = 0;
+ }
copy:{
- gx_cmd_rect rect;
- int rsize;
- byte op = (byte) cmd_op_copy_color_alpha;
- byte *dp;
- uint csize;
- uint compress;
-
- rect.x = rx, rect.y = re.y;
- rect.width = w1, rect.height = re.height;
- rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
- do {
- code = cmd_put_bits(cdev, re.pcls, row, w1 * depth,
- re.height, raster, rsize,
- 1 << cmd_compress_rle, &dp, &csize);
- } while (RECT_RECOVER(code));
- if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
- goto error_in_rect;
- compress = (uint)code;
- if (code < 0) {
- /* The bitmap was too large; split up the transfer. */
- if (re.height > 1) {
- /* Split the transfer by reducing the height.
- * See the comment above FOR_RECTS in gxcldev.h.
- */
- re.height >>= 1;
- goto copy;
- } else {
- /* Split a single (very long) row. */
- int w2 = w1 >> 1;
-
- ++cdev->driver_call_nesting;
- {
- code = clist_copy_color(dev, row, dx,
- raster, gx_no_bitmap_id,
- rx, re.y, w2, 1);
- if (code >= 0)
- code = clist_copy_color(dev, row, dx + w2,
- raster, gx_no_bitmap_id,
- rx + w2, re.y, w1 - w2, 1);
- }
- --cdev->driver_call_nesting;
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- continue;
- }
- }
- op += compress;
- if (dx) {
- *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
- *dp++ = cmd_set_misc_data_x + dx;
- }
- *dp++ = cmd_count_op(op, csize);
- cmd_put2w(rx, re.y, dp);
- cmd_put2w(w1, re.height, dp);
- re.pcls->rect = rect;
- }
- continue;
+ gx_cmd_rect rect;
+ int rsize;
+ byte op = (byte) cmd_op_copy_color_alpha;
+ byte *dp;
+ uint csize;
+ uint compress;
+
+ rect.x = rx, rect.y = re.y;
+ rect.width = w1, rect.height = re.height;
+ rsize = (dx ? 3 : 1) + cmd_size_rect(&rect);
+ do {
+ code = cmd_put_bits(cdev, re.pcls, row, w1 * depth,
+ re.height, raster, rsize,
+ 1 << cmd_compress_rle, &dp, &csize);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
+ goto error_in_rect;
+ compress = (uint)code;
+ if (code < 0) {
+ /* The bitmap was too large; split up the transfer. */
+ if (re.height > 1) {
+ /* Split the transfer by reducing the height.
+ * See the comment above FOR_RECTS in gxcldev.h.
+ */
+ re.height >>= 1;
+ goto copy;
+ } else {
+ /* Split a single (very long) row. */
+ int w2 = w1 >> 1;
+
+ ++cdev->driver_call_nesting;
+ {
+ code = clist_copy_color(dev, row, dx,
+ raster, gx_no_bitmap_id,
+ rx, re.y, w2, 1);
+ if (code >= 0)
+ code = clist_copy_color(dev, row, dx + w2,
+ raster, gx_no_bitmap_id,
+ rx + w2, re.y, w1 - w2, 1);
+ }
+ --cdev->driver_call_nesting;
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ continue;
+ }
+ }
+ op += compress;
+ if (dx) {
+ *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
+ *dp++ = cmd_set_misc_data_x + dx;
+ }
+ *dp++ = cmd_count_op(op, csize);
+ cmd_put2w(rx, re.y, dp);
+ cmd_put2w(w1, re.height, dp);
+ re.pcls->rect = rect;
+ }
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
- re.y -= re.height;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
+ re.y -= re.height;
} while ((re.y += re.height) < re.yend);
return 0;
}
int
clist_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int rx, int ry, int rwidth, int rheight,
- gx_color_index color, int depth)
+ int raster, gx_bitmap_id id, int rx, int ry, int rwidth, int rheight,
+ gx_color_index color, int depth)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
/* I don't like copying the entire body of clist_copy_color */
/* just to change 2 arguments and 1 opcode, */
/* but I don't see any alternative that doesn't require */
@@ -825,7 +821,7 @@ clist_copy_alpha(gx_device * dev, const byte * data, int data_x,
/* If the target can't perform copy_alpha, exit now */
if (depth > 1 && (cdev->disable_mask & clist_disable_copy_alpha) != 0)
- return_error(gs_error_unknownerror);
+ return_error(gs_error_unknownerror);
fit_copy(dev, data, data_x, raster, id, rx, ry, rwidth, rheight);
y0 = ry;
@@ -834,117 +830,117 @@ clist_copy_alpha(gx_device * dev, const byte * data, int data_x,
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- int dx = (data_x_bit & 7) >> log2_depth;
- int w1 = dx + rwidth;
- const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
- int code;
-
- RECT_STEP_INIT(re);
- re.pcls->colors_used.or |= color;
- do {
- code = cmd_disable_lop(cdev, re.pcls);
- if (code >= 0)
- code = cmd_disable_clip(cdev, re.pcls);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- if (!re.pcls->color_is_alpha) {
- byte *dp;
-
- do {
- code =
- set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_alpha, 1);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- re.pcls->color_is_alpha = 1;
- }
- if (color != re.pcls->colors[1]) {
- do {
- code = cmd_set_color1(cdev, re.pcls, color);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- }
+ int dx = (data_x_bit & 7) >> log2_depth;
+ int w1 = dx + rwidth;
+ const byte *row = data + (re.y - y0) * raster + (data_x_bit >> 3);
+ int code;
+
+ RECT_STEP_INIT(re);
+ re.pcls->colors_used.or |= color;
+ do {
+ code = cmd_disable_lop(cdev, re.pcls);
+ if (code >= 0)
+ code = cmd_disable_clip(cdev, re.pcls);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ if (!re.pcls->color_is_alpha) {
+ byte *dp;
+
+ do {
+ code =
+ set_cmd_put_op(dp, cdev, re.pcls, cmd_opv_set_copy_alpha, 1);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ re.pcls->color_is_alpha = 1;
+ }
+ if (color != re.pcls->colors[1]) {
+ do {
+ code = cmd_set_color1(cdev, re.pcls, color);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ }
copy:{
- gx_cmd_rect rect;
- int rsize;
- byte op = (byte) cmd_op_copy_color_alpha;
- byte *dp;
- uint csize;
- uint compress;
-
- rect.x = rx, rect.y = re.y;
- rect.width = w1, rect.height = re.height;
- rsize = (dx ? 4 : 2) + cmd_size_rect(&rect);
- do {
- code = cmd_put_bits(cdev, re.pcls, row, w1 << log2_depth,
- re.height, raster, rsize,
- 1 << cmd_compress_rle, &dp, &csize);
- } while (RECT_RECOVER(code));
- if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
- goto error_in_rect;
- compress = (uint)code;
- if (code < 0) {
- /* The bitmap was too large; split up the transfer. */
- if (re.height > 1) {
- /* Split the transfer by reducing the height.
- * See the comment above FOR_RECTS in gxcldev.h.
- */
- re.height >>= 1;
- goto copy;
- } else {
- /* Split a single (very long) row. */
- int w2 = w1 >> 1;
-
- ++cdev->driver_call_nesting;
- {
- code = clist_copy_alpha(dev, row, dx,
- raster, gx_no_bitmap_id, rx, re.y,
- w2, 1, color, depth);
- if (code >= 0)
- code = clist_copy_alpha(dev, row, dx + w2,
- raster, gx_no_bitmap_id,
- rx + w2, re.y, w1 - w2, 1,
- color, depth);
- }
- --cdev->driver_call_nesting;
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- continue;
- }
- }
- op += compress;
- if (dx) {
- *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
- *dp++ = cmd_set_misc_data_x + dx;
- }
- *dp++ = cmd_count_op(op, csize);
- *dp++ = depth;
- cmd_put2w(rx, re.y, dp);
- cmd_put2w(w1, re.height, dp);
- re.pcls->rect = rect;
- }
- continue;
+ gx_cmd_rect rect;
+ int rsize;
+ byte op = (byte) cmd_op_copy_color_alpha;
+ byte *dp;
+ uint csize;
+ uint compress;
+
+ rect.x = rx, rect.y = re.y;
+ rect.width = w1, rect.height = re.height;
+ rsize = (dx ? 4 : 2) + cmd_size_rect(&rect);
+ do {
+ code = cmd_put_bits(cdev, re.pcls, row, w1 << log2_depth,
+ re.height, raster, rsize,
+ 1 << cmd_compress_rle, &dp, &csize);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
+ goto error_in_rect;
+ compress = (uint)code;
+ if (code < 0) {
+ /* The bitmap was too large; split up the transfer. */
+ if (re.height > 1) {
+ /* Split the transfer by reducing the height.
+ * See the comment above FOR_RECTS in gxcldev.h.
+ */
+ re.height >>= 1;
+ goto copy;
+ } else {
+ /* Split a single (very long) row. */
+ int w2 = w1 >> 1;
+
+ ++cdev->driver_call_nesting;
+ {
+ code = clist_copy_alpha(dev, row, dx,
+ raster, gx_no_bitmap_id, rx, re.y,
+ w2, 1, color, depth);
+ if (code >= 0)
+ code = clist_copy_alpha(dev, row, dx + w2,
+ raster, gx_no_bitmap_id,
+ rx + w2, re.y, w1 - w2, 1,
+ color, depth);
+ }
+ --cdev->driver_call_nesting;
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ continue;
+ }
+ }
+ op += compress;
+ if (dx) {
+ *dp++ = cmd_count_op(cmd_opv_set_misc, 2);
+ *dp++ = cmd_set_misc_data_x + dx;
+ }
+ *dp++ = cmd_count_op(op, csize);
+ *dp++ = depth;
+ cmd_put2w(rx, re.y, dp);
+ cmd_put2w(w1, re.height, dp);
+ re.pcls->rect = rect;
+ }
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
- re.y -= re.height;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
+ re.y -= re.height;
} while ((re.y += re.height) < re.yend);
return 0;
}
int
clist_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int rx, int ry, int rwidth, int rheight,
- int phase_x, int phase_y, gs_logical_operation_t lop)
+ const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
+ const gx_color_index * scolors,
+ const gx_strip_bitmap * textures, const gx_color_index * tcolors,
+ int rx, int ry, int rwidth, int rheight,
+ int phase_x, int phase_y, gs_logical_operation_t lop)
{
gx_device_clist_writer * const cdev =
- &((gx_device_clist *)dev)->writer;
+ &((gx_device_clist *)dev)->writer;
gs_rop3_t rop = lop_rop(lop);
gx_strip_bitmap tile_with_id;
const gx_strip_bitmap *tiles = textures;
@@ -953,21 +949,21 @@ clist_strip_copy_rop(gx_device * dev,
gx_color_index all = ((gx_color_index)1 << cdev->clist_color_info.depth) - 1;
bool subtractive = dev->color_info.num_components >= 4; /****** HACK ******/
gx_color_index S =
- (scolors ? scolors[0] | scolors[1] : sdata ? all : 0);
+ (scolors ? scolors[0] | scolors[1] : sdata ? all : 0);
gx_color_index T =
- (tcolors ? tcolors[0] | tcolors[1] : textures ? all : 0);
+ (tcolors ? tcolors[0] | tcolors[1] : textures ? all : 0);
gs_rop3_t color_rop =
- (subtractive ? byte_reverse_bits[rop ^ 0xff] : rop);
+ (subtractive ? byte_reverse_bits[rop ^ 0xff] : rop);
bool slow_rop;
cmd_rects_enum_t re;
if (scolors != 0 && scolors[0] != scolors[1]) {
- crop_fill(cdev, rx, ry, rwidth, rheight);
+ crop_fill(cdev, rx, ry, rwidth, rheight);
} else {
- crop_copy(cdev, sdata, sourcex, sraster, id, rx, ry, rwidth, rheight);
+ crop_copy(cdev, sdata, sourcex, sraster, id, rx, ry, rwidth, rheight);
}
if (rwidth <= 0 || rheight <= 0)
- return 0;
+ return 0;
/*
* On CMYK devices, RasterOps must be executed with complete pixels
* if the operation involves the destination.
@@ -975,19 +971,19 @@ clist_strip_copy_rop(gx_device * dev,
* in the conversion between RGB and CMYK. Check for this now.
*/
{
- gs_rop3_t rop_used = rop;
-
- if (scolors && (scolors[0] == scolors[1]))
- rop_used = (scolors[0] == gx_device_black(dev) ?
- rop3_know_S_0(rop_used) :
- scolors[0] == gx_device_white(dev) ?
- rop3_know_S_1(rop_used) : rop_used);
- if (tcolors && (tcolors[0] == tcolors[1]))
- rop_used = (tcolors[0] == gx_device_black(dev) ?
- rop3_know_T_0(rop_used) :
- tcolors[0] == gx_device_white(dev) ?
- rop3_know_T_1(rop_used) : rop_used);
- slow_rop = !(rop == rop3_0 || rop == rop3_1 ||
+ gs_rop3_t rop_used = rop;
+
+ if (scolors && (scolors[0] == scolors[1]))
+ rop_used = (scolors[0] == gx_device_black(dev) ?
+ rop3_know_S_0(rop_used) :
+ scolors[0] == gx_device_white(dev) ?
+ rop3_know_S_1(rop_used) : rop_used);
+ if (tcolors && (tcolors[0] == tcolors[1]))
+ rop_used = (tcolors[0] == gx_device_black(dev) ?
+ rop3_know_T_0(rop_used) :
+ tcolors[0] == gx_device_white(dev) ?
+ rop3_know_T_1(rop_used) : rop_used);
+ slow_rop = !(rop == rop3_0 || rop == rop3_1 ||
rop == rop3_S || rop == rop3_T);
}
y0 = ry;
@@ -995,179 +991,179 @@ clist_strip_copy_rop(gx_device * dev,
return (cdev->permanent_error);
RECT_ENUM_INIT(re, ry, rheight);
do {
- const byte *row = sdata + (re.y - y0) * sraster;
- gx_color_index D;
- int code;
-
- RECT_STEP_INIT(re);
- D = re.pcls->colors_used.or;
- /* Reducing D, S, T to rop_operand (which apparently is 32 bit) appears safe
- due to 'all' a has smaller snumber of significant bits. */
- re.pcls->colors_used.or =
- ((rop_proc_table[color_rop])((rop_operand)D, (rop_operand)S, (rop_operand)T) & all) | D;
- re.pcls->colors_used.slow_rop |= slow_rop;
- re.pcls->band_complexity.nontrivial_rops |= slow_rop;
- if (rop3_uses_T(rop)) {
- if (tcolors == 0 || tcolors[0] != tcolors[1]) {
- ulong offset_temp;
-
- if (!cls_has_tile_id(cdev, re.pcls, tiles->id, offset_temp)) {
- /* Change tile. If there is no id, generate one. */
- if (tiles->id == gx_no_bitmap_id) {
- tile_with_id = *tiles;
- tile_with_id.id = gs_next_ids(dev->memory, 1);
- tiles = &tile_with_id;
- }
- do {
- code = clist_change_tile(cdev, re.pcls, tiles,
- (tcolors != 0 ? 1 :
- cdev->clist_color_info.depth));
- } while (RECT_RECOVER(code));
- if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
- goto error_in_rect;
- if (code < 0) {
- /*
- * The error is a limitcheck: we have a tile that
- * is too big to fit in the command reading buffer.
- * For now, just divide up the transfer into scan
- * lines. (If a single scan line won't fit, punt.)
- * Eventually, we'll need a way to transfer the tile
- * in pieces.
- */
- uint rep_height = tiles->rep_height;
- gs_id ids;
- gx_strip_bitmap line_tile;
- int data_shift = 0, phase_shift = 0, raster;
- int new_phase = phase_x;
- int tile_space_phase;
- int iy;
-
- if (rep_height == 1 ||
- /****** CAN'T HANDLE SHIFT YET ******/
- tiles->rep_shift != 0
- )
- return code;
- /*
- * Allocate enough fake IDs, since the inner call on
- * clist_strip_copy_rop will need them anyway.
- */
- ids = gs_next_ids(dev->memory, min(re.height, rep_height));
- line_tile = *tiles;
- line_tile.size.y = 1;
- line_tile.rep_height = 1;
- raster = line_tile.raster;
- /* The rasterizer assumes tile phase relatively to the rectangle origin,
- (see x_offset in gdevmr8n.c), so compute "the tile phase in the tile space"
- with same expression : */
- tile_space_phase = (rx + phase_x) % tiles->rep_width;
- if (tile_space_phase + rwidth <= tiles->rep_width) {
- /* Narrow the tile to prevent buffer overflow - bug 689588.
- Note currently we don't narrow "wrapped" tiles (because bug 689588 doesn't need) :
- when tile_space_phase < rep_width && tile_space_phase + rwidth > rep_width,
- each line to be converted into 2 ones.
- */
- int depth = cdev->clist_color_info.depth;
+ const byte *row = sdata + (re.y - y0) * sraster;
+ gx_color_index D;
+ int code;
+
+ RECT_STEP_INIT(re);
+ D = re.pcls->colors_used.or;
+ /* Reducing D, S, T to rop_operand (which apparently is 32 bit) appears safe
+ due to 'all' a has smaller snumber of significant bits. */
+ re.pcls->colors_used.or =
+ ((rop_proc_table[color_rop])((rop_operand)D, (rop_operand)S, (rop_operand)T) & all) | D;
+ re.pcls->colors_used.slow_rop |= slow_rop;
+ re.pcls->band_complexity.nontrivial_rops |= slow_rop;
+ if (rop3_uses_T(rop)) {
+ if (tcolors == 0 || tcolors[0] != tcolors[1]) {
+ ulong offset_temp;
+
+ if (!cls_has_tile_id(cdev, re.pcls, tiles->id, offset_temp)) {
+ /* Change tile. If there is no id, generate one. */
+ if (tiles->id == gx_no_bitmap_id) {
+ tile_with_id = *tiles;
+ tile_with_id.id = gs_next_ids(dev->memory, 1);
+ tiles = &tile_with_id;
+ }
+ do {
+ code = clist_change_tile(cdev, re.pcls, tiles,
+ (tcolors != 0 ? 1 :
+ cdev->clist_color_info.depth));
+ } while (RECT_RECOVER(code));
+ if (code < 0 && !(code == gs_error_limitcheck) && SET_BAND_CODE(code))
+ goto error_in_rect;
+ if (code < 0) {
+ /*
+ * The error is a limitcheck: we have a tile that
+ * is too big to fit in the command reading buffer.
+ * For now, just divide up the transfer into scan
+ * lines. (If a single scan line won't fit, punt.)
+ * Eventually, we'll need a way to transfer the tile
+ * in pieces.
+ */
+ uint rep_height = tiles->rep_height;
+ gs_id ids;
+ gx_strip_bitmap line_tile;
+ int data_shift = 0, phase_shift = 0, raster;
+ int new_phase = phase_x;
+ int tile_space_phase;
+ int iy;
+
+ if (rep_height == 1 ||
+ /****** CAN'T HANDLE SHIFT YET ******/
+ tiles->rep_shift != 0
+ )
+ return code;
+ /*
+ * Allocate enough fake IDs, since the inner call on
+ * clist_strip_copy_rop will need them anyway.
+ */
+ ids = gs_next_ids(dev->memory, min(re.height, rep_height));
+ line_tile = *tiles;
+ line_tile.size.y = 1;
+ line_tile.rep_height = 1;
+ raster = line_tile.raster;
+ /* The rasterizer assumes tile phase relatively to the rectangle origin,
+ (see x_offset in gdevmr8n.c), so compute "the tile phase in the tile space"
+ with same expression : */
+ tile_space_phase = (rx + phase_x) % tiles->rep_width;
+ if (tile_space_phase + rwidth <= tiles->rep_width) {
+ /* Narrow the tile to prevent buffer overflow - bug 689588.
+ Note currently we don't narrow "wrapped" tiles (because bug 689588 doesn't need) :
+ when tile_space_phase < rep_width && tile_space_phase + rwidth > rep_width,
+ each line to be converted into 2 ones.
+ */
+ int depth = cdev->clist_color_info.depth;
# if 0
- /* Align bitmap data : */
- data_shift = ((tile_space_phase * depth) >> (log2_align_bitmap_mod + 3)) << log2_align_bitmap_mod;
+ /* Align bitmap data : */
+ data_shift = ((tile_space_phase * depth) >> (log2_align_bitmap_mod + 3)) << log2_align_bitmap_mod;
# else
- data_shift = tile_space_phase * depth / 8; /* No bitmap data alignment because we'll only write it to clist. */
+ data_shift = tile_space_phase * depth / 8; /* No bitmap data alignment because we'll only write it to clist. */
# endif
- phase_shift = data_shift * 8 / depth;
- line_tile.rep_width = rwidth + (tile_space_phase - phase_shift);
- /* Normally line_tile.raster must account trailing row alignment bytes and
- to be computed as bitmap_raster(line_tile.rep_width * depth);
- but we can't apply it here because the trailing alignment bytes may be absent
- due to data_shift. We believe it is not harmful because we just write the data to clist,
- and because the bitmap height is 1.
- The clist reader must provide the trailing bytes if the rasterizer needs them.
- */
- line_tile.raster = (line_tile.rep_width * depth + 7) / 8;
- line_tile.size.x = line_tile.rep_width;
- line_tile.shift = 0;
- new_phase = (tile_space_phase - phase_shift - rx % line_tile.rep_width);
- /* Provide a positive phase for clist reader : */
- new_phase = (new_phase + line_tile.rep_width) % line_tile.rep_width;
- }
- for (iy = 0; iy < re.height; ++iy) {
- line_tile.data = tiles->data + raster *
- ((re.y + iy + phase_y) % rep_height) + data_shift;
- line_tile.id = ids + (iy % rep_height);
- ++cdev->driver_call_nesting;
- {
- code = clist_strip_copy_rop(dev,
- (sdata == 0 ? 0 : row + iy * sraster),
- sourcex, sraster,
- gx_no_bitmap_id, scolors,
- &line_tile, tcolors,
- rx, re.y + iy, rwidth, 1,
- new_phase, 0, lop);
- }
- --cdev->driver_call_nesting;
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- }
- continue;
- }
- if (((phase_x != re.pcls->tile_phase.x) && (tiles->rep_width > 1)) ||
- ((phase_y != re.pcls->tile_phase.y) && (tiles->rep_height > 1))) {
- do {
- code = cmd_set_tile_phase(cdev, re.pcls, phase_x,
- phase_y);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- }
- }
- }
- /* Set the tile colors. */
- do {
- code =
- (tcolors != 0 ?
- cmd_set_tile_colors(cdev, re.pcls, tcolors[0], tcolors[1]) :
- cmd_set_tile_colors(cdev, re.pcls, gx_no_color_index,
- gx_no_color_index));
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- }
- do {
- code = 0;
- if (lop != re.pcls->lop)
- code = cmd_set_lop(cdev, re.pcls, lop);
- if (code >= 0)
- code = cmd_enable_lop(cdev, re.pcls);
- } while (RECT_RECOVER(code));
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- /* Set lop_enabled to -1 so that fill_rectangle / copy_* */
- /* won't attempt to set it to 0. */
- re.pcls->lop_enabled = -1;
- ++cdev->driver_call_nesting;
- {
- if (scolors != 0) {
- if (scolors[0] == scolors[1])
- code = clist_fill_rectangle(dev, rx, re.y, rwidth, re.height,
- scolors[1]);
- else
- code = clist_copy_mono(dev, row, sourcex, sraster, id,
- rx, re.y, rwidth, re.height,
- scolors[0], scolors[1]);
- } else
- code = clist_copy_color(dev, row, sourcex, sraster, id,
- rx, re.y, rwidth, re.height);
- }
- --cdev->driver_call_nesting;
- re.pcls->lop_enabled = 1;
- if (code < 0 && SET_BAND_CODE(code))
- goto error_in_rect;
- continue;
+ phase_shift = data_shift * 8 / depth;
+ line_tile.rep_width = rwidth + (tile_space_phase - phase_shift);
+ /* Normally line_tile.raster must account trailing row alignment bytes and
+ to be computed as bitmap_raster(line_tile.rep_width * depth);
+ but we can't apply it here because the trailing alignment bytes may be absent
+ due to data_shift. We believe it is not harmful because we just write the data to clist,
+ and because the bitmap height is 1.
+ The clist reader must provide the trailing bytes if the rasterizer needs them.
+ */
+ line_tile.raster = (line_tile.rep_width * depth + 7) / 8;
+ line_tile.size.x = line_tile.rep_width;
+ line_tile.shift = 0;
+ new_phase = (tile_space_phase - phase_shift - rx % line_tile.rep_width);
+ /* Provide a positive phase for clist reader : */
+ new_phase = (new_phase + line_tile.rep_width) % line_tile.rep_width;
+ }
+ for (iy = 0; iy < re.height; ++iy) {
+ line_tile.data = tiles->data + raster *
+ ((re.y + iy + phase_y) % rep_height) + data_shift;
+ line_tile.id = ids + (iy % rep_height);
+ ++cdev->driver_call_nesting;
+ {
+ code = clist_strip_copy_rop(dev,
+ (sdata == 0 ? 0 : row + iy * sraster),
+ sourcex, sraster,
+ gx_no_bitmap_id, scolors,
+ &line_tile, tcolors,
+ rx, re.y + iy, rwidth, 1,
+ new_phase, 0, lop);
+ }
+ --cdev->driver_call_nesting;
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ }
+ continue;
+ }
+ if (((phase_x != re.pcls->tile_phase.x) && (tiles->rep_width > 1)) ||
+ ((phase_y != re.pcls->tile_phase.y) && (tiles->rep_height > 1))) {
+ do {
+ code = cmd_set_tile_phase(cdev, re.pcls, phase_x,
+ phase_y);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ }
+ }
+ }
+ /* Set the tile colors. */
+ do {
+ code =
+ (tcolors != 0 ?
+ cmd_set_tile_colors(cdev, re.pcls, tcolors[0], tcolors[1]) :
+ cmd_set_tile_colors(cdev, re.pcls, gx_no_color_index,
+ gx_no_color_index));
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ }
+ do {
+ code = 0;
+ if (lop != re.pcls->lop)
+ code = cmd_set_lop(cdev, re.pcls, lop);
+ if (code >= 0)
+ code = cmd_enable_lop(cdev, re.pcls);
+ } while (RECT_RECOVER(code));
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ /* Set lop_enabled to -1 so that fill_rectangle / copy_* */
+ /* won't attempt to set it to 0. */
+ re.pcls->lop_enabled = -1;
+ ++cdev->driver_call_nesting;
+ {
+ if (scolors != 0) {
+ if (scolors[0] == scolors[1])
+ code = clist_fill_rectangle(dev, rx, re.y, rwidth, re.height,
+ scolors[1]);
+ else
+ code = clist_copy_mono(dev, row, sourcex, sraster, id,
+ rx, re.y, rwidth, re.height,
+ scolors[0], scolors[1]);
+ } else
+ code = clist_copy_color(dev, row, sourcex, sraster, id,
+ rx, re.y, rwidth, re.height);
+ }
+ --cdev->driver_call_nesting;
+ re.pcls->lop_enabled = 1;
+ if (code < 0 && SET_BAND_CODE(code))
+ goto error_in_rect;
+ continue;
error_in_rect:
- if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
- SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
- return re.band_code;
- re.y -= re.height;
+ if (!(cdev->error_is_retryable && cdev->driver_call_nesting == 0 &&
+ SET_BAND_CODE(clist_VMerror_recover_flush(cdev, re.band_code)) >= 0))
+ return re.band_code;
+ re.y -= re.height;
} while ((re.y += re.height) < re.yend);
return 0;
}
diff --git a/gs/base/gxclthrd.c b/gs/base/gxclthrd.c
index ea2a8e364..822a7466c 100644
--- a/gs/base/gxclthrd.c
+++ b/gs/base/gxclthrd.c
@@ -72,7 +72,6 @@ clist_setup_render_threads(gx_device *dev, int y)
return_error(gs_error_VMerror);
}
-
memset(crdev->render_threads, 0, crdev->num_render_threads *
sizeof(clist_render_thread_control_t));
crdev->main_thread_data = cdev->data; /* save data area */
@@ -154,7 +153,7 @@ clist_setup_render_threads(gx_device *dev, int y)
code = devn_copy_params(dev, (gx_device*) ncdev);
if (code < 0) return_error(gs_error_VMerror);
}
- /* A question is, can the clist instances share the device profile.
+ /* A question is, can the clist instances share the device profile.
Only doing reads of this from different threads */
ncdev->device_icc_profile = cdev->device_icc_profile;
rc_increment(ncdev->device_icc_profile);
@@ -298,7 +297,7 @@ clist_teardown_render_threads(gx_device *dev)
gdev_prn_free_memory((gx_device *)thread_cdev);
/* Decrement the rc count on the icc profile */
rc_decrement(thread_cdev->device_icc_profile,"clist_teardown_render_threads");
- /* Free the device copy this thread used. Note that the
+ /* Free the device copy this thread used. Note that the
deviceN stuff if was allocated and copied earlier for the device
will be freed with this call */
gs_free_object(thread->memory, thread_cdev, "clist_teardown_render_threads");
diff --git a/gs/base/gxclthrd.h b/gs/base/gxclthrd.h
index 2316e68b9..4cf7748a0 100644
--- a/gs/base/gxclthrd.h
+++ b/gs/base/gxclthrd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,8 +30,8 @@ typedef struct clist_render_thread_control_s clist_render_thread_control_t;
#endif
struct clist_render_thread_control_s {
- int status; /* 0: not started, 1: done, 2: busy, < 0: error */
- /* values allow waiting until status < 2 */
+ int status; /* 0: not started, 1: done, 2: busy, < 0: error */
+ /* values allow waiting until status < 2 */
gs_memory_t *memory; /* thread's 'chunk' memory allocator */
gx_semaphore_t *sema_this;
gx_semaphore_t *sema_group;
diff --git a/gs/base/gxclutil.c b/gs/base/gxclutil.c
index 4bccd873a..7f307e389 100644
--- a/gs/base/gxclutil.c
+++ b/gs/base/gxclutil.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,14 +57,14 @@ cmd_count_op(int op, uint size)
stats_cmd.op_counts[op]++;
stats_cmd.op_sizes[op] += size;
if (gs_debug_c('L')) {
- const char *const *sub = cmd_sub_op_names[op >> 4];
-
- if (sub)
- dlprintf2(", %s(%u)\n", sub[op & 0xf], size);
- else
- dlprintf3(", %s %d(%u)\n", cmd_op_names[op >> 4], op & 0xf,
- size);
- dflush();
+ const char *const *sub = cmd_sub_op_names[op >> 4];
+
+ if (sub)
+ dlprintf2(", %s(%u)\n", sub[op & 0xf], size);
+ else
+ dlprintf3(", %s %d(%u)\n", cmd_op_names[op >> 4], op & 0xf,
+ size);
+ dflush();
}
return op;
}
@@ -84,40 +84,40 @@ cmd_print_stats(void)
int ci, cj;
dlprintf3("[l]counts: reset = %lu, found = %lu, added = %lu\n",
- stats_cmd.tile_reset, stats_cmd.tile_found,
- stats_cmd.tile_added);
+ stats_cmd.tile_reset, stats_cmd.tile_found,
+ stats_cmd.tile_added);
dlprintf5(" diff 2.5 = %lu, 3 = %lu, 4 = %lu, 2 = %lu, >4 = %lu\n",
- stats_cmd_diffs[0], stats_cmd_diffs[1], stats_cmd_diffs[2],
- stats_cmd_diffs[3], stats_cmd_diffs[4]);
+ stats_cmd_diffs[0], stats_cmd_diffs[1], stats_cmd_diffs[2],
+ stats_cmd_diffs[3], stats_cmd_diffs[4]);
dlprintf2(" same_band = %lu, other_band = %lu\n",
- stats_cmd.same_band, stats_cmd.other_band);
+ stats_cmd.same_band, stats_cmd.other_band);
for (ci = 0; ci < 0x100; ci += 0x10) {
- const char *const *sub = cmd_sub_op_names[ci >> 4];
-
- if (sub != 0) {
- dlprintf1("[l] %s =", cmd_op_names[ci >> 4]);
- for (cj = ci; cj < ci + 0x10; cj += 2)
- dprintf6("\n\t%s = %lu(%lu), %s = %lu(%lu)",
- sub[cj - ci],
- stats_cmd.op_counts[cj], stats_cmd.op_sizes[cj],
- sub[cj - ci + 1],
- stats_cmd.op_counts[cj + 1], stats_cmd.op_sizes[cj + 1]);
- } else {
- ulong tcounts = 0, tsizes = 0;
-
- for (cj = ci; cj < ci + 0x10; cj++)
- tcounts += stats_cmd.op_counts[cj],
- tsizes += stats_cmd.op_sizes[cj];
- dlprintf3("[l] %s (%lu,%lu) =\n\t",
- cmd_op_names[ci >> 4], tcounts, tsizes);
- for (cj = ci; cj < ci + 0x10; cj++)
- if (stats_cmd.op_counts[cj] == 0)
- dputs(" -");
- else
- dprintf2(" %lu(%lu)", stats_cmd.op_counts[cj],
- stats_cmd.op_sizes[cj]);
- }
- dputs("\n");
+ const char *const *sub = cmd_sub_op_names[ci >> 4];
+
+ if (sub != 0) {
+ dlprintf1("[l] %s =", cmd_op_names[ci >> 4]);
+ for (cj = ci; cj < ci + 0x10; cj += 2)
+ dprintf6("\n\t%s = %lu(%lu), %s = %lu(%lu)",
+ sub[cj - ci],
+ stats_cmd.op_counts[cj], stats_cmd.op_sizes[cj],
+ sub[cj - ci + 1],
+ stats_cmd.op_counts[cj + 1], stats_cmd.op_sizes[cj + 1]);
+ } else {
+ ulong tcounts = 0, tsizes = 0;
+
+ for (cj = ci; cj < ci + 0x10; cj++)
+ tcounts += stats_cmd.op_counts[cj],
+ tsizes += stats_cmd.op_sizes[cj];
+ dlprintf3("[l] %s (%lu,%lu) =\n\t",
+ cmd_op_names[ci >> 4], tcounts, tsizes);
+ for (cj = ci; cj < ci + 0x10; cj++)
+ if (stats_cmd.op_counts[cj] == 0)
+ dputs(" -");
+ else
+ dprintf2(" %lu(%lu)", stats_cmd.op_counts[cj],
+ stats_cmd.op_sizes[cj]);
+ }
+ dputs("\n");
}
}
#endif /* DEBUG */
@@ -127,53 +127,53 @@ cmd_print_stats(void)
/* Write the commands for one band or band range. */
static int /* ret 0 all ok, -ve error code, or +1 ok w/low-mem warning */
cmd_write_band(gx_device_clist_writer * cldev, int band_min, int band_max,
- cmd_list * pcl, gx_band_complexity_t *band_complexity, byte cmd_end)
+ cmd_list * pcl, gx_band_complexity_t *band_complexity, byte cmd_end)
{
const cmd_prefix *cp = pcl->head;
int code_b = 0;
int code_c = 0;
if (cp != 0 || cmd_end != cmd_opv_end_run) {
- clist_file_ptr cfile = cldev->page_cfile;
- clist_file_ptr bfile = cldev->page_bfile;
- cmd_block cb;
- byte end = cmd_count_op(cmd_end, 1);
-
- if (cfile == 0 || bfile == 0)
- return_error(gs_error_ioerror);
- cb.band_min = band_min;
- cb.band_max = band_max;
- cb.pos = cldev->page_info.io_procs->ftell(cfile);
- clist_copy_band_complexity(&cb.band_complexity, band_complexity);
- if_debug4('l', "[l]writing for bands (%d,%d) at %ld K %d \n",
- band_min, band_max, (long)cb.pos, cb.band_complexity.uses_color);
- cldev->page_info.io_procs->fwrite_chars(&cb, sizeof(cb), bfile);
- if (cp != 0) {
- pcl->tail->next = 0; /* terminate the list */
- for (; cp != 0; cp = cp->next) {
+ clist_file_ptr cfile = cldev->page_cfile;
+ clist_file_ptr bfile = cldev->page_bfile;
+ cmd_block cb;
+ byte end = cmd_count_op(cmd_end, 1);
+
+ if (cfile == 0 || bfile == 0)
+ return_error(gs_error_ioerror);
+ cb.band_min = band_min;
+ cb.band_max = band_max;
+ cb.pos = cldev->page_info.io_procs->ftell(cfile);
+ clist_copy_band_complexity(&cb.band_complexity, band_complexity);
+ if_debug4('l', "[l]writing for bands (%d,%d) at %ld K %d \n",
+ band_min, band_max, (long)cb.pos, cb.band_complexity.uses_color);
+ cldev->page_info.io_procs->fwrite_chars(&cb, sizeof(cb), bfile);
+ if (cp != 0) {
+ pcl->tail->next = 0; /* terminate the list */
+ for (; cp != 0; cp = cp->next) {
#ifdef DEBUG
- if ((const byte *)cp < cldev->cbuf ||
- (const byte *)cp >= cldev->cend ||
- cp->size > cldev->cend - (const byte *)cp
- ) {
- lprintf1("cmd_write_band error at 0x%lx\n", (ulong) cp);
- return_error(gs_error_Fatal);
- }
+ if ((const byte *)cp < cldev->cbuf ||
+ (const byte *)cp >= cldev->cend ||
+ cp->size > cldev->cend - (const byte *)cp
+ ) {
+ lprintf1("cmd_write_band error at 0x%lx\n", (ulong) cp);
+ return_error(gs_error_Fatal);
+ }
#endif
- if_debug2('L',"[L]Wrote cmd id=%ld at %ld\n", cp->id,
- (long)cldev->page_info.io_procs->ftell(cfile));
- cldev->page_info.io_procs->fwrite_chars(cp + 1, cp->size, cfile);
- }
- pcl->head = pcl->tail = 0;
- }
- cldev->page_info.io_procs->fwrite_chars(&end, 1, cfile);
- process_interrupts(cldev->memory);
- code_b = cldev->page_info.io_procs->ferror_code(bfile);
- code_c = cldev->page_info.io_procs->ferror_code(cfile);
- if (code_b < 0)
- return_error(code_b);
- if (code_c < 0)
- return_error(code_c);
+ if_debug2('L',"[L]Wrote cmd id=%ld at %ld\n", cp->id,
+ (long)cldev->page_info.io_procs->ftell(cfile));
+ cldev->page_info.io_procs->fwrite_chars(cp + 1, cp->size, cfile);
+ }
+ pcl->head = pcl->tail = 0;
+ }
+ cldev->page_info.io_procs->fwrite_chars(&end, 1, cfile);
+ process_interrupts(cldev->memory);
+ code_b = cldev->page_info.io_procs->ferror_code(bfile);
+ code_c = cldev->page_info.io_procs->ferror_code(cfile);
+ if (code_b < 0)
+ return_error(code_b);
+ if (code_c < 0)
+ return_error(code_c);
}
return code_b | code_c;
}
@@ -195,7 +195,7 @@ cmd_write_icctable(gx_device_clist_writer * cldev, unsigned char *pbuf, int data
if (cfile == 0 || bfile == 0)
return_error(gs_error_ioerror);
- /* Set up the command block information that
+ /* Set up the command block information that
is stored in the bfile. Note complexity information
is filled in but not used. */
@@ -206,7 +206,7 @@ cmd_write_icctable(gx_device_clist_writer * cldev, unsigned char *pbuf, int data
cb.pos = cldev->page_info.io_procs->ftell(cfile);
if_debug2('l', "[l]writing icc table band %d cb pos %ld\n",
- band, (long)cb.pos);
+ band, (long)cb.pos);
cldev->page_info.io_procs->fwrite_chars(&cb, sizeof(cb), bfile);
@@ -225,7 +225,7 @@ cmd_write_icctable(gx_device_clist_writer * cldev, unsigned char *pbuf, int data
if (code_b < 0)
return_error(code_b);
if (code_c < 0)
- return_error(code_c);
+ return_error(code_c);
return code_b | code_c;
@@ -239,27 +239,27 @@ cmd_write_buffer(gx_device_clist_writer * cldev, byte cmd_end)
gx_clist_state *pcls;
int band;
int code = cmd_write_band(cldev, cldev->band_range_min,
- cldev->band_range_max,
- &cldev->band_range_list,
- NULL,
- cmd_opv_end_run);
+ cldev->band_range_max,
+ &cldev->band_range_list,
+ NULL,
+ cmd_opv_end_run);
int warning = code;
for (band = 0, pcls = cldev->states;
- code >= 0 && band < nbands; band++, pcls++
- ) {
- code = cmd_write_band(cldev, band, band, &pcls->list, &pcls->band_complexity, cmd_end);
- warning |= code;
+ code >= 0 && band < nbands; band++, pcls++
+ ) {
+ code = cmd_write_band(cldev, band, band, &pcls->list, &pcls->band_complexity, cmd_end);
+ warning |= code;
}
/* If an error occurred, finish cleaning up the pointers. */
for (; band < nbands; band++, pcls++)
- pcls->list.head = pcls->list.tail = 0;
+ pcls->list.head = pcls->list.tail = 0;
cldev->cnext = cldev->cbuf;
cldev->ccl = 0;
#ifdef DEBUG
if (gs_debug_c('l'))
- cmd_print_stats();
+ cmd_print_stats();
#endif
return_check_interrupt(cldev->memory, code != 0 ? code : warning);
}
@@ -276,75 +276,75 @@ cmd_put_list_op(gx_device_clist_writer * cldev, cmd_list * pcl, uint size)
byte *dp = cldev->cnext;
if (size + cmd_headroom > cldev->cend - dp) {
- if ((cldev->error_code =
+ if ((cldev->error_code =
cmd_write_buffer(cldev, cmd_opv_end_run)) != 0 ||
(size + cmd_headroom > cldev->cend - cldev->cnext)) {
- if (cldev->error_code < 0)
- cldev->error_is_retryable = 0; /* hard error */
- else {
- /* upgrade lo-mem warning into an error */
- if (!cldev->ignore_lo_mem_warnings)
- cldev->error_code = gs_note_error(gs_error_VMerror);
- cldev->error_is_retryable = 1;
- }
- return 0;
- }
- else
- return cmd_put_list_op(cldev, pcl, size);
+ if (cldev->error_code < 0)
+ cldev->error_is_retryable = 0; /* hard error */
+ else {
+ /* upgrade lo-mem warning into an error */
+ if (!cldev->ignore_lo_mem_warnings)
+ cldev->error_code = gs_note_error(gs_error_VMerror);
+ cldev->error_is_retryable = 1;
+ }
+ return 0;
+ }
+ else
+ return cmd_put_list_op(cldev, pcl, size);
}
if (cldev->ccl == pcl) { /* We're adding another command for the same band. */
- /* Tack it onto the end of the previous one. */
- cmd_count_add1(stats_cmd.same_band);
+ /* Tack it onto the end of the previous one. */
+ cmd_count_add1(stats_cmd.same_band);
#ifdef DEBUG
- if (pcl->tail->size > dp - (byte *) (pcl->tail + 1)) {
- lprintf1("cmd_put_list_op error at 0x%lx\n", (ulong) pcl->tail);
- }
+ if (pcl->tail->size > dp - (byte *) (pcl->tail + 1)) {
+ lprintf1("cmd_put_list_op error at 0x%lx\n", (ulong) pcl->tail);
+ }
#endif
- if_debug2('L', ", to id=%ld , offset=%ld", pcl->tail->id, (long)pcl->tail->size);
- pcl->tail->size += size;
+ if_debug2('L', ", to id=%ld , offset=%ld", pcl->tail->id, (long)pcl->tail->size);
+ pcl->tail->size += size;
} else {
- /* Skip to an appropriate alignment boundary. */
- /* (We assume the command buffer itself is aligned.) */
- cmd_prefix *cp = (cmd_prefix *)
- (dp + ((cldev->cbuf - dp) & (ARCH_ALIGN_PTR_MOD - 1)));
-
- cmd_count_add1(stats_cmd.other_band);
- dp = (byte *) (cp + 1);
- if (pcl->tail != 0) {
+ /* Skip to an appropriate alignment boundary. */
+ /* (We assume the command buffer itself is aligned.) */
+ cmd_prefix *cp = (cmd_prefix *)
+ (dp + ((cldev->cbuf - dp) & (ARCH_ALIGN_PTR_MOD - 1)));
+
+ cmd_count_add1(stats_cmd.other_band);
+ dp = (byte *) (cp + 1);
+ if (pcl->tail != 0) {
#ifdef DEBUG
- if (pcl->tail < pcl->head ||
- pcl->tail->size > dp - (byte *) (pcl->tail + 1)
- ) {
- lprintf1("cmd_put_list_op error at 0x%lx\n",
- (ulong) pcl->tail);
- }
+ if (pcl->tail < pcl->head ||
+ pcl->tail->size > dp - (byte *) (pcl->tail + 1)
+ ) {
+ lprintf1("cmd_put_list_op error at 0x%lx\n",
+ (ulong) pcl->tail);
+ }
#endif
- pcl->tail->next = cp;
- } else
- pcl->head = cp;
- pcl->tail = cp;
- cldev->ccl = pcl;
- cp->size = size;
- cp->id = cldev->ins_count;
- if_debug1('L', ", id=%ld ", cldev->ins_count);
- cldev->ins_count++;
+ pcl->tail->next = cp;
+ } else
+ pcl->head = cp;
+ pcl->tail = cp;
+ cldev->ccl = pcl;
+ cp->size = size;
+ cp->id = cldev->ins_count;
+ if_debug1('L', ", id=%ld ", cldev->ins_count);
+ cldev->ins_count++;
}
cldev->cnext = dp + size;
return dp;
}
-/* Request a space in the buffer.
+/* Request a space in the buffer.
Writes out the buffer if necessary.
Returns the size of available space. */
int
cmd_get_buffer_space(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint size)
{
if (size + cmd_headroom > cldev->cend - cldev->cnext) {
- cldev->error_code = cmd_write_buffer(cldev, cmd_opv_end_run);
- if (cldev->error_code < 0) {
- cldev->error_is_retryable = 0; /* hard error */
- return cldev->error_code;
- }
+ cldev->error_code = cmd_write_buffer(cldev, cmd_opv_end_run);
+ if (cldev->error_code < 0) {
+ cldev->error_is_retryable = 0; /* hard error */
+ return cldev->error_code;
+ }
}
return cldev->cend - cldev->cnext - cmd_headroom;
}
@@ -354,8 +354,8 @@ byte *
cmd_put_op(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint size)
{
if_debug3('L', "[L]band %d: size=%u, left=%u",
- (int)(pcls - cldev->states),
- size, 0);
+ (int)(pcls - cldev->states),
+ size, 0);
return cmd_put_list_op(cldev, &pcls->list, size);
}
#endif
@@ -363,27 +363,27 @@ cmd_put_op(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint size)
/* Add a command for a range of bands. */
byte *
cmd_put_range_op(gx_device_clist_writer * cldev, int band_min, int band_max,
- uint size)
+ uint size)
{
if_debug4('L', "[L]band range(%d,%d): size=%u, left=%u",
- band_min, band_max, size, 0);
- if (cldev->ccl != 0 &&
- (cldev->ccl != &cldev->band_range_list ||
- band_min != cldev->band_range_min ||
- band_max != cldev->band_range_max)
- ) {
- if ((cldev->error_code = cmd_write_buffer(cldev, cmd_opv_end_run)) != 0) {
- if (cldev->error_code < 0)
- cldev->error_is_retryable = 0; /* hard error */
- else {
- /* upgrade lo-mem warning into an error */
- cldev->error_code = gs_error_VMerror;
- cldev->error_is_retryable = 1;
- }
- return 0;
- }
- cldev->band_range_min = band_min;
- cldev->band_range_max = band_max;
+ band_min, band_max, size, 0);
+ if (cldev->ccl != 0 &&
+ (cldev->ccl != &cldev->band_range_list ||
+ band_min != cldev->band_range_min ||
+ band_max != cldev->band_range_max)
+ ) {
+ if ((cldev->error_code = cmd_write_buffer(cldev, cmd_opv_end_run)) != 0) {
+ if (cldev->error_code < 0)
+ cldev->error_is_retryable = 0; /* hard error */
+ else {
+ /* upgrade lo-mem warning into an error */
+ cldev->error_code = gs_error_VMerror;
+ cldev->error_is_retryable = 1;
+ }
+ return 0;
+ }
+ cldev->band_range_min = band_min;
+ cldev->band_range_max = band_max;
}
return cmd_put_list_op(cldev, &cldev->band_range_list, size);
}
@@ -395,14 +395,14 @@ cmd_size_w(register uint w)
register int size = 1;
while (w > 0x7f)
- w >>= 7, size++;
+ w >>= 7, size++;
return size;
}
byte *
cmd_put_w(register uint w, register byte * dp)
{
while (w > 0x7f)
- *dp++ = w | 0x80, w >>= 7;
+ *dp++ = w | 0x80, w >>= 7;
*dp = w;
return dp + 1;
}
@@ -414,7 +414,7 @@ cmd_size_frac31(register frac31 w)
register uint32_t v = w;
while (v & 0x01FFFFFF)
- v <<= 7, size++;
+ v <<= 7, size++;
return size;
}
byte *
@@ -423,13 +423,11 @@ cmd_put_frac31(register frac31 w, register byte * dp)
register uint32_t v = w;
while (v & 0x01FFFFFF)
- *dp++ = (v >> 24) | 1, v <<= 7;
+ *dp++ = (v >> 24) | 1, v <<= 7;
*dp = (v >> 24);
return dp + 1;
}
-
-
/*
* This next two arrays are used for the 'delta' mode of placing a color
* in the clist. These arrays are indexed by the number of bytes in the
@@ -455,28 +453,28 @@ cmd_put_frac31(register frac31 w, register byte * dp)
#define tab_entry(x) ((x) & (~((gx_color_index) 0)))
const gx_color_index cmd_delta_offsets[] = {
- tab_entry(0),
- tab_entry(0),
- tab_entry(0x0808),
- tab_entry(0x102010),
- tab_entry(0x08080808),
- tab_entry(0x1020100808),
- tab_entry(0x080808080808),
- tab_entry(0x10201008080808),
- tab_entry(0x0808080808080808),
- };
+ tab_entry(0),
+ tab_entry(0),
+ tab_entry(0x0808),
+ tab_entry(0x102010),
+ tab_entry(0x08080808),
+ tab_entry(0x1020100808),
+ tab_entry(0x080808080808),
+ tab_entry(0x10201008080808),
+ tab_entry(0x0808080808080808),
+ };
static const gx_color_index cmd_delta_masks[] = {
- tab_entry(0),
- tab_entry(0),
- tab_entry(0x0f0f),
- tab_entry(0x1f3f1f),
- tab_entry(0x0f0f0f0f),
- tab_entry(0x1f3f1f0f0f),
- tab_entry(0x0f0f0f0f0f0f),
- tab_entry(0x1f3f1f0f0f0f0f),
- tab_entry(0x0f0f0f0f0f0f0f0f),
- };
+ tab_entry(0),
+ tab_entry(0),
+ tab_entry(0x0f0f),
+ tab_entry(0x1f3f1f),
+ tab_entry(0x0f0f0f0f),
+ tab_entry(0x1f3f1f0f0f),
+ tab_entry(0x0f0f0f0f0f0f),
+ tab_entry(0x1f3f1f0f0f0f0f),
+ tab_entry(0x0f0f0f0f0f0f0f0f),
+ };
#undef tab_entry
@@ -524,8 +522,8 @@ const clist_select_color_t
*/
int
cmd_put_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- const clist_select_color_t * select,
- gx_color_index color, gx_color_index * pcolor)
+ const clist_select_color_t * select,
+ gx_color_index color, gx_color_index * pcolor)
{
byte * dp; /* This is manipulated by the set_cmd_put_op macro */
gx_color_index diff = color - *pcolor;
@@ -533,111 +531,110 @@ cmd_put_color(gx_device_clist_writer * cldev, gx_clist_state * pcls,
int code;
if (diff == 0)
- return 0;
+ return 0;
/* If this is a tile color then send tile color type */
if (select->tile_color) {
- code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_tile_color, 1);
- if (code < 0)
- return code;
+ code = set_cmd_put_op(dp, cldev, pcls, cmd_opv_set_tile_color, 1);
+ if (code < 0)
+ return code;
}
op = select->set_op;
op_delta = select->delta_op;
if (color == gx_no_color_index) {
- /*
- * We must handle this specially, because it may take more
- * bytes than the color depth.
- */
- code = set_cmd_put_op(dp, cldev, pcls, op + cmd_no_color_index, 1);
- if (code < 0)
- return code;
+ /*
+ * We must handle this specially, because it may take more
+ * bytes than the color depth.
+ */
+ code = set_cmd_put_op(dp, cldev, pcls, op + cmd_no_color_index, 1);
+ if (code < 0)
+ return code;
} else {
- /* Check if the "delta" mode command can be used. */
- int num_bytes = (cldev->clist_color_info.depth + 7) >> 3; /* clist_color_info may be different than target device
+ /* Check if the "delta" mode command can be used. */
+ int num_bytes = (cldev->clist_color_info.depth + 7) >> 3; /* clist_color_info may be different than target device
due to transparency group during clist writing phase */
- int delta_bytes = (num_bytes + 1) / 2;
- gx_color_index delta_offset = cmd_delta_offsets[num_bytes];
- gx_color_index delta_mask = cmd_delta_masks[num_bytes];
- gx_color_index delta = (diff + delta_offset) & delta_mask;
- bool use_delta = (color == (*pcolor + delta - delta_offset));
- int bytes_dropped = 0;
- gx_color_index data = color;
-
- /*
- * If we use the full value mode, we do not send low order bytes
- * which are zero. Determine how many low order bytes are zero.
- */
- if (color == 0) {
- bytes_dropped = num_bytes;
- }
- else {
- while ((data & 0xff) == 0) {
- bytes_dropped++;
- data >>= 8;
- }
- }
- /* Now send one of the two command forms */
- if (use_delta && delta_bytes < (num_bytes - bytes_dropped)) {
- code = set_cmd_put_op(dp, cldev, pcls,
- op_delta, delta_bytes + 1);
- if (code < 0)
- return code;
- /*
- * If we have an odd number of bytes then use extra bits for
- * the high order three bytes of the color.
- */
- if ((num_bytes >= 3) && (num_bytes & 1)) {
- data = delta >> ((num_bytes - 3) * 8);
- dp[delta_bytes--] = (byte)(((data >> 13) & 0xf8) + ((data >> 11) & 0x07));
- dp[delta_bytes--] = (byte)(((data >> 3) & 0xe0) + (data & 0x1f));
- }
- for(; delta_bytes>0; delta_bytes--) {
- dp[delta_bytes] = (byte)((delta >> 4) + delta);
- delta >>= 16;
- }
- }
- else {
- num_bytes -= bytes_dropped;
- code = set_cmd_put_op(dp, cldev, pcls,
- (byte)(op + bytes_dropped), num_bytes + 1);
- if (code < 0)
- return code;
- for(; num_bytes>0; num_bytes--) {
- dp[num_bytes] = (byte)data;
- data >>= 8;
- }
- }
+ int delta_bytes = (num_bytes + 1) / 2;
+ gx_color_index delta_offset = cmd_delta_offsets[num_bytes];
+ gx_color_index delta_mask = cmd_delta_masks[num_bytes];
+ gx_color_index delta = (diff + delta_offset) & delta_mask;
+ bool use_delta = (color == (*pcolor + delta - delta_offset));
+ int bytes_dropped = 0;
+ gx_color_index data = color;
+
+ /*
+ * If we use the full value mode, we do not send low order bytes
+ * which are zero. Determine how many low order bytes are zero.
+ */
+ if (color == 0) {
+ bytes_dropped = num_bytes;
+ }
+ else {
+ while ((data & 0xff) == 0) {
+ bytes_dropped++;
+ data >>= 8;
+ }
+ }
+ /* Now send one of the two command forms */
+ if (use_delta && delta_bytes < (num_bytes - bytes_dropped)) {
+ code = set_cmd_put_op(dp, cldev, pcls,
+ op_delta, delta_bytes + 1);
+ if (code < 0)
+ return code;
+ /*
+ * If we have an odd number of bytes then use extra bits for
+ * the high order three bytes of the color.
+ */
+ if ((num_bytes >= 3) && (num_bytes & 1)) {
+ data = delta >> ((num_bytes - 3) * 8);
+ dp[delta_bytes--] = (byte)(((data >> 13) & 0xf8) + ((data >> 11) & 0x07));
+ dp[delta_bytes--] = (byte)(((data >> 3) & 0xe0) + (data & 0x1f));
+ }
+ for(; delta_bytes>0; delta_bytes--) {
+ dp[delta_bytes] = (byte)((delta >> 4) + delta);
+ delta >>= 16;
+ }
+ }
+ else {
+ num_bytes -= bytes_dropped;
+ code = set_cmd_put_op(dp, cldev, pcls,
+ (byte)(op + bytes_dropped), num_bytes + 1);
+ if (code < 0)
+ return code;
+ for(; num_bytes>0; num_bytes--) {
+ dp[num_bytes] = (byte)data;
+ data >>= 8;
+ }
+ }
}
*pcolor = color;
return 0;
}
-
/* Put out a command to set the tile colors. */
int
cmd_set_tile_colors(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- gx_color_index color0, gx_color_index color1)
+ gx_color_index color0, gx_color_index color1)
{
int code = 0;
if (color0 != pcls->tile_colors[0]) {
- code = cmd_put_color(cldev, pcls,
- &clist_select_tile_color0,
- color0, &pcls->tile_colors[0]);
- if (code != 0)
- return code;
+ code = cmd_put_color(cldev, pcls,
+ &clist_select_tile_color0,
+ color0, &pcls->tile_colors[0]);
+ if (code != 0)
+ return code;
}
if (color1 != pcls->tile_colors[1])
- code = cmd_put_color(cldev, pcls,
- &clist_select_tile_color1,
- color1, &pcls->tile_colors[1]);
+ code = cmd_put_color(cldev, pcls,
+ &clist_select_tile_color1,
+ color1, &pcls->tile_colors[1]);
return code;
}
/* Put out a command to set the tile phase. */
int
cmd_set_tile_phase_generic(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int px, int py, bool all_bands)
+ int px, int py, bool all_bands)
{
int pcsize;
byte *dp;
@@ -645,11 +642,11 @@ cmd_set_tile_phase_generic(gx_device_clist_writer * cldev, gx_clist_state * pcls
pcsize = 1 + cmd_size2w(px, py);
if (all_bands)
- code = set_cmd_put_all_op(dp, cldev, (byte)cmd_opv_set_tile_phase, pcsize);
+ code = set_cmd_put_all_op(dp, cldev, (byte)cmd_opv_set_tile_phase, pcsize);
else
- code = set_cmd_put_op(dp, cldev, pcls, (byte)cmd_opv_set_tile_phase, pcsize);
+ code = set_cmd_put_op(dp, cldev, pcls, (byte)cmd_opv_set_tile_phase, pcsize);
if (code < 0)
- return code;
+ return code;
++dp;
pcls->tile_phase.x = px;
pcls->tile_phase.y = py;
@@ -659,25 +656,24 @@ cmd_set_tile_phase_generic(gx_device_clist_writer * cldev, gx_clist_state * pcls
int
cmd_set_tile_phase(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int px, int py)
+ int px, int py)
{
return cmd_set_tile_phase_generic(cldev, pcls, px, py, false);
}
-
/* Write a command to enable or disable the logical operation. */
int
cmd_put_enable_lop(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int enable)
+ int enable)
{
byte *dp;
int code = set_cmd_put_op(dp, cldev, pcls,
- (byte)(enable ? cmd_opv_enable_lop :
- cmd_opv_disable_lop),
- 1);
+ (byte)(enable ? cmd_opv_enable_lop :
+ cmd_opv_disable_lop),
+ 1);
if (code < 0)
- return code;
+ return code;
pcls->lop_enabled = enable;
return 0;
}
@@ -686,16 +682,16 @@ cmd_put_enable_lop(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* This routine is only called if the path extensions are included. */
int
cmd_put_enable_clip(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- int enable)
+ int enable)
{
byte *dp;
int code = set_cmd_put_op(dp, cldev, pcls,
- (byte)(enable ? cmd_opv_enable_clip :
- cmd_opv_disable_clip),
- 1);
+ (byte)(enable ? cmd_opv_enable_clip :
+ cmd_opv_disable_clip),
+ 1);
if (code < 0)
- return code;
+ return code;
pcls->clip_enabled = enable;
return 0;
}
@@ -703,15 +699,15 @@ cmd_put_enable_clip(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* Write a command to set the logical operation. */
int
cmd_set_lop(gx_device_clist_writer * cldev, gx_clist_state * pcls,
- gs_logical_operation_t lop)
+ gs_logical_operation_t lop)
{
byte *dp;
uint lop_msb = lop >> 6;
int code = set_cmd_put_op(dp, cldev, pcls,
- cmd_opv_set_misc, 2 + cmd_size_w(lop_msb));
+ cmd_opv_set_misc, 2 + cmd_size_w(lop_msb));
if (code < 0)
- return code;
+ return code;
dp[1] = cmd_set_misc_lop + (lop & 0x3f);
cmd_put_w(lop_msb, dp + 2);
pcls->lop = lop;
@@ -722,22 +718,22 @@ cmd_set_lop(gx_device_clist_writer * cldev, gx_clist_state * pcls,
/* needed. */
int
cmd_update_lop(gx_device_clist_writer *cldev, gx_clist_state *pcls,
- gs_logical_operation_t lop)
+ gs_logical_operation_t lop)
{
int code;
if (lop == lop_default)
- return cmd_disable_lop(cldev, pcls);
+ return cmd_disable_lop(cldev, pcls);
code = cmd_set_lop(cldev, pcls, lop);
if (code < 0)
- return code;
+ return code;
return cmd_enable_lop(cldev, pcls);
}
/* Write a parameter list */
int /* ret 0 all ok, -ve error */
cmd_put_params(gx_device_clist_writer *cldev,
- gs_param_list *param_list) /* NB open for READ */
+ gs_param_list *param_list) /* NB open for READ */
{
byte *dp;
int code;
@@ -746,36 +742,36 @@ cmd_put_params(gx_device_clist_writer *cldev,
/* Get serialized list's length + try to get it into local var if it fits. */
param_length = code =
- gs_param_list_serialize(param_list, local_buf, sizeof(local_buf));
+ gs_param_list_serialize(param_list, local_buf, sizeof(local_buf));
if (param_length > 0) {
- /* Get cmd buffer space for serialized */
- code = set_cmd_put_all_op(dp, cldev, cmd_opv_extend,
- 2 + sizeof(unsigned) + param_length);
- if (code < 0)
- return code;
-
- /* write param list to cmd list: needs to all fit in cmd buffer */
- if_debug1('l', "[l]put_params, length=%d\n", param_length);
- dp[1] = cmd_opv_ext_put_params;
- dp += 2;
- memcpy(dp, &param_length, sizeof(unsigned));
- dp += sizeof(unsigned);
- if (param_length > sizeof(local_buf)) {
- int old_param_length = param_length;
-
- param_length = code =
- gs_param_list_serialize(param_list, dp, old_param_length);
- if (param_length >= 0)
- code = (old_param_length != param_length ?
- gs_note_error(gs_error_unknownerror) : 0);
- if (code < 0) {
- /* error serializing: back out by writing a 0-length parm list */
- memset(dp - sizeof(unsigned), 0, sizeof(unsigned));
- cmd_shorten_list_op(cldev, &cldev->band_range_list,
- old_param_length);
- }
- } else
- memcpy(dp, local_buf, param_length); /* did this when computing length */
+ /* Get cmd buffer space for serialized */
+ code = set_cmd_put_all_op(dp, cldev, cmd_opv_extend,
+ 2 + sizeof(unsigned) + param_length);
+ if (code < 0)
+ return code;
+
+ /* write param list to cmd list: needs to all fit in cmd buffer */
+ if_debug1('l', "[l]put_params, length=%d\n", param_length);
+ dp[1] = cmd_opv_ext_put_params;
+ dp += 2;
+ memcpy(dp, &param_length, sizeof(unsigned));
+ dp += sizeof(unsigned);
+ if (param_length > sizeof(local_buf)) {
+ int old_param_length = param_length;
+
+ param_length = code =
+ gs_param_list_serialize(param_list, dp, old_param_length);
+ if (param_length >= 0)
+ code = (old_param_length != param_length ?
+ gs_note_error(gs_error_unknownerror) : 0);
+ if (code < 0) {
+ /* error serializing: back out by writing a 0-length parm list */
+ memset(dp - sizeof(unsigned), 0, sizeof(unsigned));
+ cmd_shorten_list_op(cldev, &cldev->band_range_list,
+ old_param_length);
+ }
+ } else
+ memcpy(dp, local_buf, param_length); /* did this when computing length */
}
return code;
}
@@ -787,7 +783,7 @@ clist_cf_init(stream_CF_state *ss, int width)
ss->K = -1;
ss->Columns = width;
#if 0 /* Disabled due to a crash with ppmraw -r216 c327.bin :
- the decoding filter overruns in 1 byte.
+ the decoding filter overruns in 1 byte.
*/
ss->EndOfBlock = false;
#else
@@ -841,4 +837,3 @@ cmd_read_matrix(gs_matrix * pmat, const byte * cbp)
sget_matrix(&s, pmat);
return cbp + stell(&s);
}
-
diff --git a/gs/base/gxcmap.c b/gs/base/gxcmap.c
index 0127bfa52..78616a671 100644
--- a/gs/base/gxcmap.c
+++ b/gs/base/gxcmap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,10 +35,10 @@
/* Structure descriptor */
public_st_device_color();
-static
+static
ENUM_PTRS_WITH(device_color_enum_ptrs, gx_device_color *cptr)
{
- return ENUM_USING(*cptr->type->stype, vptr, size, index);
+ return ENUM_USING(*cptr->type->stype, vptr, size, index);
}
ENUM_PTRS_END
static RELOC_PTRS_WITH(device_color_reloc_ptrs, gx_device_color *cptr)
@@ -63,14 +63,14 @@ gx_default_encode_color(gx_device * dev, const gx_color_value cv[])
}
#endif
for (i = 0; i < ncomps; i++) {
- color |= (gx_color_index)(cv[i] >> (gx_color_value_bits - comp_bits[i]))
- << comp_shift[i];
+ color |= (gx_color_index)(cv[i] >> (gx_color_value_bits - comp_bits[i]))
+ << comp_shift[i];
}
return color;
}
-/*
+/*
* This routine is only used if the device is 'separable'. See
* separable_and_linear in gxdevcli.h for more information.
*/
@@ -92,23 +92,23 @@ gx_default_decode_color(gx_device * dev, gx_color_index color, gx_color_value cv
#endif
for (i = 0; i < ncomps; i++) {
- /*
- * Convert from the gx_color_index bits to a gx_color_value.
- * Split the conversion into an integer and a fraction calculation
- * so we can do integer arthmetic. The calculation is equivalent
- * to floor(0xffff.fffff * ivalue / ((1 << nbits) - 1))
- */
- nbits = comp_bits[i];
- scale = gx_max_color_value / ((1 << nbits) - 1);
- ivalue = (color & comp_mask[i]) >> comp_shift[i];
- cv[i] = ivalue * scale;
- /*
- * Since our scaling factor is an integer, we lost the fraction.
- * Determine what part of the ivalue that the faction would have
- * added into the result.
- */
- shift = nbits - (gx_color_value_bits % nbits);
- cv[i] += ivalue >> shift;
+ /*
+ * Convert from the gx_color_index bits to a gx_color_value.
+ * Split the conversion into an integer and a fraction calculation
+ * so we can do integer arthmetic. The calculation is equivalent
+ * to floor(0xffff.fffff * ivalue / ((1 << nbits) - 1))
+ */
+ nbits = comp_bits[i];
+ scale = gx_max_color_value / ((1 << nbits) - 1);
+ ivalue = (color & comp_mask[i]) >> comp_shift[i];
+ cv[i] = ivalue * scale;
+ /*
+ * Since our scaling factor is an integer, we lost the fraction.
+ * Determine what part of the ivalue that the faction would have
+ * added into the result.
+ */
+ shift = nbits - (gx_color_value_bits % nbits);
+ cv[i] += ivalue >> shift;
}
return 0;
}
@@ -119,7 +119,7 @@ gx_error_encode_color(gx_device * dev, const gx_color_value colors[])
#ifdef DEBUG
/* The "null" device is expected to be missing encode_color */
if (strcmp(dev->dname, "null") != 0)
- dprintf("No encode_color proc defined for device.\n");
+ dprintf("No encode_color proc defined for device.\n");
#endif
return gx_no_color_index;
}
@@ -128,12 +128,12 @@ int
gx_error_decode_color(gx_device * dev, gx_color_index cindex, gx_color_value colors[])
{
int i=dev->color_info.num_components;
-
+
#ifdef DEBUG
dprintf("No decode_color proc defined for device.\n");
#endif
for(; i>=0; i--)
- colors[i] = 0;
+ colors[i] = 0;
return gs_error_rangecheck;
}
@@ -179,7 +179,7 @@ gx_default_gray_encode(gx_device * dev, const gx_color_value cv[])
**/
gx_color_index
gx_backwards_compatible_gray_encode(gx_device *dev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_value gray_val = cv[0];
gx_color_value rgb_cv[3];
@@ -200,7 +200,7 @@ gray_cs_to_gray_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_gray_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
out[0] = color_rgb_to_gray(r, g, b, NULL);
}
@@ -219,7 +219,7 @@ gray_cs_to_rgb_cm(gx_device * dev, frac gray, frac out[])
void
rgb_cs_to_rgb_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
out[0] = r;
out[1] = g;
@@ -241,17 +241,17 @@ gray_cs_to_rgbk_cm(gx_device * dev, frac gray, frac out[])
static void
rgb_cs_to_rgbk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
if ((r == g) && (g == b)) {
- out[0] = out[1] = out[2] = frac_0;
- out[3] = r;
+ out[0] = out[1] = out[2] = frac_0;
+ out[3] = r;
}
else {
- out[0] = r;
- out[1] = g;
- out[2] = b;
- out[3] = frac_0;
+ out[0] = r;
+ out[1] = g;
+ out[2] = b;
+ out[3] = frac_0;
}
}
@@ -260,12 +260,12 @@ cmyk_cs_to_rgbk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
{
frac rgb[3];
if ((c == frac_0) && (m == frac_0) && (y == frac_0)) {
- out[0] = out[1] = out[2] = frac_0;
- out[3] = frac_1 - k;
+ out[0] = out[1] = out[2] = frac_0;
+ out[3] = frac_1 - k;
}
else {
- color_cmyk_to_rgb(c, m, y, k, NULL, rgb, dev->memory);
- rgb_cs_to_rgbk_cm(dev, NULL, rgb[0], rgb[1], rgb[2], out);
+ color_cmyk_to_rgb(c, m, y, k, NULL, rgb, dev->memory);
+ rgb_cs_to_rgbk_cm(dev, NULL, rgb[0], rgb[1], rgb[2], out);
}
}
@@ -293,7 +293,7 @@ gray_cs_to_cmyk_cm(gx_device * dev, frac gray, frac out[])
*/
static void
rgb_cs_to_cmyk_cm(gx_device * dev, const gs_imager_state *pis,
- frac r, frac g, frac b, frac out[])
+ frac r, frac g, frac b, frac out[])
{
if (pis != 0)
color_rgb_to_cmyk(r, g, b, pis, out, dev->memory);
@@ -317,7 +317,6 @@ cmyk_cs_to_cmyk_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[])
out[3] = k;
}
-
/* The list of default color space to color model conversion routines. */
static const gx_cm_color_map_procs DeviceGray_procs = {
@@ -377,17 +376,17 @@ gx_error_get_color_mapping_procs(const gx_device * dev)
dev->dname);
switch (dev->color_info.num_components) {
case 1: /* DeviceGray or DeviceInvertGray */
- return gx_default_DevGray_get_color_mapping_procs(dev);
+ return gx_default_DevGray_get_color_mapping_procs(dev);
case 3:
- return gx_default_DevRGB_get_color_mapping_procs(dev);
+ return gx_default_DevRGB_get_color_mapping_procs(dev);
case 4:
default: /* Unknown color model - punt with CMYK */
return gx_default_DevCMYK_get_color_mapping_procs(dev);
}
}
-
+
/* ----- Default color component name to colorant index conversion routines ------ */
#define compare_color_names(pname, name_size, name_str) \
@@ -396,10 +395,10 @@ gx_error_get_color_mapping_procs(const gx_device * dev)
/* Default color component to index for a DeviceGray color model */
int
gx_default_DevGray_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
if (compare_color_names(pname, name_size, "Gray") ||
- compare_color_names(pname, name_size, "Grey"))
+ compare_color_names(pname, name_size, "Grey"))
return 0;
else
return -1; /* Indicate that the component name is "unknown" */
@@ -408,7 +407,7 @@ gx_default_DevGray_get_color_comp_index(gx_device * dev, const char * pname,
/* Default color component to index for a DeviceRGB color model */
int
gx_default_DevRGB_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
if (compare_color_names(pname, name_size, "Red"))
return 0;
@@ -423,7 +422,7 @@ gx_default_DevRGB_get_color_comp_index(gx_device * dev, const char * pname,
/* Default color component to index for a DeviceCMYK color model */
int
gx_default_DevCMYK_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
if (compare_color_names(pname, name_size, "Cyan"))
return 0;
@@ -440,7 +439,7 @@ gx_default_DevCMYK_get_color_comp_index(gx_device * dev, const char * pname,
/* Default color component to index for a DeviceRGBK color model */
int
gx_default_DevRGBK_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
if (compare_color_names(pname, name_size, "Red"))
return 0;
@@ -457,7 +456,7 @@ gx_default_DevRGBK_get_color_comp_index(gx_device * dev, const char * pname,
/* Default color component to index for an unknown color model */
int
gx_error_get_color_comp_index(gx_device * dev, const char * pname,
- int name_size, int component_type)
+ int name_size, int component_type)
{
/*
* We should never get here. If we do then we do not have a "get_color_comp_index"
@@ -499,8 +498,8 @@ static cmap_proc_is_halftoned(cmap_halftoned_is_halftoned);
static cmap_proc_is_halftoned(cmap_direct_is_halftoned);
static const gx_color_map_procs cmap_few = {
- cmap_gray_halftoned,
- cmap_rgb_halftoned,
+ cmap_gray_halftoned,
+ cmap_rgb_halftoned,
cmap_cmyk_halftoned,
cmap_rgb_alpha_halftoned,
cmap_separation_halftoned,
@@ -519,7 +518,6 @@ static const gx_color_map_procs cmap_many = {
const gx_color_map_procs *const cmap_procs_default = &cmap_many;
-
/* Determine the color mapping procedures for a device. */
/* Note that the default procedure doesn't consult the imager state. */
const gx_color_map_procs *
@@ -551,12 +549,12 @@ gx_remap_color(gs_state * pgs)
/* The current color in the graphics state is always used for */
/* the texture, never for the source. */
code = (*pcs->type->remap_color) (gs_currentcolor_inline(pgs),
- pcs, gs_currentdevicecolor_inline(pgs),
- (gs_imager_state *) pgs, pgs->device,
- gs_color_select_texture);
+ pcs, gs_currentdevicecolor_inline(pgs),
+ (gs_imager_state *) pgs, pgs->device,
+ gs_color_select_texture);
/* if overprint mode is in effect, update the overprint information */
if (code >= 0 && pgs->effective_overprint_mode == 1)
- code = gs_do_set_overprint(pgs);
+ code = gs_do_set_overprint(pgs);
return code;
}
@@ -577,7 +575,7 @@ gx_same_concrete_space(const gs_color_space * pcs, const gs_imager_state * pis)
/* Indicate that a color cannot be concretized. */
int
gx_no_concretize_color(const gs_client_color * pcc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
return_error(gs_error_rangecheck);
}
@@ -586,8 +584,8 @@ gx_no_concretize_color(const gs_client_color * pcc, const gs_color_space * pcs,
/* remapping the concrete color. */
int
gx_default_remap_color(const gs_client_color * pcc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
frac conc[GS_CLIENT_COLOR_MAX_COMPONENTS];
const gs_color_space *pconcs;
@@ -595,14 +593,14 @@ gx_default_remap_color(const gs_client_color * pcc, const gs_color_space * pcs,
int code = (*pcs->type->concretize_color)(pcc, pcs, conc, pis, dev);
if (code < 0)
- return code;
+ return code;
pconcs = cs_concrete_space(pcs, pis);
code = (*pconcs->type->remap_concrete_color)(conc, pconcs, pdc, pis, dev, select);
/* Save original color space and color info into dev color */
i = any_abs(i);
for (i--; i >= 0; i--)
- pdc->ccolor.paint.values[i] = pcc->paint.values[i];
+ pdc->ccolor.paint.values[i] = pcc->paint.values[i];
pdc->ccolor_valid = true;
return code;
}
@@ -611,33 +609,32 @@ gx_default_remap_color(const gs_client_color * pcc, const gs_color_space * pcs,
/* Note that we use D... instead of Device... in some places because */
/* gcc under VMS only retains 23 characters of procedure names. */
-
/* DeviceGray */
int
gx_concretize_DeviceGray(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
pconc[0] = gx_unit_frac(pc->paint.values[0]);
return 0;
}
int
gx_remap_concrete_DGray(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
if (pis->alpha == gx_max_color_value)
- (*pis->cmap_procs->map_gray)
- (pconc[0], pdc, pis, dev, select);
+ (*pis->cmap_procs->map_gray)
+ (pconc[0], pdc, pis, dev, select);
else
- (*pis->cmap_procs->map_rgb_alpha)
- (pconc[0], pconc[0], pconc[0], cv2frac(pis->alpha),
- pdc, pis, dev, select);
+ (*pis->cmap_procs->map_rgb_alpha)
+ (pconc[0], pconc[0], pconc[0], cv2frac(pis->alpha),
+ pdc, pis, dev, select);
return 0;
}
int
gx_remap_DeviceGray(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
frac fgray = gx_unit_frac(pc->paint.values[0]);
@@ -645,18 +642,18 @@ gx_remap_DeviceGray(const gs_client_color * pc, const gs_color_space * pcs,
pdc->ccolor.paint.values[0] = pc->paint.values[0];
pdc->ccolor_valid = true;
if (pis->alpha == gx_max_color_value)
- (*pis->cmap_procs->map_gray)
- (fgray, pdc, pis, dev, select);
+ (*pis->cmap_procs->map_gray)
+ (fgray, pdc, pis, dev, select);
else
- (*pis->cmap_procs->map_rgb_alpha)
- (fgray, fgray, fgray, cv2frac(pis->alpha), pdc, pis, dev, select);
+ (*pis->cmap_procs->map_rgb_alpha)
+ (fgray, fgray, fgray, cv2frac(pis->alpha), pdc, pis, dev, select);
return 0;
}
/* DeviceRGB */
int
gx_concretize_DeviceRGB(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
pconc[0] = gx_unit_frac(pc->paint.values[0]);
pconc[1] = gx_unit_frac(pc->paint.values[1]);
@@ -665,22 +662,22 @@ gx_concretize_DeviceRGB(const gs_client_color * pc, const gs_color_space * pcs,
}
int
gx_remap_concrete_DRGB(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
if (pis->alpha == gx_max_color_value)
- gx_remap_concrete_rgb(pconc[0], pconc[1], pconc[2],
- pdc, pis, dev, select);
+ gx_remap_concrete_rgb(pconc[0], pconc[1], pconc[2],
+ pdc, pis, dev, select);
else
- gx_remap_concrete_rgb_alpha(pconc[0], pconc[1], pconc[2],
- cv2frac(pis->alpha),
- pdc, pis, dev, select);
+ gx_remap_concrete_rgb_alpha(pconc[0], pconc[1], pconc[2],
+ cv2frac(pis->alpha),
+ pdc, pis, dev, select);
return 0;
}
int
gx_remap_DeviceRGB(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
frac fred = gx_unit_frac(pc->paint.values[0]), fgreen = gx_unit_frac(pc->paint.values[1]),
fblue = gx_unit_frac(pc->paint.values[2]);
@@ -691,18 +688,18 @@ gx_remap_DeviceRGB(const gs_client_color * pc, const gs_color_space * pcs,
pdc->ccolor.paint.values[2] = pc->paint.values[2];
pdc->ccolor_valid = true;
if (pis->alpha == gx_max_color_value)
- gx_remap_concrete_rgb(fred, fgreen, fblue,
- pdc, pis, dev, select);
+ gx_remap_concrete_rgb(fred, fgreen, fblue,
+ pdc, pis, dev, select);
else
- gx_remap_concrete_rgb_alpha(fred, fgreen, fblue, cv2frac(pis->alpha),
- pdc, pis, dev, select);
+ gx_remap_concrete_rgb_alpha(fred, fgreen, fblue, cv2frac(pis->alpha),
+ pdc, pis, dev, select);
return 0;
}
/* DeviceCMYK */
int
gx_concretize_DeviceCMYK(const gs_client_color * pc, const gs_color_space * pcs,
- frac * pconc, const gs_imager_state * pis, gx_device *dev)
+ frac * pconc, const gs_imager_state * pis, gx_device *dev)
{
pconc[0] = gx_unit_frac(pc->paint.values[0]);
pconc[1] = gx_unit_frac(pc->paint.values[1]);
@@ -712,18 +709,18 @@ gx_concretize_DeviceCMYK(const gs_client_color * pc, const gs_color_space * pcs,
}
int
gx_remap_concrete_DCMYK(const frac * pconc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
/****** IGNORE alpha ******/
gx_remap_concrete_cmyk(pconc[0], pconc[1], pconc[2], pconc[3], pdc,
- pis, dev, select);
+ pis, dev, select);
return 0;
}
int
gx_remap_DeviceCMYK(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
/****** IGNORE alpha ******/
/* Save original color space and color info into dev color */
@@ -733,14 +730,13 @@ gx_remap_DeviceCMYK(const gs_client_color * pc, const gs_color_space * pcs,
pdc->ccolor.paint.values[3] = pc->paint.values[3];
pdc->ccolor_valid = true;
gx_remap_concrete_cmyk(gx_unit_frac(pc->paint.values[0]),
- gx_unit_frac(pc->paint.values[1]),
- gx_unit_frac(pc->paint.values[2]),
- gx_unit_frac(pc->paint.values[3]),
- pdc, pis, dev, select);
+ gx_unit_frac(pc->paint.values[1]),
+ gx_unit_frac(pc->paint.values[2]),
+ gx_unit_frac(pc->paint.values[3]),
+ pdc, pis, dev, select);
return 0;
}
-
/* ------ Render Gray color. ------ */
static void
@@ -752,41 +748,41 @@ cmap_gray_halftoned(frac gray, gx_device_color * pdc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_gray(dev, gray, cm_comps);
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else {
if (dev->color_info.opmode == GX_CINFO_OPMODE_UNKNOWN)
- check_cmyk_color_model_comps(dev);
+ check_cmyk_color_model_comps(dev);
if (dev->color_info.opmode == GX_CINFO_OPMODE) { /* CMYK-like color space */
int k = dev->color_info.black_component;
for (i = 0; i < ncomps; i++) {
if (i == k)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
else
cm_comps[i] = cm_comps[i]; /* Ignore transfer, see PLRM3 p. 494 */
}
} else {
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
}
}
if (gx_render_device_DeviceN(cm_comps, pdc, dev, pis->dev_ht,
- &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
+ &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
}
static void
cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
int i, ncomps = dev->color_info.num_components;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
@@ -795,31 +791,31 @@ cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_imager_state * pis,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_gray(dev, gray, cm_comps);
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ cm_comps[i], effective_transfer[i]));
else {
if (dev->color_info.opmode == GX_CINFO_OPMODE_UNKNOWN)
- check_cmyk_color_model_comps(dev);
+ check_cmyk_color_model_comps(dev);
if (dev->color_info.opmode == GX_CINFO_OPMODE) { /* CMYK-like color space */
int k = dev->color_info.black_component;
for (i = 0; i < ncomps; i++) {
if (i == k)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
else
cv[i] = frac2cv(cm_comps[i]); /* Ignore transfer, see PLRM3 p. 494 */
}
} else {
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
}
}
/* encode as a color index */
@@ -832,7 +828,6 @@ cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_imager_state * pis,
cmap_gray_halftoned(gray, pdc, pis, dev, select);
}
-
/* ------ Render RGB color. ------ */
static void
@@ -844,22 +839,22 @@ cmap_rgb_halftoned(frac r, frac g, frac b, gx_device_color * pdc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_rgb(dev, pis, r, g, b, cm_comps);
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
if (gx_render_device_DeviceN(cm_comps, pdc, dev, pis->dev_ht,
- &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
+ &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
}
static void
@@ -873,18 +868,18 @@ cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_rgb(dev, pis, r, g, b, cm_comps);
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ cm_comps[i], effective_transfer[i]));
else
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
/* encode as a color index */
color = dev_proc(dev, encode_color)(dev, cv);
@@ -896,7 +891,6 @@ cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc,
cmap_rgb_halftoned(r, g, b, pdc, pis, dev, select);
}
-
/* ------ Render CMYK color. ------ */
static void
@@ -910,53 +904,53 @@ cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_cmyk(dev, c, m, y, k, cm_comps);
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
/* We make a test for direct vs. halftoned, rather than */
/* duplicating most of the code of this procedure. */
if (gx_device_must_halftone(dev)) {
- if (gx_render_device_DeviceN(cm_comps, pdc, dev,
- pis->dev_ht, &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
- return;
+ if (gx_render_device_DeviceN(cm_comps, pdc, dev,
+ pis->dev_ht, &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
+ return;
}
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(cm_comps[i]);
color = dev_proc(dev, encode_color)(dev, cv);
- if (color != gx_no_color_index)
- color_set_pure(pdc, color);
+ if (color != gx_no_color_index)
+ color_set_pure(pdc, color);
else {
- if (gx_render_device_DeviceN(cm_comps, pdc, dev,
- pis->dev_ht, &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
- return;
+ if (gx_render_device_DeviceN(cm_comps, pdc, dev,
+ pis->dev_ht, &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
+ return;
}
}
static void
cmap_rgb_alpha_halftoned(frac r, frac g, frac b, frac alpha,
- gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
- gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
+ gs_color_select_t select)
{
int i, ncomps = dev->color_info.num_components;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_rgb(dev, pis, r, g, b, cm_comps);
/* pre-multiply to account for the alpha weighting */
@@ -964,7 +958,7 @@ cmap_rgb_alpha_halftoned(frac r, frac g, frac b, frac alpha,
#ifdef PREMULTIPLY_TOWARDS_WHITE
frac alpha_bias = frac_1 - alpha;
#else
- frac alpha_bias = 0;
+ frac alpha_bias = 0;
#endif
for (i = 0; i < ncomps; i++)
@@ -975,15 +969,15 @@ cmap_rgb_alpha_halftoned(frac r, frac g, frac b, frac alpha,
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
if (gx_render_device_DeviceN(cm_comps, pdc, dev, pis->dev_ht,
- &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
+ &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
}
static void
@@ -997,7 +991,7 @@ cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
dev_proc(dev, get_color_mapping_procs)(dev)->map_rgb(dev, pis, r, g, b, cm_comps);
/* pre-multiply to account for the alpha weighting */
@@ -1005,7 +999,7 @@ cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
#ifdef PREMULTIPLY_TOWARDS_WHITE
frac alpha_bias = frac_1 - alpha;
#else
- frac alpha_bias = 0;
+ frac alpha_bias = 0;
#endif
for (i = 0; i < ncomps; i++)
@@ -1016,11 +1010,11 @@ cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ cm_comps[i], effective_transfer[i]));
else
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
/* encode as a color index */
if (dev_proc(dev, map_rgb_alpha_color) != gx_default_map_rgb_alpha_color &&
@@ -1036,7 +1030,6 @@ cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
cmap_rgb_alpha_halftoned(r, g, b, alpha, pdc, pis, dev, select);
}
-
/* ------ Render Separation All color. ------ */
/*
@@ -1054,21 +1047,21 @@ cmap_rgb_alpha_direct(frac r, frac g, frac b, frac alpha, gx_device_color * pdc,
*/
static inline void
map_components_to_colorants(const frac * pcc,
- const gs_devicen_color_map * pcolor_component_map, frac * plist)
+ const gs_devicen_color_map * pcolor_component_map, frac * plist)
{
int i = pcolor_component_map->num_colorants - 1;
int pos;
/* Clear all output colorants first */
for (; i >= 0; i--) {
- plist[i] = frac_0;
+ plist[i] = frac_0;
}
/* Map color components into output list */
for (i = pcolor_component_map->num_components - 1; i >= 0; i--) {
- pos = pcolor_component_map->color_map[i];
- if (pos >= 0)
- plist[pos] = pcc[i];
+ pos = pcolor_component_map->color_map[i];
+ if (pos >= 0)
+ plist[pos] = pcc[i];
}
}
@@ -1082,17 +1075,17 @@ cmap_separation_halftoned(frac all, gx_device_color * pdc,
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
if (pis->color_component_map.sep_type == SEP_ALL) {
- /*
- * Invert the photometric interpretation for additive
- * color spaces because separations are always subtractive.
- */
- if (additive)
- comp_value = frac_1 - comp_value;
+ /*
+ * Invert the photometric interpretation for additive
+ * color spaces because separations are always subtractive.
+ */
+ if (additive)
+ comp_value = frac_1 - comp_value;
/* Use the "all" value for all components */
- i = pis->color_component_map.num_colorants - 1;
+ i = pis->color_component_map.num_colorants - 1;
for (; i >= 0; i--)
cm_comps[i] = comp_value;
}
@@ -1105,20 +1098,20 @@ cmap_separation_halftoned(frac all, gx_device_color * pdc,
if (additive)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
if (gx_render_device_DeviceN(cm_comps, pdc, dev, pis->dev_ht,
- &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
+ &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
}
static void
cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
int i, ncomps = dev->color_info.num_components;
bool additive = dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE;
@@ -1129,14 +1122,14 @@ cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_state *
bool use_rgb2dev_icc = false;
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
if (pis->color_component_map.sep_type == SEP_ALL) {
- /*
- * Invert the photometric interpretation for additive
- * color spaces because separations are always subtractive.
- */
- if (additive)
- comp_value = frac_1 - comp_value;
+ /*
+ * Invert the photometric interpretation for additive
+ * color spaces because separations are always subtractive.
+ */
+ if (additive)
+ comp_value = frac_1 - comp_value;
/* Use the "all" value for all components */
i = pis->color_component_map.num_colorants - 1;
@@ -1161,11 +1154,11 @@ cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_state *
if (additive)
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ cm_comps[i], effective_transfer[i]));
else
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
if (use_rgb2dev_icc && pis->icc_manager->default_rgb != NULL) {
/* After the transfer function go ahead and do the mapping from RGB to
@@ -1178,8 +1171,8 @@ cmap_separation_direct(frac all, gx_device_color * pdc, const gs_imager_state *
rendering_params.object_type = GS_PATH_TAG;
rendering_params.rendering_intent = pis->renderingintent;
- icc_link = gsicc_get_link_profile(pis, dev, pis->icc_manager->default_rgb,
- dev->device_icc_profile,
+ icc_link = gsicc_get_link_profile(pis, dev, pis->icc_manager->default_rgb,
+ dev->device_icc_profile,
&rendering_params, pis->memory, false);
/* Transform the color */
for (i = 0; i < ncomps; i++) {
@@ -1237,7 +1230,7 @@ devicen_icc_cmyk(frac cm_comps[], const gs_imager_state * pis, gx_device *dev)
for (k = 0; k < 4; k++){
psrc[k] = frac2cv(cm_comps[k]);
}
- icc_link = gsicc_get_link_profile(pis, dev, pis->icc_manager->default_cmyk,
+ icc_link = gsicc_get_link_profile(pis, dev, pis->icc_manager->default_cmyk,
dev->device_icc_profile, &rendering_params, pis->memory, false);
/* Transform the color */
if (icc_link->is_identity) {
@@ -1263,7 +1256,7 @@ devicen_icc_cmyk(frac cm_comps[], const gs_imager_state * pis, gx_device *dev)
* output device which requires halftoning. T
*/
static void
-cmap_devicen_halftoned(const frac * pcc,
+cmap_devicen_halftoned(const frac * pcc,
gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
gs_color_select_t select)
{
@@ -1273,27 +1266,27 @@ cmap_devicen_halftoned(const frac * pcc,
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
map_components_to_colorants(pcc, &(pis->color_component_map), cm_comps);
/* See comments in cmap_devicen_direct for details on below operations */
- if (devicen_has_cmyk(dev) &&
+ if (devicen_has_cmyk(dev) &&
dev->device_icc_profile->data_cs == gsCMYK) {
code = devicen_icc_cmyk(cm_comps, pis, dev);
- }
+ }
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cm_comps[i] = gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]);
+ cm_comps[i], effective_transfer[i]);
else
for (i = 0; i < ncomps; i++)
cm_comps[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]);
/* We need to finish halftoning */
if (gx_render_device_DeviceN(cm_comps, pdc, dev, pis->dev_ht,
- &pis->screen_phase[select]) == 1)
- gx_color_load_select(pdc, pis, dev, select);
+ &pis->screen_phase[select]) == 1)
+ gx_color_load_select(pdc, pis, dev, select);
}
/*
@@ -1301,7 +1294,7 @@ cmap_devicen_halftoned(const frac * pcc,
* output device which does not require halftoning.
*/
static void
-cmap_devicen_direct(const frac * pcc,
+cmap_devicen_direct(const frac * pcc,
gx_device_color * pdc, const gs_imager_state * pis, gx_device * dev,
gs_color_select_t select)
{
@@ -1314,20 +1307,20 @@ cmap_devicen_direct(const frac * pcc,
/* See the comment below */
/* map to the color model */
for (i=0; i < ncomps; i++)
- cm_comps[i] = 0;
+ cm_comps[i] = 0;
map_components_to_colorants(pcc, &(pis->color_component_map), cm_comps);;
/* Check if we have the standard colorants. If yes, then we will apply
ICC color management to those colorants. To understand why, consider
- the example where I have a Device with CMYK + O and I have a
- DeviceN color in the document that is specified for any set of
- these colorants, and suppose that I let them pass through
- witout any color management. This is probably not the
- desired effect since I could have a DeviceN color fill that had 10% C,
- 20% M 0% Y 0% K and 0% O. I would like this to look the same
- as a CMYK color that will be color managed and specified with 10% C,
+ the example where I have a Device with CMYK + O and I have a
+ DeviceN color in the document that is specified for any set of
+ these colorants, and suppose that I let them pass through
+ witout any color management. This is probably not the
+ desired effect since I could have a DeviceN color fill that had 10% C,
+ 20% M 0% Y 0% K and 0% O. I would like this to look the same
+ as a CMYK color that will be color managed and specified with 10% C,
20% M 0% Y 0% K. Hence the CMYK values should go through the same
color management as a stand alone CMYK value. */
- if (devicen_has_cmyk(dev) &&
+ if (devicen_has_cmyk(dev) &&
dev->device_icc_profile->data_cs == gsCMYK) {
/* We need to do a CMYK to CMYK conversion here. This will always
use the default CMYK profile and the device's output profile.
@@ -1336,16 +1329,16 @@ cmap_devicen_direct(const frac * pcc,
side for the case when we add DeviceN icc source profiles for use
in PDF and PS data. */
code = devicen_icc_cmyk(cm_comps, pis, dev);
- }
+ }
/* apply the transfer function(s); convert to color values */
if (dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE)
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(gx_map_color_frac(pis,
- cm_comps[i], effective_transfer[i]));
+ cm_comps[i], effective_transfer[i]));
else
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
+ (frac)(frac_1 - cm_comps[i]), effective_transfer[i]));
/* encode as a color index */
color = dev_proc(dev, encode_color)(dev, cv);
/* check if the encoding was successful; we presume failure is rare */
@@ -1395,7 +1388,7 @@ gx_set_identity_transfer(gx_transfer_map *pmap)
pmap->proc = gs_identity_transfer;
/* We still have to fill in the cached values. */
for (i = 0; i < transfer_map_size; ++i)
- pmap->values[i] = bits2frac(i, log2_transfer_map_size);
+ pmap->values[i] = bits2frac(i, log2_transfer_map_size);
}
#if FRAC_MAP_INTERPOLATE /* NOTA BENE */
@@ -1413,14 +1406,14 @@ gx_color_frac_map(frac cv, const frac * values)
/* Interpolate between two adjacent values if needed. */
rem = cv - bits2frac(cmi, log2_transfer_map_size);
if (rem == 0)
- return mv;
+ return mv;
mdv = values[cmi + 1] - mv;
#if ARCH_INTS_ARE_SHORT
/* Only use long multiplication if necessary. */
if (mdv < -1 << (16 - cp_frac_bits) ||
- mdv > 1 << (16 - cp_frac_bits)
- )
- return mv + (uint) (((ulong) rem * mdv) >> cp_frac_bits);
+ mdv > 1 << (16 - cp_frac_bits)
+ )
+ return mv + (uint) (((ulong) rem * mdv) >> cp_frac_bits);
#endif
return mv + ((rem * mdv) >> cp_frac_bits);
#undef cp_frac_bits
@@ -1435,7 +1428,7 @@ gx_default_w_b_map_rgb_color(gx_device * dev, const gx_color_value cv[])
{ /* Map values >= 1/2 to 1, < 1/2 to 0. */
int i, ncomps = dev->color_info.num_components;
gx_color_value cv_all = 0;
-
+
for (i = 0; i < ncomps; i++)
cv_all |= cv[i];
return cv_all > gx_max_color_value / 2 ? (gx_color_index)1
@@ -1445,7 +1438,7 @@ gx_default_w_b_map_rgb_color(gx_device * dev, const gx_color_value cv[])
int
gx_default_w_b_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{ /* Map 1 to max_value, 0 to 0. */
prgb[0] = prgb[1] = prgb[2] = -(gx_color_value) color;
return 0;
@@ -1457,7 +1450,7 @@ gx_default_b_w_map_rgb_color(gx_device * dev, const gx_color_value cv[])
{
int i, ncomps = dev->color_info.num_components;
gx_color_value cv_all = 0;
-
+
for (i = 0; i < ncomps; i++)
cv_all |= cv[i];
return cv_all > gx_max_color_value / 2 ? (gx_color_index)0
@@ -1466,7 +1459,7 @@ gx_default_b_w_map_rgb_color(gx_device * dev, const gx_color_value cv[])
int
gx_default_b_w_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{ /* Map 0 to max_value, 1 to 0. */
prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
return 0;
@@ -1490,10 +1483,10 @@ gx_default_gray_map_rgb_color(gx_device * dev, const gx_color_value cv[])
int
gx_default_gray_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
- gx_color_value gray = (gx_color_value)
- (color * gx_max_color_value / dev->color_info.max_gray);
+ gx_color_value gray = (gx_color_value)
+ (color * gx_max_color_value / dev->color_info.max_gray);
prgb[0] = gray;
prgb[1] = gray;
@@ -1511,7 +1504,7 @@ gx_default_8bit_map_gray_color(gx_device * dev, const gx_color_value cv[])
int
gx_default_8bit_map_color_gray(gx_device * dev, gx_color_index color,
- gx_color_value pgray[1])
+ gx_color_value pgray[1])
{
pgray[0] = (gx_color_value)(color * gx_max_color_value / 255);
return 0;
@@ -1523,37 +1516,37 @@ gx_color_index
gx_default_rgb_map_rgb_color(gx_device * dev, const gx_color_value cv[])
{
if (dev->color_info.depth == 24)
- return gx_color_value_to_byte(cv[2]) +
- ((uint) gx_color_value_to_byte(cv[1]) << 8) +
- ((ulong) gx_color_value_to_byte(cv[0]) << 16);
+ return gx_color_value_to_byte(cv[2]) +
+ ((uint) gx_color_value_to_byte(cv[1]) << 8) +
+ ((ulong) gx_color_value_to_byte(cv[0]) << 16);
else {
- int bpc = dev->color_info.depth / 3;
- int drop = sizeof(gx_color_value) * 8 - bpc;
- return ( ( (((gx_color_index)cv[0] >> drop) << bpc) +
- ((gx_color_index)cv[1] >> drop) ) << bpc) +
- ((gx_color_index)cv[2] >> drop);
+ int bpc = dev->color_info.depth / 3;
+ int drop = sizeof(gx_color_value) * 8 - bpc;
+ return ( ( (((gx_color_index)cv[0] >> drop) << bpc) +
+ ((gx_color_index)cv[1] >> drop) ) << bpc) +
+ ((gx_color_index)cv[2] >> drop);
}
}
/* Map a color index to a r-g-b color. */
int
gx_default_rgb_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
if (dev->color_info.depth == 24) {
- prgb[0] = gx_color_value_from_byte(color >> 16);
- prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[2] = gx_color_value_from_byte(color & 0xff);
+ prgb[0] = gx_color_value_from_byte(color >> 16);
+ prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[2] = gx_color_value_from_byte(color & 0xff);
} else {
- uint bits_per_color = dev->color_info.depth / 3;
- uint color_mask = (1 << bits_per_color) - 1;
-
- prgb[0] = ((color >> (bits_per_color * 2)) & color_mask) *
- (ulong) gx_max_color_value / color_mask;
- prgb[1] = ((color >> (bits_per_color)) & color_mask) *
- (ulong) gx_max_color_value / color_mask;
- prgb[2] = (color & color_mask) *
- (ulong) gx_max_color_value / color_mask;
+ uint bits_per_color = dev->color_info.depth / 3;
+ uint color_mask = (1 << bits_per_color) - 1;
+
+ prgb[0] = ((color >> (bits_per_color * 2)) & color_mask) *
+ (ulong) gx_max_color_value / color_mask;
+ prgb[1] = ((color >> (bits_per_color)) & color_mask) *
+ (ulong) gx_max_color_value / color_mask;
+ prgb[2] = (color & color_mask) *
+ (ulong) gx_max_color_value / color_mask;
}
return 0;
}
@@ -1566,7 +1559,7 @@ gx_default_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
frac rgb[3];
gx_color_value rgb_cv[3];
color_cmyk_to_rgb(cv2frac(cv[0]), cv2frac(cv[1]), cv2frac(cv[2]), cv2frac(cv[3]),
- NULL, rgb, dev->memory);
+ NULL, rgb, dev->memory);
rgb_cv[0] = frac2cv(rgb[0]);
rgb_cv[1] = frac2cv(rgb[1]);
rgb_cv[2] = frac2cv(rgb[2]);
@@ -1580,28 +1573,28 @@ cmyk_1bit_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
{
#define CV_BIT(v) ((v) >> (gx_color_value_bits - 1))
return (gx_color_index)
- (CV_BIT(cv[3]) + (CV_BIT(cv[2]) << 1) + (CV_BIT(cv[1]) << 2) + (CV_BIT(cv[0]) << 3));
+ (CV_BIT(cv[3]) + (CV_BIT(cv[2]) << 1) + (CV_BIT(cv[1]) << 2) + (CV_BIT(cv[0]) << 3));
#undef CV_BIT
}
/* Shouldn't be called: decode_color should be cmyk_1bit_map_color_cmyk */
int
cmyk_1bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
if (color & 1)
- prgb[0] = prgb[1] = prgb[2] = 0;
+ prgb[0] = prgb[1] = prgb[2] = 0;
else {
- prgb[0] = (color & 8 ? 0 : gx_max_color_value);
- prgb[1] = (color & 4 ? 0 : gx_max_color_value);
- prgb[2] = (color & 2 ? 0 : gx_max_color_value);
+ prgb[0] = (color & 8 ? 0 : gx_max_color_value);
+ prgb[1] = (color & 4 ? 0 : gx_max_color_value);
+ prgb[2] = (color & 2 ? 0 : gx_max_color_value);
}
return 0;
}
int
cmyk_1bit_map_color_cmyk(gx_device * dev, gx_color_index color,
- gx_color_value pcv[4])
+ gx_color_value pcv[4])
{
pcv[0] = (color & 8 ? 0 : gx_max_color_value);
pcv[1] = (color & 4 ? 0 : gx_max_color_value);
@@ -1614,10 +1607,10 @@ gx_color_index
cmyk_8bit_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
{
gx_color_index color =
- gx_color_value_to_byte(cv[3]) +
- ((uint)gx_color_value_to_byte(cv[2]) << 8) +
- ((uint)gx_color_value_to_byte(cv[1]) << 16) +
- ((uint)gx_color_value_to_byte(cv[0]) << 24);
+ gx_color_value_to_byte(cv[3]) +
+ ((uint)gx_color_value_to_byte(cv[2]) << 8) +
+ ((uint)gx_color_value_to_byte(cv[1]) << 16) +
+ ((uint)gx_color_value_to_byte(cv[0]) << 24);
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -1626,10 +1619,10 @@ gx_color_index
cmyk_16bit_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
{
gx_color_index color =
- (uint64_t)cv[3] +
- ((uint64_t)cv[2] << 16) +
- ((uint64_t)cv[1] << 32) +
- ((uint64_t)cv[0] << 48);
+ (uint64_t)cv[3] +
+ ((uint64_t)cv[2] << 16) +
+ ((uint64_t)cv[1] << 32) +
+ ((uint64_t)cv[0] << 48);
return (color == gx_no_color_index ? color ^ 1 : color);
}
@@ -1637,13 +1630,13 @@ cmyk_16bit_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
/* Shouldn't be called: decode_color should be cmyk_8bit_map_color_cmyk */
int
cmyk_8bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
int
- not_k = (int) (~color & 0xff),
- r = not_k - (int) (color >> 24),
- g = not_k - (int) ((color >> 16) & 0xff),
- b = not_k - (int) ((color >> 8) & 0xff);
+ not_k = (int) (~color & 0xff),
+ r = not_k - (int) (color >> 24),
+ g = not_k - (int) ((color >> 16) & 0xff),
+ b = not_k - (int) ((color >> 8) & 0xff);
prgb[0] = (r < 0 ? 0 : gx_color_value_from_byte(r));
prgb[1] = (g < 0 ? 0 : gx_color_value_from_byte(g));
@@ -1653,7 +1646,7 @@ cmyk_8bit_map_color_rgb(gx_device * dev, gx_color_index color,
int
cmyk_8bit_map_color_cmyk(gx_device * dev, gx_color_index color,
- gx_color_value pcv[4])
+ gx_color_value pcv[4])
{
pcv[0] = gx_color_value_from_byte((color >> 24) & 0xff);
pcv[1] = gx_color_value_from_byte((color >> 16) & 0xff);
@@ -1664,7 +1657,7 @@ cmyk_8bit_map_color_cmyk(gx_device * dev, gx_color_index color,
int
cmyk_16bit_map_color_cmyk(gx_device * dev, gx_color_index color,
- gx_color_value pcv[4])
+ gx_color_value pcv[4])
{
pcv[0] = ((color >> 24) >> 24) & 0xffff;
pcv[1] = ((color >> 16) >> 16) & 0xffff;
@@ -1673,7 +1666,6 @@ cmyk_16bit_map_color_cmyk(gx_device * dev, gx_color_index color,
return 0;
}
-
/* Default mapping between RGB+alpha and RGB. */
gx_color_index
@@ -1687,7 +1679,7 @@ gx_default_map_rgb_alpha_color(gx_device * dev,
int
gx_default_map_color_rgb_alpha(gx_device * dev, gx_color_index color,
- gx_color_value prgba[4])
+ gx_color_value prgba[4])
{
prgba[3] = gx_max_color_value; /* alpha = 1 */
return (*dev_proc(dev, map_color_rgb)) (dev, color, prgba);
@@ -1728,7 +1720,7 @@ cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
for (i = 0; i < ncomps; i++) {
frac_value = cv2frac(pconc[i]);
cv_frac[i] = gx_map_color_frac(pis,
- frac_value, effective_transfer[i]);
+ frac_value, effective_transfer[i]);
}
} else {
if (dev->color_info.opmode == GX_CINFO_OPMODE_UNKNOWN) {
@@ -1740,7 +1732,7 @@ cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
frac_value = cv2frac(pconc[i]);
if (i == k) {
cv_frac[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - frac_value), effective_transfer[i]);
+ (frac)(frac_1 - frac_value), effective_transfer[i]);
} else {
cv_frac[i] = cv2frac(pconc[i]); /* Ignore transfer, see PLRM3 p. 494 */
}
@@ -1749,7 +1741,7 @@ cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
for (i = 0; i < ncomps; i++) {
frac_value = cv2frac(pconc[i]);
cv_frac[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - frac_value), effective_transfer[i]);
+ (frac)(frac_1 - frac_value), effective_transfer[i]);
}
}
}
@@ -1757,20 +1749,20 @@ cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
if (has_halftone) {
/* We need this to be in frac form */
for (i = 0; i < ncomps; i++) {
- cv_frac[i] = cv2frac(pconc[i]);
+ cv_frac[i] = cv2frac(pconc[i]);
}
- }
+ }
}
/* Halftoning */
if (has_halftone) {
if (gx_render_device_DeviceN(&(cv_frac[0]), pdc, dev,
- pis->dev_ht, &pis->screen_phase[select]) == 1)
+ pis->dev_ht, &pis->screen_phase[select]) == 1)
gx_color_load_select(pdc, pis, dev, select);
} else {
/* We have a frac value from the transfer function. Do the encode.
which does not take a frac value... */
for (i = 0; i < ncomps; i++) {
- color_val[i] = frac2cv(cv_frac[i]);
+ color_val[i] = frac2cv(cv_frac[i]);
}
color = dev_proc(dev, encode_color)(dev, &(color_val[0]));
/* check if the encoding was successful; we presume failure is rare */
@@ -1780,7 +1772,7 @@ cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
}
}
-/* This is used by image color render to apply only the transfer function.
+/* This is used by image color render to apply only the transfer function.
We follow this up with threshold rendering. */
void
cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis, gx_device * dev)
@@ -1795,7 +1787,7 @@ cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis, gx_device * de
for (i = 0; i < ncomps; i++) {
frac_value = cv2frac(pconc[i]);
cv_frac[i] = gx_map_color_frac(pis,
- frac_value, effective_transfer[i]);
+ frac_value, effective_transfer[i]);
pconc[i] = frac2cv(cv_frac[i]);
}
} else {
@@ -1808,7 +1800,7 @@ cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis, gx_device * de
frac_value = cv2frac(pconc[i]);
if (i == k) {
cv_frac[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - frac_value), effective_transfer[i]);
+ (frac)(frac_1 - frac_value), effective_transfer[i]);
} else {
cv_frac[i] = cv2frac(pconc[i]); /* Ignore transfer, see PLRM3 p. 494 */
}
@@ -1818,7 +1810,7 @@ cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis, gx_device * de
for (i = 0; i < ncomps; i++) {
frac_value = cv2frac(pconc[i]);
cv_frac[i] = frac_1 - gx_map_color_frac(pis,
- (frac)(frac_1 - frac_value), effective_transfer[i]);
+ (frac)(frac_1 - frac_value), effective_transfer[i]);
pconc[i] = frac2cv(cv_frac[i]);
}
}
@@ -1826,7 +1818,7 @@ cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis, gx_device * de
}
bool
-gx_device_uses_std_cmap_procs(gx_device * dev)
+gx_device_uses_std_cmap_procs(gx_device * dev)
{
const gx_cm_color_map_procs *pprocs;
@@ -1835,14 +1827,14 @@ gx_device_uses_std_cmap_procs(gx_device * dev)
/* Check if they are forwarding procs */
if (fwd_uses_fwd_cmap_procs(dev)) {
pprocs = fwd_get_target_cmap_procs(dev);
- }
+ }
switch(dev->device_icc_profile->data_cs) {
case gsGRAY:
if (pprocs == &DeviceGray_procs) {
return true;
}
break;
- case gsRGB:
+ case gsRGB:
if (pprocs == &DeviceRGB_procs) {
return true;
}
@@ -1860,6 +1852,6 @@ gx_device_uses_std_cmap_procs(gx_device * dev)
default:
break;
}
- }
+ }
return false;
}
diff --git a/gs/base/gxcmap.h b/gs/base/gxcmap.h
index bd1f49ed4..986824acc 100644
--- a/gs/base/gxcmap.h
+++ b/gs/base/gxcmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,22 +34,22 @@ typedef struct gx_device_color_s gx_device_color;
#define cmap_proc_gray(proc)\
void proc(frac, gx_device_color *, const gs_imager_state *,\
- gx_device *, gs_color_select_t)
+ gx_device *, gs_color_select_t)
#define cmap_proc_rgb(proc)\
void proc(frac, frac, frac, gx_device_color *, const gs_imager_state *,\
- gx_device *, gs_color_select_t)
+ gx_device *, gs_color_select_t)
#define cmap_proc_cmyk(proc)\
void proc(frac, frac, frac, frac, gx_device_color *,\
- const gs_imager_state *, gx_device *, gs_color_select_t)
+ const gs_imager_state *, gx_device *, gs_color_select_t)
#define cmap_proc_rgb_alpha(proc)\
void proc(frac, frac, frac, frac, gx_device_color *,\
- const gs_imager_state *, gx_device *, gs_color_select_t)
+ const gs_imager_state *, gx_device *, gs_color_select_t)
#define cmap_proc_separation(proc)\
void proc(frac, gx_device_color *, const gs_imager_state *,\
- gx_device *, gs_color_select_t)
+ gx_device *, gs_color_select_t)
#define cmap_proc_devicen(proc)\
void proc(const frac *, gx_device_color *, const gs_imager_state *, \
- gx_device *, gs_color_select_t)
+ gx_device *, gs_color_select_t)
#define cmap_proc_is_halftoned(proc)\
bool proc(const gs_imager_state *, gx_device *)
@@ -63,7 +63,7 @@ typedef struct gx_device_color_s gx_device_color;
#define cm_map_proc_rgb(proc) \
void proc (gx_device * dev, \
- const gs_imager_state *pis, \
+ const gs_imager_state *pis, \
frac r, frac g, frac b, \
frac * out)
@@ -180,7 +180,6 @@ extern cm_map_proc_gray(gx_error_gray_cs_to_cmyk_cm);
extern cm_map_proc_rgb(gx_error_rgb_cs_to_cmyk_cm);
extern cm_map_proc_cmyk(gx_error_cmyk_cs_to_cmyk_cm);
-
/*
Get the mapping procedures appropriate for the currently set
color model.
@@ -229,8 +228,6 @@ extern cm_map_proc_cmyk(gx_error_cmyk_cs_to_cmyk_cm);
#define dev_proc_decode_color(proc) \
dev_t_proc_decode_color(proc, gx_device)
-
-
/*
* These are the default routines for translating a color component
* name into the device colorant index.
@@ -285,7 +282,7 @@ dev_proc_decode_color(gx_default_decode_color);
*/
frac gx_unit_frac(float fvalue);
/* Determine if the device is using the standard color mapping procs. In
- such a case, we can make use of the faster icc color conversions for
+ such a case, we can make use of the faster icc color conversions for
images */
bool gx_device_uses_std_cmap_procs(gx_device * dev);
bool fwd_uses_fwd_cmap_procs(gx_device * dev);
@@ -293,6 +290,6 @@ const gx_cm_color_map_procs* fwd_get_target_cmap_procs(gx_device * dev);
void cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
const gs_imager_state * pis, gx_device * dev, bool has_transfer,
bool has_halftone, gs_color_select_t select);
-void cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis,
+void cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis,
gx_device * dev);
#endif /* gxcmap_INCLUDED */
diff --git a/gs/base/gxcolor2.h b/gs/base/gxcolor2.h
index 93e293dbb..37837e309 100644
--- a/gs/base/gxcolor2.h
+++ b/gs/base/gxcolor2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,8 +27,8 @@
struct gs_indexed_map_s {
rc_header rc;
union {
- int (*lookup_index)(const gs_color_space *, int, float *);
- int (*tint_transform)(const gs_separation_params *, floatp, float *);
+ int (*lookup_index)(const gs_color_space *, int, float *);
+ int (*tint_transform)(const gs_separation_params *, floatp, float *);
} proc;
void *proc_data;
uint num_values; /* base_space->type->num_components * (hival + 1) */
@@ -44,7 +44,7 @@ int lookup_indexed_map(const gs_color_space *, int, float *);
/* Allocate an indexed map and its values. */
/* The initial reference count is 1. */
int alloc_indexed_map(gs_indexed_map ** ppmap, int num_values,
- gs_memory_t * mem, client_name_t cname);
+ gs_memory_t * mem, client_name_t cname);
/* Free an indexed map and its values when the reference count goes to 0. */
rc_free_proc(free_indexed_map);
@@ -93,11 +93,10 @@ struct gs_pattern1_instance_s {
"gs_pattern1_instance_t", pattern1_instance_enum_ptrs,\
pattern1_instance_reloc_ptrs)
-/* This is used for the case where we have float outputs due to the use of a procedure in
+/* This is used for the case where we have float outputs due to the use of a procedure in
the indexed image, but we desire to have byte outputs. Used with interpolated images. */
#define float_color_to_byte_color(float_color) ( (0.0 < float_color && float_color < 1.0) ? \
((unsigned char) (float_color*255.0)) : ( (float_color <= 0.0) ? 0x00 : 0xFF ))
-
#endif /* gxcolor2_INCLUDED */
diff --git a/gs/base/gxcomp.h b/gs/base/gxcomp.h
index 8cb8c7f67..fb3c6e069 100644
--- a/gs/base/gxcomp.h
+++ b/gs/base/gxcomp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,11 +46,10 @@
#define GX_COMPOSITOR_OVERPRINT 0x02 /* overprint/overprintmode compositor */
#define GX_COMPOSITOR_PDF14_TRANS 0x03 /* PDF 1.4 transparency compositor */
-
/*
* Define the abstract superclass for all compositing function types.
*/
- /*typedef struct gs_composite_s gs_composite_t; *//* in gscompt.h */
+ /*typedef struct gs_composite_s gs_composite_t; *//* in gscompt.h */
#ifndef gs_imager_state_DEFINED
# define gs_imager_state_DEFINED
@@ -118,7 +117,7 @@ typedef struct gs_composite_type_procs_s {
* Checks whether a next compositor operation closes this one.
* Must set the 2nd argument with a pointer to the opening compositor operation.
* Return coides : <0 - error, 0 - not closing,
- * 1 - closing with annihilation, 2 - execute immediately,
+ * 1 - closing with annihilation, 2 - execute immediately,
* 3 - closing and replacing, 4 - replace one, 5 - drop queue.
*/
#define composite_is_closing_proc(proc)\
@@ -138,7 +137,7 @@ typedef struct gs_composite_type_procs_s {
*/
#define composite_clist_write_update(proc)\
int proc(const gs_composite_t * pcte, gx_device * dev, gx_device ** pcdev,\
- gs_imager_state * pis, gs_memory_t * mem)
+ gs_imager_state * pis, gs_memory_t * mem)
composite_clist_write_update((*clist_compositor_write_update));
/*
@@ -146,7 +145,7 @@ typedef struct gs_composite_type_procs_s {
*/
#define composite_clist_read_update(proc)\
int proc(gs_composite_t * pcte, gx_device * cdev, gx_device * tdev,\
- gs_imager_state * pis, gs_memory_t * mem)
+ gs_imager_state * pis, gs_memory_t * mem)
composite_clist_read_update((*clist_compositor_read_update));
/*
@@ -196,10 +195,10 @@ composite_get_cropping_proc(gx_default_composite_get_cropping);
* structure type is needed for it.
*/
#define gs_composite_common\
- const gs_composite_type_t *type;\
- gs_id id; /* see gscompt.h */\
- bool idle; /* Doesn't paint anything. */\
- struct gs_composite_s *prev, *next /* Queue links for clist_playback_band. */
+ const gs_composite_type_t *type;\
+ gs_id id; /* see gscompt.h */\
+ bool idle; /* Doesn't paint anything. */\
+ struct gs_composite_s *prev, *next /* Queue links for clist_playback_band. */
struct gs_composite_s {
gs_composite_common;
diff --git a/gs/base/gxcoord.h b/gs/base/gxcoord.h
index 783c1a48b..ab2d4d7d2 100644
--- a/gs/base/gxcoord.h
+++ b/gs/base/gxcoord.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxcpath.c b/gs/base/gxcpath.c
index 6ed38459c..41db2d04e 100644
--- a/gs/base/gxcpath.c
+++ b/gs/base/gxcpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,12 +40,12 @@ private_st_cpath_enum();
private_st_cpath_path_list();
/* GC procedures for gx_clip_path */
-static
+static
ENUM_PTRS_WITH(clip_path_enum_ptrs, gx_clip_path *cptr) return ENUM_USING(st_path, &cptr->path, sizeof(cptr->path), index - 2);
case 0:
return ENUM_OBJ((cptr->rect_list == &cptr->local_list ? 0 :
- cptr->rect_list));
+ cptr->rect_list));
case 1:
return ENUM_OBJ(cptr->path_list);
ENUM_PTRS_END
@@ -53,7 +53,7 @@ static
RELOC_PTRS_WITH(clip_path_reloc_ptrs, gx_clip_path *cptr)
{
if (cptr->rect_list != &cptr->local_list)
- RELOC_VAR(cptr->rect_list);
+ RELOC_VAR(cptr->rect_list);
RELOC_VAR(cptr->path_list);
RELOC_USING(st_path, &cptr->path, sizeof(gx_path));
}
@@ -64,23 +64,23 @@ static
ENUM_PTRS_WITH(device_clip_enum_ptrs, gx_device_clip *cptr)
{
if (index < st_clip_list_max_ptrs + 1)
- return ENUM_USING(st_clip_list, &cptr->list,
- sizeof(gx_clip_list), index - 1);
+ return ENUM_USING(st_clip_list, &cptr->list,
+ sizeof(gx_clip_list), index - 1);
return ENUM_USING(st_device_forward, vptr,
- sizeof(gx_device_forward),
- index - (st_clip_list_max_ptrs + 1));
+ sizeof(gx_device_forward),
+ index - (st_clip_list_max_ptrs + 1));
}
case 0:
ENUM_RETURN((cptr->current == &cptr->list.single ? NULL :
- (void *)cptr->current));
+ (void *)cptr->current));
ENUM_PTRS_END
static
RELOC_PTRS_WITH(device_clip_reloc_ptrs, gx_device_clip *cptr)
{
if (cptr->current == &cptr->list.single)
- cptr->current = &((gx_device_clip *)RELOC_OBJ(vptr))->list.single;
+ cptr->current = &((gx_device_clip *)RELOC_OBJ(vptr))->list.single;
else
- RELOC_PTR(gx_device_clip, current);
+ RELOC_PTR(gx_device_clip, current);
RELOC_USING(st_clip_list, &cptr->list, sizeof(gx_clip_list));
RELOC_USING(st_device_forward, vptr, sizeof(gx_device_forward));
}
@@ -133,41 +133,41 @@ cpath_share_own_contents(gx_clip_path * pcpath, const gx_clip_path * shared)
/* Allocate only the segments of a clipping path on the heap. */
static int
cpath_alloc_list(gx_clip_rect_list ** prlist, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
rc_alloc_struct_1(*prlist, gx_clip_rect_list, &st_clip_rect_list, mem,
- return_error(gs_error_VMerror), cname);
+ return_error(gs_error_VMerror), cname);
(*prlist)->rc.free = rc_free_cpath_list;
return 0;
}
int
gx_cpath_init_contained_shared(gx_clip_path * pcpath,
- const gx_clip_path * shared, gs_memory_t * mem, client_name_t cname)
+ const gx_clip_path * shared, gs_memory_t * mem, client_name_t cname)
{
if (shared) {
- if (shared->path.segments == &shared->path.local_segments) {
- lprintf1("Attempt to share (local) segments of clip path 0x%lx!\n",
- (ulong) shared);
- return_error(gs_error_Fatal);
- }
- *pcpath = *shared;
- pcpath->path.memory = mem;
- pcpath->path.allocation = path_allocated_contained;
- rc_increment(pcpath->path.segments);
- rc_increment(pcpath->rect_list);
- rc_increment(pcpath->path_list);
+ if (shared->path.segments == &shared->path.local_segments) {
+ lprintf1("Attempt to share (local) segments of clip path 0x%lx!\n",
+ (ulong) shared);
+ return_error(gs_error_Fatal);
+ }
+ *pcpath = *shared;
+ pcpath->path.memory = mem;
+ pcpath->path.allocation = path_allocated_contained;
+ rc_increment(pcpath->path.segments);
+ rc_increment(pcpath->rect_list);
+ rc_increment(pcpath->path_list);
} else {
- int code = cpath_alloc_list(&pcpath->rect_list, mem, cname);
-
- if (code < 0)
- return code;
- code = gx_path_alloc_contained(&pcpath->path, mem, cname);
- if (code < 0) {
- gs_free_object(mem, pcpath->rect_list, cname);
- pcpath->rect_list = 0;
- return code;
- }
- cpath_init_own_contents(pcpath);
+ int code = cpath_alloc_list(&pcpath->rect_list, mem, cname);
+
+ if (code < 0)
+ return code;
+ code = gx_path_alloc_contained(&pcpath->path, mem, cname);
+ if (code < 0) {
+ gs_free_object(mem, pcpath->rect_list, cname);
+ pcpath->rect_list = 0;
+ return code;
+ }
+ cpath_init_own_contents(pcpath);
}
return 0;
}
@@ -177,18 +177,18 @@ gx_cpath_init_contained_shared(gx_clip_path * pcpath,
/* Allocate all of a clipping path on the heap. */
gx_clip_path *
gx_cpath_alloc_shared(const gx_clip_path * shared, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
gx_clip_path *pcpath =
gs_alloc_struct(mem, gx_clip_path, &st_clip_path, cname);
int code;
if (pcpath == 0)
- return 0;
+ return 0;
code = gx_cpath_alloc_contents(pcpath, shared, mem, cname);
if (code < 0) {
- gs_free_object(mem, pcpath, cname);
- return 0;
+ gs_free_object(mem, pcpath, cname);
+ return 0;
}
pcpath->path.allocation = path_allocated_on_heap;
return pcpath;
@@ -197,28 +197,28 @@ gx_cpath_alloc_shared(const gx_clip_path * shared, gs_memory_t * mem,
/* Initialize a stack-allocated clipping path. */
int
gx_cpath_init_local_shared(gx_clip_path * pcpath, const gx_clip_path * shared,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
if (shared) {
- if (shared->path.segments == &shared->path.local_segments) {
- lprintf1("Attempt to share (local) segments of clip path 0x%lx!\n",
- (ulong) shared);
- return_error(gs_error_Fatal);
- }
- pcpath->path = shared->path;
- pcpath->path.allocation = path_allocated_on_stack;
- rc_increment(pcpath->path.segments);
- pcpath->rect_list = shared->rect_list;
- rc_increment(pcpath->rect_list);
- pcpath->path_list = shared->path_list;
- rc_increment(pcpath->path_list);
- cpath_share_own_contents(pcpath, shared);
- pcpath->rule = shared->rule;
+ if (shared->path.segments == &shared->path.local_segments) {
+ lprintf1("Attempt to share (local) segments of clip path 0x%lx!\n",
+ (ulong) shared);
+ return_error(gs_error_Fatal);
+ }
+ pcpath->path = shared->path;
+ pcpath->path.allocation = path_allocated_on_stack;
+ rc_increment(pcpath->path.segments);
+ pcpath->rect_list = shared->rect_list;
+ rc_increment(pcpath->rect_list);
+ pcpath->path_list = shared->path_list;
+ rc_increment(pcpath->path_list);
+ cpath_share_own_contents(pcpath, shared);
+ pcpath->rule = shared->rule;
} else {
- gx_path_init_local(&pcpath->path, mem);
- rc_init_free(&pcpath->local_list, mem, 1, rc_free_cpath_list_local);
- pcpath->rect_list = &pcpath->local_list;
- cpath_init_own_contents(pcpath);
+ gx_path_init_local(&pcpath->path, mem);
+ rc_init_free(&pcpath->local_list, mem, 1, rc_free_cpath_list_local);
+ pcpath->rect_list = &pcpath->local_list;
+ cpath_init_own_contents(pcpath);
}
return 0;
}
@@ -231,16 +231,16 @@ gx_cpath_unshare(gx_clip_path * pcpath)
gx_clip_rect_list *rlist = pcpath->rect_list;
if (code < 0)
- return code;
+ return code;
if (rlist->rc.ref_count > 1) {
- int code = cpath_alloc_list(&pcpath->rect_list, pcpath->path.memory,
- "gx_cpath_unshare");
+ int code = cpath_alloc_list(&pcpath->rect_list, pcpath->path.memory,
+ "gx_cpath_unshare");
- if (code < 0)
- return code;
- /* Copy the rectangle list. */
+ if (code < 0)
+ return code;
+ /* Copy the rectangle list. */
/**************** NYI ****************/
- rc_decrement(rlist, "gx_cpath_unshare");
+ rc_decrement(rlist, "gx_cpath_unshare");
}
return code;
}
@@ -255,14 +255,14 @@ gx_cpath_free(gx_clip_path * pcpath, client_name_t cname)
pcpath->rect_list = 0;
pcpath->path_list = 0;
{
- gx_path_allocation_t alloc = pcpath->path.allocation;
-
- if (alloc == path_allocated_on_heap) {
- pcpath->path.allocation = path_allocated_contained;
- gx_path_free(&pcpath->path, cname);
- gs_free_object(pcpath->path.memory, pcpath, cname);
- } else
- gx_path_free(&pcpath->path, cname);
+ gx_path_allocation_t alloc = pcpath->path.allocation;
+
+ if (alloc == path_allocated_on_heap) {
+ pcpath->path.allocation = path_allocated_contained;
+ gx_path_free(&pcpath->path, cname);
+ gs_free_object(pcpath->path.memory, pcpath, cname);
+ } else
+ gx_path_free(&pcpath->path, cname);
}
}
@@ -276,29 +276,29 @@ gx_cpath_assign_preserve(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
gx_path path;
if (code < 0)
- return 0;
+ return 0;
if (fromlist == &pcpfrom->local_list) {
- /* We can't use pcpfrom's list object. */
- if (tolist == &pcpto->local_list || tolist->rc.ref_count > 1) {
- /* We can't use pcpto's list either. Allocate a new one. */
- int code = cpath_alloc_list(&tolist, tolist->rc.memory,
- "gx_cpath_assign");
-
- if (code < 0)
- return code;
- rc_decrement(pcpto->rect_list, "gx_cpath_assign");
- } else {
- /* Use pcpto's list object. */
- rc_free_cpath_list_local(tolist->rc.memory, tolist,
- "gx_cpath_assign");
- }
- tolist->list = fromlist->list;
- pcpfrom->rect_list = tolist;
- rc_increment(tolist);
+ /* We can't use pcpfrom's list object. */
+ if (tolist == &pcpto->local_list || tolist->rc.ref_count > 1) {
+ /* We can't use pcpto's list either. Allocate a new one. */
+ int code = cpath_alloc_list(&tolist, tolist->rc.memory,
+ "gx_cpath_assign");
+
+ if (code < 0)
+ return code;
+ rc_decrement(pcpto->rect_list, "gx_cpath_assign");
+ } else {
+ /* Use pcpto's list object. */
+ rc_free_cpath_list_local(tolist->rc.memory, tolist,
+ "gx_cpath_assign");
+ }
+ tolist->list = fromlist->list;
+ pcpfrom->rect_list = tolist;
+ rc_increment(tolist);
} else {
- /* We can use pcpfrom's list object. */
- rc_increment(fromlist);
- rc_decrement(pcpto->rect_list, "gx_cpath_assign");
+ /* We can use pcpfrom's list object. */
+ rc_increment(fromlist);
+ rc_decrement(pcpto->rect_list, "gx_cpath_assign");
}
rc_increment(pcpfrom->path_list);
path = pcpto->path, *pcpto = *pcpfrom, pcpto->path = path;
@@ -312,7 +312,7 @@ gx_cpath_assign_free(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
int code = gx_cpath_assign_preserve(pcpto, pcpfrom);
if (code < 0)
- return 0;
+ return 0;
gx_cpath_free(pcpfrom, "gx_cpath_assign_free");
return 0;
}
@@ -320,7 +320,7 @@ gx_cpath_assign_free(gx_clip_path * pcpto, gx_clip_path * pcpfrom)
/* Free the clipping list when its reference count goes to zero. */
static void
rc_free_cpath_list_local(gs_memory_t * mem, void *vrlist,
- client_name_t cname)
+ client_name_t cname)
{
gx_clip_rect_list *rlist = (gx_clip_rect_list *) vrlist;
@@ -346,28 +346,28 @@ rc_free_cpath_path_list(gs_memory_t * mem, void *vplist, client_name_t cname)
of 1, and "steals" the reference to next (i.e. does not increment
its reference count). */
static int
-gx_cpath_path_list_new(gs_memory_t *mem, gx_clip_path *pcpath, int rule,
- gx_path *ppfrom, gx_cpath_path_list *next, gx_cpath_path_list **pnew)
+gx_cpath_path_list_new(gs_memory_t *mem, gx_clip_path *pcpath, int rule,
+ gx_path *ppfrom, gx_cpath_path_list *next, gx_cpath_path_list **pnew)
{
int code;
client_name_t cname = "gx_cpath_path_list_new";
gx_cpath_path_list *pcplist = gs_alloc_struct(mem, gx_cpath_path_list,
- &st_cpath_path_list, cname);
+ &st_cpath_path_list, cname);
if (pcplist == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
rc_init_free(pcplist, mem, 1, rc_free_cpath_path_list);
if (pcpath!=NULL && !pcpath->path_valid) {
- code = gx_path_init_contained_shared(&pcplist->path, NULL, mem, cname);
- if (code < 0)
- return code;
- code = gx_cpath_to_path(pcpath, &pcplist->path);
+ code = gx_path_init_contained_shared(&pcplist->path, NULL, mem, cname);
+ if (code < 0)
+ return code;
+ code = gx_cpath_to_path(pcpath, &pcplist->path);
} else {
- gx_path_init_local(&pcplist->path, mem);
- code = gx_path_assign_preserve(&pcplist->path, ppfrom);
+ gx_path_init_local(&pcplist->path, mem);
+ code = gx_path_assign_preserve(&pcplist->path, ppfrom);
}
if (code < 0)
- return code;
+ return code;
pcplist->next = next;
pcplist->rule = rule;
*pnew = pcplist;
@@ -387,30 +387,30 @@ gx_cpath_to_path_synthesize(const gx_clip_path * pcpath, gx_path * ppath)
gx_cpath_enum_init(&cenum, pcpath);
while ((code = gx_cpath_enum_next(&cenum, pts)) != 0) {
- switch (code) {
- case gs_pe_moveto:
- code = gx_path_add_point(ppath, pts[0].x, pts[0].y);
- break;
- case gs_pe_lineto:
- code = gx_path_add_line_notes(ppath, pts[0].x, pts[0].y,
- gx_cpath_enum_notes(&cenum));
- break;
- case gs_pe_curveto:
- code = gx_path_add_curve_notes(ppath, pts[0].x, pts[0].y,
- pts[1].x, pts[1].y,
- pts[2].x, pts[2].y,
- gx_cpath_enum_notes(&cenum));
- break;
- case gs_pe_closepath:
- code = gx_path_close_subpath_notes(ppath,
- gx_cpath_enum_notes(&cenum));
- break;
- default:
- if (code >= 0)
- code = gs_note_error(gs_error_unregistered);
- }
- if (code < 0)
- break;
+ switch (code) {
+ case gs_pe_moveto:
+ code = gx_path_add_point(ppath, pts[0].x, pts[0].y);
+ break;
+ case gs_pe_lineto:
+ code = gx_path_add_line_notes(ppath, pts[0].x, pts[0].y,
+ gx_cpath_enum_notes(&cenum));
+ break;
+ case gs_pe_curveto:
+ code = gx_path_add_curve_notes(ppath, pts[0].x, pts[0].y,
+ pts[1].x, pts[1].y,
+ pts[2].x, pts[2].y,
+ gx_cpath_enum_notes(&cenum));
+ break;
+ case gs_pe_closepath:
+ code = gx_path_close_subpath_notes(ppath,
+ gx_cpath_enum_notes(&cenum));
+ break;
+ default:
+ if (code >= 0)
+ code = gs_note_error(gs_error_unregistered);
+ }
+ if (code < 0)
+ break;
}
return 0;
}
@@ -420,19 +420,19 @@ int
gx_cpath_to_path(gx_clip_path * pcpath, gx_path * ppath)
{
if (!pcpath->path_valid) {
- gx_path rpath;
- int code;
-
- gx_path_init_local(&rpath, pcpath->path.memory);
- code = gx_cpath_to_path_synthesize(pcpath, &rpath);
- if (code < 0) {
- gx_path_free(&rpath, "gx_cpath_to_path error");
- return code;
- }
- code = gx_path_assign_free(&pcpath->path, &rpath);
- if (code < 0)
- return code;
- pcpath->path_valid = true;
+ gx_path rpath;
+ int code;
+
+ gx_path_init_local(&rpath, pcpath->path.memory);
+ code = gx_cpath_to_path_synthesize(pcpath, &rpath);
+ if (code < 0) {
+ gx_path_free(&rpath, "gx_cpath_to_path error");
+ return code;
+ }
+ code = gx_path_assign_free(&pcpath->path, &rpath);
+ if (code < 0)
+ return code;
+ pcpath->path_valid = true;
}
return gx_path_assign_preserve(ppath, &pcpath->path);
}
@@ -455,15 +455,15 @@ gx_cpath_outer_box(const gx_clip_path * pcpath, gs_fixed_rect * pbox)
/* The rectangle need not be oriented correctly, i.e. x0 > x1 is OK. */
bool
gx_cpath_includes_rectangle(register const gx_clip_path * pcpath,
- fixed x0, fixed y0, fixed x1, fixed y1)
+ fixed x0, fixed y0, fixed x1, fixed y1)
{
return
- (x0 <= x1 ?
- (pcpath->inner_box.p.x <= x0 && x1 <= pcpath->inner_box.q.x) :
- (pcpath->inner_box.p.x <= x1 && x0 <= pcpath->inner_box.q.x)) &&
- (y0 <= y1 ?
- (pcpath->inner_box.p.y <= y0 && y1 <= pcpath->inner_box.q.y) :
- (pcpath->inner_box.p.y <= y1 && y0 <= pcpath->inner_box.q.y));
+ (x0 <= x1 ?
+ (pcpath->inner_box.p.x <= x0 && x1 <= pcpath->inner_box.q.x) :
+ (pcpath->inner_box.p.x <= x1 && x0 <= pcpath->inner_box.q.x)) &&
+ (y0 <= y1 ?
+ (pcpath->inner_box.p.y <= y0 && y1 <= pcpath->inner_box.q.y) :
+ (pcpath->inner_box.p.y <= y1 && y0 <= pcpath->inner_box.q.y));
}
/* Set the outer clipping box to the path bounding box, */
@@ -490,7 +490,6 @@ gx_cpath_list_private(const gx_clip_path *pcpath)
return &pcpath->rect_list->list;
}
-
/* ------ Clipping path setting ------ */
/* Create a rectangular clipping path. */
@@ -502,15 +501,15 @@ cpath_set_rectangle(gx_clip_path * pcpath, gs_fixed_rect * pbox)
gx_clip_rect_list *rlist = pcpath->rect_list;
if (rlist->rc.ref_count <= 1)
- gx_clip_list_free(&rlist->list, rlist->rc.memory);
+ gx_clip_list_free(&rlist->list, rlist->rc.memory);
else {
- int code = cpath_alloc_list(&pcpath->rect_list, pcpath->path.memory,
- "gx_cpath_from_rectangle");
+ int code = cpath_alloc_list(&pcpath->rect_list, pcpath->path.memory,
+ "gx_cpath_from_rectangle");
- if (code < 0)
- return code;
- rc_decrement(rlist, "gx_cpath_from_rectangle");
- rlist = pcpath->rect_list;
+ if (code < 0)
+ return code;
+ rc_decrement(rlist, "gx_cpath_from_rectangle");
+ rlist = pcpath->rect_list;
}
cpath_init_rectangle(pcpath, pbox);
return 0;
@@ -521,7 +520,7 @@ gx_cpath_from_rectangle(gx_clip_path * pcpath, gs_fixed_rect * pbox)
int code = gx_path_new(&pcpath->path);
if (code < 0)
- return code;
+ return code;
return cpath_set_rectangle(pcpath, pbox);
}
int
@@ -538,12 +537,12 @@ const gs_fixed_rect *
cpath_is_rectangle(const gx_clip_path * pcpath)
{
if (pcpath->path_valid)
- return NULL;
+ return NULL;
if (pcpath->inner_box.p.x != pcpath->path.bbox.p.x ||
- pcpath->inner_box.p.y != pcpath->path.bbox.p.y ||
- pcpath->inner_box.q.x != pcpath->path.bbox.q.x ||
- pcpath->inner_box.q.y != pcpath->path.bbox.q.y)
- return NULL;
+ pcpath->inner_box.p.y != pcpath->path.bbox.p.y ||
+ pcpath->inner_box.q.x != pcpath->path.bbox.q.x ||
+ pcpath->inner_box.q.y != pcpath->path.bbox.q.y)
+ return NULL;
return &pcpath->inner_box;
}
@@ -551,15 +550,15 @@ cpath_is_rectangle(const gx_clip_path * pcpath)
/* Flatten the new path first (in a copy) if necessary. */
int
gx_cpath_clip(gs_state *pgs, gx_clip_path *pcpath,
- /*const*/ gx_path *ppath_orig, int rule)
+ /*const*/ gx_path *ppath_orig, int rule)
{
return gx_cpath_intersect(pcpath, ppath_orig, rule,
- (gs_imager_state *)pgs);
+ (gs_imager_state *)pgs);
}
int
gx_cpath_intersect_with_params(gx_clip_path *pcpath, /*const*/ gx_path *ppath_orig,
- int rule, gs_imager_state *pis, const gx_fill_params * params)
+ int rule, gs_imager_state *pis, const gx_fill_params * params)
{
gx_path fpath;
/*const*/ gx_path *ppath = ppath_orig;
@@ -568,166 +567,165 @@ gx_cpath_intersect_with_params(gx_clip_path *pcpath, /*const*/ gx_path *ppath_or
/* Flatten the path if necessary. */
if (gx_path_has_curves_inline(ppath)) {
- gx_path_init_local(&fpath, pis->memory);
- code = gx_path_add_flattened_accurate(ppath, &fpath,
- gs_currentflat_inline(pis),
- pis->accurate_curves);
- if (code < 0)
- return code;
- ppath = &fpath;
+ gx_path_init_local(&fpath, pis->memory);
+ code = gx_path_add_flattened_accurate(ppath, &fpath,
+ gs_currentflat_inline(pis),
+ pis->accurate_curves);
+ if (code < 0)
+ return code;
+ ppath = &fpath;
}
if (gx_cpath_inner_box(pcpath, &old_box) &&
- ((code = gx_path_is_rectangle(ppath, &new_box)) ||
- gx_path_is_void(ppath))
- ) {
- int changed = 0;
-
- if (!code) {
- /* The new path is void. */
- if (gx_path_current_point(ppath, &new_box.p) < 0) {
- /* Use the user space origin (arbitrarily). */
- new_box.p.x = float2fixed(pis->ctm.tx);
- new_box.p.y = float2fixed(pis->ctm.ty);
- }
- new_box.q = new_box.p;
- changed = 1;
- } else {
- if (params != NULL) {
- /* Called from gx_default_fill_path for converting
- a filling path into a clipping path.
- Apply same adjustment as for filling the path. */
- gs_fixed_point adjust = params->adjust;
- fixed adjust_xl, adjust_xu, adjust_yl, adjust_yu;
-
- if (adjust.x == -1)
- adjust_xl = adjust_xu = adjust_yl = adjust_yu = 0;
- else {
- adjust_xl = (adjust.x == fixed_half ? fixed_half - fixed_epsilon : adjust.x);
- adjust_yl = (adjust.y == fixed_half ? fixed_half - fixed_epsilon : adjust.y);
- adjust_xu = adjust.x;
- adjust_yu = adjust.y;
- }
- new_box.p.x = int2fixed(fixed2int_pixround(new_box.p.x - adjust_xl));
- new_box.p.y = int2fixed(fixed2int_pixround(new_box.p.y - adjust_yl));
- new_box.q.x = int2fixed(fixed2int_pixround(new_box.q.x + adjust_xu));
- new_box.q.y = int2fixed(fixed2int_pixround(new_box.q.y + adjust_yu));
- }
- /* Intersect the two rectangles if necessary. */
- if (old_box.p.x > new_box.p.x)
- new_box.p.x = old_box.p.x, ++changed;
- if (old_box.p.y > new_box.p.y)
- new_box.p.y = old_box.p.y, ++changed;
- if (old_box.q.x < new_box.q.x)
- new_box.q.x = old_box.q.x, ++changed;
- if (old_box.q.y < new_box.q.y)
- new_box.q.y = old_box.q.y, ++changed;
- /* Check for a degenerate rectangle. */
- if (new_box.q.x < new_box.p.x || new_box.q.y < new_box.p.y)
- new_box.p = new_box.q, changed = 1;
- }
- if (changed == 4) {
- /* The new box/path is the same as the old. */
- return 0;
- }
- /* Release the existing path. */
- rc_decrement(pcpath->path_list, "gx_cpath_intersect");
- pcpath->path_list = NULL;
- gx_path_new(&pcpath->path);
- ppath->bbox = new_box;
- cpath_set_rectangle(pcpath, &new_box);
- if (changed == 0) {
- /* The path is valid; otherwise, defer constructing it. */
- gx_path_assign_preserve(&pcpath->path, ppath);
- pcpath->path_valid = true;
- }
+ ((code = gx_path_is_rectangle(ppath, &new_box)) ||
+ gx_path_is_void(ppath))
+ ) {
+ int changed = 0;
+
+ if (!code) {
+ /* The new path is void. */
+ if (gx_path_current_point(ppath, &new_box.p) < 0) {
+ /* Use the user space origin (arbitrarily). */
+ new_box.p.x = float2fixed(pis->ctm.tx);
+ new_box.p.y = float2fixed(pis->ctm.ty);
+ }
+ new_box.q = new_box.p;
+ changed = 1;
+ } else {
+ if (params != NULL) {
+ /* Called from gx_default_fill_path for converting
+ a filling path into a clipping path.
+ Apply same adjustment as for filling the path. */
+ gs_fixed_point adjust = params->adjust;
+ fixed adjust_xl, adjust_xu, adjust_yl, adjust_yu;
+
+ if (adjust.x == -1)
+ adjust_xl = adjust_xu = adjust_yl = adjust_yu = 0;
+ else {
+ adjust_xl = (adjust.x == fixed_half ? fixed_half - fixed_epsilon : adjust.x);
+ adjust_yl = (adjust.y == fixed_half ? fixed_half - fixed_epsilon : adjust.y);
+ adjust_xu = adjust.x;
+ adjust_yu = adjust.y;
+ }
+ new_box.p.x = int2fixed(fixed2int_pixround(new_box.p.x - adjust_xl));
+ new_box.p.y = int2fixed(fixed2int_pixround(new_box.p.y - adjust_yl));
+ new_box.q.x = int2fixed(fixed2int_pixround(new_box.q.x + adjust_xu));
+ new_box.q.y = int2fixed(fixed2int_pixround(new_box.q.y + adjust_yu));
+ }
+ /* Intersect the two rectangles if necessary. */
+ if (old_box.p.x > new_box.p.x)
+ new_box.p.x = old_box.p.x, ++changed;
+ if (old_box.p.y > new_box.p.y)
+ new_box.p.y = old_box.p.y, ++changed;
+ if (old_box.q.x < new_box.q.x)
+ new_box.q.x = old_box.q.x, ++changed;
+ if (old_box.q.y < new_box.q.y)
+ new_box.q.y = old_box.q.y, ++changed;
+ /* Check for a degenerate rectangle. */
+ if (new_box.q.x < new_box.p.x || new_box.q.y < new_box.p.y)
+ new_box.p = new_box.q, changed = 1;
+ }
+ if (changed == 4) {
+ /* The new box/path is the same as the old. */
+ return 0;
+ }
+ /* Release the existing path. */
+ rc_decrement(pcpath->path_list, "gx_cpath_intersect");
+ pcpath->path_list = NULL;
+ gx_path_new(&pcpath->path);
+ ppath->bbox = new_box;
+ cpath_set_rectangle(pcpath, &new_box);
+ if (changed == 0) {
+ /* The path is valid; otherwise, defer constructing it. */
+ gx_path_assign_preserve(&pcpath->path, ppath);
+ pcpath->path_valid = true;
+ }
} else {
- /* New clip path is nontrivial. Intersect the slow way. */
- gx_cpath_path_list *next = pcpath->path_list;
- bool path_valid =
- gx_cpath_inner_box(pcpath, &old_box) &&
- gx_path_bbox(ppath, &new_box) >= 0 &&
- gx_cpath_includes_rectangle(pcpath,
- new_box.p.x, new_box.p.y,
- new_box.q.x, new_box.q.y);
-
- if (!path_valid && next == NULL) {
- code = gx_cpath_path_list_new(pcpath->path.memory, pcpath, pcpath->rule,
- &pcpath->path, NULL, &next);
- if (code < 0)
- goto ex;
- }
- code = gx_cpath_intersect_path_slow(pcpath, (params != NULL ? ppath_orig : ppath),
- rule, pis, params);
- if (code < 0)
- goto ex;
- if (path_valid) {
- gx_path_assign_preserve(&pcpath->path, ppath_orig);
- pcpath->path_valid = true;
- pcpath->rule = rule;
- } else {
- code = gx_cpath_path_list_new(pcpath->path.memory, NULL, rule,
- ppath_orig, next, &pcpath->path_list);
- }
+ /* New clip path is nontrivial. Intersect the slow way. */
+ gx_cpath_path_list *next = pcpath->path_list;
+ bool path_valid =
+ gx_cpath_inner_box(pcpath, &old_box) &&
+ gx_path_bbox(ppath, &new_box) >= 0 &&
+ gx_cpath_includes_rectangle(pcpath,
+ new_box.p.x, new_box.p.y,
+ new_box.q.x, new_box.q.y);
+
+ if (!path_valid && next == NULL) {
+ code = gx_cpath_path_list_new(pcpath->path.memory, pcpath, pcpath->rule,
+ &pcpath->path, NULL, &next);
+ if (code < 0)
+ goto ex;
+ }
+ code = gx_cpath_intersect_path_slow(pcpath, (params != NULL ? ppath_orig : ppath),
+ rule, pis, params);
+ if (code < 0)
+ goto ex;
+ if (path_valid) {
+ gx_path_assign_preserve(&pcpath->path, ppath_orig);
+ pcpath->path_valid = true;
+ pcpath->rule = rule;
+ } else {
+ code = gx_cpath_path_list_new(pcpath->path.memory, NULL, rule,
+ ppath_orig, next, &pcpath->path_list);
+ }
}
ex:
if (ppath != ppath_orig)
- gx_path_free(ppath, "gx_cpath_clip");
+ gx_path_free(ppath, "gx_cpath_clip");
return code;
}
int
gx_cpath_intersect(gx_clip_path *pcpath, /*const*/ gx_path *ppath_orig,
- int rule, gs_imager_state *pis)
+ int rule, gs_imager_state *pis)
{
return gx_cpath_intersect_with_params(pcpath, ppath_orig,
- rule, pis, NULL);
+ rule, pis, NULL);
}
-
/* Scale a clipping path by a power of 2. */
int
gx_cpath_scale_exp2_shared(gx_clip_path * pcpath, int log2_scale_x,
- int log2_scale_y, bool list_shared,
- bool segments_shared)
+ int log2_scale_y, bool list_shared,
+ bool segments_shared)
{
int code =
- (pcpath->path_valid ?
- gx_path_scale_exp2_shared(&pcpath->path, log2_scale_x, log2_scale_y,
- segments_shared) :
- 0);
+ (pcpath->path_valid ?
+ gx_path_scale_exp2_shared(&pcpath->path, log2_scale_x, log2_scale_y,
+ segments_shared) :
+ 0);
gx_clip_list *list = gx_cpath_list_private(pcpath);
gx_clip_rect *pr;
if (code < 0)
- return code;
+ return code;
/* Scale the fixed entries. */
gx_rect_scale_exp2(&pcpath->inner_box, log2_scale_x, log2_scale_y);
gx_rect_scale_exp2(&pcpath->outer_box, log2_scale_x, log2_scale_y);
if (!list_shared) {
- /* Scale the clipping list. */
- pr = list->head;
- if (pr == 0)
- pr = &list->single;
- for (; pr != 0; pr = pr->next)
- if (pr != list->head && pr != list->tail) {
+ /* Scale the clipping list. */
+ pr = list->head;
+ if (pr == 0)
+ pr = &list->single;
+ for (; pr != 0; pr = pr->next)
+ if (pr != list->head && pr != list->tail) {
#define SCALE_V(v, s)\
if ( pr->v != min_int && pr->v != max_int )\
pr->v = (s >= 0 ? pr->v << s : pr->v >> -s)
- SCALE_V(xmin, log2_scale_x);
- SCALE_V(xmax, log2_scale_x);
- SCALE_V(ymin, log2_scale_y);
- SCALE_V(ymax, log2_scale_y);
+ SCALE_V(xmin, log2_scale_x);
+ SCALE_V(xmax, log2_scale_x);
+ SCALE_V(ymin, log2_scale_y);
+ SCALE_V(ymax, log2_scale_y);
#undef SCALE_V
- }
- if (log2_scale_x > 0) {
- list->xmin <<= log2_scale_x;
- list->xmax <<= log2_scale_x;
- } else {
- list->xmin = arith_rshift(list->xmin, -log2_scale_x);
- list->xmax = arith_rshift(list->xmax, -log2_scale_x);
- }
+ }
+ if (log2_scale_x > 0) {
+ list->xmin <<= log2_scale_x;
+ list->xmax <<= log2_scale_x;
+ } else {
+ list->xmin = arith_rshift(list->xmin, -log2_scale_x);
+ list->xmax = arith_rshift(list->xmax, -log2_scale_x);
+ }
}
pcpath->id = gs_next_ids(pcpath->path.memory, 1); /* path changed => change id */
return 0;
@@ -747,30 +745,30 @@ gx_clip_list_init(gx_clip_list * clp)
/* but it will be oriented correctly upon return. */
static void
gx_clip_list_from_rectangle(register gx_clip_list * clp,
- register gs_fixed_rect * rp)
+ register gs_fixed_rect * rp)
{
gx_clip_list_init(clp);
if (rp->p.x > rp->q.x) {
- fixed t = rp->p.x;
+ fixed t = rp->p.x;
- rp->p.x = rp->q.x;
- rp->q.x = t;
+ rp->p.x = rp->q.x;
+ rp->q.x = t;
}
if (rp->p.y > rp->q.y) {
- fixed t = rp->p.y;
+ fixed t = rp->p.y;
- rp->p.y = rp->q.y;
- rp->q.y = t;
+ rp->p.y = rp->q.y;
+ rp->q.y = t;
}
clp->single.xmin = clp->xmin = fixed2int_var(rp->p.x);
clp->single.ymin = fixed2int_var(rp->p.y);
/* Handle degenerate rectangles specially. */
clp->single.xmax = clp->xmax =
- (rp->q.x == rp->p.x ? clp->single.xmin :
- fixed2int_var_ceiling(rp->q.x));
+ (rp->q.x == rp->p.x ? clp->single.xmin :
+ fixed2int_var_ceiling(rp->q.x));
clp->single.ymax =
- (rp->q.y == rp->p.y ? clp->single.ymin :
- fixed2int_var_ceiling(rp->q.y));
+ (rp->q.y == rp->p.y ? clp->single.ymin :
+ fixed2int_var_ceiling(rp->q.y));
clp->count = 1;
}
@@ -779,28 +777,28 @@ int
gx_cpath_enum_init(gs_cpath_enum * penum, const gx_clip_path * pcpath)
{
if ((penum->using_path = pcpath->path_valid)) {
- gx_path_enum_init(&penum->path_enum, &pcpath->path);
- penum->rp = penum->visit = 0;
- penum->first_visit = visit_left;
+ gx_path_enum_init(&penum->path_enum, &pcpath->path);
+ penum->rp = penum->visit = 0;
+ penum->first_visit = visit_left;
} else {
- gx_path empty_path;
- gx_clip_list *clp = gx_cpath_list_private(pcpath);
- gx_clip_rect *head = (clp->count <= 1 ? &clp->single : clp->head);
- gx_clip_rect *rp;
-
- /* Initialize the pointers in the path_enum properly. */
- gx_path_init_local(&empty_path, pcpath->path.memory);
- gx_path_enum_init(&penum->path_enum, &empty_path);
- penum->first_visit = visit_left;
- penum->visit = head;
- for (rp = head; rp != 0; rp = rp->next)
- rp->to_visit =
- (rp->xmin < rp->xmax && rp->ymin < rp->ymax ?
- visit_left | visit_right : 0);
- penum->rp = 0; /* scan will initialize */
- penum->any_rectangles = false;
- penum->state = cpe_scan;
- penum->have_line = false;
+ gx_path empty_path;
+ gx_clip_list *clp = gx_cpath_list_private(pcpath);
+ gx_clip_rect *head = (clp->count <= 1 ? &clp->single : clp->head);
+ gx_clip_rect *rp;
+
+ /* Initialize the pointers in the path_enum properly. */
+ gx_path_init_local(&empty_path, pcpath->path.memory);
+ gx_path_enum_init(&penum->path_enum, &empty_path);
+ penum->first_visit = visit_left;
+ penum->visit = head;
+ for (rp = head; rp != 0; rp = rp->next)
+ rp->to_visit =
+ (rp->xmin < rp->xmax && rp->ymin < rp->ymax ?
+ visit_left | visit_right : 0);
+ penum->rp = 0; /* scan will initialize */
+ penum->any_rectangles = false;
+ penum->state = cpe_scan;
+ penum->have_line = false;
}
return 0;
}
@@ -811,172 +809,172 @@ int
gx_cpath_enum_next(gs_cpath_enum * penum, gs_fixed_point pts[3])
{
if (penum->using_path)
- return gx_path_enum_next(&penum->path_enum, pts);
+ return gx_path_enum_next(&penum->path_enum, pts);
#define set_pt(xi, yi)\
(pts[0].x = int2fixed(xi), pts[0].y = int2fixed(yi))
#define set_line(xi, yi)\
(penum->line_end.x = (xi), penum->line_end.y = (yi), penum->have_line = true)
if (penum->have_line) {
- set_pt(penum->line_end.x, penum->line_end.y);
- penum->have_line = false;
- return gs_pe_lineto;
+ set_pt(penum->line_end.x, penum->line_end.y);
+ penum->have_line = false;
+ return gs_pe_lineto;
} {
- gx_clip_rect *visit = penum->visit;
- gx_clip_rect *rp = penum->rp;
- cpe_visit_t first_visit = penum->first_visit;
- cpe_state_t state = penum->state;
- gx_clip_rect *look;
- int code;
-
- switch (state) {
-
- case cpe_scan:
- /* Look for the start of an edge to trace. */
- for (; visit != 0; visit = visit->next) {
- if (visit->to_visit & visit_left) {
- set_pt(visit->xmin, visit->ymin);
- first_visit = visit_left;
- state = cpe_left;
- } else if (visit->to_visit & visit_right) {
- set_pt(visit->xmax, visit->ymax);
- first_visit = visit_right;
- state = cpe_right;
- } else
- continue;
- rp = visit;
- code = gs_pe_moveto;
- penum->any_rectangles = true;
- goto out;
- }
- /* We've enumerated all the edges. */
- state = cpe_done;
- if (!penum->any_rectangles) {
- /* We didn't have any rectangles. */
- set_pt(fixed_0, fixed_0);
- code = gs_pe_moveto;
- break;
- }
- /* falls through */
-
- case cpe_done:
- /* All done. */
- code = 0;
- break;
+ gx_clip_rect *visit = penum->visit;
+ gx_clip_rect *rp = penum->rp;
+ cpe_visit_t first_visit = penum->first_visit;
+ cpe_state_t state = penum->state;
+ gx_clip_rect *look;
+ int code;
+
+ switch (state) {
+
+ case cpe_scan:
+ /* Look for the start of an edge to trace. */
+ for (; visit != 0; visit = visit->next) {
+ if (visit->to_visit & visit_left) {
+ set_pt(visit->xmin, visit->ymin);
+ first_visit = visit_left;
+ state = cpe_left;
+ } else if (visit->to_visit & visit_right) {
+ set_pt(visit->xmax, visit->ymax);
+ first_visit = visit_right;
+ state = cpe_right;
+ } else
+ continue;
+ rp = visit;
+ code = gs_pe_moveto;
+ penum->any_rectangles = true;
+ goto out;
+ }
+ /* We've enumerated all the edges. */
+ state = cpe_done;
+ if (!penum->any_rectangles) {
+ /* We didn't have any rectangles. */
+ set_pt(fixed_0, fixed_0);
+ code = gs_pe_moveto;
+ break;
+ }
+ /* falls through */
+
+ case cpe_done:
+ /* All done. */
+ code = 0;
+ break;
/* We can't use the BEGIN ... END hack here: we need to be able to break. */
#define return_line(px, py)\
set_pt(px, py); code = gs_pe_lineto; break
- case cpe_left:
-
- left: /* Trace upward along a left edge. */
- /* We're at the lower left corner of rp. */
- rp->to_visit &= ~visit_left;
- /* Look for an adjacent rectangle above rp. */
- for (look = rp;
- (look = look->next) != 0 &&
- (look->ymin == rp->ymin ||
- (look->ymin == rp->ymax && look->xmax <= rp->xmin));
- );
- /* Now we know look->ymin >= rp->ymax. */
- if (look == 0 || look->ymin > rp->ymax ||
- look->xmin >= rp->xmax
- ) { /* No adjacent rectangle, switch directions. */
- state =
- (rp == visit && first_visit == visit_right ? cpe_close :
- (set_line(rp->xmax, rp->ymax), cpe_right));
- return_line(rp->xmin, rp->ymax);
- }
- /* We found an adjacent rectangle. */
- /* See if it also adjoins a rectangle to the left of rp. */
- {
- gx_clip_rect *prev = rp->prev;
- gx_clip_rect *cur = rp;
-
- if (prev != 0 && prev->ymax == rp->ymax &&
- look->xmin < prev->xmax
- ) { /* There's an adjoining rectangle as well. */
- /* Switch directions. */
- rp = prev;
- state =
- (rp == visit && first_visit == visit_right ? cpe_close :
- (set_line(prev->xmax, prev->ymax), cpe_right));
- return_line(cur->xmin, cur->ymax);
- }
- rp = look;
- if (rp == visit && first_visit == visit_left)
- state = cpe_close;
- else if (rp->xmin == cur->xmin)
- goto left;
- else
- set_line(rp->xmin, rp->ymin);
- return_line(cur->xmin, cur->ymax);
- }
-
- case cpe_right:
-
- right: /* Trace downward along a right edge. */
- /* We're at the upper right corner of rp. */
- rp->to_visit &= ~visit_right;
- /* Look for an adjacent rectangle below rp. */
- for (look = rp;
- (look = look->prev) != 0 &&
- (look->ymax == rp->ymax ||
- (look->ymax == rp->ymin && look->xmin >= rp->xmax));
- );
- /* Now we know look->ymax <= rp->ymin. */
- if (look == 0 || look->ymax < rp->ymin ||
- look->xmax <= rp->xmin
- ) { /* No adjacent rectangle, switch directions. */
- state =
- (rp == visit && first_visit == visit_left ? cpe_close :
- (set_line(rp->xmin, rp->ymin), cpe_left));
- return_line(rp->xmax, rp->ymin);
- }
- /* We found an adjacent rectangle. */
- /* See if it also adjoins a rectangle to the right of rp. */
- {
- gx_clip_rect *next = rp->next;
- gx_clip_rect *cur = rp;
-
- if (next != 0 && next->ymin == rp->ymin &&
- look->xmax > next->xmin
- ) { /* There's an adjoining rectangle as well. */
- /* Switch directions. */
- rp = next;
- state =
- (rp == visit && first_visit == visit_left ? cpe_close :
- (set_line(next->xmin, next->ymin), cpe_left));
- return_line(cur->xmax, cur->ymin);
- }
- rp = look;
- if (rp == visit && first_visit == visit_right)
- state = cpe_close;
- else if (rp->xmax == cur->xmax)
- goto right;
- else
- set_line(rp->xmax, rp->ymax);
- return_line(cur->xmax, cur->ymin);
- }
+ case cpe_left:
+
+ left: /* Trace upward along a left edge. */
+ /* We're at the lower left corner of rp. */
+ rp->to_visit &= ~visit_left;
+ /* Look for an adjacent rectangle above rp. */
+ for (look = rp;
+ (look = look->next) != 0 &&
+ (look->ymin == rp->ymin ||
+ (look->ymin == rp->ymax && look->xmax <= rp->xmin));
+ );
+ /* Now we know look->ymin >= rp->ymax. */
+ if (look == 0 || look->ymin > rp->ymax ||
+ look->xmin >= rp->xmax
+ ) { /* No adjacent rectangle, switch directions. */
+ state =
+ (rp == visit && first_visit == visit_right ? cpe_close :
+ (set_line(rp->xmax, rp->ymax), cpe_right));
+ return_line(rp->xmin, rp->ymax);
+ }
+ /* We found an adjacent rectangle. */
+ /* See if it also adjoins a rectangle to the left of rp. */
+ {
+ gx_clip_rect *prev = rp->prev;
+ gx_clip_rect *cur = rp;
+
+ if (prev != 0 && prev->ymax == rp->ymax &&
+ look->xmin < prev->xmax
+ ) { /* There's an adjoining rectangle as well. */
+ /* Switch directions. */
+ rp = prev;
+ state =
+ (rp == visit && first_visit == visit_right ? cpe_close :
+ (set_line(prev->xmax, prev->ymax), cpe_right));
+ return_line(cur->xmin, cur->ymax);
+ }
+ rp = look;
+ if (rp == visit && first_visit == visit_left)
+ state = cpe_close;
+ else if (rp->xmin == cur->xmin)
+ goto left;
+ else
+ set_line(rp->xmin, rp->ymin);
+ return_line(cur->xmin, cur->ymax);
+ }
+
+ case cpe_right:
+
+ right: /* Trace downward along a right edge. */
+ /* We're at the upper right corner of rp. */
+ rp->to_visit &= ~visit_right;
+ /* Look for an adjacent rectangle below rp. */
+ for (look = rp;
+ (look = look->prev) != 0 &&
+ (look->ymax == rp->ymax ||
+ (look->ymax == rp->ymin && look->xmin >= rp->xmax));
+ );
+ /* Now we know look->ymax <= rp->ymin. */
+ if (look == 0 || look->ymax < rp->ymin ||
+ look->xmax <= rp->xmin
+ ) { /* No adjacent rectangle, switch directions. */
+ state =
+ (rp == visit && first_visit == visit_left ? cpe_close :
+ (set_line(rp->xmin, rp->ymin), cpe_left));
+ return_line(rp->xmax, rp->ymin);
+ }
+ /* We found an adjacent rectangle. */
+ /* See if it also adjoins a rectangle to the right of rp. */
+ {
+ gx_clip_rect *next = rp->next;
+ gx_clip_rect *cur = rp;
+
+ if (next != 0 && next->ymin == rp->ymin &&
+ look->xmax > next->xmin
+ ) { /* There's an adjoining rectangle as well. */
+ /* Switch directions. */
+ rp = next;
+ state =
+ (rp == visit && first_visit == visit_left ? cpe_close :
+ (set_line(next->xmin, next->ymin), cpe_left));
+ return_line(cur->xmax, cur->ymin);
+ }
+ rp = look;
+ if (rp == visit && first_visit == visit_right)
+ state = cpe_close;
+ else if (rp->xmax == cur->xmax)
+ goto right;
+ else
+ set_line(rp->xmax, rp->ymax);
+ return_line(cur->xmax, cur->ymin);
+ }
#undef return_line
- case cpe_close:
- /* We've gone all the way around an edge. */
- code = gs_pe_closepath;
- state = cpe_scan;
- break;
+ case cpe_close:
+ /* We've gone all the way around an edge. */
+ code = gs_pe_closepath;
+ state = cpe_scan;
+ break;
- default:
- return_error(gs_error_unknownerror);
- }
+ default:
+ return_error(gs_error_unknownerror);
+ }
out: /* Store the state before exiting. */
- penum->visit = visit;
- penum->rp = rp;
- penum->first_visit = first_visit;
- penum->state = state;
- return code;
+ penum->visit = visit;
+ penum->rp = rp;
+ penum->first_visit = first_visit;
+ penum->state = state;
+ return code;
}
#undef set_pt
#undef set_line
@@ -994,40 +992,40 @@ gx_clip_list_free(gx_clip_list * clp, gs_memory_t * mem)
gx_clip_rect *rp = clp->tail;
while (rp != 0) {
- gx_clip_rect *prev = rp->prev;
+ gx_clip_rect *prev = rp->prev;
- gs_free_object(mem, rp, "gx_clip_list_free");
- rp = prev;
+ gs_free_object(mem, rp, "gx_clip_list_free");
+ rp = prev;
}
gx_clip_list_init(clp);
}
/* Check whether a rectangle has a non-empty intersection with a clipping patch. */
-bool
+bool
gx_cpath_rect_visible(gx_clip_path * pcpath, gs_int_rect *prect)
{
const gx_clip_rect *pr;
const gx_clip_list *list = &pcpath->rect_list->list;
switch (list->count) {
- case 0:
- return false;
- case 1:
- pr = &list->single;
- break;
- default:
- pr = list->head;
+ case 0:
+ return false;
+ case 1:
+ pr = &list->single;
+ break;
+ default:
+ pr = list->head;
}
for (; pr != 0; pr = pr->next) {
- if (pr->xmin > prect->q.x)
- continue;
- if (pr->xmax < prect->p.x)
- continue;
- if (pr->ymin > prect->q.y)
- continue;
- if (pr->ymax < prect->p.y)
- continue;
- return true;
+ if (pr->xmin > prect->q.x)
+ continue;
+ if (pr->xmax < prect->p.x)
+ continue;
+ if (pr->ymin > prect->q.y)
+ continue;
+ if (pr->ymax < prect->p.y)
+ continue;
+ return true;
}
return false;
}
@@ -1041,26 +1039,26 @@ gx_cpath_copy(const gx_clip_path * from, gx_clip_path * pcpath)
pcpath->path_valid = false;
/* NOTE: pcpath->path still contains the old path. */
if (pcpath->path_list)
- rc_decrement(pcpath->path_list, "gx_cpath_copy");
+ rc_decrement(pcpath->path_list, "gx_cpath_copy");
pcpath->path_list = NULL;
pcpath->rule = from->rule;
pcpath->outer_box = from->outer_box;
pcpath->inner_box = from->inner_box;
l->single = from->rect_list->list.single;
for (r = from->rect_list->list.head; r != NULL; r = r->next) {
- s = gs_alloc_struct(from->rect_list->rc.memory, gx_clip_rect, &st_clip_rect, "gx_cpath_copy");
- if (s == NULL)
- return_error(gs_error_VMerror);
- *s = *r;
- s->next = NULL;
- if (l->tail) {
- s->prev = l->tail;
- l->tail->next = s;
- } else {
- l->head = s;
- s->prev = NULL;
- }
- l->tail = s;
+ s = gs_alloc_struct(from->rect_list->rc.memory, gx_clip_rect, &st_clip_rect, "gx_cpath_copy");
+ if (s == NULL)
+ return_error(gs_error_VMerror);
+ *s = *r;
+ s->next = NULL;
+ if (l->tail) {
+ s->prev = l->tail;
+ l->tail->next = s;
+ } else {
+ l->head = s;
+ s->prev = NULL;
+ }
+ l->tail = s;
}
l->count = from->rect_list->list.count;
return 0;
@@ -1077,20 +1075,20 @@ gx_clip_list_print(const gx_clip_list *list)
const gx_clip_rect *pr;
dlprintf3(" list count=%d xmin=%d xmax=%d\n",
- list->count, list->xmin, list->xmax);
+ list->count, list->xmin, list->xmax);
switch (list->count) {
- case 0:
- pr = 0;
- break;
- case 1:
- pr = &list->single;
- break;
- default:
- pr = list->head;
+ case 0:
+ pr = 0;
+ break;
+ case 1:
+ pr = &list->single;
+ break;
+ default:
+ pr = list->head;
}
for (; pr != 0; pr = pr->next)
- dlprintf4(" rect: (%d,%d),(%d,%d)\n",
- pr->xmin, pr->ymin, pr->xmax, pr->ymax);
+ dlprintf4(" rect: (%d,%d),(%d,%d)\n",
+ pr->xmin, pr->ymin, pr->xmax, pr->ymax);
}
/* Print a clipping path */
@@ -1098,21 +1096,21 @@ void
gx_cpath_print(const gx_clip_path * pcpath)
{
if (pcpath->path_valid)
- gx_path_print(&pcpath->path);
+ gx_path_print(&pcpath->path);
else
- dlputs(" (path not valid)\n");
+ dlputs(" (path not valid)\n");
dlprintf4(" inner_box=(%g,%g),(%g,%g)\n",
- fixed2float(pcpath->inner_box.p.x),
- fixed2float(pcpath->inner_box.p.y),
- fixed2float(pcpath->inner_box.q.x),
- fixed2float(pcpath->inner_box.q.y));
+ fixed2float(pcpath->inner_box.p.x),
+ fixed2float(pcpath->inner_box.p.y),
+ fixed2float(pcpath->inner_box.q.x),
+ fixed2float(pcpath->inner_box.q.y));
dlprintf4(" outer_box=(%g,%g),(%g,%g)",
- fixed2float(pcpath->outer_box.p.x),
- fixed2float(pcpath->outer_box.p.y),
- fixed2float(pcpath->outer_box.q.x),
- fixed2float(pcpath->outer_box.q.y));
+ fixed2float(pcpath->outer_box.p.x),
+ fixed2float(pcpath->outer_box.p.y),
+ fixed2float(pcpath->outer_box.q.x),
+ fixed2float(pcpath->outer_box.q.y));
dprintf2(" rule=%d list.refct=%ld\n",
- pcpath->rule, pcpath->rect_list->rc.ref_count);
+ pcpath->rule, pcpath->rect_list->rc.ref_count);
gx_clip_list_print(gx_cpath_list(pcpath));
}
diff --git a/gs/base/gxcpath.h b/gs/base/gxcpath.h
index 458987e99..6de09b7f8 100644
--- a/gs/base/gxcpath.h
+++ b/gs/base/gxcpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -71,7 +71,7 @@ struct gx_clip_list_s {
gx_clip_rect *tail;
int xmin, xmax; /* min and max X over all but head/tail */
int count; /* # of rectangles not counting */
- /* head or tail */
+ /* head or tail */
};
#define public_st_clip_list() /* in gxcpath.c */\
@@ -110,11 +110,11 @@ extern_st(st_device_clip);
gx_device_finalize)
void gx_make_clip_device_on_stack(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target);
void gx_make_clip_device_in_heap(gx_device_clip * dev, const gx_clip_path *pcpath, gx_device *target,
- gs_memory_t *mem);
+ gs_memory_t *mem);
#define clip_rect_print(ch, str, ar)\
if_debug7(ch, "[%c]%s 0x%lx: (%d,%d),(%d,%d)\n", ch, str, (ulong)ar,\
- (ar)->xmin, (ar)->ymin, (ar)->xmax, (ar)->ymax)
+ (ar)->xmin, (ar)->ymin, (ar)->xmax, (ar)->ymax)
/* Exported by gxcpath.c for gxacpath.c */
diff --git a/gs/base/gxcspace.h b/gs/base/gxcspace.h
index b2a1d1a31..824a814ee 100644
--- a/gs/base/gxcspace.h
+++ b/gs/base/gxcspace.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -77,7 +77,7 @@ struct gs_color_space_type_s {
int proc(const gs_color_space *)
#define cs_num_components(pcs)\
(*(pcs)->type->num_components)(pcs)
- cs_proc_num_components((*num_components));
+ cs_proc_num_components((*num_components));
/* Construct the initial color value for this space. */
@@ -87,7 +87,7 @@ struct gs_color_space_type_s {
(*(pcs)->type->init_color)(pcc, pcs)
#define cs_full_init_color(pcc, pcs)\
((pcc)->pattern = 0, cs_init_color(pcc, pcs))
- cs_proc_init_color((*init_color));
+ cs_proc_init_color((*init_color));
/* Force a client color into its legal range. */
@@ -95,17 +95,17 @@ struct gs_color_space_type_s {
void proc(gs_client_color *, const gs_color_space *)
#define cs_restrict_color(pcc, pcs)\
((pcs)->type->restrict_color(pcc, pcs))
- cs_proc_restrict_color((*restrict_color));
+ cs_proc_restrict_color((*restrict_color));
/* Return the concrete color space underlying this one. */
/* (Not defined for Pattern spaces.) */
#define cs_proc_concrete_space(proc)\
const gs_color_space *proc(const gs_color_space *,\
- const gs_imager_state *)
+ const gs_imager_state *)
#define cs_concrete_space(pcs, pis)\
(*(pcs)->type->concrete_space)(pcs, pis)
- cs_proc_concrete_space((*concrete_space));
+ cs_proc_concrete_space((*concrete_space));
/*
* Reduce a color to a concrete color. A concrete color is one
@@ -120,15 +120,15 @@ struct gs_color_space_type_s {
frac *, const gs_imager_state *, gx_device *)
#define cs_concretize_color(pcc, pcs, values, pis, dev)\
(*(pcs)->type->concretize_color)(pcc, pcs, values, pis, dev)
- cs_proc_concretize_color((*concretize_color));
+ cs_proc_concretize_color((*concretize_color));
/* Map a concrete color to a device color. */
/* (Only defined for concrete color spaces.) */
#define cs_proc_remap_concrete_color(proc)\
int proc(const frac *, const gs_color_space * pcs, gx_device_color *,\
- const gs_imager_state *, gx_device *, gs_color_select_t)
- cs_proc_remap_concrete_color((*remap_concrete_color));
+ const gs_imager_state *, gx_device *, gs_color_select_t)
+ cs_proc_remap_concrete_color((*remap_concrete_color));
/* Map a color directly to a device color. */
@@ -136,13 +136,13 @@ struct gs_color_space_type_s {
int proc(const gs_client_color *, const gs_color_space *,\
gx_device_color *, const gs_imager_state *, gx_device *,\
gs_color_select_t)
- cs_proc_remap_color((*remap_color));
+ cs_proc_remap_color((*remap_color));
/* Install the color space in a graphics state. */
#define cs_proc_install_cspace(proc)\
int proc(gs_color_space *, gs_state *)
- cs_proc_install_cspace((*install_cspace));
+ cs_proc_install_cspace((*install_cspace));
/*
* Push the appropriate overprint compositor onto the current device.
@@ -158,13 +158,13 @@ struct gs_color_space_type_s {
#define cs_proc_set_overprint(proc)\
int proc(const gs_color_space *, gs_state *)
- cs_proc_set_overprint((*set_overprint));
+ cs_proc_set_overprint((*set_overprint));
/* Free contents of composite colorspace objects. */
#define cs_proc_final(proc)\
void proc(const gs_color_space *)
- cs_proc_final((*final));
+ cs_proc_final((*final));
/* Adjust reference counts of indirect color components. */
/*
@@ -179,12 +179,12 @@ struct gs_color_space_type_s {
#define cs_adjust_color_count(pgs, delta)\
(*gs_currentcolorspace_inline(pgs)->type->adjust_color_count)\
(gs_currentcolor_inline(pgs), gs_currentcolorspace_inline(pgs), delta)
- cs_proc_adjust_color_count((*adjust_color_count));
+ cs_proc_adjust_color_count((*adjust_color_count));
/* Adjust both reference counts. */
#define cs_adjust_counts(pgs, delta)\
cs_adjust_color_count(pgs, delta); \
- rc_adjust_const(gs_currentcolorspace_inline(pgs), delta, "cs_adjust_counts")
+ rc_adjust_const(gs_currentcolorspace_inline(pgs), delta, "cs_adjust_counts")
/* Serialization. */
/*
@@ -196,19 +196,19 @@ struct gs_color_space_type_s {
int proc(const gs_color_space *, stream *)
#define cs_serialize(pcs, s)\
(*(pcs)->type->serialize)(pcs, s)
- cs_proc_serialize((*serialize));
+ cs_proc_serialize((*serialize));
/* A color mapping linearity check. */
#define cs_proc_is_linear(proc)\
int proc(const gs_color_space *cs, const gs_imager_state * pis,\
- gx_device *dev,\
- const gs_client_color *c0, const gs_client_color *c1,\
- const gs_client_color *c2, const gs_client_color *c3,\
- float smoothness, gsicc_link_t *icclink)
+ gx_device *dev,\
+ const gs_client_color *c0, const gs_client_color *c1,\
+ const gs_client_color *c2, const gs_client_color *c3,\
+ float smoothness, gsicc_link_t *icclink)
#define cs_is_linear(pcs, pis, dev, c0, c1, c2, c3, smoothness, icclink)\
(*(pcs)->type->is_linear)(pcs, pis, dev, c0, c1, c2, c3, smoothness, icclink)
- cs_proc_is_linear((*is_linear));
+ cs_proc_is_linear((*is_linear));
};
extern_st(st_base_color_space);
diff --git a/gs/base/gxctable.c b/gs/base/gxctable.c
index 54d494ee2..851b1e82d 100644
--- a/gs/base/gxctable.c
+++ b/gs/base/gxctable.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,24 +26,24 @@
*/
void
gx_color_interpolate_nearest(const fixed * pi,
- const gx_color_lookup_table * pclt, frac * pv)
+ const gx_color_lookup_table * pclt, frac * pv)
{
const int *pdim = pclt->dims;
int m = pclt->m;
const gs_const_string *table = pclt->table;
if (pclt->n > 3) {
- table += fixed2int_var_rounded(pi[0]) * pdim[1];
- ++pi, ++pdim;
+ table += fixed2int_var_rounded(pi[0]) * pdim[1];
+ ++pi, ++pdim;
} {
- int ic = fixed2int_var_rounded(pi[2]);
- int ib = fixed2int_var_rounded(pi[1]);
- int ia = fixed2int_var_rounded(pi[0]);
- const byte *p = pclt->table[ia].data + (ib * pdim[2] + ic) * m;
- int j;
+ int ic = fixed2int_var_rounded(pi[2]);
+ int ib = fixed2int_var_rounded(pi[1]);
+ int ia = fixed2int_var_rounded(pi[0]);
+ const byte *p = pclt->table[ia].data + (ib * pdim[2] + ic) * m;
+ int j;
- for (j = 0; j < m; ++j, ++p)
- pv[j] = byte2frac(*p);
+ for (j = 0; j < m; ++j, ++p)
+ pv[j] = byte2frac(*p);
}
}
@@ -52,91 +52,91 @@ gx_color_interpolate_nearest(const fixed * pi,
*/
static void
interpolate_accum(const fixed * pi, const gx_color_lookup_table * pclt,
- frac * pv, fixed factor)
+ frac * pv, fixed factor)
{
const int *pdim = pclt->dims;
int m = pclt->m;
if (pclt->n > 3) {
- /* Do two 3-D interpolations, interpolating between them. */
- gx_color_lookup_table clt3;
- int ix = fixed2int_var(pi[0]);
- fixed fx = fixed_fraction(pi[0]);
+ /* Do two 3-D interpolations, interpolating between them. */
+ gx_color_lookup_table clt3;
+ int ix = fixed2int_var(pi[0]);
+ fixed fx = fixed_fraction(pi[0]);
- clt3.n = 3;
- clt3.dims[0] = pdim[1]; /* needed only for range checking */
- clt3.dims[1] = pdim[2];
- clt3.dims[2] = pdim[3];
- clt3.m = m;
- clt3.table = pclt->table + ix * pdim[1];
- interpolate_accum(pi + 1, &clt3, pv, fixed_1);
- if (ix == pdim[0] - 1)
- return;
- clt3.table += pdim[1];
- interpolate_accum(pi + 1, &clt3, pv, fx);
+ clt3.n = 3;
+ clt3.dims[0] = pdim[1]; /* needed only for range checking */
+ clt3.dims[1] = pdim[2];
+ clt3.dims[2] = pdim[3];
+ clt3.m = m;
+ clt3.table = pclt->table + ix * pdim[1];
+ interpolate_accum(pi + 1, &clt3, pv, fixed_1);
+ if (ix == pdim[0] - 1)
+ return;
+ clt3.table += pdim[1];
+ interpolate_accum(pi + 1, &clt3, pv, fx);
} else {
- int ic = fixed2int_var(pi[2]);
- fixed fc = fixed_fraction(pi[2]);
- uint dc1 = (ic == pdim[2] - 1 ? 0 : m);
- int ib = fixed2int_var(pi[1]);
- fixed fb = fixed_fraction(pi[1]);
- uint db1 = (ib == pdim[1] - 1 ? 0 : pdim[2] * m);
- uint dbc = (ib * pdim[2] + ic) * m;
- uint dbc1 = db1 + dc1;
- int ia = fixed2int_var(pi[0]);
- fixed fa = fixed_fraction(pi[0]);
- const byte *pa0 = pclt->table[ia].data + dbc;
- const byte *pa1 =
- (ia == pdim[0] - 1 ? pa0 : pclt->table[ia + 1].data + dbc);
- int j;
+ int ic = fixed2int_var(pi[2]);
+ fixed fc = fixed_fraction(pi[2]);
+ uint dc1 = (ic == pdim[2] - 1 ? 0 : m);
+ int ib = fixed2int_var(pi[1]);
+ fixed fb = fixed_fraction(pi[1]);
+ uint db1 = (ib == pdim[1] - 1 ? 0 : pdim[2] * m);
+ uint dbc = (ib * pdim[2] + ic) * m;
+ uint dbc1 = db1 + dc1;
+ int ia = fixed2int_var(pi[0]);
+ fixed fa = fixed_fraction(pi[0]);
+ const byte *pa0 = pclt->table[ia].data + dbc;
+ const byte *pa1 =
+ (ia == pdim[0] - 1 ? pa0 : pclt->table[ia + 1].data + dbc);
+ int j;
- /* The values to be interpolated are */
- /* pa{0,1}[{0,db1,dc1,dbc1}]. */
- for (j = 0; j < m; ++j, ++pa0, ++pa1) {
- frac v000 = byte2frac(pa0[0]);
- frac v001 = byte2frac(pa0[dc1]);
- frac v010 = byte2frac(pa0[db1]);
- frac v011 = byte2frac(pa0[dbc1]);
- frac v100 = byte2frac(pa1[0]);
- frac v101 = byte2frac(pa1[dc1]);
- frac v110 = byte2frac(pa1[db1]);
- frac v111 = byte2frac(pa1[dbc1]);
- frac rv;
+ /* The values to be interpolated are */
+ /* pa{0,1}[{0,db1,dc1,dbc1}]. */
+ for (j = 0; j < m; ++j, ++pa0, ++pa1) {
+ frac v000 = byte2frac(pa0[0]);
+ frac v001 = byte2frac(pa0[dc1]);
+ frac v010 = byte2frac(pa0[db1]);
+ frac v011 = byte2frac(pa0[dbc1]);
+ frac v100 = byte2frac(pa1[0]);
+ frac v101 = byte2frac(pa1[dc1]);
+ frac v110 = byte2frac(pa1[db1]);
+ frac v111 = byte2frac(pa1[dbc1]);
+ frac rv;
- frac v00 = v000 +
- (frac) arith_rshift((long)fc * (v001 - v000),
- _fixed_shift);
- frac v01 = v010 +
- (frac) arith_rshift((long)fc * (v011 - v010),
- _fixed_shift);
- frac v10 = v100 +
- (frac) arith_rshift((long)fc * (v101 - v100),
- _fixed_shift);
- frac v11 = v110 +
- (frac) arith_rshift((long)fc * (v111 - v110),
- _fixed_shift);
+ frac v00 = v000 +
+ (frac) arith_rshift((long)fc * (v001 - v000),
+ _fixed_shift);
+ frac v01 = v010 +
+ (frac) arith_rshift((long)fc * (v011 - v010),
+ _fixed_shift);
+ frac v10 = v100 +
+ (frac) arith_rshift((long)fc * (v101 - v100),
+ _fixed_shift);
+ frac v11 = v110 +
+ (frac) arith_rshift((long)fc * (v111 - v110),
+ _fixed_shift);
- frac v0 = v00 +
- (frac) arith_rshift((long)fb * (v01 - v00),
- _fixed_shift);
- frac v1 = v10 +
- (frac) arith_rshift((long)fb * (v11 - v10),
- _fixed_shift);
+ frac v0 = v00 +
+ (frac) arith_rshift((long)fb * (v01 - v00),
+ _fixed_shift);
+ frac v1 = v10 +
+ (frac) arith_rshift((long)fb * (v11 - v10),
+ _fixed_shift);
- rv = v0 +
- (frac) arith_rshift((long)fa * (v1 - v0),
- _fixed_shift);
- if (factor == fixed_1)
- pv[j] = rv;
- else
- pv[j] += (frac) arith_rshift((long)factor * (rv - pv[j]),
- _fixed_shift);
- }
+ rv = v0 +
+ (frac) arith_rshift((long)fa * (v1 - v0),
+ _fixed_shift);
+ if (factor == fixed_1)
+ pv[j] = rv;
+ else
+ pv[j] += (frac) arith_rshift((long)factor * (rv - pv[j]),
+ _fixed_shift);
+ }
}
}
void
gx_color_interpolate_linear(const fixed * pi,
- const gx_color_lookup_table * pclt, frac * pv)
+ const gx_color_lookup_table * pclt, frac * pv)
{
interpolate_accum(pi, pclt, pv, fixed_1);
}
diff --git a/gs/base/gxctable.h b/gs/base/gxctable.h
index 27a2fc23d..947c14978 100644
--- a/gs/base/gxctable.h
+++ b/gs/base/gxctable.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,10 +50,10 @@ typedef struct gx_color_lookup_table_s {
/* Return the nearest value without interpolation. */
void gx_color_interpolate_nearest(const fixed * pi,
- const gx_color_lookup_table * pclt, frac * pv);
+ const gx_color_lookup_table * pclt, frac * pv);
/* Use trilinear interpolation. */
void gx_color_interpolate_linear(const fixed * pi,
- const gx_color_lookup_table * pclt, frac * pv);
+ const gx_color_lookup_table * pclt, frac * pv);
#endif /* gxctable_INCLUDED */
diff --git a/gs/base/gxcvalue.h b/gs/base/gxcvalue.h
index a633822a4..02978c4e6 100644
--- a/gs/base/gxcvalue.h
+++ b/gs/base/gxcvalue.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxdcconv.c b/gs/base/gxdcconv.c
index ccf08d3a1..c7c5fe200 100644
--- a/gs/base/gxdcconv.c
+++ b/gs/base/gxdcconv.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,17 +45,17 @@ frac
color_rgb_to_gray(frac r, frac g, frac b, const gs_imager_state * pis)
{
return (r * (unsigned long)lum_red_weight +
- g * (unsigned long)lum_green_weight +
- b * (unsigned long)lum_blue_weight +
- (lum_all_weights / 2))
- / lum_all_weights;
+ g * (unsigned long)lum_green_weight +
+ b * (unsigned long)lum_blue_weight +
+ (lum_all_weights / 2))
+ / lum_all_weights;
}
/* Convert RGB to CMYK. */
/* Note that this involves black generation and undercolor removal. */
void
color_rgb_to_cmyk(frac r, frac g, frac b, const gs_imager_state * pis,
- frac cmyk[4], gs_memory_t *mem)
+ frac cmyk[4], gs_memory_t *mem)
{
frac c = frac_1 - r, m = frac_1 - g, y = frac_1 - b;
frac k = (c < m ? min(c, y) : min(m, y));
@@ -65,44 +65,44 @@ color_rgb_to_cmyk(frac r, frac g, frac b, const gs_imager_state * pis,
* but they must agree with the ones in gs_init.ps.
*/
frac bg =
- (pis == NULL ? k : pis->black_generation == NULL ? frac_0 :
- gx_map_color_frac(pis, k, black_generation));
+ (pis == NULL ? k : pis->black_generation == NULL ? frac_0 :
+ gx_map_color_frac(pis, k, black_generation));
signed_frac ucr =
- (pis == NULL ? k : pis->undercolor_removal == NULL ? frac_0 :
- gx_map_color_frac(pis, k, undercolor_removal));
+ (pis == NULL ? k : pis->undercolor_removal == NULL ? frac_0 :
+ gx_map_color_frac(pis, k, undercolor_removal));
if (ucr == frac_1)
- cmyk[0] = cmyk[1] = cmyk[2] = 0;
+ cmyk[0] = cmyk[1] = cmyk[2] = 0;
else if (ucr == frac_0)
- cmyk[0] = c, cmyk[1] = m, cmyk[2] = y;
+ cmyk[0] = c, cmyk[1] = m, cmyk[2] = y;
else {
- if (!gs_currentcpsimode(mem)) {
- /* C = max(0.0, min(1.0, 1 - R - UCR)), etc. */
- signed_frac not_ucr = (ucr < 0 ? frac_1 + ucr : frac_1);
-
- cmyk[0] = (c < ucr ? frac_0 : c > not_ucr ? frac_1 : c - ucr);
- cmyk[1] = (m < ucr ? frac_0 : m > not_ucr ? frac_1 : m - ucr);
- cmyk[2] = (y < ucr ? frac_0 : y > not_ucr ? frac_1 : y - ucr);
- } else {
- /* Adobe CPSI method */
- /* C = max(0.0, min(1.0, 1 - R / (1 - UCR))), etc. */
- float denom = frac2float(frac_1 - ucr); /* unscaled */
- float v;
-
- v = (float)frac_1 - r / denom; /* unscaled */
- cmyk[0] =
- (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
- v = (float)frac_1 - g / denom; /* unscaled */
- cmyk[1] =
- (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
- v = (float)frac_1 - b / denom; /* unscaled */
- cmyk[2] =
- (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
- }
+ if (!gs_currentcpsimode(mem)) {
+ /* C = max(0.0, min(1.0, 1 - R - UCR)), etc. */
+ signed_frac not_ucr = (ucr < 0 ? frac_1 + ucr : frac_1);
+
+ cmyk[0] = (c < ucr ? frac_0 : c > not_ucr ? frac_1 : c - ucr);
+ cmyk[1] = (m < ucr ? frac_0 : m > not_ucr ? frac_1 : m - ucr);
+ cmyk[2] = (y < ucr ? frac_0 : y > not_ucr ? frac_1 : y - ucr);
+ } else {
+ /* Adobe CPSI method */
+ /* C = max(0.0, min(1.0, 1 - R / (1 - UCR))), etc. */
+ float denom = frac2float(frac_1 - ucr); /* unscaled */
+ float v;
+
+ v = (float)frac_1 - r / denom; /* unscaled */
+ cmyk[0] =
+ (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
+ v = (float)frac_1 - g / denom; /* unscaled */
+ cmyk[1] =
+ (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
+ v = (float)frac_1 - b / denom; /* unscaled */
+ cmyk[2] =
+ (is_fneg(v) ? frac_0 : v >= (float)frac_1 ? frac_1 : (frac) v);
+ }
}
cmyk[3] = bg;
if_debug7('c', "[c]RGB 0x%x,0x%x,0x%x -> CMYK 0x%x,0x%x,0x%x,0x%x\n",
- r, g, b, cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
+ r, g, b, cmyk[0], cmyk[1], cmyk[2], cmyk[3]);
}
/* Convert CMYK to Gray. */
@@ -112,46 +112,46 @@ color_cmyk_to_gray(frac c, frac m, frac y, frac k, const gs_imager_state * pis)
frac not_gray = color_rgb_to_gray(c, m, y, pis);
return (not_gray > frac_1 - k ? /* gray + k > 1.0 */
- frac_0 : frac_1 - (not_gray + k));
+ frac_0 : frac_1 - (not_gray + k));
}
/* Convert CMYK to RGB. */
void
color_cmyk_to_rgb(frac c, frac m, frac y, frac k, const gs_imager_state * pis,
- frac rgb[3], gs_memory_t *mem)
+ frac rgb[3], gs_memory_t *mem)
{
switch (k) {
- case frac_0:
- rgb[0] = frac_1 - c;
- rgb[1] = frac_1 - m;
- rgb[2] = frac_1 - y;
- break;
- case frac_1:
- rgb[0] = rgb[1] = rgb[2] = frac_0;
- break;
- default:
- if (!gs_currentcpsimode(mem)) {
- /* R = 1.0 - min(1.0, C + K), etc. */
- frac not_k = frac_1 - k;
-
- rgb[0] = (c > not_k ? frac_0 : not_k - c);
- rgb[1] = (m > not_k ? frac_0 : not_k - m);
- rgb[2] = (y > not_k ? frac_0 : not_k - y);
- } else {
- /* R = (1.0 - C) * (1.0 - K), etc. */
- ulong not_k = frac_1 - k;
-
- /* Compute not_k * (frac_1 - v) / frac_1 efficiently. */
- ulong prod;
+ case frac_0:
+ rgb[0] = frac_1 - c;
+ rgb[1] = frac_1 - m;
+ rgb[2] = frac_1 - y;
+ break;
+ case frac_1:
+ rgb[0] = rgb[1] = rgb[2] = frac_0;
+ break;
+ default:
+ if (!gs_currentcpsimode(mem)) {
+ /* R = 1.0 - min(1.0, C + K), etc. */
+ frac not_k = frac_1 - k;
+
+ rgb[0] = (c > not_k ? frac_0 : not_k - c);
+ rgb[1] = (m > not_k ? frac_0 : not_k - m);
+ rgb[2] = (y > not_k ? frac_0 : not_k - y);
+ } else {
+ /* R = (1.0 - C) * (1.0 - K), etc. */
+ ulong not_k = frac_1 - k;
+
+ /* Compute not_k * (frac_1 - v) / frac_1 efficiently. */
+ ulong prod;
#define deduct_black(v)\
(prod = (frac_1 - (v)) * not_k, frac_1_quo(prod))
- rgb[0] = deduct_black(c);
- rgb[1] = deduct_black(m);
- rgb[2] = deduct_black(y);
+ rgb[0] = deduct_black(c);
+ rgb[1] = deduct_black(m);
+ rgb[2] = deduct_black(y);
#undef deduct_black
- }
+ }
}
if_debug7('c', "[c]CMYK 0x%x,0x%x,0x%x,0x%x -> RGB 0x%x,0x%x,0x%x\n",
- c, m, y, k, rgb[0], rgb[1], rgb[2]);
+ c, m, y, k, rgb[0], rgb[1], rgb[2]);
}
diff --git a/gs/base/gxdcconv.h b/gs/base/gxdcconv.h
index 25cc25dc0..bc09225d5 100644
--- a/gs/base/gxdcconv.h
+++ b/gs/base/gxdcconv.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,14 +21,14 @@
/* Color space conversion routines */
frac color_rgb_to_gray(frac r, frac g, frac b,
- const gs_imager_state * pis);
+ const gs_imager_state * pis);
void color_rgb_to_cmyk(frac r, frac g, frac b,
- const gs_imager_state * pis, frac cmyk[4],
+ const gs_imager_state * pis, frac cmyk[4],
gs_memory_t * mem);
frac color_cmyk_to_gray(frac c, frac m, frac y, frac k,
- const gs_imager_state * pis);
+ const gs_imager_state * pis);
void color_cmyk_to_rgb(frac c, frac m, frac y, frac k,
- const gs_imager_state * pis, frac rgb[3],
+ const gs_imager_state * pis, frac rgb[3],
gs_memory_t * mem);
#endif /* gxdcconv_INCLUDED */
diff --git a/gs/base/gxdcolor.c b/gs/base/gxdcolor.c
index f21349196..db28d735e 100644
--- a/gs/base/gxdcolor.c
+++ b/gs/base/gxdcolor.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -85,18 +85,18 @@ gx_color_index
gx_device_black(gx_device *dev)
{
if (dev->cached_colors.black == gx_no_color_index) {
- const gx_cm_color_map_procs * cm_procs = dev_proc(dev, get_color_mapping_procs)(dev);
+ const gx_cm_color_map_procs * cm_procs = dev_proc(dev, get_color_mapping_procs)(dev);
int i, ncomps = dev->color_info.num_components;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- /* Get color components for black (gray = 0) */
- cm_procs->map_gray(dev, frac_0, cm_comps);
+ /* Get color components for black (gray = 0) */
+ cm_procs->map_gray(dev, frac_0, cm_comps);
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(cm_comps[i]);
- dev->cached_colors.black = dev_proc(dev, encode_color)(dev, cv);
+ dev->cached_colors.black = dev_proc(dev, encode_color)(dev, cv);
}
return dev->cached_colors.black;
}
@@ -104,18 +104,18 @@ gx_color_index
gx_device_white(gx_device *dev)
{
if (dev->cached_colors.white == gx_no_color_index) {
- const gx_cm_color_map_procs * cm_procs = dev_proc(dev, get_color_mapping_procs)(dev);
+ const gx_cm_color_map_procs * cm_procs = dev_proc(dev, get_color_mapping_procs)(dev);
int i, ncomps = dev->color_info.num_components;
frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS];
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
- /* Get color components for white (gray = 1) */
- cm_procs->map_gray(dev, frac_1, cm_comps);
+ /* Get color components for white (gray = 1) */
+ cm_procs->map_gray(dev, frac_1, cm_comps);
for (i = 0; i < ncomps; i++)
cv[i] = frac2cv(cm_comps[i]);
- dev->cached_colors.white = dev_proc(dev, encode_color)(dev, cv);
+ dev->cached_colors.white = dev_proc(dev, encode_color)(dev, cv);
}
return dev->cached_colors.white;
}
@@ -132,23 +132,23 @@ static const gx_rop_source_t gx_rop_no_source_0 = {gx_rop_no_source_body(0)};
static const gx_rop_source_t gx_rop_no_source_1 = {gx_rop_no_source_body(1)};
void
gx_set_rop_no_source(const gx_rop_source_t **psource,
- gx_rop_source_t *pno_source, gx_device *dev)
+ gx_rop_source_t *pno_source, gx_device *dev)
{
gx_color_index black;
top:
black = dev->cached_colors.black;
if (black == 0)
- *psource = &gx_rop_no_source_0;
+ *psource = &gx_rop_no_source_0;
else if (black == 1)
- *psource = &gx_rop_no_source_1;
+ *psource = &gx_rop_no_source_1;
else if (black == gx_no_color_index) { /* cache not loaded */
- discard(gx_device_black(dev));
- goto top;
+ discard(gx_device_black(dev));
+ goto top;
} else {
- *pno_source = gx_rop_no_source_0;
- gx_rop_source_set_color(pno_source, black);
- *psource = pno_source;
+ *pno_source = gx_rop_no_source_0;
+ gx_rop_source_set_color(pno_source, black);
+ *psource = pno_source;
}
}
@@ -160,7 +160,7 @@ top:
*/
bool
gx_device_color_equal(const gx_device_color *pdevc1,
- const gx_device_color *pdevc2)
+ const gx_device_color *pdevc2)
{
return pdevc1->type->equal(pdevc1, pdevc2);
}
@@ -238,35 +238,35 @@ gx_dc_no_get_dev_halftone(const gx_device_color * pdevc)
static int
gx_dc_no_load(gx_device_color *pdevc, const gs_imager_state *ignore_pis,
- gx_device *ignore_dev, gs_color_select_t ignore_select)
+ gx_device *ignore_dev, gs_color_select_t ignore_select)
{
return 0;
}
static int
gx_dc_no_fill_rectangle(const gx_device_color *pdevc, int x, int y,
- int w, int h, gx_device *dev,
- gs_logical_operation_t lop,
- const gx_rop_source_t *source)
+ int w, int h, gx_device *dev,
+ gs_logical_operation_t lop,
+ const gx_rop_source_t *source)
{
gx_device_color filler;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
if (lop_uses_T(lop))
- return_error(gs_error_Fatal);
+ return_error(gs_error_Fatal);
set_nonclient_dev_color(&filler, 0); /* any valid value for dev will do */
return gx_dc_pure_fill_rectangle(&filler, x, y, w, h, dev, lop, source);
}
static int
gx_dc_no_fill_masked(const gx_device_color *pdevc, const byte *data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_device *dev,
- gs_logical_operation_t lop, bool invert)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_device *dev,
+ gs_logical_operation_t lop, bool invert)
{
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
return_error(gs_error_Fatal);
}
@@ -343,25 +343,25 @@ gx_dc_no_get_nonzero_comps(
static int
gx_dc_null_load(gx_device_color *pdevc, const gs_imager_state *ignore_pis,
- gx_device *ignore_dev, gs_color_select_t ignore_select)
+ gx_device *ignore_dev, gs_color_select_t ignore_select)
{
return 0;
}
static int
gx_dc_null_fill_rectangle(const gx_device_color * pdevc, int x, int y,
- int w, int h, gx_device * dev,
- gs_logical_operation_t lop,
- const gx_rop_source_t * source)
+ int w, int h, gx_device * dev,
+ gs_logical_operation_t lop,
+ const gx_rop_source_t * source)
{
return 0;
}
static int
gx_dc_null_fill_masked(const gx_device_color * pdevc, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_device * dev,
- gs_logical_operation_t lop, bool invert)
+ int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_device * dev,
+ gs_logical_operation_t lop, bool invert)
{
return 0;
}
@@ -398,7 +398,7 @@ gx_dc_pure_save_dc(const gx_device_color * pdevc, gx_device_color_saved * psdc)
static int
gx_dc_pure_load(gx_device_color * pdevc, const gs_imager_state * ignore_pis,
- gx_device * ignore_dev, gs_color_select_t ignore_select)
+ gx_device * ignore_dev, gs_color_select_t ignore_select)
{
return 0;
}
@@ -407,23 +407,23 @@ gx_dc_pure_load(gx_device_color * pdevc, const gs_imager_state * ignore_pis,
/* Note that we treat this as "texture" for RasterOp. */
static int
gx_dc_pure_fill_rectangle(const gx_device_color * pdevc, int x, int y,
- int w, int h, gx_device * dev, gs_logical_operation_t lop,
- const gx_rop_source_t * source)
+ int w, int h, gx_device * dev, gs_logical_operation_t lop,
+ const gx_rop_source_t * source)
{
if (source == NULL && lop_no_S_is_T(lop))
- return (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h,
- pdevc->colors.pure);
+ return (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h,
+ pdevc->colors.pure);
{
- gx_color_index colors[2];
- gx_rop_source_t no_source;
-
- colors[0] = colors[1] = pdevc->colors.pure;
- if (source == NULL)
- set_rop_no_source(source, no_source, dev);
- return (*dev_proc(dev, strip_copy_rop))
- (dev, source->sdata, source->sourcex, source->sraster,
- source->id, (source->use_scolors ? source->scolors : NULL),
- NULL /*arbitrary */ , colors, x, y, w, h, 0, 0, lop);
+ gx_color_index colors[2];
+ gx_rop_source_t no_source;
+
+ colors[0] = colors[1] = pdevc->colors.pure;
+ if (source == NULL)
+ set_rop_no_source(source, no_source, dev);
+ return (*dev_proc(dev, strip_copy_rop))
+ (dev, source->sdata, source->sourcex, source->sraster,
+ source->id, (source->use_scolors ? source->scolors : NULL),
+ NULL /*arbitrary */ , colors, x, y, w, h, 0, 0, lop);
}
}
@@ -431,34 +431,34 @@ gx_dc_pure_fill_rectangle(const gx_device_color * pdevc, int x, int y,
/* Note that there is no source in this case: the mask is the source. */
static int
gx_dc_pure_fill_masked(const gx_device_color * pdevc, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_device * dev, gs_logical_operation_t lop, bool invert)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_device * dev, gs_logical_operation_t lop, bool invert)
{
if (lop_no_S_is_T(lop)) {
- gx_color_index color0, color1;
-
- if (invert)
- color0 = pdevc->colors.pure, color1 = gx_no_color_index;
- else
- color1 = pdevc->colors.pure, color0 = gx_no_color_index;
- return (*dev_proc(dev, copy_mono))
- (dev, data, data_x, raster, id, x, y, w, h, color0, color1);
+ gx_color_index color0, color1;
+
+ if (invert)
+ color0 = pdevc->colors.pure, color1 = gx_no_color_index;
+ else
+ color1 = pdevc->colors.pure, color0 = gx_no_color_index;
+ return (*dev_proc(dev, copy_mono))
+ (dev, data, data_x, raster, id, x, y, w, h, color0, color1);
} {
- gx_color_index scolors[2];
- gx_color_index tcolors[2];
-
- if ( lop != lop_default ) {
- scolors[0] = gx_device_white(dev);
- scolors[1] = gx_device_black(dev);
- } else {
- scolors[0] = gx_device_black(dev);
- scolors[1] = gx_device_white(dev);
+ gx_color_index scolors[2];
+ gx_color_index tcolors[2];
+
+ if ( lop != lop_default ) {
+ scolors[0] = gx_device_white(dev);
+ scolors[1] = gx_device_black(dev);
+ } else {
+ scolors[0] = gx_device_black(dev);
+ scolors[1] = gx_device_white(dev);
}
- tcolors[0] = tcolors[1] = pdevc->colors.pure;
- return (*dev_proc(dev, strip_copy_rop))
- (dev, data, data_x, raster, id, scolors,
- NULL, tcolors, x, y, w, h, 0, 0,
- (invert ? rop3_invert_S(lop) : lop) | (rop3_S | lop_S_transparent));
+ tcolors[0] = tcolors[1] = pdevc->colors.pure;
+ return (*dev_proc(dev, strip_copy_rop))
+ (dev, data, data_x, raster, id, scolors,
+ NULL, tcolors, x, y, w, h, 0, 0,
+ (invert ? rop3_invert_S(lop) : lop) | (rop3_S | lop_S_transparent));
}
}
@@ -466,7 +466,7 @@ static bool
gx_dc_pure_equal(const gx_device_color * pdevc1, const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
- gx_dc_pure_color(pdevc1) == gx_dc_pure_color(pdevc2);
+ gx_dc_pure_color(pdevc1) == gx_dc_pure_color(pdevc2);
}
/*
@@ -478,7 +478,7 @@ gx_dc_pure_equal(const gx_device_color * pdevc1, const gx_device_color * pdevc2)
*
* psdc pointer ot saved version of last serialized color (for
* this band); this is ignored
- *
+ *
* dev pointer to the current device, used to retrieve process
* color model information
*
@@ -610,8 +610,8 @@ gx_complete_halftone(gx_device_color *pdevc, int num_comps, gx_device_halftone *
/* Fill a mask with a color by parsing the mask into rectangles. */
int
gx_dc_default_fill_masked(const gx_device_color * pdevc, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_device * dev, gs_logical_operation_t lop, bool invert)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_device * dev, gs_logical_operation_t lop, bool invert)
{
int lbit = data_x & 7;
const byte *row = data + (data_x >> 3);
@@ -620,61 +620,61 @@ gx_dc_default_fill_masked(const gx_device_color * pdevc, const byte * data,
int iy;
for (iy = 0; iy < h; ++iy, row += raster) {
- const byte *p = row;
- int bit = lbit;
- int left = w;
- int l0;
-
- while (left) {
- int run, code;
-
- /* Skip a run of zeros. */
- run = byte_bit_run_length[bit][*p ^ one];
- if (run) {
- if (run < 8) {
- if (run >= left)
- break; /* end of row while skipping */
- bit += run, left -= run;
- } else if ((run -= 8) >= left)
- break; /* end of row while skipping */
- else {
- left -= run;
- ++p;
- while (left > 8 && *p == zero)
- left -= 8, ++p;
- run = byte_bit_run_length_0[*p ^ one];
- if (run >= left) /* run < 8 unless very last byte */
- break; /* end of row while skipping */
- else
- bit = run & 7, left -= run;
- }
- }
- l0 = left;
- /* Scan a run of ones, and then paint it. */
- run = byte_bit_run_length[bit][*p ^ zero];
- if (run < 8) {
- if (run >= left)
- left = 0;
- else
- bit += run, left -= run;
- } else if ((run -= 8) >= left)
- left = 0;
- else {
- left -= run;
- ++p;
- while (left > 8 && *p == one)
- left -= 8, ++p;
- run = byte_bit_run_length_0[*p ^ zero];
- if (run >= left) /* run < 8 unless very last byte */
- left = 0;
- else
- bit = run & 7, left -= run;
- }
- code = gx_device_color_fill_rectangle(pdevc,
- x + w - l0, y + iy, l0 - left, 1, dev, lop, NULL);
- if (code < 0)
- return code;
- }
+ const byte *p = row;
+ int bit = lbit;
+ int left = w;
+ int l0;
+
+ while (left) {
+ int run, code;
+
+ /* Skip a run of zeros. */
+ run = byte_bit_run_length[bit][*p ^ one];
+ if (run) {
+ if (run < 8) {
+ if (run >= left)
+ break; /* end of row while skipping */
+ bit += run, left -= run;
+ } else if ((run -= 8) >= left)
+ break; /* end of row while skipping */
+ else {
+ left -= run;
+ ++p;
+ while (left > 8 && *p == zero)
+ left -= 8, ++p;
+ run = byte_bit_run_length_0[*p ^ one];
+ if (run >= left) /* run < 8 unless very last byte */
+ break; /* end of row while skipping */
+ else
+ bit = run & 7, left -= run;
+ }
+ }
+ l0 = left;
+ /* Scan a run of ones, and then paint it. */
+ run = byte_bit_run_length[bit][*p ^ zero];
+ if (run < 8) {
+ if (run >= left)
+ left = 0;
+ else
+ bit += run, left -= run;
+ } else if ((run -= 8) >= left)
+ left = 0;
+ else {
+ left -= run;
+ ++p;
+ while (left > 8 && *p == one)
+ left -= 8, ++p;
+ run = byte_bit_run_length_0[*p ^ zero];
+ if (run >= left) /* run < 8 unless very last byte */
+ left = 0;
+ else
+ bit = run & 7, left -= run;
+ }
+ code = gx_device_color_fill_rectangle(pdevc,
+ x + w - l0, y + iy, l0 - left, 1, dev, lop, NULL);
+ if (code < 0)
+ return code;
+ }
}
return 0;
}
diff --git a/gs/base/gxdcolor.h b/gs/base/gxdcolor.h
index f90286239..0b53e18f4 100644
--- a/gs/base/gxdcolor.h
+++ b/gs/base/gxdcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,7 +56,7 @@ typedef struct gx_rop_source_s {
#define gx_rop_source_set_color(prs, pixel)\
((prs)->scolors[0] = (prs)->scolors[1] = (pixel))
void gx_set_rop_no_source(const gx_rop_source_t **psource,
- gx_rop_source_t *pno_source, gx_device *dev);
+ gx_rop_source_t *pno_source, gx_device *dev);
#define set_rop_no_source(source, no_source, dev)\
gx_set_rop_no_source(&(source), &(no_source), dev)
@@ -94,15 +94,15 @@ struct gx_device_color_type_s {
*/
#define dev_color_proc_save_dc(proc)\
void proc(const gx_device_color * pdevc, gx_device_color_saved * psdc)
- dev_color_proc_save_dc((*save_dc));
+ dev_color_proc_save_dc((*save_dc));
#define dev_color_proc_get_dev_halftone(proc)\
const gx_device_halftone * proc(const gx_device_color * pdevc)
- dev_color_proc_get_dev_halftone((*get_dev_halftone));
+ dev_color_proc_get_dev_halftone((*get_dev_halftone));
#define dev_color_proc_get_phase(proc)\
bool proc(const gx_device_color * pdevc, gs_int_point * pphase)
- dev_color_proc_get_phase((*get_phase));
+ dev_color_proc_get_phase((*get_phase));
/*
* If necessary and possible, load the halftone or Pattern cache
@@ -155,13 +155,13 @@ struct gx_device_color_type_s {
* the routine sets *psize to 0 and returns 1. Otherwise, if *psize
* is large enough, the procedure sets *psize to the amount actually
* used and returns 0. If *psize is zero and no other problem
- * is detected, *psize is set to the amount required and
- * gs_error_rangecheck is returned. If *psize is not zero,
+ * is detected, *psize is set to the amount required and
+ * gs_error_rangecheck is returned. If *psize is not zero,
* a data block is written into the buffer, and the function returns 0.
* Note the function always fills entire buffer of *psize length,
- * except for the last block of the stream, which is written until
- * the stream end. If some other error is detected, *psize is left unchanged
- * and the error code is returned. When *psize is not zero,
+ * except for the last block of the stream, which is written until
+ * the stream end. If some other error is detected, *psize is left unchanged
+ * and the error code is returned. When *psize is not zero,
* the offset operand specifies the position of the block in the stream.
*
* The "read" routine converts the stream representation back into
@@ -216,13 +216,13 @@ struct gx_device_color_type_s {
#define dev_color_proc_write(proc)\
int proc(const gx_device_color *pdevc, const gx_device_color_saved *psdc,\
const gx_device * dev, uint offset, byte *data, uint *psize)
- dev_color_proc_write((*write));
+ dev_color_proc_write((*write));
#define dev_color_proc_read(proc)\
int proc(gx_device_color *pdevc, const gs_imager_state * pis,\
const gx_device_color *prior_devc, const gx_device * dev, uint offset,\
const byte *data, uint size, gs_memory_t *mem)
- dev_color_proc_read((*read));
+ dev_color_proc_read((*read));
/*
* Identify which color model components have non-zero intensities in
@@ -268,7 +268,7 @@ extern const gx_device_color_type_t
#define gx_dc_type_pure (&gx_dc_type_data_pure)
gx_dc_type_data_pure, /* gxdcolor.c */
/*#define gx_dc_type_pattern (&gx_dc_type_data_pattern) */
- /*gx_dc_type_data_pattern, *//* gspcolor.c */
+ /*gx_dc_type_data_pattern, *//* gspcolor.c */
#define gx_dc_type_ht_binary (&gx_dc_type_data_ht_binary)
gx_dc_type_data_ht_binary, /* gxht.c */
#define gx_dc_type_ht_colored (&gx_dc_type_data_ht_colored)
@@ -289,7 +289,6 @@ extern const gx_device_color_type_t * gx_get_dc_type_from_index(int);
extern dev_color_proc_get_phase(gx_dc_no_get_phase);
extern dev_color_proc_get_phase(gx_dc_ht_get_phase);
-
#define gs_color_writes_pure(pgs)\
color_writes_pure(gs_currentdevicecolor_inline(pgs), (pgs)->log_op)
@@ -319,7 +318,7 @@ int gx_remap_color(gs_state *);
gx_color_load_select(pdevc, pis, dev, gs_color_select_texture)
#define gs_state_color_load(pgs)\
gx_color_load(gs_currentdevicecolor_inline(pgs), (const gs_imager_state *)(pgs),\
- (pgs)->device)
+ (pgs)->device)
/* Fill a rectangle with a color. */
#define gx_device_color_fill_rectangle(pdevc, x, y, w, h, dev, lop, source)\
diff --git a/gs/base/gxdda.h b/gs/base/gxdda.h
index f4c6f0245..4e070017c 100644
--- a/gs/base/gxdda.h
+++ b/gs/base/gxdda.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -58,18 +58,18 @@ typedef struct gx_dda_int_s {
} gx_dda_int_t;
/* DDA with fixed Q and (unsigned) integer N */
-typedef
+typedef
dda_state_struct(_a, fixed, uint) gx_dda_state_fixed;
typedef dda_step_struct(_e, fixed, uint) gx_dda_step_fixed;
typedef struct gx_dda_fixed_s {
- gx_dda_state_fixed state;
- gx_dda_step_fixed step;
+ gx_dda_state_fixed state;
+ gx_dda_step_fixed step;
} gx_dda_fixed;
/*
* Define a pair of DDAs for iterating along an arbitrary line.
*/
typedef struct gx_dda_fixed_point_s {
- gx_dda_fixed x, y;
+ gx_dda_fixed x, y;
} gx_dda_fixed_point;
/*
* Initialize a DDA. The sign test is needed only because C doesn't
@@ -151,5 +151,5 @@ dda_state_struct(_a, fixed, uint) gx_dda_state_fixed;
((dstate).Q += (delta))
#define dda_translate(dda, delta)\
dda_state_translate((dda).state, delta)
-
+
#endif /* gxdda_INCLUDED */
diff --git a/gs/base/gxdevbuf.h b/gs/base/gxdevbuf.h
index d8755458a..69f1617d3 100644
--- a/gs/base/gxdevbuf.h
+++ b/gs/base/gxdevbuf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,7 +55,6 @@ typedef struct gx_band_complexity_s {
#endif
} gx_band_complexity_t;
-
typedef struct gx_device_buf_procs_s {
/*
@@ -72,8 +71,8 @@ typedef struct gx_device_buf_procs_s {
#define dev_proc_create_buf_device(proc)\
int proc(gx_device **pbdev, gx_device *target, int y,\
- const gx_render_plane_t *render_plane, gs_memory_t *mem,\
- gx_band_complexity_t *band_complexity)
+ const gx_render_plane_t *render_plane, gs_memory_t *mem,\
+ gx_band_complexity_t *band_complexity)
dev_proc_create_buf_device((*create_buf_device));
@@ -83,8 +82,8 @@ typedef struct gx_device_buf_procs_s {
#define dev_proc_size_buf_device(proc)\
int proc(gx_device_buf_space_t *space, gx_device *target,\
- const gx_render_plane_t *render_plane,\
- int height, bool for_band)
+ const gx_render_plane_t *render_plane,\
+ int height, bool for_band)
dev_proc_size_buf_device((*size_buf_device));
@@ -103,8 +102,8 @@ typedef struct gx_device_buf_procs_s {
#define dev_proc_setup_buf_device(proc)\
int proc(gx_device *bdev, byte *buffer, int bytes_per_line,\
- byte **line_ptrs /*[height]*/, int y, int setup_height,\
- int full_height)
+ byte **line_ptrs /*[height]*/, int y, int setup_height,\
+ int full_height)
dev_proc_setup_buf_device((*setup_buf_device));
diff --git a/gs/base/gxdevcli.h b/gs/base/gxdevcli.h
index 106971268..340dc545e 100644
--- a/gs/base/gxdevcli.h
+++ b/gs/base/gxdevcli.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -162,7 +162,6 @@ typedef struct gx_image_enum_common_s gx_image_enum_common_t;
typedef struct gs_pattern1_instance_s gs_pattern1_instance_t;
#endif
-
/* Define the type for colors passed to the higher-level procedures. */
typedef gx_device_color gx_drawing_color;
@@ -191,8 +190,8 @@ typedef struct gx_device_anti_alias_info_s {
int graphics_bits; /* ditto */
} gx_device_anti_alias_info;
-typedef int32_t frac31; /* A fraction value in [-1,1].
- Represents a color (in [0,1])
+typedef int32_t frac31; /* A fraction value in [-1,1].
+ Represents a color (in [0,1])
or a color difference (in [-1,1]) in shadings. */
/* Define an edge of a linear color trapezoid. Requirement: end.y >= start.y. */
@@ -203,7 +202,6 @@ typedef struct gs_linear_color_edge_s {
fixed clip_x;
} gs_linear_color_edge;
-
/*
* Possible values for the separable_and_linear flag in the
* gx_device_color_info structure. These form an order, with lower
@@ -223,7 +221,7 @@ typedef struct gs_linear_color_edge_s {
* A separable and linear encoding has the separability and
* linearity properties.
*
- * Encodings with this property are completely characterized
+ * Encodings with this property are completely characterized
* by the comp_shift array. Hence, there is no need to provide
* an encode_color procedure for such devices, though the device
* creator may choose to do so for performance reasons (e.g.: when
@@ -323,7 +321,7 @@ typedef struct gx_device_color_info_s {
gx_color_polarity_t polarity;
/*
- * The number of bits of gx_color_index actually used.
+ * The number of bits of gx_color_index actually used.
* This must be <= arch_sizeof_color_index, which is usually 64.
*/
byte depth;
@@ -332,7 +330,7 @@ typedef struct gx_device_color_info_s {
* Index of the gray color component, if any. The max_gray and
* dither_gray values apply to this component only; all other
* components use the max_color and dither_color values.
- *
+ *
* Note: This field refers to a 'gray' colorant because of the
* past use of the max_gray/color and dither_grays/colors fields.
* Prior to 8.00, the 'gray' values were used for monochrome
@@ -351,7 +349,7 @@ typedef struct gx_device_color_info_s {
* 1 (the green colorant), set max_gray to 63 and dither_grays to
* 64, and set max_color to 31 and dither_colors to 32.
*
- * This will be GX_CINFO_COMP_NO_INDEX if there is no 'gray'
+ * This will be GX_CINFO_COMP_NO_INDEX if there is no 'gray'
* component.
*/
byte gray_index;
@@ -455,7 +453,7 @@ typedef struct gx_device_color_info_s {
/* NB encoding flag ignored */
#define dci_extended_alpha_values(mcmp, nc, p, d, gi, mg, \
- mc, dg, dc, ta, ga, sl, cn) \
+ mc, dg, dc, ta, ga, sl, cn) \
{mcmp /* max components */, \
nc /* number components */, \
p /* polarity */, \
@@ -482,7 +480,6 @@ typedef struct gx_device_color_info_s {
( (dev)->color_info.num_components > 1 || \
(dev)->color_info.gray_index == GX_CINFO_COMP_NO_INDEX )
-
/* parameter initialization macros for backwards compatibility */
/*
@@ -523,8 +520,7 @@ typedef struct gx_device_color_info_s {
dci_std_gray_index(nc), \
mg, mc, dg, dc, ta, ga, \
GX_CINFO_UNKNOWN_SEP_LIN, \
- dci_std_cm_name(nc) )
-
+ dci_std_cm_name(nc) )
/*
* Determine the depth corresponding to a color_bits specification.
@@ -576,14 +572,13 @@ typedef struct gx_device_color_info_s {
#define dci_std_color_max_gray(nc, color_bits) \
( (nc) == 3 \
? 0 \
- : (1 << dci_std_gray_bits(nc, color_bits)) - 1 )
+ : (1 << dci_std_gray_bits(nc, color_bits)) - 1 )
#define dci_std_color_max_color(nc, color_bits) \
( (nc) == 1 \
? 0 \
: (1 << dci_std_color_bits(nc, color_bits)) - 1 )
-
/*
* Define a color model based strictly on the number of bits
* available for color representation. Please note, this is only
@@ -614,7 +609,6 @@ typedef struct gx_device_color_info_s {
#define get_process_color_model_name(dev) \
((dev)->color_info.cm_name)
-
/* Structure for device procedures. */
typedef struct gx_device_procs_s gx_device_procs;
@@ -643,9 +637,9 @@ dev_page_proc_end_page(gx_default_end_page);
/* ----------- A stroked gradient recognizer data ----------*/
-/* This structure is associated with a device for
+/* This structure is associated with a device for
internal needs of the graphics library.
- The main purpose is to suppress stroke adjustment
+ The main purpose is to suppress stroke adjustment
when painting a gradient as a set of parallel strokes.
Such gradients still come from some obsolete 3d party software.
See bug 687974,
@@ -661,7 +655,7 @@ typedef struct gx_stroked_gradient_recognizer_s {
/*
* Define the generic device structure. The device procedures can
* have two different configurations:
- *
+ *
* - Statically initialized devices predating release 2.8.1
* set the static_procs pointer to point to a separate procedure record,
* and do not initialize procs.
@@ -687,55 +681,55 @@ typedef struct gx_device_cached_colors_s {
gx_color_index black, white;
} gx_device_cached_colors_t;
#define gx_device_common\
- int params_size; /* OBSOLETE if stype != 0: */\
- /* size of this structure */\
- const gx_device_procs *static_procs; /* OBSOLETE */\
- /* pointer to procs */\
- const char *dname; /* the device name */\
- gs_memory_t *memory; /* (0 iff static prototype) */\
- gs_memory_type_ptr_t stype; /* memory manager structure type, */\
- /* may be 0 if static prototype */\
- bool stype_is_dynamic; /* if true, free the stype when */\
- /* freeing the device */\
- void (*finalize)(gx_device *); /* finalization to execute */\
- /* before closing device, if any */\
- rc_header rc; /* reference count from gstates */\
- /* and targets, +1 if retained */\
- bool retained; /* true if retained */\
- bool is_open; /* true if device has been opened */\
- int max_fill_band; /* limit on band size for fill, */\
- /* must be 0 or a power of 2 */\
- /* (see gdevabuf.c for more info) */\
- gx_device_color_info color_info; /* color information */\
- gx_device_cached_colors_t cached_colors;\
- int width; /* width in pixels */\
- int height; /* height in pixels */\
+ int params_size; /* OBSOLETE if stype != 0: */\
+ /* size of this structure */\
+ const gx_device_procs *static_procs; /* OBSOLETE */\
+ /* pointer to procs */\
+ const char *dname; /* the device name */\
+ gs_memory_t *memory; /* (0 iff static prototype) */\
+ gs_memory_type_ptr_t stype; /* memory manager structure type, */\
+ /* may be 0 if static prototype */\
+ bool stype_is_dynamic; /* if true, free the stype when */\
+ /* freeing the device */\
+ void (*finalize)(gx_device *); /* finalization to execute */\
+ /* before closing device, if any */\
+ rc_header rc; /* reference count from gstates */\
+ /* and targets, +1 if retained */\
+ bool retained; /* true if retained */\
+ bool is_open; /* true if device has been opened */\
+ int max_fill_band; /* limit on band size for fill, */\
+ /* must be 0 or a power of 2 */\
+ /* (see gdevabuf.c for more info) */\
+ gx_device_color_info color_info; /* color information */\
+ gx_device_cached_colors_t cached_colors;\
+ int width; /* width in pixels */\
+ int height; /* height in pixels */\
int LeadingEdge; /* see below */\
- float MediaSize[2]; /* media dimensions in points */\
- float ImagingBBox[4]; /* imageable region in points */\
- bool ImagingBBox_set;\
- float HWResolution[2]; /* resolution, dots per inch */\
- float MarginsHWResolution[2]; /* resolution for Margins */\
- float Margins[2]; /* offset of physical page corner */\
- /* from device coordinate (0,0), */\
- /* in units given by MarginsHWResolution */\
- float HWMargins[4]; /* margins around imageable area, */\
- /* in default user units ("points") */\
- long PageCount; /* number of pages written */\
- long ShowpageCount; /* number of calls on showpage */\
- int NumCopies;\
- bool NumCopies_set;\
- bool IgnoreNumCopies; /* if true, force num_copies = 1 */\
- bool UseCIEColor; /* for PS LL3 */\
- bool LockSafetyParams; /* If true, prevent unsafe changes */\
- long band_offset_x; /* offsets of clist band base to (mem device) buffer */\
- long band_offset_y; /* for rendering that is phase sensitive (wtsimdi) */\
- gx_stroked_gradient_recognizer_t sgr;\
- int MaxPatternBitmap; /* Threshold for switching to pattern_clist mode */\
+ float MediaSize[2]; /* media dimensions in points */\
+ float ImagingBBox[4]; /* imageable region in points */\
+ bool ImagingBBox_set;\
+ float HWResolution[2]; /* resolution, dots per inch */\
+ float MarginsHWResolution[2]; /* resolution for Margins */\
+ float Margins[2]; /* offset of physical page corner */\
+ /* from device coordinate (0,0), */\
+ /* in units given by MarginsHWResolution */\
+ float HWMargins[4]; /* margins around imageable area, */\
+ /* in default user units ("points") */\
+ long PageCount; /* number of pages written */\
+ long ShowpageCount; /* number of calls on showpage */\
+ int NumCopies;\
+ bool NumCopies_set;\
+ bool IgnoreNumCopies; /* if true, force num_copies = 1 */\
+ bool UseCIEColor; /* for PS LL3 */\
+ bool LockSafetyParams; /* If true, prevent unsafe changes */\
+ long band_offset_x; /* offsets of clist band base to (mem device) buffer */\
+ long band_offset_y; /* for rendering that is phase sensitive (wtsimdi) */\
+ gx_stroked_gradient_recognizer_t sgr;\
+ int MaxPatternBitmap; /* Threshold for switching to pattern_clist mode */\
cmm_profile_t *device_icc_profile; /* Device profile in non-gc memory */\
- gx_page_device_procs page_procs; /* must be last */\
- /* end of std_device_body */\
- gx_device_procs procs /* object procedures */
+ gx_page_device_procs page_procs; /* must be last */\
+ /* end of std_device_body */\
+ gx_device_procs procs /* object procedures */
#define LEADINGEDGE_MASK 3
#define LEADINGEDGE_SET_MASK (1 << 2)
@@ -874,7 +868,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_copy_color(proc)\
dev_t_proc_copy_color(proc, gx_device)
- /* OBSOLETED in release 3.66 */
+ /* OBSOLETED in release 3.66 */
#define dev_t_proc_draw_line(proc, dev_t)\
int proc(dev_t *dev,\
@@ -882,7 +876,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_draw_line(proc)\
dev_t_proc_draw_line(proc, gx_device)
- /* Added in release 2.4 */
+ /* Added in release 2.4 */
#define dev_t_proc_get_bits(proc, dev_t)\
int proc(dev_t *dev,\
@@ -890,8 +884,8 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_get_bits(proc)\
dev_t_proc_get_bits(proc, gx_device)
- /* Added in release 2.4, changed in 2.8, */
- /* renamed in 2.9.6 */
+ /* Added in release 2.4, changed in 2.8, */
+ /* renamed in 2.9.6 */
#define dev_t_proc_get_params(proc, dev_t)\
int proc(dev_t *dev, gs_param_list *plist)
@@ -903,7 +897,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_put_params(proc)\
dev_t_proc_put_params(proc, gx_device)
- /* Added in release 2.6 */
+ /* Added in release 2.6 */
#define dev_t_proc_map_cmyk_color(proc, dev_t)\
gx_color_index proc(dev_t *dev, const gx_color_value cv[])
@@ -915,14 +909,14 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_get_xfont_procs(proc)\
dev_t_proc_get_xfont_procs(proc, gx_device)
- /* Added in release 2.6.1 */
+ /* Added in release 2.6.1 */
#define dev_t_proc_get_xfont_device(proc, dev_t)\
gx_device *proc(dev_t *dev)
#define dev_proc_get_xfont_device(proc)\
dev_t_proc_get_xfont_device(proc, gx_device)
- /* Added in release 2.7.1 */
+ /* Added in release 2.7.1 */
#define dev_t_proc_map_rgb_alpha_color(proc, dev_t)\
gx_color_index proc(dev_t *dev,\
@@ -931,21 +925,21 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_map_rgb_alpha_color(proc)\
dev_t_proc_map_rgb_alpha_color(proc, gx_device)
- /* Added in release 2.8.1 */
+ /* Added in release 2.8.1 */
#define dev_t_proc_get_page_device(proc, dev_t)\
gx_device *proc(dev_t *dev)
#define dev_proc_get_page_device(proc)\
dev_t_proc_get_page_device(proc, gx_device)
- /* Added in release 3.20, OBSOLETED in 5.65 */
+ /* Added in release 3.20, OBSOLETED in 5.65 */
#define dev_t_proc_get_alpha_bits(proc, dev_t)\
int proc(dev_t *dev, graphics_object_type type)
#define dev_proc_get_alpha_bits(proc)\
dev_t_proc_get_alpha_bits(proc, gx_device)
- /* Added in release 3.20 */
+ /* Added in release 3.20 */
#define dev_t_proc_copy_alpha(proc, dev_t)\
int proc(dev_t *dev, const byte *data, int data_x,\
@@ -954,14 +948,14 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_copy_alpha(proc)\
dev_t_proc_copy_alpha(proc, gx_device)
- /* Added in release 3.38 */
+ /* Added in release 3.38 */
#define dev_t_proc_get_band(proc, dev_t)\
int proc(dev_t *dev, int y, int *band_start)
#define dev_proc_get_band(proc)\
dev_t_proc_get_band(proc, gx_device)
- /* Added in release 3.44 */
+ /* Added in release 3.44 */
#define dev_t_proc_copy_rop(proc, dev_t)\
int proc(dev_t *dev,\
@@ -973,7 +967,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_copy_rop(proc)\
dev_t_proc_copy_rop(proc, gx_device)
- /* Added in release 3.60, changed in 3.68. */
+ /* Added in release 3.60, changed in 3.68. */
#define dev_t_proc_fill_path(proc, dev_t)\
int proc(dev_t *dev,\
@@ -991,7 +985,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_stroke_path(proc)\
dev_t_proc_stroke_path(proc, gx_device)
- /* Added in release 3.60 */
+ /* Added in release 3.60 */
#define dev_t_proc_fill_mask(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1002,7 +996,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_fill_mask(proc)\
dev_t_proc_fill_mask(proc, gx_device)
- /* Added in release 3.66, changed in 3.69 */
+ /* Added in release 3.66, changed in 3.69 */
#define dev_t_proc_fill_trapezoid(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1026,10 +1020,10 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_fill_triangle(proc)\
dev_t_proc_fill_triangle(proc, gx_device)
- /* adjustx and adjusty were added in 8.71 to get around a
- * problem with PCL (Bug 691030). In the fullness of time
- * hopefully PCL can be fixed to not need them and they can
- * be removed again. */
+ /* adjustx and adjusty were added in 8.71 to get around a
+ * problem with PCL (Bug 691030). In the fullness of time
+ * hopefully PCL can be fixed to not need them and they can
+ * be removed again. */
#define dev_t_proc_draw_thin_line(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1039,10 +1033,10 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_draw_thin_line(proc)\
dev_t_proc_draw_thin_line(proc, gx_device)
- /* Added in release 3.66 (as stubs); */
- /* changed in 3.68; */
- /* begin_image and image_data changed in 4.30, */
- /* begin_image changed in 5.23. */
+ /* Added in release 3.66 (as stubs); */
+ /* changed in 3.68; */
+ /* begin_image and image_data changed in 4.30, */
+ /* begin_image changed in 5.23. */
#define dev_t_proc_begin_image(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1053,7 +1047,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_begin_image(proc)\
dev_t_proc_begin_image(proc, gx_device)
- /* OBSOLETED in release 5.23 */
+ /* OBSOLETED in release 5.23 */
#define dev_t_proc_image_data(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1062,7 +1056,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_image_data(proc)\
dev_t_proc_image_data(proc, gx_device)
- /* OBSOLETED in release 5.23 */
+ /* OBSOLETED in release 5.23 */
#define dev_t_proc_end_image(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1070,7 +1064,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_end_image(proc)\
dev_t_proc_end_image(proc, gx_device)
- /* Added in release 3.68 */
+ /* Added in release 3.68 */
#define dev_t_proc_strip_tile_rectangle(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1090,14 +1084,14 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_strip_copy_rop(proc)\
dev_t_proc_strip_copy_rop(proc, gx_device)
- /* Added in release 4.20 */
+ /* Added in release 4.20 */
#define dev_t_proc_get_clipping_box(proc, dev_t)\
void proc(dev_t *dev, gs_fixed_rect *pbox)
#define dev_proc_get_clipping_box(proc)\
dev_t_proc_get_clipping_box(proc, gx_device)
- /* Added in release 5.20, changed in 5.23 */
+ /* Added in release 5.20, changed in 5.23 */
#define dev_t_proc_begin_typed_image(proc, dev_t)\
int proc(dev_t *dev,\
@@ -1108,7 +1102,7 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_begin_typed_image(proc)\
dev_t_proc_begin_typed_image(proc, gx_device)
- /* Added in release 5.20 */
+ /* Added in release 5.20 */
#define dev_t_proc_get_bits_rectangle(proc, dev_t)\
int proc(dev_t *dev, const gs_int_rect *prect,\
@@ -1129,26 +1123,25 @@ typedef struct gs_param_list_s gs_param_list;
#define dev_proc_create_compositor(proc)\
dev_t_proc_create_compositor(proc, gx_device)\
- /* Added in release 5.23 */
+ /* Added in release 5.23 */
#define dev_t_proc_get_hardware_params(proc, dev_t)\
int proc(dev_t *dev, gs_param_list *plist)
#define dev_proc_get_hardware_params(proc)\
dev_t_proc_get_hardware_params(proc, gx_device)
- /* Added in release 5.24 */
+ /* Added in release 5.24 */
/* ... text_begin ... see gxtext.h for definition */
- /* Added in release 6.23 */
+ /* Added in release 6.23 */
#define dev_t_proc_finish_copydevice(proc, dev_t)\
int proc(dev_t *dev, const gx_device *from_dev)
#define dev_proc_finish_copydevice(proc)\
dev_t_proc_finish_copydevice(proc, gx_device)
- /* Added in release 6.61 (raph) */
-
+ /* Added in release 6.61 (raph) */
/*
This area of the transparency facilities is in flux. Here is a proposal
@@ -1269,7 +1262,7 @@ typedef enum {
#define dev_t_proc_pattern_manage(proc, dev_t)\
int proc(gx_device *pdev, gx_bitmap_id id,\
- gs_pattern1_instance_t *pinst, pattern_manage_t function)
+ gs_pattern1_instance_t *pinst, pattern_manage_t function)
#define dev_proc_pattern_manage(proc)\
dev_t_proc_pattern_manage(proc, gx_device)
@@ -1277,9 +1270,9 @@ typedef enum {
Fill rectangle with a high level color.
Return rangecheck, if the device can't handle the high level color.
- The graphics library calls this function with degenerate (widths=0)
- rectangles, to know whether the device can handle a rectangle with
- the high level color. The device should skip such rectangles returning
+ The graphics library calls this function with degenerate (widths=0)
+ rectangles, to know whether the device can handle a rectangle with
+ the high level color. The device should skip such rectangles returning
a proper code.
Currently this function is used with gs_rectfill and gs_fillpage only.
@@ -1288,14 +1281,14 @@ typedef enum {
#define dev_t_proc_fill_rectangle_hl_color(proc, dev_t)\
int proc(dev_t *dev, const gs_fixed_rect *rect, \
- const gs_imager_state *pis, const gx_drawing_color *pdcolor, \
- const gx_clip_path *pcpath)
+ const gs_imager_state *pis, const gx_drawing_color *pdcolor, \
+ const gx_clip_path *pcpath)
#define dev_proc_fill_rectangle_hl_color(proc)\
dev_t_proc_fill_rectangle_hl_color(proc, gx_device)
/*
Include a color space into the output.
- This function is used to include DefaultGray, DefaultRGB,
+ This function is used to include DefaultGray, DefaultRGB,
DefaultCMYK into PDF, PS, EPS output.
Low level devices should ignore this call.
*/
@@ -1305,7 +1298,7 @@ typedef enum {
#define dev_proc_include_color_space(proc)\
dev_t_proc_include_color_space(proc, gx_device)
- /* Shading support. */
+ /* Shading support. */
typedef struct gs_fill_attributes_s {
const gs_fixed_rect *clip;
@@ -1320,16 +1313,16 @@ typedef struct gs_fill_attributes_s {
#define dev_t_proc_fill_linear_color_scanline(proc, dev_t)\
int proc(dev_t *dev, const gs_fill_attributes *fa,\
- int i, int j, int w, /* scanline coordinates and width */\
- const frac31 *c0, /* initial color for the pixel (i,j), the integer part */\
- const int32_t *c0_f, /* initial color for the pixel (i,j), the fraction part numerator */\
- const int32_t *cg_num, /* color gradient numerator */\
- int32_t cg_den /* color gradient denominator */)
+ int i, int j, int w, /* scanline coordinates and width */\
+ const frac31 *c0, /* initial color for the pixel (i,j), the integer part */\
+ const int32_t *c0_f, /* initial color for the pixel (i,j), the fraction part numerator */\
+ const int32_t *cg_num, /* color gradient numerator */\
+ int32_t cg_den /* color gradient denominator */)
#define dev_proc_fill_linear_color_scanline(proc)\
dev_t_proc_fill_linear_color_scanline(proc, gx_device)
/* Fill a linear color trapezoid. */
-/* The server assumes a strongly linear color,
+/* The server assumes a strongly linear color,
i.e. it can ignore any of c0, c1, c2, c3. */
/* [p0 : p1] - left edge, from bottom to top.
[p2 : p3] - right edge, from bottom to top.
@@ -1338,9 +1331,9 @@ typedef struct gs_fill_attributes_s {
In this case the color doesn't depend on X (on Y if fa->swap_axes).
In this case the base coordinates for the color gradient
may be unequal to p0, p1, p2, p3, and must be provided/taken
- in/from fa->ystart, fa->yend.
+ in/from fa->ystart, fa->yend.
The return value 0 is not allowed in this case. */
-/* Return values :
+/* Return values :
1 - success;
0 - Too big. The area isn't filled. The client must decompose the area.
<0 - error.
@@ -1348,15 +1341,15 @@ typedef struct gs_fill_attributes_s {
#define dev_t_proc_fill_linear_color_trapezoid(proc, dev_t)\
int proc(dev_t *dev, const gs_fill_attributes *fa,\
- const gs_fixed_point *p0, const gs_fixed_point *p1,\
- const gs_fixed_point *p2, const gs_fixed_point *p3,\
- const frac31 *c0, const frac31 *c1,\
- const frac31 *c2, const frac31 *c3)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,\
+ const gs_fixed_point *p2, const gs_fixed_point *p3,\
+ const frac31 *c0, const frac31 *c1,\
+ const frac31 *c2, const frac31 *c3)
#define dev_proc_fill_linear_color_trapezoid(proc)\
dev_t_proc_fill_linear_color_trapezoid(proc, gx_device)
/* Fill a linear color triangle. */
-/* Return values :
+/* Return values :
1 - success;
0 - Too big. The area isn't filled. The client must decompose the area.
<0 - error.
@@ -1364,9 +1357,9 @@ typedef struct gs_fill_attributes_s {
#define dev_t_proc_fill_linear_color_triangle(proc, dev_t)\
int proc(dev_t *dev, const gs_fill_attributes *fa,\
- const gs_fixed_point *p0, const gs_fixed_point *p1,\
- const gs_fixed_point *p2,\
- const frac31 *c0, const frac31 *c1, const frac31 *c2)
+ const gs_fixed_point *p0, const gs_fixed_point *p1,\
+ const gs_fixed_point *p2,\
+ const frac31 *c0, const frac31 *c1, const frac31 *c2)
#define dev_proc_fill_linear_color_triangle(proc)\
dev_t_proc_fill_linear_color_triangle(proc, gx_device)
@@ -1404,14 +1397,12 @@ typedef struct gs_devn_params_s gs_devn_params;
#define dev_proc_fillpage(proc)\
dev_t_proc_fillpage(proc, gx_device)
-
#define dev_t_proc_push_transparency_state(proc, dev_t)\
int proc(gx_device *dev,\
gs_imager_state *pis)
#define dev_proc_push_transparency_state(proc)\
dev_t_proc_push_transparency_state(proc, gx_device)
-
#define dev_t_proc_pop_transparency_state(proc, dev_t)\
int proc(gx_device *dev,\
gs_imager_state *pis)
@@ -1441,67 +1432,67 @@ typedef struct gs_devn_params_s gs_devn_params;
#define gx_device_proc_struct(dev_t)\
{ dev_t_proc_open_device((*open_device), dev_t);\
- dev_t_proc_get_initial_matrix((*get_initial_matrix), dev_t);\
- dev_t_proc_sync_output((*sync_output), dev_t);\
- dev_t_proc_output_page((*output_page), dev_t);\
- dev_t_proc_close_device((*close_device), dev_t);\
- dev_t_proc_map_rgb_color((*map_rgb_color), dev_t);\
- dev_t_proc_map_color_rgb((*map_color_rgb), dev_t);\
- dev_t_proc_fill_rectangle((*fill_rectangle), dev_t);\
- dev_t_proc_tile_rectangle((*tile_rectangle), dev_t);\
- dev_t_proc_copy_mono((*copy_mono), dev_t);\
- dev_t_proc_copy_color((*copy_color), dev_t);\
- dev_t_proc_draw_line((*obsolete_draw_line), dev_t);\
- dev_t_proc_get_bits((*get_bits), dev_t);\
- dev_t_proc_get_params((*get_params), dev_t);\
- dev_t_proc_put_params((*put_params), dev_t);\
- dev_t_proc_map_cmyk_color((*map_cmyk_color), dev_t);\
- dev_t_proc_get_xfont_procs((*get_xfont_procs), dev_t);\
- dev_t_proc_get_xfont_device((*get_xfont_device), dev_t);\
- dev_t_proc_map_rgb_alpha_color((*map_rgb_alpha_color), dev_t);\
- dev_t_proc_get_page_device((*get_page_device), dev_t);\
- dev_t_proc_get_alpha_bits((*get_alpha_bits), dev_t);\
- dev_t_proc_copy_alpha((*copy_alpha), dev_t);\
- dev_t_proc_get_band((*get_band), dev_t);\
- dev_t_proc_copy_rop((*copy_rop), dev_t);\
- dev_t_proc_fill_path((*fill_path), dev_t);\
- dev_t_proc_stroke_path((*stroke_path), dev_t);\
- dev_t_proc_fill_mask((*fill_mask), dev_t);\
- dev_t_proc_fill_trapezoid((*fill_trapezoid), dev_t);\
- dev_t_proc_fill_parallelogram((*fill_parallelogram), dev_t);\
- dev_t_proc_fill_triangle((*fill_triangle), dev_t);\
- dev_t_proc_draw_thin_line((*draw_thin_line), dev_t);\
- dev_t_proc_begin_image((*begin_image), dev_t);\
- dev_t_proc_image_data((*image_data), dev_t);\
- dev_t_proc_end_image((*end_image), dev_t);\
- dev_t_proc_strip_tile_rectangle((*strip_tile_rectangle), dev_t);\
- dev_t_proc_strip_copy_rop((*strip_copy_rop), dev_t);\
- dev_t_proc_get_clipping_box((*get_clipping_box), dev_t);\
- dev_t_proc_begin_typed_image((*begin_typed_image), dev_t);\
- dev_t_proc_get_bits_rectangle((*get_bits_rectangle), dev_t);\
- dev_t_proc_map_color_rgb_alpha((*map_color_rgb_alpha), dev_t);\
- dev_t_proc_create_compositor((*create_compositor), dev_t);\
- dev_t_proc_get_hardware_params((*get_hardware_params), dev_t);\
- dev_t_proc_text_begin((*text_begin), dev_t);\
- dev_t_proc_finish_copydevice((*finish_copydevice), dev_t);\
- dev_t_proc_begin_transparency_group((*begin_transparency_group), dev_t);\
- dev_t_proc_end_transparency_group((*end_transparency_group), dev_t);\
- dev_t_proc_begin_transparency_mask((*begin_transparency_mask), dev_t);\
- dev_t_proc_end_transparency_mask((*end_transparency_mask), dev_t);\
- dev_t_proc_discard_transparency_layer((*discard_transparency_layer), dev_t);\
- dev_t_proc_get_color_mapping_procs((*get_color_mapping_procs), dev_t); \
- dev_t_proc_get_color_comp_index((*get_color_comp_index), dev_t); \
- dev_t_proc_encode_color((*encode_color), dev_t); \
- dev_t_proc_decode_color((*decode_color), dev_t); \
- dev_t_proc_pattern_manage((*pattern_manage), dev_t); \
- dev_t_proc_fill_rectangle_hl_color((*fill_rectangle_hl_color), dev_t); \
- dev_t_proc_include_color_space((*include_color_space), dev_t); \
- dev_t_proc_fill_linear_color_scanline((*fill_linear_color_scanline), dev_t); \
- dev_t_proc_fill_linear_color_trapezoid((*fill_linear_color_trapezoid), dev_t); \
- dev_t_proc_fill_linear_color_triangle((*fill_linear_color_triangle), dev_t); \
- dev_t_proc_update_spot_equivalent_colors((*update_spot_equivalent_colors), dev_t); \
- dev_t_proc_ret_devn_params((*ret_devn_params), dev_t); \
- dev_t_proc_fillpage((*fillpage), dev_t); \
+ dev_t_proc_get_initial_matrix((*get_initial_matrix), dev_t);\
+ dev_t_proc_sync_output((*sync_output), dev_t);\
+ dev_t_proc_output_page((*output_page), dev_t);\
+ dev_t_proc_close_device((*close_device), dev_t);\
+ dev_t_proc_map_rgb_color((*map_rgb_color), dev_t);\
+ dev_t_proc_map_color_rgb((*map_color_rgb), dev_t);\
+ dev_t_proc_fill_rectangle((*fill_rectangle), dev_t);\
+ dev_t_proc_tile_rectangle((*tile_rectangle), dev_t);\
+ dev_t_proc_copy_mono((*copy_mono), dev_t);\
+ dev_t_proc_copy_color((*copy_color), dev_t);\
+ dev_t_proc_draw_line((*obsolete_draw_line), dev_t);\
+ dev_t_proc_get_bits((*get_bits), dev_t);\
+ dev_t_proc_get_params((*get_params), dev_t);\
+ dev_t_proc_put_params((*put_params), dev_t);\
+ dev_t_proc_map_cmyk_color((*map_cmyk_color), dev_t);\
+ dev_t_proc_get_xfont_procs((*get_xfont_procs), dev_t);\
+ dev_t_proc_get_xfont_device((*get_xfont_device), dev_t);\
+ dev_t_proc_map_rgb_alpha_color((*map_rgb_alpha_color), dev_t);\
+ dev_t_proc_get_page_device((*get_page_device), dev_t);\
+ dev_t_proc_get_alpha_bits((*get_alpha_bits), dev_t);\
+ dev_t_proc_copy_alpha((*copy_alpha), dev_t);\
+ dev_t_proc_get_band((*get_band), dev_t);\
+ dev_t_proc_copy_rop((*copy_rop), dev_t);\
+ dev_t_proc_fill_path((*fill_path), dev_t);\
+ dev_t_proc_stroke_path((*stroke_path), dev_t);\
+ dev_t_proc_fill_mask((*fill_mask), dev_t);\
+ dev_t_proc_fill_trapezoid((*fill_trapezoid), dev_t);\
+ dev_t_proc_fill_parallelogram((*fill_parallelogram), dev_t);\
+ dev_t_proc_fill_triangle((*fill_triangle), dev_t);\
+ dev_t_proc_draw_thin_line((*draw_thin_line), dev_t);\
+ dev_t_proc_begin_image((*begin_image), dev_t);\
+ dev_t_proc_image_data((*image_data), dev_t);\
+ dev_t_proc_end_image((*end_image), dev_t);\
+ dev_t_proc_strip_tile_rectangle((*strip_tile_rectangle), dev_t);\
+ dev_t_proc_strip_copy_rop((*strip_copy_rop), dev_t);\
+ dev_t_proc_get_clipping_box((*get_clipping_box), dev_t);\
+ dev_t_proc_begin_typed_image((*begin_typed_image), dev_t);\
+ dev_t_proc_get_bits_rectangle((*get_bits_rectangle), dev_t);\
+ dev_t_proc_map_color_rgb_alpha((*map_color_rgb_alpha), dev_t);\
+ dev_t_proc_create_compositor((*create_compositor), dev_t);\
+ dev_t_proc_get_hardware_params((*get_hardware_params), dev_t);\
+ dev_t_proc_text_begin((*text_begin), dev_t);\
+ dev_t_proc_finish_copydevice((*finish_copydevice), dev_t);\
+ dev_t_proc_begin_transparency_group((*begin_transparency_group), dev_t);\
+ dev_t_proc_end_transparency_group((*end_transparency_group), dev_t);\
+ dev_t_proc_begin_transparency_mask((*begin_transparency_mask), dev_t);\
+ dev_t_proc_end_transparency_mask((*end_transparency_mask), dev_t);\
+ dev_t_proc_discard_transparency_layer((*discard_transparency_layer), dev_t);\
+ dev_t_proc_get_color_mapping_procs((*get_color_mapping_procs), dev_t); \
+ dev_t_proc_get_color_comp_index((*get_color_comp_index), dev_t); \
+ dev_t_proc_encode_color((*encode_color), dev_t); \
+ dev_t_proc_decode_color((*decode_color), dev_t); \
+ dev_t_proc_pattern_manage((*pattern_manage), dev_t); \
+ dev_t_proc_fill_rectangle_hl_color((*fill_rectangle_hl_color), dev_t); \
+ dev_t_proc_include_color_space((*include_color_space), dev_t); \
+ dev_t_proc_fill_linear_color_scanline((*fill_linear_color_scanline), dev_t); \
+ dev_t_proc_fill_linear_color_trapezoid((*fill_linear_color_trapezoid), dev_t); \
+ dev_t_proc_fill_linear_color_triangle((*fill_linear_color_triangle), dev_t); \
+ dev_t_proc_update_spot_equivalent_colors((*update_spot_equivalent_colors), dev_t); \
+ dev_t_proc_ret_devn_params((*ret_devn_params), dev_t); \
+ dev_t_proc_fillpage((*fillpage), dev_t); \
dev_t_proc_push_transparency_state((*push_transparency_state), dev_t); \
dev_t_proc_pop_transparency_state((*pop_transparency_state), dev_t); \
dev_t_proc_put_image((*put_image), dev_t); \
@@ -1535,16 +1526,16 @@ typedef struct gx_image_plane_s {
* Their replacements no longer take an ignored dev argument.
*/
int gx_image_data(gx_image_enum_common_t *info, const byte **planes,
- int data_x, uint raster, int height);
+ int data_x, uint raster, int height);
/*
* Solely for backward compatibility, gx_image_plane_data doesn't return
* rows_used.
*/
int gx_image_plane_data(gx_image_enum_common_t *info,
- const gx_image_plane_t *planes, int height);
+ const gx_image_plane_t *planes, int height);
int gx_image_plane_data_rows(gx_image_enum_common_t *info,
- const gx_image_plane_t *planes, int height,
- int *rows_used);
+ const gx_image_plane_t *planes, int height,
+ int *rows_used);
int gx_image_flush(gx_image_enum_common_t *info);
bool gx_image_planes_wanted(const gx_image_enum_common_t *info, byte *wanted);
int gx_image_end(gx_image_enum_common_t *info, bool draw_last);
@@ -1616,8 +1607,8 @@ typedef dev_proc_map_color_rgb((*dev_proc_map_color_rgb_t));
* compositing, halftoning, and the null device.
*/
#define gx_device_forward_common\
- gx_device_common;\
- gx_device *target
+ gx_device_common;\
+ gx_device *target
/* A generic forwarding device. */
typedef struct gx_device_forward_s {
gx_device_forward_common;
@@ -1657,13 +1648,13 @@ extern_st(st_device_null);
* internal = true (retained = false).
*/
void gx_device_init(gx_device * dev, const gx_device * proto,
- gs_memory_t * mem, bool internal);
+ gs_memory_t * mem, bool internal);
/* Make a null device. */
/* The gs_memory_t argument is 0 if the device is temporary and local, */
/* or the allocator that was used to allocate it if it is a real object. */
void gs_make_null_device(gx_device_null *dev_null, gx_device *target,
- gs_memory_t *mem);
+ gs_memory_t *mem);
/* Is a null device ? */
bool gs_is_null_device(gx_device *dev);
@@ -1686,7 +1677,7 @@ int gx_device_adjust_resolution(gx_device * dev, int actual_width, int actual_he
/* Set the HWMargins to values defined in inches. */
/* If move_origin is true, also reset the Margins. */
void gx_device_set_margins(gx_device * dev, const float *margins /*[4] */ ,
- bool move_origin);
+ bool move_origin);
/* Set the width and height (in pixels), updating MediaSize. */
void gx_device_set_width_height(gx_device * dev, int width, int height);
diff --git a/gs/base/gxdevmem.h b/gs/base/gxdevmem.h
index 82248213f..2f3ad3809 100644
--- a/gs/base/gxdevmem.h
+++ b/gs/base/gxdevmem.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -106,28 +106,28 @@ struct gx_device_memory_s {
gs_const_string palette; /* RGB triples */
/* Following is only used for 24-bit color. */
struct _c24 {
- gx_color_index rgb; /* cache key */
- bits32 rgbr, gbrg, brgb; /* cache value */
+ gx_color_index rgb; /* cache key */
+ bits32 rgbr, gbrg, brgb; /* cache value */
} color24;
/* Following is only used for 40-bit color. */
struct _c40 {
- gx_color_index abcde; /* cache key */
- bits32 abcd, bcde, cdea, deab, eabc; /* cache value */
+ gx_color_index abcde; /* cache key */
+ bits32 abcd, bcde, cdea, deab, eabc; /* cache value */
} color40;
/* Following is only used for 48-bit color. */
struct _c48 {
- gx_color_index abcdef; /* cache key */
- bits32 abcd, cdef, efab; /* cache value */
+ gx_color_index abcdef; /* cache key */
+ bits32 abcd, cdef, efab; /* cache value */
} color48;
/* Following is only used for 56-bit color. */
struct _c56 {
- gx_color_index abcdefg; /* cache key */
- bits32 abcd, bcde, cdef, defg, efga, fgab, gabc; /* cache value */
+ gx_color_index abcdefg; /* cache key */
+ bits32 abcd, bcde, cdef, defg, efga, fgab, gabc; /* cache value */
} color56;
/* Following is only used for 64-bit color. */
struct _c64 {
- gx_color_index abcdefgh; /* cache key */
- bits32 abcd, efgh; /* cache value */
+ gx_color_index abcdefgh; /* cache key */
+ bits32 abcd, efgh; /* cache value */
} color64;
/* Following are only used for alpha buffers. */
/* The client initializes those marked with $; */
@@ -151,25 +151,25 @@ extern_st(st_device_memory);
gx_device_finalize)
#define st_device_memory_max_ptrs (st_device_forward_max_ptrs + 2)
#define mem_device_init_private\
- 0, /* raster */\
- (byte *)0, /* base */\
- 0, /* bitmap_memory */\
- true, /* foreign_bits (default) */\
- 0, /* line_pointer_memory */\
- true, /* foreign_line_pointers (default) */\
- 0, /* num_planes (default) */\
- { { 0 } }, /* planes (only used for planar) */\
- { identity_matrix_body }, /* initial matrix (filled in) */\
- (byte **)0, /* line_ptrs (filled in by mem_open) */\
- { (byte *)0, 0 }, /* palette (filled in for color) */\
- { gx_no_color_index }, /* color24 */\
- { gx_no_color_index }, /* color40 */\
- { gx_no_color_index }, /* color48 */\
- { gx_no_color_index }, /* color56 */\
- { gx_no_color_index }, /* color64 */\
- { 0, 0 }, 0, /* scale, log2_alpha_bits */\
- 0, 0, 0, 0, /* mapped_* */\
- gx_no_color_index /* save_color */
+ 0, /* raster */\
+ (byte *)0, /* base */\
+ 0, /* bitmap_memory */\
+ true, /* foreign_bits (default) */\
+ 0, /* line_pointer_memory */\
+ true, /* foreign_line_pointers (default) */\
+ 0, /* num_planes (default) */\
+ { { 0 } }, /* planes (only used for planar) */\
+ { identity_matrix_body }, /* initial matrix (filled in) */\
+ (byte **)0, /* line_ptrs (filled in by mem_open) */\
+ { (byte *)0, 0 }, /* palette (filled in for color) */\
+ { gx_no_color_index }, /* color24 */\
+ { gx_no_color_index }, /* color40 */\
+ { gx_no_color_index }, /* color48 */\
+ { gx_no_color_index }, /* color56 */\
+ { gx_no_color_index }, /* color64 */\
+ { 0, 0 }, 0, /* scale, log2_alpha_bits */\
+ 0, 0, 0, 0, /* mapped_* */\
+ gx_no_color_index /* save_color */
/*
* Memory devices may have special setup requirements. In particular, it
@@ -179,13 +179,13 @@ extern_st(st_device_memory);
*/
/* bits only */
int gdev_mem_bits_size(const gx_device_memory *mdev, int width,
- int height, ulong *size);
+ int height, ulong *size);
/* line pointers only */
ulong gdev_mem_line_ptrs_size(const gx_device_memory *mdev, int width,
- int height);
+ int height);
/* bits + line pointers */
int gdev_mem_data_size(const gx_device_memory *mdev, int width,
- int height, ulong *size);
+ int height, ulong *size);
#define gdev_mem_bitmap_size(mdev, size)\
gdev_mem_data_size(mdev, (mdev)->width, (mdev)->height, size)
@@ -195,7 +195,7 @@ int gdev_mem_data_size(const gx_device_memory *mdev, int width,
* compute the maximum height.
*/
int gdev_mem_max_height(const gx_device_memory * dev, int width, ulong size,
- bool page_uses_transparency);
+ bool page_uses_transparency);
/*
* Compute the standard raster (data bytes per line) similarly.
@@ -210,7 +210,7 @@ const gx_device_memory *gdev_mem_device_for_bits(int);
/* Determine the word-oriented memory device for a given depth. */
const gx_device_memory *gdev_mem_word_device_for_bits(int);
-/*
+/*
* Make a memory device. The following 4 procedures will be
* deprecated, use gs_make_mem_*_copydevice() below, for future
* changes.
@@ -222,19 +222,19 @@ const gx_device_memory *gdev_mem_word_device_for_bits(int);
/* 0 if it should propagate this property from its target, or */
/* -1 if it should not be a page device. */
void gs_make_mem_mono_device(gx_device_memory * mdev, gs_memory_t * mem,
- gx_device * target);
+ gx_device * target);
void gs_make_mem_device(gx_device_memory * mdev,
- const gx_device_memory * mdproto,
- gs_memory_t * mem, int page_device,
- gx_device * target);
+ const gx_device_memory * mdproto,
+ gs_memory_t * mem, int page_device,
+ gx_device * target);
void gs_make_mem_abuf_device(gx_device_memory * adev, gs_memory_t * mem,
- gx_device * target,
- const gs_log2_scale_point * pscale,
- int alpha_bits, int mapped_x);
+ gx_device * target,
+ const gs_log2_scale_point * pscale,
+ int alpha_bits, int mapped_x);
void gs_make_mem_alpha_device(gx_device_memory * adev, gs_memory_t * mem,
- gx_device * target, int alpha_bits);
+ gx_device * target, int alpha_bits);
-/*
+/*
* Create memory devices with copydevice. For now the destructor is
* simply: gx_device_retain(mdev, false).
*/
@@ -249,7 +249,7 @@ int gs_make_mem_device_with_copydevice(gx_device_memory ** mdev,
int page_device,
gx_device * target);
-/*
+/*
* TODO replace gs_make_mem_abuf_device, gs_make_mem_alpha_device with
* procedures that use copydevice.
*/
@@ -274,8 +274,8 @@ int gdev_mem_open_scan_lines(gx_device_memory *mdev, int setup_height);
* setup_height.
*/
int gdev_mem_set_line_ptrs(gx_device_memory *mdev,
- byte *base, int raster, byte **line_ptrs,
- int setup_height);
+ byte *base, int raster, byte **line_ptrs,
+ int setup_height);
/* Define whether a monobit memory device is inverted (black=1). */
void gdev_mem_mono_set_inverted(gx_device_memory * mdev, bool black_is_1);
diff --git a/gs/base/gxdevndi.c b/gs/base/gxdevndi.c
index 4b0bdb125..3153ffce4 100644
--- a/gs/base/gxdevndi.c
+++ b/gs/base/gxdevndi.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -90,32 +90,32 @@ const gx_color_value *const fc_color_quo[8] = {
**/
static int
gx_render_device_DeviceN_wts(frac * pcolor,
- gx_device_color * pdevc, gx_device * dev,
- gx_device_halftone * pdht,
- const gs_int_point * ht_phase)
+ gx_device_color * pdevc, gx_device * dev,
+ gx_device_halftone * pdht,
+ const gs_int_point * ht_phase)
{
int i;
gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS];
int num_comp = pdht->num_comp;
for (i = 0; i < num_comp; i++) {
- cv[i] = 0;
+ cv[i] = 0;
}
pdevc->type = gx_dc_type_wts;
pdevc->colors.wts.w_ht = pdht;
if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN) {
- /* Monochrome case may be inverted. */
- pdevc->colors.wts.plane_vector[1] =
- dev_proc(dev, encode_color)(dev, cv);
+ /* Monochrome case may be inverted. */
+ pdevc->colors.wts.plane_vector[1] =
+ dev_proc(dev, encode_color)(dev, cv);
}
for (i = 0; i < num_comp; i++) {
- pdevc->colors.wts.levels[i] = pcolor[i];
- cv[i] = gx_max_color_value;
- pdevc->colors.wts.plane_vector[i] =
- dev_proc(dev, encode_color)(dev, cv);
- cv[i] = 0;
+ pdevc->colors.wts.levels[i] = pcolor[i];
+ cv[i] = gx_max_color_value;
+ pdevc->colors.wts.plane_vector[i] =
+ dev_proc(dev, encode_color)(dev, cv);
+ cv[i] = 0;
}
pdevc->colors.wts.num_components = num_comp;
pdevc->phase = *ht_phase;
@@ -135,8 +135,8 @@ gx_render_device_DeviceN_wts(frac * pcolor,
*/
int
gx_render_device_DeviceN(frac * pcolor,
- gx_device_color * pdevc, gx_device * dev,
- gx_device_halftone * pdht, const gs_int_point * ht_phase)
+ gx_device_color * pdevc, gx_device * dev,
+ gx_device_halftone * pdht, const gs_int_point * ht_phase)
{
uint max_value[GS_CLIENT_COLOR_MAX_COMPONENTS];
frac dither_check = 0;
@@ -147,45 +147,45 @@ gx_render_device_DeviceN(frac * pcolor,
uint l_color[GS_CLIENT_COLOR_MAX_COMPONENTS];
if (pdht && pdht->components && pdht->components[0].corder.wts)
- return gx_render_device_DeviceN_wts(pcolor, pdevc, dev, pdht,
- ht_phase);
+ return gx_render_device_DeviceN_wts(pcolor, pdevc, dev, pdht,
+ ht_phase);
for (i=0; i<num_colors; i++) {
- max_value[i] = (dev->color_info.gray_index == i) ?
- dev->color_info.dither_grays - 1 :
- dev->color_info.dither_colors - 1;
+ max_value[i] = (dev->color_info.gray_index == i) ?
+ dev->color_info.dither_grays - 1 :
+ dev->color_info.dither_colors - 1;
}
for (i = 0; i < num_colors; i++) {
- unsigned long hsize = pdht ?
- (unsigned) pdht->components[i].corder.num_levels
- : 1;
- unsigned long nshades = hsize * max_value[i] + 1;
- long shade = pcolor[i] * nshades / (frac_1_long + 1);
- int_color[i] = shade / hsize;
- l_color[i] = shade % hsize;
- if (max_value[i] < MIN_CONTONE_LEVELS)
- dither_check |= l_color[i];
+ unsigned long hsize = pdht ?
+ (unsigned) pdht->components[i].corder.num_levels
+ : 1;
+ unsigned long nshades = hsize * max_value[i] + 1;
+ long shade = pcolor[i] * nshades / (frac_1_long + 1);
+ int_color[i] = shade / hsize;
+ l_color[i] = shade % hsize;
+ if (max_value[i] < MIN_CONTONE_LEVELS)
+ dither_check |= l_color[i];
}
#ifdef DEBUG
if (gs_debug_c('c')) {
- dlprintf1("[c]ncomp=%d ", num_colors);
- for (i = 0; i < num_colors; i++)
- dlprintf1("0x%x, ", pcolor[i]);
- dlprintf("--> ");
- for (i = 0; i < num_colors; i++)
- dlprintf2("%x+0x%x, ", int_color[i], l_color[i]);
- dlprintf("\n");
+ dlprintf1("[c]ncomp=%d ", num_colors);
+ for (i = 0; i < num_colors; i++)
+ dlprintf1("0x%x, ", pcolor[i]);
+ dlprintf("--> ");
+ for (i = 0; i < num_colors; i++)
+ dlprintf2("%x+0x%x, ", int_color[i], l_color[i]);
+ dlprintf("\n");
}
#endif
/* Check for no dithering required */
if (!dither_check) {
- for (i = 0; i < num_colors; i++)
- vcolor[i] = fractional_color(int_color[i], max_value[i]);
- color_set_pure(pdevc, dev_proc(dev, encode_color)(dev, vcolor));
- return 0;
+ for (i = 0; i < num_colors; i++)
+ vcolor[i] = fractional_color(int_color[i], max_value[i]);
+ color_set_pure(pdevc, dev_proc(dev, encode_color)(dev, vcolor));
+ return 0;
}
/* Use the slow, general colored halftone algorithm. */
@@ -195,13 +195,13 @@ gx_render_device_DeviceN(frac * pcolor,
gx_complete_halftone(pdevc, num_colors, pdht);
color_set_phase_mod(pdevc, ht_phase->x, ht_phase->y,
- pdht->lcm_width, pdht->lcm_height);
+ pdht->lcm_width, pdht->lcm_height);
/* Determine if we are using only one component */
if (!(pdevc->colors.colored.plane_mask &
- (pdevc->colors.colored.plane_mask - 1))) {
- /* We can reduce this color to a binary halftone or pure color. */
- return gx_devn_reduce_colored_halftone(pdevc, dev);
+ (pdevc->colors.colored.plane_mask - 1))) {
+ /* We can reduce this color to a binary halftone or pure color. */
+ return gx_devn_reduce_colored_halftone(pdevc, dev);
}
return 1;
@@ -221,57 +221,57 @@ gx_devn_reduce_colored_halftone(gx_device_color *pdevc, gx_device *dev)
int i;
for (i = 0; i < num_colors; i++) {
- max_value[i] = (dev->color_info.gray_index == i) ?
- dev->color_info.dither_grays - 1 :
- dev->color_info.dither_colors - 1;
+ max_value[i] = (dev->color_info.gray_index == i) ?
+ dev->color_info.dither_grays - 1 :
+ dev->color_info.dither_colors - 1;
b[i] = pdevc->colors.colored.c_base[i];
v[i] = fractional_color(b[i], max_value[i]);
}
c0 = dev_proc(dev, encode_color)(dev, v);
if (planes == 0) {
- /*
- * Use a pure color. This case is unlikely, but it can occur if
- * (and only if) the difference of each component from the nearest
- * device color is less than one halftone level.
- */
- color_set_pure(pdevc, c0);
- return 0;
+ /*
+ * Use a pure color. This case is unlikely, but it can occur if
+ * (and only if) the difference of each component from the nearest
+ * device color is less than one halftone level.
+ */
+ color_set_pure(pdevc, c0);
+ return 0;
} else {
- /* Use a binary color. */
- int i = 0;
- uint bi;
- const gx_device_halftone *pdht = pdevc->colors.colored.c_ht;
- /*
- * NB: the halftone orders are all set up for an additive color
- * space. To use these work with a subtractive color space, it is
- * necessary to invert both the color level and the color
- * pair. Note that if the original color was provided an
- * additive space, this will reverse (in an approximate sense)
- * the color conversion performed to express the color in
- * subtractive space.
- */
- bool invert = dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE;
- uint level;
+ /* Use a binary color. */
+ int i = 0;
+ uint bi;
+ const gx_device_halftone *pdht = pdevc->colors.colored.c_ht;
+ /*
+ * NB: the halftone orders are all set up for an additive color
+ * space. To use these work with a subtractive color space, it is
+ * necessary to invert both the color level and the color
+ * pair. Note that if the original color was provided an
+ * additive space, this will reverse (in an approximate sense)
+ * the color conversion performed to express the color in
+ * subtractive space.
+ */
+ bool invert = dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE;
+ uint level;
- /* Convert plane mask bit position to component number */
- /* Determine i = log2(planes); This works for powers of two */
- while (planes > 7) {
- i += 3;
- planes >>= 3;
- }
- i += planes >> 1; /* log2 for 1,2,4 */
+ /* Convert plane mask bit position to component number */
+ /* Determine i = log2(planes); This works for powers of two */
+ while (planes > 7) {
+ i += 3;
+ planes >>= 3;
+ }
+ i += planes >> 1; /* log2 for 1,2,4 */
- bi = b[i] + 1;
- v[i] = fractional_color(bi, max_value[i]);
- level = pdevc->colors.colored.c_level[i];
+ bi = b[i] + 1;
+ v[i] = fractional_color(bi, max_value[i]);
+ level = pdevc->colors.colored.c_level[i];
c1 = dev_proc(dev, encode_color)(dev, v);
- if (invert) {
- level = pdht->components[i].corder.num_levels - level;
- color_set_binary_halftone_component(pdevc, pdht, i, c1, c0, level);
- } else
- color_set_binary_halftone_component(pdevc, pdht, i, c0, c1, level);
-
- return 1;
+ if (invert) {
+ level = pdht->components[i].corder.num_levels - level;
+ color_set_binary_halftone_component(pdevc, pdht, i, c1, c0, level);
+ } else
+ color_set_binary_halftone_component(pdevc, pdht, i, c0, c1, level);
+
+ return 1;
}
}
diff --git a/gs/base/gxdevndi.h b/gs/base/gxdevndi.h
index 941215c03..9196c27ec 100644
--- a/gs/base/gxdevndi.h
+++ b/gs/base/gxdevndi.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,10 +29,9 @@ typedef struct gx_device_halftone_s gx_device_halftone;
/* Render a color, possibly by halftoning. */
/* Return as for gx_render_[device_]gray. */
int gx_render_device_color_devn(P10(frac red, frac green, frac blue, frac white,
- bool cmyk, gx_color_value alpha,
- gx_device_color * pdevc, gx_device * dev,
- gx_device_halftone * pdht,
- const gs_int_point * ht_phase));
-
+ bool cmyk, gx_color_value alpha,
+ gx_device_color * pdevc, gx_device * dev,
+ gx_device_halftone * pdht,
+ const gs_int_point * ht_phase));
#endif /* gxdevndi_INCLUDED */
diff --git a/gs/base/gxdevrop.h b/gs/base/gxdevrop.h
index cbbe757e7..686afbd3a 100644
--- a/gs/base/gxdevrop.h
+++ b/gs/base/gxdevrop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxdevsop.h b/gs/base/gxdevsop.h
index 7e42467dd..04087502e 100644
--- a/gs/base/gxdevsop.h
+++ b/gs/base/gxdevsop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,7 +51,7 @@
* All device_specific_operations are identified by a unique dev_spec_op
* key, listed in the enumeration below. To add a new one, simply extend the
* enumeration.
- *
+ *
* The generic call to a dev_spec_op function is as follows:
*
* int dev_spec_op(gx_device *dev, int dev_spec_op, void *data, int size);
@@ -110,7 +110,7 @@
enum {
/* All gxdso_ keys must be defined in this structure.
* Do NOT rely on your particular gxdso_ having a particular value.
- * (i.e. do not use: gxdso_foo = 256, or similar below). The individual
+ * (i.e. do not use: gxdso_foo = 256, or similar below). The individual
* values may change on any compile.)
*/
diff --git a/gs/base/gxdht.h b/gs/base/gxdht.h
index 55daea84c..50490feb7 100644
--- a/gs/base/gxdht.h
+++ b/gs/base/gxdht.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -184,19 +184,19 @@ typedef struct gx_ht_order_procs_s {
/* Return the (x,y) coordinate of an element of bit_data. */
int (*bit_index)(const gx_ht_order *order, uint index,
- gs_int_point *ppt);
+ gs_int_point *ppt);
/* Update a halftone cache tile to match this order. */
int (*render)(gx_ht_tile *tile, int new_bit_level,
- const gx_ht_order *order);
+ const gx_ht_order *order);
/* Draw a halftone shade into a 1 bit deep buffer. */
/* Note: this is a tentative design for a new method. I may not
keep it. */
int (*draw)(gx_ht_order *order, frac shade,
- byte *data, int data_raster,
- int x, int y, int w, int h);
+ byte *data, int data_raster,
+ int x, int y, int w, int h);
} gx_ht_order_procs_t;
/*
diff --git a/gs/base/gxdhtres.h b/gs/base/gxdhtres.h
index f0acb6d93..2aea27a68 100644
--- a/gs/base/gxdhtres.h
+++ b/gs/base/gxdhtres.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxdhtserial.c b/gs/base/gxdhtserial.c
index f7ac88821..da73037ac 100644
--- a/gs/base/gxdhtserial.c
+++ b/gs/base/gxdhtserial.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,7 +28,6 @@
#include "gsserial.h"
#include "gxdhtserial.h"
-
/*
* Declare the set of procedures that return resident halftones. This
* declares both the array of procedures and their type. It is used
@@ -36,7 +35,6 @@
*/
extern_gx_device_halftone_list();
-
/*
* An enumeration of halftone transfer functions. These must distinguish
* between cases in which no transfer function is present, and when one
@@ -55,7 +53,6 @@ typedef enum {
gx_ht_wts
} gx_ht_order_type_t;
-
/*
* Serialize a transfer function. These will occupy one byte if they are
* not present or provide an identity mapping,
@@ -71,7 +68,7 @@ typedef enum {
static int
gx_ht_write_tf(
const gx_transfer_map * pmap,
- byte * data,
+ byte * data,
uint * psize )
{
int req_size = 1; /* minimum of one byte */
@@ -218,7 +215,7 @@ gx_ht_write_component(
* is handled in a separate function.
*/
if (porder->wts != 0)
- return gx_ht_write_component_wts(porder->wts, data, psize);
+ return gx_ht_write_component_wts(porder->wts, data, psize);
/*
* The following order fields are not transmitted:
@@ -247,7 +244,7 @@ gx_ht_write_component(
*
* Calculate the size required.
*/
- levels_size = porder->num_levels * sizeof(porder->levels[0]);
+ levels_size = porder->num_levels * sizeof(porder->levels[0]);
bits_size = porder->num_bits * porder->procs->bit_data_elt_size;
req_size = 1 /* gx_ht_type_t */
+ enc_u_sizew(porder->width)
@@ -295,23 +292,23 @@ gx_ht_write_component(
static int
gx_ht_read_component_wts(gx_ht_order_component *pcomp,
- const byte *data, uint size,
- gs_memory_t *mem)
+ const byte *data, uint size,
+ gs_memory_t *mem)
{
const wts_screen_t *ws = (const wts_screen_t *)data;
int hdr_size = wts_size(ws);
int cell_size = ws->cell_width * ws->cell_height *
- sizeof(wts_screen_sample_t);
+ sizeof(wts_screen_sample_t);
int bufsize = 1+hdr_size+cell_size;
memset(&pcomp->corder, 0, sizeof(pcomp->corder));
if (size < bufsize)
- return -1;
+ return -1;
pcomp->corder.wts = gs_wts_from_buf(data, bufsize);
pcomp->cname = 0;
if (pcomp->corder.wts == NULL)
- return -1;
+ return -1;
return bufsize;
}
@@ -352,7 +349,7 @@ gx_ht_read_component(
/* currently only the traditional halftone order are supported */
if (order_type != gx_ht_traditional)
- return gx_ht_read_component_wts(pcomp, data, size, mem);
+ return gx_ht_read_component_wts(pcomp, data, size, mem);
/*
* For performance reasons, the number encoding macros do not
@@ -489,7 +486,6 @@ gx_ht_read_component(
return data - data0;
}
-
/*
* Serialize a halftone. The essential step is the serialization of the
* halftone orders; beyond this only the halftone type must be
@@ -526,7 +522,7 @@ gx_ht_write(
* NB: the pdht->order field is ignored by this code.
*/
if (pdht == 0 || pdht->components == 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
num_dev_comps = pdht->num_dev_comp;
/*
@@ -560,7 +556,7 @@ gx_ht_write(
/* sanity check */
if (i != pdht->components[i].comp_number)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
code = gx_ht_write_component( &pdht->components[i],
data,
@@ -659,9 +655,9 @@ gx_ht_read_and_install(
/* if everything is OK, install the halftone */
if (code >= 0) {
- /* save since the 'install' copies the order, but then clears the source order */
+ /* save since the 'install' copies the order, but then clears the source order */
for (i = 0; i < num_dev_comps; i++)
- components_save[i] = components[i];
+ components_save[i] = components[i];
code = gx_imager_dev_ht_install(pis, &dht, dht.type, dev);
for (i = 0; i < num_dev_comps; i++)
gx_ht_order_release(&components_save[i].corder, mem, false);
diff --git a/gs/base/gxdhtserial.h b/gs/base/gxdhtserial.h
index 9573fb689..6c39c1b3b 100644
--- a/gs/base/gxdhtserial.h
+++ b/gs/base/gxdhtserial.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,6 @@ typedef struct gx_device_halftone_s gx_device_halftone;
typedef struct gs_imager_state_s gs_imager_state;
#endif
-
/*
* Serialize a halftone.
*
diff --git a/gs/base/gxdither.h b/gs/base/gxdither.h
index a5deb6526..d37500d54 100644
--- a/gs/base/gxdither.h
+++ b/gs/base/gxdither.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxdtfill.h b/gs/base/gxdtfill.h
index 55717d269..66b225d30 100644
--- a/gs/base/gxdtfill.h
+++ b/gs/base/gxdtfill.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,16 +16,16 @@
/*
* Since we need several statically defined variants of this agorithm,
- * we store it in .h file and include several times into gdevddrw.c and
+ * we store it in .h file and include several times into gdevddrw.c and
* into gxfill.h . Configuration flags (macros) are :
- *
+ *
* GX_FILL_TRAPEZOID - a name of method
* CONTIGUOUS_FILL - prevent dropouts in narrow trapezoids
* SWAP_AXES - assume swapped axes
* FILL_DIRECT - See LOOP_FILL_RECTANGLE_DIRECT.
* LINEAR_COLOR - Fill with a linear color.
* EDGE_TYPE - a type of edge structure.
- * FILL_ATTRS - operation attributes.
+ * FILL_ATTRS - operation attributes.
*/
/*
@@ -37,10 +37,10 @@
*/
/*
- * With CONTIGUOUS_FILL is off,
+ * With CONTIGUOUS_FILL is off,
* this algorithm paints pixels, which centers fall between
- * the left and the right side of the trapezoid, excluding the
- * right side (see PLRM3, 7.5. Scan conversion details).
+ * the left and the right side of the trapezoid, excluding the
+ * right side (see PLRM3, 7.5. Scan conversion details).
* Particularly 0-width trapezoids are not painted.
*
* Similarly, it paints pixels, which centers
@@ -52,7 +52,7 @@
* Particularly it may paint pixels on the right and on the top sides,
* if they are necessary for the contiguity.
*
- * With LINEAR_COLOR returns 1 if the gradient arithmetics overflows..
+ * With LINEAR_COLOR returns 1 if the gradient arithmetics overflows..
*/
/*
@@ -81,12 +81,12 @@ trap_line represents the intersection coordinate as a rational value :
Where 'e' is 'fixed_epsilon', 0.5 is 'fixed_half', and fl == l.fx / l.h, fr == - r.fx / r.h,
e <= fl < 0, e <= fr < 0.
-Let
+Let
xl' := xl + 0.5
xr' := xr + 0.5
-Then
+Then
xl = xl' - 0.5
xr = xr' - 0.5
@@ -95,7 +95,7 @@ Then
Xr = xr' - 0.5 + e - fr
ceil(xl' - 0.5 + e - fl - 0.5) <= i < ceil(xr' - 0.5 + e - fr - 0.5)
-
+
which is equivalent to
ceil(xl' + e - fl) - 1 <= i < ceil(xr' + e - fr) - 1
@@ -135,51 +135,51 @@ GX_FILL_TRAPEZOID (gx_device * dev, const EDGE_TYPE * left,
const fixed ymax = fixed_pixround(ytop);
if (ymin >= ymax)
- return 0; /* no scan lines to sample */
+ return 0; /* no scan lines to sample */
{
- int iy = fixed2int_var(ymin);
- const int iy1 = fixed2int_var(ymax);
- trap_line l, r;
- register int rxl, rxr;
- int ry;
- const fixed
- x0l = left->start.x, x1l = left->end.x, x0r = right->start.x,
- x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r;
- const fixed /* partial pixel offset to first line to sample */
- ysl = ymin - left->start.y, ysr = ymin - right->start.y;
- fixed fxl;
- int code;
+ int iy = fixed2int_var(ymin);
+ const int iy1 = fixed2int_var(ymax);
+ trap_line l, r;
+ register int rxl, rxr;
+ int ry;
+ const fixed
+ x0l = left->start.x, x1l = left->end.x, x0r = right->start.x,
+ x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r;
+ const fixed /* partial pixel offset to first line to sample */
+ ysl = ymin - left->start.y, ysr = ymin - right->start.y;
+ fixed fxl;
+ int code;
# if CONTIGUOUS_FILL
- const bool peak0 = ((flags & 1) != 0);
- const bool peak1 = ((flags & 2) != 0);
- int peak_y0 = ybot + fixed_half;
- int peak_y1 = ytop - fixed_half;
+ const bool peak0 = ((flags & 1) != 0);
+ const bool peak1 = ((flags & 2) != 0);
+ int peak_y0 = ybot + fixed_half;
+ int peak_y1 = ytop - fixed_half;
# endif
# if LINEAR_COLOR
- int num_components = dev->color_info.num_components;
- frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
- frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
- frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
- int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
- trap_gradient lg, rg, xg;
+ int num_components = dev->color_info.num_components;
+ frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
+ trap_gradient lg, rg, xg;
# else
- gx_color_index cindex = pdevc->colors.pure;
- dev_proc_fill_rectangle((*fill_rect)) =
- dev_proc(dev, fill_rectangle);
+ gx_color_index cindex = pdevc->colors.pure;
+ dev_proc_fill_rectangle((*fill_rect)) =
+ dev_proc(dev, fill_rectangle);
# endif
- if_debug2('z', "[z]y=[%d,%d]\n", iy, iy1);
+ if_debug2('z', "[z]y=[%d,%d]\n", iy, iy1);
- l.h = left->end.y - left->start.y;
- r.h = right->end.y - right->start.y;
- l.x = x0l + (fixed_half - fixed_epsilon);
- r.x = x0r + (fixed_half - fixed_epsilon);
- ry = iy;
+ l.h = left->end.y - left->start.y;
+ r.h = right->end.y - right->start.y;
+ l.x = x0l + (fixed_half - fixed_epsilon);
+ r.x = x0r + (fixed_half - fixed_epsilon);
+ ry = iy;
/*
* Free variables of FILL_TRAP_RECT:
@@ -196,27 +196,27 @@ GX_FILL_TRAPEZOID (gx_device * dev, const EDGE_TYPE * left,
#if LINEAR_COLOR
# define FILL_TRAP_RECT(x,y,w,h)\
- (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den))
+ (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den))
#else
# define FILL_TRAP_RECT(x,y,w,h)\
- (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h))
+ (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h))
#endif
#define VD_RECT_SWAPPED(rxl, ry, rxr, iy)\
vd_rect(int2fixed(SWAP_AXES ? ry : rxl), int2fixed(SWAP_AXES ? rxl : ry),\
int2fixed(SWAP_AXES ? iy : rxr), int2fixed(SWAP_AXES ? rxr : iy),\
- 1, VD_RECT_COLOR);
-
- /* Compute the dx/dy ratios. */
-
- /*
- * Compute the x offsets at the first scan line to sample. We need
- * to be careful in computing ys# * dx#f {/,%} h# because the
- * multiplication may overflow. We know that all the quantities
- * involved are non-negative, and that ys# is usually less than 1 (as
- * a fixed, of course); this gives us a cheap conservative check for
- * overflow in the multiplication.
- */
+ 1, VD_RECT_COLOR);
+
+ /* Compute the dx/dy ratios. */
+
+ /*
+ * Compute the x offsets at the first scan line to sample. We need
+ * to be careful in computing ys# * dx#f {/,%} h# because the
+ * multiplication may overflow. We know that all the quantities
+ * involved are non-negative, and that ys# is usually less than 1 (as
+ * a fixed, of course); this gives us a cheap conservative check for
+ * overflow in the multiplication.
+ */
#define YMULT_QUO(ys, tl)\
(ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\
fixed_mult_quo(ys, tl.df, tl.h))
@@ -231,101 +231,101 @@ GX_FILL_TRAPEZOID (gx_device * dev, const EDGE_TYPE * left,
*/
#define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \
if (ixl == ixr) \
- if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\
- fixed x = int2fixed(ixl) + fixed_half;\
- if (x - l.x < r.x - x)\
- ++ixr;\
- else\
- --ixl;\
- }
+ if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\
+ fixed x = int2fixed(ixl) + fixed_half;\
+ if (x - l.x < r.x - x)\
+ ++ixr;\
+ else\
+ --ixl;\
+ }
#define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\
if (adj1 < adj2) {\
- if (iy - ry > 1) {\
- VD_RECT_SWAPPED(rxl, ry, rxr, iy - 1);\
- code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\
- if (code < 0)\
- goto xit;\
- ry = iy - 1;\
- }\
- adj1 = adj2 = (adj2 + adj2) / 2;\
+ if (iy - ry > 1) {\
+ VD_RECT_SWAPPED(rxl, ry, rxr, iy - 1);\
+ code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\
+ if (code < 0)\
+ goto xit;\
+ ry = iy - 1;\
+ }\
+ adj1 = adj2 = (adj2 + adj2) / 2;\
}
#else
#define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING
#define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING
#endif
- if (fixed_floor(l.x) == fixed_pixround(x1l)) {
- /* Left edge is vertical, we don't need to increment. */
- l.di = 0, l.df = 0;
- fxl = 0;
- } else {
- compute_dx(&l, dxl, ysl);
- fxl = YMULT_QUO(ysl, l);
- l.x += fxl;
- }
- if (fixed_floor(r.x) == fixed_pixround(x1r)) {
- /* Right edge is vertical. If both are vertical, */
- /* we have a rectangle. */
+ if (fixed_floor(l.x) == fixed_pixround(x1l)) {
+ /* Left edge is vertical, we don't need to increment. */
+ l.di = 0, l.df = 0;
+ fxl = 0;
+ } else {
+ compute_dx(&l, dxl, ysl);
+ fxl = YMULT_QUO(ysl, l);
+ l.x += fxl;
+ }
+ if (fixed_floor(r.x) == fixed_pixround(x1r)) {
+ /* Right edge is vertical. If both are vertical, */
+ /* we have a rectangle. */
# if !LINEAR_COLOR
- if (l.di == 0 && l.df == 0) {
- rxl = fixed2int_var(l.x);
- rxr = fixed2int_var(r.x);
- SET_MINIMAL_WIDTH(rxl, rxr, l, r);
- VD_RECT_SWAPPED(rxl, ry, rxr, iy1);
- code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry);
- goto xit;
- }
+ if (l.di == 0 && l.df == 0) {
+ rxl = fixed2int_var(l.x);
+ rxr = fixed2int_var(r.x);
+ SET_MINIMAL_WIDTH(rxl, rxr, l, r);
+ VD_RECT_SWAPPED(rxl, ry, rxr, iy1);
+ code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry);
+ goto xit;
+ }
# endif
- r.di = 0, r.df = 0;
- }
- /*
- * The test for fxl != 0 is required because the right edge might
- * cross some pixel centers even if the left edge doesn't.
- */
- else if (dxr == dxl && fxl != 0) {
- if (l.di == 0)
- r.di = 0, r.df = l.df;
- else
- compute_dx(&r, dxr, ysr);
- if (ysr == ysl && r.h == l.h)
- r.x += fxl;
- else
- r.x += YMULT_QUO(ysr, r);
- } else {
- compute_dx(&r, dxr, ysr);
- r.x += YMULT_QUO(ysr, r);
- }
- /* Compute one line's worth of dx/dy. */
- compute_ldx(&l, ysl);
- compute_ldx(&r, ysr);
- /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding
- when the rational part is zero. Now add it back to get xl', xr' */
- l.x += fixed_epsilon;
- r.x += fixed_epsilon;
+ r.di = 0, r.df = 0;
+ }
+ /*
+ * The test for fxl != 0 is required because the right edge might
+ * cross some pixel centers even if the left edge doesn't.
+ */
+ else if (dxr == dxl && fxl != 0) {
+ if (l.di == 0)
+ r.di = 0, r.df = l.df;
+ else
+ compute_dx(&r, dxr, ysr);
+ if (ysr == ysl && r.h == l.h)
+ r.x += fxl;
+ else
+ r.x += YMULT_QUO(ysr, r);
+ } else {
+ compute_dx(&r, dxr, ysr);
+ r.x += YMULT_QUO(ysr, r);
+ }
+ /* Compute one line's worth of dx/dy. */
+ compute_ldx(&l, ysl);
+ compute_ldx(&r, ysr);
+ /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding
+ when the rational part is zero. Now add it back to get xl', xr' */
+ l.x += fixed_epsilon;
+ r.x += fixed_epsilon;
# if LINEAR_COLOR
# ifdef DEBUG
- if (check_gradient_overflow(left, right, num_components)) {
- /* The caller must care of.
- Checking it here looses some performance with triangles. */
- return_error(gs_error_unregistered);
- }
+ if (check_gradient_overflow(left, right, num_components)) {
+ /* The caller must care of.
+ Checking it here looses some performance with triangles. */
+ return_error(gs_error_unregistered);
+ }
# endif
- lg.c = lgc;
- lg.f = lgf;
- lg.num = lgnum;
- rg.c = rgc;
- rg.f = rgf;
- rg.num = rgnum;
- xg.c = xgc;
- xg.f = xgf;
- xg.num = xgnum;
- code = init_gradient(&lg, fa, left, right, &l, ymin, num_components);
- if (code < 0)
- return code;
- code = init_gradient(&rg, fa, right, left, &r, ymin, num_components);
- if (code < 0)
- return code;
+ lg.c = lgc;
+ lg.f = lgf;
+ lg.num = lgnum;
+ rg.c = rgc;
+ rg.f = rgf;
+ rg.num = rgnum;
+ xg.c = xgc;
+ xg.f = xgf;
+ xg.num = xgnum;
+ code = init_gradient(&lg, fa, left, right, &l, ymin, num_components);
+ if (code < 0)
+ return code;
+ code = init_gradient(&rg, fa, right, left, &r, ymin, num_components);
+ if (code < 0)
+ return code;
# endif
@@ -336,48 +336,48 @@ GX_FILL_TRAPEZOID (gx_device * dev, const EDGE_TYPE * left,
if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\
ix = rational_floor(tl)
- rxl = rational_floor(l);
- rxr = rational_floor(r);
- SET_MINIMAL_WIDTH(rxl, rxr, l, r);
- while (LINEAR_COLOR ? 1 : ++iy != iy1) {
+ rxl = rational_floor(l);
+ rxr = rational_floor(r);
+ SET_MINIMAL_WIDTH(rxl, rxr, l, r);
+ while (LINEAR_COLOR ? 1 : ++iy != iy1) {
# if LINEAR_COLOR
- if (rxl != rxr) {
- code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components);
- if (code < 0)
- goto xit;
- /*VD_RECT_SWAPPED(rxl, iy, rxr, iy + 1);*/
- code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1);
- if (code < 0)
- goto xit;
- }
- if (++iy == iy1)
- break;
- STEP_LINE(rxl, l);
- STEP_LINE(rxr, r);
- step_gradient(&lg, num_components);
- step_gradient(&rg, num_components);
+ if (rxl != rxr) {
+ code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components);
+ if (code < 0)
+ goto xit;
+ /*VD_RECT_SWAPPED(rxl, iy, rxr, iy + 1);*/
+ code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1);
+ if (code < 0)
+ goto xit;
+ }
+ if (++iy == iy1)
+ break;
+ STEP_LINE(rxl, l);
+ STEP_LINE(rxr, r);
+ step_gradient(&lg, num_components);
+ step_gradient(&rg, num_components);
# else
- register int ixl, ixr;
-
- STEP_LINE(ixl, l);
- STEP_LINE(ixr, r);
- SET_MINIMAL_WIDTH(ixl, ixr, l, r);
- if (ixl != rxl || ixr != rxr) {
- CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT);
- CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT);
- VD_RECT_SWAPPED(rxl, ry, rxr, iy);
- code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
- if (code < 0)
- goto xit;
- rxl = ixl, rxr = ixr, ry = iy;
- }
+ register int ixl, ixr;
+
+ STEP_LINE(ixl, l);
+ STEP_LINE(ixr, r);
+ SET_MINIMAL_WIDTH(ixl, ixr, l, r);
+ if (ixl != rxl || ixr != rxr) {
+ CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT);
+ CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT);
+ VD_RECT_SWAPPED(rxl, ry, rxr, iy);
+ code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
+ if (code < 0)
+ goto xit;
+ rxl = ixl, rxr = ixr, ry = iy;
+ }
# endif
- }
+ }
# if !LINEAR_COLOR
- VD_RECT_SWAPPED(rxl, ry, rxr, iy);
- code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
+ VD_RECT_SWAPPED(rxl, ry, rxr, iy);
+ code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
# else
- code = 0;
+ code = 0;
# endif
#undef STEP_LINE
#undef SET_MINIMAL_WIDTH
@@ -388,9 +388,9 @@ GX_FILL_TRAPEZOID (gx_device * dev, const EDGE_TYPE * left,
#undef YMULT_QUO
#undef VD_RECT_SWAPPED
xit: if (code < 0 && FILL_DIRECT)
- return_error(code);
- return_if_interrupt(dev->memory);
- return code;
+ return_error(code);
+ return_if_interrupt(dev->memory);
+ return code;
}
}
diff --git a/gs/base/gxfapiu.c b/gs/base/gxfapiu.c
index 6f17e1e06..95cd9f1b4 100644
--- a/gs/base/gxfapiu.c
+++ b/gs/base/gxfapiu.c
@@ -64,12 +64,11 @@ static LPUB8 stub_PCLglyphID2Ptr(FSP UW16 glyphID)
/* set to 1 to display UFST debugging statements */
GLOBAL const SW16 trace_sw = 0;
-
/*
- The following 4 variables are defined statically
+ The following 4 variables are defined statically
They could be stored in the gs_lib_ctx but that would require casting the types
-to avoid including ufst's typedefs.
+to avoid including ufst's typedefs.
*/
static LPUB8 (*m_PCLEO_charptr)(FSP LPUB8 pfont_hdr, UW16 sym_code) = stub_PCLEO_charptr;
@@ -143,7 +142,6 @@ int FAPIU_fclose (FILE *s)
return(sfclose((stream *)(s)));
}
-
void * FAPIU_open (char *path, int mode)
{
if (!gs_mem_ctx)
@@ -161,7 +159,7 @@ int FAPIU_read (void *s, void *ptr, int count)
int FAPIU_lseek (void *s, int offset, int whence)
{
int pos = sfseek (s, offset, whence);
-
+
if (pos >= 0)
{
pos = sftell(s);
@@ -172,7 +170,7 @@ int FAPIU_lseek (void *s, int offset, int whence)
int fapi_ufseek (stream *s, long offset, int whence)
{
int pos = sfseek (s, offset, whence);
-
+
if (pos >= 0)
{
pos = sftell(s);
@@ -197,7 +195,7 @@ GLOBAL VOID MEMinit(FSP0)
if_state.pserver->mem_avail[CHARGEN_POOL] = 16 * 1024 * 1024;
if_state.pserver->mem_fund[CHARGEN_POOL] = 16 * 1024 * 1024;
-
+
}
#ifndef UFST_MEMORY_CHECKING
#define UFST_MEMORY_CHECKING 0
@@ -243,7 +241,7 @@ GLOBAL MEM_HANDLE MEMalloc(FSP UW16 pool, SL32 size)
ptr += sizeof(void *);
#endif
-
+
return((MEM_HANDLE)ptr);
}
}
@@ -255,14 +253,14 @@ GLOBAL VOID MEMfree(FSP UW16 pool, MEM_HANDLE ptr)
#if UFST_MEMORY_CHECKING
int size1;
void *ptr2;
-
+
size = sizeof(void *);
#endif
-
+
if (!ptr) {
return;
}
-
+
ptr -= (sizeof(long) + size);
size = *((long *)ptr);
@@ -281,7 +279,7 @@ GLOBAL VOID MEMfree(FSP UW16 pool, MEM_HANDLE ptr)
dprintf("Memory pointer record corrupt!\n");
}
#endif
-
+
memset (ptr, 0x00, size);
gs_free (gs_mem_ctx, ptr, 0, 0, "UFST MEMfree");
}
@@ -291,13 +289,13 @@ GLOBAL VOID MEMfree(FSP UW16 pool, MEM_HANDLE ptr)
/* Set UFST callbacks. Each PDL will want it's own character build function and must set the callbacks
* upon language entry/initialization.
*/
-/* Warning : this function may cause a reentrancy problem
- due to a modification of static variables.
- Nevertheless this problem isn't important in a
- single interpreter build, because the values
- really change on the first demand only.
- See also a comment in gs_fapiufst_finit.
- */
+/* Warning : this function may cause a reentrancy problem
+ due to a modification of static variables.
+ Nevertheless this problem isn't important in a
+ single interpreter build, because the values
+ really change on the first demand only.
+ See also a comment in gs_fapiufst_finit.
+ */
void gx_set_UFST_Callbacks(LPUB8 (*p_PCLEO_charptr)(FSP LPUB8 pfont_hdr, UW16 sym_code),
LPUB8 (*p_PCLchId2ptr)(FSP UW16 chId),
LPUB8 (*p_PCLglyphID2Ptr)(FSP UW16 glyphID))
@@ -309,8 +307,7 @@ void gx_set_UFST_Callbacks(LPUB8 (*p_PCLEO_charptr)(FSP LPUB8 pfont_hdr, UW16 s
#define MAX_OPEN_LIBRARIES 5 /* NB */
#define BITMAP_WIDTH 1 /* must be 1, 2, 4 or 8 */
-
-/* returns negative on error,
+/* returns negative on error,
* 1 = "I just initialized for the first time and you might want to as well."
* 0 = "I've already initialized but its ok to call me."
* <0 = error.
@@ -323,7 +320,7 @@ gx_UFST_init(gs_memory_t *mem, const UB8 *ufst_root_dir)
#if !UFST_REENTRANT
if (ufst_initialized)
- return 0;
+ return 0;
gs_mem_ctx = mem;
#endif
strcpy(config_block.ufstPath, ufst_root_dir);
@@ -336,19 +333,19 @@ gx_UFST_init(gs_memory_t *mem, const UB8 *ufst_root_dir)
config_block.typePath[0] = 0;
if ((status = CGIFinit(FSA0)) != 0) {
- dprintf1("CGIFinit() error: %d\n", status);
+ dprintf1("CGIFinit() error: %d\n", status);
gs_mem_ctx = NULL;
- return status;
+ return status;
}
if ((status = CGIFconfig(FSA &config_block)) != 0) {
- dprintf1("CGIFconfig() error: %d\n", status);
+ dprintf1("CGIFconfig() error: %d\n", status);
gs_mem_ctx = NULL;
- return status;
+ return status;
}
if ((status = CGIFenter(FSA0)) != 0) {
- dprintf1("CGIFenter() error: %u\n",status);
+ dprintf1("CGIFenter() error: %u\n",status);
gs_mem_ctx = NULL;
- return status;
+ return status;
}
#if !UFST_REENTRANT
ufst_initialized = TRUE;
@@ -370,55 +367,55 @@ gx_UFST_fini(void)
/* Access to the static FCO list for the language switching project. */
fco_list_elem *gx_UFST_find_static_fco(const char *font_file_path)
-{
+{
#if !UFST_REENTRANT
int i;
for (i = 0; i < static_fco_count; i++)
- if (!strcmp(static_fco_list[i].file_path, font_file_path))
- return &static_fco_list[i];
+ if (!strcmp(static_fco_list[i].file_path, font_file_path))
+ return &static_fco_list[i];
#endif
return NULL;
}
fco_list_elem *gx_UFST_find_static_fco_handle(SW16 fcHandle)
-{
+{
#if !UFST_REENTRANT
int i;
for (i = 0; i < static_fco_count; i++)
- if (static_fco_list[i].fcHandle == fcHandle)
- return &static_fco_list[i];
+ if (static_fco_list[i].fcHandle == fcHandle)
+ return &static_fco_list[i];
#endif
return NULL;
}
SW16 gx_UFST_find_fco_handle_by_name(const char *font_file_path)
-{
+{
#if !UFST_REENTRANT
fco_list_elem *fco = gx_UFST_find_static_fco(font_file_path);
if (fco)
- return fco->fcHandle;
+ return fco->fcHandle;
return 0;
#endif
}
UW16 gx_UFST_open_static_fco(const char *font_file_path, SW16 *result_fcHandle)
-{
+{
#if !UFST_REENTRANT
SW16 fcHandle;
UW16 code;
fco_list_elem *e;
if (static_fco_count >= MAX_STATIC_FCO_COUNT)
- return ERR_fco_NoMem;
+ return ERR_fco_NoMem;
code = CGIFfco_Open(FSA (UB8 *)font_file_path, &fcHandle);
if (code != 0)
- return code;
+ return code;
e = &static_fco_list[static_fco_count];
- strncpy(static_fco_paths[static_fco_count], font_file_path,
- sizeof(static_fco_paths[static_fco_count]));
+ strncpy(static_fco_paths[static_fco_count], font_file_path,
+ sizeof(static_fco_paths[static_fco_count]));
e->file_path = static_fco_paths[static_fco_count];
e->fcHandle = fcHandle;
e->open_count = -1; /* Unused for static FCOs. */
@@ -432,19 +429,19 @@ UW16 gx_UFST_open_static_fco(const char *font_file_path, SW16 *result_fcHandle)
}
UW16 gx_UFST_close_static_fco(SW16 fcHandle)
-{
+{
#if !UFST_REENTRANT
int i;
for (i = 0; i < static_fco_count; i++)
- if (static_fco_list[i].fcHandle == fcHandle)
- break;
+ if (static_fco_list[i].fcHandle == fcHandle)
+ break;
if (i >= static_fco_count)
- return ERR_fco_NoMem;
+ return ERR_fco_NoMem;
CGIFfco_Close(FSA fcHandle);
for (i++; i < static_fco_count; i++) {
- static_fco_list[i - 1] = static_fco_list[i];
- strcpy(static_fco_paths[i - 1], static_fco_paths[i]);
+ static_fco_list[i - 1] = static_fco_list[i];
+ strcpy(static_fco_paths[i - 1], static_fco_paths[i]);
}
static_fco_count--;
#endif
@@ -455,7 +452,7 @@ void gx_UFST_close_static_fcos()
{
#if !UFST_REENTRANT
for(; static_fco_count; )
- gx_UFST_close_static_fco(static_fco_list[0].fcHandle);
+ gx_UFST_close_static_fco(static_fco_list[0].fcHandle);
#endif
}
@@ -467,10 +464,9 @@ void gx_UFST_close_static_fcos()
*/
GLOBAL VOID BLACKPIX(FSP SW16 x, SW16 y )
{
- return;
+ return;
}
-
/* -------------------------------- GRAYPIX --------------------------------
* Description: Called by UFST gichar function.
* Returns: VOID
@@ -478,6 +474,6 @@ GLOBAL VOID BLACKPIX(FSP SW16 x, SW16 y )
*/
GLOBAL VOID GRAYPIX(FSP SW16 x, SW16 y, SW16 v )
{
- return;
+ return;
}
#endif /* GRAYSCALING */
diff --git a/gs/base/gxfapiu.h b/gs/base/gxfapiu.h
index edd9956d9..e586f6ef5 100644
--- a/gs/base/gxfapiu.h
+++ b/gs/base/gxfapiu.h
@@ -23,7 +23,7 @@
/* Warning : the language switch project doesn't guarantee
that this function is called when switching
to another interpreter. Therefore each interpreter must take
- care for its own callback methods before they
+ care for its own callback methods before they
may be called by UFST.
*/
/* Warning : this function may cause a reentrancy problem
@@ -77,5 +77,4 @@ int FAPIU_ferror (FILE *s);
int FAPIU_fclose (FILE *s);
int FAPIU_close (void *s);
-
#endif /* gxfapiu_INCLUDED */
diff --git a/gs/base/gxfarith.h b/gs/base/gxfarith.h
index 4349bc92b..a3b7c0bb9 100644
--- a/gs/base/gxfarith.h
+++ b/gs/base/gxfarith.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxfcache.h b/gs/base/gxfcache.h
index c470360ee..3efb3e6b4 100644
--- a/gs/base/gxfcache.h
+++ b/gs/base/gxfcache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,7 +65,6 @@ typedef struct gx_device_spot_analyzer_s gx_device_spot_analyzer;
typedef struct gs_state_s gs_state;
#endif
-
/*
* Define the entry for a cached (font,matrix) pair. If the UID
* is valid, the font pointer may be 0, since we keep entries even for
@@ -332,29 +331,29 @@ struct gs_font_dir_s {
/* Character cache procedures (in gxccache.c and gxccman.c) */
int gx_char_cache_alloc(gs_memory_t * struct_mem, gs_memory_t * bits_mem,
- gs_font_dir * pdir, uint bmax, uint mmax,
- uint cmax, uint upper);
+ gs_font_dir * pdir, uint bmax, uint mmax,
+ uint cmax, uint upper);
void gx_char_cache_init(gs_font_dir *);
-void gx_purge_selected_cached_chars(gs_font_dir *,
- bool(*)(const gs_memory_t *, cached_char *, void *), void *);
-void gx_compute_char_matrix(const gs_matrix *char_tm, const gs_log2_scale_point *log2_scale,
+void gx_purge_selected_cached_chars(gs_font_dir *,
+ bool(*)(const gs_memory_t *, cached_char *, void *), void *);
+void gx_compute_char_matrix(const gs_matrix *char_tm, const gs_log2_scale_point *log2_scale,
float *mxx, float *mxy, float *myx, float *myy);
-void gx_compute_ccache_key(gs_font * pfont, const gs_matrix *char_tm,
+void gx_compute_ccache_key(gs_font * pfont, const gs_matrix *char_tm,
const gs_log2_scale_point *log2_scale, bool design_grid,
float *mxx, float *mxy, float *myx, float *myy);
-int gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
+int gx_lookup_fm_pair(gs_font * pfont, const gs_matrix *char_tm,
const gs_log2_scale_point *log2_scale, bool design_grid, cached_fm_pair **ppair);
int gx_add_fm_pair(register gs_font_dir * dir, gs_font * font, const gs_uid * puid,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid, cached_fm_pair **ppair);
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid, cached_fm_pair **ppair);
int gx_fm_pair_attributes(gs_font_dir * dir,
- gs_font *font, cached_fm_pair *pair,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid);
+ gs_font *font, cached_fm_pair *pair,
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid);
int gx_provide_fm_pair_attributes(gs_font_dir * dir,
- gs_font *font, cached_fm_pair *pair,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid);
+ gs_font *font, cached_fm_pair *pair,
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid);
int gx_touch_fm_pair(gs_font_dir *dir, cached_fm_pair *pair);
void gx_lookup_xfont(const gs_state *, cached_fm_pair *, int);
void gs_clean_fm_pair(gs_font_dir * dir, cached_fm_pair * pair);
diff --git a/gs/base/gxfcid.h b/gs/base/gxfcid.h
index cf3b6a797..37df4e8a3 100644
--- a/gs/base/gxfcid.h
+++ b/gs/base/gxfcid.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -140,9 +140,9 @@ typedef struct gs_font_cid2_data_s {
* handle MetricsCount. Save the original ones here.
*/
struct o_ {
- int (*get_outline)(gs_font_type42 *, uint, gs_glyph_data_t *);
- int (*get_metrics)(gs_font_type42 *, uint, gs_type42_metrics_options_t,
- float * /* See comment for gs_type42_default_get_metrics. */);
+ int (*get_outline)(gs_font_type42 *, uint, gs_glyph_data_t *);
+ int (*get_metrics)(gs_font_type42 *, uint, gs_type42_metrics_options_t,
+ float * /* See comment for gs_type42_default_get_metrics. */);
} orig_procs;
} gs_font_cid2_data;
struct gs_font_cid2_s {
@@ -177,8 +177,8 @@ font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph);
/*
* Check CIDSystemInfo compatibility.
*/
-bool gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
- const gs_cid_system_info_t *info1);
+bool gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
+ const gs_cid_system_info_t *info1);
/* Return the font from the FDArray at the given index */
const gs_font *gs_cid0_indexed_font(const gs_font *, int);
diff --git a/gs/base/gxfcmap.h b/gs/base/gxfcmap.h
index f7232d6df..0bb92cfaa 100644
--- a/gs/base/gxfcmap.h
+++ b/gs/base/gxfcmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -133,7 +133,7 @@ typedef struct gs_cmap_s gs_cmap_t;
#define GS_CMAP_COMMON\
int CMapType; /* must be first */\
gs_id id; /* internal ID (no relation to UID) */\
- /* End of entries common to all CMapTypes */\
+ /* End of entries common to all CMapTypes */\
gs_const_string CMapName;\
gs_cid_system_info_t *CIDSystemInfo; /* [num_fonts] */\
int num_fonts;\
@@ -166,22 +166,22 @@ typedef struct gs_cmap_procs_s {
*/
int (*decode_next)(const gs_cmap_t *pcmap, const gs_const_string *str,
- uint *pindex, uint *pfidx,
- gs_char *pchr, gs_glyph *pglyph);
+ uint *pindex, uint *pfidx,
+ gs_char *pchr, gs_glyph *pglyph);
/*
* Initialize an enumeration of code space ranges. See below.
*/
void (*enum_ranges)(const gs_cmap_t *pcmap,
- gs_cmap_ranges_enum_t *penum);
+ gs_cmap_ranges_enum_t *penum);
/*
* Initialize an enumeration of lookups. See below.
*/
void (*enum_lookups)(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *penum);
+ gs_cmap_lookups_enum_t *penum);
/*
* Check if the cmap is identity.
@@ -256,7 +256,7 @@ extern const gs_cmap_lookups_enum_procs_t gs_cmap_no_lookups_procs;
* if (code < 0) <<error>>
*/
void gs_cmap_ranges_enum_init(const gs_cmap_t *pcmap,
- gs_cmap_ranges_enum_t *penum);
+ gs_cmap_ranges_enum_t *penum);
int gs_cmap_enum_next_range(gs_cmap_ranges_enum_t *penum);
/*
@@ -283,7 +283,7 @@ int gs_cmap_enum_next_range(gs_cmap_ranges_enum_t *penum);
* itself) and not survive from one call to the next.
*/
void gs_cmap_lookups_enum_init(const gs_cmap_t *pcmap, int which,
- gs_cmap_lookups_enum_t *penum);
+ gs_cmap_lookups_enum_t *penum);
int gs_cmap_enum_next_lookup(gs_cmap_lookups_enum_t *penum);
int gs_cmap_enum_next_entry(gs_cmap_lookups_enum_t *penum);
@@ -299,26 +299,26 @@ void gs_cmap_init(const gs_memory_t *mem, gs_cmap_t *pcmap, int num_fonts);
* Allocate and initialize (the common part of) a CMap.
*/
int gs_cmap_alloc(gs_cmap_t **ppcmap, const gs_memory_struct_type_t *pstype,
- int wmode, const byte *map_name, uint name_size,
- const gs_cid_system_info_t *pcidsi, int num_fonts,
- const gs_cmap_procs_t *procs, gs_memory_t *mem);
+ int wmode, const byte *map_name, uint name_size,
+ const gs_cid_system_info_t *pcidsi, int num_fonts,
+ const gs_cmap_procs_t *procs, gs_memory_t *mem);
/*
* Initialize an enumerator with convenient defaults (index = 0).
*/
void gs_cmap_ranges_enum_setup(gs_cmap_ranges_enum_t *penum,
- const gs_cmap_t *pcmap,
- const gs_cmap_ranges_enum_procs_t *procs);
+ const gs_cmap_t *pcmap,
+ const gs_cmap_ranges_enum_procs_t *procs);
void gs_cmap_lookups_enum_setup(gs_cmap_lookups_enum_t *penum,
- const gs_cmap_t *pcmap,
- const gs_cmap_lookups_enum_procs_t *procs);
+ const gs_cmap_t *pcmap,
+ const gs_cmap_lookups_enum_procs_t *procs);
-/*
+/*
* Check for identity CMap. Uses a fast check for special cases.
*/
bool gs_cmap_is_identity(const gs_cmap_t *pcmap, int font_index_only);
-/*
+/*
* For a random CMap, compute whether it is identity.
* It is not applicable to gs_cmap_ToUnicode_t due to
* different sizes of domain keys and range values.
diff --git a/gs/base/gxfcmap1.h b/gs/base/gxfcmap1.h
index 5f3cca08e..ac659c318 100644
--- a/gs/base/gxfcmap1.h
+++ b/gs/base/gxfcmap1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -108,9 +108,9 @@ extern_st(st_cmap_adobe1);
* the code space ranges, lookup tables, keys, and values.
*/
int gs_cmap_adobe1_alloc(gs_cmap_adobe1_t **ppcmap, int wmode,
- const byte *map_name, uint name_size,
- uint num_fonts, uint num_ranges, uint num_lookups,
- uint keys_size, uint values_size,
- const gs_cid_system_info_t *pcidsi, gs_memory_t *mem);
+ const byte *map_name, uint name_size,
+ uint num_fonts, uint num_ranges, uint num_lookups,
+ uint keys_size, uint values_size,
+ const gs_cid_system_info_t *pcidsi, gs_memory_t *mem);
#endif /* gxfcmap1_INCLUDED */
diff --git a/gs/base/gxfcopy.c b/gs/base/gxfcopy.c
index 04dda6338..bca34b0be 100644
--- a/gs/base/gxfcopy.c
+++ b/gs/base/gxfcopy.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,10 +49,10 @@ typedef struct gs_copied_font_data_s gs_copied_font_data_t;
typedef struct gs_copied_font_procs_s {
int (*finish_copy_font)(gs_font *font, gs_font *copied);
int (*copy_glyph)(gs_font *font, gs_glyph glyph, gs_font *copied,
- int options);
+ int options);
int (*add_encoding)(gs_font *copied, gs_char chr, gs_glyph glyph);
int (*named_glyph_slot)(gs_copied_font_data_t *cfdata, gs_glyph glyph,
- gs_copied_glyph_t **pslot);
+ gs_copied_glyph_t **pslot);
/* Font procedures */
font_proc_encode_char((*encode_char));
font_proc_glyph_info((*glyph_info));
@@ -81,22 +81,22 @@ typedef struct gs_subr_info_s {
struct gs_copied_glyph_s {
gs_const_string gdata; /* vector data */
#define HAS_DATA 1 /* entry is in use */
- /* HAS_SBW* are only used for TT-based fonts */
+ /* HAS_SBW* are only used for TT-based fonts */
#define HAS_SBW0 2 /* has hmtx */
#define HAS_SBW1 4 /* has vmtx */
byte used; /* non-zero iff this entry is in use */
- /* (if not, gdata.{data,size} = 0) */
+ /* (if not, gdata.{data,size} = 0) */
int order_index; /* Index for the ordered glyph set. */
};
/*
* We use a special GC descriptor to avoid large GC overhead.
*/
gs_private_st_composite(st_gs_copied_glyph_element, gs_copied_glyph_t,
- "gs_copied_glyph_t[]", copied_glyph_element_enum_ptrs,
- copied_glyph_element_reloc_ptrs);
+ "gs_copied_glyph_t[]", copied_glyph_element_enum_ptrs,
+ copied_glyph_element_reloc_ptrs);
static ENUM_PTRS_WITH(copied_glyph_element_enum_ptrs, gs_copied_glyph_t *pcg)
if (index < size / (uint)sizeof(gs_copied_glyph_t))
- return ENUM_CONST_STRING(&pcg[index].gdata);
+ return ENUM_CONST_STRING(&pcg[index].gdata);
return 0;
ENUM_PTRS_END
static RELOC_PTRS_WITH(copied_glyph_element_reloc_ptrs, gs_copied_glyph_t *pcg)
@@ -105,8 +105,8 @@ static RELOC_PTRS_WITH(copied_glyph_element_reloc_ptrs, gs_copied_glyph_t *pcg)
gs_copied_glyph_t *p = pcg;
for (; count > 0; --count, ++p)
- if (p->gdata.size > 0)
- RELOC_CONST_STRING_VAR(p->gdata);
+ if (p->gdata.size > 0)
+ RELOC_CONST_STRING_VAR(p->gdata);
}
RELOC_PTRS_END
@@ -128,21 +128,21 @@ typedef struct gs_copied_glyph_name_s {
* We use the same special GC descriptor as above for 'names'.
*/
gs_private_st_composite(st_gs_copied_glyph_name_element,
- gs_copied_glyph_name_t,
- "gs_copied_glyph_name_t[]",
- copied_glyph_name_enum_ptrs,
- copied_glyph_name_reloc_ptrs);
+ gs_copied_glyph_name_t,
+ "gs_copied_glyph_name_t[]",
+ copied_glyph_name_enum_ptrs,
+ copied_glyph_name_reloc_ptrs);
static ENUM_PTRS_WITH(copied_glyph_name_enum_ptrs, gs_copied_glyph_name_t *pcgn)
if (index < size / (uint)sizeof(gs_copied_glyph_name_t)) {
- const gs_copied_glyph_name_t *const p = &pcgn[index];
+ const gs_copied_glyph_name_t *const p = &pcgn[index];
- return (p->str.size == 0 ||
- gs_is_c_glyph_name(p->str.data, p->str.size) ?
- ENUM_CONST_STRING2(0, 0) :
- ENUM_CONST_STRING(&p->str));
+ return (p->str.size == 0 ||
+ gs_is_c_glyph_name(p->str.data, p->str.size) ?
+ ENUM_CONST_STRING2(0, 0) :
+ ENUM_CONST_STRING(&p->str));
}
return 0;
- /* We should mark glyph name here, but we have no access to
+ /* We should mark glyph name here, but we have no access to
the gs_font_dir instance. Will mark in gs_copied_font_data_enum_ptrs.
*/
ENUM_PTRS_END
@@ -152,8 +152,8 @@ static RELOC_PTRS_WITH(copied_glyph_name_reloc_ptrs, gs_copied_glyph_name_t *pcg
gs_copied_glyph_name_t *p = pcgn;
for (; count > 0; --count, ++p)
- if (p->str.size > 0 && !gs_is_c_glyph_name(p->str.data, p->str.size))
- RELOC_CONST_STRING_VAR(p->str);
+ if (p->str.size > 0 && !gs_is_c_glyph_name(p->str.data, p->str.size))
+ RELOC_CONST_STRING_VAR(p->str);
}
RELOC_PTRS_END
@@ -172,10 +172,10 @@ BASIC_PTRS(gs_copied_glyph_extra_name_ptrs) {
GC_OBJ_ELT(gs_copied_glyph_extra_name_t, next)
};
gs_private_st_basic(st_gs_copied_glyph_extra_name,
- gs_copied_glyph_extra_name_t,
- "gs_copied_glyph_extra_name_t",
- gs_copied_glyph_extra_name_ptrs,
- gs_copied_glyph_extra_name_data);
+ gs_copied_glyph_extra_name_t,
+ "gs_copied_glyph_extra_name_t",
+ gs_copied_glyph_extra_name_ptrs,
+ gs_copied_glyph_extra_name_data);
/*
* The client_data of copied fonts points to an instance of
@@ -205,20 +205,20 @@ struct gs_copied_font_data_s {
bool ordered;
};
extern_st(st_gs_font_info);
-static
+static
ENUM_PTRS_WITH(gs_copied_font_data_enum_ptrs, gs_copied_font_data_t *cfdata)
if (index == 12) {
- gs_copied_glyph_name_t *names = cfdata->names;
- gs_copied_glyph_extra_name_t *en = cfdata->extra_names;
- int i;
-
- if (names != NULL)
- for (i = 0; i < cfdata->glyphs_size; ++i)
- if (names[i].glyph < gs_c_min_std_encoding_glyph)
- cfdata->dir->ccache.mark_glyph(mem, names[i].glyph, NULL);
- for (; en != NULL; en = en->next)
- if (en->name.glyph < gs_c_min_std_encoding_glyph)
- cfdata->dir->ccache.mark_glyph(mem, en->name.glyph, NULL);
+ gs_copied_glyph_name_t *names = cfdata->names;
+ gs_copied_glyph_extra_name_t *en = cfdata->extra_names;
+ int i;
+
+ if (names != NULL)
+ for (i = 0; i < cfdata->glyphs_size; ++i)
+ if (names[i].glyph < gs_c_min_std_encoding_glyph)
+ cfdata->dir->ccache.mark_glyph(mem, names[i].glyph, NULL);
+ for (; en != NULL; en = en->next)
+ if (en->name.glyph < gs_c_min_std_encoding_glyph)
+ cfdata->dir->ccache.mark_glyph(mem, en->name.glyph, NULL);
}
return ENUM_USING(st_gs_font_info, &cfdata->info, sizeof(gs_font_info_t), index - 12);
ENUM_PTR3(0, gs_copied_font_data_t, glyphs, names, extra_names);
@@ -259,11 +259,11 @@ copy_string(gs_memory_t *mem, gs_const_string *pstr, client_name_t cname)
byte *str;
if (data == 0)
- return 0; /* empty string */
+ return 0; /* empty string */
str = gs_alloc_string(mem, size, cname);
pstr->data = str;
if (str == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(str, data, size);
return 0;
}
@@ -273,7 +273,7 @@ static void
uncopy_string(gs_memory_t *mem, gs_const_string *pstr, client_name_t cname)
{
if (pstr->data)
- gs_free_const_string(mem, pstr->data, pstr->size, cname);
+ gs_free_const_string(mem, pstr->data, pstr->size, cname);
}
/*
@@ -284,14 +284,14 @@ copied_Encoding_alloc(gs_font *copied)
{
gs_copied_font_data_t *const cfdata = cf_data(copied);
gs_glyph *Encoding = (gs_glyph *)
- gs_alloc_byte_array(copied->memory, 256, sizeof(*cfdata->Encoding),
- "copy_font_type1(Encoding)");
+ gs_alloc_byte_array(copied->memory, 256, sizeof(*cfdata->Encoding),
+ "copy_font_type1(Encoding)");
int i;
if (Encoding == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < 256; ++i)
- Encoding[i] = GS_NO_GLYPH;
+ Encoding[i] = GS_NO_GLYPH;
cfdata->Encoding = Encoding;
return 0;
}
@@ -308,10 +308,10 @@ copied_data_alloc(gs_font *copied, stream *s, uint extra, int code)
byte *fdata;
if (code < 0)
- return code;
+ return code;
fdata = gs_alloc_bytes(copied->memory, len + extra, "copied_data_alloc");
if (fdata == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
s_init(s, copied->memory);
swrite_string(s, fdata, len);
cfdata->data = fdata;
@@ -324,7 +324,7 @@ copied_data_alloc(gs_font *copied, stream *s, uint extra, int code)
*/
static int
copy_subrs(gs_font_type1 *pfont, bool global, gs_subr_info_t *psi,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
int i, code;
uint size;
@@ -335,40 +335,40 @@ copy_subrs(gs_font_type1 *pfont, bool global, gs_subr_info_t *psi,
gdata.memory = pfont->memory;
/* Scan the font to determine the size of the subrs. */
for (i = 0, size = 0;
- (code = pfont->data.procs.subr_data(pfont, i, global, &gdata)) !=
- gs_error_rangecheck;
- ++i) {
- if (code >= 0) {
- size += gdata.bits.size;
- gs_glyph_data_free(&gdata, "copy_subrs");
- }
+ (code = pfont->data.procs.subr_data(pfont, i, global, &gdata)) !=
+ gs_error_rangecheck;
+ ++i) {
+ if (code >= 0) {
+ size += gdata.bits.size;
+ gs_glyph_data_free(&gdata, "copy_subrs");
+ }
}
if (size == 0)
- data = 0, starts = 0, i = 0;
+ data = 0, starts = 0, i = 0;
else {
- /* Allocate the copy. */
- data = gs_alloc_bytes(mem, size, "copy_subrs(data)");
- starts = (uint *)gs_alloc_byte_array(mem, i + 1, sizeof(*starts),
- "copy_subrs(starts)");
- if (data == 0 || starts == 0) {
- gs_free_object(mem, starts, "copy_subrs(starts)");
- gs_free_object(mem, data, "copy_subrs(data)");
- return_error(gs_error_VMerror);
- }
-
- /* Copy the data. */
- for (i = 0, size = 0;
- (code = pfont->data.procs.subr_data(pfont, i, global, &gdata)) !=
- gs_error_rangecheck;
- ++i) {
- starts[i] = size;
- if (code >= 0) {
- memcpy(data + size, gdata.bits.data, gdata.bits.size);
- size += gdata.bits.size;
- gs_glyph_data_free(&gdata, "copy_subrs");
- }
- }
- starts[i] = size;
+ /* Allocate the copy. */
+ data = gs_alloc_bytes(mem, size, "copy_subrs(data)");
+ starts = (uint *)gs_alloc_byte_array(mem, i + 1, sizeof(*starts),
+ "copy_subrs(starts)");
+ if (data == 0 || starts == 0) {
+ gs_free_object(mem, starts, "copy_subrs(starts)");
+ gs_free_object(mem, data, "copy_subrs(data)");
+ return_error(gs_error_VMerror);
+ }
+
+ /* Copy the data. */
+ for (i = 0, size = 0;
+ (code = pfont->data.procs.subr_data(pfont, i, global, &gdata)) !=
+ gs_error_rangecheck;
+ ++i) {
+ starts[i] = size;
+ if (code >= 0) {
+ memcpy(data + size, gdata.bits.data, gdata.bits.size);
+ size += gdata.bits.size;
+ gs_glyph_data_free(&gdata, "copy_subrs");
+ }
+ }
+ starts[i] = size;
}
psi->data = data;
@@ -387,42 +387,42 @@ copy_subrs(gs_font_type1 *pfont, bool global, gs_subr_info_t *psi,
*/
static int
copied_glyph_slot(gs_copied_font_data_t *cfdata, gs_glyph glyph,
- gs_copied_glyph_t **pslot)
+ gs_copied_glyph_t **pslot)
{
uint gsize = cfdata->glyphs_size;
*pslot = 0;
if (glyph >= GS_MIN_GLYPH_INDEX) {
- /* CIDFontType 2 uses glyph indices for slots. */
- if (glyph - GS_MIN_GLYPH_INDEX >= gsize)
- return_error(gs_error_rangecheck);
- *pslot = &cfdata->glyphs[glyph - GS_MIN_GLYPH_INDEX];
+ /* CIDFontType 2 uses glyph indices for slots. */
+ if (glyph - GS_MIN_GLYPH_INDEX >= gsize)
+ return_error(gs_error_rangecheck);
+ *pslot = &cfdata->glyphs[glyph - GS_MIN_GLYPH_INDEX];
} else if (glyph >= GS_MIN_CID_GLYPH) {
- /* CIDFontType 0 uses CIDS for slots. */
- if (glyph - GS_MIN_CID_GLYPH >= gsize)
- return_error(gs_error_rangecheck);
- *pslot = &cfdata->glyphs[glyph - GS_MIN_CID_GLYPH];
+ /* CIDFontType 0 uses CIDS for slots. */
+ if (glyph - GS_MIN_CID_GLYPH >= gsize)
+ return_error(gs_error_rangecheck);
+ *pslot = &cfdata->glyphs[glyph - GS_MIN_CID_GLYPH];
} else if (cfdata->names == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else {
- int code = cfdata->procs->named_glyph_slot(cfdata, glyph, pslot);
+ int code = cfdata->procs->named_glyph_slot(cfdata, glyph, pslot);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (!(*pslot)->used)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
return 0;
}
static int
named_glyph_slot_none(gs_copied_font_data_t *cfdata, gs_glyph glyph,
- gs_copied_glyph_t **pslot)
+ gs_copied_glyph_t **pslot)
{
return_error(gs_error_rangecheck);
}
static int
named_glyph_slot_hashed(gs_copied_font_data_t *cfdata, gs_glyph glyph,
- gs_copied_glyph_t **pslot)
+ gs_copied_glyph_t **pslot)
{
uint gsize = cfdata->glyphs_size;
gs_copied_glyph_name_t *names = cfdata->names;
@@ -438,37 +438,37 @@ named_glyph_slot_hashed(gs_copied_font_data_t *cfdata, gs_glyph glyph,
uint tries = gsize;
while (names[hash].str.data != 0 && names[hash].glyph != glyph) {
- hash = (hash + hash2) % gsize;
- if (!tries)
- return gs_error_undefined;
- tries--;
+ hash = (hash + hash2) % gsize;
+ if (!tries)
+ return gs_error_undefined;
+ tries--;
}
*pslot = &cfdata->glyphs[hash];
return 0;
}
static int
named_glyph_slot_linear(gs_copied_font_data_t *cfdata, gs_glyph glyph,
- gs_copied_glyph_t **pslot)
+ gs_copied_glyph_t **pslot)
{
{
- gs_copied_glyph_name_t *names = cfdata->names;
- int i;
-
- for (i = 0; i < cfdata->glyphs_size; ++i)
- if (names[i].glyph == glyph) {
- *pslot = &cfdata->glyphs[i];
- return 0;
- }
+ gs_copied_glyph_name_t *names = cfdata->names;
+ int i;
+
+ for (i = 0; i < cfdata->glyphs_size; ++i)
+ if (names[i].glyph == glyph) {
+ *pslot = &cfdata->glyphs[i];
+ return 0;
+ }
}
/* This might be a glyph with multiple names. Search extra_names. */
{
- gs_copied_glyph_extra_name_t *extra_name = cfdata->extra_names;
+ gs_copied_glyph_extra_name_t *extra_name = cfdata->extra_names;
- for (; extra_name != 0; extra_name = extra_name->next)
- if (extra_name->name.glyph == glyph) {
- *pslot = &cfdata->glyphs[extra_name->gid];
- return 0;
- }
+ for (; extra_name != 0; extra_name = extra_name->next)
+ if (extra_name->name.glyph == glyph) {
+ *pslot = &cfdata->glyphs[extra_name->gid];
+ return 0;
+ }
}
return_error(gs_error_rangecheck);
}
@@ -482,7 +482,7 @@ named_glyph_slot_linear(gs_copied_font_data_t *cfdata, gs_glyph glyph,
*/
static int
copy_glyph_data(gs_font *font, gs_glyph glyph, gs_font *copied, int options,
- gs_glyph_data_t *pgdata, const byte *prefix, int prefix_bytes)
+ gs_glyph_data_t *pgdata, const byte *prefix, int prefix_bytes)
{
gs_copied_font_data_t *const cfdata = cf_data(copied);
uint size = pgdata->bits.size;
@@ -490,45 +490,45 @@ copy_glyph_data(gs_font *font, gs_glyph glyph, gs_font *copied, int options,
int code = copied_glyph_slot(cfdata, glyph, &pcg);
if (cfdata->ordered)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
switch (code) {
case 0: /* already defined */
- if ((options & COPY_GLYPH_NO_OLD) ||
- pcg->gdata.size != prefix_bytes + size ||
- memcmp(pcg->gdata.data, prefix, prefix_bytes) ||
- memcmp(pcg->gdata.data + prefix_bytes,
- pgdata->bits.data, size)
- )
- code = gs_note_error(gs_error_invalidaccess);
- else
- code = 1;
- break;
+ if ((options & COPY_GLYPH_NO_OLD) ||
+ pcg->gdata.size != prefix_bytes + size ||
+ memcmp(pcg->gdata.data, prefix, prefix_bytes) ||
+ memcmp(pcg->gdata.data + prefix_bytes,
+ pgdata->bits.data, size)
+ )
+ code = gs_note_error(gs_error_invalidaccess);
+ else
+ code = 1;
+ break;
case gs_error_undefined:
- if (options & COPY_GLYPH_NO_NEW)
- code = gs_note_error(gs_error_undefined);
- else if (pcg == NULL)
- code = gs_note_error(gs_error_undefined);
- else {
- uint str_size = prefix_bytes + size;
- byte *str = gs_alloc_string(copied->memory, str_size,
- "copy_glyph_data(data)");
-
- if (str == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- if (prefix_bytes)
- memcpy(str, prefix, prefix_bytes);
- memcpy(str + prefix_bytes, pgdata->bits.data, size);
- pcg->gdata.data = str;
- pcg->gdata.size = str_size;
- pcg->used = HAS_DATA;
- pcg->order_index = -1;
- code = 0;
- cfdata->num_glyphs++;
- }
- }
+ if (options & COPY_GLYPH_NO_NEW)
+ code = gs_note_error(gs_error_undefined);
+ else if (pcg == NULL)
+ code = gs_note_error(gs_error_undefined);
+ else {
+ uint str_size = prefix_bytes + size;
+ byte *str = gs_alloc_string(copied->memory, str_size,
+ "copy_glyph_data(data)");
+
+ if (str == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ if (prefix_bytes)
+ memcpy(str, prefix, prefix_bytes);
+ memcpy(str + prefix_bytes, pgdata->bits.data, size);
+ pcg->gdata.data = str;
+ pcg->gdata.size = str_size;
+ pcg->used = HAS_DATA;
+ pcg->order_index = -1;
+ code = 0;
+ cfdata->num_glyphs++;
+ }
+ }
default:
- break;
+ break;
}
gs_glyph_data_free(pgdata, "copy_glyph_data");
return code;
@@ -539,7 +539,7 @@ copy_glyph_data(gs_font *font, gs_glyph glyph, gs_font *copied, int options,
*/
static int
copy_glyph_name(gs_font *font, gs_glyph glyph, gs_font *copied,
- gs_glyph copied_glyph)
+ gs_glyph copied_glyph)
{
gs_glyph known_glyph;
gs_copied_font_data_t *const cfdata = cf_data(copied);
@@ -549,33 +549,33 @@ copy_glyph_name(gs_font *font, gs_glyph glyph, gs_font *copied,
gs_const_string str;
if (cfdata->ordered)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (code < 0 ||
- (code = font->procs.glyph_name(font, glyph, &str)) < 0
- )
- return code;
+ (code = font->procs.glyph_name(font, glyph, &str)) < 0
+ )
+ return code;
/* Try to share a permanently allocated known glyph name. */
if ((known_glyph = gs_c_name_glyph(str.data, str.size)) != GS_NO_GLYPH)
- gs_c_glyph_name(known_glyph, &str);
+ gs_c_glyph_name(known_glyph, &str);
else if ((code = copy_string(copied->memory, &str, "copy_glyph_name")) < 0)
- return code;
+ return code;
pcgn = cfdata->names + (pcg - cfdata->glyphs);
if (pcgn->glyph != GS_NO_GLYPH &&
- (pcgn->str.size != str.size ||
- memcmp(pcgn->str.data, str.data, str.size))
- ) {
- /* This is a glyph with multiple names. Add an extra_name entry. */
- gs_copied_glyph_extra_name_t *extra_name =
- gs_alloc_struct(copied->memory, gs_copied_glyph_extra_name_t,
- &st_gs_copied_glyph_extra_name,
- "copy_glyph_name(extra_name)");
-
- if (extra_name == 0)
- return_error(gs_error_VMerror);
- extra_name->next = cfdata->extra_names;
- extra_name->gid = pcg - cfdata->glyphs;
- cfdata->extra_names = extra_name;
- pcgn = &extra_name->name;
+ (pcgn->str.size != str.size ||
+ memcmp(pcgn->str.data, str.data, str.size))
+ ) {
+ /* This is a glyph with multiple names. Add an extra_name entry. */
+ gs_copied_glyph_extra_name_t *extra_name =
+ gs_alloc_struct(copied->memory, gs_copied_glyph_extra_name_t,
+ &st_gs_copied_glyph_extra_name,
+ "copy_glyph_name(extra_name)");
+
+ if (extra_name == 0)
+ return_error(gs_error_VMerror);
+ extra_name->next = cfdata->extra_names;
+ extra_name->gid = pcg - cfdata->glyphs;
+ cfdata->extra_names = extra_name;
+ pcgn = &extra_name->name;
}
pcgn->glyph = glyph;
pcgn->str = str;
@@ -592,10 +592,10 @@ find_notdef(gs_font_base *font)
gs_glyph glyph;
while (font->procs.enumerate_glyph((gs_font *)font, &index,
- GLYPH_SPACE_NAME, &glyph),
- index != 0)
- if (gs_font_glyph_is_notdef(font, glyph))
- return glyph;
+ GLYPH_SPACE_NAME, &glyph),
+ index != 0)
+ if (gs_font_glyph_is_notdef(font, glyph))
+ return glyph;
return GS_NO_GLYPH; /* best we can do */
}
@@ -611,16 +611,16 @@ copied_char_add_encoding(gs_font *copied, gs_char chr, gs_glyph glyph)
int code;
if (cfdata->ordered)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (Encoding == 0)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
if (chr >= 256 || glyph >= GS_MIN_CID_GLYPH)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = copied_glyph_slot(cfdata, glyph, &pslot);
if (code < 0)
- return code;
+ return code;
if (Encoding[chr] != glyph && Encoding[chr] != GS_NO_GLYPH)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
Encoding[chr] = glyph;
return 0;
}
@@ -636,10 +636,10 @@ copied_no_add_encoding(gs_font *copied, gs_char chr, gs_glyph glyph)
static int
copied_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
if (pscale != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
*info = cf_data(font)->info;
return 0;
}
@@ -651,38 +651,38 @@ copied_encode_char(gs_font *copied, gs_char chr, gs_glyph_space_t glyph_space)
const gs_glyph *Encoding = cfdata->Encoding;
if (chr >= 256 || Encoding == 0)
- return GS_NO_GLYPH;
+ return GS_NO_GLYPH;
return Encoding[chr];
}
static int
copied_enumerate_glyph(gs_font *font, int *pindex,
- gs_glyph_space_t glyph_space, gs_glyph *pglyph)
+ gs_glyph_space_t glyph_space, gs_glyph *pglyph)
{
gs_copied_font_data_t *const cfdata = cf_data(font);
if (cfdata->ordered) {
- if (*pindex >= cfdata->num_glyphs)
- *pindex = 0;
- else {
- int i = cfdata->glyphs[*pindex].order_index;
-
- *pglyph = cfdata->names[i].glyph;
- ++(*pindex);
- }
- return 0;
+ if (*pindex >= cfdata->num_glyphs)
+ *pindex = 0;
+ else {
+ int i = cfdata->glyphs[*pindex].order_index;
+
+ *pglyph = cfdata->names[i].glyph;
+ ++(*pindex);
+ }
+ return 0;
}
for (; *pindex < cfdata->glyphs_size; ++*pindex)
- if (cfdata->glyphs[*pindex].used) {
- *pglyph =
- (glyph_space == GLYPH_SPACE_NAME && cfdata->names != 0 ?
- cfdata->names[*pindex].glyph :
- /* CIDFontType 0 uses CIDS as slot indices; CIDFontType 2 uses GIDs. */
- *pindex + (glyph_space == GLYPH_SPACE_NAME
- ? GS_MIN_CID_GLYPH : GS_MIN_GLYPH_INDEX));
- ++(*pindex);
- return 0;
- }
+ if (cfdata->glyphs[*pindex].used) {
+ *pglyph =
+ (glyph_space == GLYPH_SPACE_NAME && cfdata->names != 0 ?
+ cfdata->names[*pindex].glyph :
+ /* CIDFontType 0 uses CIDS as slot indices; CIDFontType 2 uses GIDs. */
+ *pindex + (glyph_space == GLYPH_SPACE_NAME
+ ? GS_MIN_CID_GLYPH : GS_MIN_GLYPH_INDEX));
+ ++(*pindex);
+ return 0;
+ }
*pindex = 0;
return 0;
}
@@ -694,16 +694,16 @@ copied_glyph_name(gs_font *font, gs_glyph glyph, gs_const_string *pstr)
gs_copied_glyph_t *pcg;
if (glyph >= GS_MIN_CID_GLYPH)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (copied_glyph_slot(cfdata, glyph, &pcg) < 0)
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
*pstr = cfdata->names[pcg - cfdata->glyphs].str;
return 0;
}
static int
copied_build_char(gs_show_enum *pte, gs_state *pgs, gs_font *font,
- gs_char chr, gs_glyph glyph)
+ gs_char chr, gs_glyph glyph)
{
int wmode = font->WMode;
int code;
@@ -712,22 +712,22 @@ copied_build_char(gs_show_enum *pte, gs_state *pgs, gs_font *font,
double sbw_stub[4]; /* Currently glyph_outline retrieves sbw only with type 1,2,9 fonts. */
if (glyph == GS_NO_GLYPH) {
- glyph = font->procs.encode_char(font, chr, GLYPH_SPACE_INDEX);
- if (glyph == GS_NO_GLYPH)
- glyph = cf_data(font)->notdef;
+ glyph = font->procs.encode_char(font, chr, GLYPH_SPACE_INDEX);
+ if (glyph == GS_NO_GLYPH)
+ glyph = cf_data(font)->notdef;
}
/*
* Type 1/2 outlines don't require a current point, but TrueType
* outlines do. We might want to fix this someday....
*/
if ((code = gs_moveto(pgs, 0.0, 0.0)) < 0 ||
- (code = font->procs.glyph_info(font, glyph, NULL,
- (GLYPH_INFO_WIDTH << wmode) |
- GLYPH_INFO_BBOX |
- GLYPH_INFO_OUTLINE_WIDTHS,
- &info)) < 0
- )
- return code;
+ (code = font->procs.glyph_info(font, glyph, NULL,
+ (GLYPH_INFO_WIDTH << wmode) |
+ GLYPH_INFO_BBOX |
+ GLYPH_INFO_OUTLINE_WIDTHS,
+ &info)) < 0
+ )
+ return code;
wxy[0] = info.width[wmode].x;
wxy[1] = info.width[wmode].y;
wxy[2] = info.bbox.p.x;
@@ -735,38 +735,38 @@ copied_build_char(gs_show_enum *pte, gs_state *pgs, gs_font *font,
wxy[4] = info.bbox.q.x;
wxy[5] = info.bbox.q.y;
if ((code = gs_setcachedevice_double(pte, pte->pgs, wxy)) < 0 ||
- (code = font->procs.glyph_outline(font, wmode, glyph, &ctm_only(pgs),
- pgs->path, sbw_stub)) < 0
- )
- return code;
+ (code = font->procs.glyph_outline(font, wmode, glyph, &ctm_only(pgs),
+ pgs->path, sbw_stub)) < 0
+ )
+ return code;
if (font->PaintType != 0) {
- gs_setlinewidth(pgs, font->StrokeWidth);
- return gs_stroke(pgs);
+ gs_setlinewidth(pgs, font->StrokeWidth);
+ return gs_stroke(pgs);
} else {
- return gs_fill(pgs);
+ return gs_fill(pgs);
}
}
-static inline bool
+static inline bool
compare_arrays(const float *v0, int l0, const float *v1, int l1)
{
if (l0 != l1)
- return false;
+ return false;
if (memcmp(v0, v1, l0 * sizeof(v0[0])))
- return false;
- return true;
+ return false;
+ return true;
}
#define compare_tables(a, b) compare_arrays(a.values, a.count, b.values, b.count)
static int
-compare_glyphs(const gs_font *cfont, const gs_font *ofont, gs_glyph *glyphs,
- int num_glyphs, int glyphs_step, int level)
+compare_glyphs(const gs_font *cfont, const gs_font *ofont, gs_glyph *glyphs,
+ int num_glyphs, int glyphs_step, int level)
{
- /*
- * Checking widths because we can synthesize fonts from random fonts
- * having same FontName and FontType.
- * We must request width explicitely because Type 42 stores widths
+ /*
+ * Checking widths because we can synthesize fonts from random fonts
+ * having same FontName and FontType.
+ * We must request width explicitely because Type 42 stores widths
* separately from outline data. We could skip it for Type 1, which doesn't.
* We don't care of Metrics, Metrics2 because copied font never has them.
*/
@@ -778,131 +778,131 @@ compare_glyphs(const gs_font *cfont, const gs_font *ofont, gs_glyph *glyphs,
gs_make_identity(&mat);
for (i = 0; i < num_glyphs; i++) {
- gs_glyph glyph = *(gs_glyph *)((byte *)glyphs + i * glyphs_step);
- gs_glyph pieces0[40], *pieces = pieces0;
- gs_glyph_info_t info0, info1;
- int code0 = ofont->procs.glyph_info((gs_font *)ofont, glyph, &mat, members, &info0);
- int code1 = cfont->procs.glyph_info((gs_font *)cfont, glyph, &mat, members, &info1);
- int code2, code;
-
- if (code0 == gs_error_undefined)
- continue;
- if (code1 == gs_error_undefined) {
- num_new_glyphs++;
- if (num_new_glyphs > cfdata->glyphs_size - cfdata->num_glyphs)
- return 0;
- continue;
- }
- if (code0 < 0)
- return code0;
- if (code1 < 0)
- return code1;
- if (info0.num_pieces != info1.num_pieces)
- return 0;
- if (info0.width[WMode].x != info1.width[WMode].x ||
- info0.width[WMode].y != info1.width[WMode].y)
- return 0;
- if (WMode && (info0.v.x != info1.v.x || info0.v.y != info1.v.y))
- return 0;
- if (info0.num_pieces > 0) {
- if(level > 5)
- return_error(gs_error_rangecheck); /* abnormal glyph recursion */
- if (info0.num_pieces > countof(pieces0) / 2) {
- pieces = (gs_glyph *)gs_alloc_bytes(cfont->memory,
- sizeof(glyphs) * info0.num_pieces * 2, "compare_glyphs");
- if (pieces == 0)
- return_error(gs_error_VMerror);
- }
- info0.pieces = pieces;
- info1.pieces = pieces + info0.num_pieces;
- code0 = ofont->procs.glyph_info((gs_font *)ofont, glyph, &mat,
- GLYPH_INFO_PIECES, &info0);
- code1 = cfont->procs.glyph_info((gs_font *)cfont, glyph, &mat,
- GLYPH_INFO_PIECES, &info1);
- if (code0 >= 0 && code1 >= 0) {
- code2 = memcmp(info0.pieces, info1.pieces, info0.num_pieces * sizeof(*pieces));
- if (!code2)
- code = compare_glyphs(cfont, ofont, pieces, info0.num_pieces, glyphs_step, level + 1);
- else
- code = 0; /* Quiet compiler. */
- } else
- code2 = code = 0;
- if (pieces != pieces0)
- gs_free_object(cfont->memory, pieces, "compare_glyphs");
- if (code0 == gs_error_undefined)
- continue;
- if (code1 == gs_error_undefined) {
- num_new_glyphs++;
- if (num_new_glyphs > cfdata->glyphs_size - cfdata->num_glyphs)
- return 0;
- continue;
- }
- if (code0 < 0)
- return code0;
- if (code1 < 0)
- return code1;
- if (code2 || code == 0) {
- return 0;
- }
- } else {
- gs_glyph_data_t gdata0, gdata1;
-
- switch(cfont->FontType) {
- case ft_encrypted:
- case ft_encrypted2: {
- gs_font_type1 *font0 = (gs_font_type1 *)cfont;
- gs_font_type1 *font1 = (gs_font_type1 *)ofont;
-
- gdata0.memory = font0->memory;
- gdata1.memory = font1->memory;
- code0 = font0->data.procs.glyph_data(font0, glyph, &gdata0);
- code1 = font1->data.procs.glyph_data(font1, glyph, &gdata1);
- break;
- }
- case ft_TrueType:
- case ft_CID_TrueType: {
- gs_font_type42 *font0 = (gs_font_type42 *)cfont;
- gs_font_type42 *font1 = (gs_font_type42 *)ofont;
- uint glyph_index0 = font0->data.get_glyph_index(font0, glyph);
- uint glyph_index1 = font1->data.get_glyph_index(font1, glyph);
-
- gdata0.memory = font0->memory;
- gdata1.memory = font1->memory;
- code0 = font0->data.get_outline(font0, glyph_index0, &gdata0);
- code1 = font1->data.get_outline(font1, glyph_index1, &gdata1);
- break;
- }
- case ft_CID_encrypted: {
- gs_font_cid0 *font0 = (gs_font_cid0 *)cfont;
- gs_font_cid0 *font1 = (gs_font_cid0 *)ofont;
- int fidx0, fidx1;
-
- gdata0.memory = font0->memory;
- gdata1.memory = font1->memory;
- code0 = font0->cidata.glyph_data((gs_font_base *)font0, glyph, &gdata0, &fidx0);
- code1 = font1->cidata.glyph_data((gs_font_base *)font1, glyph, &gdata1, &fidx1);
- break;
- }
- default:
- return_error(gs_error_unregistered); /* unimplemented */
- }
- if (code0 < 0) {
- if (code1 >= 0)
- gs_glyph_data_free(&gdata1, "compare_glyphs");
- return code0;
- }
- if (code1 < 0) {
- if (code0 >= 0)
- gs_glyph_data_free(&gdata0, "compare_glyphs");
- return code1;
- }
- if (gdata0.bits.size != gdata1.bits.size)
- return 0;
- if (memcmp(gdata0.bits.data, gdata0.bits.data, gdata0.bits.size))
- return 0;
- gs_glyph_data_free(&gdata0, "compare_glyphs");
- gs_glyph_data_free(&gdata1, "compare_glyphs");
- }
+ gs_glyph glyph = *(gs_glyph *)((byte *)glyphs + i * glyphs_step);
+ gs_glyph pieces0[40], *pieces = pieces0;
+ gs_glyph_info_t info0, info1;
+ int code0 = ofont->procs.glyph_info((gs_font *)ofont, glyph, &mat, members, &info0);
+ int code1 = cfont->procs.glyph_info((gs_font *)cfont, glyph, &mat, members, &info1);
+ int code2, code;
+
+ if (code0 == gs_error_undefined)
+ continue;
+ if (code1 == gs_error_undefined) {
+ num_new_glyphs++;
+ if (num_new_glyphs > cfdata->glyphs_size - cfdata->num_glyphs)
+ return 0;
+ continue;
+ }
+ if (code0 < 0)
+ return code0;
+ if (code1 < 0)
+ return code1;
+ if (info0.num_pieces != info1.num_pieces)
+ return 0;
+ if (info0.width[WMode].x != info1.width[WMode].x ||
+ info0.width[WMode].y != info1.width[WMode].y)
+ return 0;
+ if (WMode && (info0.v.x != info1.v.x || info0.v.y != info1.v.y))
+ return 0;
+ if (info0.num_pieces > 0) {
+ if(level > 5)
+ return_error(gs_error_rangecheck); /* abnormal glyph recursion */
+ if (info0.num_pieces > countof(pieces0) / 2) {
+ pieces = (gs_glyph *)gs_alloc_bytes(cfont->memory,
+ sizeof(glyphs) * info0.num_pieces * 2, "compare_glyphs");
+ if (pieces == 0)
+ return_error(gs_error_VMerror);
+ }
+ info0.pieces = pieces;
+ info1.pieces = pieces + info0.num_pieces;
+ code0 = ofont->procs.glyph_info((gs_font *)ofont, glyph, &mat,
+ GLYPH_INFO_PIECES, &info0);
+ code1 = cfont->procs.glyph_info((gs_font *)cfont, glyph, &mat,
+ GLYPH_INFO_PIECES, &info1);
+ if (code0 >= 0 && code1 >= 0) {
+ code2 = memcmp(info0.pieces, info1.pieces, info0.num_pieces * sizeof(*pieces));
+ if (!code2)
+ code = compare_glyphs(cfont, ofont, pieces, info0.num_pieces, glyphs_step, level + 1);
+ else
+ code = 0; /* Quiet compiler. */
+ } else
+ code2 = code = 0;
+ if (pieces != pieces0)
+ gs_free_object(cfont->memory, pieces, "compare_glyphs");
+ if (code0 == gs_error_undefined)
+ continue;
+ if (code1 == gs_error_undefined) {
+ num_new_glyphs++;
+ if (num_new_glyphs > cfdata->glyphs_size - cfdata->num_glyphs)
+ return 0;
+ continue;
+ }
+ if (code0 < 0)
+ return code0;
+ if (code1 < 0)
+ return code1;
+ if (code2 || code == 0) {
+ return 0;
+ }
+ } else {
+ gs_glyph_data_t gdata0, gdata1;
+
+ switch(cfont->FontType) {
+ case ft_encrypted:
+ case ft_encrypted2: {
+ gs_font_type1 *font0 = (gs_font_type1 *)cfont;
+ gs_font_type1 *font1 = (gs_font_type1 *)ofont;
+
+ gdata0.memory = font0->memory;
+ gdata1.memory = font1->memory;
+ code0 = font0->data.procs.glyph_data(font0, glyph, &gdata0);
+ code1 = font1->data.procs.glyph_data(font1, glyph, &gdata1);
+ break;
+ }
+ case ft_TrueType:
+ case ft_CID_TrueType: {
+ gs_font_type42 *font0 = (gs_font_type42 *)cfont;
+ gs_font_type42 *font1 = (gs_font_type42 *)ofont;
+ uint glyph_index0 = font0->data.get_glyph_index(font0, glyph);
+ uint glyph_index1 = font1->data.get_glyph_index(font1, glyph);
+
+ gdata0.memory = font0->memory;
+ gdata1.memory = font1->memory;
+ code0 = font0->data.get_outline(font0, glyph_index0, &gdata0);
+ code1 = font1->data.get_outline(font1, glyph_index1, &gdata1);
+ break;
+ }
+ case ft_CID_encrypted: {
+ gs_font_cid0 *font0 = (gs_font_cid0 *)cfont;
+ gs_font_cid0 *font1 = (gs_font_cid0 *)ofont;
+ int fidx0, fidx1;
+
+ gdata0.memory = font0->memory;
+ gdata1.memory = font1->memory;
+ code0 = font0->cidata.glyph_data((gs_font_base *)font0, glyph, &gdata0, &fidx0);
+ code1 = font1->cidata.glyph_data((gs_font_base *)font1, glyph, &gdata1, &fidx1);
+ break;
+ }
+ default:
+ return_error(gs_error_unregistered); /* unimplemented */
+ }
+ if (code0 < 0) {
+ if (code1 >= 0)
+ gs_glyph_data_free(&gdata1, "compare_glyphs");
+ return code0;
+ }
+ if (code1 < 0) {
+ if (code0 >= 0)
+ gs_glyph_data_free(&gdata0, "compare_glyphs");
+ return code1;
+ }
+ if (gdata0.bits.size != gdata1.bits.size)
+ return 0;
+ if (memcmp(gdata0.bits.data, gdata0.bits.data, gdata0.bits.size))
+ return 0;
+ gs_glyph_data_free(&gdata0, "compare_glyphs");
+ gs_glyph_data_free(&gdata1, "compare_glyphs");
+ }
}
return 1;
}
@@ -913,39 +913,39 @@ compare_glyphs(const gs_font *cfont, const gs_font *ofont, gs_glyph *glyphs,
static int
copied_type1_glyph_data(gs_font_type1 * pfont, gs_glyph glyph,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
gs_copied_font_data_t *const cfdata = cf_data((gs_font *)pfont);
gs_copied_glyph_t *pslot;
int code = copied_glyph_slot(cfdata, glyph, &pslot);
if (code < 0)
- return code;
+ return code;
gs_glyph_data_from_string(pgd, pslot->gdata.data, pslot->gdata.size,
- NULL);
+ NULL);
return 0;
}
static int
copied_type1_subr_data(gs_font_type1 * pfont, int subr_num, bool global,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
gs_copied_font_data_t *const cfdata = cf_data((gs_font *)pfont);
const gs_subr_info_t *psi =
- (global ? &cfdata->global_subrs : &cfdata->subrs);
+ (global ? &cfdata->global_subrs : &cfdata->subrs);
if (subr_num < 0 || subr_num >= psi->count)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
gs_glyph_data_from_string(pgd, psi->data + psi->starts[subr_num],
- psi->starts[subr_num + 1] -
- psi->starts[subr_num],
- NULL);
+ psi->starts[subr_num + 1] -
+ psi->starts[subr_num],
+ NULL);
return 0;
}
static int
copied_type1_seac_data(gs_font_type1 * pfont, int ccode,
- gs_glyph * pglyph, gs_const_string *gstr, gs_glyph_data_t *pgd)
+ gs_glyph * pglyph, gs_const_string *gstr, gs_glyph_data_t *pgd)
{
/*
* This can only be invoked if the components have already been
@@ -956,19 +956,19 @@ copied_type1_seac_data(gs_font_type1 * pfont, int ccode,
int code;
if (glyph == GS_NO_GLYPH)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = gs_c_glyph_name(glyph, gstr);
if (code < 0)
- return code;
+ return code;
code = pfont->dir->global_glyph_code(pfont->memory, gstr, &glyph1);
if (code < 0)
- return code;
+ return code;
if (pglyph)
- *pglyph = glyph1;
+ *pglyph = glyph1;
if (pgd)
- return copied_type1_glyph_data(pfont, glyph1, pgd);
+ return copied_type1_glyph_data(pfont, glyph1, pgd);
else
- return 0;
+ return 0;
}
static int
@@ -994,13 +994,13 @@ copy_font_type1(gs_font *font, gs_font *copied)
cfdata->notdef = find_notdef((gs_font_base *)font);
code = copied_Encoding_alloc(copied);
if (code < 0)
- return code;
+ return code;
if ((code = copy_subrs(font1, false, &cfdata->subrs, copied->memory)) < 0 ||
- (code = copy_subrs(font1, true, &cfdata->global_subrs, copied->memory)) < 0
- ) {
- gs_free_object(copied->memory, cfdata->Encoding,
- "copy_font_type1(Encoding)");
- return code;
+ (code = copy_subrs(font1, true, &cfdata->global_subrs, copied->memory)) < 0
+ ) {
+ gs_free_object(copied->memory, cfdata->Encoding,
+ "copy_font_type1(Encoding)");
+ return code;
}
/*
* We don't need real push/pop procedures, because we can't do anything
@@ -1026,20 +1026,20 @@ copy_glyph_type1(gs_font *font, gs_glyph glyph, gs_font *copied, int options)
gdata.memory = font->memory;
code = font1->data.procs.glyph_data(font1, glyph, &gdata);
if (code < 0)
- return code;
+ return code;
code = copy_glyph_data(font, glyph, copied, options, &gdata, NULL, 0);
if (code < 0)
- return code;
+ return code;
rcode = code;
if (code == 0)
- code = copy_glyph_name(font, glyph, copied, glyph);
+ code = copy_glyph_name(font, glyph, copied, glyph);
return (code < 0 ? code : rcode);
}
static int
copied_type1_glyph_outline(gs_font *font, int WMode, gs_glyph glyph,
- const gs_matrix *pmat, gx_path *ppath, double sbw[4])
-{ /*
+ const gs_matrix *pmat, gx_path *ppath, double sbw[4])
+{ /*
* 'WMode' may be inherited from an upper font.
* We ignore in because Type 1,2 charstrings do not depend on it.
*/
@@ -1059,40 +1059,40 @@ copied_type1_glyph_outline(gs_font *font, int WMode, gs_glyph glyph,
gdata.memory = pfont1->memory;
code = pfont1->data.procs.glyph_data(pfont1, glyph, &gdata);
if (code < 0)
- return code;
+ return code;
if (pgd->bits.size <= max(pfont1->data.lenIV, 0))
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
/* Initialize just enough of the imager state. */
if (pmat)
- gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
+ gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
else {
- gs_matrix imat;
+ gs_matrix imat;
- gs_make_identity(&imat);
- gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
+ gs_make_identity(&imat);
+ gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
}
gis.flatness = 0;
code = gs_type1_interp_init(&cis, &gis, ppath, NULL, NULL, true, 0,
- pfont1);
+ pfont1);
if (code < 0)
- return code;
+ return code;
cis.no_grid_fitting = true;
/* Continue interpreting. */
for (;;) {
- int value;
-
- code = pfont1->data.interpret(&cis, pgd, &value);
- switch (code) {
- case 0: /* all done */
- /* falls through */
- default: /* code < 0, error */
- return code;
- case type1_result_callothersubr: /* unknown OtherSubr */
- return_error(gs_error_rangecheck); /* can't handle it */
- case type1_result_sbw: /* [h]sbw, just continue */
- pgd = 0;
- type1_cis_get_metrics(&cis, sbw);
- }
+ int value;
+
+ code = pfont1->data.interpret(&cis, pgd, &value);
+ switch (code) {
+ case 0: /* all done */
+ /* falls through */
+ default: /* code < 0, error */
+ return code;
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return_error(gs_error_rangecheck); /* can't handle it */
+ case type1_result_sbw: /* [h]sbw, just continue */
+ pgd = 0;
+ type1_cis_get_metrics(&cis, sbw);
+ }
}
}
@@ -1113,23 +1113,23 @@ static void hash_subrs(gs_font_type1 *pfont)
gdata0.memory = pfont->memory;
/* Scan the font to hash the global subrs. */
for (i = 0; !exit; i++) {
- int code0 = pfont->data.procs.subr_data((gs_font_type1 *)pfont,
- i, true, &gdata0);
- if (code0 == gs_error_rangecheck)
- /* rangecheck means we ran out of /Subrs */
- exit = true;
- if (code0 == gs_error_typecheck)
- /* typecheck means that we may have encoutnered a null object
- * for a Subr, we ignore this subr, but carry on hashing, as there
- * may be more Subrs.
- */
- continue;
- if (code0 < 0)
- break;
- else {
- gs_md5_append(&md5, gdata0.bits.data, gdata0.bits.size);
- gs_glyph_data_free(&gdata0, "hash_type1_subrs");
- }
+ int code0 = pfont->data.procs.subr_data((gs_font_type1 *)pfont,
+ i, true, &gdata0);
+ if (code0 == gs_error_rangecheck)
+ /* rangecheck means we ran out of /Subrs */
+ exit = true;
+ if (code0 == gs_error_typecheck)
+ /* typecheck means that we may have encoutnered a null object
+ * for a Subr, we ignore this subr, but carry on hashing, as there
+ * may be more Subrs.
+ */
+ continue;
+ if (code0 < 0)
+ break;
+ else {
+ gs_md5_append(&md5, gdata0.bits.data, gdata0.bits.size);
+ gs_glyph_data_free(&gdata0, "hash_type1_subrs");
+ }
}
/* For a 'belt and braces' approach, we also record the number of local
* and global /Subrs, and compare these below as well. Shifting the global
@@ -1140,29 +1140,29 @@ static void hash_subrs(gs_font_type1 *pfont)
exit = 0;
/* Scan the font to hash the local subrs. */
for (i = 0; !exit; i++) {
- int code0 = pfont->data.procs.subr_data((gs_font_type1 *)pfont,
- i, false, &gdata0);
- if (code0 == gs_error_rangecheck)
- /* rangecheck means we ran out of /Subrs */
- exit = true;
- if (code0 == gs_error_typecheck)
- /* typecheck means that we may have encoutnered a null object
- * for a Subr, we ignore this subr, but carry on hashing, as there
- * may be more Subrs.
- */
- continue;
- if (code0 < 0)
- break;
- else {
- gs_md5_append(&md5, gdata0.bits.data, gdata0.bits.size);
- gs_glyph_data_free(&gdata0, "hash_type1_subrs");
- }
+ int code0 = pfont->data.procs.subr_data((gs_font_type1 *)pfont,
+ i, false, &gdata0);
+ if (code0 == gs_error_rangecheck)
+ /* rangecheck means we ran out of /Subrs */
+ exit = true;
+ if (code0 == gs_error_typecheck)
+ /* typecheck means that we may have encoutnered a null object
+ * for a Subr, we ignore this subr, but carry on hashing, as there
+ * may be more Subrs.
+ */
+ continue;
+ if (code0 < 0)
+ break;
+ else {
+ gs_md5_append(&md5, gdata0.bits.data, gdata0.bits.size);
+ gs_glyph_data_free(&gdata0, "hash_type1_subrs");
+ }
}
gs_md5_finish(&md5, d0->hash_subrs);
d0->num_subrs += i;
}
-static bool
+static bool
same_type1_hinting(const gs_font_type1 *cfont, const gs_font_type1 *ofont)
{
const gs_type1_data *d0 = &cfont->data, *d1 = &ofont->data;
@@ -1170,47 +1170,47 @@ same_type1_hinting(const gs_font_type1 *cfont, const gs_font_type1 *ofont)
int *hash1 = (int *)&d1->hash_subrs;
if (d0->lenIV != d1->lenIV)
- return false;
+ return false;
/*
if (d0->defaultWidthX != d1->defaultWidthX)
- return false;
+ return false;
if (d0->nominalWidthX != d1->nominalWidthX)
- return false;
+ return false;
*/
if (d0->BlueFuzz != d1->BlueFuzz)
- return false;
+ return false;
if (d0->BlueScale != d1->BlueScale)
- return false;
+ return false;
if (d0->BlueShift != d1->BlueShift)
- return false;
+ return false;
if (d0->ExpansionFactor != d1->ExpansionFactor)
- return false;
+ return false;
if (d0->ForceBold != d1->ForceBold)
- return false;
+ return false;
if (!compare_tables(d0->FamilyBlues, d1->FamilyBlues))
- return false;
+ return false;
if (!compare_tables(d0->FamilyOtherBlues, d1->FamilyOtherBlues))
- return false;
+ return false;
if (d0->LanguageGroup != d1->LanguageGroup)
- return false;
+ return false;
if (!compare_tables(d0->OtherBlues, d1->OtherBlues))
- return false;
+ return false;
if (d0->RndStemUp != d1->RndStemUp)
- return false;
+ return false;
if (!compare_tables(d0->StdHW, d1->StdHW))
- return false;
+ return false;
if (!compare_tables(d0->StemSnapH, d1->StemSnapH))
- return false;
+ return false;
if (!compare_tables(d0->StemSnapV, d1->StemSnapV))
- return false;
+ return false;
if (!compare_tables(d0->WeightVector, d1->WeightVector))
- return false;
+ return false;
if (hash0[0] == 0x00 && hash0[1] == 0x00 && hash0[2] == 0x00 && hash0[3] == 0x00)
- hash_subrs((gs_font_type1 *)cfont);
+ hash_subrs((gs_font_type1 *)cfont);
if (hash1[0] == 0x00 && hash1[1] == 0x00 && hash1[2] == 0x00 && hash1[3] == 0x00)
- hash_subrs((gs_font_type1 *)ofont);
+ hash_subrs((gs_font_type1 *)ofont);
if (memcmp(d0->hash_subrs, d1->hash_subrs, 16) != 0 || d0->num_subrs != d1->num_subrs)
- return false;
+ return false;
/*
* We ignore differences in OtherSubrs because pdfwrite
@@ -1224,36 +1224,36 @@ same_type1_hinting(const gs_font_type1 *cfont, const gs_font_type1 *ofont)
static int
copied_type42_string_proc(gs_font_type42 *font, ulong offset, uint len,
- const byte **pstr)
+ const byte **pstr)
{
gs_copied_font_data_t *const cfdata = font->data.proc_data;
if (offset + len > cfdata->data_size)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
*pstr = cfdata->data + offset;
return 0;
}
static int
copied_type42_get_outline(gs_font_type42 *font, uint glyph_index,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
gs_copied_font_data_t *const cfdata = font->data.proc_data;
gs_copied_glyph_t *pcg;
if (glyph_index >= cfdata->glyphs_size)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pcg = &cfdata->glyphs[glyph_index];
if (!pcg->used)
- gs_glyph_data_from_null(pgd);
+ gs_glyph_data_from_null(pgd);
else
- gs_glyph_data_from_string(pgd, pcg->gdata.data, pcg->gdata.size, NULL);
+ gs_glyph_data_from_string(pgd, pcg->gdata.data, pcg->gdata.size, NULL);
return 0;
}
static int
copied_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
- gs_type42_metrics_options_t options, float sbw[4])
+ gs_type42_metrics_options_t options, float sbw[4])
{
/* Check whether we have metrics for this (glyph,wmode) pair. */
gs_copied_font_data_t *const cfdata = pfont->data.proc_data;
@@ -1261,10 +1261,10 @@ copied_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
int wmode = gs_type42_metrics_options_wmode(options);
if (glyph_index >= cfdata->glyphs_size)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pcg = &cfdata->glyphs[glyph_index];
if (!(pcg->used & (HAS_SBW0 << wmode)))
- return_error(gs_error_undefined);
+ return_error(gs_error_undefined);
return gs_type42_default_get_metrics(pfont, glyph_index, options, sbw);
}
@@ -1276,7 +1276,7 @@ copied_type42_get_glyph_index(gs_font_type42 *font, gs_glyph glyph)
int code = copied_glyph_slot(cfdata, glyph, &pcg);
if (code < 0)
- return GS_NO_GLYPH;
+ return GS_NO_GLYPH;
return pcg - cfdata->glyphs;
}
@@ -1298,23 +1298,23 @@ copy_font_type42(gs_font *font, gs_font *copied)
cfdata->notdef = find_notdef((gs_font_base *)font);
code = copied_Encoding_alloc(copied);
if (code < 0)
- return code;
+ return code;
s_init(&fs, font->memory);
swrite_position_only(&fs);
code = (font->FontType == ft_TrueType ? psf_write_truetype_stripped(&fs, font42)
- : psf_write_cid2_stripped(&fs, (gs_font_cid2 *)font42));
+ : psf_write_cid2_stripped(&fs, (gs_font_cid2 *)font42));
code = copied_data_alloc(copied, &fs, extra, code);
if (code < 0)
- goto fail;
+ goto fail;
if (font->FontType == ft_TrueType)
- psf_write_truetype_stripped(&fs, font42);
+ psf_write_truetype_stripped(&fs, font42);
else
- psf_write_cid2_stripped(&fs, (gs_font_cid2 *)font42);
+ psf_write_cid2_stripped(&fs, (gs_font_cid2 *)font42);
copied42->data.string_proc = copied_type42_string_proc;
copied42->data.proc_data = cfdata;
code = gs_type42_font_init(copied42, 0);
if (code < 0)
- goto fail2;
+ goto fail2;
/* gs_type42_font_init overwrites font_info. */
copied->procs.font_info = copied_font_info;
/* gs_type42_font_init overwrites enumerate_glyph. */
@@ -1323,23 +1323,23 @@ copy_font_type42(gs_font *font, gs_font *copied)
copied42->data.get_outline = copied_type42_get_outline;
copied42->data.get_metrics = copied_type42_get_metrics;
copied42->data.metrics[0].numMetrics =
- copied42->data.metrics[1].numMetrics =
- extra / 8;
+ copied42->data.metrics[1].numMetrics =
+ extra / 8;
copied42->data.metrics[0].offset = cfdata->data_size - extra;
copied42->data.metrics[1].offset = cfdata->data_size - extra / 2;
copied42->data.metrics[0].length =
- copied42->data.metrics[1].length =
- extra / 2;
+ copied42->data.metrics[1].length =
+ extra / 2;
memset(cfdata->data + cfdata->data_size - extra, 0, extra);
copied42->data.numGlyphs = font42->data.numGlyphs;
copied42->data.trueNumGlyphs = font42->data.trueNumGlyphs;
return 0;
fail2:
gs_free_object(copied->memory, cfdata->data,
- "copy_font_type42(data)");
+ "copy_font_type42(data)");
fail:
gs_free_object(copied->memory, cfdata->Encoding,
- "copy_font_type42(Encoding)");
+ "copy_font_type42(Encoding)");
return code;
}
@@ -1351,9 +1351,9 @@ copy_glyph_type42(gs_font *font, gs_glyph glyph, gs_font *copied, int options)
gs_font_cid2 *fontCID2 = (gs_font_cid2 *)font;
gs_font_type42 *const copied42 = (gs_font_type42 *)copied;
uint gid = (options & COPY_GLYPH_BY_INDEX ? glyph - GS_MIN_GLYPH_INDEX :
- font->FontType == ft_CID_TrueType
- ? fontCID2->cidata.CIDMap_proc(fontCID2, glyph)
- : font42->data.get_glyph_index(font42, glyph));
+ font->FontType == ft_CID_TrueType
+ ? fontCID2->cidata.CIDMap_proc(fontCID2, glyph)
+ : font42->data.get_glyph_index(font42, glyph));
int code;
int rcode;
gs_copied_font_data_t *const cfdata = cf_data(copied);
@@ -1364,73 +1364,72 @@ copy_glyph_type42(gs_font *font, gs_glyph glyph, gs_font *copied, int options)
gdata.memory = font42->memory;
code = font42->data.get_outline(font42, gid, &gdata);
- /* If the glyph is a /.notdef, and the GID is not 0, and we failed to find
+ /* If the glyph is a /.notdef, and the GID is not 0, and we failed to find
* the /.notdef, try again with GID 0. We have seen fonts from GraphPad
* Prism which end up putting the /.notdef in the CharStrings dictionary
* with the wrong GID value (Bug #691573)
*/
if (code < 0 && gid != 0) {
- gs_const_string gnstr;
- if (font->procs.glyph_name(font, glyph, &gnstr) >= 0 && gnstr.size == 7
- && !memcmp(gnstr.data, ".notdef", 7)) {
- gid = 0;
- code = font42->data.get_outline(font42, gid, &gdata);
- }
+ gs_const_string gnstr;
+ if (font->procs.glyph_name(font, glyph, &gnstr) >= 0 && gnstr.size == 7
+ && !memcmp(gnstr.data, ".notdef", 7)) {
+ gid = 0;
+ code = font42->data.get_outline(font42, gid, &gdata);
+ }
}
if (code < 0)
- return code;
+ return code;
code = copy_glyph_data(font, gid + GS_MIN_GLYPH_INDEX, copied, options,
- &gdata, NULL, 0);
+ &gdata, NULL, 0);
if (code < 0)
- return code;
+ return code;
rcode = code;
if (glyph < GS_MIN_CID_GLYPH)
- code = copy_glyph_name(font, glyph, copied,
- gid + GS_MIN_GLYPH_INDEX);
+ code = copy_glyph_name(font, glyph, copied,
+ gid + GS_MIN_GLYPH_INDEX);
DISCARD(copied_glyph_slot(cfdata, gid + GS_MIN_GLYPH_INDEX, &pcg)); /* can't fail */
for (i = 0; i < 2; ++i) {
- if (font42->data.get_metrics(font42, gid, i, sbw) >= 0) {
- int sb = (int)(sbw[i] * factor + 0.5);
- uint width = (uint)(sbw[2 + i] * factor + 0.5);
- byte *pmetrics =
- cfdata->data + copied42->data.metrics[i].offset + gid * 4;
-
- pmetrics[0] = (byte)(width >> 8);
- pmetrics[1] = (byte)width;
- pmetrics[2] = (byte)(sb >> 8);
- pmetrics[3] = (byte)sb;
- pcg->used |= HAS_SBW0 << i;
- }
- factor = -factor; /* values are negated for WMode = 1 */
+ if (font42->data.get_metrics(font42, gid, i, sbw) >= 0) {
+ int sb = (int)(sbw[i] * factor + 0.5);
+ uint width = (uint)(sbw[2 + i] * factor + 0.5);
+ byte *pmetrics =
+ cfdata->data + copied42->data.metrics[i].offset + gid * 4;
+
+ pmetrics[0] = (byte)(width >> 8);
+ pmetrics[1] = (byte)width;
+ pmetrics[2] = (byte)(sb >> 8);
+ pmetrics[3] = (byte)sb;
+ pcg->used |= HAS_SBW0 << i;
+ }
+ factor = -factor; /* values are negated for WMode = 1 */
}
return (code < 0 ? code : rcode);
}
static gs_glyph
copied_type42_encode_char(gs_font *copied, gs_char chr,
- gs_glyph_space_t glyph_space)
+ gs_glyph_space_t glyph_space)
{
gs_copied_font_data_t *const cfdata = cf_data(copied);
const gs_glyph *Encoding = cfdata->Encoding;
gs_glyph glyph;
if (chr >= 256 || Encoding == 0)
- return GS_NO_GLYPH;
+ return GS_NO_GLYPH;
glyph = Encoding[chr];
if (glyph_space == GLYPH_SPACE_INDEX) {
- /* Search linearly for the glyph by name. */
- gs_copied_glyph_t *pcg;
- int code = named_glyph_slot_linear(cfdata, glyph, &pcg);
+ /* Search linearly for the glyph by name. */
+ gs_copied_glyph_t *pcg;
+ int code = named_glyph_slot_linear(cfdata, glyph, &pcg);
- if (code < 0 || !pcg->used)
- return GS_NO_GLYPH;
- return GS_MIN_GLYPH_INDEX + (pcg - cfdata->glyphs);
+ if (code < 0 || !pcg->used)
+ return GS_NO_GLYPH;
+ return GS_MIN_GLYPH_INDEX + (pcg - cfdata->glyphs);
}
return glyph;
}
-
static const gs_copied_font_procs_t copied_procs_type42 = {
copy_font_type42, copy_glyph_type42, copied_char_add_encoding,
named_glyph_slot_linear,
@@ -1438,8 +1437,8 @@ static const gs_copied_font_procs_t copied_procs_type42 = {
};
static inline int
-access_type42_data(gs_font_type42 *pfont, ulong base, ulong length,
- const byte **vptr)
+access_type42_data(gs_font_type42 *pfont, ulong base, ulong length,
+ const byte **vptr)
{
return pfont->data.string_proc(pfont, base, length, vptr);
}
@@ -1460,63 +1459,63 @@ same_type42_hinting(gs_font_type42 *font0, gs_font_type42 *font1)
int i, j, code;
if (d0->unitsPerEm != d1->unitsPerEm)
- return 0;
+ return 0;
font[0] = font0;
font[1] = font1;
memset(pos, 0, sizeof(pos));
for (j = 0; j < 2; j++) {
- const byte *OffsetTable;
- uint numTables;
-
- code = access_type42_data(font[j], 0, 12, &OffsetTable);
- if (code < 0)
- return code;
- numTables = U16(OffsetTable + 4);
- for (i = 0; i < numTables; ++i) {
- const byte *tab;
- ulong start;
- uint length;
-
- code = access_type42_data(font[j], 12 + i * 16, 16, &tab);
- if (code < 0)
- return code;
- start = get_u32_msb(tab + 8);
- length = get_u32_msb(tab + 12);
- if (!memcmp("prep", tab, 4))
- pos[j][0] = start, len[j][0] = length;
- else if (!memcmp("cvt ", tab, 4))
- pos[j][1] = start, len[j][1] = length;
- else if (!memcmp("fpgm", tab, 4))
- pos[j][2] = start, len[j][2] = length;
- }
+ const byte *OffsetTable;
+ uint numTables;
+
+ code = access_type42_data(font[j], 0, 12, &OffsetTable);
+ if (code < 0)
+ return code;
+ numTables = U16(OffsetTable + 4);
+ for (i = 0; i < numTables; ++i) {
+ const byte *tab;
+ ulong start;
+ uint length;
+
+ code = access_type42_data(font[j], 12 + i * 16, 16, &tab);
+ if (code < 0)
+ return code;
+ start = get_u32_msb(tab + 8);
+ length = get_u32_msb(tab + 12);
+ if (!memcmp("prep", tab, 4))
+ pos[j][0] = start, len[j][0] = length;
+ else if (!memcmp("cvt ", tab, 4))
+ pos[j][1] = start, len[j][1] = length;
+ else if (!memcmp("fpgm", tab, 4))
+ pos[j][2] = start, len[j][2] = length;
+ }
}
for (i = 0; i < 3; i++) {
- if (len[0][i] != len[1][i])
- return 0;
+ if (len[0][i] != len[1][i])
+ return 0;
}
for (i = 0; i < 3; i++) {
- if (len[0][i] != 0) {
- const byte *data0, *data1;
- ulong length = len[0][i], size0, size1, size;
- ulong pos0 = pos[0][i], pos1 = pos[1][i];
-
- while (length > 0) {
- code = access_type42_data(font0, pos0, length, &data0);
- if (code < 0)
- return code;
- size0 = (code == 0 ? length : code);
- code = access_type42_data(font1, pos1, length, &data1);
- if (code < 0)
- return code;
- size1 = (code == 0 ? length : code);
- size = min(size0, size1);
- if (memcmp(data0, data1, size))
- return 0;
- pos0 += size;
- pos1 += size;
- length -= size;
- }
- }
+ if (len[0][i] != 0) {
+ const byte *data0, *data1;
+ ulong length = len[0][i], size0, size1, size;
+ ulong pos0 = pos[0][i], pos1 = pos[1][i];
+
+ while (length > 0) {
+ code = access_type42_data(font0, pos0, length, &data0);
+ if (code < 0)
+ return code;
+ size0 = (code == 0 ? length : code);
+ code = access_type42_data(font1, pos1, length, &data1);
+ if (code < 0)
+ return code;
+ size1 = (code == 0 ? length : code);
+ size = min(size0, size1);
+ if (memcmp(data0, data1, size))
+ return 0;
+ pos0 += size;
+ pos1 += size;
+ length -= size;
+ }
+ }
}
return 1;
}
@@ -1527,16 +1526,16 @@ static int
copy_font_cid_common(gs_font *font, gs_font *copied, gs_font_cid_data *pcdata)
{
return (copy_string(copied->memory, &pcdata->CIDSystemInfo.Registry,
- "Registry") |
- copy_string(copied->memory, &pcdata->CIDSystemInfo.Ordering,
- "Ordering"));
+ "Registry") |
+ copy_string(copied->memory, &pcdata->CIDSystemInfo.Ordering,
+ "Ordering"));
}
/* ------ CIDFontType 0 ------ */
static int
copied_cid0_glyph_data(gs_font_base *font, gs_glyph glyph,
- gs_glyph_data_t *pgd, int *pfidx)
+ gs_glyph_data_t *pgd, int *pfidx)
{
gs_font_cid0 *fcid0 = (gs_font_cid0 *)font;
gs_copied_font_data_t *const cfdata = cf_data((gs_font *)font);
@@ -1546,27 +1545,27 @@ copied_cid0_glyph_data(gs_font_base *font, gs_glyph glyph,
int i;
if (pfidx)
- *pfidx = 0;
+ *pfidx = 0;
if (code < 0) {
- if (pgd)
- gs_glyph_data_from_null(pgd);
- return_error(gs_error_undefined);
+ if (pgd)
+ gs_glyph_data_from_null(pgd);
+ return_error(gs_error_undefined);
}
if (pfidx)
- for (i = 0; i < fdbytes; ++i)
- *pfidx = (*pfidx << 8) + pcg->gdata.data[i];
+ for (i = 0; i < fdbytes; ++i)
+ *pfidx = (*pfidx << 8) + pcg->gdata.data[i];
if (pgd)
- gs_glyph_data_from_string(pgd, pcg->gdata.data + fdbytes,
- pcg->gdata.size - fdbytes, NULL);
+ gs_glyph_data_from_string(pgd, pcg->gdata.data + fdbytes,
+ pcg->gdata.size - fdbytes, NULL);
return 0;
}
static int
copied_sub_type1_glyph_data(gs_font_type1 * pfont, gs_glyph glyph,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
return
copied_cid0_glyph_data((gs_font_base *)cf_data((gs_font *)pfont)->parent,
- glyph, pgd, NULL);
+ glyph, pgd, NULL);
}
static int
@@ -1574,63 +1573,63 @@ cid0_subfont(gs_font *copied, gs_glyph glyph, gs_font_type1 **pfont1)
{
int fidx;
int code = copied_cid0_glyph_data((gs_font_base *)copied, glyph, NULL,
- &fidx);
+ &fidx);
if (code >= 0) {
- gs_font_cid0 *font0 = (gs_font_cid0 *)copied;
+ gs_font_cid0 *font0 = (gs_font_cid0 *)copied;
- if (fidx >= font0->cidata.FDArray_size)
- return_error(gs_error_unregistered); /* Must not happen. */
- *pfont1 = font0->cidata.FDArray[fidx];
+ if (fidx >= font0->cidata.FDArray_size)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ *pfont1 = font0->cidata.FDArray[fidx];
}
return code;
}
static int
copied_cid0_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
gs_font_type1 *subfont1;
int code = cid0_subfont(font, glyph, &subfont1);
if (code < 0)
- return code;
+ return code;
if (members & GLYPH_INFO_WIDTH1) {
- /* Hack : There is no way to pass WMode from font to glyph_info,
- * and usually CID font has no metrics for WMode 1.
- * Therefore we use FontBBox as default size.
- * Warning : this incompletely implements the request :
- * other requested members are not retrieved.
- */
- gs_font_info_t finfo;
- int code = subfont1->procs.font_info(font, NULL, FONT_INFO_BBOX, &finfo);
-
- if (code < 0)
- return code;
- info->width[0].x = 0;
- info->width[0].y = 0;
- info->width[1].x = 0;
- info->width[1].y = -finfo.BBox.q.x; /* Sic! */
- info->v.x = finfo.BBox.q.x / 2;
- info->v.y = finfo.BBox.q.y;
- info->members = GLYPH_INFO_WIDTH1;
- return 0;
+ /* Hack : There is no way to pass WMode from font to glyph_info,
+ * and usually CID font has no metrics for WMode 1.
+ * Therefore we use FontBBox as default size.
+ * Warning : this incompletely implements the request :
+ * other requested members are not retrieved.
+ */
+ gs_font_info_t finfo;
+ int code = subfont1->procs.font_info(font, NULL, FONT_INFO_BBOX, &finfo);
+
+ if (code < 0)
+ return code;
+ info->width[0].x = 0;
+ info->width[0].y = 0;
+ info->width[1].x = 0;
+ info->width[1].y = -finfo.BBox.q.x; /* Sic! */
+ info->v.x = finfo.BBox.q.x / 2;
+ info->v.y = finfo.BBox.q.y;
+ info->members = GLYPH_INFO_WIDTH1;
+ return 0;
}
return subfont1->procs.glyph_info((gs_font *)subfont1, glyph, pmat,
- members, info);
+ members, info);
}
static int
copied_cid0_glyph_outline(gs_font *font, int WMode, gs_glyph glyph,
- const gs_matrix *pmat, gx_path *ppath, double sbw[4])
+ const gs_matrix *pmat, gx_path *ppath, double sbw[4])
{
gs_font_type1 *subfont1;
int code = cid0_subfont(font, glyph, &subfont1);
if (code < 0)
- return code;
+ return code;
return subfont1->procs.glyph_outline((gs_font *)subfont1, WMode, glyph, pmat,
- ppath, sbw);
+ ppath, sbw);
}
static int
@@ -1639,66 +1638,66 @@ copy_font_cid0(gs_font *font, gs_font *copied)
gs_font_cid0 *copied0 = (gs_font_cid0 *)copied;
gs_copied_font_data_t *const cfdata = cf_data(copied);
gs_font_type1 **FDArray =
- gs_alloc_struct_array(copied->memory, copied0->cidata.FDArray_size,
- gs_font_type1 *,
- &st_gs_font_type1_ptr_element, "FDArray");
+ gs_alloc_struct_array(copied->memory, copied0->cidata.FDArray_size,
+ gs_font_type1 *,
+ &st_gs_font_type1_ptr_element, "FDArray");
int i = 0, code;
if (FDArray == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = copy_font_cid_common(font, copied, &copied0->cidata.common);
if (code < 0)
- goto fail;
+ goto fail;
for (; i < copied0->cidata.FDArray_size; ++i) {
- gs_font *subfont = (gs_font *)copied0->cidata.FDArray[i];
- gs_font_type1 *subfont1 = (gs_font_type1 *)subfont;
- gs_font *subcopy;
- gs_font_type1 *subcopy1;
- gs_copied_font_data_t *subdata;
-
- if (i == 0) {
- /* copy_subrs requires a Type 1 font, even for GSubrs. */
- code = copy_subrs(subfont1, true, &cfdata->global_subrs,
- copied->memory);
- if (code < 0)
- goto fail;
- }
- code = gs_copy_font(subfont, &subfont->FontMatrix, copied->memory, &subcopy, -1);
- if (code < 0)
- goto fail;
- subcopy1 = (gs_font_type1 *)subcopy;
- subcopy1->data.parent = NULL;
- subdata = cf_data(subcopy);
- subdata->parent = copied0;
- gs_free_object(copied->memory, subdata->Encoding,
- "copy_font_cid0(Encoding)");
- subdata->Encoding = 0;
- /*
- * Share the glyph data and global_subrs with the parent. This
- * allows copied_type1_glyph_data in the subfont to do the right
- * thing.
- */
- gs_free_object(copied->memory, subdata->names,
- "copy_font_cid0(subfont names)");
- gs_free_object(copied->memory, subdata->glyphs,
- "copy_font_cid0(subfont glyphs)");
- subcopy1->data.procs.glyph_data = copied_sub_type1_glyph_data;
- subdata->glyphs = cfdata->glyphs;
- subdata->glyphs_size = cfdata->glyphs_size;
- subdata->names = 0;
- subdata->global_subrs = cfdata->global_subrs;
- FDArray[i] = subcopy1;
+ gs_font *subfont = (gs_font *)copied0->cidata.FDArray[i];
+ gs_font_type1 *subfont1 = (gs_font_type1 *)subfont;
+ gs_font *subcopy;
+ gs_font_type1 *subcopy1;
+ gs_copied_font_data_t *subdata;
+
+ if (i == 0) {
+ /* copy_subrs requires a Type 1 font, even for GSubrs. */
+ code = copy_subrs(subfont1, true, &cfdata->global_subrs,
+ copied->memory);
+ if (code < 0)
+ goto fail;
+ }
+ code = gs_copy_font(subfont, &subfont->FontMatrix, copied->memory, &subcopy, -1);
+ if (code < 0)
+ goto fail;
+ subcopy1 = (gs_font_type1 *)subcopy;
+ subcopy1->data.parent = NULL;
+ subdata = cf_data(subcopy);
+ subdata->parent = copied0;
+ gs_free_object(copied->memory, subdata->Encoding,
+ "copy_font_cid0(Encoding)");
+ subdata->Encoding = 0;
+ /*
+ * Share the glyph data and global_subrs with the parent. This
+ * allows copied_type1_glyph_data in the subfont to do the right
+ * thing.
+ */
+ gs_free_object(copied->memory, subdata->names,
+ "copy_font_cid0(subfont names)");
+ gs_free_object(copied->memory, subdata->glyphs,
+ "copy_font_cid0(subfont glyphs)");
+ subcopy1->data.procs.glyph_data = copied_sub_type1_glyph_data;
+ subdata->glyphs = cfdata->glyphs;
+ subdata->glyphs_size = cfdata->glyphs_size;
+ subdata->names = 0;
+ subdata->global_subrs = cfdata->global_subrs;
+ FDArray[i] = subcopy1;
}
cfdata->notdef = GS_MIN_CID_GLYPH;
copied0->cidata.FDArray = FDArray;
copied0->cidata.FDBytes =
- (copied0->cidata.FDArray_size <= 1 ? 0 :
- copied0->cidata.FDArray_size <= 256 ? 1 : 2);
+ (copied0->cidata.FDArray_size <= 1 ? 0 :
+ copied0->cidata.FDArray_size <= 256 ? 1 : 2);
copied0->cidata.glyph_data = copied_cid0_glyph_data;
return 0;
fail:
while (--i >= 0)
- gs_free_object(copied->memory, FDArray[i], "copy_font_cid0(subfont)");
+ gs_free_object(copied->memory, FDArray[i], "copy_font_cid0(subfont)");
gs_free_object(copied->memory, FDArray, "FDArray");
return code;
}
@@ -1717,13 +1716,13 @@ copy_glyph_cid0(gs_font *font, gs_glyph glyph, gs_font *copied, int options)
gdata.memory = font->memory;
code = fcid0->cidata.glyph_data((gs_font_base *)font, glyph,
- &gdata, &fidx);
+ &gdata, &fidx);
if (code < 0)
- return code;
+ return code;
for (i = fdbytes - 1; i >= 0; --i, fidx >>= 8)
- prefix[i] = (byte)fidx;
+ prefix[i] = (byte)fidx;
if (fidx != 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return copy_glyph_data(font, glyph, copied, options, &gdata, prefix, fdbytes);
}
@@ -1739,13 +1738,13 @@ same_cid0_hinting(const gs_font_cid0 *cfont, const gs_font_cid0 *ofont)
int i;
if (cfont->cidata.FDArray_size != ofont->cidata.FDArray_size)
- return 0;
+ return 0;
for (i = 0; i < cfont->cidata.FDArray_size; i++) {
- gs_font_type1 *subfont0 = cfont->cidata.FDArray[i];
- gs_font_type1 *subfont1 = ofont->cidata.FDArray[i];
- if (!same_type1_hinting(subfont0, subfont1))
- return 0;
+ gs_font_type1 *subfont0 = cfont->cidata.FDArray[i];
+ gs_font_type1 *subfont1 = ofont->cidata.FDArray[i];
+ if (!same_type1_hinting(subfont0, subfont1))
+ return 0;
}
return 1;
}
@@ -1760,9 +1759,9 @@ copied_cid2_CIDMap_proc(gs_font_cid2 *fcid2, gs_glyph glyph)
const ushort *CIDMap = cfdata->CIDMap;
if (glyph < GS_MIN_CID_GLYPH || cid >= fcid2->cidata.common.CIDCount)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (CIDMap[cid] == 0xffff)
- return -1;
+ return -1;
return CIDMap[cid];
}
@@ -1772,7 +1771,7 @@ copied_cid2_get_glyph_index(gs_font_type42 *font, gs_glyph glyph)
int glyph_index = copied_cid2_CIDMap_proc((gs_font_cid2 *)font, glyph);
if (glyph_index < 0)
- return GS_NO_GLYPH;
+ return GS_NO_GLYPH;
return glyph_index;
}
@@ -1786,17 +1785,17 @@ copy_font_cid2(gs_font *font, gs_font *copied)
int code;
int CIDCount = copied2->cidata.common.CIDCount;
ushort *CIDMap = (ushort *)
- gs_alloc_byte_array(copied->memory, CIDCount, sizeof(ushort),
- "copy_font_cid2(CIDMap");
+ gs_alloc_byte_array(copied->memory, CIDCount, sizeof(ushort),
+ "copy_font_cid2(CIDMap");
if (CIDMap == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = copy_font_cid_common(font, copied, &copied2->cidata.common);
if (code < 0 ||
- (code = copy_font_type42(font, copied)) < 0
- ) {
- gs_free_object(copied->memory, CIDMap, "copy_font_cid2(CIDMap");
- return code;
+ (code = copy_font_type42(font, copied)) < 0
+ ) {
+ gs_free_object(copied->memory, CIDMap, "copy_font_cid2(CIDMap");
+ return code;
}
cfdata->notdef = GS_MIN_CID_GLYPH;
memset(CIDMap, 0xff, CIDCount * sizeof(*CIDMap));
@@ -1804,18 +1803,18 @@ copy_font_cid2(gs_font *font, gs_font *copied)
copied2->cidata.MetricsCount = 0;
copied2->cidata.CIDMap_proc = copied_cid2_CIDMap_proc;
{
- gs_font_type42 *const copied42 = (gs_font_type42 *)copied;
-
- copied42->data.get_glyph_index = copied_cid2_get_glyph_index;
+ gs_font_type42 *const copied42 = (gs_font_type42 *)copied;
+
+ copied42->data.get_glyph_index = copied_cid2_get_glyph_index;
}
if (copied2->subst_CID_on_WMode) {
- gs_subst_CID_on_WMode_t *subst = NULL;
+ gs_subst_CID_on_WMode_t *subst = NULL;
- rc_alloc_struct_1(subst, gs_subst_CID_on_WMode_t, &st_subst_CID_on_WMode,
- copied2->memory, return_error(gs_error_VMerror), "copy_font_cid2");
- subst->data[0] = subst->data[1] = 0;
- copied2->subst_CID_on_WMode = subst;
- rc_increment(subst);
+ rc_alloc_struct_1(subst, gs_subst_CID_on_WMode_t, &st_subst_CID_on_WMode,
+ copied2->memory, return_error(gs_error_VMerror), "copy_font_cid2");
+ subst->data[0] = subst->data[1] = 0;
+ copied2->subst_CID_on_WMode = subst;
+ rc_increment(subst);
}
return 0;
@@ -1827,15 +1826,15 @@ static int expand_CIDMap(gs_font_cid2 *copied2, uint CIDCount)
gs_copied_font_data_t *const cfdata = cf_data((gs_font *)copied2);
if (CIDCount <= copied2->cidata.common.CIDCount)
- return 0;
+ return 0;
CIDMap = (ushort *)
- gs_alloc_byte_array(copied2->memory, CIDCount, sizeof(ushort),
- "copy_font_cid2(CIDMap");
+ gs_alloc_byte_array(copied2->memory, CIDCount, sizeof(ushort),
+ "copy_font_cid2(CIDMap");
if (CIDMap == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(CIDMap, cfdata->CIDMap, copied2->cidata.common.CIDCount * sizeof(*CIDMap));
- memset(CIDMap + copied2->cidata.common.CIDCount, 0xFF,
- (CIDCount - copied2->cidata.common.CIDCount) * sizeof(*CIDMap));
+ memset(CIDMap + copied2->cidata.common.CIDCount, 0xFF,
+ (CIDCount - copied2->cidata.common.CIDCount) * sizeof(*CIDMap));
cfdata->CIDMap = CIDMap;
copied2->cidata.common.CIDCount = CIDCount;
return 0;
@@ -1851,31 +1850,31 @@ copy_glyph_cid2(gs_font *font, gs_glyph glyph, gs_font *copied, int options)
int code;
if (!(options & COPY_GLYPH_BY_INDEX)) {
- uint cid = glyph - GS_MIN_CID_GLYPH;
- int CIDCount;
+ uint cid = glyph - GS_MIN_CID_GLYPH;
+ int CIDCount;
- code = expand_CIDMap(copied2, cid + 1);
- if (code < 0)
- return code;
- CIDCount = copied2->cidata.common.CIDCount;
+ code = expand_CIDMap(copied2, cid + 1);
+ if (code < 0)
+ return code;
+ CIDCount = copied2->cidata.common.CIDCount;
gid = fcid2->cidata.CIDMap_proc(fcid2, glyph);
- if (gid < 0 || gid >= cfdata->glyphs_size)
- return_error(gs_error_rangecheck);
- if (cid > CIDCount)
- return_error(gs_error_invalidaccess);
- if (cfdata->CIDMap[cid] != 0xffff && cfdata->CIDMap[cid] != gid)
- return_error(gs_error_invalidaccess);
- code = copy_glyph_type42(font, glyph, copied, options);
- if (code < 0)
- return code;
+ if (gid < 0 || gid >= cfdata->glyphs_size)
+ return_error(gs_error_rangecheck);
+ if (cid > CIDCount)
+ return_error(gs_error_invalidaccess);
+ if (cfdata->CIDMap[cid] != 0xffff && cfdata->CIDMap[cid] != gid)
+ return_error(gs_error_invalidaccess);
+ code = copy_glyph_type42(font, glyph, copied, options);
+ if (code < 0)
+ return code;
cfdata->CIDMap[cid] = gid;
} else {
- gid = glyph - GS_MIN_GLYPH_INDEX;
- if (gid < 0 || gid >= cfdata->glyphs_size)
- return_error(gs_error_rangecheck);
- code = copy_glyph_type42(font, glyph, copied, options);
- if (code < 0)
- return code;
+ gid = glyph - GS_MIN_GLYPH_INDEX;
+ if (gid < 0 || gid >= cfdata->glyphs_size)
+ return_error(gs_error_rangecheck);
+ code = copy_glyph_type42(font, glyph, copied, options);
+ if (code < 0)
+ return code;
}
return code;
}
@@ -1917,13 +1916,13 @@ static const gs_font_procs copied_font_procs = {
#if GLYPHS_SIZE_IS_PRIME
static const int some_primes[] = {
- /* Arbitrary choosen prime numbers, being reasonable for a Type 1|2 font size.
+ /* Arbitrary choosen prime numbers, being reasonable for a Type 1|2 font size.
We start with 257 to fit 256 glyphs and .notdef .
Smaller numbers aren't useful, because we don't know whether a font
will add more glyphs incrementally when we allocate its stable copy.
*/
- 257, 359, 521, 769, 1031, 2053,
- 3079, 4099, 5101, 6101, 7109, 8209, 10007, 12007, 14009,
+ 257, 359, 521, 769, 1031, 2053,
+ 3079, 4099, 5101, 6101, 7109, 8209, 10007, 12007, 14009,
16411, 20107, 26501, 32771, 48857, 65537, 85229, 127837};
#endif
@@ -1951,69 +1950,69 @@ gs_copy_font(gs_font *font, const gs_matrix *orig_matrix, gs_memory_t *mem, gs_f
*/
switch (font->FontType) {
case ft_TrueType:
- procs = &copied_procs_type42;
- glyphs_size = ((gs_font_type42 *)font)->data.trueNumGlyphs;
- have_names = true;
- break;
+ procs = &copied_procs_type42;
+ glyphs_size = ((gs_font_type42 *)font)->data.trueNumGlyphs;
+ have_names = true;
+ break;
case ft_encrypted:
case ft_encrypted2:
- procs = &copied_procs_type1;
- /* Count the glyphs. */
- glyphs_size = 0;
- {
- int index = 0;
- gs_glyph glyph;
-
- while (font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME,
- &glyph), index != 0)
- ++glyphs_size;
- }
- if(glyphs_size > max_reserved_glyphs && max_reserved_glyphs != -1)
- glyphs_size = max_reserved_glyphs;
+ procs = &copied_procs_type1;
+ /* Count the glyphs. */
+ glyphs_size = 0;
+ {
+ int index = 0;
+ gs_glyph glyph;
+
+ while (font->procs.enumerate_glyph(font, &index, GLYPH_SPACE_NAME,
+ &glyph), index != 0)
+ ++glyphs_size;
+ }
+ if(glyphs_size > max_reserved_glyphs && max_reserved_glyphs != -1)
+ glyphs_size = max_reserved_glyphs;
#if GLYPHS_SIZE_IS_PRIME
- if (glyphs_size < 257)
- glyphs_size = 257;
- /*
- * Make glyphs_size a prime number to ensure termination of the loop in
- * named_glyphs_slot_hashed, q.v.
- * Also reserve additional slots for the case of font merging and
- * for possible font increments.
- */
- glyphs_size = glyphs_size * 3 / 2;
-
- { int i;
- for (i = 0; i < count_of(some_primes); i++)
- if (glyphs_size <= some_primes[i])
- break;
- if (i >= count_of(some_primes))
- return_error(gs_error_rangecheck);
- glyphs_size = some_primes[i];
- }
+ if (glyphs_size < 257)
+ glyphs_size = 257;
+ /*
+ * Make glyphs_size a prime number to ensure termination of the loop in
+ * named_glyphs_slot_hashed, q.v.
+ * Also reserve additional slots for the case of font merging and
+ * for possible font increments.
+ */
+ glyphs_size = glyphs_size * 3 / 2;
+
+ { int i;
+ for (i = 0; i < count_of(some_primes); i++)
+ if (glyphs_size <= some_primes[i])
+ break;
+ if (i >= count_of(some_primes))
+ return_error(gs_error_rangecheck);
+ glyphs_size = some_primes[i];
+ }
#else
- /*
- * Make names_size a power of 2 to ensure termination of the loop in
- * named_glyphs_slot_hashed, q.v.
- */
- glyphs_size = glyphs_size * 3 / 2;
- while (glyphs_size & (glyphs_size - 1))
- glyphs_size = (glyphs_size | (glyphs_size - 1)) + 1;
- if (glyphs_size < 256) /* probably incremental font */
- glyphs_size = 256;
+ /*
+ * Make names_size a power of 2 to ensure termination of the loop in
+ * named_glyphs_slot_hashed, q.v.
+ */
+ glyphs_size = glyphs_size * 3 / 2;
+ while (glyphs_size & (glyphs_size - 1))
+ glyphs_size = (glyphs_size | (glyphs_size - 1)) + 1;
+ if (glyphs_size < 256) /* probably incremental font */
+ glyphs_size = 256;
#endif
- have_names = true;
- break;
+ have_names = true;
+ break;
case ft_CID_encrypted:
- procs = &copied_procs_cid0;
- glyphs_size = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
- break;
+ procs = &copied_procs_cid0;
+ glyphs_size = ((gs_font_cid0 *)font)->cidata.common.CIDCount;
+ break;
case ft_CID_TrueType:
- procs = &copied_procs_cid2;
- /* Glyphs are indexed by GID, not by CID. */
- glyphs_size = ((gs_font_cid2 *)font)->data.trueNumGlyphs;
- break;
+ procs = &copied_procs_cid2;
+ /* Glyphs are indexed by GID, not by CID. */
+ glyphs_size = ((gs_font_cid2 *)font)->data.trueNumGlyphs;
+ break;
default:
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
}
/* Get the font_info for copying. */
@@ -2022,46 +2021,46 @@ gs_copy_font(gs_font *font, const gs_matrix *orig_matrix, gs_memory_t *mem, gs_f
info.Flags_requested = ~0;
code = font->procs.font_info(font, NULL, ~0, &info);
- /* We can ignore a lack of FontInfo for TrueType fonts which
+ /* We can ignore a lack of FontInfo for TrueType fonts which
* are descendants of CID fonts
*/
if (code < 0 && !(font->FontType == ft_CID_TrueType))
- return code;
+ return code;
/* Allocate the generic copied information. */
glyphs = gs_alloc_struct_array(mem, glyphs_size, gs_copied_glyph_t,
- &st_gs_copied_glyph_element,
- "gs_copy_font(glyphs)");
+ &st_gs_copied_glyph_element,
+ "gs_copy_font(glyphs)");
if (have_names != 0)
- names = gs_alloc_struct_array(mem, glyphs_size, gs_copied_glyph_name_t,
- &st_gs_copied_glyph_name_element,
- "gs_copy_font(names)");
+ names = gs_alloc_struct_array(mem, glyphs_size, gs_copied_glyph_name_t,
+ &st_gs_copied_glyph_name_element,
+ "gs_copy_font(names)");
copied = gs_alloc_struct(mem, gs_font, fstype,
- "gs_copy_font(copied font)");
+ "gs_copy_font(copied font)");
cfdata = gs_alloc_struct(mem, gs_copied_font_data_t,
- &st_gs_copied_font_data,
- "gs_copy_font(wrapper data)");
+ &st_gs_copied_font_data,
+ "gs_copy_font(wrapper data)");
if (cfdata)
- memset(cfdata, 0, sizeof(*cfdata));
+ memset(cfdata, 0, sizeof(*cfdata));
if (glyphs == 0 || (names == 0 && have_names) || copied == 0 ||
- cfdata == 0
- ) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ cfdata == 0
+ ) {
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
cfdata->info = info;
cfdata->dir = font->dir;
if ((code = (copy_string(mem, &cfdata->info.Copyright,
- "gs_copy_font(Copyright)") |
- copy_string(mem, &cfdata->info.Notice,
- "gs_copy_font(Notice)") |
- copy_string(mem, &cfdata->info.FamilyName,
- "gs_copy_font(FamilyName)") |
- copy_string(mem, &cfdata->info.FullName,
- "gs_copy_font(FullName)"))) < 0
- )
- goto fail;
+ "gs_copy_font(Copyright)") |
+ copy_string(mem, &cfdata->info.Notice,
+ "gs_copy_font(Notice)") |
+ copy_string(mem, &cfdata->info.FamilyName,
+ "gs_copy_font(FamilyName)") |
+ copy_string(mem, &cfdata->info.FullName,
+ "gs_copy_font(FullName)"))) < 0
+ )
+ goto fail;
/* Initialize the copied font. */
@@ -2078,14 +2077,14 @@ gs_copy_font(gs_font *font, const gs_matrix *orig_matrix, gs_memory_t *mem, gs_f
copied->procs.glyph_info = procs->glyph_info;
copied->procs.glyph_outline = procs->glyph_outline;
{
- gs_font_base *bfont = (gs_font_base *)copied;
-
- bfont->FAPI = 0;
- bfont->FAPI_font_data = 0;
- bfont->encoding_index = ENCODING_INDEX_UNKNOWN;
- code = uid_copy(&bfont->UID, mem, "gs_copy_font(UID)");
- if (code < 0)
- goto fail;
+ gs_font_base *bfont = (gs_font_base *)copied;
+
+ bfont->FAPI = 0;
+ bfont->FAPI_font_data = 0;
+ bfont->encoding_index = ENCODING_INDEX_UNKNOWN;
+ code = uid_copy(&bfont->UID, mem, "gs_copy_font(UID)");
+ if (code < 0)
+ goto fail;
}
cfdata->procs = procs;
@@ -2095,38 +2094,38 @@ gs_copy_font(gs_font *font, const gs_matrix *orig_matrix, gs_memory_t *mem, gs_f
cfdata->num_glyphs = 0;
cfdata->ordered = false;
if (names)
- memset(names, 0, glyphs_size * sizeof(*names));
+ memset(names, 0, glyphs_size * sizeof(*names));
cfdata->names = names;
if (names != 0) {
- uint i;
+ uint i;
- for (i = 0; i < glyphs_size; ++i)
- names[i].glyph = GS_NO_GLYPH;
+ for (i = 0; i < glyphs_size; ++i)
+ names[i].glyph = GS_NO_GLYPH;
}
/* Do FontType-specific initialization. */
code = procs->finish_copy_font(font, copied);
if (code < 0)
- goto fail;
+ goto fail;
*pfont_new = copied;
if (cfdata->notdef != GS_NO_GLYPH)
- code = gs_copy_glyph(font, cfdata->notdef, copied);
+ code = gs_copy_glyph(font, cfdata->notdef, copied);
return code;
fail:
/* Free storage and exit. */
if (cfdata) {
- uncopy_string(mem, &cfdata->info.FullName,
- "gs_copy_font(FullName)");
- uncopy_string(mem, &cfdata->info.FamilyName,
- "gs_copy_font(FamilyName)");
- uncopy_string(mem, &cfdata->info.Notice,
- "gs_copy_font(Notice)");
- uncopy_string(mem, &cfdata->info.Copyright,
- "gs_copy_font(Copyright)");
- gs_free_object(mem, cfdata, "gs_copy_font(wrapper data)");
+ uncopy_string(mem, &cfdata->info.FullName,
+ "gs_copy_font(FullName)");
+ uncopy_string(mem, &cfdata->info.FamilyName,
+ "gs_copy_font(FamilyName)");
+ uncopy_string(mem, &cfdata->info.Notice,
+ "gs_copy_font(Notice)");
+ uncopy_string(mem, &cfdata->info.Copyright,
+ "gs_copy_font(Copyright)");
+ gs_free_object(mem, cfdata, "gs_copy_font(wrapper data)");
}
gs_free_object(mem, copied, "gs_copy_font(copied font)");
gs_free_object(mem, names, "gs_copy_font(names)");
@@ -2144,7 +2143,7 @@ gs_copy_glyph(gs_font *font, gs_glyph glyph, gs_font *copied)
}
int
gs_copy_glyph_options(gs_font *font, gs_glyph glyph, gs_font *copied,
- int options)
+ int options)
{
int code;
#define MAX_GLYPH_PIECES 64 /* arbitrary, but 32 is too small - bug 687698. */
@@ -2152,58 +2151,58 @@ gs_copy_glyph_options(gs_font *font, gs_glyph glyph, gs_font *copied,
uint count = 1, i;
if (copied->procs.font_info != copied_font_info)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
code = cf_data(copied)->procs->copy_glyph(font, glyph, copied, options);
if (code != 0)
- return code;
+ return code;
/* Copy any sub-glyphs. */
glyphs[0] = glyph;
code = psf_add_subset_pieces(glyphs, &count, MAX_GLYPH_PIECES, MAX_GLYPH_PIECES,
- font);
+ font);
if (code < 0)
- return code;
+ return code;
if (count > MAX_GLYPH_PIECES)
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
for (i = 1; i < count; ++i) {
- code = gs_copy_glyph_options(font, glyphs[i], copied,
- (options & ~COPY_GLYPH_NO_OLD) | COPY_GLYPH_BY_INDEX);
- if (code < 0)
- return code;
+ code = gs_copy_glyph_options(font, glyphs[i], copied,
+ (options & ~COPY_GLYPH_NO_OLD) | COPY_GLYPH_BY_INDEX);
+ if (code < 0)
+ return code;
}
/*
* Because 'seac' accesses the Encoding of the font as well as the
* glyphs, we have to copy the Encoding entries as well.
*/
if (count == 1)
- return 0;
+ return 0;
switch (font->FontType) {
case ft_encrypted:
case ft_encrypted2:
- break;
+ break;
default:
- return 0;
+ return 0;
}
-#if 0 /* No need to add subglyphs to the Encoding because they always are
- taken from StandardEncoding (See the Type 1 spec about 'seac').
- Attempt to add them to the encoding can cause a conflict,
- if the encoding specifies different glyphs for these char codes
- (See the bug #687172). */
+#if 0 /* No need to add subglyphs to the Encoding because they always are
+ taken from StandardEncoding (See the Type 1 spec about 'seac').
+ Attempt to add them to the encoding can cause a conflict,
+ if the encoding specifies different glyphs for these char codes
+ (See the bug #687172). */
{
- gs_copied_glyph_t *pcg;
- gs_glyph_data_t gdata;
- gs_char chars[2];
-
- gdata.memory = font->memory;
- /* Since we just copied the glyph, copied_glyph_slot can't fail. */
- DISCARD(copied_glyph_slot(cf_data(copied), glyph, &pcg));
- gs_glyph_data_from_string(&gdata, pcg->gdata.data, pcg->gdata.size,
- NULL);
- code = gs_type1_piece_codes((gs_font_type1 *)font, &gdata, chars);
- if (code <= 0 || /* 0 is not possible here */
- (code = gs_copied_font_add_encoding(copied, chars[0], glyphs[1])) < 0 ||
- (code = gs_copied_font_add_encoding(copied, chars[1], glyphs[2])) < 0
- )
- return code;
+ gs_copied_glyph_t *pcg;
+ gs_glyph_data_t gdata;
+ gs_char chars[2];
+
+ gdata.memory = font->memory;
+ /* Since we just copied the glyph, copied_glyph_slot can't fail. */
+ DISCARD(copied_glyph_slot(cf_data(copied), glyph, &pcg));
+ gs_glyph_data_from_string(&gdata, pcg->gdata.data, pcg->gdata.size,
+ NULL);
+ code = gs_type1_piece_codes((gs_font_type1 *)font, &gdata, chars);
+ if (code <= 0 || /* 0 is not possible here */
+ (code = gs_copied_font_add_encoding(copied, chars[0], glyphs[1])) < 0 ||
+ (code = gs_copied_font_add_encoding(copied, chars[1], glyphs[2])) < 0
+ )
+ return code;
}
#endif
return 0;
@@ -2220,7 +2219,7 @@ gs_copied_font_add_encoding(gs_font *copied, gs_char chr, gs_glyph glyph)
gs_copied_font_data_t *const cfdata = cf_data(copied);
if (copied->procs.font_info != copied_font_info)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return cfdata->procs->add_encoding(copied, chr, glyph);
}
@@ -2245,172 +2244,172 @@ gs_copy_font_complete(gs_font *font, gs_font *copied)
* then copy again by GID, to cover glyphs that don't have names.
*/
for (;;) {
- for (index = 0;
- code >= 0 &&
- (font->procs.enumerate_glyph(font, &index, space, &glyph),
- index != 0);
- ) {
- if (font->FontType == ft_TrueType &&
- glyph >= GS_MIN_CID_GLYPH && glyph < GS_MIN_GLYPH_INDEX)
- return_error(gs_error_invalidfont); /* bug 688370. */
- code = gs_copy_glyph(font, glyph, copied);
- }
- /* For Type 42 fonts, if we copied by name, now copy again by index. */
- if (space == GLYPH_SPACE_NAME && font->FontType == ft_TrueType)
- space = GLYPH_SPACE_INDEX;
- else
- break;
+ for (index = 0;
+ code >= 0 &&
+ (font->procs.enumerate_glyph(font, &index, space, &glyph),
+ index != 0);
+ ) {
+ if (font->FontType == ft_TrueType &&
+ glyph >= GS_MIN_CID_GLYPH && glyph < GS_MIN_GLYPH_INDEX)
+ return_error(gs_error_invalidfont); /* bug 688370. */
+ code = gs_copy_glyph(font, glyph, copied);
+ }
+ /* For Type 42 fonts, if we copied by name, now copy again by index. */
+ if (space == GLYPH_SPACE_NAME && font->FontType == ft_TrueType)
+ space = GLYPH_SPACE_INDEX;
+ else
+ break;
}
if (cf_data(copied)->Encoding != 0)
- for (index = 0; code >= 0 && index < 256; ++index) {
- glyph = font->procs.encode_char(font, (gs_char)index,
- GLYPH_SPACE_NAME);
- if (glyph != GS_NO_GLYPH) {
- code = gs_copied_font_add_encoding(copied, (gs_char)index,
- glyph);
- if (code == gs_error_undefined) {
- /* Skip Encoding entries, which point to undefiuned glyphs -
- happens with 033-52-5873.pdf. */
- code = 0;
- }
- if (code == gs_error_rangecheck) {
- /* Skip Encoding entries, which point to undefiuned glyphs -
- happens with 159.pdf. */
- code = 0;
- }
- }
- }
+ for (index = 0; code >= 0 && index < 256; ++index) {
+ glyph = font->procs.encode_char(font, (gs_char)index,
+ GLYPH_SPACE_NAME);
+ if (glyph != GS_NO_GLYPH) {
+ code = gs_copied_font_add_encoding(copied, (gs_char)index,
+ glyph);
+ if (code == gs_error_undefined) {
+ /* Skip Encoding entries, which point to undefiuned glyphs -
+ happens with 033-52-5873.pdf. */
+ code = 0;
+ }
+ if (code == gs_error_rangecheck) {
+ /* Skip Encoding entries, which point to undefiuned glyphs -
+ happens with 159.pdf. */
+ code = 0;
+ }
+ }
+ }
if (copied->FontType != ft_composite) {
- gs_font_base *bfont = (gs_font_base *)font;
- gs_font_base *bcopied = (gs_font_base *)copied;
+ gs_font_base *bfont = (gs_font_base *)font;
+ gs_font_base *bcopied = (gs_font_base *)copied;
- bcopied->encoding_index = bfont->encoding_index;
- bcopied->nearest_encoding_index = bfont->nearest_encoding_index;
+ bcopied->encoding_index = bfont->encoding_index;
+ bcopied->nearest_encoding_index = bfont->nearest_encoding_index;
}
return code;
}
/*
* Check whether specified glyphs can be copied from another font.
- * It means that (1) fonts have same hinting parameters and
- * (2) font subsets for the specified glyph set don't include different
- * outlines or metrics. Possible returned values :
+ * It means that (1) fonts have same hinting parameters and
+ * (2) font subsets for the specified glyph set don't include different
+ * outlines or metrics. Possible returned values :
* 0 (incompatible), 1 (compatible), < 0 (error)
*/
int
-gs_copied_can_copy_glyphs(const gs_font *cfont, const gs_font *ofont,
- gs_glyph *glyphs, int num_glyphs, int glyphs_step,
- bool check_hinting)
-{
+gs_copied_can_copy_glyphs(const gs_font *cfont, const gs_font *ofont,
+ gs_glyph *glyphs, int num_glyphs, int glyphs_step,
+ bool check_hinting)
+{
int code = 0;
if (cfont == ofont)
- return 1;
+ return 1;
if (cfont->FontType != ofont->FontType)
- return 0;
+ return 0;
if (cfont->WMode != ofont->WMode)
- return 0;
+ return 0;
if (cfont->font_name.size == 0 || ofont->font_name.size == 0) {
- if (cfont->key_name.size != ofont->key_name.size ||
- memcmp(cfont->key_name.chars, ofont->key_name.chars,
- cfont->font_name.size))
- return 0; /* Don't allow to merge random fonts. */
+ if (cfont->key_name.size != ofont->key_name.size ||
+ memcmp(cfont->key_name.chars, ofont->key_name.chars,
+ cfont->font_name.size))
+ return 0; /* Don't allow to merge random fonts. */
} else {
- if (cfont->font_name.size != ofont->font_name.size ||
- memcmp(cfont->font_name.chars, ofont->font_name.chars,
- cfont->font_name.size))
- return 0; /* Don't allow to merge random fonts. */
+ if (cfont->font_name.size != ofont->font_name.size ||
+ memcmp(cfont->font_name.chars, ofont->font_name.chars,
+ cfont->font_name.size))
+ return 0; /* Don't allow to merge random fonts. */
}
if (check_hinting) {
- switch(cfont->FontType) {
- case ft_encrypted:
- case ft_encrypted2:
- if (!same_type1_hinting((const gs_font_type1 *)cfont,
- (const gs_font_type1 *)ofont))
- return 0;
- code = 1;
- break;
- case ft_TrueType:
- code = same_type42_hinting((gs_font_type42 *)cfont,
- (gs_font_type42 *)ofont);
- break;
- case ft_CID_encrypted:
- if (!gs_is_CIDSystemInfo_compatible(
- gs_font_cid_system_info(cfont),
- gs_font_cid_system_info(ofont)))
- return 0;
- code = same_cid0_hinting((const gs_font_cid0 *)cfont,
- (const gs_font_cid0 *)ofont);
- break;
- case ft_CID_TrueType:
- if (!gs_is_CIDSystemInfo_compatible(
- gs_font_cid_system_info(cfont),
- gs_font_cid_system_info(ofont)))
- return 0;
- code = same_cid2_hinting((const gs_font_cid2 *)cfont,
- (const gs_font_cid2 *)ofont);
- break;
- default:
- return_error(gs_error_unregistered); /* Must not happen. */
- }
- if (code <= 0) /* an error or false */
- return code;
+ switch(cfont->FontType) {
+ case ft_encrypted:
+ case ft_encrypted2:
+ if (!same_type1_hinting((const gs_font_type1 *)cfont,
+ (const gs_font_type1 *)ofont))
+ return 0;
+ code = 1;
+ break;
+ case ft_TrueType:
+ code = same_type42_hinting((gs_font_type42 *)cfont,
+ (gs_font_type42 *)ofont);
+ break;
+ case ft_CID_encrypted:
+ if (!gs_is_CIDSystemInfo_compatible(
+ gs_font_cid_system_info(cfont),
+ gs_font_cid_system_info(ofont)))
+ return 0;
+ code = same_cid0_hinting((const gs_font_cid0 *)cfont,
+ (const gs_font_cid0 *)ofont);
+ break;
+ case ft_CID_TrueType:
+ if (!gs_is_CIDSystemInfo_compatible(
+ gs_font_cid_system_info(cfont),
+ gs_font_cid_system_info(ofont)))
+ return 0;
+ code = same_cid2_hinting((const gs_font_cid2 *)cfont,
+ (const gs_font_cid2 *)ofont);
+ break;
+ default:
+ return_error(gs_error_unregistered); /* Must not happen. */
+ }
+ if (code <= 0) /* an error or false */
+ return code;
}
return compare_glyphs(cfont, ofont, glyphs, num_glyphs, glyphs_step, 0);
}
-/* Extension glyphs may be added to a font to resolve
+/* Extension glyphs may be added to a font to resolve
glyph name conflicts while conwerting a PDF Widths into Metrics.
This function drops them before writing out an embedded font. */
int
copied_drop_extension_glyphs(gs_font *copied)
{
/* Note : This function drops 'used' flags for some glyphs
- and truncates glyph names. Can't use the font
- for outlining|rasterization|width after applying it.
+ and truncates glyph names. Can't use the font
+ for outlining|rasterization|width after applying it.
*/
gs_copied_font_data_t *const cfdata = cf_data(copied);
uint gsize = cfdata->glyphs_size, i;
const int sl = strlen(gx_extendeg_glyph_name_separator);
for (i = 0; i < gsize; i++) {
- gs_copied_glyph_t *pslot = &cfdata->glyphs[i];
- gs_copied_glyph_name_t *name;
- int l, j, k, i0;
-
- if (!pslot->used)
- continue;
- name = &cfdata->names[i];
- l = name->str.size - sl;
-
- for (j = 0; j < l; j ++)
- if (!memcmp(gx_extendeg_glyph_name_separator, name->str.data + j, sl))
- break;
- if (j >= l)
- continue;
- /* Found an extension name.
- Find the corresponding non-extended one. */
- i0 = i;
- for (k = 0; k < gsize; k++)
- if (cfdata->glyphs[k].used &&
- cfdata->names[k].str.size == j &&
- !memcmp(cfdata->names[k].str.data, name->str.data, j) &&
- !bytes_compare(pslot->gdata.data, pslot->gdata.size,
- cfdata->glyphs[k].gdata.data, cfdata->glyphs[k].gdata.size)) {
- i0 = k;
- break;
- }
- /* Truncate the extended glyph name. */
- cfdata->names[i0].str.size = j;
- /* Drop others with same prefix. */
- for (k = 0; k < gsize; k++)
- if (k != i0 && cfdata->glyphs[k].used &&
- cfdata->names[k].str.size >= j + sl &&
- !memcmp(cfdata->names[k].str.data, name->str.data, j) &&
- !memcmp(gx_extendeg_glyph_name_separator, name + j, sl) &&
- !bytes_compare(pslot->gdata.data, pslot->gdata.size,
- cfdata->glyphs[k].gdata.data, cfdata->glyphs[k].gdata.size))
- cfdata->glyphs[k].used = false;
+ gs_copied_glyph_t *pslot = &cfdata->glyphs[i];
+ gs_copied_glyph_name_t *name;
+ int l, j, k, i0;
+
+ if (!pslot->used)
+ continue;
+ name = &cfdata->names[i];
+ l = name->str.size - sl;
+
+ for (j = 0; j < l; j ++)
+ if (!memcmp(gx_extendeg_glyph_name_separator, name->str.data + j, sl))
+ break;
+ if (j >= l)
+ continue;
+ /* Found an extension name.
+ Find the corresponding non-extended one. */
+ i0 = i;
+ for (k = 0; k < gsize; k++)
+ if (cfdata->glyphs[k].used &&
+ cfdata->names[k].str.size == j &&
+ !memcmp(cfdata->names[k].str.data, name->str.data, j) &&
+ !bytes_compare(pslot->gdata.data, pslot->gdata.size,
+ cfdata->glyphs[k].gdata.data, cfdata->glyphs[k].gdata.size)) {
+ i0 = k;
+ break;
+ }
+ /* Truncate the extended glyph name. */
+ cfdata->names[i0].str.size = j;
+ /* Drop others with same prefix. */
+ for (k = 0; k < gsize; k++)
+ if (k != i0 && cfdata->glyphs[k].used &&
+ cfdata->names[k].str.size >= j + sl &&
+ !memcmp(cfdata->names[k].str.data, name->str.data, j) &&
+ !memcmp(gx_extendeg_glyph_name_separator, name + j, sl) &&
+ !bytes_compare(pslot->gdata.data, pslot->gdata.size,
+ cfdata->glyphs[k].gdata.data, cfdata->glyphs[k].gdata.size))
+ cfdata->glyphs[k].used = false;
}
return 0;
}
@@ -2424,28 +2423,27 @@ compare_glyph_names(const void *pg1, const void *pg2)
return bytes_compare(gn1->str.data, gn1->str.size, gn2->str.data, gn2->str.size);
}
-
/* Order font data to avoid a serialization indeterminism. */
static int
order_font_data(gs_copied_font_data_t *cfdata, gs_memory_t *memory)
{
int i, j = 0;
- gs_copied_glyph_name_t **a = (gs_copied_glyph_name_t **)gs_alloc_byte_array(memory, cfdata->num_glyphs,
- sizeof(gs_copied_glyph_name_t *), "order_font_data");
+ gs_copied_glyph_name_t **a = (gs_copied_glyph_name_t **)gs_alloc_byte_array(memory, cfdata->num_glyphs,
+ sizeof(gs_copied_glyph_name_t *), "order_font_data");
if (a == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
j = 0;
for (i = 0; i < cfdata->glyphs_size; i++) {
- if (cfdata->glyphs[i].used) {
- if (j >= cfdata->num_glyphs)
- return_error(gs_error_unregistered); /* Must not happen */
- a[j++] = &cfdata->names[i];
- }
+ if (cfdata->glyphs[i].used) {
+ if (j >= cfdata->num_glyphs)
+ return_error(gs_error_unregistered); /* Must not happen */
+ a[j++] = &cfdata->names[i];
+ }
}
qsort(a, cfdata->num_glyphs, sizeof(*a), compare_glyph_names);
for (j--; j >= 0; j--)
- cfdata->glyphs[j].order_index = a[j] - cfdata->names;
+ cfdata->glyphs[j].order_index = a[j] - cfdata->names;
gs_free_object(memory, a, "order_font_data");
return 0;
}
@@ -2456,14 +2454,14 @@ copied_order_font(gs_font *font)
{
if (font->procs.enumerate_glyph != copied_enumerate_glyph)
- return_error(gs_error_unregistered); /* Must not happen */
+ return_error(gs_error_unregistered); /* Must not happen */
if (font->FontType != ft_encrypted && font->FontType != ft_encrypted2) {
- /* Don't need to order, because it is ordered by CIDs or glyph indices. */
- return 0;
+ /* Don't need to order, because it is ordered by CIDs or glyph indices. */
+ return 0;
}
{ gs_copied_font_data_t * cfdata = cf_data(font);
- cfdata->ordered = true;
- return order_font_data(cfdata, font->memory);
+ cfdata->ordered = true;
+ return order_font_data(cfdata, font->memory);
}
}
@@ -2475,4 +2473,3 @@ copied_get_notdef(const gs_font *font)
return cfdata->notdef;
}
-
diff --git a/gs/base/gxfcopy.h b/gs/base/gxfcopy.h
index 638620f7d..c46ca65ec 100644
--- a/gs/base/gxfcopy.h
+++ b/gs/base/gxfcopy.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,13 +63,13 @@ typedef struct gs_matrix_s gs_matrix;
* rendering (glyph_outline, etc.), but it does not support make_font.
*
* max_reserved_glyphs limits the maount of space allocated for the glyph names
- * and glyph outlines of type 1 or 2 fonts. -1 reserves as many as required for
- * a full copy of the original font. This is used by pdfwrite to limit the size
+ * and glyph outlines of type 1 or 2 fonts. -1 reserves as many as required for
+ * a full copy of the original font. This is used by pdfwrite to limit the size
* of a copy when creating a subset font.
*/
-int gs_copy_font(gs_font *font, const gs_matrix *orig_matrix,
- gs_memory_t *mem, gs_font **pfont_new,
- int max_reserved_glyphs);
+int gs_copy_font(gs_font *font, const gs_matrix *orig_matrix,
+ gs_memory_t *mem, gs_font **pfont_new,
+ int max_reserved_glyphs);
/*
* Copy a glyph, including any sub-glyphs. The destination font ("copied"
@@ -123,7 +123,7 @@ int gs_copy_glyph(gs_font *font, gs_glyph glyph, gs_font *copied);
#define COPY_GLYPH_NO_NEW 2
#define COPY_GLYPH_BY_INDEX 4
int gs_copy_glyph_options(gs_font *font, gs_glyph glyph, gs_font *copied,
- int options);
+ int options);
/*
* Add an encoding entry to a copied font. If the given encoding entry is
@@ -151,28 +151,27 @@ int gs_copied_font_add_encoding(gs_font *copied, gs_char chr, gs_glyph glyph);
*/
int gs_copy_font_complete(gs_font *font, gs_font *copied);
-
/*
* Check whether specified glyphs can be copied from another font.
- * It means that (1) fonts have same hinting parameters and
- * (2) font subsets for the specified glyph set don't include different
- * outlines or metrics. Possible returned values :
+ * It means that (1) fonts have same hinting parameters and
+ * (2) font subsets for the specified glyph set don't include different
+ * outlines or metrics. Possible returned values :
* 0 (incompatible), 1 (compatible), < 0 (error)
*/
-int gs_copied_can_copy_glyphs(const gs_font *cfont, const gs_font *ofont,
- gs_glyph *glyphs, int num_glyphs, int glyphs_step,
- bool check_hinting);
+int gs_copied_can_copy_glyphs(const gs_font *cfont, const gs_font *ofont,
+ gs_glyph *glyphs, int num_glyphs, int glyphs_step,
+ bool check_hinting);
-/* Extension glyphs may be added to a font to resolve
+/* Extension glyphs may be added to a font to resolve
glyph name conflicts while conwerting a PDF Widths into Metrics.
This function drops them before writing out an embedded font. */
int copied_drop_extension_glyphs(gs_font *cfont);
-/* Order font to avoid a serialization indeterminism.
- An indeterminizm can happen due to PS name indices
+/* Order font to avoid a serialization indeterminism.
+ An indeterminizm can happen due to PS name indices
depend on memory allocation.
Must not add glyphs after calling this function.
- After calling this function, enumerate_glyph
+ After calling this function, enumerate_glyph
enumerates glyphs in the alphabetic order of glyph names.
Currently works for Type 1,2 only,
because other fonts type don't use PS name indices
diff --git a/gs/base/gxfdrop.c b/gs/base/gxfdrop.c
index 5831f3855..3d06cc235 100644
--- a/gs/base/gxfdrop.c
+++ b/gs/base/gxfdrop.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,10 +25,10 @@
#include "gxfill.h"
#include "vdtrace.h"
-#define INTERTRAP_STEM_BUG 0 /* We're not sure that 1 gives a
+#define INTERTRAP_STEM_BUG 0 /* We're not sure that 1 gives a
better painting with neighbour serifs.
- Need more testing.
- 0 is compatible to the old code. */
+ Need more testing.
+ 0 is compatible to the old code. */
/*
* Rather some margins are placed in virtual memory,
@@ -43,10 +43,10 @@ void init_section(section *sect, int i0, int i1)
for (i = i0; i < i1; i++) {
# if ADJUST_SERIF && CHECK_SPOT_CONTIGUITY
- sect[i].x0 = fixed_1;
- sect[i].x1 = 0;
+ sect[i].x0 = fixed_1;
+ sect[i].x1 = 0;
# endif
- sect[i].y0 = sect[i].y1 = -1;
+ sect[i].y0 = sect[i].y1 = -1;
}
}
@@ -54,15 +54,15 @@ static margin * alloc_margin(line_list * ll)
{ margin *m;
if (ll->free_margin_list != 0) {
- m = ll->free_margin_list;
- ll->free_margin_list = ll->free_margin_list->next;
+ m = ll->free_margin_list;
+ ll->free_margin_list = ll->free_margin_list->next;
} else if (ll->local_margin_alloc_count < MAX_LOCAL_ACTIVE) {
- m = ll->local_margins + ll->local_margin_alloc_count;
- ++ ll->local_margin_alloc_count;
+ m = ll->local_margins + ll->local_margin_alloc_count;
+ ++ ll->local_margin_alloc_count;
} else {
- m = gs_alloc_struct(ll->memory, margin, &st_margin, "filling contiguity margin");
- /* The allocation happens only if ll->local_margins[MAX_LOCAL_ACTIVE]
- is exceeded. We believe it does very seldom. */
+ m = gs_alloc_struct(ll->memory, margin, &st_margin, "filling contiguity margin");
+ /* The allocation happens only if ll->local_margins[MAX_LOCAL_ACTIVE]
+ is exceeded. We believe it does very seldom. */
}
return m;
}
@@ -71,9 +71,9 @@ static void release_margin_list(line_list * ll, margin_set *ms)
{ margin * m1 = ms->margin_list;
if (m1 == 0)
- return;
+ return;
while (m1->next != 0)
- m1 = m1->next;
+ m1 = m1->next;
m1->next = ll->free_margin_list;
ll->free_margin_list = ms->margin_list;
ms->margin_list = ms->margin_touched = 0;
@@ -84,11 +84,11 @@ void free_all_margins(line_list * ll)
ll->free_margin_list = 0;
while (m != 0) {
- margin * m1 = m->next;
+ margin * m1 = m->next;
- if (m < ll->local_margins || m >= ll->local_margins + MAX_LOCAL_ACTIVE)
- gs_free_object(ll->memory, m, "filling contiguity margin");
- m = m1;
+ if (m < ll->local_margins || m >= ll->local_margins + MAX_LOCAL_ACTIVE)
+ gs_free_object(ll->memory, m, "filling contiguity margin");
+ m = m1;
}
}
@@ -102,107 +102,107 @@ static int store_margin(line_list * ll, margin_set * set, int ii0, int ii1)
margin *m0 = set->margin_touched, *m1;
if (!ll->fo->pseudo_rasterization)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (ii0 < 0 || ii1 > ll->bbox_width)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
set->margin_touched = 0; /* safety */
/* Find contacting elements. */
if (m0 != 0) {
- margin *m_last = m0, *mb, *me;
-
- if (set->margin_list == 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- if (i1 < m0->ibeg) {
- do {
- m0 = m0->prev;
- } while (m0 != 0 && i0 <= m0->iend);
- /* m0 points to a non-contacting at left. */
- m1 = (m0 == 0 ? set->margin_list : m0)->next;
- while (m1 != 0 && m1->ibeg <= i1) {
- m_last = m1;
- m1 = m1->next;
- }
- /* m1 points to a non-contacting at right. */
- } else if (i0 > m0->iend) {
- m1 = m0;
- do {
- m_last = m1;
- m1 = m1->next;
- } while (m1 != 0 && i1 >= m1->ibeg);
- /* m0 points to a non-contacting at right. */
- m0 = (m1 == 0 ? m_last : m1->prev);
- while (m0 != 0 && m0->iend >= i0)
- m0 = m0->prev;
- /* m1 points to a non-contacting at left. */
- } else {
- m1 = m0;
- while (m1 != 0 && m1->ibeg <= i1) {
- m_last = m1;
- m1 = m1->next;
- }
- /* m1 points to a non-contacting at right. */
- while (m0 != 0 && m0->iend >= i0)
- m0 = m0->prev;
- /* m1 points to a non-contacting at left. */
- }
- /* Remove elements from m0->next to m1->prev, excluding the latter.
- m0 may be NULL if we riched list start.
- m1 may be NULL if we riched list end. */
- mb = (m0 == 0 ? set->margin_list : m0->next);
- if (mb != 0 && mb != m1) {
- me = (m1 == 0 ? m_last : m1->prev);
- /* Remove elements from mb to me, excluding the latter.
- me may be NULL if we riched list start. */
- if (me != 0) {
- if (mb != me && me->prev != 0) {
- margin *mf = me->prev;
-
- /* Remove elements from mb to mf. */
- if (mb->prev != 0)
- mb->prev->next = mf->next;
- if (mf->next != 0)
- mf->next->prev = mb->prev;
- if (set->margin_list == mb)
- set->margin_list = mf->next;
- mf->next = ll->free_margin_list;
- ll->free_margin_list = mb;
- i0 = min(i0, mb->ibeg);
- i1 = max(i1, mf->iend);
- /* 'prev' links are not used in ll->free_margin_list. */
- }
- }
- }
- me = (m0 == 0 ? set->margin_list : m0->next);
- if (me == 0)
- m0 = m0; /* Already set. */
- else if (me->iend < i0)
- m0 = me; /* Insert after me. */
- else if (me->ibeg > i1)
- m0 = me->prev; /* Insert before me. */
- else if (me->iend >= i0 && me->ibeg <= i1) {
- /* Intersects with me. Replace me boundaries. */
- me->ibeg = min(i0, me->ibeg);
- me->iend = max(i1, me->iend);
- set->margin_touched = me;
- return 0;
- }
+ margin *m_last = m0, *mb, *me;
+
+ if (set->margin_list == 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (i1 < m0->ibeg) {
+ do {
+ m0 = m0->prev;
+ } while (m0 != 0 && i0 <= m0->iend);
+ /* m0 points to a non-contacting at left. */
+ m1 = (m0 == 0 ? set->margin_list : m0)->next;
+ while (m1 != 0 && m1->ibeg <= i1) {
+ m_last = m1;
+ m1 = m1->next;
+ }
+ /* m1 points to a non-contacting at right. */
+ } else if (i0 > m0->iend) {
+ m1 = m0;
+ do {
+ m_last = m1;
+ m1 = m1->next;
+ } while (m1 != 0 && i1 >= m1->ibeg);
+ /* m0 points to a non-contacting at right. */
+ m0 = (m1 == 0 ? m_last : m1->prev);
+ while (m0 != 0 && m0->iend >= i0)
+ m0 = m0->prev;
+ /* m1 points to a non-contacting at left. */
+ } else {
+ m1 = m0;
+ while (m1 != 0 && m1->ibeg <= i1) {
+ m_last = m1;
+ m1 = m1->next;
+ }
+ /* m1 points to a non-contacting at right. */
+ while (m0 != 0 && m0->iend >= i0)
+ m0 = m0->prev;
+ /* m1 points to a non-contacting at left. */
+ }
+ /* Remove elements from m0->next to m1->prev, excluding the latter.
+ m0 may be NULL if we riched list start.
+ m1 may be NULL if we riched list end. */
+ mb = (m0 == 0 ? set->margin_list : m0->next);
+ if (mb != 0 && mb != m1) {
+ me = (m1 == 0 ? m_last : m1->prev);
+ /* Remove elements from mb to me, excluding the latter.
+ me may be NULL if we riched list start. */
+ if (me != 0) {
+ if (mb != me && me->prev != 0) {
+ margin *mf = me->prev;
+
+ /* Remove elements from mb to mf. */
+ if (mb->prev != 0)
+ mb->prev->next = mf->next;
+ if (mf->next != 0)
+ mf->next->prev = mb->prev;
+ if (set->margin_list == mb)
+ set->margin_list = mf->next;
+ mf->next = ll->free_margin_list;
+ ll->free_margin_list = mb;
+ i0 = min(i0, mb->ibeg);
+ i1 = max(i1, mf->iend);
+ /* 'prev' links are not used in ll->free_margin_list. */
+ }
+ }
+ }
+ me = (m0 == 0 ? set->margin_list : m0->next);
+ if (me == 0)
+ m0 = m0; /* Already set. */
+ else if (me->iend < i0)
+ m0 = me; /* Insert after me. */
+ else if (me->ibeg > i1)
+ m0 = me->prev; /* Insert before me. */
+ else if (me->iend >= i0 && me->ibeg <= i1) {
+ /* Intersects with me. Replace me boundaries. */
+ me->ibeg = min(i0, me->ibeg);
+ me->iend = max(i1, me->iend);
+ set->margin_touched = me;
+ return 0;
+ }
}
/* Insert after m0 */
m1 = alloc_margin(ll);
if (m1 == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (m0 != 0) {
- m1->next = m0->next;
- m1->prev = m0;
- m0->next = m1;
- if (m1->next!= 0)
- m1->next->prev = m1;
+ m1->next = m0->next;
+ m1->prev = m0;
+ m0->next = m1;
+ if (m1->next!= 0)
+ m1->next->prev = m1;
} else {
- m1->next = set->margin_list;
- m1->prev = 0;
- if (set->margin_list != 0)
- set->margin_list->prev = m1;
- set->margin_list = m1;
+ m1->next = set->margin_list;
+ m1->prev = 0;
+ if (set->margin_list != 0)
+ set->margin_list->prev = m1;
+ set->margin_list = m1;
}
m1->ibeg = i0;
m1->iend = i1;
@@ -218,8 +218,8 @@ static inline fixed Y_AT_X(active_line *alp, fixed xp)
{ return alp->start.y + fixed_mult_quo(xp - alp->start.x, alp->diff.y, alp->diff.x);
}
-static int margin_boundary(line_list * ll, margin_set * set, active_line * alp,
- fixed xx0, fixed xx1, fixed yy0, fixed yy1, int dir, fixed y0, fixed y1)
+static int margin_boundary(line_list * ll, margin_set * set, active_line * alp,
+ fixed xx0, fixed xx1, fixed yy0, fixed yy1, int dir, fixed y0, fixed y1)
{ section *sect = set->sect;
fixed x0, x1, xmin, xmax;
int xp0, xp;
@@ -229,74 +229,74 @@ static int margin_boundary(line_list * ll, margin_set * set, active_line * alp,
# endif
if (yy0 > yy1)
- return 0;
+ return 0;
/* enumerate integral x's in [yy0,yy1] : */
if (alp == 0)
- x0 = xx0, x1 = xx1;
+ x0 = xx0, x1 = xx1;
else {
- x0 = (yy0 == y0 ? alp->x_current : AL_X_AT_Y(alp, yy0));
- x1 = (yy1 == y1 ? alp->x_next : AL_X_AT_Y(alp, yy1));
+ x0 = (yy0 == y0 ? alp->x_current : AL_X_AT_Y(alp, yy0));
+ x1 = (yy1 == y1 ? alp->x_next : AL_X_AT_Y(alp, yy1));
}
xmin = min(x0, x1);
xmax = max(x0, x1);
# if !CHECK_SPOT_CONTIGUITY
- xp0 = fixed_floor(xmin) + fixed_half;
- i0 = fixed2int(xp0) - ll->bbox_left;
- if (xp0 < xmin) {
- xp0 += fixed_1;
- i0++;
- }
- if (i0 < 0)
- return_error(gs_error_unregistered); /* Must not happen. */
- for (i = i0, xp = xp0; xp < xmax && i < ll->bbox_width; xp += fixed_1, i++) {
- fixed y = (alp == 0 ? yy0 : Y_AT_X(alp, xp));
- fixed dy = y - set->y;
- bool ud;
- short *b, h;
- section *s = &sect[i];
-
- if (dy < 0)
- dy = 0; /* fix rounding errors in Y_AT_X */
- if (dy >= fixed_1)
- dy = fixed_1; /* safety */
- vd_circle(xp, y, 2, 0);
- ud = (alp == 0 ? (dir > 0) : ((alp->start.x - alp->end.x) * dir > 0));
- b = (ud ? &s->y0 : &s->y1);
- h = (short)dy;
- if (*b == -1 || (*b != -2 && ( ud ? *b > h : *b < h)))
- *b = h;
- }
+ xp0 = fixed_floor(xmin) + fixed_half;
+ i0 = fixed2int(xp0) - ll->bbox_left;
+ if (xp0 < xmin) {
+ xp0 += fixed_1;
+ i0++;
+ }
+ if (i0 < 0)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ for (i = i0, xp = xp0; xp < xmax && i < ll->bbox_width; xp += fixed_1, i++) {
+ fixed y = (alp == 0 ? yy0 : Y_AT_X(alp, xp));
+ fixed dy = y - set->y;
+ bool ud;
+ short *b, h;
+ section *s = &sect[i];
+
+ if (dy < 0)
+ dy = 0; /* fix rounding errors in Y_AT_X */
+ if (dy >= fixed_1)
+ dy = fixed_1; /* safety */
+ vd_circle(xp, y, 2, 0);
+ ud = (alp == 0 ? (dir > 0) : ((alp->start.x - alp->end.x) * dir > 0));
+ b = (ud ? &s->y0 : &s->y1);
+ h = (short)dy;
+ if (*b == -1 || (*b != -2 && ( ud ? *b > h : *b < h)))
+ *b = h;
+ }
# else
- xp0 = fixed_floor(xmin) + fixed_half;
- i0 = fixed2int(xp0) - ll->bbox_left;
- if (xp0 < xmin) {
- i0++;
- xp0 += fixed_1;
- }
- for (i = i0, xp = xp0; xp < xmax; xp += fixed_1, i++) {
- section *s = &sect[i];
- fixed y = (alp==0 ? yy0 : Y_AT_X(alp, xp));
- fixed dy = y - set->y;
- bool ud;
- short *b, h;
-
- if (dy < 0)
- dy = 0; /* fix rounding errors in Y_AT_X */
- if (dy >= fixed_1)
- dy = fixed_1; /* safety */
- vd_circle(xp, y, 2, 0);
- ud = (alp == 0 ? (dir > 0) : ((alp->start.x - alp->end.x) * dir > 0));
- b = (ud ? &s->y0 : &s->y1);
- h = (short)dy;
- if (*b == -1 || (*b != -2 && ( ud ? *b > h : *b < h)))
- *b = h;
- }
- if (i0 < 0 || i > ll->bbox_width)
- return_error(gs_error_unregistered); /* Must not happen. */
+ xp0 = fixed_floor(xmin) + fixed_half;
+ i0 = fixed2int(xp0) - ll->bbox_left;
+ if (xp0 < xmin) {
+ i0++;
+ xp0 += fixed_1;
+ }
+ for (i = i0, xp = xp0; xp < xmax; xp += fixed_1, i++) {
+ section *s = &sect[i];
+ fixed y = (alp==0 ? yy0 : Y_AT_X(alp, xp));
+ fixed dy = y - set->y;
+ bool ud;
+ short *b, h;
+
+ if (dy < 0)
+ dy = 0; /* fix rounding errors in Y_AT_X */
+ if (dy >= fixed_1)
+ dy = fixed_1; /* safety */
+ vd_circle(xp, y, 2, 0);
+ ud = (alp == 0 ? (dir > 0) : ((alp->start.x - alp->end.x) * dir > 0));
+ b = (ud ? &s->y0 : &s->y1);
+ h = (short)dy;
+ if (*b == -1 || (*b != -2 && ( ud ? *b > h : *b < h)))
+ *b = h;
+ }
+ if (i0 < 0 || i > ll->bbox_width)
+ return_error(gs_error_unregistered); /* Must not happen. */
# endif
if (i > i0)
- return store_margin(ll, set, i0, i);
+ return store_margin(ll, set, i0, i);
return 0;
}
@@ -308,37 +308,37 @@ int continue_margin_common(line_list * ll, margin_set * set, active_line * flp,
fixed yy1 = min(min(y1, alp->end.y), set->y + fixed_1);
if (yy0 <= yy1) {
- fixed x00 = (yy0 == y0 ? flp->x_current : AL_X_AT_Y(flp, yy0));
- fixed x10 = (yy0 == y0 ? alp->x_current : AL_X_AT_Y(alp, yy0));
- fixed x01 = (yy1 == y1 ? flp->x_next : AL_X_AT_Y(flp, yy1));
- fixed x11 = (yy1 == y1 ? alp->x_next : AL_X_AT_Y(alp, yy1));
- fixed xmin = min(x00, x01), xmax = max(x10, x11);
-
- int i0 = fixed2int(xmin) - ll->bbox_left, i;
- int i1 = fixed2int_ceiling(xmax) - ll->bbox_left;
-
- for (i = i0; i < i1; i++) {
- section *s = &sect[i];
- int x_pixel = int2fixed(i + ll->bbox_left);
- int xl = max(xmin - x_pixel, 0);
- int xu = min(xmax - x_pixel, fixed_1);
-
- s->x0 = min(s->x0, xl);
- s->x1 = max(s->x1, xu);
- x_pixel+=0; /* Just a place for breakpoint */
- }
- code = store_margin(ll, set, i0, i1);
- if (code < 0)
- return code;
- /* fixme : after ADJUST_SERIF becames permanent,
- * don't call margin_boundary if yy0 > yy1.
- */
+ fixed x00 = (yy0 == y0 ? flp->x_current : AL_X_AT_Y(flp, yy0));
+ fixed x10 = (yy0 == y0 ? alp->x_current : AL_X_AT_Y(alp, yy0));
+ fixed x01 = (yy1 == y1 ? flp->x_next : AL_X_AT_Y(flp, yy1));
+ fixed x11 = (yy1 == y1 ? alp->x_next : AL_X_AT_Y(alp, yy1));
+ fixed xmin = min(x00, x01), xmax = max(x10, x11);
+
+ int i0 = fixed2int(xmin) - ll->bbox_left, i;
+ int i1 = fixed2int_ceiling(xmax) - ll->bbox_left;
+
+ for (i = i0; i < i1; i++) {
+ section *s = &sect[i];
+ int x_pixel = int2fixed(i + ll->bbox_left);
+ int xl = max(xmin - x_pixel, 0);
+ int xu = min(xmax - x_pixel, fixed_1);
+
+ s->x0 = min(s->x0, xl);
+ s->x1 = max(s->x1, xu);
+ x_pixel+=0; /* Just a place for breakpoint */
+ }
+ code = store_margin(ll, set, i0, i1);
+ if (code < 0)
+ return code;
+ /* fixme : after ADJUST_SERIF becames permanent,
+ * don't call margin_boundary if yy0 > yy1.
+ */
}
# endif
code = margin_boundary(ll, set, flp, 0, 0, yy0, yy1, 1, y0, y1);
if (code < 0)
- return code;
+ return code;
return margin_boundary(ll, set, alp, 0, 0, yy0, yy1, -1, y0, y1);
}
@@ -350,19 +350,19 @@ static inline int mark_margin_interior(line_list * ll, margin_set * set, active_
int i0 = fixed2int(x0), ii0, ii1, i, code;
if (int2fixed(i0) + fixed_half < x0)
- i0++;
+ i0++;
ii0 = i0 - ll->bbox_left;
ii1 = fixed2int_var_pixround(x1) - ll->bbox_left;
if (ii0 < ii1) {
- if (ii0 < 0 || ii1 > ll->bbox_width)
- return_error(gs_error_unregistered); /* Must not happen. */
- for (i = ii0; i < ii1; i++) {
- sect[i].y0 = sect[i].y1 = -2;
- vd_circle(int2fixed(i + ll->bbox_left) + fixed_half, y, 3, RGB(255, 0, 0));
- }
- code = store_margin(ll, set, ii0, ii1);
- if (code < 0)
- return code;
+ if (ii0 < 0 || ii1 > ll->bbox_width)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ for (i = ii0; i < ii1; i++) {
+ sect[i].y0 = sect[i].y1 = -2;
+ vd_circle(int2fixed(i + ll->bbox_left) + fixed_half, y, 3, RGB(255, 0, 0));
+ }
+ code = store_margin(ll, set, ii0, ii1);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -373,101 +373,101 @@ int margin_interior(line_list * ll, active_line * flp, active_line * alp, fixed
yy0 = ll->margin_set0.y;
if (y0 <= yy0 && yy0 <= y1) {
- code = mark_margin_interior(ll, &ll->margin_set0, flp, alp, yy0, y0, y1);
- if (code < 0)
- return code;
+ code = mark_margin_interior(ll, &ll->margin_set0, flp, alp, yy0, y0, y1);
+ if (code < 0)
+ return code;
}
yy1 = ll->margin_set1.y + fixed_1;
if (y0 <= yy1 && yy1 <= y1) {
- code = mark_margin_interior(ll, &ll->margin_set1, flp, alp, yy1, y0, y1);
- if (code < 0)
- return code;
+ code = mark_margin_interior(ll, &ll->margin_set1, flp, alp, yy1, y0, y1);
+ if (code < 0)
+ return code;
}
return 0;
}
-static inline int process_h_sect(line_list * ll, margin_set * set, active_line * hlp0,
+static inline int process_h_sect(line_list * ll, margin_set * set, active_line * hlp0,
active_line * plp, active_line * flp, int side, fixed y0, fixed y1)
{
active_line *hlp = hlp0;
fixed y = hlp->start.y;
- fixed x0 = (plp != 0 ? (y == y0 ? plp->x_current : y == y1 ? plp->x_next : AL_X_AT_Y(plp, y))
- : int2fixed(ll->bbox_left));
+ fixed x0 = (plp != 0 ? (y == y0 ? plp->x_current : y == y1 ? plp->x_next : AL_X_AT_Y(plp, y))
+ : int2fixed(ll->bbox_left));
fixed x1 = (flp != 0 ? (y == y0 ? flp->x_current : y == y1 ? flp->x_next : AL_X_AT_Y(flp, y))
: int2fixed(ll->bbox_left + ll->bbox_width));
int code;
for (; hlp != 0; hlp = hlp->next) {
- fixed xx0 = max(x0, min(hlp->start.x, hlp->end.x));
- fixed xx1 = min(x1, max(hlp->start.x, hlp->end.x));
-
- if (xx0 < xx1) {
- vd_bar(xx0, y, xx1, y, 1, RGB(255, 0, 255));
- code = margin_boundary(ll, set, 0, xx0, xx1, y, y, side, 0, 0);
- if (code < 0)
- return code;
- }
+ fixed xx0 = max(x0, min(hlp->start.x, hlp->end.x));
+ fixed xx1 = min(x1, max(hlp->start.x, hlp->end.x));
+
+ if (xx0 < xx1) {
+ vd_bar(xx0, y, xx1, y, 1, RGB(255, 0, 255));
+ code = margin_boundary(ll, set, 0, xx0, xx1, y, y, side, 0, 0);
+ if (code < 0)
+ return code;
+ }
}
- return 0;
+ return 0;
}
-static inline int process_h_side(line_list * ll, margin_set * set, active_line * hlp,
+static inline int process_h_side(line_list * ll, margin_set * set, active_line * hlp,
active_line * plp, active_line * flp, active_line * alp, int side, fixed y0, fixed y1)
{ if (plp != 0 || flp != 0 || (plp == 0 && flp == 0 && alp == 0)) {
- /* We don't know here, whether the opposite (-) side is painted with
- * a trapezoid. mark_margin_interior may rewrite it later.
- */
- int code = process_h_sect(ll, set, hlp, plp, flp, -side, y0, y1);
+ /* We don't know here, whether the opposite (-) side is painted with
+ * a trapezoid. mark_margin_interior may rewrite it later.
+ */
+ int code = process_h_sect(ll, set, hlp, plp, flp, -side, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (flp != 0 && alp != 0) {
- int code = process_h_sect(ll, set, hlp, flp, alp, side, y0, y1);
+ int code = process_h_sect(ll, set, hlp, flp, alp, side, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
-static inline int process_h_list(line_list * ll, active_line * hlp, active_line * plp,
+static inline int process_h_list(line_list * ll, active_line * hlp, active_line * plp,
active_line * flp, active_line * alp, int side, fixed y0, fixed y1)
{ fixed y = hlp->start.y;
if (ll->margin_set0.y <= y && y <= ll->margin_set0.y + fixed_1) {
- int code = process_h_side(ll, &ll->margin_set0, hlp, plp, flp, alp, side, y0, y1);
+ int code = process_h_side(ll, &ll->margin_set0, hlp, plp, flp, alp, side, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (ll->margin_set1.y <= y && y <= ll->margin_set1.y + fixed_1) {
- int code = process_h_side(ll, &ll->margin_set1, hlp, plp, flp, alp, side, y0, y1);
+ int code = process_h_side(ll, &ll->margin_set1, hlp, plp, flp, alp, side, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
int process_h_lists(line_list * ll, active_line * plp, active_line * flp, active_line * alp,
- fixed y0, fixed y1)
-{
+ fixed y0, fixed y1)
+{
if (y0 == y1) {
- /* fixme : Must not happen. Remove. */
- return 0;
+ /* fixme : Must not happen. Remove. */
+ return 0;
}
if (ll->h_list0 != 0) {
- int code = process_h_list(ll, ll->h_list0, plp, flp, alp, 1, y0, y1);
+ int code = process_h_list(ll, ll->h_list0, plp, flp, alp, 1, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
if (ll->h_list1 != 0) {
- int code = process_h_list(ll, ll->h_list1, plp, flp, alp, -1, y0, y1);
+ int code = process_h_list(ll, ll->h_list1, plp, flp, alp, -1, y0, y1);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -475,9 +475,9 @@ int process_h_lists(line_list * ll, active_line * plp, active_line * flp, active
static inline int compute_padding(section *s)
{
return (s->y0 < 0 || s->y1 < 0 ? -2 : /* contacts a trapezoid - don't paint */
- s->y1 < fixed_half ? 0 :
- s->y0 > fixed_half ? 1 :
- fixed_half - s->y0 < s->y1 - fixed_half ? 1 : 0);
+ s->y1 < fixed_half ? 0 :
+ s->y0 > fixed_half ? 1 :
+ fixed_half - s->y0 < s->y1 - fixed_half ? 1 : 0);
}
static int fill_margin(gx_device * dev, const line_list * ll, margin_set *ms, int i0, int i1)
@@ -489,86 +489,86 @@ static int fill_margin(gx_device * dev, const line_list * ll, margin_set *ms, in
const bool FILL_DIRECT = fo->fill_direct;
if (i0 < 0 || i1 > ll->bbox_width)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
ir = i0;
for (i = i0; i < i1; i++) {
- int y0 = sect[i].y0, y1 = sect[i].y1, hh;
+ int y0 = sect[i].y0, y1 = sect[i].y1, hh;
- if (y0 == -1)
- y0 = 0;
- if (y1 == -1)
- y1 = fixed_scale - 1;
- hh = compute_padding(&sect[i]);
+ if (y0 == -1)
+ y0 = 0;
+ if (y1 == -1)
+ y1 = fixed_scale - 1;
+ hh = compute_padding(&sect[i]);
# if ADJUST_SERIF
- if (hh >= 0) {
+ if (hh >= 0) {
# if !CHECK_SPOT_CONTIGUITY
- if (i == i0 && i + 1 < i1) {
- int hhh = compute_padding(&sect[i + 1]);
-
- hh = hhh;
- } else if (i == i1 - 1 && i > i0)
- hh = h;
- /* We could optimize it with moving outside the cycle.
- * Delaying the optimization until the code is well tested.
- */
+ if (i == i0 && i + 1 < i1) {
+ int hhh = compute_padding(&sect[i + 1]);
+
+ hh = hhh;
+ } else if (i == i1 - 1 && i > i0)
+ hh = h;
+ /* We could optimize it with moving outside the cycle.
+ * Delaying the optimization until the code is well tested.
+ */
# else
- if (sect[i].x0 > 0 && sect[i].x1 == fixed_1 && i + 1 < i1) {
+ if (sect[i].x0 > 0 && sect[i].x1 == fixed_1 && i + 1 < i1) {
# if INTERTRAP_STEM_BUG
- int hhh = hh;
+ int hhh = hh;
# endif
- hh = (i + 1 < i1 ? compute_padding(&sect[i + 1]) : -2);
- /* We could cache hh.
- * Delaying the optimization until the code is well tested.
- */
+ hh = (i + 1 < i1 ? compute_padding(&sect[i + 1]) : -2);
+ /* We could cache hh.
+ * Delaying the optimization until the code is well tested.
+ */
# if INTERTRAP_STEM_BUG
- /* A bug in the old code. */
- if (i > i0 && i + 1 < i1 && hh == -2 &&
- compute_padding(&sect[i - 1]) == -2) {
- /* It can be either a thin stem going from left to up or down
- (See 'r' in 01-001.ps in 'General', ppmraw, 72dpi),
- or a serif from the left.
- Since it is between 2 trapezoids, it is better to paint it
- against a dropout. */
- hh = hhh;
- }
+ /* A bug in the old code. */
+ if (i > i0 && i + 1 < i1 && hh == -2 &&
+ compute_padding(&sect[i - 1]) == -2) {
+ /* It can be either a thin stem going from left to up or down
+ (See 'r' in 01-001.ps in 'General', ppmraw, 72dpi),
+ or a serif from the left.
+ Since it is between 2 trapezoids, it is better to paint it
+ against a dropout. */
+ hh = hhh;
+ }
# endif
- } else if (sect[i].x0 == 0 && sect[i].x1 < fixed_1) {
+ } else if (sect[i].x0 == 0 && sect[i].x1 < fixed_1) {
# if INTERTRAP_STEM_BUG
- int hhh = hh;
+ int hhh = hh;
# endif
- hh = h;
+ hh = h;
# if INTERTRAP_STEM_BUG
- /* A bug in the old code. */
- if (i > i0 && i + 1 < i1 && hh == -2 &&
- compute_padding(&sect[i - 1]) == -2) {
- /* It can be either a thin stem going from right to up or down
- (See 'r' in 01-001.ps in 'General', ppmraw, 72dpi),
- or a serif from the right.
- Since it is between 2 trapezoids, it is better to paint it.
- against a dropout. */
- DO_NOTHING;
- }
+ /* A bug in the old code. */
+ if (i > i0 && i + 1 < i1 && hh == -2 &&
+ compute_padding(&sect[i - 1]) == -2) {
+ /* It can be either a thin stem going from right to up or down
+ (See 'r' in 01-001.ps in 'General', ppmraw, 72dpi),
+ or a serif from the right.
+ Since it is between 2 trapezoids, it is better to paint it.
+ against a dropout. */
+ DO_NOTHING;
+ }
# endif
- }
+ }
# endif
- }
+ }
# endif
- if (h != hh) {
- if (h >= 0) {
- VD_RECT(ir + ll->bbox_left, iy + h, i - ir, 1, VD_MARG_COLOR);
- code = LOOP_FILL_RECTANGLE_DIRECT(fo, ir + ll->bbox_left, iy + h, i - ir, 1);
- if (code < 0)
- return code;
- }
- ir = i;
- h = hh;
- }
+ if (h != hh) {
+ if (h >= 0) {
+ VD_RECT(ir + ll->bbox_left, iy + h, i - ir, 1, VD_MARG_COLOR);
+ code = LOOP_FILL_RECTANGLE_DIRECT(fo, ir + ll->bbox_left, iy + h, i - ir, 1);
+ if (code < 0)
+ return code;
+ }
+ ir = i;
+ h = hh;
+ }
}
if (h >= 0) {
- VD_RECT(ir + ll->bbox_left, iy + h, i - ir, 1, VD_MARG_COLOR);
- code = LOOP_FILL_RECTANGLE_DIRECT(fo, ir + ll->bbox_left, iy + h, i - ir, 1);
- if (code < 0)
- return code;
+ VD_RECT(ir + ll->bbox_left, iy + h, i - ir, 1, VD_MARG_COLOR);
+ code = LOOP_FILL_RECTANGLE_DIRECT(fo, ir + ll->bbox_left, iy + h, i - ir, 1);
+ if (code < 0)
+ return code;
}
init_section(sect, i0, i1);
return 0;
@@ -578,33 +578,33 @@ static int fill_margin(gx_device * dev, const line_list * ll, margin_set *ms, in
* We either suppress a serif or move it up or down for 1 pixel.
* If we would paint it as an entire pixel where it occures, it looks too big
* relatively to the character size. Besides, a stem end may
- * be placed a little bit below the baseline, and our dropout prevention
+ * be placed a little bit below the baseline, and our dropout prevention
* method desides to paint a pixel below baseline, so that it looks
* fallen down (or fallen up in the case of character top).
- *
+ *
* We assume that contacting margins are merged in margin_list.
* This implies that areas outside a margin are not painted
* (Only useful without CHECK_SPOT_CONTIGUITY).
*
* With no CHECK_SPOT_CONTIGUITY we can't perfectly handle the case when 2 serifs
* contact each another inside a margin interior (such as Serif 'n').
- * Since we don't know the contiguty, we misrecognize them as a stem and
+ * Since we don't know the contiguty, we misrecognize them as a stem and
* leave them as they are (possibly still fallen down or up).
*
* CHECK_SPOT_CONTIGUITY computes the contiguity of the intersection of the spot
* and the section window. It allows to recognize contacting serifs properly.
*
- * If a serif isn't painted with regular trapezoids,
+ * If a serif isn't painted with regular trapezoids,
* it appears a small one, so we don't need to measure its size.
* This heuristic isn't perfect, but it is very fast.
* Meanwhile with CHECK_SPOT_CONTIGUITY we actually have something
* like a bbox for a small serif, and a rough estimation is possible.
- *
+ *
* We believe that in normal cases this stuff should work idle,
- * because a perfect rendering should either use anti-aliasing
+ * because a perfect rendering should either use anti-aliasing
* (so that the character isn't small in the subpixel grid),
* and/or the path must be well fitted into the grid. So please consider
- * this code as an attempt to do our best for the case of a
+ * this code as an attempt to do our best for the case of a
* non-well-setup rendering.
*/
}
@@ -614,9 +614,9 @@ int close_margins(gx_device * dev, line_list * ll, margin_set *ms)
int code;
for (; m != 0; m = m->next) {
- code = fill_margin(dev, ll, ms, m->ibeg, m->iend);
- if (code < 0)
- return code;
+ code = fill_margin(dev, ll, ms, m->ibeg, m->iend);
+ if (code < 0)
+ return code;
}
release_margin_list(ll, ms);
return 0;
@@ -628,7 +628,7 @@ int start_margin_set(gx_device * dev, line_list * ll, fixed y0)
margin_set s;
if (ll->margin_set0.y == ym)
- return 0;
+ return 0;
s = ll->margin_set1;
ll->margin_set1 = ll->margin_set0;
ll->margin_set0 = s;
@@ -636,6 +636,3 @@ int start_margin_set(gx_device * dev, line_list * ll, fixed y0)
ll->margin_set0.y = ym;
return code;
}
-
-
-
diff --git a/gs/base/gxfdrop.h b/gs/base/gxfdrop.h
index 8e22089a1..39a7c35da 100644
--- a/gs/base/gxfdrop.h
+++ b/gs/base/gxfdrop.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,8 +17,7 @@
#ifndef gxfdrop_INCLUDED
# define gxfdrop_INCLUDED
-
-/* The structure margin_set and related structures and functions are used for
+/* The structure margin_set and related structures and functions are used for
preventing dropouts rasterizing a character with zero fill adjustment. The purpose
is to paint something along thin quazi-horizontal stems,
which are composed of multiple small segments (such as a result of flattenpath).
@@ -37,9 +36,9 @@
to be painted), and array of "sections" (i-th section corresponds to
half-integer X-coordinate Xi = bbox_left + i + 0.5, and stores fraction
part of y-coordinate of intersection of the line x == Xi with margin
- boudaries, being visible through window (only extremal coordinates are stored
+ boudaries, being visible through window (only extremal coordinates are stored
into a section)).
-
+
The structure margin_set snaps what has been painted inside window.
We handle 2 instances of margin_set : margin_set0 is being prepared and margin_set1 is
being refinished. When the filling loop steps down over a pixel center,
@@ -94,7 +93,7 @@ typedef struct section_s
} section;
typedef struct margin_set_s
-{ fixed y;
+{ fixed y;
margin *margin_list, *margin_touched;
section *sect;
} margin_set;
diff --git a/gs/base/gxfill.c b/gs/base/gxfill.c
index 43193616b..44e54342c 100644
--- a/gs/base/gxfill.c
+++ b/gs/base/gxfill.c
@@ -92,10 +92,8 @@ stats_fill_t stats_fill;
/* we are inside if the winding number is odd. */
#define INSIDE_PATH_P(inside, rule) ((inside & rule) != 0)
-
/* ---------------- Active line management ---------------- */
-
/*
* Define the ordering criterion for active lines that overlap in Y.
* Return -1, 0, or 1 if lp1 precedes, coincides with, or follows lp2.
@@ -213,7 +211,6 @@ static void insert_x_new(active_line *, line_list *);
static int end_x_line(active_line *, const line_list *, bool);
static int step_al(active_line *alp, bool move_iterator);
-
#define FILL_LOOP_PROC(proc) int proc(line_list *, fixed band_mask)
static FILL_LOOP_PROC(spot_into_scan_lines);
static FILL_LOOP_PROC(spot_into_trapezoids);
@@ -257,7 +254,6 @@ init_line_list(line_list *ll, gs_memory_t * mem)
INCR(fill);
}
-
/* Unlink any line_close segments added temporarily. */
static inline void
unclose_path(gx_path * ppath, int count)
@@ -1117,7 +1113,6 @@ add_y_list(gx_path * ppath, line_list *ll)
return close_count;
}
-
static int
step_al(active_line *alp, bool move_iterator)
{
@@ -1246,7 +1241,6 @@ add_y_line_aux(const segment * prev_lp, const segment * lp,
return 0;
}
-
/* ---------------- Filling loop utilities ---------------- */
/* Insert a newly active line in the X ordering. */
@@ -1735,7 +1729,6 @@ loop_fill_trap_np(const line_list *ll, const gs_fixed_edge *le, const gs_fixed_e
#undef TEMPLATE_slant_into_trapezoids
#undef FILL_DIRECT
-
#define COVERING_PIXEL_CENTERS(y, y1, adjust_below, adjust_above)\
(fixed_pixround(y - adjust_below) < fixed_pixround(y1 + adjust_above))
@@ -1827,7 +1820,6 @@ coord_weight(const active_line *alp)
return 1 + min(any_abs((int)((int64_t)alp->diff.y * 8 / alp->diff.x)), 256);
}
-
/* Find intersections of active lines within the band.
Intersect and reorder them, and correct the bund top. */
static void
diff --git a/gs/base/gxfill.h b/gs/base/gxfill.h
index 532006a7e..ff276a0ae 100644
--- a/gs/base/gxfill.h
+++ b/gs/base/gxfill.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,9 +27,9 @@ struct active_line_s {
gs_fixed_point end; /* x,y where line ends */
gs_fixed_point diff; /* end - start */
fixed y_fast_max; /* can do x_at_y in fixed point */
- /* if y <= y_fast_max */
+ /* if y <= y_fast_max */
fixed num_adjust; /* 0 if diff.x >= 0, -diff.y + epsilon if */
- /* diff.x < 0 and division truncates */
+ /* diff.x < 0 and division truncates */
#if ARCH_DIV_NEG_POS_TRUNCATES
/* neg/pos truncates, we must bias the numberator. */
# define SET_NUM_ADJUST(alp) \
@@ -123,7 +123,7 @@ struct line_list_s {
#define x_list x_head.next
active_line *h_list0, *h_list1; /* lists of horizontal lines for y, y1 */
margin_set margin_set0, margin_set1;
- margin *free_margin_list;
+ margin *free_margin_list;
int *windings;
int local_margin_alloc_count;
int bbox_left, bbox_width;
@@ -159,9 +159,9 @@ struct line_list_s {
#ifdef DEBUG
struct stats_fill_s {
long
- fill, fill_alloc, y_up, y_down, horiz, x_step, slow_x, iter, find_y,
- band, band_step, band_fill, afill, slant, slant_shallow, sfill,
- mq_cross, cross_slow, cross_low, order, slow_order;
+ fill, fill_alloc, y_up, y_down, horiz, x_step, slow_x, iter, find_y,
+ band, band_step, band_fill, afill, slant, slant_shallow, sfill,
+ mq_cross, cross_slow, cross_low, order, slow_order;
};
typedef struct stats_fill_s stats_fill_t;
extern stats_fill_t stats_fill;
@@ -176,5 +176,3 @@ extern stats_fill_t stats_fill;
#endif
#endif /* gxfill_INCLUDED */
-
-
diff --git a/gs/base/gxfillsl.h b/gs/base/gxfillsl.h
index cc5dd516e..02f35394d 100644
--- a/gs/base/gxfillsl.h
+++ b/gs/base/gxfillsl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,7 +18,7 @@
* Since we need several statically defined variants of this agorithm,
* we store it in .h file and include it several times into gxfill.c .
* Configuration macros (template arguments) are :
- *
+ *
* FILL_DIRECT - See LOOP_FILL_RECTANGLE_DIRECT.
* TEMPLATE_spot_into_scanlines - the name of the procedure to generate.
*/
@@ -39,10 +39,10 @@ TEMPLATE_spot_into_scanlines (line_list *ll, fixed band_mask)
* epsilon.)
*/
fixed y_frac_min =
- (fo.adjust_above == fixed_0 ? fixed_half :
- fixed_half + fixed_epsilon - fo.adjust_above);
+ (fo.adjust_above == fixed_0 ? fixed_half :
+ fixed_half + fixed_epsilon - fo.adjust_above);
fixed y_frac_max =
- fixed_half + fo.adjust_below;
+ fixed_half + fo.adjust_below;
int y0 = fixed2int(min_fixed);
fixed y_bot = min_fixed; /* normally int2fixed(y0) + y_frac_min */
fixed y_top = min_fixed; /* normally int2fixed(y0) + y_frac_max */
@@ -52,189 +52,188 @@ TEMPLATE_spot_into_scanlines (line_list *ll, fixed band_mask)
int code = 0;
if (yll == 0) /* empty list */
- return 0;
+ return 0;
range_list_init(&rlist, rlocal, countof(rlocal), ll->memory);
ll->x_list = 0;
ll->x_head.x_current = min_fixed; /* stop backward scan */
do {
- active_line *alp, *nlp;
- fixed x;
- bool new_band;
-
- INCR(iter);
-
- code = move_al_by_y(ll, y); /* Skip horizontal pieces. */
- if (code < 0)
- return code;
- /*
- * Find the next sampling point, either the bottom of a sampling
- * band or a line start.
- */
-
- if (ll->x_list == 0)
- y = (yll == 0 ? ll->y_break : yll->start.y);
- else {
- y = y_bot + fixed_1;
- if (yll != 0)
- y = min(y, yll->start.y);
- for (alp = ll->x_list; alp != 0; alp = alp->next) {
- fixed yy = max(alp->fi.y3, alp->fi.y0);
-
- yy = max(yy, alp->end.y); /* Non-monotonic curves may have an inner extreme. */
- y = min(y, yy);
- }
- }
-
- /* Move newly active lines from y to x list. */
-
- while (yll != 0 && yll->start.y == y) {
- active_line *ynext = yll->next; /* insert smashes next/prev links */
-
- if (yll->direction == DIR_HORIZONTAL) {
- insert_h_new(yll, ll);
- } else
- insert_x_new(yll, ll);
- yll = ynext;
- }
-
- /* Update active lines to y. */
-
- x = min_fixed;
- for (alp = ll->x_list; alp != 0; alp = nlp) {
- fixed nx;
-
- nlp = alp->next;
- e:if (alp->end.y <= y || alp->start.y == alp->end.y) {
- if (end_x_line(alp, ll, true))
- continue;
- if (alp->more_flattened)
- if (alp->end.y <= y || alp->start.y == alp->end.y) {
- code = step_al(alp, true);
- if (code < 0)
- return code;
- }
- goto e;
- }
- nx = alp->x_current = (alp->start.y >= y ? alp->start.x : AL_X_AT_Y(alp, y));
- if (nx < x) {
- /* Move this line backward in the list. */
- active_line *ilp = alp;
-
- while (nx < (ilp = ilp->prev)->x_current)
- DO_NOTHING;
- /* Now ilp->x_current <= nx < ilp->next->x_cur. */
- alp->prev->next = alp->next;
- if (alp->next)
- alp->next->prev = alp->prev;
- if (ilp->next)
- ilp->next->prev = alp;
- alp->next = ilp->next;
- ilp->next = alp;
- alp->prev = ilp;
- continue;
- }
- x = nx;
- }
-
- if (y > y_top || y >= y_limit) {
- /* We're beyond the end of the previous sampling band. */
- const coord_range_t *pcr;
-
- /* Fill the ranges for y0. */
-
- for (pcr = rlist.first.next; pcr != &rlist.last;
- pcr = pcr->next
- ) {
- int x0 = pcr->rmin, x1 = pcr->rmax;
-
- if_debug4('Q', "[Qr]draw 0x%lx: [%d,%d),%d\n", (ulong)pcr,
- x0, x1, y0);
- VD_RECT(x0, y0, x1 - x0, 1, VD_TRAP_COLOR);
- code = LOOP_FILL_RECTANGLE_DIRECT(&fo, x0, y0, x1 - x0, 1);
- if_debug3('F', "[F]drawing [%d:%d),%d\n", x0, x1, y0);
- if (code < 0)
- goto done;
- }
- range_list_reset(&rlist);
-
- /* Check whether we've reached the maximum y. */
-
- if (y >= y_limit)
- break;
-
- /* Reset the sampling band. */
-
- y0 = fixed2int(y);
- if (fixed_fraction(y) < y_frac_min)
- --y0;
- y_bot = int2fixed(y0) + y_frac_min;
- y_top = int2fixed(y0) + y_frac_max;
- new_band = true;
- } else
- new_band = false;
-
- if (y <= y_top) {
- /*
- * We're within the same Y pixel. Merge regions for segments
- * starting here (at y), up to y_top or the end of the segment.
- * If this is the first sampling within the band, run the
- * fill/eofill algorithm.
- */
- fixed y_min;
-
- if (new_band) {
- int inside = 0;
-
- INCR(band);
- for (alp = ll->x_list; alp != 0; alp = alp->next) {
- int x0 = fixed2int_pixround(alp->x_current - fo.adjust_left);
-
- for (;;) {
- /* We're inside a filled region. */
- print_al("step", alp);
- INCR(band_step);
- inside += alp->direction;
- if (!INSIDE_PATH_P(inside, fo.rule))
- break;
- /*
- * Since we're dealing with closed paths, the test
- * for alp == 0 shouldn't be needed, but we may have
- * omitted lines that are to the right of the
- * clipping region.
- */
- if ((alp = alp->next) == 0)
- goto out;
- }
- /* We just went from inside to outside, so fill the region. */
- code = range_list_add(&rlist, x0,
- fixed2int_rounded(alp->x_current +
- fo.adjust_right));
- if (code < 0)
- goto done;
- }
- out:
- y_min = min_fixed;
- } else
- y_min = y;
-
- /* Process horisontal segments */
-
- for (alp = ll->h_list0; alp != NULL; alp = alp->next) {
- fixed x0 = min(alp->start.x, alp->end.x);
- fixed x1 = max(alp->start.x, alp->end.x);
-
- code = range_list_add(&rlist, fixed2int_rounded(x0 - fo.adjust_left),
- fixed2int_rounded(x1 + fo.adjust_right));
- if (code < 0)
- goto done;
- }
-
- code = merge_ranges(&rlist, ll, y_min, y_top);
- } /* else y < y_bot + 1, do nothing */
- ll->h_list0 = NULL;
+ active_line *alp, *nlp;
+ fixed x;
+ bool new_band;
+
+ INCR(iter);
+
+ code = move_al_by_y(ll, y); /* Skip horizontal pieces. */
+ if (code < 0)
+ return code;
+ /*
+ * Find the next sampling point, either the bottom of a sampling
+ * band or a line start.
+ */
+
+ if (ll->x_list == 0)
+ y = (yll == 0 ? ll->y_break : yll->start.y);
+ else {
+ y = y_bot + fixed_1;
+ if (yll != 0)
+ y = min(y, yll->start.y);
+ for (alp = ll->x_list; alp != 0; alp = alp->next) {
+ fixed yy = max(alp->fi.y3, alp->fi.y0);
+
+ yy = max(yy, alp->end.y); /* Non-monotonic curves may have an inner extreme. */
+ y = min(y, yy);
+ }
+ }
+
+ /* Move newly active lines from y to x list. */
+
+ while (yll != 0 && yll->start.y == y) {
+ active_line *ynext = yll->next; /* insert smashes next/prev links */
+
+ if (yll->direction == DIR_HORIZONTAL) {
+ insert_h_new(yll, ll);
+ } else
+ insert_x_new(yll, ll);
+ yll = ynext;
+ }
+
+ /* Update active lines to y. */
+
+ x = min_fixed;
+ for (alp = ll->x_list; alp != 0; alp = nlp) {
+ fixed nx;
+
+ nlp = alp->next;
+ e:if (alp->end.y <= y || alp->start.y == alp->end.y) {
+ if (end_x_line(alp, ll, true))
+ continue;
+ if (alp->more_flattened)
+ if (alp->end.y <= y || alp->start.y == alp->end.y) {
+ code = step_al(alp, true);
+ if (code < 0)
+ return code;
+ }
+ goto e;
+ }
+ nx = alp->x_current = (alp->start.y >= y ? alp->start.x : AL_X_AT_Y(alp, y));
+ if (nx < x) {
+ /* Move this line backward in the list. */
+ active_line *ilp = alp;
+
+ while (nx < (ilp = ilp->prev)->x_current)
+ DO_NOTHING;
+ /* Now ilp->x_current <= nx < ilp->next->x_cur. */
+ alp->prev->next = alp->next;
+ if (alp->next)
+ alp->next->prev = alp->prev;
+ if (ilp->next)
+ ilp->next->prev = alp;
+ alp->next = ilp->next;
+ ilp->next = alp;
+ alp->prev = ilp;
+ continue;
+ }
+ x = nx;
+ }
+
+ if (y > y_top || y >= y_limit) {
+ /* We're beyond the end of the previous sampling band. */
+ const coord_range_t *pcr;
+
+ /* Fill the ranges for y0. */
+
+ for (pcr = rlist.first.next; pcr != &rlist.last;
+ pcr = pcr->next
+ ) {
+ int x0 = pcr->rmin, x1 = pcr->rmax;
+
+ if_debug4('Q', "[Qr]draw 0x%lx: [%d,%d),%d\n", (ulong)pcr,
+ x0, x1, y0);
+ VD_RECT(x0, y0, x1 - x0, 1, VD_TRAP_COLOR);
+ code = LOOP_FILL_RECTANGLE_DIRECT(&fo, x0, y0, x1 - x0, 1);
+ if_debug3('F', "[F]drawing [%d:%d),%d\n", x0, x1, y0);
+ if (code < 0)
+ goto done;
+ }
+ range_list_reset(&rlist);
+
+ /* Check whether we've reached the maximum y. */
+
+ if (y >= y_limit)
+ break;
+
+ /* Reset the sampling band. */
+
+ y0 = fixed2int(y);
+ if (fixed_fraction(y) < y_frac_min)
+ --y0;
+ y_bot = int2fixed(y0) + y_frac_min;
+ y_top = int2fixed(y0) + y_frac_max;
+ new_band = true;
+ } else
+ new_band = false;
+
+ if (y <= y_top) {
+ /*
+ * We're within the same Y pixel. Merge regions for segments
+ * starting here (at y), up to y_top or the end of the segment.
+ * If this is the first sampling within the band, run the
+ * fill/eofill algorithm.
+ */
+ fixed y_min;
+
+ if (new_band) {
+ int inside = 0;
+
+ INCR(band);
+ for (alp = ll->x_list; alp != 0; alp = alp->next) {
+ int x0 = fixed2int_pixround(alp->x_current - fo.adjust_left);
+
+ for (;;) {
+ /* We're inside a filled region. */
+ print_al("step", alp);
+ INCR(band_step);
+ inside += alp->direction;
+ if (!INSIDE_PATH_P(inside, fo.rule))
+ break;
+ /*
+ * Since we're dealing with closed paths, the test
+ * for alp == 0 shouldn't be needed, but we may have
+ * omitted lines that are to the right of the
+ * clipping region.
+ */
+ if ((alp = alp->next) == 0)
+ goto out;
+ }
+ /* We just went from inside to outside, so fill the region. */
+ code = range_list_add(&rlist, x0,
+ fixed2int_rounded(alp->x_current +
+ fo.adjust_right));
+ if (code < 0)
+ goto done;
+ }
+ out:
+ y_min = min_fixed;
+ } else
+ y_min = y;
+
+ /* Process horisontal segments */
+
+ for (alp = ll->h_list0; alp != NULL; alp = alp->next) {
+ fixed x0 = min(alp->start.x, alp->end.x);
+ fixed x1 = max(alp->start.x, alp->end.x);
+
+ code = range_list_add(&rlist, fixed2int_rounded(x0 - fo.adjust_left),
+ fixed2int_rounded(x1 + fo.adjust_right));
+ if (code < 0)
+ goto done;
+ }
+
+ code = merge_ranges(&rlist, ll, y_min, y_top);
+ } /* else y < y_bot + 1, do nothing */
+ ll->h_list0 = NULL;
} while (code >= 0);
done:
range_list_free(&rlist);
return code;
}
-
diff --git a/gs/base/gxfilltr.h b/gs/base/gxfilltr.h
index 0a4e7bb1a..bbea479f0 100644
--- a/gs/base/gxfilltr.h
+++ b/gs/base/gxfilltr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,7 +18,7 @@
* Since we need several statically defined variants of this algorithm,
* we store it in .h file and include it several times into gxfill.c .
* Configuration macros (template arguments) are :
- *
+ *
* IS_SPOTAN - is the target device a spot analyzer ("spotan").
* PSEUDO_RASTERIZATION - use pseudo-rasterization.
* SMART_WINDING - even-odd filling rule for each contour independently.
@@ -46,317 +46,316 @@ TEMPLATE_spot_into_trapezoids (line_list *ll, fixed band_mask)
const bool all_bands = fo.is_spotan;
if (yll == 0)
- return 0; /* empty list */
+ return 0; /* empty list */
y = yll->start.y; /* first Y value */
ll->x_list = 0;
ll->x_head.x_current = min_fixed; /* stop backward scan */
ll->margin_set0.y = fixed_pixround(y) - fixed_half;
ll->margin_set1.y = fixed_pixround(y) - fixed_1 - fixed_half;
while (1) {
- fixed y1;
- active_line *alp, *plp = NULL;
- bool covering_pixel_centers;
+ fixed y1;
+ active_line *alp, *plp = NULL;
+ bool covering_pixel_centers;
- INCR(iter);
- /* Move newly active lines from y to x list. */
- while (yll != 0 && yll->start.y == y) {
- active_line *ynext = yll->next; /* insert smashes next/prev links */
+ INCR(iter);
+ /* Move newly active lines from y to x list. */
+ while (yll != 0 && yll->start.y == y) {
+ active_line *ynext = yll->next; /* insert smashes next/prev links */
- ll->y_list = ynext;
- if (ll->y_line == yll)
- ll->y_line = ynext;
- if (ynext != NULL)
- ynext->prev = NULL;
- if (yll->direction == DIR_HORIZONTAL) {
- if (!PSEUDO_RASTERIZATION) {
- /*
- * This is a hack to make sure that isolated horizontal
- * lines get stroked.
- */
- int yi = fixed2int_pixround(y - (!FILL_ADJUST ? 0 : fo.adjust_below));
- int xi, wi;
+ ll->y_list = ynext;
+ if (ll->y_line == yll)
+ ll->y_line = ynext;
+ if (ynext != NULL)
+ ynext->prev = NULL;
+ if (yll->direction == DIR_HORIZONTAL) {
+ if (!PSEUDO_RASTERIZATION) {
+ /*
+ * This is a hack to make sure that isolated horizontal
+ * lines get stroked.
+ */
+ int yi = fixed2int_pixround(y - (!FILL_ADJUST ? 0 : fo.adjust_below));
+ int xi, wi;
- if (yll->start.x <= yll->end.x) {
- xi = fixed2int_pixround(yll->start.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
- wi = fixed2int_pixround(yll->end.x + (!FILL_ADJUST ? 0 : fo.adjust_right)) - xi;
- } else {
- xi = fixed2int_pixround(yll->end.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
- wi = fixed2int_pixround(yll->start.x + (!FILL_ADJUST ? 0 : fo.adjust_right)) - xi;
- }
- VD_RECT(xi, yi, wi, 1, VD_TRAP_COLOR);
- code = LOOP_FILL_RECTANGLE_DIRECT(&fo, xi, yi, wi, 1);
- if (code < 0)
- return code;
- } else if (PSEUDO_RASTERIZATION)
- insert_h_new(yll, ll);
- } else
- insert_x_new(yll, ll);
- yll = ynext;
- }
- /* Mustn't leave by Y before process_h_segments. */
- if (ll->x_list == 0) { /* No active lines, skip to next start */
- if (yll == 0)
- break; /* no lines left */
- /* We don't close margin set here because the next set
- * may fall into same window. */
- y = yll->start.y;
- ll->h_list1 = ll->h_list0;
- ll->h_list0 = 0;
- continue;
- }
- if (vd_enabled) {
- vd_circle(0, y, 3, RGB(255, 0, 0));
- y += 0; /* Just a good place for a debugger breakpoint */
- }
- /* Find the next evaluation point. */
- /* Start by finding the smallest y value */
- /* at which any currently active line ends */
- /* (or the next to-be-active line begins). */
- y1 = (yll != 0 ? yll->start.y : ll->y_break);
- /* Make sure we don't exceed the maximum band height. */
- {
- fixed y_band = y | ~band_mask;
+ if (yll->start.x <= yll->end.x) {
+ xi = fixed2int_pixround(yll->start.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
+ wi = fixed2int_pixround(yll->end.x + (!FILL_ADJUST ? 0 : fo.adjust_right)) - xi;
+ } else {
+ xi = fixed2int_pixround(yll->end.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
+ wi = fixed2int_pixround(yll->start.x + (!FILL_ADJUST ? 0 : fo.adjust_right)) - xi;
+ }
+ VD_RECT(xi, yi, wi, 1, VD_TRAP_COLOR);
+ code = LOOP_FILL_RECTANGLE_DIRECT(&fo, xi, yi, wi, 1);
+ if (code < 0)
+ return code;
+ } else if (PSEUDO_RASTERIZATION)
+ insert_h_new(yll, ll);
+ } else
+ insert_x_new(yll, ll);
+ yll = ynext;
+ }
+ /* Mustn't leave by Y before process_h_segments. */
+ if (ll->x_list == 0) { /* No active lines, skip to next start */
+ if (yll == 0)
+ break; /* no lines left */
+ /* We don't close margin set here because the next set
+ * may fall into same window. */
+ y = yll->start.y;
+ ll->h_list1 = ll->h_list0;
+ ll->h_list0 = 0;
+ continue;
+ }
+ if (vd_enabled) {
+ vd_circle(0, y, 3, RGB(255, 0, 0));
+ y += 0; /* Just a good place for a debugger breakpoint */
+ }
+ /* Find the next evaluation point. */
+ /* Start by finding the smallest y value */
+ /* at which any currently active line ends */
+ /* (or the next to-be-active line begins). */
+ y1 = (yll != 0 ? yll->start.y : ll->y_break);
+ /* Make sure we don't exceed the maximum band height. */
+ {
+ fixed y_band = y | ~band_mask;
- if (y1 > y_band)
- y1 = y_band + 1;
- }
- for (alp = ll->x_list; alp != 0; alp = alp->next) {
- if (alp->end.y < y1)
- y1 = alp->end.y;
- }
+ if (y1 > y_band)
+ y1 = y_band + 1;
+ }
+ for (alp = ll->x_list; alp != 0; alp = alp->next) {
+ if (alp->end.y < y1)
+ y1 = alp->end.y;
+ }
# ifdef DEBUG
- if (gs_debug_c('F')) {
- dlprintf2("[F]before loop: y=%f y1=%f:\n",
- fixed2float(y), fixed2float(y1));
- print_line_list(ll->x_list);
- }
+ if (gs_debug_c('F')) {
+ dlprintf2("[F]before loop: y=%f y1=%f:\n",
+ fixed2float(y), fixed2float(y1));
+ print_line_list(ll->x_list);
+ }
# endif
- if (y == y1) {
- code = process_h_segments(ll, y);
- if (code < 0)
- return code;
- { int code1 = move_al_by_y(ll, y1);
- if (code1 < 0)
- return code1;
- }
- if (code > 0) {
- yll = ll->y_list; /* add_y_line_aux in process_h_segments changes it. */
- continue;
- }
+ if (y == y1) {
+ code = process_h_segments(ll, y);
+ if (code < 0)
+ return code;
+ { int code1 = move_al_by_y(ll, y1);
+ if (code1 < 0)
+ return code1;
+ }
+ if (code > 0) {
+ yll = ll->y_list; /* add_y_line_aux in process_h_segments changes it. */
+ continue;
+ }
- }
- if (y >= y_limit)
- break;
- /* Now look for line intersections before y1. */
- covering_pixel_centers = COVERING_PIXEL_CENTERS(y, y1,
- (!FILL_ADJUST ? 0 : fo.adjust_below),
- (!FILL_ADJUST ? 0 : fo.adjust_above));
- if (y != y1) {
- intersect_al(ll, y, &y1, (covering_pixel_centers ? 1 : -1), all_bands); /* May change y1. */
- covering_pixel_centers = COVERING_PIXEL_CENTERS(y, y1,
- (!FILL_ADJUST ? 0 : fo.adjust_below),
- (!FILL_ADJUST ? 0 : fo.adjust_above));
- }
- /* Prepare dropout prevention. */
- if (PSEUDO_RASTERIZATION) {
- code = start_margin_set(fo.dev, ll, y1);
- if (code < 0)
- return code;
- }
- /* Fill a multi-trapezoid band for the active lines. */
- if (covering_pixel_centers || all_bands) {
- int inside = 0;
- active_line *flp = NULL;
+ }
+ if (y >= y_limit)
+ break;
+ /* Now look for line intersections before y1. */
+ covering_pixel_centers = COVERING_PIXEL_CENTERS(y, y1,
+ (!FILL_ADJUST ? 0 : fo.adjust_below),
+ (!FILL_ADJUST ? 0 : fo.adjust_above));
+ if (y != y1) {
+ intersect_al(ll, y, &y1, (covering_pixel_centers ? 1 : -1), all_bands); /* May change y1. */
+ covering_pixel_centers = COVERING_PIXEL_CENTERS(y, y1,
+ (!FILL_ADJUST ? 0 : fo.adjust_below),
+ (!FILL_ADJUST ? 0 : fo.adjust_above));
+ }
+ /* Prepare dropout prevention. */
+ if (PSEUDO_RASTERIZATION) {
+ code = start_margin_set(fo.dev, ll, y1);
+ if (code < 0)
+ return code;
+ }
+ /* Fill a multi-trapezoid band for the active lines. */
+ if (covering_pixel_centers || all_bands) {
+ int inside = 0;
+ active_line *flp = NULL;
- if (SMART_WINDING)
- memset(ll->windings, 0, sizeof(ll->windings[0]) * ll->contour_count);
- INCR(band);
- /* Generate trapezoids */
- for (alp = ll->x_list; alp != 0; alp = alp->next) {
- int code;
+ if (SMART_WINDING)
+ memset(ll->windings, 0, sizeof(ll->windings[0]) * ll->contour_count);
+ INCR(band);
+ /* Generate trapezoids */
+ for (alp = ll->x_list; alp != 0; alp = alp->next) {
+ int code;
- print_al("step", alp);
- INCR(band_step);
- if (!INSIDE_PATH_P(inside, rule)) { /* i.e., outside */
- ADVANCE_WINDING(inside, alp, ll);
- if (INSIDE_PATH_P(inside, rule)) /* about to go in */
- flp = alp;
- continue;
- }
- /* We're inside a region being filled. */
- ADVANCE_WINDING(inside, alp, ll);
- if (INSIDE_PATH_P(inside, rule)) /* not about to go out */
- continue;
- /* We just went from inside to outside,
- chech whether we'll immediately go inside. */
- if (alp->next != NULL &&
- alp->x_current == alp->next->x_current &&
- alp->x_next == alp->next->x_next) {
- /* If the next trapezoid contacts this one, unite them.
- This simplifies data for the spot analyzer
- and reduces the number of trapezoids in the rasterization.
- Note that the topology possibly isn't exactly such
- as we generate by this uniting :
- Due to arithmetic errors in x_current, x_next
- we can unite things, which really are not contacting.
- But this level of the topology precision is enough for
- the glyph grid fitting.
- Also note that
- while a rasterization with dropout prevention
- it may cause a shift when choosing a pixel
- to paint with a narrow trapezoid. */
- alp = alp->next;
- ADVANCE_WINDING(inside, alp, ll);
- continue;
- }
- /* We just went from inside to outside, so fill the region. */
- INCR(band_fill);
- if (FILL_ADJUST && !(flp->end.x == flp->start.x && alp->end.x == alp->start.x) &&
- (fo.adjust_below | fo.adjust_above) != 0) {
- /* Assuming pseudo_rasterization = false. */
- if (FILL_DIRECT)
- code = slant_into_trapezoids__fd(ll, flp, alp, y, y1);
- else
- code = slant_into_trapezoids__nd(ll, flp, alp, y, y1);
- } else {
- fixed ybot = max(y, fo.pbox->p.y);
- fixed ytop = min(y1, fo.pbox->q.y);
+ print_al("step", alp);
+ INCR(band_step);
+ if (!INSIDE_PATH_P(inside, rule)) { /* i.e., outside */
+ ADVANCE_WINDING(inside, alp, ll);
+ if (INSIDE_PATH_P(inside, rule)) /* about to go in */
+ flp = alp;
+ continue;
+ }
+ /* We're inside a region being filled. */
+ ADVANCE_WINDING(inside, alp, ll);
+ if (INSIDE_PATH_P(inside, rule)) /* not about to go out */
+ continue;
+ /* We just went from inside to outside,
+ chech whether we'll immediately go inside. */
+ if (alp->next != NULL &&
+ alp->x_current == alp->next->x_current &&
+ alp->x_next == alp->next->x_next) {
+ /* If the next trapezoid contacts this one, unite them.
+ This simplifies data for the spot analyzer
+ and reduces the number of trapezoids in the rasterization.
+ Note that the topology possibly isn't exactly such
+ as we generate by this uniting :
+ Due to arithmetic errors in x_current, x_next
+ we can unite things, which really are not contacting.
+ But this level of the topology precision is enough for
+ the glyph grid fitting.
+ Also note that
+ while a rasterization with dropout prevention
+ it may cause a shift when choosing a pixel
+ to paint with a narrow trapezoid. */
+ alp = alp->next;
+ ADVANCE_WINDING(inside, alp, ll);
+ continue;
+ }
+ /* We just went from inside to outside, so fill the region. */
+ INCR(band_fill);
+ if (FILL_ADJUST && !(flp->end.x == flp->start.x && alp->end.x == alp->start.x) &&
+ (fo.adjust_below | fo.adjust_above) != 0) {
+ /* Assuming pseudo_rasterization = false. */
+ if (FILL_DIRECT)
+ code = slant_into_trapezoids__fd(ll, flp, alp, y, y1);
+ else
+ code = slant_into_trapezoids__nd(ll, flp, alp, y, y1);
+ } else {
+ fixed ybot = max(y, fo.pbox->p.y);
+ fixed ytop = min(y1, fo.pbox->q.y);
- if (IS_SPOTAN) {
- /* We can't pass data through the device interface because
- we need to pass segment pointers. We're unhappy of that. */
- code = gx_san_trap_store((gx_device_spot_analyzer *)fo.dev,
- y, y1, flp->x_current, alp->x_current, flp->x_next, alp->x_next,
- flp->pseg, alp->pseg, flp->direction, alp->direction);
- } else {
- if (flp->end.x == flp->start.x && alp->end.x == alp->start.x) {
- if (FILL_ADJUST) {
- ybot = max(y - fo.adjust_below, fo.pbox->p.y);
- ytop = min(y1 + fo.adjust_above, fo.pbox->q.y);
- }
- if (ytop > ybot) {
- int yi = fixed2int_pixround(ybot);
- int hi = fixed2int_pixround(ytop) - yi;
- int xli = fixed2int_var_pixround(flp->end.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
- int xi = fixed2int_var_pixround(alp->end.x + (!FILL_ADJUST ? 0 : fo.adjust_right));
+ if (IS_SPOTAN) {
+ /* We can't pass data through the device interface because
+ we need to pass segment pointers. We're unhappy of that. */
+ code = gx_san_trap_store((gx_device_spot_analyzer *)fo.dev,
+ y, y1, flp->x_current, alp->x_current, flp->x_next, alp->x_next,
+ flp->pseg, alp->pseg, flp->direction, alp->direction);
+ } else {
+ if (flp->end.x == flp->start.x && alp->end.x == alp->start.x) {
+ if (FILL_ADJUST) {
+ ybot = max(y - fo.adjust_below, fo.pbox->p.y);
+ ytop = min(y1 + fo.adjust_above, fo.pbox->q.y);
+ }
+ if (ytop > ybot) {
+ int yi = fixed2int_pixround(ybot);
+ int hi = fixed2int_pixround(ytop) - yi;
+ int xli = fixed2int_var_pixround(flp->end.x - (!FILL_ADJUST ? 0 : fo.adjust_left));
+ int xi = fixed2int_var_pixround(alp->end.x + (!FILL_ADJUST ? 0 : fo.adjust_right));
#ifdef FILL_ZERO_WIDTH
- if ( (xli == xi) && (PSEUDO_RASTERIZATION ||
- (FILL_ADJUST && (fo.adjust_right | fo.adjust_left) != 0))) {
+ if ( (xli == xi) && (PSEUDO_RASTERIZATION ||
+ (FILL_ADJUST && (fo.adjust_right | fo.adjust_left) != 0))) {
#else
- if (PSEUDO_RASTERIZATION && xli == xi) {
+ if (PSEUDO_RASTERIZATION && xli == xi) {
#endif
- /*
- * The scan is empty but we should paint something
- * against a dropout. Choose one of two pixels which
- * is closer to the "axis".
- */
- fixed xx = int2fixed(xli);
+ /*
+ * The scan is empty but we should paint something
+ * against a dropout. Choose one of two pixels which
+ * is closer to the "axis".
+ */
+ fixed xx = int2fixed(xli);
- if (xx - flp->end.x < alp->end.x - xx)
- ++xi;
- else
- --xli;
- }
- vd_rect(flp->end.x, y, alp->end.x, y1, 1, VD_TRAP_COLOR);
- code = LOOP_FILL_RECTANGLE_DIRECT(&fo, xli, yi, xi - xli, hi);
- } else
- code = 0;
- } else if (ybot < ytop) {
- gs_fixed_edge le, re;
+ if (xx - flp->end.x < alp->end.x - xx)
+ ++xi;
+ else
+ --xli;
+ }
+ vd_rect(flp->end.x, y, alp->end.x, y1, 1, VD_TRAP_COLOR);
+ code = LOOP_FILL_RECTANGLE_DIRECT(&fo, xli, yi, xi - xli, hi);
+ } else
+ code = 0;
+ } else if (ybot < ytop) {
+ gs_fixed_edge le, re;
- le.start = flp->start;
- le.end = flp->end;
- re.start = alp->start;
- re.end = alp->end;
- vd_quad(flp->x_current, ybot, alp->x_current, ybot, alp->x_next, ytop, flp->x_next, ytop, 1, VD_TRAP_COLOR);
- if (PSEUDO_RASTERIZATION) {
- int flags = ftf_pseudo_rasterization;
+ le.start = flp->start;
+ le.end = flp->end;
+ re.start = alp->start;
+ re.end = alp->end;
+ vd_quad(flp->x_current, ybot, alp->x_current, ybot, alp->x_next, ytop, flp->x_next, ytop, 1, VD_TRAP_COLOR);
+ if (PSEUDO_RASTERIZATION) {
+ int flags = ftf_pseudo_rasterization;
- if (flp->start.x == alp->start.x && flp->start.y == y && alp->start.y == y)
- flags |= ftf_peak0;
- if (flp->end.x == alp->end.x && flp->end.y == y1 && alp->end.y == y1)
- flags |= ftf_peak0;
- if (FILL_DIRECT)
- code = gx_fill_trapezoid_cf_fd(fo.dev, &le, &re, ybot, ytop, flags, fo.pdevc, fo.lop);
- else
- code = gx_fill_trapezoid_cf_nd(fo.dev, &le, &re, ybot, ytop, flags, fo.pdevc, fo.lop);
- } else
- code = fo.fill_trap(fo.dev,
- &le, &re, ybot, ytop, false, fo.pdevc, fo.lop);
- } else
- code = 0;
- }
- if (PSEUDO_RASTERIZATION) {
- if (code < 0)
- return code;
- code = complete_margin(ll, flp, alp, y, y1);
- if (code < 0)
- return code;
- code = margin_interior(ll, flp, alp, y, y1);
- if (code < 0)
- return code;
- code = add_margin(ll, flp, alp, y, y1);
- if (code < 0)
- return code;
- code = process_h_lists(ll, plp, flp, alp, y, y1);
- plp = alp;
- }
- }
- if (code < 0)
- return code;
- }
- } else {
- /* No trapezoids generation needed. */
- if (PSEUDO_RASTERIZATION) {
- /* Process dropouts near trapezoids. */
- active_line *flp = NULL;
- int inside = 0;
+ if (flp->start.x == alp->start.x && flp->start.y == y && alp->start.y == y)
+ flags |= ftf_peak0;
+ if (flp->end.x == alp->end.x && flp->end.y == y1 && alp->end.y == y1)
+ flags |= ftf_peak0;
+ if (FILL_DIRECT)
+ code = gx_fill_trapezoid_cf_fd(fo.dev, &le, &re, ybot, ytop, flags, fo.pdevc, fo.lop);
+ else
+ code = gx_fill_trapezoid_cf_nd(fo.dev, &le, &re, ybot, ytop, flags, fo.pdevc, fo.lop);
+ } else
+ code = fo.fill_trap(fo.dev,
+ &le, &re, ybot, ytop, false, fo.pdevc, fo.lop);
+ } else
+ code = 0;
+ }
+ if (PSEUDO_RASTERIZATION) {
+ if (code < 0)
+ return code;
+ code = complete_margin(ll, flp, alp, y, y1);
+ if (code < 0)
+ return code;
+ code = margin_interior(ll, flp, alp, y, y1);
+ if (code < 0)
+ return code;
+ code = add_margin(ll, flp, alp, y, y1);
+ if (code < 0)
+ return code;
+ code = process_h_lists(ll, plp, flp, alp, y, y1);
+ plp = alp;
+ }
+ }
+ if (code < 0)
+ return code;
+ }
+ } else {
+ /* No trapezoids generation needed. */
+ if (PSEUDO_RASTERIZATION) {
+ /* Process dropouts near trapezoids. */
+ active_line *flp = NULL;
+ int inside = 0;
- if (SMART_WINDING)
- memset(ll->windings, 0, sizeof(ll->windings[0]) * ll->contour_count);
- for (alp = ll->x_list; alp != 0; alp = alp->next) {
- if (!INSIDE_PATH_P(inside, rule)) { /* i.e., outside */
- ADVANCE_WINDING(inside, alp, ll);
- if (INSIDE_PATH_P(inside, rule)) /* about to go in */
- flp = alp;
- continue;
- }
- /* We're inside a region being filled. */
- ADVANCE_WINDING(inside, alp, ll);
- if (INSIDE_PATH_P(inside, rule)) /* not about to go out */
- continue;
- code = continue_margin(ll, flp, alp, y, y1);
- if (code < 0)
- return code;
- code = process_h_lists(ll, plp, flp, alp, y, y1);
- plp = alp;
- if (code < 0)
- return code;
- }
- }
- }
- if (PSEUDO_RASTERIZATION && plp != 0) {
- code = process_h_lists(ll, plp, 0, 0, y, y1);
- if (code < 0)
- return code;
- }
- code = move_al_by_y(ll, y1);
- if (code < 0)
- return code;
- ll->h_list1 = ll->h_list0;
- ll->h_list0 = 0;
- y = y1;
+ if (SMART_WINDING)
+ memset(ll->windings, 0, sizeof(ll->windings[0]) * ll->contour_count);
+ for (alp = ll->x_list; alp != 0; alp = alp->next) {
+ if (!INSIDE_PATH_P(inside, rule)) { /* i.e., outside */
+ ADVANCE_WINDING(inside, alp, ll);
+ if (INSIDE_PATH_P(inside, rule)) /* about to go in */
+ flp = alp;
+ continue;
+ }
+ /* We're inside a region being filled. */
+ ADVANCE_WINDING(inside, alp, ll);
+ if (INSIDE_PATH_P(inside, rule)) /* not about to go out */
+ continue;
+ code = continue_margin(ll, flp, alp, y, y1);
+ if (code < 0)
+ return code;
+ code = process_h_lists(ll, plp, flp, alp, y, y1);
+ plp = alp;
+ if (code < 0)
+ return code;
+ }
+ }
+ }
+ if (PSEUDO_RASTERIZATION && plp != 0) {
+ code = process_h_lists(ll, plp, 0, 0, y, y1);
+ if (code < 0)
+ return code;
+ }
+ code = move_al_by_y(ll, y1);
+ if (code < 0)
+ return code;
+ ll->h_list1 = ll->h_list0;
+ ll->h_list0 = 0;
+ y = y1;
}
if (PSEUDO_RASTERIZATION) {
- code = process_h_lists(ll, 0, 0, 0, y, y + 1 /*stub*/);
- if (code < 0)
- return code;
- code = close_margins(fo.dev, ll, &ll->margin_set1);
- if (code < 0)
- return code;
- return close_margins(fo.dev, ll, &ll->margin_set0);
- }
+ code = process_h_lists(ll, 0, 0, 0, y, y + 1 /*stub*/);
+ if (code < 0)
+ return code;
+ code = close_margins(fo.dev, ll, &ll->margin_set1);
+ if (code < 0)
+ return code;
+ return close_margins(fo.dev, ll, &ll->margin_set0);
+ }
return 0;
}
-
diff --git a/gs/base/gxfillts.h b/gs/base/gxfillts.h
index d3e58f69e..ec146be5d 100644
--- a/gs/base/gxfillts.h
+++ b/gs/base/gxfillts.h
@@ -216,4 +216,3 @@ TEMPLATE_slant_into_trapezoids (const line_list *ll,
/* Otherwise, handle it as a slanted trapezoid. */
return fill_slant_adjust(ll, flp, alp, y, y1);
}
-
diff --git a/gs/base/gxfixed.h b/gs/base/gxfixed.h
index 5e2bb5b39..713757068 100644
--- a/gs/base/gxfixed.h
+++ b/gs/base/gxfixed.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,6 @@ typedef ulong ufixed; /* only used in a very few places */
# endif
#endif
-
#define fixed_0 0L
#define fixed_epsilon 1L
/*
@@ -88,21 +87,21 @@ typedef ulong ufixed; /* only used in a very few places */
#define fixed_pre_pixround(x) ((x)+_fixed_pixround_v)
#define fixed2int_pixround(x) fixed2int(fixed_pre_pixround(x))
#define fixed2int_pixround_perfect(x) ((x) < 0 && ((x) & (fixed_1 - fixed_epsilon)) == fixed_half \
- ? (int)_fixed_rshift(x) + 1 : fixed2int_pixround(x))
+ ? (int)_fixed_rshift(x) + 1 : fixed2int_pixround(x))
#define fixed_is_int(x) !((x)&_fixed_fraction_v)
#if ARCH_INTS_ARE_SHORT & !ARCH_IS_BIG_ENDIAN
/* Do some of the shifting and extraction ourselves. */
# define _fixed_hi(x) *((const uint *)&(x)+1)
# define _fixed_lo(x) *((const uint *)&(x))
# define fixed2int_var(x)\
- ((int)((_fixed_hi(x) << (16-_fixed_shift)) +\
- (_fixed_lo(x) >> _fixed_shift)))
+ ((int)((_fixed_hi(x) << (16-_fixed_shift)) +\
+ (_fixed_lo(x) >> _fixed_shift)))
# define fixed2int_var_rounded(x)\
- ((int)((_fixed_hi(x) << (16-_fixed_shift)) +\
- (((_fixed_lo(x) >> (_fixed_shift-1))+1)>>1)))
+ ((int)((_fixed_hi(x) << (16-_fixed_shift)) +\
+ (((_fixed_lo(x) >> (_fixed_shift-1))+1)>>1)))
# define fixed2int_var_ceiling(x)\
- (fixed2int_var(x) -\
- arith_rshift((int)-(_fixed_lo(x) & _fixed_fraction_v), _fixed_shift))
+ (fixed2int_var(x) -\
+ arith_rshift((int)-(_fixed_lo(x) & _fixed_fraction_v), _fixed_shift))
#else
/* Use reasonable definitions. */
# define fixed2int_var(x) fixed2int(x)
@@ -178,9 +177,9 @@ fixed fixed_mult_quo(fixed A, fixed B, fixed C);
* truncated to 'fixed'; *ey is 1 iff the precise Y coordinate of
* the intersection is greater than *ry (used by the shading algorithm).
*/
-bool
-gx_intersect_small_bars(fixed q0x, fixed q0y, fixed q1x, fixed q1y, fixed q2x, fixed q2y,
- fixed q3x, fixed q3y, fixed *ry, fixed *ey);
+bool
+gx_intersect_small_bars(fixed q0x, fixed q0y, fixed q1x, fixed q1y, fixed q2x, fixed q2y,
+ fixed q3x, fixed q3y, fixed *ry, fixed *ey);
/*
* The macros all use R for the (fixed) result, FB for the second (float)
diff --git a/gs/base/gxfmap.h b/gs/base/gxfmap.h
index 24fe69ee9..3ac28823c 100644
--- a/gs/base/gxfmap.h
+++ b/gs/base/gxfmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,8 +81,8 @@ frac gx_color_frac_map(frac, const frac *); /* in gxcmap.c */
# define byte_to_tmx(b) ((b) >> (8 - log2_transfer_map_size))
#else
# define byte_to_tmx(b)\
- (((b) << (log2_transfer_map_size - 8)) +\
- ((b) >> (16 - log2_transfer_map_size)))
+ (((b) << (log2_transfer_map_size - 8)) +\
+ ((b) >> (16 - log2_transfer_map_size)))
#endif
#define gx_map_color_frac_byte(pgs,b,m)\
(pgs->m->values[byte_to_tmx(b)])
diff --git a/gs/base/gxfont.h b/gs/base/gxfont.h
index 2909db839..b2a0f606d 100644
--- a/gs/base/gxfont.h
+++ b/gs/base/gxfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -120,7 +120,7 @@ typedef struct gs_font_info_s {
GC_CONST_STRING_ELT(gs_font_info_t, FullName)\
};\
gs_public_st_basic(st_gs_font_info, gs_font_info_t, "gs_font_info_t",\
- gs_font_info_ptrs, gs_font_info_data)
+ gs_font_info_ptrs, gs_font_info_data)
/*
* Define the structure used to return information about a glyph.
@@ -151,9 +151,9 @@ typedef struct gs_glyph_info_s {
int num_pieces; /* # of pieces if composite, 0 if not */
#define GLYPH_INFO_PIECES 16
gs_glyph *pieces; /* pieces are stored here: the caller must */
- /* preset pieces if INFO_PIECES is set. */
+ /* preset pieces if INFO_PIECES is set. */
#define GLYPH_INFO_OUTLINE_WIDTHS 32 /* return unmodified widths, see above */
-#define GLYPH_INFO_VVECTOR0 64
+#define GLYPH_INFO_VVECTOR0 64
#define GLYPH_INFO_VVECTOR1 128 /* must be VVECTOR0 << 1 */
#define GLYPH_INFO_CDEVPROC 256 /* Allow CDevProc callout. */
} gs_glyph_info_t;
@@ -193,7 +193,7 @@ typedef struct gs_font_procs_s {
#define font_proc_font_info(proc)\
int proc(gs_font *font, const gs_point *pscale, int members,\
- gs_font_info_t *info)
+ gs_font_info_t *info)
font_proc_font_info((*font_info));
/*
@@ -242,7 +242,7 @@ typedef struct gs_font_procs_s {
#define font_proc_enumerate_glyph(proc)\
int proc(gs_font *font, int *pindex, gs_glyph_space_t glyph_space,\
- gs_glyph *pglyph)
+ gs_glyph *pglyph)
font_proc_enumerate_glyph((*enumerate_glyph));
/*
@@ -264,13 +264,13 @@ typedef struct gs_font_procs_s {
* Currently we do not handle requests, in which GLYPH_INFO_VVECTOR0
* is set, but GLYPH_INFO_WIDTH0 is not. Same for GLYPH_INFO_VVECTOR1
* and GLYPH_INFO_WIDTH1. Also requests, in which both GLYPH_INFO_WIDTH0 and
- * GLYPH_INFO_WIDTH1 are set, may work wrongly. Such requests look never used
+ * GLYPH_INFO_WIDTH1 are set, may work wrongly. Such requests look never used
* and debugged, and the implementation code requires improvements.
*/
#define font_proc_glyph_info(proc)\
int proc(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,\
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
font_proc_glyph_info((*glyph_info));
/*
@@ -286,7 +286,7 @@ typedef struct gs_font_procs_s {
#define font_proc_glyph_outline(proc)\
int proc(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,\
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
font_proc_glyph_outline((*glyph_outline));
/*
@@ -375,33 +375,33 @@ typedef struct gs_font_name_s {
* ****** procedures are not automatically inherited.
*/
#define gs_font_common\
- gs_font *next, *prev; /* chain for original font list or */\
- /* scaled font cache */\
- gs_memory_t *memory; /* allocator for this font */\
- gs_font_dir *dir; /* directory where registered */\
- bool is_resource;\
- gs_notify_list_t notify_list; /* clients to notify when freeing */\
- gs_id id; /* internal ID (no relation to UID) */\
- gs_font *base; /* original (unscaled) base font */\
- void *client_data; /* additional client data */\
- gs_matrix FontMatrix;\
- gs_matrix orig_FontMatrix; /* The original font matrix or zeros. */\
- font_type FontType;\
- bool BitmapWidths;\
- fbit_type ExactSize, InBetweenSize, TransformedChar;\
- int WMode; /* 0 or 1 */\
- int PaintType; /* PaintType for Type 1/4/42 fonts, */\
- /* 0 for others */\
- float StrokeWidth; /* StrokeWidth for Type 1/4/42 */\
- /* fonts (if present), 0 for others */\
- bool is_cached; /* Prevents redundant executions of */\
- /* gs_purge_font_from_char_caches, */\
- /* when it is called from 'font_restore' */\
- /* and from gx_font_finalize. */\
- gs_font_procs procs;\
- /* We store both the FontDirectory key (key_name) and, */\
- /* if present, the FontName (font_name). */\
- gs_font_name key_name, font_name
+ gs_font *next, *prev; /* chain for original font list or */\
+ /* scaled font cache */\
+ gs_memory_t *memory; /* allocator for this font */\
+ gs_font_dir *dir; /* directory where registered */\
+ bool is_resource;\
+ gs_notify_list_t notify_list; /* clients to notify when freeing */\
+ gs_id id; /* internal ID (no relation to UID) */\
+ gs_font *base; /* original (unscaled) base font */\
+ void *client_data; /* additional client data */\
+ gs_matrix FontMatrix;\
+ gs_matrix orig_FontMatrix; /* The original font matrix or zeros. */\
+ font_type FontType;\
+ bool BitmapWidths;\
+ fbit_type ExactSize, InBetweenSize, TransformedChar;\
+ int WMode; /* 0 or 1 */\
+ int PaintType; /* PaintType for Type 1/4/42 fonts, */\
+ /* 0 for others */\
+ float StrokeWidth; /* StrokeWidth for Type 1/4/42 */\
+ /* fonts (if present), 0 for others */\
+ bool is_cached; /* Prevents redundant executions of */\
+ /* gs_purge_font_from_char_caches, */\
+ /* when it is called from 'font_restore' */\
+ /* and from gx_font_finalize. */\
+ gs_font_procs procs;\
+ /* We store both the FontDirectory key (key_name) and, */\
+ /* if present, the FontName (font_name). */\
+ gs_font_name key_name, font_name
/*typedef struct gs_font_s gs_font; *//* in gsfont.h and other places */
struct gs_font_s {
gs_font_common;
@@ -428,8 +428,8 @@ extern_st(st_gs_font_ptr_element);
/* Does not set: FontMatrix, FontType, key_name, font_name. */
gs_font *
gs_font_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
- const gs_font_procs *procs, gs_font_dir *dir,
- client_name_t cname);
+ const gs_font_procs *procs, gs_font_dir *dir,
+ client_name_t cname);
/* Initialize the notification list for a font. */
void gs_font_notify_init(gs_font *font);
@@ -440,9 +440,9 @@ void gs_font_notify_init(gs_font *font);
* such client must unregister itself when *it* is freed.
*/
int gs_font_notify_register(gs_font *font, gs_notify_proc_t proc,
- void *proc_data);
+ void *proc_data);
int gs_font_notify_unregister(gs_font *font, gs_notify_proc_t proc,
- void *proc_data);
+ void *proc_data);
#ifndef FAPI_server_DEFINED
#define FAPI_server_DEFINED
@@ -451,14 +451,14 @@ typedef struct FAPI_server_s FAPI_server;
/* Define a base (not composite) font. */
#define gs_font_base_common\
- gs_font_common;\
- gs_rect FontBBox;\
- gs_uid UID;\
- FAPI_server *FAPI; \
+ gs_font_common;\
+ gs_rect FontBBox;\
+ gs_uid UID;\
+ FAPI_server *FAPI; \
void *FAPI_font_data; \
- gs_encoding_index_t encoding_index;\
- gs_encoding_index_t nearest_encoding_index /* (may be >= 0 even if */\
- /* encoding_index = -1) */
+ gs_encoding_index_t encoding_index;\
+ gs_encoding_index_t nearest_encoding_index /* (may be >= 0 even if */\
+ /* encoding_index = -1) */
#ifndef gs_font_base_DEFINED
# define gs_font_base_DEFINED
typedef struct gs_font_base_s gs_font_base;
@@ -478,8 +478,8 @@ extern_st(st_gs_font_base);
/* Does not set: same elements as gs_alloc_font. */
gs_font_base *
gs_font_base_alloc(gs_memory_t *mem, gs_memory_type_ptr_t pstype,
- const gs_font_procs *procs, gs_font_dir *dir,
- client_name_t cname);
+ const gs_font_procs *procs, gs_font_dir *dir,
+ client_name_t cname);
/* Define a string to interact with unique_name in lib/pdf_font.ps .
The string is used to resolve glyph name conflict while
diff --git a/gs/base/gxfont0.h b/gs/base/gxfont0.h
index b1bd2f173..443ced69f 100644
--- a/gs/base/gxfont0.h
+++ b/gs/base/gxfont0.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxfont0c.h b/gs/base/gxfont0c.h
index 949724da9..20a34a8be 100644
--- a/gs/base/gxfont0c.h
+++ b/gs/base/gxfont0c.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,8 +27,8 @@
* psmat == NULL means use the identity matrix.
*/
int gs_font_type0_from_cidfont(gs_font_type0 **ppfont0, gs_font *font,
- int wmode, const gs_matrix *psmat,
- gs_memory_t *mem);
+ int wmode, const gs_matrix *psmat,
+ gs_memory_t *mem);
/*
* Create a Type 0 font wrapper for a Type 42 font (converted to a Type 2
@@ -36,7 +36,7 @@ int gs_font_type0_from_cidfont(gs_font_type0 **ppfont0, gs_font *font,
* See gs_cmap_from_type42_cmap below for details.
*/
int gs_font_type0_from_type42(gs_font_type0 **ppfont0, gs_font_type42 *pfont42,
- int wmode, bool use_cmap, gs_memory_t *mem);
+ int wmode, bool use_cmap, gs_memory_t *mem);
/* Exported by gsfcid2.c */
@@ -44,13 +44,13 @@ int gs_font_type0_from_type42(gs_font_type0 **ppfont0, gs_font_type42 *pfont42,
* Create a Type 2 CIDFont from a Type 42 font.
*/
int gs_font_cid2_from_type42(gs_font_cid2 **ppfcid, gs_font_type42 *pfont42,
- int wmode, gs_memory_t *mem);
+ int wmode, gs_memory_t *mem);
/*
* Create a CMap from a TrueType cmap (Platform 3, Encoding 1, Format 4 only).
* The resulting CMap is marked as being Unicode-based.
*/
int gs_cmap_from_type42_cmap(gs_cmap_t **ppcmap, gs_font_type42 *pfont42,
- int wmode, gs_memory_t *mem);
+ int wmode, gs_memory_t *mem);
#endif /* gxfont0c_INCLUDED */
diff --git a/gs/base/gxfont1.h b/gs/base/gxfont1.h
index 7fc20fdc7..8fdb68fa3 100644
--- a/gs/base/gxfont1.h
+++ b/gs/base/gxfont1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,17 +36,17 @@ typedef struct gs_font_type1_s gs_font_type1;
* specification, but some fonts have arbitrary floats here.
*/
#define zone_table(size)\
- struct {\
- int count;\
- float values[(size)*2];\
- }
+ struct {\
+ int count;\
+ float values[(size)*2];\
+ }
#define float_array(size)\
- struct {\
- int count;\
- float values[size];\
- }
+ struct {\
+ int count;\
+ float values[size];\
+ }
#define stem_table(size)\
- float_array(size)
+ float_array(size)
#ifndef gs_type1_data_DEFINED
#define gs_type1_data_DEFINED
@@ -58,12 +58,12 @@ typedef struct gs_type1_data_procs_s {
/* Get the data for any glyph. Return >= 0 or < 0 as usual. */
int (*glyph_data)(gs_font_type1 * pfont, gs_glyph glyph,
- gs_glyph_data_t *pgd);
+ gs_glyph_data_t *pgd);
/* Get the data for a Subr. Return like glyph_data. */
int (*subr_data)(gs_font_type1 * pfont, int subr_num, bool global,
- gs_glyph_data_t *pgd);
+ gs_glyph_data_t *pgd);
/*
* Get the data for a seac character, including the glyph and/or the
@@ -73,7 +73,7 @@ typedef struct gs_type1_data_procs_s {
*/
int (*seac_data)(gs_font_type1 * pfont, int ccode,
- gs_glyph * pglyph, gs_const_string *gstr, gs_glyph_data_t *pgd);
+ gs_glyph * pglyph, gs_const_string *gstr, gs_glyph_data_t *pgd);
/*
* Push (a) value(s) onto the client ('PostScript') stack during
@@ -82,7 +82,7 @@ typedef struct gs_type1_data_procs_s {
*/
int (*push_values)(void *callback_data, const fixed *values,
- int count);
+ int count);
/* Pop a value from the client stack. */
@@ -103,15 +103,15 @@ struct gs_type1_data_s {
void *proc_data; /* data for procs */
gs_font_base *parent; /* the type 9 font, if this font is is a type 9 descendent. */
int lenIV; /* -1 means no encryption */
- /* (undocumented feature!) */
+ /* (undocumented feature!) */
uint subroutineNumberBias; /* added to operand of callsubr */
- /* (undocumented feature!) */
- /* Type 2 additions */
+ /* (undocumented feature!) */
+ /* Type 2 additions */
uint gsubrNumberBias; /* added to operand of callgsubr */
long initialRandomSeed;
fixed defaultWidthX;
fixed nominalWidthX;
- /* End of Type 2 additions */
+ /* End of Type 2 additions */
/* For a description of the following hint information, */
/* see chapter 5 of the "Adobe Type 1 Font Format" book. */
int BlueFuzz;
@@ -163,6 +163,6 @@ font_proc_glyph_info(gs_type1_glyph_info);
* This is exported only for the benefit of font copying.
*/
int gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
- const gs_glyph_data_t *pgd, gs_char *chars);
+ const gs_glyph_data_t *pgd, gs_char *chars);
#endif /* gxfont1_INCLUDED */
diff --git a/gs/base/gxfont42.h b/gs/base/gxfont42.h
index fc39ff4c6..91dda0d80 100644
--- a/gs/base/gxfont42.h
+++ b/gs/base/gxfont42.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,12 +53,12 @@ typedef enum gs_type42_metrics_options_s {
#define gs_type42_metrics_options_sbw_requested(a) (~(a)&gs_type42_metrics_options_BBOX)
#define gs_type42_metrics_options_bbox_requested(a)((a)&6)
-/* Export the default get_metrics procedure.
+/* Export the default get_metrics procedure.
The length of sbw is >=4 when bbox in not requested,
and 8 otherwise.
*/
int gs_type42_default_get_metrics(gs_font_type42 *pfont, uint glyph_index,
- gs_type42_metrics_options_t options, float *sbw);
+ gs_type42_metrics_options_t options, float *sbw);
typedef struct gs_type42_mtx_s {
uint numMetrics; /* num*Metrics from [hv]hea */
@@ -75,23 +75,23 @@ struct gs_type42_data_s {
*/
uint (*get_glyph_index)(gs_font_type42 *pfont, gs_glyph glyph);
int (*get_outline)(gs_font_type42 *pfont, uint glyph_index,
- gs_glyph_data_t *pgd);
- int (*get_metrics)(gs_font_type42 *pfont, uint glyph_index,
- gs_type42_metrics_options_t options,
- float *sbw_bbox/* See comment for gs_type42_default_get_metrics */);
+ gs_glyph_data_t *pgd);
+ int (*get_metrics)(gs_font_type42 *pfont, uint glyph_index,
+ gs_type42_metrics_options_t options,
+ float *sbw_bbox/* See comment for gs_type42_default_get_metrics */);
uint (*substitute_glyph_index_vertical)(gs_font_type42 *pfont, uint glyph_index,
- int WMode, gs_glyph glyph);
+ int WMode, gs_glyph glyph);
/* The following are cached values. */
ulong cmap; /* offset to cmap table (not used by */
- /* renderer, only here for clients) */
+ /* renderer, only here for clients) */
ulong glyf; /* offset to glyf table */
uint unitsPerEm; /* from head */
uint indexToLocFormat; /* from head */
gs_type42_mtx_t metrics[2]; /* hhea/hmtx, vhea/vmtx (indexed by WMode) */
ulong loca; /* offset to loca table */
- ulong name_offset; /* offset to name table */
- ulong os2_offset; /* offset to OS/2 table */
+ ulong name_offset; /* offset to name table */
+ ulong os2_offset; /* offset to OS/2 table */
/*
* TrueType fonts specify the number of glyphs in two different ways:
* the size of the loca table, and an explicit value in maxp. Currently
@@ -133,7 +133,7 @@ extern_st(st_gs_font_type42);
* Note that this initializes the type42_data procedures other than
* string_proc, and the font procedures as well.
* USE_ttfReader subclasses gs_font_type42 with ttfReader or without.
- * FAPI will disable ttfReader as well.
+ * FAPI will disable ttfReader as well.
*/
int gs_type42_font_init(gs_font_type42 *pfont, int subfontid);
@@ -145,7 +145,7 @@ int gs_type42_read_data(gs_font_type42 * pfont, ulong pos, uint length, byte *bu
#define READ_SFNTS(pfont, pos, length, buf)\
BEGIN\
if (length > sizeof(buf))\
- return_error(gs_error_unregistered);/* Must not happen. */\
+ return_error(gs_error_unregistered);/* Must not happen. */\
code = gs_type42_read_data(pfont, (ulong)(pos), length, buf);\
if ( code < 0 ) return code;\
END
@@ -154,15 +154,15 @@ int gs_type42_read_data(gs_font_type42 * pfont, ulong pos, uint length, byte *bu
/* Append the outline of a TrueType character to a path. */
int gs_type42_append(uint glyph_index, gs_state * pgs,
- gx_path * ppath, gs_text_enum_t *penum, gs_font *pfont,
- bool charpath_flag);
+ gx_path * ppath, gs_text_enum_t *penum, gs_font *pfont,
+ bool charpath_flag);
/* Get the metrics of a TrueType character. */
int gs_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
- float psbw[4]);
+ float psbw[4]);
int gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
- gs_glyph_data_t *pgd);
+ gs_glyph_data_t *pgd);
/* Export the font procedures so they can be called from the interpreter. */
font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
@@ -171,15 +171,15 @@ font_proc_glyph_outline(gs_type42_glyph_outline);
/* Get glyph info by glyph index. */
int gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info, uint glyph_index);
+ int members, gs_glyph_info_t *info, uint glyph_index);
int gs_type42_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info);
+ gs_font_info_t *info);
int gs_truetype_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info);
+ gs_font_info_t *info);
uint gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_index,
- int WMode, gs_glyph glyph);
+ int WMode, gs_glyph glyph);
/* Get next component in a composite TrueType glyph. */
void gs_type42_parse_component(const byte **pdata, uint *pflags, gs_matrix_fixed *psmat,
diff --git a/gs/base/gxfrac.h b/gs/base/gxfrac.h
index 5365bf1d3..73534e4fc 100644
--- a/gs/base/gxfrac.h
+++ b/gs/base/gxfrac.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxftype.h b/gs/base/gxftype.h
index c9362ae7a..d7a8bf3f5 100644
--- a/gs/base/gxftype.h
+++ b/gs/base/gxftype.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxfunc.h b/gs/base/gxfunc.h
index 2fe03a089..73d9c9967 100644
--- a/gs/base/gxfunc.h
+++ b/gs/base/gxfunc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,21 +51,21 @@ int fn_common_get_params(const gs_function_t *pfn, gs_param_list *plist);
* Copy an array of numeric values when scaling a function.
*/
void *fn_copy_values(const void *pvalues, int count, int size,
- gs_memory_t *mem);
+ gs_memory_t *mem);
/*
* If necessary, scale the Range or Decode array for fn_make_scaled.
* Note that we must always allocate a new array.
*/
int fn_scale_pairs(const float **ppvalues, const float *pvalues, int npairs,
- const gs_range_t *pranges, gs_memory_t *mem);
+ const gs_range_t *pranges, gs_memory_t *mem);
/*
* Scale the generic part of a function (Domain and Range).
* The client must have copied the parameters already.
*/
int fn_common_scale(gs_function_t *psfn, const gs_function_t *pfn,
- const gs_range_t *pranges, gs_memory_t *mem);
+ const gs_range_t *pranges, gs_memory_t *mem);
/* Serialize. */
int fn_common_serialize(const gs_function_t * pfn, stream *s);
diff --git a/gs/base/gxgetbit.h b/gs/base/gxgetbit.h
index f6edb9c0d..27f6df580 100644
--- a/gs/base/gxgetbit.h
+++ b/gs/base/gxgetbit.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,14 +78,14 @@ struct gs_get_bits_params_s {
/* Try to implement get_bits_rectangle by returning a pointer. */
int gx_get_bits_return_pointer(gx_device * dev, int x, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- byte * stored_base);
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ byte * stored_base);
/* Implement get_bits_rectangle by copying. */
int gx_get_bits_copy(gx_device * dev, int x, int w, int h,
- gs_get_bits_params_t * params,
- const gs_get_bits_params_t *stored,
- const byte * src_base, uint dev_raster);
+ gs_get_bits_params_t * params,
+ const gs_get_bits_params_t *stored,
+ const byte * src_base, uint dev_raster);
#endif /* gxgetbit_INCLUDED */
diff --git a/gs/base/gxhintn.c b/gs/base/gxhintn.c
index 4194e8a9c..8a5fd0eb2 100644
--- a/gs/base/gxhintn.c
+++ b/gs/base/gxhintn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,8 +37,6 @@
- Test Adobe compatibility for rotated/skewed glyphs.
*/
-
-
/* Stem processing basics :
(See the glyph AE in Times-Roman by Adobe.)
@@ -61,9 +59,9 @@
3. The TT interpreter aligned stem3 with centering the middle stem.
4. If a stem boundary corresponds to a pole aligned with an alignment zone,
- pass aligned coordinate to the stem command.
+ pass aligned coordinate to the stem command.
Use the stem boundary longitude middle point for alignment with
- skewed or rotated matrix. Use standard stem width for computing
+ skewed or rotated matrix. Use standard stem width for computing
opposite coordinates.
4a. If a stem width rounds to several StemSnap* element,
@@ -82,7 +80,7 @@
8. Interpolate unaligned poles.
- 9. After the alignment is done, it is desirable to check for
+ 9. After the alignment is done, it is desirable to check for
anomalous negative contours and fix them, but we have no
good algorithm for this. The rasterizer must be tolerant
to such contours (which may have self-crosses, self-contacts,
@@ -93,7 +91,7 @@
/* Dotsection processing basics :
If stem replacement occures, dotsection to be ignored.
- To check this properly, we test whether extremal poles of contour
+ To check this properly, we test whether extremal poles of contour
were actually aligned with stem hints.
If a contour was aligned with stem hints by both X and Y,
@@ -102,7 +100,7 @@
Otherwise if dotsection center falls near vstem axis,
we align it by X with the axis. Otherwise we align
it by X to half-pixel. Then we align the center by Y to
- half-pixel, and shift entire contour to satisfy
+ half-pixel, and shift entire contour to satisfy
the alignment of the center.
*/
@@ -125,7 +123,7 @@
#define ADOBE_OVERSHOOT_COMPATIBILIY 0
#define ADOBE_SHIFT_CHARPATH 0
-/* The CONTRAST_STEMS option aligns one of two stem boundaries
+/* The CONTRAST_STEMS option aligns one of two stem boundaries
to integral pixel boundary when AlignToPixels = 0.
It gives more contrast stems, because a bigger part
of boldness is concentrated in smaller number of pixels.
@@ -155,8 +153,8 @@ static const int32_t FFFFF000 = ~(int32_t)0xFFF; /* = ~(((int32_t)1 << split_bit
/* Constants above must satisfy expressions given in comments. */
/* Computes (a*b)>>s, s <= 12 */
-static inline int32_t mul_shift(int24 a, int19 b, unsigned int s)
-{
+static inline int32_t mul_shift(int24 a, int19 b, unsigned int s)
+{
#ifdef HAVE_INT64_T
return ( (int64_t)a * (int64_t)b ) >> s; /* unrounded result */
#else
@@ -168,7 +166,7 @@ static inline int32_t mul_shift(int24 a, int19 b, unsigned int s)
}
/* Computes (a*b)>>s, s <= 12, with rounding */
-static inline int32_t mul_shift_round(int24 a, int19 b, unsigned int s)
+static inline int32_t mul_shift_round(int24 a, int19 b, unsigned int s)
{
#ifdef HAVE_INT64_T
return (( ( (int64_t)a * (int64_t)b ) >> (s - 1)) + 1) >> 1;
@@ -211,7 +209,7 @@ static inline int double_matrix__invert_to(const double_matrix * this, double_ma
{ double det = this->xx * this->yy - this->xy * this->yx;
if (fabs(det) * 1000000 <= fabs(this->xx) + fabs(this->xy) + fabs(this->yx) + fabs(this->yy))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
m->xx = this->yy / det;
m->xy = -this->xy / det;
m->yx = -this->yx / det;
@@ -223,7 +221,7 @@ static void fraction_matrix__drop_bits(fraction_matrix * this, unsigned int bits
{ this->xx = shift_rounded(this->xx, bits);
this->xy = shift_rounded(this->xy, bits);
this->yx = shift_rounded(this->yx, bits);
- this->yy = shift_rounded(this->yy, bits);
+ this->yy = shift_rounded(this->yy, bits);
this->denominator >>= bits;
this->bitshift -= bits;
}
@@ -237,26 +235,26 @@ static void fraction_matrix__set(fraction_matrix * this, const double_matrix * p
this->bitshift = matrix_bits - matrix_exp;
if (this->bitshift >= sizeof( this->denominator) * 8) {
- this->denominator = 0;
- this->xx = this->xy = this->yx = this->yy = 0;
+ this->denominator = 0;
+ this->xx = this->xy = this->yx = this->yy = 0;
} else {
- this->denominator = 1 << this->bitshift;
- /* Round towards zero for a better view of mirrored characters : */
- this->xx = (int32_t)(pmat->xx * this->denominator + 0.5);
- this->xy = (int32_t)(pmat->xy * this->denominator + 0.5);
- this->yx = (int32_t)(pmat->yx * this->denominator + 0.5);
- this->yy = (int32_t)(pmat->yy * this->denominator + 0.5);
- m = Max(Max(any_abs(this->xx), any_abs(this->xy)), Max(any_abs(this->yx), any_abs(this->yy)));
- unused = frexp(m, &matrix_exp);
- if (matrix_exp > matrix_bits)
- fraction_matrix__drop_bits(this, matrix_exp - matrix_bits);
+ this->denominator = 1 << this->bitshift;
+ /* Round towards zero for a better view of mirrored characters : */
+ this->xx = (int32_t)(pmat->xx * this->denominator + 0.5);
+ this->xy = (int32_t)(pmat->xy * this->denominator + 0.5);
+ this->yx = (int32_t)(pmat->yx * this->denominator + 0.5);
+ this->yy = (int32_t)(pmat->yy * this->denominator + 0.5);
+ m = Max(Max(any_abs(this->xx), any_abs(this->xy)), Max(any_abs(this->yx), any_abs(this->yy)));
+ unused = frexp(m, &matrix_exp);
+ if (matrix_exp > matrix_bits)
+ fraction_matrix__drop_bits(this, matrix_exp - matrix_bits);
}
}
static inline int fraction_matrix__to_double(const fraction_matrix * this, double_matrix * pmat)
-{
+{
if (this->denominator == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
pmat->xx = (double)this->xx / this->denominator;
pmat->xy = (double)this->xy / this->denominator;
pmat->yx = (double)this->yx / this->denominator;
@@ -270,10 +268,10 @@ static int fraction_matrix__invert_to(const fraction_matrix * this, fraction_mat
code = fraction_matrix__to_double(this, &M);
if (code < 0)
- return code;
+ return code;
code = double_matrix__invert_to(&M, &m);
if (code < 0)
- return code;
+ return code;
fraction_matrix__set(pmat, &m);
return 0;
}
@@ -285,7 +283,6 @@ static inline int32_t fraction_matrix__transform_y(fraction_matrix *this, int24
{ return mul_shift_round(x, this->xy, s) + mul_shift_round(y, this->yy, s);
}
-
/*--------------------------- friends ------------------------------*/
static inline int ranger_step_f(int i, int beg, int end)
@@ -297,24 +294,24 @@ static inline int ranger_step_b(int i, int beg, int end)
}
static inline fixed o2d(const t1_hinter *h, t1_hinter_space_coord v)
-{
+{
int s = h->g2o_fraction_bits - _fixed_shift;
if (s >= 1)
- return ((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1;
+ return ((v >> (h->g2o_fraction_bits - _fixed_shift - 1)) + 1) >> 1;
else if (s == 0)
- return v;
+ return v;
else
- return v << -s;
+ return v << -s;
}
static inline fixed d2o(const t1_hinter *h, t1_hinter_space_coord v)
{ int s = h->g2o_fraction_bits - _fixed_shift;
if (s >= 0)
- return v << s;
+ return v << s;
else
- return v >> -s;
+ return v >> -s;
}
static inline void g2o(t1_hinter * h, t1_glyph_space_coord gx, t1_glyph_space_coord gy, t1_hinter_space_coord *ox, t1_hinter_space_coord *oy)
@@ -354,7 +351,7 @@ static inline void o2g_float(t1_hinter * h, t1_hinter_space_coord ox, t1_hinter_
/* --------------------- t1_hint class members ---------------------*/
static void t1_hint__set_aligned_coord(t1_hint * this, t1_glyph_space_coord gc, t1_pole * pole, enum t1_align_type align, int quality)
-{ t1_glyph_space_coord g = (this->type == hstem ? pole->gy : pole->gx);
+{ t1_glyph_space_coord g = (this->type == hstem ? pole->gy : pole->gx);
if (any_abs(this->g0 - g) < any_abs(this->g1 - g)) {
if (this->aligned0 <= align && this->q0 > quality)
@@ -380,7 +377,7 @@ static void t1_hinter__paint_glyph(t1_hinter * this, bool aligned)
char buf[15];
if (!vd_enabled)
- return;
+ return;
# if VD_PAINT_POLE_IDS
for(i = 0; i < this->contour_count; i++) {
int beg_pole = this->contour[i];
@@ -424,15 +421,15 @@ static void t1_hinter__paint_raster_grid(t1_hinter * this)
double j; /* 'long' can overflow */
unsigned long c0 = RGB(192, 192, 192), c1 = RGB(64, 64, 64);
t1_hinter_space_coord min_ox, max_ox, min_oy, max_oy;
- long div_x = this->g2o_fraction, div_xx = div_x << this->log2_pixels_x;
- long div_y = this->g2o_fraction, div_yy = div_y << this->log2_pixels_y;
+ long div_x = this->g2o_fraction, div_xx = div_x << this->log2_pixels_x;
+ long div_y = this->g2o_fraction, div_yy = div_y << this->log2_pixels_y;
long ext_x = div_x * 5;
long ext_y = div_y * 5;
long sx = this->orig_ox % div_xx;
long sy = this->orig_oy % div_yy;
if (!vd_enabled)
- return;
+ return;
g2o(this, this->pole[0].gx, this->pole[0].gy, &min_ox, &min_oy);
max_ox = min_ox, max_oy = min_oy;
/* Compute BBox in outliner's space : */
@@ -452,7 +449,7 @@ static void t1_hinter__paint_raster_grid(t1_hinter * this)
/* Paint columns : */
for (j = min_ox / div_x * div_x; j < (double)max_ox + div_x; j += div_x) {
t1_glyph_space_coord gx0, gy0, gx1, gy1;
- bool pix = ((int)j / div_xx * div_xx == (int)j);
+ bool pix = ((int)j / div_xx * div_xx == (int)j);
o2g_float(this, (int)j - sx, min_oy - sy, &gx0, &gy0); /* o2g may overflow here due to ext. */
o2g_float(this, (int)j - sx, max_oy - sy, &gx1, &gy1);
@@ -461,7 +458,7 @@ static void t1_hinter__paint_raster_grid(t1_hinter * this)
/* Paint rows : */
for (j = min_oy / div_y * div_y; j < max_oy + div_y; j += div_y) {
t1_glyph_space_coord gx0, gy0, gx1, gy1;
- bool pix = ((int)j / div_yy * div_yy == (int)j);
+ bool pix = ((int)j / div_yy * div_yy == (int)j);
o2g_float(this, min_ox - sx, (int)j - sy, &gx0, &gy0);
o2g_float(this, max_ox - sx, (int)j - sy, &gx1, &gy1);
@@ -495,7 +492,7 @@ void t1_hinter__init(t1_hinter * this, gx_path *output_path)
this->max_stem_snap_count[0] = count_of(this->stem_snap0[0]);
this->max_stem_snap_count[1] = count_of(this->stem_snap0[1]);
this->max_stem_snap_vote_count = count_of(this->stem_snap_vote0);
-
+
this->pole = this->pole0;
this->hint = this->hint0;
this->zone = this->zone0;
@@ -532,25 +529,25 @@ void t1_hinter__init(t1_hinter * this, gx_path *output_path)
static inline void t1_hinter__free_arrays(t1_hinter * this)
{ if (this->pole != this->pole0)
- gs_free_object(this->memory, this->pole, s_pole_array);
+ gs_free_object(this->memory, this->pole, s_pole_array);
if (this->hint != this->hint0)
- gs_free_object(this->memory, this->hint, s_hint_array);
+ gs_free_object(this->memory, this->hint, s_hint_array);
if (this->zone != this->zone0)
- gs_free_object(this->memory, this->zone, s_zone_array);
+ gs_free_object(this->memory, this->zone, s_zone_array);
if (this->contour != this->contour0)
- gs_free_object(this->memory, this->contour, s_contour_array);
+ gs_free_object(this->memory, this->contour, s_contour_array);
if (this->subglyph != this->subglyph0)
- gs_free_object(this->memory, this->subglyph, s_subglyph_array);
+ gs_free_object(this->memory, this->subglyph, s_subglyph_array);
if (this->hint_range != this->hint_range0)
- gs_free_object(this->memory, this->hint_range, s_hint_range_array);
+ gs_free_object(this->memory, this->hint_range, s_hint_range_array);
if (this->hint_applying != this->hint_applying0)
- gs_free_object(this->memory, this->hint_applying, s_hint_applying_array);
+ gs_free_object(this->memory, this->hint_applying, s_hint_applying_array);
if (this->stem_snap[0] != this->stem_snap0[0])
- gs_free_object(this->memory, this->stem_snap[0], s_stem_snap_array);
+ gs_free_object(this->memory, this->stem_snap[0], s_stem_snap_array);
if (this->stem_snap[1] != this->stem_snap0[1])
- gs_free_object(this->memory, this->stem_snap[1], s_stem_snap_array);
+ gs_free_object(this->memory, this->stem_snap[1], s_stem_snap_array);
if (this->stem_snap_vote != this->stem_snap_vote0)
- gs_free_object(this->memory, this->stem_snap_vote, s_stem_snap_vote_array);
+ gs_free_object(this->memory, this->stem_snap_vote, s_stem_snap_vote_array);
this->pole = 0;
this->hint = 0;
this->zone = 0;
@@ -585,22 +582,22 @@ static inline void t1_hinter__adjust_matrix_precision(t1_hinter * this, fixed xx
fixed c = (x > y ? x : y);
while (c >= this->max_import_coord) {
- /* Reduce the precision of ctmf to allow products to fit into 32 bits : */
- this->max_import_coord <<= 1;
- fraction_matrix__drop_bits(&this->ctmf, 1);
- fraction_matrix__drop_bits(&this->ctmi, 1);
- this->g2o_fraction_bits -= 1;
- this->g2o_fraction >>= 1;
- t1_hinter__compute_rat_transform_coef(this);
+ /* Reduce the precision of ctmf to allow products to fit into 32 bits : */
+ this->max_import_coord <<= 1;
+ fraction_matrix__drop_bits(&this->ctmf, 1);
+ fraction_matrix__drop_bits(&this->ctmi, 1);
+ this->g2o_fraction_bits -= 1;
+ this->g2o_fraction >>= 1;
+ t1_hinter__compute_rat_transform_coef(this);
}
if (this->ctmf.denominator == 0) {
- /* ctmf should be degenerate. */
- this->ctmf.denominator = 1;
+ /* ctmf should be degenerate. */
+ this->ctmf.denominator = 1;
}
}
static inline void t1_hinter__set_origin(t1_hinter * this, fixed dx, fixed dy)
-{
+{
fixed align_x = rshift(fixed_1, (this->align_to_pixels ? (int)this->log2_pixels_x : this->log2_subpixels_x));
fixed align_y = rshift(fixed_1, (this->align_to_pixels ? (int)this->log2_pixels_y : this->log2_subpixels_y));
@@ -621,17 +618,17 @@ static inline void t1_hinter__set_origin(t1_hinter * this, fixed dx, fixed dy)
this->orig_dy += fixed_half;
} else {
this->orig_dy += fixed_1;
- /* Adobe CPSI does this, not sure why. */
+ /* Adobe CPSI does this, not sure why. */
/* fixme : check bbox of cached bitmap. */
}
# endif
}
int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
- gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
- int log2_pixels_x, int log2_pixels_y,
- int log2_subpixels_x, int log2_subpixels_y,
- fixed origin_x, fixed origin_y, bool align_to_pixels)
+ gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
+ int log2_pixels_x, int log2_pixels_y,
+ int log2_subpixels_x, int log2_subpixels_y,
+ fixed origin_x, fixed origin_y, bool align_to_pixels)
{ float axx = fabs(ctm->xx), axy = fabs(ctm->xy);
float ayx = fabs(ctm->xx), ayy = fabs(ctm->xy);
float scale = max(axx + axy, ayx + ayy);
@@ -652,24 +649,24 @@ int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
this->g2o_fraction_bits = max_coord_bits;
}
if (this->ctmf.denominator != 0) {
- code = fraction_matrix__invert_to(&this->ctmf, &this->ctmi); /* Note: ctmi is inversion of ctmf, not ctm. */
- if (code == gs_error_rangecheck)
- this->ctmf.denominator = 0;
- else if (code < 0)
- return code;
+ code = fraction_matrix__invert_to(&this->ctmf, &this->ctmi); /* Note: ctmi is inversion of ctmf, not ctm. */
+ if (code == gs_error_rangecheck)
+ this->ctmf.denominator = 0;
+ else if (code < 0)
+ return code;
}
if (this->ctmf.denominator != 0) {
- this->g2o_fraction = 1 << this->g2o_fraction_bits;
- /* Note : possibly we'll adjust the matrix precision dynamically
- with adjust_matrix_precision while importing the glyph. */
- if (this->g2o_fraction == 0)
- return_error(gs_error_limitcheck);
+ this->g2o_fraction = 1 << this->g2o_fraction_bits;
+ /* Note : possibly we'll adjust the matrix precision dynamically
+ with adjust_matrix_precision while importing the glyph. */
+ if (this->g2o_fraction == 0)
+ return_error(gs_error_limitcheck);
}
if (this->ctmf.denominator == 0 || this->ctmi.denominator == 0) {
- /* ctmf should be degenerate. */
- this->disable_hinting = true;
- this->pass_through = true;
- this->ctmf.denominator = 1;
+ /* ctmf should be degenerate. */
+ this->disable_hinting = true;
+ this->pass_through = true;
+ this->ctmf.denominator = 1;
}
this->transposed = (any_abs(this->ctmf.xy) * 10 > any_abs(this->ctmf.xx));
{ /* height_transform_coef is scaling factor for the
@@ -680,21 +677,21 @@ int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
double vp, sp, div_x, div_y;
code = fraction_matrix__to_double(&this->ctmf, &m);
- if (code < 0)
- return code;
- vp = any_abs(m.xx * m.yy - m.yx * m.xy);
+ if (code < 0)
+ return code;
+ vp = any_abs(m.xx * m.yy - m.yx * m.xy);
sp = any_abs(m.xx * m.yx + m.xy * m.yy);
div_x = hypot(m.xx, m.yx);
div_y = hypot(m.xy, m.yy);
if (vp != 0 && div_x != 0 && div_y != 0) {
- if (!this->transposed) {
- this->heigt_transform_coef = vp / div_x;
- this->width_transform_coef = vp / div_y;
- } else {
- this->heigt_transform_coef = vp / div_y;
- this->width_transform_coef = vp / div_x;
- }
- t1_hinter__compute_rat_transform_coef(this);
+ if (!this->transposed) {
+ this->heigt_transform_coef = vp / div_x;
+ this->width_transform_coef = vp / div_y;
+ } else {
+ this->heigt_transform_coef = vp / div_y;
+ this->width_transform_coef = vp / div_x;
+ }
+ t1_hinter__compute_rat_transform_coef(this);
this->keep_stem_width = (sp <= vp / 3); /* small skew */
}
}
@@ -711,30 +708,30 @@ int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
this->base_font_scale = d0;
this->font_size = floor(d1 / d0 * 10000 + 0.5) / 10000;
this->resolution = floor(d2 / d1 * 10000000 + 0.5) / 10000000;
- /*
- * fixme: base_font_scale, font_size and resolution are computed wrongly
- * for any of the following cases :
- *
- * 1. CIDFontType0C with FontMatrix=[0.001 0 0 0.001 0 0] gives 1/1000 size.
- * A known example : CIDembedded.pdf . We could obtain the Type 9 FontMatrix
- * in type1_exec_init from penum->fstack.
- *
- * 2. See comment in pdf_font_orig_matrix.
- *
- * Currently we don't use these values with a regular build.
- * The ADOBE_OVERSHOOT_COMPATIBILIY build needs to fix them.
- */
+ /*
+ * fixme: base_font_scale, font_size and resolution are computed wrongly
+ * for any of the following cases :
+ *
+ * 1. CIDFontType0C with FontMatrix=[0.001 0 0 0.001 0 0] gives 1/1000 size.
+ * A known example : CIDembedded.pdf . We could obtain the Type 9 FontMatrix
+ * in type1_exec_init from penum->fstack.
+ *
+ * 2. See comment in pdf_font_orig_matrix.
+ *
+ * Currently we don't use these values with a regular build.
+ * The ADOBE_OVERSHOOT_COMPATIBILIY build needs to fix them.
+ */
}
if (1 || /* Doesn't work - see comment above. */
- this->resolution * this->font_size >= 2) {
- /* Enable the grid fitting separately for axes : */
- this->grid_fit_y = (any_abs(this->ctmf.xy) * 10 < any_abs(this->ctmf.xx) ||
- any_abs(this->ctmf.xx) * 10 < any_abs(this->ctmf.xy));
- this->grid_fit_x = (any_abs(this->ctmf.yx) * 10 < any_abs(this->ctmf.yy) ||
- any_abs(this->ctmf.yy) * 10 < any_abs(this->ctmf.yx));
+ this->resolution * this->font_size >= 2) {
+ /* Enable the grid fitting separately for axes : */
+ this->grid_fit_y = (any_abs(this->ctmf.xy) * 10 < any_abs(this->ctmf.xx) ||
+ any_abs(this->ctmf.xx) * 10 < any_abs(this->ctmf.xy));
+ this->grid_fit_x = (any_abs(this->ctmf.yx) * 10 < any_abs(this->ctmf.yy) ||
+ any_abs(this->ctmf.yy) * 10 < any_abs(this->ctmf.yx));
} else {
- /* Disable the grid fitting for very small fonts. */
- this->grid_fit_x = this->grid_fit_y = false;
+ /* Disable the grid fitting for very small fonts. */
+ this->grid_fit_x = this->grid_fit_y = false;
}
this->align_to_pixels = align_to_pixels;
t1_hinter__set_origin(this, origin_x, origin_y);
@@ -764,10 +761,10 @@ static bool t1_hinter__realloc_array(gs_memory_t *mem, void **a, void *a0, int *
void *aa = gs_alloc_bytes(mem, (*max_count + enhancement * 2) * elem_size, cname);
if (aa == NULL)
- return true;
+ return true;
memcpy(aa, *a, *max_count * elem_size);
if (*a != a0)
- gs_free_object(mem, *a, cname);
+ gs_free_object(mem, *a, cname);
*a = aa;
*max_count += enhancement * 2;
return false;
@@ -779,10 +776,10 @@ static int t1_hinter__set_alignment_zones(t1_hinter * this, float * blues, int c
if (!family) {
/* Store zones : */
if (count2 + this->zone_count >= this->max_zone_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->zone, this->zone0, &this->max_zone_count,
- sizeof(this->zone0) / count_of(this->zone0),
- max(T1_MAX_ALIGNMENT_ZONES, count), s_zone_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->zone, this->zone0, &this->max_zone_count,
+ sizeof(this->zone0) / count_of(this->zone0),
+ max(T1_MAX_ALIGNMENT_ZONES, count), s_zone_array))
+ return_error(gs_error_VMerror);
for (i = 0; i < count2; i++)
t1_hinter__make_zone(this, &this->zone[this->zone_count + i], blues + i + i, type, this->blue_fuzz);
this->zone_count += count2;
@@ -797,7 +794,7 @@ static int t1_hinter__set_alignment_zones(t1_hinter * this, float * blues, int c
any_abs(zone.overshoot_y - zone1->overshoot_y) * this->heigt_transform_coef <= 1)
*zone1 = zone;
}
- }
+ }
}
return 0;
}
@@ -807,46 +804,46 @@ static int t1_hinter__set_stem_snap(t1_hinter * this, float * value, int count,
t1_glyph_space_coord pixel_g = (!hv ? this->pixel_gh : this->pixel_gw);
if (pixel_g == 0)
- return 0;
+ return 0;
if (count + count0 >= this->max_stem_snap_count[hv])
- if(t1_hinter__realloc_array(this->memory, (void **)&this->stem_snap[hv], this->stem_snap0[hv], &this->max_stem_snap_count[hv],
- sizeof(this->stem_snap0[0]) / count_of(this->stem_snap0[0]),
- max(T1_MAX_STEM_SNAPS, count), s_stem_snap_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->stem_snap[hv], this->stem_snap0[hv], &this->max_stem_snap_count[hv],
+ sizeof(this->stem_snap0[0]) / count_of(this->stem_snap0[0]),
+ max(T1_MAX_STEM_SNAPS, count), s_stem_snap_array))
+ return_error(gs_error_VMerror);
if (count + count0 >= this->max_stem_snap_vote_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->stem_snap_vote, this->stem_snap_vote0, &this->max_stem_snap_vote_count,
- sizeof(this->stem_snap_vote0) / count_of(this->stem_snap_vote0),
- max(T1_MAX_STEM_SNAPS, count), s_stem_snap_vote_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->stem_snap_vote, this->stem_snap_vote0, &this->max_stem_snap_vote_count,
+ sizeof(this->stem_snap_vote0) / count_of(this->stem_snap_vote0),
+ max(T1_MAX_STEM_SNAPS, count), s_stem_snap_vote_array))
+ return_error(gs_error_VMerror);
if (count == 1 || (count > 0 && float2fixed(value[count - 1] - value[0]) > pixel_g)) {
- for (i = 0; i < count; i++)
- this->stem_snap[hv][i] = float2fixed(value[i]);
- this->stem_snap_count[hv] = count;
- for (i = 0; i < count; i++) {
- for (j = i + 1; j < count; j++)
- if (this->stem_snap[hv][i] > this->stem_snap[hv][j]) {
- t1_glyph_space_coord v = this->stem_snap[hv][i];
-
- this->stem_snap[hv][i] = this->stem_snap[hv][j];
- this->stem_snap[hv][j] = v;
- }
- }
- for (i = 1, j = 0; i < count; i++) {
- if (this->stem_snap[hv][j] != this->stem_snap[hv][i]) {
- j++;
- this->stem_snap[hv][j] = this->stem_snap[hv][i];
- }
+ for (i = 0; i < count; i++)
+ this->stem_snap[hv][i] = float2fixed(value[i]);
+ this->stem_snap_count[hv] = count;
+ for (i = 0; i < count; i++) {
+ for (j = i + 1; j < count; j++)
+ if (this->stem_snap[hv][i] > this->stem_snap[hv][j]) {
+ t1_glyph_space_coord v = this->stem_snap[hv][i];
+
+ this->stem_snap[hv][i] = this->stem_snap[hv][j];
+ this->stem_snap[hv][j] = v;
+ }
+ }
+ for (i = 1, j = 0; i < count; i++) {
+ if (this->stem_snap[hv][j] != this->stem_snap[hv][i]) {
+ j++;
+ this->stem_snap[hv][j] = this->stem_snap[hv][i];
+ }
}
- this->stem_snap_count[hv] = j + 1;
+ this->stem_snap_count[hv] = j + 1;
}
return 0;
/* We store unrounded stem snap elements, align stem width
to an unrounded element, and then round the width to pixels.
As an alternative we tried to round stem snap elements when storing them,
- and aligh stem width to the closest rounded value. The fist alternative gives
+ and aligh stem width to the closest rounded value. The fist alternative gives
results closer to Adobe, and therefore we believe that Adobe does the same.
With the second alternative many glyphs render some wider,
- for example in aaon97_p7.pdf, adesso1.pdf at 300 dpi.
+ for example in aaon97_p7.pdf, adesso1.pdf at 300 dpi.
Another arbitrary solution is ignoring stem snap when
its variation is lesser than 1 pixel. We believe that a threshold
@@ -856,7 +853,7 @@ static int t1_hinter__set_stem_snap(t1_hinter * this, float * value, int count,
At last, we ignore Std*V when stem snap is used.
Doing so because we don't know cases when Std*V
- isn't equal to any stem snap element.
+ isn't equal to any stem snap element.
*/
}
@@ -887,35 +884,35 @@ int t1_hinter__set_font_data(t1_hinter * this, int FontType, gs_type1_data *pdat
this->charpath_flag = no_grid_fitting;
this->fix_contour_sign = (!is_resource && this->memory != NULL);
if (this->fix_contour_sign)
- this->pass_through = false;
+ this->pass_through = false;
if (!vd_enabled && (VD_DRAW_IMPORT || this->pass_through))
- enable_draw_import();
+ enable_draw_import();
if (this->pass_through)
- return 0;
+ return 0;
code = t1_hinter__set_alignment_zones(this, pdata->OtherBlues.values, pdata->OtherBlues.count, botzone, false);
if (code >= 0)
- code = t1_hinter__set_alignment_zones(this, pdata->BlueValues.values, min(2, pdata->BlueValues.count), botzone, false);
+ code = t1_hinter__set_alignment_zones(this, pdata->BlueValues.values, min(2, pdata->BlueValues.count), botzone, false);
if (code >= 0)
- code = t1_hinter__set_alignment_zones(this, pdata->BlueValues.values + 2, pdata->BlueValues.count - 2, topzone, false);
+ code = t1_hinter__set_alignment_zones(this, pdata->BlueValues.values + 2, pdata->BlueValues.count - 2, topzone, false);
if (code >= 0)
- code = t1_hinter__set_alignment_zones(this, pdata->FamilyOtherBlues.values, pdata->FamilyOtherBlues.count, botzone, true);
+ code = t1_hinter__set_alignment_zones(this, pdata->FamilyOtherBlues.values, pdata->FamilyOtherBlues.count, botzone, true);
if (code >= 0)
- code = t1_hinter__set_alignment_zones(this, pdata->FamilyBlues.values, min(2, pdata->FamilyBlues.count), botzone, true);
+ code = t1_hinter__set_alignment_zones(this, pdata->FamilyBlues.values, min(2, pdata->FamilyBlues.count), botzone, true);
if (code >= 0)
- code = t1_hinter__set_alignment_zones(this, pdata->FamilyBlues.values + 2, pdata->FamilyBlues.count - 2, topzone, true);
+ code = t1_hinter__set_alignment_zones(this, pdata->FamilyBlues.values + 2, pdata->FamilyBlues.count - 2, topzone, true);
if (code >= 0)
- code = t1_hinter__set_stem_snap(this, pdata->StdHW.values, pdata->StdHW.count, 0);
+ code = t1_hinter__set_stem_snap(this, pdata->StdHW.values, pdata->StdHW.count, 0);
if (code >= 0)
- code = t1_hinter__set_stem_snap(this, pdata->StdVW.values, pdata->StdVW.count, 1);
+ code = t1_hinter__set_stem_snap(this, pdata->StdVW.values, pdata->StdVW.count, 1);
if (code >= 0)
- code = t1_hinter__set_stem_snap(this, pdata->StemSnapH.values, pdata->StemSnapH.count, 0);
+ code = t1_hinter__set_stem_snap(this, pdata->StemSnapH.values, pdata->StemSnapH.count, 0);
if (code >= 0)
- code = t1_hinter__set_stem_snap(this, pdata->StemSnapV.values, pdata->StemSnapV.count, 1);
+ code = t1_hinter__set_stem_snap(this, pdata->StemSnapV.values, pdata->StemSnapV.count, 1);
return code;
}
int t1_hinter__set_font42_data(t1_hinter * this, int FontType, gs_type42_data *pdata, bool no_grid_fitting)
-{
+{
t1_hinter__init_outline(this);
this->FontType = FontType;
this->BlueScale = 0.039625; /* A Type 1 spec default. */
@@ -928,18 +925,18 @@ int t1_hinter__set_font42_data(t1_hinter * this, int FontType, gs_type42_data *p
this->charpath_flag = no_grid_fitting;
this->autohinting = true;
if (!vd_enabled && (VD_DRAW_IMPORT || this->pass_through))
- enable_draw_import();
+ enable_draw_import();
if (this->pass_through)
- return 0;
+ return 0;
/* Currently we don't provice alignments zones or stem snap. */
return 0;
}
static inline int t1_hinter__can_add_pole(t1_hinter * this, t1_pole **pole)
{ if (this->pole_count >= this->max_pole_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->pole, this->pole0, &this->max_pole_count,
- sizeof(this->pole0) / count_of(this->pole0), T1_MAX_POLES, s_pole_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->pole, this->pole0, &this->max_pole_count,
+ sizeof(this->pole0) / count_of(this->pole0), T1_MAX_POLES, s_pole_array))
+ return_error(gs_error_VMerror);
*pole = &this->pole[this->pole_count];
return 0;
}
@@ -949,7 +946,7 @@ static inline int t1_hinter__add_pole(t1_hinter * this, t1_glyph_space_coord xx,
int code = t1_hinter__can_add_pole(this, &pole);
if (code < 0)
- return code;
+ return code;
pole->gx = pole->ax = this->cx += xx;
pole->gy = pole->ay = this->cy += yy;
pole->ox = pole->oy = 0;
@@ -976,10 +973,10 @@ int t1_hinter__sbw_seac(t1_hinter * this, fixed sbx, fixed sby)
return 0;
}
-static bool t1_hinter__find_flex(t1_hinter * this, int k, int contour_beg, int contour_end,
- t1_glyph_space_coord pixel_g, t1_glyph_space_coord threshold,
- int i0, int i1, int N, int *j0, int *j1,
- t1_glyph_space_coord *gm)
+static bool t1_hinter__find_flex(t1_hinter * this, int k, int contour_beg, int contour_end,
+ t1_glyph_space_coord pixel_g, t1_glyph_space_coord threshold,
+ int i0, int i1, int N, int *j0, int *j1,
+ t1_glyph_space_coord *gm)
{
int i, j, n = N - 5, m, l;
t1_glyph_space_coord *p_gc = (!k ? &this->pole[0].gx : &this->pole[0].gy);
@@ -989,89 +986,89 @@ static bool t1_hinter__find_flex(t1_hinter * this, int k, int contour_beg, int c
t1_glyph_space_coord gc0, gc1, gd0, gd1, gcl, gdl, gcp = 0, gdp = 0, gcd, gcm = 0;
for (i = i0; n; n--, i = i + 1) {
- if (i == contour_end)
- i = contour_beg;
- if (this->pole[i].type == offcurve)
- continue;
- gc0 = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
- gd0 = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
- for (j = i1, m = n; m; m--, j--) {
- if (j < contour_beg)
- j = contour_end - 1;
- if (this->pole[j].type == offcurve)
- continue;
- gc1 = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
- gd1 = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gd);
- if (any_abs(gd1 - gd0) < pixel_g * 4) /* Arbitrary check for 4 pixels length. */
- continue;
- if (gc0 == gc1) { /* Arbitrary check for strong equality. */
- /* Compute the curvity direction relative to the middle coord. */
- bool gt = false, lt = false;
- double area = 0, area0;
- int pl = i;
- int dir = 0, prev_dir = 0, dir_change = 0;
-
- *gm = gc0; /* Safety. */
- /* fixme: optimize: the computaion of gt, lt may be replaced with
- a longer loop, so that dir_change accounts outer segments.
- optimize : move the 1st iteratiot outside the loop. */
- for (l = i; ; pl = l, gcp = gcl, gdp = gdl, prev_dir = dir, l++) {
- if (l == contour_end)
- l = contour_beg;
- gcl = *member_prt(t1_glyph_space_coord, &this->pole[l], offset_gc);
- gdl = *member_prt(t1_glyph_space_coord, &this->pole[l], offset_gd);
- if (l != i) {
- area += (double)(gcp - gc0) * (gdl - gdp) - (double)(gdp - gd0) * (gcl - gcp);
- gcd = gcl - gc0;
- gcd = any_abs(gcd);
- if (gcm < gcd) {
- *gm = gcl;
- gcm = gcd;
- }
- dir = (gcp < gcl ? 1 : gcp > gcl ? -1 : prev_dir);
- if (dir * prev_dir < 0)
- dir_change++;
- }
- if (l == j)
- break;
- if (gcl < gc0)
- lt = true;
- if (gcl > gc0)
- gt = true;
- }
- if (dir_change > 1)
- continue;
- if (gcm > threshold)
- continue;
- area = any_abs(area) / 2; /* Flex area. */
- area0 = (double)(gd1 - gd0) * gcm; /* Surrounding rectangle. */
- area0 = any_abs(area0);
- if (area > area0 * 0.75)
- continue; /* looks as a rounded rectangle. */
- if (!lt || !gt) {
- int ii = i - 1, jj = j + 1;
- t1_glyph_space_coord gii, gjj;
-
- if (ii < contour_beg)
- ii = contour_end - 1;
- if (jj == contour_end)
- jj = contour_beg;
- gii = *member_prt(t1_glyph_space_coord, &this->pole[ii], offset_gc);
- gjj = *member_prt(t1_glyph_space_coord, &this->pole[jj], offset_gc);
- if ((lt && gii <= gc0 && gjj <= gc0) ||
- (gt && gii >= gc0 && gjj >= gc0)) {
- *j0 = i;
- *j1 = j;
- return true;
- }
- }
- }
- }
- /* Leave the loop here because t1_hinter__fix_missed_flex
- will try the interval starting with the next pole.
- We reserve the 'i' cycle for fonding a "best" flex
- within the interval. */
- break;
+ if (i == contour_end)
+ i = contour_beg;
+ if (this->pole[i].type == offcurve)
+ continue;
+ gc0 = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
+ gd0 = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
+ for (j = i1, m = n; m; m--, j--) {
+ if (j < contour_beg)
+ j = contour_end - 1;
+ if (this->pole[j].type == offcurve)
+ continue;
+ gc1 = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
+ gd1 = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gd);
+ if (any_abs(gd1 - gd0) < pixel_g * 4) /* Arbitrary check for 4 pixels length. */
+ continue;
+ if (gc0 == gc1) { /* Arbitrary check for strong equality. */
+ /* Compute the curvity direction relative to the middle coord. */
+ bool gt = false, lt = false;
+ double area = 0, area0;
+ int pl = i;
+ int dir = 0, prev_dir = 0, dir_change = 0;
+
+ *gm = gc0; /* Safety. */
+ /* fixme: optimize: the computaion of gt, lt may be replaced with
+ a longer loop, so that dir_change accounts outer segments.
+ optimize : move the 1st iteratiot outside the loop. */
+ for (l = i; ; pl = l, gcp = gcl, gdp = gdl, prev_dir = dir, l++) {
+ if (l == contour_end)
+ l = contour_beg;
+ gcl = *member_prt(t1_glyph_space_coord, &this->pole[l], offset_gc);
+ gdl = *member_prt(t1_glyph_space_coord, &this->pole[l], offset_gd);
+ if (l != i) {
+ area += (double)(gcp - gc0) * (gdl - gdp) - (double)(gdp - gd0) * (gcl - gcp);
+ gcd = gcl - gc0;
+ gcd = any_abs(gcd);
+ if (gcm < gcd) {
+ *gm = gcl;
+ gcm = gcd;
+ }
+ dir = (gcp < gcl ? 1 : gcp > gcl ? -1 : prev_dir);
+ if (dir * prev_dir < 0)
+ dir_change++;
+ }
+ if (l == j)
+ break;
+ if (gcl < gc0)
+ lt = true;
+ if (gcl > gc0)
+ gt = true;
+ }
+ if (dir_change > 1)
+ continue;
+ if (gcm > threshold)
+ continue;
+ area = any_abs(area) / 2; /* Flex area. */
+ area0 = (double)(gd1 - gd0) * gcm; /* Surrounding rectangle. */
+ area0 = any_abs(area0);
+ if (area > area0 * 0.75)
+ continue; /* looks as a rounded rectangle. */
+ if (!lt || !gt) {
+ int ii = i - 1, jj = j + 1;
+ t1_glyph_space_coord gii, gjj;
+
+ if (ii < contour_beg)
+ ii = contour_end - 1;
+ if (jj == contour_end)
+ jj = contour_beg;
+ gii = *member_prt(t1_glyph_space_coord, &this->pole[ii], offset_gc);
+ gjj = *member_prt(t1_glyph_space_coord, &this->pole[jj], offset_gc);
+ if ((lt && gii <= gc0 && gjj <= gc0) ||
+ (gt && gii >= gc0 && gjj >= gc0)) {
+ *j0 = i;
+ *j1 = j;
+ return true;
+ }
+ }
+ }
+ }
+ /* Leave the loop here because t1_hinter__fix_missed_flex
+ will try the interval starting with the next pole.
+ We reserve the 'i' cycle for fonding a "best" flex
+ within the interval. */
+ break;
}
return false;
}
@@ -1079,38 +1076,38 @@ static bool t1_hinter__find_flex(t1_hinter * this, int k, int contour_beg, int c
static void t1_hinter__compact_flex(t1_hinter * this, int contour_beg, int contour_end, int i0, int i1, int *pi)
{
if (i0 > i1) {
- t1_hinter__compact_flex(this, contour_beg, contour_end, i0, contour_end, pi);
- t1_hinter__compact_flex(this, contour_beg, contour_end, contour_beg, i1, pi);
+ t1_hinter__compact_flex(this, contour_beg, contour_end, i0, contour_end, pi);
+ t1_hinter__compact_flex(this, contour_beg, contour_end, contour_beg, i1, pi);
} else if (i0 < i1) {
- int i, j;
- int s = i1 - i0 - 1;
-
- for (j = 0; j < this->hint_range_count; j++) {
- if (this->hint_range[j].beg_pole >= i1)
- this->hint_range[j].beg_pole -= s;
- else if (this->hint_range[j].beg_pole > i0)
- this->hint_range[j].beg_pole = i0;
- if (this->hint_range[j].end_pole >= i1)
- this->hint_range[j].end_pole -= s;
- else if (this->hint_range[j].end_pole > i0)
- this->hint_range[j].end_pole = i0;
- }
- if (VD_DRAW_IMPORT) {
- for (i = i0; i <= i1; i++)
- vd_square(this->pole[i].gx, this->pole[i].gy, 7, RGB(0,0,0));
- }
- memmove(&this->pole[i0 + 1], &this->pole[i1], sizeof(*this->pole) * (this->pole_count - i1));
- this->contour[this->contour_count] -= s;
- this->pole_count -= s;
- if (*pi >= i1)
- *pi -= s;
- else if (i0 <= *pi)
- *pi = i0;
- }
-}
-
-static void t1_hinter__adjust_stem_hints_by_missed_flex(t1_hinter * this, t1_glyph_space_coord g0,
- t1_glyph_space_coord gm, int k)
+ int i, j;
+ int s = i1 - i0 - 1;
+
+ for (j = 0; j < this->hint_range_count; j++) {
+ if (this->hint_range[j].beg_pole >= i1)
+ this->hint_range[j].beg_pole -= s;
+ else if (this->hint_range[j].beg_pole > i0)
+ this->hint_range[j].beg_pole = i0;
+ if (this->hint_range[j].end_pole >= i1)
+ this->hint_range[j].end_pole -= s;
+ else if (this->hint_range[j].end_pole > i0)
+ this->hint_range[j].end_pole = i0;
+ }
+ if (VD_DRAW_IMPORT) {
+ for (i = i0; i <= i1; i++)
+ vd_square(this->pole[i].gx, this->pole[i].gy, 7, RGB(0,0,0));
+ }
+ memmove(&this->pole[i0 + 1], &this->pole[i1], sizeof(*this->pole) * (this->pole_count - i1));
+ this->contour[this->contour_count] -= s;
+ this->pole_count -= s;
+ if (*pi >= i1)
+ *pi -= s;
+ else if (i0 <= *pi)
+ *pi = i0;
+ }
+}
+
+static void t1_hinter__adjust_stem_hints_by_missed_flex(t1_hinter * this, t1_glyph_space_coord g0,
+ t1_glyph_space_coord gm, int k)
{
/* While fixing a missed flex, a part of outline is shifted.
If there are stem hints pointing to that outline part, we need to move
@@ -1127,17 +1124,17 @@ static void t1_hinter__adjust_stem_hints_by_missed_flex(t1_hinter * this, t1_gly
int i;
if (gm < g0) {
- g0 ^= gm; gm ^= g0; g0 ^= gm;
+ g0 ^= gm; gm ^= g0; g0 ^= gm;
}
- for (i = 0; i < this->hint_count; i++)
- if (!k == (this->hint[i].type != hstem)) {
- t1_hint *hint = &this->hint[i];
+ for (i = 0; i < this->hint_count; i++)
+ if (!k == (this->hint[i].type != hstem)) {
+ t1_hint *hint = &this->hint[i];
- if (g0 <= hint->g0 && hint->g0 <= gm)
- hint->g0 = hint->ag0 = gg;
- if (g0 <= hint->g1 && hint->g1 <= gm)
- hint->g1 = hint->ag1 = gg;
- }
+ if (g0 <= hint->g0 && hint->g0 <= gm)
+ hint->g0 = hint->ag0 = gg;
+ if (g0 <= hint->g1 && hint->g1 <= gm)
+ hint->g1 = hint->ag1 = gg;
+ }
}
static void t1_hinter__fix_missed_flex(t1_hinter * this)
@@ -1146,76 +1143,76 @@ static void t1_hinter__fix_missed_flex(t1_hinter * this)
int i, j, k, pj, n, j0, j1;
if (this->contour_count == 0)
- return;
+ return;
contour_beg = this->contour[this->contour_count -1];
contour_end = this->pole_count - 1; /* the last contour's 'closepath'. */
if (contour_beg + 8 >= contour_end)
- return;
+ return;
for (k = 0; k < 2; k++) {
t1_glyph_space_coord *p_gc = (!k ? &this->pole[0].gx : &this->pole[0].gy);
t1_glyph_space_coord *p_gd = (!k ? &this->pole[0].gy : &this->pole[0].gx);
int offset_gc = (char *)p_gc - (char *)&this->pole[0];
int offset_gd = (char *)p_gd - (char *)&this->pole[0];
- t1_glyph_space_coord pixel_g = (!k ? this->pixel_gw : this->pixel_gh);
- t1_glyph_space_coord threshold = pixel_g * 5 / 10;
+ t1_glyph_space_coord pixel_g = (!k ? this->pixel_gw : this->pixel_gh);
+ t1_glyph_space_coord threshold = pixel_g * 5 / 10;
t1_glyph_space_coord gc0, gc1, gc, gcj, gd = 0, ge, gm;
- int dir = 0, prev_dir;
- bool wrapped = false;
-
- gc = *member_prt(t1_glyph_space_coord, &this->pole[contour_beg], offset_gc);
- gc0 = gc - threshold;
- gc1 = gc + threshold;
- /* Backward search for a plattue start. */
- for (i = contour_end; i > contour_beg; i--) {
- gcj = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
- if (this->pole[i].type == offcurve)
- continue;
- if (gcj < gc0 || gcj > gc1)
- break;
- }
- if (i == contour_end) {
- i = contour_beg;
- wrapped = true;
- } else
- i++;
- /* Forward search for all platues. */
- for (;;i++) {
- prev_dir = 0;
- if (i == contour_end) {
- if (wrapped)
- break;
- wrapped = true;
- i = contour_beg;
- }
- gc = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
- ge = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
- gc0 = gc - threshold;
- gc1 = gc + threshold;
- for (pj = i, j = i + 1, n = 0; ; pj = j, j++, n++) {
- if (j == contour_end)
- j = contour_beg;
- if (j == i)
- break; /* against bad glyphs. */
- if (this->pole[j].type == offcurve)
- continue;
- gcj = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
- if (gcj < gc0 || gcj > gc1)
- break;
- gd = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
- dir = (gd > ge ? 1 : -1);
- if (dir * prev_dir < 0)
- break;
- ge = gd;
- prev_dir = dir;
- }
- if (n < 6)
- continue;
- if (t1_hinter__find_flex(this, k, contour_beg, contour_end, pixel_g, threshold, i, pj, n, &j0, &j1, &gm)) {
- t1_hinter__compact_flex(this, contour_beg, contour_end, j0, j1, &i);
- t1_hinter__adjust_stem_hints_by_missed_flex(this, gc, gm, k);
- contour_end = this->pole_count - 1;
- }
- }
+ int dir = 0, prev_dir;
+ bool wrapped = false;
+
+ gc = *member_prt(t1_glyph_space_coord, &this->pole[contour_beg], offset_gc);
+ gc0 = gc - threshold;
+ gc1 = gc + threshold;
+ /* Backward search for a plattue start. */
+ for (i = contour_end; i > contour_beg; i--) {
+ gcj = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
+ if (this->pole[i].type == offcurve)
+ continue;
+ if (gcj < gc0 || gcj > gc1)
+ break;
+ }
+ if (i == contour_end) {
+ i = contour_beg;
+ wrapped = true;
+ } else
+ i++;
+ /* Forward search for all platues. */
+ for (;;i++) {
+ prev_dir = 0;
+ if (i == contour_end) {
+ if (wrapped)
+ break;
+ wrapped = true;
+ i = contour_beg;
+ }
+ gc = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gc);
+ ge = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
+ gc0 = gc - threshold;
+ gc1 = gc + threshold;
+ for (pj = i, j = i + 1, n = 0; ; pj = j, j++, n++) {
+ if (j == contour_end)
+ j = contour_beg;
+ if (j == i)
+ break; /* against bad glyphs. */
+ if (this->pole[j].type == offcurve)
+ continue;
+ gcj = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
+ if (gcj < gc0 || gcj > gc1)
+ break;
+ gd = *member_prt(t1_glyph_space_coord, &this->pole[i], offset_gd);
+ dir = (gd > ge ? 1 : -1);
+ if (dir * prev_dir < 0)
+ break;
+ ge = gd;
+ prev_dir = dir;
+ }
+ if (n < 6)
+ continue;
+ if (t1_hinter__find_flex(this, k, contour_beg, contour_end, pixel_g, threshold, i, pj, n, &j0, &j1, &gm)) {
+ t1_hinter__compact_flex(this, contour_beg, contour_end, j0, j1, &i);
+ t1_hinter__adjust_stem_hints_by_missed_flex(this, gc, gm, k);
+ contour_end = this->pole_count - 1;
+ }
+ }
}
}
@@ -1224,41 +1221,41 @@ int t1_hinter__rmoveto(t1_hinter * this, fixed xx, fixed yy)
t1_hinter__adjust_matrix_precision(this, xx, yy);
if (this->flex_count == 0) {
- if (this->pass_through) {
- t1_glyph_space_coord gx = this->cx += xx;
- t1_glyph_space_coord gy = this->cy += yy;
- fixed fx, fy;
-
- if (this->path_opened) {
- code = gx_path_close_subpath(this->output_path);
- if (code < 0)
- return code;
- this->path_opened = false;
- }
- g2d(this, gx, gy, &fx, &fy);
- code = gx_path_add_point(this->output_path, fx, fy);
- vd_circle(this->cx, this->cy, 2, RGB(255, 0, 0));
- vd_moveto(this->cx, this->cy);
- if (this->flex_count == 0) {
- this->bx = this->cx;
- this->by = this->cy;
- }
- return code;
- }
- if (this->pole_count > 0 && this->pole[this->pole_count - 1].type == moveto)
- this->pole_count--;
- if (this->pole_count > 0 && this->pole[this->pole_count - 1].type != closepath) {
- code = t1_hinter__closepath(this);
- if (code < 0)
- return code;
- }
- if (!this->have_flex)
- t1_hinter__fix_missed_flex(this);
+ if (this->pass_through) {
+ t1_glyph_space_coord gx = this->cx += xx;
+ t1_glyph_space_coord gy = this->cy += yy;
+ fixed fx, fy;
+
+ if (this->path_opened) {
+ code = gx_path_close_subpath(this->output_path);
+ if (code < 0)
+ return code;
+ this->path_opened = false;
+ }
+ g2d(this, gx, gy, &fx, &fy);
+ code = gx_path_add_point(this->output_path, fx, fy);
+ vd_circle(this->cx, this->cy, 2, RGB(255, 0, 0));
+ vd_moveto(this->cx, this->cy);
+ if (this->flex_count == 0) {
+ this->bx = this->cx;
+ this->by = this->cy;
+ }
+ return code;
+ }
+ if (this->pole_count > 0 && this->pole[this->pole_count - 1].type == moveto)
+ this->pole_count--;
+ if (this->pole_count > 0 && this->pole[this->pole_count - 1].type != closepath) {
+ code = t1_hinter__closepath(this);
+ if (code < 0)
+ return code;
+ }
+ if (!this->have_flex)
+ t1_hinter__fix_missed_flex(this);
}
code = t1_hinter__add_pole(this, xx, yy, moveto);
if (this->flex_count == 0) {
- this->bx = this->cx;
- this->by = this->cy;
+ this->bx = this->cx;
+ this->by = this->cy;
}
vd_circle(this->cx, this->cy, 2, RGB(255, 0, 0));
vd_moveto(this->cx, this->cy);
@@ -1270,134 +1267,134 @@ static inline void t1_hinter__skip_degenerate_segnment(t1_hinter * this, int npo
int contour_beg = this->contour[this->contour_count], i;
if (contour_beg >= this->pole_count - npoles)
- return;
+ return;
for (i = this->pole_count - npoles - 1; i < this->pole_count - 1; i++)
- if (this->pole[i].ax != this->cx || this->pole[i].ay != this->cy)
- return;
+ if (this->pole[i].ax != this->cx || this->pole[i].ay != this->cy)
+ return;
this->pole_count -= npoles;
}
int t1_hinter__rlineto(t1_hinter * this, fixed xx, fixed yy)
-{
+{
t1_hinter__adjust_matrix_precision(this, xx, yy);
if (this->pass_through) {
- t1_glyph_space_coord gx = this->cx += xx;
- t1_glyph_space_coord gy = this->cy += yy;
- fixed fx, fy;
-
- vd_lineto(this->cx, this->cy);
- this->path_opened = true;
- g2d(this, gx, gy, &fx, &fy);
- return gx_path_add_line(this->output_path, fx, fy);
+ t1_glyph_space_coord gx = this->cx += xx;
+ t1_glyph_space_coord gy = this->cy += yy;
+ fixed fx, fy;
+
+ vd_lineto(this->cx, this->cy);
+ this->path_opened = true;
+ g2d(this, gx, gy, &fx, &fy);
+ return gx_path_add_line(this->output_path, fx, fy);
} else {
- int code = t1_hinter__add_pole(this, xx, yy, oncurve);
-
- if (code < 0)
- return code;
- vd_lineto(this->cx, this->cy);
- t1_hinter__skip_degenerate_segnment(this, 1);
- return 0;
+ int code = t1_hinter__add_pole(this, xx, yy, oncurve);
+
+ if (code < 0)
+ return code;
+ vd_lineto(this->cx, this->cy);
+ t1_hinter__skip_degenerate_segnment(this, 1);
+ return 0;
}
}
int t1_hinter__rcurveto(t1_hinter * this, fixed xx0, fixed yy0, fixed xx1, fixed yy1, fixed xx2, fixed yy2)
-{
+{
t1_hinter__adjust_matrix_precision(this, xx0, yy0);
t1_hinter__adjust_matrix_precision(this, xx1, yy1);
t1_hinter__adjust_matrix_precision(this, xx2, yy2);
if (this->pass_through) {
- t1_glyph_space_coord gx0 = this->cx += xx0;
- t1_glyph_space_coord gy0 = this->cy += yy0;
- t1_glyph_space_coord gx1 = this->cx += xx1;
- t1_glyph_space_coord gy1 = this->cy += yy1;
- t1_glyph_space_coord gx2 = this->cx += xx2;
- t1_glyph_space_coord gy2 = this->cy += yy2;
- fixed fx0, fy0, fx1, fy1, fx2, fy2;
-
- vd_curveto(gx0, gy0, gx1, gy1, gx2, gy2);
- this->path_opened = true;
- g2d(this, gx0, gy0, &fx0, &fy0);
- g2d(this, gx1, gy1, &fx1, &fy1);
- g2d(this, gx2, gy2, &fx2, &fy2);
- return gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
+ t1_glyph_space_coord gx0 = this->cx += xx0;
+ t1_glyph_space_coord gy0 = this->cy += yy0;
+ t1_glyph_space_coord gx1 = this->cx += xx1;
+ t1_glyph_space_coord gy1 = this->cy += yy1;
+ t1_glyph_space_coord gx2 = this->cx += xx2;
+ t1_glyph_space_coord gy2 = this->cy += yy2;
+ fixed fx0, fy0, fx1, fy1, fx2, fy2;
+
+ vd_curveto(gx0, gy0, gx1, gy1, gx2, gy2);
+ this->path_opened = true;
+ g2d(this, gx0, gy0, &fx0, &fy0);
+ g2d(this, gx1, gy1, &fx1, &fy1);
+ g2d(this, gx2, gy2, &fx2, &fy2);
+ return gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
} else {
- int code;
-
- code = t1_hinter__add_pole(this, xx0, yy0, offcurve);
- if (code < 0)
- return code;
- code = t1_hinter__add_pole(this, xx1, yy1, offcurve);
- if (code < 0)
- return code;
- code = t1_hinter__add_pole(this, xx2, yy2, oncurve);
- if (code < 0)
- return code;
- vd_curveto(this->pole[this->pole_count - 3].gx, this->pole[this->pole_count - 3].gy,
- this->pole[this->pole_count - 2].gx, this->pole[this->pole_count - 2].gy,
- this->cx, this->cy);
- t1_hinter__skip_degenerate_segnment(this, 3);
- return 0;
+ int code;
+
+ code = t1_hinter__add_pole(this, xx0, yy0, offcurve);
+ if (code < 0)
+ return code;
+ code = t1_hinter__add_pole(this, xx1, yy1, offcurve);
+ if (code < 0)
+ return code;
+ code = t1_hinter__add_pole(this, xx2, yy2, oncurve);
+ if (code < 0)
+ return code;
+ vd_curveto(this->pole[this->pole_count - 3].gx, this->pole[this->pole_count - 3].gy,
+ this->pole[this->pole_count - 2].gx, this->pole[this->pole_count - 2].gy,
+ this->cx, this->cy);
+ t1_hinter__skip_degenerate_segnment(this, 3);
+ return 0;
}
}
void t1_hinter__setcurrentpoint(t1_hinter * this, fixed xx, fixed yy)
-{
+{
t1_hinter__adjust_matrix_precision(this, xx, yy);
if (this->FontType != 2) {
- /* We use this function to set a subglyph origin
- for composite glyphs in Type 2 fonts.
- */
- this->cx = xx;
- this->cy = yy;
+ /* We use this function to set a subglyph origin
+ for composite glyphs in Type 2 fonts.
+ */
+ this->cx = xx;
+ this->cy = yy;
} else if (this->cx != xx || this->cy != yy) {
- /* Type 1 spec reads : "The setcurrentpoint command is used only
- in conjunction with results from OtherSubrs procedures."
- We guess that such cases don't cause a real coordinate change
- (our testbase shows that). But we met a font
- (see comparefiles/type1-ce1_setcurrentpoint.ps) which use
- setcurrentpoint immediately before moveto, with no conjunction
- with OtherSubrs. (The check above is debug purpose only.)
- */
- this->cx = xx;
- this->cy = yy;
+ /* Type 1 spec reads : "The setcurrentpoint command is used only
+ in conjunction with results from OtherSubrs procedures."
+ We guess that such cases don't cause a real coordinate change
+ (our testbase shows that). But we met a font
+ (see comparefiles/type1-ce1_setcurrentpoint.ps) which use
+ setcurrentpoint immediately before moveto, with no conjunction
+ with OtherSubrs. (The check above is debug purpose only.)
+ */
+ this->cx = xx;
+ this->cy = yy;
}
}
int t1_hinter__closepath(t1_hinter * this)
{ if (this->pass_through) {
- vd_lineto(this->bx, this->by);
- this->path_opened = false;
+ vd_lineto(this->bx, this->by);
+ this->path_opened = false;
return gx_path_close_subpath(this->output_path);
} else {
- int contour_beg = this->contour[this->contour_count], code;
-
- if (contour_beg == this->pole_count)
- return 0; /* maybe a single trailing moveto */
- if (vd_enabled && (VD_DRAW_IMPORT || this->pass_through)) {
- vd_setcolor(VD_IMPORT_COLOR);
- vd_setlinewidth(0);
- vd_lineto(this->bx, this->by);
- }
- if (this->bx == this->cx && this->by == this->cy) {
- /* Don't create degenerate segment */
- this->pole[this->pole_count - 1].type = closepath;
- } else {
- t1_glyph_space_coord cx = this->cx, cy = this->cy;
-
- this->cx = this->bx;
- this->cy = this->by;
- code = t1_hinter__add_pole(this, 0, 0, closepath);
- if (code < 0)
- return code;
- this->cx = cx;
- this->cy = cy;
- }
- this->contour_count++;
- if (this->contour_count >= this->max_contour_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->contour, this->contour0, &this->max_contour_count,
- sizeof(this->contour0) / count_of(this->contour0), T1_MAX_CONTOURS, s_contour_array))
- return_error(gs_error_VMerror);
- this->contour[this->contour_count] = this->pole_count;
+ int contour_beg = this->contour[this->contour_count], code;
+
+ if (contour_beg == this->pole_count)
+ return 0; /* maybe a single trailing moveto */
+ if (vd_enabled && (VD_DRAW_IMPORT || this->pass_through)) {
+ vd_setcolor(VD_IMPORT_COLOR);
+ vd_setlinewidth(0);
+ vd_lineto(this->bx, this->by);
+ }
+ if (this->bx == this->cx && this->by == this->cy) {
+ /* Don't create degenerate segment */
+ this->pole[this->pole_count - 1].type = closepath;
+ } else {
+ t1_glyph_space_coord cx = this->cx, cy = this->cy;
+
+ this->cx = this->bx;
+ this->cy = this->by;
+ code = t1_hinter__add_pole(this, 0, 0, closepath);
+ if (code < 0)
+ return code;
+ this->cx = cx;
+ this->cy = cy;
+ }
+ this->contour_count++;
+ if (this->contour_count >= this->max_contour_count)
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->contour, this->contour0, &this->max_contour_count,
+ sizeof(this->contour0) / count_of(this->contour0), T1_MAX_CONTOURS, s_contour_array))
+ return_error(gs_error_VMerror);
+ this->contour[this->contour_count] = this->pole_count;
return 0;
}
}
@@ -1405,38 +1402,38 @@ int t1_hinter__closepath(t1_hinter * this)
int t1_hinter__end_subglyph(t1_hinter * this)
{
if (this->pass_through)
- return 0;
+ return 0;
this->subglyph_count++;
if (this->subglyph_count >= this->max_subglyph_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->subglyph, this->subglyph0, &this->max_subglyph_count,
- sizeof(this->subglyph0) / count_of(this->subglyph0), T1_MAX_SUBGLYPHS, s_subglyph_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->subglyph, this->subglyph0, &this->max_subglyph_count,
+ sizeof(this->subglyph0) / count_of(this->subglyph0), T1_MAX_SUBGLYPHS, s_subglyph_array))
+ return_error(gs_error_VMerror);
this->subglyph[this->subglyph_count] = this->contour_count;
return 0;
}
static inline int t1_hinter__can_add_hint(t1_hinter * this, t1_hint **hint)
{ if (this->hint_count >= this->max_hint_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->hint, this->hint0, &this->max_hint_count,
- sizeof(this->hint0) / count_of(this->hint0), T1_MAX_HINTS, s_hint_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->hint, this->hint0, &this->max_hint_count,
+ sizeof(this->hint0) / count_of(this->hint0), T1_MAX_HINTS, s_hint_array))
+ return_error(gs_error_VMerror);
*hint = &this->hint[this->hint_count];
return 0;
}
int t1_hinter__flex_beg(t1_hinter * this)
{ if (this->flex_count != 0)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
this->flex_count++;
this->have_flex = true;
if (this->pass_through)
- return t1_hinter__rmoveto(this, 0, 0);
+ return t1_hinter__rmoveto(this, 0, 0);
return 0;
}
int t1_hinter__flex_point(t1_hinter * this)
{ if (this->flex_count == 0)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
this->flex_count++;
return 0;
}
@@ -1446,60 +1443,60 @@ int t1_hinter__flex_end(t1_hinter * this, fixed flex_height)
t1_hinter_space_coord ox, oy;
const int32_t div_x = this->g2o_fraction << this->log2_pixels_x;
const int32_t div_y = this->g2o_fraction << this->log2_pixels_y;
-
+
if (this->flex_count != 8)
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
/* We've got 8 poles accumulated in pole array. */
pole0 = &this->pole[this->pole_count - 8];
pole1 = &this->pole[this->pole_count - 7];
pole4 = &this->pole[this->pole_count - 4];
g2o(this, pole4->gx - pole1->gx, pole4->gy - pole1->gy, &ox, &oy);
- if (any_abs(ox) > div_x * fixed2float(flex_height) / 100 ||
- any_abs(oy) > div_y * fixed2float(flex_height) / 100) {
- /* do with curves */
- vd_moveto (pole0[0].gx, pole0[0].gy);
- vd_curveto(pole0[2].gx, pole0[2].gy, pole0[3].gx, pole0[3].gy, pole0[4].gx, pole0[4].gy);
- vd_curveto(pole0[5].gx, pole0[5].gy, pole0[6].gx, pole0[6].gy, pole0[7].gx, pole0[7].gy);
- if (this->pass_through) {
- fixed fx0, fy0, fx1, fy1, fx2, fy2;
- int code;
-
- g2d(this, pole0[2].gx, pole0[2].gy, &fx0, &fy0);
- g2d(this, pole0[3].gx, pole0[3].gy, &fx1, &fy1);
- g2d(this, pole0[4].gx, pole0[4].gy, &fx2, &fy2);
- code = gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
- if (code < 0)
- return code;
- g2d(this, pole0[5].gx, pole0[5].gy, &fx0, &fy0);
- g2d(this, pole0[6].gx, pole0[6].gy, &fx1, &fy1);
- g2d(this, pole0[7].gx, pole0[7].gy, &fx2, &fy2);
- this->flex_count = 0;
- this->pole_count = 0;
- return gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
- } else {
- memmove(pole1, pole1 + 1, (sizeof(this->pole0) / count_of(this->pole0)) * 7);
- pole0[1].type = pole0[2].type = offcurve;
- pole0[3].type = oncurve;
- pole0[4].type = pole0[5].type = offcurve;
- pole0[6].type = oncurve;
- this->pole_count--;
- }
+ if (any_abs(ox) > div_x * fixed2float(flex_height) / 100 ||
+ any_abs(oy) > div_y * fixed2float(flex_height) / 100) {
+ /* do with curves */
+ vd_moveto (pole0[0].gx, pole0[0].gy);
+ vd_curveto(pole0[2].gx, pole0[2].gy, pole0[3].gx, pole0[3].gy, pole0[4].gx, pole0[4].gy);
+ vd_curveto(pole0[5].gx, pole0[5].gy, pole0[6].gx, pole0[6].gy, pole0[7].gx, pole0[7].gy);
+ if (this->pass_through) {
+ fixed fx0, fy0, fx1, fy1, fx2, fy2;
+ int code;
+
+ g2d(this, pole0[2].gx, pole0[2].gy, &fx0, &fy0);
+ g2d(this, pole0[3].gx, pole0[3].gy, &fx1, &fy1);
+ g2d(this, pole0[4].gx, pole0[4].gy, &fx2, &fy2);
+ code = gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
+ if (code < 0)
+ return code;
+ g2d(this, pole0[5].gx, pole0[5].gy, &fx0, &fy0);
+ g2d(this, pole0[6].gx, pole0[6].gy, &fx1, &fy1);
+ g2d(this, pole0[7].gx, pole0[7].gy, &fx2, &fy2);
+ this->flex_count = 0;
+ this->pole_count = 0;
+ return gx_path_add_curve(this->output_path, fx0, fy0, fx1, fy1, fx2, fy2);
+ } else {
+ memmove(pole1, pole1 + 1, (sizeof(this->pole0) / count_of(this->pole0)) * 7);
+ pole0[1].type = pole0[2].type = offcurve;
+ pole0[3].type = oncurve;
+ pole0[4].type = pole0[5].type = offcurve;
+ pole0[6].type = oncurve;
+ this->pole_count--;
+ }
} else {
- /* do with line */
- vd_moveto(pole0[0].gx, pole0[0].gy);
- vd_lineto(pole0[7].gx, pole0[7].gy);
- if (this->pass_through) {
- fixed fx, fy;
-
- g2d(this, pole0[7].gx, pole0[7].gy, &fx, &fy);
- this->flex_count = 0;
- this->pole_count = 0;
- return gx_path_add_line(this->output_path, fx, fy);
- } else {
- pole0[1] = pole0[7];
- pole0[1].type = oncurve;
- this->pole_count -= 6;
- }
+ /* do with line */
+ vd_moveto(pole0[0].gx, pole0[0].gy);
+ vd_lineto(pole0[7].gx, pole0[7].gy);
+ if (this->pass_through) {
+ fixed fx, fy;
+
+ g2d(this, pole0[7].gx, pole0[7].gy, &fx, &fy);
+ this->flex_count = 0;
+ this->pole_count = 0;
+ return gx_path_add_line(this->output_path, fx, fy);
+ } else {
+ pole0[1] = pole0[7];
+ pole0[1].type = oncurve;
+ this->pole_count -= 6;
+ }
}
this->flex_count = 0;
return 0;
@@ -1507,18 +1504,18 @@ int t1_hinter__flex_end(t1_hinter * this, fixed flex_height)
static inline int t1_hinter__can_add_hint_range(t1_hinter * this, t1_hint_range **hint_range)
{ if (this->hint_range_count >= this->max_hint_range_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->hint_range, this->hint_range0, &this->max_hint_range_count,
- sizeof(this->hint_range0) / count_of(this->hint_range0), T1_MAX_HINTS, s_hint_range_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->hint_range, this->hint_range0, &this->max_hint_range_count,
+ sizeof(this->hint_range0) / count_of(this->hint_range0), T1_MAX_HINTS, s_hint_range_array))
+ return_error(gs_error_VMerror);
*hint_range = &this->hint_range[this->hint_range_count];
return 0;
}
static inline int t1_hinter__can_add_hint_applying(t1_hinter * this, t1_hint_applying **hint_applying)
{ if (this->hint_applying_count >= this->max_hint_applying_count)
- if(t1_hinter__realloc_array(this->memory, (void **)&this->hint_applying, this->hint_applying0, &this->max_hint_applying_count,
- sizeof(this->hint_applying0) / count_of(this->hint_applying0), T1_MAX_HINTS, s_hint_applying_array))
- return_error(gs_error_VMerror);
+ if(t1_hinter__realloc_array(this->memory, (void **)&this->hint_applying, this->hint_applying0, &this->max_hint_applying_count,
+ sizeof(this->hint_applying0) / count_of(this->hint_applying0), T1_MAX_HINTS, s_hint_applying_array))
+ return_error(gs_error_VMerror);
*hint_applying = &this->hint_applying[this->hint_applying_count];
return 0;
}
@@ -1527,49 +1524,49 @@ int t1_hinter__hint_mask(t1_hinter * this, byte *mask)
{ int hint_count, i;
if (this->disable_hinting)
- return 0;
+ return 0;
hint_count = this->hint_count;
for(i = 0; i < hint_count; i++) {
- bool activate = (mask != NULL && (mask[i >> 3] & (0x80 >> (i & 7))) != 0);
- t1_hint *hint = &this->hint[i];
-
- if (activate) {
- if (hint->range_index != -1 &&
- (this->hint_range[hint->range_index].end_pole == -1 ||
- this->hint_range[hint->range_index].end_pole == this->pole_count)) {
- /* continie the range */
- this->hint_range[hint->range_index].end_pole = -1;
- } else {
- /* add new range */
- t1_hint_range *hint_range;
- int code = t1_hinter__can_add_hint_range(this, &hint_range);
-
- if (code < 0)
- return code;
- hint_range->beg_pole = this->pole_count;
- hint_range->end_pole = -1;
- hint_range->next = hint->range_index;
- hint->range_index = this->hint_range_count;
- this->hint_range_count++;
- }
- } else {
- if (hint->range_index != -1 &&
- this->hint_range[hint->range_index].end_pole == -1) {
- /* deactivate */
- this->hint_range[hint->range_index].end_pole = this->pole_count;
- } else
- DO_NOTHING;
- }
+ bool activate = (mask != NULL && (mask[i >> 3] & (0x80 >> (i & 7))) != 0);
+ t1_hint *hint = &this->hint[i];
+
+ if (activate) {
+ if (hint->range_index != -1 &&
+ (this->hint_range[hint->range_index].end_pole == -1 ||
+ this->hint_range[hint->range_index].end_pole == this->pole_count)) {
+ /* continie the range */
+ this->hint_range[hint->range_index].end_pole = -1;
+ } else {
+ /* add new range */
+ t1_hint_range *hint_range;
+ int code = t1_hinter__can_add_hint_range(this, &hint_range);
+
+ if (code < 0)
+ return code;
+ hint_range->beg_pole = this->pole_count;
+ hint_range->end_pole = -1;
+ hint_range->next = hint->range_index;
+ hint->range_index = this->hint_range_count;
+ this->hint_range_count++;
+ }
+ } else {
+ if (hint->range_index != -1 &&
+ this->hint_range[hint->range_index].end_pole == -1) {
+ /* deactivate */
+ this->hint_range[hint->range_index].end_pole = this->pole_count;
+ } else
+ DO_NOTHING;
+ }
}
return 0;
}
int t1_hinter__drop_hints(t1_hinter * this)
{ if (this->disable_hinting)
- return 0;
+ return 0;
if (this->primary_hint_count == -1)
- this->primary_hint_count = this->hint_range_count;
+ this->primary_hint_count = this->hint_range_count;
return t1_hinter__hint_mask(this, NULL);
}
@@ -1584,37 +1581,37 @@ int i, code;
t1_hinter__adjust_matrix_precision(this, (side_mask & 1 ? g0 : g1), (side_mask & 2 ? g1 : g0));
for (i = 0; i < this->hint_count; i++)
- if (this->hint[i].type == type &&
- this->hint[i].g0 == g0 && this->hint[i].g1 == g1 &&
- this->hint[i].side_mask == side_mask)
- break;
+ if (this->hint[i].type == type &&
+ this->hint[i].g0 == g0 && this->hint[i].g1 == g1 &&
+ this->hint[i].side_mask == side_mask)
+ break;
if (i < this->hint_count)
- hint = &this->hint[i];
+ hint = &this->hint[i];
else {
- code = t1_hinter__can_add_hint(this, &hint);
- if (code < 0)
- return code;
- hint->type = type;
- hint->g0 = hint->ag0 = g0;
- hint->g1 = hint->ag1 = g1;
- hint->aligned0 = hint->aligned1 = unaligned;
- hint->q0 = hint->q1 = max_int;
- hint->b0 = hint->b1 = false;
- hint->stem3_index = stem3_index;
- hint->range_index = -1;
- hint->side_mask = side_mask;
- hint->stem_snap_index0 = hint->stem_snap_index1 = 0;
- hint->boundary_length0 = hint->boundary_length1 = 0;
+ code = t1_hinter__can_add_hint(this, &hint);
+ if (code < 0)
+ return code;
+ hint->type = type;
+ hint->g0 = hint->ag0 = g0;
+ hint->g1 = hint->ag1 = g1;
+ hint->aligned0 = hint->aligned1 = unaligned;
+ hint->q0 = hint->q1 = max_int;
+ hint->b0 = hint->b1 = false;
+ hint->stem3_index = stem3_index;
+ hint->range_index = -1;
+ hint->side_mask = side_mask;
+ hint->stem_snap_index0 = hint->stem_snap_index1 = 0;
+ hint->boundary_length0 = hint->boundary_length1 = 0;
}
code = t1_hinter__can_add_hint_range(this, &range);
if (code < 0)
- return code;
+ return code;
range->beg_pole = this->pole_count;
range->end_pole = -1;
range->next = hint->range_index;
hint->range_index = range - this->hint_range;
if (i >= this->hint_count)
- this->hint_count++;
+ this->hint_count++;
this->hint_range_count++;
return 0;
}
@@ -1623,27 +1620,26 @@ int t1_hinter__dotsection(t1_hinter * this)
{ if (this->pole_count == 0 || this->pole[this->pole_count - 1].type != moveto)
return 0; /* We store beginning dotsection hints only. */
if (this->disable_hinting)
- return 0;
+ return 0;
return t1_hinter__stem(this, dot, 0, 0, 0, 0);
}
-
int t1_hinter__hstem(t1_hinter * this, fixed x0, fixed x1)
{ if (this->disable_hinting)
- return 0;
+ return 0;
return t1_hinter__stem(this, hstem, 0, x0, x1, 3);
}
int t1_hinter__overall_hstem(t1_hinter * this, fixed x0, fixed x1, int side_mask)
{ /* True Type autohinting only. */
if (this->disable_hinting)
- return 0;
+ return 0;
return t1_hinter__stem(this, hstem, 0, x0, x1, side_mask);
}
int t1_hinter__vstem(t1_hinter * this, fixed y0, fixed y1)
{ if (this->disable_hinting)
- return 0;
+ return 0;
return t1_hinter__stem(this, vstem, 0, y0, y1, 3);
}
@@ -1651,13 +1647,13 @@ int t1_hinter__hstem3(t1_hinter * this, fixed x0, fixed x1, fixed x2, fixed x3,
{ int code;
if (this->disable_hinting)
- return 0;
+ return 0;
code = t1_hinter__stem(this, hstem, 1, x0, x1, 3);
if (code < 0)
- return code;
+ return code;
code = t1_hinter__stem(this, hstem, 2, x2, x3, 3);
if (code < 0)
- return code;
+ return code;
return t1_hinter__stem(this, hstem, 3, x4, x5, 3);
}
@@ -1665,13 +1661,13 @@ int t1_hinter__vstem3(t1_hinter * this, fixed y0, fixed y1, fixed y2, fixed y3,
{ int code;
if (this->disable_hinting)
- return 0;
+ return 0;
code = t1_hinter__stem(this, vstem, 1, y0, y1, 3);
if (code < 0)
- return code;
+ return code;
code = t1_hinter__stem(this, vstem, 2, y2, y3, 3);
if (code < 0)
- return code;
+ return code;
return t1_hinter__stem(this, vstem, 3, y4, y5, 3);
}
@@ -1709,23 +1705,23 @@ static void t1_hinter__compute_y_span(t1_hinter * this)
{
int n = this->pole_count - 1;
int i;
-
+
if (n > 1) {
- /* For non-space characters ignore the trailing moveto.
- Rather it could give a baseline,
- it is not guaranteedly good,
- and doesn't allow a stable recognition
- of the upper side of a dot, comma, etc.. */
- n--;
+ /* For non-space characters ignore the trailing moveto.
+ Rather it could give a baseline,
+ it is not guaranteedly good,
+ and doesn't allow a stable recognition
+ of the upper side of a dot, comma, etc.. */
+ n--;
} else if (n < 0) {
return; /* empty glyph */
}
this->ymin = this->ymax = this->pole[0].gy;
for (i = 1; i < n; i++) {
- if (this->ymin > this->pole[i].gy)
- this->ymin = this->pole[i].gy;
- if (this->ymax < this->pole[i].gy)
- this->ymax = this->pole[i].gy;
+ if (this->ymin > this->pole[i].gy)
+ this->ymin = this->pole[i].gy;
+ if (this->ymax < this->pole[i].gy)
+ this->ymax = this->pole[i].gy;
}
this->ymid = (this->ymax + this->ymin) / 2;
}
@@ -1736,45 +1732,45 @@ static void t1_hinter__simplify_representation(t1_hinter * this)
int primary_hint_count = this->primary_hint_count;
if (last_pole > 1 && this->pole[last_pole -1].type == closepath)
- last_pole -= 2; /* Skip the trailing moveto. */
+ last_pole -= 2; /* Skip the trailing moveto. */
if (this->pole_count <= 1)
- return; /* An empty glyph (only a trailing moveto). */
+ return; /* An empty glyph (only a trailing moveto). */
/* Remove hints which are disabled with !grid_fit_x, !grid_fit_y.
* We can't do before import is completed due to hint mask commands.
*/
if (!this->grid_fit_x || !this->grid_fit_y) {
- for (i = j = 0; i < this->hint_count; i++)
- if ((this->hint[i].type == vstem && !this->grid_fit_x) ||
- (this->hint[i].type == hstem && !this->grid_fit_y)) {
- if (i < primary_hint_count)
- this->primary_hint_count--;
- continue; /* skip it. */
- } else {
- if (i != j) /* for Valgrind */
+ for (i = j = 0; i < this->hint_count; i++)
+ if ((this->hint[i].type == vstem && !this->grid_fit_x) ||
+ (this->hint[i].type == hstem && !this->grid_fit_y)) {
+ if (i < primary_hint_count)
+ this->primary_hint_count--;
+ continue; /* skip it. */
+ } else {
+ if (i != j) /* for Valgrind */
this->hint[j] = this->hint[i];
- j++;
- }
- this->hint_count = j;
+ j++;
+ }
+ this->hint_count = j;
}
for (i = 0; i < this->hint_range_count; i++) {
- t1_hint_range *hint_range = &this->hint_range[i];
-
- j = hint_range->beg_pole;
- if (this->pole[j].type == closepath)
- hint_range->beg_pole = ++j;
- else {
- if (this->pole[j].type == offcurve)
- hint_range->beg_pole = --j;
- if (this->pole[j].type == offcurve)
- hint_range->beg_pole = --j;
- }
- j = hint_range->end_pole;
- if (j == -1)
- hint_range->end_pole = j = last_pole;
- if (this->pole[j].type == offcurve)
- hint_range->end_pole = ++j;
- if (this->pole[j].type == offcurve)
- hint_range->end_pole = ++j;
+ t1_hint_range *hint_range = &this->hint_range[i];
+
+ j = hint_range->beg_pole;
+ if (this->pole[j].type == closepath)
+ hint_range->beg_pole = ++j;
+ else {
+ if (this->pole[j].type == offcurve)
+ hint_range->beg_pole = --j;
+ if (this->pole[j].type == offcurve)
+ hint_range->beg_pole = --j;
+ }
+ j = hint_range->end_pole;
+ if (j == -1)
+ hint_range->end_pole = j = last_pole;
+ if (this->pole[j].type == offcurve)
+ hint_range->end_pole = ++j;
+ if (this->pole[j].type == offcurve)
+ hint_range->end_pole = ++j;
}
/* moveto's were needed to decode path correctly.
We don't need them so far.
@@ -1784,20 +1780,20 @@ static void t1_hinter__simplify_representation(t1_hinter * this)
if (this->pole[this->contour[i]].type == moveto)
this->pole[this->contour[i]].type = oncurve;
/* After the decoding, hint commands refer to the last pole before HR occures.
- Move pointers to the beginning segment pole.
+ Move pointers to the beginning segment pole.
*/
for (j = 0; j < this->hint_range_count; j++) {
- int beg_pole = this->hint_range[j].beg_pole;
- int contour_index = this->pole[beg_pole].contour_index;
- int contour_beg_pole = this->contour[contour_index];
+ int beg_pole = this->hint_range[j].beg_pole;
+ int contour_index = this->pole[beg_pole].contour_index;
+ int contour_beg_pole = this->contour[contour_index];
- if (beg_pole > contour_beg_pole && beg_pole < last_pole)
- this->hint_range[j].beg_pole = t1_hinter__segment_beg(this, beg_pole);
+ if (beg_pole > contour_beg_pole && beg_pole < last_pole)
+ this->hint_range[j].beg_pole = t1_hinter__segment_beg(this, beg_pole);
}
}
-static inline bool t1_hinter__is_small_angle(t1_hinter * this, int pole_index0, int pole_index1,
- long tan_x, long tan_y, int alpha, int alpha_div, int *quality)
+static inline bool t1_hinter__is_small_angle(t1_hinter * this, int pole_index0, int pole_index1,
+ long tan_x, long tan_y, int alpha, int alpha_div, int *quality)
{ long gx = this->pole[pole_index1].gx - this->pole[pole_index0].gx;
long gy = this->pole[pole_index1].gy - this->pole[pole_index0].gy;
long vp = mul_shift(gx, tan_y, _fixed_shift) - mul_shift(gy, tan_x, _fixed_shift);
@@ -1805,16 +1801,16 @@ static inline bool t1_hinter__is_small_angle(t1_hinter * this, int pole_index0,
long vp1 = any_abs(vp), sp1 = any_abs(sp);
if (gx == 0 && gy == 0) {
- *quality = max_int;
- return false;
+ *quality = max_int;
+ return false;
}
if (vp1 >= sp1) {
- *quality = max_int;
- return false;
+ *quality = max_int;
+ return false;
}
if (vp1 / alpha_div > sp1 / alpha) {
- *quality = max_int;
- return false;
+ *quality = max_int;
+ return false;
}
*quality = vp1 * 100 / sp1; /* The best quality is 0. */
return true;
@@ -1856,8 +1852,8 @@ static inline bool t1_hinter__is_good_tangent(t1_hinter * this, int pole_index,
prev = ranger_step_b(pole_index, beg_contour_pole, end_contour_pole);
good0 = t1_hinter__is_small_angle(this, prev, pole_index, tan_x, tan_y, alpha, alpha_div, &quality0);
if (quality0 == 0) {
- *quality = 0;
- return true;
+ *quality = 0;
+ return true;
}
next = ranger_step_f(pole_index, beg_contour_pole, end_contour_pole);
good1 = t1_hinter__is_small_angle(this, next, pole_index, tan_x, tan_y, alpha, alpha_div, &quality1);
@@ -1871,9 +1867,9 @@ static void t1_hinter__compute_type1_stem_ranges(t1_hinter * this)
int primary_hint_count = this->primary_hint_count;
if (this->hint_count == 0)
- return;
+ return;
if (primary_hint_count == -1)
- primary_hint_count = this->hint_range_count;
+ primary_hint_count = this->hint_range_count;
/* Process primary hints - ranges are entire glyph : */
for(j = 0; j < primary_hint_count; j++) {
this->hint_range[j].beg_pole = 0;
@@ -1881,7 +1877,7 @@ static void t1_hinter__compute_type1_stem_ranges(t1_hinter * this)
}
/* Note that ranges of primary hints may include a tail of the hint array
due to multiple contours. Primary hints have a lesser priority,
- so apply them first, and possibly recover later.
+ so apply them first, and possibly recover later.
*/
}
@@ -1889,12 +1885,12 @@ static void t1_hinter__compute_type2_stem_ranges(t1_hinter * this)
{ int i;
for (i = 0; i < this->hint_range_count; i++)
- if (this->hint_range[i].end_pole == -1)
- this->hint_range[i].end_pole = this->pole_count - 2;
+ if (this->hint_range[i].end_pole == -1)
+ this->hint_range[i].end_pole = this->pole_count - 2;
}
-static bool t1_hinter__is_stem_boundary_near(t1_hinter * this, const t1_hint *hint,
- t1_glyph_space_coord g, int boundary)
+static bool t1_hinter__is_stem_boundary_near(t1_hinter * this, const t1_hint *hint,
+ t1_glyph_space_coord g, int boundary)
{
t1_glyph_space_coord const fuzz = this->blue_fuzz; /* comparefiles/tpc2.ps */
@@ -1905,15 +1901,15 @@ static int t1_hinter__is_stem_hint_applicable(t1_hinter * this, t1_hint *hint, i
{ /* We don't check hint->side_mask because the unused coord should be outside the design bbox. */
int k;
- if (hint->type == hstem
- && ((k = 1, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gy, 0)) ||
- (k = 2, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gy, 1)))
+ if (hint->type == hstem
+ && ((k = 1, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gy, 0)) ||
+ (k = 2, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gy, 1)))
&& t1_hinter__is_good_tangent(this, pole_index, 1, 0, quality))
return k;
- if (hint->type == vstem
- && ((k = 1, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gx, 0)) ||
- (k = 2, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gx, 1)))
- && t1_hinter__is_good_tangent(this, pole_index, 0, 1, quality))
+ if (hint->type == vstem
+ && ((k = 1, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gx, 0)) ||
+ (k = 2, t1_hinter__is_stem_boundary_near(this, hint, this->pole[pole_index].gx, 1)))
+ && t1_hinter__is_good_tangent(this, pole_index, 0, 1, quality))
return k;
return 0;
}
@@ -1934,18 +1930,18 @@ static t1_zone * t1_hinter__find_zone(t1_hinter * this, t1_glyph_space_coord pol
}
static void t1_hinter__align_to_grid__general(t1_hinter * this, int32_t unit,
- t1_glyph_space_coord gx, t1_glyph_space_coord gy,
- t1_hinter_space_coord *pdx, t1_hinter_space_coord *pdy,
- bool align_to_pixels, bool absolute)
-{
+ t1_glyph_space_coord gx, t1_glyph_space_coord gy,
+ t1_hinter_space_coord *pdx, t1_hinter_space_coord *pdy,
+ bool align_to_pixels, bool absolute)
+{
long div_x = rshift(unit, (align_to_pixels ? (int)this->log2_pixels_x : this->log2_subpixels_x));
long div_y = rshift(unit, (align_to_pixels ? (int)this->log2_pixels_y : this->log2_subpixels_y));
t1_hinter_space_coord ox, oy, dx, dy;
g2o(this, gx, gy, &ox, &oy);
if (absolute) {
- ox += this->orig_ox;
- oy += this->orig_oy;
+ ox += this->orig_ox;
+ oy += this->orig_oy;
}
dx = ox % div_x;
dy = oy % div_y; /* So far dx and dy are 19 bits */
@@ -1962,50 +1958,50 @@ static void t1_hinter__align_to_grid__general(t1_hinter * this, int32_t unit,
}
static void t1_hinter__align_to_grid__final(t1_hinter * this,
- t1_glyph_space_coord *x, t1_glyph_space_coord *y,
- t1_hinter_space_coord dx, t1_hinter_space_coord dy)
+ t1_glyph_space_coord *x, t1_glyph_space_coord *y,
+ t1_hinter_space_coord dx, t1_hinter_space_coord dy)
{
t1_glyph_space_coord gxd, gyd;
o2g(this, dx, dy, &gxd, &gyd);
if (this->grid_fit_x) {
- *x -= gxd;
- *x = (*x + 7) & ~15; /* Round to suppress small noise : */
+ *x -= gxd;
+ *x = (*x + 7) & ~15; /* Round to suppress small noise : */
}
if (this->grid_fit_y) {
- *y -= gyd;
- *y = (*y + 7) & ~15; /* Round to suppress small noise : */
+ *y -= gyd;
+ *y = (*y + 7) & ~15; /* Round to suppress small noise : */
}
}
-static void t1_hinter__hint_stem_snap_range(t1_hinter * this,
- t1_glyph_space_coord w0, t1_glyph_space_coord w1, bool horiz,
- short *index0, short *index1)
+static void t1_hinter__hint_stem_snap_range(t1_hinter * this,
+ t1_glyph_space_coord w0, t1_glyph_space_coord w1, bool horiz,
+ short *index0, short *index1)
{ int k = (horiz ? 0 : 1), i;
bool index0_set = false;
*index0 = 0;
*index1 = -1;
for (i = 0; i < this->stem_snap_count[k]; i++) {
- if (w0 > this->stem_snap[k][i])
- continue;
- if (!index0_set) {
- index0_set = true;
- *index0 = i;
- }
- if (w1 < this->stem_snap[k][i])
- break;
- *index1 = i;
+ if (w0 > this->stem_snap[k][i])
+ continue;
+ if (!index0_set) {
+ index0_set = true;
+ *index0 = i;
+ }
+ if (w1 < this->stem_snap[k][i])
+ break;
+ *index1 = i;
}
}
-static void t1_hinter__align_to_grid(t1_hinter * this, int32_t unit,
- t1_glyph_space_coord *x, t1_glyph_space_coord *y, bool align_to_pixels)
+static void t1_hinter__align_to_grid(t1_hinter * this, int32_t unit,
+ t1_glyph_space_coord *x, t1_glyph_space_coord *y, bool align_to_pixels)
{ if (unit > 0) {
t1_hinter_space_coord dx, dy;
- t1_hinter__align_to_grid__general(this, unit, *x, *y, &dx, &dy, align_to_pixels, align_to_pixels);
- t1_hinter__align_to_grid__final(this, x, y, dx, dy);
+ t1_hinter__align_to_grid__general(this, unit, *x, *y, &dx, &dy, align_to_pixels, align_to_pixels);
+ t1_hinter__align_to_grid__final(this, x, y, dx, dy);
}
}
@@ -2018,107 +2014,107 @@ static void t1_hinter_compute_stem_snap_range_hv(t1_hinter * this, int hv)
t1_glyph_space_coord pixel_g = (horiz ? this->pixel_gh : this->pixel_gw);
int stem_snap_count = this->stem_snap_count[hv];
- memset(this->stem_snap_vote, 0, stem_snap_count * sizeof(this->stem_snap_vote[0]));
+ memset(this->stem_snap_vote, 0, stem_snap_count * sizeof(this->stem_snap_vote[0]));
for (i = 0; i < this->hint_count; i++) {
- if (this->hint[i].type == t) {
- t1_glyph_space_coord gw = any_abs(this->hint[i].g1 - this->hint[i].g0);
+ if (this->hint[i].type == t) {
+ t1_glyph_space_coord gw = any_abs(this->hint[i].g1 - this->hint[i].g0);
- t1_hinter__hint_stem_snap_range(this, gw - pixel_g + 1, gw + pixel_g - 1, horiz,
- &this->hint[i].stem_snap_index0, &this->hint[i].stem_snap_index1);
- for (j = this->hint[i].stem_snap_index0; j <= this->hint[i].stem_snap_index1; j++)
- this->stem_snap_vote[j]++;
- }
+ t1_hinter__hint_stem_snap_range(this, gw - pixel_g + 1, gw + pixel_g - 1, horiz,
+ &this->hint[i].stem_snap_index0, &this->hint[i].stem_snap_index1);
+ for (j = this->hint[i].stem_snap_index0; j <= this->hint[i].stem_snap_index1; j++)
+ this->stem_snap_vote[j]++;
+ }
}
for (i = 0; i < this->hint_count; i++) {
- if (this->hint[i].type == t) {
- int m = 0, mj = -1, d, md = pixel_g * 2;
- t1_glyph_space_coord gw = any_abs(this->hint[i].g1 - this->hint[i].g0);
-
- for (j = this->hint[i].stem_snap_index0; j <= this->hint[i].stem_snap_index1; j++) {
- if (m < this->stem_snap_vote[j]) {
- m = this->stem_snap_vote[j];
- mj = j;
- md = any_abs(gw - pixel_g / 5 - this->stem_snap[hv][mj]);
- } else {
- d = any_abs(gw - pixel_g / 5 - this->stem_snap[hv][j]);
- if (md > d) {
- md = d;
- mj = j;
- }
- }
- }
- this->hint[i].stem_snap_index0 = mj;
- }
+ if (this->hint[i].type == t) {
+ int m = 0, mj = -1, d, md = pixel_g * 2;
+ t1_glyph_space_coord gw = any_abs(this->hint[i].g1 - this->hint[i].g0);
+
+ for (j = this->hint[i].stem_snap_index0; j <= this->hint[i].stem_snap_index1; j++) {
+ if (m < this->stem_snap_vote[j]) {
+ m = this->stem_snap_vote[j];
+ mj = j;
+ md = any_abs(gw - pixel_g / 5 - this->stem_snap[hv][mj]);
+ } else {
+ d = any_abs(gw - pixel_g / 5 - this->stem_snap[hv][j]);
+ if (md > d) {
+ md = d;
+ mj = j;
+ }
+ }
+ }
+ this->hint[i].stem_snap_index0 = mj;
+ }
}
}
static void t1_hinter_compute_stem_snap_range(t1_hinter * this)
{
if (this->stem_snap_count[0] > 1)
- t1_hinter_compute_stem_snap_range_hv(this, 0);
+ t1_hinter_compute_stem_snap_range_hv(this, 0);
if (this->stem_snap_count[1] > 1)
- t1_hinter_compute_stem_snap_range_hv(this, 1);
+ t1_hinter_compute_stem_snap_range_hv(this, 1);
}
static void t1_hinter__align_stem_width(t1_hinter * this, t1_glyph_space_coord *pgw, const t1_hint *hint)
-{
+{
bool horiz = (hint->type == hstem);
t1_glyph_space_coord gw = *pgw;
t1_glyph_space_coord pixel_g = (horiz ? this->pixel_gh : this->pixel_gw);
t1_glyph_space_coord gwe;
if (!this->keep_stem_width || pixel_g == 0)
- return;
+ return;
if (hint->stem_snap_index0 >= 0 && this->stem_snap_count[horiz ? 0 : 1] > 0) {
- t1_glyph_space_coord w0 = this->stem_snap[horiz ? 0 : 1][hint->stem_snap_index0];
+ t1_glyph_space_coord w0 = this->stem_snap[horiz ? 0 : 1][hint->stem_snap_index0];
t1_glyph_space_coord thr0 = pixel_g * 70 / 100, thr1 = pixel_g * 35 / 100;
- if (gw - thr0 <= w0 && w0 <= gw + thr1)
- gw = w0;
+ if (gw - thr0 <= w0 && w0 <= gw + thr1)
+ gw = w0;
}
gwe = gw % pixel_g;
if (gw >= pixel_g && gwe < pixel_g / 2)
- gw -= gwe;
+ gw -= gwe;
else
- gw += pixel_g - gwe;
+ gw += pixel_g - gwe;
*pgw = gw;
}
-static void t1_hinter__align_stem_to_grid(t1_hinter * this, int32_t unit,
- t1_glyph_space_coord *x0, t1_glyph_space_coord *y0,
- t1_glyph_space_coord x1, t1_glyph_space_coord y1,
- bool align_to_pixels, const t1_hint *hint)
+static void t1_hinter__align_stem_to_grid(t1_hinter * this, int32_t unit,
+ t1_glyph_space_coord *x0, t1_glyph_space_coord *y0,
+ t1_glyph_space_coord x1, t1_glyph_space_coord y1,
+ bool align_to_pixels, const t1_hint *hint)
{ /* Implemented for Bug 687578 "T1 hinter disturbs stem width". */
/* fixme: optimize. */
if (unit > 0) {
- bool horiz = (hint->type == hstem);
- t1_glyph_space_coord gw = (horiz ? y1 - *y0 : x1 - *x0);
- t1_glyph_space_coord GW = any_abs(gw), GW0 = GW;
- bool positive = (gw >= 0);
- int19 cf = (horiz ? this->heigt_transform_coef_rat : this->width_transform_coef_rat);
+ bool horiz = (hint->type == hstem);
+ t1_glyph_space_coord gw = (horiz ? y1 - *y0 : x1 - *x0);
+ t1_glyph_space_coord GW = any_abs(gw), GW0 = GW;
+ bool positive = (gw >= 0);
+ int19 cf = (horiz ? this->heigt_transform_coef_rat : this->width_transform_coef_rat);
t1_hinter_space_coord dx0, dy0, dx1, dy1, dgw;
- t1_hinter__align_to_grid__general(this, unit, *x0, *y0, &dx0, &dy0, align_to_pixels, align_to_pixels);
- t1_hinter__align_to_grid__general(this, unit, x1, y1, &dx1, &dy1, align_to_pixels, align_to_pixels);
- t1_hinter__align_stem_width(this, &GW, hint);
- dgw = g2o_dist(GW - GW0, cf);
- if ((horiz ? (!this->transposed ? this->ctmf.yy : this->ctmf.xy)
- : (!this->transposed ? this->ctmf.xx : this->ctmf.yx)) < 0)
- dgw = - dgw;
- if (horiz) {
- t1_hinter_space_coord ddy1 = (positive ? dy0 - dgw : dy0 + dgw);
- t1_hinter_space_coord ddy0 = (positive ? dy1 + dgw : dy1 - dgw);
-
- if (any_abs(dy0 + ddy1) > any_abs(dy1 + ddy0))
- dy0 = ddy0;
- } else {
- t1_hinter_space_coord ddx1 = (positive ? dx0 - dgw : dx0 + dgw);
- t1_hinter_space_coord ddx0 = (positive ? dx1 + dgw : dx1 - dgw);
+ t1_hinter__align_to_grid__general(this, unit, *x0, *y0, &dx0, &dy0, align_to_pixels, align_to_pixels);
+ t1_hinter__align_to_grid__general(this, unit, x1, y1, &dx1, &dy1, align_to_pixels, align_to_pixels);
+ t1_hinter__align_stem_width(this, &GW, hint);
+ dgw = g2o_dist(GW - GW0, cf);
+ if ((horiz ? (!this->transposed ? this->ctmf.yy : this->ctmf.xy)
+ : (!this->transposed ? this->ctmf.xx : this->ctmf.yx)) < 0)
+ dgw = - dgw;
+ if (horiz) {
+ t1_hinter_space_coord ddy1 = (positive ? dy0 - dgw : dy0 + dgw);
+ t1_hinter_space_coord ddy0 = (positive ? dy1 + dgw : dy1 - dgw);
+
+ if (any_abs(dy0 + ddy1) > any_abs(dy1 + ddy0))
+ dy0 = ddy0;
+ } else {
+ t1_hinter_space_coord ddx1 = (positive ? dx0 - dgw : dx0 + dgw);
+ t1_hinter_space_coord ddx0 = (positive ? dx1 + dgw : dx1 - dgw);
- if (any_abs(dx0 + ddx1) > any_abs(dx1 + ddx0))
- dx0 = ddx0;
- }
- t1_hinter__align_to_grid__final(this, x0, y0, dx0, dy0);
+ if (any_abs(dx0 + ddx1) > any_abs(dx1 + ddx0))
+ dx0 = ddx0;
+ }
+ t1_hinter__align_to_grid__final(this, x0, y0, dx0, dy0);
}
}
@@ -2143,9 +2139,9 @@ static void t1_hinter__add_overshoot(t1_hinter * this, t1_zone * zone, t1_glyph_
}
#endif
-static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
- t1_glyph_space_coord * gc, int segment_index, fixed t, const t1_hint *hint,
- enum t1_align_type align0)
+static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
+ t1_glyph_space_coord * gc, int segment_index, fixed t, const t1_hint *hint,
+ enum t1_align_type align0)
{ /* Returns true, if alignment zone is applied. */
/* t is 0 or 0.5, and it is always 0 for curves. */
bool horiz = (hint->type == hstem);
@@ -2154,13 +2150,13 @@ static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
t1_glyph_space_coord gy = this->pole[segment_index].gy, gy0;
t1_glyph_space_coord gc0 = (horiz ? gy : gx);
bool align_by_stem =
- align0 == unaligned /* Force aligning outer boundaries
- from the TT spot analyzer. */
- && hint->b0 && hint->b1; /* It's a real stem. Contrary
- 033-52-5873.pdf uses single hint boundaries
- to mark top|bottom sides of a glyph,
- but their opposite boundaries are dummy coordinates,
- which don't correspond to poles. */
+ align0 == unaligned /* Force aligning outer boundaries
+ from the TT spot analyzer. */
+ && hint->b0 && hint->b1; /* It's a real stem. Contrary
+ 033-52-5873.pdf uses single hint boundaries
+ to mark top|bottom sides of a glyph,
+ but their opposite boundaries are dummy coordinates,
+ which don't correspond to poles. */
/* Compute point of specified segment by parameter t : */
if (t) {
@@ -2183,30 +2179,30 @@ static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
int prev2 = ranger_step_b(prev1 , beg_contour_pole, end_contour_pole);
int next1 = ranger_step_f(segment_index, beg_contour_pole, end_contour_pole);
int next2 = ranger_step_f(next1 , beg_contour_pole, end_contour_pole);
- bool forwd_horiz = (any_abs(this->pole[next1].gy - pole->gy) <=
- max(this->blue_fuzz, any_abs(this->pole[next1].gx - pole->gx) / 10));
- bool bckwd_horiz = (any_abs(this->pole[prev1].gy - pole->gy) <=
- max(this->blue_fuzz, any_abs(this->pole[prev1].gx - pole->gx) / 10));
- bool maximum = (this->pole[next1].gy - pole->gy < 0 &&
- this->pole[prev1].gy - pole->gy < 0);
- bool minimum = (this->pole[next1].gy - pole->gy > 0 &&
- this->pole[prev1].gy - pole->gy > 0);
-
+ bool forwd_horiz = (any_abs(this->pole[next1].gy - pole->gy) <=
+ max(this->blue_fuzz, any_abs(this->pole[next1].gx - pole->gx) / 10));
+ bool bckwd_horiz = (any_abs(this->pole[prev1].gy - pole->gy) <=
+ max(this->blue_fuzz, any_abs(this->pole[prev1].gx - pole->gx) / 10));
+ bool maximum = (this->pole[next1].gy - pole->gy < 0 &&
+ this->pole[prev1].gy - pole->gy < 0);
+ bool minimum = (this->pole[next1].gy - pole->gy > 0 &&
+ this->pole[prev1].gy - pole->gy > 0);
+
if (forwd_horiz || bckwd_horiz || maximum || minimum) {
bool forwd_curve = (this->pole[next1].type == offcurve);
bool bckwd_curve = (this->pole[prev1].type == offcurve);
bool curve = (bckwd_curve && forwd_curve);
- bool convex = (curve && this->pole[prev2].gy <= pole->gy &&
+ bool convex = (curve && this->pole[prev2].gy <= pole->gy &&
this->pole[next2].gy <= pole->gy);
- bool concave = (curve && this->pole[prev2].gy >= pole->gy &&
+ bool concave = (curve && this->pole[prev2].gy >= pole->gy &&
this->pole[next2].gy >= pole->gy);
- t1_zone *zone = t1_hinter__find_zone(this, pole->gy, curve || maximum || minimum,
- convex || maximum, concave || minimum);
+ t1_zone *zone = t1_hinter__find_zone(this, pole->gy, curve || maximum || minimum,
+ convex || maximum, concave || minimum);
if (zone != NULL &&
- (forwd_horiz || bckwd_horiz ||
- (maximum && zone->type == topzone) ||
- (minimum && zone->type == botzone))) {
+ (forwd_horiz || bckwd_horiz ||
+ (maximum && zone->type == topzone) ||
+ (minimum && zone->type == botzone))) {
if (this->suppress_overshoots)
# if ADOBE_OVERSHOOT_COMPATIBILIY
gy = (zone->type == topzone ? zone->overshoot_y : zone->y);
@@ -2224,52 +2220,52 @@ static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
if (s < ss) /* Enforce overshoot : */
gy = (zone->type == topzone ? zone->y + ss : zone->y - ss);
- else {
+ else {
# if ADOBE_OVERSHOOT_COMPATIBILIY
t1_hinter__add_overshoot(this, zone, &gx, &gy);
# endif
}
- }
+ }
}
align = (zone->type == topzone ? topzn : botzn);
- align_by_stem = false;
+ align_by_stem = false;
}
}
}
vd_circle(gx, gy, 7, RGB(0,255,0));
if (align_by_stem) {
- t1_glyph_space_coord gx1, gy1;
-
- if (horiz) {
- bool b0 = t1_hinter__is_stem_boundary_near(this, hint, gy, 0);
- bool b1 = t1_hinter__is_stem_boundary_near(this, hint, gy, 1);
-
- gx1 = gx;
- if (b0 && !b1)
- gy1 = hint->g1, align_by_stem = true;
- else if (!b0 && b1)
- gy1 = hint->g0, align_by_stem = true;
- else
- gy1 = 0; /* Quiet the compiler. */
- } else {
- bool b0 = t1_hinter__is_stem_boundary_near(this, hint, gx, 0);
- bool b1 = t1_hinter__is_stem_boundary_near(this, hint, gx, 1);
-
- gy1 = gy;
- if (b0 && !b1)
- gx1 = hint->g1, align_by_stem = true;
- else if (!b0 && b1)
- gx1 = hint->g0, align_by_stem = true;
- else
- gx1 = 0; /* Quiet the compiler. */
- }
- if (align_by_stem)
- t1_hinter__align_stem_to_grid(this, this->g2o_fraction, &gx, &gy, gx1, gy1,
- CONTRAST_STEMS || this->align_to_pixels, hint);
+ t1_glyph_space_coord gx1, gy1;
+
+ if (horiz) {
+ bool b0 = t1_hinter__is_stem_boundary_near(this, hint, gy, 0);
+ bool b1 = t1_hinter__is_stem_boundary_near(this, hint, gy, 1);
+
+ gx1 = gx;
+ if (b0 && !b1)
+ gy1 = hint->g1, align_by_stem = true;
+ else if (!b0 && b1)
+ gy1 = hint->g0, align_by_stem = true;
+ else
+ gy1 = 0; /* Quiet the compiler. */
+ } else {
+ bool b0 = t1_hinter__is_stem_boundary_near(this, hint, gx, 0);
+ bool b1 = t1_hinter__is_stem_boundary_near(this, hint, gx, 1);
+
+ gy1 = gy;
+ if (b0 && !b1)
+ gx1 = hint->g1, align_by_stem = true;
+ else if (!b0 && b1)
+ gx1 = hint->g0, align_by_stem = true;
+ else
+ gx1 = 0; /* Quiet the compiler. */
+ }
+ if (align_by_stem)
+ t1_hinter__align_stem_to_grid(this, this->g2o_fraction, &gx, &gy, gx1, gy1,
+ CONTRAST_STEMS || this->align_to_pixels, hint);
}
if (!align_by_stem)
- t1_hinter__align_to_grid(this, this->g2o_fraction, &gx, &gy,
- CONTRAST_STEMS || this->align_to_pixels);
+ t1_hinter__align_to_grid(this, this->g2o_fraction, &gx, &gy,
+ CONTRAST_STEMS || this->align_to_pixels);
vd_circle(gx, gy, 7, RGB(0,0,255));
*gc = gc0 + (horiz ? gy - gy0 : gx - gx0);
return (align == unaligned ? aligned : align);
@@ -2277,34 +2273,34 @@ static enum t1_align_type t1_hinter__compute_aligned_coord(t1_hinter * this,
#define PRESERVE_STEM_SLANT 1 /* 0 - always diminish
1 - preserve iff slanted in design space
- 2 - always preserve */
+ 2 - always preserve */
static int t1_hinter__find_stem_middle(t1_hinter * this, fixed *t, int pole_index, bool horiz)
-{
+{
/* *t = 0 preserves slant; *t = fixed_half deminishes slant (don't apply to curves). */
if (PRESERVE_STEM_SLANT == 2) {
- *t = 0;
- return pole_index;
+ *t = 0;
+ return pole_index;
} else {
- /* For a better representation of arms with a small slope,
- we align their poles. It appears useful for CJK fonts,
- see comparefiles/japan.ps, Bug687603.ps .
- Otherwise (a slightly rotated glyph, see Openhuis_pdf_zw.pdf)
- we align the arm middle, causing the slope to look smaller
+ /* For a better representation of arms with a small slope,
+ we align their poles. It appears useful for CJK fonts,
+ see comparefiles/japan.ps, Bug687603.ps .
+ Otherwise (a slightly rotated glyph, see Openhuis_pdf_zw.pdf)
+ we align the arm middle, causing the slope to look smaller
*/
- /* We assume proper glyphs, see Type 1 spec, chapter 4. */
- int next = t1_hinter__next_contour_pole(this, pole_index);
- const int alpha = 10;
- int design_slant;
- bool curve = this->pole[next].type == offcurve;
- bool continuing = (horiz ? t1_hinter__is_small_angle(this, next, pole_index, 1, 0, alpha, 1, &design_slant)
- : t1_hinter__is_small_angle(this, next, pole_index, 0, 1, alpha, 1, &design_slant));
+ /* We assume proper glyphs, see Type 1 spec, chapter 4. */
+ int next = t1_hinter__next_contour_pole(this, pole_index);
+ const int alpha = 10;
+ int design_slant;
+ bool curve = this->pole[next].type == offcurve;
+ bool continuing = (horiz ? t1_hinter__is_small_angle(this, next, pole_index, 1, 0, alpha, 1, &design_slant)
+ : t1_hinter__is_small_angle(this, next, pole_index, 0, 1, alpha, 1, &design_slant));
- if (!PRESERVE_STEM_SLANT || design_slant == 0)
- *t = (!curve && continuing ? fixed_half : 0);
- else
- *t = 0;
- return pole_index;
+ if (!PRESERVE_STEM_SLANT || design_slant == 0)
+ *t = (!curve && continuing ? fixed_half : 0);
+ else
+ *t = 0;
+ return pole_index;
}
}
@@ -2320,10 +2316,10 @@ static int t1_hinter__skip_stem(t1_hinter * this, int pole_index, bool horiz)
while (t1_hinter__is_small_angle(this, i, next_pole, tan_x, tan_y, 1000, 1, &quality) && /* The threshold is taken from scratch. */
t1_hinter__is_small_angle(this, i, next_segm, tan_x, tan_y, 1000, 1, &quality)) {
i = t1_hinter__segment_end(this, i);
- if (i == pole_index) {
- /* An invalid glyph with <=2 segments in the contour with no angles. */
- break;
- }
+ if (i == pole_index) {
+ /* An invalid glyph with <=2 segments in the contour with no angles. */
+ break;
+ }
next_pole = t1_hinter__next_contour_pole(this, i);
next_segm = t1_hinter__segment_end(this, i);
}
@@ -2334,114 +2330,114 @@ static void t1_hinter__mark_existing_stems(t1_hinter * this)
{ /* fixme: Duplicated code with t1_hinter__align_stem_commands. */
int i, j, jj, k;
- for(i = 0; i < this->hint_count; i++)
- if (this->hint[i].type == vstem || this->hint[i].type == hstem)
- for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
- int beg_range_pole = this->hint_range[k].beg_pole;
- int end_range_pole = this->hint_range[k].end_pole;
- int quality;
-
- if (this->pole[beg_range_pole].type == closepath) {
- /* A workaround for a buggy font from the Bug 687393,
- which defines a range with 'closepath' only. */
- beg_range_pole++;
- if (beg_range_pole > end_range_pole)
- continue;
- }
- for (j = beg_range_pole; j <= end_range_pole;) {
- int k = t1_hinter__is_stem_hint_applicable(this, &this->hint[i], j, &quality);
- if (k == 1)
- this->hint[i].b0 = true;
- else if (k == 2)
- this->hint[i].b1 = true;
- { /* Step to the next pole in the range : */
- jj = j;
- j = t1_hinter__segment_end(this, j);
- if (j <= jj) /* Rolled over contour end ? */
- j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
- }
- }
- }
+ for(i = 0; i < this->hint_count; i++)
+ if (this->hint[i].type == vstem || this->hint[i].type == hstem)
+ for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
+ int beg_range_pole = this->hint_range[k].beg_pole;
+ int end_range_pole = this->hint_range[k].end_pole;
+ int quality;
+
+ if (this->pole[beg_range_pole].type == closepath) {
+ /* A workaround for a buggy font from the Bug 687393,
+ which defines a range with 'closepath' only. */
+ beg_range_pole++;
+ if (beg_range_pole > end_range_pole)
+ continue;
+ }
+ for (j = beg_range_pole; j <= end_range_pole;) {
+ int k = t1_hinter__is_stem_hint_applicable(this, &this->hint[i], j, &quality);
+ if (k == 1)
+ this->hint[i].b0 = true;
+ else if (k == 2)
+ this->hint[i].b1 = true;
+ { /* Step to the next pole in the range : */
+ jj = j;
+ j = t1_hinter__segment_end(this, j);
+ if (j <= jj) /* Rolled over contour end ? */
+ j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
+ }
+ }
+ }
}
static void t1_hinter__add_boundary_length(t1_hinter * this, t1_hint *hint,
- int pole_index0, int pole_index1)
+ int pole_index0, int pole_index1)
{ const t1_pole *pole = &this->pole[pole_index0];
int contour_index = pole->contour_index;
int beg_contour_pole = this->contour[contour_index];
int end_contour_pole = this->contour[contour_index + 1] - 2;
int i0 = ranger_step_b(pole_index0, beg_contour_pole, end_contour_pole);
int i1 = ranger_step_f(pole_index1, beg_contour_pole, end_contour_pole);
- t1_glyph_space_coord g = (hint->type == hstem ? pole->gy : pole->gx);
+ t1_glyph_space_coord g = (hint->type == hstem ? pole->gy : pole->gx);
if (this->pole[i0].type == oncurve)
- i0 = pole_index0;
+ i0 = pole_index0;
if (this->pole[i1].type == oncurve)
- i1 = pole_index1;
+ i1 = pole_index1;
*(any_abs(hint->g0 - g) < any_abs(hint->g1 - g) ? &hint->boundary_length0 : &hint->boundary_length1)
- += (hint->type == hstem ? any_abs(this->pole[i0].gx - this->pole[i1].gx)
- : any_abs(this->pole[i0].gy - this->pole[i1].gy));
+ += (hint->type == hstem ? any_abs(this->pole[i0].gx - this->pole[i1].gx)
+ : any_abs(this->pole[i0].gy - this->pole[i1].gy));
}
static void t1_hinter__align_stem_commands(t1_hinter * this)
{ int i, j, jj, k;
for(i = 0; i < this->hint_count; i++) {
- this->hint[i].boundary_length0 = this->hint[i].boundary_length1 = 0;
- if (this->hint[i].type == vstem || this->hint[i].type == hstem)
- for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
- int beg_range_pole = this->hint_range[k].beg_pole;
- int end_range_pole = this->hint_range[k].end_pole;
- bool horiz = (this->hint[i].type == hstem);
- int quality = max_int;
-
- if (this->pole[beg_range_pole].type == closepath) {
- /* A workaround for a buggy font from the Bug 687393,
- which defines a range with 'closepath' only. */
- beg_range_pole++;
- if (beg_range_pole > end_range_pole)
- continue;
- }
- for (j = beg_range_pole; j <= end_range_pole;) {
- if (this->pole[j].type == closepath) {
- j++;
- continue;
- }
- if (t1_hinter__is_stem_hint_applicable(this, &this->hint[i], j, &quality)) {
- fixed t; /* Type 1 spec implies that it is 0 for curves, 0.5 for bars */
- int segment_index = t1_hinter__find_stem_middle(this, &t, j, horiz);
- t1_glyph_space_coord gc;
- enum t1_align_type align = unaligned;
-
- if (this->hint[i].side_mask != 3) {
- /* An overal hint from the True Type autohinter. */
- align = (this->hint[i].side_mask & 2 ? topzn : botzn);
- } else if (this->autohinting && horiz) {
- if (this->pole[segment_index].gy == this->hint[i].g0)
- align = (this->hint[i].g0 > this->hint[i].g1 ? topzn : botzn);
- }
- align = t1_hinter__compute_aligned_coord(this, &gc,
- segment_index, t, &this->hint[i], align);
- vd_square(this->pole[segment_index].gx, this->pole[segment_index].gy,
- (horiz ? 7 : 9), (i < this->primary_hint_count ? RGB(0,0,255) : RGB(0,255,0)));
- /* todo: optimize: primary commands don't need to align, if suppressed by secondary ones. */
- t1_hint__set_aligned_coord(&this->hint[i], gc, &this->pole[j], align, quality);
- jj = j;
- j = t1_hinter__skip_stem(this, j, horiz);
- t1_hinter__add_boundary_length(this, &this->hint[i], jj, j);
- if (j < jj) { /* Rolled over contour end ? */
- j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
- continue;
- }
- }
- { /* Step to the next pole in the range : */
- jj = j;
- j = t1_hinter__segment_end(this, j);
- if (j <= jj) /* Rolled over contour end ? */
- j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
- }
- }
- }
+ this->hint[i].boundary_length0 = this->hint[i].boundary_length1 = 0;
+ if (this->hint[i].type == vstem || this->hint[i].type == hstem)
+ for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
+ int beg_range_pole = this->hint_range[k].beg_pole;
+ int end_range_pole = this->hint_range[k].end_pole;
+ bool horiz = (this->hint[i].type == hstem);
+ int quality = max_int;
+
+ if (this->pole[beg_range_pole].type == closepath) {
+ /* A workaround for a buggy font from the Bug 687393,
+ which defines a range with 'closepath' only. */
+ beg_range_pole++;
+ if (beg_range_pole > end_range_pole)
+ continue;
+ }
+ for (j = beg_range_pole; j <= end_range_pole;) {
+ if (this->pole[j].type == closepath) {
+ j++;
+ continue;
+ }
+ if (t1_hinter__is_stem_hint_applicable(this, &this->hint[i], j, &quality)) {
+ fixed t; /* Type 1 spec implies that it is 0 for curves, 0.5 for bars */
+ int segment_index = t1_hinter__find_stem_middle(this, &t, j, horiz);
+ t1_glyph_space_coord gc;
+ enum t1_align_type align = unaligned;
+
+ if (this->hint[i].side_mask != 3) {
+ /* An overal hint from the True Type autohinter. */
+ align = (this->hint[i].side_mask & 2 ? topzn : botzn);
+ } else if (this->autohinting && horiz) {
+ if (this->pole[segment_index].gy == this->hint[i].g0)
+ align = (this->hint[i].g0 > this->hint[i].g1 ? topzn : botzn);
+ }
+ align = t1_hinter__compute_aligned_coord(this, &gc,
+ segment_index, t, &this->hint[i], align);
+ vd_square(this->pole[segment_index].gx, this->pole[segment_index].gy,
+ (horiz ? 7 : 9), (i < this->primary_hint_count ? RGB(0,0,255) : RGB(0,255,0)));
+ /* todo: optimize: primary commands don't need to align, if suppressed by secondary ones. */
+ t1_hint__set_aligned_coord(&this->hint[i], gc, &this->pole[j], align, quality);
+ jj = j;
+ j = t1_hinter__skip_stem(this, j, horiz);
+ t1_hinter__add_boundary_length(this, &this->hint[i], jj, j);
+ if (j < jj) { /* Rolled over contour end ? */
+ j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
+ continue;
+ }
+ }
+ { /* Step to the next pole in the range : */
+ jj = j;
+ j = t1_hinter__segment_end(this, j);
+ if (j <= jj) /* Rolled over contour end ? */
+ j = this->contour[this->pole[j].contour_index + 1]; /* Go to the next contour. */
+ }
+ }
+ }
}
}
@@ -2453,55 +2449,55 @@ static void t1_hinter__unfix_opposite_to_common(t1_hinter * this)
enum t1_align_type *p_aj, *p_ai, *p_oi, *p_oj, am;
for (k = 0; k < 2; k++) { /* g0, g1 */
- /* Since the number of stems in a complex is usually small,
- we don't care about redundant computations. */
- for(i = 0; i < this->hint_count; i++) {
- if (this->hint[i].type == vstem || this->hint[i].type == hstem) {
- p_ai = (!k ? &this->hint[i].aligned0 : &this->hint[i].aligned1);
- p_oi = (!k ? &this->hint[i].aligned1 : &this->hint[i].aligned0);
- if (*p_ai > weak && *p_ai == *p_oi) {
- p_ci = (!k ? &this->hint[i].g0 : &this->hint[i].g1);
- md = any_abs(this->hint[i].g1 - this->hint[i].g0);
- m = i;
- am = *p_ai;
- agm = (!k ? this->hint[m].ag0 : this->hint[m].ag1);
- n = 0;
- for(j = 0; j < this->hint_count; j++) {
- if (j != i && this->hint[i].type == this->hint[j].type) {
- p_cj = (!k ? &this->hint[j].g0 : &this->hint[j].g1);
- if (*p_ci == *p_cj) {
- n++;
- p_aj = (!k ? &this->hint[j].aligned0 : &this->hint[j].aligned1);
- d = any_abs(this->hint[j].g1 - this->hint[j].g0);
- if (am < *p_aj) {
- md = d;
- m = j;
- am = *p_aj;
- agm = (!k ? this->hint[m].ag0 : this->hint[m].ag1);
- } if (md < d) {
- md = d;
- m = j;
- }
- }
- }
- }
- if (n) {
- for(j = 0; j < this->hint_count; j++) {
- p_cj = (!k ? &this->hint[j].g0 : &this->hint[j].g1);
- if (*p_ci == *p_cj) {
- p_aj = (!k ? &this->hint[j].aligned0 : &this->hint[j].aligned1);
- p_oj = (!k ? &this->hint[j].aligned1 : &this->hint[j].aligned0);
- p_agj = (!k ? &this->hint[j].ag0 : &this->hint[j].ag1);
- *p_aj = am;
- if (*p_oj == aligned)
- *p_oj = weak;
- *p_agj = agm;
- }
- }
- }
- }
- }
- }
+ /* Since the number of stems in a complex is usually small,
+ we don't care about redundant computations. */
+ for(i = 0; i < this->hint_count; i++) {
+ if (this->hint[i].type == vstem || this->hint[i].type == hstem) {
+ p_ai = (!k ? &this->hint[i].aligned0 : &this->hint[i].aligned1);
+ p_oi = (!k ? &this->hint[i].aligned1 : &this->hint[i].aligned0);
+ if (*p_ai > weak && *p_ai == *p_oi) {
+ p_ci = (!k ? &this->hint[i].g0 : &this->hint[i].g1);
+ md = any_abs(this->hint[i].g1 - this->hint[i].g0);
+ m = i;
+ am = *p_ai;
+ agm = (!k ? this->hint[m].ag0 : this->hint[m].ag1);
+ n = 0;
+ for(j = 0; j < this->hint_count; j++) {
+ if (j != i && this->hint[i].type == this->hint[j].type) {
+ p_cj = (!k ? &this->hint[j].g0 : &this->hint[j].g1);
+ if (*p_ci == *p_cj) {
+ n++;
+ p_aj = (!k ? &this->hint[j].aligned0 : &this->hint[j].aligned1);
+ d = any_abs(this->hint[j].g1 - this->hint[j].g0);
+ if (am < *p_aj) {
+ md = d;
+ m = j;
+ am = *p_aj;
+ agm = (!k ? this->hint[m].ag0 : this->hint[m].ag1);
+ } if (md < d) {
+ md = d;
+ m = j;
+ }
+ }
+ }
+ }
+ if (n) {
+ for(j = 0; j < this->hint_count; j++) {
+ p_cj = (!k ? &this->hint[j].g0 : &this->hint[j].g1);
+ if (*p_ci == *p_cj) {
+ p_aj = (!k ? &this->hint[j].aligned0 : &this->hint[j].aligned1);
+ p_oj = (!k ? &this->hint[j].aligned1 : &this->hint[j].aligned0);
+ p_agj = (!k ? &this->hint[j].ag0 : &this->hint[j].ag1);
+ *p_aj = am;
+ if (*p_oj == aligned)
+ *p_oj = weak;
+ *p_agj = agm;
+ }
+ }
+ }
+ }
+ }
+ }
}
}
@@ -2517,7 +2513,7 @@ static void t1_hinter__compute_opposite_stem_coords(t1_hinter * this)
t1_glyph_space_coord gw;
gw = any_abs(this->hint[i].g1 - this->hint[i].g0);
- t1_hinter__align_stem_width(this, &gw, &this->hint[i]);
+ t1_hinter__align_stem_width(this, &gw, &this->hint[i]);
if (this->hint[i].g1 - this->hint[i].g0 < 0)
gw = -gw;
if (aligned0 > aligned1)
@@ -2528,32 +2524,32 @@ static void t1_hinter__compute_opposite_stem_coords(t1_hinter * this)
t1_glyph_space_coord d0 = any_abs(ag0 - this->hint[i].g0);
t1_glyph_space_coord d1 = any_abs(ag1 - this->hint[i].g1);
- if (aligned0 == topzn || aligned1 == topzn)
- if (gw > 0)
- ag0 = ag1 - gw;
- else
- ag1 = ag0 + gw;
- else if (aligned0 == botzn || aligned1 == botzn)
- if (gw < 0)
- ag0 = ag1 - gw;
- else
- ag1 = ag0 + gw;
- else if (this->hint[i].type == hstem &&
- min(any_abs(this->hint[i].g0 - this->ymid), any_abs(this->hint[i].g1 - this->ymid)) >
- (this->ymax - this->ymin) / 5) {
- if ((this->hint[i].g1 + this->hint[i].g0) / 2 > this->ymid)
- ag0 = ag1 - gw;
- else
- ag1 = ag0 + gw;
- } else {
- if (d0 < d1)
- ag1 = ag0 + gw;
- else
- ag0 = ag1 - gw;
- }
+ if (aligned0 == topzn || aligned1 == topzn)
+ if (gw > 0)
+ ag0 = ag1 - gw;
+ else
+ ag1 = ag0 + gw;
+ else if (aligned0 == botzn || aligned1 == botzn)
+ if (gw < 0)
+ ag0 = ag1 - gw;
+ else
+ ag1 = ag0 + gw;
+ else if (this->hint[i].type == hstem &&
+ min(any_abs(this->hint[i].g0 - this->ymid), any_abs(this->hint[i].g1 - this->ymid)) >
+ (this->ymax - this->ymin) / 5) {
+ if ((this->hint[i].g1 + this->hint[i].g0) / 2 > this->ymid)
+ ag0 = ag1 - gw;
+ else
+ ag1 = ag0 + gw;
+ } else {
+ if (d0 < d1)
+ ag1 = ag0 + gw;
+ else
+ ag0 = ag1 - gw;
+ }
}
- this->hint[i].ag0 = ag0;
- this->hint[i].ag1 = ag1;
+ this->hint[i].ag0 = ag0;
+ this->hint[i].ag1 = ag1;
}
}
@@ -2563,7 +2559,7 @@ static int t1_hinter__store_hint_applying(t1_hinter * this, t1_hint *hint, int p
int code = t1_hinter__can_add_hint_applying(this, &ha);
if (code < 0)
- return code;
+ return code;
ha->pole = pole_index;
ha->opposite = -1;
this->hint_applying_count++;
@@ -2576,86 +2572,86 @@ static int t1_hinter__align_stem_poles(t1_hinter * this)
int code = 0;
for (i = 0; i < this->hint_count; i++)
- if (this->hint[i].type == vstem || this->hint[i].type == hstem) {
- t1_hint * hint = &this->hint[i];
- t1_glyph_space_coord ag0 = hint->ag0, ag1 = hint->ag1;
- bool horiz = (hint->type == hstem);
-
- /* fixme: optimize: Reduce hint_applying with storing only one side of the hint. */
- this->hint_applying_count = 0;
- for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
- int beg_range_pole = this->hint_range[k].beg_pole;
- int end_range_pole = this->hint_range[k].end_pole;
-
- for (j = beg_range_pole; j <= end_range_pole; j++) {
- t1_pole * pole = &this->pole[j];
-
- if (pole->type != oncurve)
- continue;
- if (!horiz && any_abs(pole->gx - hint->g0) <= fuzz)
- code = t1_hinter__store_hint_applying(this, hint, j);
- else if (!horiz && any_abs(pole->gx - hint->g1) <= fuzz)
- code = t1_hinter__store_hint_applying(this, hint, j);
- else if ( horiz && any_abs(pole->gy - hint->g0) <= fuzz)
- code = t1_hinter__store_hint_applying(this, hint, j);
- else if ( horiz && any_abs(pole->gy - hint->g1) <= fuzz)
- code = t1_hinter__store_hint_applying(this, hint, j);
- if (code < 0)
- return code;
- }
- }
- for (k = 0; k < this->hint_applying_count; k++) {
- t1_hint_applying *ha0 = &this->hint_applying[k];
- int pole_index0 = ha0->pole;
- t1_pole *pole0 = &this->pole[pole_index0];
- t1_glyph_space_coord g0 = (horiz ? pole0->gy : pole0->gx);
- t1_glyph_space_coord t0 = (horiz ? pole0->gx : pole0->gy);
- bool gt0 = any_abs(hint->g0 - g0) > any_abs(hint->g1 - g0);
- t1_glyph_space_coord d, md = any_abs(hint->g1 - hint->g0) * 5 / 4;
- int mj = -1;
-
- for (j = 0; j < this->hint_applying_count; j++) {
- t1_hint_applying *ha1 = &this->hint_applying[j];
- int pole_index1 = ha1->pole;
- t1_pole *pole1 = &this->pole[pole_index1];
- t1_glyph_space_coord g1 = (horiz ? pole1->gy : pole1->gx);
- t1_glyph_space_coord t1 = (horiz ? pole1->gx : pole1->gy);
- bool gt1 = any_abs(hint->g0 - g1) > any_abs(hint->g1 - g1);
-
- if (gt0 != gt1) {
- d = any_abs(t1 - t0);
- if (md > d) {
- d = md;
- mj = j;
- }
- }
- }
- if (mj != -1) {
- ha0->opposite = mj;
- this->hint_applying[mj].opposite = j;
- }
- }
- for (k = 0; k < this->hint_applying_count; k++) {
- t1_hint_applying *ha = &this->hint_applying[k];
- int pole_index = ha->pole;
- t1_pole *pole = &this->pole[pole_index];
- t1_glyph_space_coord g0 = (horiz ? pole->gy : pole->gx);
- bool gt0 = any_abs(hint->g0 - g0) > any_abs(hint->g1 - g0);
- enum t1_align_type align = (!gt0 ? hint->aligned0 : hint->aligned1);
- t1_glyph_space_coord ag = (!gt0 ? ag0 : ag1);
- t1_glyph_space_coord bl = (!gt0 ? hint->boundary_length1 : hint->boundary_length0); /* opposite */
-
- if (ha->opposite == -1)
- align = weak;
- if (!horiz) {
- if (pole->aligned_x < align)
- pole->ax = ag, pole->aligned_x = align, pole->boundary_length_x = bl;
- } else {
- if (pole->aligned_y < align)
- pole->ay = ag, pole->aligned_y = align, pole->boundary_length_y = bl;
- }
- }
- }
+ if (this->hint[i].type == vstem || this->hint[i].type == hstem) {
+ t1_hint * hint = &this->hint[i];
+ t1_glyph_space_coord ag0 = hint->ag0, ag1 = hint->ag1;
+ bool horiz = (hint->type == hstem);
+
+ /* fixme: optimize: Reduce hint_applying with storing only one side of the hint. */
+ this->hint_applying_count = 0;
+ for (k = this->hint[i].range_index; k != -1; k = this->hint_range[k].next) {
+ int beg_range_pole = this->hint_range[k].beg_pole;
+ int end_range_pole = this->hint_range[k].end_pole;
+
+ for (j = beg_range_pole; j <= end_range_pole; j++) {
+ t1_pole * pole = &this->pole[j];
+
+ if (pole->type != oncurve)
+ continue;
+ if (!horiz && any_abs(pole->gx - hint->g0) <= fuzz)
+ code = t1_hinter__store_hint_applying(this, hint, j);
+ else if (!horiz && any_abs(pole->gx - hint->g1) <= fuzz)
+ code = t1_hinter__store_hint_applying(this, hint, j);
+ else if ( horiz && any_abs(pole->gy - hint->g0) <= fuzz)
+ code = t1_hinter__store_hint_applying(this, hint, j);
+ else if ( horiz && any_abs(pole->gy - hint->g1) <= fuzz)
+ code = t1_hinter__store_hint_applying(this, hint, j);
+ if (code < 0)
+ return code;
+ }
+ }
+ for (k = 0; k < this->hint_applying_count; k++) {
+ t1_hint_applying *ha0 = &this->hint_applying[k];
+ int pole_index0 = ha0->pole;
+ t1_pole *pole0 = &this->pole[pole_index0];
+ t1_glyph_space_coord g0 = (horiz ? pole0->gy : pole0->gx);
+ t1_glyph_space_coord t0 = (horiz ? pole0->gx : pole0->gy);
+ bool gt0 = any_abs(hint->g0 - g0) > any_abs(hint->g1 - g0);
+ t1_glyph_space_coord d, md = any_abs(hint->g1 - hint->g0) * 5 / 4;
+ int mj = -1;
+
+ for (j = 0; j < this->hint_applying_count; j++) {
+ t1_hint_applying *ha1 = &this->hint_applying[j];
+ int pole_index1 = ha1->pole;
+ t1_pole *pole1 = &this->pole[pole_index1];
+ t1_glyph_space_coord g1 = (horiz ? pole1->gy : pole1->gx);
+ t1_glyph_space_coord t1 = (horiz ? pole1->gx : pole1->gy);
+ bool gt1 = any_abs(hint->g0 - g1) > any_abs(hint->g1 - g1);
+
+ if (gt0 != gt1) {
+ d = any_abs(t1 - t0);
+ if (md > d) {
+ d = md;
+ mj = j;
+ }
+ }
+ }
+ if (mj != -1) {
+ ha0->opposite = mj;
+ this->hint_applying[mj].opposite = j;
+ }
+ }
+ for (k = 0; k < this->hint_applying_count; k++) {
+ t1_hint_applying *ha = &this->hint_applying[k];
+ int pole_index = ha->pole;
+ t1_pole *pole = &this->pole[pole_index];
+ t1_glyph_space_coord g0 = (horiz ? pole->gy : pole->gx);
+ bool gt0 = any_abs(hint->g0 - g0) > any_abs(hint->g1 - g0);
+ enum t1_align_type align = (!gt0 ? hint->aligned0 : hint->aligned1);
+ t1_glyph_space_coord ag = (!gt0 ? ag0 : ag1);
+ t1_glyph_space_coord bl = (!gt0 ? hint->boundary_length1 : hint->boundary_length0); /* opposite */
+
+ if (ha->opposite == -1)
+ align = weak;
+ if (!horiz) {
+ if (pole->aligned_x < align)
+ pole->ax = ag, pole->aligned_x = align, pole->boundary_length_x = bl;
+ } else {
+ if (pole->aligned_y < align)
+ pole->ay = ag, pole->aligned_y = align, pole->boundary_length_y = bl;
+ }
+ }
+ }
return 0;
}
@@ -2682,7 +2678,7 @@ static void t1_hinter__process_dotsection(t1_hinter * this, int beg_pole, int en
we compute bounding box from poles.
*/
int i;
- t1_glyph_space_coord min_gx = this->pole[beg_pole].gx, min_gy = this->pole[beg_pole].gy;
+ t1_glyph_space_coord min_gx = this->pole[beg_pole].gx, min_gy = this->pole[beg_pole].gy;
t1_glyph_space_coord max_gx = min_gx, max_gy = min_gy;
t1_glyph_space_coord center_gx, center_gy, center_agx, center_agy;
t1_glyph_space_coord sx, sy;
@@ -2710,7 +2706,7 @@ static void t1_hinter__process_dotsection(t1_hinter * this, int beg_pole, int en
aligned_x = aligned_min_x && aligned_max_x;
aligned_y = aligned_min_y && aligned_max_y;
if (aligned_x && aligned_y)
- return; /* The contour was aligned with stem commands - nothing to do. */
+ return; /* The contour was aligned with stem commands - nothing to do. */
center_gx = center_agx = (min_gx + max_gx) / 2;
center_gy = center_agy = (min_gy + max_gy) / 2;
vd_circle(center_agx, center_agy, 7, RGB(255,0,0));
@@ -2723,8 +2719,8 @@ static void t1_hinter__process_dotsection(t1_hinter * this, int beg_pole, int en
}
}
vd_circle(center_agx, center_agy, 7, RGB(0,255,0));
- t1_hinter__align_to_grid(this, this->g2o_fraction / 2, &center_agx, &center_agy,
- CONTRAST_STEMS || this->align_to_pixels);
+ t1_hinter__align_to_grid(this, this->g2o_fraction / 2, &center_agx, &center_agy,
+ CONTRAST_STEMS || this->align_to_pixels);
vd_circle(center_agx, center_agy, 7, RGB(0,0,255));
sx = center_agx - center_gx;
sy = center_agy - center_gy;
@@ -2746,8 +2742,8 @@ static void t1_hinter__process_dotsections(t1_hinter * this)
for(i = 0; i < this->hint_count; i++)
if (this->hint[i].type == dot) {
- int pole_index = this->hint_range[this->hint[i].range_index].beg_pole;
- int contour_index = this->pole[pole_index].contour_index;
+ int pole_index = this->hint_range[this->hint[i].range_index].beg_pole;
+ int contour_index = this->pole[pole_index].contour_index;
int beg_pole = this->contour[contour_index];
int end_pole = this->contour[contour_index + 1] - 2;
@@ -2784,89 +2780,89 @@ static void t1_hinter__interpolate_other_poles(t1_hinter * this)
do {
int start_pole = j, stop_pole = -1;
t1_glyph_space_coord min_a, max_a;
- t1_glyph_space_coord min_g, max_g, g0, g1, a0, a1;
- int min_i = start_pole, max_i = start_pole, cut_l, l;
- bool moved = false;
-
- do {
- int min_l = 0, max_l = 0, jp;
- int min_w, max_w, w0;
-
- g0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_gc);
- w0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_wc);
- a0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_ac);
- min_g = g0;
- max_g = g0;
- min_w = max_w = w0;
- jp = start_pole;
- for (j = ranger_step_f(start_pole, beg_contour_pole, end_contour_pole), l = 1;
- j != start_pole;
- j = ranger_step_f(j, beg_contour_pole, end_contour_pole), l++) {
- t1_glyph_space_coord g = * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
- t1_glyph_space_coord w = * member_prt(t1_glyph_space_coord, &this->pole[j], offset_wc);
-
- if (min_g > g)
- min_g = g, min_i = j, min_l = l;
- if (max_g < g)
- max_g = g, max_i = j, max_l = l;
- if (min_w > w)
- min_w = w;
- if (max_w < w)
- max_w = w;
- if (*member_prt(enum t1_align_type, &this->pole[j], offset_f))
- break;
- if (j == stop_pole)
- break;
- jp = j;
- }
- stop_pole = j;
- cut_l = l;
- g1 = * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_gc);
- a1 = * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_ac);
-
- if (start_pole != stop_pole)
- if (any_abs(g0 - g1) >= any_abs(a0 - a1) / 10)
- if (any_abs(max_g - min_g) <= any_abs(max_w - min_w) / 4)
- break; /* OK to interpolate. */
- /* else break at an extremal pole : */
- if (min_i != start_pole && min_l < cut_l && min_g != g0 && min_g != g1)
- stop_pole = min_i, cut_l = min_l;
- if (max_i != start_pole && max_l < cut_l && max_g != g0 && max_g != g1)
- stop_pole = max_i, cut_l = max_l;
- } while (cut_l < l);
+ t1_glyph_space_coord min_g, max_g, g0, g1, a0, a1;
+ int min_i = start_pole, max_i = start_pole, cut_l, l;
+ bool moved = false;
+
+ do {
+ int min_l = 0, max_l = 0, jp;
+ int min_w, max_w, w0;
+
+ g0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_gc);
+ w0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_wc);
+ a0 = *member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_ac);
+ min_g = g0;
+ max_g = g0;
+ min_w = max_w = w0;
+ jp = start_pole;
+ for (j = ranger_step_f(start_pole, beg_contour_pole, end_contour_pole), l = 1;
+ j != start_pole;
+ j = ranger_step_f(j, beg_contour_pole, end_contour_pole), l++) {
+ t1_glyph_space_coord g = * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
+ t1_glyph_space_coord w = * member_prt(t1_glyph_space_coord, &this->pole[j], offset_wc);
+
+ if (min_g > g)
+ min_g = g, min_i = j, min_l = l;
+ if (max_g < g)
+ max_g = g, max_i = j, max_l = l;
+ if (min_w > w)
+ min_w = w;
+ if (max_w < w)
+ max_w = w;
+ if (*member_prt(enum t1_align_type, &this->pole[j], offset_f))
+ break;
+ if (j == stop_pole)
+ break;
+ jp = j;
+ }
+ stop_pole = j;
+ cut_l = l;
+ g1 = * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_gc);
+ a1 = * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_ac);
+
+ if (start_pole != stop_pole)
+ if (any_abs(g0 - g1) >= any_abs(a0 - a1) / 10)
+ if (any_abs(max_g - min_g) <= any_abs(max_w - min_w) / 4)
+ break; /* OK to interpolate. */
+ /* else break at an extremal pole : */
+ if (min_i != start_pole && min_l < cut_l && min_g != g0 && min_g != g1)
+ stop_pole = min_i, cut_l = min_l;
+ if (max_i != start_pole && max_l < cut_l && max_g != g0 && max_g != g1)
+ stop_pole = max_i, cut_l = max_l;
+ } while (cut_l < l);
/* Now start_pole and end_pole point to the contour interval to interpolate. */
- if (g0 < g1) {
- min_g = g0;
- max_g = g1;
- min_a = a0;
- max_a = a1;
- } else {
- min_g = g1;
- max_g = g0;
- min_a = a1;
- max_a = a0;
- }
- if (min_g == max_g && min_a != max_a) {
- /* Alignment conflict, choose by boundary_length. */
- if (* member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_bl) <
- * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_bl))
- min_a = max_a = a1;
- else
- min_a = max_a = a0;
- }
- for (j = start_pole; ;
+ if (g0 < g1) {
+ min_g = g0;
+ max_g = g1;
+ min_a = a0;
+ max_a = a1;
+ } else {
+ min_g = g1;
+ max_g = g0;
+ min_a = a1;
+ max_a = a0;
+ }
+ if (min_g == max_g && min_a != max_a) {
+ /* Alignment conflict, choose by boundary_length. */
+ if (* member_prt(t1_glyph_space_coord, &this->pole[start_pole], offset_bl) <
+ * member_prt(t1_glyph_space_coord, &this->pole[stop_pole], offset_bl))
+ min_a = max_a = a1;
+ else
+ min_a = max_a = a0;
+ }
+ for (j = start_pole; ;
j = ranger_step_f(j, beg_contour_pole, end_contour_pole)) {
t1_glyph_space_coord g = * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
if (g <= min_g)
- * member_prt(t1_glyph_space_coord, &this->pole[j], offset_ac) =
- * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc) + (min_a - min_g);
+ * member_prt(t1_glyph_space_coord, &this->pole[j], offset_ac) =
+ * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc) + (min_a - min_g);
else if (g >= max_g)
- * member_prt(t1_glyph_space_coord, &this->pole[j], offset_ac) =
- * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc) + (max_a - max_g);
+ * member_prt(t1_glyph_space_coord, &this->pole[j], offset_ac) =
+ * member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc) + (max_a - max_g);
if(moved && j == stop_pole)
break;
- moved = true;
+ moved = true;
}
if (min_g < max_g) {
int24 div = max_g - min_g;
@@ -2903,7 +2899,7 @@ static void t1_hinter__interpolate_other_poles(t1_hinter * this)
q1 = m0 / d, r1 = m0 % d, m1 = r1 << 12;
q2 = m1 / d;
u = (q1 << 12) + q2;
- for (j = ranger_step_f(start_pole, beg_contour_pole, end_contour_pole); j != stop_pole;
+ for (j = ranger_step_f(start_pole, beg_contour_pole, end_contour_pole); j != stop_pole;
j = ranger_step_f(j, beg_contour_pole, end_contour_pole)) {
t1_glyph_space_coord g = *member_prt(t1_glyph_space_coord, &this->pole[j], offset_gc);
@@ -2933,11 +2929,11 @@ static int t1_hinter__export(t1_hinter * this)
g2d(this, pole->ax, pole->ay, &fx, &fy);
code = gx_path_add_point(this->output_path, fx, fy);
- if (code < 0)
- return code;
- if (i >= this->contour_count)
- break;
- vd_setcolor(RGB(255,0,0));
+ if (code < 0)
+ return code;
+ if (i >= this->contour_count)
+ break;
+ vd_setcolor(RGB(255,0,0));
vd_moveto(fx,fy);
end_pole = this->contour[i + 1] - 2;
for(j = beg_pole + 1; j <= end_pole; j++) {
@@ -2945,8 +2941,8 @@ static int t1_hinter__export(t1_hinter * this)
g2d(this, pole->ax, pole->ay, &fx, &fy);
if (pole->type == oncurve) {
code = gx_path_add_line(this->output_path, fx, fy);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
vd_setcolor(RGB(255,0,0));
vd_lineto(fx,fy);
} else {
@@ -2956,16 +2952,16 @@ static int t1_hinter__export(t1_hinter * this)
g2d(this, this->pole[j1].ax, this->pole[j1].ay, &fx1, &fy1);
g2d(this, this->pole[j2].ax, this->pole[j2].ay, &fx2, &fy2);
code = gx_path_add_curve(this->output_path, fx, fy, fx1, fy1, fx2, fy2);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
vd_setcolor(RGB(255,0,0));
vd_curveto(fx,fy,fx1,fy1,fx2,fy2);
j+=2;
}
}
code = gx_path_close_subpath(this->output_path);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -2974,17 +2970,17 @@ static int t1_hinter__add_trailing_moveto(t1_hinter * this)
{ t1_glyph_space_coord gx = this->width_gx, gy = this->width_gy;
#if 0 /* This appears wrong due to several reasons :
- 1. With TextAlphaBits=1, AlignToPixels must have no effect.
- 2. ashow, awidthshow must add the width before alignment.
- 4. In the PDF interpreter, Tc must add before alignment.
- 5. Since a character origin is aligned,
- rounding its width doesn't affect subsequent characters.
- 6. When the character size is smaller than half pixel width,
- glyph widths rounds to zero, causing overlapped glyphs.
- (Bug 687719 "PDFWRITE corrupts letter spacing/placement").
+ 1. With TextAlphaBits=1, AlignToPixels must have no effect.
+ 2. ashow, awidthshow must add the width before alignment.
+ 4. In the PDF interpreter, Tc must add before alignment.
+ 5. Since a character origin is aligned,
+ rounding its width doesn't affect subsequent characters.
+ 6. When the character size is smaller than half pixel width,
+ glyph widths rounds to zero, causing overlapped glyphs.
+ (Bug 687719 "PDFWRITE corrupts letter spacing/placement").
*/
if (this->align_to_pixels)
- t1_hinter__align_to_grid(this, this->g2o_fraction, &gx, &gy, this->align_to_pixels);
+ t1_hinter__align_to_grid(this, this->g2o_fraction, &gx, &gy, this->align_to_pixels);
#endif
return t1_hinter__rmoveto(this, gx - this->cx, gy - this->cy);
}
@@ -2993,59 +2989,59 @@ int t1_hinter__endglyph(t1_hinter * this)
{ int code = 0;
if (!vd_enabled) { /* Maybe enabled in t1_hinter__set_mapping. */
- vd_get_dc('h');
- vd_set_shift(VD_SHIFT_X, VD_SHIFT_Y);
- vd_set_scale(VD_SCALE);
- vd_set_origin(0, 0);
- if (!VD_DRAW_IMPORT && !this->disable_hinting)
- vd_erase(RGB(255, 255, 255));
+ vd_get_dc('h');
+ vd_set_shift(VD_SHIFT_X, VD_SHIFT_Y);
+ vd_set_scale(VD_SCALE);
+ vd_set_origin(0, 0);
+ if (!VD_DRAW_IMPORT && !this->disable_hinting)
+ vd_erase(RGB(255, 255, 255));
}
if (vd_enabled && this->g2o_fraction != 0 && !this->disable_hinting)
- t1_hinter__paint_raster_grid(this);
+ t1_hinter__paint_raster_grid(this);
code = t1_hinter__add_trailing_moveto(this);
if (code < 0)
- goto exit;
+ goto exit;
code = t1_hinter__end_subglyph(this);
if (code < 0)
- goto exit;
+ goto exit;
t1_hinter__paint_glyph(this, false);
t1_hinter__adjust_matrix_precision(this, this->orig_gx, this->orig_gy);
t1_hinter__compute_y_span(this);
t1_hinter__simplify_representation(this);
if (!this->disable_hinting && (this->grid_fit_x || this->grid_fit_y)) {
- if (this->FontType == 1)
- t1_hinter__compute_type1_stem_ranges(this);
- else
- t1_hinter__compute_type2_stem_ranges(this);
- t1_hinter__mark_existing_stems(this);
- t1_hinter_compute_stem_snap_range(this);
+ if (this->FontType == 1)
+ t1_hinter__compute_type1_stem_ranges(this);
+ else
+ t1_hinter__compute_type2_stem_ranges(this);
+ t1_hinter__mark_existing_stems(this);
+ t1_hinter_compute_stem_snap_range(this);
t1_hinter__align_stem_commands(this);
- t1_hinter__unfix_opposite_to_common(this);
+ t1_hinter__unfix_opposite_to_common(this);
t1_hinter__compute_opposite_stem_coords(this);
/* stem3 was processed in the Type 1 interpreter. */
code = t1_hinter__align_stem_poles(this);
- if (code < 0)
- goto exit;
+ if (code < 0)
+ goto exit;
t1_hinter__process_dotsections(this);
t1_hinter__interpolate_other_poles(this);
t1_hinter__paint_glyph(this, true);
}
if (this->pole_count) {
- if (this->fix_contour_sign) {
- t1_hinter__fix_contour_signs(this);
- t1_hinter__paint_glyph(this, true);
- }
- if (vd_enabled) {
- double_matrix m;
-
- fraction_matrix__to_double(&this->ctmi, &m);
- vd_set_scaleXY(vd_get_scale_x * m.xx, vd_get_scale_y * m.yy);
- vd_set_origin(this->orig_dx, this->orig_dy);
- /* fixme : general transform requires changes to vdtrace.
- Current implementation paints exported rotated glyph in wrong coordinates.
- */
- }
- code = t1_hinter__export(this);
+ if (this->fix_contour_sign) {
+ t1_hinter__fix_contour_signs(this);
+ t1_hinter__paint_glyph(this, true);
+ }
+ if (vd_enabled) {
+ double_matrix m;
+
+ fraction_matrix__to_double(&this->ctmi, &m);
+ vd_set_scaleXY(vd_get_scale_x * m.xx, vd_get_scale_y * m.yy);
+ vd_set_origin(this->orig_dx, this->orig_dy);
+ /* fixme : general transform requires changes to vdtrace.
+ Current implementation paints exported rotated glyph in wrong coordinates.
+ */
+ }
+ code = t1_hinter__export(this);
}
exit:
t1_hinter__free_arrays(this);
diff --git a/gs/base/gxhintn.h b/gs/base/gxhintn.h
index 93ba4eabb..3ead3a5fc 100644
--- a/gs/base/gxhintn.h
+++ b/gs/base/gxhintn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -184,14 +184,14 @@ typedef struct t1_hinter_s
void t1_hinter__init(t1_hinter * this, gx_path *output_path);
int t1_hinter__set_mapping(t1_hinter * this, gs_matrix_fixed * ctm,
- gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
- int log2_pixels_x, int log2_pixels_y,
- int log2_subpixels_x, int log2_subpixels_y,
- fixed origin_x, fixed origin_y, bool align_to_pixels);
-int t1_hinter__set_font_data(t1_hinter * this, int FontType, gs_type1_data *pdata,
- bool no_grid_fitting, bool is_resource);
-int t1_hinter__set_font42_data(t1_hinter * this, int FontType, gs_type42_data *pdata,
- bool no_grid_fitting);
+ gs_matrix * FontMatrix, gs_matrix * baseFontMatrix,
+ int log2_pixels_x, int log2_pixels_y,
+ int log2_subpixels_x, int log2_subpixels_y,
+ fixed origin_x, fixed origin_y, bool align_to_pixels);
+int t1_hinter__set_font_data(t1_hinter * this, int FontType, gs_type1_data *pdata,
+ bool no_grid_fitting, bool is_resource);
+int t1_hinter__set_font42_data(t1_hinter * this, int FontType, gs_type42_data *pdata,
+ bool no_grid_fitting);
int t1_hinter__sbw(t1_hinter * this, fixed sbx, fixed sby, fixed wx, fixed wy);
int t1_hinter__sbw_seac(t1_hinter * this, fixed sbx, fixed sby);
diff --git a/gs/base/gxhintn1.c b/gs/base/gxhintn1.c
index aaa74f88d..c50fdee24 100644
--- a/gs/base/gxhintn1.c
+++ b/gs/base/gxhintn1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,10 +32,10 @@ static double inline line_area_2(fixed p0x, fixed p0y, fixed p1x, fixed p1y)
return ((double)p0x*p1y - (double)p0y*p1x);
}
-static double inline bezier_area_2(fixed p0x, fixed p0y, fixed p1x, fixed p1y,
- fixed p2x, fixed p2y, fixed p3x, fixed p3y)
+static double inline bezier_area_2(fixed p0x, fixed p0y, fixed p1x, fixed p1y,
+ fixed p2x, fixed p2y, fixed p3x, fixed p3y)
{ /* Returns area * 2.*/
- return (-(p0y*(6.0*p1x + 3.0*p2x + p3x)) + p0x*(6.0*p1y + 3.0*p2y + p3y) -
+ return (-(p0y*(6.0*p1x + 3.0*p2x + p3x)) + p0x*(6.0*p1y + 3.0*p2y + p3y) -
3*((double)p1y*p2x + (double)p1y*p3x + 2.0*p2y*p3x - 2.0*p2x*p3y - (double)p1x*(p2y + p3y)))/10;
}
@@ -49,11 +49,11 @@ static void t1_hinter__reverse_contour(t1_hinter * this, int c)
/* Reverse all except endpoint ('close') : */
for (i = b + 1; i < e2; i++) {
- int j = e - (i - b);
+ int j = e - (i - b);
- p = this->pole[i];
- this->pole[i] = this->pole[j];
- this->pole[j] = p;
+ p = this->pole[i];
+ this->pole[i] = this->pole[j];
+ this->pole[j] = p;
}
}
@@ -64,15 +64,15 @@ static double inline bar_winding_angle(fixed x0, fixed y0, fixed x1, fixed y1)
double vp = (double)x0 * y1 - (double)y0 * x1;
double sp = (double)x0 * x1 + (double)y0 * y1;
double A;
-
+
if (sp == 0) {
- if (vp == 0)
- return CONTACT_SIGNAL; /* Contours contact. */
- A = 1.57079632679489661923; /* pi/2. */
- if (vp < 0)
- A = -A;
+ if (vp == 0)
+ return CONTACT_SIGNAL; /* Contours contact. */
+ A = 1.57079632679489661923; /* pi/2. */
+ if (vp < 0)
+ A = -A;
} else
- A = atan2(vp, sp);
+ A = atan2(vp, sp);
return A;
}
@@ -80,40 +80,40 @@ static double
curve_winding_angle_rec(int k, fixed x0, fixed y0, fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3)
{
if (k <= 1)
- return bar_winding_angle(x0, y0, x3, y3);
+ return bar_winding_angle(x0, y0, x3, y3);
else {
- /* Assuming the trapezoid is not self-intersecting and
- the curve is inside the trapezoid
- due to Type 1 constraints. */
- double a0 = bar_winding_angle(x0, y0, x1, y1);
- double a1 = bar_winding_angle(x1, y1, x2, y2);
- double a2 = bar_winding_angle(x2, y2, x3, y3);
- double a3 = bar_winding_angle(x3, y3, x0, y0);
- double a = a0 + a1 + a2 + a3;
-
- if (any_abs(a) < 0.1 && a0 != CONTACT_SIGNAL &&
- a1 != CONTACT_SIGNAL &&
- a2 != CONTACT_SIGNAL &&
- a3 != CONTACT_SIGNAL) {
- /* The center is outside the trapezoid. */
- return -a3;
- } else {
- fixed x01 = (x0 + x1) / 2, y01 = (y0 + y1) / 2;
- fixed x12 = (x1 + x2) / 2, y12 = (y1 + y2) / 2;
- fixed x23 = (x2 + x3) / 2, y23 = (y2 + y3) / 2;
- fixed x012 = (x01 + x12) / 2, y012 = (y01 + y12) / 2;
- fixed x123 = (x12 + x23) / 2, y123 = (y12 + y23) / 2;
- fixed x0123 = (x012 + x123) / 2, y0123 = (y012 + y123) / 2;
- double A0, A1;
-
- A0 = curve_winding_angle_rec(k - 1, x0, y0, x01, y01, x012, y012, x0123, y0123);
- if (A0 == CONTACT_SIGNAL)
- return CONTACT_SIGNAL;
- A1 = curve_winding_angle_rec(k - 1, x0123, y0123, x123, y123, x23, y23, x3, y3);
- if (A1 == CONTACT_SIGNAL)
- return CONTACT_SIGNAL;
- return A0 + A1;
- }
+ /* Assuming the trapezoid is not self-intersecting and
+ the curve is inside the trapezoid
+ due to Type 1 constraints. */
+ double a0 = bar_winding_angle(x0, y0, x1, y1);
+ double a1 = bar_winding_angle(x1, y1, x2, y2);
+ double a2 = bar_winding_angle(x2, y2, x3, y3);
+ double a3 = bar_winding_angle(x3, y3, x0, y0);
+ double a = a0 + a1 + a2 + a3;
+
+ if (any_abs(a) < 0.1 && a0 != CONTACT_SIGNAL &&
+ a1 != CONTACT_SIGNAL &&
+ a2 != CONTACT_SIGNAL &&
+ a3 != CONTACT_SIGNAL) {
+ /* The center is outside the trapezoid. */
+ return -a3;
+ } else {
+ fixed x01 = (x0 + x1) / 2, y01 = (y0 + y1) / 2;
+ fixed x12 = (x1 + x2) / 2, y12 = (y1 + y2) / 2;
+ fixed x23 = (x2 + x3) / 2, y23 = (y2 + y3) / 2;
+ fixed x012 = (x01 + x12) / 2, y012 = (y01 + y12) / 2;
+ fixed x123 = (x12 + x23) / 2, y123 = (y12 + y23) / 2;
+ fixed x0123 = (x012 + x123) / 2, y0123 = (y012 + y123) / 2;
+ double A0, A1;
+
+ A0 = curve_winding_angle_rec(k - 1, x0, y0, x01, y01, x012, y012, x0123, y0123);
+ if (A0 == CONTACT_SIGNAL)
+ return CONTACT_SIGNAL;
+ A1 = curve_winding_angle_rec(k - 1, x0123, y0123, x123, y123, x23, y23, x3, y3);
+ if (A1 == CONTACT_SIGNAL)
+ return CONTACT_SIGNAL;
+ return A0 + A1;
+ }
}
}
@@ -145,23 +145,23 @@ static int t1_hinter__is_inside(t1_hinter * this, t1_glyph_space_coord gx, t1_gl
int i;
for (i = b; i < e;) {
- if (this->pole[i + 1].type != offcurve) { /* line or close. */
- A = bar_winding_angle(this->pole[i + 0].gx - gx, this->pole[i + 0].gy - gy,
- this->pole[i + 1].gx - gx, this->pole[i + 1].gy - gy);
- i++;
- } else {
- A = curve_winding_angle(this->pole[i + 0].gx - gx, this->pole[i + 0].gy - gy,
- this->pole[i + 1].gx - gx, this->pole[i + 1].gy - gy,
- this->pole[i + 2].gx - gx, this->pole[i + 2].gy - gy,
- this->pole[i + 3].gx - gx, this->pole[i + 3].gy - gy);
- i += 3;
- }
- if (A == CONTACT_SIGNAL)
- return -1;
- a += A;
+ if (this->pole[i + 1].type != offcurve) { /* line or close. */
+ A = bar_winding_angle(this->pole[i + 0].gx - gx, this->pole[i + 0].gy - gy,
+ this->pole[i + 1].gx - gx, this->pole[i + 1].gy - gy);
+ i++;
+ } else {
+ A = curve_winding_angle(this->pole[i + 0].gx - gx, this->pole[i + 0].gy - gy,
+ this->pole[i + 1].gx - gx, this->pole[i + 1].gy - gy,
+ this->pole[i + 2].gx - gx, this->pole[i + 2].gy - gy,
+ this->pole[i + 3].gx - gx, this->pole[i + 3].gy - gy);
+ i += 3;
+ }
+ if (A == CONTACT_SIGNAL)
+ return -1;
+ a += A;
}
if (any_abs(a) < 0.1)
- return 0;
+ return 0;
return 1;
}
@@ -169,52 +169,52 @@ static inline bool
intersect_bar_bar(fixed q0x, fixed q0y, fixed q1x, fixed q1y, fixed q2x, fixed q2y, fixed q3x, fixed q3y)
{
if (q1x == q0x && q1y == q0y)
- return false;
+ return false;
if (q1x == q2x && q1y == q2y)
- return false;
+ return false;
if (q0x == q2x && q0y == q2y)
- return true;
+ return true;
if (q0x == q3x && q0y == q3y)
- return true;
+ return true;
if (q1x == q2x && q1y == q2y)
- return true;
+ return true;
if (q1x == q3x && q1y == q3y)
- return true;
+ return true;
else {
- fixed dx1 = q1x - q0x;
- fixed dy1 = q1y - q0y;
- fixed dx2 = q2x - q0x;
- fixed dy2 = q2y - q0y;
- fixed dx3 = q3x - q0x;
- fixed dy3 = q3y - q0y;
- fixed dx1a = any_abs(dx1);
- fixed dy1a = any_abs(dy1);
- fixed dx2a = any_abs(dx2);
- fixed dy2a = any_abs(dy2);
- fixed dx3a = any_abs(dx3);
- fixed dy3a = any_abs(dy3);
- fixed d = dx1a | dy1a | dx2a | dy2a | dx3a | dy3a;
- fixed ry, ey; /* stubs only - don't use them, they are whong here. */
-
- /* gx_intersect_small_bars needs cubes of distances to fit into 62 bits,
- Drop extra bits here.
- We don't need ry, so don't bother with absolute coordinates. */
- while (d >= (1 << (60 / 3))) {
- d >>= 1;
- dx1 = (dx1 + 1) / 2;
- dy1 = (dy1 + 1) / 2;
- dx2 = (dy2 + 1) / 2;
- dy2 = (dy2 + 1) / 2;
- dx3 = (dy3 + 1) / 2;
- dy3 = (dy3 + 1) / 2;
- }
- /* Well, when we drop bits, the intersection isn't precise.
- But it happens with big characters only,
- which unlikely have close oncurve poles
- which belong to different contours.
- Due to that we believe the boolean result is precise
- with a very high probablility. */
- return gx_intersect_small_bars(0, 0, dx1, dy1, dx2, dy2, dx3, dy3, &ry, &ey);
+ fixed dx1 = q1x - q0x;
+ fixed dy1 = q1y - q0y;
+ fixed dx2 = q2x - q0x;
+ fixed dy2 = q2y - q0y;
+ fixed dx3 = q3x - q0x;
+ fixed dy3 = q3y - q0y;
+ fixed dx1a = any_abs(dx1);
+ fixed dy1a = any_abs(dy1);
+ fixed dx2a = any_abs(dx2);
+ fixed dy2a = any_abs(dy2);
+ fixed dx3a = any_abs(dx3);
+ fixed dy3a = any_abs(dy3);
+ fixed d = dx1a | dy1a | dx2a | dy2a | dx3a | dy3a;
+ fixed ry, ey; /* stubs only - don't use them, they are whong here. */
+
+ /* gx_intersect_small_bars needs cubes of distances to fit into 62 bits,
+ Drop extra bits here.
+ We don't need ry, so don't bother with absolute coordinates. */
+ while (d >= (1 << (60 / 3))) {
+ d >>= 1;
+ dx1 = (dx1 + 1) / 2;
+ dy1 = (dy1 + 1) / 2;
+ dx2 = (dy2 + 1) / 2;
+ dy2 = (dy2 + 1) / 2;
+ dx3 = (dy3 + 1) / 2;
+ dy3 = (dy3 + 1) / 2;
+ }
+ /* Well, when we drop bits, the intersection isn't precise.
+ But it happens with big characters only,
+ which unlikely have close oncurve poles
+ which belong to different contours.
+ Due to that we believe the boolean result is precise
+ with a very high probablility. */
+ return gx_intersect_small_bars(0, 0, dx1, dy1, dx2, dy2, dx3, dy3, &ry, &ey);
}
}
@@ -233,85 +233,85 @@ t1_hinter__intersect_bar_bar(t1_hinter * this, int i, int j)
return intersect_bar_bar(q0x, q0y, q1x, q1y, q2x, q2y, q3x, q3y);
}
-static bool intersect_curve_bar_rec(int m, int k, fixed X1, fixed Y1,
- fixed x0, fixed y0, fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3)
+static bool intersect_curve_bar_rec(int m, int k, fixed X1, fixed Y1,
+ fixed x0, fixed y0, fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3)
{
if (m <= 1)
- return intersect_bar_bar(0, 0, X1, Y1, x0, y0, x3, y3);
+ return intersect_bar_bar(0, 0, X1, Y1, x0, y0, x3, y3);
else {
- gs_rect box0, box1;
-
- if (X1 < 0)
- box0.p.x = X1, box0.q.x = 0;
- else
- box0.p.x = 0, box0.q.x = X1;
- if (Y1 < 0)
- box0.p.y = Y1, box0.q.y = 0;
- else
- box0.p.y = 0, box0.q.y = Y1;
-
- box1.p.x = box1.q.x = x0;
- box1.p.y = box1.q.y = y0;
- if (box1.p.x > x1)
- box1.p.x = x1;
- if (box1.q.x < x1)
- box1.q.x = x1;
- if (box1.p.y > y1)
- box1.p.y = y1;
- if (box1.q.y < y1)
- box1.q.y = y1;
- if (box1.p.x > x2)
- box1.p.x = x2;
- if (box1.q.x < x2)
- box1.q.x = x2;
- if (box1.p.y > y2)
- box1.p.y = y2;
- if (box1.q.y < y2)
- box1.q.y = y2;
- if (box1.p.x > x3)
- box1.p.x = x3;
- if (box1.q.x < x3)
- box1.q.x = x3;
- if (box1.p.y > y3)
- box1.p.y = y3;
- if (box1.q.y < y3)
- box1.q.y = y3;
- if (box0.p.x > box1.q.x)
- return false;
- if (box0.q.x < box1.p.x)
- return false;
- if (box0.p.y > box1.q.y)
- return false;
- if (box0.q.y < box1.p.y)
- return false;
+ gs_rect box0, box1;
+
+ if (X1 < 0)
+ box0.p.x = X1, box0.q.x = 0;
+ else
+ box0.p.x = 0, box0.q.x = X1;
+ if (Y1 < 0)
+ box0.p.y = Y1, box0.q.y = 0;
+ else
+ box0.p.y = 0, box0.q.y = Y1;
+
+ box1.p.x = box1.q.x = x0;
+ box1.p.y = box1.q.y = y0;
+ if (box1.p.x > x1)
+ box1.p.x = x1;
+ if (box1.q.x < x1)
+ box1.q.x = x1;
+ if (box1.p.y > y1)
+ box1.p.y = y1;
+ if (box1.q.y < y1)
+ box1.q.y = y1;
+ if (box1.p.x > x2)
+ box1.p.x = x2;
+ if (box1.q.x < x2)
+ box1.q.x = x2;
+ if (box1.p.y > y2)
+ box1.p.y = y2;
+ if (box1.q.y < y2)
+ box1.q.y = y2;
+ if (box1.p.x > x3)
+ box1.p.x = x3;
+ if (box1.q.x < x3)
+ box1.q.x = x3;
+ if (box1.p.y > y3)
+ box1.p.y = y3;
+ if (box1.q.y < y3)
+ box1.q.y = y3;
+ if (box0.p.x > box1.q.x)
+ return false;
+ if (box0.q.x < box1.p.x)
+ return false;
+ if (box0.p.y > box1.q.y)
+ return false;
+ if (box0.q.y < box1.p.y)
+ return false;
}
{ fixed x01 = (x0 + x1) / 2, y01 = (y0 + y1) / 2;
- fixed x12 = (x1 + x2) / 2, y12 = (y1 + y2) / 2;
- fixed x23 = (x2 + x3) / 2, y23 = (y2 + y3) / 2;
- fixed x012 = (x01 + x12) / 2, y012 = (y01 + y12) / 2;
- fixed x123 = (x12 + x23) / 2, y123 = (y12 + y23) / 2;
- fixed x0123 = (x012 + x123) / 2, y0123 = (y012 + y123) / 2;
-
- if (k <= 1) {
- if (intersect_curve_bar_rec(m - 1, k, X1, Y1, x0, y0, x01, y01, x012, y012, x0123, y0123))
- return true;
- if (intersect_curve_bar_rec(m - 1, k, X1, Y1, x0123, y0123, x123, y123, x23, y23, x3, y3))
- return true;
- } else {
- fixed X01 = X1 / 2;
- fixed Y01 = Y1 / 2;
-
- if (intersect_curve_bar_rec(m - 1, k - 1, X01, Y01, x0, y0, x01, y01, x012, y012, x0123, y0123))
- return true;
- if (intersect_curve_bar_rec(m - 1, k - 1, X01, Y01, x0123, y0123, x123, y123, x23, y23, x3, y3))
- return true;
- if (intersect_curve_bar_rec(m - 1, k - 1, X1 - X01, Y1 - Y01, x0 - X01, y0 - Y01, x01 - X01, y01 - Y01,
- x012 - X01, y012 - Y01, x0123 - X01, y0123 - Y01))
- return true;
- if (intersect_curve_bar_rec(m - 1, k - 1, X1 - X01, Y1 - Y01, x0123 - X01, y0123 - Y01,
- x123 - X01, y123 - Y01, x23 - X01, y23 - Y01, x3 - X01, y3 - Y01))
- return true;
- }
+ fixed x12 = (x1 + x2) / 2, y12 = (y1 + y2) / 2;
+ fixed x23 = (x2 + x3) / 2, y23 = (y2 + y3) / 2;
+ fixed x012 = (x01 + x12) / 2, y012 = (y01 + y12) / 2;
+ fixed x123 = (x12 + x23) / 2, y123 = (y12 + y23) / 2;
+ fixed x0123 = (x012 + x123) / 2, y0123 = (y012 + y123) / 2;
+
+ if (k <= 1) {
+ if (intersect_curve_bar_rec(m - 1, k, X1, Y1, x0, y0, x01, y01, x012, y012, x0123, y0123))
+ return true;
+ if (intersect_curve_bar_rec(m - 1, k, X1, Y1, x0123, y0123, x123, y123, x23, y23, x3, y3))
+ return true;
+ } else {
+ fixed X01 = X1 / 2;
+ fixed Y01 = Y1 / 2;
+
+ if (intersect_curve_bar_rec(m - 1, k - 1, X01, Y01, x0, y0, x01, y01, x012, y012, x0123, y0123))
+ return true;
+ if (intersect_curve_bar_rec(m - 1, k - 1, X01, Y01, x0123, y0123, x123, y123, x23, y23, x3, y3))
+ return true;
+ if (intersect_curve_bar_rec(m - 1, k - 1, X1 - X01, Y1 - Y01, x0 - X01, y0 - Y01, x01 - X01, y01 - Y01,
+ x012 - X01, y012 - Y01, x0123 - X01, y0123 - Y01))
+ return true;
+ if (intersect_curve_bar_rec(m - 1, k - 1, X1 - X01, Y1 - Y01, x0123 - X01, y0123 - Y01,
+ x123 - X01, y123 - Y01, x23 - X01, y23 - Y01, x3 - X01, y3 - Y01))
+ return true;
+ }
}
return false;
}
@@ -320,8 +320,8 @@ static int bar_samples(fixed dx, fixed dy)
{
int l = (any_abs(dx) | any_abs(dy)) / CURVE_FLATTENING, m = 0;
while (l) {
- l >>= 1;
- m++;
+ l >>= 1;
+ m++;
}
return m;
}
@@ -347,110 +347,110 @@ static bool t1_hinter__intersect_curve_bar(t1_hinter * this, int i, int j)
}
static bool intersect_curve_curve_rec(int ka, int kb,
- fixed ax0, fixed ay0, fixed ax1, fixed ay1, fixed ax2, fixed ay2, fixed ax3, fixed ay3,
- fixed bx0, fixed by0, fixed bx1, fixed by1, fixed bx2, fixed by2, fixed bx3, fixed by3)
+ fixed ax0, fixed ay0, fixed ax1, fixed ay1, fixed ax2, fixed ay2, fixed ax3, fixed ay3,
+ fixed bx0, fixed by0, fixed bx1, fixed by1, fixed bx2, fixed by2, fixed bx3, fixed by3)
{
if (ka <= 1 && kb <= 1)
- return intersect_bar_bar(ax0, ay0, ax3, ay3, bx0, by0, bx3, by3);
+ return intersect_bar_bar(ax0, ay0, ax3, ay3, bx0, by0, bx3, by3);
else if (ka <= 1) {
- int m = bar_samples(ax3 - ax0, ay3 - ay0);
+ int m = bar_samples(ax3 - ax0, ay3 - ay0);
- return intersect_curve_bar_rec(m, kb, ax3 - ax0, ay3 - ay0,
- bx0 - ax0, by0 - ay0, bx1 - ax0, by1 - ay0, bx2 - ax0, by2 - ay0, bx3 - ax0, by3 - ay0);
+ return intersect_curve_bar_rec(m, kb, ax3 - ax0, ay3 - ay0,
+ bx0 - ax0, by0 - ay0, bx1 - ax0, by1 - ay0, bx2 - ax0, by2 - ay0, bx3 - ax0, by3 - ay0);
} else if (kb <= 1) {
- int m = bar_samples(bx3 - bx0, by3 - by0);
+ int m = bar_samples(bx3 - bx0, by3 - by0);
- return intersect_curve_bar_rec(m, ka, bx3 - bx0, by3 - by0,
- ax0 - bx0, ay0 - by0, ax1 - bx0, ay1 - by0, ax2 - bx0, ay2 - by0, ax3 - bx0, ay3 - by0);
+ return intersect_curve_bar_rec(m, ka, bx3 - bx0, by3 - by0,
+ ax0 - bx0, ay0 - by0, ax1 - bx0, ay1 - by0, ax2 - bx0, ay2 - by0, ax3 - bx0, ay3 - by0);
} else {
- gs_rect box0, box1;
-
- box0.p.x = box0.q.x = ax0;
- box0.p.y = box0.q.y = ay0;
- if (box0.p.x > ax1)
- box0.p.x = ax1;
- if (box0.q.x < ax1)
- box0.q.x = ax1;
- if (box0.p.y > ay1)
- box0.p.y = ay1;
- if (box0.q.y < ay1)
- box0.q.y = ay1;
- if (box0.p.x > ax2)
- box0.p.x = ax2;
- if (box0.q.x < ax2)
- box0.q.x = ax2;
- if (box0.p.y > ay2)
- box0.p.y = ay2;
- if (box0.q.y < ay2)
- box0.q.y = ay2;
- if (box0.p.x > ax3)
- box0.p.x = ax3;
- if (box0.q.x < ax3)
- box0.q.x = ax3;
- if (box0.p.y > ay3)
- box0.p.y = ay3;
- if (box0.q.y < ay3)
- box0.q.y = ay3;
- box1.p.x = box1.q.x = bx0;
- box1.p.y = box1.q.y = by0;
- if (box1.p.x > bx1)
- box1.p.x = bx1;
- if (box1.q.x < bx1)
- box1.q.x = bx1;
- if (box1.p.y > by1)
- box1.p.y = by1;
- if (box1.q.y < by1)
- box1.q.y = by1;
- if (box1.p.x > bx2)
- box1.p.x = bx2;
- if (box1.q.x < bx2)
- box1.q.x = bx2;
- if (box1.p.y > by2)
- box1.p.y = by2;
- if (box1.q.y < by2)
- box1.q.y = by2;
- if (box1.p.x > bx3)
- box1.p.x = bx3;
- if (box1.q.x < bx3)
- box1.q.x = bx3;
- if (box1.p.y > by3)
- box1.p.y = by3;
- if (box1.q.y < by3)
- box1.q.y = by3;
- if (box0.p.x > box1.q.x)
- return false;
- if (box0.q.x < box1.p.x)
- return false;
- if (box0.p.y > box1.q.y)
- return false;
- if (box0.q.y < box1.p.y)
- return false;
- }
+ gs_rect box0, box1;
+
+ box0.p.x = box0.q.x = ax0;
+ box0.p.y = box0.q.y = ay0;
+ if (box0.p.x > ax1)
+ box0.p.x = ax1;
+ if (box0.q.x < ax1)
+ box0.q.x = ax1;
+ if (box0.p.y > ay1)
+ box0.p.y = ay1;
+ if (box0.q.y < ay1)
+ box0.q.y = ay1;
+ if (box0.p.x > ax2)
+ box0.p.x = ax2;
+ if (box0.q.x < ax2)
+ box0.q.x = ax2;
+ if (box0.p.y > ay2)
+ box0.p.y = ay2;
+ if (box0.q.y < ay2)
+ box0.q.y = ay2;
+ if (box0.p.x > ax3)
+ box0.p.x = ax3;
+ if (box0.q.x < ax3)
+ box0.q.x = ax3;
+ if (box0.p.y > ay3)
+ box0.p.y = ay3;
+ if (box0.q.y < ay3)
+ box0.q.y = ay3;
+ box1.p.x = box1.q.x = bx0;
+ box1.p.y = box1.q.y = by0;
+ if (box1.p.x > bx1)
+ box1.p.x = bx1;
+ if (box1.q.x < bx1)
+ box1.q.x = bx1;
+ if (box1.p.y > by1)
+ box1.p.y = by1;
+ if (box1.q.y < by1)
+ box1.q.y = by1;
+ if (box1.p.x > bx2)
+ box1.p.x = bx2;
+ if (box1.q.x < bx2)
+ box1.q.x = bx2;
+ if (box1.p.y > by2)
+ box1.p.y = by2;
+ if (box1.q.y < by2)
+ box1.q.y = by2;
+ if (box1.p.x > bx3)
+ box1.p.x = bx3;
+ if (box1.q.x < bx3)
+ box1.q.x = bx3;
+ if (box1.p.y > by3)
+ box1.p.y = by3;
+ if (box1.q.y < by3)
+ box1.q.y = by3;
+ if (box0.p.x > box1.q.x)
+ return false;
+ if (box0.q.x < box1.p.x)
+ return false;
+ if (box0.p.y > box1.q.y)
+ return false;
+ if (box0.q.y < box1.p.y)
+ return false;
+ }
{ fixed ax01 = (ax0 + ax1) / 2, ay01 = (ay0 + ay1) / 2;
- fixed ax12 = (ax1 + ax2) / 2, ay12 = (ay1 + ay2) / 2;
- fixed ax23 = (ax2 + ax3) / 2, ay23 = (ay2 + ay3) / 2;
- fixed ax012 = (ax01 + ax12) / 2, ay012 = (ay01 + ay12) / 2;
- fixed ax123 = (ax12 + ax23) / 2, ay123 = (ay12 + ay23) / 2;
- fixed ax0123 = (ax012 + ax123) / 2, ay0123 = (ay012 + ay123) / 2;
- fixed bx01 = (bx0 + bx1) / 2, by01 = (by0 + by1) / 2;
- fixed bx12 = (bx1 + bx2) / 2, by12 = (by1 + by2) / 2;
- fixed bx23 = (bx2 + bx3) / 2, by23 = (by2 + by3) / 2;
- fixed bx012 = (bx01 + bx12) / 2, by012 = (by01 + by12) / 2;
- fixed bx123 = (bx12 + bx23) / 2, by123 = (by12 + by23) / 2;
- fixed bx0123 = (bx012 + bx123) / 2, by0123 = (by012 + by123) / 2;
-
- if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0, ay0, ax01, ay01, ax012, ay012, ax0123, ay0123,
- bx0, by0, bx01, by01, bx012, by012, bx0123, by0123))
- return true;
- if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0, ay0, ax01, ay01, ax012, ay012, ax0123, ay0123,
- bx0123, by0123, bx123, by123, bx23, by23, bx3, by3))
- return true;
- if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0123, ay0123, ax123, ay123, ax23, ay23, ax3, ay3,
- bx0, by0, bx01, by01, bx012, by012, bx0123, by0123))
- return true;
- if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0123, ay0123, ax123, ay123, ax23, ay23, ax3, ay3,
- bx0123, by0123, bx123, by123, bx23, by23, bx3, by3))
- return true;
+ fixed ax12 = (ax1 + ax2) / 2, ay12 = (ay1 + ay2) / 2;
+ fixed ax23 = (ax2 + ax3) / 2, ay23 = (ay2 + ay3) / 2;
+ fixed ax012 = (ax01 + ax12) / 2, ay012 = (ay01 + ay12) / 2;
+ fixed ax123 = (ax12 + ax23) / 2, ay123 = (ay12 + ay23) / 2;
+ fixed ax0123 = (ax012 + ax123) / 2, ay0123 = (ay012 + ay123) / 2;
+ fixed bx01 = (bx0 + bx1) / 2, by01 = (by0 + by1) / 2;
+ fixed bx12 = (bx1 + bx2) / 2, by12 = (by1 + by2) / 2;
+ fixed bx23 = (bx2 + bx3) / 2, by23 = (by2 + by3) / 2;
+ fixed bx012 = (bx01 + bx12) / 2, by012 = (by01 + by12) / 2;
+ fixed bx123 = (bx12 + bx23) / 2, by123 = (by12 + by23) / 2;
+ fixed bx0123 = (bx012 + bx123) / 2, by0123 = (by012 + by123) / 2;
+
+ if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0, ay0, ax01, ay01, ax012, ay012, ax0123, ay0123,
+ bx0, by0, bx01, by01, bx012, by012, bx0123, by0123))
+ return true;
+ if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0, ay0, ax01, ay01, ax012, ay012, ax0123, ay0123,
+ bx0123, by0123, bx123, by123, bx23, by23, bx3, by3))
+ return true;
+ if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0123, ay0123, ax123, ay123, ax23, ay23, ax3, ay3,
+ bx0, by0, bx01, by01, bx012, by012, bx0123, by0123))
+ return true;
+ if (intersect_curve_curve_rec(ka - 1, kb - 1, ax0123, ay0123, ax123, ay123, ax23, ay23, ax3, ay3,
+ bx0123, by0123, bx123, by123, bx23, by23, bx3, by3))
+ return true;
}
return false;
@@ -478,8 +478,8 @@ static bool t1_hinter__intersect_curve_curve(t1_hinter * this, int i, int j)
int kb = curve_log2_samples(bx0, by0, bx1, by1, bx2, by2, bx3, by3);
return intersect_curve_curve_rec(ka, kb,
- ax0, ay0, ax1, ay1, ax2, ay2, ax3, ay3,
- bx0, by0, bx1, by1, bx2, by2, bx3, by3);
+ ax0, ay0, ax1, ay1, ax2, ay2, ax3, ay3,
+ bx0, by0, bx1, by1, bx2, by2, bx3, by3);
}
static bool t1_hinter__contour_intersection(t1_hinter * this, int c0, int c1)
@@ -491,33 +491,33 @@ static bool t1_hinter__contour_intersection(t1_hinter * this, int c0, int c1)
int i, j;
for (i = b0; i < e0;) {
- if (this->pole[i + 1].type != offcurve) { /* line or close. */
- for (j = b1; j < e1;) {
- if (this->pole[j + 1].type != offcurve) { /* line or close. */
- if (t1_hinter__intersect_bar_bar(this, i, j))
- return true;
- j++;
- } else {
- if (t1_hinter__intersect_curve_bar(this, j, i))
- return true;
- j += 3;
- }
- }
- i++;
- } else {
- for (j = b1; j < e1;) {
- if (this->pole[j + 1].type != offcurve) { /* line or close. */
- if (t1_hinter__intersect_curve_bar(this, i, j))
- return true;
- j++;
- } else {
- if (t1_hinter__intersect_curve_curve(this, j, i))
- return true;
- j += 3;
- }
- }
- i += 3;
- }
+ if (this->pole[i + 1].type != offcurve) { /* line or close. */
+ for (j = b1; j < e1;) {
+ if (this->pole[j + 1].type != offcurve) { /* line or close. */
+ if (t1_hinter__intersect_bar_bar(this, i, j))
+ return true;
+ j++;
+ } else {
+ if (t1_hinter__intersect_curve_bar(this, j, i))
+ return true;
+ j += 3;
+ }
+ }
+ i++;
+ } else {
+ for (j = b1; j < e1;) {
+ if (this->pole[j + 1].type != offcurve) { /* line or close. */
+ if (t1_hinter__intersect_curve_bar(this, i, j))
+ return true;
+ j++;
+ } else {
+ if (t1_hinter__intersect_curve_curve(this, j, i))
+ return true;
+ j += 3;
+ }
+ }
+ i += 3;
+ }
}
return false;
}
@@ -536,164 +536,164 @@ static void t1_hinter__fix_subglyph_contour_signs(t1_hinter * this, int first_co
int nesting_sum;
if (first_contour == last_contour) {
- /* Don't fix a single contour. */
- return;
+ /* Don't fix a single contour. */
+ return;
}
/* Compute contour bboxes : */
k = 0;
for(i = first_contour; i <= last_contour; i++) {
- int b = this->contour[i];
- int e = this->contour[i + 1] - 1;
-
- bbox[k].p.x = bbox[k].q.x = this->pole[b].gx;
- bbox[k].p.y = bbox[k].q.y = this->pole[b].gy;
- /* 'close' has same coords as the starting point. */
- for (j = b; j < e; j++) {
- t1_glyph_space_coord x = this->pole[j].gx;
- t1_glyph_space_coord y = this->pole[j].gy;
-
- if (bbox[k].p.x > x)
- bbox[k].p.x = x;
- if (bbox[k].q.x < x)
- bbox[k].q.x = x;
- if (bbox[k].p.y > y)
- bbox[k].p.y = y;
- if (bbox[k].q.y < y)
- bbox[k].q.y = y;
- }
- k++;
+ int b = this->contour[i];
+ int e = this->contour[i + 1] - 1;
+
+ bbox[k].p.x = bbox[k].q.x = this->pole[b].gx;
+ bbox[k].p.y = bbox[k].q.y = this->pole[b].gy;
+ /* 'close' has same coords as the starting point. */
+ for (j = b; j < e; j++) {
+ t1_glyph_space_coord x = this->pole[j].gx;
+ t1_glyph_space_coord y = this->pole[j].gy;
+
+ if (bbox[k].p.x > x)
+ bbox[k].p.x = x;
+ if (bbox[k].q.x < x)
+ bbox[k].q.x = x;
+ if (bbox[k].p.y > y)
+ bbox[k].p.y = y;
+ if (bbox[k].q.y < y)
+ bbox[k].q.y = y;
+ }
+ k++;
}
/* mark contacting bboxes : */
memset(isolated, 0, sizeof(isolated));
for (i = 0; i < k; i++) {
- for (j = i + 1; j < k; j++) {
- if (bbox[i].p.x > bbox[j].q.x)
- continue;
- if (bbox[i].q.x < bbox[j].p.x)
- continue;
- if (bbox[i].p.y > bbox[j].q.y)
- continue;
- if (bbox[i].q.y < bbox[j].p.y)
- continue;
- isolated[i] = isolated[j] = 1; /* mark not isolated. */
- }
+ for (j = i + 1; j < k; j++) {
+ if (bbox[i].p.x > bbox[j].q.x)
+ continue;
+ if (bbox[i].q.x < bbox[j].p.x)
+ continue;
+ if (bbox[i].p.y > bbox[j].q.y)
+ continue;
+ if (bbox[i].q.y < bbox[j].p.y)
+ continue;
+ isolated[i] = isolated[j] = 1; /* mark not isolated. */
+ }
}
/* Make a list of non-isolated contours : */
j = 0;
for (i = 0; i < k; i++) {
- if (isolated[i]) {
- isolated[j] = first_contour + i;
- j++;
- }
+ if (isolated[i]) {
+ isolated[j] = first_contour + i;
+ j++;
+ }
}
k = j;
/* So far we skip isolated contours. */
if (k <= 1)
- return; /* Nothing to fix. */
+ return; /* Nothing to fix. */
/* Compute contour signes : */
for(i = 0; i < k; i++) {
- int c = isolated[i];
- int b = this->contour[c];
- int e = this->contour[c + 1] - 1;
-
- a = 0;
- /* 'close' has same coords as the starting point. */
- for (j = b; j < e; ) {
- if (this->pole[j + 1].type != offcurve) { /* line or close. */
- a += line_area_2(this->pole[j + 0].gx, this->pole[j + 0].gy,
- this->pole[j + 1].gx, this->pole[j + 1].gy);
- j++;
- } else {
- a += bezier_area_2(this->pole[j + 0].gx, this->pole[j + 0].gy,
- this->pole[j + 1].gx, this->pole[j + 1].gy,
- this->pole[j + 2].gx, this->pole[j + 2].gy,
- this->pole[j + 3].gx, this->pole[j + 3].gy);
- j += 3;
- }
- }
- area[i] = a;
+ int c = isolated[i];
+ int b = this->contour[c];
+ int e = this->contour[c + 1] - 1;
+
+ a = 0;
+ /* 'close' has same coords as the starting point. */
+ for (j = b; j < e; ) {
+ if (this->pole[j + 1].type != offcurve) { /* line or close. */
+ a += line_area_2(this->pole[j + 0].gx, this->pole[j + 0].gy,
+ this->pole[j + 1].gx, this->pole[j + 1].gy);
+ j++;
+ } else {
+ a += bezier_area_2(this->pole[j + 0].gx, this->pole[j + 0].gy,
+ this->pole[j + 1].gx, this->pole[j + 1].gy,
+ this->pole[j + 2].gx, this->pole[j + 2].gy,
+ this->pole[j + 3].gx, this->pole[j + 3].gy);
+ j += 3;
+ }
+ }
+ area[i] = a;
}
/* If contours have different signs, don't adjust. */
for (i = 1; i < k; i++) {
- if (area[0] * area[i] < 0)
- return;
+ if (area[0] * area[i] < 0)
+ return;
}
/* Compute the insideness matrix :
For any contoor pair A, B,
check if some point of A is inside B. */
for (i = 0; i < k; i++) {
- inside[i][i] = 0;
- for (j = 0; j < k; j++) {
- if (i != j) {
- int b = this->contour[isolated[i]];
- int code = t1_hinter__is_inside(this, this->pole[b].gx, this->pole[b].gy, isolated[j]);
-
- if (code < 0) {
- /* Contours have a common point - don't fix. */
- return;
- }
- inside[i][j] = (byte)code;
- if (i > j && inside[j][i]) {
- /* Contours intersect, don't fix. */
- return;
- }
- }
- }
+ inside[i][i] = 0;
+ for (j = 0; j < k; j++) {
+ if (i != j) {
+ int b = this->contour[isolated[i]];
+ int code = t1_hinter__is_inside(this, this->pole[b].gx, this->pole[b].gy, isolated[j]);
+
+ if (code < 0) {
+ /* Contours have a common point - don't fix. */
+ return;
+ }
+ inside[i][j] = (byte)code;
+ if (i > j && inside[j][i]) {
+ /* Contours intersect, don't fix. */
+ return;
+ }
+ }
+ }
}
/* Transitive closure : */
do {
- m = 0;
- for (i = 0; i < k; i++) {
- for (j = 0; j < k; j++) {
- if (i != j) {
- for (l = 0; l < k; l++) {
- if (j != l && inside[i][j] && inside[j][l]) {
- if (inside[l][i]) {
- /* Cycled - don't fix. */
- return;
- }
- if (!inside[i][l])
- m = 1;
- inside[i][l] = 1;
- }
- }
- }
- }
- }
+ m = 0;
+ for (i = 0; i < k; i++) {
+ for (j = 0; j < k; j++) {
+ if (i != j) {
+ for (l = 0; l < k; l++) {
+ if (j != l && inside[i][j] && inside[j][l]) {
+ if (inside[l][i]) {
+ /* Cycled - don't fix. */
+ return;
+ }
+ if (!inside[i][l])
+ m = 1;
+ inside[i][l] = 1;
+ }
+ }
+ }
+ }
+ }
} while(m);
/* Compute nesting numbers : */
nesting_sum = 0;
memset(nesting, 0, sizeof(nesting));
for (i = 0; i < k; i++) {
- for (j = 0; j < k; j++) {
- if (inside[i][j]) {
- nesting[i]++;
- nesting_sum++;
- }
- }
+ for (j = 0; j < k; j++) {
+ if (inside[i][j]) {
+ nesting[i]++;
+ nesting_sum++;
+ }
+ }
}
if (nesting_sum == 0) {
- /* No nesting contours - don't fix.
- We want to save time from computing contour intersections. */
- return;
+ /* No nesting contours - don't fix.
+ We want to save time from computing contour intersections. */
+ return;
}
/* Check contour intersections : */
for (i = 0; i < k; i++) {
- for (j = 0; j < k; j++) {
- if (inside[i][j]) {
- if (t1_hinter__contour_intersection(this, isolated[i], isolated[j])) {
- /* Contours intersect - don't fix. */
- return;
- }
- }
- }
+ for (j = 0; j < k; j++) {
+ if (inside[i][j]) {
+ if (t1_hinter__contour_intersection(this, isolated[i], isolated[j])) {
+ /* Contours intersect - don't fix. */
+ return;
+ }
+ }
+ }
}
/* Fix signs : */
for (i = 0; i < k; i++) {
- if ((nesting[i] & 1) != (area[i] < 0))
- t1_hinter__reverse_contour(this, isolated[i]);
+ if ((nesting[i] & 1) != (area[i] < 0))
+ t1_hinter__reverse_contour(this, isolated[i]);
}
- /* Note we didn't fix negative isolated contours.
+ /* Note we didn't fix negative isolated contours.
We never meet such cases actually. */
}
@@ -702,21 +702,21 @@ void t1_hinter__fix_contour_signs(t1_hinter * this)
int i;
if (this->subglyph_count >= 3) {
- /* 3 or more subglyphs.
- We didn't meet so complex characters with wrong contours signs.
- Skip it for saving the CPU time. */
- return;
+ /* 3 or more subglyphs.
+ We didn't meet so complex characters with wrong contours signs.
+ Skip it for saving the CPU time. */
+ return;
}
for (i = 1; i <= this->subglyph_count; i++) {
- int first_contour = this->subglyph[i - 1];
- int last_contour = this->subglyph[i] - 1;
-
- if (last_contour - first_contour >= MAX_NORMALIZING_CONTOURS) {
- /* 4 or more contours.
- We didn't meet so complex characters with wrong contours signs.
- Skip it for saving the CPU time. */
- continue;
- }
- t1_hinter__fix_subglyph_contour_signs(this, first_contour, last_contour);
+ int first_contour = this->subglyph[i - 1];
+ int last_contour = this->subglyph[i] - 1;
+
+ if (last_contour - first_contour >= MAX_NORMALIZING_CONTOURS) {
+ /* 4 or more contours.
+ We didn't meet so complex characters with wrong contours signs.
+ Skip it for saving the CPU time. */
+ continue;
+ }
+ t1_hinter__fix_subglyph_contour_signs(this, first_contour, last_contour);
}
}
diff --git a/gs/base/gxhldevc.c b/gs/base/gxhldevc.c
index 719214096..81c8673d5 100644
--- a/gs/base/gxhldevc.c
+++ b/gs/base/gxhldevc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ void gx_hld_saved_color_init(gx_hl_saved_color * psc)
{
gx_device_color temp_devc;
- memset(psc, 0, sizeof(*psc)); /* clear the entire structure */
+ memset(psc, 0, sizeof(*psc)); /* clear the entire structure */
psc->color_space_id = psc->pattern_id = gs_no_id;
color_set_null(&temp_devc);
temp_devc.type->save_dc(&temp_devc, &(psc->saved_dev_color));
@@ -47,7 +47,7 @@ const gs_state * gx_hld_get_gstate_ptr(const gs_imager_state * pis)
/* Check to verify the structure type is really (gs_state *) */
if (pis == NULL || pis->is_gstate == false)
- return NULL;
+ return NULL;
return (const gs_state *) pis;
}
@@ -60,7 +60,7 @@ const gs_state * gx_hld_get_gstate_ptr(const gs_imager_state * pis)
*/
bool
gx_hld_save_color(const gs_imager_state * pis, const gx_device_color * pdevc,
- gx_hl_saved_color * psc)
+ gx_hl_saved_color * psc)
{
const gs_state * pgs = gx_hld_get_gstate_ptr(pis);
memset(psc, 0, sizeof(*psc)); /* clear the entire structure */
@@ -68,38 +68,38 @@ gx_hld_save_color(const gs_imager_state * pis, const gx_device_color * pdevc,
if (pdevc == NULL) {
/* No device color given, should not happen */
gx_hld_saved_color_init(psc); /* revert to unknown color */
- return false;
+ return false;
} else if (pgs == NULL) {
/* No color space, simply save device color specific info */
psc->color_space_id = psc->pattern_id = gs_no_id;
pdevc->type->save_dc(pdevc, &(psc->saved_dev_color));
- return false;
+ return false;
} else {
/*
- * Have color space, save id, ccolor, & device color specific info.
- * Also save the high level colors since two gx_color_index values
- * may be the same but for differing high level colors (due to the
- * usual lower resolution of the gx_color_index values.
- */
+ * Have color space, save id, ccolor, & device color specific info.
+ * Also save the high level colors since two gx_color_index values
+ * may be the same but for differing high level colors (due to the
+ * usual lower resolution of the gx_color_index values.
+ */
const gs_color_space * pcs = gs_currentcolorspace_inline(pgs);
int i = gs_color_space_num_components(pcs);
psc->color_space_id = pcs->id;
pdevc->type->save_dc(pdevc, &(psc->saved_dev_color));
- if (pdevc->type == gx_dc_type_pattern2)
- i = 0;
+ if (pdevc->type == gx_dc_type_pattern2)
+ i = 0;
else if (i < 0)
- i = -i - 1; /* See gx_num_components_Pattern. */
+ i = -i - 1; /* See gx_num_components_Pattern. */
for (i--; i >= 0; i--)
- psc->ccolor.paint.values[i] = pdevc->ccolor.paint.values[i];
+ psc->ccolor.paint.values[i] = pdevc->ccolor.paint.values[i];
- /* Save the pattern id - if present */
- if ((pdevc->type == gx_dc_type_pattern
- || pdevc->type == gx_dc_type_pattern2) && pdevc->ccolor_valid)
+ /* Save the pattern id - if present */
+ if ((pdevc->type == gx_dc_type_pattern
+ || pdevc->type == gx_dc_type_pattern2) && pdevc->ccolor_valid)
psc->pattern_id = pdevc->ccolor.pattern->pattern_id;
- else
+ else
psc->pattern_id = gs_no_id;
- return true;
+ return true;
}
}
@@ -109,7 +109,7 @@ gx_hld_save_color(const gs_imager_state * pis, const gx_device_color * pdevc,
* for what is actually being compared.
*/
bool gx_hld_saved_color_equal(const gx_hl_saved_color * psc1,
- const gx_hl_saved_color * psc2)
+ const gx_hl_saved_color * psc2)
{
return (memcmp(psc1, psc2, sizeof(*psc1)) == 0);
}
@@ -118,16 +118,16 @@ bool gx_hld_saved_color_equal(const gx_hl_saved_color * psc1,
* Check whether two saved colors have same color space.
*/
bool gx_hld_saved_color_same_cspace(const gx_hl_saved_color * psc1,
- const gx_hl_saved_color * psc2)
+ const gx_hl_saved_color * psc2)
{
if (psc1->color_space_id != psc2->color_space_id)
- return false;
+ return false;
if (psc1->pattern_id != psc2->pattern_id)
- return false;
+ return false;
if (psc1->ccolor_valid != psc2->ccolor_valid)
- return false;
+ return false;
if (psc1->color_space_id != psc2->color_space_id)
- return false;
+ return false;
return true;
}
@@ -136,12 +136,12 @@ bool gx_hld_saved_color_same_cspace(const gx_hl_saved_color * psc1,
*/
bool
gx_hld_is_hl_color_available(const gs_imager_state * pis,
- const gx_device_color * pdevc)
+ const gx_device_color * pdevc)
{
const gs_state * pgs = gx_hld_get_gstate_ptr(pis);
if (pgs != NULL && pdevc != NULL && pdevc->ccolor_valid)
- return true;
+ return true;
return false;
}
@@ -152,23 +152,23 @@ gx_hld_is_hl_color_available(const gs_imager_state * pis,
*/
gx_hld_get_color_space_and_ccolor_status
gx_hld_get_color_space_and_ccolor(const gs_imager_state * pis,
- const gx_device_color * pdevc, const gs_color_space ** ppcs,
- const gs_client_color ** ppcc)
+ const gx_device_color * pdevc, const gs_color_space ** ppcs,
+ const gs_client_color ** ppcc)
{
/* Check if the current color space was used to build the device color */
if (gx_hld_is_hl_color_available(pis, pdevc)) {
- const gs_state * pgs = gx_hld_get_gstate_ptr(pis);
+ const gs_state * pgs = gx_hld_get_gstate_ptr(pis);
const gs_color_space * pcs = gs_currentcolorspace_inline(pgs);
- *ppcs = pcs;
- *ppcc = &(pdevc->ccolor);
- if (pdevc->type == gx_dc_type_pattern
- || pdevc->type == &gx_dc_pure_masked
- || pdevc->type == gx_dc_type_pattern2)
+ *ppcs = pcs;
+ *ppcc = &(pdevc->ccolor);
+ if (pdevc->type == gx_dc_type_pattern
+ || pdevc->type == &gx_dc_pure_masked
+ || pdevc->type == gx_dc_type_pattern2)
return pattern_color_space;
- else {
+ else {
return non_pattern_color_space;
- }
+ }
}
/* No color space */
*ppcs = NULL;
@@ -188,11 +188,11 @@ gx_hld_get_number_color_components(const gs_imager_state * pis)
if (pgs != NULL) {
const gs_color_space * pcs = gs_currentcolorspace_inline(pgs);
- int n = gs_color_space_num_components(pcs);
+ int n = gs_color_space_num_components(pcs);
- return (n >= 0 ? n : -n - 1);
+ return (n >= 0 ? n : -n - 1);
} else
- return -1;
+ return -1;
}
/*
@@ -202,19 +202,18 @@ gx_hld_get_number_color_components(const gs_imager_state * pis)
*/
gx_hld_get_color_component_status
gx_hld_get_color_component(const gs_imager_state * pis,
- const gx_device_color * pdevc,
- int comp_num, float * output)
+ const gx_device_color * pdevc,
+ int comp_num, float * output)
{
if (pdevc != NULL && pdevc->ccolor_valid) {
- int ncomp = gx_hld_get_number_color_components(pis);
+ int ncomp = gx_hld_get_number_color_components(pis);
- if (ncomp < 0)
- return invalid_color_info;
- if (comp_num < 0 || comp_num >= ncomp)
- return invalid_component_requested;
- *output = pdevc->ccolor.paint.values[comp_num];
+ if (ncomp < 0)
+ return invalid_color_info;
+ if (comp_num < 0 || comp_num >= ncomp)
+ return invalid_component_requested;
+ *output = pdevc->ccolor.paint.values[comp_num];
return valid_result;
}
return invalid_color_info;
}
-
diff --git a/gs/base/gxhldevc.h b/gs/base/gxhldevc.h
index 987962ad0..8569da3df 100644
--- a/gs/base/gxhldevc.h
+++ b/gs/base/gxhldevc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,6 @@
* The functions below are desiged to assist the high level device in the
* saving, comparing, and getting high level color information.
*/
-
#ifndef gs_imager_state_DEFINED
# define gs_imager_state_DEFINED
@@ -92,11 +91,11 @@ const gs_state * gx_hld_get_gstate_ptr(const gs_imager_state * pis);
* color. Otherwise 'false' is returned. Thus the return does both
* a save and test on the given color.
*
- * If the device can't handle high level colors, it must pass NULL to
+ * If the device can't handle high level colors, it must pass NULL to
* the 'pis' argument.
*/
bool gx_hld_save_color(const gs_imager_state * pis,
- const gx_device_color * pdevc, gx_hl_saved_color * psc);
+ const gx_device_color * pdevc, gx_hl_saved_color * psc);
/*
* Compare two saved colors to check if match. Note this routine assumes
@@ -104,20 +103,20 @@ bool gx_hld_save_color(const gs_imager_state * pis,
* for what is actually being compared.
*/
bool gx_hld_saved_color_equal(const gx_hl_saved_color * psc1,
- const gx_hl_saved_color * psc2);
+ const gx_hl_saved_color * psc2);
/*
* Check whether two saved colors have same color space.
*/
bool gx_hld_saved_color_same_cspace(const gx_hl_saved_color * psc1,
- const gx_hl_saved_color * psc2);
+ const gx_hl_saved_color * psc2);
/*
* Check if a high level color is availavble.
*/
bool
gx_hld_is_hl_color_available(const gs_imager_state * pis,
- const gx_device_color * pdevc);
+ const gx_device_color * pdevc);
/*
* Return status from get_color_space_and_ccolor. See that routine for
@@ -129,7 +128,7 @@ gx_hld_is_hl_color_available(const gs_imager_state * pis,
typedef enum {
non_pattern_color_space,
pattern_color_space,
- use_process_color
+ use_process_color
} gx_hld_get_color_space_and_ccolor_status;
/*
@@ -156,8 +155,8 @@ typedef enum {
* a pattern or non pattern).
*/
gx_hld_get_color_space_and_ccolor_status gx_hld_get_color_space_and_ccolor(
- const gs_imager_state * pis, const gx_device_color * pdevc,
- const gs_color_space ** ppcs, const gs_client_color ** ppcc);
+ const gs_imager_state * pis, const gx_device_color * pdevc,
+ const gs_color_space ** ppcs, const gs_client_color ** ppcc);
/*
* This routine will return the number of components in the current color
@@ -186,8 +185,7 @@ typedef enum {
* device fall back to using the process color model.
*/
gx_hld_get_color_component_status gx_hld_get_color_component(
- const gs_imager_state * pis, const gx_device_color * pdevc,
- int comp_numi, float * output);
+ const gs_imager_state * pis, const gx_device_color * pdevc,
+ int comp_numi, float * output);
#endif
-
diff --git a/gs/base/gxht.c b/gs/base/gxht.c
index 66f7dcecc..2b6729a94 100644
--- a/gs/base/gxht.c
+++ b/gs/base/gxht.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
/* Define the binary halftone device color type. */
/* The type descriptor must be public for Pattern types. */
gs_public_st_composite(st_dc_ht_binary, gx_device_color, "dc_ht_binary",
- dc_ht_binary_enum_ptrs, dc_ht_binary_reloc_ptrs);
+ dc_ht_binary_enum_ptrs, dc_ht_binary_reloc_ptrs);
static dev_color_proc_save_dc(gx_dc_ht_binary_save_dc);
static dev_color_proc_get_dev_halftone(gx_dc_ht_binary_get_dev_halftone);
static dev_color_proc_load(gx_dc_ht_binary_load);
@@ -55,7 +55,7 @@ const gx_device_color_type_t *const gx_dc_type_ht_binary =
#define gx_dc_type_ht_binary (&gx_dc_type_data_ht_binary)
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(dc_ht_binary_enum_ptrs, gx_device_color *cptr) return 0;
ENUM_PTR(0, gx_device_color, colors.binary.b_ht);
case 1:
@@ -78,7 +78,7 @@ RELOC_PTRS_END
/* Other GC procedures */
private_st_ht_tiles();
-static
+static
ENUM_PTRS_BEGIN_PROC(ht_tiles_enum_ptrs)
{
return 0;
@@ -93,15 +93,15 @@ static RELOC_PTRS_BEGIN(ht_tiles_reloc_ptrs)
uint diff;
if (bits == 0)
- return;
+ return;
RELOC_VAR(bits);
if (size == size_of(gx_ht_tile)) { /* only 1 tile */
- ht_tiles->tiles.data = bits;
- return;
+ ht_tiles->tiles.data = bits;
+ return;
}
diff = ht_tiles[1].tiles.data - ht_tiles[0].tiles.data;
for (; size; ht_tiles++, size -= size_of(gx_ht_tile), bits += diff) {
- ht_tiles->tiles.data = bits;
+ ht_tiles->tiles.data = bits;
}
}
RELOC_PTRS_END
@@ -113,7 +113,7 @@ gx_ht_cache_default_tiles(void)
{
#ifdef DEBUG
return (gs_debug_c('.') ? max_ht_cached_tiles_SMALL :
- max_ht_cached_tiles);
+ max_ht_cached_tiles);
#else
return max_ht_cached_tiles;
#endif
@@ -123,7 +123,7 @@ gx_ht_cache_default_bits_size(void)
{
#ifdef DEBUG
return (gs_debug_c('.') ? max_ht_cache_bits_size_SMALL :
- max_ht_cache_bits_size);
+ max_ht_cache_bits_size);
#else
return max_ht_cache_bits_size;
#endif
@@ -135,18 +135,18 @@ gx_ht_alloc_cache(gs_memory_t * mem, uint max_tiles, uint max_bits_size)
{
gx_ht_cache *pcache =
gs_alloc_struct(mem, gx_ht_cache, &st_ht_cache,
- "alloc_ht_cache(struct)");
+ "alloc_ht_cache(struct)");
byte *tbits =
- gs_alloc_bytes(mem, max_bits_size, "alloc_ht_cache(bits)");
+ gs_alloc_bytes(mem, max_bits_size, "alloc_ht_cache(bits)");
gx_ht_tile *ht_tiles =
- gs_alloc_struct_array(mem, max_tiles, gx_ht_tile, &st_ht_tiles,
- "alloc_ht_cache(ht_tiles)");
+ gs_alloc_struct_array(mem, max_tiles, gx_ht_tile, &st_ht_tiles,
+ "alloc_ht_cache(ht_tiles)");
if (pcache == 0 || tbits == 0 || ht_tiles == 0) {
- gs_free_object(mem, ht_tiles, "alloc_ht_cache(ht_tiles)");
- gs_free_object(mem, tbits, "alloc_ht_cache(bits)");
- gs_free_object(mem, pcache, "alloc_ht_cache(struct)");
- return 0;
+ gs_free_object(mem, ht_tiles, "alloc_ht_cache(ht_tiles)");
+ gs_free_object(mem, tbits, "alloc_ht_cache(bits)");
+ gs_free_object(mem, pcache, "alloc_ht_cache(struct)");
+ return 0;
}
pcache->bits = tbits;
pcache->bits_size = max_bits_size;
@@ -194,7 +194,7 @@ gx_check_tile_cache(const gs_imager_state * pis)
*/
int
gx_check_tile_size(const gs_imager_state * pis, int w, int y, int h,
- gs_color_select_t select, int *ppx)
+ gs_color_select_t select, int *ppx)
{
/* TO_DO_DEVICEN - this routine is no longer used - delete. */
return -1;
@@ -202,7 +202,7 @@ gx_check_tile_size(const gs_imager_state * pis, int w, int y, int h,
/* Render a given level into a halftone cache. */
static int render_ht(gx_ht_tile *, int, const gx_ht_order *,
- gx_bitmap_id);
+ gx_bitmap_id);
static gx_ht_tile *
gx_render_ht_default(gx_ht_cache * pcache, int b_level)
{
@@ -211,15 +211,15 @@ gx_render_ht_default(gx_ht_cache * pcache, int b_level)
gx_ht_tile *bt;
if (pcache->num_cached < porder->num_levels )
- bt = &pcache->ht_tiles[level / pcache->levels_per_tile];
+ bt = &pcache->ht_tiles[level / pcache->levels_per_tile];
else
- bt = &pcache->ht_tiles[b_level]; /* one tile per b_level */
+ bt = &pcache->ht_tiles[b_level]; /* one tile per b_level */
if (bt->level != level) {
- int code = render_ht(bt, level, porder, pcache->base_id + b_level);
+ int code = render_ht(bt, level, porder, pcache->base_id + b_level);
- if (code < 0)
- return 0;
+ if (code < 0)
+ return 0;
}
return bt;
}
@@ -247,17 +247,17 @@ gx_dc_ht_binary_get_dev_halftone(const gx_device_color * pdevc)
/* Load the device color into the halftone cache if needed. */
static int
gx_dc_ht_binary_load(gx_device_color * pdevc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
int component_index = pdevc->colors.binary.b_index;
const gx_ht_order *porder =
- (component_index < 0 ?
- &pdevc->colors.binary.b_ht->order :
- &pdevc->colors.binary.b_ht->components[component_index].corder);
+ (component_index < 0 ?
+ &pdevc->colors.binary.b_ht->order :
+ &pdevc->colors.binary.b_ht->components[component_index].corder);
gx_ht_cache *pcache = porder->cache;
if (pcache->order.bit_data != porder->bit_data)
- gx_ht_init_cache(pis->memory, pcache, porder);
+ gx_ht_init_cache(pis->memory, pcache, porder);
/*
* We do not load the cache now. Instead we wait until we are ready
* to actually render the color. This allows multiple colors to be
@@ -278,22 +278,22 @@ gx_dc_ht_binary_load_cache(const gx_device_color * pdevc)
{
int component_index = pdevc->colors.binary.b_index;
const gx_ht_order *porder =
- &pdevc->colors.binary.b_ht->components[component_index].corder;
+ &pdevc->colors.binary.b_ht->components[component_index].corder;
gx_ht_cache *pcache = porder->cache;
int b_level = pdevc->colors.binary.b_level;
int level = porder->levels[b_level];
gx_ht_tile *bt;
if (pcache->num_cached < porder->num_levels )
- bt = &pcache->ht_tiles[level / pcache->levels_per_tile];
+ bt = &pcache->ht_tiles[level / pcache->levels_per_tile];
else
- bt = &pcache->ht_tiles[b_level]; /* one tile per b_level */
+ bt = &pcache->ht_tiles[b_level]; /* one tile per b_level */
if (bt->level != level) {
- int code = render_ht(bt, level, porder, pcache->base_id + b_level);
+ int code = render_ht(bt, level, porder, pcache->base_id + b_level);
- if (code < 0)
- return_error(gs_error_Fatal);
+ if (code < 0)
+ return_error(gs_error_Fatal);
}
((gx_device_color *)pdevc)->colors.binary.b_tile = bt;
return 0;
@@ -303,8 +303,8 @@ gx_dc_ht_binary_load_cache(const gx_device_color * pdevc)
/* Note that we treat this as "texture" for RasterOp. */
static int
gx_dc_ht_binary_fill_rectangle(const gx_device_color * pdevc, int x, int y,
- int w, int h, gx_device * dev, gs_logical_operation_t lop,
- const gx_rop_source_t * source)
+ int w, int h, gx_device * dev, gs_logical_operation_t lop,
+ const gx_rop_source_t * source)
{
gx_rop_source_t no_source;
@@ -317,33 +317,33 @@ gx_dc_ht_binary_fill_rectangle(const gx_device_color * pdevc, int x, int y,
* pixels are *not* opaque.
*/
if (dev->color_info.depth > 1)
- lop &= ~lop_T_transparent;
+ lop &= ~lop_T_transparent;
if (source == NULL && lop_no_S_is_T(lop))
- return (*dev_proc(dev, strip_tile_rectangle)) (dev,
- &pdevc->colors.binary.b_tile->tiles,
- x, y, w, h, pdevc->colors.binary.color[0],
- pdevc->colors.binary.color[1],
- pdevc->phase.x, pdevc->phase.y);
+ return (*dev_proc(dev, strip_tile_rectangle)) (dev,
+ &pdevc->colors.binary.b_tile->tiles,
+ x, y, w, h, pdevc->colors.binary.color[0],
+ pdevc->colors.binary.color[1],
+ pdevc->phase.x, pdevc->phase.y);
/* Adjust the logical operation per transparent colors. */
if (pdevc->colors.binary.color[0] == gx_no_color_index)
- lop = rop3_use_D_when_T_0(lop);
+ lop = rop3_use_D_when_T_0(lop);
if (pdevc->colors.binary.color[1] == gx_no_color_index)
- lop = rop3_use_D_when_T_1(lop);
+ lop = rop3_use_D_when_T_1(lop);
if (source == NULL)
- set_rop_no_source(source, no_source, dev);
+ set_rop_no_source(source, no_source, dev);
return (*dev_proc(dev, strip_copy_rop)) (dev, source->sdata,
- source->sourcex, source->sraster, source->id,
- (source->use_scolors ? source->scolors : NULL),
- &pdevc->colors.binary.b_tile->tiles,
- pdevc->colors.binary.color,
- x, y, w, h, pdevc->phase.x, pdevc->phase.y,
- lop);
+ source->sourcex, source->sraster, source->id,
+ (source->use_scolors ? source->scolors : NULL),
+ &pdevc->colors.binary.b_tile->tiles,
+ pdevc->colors.binary.color,
+ x, y, w, h, pdevc->phase.x, pdevc->phase.y,
+ lop);
}
static int
gx_dc_ht_binary_fill_masked(const gx_device_color * pdevc, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_device * dev, gs_logical_operation_t lop, bool invert)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_device * dev, gs_logical_operation_t lop, bool invert)
{
/*
* Load the halftone cache for the color. We do not do it earlier
@@ -355,26 +355,25 @@ gx_dc_ht_binary_fill_masked(const gx_device_color * pdevc, const byte * data,
int code = gx_dc_ht_binary_load_cache(pdevc);
if (code < 0)
- return code;
+ return code;
return gx_dc_default_fill_masked(pdevc, data, data_x, raster, id,
- x, y, w, h, dev, lop, invert);
+ x, y, w, h, dev, lop, invert);
}
/* Compare two binary halftones for equality. */
static bool
gx_dc_ht_binary_equal(const gx_device_color * pdevc1,
- const gx_device_color * pdevc2)
+ const gx_device_color * pdevc2)
{
return pdevc2->type == pdevc1->type &&
- pdevc1->phase.x == pdevc2->phase.x &&
- pdevc1->phase.y == pdevc2->phase.y &&
- gx_dc_binary_color0(pdevc1) == gx_dc_binary_color0(pdevc2) &&
- gx_dc_binary_color1(pdevc1) == gx_dc_binary_color1(pdevc2) &&
- pdevc1->colors.binary.b_level == pdevc2->colors.binary.b_level;
+ pdevc1->phase.x == pdevc2->phase.x &&
+ pdevc1->phase.y == pdevc2->phase.y &&
+ gx_dc_binary_color0(pdevc1) == gx_dc_binary_color0(pdevc2) &&
+ gx_dc_binary_color1(pdevc1) == gx_dc_binary_color1(pdevc2) &&
+ pdevc1->colors.binary.b_level == pdevc2->colors.binary.b_level;
}
-
-/*
+/*
* Flags to indicate the pieces of a binary halftone that are included
* in its string representation. The first byte of the string holds this
* set of flags.
@@ -387,7 +386,6 @@ static const int dc_ht_binary_has_color1 = 0x02;
static const int dc_ht_binary_has_level = 0x04;
static const int dc_ht_binary_has_index = 0x08;
-
/*
* Serialize a binany halftone device color.
*
@@ -397,7 +395,7 @@ static const int dc_ht_binary_has_index = 0x08;
*
* psdc pointer ot saved version of last serialized color (for
* this band)
- *
+ *
* dev pointer to the current device, used to retrieve process
* color model information
*
@@ -435,7 +433,7 @@ gx_dc_ht_binary_write(
int code;
if (offset != 0)
- return_error(gs_error_unregistered); /* Not implemented yet. */
+ return_error(gs_error_unregistered); /* Not implemented yet. */
/* check if operand and saved colors are the same type */
if (psdc != 0 && psdc->type != pdevc->type)
@@ -566,7 +564,7 @@ gx_dc_ht_binary_read(
int code, flag_bits;
if (offset != 0)
- return_error(gs_error_unregistered); /* Not implemented yet. */
+ return_error(gs_error_unregistered); /* Not implemented yet. */
/* if prior information is available, use it */
if (prior_devc != 0 && prior_devc->type == gx_dc_type_ht_binary)
@@ -619,12 +617,12 @@ gx_dc_ht_binary_read(
if ((flag_bits & dc_ht_binary_has_index) != 0) {
if (size == 0)
return_error(gs_error_rangecheck);
- --size;
+ --size;
devc.colors.binary.b_index = *pdata++;
}
if (pis->dev_ht == NULL)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
/* set the phase as required (select value is arbitrary) */
color_set_phase_mod( &devc,
pis->screen_phase[0].x,
@@ -637,7 +635,6 @@ gx_dc_ht_binary_read(
return pdata - pdata0;
}
-
/*
* Get the nonzero components of a binary halftone. This is used to
* distinguish components that are given zero intensity due to halftoning
@@ -677,7 +674,6 @@ gx_dc_ht_binary_get_nonzero_comps(
return code;
}
-
/* Initialize the tile cache for a given screen. */
/* Cache as many different levels as will fit. */
void
@@ -699,40 +695,40 @@ gx_ht_init_cache(const gs_memory_t *mem, gx_ht_cache * pcache, const gx_ht_order
/* Non-monotonic halftones may have more bits than size. */
if (porder->num_bits >= size)
- size = porder->num_bits + 1;
+ size = porder->num_bits + 1;
/* Make sure num_cached is within bounds */
num_cached = pcache->bits_size / tile_bytes;
if (num_cached > size)
- num_cached = size;
+ num_cached = size;
if (num_cached > pcache->num_tiles)
- num_cached = pcache->num_tiles;
+ num_cached = pcache->num_tiles;
if (num_cached == size &&
- tile_bytes * num_cached <= pcache->bits_size / 2
- ) {
- /*
- * We can afford to replicate every tile in the cache,
- * which will reduce breakage when tiling. Since
- * horizontal breakage is more expensive than vertical,
- * and since wide shallow fills are more common than
- * narrow deep fills, we replicate the tile horizontally.
- * We do have to be careful not to replicate the tile
- * to an absurdly large size, however.
- */
- uint rep_raster =
- ((pcache->bits_size / num_cached) / height) &
- ~(align_bitmap_mod - 1);
- uint rep_count = rep_raster * 8 / width;
-
- /*
- * There's no real value in replicating the tile
- * beyond the point where the byte width of the replicated
- * tile is a multiple of a long.
- */
- if (rep_count > sizeof(ulong) * 8)
- rep_count = sizeof(ulong) * 8;
- width_unit = width * rep_count;
- raster = bitmap_raster(width_unit);
- tile_bytes = raster * height;
+ tile_bytes * num_cached <= pcache->bits_size / 2
+ ) {
+ /*
+ * We can afford to replicate every tile in the cache,
+ * which will reduce breakage when tiling. Since
+ * horizontal breakage is more expensive than vertical,
+ * and since wide shallow fills are more common than
+ * narrow deep fills, we replicate the tile horizontally.
+ * We do have to be careful not to replicate the tile
+ * to an absurdly large size, however.
+ */
+ uint rep_raster =
+ ((pcache->bits_size / num_cached) / height) &
+ ~(align_bitmap_mod - 1);
+ uint rep_count = rep_raster * 8 / width;
+
+ /*
+ * There's no real value in replicating the tile
+ * beyond the point where the byte width of the replicated
+ * tile is a multiple of a long.
+ */
+ if (rep_count > sizeof(ulong) * 8)
+ rep_count = sizeof(ulong) * 8;
+ width_unit = width * rep_count;
+ raster = bitmap_raster(width_unit);
+ tile_bytes = raster * height;
}
pcache->base_id = gs_next_ids(mem, porder->num_levels + 1);
pcache->order = *porder;
@@ -743,17 +739,17 @@ gx_ht_init_cache(const gs_memory_t *mem, gx_ht_cache * pcache, const gx_ht_order
pcache->tiles_fit = -1;
memset(tbits, 0, pcache->bits_size);
for (i = 0; i < num_cached; i++, tbits += tile_bytes) {
- register gx_ht_tile *bt = &pcache->ht_tiles[i];
-
- bt->level = 0;
- bt->index = i;
- bt->tiles.data = tbits;
- bt->tiles.raster = raster;
- bt->tiles.size.x = width_unit;
- bt->tiles.size.y = height_unit;
- bt->tiles.rep_width = width;
- bt->tiles.rep_height = height;
- bt->tiles.shift = bt->tiles.rep_shift = shift;
+ register gx_ht_tile *bt = &pcache->ht_tiles[i];
+
+ bt->level = 0;
+ bt->index = i;
+ bt->tiles.data = tbits;
+ bt->tiles.raster = raster;
+ bt->tiles.size.x = width_unit;
+ bt->tiles.size.y = height_unit;
+ bt->tiles.rep_width = width;
+ bt->tiles.rep_height = height;
+ bt->tiles.shift = bt->tiles.rep_shift = shift;
}
pcache->render_ht = gx_render_ht_default;
}
@@ -769,25 +765,25 @@ gx_ht_init_cache(const gs_memory_t *mem, gx_ht_cache * pcache, const gx_ht_order
*/
static int
render_ht(gx_ht_tile * pbt, int level /* [1..num_bits-1] */ ,
- const gx_ht_order * porder, gx_bitmap_id new_id)
+ const gx_ht_order * porder, gx_bitmap_id new_id)
{
byte *data = pbt->tiles.data;
int code;
if_debug7('H', "[H]Halftone cache slot 0x%lx: old=%d, new=%d, w=%d(%d), h=%d(%d):\n",
- (ulong) data, pbt->level, level,
- pbt->tiles.size.x, porder->width,
- pbt->tiles.size.y, porder->num_bits / porder->width);
+ (ulong) data, pbt->level, level,
+ pbt->tiles.size.x, porder->width,
+ pbt->tiles.size.y, porder->num_bits / porder->width);
#ifdef DEBUG
if (level < 0 || level > porder->num_bits) {
- lprintf3("Error in render_ht: level=%d, old level=%d, num_bits=%d\n",
- level, pbt->level, porder->num_bits);
- return_error(gs_error_Fatal);
+ lprintf3("Error in render_ht: level=%d, old level=%d, num_bits=%d\n",
+ level, pbt->level, porder->num_bits);
+ return_error(gs_error_Fatal);
}
#endif
code = porder->procs->render(pbt, level, porder);
if (code < 0)
- return code;
+ return code;
pbt->level = level;
pbt->tiles.id = new_id;
/*
@@ -796,32 +792,32 @@ render_ht(gx_ht_tile * pbt, int level /* [1..num_bits-1] */ ,
* in the cache, we only do it once per level, and it doesn't
* have to be very efficient.
*/
- /****** TEST IS WRONG if width > rep_width but tile.raster ==
- ****** order raster.
- ******/
+ /****** TEST IS WRONG if width > rep_width but tile.raster ==
+ ****** order raster.
+ ******/
if (pbt->tiles.raster > porder->raster)
- bits_replicate_horizontally(data, pbt->tiles.rep_width,
- pbt->tiles.rep_height, porder->raster,
- pbt->tiles.size.x, pbt->tiles.raster);
+ bits_replicate_horizontally(data, pbt->tiles.rep_width,
+ pbt->tiles.rep_height, porder->raster,
+ pbt->tiles.size.x, pbt->tiles.raster);
if (pbt->tiles.size.y > pbt->tiles.rep_height &&
- pbt->tiles.shift == 0
- )
- bits_replicate_vertically(data, pbt->tiles.rep_height,
- pbt->tiles.raster, pbt->tiles.size.y);
+ pbt->tiles.shift == 0
+ )
+ bits_replicate_vertically(data, pbt->tiles.rep_height,
+ pbt->tiles.raster, pbt->tiles.size.y);
#ifdef DEBUG
if (gs_debug_c('H')) {
- const byte *p = pbt->tiles.data;
- int wb = pbt->tiles.raster;
- const byte *ptr = p + wb * pbt->tiles.size.y;
-
- while (p < ptr) {
- dprintf8(" %d%d%d%d%d%d%d%d",
- *p >> 7, (*p >> 6) & 1, (*p >> 5) & 1,
- (*p >> 4) & 1, (*p >> 3) & 1, (*p >> 2) & 1,
- (*p >> 1) & 1, *p & 1);
- if ((++p - data) % wb == 0)
- dputc('\n');
- }
+ const byte *p = pbt->tiles.data;
+ int wb = pbt->tiles.raster;
+ const byte *ptr = p + wb * pbt->tiles.size.y;
+
+ while (p < ptr) {
+ dprintf8(" %d%d%d%d%d%d%d%d",
+ *p >> 7, (*p >> 6) & 1, (*p >> 5) & 1,
+ (*p >> 4) & 1, (*p >> 3) & 1, (*p >> 2) & 1,
+ (*p >> 1) & 1, *p & 1);
+ if ((++p - data) % wb == 0)
+ dputc('\n');
+ }
}
#endif
return 0;
diff --git a/gs/base/gxht.h b/gs/base/gxht.h
index ee540004c..b178556de 100644
--- a/gs/base/gxht.h
+++ b/gs/base/gxht.h
@@ -116,9 +116,9 @@ typedef struct gs_client_order_ht_procs_s {
*/
int (*create_order) (gx_ht_order * porder,
- gs_state * pgs,
- const gs_client_order_halftone * phcop,
- gs_memory_t * mem);
+ gs_state * pgs,
+ const gs_client_order_halftone * phcop,
+ gs_memory_t * mem);
} gs_client_order_ht_procs_t;
struct gs_client_order_halftone_s {
@@ -138,10 +138,10 @@ typedef struct gs_halftone_component_s {
int cname;
gs_halftone_type type;
union {
- gs_spot_halftone spot; /* Type 1 */
- gs_threshold_halftone threshold; /* Type 3 */
- gs_threshold2_halftone threshold2; /* Extended Type 3 */
- gs_client_order_halftone client_order; /* client order */
+ gs_spot_halftone spot; /* Type 1 */
+ gs_threshold_halftone threshold; /* Type 3 */
+ gs_threshold2_halftone threshold2; /* Extended Type 3 */
+ gs_client_order_halftone client_order; /* client order */
} params;
} gs_halftone_component;
@@ -164,7 +164,7 @@ typedef struct gs_multiple_halftone_s {
gs_halftone_component *components;
uint num_comp;
int (*get_colorname_string)(const gs_memory_t *mem, gs_separation_name colorname_index,
- unsigned char **ppstr, unsigned int *pname_size);
+ unsigned char **ppstr, unsigned int *pname_size);
} gs_multiple_halftone;
#define st_multiple_halftone_max_ptrs 1
@@ -182,13 +182,13 @@ struct gs_halftone_s {
gs_halftone_type type;
rc_header rc;
union {
- gs_screen_halftone screen; /* setscreen */
- gs_colorscreen_halftone colorscreen; /* setcolorscreen */
- gs_spot_halftone spot; /* Type 1 */
- gs_threshold_halftone threshold; /* Type 3 */
- gs_threshold2_halftone threshold2; /* Extended Type 3 */
- gs_client_order_halftone client_order; /* client order */
- gs_multiple_halftone multiple; /* Type 5 */
+ gs_screen_halftone screen; /* setscreen */
+ gs_colorscreen_halftone colorscreen; /* setcolorscreen */
+ gs_spot_halftone spot; /* Type 1 */
+ gs_threshold_halftone threshold; /* Type 3 */
+ gs_threshold2_halftone threshold2; /* Extended Type 3 */
+ gs_client_order_halftone client_order; /* client order */
+ gs_multiple_halftone multiple; /* Type 5 */
} params;
};
@@ -199,8 +199,8 @@ extern_st(st_halftone);
#define st_halftone_max_ptrs\
max(max(st_screen_halftone_max_ptrs, st_colorscreen_halftone_max_ptrs),\
max(max(st_spot_halftone_max_ptrs, st_threshold_halftone_max_ptrs),\
- max(st_client_order_halftone_max_ptrs,\
- st_multiple_halftone_max_ptrs)))
+ max(st_client_order_halftone_max_ptrs,\
+ st_multiple_halftone_max_ptrs)))
/* Procedural interface for AccurateScreens */
@@ -218,7 +218,7 @@ bool gs_currentusewts(gs_memory_t *);
/* Initiate screen sampling with optional AccurateScreens. */
int gs_screen_init_memory(gs_screen_enum *, gs_state *,
- gs_screen_halftone *, bool, gs_memory_t *);
+ gs_screen_halftone *, bool, gs_memory_t *);
#define gs_screen_init_accurate(penum, pgs, phsp, accurate)\
gs_screen_init_memory(penum, pgs, phsp, accurate, pgs->memory)
diff --git a/gs/base/gxht_thresh.c b/gs/base/gxht_thresh.c
index 65ad68bd2..3e9c8907b 100644
--- a/gs/base/gxht_thresh.c
+++ b/gs/base/gxht_thresh.c
@@ -278,7 +278,6 @@ gx_ht_threshold_row_bit(byte *contone, byte *threshold_strip, int contone_stri
#endif
}
-
/* This thresholds a buffer that is 16 wide by data_length tall */
void
gx_ht_threshold_landscape(byte *contone_align, byte *thresh_align,
@@ -333,7 +332,7 @@ gx_ht_threshold_landscape(byte *contone_align, byte *thresh_align,
contone_out_posit++;
}
#ifdef PACIFY_VALGRIND
- if (extra)
+ if (extra)
memset(contone+contone_out_posit, 0, extra);
#endif
curr_position++; /* Move us to the next position in our width array */
@@ -367,7 +366,7 @@ gxht_thresh_image_init(gx_image_enum *penum)
if (penum->pis != NULL && penum->pis->dev_ht != NULL) {
for (k = 0; k < penum->pis->dev_ht->num_comp; k++) {
d_order = &(penum->pis->dev_ht->components[k].corder);
- code = gx_ht_construct_threshold(d_order, penum->dev,
+ code = gx_ht_construct_threshold(d_order, penum->dev,
penum->pis, k);
if (code < 0 ) {
return gs_rethrow(code, "threshold creation failed");
@@ -396,7 +395,7 @@ gxht_thresh_image_init(gx_image_enum *penum)
with h=0 we will flush the buffer as we are at the end of the
data. */
if (penum->posture == image_landscape) {
- int col_length =
+ int col_length =
fixed2int_var_rounded(any_abs(penum->x_extent.y)) * spp_out;
ox = dda_current(penum->dda.pixel0.x);
oy = dda_current(penum->dda.pixel0.y);
@@ -500,12 +499,12 @@ gxht_thresh_image_init(gx_image_enum *penum)
Also allow a 15 sample over run during the execution. */
temp = (int) ceil((float) ((dev_width + 15.0) + 15.0)/16.0);
penum->line_size = temp * 16; /* The stride */
- penum->line = gs_alloc_bytes(penum->memory, penum->line_size * spp_out,
+ penum->line = gs_alloc_bytes(penum->memory, penum->line_size * spp_out,
"gxht_thresh");
- penum->thresh_buffer = gs_alloc_bytes(penum->memory,
+ penum->thresh_buffer = gs_alloc_bytes(penum->memory,
penum->line_size * max_height * spp_out,
"gxht_thresh");
- if (penum->line == NULL || penum->thresh_buffer == NULL ||
+ if (penum->line == NULL || penum->thresh_buffer == NULL ||
penum->ht_buffer == NULL) {
return -1;
} else {
@@ -587,13 +586,13 @@ reset_landscape_buffer(ht_landscape_info_t *ht_landscape, byte *contone_align,
}
}
-/* This performs a thresholding operation on a single plane of data and
+/* This performs a thresholding operation on a single plane of data and
performs a copy mono operation to the device */
-int
-gxht_thresh_plane(gx_image_enum *penum, gx_ht_order *d_order,
+int
+gxht_thresh_plane(gx_image_enum *penum, gx_ht_order *d_order,
fixed xrun, int dest_width, int dest_height,
- byte *thresh_align, byte *contone_align, int contone_stride,
- gx_device * dev)
+ byte *thresh_align, byte *contone_align, int contone_stride,
+ gx_device * dev)
{
int thresh_width, thresh_height, dx;
int left_rem_end, left_width, vdi;
diff --git a/gs/base/gxht_thresh.h b/gs/base/gxht_thresh.h
index 0f2c6ff91..ced7f34c8 100644
--- a/gs/base/gxht_thresh.h
+++ b/gs/base/gxht_thresh.h
@@ -33,9 +33,8 @@ void gx_ht_threshold_landscape(byte *contone_align, byte *thresh_align,
ht_landscape_info_t ht_landscape, byte *halftone,
int data_length);
int gxht_thresh_image_init(gx_image_enum *penum);
-int gxht_thresh_plane(gx_image_enum *penum, gx_ht_order *d_order,
+int gxht_thresh_plane(gx_image_enum *penum, gx_ht_order *d_order,
fixed xrun, int dest_width, int dest_height,
- byte *thresh_align, byte *contone_align, int contone_stride,
- gx_device * dev);
+ byte *thresh_align, byte *contone_align, int contone_stride,
+ gx_device * dev);
#endif /* gshtx_INCLUDED */
-
diff --git a/gs/base/gxhtbit.c b/gs/base/gxhtbit.c
index 7f2ef4847..eb86b6a6a 100644
--- a/gs/base/gxhtbit.c
+++ b/gs/base/gxhtbit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ construct_ht_order_default(gx_ht_order *porder, const byte *thresholds)
uint i;
for (i = 0; i < porder->num_bits; i++)
- bits[i].mask = max(1, thresholds[i]);
+ bits[i].mask = max(1, thresholds[i]);
gx_ht_complete_threshold_order(porder);
return 0;
}
@@ -58,59 +58,59 @@ construct_ht_order_short(gx_ht_order *porder, const byte *thresholds)
memset(levels, 0, num_levels * sizeof(*levels));
/* Count the number of threshold elements with each value. */
for (i = 0; i < size; i++) {
- uint value = max(1, thresholds[i]);
+ uint value = max(1, thresholds[i]);
- if (value + 1 < num_levels)
- levels[value + 1]++;
+ if (value + 1 < num_levels)
+ levels[value + 1]++;
}
for (i = 2; i < num_levels; ++i)
- levels[i] += levels[i - 1];
+ levels[i] += levels[i - 1];
/* Now construct the actual order. */
{
- uint width = porder->width;
- uint padding = bitmap_raster(width) * 8 - width;
+ uint width = porder->width;
+ uint padding = bitmap_raster(width) * 8 - width;
- for (i = 0; i < size; i++) {
- uint value = max(1, thresholds[i]);
+ for (i = 0; i < size; i++) {
+ uint value = max(1, thresholds[i]);
- /* Adjust the bit index to account for padding. */
- bits[levels[value]++] = i + (i / width * padding);
- }
+ /* Adjust the bit index to account for padding. */
+ bits[levels[value]++] = i + (i / width * padding);
+ }
}
/* Check whether this is a predefined halftone. */
{
- const gx_dht_proc *phtrp = gx_device_halftone_list;
+ const gx_dht_proc *phtrp = gx_device_halftone_list;
- for (; *phtrp; ++phtrp) {
- const gx_device_halftone_resource_t *const *pphtr = (*phtrp)();
- const gx_device_halftone_resource_t *phtr;
+ for (; *phtrp; ++phtrp) {
+ const gx_device_halftone_resource_t *const *pphtr = (*phtrp)();
+ const gx_device_halftone_resource_t *phtr;
- while ((phtr = *pphtr++) != 0) {
- if (phtr->Width == porder->width &&
- phtr->Height == porder->height &&
- phtr->elt_size == sizeof(ushort) &&
- !memcmp(phtr->levels, levels, num_levels * sizeof(*levels)) &&
- !memcmp(phtr->bit_data, porder->bit_data,
- size * phtr->elt_size)
- ) {
- /*
- * This is a predefined halftone. Free the levels and
- * bit_data arrays, replacing them with the built-in ones.
- */
- if (porder->data_memory) {
- gs_free_object(porder->data_memory, porder->bit_data,
- "construct_ht_order_short(bit_data)");
- gs_free_object(porder->data_memory, porder->levels,
- "construct_ht_order_short(levels)");
- }
- porder->data_memory = 0;
- porder->levels = (uint *)phtr->levels; /* actually const */
- porder->bit_data = (void *)phtr->bit_data; /* actually const */
- goto out;
- }
- }
- }
+ while ((phtr = *pphtr++) != 0) {
+ if (phtr->Width == porder->width &&
+ phtr->Height == porder->height &&
+ phtr->elt_size == sizeof(ushort) &&
+ !memcmp(phtr->levels, levels, num_levels * sizeof(*levels)) &&
+ !memcmp(phtr->bit_data, porder->bit_data,
+ size * phtr->elt_size)
+ ) {
+ /*
+ * This is a predefined halftone. Free the levels and
+ * bit_data arrays, replacing them with the built-in ones.
+ */
+ if (porder->data_memory) {
+ gs_free_object(porder->data_memory, porder->bit_data,
+ "construct_ht_order_short(bit_data)");
+ gs_free_object(porder->data_memory, porder->levels,
+ "construct_ht_order_short(levels)");
+ }
+ porder->data_memory = 0;
+ porder->levels = (uint *)phtr->levels; /* actually const */
+ porder->bit_data = (void *)phtr->bit_data; /* actually const */
+ goto out;
+ }
+ }
+ }
}
out:
return 0;
@@ -125,7 +125,7 @@ ht_bit_index_default(const gx_ht_order *porder, uint index, gs_int_point *ppt)
int bit = 0;
while (!(((const byte *)&phtb->mask)[bit >> 3] & (0x80 >> (bit & 7))))
- ++bit;
+ ++bit;
ppt->x = (offset % porder->raster * 8) + bit;
ppt->y = offset / porder->raster;
return 0;
@@ -149,7 +149,7 @@ render_ht_default(gx_ht_tile *pbt, int level, const gx_ht_order *porder)
{
int old_level = pbt->level;
register const gx_ht_bit *p =
- (const gx_ht_bit *)porder->bit_data + old_level;
+ (const gx_ht_bit *)porder->bit_data + old_level;
register byte *data = pbt->tiles.data;
/*
@@ -167,38 +167,38 @@ render_ht_default(gx_ht_tile *pbt, int level, const gx_ht_order *porder)
# define INVERT(i)\
BEGIN\
if_debug3('H', "[H]invert level=%d offset=%u mask=0x%x\n",\
- (int)(p + i - (const gx_ht_bit *)porder->bit_data),\
- p[i].offset, p[i].mask);\
+ (int)(p + i - (const gx_ht_bit *)porder->bit_data),\
+ p[i].offset, p[i].mask);\
INVERT_DATA(i);\
END
#else
# define INVERT(i) INVERT_DATA(i)
#endif
sw:switch (level - old_level) {
- default:
- if (level > old_level) {
- INVERT(0); INVERT(1); INVERT(2); INVERT(3);
- p += 4; old_level += 4;
- } else {
- INVERT(-1); INVERT(-2); INVERT(-3); INVERT(-4);
- p -= 4; old_level -= 4;
- }
- goto sw;
- case 7: INVERT(6);
- case 6: INVERT(5);
- case 5: INVERT(4);
- case 4: INVERT(3);
- case 3: INVERT(2);
- case 2: INVERT(1);
- case 1: INVERT(0);
- case 0: break; /* Shouldn't happen! */
- case -7: INVERT(-7);
- case -6: INVERT(-6);
- case -5: INVERT(-5);
- case -4: INVERT(-4);
- case -3: INVERT(-3);
- case -2: INVERT(-2);
- case -1: INVERT(-1);
+ default:
+ if (level > old_level) {
+ INVERT(0); INVERT(1); INVERT(2); INVERT(3);
+ p += 4; old_level += 4;
+ } else {
+ INVERT(-1); INVERT(-2); INVERT(-3); INVERT(-4);
+ p -= 4; old_level -= 4;
+ }
+ goto sw;
+ case 7: INVERT(6);
+ case 6: INVERT(5);
+ case 5: INVERT(4);
+ case 4: INVERT(3);
+ case 3: INVERT(2);
+ case 2: INVERT(1);
+ case 1: INVERT(0);
+ case 0: break; /* Shouldn't happen! */
+ case -7: INVERT(-7);
+ case -6: INVERT(-6);
+ case -5: INVERT(-5);
+ case -4: INVERT(-4);
+ case -3: INVERT(-3);
+ case -2: INVERT(-2);
+ case -1: INVERT(-1);
}
#undef INVERT_DATA
#undef INVERT
@@ -224,38 +224,38 @@ render_ht_short(gx_ht_tile *pbt, int level, const gx_ht_order *porder)
# define INVERT(i)\
BEGIN\
if_debug3('H', "[H]invert level=%d offset=%u mask=0x%x\n",\
- (int)(p + i - (const ushort *)porder->bit_data),\
- p[i] >> 3, 0x80 >> (p[i] & 7));\
+ (int)(p + i - (const ushort *)porder->bit_data),\
+ p[i] >> 3, 0x80 >> (p[i] & 7));\
INVERT_DATA(i);\
END
#else
# define INVERT(i) INVERT_DATA(i)
#endif
sw:switch (level - old_level) {
- default:
- if (level > old_level) {
- INVERT(0); INVERT(1); INVERT(2); INVERT(3);
- p += 4; old_level += 4;
- } else {
- INVERT(-1); INVERT(-2); INVERT(-3); INVERT(-4);
- p -= 4; old_level -= 4;
- }
- goto sw;
- case 7: INVERT(6);
- case 6: INVERT(5);
- case 5: INVERT(4);
- case 4: INVERT(3);
- case 3: INVERT(2);
- case 2: INVERT(1);
- case 1: INVERT(0);
- case 0: break; /* Shouldn't happen! */
- case -7: INVERT(-7);
- case -6: INVERT(-6);
- case -5: INVERT(-5);
- case -4: INVERT(-4);
- case -3: INVERT(-3);
- case -2: INVERT(-2);
- case -1: INVERT(-1);
+ default:
+ if (level > old_level) {
+ INVERT(0); INVERT(1); INVERT(2); INVERT(3);
+ p += 4; old_level += 4;
+ } else {
+ INVERT(-1); INVERT(-2); INVERT(-3); INVERT(-4);
+ p -= 4; old_level -= 4;
+ }
+ goto sw;
+ case 7: INVERT(6);
+ case 6: INVERT(5);
+ case 5: INVERT(4);
+ case 4: INVERT(3);
+ case 3: INVERT(2);
+ case 2: INVERT(1);
+ case 1: INVERT(0);
+ case 0: break; /* Shouldn't happen! */
+ case -7: INVERT(-7);
+ case -6: INVERT(-6);
+ case -5: INVERT(-5);
+ case -4: INVERT(-4);
+ case -3: INVERT(-3);
+ case -2: INVERT(-2);
+ case -1: INVERT(-1);
}
#undef INVERT_DATA
#undef INVERT
diff --git a/gs/base/gxhttile.h b/gs/base/gxhttile.h
index 01c4c4902..f916e03db 100644
--- a/gs/base/gxhttile.h
+++ b/gs/base/gxhttile.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxhttype.h b/gs/base/gxhttype.h
index fc58dd9cc..e21fef651 100644
--- a/gs/base/gxhttype.h
+++ b/gs/base/gxhttype.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,13 +25,13 @@ typedef enum {
ht_type_spot, /* Type 1 halftone dictionary */
ht_type_threshold, /* Type 3 halftone dictionary */
ht_type_threshold2, /* Extended Type 3 halftone dictionary */
- /* (Type 3 with either 8- or 16-bit */
- /* samples, bytestring instead of string */
- /* thresholds, and 1 or 2 rectangles) */
+ /* (Type 3 with either 8- or 16-bit */
+ /* samples, bytestring instead of string */
+ /* thresholds, and 1 or 2 rectangles) */
ht_type_multiple, /* Type 5 halftone dictionary */
ht_type_multiple_colorscreen, /* Type 5 halftone dictionary */
- /* created from Type 2 or Type 4 */
- /* halftone dictionary */
+ /* created from Type 2 or Type 4 */
+ /* halftone dictionary */
ht_type_client_order /* client-defined, creating a gx_ht_order */
} gs_halftone_type;
diff --git a/gs/base/gxi12bit.c b/gs/base/gxi12bit.c
index c0174bf4b..633f20391 100644
--- a/gs/base/gxi12bit.c
+++ b/gs/base/gxi12bit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,8 +41,8 @@
static const byte *
sample_unpack_12(byte * bptr, int *pdata_x, const byte * data,
- int data_x, uint dsize, const sample_map *ignore_smap, int spread,
- int ignore_num_components_per_plane)
+ int data_x, uint dsize, const sample_map *ignore_smap, int spread,
+ int ignore_num_components_per_plane)
{
/* Assuming an identity map for all components. */
register frac *bufp = (frac *) bptr;
@@ -53,43 +53,43 @@ sample_unpack_12(byte * bptr, int *pdata_x, const byte * data,
int left = dsize - dskip;
if ((data_x & 1) && left > 0)
- switch (left) {
- default:
- sample = ((uint) (psrc[1] & 0xf) << 8) + psrc[2];
- *bufp = bits2frac(sample, 12);
- inc_bufp(bufp, spread);
- psrc += 3;
- left -= 3;
- break;
- case 2: /* xxxxxxxx xxxxdddd */
- *bufp = (psrc[1] & 0xf) * (frac_1 / 15);
- case 1: /* xxxxxxxx */
- left = 0;
- }
+ switch (left) {
+ default:
+ sample = ((uint) (psrc[1] & 0xf) << 8) + psrc[2];
+ *bufp = bits2frac(sample, 12);
+ inc_bufp(bufp, spread);
+ psrc += 3;
+ left -= 3;
+ break;
+ case 2: /* xxxxxxxx xxxxdddd */
+ *bufp = (psrc[1] & 0xf) * (frac_1 / 15);
+ case 1: /* xxxxxxxx */
+ left = 0;
+ }
while (left >= 3) {
- sample = ((uint) * psrc << 4) + (psrc[1] >> 4);
- *bufp = bits2frac(sample, 12);
- inc_bufp(bufp, spread);
- sample = ((uint) (psrc[1] & 0xf) << 8) + psrc[2];
- *bufp = bits2frac(sample, 12);
- inc_bufp(bufp, spread);
- psrc += 3;
- left -= 3;
+ sample = ((uint) * psrc << 4) + (psrc[1] >> 4);
+ *bufp = bits2frac(sample, 12);
+ inc_bufp(bufp, spread);
+ sample = ((uint) (psrc[1] & 0xf) << 8) + psrc[2];
+ *bufp = bits2frac(sample, 12);
+ inc_bufp(bufp, spread);
+ psrc += 3;
+ left -= 3;
}
/* Handle trailing bytes. */
switch (left) {
- case 2: /* dddddddd ddddxxxx */
- sample = ((uint) * psrc << 4) + (psrc[1] >> 4);
- *bufp = bits2frac(sample, 12);
- inc_bufp(bufp, spread);
- *bufp = (psrc[1] & 0xf) * (frac_1 / 15);
- break;
- case 1: /* dddddddd */
- sample = (uint) * psrc << 4;
- *bufp = bits2frac(sample, 12);
- break;
- case 0: /* Nothing more to do. */
- ;
+ case 2: /* dddddddd ddddxxxx */
+ sample = ((uint) * psrc << 4) + (psrc[1] >> 4);
+ *bufp = bits2frac(sample, 12);
+ inc_bufp(bufp, spread);
+ *bufp = (psrc[1] & 0xf) * (frac_1 / 15);
+ break;
+ case 1: /* dddddddd */
+ sample = (uint) * psrc << 4;
+ *bufp = bits2frac(sample, 12);
+ break;
+ case 0: /* Nothing more to do. */
+ ;
}
*pdata_x = 0;
return bptr;
@@ -112,25 +112,25 @@ gs_image_class_2_fracs(gx_image_enum * penum)
bool std_cmap_procs;
if (penum->bps > 8) {
- if (penum->use_mask_color) {
- /* Convert color mask values to fracs. */
- int i;
-
- for (i = 0; i < penum->spp * 2; ++i)
- penum->mask_color.values[i] =
- bits2frac(penum->mask_color.values[i], 12);
- }
+ if (penum->use_mask_color) {
+ /* Convert color mask values to fracs. */
+ int i;
+
+ for (i = 0; i < penum->spp * 2; ++i)
+ penum->mask_color.values[i] =
+ bits2frac(penum->mask_color.values[i], 12);
+ }
/* If the device has some unique color mapping procs due to its color space,
then we will need to use those and go through pixel by pixel instead
- of blasting through buffers. This is true for example with many of
+ of blasting through buffers. This is true for example with many of
the color spaces for CUPs */
std_cmap_procs = gx_device_uses_std_cmap_procs(penum->dev);
if ( (gs_color_space_get_index(penum->pcs) == gs_color_space_index_DeviceN &&
- penum->pcs->cmm_icc_profile_data == NULL) || penum->use_mask_color ||
+ penum->pcs->cmm_icc_profile_data == NULL) || penum->use_mask_color ||
penum->bps != 16 || !std_cmap_procs ||
- gs_color_space_get_index(penum->pcs) == gs_color_space_index_DevicePixel) {
+ gs_color_space_get_index(penum->pcs) == gs_color_space_index_DevicePixel) {
/* DevicePixel color space used in mask from 3x type. Basically
- a simple color space that just is scaled to the device bit
+ a simple color space that just is scaled to the device bit
depth when remapped. No CM needed */
if_debug0('b', "[b]render=frac\n");
return &image_render_frac;
@@ -164,7 +164,7 @@ gs_image_class_2_fracs(gx_image_enum * penum)
penum->dev->device_icc_profile->num_comps);
if (penum->icc_setup.is_lab) penum->icc_setup.need_decode = false;
if (penum->icc_link == NULL) {
- penum->icc_link = gsicc_get_link(penum->pis, penum->dev, pcs, NULL,
+ penum->icc_link = gsicc_get_link(penum->pis, penum->dev, pcs, NULL,
&rendering_params, penum->memory, false);
}
/* Use the direct unpacking proc */
@@ -202,15 +202,15 @@ typedef union {
/* Test whether a color is transparent. */
static bool
mask_color12_matches(const frac *v, const gx_image_enum *penum,
- int num_components)
+ int num_components)
{
int i;
for (i = num_components * 2, v += num_components - 1; (i -= 2) >= 0; --v)
- if (*v < penum->mask_color.values[i] ||
- *v > penum->mask_color.values[i + 1]
- )
- return false;
+ if (*v < penum->mask_color.values[i] ||
+ *v > penum->mask_color.values[i + 1]
+ )
+ return false;
return true;
}
@@ -218,7 +218,7 @@ mask_color12_matches(const frac *v, const gx_image_enum *penum,
/* The samples have been expanded into fracs. */
static int
image_render_frac(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
const gs_imager_state *pis = penum->pis;
gs_logical_operation_t lop = penum->log_op;
@@ -251,7 +251,7 @@ image_render_frac(gx_image_enum * penum, const byte * buffer, int data_x,
int code = 0, mcode = 0;
if (h == 0)
- return 0;
+ return 0;
pnext = penum->dda.pixel0;
xrun = xl = dda_current(pnext.x);
irun = fixed2int_var_rounded(xrun);
@@ -259,7 +259,7 @@ image_render_frac(gx_image_enum * penum, const byte * buffer, int data_x,
pdyx = dda_current(penum->dda.row.x) - penum->cur.x;
pdyy = dda_current(penum->dda.row.y) - penum->cur.y;
if_debug5('b', "[b]y=%d data_x=%d w=%d xt=%f yt=%f\n",
- penum->y, data_x, w, fixed2float(xl), fixed2float(ytf));
+ penum->y, data_x, w, fixed2float(xl), fixed2float(ytf));
memset(&run, 0, sizeof(run));
memset(&next, 0, sizeof(next));
/* Ensure that we don't get any false dev_color_eq hits. */
@@ -269,188 +269,187 @@ image_render_frac(gx_image_enum * penum, const byte * buffer, int data_x,
run.v[0] = ~psrc[0]; /* force remap */
while (psrc < bufend) {
- next.v[0] = psrc[0];
- switch (spp) {
- case 4: /* may be CMYK */
- next.v[1] = psrc[1];
- next.v[2] = psrc[2];
- next.v[3] = psrc[3];
- psrc += 4;
- if (COLOR_FRACS_4_EQ(next, run))
- goto inc;
- if (use_mask_color && mask_color12_matches(next.v, penum, 4)) {
- color_set_null(pdevc_next);
- goto f;
- }
- if (device_color) {
- (*map_cmyk) (next.v[0], next.v[1],
- next.v[2], next.v[3],
- pdevc_next, pis, dev,
- gs_color_select_source);
- goto f;
- }
- decode_frac(next.v[0], cc, 0);
- decode_frac(next.v[1], cc, 1);
- decode_frac(next.v[2], cc, 2);
- decode_frac(next.v[3], cc, 3);
- if_debug4('B', "[B]cc[0..3]=%g,%g,%g,%g\n",
- cc.paint.values[0], cc.paint.values[1],
- cc.paint.values[2], cc.paint.values[3]);
- if_debug1('B', "[B]cc[3]=%g\n",
- cc.paint.values[3]);
- break;
- case 3: /* may be RGB */
- next.v[1] = psrc[1];
- next.v[2] = psrc[2];
- psrc += 3;
- if (COLOR_FRACS_4_EQ(next, run))
- goto inc;
- if (use_mask_color && mask_color12_matches(next.v, penum, 3)) {
- color_set_null(pdevc_next);
- goto f;
- }
- if (device_color) {
- (*map_rgb) (next.v[0], next.v[1],
- next.v[2], pdevc_next, pis, dev,
- gs_color_select_source);
- goto f;
- }
- decode_frac(next.v[0], cc, 0);
- decode_frac(next.v[1], cc, 1);
- decode_frac(next.v[2], cc, 2);
- if_debug3('B', "[B]cc[0..2]=%g,%g,%g\n",
- cc.paint.values[0], cc.paint.values[1],
- cc.paint.values[2]);
- break;
- case 1: /* may be Gray */
- psrc++;
- if (next.v[0] == run.v[0])
- goto inc;
- if (use_mask_color && mask_color12_matches(next.v, penum, 1)) {
- color_set_null(pdevc_next);
- goto f;
- }
- if (device_color) {
- (*map_rgb) (next.v[0], next.v[0],
- next.v[0], pdevc_next, pis, dev,
- gs_color_select_source);
- goto f;
- }
- decode_frac(next.v[0], cc, 0);
- if_debug1('B', "[B]cc[0]=%g\n",
- cc.paint.values[0]);
- break;
- default: /* DeviceN */
- {
- int i;
-
- for (i = 1; i < spp; ++i)
- next.v[i] = psrc[i];
- psrc += spp;
- if (!memcmp(next.v, run.v, spp * sizeof(next.v[0])))
- goto inc;
- if (use_mask_color &&
- mask_color12_matches(next.v, penum, spp)
- ) {
- color_set_null(pdevc_next);
- goto f;
- }
- for (i = 0; i < spp; ++i)
- decode_frac(next.v[i], cc, i);
+ next.v[0] = psrc[0];
+ switch (spp) {
+ case 4: /* may be CMYK */
+ next.v[1] = psrc[1];
+ next.v[2] = psrc[2];
+ next.v[3] = psrc[3];
+ psrc += 4;
+ if (COLOR_FRACS_4_EQ(next, run))
+ goto inc;
+ if (use_mask_color && mask_color12_matches(next.v, penum, 4)) {
+ color_set_null(pdevc_next);
+ goto f;
+ }
+ if (device_color) {
+ (*map_cmyk) (next.v[0], next.v[1],
+ next.v[2], next.v[3],
+ pdevc_next, pis, dev,
+ gs_color_select_source);
+ goto f;
+ }
+ decode_frac(next.v[0], cc, 0);
+ decode_frac(next.v[1], cc, 1);
+ decode_frac(next.v[2], cc, 2);
+ decode_frac(next.v[3], cc, 3);
+ if_debug4('B', "[B]cc[0..3]=%g,%g,%g,%g\n",
+ cc.paint.values[0], cc.paint.values[1],
+ cc.paint.values[2], cc.paint.values[3]);
+ if_debug1('B', "[B]cc[3]=%g\n",
+ cc.paint.values[3]);
+ break;
+ case 3: /* may be RGB */
+ next.v[1] = psrc[1];
+ next.v[2] = psrc[2];
+ psrc += 3;
+ if (COLOR_FRACS_4_EQ(next, run))
+ goto inc;
+ if (use_mask_color && mask_color12_matches(next.v, penum, 3)) {
+ color_set_null(pdevc_next);
+ goto f;
+ }
+ if (device_color) {
+ (*map_rgb) (next.v[0], next.v[1],
+ next.v[2], pdevc_next, pis, dev,
+ gs_color_select_source);
+ goto f;
+ }
+ decode_frac(next.v[0], cc, 0);
+ decode_frac(next.v[1], cc, 1);
+ decode_frac(next.v[2], cc, 2);
+ if_debug3('B', "[B]cc[0..2]=%g,%g,%g\n",
+ cc.paint.values[0], cc.paint.values[1],
+ cc.paint.values[2]);
+ break;
+ case 1: /* may be Gray */
+ psrc++;
+ if (next.v[0] == run.v[0])
+ goto inc;
+ if (use_mask_color && mask_color12_matches(next.v, penum, 1)) {
+ color_set_null(pdevc_next);
+ goto f;
+ }
+ if (device_color) {
+ (*map_rgb) (next.v[0], next.v[0],
+ next.v[0], pdevc_next, pis, dev,
+ gs_color_select_source);
+ goto f;
+ }
+ decode_frac(next.v[0], cc, 0);
+ if_debug1('B', "[B]cc[0]=%g\n",
+ cc.paint.values[0]);
+ break;
+ default: /* DeviceN */
+ {
+ int i;
+
+ for (i = 1; i < spp; ++i)
+ next.v[i] = psrc[i];
+ psrc += spp;
+ if (!memcmp(next.v, run.v, spp * sizeof(next.v[0])))
+ goto inc;
+ if (use_mask_color &&
+ mask_color12_matches(next.v, penum, spp)
+ ) {
+ color_set_null(pdevc_next);
+ goto f;
+ }
+ for (i = 0; i < spp; ++i)
+ decode_frac(next.v[i], cc, i);
#ifdef DEBUG
- if (gs_debug_c('B')) {
- dprintf2("[B]cc[0..%d]=%g", spp - 1,
- cc.paint.values[0]);
- for (i = 1; i < spp; ++i)
- dprintf1(",%g", cc.paint.values[i]);
- dputs("\n");
- }
+ if (gs_debug_c('B')) {
+ dprintf2("[B]cc[0..%d]=%g", spp - 1,
+ cc.paint.values[0]);
+ for (i = 1; i < spp; ++i)
+ dprintf1(",%g", cc.paint.values[i]);
+ dputs("\n");
+ }
#endif
- }
- break;
- }
- mcode = remap_color(&cc, pcs, pdevc_next, pis, dev,
- gs_color_select_source);
- if (mcode < 0)
- goto fill;
+ }
+ break;
+ }
+ mcode = remap_color(&cc, pcs, pdevc_next, pis, dev,
+ gs_color_select_source);
+ if (mcode < 0)
+ goto fill;
f:
- if (sizeof(pdevc_next->colors.binary.color[0]) <= sizeof(ulong))
- if_debug7('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%lx,0x%lx,0x%lx\n",
- next.v[0], next.v[1], next.v[2], next.v[3],
- (ulong)pdevc_next->colors.binary.color[0],
- (ulong)pdevc_next->colors.binary.color[1],
- (ulong)pdevc_next->type);
- else
- if_debug9('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%08lx%08lx,0x%08lx%08lx,0x%lx\n",
- next.v[0], next.v[1], next.v[2], next.v[3],
- (ulong)(pdevc_next->colors.binary.color[0] >>
- 8 * (sizeof(pdevc_next->colors.binary.color[0]) - sizeof(ulong))),
- (ulong)pdevc_next->colors.binary.color[0],
- (ulong)(pdevc_next->colors.binary.color[1] >>
- 8 * (sizeof(pdevc_next->colors.binary.color[1]) - sizeof(ulong))),
- (ulong)pdevc_next->colors.binary.color[1],
- (ulong)pdevc_next->type);
+ if (sizeof(pdevc_next->colors.binary.color[0]) <= sizeof(ulong))
+ if_debug7('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%lx,0x%lx,0x%lx\n",
+ next.v[0], next.v[1], next.v[2], next.v[3],
+ (ulong)pdevc_next->colors.binary.color[0],
+ (ulong)pdevc_next->colors.binary.color[1],
+ (ulong)pdevc_next->type);
+ else
+ if_debug9('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%08lx%08lx,0x%08lx%08lx,0x%lx\n",
+ next.v[0], next.v[1], next.v[2], next.v[3],
+ (ulong)(pdevc_next->colors.binary.color[0] >>
+ 8 * (sizeof(pdevc_next->colors.binary.color[0]) - sizeof(ulong))),
+ (ulong)pdevc_next->colors.binary.color[0],
+ (ulong)(pdevc_next->colors.binary.color[1] >>
+ 8 * (sizeof(pdevc_next->colors.binary.color[1]) - sizeof(ulong))),
+ (ulong)pdevc_next->colors.binary.color[1],
+ (ulong)pdevc_next->type);
/* NB: sizeof gx_color_index is 4 or 8 bytes! */
-
- /* Even though the supplied colors don't match, */
- /* the device colors might. */
- if (!dev_color_eq(devc1, devc2)) {
- /* Fill the region between xrun/irun and xl */
- gx_device_color *ptemp;
+ /* Even though the supplied colors don't match, */
+ /* the device colors might. */
+ if (!dev_color_eq(devc1, devc2)) {
+ /* Fill the region between xrun/irun and xl */
+ gx_device_color *ptemp;
fill:
- if (posture != image_portrait) { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun,
- xl - xrun, ytf - yrun, pdyx, pdyy,
- pdevc, lop);
- } else { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xl)) - xi;
-
- if (wi < 0)
- xi += wi, wi = -wi;
- code = gx_fill_rectangle_device_rop(xi, yt,
- wi, iht, pdevc, dev, lop);
- vd_set_scale(0.01);
- vd_rect(int2fixed(xi), int2fixed(yt), int2fixed(xi + wi), int2fixed(yt + iht),
- 1, (int)pdevc->colors.pure);
- }
- if (code < 0)
- goto err;
- rsrc = psrc;
- if ((code = mcode) < 0)
- goto err;
- ptemp = pdevc;
- pdevc = pdevc_next;
- pdevc_next = ptemp;
- xrun = xl;
- yrun = ytf;
- }
- run = next;
+ if (posture != image_portrait) { /* Parallelogram */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun,
+ xl - xrun, ytf - yrun, pdyx, pdyy,
+ pdevc, lop);
+ } else { /* Rectangle */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xl)) - xi;
+
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ code = gx_fill_rectangle_device_rop(xi, yt,
+ wi, iht, pdevc, dev, lop);
+ vd_set_scale(0.01);
+ vd_rect(int2fixed(xi), int2fixed(yt), int2fixed(xi + wi), int2fixed(yt + iht),
+ 1, (int)pdevc->colors.pure);
+ }
+ if (code < 0)
+ goto err;
+ rsrc = psrc;
+ if ((code = mcode) < 0)
+ goto err;
+ ptemp = pdevc;
+ pdevc = pdevc_next;
+ pdevc_next = ptemp;
+ xrun = xl;
+ yrun = ytf;
+ }
+ run = next;
inc:
- xl = dda_next(pnext.x);
- ytf = dda_next(pnext.y);
+ xl = dda_next(pnext.x);
+ ytf = dda_next(pnext.y);
}
/* Fill the final run. */
if (posture != image_portrait) {
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xl - xrun, ytf - yrun, pdyx, pdyy, pdevc, lop);
- /*vd_quad(xrun, yrun, xl, ytf, xl + pdyx, ytf + pdyy, xrun + pdyx, yrun + pdyy,
- 1, (int)pdevc->colors.pure); */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xl - xrun, ytf - yrun, pdyx, pdyy, pdevc, lop);
+ /*vd_quad(xrun, yrun, xl, ytf, xl + pdyx, ytf + pdyy, xrun + pdyx, yrun + pdyy,
+ 1, (int)pdevc->colors.pure); */
} else {
- /* Same code as above near 'fill:' : */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xl)) - xi;
-
- if (wi < 0)
- xi += wi, wi = -wi;
- code = gx_fill_rectangle_device_rop(xi, yt,
- wi, iht, pdevc, dev, lop);
- vd_set_scale(0.01);
- vd_rect(int2fixed(xi), int2fixed(yt), int2fixed(xi + wi), int2fixed(yt + iht),
- 1, (int)pdevc->colors.pure);
+ /* Same code as above near 'fill:' : */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xl)) - xi;
+
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ code = gx_fill_rectangle_device_rop(xi, yt,
+ wi, iht, pdevc, dev, lop);
+ vd_set_scale(0.01);
+ vd_rect(int2fixed(xi), int2fixed(yt), int2fixed(xi + wi), int2fixed(yt + iht),
+ 1, (int)pdevc->colors.pure);
}
return (code < 0 ? code : 1);
@@ -467,12 +466,11 @@ rescale_input_color(gs_range range, float input)
return((input-range.rmin)/(range.rmax-range.rmin));
}
-
-/* This one includes an extra adjustment for the CIE PS color space
+/* This one includes an extra adjustment for the CIE PS color space
non standard range */
-static void
-decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc,
- int spp, unsigned short *pdes,
+static void
+decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc,
+ int spp, unsigned short *pdes,
const unsigned short *bufend, gs_range range_array[])
{
unsigned short *curr_pos = pdes;
@@ -485,7 +483,7 @@ decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc,
case sd_none:
*curr_pos = *psrc;
break;
- case sd_lookup:
+ case sd_lookup:
temp = penum->map[k].decode_lookup[(*psrc) >> 4]*65535.0;
temp = rescale_input_color(range_array[k], temp);
temp = temp*65535;
@@ -494,7 +492,7 @@ decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc,
*curr_pos = (unsigned short) temp;
break;
case sd_compute:
- temp = penum->map[k].decode_base +
+ temp = penum->map[k].decode_base +
(*psrc) * penum->map[k].decode_factor;
temp = rescale_input_color(range_array[k], temp);
temp = temp*65535;
@@ -510,7 +508,7 @@ decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc,
}
}
-static void
+static void
decode_row16(const gx_image_enum *penum, const unsigned short *psrc, int spp,
unsigned short *pdes,const unsigned short *bufend)
{
@@ -524,14 +522,14 @@ decode_row16(const gx_image_enum *penum, const unsigned short *psrc, int spp,
case sd_none:
*curr_pos = *psrc;
break;
- case sd_lookup:
+ case sd_lookup:
temp = penum->map[k].decode_lookup[(*psrc) >> 4]*65535;
if (temp > 65535) temp = 65535;
if (temp < 0 ) temp = 0;
*curr_pos = (unsigned short) temp;
break;
case sd_compute:
- temp = penum->map[k].decode_base +
+ temp = penum->map[k].decode_base +
(*psrc) * penum->map[k].decode_factor;
temp *= 65535;
if (temp > 65535) temp = 65535;
@@ -546,11 +544,11 @@ decode_row16(const gx_image_enum *penum, const unsigned short *psrc, int spp,
}
}
-/* Render an image with more than 8 bits per sample where we keep the data
+/* Render an image with more than 8 bits per sample where we keep the data
in 16 bit form and hand directly to the CMM */
static int
image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
const gs_imager_state *pis = penum->pis;
gs_logical_operation_t lop = penum->log_op;
@@ -588,7 +586,7 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
bool has_transfer = penum->icc_setup.has_transfer;
if (h == 0)
- return 0;
+ return 0;
if (penum->icc_link == NULL) {
return gs_rethrow(-1, "ICC Link not created during image render icc16");
@@ -606,8 +604,8 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
pdevc->type = gx_dc_type_none;
pdevc_next->type = gx_dc_type_none;
if (h == 0)
- return 0;
- /* If the link is the identity, then we don't need to do any color
+ return 0;
+ /* If the link is the identity, then we don't need to do any color
conversions except for potentially a decode. */
if (penum->icc_link->is_identity && !need_decode) {
/* Fastest case. No decode or CM needed */
@@ -617,14 +615,14 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
psrc_cm_start = NULL;
} else {
spp_cm = dev->device_icc_profile->num_comps;
- psrc_cm = (unsigned short*) gs_alloc_bytes(pis->memory,
- sizeof(unsigned short) * w * spp_cm/spp,
+ psrc_cm = (unsigned short*) gs_alloc_bytes(pis->memory,
+ sizeof(unsigned short) * w * spp_cm/spp,
"image_render_icc16");
psrc_cm_start = psrc_cm;
bufend = psrc_cm + w * spp_cm/spp;
if (penum->icc_link->is_identity) {
/* decode only. no CM. This is slow but does not happen that often */
- decode_row16(penum, psrc, spp, psrc_cm, bufend);
+ decode_row16(penum, psrc, spp, psrc_cm, bufend);
} else {
/* Set up the buffer descriptors. */
num_pixels = w/spp;
@@ -634,33 +632,33 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
gsicc_init_buffer(&output_buff_desc, spp_cm, 2,
false, false, false, 0, num_pixels * spp_cm * 2,
1, num_pixels);
- /* For now, just blast it all through the link. If we had a significant reduction
- we will want to repack the data first and then do this. That will be
+ /* For now, just blast it all through the link. If we had a significant reduction
+ we will want to repack the data first and then do this. That will be
an optimization shortly. For now just allocate a new output
buffer. We can reuse the old one if the number of channels in the output is
less than or equal to the new one. */
if (need_decode) {
/* Need decode and CM. This is slow but does not happen that often */
- psrc_decode = (unsigned short*) gs_alloc_bytes(pis->memory,
- sizeof(unsigned short) * w * spp_cm/spp,
+ psrc_decode = (unsigned short*) gs_alloc_bytes(pis->memory,
+ sizeof(unsigned short) * w * spp_cm/spp,
"image_render_icc16");
if (penum->cie_range == NULL) {
- decode_row16(penum, psrc, spp, psrc_decode,
+ decode_row16(penum, psrc, spp, psrc_decode,
(const unsigned short*) (psrc_decode+w));
} else {
/* Decode needs to include adjustment for CIE range */
- decode_row_cie16(penum, psrc, spp, psrc_decode,
- (const unsigned short*) (psrc_decode+w),
+ decode_row_cie16(penum, psrc, spp, psrc_decode,
+ (const unsigned short*) (psrc_decode+w),
penum->cie_range);
}
- gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
- &output_buff_desc, (void*) psrc_decode,
+ gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
+ &output_buff_desc, (void*) psrc_decode,
(void*) psrc_cm);
gs_free_object(pis->memory, (byte *)psrc_decode, "image_render_color_icc");
} else {
/* CM only. No decode */
- gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
- &output_buff_desc, (void*) psrc,
+ gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
+ &output_buff_desc, (void*) psrc,
(void*) psrc_cm);
}
}
@@ -672,24 +670,24 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
pdyx = dda_current(penum->dda.row.x) - penum->cur.x;
pdyy = dda_current(penum->dda.row.y) - penum->cur.y;
switch (posture) {
- case image_portrait:
- vci = penum->yci, vdi = penum->hci;
- irun = fixed2int_var_rounded(xrun);
- break;
- case image_landscape:
- default: /* we don't handle skew -- treat as landscape */
- vci = penum->xci, vdi = penum->wci;
- irun = fixed2int_var_rounded(yrun);
- break;
+ case image_portrait:
+ vci = penum->yci, vdi = penum->hci;
+ irun = fixed2int_var_rounded(xrun);
+ break;
+ case image_landscape:
+ default: /* we don't handle skew -- treat as landscape */
+ vci = penum->xci, vdi = penum->wci;
+ irun = fixed2int_var_rounded(yrun);
+ break;
}
if_debug5('b', "[b]y=%d data_x=%d w=%d xt=%f yt=%f\n",
- penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
+ penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
memset(&run, 0, sizeof(run));
memset(&next, 0, sizeof(next));
run.v[0] = ~psrc_cm[0]; /* Force intial setting */
while (psrc_cm < bufend) {
- dda_next(pnext.x);
- dda_next(pnext.y);
+ dda_next(pnext.x);
+ dda_next(pnext.y);
if ( penum->alpha ) {
/* If the pixels are different, then take care of the alpha now */
/* will need to adjust spp below.... */
@@ -699,16 +697,16 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
}
/* Compare to previous. If same then move on */
if (posture != image_skewed && next.all[0] == run.all[0])
- goto inc;
+ goto inc;
/* This needs to be sped up */
for ( k = 0; k < spp_cm; k++ ) {
conc[k] = next.v[k];
- }
+ }
/* Now we can do an encoding directly or we have to apply transfer
and or halftoning */
if (must_halftone || has_transfer) {
/* We need to do the tranfer function and/or the halftoning */
- cmap_transfer_halftone(&(conc[0]), pdevc_next, pis, dev,
+ cmap_transfer_halftone(&(conc[0]), pdevc_next, pis, dev,
has_transfer, must_halftone, gs_color_select_source);
} else {
/* encode as a color index. avoid all the cv to frac to cv
@@ -719,49 +717,49 @@ image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x,
color_set_pure(pdevc_next, color);
}
/* Fill the region between */
- /* xrun/irun and xprev */
+ /* xrun/irun and xprev */
if (posture != image_portrait) { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
- xrun = xprev;
- yrun = yprev;
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
+ xrun = xprev;
+ yrun = yprev;
} else { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
-
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
}
if (code < 0)
- goto err;
- rsrc = psrc;
- if ((code = mcode) < 0) goto err;
+ goto err;
+ rsrc = psrc;
+ if ((code = mcode) < 0) goto err;
/* Swap around the colors due to a change */
ptemp = pdevc;
pdevc = pdevc_next;
pdevc_next = ptemp;
- run = next;
+ run = next;
inc: xprev = dda_current(pnext.x);
- yprev = dda_current(pnext.y); /* harmless if no skew */
+ yprev = dda_current(pnext.y); /* harmless if no skew */
}
/* Fill the final run. */
if (posture != image_portrait) {
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
} else {
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
-
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
}
/* Free cm buffer, if it was used */
if (psrc_cm_start != NULL) {
diff --git a/gs/base/gxi16bit.c b/gs/base/gxi16bit.c
index cc69386bb..2f7308e6b 100644
--- a/gs/base/gxi16bit.c
+++ b/gs/base/gxi16bit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,8 +35,8 @@
static const byte *
sample_unpack_16(byte * bptr, int *pdata_x, const byte * data,
- int data_x, uint dsize, const sample_map *ignore_smap, int spread,
- int ignore_num_components_per_plane)
+ int data_x, uint dsize, const sample_map *ignore_smap, int spread,
+ int ignore_num_components_per_plane)
{
/* Assuming an identity map for all components. */
register frac *bufp = (frac *) bptr;
@@ -47,11 +47,11 @@ sample_unpack_16(byte * bptr, int *pdata_x, const byte * data,
int left = dsize - dskip;
while (left > 2) {
- sample = ((uint) psrc[0] << 8) + psrc[1];
- *bufp = (frac)((frac_1 * (sample + 1)) >> 16);
- inc_bufp(bufp, spread);
- psrc += 2;
- left -= 2;
+ sample = ((uint) psrc[0] << 8) + psrc[1];
+ *bufp = (frac)((frac_1 * (sample + 1)) >> 16);
+ inc_bufp(bufp, spread);
+ psrc += 2;
+ left -= 2;
}
*pdata_x = 0;
return bptr;
@@ -59,8 +59,8 @@ sample_unpack_16(byte * bptr, int *pdata_x, const byte * data,
static const byte *
sample_unpackicc_16(byte * bptr, int *pdata_x, const byte * data,
- int data_x, uint dsize, const sample_map *ignore_smap, int spread,
- int ignore_num_components_per_plane)
+ int data_x, uint dsize, const sample_map *ignore_smap, int spread,
+ int ignore_num_components_per_plane)
{
/* Assuming an identity map for all components. */
register unsigned short *bufp = (unsigned short *) bptr;
@@ -71,11 +71,11 @@ sample_unpackicc_16(byte * bptr, int *pdata_x, const byte * data,
int left = dsize - dskip;
while (left >= 2) {
- sample = ((uint) psrc[0] << 8) + psrc[1];
- *bufp = (unsigned short)(sample);
- inc_bufp16(bufp, spread);
- psrc += 2;
- left -= 2;
+ sample = ((uint) psrc[0] << 8) + psrc[1];
+ *bufp = (unsigned short)(sample);
+ inc_bufp16(bufp, spread);
+ psrc += 2;
+ left -= 2;
}
*pdata_x = 0;
return bptr;
diff --git a/gs/base/gxiclass.h b/gs/base/gxiclass.h
index 01e5a8046..eb3605a16 100644
--- a/gs/base/gxiclass.h
+++ b/gs/base/gxiclass.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,7 +44,7 @@ typedef struct gx_device_s gx_device;
*/
#define irender_proc(proc)\
int proc(gx_image_enum *penum, const byte *buffer, int data_x,\
- uint w, int h, gx_device *dev)
+ uint w, int h, gx_device *dev)
typedef irender_proc((*irender_proc_t));
/*
diff --git a/gs/base/gxicolor.c b/gs/base/gxicolor.c
index 71801b406..054df559b 100644
--- a/gs/base/gxicolor.c
+++ b/gs/base/gxicolor.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -68,39 +68,39 @@ gs_image_class_4_color(gx_image_enum * penum)
bool is_planar_dev = false;
if (penum->use_mask_color) {
- /*
- * Scale the mask colors to match the scaling of each sample to
- * a full byte, and set up the quick-filter parameters.
- */
- int i;
- color_samples mask, test;
- bool exact = penum->spp <= BYTES_PER_BITS32;
+ /*
+ * Scale the mask colors to match the scaling of each sample to
+ * a full byte, and set up the quick-filter parameters.
+ */
+ int i;
+ color_samples mask, test;
+ bool exact = penum->spp <= BYTES_PER_BITS32;
- memset(&mask, 0, sizeof(mask));
- memset(&test, 0, sizeof(test));
- for (i = 0; i < penum->spp; ++i) {
- byte v0, v1;
- byte match = 0xff;
+ memset(&mask, 0, sizeof(mask));
+ memset(&test, 0, sizeof(test));
+ for (i = 0; i < penum->spp; ++i) {
+ byte v0, v1;
+ byte match = 0xff;
- gx_image_scale_mask_colors(penum, i);
- v0 = (byte)penum->mask_color.values[2 * i];
- v1 = (byte)penum->mask_color.values[2 * i + 1];
- while ((v0 & match) != (v1 & match))
- match <<= 1;
- mask.v[i] = match;
- test.v[i] = v0 & match;
- exact &= (v0 == match && (v1 | match) == 0xff);
- }
- penum->mask_color.mask = mask.all[0];
- penum->mask_color.test = test.all[0];
- penum->mask_color.exact = exact;
+ gx_image_scale_mask_colors(penum, i);
+ v0 = (byte)penum->mask_color.values[2 * i];
+ v1 = (byte)penum->mask_color.values[2 * i + 1];
+ while ((v0 & match) != (v1 & match))
+ match <<= 1;
+ mask.v[i] = match;
+ test.v[i] = v0 & match;
+ exact &= (v0 == match && (v1 | match) == 0xff);
+ }
+ penum->mask_color.mask = mask.all[0];
+ penum->mask_color.test = test.all[0];
+ penum->mask_color.exact = exact;
} else {
- penum->mask_color.mask = 0;
- penum->mask_color.test = ~0;
+ penum->mask_color.mask = 0;
+ penum->mask_color.test = ~0;
}
/* If the device has some unique color mapping procs due to its color space,
then we will need to use those and go through pixel by pixel instead
- of blasting through buffers. This is true for example with many of
+ of blasting through buffers. This is true for example with many of
the color spaces for CUPs */
std_cmap_procs = gx_device_uses_std_cmap_procs(penum->dev);
if ( (gs_color_space_get_index(penum->pcs) == gs_color_space_index_DeviceN &&
@@ -137,14 +137,14 @@ gs_image_class_4_color(gx_image_enum * penum)
penum->dev->device_icc_profile->num_comps);
if (penum->icc_setup.is_lab) penum->icc_setup.need_decode = false;
if (penum->icc_link == NULL) {
- penum->icc_link = gsicc_get_link(penum->pis, penum->dev, pcs, NULL,
+ penum->icc_link = gsicc_get_link(penum->pis, penum->dev, pcs, NULL,
&rendering_params, penum->memory, false);
}
/* PS CIE color spaces may have addition decoding that needs to
be performed to ensure that the range of 0 to 1 is provided
to the CMM since ICC profiles are restricted to that range
but the PS color spaces are not. */
- if (gs_color_space_is_PSCIE(penum->pcs) &&
+ if (gs_color_space_is_PSCIE(penum->pcs) &&
penum->pcs->icc_equivalent != NULL) {
/* We have a PS CIE space. Check the range */
if ( !check_cie_range(penum->pcs) ) {
@@ -160,9 +160,9 @@ gs_image_class_4_color(gx_image_enum * penum)
/* If num components is 1 or if we are going to CMYK planar device
then we will may use the thresholding if it is a halftone
device*/
- is_planar_dev = !dev_proc(penum->dev, dev_spec_op)(penum->dev,
+ is_planar_dev = !dev_proc(penum->dev, dev_spec_op)(penum->dev,
gxdso_is_native_planar, NULL, 0);
- if ((penum->dev->color_info.num_components == 1 || is_planar_dev) &&
+ if ((penum->dev->color_info.num_components == 1 || is_planar_dev) &&
penum->bps == 8 ) {
code = gxht_thresh_image_init(penum);
if (code == 0) {
@@ -179,15 +179,15 @@ gs_image_class_4_color(gx_image_enum * penum)
/* Test whether a color is transparent. */
static bool
mask_color_matches(const byte *v, const gx_image_enum *penum,
- int num_components)
+ int num_components)
{
int i;
for (i = num_components * 2, v += num_components - 1; (i -= 2) >= 0; --v)
- if (*v < penum->mask_color.values[i] ||
- *v > penum->mask_color.values[i + 1]
- )
- return false;
+ if (*v < penum->mask_color.values[i] ||
+ *v > penum->mask_color.values[i + 1]
+ )
+ return false;
return true;
}
@@ -197,10 +197,10 @@ rescale_input_color(gs_range range, float input)
return((input-range.rmin)/(range.rmax-range.rmin));
}
-/* This one includes an extra adjustment for the CIE PS color space
+/* This one includes an extra adjustment for the CIE PS color space
non standard range */
-static void
-decode_row_cie(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
+static void
+decode_row_cie(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
byte *bufend, gs_range range_array[])
{
byte *curr_pos = pdes;
@@ -213,7 +213,7 @@ decode_row_cie(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes
case sd_none:
*curr_pos = *psrc;
break;
- case sd_lookup:
+ case sd_lookup:
temp = penum->map[k].decode_lookup[(*psrc) >> 4]*255.0;
temp = rescale_input_color(range_array[k], temp);
temp = temp*255;
@@ -222,7 +222,7 @@ decode_row_cie(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes
*curr_pos = (unsigned char) temp;
break;
case sd_compute:
- temp = penum->map[k].decode_base +
+ temp = penum->map[k].decode_base +
(*psrc) * penum->map[k].decode_factor;
temp = rescale_input_color(range_array[k], temp);
temp = temp*255;
@@ -238,8 +238,8 @@ decode_row_cie(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes
}
}
-static void
-decode_row(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
+static void
+decode_row(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
byte *bufend)
{
byte *curr_pos = pdes;
@@ -252,14 +252,14 @@ decode_row(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
case sd_none:
*curr_pos = *psrc;
break;
- case sd_lookup:
+ case sd_lookup:
temp = penum->map[k].decode_lookup[(*psrc) >> 4]*255.0;
if (temp > 255) temp = 255;
if (temp < 0 ) temp = 0;
*curr_pos = (unsigned char) temp;
break;
case sd_compute:
- temp = penum->map[k].decode_base +
+ temp = penum->map[k].decode_base +
(*psrc) * penum->map[k].decode_factor;
temp *= 255;
if (temp > 255) temp = 255;
@@ -277,8 +277,8 @@ decode_row(const gx_image_enum *penum, const byte *psrc, int spp, byte *pdes,
/* Common code shared amongst the thresholding and non thresholding color image
renderers */
static int
-image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
- gx_device *dev, int *spp_cm_out, byte **psrc_cm,
+image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
+ gx_device *dev, int *spp_cm_out, byte **psrc_cm,
byte **psrc_cm_start, byte **psrc_decode, byte **bufend,
bool planar_out)
{
@@ -291,7 +291,7 @@ image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
int num_pixels, spp_cm;
int spp = penum->spp;
bool force_planar = false;
-
+
if (penum->icc_link == NULL) {
return gs_rethrow(-1, "ICC Link not created during image render color");
}
@@ -300,12 +300,12 @@ image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
} else {
pcs = penum->pcs;
}
- /* If the link is the identity, then we don't need to do any color
+ /* If the link is the identity, then we don't need to do any color
conversions except for potentially a decode. Planar out is a special
case. For now we let the CMM do the reorg into planar. We will want
to optimize this to do something special when we have the identity
transform for CM and going out to a planar CMYK device */
- if (dev->device_icc_profile->num_comps != 1 && planar_out == true) {
+ if (dev->device_icc_profile->num_comps != 1 && planar_out == true) {
force_planar = true;
}
if (penum->icc_link->is_identity && !need_decode && !force_planar) {
@@ -316,13 +316,13 @@ image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
*psrc_cm_start = NULL;
} else {
spp_cm = dev->device_icc_profile->num_comps;
- *psrc_cm = gs_alloc_bytes(pis->memory, w * spp_cm/spp,
+ *psrc_cm = gs_alloc_bytes(pis->memory, w * spp_cm/spp,
"image_render_color_icc");
*psrc_cm_start = *psrc_cm;
*bufend = *psrc_cm + w * spp_cm/spp;
if (penum->icc_link->is_identity && !force_planar) {
/* decode only. no CM. This is slow but does not happen that often */
- decode_row(penum, psrc, spp, *psrc_cm, *bufend);
+ decode_row(penum, psrc, spp, *psrc_cm, *bufend);
} else {
/* Set up the buffer descriptors. planar out always ends up here */
num_pixels = w/spp;
@@ -338,31 +338,31 @@ image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
false, false, true, w/spp, w/spp,
1, num_pixels);
}
- /* For now, just blast it all through the link. If we had a significant reduction
- we will want to repack the data first and then do this. That will be
+ /* For now, just blast it all through the link. If we had a significant reduction
+ we will want to repack the data first and then do this. That will be
an optimization shortly. For now just allocate a new output
buffer. We can reuse the old one if the number of channels in the output is
less than or equal to the new one. */
if (need_decode) {
/* Need decode and CM. This is slow but does not happen that often */
- *psrc_decode = gs_alloc_bytes(pis->memory, w,
+ *psrc_decode = gs_alloc_bytes(pis->memory, w,
"image_render_color_icc");
if (penum->cie_range == NULL) {
decode_row(penum, psrc, spp, *psrc_decode, (*psrc_decode)+w);
} else {
/* Decode needs to include adjustment for CIE range */
- decode_row_cie(penum, psrc, spp, *psrc_decode,
+ decode_row_cie(penum, psrc, spp, *psrc_decode,
(*psrc_decode)+w, penum->cie_range);
}
- gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
- &output_buff_desc, (void*) *psrc_decode,
+ gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
+ &output_buff_desc, (void*) *psrc_decode,
(void*) *psrc_cm);
- gs_free_object(pis->memory, (byte *) *psrc_decode,
+ gs_free_object(pis->memory, (byte *) *psrc_decode,
"image_render_color_icc");
} else {
/* CM only. No decode */
- gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
- &output_buff_desc, (void*) psrc,
+ gscms_transform_color_buffer(penum->icc_link, &input_buff_desc,
+ &output_buff_desc, (void*) psrc,
(void*) *psrc_cm);
}
}
@@ -373,7 +373,7 @@ image_color_icc_prep(gx_image_enum *penum_orig, const byte *psrc, uint w,
static int
image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
gx_image_enum *penum = penum_orig; /* const within proc */
image_posture posture = penum->posture;
@@ -406,7 +406,7 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
if (h != 0) {
/* Get the buffer into the device color space */
- code = image_color_icc_prep(penum, psrc, w, dev, &spp_cm, &psrc_cm,
+ code = image_color_icc_prep(penum, psrc, w, dev, &spp_cm, &psrc_cm,
&psrc_cm_start, &psrc_decode, &bufend,
true);
} else {
@@ -420,7 +420,7 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
flush_buff = true;
}
}
- /* Data is now in the proper destination color space. Now we want
+ /* Data is now in the proper destination color space. Now we want
to go ahead and get the data into the proper spatial setting and then
threshold. First get the data spatially sampled correctly */
src_size = (penum->rect.w - 1.0);
@@ -433,8 +433,8 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
vdi = penum->hci;
contone_stride = penum->line_size;
for (k = 0; k < spp_out; k ++) {
- offset_contone[k] = (- (((long)(penum->line)) +
- contone_stride * k +
+ offset_contone[k] = (- (((long)(penum->line)) +
+ contone_stride * k +
penum->ht_offset_bits)) & 15;
offset_threshold[k] = (- (((long)(penum->thresh_buffer)) +
contone_stride * vdi * k +
@@ -462,7 +462,7 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
vdi = penum->wci;
contone_stride = penum->line_size;
for (k = 0; k < spp_out; k ++) {
- offset_contone[k] = (- ((long)(penum->line) +
+ offset_contone[k] = (- ((long)(penum->line) +
contone_stride * k)) & 15;
offset_threshold[k] = (-((long)(penum->thresh_buffer) +
contone_stride * vdi * k)) & 15;
@@ -514,7 +514,7 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
devc_contone[k] = penum->line + offset_contone[k] * k;
psrc_plane[k] = psrc_cm + psrc_planestride * k;
}
- switch (spp_out)
+ switch (spp_out)
{
case 1:
devc_contone_gray = devc_contone[0];
@@ -525,13 +525,13 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
memcpy(devc_contone_gray, psrc_cm, data_length);
} else if (scale_factor == fixed_half) {
psrc_temp = psrc_cm;
- for (k = 0; k < data_length; k+=2,
+ for (k = 0; k < data_length; k+=2,
devc_contone_gray+=2, psrc_temp++) {
- *devc_contone_gray =
+ *devc_contone_gray =
*(devc_contone_gray+1) = *psrc_temp;
}
} else {
- for (k = 0; k < data_length; k++,
+ for (k = 0; k < data_length; k++,
devc_contone_gray++) {
*devc_contone_gray = psrc_cm[dda_ht.state.Q];
dda_next(dda_ht);
@@ -571,14 +571,14 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
for (k = 0; k < data_length; k+=2) {
offset = fixed2int_rounded(scale_factor * k);
devc_contone_gray[position] =
- devc_contone_gray[position + 16] =
+ devc_contone_gray[position + 16] =
psrc_cm[offset];
position += 32;
}
} else {
/* use dda */
for (k = 0; k < data_length; k++) {
- devc_contone_gray[position] =
+ devc_contone_gray[position] =
psrc_cm[dda_ht.state.Q];
position += 16;
dda_next(dda_ht);
@@ -608,13 +608,13 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
memcpy(devc_contone[3], psrc_plane[3], data_length);
} else if (scale_factor == fixed_half) {
for (k = 0; k < data_length; k+=2) {
- *(devc_contone[0]) = *(devc_contone[0]+1) =
+ *(devc_contone[0]) = *(devc_contone[0]+1) =
*psrc_plane[0]++;
- *(devc_contone[1]) = *(devc_contone[1]+1) =
+ *(devc_contone[1]) = *(devc_contone[1]+1) =
*psrc_plane[1]++;
- *(devc_contone[2]) = *(devc_contone[2]+1) =
+ *(devc_contone[2]) = *(devc_contone[2]+1) =
*psrc_plane[2]++;
- *(devc_contone[3]) = *(devc_contone[3]+1) =
+ *(devc_contone[3]) = *(devc_contone[3]+1) =
*psrc_plane[3]++;
devc_contone[0] += 2;
devc_contone[1] += 2;
@@ -623,13 +623,13 @@ image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int dat
}
} else {
for (k = 0; k < data_length; k++) {
- *(devc_contone[0])++ =
+ *(devc_contone[0])++ =
(psrc_plane[0])[dda_ht.state.Q];
- *(devc_contone[1])++ =
+ *(devc_contone[1])++ =
(psrc_plane[1])[dda_ht.state.Q];
- *(devc_contone[2])++ =
+ *(devc_contone[2])++ =
(psrc_plane[2])[dda_ht.state.Q];
- *(devc_contone[3])++ =
+ *(devc_contone[3])++ =
(psrc_plane[3])[dda_ht.state.Q];
dda_next(dda_ht);
}
@@ -711,7 +711,7 @@ flush:
contone_align = penum->line + offset_contone[k] * k;
thresh_align = penum->thresh_buffer + offset_threshold[k] * k;
code = gxht_thresh_plane(penum, d_order, xrun, dest_width, dest_height,
- thresh_align, contone_align, contone_stride, dev);
+ thresh_align, contone_align, contone_stride, dev);
}
return code;
}
@@ -719,7 +719,7 @@ flush:
/* Render a color image with 8 or fewer bits per sample using ICC profile. */
static int
image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
const gx_image_enum *const penum = penum_orig; /* const within proc */
const gs_imager_state *pis = penum->pis;
@@ -759,8 +759,8 @@ image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x
pdevc->type = gx_dc_type_none;
pdevc_next->type = gx_dc_type_none;
if (h == 0)
- return 0;
- code = image_color_icc_prep(penum_orig, psrc, w, dev, &spp_cm, &psrc_cm,
+ return 0;
+ code = image_color_icc_prep(penum_orig, psrc, w, dev, &spp_cm, &psrc_cm,
&psrc_cm_start, &psrc_decode, &bufend, false);
if (code < 0) return code;
/* Needed for device N */
@@ -771,24 +771,24 @@ image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x
pdyx = dda_current(penum->dda.row.x) - penum->cur.x;
pdyy = dda_current(penum->dda.row.y) - penum->cur.y;
switch (posture) {
- case image_portrait:
- vci = penum->yci, vdi = penum->hci;
- irun = fixed2int_var_rounded(xrun);
- break;
- case image_landscape:
- default: /* we don't handle skew -- treat as landscape */
- vci = penum->xci, vdi = penum->wci;
- irun = fixed2int_var_rounded(yrun);
- break;
+ case image_portrait:
+ vci = penum->yci, vdi = penum->hci;
+ irun = fixed2int_var_rounded(xrun);
+ break;
+ case image_landscape:
+ default: /* we don't handle skew -- treat as landscape */
+ vci = penum->xci, vdi = penum->wci;
+ irun = fixed2int_var_rounded(yrun);
+ break;
}
if_debug5('b', "[b]y=%d data_x=%d w=%d xt=%f yt=%f\n",
- penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
+ penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
memset(&run, 0, sizeof(run));
memset(&next, 0, sizeof(next));
run.v[0] = ~psrc_cm[0]; /* Force intial setting */
while (psrc_cm < bufend) {
- dda_next(pnext.x);
- dda_next(pnext.y);
+ dda_next(pnext.x);
+ dda_next(pnext.y);
if ( penum->alpha ) {
/* If the pixels are different, then take care of the alpha now */
/* will need to adjust spp below.... */
@@ -798,7 +798,7 @@ image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x
}
/* Compare to previous. If same then move on */
if (posture != image_skewed && next.all[0] == run.all[0])
- goto inc;
+ goto inc;
/* This needs to be sped up */
for ( k = 0; k < spp_cm; k++ ) {
conc[k] = gx_color_value_from_byte(next.v[k]);
@@ -807,7 +807,7 @@ image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x
and or halftoning */
if (must_halftone || has_transfer) {
/* We need to do the tranfer function and/or the halftoning */
- cmap_transfer_halftone(&(conc[0]), pdevc_next, pis, dev,
+ cmap_transfer_halftone(&(conc[0]), pdevc_next, pis, dev,
has_transfer, must_halftone, gs_color_select_source);
} else {
/* encode as a color index. avoid all the cv to frac to cv
@@ -818,102 +818,102 @@ image_render_color_icc(gx_image_enum *penum_orig, const byte *buffer, int data_x
color_set_pure(pdevc_next, color);
}
/* Fill the region between */
- /* xrun/irun and xprev */
- /*
- * Note; This section is nearly a copy of a simlar section below
+ /* xrun/irun and xprev */
+ /*
+ * Note; This section is nearly a copy of a simlar section below
* for processing the last image pixel in the loop. This would have been
* made into a subroutine except for complications about the number of
* variables that would have been needed to be passed to the routine.
- */
- switch (posture) {
- case image_portrait:
- { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+ */
+ switch (posture) {
+ case image_portrait:
+ { /* Rectangle */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
- }
- break;
- case image_landscape:
- { /* 90 degree rotated rectangle */
- int yi = irun;
- int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
+ }
+ break;
+ case image_landscape:
+ { /* 90 degree rotated rectangle */
+ int yi = irun;
+ int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
- if (hi < 0)
- yi += hi, hi = -hi;
- if (hi > 0)
- code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
- pdevc, dev, lop);
- }
- break;
- default:
- { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
- xrun = xprev;
- yrun = yprev;
- }
- }
- if (code < 0)
- goto err;
- rsrc = psrc;
- if ((code = mcode) < 0) goto err;
+ if (hi < 0)
+ yi += hi, hi = -hi;
+ if (hi > 0)
+ code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
+ pdevc, dev, lop);
+ }
+ break;
+ default:
+ { /* Parallelogram */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
+ xrun = xprev;
+ yrun = yprev;
+ }
+ }
+ if (code < 0)
+ goto err;
+ rsrc = psrc;
+ if ((code = mcode) < 0) goto err;
/* Swap around the colors due to a change */
ptemp = pdevc;
pdevc = pdevc_next;
pdevc_next = ptemp;
- run = next;
+ run = next;
inc: xprev = dda_current(pnext.x);
- yprev = dda_current(pnext.y); /* harmless if no skew */
+ yprev = dda_current(pnext.y); /* harmless if no skew */
}
/* Fill the last run. */
- /*
+ /*
* Note; This section is nearly a copy of a simlar section above
* for processing an image pixel in the loop. This would have been
* made into a subroutine except for complications about the number
* variables that would have been needed to be passed to the routine.
- */
+ */
switch (posture) {
- case image_portrait:
- { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+ case image_portrait:
+ { /* Rectangle */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
- }
- break;
- case image_landscape:
- { /* 90 degree rotated rectangle */
- int yi = irun;
- int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
+ }
+ break;
+ case image_landscape:
+ { /* 90 degree rotated rectangle */
+ int yi = irun;
+ int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
- if (hi < 0)
- yi += hi, hi = -hi;
- if (hi > 0)
- code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
- pdevc, dev, lop);
- }
- break;
- default:
- { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
- }
- }
+ if (hi < 0)
+ yi += hi, hi = -hi;
+ if (hi > 0)
+ code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
+ pdevc, dev, lop);
+ }
+ break;
+ default:
+ { /* Parallelogram */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
+ }
+ }
/* Free cm buffer, if it was used */
if (psrc_cm_start != NULL) {
gs_free_object(pis->memory, (byte *)psrc_cm_start, "image_render_color_icc");
- }
+ }
return (code < 0 ? code : 1);
/* Save position if error, in case we resume. */
err:
@@ -923,12 +923,12 @@ err:
return code;
}
-/* Render a color image for deviceN source color with no ICC profile. This
- is also used if the image has any masking (type4 image) since we will not
+/* Render a color image for deviceN source color with no ICC profile. This
+ is also used if the image has any masking (type4 image) since we will not
be blasting through quickly */
static int
image_render_color_DeviceN(gx_image_enum *penum_orig, const byte *buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
const gx_image_enum *const penum = penum_orig; /* const within proc */
const gs_imager_state *pis = penum->pis;
@@ -957,12 +957,12 @@ image_render_color_DeviceN(gx_image_enum *penum_orig, const byte *buffer, int da
color_samples next; /* next sample value */
const byte *bufend = psrc + w;
int code = 0, mcode = 0;
- int i;
+ int i;
bits32 mask = penum->mask_color.mask;
bits32 test = penum->mask_color.test;
if (h == 0)
- return 0;
+ return 0;
pdevc = &devc1;
pdevc_next = &devc2;
/* These used to be set by init clues */
@@ -974,18 +974,18 @@ image_render_color_DeviceN(gx_image_enum *penum_orig, const byte *buffer, int da
pdyx = dda_current(penum->dda.row.x) - penum->cur.x;
pdyy = dda_current(penum->dda.row.y) - penum->cur.y;
switch (posture) {
- case image_portrait:
- vci = penum->yci, vdi = penum->hci;
- irun = fixed2int_var_rounded(xrun);
- break;
- case image_landscape:
- default: /* we don't handle skew -- treat as landscape */
- vci = penum->xci, vdi = penum->wci;
- irun = fixed2int_var_rounded(yrun);
- break;
+ case image_portrait:
+ vci = penum->yci, vdi = penum->hci;
+ irun = fixed2int_var_rounded(xrun);
+ break;
+ case image_landscape:
+ default: /* we don't handle skew -- treat as landscape */
+ vci = penum->xci, vdi = penum->wci;
+ irun = fixed2int_var_rounded(yrun);
+ break;
}
if_debug5('b', "[b]y=%d data_x=%d w=%d xt=%f yt=%f\n",
- penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
+ penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev));
memset(&run, 0, sizeof(run));
memset(&next, 0, sizeof(next));
cs_full_init_color(&cc, pcs);
@@ -993,107 +993,107 @@ image_render_color_DeviceN(gx_image_enum *penum_orig, const byte *buffer, int da
while (psrc < bufend) {
dda_next(pnext.x);
dda_next(pnext.y);
- if (posture != image_skewed && !memcmp(psrc, run.v, spp)) {
- psrc += spp;
- goto inc;
- }
- memcpy(next.v, psrc, spp);
- psrc += spp;
+ if (posture != image_skewed && !memcmp(psrc, run.v, spp)) {
+ psrc += spp;
+ goto inc;
+ }
+ memcpy(next.v, psrc, spp);
+ psrc += spp;
/* Check for transparent color. */
- if ((next.all[0] & mask) == test &&
- (penum->mask_color.exact ||
+ if ((next.all[0] & mask) == test &&
+ (penum->mask_color.exact ||
mask_color_matches(next.v, penum, spp))) {
- color_set_null(pdevc_next);
- goto mapped;
- }
- for (i = 0; i < spp; ++i)
- decode_sample(next.v[i], cc, i);
+ color_set_null(pdevc_next);
+ goto mapped;
+ }
+ for (i = 0; i < spp; ++i)
+ decode_sample(next.v[i], cc, i);
#ifdef DEBUG
- if (gs_debug_c('B')) {
- dprintf2("[B]cc[0..%d]=%g", spp - 1,
- cc.paint.values[0]);
- for (i = 1; i < spp; ++i)
- dprintf1(",%g", cc.paint.values[i]);
- dputs("\n");
- }
+ if (gs_debug_c('B')) {
+ dprintf2("[B]cc[0..%d]=%g", spp - 1,
+ cc.paint.values[0]);
+ for (i = 1; i < spp; ++i)
+ dprintf1(",%g", cc.paint.values[i]);
+ dputs("\n");
+ }
#endif
- mcode = remap_color(&cc, pcs, pdevc_next, pis, dev,
- gs_color_select_source);
+ mcode = remap_color(&cc, pcs, pdevc_next, pis, dev,
+ gs_color_select_source);
mapped: if (mcode < 0)
- goto fill;
- if (sizeof(pdevc_next->colors.binary.color[0]) <= sizeof(ulong))
- if_debug7('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%lx,0x%lx,0x%lx\n",
- next.v[0], next.v[1], next.v[2], next.v[3],
- (ulong)pdevc_next->colors.binary.color[0],
- (ulong)pdevc_next->colors.binary.color[1],
- (ulong) pdevc_next->type);
- else
- if_debug9('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%08lx%08lx,0x%08lx%08lx,0x%lx\n",
- next.v[0], next.v[1], next.v[2], next.v[3],
- (ulong)(pdevc_next->colors.binary.color[0] >>
- 8 * (sizeof(pdevc_next->colors.binary.color[0]) - sizeof(ulong))),
- (ulong)pdevc_next->colors.binary.color[0],
- (ulong)(pdevc_next->colors.binary.color[1] >>
- 8 * (sizeof(pdevc_next->colors.binary.color[1]) - sizeof(ulong))),
- (ulong)pdevc_next->colors.binary.color[1],
- (ulong) pdevc_next->type);
- /* NB: printf above fails to account for sizeof gx_color_index 4 or 8 bytes */
- if (posture != image_skewed && next.all[0] == run.all[0])
- goto set;
+ goto fill;
+ if (sizeof(pdevc_next->colors.binary.color[0]) <= sizeof(ulong))
+ if_debug7('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%lx,0x%lx,0x%lx\n",
+ next.v[0], next.v[1], next.v[2], next.v[3],
+ (ulong)pdevc_next->colors.binary.color[0],
+ (ulong)pdevc_next->colors.binary.color[1],
+ (ulong) pdevc_next->type);
+ else
+ if_debug9('B', "[B]0x%x,0x%x,0x%x,0x%x -> 0x%08lx%08lx,0x%08lx%08lx,0x%lx\n",
+ next.v[0], next.v[1], next.v[2], next.v[3],
+ (ulong)(pdevc_next->colors.binary.color[0] >>
+ 8 * (sizeof(pdevc_next->colors.binary.color[0]) - sizeof(ulong))),
+ (ulong)pdevc_next->colors.binary.color[0],
+ (ulong)(pdevc_next->colors.binary.color[1] >>
+ 8 * (sizeof(pdevc_next->colors.binary.color[1]) - sizeof(ulong))),
+ (ulong)pdevc_next->colors.binary.color[1],
+ (ulong) pdevc_next->type);
+ /* NB: printf above fails to account for sizeof gx_color_index 4 or 8 bytes */
+ if (posture != image_skewed && next.all[0] == run.all[0])
+ goto set;
fill: /* Fill the region between */
- /* xrun/irun and xprev */
+ /* xrun/irun and xprev */
/*
- * Note; This section is nearly a copy of a simlar section below
+ * Note; This section is nearly a copy of a simlar section below
* for processing the last image pixel in the loop. This would have been
* made into a subroutine except for complications about the number of
* variables that would have been needed to be passed to the routine.
- */
- switch (posture) {
- case image_portrait:
- { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+ */
+ switch (posture) {
+ case image_portrait:
+ { /* Rectangle */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
- }
- break;
- case image_landscape:
- { /* 90 degree rotated rectangle */
- int yi = irun;
- int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
+ }
+ break;
+ case image_landscape:
+ { /* 90 degree rotated rectangle */
+ int yi = irun;
+ int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
- if (hi < 0)
- yi += hi, hi = -hi;
- if (hi > 0)
- code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
- pdevc, dev, lop);
- }
- break;
- default:
- { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
- xrun = xprev;
- yrun = yprev;
- }
- }
- if (code < 0)
- goto err;
- rsrc = psrc;
+ if (hi < 0)
+ yi += hi, hi = -hi;
+ if (hi > 0)
+ code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
+ pdevc, dev, lop);
+ }
+ break;
+ default:
+ { /* Parallelogram */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
+ xrun = xprev;
+ yrun = yprev;
+ }
+ }
+ if (code < 0)
+ goto err;
+ rsrc = psrc;
- if ((code = mcode) < 0) goto err;
+ if ((code = mcode) < 0) goto err;
/* Swap around the colors due to a change */
ptemp = pdevc;
pdevc = pdevc_next;
pdevc_next = ptemp;
set: run = next;
inc: xprev = dda_current(pnext.x);
- yprev = dda_current(pnext.y); /* harmless if no skew */
+ yprev = dda_current(pnext.y); /* harmless if no skew */
}
/* Fill the last run. */
/*
@@ -1103,36 +1103,36 @@ inc: xprev = dda_current(pnext.x);
* variables that would have been needed to be passed to the routine.
*/
switch (posture) {
- case image_portrait:
- { /* Rectangle */
- int xi = irun;
- int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
+ case image_portrait:
+ { /* Rectangle */
+ int xi = irun;
+ int wi = (irun = fixed2int_var_rounded(xprev)) - xi;
- if (wi < 0)
- xi += wi, wi = -wi;
- if (wi > 0)
- code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
- pdevc, dev, lop);
- }
- break;
- case image_landscape:
- { /* 90 degree rotated rectangle */
- int yi = irun;
- int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
+ if (wi < 0)
+ xi += wi, wi = -wi;
+ if (wi > 0)
+ code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi,
+ pdevc, dev, lop);
+ }
+ break;
+ case image_landscape:
+ { /* 90 degree rotated rectangle */
+ int yi = irun;
+ int hi = (irun = fixed2int_var_rounded(yprev)) - yi;
- if (hi < 0)
- yi += hi, hi = -hi;
- if (hi > 0)
- code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
- pdevc, dev, lop);
- }
- break;
- default:
- { /* Parallelogram */
- code = (*dev_proc(dev, fill_parallelogram))
- (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
- pdevc, lop);
- }
+ if (hi < 0)
+ yi += hi, hi = -hi;
+ if (hi > 0)
+ code = gx_fill_rectangle_device_rop(vci, yi, vdi, hi,
+ pdevc, dev, lop);
+ }
+ break;
+ default:
+ { /* Parallelogram */
+ code = (*dev_proc(dev, fill_parallelogram))
+ (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy,
+ pdevc, lop);
+ }
}
return (code < 0 ? code : 1);
/* Save position if error, in case we resume. */
diff --git a/gs/base/gxidata.c b/gs/base/gxidata.c
index 55f9d4f0f..e8b993e44 100644
--- a/gs/base/gxidata.c
+++ b/gs/base/gxidata.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,16 +24,16 @@
/* Forward declarations */
static void update_strip(gx_image_enum *penum);
static void repack_bit_planes(const gx_image_plane_t *src_planes,
- const ulong *offsets, int num_planes,
- byte *buffer, int width,
- const sample_lookup_t * ptab, int spread);
+ const ulong *offsets, int num_planes,
+ byte *buffer, int width,
+ const sample_lookup_t * ptab, int spread);
static gx_device *setup_image_device(const gx_image_enum *penum);
/* Process the next piece of an ImageType 1 image. */
int
gx_image1_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_image_enum *penum = (gx_image_enum *) info;
gx_device *dev;
@@ -54,183 +54,183 @@ gx_image1_plane_data(gx_image_enum_common_t * info,
int code;
if (height == 0) {
- *rows_used = 0;
- return 0;
+ *rows_used = 0;
+ return 0;
}
dev = setup_image_device(penum);
/* Now render complete rows. */
if (penum->used.y) {
- /*
- * Processing was interrupted by an error. Skip over rows
- * already processed.
- */
- int px;
-
- for (px = 0; px < num_planes; ++px)
- offsets[px] = planes[px].raster * penum->used.y;
- penum->used.y = 0;
+ /*
+ * Processing was interrupted by an error. Skip over rows
+ * already processed.
+ */
+ int px;
+
+ for (px = 0; px < num_planes; ++px)
+ offsets[px] = planes[px].raster * penum->used.y;
+ penum->used.y = 0;
} else
- memset(offsets, 0, num_planes * sizeof(offsets[0]));
+ memset(offsets, 0, num_planes * sizeof(offsets[0]));
if (num_planes == 1 && penum->plane_depths[0] != penum->bps) {
- /* A single plane with multiple components. */
- num_components_per_plane = penum->plane_depths[0] / penum->bps;
+ /* A single plane with multiple components. */
+ num_components_per_plane = penum->plane_depths[0] / penum->bps;
}
for (; penum->y < y_end; penum->y++) {
- int px;
- const byte *buffer;
- int sourcex;
- int x_used = penum->used.x;
-
- if (bit_planar) {
- /* Repack the bit planes into byte-wide samples. */
-
- buffer = penum->buffer;
- sourcex = 0;
- for (px = 0; px < num_planes; px += penum->bps)
- repack_bit_planes(planes, offsets, penum->bps, penum->buffer,
- penum->rect.w, &penum->map[px].table,
- penum->spread);
- for (px = 0; px < num_planes; ++px)
- offsets[px] += planes[px].raster;
- } else {
- /*
- * Normally, we unpack the data into the buffer, but if
- * there is only one plane and we don't need to expand the
- * input samples, we may use the data directly.
- */
- sourcex = planes[0].data_x;
- buffer =
- (*penum->unpack)(penum->buffer, &sourcex,
- planes[0].data + offsets[0],
- planes[0].data_x, BCOUNT(planes[0]),
- &penum->map[0], penum->spread, num_components_per_plane);
-
- offsets[0] += planes[0].raster;
- for (px = 1; px < num_planes; ++px) {
- (*penum->unpack)(penum->buffer + (px << penum->log2_xbytes),
- &ignore_data_x,
- planes[px].data + offsets[px],
- planes[px].data_x, BCOUNT(planes[px]),
- &penum->map[px], penum->spread, 1);
- offsets[px] += planes[px].raster;
- }
- }
+ int px;
+ const byte *buffer;
+ int sourcex;
+ int x_used = penum->used.x;
+
+ if (bit_planar) {
+ /* Repack the bit planes into byte-wide samples. */
+
+ buffer = penum->buffer;
+ sourcex = 0;
+ for (px = 0; px < num_planes; px += penum->bps)
+ repack_bit_planes(planes, offsets, penum->bps, penum->buffer,
+ penum->rect.w, &penum->map[px].table,
+ penum->spread);
+ for (px = 0; px < num_planes; ++px)
+ offsets[px] += planes[px].raster;
+ } else {
+ /*
+ * Normally, we unpack the data into the buffer, but if
+ * there is only one plane and we don't need to expand the
+ * input samples, we may use the data directly.
+ */
+ sourcex = planes[0].data_x;
+ buffer =
+ (*penum->unpack)(penum->buffer, &sourcex,
+ planes[0].data + offsets[0],
+ planes[0].data_x, BCOUNT(planes[0]),
+ &penum->map[0], penum->spread, num_components_per_plane);
+
+ offsets[0] += planes[0].raster;
+ for (px = 1; px < num_planes; ++px) {
+ (*penum->unpack)(penum->buffer + (px << penum->log2_xbytes),
+ &ignore_data_x,
+ planes[px].data + offsets[px],
+ planes[px].data_x, BCOUNT(planes[px]),
+ &penum->map[px], penum->spread, 1);
+ offsets[px] += planes[px].raster;
+ }
+ }
#ifdef DEBUG
- if (gs_debug_c('b'))
- dprintf1("[b]image1 y=%d\n", y);
- if (gs_debug_c('B')) {
- int i, n = width_spp;
-
- if (penum->bps > 8)
- n *= 2;
- else if (penum->bps == 1 && penum->unpack_bps == 8)
- n = (n + 7) / 8;
- dlputs("[B]row:");
- for (i = 0; i < n; i++)
- dprintf1(" %02x", buffer[i]);
- dputs("\n");
- }
+ if (gs_debug_c('b'))
+ dprintf1("[b]image1 y=%d\n", y);
+ if (gs_debug_c('B')) {
+ int i, n = width_spp;
+
+ if (penum->bps > 8)
+ n *= 2;
+ else if (penum->bps == 1 && penum->unpack_bps == 8)
+ n = (n + 7) / 8;
+ dlputs("[B]row:");
+ for (i = 0; i < n; i++)
+ dprintf1(" %02x", buffer[i]);
+ dputs("\n");
+ }
#endif
- penum->cur.x = dda_current(penum->dda.row.x);
- dda_next(penum->dda.row.x);
- penum->cur.y = dda_current(penum->dda.row.y);
- dda_next(penum->dda.row.y);
- if (!penum->interpolate)
- switch (penum->posture) {
- case image_portrait:
- { /* Precompute integer y and height, */
- /* and check for clipping. */
- fixed yc = penum->cur.y,
- yn = dda_current(penum->dda.row.y);
-
- if (yn < yc) {
- fixed temp = yn;
-
- yn = yc;
- yc = temp;
- }
- yc -= adjust;
- if (yc >= penum->clip_outer.q.y)
- goto mt;
- yn += adjust;
- if (yn <= penum->clip_outer.p.y)
- goto mt;
- penum->yci = fixed2int_pixround_perfect(yc);
- penum->hci = fixed2int_pixround_perfect(yn) - penum->yci;
- if (penum->hci == 0)
- goto mt;
- if_debug2('b', "[b]yci=%d, hci=%d\n",
- penum->yci, penum->hci);
- }
- break;
- case image_landscape:
- { /* Check for no pixel centers in x. */
- fixed xc = penum->cur.x,
- xn = dda_current(penum->dda.row.x);
-
- if (xn < xc) {
- fixed temp = xn;
-
- xn = xc;
- xc = temp;
- }
- xc -= adjust;
- if (xc >= penum->clip_outer.q.x)
- goto mt;
- xn += adjust;
- if (xn <= penum->clip_outer.p.x)
- goto mt;
- penum->xci = fixed2int_pixround_perfect(xc);
- penum->wci = fixed2int_pixround_perfect(xn) - penum->xci;
- if (penum->wci == 0)
- goto mt;
- if_debug2('b', "[b]xci=%d, wci=%d\n",
- penum->xci, penum->wci);
- }
- break;
- case image_skewed:
- ;
- }
- update_strip(penum);
- if (x_used) {
- /*
- * Processing was interrupted by an error. Skip over pixels
- * already processed.
- */
- dda_advance(penum->dda.pixel0.x, x_used);
- dda_advance(penum->dda.pixel0.y, x_used);
- penum->used.x = 0;
- }
- if_debug2('b', "[b]pixel0 x=%g, y=%g\n",
- fixed2float(dda_current(penum->dda.pixel0.x)),
- fixed2float(dda_current(penum->dda.pixel0.y)));
- code = (*penum->render)(penum, buffer, sourcex + x_used,
- width_spp - x_used * penum->spp, 1, dev);
- if (code < 0) {
- /* Error or interrupt, restore original state. */
- penum->used.x += x_used;
- if (!penum->used.y) {
- dda_previous(penum->dda.row.x);
- dda_previous(penum->dda.row.y);
- dda_translate(penum->dda.strip.x,
- penum->prev.x - penum->cur.x);
- dda_translate(penum->dda.strip.y,
- penum->prev.y - penum->cur.y);
- }
- goto out;
- }
- penum->prev = penum->cur;
+ penum->cur.x = dda_current(penum->dda.row.x);
+ dda_next(penum->dda.row.x);
+ penum->cur.y = dda_current(penum->dda.row.y);
+ dda_next(penum->dda.row.y);
+ if (!penum->interpolate)
+ switch (penum->posture) {
+ case image_portrait:
+ { /* Precompute integer y and height, */
+ /* and check for clipping. */
+ fixed yc = penum->cur.y,
+ yn = dda_current(penum->dda.row.y);
+
+ if (yn < yc) {
+ fixed temp = yn;
+
+ yn = yc;
+ yc = temp;
+ }
+ yc -= adjust;
+ if (yc >= penum->clip_outer.q.y)
+ goto mt;
+ yn += adjust;
+ if (yn <= penum->clip_outer.p.y)
+ goto mt;
+ penum->yci = fixed2int_pixround_perfect(yc);
+ penum->hci = fixed2int_pixround_perfect(yn) - penum->yci;
+ if (penum->hci == 0)
+ goto mt;
+ if_debug2('b', "[b]yci=%d, hci=%d\n",
+ penum->yci, penum->hci);
+ }
+ break;
+ case image_landscape:
+ { /* Check for no pixel centers in x. */
+ fixed xc = penum->cur.x,
+ xn = dda_current(penum->dda.row.x);
+
+ if (xn < xc) {
+ fixed temp = xn;
+
+ xn = xc;
+ xc = temp;
+ }
+ xc -= adjust;
+ if (xc >= penum->clip_outer.q.x)
+ goto mt;
+ xn += adjust;
+ if (xn <= penum->clip_outer.p.x)
+ goto mt;
+ penum->xci = fixed2int_pixround_perfect(xc);
+ penum->wci = fixed2int_pixround_perfect(xn) - penum->xci;
+ if (penum->wci == 0)
+ goto mt;
+ if_debug2('b', "[b]xci=%d, wci=%d\n",
+ penum->xci, penum->wci);
+ }
+ break;
+ case image_skewed:
+ ;
+ }
+ update_strip(penum);
+ if (x_used) {
+ /*
+ * Processing was interrupted by an error. Skip over pixels
+ * already processed.
+ */
+ dda_advance(penum->dda.pixel0.x, x_used);
+ dda_advance(penum->dda.pixel0.y, x_used);
+ penum->used.x = 0;
+ }
+ if_debug2('b', "[b]pixel0 x=%g, y=%g\n",
+ fixed2float(dda_current(penum->dda.pixel0.x)),
+ fixed2float(dda_current(penum->dda.pixel0.y)));
+ code = (*penum->render)(penum, buffer, sourcex + x_used,
+ width_spp - x_used * penum->spp, 1, dev);
+ if (code < 0) {
+ /* Error or interrupt, restore original state. */
+ penum->used.x += x_used;
+ if (!penum->used.y) {
+ dda_previous(penum->dda.row.x);
+ dda_previous(penum->dda.row.y);
+ dda_translate(penum->dda.strip.x,
+ penum->prev.x - penum->cur.x);
+ dda_translate(penum->dda.strip.y,
+ penum->prev.y - penum->cur.y);
+ }
+ goto out;
+ }
+ penum->prev = penum->cur;
mt:;
}
if (penum->y < penum->rect.h) {
- code = 0;
+ code = 0;
} else {
- /* End of input data. Render any left-over buffered data. */
- code = gx_image1_flush(info);
- if (code >= 0)
- code = 1;
+ /* End of input data. Render any left-over buffered data. */
+ code = gx_image1_flush(info);
+ if (code >= 0)
+ code = 1;
}
out:
/* Note that caller must call end_image */
@@ -250,29 +250,29 @@ gx_image1_flush(gx_image_enum_common_t * info)
penum->cur.x = dda_current(penum->dda.row.x);
penum->cur.y = dda_current(penum->dda.row.y);
switch (penum->posture) {
- case image_portrait:
- {
- fixed yc = penum->cur.y;
-
- penum->yci = fixed2int_rounded(yc - adjust);
- penum->hci = fixed2int_rounded(yc + adjust) - penum->yci;
- }
- break;
- case image_landscape:
- {
- fixed xc = penum->cur.x;
-
- penum->xci = fixed2int_rounded(xc - adjust);
- penum->wci = fixed2int_rounded(xc + adjust) - penum->xci;
- }
- break;
- case image_skewed: /* pacify compilers */
- ;
+ case image_portrait:
+ {
+ fixed yc = penum->cur.y;
+
+ penum->yci = fixed2int_rounded(yc - adjust);
+ penum->hci = fixed2int_rounded(yc + adjust) - penum->yci;
+ }
+ break;
+ case image_landscape:
+ {
+ fixed xc = penum->cur.x;
+
+ penum->xci = fixed2int_rounded(xc - adjust);
+ penum->wci = fixed2int_rounded(xc + adjust) - penum->xci;
+ }
+ break;
+ case image_skewed: /* pacify compilers */
+ ;
}
update_strip(penum);
penum->prev = penum->cur;
return (*penum->render)(penum, NULL, 0, width_spp, 0,
- setup_image_device(penum));
+ setup_image_device(penum));
}
/* Update the strip DDA when moving to a new row. */
@@ -280,7 +280,7 @@ static void
update_strip(gx_image_enum *penum)
{
-#if 1
+#if 1
/* Old code. */
dda_translate(penum->dda.strip.x, penum->cur.x - penum->prev.x);
dda_translate(penum->dda.strip.y, penum->cur.y - penum->prev.y);
@@ -311,15 +311,15 @@ update_strip(gx_image_enum *penum)
*/
static void
repack_bit_planes(const gx_image_plane_t *src_planes, const ulong *offsets,
- int num_planes, byte *buffer, int width,
- const sample_lookup_t * ptab, int spread)
+ int num_planes, byte *buffer, int width,
+ const sample_lookup_t * ptab, int spread)
{
gx_image_plane_t planes[8];
byte *zeros = 0;
byte *dest = buffer;
int any_data_x = 0;
bool direct = (spread == 1 && ptab->lookup8[0] == 0 &&
- ptab->lookup8[255] == 255);
+ ptab->lookup8[255] == 255);
int pi, x;
gx_image_plane_t *pp;
@@ -329,84 +329,84 @@ repack_bit_planes(const gx_image_plane_t *src_planes, const ulong *offsets,
* order to avoid tests in the loop.
*/
for (pi = 0, pp = planes; pi < num_planes; ++pi, ++pp)
- if (src_planes[pi].data == 0) {
- if (!zeros) {
- zeros = buffer + width - ((width + 7) >> 3);
- }
- pp->data = zeros;
- pp->data_x = 0;
- } else {
- int dx = src_planes[pi].data_x;
-
- pp->data = src_planes[pi].data + (dx >> 3) + offsets[pi];
- any_data_x |= (pp->data_x = dx & 7);
- }
+ if (src_planes[pi].data == 0) {
+ if (!zeros) {
+ zeros = buffer + width - ((width + 7) >> 3);
+ }
+ pp->data = zeros;
+ pp->data_x = 0;
+ } else {
+ int dx = src_planes[pi].data_x;
+
+ pp->data = src_planes[pi].data + (dx >> 3) + offsets[pi];
+ any_data_x |= (pp->data_x = dx & 7);
+ }
if (zeros)
- memset(zeros, 0, buffer + width - zeros);
+ memset(zeros, 0, buffer + width - zeros);
/*
* Now process the data, in blocks of one input byte column
* (8 output bytes).
*/
for (x = 0; x < width; x += 8) {
- bits32 w0 = 0, w1 = 0;
+ bits32 w0 = 0, w1 = 0;
#if arch_is_big_endian
- static const bits32 expand[16] = {
- 0x00000000, 0x00000001, 0x00000100, 0x00000101,
- 0x00010000, 0x00010001, 0x00010100, 0x00010101,
- 0x01000000, 0x01000001, 0x01000100, 0x01000101,
- 0x01010000, 0x01010001, 0x01010100, 0x01010101
- };
+ static const bits32 expand[16] = {
+ 0x00000000, 0x00000001, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010100, 0x00010101,
+ 0x01000000, 0x01000001, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010100, 0x01010101
+ };
#else
- static const bits32 expand[16] = {
- 0x00000000, 0x01000000, 0x00010000, 0x01010000,
- 0x00000100, 0x01000100, 0x00010100, 0x01010100,
- 0x00000001, 0x01000001, 0x00010001, 0x01010001,
- 0x00000101, 0x01000101, 0x00010101, 0x01010101
- };
+ static const bits32 expand[16] = {
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101
+ };
#endif
- if (any_data_x) {
- for (pi = 0, pp = planes; pi < num_planes; ++pi, ++pp) {
- uint b = *(pp->data++);
- int dx = pp->data_x;
-
- if (dx) {
- b <<= dx;
- if (x + 8 - dx < width)
- b += *pp->data >> (8 - dx);
- }
- w0 = (w0 << 1) | expand[b >> 4];
- w1 = (w1 << 1) | expand[b & 0xf];
- }
- } else {
- for (pi = 0, pp = planes; pi < num_planes; ++pi, ++pp) {
- uint b = *(pp->data++);
-
- w0 = (w0 << 1) | expand[b >> 4];
- w1 = (w1 << 1) | expand[b & 0xf];
- }
- }
- /*
- * We optimize spread == 1 and identity ptab together, although
- * we could subdivide these 2 cases into 4 if we wanted.
- */
- if (direct) {
- ((bits32 *)dest)[0] = w0;
- ((bits32 *)dest)[1] = w1;
- dest += 8;
- } else {
+ if (any_data_x) {
+ for (pi = 0, pp = planes; pi < num_planes; ++pi, ++pp) {
+ uint b = *(pp->data++);
+ int dx = pp->data_x;
+
+ if (dx) {
+ b <<= dx;
+ if (x + 8 - dx < width)
+ b += *pp->data >> (8 - dx);
+ }
+ w0 = (w0 << 1) | expand[b >> 4];
+ w1 = (w1 << 1) | expand[b & 0xf];
+ }
+ } else {
+ for (pi = 0, pp = planes; pi < num_planes; ++pi, ++pp) {
+ uint b = *(pp->data++);
+
+ w0 = (w0 << 1) | expand[b >> 4];
+ w1 = (w1 << 1) | expand[b & 0xf];
+ }
+ }
+ /*
+ * We optimize spread == 1 and identity ptab together, although
+ * we could subdivide these 2 cases into 4 if we wanted.
+ */
+ if (direct) {
+ ((bits32 *)dest)[0] = w0;
+ ((bits32 *)dest)[1] = w1;
+ dest += 8;
+ } else {
#define MAP_BYTE(v) (ptab->lookup8[(byte)(v)])
- dest[0] = MAP_BYTE(w0 >> 24); dest += spread;
- dest[1] = MAP_BYTE(w0 >> 16); dest += spread;
- dest[2] = MAP_BYTE(w0 >> 8); dest += spread;
- dest[3] = MAP_BYTE(w0); dest += spread;
- dest[4] = MAP_BYTE(w1 >> 24); dest += spread;
- dest[5] = MAP_BYTE(w1 >> 16); dest += spread;
- dest[6] = MAP_BYTE(w1 >> 8); dest += spread;
- dest[7] = MAP_BYTE(w1); dest += spread;
+ dest[0] = MAP_BYTE(w0 >> 24); dest += spread;
+ dest[1] = MAP_BYTE(w0 >> 16); dest += spread;
+ dest[2] = MAP_BYTE(w0 >> 8); dest += spread;
+ dest[3] = MAP_BYTE(w0); dest += spread;
+ dest[4] = MAP_BYTE(w1 >> 24); dest += spread;
+ dest[5] = MAP_BYTE(w1 >> 16); dest += spread;
+ dest[6] = MAP_BYTE(w1 >> 8); dest += spread;
+ dest[7] = MAP_BYTE(w1); dest += spread;
#undef MAP_BYTE
- }
+ }
}
}
@@ -417,16 +417,16 @@ setup_image_device(const gx_image_enum *penum)
gx_device *dev = penum->dev;
if (penum->clip_dev) {
- gx_device_clip *cdev = penum->clip_dev;
+ gx_device_clip *cdev = penum->clip_dev;
- gx_device_set_target((gx_device_forward *)cdev, dev);
- dev = (gx_device *) cdev;
+ gx_device_set_target((gx_device_forward *)cdev, dev);
+ dev = (gx_device *) cdev;
}
if (penum->rop_dev) {
- gx_device_rop_texture *rtdev = penum->rop_dev;
+ gx_device_rop_texture *rtdev = penum->rop_dev;
- gx_device_set_target((gx_device_forward *)rtdev, dev);
- dev = (gx_device *) rtdev;
+ gx_device_set_target((gx_device_forward *)rtdev, dev);
+ dev = (gx_device *) rtdev;
}
return dev;
}
@@ -441,12 +441,12 @@ gx_image1_end_image(gx_image_enum_common_t * info, bool draw_last)
stream_image_scale_state *scaler = penum->scaler;
if_debug2('b', "[b]%send_image, y=%d\n",
- (penum->y < penum->rect.h ? "premature " : ""), penum->y);
+ (penum->y < penum->rect.h ? "premature " : ""), penum->y);
if (draw_last) {
- int code = gx_image_flush(info);
+ int code = gx_image_flush(info);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
/* release the reference to the target */
@@ -460,18 +460,18 @@ gx_image1_end_image(gx_image_enum_common_t * info, bool draw_last)
gs_free_object(mem, penum->clip_dev, "image clipper");
if (scaler != 0) {
- (*scaler->template->release) ((stream_state *) scaler);
- gs_free_object(mem, scaler, "image scaler state");
+ (*scaler->template->release) ((stream_state *) scaler);
+ gs_free_object(mem, scaler, "image scaler state");
}
if (penum->icc_link != NULL) {
gsicc_release_link(penum->icc_link);
}
if (penum->color_cache != NULL) {
if (penum->color_cache->free_contone) {
- gs_free_object(mem, penum->color_cache->device_contone,
+ gs_free_object(mem, penum->color_cache->device_contone,
"device_contone");
}
- gs_free_object(mem, penum->color_cache->is_transparent,
+ gs_free_object(mem, penum->color_cache->is_transparent,
"image is_transparent");
gs_free_object(mem, penum->color_cache, "image color cache");
}
diff --git a/gs/base/gxifast.c b/gs/base/gxifast.c
index e9eba511a..3235a19a9 100644
--- a/gs/base/gxifast.c
+++ b/gs/base/gxifast.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,82 +56,82 @@ gs_image_class_1_simple(gx_image_enum * penum)
fixed oy = dda_current(penum->dda.pixel0.y);
if (penum->use_rop || penum->spp != 1 || penum->bps != 1)
- return 0;
+ return 0;
switch (penum->posture) {
- case image_portrait:
- { /* Use fast portrait algorithm. */
- long dev_width =
- fixed2long_pixround(ox + penum->x_extent.x) -
- fixed2long_pixround(ox);
-
- if (dev_width != penum->rect.w) {
- /*
- * Add an extra align_bitmap_mod of padding so that
- * we can align scaled rows with the device.
- */
- long line_size =
- bitmap_raster(any_abs(dev_width)) + align_bitmap_mod;
-
- if (penum->adjust != 0 || line_size > max_uint)
- return 0;
- /* Must buffer a scan line. */
- penum->line_width = any_abs(dev_width);
- penum->line_size = (uint) line_size;
- penum->line = gs_alloc_bytes(penum->memory,
- penum->line_size, "image line");
- if (penum->line == 0) {
- gx_default_end_image(penum->dev,
- (gx_image_enum_common_t *)penum,
- false);
- return 0;
- }
- }
- if_debug2('b', "[b]render=simple, unpack=copy; rect.w=%d, dev_width=%ld\n",
- penum->rect.w, dev_width);
- rproc = image_render_simple;
- break;
- }
- case image_landscape:
- { /* Use fast landscape algorithm. */
- long dev_width =
- fixed2long_pixround(oy + penum->x_extent.y) -
- fixed2long_pixround(oy);
- long line_size =
- (dev_width = any_abs(dev_width),
- bitmap_raster(dev_width) * 8 +
- ROUND_UP(dev_width, 8) * align_bitmap_mod);
-
- if ((dev_width != penum->rect.w && penum->adjust != 0) ||
- line_size > max_uint
- )
- return 0;
- /* Must buffer a group of 8N scan lines. */
- penum->line_width = dev_width;
- penum->line_size = (uint) line_size;
- penum->line = gs_alloc_bytes(penum->memory,
- penum->line_size, "image line");
- if (penum->line == 0) {
- gx_default_end_image(penum->dev,
- (gx_image_enum_common_t *) penum,
- false);
- return 0;
- }
- penum->xi_next = penum->line_xy = fixed2int_var_rounded(ox);
- if_debug3('b', "[b]render=landscape, unpack=copy; rect.w=%d, dev_width=%ld, line_size=%ld\n",
- penum->rect.w, dev_width, line_size);
- rproc = image_render_landscape;
- /* Precompute values needed for rasterizing. */
- penum->dxy =
- float2fixed(penum->matrix.xy +
- fixed2float(fixed_epsilon) / 2);
- break;
- }
- default:
- return 0;
+ case image_portrait:
+ { /* Use fast portrait algorithm. */
+ long dev_width =
+ fixed2long_pixround(ox + penum->x_extent.x) -
+ fixed2long_pixround(ox);
+
+ if (dev_width != penum->rect.w) {
+ /*
+ * Add an extra align_bitmap_mod of padding so that
+ * we can align scaled rows with the device.
+ */
+ long line_size =
+ bitmap_raster(any_abs(dev_width)) + align_bitmap_mod;
+
+ if (penum->adjust != 0 || line_size > max_uint)
+ return 0;
+ /* Must buffer a scan line. */
+ penum->line_width = any_abs(dev_width);
+ penum->line_size = (uint) line_size;
+ penum->line = gs_alloc_bytes(penum->memory,
+ penum->line_size, "image line");
+ if (penum->line == 0) {
+ gx_default_end_image(penum->dev,
+ (gx_image_enum_common_t *)penum,
+ false);
+ return 0;
+ }
+ }
+ if_debug2('b', "[b]render=simple, unpack=copy; rect.w=%d, dev_width=%ld\n",
+ penum->rect.w, dev_width);
+ rproc = image_render_simple;
+ break;
+ }
+ case image_landscape:
+ { /* Use fast landscape algorithm. */
+ long dev_width =
+ fixed2long_pixround(oy + penum->x_extent.y) -
+ fixed2long_pixround(oy);
+ long line_size =
+ (dev_width = any_abs(dev_width),
+ bitmap_raster(dev_width) * 8 +
+ ROUND_UP(dev_width, 8) * align_bitmap_mod);
+
+ if ((dev_width != penum->rect.w && penum->adjust != 0) ||
+ line_size > max_uint
+ )
+ return 0;
+ /* Must buffer a group of 8N scan lines. */
+ penum->line_width = dev_width;
+ penum->line_size = (uint) line_size;
+ penum->line = gs_alloc_bytes(penum->memory,
+ penum->line_size, "image line");
+ if (penum->line == 0) {
+ gx_default_end_image(penum->dev,
+ (gx_image_enum_common_t *) penum,
+ false);
+ return 0;
+ }
+ penum->xi_next = penum->line_xy = fixed2int_var_rounded(ox);
+ if_debug3('b', "[b]render=landscape, unpack=copy; rect.w=%d, dev_width=%ld, line_size=%ld\n",
+ penum->rect.w, dev_width, line_size);
+ rproc = image_render_landscape;
+ /* Precompute values needed for rasterizing. */
+ penum->dxy =
+ float2fixed(penum->matrix.xy +
+ fixed2float(fixed_epsilon) / 2);
+ break;
+ }
+ default:
+ return 0;
}
/* Precompute values needed for rasterizing. */
penum->dxx =
- float2fixed(penum->matrix.xx + fixed2float(fixed_epsilon) / 2);
+ float2fixed(penum->matrix.xx + fixed2float(fixed_epsilon) / 2);
/*
* We don't want to spread the samples, but we have to reset unpack_bps
* to prevent the buffer pointer from being incremented by 8 bytes per
@@ -140,27 +140,27 @@ gs_image_class_1_simple(gx_image_enum * penum)
penum->unpack = sample_unpack_copy;
penum->unpack_bps = 8;
if (penum->use_mask_color) {
- /*
- * Set the masked color as 'no_color' to make it transparent
- * according to the mask color range and the decoding.
- */
- penum->masked = true;
- if (penum->mask_color.values[0] == 1) {
- /* if v0 == 1, 1 is transparent since v1 must be == 1 to be a valid range */
- set_nonclient_dev_color(penum->map[0].inverted ? penum->icolor0 : penum->icolor1,
- gx_no_color_index);
- } else if (penum->mask_color.values[1] == 0) {
- /* if v1 == 0, 0 is transparent since v0 must be == 0 to be a valid range */
- set_nonclient_dev_color(penum->map[0].inverted ? penum->icolor1 : penum->icolor0,
- gx_no_color_index);
- } else {
- /*
- * The only other possible in-range value is v0 = 0, v1 = 1.
- * The image is completely transparent!
- */
- rproc = image_render_skip;
- }
- penum->map[0].decoding = sd_none;
+ /*
+ * Set the masked color as 'no_color' to make it transparent
+ * according to the mask color range and the decoding.
+ */
+ penum->masked = true;
+ if (penum->mask_color.values[0] == 1) {
+ /* if v0 == 1, 1 is transparent since v1 must be == 1 to be a valid range */
+ set_nonclient_dev_color(penum->map[0].inverted ? penum->icolor0 : penum->icolor1,
+ gx_no_color_index);
+ } else if (penum->mask_color.values[1] == 0) {
+ /* if v1 == 0, 0 is transparent since v0 must be == 0 to be a valid range */
+ set_nonclient_dev_color(penum->map[0].inverted ? penum->icolor1 : penum->icolor0,
+ gx_no_color_index);
+ } else {
+ /*
+ * The only other possible in-range value is v0 = 0, v1 = 1.
+ * The image is completely transparent!
+ */
+ rproc = image_render_skip;
+ }
+ penum->map[0].decoding = sd_none;
}
return rproc;
}
@@ -173,7 +173,7 @@ gs_image_class_1_simple(gx_image_enum * penum)
/* Skip over a completely transparent image. */
static int
image_render_skip(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
return h;
}
@@ -213,8 +213,8 @@ fill_row(byte *line, int line_x, uint raster, int value)
}
static void
image_simple_expand(byte * line, int line_x, uint raster,
- const byte * buffer, int data_x, uint w,
- fixed xcur, fixed x_extent, byte zero /* 0 or 0xff */ )
+ const byte * buffer, int data_x, uint w,
+ fixed xcur, fixed x_extent, byte zero /* 0 or 0xff */ )
{
int dbitx = data_x & 7;
byte sbit = 0x80 >> dbitx;
@@ -252,61 +252,61 @@ image_simple_expand(byte * line, int line_x, uint raster,
fixed xl0;
if (w == 0)
- return;
+ return;
INCS(calls);
/* Scan backward for the last transition. */
if (stopbit == 0x80)
- --stop, stopbit = 1;
+ --stop, stopbit = 1;
else
- stopbit <<= 1;
+ stopbit <<= 1;
/* Now (stop, stopbit) give the last bit of the row. */
{
- byte stopmask = -stopbit << 1;
- byte last = *stop;
-
- if (stop == psrc) /* only 1 input byte */
- stopmask &= sbitmask;
- if (last & stopbit) {
- /* The last bit is a 1: look for a 0-to-1 transition. */
- if (~last & stopmask) { /* Transition in last byte. */
- last |= stopbit - 1;
- } else { /* No transition in the last byte. */
- while (stop > psrc && stop[-1] == 0xff)
- --stop;
- if (stop == psrc ||
- (stop == psrc + 1 && !(~*psrc & sbitmask))
- ) {
- /* The input is all 1s. Clear the row and exit. */
- INCS(all1s);
- fill_row(line, line_x, raster, one);
- return;
- }
- last = *--stop;
- }
- stopx = byte_bit_run_length_0[byte_reverse_bits[last]] - 1;
- } else {
- /* The last bit is a 0: look for a 1-to-0 transition. */
- if (last & stopmask) { /* Transition in last byte. */
- last &= -stopbit;
- } else { /* No transition in the last byte. */
- while (stop > psrc && stop[-1] == 0)
- --stop;
- if (stop == psrc ||
- (stop == psrc + 1 && !(*psrc & sbitmask))
- ) {
- /* The input is all 0s. Clear the row and exit. */
- INCS(all0s);
- fill_row(line, line_x, raster, zero);
- return;
- }
- last = *--stop;
- }
- stopx = byte_bit_run_length_0[byte_reverse_bits[last ^ 0xff]] - 1;
- }
- if (stopx < 0)
- stopx = 7, ++stop;
- stopbit = 1 << stopx;
+ byte stopmask = -stopbit << 1;
+ byte last = *stop;
+
+ if (stop == psrc) /* only 1 input byte */
+ stopmask &= sbitmask;
+ if (last & stopbit) {
+ /* The last bit is a 1: look for a 0-to-1 transition. */
+ if (~last & stopmask) { /* Transition in last byte. */
+ last |= stopbit - 1;
+ } else { /* No transition in the last byte. */
+ while (stop > psrc && stop[-1] == 0xff)
+ --stop;
+ if (stop == psrc ||
+ (stop == psrc + 1 && !(~*psrc & sbitmask))
+ ) {
+ /* The input is all 1s. Clear the row and exit. */
+ INCS(all1s);
+ fill_row(line, line_x, raster, one);
+ return;
+ }
+ last = *--stop;
+ }
+ stopx = byte_bit_run_length_0[byte_reverse_bits[last]] - 1;
+ } else {
+ /* The last bit is a 0: look for a 1-to-0 transition. */
+ if (last & stopmask) { /* Transition in last byte. */
+ last &= -stopbit;
+ } else { /* No transition in the last byte. */
+ while (stop > psrc && stop[-1] == 0)
+ --stop;
+ if (stop == psrc ||
+ (stop == psrc + 1 && !(*psrc & sbitmask))
+ ) {
+ /* The input is all 0s. Clear the row and exit. */
+ INCS(all0s);
+ fill_row(line, line_x, raster, zero);
+ return;
+ }
+ last = *--stop;
+ }
+ stopx = byte_bit_run_length_0[byte_reverse_bits[last ^ 0xff]] - 1;
+ }
+ if (stopx < 0)
+ stopx = 7, ++stop;
+ stopbit = 1 << stopx;
}
/* Pre-clear the row. */
@@ -314,15 +314,15 @@ image_simple_expand(byte * line, int line_x, uint raster,
/* Set up the DDAs. */
xl0 =
- (x_extent >= 0 ?
- fixed_fraction(fixed_pre_pixround(xcur)) :
- fixed_fraction(fixed_pre_pixround(xcur + x_extent)) - x_extent);
+ (x_extent >= 0 ?
+ fixed_fraction(fixed_pre_pixround(xcur)) :
+ fixed_fraction(fixed_pre_pixround(xcur + x_extent)) - x_extent);
xl0 += int2fixed(line_x);
dda_init(xl, xl0, x_extent, w);
dxx4 = xl.step;
dda_step_add(dxx4, xl.step);
/* egcc - 2.91.66 generates incorrect code for
- * dda_step_add(dxx4, dxx4);
+ * dda_step_add(dxx4, dxx4);
* Using the temp variable.
*/
dxx8 = dxx4;
@@ -342,133 +342,133 @@ image_simple_expand(byte * line, int line_x, uint raster,
* sbit = 1 << n, 0<=n<=7.
*/
for (data = *psrc;;) {
- int x0, n, bit;
- byte *bp;
- static const byte lmasks[9] = {
- 0xff, 0x7f, 0x3f, 0x1f, 0xf, 7, 3, 1, 0
- };
- static const byte rmasks[9] = {
- 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
- };
-
- INCS(runs);
-
- /* Scan a run of zeros. */
- data ^= 0xff; /* invert */
- while (data & sbit) {
- dda_next(xl);
- sbit >>= 1;
- INCS(lbit0);
- }
- if (!sbit) { /* Scan a run of zero bytes. */
+ int x0, n, bit;
+ byte *bp;
+ static const byte lmasks[9] = {
+ 0xff, 0x7f, 0x3f, 0x1f, 0xf, 7, 3, 1, 0
+ };
+ static const byte rmasks[9] = {
+ 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff
+ };
+
+ INCS(runs);
+
+ /* Scan a run of zeros. */
+ data ^= 0xff; /* invert */
+ while (data & sbit) {
+ dda_next(xl);
+ sbit >>= 1;
+ INCS(lbit0);
+ }
+ if (!sbit) { /* Scan a run of zero bytes. */
sw: if ((data = psrc[1]) != 0) {
- psrc++;
- INCS(byte00);
- } else if ((data = psrc[2]) != 0) {
- dda_state_next(xl.state, dxx8);
- psrc += 2;
- INCS(byte01);
- } else if ((data = psrc[3]) != 0) {
- dda_state_next(xl.state, dxx16);
- psrc += 3;
- INCS(byte02);
- } else if ((data = psrc[4]) != 0) {
- dda_state_next(xl.state, dxx24);
- psrc += 4;
- INCS(byte03);
- } else {
- dda_state_next(xl.state, dxx32);
- psrc += 4;
- INCS(byte04);
- goto sw;
- }
- if (data > 0xf)
- sbit = 0x80;
- else {
- sbit = 0x08;
- dda_state_next(xl.state, dxx4);
- }
- data ^= 0xff; /* invert */
- while (data & sbit) {
- dda_next(xl);
- sbit >>= 1;
- INCS(rbit0);
- }
- }
- x0 = dda_current_fixed2int(xl);
- if (psrc >= stop && sbit == stopbit) {
- /*
- * We've scanned the last run of 0s.
- * Prepare to fill the final run of 1s.
- */
- n = fixed2int(xl0 + x_extent) - x0;
- } else { /* Scan a run of ones. */
- /* We know the current bit is a one. */
- data ^= 0xff; /* un-invert */
- do {
- dda_next(xl);
- sbit >>= 1;
- INCS(lbit1);
- }
- while (data & sbit);
- if (!sbit) { /* Scan a run of 0xff bytes. */
- while ((data = *++psrc) == 0xff) {
- dda_state_next(xl.state, dxx8);
- INCS(byte1);
- }
- if (data < 0xf0)
- sbit = 0x80;
- else {
- sbit = 0x08;
- dda_state_next(xl.state, dxx4);
- }
- while (data & sbit) {
- dda_next(xl);
- sbit >>= 1;
- INCS(rbit1);
- }
- }
- n = dda_current_fixed2int(xl) - x0;
- }
-
- /* Fill the run in the scan line. */
- if (n < 0)
- x0 += n, n = -n;
- bp = line + (x0 >> 3);
- bit = x0 & 7;
- if ((n += bit) <= 8) {
- *bp ^= lmasks[bit] - lmasks[n];
- INCS(thin);
- } else if ((n -= 8) <= 8) {
- *bp ^= lmasks[bit];
- bp[1] ^= rmasks[n];
- INCS(thin2);
- } else {
- *bp++ ^= lmasks[bit];
- if (n >= 56) {
- int nb = n >> 3;
-
- memset(bp, one, nb);
- bp += nb;
- INCS(nwide);
- ADDS(bwide, nb);
- } else {
- ADDS(bfill, n >> 3);
- while ((n -= 8) >= 0)
- *bp++ = one;
- INCS(nfill);
- }
- *bp ^= rmasks[n & 7];
- }
- if (psrc >= stop && sbit == stopbit)
- break;
+ psrc++;
+ INCS(byte00);
+ } else if ((data = psrc[2]) != 0) {
+ dda_state_next(xl.state, dxx8);
+ psrc += 2;
+ INCS(byte01);
+ } else if ((data = psrc[3]) != 0) {
+ dda_state_next(xl.state, dxx16);
+ psrc += 3;
+ INCS(byte02);
+ } else if ((data = psrc[4]) != 0) {
+ dda_state_next(xl.state, dxx24);
+ psrc += 4;
+ INCS(byte03);
+ } else {
+ dda_state_next(xl.state, dxx32);
+ psrc += 4;
+ INCS(byte04);
+ goto sw;
+ }
+ if (data > 0xf)
+ sbit = 0x80;
+ else {
+ sbit = 0x08;
+ dda_state_next(xl.state, dxx4);
+ }
+ data ^= 0xff; /* invert */
+ while (data & sbit) {
+ dda_next(xl);
+ sbit >>= 1;
+ INCS(rbit0);
+ }
+ }
+ x0 = dda_current_fixed2int(xl);
+ if (psrc >= stop && sbit == stopbit) {
+ /*
+ * We've scanned the last run of 0s.
+ * Prepare to fill the final run of 1s.
+ */
+ n = fixed2int(xl0 + x_extent) - x0;
+ } else { /* Scan a run of ones. */
+ /* We know the current bit is a one. */
+ data ^= 0xff; /* un-invert */
+ do {
+ dda_next(xl);
+ sbit >>= 1;
+ INCS(lbit1);
+ }
+ while (data & sbit);
+ if (!sbit) { /* Scan a run of 0xff bytes. */
+ while ((data = *++psrc) == 0xff) {
+ dda_state_next(xl.state, dxx8);
+ INCS(byte1);
+ }
+ if (data < 0xf0)
+ sbit = 0x80;
+ else {
+ sbit = 0x08;
+ dda_state_next(xl.state, dxx4);
+ }
+ while (data & sbit) {
+ dda_next(xl);
+ sbit >>= 1;
+ INCS(rbit1);
+ }
+ }
+ n = dda_current_fixed2int(xl) - x0;
+ }
+
+ /* Fill the run in the scan line. */
+ if (n < 0)
+ x0 += n, n = -n;
+ bp = line + (x0 >> 3);
+ bit = x0 & 7;
+ if ((n += bit) <= 8) {
+ *bp ^= lmasks[bit] - lmasks[n];
+ INCS(thin);
+ } else if ((n -= 8) <= 8) {
+ *bp ^= lmasks[bit];
+ bp[1] ^= rmasks[n];
+ INCS(thin2);
+ } else {
+ *bp++ ^= lmasks[bit];
+ if (n >= 56) {
+ int nb = n >> 3;
+
+ memset(bp, one, nb);
+ bp += nb;
+ INCS(nwide);
+ ADDS(bwide, nb);
+ } else {
+ ADDS(bfill, n >> 3);
+ while ((n -= 8) >= 0)
+ *bp++ = one;
+ INCS(nfill);
+ }
+ *bp ^= rmasks[n & 7];
+ }
+ if (psrc >= stop && sbit == stopbit)
+ break;
}
}
/* Copy one rendered scan line to the device. */
static int
copy_portrait(gx_image_enum * penum, const byte * data, int dx, int raster,
- int x, int y, int w, int h, gx_device * dev)
+ int x, int y, int w, int h, gx_device * dev)
{
const gx_device_color *pdc0;
const gx_device_color *pdc1;
@@ -479,19 +479,19 @@ copy_portrait(gx_image_enum * penum, const byte * data, int dx, int raster,
* so it can only have 2 states: straight-through or invert.
*/
if (penum->map[0].table.lookup4x1to32[0])
- pdc0 = penum->icolor1, pdc1 = penum->icolor0;
+ pdc0 = penum->icolor1, pdc1 = penum->icolor0;
else
- pdc0 = penum->icolor0, pdc1 = penum->icolor1;
+ pdc0 = penum->icolor0, pdc1 = penum->icolor1;
data -= align;
dx += align << 3;
if (gx_dc_is_pure(pdc0) && gx_dc_is_pure(pdc1)) {
- /* Just use copy_mono. */
- dev_proc_copy_mono((*copy_mono)) =
- (h == 1 || (raster & (align_bitmap_mod - 1)) == 0 ?
- dev_proc(dev, copy_mono) : gx_copy_mono_unaligned);
- return (*copy_mono)
- (dev, data, dx, raster, gx_no_bitmap_id,
- x, y, w, h, pdc0->colors.pure, pdc1->colors.pure);
+ /* Just use copy_mono. */
+ dev_proc_copy_mono((*copy_mono)) =
+ (h == 1 || (raster & (align_bitmap_mod - 1)) == 0 ?
+ dev_proc(dev, copy_mono) : gx_copy_mono_unaligned);
+ return (*copy_mono)
+ (dev, data, dx, raster, gx_no_bitmap_id,
+ x, y, w, h, pdc0->colors.pure, pdc1->colors.pure);
}
/*
* At least one color isn't pure: if the other one is transparent, use
@@ -500,26 +500,26 @@ copy_portrait(gx_image_enum * penum, const byte * data, int dx, int raster,
* gx_begin_image1): a pure color with pixel value gx_no_color_index.
*/
{
- const gx_device_color *pdc;
- bool invert;
-
- if (DC_IS_NULL(pdc1)) {
- pdc = pdc0;
- invert = true;
- } else {
- if (!DC_IS_NULL(pdc0)) {
- int code = gx_device_color_fill_rectangle
- (pdc0, x, y, w, h, dev, lop_default, NULL);
-
- if (code < 0)
- return code;
- }
- pdc = pdc1;
- invert = false;
- }
- return (*pdc->type->fill_masked)
- (pdc, data, dx, raster, gx_no_bitmap_id, x, y, w, h,
- dev, lop_default, invert);
+ const gx_device_color *pdc;
+ bool invert;
+
+ if (DC_IS_NULL(pdc1)) {
+ pdc = pdc0;
+ invert = true;
+ } else {
+ if (!DC_IS_NULL(pdc0)) {
+ int code = gx_device_color_fill_rectangle
+ (pdc0, x, y, w, h, dev, lop_default, NULL);
+
+ if (code < 0)
+ return code;
+ }
+ pdc = pdc1;
+ invert = false;
+ }
+ return (*pdc->type->fill_masked)
+ (pdc, data, dx, raster, gx_no_bitmap_id, x, y, w, h,
+ dev, lop_default, invert);
}
}
@@ -528,7 +528,7 @@ copy_portrait(gx_image_enum * penum, const byte * data, int dx, int raster,
/* skew or rotation and pure colors. */
static int
image_render_simple(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
const fixed dxx = penum->dxx;
@@ -545,96 +545,96 @@ image_render_simple(gx_image_enum * penum, const byte * buffer, int data_x,
int code;
if (h == 0)
- return 0;
+ return 0;
if ((!DC_IS_NULL(pdc0) &&
- (code = gx_color_load(pdc0, penum->pis, dev)) < 0) ||
- (!DC_IS_NULL(pdc1) &&
- (code = gx_color_load(pdc1, penum->pis, dev)) < 0)
- )
- return code;
+ (code = gx_color_load(pdc0, penum->pis, dev)) < 0) ||
+ (!DC_IS_NULL(pdc1) &&
+ (code = gx_color_load(pdc1, penum->pis, dev)) < 0)
+ )
+ return code;
if (penum->line == 0) { /* A direct BitBlt is possible. */
- line = buffer;
- line_size = (w + 7) >> 3;
- line_width = w;
- line_x = 0;
+ line = buffer;
+ line_size = (w + 7) >> 3;
+ line_width = w;
+ line_x = 0;
} else if (copy_mono == dev_proc(&mem_mono_device, copy_mono) &&
- dxx > 0 && gx_dc_is_pure(pdc1) && gx_dc_is_pure(pdc0) &&
- /* We know the colors must be (0,1) or (1,0). */
- (pdc0->colors.pure ^ pdc1->colors.pure) == 1 &&
- !penum->clip_image &&
- /*
- * Even if clip_image is false, the clipping rectangle
- * might lie partly outside the device coordinate space
- * if the Margins values are non-zero.
- */
- ix >= 0 &&
- (ixr = fixed2int_pixround(xcur + penum->x_extent.x) - 1) <
- dev->width &&
- iy >= 0 && iy + ih <= dev->height
- ) {
- /* Do the operation directly into the memory device bitmap. */
- int line_ix;
- int ib_left = ix >> 3, ib_right = ixr >> 3;
- byte *scan_line = scan_line_base((gx_device_memory *) dev, iy);
- byte save_left, save_right, mask;
-
- line_x = ix & (align_bitmap_mod * 8 - 1);
- line_ix = ix - line_x;
- line_size = (ixr >> 3) + 1 - (line_ix >> 3);
- line_width = ixr + 1 - ix;
- /* We must save and restore any unmodified bits in */
- /* the two edge bytes. */
- save_left = scan_line[ib_left];
- save_right = scan_line[ib_right];
- image_simple_expand(scan_line + (line_ix >> 3), line_x,
- line_size, buffer, data_x, w, xcur,
- penum->x_extent.x,
- (byte)((pdc0->colors.pure == 0) !=
- (penum->map[0].table.lookup4x1to32[0] == 0) ?
- 0xff : 0));
- if (ix & 7)
- mask = (byte) (0xff00 >> (ix & 7)),
- scan_line[ib_left] =
- (save_left & mask) + (scan_line[ib_left] & ~mask);
- if ((ixr + 1) & 7)
- mask = (byte) (0xff00 >> ((ixr + 1) & 7)),
- scan_line[ib_right] =
- (scan_line[ib_right] & mask) + (save_right & ~mask);
- if (ih <= 1)
- return 1;
- /****** MAY BE UNALIGNED ******/
- line = scan_line + (line_ix >> 3);
- if (dxx < 0)
- ix -= line_width;
- for (dy = 1; dy < ih; dy++) {
- int code = (*copy_mono)
- (dev, line, line_x, line_size, gx_no_bitmap_id,
- ix, iy + dy, line_width, 1,
- (gx_color_index)0, (gx_color_index)1);
-
- if (code < 0)
- return code;
- }
- return 0;
+ dxx > 0 && gx_dc_is_pure(pdc1) && gx_dc_is_pure(pdc0) &&
+ /* We know the colors must be (0,1) or (1,0). */
+ (pdc0->colors.pure ^ pdc1->colors.pure) == 1 &&
+ !penum->clip_image &&
+ /*
+ * Even if clip_image is false, the clipping rectangle
+ * might lie partly outside the device coordinate space
+ * if the Margins values are non-zero.
+ */
+ ix >= 0 &&
+ (ixr = fixed2int_pixround(xcur + penum->x_extent.x) - 1) <
+ dev->width &&
+ iy >= 0 && iy + ih <= dev->height
+ ) {
+ /* Do the operation directly into the memory device bitmap. */
+ int line_ix;
+ int ib_left = ix >> 3, ib_right = ixr >> 3;
+ byte *scan_line = scan_line_base((gx_device_memory *) dev, iy);
+ byte save_left, save_right, mask;
+
+ line_x = ix & (align_bitmap_mod * 8 - 1);
+ line_ix = ix - line_x;
+ line_size = (ixr >> 3) + 1 - (line_ix >> 3);
+ line_width = ixr + 1 - ix;
+ /* We must save and restore any unmodified bits in */
+ /* the two edge bytes. */
+ save_left = scan_line[ib_left];
+ save_right = scan_line[ib_right];
+ image_simple_expand(scan_line + (line_ix >> 3), line_x,
+ line_size, buffer, data_x, w, xcur,
+ penum->x_extent.x,
+ (byte)((pdc0->colors.pure == 0) !=
+ (penum->map[0].table.lookup4x1to32[0] == 0) ?
+ 0xff : 0));
+ if (ix & 7)
+ mask = (byte) (0xff00 >> (ix & 7)),
+ scan_line[ib_left] =
+ (save_left & mask) + (scan_line[ib_left] & ~mask);
+ if ((ixr + 1) & 7)
+ mask = (byte) (0xff00 >> ((ixr + 1) & 7)),
+ scan_line[ib_right] =
+ (scan_line[ib_right] & mask) + (save_right & ~mask);
+ if (ih <= 1)
+ return 1;
+ /****** MAY BE UNALIGNED ******/
+ line = scan_line + (line_ix >> 3);
+ if (dxx < 0)
+ ix -= line_width;
+ for (dy = 1; dy < ih; dy++) {
+ int code = (*copy_mono)
+ (dev, line, line_x, line_size, gx_no_bitmap_id,
+ ix, iy + dy, line_width, 1,
+ (gx_color_index)0, (gx_color_index)1);
+
+ if (code < 0)
+ return code;
+ }
+ return 0;
} else {
- line = penum->line;
- line_size = penum->line_size;
- line_width = penum->line_width;
- line_x = ix & (align_bitmap_mod * 8 - 1);
- image_simple_expand(penum->line, line_x, line_size,
- buffer, data_x, w, xcur,
- penum->x_extent.x, 0);
+ line = penum->line;
+ line_size = penum->line_size;
+ line_width = penum->line_width;
+ line_x = ix & (align_bitmap_mod * 8 - 1);
+ image_simple_expand(penum->line, line_x, line_size,
+ buffer, data_x, w, xcur,
+ penum->x_extent.x, 0);
}
/* Finally, transfer the scan line to the device. */
if (dxx < 0)
- ix -= line_width;
+ ix -= line_width;
for (dy = 0; dy < ih; dy++) {
- int code = copy_portrait(penum, line, line_x, line_size,
- ix, iy + dy, line_width, 1, dev);
+ int code = copy_portrait(penum, line, line_x, line_size,
+ ix, iy + dy, line_width, 1, dev);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 1;
@@ -645,7 +645,7 @@ image_render_simple(gx_image_enum * penum, const byte * buffer, int data_x,
static int copy_landscape(gx_image_enum *, int, int, bool, gx_device *);
static int
image_render_landscape(gx_image_enum * penum, const byte * buffer, int data_x,
- uint w, int h, gx_device * dev)
+ uint w, int h, gx_device * dev)
{
byte *line = penum->line;
uint raster = bitmap_raster(penum->line_width);
@@ -656,62 +656,62 @@ image_render_landscape(gx_image_enum * penum, const byte * buffer, int data_x,
bool y_neg = penum->dxy < 0;
if (is_fneg(penum->matrix.yx))
- ix += iw, iw = -iw, xinc = -1;
+ ix += iw, iw = -iw, xinc = -1;
else
- xinc = 1;
+ xinc = 1;
/*
* Because of clipping, there may be discontinuous jumps in the values
* of ix (xci). If this happens, or if we are at the end of the data or
* a client has requested flushing, flush the flipping buffer.
*/
if (ix != penum->xi_next || h == 0) {
- int xi = penum->xi_next;
- int code =
- (xinc > 0 ?
- copy_landscape(penum, penum->line_xy, xi, y_neg, dev) :
- copy_landscape(penum, xi, penum->line_xy, y_neg, dev));
-
- if (code < 0)
- return code;
- penum->line_xy = penum->xi_next = ix;
- if (h == 0)
- return code;
+ int xi = penum->xi_next;
+ int code =
+ (xinc > 0 ?
+ copy_landscape(penum, penum->line_xy, xi, y_neg, dev) :
+ copy_landscape(penum, xi, penum->line_xy, y_neg, dev));
+
+ if (code < 0)
+ return code;
+ penum->line_xy = penum->xi_next = ix;
+ if (h == 0)
+ return code;
}
for (; iw != 0; iw -= xinc) {
- if (xinc < 0)
- --ix;
- xmod = ix & 7;
- row = line + xmod * raster;
- if (orig_row == 0) {
- image_simple_expand(row, 0, raster,
- buffer, data_x, w,
- dda_current(penum->dda.pixel0.y),
- penum->x_extent.y, 0);
- orig_row = row;
- } else
- memcpy(row, orig_row, raster);
- if (xinc > 0) {
- ++ix;
- if (xmod == 7) {
- int code =
- copy_landscape(penum, penum->line_xy, ix, y_neg, dev);
-
- if (code < 0)
- return code;
- orig_row = 0;
- penum->line_xy = ix;
- }
- } else {
- if (xmod == 0) {
- int code =
- copy_landscape(penum, ix, penum->line_xy, y_neg, dev);
-
- if (code < 0)
- return code;
- orig_row = 0;
- penum->line_xy = ix;
- }
- }
+ if (xinc < 0)
+ --ix;
+ xmod = ix & 7;
+ row = line + xmod * raster;
+ if (orig_row == 0) {
+ image_simple_expand(row, 0, raster,
+ buffer, data_x, w,
+ dda_current(penum->dda.pixel0.y),
+ penum->x_extent.y, 0);
+ orig_row = row;
+ } else
+ memcpy(row, orig_row, raster);
+ if (xinc > 0) {
+ ++ix;
+ if (xmod == 7) {
+ int code =
+ copy_landscape(penum, penum->line_xy, ix, y_neg, dev);
+
+ if (code < 0)
+ return code;
+ orig_row = 0;
+ penum->line_xy = ix;
+ }
+ } else {
+ if (xmod == 0) {
+ int code =
+ copy_landscape(penum, ix, penum->line_xy, y_neg, dev);
+
+ if (code < 0)
+ return code;
+ orig_row = 0;
+ penum->line_xy = ix;
+ }
+ }
}
penum->xi_next = ix;
return 0;
@@ -720,7 +720,7 @@ image_render_landscape(gx_image_enum * penum, const byte * buffer, int data_x,
/* Flip and copy one group of scan lines. */
static int
copy_landscape(gx_image_enum * penum, int x0, int x1, bool y_neg,
- gx_device * dev)
+ gx_device * dev)
{
byte *line = penum->line;
uint line_width = penum->line_width;
@@ -730,22 +730,22 @@ copy_landscape(gx_image_enum * penum, int x0, int x1, bool y_neg,
int y = fixed2int_pixround(dda_current(penum->dda.pixel0.y));
if (w == 0 || line_width == 0)
- return 0;
+ return 0;
/* Flip the buffered data from raster x 8 to align_bitmap_mod x */
/* line_width. */
if (line_width > 0) {
- int i;
+ int i;
- for (i = (line_width - 1) >> 3; i >= 0; --i)
- memflip8x8(line + i, raster,
- flipped + (i << (log2_align_bitmap_mod + 3)),
- align_bitmap_mod);
+ for (i = (line_width - 1) >> 3; i >= 0; --i)
+ memflip8x8(line + i, raster,
+ flipped + (i << (log2_align_bitmap_mod + 3)),
+ align_bitmap_mod);
}
/* Transfer the scan lines to the device. */
if (w < 0)
- x0 = x1, w = -w;
+ x0 = x1, w = -w;
if (y_neg)
- y -= line_width;
+ y -= line_width;
return copy_portrait(penum, flipped, x0 & 7, align_bitmap_mod,
- x0, y, w, line_width, dev);
+ x0, y, w, line_width, dev);
}
diff --git a/gs/base/gximag3x.c b/gs/base/gximag3x.c
index 71b02fdba..4bf46521a 100644
--- a/gs/base/gximag3x.c
+++ b/gs/base/gximag3x.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,14 +81,14 @@ gs_image3x_t_init(gs_image3x_t * pim, gs_color_space * color_space)
typedef struct image3x_channel_state_s {
gx_image_enum_common_t *info;
gx_device *mdev; /* gx_device_memory in default impl. */
- /* (only for masks) */
+ /* (only for masks) */
gs_image3_interleave_type_t InterleaveType;
int width, height, full_height, depth;
byte *data; /* (if chunky) */
/* Only the following change dynamically. */
int y;
int skip; /* only for masks, # of rows to skip, */
- /* see below */
+ /* see below */
} image3x_channel_state_t;
typedef struct gx_image3x_enum_s {
gx_image_enum_common;
@@ -116,20 +116,20 @@ typedef struct image3x_channel_values_s {
gs_image_t image;
} image3x_channel_values_t;
static int check_image3x_mask(const gs_image3x_t *pim,
- const gs_image3x_mask_t *pimm,
- const image3x_channel_values_t *ppcv,
- image3x_channel_values_t *pmcv,
- image3x_channel_state_t *pmcs,
- gs_memory_t *mem);
+ const gs_image3x_mask_t *pimm,
+ const image3x_channel_values_t *ppcv,
+ image3x_channel_values_t *pmcv,
+ image3x_channel_state_t *pmcs,
+ gs_memory_t *mem);
int
gx_begin_image3x_generic(gx_device * dev,
- const gs_imager_state *pis, const gs_matrix *pmat,
- const gs_image_common_t *pic, const gs_int_rect *prect,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- image3x_make_mid_proc_t make_mid,
- image3x_make_mcde_proc_t make_mcde,
- gx_image_enum_common_t **pinfo)
+ const gs_imager_state *pis, const gs_matrix *pmat,
+ const gs_image_common_t *pic, const gs_int_rect *prect,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ image3x_make_mid_proc_t make_mid,
+ image3x_make_mcde_proc_t make_mcde,
+ gx_image_enum_common_t **pinfo)
{
const gs_image3x_t *pim = (const gs_image3x_t *)pic;
gx_image3x_enum_t *penum;
@@ -144,209 +144,209 @@ gx_begin_image3x_generic(gx_device * dev,
/* Validate the parameters. */
if (pim->Height <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
penum = gs_alloc_struct(mem, gx_image3x_enum_t, &st_image3x_enum,
- "gx_begin_image3x");
+ "gx_begin_image3x");
if (penum == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Initialize pointers now in case we bail out. */
penum->mask[0].info = 0, penum->mask[0].mdev = 0, penum->mask[0].data = 0;
penum->mask[1].info = 0, penum->mask[1].mdev = 0, penum->mask[1].data = 0;
penum->pixel.info = 0, penum->pixel.data = 0;
if (prect)
- pixel.rect = *prect;
+ pixel.rect = *prect;
else {
- pixel.rect.p.x = pixel.rect.p.y = 0;
- pixel.rect.q.x = pim->Width;
- pixel.rect.q.y = pim->Height;
+ pixel.rect.p.x = pixel.rect.p.y = 0;
+ pixel.rect.q.x = pim->Width;
+ pixel.rect.q.y = pim->Height;
}
if ((code = gs_matrix_invert(&pim->ImageMatrix, &pixel.matrix)) < 0 ||
- (code = gs_point_transform(pim->Width, pim->Height, &pixel.matrix,
- &pixel.corner)) < 0 ||
- (code = check_image3x_mask(pim, &pim->Opacity, &pixel, &mask[0],
- &penum->mask[0], mem)) < 0 ||
- (code = check_image3x_mask(pim, &pim->Shape, &pixel, &mask[1],
- &penum->mask[1], mem)) < 0
- ) {
- goto out0;
+ (code = gs_point_transform(pim->Width, pim->Height, &pixel.matrix,
+ &pixel.corner)) < 0 ||
+ (code = check_image3x_mask(pim, &pim->Opacity, &pixel, &mask[0],
+ &penum->mask[0], mem)) < 0 ||
+ (code = check_image3x_mask(pim, &pim->Shape, &pixel, &mask[1],
+ &penum->mask[1], mem)) < 0
+ ) {
+ goto out0;
}
penum->num_components =
- gs_color_space_num_components(pim->ColorSpace);
+ gs_color_space_num_components(pim->ColorSpace);
gx_image_enum_common_init((gx_image_enum_common_t *) penum,
- (const gs_data_image_t *)pim,
- &image3x_enum_procs, dev,
- 1 + penum->num_components,
- pim->format);
+ (const gs_data_image_t *)pim,
+ &image3x_enum_procs, dev,
+ 1 + penum->num_components,
+ pim->format);
penum->pixel.width = pixel.rect.q.x - pixel.rect.p.x;
penum->pixel.height = pixel.rect.q.y - pixel.rect.p.y;
penum->pixel.full_height = pim->Height;
penum->pixel.y = 0;
if (penum->mask[0].data || penum->mask[1].data) {
- /* Also allocate a row buffer for the pixel data. */
- penum->pixel.data =
- gs_alloc_bytes(mem,
- (penum->pixel.width * pim->BitsPerComponent *
- penum->num_components + 7) >> 3,
- "gx_begin_image3x(pixel.data)");
- if (penum->pixel.data == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out1;
- }
+ /* Also allocate a row buffer for the pixel data. */
+ penum->pixel.data =
+ gs_alloc_bytes(mem,
+ (penum->pixel.width * pim->BitsPerComponent *
+ penum->num_components + 7) >> 3,
+ "gx_begin_image3x(pixel.data)");
+ if (penum->pixel.data == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out1;
+ }
}
penum->bpc = pim->BitsPerComponent;
penum->memory = mem;
if (pmat == 0)
- pmat = &ctm_only(pis);
+ pmat = &ctm_only(pis);
for (i = 0; i < NUM_MASKS; ++i) {
- gs_rect mrect;
- gx_device *mdev;
- /*
- * The mask data has to be defined in a DevicePixel color space
- * of the correct depth so that no color mapping will occur.
- */
- /****** FREE COLOR SPACE ON ERROR OR AT END ******/
- gs_color_space *pmcs;
-
- if (penum->mask[i].depth == 0) { /* mask not supplied */
- midev[i] = 0;
- minfo[i] = 0;
- continue;
- }
- code = gs_cspace_new_DevicePixel(mem, &pmcs, penum->mask[i].depth);
- if (code < 0)
- return code;
- mrect.p.x = mrect.p.y = 0;
- mrect.q.x = penum->mask[i].width;
- mrect.q.y = penum->mask[i].height;
- if ((code = gs_matrix_multiply(&mask[i].matrix, pmat, &mat)) < 0 ||
- (code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
- )
- return code;
- origin[i].x = (int)floor(mrect.p.x);
- origin[i].y = (int)floor(mrect.p.y);
- code = make_mid(&mdev, dev,
- (int)ceil(mrect.q.x) - origin[i].x,
- (int)ceil(mrect.q.y) - origin[i].y,
- penum->mask[i].depth, mem);
+ gs_rect mrect;
+ gx_device *mdev;
+ /*
+ * The mask data has to be defined in a DevicePixel color space
+ * of the correct depth so that no color mapping will occur.
+ */
+ /****** FREE COLOR SPACE ON ERROR OR AT END ******/
+ gs_color_space *pmcs;
+
+ if (penum->mask[i].depth == 0) { /* mask not supplied */
+ midev[i] = 0;
+ minfo[i] = 0;
+ continue;
+ }
+ code = gs_cspace_new_DevicePixel(mem, &pmcs, penum->mask[i].depth);
+ if (code < 0)
+ return code;
+ mrect.p.x = mrect.p.y = 0;
+ mrect.q.x = penum->mask[i].width;
+ mrect.q.y = penum->mask[i].height;
+ if ((code = gs_matrix_multiply(&mask[i].matrix, pmat, &mat)) < 0 ||
+ (code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
+ )
+ return code;
+ origin[i].x = (int)floor(mrect.p.x);
+ origin[i].y = (int)floor(mrect.p.y);
+ code = make_mid(&mdev, dev,
+ (int)ceil(mrect.q.x) - origin[i].x,
+ (int)ceil(mrect.q.y) - origin[i].y,
+ penum->mask[i].depth, mem);
mdev->device_icc_profile = dev->device_icc_profile;
rc_increment(dev->device_icc_profile);
- if (code < 0)
- goto out1;
- penum->mask[i].mdev = mdev;
+ if (code < 0)
+ goto out1;
+ penum->mask[i].mdev = mdev;
gs_image_t_init(&mask[i].image, pmcs);
- mask[i].image.ColorSpace = pmcs;
- mask[i].image.adjust = false;
+ mask[i].image.ColorSpace = pmcs;
+ mask[i].image.adjust = false;
mask[i].image.image_parent_type = gs_image_type3x;
- {
- const gx_image_type_t *type1 = mask[i].image.type;
- const gs_image3x_mask_t *pixm =
- (i == 0 ? &pim->Opacity : &pim->Shape);
+ {
+ const gx_image_type_t *type1 = mask[i].image.type;
+ const gs_image3x_mask_t *pixm =
+ (i == 0 ? &pim->Opacity : &pim->Shape);
/* Use memcpy because direct assignment breaks ANSI aliasing */
/* rules and causes SEGV with gcc 4.5.1 */
memcpy(&mask[i].image, &pixm->MaskDict, sizeof(pixm->MaskDict));
- mask[i].image.type = type1;
- mask[i].image.BitsPerComponent = pixm->MaskDict.BitsPerComponent;
- }
- {
- gs_matrix m_mat;
-
- /*
- * Adjust the translation for rendering the mask to include a
- * negative translation by origin.{x,y} in device space.
- */
- m_mat = *pmat;
- m_mat.tx -= origin[i].x;
- m_mat.ty -= origin[i].y;
- /*
- * Peter put in a comment that said " Note that pis = NULL here,
- * since we don't want to have to create another imager state with
- * default log_op, etc." and passed NULL instead of pis to this
- * routine. However Image type 1 need the imager state (see
- * bug 688348) thus his optimization was removed.
- * dcolor = NULL is OK because this is an opaque image with
- * CombineWithColor = false.
- */
- code = gx_device_begin_typed_image(mdev, pis, &m_mat,
- (const gs_image_common_t *)&mask[i].image,
- &mask[i].rect, NULL, NULL,
- mem, &penum->mask[i].info);
- if (code < 0)
- goto out2;
- }
- midev[i] = mdev;
- minfo[i] = penum->mask[i].info;
+ mask[i].image.type = type1;
+ mask[i].image.BitsPerComponent = pixm->MaskDict.BitsPerComponent;
+ }
+ {
+ gs_matrix m_mat;
+
+ /*
+ * Adjust the translation for rendering the mask to include a
+ * negative translation by origin.{x,y} in device space.
+ */
+ m_mat = *pmat;
+ m_mat.tx -= origin[i].x;
+ m_mat.ty -= origin[i].y;
+ /*
+ * Peter put in a comment that said " Note that pis = NULL here,
+ * since we don't want to have to create another imager state with
+ * default log_op, etc." and passed NULL instead of pis to this
+ * routine. However Image type 1 need the imager state (see
+ * bug 688348) thus his optimization was removed.
+ * dcolor = NULL is OK because this is an opaque image with
+ * CombineWithColor = false.
+ */
+ code = gx_device_begin_typed_image(mdev, pis, &m_mat,
+ (const gs_image_common_t *)&mask[i].image,
+ &mask[i].rect, NULL, NULL,
+ mem, &penum->mask[i].info);
+ if (code < 0)
+ goto out2;
+ }
+ midev[i] = mdev;
+ minfo[i] = penum->mask[i].info;
}
gs_image_t_init(&pixel.image, pim->ColorSpace);
{
- const gx_image_type_t *type1 = pixel.image.type;
+ const gx_image_type_t *type1 = pixel.image.type;
- *(gs_pixel_image_t *)&pixel.image = *(const gs_pixel_image_t *)pim;
- pixel.image.type = type1;
+ *(gs_pixel_image_t *)&pixel.image = *(const gs_pixel_image_t *)pim;
+ pixel.image.type = type1;
pixel.image.image_parent_type = gs_image_type3x;
}
code = make_mcde(dev, pis, pmat, (const gs_image_common_t *)&pixel.image,
- prect, pdcolor, pcpath, mem, &penum->pixel.info,
- &pcdev, midev, minfo, origin, pim);
+ prect, pdcolor, pcpath, mem, &penum->pixel.info,
+ &pcdev, midev, minfo, origin, pim);
if (code < 0)
- goto out3;
+ goto out3;
penum->pcdev = pcdev;
/*
* Set num_planes, plane_widths, and plane_depths from the values in the
* enumerators for the mask(s) and the image data.
*/
{
- int added_depth = 0;
- int pi = 0;
-
- for (i = 0; i < NUM_MASKS; ++i) {
- if (penum->mask[i].depth == 0) /* no mask */
- continue;
- switch (penum->mask[i].InterleaveType) {
- case interleave_chunky:
- /* Add the mask data to the depth of the image data. */
- added_depth += pim->BitsPerComponent;
- break;
- case interleave_separate_source:
- /* Insert the mask as a separate plane. */
- penum->plane_widths[pi] = penum->mask[i].width;
- penum->plane_depths[pi] = penum->mask[i].depth;
- ++pi;
- break;
- default: /* can't happen */
- code = gs_note_error(gs_error_Fatal);
- goto out3;
- }
- }
- memcpy(&penum->plane_widths[pi], &penum->pixel.info->plane_widths[0],
- penum->pixel.info->num_planes * sizeof(penum->plane_widths[0]));
- memcpy(&penum->plane_depths[pi], &penum->pixel.info->plane_depths[0],
- penum->pixel.info->num_planes * sizeof(penum->plane_depths[0]));
- penum->plane_depths[pi] += added_depth;
- penum->num_planes = pi + penum->pixel.info->num_planes;
+ int added_depth = 0;
+ int pi = 0;
+
+ for (i = 0; i < NUM_MASKS; ++i) {
+ if (penum->mask[i].depth == 0) /* no mask */
+ continue;
+ switch (penum->mask[i].InterleaveType) {
+ case interleave_chunky:
+ /* Add the mask data to the depth of the image data. */
+ added_depth += pim->BitsPerComponent;
+ break;
+ case interleave_separate_source:
+ /* Insert the mask as a separate plane. */
+ penum->plane_widths[pi] = penum->mask[i].width;
+ penum->plane_depths[pi] = penum->mask[i].depth;
+ ++pi;
+ break;
+ default: /* can't happen */
+ code = gs_note_error(gs_error_Fatal);
+ goto out3;
+ }
+ }
+ memcpy(&penum->plane_widths[pi], &penum->pixel.info->plane_widths[0],
+ penum->pixel.info->num_planes * sizeof(penum->plane_widths[0]));
+ memcpy(&penum->plane_depths[pi], &penum->pixel.info->plane_depths[0],
+ penum->pixel.info->num_planes * sizeof(penum->plane_depths[0]));
+ penum->plane_depths[pi] += added_depth;
+ penum->num_planes = pi + penum->pixel.info->num_planes;
}
if (midev[0])
- gx_device_retain(midev[0], true); /* will free explicitly */
+ gx_device_retain(midev[0], true); /* will free explicitly */
if (midev[1])
- gx_device_retain(midev[1], true); /* ditto */
+ gx_device_retain(midev[1], true); /* ditto */
gx_device_retain(pcdev, true); /* ditto */
*pinfo = (gx_image_enum_common_t *) penum;
return 0;
out3:
if (penum->mask[1].info)
- gx_image_end(penum->mask[1].info, false);
+ gx_image_end(penum->mask[1].info, false);
if (penum->mask[0].info)
- gx_image_end(penum->mask[0].info, false);
+ gx_image_end(penum->mask[0].info, false);
out2:
if (penum->mask[1].mdev) {
- gs_closedevice(penum->mask[1].mdev);
- gs_free_object(mem, penum->mask[1].mdev,
- "gx_begin_image3x(mask[1].mdev)");
+ gs_closedevice(penum->mask[1].mdev);
+ gs_free_object(mem, penum->mask[1].mdev,
+ "gx_begin_image3x(mask[1].mdev)");
}
if (penum->mask[0].mdev) {
- gs_closedevice(penum->mask[0].mdev);
- gs_free_object(mem, penum->mask[0].mdev,
- "gx_begin_image3x(mask[0].mdev)");
+ gs_closedevice(penum->mask[0].mdev);
+ gs_free_object(mem, penum->mask[0].mdev,
+ "gx_begin_image3x(mask[0].mdev)");
}
out1:
gs_free_object(mem, penum->mask[0].data, "gx_begin_image3x(mask[0].data)");
@@ -360,9 +360,9 @@ static bool
check_image3x_extent(floatp mask_coeff, floatp data_coeff)
{
if (mask_coeff == 0)
- return data_coeff == 0;
+ return data_coeff == 0;
if (data_coeff == 0 || (mask_coeff > 0) != (data_coeff > 0))
- return false;
+ return false;
return true;
}
/*
@@ -373,67 +373,67 @@ check_image3x_extent(floatp mask_coeff, floatp data_coeff)
*/
static bool
check_image3x_mask(const gs_image3x_t *pim, const gs_image3x_mask_t *pimm,
- const image3x_channel_values_t *ppcv,
- image3x_channel_values_t *pmcv,
- image3x_channel_state_t *pmcs, gs_memory_t *mem)
+ const image3x_channel_values_t *ppcv,
+ image3x_channel_values_t *pmcv,
+ image3x_channel_state_t *pmcs, gs_memory_t *mem)
{
int mask_width = pimm->MaskDict.Width, mask_height = pimm->MaskDict.Height;
int code;
if (pimm->MaskDict.BitsPerComponent == 0) { /* mask missing */
- pmcs->depth = 0;
+ pmcs->depth = 0;
pmcs->InterleaveType = 0; /* not a valid type */
- return 0;
+ return 0;
}
if (mask_height <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
switch (pimm->InterleaveType) {
- /*case interleave_scan_lines:*/ /* not supported */
- default:
- return_error(gs_error_rangecheck);
- case interleave_chunky:
- if (mask_width != pim->Width ||
- mask_height != pim->Height ||
- pimm->MaskDict.BitsPerComponent != pim->BitsPerComponent ||
- pim->format != gs_image_format_chunky
- )
- return_error(gs_error_rangecheck);
- break;
- case interleave_separate_source:
- switch (pimm->MaskDict.BitsPerComponent) {
- case 1: case 2: case 4: case 8: case 12: case 16:
- break;
- default:
- return_error(gs_error_rangecheck);
- }
+ /*case interleave_scan_lines:*/ /* not supported */
+ default:
+ return_error(gs_error_rangecheck);
+ case interleave_chunky:
+ if (mask_width != pim->Width ||
+ mask_height != pim->Height ||
+ pimm->MaskDict.BitsPerComponent != pim->BitsPerComponent ||
+ pim->format != gs_image_format_chunky
+ )
+ return_error(gs_error_rangecheck);
+ break;
+ case interleave_separate_source:
+ switch (pimm->MaskDict.BitsPerComponent) {
+ case 1: case 2: case 4: case 8: case 12: case 16:
+ break;
+ default:
+ return_error(gs_error_rangecheck);
+ }
}
if (!check_image3x_extent(pim->ImageMatrix.xx,
- pimm->MaskDict.ImageMatrix.xx) ||
- !check_image3x_extent(pim->ImageMatrix.xy,
- pimm->MaskDict.ImageMatrix.xy) ||
- !check_image3x_extent(pim->ImageMatrix.yx,
- pimm->MaskDict.ImageMatrix.yx) ||
- !check_image3x_extent(pim->ImageMatrix.yy,
- pimm->MaskDict.ImageMatrix.yy)
- )
- return_error(gs_error_rangecheck);
+ pimm->MaskDict.ImageMatrix.xx) ||
+ !check_image3x_extent(pim->ImageMatrix.xy,
+ pimm->MaskDict.ImageMatrix.xy) ||
+ !check_image3x_extent(pim->ImageMatrix.yx,
+ pimm->MaskDict.ImageMatrix.yx) ||
+ !check_image3x_extent(pim->ImageMatrix.yy,
+ pimm->MaskDict.ImageMatrix.yy)
+ )
+ return_error(gs_error_rangecheck);
if ((code = gs_matrix_invert(&pimm->MaskDict.ImageMatrix, &pmcv->matrix)) < 0 ||
- (code = gs_point_transform(mask_width, mask_height,
- &pmcv->matrix, &pmcv->corner)) < 0
- )
- return code;
+ (code = gs_point_transform(mask_width, mask_height,
+ &pmcv->matrix, &pmcv->corner)) < 0
+ )
+ return code;
if (fabs(ppcv->matrix.tx - pmcv->matrix.tx) >= 0.5 ||
- fabs(ppcv->matrix.ty - pmcv->matrix.ty) >= 0.5 ||
- fabs(ppcv->corner.x - pmcv->corner.x) >= 0.5 ||
- fabs(ppcv->corner.y - pmcv->corner.y) >= 0.5
- )
- return_error(gs_error_rangecheck);
+ fabs(ppcv->matrix.ty - pmcv->matrix.ty) >= 0.5 ||
+ fabs(ppcv->corner.x - pmcv->corner.x) >= 0.5 ||
+ fabs(ppcv->corner.y - pmcv->corner.y) >= 0.5
+ )
+ return_error(gs_error_rangecheck);
pmcv->rect.p.x = ppcv->rect.p.x * mask_width / pim->Width;
pmcv->rect.p.y = ppcv->rect.p.y * mask_height / pim->Height;
pmcv->rect.q.x = (ppcv->rect.q.x * mask_width + pim->Width - 1) /
- pim->Width;
+ pim->Width;
pmcv->rect.q.y = (ppcv->rect.q.y * mask_height + pim->Height - 1) /
- pim->Height;
+ pim->Height;
/* Initialize the channel state in the enumerator. */
pmcs->InterleaveType = pimm->InterleaveType;
pmcs->width = pmcv->rect.q.x - pmcv->rect.p.x;
@@ -441,13 +441,13 @@ check_image3x_mask(const gs_image3x_t *pim, const gs_image3x_mask_t *pimm,
pmcs->full_height = pimm->MaskDict.Height;
pmcs->depth = pimm->MaskDict.BitsPerComponent;
if (pmcs->InterleaveType == interleave_chunky) {
- /* Allocate a buffer for the data. */
- pmcs->data =
- gs_alloc_bytes(mem,
- (pmcs->width * pimm->MaskDict.BitsPerComponent + 7) >> 3,
- "gx_begin_image3x(mask data)");
- if (pmcs->data == 0)
- return_error(gs_error_VMerror);
+ /* Allocate a buffer for the data. */
+ pmcs->data =
+ gs_alloc_bytes(mem,
+ (pmcs->width * pimm->MaskDict.BitsPerComponent + 7) >> 3,
+ "gx_begin_image3x(mask data)");
+ if (pmcs->data == 0)
+ return_error(gs_error_VMerror);
}
pmcs->y = pmcs->skip = 0;
return 0;
@@ -459,7 +459,7 @@ check_image3x_mask(const gs_image3x_t *pim, const gs_image3x_mask_t *pimm,
*/
static int
channel_next(const image3x_channel_state_t *pics1,
- const image3x_channel_state_t *pics2)
+ const image3x_channel_state_t *pics2)
{
/*
* The invariant we need to maintain is that we always have at least as
@@ -476,33 +476,33 @@ channel_next(const image3x_channel_state_t *pics1,
#ifdef DEBUG
if (current < 0)
- lprintf4("channel_next invariant fails: %d/%d < %d/%d\n",
- pics1->y, pics1->full_height,
- pics2->y, pics2->full_height);
+ lprintf4("channel_next invariant fails: %d/%d < %d/%d\n",
+ pics1->y, pics1->full_height,
+ pics2->y, pics2->full_height);
#endif
return ((current -= h1) >= 0 ? -1 :
- current + h2 >= 0 ? 0 : 1);
+ current + h2 >= 0 ? 0 : 1);
}
/* Define the default implementation of ImageType 3 processing. */
static IMAGE3X_MAKE_MID_PROC(make_midx_default); /* check prototype */
static int
make_midx_default(gx_device **pmidev, gx_device *dev, int width, int height,
- int depth, gs_memory_t *mem)
+ int depth, gs_memory_t *mem)
{
const gx_device_memory *mdproto = gdev_mem_device_for_bits(depth);
gx_device_memory *midev;
int code;
if (width != 0)
- if (height > max_ulong/width) /* protect against overflow in bitmap size */
- return_error(gs_error_VMerror);
+ if (height > max_ulong/width) /* protect against overflow in bitmap size */
+ return_error(gs_error_VMerror);
if (mdproto == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
midev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "make_mid_default");
+ "make_mid_default");
if (midev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gs_make_mem_device(midev, mdproto, mem, 0, NULL);
midev->bitmap_memory = mem;
midev->width = width;
@@ -511,26 +511,26 @@ make_midx_default(gx_device **pmidev, gx_device *dev, int width, int height,
gx_device_fill_in_procs((gx_device *)midev);
code = dev_proc(midev, open_device)((gx_device *)midev);
if (code < 0) {
- gs_free_object(mem, midev, "make_midx_default");
- return code;
+ gs_free_object(mem, midev, "make_midx_default");
+ return code;
}
midev->is_open = true;
dev_proc(midev, fill_rectangle)
- ((gx_device *)midev, 0, 0, width, height, (gx_color_index)0);
+ ((gx_device *)midev, 0, 0, width, height, (gx_color_index)0);
*pmidev = (gx_device *)midev;
return 0;
}
static IMAGE3X_MAKE_MCDE_PROC(make_mcdex_default); /* check prototype */
static int
make_mcdex_default(gx_device *dev, const gs_imager_state *pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect *prect, const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- gx_image_enum_common_t **pinfo,
- gx_device **pmcdev, gx_device *midev[2],
- gx_image_enum_common_t *pminfo[2],
- const gs_int_point origin[2],
- const gs_image3x_t *pim)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect *prect, const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ gx_image_enum_common_t **pinfo,
+ gx_device **pmcdev, gx_device *midev[2],
+ gx_image_enum_common_t *pminfo[2],
+ const gs_int_point origin[2],
+ const gs_image3x_t *pim)
{
/**************** NYI ****************/
/*
@@ -542,41 +542,41 @@ make_mcdex_default(gx_device *dev, const gs_imager_state *pis,
* The most convenient device for this purpose is the bbox device.
*/
gx_device_bbox *bbdev =
- gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
- "make_mcdex_default");
+ gs_alloc_struct_immovable(mem, gx_device_bbox, &st_device_bbox,
+ "make_mcdex_default");
int code;
if (bbdev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_device_bbox_init(bbdev, dev, mem);
gx_device_bbox_fwd_open_close(bbdev, false);
code = dev_proc(bbdev, begin_typed_image)
- ((gx_device *)bbdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
- pinfo);
+ ((gx_device *)bbdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ pinfo);
if (code < 0) {
- gs_free_object(mem, bbdev, "make_mcdex_default");
- return code;
+ gs_free_object(mem, bbdev, "make_mcdex_default");
+ return code;
}
*pmcdev = (gx_device *)bbdev;
return 0;
}
static int
gx_begin_image3x(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
return gx_begin_image3x_generic(dev, pis, pmat, pic, prect, pdcolor,
- pcpath, mem, make_midx_default,
- make_mcdex_default, pinfo);
+ pcpath, mem, make_midx_default,
+ make_mcdex_default, pinfo);
}
/* Process the next piece of an ImageType 3 image. */
static int
gx_image3x_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_image3x_enum_t *penum = (gx_image3x_enum_t *) info;
int pixel_height = penum->pixel.height;
@@ -592,15 +592,15 @@ gx_image3x_plane_data(gx_image_enum_common_t * info,
int num_chunky = 0;
for (i = 0; i < NUM_MASKS; ++i) {
- int mh = mask_height[i] = penum->mask[i].height;
-
- mask_plane[i].data = 0;
- mask_used[i] = 0;
- if (!penum->mask[i].depth)
- continue;
- h1 = min(h1, mh - penum->mask[i].y);
- if (penum->mask[i].InterleaveType == interleave_chunky)
- ++num_chunky;
+ int mh = mask_height[i] = penum->mask[i].height;
+
+ mask_plane[i].data = 0;
+ mask_used[i] = 0;
+ if (!penum->mask[i].depth)
+ continue;
+ h1 = min(h1, mh - penum->mask[i].y);
+ if (penum->mask[i].InterleaveType == interleave_chunky)
+ ++num_chunky;
}
h = min(height, h1);
/* Initialized rows_used in case we get an error. */
@@ -609,162 +609,162 @@ gx_image3x_plane_data(gx_image_enum_common_t * info,
/* FIX_ME. In the soft mask branch
the file associated with bug 689290
gets into an endless loop. This
- is related to the size mismatch of the
- soft mask which is 1x1 and the
+ is related to the size mismatch of the
+ soft mask which is 1x1 and the
image size */
if (h <= 0)
-#ifdef ENDLESS_LOOP
- return 0;
+#ifdef ENDLESS_LOOP
+ return 0;
#else
return 1;
#endif
/* Handle masks from separate sources. */
for (i = 0; i < NUM_MASKS; ++i)
- if (penum->mask[i].InterleaveType == interleave_separate_source) {
- /*
- * In order to be able to recover from interruptions, we must
- * limit separate-source processing to 1 scan line at a time.
- */
- if (h > 1)
- h = 1;
- mask_plane[i] = planes[pi++];
- }
+ if (penum->mask[i].InterleaveType == interleave_separate_source) {
+ /*
+ * In order to be able to recover from interruptions, we must
+ * limit separate-source processing to 1 scan line at a time.
+ */
+ if (h > 1)
+ h = 1;
+ mask_plane[i] = planes[pi++];
+ }
pixel_planes = &planes[pi];
/* Handle chunky masks. */
if (num_chunky) {
- int bpc = penum->bpc;
- int num_components = penum->num_components;
- int width = penum->pixel.width;
- /* Pull apart the source data and the mask data. */
- /* We do this in the simplest (not fastest) way for now. */
- uint bit_x = bpc * (num_components + num_chunky) * planes[pi].data_x;
- sample_load_declare_setup(sptr, sbit, planes[0].data + (bit_x >> 3),
- bit_x & 7, bpc);
- sample_store_declare_setup(pptr, pbit, pbbyte,
- penum->pixel.data, 0, bpc);
- sample_store_declare(dptr[NUM_MASKS], dbit[NUM_MASKS],
- dbbyte[NUM_MASKS]);
- int depth[NUM_MASKS];
- int x;
-
- if (h > 1) {
- /* Do the operation one row at a time. */
- h = 1;
- }
- for (i = 0; i < NUM_MASKS; ++i)
- if (penum->mask[i].data) {
- depth[i] = penum->mask[i].depth;
- mask_plane[i].data = dptr[i] = penum->mask[i].data;
- mask_plane[i].data_x = 0;
- /* raster doesn't matter */
- sample_store_setup(dbit[i], 0, depth[i]);
- sample_store_preload(dbbyte[i], dptr[i], 0, depth[i]);
- } else
- depth[i] = 0;
- pixel_plane.data = pptr;
- pixel_plane.data_x = 0;
- /* raster doesn't matter */
- pixel_planes = &pixel_plane;
- for (x = 0; x < width; ++x) {
- uint value;
-
- for (i = 0; i < NUM_MASKS; ++i)
- if (depth[i]) {
- sample_load_next12(value, sptr, sbit, bpc);
- sample_store_next12(value, dptr[i], dbit[i], depth[i],
- dbbyte[i]);
- }
- for (i = 0; i < num_components; ++i) {
- sample_load_next12(value, sptr, sbit, bpc);
- sample_store_next12(value, pptr, pbit, bpc, pbbyte);
- }
- }
- for (i = 0; i < NUM_MASKS; ++i)
- if (penum->mask[i].data)
- sample_store_flush(dptr[i], dbit[i], depth[i], dbbyte[i]);
- sample_store_flush(pptr, pbit, bpc, pbbyte);
- }
+ int bpc = penum->bpc;
+ int num_components = penum->num_components;
+ int width = penum->pixel.width;
+ /* Pull apart the source data and the mask data. */
+ /* We do this in the simplest (not fastest) way for now. */
+ uint bit_x = bpc * (num_components + num_chunky) * planes[pi].data_x;
+ sample_load_declare_setup(sptr, sbit, planes[0].data + (bit_x >> 3),
+ bit_x & 7, bpc);
+ sample_store_declare_setup(pptr, pbit, pbbyte,
+ penum->pixel.data, 0, bpc);
+ sample_store_declare(dptr[NUM_MASKS], dbit[NUM_MASKS],
+ dbbyte[NUM_MASKS]);
+ int depth[NUM_MASKS];
+ int x;
+
+ if (h > 1) {
+ /* Do the operation one row at a time. */
+ h = 1;
+ }
+ for (i = 0; i < NUM_MASKS; ++i)
+ if (penum->mask[i].data) {
+ depth[i] = penum->mask[i].depth;
+ mask_plane[i].data = dptr[i] = penum->mask[i].data;
+ mask_plane[i].data_x = 0;
+ /* raster doesn't matter */
+ sample_store_setup(dbit[i], 0, depth[i]);
+ sample_store_preload(dbbyte[i], dptr[i], 0, depth[i]);
+ } else
+ depth[i] = 0;
+ pixel_plane.data = pptr;
+ pixel_plane.data_x = 0;
+ /* raster doesn't matter */
+ pixel_planes = &pixel_plane;
+ for (x = 0; x < width; ++x) {
+ uint value;
+
+ for (i = 0; i < NUM_MASKS; ++i)
+ if (depth[i]) {
+ sample_load_next12(value, sptr, sbit, bpc);
+ sample_store_next12(value, dptr[i], dbit[i], depth[i],
+ dbbyte[i]);
+ }
+ for (i = 0; i < num_components; ++i) {
+ sample_load_next12(value, sptr, sbit, bpc);
+ sample_store_next12(value, pptr, pbit, bpc, pbbyte);
+ }
+ }
+ for (i = 0; i < NUM_MASKS; ++i)
+ if (penum->mask[i].data)
+ sample_store_flush(dptr[i], dbit[i], depth[i], dbbyte[i]);
+ sample_store_flush(pptr, pbit, bpc, pbbyte);
+ }
/*
* Process the mask data first, so it will set up the mask
* device for clipping the pixel data.
*/
for (i = 0; i < NUM_MASKS; ++i)
- if (mask_plane[i].data) {
- /*
- * If, on the last call, we processed some mask rows
- * successfully but processing the pixel rows was interrupted,
- * we set rows_used to indicate the number of pixel rows
- * processed (since there is no way to return two rows_used
- * values). If this happened, some mask rows may get presented
- * again. We must skip over them rather than processing them
- * again.
- */
- int skip = penum->mask[i].skip;
-
- if (skip >= h) {
- penum->mask[i].skip = skip - (mask_used[i] = h);
- } else {
- int mask_h = h - skip;
-
- mask_plane[i].data += skip * mask_plane[i].raster;
- penum->mask[i].skip = 0;
- code = gx_image_plane_data_rows(penum->mask[i].info,
- &mask_plane[i],
- mask_h, &mask_used[i]);
- mask_used[i] += skip;
- }
- *rows_used = mask_used[i];
- penum->mask[i].y += mask_used[i];
- if (code < 0)
- return code;
- }
+ if (mask_plane[i].data) {
+ /*
+ * If, on the last call, we processed some mask rows
+ * successfully but processing the pixel rows was interrupted,
+ * we set rows_used to indicate the number of pixel rows
+ * processed (since there is no way to return two rows_used
+ * values). If this happened, some mask rows may get presented
+ * again. We must skip over them rather than processing them
+ * again.
+ */
+ int skip = penum->mask[i].skip;
+
+ if (skip >= h) {
+ penum->mask[i].skip = skip - (mask_used[i] = h);
+ } else {
+ int mask_h = h - skip;
+
+ mask_plane[i].data += skip * mask_plane[i].raster;
+ penum->mask[i].skip = 0;
+ code = gx_image_plane_data_rows(penum->mask[i].info,
+ &mask_plane[i],
+ mask_h, &mask_used[i]);
+ mask_used[i] += skip;
+ }
+ *rows_used = mask_used[i];
+ penum->mask[i].y += mask_used[i];
+ if (code < 0)
+ return code;
+ }
if (pixel_planes[0].data) {
- /*
- * If necessary, flush any buffered mask data to the mask clipping
- * device.
- */
- for (i = 0; i < NUM_MASKS; ++i)
- if (penum->mask[i].info)
- gx_image_flush(penum->mask[i].info);
- code = gx_image_plane_data_rows(penum->pixel.info, pixel_planes, h,
- &pixel_used);
- /*
- * There isn't any way to set rows_used if different amounts of
- * the mask and pixel data were used. Fake it.
- */
- *rows_used = pixel_used;
- /*
- * Don't return code yet: we must account for the fact that
- * some mask data may have been processed.
- */
- penum->pixel.y += pixel_used;
- if (code < 0) {
- /*
- * We must prevent the mask data from being processed again.
- * We rely on the fact that h > 1 is only possible if the
- * mask and pixel data have the same Y scaling.
- */
- for (i = 0; i < NUM_MASKS; ++i)
- if (mask_used[i] > pixel_used) {
- int skip = mask_used[i] - pixel_used;
-
- penum->mask[i].skip = skip;
- penum->mask[i].y -= skip;
- mask_used[i] = pixel_used;
- }
- }
+ /*
+ * If necessary, flush any buffered mask data to the mask clipping
+ * device.
+ */
+ for (i = 0; i < NUM_MASKS; ++i)
+ if (penum->mask[i].info)
+ gx_image_flush(penum->mask[i].info);
+ code = gx_image_plane_data_rows(penum->pixel.info, pixel_planes, h,
+ &pixel_used);
+ /*
+ * There isn't any way to set rows_used if different amounts of
+ * the mask and pixel data were used. Fake it.
+ */
+ *rows_used = pixel_used;
+ /*
+ * Don't return code yet: we must account for the fact that
+ * some mask data may have been processed.
+ */
+ penum->pixel.y += pixel_used;
+ if (code < 0) {
+ /*
+ * We must prevent the mask data from being processed again.
+ * We rely on the fact that h > 1 is only possible if the
+ * mask and pixel data have the same Y scaling.
+ */
+ for (i = 0; i < NUM_MASKS; ++i)
+ if (mask_used[i] > pixel_used) {
+ int skip = mask_used[i] - pixel_used;
+
+ penum->mask[i].skip = skip;
+ penum->mask[i].y -= skip;
+ mask_used[i] = pixel_used;
+ }
+ }
}
if_debug7('b', "[b]image3x h=%d %sopacity.y=%d %sopacity.y=%d %spixel.y=%d\n",
- h, (mask_plane[0].data ? "+" : ""), penum->mask[0].y,
- (mask_plane[1].data ? "+" : ""), penum->mask[1].y,
- (pixel_planes[0].data ? "+" : ""), penum->pixel.y);
+ h, (mask_plane[0].data ? "+" : ""), penum->mask[0].y,
+ (mask_plane[1].data ? "+" : ""), penum->mask[1].y,
+ (pixel_planes[0].data ? "+" : ""), penum->pixel.y);
if (penum->mask[0].depth == 0 || penum->mask[0].y >= penum->mask[0].height) {
if (penum->mask[1].depth == 0 || penum->mask[1].y >= penum->mask[1].height) {
- if (penum->pixel.y >= penum->pixel.height) {
- return 1;
+ if (penum->pixel.y >= penum->pixel.height) {
+ return 1;
}
}
}
@@ -783,9 +783,9 @@ gx_image3x_flush(gx_image_enum_common_t * info)
int code = gx_image_flush(penum->mask[0].info);
if (code >= 0)
- code = gx_image_flush(penum->mask[1].info);
+ code = gx_image_flush(penum->mask[1].info);
if (code >= 0)
- code = gx_image_flush(penum->pixel.info);
+ code = gx_image_flush(penum->pixel.info);
return code;
}
@@ -799,45 +799,45 @@ gx_image3x_planes_wanted(const gx_image_enum_common_t * info, byte *wanted)
* pixel data.
*/
bool
- sso = penum->mask[0].InterleaveType == interleave_separate_source,
- sss = penum->mask[1].InterleaveType == interleave_separate_source;
+ sso = penum->mask[0].InterleaveType == interleave_separate_source,
+ sss = penum->mask[1].InterleaveType == interleave_separate_source;
if (sso & sss) {
- /* Both masks have separate sources. */
- int mask_next = channel_next(&penum->mask[1], &penum->pixel);
-
- memset(wanted + 2, (mask_next <= 0 ? 0xff : 0), info->num_planes - 2);
- wanted[1] = (mask_next >= 0 ? 0xff : 0);
- if (wanted[1]) {
- mask_next = channel_next(&penum->mask[0], &penum->mask[1]);
- wanted[0] = mask_next >= 0;
- } else
- wanted[0] = 0;
- return false; /* see below */
+ /* Both masks have separate sources. */
+ int mask_next = channel_next(&penum->mask[1], &penum->pixel);
+
+ memset(wanted + 2, (mask_next <= 0 ? 0xff : 0), info->num_planes - 2);
+ wanted[1] = (mask_next >= 0 ? 0xff : 0);
+ if (wanted[1]) {
+ mask_next = channel_next(&penum->mask[0], &penum->mask[1]);
+ wanted[0] = mask_next >= 0;
+ } else
+ wanted[0] = 0;
+ return false; /* see below */
} else if (sso | sss) {
- /* Only one separate source. */
- const image3x_channel_state_t *pics =
- (sso ? &penum->mask[0] : &penum->mask[1]);
- int mask_next = channel_next(pics, &penum->pixel);
-
- wanted[0] = (mask_next >= 0 ? 0xff : 0);
- memset(wanted + 1, (mask_next <= 0 ? 0xff : 0), info->num_planes - 1);
- /*
- * In principle, wanted will always be true for both mask and pixel
- * data if the full_heights are equal. Unfortunately, even in this
- * case, processing may be interrupted after a mask row has been
- * passed to the underlying image processor but before the data row
- * has been passed, in which case pixel data will be 'wanted', but
- * not mask data, for the next call. Therefore, we must return
- * false.
- */
- return false
- /*(next == 0 &&
- pics->full_height == penum->pixel.full_height)*/;
+ /* Only one separate source. */
+ const image3x_channel_state_t *pics =
+ (sso ? &penum->mask[0] : &penum->mask[1]);
+ int mask_next = channel_next(pics, &penum->pixel);
+
+ wanted[0] = (mask_next >= 0 ? 0xff : 0);
+ memset(wanted + 1, (mask_next <= 0 ? 0xff : 0), info->num_planes - 1);
+ /*
+ * In principle, wanted will always be true for both mask and pixel
+ * data if the full_heights are equal. Unfortunately, even in this
+ * case, processing may be interrupted after a mask row has been
+ * passed to the underlying image processor but before the data row
+ * has been passed, in which case pixel data will be 'wanted', but
+ * not mask data, for the next call. Therefore, we must return
+ * false.
+ */
+ return false
+ /*(next == 0 &&
+ pics->full_height == penum->pixel.full_height)*/;
} else {
- /* Everything is chunky, only 1 plane. */
- wanted[0] = 0xff;
- return true;
+ /* Everything is chunky, only 1 plane. */
+ wanted[0] = 0xff;
+ return true;
}
}
@@ -849,26 +849,26 @@ gx_image3x_end_image(gx_image_enum_common_t * info, bool draw_last)
gs_memory_t *mem = penum->memory;
gx_device *mdev0 = penum->mask[0].mdev;
int ocode =
- (penum->mask[0].info ? gx_image_end(penum->mask[0].info, draw_last) :
- 0);
+ (penum->mask[0].info ? gx_image_end(penum->mask[0].info, draw_last) :
+ 0);
gx_device *mdev1 = penum->mask[1].mdev;
int scode =
- (penum->mask[1].info ? gx_image_end(penum->mask[1].info, draw_last) :
- 0);
+ (penum->mask[1].info ? gx_image_end(penum->mask[1].info, draw_last) :
+ 0);
gx_device *pcdev = penum->pcdev;
int pcode = gx_image_end(penum->pixel.info, draw_last);
gs_closedevice(pcdev);
if (mdev0)
- gs_closedevice(mdev0);
+ gs_closedevice(mdev0);
if (mdev1)
- gs_closedevice(mdev1);
+ gs_closedevice(mdev1);
gs_free_object(mem, penum->mask[0].data,
- "gx_image3x_end_image(mask[0].data)");
+ "gx_image3x_end_image(mask[0].data)");
gs_free_object(mem, penum->mask[1].data,
- "gx_image3x_end_image(mask[1].data)");
+ "gx_image3x_end_image(mask[1].data)");
gs_free_object(mem, penum->pixel.data,
- "gx_image3x_end_image(pixel.data)");
+ "gx_image3x_end_image(pixel.data)");
gs_free_object(mem, pcdev, "gx_image3x_end_image(pcdev)");
gs_free_object(mem, mdev0, "gx_image3x_end_image(mask[0].mdev)");
gs_free_object(mem, mdev1, "gx_image3x_end_image(mask[1].mdev)");
diff --git a/gs/base/gximag3x.h b/gs/base/gximag3x.h
index abebeb69c..e9952a703 100644
--- a/gs/base/gximag3x.h
+++ b/gs/base/gximag3x.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@
*/
#define IMAGE3X_MAKE_MID_PROC(proc)\
int proc(gx_device **pmidev, gx_device *dev, int width, int height,\
- int depth, gs_memory_t *mem)
+ int depth, gs_memory_t *mem)
typedef IMAGE3X_MAKE_MID_PROC((*image3x_make_mid_proc_t));
/*
@@ -43,19 +43,19 @@ typedef IMAGE3X_MAKE_MID_PROC((*image3x_make_mid_proc_t));
*/
#define IMAGE3X_MAKE_MCDE_PROC(proc)\
int proc(/* The initial arguments are those of begin_typed_image. */\
- gx_device *dev,\
- const gs_imager_state *pis,\
- const gs_matrix *pmat,\
- const gs_image_common_t *pic,\
- const gs_int_rect *prect,\
- const gx_drawing_color *pdcolor,\
- const gx_clip_path *pcpath, gs_memory_t *mem,\
- gx_image_enum_common_t **pinfo,\
- /* The following arguments are added. */\
- gx_device **pmcdev, gx_device *midev[2],\
- gx_image_enum_common_t *pminfo[2],\
- const gs_int_point origin[2],\
- const gs_image3x_t *pim)
+ gx_device *dev,\
+ const gs_imager_state *pis,\
+ const gs_matrix *pmat,\
+ const gs_image_common_t *pic,\
+ const gs_int_rect *prect,\
+ const gx_drawing_color *pdcolor,\
+ const gx_clip_path *pcpath, gs_memory_t *mem,\
+ gx_image_enum_common_t **pinfo,\
+ /* The following arguments are added. */\
+ gx_device **pmcdev, gx_device *midev[2],\
+ gx_image_enum_common_t *pminfo[2],\
+ const gs_int_point origin[2],\
+ const gs_image3x_t *pim)
typedef IMAGE3X_MAKE_MCDE_PROC((*image3x_make_mcde_proc_t));
/*
@@ -63,14 +63,14 @@ typedef IMAGE3X_MAKE_MCDE_PROC((*image3x_make_mcde_proc_t));
* procedures as additional parameters.
*/
int gx_begin_image3x_generic(gx_device * dev,
- const gs_imager_state *pis,
- const gs_matrix *pmat,
- const gs_image_common_t *pic,
- const gs_int_rect *prect,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- IMAGE3X_MAKE_MID_PROC((*make_mid)),
- IMAGE3X_MAKE_MCDE_PROC((*make_mcde)),
- gx_image_enum_common_t **pinfo);
+ const gs_imager_state *pis,
+ const gs_matrix *pmat,
+ const gs_image_common_t *pic,
+ const gs_int_rect *prect,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ IMAGE3X_MAKE_MID_PROC((*make_mid)),
+ IMAGE3X_MAKE_MCDE_PROC((*make_mcde)),
+ gx_image_enum_common_t **pinfo);
#endif /* gximag3x_INCLUDED */
diff --git a/gs/base/gximage.c b/gs/base/gximage.c
index 9f94f0db0..f0ca3ce89 100644
--- a/gs/base/gximage.c
+++ b/gs/base/gximage.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,25 +45,25 @@ gs_data_image_t_init(gs_data_image_t * pim, int num_components)
pim->Width = pim->Height = 0;
pim->BitsPerComponent = 1;
if (num_components >= 0) {
- for (i = 0; i < num_components * 2; i += 2)
- pim->Decode[i] = 0, pim->Decode[i + 1] = 1;
+ for (i = 0; i < num_components * 2; i += 2)
+ pim->Decode[i] = 0, pim->Decode[i + 1] = 1;
} else {
- for (i = 0; i < num_components * -2; i += 2)
- pim->Decode[i] = 1, pim->Decode[i + 1] = 0;
+ for (i = 0; i < num_components * -2; i += 2)
+ pim->Decode[i] = 1, pim->Decode[i + 1] = 0;
}
pim->Interpolate = false;
}
void
gs_pixel_image_t_init(gs_pixel_image_t * pim,
- gs_color_space * color_space)
+ gs_color_space * color_space)
{
int num_components;
if (color_space == 0 ||
- (num_components =
- gs_color_space_num_components(color_space)) < 0
- )
- num_components = 0;
+ (num_components =
+ gs_color_space_num_components(color_space)) < 0
+ )
+ num_components = 0;
gs_data_image_t_init((gs_data_image_t *) pim, num_components);
pim->format = gs_image_format_chunky;
pim->ColorSpace = color_space;
@@ -73,10 +73,10 @@ gs_pixel_image_t_init(gs_pixel_image_t * pim,
/* Initialize the common part of an image-processing enumerator. */
int
gx_image_enum_common_init(gx_image_enum_common_t * piec,
- const gs_data_image_t * pic,
- const gx_image_enum_procs_t * piep,
- gx_device * dev, int num_components,
- gs_image_format_t format)
+ const gs_data_image_t * pic,
+ const gx_image_enum_procs_t * piep,
+ gx_device * dev, int num_components,
+ gs_image_format_t format)
{
int bpc = pic->BitsPerComponent;
int i;
@@ -87,32 +87,32 @@ gx_image_enum_common_init(gx_image_enum_common_t * piec,
piec->id = gs_next_ids(dev->memory, 1);
piec->skipping = false;
switch (format) {
- case gs_image_format_chunky:
- piec->num_planes = 1;
- piec->plane_depths[0] = bpc * num_components;
- break;
- case gs_image_format_component_planar:
- piec->num_planes = num_components;
- for (i = 0; i < num_components; ++i)
- piec->plane_depths[i] = bpc;
- break;
- case gs_image_format_bit_planar:
- piec->num_planes = bpc * num_components;
- for (i = 0; i < piec->num_planes; ++i)
- piec->plane_depths[i] = 1;
- break;
- default:
- return_error(gs_error_rangecheck);
+ case gs_image_format_chunky:
+ piec->num_planes = 1;
+ piec->plane_depths[0] = bpc * num_components;
+ break;
+ case gs_image_format_component_planar:
+ piec->num_planes = num_components;
+ for (i = 0; i < num_components; ++i)
+ piec->plane_depths[i] = bpc;
+ break;
+ case gs_image_format_bit_planar:
+ piec->num_planes = bpc * num_components;
+ for (i = 0; i < piec->num_planes; ++i)
+ piec->plane_depths[i] = 1;
+ break;
+ default:
+ return_error(gs_error_rangecheck);
}
for (i = 0; i < piec->num_planes; ++i)
- piec->plane_widths[i] = pic->Width;
+ piec->plane_widths[i] = pic->Width;
return 0;
}
/* Compute the source size of an ordinary image with explicit data. */
int
gx_data_image_source_size(const gs_imager_state * pis,
- const gs_image_common_t * pim, gs_int_point * psize)
+ const gs_image_common_t * pim, gs_int_point * psize)
{
const gs_data_image_t *pdi = (const gs_data_image_t *)pim;
@@ -125,8 +125,8 @@ gx_data_image_source_size(const gs_imager_state * pis,
/* This procedure should never be called. */
int
gx_no_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *height_used)
+ const gx_image_plane_t * planes, int height,
+ int *height_used)
{
return_error(gs_error_Fatal);
}
@@ -143,7 +143,7 @@ gx_ignore_end_image(gx_image_enum_common_t * info, bool draw_last)
int
gx_image_data(gx_image_enum_common_t * info, const byte ** plane_data,
- int data_x, uint raster, int height)
+ int data_x, uint raster, int height)
{
int num_planes = info->num_planes;
gx_image_plane_t planes[GS_IMAGE_MAX_COMPONENTS];
@@ -151,22 +151,22 @@ gx_image_data(gx_image_enum_common_t * info, const byte ** plane_data,
#ifdef DEBUG
if (num_planes > GS_IMAGE_MAX_COMPONENTS) {
- lprintf2("num_planes=%d > GS_IMAGE_MAX_COMPONENTS=%d!\n",
- num_planes, GS_IMAGE_MAX_COMPONENTS);
- return_error(gs_error_Fatal);
+ lprintf2("num_planes=%d > GS_IMAGE_MAX_COMPONENTS=%d!\n",
+ num_planes, GS_IMAGE_MAX_COMPONENTS);
+ return_error(gs_error_Fatal);
}
#endif
for (i = 0; i < num_planes; ++i) {
- planes[i].data = plane_data[i];
- planes[i].data_x = data_x;
- planes[i].raster = raster;
+ planes[i].data = plane_data[i];
+ planes[i].data_x = data_x;
+ planes[i].raster = raster;
}
return gx_image_plane_data(info, planes, height);
}
int
gx_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height)
+ const gx_image_plane_t * planes, int height)
{
int ignore_rows_used;
@@ -175,8 +175,8 @@ gx_image_plane_data(gx_image_enum_common_t * info,
int
gx_image_plane_data_rows(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
return info->procs->plane_data(info, planes, height, rows_used);
}
@@ -193,13 +193,13 @@ bool
gx_image_planes_wanted(const gx_image_enum_common_t *info, byte *wanted)
{
bool (*planes_wanted)(const gx_image_enum_common_t *, byte *) =
- info->procs->planes_wanted;
+ info->procs->planes_wanted;
if (planes_wanted)
- return planes_wanted(info, wanted);
+ return planes_wanted(info, wanted);
else {
- memset(wanted, 0xff, info->num_planes);
- return true;
+ memset(wanted, 0xff, info->num_planes);
+ return true;
}
}
@@ -218,14 +218,14 @@ gx_image_end(gx_image_enum_common_t * info, bool draw_last)
int
gx_image_no_sput(const gs_image_common_t *pic, stream *s,
- const gs_color_space **ppcs)
+ const gs_color_space **ppcs)
{
return_error(gs_error_rangecheck);
}
int
gx_image_no_sget(gs_image_common_t *pic, stream *s,
- gs_color_space *pcs)
+ gs_color_space *pcs)
{
return_error(gs_error_rangecheck);
}
@@ -241,20 +241,20 @@ static void
debug_b_print_matrix(const gs_pixel_image_t *pim)
{
if_debug6('b', " ImageMatrix=[%g %g %g %g %g %g]\n",
- pim->ImageMatrix.xx, pim->ImageMatrix.xy,
- pim->ImageMatrix.yx, pim->ImageMatrix.yy,
- pim->ImageMatrix.tx, pim->ImageMatrix.ty);
+ pim->ImageMatrix.xx, pim->ImageMatrix.xy,
+ pim->ImageMatrix.yx, pim->ImageMatrix.yy,
+ pim->ImageMatrix.tx, pim->ImageMatrix.ty);
}
static void
debug_b_print_decode(const gs_pixel_image_t *pim, int num_decode)
{
if (gs_debug_c('b')) {
- const char *str = " Decode=[";
- int i;
+ const char *str = " Decode=[";
+ int i;
- for (i = 0; i < num_decode; str = " ", ++i)
- dprintf2("%s%g", str, pim->Decode[i]);
- dputs("]\n");
+ for (i = 0; i < num_decode; str = " ", ++i)
+ dprintf2("%s%g", str, pim->Decode[i]);
+ dputs("]\n");
}
}
#else
@@ -267,10 +267,10 @@ bool
gx_image_matrix_is_default(const gs_data_image_t *pid)
{
return (is_xxyy(&pid->ImageMatrix) &&
- pid->ImageMatrix.xx == pid->Width &&
- pid->ImageMatrix.yy == -pid->Height &&
- is_fzero(pid->ImageMatrix.tx) &&
- pid->ImageMatrix.ty == pid->Height);
+ pid->ImageMatrix.xx == pid->Width &&
+ pid->ImageMatrix.yy == -pid->Height &&
+ is_fzero(pid->ImageMatrix.tx) &&
+ pid->ImageMatrix.ty == pid->Height);
}
/* Put a variable-length uint on a stream. */
@@ -278,7 +278,7 @@ void
sput_variable_uint(stream *s, uint w)
{
for (; w > 0x7f; w >>= 7)
- sputc(s, (byte)(w | 0x80));
+ sputc(s, (byte)(w | 0x80));
sputc(s, (byte)w);
}
@@ -315,7 +315,7 @@ sput_variable_uint(stream *s, uint w)
*/
int
gx_pixel_image_sput(const gs_pixel_image_t *pim, stream *s,
- const gs_color_space **ppcs, int extra)
+ const gs_color_space **ppcs, int extra)
{
const gs_color_space *pcs = pim->ColorSpace;
int bpc = pim->BitsPerComponent;
@@ -329,78 +329,78 @@ gx_pixel_image_sput(const gs_pixel_image_t *pim, stream *s,
/* Construct the control word. */
if (!gx_image_matrix_is_default((const gs_data_image_t *)pim))
- control |= PI_ImageMatrix;
+ control |= PI_ImageMatrix;
switch (pim->format) {
case gs_image_format_chunky:
case gs_image_format_component_planar:
- switch (bpc) {
- case 1: case 2: case 4: case 8: case 12: break;
- default: return_error(gs_error_rangecheck);
- }
- break;
+ switch (bpc) {
+ case 1: case 2: case 4: case 8: case 12: break;
+ default: return_error(gs_error_rangecheck);
+ }
+ break;
case gs_image_format_bit_planar:
- if (bpc < 1 || bpc > 8)
- return_error(gs_error_rangecheck);
+ if (bpc < 1 || bpc > 8)
+ return_error(gs_error_rangecheck);
}
control |= (bpc - 1) << PI_BPC_SHIFT;
control |= pim->format << PI_FORMAT_SHIFT;
num_decode = num_components * 2;
if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed)
- decode_default_1 = (float)pcs->params.indexed.hival;
+ decode_default_1 = (float)pcs->params.indexed.hival;
for (i = 0; i < num_decode; ++i)
- if (pim->Decode[i] != DECODE_DEFAULT(i, decode_default_1)) {
- control |= PI_Decode;
- break;
- }
+ if (pim->Decode[i] != DECODE_DEFAULT(i, decode_default_1)) {
+ control |= PI_Decode;
+ break;
+ }
if (pim->Interpolate)
- control |= PI_Interpolate;
+ control |= PI_Interpolate;
if (pim->CombineWithColor)
- control |= PI_CombineWithColor;
+ control |= PI_CombineWithColor;
/* Write the encoding on the stream. */
if_debug3('b', "[b]put control=0x%x, Width=%d, Height=%d\n",
- control, pim->Width, pim->Height);
+ control, pim->Width, pim->Height);
sput_variable_uint(s, control);
sput_variable_uint(s, (uint)pim->Width);
sput_variable_uint(s, (uint)pim->Height);
if (control & PI_ImageMatrix) {
- debug_b_print_matrix(pim);
- sput_matrix(s, &pim->ImageMatrix);
+ debug_b_print_matrix(pim);
+ sput_matrix(s, &pim->ImageMatrix);
}
if (control & PI_Decode) {
- int i;
- uint dflags = 1;
- float decode[8];
- int di = 0;
-
- debug_b_print_decode(pim, num_decode);
- for (i = 0; i < num_decode; i += 2) {
- float u = pim->Decode[i], v = pim->Decode[i + 1];
- float dv = DECODE_DEFAULT(i + 1, decode_default_1);
-
- if (dflags >= 0x100) {
- sputc(s, (byte)(dflags & 0xff));
- sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
- dflags = 1;
- di = 0;
- }
- dflags <<= 2;
- if (u == 0 && v == dv)
- DO_NOTHING;
- else if (u == dv && v == 0)
- dflags += 1;
- else {
- if (u != 0) {
- dflags++;
- decode[di++] = u;
- }
- dflags += 2;
- decode[di++] = v;
- }
- }
- sputc(s, (byte)((dflags << (8 - num_decode)) & 0xff));
- sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
+ int i;
+ uint dflags = 1;
+ float decode[8];
+ int di = 0;
+
+ debug_b_print_decode(pim, num_decode);
+ for (i = 0; i < num_decode; i += 2) {
+ float u = pim->Decode[i], v = pim->Decode[i + 1];
+ float dv = DECODE_DEFAULT(i + 1, decode_default_1);
+
+ if (dflags >= 0x100) {
+ sputc(s, (byte)(dflags & 0xff));
+ sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
+ dflags = 1;
+ di = 0;
+ }
+ dflags <<= 2;
+ if (u == 0 && v == dv)
+ DO_NOTHING;
+ else if (u == dv && v == 0)
+ dflags += 1;
+ else {
+ if (u != 0) {
+ dflags++;
+ decode[di++] = u;
+ }
+ dflags += 2;
+ decode[di++] = v;
+ }
+ }
+ sputc(s, (byte)((dflags << (8 - num_decode)) & 0xff));
+ sputs(s, (const byte *)decode, di * sizeof(float), &ignore);
}
*ppcs = pcs;
return 0;
@@ -427,9 +427,9 @@ sget_variable_uint(stream *s, uint *pw)
int ch;
for (; (ch = sgetc(s)) >= 0x80; shift += 7)
- w += (ch & 0x7f) << shift;
+ w += (ch & 0x7f) << shift;
if (ch < 0)
- return_error(gs_error_ioerror);
+ return_error(gs_error_ioerror);
*pw = w + (ch << shift);
return 0;
}
@@ -439,7 +439,7 @@ sget_variable_uint(stream *s, uint *pw)
*/
int
gx_pixel_image_sget(gs_pixel_image_t *pim, stream *s,
- gs_color_space *pcs)
+ gs_color_space *pcs)
{
uint control;
float decode_default_1 = 1;
@@ -449,57 +449,57 @@ gx_pixel_image_sget(gs_pixel_image_t *pim, stream *s,
uint ignore;
if ((code = sget_variable_uint(s, &control)) < 0 ||
- (code = sget_variable_uint(s, (uint *)&pim->Width)) < 0 ||
- (code = sget_variable_uint(s, (uint *)&pim->Height)) < 0
- )
- return code;
+ (code = sget_variable_uint(s, (uint *)&pim->Width)) < 0 ||
+ (code = sget_variable_uint(s, (uint *)&pim->Height)) < 0
+ )
+ return code;
if_debug3('b', "[b]get control=0x%x, Width=%d, Height=%d\n",
- control, pim->Width, pim->Height);
+ control, pim->Width, pim->Height);
if (control & PI_ImageMatrix) {
- if ((code = sget_matrix(s, &pim->ImageMatrix)) < 0)
- return code;
- debug_b_print_matrix(pim);
+ if ((code = sget_matrix(s, &pim->ImageMatrix)) < 0)
+ return code;
+ debug_b_print_matrix(pim);
} else
- gx_image_matrix_set_default((gs_data_image_t *)pim);
+ gx_image_matrix_set_default((gs_data_image_t *)pim);
pim->BitsPerComponent = ((control >> PI_BPC_SHIFT) & PI_BPC_MASK) + 1;
pim->format = (control >> PI_FORMAT_SHIFT) & PI_FORMAT_MASK;
pim->ColorSpace = pcs;
num_components = gs_color_space_num_components(pcs);
num_decode = num_components * 2;
if (gs_color_space_get_index(pcs) == gs_color_space_index_Indexed)
- decode_default_1 = (float)pcs->params.indexed.hival;
+ decode_default_1 = (float)pcs->params.indexed.hival;
if (control & PI_Decode) {
- uint dflags = 0x10000;
- float *dp = pim->Decode;
-
- for (i = 0; i < num_decode; i += 2, dp += 2, dflags <<= 2) {
- if (dflags >= 0x10000) {
- dflags = sgetc(s) + 0x100;
- if (dflags < 0x100)
- return_error(gs_error_ioerror);
- }
- switch (dflags & 0xc0) {
- case 0x00:
- dp[0] = 0, dp[1] = DECODE_DEFAULT(i + 1, decode_default_1);
- break;
- case 0x40:
- dp[0] = DECODE_DEFAULT(i + 1, decode_default_1), dp[1] = 0;
- break;
- case 0x80:
- dp[0] = 0;
- if (sgets(s, (byte *)(dp + 1), sizeof(float), &ignore) < 0)
- return_error(gs_error_ioerror);
- break;
- case 0xc0:
- if (sgets(s, (byte *)dp, sizeof(float) * 2, &ignore) < 0)
- return_error(gs_error_ioerror);
- break;
- }
- }
- debug_b_print_decode(pim, num_decode);
+ uint dflags = 0x10000;
+ float *dp = pim->Decode;
+
+ for (i = 0; i < num_decode; i += 2, dp += 2, dflags <<= 2) {
+ if (dflags >= 0x10000) {
+ dflags = sgetc(s) + 0x100;
+ if (dflags < 0x100)
+ return_error(gs_error_ioerror);
+ }
+ switch (dflags & 0xc0) {
+ case 0x00:
+ dp[0] = 0, dp[1] = DECODE_DEFAULT(i + 1, decode_default_1);
+ break;
+ case 0x40:
+ dp[0] = DECODE_DEFAULT(i + 1, decode_default_1), dp[1] = 0;
+ break;
+ case 0x80:
+ dp[0] = 0;
+ if (sgets(s, (byte *)(dp + 1), sizeof(float), &ignore) < 0)
+ return_error(gs_error_ioerror);
+ break;
+ case 0xc0:
+ if (sgets(s, (byte *)dp, sizeof(float) * 2, &ignore) < 0)
+ return_error(gs_error_ioerror);
+ break;
+ }
+ }
+ debug_b_print_decode(pim, num_decode);
} else {
for (i = 0; i < num_decode; ++i)
- pim->Decode[i] = DECODE_DEFAULT(i, decode_default_1);
+ pim->Decode[i] = DECODE_DEFAULT(i, decode_default_1);
}
pim->Interpolate = (control & PI_Interpolate) != 0;
pim->CombineWithColor = (control & PI_CombineWithColor) != 0;
diff --git a/gs/base/gximage.h b/gs/base/gximage.h
index f086db3e9..748a40523 100644
--- a/gs/base/gximage.h
+++ b/gs/base/gximage.h
@@ -116,7 +116,6 @@ typedef struct sample_map_s sample_map;
cc.paint.values[i] =\
penum->map[i].decode_base + (frac_value) * penum->map[i].decode_factor
-
/* Decode a frac value, to our 16 bit frac form. */
#define DECODE_FRAC_FRAC(frac_value, frac_value_out, i)\
frac_value_out =\
diff --git a/gs/base/gximage1.c b/gs/base/gximage1.c
index a00aa760f..04a816af4 100644
--- a/gs/base/gximage1.c
+++ b/gs/base/gximage1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,7 @@ const gx_image_type_t gs_image_type_mask1 = {
/* Define the procedures for initializing gs_image_ts to default values. */
void
gs_image_t_init_adjust(gs_image_t * pim, gs_color_space * color_space,
- bool adjust)
+ bool adjust)
{
gs_pixel_image_t_init((gs_pixel_image_t *) pim, color_space);
pim->ImageMask = (color_space == NULL);
@@ -63,36 +63,36 @@ gs_image_t_init_mask_adjust(gs_image_t * pim, bool write_1s, bool adjust)
{
gs_image_t_init(pim, NULL);
if (write_1s)
- pim->Decode[0] = 1, pim->Decode[1] = 0;
+ pim->Decode[0] = 1, pim->Decode[1] = 0;
else
- pim->Decode[0] = 0, pim->Decode[1] = 1;
+ pim->Decode[0] = 0, pim->Decode[1] = 1;
pim->adjust = adjust;
}
/* Start processing an ImageType 1 image. */
int
gx_begin_image1(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
gx_image_enum *penum;
const gs_image_t *pim = (const gs_image_t *)pic;
int code = gx_image_enum_alloc(pic, prect, mem, &penum);
if (code < 0)
- return code;
+ return code;
penum->alpha = pim->Alpha;
penum->use_mask_color = false;
penum->image_parent_type = pim->image_parent_type;
penum->masked = pim->ImageMask;
penum->adjust =
- (pim->ImageMask && pim->adjust ? float2fixed(0.25) : fixed_0);
+ (pim->ImageMask && pim->adjust ? float2fixed(0.25) : fixed_0);
code = gx_image_enum_begin(dev, pis, pmat, pic, pdcolor, pcpath, mem,
- penum);
+ penum);
if (code >= 0)
- *pinfo = (gx_image_enum_common_t *)penum;
+ *pinfo = (gx_image_enum_common_t *)penum;
return code;
}
@@ -104,23 +104,23 @@ gx_begin_image1(gx_device * dev,
static int
gx_image1_sput(const gs_image_common_t *pic, stream *s,
- const gs_color_space **ppcs)
+ const gs_color_space **ppcs)
{
const gs_image_t *const pim = (const gs_image_t *)pic;
return gx_pixel_image_sput((const gs_pixel_image_t *)pic, s, ppcs,
- (int)pim->Alpha);
+ (int)pim->Alpha);
}
static int
gx_image1_sget(gs_image_common_t *pic, stream *s,
- gs_color_space *pcs)
+ gs_color_space *pcs)
{
gs_image1_t *const pim = (gs_image1_t *)pic;
int code = gx_pixel_image_sget((gs_pixel_image_t *)pim, s, pcs);
if (code < 0)
- return code;
+ return code;
pim->type = &gs_image_type_1;
pim->ImageMask = false;
pim->Alpha = code;
@@ -153,46 +153,46 @@ gx_image1_sget(gs_image_common_t *pic, stream *s,
static int
gx_image1_mask_sput(const gs_image_common_t *pic, stream *s,
- const gs_color_space **ignore_ppcs)
+ const gs_color_space **ignore_ppcs)
{
const gs_image_t *pim = (const gs_image_t *)pic;
uint control =
- (gx_image_matrix_is_default((const gs_data_image_t *)pim) ? 0 :
- MI_ImageMatrix) |
- (pim->Decode[0] != 0 ? MI_Decode : 0) |
- (pim->Interpolate ? MI_Interpolate : 0) |
- (pim->adjust ? MI_adjust : 0) |
- (pim->Alpha << MI_Alpha_SHIFT) |
- ((pim->BitsPerComponent - 1) << MI_BPC_SHIFT);
+ (gx_image_matrix_is_default((const gs_data_image_t *)pim) ? 0 :
+ MI_ImageMatrix) |
+ (pim->Decode[0] != 0 ? MI_Decode : 0) |
+ (pim->Interpolate ? MI_Interpolate : 0) |
+ (pim->adjust ? MI_adjust : 0) |
+ (pim->Alpha << MI_Alpha_SHIFT) |
+ ((pim->BitsPerComponent - 1) << MI_BPC_SHIFT);
sput_variable_uint(s, control);
sput_variable_uint(s, (uint)pim->Width);
sput_variable_uint(s, (uint)pim->Height);
if (control & MI_ImageMatrix)
- sput_matrix(s, &pim->ImageMatrix);
+ sput_matrix(s, &pim->ImageMatrix);
return 0;
}
static int
gx_image1_mask_sget(gs_image_common_t *pic, stream *s,
- gs_color_space *ignore_pcs)
+ gs_color_space *ignore_pcs)
{
gs_image1_t *const pim = (gs_image1_t *)pic;
int code;
uint control;
if ((code = sget_variable_uint(s, &control)) < 0)
- return code;
+ return code;
gs_image_t_init_mask(pim, (control & MI_Decode) != 0);
if ((code = sget_variable_uint(s, (uint *)&pim->Width)) < 0 ||
- (code = sget_variable_uint(s, (uint *)&pim->Height)) < 0
- )
- return code;
+ (code = sget_variable_uint(s, (uint *)&pim->Height)) < 0
+ )
+ return code;
if (control & MI_ImageMatrix) {
- if ((code = sget_matrix(s, &pim->ImageMatrix)) < 0)
- return code;
+ if ((code = sget_matrix(s, &pim->ImageMatrix)) < 0)
+ return code;
} else
- gx_image_matrix_set_default((gs_data_image_t *)pim);
+ gx_image_matrix_set_default((gs_data_image_t *)pim);
pim->Interpolate = (control & MI_Interpolate) != 0;
pim->adjust = (control & MI_adjust) != 0;
pim->Alpha = (control >> MI_Alpha_SHIFT) & MI_Alpha_MASK;
@@ -214,19 +214,19 @@ gx_image_free_enum(gx_image_enum_common_t **ppenum)
gs_memory_t *mem = penum->memory;
/* Bug 688845 comment #38 :
- Adobe Illustrator creates a Postscript document,
- in which an image data procedure executes 'save',
- and the corresponding 'restore' appears after the image end.
- It causes this procedure is called at a higher save level than
- at which the enumerator was allocated, so that gs_free_object below
- works idle. Nevertheless we can't leave pointers in the structure,
- because they may point to blocks already released
- by the client's subclass method for end_image.
- Leaving them uncleaned caused a real crash in the garbager - see bug 688845.
- So we clean the entire subclassed enumerator here,
- rather this is a generic function for base class.
- Note the cleaning is neccessaryfor Postscript only,
- because other languaged don't implement save-restore.
+ Adobe Illustrator creates a Postscript document,
+ in which an image data procedure executes 'save',
+ and the corresponding 'restore' appears after the image end.
+ It causes this procedure is called at a higher save level than
+ at which the enumerator was allocated, so that gs_free_object below
+ works idle. Nevertheless we can't leave pointers in the structure,
+ because they may point to blocks already released
+ by the client's subclass method for end_image.
+ Leaving them uncleaned caused a real crash in the garbager - see bug 688845.
+ So we clean the entire subclassed enumerator here,
+ rather this is a generic function for base class.
+ Note the cleaning is neccessaryfor Postscript only,
+ because other languaged don't implement save-restore.
*/
memset(penum, 0, gs_object_size(mem, penum));
gs_free_object(mem, penum, "gx_image_free_enum");
diff --git a/gs/base/gximage2.c b/gs/base/gximage2.c
index e4d1b09aa..c26d9d3f5 100644
--- a/gs/base/gximage2.c
+++ b/gs/base/gximage2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -86,7 +86,7 @@ image2_set_data(const gs_image2_t * pim, image2_data_t * pid)
/* Compute the source size of an ImageType 2 image. */
static int
gx_image2_source_size(const gs_imager_state * pis, const gs_image_common_t * pim,
- gs_int_point * psize)
+ gs_int_point * psize)
{
image2_data_t idata;
@@ -101,10 +101,10 @@ gx_image2_source_size(const gs_imager_state * pis, const gs_image_common_t * pim
/* this procedure does all the work. */
static int
gx_begin_image2(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
const gs_image2_t *pim = (const gs_image2_t *)pic;
gs_state *pgs = pim->DataSource;
@@ -137,180 +137,179 @@ gx_begin_image2(gx_device * dev,
idata.image.Decode[6] = idata.image.Decode[8] = 0.0;
idata.image.Decode[7] = idata.image.Decode[9] = 1.0;
if (pmat == 0) {
- gs_currentmatrix((const gs_state *)pis, &dmat);
- pmat = &dmat;
+ gs_currentmatrix((const gs_state *)pis, &dmat);
+ pmat = &dmat;
} else
- dmat = *pmat;
+ dmat = *pmat;
gs_currentmatrix(pgs, &smat);
code = image2_set_data(pim, &idata);
if (code < 0)
- return code;
+ return code;
/****** ONLY HANDLE SIMPLE CASES FOR NOW ******/
if (idata.bbox.p.x != floor(idata.origin.x))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (!(idata.bbox.p.y == floor(idata.origin.y) ||
- idata.bbox.q.y == ceil(idata.origin.y))
- )
- return_error(gs_error_rangecheck);
+ idata.bbox.q.y == ceil(idata.origin.y))
+ )
+ return_error(gs_error_rangecheck);
source_size = (idata.image.Width * depth + 7) >> 3;
row_size = max(3 * idata.image.Width, source_size);
row = gs_alloc_bytes(mem, row_size, "gx_begin_image2");
if (row == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (pixel_copy) {
- idata.image.BitsPerComponent = depth;
- has_alpha = false; /* no separate alpha channel */
-
- if ( pcpath == NULL ||
- gx_cpath_includes_rectangle(pcpath,
- int2fixed(idata.bbox.p.x),
- int2fixed(idata.bbox.p.y),
- int2fixed(idata.bbox.q.x),
- int2fixed(idata.bbox.q.y)) ) {
- gs_matrix mat;
+ idata.image.BitsPerComponent = depth;
+ has_alpha = false; /* no separate alpha channel */
+ if ( pcpath == NULL ||
+ gx_cpath_includes_rectangle(pcpath,
+ int2fixed(idata.bbox.p.x),
+ int2fixed(idata.bbox.p.y),
+ int2fixed(idata.bbox.q.x),
+ int2fixed(idata.bbox.q.y)) ) {
+ gs_matrix mat;
- /*
- * Figure 7.2 of the Adobe 3010 Supplement says that we should
- * compute CTM x ImageMatrix here, but I'm almost certain it
- * should be the other way around. Also see gdevx.c.
- */
- gs_matrix_multiply(&idata.image.ImageMatrix, &smat, &mat);
- direct_copy =
- (is_xxyy(&dmat) || is_xyyx(&dmat)) &&
+ /*
+ * Figure 7.2 of the Adobe 3010 Supplement says that we should
+ * compute CTM x ImageMatrix here, but I'm almost certain it
+ * should be the other way around. Also see gdevx.c.
+ */
+ gs_matrix_multiply(&idata.image.ImageMatrix, &smat, &mat);
+ direct_copy =
+ (is_xxyy(&dmat) || is_xyyx(&dmat)) &&
#define eqe(e) mat.e == dmat.e
- eqe(xx) && eqe(xy) && eqe(yx) && eqe(yy);
+ eqe(xx) && eqe(xy) && eqe(yx) && eqe(yy);
#undef eqe
}
} else {
- idata.image.BitsPerComponent = 8;
+ idata.image.BitsPerComponent = 8;
- /* Always use RGB source color for now.
+ /* Always use RGB source color for now.
*
- * The source device has alpha if the same RGB values with
- * different alphas map to different pixel values.
- ****** THIS IS NOT GOOD ENOUGH: WE WANT TO SKIP TRANSFERRING
- ****** ALPHA IF THE SOURCE IS CAPABLE OF HAVING ALPHA BUT
- ****** DOESN'T CURRENTLY HAVE ANY ACTUAL ALPHA VALUES DIFFERENT
- ****** FROM 1.
- */
- /*
- * Since the default implementation of map_rgb_alpha_color
- * premultiplies the color towards white, we can't just test
- * whether changing alpha has an effect on the color.
- */
- {
- gx_color_index trans_black =
- (*dev_proc(sdev, map_rgb_alpha_color))
- (sdev, (gx_color_value) 0, (gx_color_value) 0,
- (gx_color_value) 0, (gx_color_value) 0);
+ * The source device has alpha if the same RGB values with
+ * different alphas map to different pixel values.
+ ****** THIS IS NOT GOOD ENOUGH: WE WANT TO SKIP TRANSFERRING
+ ****** ALPHA IF THE SOURCE IS CAPABLE OF HAVING ALPHA BUT
+ ****** DOESN'T CURRENTLY HAVE ANY ACTUAL ALPHA VALUES DIFFERENT
+ ****** FROM 1.
+ */
+ /*
+ * Since the default implementation of map_rgb_alpha_color
+ * premultiplies the color towards white, we can't just test
+ * whether changing alpha has an effect on the color.
+ */
+ {
+ gx_color_index trans_black =
+ (*dev_proc(sdev, map_rgb_alpha_color))
+ (sdev, (gx_color_value) 0, (gx_color_value) 0,
+ (gx_color_value) 0, (gx_color_value) 0);
- has_alpha =
- trans_black != (*dev_proc(sdev, map_rgb_alpha_color))
- (sdev, (gx_color_value) 0, (gx_color_value) 0,
- (gx_color_value) 0, gx_max_color_value) &&
- trans_black != (*dev_proc(sdev, map_rgb_alpha_color))
- (sdev, gx_max_color_value, gx_max_color_value,
- gx_max_color_value, gx_max_color_value);
- }
+ has_alpha =
+ trans_black != (*dev_proc(sdev, map_rgb_alpha_color))
+ (sdev, (gx_color_value) 0, (gx_color_value) 0,
+ (gx_color_value) 0, gx_max_color_value) &&
+ trans_black != (*dev_proc(sdev, map_rgb_alpha_color))
+ (sdev, gx_max_color_value, gx_max_color_value,
+ gx_max_color_value, gx_max_color_value);
+ }
}
idata.image.Alpha =
- (has_alpha ? gs_image_alpha_last : gs_image_alpha_none);
+ (has_alpha ? gs_image_alpha_last : gs_image_alpha_none);
if (smat.yy < 0) {
- /*
- * The source Y axis is reflected. Reflect the mapping from
- * user space to source data.
- */
- idata.image.ImageMatrix.ty += idata.image.Height *
- idata.image.ImageMatrix.yy;
- idata.image.ImageMatrix.xy = -idata.image.ImageMatrix.xy;
- idata.image.ImageMatrix.yy = -idata.image.ImageMatrix.yy;
+ /*
+ * The source Y axis is reflected. Reflect the mapping from
+ * user space to source data.
+ */
+ idata.image.ImageMatrix.ty += idata.image.Height *
+ idata.image.ImageMatrix.yy;
+ idata.image.ImageMatrix.xy = -idata.image.ImageMatrix.xy;
+ idata.image.ImageMatrix.yy = -idata.image.ImageMatrix.yy;
}
if (!direct_copy)
- code = (*dev_proc(dev, begin_typed_image))
- (dev, pis, pmat, (const gs_image_common_t *)&idata.image, NULL,
- pdcolor, pcpath, mem, &info);
+ code = (*dev_proc(dev, begin_typed_image))
+ (dev, pis, pmat, (const gs_image_common_t *)&idata.image, NULL,
+ pdcolor, pcpath, mem, &info);
if (code >= 0) {
- int y;
- gs_int_rect rect;
- gs_get_bits_params_t params;
- const byte *data;
- uint offset = row_size - source_size;
+ int y;
+ gs_int_rect rect;
+ gs_get_bits_params_t params;
+ const byte *data;
+ uint offset = row_size - source_size;
- rect = idata.bbox;
- for (y = 0; code >= 0 && y < idata.image.Height; ++y) {
- gs_int_rect *unread = 0;
- int num_unread;
+ rect = idata.bbox;
+ for (y = 0; code >= 0 && y < idata.image.Height; ++y) {
+ gs_int_rect *unread = 0;
+ int num_unread;
/****** y COMPUTATION IS ROUNDED -- WRONG ******/
- rect.q.y = rect.p.y + 1;
- /* Insist on x_offset = 0 to simplify the conversion loop. */
- params.options =
- GB_ALIGN_ANY | (GB_RETURN_COPY | GB_RETURN_POINTER) |
- GB_OFFSET_0 | (GB_RASTER_STANDARD | GB_RASTER_ANY) |
- GB_PACKING_CHUNKY;
- if (pixel_copy) {
- params.options |= GB_COLORS_NATIVE;
- params.data[0] = row + offset;
- code = (*dev_proc(sdev, get_bits_rectangle))
- (sdev, &rect, &params, &unread);
- if (code < 0)
- break;
- num_unread = code;
- data = params.data[0];
- if (direct_copy) {
- /*
- * Copy the pixels directly to the destination.
- * We know that the transformation is only a translation,
- * but we must handle an inverted destination Y axis.
- */
- code = (*dev_proc(dev, copy_color))
- (dev, data, 0, row_size, gx_no_bitmap_id,
- (int)(dmat.tx - idata.image.ImageMatrix.tx),
- (int)(dmat.ty - idata.image.ImageMatrix.ty +
- (dmat.yy < 0 ? ~y : y)),
- idata.image.Width, 1);
- continue;
- }
- } else {
- /*
- * Convert the pixels to pure colors. This may be very
- * slow and painful. Eventually we will use indexed color for
- * narrow pixels.
- */
- /* Always use RGB source color for now. */
- params.options |=
- GB_COLORS_RGB | GB_DEPTH_8 |
- (has_alpha ? GB_ALPHA_LAST : GB_ALPHA_NONE);
- params.data[0] = row;
- code = (*dev_proc(sdev, get_bits_rectangle))
- (sdev, &rect, &params, &unread);
- if (code < 0)
- break;
- num_unread = code;
- data = params.data[0];
- }
- if (num_unread > 0 && pim->UnpaintedPath) {
- /* Add the rectangle(s) to the unpainted path. */
- int i;
+ rect.q.y = rect.p.y + 1;
+ /* Insist on x_offset = 0 to simplify the conversion loop. */
+ params.options =
+ GB_ALIGN_ANY | (GB_RETURN_COPY | GB_RETURN_POINTER) |
+ GB_OFFSET_0 | (GB_RASTER_STANDARD | GB_RASTER_ANY) |
+ GB_PACKING_CHUNKY;
+ if (pixel_copy) {
+ params.options |= GB_COLORS_NATIVE;
+ params.data[0] = row + offset;
+ code = (*dev_proc(sdev, get_bits_rectangle))
+ (sdev, &rect, &params, &unread);
+ if (code < 0)
+ break;
+ num_unread = code;
+ data = params.data[0];
+ if (direct_copy) {
+ /*
+ * Copy the pixels directly to the destination.
+ * We know that the transformation is only a translation,
+ * but we must handle an inverted destination Y axis.
+ */
+ code = (*dev_proc(dev, copy_color))
+ (dev, data, 0, row_size, gx_no_bitmap_id,
+ (int)(dmat.tx - idata.image.ImageMatrix.tx),
+ (int)(dmat.ty - idata.image.ImageMatrix.ty +
+ (dmat.yy < 0 ? ~y : y)),
+ idata.image.Width, 1);
+ continue;
+ }
+ } else {
+ /*
+ * Convert the pixels to pure colors. This may be very
+ * slow and painful. Eventually we will use indexed color for
+ * narrow pixels.
+ */
+ /* Always use RGB source color for now. */
+ params.options |=
+ GB_COLORS_RGB | GB_DEPTH_8 |
+ (has_alpha ? GB_ALPHA_LAST : GB_ALPHA_NONE);
+ params.data[0] = row;
+ code = (*dev_proc(sdev, get_bits_rectangle))
+ (sdev, &rect, &params, &unread);
+ if (code < 0)
+ break;
+ num_unread = code;
+ data = params.data[0];
+ }
+ if (num_unread > 0 && pim->UnpaintedPath) {
+ /* Add the rectangle(s) to the unpainted path. */
+ int i;
- for (i = 0; code >= 0 && i < num_unread; ++i)
- code = gx_path_add_rectangle(pim->UnpaintedPath,
- int2fixed(unread[i].p.x),
- int2fixed(unread[i].p.y),
- int2fixed(unread[i].q.x),
- int2fixed(unread[i].q.y));
- gs_free_object(dev->memory, unread, "UnpaintedPath unread");
- }
- code = gx_image_data(info, &data, 0, row_size, 1);
- rect.p.y = rect.q.y;
- }
- if (!direct_copy) {
- if (code >= 0)
- code = gx_image_end(info, true);
- else
- discard(gx_image_end(info, false));
- }
+ for (i = 0; code >= 0 && i < num_unread; ++i)
+ code = gx_path_add_rectangle(pim->UnpaintedPath,
+ int2fixed(unread[i].p.x),
+ int2fixed(unread[i].p.y),
+ int2fixed(unread[i].q.x),
+ int2fixed(unread[i].q.y));
+ gs_free_object(dev->memory, unread, "UnpaintedPath unread");
+ }
+ code = gx_image_data(info, &data, 0, row_size, 1);
+ rect.p.y = rect.q.y;
+ }
+ if (!direct_copy) {
+ if (code >= 0)
+ code = gx_image_end(info, true);
+ else
+ discard(gx_image_end(info, false));
+ }
}
gs_free_object(mem, row, "gx_begin_image2");
return (code < 0 ? code : 1);
diff --git a/gs/base/gximage3.c b/gs/base/gximage3.c
index 13d9944dd..c9c195cb0 100644
--- a/gs/base/gximage3.c
+++ b/gs/base/gximage3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,7 @@ static const gx_image_enum_procs_t image3_enum_procs = {
/* Initialize an ImageType 3 image. */
void
gs_image3_t_init(gs_image3_t * pim, gs_color_space * color_space,
- gs_image3_interleave_type_t interleave_type)
+ gs_image3_interleave_type_t interleave_type)
{
gs_pixel_image_t_init((gs_pixel_image_t *) pim, color_space);
pim->type = &gs_image_type_3;
@@ -93,15 +93,15 @@ gs_private_st_suffix_add6(st_image3_enum, gx_image3_enum_t, "gx_image3_enum_t",
static IMAGE3_MAKE_MID_PROC(make_mid_default); /* check prototype */
static int
make_mid_default(gx_device **pmidev, gx_device *dev, int width, int height,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
gx_device_memory *midev =
- gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "make_mid_default");
+ gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
+ "make_mid_default");
int code;
if (midev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gs_make_mem_mono_device(midev, mem, NULL);
midev->bitmap_memory = mem;
midev->width = width;
@@ -110,68 +110,68 @@ make_mid_default(gx_device **pmidev, gx_device *dev, int width, int height,
gx_device_fill_in_procs((gx_device *)midev);
code = dev_proc(midev, open_device)((gx_device *)midev);
if (code < 0) {
- gs_free_object(mem, midev, "make_mid_default");
- return code;
+ gs_free_object(mem, midev, "make_mid_default");
+ return code;
}
midev->is_open = true;
dev_proc(midev, fill_rectangle)
- ((gx_device *)midev, 0, 0, width, height, (gx_color_index)0);
+ ((gx_device *)midev, 0, 0, width, height, (gx_color_index)0);
*pmidev = (gx_device *)midev;
return 0;
}
static IMAGE3_MAKE_MCDE_PROC(make_mcde_default); /* check prototype */
static int
make_mcde_default(gx_device *dev, const gs_imager_state *pis,
- const gs_matrix *pmat, const gs_image_common_t *pic,
- const gs_int_rect *prect, const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- gx_image_enum_common_t **pinfo,
- gx_device **pmcdev, gx_device *midev,
- gx_image_enum_common_t *pminfo,
- const gs_int_point *origin)
+ const gs_matrix *pmat, const gs_image_common_t *pic,
+ const gs_int_rect *prect, const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ gx_image_enum_common_t **pinfo,
+ gx_device **pmcdev, gx_device *midev,
+ gx_image_enum_common_t *pminfo,
+ const gs_int_point *origin)
{
gx_device_memory *const mdev = (gx_device_memory *)midev;
gx_device_mask_clip *mcdev =
- gs_alloc_struct(mem, gx_device_mask_clip, &st_device_mask_clip,
- "make_mcde_default");
+ gs_alloc_struct(mem, gx_device_mask_clip, &st_device_mask_clip,
+ "make_mcde_default");
gx_strip_bitmap bits; /* only gx_bitmap */
int code;
if (mcdev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
bits.data = mdev->base;
bits.raster = mdev->raster;
bits.size.x = mdev->width;
bits.size.y = mdev->height;
bits.id = gx_no_bitmap_id;
code = gx_mask_clip_initialize(mcdev, &gs_mask_clip_device,
- (const gx_bitmap *)&bits, dev,
- origin->x, origin->y, mem);
+ (const gx_bitmap *)&bits, dev,
+ origin->x, origin->y, mem);
if (code < 0) {
- gs_free_object(mem, mcdev, "make_mcde_default");
- return code;
+ gs_free_object(mem, mcdev, "make_mcde_default");
+ return code;
}
mcdev->tiles = bits;
code = dev_proc(mcdev, begin_typed_image)
- ((gx_device *)mcdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
- pinfo);
+ ((gx_device *)mcdev, pis, pmat, pic, prect, pdcolor, pcpath, mem,
+ pinfo);
if (code < 0) {
- gs_free_object(mem, mcdev, "make_mcde_default");
- return code;
+ gs_free_object(mem, mcdev, "make_mcde_default");
+ return code;
}
*pmcdev = (gx_device *)mcdev;
return 0;
}
static int
gx_begin_image3(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
return gx_begin_image3_generic(dev, pis, pmat, pic, prect, pdcolor,
- pcpath, mem, make_mid_default,
- make_mcde_default, pinfo);
+ pcpath, mem, make_mid_default,
+ make_mcde_default, pinfo);
}
/*
@@ -181,13 +181,13 @@ gx_begin_image3(gx_device * dev,
static bool check_image3_extent(floatp mask_coeff, floatp data_coeff);
int
gx_begin_image3_generic(gx_device * dev,
- const gs_imager_state *pis, const gs_matrix *pmat,
- const gs_image_common_t *pic, const gs_int_rect *prect,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- image3_make_mid_proc_t make_mid,
- image3_make_mcde_proc_t make_mcde,
- gx_image_enum_common_t **pinfo)
+ const gs_imager_state *pis, const gs_matrix *pmat,
+ const gs_image_common_t *pic, const gs_int_rect *prect,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ image3_make_mid_proc_t make_mid,
+ image3_make_mcde_proc_t make_mcde,
+ gx_image_enum_common_t **pinfo)
{
const gs_image3_t *pim = (const gs_image3_t *)pic;
gx_image3_enum_t *penum;
@@ -202,98 +202,98 @@ gx_begin_image3_generic(gx_device * dev,
/* Validate the parameters. */
if (pim->Height <= 0 || pim->MaskDict.Height <= 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
switch (pim->InterleaveType) {
- default:
- return_error(gs_error_rangecheck);
- case interleave_chunky:
- if (pim->MaskDict.Width != pim->Width ||
- pim->MaskDict.Height != pim->Height ||
- pim->MaskDict.BitsPerComponent != pim->BitsPerComponent ||
- pim->format != gs_image_format_chunky
- )
- return_error(gs_error_rangecheck);
- break;
- case interleave_scan_lines:
- if (pim->MaskDict.Height % pim->Height != 0 &&
- pim->Height % pim->MaskDict.Height != 0
- )
- return_error(gs_error_rangecheck);
- /* falls through */
- case interleave_separate_source:
- if (pim->MaskDict.BitsPerComponent != 1)
- return_error(gs_error_rangecheck);
+ default:
+ return_error(gs_error_rangecheck);
+ case interleave_chunky:
+ if (pim->MaskDict.Width != pim->Width ||
+ pim->MaskDict.Height != pim->Height ||
+ pim->MaskDict.BitsPerComponent != pim->BitsPerComponent ||
+ pim->format != gs_image_format_chunky
+ )
+ return_error(gs_error_rangecheck);
+ break;
+ case interleave_scan_lines:
+ if (pim->MaskDict.Height % pim->Height != 0 &&
+ pim->Height % pim->MaskDict.Height != 0
+ )
+ return_error(gs_error_rangecheck);
+ /* falls through */
+ case interleave_separate_source:
+ if (pim->MaskDict.BitsPerComponent != 1)
+ return_error(gs_error_rangecheck);
}
if (!check_image3_extent(pim->ImageMatrix.xx,
- pim->MaskDict.ImageMatrix.xx) ||
- !check_image3_extent(pim->ImageMatrix.xy,
- pim->MaskDict.ImageMatrix.xy) ||
- !check_image3_extent(pim->ImageMatrix.yx,
- pim->MaskDict.ImageMatrix.yx) ||
- !check_image3_extent(pim->ImageMatrix.yy,
- pim->MaskDict.ImageMatrix.yy)
- )
- return_error(gs_error_rangecheck);
+ pim->MaskDict.ImageMatrix.xx) ||
+ !check_image3_extent(pim->ImageMatrix.xy,
+ pim->MaskDict.ImageMatrix.xy) ||
+ !check_image3_extent(pim->ImageMatrix.yx,
+ pim->MaskDict.ImageMatrix.yx) ||
+ !check_image3_extent(pim->ImageMatrix.yy,
+ pim->MaskDict.ImageMatrix.yy)
+ )
+ return_error(gs_error_rangecheck);
if ((code = gs_matrix_invert(&pim->ImageMatrix, &mi_pixel)) < 0 ||
- (code = gs_matrix_invert(&pim->MaskDict.ImageMatrix, &mi_mask)) < 0
- )
- return code;
+ (code = gs_matrix_invert(&pim->MaskDict.ImageMatrix, &mi_mask)) < 0
+ )
+ return code;
if (fabs(mi_pixel.tx - mi_mask.tx) >= 0.5 ||
- fabs(mi_pixel.ty - mi_mask.ty) >= 0.5
- )
- return_error(gs_error_rangecheck);
+ fabs(mi_pixel.ty - mi_mask.ty) >= 0.5
+ )
+ return_error(gs_error_rangecheck);
#ifdef DEBUG
{
- /* Although the PLRM says that the Mask and Image *must* be the same size, */
- /* Adobe CPSI (and other RIPS) ignore this and process anyway. Note that we */
- /* are not compatible if the Mask Height than the Data (pixel) Height. CPSI */
- /* de-interleaves the mask from the data image and stops at the Mask Height */
- /* Problem detected with Genoa 468-03 (part of file 468-01.ps) */
- /***** fixme: When Data Image Height > Mask Height *****/
- gs_point ep, em;
-
- if ((code = gs_point_transform(pim->Width, pim->Height, &mi_pixel,
- &ep)) < 0 ||
- (code = gs_point_transform(pim->MaskDict.Width,
- pim->MaskDict.Height, &mi_mask,
- &em)) < 0
- )
- return code;
- if (fabs(ep.x - em.x) >= 0.5 || fabs(ep.y - em.y) >= 0.5)
- code = gs_error_rangecheck; /* leave the check in for debug breakpoint */
+ /* Although the PLRM says that the Mask and Image *must* be the same size, */
+ /* Adobe CPSI (and other RIPS) ignore this and process anyway. Note that we */
+ /* are not compatible if the Mask Height than the Data (pixel) Height. CPSI */
+ /* de-interleaves the mask from the data image and stops at the Mask Height */
+ /* Problem detected with Genoa 468-03 (part of file 468-01.ps) */
+ /***** fixme: When Data Image Height > Mask Height *****/
+ gs_point ep, em;
+
+ if ((code = gs_point_transform(pim->Width, pim->Height, &mi_pixel,
+ &ep)) < 0 ||
+ (code = gs_point_transform(pim->MaskDict.Width,
+ pim->MaskDict.Height, &mi_mask,
+ &em)) < 0
+ )
+ return code;
+ if (fabs(ep.x - em.x) >= 0.5 || fabs(ep.y - em.y) >= 0.5)
+ code = gs_error_rangecheck; /* leave the check in for debug breakpoint */
}
#endif /* DEBUG */
penum = gs_alloc_struct(mem, gx_image3_enum_t, &st_image3_enum,
- "gx_begin_image3");
+ "gx_begin_image3");
if (penum == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
penum->num_components =
- gs_color_space_num_components(pim->ColorSpace);
+ gs_color_space_num_components(pim->ColorSpace);
gx_image_enum_common_init((gx_image_enum_common_t *) penum,
- (const gs_data_image_t *)pim,
- &image3_enum_procs, dev,
- 1 + penum->num_components,
- pim->format);
+ (const gs_data_image_t *)pim,
+ &image3_enum_procs, dev,
+ 1 + penum->num_components,
+ pim->format);
/* Initialize pointers now in case we bail out. */
penum->mask_data = 0;
penum->pixel_data = 0;
if (prect) {
- long lmw = pim->MaskDict.Width, lmh = pim->MaskDict.Height;
-
- data_rect = *prect;
- mask_rect.p.x = (int)(data_rect.p.x * lmw / pim->Width);
- mask_rect.p.y = (int)(data_rect.p.y * lmh / pim->Height);
- mask_rect.q.x = (int)((data_rect.q.x + pim->Width - 1) * lmw /
- pim->Width);
- mask_rect.q.y = (int)((data_rect.q.y + pim->Height - 1) * lmh /
- pim->Height);
+ long lmw = pim->MaskDict.Width, lmh = pim->MaskDict.Height;
+
+ data_rect = *prect;
+ mask_rect.p.x = (int)(data_rect.p.x * lmw / pim->Width);
+ mask_rect.p.y = (int)(data_rect.p.y * lmh / pim->Height);
+ mask_rect.q.x = (int)((data_rect.q.x + pim->Width - 1) * lmw /
+ pim->Width);
+ mask_rect.q.y = (int)((data_rect.q.y + pim->Height - 1) * lmh /
+ pim->Height);
} else {
- mask_rect.p.x = mask_rect.p.y = 0;
- mask_rect.q.x = pim->MaskDict.Width;
- mask_rect.q.y = pim->MaskDict.Height;
- data_rect.p.x = data_rect.p.y = 0;
- data_rect.q.x = pim->Width;
- data_rect.q.y = pim->Height;
+ mask_rect.p.x = mask_rect.p.y = 0;
+ mask_rect.q.x = pim->MaskDict.Width;
+ mask_rect.q.y = pim->MaskDict.Height;
+ data_rect.p.x = data_rect.p.y = 0;
+ data_rect.q.x = pim->Width;
+ data_rect.q.y = pim->Height;
}
penum->mask_width = mask_rect.q.x - mask_rect.p.x;
penum->mask_height = mask_rect.q.y - mask_rect.p.y;
@@ -307,19 +307,19 @@ gx_begin_image3_generic(gx_device * dev,
penum->mask_info = 0;
penum->pixel_info = 0;
if (pim->InterleaveType == interleave_chunky) {
- /* Allocate row buffers for the mask and pixel data. */
- penum->pixel_data =
- gs_alloc_bytes(mem,
- (penum->pixel_width * pim->BitsPerComponent *
- penum->num_components + 7) >> 3,
- "gx_begin_image3(pixel_data)");
- penum->mask_data =
- gs_alloc_bytes(mem, (penum->mask_width + 7) >> 3,
- "gx_begin_image3(mask_data)");
- if (penum->pixel_data == 0 || penum->mask_data == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out1;
- }
+ /* Allocate row buffers for the mask and pixel data. */
+ penum->pixel_data =
+ gs_alloc_bytes(mem,
+ (penum->pixel_width * pim->BitsPerComponent *
+ penum->num_components + 7) >> 3,
+ "gx_begin_image3(pixel_data)");
+ penum->mask_data =
+ gs_alloc_bytes(mem, (penum->mask_width + 7) >> 3,
+ "gx_begin_image3(mask_data)");
+ if (penum->pixel_data == 0 || penum->mask_data == 0) {
+ code = gs_note_error(gs_error_VMerror);
+ goto out1;
+ }
}
penum->InterleaveType = pim->InterleaveType;
penum->bpc = pim->BitsPerComponent;
@@ -328,65 +328,65 @@ gx_begin_image3_generic(gx_device * dev,
mrect.q.x = pim->MaskDict.Width;
mrect.q.y = pim->MaskDict.Height;
if (pmat == 0)
- pmat = &ctm_only(pis);
+ pmat = &ctm_only(pis);
if ((code = gs_matrix_multiply(&mi_mask, pmat, &mat)) < 0 ||
- (code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
- )
- return code;
+ (code = gs_bbox_transform(&mrect, &mat, &mrect)) < 0
+ )
+ return code;
origin.x = (mrect.p.x < 0) ? (int)ceil(mrect.p.x) : (int)floor(mrect.p.x);
origin.y = (mrect.p.y < 0) ? (int)ceil(mrect.p.y) : (int)floor(mrect.p.y);
code = make_mid(&mdev, dev, (int)ceil(mrect.q.x) - origin.x,
- (int)ceil(mrect.q.y) - origin.y, mem);
+ (int)ceil(mrect.q.y) - origin.y, mem);
if (code < 0)
- goto out1;
+ goto out1;
penum->mdev = mdev;
gs_image_t_init_mask(&i_mask, false);
i_mask.adjust = false;
{
- const gx_image_type_t *type1 = i_mask.type;
+ const gx_image_type_t *type1 = i_mask.type;
- *(gs_data_image_t *)&i_mask = pim->MaskDict;
- i_mask.type = type1;
- i_mask.BitsPerComponent = 1;
+ *(gs_data_image_t *)&i_mask = pim->MaskDict;
+ i_mask.type = type1;
+ i_mask.BitsPerComponent = 1;
i_mask.image_parent_type = gs_image_type3;
}
{
- gx_drawing_color dcolor;
- gs_matrix m_mat;
-
- set_nonclient_dev_color(&dcolor, 1);
- /*
- * Adjust the translation for rendering the mask to include a
- * negative translation by origin.{x,y} in device space.
- */
- m_mat = *pmat;
- m_mat.tx -= origin.x;
- m_mat.ty -= origin.y;
- /*
- * Note that pis = NULL here, since we don't want to have to
- * create another imager state with default log_op, etc.
- */
- code = gx_device_begin_typed_image(mdev, NULL, &m_mat,
- (const gs_image_common_t *)&i_mask,
- &mask_rect, &dcolor, NULL, mem,
- &penum->mask_info);
- if (code < 0)
- goto out2;
+ gx_drawing_color dcolor;
+ gs_matrix m_mat;
+
+ set_nonclient_dev_color(&dcolor, 1);
+ /*
+ * Adjust the translation for rendering the mask to include a
+ * negative translation by origin.{x,y} in device space.
+ */
+ m_mat = *pmat;
+ m_mat.tx -= origin.x;
+ m_mat.ty -= origin.y;
+ /*
+ * Note that pis = NULL here, since we don't want to have to
+ * create another imager state with default log_op, etc.
+ */
+ code = gx_device_begin_typed_image(mdev, NULL, &m_mat,
+ (const gs_image_common_t *)&i_mask,
+ &mask_rect, &dcolor, NULL, mem,
+ &penum->mask_info);
+ if (code < 0)
+ goto out2;
}
gs_image_t_init(&i_pixel, pim->ColorSpace);
{
- const gx_image_type_t *type1 = i_pixel.type;
+ const gx_image_type_t *type1 = i_pixel.type;
- *(gs_pixel_image_t *)&i_pixel = *(const gs_pixel_image_t *)pim;
- i_pixel.type = type1;
+ *(gs_pixel_image_t *)&i_pixel = *(const gs_pixel_image_t *)pim;
+ i_pixel.type = type1;
i_pixel.image_parent_type = gs_image_type3;
}
code = make_mcde(dev, pis, pmat, (const gs_image_common_t *)&i_pixel,
- prect, pdcolor, pcpath, mem, &penum->pixel_info,
- &pcdev, mdev, penum->mask_info, &origin);
+ prect, pdcolor, pcpath, mem, &penum->pixel_info,
+ &pcdev, mdev, penum->mask_info, &origin);
if (code < 0)
- goto out3;
+ goto out3;
penum->pcdev = pcdev;
/*
* Set num_planes, plane_widths, and plane_depths from the values in the
@@ -394,33 +394,33 @@ gx_begin_image3_generic(gx_device * dev,
*/
switch (pim->InterleaveType) {
case interleave_chunky:
- /* Add the mask data to the depth of the image data. */
- penum->num_planes = 1;
- penum->plane_widths[0] = pim->Width;
- penum->plane_depths[0] =
- penum->pixel_info->plane_depths[0] *
- (penum->num_components + 1) / penum->num_components;
- break;
+ /* Add the mask data to the depth of the image data. */
+ penum->num_planes = 1;
+ penum->plane_widths[0] = pim->Width;
+ penum->plane_depths[0] =
+ penum->pixel_info->plane_depths[0] *
+ (penum->num_components + 1) / penum->num_components;
+ break;
case interleave_scan_lines:
- /*
- * There is only 1 plane, with dynamically changing width & depth.
- * Initialize it for the mask data, since that is what will be
- * read first.
- */
- penum->num_planes = 1;
- penum->plane_depths[0] = 1;
- penum->plane_widths[0] = pim->MaskDict.Width;
- break;
+ /*
+ * There is only 1 plane, with dynamically changing width & depth.
+ * Initialize it for the mask data, since that is what will be
+ * read first.
+ */
+ penum->num_planes = 1;
+ penum->plane_depths[0] = 1;
+ penum->plane_widths[0] = pim->MaskDict.Width;
+ break;
case interleave_separate_source:
- /* Insert the mask data as a separate plane before the image data. */
- penum->num_planes = penum->pixel_info->num_planes + 1;
- penum->plane_widths[0] = pim->MaskDict.Width;
- penum->plane_depths[0] = 1;
- memcpy(&penum->plane_widths[1], &penum->pixel_info->plane_widths[0],
- (penum->num_planes - 1) * sizeof(penum->plane_widths[0]));
- memcpy(&penum->plane_depths[1], &penum->pixel_info->plane_depths[0],
- (penum->num_planes - 1) * sizeof(penum->plane_depths[0]));
- break;
+ /* Insert the mask data as a separate plane before the image data. */
+ penum->num_planes = penum->pixel_info->num_planes + 1;
+ penum->plane_widths[0] = pim->MaskDict.Width;
+ penum->plane_depths[0] = 1;
+ memcpy(&penum->plane_widths[1], &penum->pixel_info->plane_widths[0],
+ (penum->num_planes - 1) * sizeof(penum->plane_widths[0]));
+ memcpy(&penum->plane_depths[1], &penum->pixel_info->plane_depths[0],
+ (penum->num_planes - 1) * sizeof(penum->plane_depths[0]));
+ break;
}
gx_device_retain(mdev, true); /* will free explicitly */
gx_device_retain(pcdev, true); /* ditto */
@@ -441,9 +441,9 @@ static bool
check_image3_extent(floatp mask_coeff, floatp data_coeff)
{
if (mask_coeff == 0)
- return data_coeff == 0;
+ return data_coeff == 0;
if (data_coeff == 0 || (mask_coeff > 0) != (data_coeff > 0))
- return false;
+ return false;
return true;
}
@@ -465,23 +465,23 @@ planes_next(const gx_image3_enum_t *penum)
int mask_h = penum->mask_full_height;
int pixel_h = penum->pixel_full_height;
long current = penum->pixel_y * (long)mask_h -
- penum->mask_y * (long)pixel_h;
+ penum->mask_y * (long)pixel_h;
#ifdef DEBUG
if (current > 0)
- lprintf4("planes_next invariant fails: %d/%d > %d/%d\n",
- penum->pixel_y, penum->pixel_full_height,
- penum->mask_y, penum->mask_full_height);
+ lprintf4("planes_next invariant fails: %d/%d > %d/%d\n",
+ penum->pixel_y, penum->pixel_full_height,
+ penum->mask_y, penum->mask_full_height);
#endif
return ((current += mask_h) <= 0 ? -1 :
- current - pixel_h <= 0 ? 0 : 1);
+ current - pixel_h <= 0 ? 0 : 1);
}
/* Process the next piece of an ImageType 3 image. */
static int
gx_image3_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_image3_enum_t *penum = (gx_image3_enum_t *) info;
int pixel_height = penum->pixel_height;
@@ -497,168 +497,168 @@ gx_image3_plane_data(gx_image_enum_common_t * info,
/* Initialized rows_used in case we get an error. */
*rows_used = 0;
switch (penum->InterleaveType) {
- case interleave_chunky:
- if (h <= 0)
- return 0;
- if (h > 1) {
- /* Do the operation one row at a time. */
- int h_orig = h;
-
- mask_plane = planes[0];
- do {
- code = gx_image3_plane_data(info, &mask_plane, 1,
- rows_used);
- h -= *rows_used;
- if (code)
- break;
- mask_plane.data += mask_plane.raster;
- } while (h);
- *rows_used = h_orig - h;
- return code;
- } {
- /* Pull apart the source data and the mask data. */
- int bpc = penum->bpc;
- int num_components = penum->num_components;
- int width = penum->pixel_width;
-
- /* We do this in the simplest (not fastest) way for now. */
- uint bit_x = bpc * (num_components + 1) * planes[0].data_x;
-
- sample_load_declare_setup(sptr, sbit,
- planes[0].data + (bit_x >> 3),
- bit_x & 7, bpc);
- sample_store_declare_setup(mptr, mbit, mbbyte,
- penum->mask_data, 0, 1);
- sample_store_declare_setup(pptr, pbit, pbbyte,
- penum->pixel_data, 0, bpc);
- int x;
-
- mask_plane.data = mptr;
- mask_plane.data_x = 0;
- mask_plane.raster = 0; /* raster doesn't matter, pacify Valgrind */
- pixel_plane.data = pptr;
- pixel_plane.data_x = 0;
- /* raster doesn't matter */
- pixel_planes = &pixel_plane;
- for (x = 0; x < width; ++x) {
- uint value;
- int i;
-
- sample_load_next12(value, sptr, sbit, bpc);
- sample_store_next12(value != 0, mptr, mbit, 1, mbbyte);
- for (i = 0; i < num_components; ++i) {
- sample_load_next12(value, sptr, sbit, bpc);
- sample_store_next12(value, pptr, pbit, bpc, pbbyte);
- }
- }
- sample_store_flush(mptr, mbit, 1, mbbyte);
- sample_store_flush(pptr, pbit, bpc, pbbyte);
- }
- break;
- case interleave_scan_lines:
- if (planes_next(penum) >= 0) {
- /* This is mask data. */
- mask_plane = planes[0];
- pixel_planes = &pixel_plane;
- pixel_plane.data = 0;
- } else {
- /* This is pixel data. */
- mask_plane.data = 0;
- pixel_planes = planes;
- }
- break;
- case interleave_separate_source:
- /*
- * In order to be able to recover from interruptions, we must
- * limit separate-source processing to 1 scan line at a time.
- */
- if (h > 1)
- h = 1;
- mask_plane = planes[0];
- pixel_planes = planes + 1;
- break;
- default: /* not possible */
- return_error(gs_error_rangecheck);
+ case interleave_chunky:
+ if (h <= 0)
+ return 0;
+ if (h > 1) {
+ /* Do the operation one row at a time. */
+ int h_orig = h;
+
+ mask_plane = planes[0];
+ do {
+ code = gx_image3_plane_data(info, &mask_plane, 1,
+ rows_used);
+ h -= *rows_used;
+ if (code)
+ break;
+ mask_plane.data += mask_plane.raster;
+ } while (h);
+ *rows_used = h_orig - h;
+ return code;
+ } {
+ /* Pull apart the source data and the mask data. */
+ int bpc = penum->bpc;
+ int num_components = penum->num_components;
+ int width = penum->pixel_width;
+
+ /* We do this in the simplest (not fastest) way for now. */
+ uint bit_x = bpc * (num_components + 1) * planes[0].data_x;
+
+ sample_load_declare_setup(sptr, sbit,
+ planes[0].data + (bit_x >> 3),
+ bit_x & 7, bpc);
+ sample_store_declare_setup(mptr, mbit, mbbyte,
+ penum->mask_data, 0, 1);
+ sample_store_declare_setup(pptr, pbit, pbbyte,
+ penum->pixel_data, 0, bpc);
+ int x;
+
+ mask_plane.data = mptr;
+ mask_plane.data_x = 0;
+ mask_plane.raster = 0; /* raster doesn't matter, pacify Valgrind */
+ pixel_plane.data = pptr;
+ pixel_plane.data_x = 0;
+ /* raster doesn't matter */
+ pixel_planes = &pixel_plane;
+ for (x = 0; x < width; ++x) {
+ uint value;
+ int i;
+
+ sample_load_next12(value, sptr, sbit, bpc);
+ sample_store_next12(value != 0, mptr, mbit, 1, mbbyte);
+ for (i = 0; i < num_components; ++i) {
+ sample_load_next12(value, sptr, sbit, bpc);
+ sample_store_next12(value, pptr, pbit, bpc, pbbyte);
+ }
+ }
+ sample_store_flush(mptr, mbit, 1, mbbyte);
+ sample_store_flush(pptr, pbit, bpc, pbbyte);
+ }
+ break;
+ case interleave_scan_lines:
+ if (planes_next(penum) >= 0) {
+ /* This is mask data. */
+ mask_plane = planes[0];
+ pixel_planes = &pixel_plane;
+ pixel_plane.data = 0;
+ } else {
+ /* This is pixel data. */
+ mask_plane.data = 0;
+ pixel_planes = planes;
+ }
+ break;
+ case interleave_separate_source:
+ /*
+ * In order to be able to recover from interruptions, we must
+ * limit separate-source processing to 1 scan line at a time.
+ */
+ if (h > 1)
+ h = 1;
+ mask_plane = planes[0];
+ pixel_planes = planes + 1;
+ break;
+ default: /* not possible */
+ return_error(gs_error_rangecheck);
}
/*
* Process the mask data first, so it will set up the mask
* device for clipping the pixel data.
*/
if (mask_plane.data) {
- /*
- * If, on the last call, we processed some mask rows successfully
- * but processing the pixel rows was interrupted, we set rows_used
- * to indicate the number of pixel rows processed (since there is
- * no way to return two rows_used values). If this happened, some
- * mask rows may get presented again. We must skip over them
- * rather than processing them again.
- */
- int skip = penum->mask_skip;
-
- if (skip >= h) {
- penum->mask_skip = skip - (mask_used = h);
- } else {
- int mask_h = h - skip;
-
- mask_plane.data += skip * mask_plane.raster;
- penum->mask_skip = 0;
- code = gx_image_plane_data_rows(penum->mask_info, &mask_plane,
- mask_h, &mask_used);
- mask_used += skip;
- }
- *rows_used = mask_used;
- penum->mask_y += mask_used;
- if (code < 0)
- return code;
+ /*
+ * If, on the last call, we processed some mask rows successfully
+ * but processing the pixel rows was interrupted, we set rows_used
+ * to indicate the number of pixel rows processed (since there is
+ * no way to return two rows_used values). If this happened, some
+ * mask rows may get presented again. We must skip over them
+ * rather than processing them again.
+ */
+ int skip = penum->mask_skip;
+
+ if (skip >= h) {
+ penum->mask_skip = skip - (mask_used = h);
+ } else {
+ int mask_h = h - skip;
+
+ mask_plane.data += skip * mask_plane.raster;
+ penum->mask_skip = 0;
+ code = gx_image_plane_data_rows(penum->mask_info, &mask_plane,
+ mask_h, &mask_used);
+ mask_used += skip;
+ }
+ *rows_used = mask_used;
+ penum->mask_y += mask_used;
+ if (code < 0)
+ return code;
}
if (pixel_planes[0].data) {
- /*
- * If necessary, flush any buffered mask data to the mask clipping
- * device.
- */
- gx_image_flush(penum->mask_info);
- code = gx_image_plane_data_rows(penum->pixel_info, pixel_planes, h,
- &pixel_used);
- /*
- * There isn't any way to set rows_used if different amounts of
- * the mask and pixel data were used. Fake it.
- */
- *rows_used = pixel_used;
- /*
- * Don't return code yet: we must account for the fact that
- * some mask data may have been processed.
- */
- penum->pixel_y += pixel_used;
- if (code < 0) {
- /*
- * We must prevent the mask data from being processed again.
- * We rely on the fact that h > 1 is only possible if the
- * mask and pixel data have the same Y scaling.
- */
- if (mask_used > pixel_used) {
- int skip = mask_used - pixel_used;
-
- penum->mask_skip = skip;
- penum->mask_y -= skip;
- mask_used = pixel_used;
- }
- }
+ /*
+ * If necessary, flush any buffered mask data to the mask clipping
+ * device.
+ */
+ gx_image_flush(penum->mask_info);
+ code = gx_image_plane_data_rows(penum->pixel_info, pixel_planes, h,
+ &pixel_used);
+ /*
+ * There isn't any way to set rows_used if different amounts of
+ * the mask and pixel data were used. Fake it.
+ */
+ *rows_used = pixel_used;
+ /*
+ * Don't return code yet: we must account for the fact that
+ * some mask data may have been processed.
+ */
+ penum->pixel_y += pixel_used;
+ if (code < 0) {
+ /*
+ * We must prevent the mask data from being processed again.
+ * We rely on the fact that h > 1 is only possible if the
+ * mask and pixel data have the same Y scaling.
+ */
+ if (mask_used > pixel_used) {
+ int skip = mask_used - pixel_used;
+
+ penum->mask_skip = skip;
+ penum->mask_y -= skip;
+ mask_used = pixel_used;
+ }
+ }
}
if_debug5('b', "[b]image3 h=%d %smask_y=%d %spixel_y=%d\n",
- h, (mask_plane.data ? "+" : ""), penum->mask_y,
- (pixel_planes[0].data ? "+" : ""), penum->pixel_y);
+ h, (mask_plane.data ? "+" : ""), penum->mask_y,
+ (pixel_planes[0].data ? "+" : ""), penum->pixel_y);
if (penum->mask_y >= penum->mask_height &&
- penum->pixel_y >= penum->pixel_height)
- return 1;
+ penum->pixel_y >= penum->pixel_height)
+ return 1;
if (penum->InterleaveType == interleave_scan_lines) {
- /* Update the width and depth in the enumerator. */
- if (planes_next(penum) >= 0) { /* want mask data next */
- penum->plane_widths[0] = penum->mask_width;
- penum->plane_depths[0] = 1;
- } else { /* want pixel data next */
- penum->plane_widths[0] = penum->pixel_width;
- penum->plane_depths[0] = penum->pixel_info->plane_depths[0];
- }
+ /* Update the width and depth in the enumerator. */
+ if (planes_next(penum) >= 0) { /* want mask data next */
+ penum->plane_widths[0] = penum->mask_width;
+ penum->plane_depths[0] = 1;
+ } else { /* want pixel data next */
+ penum->plane_widths[0] = penum->pixel_width;
+ penum->plane_depths[0] = penum->pixel_info->plane_depths[0];
+ }
}
/*
* The mask may be complete (gx_image_plane_data_rows returned 1),
@@ -675,7 +675,7 @@ gx_image3_flush(gx_image_enum_common_t * info)
int code = gx_image_flush(penum->mask_info);
if (code >= 0)
- code = gx_image_flush(penum->pixel_info);
+ code = gx_image_flush(penum->pixel_info);
return code;
}
@@ -687,37 +687,37 @@ gx_image3_planes_wanted(const gx_image_enum_common_t * info, byte *wanted)
switch (penum->InterleaveType) {
case interleave_chunky: /* only 1 plane */
- wanted[0] = 0xff;
- return true;
+ wanted[0] = 0xff;
+ return true;
case interleave_scan_lines: /* only 1 plane, but varying width/depth */
- wanted[0] = 0xff;
- return false;
+ wanted[0] = 0xff;
+ return false;
case interleave_separate_source: {
- /*
- * We always want at least as much of the mask to be filled as the
- * pixel data. next > 0 iff we've processed more data than mask.
- * Plane 0 is the mask, planes [1 .. num_planes - 1] are pixel data.
- */
- int next = planes_next(penum);
-
- wanted[0] = (next >= 0 ? 0xff : 0);
- memset(wanted + 1, (next <= 0 ? 0xff : 0), info->num_planes - 1);
- /*
- * In principle, wanted will always be true for both mask and pixel
- * data if the full_heights are equal. Unfortunately, even in this
- * case, processing may be interrupted after a mask row has been
- * passed to the underlying image processor but before the data row
- * has been passed, in which case pixel data will be 'wanted', but
- * not mask data, for the next call. Therefore, we must return
- * false.
- */
- return false
- /*(next == 0 &&
- penum->mask_full_height == penum->pixel_full_height)*/;
+ /*
+ * We always want at least as much of the mask to be filled as the
+ * pixel data. next > 0 iff we've processed more data than mask.
+ * Plane 0 is the mask, planes [1 .. num_planes - 1] are pixel data.
+ */
+ int next = planes_next(penum);
+
+ wanted[0] = (next >= 0 ? 0xff : 0);
+ memset(wanted + 1, (next <= 0 ? 0xff : 0), info->num_planes - 1);
+ /*
+ * In principle, wanted will always be true for both mask and pixel
+ * data if the full_heights are equal. Unfortunately, even in this
+ * case, processing may be interrupted after a mask row has been
+ * passed to the underlying image processor but before the data row
+ * has been passed, in which case pixel data will be 'wanted', but
+ * not mask data, for the next call. Therefore, we must return
+ * false.
+ */
+ return false
+ /*(next == 0 &&
+ penum->mask_full_height == penum->pixel_full_height)*/;
}
default: /* can't happen */
- memset(wanted, 0, info->num_planes);
- return false;
+ memset(wanted, 0, info->num_planes);
+ return false;
}
}
@@ -735,9 +735,9 @@ gx_image3_end_image(gx_image_enum_common_t * info, bool draw_last)
int code2 = gs_closedevice(mdev);
gs_free_object(mem, penum->mask_data,
- "gx_image3_end_image(mask_data)");
+ "gx_image3_end_image(mask_data)");
gs_free_object(mem, penum->pixel_data,
- "gx_image3_end_image(pixel_data)");
+ "gx_image3_end_image(pixel_data)");
gs_free_object(mem, pcdev, "gx_image3_end_image(pcdev)");
gs_free_object(mem, mdev, "gx_image3_end_image(mdev)");
gx_image_free_enum(&info);
diff --git a/gs/base/gximage3.h b/gs/base/gximage3.h
index 334bdf572..e59596a16 100644
--- a/gs/base/gximage3.h
+++ b/gs/base/gximage3.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@
*/
#define IMAGE3_MAKE_MID_PROC(proc)\
int proc(gx_device **pmidev, gx_device *dev, int width, int height,\
- gs_memory_t *mem)
+ gs_memory_t *mem)
typedef IMAGE3_MAKE_MID_PROC((*image3_make_mid_proc_t));
/*
@@ -43,18 +43,18 @@ typedef IMAGE3_MAKE_MID_PROC((*image3_make_mid_proc_t));
*/
#define IMAGE3_MAKE_MCDE_PROC(proc)\
int proc(/* The initial arguments are those of begin_typed_image. */\
- gx_device *dev,\
- const gs_imager_state *pis,\
- const gs_matrix *pmat,\
- const gs_image_common_t *pic,\
- const gs_int_rect *prect,\
- const gx_drawing_color *pdcolor,\
- const gx_clip_path *pcpath, gs_memory_t *mem,\
- gx_image_enum_common_t **pinfo,\
- /* The following arguments are added. */\
- gx_device **pmcdev, gx_device *midev,\
- gx_image_enum_common_t *pminfo,\
- const gs_int_point *origin)
+ gx_device *dev,\
+ const gs_imager_state *pis,\
+ const gs_matrix *pmat,\
+ const gs_image_common_t *pic,\
+ const gs_int_rect *prect,\
+ const gx_drawing_color *pdcolor,\
+ const gx_clip_path *pcpath, gs_memory_t *mem,\
+ gx_image_enum_common_t **pinfo,\
+ /* The following arguments are added. */\
+ gx_device **pmcdev, gx_device *midev,\
+ gx_image_enum_common_t *pminfo,\
+ const gs_int_point *origin)
typedef IMAGE3_MAKE_MCDE_PROC((*image3_make_mcde_proc_t));
/*
@@ -62,14 +62,14 @@ typedef IMAGE3_MAKE_MCDE_PROC((*image3_make_mcde_proc_t));
* procedures as additional parameters.
*/
int gx_begin_image3_generic(gx_device * dev,
- const gs_imager_state *pis,
- const gs_matrix *pmat,
- const gs_image_common_t *pic,
- const gs_int_rect *prect,
- const gx_drawing_color *pdcolor,
- const gx_clip_path *pcpath, gs_memory_t *mem,
- IMAGE3_MAKE_MID_PROC((*make_mid)),
- IMAGE3_MAKE_MCDE_PROC((*make_mcde)),
- gx_image_enum_common_t **pinfo);
+ const gs_imager_state *pis,
+ const gs_matrix *pmat,
+ const gs_image_common_t *pic,
+ const gs_int_rect *prect,
+ const gx_drawing_color *pdcolor,
+ const gx_clip_path *pcpath, gs_memory_t *mem,
+ IMAGE3_MAKE_MID_PROC((*make_mid)),
+ IMAGE3_MAKE_MCDE_PROC((*make_mcde)),
+ gx_image_enum_common_t **pinfo);
#endif /* gximage3_INCLUDED */
diff --git a/gs/base/gximage4.c b/gs/base/gximage4.c
index f65d7017f..b75119c07 100644
--- a/gs/base/gximage4.c
+++ b/gs/base/gximage4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,53 +59,53 @@ gs_image4_t_init(gs_image4_t * pim, gs_color_space * color_space)
/* Start processing an ImageType 4 image. */
static int
gx_begin_image4(gx_device * dev,
- const gs_imager_state * pis, const gs_matrix * pmat,
- const gs_image_common_t * pic, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t ** pinfo)
{
gx_image_enum *penum;
const gs_image4_t *pim = (const gs_image4_t *)pic;
int code = gx_image_enum_alloc(pic, prect, mem, &penum);
if (code < 0)
- return code;
+ return code;
penum->alpha = gs_image_alpha_none;
penum->masked = false;
penum->adjust = fixed_0;
penum->image_parent_type = gs_image_type4;
/* Check that MaskColor values are within the valid range. */
{
- bool opaque = false;
- uint max_value = (1 << pim->BitsPerComponent) - 1;
- int spp = cs_num_components(pim->ColorSpace);
- int i;
-
- for (i = 0; i < spp * 2; i += 2) {
- uint c0, c1;
-
- if (pim->MaskColor_is_range)
- c0 = pim->MaskColor[i], c1 = pim->MaskColor[i + 1];
- else
- c0 = c1 = pim->MaskColor[i >> 1];
-
- if ((c0 | c1) > max_value) {
- gs_free_object(mem, penum, "gx_begin_image4");
- return_error(gs_error_rangecheck);
- }
- if (c0 > c1) {
- opaque = true; /* pixel can never match mask color */
- break;
- }
- penum->mask_color.values[i] = c0;
- penum->mask_color.values[i + 1] = c1;
- }
- penum->use_mask_color = !opaque;
+ bool opaque = false;
+ uint max_value = (1 << pim->BitsPerComponent) - 1;
+ int spp = cs_num_components(pim->ColorSpace);
+ int i;
+
+ for (i = 0; i < spp * 2; i += 2) {
+ uint c0, c1;
+
+ if (pim->MaskColor_is_range)
+ c0 = pim->MaskColor[i], c1 = pim->MaskColor[i + 1];
+ else
+ c0 = c1 = pim->MaskColor[i >> 1];
+
+ if ((c0 | c1) > max_value) {
+ gs_free_object(mem, penum, "gx_begin_image4");
+ return_error(gs_error_rangecheck);
+ }
+ if (c0 > c1) {
+ opaque = true; /* pixel can never match mask color */
+ break;
+ }
+ penum->mask_color.values[i] = c0;
+ penum->mask_color.values[i + 1] = c1;
+ }
+ penum->use_mask_color = !opaque;
}
code = gx_image_enum_begin(dev, pis, pmat, pic, pdcolor, pcpath, mem,
- penum);
+ penum);
if (code >= 0)
- *pinfo = (gx_image_enum_common_t *)penum;
+ *pinfo = (gx_image_enum_common_t *)penum;
return code;
}
@@ -113,27 +113,27 @@ gx_begin_image4(gx_device * dev,
static int
gx_image4_sput(const gs_image_common_t *pic, stream *s,
- const gs_color_space **ppcs)
+ const gs_color_space **ppcs)
{
const gs_image4_t *pim = (const gs_image4_t *)pic;
bool is_range = pim->MaskColor_is_range;
int code = gx_pixel_image_sput((const gs_pixel_image_t *)pim, s, ppcs,
- is_range);
+ is_range);
int num_values =
- gs_color_space_num_components(pim->ColorSpace) * (is_range ? 2 : 1);
+ gs_color_space_num_components(pim->ColorSpace) * (is_range ? 2 : 1);
int i;
if (code < 0)
- return code;
+ return code;
for (i = 0; i < num_values; ++i)
- sput_variable_uint(s, pim->MaskColor[i]);
+ sput_variable_uint(s, pim->MaskColor[i]);
*ppcs = pim->ColorSpace;
return 0;
}
static int
gx_image4_sget(gs_image_common_t *pic, stream *s,
- gs_color_space *pcs)
+ gs_color_space *pcs)
{
gs_image4_t *const pim = (gs_image4_t *)pic;
int num_values;
@@ -141,16 +141,16 @@ gx_image4_sget(gs_image_common_t *pic, stream *s,
int code = gx_pixel_image_sget((gs_pixel_image_t *)pim, s, pcs);
if (code < 0)
- return code;
+ return code;
pim->type = &gs_image_type_4;
pim->MaskColor_is_range = code;
num_values =
- gs_color_space_num_components(pcs) *
- (pim->MaskColor_is_range ? 2 : 1);
+ gs_color_space_num_components(pcs) *
+ (pim->MaskColor_is_range ? 2 : 1);
for (i = 0; i < num_values; ++i) {
- code = sget_variable_uint(s, &pim->MaskColor[i]);
+ code = sget_variable_uint(s, &pim->MaskColor[i]);
if (code < 0)
- return code;
+ return code;
}
pim->image_parent_type = gs_image_type4;
return 0;
diff --git a/gs/base/gximask.c b/gs/base/gximask.c
index 36a55c5ab..1333d9830 100644
--- a/gs/base/gximask.c
+++ b/gs/base/gximask.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,6 @@
#include "gzcpath.h"
#include "gxdevsop.h"
-
/* Functions for masked fill optimization. */
/* Imagemask with a shading color would paint entire shading for each rectangle of the mask.
These functions convert the mask into a clipping path and then render entire shading
@@ -34,33 +33,33 @@
*/
int
-gx_image_fill_masked_start(gx_device *dev, const gx_device_color *pdevc, const gx_clip_path *pcpath,
- gs_memory_t *mem, gx_device **cdev)
+gx_image_fill_masked_start(gx_device *dev, const gx_device_color *pdevc, const gx_clip_path *pcpath,
+ gs_memory_t *mem, gx_device **cdev)
{
if (gx_dc_is_pattern2_color(pdevc) || gx_dc_is_pattern1_color_clist_based(pdevc)) {
- if (!dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_can_accum, NULL, gs_no_id)) {
- extern_st(st_device_cpath_accum);
- gx_device_cpath_accum *pcdev = gs_alloc_struct(mem,
- gx_device_cpath_accum, &st_device_cpath_accum, "gx_image_fill_masked_start");
- gs_fixed_rect cbox;
+ if (!dev_proc(dev, dev_spec_op)(dev, gxdso_pattern_can_accum, NULL, gs_no_id)) {
+ extern_st(st_device_cpath_accum);
+ gx_device_cpath_accum *pcdev = gs_alloc_struct(mem,
+ gx_device_cpath_accum, &st_device_cpath_accum, "gx_image_fill_masked_start");
+ gs_fixed_rect cbox;
- if (pcdev == NULL)
- return_error(gs_error_VMerror);
- gx_cpath_accum_begin(pcdev, mem);
- gx_cpath_outer_box(pcpath, &cbox);
- gx_cpath_accum_set_cbox(pcdev, &cbox);
- pcdev->rc.memory = mem;
- pcdev->width = dev->width; /* For gx_default_copy_mono. */
- pcdev->height = dev->height; /* For gx_default_copy_mono. */
- gx_device_retain((gx_device *)pcdev, true);
- *cdev = (gx_device *)pcdev;
- }
+ if (pcdev == NULL)
+ return_error(gs_error_VMerror);
+ gx_cpath_accum_begin(pcdev, mem);
+ gx_cpath_outer_box(pcpath, &cbox);
+ gx_cpath_accum_set_cbox(pcdev, &cbox);
+ pcdev->rc.memory = mem;
+ pcdev->width = dev->width; /* For gx_default_copy_mono. */
+ pcdev->height = dev->height; /* For gx_default_copy_mono. */
+ gx_device_retain((gx_device *)pcdev, true);
+ *cdev = (gx_device *)pcdev;
+ }
} else
- *cdev = dev;
+ *cdev = dev;
return 0;
}
-int
+int
gx_image_fill_masked_end(gx_device *dev, gx_device *tdev, const gx_device_color *pdevc)
{
gx_device_cpath_accum *pcdev = (gx_device_cpath_accum *)dev;
@@ -73,25 +72,25 @@ gx_image_fill_masked_end(gx_device *dev, gx_device *tdev, const gx_device_color
gx_cpath_init_local(&cpath, pcdev->memory);
code = gx_cpath_accum_end(pcdev, &cpath);
if (code >= 0)
- code = gx_dc_pattern2_clip_with_bbox(pdevc, tdev, &cpath_with_shading_bbox, &pcpath1);
+ code = gx_dc_pattern2_clip_with_bbox(pdevc, tdev, &cpath_with_shading_bbox, &pcpath1);
gx_make_clip_device_on_stack(&cdev, pcpath1, tdev);
if (code >= 0 && pcdev->bbox.p.x < pcdev->bbox.q.x) {
- code1 = gx_device_color_fill_rectangle(pdevc,
- pcdev->bbox.p.x, pcdev->bbox.p.y,
- pcdev->bbox.q.x - pcdev->bbox.p.x,
- pcdev->bbox.q.y - pcdev->bbox.p.y,
- (gx_device *)&cdev, lop_default, 0);
- if (code == 0)
- code = code1;
+ code1 = gx_device_color_fill_rectangle(pdevc,
+ pcdev->bbox.p.x, pcdev->bbox.p.y,
+ pcdev->bbox.q.x - pcdev->bbox.p.x,
+ pcdev->bbox.q.y - pcdev->bbox.p.y,
+ (gx_device *)&cdev, lop_default, 0);
+ if (code == 0)
+ code = code1;
}
if (pcpath1 == &cpath_with_shading_bbox)
- gx_cpath_free(&cpath_with_shading_bbox, "s_image_cleanup");
+ gx_cpath_free(&cpath_with_shading_bbox, "s_image_cleanup");
gx_device_retain((gx_device *)pcdev, false);
gx_cpath_free(&cpath, "s_image_cleanup");
return code;
}
-int
+int
gx_image_fill_masked(gx_device *dev,
const byte *data, int data_x, int raster, gx_bitmap_id id,
int x, int y, int width, int height,
@@ -103,9 +102,9 @@ gx_image_fill_masked(gx_device *dev,
code = gx_image_fill_masked_start(dev, pdc, pcpath, dev->memory, &cdev);
if (code >= 0)
- code = (*dev_proc(cdev, fill_mask))(cdev, data, data_x, raster, id,
- x, y, width, height, pdc, depth, lop, pcpath);
+ code = (*dev_proc(cdev, fill_mask))(cdev, data, data_x, raster, id,
+ x, y, width, height, pdc, depth, lop, pcpath);
if (code >= 0 && cdev != dev)
- code = gx_image_fill_masked_end(cdev, dev, pdc);
+ code = gx_image_fill_masked_end(cdev, dev, pdc);
return code;
}
diff --git a/gs/base/gximask.h b/gs/base/gximask.h
index d1bd10285..f1d6e08f1 100644
--- a/gs/base/gximask.h
+++ b/gs/base/gximask.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,8 +33,8 @@ typedef struct gx_device_color_s gx_device_color;
typedef struct gx_clip_path_s gx_clip_path;
#endif
-int gx_image_fill_masked_start(gx_device *dev, const gx_device_color *pdevc, const gx_clip_path *pcpath,
- gs_memory_t *mem, gx_device **cdev);
+int gx_image_fill_masked_start(gx_device *dev, const gx_device_color *pdevc, const gx_clip_path *pcpath,
+ gs_memory_t *mem, gx_device **cdev);
int gx_image_fill_masked_end(gx_device *dev, gx_device *tdev, const gx_device_color *pdevc);
@@ -44,5 +44,4 @@ int gx_image_fill_masked(gx_device *dev,
const gx_device_color *pdcolor, int depth,
gs_logical_operation_t lop, const gx_clip_path *pcpath);
-
#endif /* gximask_INCLUDED */
diff --git a/gs/base/gximono.c b/gs/base/gximono.c
index 3f006b664..c9ba9c457 100644
--- a/gs/base/gximono.c
+++ b/gs/base/gximono.c
@@ -229,7 +229,6 @@ image_set_gray(byte sample_value, const bool masked, uint mask_base,
return(0);
}
-
/*
* Rendering procedure for general mono-component images, dealing with
* multiple bit-per-sample images, general transformations, arbitrary
@@ -998,6 +997,6 @@ image_render_mono_ht(gx_image_enum * penum_orig, const byte * buffer, int data_x
/* Apply threshold array to image data */
flush:
code = gxht_thresh_plane(penum, d_order, xrun, dest_width, dest_height,
- thresh_align, contone_align, contone_stride, dev);
+ thresh_align, contone_align, contone_stride, dev);
return code;
}
diff --git a/gs/base/gxino12b.c b/gs/base/gxino12b.c
index 8719c081f..64e61200b 100644
--- a/gs/base/gxino12b.c
+++ b/gs/base/gxino12b.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxino16b.c b/gs/base/gxino16b.c
index d7c15e783..e3622dd55 100644
--- a/gs/base/gxino16b.c
+++ b/gs/base/gxino16b.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxiodev.h b/gs/base/gxiodev.h
index 36024b6f5..755ca9b4d 100644
--- a/gs/base/gxiodev.h
+++ b/gs/base/gxiodev.h
@@ -81,12 +81,12 @@ struct gx_io_device_procs_s {
#define iodev_proc_open_device(proc)\
int proc(gx_io_device *iodev, const char *access, stream **ps,\
- gs_memory_t *mem)
+ gs_memory_t *mem)
iodev_proc_open_device((*open_device));
#define iodev_proc_open_file(proc)\
int proc(gx_io_device *iodev, const char *fname, uint namelen,\
- const char *access, stream **ps, gs_memory_t *mem)
+ const char *access, stream **ps, gs_memory_t *mem)
iodev_proc_open_file((*open_file));
/* fopen was changed in release 2.9.6, */
@@ -94,7 +94,7 @@ struct gx_io_device_procs_s {
#define iodev_proc_fopen(proc)\
int proc(gx_io_device *iodev, const char *fname, const char *access,\
- FILE **pfile, char *rfname, uint rnamelen)
+ FILE **pfile, char *rfname, uint rnamelen)
iodev_proc_fopen((*fopen));
#define iodev_proc_fclose(proc)\
@@ -115,7 +115,7 @@ struct gx_io_device_procs_s {
#define iodev_proc_enumerate_files(proc)\
file_enum *proc(gx_io_device *iodev, const char *pat, uint patlen,\
- gs_memory_t *mem)
+ gs_memory_t *mem)
iodev_proc_enumerate_files((*enumerate_files));
#define iodev_proc_enumerate_next(proc)\
diff --git a/gs/base/gxiparam.h b/gs/base/gxiparam.h
index 39729976b..24f633c9d 100644
--- a/gs/base/gxiparam.h
+++ b/gs/base/gxiparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -112,9 +112,9 @@ image_proc_release(gx_image_default_release); /* just free the params */
* Note that these procedures take different parameters.
*/
int gx_pixel_image_sput(const gs_pixel_image_t *pic, stream *s,
- const gs_color_space **ppcs, int extra);
+ const gs_color_space **ppcs, int extra);
int gx_pixel_image_sget(gs_pixel_image_t *pic, stream *s,
- gs_color_space *pcs);
+ gs_color_space *pcs);
void gx_pixel_image_release(gs_pixel_image_t *pic, gs_memory_t *mem);
/* Internal procedures for use in sput/sget implementations. */
@@ -144,7 +144,7 @@ typedef struct gx_image_enum_procs_s {
#define image_enum_proc_plane_data(proc)\
int proc(gx_image_enum_common_t *info, const gx_image_plane_t *planes,\
- int height, int *rows_used)
+ int height, int *rows_used)
image_enum_proc_plane_data((*plane_data));
@@ -188,7 +188,7 @@ typedef struct gx_image_enum_procs_s {
* By default, all data planes are always wanted; however, ImageType 3
* images with separate mask and image data sources may want mask data
* before image data or vice versa.
- *
+ *
* This procedure is optional (may be 0).
*/
@@ -210,15 +210,15 @@ typedef struct gx_image_enum_procs_s {
* be in progress simultaneously.
*/
#define gx_image_enum_common\
- const gx_image_type_t *image_type;\
- const gx_image_enum_procs_t *procs;\
- gx_device *dev;\
- gs_memory_t *memory; /* from begin_image */\
- gs_id id;\
- bool skipping; /* don't render, just consume image streams. */\
- int num_planes;\
- int plane_depths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\
- int plane_widths[GS_IMAGE_MAX_COMPONENTS] /* [num_planes] */
+ const gx_image_type_t *image_type;\
+ const gx_image_enum_procs_t *procs;\
+ gx_device *dev;\
+ gs_memory_t *memory; /* from begin_image */\
+ gs_id id;\
+ bool skipping; /* don't render, just consume image streams. */\
+ int num_planes;\
+ int plane_depths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\
+ int plane_widths[GS_IMAGE_MAX_COMPONENTS] /* [num_planes] */
struct gx_image_enum_common_s {
gx_image_enum_common;
};
@@ -233,10 +233,10 @@ extern_st(st_gx_image_enum_common);
* Initialize the common part of an image enumerator.
*/
int gx_image_enum_common_init(gx_image_enum_common_t * piec,
- const gs_data_image_t * pic,
- const gx_image_enum_procs_t * piep,
- gx_device * dev, int num_components,
- gs_image_format_t format);
+ const gs_data_image_t * pic,
+ const gx_image_enum_procs_t * piep,
+ gx_device * dev, int num_components,
+ gs_image_format_t format);
/*
* Define image_plane_data and end_image procedures for image types that
diff --git a/gs/base/gxipixel.c b/gs/base/gxipixel.c
index f8c6eedff..c564b46b4 100644
--- a/gs/base/gxipixel.c
+++ b/gs/base/gxipixel.c
@@ -123,7 +123,6 @@ static RELOC_PTRS_WITH(image_enum_reloc_ptrs, gx_image_enum *eptr)
}
RELOC_PTRS_END
-
/* Forward declarations */
static int color_draws_b_w(gx_device * dev,
const gx_drawing_color * pdcolor);
diff --git a/gs/base/gxiscale.c b/gs/base/gxiscale.c
index 454c1fc9c..5444397d2 100644
--- a/gs/base/gxiscale.c
+++ b/gs/base/gxiscale.c
@@ -102,7 +102,7 @@ gs_image_class_0_interpolate(gx_image_enum * penum)
}
/* If the device has some unique color mapping procs due to its color space,
then we will need to use those and go through pixel by pixel instead
- of blasting through buffers. This is true for example with many of
+ of blasting through buffers. This is true for example with many of
the color spaces for CUPs */
if(!gx_device_uses_std_cmap_procs(penum->dev)) {
use_icc = false;
diff --git a/gs/base/gxistate.h b/gs/base/gxistate.h
index b6c152da1..3a42b433d 100644
--- a/gs/base/gxistate.h
+++ b/gs/base/gxistate.h
@@ -42,35 +42,35 @@
structure when it is being used for other imaging, specifically for
imaging a command list). While this criterion is somewhat fuzzy, it leads
us to INCLUDE the following state elements:
- line parameters: cap, join, miter limit, dash pattern
- transformation matrix (CTM)
- logical operation: RasterOp, transparency
- color modification: alpha, rendering algorithm
- transparency information:
- blend mode
- (opacity + shape) (alpha + cached mask)
- text knockout flag
- rendering stack
- overprint control: overprint flag, mode, and effective mode
- rendering tweaks: flatness, fill adjustment, stroke adjust flag,
- accurate curves flag, shading smoothness
- color rendering information:
- halftone, halftone phases
- transfer functions
- black generation, undercolor removal
- CIE rendering tables
- halftone and pattern caches
- shared (constant) device color spaces
+ line parameters: cap, join, miter limit, dash pattern
+ transformation matrix (CTM)
+ logical operation: RasterOp, transparency
+ color modification: alpha, rendering algorithm
+ transparency information:
+ blend mode
+ (opacity + shape) (alpha + cached mask)
+ text knockout flag
+ rendering stack
+ overprint control: overprint flag, mode, and effective mode
+ rendering tweaks: flatness, fill adjustment, stroke adjust flag,
+ accurate curves flag, shading smoothness
+ color rendering information:
+ halftone, halftone phases
+ transfer functions
+ black generation, undercolor removal
+ CIE rendering tables
+ halftone and pattern caches
+ shared (constant) device color spaces
We EXCLUDE the following for reason #1 (drawing command parameters):
- path
- clipping path and stack
- color specification: color, color space, substitute color spaces
- font
- device
+ path
+ clipping path and stack
+ color specification: color, color space, substitute color spaces
+ font
+ device
We EXCLUDE the following for reason #2 (specific to PostScript):
- graphics state stack
- default CTM
- clipping path stack
+ graphics state stack
+ default CTM
+ clipping path stack
In retrospect, perhaps the device should have been included in the
imager state, but we don't think this change is worth the trouble now.
*/
@@ -124,51 +124,51 @@ typedef struct gx_transfer_s {
#define gs_color_rendering_state_common\
\
- /* Halftone screen: */\
+ /* Halftone screen: */\
\
- gs_halftone *halftone; /* (RC) */\
- gs_int_point screen_phase[gs_color_select_count];\
- /* dev_ht depends on halftone and device resolution. */\
- gx_device_halftone *dev_ht; /* (RC) */\
+ gs_halftone *halftone; /* (RC) */\
+ gs_int_point screen_phase[gs_color_select_count];\
+ /* dev_ht depends on halftone and device resolution. */\
+ gx_device_halftone *dev_ht; /* (RC) */\
\
- /* Color (device-dependent): */\
+ /* Color (device-dependent): */\
\
- struct gs_cie_render_s *cie_render; /* (RC) may be 0 */\
- bool cie_to_xyz; /* flag for conversion to XYZ, no CRD req'd */\
- gx_transfer_map *black_generation; /* (RC) may be 0 */\
- gx_transfer_map *undercolor_removal; /* (RC) may be 0 */\
- /* set_transfer holds the transfer functions specified by */\
- /* set[color]transfer; effective_transfer includes the */\
- /* effects of overrides by TransferFunctions in halftone */\
- /* dictionaries. (In Level 1 systems, set_transfer and */\
- /* effective_transfer are always the same.) */\
- gx_transfer set_transfer; /* members are (RC) */\
- gx_transfer_map *effective_transfer[GX_DEVICE_COLOR_MAX_COMPONENTS]; /* see below */\
- int object_tag; /* */\
+ struct gs_cie_render_s *cie_render; /* (RC) may be 0 */\
+ bool cie_to_xyz; /* flag for conversion to XYZ, no CRD req'd */\
+ gx_transfer_map *black_generation; /* (RC) may be 0 */\
+ gx_transfer_map *undercolor_removal; /* (RC) may be 0 */\
+ /* set_transfer holds the transfer functions specified by */\
+ /* set[color]transfer; effective_transfer includes the */\
+ /* effects of overrides by TransferFunctions in halftone */\
+ /* dictionaries. (In Level 1 systems, set_transfer and */\
+ /* effective_transfer are always the same.) */\
+ gx_transfer set_transfer; /* members are (RC) */\
+ gx_transfer_map *effective_transfer[GX_DEVICE_COLOR_MAX_COMPONENTS]; /* see below */\
+ int object_tag; /* */\
\
- /* Color caches: */\
+ /* Color caches: */\
\
- /* cie_joint_caches depend on cie_render and */\
- /* the color space. */\
- struct gx_cie_joint_caches_s *cie_joint_caches; /* (RC) */\
- /* cmap_procs depend on the device's color_info. */\
- const struct gx_color_map_procs_s *cmap_procs; /* static */\
- /* DeviceN component map for current color space */\
- gs_devicen_color_map color_component_map;\
- /* The contents of pattern_cache depend on the */\
- /* the color space and the device's color_info and */\
- /* resolution. */\
- struct gx_pattern_cache_s *pattern_cache; /* (Shared) by all gstates */\
+ /* cie_joint_caches depend on cie_render and */\
+ /* the color space. */\
+ struct gx_cie_joint_caches_s *cie_joint_caches; /* (RC) */\
+ /* cmap_procs depend on the device's color_info. */\
+ const struct gx_color_map_procs_s *cmap_procs; /* static */\
+ /* DeviceN component map for current color space */\
+ gs_devicen_color_map color_component_map;\
+ /* The contents of pattern_cache depend on the */\
+ /* the color space and the device's color_info and */\
+ /* resolution. */\
+ struct gx_pattern_cache_s *pattern_cache; /* (Shared) by all gstates */\
\
- /* Simple color spaces, stored here for easy access from */ \
- /* gx_concrete_space_CIE */ \
- gs_color_space *devicergb_cs;\
- gs_color_space *devicecmyk_cs;\
+ /* Simple color spaces, stored here for easy access from */ \
+ /* gx_concrete_space_CIE */ \
+ gs_color_space *devicergb_cs;\
+ gs_color_space *devicecmyk_cs;\
\
- /* Stores for cached values which correspond to whichever */\
- /* color isn't in force at the moment */\
- struct gx_cie_joint_caches_s *cie_joint_caches_alt;\
- gs_devicen_color_map color_component_map_alt
+ /* Stores for cached values which correspond to whichever */\
+ /* color isn't in force at the moment */\
+ struct gx_cie_joint_caches_s *cie_joint_caches_alt;\
+ gs_devicen_color_map color_component_map_alt
/*
* Enumerate the reference-counted pointers in a c.r. state. Note that
@@ -204,7 +204,6 @@ typedef struct gx_transfer_s {
*/
#define st_cr_state_num_ptrs 14
-
typedef struct gs_devicen_color_map_s {
bool use_alt_cspace;
separation_type sep_type;
@@ -214,7 +213,6 @@ typedef struct gs_devicen_color_map_s {
int color_map[GS_CLIENT_COLOR_MAX_COMPONENTS];
} gs_devicen_color_map;
-
/* These flags are used to keep track of qQ
combinations surrounding a graphic state
change that includes a softmask setting.
@@ -226,7 +224,6 @@ typedef struct gs_xstate_trans_flags {
bool xstate_change;
} gs_xstate_trans_flags_t;
-
/* Define the imager state structure itself. */
/*
* Note that the ctm member is a gs_matrix_fixed. As such, it cannot be
@@ -235,46 +232,46 @@ typedef struct gs_xstate_trans_flags {
* than &pis->ctm.
*/
#define gs_imager_state_common\
- bool is_gstate; /* is this imager state part of gstate ? */\
- gs_memory_t *memory;\
- void *client_data;\
- gx_line_params line_params;\
- gs_matrix_fixed ctm;\
- bool current_point_valid;\
- gs_point current_point;\
- gs_point subpath_start;\
- bool clamp_coordinates;\
- gs_logical_operation_t log_op;\
- gx_color_value alpha;\
- gs_blend_mode_t blend_mode;\
- gs_transparency_source_t opacity, shape;\
+ bool is_gstate; /* is this imager state part of gstate ? */\
+ gs_memory_t *memory;\
+ void *client_data;\
+ gx_line_params line_params;\
+ gs_matrix_fixed ctm;\
+ bool current_point_valid;\
+ gs_point current_point;\
+ gs_point subpath_start;\
+ bool clamp_coordinates;\
+ gs_logical_operation_t log_op;\
+ gx_color_value alpha;\
+ gs_blend_mode_t blend_mode;\
+ gs_transparency_source_t opacity, shape;\
gs_xstate_trans_flags_t trans_flags;\
- gs_id soft_mask_id;\
- bool text_knockout;\
- uint text_rendering_mode;\
- gs_transparency_state_t *transparency_stack;\
+ gs_id soft_mask_id;\
+ bool text_knockout;\
+ uint text_rendering_mode;\
+ gs_transparency_state_t *transparency_stack;\
bool has_transparency; /* used to keep from doing shading fills in device color space */\
gx_device *trans_device; /* trans device has all mappings to group color space */\
- bool overprint;\
- int overprint_mode;\
- int effective_overprint_mode;\
- bool overprint_alt;\
- int overprint_mode_alt;\
- int effective_overprint_mode_alt;\
- float flatness;\
- gs_fixed_point fill_adjust; /* A path expansion for fill; -1 = dropout prevention*/\
- bool stroke_adjust;\
- bool accurate_curves;\
- bool have_pattern_streams;\
- float smoothness;\
- int renderingintent; /* See gsstate.c */\
+ bool overprint;\
+ int overprint_mode;\
+ int effective_overprint_mode;\
+ bool overprint_alt;\
+ int overprint_mode_alt;\
+ int effective_overprint_mode_alt;\
+ float flatness;\
+ gs_fixed_point fill_adjust; /* A path expansion for fill; -1 = dropout prevention*/\
+ bool stroke_adjust;\
+ bool accurate_curves;\
+ bool have_pattern_streams;\
+ float smoothness;\
+ int renderingintent; /* See gsstate.c */\
gsicc_manager_t *icc_manager; /* ICC color manager, profile */\
gsicc_link_cache_t *icc_link_cache; /* ICC linked transforms */\
gsicc_profile_cache_t *icc_profile_cache; /* ICC profiles from PS. */\
- CUSTOM_COLOR_PTR /* Pointer to custom color callback struct */\
- const gx_color_map_procs *\
- (*get_cmap_procs)(const gs_imager_state *, const gx_device *);\
- gs_color_rendering_state_common
+ CUSTOM_COLOR_PTR /* Pointer to custom color callback struct */\
+ const gx_color_map_procs *\
+ (*get_cmap_procs)(const gs_imager_state *, const gx_device *);\
+ gs_color_rendering_state_common
#define st_imager_state_num_ptrs\
(st_line_params_num_ptrs + st_cr_state_num_ptrs + 6)
/* Access macros */
@@ -326,8 +323,7 @@ void gs_imager_state_copied(gs_imager_state * pis);
/* Adjust reference counts before assigning one imager state to another. */
void gs_imager_state_pre_assign(gs_imager_state *to,
- const gs_imager_state *from);
-
+ const gs_imager_state *from);
/* Release an imager state. */
void gs_imager_state_release(gs_imager_state * pis);
diff --git a/gs/base/gxline.h b/gs/base/gxline.h
index 658d47acc..36072b4ef 100644
--- a/gs/base/gxline.h
+++ b/gs/base/gxline.h
@@ -44,14 +44,14 @@ typedef struct gx_line_params_s {
gs_line_cap dash_cap; /* Cap to use on start/end of dash segment */
gs_line_join join;
int curve_join; /* <0 means use join between segments of */
- /* flattened curves, >=0 means use this join */
+ /* flattened curves, >=0 means use this join */
float miter_limit;
float miter_check; /* computed from miter limit, */
- /* see gx_set_miter_limit and gs_stroke */
+ /* see gx_set_miter_limit and gs_stroke */
float dot_length;
bool dot_length_absolute; /* if true, dot_length is 1/72" units */
gs_matrix dot_orientation; /* dot length is aligned with (1,0); */
- /* must be xxyy or xyyx */
+ /* must be xxyy or xyyx */
gx_dash_params dash;
} gx_line_params;
diff --git a/gs/base/gxlum.h b/gs/base/gxlum.h
index bda365bf4..019ae0c31 100644
--- a/gs/base/gxlum.h
+++ b/gs/base/gxlum.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxmatrix.h b/gs/base/gxmatrix.h
index 68e560ab0..5fe010b69 100644
--- a/gs/base/gxmatrix.h
+++ b/gs/base/gxmatrix.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
#include "gsmatrix.h"
-/* The following switch is for developmenty purpose only.
+/* The following switch is for developmenty purpose only.
PRECISE_CURRENTPOINT 0 must not go to production due to no clamping. */
#define PRECISE_CURRENTPOINT 1 /* Old code compatible with dropped clamping = 0, new code = 1 */
@@ -46,12 +46,12 @@ int gs_matrix_fixed_from_matrix(gs_matrix_fixed *, const gs_matrix *);
/* Coordinate transformations to fixed point. */
int gs_point_transform2fixed(const gs_matrix_fixed *, floatp, floatp,
- gs_fixed_point *);
+ gs_fixed_point *);
int gs_distance_transform2fixed(const gs_matrix_fixed *, floatp, floatp,
- gs_fixed_point *);
+ gs_fixed_point *);
#if PRECISE_CURRENTPOINT
int gs_point_transform2fixed_rounding(const gs_matrix_fixed * pmat,
- floatp x, floatp y, gs_fixed_point * ppt);
+ floatp x, floatp y, gs_fixed_point * ppt);
#endif
/*
diff --git a/gs/base/gxmclip.c b/gs/base/gxmclip.c
index bf43732d1..7ef06f069 100644
--- a/gs/base/gxmclip.c
+++ b/gs/base/gxmclip.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,13 +26,13 @@ public_st_device_mask_clip();
static ENUM_PTRS_WITH(device_mask_clip_enum_ptrs, gx_device_mask_clip *mcdev)
{
if (index < st_gx_strip_bitmap_max_ptrs) {
- return ENUM_USING(st_gx_strip_bitmap, &mcdev->tiles,
- sizeof(mcdev->tiles), index);
+ return ENUM_USING(st_gx_strip_bitmap, &mcdev->tiles,
+ sizeof(mcdev->tiles), index);
}
index -= st_gx_strip_bitmap_max_ptrs;
if (index < st_device_memory_max_ptrs) {
- return ENUM_USING(st_device_memory, &mcdev->mdev,
- sizeof(mcdev->mdev), index);
+ return ENUM_USING(st_device_memory, &mcdev->mdev,
+ sizeof(mcdev->mdev), index);
}
ENUM_PREFIX(st_device_forward, st_device_memory_max_ptrs);
}
@@ -43,18 +43,18 @@ static RELOC_PTRS_WITH(device_mask_clip_reloc_ptrs, gx_device_mask_clip *mcdev)
RELOC_USING(st_gx_strip_bitmap, &mcdev->tiles, sizeof(mcdev->tiles));
RELOC_USING(st_device_memory, &mcdev->mdev, sizeof(mcdev->mdev));
if (mcdev->mdev.base != 0) {
- /*
- * Update the line pointers specially, since they point into the
- * buffer that is part of the mask clipping device itself.
- */
- long diff = (char *)RELOC_OBJ(mcdev) - (char *)mcdev;
- int i;
+ /*
+ * Update the line pointers specially, since they point into the
+ * buffer that is part of the mask clipping device itself.
+ */
+ long diff = (char *)RELOC_OBJ(mcdev) - (char *)mcdev;
+ int i;
- for (i = 0; i < mcdev->mdev.height; ++i)
- mcdev->mdev.line_ptrs[i] += diff;
- mcdev->mdev.base = mcdev->mdev.line_ptrs[0];
- mcdev->mdev.line_ptrs =
- (void *)((char *)(mcdev->mdev.line_ptrs) + diff);
+ for (i = 0; i < mcdev->mdev.height; ++i)
+ mcdev->mdev.line_ptrs[i] += diff;
+ mcdev->mdev.base = mcdev->mdev.line_ptrs[0];
+ mcdev->mdev.line_ptrs =
+ (void *)((char *)(mcdev->mdev.line_ptrs) + diff);
}
}
RELOC_PTRS_END
@@ -62,16 +62,16 @@ RELOC_PTRS_END
/* Initialize a mask clipping device. */
int
gx_mask_clip_initialize(gx_device_mask_clip * cdev,
- const gx_device_mask_clip * proto,
- const gx_bitmap * bits, gx_device * tdev,
- int tx, int ty, gs_memory_t *mem)
+ const gx_device_mask_clip * proto,
+ const gx_bitmap * bits, gx_device * tdev,
+ int tx, int ty, gs_memory_t *mem)
{
int buffer_width = bits->size.x;
int buffer_height =
- tile_clip_buffer_size / (bits->raster + sizeof(byte *));
+ tile_clip_buffer_size / (bits->raster + sizeof(byte *));
gx_device_init((gx_device *)cdev, (const gx_device *)proto,
- mem, true);
+ mem, true);
cdev->width = tdev->width;
cdev->height = tdev->height;
cdev->color_info = tdev->color_info;
@@ -79,25 +79,25 @@ gx_mask_clip_initialize(gx_device_mask_clip * cdev,
cdev->phase.x = -tx;
cdev->phase.y = -ty;
if (buffer_height > bits->size.y)
- buffer_height = bits->size.y;
+ buffer_height = bits->size.y;
gs_make_mem_mono_device(&cdev->mdev, 0, 0);
for (;;) {
- ulong bitmap_size = max_ulong;
+ ulong bitmap_size = max_ulong;
- if (buffer_height <= 0) {
- /*
- * The tile is too wide to buffer even one scan line.
- * We could do copy_mono in chunks, but for now, we punt.
- */
- cdev->mdev.base = 0;
- return_error(gs_error_VMerror);
- }
- cdev->mdev.width = buffer_width;
- cdev->mdev.height = buffer_height;
- gdev_mem_bitmap_size(&cdev->mdev, &bitmap_size);
- if (bitmap_size <= tile_clip_buffer_size)
- break;
- buffer_height--;
+ if (buffer_height <= 0) {
+ /*
+ * The tile is too wide to buffer even one scan line.
+ * We could do copy_mono in chunks, but for now, we punt.
+ */
+ cdev->mdev.base = 0;
+ return_error(gs_error_VMerror);
+ }
+ cdev->mdev.width = buffer_width;
+ cdev->mdev.height = buffer_height;
+ gdev_mem_bitmap_size(&cdev->mdev, &bitmap_size);
+ if (bitmap_size <= tile_clip_buffer_size)
+ break;
+ buffer_height--;
}
cdev->mdev.base = cdev->buffer.bytes;
return (*dev_proc(&cdev->mdev, open_device))((gx_device *)&cdev->mdev);
diff --git a/gs/base/gxmclip.h b/gs/base/gxmclip.h
index a66121679..d870c6479 100644
--- a/gs/base/gxmclip.h
+++ b/gs/base/gxmclip.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,11 +40,11 @@ typedef struct gx_device_mask_clip_s {
gx_strip_bitmap tiles;
gx_device_memory mdev; /* for tile buffer for copy_mono */
gs_int_point phase; /* device space origin relative */
- /* to tile (backwards from gstate phase) */
+ /* to tile (backwards from gstate phase) */
/* Ensure that the buffer is long-aligned. */
union _b {
- byte bytes[tile_clip_buffer_size];
- ulong longs[tile_clip_buffer_size / arch_sizeof_long];
+ byte bytes[tile_clip_buffer_size];
+ ulong longs[tile_clip_buffer_size / arch_sizeof_long];
} buffer;
} gx_device_mask_clip;
@@ -60,9 +60,9 @@ extern_st(st_device_mask_clip);
* Note that this procedure does not set cdev->tiles.
*/
int gx_mask_clip_initialize(gx_device_mask_clip * cdev,
- const gx_device_mask_clip * proto,
- const gx_bitmap * bits, gx_device * tdev,
- int tx, int ty, gs_memory_t *mem);
+ const gx_device_mask_clip * proto,
+ const gx_bitmap * bits, gx_device * tdev,
+ int tx, int ty, gs_memory_t *mem);
/*
* Prepare colors for a copy_mono operation.
@@ -70,31 +70,31 @@ int gx_mask_clip_initialize(gx_device_mask_clip * cdev,
* dev, data, sourcex, raster, id, x, y, w, y, color0, color1.
*/
#define setup_mask_copy_mono(cdev, color, mcolor0, mcolor1)\
- BEGIN\
- if ( cdev->mdev.base == 0 ) {\
- /*\
- * The tile was too large for us to buffer even one scan line.\
- * Punt to the very, very slow default implementation of\
- * copy_mono.\
- */\
- return gx_default_copy_mono(dev, data, sourcex, raster, id,\
- x, y, w, h, color0, color1);\
- }\
- if ( color1 != gx_no_color_index ) {\
- if ( color0 != gx_no_color_index ) {\
- /* Pre-fill with color0. */\
- code =\
- (*dev_proc(dev, fill_rectangle))(dev, x, y, w, h, color0);\
- if ( code < 0 )\
- return code;\
- }\
- color = color1;\
- mcolor0 = 0, mcolor1 = gx_no_color_index;\
- } else if ( color0 != gx_no_color_index ) {\
- color = color0;\
- mcolor0 = gx_no_color_index, mcolor1 = 0;\
- } else\
- return 0;\
- END
+ BEGIN\
+ if ( cdev->mdev.base == 0 ) {\
+ /*\
+ * The tile was too large for us to buffer even one scan line.\
+ * Punt to the very, very slow default implementation of\
+ * copy_mono.\
+ */\
+ return gx_default_copy_mono(dev, data, sourcex, raster, id,\
+ x, y, w, h, color0, color1);\
+ }\
+ if ( color1 != gx_no_color_index ) {\
+ if ( color0 != gx_no_color_index ) {\
+ /* Pre-fill with color0. */\
+ code =\
+ (*dev_proc(dev, fill_rectangle))(dev, x, y, w, h, color0);\
+ if ( code < 0 )\
+ return code;\
+ }\
+ color = color1;\
+ mcolor0 = 0, mcolor1 = gx_no_color_index;\
+ } else if ( color0 != gx_no_color_index ) {\
+ color = color0;\
+ mcolor0 = gx_no_color_index, mcolor1 = 0;\
+ } else\
+ return 0;\
+ END
#endif /* gxmclip_INCLUDED */
diff --git a/gs/base/gxobj.h b/gs/base/gxobj.h
index 705f40ffc..f7680b3ca 100644
--- a/gs/base/gxobj.h
+++ b/gs/base/gxobj.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,9 +27,9 @@
/*
* Object headers have the form:
- -l- -mark/back-
- -size-
- -type/reloc-
+ -l- -mark/back-
+ -size-
+ -type/reloc-
* l (aLone) is a single bit. Mark/back is 1 bit shorter than a uint. We
* round the header size up to the next multiple of the most severe
* alignment restriction (4 or 8 bytes).
@@ -77,20 +77,20 @@
#define obj_back_scale (1 << obj_back_shift)
typedef struct obj_header_data_s {
union _f {
- struct _h {
- unsigned alone:1;
- } h;
- struct _m {
- unsigned _:1, smark:obj_mb_bits;
- } m;
- struct _b {
- unsigned _:1, back:obj_mb_bits;
- } b;
+ struct _h {
+ unsigned alone:1;
+ } h;
+ struct _m {
+ unsigned _:1, smark:obj_mb_bits;
+ } m;
+ struct _b {
+ unsigned _:1, back:obj_mb_bits;
+ } b;
} f;
uint size;
union _t {
- gs_memory_type_ptr_t type;
- uint reloc;
+ gs_memory_type_ptr_t type;
+ uint reloc;
} t;
# if IGC_PTR_STABILITY_CHECK
unsigned space_id:3; /* r_space_bits + 1 bit for "instability". */
@@ -132,8 +132,8 @@ typedef struct obj_header_data_s {
/* Define the real object header type, taking alignment into account. */
struct obj_header_s { /* must be a struct because of forward reference */
union _d {
- obj_header_data_t o;
- byte _pad[ROUND_UP(sizeof(obj_header_data_t), obj_align_mod)];
+ obj_header_data_t o;
+ byte _pad[ROUND_UP(sizeof(obj_header_data_t), obj_align_mod)];
}
d;
};
diff --git a/gs/base/gxoprect.c b/gs/base/gxoprect.c
index 3b5e20359..7c506aa61 100644
--- a/gs/base/gxoprect.c
+++ b/gs/base/gxoprect.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,7 +24,6 @@
#include "gxoprect.h"
#include "gsbitops.h"
-
/*
* Unpack a scanline for a depth < 8. In this case we know the depth is
* divisor of 8 and thus a power of 2, which implies that 8 / depth is
@@ -167,7 +166,6 @@ pack_scanline_ge8(
}
}
-
/*
* Perform the fill rectangle operation for a non-separable color encoding
* that requires overprint support. This situation requires that colors be
@@ -259,7 +257,7 @@ gx_overprint_generic_fill_rectangle(
*
* - Data should be returned in the depth of the process color
* model. Though this depth could be specified explicitly, there
- * is little reason to do so.
+ * is little reason to do so.
*
* - Though overprint is much more easily implemented with planar
* data, there is no planar version of the copy_color method to
@@ -317,7 +315,7 @@ gx_overprint_generic_fill_rectangle(
gx_color_index comps;
int j;
gx_color_value dest_cvals[GX_DEVICE_COLOR_MAX_COMPONENTS];
-
+
if ((code = dev_proc(tdev, decode_color)(tdev, *cp, dest_cvals)) < 0)
break;
for (j = 0, comps = drawn_comps; comps != 0; ++j, comps >>= 1) {
@@ -345,8 +343,6 @@ gx_overprint_generic_fill_rectangle(
return code;
}
-
-
/*
* Replication of 2 and 4 bit patterns to fill a mem_mono_chunk.
*/
@@ -404,7 +400,6 @@ replicate_color(int depth, mono_fill_chunk color)
return color;
}
-
/*
* Perform the fill rectangle operation for a separable color encoding
* that requires overprint support.
@@ -525,7 +520,6 @@ gx_overprint_sep_fill_rectangle_1(
return code;
}
-
int
gx_overprint_sep_fill_rectangle_2(
gx_device * tdev,
@@ -613,4 +607,3 @@ gx_overprint_sep_fill_rectangle_2(
return code;
}
-
diff --git a/gs/base/gxoprect.h b/gs/base/gxoprect.h
index cc4e80887..23f20abdf 100644
--- a/gs/base/gxoprect.h
+++ b/gs/base/gxoprect.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxp1fill.c b/gs/base/gxp1fill.c
index 60e97467a..d9f3ab203 100644
--- a/gs/base/gxp1fill.c
+++ b/gs/base/gxp1fill.c
@@ -62,7 +62,6 @@ typedef struct tile_fill_state_s {
} tile_fill_state_t;
-
/* Define the state for tile filling.
This is used for when we have
transparency */
@@ -467,7 +466,6 @@ gx_dc_colored_masked_fill_rect(const gx_device_color * pdevc,
}
}
-
/*
* This is somewhat a clone of the tile_by_steps function but one
* that performs filling from and to pdf14dev (transparency) buffers.
@@ -617,7 +615,6 @@ tile_rect_trans_simple(int xmin, int ymin, int xmax, int ymax, int px, int py, c
right_tile_width = w - num_full_tiles*tile_width - left_width;
-
for (kk = 0; kk < fill_trans_buffer->n_chan; kk++){
ptr_out = buff_out + kk * fill_trans_buffer->planestride;
@@ -674,7 +671,6 @@ tile_rect_trans_simple(int xmin, int ymin, int xmax, int ymax, int px, int py, c
}
-
/* This does the case of tiling with non simple tiles. In this case, the tiles may overlap and
so we really need to do blending within the existing buffer. This needs some serious optimization. */
void
@@ -771,9 +767,9 @@ tile_rect_trans_blend(int xmin, int ymin, int xmax, int ymax, int px, int py, co
/* This version does a rect fill with the transparency object */
int
gx_dc_pat_trans_fill_rectangle(const gx_device_color * pdevc, int x, int y,
- int w, int h, gx_device * dev,
- gs_logical_operation_t lop,
- const gx_rop_source_t * source)
+ int w, int h, gx_device * dev,
+ gs_logical_operation_t lop,
+ const gx_rop_source_t * source)
{
gx_color_tile *ptile = pdevc->colors.pattern.p_tile;
int code;
@@ -789,7 +785,7 @@ gx_dc_pat_trans_fill_rectangle(const gx_device_color * pdevc, int x, int y,
phase.x = pdevc->phase.x;
phase.y = pdevc->phase.y;
- code = gx_trans_pattern_fill_rect(x, y, x+w, y+h, ptile,
+ code = gx_trans_pattern_fill_rect(x, y, x+w, y+h, ptile,
ptile->ttrans->fill_trans_buffer, phase);
return code;
@@ -800,7 +796,7 @@ gx_dc_pat_trans_fill_rectangle(const gx_device_color * pdevc, int x, int y,
int
gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax, gx_color_tile *ptile,
- gx_pattern_trans_t *fill_trans_buffer,
+ gx_pattern_trans_t *fill_trans_buffer,
gs_int_point phase)
{
@@ -813,7 +809,7 @@ gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax, gx_color_tile
/* Fit fill */
if ( (xmin | ymin) < 0 ) {
if ( xmin < 0 )
- xmin = 0;
+ xmin = 0;
if ( ymin < 0 )
ymin = 0;
}
@@ -829,7 +825,7 @@ gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax, gx_color_tile
int py =
imod(-(int)fastfloor(ptile->step_matrix.ty - phase.y + 0.5),
ptile->ttrans->height);
-
+
tile_rect_trans_simple(xmin, ymin, xmax, ymax, px, py, ptile,
fill_trans_buffer);
} else {
diff --git a/gs/base/gxp1impl.h b/gs/base/gxp1impl.h
index a1e6695e8..bc016ff59 100644
--- a/gs/base/gxp1impl.h
+++ b/gs/base/gxp1impl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ dev_color_proc_fill_rectangle(gx_dc_pat_trans_fill_rectangle);
* Declare the Pattern color mapping procedures exported by gxpcmap.c.
*/
int gx_pattern_load(gx_device_color *, const gs_imager_state *,
- gx_device *, gs_color_select_t);
+ gx_device *, gs_color_select_t);
pattern_proc_remap_color(gs_pattern1_remap_color);
#endif /* gxp1impl_INCLUDED */
diff --git a/gs/base/gxpageq.c b/gs/base/gxpageq.c
index 13dd2e095..f0047013d 100644
--- a/gs/base/gxpageq.c
+++ b/gs/base/gxpageq.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,9 +56,8 @@ private_st_gx_page_queue();
/* ------------ Forward Decl's --------------------------- */
static gx_page_queue_entry_t * /* removed entry, 0 if none avail */
gx_page_queue_remove_first(
- gx_page_queue_t * queue /* page queue to retrieve from */
- );
-
+ gx_page_queue_t * queue /* page queue to retrieve from */
+ );
/* --------------------Procedures------------------------- */
@@ -67,7 +66,7 @@ gx_page_queue_t *
gx_page_queue_alloc(gs_memory_t *mem)
{
return gs_alloc_struct(mem, gx_page_queue_t, &st_gx_page_queue,
- "gx_page_queue_alloc");
+ "gx_page_queue_alloc");
}
/* ------- page_queue_entry alloc/free --------- */
@@ -75,16 +74,16 @@ gx_page_queue_alloc(gs_memory_t *mem)
/* Allocate & init a gx_page_queue_entry */
gx_page_queue_entry_t * /* rets ptr to allocated object, 0 if VM error */
gx_page_queue_entry_alloc(
- gx_page_queue_t * queue /* queue that entry is being alloc'd for */
+ gx_page_queue_t * queue /* queue that entry is being alloc'd for */
)
{
gx_page_queue_entry_t *entry
= gs_alloc_struct(queue->memory, gx_page_queue_entry_t,
- &st_gx_page_queue_entry, "gx_page_queue_entry_alloc");
+ &st_gx_page_queue_entry, "gx_page_queue_entry_alloc");
if (entry != 0) {
- entry->next = 0;
- entry->queue = queue;
+ entry->next = 0;
+ entry->queue = queue;
}
return entry;
}
@@ -92,16 +91,16 @@ gx_page_queue_entry_alloc(
/* Free a gx_page_queue_entry allocated w/gx_page_queue_entry_alloc */
void
gx_page_queue_entry_free(
- gx_page_queue_entry_t * entry /* entry to free up */
+ gx_page_queue_entry_t * entry /* entry to free up */
)
{
gs_free_object(entry->queue->memory, entry, "gx_page_queue_entry_free");
}
-
+
/* Free the clist resources held by a gx_page_queue_entry_t */
void
gx_page_queue_entry_free_page_info(
- gx_page_queue_entry_t * entry /* entry to free up */
+ gx_page_queue_entry_t * entry /* entry to free up */
)
{
clist_close_page_info( &entry->page_info );
@@ -112,8 +111,8 @@ gx_page_queue_entry_free_page_info(
/* Initialize a gx_page_queue object */
int /* -ve error code, or 0 */
gx_page_queue_init(
- gx_page_queue_t * queue, /* page queue to init */
- gs_memory_t * memory /* allocator for dynamic memory */
+ gx_page_queue_t * queue, /* page queue to init */
+ gs_memory_t * memory /* allocator for dynamic memory */
)
{
queue->memory = memory;
@@ -127,44 +126,44 @@ gx_page_queue_init(
queue->reserve_entry = gx_page_queue_entry_alloc(queue);
if (queue->monitor && queue->render_req_sema && queue->render_done_sema
- && queue->reserve_entry)
- return 0;
+ && queue->reserve_entry)
+ return 0;
else {
- gx_page_queue_dnit(queue);
- return gs_error_VMerror;
+ gx_page_queue_dnit(queue);
+ return gs_error_VMerror;
}
}
/* Dnitialize a gx_page_queue object */
void
gx_page_queue_dnit(
- gx_page_queue_t * queue /* page queue to dnit */
+ gx_page_queue_t * queue /* page queue to dnit */
)
{
/* Deallocate any left-over queue entries */
gx_page_queue_entry_t *entry;
while ((entry = gx_page_queue_remove_first(queue)) != 0) {
- gx_page_queue_entry_free_page_info(entry);
- gx_page_queue_entry_free(entry);
+ gx_page_queue_entry_free_page_info(entry);
+ gx_page_queue_entry_free(entry);
}
/* Free dynamic objects */
if (queue->monitor) {
- gx_monitor_free(queue->monitor);
- queue->monitor = 0;
+ gx_monitor_free(queue->monitor);
+ queue->monitor = 0;
}
if (queue->render_req_sema) {
- gx_semaphore_free(queue->render_req_sema);
- queue->render_req_sema = 0;
+ gx_semaphore_free(queue->render_req_sema);
+ queue->render_req_sema = 0;
}
if (queue->render_done_sema) {
- gx_semaphore_free(queue->render_done_sema);
- queue->render_done_sema = 0;
+ gx_semaphore_free(queue->render_done_sema);
+ queue->render_done_sema = 0;
}
if (queue->reserve_entry) {
- gx_page_queue_entry_free(queue->reserve_entry);
- queue->reserve_entry = 0;
+ gx_page_queue_entry_free(queue->reserve_entry);
+ queue->reserve_entry = 0;
}
}
@@ -173,7 +172,7 @@ gx_page_queue_dnit(
/* Retrieve & remove firstin queue entry */
static gx_page_queue_entry_t * /* removed entry, 0 if none avail */
gx_page_queue_remove_first(
- gx_page_queue_t * queue /* page queue to retrieve from */
+ gx_page_queue_t * queue /* page queue to retrieve from */
)
{
gx_page_queue_entry_t *entry = 0; /* assume failure */
@@ -183,11 +182,11 @@ gx_page_queue_remove_first(
/* Get the goods */
if (queue->entry_count) {
- entry = queue->first_in;
- queue->first_in = entry->next;
- if (queue->last_in == entry)
- queue->last_in = 0;
- --queue->entry_count;
+ entry = queue->first_in;
+ queue->first_in = entry->next;
+ if (queue->last_in == entry)
+ queue->last_in = 0;
+ --queue->entry_count;
}
/* exit monitor */
gx_monitor_leave(queue->monitor);
@@ -198,7 +197,7 @@ gx_page_queue_remove_first(
/* Add entry to queue at end */
static void
gx_page_queue_add_last(
- gx_page_queue_entry_t * entry /* entry to add */
+ gx_page_queue_entry_t * entry /* entry to add */
)
{
gx_page_queue_t *queue = entry->queue;
@@ -209,10 +208,10 @@ gx_page_queue_add_last(
/* Add the goods */
entry->next = 0;
if (queue->last_in != 0)
- queue->last_in->next = entry;
+ queue->last_in->next = entry;
queue->last_in = entry;
if (queue->first_in == 0)
- queue->first_in = entry;
+ queue->first_in = entry;
++queue->entry_count;
/* exit monitor */
@@ -224,23 +223,23 @@ gx_page_queue_add_last(
/* Wait for a single page to finish rendering (if any pending) */
int /* rets 0 if no pages were waiting for rendering, 1 if actually waited */
gx_page_queue_wait_one_page(
- gx_page_queue_t * queue /* queue to wait on */
+ gx_page_queue_t * queue /* queue to wait on */
)
{
int code;
gx_monitor_enter(queue->monitor);
if (!queue->entry_count && !queue->dequeue_in_progress) {
- code = 0;
- gx_monitor_leave(queue->monitor);
+ code = 0;
+ gx_monitor_leave(queue->monitor);
} else {
- /* request acknowledgement on render done */
- queue->enable_render_done_signal = true;
+ /* request acknowledgement on render done */
+ queue->enable_render_done_signal = true;
- /* exit monitor & wait for acknowlegement */
- gx_monitor_leave(queue->monitor);
- gx_semaphore_wait(queue->render_done_sema);
- code = 1;
+ /* exit monitor & wait for acknowlegement */
+ gx_monitor_leave(queue->monitor);
+ gx_semaphore_wait(queue->render_done_sema);
+ code = 1;
}
return code;
}
@@ -248,7 +247,7 @@ gx_page_queue_wait_one_page(
/* Wait for page queue to become empty */
void
gx_page_queue_wait_until_empty(
- gx_page_queue_t * queue /* page queue to wait on */
+ gx_page_queue_t * queue /* page queue to wait on */
)
{
while (gx_page_queue_wait_one_page(queue));
@@ -259,7 +258,7 @@ gx_page_queue_wait_until_empty(
/* Add an entry to page queue for rendering w/sync to renderer */
void
gx_page_queue_enqueue(
- gx_page_queue_entry_t * entry /* entry to add */
+ gx_page_queue_entry_t * entry /* entry to add */
)
{
gx_page_queue_t *queue = entry->queue;
@@ -273,10 +272,10 @@ gx_page_queue_enqueue(
/* Even if an error is returned, entry will have been added to queue! */
int /* rets 0 ok, gs_error_VMerror if error */
gx_page_queue_add_page(gx_device_clist_writer *const pcwdev,
- gx_page_queue_t * queue, /* page queue to add to */
- gx_page_queue_action_t action, /* action code to queue */
- const gx_band_page_info_t * page_info, /* bandinfo incl. bandlist (or 0) */
- int page_count /* see comments in gdevprna.c */
+ gx_page_queue_t * queue, /* page queue to add to */
+ gx_page_queue_action_t action, /* action code to queue */
+ const gx_band_page_info_t * page_info, /* bandinfo incl. bandlist (or 0) */
+ int page_count /* see comments in gdevprna.c */
)
{
int code = 0;
@@ -286,19 +285,19 @@ gx_page_queue_add_page(gx_device_clist_writer *const pcwdev,
= gx_page_queue_entry_alloc(queue);
if (!entry) {
- /* Use reserve page queue entry */
- gx_monitor_enter(queue->monitor); /* not strictly necessary */
- entry = queue->reserve_entry;
- queue->reserve_entry = 0;
- gx_monitor_leave(queue->monitor);
+ /* Use reserve page queue entry */
+ gx_monitor_enter(queue->monitor); /* not strictly necessary */
+ entry = queue->reserve_entry;
+ queue->reserve_entry = 0;
+ gx_monitor_leave(queue->monitor);
}
/* Fill in page queue entry with info from device */
entry->action = action;
if (page_info != 0)
- entry->page_info = *page_info;
+ entry->page_info = *page_info;
else {
- entry->page_info = null_page_info;
- entry->page_info.io_procs = pcwdev->page_info.io_procs;
+ entry->page_info = null_page_info;
+ entry->page_info.io_procs = pcwdev->page_info.io_procs;
}
entry->num_copies = page_count;
@@ -307,12 +306,12 @@ gx_page_queue_add_page(gx_device_clist_writer *const pcwdev,
/* If a new reserve entry is needed, wait till enough mem is avail */
while (!queue->reserve_entry) {
- queue->reserve_entry = gx_page_queue_entry_alloc(queue);
- if (!queue->reserve_entry && !gx_page_queue_wait_one_page(queue)) {
- /* Should never happen: all pages rendered & still can't get memory: give up! */
- code = gs_note_error(gs_error_Fatal);
- break;
- }
+ queue->reserve_entry = gx_page_queue_entry_alloc(queue);
+ if (!queue->reserve_entry && !gx_page_queue_wait_one_page(queue)) {
+ /* Should never happen: all pages rendered & still can't get memory: give up! */
+ code = gs_note_error(gs_error_Fatal);
+ break;
+ }
}
return code;
}
@@ -320,7 +319,7 @@ gx_page_queue_add_page(gx_device_clist_writer *const pcwdev,
/* Wait for & get next page queue entry */
gx_page_queue_entry_t * /* removed entry */
gx_page_queue_start_dequeue(
- gx_page_queue_t * queue /* page queue to retrieve from */
+ gx_page_queue_t * queue /* page queue to retrieve from */
)
{
gx_semaphore_wait(queue->render_req_sema);
@@ -331,15 +330,15 @@ gx_page_queue_start_dequeue(
/* After rendering page gotten w/gx_page_queue_dequeue, call this to ack */
void
gx_page_queue_finish_dequeue(
- gx_page_queue_entry_t * entry /* entry that was retrieved to delete */
+ gx_page_queue_entry_t * entry /* entry that was retrieved to delete */
)
{
gx_page_queue_t *queue = entry->queue;
gx_monitor_enter(queue->monitor);
if (queue->enable_render_done_signal) {
- queue->enable_render_done_signal = false;
- gx_semaphore_signal(queue->render_done_sema);
+ queue->enable_render_done_signal = false;
+ gx_semaphore_signal(queue->render_done_sema);
}
queue->dequeue_in_progress = false;
diff --git a/gs/base/gxpageq.h b/gs/base/gxpageq.h
index f6c68ea15..89b88034e 100644
--- a/gs/base/gxpageq.h
+++ b/gs/base/gxpageq.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,70 +32,66 @@
/* --------------- Data type definitions --------------------- */
/* Action codes for each page queue entry. Each page that the interpreter
- emits to the page queue can actually be broken down into a sequence of
- one or more page queue entries. The general form for a given page's
- sequence of page queue entries can be expressed as:
- [PARTIAL_PAGE]... [COPY_PAGE [PARTIAL_PAGE]...]... FULL_PAGE
- where elements in square brackets are optional, and ellipses show
- repetition. NOTE that a single ACTION_TERMINATE (followed by nothing) can
- also show up at any point in the page queue in lieu of page descriptions.
-
-
- PARTIAL_PAGE: The interpreter emits a partial page when the bandlist is
- too small to contain a page's full representation. Partial pages will
- be emitted in out-of-memory situations *only* after the interpreter
- has determined that no further page queue entries are in the page
- queue, indicating that no further memory can be reclaimed by merely
- waiting for queued pages to render and free their associated bandlist.
-
- Note that num_copies is undefined for partial pages: the actual
- number of pages to render will only be known when ...COPY_PAGE
- or FULL_PAGE is emitted.
-
- Partial pages are never imaged.
-
-
- FULL_PAGE: The interpreter emits a full page when a page description
- is complete (e.g. showpage), or trashed (e.g. setpagedevice). The
- page's complete description consists of the FULL_PAGE plus all
- PARTIAL_PAGEs that immediately precede it in the page queue (and
- possibly preceding COPY_PAGEs) all the way back to the previous
- FULL_PAGE (or up to the beginning of queue entries).
-
- In the case of a trashed page, the page count will be 0. The page
- queue may choose to not render the 0-count FULL_PAGE queue entry
- for efficiency. If they have not been rendered, the page queue
- may choose to also discard (and/or not render) any PARTIAL_PAGEs
- leading up to the trashed page. The page queue must however take
- care to not discard any entries leading up to a COPY_PAGE with
- a non-0 page count that may precede the FULL_PAGE, since COPY_PAGE
- must be rendered in that case. In any event, a 0-count page will
- not be imaged.
-
- In the case of a complete page, the page count will be 0 or greater.
- The 0-count page is equivalent to a trashed page -- see above. The
- renderer must ensure that all PARTIAL_PAGEs and COPY_PAGEs leading
- up to the FULL_PAGE are rendered sequentially before rendering
- and imaging the FULL_PAGE.
-
-
- COPY_PAGE: is similar to FULL_PAGE above, except that COPY_PAGE must
- keep the rendered results, instead of clearing them. COPY_PAGE
- differs from a partial page in that the page must be imaged, as well
- as rasterized. This is to support PostScript language "copypage"
- semantics.
-
- Note that a 0 page count here does not absolve the renderer from
- rendering the page queue entries (unless all subsequent COPY_PAGEs
- the the FULL_PAGE for this page also have a 0 page count), since
- the results of COPY_PAGE must be available for subsequent pages.
-
-
- TERMINATE: This entry can appear at any time in the page queue. It
- will be the last entry to ever appear in the queue. The semantics
- of this entry require all prior non-zero-count COPY_PAGEs and
- FULL_PAGEs to be imaged. Any trailing PARTIAL_PAGEs may optionally
- be rendered, but should not be imaged.
+ emits to the page queue can actually be broken down into a sequence of
+ one or more page queue entries. The general form for a given page's
+ sequence of page queue entries can be expressed as:
+ [PARTIAL_PAGE]... [COPY_PAGE [PARTIAL_PAGE]...]... FULL_PAGE
+ where elements in square brackets are optional, and ellipses show
+ repetition. NOTE that a single ACTION_TERMINATE (followed by nothing) can
+ also show up at any point in the page queue in lieu of page descriptions.
+
+ PARTIAL_PAGE: The interpreter emits a partial page when the bandlist is
+ too small to contain a page's full representation. Partial pages will
+ be emitted in out-of-memory situations *only* after the interpreter
+ has determined that no further page queue entries are in the page
+ queue, indicating that no further memory can be reclaimed by merely
+ waiting for queued pages to render and free their associated bandlist.
+
+ Note that num_copies is undefined for partial pages: the actual
+ number of pages to render will only be known when ...COPY_PAGE
+ or FULL_PAGE is emitted.
+
+ Partial pages are never imaged.
+
+ FULL_PAGE: The interpreter emits a full page when a page description
+ is complete (e.g. showpage), or trashed (e.g. setpagedevice). The
+ page's complete description consists of the FULL_PAGE plus all
+ PARTIAL_PAGEs that immediately precede it in the page queue (and
+ possibly preceding COPY_PAGEs) all the way back to the previous
+ FULL_PAGE (or up to the beginning of queue entries).
+
+ In the case of a trashed page, the page count will be 0. The page
+ queue may choose to not render the 0-count FULL_PAGE queue entry
+ for efficiency. If they have not been rendered, the page queue
+ may choose to also discard (and/or not render) any PARTIAL_PAGEs
+ leading up to the trashed page. The page queue must however take
+ care to not discard any entries leading up to a COPY_PAGE with
+ a non-0 page count that may precede the FULL_PAGE, since COPY_PAGE
+ must be rendered in that case. In any event, a 0-count page will
+ not be imaged.
+
+ In the case of a complete page, the page count will be 0 or greater.
+ The 0-count page is equivalent to a trashed page -- see above. The
+ renderer must ensure that all PARTIAL_PAGEs and COPY_PAGEs leading
+ up to the FULL_PAGE are rendered sequentially before rendering
+ and imaging the FULL_PAGE.
+
+ COPY_PAGE: is similar to FULL_PAGE above, except that COPY_PAGE must
+ keep the rendered results, instead of clearing them. COPY_PAGE
+ differs from a partial page in that the page must be imaged, as well
+ as rasterized. This is to support PostScript language "copypage"
+ semantics.
+
+ Note that a 0 page count here does not absolve the renderer from
+ rendering the page queue entries (unless all subsequent COPY_PAGEs
+ the the FULL_PAGE for this page also have a 0 page count), since
+ the results of COPY_PAGE must be available for subsequent pages.
+
+ TERMINATE: This entry can appear at any time in the page queue. It
+ will be the last entry to ever appear in the queue. The semantics
+ of this entry require all prior non-zero-count COPY_PAGEs and
+ FULL_PAGEs to be imaged. Any trailing PARTIAL_PAGEs may optionally
+ be rendered, but should not be imaged.
*/
typedef enum {
GX_PAGE_QUEUE_ACTION_PARTIAL_PAGE,
@@ -232,7 +228,7 @@ int gx_page_queue_add_page(
gx_page_queue_action_t action, /* action code to queue */
const gx_band_page_info_t * page_info, /* bandinfo incl. bandlist */
int page_count /* # of copies to print if final "print," */
- /* 0 if partial page, -1 if cancel */
+ /* 0 if partial page, -1 if cancel */
);
/*
@@ -247,9 +243,9 @@ int gx_page_queue_add_page(
* may free more memory.
* Typically called by renderer thread loop, which looks like:
do {
- gx_page_queue_start_deqeueue(...);
- render_retrieved_entry(...);
- gx_page_queue_finish_dequeue(...);
+ gx_page_queue_start_deqeueue(...);
+ render_retrieved_entry(...);
+ gx_page_queue_finish_dequeue(...);
} while (some condition);
*/
gx_page_queue_entry_t * /* removed entry */
diff --git a/gs/base/gxpaint.c b/gs/base/gxpaint.c
index c33e1fea4..e2826eac9 100644
--- a/gs/base/gxpaint.c
+++ b/gs/base/gxpaint.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,15 +24,15 @@
static bool caching_an_outline_font(const gs_state * pgs)
{
return pgs->in_cachedevice > 1 &&
- pgs->font != NULL &&
- pgs->font->FontType != ft_user_defined &&
- pgs->font->FontType != ft_CID_user_defined;
+ pgs->font != NULL &&
+ pgs->font->FontType != ft_user_defined &&
+ pgs->font->FontType != ft_CID_user_defined;
}
/* Fill a path. */
int
gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs,
- int rule, fixed adjust_x, fixed adjust_y)
+ int rule, fixed adjust_x, fixed adjust_y)
{
gx_device *dev = gs_currentdevice_inline(pgs);
gx_clip_path *pcpath;
@@ -40,13 +40,13 @@ gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs,
gx_fill_params params;
if (code < 0)
- return code;
+ return code;
params.rule = rule;
params.adjust.x = adjust_x;
params.adjust.y = adjust_y;
params.flatness = (caching_an_outline_font(pgs) ? 0.0 : pgs->flatness);
return (*dev_proc(dev, fill_path))
- (dev, (const gs_imager_state *)pgs, ppath, &params, pdevc, pcpath);
+ (dev, (const gs_imager_state *)pgs, ppath, &params, pdevc, pcpath);
}
/* Stroke a path for drawing or saving. */
@@ -59,35 +59,35 @@ gx_stroke_fill(gx_path * ppath, gs_state * pgs)
gx_stroke_params params;
if (code < 0)
- return code;
+ return code;
params.flatness = (caching_an_outline_font(pgs) ? 0.0 : pgs->flatness);
params.traditional = false;
return (*dev_proc(dev, stroke_path))
- (dev, (const gs_imager_state *)pgs, ppath, &params,
- gs_currentdevicecolor_inline(pgs), pcpath);
+ (dev, (const gs_imager_state *)pgs, ppath, &params,
+ gs_currentdevicecolor_inline(pgs), pcpath);
}
int
gx_stroke_add(gx_path * ppath, gx_path * to_path,
- const gs_state * pgs, bool traditional)
+ const gs_state * pgs, bool traditional)
{
gx_stroke_params params;
params.flatness = (caching_an_outline_font(pgs) ? 0.0 : pgs->flatness);
params.traditional = traditional;
return gx_stroke_path_only(ppath, to_path, pgs->device,
- (const gs_imager_state *)pgs,
- &params, NULL, NULL);
+ (const gs_imager_state *)pgs,
+ &params, NULL, NULL);
}
int
gx_imager_stroke_add(gx_path *ppath, gx_path *to_path,
- gx_device *dev, const gs_imager_state *pis)
+ gx_device *dev, const gs_imager_state *pis)
{
gx_stroke_params params;
params.flatness = pis->flatness;
params.traditional = false;
return gx_stroke_path_only(ppath, to_path, dev, pis,
- &params, NULL, NULL);
+ &params, NULL, NULL);
}
diff --git a/gs/base/gxpaint.h b/gs/base/gxpaint.h
index d75e5a79e..4c432ebe6 100644
--- a/gs/base/gxpaint.h
+++ b/gs/base/gxpaint.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ typedef struct gx_device_color_s gx_device_color;
*/
int gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs,
- int rule, fixed adjust_x, fixed adjust_y);
+ int rule, fixed adjust_x, fixed adjust_y);
int gx_stroke_fill(gx_path * ppath, gs_state * pgs);
int gx_stroke_add(gx_path *ppath, gx_path *to_path, const gs_state * pgs, bool traditional);
/*
@@ -54,7 +54,7 @@ int gx_stroke_add(gx_path *ppath, gx_path *to_path, const gs_state * pgs, bool t
* dots (and for no other reason).
*/
int gx_imager_stroke_add(gx_path *ppath, gx_path *to_path,
- gx_device *dev, const gs_imager_state *pis);
+ gx_device *dev, const gs_imager_state *pis);
/* ------ Imager procedures ------ */
@@ -75,7 +75,7 @@ void gx_adjust_if_empty(const gs_fixed_rect *, gs_fixed_point *);
* pathbbox.
*/
int gx_stroke_path_expansion(const gs_imager_state *pis,
- const gx_path *ppath, gs_fixed_point *ppt);
+ const gx_path *ppath, gs_fixed_point *ppt);
/* Backward compatibility */
#define gx_stroke_expansion(pis, ppt)\
@@ -111,9 +111,9 @@ struct gx_stroke_params_s {
};
int gx_stroke_path_only(gx_path * ppath, gx_path * to_path, gx_device * dev,
- const gs_imager_state * pis,
- const gx_stroke_params * params,
- const gx_device_color * pdevc,
- const gx_clip_path * pcpath);
+ const gs_imager_state * pis,
+ const gx_stroke_params * params,
+ const gx_device_color * pdevc,
+ const gx_clip_path * pcpath);
#endif /* gxpaint_INCLUDED */
diff --git a/gs/base/gxpath.c b/gs/base/gxpath.c
index 12c95396b..61722e7cb 100644
--- a/gs/base/gxpath.c
+++ b/gs/base/gxpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@ static void gx_print_segment(const segment *);
py < ppath->bbox.p.y || py > ppath->bbox.q.y)
#define check_in_bbox(ppath, px, py)\
if ( outside_bbox(ppath, px, py) )\
- return_error(gs_error_rangecheck)
+ return_error(gs_error_rangecheck)
/* Structure descriptors for paths and path segment types. */
public_st_path();
@@ -63,7 +63,7 @@ static rc_free_proc(rc_free_path_segments_local);
/*
* Define the default virtual path interface implementation.
*/
-static int
+static int
gz_path_add_point(gx_path *, fixed, fixed),
gz_path_add_line_notes(gx_path *, fixed, fixed, segment_notes),
gz_path_add_curve_notes(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, segment_notes),
@@ -81,7 +81,7 @@ static gx_path_procs default_path_procs = {
/*
* Define virtual path interface implementation for computing a path bbox.
*/
-static int
+static int
gz_path_bbox_add_point(gx_path *, fixed, fixed),
gz_path_bbox_add_line_notes(gx_path *, fixed, fixed, segment_notes),
gz_path_bbox_add_curve_notes(gx_path *, fixed, fixed, fixed, fixed, fixed, fixed, segment_notes),
@@ -118,32 +118,32 @@ gx_path_init_contents(gx_path * ppath)
*/
static int
path_alloc_segments(gx_path_segments ** ppsegs, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
mem = gs_memory_stable(mem);
rc_alloc_struct_1(*ppsegs, gx_path_segments, &st_path_segments,
- mem, return_error(gs_error_VMerror), cname);
+ mem, return_error(gs_error_VMerror), cname);
(*ppsegs)->rc.free = rc_free_path_segments;
return 0;
}
int
gx_path_init_contained_shared(gx_path * ppath, const gx_path * shared,
- gs_memory_t * mem, client_name_t cname)
+ gs_memory_t * mem, client_name_t cname)
{
if (shared) {
- if (shared->segments == &shared->local_segments) {
- lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
- (ulong) shared);
- return_error(gs_error_Fatal);
- }
- *ppath = *shared;
- rc_increment(ppath->segments);
+ if (shared->segments == &shared->local_segments) {
+ lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
+ (ulong) shared);
+ return_error(gs_error_Fatal);
+ }
+ *ppath = *shared;
+ rc_increment(ppath->segments);
} else {
- int code = path_alloc_segments(&ppath->segments, mem, cname);
+ int code = path_alloc_segments(&ppath->segments, mem, cname);
- if (code < 0)
- return code;
- gx_path_init_contents(ppath);
+ if (code < 0)
+ return code;
+ gx_path_init_contents(ppath);
}
ppath->memory = mem;
ppath->allocation = path_allocated_contained;
@@ -158,30 +158,30 @@ gx_path_init_contained_shared(gx_path * ppath, const gx_path * shared,
*/
gx_path *
gx_path_alloc_shared(const gx_path * shared, gs_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
gx_path *ppath = gs_alloc_struct(mem, gx_path, &st_path, cname);
if (ppath == 0)
- return 0;
+ return 0;
ppath->procs = &default_path_procs;
if (shared) {
- if (shared->segments == &shared->local_segments) {
- lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
- (ulong) shared);
- gs_free_object(mem, ppath, cname);
- return 0;
- }
- *ppath = *shared;
- rc_increment(ppath->segments);
+ if (shared->segments == &shared->local_segments) {
+ lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
+ (ulong) shared);
+ gs_free_object(mem, ppath, cname);
+ return 0;
+ }
+ *ppath = *shared;
+ rc_increment(ppath->segments);
} else {
- int code = path_alloc_segments(&ppath->segments, mem, cname);
+ int code = path_alloc_segments(&ppath->segments, mem, cname);
- if (code < 0) {
- gs_free_object(mem, ppath, cname);
- return 0;
- }
- gx_path_init_contents(ppath);
+ if (code < 0) {
+ gs_free_object(mem, ppath, cname);
+ return 0;
+ }
+ gx_path_init_contents(ppath);
}
ppath->memory = mem;
ppath->allocation = path_allocated_on_heap;
@@ -194,21 +194,21 @@ gx_path_alloc_shared(const gx_path * shared, gs_memory_t * mem,
*/
int
gx_path_init_local_shared(gx_path * ppath, const gx_path * shared,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
if (shared) {
- if (shared->segments == &shared->local_segments) {
- lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
- (ulong) shared);
- return_error(gs_error_Fatal);
- }
- *ppath = *shared;
- rc_increment(ppath->segments);
+ if (shared->segments == &shared->local_segments) {
+ lprintf1("Attempt to share (local) segments of path 0x%lx!\n",
+ (ulong) shared);
+ return_error(gs_error_Fatal);
+ }
+ *ppath = *shared;
+ rc_increment(ppath->segments);
} else {
- rc_init_free(&ppath->local_segments, mem, 1,
- rc_free_path_segments_local);
- ppath->segments = &ppath->local_segments;
- gx_path_init_contents(ppath);
+ rc_init_free(&ppath->local_segments, mem, 1,
+ rc_free_path_segments_local);
+ ppath->segments = &ppath->local_segments;
+ gx_path_init_contents(ppath);
}
ppath->memory = mem;
ppath->allocation = path_allocated_on_stack;
@@ -249,7 +249,7 @@ gx_path_unshare(gx_path * ppath)
int code = 0;
if (gx_path_is_shared(ppath))
- code = path_alloc_copy(ppath);
+ code = path_alloc_copy(ppath);
return code;
}
@@ -265,7 +265,7 @@ gx_path_free(gx_path * ppath, client_name_t cname)
ppath->box_last = 0;
ppath->segments = 0; /* Nota bene */
if (ppath->allocation == path_allocated_on_heap)
- gs_free_object(ppath->memory, ppath, cname);
+ gs_free_object(ppath->memory, ppath, cname);
}
/*
@@ -284,27 +284,27 @@ gx_path_assign_preserve(gx_path * ppto, gx_path * ppfrom)
gx_path_allocation_t allocation = ppto->allocation;
if (fromsegs == &ppfrom->local_segments) {
- /* We can't use ppfrom's segments object. */
- if (tosegs == &ppto->local_segments || gx_path_is_shared(ppto)) {
- /* We can't use ppto's segments either. Allocate a new one. */
- int code = path_alloc_segments(&tosegs, ppto->memory,
- "gx_path_assign");
-
- if (code < 0)
- return code;
- rc_decrement(ppto->segments, "gx_path_assign");
- } else {
- /* Use ppto's segments object. */
- rc_free_path_segments_local(tosegs->rc.memory, tosegs,
- "gx_path_assign");
- }
- tosegs->contents = fromsegs->contents;
- ppfrom->segments = tosegs;
- rc_increment(tosegs); /* for reference from ppfrom */
+ /* We can't use ppfrom's segments object. */
+ if (tosegs == &ppto->local_segments || gx_path_is_shared(ppto)) {
+ /* We can't use ppto's segments either. Allocate a new one. */
+ int code = path_alloc_segments(&tosegs, ppto->memory,
+ "gx_path_assign");
+
+ if (code < 0)
+ return code;
+ rc_decrement(ppto->segments, "gx_path_assign");
+ } else {
+ /* Use ppto's segments object. */
+ rc_free_path_segments_local(tosegs->rc.memory, tosegs,
+ "gx_path_assign");
+ }
+ tosegs->contents = fromsegs->contents;
+ ppfrom->segments = tosegs;
+ rc_increment(tosegs); /* for reference from ppfrom */
} else {
- /* We can use ppfrom's segments object. */
- rc_increment(fromsegs);
- rc_decrement(tosegs, "gx_path_assign");
+ /* We can use ppfrom's segments object. */
+ rc_increment(fromsegs);
+ rc_decrement(tosegs, "gx_path_assign");
}
*ppto = *ppfrom;
ppto->memory = mem;
@@ -324,31 +324,31 @@ gx_path_assign_free(gx_path * ppto, gx_path * ppfrom)
* segments, since we can avoid allocating new segments in this case.
*/
if (ppto->segments == &ppto->local_segments &&
- ppfrom->segments == &ppfrom->local_segments &&
- !gx_path_is_shared(ppto)
- ) {
+ ppfrom->segments == &ppfrom->local_segments &&
+ !gx_path_is_shared(ppto)
+ ) {
#define fromsegs (&ppfrom->local_segments)
#define tosegs (&ppto->local_segments)
- gs_memory_t *mem = ppto->memory;
- gx_path_allocation_t allocation = ppto->allocation;
-
- rc_free_path_segments_local(tosegs->rc.memory, tosegs,
- "gx_path_assign_free");
- /* We record a bogus reference to fromsegs, which */
- /* gx_path_free will undo. */
- *ppto = *ppfrom;
- rc_increment(fromsegs);
- ppto->segments = tosegs;
- ppto->memory = mem;
- ppto->allocation = allocation;
+ gs_memory_t *mem = ppto->memory;
+ gx_path_allocation_t allocation = ppto->allocation;
+
+ rc_free_path_segments_local(tosegs->rc.memory, tosegs,
+ "gx_path_assign_free");
+ /* We record a bogus reference to fromsegs, which */
+ /* gx_path_free will undo. */
+ *ppto = *ppfrom;
+ rc_increment(fromsegs);
+ ppto->segments = tosegs;
+ ppto->memory = mem;
+ ppto->allocation = allocation;
#undef fromsegs
#undef tosegs
} else {
- /* In all other cases, just do assign + free. */
- int code = gx_path_assign_preserve(ppto, ppfrom);
+ /* In all other cases, just do assign + free. */
+ int code = gx_path_assign_preserve(ppto, ppfrom);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
gx_path_free(ppfrom, "gx_path_assign_free");
return 0;
@@ -362,21 +362,21 @@ gx_path_assign_free(gx_path * ppto, gx_path * ppfrom)
*/
static void
rc_free_path_segments_local(gs_memory_t * mem, void *vpsegs,
- client_name_t cname)
+ client_name_t cname)
{
gx_path_segments *psegs = (gx_path_segments *) vpsegs;
segment *pseg;
mem = gs_memory_stable(mem);
if (psegs->contents.subpath_first == 0)
- return; /* empty path */
+ return; /* empty path */
pseg = (segment *) psegs->contents.subpath_current->last;
while (pseg) {
- segment *prev = pseg->prev;
+ segment *prev = pseg->prev;
- trace_segment("[P]release", pseg);
- gs_free_object(mem, pseg, cname);
- pseg = prev;
+ trace_segment("[P]release", pseg);
+ gs_free_object(mem, pseg, cname);
+ pseg = prev;
}
}
static void
@@ -404,7 +404,7 @@ rc_free_path_segments(gs_memory_t * mem, void *vpsegs, client_name_t cname)
if ( !path_is_drawing(ppath) ) {\
int code_;\
if ( !path_position_valid(ppath) )\
- return_error(gs_error_nocurrentpoint);\
+ return_error(gs_error_nocurrentpoint);\
code_ = gx_path_new_subpath(ppath);\
if ( code_ < 0 ) return code_;\
}\
@@ -418,7 +418,7 @@ rc_free_path_segments(gs_memory_t * mem, void *vpsegs, client_name_t cname)
path_unshare(ppath);\
psub = ppath->current_subpath;\
if( !(pseg = gs_alloc_struct(gs_memory_stable(ppath->memory), ctype,\
- pstype, cname)) )\
+ pstype, cname)) )\
return_error(gs_error_VMerror);\
pseg->type = stype, pseg->notes = snotes, pseg->next = 0
#define path_alloc_link(pseg)\
@@ -435,14 +435,14 @@ gx_path_new(gx_path * ppath)
gx_path_segments *psegs = ppath->segments;
if (gx_path_is_shared(ppath)) {
- int code = path_alloc_segments(&ppath->segments, ppath->memory,
- "gx_path_new");
+ int code = path_alloc_segments(&ppath->segments, ppath->memory,
+ "gx_path_new");
- if (code < 0)
- return code;
- rc_decrement(psegs, "gx_path_new");
+ if (code < 0)
+ return code;
+ rc_decrement(psegs, "gx_path_new");
} else {
- rc_free_path_segments_local(psegs->rc.memory, psegs, "gx_path_new");
+ rc_free_path_segments_local(psegs->rc.memory, psegs, "gx_path_new");
}
gx_path_init_contents(ppath);
return 0;
@@ -457,19 +457,19 @@ gx_path_new_subpath(gx_path * ppath)
subpath *spp;
path_alloc_segment(spp, subpath, &st_subpath, s_start, sn_none,
- "gx_path_new_subpath");
+ "gx_path_new_subpath");
spp->last = (segment *) spp;
spp->curve_count = 0;
spp->is_closed = 0;
spp->pt = ppath->position;
if (!psub) { /* first subpath */
- ppath->first_subpath = spp;
- spp->prev = 0;
+ ppath->first_subpath = spp;
+ spp->prev = 0;
} else {
- segment *prev = psub->last;
+ segment *prev = psub->last;
- prev->next = (segment *) spp;
- spp->prev = prev;
+ prev->next = (segment *) spp;
+ spp->prev = prev;
}
ppath->current_subpath = spp;
ppath->subpath_count++;
@@ -481,18 +481,18 @@ static inline void
gz_path_bbox_add(gx_path * ppath, fixed x, fixed y)
{
if (!ppath->bbox_set) {
- ppath->bbox.p.x = ppath->bbox.q.x = x;
- ppath->bbox.p.y = ppath->bbox.q.y = y;
- ppath->bbox_set = 1;
+ ppath->bbox.p.x = ppath->bbox.q.x = x;
+ ppath->bbox.p.y = ppath->bbox.q.y = y;
+ ppath->bbox_set = 1;
} else {
- if (ppath->bbox.p.x > x)
- ppath->bbox.p.x = x;
- if (ppath->bbox.p.y > y)
- ppath->bbox.p.y = y;
- if (ppath->bbox.q.x < x)
- ppath->bbox.q.x = x;
- if (ppath->bbox.q.y < y)
- ppath->bbox.q.y = y;
+ if (ppath->bbox.p.x > x)
+ ppath->bbox.p.x = x;
+ if (ppath->bbox.p.y > y)
+ ppath->bbox.p.y = y;
+ if (ppath->bbox.q.x < x)
+ ppath->bbox.q.x = x;
+ if (ppath->bbox.q.y < y)
+ ppath->bbox.q.y = y;
}
}
@@ -515,7 +515,7 @@ static int
gz_path_add_point(gx_path * ppath, fixed x, fixed y)
{
if (ppath->bbox_set)
- check_in_bbox(ppath, x, y);
+ check_in_bbox(ppath, x, y);
ppath->position.x = x;
ppath->position.y = y;
path_update_moveto(ppath);
@@ -533,20 +533,20 @@ int
gx_path_add_relative_point(gx_path * ppath, fixed dx, fixed dy)
{
if (!path_position_in_range(ppath))
- return_error((path_position_valid(ppath) ? gs_error_limitcheck :
- gs_error_nocurrentpoint));
+ return_error((path_position_valid(ppath) ? gs_error_limitcheck :
+ gs_error_nocurrentpoint));
{
- fixed nx = ppath->position.x + dx, ny = ppath->position.y + dy;
-
- /* Check for overflow in addition. */
- if (((nx ^ dx) < 0 && (ppath->position.x ^ dx) >= 0) ||
- ((ny ^ dy) < 0 && (ppath->position.y ^ dy) >= 0)
- )
- return_error(gs_error_limitcheck);
- if (ppath->bbox_set)
- check_in_bbox(ppath, nx, ny);
- ppath->position.x = nx;
- ppath->position.y = ny;
+ fixed nx = ppath->position.x + dx, ny = ppath->position.y + dy;
+
+ /* Check for overflow in addition. */
+ if (((nx ^ dx) < 0 && (ppath->position.x ^ dx) >= 0) ||
+ ((ny ^ dy) < 0 && (ppath->position.y ^ dy) >= 0)
+ )
+ return_error(gs_error_limitcheck);
+ if (ppath->bbox_set)
+ check_in_bbox(ppath, nx, ny);
+ ppath->position.x = nx;
+ ppath->position.y = ny;
}
path_update_moveto(ppath);
return 0;
@@ -555,8 +555,8 @@ gx_path_add_relative_point(gx_path * ppath, fixed dx, fixed dy)
/* Set the segment point and the current point in the path. */
/* Assumes ppath points to the path. */
#define path_set_point(pseg, fx, fy)\
- (pseg)->pt.x = ppath->position.x = (fx),\
- (pseg)->pt.y = ppath->position.y = (fy)
+ (pseg)->pt.x = ppath->position.x = (fx),\
+ (pseg)->pt.y = ppath->position.y = (fy)
/* Add a line to the current path (lineto). */
int
@@ -571,10 +571,10 @@ gz_path_add_line_notes(gx_path * ppath, fixed x, fixed y, segment_notes notes)
line_segment *lp;
if (ppath->bbox_set)
- check_in_bbox(ppath, x, y);
+ check_in_bbox(ppath, x, y);
path_open();
path_alloc_segment(lp, line_segment, &st_line, s_line, notes,
- "gx_path_add_line");
+ "gx_path_add_line");
path_alloc_link(lp);
path_set_point(lp, x, y);
path_update_draw(ppath);
@@ -593,7 +593,7 @@ gz_path_bbox_add_line_notes(gx_path * ppath, fixed x, fixed y, segment_notes not
/* Note that all lines have the same notes. */
int
gx_path_add_lines_notes(gx_path *ppath, const gs_fixed_point *ppts, int count,
- segment_notes notes)
+ segment_notes notes)
{
subpath *psub;
segment *prev;
@@ -602,7 +602,7 @@ gx_path_add_lines_notes(gx_path *ppath, const gs_fixed_point *ppts, int count,
int code = 0;
if (count <= 0)
- return 0;
+ return 0;
path_unshare(ppath);
path_open();
psub = ppath->current_subpath;
@@ -614,37 +614,37 @@ gx_path_add_lines_notes(gx_path *ppath, const gs_fixed_point *ppts, int count,
* happen with multiple calls on gx_path_add_line.
*/
for (i = 0; i < count; i++) {
- fixed x = ppts[i].x;
- fixed y = ppts[i].y;
- line_segment *next;
-
- if (ppath->bbox_set && outside_bbox(ppath, x, y)) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- if (!(next = gs_alloc_struct(gs_memory_stable(ppath->memory),
- line_segment, &st_line,
- "gx_path_add_lines"))
- ) {
- code = gs_note_error(gs_error_VMerror);
- break;
- }
- lp = next;
- lp->type = s_line;
- lp->notes = notes;
- prev->next = (segment *) lp;
- lp->prev = prev;
- lp->pt.x = x;
- lp->pt.y = y;
- prev = (segment *) lp;
- trace_segment("[P]", (segment *) lp);
+ fixed x = ppts[i].x;
+ fixed y = ppts[i].y;
+ line_segment *next;
+
+ if (ppath->bbox_set && outside_bbox(ppath, x, y)) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ if (!(next = gs_alloc_struct(gs_memory_stable(ppath->memory),
+ line_segment, &st_line,
+ "gx_path_add_lines"))
+ ) {
+ code = gs_note_error(gs_error_VMerror);
+ break;
+ }
+ lp = next;
+ lp->type = s_line;
+ lp->notes = notes;
+ prev->next = (segment *) lp;
+ lp->prev = prev;
+ lp->pt.x = x;
+ lp->pt.y = y;
+ prev = (segment *) lp;
+ trace_segment("[P]", (segment *) lp);
}
if (lp != 0)
- ppath->position.x = lp->pt.x,
- ppath->position.y = lp->pt.y,
- psub->last = (segment *) lp,
- lp->next = 0,
- path_update_draw(ppath);
+ ppath->position.x = lp->pt.x,
+ ppath->position.y = lp->pt.y,
+ psub->last = (segment *) lp,
+ lp->next = 0,
+ path_update_draw(ppath);
return code;
}
@@ -657,10 +657,10 @@ gx_path_add_dash_notes(gx_path * ppath, fixed x, fixed y, fixed dx, fixed dy, se
dash_segment *lp;
if (ppath->bbox_set)
- check_in_bbox(ppath, x, y);
+ check_in_bbox(ppath, x, y);
path_open();
path_alloc_segment(lp, dash_segment, &st_dash, s_dash, notes,
- "gx_dash_add_dash");
+ "gx_dash_add_dash");
path_alloc_link(lp);
path_set_point(lp, x, y);
lp->tangent.x = dx;
@@ -683,37 +683,37 @@ gx_path_add_rectangle(gx_path * ppath, fixed x0, fixed y0, fixed x1, fixed y1)
pts[2].y = y0;
pts[0].y = pts[1].y = y1;
if ((code = gx_path_add_point(ppath, x0, y0)) < 0 ||
- (code = gx_path_add_lines(ppath, pts, 3)) < 0 ||
- (code = gx_path_close_subpath(ppath)) < 0
- )
- return code;
+ (code = gx_path_add_lines(ppath, pts, 3)) < 0 ||
+ (code = gx_path_close_subpath(ppath)) < 0
+ )
+ return code;
return 0;
}
/* Add a curve to the current path (curveto). */
int
gx_path_add_curve_notes(gx_path * ppath,
- fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
- segment_notes notes)
+ fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
+ segment_notes notes)
{
return ppath->procs->add_curve(ppath, x1, y1, x2, y2, x3, y3, notes);
}
static int
gz_path_add_curve_notes(gx_path * ppath,
- fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
- segment_notes notes)
+ fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
+ segment_notes notes)
{
subpath *psub;
curve_segment *lp;
if (ppath->bbox_set) {
- check_in_bbox(ppath, x1, y1);
- check_in_bbox(ppath, x2, y2);
- check_in_bbox(ppath, x3, y3);
+ check_in_bbox(ppath, x1, y1);
+ check_in_bbox(ppath, x2, y2);
+ check_in_bbox(ppath, x3, y3);
}
path_open();
path_alloc_segment(lp, curve_segment, &st_curve, s_curve, notes,
- "gx_path_add_curve");
+ "gx_path_add_curve");
path_alloc_link(lp);
lp->p1.x = x1;
lp->p1.y = y1;
@@ -728,8 +728,8 @@ gz_path_add_curve_notes(gx_path * ppath,
}
static int
gz_path_bbox_add_curve_notes(gx_path * ppath,
- fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
- segment_notes notes)
+ fixed x1, fixed y1, fixed x2, fixed y2, fixed x3, fixed y3,
+ segment_notes notes)
{
gz_path_bbox_add(ppath, x1, y1);
gz_path_bbox_add(ppath, x2, y2);
@@ -764,16 +764,16 @@ fixed x3, fixed y3, fixed xt, fixed yt, floatp fraction, segment_notes notes)
fixed x0 = ppath->position.x, y0 = ppath->position.y;
vd_curveto(x0 + (fixed) ((xt - x0) * fraction),
- y0 + (fixed) ((yt - y0) * fraction),
- x3 + (fixed) ((xt - x3) * fraction),
- y3 + (fixed) ((yt - y3) * fraction),
- x3, y3);
+ y0 + (fixed) ((yt - y0) * fraction),
+ x3 + (fixed) ((xt - x3) * fraction),
+ y3 + (fixed) ((yt - y3) * fraction),
+ x3, y3);
return gx_path_add_curve_notes(ppath,
- x0 + (fixed) ((xt - x0) * fraction),
- y0 + (fixed) ((yt - y0) * fraction),
- x3 + (fixed) ((xt - x3) * fraction),
- y3 + (fixed) ((yt - y3) * fraction),
- x3, y3, notes | sn_from_arc);
+ x0 + (fixed) ((xt - x0) * fraction),
+ y0 + (fixed) ((yt - y0) * fraction),
+ x3 + (fixed) ((xt - x3) * fraction),
+ y3 + (fixed) ((yt - y3) * fraction),
+ x3, y3, notes | sn_from_arc);
}
/* Append a path to another path, and reset the first path. */
@@ -785,18 +785,18 @@ gx_path_add_path(gx_path * ppath, gx_path * ppfrom)
path_unshare(ppfrom);
path_unshare(ppath);
if (ppfrom->first_subpath) { /* i.e. ppfrom not empty */
- if (ppath->first_subpath) { /* i.e. ppath not empty */
- subpath *psub = ppath->current_subpath;
- segment *pseg = psub->last;
- subpath *pfsub = ppfrom->first_subpath;
-
- pseg->next = (segment *) pfsub;
- pfsub->prev = pseg;
- } else
- ppath->first_subpath = ppfrom->first_subpath;
- ppath->current_subpath = ppfrom->current_subpath;
- ppath->subpath_count += ppfrom->subpath_count;
- ppath->curve_count += ppfrom->curve_count;
+ if (ppath->first_subpath) { /* i.e. ppath not empty */
+ subpath *psub = ppath->current_subpath;
+ segment *pseg = psub->last;
+ subpath *pfsub = ppfrom->first_subpath;
+
+ pseg->next = (segment *) pfsub;
+ pfsub->prev = pseg;
+ } else
+ ppath->first_subpath = ppfrom->first_subpath;
+ ppath->current_subpath = ppfrom->current_subpath;
+ ppath->subpath_count += ppfrom->subpath_count;
+ ppath->curve_count += ppfrom->curve_count;
}
/* Transfer the remaining state. */
ppath->position = ppfrom->position;
@@ -811,40 +811,40 @@ gx_path_add_path(gx_path * ppath, gx_path * ppfrom)
/* relatives. */
int
gx_path_add_char_path(gx_path * to_path, gx_path * from_path,
- gs_char_path_mode mode)
+ gs_char_path_mode mode)
{
int code;
gs_fixed_rect bbox;
switch (mode) {
- default: /* shouldn't happen! */
- gx_path_new(from_path);
- return 0;
- case cpm_charwidth: {
- gs_fixed_point cpt;
-
- code = gx_path_current_point(from_path, &cpt);
- if (code < 0)
- break;
- return gx_path_add_point(to_path, cpt.x, cpt.y);
- }
- case cpm_true_charpath:
- case cpm_false_charpath:
- return gx_path_add_path(to_path, from_path);
- case cpm_true_charboxpath:
- gx_path_bbox(from_path, &bbox);
- code = gx_path_add_rectangle(to_path, bbox.p.x, bbox.p.y,
- bbox.q.x, bbox.q.y);
- break;
- case cpm_false_charboxpath:
- gx_path_bbox(from_path, &bbox);
- code = gx_path_add_point(to_path, bbox.p.x, bbox.p.y);
- if (code >= 0)
- code = gx_path_add_line(to_path, bbox.q.x, bbox.q.y);
- break;
+ default: /* shouldn't happen! */
+ gx_path_new(from_path);
+ return 0;
+ case cpm_charwidth: {
+ gs_fixed_point cpt;
+
+ code = gx_path_current_point(from_path, &cpt);
+ if (code < 0)
+ break;
+ return gx_path_add_point(to_path, cpt.x, cpt.y);
+ }
+ case cpm_true_charpath:
+ case cpm_false_charpath:
+ return gx_path_add_path(to_path, from_path);
+ case cpm_true_charboxpath:
+ gx_path_bbox(from_path, &bbox);
+ code = gx_path_add_rectangle(to_path, bbox.p.x, bbox.p.y,
+ bbox.q.x, bbox.q.y);
+ break;
+ case cpm_false_charboxpath:
+ gx_path_bbox(from_path, &bbox);
+ code = gx_path_add_point(to_path, bbox.p.x, bbox.p.y);
+ if (code >= 0)
+ code = gx_path_add_line(to_path, bbox.q.x, bbox.q.y);
+ break;
}
if (code < 0)
- return code;
+ return code;
gx_path_new(from_path);
return 0;
}
@@ -863,15 +863,15 @@ gz_path_close_subpath_notes(gx_path * ppath, segment_notes notes)
int code;
if (!path_subpath_open(ppath))
- return 0;
+ return 0;
if (path_last_is_moveto(ppath)) {
- /* The last operation was a moveto: create a subpath. */
- code = gx_path_new_subpath(ppath);
- if (code < 0)
- return code;
+ /* The last operation was a moveto: create a subpath. */
+ code = gx_path_new_subpath(ppath);
+ if (code < 0)
+ return code;
}
path_alloc_segment(lp, line_close_segment, &st_line_close,
- s_line_close, notes, "gx_path_close_subpath");
+ s_line_close, notes, "gx_path_close_subpath");
path_alloc_link(lp);
path_set_point(lp, psub->pt.x, psub->pt.y);
lp->sub = psub;
@@ -887,21 +887,21 @@ gz_path_bbox_close_subpath_notes(gx_path * ppath, segment_notes notes)
}
/* Access path state flags */
-byte
+byte
gz_path_state_flags(gx_path *ppath, byte flags)
{
byte flags_old = ppath->state_flags;
ppath->state_flags = flags;
return flags_old;
}
-byte
+byte
gx_path_get_state_flags(gx_path *ppath)
{
byte flags = ppath->procs->state_flags(ppath, 0);
ppath->procs->state_flags(ppath, flags);
return flags;
}
-void
+void
gx_path_set_state_flags(gx_path *ppath, byte flags)
{
ppath->procs->state_flags(ppath, flags);
@@ -912,8 +912,6 @@ gx_path_is_drawing(gx_path *ppath)
return path_is_drawing(ppath);
}
-
-
/* Remove the last line from the current subpath, and then close it. */
/* The Type 1 font hinting routines use this if a path ends with */
/* a line to the start followed by a closepath. */
@@ -925,9 +923,9 @@ gx_path_pop_close_notes(gx_path * ppath, segment_notes notes)
segment *prev;
if (psub == 0 || (pseg = psub->last) == 0 ||
- pseg->type != s_line
- )
- return_error(gs_error_unknownerror);
+ pseg->type != s_line
+ )
+ return_error(gs_error_unknownerror);
prev = pseg->prev;
prev->next = 0;
psub->last = prev;
@@ -949,8 +947,8 @@ path_alloc_copy(gx_path * ppath)
gx_path_init_local(&path_new, ppath->memory);
code = gx_path_copy(ppath, &path_new);
if (code < 0) {
- gx_path_free(&path_new, "path_alloc_copy error");
- return code;
+ gx_path_free(&path_new, "path_alloc_copy error");
+ return code;
}
ppath->last_charpath_segment = 0;
return gx_path_assign_free(ppath, &path_new);
@@ -975,21 +973,21 @@ gx_path_print(const gx_path * ppath)
const segment *pseg = (const segment *)ppath->first_subpath;
dlprintf5(" state_flags=%d subpaths=%d, curves=%d, point=(%f,%f)\n",
- ppath->state_flags, ppath->subpath_count, ppath->curve_count,
- fixed2float(ppath->position.x),
- fixed2float(ppath->position.y));
+ ppath->state_flags, ppath->subpath_count, ppath->curve_count,
+ fixed2float(ppath->position.x),
+ fixed2float(ppath->position.y));
dlprintf5(" box=(%f,%f),(%f,%f) last=0x%lx\n",
- fixed2float(ppath->bbox.p.x), fixed2float(ppath->bbox.p.y),
- fixed2float(ppath->bbox.q.x), fixed2float(ppath->bbox.q.y),
- (ulong) ppath->box_last);
+ fixed2float(ppath->bbox.p.x), fixed2float(ppath->bbox.p.y),
+ fixed2float(ppath->bbox.q.x), fixed2float(ppath->bbox.q.y),
+ (ulong) ppath->box_last);
dlprintf4(" segments=0x%lx (refct=%ld, first=0x%lx, current=0x%lx)\n",
- (ulong) ppath->segments, (long)ppath->segments->rc.ref_count,
- (ulong) ppath->segments->contents.subpath_first,
- (ulong) ppath->segments->contents.subpath_current);
+ (ulong) ppath->segments, (long)ppath->segments->rc.ref_count,
+ (ulong) ppath->segments->contents.subpath_first,
+ (ulong) ppath->segments->contents.subpath_current);
while (pseg) {
- dlputs("");
- gx_print_segment(pseg);
- pseg = pseg->next;
+ dlputs("");
+ gx_print_segment(pseg);
+ pseg = pseg->next;
}
}
static void
@@ -1000,44 +998,44 @@ gx_print_segment(const segment * pseg)
char out[80];
sprintf(out, " 0x%lx<0x%lx,0x%lx>:%u",
- (ulong) pseg, (ulong) pseg->prev, (ulong) pseg->next, pseg->notes);
+ (ulong) pseg, (ulong) pseg->prev, (ulong) pseg->next, pseg->notes);
switch (pseg->type) {
- case s_start:{
- const subpath *const psub = (const subpath *)pseg;
-
- dprintf5("%s: %1.4f %1.4f moveto\t%% #curves=%d last=0x%lx\n",
- out, px, py, psub->curve_count, (ulong) psub->last);
- break;
- }
- case s_curve:{
- const curve_segment *const pcur = (const curve_segment *)pseg;
-
- dprintf7("%s: %1.4f %1.4f %1.4f %1.4f %1.4f %1.4f curveto\n",
- out, fixed2float(pcur->p1.x), fixed2float(pcur->p1.y),
- fixed2float(pcur->p2.x), fixed2float(pcur->p2.y), px, py);
- break;
- }
- case s_line:
- dprintf3("%s: %1.4f %1.4f lineto\n", out, px, py);
- break;
- case s_dash:{
- const dash_segment *const pd = (const dash_segment *)pseg;
-
- dprintf5("%s: %1.4f %1.4f %1.4f %1.4f dash\n", out,
- fixed2float(pd->pt.x), fixed2float(pd->pt.y),
- fixed2float(pd->tangent.x), fixed2float(pd->tangent.y));
- break;
- }
- case s_line_close:{
- const line_close_segment *const plc =
- (const line_close_segment *)pseg;
-
- dprintf4("%s: closepath\t%% %1.4f %1.4f 0x%lx\n",
- out, px, py, (ulong) (plc->sub));
- break;
- }
- default:
- dprintf4("%s: %1.4f %1.4f <type 0x%x>\n", out, px, py, pseg->type);
+ case s_start:{
+ const subpath *const psub = (const subpath *)pseg;
+
+ dprintf5("%s: %1.4f %1.4f moveto\t%% #curves=%d last=0x%lx\n",
+ out, px, py, psub->curve_count, (ulong) psub->last);
+ break;
+ }
+ case s_curve:{
+ const curve_segment *const pcur = (const curve_segment *)pseg;
+
+ dprintf7("%s: %1.4f %1.4f %1.4f %1.4f %1.4f %1.4f curveto\n",
+ out, fixed2float(pcur->p1.x), fixed2float(pcur->p1.y),
+ fixed2float(pcur->p2.x), fixed2float(pcur->p2.y), px, py);
+ break;
+ }
+ case s_line:
+ dprintf3("%s: %1.4f %1.4f lineto\n", out, px, py);
+ break;
+ case s_dash:{
+ const dash_segment *const pd = (const dash_segment *)pseg;
+
+ dprintf5("%s: %1.4f %1.4f %1.4f %1.4f dash\n", out,
+ fixed2float(pd->pt.x), fixed2float(pd->pt.y),
+ fixed2float(pd->tangent.x), fixed2float(pd->tangent.y));
+ break;
+ }
+ case s_line_close:{
+ const line_close_segment *const plc =
+ (const line_close_segment *)pseg;
+
+ dprintf4("%s: closepath\t%% %1.4f %1.4f 0x%lx\n",
+ out, px, py, (ulong) (plc->sub));
+ break;
+ }
+ default:
+ dprintf4("%s: %1.4f %1.4f <type 0x%x>\n", out, px, py, pseg->type);
}
}
diff --git a/gs/base/gxpath.h b/gs/base/gxpath.h
index b0797ce1b..e4985611d 100644
--- a/gs/base/gxpath.h
+++ b/gs/base/gxpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -74,7 +74,7 @@ void gx_path_print(const gx_path *);
* segments.
*/
gx_path *gx_path_alloc_shared(const gx_path * shared, gs_memory_t * mem,
- client_name_t cname);
+ client_name_t cname);
#define gx_path_alloc(mem, cname)\
gx_path_alloc_shared(NULL, mem, cname)
@@ -83,7 +83,7 @@ gx_path *gx_path_alloc_shared(const gx_path * shared, gs_memory_t * mem,
* optionally allocating its segments.
*/
int gx_path_init_contained_shared(gx_path * ppath, const gx_path * shared,
- gs_memory_t * mem, client_name_t cname);
+ gs_memory_t * mem, client_name_t cname);
#define gx_path_alloc_contained(ppath, mem, cname)\
gx_path_init_contained_shared(ppath, NULL, mem, cname)
@@ -93,7 +93,7 @@ int gx_path_init_contained_shared(gx_path * ppath, const gx_path * shared,
* asked to share the segments of another local path.
*/
int gx_path_init_local_shared(gx_path * ppath, const gx_path * shared,
- gs_memory_t * mem);
+ gs_memory_t * mem);
#define gx_path_init_local(ppath, mem)\
(void)gx_path_init_local_shared(ppath, NULL, mem) /* can't fail */
@@ -149,8 +149,8 @@ int gx_path_new(gx_path *),
gx_path_add_partial_arc_notes(gx_path *, fixed, fixed, fixed, fixed, floatp, segment_notes),
gx_path_add_path(gx_path *, gx_path *),
gx_path_close_subpath_notes(gx_path *, segment_notes),
- /* We have to remove the 'subpath' from the following name */
- /* to keep it unique in the first 23 characters. */
+ /* We have to remove the 'subpath' from the following name */
+ /* to keep it unique in the first 23 characters. */
gx_path_pop_close_notes(gx_path *, segment_notes);
/* Access path state flags */
@@ -224,8 +224,8 @@ gx_path_is_rectangular(const gx_path *, gs_fixed_rect *);
typedef struct gs_imager_state_s gs_imager_state;
#endif
int gx_path_copy_reducing(const gx_path * ppath_old, gx_path * ppath_new,
- fixed fixed_flatness, const gs_imager_state *pis,
- gx_path_copy_options options);
+ fixed fixed_flatness, const gs_imager_state *pis,
+ gx_path_copy_options options);
#define gx_path_copy(old, new)\
gx_path_copy_reducing(old, new, max_fixed, NULL, pco_none)
@@ -233,20 +233,20 @@ int gx_path_copy_reducing(const gx_path * ppath_old, gx_path * ppath_new,
gx_path_copy_reducing(old, new, float2fixed(flatness), NULL, pco_none)
#define gx_path_add_flattened_accurate(old, new, flatness, accurate)\
gx_path_copy_reducing(old, new, float2fixed(flatness), NULL,\
- (accurate ? pco_accurate : pco_none))
+ (accurate ? pco_accurate : pco_none))
#define gx_path_add_flattened_for_stroke(old, new, flatness, pis)\
gx_path_copy_reducing(old, new, float2fixed(flatness), pis,\
- (pis->accurate_curves ?\
- pco_accurate | pco_for_stroke : pco_for_stroke))
+ (pis->accurate_curves ?\
+ pco_accurate | pco_for_stroke : pco_for_stroke))
#define gx_path_add_monotonized(old, new)\
gx_path_copy_reducing(old, new, max_fixed, NULL, pco_monotonize)
int gx_path_add_dash_expansion(const gx_path * /*old*/, gx_path * /*new*/,
- const gs_imager_state *),
+ const gs_imager_state *),
gx_path_copy_reversed(const gx_path * /*old*/, gx_path * /*new*/),
gx_path_append_reversed(const gx_path * /*orig*/, gx_path * /*rev*/),
gx_path_translate(gx_path *, fixed, fixed),
gx_path_scale_exp2_shared(gx_path *ppath, int log2_scale_x,
- int log2_scale_y, bool segments_shared);
+ int log2_scale_y, bool segments_shared);
void gx_point_scale_exp2(gs_fixed_point *, int, int),
gx_rect_scale_exp2(gs_fixed_rect *, int, int);
@@ -295,7 +295,6 @@ typedef struct gx_clip_list_s gx_clip_list;
typedef struct gx_fill_params_s gx_fill_params;
#endif
-
/* Opaque type for a clipping path enumerator. */
typedef struct gs_cpath_enum_s gs_cpath_enum;
@@ -304,20 +303,20 @@ typedef struct gs_cpath_enum_s gs_cpath_enum;
* paths (see above for details).
*/
gx_clip_path *gx_cpath_alloc_shared(const gx_clip_path * shared,
- gs_memory_t * mem, client_name_t cname);
+ gs_memory_t * mem, client_name_t cname);
#define gx_cpath_alloc(mem, cname)\
gx_cpath_alloc_shared(NULL, mem, cname)
int gx_cpath_init_contained_shared(gx_clip_path * pcpath,
- const gx_clip_path * shared,
- gs_memory_t * mem,
- client_name_t cname);
+ const gx_clip_path * shared,
+ gs_memory_t * mem,
+ client_name_t cname);
#define gx_cpath_alloc_contained(pcpath, mem, cname)\
gx_cpath_init_contained_shared(pcpath, NULL, mem, cname)
int gx_cpath_init_local_shared(gx_clip_path * pcpath,
- const gx_clip_path * shared,
- gs_memory_t * mem);
+ const gx_clip_path * shared,
+ gs_memory_t * mem);
#define gx_cpath_init_local(pcpath, mem)\
(void)gx_cpath_init_local_shared(pcpath, NULL, mem) /* can't fail */
@@ -333,19 +332,19 @@ int
gx_cpath_from_rectangle(gx_clip_path *, gs_fixed_rect *),
gx_cpath_clip(gs_state *, gx_clip_path *, /*const*/ gx_path *, int),
gx_cpath_intersect(gx_clip_path *, /*const*/ gx_path *, int,
- gs_imager_state *),
+ gs_imager_state *),
gx_cpath_intersect_with_params(gx_clip_path *pcpath, /*const*/ gx_path *ppath_orig,
- int rule, gs_imager_state *pis, const gx_fill_params * params),
+ int rule, gs_imager_state *pis, const gx_fill_params * params),
gx_cpath_scale_exp2_shared(gx_clip_path *pcpath, int log2_scale_x,
- int log2_scale_y, bool list_shared,
- bool segments_shared),
+ int log2_scale_y, bool list_shared,
+ bool segments_shared),
gx_cpath_to_path(gx_clip_path *, gx_path *),
gx_cpath_to_path_synthesize(const gx_clip_path * pcpath, gx_path * ppath);
bool
gx_cpath_inner_box(const gx_clip_path *, gs_fixed_rect *),
gx_cpath_outer_box(const gx_clip_path *, gs_fixed_rect *),
gx_cpath_includes_rectangle(const gx_clip_path *, fixed, fixed,
- fixed, fixed);
+ fixed, fixed);
const gs_fixed_rect *cpath_is_rectangle(const gx_clip_path * pcpath);
bool gx_cpath_rect_visible(gx_clip_path * pcpath, gs_int_rect *prect);
int gx_cpath_copy(const gx_clip_path * from, gx_clip_path * pcpath);
@@ -362,5 +361,4 @@ gx_cpath_enum_notes(const gs_cpath_enum *);
void gx_cpath_print(const gx_clip_path *);
#endif
-
#endif /* gxpath_INCLUDED */
diff --git a/gs/base/gxpath2.c b/gs/base/gxpath2.c
index e3084502f..01caed385 100644
--- a/gs/base/gxpath2.c
+++ b/gs/base/gxpath2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ int
gx_path_current_point(const gx_path * ppath, gs_fixed_point * ppt)
{
if (!path_position_valid(ppath))
- return_error(gs_error_nocurrentpoint);
+ return_error(gs_error_nocurrentpoint);
/* Copying the coordinates individually */
/* is much faster on a PC, and almost as fast on other machines.... */
ppt->x = ppath->position.x, ppt->y = ppath->position.y;
@@ -44,7 +44,7 @@ gx_path_subpath_start_point(const gx_path * ppath, gs_fixed_point * ppt)
const subpath *psub = ppath->current_subpath;
if (!psub)
- return_error(gs_error_nocurrentpoint);
+ return_error(gs_error_nocurrentpoint);
*ppt = psub->pt;
return 0;
}
@@ -57,41 +57,41 @@ int
gx_path_bbox(gx_path * ppath, gs_fixed_rect * pbox)
{
if (ppath->bbox_accurate) {
- /* The bounding box was set by setbbox. */
- *pbox = ppath->bbox;
- return 0;
+ /* The bounding box was set by setbbox. */
+ *pbox = ppath->bbox;
+ return 0;
}
if (ppath->first_subpath == 0) {
- /* The path is empty, use the current point if any. */
- int code = gx_path_current_point(ppath, &pbox->p);
-
- if (code < 0) {
- /*
- * Don't return garbage, in case the caller doesn't
- * check the return code.
- */
- pbox->p.x = pbox->p.y = 0;
- }
- pbox->q = pbox->p;
- return code;
+ /* The path is empty, use the current point if any. */
+ int code = gx_path_current_point(ppath, &pbox->p);
+
+ if (code < 0) {
+ /*
+ * Don't return garbage, in case the caller doesn't
+ * check the return code.
+ */
+ pbox->p.x = pbox->p.y = 0;
+ }
+ pbox->q = pbox->p;
+ return code;
}
/* The stored bounding box may not be up to date. */
/* Correct it now if necessary. */
if (ppath->box_last == ppath->current_subpath->last) {
- /* Box is up to date */
- *pbox = ppath->bbox;
+ /* Box is up to date */
+ *pbox = ppath->bbox;
} else {
- fixed px, py, qx, qy;
- const segment *pseg = ppath->box_last;
-
- if (pseg == 0) { /* box is uninitialized */
- pseg = (const segment *)ppath->first_subpath;
- px = qx = pseg->pt.x;
- py = qy = pseg->pt.y;
- } else {
- px = ppath->bbox.p.x, py = ppath->bbox.p.y;
- qx = ppath->bbox.q.x, qy = ppath->bbox.q.y;
- }
+ fixed px, py, qx, qy;
+ const segment *pseg = ppath->box_last;
+
+ if (pseg == 0) { /* box is uninitialized */
+ pseg = (const segment *)ppath->first_subpath;
+ px = qx = pseg->pt.x;
+ py = qy = pseg->pt.y;
+ } else {
+ px = ppath->bbox.p.x, py = ppath->bbox.p.y;
+ qx = ppath->bbox.q.x, qy = ppath->bbox.q.y;
+ }
/* Macro for adjusting the bounding box when adding a point */
#define ADJUST_BBOX(pt)\
@@ -100,25 +100,25 @@ gx_path_bbox(gx_path * ppath, gs_fixed_rect * pbox)
if ((pt).y < py) py = (pt).y;\
else if ((pt).y > qy) qy = (pt).y
- while ((pseg = pseg->next) != 0) {
- switch (pseg->type) {
- case s_curve:
- ADJUST_BBOX(((const curve_segment *)pseg)->p1);
- ADJUST_BBOX(((const curve_segment *)pseg)->p2);
- /* falls through */
- default:
- ADJUST_BBOX(pseg->pt);
- }
- }
+ while ((pseg = pseg->next) != 0) {
+ switch (pseg->type) {
+ case s_curve:
+ ADJUST_BBOX(((const curve_segment *)pseg)->p1);
+ ADJUST_BBOX(((const curve_segment *)pseg)->p2);
+ /* falls through */
+ default:
+ ADJUST_BBOX(pseg->pt);
+ }
+ }
#undef ADJUST_BBOX
#define STORE_BBOX(b)\
(b).p.x = px, (b).p.y = py, (b).q.x = qx, (b).q.y = qy;
- STORE_BBOX(*pbox);
- STORE_BBOX(ppath->bbox);
+ STORE_BBOX(*pbox);
+ STORE_BBOX(ppath->bbox);
#undef STORE_BBOX
- ppath->box_last = ppath->current_subpath->last;
+ ppath->box_last = ppath->current_subpath->last;
}
return 0;
}
@@ -128,14 +128,13 @@ int
gx_path_bbox_set(gx_path * ppath, gs_fixed_rect * pbox)
{
if (ppath->bbox_set) {
- /* The bounding box was set by setbbox. */
- *pbox = ppath->bbox;
- return 0;
+ /* The bounding box was set by setbbox. */
+ *pbox = ppath->bbox;
+ return 0;
} else
- return gx_path_bbox(ppath, pbox);
+ return gx_path_bbox(ppath, pbox);
}
-
/* Test if a path has any curves. */
#undef gx_path_has_curves
bool
@@ -175,53 +174,53 @@ gx_path_is_null(const gx_path * ppath)
*/
gx_path_rectangular_type
gx_subpath_is_rectangular(const subpath * pseg0, gs_fixed_rect * pbox,
- const subpath ** ppnext)
+ const subpath ** ppnext)
{
const segment *pseg1, *pseg2, *pseg3, *pseg4;
gx_path_rectangular_type type;
if (pseg0->curve_count == 0 &&
- (pseg1 = pseg0->next) != 0 &&
- (pseg2 = pseg1->next) != 0 &&
- (pseg3 = pseg2->next) != 0
- ) {
- if ((pseg4 = pseg3->next) == 0 || pseg4->type == s_start)
- type = prt_open; /* M, L, L, L */
- else if (pseg4->type != s_line) /* must be s_line_close */
- type = prt_closed; /* M, L, L, L, C */
- else if (pseg4->pt.x != pseg0->pt.x ||
- pseg4->pt.y != pseg0->pt.y
- )
- return prt_none;
- else if (pseg4->next == 0 || pseg4->next->type == s_start)
- type = prt_fake_closed; /* Mo, L, L, L, Lo */
- else if (pseg4->next->type != s_line) /* must be s_line_close */
- type = prt_closed; /* Mo, L, L, L, Lo, C */
- else
- return prt_none;
- {
- fixed x0 = pseg0->pt.x, y0 = pseg0->pt.y;
- fixed x2 = pseg2->pt.x, y2 = pseg2->pt.y;
-
- if ((x0 == pseg1->pt.x && pseg1->pt.y == y2 &&
- x2 == pseg3->pt.x && pseg3->pt.y == y0) ||
- (x0 == pseg3->pt.x && pseg3->pt.y == y2 &&
- x2 == pseg1->pt.x && pseg1->pt.y == y0)
- ) { /* Path is a rectangle. Return the bounding box. */
- if (x0 < x2)
- pbox->p.x = x0, pbox->q.x = x2;
- else
- pbox->p.x = x2, pbox->q.x = x0;
- if (y0 < y2)
- pbox->p.y = y0, pbox->q.y = y2;
- else
- pbox->p.y = y2, pbox->q.y = y0;
- while (pseg4 != 0 && pseg4->type != s_start)
- pseg4 = pseg4->next;
- *ppnext = (const subpath *)pseg4;
- return type;
- }
- }
+ (pseg1 = pseg0->next) != 0 &&
+ (pseg2 = pseg1->next) != 0 &&
+ (pseg3 = pseg2->next) != 0
+ ) {
+ if ((pseg4 = pseg3->next) == 0 || pseg4->type == s_start)
+ type = prt_open; /* M, L, L, L */
+ else if (pseg4->type != s_line) /* must be s_line_close */
+ type = prt_closed; /* M, L, L, L, C */
+ else if (pseg4->pt.x != pseg0->pt.x ||
+ pseg4->pt.y != pseg0->pt.y
+ )
+ return prt_none;
+ else if (pseg4->next == 0 || pseg4->next->type == s_start)
+ type = prt_fake_closed; /* Mo, L, L, L, Lo */
+ else if (pseg4->next->type != s_line) /* must be s_line_close */
+ type = prt_closed; /* Mo, L, L, L, Lo, C */
+ else
+ return prt_none;
+ {
+ fixed x0 = pseg0->pt.x, y0 = pseg0->pt.y;
+ fixed x2 = pseg2->pt.x, y2 = pseg2->pt.y;
+
+ if ((x0 == pseg1->pt.x && pseg1->pt.y == y2 &&
+ x2 == pseg3->pt.x && pseg3->pt.y == y0) ||
+ (x0 == pseg3->pt.x && pseg3->pt.y == y2 &&
+ x2 == pseg1->pt.x && pseg1->pt.y == y0)
+ ) { /* Path is a rectangle. Return the bounding box. */
+ if (x0 < x2)
+ pbox->p.x = x0, pbox->q.x = x2;
+ else
+ pbox->p.x = x2, pbox->q.x = x0;
+ if (y0 < y2)
+ pbox->p.y = y0, pbox->q.y = y2;
+ else
+ pbox->p.y = y2, pbox->q.y = y0;
+ while (pseg4 != 0 && pseg4->type != s_start)
+ pseg4 = pseg4->next;
+ *ppnext = (const subpath *)pseg4;
+ return type;
+ }
+ }
}
return prt_none;
}
@@ -232,9 +231,9 @@ gx_path_is_rectangular(const gx_path * ppath, gs_fixed_rect * pbox)
const subpath *pnext;
return
- (gx_path_subpath_count(ppath) == 1 ?
- gx_subpath_is_rectangular(ppath->first_subpath, pbox, &pnext) :
- prt_none);
+ (gx_path_subpath_count(ppath) == 1 ?
+ gx_subpath_is_rectangular(ppath->first_subpath, pbox, &pnext) :
+ prt_none);
}
/* Translate an already-constructed path (in device space). */
@@ -247,23 +246,23 @@ gx_path_translate(gx_path * ppath, fixed dx, fixed dy)
#define update_xy(pt)\
pt.x += dx, pt.y += dy
if (ppath->box_last != 0) {
- update_xy(ppath->bbox.p);
- update_xy(ppath->bbox.q);
+ update_xy(ppath->bbox.p);
+ update_xy(ppath->bbox.q);
}
if (path_position_valid(ppath))
- update_xy(ppath->position);
+ update_xy(ppath->position);
for (pseg = (segment *) (ppath->first_subpath); pseg != 0;
- pseg = pseg->next
- )
- switch (pseg->type) {
- case s_curve:
+ pseg = pseg->next
+ )
+ switch (pseg->type) {
+ case s_curve:
#define pcseg ((curve_segment *)pseg)
- update_xy(pcseg->p1);
- update_xy(pcseg->p2);
+ update_xy(pcseg->p1);
+ update_xy(pcseg->p2);
#undef pcseg
- default:
- update_xy(pseg->pt);
- }
+ default:
+ update_xy(pseg->pt);
+ }
#undef update_xy
return 0;
}
@@ -286,7 +285,7 @@ gx_point_scale_exp2(gs_fixed_point * pt, int sx, int sy)
pt->x = -v;
pt->x <<= sx;
} else
- pt->x >>= -sx;
+ pt->x >>= -sx;
if (sy > 0) {
v = (max_int - int2fixed(1000)) >> sy;
@@ -296,7 +295,7 @@ gx_point_scale_exp2(gs_fixed_point * pt, int sx, int sy)
pt->y = -v;
pt->y <<= sy;
} else
- pt->y >>= -sy;
+ pt->y >>= -sy;
}
void
gx_rect_scale_exp2(gs_fixed_rect * pr, int sx, int sy)
@@ -306,7 +305,7 @@ gx_rect_scale_exp2(gs_fixed_rect * pr, int sx, int sy)
}
int
gx_path_scale_exp2_shared(gx_path * ppath, int log2_scale_x, int log2_scale_y,
- bool segments_shared)
+ bool segments_shared)
{
segment *pseg;
@@ -314,16 +313,16 @@ gx_path_scale_exp2_shared(gx_path * ppath, int log2_scale_x, int log2_scale_y,
#define SCALE_XY(pt) gx_point_scale_exp2(&pt, log2_scale_x, log2_scale_y)
SCALE_XY(ppath->position);
if (!segments_shared) {
- for (pseg = (segment *) (ppath->first_subpath); pseg != 0;
- pseg = pseg->next
- )
- switch (pseg->type) {
- case s_curve:
- SCALE_XY(((curve_segment *)pseg)->p1);
- SCALE_XY(((curve_segment *)pseg)->p2);
- default:
- SCALE_XY(pseg->pt);
- }
+ for (pseg = (segment *) (ppath->first_subpath); pseg != 0;
+ pseg = pseg->next
+ )
+ switch (pseg->type) {
+ case s_curve:
+ SCALE_XY(((curve_segment *)pseg)->p1);
+ SCALE_XY(((curve_segment *)pseg)->p2);
+ default:
+ SCALE_XY(pseg->pt);
+ }
}
#undef SCALE_XY
return 0;
@@ -347,75 +346,75 @@ gx_path_copy_reversed(const gx_path * ppath_old, gx_path * ppath)
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath_old, "before reversepath");
+ gx_dump_path(ppath_old, "before reversepath");
#endif
nsp:
if (psub) {
- const segment *prev = psub->last;
- const segment *pseg;
- segment_notes notes =
- (prev == (const segment *)psub ? sn_none :
- psub->next->notes);
- segment_notes prev_notes;
- int code;
-
- if (!psub->is_closed) {
- code = gx_path_add_point(ppath, prev->pt.x, prev->pt.y);
- if (code < 0)
- return code;
- }
- /*
- * The do ... while structure of this loop is artificial,
- * designed solely to keep compilers from complaining about
- * 'statement not reached' or 'end-of-loop code not reached'.
- * The normal exit from this loop is the goto statement in
- * the s_start arm of the switch.
- */
- do {
- pseg = prev;
- prev_notes = notes;
- prev = pseg->prev;
- notes = pseg->notes;
- prev_notes = (prev_notes & sn_not_first) |
- (notes & ~sn_not_first);
- switch (pseg->type) {
- case s_start:
- /* Finished subpath */
- if (psub->is_closed) {
- code =
- gx_path_close_subpath_notes(ppath, prev_notes);
- if (code < 0)
- return code;
- }
- do {
- psub = (const subpath *)psub->prev;
- } while (psub && psub->type != s_start);
- goto nsp;
- case s_curve:
- {
- const curve_segment *pc =
- (const curve_segment *)pseg;
-
- code = gx_path_add_curve_notes(ppath,
- pc->p2.x, pc->p2.y,
- pc->p1.x, pc->p1.y,
- prev->pt.x, prev->pt.y, prev_notes);
- break;
- }
- case s_line:
- code = gx_path_add_line_notes(ppath,
- prev->pt.x, prev->pt.y, prev_notes);
- break;
- case s_line_close:
- /* Skip the closing line. */
- code = gx_path_add_point(ppath, prev->pt.x,
- prev->pt.y);
- break;
- default: /* not possible */
- return_error(gs_error_Fatal);
- }
- } while (code >= 0);
- return code; /* only reached if code < 0 */
+ const segment *prev = psub->last;
+ const segment *pseg;
+ segment_notes notes =
+ (prev == (const segment *)psub ? sn_none :
+ psub->next->notes);
+ segment_notes prev_notes;
+ int code;
+
+ if (!psub->is_closed) {
+ code = gx_path_add_point(ppath, prev->pt.x, prev->pt.y);
+ if (code < 0)
+ return code;
+ }
+ /*
+ * The do ... while structure of this loop is artificial,
+ * designed solely to keep compilers from complaining about
+ * 'statement not reached' or 'end-of-loop code not reached'.
+ * The normal exit from this loop is the goto statement in
+ * the s_start arm of the switch.
+ */
+ do {
+ pseg = prev;
+ prev_notes = notes;
+ prev = pseg->prev;
+ notes = pseg->notes;
+ prev_notes = (prev_notes & sn_not_first) |
+ (notes & ~sn_not_first);
+ switch (pseg->type) {
+ case s_start:
+ /* Finished subpath */
+ if (psub->is_closed) {
+ code =
+ gx_path_close_subpath_notes(ppath, prev_notes);
+ if (code < 0)
+ return code;
+ }
+ do {
+ psub = (const subpath *)psub->prev;
+ } while (psub && psub->type != s_start);
+ goto nsp;
+ case s_curve:
+ {
+ const curve_segment *pc =
+ (const curve_segment *)pseg;
+
+ code = gx_path_add_curve_notes(ppath,
+ pc->p2.x, pc->p2.y,
+ pc->p1.x, pc->p1.y,
+ prev->pt.x, prev->pt.y, prev_notes);
+ break;
+ }
+ case s_line:
+ code = gx_path_add_line_notes(ppath,
+ prev->pt.x, prev->pt.y, prev_notes);
+ break;
+ case s_line_close:
+ /* Skip the closing line. */
+ code = gx_path_add_point(ppath, prev->pt.x,
+ prev->pt.y);
+ break;
+ default: /* not possible */
+ return_error(gs_error_Fatal);
+ }
+ } while (code >= 0);
+ return code; /* only reached if code < 0 */
}
#undef sn_not_end
/*
@@ -424,17 +423,17 @@ gx_path_copy_reversed(const gx_path * ppath_old, gx_path * ppath)
* this behavior here, even though we consider it a bug.
*/
if (ppath_old->first_subpath == 0 &&
- path_last_is_moveto(ppath_old)
- ) {
- int code = gx_path_add_point(ppath, ppath_old->position.x,
- ppath_old->position.y);
+ path_last_is_moveto(ppath_old)
+ ) {
+ int code = gx_path_add_point(ppath, ppath_old->position.x,
+ ppath_old->position.y);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath, "after reversepath");
+ gx_dump_path(ppath, "after reversepath");
#endif
return 0;
}
@@ -446,75 +445,75 @@ gx_path_append_reversed(const gx_path * ppath_old, gx_path * ppath)
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath_old, "before reversepath");
+ gx_dump_path(ppath_old, "before reversepath");
#endif
nsp:
if (psub) {
- const segment *prev = psub->last;
- const segment *pseg;
- segment_notes notes =
- (prev == (const segment *)psub ? sn_none :
- psub->next->notes);
- segment_notes prev_notes;
- int code;
-
- if (!psub->is_closed) {
- code = gx_path_add_line(ppath, prev->pt.x, prev->pt.y);
- if (code < 0)
- return code;
- }
- /*
- * The do ... while structure of this loop is artificial,
- * designed solely to keep compilers from complaining about
- * 'statement not reached' or 'end-of-loop code not reached'.
- * The normal exit from this loop is the goto statement in
- * the s_start arm of the switch.
- */
- do {
- pseg = prev;
- prev_notes = notes;
- prev = pseg->prev;
- notes = pseg->notes;
- prev_notes = (prev_notes & sn_not_first) |
- (notes & ~sn_not_first);
- switch (pseg->type) {
- case s_start:
- /* Finished subpath */
- if (psub->is_closed) {
- code =
- gx_path_close_subpath_notes(ppath, prev_notes);
- if (code < 0)
- return code;
- }
- do {
- psub = (const subpath *)psub->prev;
- } while (psub && psub->type != s_start);
- goto nsp;
- case s_curve:
- {
- const curve_segment *pc =
- (const curve_segment *)pseg;
-
- code = gx_path_add_curve_notes(ppath,
- pc->p2.x, pc->p2.y,
- pc->p1.x, pc->p1.y,
- prev->pt.x, prev->pt.y, prev_notes);
- break;
- }
- case s_line:
- code = gx_path_add_line_notes(ppath,
- prev->pt.x, prev->pt.y, prev_notes);
- break;
- case s_line_close:
- /* Skip the closing line. */
- code = gx_path_add_point(ppath, prev->pt.x,
- prev->pt.y);
- break;
- default: /* not possible */
- return_error(gs_error_Fatal);
- }
- } while (code >= 0);
- return code; /* only reached if code < 0 */
+ const segment *prev = psub->last;
+ const segment *pseg;
+ segment_notes notes =
+ (prev == (const segment *)psub ? sn_none :
+ psub->next->notes);
+ segment_notes prev_notes;
+ int code;
+
+ if (!psub->is_closed) {
+ code = gx_path_add_line(ppath, prev->pt.x, prev->pt.y);
+ if (code < 0)
+ return code;
+ }
+ /*
+ * The do ... while structure of this loop is artificial,
+ * designed solely to keep compilers from complaining about
+ * 'statement not reached' or 'end-of-loop code not reached'.
+ * The normal exit from this loop is the goto statement in
+ * the s_start arm of the switch.
+ */
+ do {
+ pseg = prev;
+ prev_notes = notes;
+ prev = pseg->prev;
+ notes = pseg->notes;
+ prev_notes = (prev_notes & sn_not_first) |
+ (notes & ~sn_not_first);
+ switch (pseg->type) {
+ case s_start:
+ /* Finished subpath */
+ if (psub->is_closed) {
+ code =
+ gx_path_close_subpath_notes(ppath, prev_notes);
+ if (code < 0)
+ return code;
+ }
+ do {
+ psub = (const subpath *)psub->prev;
+ } while (psub && psub->type != s_start);
+ goto nsp;
+ case s_curve:
+ {
+ const curve_segment *pc =
+ (const curve_segment *)pseg;
+
+ code = gx_path_add_curve_notes(ppath,
+ pc->p2.x, pc->p2.y,
+ pc->p1.x, pc->p1.y,
+ prev->pt.x, prev->pt.y, prev_notes);
+ break;
+ }
+ case s_line:
+ code = gx_path_add_line_notes(ppath,
+ prev->pt.x, prev->pt.y, prev_notes);
+ break;
+ case s_line_close:
+ /* Skip the closing line. */
+ code = gx_path_add_point(ppath, prev->pt.x,
+ prev->pt.y);
+ break;
+ default: /* not possible */
+ return_error(gs_error_Fatal);
+ }
+ } while (code >= 0);
+ return code; /* only reached if code < 0 */
}
#undef sn_not_end
/*
@@ -523,17 +522,17 @@ gx_path_append_reversed(const gx_path * ppath_old, gx_path * ppath)
* this behavior here, even though we consider it a bug.
*/
if (ppath_old->first_subpath == 0 &&
- path_last_is_moveto(ppath_old)
- ) {
- int code = gx_path_add_point(ppath, ppath_old->position.x,
- ppath_old->position.y);
+ path_last_is_moveto(ppath_old)
+ ) {
+ int code = gx_path_add_point(ppath, ppath_old->position.x,
+ ppath_old->position.y);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath, "after reversepath");
+ gx_dump_path(ppath, "after reversepath");
#endif
return 0;
}
@@ -569,39 +568,39 @@ gx_path_enum_next(gs_path_enum * penum, gs_fixed_point ppts[3])
const segment *pseg = penum->pseg;
if (pseg == 0) { /* We've enumerated all the segments, but there might be */
- /* a trailing moveto. */
- const gx_path *ppath = penum->path;
-
- if (path_last_is_moveto(ppath) && !penum->moveto_done) { /* Handle a trailing moveto */
- penum->moveto_done = true;
- penum->notes = sn_none;
- ppts[0] = ppath->position;
- return gs_pe_moveto;
- }
- return 0;
+ /* a trailing moveto. */
+ const gx_path *ppath = penum->path;
+
+ if (path_last_is_moveto(ppath) && !penum->moveto_done) { /* Handle a trailing moveto */
+ penum->moveto_done = true;
+ penum->notes = sn_none;
+ ppts[0] = ppath->position;
+ return gs_pe_moveto;
+ }
+ return 0;
}
penum->pseg = pseg->next;
penum->notes = pseg->notes;
switch (pseg->type) {
- case s_start:
- ppts[0] = pseg->pt;
- return gs_pe_moveto;
- case s_line:
- ppts[0] = pseg->pt;
- return gs_pe_lineto;
- case s_line_close:
- ppts[0] = pseg->pt;
- return gs_pe_closepath;
- case s_curve:
+ case s_start:
+ ppts[0] = pseg->pt;
+ return gs_pe_moveto;
+ case s_line:
+ ppts[0] = pseg->pt;
+ return gs_pe_lineto;
+ case s_line_close:
+ ppts[0] = pseg->pt;
+ return gs_pe_closepath;
+ case s_curve:
#define pcseg ((const curve_segment *)pseg)
- ppts[0] = pcseg->p1;
- ppts[1] = pcseg->p2;
- ppts[2] = pseg->pt;
- return gs_pe_curveto;
+ ppts[0] = pcseg->p1;
+ ppts[1] = pcseg->p2;
+ ppts[2] = pseg->pt;
+ return gs_pe_curveto;
#undef pcseg
- default:
- lprintf1("bad type %x in gx_path_enum_next!\n", pseg->type);
- return_error(gs_error_Fatal);
+ default:
+ lprintf1("bad type %x in gx_path_enum_next!\n", pseg->type);
+ return_error(gs_error_Fatal);
}
}
@@ -622,27 +621,27 @@ gx_path_enum_backup(gs_path_enum * penum)
const segment *pseg = penum->pseg;
if (pseg != 0) {
- if ((pseg = pseg->prev) == 0)
- return false;
- penum->pseg = pseg;
- return true;
+ if ((pseg = pseg->prev) == 0)
+ return false;
+ penum->pseg = pseg;
+ return true;
}
/* We're at the end of the path. Check to see whether */
/* we need to back up over a trailing moveto. */
{
- const gx_path *ppath = penum->path;
-
- if (path_last_is_moveto(ppath) && penum->moveto_done) { /* Back up over the trailing moveto. */
- penum->moveto_done = false;
- return true;
- } {
- const subpath *psub = ppath->current_subpath;
-
- if (psub == 0) /* empty path */
- return false;
- /* Back up to the last segment of the last subpath. */
- penum->pseg = psub->last;
- return true;
- }
+ const gx_path *ppath = penum->path;
+
+ if (path_last_is_moveto(ppath) && penum->moveto_done) { /* Back up over the trailing moveto. */
+ penum->moveto_done = false;
+ return true;
+ } {
+ const subpath *psub = ppath->current_subpath;
+
+ if (psub == 0) /* empty path */
+ return false;
+ /* Back up to the last segment of the last subpath. */
+ penum->pseg = psub->last;
+ return true;
+ }
}
}
diff --git a/gs/base/gxpcache.h b/gs/base/gxpcache.h
index 597d3c349..056c5ad24 100644
--- a/gs/base/gxpcache.h
+++ b/gs/base/gxpcache.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gxpcmap.c b/gs/base/gxpcmap.c
index dce98bd1b..123c6d400 100644
--- a/gs/base/gxpcmap.c
+++ b/gs/base/gxpcmap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,7 +51,7 @@ gx_pat_cache_default_tiles(void)
#else
#ifdef DEBUG
return (gs_debug_c('.') ? max_cached_patterns_SMALL :
- max_cached_patterns_LARGE);
+ max_cached_patterns_LARGE);
#else
return max_cached_patterns_LARGE;
#endif
@@ -65,7 +65,7 @@ gx_pat_cache_default_bits(void)
#else
#ifdef DEBUG
return (gs_debug_c('.') ? max_pattern_bits_SMALL :
- max_pattern_bits_LARGE);
+ max_pattern_bits_LARGE);
#else
return max_pattern_bits_LARGE;
#endif
@@ -92,8 +92,8 @@ static dev_proc_get_bits_rectangle(pattern_accum_get_bits_rectangle);
/* The device descriptor */
static const gx_device_pattern_accum gs_pattern_accum_device =
{std_device_std_body_open(gx_device_pattern_accum, 0,
- "pattern accumulator",
- 0, 0, 72, 72),
+ "pattern accumulator",
+ 0, 0, 72, 72),
{
/* NOTE: all drawing procedures must be defaulted, not forwarded. */
pattern_accum_open,
@@ -154,14 +154,13 @@ static const gx_device_pattern_accum gs_pattern_accum_device =
0, 0, 0, 0 /* bitmap_memory, bits, mask, instance */
};
-
-static int
+static int
dummy_free_up_bandlist_memory(gx_device *cldev, bool b)
{
return 0;
}
-int
+int
pattern_clist_open_device(gx_device *dev)
{
/* This function is defiled only for clist_init_bands. */
@@ -173,7 +172,7 @@ static dev_proc_create_buf_device(dummy_create_buf_device)
gx_device_memory *mdev = (gx_device_memory *)*pbdev;
gs_make_mem_device(mdev, gdev_mem_device_for_bits(target->color_info.depth),
- mem, 0, target);
+ mem, 0, target);
return 0;
}
static dev_proc_size_buf_device(dummy_size_buf_device)
@@ -194,8 +193,8 @@ static dev_proc_destroy_buf_device(dummy_destroy_buf_device)
/* Allocate a pattern accumulator, with an initial refct of 0. */
gx_device_forward *
-gx_pattern_accum_alloc(gs_memory_t * mem, gs_memory_t * storage_memory,
- gs_pattern1_instance_t *pinst, client_name_t cname)
+gx_pattern_accum_alloc(gs_memory_t * mem, gs_memory_t * storage_memory,
+ gs_pattern1_instance_t *pinst, client_name_t cname)
{
gx_device *tdev = pinst->saved->device;
int depth = (pinst->template.PaintType == 2 ? 1 : tdev->color_info.depth);
@@ -204,9 +203,9 @@ gx_pattern_accum_alloc(gs_memory_t * mem, gs_memory_t * storage_memory,
gx_device_forward *fdev;
int force_no_clist = 0;
int max_pattern_bitmap = tdev->MaxPatternBitmap == 0 ? MaxPatternBitmap_DEFAULT :
- tdev->MaxPatternBitmap;
+ tdev->MaxPatternBitmap;
- /*
+ /*
* If the target device can accumulate a pattern stream and the language
* client supports high level patterns (ps and pdf only) we don't need a
* raster or clist representation for the pattern, but the code goes
@@ -218,122 +217,122 @@ gx_pattern_accum_alloc(gs_memory_t * mem, gs_memory_t * storage_memory,
* is so large we can't even allocate the memory for the device and the
* dummy clist path must be used. None of this discussion is relevant if
* the client language does not support high level patterns or the device
- * cannot accumulate the pattern stream.
+ * cannot accumulate the pattern stream.
*/
- if (pinst->saved->have_pattern_streams == 0 && (*dev_proc(pinst->saved->device,
- dev_spec_op))((gx_device *)pinst->saved->device,
- gxdso_pattern_can_accum, pinst, 0) == 1)
- force_no_clist = 1;
+ if (pinst->saved->have_pattern_streams == 0 && (*dev_proc(pinst->saved->device,
+ dev_spec_op))((gx_device *)pinst->saved->device,
+ gxdso_pattern_can_accum, pinst, 0) == 1)
+ force_no_clist = 1;
/* Do not allow pattern to be a clist if it uses transparency. We
will want to fix this at some point */
- if (force_no_clist || (size < max_pattern_bitmap && !pinst->is_clist) || pinst->template.PaintType != 1 ||
+ if (force_no_clist || (size < max_pattern_bitmap && !pinst->is_clist) || pinst->template.PaintType != 1 ||
pinst->template.uses_transparency ) {
- gx_device_pattern_accum *adev = gs_alloc_struct(mem, gx_device_pattern_accum,
- &st_device_pattern_accum, cname);
+ gx_device_pattern_accum *adev = gs_alloc_struct(mem, gx_device_pattern_accum,
+ &st_device_pattern_accum, cname);
- if (adev == 0)
- return 0;
+ if (adev == 0)
+ return 0;
#ifdef DEBUG
- if (pinst->is_clist)
- eprintf("not using clist even though clist is requested\n");
+ if (pinst->is_clist)
+ eprintf("not using clist even though clist is requested\n");
#endif
- pinst->is_clist = false;
- gx_device_init((gx_device *)adev,
- (const gx_device *)&gs_pattern_accum_device,
- mem, true);
- adev->instance = pinst;
- adev->bitmap_memory = storage_memory;
+ pinst->is_clist = false;
+ gx_device_init((gx_device *)adev,
+ (const gx_device *)&gs_pattern_accum_device,
+ mem, true);
+ adev->instance = pinst;
+ adev->bitmap_memory = storage_memory;
adev->device_icc_profile = tdev->device_icc_profile;
rc_increment(tdev->device_icc_profile);
- fdev = (gx_device_forward *)adev;
+ fdev = (gx_device_forward *)adev;
} else {
- gx_device_buf_procs_t buf_procs = {dummy_create_buf_device,
- dummy_size_buf_device, dummy_setup_buf_device, dummy_destroy_buf_device};
- gx_device_clist *cdev = gs_alloc_struct(mem, gx_device_clist,
- &st_device_clist, cname);
- gx_device_clist_writer *cwdev = (gx_device_clist_writer *)cdev;
- const int data_size = 1024*32;
- byte *data;
-
- if (cdev == 0)
- return 0;
- /* We're not shure how big area do we need here.
- Definitely we need 1 state in 'states'.
- Not sure whether we need to create tile_cache, etc..
- Note it is allocated in non-gc memory,
- because the garbager descriptor for
- gx_device_clist do not enumerate 'data'
- and its subfields, assuming they do not relocate.
- We place command list files to non-gc memory
- due to same reason.
- */
- data = gs_alloc_bytes(storage_memory->non_gc_memory, data_size, cname);
- if (data == NULL) {
- gs_free_object(mem, cdev, cname);
- return 0;
- }
- pinst->is_clist = true;
- memset(cdev, 0, sizeof(*cdev));
- cwdev->params_size = sizeof(gx_device_clist);
- cwdev->static_procs = NULL;
- cwdev->dname = "pattern-clist";
- cwdev->memory = mem;
- cwdev->stype = &st_device_clist;
- cwdev->stype_is_dynamic = false;
- cwdev->finalize = NULL;
- rc_init(cwdev, mem, 1);
- cwdev->retained = true;
- cwdev->is_open = false;
- cwdev->max_fill_band = 0;
- cwdev->color_info = tdev->color_info;
- cwdev->cached_colors = tdev->cached_colors;
- cwdev->width = pinst->size.x;
- cwdev->height = pinst->size.y;
+ gx_device_buf_procs_t buf_procs = {dummy_create_buf_device,
+ dummy_size_buf_device, dummy_setup_buf_device, dummy_destroy_buf_device};
+ gx_device_clist *cdev = gs_alloc_struct(mem, gx_device_clist,
+ &st_device_clist, cname);
+ gx_device_clist_writer *cwdev = (gx_device_clist_writer *)cdev;
+ const int data_size = 1024*32;
+ byte *data;
+
+ if (cdev == 0)
+ return 0;
+ /* We're not shure how big area do we need here.
+ Definitely we need 1 state in 'states'.
+ Not sure whether we need to create tile_cache, etc..
+ Note it is allocated in non-gc memory,
+ because the garbager descriptor for
+ gx_device_clist do not enumerate 'data'
+ and its subfields, assuming they do not relocate.
+ We place command list files to non-gc memory
+ due to same reason.
+ */
+ data = gs_alloc_bytes(storage_memory->non_gc_memory, data_size, cname);
+ if (data == NULL) {
+ gs_free_object(mem, cdev, cname);
+ return 0;
+ }
+ pinst->is_clist = true;
+ memset(cdev, 0, sizeof(*cdev));
+ cwdev->params_size = sizeof(gx_device_clist);
+ cwdev->static_procs = NULL;
+ cwdev->dname = "pattern-clist";
+ cwdev->memory = mem;
+ cwdev->stype = &st_device_clist;
+ cwdev->stype_is_dynamic = false;
+ cwdev->finalize = NULL;
+ rc_init(cwdev, mem, 1);
+ cwdev->retained = true;
+ cwdev->is_open = false;
+ cwdev->max_fill_band = 0;
+ cwdev->color_info = tdev->color_info;
+ cwdev->cached_colors = tdev->cached_colors;
+ cwdev->width = pinst->size.x;
+ cwdev->height = pinst->size.y;
cwdev->LeadingEdge = tdev->LeadingEdge;
- /* Fields left zeroed :
- float MediaSize[2];
- float ImagingBBox[4];
- bool ImagingBBox_set;
- */
- cwdev->HWResolution[0] = tdev->HWResolution[0];
- cwdev->HWResolution[1] = tdev->HWResolution[1];
- /* Fields left zeroed :
- float MarginsHWResolution[2];
- float Margins[2];
- float HWMargins[4];
- long PageCount;
- long ShowpageCount;
- int NumCopies;
- bool NumCopies_set;
- bool IgnoreNumCopies;
- */
+ /* Fields left zeroed :
+ float MediaSize[2];
+ float ImagingBBox[4];
+ bool ImagingBBox_set;
+ */
+ cwdev->HWResolution[0] = tdev->HWResolution[0];
+ cwdev->HWResolution[1] = tdev->HWResolution[1];
+ /* Fields left zeroed :
+ float MarginsHWResolution[2];
+ float Margins[2];
+ float HWMargins[4];
+ long PageCount;
+ long ShowpageCount;
+ int NumCopies;
+ bool NumCopies_set;
+ bool IgnoreNumCopies;
+ */
cwdev->icc_cache_cl = NULL;
cwdev->icc_table = NULL;
- cwdev->UseCIEColor = tdev->UseCIEColor;
- cwdev->LockSafetyParams = true;
- /* gx_page_device_procs page_procs; */
- cwdev->procs = gs_clist_device_procs;
- cwdev->procs.open_device = pattern_clist_open_device;
- gx_device_copy_color_params((gx_device *)cwdev, tdev);
- rc_assign(cwdev->target, tdev, "gx_pattern_accum_alloc");
- clist_init_io_procs(cdev, true);
- cwdev->data = data;
- cwdev->data_size = data_size;
- cwdev->buf_procs = buf_procs ;
- cwdev->band_params.page_uses_transparency = false;
- cwdev->band_params.BandWidth = pinst->size.x;
- cwdev->band_params.BandHeight = pinst->size.x;
- cwdev->band_params.BandBufferSpace = 0;
- cwdev->do_not_open_or_close_bandfiles = false;
- cwdev->bandlist_memory = storage_memory->non_gc_memory;
- cwdev->free_up_bandlist_memory = dummy_free_up_bandlist_memory;
- cwdev->disable_mask = 0;
- cwdev->page_uses_transparency = false;
- cwdev->pinst = pinst;
- set_dev_proc(cwdev, get_clipping_box, gx_default_get_clipping_box);
- fdev = (gx_device_forward *)cdev;
+ cwdev->UseCIEColor = tdev->UseCIEColor;
+ cwdev->LockSafetyParams = true;
+ /* gx_page_device_procs page_procs; */
+ cwdev->procs = gs_clist_device_procs;
+ cwdev->procs.open_device = pattern_clist_open_device;
+ gx_device_copy_color_params((gx_device *)cwdev, tdev);
+ rc_assign(cwdev->target, tdev, "gx_pattern_accum_alloc");
+ clist_init_io_procs(cdev, true);
+ cwdev->data = data;
+ cwdev->data_size = data_size;
+ cwdev->buf_procs = buf_procs ;
+ cwdev->band_params.page_uses_transparency = false;
+ cwdev->band_params.BandWidth = pinst->size.x;
+ cwdev->band_params.BandHeight = pinst->size.x;
+ cwdev->band_params.BandBufferSpace = 0;
+ cwdev->do_not_open_or_close_bandfiles = false;
+ cwdev->bandlist_memory = storage_memory->non_gc_memory;
+ cwdev->free_up_bandlist_memory = dummy_free_up_bandlist_memory;
+ cwdev->disable_mask = 0;
+ cwdev->page_uses_transparency = false;
+ cwdev->pinst = pinst;
+ set_dev_proc(cwdev, get_clipping_box, gx_default_get_clipping_box);
+ fdev = (gx_device_forward *)cdev;
cdev->common.device_icc_profile = tdev->device_icc_profile;
rc_increment(tdev->device_icc_profile);
}
@@ -362,8 +361,8 @@ pattern_accum_open(gx_device * dev)
* as the one that was current when the pattern was instantiated.
*/
gx_device *target =
- (padev->target == 0 ? gs_currentdevice(pinst->saved) :
- padev->target);
+ (padev->target == 0 ? gs_currentdevice(pinst->saved) :
+ padev->target);
int width = pinst->size.x;
int height = pinst->size.y;
int code = 0;
@@ -382,7 +381,7 @@ pattern_accum_open(gx_device * dev)
PDSET(padev);
padev->color_info = target->color_info;
- /* If we have transparency, then fix the color info
+ /* If we have transparency, then fix the color info
now so that the mem device allocates the proper
buffer space for the pattern template. We can
do this since the transparency code all */
@@ -405,25 +404,25 @@ pattern_accum_open(gx_device * dev)
mask = gs_alloc_struct( mem,
gx_device_memory,
&st_device_memory,
- "pattern_accum_open(mask)"
+ "pattern_accum_open(mask)"
);
if (mask == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gs_make_mem_mono_device(mask, mem, 0);
PDSET(mask);
mask->bitmap_memory = mem;
mask->base = 0;
code = (*dev_proc(mask, open_device)) ((gx_device *) mask);
if (code >= 0) {
- mask_open = true;
- memset(mask->base, 0, mask->raster * mask->height);
- }
+ mask_open = true;
+ memset(mask->base, 0, mask->raster * mask->height);
+ }
}
if (code >= 0) {
if (pinst->template.uses_transparency){
-
+
/* In this case, we will grab the buffer created
by the graphic state's device (which is pdf14) and
we will be tiling that into a transparency group buffer
@@ -431,44 +430,44 @@ pattern_accum_open(gx_device * dev)
all the transparency stuff is planar format, it is
best just to keep the data in that form */
- gx_device_set_target((gx_device_forward *)padev, target);
+ gx_device_set_target((gx_device_forward *)padev, target);
} else {
- switch (pinst->template.PaintType) {
- case 2: /* uncolored */
- gx_device_set_target((gx_device_forward *)padev, target);
- break;
- case 1: /* colored */
- bits = gs_alloc_struct(mem, gx_device_memory,
- &st_device_memory,
- "pattern_accum_open(bits)");
- if (bits == 0)
- code = gs_note_error(gs_error_VMerror);
- else {
- gs_make_mem_device(bits,
- gdev_mem_device_for_bits(padev->color_info.depth),
- mem, -1, target);
- PDSET(bits);
+ switch (pinst->template.PaintType) {
+ case 2: /* uncolored */
+ gx_device_set_target((gx_device_forward *)padev, target);
+ break;
+ case 1: /* colored */
+ bits = gs_alloc_struct(mem, gx_device_memory,
+ &st_device_memory,
+ "pattern_accum_open(bits)");
+ if (bits == 0)
+ code = gs_note_error(gs_error_VMerror);
+ else {
+ gs_make_mem_device(bits,
+ gdev_mem_device_for_bits(padev->color_info.depth),
+ mem, -1, target);
+ PDSET(bits);
#undef PDSET
- bits->color_info = padev->color_info;
- bits->bitmap_memory = mem;
- code = (*dev_proc(bits, open_device)) ((gx_device *) bits);
- gx_device_set_target((gx_device_forward *)padev,
- (gx_device *)bits);
- }
- }
+ bits->color_info = padev->color_info;
+ bits->bitmap_memory = mem;
+ code = (*dev_proc(bits, open_device)) ((gx_device *) bits);
+ gx_device_set_target((gx_device_forward *)padev,
+ (gx_device *)bits);
+ }
+ }
}
}
if (code < 0) {
- if (bits != 0)
- gs_free_object(mem, bits, "pattern_accum_open(bits)");
+ if (bits != 0)
+ gs_free_object(mem, bits, "pattern_accum_open(bits)");
if (mask != 0) {
- if (mask_open)
- (*dev_proc(mask, close_device)) ((gx_device *) mask);
- gs_free_object(mem, mask, "pattern_accum_open(mask)");
+ if (mask_open)
+ (*dev_proc(mask, close_device)) ((gx_device *) mask);
+ gs_free_object(mem, mask, "pattern_accum_open(mask)");
}
- return code;
+ return code;
}
padev->mask = mask;
padev->bits = bits;
@@ -483,7 +482,6 @@ new_pattern_trans_buff(gs_memory_t *mem)
gx_pattern_trans_t *result;
-
/* Allocate structure that we will use for the trans pattern */
result = gs_alloc_struct(mem, gx_pattern_trans_t, &st_pattern_trans, "new_pattern_trans_buff");
result->transbytes = NULL;
@@ -493,7 +491,6 @@ new_pattern_trans_buff(gs_memory_t *mem)
return(result);
}
-
/* Close an accumulator and free the bits. */
static int
pattern_accum_close(gx_device * dev)
@@ -526,16 +523,16 @@ pattern_accum_close(gx_device * dev)
/* Fill a rectangle */
static int
pattern_accum_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
+ gx_color_index color)
{
gx_device_pattern_accum *const padev = (gx_device_pattern_accum *) dev;
if (padev->bits)
- (*dev_proc(padev->target, fill_rectangle))
- (padev->target, x, y, w, h, color);
+ (*dev_proc(padev->target, fill_rectangle))
+ (padev->target, x, y, w, h, color);
if (padev->mask)
return (*dev_proc(padev->mask, fill_rectangle))
- ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
+ ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
else
return 0;
}
@@ -543,8 +540,8 @@ pattern_accum_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a monochrome bitmap. */
static int
pattern_accum_copy_mono(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index color0, gx_color_index color1)
{
gx_device_pattern_accum *const padev = (gx_device_pattern_accum *) dev;
@@ -552,21 +549,21 @@ pattern_accum_copy_mono(gx_device * dev, const byte * data, int data_x,
if (color0 == gx_no_color_index && color1 == gx_no_color_index)
return 0;
if (padev->bits)
- (*dev_proc(padev->target, copy_mono))
- (padev->target, data, data_x, raster, id, x, y, w, h,
- color0, color1);
+ (*dev_proc(padev->target, copy_mono))
+ (padev->target, data, data_x, raster, id, x, y, w, h,
+ color0, color1);
if (padev->mask) {
if (color0 != gx_no_color_index)
- color0 = 1;
+ color0 = 1;
if (color1 != gx_no_color_index)
- color1 = 1;
+ color1 = 1;
if (color0 == 1 && color1 == 1)
- return (*dev_proc(padev->mask, fill_rectangle))
- ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
+ return (*dev_proc(padev->mask, fill_rectangle))
+ ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
else
- return (*dev_proc(padev->mask, copy_mono))
- ((gx_device *) padev->mask, data, data_x, raster, id, x, y, w, h,
- color0, color1);
+ return (*dev_proc(padev->mask, copy_mono))
+ ((gx_device *) padev->mask, data, data_x, raster, id, x, y, w, h,
+ color0, color1);
} else
return 0;
}
@@ -574,16 +571,16 @@ pattern_accum_copy_mono(gx_device * dev, const byte * data, int data_x,
/* Copy a color bitmap. */
static int
pattern_accum_copy_color(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device_pattern_accum *const padev = (gx_device_pattern_accum *) dev;
if (padev->bits)
- (*dev_proc(padev->target, copy_color))
- (padev->target, data, data_x, raster, id, x, y, w, h);
+ (*dev_proc(padev->target, copy_color))
+ (padev->target, data, data_x, raster, id, x, y, w, h);
if (padev->mask)
return (*dev_proc(padev->mask, fill_rectangle))
- ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
+ ((gx_device *) padev->mask, x, y, w, h, (gx_color_index) 1);
else
return 0;
}
@@ -592,19 +589,19 @@ pattern_accum_copy_color(gx_device * dev, const byte * data, int data_x,
/****** SHOULD USE MASK TO DEFINE UNREAD AREA *****/
static int
pattern_accum_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
- gs_get_bits_params_t * params, gs_int_rect ** unread)
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
gx_device_pattern_accum *const padev = (gx_device_pattern_accum *) dev;
const gs_pattern1_instance_t *pinst = padev->instance;
if (padev->bits)
- return (*dev_proc(padev->target, get_bits_rectangle))
- (padev->target, prect, params, unread);
+ return (*dev_proc(padev->target, get_bits_rectangle))
+ (padev->target, prect, params, unread);
- if (pinst->template.PaintType == 2)
- return 0;
- else
- return_error(gs_error_Fatal); /* shouldn't happen */
+ if (pinst->template.PaintType == 2)
+ return 0;
+ else
+ return_error(gs_error_Fatal); /* shouldn't happen */
}
/* ------ Color space implementation ------ */
@@ -627,17 +624,17 @@ gx_pattern_alloc_cache(gs_memory_t * mem, uint num_tiles, ulong max_bits)
{
gx_pattern_cache *pcache =
gs_alloc_struct(mem, gx_pattern_cache, &st_pattern_cache,
- "gx_pattern_alloc_cache(struct)");
+ "gx_pattern_alloc_cache(struct)");
gx_color_tile *tiles =
gs_alloc_struct_array(mem, num_tiles, gx_color_tile,
- &st_color_tile_element,
- "gx_pattern_alloc_cache(tiles)");
+ &st_color_tile_element,
+ "gx_pattern_alloc_cache(tiles)");
uint i;
if (pcache == 0 || tiles == 0) {
- gs_free_object(mem, tiles, "gx_pattern_alloc_cache(tiles)");
- gs_free_object(mem, pcache, "gx_pattern_alloc_cache(struct)");
- return 0;
+ gs_free_object(mem, tiles, "gx_pattern_alloc_cache(tiles)");
+ gs_free_object(mem, pcache, "gx_pattern_alloc_cache(struct)");
+ return 0;
}
pcache->memory = mem;
pcache->tiles = tiles;
@@ -648,13 +645,13 @@ gx_pattern_alloc_cache(gs_memory_t * mem, uint num_tiles, ulong max_bits)
pcache->max_bits = max_bits;
pcache->free_all = pattern_cache_free_all;
for (i = 0; i < num_tiles; tiles++, i++) {
- tiles->id = gx_no_bitmap_id;
- /* Clear the pointers to pacify the GC. */
- uid_set_invalid(&tiles->uid);
- tiles->tbits.data = 0;
- tiles->tmask.data = 0;
- tiles->index = i;
- tiles->cdev = NULL;
+ tiles->id = gx_no_bitmap_id;
+ /* Clear the pointers to pacify the GC. */
+ uid_set_invalid(&tiles->uid);
+ tiles->tbits.data = 0;
+ tiles->tmask.data = 0;
+ tiles->index = i;
+ tiles->cdev = NULL;
tiles->ttrans = NULL;
}
return pcache;
@@ -664,14 +661,14 @@ static int
ensure_pattern_cache(gs_imager_state * pis)
{
if (pis->pattern_cache == 0) {
- gx_pattern_cache *pcache =
- gx_pattern_alloc_cache(pis->memory,
- gx_pat_cache_default_tiles(),
- gx_pat_cache_default_bits());
-
- if (pcache == 0)
- return_error(gs_error_VMerror);
- pis->pattern_cache = pcache;
+ gx_pattern_cache *pcache =
+ gx_pattern_alloc_cache(pis->memory,
+ gx_pat_cache_default_tiles(),
+ gx_pat_cache_default_bits());
+
+ if (pcache == 0)
+ return_error(gs_error_VMerror);
+ pis->pattern_cache = pcache;
}
return 0;
}
@@ -705,50 +702,50 @@ gx_pattern_cache_free_entry(gx_pattern_cache * pcache, gx_color_tile * ctile)
gx_device *temp_device;
if ((ctile->id != gx_no_bitmap_id) && !ctile->is_dummy) {
- gs_memory_t *mem = pcache->memory;
- gx_device_memory *pmdev;
- ulong used = 0;
-
- /*
- * We must initialize the memory device properly, even though
- * we aren't using it for drawing.
- */
- gs_make_mem_mono_device_with_copydevice(&pmdev, mem, NULL);
- if (ctile->tmask.data != 0) {
- pmdev->width = ctile->tmask.size.x;
- pmdev->height = ctile->tmask.size.y;
- /*mdev.color_info.depth = 1;*/
- gdev_mem_bitmap_size(pmdev, &used);
- gs_free_object(mem, ctile->tmask.data,
- "free_pattern_cache_entry(mask data)");
- ctile->tmask.data = 0; /* for GC */
- }
- if (ctile->tbits.data != 0) {
- ulong tbits_used = 0;
-
- pmdev->width = ctile->tbits.size.x;
- pmdev->height = ctile->tbits.size.y;
- pmdev->color_info.depth = ctile->depth;
- gdev_mem_bitmap_size(pmdev, &tbits_used);
- used += tbits_used;
- gs_free_object(mem, ctile->tbits.data,
- "free_pattern_cache_entry(bits data)");
- ctile->tbits.data = 0; /* for GC */
- }
- if (ctile->cdev != NULL) {
- dev_proc(&ctile->cdev->common, close_device)((gx_device *)&ctile->cdev->common);
+ gs_memory_t *mem = pcache->memory;
+ gx_device_memory *pmdev;
+ ulong used = 0;
+
+ /*
+ * We must initialize the memory device properly, even though
+ * we aren't using it for drawing.
+ */
+ gs_make_mem_mono_device_with_copydevice(&pmdev, mem, NULL);
+ if (ctile->tmask.data != 0) {
+ pmdev->width = ctile->tmask.size.x;
+ pmdev->height = ctile->tmask.size.y;
+ /*mdev.color_info.depth = 1;*/
+ gdev_mem_bitmap_size(pmdev, &used);
+ gs_free_object(mem, ctile->tmask.data,
+ "free_pattern_cache_entry(mask data)");
+ ctile->tmask.data = 0; /* for GC */
+ }
+ if (ctile->tbits.data != 0) {
+ ulong tbits_used = 0;
+
+ pmdev->width = ctile->tbits.size.x;
+ pmdev->height = ctile->tbits.size.y;
+ pmdev->color_info.depth = ctile->depth;
+ gdev_mem_bitmap_size(pmdev, &tbits_used);
+ used += tbits_used;
+ gs_free_object(mem, ctile->tbits.data,
+ "free_pattern_cache_entry(bits data)");
+ ctile->tbits.data = 0; /* for GC */
+ }
+ if (ctile->cdev != NULL) {
+ dev_proc(&ctile->cdev->common, close_device)((gx_device *)&ctile->cdev->common);
/* Free up the icc based stuff in the clist device. I am puzzled
why the other objects are not released */
- clist_icc_freetable(ctile->cdev->common.icc_table,
+ clist_icc_freetable(ctile->cdev->common.icc_table,
ctile->cdev->common.memory);
rc_decrement(ctile->cdev->common.icc_cache_cl,
"gx_pattern_cache_free_entry");
- gs_free_object(ctile->cdev->common.memory, ctile->cdev, "free_pattern_cache_entry(pattern-clist)");
- ctile->cdev = NULL;
- }
+ gs_free_object(ctile->cdev->common.memory, ctile->cdev, "free_pattern_cache_entry(pattern-clist)");
+ ctile->cdev = NULL;
+ }
if (ctile->ttrans != NULL) {
-
+
if ( ctile->ttrans->pdev14 == NULL) {
/* This can happen if we came from the clist */
gs_free_object(mem,ctile->ttrans->transbytes,
@@ -757,24 +754,24 @@ gx_pattern_cache_free_entry(gx_pattern_cache * pcache, gx_color_tile * ctile)
"free_pattern_cache_entry(fill_trans_buffer)");
ctile->ttrans->transbytes = NULL;
} else {
- dev_proc(ctile->ttrans->pdev14, close_device)((gx_device *)ctile->ttrans->pdev14);
+ dev_proc(ctile->ttrans->pdev14, close_device)((gx_device *)ctile->ttrans->pdev14);
temp_device = ctile->ttrans->pdev14;
gx_device_retain(temp_device, false);
- ctile->ttrans->pdev14 = NULL;
+ ctile->ttrans->pdev14 = NULL;
ctile->ttrans->transbytes = NULL; /* should be ok due to pdf14_close */
ctile->ttrans->fill_trans_buffer = NULL; /* This is always freed */
}
used += ctile->ttrans->n_chan*ctile->ttrans->planestride;
- gs_free_object(mem, ctile->ttrans,
- "free_pattern_cache_entry(ttrans)");
+ gs_free_object(mem, ctile->ttrans,
+ "free_pattern_cache_entry(ttrans)");
ctile->ttrans = NULL;
}
- pcache->tiles_used--;
- pcache->bits_used -= used;
- ctile->id = gx_no_bitmap_id;
+ pcache->tiles_used--;
+ pcache->bits_used -= used;
+ ctile->id = gx_no_bitmap_id;
gx_device_retain((gx_device *)pmdev, false);
}
}
@@ -788,7 +785,7 @@ gx_pattern_cache_free_entry(gx_pattern_cache * pcache, gx_color_tile * ctile)
static void make_bitmap(gx_strip_bitmap *, const gx_device_memory *, gx_bitmap_id);
int
gx_pattern_cache_add_entry(gs_imager_state * pis,
- gx_device_forward * fdev, gx_color_tile ** pctile)
+ gx_device_forward * fdev, gx_color_tile ** pctile)
{
gx_pattern_cache *pcache;
const gs_pattern1_instance_t *pinst;
@@ -801,75 +798,74 @@ gx_pattern_cache_add_entry(gs_imager_state * pis,
gx_device_memory *mbits = NULL;
gx_pattern_trans_t *trans = NULL;
-
if (code < 0)
- return code;
+ return code;
pcache = pis->pattern_cache;
if (fdev->procs.open_device != pattern_clist_open_device) {
- gx_device_pattern_accum *padev = (gx_device_pattern_accum *)fdev;
-
- mbits = padev->bits;
- mmask = padev->mask;
- pinst = padev->instance;
+ gx_device_pattern_accum *padev = (gx_device_pattern_accum *)fdev;
+
+ mbits = padev->bits;
+ mmask = padev->mask;
+ pinst = padev->instance;
trans = padev->transbuff;
- /*
- * Check whether the pattern completely fills its box.
- * If so, we can avoid the expensive masking operations
- * when using the pattern.
- */
- if (mmask != 0) {
- int y;
-
- for (y = 0; y < mmask->height; y++) {
- const byte *row = scan_line_base(mmask, y);
- int w;
-
- for (w = mmask->width; w > 8; w -= 8)
- if (*row++ != 0xff)
- goto keep;
- if ((*row | (0xff >> w)) != 0xff)
- goto keep;
- }
- /* We don't need a mask. */
- mmask = 0;
- keep:;
- }
+ /*
+ * Check whether the pattern completely fills its box.
+ * If so, we can avoid the expensive masking operations
+ * when using the pattern.
+ */
+ if (mmask != 0) {
+ int y;
+
+ for (y = 0; y < mmask->height; y++) {
+ const byte *row = scan_line_base(mmask, y);
+ int w;
+
+ for (w = mmask->width; w > 8; w -= 8)
+ if (*row++ != 0xff)
+ goto keep;
+ if ((*row | (0xff >> w)) != 0xff)
+ goto keep;
+ }
+ /* We don't need a mask. */
+ mmask = 0;
+ keep:;
+ }
/* Need to get size of buffers that are being added to the cache */
- if (mbits != 0)
- gdev_mem_bitmap_size(mbits, &used);
- if (mmask != 0) {
- gdev_mem_bitmap_size(mmask, &mask_used);
- used += mask_used;
- }
+ if (mbits != 0)
+ gdev_mem_bitmap_size(mbits, &used);
+ if (mmask != 0) {
+ gdev_mem_bitmap_size(mmask, &mask_used);
+ used += mask_used;
+ }
if (trans != 0) {
trans_used = trans->planestride*trans->n_chan;
used += trans_used;
}
} else {
- gx_device_clist *cdev = (gx_device_clist *)fdev;
- gx_device_clist_writer * cldev = (gx_device_clist_writer *)cdev;
-
- code = clist_end_page(cldev);
- if (code < 0)
- return code;
- pinst = cdev->writer.pinst;
- /* HACK: we would like to copy the pattern clist stream into the
- tile cache memory and properly account its size,
- but we have no time for this development now.
- Therefore the stream is stored outside the cache. */
- used = 0;
+ gx_device_clist *cdev = (gx_device_clist *)fdev;
+ gx_device_clist_writer * cldev = (gx_device_clist_writer *)cdev;
+
+ code = clist_end_page(cldev);
+ if (code < 0)
+ return code;
+ pinst = cdev->writer.pinst;
+ /* HACK: we would like to copy the pattern clist stream into the
+ tile cache memory and properly account its size,
+ but we have no time for this development now.
+ Therefore the stream is stored outside the cache. */
+ used = 0;
}
id = pinst->id;
ctile = &pcache->tiles[id % pcache->num_tiles];
gx_pattern_cache_free_entry(pcache, ctile);
/* If too large then start freeing entries */
while (pcache->bits_used + used > pcache->max_bits &&
- pcache->bits_used != 0 /* allow 1 oversized entry (?) */
- ) {
- pcache->next = (pcache->next + 1) % pcache->num_tiles;
- gx_pattern_cache_free_entry(pcache, &pcache->tiles[pcache->next]);
+ pcache->bits_used != 0 /* allow 1 oversized entry (?) */
+ ) {
+ pcache->next = (pcache->next + 1) % pcache->num_tiles;
+ gx_pattern_cache_free_entry(pcache, &pcache->tiles[pcache->next]);
}
ctile->id = id;
ctile->depth = fdev->color_info.depth;
@@ -881,44 +877,44 @@ gx_pattern_cache_add_entry(gs_imager_state * pis,
ctile->has_overlap = pinst->has_overlap;
ctile->is_dummy = false;
if (fdev->procs.open_device != pattern_clist_open_device) {
- if (mbits != 0) {
- make_bitmap(&ctile->tbits, mbits, gs_next_ids(pis->memory, 1));
- mbits->bitmap_memory = 0; /* don't free the bits */
- } else
- ctile->tbits.data = 0;
- if (mmask != 0) {
- make_bitmap(&ctile->tmask, mmask, id);
- mmask->bitmap_memory = 0; /* don't free the bits */
- } else
- ctile->tmask.data = 0;
+ if (mbits != 0) {
+ make_bitmap(&ctile->tbits, mbits, gs_next_ids(pis->memory, 1));
+ mbits->bitmap_memory = 0; /* don't free the bits */
+ } else
+ ctile->tbits.data = 0;
+ if (mmask != 0) {
+ make_bitmap(&ctile->tmask, mmask, id);
+ mmask->bitmap_memory = 0; /* don't free the bits */
+ } else
+ ctile->tmask.data = 0;
if (trans != 0) {
ctile->ttrans = trans;
}
-
- ctile->cdev = NULL;
- pcache->bits_used += used;
+
+ ctile->cdev = NULL;
+ pcache->bits_used += used;
} else {
- gx_device_clist *cdev = (gx_device_clist *)fdev;
- gx_device_clist_writer *cwdev = (gx_device_clist_writer *)fdev;
-
- ctile->tbits.data = 0;
- ctile->tbits.size.x = 0;
- ctile->tbits.size.y = 0;
- ctile->tmask.data = 0;
- ctile->tmask.size.x = 0;
- ctile->tmask.size.y = 0;
- ctile->cdev = cdev;
+ gx_device_clist *cdev = (gx_device_clist *)fdev;
+ gx_device_clist_writer *cwdev = (gx_device_clist_writer *)fdev;
+
+ ctile->tbits.data = 0;
+ ctile->tbits.size.x = 0;
+ ctile->tbits.size.y = 0;
+ ctile->tmask.data = 0;
+ ctile->tmask.size.x = 0;
+ ctile->tmask.size.y = 0;
+ ctile->cdev = cdev;
#if 0 /* Don't free - tile cache is used by clist reader. */
- gs_free_object(cwdev->bandlist_memory, cwdev->data, "gx_pattern_cache_add_entry");
- cwdev->data = NULL;
- cwdev->states = NULL;
- cwdev->cbuf = NULL;
- cwdev->cnext = NULL;
- cwdev->cend = NULL;
- cwdev->ccl = NULL;
+ gs_free_object(cwdev->bandlist_memory, cwdev->data, "gx_pattern_cache_add_entry");
+ cwdev->data = NULL;
+ cwdev->states = NULL;
+ cwdev->cbuf = NULL;
+ cwdev->cnext = NULL;
+ cwdev->cend = NULL;
+ cwdev->ccl = NULL;
#endif
- /* Prevent freeing files on pattern_paint_cleanup : */
- cwdev->do_not_open_or_close_bandfiles = true;
+ /* Prevent freeing files on pattern_paint_cleanup : */
+ cwdev->do_not_open_or_close_bandfiles = true;
}
pcache->tiles_used++;
*pctile = ctile;
@@ -934,7 +930,7 @@ gx_pattern_cache_get_entry(gs_imager_state * pis, gs_id id, gx_color_tile ** pct
int code = ensure_pattern_cache(pis);
if (code < 0)
- return code;
+ return code;
pcache = pis->pattern_cache;
ctile = &pcache->tiles[id % pcache->num_tiles];
gx_pattern_cache_free_entry(pis->pattern_cache, ctile);
@@ -943,7 +939,7 @@ gx_pattern_cache_get_entry(gs_imager_state * pis, gs_id id, gx_color_tile ** pct
return 0;
}
-bool
+bool
gx_pattern_tile_is_clist(gx_color_tile *ptile)
{
return ptile != NULL && ptile->cdev != NULL;
@@ -952,8 +948,8 @@ gx_pattern_tile_is_clist(gx_color_tile *ptile)
/* Add a dummy Pattern cache entry. Stubs a pattern tile for interpreter when
device handles high level patterns. */
int
-gx_pattern_cache_add_dummy_entry(gs_imager_state *pis,
- gs_pattern1_instance_t *pinst, int depth)
+gx_pattern_cache_add_dummy_entry(gs_imager_state *pis,
+ gs_pattern1_instance_t *pinst, int depth)
{
gx_color_tile *ctile;
gx_pattern_cache *pcache;
@@ -961,7 +957,7 @@ gx_pattern_cache_add_dummy_entry(gs_imager_state *pis,
int code = ensure_pattern_cache(pis);
if (code < 0)
- return code;
+ return code;
pcache = pis->pattern_cache;
ctile = &pcache->tiles[id % pcache->num_tiles];
gx_pattern_cache_free_entry(pcache, ctile);
@@ -1023,7 +1019,7 @@ dump_raw_pattern(int height, int width, int n_chan, int depth,
static void
make_bitmap(register gx_strip_bitmap * pbm, const gx_device_memory * mdev,
- gx_bitmap_id id)
+ gx_bitmap_id id)
{
pbm->data = mdev->base;
pbm->raster = mdev->raster;
@@ -1036,13 +1032,12 @@ make_bitmap(register gx_strip_bitmap * pbm, const gx_device_memory * mdev,
#if RAW_PATTERN_DUMP
dump_raw_pattern(pbm->rep_height, pbm->rep_width,
- mdev->color_info.num_components,
+ mdev->color_info.num_components,
mdev->color_info.depth,
(unsigned char*) mdev->base,
pbm->raster);
global_pat_index++;
-
#endif
@@ -1056,12 +1051,12 @@ gx_pattern_cache_winnow(gx_pattern_cache * pcache,
uint i;
if (pcache == 0) /* no cache created yet */
- return;
+ return;
for (i = 0; i < pcache->num_tiles; ++i) {
- gx_color_tile *ctile = &pcache->tiles[i];
+ gx_color_tile *ctile = &pcache->tiles[i];
- if (ctile->id != gx_no_bitmap_id && (*proc) (ctile, proc_data))
- gx_pattern_cache_free_entry(pcache, ctile);
+ if (ctile->id != gx_no_bitmap_id && (*proc) (ctile, proc_data))
+ gx_pattern_cache_free_entry(pcache, ctile);
}
}
@@ -1074,7 +1069,7 @@ gx_erase_colored_pattern(gs_state *pgs)
gx_device_pattern_accum *pdev = (gx_device_pattern_accum *)gs_currentdevice(pgs);
if ((code = gs_gsave(pgs)) < 0)
- return code;
+ return code;
if ((code = gs_setgray(pgs, 1.0)) >= 0) {
gs_rect rect;
gx_device_memory *mask;
@@ -1088,7 +1083,7 @@ gx_erase_colored_pattern(gs_state *pgs)
mask */
mask = pdev->mask;
pdev->mask = NULL;
- code = gs_rectfill(pgs, &rect, 1);
+ code = gs_rectfill(pgs, &rect, 1);
/* restore the mask */
pdev->mask = mask;
if (code < 0)
@@ -1102,46 +1097,46 @@ gx_erase_colored_pattern(gs_state *pgs)
/* *pdc is already set, except for colors.pattern.p_tile and mask.m_tile. */
int
gx_pattern_load(gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device * dev, gs_color_select_t select)
{
gx_device_forward *adev = NULL;
gs_pattern1_instance_t *pinst =
- (gs_pattern1_instance_t *)pdc->ccolor.pattern;
+ (gs_pattern1_instance_t *)pdc->ccolor.pattern;
gs_state *saved;
gx_color_tile *ctile;
gs_memory_t *mem = pis->memory;
int code;
if (gx_pattern_cache_lookup(pdc, pis, dev, select))
- return 0;
+ return 0;
/* We REALLY don't like the following cast.... */
code = ensure_pattern_cache((gs_imager_state *) pis);
if (code < 0)
- return code;
+ return code;
/*
* Note that adev is an internal device, so it will be freed when the
* last reference to it from a graphics state is deleted.
*/
adev = gx_pattern_accum_alloc(mem, pis->pattern_cache->memory, pinst, "gx_pattern_load");
if (adev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_device_set_target((gx_device_forward *)adev, dev);
code = dev_proc(adev, open_device)((gx_device *)adev);
if (code < 0)
- goto fail;
+ goto fail;
saved = gs_gstate(pinst->saved);
if (saved == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fail;
+ code = gs_note_error(gs_error_VMerror);
+ goto fail;
}
if (saved->pattern_cache == 0)
- saved->pattern_cache = pis->pattern_cache;
+ saved->pattern_cache = pis->pattern_cache;
gs_setdevice_no_init(saved, (gx_device *)adev);
if (pinst->template.uses_transparency) {
/* This should not occur from PS or PDF, but is provided for other clients (XPS) */
- if_debug0('v', "gx_pattern_load: pushing the pdf14 compositor device into this graphics state\n");
- if ((code = gs_push_pdf14trans_device(saved)) < 0)
- return code;
+ if_debug0('v', "gx_pattern_load: pushing the pdf14 compositor device into this graphics state\n");
+ if ((code = gs_push_pdf14trans_device(saved)) < 0)
+ return code;
} else {
/* For colored patterns we clear the pattern device's
background. This is necessary for the anti aliasing code
@@ -1157,36 +1152,36 @@ gx_pattern_load(gx_device_color * pdc, const gs_imager_state * pis,
code = (*pinst->template.PaintProc)(&pdc->ccolor, saved);
if (code < 0) {
- dev_proc(adev, close_device)((gx_device *)adev);
- /* Freeing the state will free the device and the pdf14 compositor (if any). */
- gs_state_free(saved);
- return code;
+ dev_proc(adev, close_device)((gx_device *)adev);
+ /* Freeing the state will free the device and the pdf14 compositor (if any). */
+ gs_state_free(saved);
+ return code;
}
if (pinst->template.uses_transparency) {
- if_debug0('v', "gx_pattern_load: popping the pdf14 compositor device from this graphics state\n");
- if ((code = gs_pop_pdf14trans_device(saved)) < 0)
- return code;
+ if_debug0('v', "gx_pattern_load: popping the pdf14 compositor device from this graphics state\n");
+ if ((code = gs_pop_pdf14trans_device(saved)) < 0)
+ return code;
}
/* We REALLY don't like the following cast.... */
- code = gx_pattern_cache_add_entry((gs_imager_state *)pis,
- adev, &ctile);
+ code = gx_pattern_cache_add_entry((gs_imager_state *)pis,
+ adev, &ctile);
if (code >= 0) {
- if (!gx_pattern_cache_lookup(pdc, pis, dev, select)) {
- lprintf("Pattern cache lookup failed after insertion!\n");
- code = gs_note_error(gs_error_Fatal);
- }
+ if (!gx_pattern_cache_lookup(pdc, pis, dev, select)) {
+ lprintf("Pattern cache lookup failed after insertion!\n");
+ code = gs_note_error(gs_error_Fatal);
+ }
}
#ifdef DEBUG
if (gs_debug_c('B') && adev->procs.open_device == pattern_accum_open) {
- gx_device_pattern_accum *pdev = (gx_device_pattern_accum *)adev;
+ gx_device_pattern_accum *pdev = (gx_device_pattern_accum *)adev;
if (pdev->mask)
- debug_dump_bitmap(pdev->mask->base, pdev->mask->raster,
- pdev->mask->height, "[B]Pattern mask");
- if (pdev->bits)
- debug_dump_bitmap(((gx_device_memory *) pdev->target)->base,
- ((gx_device_memory *) pdev->target)->raster,
- pdev->target->height, "[B]Pattern bits");
+ debug_dump_bitmap(pdev->mask->base, pdev->mask->raster,
+ pdev->mask->height, "[B]Pattern mask");
+ if (pdev->bits)
+ debug_dump_bitmap(((gx_device_memory *) pdev->target)->base,
+ ((gx_device_memory *) pdev->target)->raster,
+ pdev->target->height, "[B]Pattern bits");
}
#endif
/* Free the bookkeeping structures, except for the bits and mask */
@@ -1197,10 +1192,10 @@ gx_pattern_load(gx_device_color * pdc, const gs_imager_state * pis,
return code;
fail:
if (adev->procs.open_device == pattern_clist_open_device) {
- gx_device_clist *cdev = (gx_device_clist *)adev;
+ gx_device_clist *cdev = (gx_device_clist *)adev;
- gs_free_object(cdev->writer.bandlist_memory, cdev->common.data, "gx_pattern_load");
- cdev->common.data = 0;
+ gs_free_object(cdev->writer.bandlist_memory, cdev->common.data, "gx_pattern_load");
+ cdev->common.data = 0;
}
gs_free_object(mem, adev, "gx_pattern_load");
return code;
@@ -1210,8 +1205,8 @@ fail:
cs_proc_remap_color(gx_remap_Pattern); /* check the prototype */
int
gs_pattern1_remap_color(const gs_client_color * pc, const gs_color_space * pcs,
- gx_device_color * pdc, const gs_imager_state * pis,
- gx_device * dev, gs_color_select_t select)
+ gx_device_color * pdc, const gs_imager_state * pis,
+ gx_device * dev, gs_color_select_t select)
{
gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)pc->pattern;
int code;
@@ -1220,27 +1215,26 @@ gs_pattern1_remap_color(const gs_client_color * pc, const gs_color_space * pcs,
pdc->ccolor = *pc;
pdc->ccolor_valid = true;
if (pinst == 0) {
- /* Null pattern */
- color_set_null_pattern(pdc);
- return 0;
+ /* Null pattern */
+ color_set_null_pattern(pdc);
+ return 0;
}
if (pinst->template.PaintType == 2) { /* uncolored */
- code = (pcs->base_space->type->remap_color)
- (pc, pcs->base_space, pdc, pis, dev, select);
- if (code < 0)
- return code;
- if (pdc->type == gx_dc_type_pure)
- pdc->type = &gx_dc_pure_masked;
- else if (pdc->type == gx_dc_type_ht_binary)
- pdc->type = &gx_dc_binary_masked;
- else if (pdc->type == gx_dc_type_ht_colored)
- pdc->type = &gx_dc_colored_masked;
- else
- return_error(gs_error_unregistered);
+ code = (pcs->base_space->type->remap_color)
+ (pc, pcs->base_space, pdc, pis, dev, select);
+ if (code < 0)
+ return code;
+ if (pdc->type == gx_dc_type_pure)
+ pdc->type = &gx_dc_pure_masked;
+ else if (pdc->type == gx_dc_type_ht_binary)
+ pdc->type = &gx_dc_binary_masked;
+ else if (pdc->type == gx_dc_type_ht_colored)
+ pdc->type = &gx_dc_colored_masked;
+ else
+ return_error(gs_error_unregistered);
} else
- color_set_null_pattern(pdc);
+ color_set_null_pattern(pdc);
pdc->mask.id = pinst->id;
pdc->mask.m_tile = 0;
return gx_pattern_load(pdc, pis, dev, select);
}
-
diff --git a/gs/base/gxpcolor.h b/gs/base/gxpcolor.h
index 1866e7f0f..ffc97ce1d 100644
--- a/gs/base/gxpcolor.h
+++ b/gs/base/gxpcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,57 +46,57 @@ struct gs_pattern_type_s {
int PatternType;
struct pp_ {
- /*
- * Define whether a Pattern uses the base color space in its color
- * space, requiring setcolor to provide values for the base color
- * space. Currently this is true for uncolored PatternType 1
- * patterns, false for all others.
- */
+ /*
+ * Define whether a Pattern uses the base color space in its color
+ * space, requiring setcolor to provide values for the base color
+ * space. Currently this is true for uncolored PatternType 1
+ * patterns, false for all others.
+ */
#define pattern_proc_uses_base_space(proc)\
bool proc(const gs_pattern_template_t *)
- pattern_proc_uses_base_space((*uses_base_space));
+ pattern_proc_uses_base_space((*uses_base_space));
- /*
- * Make an instance of a Pattern.
- */
+ /*
+ * Make an instance of a Pattern.
+ */
#define pattern_proc_make_pattern(proc)\
int proc(gs_client_color *, const gs_pattern_template_t *,\
- const gs_matrix *, gs_state *, gs_memory_t *)
+ const gs_matrix *, gs_state *, gs_memory_t *)
- pattern_proc_make_pattern((*make_pattern));
+ pattern_proc_make_pattern((*make_pattern));
- /*
- * Get the template from a Pattern instance.
- */
+ /*
+ * Get the template from a Pattern instance.
+ */
#define pattern_proc_get_pattern(proc)\
const gs_pattern_template_t *proc(const gs_pattern_instance_t *)
- pattern_proc_get_pattern((*get_pattern));
+ pattern_proc_get_pattern((*get_pattern));
- /*
- * Remap a Pattern color to a device color.
- * cs_proc_remap_color is defined in gxcspace.h.
- */
+ /*
+ * Remap a Pattern color to a device color.
+ * cs_proc_remap_color is defined in gxcspace.h.
+ */
#define pattern_proc_remap_color(proc)\
cs_proc_remap_color(proc)
- pattern_proc_remap_color((*remap_color));
+ pattern_proc_remap_color((*remap_color));
- /*
- * Perform any special actions required when a pattern instance
- * is made the current color "color" (i.e.: at setcolor time).
- * This is primarily useful for PatternType2 patterns, where the
- * pattern instance specifies a color space.
- */
+ /*
+ * Perform any special actions required when a pattern instance
+ * is made the current color "color" (i.e.: at setcolor time).
+ * This is primarily useful for PatternType2 patterns, where the
+ * pattern instance specifies a color space.
+ */
#define pattern_proc_set_color(proc)\
int proc(const gs_client_color *, gs_state *)
- pattern_proc_set_color((*set_color));
+ pattern_proc_set_color((*set_color));
} procs;
};
@@ -106,15 +106,15 @@ struct gs_pattern_type_s {
* the use of gs_pattern*_init implementations, not clients.
*/
void gs_pattern_common_init(gs_pattern_template_t *,
- const gs_pattern_type_t *);
+ const gs_pattern_type_t *);
/*
* Do the generic work for makepattern: allocate the instance and the
* saved graphics state, and fill in the common members.
*/
int gs_make_pattern_common(gs_client_color *, const gs_pattern_template_t *,
- const gs_matrix *, gs_state *, gs_memory_t *,
- gs_memory_type_ptr_t);
+ const gs_matrix *, gs_state *, gs_memory_t *,
+ gs_memory_type_ptr_t);
/* Declare the freeing procedure for Pattern instances. */
extern rc_free_proc(rc_free_pattern_instance);
@@ -148,7 +148,6 @@ extern dev_color_proc_read(gx_dc_pattern_read);
*/
extern dev_color_proc_get_nonzero_comps(gx_dc_pattern_get_nonzero_comps);
-
/* Used for keeping a buffer of the pattern that containes an alpha channel
in a planar form. Since we must be going from the pdf14 compositor through
the pattern accumulator and then back to a pdf14 compositor it makes sense
@@ -158,7 +157,7 @@ typedef struct gx_pattern_trans_s gx_pattern_trans_t;
struct gx_pattern_trans_s {
- const gx_device *pdev14;
+ const gx_device *pdev14;
byte *transbytes;
gx_pattern_trans_t *fill_trans_buffer; /* buffer to fill */
gs_int_rect rect;
@@ -171,17 +170,17 @@ struct gx_pattern_trans_s {
const pdf14_nonseparable_blending_procs_t *blending_procs;
bool is_additive;
gs_blend_mode_t blending_mode;
- void (* pat_trans_fill)(int xmin, int ymin, int xmax, int ymax, int px,
+ void (* pat_trans_fill)(int xmin, int ymin, int xmax, int ymax, int px,
int py, const gx_color_tile *ptile,
gx_pattern_trans_t *fill_trans_buffer);
- int (* image_render)(gx_image_enum * penum, const byte * buffer,
+ int (* image_render)(gx_image_enum * penum, const byte * buffer,
int data_x, uint w, int h, gx_device * dev);
};
#define private_st_pattern_trans() /* in gxpcmap.c */\
gs_private_st_ptrs3(st_pattern_trans, gx_pattern_trans_t, "gx_pattern_trans",\
- pattern_trans_enum_ptrs, pattern_trans_reloc_ptrs,\
- pdev14, transbytes, fill_trans_buffer)
+ pattern_trans_enum_ptrs, pattern_trans_reloc_ptrs,\
+ pdev14, transbytes, fill_trans_buffer)
/*
* Define a color tile, an entry in the rendered Pattern cache (and
* eventually in the colored halftone cache). Note that the depth is
@@ -215,7 +214,7 @@ struct gx_color_tile_s {
gx_device_clist *cdev; /* not NULL if the graphics is a command list. */
byte is_simple; /* true if xstep/ystep = tile size */
byte has_overlap; /* true if step size is smaller than bounding box */
- byte is_dummy; /* if true, the device manages the pattern,
+ byte is_dummy; /* if true, the device manages the pattern,
and the content of the tile is empty. */
byte pad[2]; /* structure members alignment. */
/* The following is neither key nor value. */
@@ -281,54 +280,53 @@ typedef struct gx_device_pattern_accum_s {
instance, bits, mask, transbuff)
/* Allocate a pattern accumulator. */
-gx_device_forward * gx_pattern_accum_alloc(gs_memory_t * mem,
- gs_memory_t * stoarge_memory,
- gs_pattern1_instance_t *pinst, client_name_t cname);
+gx_device_forward * gx_pattern_accum_alloc(gs_memory_t * mem,
+ gs_memory_t * stoarge_memory,
+ gs_pattern1_instance_t *pinst, client_name_t cname);
/* Add an accumulated pattern to the cache. */
/* Note that this does not free any of the data in the accumulator */
/* device, but it may zero out the bitmap_memory pointers to prevent */
/* the accumulated bitmaps from being freed when the device is closed. */
int gx_pattern_cache_add_entry(gs_imager_state *, gx_device_forward *,
- gx_color_tile **);
+ gx_color_tile **);
/* Add a dummy Pattern cache entry. Stubs a pattern tile for interpreter when
device handles high level patterns. */
int gx_pattern_cache_add_dummy_entry(gs_imager_state *pis, gs_pattern1_instance_t *pinst,
- int depth);
+ int depth);
/* Get entry for reading a pattern from clist. */
int gx_pattern_cache_get_entry(gs_imager_state * pis, gs_id id, gx_color_tile ** pctile);
-
/* Look up a pattern color in the cache. */
bool gx_pattern_cache_lookup(gx_device_color *, const gs_imager_state *,
- gx_device *, gs_color_select_t);
+ gx_device *, gs_color_select_t);
/* Purge selected entries from the pattern cache. */
void gx_pattern_cache_winnow(gx_pattern_cache *,
- bool (*)(gx_color_tile *, void *),
- void *);
+ bool (*)(gx_color_tile *, void *),
+ void *);
bool gx_pattern_tile_is_clist(gx_color_tile *ptile);
dev_proc_open_device(pattern_clist_open_device);
/* Code to fill a pdf14 transparency rectangles with a pattern trans buffer object */
-int gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax,
- gx_color_tile *ptile,
- gx_pattern_trans_t *fill_trans_buffer,
+int gx_trans_pattern_fill_rect(int xmin, int ymin, int xmax, int ymax,
+ gx_color_tile *ptile,
+ gx_pattern_trans_t *fill_trans_buffer,
gs_int_point phase);
gx_pattern_trans_t* new_pattern_trans_buff(gs_memory_t *mem);
-void tile_rect_trans_simple(int xmin, int ymin, int xmax, int ymax, int px,
+void tile_rect_trans_simple(int xmin, int ymin, int xmax, int ymax, int px,
int py, const gx_color_tile *ptile,
gx_pattern_trans_t *fill_trans_buffer);
-/* This is used for the case when we may have overlapping tiles.
- We need to get better detection for this as
+/* This is used for the case when we may have overlapping tiles.
+ We need to get better detection for this as
it would be best to avoid doing it if not needed. */
-void tile_rect_trans_blend(int xmin, int ymin, int xmax, int ymax, int px,
+void tile_rect_trans_blend(int xmin, int ymin, int xmax, int ymax, int px,
int py, const gx_color_tile *ptile,
gx_pattern_trans_t *fill_trans_buffer);
diff --git a/gs/base/gxpcopy.c b/gs/base/gxpcopy.c
index 5777a68fe..fa8dc7a79 100644
--- a/gs/base/gxpcopy.c
+++ b/gs/base/gxpcopy.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,7 +24,7 @@
/* Forward declarations */
static void adjust_point_to_tangent(segment *, const segment *,
- const gs_fixed_point *);
+ const gs_fixed_point *);
static inline int
break_line_if_long(gx_path *ppath, const segment *pseg)
@@ -33,33 +33,32 @@ break_line_if_long(gx_path *ppath, const segment *pseg)
fixed y0 = ppath->position.y;
if (gx_check_fixed_diff_overflow(pseg->pt.x, x0) ||
- gx_check_fixed_diff_overflow(pseg->pt.y, y0)) {
- fixed x, y;
-
- if (gx_check_fixed_sum_overflow(pseg->pt.x, x0))
- x = (pseg->pt.x >> 1) + (x0 >> 1);
- else
- x = (pseg->pt.x + x0) >> 1;
- if (gx_check_fixed_sum_overflow(pseg->pt.y, y0))
- y = (pseg->pt.y >> 1) + (y0 >> 1);
- else
- y = (pseg->pt.y + y0) >> 1;
- return gx_path_add_line_notes(ppath, x, y, pseg->notes);
- /* WARNING: Stringly speaking, the next half segment must get
- the sn_not_first flag. We don't bother, because that flag
- has no important meaning with colinear segments.
- */
+ gx_check_fixed_diff_overflow(pseg->pt.y, y0)) {
+ fixed x, y;
+
+ if (gx_check_fixed_sum_overflow(pseg->pt.x, x0))
+ x = (pseg->pt.x >> 1) + (x0 >> 1);
+ else
+ x = (pseg->pt.x + x0) >> 1;
+ if (gx_check_fixed_sum_overflow(pseg->pt.y, y0))
+ y = (pseg->pt.y >> 1) + (y0 >> 1);
+ else
+ y = (pseg->pt.y + y0) >> 1;
+ return gx_path_add_line_notes(ppath, x, y, pseg->notes);
+ /* WARNING: Stringly speaking, the next half segment must get
+ the sn_not_first flag. We don't bother, because that flag
+ has no important meaning with colinear segments.
+ */
}
return 0;
}
-
/* Copy a path, optionally flattening or monotonizing it. */
/* If the copy fails, free the new path. */
int
gx_path_copy_reducing(const gx_path *ppath_old, gx_path *ppath,
- fixed fixed_flatness, const gs_imager_state *pis,
- gx_path_copy_options options)
+ fixed fixed_flatness, const gs_imager_state *pis,
+ gx_path_copy_options options)
{
const segment *pseg;
fixed flat = fixed_flatness;
@@ -71,78 +70,78 @@ gx_path_copy_reducing(const gx_path *ppath_old, gx_path *ppath,
int code = gx_path_unshare(ppath);
if (code < 0)
- return code;
+ return code;
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath_old, "before reducing");
+ gx_dump_path(ppath_old, "before reducing");
#endif
if (options & pco_for_stroke) {
- /* Precompute the maximum expansion of the bounding box. */
- double width = pis->line_params.half_width;
-
- expansion.x =
- float2fixed((fabs(pis->ctm.xx) + fabs(pis->ctm.yx)) * width) * 2;
- expansion.y =
- float2fixed((fabs(pis->ctm.xy) + fabs(pis->ctm.yy)) * width) * 2;
- } else
- expansion.x = expansion.y = 0; /* Quiet gcc warning. */
+ /* Precompute the maximum expansion of the bounding box. */
+ double width = pis->line_params.half_width;
+
+ expansion.x =
+ float2fixed((fabs(pis->ctm.xx) + fabs(pis->ctm.yx)) * width) * 2;
+ expansion.y =
+ float2fixed((fabs(pis->ctm.xy) + fabs(pis->ctm.yy)) * width) * 2;
+ } else
+ expansion.x = expansion.y = 0; /* Quiet gcc warning. */
vd_setcolor(RGB(255,255,0));
pseg = (const segment *)(ppath_old->first_subpath);
while (pseg) {
- switch (pseg->type) {
- case s_start:
- code = gx_path_add_point(ppath,
- pseg->pt.x, pseg->pt.y);
- vd_moveto(pseg->pt.x, pseg->pt.y);
- break;
- case s_curve:
- {
- const curve_segment *pc = (const curve_segment *)pseg;
-
- if (fixed_flatness == max_fixed) { /* don't flatten */
- if (options & pco_monotonize)
- code = gx_curve_monotonize(ppath, pc);
- else
- code = gx_path_add_curve_notes(ppath,
- pc->p1.x, pc->p1.y, pc->p2.x, pc->p2.y,
- pc->pt.x, pc->pt.y, pseg->notes);
- } else {
- fixed x0 = ppath->position.x;
- fixed y0 = ppath->position.y;
- segment_notes notes = pseg->notes;
- curve_segment cseg;
- int k;
-
- if (options & pco_for_stroke) {
- /*
- * When flattening for stroking, the flatness
- * must apply to the outside of the resulting
- * stroked region. We approximate this by
- * dividing the flatness by the ratio of the
- * expanded bounding box to the original
- * bounding box. This is crude, but pretty
- * simple to calculate, and produces reasonably
- * good results.
- */
- fixed min01, max01, min23, max23;
- fixed ex, ey, flat_x, flat_y;
+ switch (pseg->type) {
+ case s_start:
+ code = gx_path_add_point(ppath,
+ pseg->pt.x, pseg->pt.y);
+ vd_moveto(pseg->pt.x, pseg->pt.y);
+ break;
+ case s_curve:
+ {
+ const curve_segment *pc = (const curve_segment *)pseg;
+
+ if (fixed_flatness == max_fixed) { /* don't flatten */
+ if (options & pco_monotonize)
+ code = gx_curve_monotonize(ppath, pc);
+ else
+ code = gx_path_add_curve_notes(ppath,
+ pc->p1.x, pc->p1.y, pc->p2.x, pc->p2.y,
+ pc->pt.x, pc->pt.y, pseg->notes);
+ } else {
+ fixed x0 = ppath->position.x;
+ fixed y0 = ppath->position.y;
+ segment_notes notes = pseg->notes;
+ curve_segment cseg;
+ int k;
+
+ if (options & pco_for_stroke) {
+ /*
+ * When flattening for stroking, the flatness
+ * must apply to the outside of the resulting
+ * stroked region. We approximate this by
+ * dividing the flatness by the ratio of the
+ * expanded bounding box to the original
+ * bounding box. This is crude, but pretty
+ * simple to calculate, and produces reasonably
+ * good results.
+ */
+ fixed min01, max01, min23, max23;
+ fixed ex, ey, flat_x, flat_y;
#define SET_EXTENT(r, c0, c1, c2, c3)\
BEGIN\
- if (c0 < c1) min01 = c0, max01 = c1;\
- else min01 = c1, max01 = c0;\
- if (c2 < c3) min23 = c2, max23 = c3;\
- else min23 = c3, max23 = c2;\
- r = max(max01, max23) - min(min01, min23);\
+ if (c0 < c1) min01 = c0, max01 = c1;\
+ else min01 = c1, max01 = c0;\
+ if (c2 < c3) min23 = c2, max23 = c3;\
+ else min23 = c3, max23 = c2;\
+ r = max(max01, max23) - min(min01, min23);\
END
- SET_EXTENT(ex, x0, pc->p1.x, pc->p2.x, pc->pt.x);
- SET_EXTENT(ey, y0, pc->p1.y, pc->p2.y, pc->pt.y);
+ SET_EXTENT(ex, x0, pc->p1.x, pc->p2.x, pc->pt.x);
+ SET_EXTENT(ey, y0, pc->p1.y, pc->p2.y, pc->pt.y);
#undef SET_EXTENT
- /*
- * We check for the degenerate case specially
- * to avoid a division by zero.
- */
- if (ex == 0 || ey == 0)
+ /*
+ * We check for the degenerate case specially
+ * to avoid a division by zero.
+ */
+ if (ex == 0 || ey == 0)
if (ex != 0) {
flat = fixed_mult_quo(fixed_flatness, ex,
ex + expansion.x);
@@ -153,116 +152,116 @@ gx_path_copy_reducing(const gx_path *ppath_old, gx_path *ppath,
k = gx_curve_log2_samples(x0,y0,pc,flat);
} else
k = 0;
- else {
- flat_x =
- fixed_mult_quo(fixed_flatness, ex,
- ex + expansion.x);
- flat_y =
- fixed_mult_quo(fixed_flatness, ey,
- ey + expansion.y);
- flat = min(flat_x, flat_y);
- k = gx_curve_log2_samples(x0, y0, pc, flat);
- }
- } else
- k = gx_curve_log2_samples(x0, y0, pc, flat);
- if (options & pco_accurate) {
- segment *start;
- segment *end;
-
- /*
- * Add an extra line, which will become
- * the tangent segment.
- */
- code = gx_path_add_line_notes(ppath, x0, y0,
- notes);
- if (code < 0)
- break;
- vd_lineto(x0, y0);
- start = ppath->current_subpath->last;
- notes |= sn_not_first;
- cseg = *pc;
- code = gx_subdivide_curve(ppath, k, &cseg, notes);
- if (code < 0)
- break;
- /*
- * Adjust the first and last segments so that
- * they line up with the tangents.
- */
- end = ppath->current_subpath->last;
- vd_lineto(ppath->position.x, ppath->position.y);
- if ((code = gx_path_add_line_notes(ppath,
- ppath->position.x,
- ppath->position.y,
- pseg->notes | sn_not_first)) < 0)
- break;
- if (start->next->pt.x != pc->p1.x || start->next->pt.y != pc->p1.y)
- adjust_point_to_tangent(start, start->next, &pc->p1);
- else if (start->next->pt.x != pc->p2.x || start->next->pt.y != pc->p2.y)
- adjust_point_to_tangent(start, start->next, &pc->p2);
- else
- adjust_point_to_tangent(start, start->next, &end->prev->pt);
- if (end->prev->pt.x != pc->p2.x || end->prev->pt.y != pc->p2.y)
- adjust_point_to_tangent(end, end->prev, &pc->p2);
- else if (end->prev->pt.x != pc->p1.x || end->prev->pt.y != pc->p1.y)
- adjust_point_to_tangent(end, end->prev, &pc->p1);
- else
- adjust_point_to_tangent(end, end->prev, &start->pt);
- } else {
- cseg = *pc;
- code = gx_subdivide_curve(ppath, k, &cseg, notes);
- }
- }
- break;
- }
- case s_line:
- code = break_line_if_long(ppath, pseg);
- if (code < 0)
- break;
- code = gx_path_add_line_notes(ppath,
- pseg->pt.x, pseg->pt.y, pseg->notes);
- vd_lineto(pseg->pt.x, pseg->pt.y);
- break;
- case s_dash:
- {
- const dash_segment *pd = (const dash_segment *)pseg;
-
- code = gx_path_add_dash_notes(ppath,
- pd->pt.x, pd->pt.y, pd->tangent.x, pd->tangent.y, pseg->notes);
- break;
- }
- case s_line_close:
- code = break_line_if_long(ppath, pseg);
- if (code < 0)
- break;
- code = gx_path_close_subpath(ppath);
- vd_closepath;
- break;
- default: /* can't happen */
- code = gs_note_error(gs_error_unregistered);
- }
- if (code < 0) {
- gx_path_new(ppath);
- return code;
- }
- pseg = pseg->next;
+ else {
+ flat_x =
+ fixed_mult_quo(fixed_flatness, ex,
+ ex + expansion.x);
+ flat_y =
+ fixed_mult_quo(fixed_flatness, ey,
+ ey + expansion.y);
+ flat = min(flat_x, flat_y);
+ k = gx_curve_log2_samples(x0, y0, pc, flat);
+ }
+ } else
+ k = gx_curve_log2_samples(x0, y0, pc, flat);
+ if (options & pco_accurate) {
+ segment *start;
+ segment *end;
+
+ /*
+ * Add an extra line, which will become
+ * the tangent segment.
+ */
+ code = gx_path_add_line_notes(ppath, x0, y0,
+ notes);
+ if (code < 0)
+ break;
+ vd_lineto(x0, y0);
+ start = ppath->current_subpath->last;
+ notes |= sn_not_first;
+ cseg = *pc;
+ code = gx_subdivide_curve(ppath, k, &cseg, notes);
+ if (code < 0)
+ break;
+ /*
+ * Adjust the first and last segments so that
+ * they line up with the tangents.
+ */
+ end = ppath->current_subpath->last;
+ vd_lineto(ppath->position.x, ppath->position.y);
+ if ((code = gx_path_add_line_notes(ppath,
+ ppath->position.x,
+ ppath->position.y,
+ pseg->notes | sn_not_first)) < 0)
+ break;
+ if (start->next->pt.x != pc->p1.x || start->next->pt.y != pc->p1.y)
+ adjust_point_to_tangent(start, start->next, &pc->p1);
+ else if (start->next->pt.x != pc->p2.x || start->next->pt.y != pc->p2.y)
+ adjust_point_to_tangent(start, start->next, &pc->p2);
+ else
+ adjust_point_to_tangent(start, start->next, &end->prev->pt);
+ if (end->prev->pt.x != pc->p2.x || end->prev->pt.y != pc->p2.y)
+ adjust_point_to_tangent(end, end->prev, &pc->p2);
+ else if (end->prev->pt.x != pc->p1.x || end->prev->pt.y != pc->p1.y)
+ adjust_point_to_tangent(end, end->prev, &pc->p1);
+ else
+ adjust_point_to_tangent(end, end->prev, &start->pt);
+ } else {
+ cseg = *pc;
+ code = gx_subdivide_curve(ppath, k, &cseg, notes);
+ }
+ }
+ break;
+ }
+ case s_line:
+ code = break_line_if_long(ppath, pseg);
+ if (code < 0)
+ break;
+ code = gx_path_add_line_notes(ppath,
+ pseg->pt.x, pseg->pt.y, pseg->notes);
+ vd_lineto(pseg->pt.x, pseg->pt.y);
+ break;
+ case s_dash:
+ {
+ const dash_segment *pd = (const dash_segment *)pseg;
+
+ code = gx_path_add_dash_notes(ppath,
+ pd->pt.x, pd->pt.y, pd->tangent.x, pd->tangent.y, pseg->notes);
+ break;
+ }
+ case s_line_close:
+ code = break_line_if_long(ppath, pseg);
+ if (code < 0)
+ break;
+ code = gx_path_close_subpath(ppath);
+ vd_closepath;
+ break;
+ default: /* can't happen */
+ code = gs_note_error(gs_error_unregistered);
+ }
+ if (code < 0) {
+ gx_path_new(ppath);
+ return code;
+ }
+ pseg = pseg->next;
}
if (path_last_is_moveto(ppath_old))
- gx_path_add_point(ppath, ppath_old->position.x,
- ppath_old->position.y);
+ gx_path_add_point(ppath, ppath_old->position.x,
+ ppath_old->position.y);
if (ppath_old->bbox_set) {
- if (ppath->bbox_set) {
- ppath->bbox.p.x = min(ppath_old->bbox.p.x, ppath->bbox.p.x);
- ppath->bbox.p.y = min(ppath_old->bbox.p.y, ppath->bbox.p.y);
- ppath->bbox.q.x = max(ppath_old->bbox.q.x, ppath->bbox.q.x);
- ppath->bbox.q.y = max(ppath_old->bbox.q.y, ppath->bbox.q.y);
- } else {
- ppath->bbox_set = true;
- ppath->bbox = ppath_old->bbox;
- }
+ if (ppath->bbox_set) {
+ ppath->bbox.p.x = min(ppath_old->bbox.p.x, ppath->bbox.p.x);
+ ppath->bbox.p.y = min(ppath_old->bbox.p.y, ppath->bbox.p.y);
+ ppath->bbox.q.x = max(ppath_old->bbox.q.x, ppath->bbox.q.x);
+ ppath->bbox.q.y = max(ppath_old->bbox.q.y, ppath->bbox.q.y);
+ } else {
+ ppath->bbox_set = true;
+ ppath->bbox = ppath_old->bbox;
+ }
}
#ifdef DEBUG
if (gs_debug_c('P'))
- gx_dump_path(ppath, "after reducing");
+ gx_dump_path(ppath, "after reducing");
#endif
return 0;
}
@@ -280,7 +279,7 @@ gx_path_copy_reducing(const gx_path *ppath_old, gx_path *ppath,
*/
static void
adjust_point_to_tangent(segment * pseg, const segment * next,
- const gs_fixed_point * p1)
+ const gs_fixed_point * p1)
{
const fixed x0 = pseg->pt.x, y0 = pseg->pt.y;
const fixed fC = p1->x - x0, fD = p1->y - y0;
@@ -291,39 +290,39 @@ adjust_point_to_tangent(segment * pseg, const segment * next,
* we can handle it with far less work (and no floating point).
*/
if (fC == 0) {
- /* Vertical tangent. */
- const fixed DT = arith_rshift(next->pt.y - y0, 2);
-
- if (fD == 0)
- return; /* anomalous case */
- if_debug1('2', "[2]adjusting vertical: DT = %g\n",
- fixed2float(DT));
- if ((DT ^ fD) > 0)
- pseg->pt.y = DT + y0;
+ /* Vertical tangent. */
+ const fixed DT = arith_rshift(next->pt.y - y0, 2);
+
+ if (fD == 0)
+ return; /* anomalous case */
+ if_debug1('2', "[2]adjusting vertical: DT = %g\n",
+ fixed2float(DT));
+ if ((DT ^ fD) > 0)
+ pseg->pt.y = DT + y0;
} else if (fD == 0) {
- /* Horizontal tangent. */
- const fixed CT = arith_rshift(next->pt.x - x0, 2);
+ /* Horizontal tangent. */
+ const fixed CT = arith_rshift(next->pt.x - x0, 2);
- if_debug1('2', "[2]adjusting horizontal: CT = %g\n",
- fixed2float(CT));
- if ((CT ^ fC) > 0)
- pseg->pt.x = CT + x0;
+ if_debug1('2', "[2]adjusting horizontal: CT = %g\n",
+ fixed2float(CT));
+ if ((CT ^ fC) > 0)
+ pseg->pt.x = CT + x0;
} else {
- /* General case. */
- const double C = fC, D = fD;
- double T = (C * (next->pt.x - x0) + D * (next->pt.y - y0)) /
- (C * C + D * D);
-
- if_debug3('2', "[2]adjusting: C = %g, D = %g, T = %g\n",
- C, D, T);
- if (T > 0) {
- if (T > 1) {
- /* Don't go outside the curve bounding box. */
- T = 1;
- }
- pseg->pt.x = arith_rshift((fixed) (C * T), 2) + x0;
- pseg->pt.y = arith_rshift((fixed) (D * T), 2) + y0;
- }
+ /* General case. */
+ const double C = fC, D = fD;
+ double T = (C * (next->pt.x - x0) + D * (next->pt.y - y0)) /
+ (C * C + D * D);
+
+ if_debug3('2', "[2]adjusting: C = %g, D = %g, T = %g\n",
+ C, D, T);
+ if (T > 0) {
+ if (T > 1) {
+ /* Don't go outside the curve bounding box. */
+ T = 1;
+ }
+ pseg->pt.x = arith_rshift((fixed) (C * T), 2) + x0;
+ pseg->pt.y = arith_rshift((fixed) (D * T), 2) + y0;
+ }
}
}
@@ -338,56 +337,56 @@ gx_path__check_curves(const gx_path * ppath, gx_path_copy_options options, fixed
pt0.x = pt0.y = 0; /* Quiet gcc warning. */
while (pseg) {
- switch (pseg->type) {
- case s_start:
- {
- const subpath *psub = (const subpath *)pseg;
-
- /* Skip subpaths without curves. */
- if (!psub->curve_count)
- pseg = psub->last;
- }
- break;
- case s_line:
- if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
- gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
- return false;
- break;
- case s_curve:
- {
- const curve_segment *pc = (const curve_segment *)pseg;
-
- if (options & pco_monotonize) {
- double t[2];
- int nz = gx_curve_monotonic_points(pt0.y,
- pc->p1.y, pc->p2.y, pc->pt.y, t);
-
- if (nz != 0)
- return false;
- nz = gx_curve_monotonic_points(pt0.x,
- pc->p1.x, pc->p2.x, pc->pt.x, t);
- if (nz != 0)
- return false;
- }
- if (options & pco_small_curves) {
- fixed ax, bx, cx, ay, by, cy;
- int k = gx_curve_log2_samples(pt0.x, pt0.y, pc, fixed_flat);
-
- if(!curve_coeffs_ranged(pt0.x, pc->p1.x, pc->p2.x, pc->pt.x,
- pt0.y, pc->p1.y, pc->p2.y, pc->pt.y,
- &ax, &bx, &cx, &ay, &by, &cy, k))
- return false;
- if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
- gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
- return false;
- }
- }
- break;
- default:
- ;
- }
- pt0 = pseg->pt;
- pseg = pseg->next;
+ switch (pseg->type) {
+ case s_start:
+ {
+ const subpath *psub = (const subpath *)pseg;
+
+ /* Skip subpaths without curves. */
+ if (!psub->curve_count)
+ pseg = psub->last;
+ }
+ break;
+ case s_line:
+ if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
+ gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
+ return false;
+ break;
+ case s_curve:
+ {
+ const curve_segment *pc = (const curve_segment *)pseg;
+
+ if (options & pco_monotonize) {
+ double t[2];
+ int nz = gx_curve_monotonic_points(pt0.y,
+ pc->p1.y, pc->p2.y, pc->pt.y, t);
+
+ if (nz != 0)
+ return false;
+ nz = gx_curve_monotonic_points(pt0.x,
+ pc->p1.x, pc->p2.x, pc->pt.x, t);
+ if (nz != 0)
+ return false;
+ }
+ if (options & pco_small_curves) {
+ fixed ax, bx, cx, ay, by, cy;
+ int k = gx_curve_log2_samples(pt0.x, pt0.y, pc, fixed_flat);
+
+ if(!curve_coeffs_ranged(pt0.x, pc->p1.x, pc->p2.x, pc->pt.x,
+ pt0.y, pc->p1.y, pc->p2.y, pc->pt.y,
+ &ax, &bx, &cx, &ay, &by, &cy, k))
+ return false;
+ if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
+ gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
+ return false;
+ }
+ }
+ break;
+ default:
+ ;
+ }
+ pt0 = pseg->pt;
+ pseg = pseg->next;
}
return true;
}
@@ -407,17 +406,17 @@ gx_path_has_long_segments(const gx_path * ppath)
pt0.x = pt0.y = 0; /* Quiet gcc warning. */
while (pseg) {
- switch (pseg->type) {
- case s_start:
- break;
- default:
- if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
- gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
- return true;
- break;
- }
- pt0 = pseg->pt;
- pseg = pseg->next;
+ switch (pseg->type) {
+ case s_start:
+ break;
+ default:
+ if (gx_check_fixed_diff_overflow(pseg->pt.x, pt0.x) ||
+ gx_check_fixed_diff_overflow(pseg->pt.y, pt0.y))
+ return true;
+ break;
+ }
+ pt0 = pseg->pt;
+ pseg = pseg->next;
}
return false;
}
@@ -441,40 +440,40 @@ gx_curve_monotonize(gx_path * ppath, const curve_segment * pc)
n1 = gx_curve_monotonic_points(y0, pc->p1.y, pc->p2.y, pc->pt.y, t + n0);
n = n0 + n1;
if (n == 0)
- return gx_path_add_curve_notes(ppath, pc->p1.x, pc->p1.y,
- pc->p2.x, pc->p2.y, pc->pt.x, pc->pt.y, notes);
+ return gx_path_add_curve_notes(ppath, pc->p1.x, pc->p1.y,
+ pc->p2.x, pc->p2.y, pc->pt.x, pc->pt.y, notes);
if (n0 > 0)
- c[0] = 1;
+ c[0] = 1;
if (n0 > 1)
- c[1] = 1;
+ c[1] = 1;
if (n1 > 0)
- c[n0] = 2;
+ c[n0] = 2;
if (n1 > 1)
- c[n0 + 1] = 2;
+ c[n0 + 1] = 2;
/* Order roots : */
for (i = 0; i < n; i++)
- for (j = i + 1; j < n; j++)
- if (t[i] > t[j]) {
- int w;
- double v = t[i]; t[i] = t[j]; t[j] = v;
- w = c[i]; c[i] = c[j]; c[j] = w;
- }
+ for (j = i + 1; j < n; j++)
+ if (t[i] > t[j]) {
+ int w;
+ double v = t[i]; t[i] = t[j]; t[j] = v;
+ w = c[i]; c[i] = c[j]; c[j] = w;
+ }
/* Drop roots near zero : */
for (k = 0; k < n; k++)
- if (t[k] >= delta)
- break;
+ if (t[k] >= delta)
+ break;
/* Merge close roots, and drop roots at 1 : */
if (t[n - 1] > 1 - delta)
- n--;
+ n--;
for (i = k + 1, j = k; i < n && t[k] < 1 - delta; i++)
- if (any_abs(t[i] - t[j]) < delta) {
- t[j] = (t[j] + t[i]) / 2; /* Unlikely 3 roots are close. */
- c[j] |= c[i];
- } else {
- j++;
- t[j] = t[i];
- c[j] = c[i];
- }
+ if (any_abs(t[i] - t[j]) < delta) {
+ t[j] = (t[j] + t[i]) / 2; /* Unlikely 3 roots are close. */
+ c[j] |= c[i];
+ } else {
+ j++;
+ t[j] = t[i];
+ c[j] = c[i];
+ }
n = j + 1;
/* Do split : */
curve_points_to_coefficients(x0, pc->p1.x, pc->p2.x, pc->pt.x, ax, bx, cx, v01, v12);
@@ -487,37 +486,37 @@ gx_curve_monotonize(gx_path * ppath, const curve_segment * pc)
qy = (fixed)((pc->p1.y - py) * t[0] + 0.5);
tp = 0;
for (i = k; i < n; i++) {
- double ti = t[i];
- double t2 = ti * ti, t3 = t2 * ti;
- double omt = 1 - ti, omt2 = omt * omt, omt3 = omt2 * omt;
- double x = x0 * omt3 + 3 * pc->p1.x * omt2 * ti + 3 * pc->p2.x * omt * t2 + pc->pt.x * t3;
- double y = y0 * omt3 + 3 * pc->p1.y * omt2 * ti + 3 * pc->p2.y * omt * t2 + pc->pt.y * t3;
- double ddx = (c[i] & 1 ? 0 : ax * t2 + bx * ti + cx); /* Suppress noise. */
- double ddy = (c[i] & 2 ? 0 : ay * t2 + by * ti + cy);
- fixed dx = (fixed)(ddx + 0.5);
- fixed dy = (fixed)(ddy + 0.5);
- int code;
-
- tt = (i + 1 < n ? t[i + 1] : 1) - ti;
- rx = (fixed)(dx * (t[i] - tp) / 3 + 0.5);
- ry = (fixed)(dy * (t[i] - tp) / 3 + 0.5);
- sx = (fixed)(x + 0.5);
- sy = (fixed)(y + 0.5);
- /* Suppress the derivative sign noise near a peak : */
- if ((double)(sx - px) * qx + (double)(sy - py) * qy < 0)
- qx = -qx, qy = -qy;
- if ((double)(sx - px) * rx + (double)(sy - py) * ry < 0)
- rx = -rx, ry = -qy;
- /* Do add : */
- code = gx_path_add_curve_notes(ppath, px + qx, py + qy, sx - rx, sy - ry, sx, sy, notes);
- if (code < 0)
- return code;
- notes |= sn_not_first;
- px = sx;
- py = sy;
- qx = (fixed)(dx * tt / 3 + 0.5);
- qy = (fixed)(dy * tt / 3 + 0.5);
- tp = t[i];
+ double ti = t[i];
+ double t2 = ti * ti, t3 = t2 * ti;
+ double omt = 1 - ti, omt2 = omt * omt, omt3 = omt2 * omt;
+ double x = x0 * omt3 + 3 * pc->p1.x * omt2 * ti + 3 * pc->p2.x * omt * t2 + pc->pt.x * t3;
+ double y = y0 * omt3 + 3 * pc->p1.y * omt2 * ti + 3 * pc->p2.y * omt * t2 + pc->pt.y * t3;
+ double ddx = (c[i] & 1 ? 0 : ax * t2 + bx * ti + cx); /* Suppress noise. */
+ double ddy = (c[i] & 2 ? 0 : ay * t2 + by * ti + cy);
+ fixed dx = (fixed)(ddx + 0.5);
+ fixed dy = (fixed)(ddy + 0.5);
+ int code;
+
+ tt = (i + 1 < n ? t[i + 1] : 1) - ti;
+ rx = (fixed)(dx * (t[i] - tp) / 3 + 0.5);
+ ry = (fixed)(dy * (t[i] - tp) / 3 + 0.5);
+ sx = (fixed)(x + 0.5);
+ sy = (fixed)(y + 0.5);
+ /* Suppress the derivative sign noise near a peak : */
+ if ((double)(sx - px) * qx + (double)(sy - py) * qy < 0)
+ qx = -qx, qy = -qy;
+ if ((double)(sx - px) * rx + (double)(sy - py) * ry < 0)
+ rx = -rx, ry = -qy;
+ /* Do add : */
+ code = gx_path_add_curve_notes(ppath, px + qx, py + qy, sx - rx, sy - ry, sx, sy, notes);
+ if (code < 0)
+ return code;
+ notes |= sn_not_first;
+ px = sx;
+ py = sy;
+ qx = (fixed)(dx * tt / 3 + 0.5);
+ qy = (fixed)(dy * tt / 3 + 0.5);
+ tp = t[i];
}
sx = pc->pt.x;
sy = pc->pt.y;
@@ -525,9 +524,9 @@ gx_curve_monotonize(gx_path * ppath, const curve_segment * pc)
ry = (fixed)((pc->pt.y - pc->p2.y) * tt + 0.5);
/* Suppress the derivative sign noise near peaks : */
if ((double)(sx - px) * qx + (double)(sy - py) * qy < 0)
- qx = -qx, qy = -qy;
+ qx = -qx, qy = -qy;
if ((double)(sx - px) * rx + (double)(sy - py) * ry < 0)
- rx = -rx, ry = -qy;
+ rx = -rx, ry = -qy;
return gx_path_add_curve_notes(ppath, px + qx, py + qy, sx - rx, sy - ry, sx, sy, notes);
}
@@ -540,7 +539,7 @@ gx_curve_monotonize(gx_path * ppath, const curve_segment * pc)
*/
int
gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
- double pst[2])
+ double pst[2])
{
/*
Let
@@ -570,11 +569,11 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
This zero is valid iff sign(c) != sign(b) and 0 < |c| < 2*|b|.
*/
if (a == 0) {
- if ((b ^ c) < 0 && any_abs(c) < any_abs(b2) && c != 0) {
- *pst = (double)(-c) / b2;
- return 1;
- } else
- return 0;
+ if ((b ^ c) < 0 && any_abs(c) < any_abs(b2) && c != 0) {
+ *pst = (double)(-c) / b2;
+ return 1;
+ } else
+ return 0;
}
/*
Iff a curve is horizontal at t = 0, c = 0. In this case,
@@ -582,11 +581,11 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
This zero is valid iff sign(a) != sign(b) and 0 < 2*|b| < 3*|a|.
*/
if (c == 0) {
- if ((a ^ b) < 0 && any_abs(b2) < any_abs(a3) && b != 0) {
- *pst = (double)(-b2) / a3;
- return 1;
- } else
- return 0;
+ if ((a ^ b) < 0 && any_abs(b2) < any_abs(a3) && b != 0) {
+ *pst = (double)(-b2) / a3;
+ return 1;
+ } else
+ return 0;
}
/*
Similarly, iff a curve is horizontal at t = 1, 3*a + 2*b + c = 0.
@@ -595,14 +594,14 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
i.e., 3*|a| < 2*|b| < 6*|a|.
*/
else if ((dv_end = a3 + b2 + c) == 0) {
- if ((a ^ b) < 0 &&
- (b2abs = any_abs(b2)) > (a3abs = any_abs(a3)) &&
- b2abs < a3abs << 1
- ) {
- *pst = (double)(-b2 - a3) / a3;
- return 1;
- } else
- return 0;
+ if ((a ^ b) < 0 &&
+ (b2abs = any_abs(b2)) > (a3abs = any_abs(a3)) &&
+ b2abs < a3abs << 1
+ ) {
+ *pst = (double)(-b2 - a3) / a3;
+ return 1;
+ } else
+ return 0;
}
/*
If sign(dv_end) != sign(c), at least one valid zero exists,
@@ -616,7 +615,7 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
at both endpoints.
*/
else if ((a ^ b) >= 0)
- return 0;
+ return 0;
/*
Otherwise, dv(t) may be non-monotonic on [0..1]; it has valid zeros
iff its sign anywhere in this interval is different from its sign
@@ -631,7 +630,7 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
Note that we just determined that sign(a) != sign(b), so we know t1 > 0.
*/
else if (any_abs(b) >= any_abs(a3))
- return 0;
+ return 0;
/*
Otherwise, we just go ahead with the computation of the roots,
and test them for being in the correct range. Note that a valid
@@ -639,48 +638,48 @@ gx_curve_monotonic_points(fixed v0, fixed v1, fixed v2, fixed v3,
bother to check for this case, since it's rare.
*/
{
- double nbf = (double)(-b);
- double a3f = (double)a3;
- double radicand = nbf * nbf - a3f * c;
-
- if (radicand < 0) {
- if_debug1('2', "[2]negative radicand = %g\n", radicand);
- return 0;
- } {
- double root = sqrt(radicand);
- int nzeros = 0;
- double z = (nbf - root) / a3f;
-
- /*
- * We need to return the zeros in the correct order.
- * We know that root is non-negative, but a3f may be either
- * positive or negative, so we need to check the ordering
- * explicitly.
- */
- if_debug2('2', "[2]zeros at %g, %g\n", z, (nbf + root) / a3f);
- if (z > 0 && z < 1)
- *pst = z, nzeros = 1;
- if (root != 0) {
- z = (nbf + root) / a3f;
- if (z > 0 && z < 1) {
- if (nzeros && a3f < 0) /* order is reversed */
- pst[1] = *pst, *pst = z;
- else
- pst[nzeros] = z;
- nzeros++;
- }
- }
- return nzeros;
- }
+ double nbf = (double)(-b);
+ double a3f = (double)a3;
+ double radicand = nbf * nbf - a3f * c;
+
+ if (radicand < 0) {
+ if_debug1('2', "[2]negative radicand = %g\n", radicand);
+ return 0;
+ } {
+ double root = sqrt(radicand);
+ int nzeros = 0;
+ double z = (nbf - root) / a3f;
+
+ /*
+ * We need to return the zeros in the correct order.
+ * We know that root is non-negative, but a3f may be either
+ * positive or negative, so we need to check the ordering
+ * explicitly.
+ */
+ if_debug2('2', "[2]zeros at %g, %g\n", z, (nbf + root) / a3f);
+ if (z > 0 && z < 1)
+ *pst = z, nzeros = 1;
+ if (root != 0) {
+ z = (nbf + root) / a3f;
+ if (z > 0 && z < 1) {
+ if (nzeros && a3f < 0) /* order is reversed */
+ pst[1] = *pst, *pst = z;
+ else
+ pst[nzeros] = z;
+ nzeros++;
+ }
+ }
+ return nzeros;
+ }
}
}
/* ---------------- Path optimization for the filling algorithm. ---------------- */
static bool
-find_contacting_segments(const subpath *sp0, segment *sp0last,
- const subpath *sp1, segment *sp1last,
- segment **sc0, segment **sc1)
+find_contacting_segments(const subpath *sp0, segment *sp0last,
+ const subpath *sp1, segment *sp1last,
+ segment **sc0, segment **sc1)
{
segment *s0, *s1;
const segment *s0s, *s1s;
@@ -691,44 +690,44 @@ find_contacting_segments(const subpath *sp0, segment *sp0last,
"Quazi-vertical" means dx <= 1 && dy >= min_length . */
/* To avoid a big unuseful expence of the processor time,
we search the first subpath from the end
- (assuming that it was recently merged near the end),
- and restrict the search with search_limit segments
- against a quadratic scanning of two long subpaths.
+ (assuming that it was recently merged near the end),
+ and restrict the search with search_limit segments
+ against a quadratic scanning of two long subpaths.
Thus algorithm is not necessary finds anything contacting.
Instead it either quickly finds something, or maybe not. */
for (s0 = sp0last, count0 = 0; count0 < search_limit && s0 != (segment *)sp0; s0 = s0->prev, count0++) {
- s0s = s0->prev;
- if (s0->type == s_line && (s0s->pt.x == s0->pt.x ||
- (any_abs(s0s->pt.x - s0->pt.x) == 1 && any_abs(s0s->pt.y - s0->pt.y) > min_length))) {
- for (s1 = sp1last, count1 = 0; count1 < search_limit && s1 != (segment *)sp1; s1 = s1->prev, count1++) {
- s1s = s1->prev;
- if (s1->type == s_line && (s1s->pt.x == s1->pt.x ||
- (any_abs(s1s->pt.x - s1->pt.x) == 1 && any_abs(s1s->pt.y - s1->pt.y) > min_length))) {
- if (s0s->pt.x == s1s->pt.x || s0->pt.x == s1->pt.x || s0->pt.x == s1s->pt.x || s0s->pt.x == s1->pt.x) {
- if (s0s->pt.y < s0->pt.y && s1s->pt.y > s1->pt.y) {
- fixed y0 = max(s0s->pt.y, s1->pt.y);
- fixed y1 = min(s0->pt.y, s1s->pt.y);
-
- if (y0 <= y1) {
- *sc0 = s0;
- *sc1 = s1;
- return true;
- }
- }
- if (s0s->pt.y > s0->pt.y && s1s->pt.y < s1->pt.y) {
- fixed y0 = max(s0->pt.y, s1s->pt.y);
- fixed y1 = min(s0s->pt.y, s1->pt.y);
-
- if (y0 <= y1) {
- *sc0 = s0;
- *sc1 = s1;
- return true;
- }
- }
- }
- }
- }
- }
+ s0s = s0->prev;
+ if (s0->type == s_line && (s0s->pt.x == s0->pt.x ||
+ (any_abs(s0s->pt.x - s0->pt.x) == 1 && any_abs(s0s->pt.y - s0->pt.y) > min_length))) {
+ for (s1 = sp1last, count1 = 0; count1 < search_limit && s1 != (segment *)sp1; s1 = s1->prev, count1++) {
+ s1s = s1->prev;
+ if (s1->type == s_line && (s1s->pt.x == s1->pt.x ||
+ (any_abs(s1s->pt.x - s1->pt.x) == 1 && any_abs(s1s->pt.y - s1->pt.y) > min_length))) {
+ if (s0s->pt.x == s1s->pt.x || s0->pt.x == s1->pt.x || s0->pt.x == s1s->pt.x || s0s->pt.x == s1->pt.x) {
+ if (s0s->pt.y < s0->pt.y && s1s->pt.y > s1->pt.y) {
+ fixed y0 = max(s0s->pt.y, s1->pt.y);
+ fixed y1 = min(s0->pt.y, s1s->pt.y);
+
+ if (y0 <= y1) {
+ *sc0 = s0;
+ *sc1 = s1;
+ return true;
+ }
+ }
+ if (s0s->pt.y > s0->pt.y && s1s->pt.y < s1->pt.y) {
+ fixed y0 = max(s0->pt.y, s1s->pt.y);
+ fixed y1 = min(s0s->pt.y, s1->pt.y);
+
+ if (y0 <= y1) {
+ *sc0 = s0;
+ *sc1 = s1;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
}
return false;
}
@@ -744,75 +743,74 @@ gx_path_merge_contacting_contours(gx_path *ppath)
subpath *sp0 = ppath->segments->contents.subpath_first;
for (; sp0 != NULL; sp0 = (subpath *)sp0->last->next) {
- segment *sp0last = sp0->last;
- subpath *sp1 = (subpath *)sp0last->next, *spnext;
- subpath *sp1p = sp0;
- int count;
-
- for (count = 0; sp1 != NULL && count < window; sp1 = spnext, count++) {
- segment *sp1last = sp1->last;
- segment *sc0, *sc1, *old_first;
-
- spnext = (subpath *)sp1last->next;
- if (find_contacting_segments(sp0, sp0last, sp1, sp1last, &sc0, &sc1)) {
- /* Detach the subpath 1 from the path: */
- sp1->prev->next = sp1last->next;
- if (sp1last->next != NULL)
- sp1last->next->prev = sp1->prev;
- sp1->prev = 0;
- sp1last->next = 0;
- old_first = sp1->next;
- /* sp1 is not longer in use. Move subpath_current from it for safe removing : */
- if (ppath->segments->contents.subpath_current == sp1) {
- ppath->segments->contents.subpath_current = sp1p;
- }
- if (sp1last->type == s_line_close) {
- /* Change 'closepath' of the subpath 1 to a line (maybe degenerate) : */
- sp1last->type = s_line;
- /* sp1 is not longer in use. Free it : */
- gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
- } else if (sp1last->pt.x == sp1->pt.x && sp1last->pt.y == sp1->pt.y) {
- /* Implicit closepath with zero length. Don't need a new segment. */
- /* sp1 is not longer in use. Free it : */
- gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
- } else {
- /* Insert the closing line segment. */
- /* sp1 is not longer in use. Convert it to the line segment : */
- sp1->type = s_line;
- sp1last->next = (segment *)sp1;
- sp1->next = NULL;
- sp1->prev = sp1last;
- sp1->last = NULL; /* Safety for garbager. */
- sp1last = (segment *)sp1;
- }
- sp1 = 0; /* Safety. */
- /* Rotate the subpath 1 to sc1 : */
- { /* Detach s_start and make a loop : */
- sp1last->next = old_first;
- old_first->prev = sp1last;
- /* Unlink before sc1 : */
- sp1last = sc1->prev;
- sc1->prev->next = 0;
- sc1->prev = 0; /* Safety. */
- /* sp1 is not longer in use. Free it : */
- if (ppath->segments->contents.subpath_current == sp1) {
- ppath->segments->contents.subpath_current = sp1p;
- }
- gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
- sp1 = 0; /* Safety. */
- }
- /* Insert the subpath 1 into the subpath 0 before sc0 :*/
- sc0->prev->next = sc1;
- sc1->prev = sc0->prev;
- sp1last->next = sc0;
- sc0->prev = sp1last;
- /* Remove degenearte "bridge" segments : (fixme: Not done due to low importance). */
- /* Edit the subpath count : */
- ppath->subpath_count--;
- } else
- sp1p = sp1;
- }
+ segment *sp0last = sp0->last;
+ subpath *sp1 = (subpath *)sp0last->next, *spnext;
+ subpath *sp1p = sp0;
+ int count;
+
+ for (count = 0; sp1 != NULL && count < window; sp1 = spnext, count++) {
+ segment *sp1last = sp1->last;
+ segment *sc0, *sc1, *old_first;
+
+ spnext = (subpath *)sp1last->next;
+ if (find_contacting_segments(sp0, sp0last, sp1, sp1last, &sc0, &sc1)) {
+ /* Detach the subpath 1 from the path: */
+ sp1->prev->next = sp1last->next;
+ if (sp1last->next != NULL)
+ sp1last->next->prev = sp1->prev;
+ sp1->prev = 0;
+ sp1last->next = 0;
+ old_first = sp1->next;
+ /* sp1 is not longer in use. Move subpath_current from it for safe removing : */
+ if (ppath->segments->contents.subpath_current == sp1) {
+ ppath->segments->contents.subpath_current = sp1p;
+ }
+ if (sp1last->type == s_line_close) {
+ /* Change 'closepath' of the subpath 1 to a line (maybe degenerate) : */
+ sp1last->type = s_line;
+ /* sp1 is not longer in use. Free it : */
+ gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
+ } else if (sp1last->pt.x == sp1->pt.x && sp1last->pt.y == sp1->pt.y) {
+ /* Implicit closepath with zero length. Don't need a new segment. */
+ /* sp1 is not longer in use. Free it : */
+ gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
+ } else {
+ /* Insert the closing line segment. */
+ /* sp1 is not longer in use. Convert it to the line segment : */
+ sp1->type = s_line;
+ sp1last->next = (segment *)sp1;
+ sp1->next = NULL;
+ sp1->prev = sp1last;
+ sp1->last = NULL; /* Safety for garbager. */
+ sp1last = (segment *)sp1;
+ }
+ sp1 = 0; /* Safety. */
+ /* Rotate the subpath 1 to sc1 : */
+ { /* Detach s_start and make a loop : */
+ sp1last->next = old_first;
+ old_first->prev = sp1last;
+ /* Unlink before sc1 : */
+ sp1last = sc1->prev;
+ sc1->prev->next = 0;
+ sc1->prev = 0; /* Safety. */
+ /* sp1 is not longer in use. Free it : */
+ if (ppath->segments->contents.subpath_current == sp1) {
+ ppath->segments->contents.subpath_current = sp1p;
+ }
+ gs_free_object(gs_memory_stable(ppath->memory), sp1, "gx_path_merge_contacting_contours");
+ sp1 = 0; /* Safety. */
+ }
+ /* Insert the subpath 1 into the subpath 0 before sc0 :*/
+ sc0->prev->next = sc1;
+ sc1->prev = sc0->prev;
+ sp1last->next = sc0;
+ sc0->prev = sp1last;
+ /* Remove degenearte "bridge" segments : (fixme: Not done due to low importance). */
+ /* Edit the subpath count : */
+ ppath->subpath_count--;
+ } else
+ sp1p = sp1;
+ }
}
return 0;
}
-
diff --git a/gs/base/gxpdash.c b/gs/base/gxpdash.c
index 66c8a625b..9732990bb 100644
--- a/gs/base/gxpdash.c
+++ b/gs/base/gxpdash.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,28 +27,28 @@
/* Expand a dashed path into explicit segments. */
/* The path contains no curves. */
static int subpath_expand_dashes(const subpath *, gx_path *,
- const gs_imager_state *,
- const gx_dash_params *);
+ const gs_imager_state *,
+ const gx_dash_params *);
int
gx_path_add_dash_expansion(const gx_path * ppath_old, gx_path * ppath,
- const gs_imager_state * pis)
+ const gs_imager_state * pis)
{
const subpath *psub;
const gx_dash_params *dash = &gs_currentlineparams(pis)->dash;
int code = 0;
if (dash->pattern_size == 0)
- return gx_path_copy(ppath_old, ppath);
+ return gx_path_copy(ppath_old, ppath);
for (psub = ppath_old->first_subpath; psub != 0 && code >= 0;
- psub = (const subpath *)psub->last->next
- )
- code = subpath_expand_dashes(psub, ppath, pis, dash);
+ psub = (const subpath *)psub->last->next
+ )
+ code = subpath_expand_dashes(psub, ppath, pis, dash);
return code;
}
static int
subpath_expand_dashes(const subpath * psub, gx_path * ppath,
- const gs_imager_state * pis, const gx_dash_params * dash)
+ const gs_imager_state * pis, const gx_dash_params * dash)
{
const float *pattern = dash->pattern;
int count, index;
@@ -77,7 +77,7 @@ subpath_expand_dashes(const subpath * psub, gx_path * ppath,
}
if ((code = gx_path_add_point(ppath, x0, y0)) < 0)
- return code;
+ return code;
/*
* To do the right thing at the beginning of a closed path, we have
* to skip any initial line, and then redo it at the end of the
@@ -91,84 +91,84 @@ subpath_expand_dashes(const subpath * psub, gx_path * ppath,
x = x0, y = y0;
pseg = (const segment *)psub;
while ((pseg = pseg->next) != 0 && pseg->type != s_start) {
- fixed sx = pseg->pt.x, sy = pseg->pt.y;
- fixed udx = sx - x, udy = sy - y;
- double length, dx, dy;
- double scale = 1;
- double left;
+ fixed sx = pseg->pt.x, sy = pseg->pt.y;
+ fixed udx = sx - x, udy = sy - y;
+ double length, dx, dy;
+ double scale = 1;
+ double left;
- if (!(udx | udy)) { /* degenerate */
- if (pgs_lp->dot_length == 0 &&
- cap != gs_cap_round) {
- /* From PLRM, stroke operator :
- If a subpath is degenerate (consists of a single-point closed path
- or of two or more points at the same coordinates),
- stroke paints it only if round line caps have been specified */
- if (zero_length || pseg->type != s_line_close)
- continue;
- }
- dx = 0, dy = 0, length = 0;
- } else {
- gs_point d;
+ if (!(udx | udy)) { /* degenerate */
+ if (pgs_lp->dot_length == 0 &&
+ cap != gs_cap_round) {
+ /* From PLRM, stroke operator :
+ If a subpath is degenerate (consists of a single-point closed path
+ or of two or more points at the same coordinates),
+ stroke paints it only if round line caps have been specified */
+ if (zero_length || pseg->type != s_line_close)
+ continue;
+ }
+ dx = 0, dy = 0, length = 0;
+ } else {
+ gs_point d;
- zero_length = false;
- dx = udx, dy = udy; /* scaled as fixed */
- gs_imager_idtransform(pis, dx, dy, &d);
- length = hypot(d.x, d.y) * (1.0 / fixed_1);
- if (gs_imager_currentdashadapt(pis)) {
- double reps = length / dash->pattern_length;
+ zero_length = false;
+ dx = udx, dy = udy; /* scaled as fixed */
+ gs_imager_idtransform(pis, dx, dy, &d);
+ length = hypot(d.x, d.y) * (1.0 / fixed_1);
+ if (gs_imager_currentdashadapt(pis)) {
+ double reps = length / dash->pattern_length;
- scale = reps / ceil(reps);
- /* Ensure we're starting at the start of a */
- /* repetition. (This shouldn't be necessary, */
- /* but it is.) */
- count = dash->pattern_size;
- ink_on = dash->init_ink_on;
- index = dash->init_index;
- elt_length = dash->init_dist_left * scale;
- }
- }
- left = length;
- while (left > elt_length) { /* We are using up the line segment. */
- double fraction = elt_length / length;
- fixed fx = (fixed) (dx * fraction);
- fixed fy = (fixed) (dy * fraction);
- fixed nx = x + fx;
- fixed ny = y + fy;
+ scale = reps / ceil(reps);
+ /* Ensure we're starting at the start of a */
+ /* repetition. (This shouldn't be necessary, */
+ /* but it is.) */
+ count = dash->pattern_size;
+ ink_on = dash->init_ink_on;
+ index = dash->init_index;
+ elt_length = dash->init_dist_left * scale;
+ }
+ }
+ left = length;
+ while (left > elt_length) { /* We are using up the line segment. */
+ double fraction = elt_length / length;
+ fixed fx = (fixed) (dx * fraction);
+ fixed fy = (fixed) (dy * fraction);
+ fixed nx = x + fx;
+ fixed ny = y + fy;
- if (ink_on) {
- if (drawing >= 0) {
- if (left >= elt_length && any_abs(fx) + any_abs(fy) < fixed_half)
- code = gx_path_add_dash_notes(ppath, nx, ny, udx, udy,
+ if (ink_on) {
+ if (drawing >= 0) {
+ if (left >= elt_length && any_abs(fx) + any_abs(fy) < fixed_half)
+ code = gx_path_add_dash_notes(ppath, nx, ny, udx, udy,
((notes & pseg->notes)|
start_notes|
sn_dash_tail));
- else
- code = gx_path_add_line_notes(ppath, nx, ny,
- ((notes & pseg->notes)|
+ else
+ code = gx_path_add_line_notes(ppath, nx, ny,
+ ((notes & pseg->notes)|
start_notes|
sn_dash_tail));
- }
- notes |= sn_not_first;
- } else {
- if (drawing > 0) /* done */
- return 0;
- code = gx_path_add_point(ppath, nx, ny);
- notes &= ~sn_not_first;
- drawing = 0;
- }
- if (code < 0)
- return code;
- left -= elt_length;
- ink_on = !ink_on;
- start_notes = sn_dash_head;
- if (++index == count)
- index = 0;
- elt_length = pattern[index] * scale;
- x = nx, y = ny;
- }
- elt_length -= left;
- /* Handle the last dash of a segment. */
+ }
+ notes |= sn_not_first;
+ } else {
+ if (drawing > 0) /* done */
+ return 0;
+ code = gx_path_add_point(ppath, nx, ny);
+ notes &= ~sn_not_first;
+ drawing = 0;
+ }
+ if (code < 0)
+ return code;
+ left -= elt_length;
+ ink_on = !ink_on;
+ start_notes = sn_dash_head;
+ if (++index == count)
+ index = 0;
+ elt_length = pattern[index] * scale;
+ x = nx, y = ny;
+ }
+ elt_length -= left;
+ /* Handle the last dash of a segment. */
if (wrap) {
/* We are wrapping, therefore we always use the dash cap */
end_notes = sn_dash_tail;
@@ -177,7 +177,7 @@ subpath_expand_dashes(const subpath * psub, gx_path * ppath,
* before the next move or end of subpath. (i.e. should we use an
* end cap or a dash cap?) */
const segment *pseg2 = pseg->next;
-
+
end_notes = 0;
while (pseg2 != 0 && pseg2->type != s_start)
{
@@ -190,84 +190,84 @@ subpath_expand_dashes(const subpath * psub, gx_path * ppath,
}
}
on:if (ink_on) {
- if (drawing >= 0) {
- if (pseg->type == s_line_close && drawing > 0)
- code = gx_path_close_subpath_notes(ppath,
+ if (drawing >= 0) {
+ if (pseg->type == s_line_close && drawing > 0)
+ code = gx_path_close_subpath_notes(ppath,
((notes & pseg->notes)|
start_notes |
end_notes));
- else if ((any_abs(sx - x) + any_abs(sy - y) < fixed_half) &&
- (udx | udy))
- /* If we only need to move a short distance, then output
- * dash notes to ensure that the stroke tangent remains
- * accurate. There is no point in outputting such dash
- * notes if we don't have any useful information to put
- * in the note though (if udx == 0 && udy == 0). */
- code = gx_path_add_dash_notes(ppath, sx, sy, udx, udy,
+ else if ((any_abs(sx - x) + any_abs(sy - y) < fixed_half) &&
+ (udx | udy))
+ /* If we only need to move a short distance, then output
+ * dash notes to ensure that the stroke tangent remains
+ * accurate. There is no point in outputting such dash
+ * notes if we don't have any useful information to put
+ * in the note though (if udx == 0 && udy == 0). */
+ code = gx_path_add_dash_notes(ppath, sx, sy, udx, udy,
((notes & pseg->notes)|
start_notes | end_notes));
- else
- code = gx_path_add_line_notes(ppath, sx, sy,
+ else
+ code = gx_path_add_line_notes(ppath, sx, sy,
((notes & pseg->notes)|
start_notes | end_notes));
- notes |= sn_not_first;
- }
- } else {
- code = gx_path_add_point(ppath, sx, sy);
- notes &= ~sn_not_first;
- if (elt_length < fixed2float(fixed_epsilon) &&
- (pseg->next == 0 || pseg->next->type == s_start || elt_length == 0)) {
+ notes |= sn_not_first;
+ }
+ } else {
+ code = gx_path_add_point(ppath, sx, sy);
+ notes &= ~sn_not_first;
+ if (elt_length < fixed2float(fixed_epsilon) &&
+ (pseg->next == 0 || pseg->next->type == s_start || elt_length == 0)) {
/*
* Ink is off, but we're within epsilon of the end
- * of the dash element.
+ * of the dash element.
* "Stretch" a little so we get a dot.
* Also if the next dash pattern is zero length,
* use the last segment orientation.
*/
- double elt_length1;
+ double elt_length1;
- if (code < 0)
- return code;
- if (++index == count)
- index = 0;
- elt_length1 = pattern[index] * scale;
- if (pseg->next == 0 || pseg->next->type == s_start) {
- elt_length = elt_length1;
- left = 0;
- ink_on = true;
- goto on;
- }
- /* Looking ahead one dash pattern element.
- If it is zero length, apply to the current segment
- (at its end). */
- if (elt_length1 == 0) {
- left = 0;
- code = gx_path_add_dash_notes(ppath, sx, sy, udx, udy,
+ if (code < 0)
+ return code;
+ if (++index == count)
+ index = 0;
+ elt_length1 = pattern[index] * scale;
+ if (pseg->next == 0 || pseg->next->type == s_start) {
+ elt_length = elt_length1;
+ left = 0;
+ ink_on = true;
+ goto on;
+ }
+ /* Looking ahead one dash pattern element.
+ If it is zero length, apply to the current segment
+ (at its end). */
+ if (elt_length1 == 0) {
+ left = 0;
+ code = gx_path_add_dash_notes(ppath, sx, sy, udx, udy,
((notes & pseg->notes)|
start_notes | end_notes));
- if (++index == count)
- index = 0;
- elt_length = pattern[index] * scale;
- ink_on = false;
- } else if (--index == 0) {
- /* Revert lookahead. */
- index = count - 1;
- }
- }
- if (drawing > 0) /* done */
- return code;
- drawing = 0;
- }
- if (code < 0)
- return code;
- x = sx, y = sy;
- cap = pgs_lp->dash_cap;
+ if (++index == count)
+ index = 0;
+ elt_length = pattern[index] * scale;
+ ink_on = false;
+ } else if (--index == 0) {
+ /* Revert lookahead. */
+ index = count - 1;
+ }
+ }
+ if (drawing > 0) /* done */
+ return code;
+ drawing = 0;
+ }
+ if (code < 0)
+ return code;
+ x = sx, y = sy;
+ cap = pgs_lp->dash_cap;
}
/* Check for wraparound. */
if (wrap && drawing <= 0) { /* We skipped some initial lines. */
- /* Go back and do them now. */
- drawing = 1;
- goto top;
+ /* Go back and do them now. */
+ drawing = 1;
+ goto top;
}
return 0;
}
diff --git a/gs/base/gxpflat.c b/gs/base/gxpflat.c
index fa106d467..c69db8adb 100644
--- a/gs/base/gxpflat.c
+++ b/gs/base/gxpflat.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,50 +46,50 @@
*/
int
gx_curve_log2_samples(fixed x0, fixed y0, const curve_segment * pc,
- fixed fixed_flat)
+ fixed fixed_flat)
{
fixed
- x03 = pc->pt.x - x0,
- y03 = pc->pt.y - y0;
+ x03 = pc->pt.x - x0,
+ y03 = pc->pt.y - y0;
int k;
if (x03 < 0)
- x03 = -x03;
+ x03 = -x03;
if (y03 < 0)
- y03 = -y03;
+ y03 = -y03;
if ((x03 | y03) < int2fixed(16))
- fixed_flat >>= 1;
+ fixed_flat >>= 1;
if (fixed_flat == 0) { /* Use the conservative method. */
- fixed m = max(x03, y03);
+ fixed m = max(x03, y03);
- for (k = 1; m > fixed_1;)
- k++, m >>= 1;
+ for (k = 1; m > fixed_1;)
+ k++, m >>= 1;
} else {
- const fixed
- x12 = pc->p1.x - pc->p2.x, y12 = pc->p1.y - pc->p2.y,
- dx0 = x0 - pc->p1.x - x12, dy0 = y0 - pc->p1.y - y12,
- dx1 = x12 - pc->p2.x + pc->pt.x, dy1 = y12 - pc->p2.y + pc->pt.y,
- adx0 = any_abs(dx0), ady0 = any_abs(dy0),
- adx1 = any_abs(dx1), ady1 = any_abs(dy1);
- fixed
- d = max(adx0, adx1) + max(ady0, ady1);
- /*
- * The following statement is split up to work around a
- * bug in the gcc 2.7.2 optimizer on H-P RISC systems.
- */
- uint qtmp = d - (d >> 2) /* 3/4 * D */ +fixed_flat - 1;
- uint q = qtmp / fixed_flat;
-
- if_debug6('2', "[2]d01=%g,%g d12=%g,%g d23=%g,%g\n",
- fixed2float(pc->p1.x - x0), fixed2float(pc->p1.y - y0),
- fixed2float(-x12), fixed2float(-y12),
- fixed2float(pc->pt.x - pc->p2.x), fixed2float(pc->pt.y - pc->p2.y));
- if_debug2('2', " D=%f, flat=%f,",
- fixed2float(d), fixed2float(fixed_flat));
- /* Now we want to set k = ceiling(log2(q) / 2). */
- for (k = 0; q > 1;)
- k++, q = (q + 3) >> 2;
- if_debug1('2', " k=%d\n", k);
+ const fixed
+ x12 = pc->p1.x - pc->p2.x, y12 = pc->p1.y - pc->p2.y,
+ dx0 = x0 - pc->p1.x - x12, dy0 = y0 - pc->p1.y - y12,
+ dx1 = x12 - pc->p2.x + pc->pt.x, dy1 = y12 - pc->p2.y + pc->pt.y,
+ adx0 = any_abs(dx0), ady0 = any_abs(dy0),
+ adx1 = any_abs(dx1), ady1 = any_abs(dy1);
+ fixed
+ d = max(adx0, adx1) + max(ady0, ady1);
+ /*
+ * The following statement is split up to work around a
+ * bug in the gcc 2.7.2 optimizer on H-P RISC systems.
+ */
+ uint qtmp = d - (d >> 2) /* 3/4 * D */ +fixed_flat - 1;
+ uint q = qtmp / fixed_flat;
+
+ if_debug6('2', "[2]d01=%g,%g d12=%g,%g d23=%g,%g\n",
+ fixed2float(pc->p1.x - x0), fixed2float(pc->p1.y - y0),
+ fixed2float(-x12), fixed2float(-y12),
+ fixed2float(pc->pt.x - pc->p2.x), fixed2float(pc->pt.y - pc->p2.y));
+ if_debug2('2', " D=%f, flat=%f,",
+ fixed2float(d), fixed2float(fixed_flat));
+ /* Now we want to set k = ceiling(log2(q) / 2). */
+ for (k = 0; q > 1;)
+ k++, q = (q + 3) >> 2;
+ if_debug1('2', " k=%d\n", k);
}
return k;
}
@@ -102,12 +102,12 @@ gx_curve_log2_samples(fixed x0, fixed y0, const curve_segment * pc,
*/
static void
split_curve_midpoint(fixed x0, fixed y0, const curve_segment * pc,
- curve_segment * pc1, curve_segment * pc2)
+ curve_segment * pc1, curve_segment * pc2)
{ /*
- * We have to define midpoint carefully to avoid overflow.
- * (If it overflows, something really pathological is going
- * on, but we could get infinite recursion that way....)
- */
+ * We have to define midpoint carefully to avoid overflow.
+ * (If it overflows, something really pathological is going
+ * on, but we could get infinite recursion that way....)
+ */
#define midpoint(a,b)\
(arith_rshift_1(a) + arith_rshift_1(b) + (((a) | (b)) & 1))
fixed x12 = midpoint(pc->p1.x, pc->p2.x);
@@ -126,8 +126,8 @@ split_curve_midpoint(fixed x0, fixed y0, const curve_segment * pc,
pc2->p1.x = midpoint(x12, pc2->p2.x);
pc2->p1.y = midpoint(y12, pc2->p2.y);
if (pc2 != pc)
- pc2->pt.x = pc->pt.x,
- pc2->pt.y = pc->pt.y;
+ pc2->pt.x = pc->pt.x,
+ pc2->pt.y = pc->pt.y;
pc1->pt.x = midpoint(pc1->p2.x, pc2->p1.x);
pc1->pt.y = midpoint(pc1->p2.y, pc2->p1.y);
#undef midpoint
@@ -136,51 +136,50 @@ split_curve_midpoint(fixed x0, fixed y0, const curve_segment * pc,
static inline void
print_points(const gs_fixed_point *points, int count)
{
-#ifdef DEBUG
+#ifdef DEBUG
int i;
if (!gs_debug_c('3'))
- return;
+ return;
for (i = 0; i < count; i++)
- if_debug2('3', "[3]out x=%ld y=%ld\n", points[i].x, points[i].y);
+ if_debug2('3', "[3]out x=%ld y=%ld\n", points[i].x, points[i].y);
#endif
}
-
bool
-curve_coeffs_ranged(fixed x0, fixed x1, fixed x2, fixed x3,
- fixed y0, fixed y1, fixed y2, fixed y3,
- fixed *ax, fixed *bx, fixed *cx,
- fixed *ay, fixed *by, fixed *cy,
- int k)
+curve_coeffs_ranged(fixed x0, fixed x1, fixed x2, fixed x3,
+ fixed y0, fixed y1, fixed y2, fixed y3,
+ fixed *ax, fixed *bx, fixed *cx,
+ fixed *ay, fixed *by, fixed *cy,
+ int k)
{
fixed x01, x12, y01, y12;
- curve_points_to_coefficients(x0, x1, x2, x3,
- *ax, *bx, *cx, x01, x12);
- curve_points_to_coefficients(y0, y1, y2, y3,
- *ay, *by, *cy, y01, y12);
+ curve_points_to_coefficients(x0, x1, x2, x3,
+ *ax, *bx, *cx, x01, x12);
+ curve_points_to_coefficients(y0, y1, y2, y3,
+ *ay, *by, *cy, y01, y12);
# define max_fast (max_fixed / 6)
# define min_fast (-max_fast)
# define in_range(v) (v < max_fast && v > min_fast)
if (k > k_sample_max ||
- !in_range(*ax) || !in_range(*ay) ||
- !in_range(*bx) || !in_range(*by) ||
- !in_range(*cx) || !in_range(*cy)
- )
- return false;
+ !in_range(*ax) || !in_range(*ay) ||
+ !in_range(*bx) || !in_range(*by) ||
+ !in_range(*cx) || !in_range(*cy)
+ )
+ return false;
#undef max_fast
#undef min_fast
#undef in_range
return true;
}
-/* Initialize the iterator.
+/* Initialize the iterator.
Momotonic curves with non-zero length are only allowed.
*/
bool
-gx_flattened_iterator__init(gx_flattened_iterator *this,
- fixed x0, fixed y0, const curve_segment *pc, int k)
+gx_flattened_iterator__init(gx_flattened_iterator *this,
+ fixed x0, fixed y0, const curve_segment *pc, int k)
{
/* Note : Immediately after the ininialization it keeps an invalid (zero length) segment. */
fixed x1, y1, x2, y2;
@@ -196,35 +195,35 @@ gx_flattened_iterator__init(gx_flattened_iterator *this,
this->x3 = pc->pt.x;
this->y3 = pc->pt.y;
if (!curve_coeffs_ranged(this->x0, x1, x2, this->x3,
- this->y0, y1, y2, this->y3,
- &this->ax, &this->bx, &this->cx,
- &this->ay, &this->by, &this->cy, k))
- return false;
+ this->y0, y1, y2, this->y3,
+ &this->ax, &this->bx, &this->cx,
+ &this->ay, &this->by, &this->cy, k))
+ return false;
this->curve = true;
vd_curve(this->x0, this->y0, x1, y1, x2, y2, this->x3, this->y3, 0, RGB(255, 255, 255));
this->k = k;
# ifdef DEBUG
- if (gs_debug_c('3')) {
- dlprintf4("[3]x0=%f y0=%f x1=%f y1=%f\n",
- fixed2float(this->x0), fixed2float(this->y0),
- fixed2float(x1), fixed2float(y1));
- dlprintf5(" x2=%f y2=%f x3=%f y3=%f k=%d\n",
- fixed2float(x2), fixed2float(y2),
- fixed2float(this->x3), fixed2float(this->y3), this->k);
- }
+ if (gs_debug_c('3')) {
+ dlprintf4("[3]x0=%f y0=%f x1=%f y1=%f\n",
+ fixed2float(this->x0), fixed2float(this->y0),
+ fixed2float(x1), fixed2float(y1));
+ dlprintf5(" x2=%f y2=%f x3=%f y3=%f k=%d\n",
+ fixed2float(x2), fixed2float(y2),
+ fixed2float(this->x3), fixed2float(this->y3), this->k);
+ }
# endif
if (k == -1) {
- /* A special hook for gx_subdivide_curve_rec.
- Only checked the range.
- Returning with no initialization. */
- return true;
+ /* A special hook for gx_subdivide_curve_rec.
+ Only checked the range.
+ Returning with no initialization. */
+ return true;
}
this->rmask = (1 << k3) - 1;
this->i = (1 << k);
this->rx = this->ry = 0;
if_debug6('3', "[3]ax=%f bx=%f cx=%f\n ay=%f by=%f cy=%f\n",
- fixed2float(this->ax), fixed2float(this->bx), fixed2float(this->cx),
- fixed2float(this->ay), fixed2float(this->by), fixed2float(this->cy));
+ fixed2float(this->ax), fixed2float(this->bx), fixed2float(this->cx),
+ fixed2float(this->ay), fixed2float(this->by), fixed2float(this->cy));
bx2 = this->bx << 1;
by2 = this->by << 1;
ax6 = ((this->ax << 1) + this->ax) << 1;
@@ -265,15 +264,15 @@ gx_flattened_iterator__init(gx_flattened_iterator *this,
return true;
}
-static inline bool
+static inline bool
check_diff_overflow(fixed v0, fixed v1)
{
if (v0 < v1) {
- if (v1 - v0 < 0)
- return true;
+ if (v1 - v0 < 0)
+ return true;
} else {
- if (v0 - v1 < 0)
- return true;
+ if (v0 - v1 < 0)
+ return true;
}
return false;
}
@@ -294,8 +293,8 @@ gx_check_fixed_sum_overflow(fixed v0, fixed v1)
/* Initialize the iterator with a line. */
bool
-gx_flattened_iterator__init_line(gx_flattened_iterator *this,
- fixed x0, fixed y0, fixed x1, fixed y1)
+gx_flattened_iterator__init_line(gx_flattened_iterator *this,
+ fixed x0, fixed y0, fixed x1, fixed y1)
{
bool ox = check_diff_overflow(x0, x1);
bool oy = check_diff_overflow(y0, y1);
@@ -305,30 +304,30 @@ gx_flattened_iterator__init_line(gx_flattened_iterator *this,
this->x3 = x1;
this->y3 = y1;
if (ox || oy) {
- /* Subdivide a long line into 4 segments, because the filling algorithm
- and the stroking algorithm need to compute differences
- of coordinates of end points.
- We can't use 2 segments, because gx_flattened_iterator__next
- implements a special code for that case,
- which requires differences of coordinates as well.
- */
- /* Note : the result of subdivision may be not strongly colinear. */
- this->ax = this->bx = 0;
- this->ay = this->by = 0;
- this->cx = ((ox ? (x1 >> 1) - (x0 >> 1) : (x1 - x0) >> 1) + 1) >> 1;
- this->cy = ((oy ? (y1 >> 1) - (y0 >> 1) : (y1 - y0) >> 1) + 1) >> 1;
- this->rd3x = this->rd3y = this->id3x = this->id3y = 0;
- this->rd2x = this->rd2y = this->id2x = this->id2y = 0;
- this->idx = this->cx;
- this->idy = this->cy;
- this->rdx = this->rdy = 0;
- this->rx = this->ry = 0;
- this->rmask = 0;
- this->k = 2;
- this->i = 4;
+ /* Subdivide a long line into 4 segments, because the filling algorithm
+ and the stroking algorithm need to compute differences
+ of coordinates of end points.
+ We can't use 2 segments, because gx_flattened_iterator__next
+ implements a special code for that case,
+ which requires differences of coordinates as well.
+ */
+ /* Note : the result of subdivision may be not strongly colinear. */
+ this->ax = this->bx = 0;
+ this->ay = this->by = 0;
+ this->cx = ((ox ? (x1 >> 1) - (x0 >> 1) : (x1 - x0) >> 1) + 1) >> 1;
+ this->cy = ((oy ? (y1 >> 1) - (y0 >> 1) : (y1 - y0) >> 1) + 1) >> 1;
+ this->rd3x = this->rd3y = this->id3x = this->id3y = 0;
+ this->rd2x = this->rd2y = this->id2x = this->id2y = 0;
+ this->idx = this->cx;
+ this->idy = this->cy;
+ this->rdx = this->rdy = 0;
+ this->rx = this->ry = 0;
+ this->rmask = 0;
+ this->k = 2;
+ this->i = 4;
} else {
- this->k = 0;
- this->i = 1;
+ this->k = 0;
+ this->i = 1;
}
this->curve = false;
return true;
@@ -339,16 +338,16 @@ static inline void
gx_flattened_iterator__print_state(gx_flattened_iterator *this)
{
if (!gs_debug_c('3'))
- return;
+ return;
dlprintf4("[3]dx=%f+%d, dy=%f+%d\n",
- fixed2float(this->idx), this->rdx,
- fixed2float(this->idy), this->rdy);
+ fixed2float(this->idx), this->rdx,
+ fixed2float(this->idy), this->rdy);
dlprintf4(" d2x=%f+%d, d2y=%f+%d\n",
- fixed2float(this->id2x), this->rd2x,
- fixed2float(this->id2y), this->rd2y);
+ fixed2float(this->id2x), this->rd2x,
+ fixed2float(this->id2y), this->rd2y);
dlprintf4(" d3x=%f+%d, d3y=%f+%d\n",
- fixed2float(this->id3x), this->rd3x,
- fixed2float(this->id3y), this->rd3y);
+ fixed2float(this->id3x), this->rd3x,
+ fixed2float(this->id3y), this->rd3y);
}
#endif
@@ -395,58 +394,58 @@ gx_flattened_iterator__next(gx_flattened_iterator *this)
fixed x = this->lx1, y = this->ly1;
if (this->i <= 0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
this->lx0 = this->lx1;
this->ly0 = this->ly1;
/* Fast check for N == 3, a common special case for small characters. */
if (this->k <= 1) {
- --this->i;
- if (this->i == 0)
- goto last;
+ --this->i;
+ if (this->i == 0)
+ goto last;
# define poly2(a,b,c) arith_rshift_1(arith_rshift_1(arith_rshift_1(a) + b) + c)
- x += poly2(this->ax, this->bx, this->cx);
- y += poly2(this->ay, this->by, this->cy);
+ x += poly2(this->ax, this->bx, this->cx);
+ y += poly2(this->ay, this->by, this->cy);
# undef poly2
- if_debug2('3', "[3]dx=%f, dy=%f\n",
- fixed2float(x - this->x0), fixed2float(y - this->y0));
- if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
- (((x ^ this->x0) | (y ^ this->y0)) & float2fixed(-0.5) ?
- "add" : "skip"),
- fixed2float(x), fixed2float(y), x, y);
- this->lx1 = x, this->ly1 = y;
- vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 255, 0));
- return true;
+ if_debug2('3', "[3]dx=%f, dy=%f\n",
+ fixed2float(x - this->x0), fixed2float(y - this->y0));
+ if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
+ (((x ^ this->x0) | (y ^ this->y0)) & float2fixed(-0.5) ?
+ "add" : "skip"),
+ fixed2float(x), fixed2float(y), x, y);
+ this->lx1 = x, this->ly1 = y;
+ vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 255, 0));
+ return true;
} else {
- --this->i;
- if (this->i == 0)
- goto last; /* don't bother with last accum */
+ --this->i;
+ if (this->i == 0)
+ goto last; /* don't bother with last accum */
# ifdef DEBUG
- gx_flattened_iterator__print_state(this);
+ gx_flattened_iterator__print_state(this);
# endif
# define accum(i, r, di, dr, rmask)\
- if ( (r += dr) > rmask ) r &= rmask, i += di + 1;\
- else i += di
- accum(x, this->rx, this->idx, this->rdx, this->rmask);
- accum(y, this->ry, this->idy, this->rdy, this->rmask);
- accum(this->idx, this->rdx, this->id2x, this->rd2x, this->rmask);
- accum(this->idy, this->rdy, this->id2y, this->rd2y, this->rmask);
- accum(this->id2x, this->rd2x, this->id3x, this->rd3x, this->rmask);
- accum(this->id2y, this->rd2y, this->id3y, this->rd3y, this->rmask);
- if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
- (((x ^ this->lx0) | (y ^ this->ly0)) & float2fixed(-0.5) ?
- "add" : "skip"),
- fixed2float(x), fixed2float(y), x, y);
+ if ( (r += dr) > rmask ) r &= rmask, i += di + 1;\
+ else i += di
+ accum(x, this->rx, this->idx, this->rdx, this->rmask);
+ accum(y, this->ry, this->idy, this->rdy, this->rmask);
+ accum(this->idx, this->rdx, this->id2x, this->rd2x, this->rmask);
+ accum(this->idy, this->rdy, this->id2y, this->rd2y, this->rmask);
+ accum(this->id2x, this->rd2x, this->id3x, this->rd3x, this->rmask);
+ accum(this->id2y, this->rd2y, this->id3y, this->rd3y, this->rmask);
+ if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
+ (((x ^ this->lx0) | (y ^ this->ly0)) & float2fixed(-0.5) ?
+ "add" : "skip"),
+ fixed2float(x), fixed2float(y), x, y);
# undef accum
- this->lx1 = this->x = x;
- this->ly1 = this->y = y;
- vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 255, 0));
- return true;
+ this->lx1 = this->x = x;
+ this->ly1 = this->y = y;
+ vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 255, 0));
+ return true;
}
last:
this->lx1 = this->x3;
this->ly1 = this->y3;
if_debug4('3', "[3]last x=%g, y=%g x=%ld y=%ld\n",
- fixed2float(this->lx1), fixed2float(this->ly1), this->lx1, this->ly1);
+ fixed2float(this->lx1), fixed2float(this->ly1), this->lx1, this->ly1);
vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 255, 0));
return false;
}
@@ -455,8 +454,8 @@ static inline void
gx_flattened_iterator__unaccum(gx_flattened_iterator *this)
{
# define unaccum(i, r, di, dr, rmask)\
- if ( r < dr ) r += rmask + 1 - dr, i -= di + 1;\
- else r -= dr, i -= di
+ if ( r < dr ) r += rmask + 1 - dr, i -= di + 1;\
+ else r -= dr, i -= di
unaccum(this->id2x, this->rd2x, this->id3x, this->rd3x, this->rmask);
unaccum(this->id2y, this->rd2y, this->id3y, this->rd3y, this->rmask);
unaccum(this->idx, this->rdx, this->id2x, this->rd2x, this->rmask);
@@ -476,29 +475,29 @@ gx_flattened_iterator__prev(gx_flattened_iterator *this)
bool last; /* i.e. the first one in the forth order. */
if (this->i >= 1 << this->k)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
this->lx1 = this->lx0;
this->ly1 = this->ly0;
if (this->k <= 1) {
- /* If k==0, we have a single segment, return it.
- If k==1 && i < 2, return the last segment.
- Otherwise must not pass here.
- We caould allow to pass here with this->i == 1 << this->k,
- but we want to check the assertion about the last segment below.
- */
- this->i++;
- this->lx0 = this->x0;
- this->ly0 = this->y0;
- vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 0, 255));
- return false;
+ /* If k==0, we have a single segment, return it.
+ If k==1 && i < 2, return the last segment.
+ Otherwise must not pass here.
+ We caould allow to pass here with this->i == 1 << this->k,
+ but we want to check the assertion about the last segment below.
+ */
+ this->i++;
+ this->lx0 = this->x0;
+ this->ly0 = this->y0;
+ vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 0, 255));
+ return false;
}
gx_flattened_iterator__unaccum(this);
this->i++;
# ifdef DEBUG
if_debug5('3', "[3]%s x=%g, y=%g x=%ld y=%ld\n",
- (((this->x ^ this->lx1) | (this->y ^ this->ly1)) & float2fixed(-0.5) ?
- "add" : "skip"),
- fixed2float(this->x), fixed2float(this->y), this->x, this->y);
+ (((this->x ^ this->lx1) | (this->y ^ this->ly1)) & float2fixed(-0.5) ?
+ "add" : "skip"),
+ fixed2float(this->x), fixed2float(this->y), this->x, this->y);
gx_flattened_iterator__print_state(this);
# endif
last = (this->i == (1 << this->k) - 1);
@@ -506,8 +505,8 @@ gx_flattened_iterator__prev(gx_flattened_iterator *this)
this->ly0 = this->y;
vd_bar(this->lx0, this->ly0, this->lx1, this->ly1, 1, RGB(0, 0, 255));
if (last)
- if (this->lx0 != this->x0 || this->ly0 != this->y0)
- return_error(gs_error_unregistered); /* Must not happen. */
+ if (this->lx0 != this->x0 || this->ly0 != this->y0)
+ return_error(gs_error_unregistered); /* Must not happen. */
return !last;
}
@@ -516,90 +515,90 @@ void
gx_flattened_iterator__switch_to_backscan(gx_flattened_iterator *this, bool not_first)
{
/* When scanning forth, the accumulator stands on the end of a segment,
- except for the last segment.
- When scanning back, the accumulator should stand on the beginning of a segment.
- Assuming at least one forward step is done.
+ except for the last segment.
+ When scanning back, the accumulator should stand on the beginning of a segment.
+ Assuming at least one forward step is done.
*/
if (not_first)
- if (this->i > 0 && this->k != 1 /* This case doesn't use the accumulator. */)
- gx_flattened_iterator__unaccum(this);
+ if (this->i > 0 && this->k != 1 /* This case doesn't use the accumulator. */)
+ gx_flattened_iterator__unaccum(this);
}
#define max_points 50 /* arbitrary */
static int
-generate_segments(gx_path * ppath, const gs_fixed_point *points,
- int count, segment_notes notes)
+generate_segments(gx_path * ppath, const gs_fixed_point *points,
+ int count, segment_notes notes)
{
/* vd_moveto(ppath->position.x, ppath->position.y); */
if (notes & sn_not_first) {
- /* vd_lineto_multi(points, count); */
- print_points(points, count);
- return gx_path_add_lines_notes(ppath, points, count, notes);
+ /* vd_lineto_multi(points, count); */
+ print_points(points, count);
+ return gx_path_add_lines_notes(ppath, points, count, notes);
} else {
- int code;
-
- /* vd_lineto(points[0].x, points[0].y); */
- print_points(points, 1);
- code = gx_path_add_line_notes(ppath, points[0].x, points[0].y, notes);
- if (code < 0)
- return code;
- /* vd_lineto_multi(points + 1, count - 1); */
- print_points(points + 1, count - 1);
- return gx_path_add_lines_notes(ppath, points + 1, count - 1, notes | sn_not_first);
+ int code;
+
+ /* vd_lineto(points[0].x, points[0].y); */
+ print_points(points, 1);
+ code = gx_path_add_line_notes(ppath, points[0].x, points[0].y, notes);
+ if (code < 0)
+ return code;
+ /* vd_lineto_multi(points + 1, count - 1); */
+ print_points(points + 1, count - 1);
+ return gx_path_add_lines_notes(ppath, points + 1, count - 1, notes | sn_not_first);
}
}
static int
-gx_subdivide_curve_rec(gx_flattened_iterator *this,
- gx_path * ppath, int k, curve_segment * pc,
- segment_notes notes, gs_fixed_point *points)
+gx_subdivide_curve_rec(gx_flattened_iterator *this,
+ gx_path * ppath, int k, curve_segment * pc,
+ segment_notes notes, gs_fixed_point *points)
{
int code;
top :
- if (!gx_flattened_iterator__init(this,
- ppath->position.x, ppath->position.y, pc, k)) {
- /* Curve is too long. Break into two pieces and recur. */
- curve_segment cseg;
-
- k--;
- split_curve_midpoint(ppath->position.x, ppath->position.y, pc, &cseg, pc);
- code = gx_subdivide_curve_rec(this, ppath, k, &cseg, notes, points);
- if (code < 0)
- return code;
- notes |= sn_not_first;
- goto top;
+ if (!gx_flattened_iterator__init(this,
+ ppath->position.x, ppath->position.y, pc, k)) {
+ /* Curve is too long. Break into two pieces and recur. */
+ curve_segment cseg;
+
+ k--;
+ split_curve_midpoint(ppath->position.x, ppath->position.y, pc, &cseg, pc);
+ code = gx_subdivide_curve_rec(this, ppath, k, &cseg, notes, points);
+ if (code < 0)
+ return code;
+ notes |= sn_not_first;
+ goto top;
} else if (k == -1) {
- /* fixme : Don't need to init the iterator. Just wanted to check in_range. */
- return gx_path_add_curve_notes(ppath, pc->p1.x, pc->p1.y, pc->p2.x, pc->p2.y,
- pc->pt.x, pc->pt.y, notes);
+ /* fixme : Don't need to init the iterator. Just wanted to check in_range. */
+ return gx_path_add_curve_notes(ppath, pc->p1.x, pc->p1.y, pc->p2.x, pc->p2.y,
+ pc->pt.x, pc->pt.y, notes);
} else {
- gs_fixed_point *ppt = points;
- bool more;
-
- for(;;) {
- code = gx_flattened_iterator__next(this);
-
- if (code < 0)
- return code;
- more = code;
- ppt->x = this->lx1;
- ppt->y = this->ly1;
- ppt++;
- if (ppt == &points[max_points] || !more) {
- gs_fixed_point *pe = (more ? ppt - 2 : ppt);
-
- code = generate_segments(ppath, points, pe - points, notes);
- if (code < 0)
- return code;
- if (!more)
- return 0;
- notes |= sn_not_first;
- memcpy(points, pe, (char *)ppt - (char *)pe);
- ppt = points + (ppt - pe);
- }
- }
+ gs_fixed_point *ppt = points;
+ bool more;
+
+ for(;;) {
+ code = gx_flattened_iterator__next(this);
+
+ if (code < 0)
+ return code;
+ more = code;
+ ppt->x = this->lx1;
+ ppt->y = this->ly1;
+ ppt++;
+ if (ppt == &points[max_points] || !more) {
+ gs_fixed_point *pe = (more ? ppt - 2 : ppt);
+
+ code = generate_segments(ppath, points, pe - points, notes);
+ if (code < 0)
+ return code;
+ if (!more)
+ return 0;
+ notes |= sn_not_first;
+ memcpy(points, pe, (char *)ppt - (char *)pe);
+ ppt = points + (ppt - pe);
+ }
+ }
}
}
@@ -623,5 +622,3 @@ gx_subdivide_curve(gx_path * ppath, int k, curve_segment * pc, segment_notes not
}
#undef max_points
-
-
diff --git a/gs/base/gxrplane.h b/gs/base/gxrplane.h
index b2b257969..336895d9a 100644
--- a/gs/base/gxrplane.h
+++ b/gs/base/gxrplane.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,6 +41,6 @@ typedef struct gx_render_plane_s {
* color_info.)
*/
int gx_render_plane_init(gx_render_plane_t *render_plane,
- const gx_device *dev, int index);
+ const gx_device *dev, int index);
#endif /* gxrplane_INCLUDED */
diff --git a/gs/base/gxsample.c b/gs/base/gxsample.c
index 8b633e0bc..54373090e 100644
--- a/gs/base/gxsample.c
+++ b/gs/base/gxsample.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,6 @@
#include "gximage.h"
/* #include "gxsamplp.h" Do not remove - this file is included below. */
-
/* ---------------- Lookup tables ---------------- */
/*
@@ -84,8 +83,8 @@ const bits32 lookup4x1to32_inverted[16] = {
const byte *
sample_unpack_copy(byte * bptr, int *pdata_x, const byte * data, int data_x,
- uint dsize, const sample_map *ignore_smap, int spread,
- int ignore_num_components_per_plane)
+ uint dsize, const sample_map *ignore_smap, int spread,
+ int ignore_num_components_per_plane)
{ /* We're going to use the data right away, so no copying is needed. */
*pdata_x = data_x;
return data;
@@ -105,7 +104,6 @@ sample_unpack_copy(byte * bptr, int *pdata_x, const byte * data, int data_x,
#undef TEMPLATE_sample_unpack_4
#undef TEMPLATE_sample_unpack_8
-
#define MULTIPLE_MAPS 1
#define TEMPLATE_sample_unpack_1 sample_unpack_1_interleaved
#define TEMPLATE_sample_unpack_2 sample_unpack_2_interleaved
diff --git a/gs/base/gxsample.h b/gs/base/gxsample.h
index 00f7bd3f0..f3ded3ab3 100644
--- a/gs/base/gxsample.h
+++ b/gs/base/gxsample.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,8 +56,8 @@ typedef struct sample_map_s sample_map;
*/
#define SAMPLE_UNPACK_PROC(proc)\
const byte *proc(byte *bptr, int *pdata_x, const byte * data, int data_x,\
- uint dsize, const sample_map *smap, int spread,\
- int num_components_per_plane)
+ uint dsize, const sample_map *smap, int spread,\
+ int num_components_per_plane)
typedef SAMPLE_UNPACK_PROC((*sample_unpack_proc_t));
/*
diff --git a/gs/base/gxsamplp.h b/gs/base/gxsamplp.h
index 657ac34c5..83e8a215e 100644
--- a/gs/base/gxsamplp.h
+++ b/gs/base/gxsamplp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,14 +14,14 @@
/* $Id$ */
/* Templates for sample lookup and expansion */
-/* This module is allowed to include several times into a single .c file.
+/* This module is allowed to include several times into a single .c file.
The following macros to be defined in advance :
- MULTIPLE_MAPS - 1 if num_components_per_plane > 0 and
- components use different maps, 0 otherwise.
- TEMPLATE_sample_unpack_1 - a name for the function
- TEMPLATE_sample_unpack_2 - a name for the function
- TEMPLATE_sample_unpack_4 - a name for the function
- TEMPLATE_sample_unpack_8 - a name for the function
+ MULTIPLE_MAPS - 1 if num_components_per_plane > 0 and
+ components use different maps, 0 otherwise.
+ TEMPLATE_sample_unpack_1 - a name for the function
+ TEMPLATE_sample_unpack_2 - a name for the function
+ TEMPLATE_sample_unpack_4 - a name for the function
+ TEMPLATE_sample_unpack_8 - a name for the function
*/
#if MULTIPLE_MAPS
@@ -36,8 +36,8 @@
const byte *
TEMPLATE_sample_unpack_1(byte * bptr, int *pdata_x, const byte * data, int data_x,
- uint dsize, const sample_map *smap, int spread,
- int num_components_per_plane)
+ uint dsize, const sample_map *smap, int spread,
+ int num_components_per_plane)
{
const sample_lookup_t * ptab = &smap->table;
const byte *psrc = data + (data_x >> 3);
@@ -45,64 +45,64 @@ TEMPLATE_sample_unpack_1(byte * bptr, int *pdata_x, const byte * data, int data_
DEFINE_SMAP_INDEX
if (spread == 1) {
- bits32 *bufp = (bits32 *) bptr;
- const bits32 *map = &ptab->lookup4x1to32[0];
- uint b;
-
- if (left & 1) {
- b = psrc[0];
- bufp[0] = map[b >> 4];
- NEXT_MAP;
- bufp[1] = map[b & 0xf];
- NEXT_MAP;
- psrc++, bufp += 2;
- }
- left >>= 1;
- while (left--) {
- b = psrc[0];
- bufp[0] = map[b >> 4];
- NEXT_MAP;
- bufp[1] = map[b & 0xf];
- NEXT_MAP;
- b = psrc[1];
- bufp[2] = map[b >> 4];
- NEXT_MAP;
- bufp[3] = map[b & 0xf];
- NEXT_MAP;
- psrc += 2, bufp += 4;
- }
+ bits32 *bufp = (bits32 *) bptr;
+ const bits32 *map = &ptab->lookup4x1to32[0];
+ uint b;
+
+ if (left & 1) {
+ b = psrc[0];
+ bufp[0] = map[b >> 4];
+ NEXT_MAP;
+ bufp[1] = map[b & 0xf];
+ NEXT_MAP;
+ psrc++, bufp += 2;
+ }
+ left >>= 1;
+ while (left--) {
+ b = psrc[0];
+ bufp[0] = map[b >> 4];
+ NEXT_MAP;
+ bufp[1] = map[b & 0xf];
+ NEXT_MAP;
+ b = psrc[1];
+ bufp[2] = map[b >> 4];
+ NEXT_MAP;
+ bufp[3] = map[b & 0xf];
+ NEXT_MAP;
+ psrc += 2, bufp += 4;
+ }
} else {
- byte *bufp = bptr;
- const byte *map = &ptab->lookup8[0];
-
- while (left--) {
- uint b = *psrc++;
-
- *bufp = map[b >> 7];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 6) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 5) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 4) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 3) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 2) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 1) & 1];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[b & 1];
- NEXT_MAP8;
- bufp += spread;
- }
+ byte *bufp = bptr;
+ const byte *map = &ptab->lookup8[0];
+
+ while (left--) {
+ uint b = *psrc++;
+
+ *bufp = map[b >> 7];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 6) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 5) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 4) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 3) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 2) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 1) & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[b & 1];
+ NEXT_MAP8;
+ bufp += spread;
+ }
}
*pdata_x = data_x & 7;
return bptr;
@@ -118,8 +118,8 @@ TEMPLATE_sample_unpack_1(byte * bptr, int *pdata_x, const byte * data, int data_
const byte *
TEMPLATE_sample_unpack_2(byte * bptr, int *pdata_x, const byte * data, int data_x,
- uint dsize, const sample_map *smap, int spread,
- int num_components_per_plane)
+ uint dsize, const sample_map *smap, int spread,
+ int num_components_per_plane)
{
const sample_lookup_t * ptab = &smap->table;
const byte *psrc = data + (data_x >> 2);
@@ -127,37 +127,37 @@ TEMPLATE_sample_unpack_2(byte * bptr, int *pdata_x, const byte * data, int data_
DEFINE_SMAP_INDEX
if (spread == 1) {
- bits16 *bufp = (bits16 *) bptr;
- const bits16 *map = &ptab->lookup2x2to16[0];
+ bits16 *bufp = (bits16 *) bptr;
+ const bits16 *map = &ptab->lookup2x2to16[0];
- while (left--) {
- uint b = *psrc++;
+ while (left--) {
+ uint b = *psrc++;
- *bufp++ = map[b >> 4];
- NEXT_MAP;
- *bufp++ = map[b & 0xf];
- NEXT_MAP;
- }
+ *bufp++ = map[b >> 4];
+ NEXT_MAP;
+ *bufp++ = map[b & 0xf];
+ NEXT_MAP;
+ }
} else {
- byte *bufp = bptr;
- const byte *map = &ptab->lookup8[0];
-
- while (left--) {
- unsigned b = *psrc++;
-
- *bufp = map[b >> 6];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 4) & 3];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[(b >> 2) & 3];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[b & 3];
- NEXT_MAP8;
- bufp += spread;
- }
+ byte *bufp = bptr;
+ const byte *map = &ptab->lookup8[0];
+
+ while (left--) {
+ unsigned b = *psrc++;
+
+ *bufp = map[b >> 6];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 4) & 3];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[(b >> 2) & 3];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[b & 3];
+ NEXT_MAP8;
+ bufp += spread;
+ }
}
*pdata_x = data_x & 3;
return bptr;
@@ -167,8 +167,8 @@ TEMPLATE_sample_unpack_2(byte * bptr, int *pdata_x, const byte * data, int data_
const byte *
TEMPLATE_sample_unpack_4(byte * bptr, int *pdata_x, const byte * data, int data_x,
- uint dsize, const sample_map *smap, int spread,
- int num_components_per_plane)
+ uint dsize, const sample_map *smap, int spread,
+ int num_components_per_plane)
{
const sample_lookup_t * ptab = &smap->table;
byte *bufp = bptr;
@@ -178,14 +178,14 @@ TEMPLATE_sample_unpack_4(byte * bptr, int *pdata_x, const byte * data, int data_
DEFINE_SMAP_INDEX
while (left--) {
- uint b = *psrc++;
-
- *bufp = map[b >> 4];
- NEXT_MAP8;
- bufp += spread;
- *bufp = map[b & 0xf];
- NEXT_MAP8;
- bufp += spread;
+ uint b = *psrc++;
+
+ *bufp = map[b >> 4];
+ NEXT_MAP8;
+ bufp += spread;
+ *bufp = map[b & 0xf];
+ NEXT_MAP8;
+ bufp += spread;
}
*pdata_x = data_x & 1;
return bptr;
@@ -193,8 +193,8 @@ TEMPLATE_sample_unpack_4(byte * bptr, int *pdata_x, const byte * data, int data_
const byte *
TEMPLATE_sample_unpack_8(byte * bptr, int *pdata_x, const byte * data, int data_x,
- uint dsize, const sample_map *smap, int spread,
- int num_components_per_plane)
+ uint dsize, const sample_map *smap, int spread,
+ int num_components_per_plane)
{
const sample_lookup_t * ptab = &smap->table;
byte *bufp = bptr;
@@ -203,28 +203,28 @@ TEMPLATE_sample_unpack_8(byte * bptr, int *pdata_x, const byte * data, int data_
*pdata_x = 0;
if (spread == 1) {
- if (MULTIPLE_MAPS ||
- ptab->lookup8[0] != 0 ||
- ptab->lookup8[255] != 255
- ) {
- uint left = dsize - data_x;
- const byte *map = &ptab->lookup8[0];
-
- while (left--) {
- *bufp++ = map[*psrc++];
- NEXT_MAP8;
- }
- } else { /* No copying needed, and we'll use the data right away. */
- return psrc;
- }
+ if (MULTIPLE_MAPS ||
+ ptab->lookup8[0] != 0 ||
+ ptab->lookup8[255] != 255
+ ) {
+ uint left = dsize - data_x;
+ const byte *map = &ptab->lookup8[0];
+
+ while (left--) {
+ *bufp++ = map[*psrc++];
+ NEXT_MAP8;
+ }
+ } else { /* No copying needed, and we'll use the data right away. */
+ return psrc;
+ }
} else {
- int left = dsize - data_x;
- const byte *map = &ptab->lookup8[0];
+ int left = dsize - data_x;
+ const byte *map = &ptab->lookup8[0];
- for (; left--; psrc++, bufp += spread) {
- *bufp = map[*psrc];
- NEXT_MAP8;
- }
+ for (; left--; psrc++, bufp += spread) {
+ *bufp = map[*psrc];
+ NEXT_MAP8;
+ }
}
return bptr;
}
diff --git a/gs/base/gxshade.c b/gs/base/gxshade.c
index 2abb37b7f..e0471abe7 100644
--- a/gs/base/gxshade.c
+++ b/gs/base/gxshade.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,9 +39,9 @@
static int cs_next_packed_value(shade_coord_stream_t *, int, uint *);
static int cs_next_array_value(shade_coord_stream_t *, int, uint *);
static int cs_next_packed_decoded(shade_coord_stream_t *, int,
- const float[2], float *);
+ const float[2], float *);
static int cs_next_array_decoded(shade_coord_stream_t *, int,
- const float[2], float *);
+ const float[2], float *);
static void cs_packed_align(shade_coord_stream_t *cs, int radix);
static void cs_array_align(shade_coord_stream_t *cs, int radix);
static bool cs_eod(const shade_coord_stream_t * cs);
@@ -49,36 +49,36 @@ static bool cs_eod(const shade_coord_stream_t * cs);
/* Initialize a packed value stream. */
void
shade_next_init(shade_coord_stream_t * cs,
- const gs_shading_mesh_params_t * params,
- const gs_imager_state * pis)
+ const gs_shading_mesh_params_t * params,
+ const gs_imager_state * pis)
{
cs->params = params;
cs->pctm = &pis->ctm;
if (data_source_is_stream(params->DataSource)) {
- /*
- * Rewind the data stream iff it is reusable -- either a reusable
- * file or a reusable string.
- */
- stream *s = cs->s = params->DataSource.data.strm;
-
- if ((s->file != 0 && s->file_limit != max_long) ||
- (s->file == 0 && s->strm == 0)
- )
- sseek(s, 0);
+ /*
+ * Rewind the data stream iff it is reusable -- either a reusable
+ * file or a reusable string.
+ */
+ stream *s = cs->s = params->DataSource.data.strm;
+
+ if ((s->file != 0 && s->file_limit != max_long) ||
+ (s->file == 0 && s->strm == 0)
+ )
+ sseek(s, 0);
} else {
- s_init(&cs->ds, NULL);
+ s_init(&cs->ds, NULL);
sread_string(&cs->ds, params->DataSource.data.str.data,
- params->DataSource.data.str.size);
- cs->s = &cs->ds;
+ params->DataSource.data.str.size);
+ cs->s = &cs->ds;
}
if (data_source_is_array(params->DataSource)) {
- cs->get_value = cs_next_array_value;
- cs->get_decoded = cs_next_array_decoded;
- cs->align = cs_array_align;
+ cs->get_value = cs_next_array_value;
+ cs->get_decoded = cs_next_array_decoded;
+ cs->align = cs_array_align;
} else {
- cs->get_value = cs_next_packed_value;
- cs->get_decoded = cs_next_packed_decoded;
- cs->align = cs_packed_align;
+ cs->get_value = cs_next_packed_value;
+ cs->get_decoded = cs_next_packed_decoded;
+ cs->align = cs_packed_align;
}
cs->is_eod = cs_eod;
cs->left = 0;
@@ -101,37 +101,37 @@ cs_next_packed_value(shade_coord_stream_t * cs, int num_bits, uint * pvalue)
int left = cs->left;
if (left >= num_bits) {
- /* We can satisfy this request with the current buffered bits. */
- cs->left = left -= num_bits;
- *pvalue = (bits >> left) & ((1 << num_bits) - 1);
+ /* We can satisfy this request with the current buffered bits. */
+ cs->left = left -= num_bits;
+ *pvalue = (bits >> left) & ((1 << num_bits) - 1);
} else {
- /* We need more bits. */
- int needed = num_bits - left;
- uint value = bits & ((1 << left) - 1); /* all the remaining bits */
-
- for (; needed >= 8; needed -= 8) {
- int b = sgetc(cs->s);
-
- if (b < 0) {
- cs->ds_EOF = true;
- return_error(gs_error_rangecheck);
- }
- value = (value << 8) + b;
- }
- if (needed == 0) {
- cs->left = 0;
- *pvalue = value;
- } else {
- int b = sgetc(cs->s);
-
- if (b < 0) {
- cs->ds_EOF = true;
- return_error(gs_error_rangecheck);
- }
- cs->bits = b;
- cs->left = left = 8 - needed;
- *pvalue = (value << needed) + (b >> left);
- }
+ /* We need more bits. */
+ int needed = num_bits - left;
+ uint value = bits & ((1 << left) - 1); /* all the remaining bits */
+
+ for (; needed >= 8; needed -= 8) {
+ int b = sgetc(cs->s);
+
+ if (b < 0) {
+ cs->ds_EOF = true;
+ return_error(gs_error_rangecheck);
+ }
+ value = (value << 8) + b;
+ }
+ if (needed == 0) {
+ cs->left = 0;
+ *pvalue = value;
+ } else {
+ int b = sgetc(cs->s);
+
+ if (b < 0) {
+ cs->ds_EOF = true;
+ return_error(gs_error_rangecheck);
+ }
+ cs->bits = b;
+ cs->left = left = 8 - needed;
+ *pvalue = (value << needed) + (b >> left);
+ }
}
return 0;
}
@@ -147,15 +147,15 @@ cs_next_array_value(shade_coord_stream_t * cs, int num_bits, uint * pvalue)
uint read;
if (sgets(cs->s, (byte *)&value, sizeof(float), &read) < 0 ||
- read != sizeof(float)) {
- cs->ds_EOF = true;
- return_error(gs_error_rangecheck);
+ read != sizeof(float)) {
+ cs->ds_EOF = true;
+ return_error(gs_error_rangecheck);
}
if (value < 0 || (num_bits != 0 && num_bits < sizeof(uint) * 8 &&
- value >= (1 << num_bits)) ||
- value != (uint)value
- )
- return_error(gs_error_rangecheck);
+ value >= (1 << num_bits)) ||
+ value != (uint)value
+ )
+ return_error(gs_error_rangecheck);
*pvalue = (uint) value;
return 0;
}
@@ -163,34 +163,34 @@ cs_next_array_value(shade_coord_stream_t * cs, int num_bits, uint * pvalue)
/* Get the next decoded floating point value. */
static int
cs_next_packed_decoded(shade_coord_stream_t * cs, int num_bits,
- const float decode[2], float *pvalue)
+ const float decode[2], float *pvalue)
{
uint value;
int code = cs->get_value(cs, num_bits, &value);
double max_value = (double)(uint)
- (num_bits == sizeof(uint) * 8 ? ~0 : ((1 << num_bits) - 1));
+ (num_bits == sizeof(uint) * 8 ? ~0 : ((1 << num_bits) - 1));
if (code < 0)
- return code;
+ return code;
*pvalue =
- (decode == 0 ? value / max_value :
- decode[0] + value * (decode[1] - decode[0]) / max_value);
+ (decode == 0 ? value / max_value :
+ decode[0] + value * (decode[1] - decode[0]) / max_value);
return 0;
}
/* Get the next floating point value from an array, without decoding. */
static int
cs_next_array_decoded(shade_coord_stream_t * cs, int num_bits,
- const float decode[2], float *pvalue)
+ const float decode[2], float *pvalue)
{
float value;
uint read;
if (sgets(cs->s, (byte *)&value, sizeof(float), &read) < 0 ||
- read != sizeof(float)
+ read != sizeof(float)
) {
- cs->ds_EOF = true;
- return_error(gs_error_rangecheck);
+ cs->ds_EOF = true;
+ return_error(gs_error_rangecheck);
}
*pvalue = value;
return 0;
@@ -223,7 +223,7 @@ shade_next_flag(shade_coord_stream_t * cs, int BitsPerFlag)
/* Get one or more coordinate pairs. */
int
shade_next_coords(shade_coord_stream_t * cs, gs_fixed_point * ppt,
- int num_points)
+ int num_points)
{
int num_bits = cs->params->BitsPerCoordinate;
const float *decode = cs->params->Decode;
@@ -231,13 +231,13 @@ shade_next_coords(shade_coord_stream_t * cs, gs_fixed_point * ppt,
int i;
for (i = 0; i < num_points; ++i) {
- float x, y;
+ float x, y;
- if ((code = cs->get_decoded(cs, num_bits, decode, &x)) < 0 ||
- (code = cs->get_decoded(cs, num_bits, decode + 2, &y)) < 0 ||
- (code = gs_point_transform2fixed(cs->pctm, x, y, &ppt[i])) < 0
- )
- break;
+ if ((code = cs->get_decoded(cs, num_bits, decode, &x)) < 0 ||
+ (code = cs->get_decoded(cs, num_bits, decode + 2, &y)) < 0 ||
+ (code = gs_point_transform2fixed(cs->pctm, x, y, &ppt[i])) < 0
+ )
+ break;
}
return code;
}
@@ -252,42 +252,42 @@ shade_next_color(shade_coord_stream_t * cs, float *pc)
int num_bits = cs->params->BitsPerComponent;
if (index == gs_color_space_index_Indexed) {
- int ncomp = gs_color_space_num_components(gs_cspace_base_space(pcs));
- int ci;
+ int ncomp = gs_color_space_num_components(gs_cspace_base_space(pcs));
+ int ci;
float cf;
- int code = cs->get_decoded(cs, num_bits, decode, &cf);
+ int code = cs->get_decoded(cs, num_bits, decode, &cf);
gs_client_color cc;
- int i;
+ int i;
- if (code < 0)
- return code;
- if (cf < 0)
- return_error(gs_error_rangecheck);
- ci = (int)cf;
+ if (code < 0)
+ return code;
+ if (cf < 0)
+ return_error(gs_error_rangecheck);
+ ci = (int)cf;
if (ci >= gs_cspace_indexed_num_entries(pcs))
- return_error(gs_error_rangecheck);
- code = gs_cspace_indexed_lookup(pcs, ci, &cc);
- if (code < 0)
- return code;
- for (i = 0; i < ncomp; ++i)
- pc[i] = cc.paint.values[i];
+ return_error(gs_error_rangecheck);
+ code = gs_cspace_indexed_lookup(pcs, ci, &cc);
+ if (code < 0)
+ return code;
+ for (i = 0; i < ncomp; ++i)
+ pc[i] = cc.paint.values[i];
} else {
- int i, code;
- int ncomp = (cs->params->Function != 0 ? 1 :
- gs_color_space_num_components(pcs));
-
- for (i = 0; i < ncomp; ++i) {
- if ((code = cs->get_decoded(cs, num_bits, decode + i * 2, &pc[i])) < 0)
- return code;
- if (cs->params->Function) {
- gs_function_params_t *params = &cs->params->Function->params;
-
- if (pc[i] < params->Domain[i + i])
- pc[i] = params->Domain[i + i];
- else if (pc[i] > params->Domain[i + i + 1])
- pc[i] = params->Domain[i + i + 1];
- }
- }
+ int i, code;
+ int ncomp = (cs->params->Function != 0 ? 1 :
+ gs_color_space_num_components(pcs));
+
+ for (i = 0; i < ncomp; ++i) {
+ if ((code = cs->get_decoded(cs, num_bits, decode + i * 2, &pc[i])) < 0)
+ return code;
+ if (cs->params->Function) {
+ gs_function_params_t *params = &cs->params->Function->params;
+
+ if (pc[i] < params->Domain[i + i])
+ pc[i] = params->Domain[i + i];
+ else if (pc[i] > params->Domain[i + i + 1])
+ pc[i] = params->Domain[i + i + 1];
+ }
+ }
}
return 0;
}
@@ -299,9 +299,9 @@ shade_next_vertex(shade_coord_stream_t * cs, shading_vertex_t * vertex, patch_co
int code = shade_next_coords(cs, &vertex->p, 1);
if (code >= 0)
- code = shade_next_color(cs, c->cc.paint.values);
+ code = shade_next_color(cs, c->cc.paint.values);
if (code >= 0)
- cs->align(cs, 8); /* CET 09-47J.PS SpecialTestI04Test01. */
+ cs->align(cs, 8); /* CET 09-47J.PS SpecialTestI04Test01. */
return code;
}
@@ -310,7 +310,7 @@ shade_next_vertex(shade_coord_stream_t * cs, shading_vertex_t * vertex, patch_co
/* Initialize the common parts of the recursion state. */
void
shade_init_fill_state(shading_fill_state_t * pfs, const gs_shading_t * psh,
- gx_device * dev, gs_imager_state * pis)
+ gx_device * dev, gs_imager_state * pis)
{
const gs_color_space *pcs = psh->params.ColorSpace;
float max_error = min(pis->smoothness, MAX_SMOOTHNESS);
@@ -322,7 +322,7 @@ shade_init_fill_state(shading_fill_state_t * pfs, const gs_shading_t * psh,
* colors times the number of halftone levels.
*/
long num_colors =
- max(dev->color_info.max_gray, dev->color_info.max_color) + 1;
+ max(dev->color_info.max_gray, dev->color_info.max_color) + 1;
const gs_range *ranges = 0;
int ci;
gsicc_rendering_param_t rendering_params;
@@ -333,46 +333,46 @@ top:
pfs->direct_space = pcs;
pfs->num_components = gs_color_space_num_components(pcs);
switch ( gs_color_space_get_index(pcs) )
- {
- case gs_color_space_index_Indexed:
- pcs = gs_cspace_base_space(pcs);
- goto top;
- case gs_color_space_index_CIEDEFG:
- ranges = pcs->params.defg->RangeDEFG.ranges;
- break;
- case gs_color_space_index_CIEDEF:
- ranges = pcs->params.def->RangeDEF.ranges;
- break;
- case gs_color_space_index_CIEABC:
- ranges = pcs->params.abc->RangeABC.ranges;
- break;
- case gs_color_space_index_CIEA:
- ranges = &pcs->params.a->RangeA;
- break;
+ {
+ case gs_color_space_index_Indexed:
+ pcs = gs_cspace_base_space(pcs);
+ goto top;
+ case gs_color_space_index_CIEDEFG:
+ ranges = pcs->params.defg->RangeDEFG.ranges;
+ break;
+ case gs_color_space_index_CIEDEF:
+ ranges = pcs->params.def->RangeDEF.ranges;
+ break;
+ case gs_color_space_index_CIEABC:
+ ranges = pcs->params.abc->RangeABC.ranges;
+ break;
+ case gs_color_space_index_CIEA:
+ ranges = &pcs->params.a->RangeA;
+ break;
case gs_color_space_index_ICC:
ranges = pcs->cmm_icc_profile_data->Range.ranges;
break;
default:
- break;
- }
+ break;
+ }
if (num_colors <= 32) {
- gx_ht_order_component *components = pis->dev_ht->components;
- if (components && components[0].corder.wts)
- num_colors = 256;
- else
- /****** WRONG FOR MULTI-PLANE HALFTONES ******/
- num_colors *= pis->dev_ht->components[0].corder.num_levels;
+ gx_ht_order_component *components = pis->dev_ht->components;
+ if (components && components[0].corder.wts)
+ num_colors = 256;
+ else
+ /****** WRONG FOR MULTI-PLANE HALFTONES ******/
+ num_colors *= pis->dev_ht->components[0].corder.num_levels;
}
if (psh->head.type == 2 || psh->head.type == 3) {
- max_error *= 0.25;
- num_colors *= 2;
+ max_error *= 0.25;
+ num_colors *= 2;
}
if (max_error < 1.0 / num_colors)
- max_error = 1.0 / num_colors;
+ max_error = 1.0 / num_colors;
for (ci = 0; ci < pfs->num_components; ++ci)
- pfs->cc_max_error[ci] =
- (ranges == 0 ? max_error :
- max_error * (ranges[ci].rmax - ranges[ci].rmin));
+ pfs->cc_max_error[ci] =
+ (ranges == 0 ? max_error :
+ max_error * (ranges[ci].rmax - ranges[ci].rmin));
if (pis->has_transparency && pis->trans_device != NULL) {
pfs->trans_device = pis->trans_device;
} else {
@@ -388,14 +388,14 @@ top:
rendering_params.rendering_intent = pis->renderingintent;
/* Grab the icc link transform that we need now */
if (pcs->cmm_icc_profile_data != NULL) {
- pfs->icclink = gsicc_get_link(pis, pis->trans_device, pcs, NULL,
+ pfs->icclink = gsicc_get_link(pis, pis->trans_device, pcs, NULL,
&rendering_params, pis->memory, false);
} else {
if (pcs->icc_equivalent != NULL ) {
- /* We have a PS equivalent ICC profile. We may need to go
+ /* We have a PS equivalent ICC profile. We may need to go
through special range adjustments in this case */
- pfs->icclink = gsicc_get_link(pis, pis->trans_device,
- pcs->icc_equivalent, NULL,
+ pfs->icclink = gsicc_get_link(pis, pis->trans_device,
+ pcs->icc_equivalent, NULL,
&rendering_params, pis->memory, false);
} else {
pfs->icclink = NULL;
@@ -406,7 +406,7 @@ top:
/* Fill one piece of a shading. */
int
shade_fill_path(const shading_fill_state_t * pfs, gx_path * ppath,
- gx_device_color * pdevc, const gs_fixed_point *fill_adjust)
+ gx_device_color * pdevc, const gs_fixed_point *fill_adjust)
{
gx_fill_params params;
@@ -414,5 +414,5 @@ shade_fill_path(const shading_fill_state_t * pfs, gx_path * ppath,
params.adjust = *fill_adjust;
params.flatness = 0; /* irrelevant */
return (*dev_proc(pfs->dev, fill_path)) (pfs->dev, pfs->pis, ppath,
- &params, pdevc, NULL);
+ &params, pdevc, NULL);
}
diff --git a/gs/base/gxshade.h b/gs/base/gxshade.h
index 1f8d7f335..3d28b9831 100644
--- a/gs/base/gxshade.h
+++ b/gs/base/gxshade.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,11 +34,11 @@
2 1-D Domain Function + Extend perp. to Coords
3 1-D Domain Function + Extend circles per Coords
4,5 triangle x Gouraud interp. on Gouraud interp. on
- 2-D in tri. Decode => corner triangle corners
- values => Function
+ 2-D in tri. Decode => corner triangle corners
+ values => Function
6 patch x (u,v) Decode => bilinear Sc + Sd - Sb on each patch
- in patch interp. on corner
- values => Function
+ in patch interp. on corner
+ values => Function
7 see 6 see 6 Sum(i) Sum(j) Pij*Bi(u)*Bj(v)
To be able to render a portion of a shading usefully, we must be able to
@@ -107,7 +107,7 @@ SHADING_FILL_RECTANGLE_PROC(gs_shading_Tpp_fill_rectangle);
typedef struct shade_coord_stream_s shade_coord_stream_t;
struct shade_coord_stream_s {
stream ds; /* stream if DataSource isn't one already -- */
- /* first for GC-ability (maybe unneeded?) */
+ /* first for GC-ability (maybe unneeded?) */
stream *s; /* DataSource or &ds */
uint bits; /* shifted bits of current byte */
int left; /* # of bits left in bits */
@@ -116,7 +116,7 @@ struct shade_coord_stream_s {
const gs_matrix_fixed *pctm;
int (*get_value)(shade_coord_stream_t *cs, int num_bits, uint *pvalue);
int (*get_decoded)(shade_coord_stream_t *cs, int num_bits,
- const float decode[2], float *pvalue);
+ const float decode[2], float *pvalue);
void (*align)(shade_coord_stream_t *cs, int radix);
bool (*is_eod)(const shade_coord_stream_t *cs);
};
@@ -137,22 +137,22 @@ typedef struct patch_color_s patch_color_t;
/* Initialize a packed value stream. */
void shade_next_init(shade_coord_stream_t * cs,
- const gs_shading_mesh_params_t * params,
- const gs_imager_state * pis);
+ const gs_shading_mesh_params_t * params,
+ const gs_imager_state * pis);
/* Get the next flag value. */
int shade_next_flag(shade_coord_stream_t * cs, int BitsPerFlag);
/* Get one or more coordinate pairs. */
int shade_next_coords(shade_coord_stream_t * cs, gs_fixed_point * ppt,
- int num_points);
+ int num_points);
/* Get a color. Currently all this does is look up Indexed colors. */
int shade_next_color(shade_coord_stream_t * cs, float *pc);
/* Get the next vertex for a mesh element. */
-int shade_next_vertex(shade_coord_stream_t * cs, shading_vertex_t * vertex,
- patch_color_t *c);
+int shade_next_vertex(shade_coord_stream_t * cs, shading_vertex_t * vertex,
+ patch_color_t *c);
/*
Currently, all shading fill procedures follow the same algorithm:
@@ -197,7 +197,7 @@ int shade_next_vertex(shade_coord_stream_t * cs, shading_vertex_t * vertex,
int num_components; /* # of color components in direct_space */\
float cc_max_error[GS_CLIENT_COLOR_MAX_COMPONENTS];\
gx_device *trans_device;\
- gsicc_link_t *icclink
+ gsicc_link_t *icclink
typedef struct shading_fill_state_s {
shading_fill_state_common;
@@ -205,8 +205,8 @@ typedef struct shading_fill_state_s {
/* Initialize the common parts of the recursion state. */
void shade_init_fill_state(shading_fill_state_t * pfs,
- const gs_shading_t * psh, gx_device * dev,
- gs_imager_state * pis);
+ const gs_shading_t * psh, gx_device * dev,
+ gs_imager_state * pis);
/* Fill one piece of a shading. */
#ifndef gx_device_color_DEFINED
@@ -214,6 +214,6 @@ void shade_init_fill_state(shading_fill_state_t * pfs,
typedef struct gx_device_color_s gx_device_color;
#endif
int shade_fill_path(const shading_fill_state_t * pfs, gx_path * ppath,
- gx_device_color * pdevc, const gs_fixed_point *fill_adjust);
+ gx_device_color * pdevc, const gs_fixed_point *fill_adjust);
#endif /* gxshade_INCLUDED */
diff --git a/gs/base/gxshade1.c b/gs/base/gxshade1.c
index c3e3e9eee..5f9a30dac 100644
--- a/gs/base/gxshade1.c
+++ b/gs/base/gxshade1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,6 @@
#define VD_TRACE_RADIAL_PATCH 1
#define VD_TRACE_FUNCTIONAL_PATCH 1
-
/* ---------------- Function-based shading ---------------- */
typedef struct Fb_frame_s { /* A rudiment of old code. */
@@ -60,19 +59,19 @@ make_other_poles(patch_curve_t curve[4])
int i, j;
for (i = 0; i < 4; i++) {
- j = (i + 1) % 4;
- curve[i].control[0].x = (curve[i].vertex.p.x * 2 + curve[j].vertex.p.x) / 3;
- curve[i].control[0].y = (curve[i].vertex.p.y * 2 + curve[j].vertex.p.y) / 3;
- curve[i].control[1].x = (curve[i].vertex.p.x + curve[j].vertex.p.x * 2) / 3;
- curve[i].control[1].y = (curve[i].vertex.p.y + curve[j].vertex.p.y * 2) / 3;
- curve[i].straight = true;
+ j = (i + 1) % 4;
+ curve[i].control[0].x = (curve[i].vertex.p.x * 2 + curve[j].vertex.p.x) / 3;
+ curve[i].control[0].y = (curve[i].vertex.p.y * 2 + curve[j].vertex.p.y) / 3;
+ curve[i].control[1].x = (curve[i].vertex.p.x + curve[j].vertex.p.x * 2) / 3;
+ curve[i].control[1].y = (curve[i].vertex.p.y + curve[j].vertex.p.y * 2) / 3;
+ curve[i].straight = true;
}
}
/* Transform a point with a fixed-point result. */
static void
gs_point_transform2fixed_clamped(const gs_matrix_fixed * pmat,
- floatp x, floatp y, gs_fixed_point * ppt)
+ floatp x, floatp y, gs_fixed_point * ppt)
{
gs_point fpt;
@@ -90,16 +89,16 @@ Fb_fill_region(Fb_fill_state_t * pfs, const gs_fixed_rect *rect)
int code;
if (VD_TRACE_FUNCTIONAL_PATCH && vd_allowed('s')) {
- vd_get_dc('s');
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
+ vd_get_dc('s');
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
}
memcpy(&pfs1, (shading_fill_state_t *)pfs, sizeof(shading_fill_state_t));
pfs1.Function = pfs->psh->params.Function;
code = init_patch_fill_state(&pfs1);
if (code < 0)
- return code;
+ return code;
pfs1.maybe_self_intersecting = false;
pfs1.n_color_args = 2;
pfs1.rect = *rect;
@@ -114,16 +113,16 @@ Fb_fill_region(Fb_fill_state_t * pfs, const gs_fixed_rect *rect)
curve[3].vertex.cc[0] = fp->region.p.x; curve[3].vertex.cc[1] = fp->region.q.y;
code = patch_fill(&pfs1, curve, NULL, NULL);
if (term_patch_fill_state(&pfs1))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (VD_TRACE_FUNCTIONAL_PATCH && vd_allowed('s'))
- vd_release_dc;
+ vd_release_dc;
return code;
}
int
-gs_shading_Fb_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis)
+gs_shading_Fb_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis)
{
const gs_shading_Fb_t * const psh = (const gs_shading_Fb_t *)psh0;
gs_matrix save_ctm;
@@ -140,27 +139,27 @@ gs_shading_Fb_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
gs_setmatrix((gs_state *) pis, &save_ctm);
/* Compute the parameter X and Y ranges. */
{
- gs_rect pbox;
+ gs_rect pbox;
- gs_bbox_transform_inverse(rect, &psh->params.Matrix, &pbox);
- x[0] = max(pbox.p.x, psh->params.Domain[0]);
- x[1] = min(pbox.q.x, psh->params.Domain[1]);
- y[0] = max(pbox.p.y, psh->params.Domain[2]);
- y[1] = min(pbox.q.y, psh->params.Domain[3]);
+ gs_bbox_transform_inverse(rect, &psh->params.Matrix, &pbox);
+ x[0] = max(pbox.p.x, psh->params.Domain[0]);
+ x[1] = min(pbox.q.x, psh->params.Domain[1]);
+ y[0] = max(pbox.p.y, psh->params.Domain[2]);
+ y[1] = min(pbox.q.y, psh->params.Domain[3]);
}
if (x[0] > x[1] || y[0] > y[1]) {
- /* The region is outside the shading area. */
+ /* The region is outside the shading area. */
if (state.icclink != NULL) gsicc_release_link(state.icclink);
- return 0;
+ return 0;
}
for (xi = 0; xi < 2; ++xi)
- for (yi = 0; yi < 2; ++yi) {
- float v[2];
+ for (yi = 0; yi < 2; ++yi) {
+ float v[2];
- v[0] = x[xi], v[1] = y[yi];
- gs_function_evaluate(psh->params.Function, v,
- state.frame.cc[yi * 2 + xi].paint.values);
- }
+ v[0] = x[xi], v[1] = y[yi];
+ gs_function_evaluate(psh->params.Function, v,
+ state.frame.cc[yi * 2 + xi].paint.values);
+ }
state.frame.region.p.x = x[0];
state.frame.region.p.y = y[0];
state.frame.region.q.x = x[1];
@@ -212,8 +211,8 @@ A_fill_region(A_fill_state_t * pfs, patch_fill_state_t *pfs1)
static inline int
gs_shading_A_fill_rectangle_aux(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect *clip_rect,
- gx_device * dev, gs_imager_state * pis)
+ const gs_fixed_rect *clip_rect,
+ gx_device * dev, gs_imager_state * pis)
{
const gs_shading_A_t *const psh = (const gs_shading_A_t *)psh0;
gs_function_t * const pfn = psh->params.Function;
@@ -234,7 +233,7 @@ gs_shading_A_fill_rectangle_aux(const gs_shading_t * psh0, const gs_rect * rect,
code = init_patch_fill_state(&pfs1);
if (code < 0) {
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
- return code;
+ return code;
}
pfs1.maybe_self_intersecting = false;
pfs1.function_arg_shift = 1;
@@ -261,202 +260,201 @@ gs_shading_A_fill_rectangle_aux(const gs_shading_t * psh0, const gs_rect * rect,
state.t0 = t0 * dd + d0;
state.t1 = t1 * dd + d0;
gs_distance_transform(state.delta.x, state.delta.y, &ctm_only(pis),
- &dist);
+ &dist);
state.length = hypot(dist.x, dist.y); /* device space line length */
code = A_fill_region(&state, &pfs1);
if (psh->params.Extend[0] && t0 > t_rect.p.y) {
if (code < 0) {
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
- return code;
+ return code;
}
- /* Use the general algorithm, because we need the trapping. */
- state.v0 = t_rect.p.y;
- state.v1 = t0;
- state.t0 = state.t1 = t0 * dd + d0;
- code = A_fill_region(&state, &pfs1);
+ /* Use the general algorithm, because we need the trapping. */
+ state.v0 = t_rect.p.y;
+ state.v1 = t0;
+ state.t0 = state.t1 = t0 * dd + d0;
+ code = A_fill_region(&state, &pfs1);
}
if (psh->params.Extend[1] && t1 < t_rect.q.y) {
if (code < 0) {
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
- return code;
+ return code;
}
- /* Use the general algorithm, because we need the trapping. */
- state.v0 = t1;
- state.v1 = t_rect.q.y;
- state.t0 = state.t1 = t1 * dd + d0;
- code = A_fill_region(&state, &pfs1);
+ /* Use the general algorithm, because we need the trapping. */
+ state.v0 = t1;
+ state.v1 = t_rect.q.y;
+ state.t0 = state.t1 = t1 * dd + d0;
+ code = A_fill_region(&state, &pfs1);
}
if (term_patch_fill_state(&pfs1))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
return code;
}
int
gs_shading_A_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis)
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis)
{
int code;
if (VD_TRACE_AXIAL_PATCH && vd_allowed('s')) {
- vd_get_dc('s');
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
+ vd_get_dc('s');
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
}
code = gs_shading_A_fill_rectangle_aux(psh0, rect, rect_clip, dev, pis);
if (VD_TRACE_AXIAL_PATCH && vd_allowed('s'))
- vd_release_dc;
+ vd_release_dc;
return code;
}
/* ---------------- Radial shading ---------------- */
-static int
+static int
R_tensor_annulus(patch_fill_state_t *pfs, /*@unused@*/const gs_rect *rect0,
double x0, double y0, double r0, double t0,
double x1, double y1, double r1, double t1)
-{
+{
double dx = x1 - x0, dy = y1 - y0;
double d = hypot(dx, dy);
gs_point p0, p1, pc0, pc1;
int k, j, code;
bool inside = 0;
- pc0.x = x0, pc0.y = y0;
+ pc0.x = x0, pc0.y = y0;
pc1.x = x1, pc1.y = y1;
if (r0 + d <= r1 || r1 + d <= r0) {
- /* One circle is inside another one.
- Use any subdivision,
- but don't depend on dx, dy, which may be too small. */
- p0.x = 0, p0.y = -1;
- /* Align stripes along radii for faster triangulation : */
- inside = 1;
+ /* One circle is inside another one.
+ Use any subdivision,
+ but don't depend on dx, dy, which may be too small. */
+ p0.x = 0, p0.y = -1;
+ /* Align stripes along radii for faster triangulation : */
+ inside = 1;
} else {
/* Must generate canonic quadrangle arcs,
- because we approximate them with curves. */
- if(any_abs(dx) >= any_abs(dy)) {
- if (dx > 0)
- p0.x = 0, p0.y = -1;
- else
- p0.x = 0, p0.y = 1;
- } else {
- if (dy > 0)
- p0.x = 1, p0.y = 0;
- else
- p0.x = -1, p0.y = 0;
- }
+ because we approximate them with curves. */
+ if(any_abs(dx) >= any_abs(dy)) {
+ if (dx > 0)
+ p0.x = 0, p0.y = -1;
+ else
+ p0.x = 0, p0.y = 1;
+ } else {
+ if (dy > 0)
+ p0.x = 1, p0.y = 0;
+ else
+ p0.x = -1, p0.y = 0;
+ }
}
- /* fixme: wish: cut invisible parts off.
+ /* fixme: wish: cut invisible parts off.
Note : when r0 != r1 the invisible part is not a half circle. */
for (k = 0; k < 4; k++, p0 = p1) {
- gs_point p[12];
- patch_curve_t curve[4];
-
- p1.x = -p0.y; p1.y = p0.x;
- if ((k & 1) == k >> 1) {
- make_quadrant_arc(p + 0, &pc0, &p1, &p0, r0);
- make_quadrant_arc(p + 6, &pc1, &p0, &p1, r1);
- } else {
- make_quadrant_arc(p + 0, &pc0, &p0, &p1, r0);
- make_quadrant_arc(p + 6, &pc1, &p1, &p0, r1);
- }
- p[4].x = (p[3].x * 2 + p[6].x) / 3;
- p[4].y = (p[3].y * 2 + p[6].y) / 3;
- p[5].x = (p[3].x + p[6].x * 2) / 3;
- p[5].y = (p[3].y + p[6].y * 2) / 3;
- p[10].x = (p[9].x * 2 + p[0].x) / 3;
- p[10].y = (p[9].y * 2 + p[0].y) / 3;
- p[11].x = (p[9].x + p[0].x * 2) / 3;
- p[11].y = (p[9].y + p[0].y * 2) / 3;
- for (j = 0; j < 4; j++) {
- int jj = (j + inside) % 4;
-
- if (gs_point_transform2fixed(&pfs->pis->ctm, p[j*3 + 0].x, p[j*3 + 0].y, &curve[jj].vertex.p) < 0)
+ gs_point p[12];
+ patch_curve_t curve[4];
+
+ p1.x = -p0.y; p1.y = p0.x;
+ if ((k & 1) == k >> 1) {
+ make_quadrant_arc(p + 0, &pc0, &p1, &p0, r0);
+ make_quadrant_arc(p + 6, &pc1, &p0, &p1, r1);
+ } else {
+ make_quadrant_arc(p + 0, &pc0, &p0, &p1, r0);
+ make_quadrant_arc(p + 6, &pc1, &p1, &p0, r1);
+ }
+ p[4].x = (p[3].x * 2 + p[6].x) / 3;
+ p[4].y = (p[3].y * 2 + p[6].y) / 3;
+ p[5].x = (p[3].x + p[6].x * 2) / 3;
+ p[5].y = (p[3].y + p[6].y * 2) / 3;
+ p[10].x = (p[9].x * 2 + p[0].x) / 3;
+ p[10].y = (p[9].y * 2 + p[0].y) / 3;
+ p[11].x = (p[9].x + p[0].x * 2) / 3;
+ p[11].y = (p[9].y + p[0].y * 2) / 3;
+ for (j = 0; j < 4; j++) {
+ int jj = (j + inside) % 4;
+
+ if (gs_point_transform2fixed(&pfs->pis->ctm, p[j*3 + 0].x, p[j*3 + 0].y, &curve[jj].vertex.p) < 0)
gs_point_transform2fixed_clamped(&pfs->pis->ctm, p[j*3 + 0].x, p[j*3 + 0].y, &curve[jj].vertex.p);
-
+
if (gs_point_transform2fixed(&pfs->pis->ctm, p[j*3 + 1].x, p[j*3 + 1].y, &curve[jj].control[0]) < 0)
gs_point_transform2fixed_clamped(&pfs->pis->ctm, p[j*3 + 1].x, p[j*3 + 1].y, &curve[jj].control[0]);
-
+
if (gs_point_transform2fixed(&pfs->pis->ctm, p[j*3 + 2].x, p[j*3 + 2].y, &curve[jj].control[1]) < 0)
gs_point_transform2fixed_clamped(&pfs->pis->ctm, p[j*3 + 2].x, p[j*3 + 2].y, &curve[jj].control[1]);
- curve[j].straight = (((j + inside) & 1) != 0);
- }
- curve[(0 + inside) % 4].vertex.cc[0] = t0;
- curve[(1 + inside) % 4].vertex.cc[0] = t0;
- curve[(2 + inside) % 4].vertex.cc[0] = t1;
- curve[(3 + inside) % 4].vertex.cc[0] = t1;
- curve[0].vertex.cc[1] = curve[1].vertex.cc[1] = 0; /* Initialize against FPE. */
- curve[2].vertex.cc[1] = curve[3].vertex.cc[1] = 0; /* Initialize against FPE. */
- code = patch_fill(pfs, curve, NULL, NULL);
- if (code < 0)
- return code;
+ curve[j].straight = (((j + inside) & 1) != 0);
+ }
+ curve[(0 + inside) % 4].vertex.cc[0] = t0;
+ curve[(1 + inside) % 4].vertex.cc[0] = t0;
+ curve[(2 + inside) % 4].vertex.cc[0] = t1;
+ curve[(3 + inside) % 4].vertex.cc[0] = t1;
+ curve[0].vertex.cc[1] = curve[1].vertex.cc[1] = 0; /* Initialize against FPE. */
+ curve[2].vertex.cc[1] = curve[3].vertex.cc[1] = 0; /* Initialize against FPE. */
+ code = patch_fill(pfs, curve, NULL, NULL);
+ if (code < 0)
+ return code;
}
return 0;
}
-
static int
-R_outer_circle(patch_fill_state_t *pfs, const gs_rect *rect,
- double x0, double y0, double r0,
- double x1, double y1, double r1,
- double *x2, double *y2, double *r2)
+R_outer_circle(patch_fill_state_t *pfs, const gs_rect *rect,
+ double x0, double y0, double r0,
+ double x1, double y1, double r1,
+ double *x2, double *y2, double *r2)
{
double dx = x1 - x0, dy = y1 - y0;
double sp, sq, s;
/* Compute a cone circle, which contacts the rect externally. */
- /* Don't bother with all 4 sides of the rect,
+ /* Don't bother with all 4 sides of the rect,
just do with the X or Y span only,
so it's not an exact contact, sorry. */
if (any_abs(dx) > any_abs(dy)) {
- /* Solving :
- x0 + (x1 - x0) * sq + r0 + (r1 - r0) * sq == bbox_px
- (x1 - x0) * sp + (r1 - r0) * sp == bbox_px - x0 - r0
- sp = (bbox_px - x0 - r0) / (x1 - x0 + r1 - r0)
-
- x0 + (x1 - x0) * sq - r0 - (r1 - r0) * sq == bbox_qx
- (x1 - x0) * sq - (r1 - r0) * sq == bbox_x - x0 + r0
- sq = (bbox_x - x0 + r0) / (x1 - x0 - r1 + r0)
- */
- if (x1 - x0 + r1 - r0 == 0) /* We checked for obtuse cone. */
- return_error(gs_error_unregistered); /* Must not happen. */
- if (x1 - x0 - r1 + r0 == 0) /* We checked for obtuse cone. */
- return_error(gs_error_unregistered); /* Must not happen. */
- sp = (rect->p.x - x0 - r0) / (x1 - x0 + r1 - r0);
- sq = (rect->q.x - x0 + r0) / (x1 - x0 - r1 + r0);
+ /* Solving :
+ x0 + (x1 - x0) * sq + r0 + (r1 - r0) * sq == bbox_px
+ (x1 - x0) * sp + (r1 - r0) * sp == bbox_px - x0 - r0
+ sp = (bbox_px - x0 - r0) / (x1 - x0 + r1 - r0)
+
+ x0 + (x1 - x0) * sq - r0 - (r1 - r0) * sq == bbox_qx
+ (x1 - x0) * sq - (r1 - r0) * sq == bbox_x - x0 + r0
+ sq = (bbox_x - x0 + r0) / (x1 - x0 - r1 + r0)
+ */
+ if (x1 - x0 + r1 - r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (x1 - x0 - r1 + r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ sp = (rect->p.x - x0 - r0) / (x1 - x0 + r1 - r0);
+ sq = (rect->q.x - x0 + r0) / (x1 - x0 - r1 + r0);
} else {
- /* Same by Y. */
- if (y1 - y0 + r1 - r0 == 0) /* We checked for obtuse cone. */
- return_error(gs_error_unregistered); /* Must not happen. */
- if (y1 - y0 - r1 + r0 == 0) /* We checked for obtuse cone. */
- return_error(gs_error_unregistered); /* Must not happen. */
- sp = (rect->p.y - y0 - r0) / (y1 - y0 + r1 - r0);
- sq = (rect->q.y - y0 + r0) / (y1 - y0 - r1 + r0);
+ /* Same by Y. */
+ if (y1 - y0 + r1 - r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ if (y1 - y0 - r1 + r0 == 0) /* We checked for obtuse cone. */
+ return_error(gs_error_unregistered); /* Must not happen. */
+ sp = (rect->p.y - y0 - r0) / (y1 - y0 + r1 - r0);
+ sq = (rect->q.y - y0 + r0) / (y1 - y0 - r1 + r0);
}
if (sp >= 1 && sq >= 1)
- s = max(sp, sq);
+ s = max(sp, sq);
else if(sp >= 1)
- s = sp;
+ s = sp;
else if (sq >= 1)
- s = sq;
+ s = sq;
else {
- /* The circle 1 is outside the rect, use it. */
+ /* The circle 1 is outside the rect, use it. */
s = 1;
}
if (r0 + (r1 - r0) * s < 0) {
- /* Passed the cone apex, use the apex. */
- s = r0 / (r0 - r1);
- *r2 = 0;
+ /* Passed the cone apex, use the apex. */
+ s = r0 / (r0 - r1);
+ *r2 = 0;
} else
- *r2 = r0 + (r1 - r0) * s;
+ *r2 = r0 + (r1 - r0) * s;
*x2 = x0 + (x1 - x0) * s;
*y2 = y0 + (y1 - y0) * s;
return 0;
}
-static double
+static double
R_rect_radius(const gs_rect *rect, double x0, double y0)
{
double d, dd;
@@ -472,7 +470,7 @@ R_rect_radius(const gs_rect *rect, double x0, double y0)
}
static int
-R_fill_triangle_new(patch_fill_state_t *pfs, const gs_rect *rect,
+R_fill_triangle_new(patch_fill_state_t *pfs, const gs_rect *rect,
double x0, double y0, double x1, double y1, double x2, double y2, double t)
{
shading_vertex_t p0, p1, p2;
@@ -485,13 +483,13 @@ R_fill_triangle_new(patch_fill_state_t *pfs, const gs_rect *rect,
p2.c = c;
code = gs_point_transform2fixed(&pfs->pis->ctm, x0, y0, &p0.p);
if (code >= 0)
- code = gs_point_transform2fixed(&pfs->pis->ctm, x1, y1, &p1.p);
+ code = gs_point_transform2fixed(&pfs->pis->ctm, x1, y1, &p1.p);
if (code >= 0)
- code = gs_point_transform2fixed(&pfs->pis->ctm, x2, y2, &p2.p);
+ code = gs_point_transform2fixed(&pfs->pis->ctm, x2, y2, &p2.p);
if (code >= 0) {
- c->t[0] = c->t[1] = t;
- patch_resolve_color(c, pfs);
- code = mesh_triangle(pfs, &p0, &p1, &p2);
+ c->t[0] = c->t[1] = t;
+ patch_resolve_color(c, pfs);
+ code = mesh_triangle(pfs, &p0, &p1, &p2);
}
release_colors(pfs, pfs->color_stack, 1);
return code;
@@ -499,9 +497,9 @@ R_fill_triangle_new(patch_fill_state_t *pfs, const gs_rect *rect,
static int
R_obtuse_cone(patch_fill_state_t *pfs, const gs_rect *rect,
- double x0, double y0, double r0,
- double x1, double y1, double r1, double t0, double r_rect,
- bool inwards)
+ double x0, double y0, double r0,
+ double x1, double y1, double r1, double t0, double r_rect,
+ bool inwards)
{
double dx = x1 - x0, dy = y1 - y0, dr = any_abs(r1 - r0);
double d = hypot(dx, dy);
@@ -516,57 +514,57 @@ R_obtuse_cone(patch_fill_state_t *pfs, const gs_rect *rect,
ay = y0 + (y1 - y0) * as;
g0 = sqrt(dx * dx + dy * dy - dr * dr) * as;
if (g0 < 1e-7 * r0) {
- /* Nearly degenerate, replace with half-plane. */
- /* Restrict the half plane with triangle, which covers the rect. */
- gs_point p0, p1, p2; /* Right tangent limit, apex limit, left tangent linit,
- (right, left == when looking from the apex). */
-
- p0.x = ax - dy * r / d;
- p0.y = ay + dx * r / d;
- p1.x = ax - dx * r / d;
- p1.y = ay - dy * r / d;
- p2.x = ax + dy * r / d;
- p2.y = ay - dx * r / d;
- /* Split into 2 triangles at the apex,
- so that the apex is preciselly covered.
- Especially important when it is not exactly degenerate. */
- code = R_fill_triangle_new(pfs, rect, ax, ay, p0.x, p0.y, p1.x, p1.y, t0);
- if (code < 0)
- return code;
- return R_fill_triangle_new(pfs, rect, ax, ay, p1.x, p1.y, p2.x, p2.y, t0);
+ /* Nearly degenerate, replace with half-plane. */
+ /* Restrict the half plane with triangle, which covers the rect. */
+ gs_point p0, p1, p2; /* Right tangent limit, apex limit, left tangent linit,
+ (right, left == when looking from the apex). */
+
+ p0.x = ax - dy * r / d;
+ p0.y = ay + dx * r / d;
+ p1.x = ax - dx * r / d;
+ p1.y = ay - dy * r / d;
+ p2.x = ax + dy * r / d;
+ p2.y = ay - dx * r / d;
+ /* Split into 2 triangles at the apex,
+ so that the apex is preciselly covered.
+ Especially important when it is not exactly degenerate. */
+ code = R_fill_triangle_new(pfs, rect, ax, ay, p0.x, p0.y, p1.x, p1.y, t0);
+ if (code < 0)
+ return code;
+ return R_fill_triangle_new(pfs, rect, ax, ay, p1.x, p1.y, p2.x, p2.y, t0);
} else {
- /* Compute the "limit" circle so that its
- tangent points are outside the rect. */
- /* Note: this branch is executed when the condition above is false :
- g0 >= 1e-7 * r0 .
- We believe that computing this branch with doubles
- provides enough precision after converting coordinates into 'fixed',
- and that the limit circle radius is not dramatically big.
- */
- double es, er; /* The limit circle parameter, radius. */
- double ex, ey; /* The limit circle centrum. */
-
- es = as - as * r / g0; /* Always negative. */
- er = r * r0 / g0 ;
- ex = x0 + dx * es;
- ey = y0 + dy * es;
- /* Fill the annulus: */
- code = R_tensor_annulus(pfs, rect, x0, y0, r0, t0, ex, ey, er, t0);
- if (code < 0)
- return code;
- /* Fill entire ending circle to ensure entire rect is covered, but
- * only if we are filling "inwards" (as otherwise we will overwrite
- * all the hard work we have done to this point) */
- if (inwards)
- code = R_tensor_annulus(pfs, rect, ex, ey, er, t0, ex, ey, 0, t0);
+ /* Compute the "limit" circle so that its
+ tangent points are outside the rect. */
+ /* Note: this branch is executed when the condition above is false :
+ g0 >= 1e-7 * r0 .
+ We believe that computing this branch with doubles
+ provides enough precision after converting coordinates into 'fixed',
+ and that the limit circle radius is not dramatically big.
+ */
+ double es, er; /* The limit circle parameter, radius. */
+ double ex, ey; /* The limit circle centrum. */
+
+ es = as - as * r / g0; /* Always negative. */
+ er = r * r0 / g0 ;
+ ex = x0 + dx * es;
+ ey = y0 + dy * es;
+ /* Fill the annulus: */
+ code = R_tensor_annulus(pfs, rect, x0, y0, r0, t0, ex, ey, er, t0);
+ if (code < 0)
+ return code;
+ /* Fill entire ending circle to ensure entire rect is covered, but
+ * only if we are filling "inwards" (as otherwise we will overwrite
+ * all the hard work we have done to this point) */
+ if (inwards)
+ code = R_tensor_annulus(pfs, rect, ex, ey, er, t0, ex, ey, 0, t0);
return code;
}
}
static int
R_tensor_cone_apex(patch_fill_state_t *pfs, const gs_rect *rect,
- double x0, double y0, double r0,
- double x1, double y1, double r1, double t)
+ double x0, double y0, double r0,
+ double x1, double y1, double r1, double t)
{
double as = r0 / (r0 - r1);
double ax = x0 + (x1 - x0) * as;
@@ -575,7 +573,6 @@ R_tensor_cone_apex(patch_fill_state_t *pfs, const gs_rect *rect,
return R_tensor_annulus(pfs, rect, x1, y1, r1, t, ax, ay, 0, t);
}
-
/*
* A map of this code:
*
@@ -617,14 +614,14 @@ R_tensor_cone_apex(patch_fill_state_t *pfs, const gs_rect *rect,
* '-> fill_triangle_wedge_aux |
* '-> fill_wedge_trap |
* '-> wedge_trap_decompose |
- * '-> linear_color_trapezoid |
+ * '-> linear_color_trapezoid |
* '-> decompose_linear_color <--|
* |-------------------------'
* '-> constant_color_trapezoid
*/
static int
-R_extensions(patch_fill_state_t *pfs, const gs_shading_R_t *psh, const gs_rect *rect,
- double t0, double t1, bool Extend0, bool Extend1)
+R_extensions(patch_fill_state_t *pfs, const gs_shading_R_t *psh, const gs_rect *rect,
+ double t0, double t1, bool Extend0, bool Extend1)
{
float x0 = psh->params.Coords[0], y0 = psh->params.Coords[1];
floatp r0 = psh->params.Coords[2];
@@ -635,76 +632,76 @@ R_extensions(patch_fill_state_t *pfs, const gs_shading_R_t *psh, const gs_rect *
int code;
if (dr >= d - 1e-7 * (d + dr)) {
- /* Nested circles, or degenerate. */
- if (r0 > r1) {
- if (Extend0) {
- r = R_rect_radius(rect, x0, y0);
- if (r > r0) {
- code = R_tensor_annulus(pfs, rect, x0, y0, r, t0, x0, y0, r0, t0);
- if (code < 0)
- return code;
- }
- }
- if (Extend1 && r1 > 0)
- return R_tensor_annulus(pfs, rect, x1, y1, r1, t1, x1, y1, 0, t1);
- } else {
- if (Extend1) {
- r = R_rect_radius(rect, x1, y1);
- if (r > r1) {
- code = R_tensor_annulus(pfs, rect, x1, y1, r, t1, x1, y1, r1, t1);
- if (code < 0)
- return code;
- }
- }
- if (Extend0 && r0 > 0)
- return R_tensor_annulus(pfs, rect, x0, y0, r0, t0, x0, y0, 0, t0);
- }
+ /* Nested circles, or degenerate. */
+ if (r0 > r1) {
+ if (Extend0) {
+ r = R_rect_radius(rect, x0, y0);
+ if (r > r0) {
+ code = R_tensor_annulus(pfs, rect, x0, y0, r, t0, x0, y0, r0, t0);
+ if (code < 0)
+ return code;
+ }
+ }
+ if (Extend1 && r1 > 0)
+ return R_tensor_annulus(pfs, rect, x1, y1, r1, t1, x1, y1, 0, t1);
+ } else {
+ if (Extend1) {
+ r = R_rect_radius(rect, x1, y1);
+ if (r > r1) {
+ code = R_tensor_annulus(pfs, rect, x1, y1, r, t1, x1, y1, r1, t1);
+ if (code < 0)
+ return code;
+ }
+ }
+ if (Extend0 && r0 > 0)
+ return R_tensor_annulus(pfs, rect, x0, y0, r0, t0, x0, y0, 0, t0);
+ }
} else if (dr > d / 3) {
- /* Obtuse cone. */
- if (r0 > r1) {
- if (Extend0) {
- r = R_rect_radius(rect, x0, y0);
- code = R_obtuse_cone(pfs, rect, x0, y0, r0, x1, y1, r1, t0, r, true);
- if (code < 0)
- return code;
- }
- if (Extend1 && r1 != 0)
- return R_tensor_cone_apex(pfs, rect, x0, y0, r0, x1, y1, r1, t1);
- return 0;
- } else {
- if (Extend1) {
- r = R_rect_radius(rect, x1, y1);
- code = R_obtuse_cone(pfs, rect, x1, y1, r1, x0, y0, r0, t1, r, false);
- if (code < 0)
- return code;
- }
- if (Extend0 && r0 != 0)
- return R_tensor_cone_apex(pfs, rect, x1, y1, r1, x0, y0, r0, t0);
- }
+ /* Obtuse cone. */
+ if (r0 > r1) {
+ if (Extend0) {
+ r = R_rect_radius(rect, x0, y0);
+ code = R_obtuse_cone(pfs, rect, x0, y0, r0, x1, y1, r1, t0, r, true);
+ if (code < 0)
+ return code;
+ }
+ if (Extend1 && r1 != 0)
+ return R_tensor_cone_apex(pfs, rect, x0, y0, r0, x1, y1, r1, t1);
+ return 0;
+ } else {
+ if (Extend1) {
+ r = R_rect_radius(rect, x1, y1);
+ code = R_obtuse_cone(pfs, rect, x1, y1, r1, x0, y0, r0, t1, r, false);
+ if (code < 0)
+ return code;
+ }
+ if (Extend0 && r0 != 0)
+ return R_tensor_cone_apex(pfs, rect, x1, y1, r1, x0, y0, r0, t0);
+ }
} else {
- /* Acute cone or cylinder. */
- double x2, y2, r2, x3, y3, r3;
-
- if (Extend0) {
- code = R_outer_circle(pfs, rect, x1, y1, r1, x0, y0, r0, &x3, &y3, &r3);
- if (code < 0)
- return code;
- if (x3 != x1 || y3 != y1) {
- code = R_tensor_annulus(pfs, rect, x0, y0, r0, t0, x3, y3, r3, t0);
- if (code < 0)
- return code;
- }
- }
- if (Extend1) {
- code = R_outer_circle(pfs, rect, x0, y0, r0, x1, y1, r1, &x2, &y2, &r2);
- if (code < 0)
- return code;
- if (x2 != x0 || y2 != y0) {
- code = R_tensor_annulus(pfs, rect, x1, y1, r1, t1, x2, y2, r2, t1);
- if (code < 0)
- return code;
- }
- }
+ /* Acute cone or cylinder. */
+ double x2, y2, r2, x3, y3, r3;
+
+ if (Extend0) {
+ code = R_outer_circle(pfs, rect, x1, y1, r1, x0, y0, r0, &x3, &y3, &r3);
+ if (code < 0)
+ return code;
+ if (x3 != x1 || y3 != y1) {
+ code = R_tensor_annulus(pfs, rect, x0, y0, r0, t0, x3, y3, r3, t0);
+ if (code < 0)
+ return code;
+ }
+ }
+ if (Extend1) {
+ code = R_outer_circle(pfs, rect, x0, y0, r0, x1, y1, r1, &x2, &y2, &r2);
+ if (code < 0)
+ return code;
+ if (x2 != x0 || y2 != y0) {
+ code = R_tensor_annulus(pfs, rect, x1, y1, r1, t1, x2, y2, r2, t1);
+ if (code < 0)
+ return code;
+ }
+ }
}
return 0;
}
@@ -712,7 +709,7 @@ R_extensions(patch_fill_state_t *pfs, const gs_shading_R_t *psh, const gs_rect *
static int
R_fill_rect_with_const_color(patch_fill_state_t *pfs, const gs_fixed_rect *clip_rect, float t)
{
-#if 0 /* Disabled because the clist writer device doesn't pass
+#if 0 /* Disabled because the clist writer device doesn't pass
the clipping path with fill_recatangle. */
patch_color_t pc;
const gs_color_space *pcs = pfs->direct_space;
@@ -721,17 +718,17 @@ R_fill_rect_with_const_color(patch_fill_state_t *pfs, const gs_fixed_rect *clip_
code = gs_function_evaluate(pfs->Function, &t, pc.cc.paint.values);
if (code < 0)
- return code;
+ return code;
pcs->type->restrict_color(&pc.cc, pcs);
code = patch_color_to_device_color(pfs, &pc, &dc);
if (code < 0)
- return code;
- return gx_fill_rectangle_device_rop(fixed2int_pixround(clip_rect->p.x), fixed2int_pixround(clip_rect->p.y),
- fixed2int_pixround(clip_rect->q.x) - fixed2int_pixround(clip_rect->p.x),
- fixed2int_pixround(clip_rect->q.y) - fixed2int_pixround(clip_rect->p.y),
- &dc, pfs->dev, pfs->pis->log_op);
+ return code;
+ return gx_fill_rectangle_device_rop(fixed2int_pixround(clip_rect->p.x), fixed2int_pixround(clip_rect->p.y),
+ fixed2int_pixround(clip_rect->q.x) - fixed2int_pixround(clip_rect->p.x),
+ fixed2int_pixround(clip_rect->q.y) - fixed2int_pixround(clip_rect->p.y),
+ &dc, pfs->dev, pfs->pis->log_op);
#else
- /* Can't apply fill_rectangle, because the clist writer device doesn't pass
+ /* Can't apply fill_rectangle, because the clist writer device doesn't pass
the clipping path with fill_recatangle. Convert into trapezoids instead.
*/
quadrangle_patch p;
@@ -742,7 +739,7 @@ R_fill_rect_with_const_color(patch_fill_state_t *pfs, const gs_fixed_rect *clip_
code = gs_function_evaluate(pfs->Function, &t, pc.cc.paint.values);
if (code < 0)
- return code;
+ return code;
pcs->type->restrict_color(&pc.cc, pcs);
pc.t[0] = pc.t[1] = t;
pp[0][0].p = clip_rect->p;
@@ -784,16 +781,16 @@ radial_shading_external_contact(radial_shading_attrs_t *rsa, int point_index, do
double dy = rsa->p[point_index - 1].y - rsa->p[point_index].y;
if (at_corner) {
- double Dx = rsa->p[point_index + 1].x - rsa->p[point_index].x;
- double Dy = rsa->p[point_index + 1].y - rsa->p[point_index].y;
- bool b1 = (dx * rx + dy * ry >= 0);
- bool b2 = (Dx * rx + Dy * ry >= 0);
+ double Dx = rsa->p[point_index + 1].x - rsa->p[point_index].x;
+ double Dy = rsa->p[point_index + 1].y - rsa->p[point_index].y;
+ bool b1 = (dx * rx + dy * ry >= 0);
+ bool b2 = (Dx * rx + Dy * ry >= 0);
- if (b1 & b2)
- rsa->outer_contact[root_index] = true;
+ if (b1 & b2)
+ rsa->outer_contact[root_index] = true;
} else {
- if (rx * dy - ry * dx < 0)
- rsa->outer_contact[root_index] = true;
+ if (rx * dy - ry * dx < 0)
+ rsa->outer_contact[root_index] = true;
}
}
@@ -803,23 +800,23 @@ store_roots(radial_shading_attrs_t *rsa, const bool have_root[2], const double t
int i;
for (i = 0; i < 2; i++) {
- bool good_root;
-
- if (!have_root[i])
- continue;
- good_root = (!rsa->have_apex || (rsa->apex <= 0 || r0 == 0 ? t[i] >= rsa->apex : t[i] <= rsa->apex));
- if (good_root) {
- radial_shading_external_contact(rsa, point_index, t[i], r0, r1, at_corner, i);
- if (!rsa->have_root[i]) {
- rsa->span[i][0] = rsa->span[i][1] = t[i];
- rsa->have_root[i] = true;
- } else {
- if (rsa->span[i][0] > t[i])
- rsa->span[i][0] = t[i];
- if (rsa->span[i][1] < t[i])
- rsa->span[i][1] = t[i];
- }
- }
+ bool good_root;
+
+ if (!have_root[i])
+ continue;
+ good_root = (!rsa->have_apex || (rsa->apex <= 0 || r0 == 0 ? t[i] >= rsa->apex : t[i] <= rsa->apex));
+ if (good_root) {
+ radial_shading_external_contact(rsa, point_index, t[i], r0, r1, at_corner, i);
+ if (!rsa->have_root[i]) {
+ rsa->span[i][0] = rsa->span[i][1] = t[i];
+ rsa->have_root[i] = true;
+ } else {
+ if (rsa->span[i][0] > t[i])
+ rsa->span[i][0] = t[i];
+ if (rsa->span[i][1] < t[i])
+ rsa->span[i][1] = t[i];
+ }
+ }
}
}
@@ -832,38 +829,38 @@ compute_radial_shading_span_extended_side(radial_shading_attrs_t *rsa, double r0
bool by_x = (rsa->p[point_index].x == rsa->p[point_index + 1].x);
int i;
- /* Assuming x0 = y0 = 0 :
- cc * t +- (r0 + (r1 - r0) * t) == c
+ /* Assuming x0 = y0 = 0 :
+ cc * t +- (r0 + (r1 - r0) * t) == c
t0 := (c - r0) / (cc + (r1 - r0))
t1 := (c + r0) / (cc - (r1 - r0))
*/
if (by_x) {
- c = rsa->p[point_index].x - rsa->x0;
- cc = rsa->x1 - rsa->x0;
+ c = rsa->p[point_index].x - rsa->x0;
+ cc = rsa->x1 - rsa->x0;
} else {
- c = rsa->p[point_index].y - rsa->y0;
- cc = rsa->y1 - rsa->y0;
+ c = rsa->p[point_index].y - rsa->y0;
+ cc = rsa->y1 - rsa->y0;
}
t[0] = (c - r0) / (cc + r1 - r0);
t[1] = (c + r0) / (cc - r1 + r0);
if (t[0] > t[1]) {
- t[0] = t[1];
- t[1] = (c - r0) / (cc + r1 - r0);
+ t[0] = t[1];
+ t[1] = (c - r0) / (cc + r1 - r0);
}
for (i = 0; i < 2; i++) {
- double d, d0, d1;
-
- if (by_x) {
- d = rsa->y1 - rsa->y0 + r0 + (r1 - r0) * t[i];
- d0 = rsa->p[point_index].y;
- d1 = rsa->p[point_index + 1].y;
- } else {
- d = rsa->x1 - rsa->x0 + r0 + (r1 - r0) * t[i];
- d0 = rsa->p[point_index].x;
- d1 = rsa->p[point_index + 1].x;
- }
- if (d1 > d0 ? d0 <= d && d <= d1 : d1 <= d && d <= d0)
- have_root[i] = true;
+ double d, d0, d1;
+
+ if (by_x) {
+ d = rsa->y1 - rsa->y0 + r0 + (r1 - r0) * t[i];
+ d0 = rsa->p[point_index].y;
+ d1 = rsa->p[point_index + 1].y;
+ } else {
+ d = rsa->x1 - rsa->x0 + r0 + (r1 - r0) * t[i];
+ d0 = rsa->p[point_index].x;
+ d1 = rsa->p[point_index + 1].x;
+ }
+ if (d1 > d0 ? d0 <= d && d <= d1 : d1 <= d && d <= d0)
+ have_root[i] = true;
}
store_roots(rsa, have_root, t, r0, r1, point_index, false);
}
@@ -880,40 +877,40 @@ compute_radial_shading_span_extended_point(radial_shading_attrs_t *rsa, double r
double t[2];
if (fabs(div) < 1e-8) {
- /* Linear equation. */
- /* This case is always the ongoing eclipese contact. */
- double cx = rsa->x0 - (rsa->x1 - rsa->x0) * r0 / (r1 - r0);
- double cy = rsa->y0 - (rsa->y1 - rsa->y0) * r0 / (r1 - r0);
-
- t[0] = (Pw2(qx) + Pw2(qy))/(cx*qx + cy*qy) / 2;
- have_root[0] = true;
+ /* Linear equation. */
+ /* This case is always the ongoing eclipese contact. */
+ double cx = rsa->x0 - (rsa->x1 - rsa->x0) * r0 / (r1 - r0);
+ double cy = rsa->y0 - (rsa->y1 - rsa->y0) * r0 / (r1 - r0);
+
+ t[0] = (Pw2(qx) + Pw2(qy))/(cx*qx + cy*qy) / 2;
+ have_root[0] = true;
} else {
- /* Square equation. */
- double desc2 = -((Pw2(qx) + Pw2(qy) - Pw2(r0))*(Pw2(p1x) + Pw2(p1y) - Pw2(r0 - r1))) + Pw2(p1x*qx + p1y*qy + r0*(-r0 + r1));
-
- if (desc2 < 0) {
- return -1; /* The point is outside the shading coverage.
- Do not shorten, because we didn't observe it in practice. */
- } else {
- double desc1 = sqrt(desc2);
-
- if (div > 0) {
- t[0] = (p1x*qx + p1y*qy + r0*(-r0 + r1) - desc1) / div;
- t[1] = (p1x*qx + p1y*qy + r0*(-r0 + r1) + desc1) / div;
- } else {
- t[0] = (p1x*qx + p1y*qy + r0*(-r0 + r1) + desc1) / div;
- t[1] = (p1x*qx + p1y*qy + r0*(-r0 + r1) - desc1) / div;
- }
- have_root[0] = have_root[1] = true;
- }
+ /* Square equation. */
+ double desc2 = -((Pw2(qx) + Pw2(qy) - Pw2(r0))*(Pw2(p1x) + Pw2(p1y) - Pw2(r0 - r1))) + Pw2(p1x*qx + p1y*qy + r0*(-r0 + r1));
+
+ if (desc2 < 0) {
+ return -1; /* The point is outside the shading coverage.
+ Do not shorten, because we didn't observe it in practice. */
+ } else {
+ double desc1 = sqrt(desc2);
+
+ if (div > 0) {
+ t[0] = (p1x*qx + p1y*qy + r0*(-r0 + r1) - desc1) / div;
+ t[1] = (p1x*qx + p1y*qy + r0*(-r0 + r1) + desc1) / div;
+ } else {
+ t[0] = (p1x*qx + p1y*qy + r0*(-r0 + r1) + desc1) / div;
+ t[1] = (p1x*qx + p1y*qy + r0*(-r0 + r1) - desc1) / div;
+ }
+ have_root[0] = have_root[1] = true;
+ }
}
store_roots(rsa, have_root, t, r0, r1, point_index, true);
- if (have_root[0] && have_root[1])
- return 15;
+ if (have_root[0] && have_root[1])
+ return 15;
if (have_root[0])
- return 15 - 4;
+ return 15 - 4;
if (have_root[1])
- return 15 - 2;
+ return 15 - 2;
return -1;
}
@@ -923,19 +920,19 @@ static int
compute_radial_shading_span_extended(radial_shading_attrs_t *rsa, double r0, double r1)
{
int span_type0, span_type1;
-
+
span_type0 = compute_radial_shading_span_extended_point(rsa, r0, r1, 1);
if (span_type0 == -1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended_point(rsa, r0, r1, 2);
if (span_type0 != span_type1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended_point(rsa, r0, r1, 3);
if (span_type0 != span_type1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended_point(rsa, r0, r1, 4);
if (span_type0 != span_type1)
- return -1;
+ return -1;
compute_radial_shading_span_extended_side(rsa, r0, r1, 1);
compute_radial_shading_span_extended_side(rsa, r0, r1, 2);
compute_radial_shading_span_extended_side(rsa, r0, r1, 3);
@@ -952,8 +949,8 @@ compute_radial_shading_span(radial_shading_attrs_t *rsa, float x0, float y0, flo
our math is not applicable, and we render entire shading.
If the path bbox is inside the shading area,
we compute 1 or 2 'spans' - the shading parameter intervals,
- which covers the bbox. For doing that we need to resolve
- a square eqation by the shading parameter
+ which covers the bbox. For doing that we need to resolve
+ a square eqation by the shading parameter
for each corner of the bounding box,
and for each side of the shading bbox.
Note the equation to be solved in the user space.
@@ -963,7 +960,7 @@ compute_radial_shading_span(radial_shading_attrs_t *rsa, float x0, float y0, flo
the running circle, and the second one corresponds to the last (outgoing) contact
(like in a sun eclipse; well our sun is rectangular).
- Here are few exceptions.
+ Here are few exceptions.
First, the equation degenerates when the distance sqrt((x1-x0)^2 + (y1-y0)^2)
appears equal to r0-r1. In this case the base circles do contact,
@@ -989,7 +986,7 @@ compute_radial_shading_span(radial_shading_attrs_t *rsa, float x0, float y0, flo
implement this optimization. The general tensor patch algorithm
will skip uncovering parts.
- Fourth, when one base circle is (almost) inside the other,
+ Fourth, when one base circle is (almost) inside the other,
the parameter interval must include the shading apex.
To know that, we determine whether the contacting circle
is outside the rectangle (the "outer" contact),
@@ -997,7 +994,7 @@ compute_radial_shading_span(radial_shading_attrs_t *rsa, float x0, float y0, flo
At last, a small shortening of a shading won't give a
sensible speedup, but it may replace a symmetric function domain
- with an assymmetric one, so that the rendering
+ with an assymmetric one, so that the rendering
would be asymmetyric for a symmetric shading.
Therefore we do not perform a small sortening.
Instead we shorten only if the shading span
@@ -1021,40 +1018,40 @@ compute_radial_shading_span(radial_shading_attrs_t *rsa, float x0, float y0, flo
rsa->apex = (rsa->have_apex ? -r0 / (r1 - r0) : 0);
span_type0 = compute_radial_shading_span_extended(rsa, r0 / extent, r1 * extent);
if (span_type0 == -1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended(rsa, r0 / extent, r1 / extent);
if (span_type0 != span_type1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended(rsa, r0 * extent, r1 * extent);
if (span_type0 != span_type1)
- return -1;
+ return -1;
span_type1 = compute_radial_shading_span_extended(rsa, r0 * extent, r1 / extent);
if (span_type1 == -1)
- return -1;
+ return -1;
if (r0 < r1) {
- if (rsa->have_root[0] && !rsa->outer_contact[0])
- rsa->span[0][0] = rsa->apex; /* Likely never happens. Remove ? */
- if (rsa->have_root[1] && !rsa->outer_contact[1])
- rsa->span[1][0] = rsa->apex;
+ if (rsa->have_root[0] && !rsa->outer_contact[0])
+ rsa->span[0][0] = rsa->apex; /* Likely never happens. Remove ? */
+ if (rsa->have_root[1] && !rsa->outer_contact[1])
+ rsa->span[1][0] = rsa->apex;
} else if (r0 > r1) {
- if (rsa->have_root[0] && !rsa->outer_contact[0])
- rsa->span[0][1] = rsa->apex;
- if (rsa->have_root[1] && !rsa->outer_contact[1])
- rsa->span[1][1] = rsa->apex; /* Likely never happens. Remove ? */
+ if (rsa->have_root[0] && !rsa->outer_contact[0])
+ rsa->span[0][1] = rsa->apex;
+ if (rsa->have_root[1] && !rsa->outer_contact[1])
+ rsa->span[1][1] = rsa->apex; /* Likely never happens. Remove ? */
}
span_type = 0;
if (rsa->have_root[0] && rsa->span[0][0] < 0)
- span_type |= 1;
+ span_type |= 1;
if (rsa->have_root[1] && rsa->span[1][0] < 0)
- span_type |= 1;
+ span_type |= 1;
if (rsa->have_root[0] && rsa->span[0][1] > 0 && rsa->span[0][0] < 1)
- span_type |= 2;
+ span_type |= 2;
if (rsa->have_root[1] && rsa->span[1][1] > 0 && rsa->span[1][0] < 1)
- span_type |= 4;
+ span_type |= 4;
if (rsa->have_root[0] && rsa->span[0][1] > 1)
- span_type |= 8;
+ span_type |= 8;
if (rsa->have_root[1] && rsa->span[1][1] > 1)
- span_type |= 8;
+ span_type |= 8;
return span_type;
}
@@ -1064,30 +1061,30 @@ shorten_radial_shading(float *x0, float *y0, floatp *r0, float *d0, float *x1, f
double s0 = span_[0], s1 = span_[1], w;
if (s0 < 0)
- s0 = 0;
+ s0 = 0;
if (s1 < 0)
- s1 = 0;
+ s1 = 0;
if (s0 > 1)
- s0 = 1;
+ s0 = 1;
if (s1 > 1)
- s1 = 1;
+ s1 = 1;
w = s1 - s0;
if (w == 0)
- return false; /* Don't pass a degenerate shading. */
+ return false; /* Don't pass a degenerate shading. */
if (w > 0.3)
- return false; /* The span is big, don't shorten it. */
+ return false; /* The span is big, don't shorten it. */
{ /* Do shorten. */
- double R0 = *r0, X0 = *x0, Y0 = *y0, D0 = *d0;
- double R1 = *r1, X1 = *x1, Y1 = *y1, D1 = *d1;
-
- *r0 = R0 + (R1 - R0) * s0;
- *x0 = X0 + (X1 - X0) * s0;
- *y0 = Y0 + (Y1 - Y0) * s0;
- *d0 = D0 + (D1 - D0) * s0;
- *r1 = R0 + (R1 - R0) * s1;
- *x1 = X0 + (X1 - X0) * s1;
- *y1 = Y0 + (Y1 - Y0) * s1;
- *d1 = D0 + (D1 - D0) * s1;
+ double R0 = *r0, X0 = *x0, Y0 = *y0, D0 = *d0;
+ double R1 = *r1, X1 = *x1, Y1 = *y1, D1 = *d1;
+
+ *r0 = R0 + (R1 - R0) * s0;
+ *x0 = X0 + (X1 - X0) * s0;
+ *y0 = Y0 + (Y1 - Y0) * s0;
+ *d0 = D0 + (D1 - D0) * s0;
+ *r1 = R0 + (R1 - R0) * s1;
+ *x1 = X0 + (X1 - X0) * s1;
+ *y1 = Y0 + (Y1 - Y0) * s1;
+ *d1 = D0 + (D1 - D0) * s1;
}
return true;
}
@@ -1109,17 +1106,17 @@ is_radial_shading_large(double x0, double y0, double r0, double d0, double x1, d
/* If one dimension is large enough, the shading parameter span is wide. */
areaX = (rect->q.x - rect->p.x) * (rect->q.x - rect->p.x);
if (areaX * arbitrary < area0 + area1 + area2)
- return true;
+ return true;
areaY = (rect->q.y - rect->p.y) * (rect->q.y - rect->p.y);
if (areaY * arbitrary < area0 + area1 + area2)
- return true;
+ return true;
return false;
}
static int
gs_shading_R_fill_rectangle_aux(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect *clip_rect,
- gx_device * dev, gs_imager_state * pis)
+ const gs_fixed_rect *clip_rect,
+ gx_device * dev, gs_imager_state * pis)
{
const gs_shading_R_t *const psh = (const gs_shading_R_t *)psh0;
float d0 = psh->params.Domain[0], d1 = psh->params.Domain[1];
@@ -1133,87 +1130,87 @@ gs_shading_R_fill_rectangle_aux(const gs_shading_t * psh0, const gs_rect * rect,
patch_fill_state_t pfs1;
if (r0 == 0 && r1 == 0)
- return 0; /* PLRM requires to paint nothing. */
+ return 0; /* PLRM requires to paint nothing. */
shade_init_fill_state((shading_fill_state_t *)&pfs1, psh0, dev, pis);
pfs1.Function = psh->params.Function;
code = init_patch_fill_state(&pfs1);
if (code < 0) {
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
- return code;
+ return code;
}
pfs1.function_arg_shift = 1;
pfs1.rect = *clip_rect;
pfs1.maybe_self_intersecting = false;
if (is_radial_shading_large(x0, y0, r0, d0, x1, y1, r1, rect))
- span_type = compute_radial_shading_span(&rsa, x0, y0, r0, x1, y1, r1, rect);
+ span_type = compute_radial_shading_span(&rsa, x0, y0, r0, x1, y1, r1, rect);
else
- span_type = -1;
+ span_type = -1;
if (span_type < 0) {
- code = R_extensions(&pfs1, psh, rect, d0, d1, psh->params.Extend[0], false);
- if (code >= 0)
- code = R_tensor_annulus(&pfs1, rect, x0, y0, r0, d0, x1, y1, r1, d1);
- if (code >= 0)
- code = R_extensions(&pfs1, psh, rect, d0, d1, false, psh->params.Extend[1]);
+ code = R_extensions(&pfs1, psh, rect, d0, d1, psh->params.Extend[0], false);
+ if (code >= 0)
+ code = R_tensor_annulus(&pfs1, rect, x0, y0, r0, d0, x1, y1, r1, d1);
+ if (code >= 0)
+ code = R_extensions(&pfs1, psh, rect, d0, d1, false, psh->params.Extend[1]);
} else if (span_type == 1) {
- code = R_fill_rect_with_const_color(&pfs1, clip_rect, d0);
+ code = R_fill_rect_with_const_color(&pfs1, clip_rect, d0);
} else if (span_type == 8) {
- code = R_fill_rect_with_const_color(&pfs1, clip_rect, d1);
+ code = R_fill_rect_with_const_color(&pfs1, clip_rect, d1);
} else {
- bool second_interval = true;
-
- code = 0;
- if (span_type & 1)
- code = R_extensions(&pfs1, psh, rect, d0, d1, psh->params.Extend[0], false);
- if (code >= 0) {
- float X0 = x0, Y0 = y0, D0 = d0, X1 = x1, Y1 = y1, D1 = d1;
- floatp R0 = r0, R1 = r1;
-
- if ((span_type & 2) && (span_type & 4) && rsa.span[0][1] >= rsa.span[1][0]) {
- double united[2];
-
- united[0] = rsa.span[0][0];
- united[1] = rsa.span[1][1];
- shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, united);
- second_interval = false;
- code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
- } else if (span_type & 2) {
- second_interval = shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, rsa.span[0]);
- code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
- }
- }
- if (code >= 0 && second_interval) {
- if (span_type & 4) {
- float X0 = x0, Y0 = y0, D0 = d0, X1 = x1, Y1 = y1, D1 = d1;
- floatp R0 = r0, R1 = r1;
-
- shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, rsa.span[1]);
- code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
- }
- }
- if (code >= 0 && (span_type & 8))
- code = R_extensions(&pfs1, psh, rect, d0, d1, false, psh->params.Extend[1]);
+ bool second_interval = true;
+
+ code = 0;
+ if (span_type & 1)
+ code = R_extensions(&pfs1, psh, rect, d0, d1, psh->params.Extend[0], false);
+ if (code >= 0) {
+ float X0 = x0, Y0 = y0, D0 = d0, X1 = x1, Y1 = y1, D1 = d1;
+ floatp R0 = r0, R1 = r1;
+
+ if ((span_type & 2) && (span_type & 4) && rsa.span[0][1] >= rsa.span[1][0]) {
+ double united[2];
+
+ united[0] = rsa.span[0][0];
+ united[1] = rsa.span[1][1];
+ shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, united);
+ second_interval = false;
+ code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
+ } else if (span_type & 2) {
+ second_interval = shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, rsa.span[0]);
+ code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
+ }
+ }
+ if (code >= 0 && second_interval) {
+ if (span_type & 4) {
+ float X0 = x0, Y0 = y0, D0 = d0, X1 = x1, Y1 = y1, D1 = d1;
+ floatp R0 = r0, R1 = r1;
+
+ shorten_radial_shading(&X0, &Y0, &R0, &D0, &X1, &Y1, &R1, &D1, rsa.span[1]);
+ code = R_tensor_annulus(&pfs1, rect, X0, Y0, R0, D0, X1, Y1, R1, D1);
+ }
+ }
+ if (code >= 0 && (span_type & 8))
+ code = R_extensions(&pfs1, psh, rect, d0, d1, false, psh->params.Extend[1]);
}
if (term_patch_fill_state(&pfs1))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pfs1.icclink != NULL) gsicc_release_link(pfs1.icclink);
return code;
}
int
gs_shading_R_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis)
-{
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis)
+{
int code;
if (VD_TRACE_RADIAL_PATCH && vd_allowed('s')) {
- vd_get_dc('s');
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
+ vd_get_dc('s');
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
}
code = gs_shading_R_fill_rectangle_aux(psh0, rect, rect_clip, dev, pis);
if (VD_TRACE_FUNCTIONAL_PATCH && vd_allowed('s'))
- vd_release_dc;
+ vd_release_dc;
return code;
}
diff --git a/gs/base/gxshade4.c b/gs/base/gxshade4.c
index 06a6bb0c1..f0875d5a4 100644
--- a/gs/base/gxshade4.c
+++ b/gs/base/gxshade4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,11 +35,11 @@
/* Initialize the fill state for triangle shading. */
int
mesh_init_fill_state(mesh_fill_state_t * pfs, const gs_shading_mesh_t * psh,
- const gs_fixed_rect * rect_clip, gx_device * dev,
- gs_imager_state * pis)
+ const gs_fixed_rect * rect_clip, gx_device * dev,
+ gs_imager_state * pis)
{
shade_init_fill_state((shading_fill_state_t *) pfs,
- (const gs_shading_t *)psh, dev, pis);
+ (const gs_shading_t *)psh, dev, pis);
pfs->pshm = psh;
pfs->rect = *rect_clip;
return 0;
@@ -49,43 +49,43 @@ mesh_init_fill_state(mesh_fill_state_t * pfs, const gs_shading_mesh_t * psh,
static int
Gt_next_vertex(const gs_shading_mesh_t * psh, shade_coord_stream_t * cs,
- shading_vertex_t * vertex, patch_color_t *c)
+ shading_vertex_t * vertex, patch_color_t *c)
{
int code = shade_next_vertex(cs, vertex, c);
-
+
if (code >= 0 && psh->params.Function) {
- c->t[0] = c->cc.paint.values[0];
- c->t[1] = 0;
- /* Decode the color with the function. */
- code = gs_function_evaluate(psh->params.Function, c->t,
- c->cc.paint.values);
+ c->t[0] = c->cc.paint.values[0];
+ c->t[1] = 0;
+ /* Decode the color with the function. */
+ code = gs_function_evaluate(psh->params.Function, c->t,
+ c->cc.paint.values);
} else
- psh->params.ColorSpace->type->restrict_color(&c->cc, psh->params.ColorSpace);
+ psh->params.ColorSpace->type->restrict_color(&c->cc, psh->params.ColorSpace);
return code;
}
static inline int
Gt_fill_triangle(patch_fill_state_t * pfs, const shading_vertex_t * va,
- const shading_vertex_t * vb, const shading_vertex_t * vc)
+ const shading_vertex_t * vb, const shading_vertex_t * vc)
{
int code = 0;
if (INTERPATCH_PADDING) {
- code = mesh_padding(pfs, &va->p, &vb->p, va->c, vb->c);
- if (code >= 0)
- code = mesh_padding(pfs, &vb->p, &vc->p, vb->c, vc->c);
- if (code >= 0)
- code = mesh_padding(pfs, &vc->p, &va->p, vc->c, va->c);
+ code = mesh_padding(pfs, &va->p, &vb->p, va->c, vb->c);
+ if (code >= 0)
+ code = mesh_padding(pfs, &vb->p, &vc->p, vb->c, vc->c);
+ if (code >= 0)
+ code = mesh_padding(pfs, &vc->p, &va->p, vc->c, va->c);
}
if (code >= 0)
- code = mesh_triangle(pfs, va, vb, vc);
+ code = mesh_triangle(pfs, va, vb, vc);
return code;
}
int
gs_shading_FfGt_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis)
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis)
{
const gs_shading_FfGt_t * const psh = (const gs_shading_FfGt_t *)psh0;
patch_fill_state_t pfs;
@@ -94,76 +94,76 @@ gs_shading_FfGt_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
int num_bits = psh->params.BitsPerFlag;
int flag;
shading_vertex_t va, vb, vc;
- patch_color_t *c, *C[3], *ca, *cb, *cc; /* va.c == ca && vb.c == cb && vc.c == cc always,
- provides a non-const access. */
+ patch_color_t *c, *C[3], *ca, *cb, *cc; /* va.c == ca && vb.c == cb && vc.c == cc always,
+ provides a non-const access. */
int code;
if (VD_TRACE_TRIANGLE_PATCH && vd_allowed('s')) {
- vd_get_dc('s');
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
+ vd_get_dc('s');
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
}
shade_init_fill_state((shading_fill_state_t *)&pfs,
- (const gs_shading_t *)psh, dev, pis);
+ (const gs_shading_t *)psh, dev, pis);
pfs.Function = pshm->params.Function;
pfs.rect = *rect_clip;
code = init_patch_fill_state(&pfs);
if (code < 0) {
if (pfs.icclink != NULL) gsicc_release_link(pfs.icclink);
- return code;
+ return code;
}
reserve_colors(&pfs, C, 3); /* Can't fail */
va.c = ca = C[0];
vb.c = cb = C[1];
vc.c = cc = C[2];
shade_next_init(&cs, (const gs_shading_mesh_params_t *)&psh->params,
- pis);
+ pis);
/* CET 09-47J.PS SpecialTestI04Test01 does not need the color data alignment. */
while ((flag = shade_next_flag(&cs, num_bits)) >= 0) {
- switch (flag) {
- default:
- return_error(gs_error_rangecheck);
- case 0:
- if ((code = Gt_next_vertex(pshm, &cs, &va, ca)) < 0 ||
- (code = shade_next_flag(&cs, num_bits)) < 0 ||
- (code = Gt_next_vertex(pshm, &cs, &vb, cb)) < 0 ||
- (code = shade_next_flag(&cs, num_bits)) < 0
- )
- break;
- goto v2;
- case 1:
- c = ca;
- va = vb;
- ca = cb;
- vb.c = cb = c;
- case 2:
- c = cb;
- vb = vc;
- cb = cc;
- vc.c = cc = c;
+ switch (flag) {
+ default:
+ return_error(gs_error_rangecheck);
+ case 0:
+ if ((code = Gt_next_vertex(pshm, &cs, &va, ca)) < 0 ||
+ (code = shade_next_flag(&cs, num_bits)) < 0 ||
+ (code = Gt_next_vertex(pshm, &cs, &vb, cb)) < 0 ||
+ (code = shade_next_flag(&cs, num_bits)) < 0
+ )
+ break;
+ goto v2;
+ case 1:
+ c = ca;
+ va = vb;
+ ca = cb;
+ vb.c = cb = c;
+ case 2:
+ c = cb;
+ vb = vc;
+ cb = cc;
+ vc.c = cc = c;
v2: if ((code = Gt_next_vertex(pshm, &cs, &vc, cc)) < 0)
- break;
- if ((code = Gt_fill_triangle(&pfs, &va, &vb, &vc)) < 0)
- break;
- }
- cs.align(&cs, 8); /* Debugged with 12-14O.PS page 2. */
+ break;
+ if ((code = Gt_fill_triangle(&pfs, &va, &vb, &vc)) < 0)
+ break;
+ }
+ cs.align(&cs, 8); /* Debugged with 12-14O.PS page 2. */
}
if (VD_TRACE_TRIANGLE_PATCH && vd_allowed('s'))
- vd_release_dc;
+ vd_release_dc;
release_colors(&pfs, pfs.color_stack, 3);
if (term_patch_fill_state(&pfs))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (!cs.is_eod(&cs))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (pfs.icclink != NULL) gsicc_release_link(pfs.icclink);
return code;
}
int
gs_shading_LfGt_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis)
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis)
{
const gs_shading_LfGt_t * const psh = (const gs_shading_LfGt_t *)psh0;
patch_fill_state_t pfs;
@@ -178,80 +178,80 @@ gs_shading_LfGt_fill_rectangle(const gs_shading_t * psh0, const gs_rect * rect,
int i, code;
if (VD_TRACE_TRIANGLE_PATCH && vd_allowed('s')) {
- vd_get_dc('s');
- vd_set_shift(0, 0);
- vd_set_scale(0.01);
- vd_set_origin(0, 0);
+ vd_get_dc('s');
+ vd_set_shift(0, 0);
+ vd_set_scale(0.01);
+ vd_set_origin(0, 0);
}
shade_init_fill_state((shading_fill_state_t *)&pfs,
- (const gs_shading_t *)psh, dev, pis);
+ (const gs_shading_t *)psh, dev, pis);
pfs.Function = pshm->params.Function;
pfs.rect = *rect_clip;
code = init_patch_fill_state(&pfs);
if (code < 0)
- goto out;
+ goto out;
reserve_colors(&pfs, &cn, 1); /* Can't fail. */
next.c = cn;
shade_next_init(&cs, (const gs_shading_mesh_params_t *)&psh->params,
- pis);
+ pis);
vertex = (shading_vertex_t *)
- gs_alloc_byte_array(pis->memory, per_row, sizeof(*vertex),
- "gs_shading_LfGt_render");
+ gs_alloc_byte_array(pis->memory, per_row, sizeof(*vertex),
+ "gs_shading_LfGt_render");
if (vertex == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
color_buffer = gs_alloc_bytes(pis->memory, pfs.color_stack_step * per_row, "gs_shading_LfGt_fill_rectangle");
if (color_buffer == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
- color_buffer_ptrs = (patch_color_t **)gs_alloc_bytes(pis->memory,
- sizeof(patch_color_t *) * per_row, "gs_shading_LfGt_fill_rectangle");
+ color_buffer_ptrs = (patch_color_t **)gs_alloc_bytes(pis->memory,
+ sizeof(patch_color_t *) * per_row, "gs_shading_LfGt_fill_rectangle");
if (color_buffer_ptrs == NULL) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
+ code = gs_note_error(gs_error_VMerror);
+ goto out;
}
/* CET 09-47K.PS SpecialTestJ02Test05 needs the color data alignment. */
for (i = 0; i < per_row; ++i) {
- color_buffer_ptrs[i] = (patch_color_t *)(color_buffer + pfs.color_stack_step * i);
- vertex[i].c = color_buffer_ptrs[i];
- if ((code = Gt_next_vertex(pshm, &cs, &vertex[i], color_buffer_ptrs[i])) < 0)
- goto out;
+ color_buffer_ptrs[i] = (patch_color_t *)(color_buffer + pfs.color_stack_step * i);
+ vertex[i].c = color_buffer_ptrs[i];
+ if ((code = Gt_next_vertex(pshm, &cs, &vertex[i], color_buffer_ptrs[i])) < 0)
+ goto out;
}
while (!seofp(cs.s)) {
- code = Gt_next_vertex(pshm, &cs, &next, cn);
- if (code < 0)
- goto out;
- for (i = 1; i < per_row; ++i) {
- code = Gt_fill_triangle(&pfs, &vertex[i - 1], &vertex[i], &next);
- if (code < 0)
- goto out;
- c = color_buffer_ptrs[i - 1];
- vertex[i - 1] = next;
- color_buffer_ptrs[i - 1] = cn;
- next.c = cn = c;
- code = Gt_next_vertex(pshm, &cs, &next, cn);
- if (code < 0)
- goto out;
- code = Gt_fill_triangle(&pfs, &vertex[i], &vertex[i - 1], &next);
- if (code < 0)
- goto out;
- }
- c = color_buffer_ptrs[per_row - 1];
- vertex[per_row - 1] = next;
- color_buffer_ptrs[per_row - 1] = cn;
- next.c = cn = c;
+ code = Gt_next_vertex(pshm, &cs, &next, cn);
+ if (code < 0)
+ goto out;
+ for (i = 1; i < per_row; ++i) {
+ code = Gt_fill_triangle(&pfs, &vertex[i - 1], &vertex[i], &next);
+ if (code < 0)
+ goto out;
+ c = color_buffer_ptrs[i - 1];
+ vertex[i - 1] = next;
+ color_buffer_ptrs[i - 1] = cn;
+ next.c = cn = c;
+ code = Gt_next_vertex(pshm, &cs, &next, cn);
+ if (code < 0)
+ goto out;
+ code = Gt_fill_triangle(&pfs, &vertex[i], &vertex[i - 1], &next);
+ if (code < 0)
+ goto out;
+ }
+ c = color_buffer_ptrs[per_row - 1];
+ vertex[per_row - 1] = next;
+ color_buffer_ptrs[per_row - 1] = cn;
+ next.c = cn = c;
}
out:
if (VD_TRACE_TRIANGLE_PATCH && vd_allowed('s'))
- vd_release_dc;
+ vd_release_dc;
gs_free_object(pis->memory, vertex, "gs_shading_LfGt_render");
gs_free_object(pis->memory, color_buffer, "gs_shading_LfGt_render");
gs_free_object(pis->memory, color_buffer_ptrs, "gs_shading_LfGt_render");
release_colors(&pfs, pfs.color_stack, 1);
if (term_patch_fill_state(&pfs))
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
if (pfs.icclink != NULL) gsicc_release_link(pfs.icclink);
return code;
}
diff --git a/gs/base/gxshade4.h b/gs/base/gxshade4.h
index 1734c019d..81e833dff 100644
--- a/gs/base/gxshade4.h
+++ b/gs/base/gxshade4.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@
to the path adjustment in the filling algorithm.
The expansion is an emulation of Adobe's trapping.
The value specifies the width of paddings.
- We did some testing of Adobe RIP, and it looks as applying
+ We did some testing of Adobe RIP, and it looks as applying
same logicks as for clipping - any part of pixel inside.
Therefore the expansion should be half pixel size.
*/
@@ -46,7 +46,7 @@
/* This mode delays creating wedges for a boundary until
both neoghbour areas are painted. At that moment we can know
all subdivision points for both right and left areas,
- and skip wedges for common points. Therefore the number of wadges
+ and skip wedges for common points. Therefore the number of wadges
dramatically reduces, causing a significant speedup.
The LAZY_WEDGES 0 mode was not systematically tested.
*/
@@ -87,10 +87,10 @@ struct wedge_vertex_list_elem_s {
};
typedef struct {
bool last_side;
- wedge_vertex_list_elem_t *beg, *end;
+ wedge_vertex_list_elem_t *beg, *end;
} wedge_vertex_list_t;
-#define LAZY_WEDGES_MAX_LEVEL 9 /* memory consumption is
+#define LAZY_WEDGES_MAX_LEVEL 9 /* memory consumption is
sizeof(wedge_vertex_list_elem_t) * LAZY_WEDGES_MAX_LEVEL * (1 << LAZY_WEDGES_MAX_LEVEL) */
#define SHADING_COLOR_STACK_SIZE 200; /* Should be enough for max 64 decomposition levels. */
@@ -172,24 +172,24 @@ typedef struct {
/* Initialize the fill state for triangle shading. */
int mesh_init_fill_state(mesh_fill_state_t * pfs,
- const gs_shading_mesh_t * psh,
- const gs_fixed_rect * rect_clip,
- gx_device * dev, gs_imager_state * pis);
+ const gs_shading_mesh_t * psh,
+ const gs_fixed_rect * rect_clip,
+ gx_device * dev, gs_imager_state * pis);
int init_patch_fill_state(patch_fill_state_t *pfs);
bool term_patch_fill_state(patch_fill_state_t *pfs);
int gx_init_patch_fill_state_for_clist(gx_device *dev, patch_fill_state_t *pfs, gs_memory_t *memory);
-int mesh_triangle(patch_fill_state_t *pfs,
+int mesh_triangle(patch_fill_state_t *pfs,
const shading_vertex_t *p0, const shading_vertex_t *p1, const shading_vertex_t *p2);
-int mesh_padding(patch_fill_state_t *pfs, const gs_fixed_point *p0, const gs_fixed_point *p1,
- const patch_color_t *c0, const patch_color_t *c1);
+int mesh_padding(patch_fill_state_t *pfs, const gs_fixed_point *p0, const gs_fixed_point *p1,
+ const patch_color_t *c0, const patch_color_t *c1);
int patch_fill(patch_fill_state_t * pfs, const patch_curve_t curve[4],
- const gs_fixed_point interior[4],
- void (*transform) (gs_fixed_point *, const patch_curve_t[4],
- const gs_fixed_point[4], floatp, floatp));
+ const gs_fixed_point interior[4],
+ void (*transform) (gs_fixed_point *, const patch_curve_t[4],
+ const gs_fixed_point[4], floatp, floatp));
int constant_color_quadrangle(patch_fill_state_t *pfs, const quadrangle_patch *p, bool self_intersecting);
@@ -198,11 +198,11 @@ void wedge_vertex_list_elem_buffer_free(patch_fill_state_t *pfs);
void patch_resolve_color(patch_color_t * ppcr, const patch_fill_state_t *pfs);
-int gx_shade_background(gx_device *pdev, const gs_fixed_rect *rect,
- const gx_device_color *pdevc, gs_logical_operation_t log_op);
+int gx_shade_background(gx_device *pdev, const gs_fixed_rect *rect,
+ const gx_device_color *pdevc, gs_logical_operation_t log_op);
-int patch_color_to_device_color(const patch_fill_state_t *pfs,
- const patch_color_t *c, gx_device_color *pdevc);
+int patch_color_to_device_color(const patch_fill_state_t *pfs,
+ const patch_color_t *c, gx_device_color *pdevc);
byte *reserve_colors(patch_fill_state_t *pfs, patch_color_t *c0[], int n);
void release_colors(patch_fill_state_t *pfs, byte *ptr, int n);
diff --git a/gs/base/gxshade6.c b/gs/base/gxshade6.c
index df6170ef7..e45b6f3d6 100644
--- a/gs/base/gxshade6.c
+++ b/gs/base/gxshade6.c
@@ -295,7 +295,6 @@ patch_resolve_color(patch_color_t * ppcr, const patch_fill_state_t *pfs)
patch_resolve_color_inline(ppcr, pfs);
}
-
/*
* Calculate the interpolated color at a given point.
* Note that we must do this twice for bilinear interpolation.
@@ -1517,7 +1516,7 @@ is_color_linear(const patch_fill_state_t *pfs, const patch_color_t *c0, const pa
if (s > pfs->smoothness)
return 0;
code = cs_is_linear(cs, pfs->pis, pfs->dev,
- &c0->cc, &c1->cc, NULL, NULL, pfs->smoothness - s, pfs->icclink);
+ &c0->cc, &c1->cc, NULL, NULL, pfs->smoothness - s, pfs->icclink);
if (code <= 0)
return code;
return 1;
@@ -2091,7 +2090,7 @@ try_device_linear_color(patch_fill_state_t *pfs, bool wedge,
s01 = max(s0, s1);
s012 = max(s01, s2);
code = cs_is_linear(cs, pfs->pis, pfs->dev,
- &p0->c->cc, &p1->c->cc, &p2->c->cc, NULL,
+ &p0->c->cc, &p1->c->cc, &p2->c->cc, NULL,
pfs->smoothness - s012, pfs->icclink);
if (code < 0)
return code;
@@ -2558,7 +2557,6 @@ constant_color_triangle(patch_fill_state_t *pfs,
return code;
}
-
static inline int
constant_color_quadrangle_aux(patch_fill_state_t *pfs, const quadrangle_patch *p, bool self_intersecting,
patch_color_t *c[3])
@@ -3663,8 +3661,6 @@ fill_quadrangle(patch_fill_state_t *pfs, const quadrangle_patch *p, bool big)
return code;
}
-
-
static inline void
split_stripe(patch_fill_state_t *pfs, tensor_patch *s0, tensor_patch *s1, const tensor_patch *p, patch_color_t *c[2])
{
@@ -4202,7 +4198,6 @@ gx_shade_background(gx_device *pdev, const gs_fixed_rect *rect,
&le, &re, le.start.y, le.end.y, false, pdevc, log_op);
}
-
int
patch_fill(patch_fill_state_t *pfs, const patch_curve_t curve[4],
const gs_fixed_point interior[4],
diff --git a/gs/base/gxstate.h b/gs/base/gxstate.h
index 03ea37a32..ce452b7b5 100644
--- a/gs/base/gxstate.h
+++ b/gs/base/gxstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,7 +25,6 @@ typedef struct gs_state_s gs_state;
#endif
#include "gscspace.h"
-
/*
* The interfaces in this file are for internal use only, primarily by the
* interpreter. They are not guaranteed to remain stable from one release
@@ -60,15 +59,15 @@ typedef enum {
/* Note that the 'from' argument of copy_for is not const. */
/* This is deliberate -- some clients need this. */
typedef int (*gs_state_copy_for_proc_t) (void *to, void *from,
- gs_state_copy_reason_t reason);
+ gs_state_copy_reason_t reason);
typedef struct gs_state_client_procs_s {
gs_state_alloc_proc_t alloc;
gs_state_copy_proc_t copy;
gs_state_free_proc_t free;
gs_state_copy_for_proc_t copy_for;
} gs_state_client_procs;
-void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *,
- bool client_has_pattern_streams);
+void gs_state_set_client(gs_state *, void *, const gs_state_client_procs *,
+ bool client_has_pattern_streams);
/* gzstate.h redefines the following: */
#ifndef gs_state_client_data
diff --git a/gs/base/gxstdio.h b/gs/base/gxstdio.h
index b08bdecf8..e0980fa41 100644
--- a/gs/base/gxstdio.h
+++ b/gs/base/gxstdio.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,4 +33,3 @@
#undef fgetchar
#endif /* gxstdio_INCLUDED */
-
diff --git a/gs/base/gxstroke.c b/gs/base/gxstroke.c
index bb434f20e..a99e4e966 100644
--- a/gs/base/gxstroke.c
+++ b/gs/base/gxstroke.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -102,7 +102,7 @@
static float join_expansion_factor(const gs_imager_state *, gs_line_join);
int
gx_stroke_path_expansion(const gs_imager_state * pis, const gx_path * ppath,
- gs_fixed_point * ppt)
+ gs_fixed_point * ppt)
{
const subpath *psub = ppath->first_subpath;
const segment *pseg;
@@ -113,71 +113,71 @@ gx_stroke_path_expansion(const gs_imager_state * pis, const gx_path * ppath,
/* Adjust the expansion (E) for square caps, if needed */
if (pis->line_params.start_cap == gs_cap_square ||
- pis->line_params.end_cap == gs_cap_square)
- expand *= 1.414213562;
+ pis->line_params.end_cap == gs_cap_square)
+ expand *= 1.414213562;
/* Check for whether an exact result can be computed easily. */
if (is_fzero2(pis->ctm.xy, pis->ctm.yx) ||
- is_fzero2(pis->ctm.xx, pis->ctm.yy)
- ) {
- bool must_be_closed =
- !(pis->line_params.start_cap == gs_cap_square ||
- pis->line_params.start_cap == gs_cap_round ||
- pis->line_params.end_cap == gs_cap_square ||
- pis->line_params.end_cap == gs_cap_round ||
- pis->line_params.dash_cap == gs_cap_square ||
- pis->line_params.dash_cap == gs_cap_round);
- gs_fixed_point prev;
-
- prev.x = prev.y = 0; /* Quiet gcc warning. */
- for (pseg = (const segment *)psub; pseg;
- prev = pseg->pt, pseg = pseg->next
- )
- switch (pseg->type) {
- case s_start:
- if (((const subpath *)pseg)->curve_count ||
- (must_be_closed && !((const subpath *)pseg)->is_closed)
- )
- goto not_exact;
- break;
- case s_line:
- case s_dash:
- case s_line_close:
- if (!(pseg->pt.x == prev.x || pseg->pt.y == prev.y))
- goto not_exact;
- break;
- default: /* other/unknown segment type */
- goto not_exact;
- }
- result = 0; /* exact result */
+ is_fzero2(pis->ctm.xx, pis->ctm.yy)
+ ) {
+ bool must_be_closed =
+ !(pis->line_params.start_cap == gs_cap_square ||
+ pis->line_params.start_cap == gs_cap_round ||
+ pis->line_params.end_cap == gs_cap_square ||
+ pis->line_params.end_cap == gs_cap_round ||
+ pis->line_params.dash_cap == gs_cap_square ||
+ pis->line_params.dash_cap == gs_cap_round);
+ gs_fixed_point prev;
+
+ prev.x = prev.y = 0; /* Quiet gcc warning. */
+ for (pseg = (const segment *)psub; pseg;
+ prev = pseg->pt, pseg = pseg->next
+ )
+ switch (pseg->type) {
+ case s_start:
+ if (((const subpath *)pseg)->curve_count ||
+ (must_be_closed && !((const subpath *)pseg)->is_closed)
+ )
+ goto not_exact;
+ break;
+ case s_line:
+ case s_dash:
+ case s_line_close:
+ if (!(pseg->pt.x == prev.x || pseg->pt.y == prev.y))
+ goto not_exact;
+ break;
+ default: /* other/unknown segment type */
+ goto not_exact;
+ }
+ result = 0; /* exact result */
}
not_exact:
if (result) {
- if (!gx_path_has_curves(ppath) && gx_path_subpath_count(ppath) <= 1 &&
- (psub == 0 || (pseg = psub->next) == 0 ||
- (pseg = pseg->next) == 0 || pseg->type == s_line_close))
- DO_NOTHING;
- else {
- float factor = join_expansion_factor(pis, pis->line_params.join);
-
- if (pis->line_params.curve_join >= 0)
- factor = max(factor, join_expansion_factor(pis,
- (gs_line_join)pis->line_params.curve_join));
- expand *= factor;
- }
+ if (!gx_path_has_curves(ppath) && gx_path_subpath_count(ppath) <= 1 &&
+ (psub == 0 || (pseg = psub->next) == 0 ||
+ (pseg = pseg->next) == 0 || pseg->type == s_line_close))
+ DO_NOTHING;
+ else {
+ float factor = join_expansion_factor(pis, pis->line_params.join);
+
+ if (pis->line_params.curve_join >= 0)
+ factor = max(factor, join_expansion_factor(pis,
+ (gs_line_join)pis->line_params.curve_join));
+ expand *= factor;
+ }
}
-
+
/* Short-cut gs_bbox_transform. */
{
- float exx = expand * cx;
- float exy = expand * cy;
- int code = set_float2fixed_vars(ppt->x, exx);
-
- if (code < 0)
- return code;
- code = set_float2fixed_vars(ppt->y, exy);
- if (code < 0)
- return code;
+ float exx = expand * cx;
+ float exy = expand * cy;
+ int code = set_float2fixed_vars(ppt->x, exx);
+
+ if (code < 0)
+ return code;
+ code = set_float2fixed_vars(ppt->y, exy);
+ if (code < 0)
+ return code;
}
return result;
@@ -239,14 +239,14 @@ typedef partial_line *pl_ptr;
* prev and current, and whether they originally came from arcs.
*/
typedef enum note_flags {
-
+
/* If set, all the line segments that make up current come from arcs. */
nf_all_from_arc = 1,
/* If set, at least one of the line segments that make up current, come
* from arcs. */
nf_some_from_arc = 2,
-
+
/* If set then this segment should have a dash cap on the start rather
* than a start cap. */
nf_dash_head = 4,
@@ -254,14 +254,14 @@ typedef enum note_flags {
/* If set then this segment should have a dash cap on the end rather
* than an end cap. */
nf_dash_tail = 8,
-
+
/* If set, all the line segments that make up prev come from arcs. */
nf_prev_all_from_arc = 16,
/* If set, at least one of the line segment that make up prev, come from
* arcs. */
nf_prev_some_from_arc = 32,
-
+
/* If set then prev should have a dash cap on the start rather
* than a start cap. */
nf_prev_dash_head = 64,
@@ -269,7 +269,7 @@ typedef enum note_flags {
/* If set then prev should have a dash cap on the end rather
* than an end cap. */
nf_prev_dash_tail = 128
-
+
} note_flags;
/* Macro to combine the prev and current arc_flags. After applying this
@@ -296,10 +296,10 @@ typedef enum note_flags {
static bool width_is_thin(pl_ptr);
static void adjust_stroke(gx_device *, pl_ptr, const gs_imager_state *, bool, bool, note_flags);
static int line_join_points(const gx_line_params * pgs_lp,
- pl_ptr plp, pl_ptr nplp,
- gs_fixed_point * join_points,
- const gs_matrix * pmat, gs_line_join join,
- bool reflected);
+ pl_ptr plp, pl_ptr nplp,
+ gs_fixed_point * join_points,
+ const gs_matrix * pmat, gs_line_join join,
+ bool reflected);
static int line_join_points_fast_cw(const gx_line_params * pgs_lp,
pl_ptr plp, pl_ptr nplp,
gs_fixed_point * rjoin_points,
@@ -312,25 +312,25 @@ static int line_join_points_fast_ccw(const gx_line_params * pgs_lp,
gs_line_join join);
static void compute_caps(pl_ptr);
static int add_points(gx_path *, const gs_fixed_point *,
- int, bool);
+ int, bool);
static int add_pie_join(gx_path *, pl_ptr, pl_ptr, bool, bool);
static int add_pie_join_fast_cw(gx_path *, pl_ptr, pl_ptr, bool);
static int add_pie_join_fast_ccw(gx_path *, pl_ptr, pl_ptr, bool);
static int add_round_cap(gx_path *, const_ep_ptr);
static int add_pie_cap(gx_path *, const_ep_ptr);
static int cap_points(gs_line_cap, const_ep_ptr,
- gs_fixed_point * /*[3] */ );
+ gs_fixed_point * /*[3] */ );
static int join_under_pie(gx_path *, pl_ptr, pl_ptr, bool);
/* Define the default implementation of the device stroke_path procedure. */
int
gx_default_stroke_path(gx_device * dev, const gs_imager_state * pis,
- gx_path * ppath, const gx_stroke_params * params,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath)
+ gx_path * ppath, const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath)
{
return gx_stroke_path_only(ppath, (gx_path *) 0, dev, pis, params,
- pdcolor, pcpath);
+ pdcolor, pcpath);
}
/* Fill a partial stroked path. Free variables: */
@@ -361,8 +361,8 @@ gx_default_stroke_path(gx_device * dev, const gs_imager_state * pis,
#define stroke_line_proc(proc)\
int proc(gx_path *, gx_path *, bool ensure_closed, int, pl_ptr, pl_ptr,\
const gx_device_color *, gx_device *, const gs_imager_state *,\
- const gx_stroke_params *, const gs_fixed_rect *, int,\
- gs_line_join, bool, note_flags)
+ const gx_stroke_params *, const gs_fixed_rect *, int,\
+ gs_line_join, bool, note_flags)
typedef stroke_line_proc((*stroke_line_proc_t));
static stroke_line_proc(stroke_add);
@@ -370,8 +370,8 @@ static stroke_line_proc(stroke_add_compat);
static stroke_line_proc(stroke_add_fast);
static stroke_line_proc(stroke_fill);
static int stroke_add_initial_cap_compat(gx_path * ppath, pl_ptr plp, bool adlust_longitude,
- const gx_device_color * pdevc, gx_device * dev,
- const gs_imager_state * pis);
+ const gx_device_color * pdevc, gx_device * dev,
+ const gs_imager_state * pis);
/* Define the orientations we handle specially. */
typedef enum {
@@ -399,10 +399,10 @@ gx_join_path_and_reverse(gx_path * path, gx_path * rpath)
code = gx_path_append_reversed(rpath, path);
if (code < 0)
return code;
-
+
gx_path_free(rpath, "gx_join_path_and_reverse");
gx_path_init_local(rpath, path->memory);
-
+
return gx_path_close_subpath(path);
}
@@ -416,8 +416,8 @@ gx_join_path_and_reverse(gx_path * path, gx_path * rpath)
*/
static int
gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
- const gs_imager_state * pis, const gx_stroke_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+ const gs_imager_state * pis, const gx_stroke_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
bool CPSI_mode = gs_currentcpsimode(pis->memory);
bool traditional = CPSI_mode | params->traditional;
@@ -447,22 +447,22 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
int uniform;
bool reflected;
orientation orient =
- (
+ (
#ifdef OPTIMIZE_ORIENTATION
- is_fzero2(xy, yx) ?
- (uniform = (xx == yy ? 1 : xx == -yy ? -1 : 0),
- reflected = (uniform ? uniform < 0 : (xx < 0) != (yy < 0)),
- orient_portrait) :
- is_fzero2(xx, yy) ?
- (uniform = (xy == yx ? -1 : xy == -yx ? 1 : 0),
- reflected = (uniform ? uniform < 0 : (xy < 0) == (yx < 0)),
- orient_landscape) :
+ is_fzero2(xy, yx) ?
+ (uniform = (xx == yy ? 1 : xx == -yy ? -1 : 0),
+ reflected = (uniform ? uniform < 0 : (xx < 0) != (yy < 0)),
+ orient_portrait) :
+ is_fzero2(xx, yy) ?
+ (uniform = (xy == yx ? -1 : xy == -yx ? 1 : 0),
+ reflected = (uniform ? uniform < 0 : (xy < 0) == (yx < 0)),
+ orient_landscape) :
/* We should optimize uniform rotated coordinate systems */
/* here as well, but we don't. */
#endif
- (uniform = 0,
- reflected = xy * yx > xx * yy,
- orient_other));
+ (uniform = 0,
+ reflected = xy * yx > xx * yy,
+ orient_other));
/*
* Formerly, there was a hack here that only treated the joins of
* flattened curves specially if the dot length was non-zero.
@@ -472,14 +472,14 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
*/
#if 0
segment_notes not_first =
- (!is_fzero(pis->line_params.dot_length) ? sn_not_first : sn_none);
+ (!is_fzero(pis->line_params.dot_length) ? sn_not_first : sn_none);
#else
const segment_notes not_first = sn_not_first;
#endif
gs_line_join curve_join =
- (pgs_lp->curve_join >= 0 ? (gs_line_join)pgs_lp->curve_join :
- pgs_lp->join == gs_join_none || pgs_lp->join == gs_join_round ?
- gs_join_bevel : pgs_lp->join);
+ (pgs_lp->curve_join >= 0 ? (gs_line_join)pgs_lp->curve_join :
+ pgs_lp->join == gs_join_none || pgs_lp->join == gs_join_round ?
+ gs_join_bevel : pgs_lp->join);
float line_width = pgs_lp->half_width; /* (*half* the line width) */
bool always_thin;
double line_width_and_scale;
@@ -491,432 +491,432 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
note_flags flags;
(*dev_proc(pdev, get_initial_matrix)) (pdev, &initial_matrix);
- initial_matrix_reflected = initial_matrix.xy * initial_matrix.yx >
- initial_matrix.xx * initial_matrix.yy;
+ initial_matrix_reflected = initial_matrix.xy * initial_matrix.yx >
+ initial_matrix.xx * initial_matrix.yy;
#ifdef DEBUG
if (gs_debug_c('o')) {
- int count = pgs_lp->dash.pattern_size;
- int i;
-
- dlprintf4("[o]half_width=%f, start_cap=%d, end_cap=%d, dash_cap=%d,\n",
- pgs_lp->half_width, (int)pgs_lp->start_cap,
- (int)pgs_lp->end_cap, (int)pgs_lp->dash_cap);
- dlprintf3(" join=%d, miter_limit=%f, miter_check=%f,\n",
- (int)pgs_lp->join, pgs_lp->miter_limit,
- pgs_lp->miter_check);
- dlprintf1(" dash pattern=%d", count);
- for (i = 0; i < count; i++)
- dprintf1(",%f", pgs_lp->dash.pattern[i]);
- dputs(",\n");
- dlprintf4("\toffset=%f, init(ink_on=%d, index=%d, dist_left=%f)\n",
- pgs_lp->dash.offset, pgs_lp->dash.init_ink_on,
- pgs_lp->dash.init_index, pgs_lp->dash.init_dist_left);
+ int count = pgs_lp->dash.pattern_size;
+ int i;
+
+ dlprintf4("[o]half_width=%f, start_cap=%d, end_cap=%d, dash_cap=%d,\n",
+ pgs_lp->half_width, (int)pgs_lp->start_cap,
+ (int)pgs_lp->end_cap, (int)pgs_lp->dash_cap);
+ dlprintf3(" join=%d, miter_limit=%f, miter_check=%f,\n",
+ (int)pgs_lp->join, pgs_lp->miter_limit,
+ pgs_lp->miter_check);
+ dlprintf1(" dash pattern=%d", count);
+ for (i = 0; i < count; i++)
+ dprintf1(",%f", pgs_lp->dash.pattern[i]);
+ dputs(",\n");
+ dlprintf4("\toffset=%f, init(ink_on=%d, index=%d, dist_left=%f)\n",
+ pgs_lp->dash.offset, pgs_lp->dash.init_ink_on,
+ pgs_lp->dash.init_index, pgs_lp->dash.init_dist_left);
}
#endif
gx_path_bbox(ppath, &ibox);
/* Expand the path bounding box by the scaled line width. */
{
- gs_fixed_point expansion;
-
- if (gx_stroke_path_expansion(pis, ppath, &expansion) < 0) {
- /* The expansion is so large it caused a limitcheck. */
- ibox.p.x = ibox.p.y = min_fixed;
- ibox.q.x = ibox.q.y = max_fixed;
- } else {
- expansion.x += pis->fill_adjust.x;
- expansion.y += pis->fill_adjust.y;
- /*
- * It's theoretically possible for the following computations to
- * overflow, so we need to check for this.
- */
- ibox.p.x = (ibox.p.x < min_fixed + expansion.x ? min_fixed :
- ibox.p.x - expansion.x);
- ibox.p.y = (ibox.p.y < min_fixed + expansion.y ? min_fixed :
- ibox.p.y - expansion.y);
- ibox.q.x = (ibox.q.x > max_fixed - expansion.x ? max_fixed :
- ibox.q.x + expansion.x);
- ibox.q.y = (ibox.q.y > max_fixed - expansion.y ? max_fixed :
- ibox.q.y + expansion.y);
- }
+ gs_fixed_point expansion;
+
+ if (gx_stroke_path_expansion(pis, ppath, &expansion) < 0) {
+ /* The expansion is so large it caused a limitcheck. */
+ ibox.p.x = ibox.p.y = min_fixed;
+ ibox.q.x = ibox.q.y = max_fixed;
+ } else {
+ expansion.x += pis->fill_adjust.x;
+ expansion.y += pis->fill_adjust.y;
+ /*
+ * It's theoretically possible for the following computations to
+ * overflow, so we need to check for this.
+ */
+ ibox.p.x = (ibox.p.x < min_fixed + expansion.x ? min_fixed :
+ ibox.p.x - expansion.x);
+ ibox.p.y = (ibox.p.y < min_fixed + expansion.y ? min_fixed :
+ ibox.p.y - expansion.y);
+ ibox.q.x = (ibox.q.x > max_fixed - expansion.x ? max_fixed :
+ ibox.q.x + expansion.x);
+ ibox.q.y = (ibox.q.y > max_fixed - expansion.y ? max_fixed :
+ ibox.q.y + expansion.y);
+ }
}
/* Check the expanded bounding box against the clipping regions. */
if (pcpath)
- gx_cpath_inner_box(pcpath, &cbox);
+ gx_cpath_inner_box(pcpath, &cbox);
else if (pdevc)
- (*dev_proc(pdev, get_clipping_box)) (pdev, &cbox);
+ (*dev_proc(pdev, get_clipping_box)) (pdev, &cbox);
else {
- /* This is strokepath, not stroke. Don't clip. */
- cbox = ibox;
+ /* This is strokepath, not stroke. Don't clip. */
+ cbox = ibox;
}
if (!rect_within(ibox, cbox)) {
- /* Intersect the path box and the clip bounding box. */
- /* If the intersection is empty, this call is a no-op. */
- gs_fixed_rect bbox;
-
- if (pcpath) {
- gx_cpath_outer_box(pcpath, &bbox);
- if_debug4('f', " outer_box=(%g,%g),(%g,%g)\n",
- fixed2float(bbox.p.x), fixed2float(bbox.p.y),
- fixed2float(bbox.q.x), fixed2float(bbox.q.y));
- rect_intersect(ibox, bbox);
- } else
- rect_intersect(ibox, cbox);
- if (ibox.p.x >= ibox.q.x || ibox.p.y >= ibox.q.y) {
- /* Intersection of boxes is empty! */
- return 0;
- }
- /*
- * The path is neither entirely inside the inner clip box
- * nor entirely outside the outer clip box.
- * If we had to flatten the path, this is where we would
- * recompute its bbox and make the tests again,
- * but we don't bother right now.
- */
- /*
- * If there is a clipping path, set up a clipping device.
- * for stroke_fill because, because the latter uses low level methods
- * which don't accept a clipping path.
- * Note that in some cases stroke_fill appends the path to stroke_path_body
- * instead a real painting, and it is painted with FILL_STROKE_PATH.
- *
- * Contrary to that, FILL_STROKE_PATH paints a path with
- * the fill_path method, which handles a clipping path,
- * so we don't pass the clipper device to FILL_STROKE_PATH
- * to prevent an appearence of superposing clippers.
- */
- if (pcpath && line_proc == stroke_fill) {
- gx_make_clip_device_on_stack(&cdev, pcpath, pdev);
- cdev.max_fill_band = pdev->max_fill_band;
- dev = (gx_device *)&cdev;
- }
+ /* Intersect the path box and the clip bounding box. */
+ /* If the intersection is empty, this call is a no-op. */
+ gs_fixed_rect bbox;
+
+ if (pcpath) {
+ gx_cpath_outer_box(pcpath, &bbox);
+ if_debug4('f', " outer_box=(%g,%g),(%g,%g)\n",
+ fixed2float(bbox.p.x), fixed2float(bbox.p.y),
+ fixed2float(bbox.q.x), fixed2float(bbox.q.y));
+ rect_intersect(ibox, bbox);
+ } else
+ rect_intersect(ibox, cbox);
+ if (ibox.p.x >= ibox.q.x || ibox.p.y >= ibox.q.y) {
+ /* Intersection of boxes is empty! */
+ return 0;
+ }
+ /*
+ * The path is neither entirely inside the inner clip box
+ * nor entirely outside the outer clip box.
+ * If we had to flatten the path, this is where we would
+ * recompute its bbox and make the tests again,
+ * but we don't bother right now.
+ */
+ /*
+ * If there is a clipping path, set up a clipping device.
+ * for stroke_fill because, because the latter uses low level methods
+ * which don't accept a clipping path.
+ * Note that in some cases stroke_fill appends the path to stroke_path_body
+ * instead a real painting, and it is painted with FILL_STROKE_PATH.
+ *
+ * Contrary to that, FILL_STROKE_PATH paints a path with
+ * the fill_path method, which handles a clipping path,
+ * so we don't pass the clipper device to FILL_STROKE_PATH
+ * to prevent an appearence of superposing clippers.
+ */
+ if (pcpath && line_proc == stroke_fill) {
+ gx_make_clip_device_on_stack(&cdev, pcpath, pdev);
+ cdev.max_fill_band = pdev->max_fill_band;
+ dev = (gx_device *)&cdev;
+ }
}
fill_params.rule = gx_rule_winding_number;
fill_params.flatness = pis->flatness;
if (line_width < 0)
- line_width = -line_width;
+ line_width = -line_width;
line_width_and_scale = line_width * (double)int2fixed(1);
if (is_fzero(line_width))
- always_thin = true;
+ always_thin = true;
else {
- float xa, ya;
-
- switch (orient) {
- case orient_portrait:
- xa = xx, ya = yy;
- goto sat;
- case orient_landscape:
- xa = xy, ya = yx;
- sat:
- if (xa < 0)
- xa = -xa;
- if (ya < 0)
- ya = -ya;
- always_thin = (max(xa, ya) * line_width < 0.5);
- if (!always_thin && uniform) { /* Precompute a value we'll need later. */
- device_line_width_scale = line_width_and_scale * xa;
- }
- break;
- default:
- {
- /* The check is more complicated, but it's worth it. */
- /* Compute radii of the transformed round brush. */
- /* Let x = [a, sqrt(1-a^2)]'
- radius^2 is an extremum of :
- rr(a)=(CTM*x)^2 = (a*xx + sqrt(1 - a^2)*xy)^2 + (a*yx + sqrt(1 - a^2)*yy)^2
- With solving D(rr(a),a)==0, got :
- max_rr = (xx^2 + xy^2 + yx^2 + yy^2 + sqrt(((xy + yx)^2 + (xx - yy)^2)*((xy - yx)^2 + (xx + yy)^2)))/2.
- r = sqrt(max_rr);
- Well we could use eigenvalues of the quadratic form,
- but it gives same result with a bigger calculus.
- */
- double max_rr = (xx*xx + xy*xy + yx*yx + yy*yy +
- sqrt( ((xy + yx)*(xy + yx) + (xx - yy)*(xx - yy)) *
- ((xy - yx)*(xy - yx) + (xx + yy)*(xx + yy))
- )
- )/2;
-
- always_thin = max_rr * line_width * line_width < 0.25;
- }
- }
+ float xa, ya;
+
+ switch (orient) {
+ case orient_portrait:
+ xa = xx, ya = yy;
+ goto sat;
+ case orient_landscape:
+ xa = xy, ya = yx;
+ sat:
+ if (xa < 0)
+ xa = -xa;
+ if (ya < 0)
+ ya = -ya;
+ always_thin = (max(xa, ya) * line_width < 0.5);
+ if (!always_thin && uniform) { /* Precompute a value we'll need later. */
+ device_line_width_scale = line_width_and_scale * xa;
+ }
+ break;
+ default:
+ {
+ /* The check is more complicated, but it's worth it. */
+ /* Compute radii of the transformed round brush. */
+ /* Let x = [a, sqrt(1-a^2)]'
+ radius^2 is an extremum of :
+ rr(a)=(CTM*x)^2 = (a*xx + sqrt(1 - a^2)*xy)^2 + (a*yx + sqrt(1 - a^2)*yy)^2
+ With solving D(rr(a),a)==0, got :
+ max_rr = (xx^2 + xy^2 + yx^2 + yy^2 + sqrt(((xy + yx)^2 + (xx - yy)^2)*((xy - yx)^2 + (xx + yy)^2)))/2.
+ r = sqrt(max_rr);
+ Well we could use eigenvalues of the quadratic form,
+ but it gives same result with a bigger calculus.
+ */
+ double max_rr = (xx*xx + xy*xy + yx*yx + yy*yy +
+ sqrt( ((xy + yx)*(xy + yx) + (xx - yy)*(xx - yy)) *
+ ((xy - yx)*(xy - yx) + (xx + yy)*(xx + yy))
+ )
+ )/2;
+
+ always_thin = max_rr * line_width * line_width < 0.25;
+ }
+ }
}
if_debug7('o', "[o]ctm=(%g,%g,%g,%g,%g,%g) thin=%d\n",
- xx, xy, yx, yy, pis->ctm.tx, pis->ctm.ty, always_thin);
+ xx, xy, yx, yy, pis->ctm.tx, pis->ctm.ty, always_thin);
if (device_dot_length != 0) {
- /*
- * Compute the dot length in device space. We can't do this
- * quite right for non-uniform coordinate systems; too bad.
- */
- gs_matrix mat;
- const gs_matrix *pmat;
-
- if (pgs_lp->dot_length_absolute) {
- gs_deviceinitialmatrix(pdev, &mat);
- pmat = &mat;
- } else
- pmat = (const gs_matrix *)&pis->ctm;
- device_dot_length *= fabs(pmat->xy) + fabs(pmat->yy);
+ /*
+ * Compute the dot length in device space. We can't do this
+ * quite right for non-uniform coordinate systems; too bad.
+ */
+ gs_matrix mat;
+ const gs_matrix *pmat;
+
+ if (pgs_lp->dot_length_absolute) {
+ gs_deviceinitialmatrix(pdev, &mat);
+ pmat = &mat;
+ } else
+ pmat = (const gs_matrix *)&pis->ctm;
+ device_dot_length *= fabs(pmat->xy) + fabs(pmat->yy);
}
/* Start by flattening the path. We should do this on-the-fly.... */
- if (!gx_path_has_curves(ppath) && !gx_path_has_long_segments(ppath)) {
- /* don't need to flatten */
- if (!ppath->first_subpath)
- return 0;
- spath = ppath;
+ if (!gx_path_has_curves(ppath) && !gx_path_has_long_segments(ppath)) {
+ /* don't need to flatten */
+ if (!ppath->first_subpath)
+ return 0;
+ spath = ppath;
} else {
- gx_path_init_local(&fpath, ppath->memory);
- if ((code = gx_path_add_flattened_for_stroke(ppath, &fpath,
- params->flatness, pis)) < 0
- )
- return code;
- spath = &fpath;
+ gx_path_init_local(&fpath, ppath->memory);
+ if ((code = gx_path_add_flattened_for_stroke(ppath, &fpath,
+ params->flatness, pis)) < 0
+ )
+ return code;
+ spath = &fpath;
}
if (dash_count) {
- gx_path_init_local(&dpath, ppath->memory);
- code = gx_path_add_dash_expansion(spath, &dpath, pis);
- if (code < 0)
- goto exf;
- spath = &dpath;
+ gx_path_init_local(&dpath, ppath->memory);
+ code = gx_path_add_dash_expansion(spath, &dpath, pis);
+ if (code < 0)
+ goto exf;
+ spath = &dpath;
}
if (to_path == 0) {
- /* We might try to defer this if it's expensive.... */
- to_path = &stroke_path_body;
- gx_path_init_local(&stroke_path_body, ppath->memory);
+ /* We might try to defer this if it's expensive.... */
+ to_path = &stroke_path_body;
+ gx_path_init_local(&stroke_path_body, ppath->memory);
}
if (line_proc == stroke_add_fast) {
to_path_reverse = &stroke_path_reverse;
gx_path_init_local(&stroke_path_reverse, ppath->memory);
}
for (psub = spath->first_subpath; psub != 0;) {
- int index = 0;
- const segment *pseg = (const segment *)psub;
- fixed x = pseg->pt.x;
- fixed y = pseg->pt.y;
- bool is_closed = ((const subpath *)pseg)->is_closed;
- partial_line pl, pl_prev, pl_first;
- bool zero_length = true;
- gs_line_cap cap;
+ int index = 0;
+ const segment *pseg = (const segment *)psub;
+ fixed x = pseg->pt.x;
+ fixed y = pseg->pt.y;
+ bool is_closed = ((const subpath *)pseg)->is_closed;
+ partial_line pl, pl_prev, pl_first;
+ bool zero_length = true;
+ gs_line_cap cap;
flags = nf_all_from_arc;
- while ((pseg = pseg->next) != 0 &&
- pseg->type != s_start
- ) {
- /* Compute the width parameters in device space. */
- /* We work with unscaled values, for speed. */
- fixed sx, udx, sy, udy;
- bool is_dash_segment = false;
+ while ((pseg = pseg->next) != 0 &&
+ pseg->type != s_start
+ ) {
+ /* Compute the width parameters in device space. */
+ /* We work with unscaled values, for speed. */
+ fixed sx, udx, sy, udy;
+ bool is_dash_segment = false;
d1:if (pseg->type != s_dash) {
- sx = pseg->pt.x;
- sy = pseg->pt.y;
- udx = sx - x;
- udy = sy - y;
- } else {
- dash_segment *pd = (dash_segment *)pseg;
-
- sx = pd->pt.x;
- sy = pd->pt.y;
- udx = pd->tangent.x;
- udy = pd->tangent.y;
- is_dash_segment = true;
- }
- zero_length &= ((udx | udy) == 0);
- pl.o.p.x = x, pl.o.p.y = y;
+ sx = pseg->pt.x;
+ sy = pseg->pt.y;
+ udx = sx - x;
+ udy = sy - y;
+ } else {
+ dash_segment *pd = (dash_segment *)pseg;
+
+ sx = pd->pt.x;
+ sy = pd->pt.y;
+ udx = pd->tangent.x;
+ udy = pd->tangent.y;
+ is_dash_segment = true;
+ }
+ zero_length &= ((udx | udy) == 0);
+ pl.o.p.x = x, pl.o.p.y = y;
d:flags = (((pseg->notes & sn_not_first) ?
((flags & nf_all_from_arc) | nf_some_from_arc) : 0) |
((pseg->notes & sn_dash_head) ? nf_dash_head : 0) |
((pseg->notes & sn_dash_tail) ? nf_dash_tail : 0) |
(flags & ~nf_all_from_arc));
- pl.e.p.x = sx, pl.e.p.y = sy;
- if (!(udx | udy) || pseg->type == s_dash) { /* degenerate or short */
- /*
- * If this is the first segment of the subpath,
- * check the entire subpath for degeneracy.
- * Otherwise, ignore the degenerate segment.
- */
- if (index != 0 && pseg->type != s_dash)
- continue;
- /* Check for a degenerate subpath. */
- while ((pseg = pseg->next) != 0 &&
- pseg->type != s_start
- ) {
- if (is_dash_segment)
- break;
- if (pseg->type == s_dash)
- goto d1;
- sx = pseg->pt.x, udx = sx - x;
- sy = pseg->pt.y, udy = sy - y;
- if (udx | udy) {
- zero_length = false;
- goto d;
- }
- }
- if (pgs_lp->dot_length == 0 &&
- pgs_lp->start_cap != gs_cap_round &&
- pgs_lp->end_cap != gs_cap_round &&
- !is_dash_segment) {
- /* From PLRM, stroke operator :
- If a subpath is degenerate (consists of a single-point closed path
- or of two or more points at the same coordinates),
- stroke paints it only if round line caps have been specified */
- break;
- }
- /*
+ pl.e.p.x = sx, pl.e.p.y = sy;
+ if (!(udx | udy) || pseg->type == s_dash) { /* degenerate or short */
+ /*
+ * If this is the first segment of the subpath,
+ * check the entire subpath for degeneracy.
+ * Otherwise, ignore the degenerate segment.
+ */
+ if (index != 0 && pseg->type != s_dash)
+ continue;
+ /* Check for a degenerate subpath. */
+ while ((pseg = pseg->next) != 0 &&
+ pseg->type != s_start
+ ) {
+ if (is_dash_segment)
+ break;
+ if (pseg->type == s_dash)
+ goto d1;
+ sx = pseg->pt.x, udx = sx - x;
+ sy = pseg->pt.y, udy = sy - y;
+ if (udx | udy) {
+ zero_length = false;
+ goto d;
+ }
+ }
+ if (pgs_lp->dot_length == 0 &&
+ pgs_lp->start_cap != gs_cap_round &&
+ pgs_lp->end_cap != gs_cap_round &&
+ !is_dash_segment) {
+ /* From PLRM, stroke operator :
+ If a subpath is degenerate (consists of a single-point closed path
+ or of two or more points at the same coordinates),
+ stroke paints it only if round line caps have been specified */
+ break;
+ }
+ /*
* If the subpath is a dash, take the orientation from the dash segment.
- * Otherwise orient the dot according to the previous segment if
- * any, or else the next segment if any, or else
- * according to the specified dot orientation.
- */
- {
- /* When passing here, either pseg == NULL or it points to the
- start of the next subpaph. So we can't use pseg
- for determining the segment direction.
- In same time, psub->last may help, so use it. */
- const segment *end = psub->last;
-
- if (is_dash_segment) {
- /* Nothing. */
- } else if (end != 0 && (end->pt.x != x || end->pt.y != y))
- sx = end->pt.x, sy = end->pt.y, udx = sx - x, udy = sy - y;
- }
- /*
- * Compute the properly oriented dot length, and then
- * draw the dot like a very short line.
- */
- if ((udx | udy) == 0) {
- if (is_fzero(pgs_lp->dot_orientation.xy)) {
- /* Portrait orientation, dot length = X */
- udx = fixed_1;
- } else {
- /* Landscape orientation, dot length = Y */
- udy = fixed_1;
- }
- }
- if (sx == x && sy == y && (pseg == NULL || pseg->type == s_start)) {
- double scale = device_dot_length /
- hypot((double)udx, (double)udy);
- fixed udx1, udy1;
- /*
- * If we're using butt caps, make sure the "line" is
- * long enough to show up.
- * Don't apply this with always_thin, becase
- * draw thin line always rounds the length up.
- */
- if (!always_thin && (pgs_lp->start_cap == gs_cap_butt ||
- pgs_lp->end_cap == gs_cap_butt ||
- pgs_lp->dash_cap == gs_cap_butt)) {
- fixed dmax = max(any_abs(udx), any_abs(udy));
-
- if (dmax * scale < fixed_1)
- scale = (float)fixed_1 / dmax;
- }
- udx1 = (fixed) (udx * scale);
- udy1 = (fixed) (udy * scale);
- sx = x + udx1;
- sy = y + udy1;
- }
- /*
- * Back up 1 segment to keep the bookkeeping straight.
- */
- pseg = (pseg != 0 ? pseg->prev : psub->last);
- if (!is_dash_segment)
- goto d;
- pl.e.p.x = sx;
- pl.e.p.y = sy;
- }
- pl.vector.x = udx;
- pl.vector.y = udy;
- if (always_thin) {
- pl.e.cdelta.x = pl.e.cdelta.y = 0;
- pl.width.x = pl.width.y = 0;
- pl.thin = true;
- } else {
- if (uniform != 0) {
- /* We can save a lot of work in this case. */
- /* We know orient != orient_other. */
- double dpx = udx, dpy = udy;
- double wl = device_line_width_scale /
- hypot(dpx, dpy);
-
- pl.e.cdelta.x = (fixed) (dpx * wl);
- pl.e.cdelta.y = (fixed) (dpy * wl);
- /* The width is the cap delta rotated by */
- /* 90 degrees. */
- if (initial_matrix_reflected)
- pl.width.x = pl.e.cdelta.y, pl.width.y = -pl.e.cdelta.x;
- else
- pl.width.x = -pl.e.cdelta.y, pl.width.y = pl.e.cdelta.x;
- pl.thin = false; /* if not always_thin, */
- /* then never thin. */
-
- } else {
- gs_point dpt; /* unscaled */
- float wl;
-
- gs_imager_idtransform(pis,
- (float)udx, (float)udy, &dpt);
- wl = line_width_and_scale /
- hypot(dpt.x, dpt.y);
- /* Construct the width vector in */
- /* user space, still unscaled. */
- dpt.x *= wl;
- dpt.y *= wl;
-
- /*
- * We now compute both perpendicular
- * and (optionally) parallel half-widths,
- * as deltas in device space. We use
- * a fixed-point, unscaled version of
- * gs_dtransform. The second computation
- * folds in a 90-degree rotation (in user
- * space, before transforming) in the
- * direction that corresponds to counter-
- * clockwise in device space.
- */
- pl.e.cdelta.x = (fixed) (dpt.x * xx);
- pl.e.cdelta.y = (fixed) (dpt.y * yy);
- if (orient != orient_portrait)
- pl.e.cdelta.x += (fixed) (dpt.y * yx),
- pl.e.cdelta.y += (fixed) (dpt.x * xy);
- if (!reflected ^ initial_matrix_reflected)
- dpt.x = -dpt.x, dpt.y = -dpt.y;
- pl.width.x = (fixed) (dpt.y * xx),
- pl.width.y = -(fixed) (dpt.x * yy);
- if (orient != orient_portrait)
- pl.width.x -= (fixed) (dpt.x * yx),
- pl.width.y += (fixed) (dpt.y * xy);
- pl.thin = width_is_thin(&pl);
- }
- if (!pl.thin) {
- if (index)
- dev->sgr.stroke_stored = false;
- adjust_stroke(dev, &pl, pis, false,
- (pseg->prev == 0 || pseg->prev->type == s_start) &&
- (pseg->next == 0 || pseg->next->type == s_start) &&
- (zero_length || !is_closed),
- COMBINE_FLAGS(flags));
- compute_caps(&pl);
- }
- }
- if (index++) {
- gs_line_join join =
- (pseg->notes & not_first ? curve_join : pgs_lp->join);
- int first;
- pl_ptr lptr;
+ * Otherwise orient the dot according to the previous segment if
+ * any, or else the next segment if any, or else
+ * according to the specified dot orientation.
+ */
+ {
+ /* When passing here, either pseg == NULL or it points to the
+ start of the next subpaph. So we can't use pseg
+ for determining the segment direction.
+ In same time, psub->last may help, so use it. */
+ const segment *end = psub->last;
+
+ if (is_dash_segment) {
+ /* Nothing. */
+ } else if (end != 0 && (end->pt.x != x || end->pt.y != y))
+ sx = end->pt.x, sy = end->pt.y, udx = sx - x, udy = sy - y;
+ }
+ /*
+ * Compute the properly oriented dot length, and then
+ * draw the dot like a very short line.
+ */
+ if ((udx | udy) == 0) {
+ if (is_fzero(pgs_lp->dot_orientation.xy)) {
+ /* Portrait orientation, dot length = X */
+ udx = fixed_1;
+ } else {
+ /* Landscape orientation, dot length = Y */
+ udy = fixed_1;
+ }
+ }
+ if (sx == x && sy == y && (pseg == NULL || pseg->type == s_start)) {
+ double scale = device_dot_length /
+ hypot((double)udx, (double)udy);
+ fixed udx1, udy1;
+ /*
+ * If we're using butt caps, make sure the "line" is
+ * long enough to show up.
+ * Don't apply this with always_thin, becase
+ * draw thin line always rounds the length up.
+ */
+ if (!always_thin && (pgs_lp->start_cap == gs_cap_butt ||
+ pgs_lp->end_cap == gs_cap_butt ||
+ pgs_lp->dash_cap == gs_cap_butt)) {
+ fixed dmax = max(any_abs(udx), any_abs(udy));
+
+ if (dmax * scale < fixed_1)
+ scale = (float)fixed_1 / dmax;
+ }
+ udx1 = (fixed) (udx * scale);
+ udy1 = (fixed) (udy * scale);
+ sx = x + udx1;
+ sy = y + udy1;
+ }
+ /*
+ * Back up 1 segment to keep the bookkeeping straight.
+ */
+ pseg = (pseg != 0 ? pseg->prev : psub->last);
+ if (!is_dash_segment)
+ goto d;
+ pl.e.p.x = sx;
+ pl.e.p.y = sy;
+ }
+ pl.vector.x = udx;
+ pl.vector.y = udy;
+ if (always_thin) {
+ pl.e.cdelta.x = pl.e.cdelta.y = 0;
+ pl.width.x = pl.width.y = 0;
+ pl.thin = true;
+ } else {
+ if (uniform != 0) {
+ /* We can save a lot of work in this case. */
+ /* We know orient != orient_other. */
+ double dpx = udx, dpy = udy;
+ double wl = device_line_width_scale /
+ hypot(dpx, dpy);
+
+ pl.e.cdelta.x = (fixed) (dpx * wl);
+ pl.e.cdelta.y = (fixed) (dpy * wl);
+ /* The width is the cap delta rotated by */
+ /* 90 degrees. */
+ if (initial_matrix_reflected)
+ pl.width.x = pl.e.cdelta.y, pl.width.y = -pl.e.cdelta.x;
+ else
+ pl.width.x = -pl.e.cdelta.y, pl.width.y = pl.e.cdelta.x;
+ pl.thin = false; /* if not always_thin, */
+ /* then never thin. */
+
+ } else {
+ gs_point dpt; /* unscaled */
+ float wl;
+
+ gs_imager_idtransform(pis,
+ (float)udx, (float)udy, &dpt);
+ wl = line_width_and_scale /
+ hypot(dpt.x, dpt.y);
+ /* Construct the width vector in */
+ /* user space, still unscaled. */
+ dpt.x *= wl;
+ dpt.y *= wl;
+
+ /*
+ * We now compute both perpendicular
+ * and (optionally) parallel half-widths,
+ * as deltas in device space. We use
+ * a fixed-point, unscaled version of
+ * gs_dtransform. The second computation
+ * folds in a 90-degree rotation (in user
+ * space, before transforming) in the
+ * direction that corresponds to counter-
+ * clockwise in device space.
+ */
+ pl.e.cdelta.x = (fixed) (dpt.x * xx);
+ pl.e.cdelta.y = (fixed) (dpt.y * yy);
+ if (orient != orient_portrait)
+ pl.e.cdelta.x += (fixed) (dpt.y * yx),
+ pl.e.cdelta.y += (fixed) (dpt.x * xy);
+ if (!reflected ^ initial_matrix_reflected)
+ dpt.x = -dpt.x, dpt.y = -dpt.y;
+ pl.width.x = (fixed) (dpt.y * xx),
+ pl.width.y = -(fixed) (dpt.x * yy);
+ if (orient != orient_portrait)
+ pl.width.x -= (fixed) (dpt.x * yx),
+ pl.width.y += (fixed) (dpt.y * xy);
+ pl.thin = width_is_thin(&pl);
+ }
+ if (!pl.thin) {
+ if (index)
+ dev->sgr.stroke_stored = false;
+ adjust_stroke(dev, &pl, pis, false,
+ (pseg->prev == 0 || pseg->prev->type == s_start) &&
+ (pseg->next == 0 || pseg->next->type == s_start) &&
+ (zero_length || !is_closed),
+ COMBINE_FLAGS(flags));
+ compute_caps(&pl);
+ }
+ }
+ if (index++) {
+ gs_line_join join =
+ (pseg->notes & not_first ? curve_join : pgs_lp->join);
+ int first;
+ pl_ptr lptr;
bool ensure_closed;
- if (join == gs_join_none) {
- /* Fake the end of a subpath so we get */
- /* caps instead of joins. */
- first = 0;
- lptr = 0;
- index = 1;
- } else {
- first = (is_closed ? 1 : index - 2);
- lptr = &pl;
- }
+ if (join == gs_join_none) {
+ /* Fake the end of a subpath so we get */
+ /* caps instead of joins. */
+ first = 0;
+ lptr = 0;
+ index = 1;
+ } else {
+ first = (is_closed ? 1 : index - 2);
+ lptr = &pl;
+ }
#ifdef AVOID_JOINING_TO_DASH_GAPS
if (is_dash_segment) /* Never join to a dash segment */
lptr = NULL;
@@ -925,33 +925,33 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
lop_is_idempotent(pis->log_op)) ||
(lptr == NULL ? true : lptr->thin));
code = (*line_proc) (to_path, to_path_reverse, ensure_closed,
- first, &pl_prev, lptr,
- pdevc, dev, pis, params, &cbox,
- uniform, join, initial_matrix_reflected,
- COMBINE_FLAGS(flags));
- if (code < 0)
- goto exit;
- FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
- } else
- pl_first = pl;
- pl_prev = pl;
- x = sx, y = sy;
- flags = (flags<<4) | nf_all_from_arc;
- }
- if (index) {
- /* If closed, join back to start, else cap. */
+ first, &pl_prev, lptr,
+ pdevc, dev, pis, params, &cbox,
+ uniform, join, initial_matrix_reflected,
+ COMBINE_FLAGS(flags));
+ if (code < 0)
+ goto exit;
+ FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
+ } else
+ pl_first = pl;
+ pl_prev = pl;
+ x = sx, y = sy;
+ flags = (flags<<4) | nf_all_from_arc;
+ }
+ if (index) {
+ /* If closed, join back to start, else cap. */
segment_notes notes = (pseg == 0 ?
- (const segment *)spath->first_subpath :
+ (const segment *)spath->first_subpath :
pseg)->notes;
gs_line_join join = (notes & not_first ? curve_join :
- pgs_lp->join);
+ pgs_lp->join);
gs_line_cap cap;
- /* For some reason, the Borland compiler requires the cast */
- /* in the following statement. */
- pl_ptr lptr =
- (!is_closed || join == gs_join_none || zero_length ?
- (pl_ptr) 0 : (pl_ptr) & pl_first);
-
+ /* For some reason, the Borland compiler requires the cast */
+ /* in the following statement. */
+ pl_ptr lptr =
+ (!is_closed || join == gs_join_none || zero_length ?
+ (pl_ptr) 0 : (pl_ptr) & pl_first);
+
#ifdef AVOID_JOINING_TO_DASH_GAPS
if (lptr && psub->type == s_dash)
lptr = NULL;
@@ -961,65 +961,65 @@ gx_stroke_path_only_aux(gx_path * ppath, gx_path * to_path, gx_device * pdev,
((notes & sn_dash_head) ? nf_dash_head : 0) |
((notes & sn_dash_tail) ? nf_dash_tail : 0) |
(flags & ~nf_all_from_arc));
- code = (*line_proc) (to_path, to_path_reverse, true,
- index - 1, &pl_prev, lptr, pdevc,
- dev, pis, params, &cbox, uniform, join,
- initial_matrix_reflected,
- COMBINE_FLAGS(flags));
- if (code < 0)
- goto exit;
- FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
- cap = ((flags & nf_prev_dash_head) ?
- pgs_lp->start_cap : pgs_lp->dash_cap);
- if (traditional && lptr == 0 && cap != gs_cap_butt) {
- /* Create the initial cap at last. */
- code = stroke_add_initial_cap_compat(to_path, &pl_first, index == 1, pdevc, dev, pis);
- if (code < 0)
- goto exit;
- FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
- }
- }
- psub = (const subpath *)pseg;
+ code = (*line_proc) (to_path, to_path_reverse, true,
+ index - 1, &pl_prev, lptr, pdevc,
+ dev, pis, params, &cbox, uniform, join,
+ initial_matrix_reflected,
+ COMBINE_FLAGS(flags));
+ if (code < 0)
+ goto exit;
+ FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
+ cap = ((flags & nf_prev_dash_head) ?
+ pgs_lp->start_cap : pgs_lp->dash_cap);
+ if (traditional && lptr == 0 && cap != gs_cap_butt) {
+ /* Create the initial cap at last. */
+ code = stroke_add_initial_cap_compat(to_path, &pl_first, index == 1, pdevc, dev, pis);
+ if (code < 0)
+ goto exit;
+ FILL_STROKE_PATH(pdev, always_thin, pcpath, false);
+ }
+ }
+ psub = (const subpath *)pseg;
}
if (to_path_reverse != NULL)
code = gx_join_path_and_reverse(to_path, to_path_reverse);
FILL_STROKE_PATH(pdev, always_thin, pcpath, true);
exit:
if (dev == (gx_device *)&cdev)
- cdev.target->sgr = cdev.sgr;
+ cdev.target->sgr = cdev.sgr;
if (to_path == &stroke_path_body)
- gx_path_free(&stroke_path_body, "gx_stroke_path_only error"); /* (only needed if error) */
+ gx_path_free(&stroke_path_body, "gx_stroke_path_only error"); /* (only needed if error) */
if (to_path_reverse == &stroke_path_reverse)
gx_path_free(&stroke_path_reverse, "gx_stroke_path_only error");
if (dash_count)
- gx_path_free(&dpath, "gx_stroke_path exit(dash path)");
+ gx_path_free(&dpath, "gx_stroke_path exit(dash path)");
exf:
if (ppath->curve_count)
- gx_path_free(&fpath, "gx_stroke_path exit(flattened path)");
+ gx_path_free(&fpath, "gx_stroke_path exit(flattened path)");
return code;
}
int
gx_stroke_path_only(gx_path * ppath, gx_path * to_path, gx_device * pdev,
- const gs_imager_state * pis, const gx_stroke_params * params,
- const gx_device_color * pdevc, const gx_clip_path * pcpath)
+ const gs_imager_state * pis, const gx_stroke_params * params,
+ const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
int code;
if (vd_allowed('S')) {
- vd_get_dc('S');
- if (vd_enabled) {
- vd_set_shift(0, 100);
- vd_set_scale(0.03);
- vd_set_origin(0, 0);
- vd_erase(RGB(192, 192, 192));
- }
+ vd_get_dc('S');
+ if (vd_enabled) {
+ vd_set_shift(0, 100);
+ vd_set_scale(0.03);
+ vd_set_origin(0, 0);
+ vd_erase(RGB(192, 192, 192));
+ }
}
if (vd_enabled)
- vd_setcolor(pdevc->colors.pure);
+ vd_setcolor(pdevc->colors.pure);
code = gx_stroke_path_only_aux(ppath, to_path, pdev, pis, params, pdevc, pcpath);
if (vd_allowed('S'))
- vd_release_dc;
+ vd_release_dc;
return code;
}
@@ -1038,16 +1038,16 @@ width_is_thin(pl_ptr plp)
/* If the line is horizontal or vertical, things are easy. */
if ((dy = plp->vector.y) == 0)
- return any_abs(wy) < fixed_half;
+ return any_abs(wy) < fixed_half;
if ((dx = plp->vector.x) == 0)
- return any_abs(wx) < fixed_half;
+ return any_abs(wx) < fixed_half;
/*
* If both horizontal and vertical widths are less than
* 0.5, the line is thin.
*/
if (any_abs(wx) < fixed_half && any_abs(wy) < fixed_half)
- return true;
+ return true;
/*
* We have to do this the hard way, by actually computing the
@@ -1057,13 +1057,13 @@ width_is_thin(pl_ptr plp)
* In this case, (U,V) is plp->width, and (C,D) is (dx,dy).
*/
{
- double C = dx, D = dy;
- double num = C * wy - D * wx;
- double denom = hypot(C, D);
+ double C = dx, D = dy;
+ double num = C * wy - D * wx;
+ double denom = hypot(C, D);
- /* both num and denom are scaled by fixed_scale^2, */
- /* so we don't need to do any de-scaling for the test. */
- return fabs(num) < denom * 0.5;
+ /* both num and denom are scaled by fixed_scale^2, */
+ /* so we don't need to do any de-scaling for the test. */
+ return fabs(num) < denom * 0.5;
}
}
@@ -1078,13 +1078,13 @@ adjust_stroke_transversal(pl_ptr plp, const gs_imager_state * pis, bool thin, bo
fixed adj2;
if (horiz) {
- /* More horizontal stroke */
- pw = &plp->width.y, pov = &plp->o.p.y, pev = &plp->e.p.y;
- adj2 = STROKE_ADJUSTMENT(thin, pis, y) << 1;
+ /* More horizontal stroke */
+ pw = &plp->width.y, pov = &plp->o.p.y, pev = &plp->e.p.y;
+ adj2 = STROKE_ADJUSTMENT(thin, pis, y) << 1;
} else {
- /* More vertical stroke */
- pw = &plp->width.x, pov = &plp->o.p.x, pev = &plp->e.p.x;
- adj2 = STROKE_ADJUSTMENT(thin, pis, x) << 1;
+ /* More vertical stroke */
+ pw = &plp->width.x, pov = &plp->o.p.x, pev = &plp->e.p.x;
+ adj2 = STROKE_ADJUSTMENT(thin, pis, x) << 1;
}
/* Round the larger component of the width up or down, */
/* whichever way produces a result closer to the correct width. */
@@ -1092,31 +1092,31 @@ adjust_stroke_transversal(pl_ptr plp, const gs_imager_state * pis, bool thin, bo
/* may not produce the correct result. */
w = *pw;
if (w > 0)
- w2 = fixed_rounded(w << 1); /* full line width */
+ w2 = fixed_rounded(w << 1); /* full line width */
else
- w2 = -fixed_rounded(-w << 1); /* full line width */
+ w2 = -fixed_rounded(-w << 1); /* full line width */
if (w2 == 0 && *pw != 0) {
- /* Make sure thin lines don't disappear. */
- w2 = (*pw < 0 ? -fixed_1 + adj2 : fixed_1 - adj2);
- *pw = arith_rshift_1(w2);
+ /* Make sure thin lines don't disappear. */
+ w2 = (*pw < 0 ? -fixed_1 + adj2 : fixed_1 - adj2);
+ *pw = arith_rshift_1(w2);
}
/* Only adjust the endpoints if the line is horizontal or vertical. */
if (*pov == *pev) {
- /* We're going to round the endpoint coordinates, so */
- /* take the fill adjustment into account now. */
- if (w >= 0)
- w2 += adj2;
- else
- w2 = adj2 - w2;
- if (w2 & fixed_1) /* odd width, move to half-pixel */
- *pov = *pev = fixed_floor(*pov) + fixed_half;
- else /* even width, move to pixel */
- *pov = *pev = fixed_rounded(*pov);
+ /* We're going to round the endpoint coordinates, so */
+ /* take the fill adjustment into account now. */
+ if (w >= 0)
+ w2 += adj2;
+ else
+ w2 = adj2 - w2;
+ if (w2 & fixed_1) /* odd width, move to half-pixel */
+ *pov = *pev = fixed_floor(*pov) + fixed_half;
+ else /* even width, move to pixel */
+ *pov = *pev = fixed_rounded(*pov);
}
}
-static void
+static void
adjust_stroke_longitude(pl_ptr plp, const gs_imager_state * pis,
bool thin, bool horiz,
gs_line_cap start_cap, gs_line_cap end_cap)
@@ -1125,48 +1125,48 @@ adjust_stroke_longitude(pl_ptr plp, const gs_imager_state * pis,
fixed *pow = (horiz ? &plp->o.p.y : &plp->o.p.x);
fixed *pew = (horiz ? &plp->e.p.y : &plp->e.p.x);
- /* Only adjust the endpoints if the line is horizontal or vertical.
+ /* Only adjust the endpoints if the line is horizontal or vertical.
Debugged with pdfwrite->ppmraw 72dpi file2.pdf */
if (*pow == *pew) {
- fixed *pov = (horiz ? &plp->o.p.x : &plp->o.p.y);
- fixed *pev = (horiz ? &plp->e.p.x : &plp->e.p.y);
- fixed length = any_abs(*pov - *pev);
- fixed length_r, length_r_2;
- fixed mv = (*pov + *pev) / 2, mv_r;
- fixed adj2 = (horiz ? STROKE_ADJUSTMENT(thin, pis, x)
- : STROKE_ADJUSTMENT(thin, pis, y)) << 1;
-
- /* fixme :
- The best value for adjust_longitude is whether
- the dash is isolated and doesn't cover entire segment.
- The current data structure can't pass this info.
- Therefore we restrict adjust_stroke_longitude with 1 pixel length.
- */
- if (length > fixed_1) /* comparefiles/file2.pdf */
- return;
- if (start_cap == gs_cap_butt || end_cap == gs_cap_butt) {
- length_r = fixed_rounded(length);
- if (length_r < fixed_1)
- length_r = fixed_1;
- length_r_2 = length_r / 2;
- } else {
- /* Account width for proper placing cap centers. */
- fixed width = any_abs(horiz ? plp->width.y : plp->width.x);
-
- length_r = fixed_rounded(length + width * 2 + adj2);
- length_r_2 = fixed_rounded(length) / 2;
- }
- if (length_r & fixed_1)
- mv_r = fixed_floor(mv) + fixed_half;
- else
- mv_r = fixed_floor(mv);
- if (*pov < *pev) {
- *pov = mv_r - length_r_2;
- *pev = mv_r + length_r_2;
- } else {
- *pov = mv_r + length_r_2;
- *pev = mv_r - length_r_2;
- }
+ fixed *pov = (horiz ? &plp->o.p.x : &plp->o.p.y);
+ fixed *pev = (horiz ? &plp->e.p.x : &plp->e.p.y);
+ fixed length = any_abs(*pov - *pev);
+ fixed length_r, length_r_2;
+ fixed mv = (*pov + *pev) / 2, mv_r;
+ fixed adj2 = (horiz ? STROKE_ADJUSTMENT(thin, pis, x)
+ : STROKE_ADJUSTMENT(thin, pis, y)) << 1;
+
+ /* fixme :
+ The best value for adjust_longitude is whether
+ the dash is isolated and doesn't cover entire segment.
+ The current data structure can't pass this info.
+ Therefore we restrict adjust_stroke_longitude with 1 pixel length.
+ */
+ if (length > fixed_1) /* comparefiles/file2.pdf */
+ return;
+ if (start_cap == gs_cap_butt || end_cap == gs_cap_butt) {
+ length_r = fixed_rounded(length);
+ if (length_r < fixed_1)
+ length_r = fixed_1;
+ length_r_2 = length_r / 2;
+ } else {
+ /* Account width for proper placing cap centers. */
+ fixed width = any_abs(horiz ? plp->width.y : plp->width.x);
+
+ length_r = fixed_rounded(length + width * 2 + adj2);
+ length_r_2 = fixed_rounded(length) / 2;
+ }
+ if (length_r & fixed_1)
+ mv_r = fixed_floor(mv) + fixed_half;
+ else
+ mv_r = fixed_floor(mv);
+ if (*pov < *pev) {
+ *pov = mv_r - length_r_2;
+ *pev = mv_r + length_r_2;
+ } else {
+ *pov = mv_r + length_r_2;
+ *pev = mv_r - length_r_2;
+ }
}
}
@@ -1186,97 +1186,97 @@ adjust_stroke(gx_device *dev, pl_ptr plp, const gs_imager_state * pis,
pis->line_params.end_cap);
if (!pis->stroke_adjust && (plp->width.x != 0 && plp->width.y != 0)) {
- dev->sgr.stroke_stored = false;
- return; /* don't adjust */
+ dev->sgr.stroke_stored = false;
+ return; /* don't adjust */
}
/* Recognizing gradients, which some obsolete software
- represent as a set of parallel strokes.
+ represent as a set of parallel strokes.
Such strokes must not be adjusted - bug 687974. */
if (dev->sgr.stroke_stored &&
- (start_cap == gs_cap_butt || end_cap == gs_cap_butt) &&
- dev->sgr.orig[3].x == plp->vector.x && dev->sgr.orig[3].y == plp->vector.y) {
- /* Parallel. */
- if ((int64_t)(plp->o.p.x - dev->sgr.orig[0].x) * plp->vector.x ==
- (int64_t)(plp->o.p.y - dev->sgr.orig[0].y) * plp->vector.y &&
- (int64_t)(plp->e.p.x - dev->sgr.orig[1].x) * plp->vector.x ==
- (int64_t)(plp->e.p.y - dev->sgr.orig[1].y) * plp->vector.y) {
- /* Transversal shift. */
- if (any_abs(plp->o.p.x - dev->sgr.orig[0].x) <= any_abs(plp->width.x + dev->sgr.orig[2].x) &&
- any_abs(plp->o.p.y - dev->sgr.orig[0].y) <= any_abs(plp->width.y + dev->sgr.orig[2].y) &&
- any_abs(plp->e.p.x - dev->sgr.orig[1].x) <= any_abs(plp->width.x + dev->sgr.orig[2].x) &&
- any_abs(plp->e.p.y - dev->sgr.orig[1].y) <= any_abs(plp->width.y + dev->sgr.orig[2].y)) {
- /* The strokes were contacting or overlapping. */
- if (any_abs(plp->o.p.x - dev->sgr.orig[0].x) >= any_abs(plp->width.x + dev->sgr.orig[2].x) / 2 &&
- any_abs(plp->o.p.y - dev->sgr.orig[0].y) >= any_abs(plp->width.y + dev->sgr.orig[2].y) / 2 &&
- any_abs(plp->e.p.x - dev->sgr.orig[1].x) >= any_abs(plp->width.x + dev->sgr.orig[2].x) / 2 &&
- any_abs(plp->e.p.y - dev->sgr.orig[1].y) >= any_abs(plp->width.y + dev->sgr.orig[2].y) / 2) {
- /* The strokes were not much overlapping. */
- if (!(any_abs(plp->o.p.x - dev->sgr.adjusted[0].x) <= any_abs(plp->width.x + dev->sgr.adjusted[2].x) &&
- any_abs(plp->o.p.y - dev->sgr.adjusted[0].y) <= any_abs(plp->width.y + dev->sgr.adjusted[2].y) &&
- any_abs(plp->e.p.x - dev->sgr.adjusted[1].x) <= any_abs(plp->width.x + dev->sgr.adjusted[2].x) &&
- any_abs(plp->e.p.y - dev->sgr.adjusted[1].y) <= any_abs(plp->width.y + dev->sgr.adjusted[2].y))) {
- /* they became not contacting.
- We should not have adjusted the last stroke. Since if we did,
- lets change the current one to restore the contact,
- so that we don't leave gaps when rasterising. See bug 687974.
- */
- fixed delta_w_x = (dev->sgr.adjusted[2].x - dev->sgr.orig[2].x);
- fixed delta_w_y = (dev->sgr.adjusted[2].y - dev->sgr.orig[2].y);
- fixed shift_o_x = (dev->sgr.adjusted[0].x - dev->sgr.orig[0].x);
- fixed shift_o_y = (dev->sgr.adjusted[0].y - dev->sgr.orig[0].y);
- fixed shift_e_x = (dev->sgr.adjusted[1].x - dev->sgr.orig[1].x); /* Must be same, but we prefer clarity. */
- fixed shift_e_y = (dev->sgr.adjusted[1].y - dev->sgr.orig[1].y);
-
- if (plp->o.p.x < dev->sgr.orig[0].x ||
- (plp->o.p.x == dev->sgr.orig[0].x && plp->o.p.y < dev->sgr.orig[0].y)) {
- /* Left contact, adjust to keep the contact. */
- if_debug4('O', "[O]don't adjust {{%f,%f},{%f,%f}}\n",
- fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
- fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
- plp->width.x += (shift_o_x - delta_w_x) / 2;
- plp->width.y += (shift_o_y - delta_w_y) / 2;
- plp->o.p.x += (shift_o_x - delta_w_x) / 2;
- plp->o.p.y += (shift_o_y - delta_w_y) / 2;
- plp->e.p.x += (shift_e_x - delta_w_x) / 2;
- plp->e.p.y += (shift_e_y - delta_w_y) / 2;
- adjust = false;
- } else {
- /* Right contact, adjust to keep the contact. */
- if_debug4('O', "[O]don't adjust {{%f,%f},{%f,%f}}\n",
- fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
- fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
- plp->width.x -= (shift_o_x + delta_w_x) / 2;
- plp->width.y -= (shift_o_y + delta_w_y) / 2;
- plp->o.p.x += (shift_o_x + delta_w_x) / 2;
- plp->o.p.y += (shift_o_y + delta_w_y) / 2;
- plp->e.p.x += (shift_e_x + delta_w_x) / 2;
- plp->e.p.y += (shift_e_y + delta_w_y) / 2;
- adjust = false;
- }
- }
- }
- }
- }
+ (start_cap == gs_cap_butt || end_cap == gs_cap_butt) &&
+ dev->sgr.orig[3].x == plp->vector.x && dev->sgr.orig[3].y == plp->vector.y) {
+ /* Parallel. */
+ if ((int64_t)(plp->o.p.x - dev->sgr.orig[0].x) * plp->vector.x ==
+ (int64_t)(plp->o.p.y - dev->sgr.orig[0].y) * plp->vector.y &&
+ (int64_t)(plp->e.p.x - dev->sgr.orig[1].x) * plp->vector.x ==
+ (int64_t)(plp->e.p.y - dev->sgr.orig[1].y) * plp->vector.y) {
+ /* Transversal shift. */
+ if (any_abs(plp->o.p.x - dev->sgr.orig[0].x) <= any_abs(plp->width.x + dev->sgr.orig[2].x) &&
+ any_abs(plp->o.p.y - dev->sgr.orig[0].y) <= any_abs(plp->width.y + dev->sgr.orig[2].y) &&
+ any_abs(plp->e.p.x - dev->sgr.orig[1].x) <= any_abs(plp->width.x + dev->sgr.orig[2].x) &&
+ any_abs(plp->e.p.y - dev->sgr.orig[1].y) <= any_abs(plp->width.y + dev->sgr.orig[2].y)) {
+ /* The strokes were contacting or overlapping. */
+ if (any_abs(plp->o.p.x - dev->sgr.orig[0].x) >= any_abs(plp->width.x + dev->sgr.orig[2].x) / 2 &&
+ any_abs(plp->o.p.y - dev->sgr.orig[0].y) >= any_abs(plp->width.y + dev->sgr.orig[2].y) / 2 &&
+ any_abs(plp->e.p.x - dev->sgr.orig[1].x) >= any_abs(plp->width.x + dev->sgr.orig[2].x) / 2 &&
+ any_abs(plp->e.p.y - dev->sgr.orig[1].y) >= any_abs(plp->width.y + dev->sgr.orig[2].y) / 2) {
+ /* The strokes were not much overlapping. */
+ if (!(any_abs(plp->o.p.x - dev->sgr.adjusted[0].x) <= any_abs(plp->width.x + dev->sgr.adjusted[2].x) &&
+ any_abs(plp->o.p.y - dev->sgr.adjusted[0].y) <= any_abs(plp->width.y + dev->sgr.adjusted[2].y) &&
+ any_abs(plp->e.p.x - dev->sgr.adjusted[1].x) <= any_abs(plp->width.x + dev->sgr.adjusted[2].x) &&
+ any_abs(plp->e.p.y - dev->sgr.adjusted[1].y) <= any_abs(plp->width.y + dev->sgr.adjusted[2].y))) {
+ /* they became not contacting.
+ We should not have adjusted the last stroke. Since if we did,
+ lets change the current one to restore the contact,
+ so that we don't leave gaps when rasterising. See bug 687974.
+ */
+ fixed delta_w_x = (dev->sgr.adjusted[2].x - dev->sgr.orig[2].x);
+ fixed delta_w_y = (dev->sgr.adjusted[2].y - dev->sgr.orig[2].y);
+ fixed shift_o_x = (dev->sgr.adjusted[0].x - dev->sgr.orig[0].x);
+ fixed shift_o_y = (dev->sgr.adjusted[0].y - dev->sgr.orig[0].y);
+ fixed shift_e_x = (dev->sgr.adjusted[1].x - dev->sgr.orig[1].x); /* Must be same, but we prefer clarity. */
+ fixed shift_e_y = (dev->sgr.adjusted[1].y - dev->sgr.orig[1].y);
+
+ if (plp->o.p.x < dev->sgr.orig[0].x ||
+ (plp->o.p.x == dev->sgr.orig[0].x && plp->o.p.y < dev->sgr.orig[0].y)) {
+ /* Left contact, adjust to keep the contact. */
+ if_debug4('O', "[O]don't adjust {{%f,%f},{%f,%f}}\n",
+ fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
+ fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
+ plp->width.x += (shift_o_x - delta_w_x) / 2;
+ plp->width.y += (shift_o_y - delta_w_y) / 2;
+ plp->o.p.x += (shift_o_x - delta_w_x) / 2;
+ plp->o.p.y += (shift_o_y - delta_w_y) / 2;
+ plp->e.p.x += (shift_e_x - delta_w_x) / 2;
+ plp->e.p.y += (shift_e_y - delta_w_y) / 2;
+ adjust = false;
+ } else {
+ /* Right contact, adjust to keep the contact. */
+ if_debug4('O', "[O]don't adjust {{%f,%f},{%f,%f}}\n",
+ fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
+ fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
+ plp->width.x -= (shift_o_x + delta_w_x) / 2;
+ plp->width.y -= (shift_o_y + delta_w_y) / 2;
+ plp->o.p.x += (shift_o_x + delta_w_x) / 2;
+ plp->o.p.y += (shift_o_y + delta_w_y) / 2;
+ plp->e.p.x += (shift_e_x + delta_w_x) / 2;
+ plp->e.p.y += (shift_e_y + delta_w_y) / 2;
+ adjust = false;
+ }
+ }
+ }
+ }
+ }
}
if ((start_cap == gs_cap_butt) || (end_cap == gs_cap_butt)) {
- dev->sgr.stroke_stored = true;
- dev->sgr.orig[0] = plp->o.p;
- dev->sgr.orig[1] = plp->e.p;
- dev->sgr.orig[2] = plp->width;
- dev->sgr.orig[3] = plp->vector;
+ dev->sgr.stroke_stored = true;
+ dev->sgr.orig[0] = plp->o.p;
+ dev->sgr.orig[1] = plp->e.p;
+ dev->sgr.orig[2] = plp->width;
+ dev->sgr.orig[3] = plp->vector;
} else
- dev->sgr.stroke_stored = false;
+ dev->sgr.stroke_stored = false;
if (adjust) {
- horiz = (any_abs(plp->width.x) <= any_abs(plp->width.y));
- adjust_stroke_transversal(plp, pis, thin, horiz);
- if (adjust_longitude)
- adjust_stroke_longitude(plp, pis, thin, horiz, start_cap, end_cap);
- }
+ horiz = (any_abs(plp->width.x) <= any_abs(plp->width.y));
+ adjust_stroke_transversal(plp, pis, thin, horiz);
+ if (adjust_longitude)
+ adjust_stroke_longitude(plp, pis, thin, horiz, start_cap, end_cap);
+ }
if ((start_cap == gs_cap_butt) || (end_cap == gs_cap_butt)) {
- dev->sgr.adjusted[0] = plp->o.p;
- dev->sgr.adjusted[1] = plp->e.p;
- dev->sgr.adjusted[2] = plp->width;
- dev->sgr.adjusted[3] = plp->vector;
+ dev->sgr.adjusted[0] = plp->o.p;
+ dev->sgr.adjusted[1] = plp->e.p;
+ dev->sgr.adjusted[2] = plp->width;
+ dev->sgr.adjusted[3] = plp->vector;
}
}
@@ -1287,11 +1287,11 @@ adjust_stroke(gx_device *dev, pl_ptr plp, const gs_imager_state * pis,
/* the direction determined by *pd1 and *pd2, and 1 otherwise. */
static int
line_intersect(
- p_ptr pp1, /* point on 1st line */
- p_ptr pd1, /* slope of 1st line (dx,dy) */
- p_ptr pp2, /* point on 2nd line */
- p_ptr pd2, /* slope of 2nd line */
- p_ptr pi)
+ p_ptr pp1, /* point on 1st line */
+ p_ptr pd1, /* slope of 1st line (dx,dy) */
+ p_ptr pp2, /* point on 2nd line */
+ p_ptr pd2, /* slope of 2nd line */
+ p_ptr pi)
{ /* return intersection here */
/* We don't have to do any scaling, the factors all work out right. */
double u1 = pd1->x, v1 = pd1->y;
@@ -1304,28 +1304,28 @@ line_intersect(
#ifdef DEBUG
if (gs_debug_c('O')) {
- dlprintf4("[o]Intersect %f,%f(%f/%f)",
- fixed2float(pp1->x), fixed2float(pp1->y),
- fixed2float(pd1->x), fixed2float(pd1->y));
- dlprintf4(" & %f,%f(%f/%f),\n",
- fixed2float(pp2->x), fixed2float(pp2->y),
- fixed2float(pd2->x), fixed2float(pd2->y));
- dlprintf3("\txdiff=%f ydiff=%f denom=%f ->\n",
- xdiff, ydiff, denom);
+ dlprintf4("[o]Intersect %f,%f(%f/%f)",
+ fixed2float(pp1->x), fixed2float(pp1->y),
+ fixed2float(pd1->x), fixed2float(pd1->y));
+ dlprintf4(" & %f,%f(%f/%f),\n",
+ fixed2float(pp2->x), fixed2float(pp2->y),
+ fixed2float(pd2->x), fixed2float(pd2->y));
+ dlprintf3("\txdiff=%f ydiff=%f denom=%f ->\n",
+ xdiff, ydiff, denom);
}
#endif
/* Check for degenerate result. */
if (any_abs(xdiff) >= max_result || any_abs(ydiff) >= max_result) {
- /* The lines are nearly parallel, */
- /* or one of them has zero length. Punt. */
- if_debug0('O', "\tdegenerate!\n");
- return -1;
+ /* The lines are nearly parallel, */
+ /* or one of them has zero length. Punt. */
+ if_debug0('O', "\tdegenerate!\n");
+ return -1;
}
f1 = (v2 * xdiff - u2 * ydiff) / denom;
pi->x = pp1->x + (fixed) (f1 * u1);
pi->y = pp1->y + (fixed) (f1 * v1);
if_debug2('O', "\t%f,%f\n",
- fixed2float(pi->x), fixed2float(pi->y));
+ fixed2float(pi->x), fixed2float(pi->y));
return (f1 >= 0 && (v1 * xdiff >= u1 * ydiff ? denom >= 0 : denom < 0) ? 0 : 1);
}
@@ -1338,11 +1338,11 @@ set_thin_widths(register pl_ptr plp)
#define TRSIGN(v, c) ((v) >= 0 ? (c) : -(c))
if (any_abs(dx) > any_abs(dy)) {
- plp->width.x = plp->e.cdelta.y = 0;
- plp->width.y = plp->e.cdelta.x = TRSIGN(dx, fixed_half);
+ plp->width.x = plp->e.cdelta.y = 0;
+ plp->width.y = plp->e.cdelta.x = TRSIGN(dx, fixed_half);
} else {
- plp->width.y = plp->e.cdelta.x = 0;
- plp->width.x = -(plp->e.cdelta.y = TRSIGN(dy, fixed_half));
+ plp->width.y = plp->e.cdelta.x = 0;
+ plp->width.x = -(plp->e.cdelta.y = TRSIGN(dy, fixed_half));
}
#undef TRSIGN
}
@@ -1364,93 +1364,93 @@ stroke_fill(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
const fixed litoy = plp->e.p.y;
if (plp->thin) {
- /* Minimum-width line, don't have to be careful with caps/joins. */
- return (*dev_proc(dev, draw_thin_line))(dev, lix, liy, litox, litoy,
- pdevc, pis->log_op,
- pis->fill_adjust.x,
- pis->fill_adjust.y);
+ /* Minimum-width line, don't have to be careful with caps/joins. */
+ return (*dev_proc(dev, draw_thin_line))(dev, lix, liy, litox, litoy,
+ pdevc, pis->log_op,
+ pis->fill_adjust.x,
+ pis->fill_adjust.y);
}
/* Check for being able to fill directly. */
{
- const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
- gs_line_cap start_cap = (flags & nf_dash_head ?
- pgs_lp->dash_cap : pgs_lp->start_cap);
- gs_line_cap end_cap = (flags & nf_dash_tail ?
- pgs_lp->dash_cap : pgs_lp->end_cap);
+ const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
+ gs_line_cap start_cap = (flags & nf_dash_head ?
+ pgs_lp->dash_cap : pgs_lp->start_cap);
+ gs_line_cap end_cap = (flags & nf_dash_tail ?
+ pgs_lp->dash_cap : pgs_lp->end_cap);
if (first != 0)
start_cap = gs_cap_butt;
if (nplp != 0)
end_cap = gs_cap_butt;
- if (!plp->thin && (nplp == 0 || !nplp->thin)
- && (start_cap == gs_cap_butt || start_cap == gs_cap_square)
- && (end_cap == gs_cap_butt || end_cap == gs_cap_square)
- && (join == gs_join_bevel || join == gs_join_miter ||
- join == gs_join_none)
- && (pis->fill_adjust.x | pis->fill_adjust.y) == 0
- && lop_is_idempotent(pis->log_op)
- ) {
- gs_fixed_point points[6];
- int npoints, code;
- fixed ax, ay, bx, by;
-
- npoints = cap_points(start_cap, &plp->o, points);
- if (nplp == 0)
- code = cap_points(end_cap, &plp->e, points + npoints);
- else
- code = line_join_points(pgs_lp, plp, nplp, points + npoints,
- (uniform ? (gs_matrix *) 0 :
- &ctm_only(pis)), join, reflected);
- if (code < 0)
- goto general;
- /* Make sure the parallelogram fill won't overflow. */
+ if (!plp->thin && (nplp == 0 || !nplp->thin)
+ && (start_cap == gs_cap_butt || start_cap == gs_cap_square)
+ && (end_cap == gs_cap_butt || end_cap == gs_cap_square)
+ && (join == gs_join_bevel || join == gs_join_miter ||
+ join == gs_join_none)
+ && (pis->fill_adjust.x | pis->fill_adjust.y) == 0
+ && lop_is_idempotent(pis->log_op)
+ ) {
+ gs_fixed_point points[6];
+ int npoints, code;
+ fixed ax, ay, bx, by;
+
+ npoints = cap_points(start_cap, &plp->o, points);
+ if (nplp == 0)
+ code = cap_points(end_cap, &plp->e, points + npoints);
+ else
+ code = line_join_points(pgs_lp, plp, nplp, points + npoints,
+ (uniform ? (gs_matrix *) 0 :
+ &ctm_only(pis)), join, reflected);
+ if (code < 0)
+ goto general;
+ /* Make sure the parallelogram fill won't overflow. */
#define SUB_OVERFLOWS(r, u, v)\
(((r = u - v) ^ u) < 0 && (u ^ v) < 0)
- if (SUB_OVERFLOWS(ax, points[0].x, points[1].x) ||
- SUB_OVERFLOWS(ay, points[0].y, points[1].y) ||
- SUB_OVERFLOWS(bx, points[2].x, points[1].x) ||
- SUB_OVERFLOWS(by, points[2].y, points[1].y)
- )
- goto general;
+ if (SUB_OVERFLOWS(ax, points[0].x, points[1].x) ||
+ SUB_OVERFLOWS(ay, points[0].y, points[1].y) ||
+ SUB_OVERFLOWS(bx, points[2].x, points[1].x) ||
+ SUB_OVERFLOWS(by, points[2].y, points[1].y)
+ )
+ goto general;
#undef SUB_OVERFLOWS
- if (nplp != 0) {
- if (join == gs_join_miter) {
- /* Make sure we have a bevel and not a miter. */
- if (!(points[2].x == plp->e.co.x &&
- points[2].y == plp->e.co.y &&
- points[5].x == plp->e.ce.x &&
- points[5].y == plp->e.ce.y)
- )
- goto fill;
- } {
- const gs_fixed_point *bevel = points + 2;
-
- /* Identify which 3 points define the bevel triangle. */
- if (points[3].x == nplp->o.p.x &&
- points[3].y == nplp->o.p.y
- )
- ++bevel;
- /* Fill the bevel. */
- code = (*dev_proc(dev, fill_triangle)) (dev,
- bevel->x, bevel->y,
- bevel[1].x - bevel->x, bevel[1].y - bevel->y,
- bevel[2].x - bevel->x, bevel[2].y - bevel->y,
- pdevc, pis->log_op);
- if (code < 0)
- return code;
- }
- }
- /* Fill the body of the stroke. */
- return (*dev_proc(dev, fill_parallelogram)) (dev,
- points[1].x, points[1].y,
- ax, ay, bx, by,
- pdevc, pis->log_op);
- fill:
- code = add_points(ppath, points, npoints + code, true);
- if (code < 0)
- return code;
- return gx_path_close_subpath(ppath);
- }
+ if (nplp != 0) {
+ if (join == gs_join_miter) {
+ /* Make sure we have a bevel and not a miter. */
+ if (!(points[2].x == plp->e.co.x &&
+ points[2].y == plp->e.co.y &&
+ points[5].x == plp->e.ce.x &&
+ points[5].y == plp->e.ce.y)
+ )
+ goto fill;
+ } {
+ const gs_fixed_point *bevel = points + 2;
+
+ /* Identify which 3 points define the bevel triangle. */
+ if (points[3].x == nplp->o.p.x &&
+ points[3].y == nplp->o.p.y
+ )
+ ++bevel;
+ /* Fill the bevel. */
+ code = (*dev_proc(dev, fill_triangle)) (dev,
+ bevel->x, bevel->y,
+ bevel[1].x - bevel->x, bevel[1].y - bevel->y,
+ bevel[2].x - bevel->x, bevel[2].y - bevel->y,
+ pdevc, pis->log_op);
+ if (code < 0)
+ return code;
+ }
+ }
+ /* Fill the body of the stroke. */
+ return (*dev_proc(dev, fill_parallelogram)) (dev,
+ points[1].x, points[1].y,
+ ax, ay, bx, by,
+ pdevc, pis->log_op);
+ fill:
+ code = add_points(ppath, points, npoints + code, true);
+ if (code < 0)
+ return code;
+ return gx_path_close_subpath(ppath);
+ }
}
/* General case: construct a path for the fill algorithm. */
general:
@@ -1479,68 +1479,68 @@ stroke_add(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
pgs_lp->dash_cap : pgs_lp->end_cap);
if (plp->thin) {
- /* We didn't set up the endpoint parameters before, */
- /* because the line was thin. Do it now. */
- set_thin_widths(plp);
- adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
- compute_caps(plp);
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
+ compute_caps(plp);
}
/* Create an initial cap if desired. */
if (first == 0 && start_cap == gs_cap_round) {
- vd_moveto(plp->o.co.x, plp->o.co.y);
- if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
- (code = add_pie_cap(ppath, &plp->o)) < 0)
- return code;
- npoints = 0;
- moveto_first = false;
+ vd_moveto(plp->o.co.x, plp->o.co.y);
+ if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
+ (code = add_pie_cap(ppath, &plp->o)) < 0)
+ return code;
+ npoints = 0;
+ moveto_first = false;
} else {
- if ((npoints = cap_points((first == 0 ? start_cap : gs_cap_butt),
- &plp->o, points)) < 0)
- return npoints;
+ if ((npoints = cap_points((first == 0 ? start_cap : gs_cap_butt),
+ &plp->o, points)) < 0)
+ return npoints;
}
if (nplp == 0) {
- /* Add a final cap. */
- if (end_cap == gs_cap_round) {
- ASSIGN_POINT(&points[npoints], plp->e.co);
- vd_lineto(points[npoints].x, points[npoints].y);
- ++npoints;
- if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
- return code;
- code = add_pie_cap(ppath, &plp->e);
- goto done;
- }
- code = cap_points(end_cap, &plp->e, points + npoints);
+ /* Add a final cap. */
+ if (end_cap == gs_cap_round) {
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
+ code = add_pie_cap(ppath, &plp->e);
+ goto done;
+ }
+ code = cap_points(end_cap, &plp->e, points + npoints);
} else if (nplp->thin) /* no join */
- code = cap_points(gs_cap_butt, &plp->e, points + npoints);
+ code = cap_points(gs_cap_butt, &plp->e, points + npoints);
else if (join == gs_join_round) {
- ASSIGN_POINT(&points[npoints], plp->e.co);
- vd_lineto(points[npoints].x, points[npoints].y);
- ++npoints;
- if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
- return code;
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
code = add_pie_join(ppath, plp, nplp, reflected, true);
- goto done;
+ goto done;
} else if (flags & nf_all_from_arc) {
/* If all the segments in 'prev' and 'current' are from a curve
* then the join should actually be a round one, because it would
* have been round if we had flattened it enough. */
- ASSIGN_POINT(&points[npoints], plp->e.co);
- vd_lineto(points[npoints].x, points[npoints].y);
- ++npoints;
- if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
- return code;
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
code = add_pie_join(ppath, plp, nplp, reflected, false);
- goto done;
+ goto done;
} else /* non-round join */
code = line_join_points(pgs_lp, plp, nplp, points + npoints,
- (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
- join, reflected);
+ (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
+ join, reflected);
if (code < 0)
- return code;
+ return code;
code = add_points(ppath, points, npoints + code, moveto_first);
done:
if (code < 0)
- return code;
+ return code;
vd_closepath;
if ((flags & nf_some_from_arc) && (!plp->thin) &&
(nplp != NULL) && (!nplp->thin))
@@ -1570,11 +1570,11 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
gs_line_cap start_cap, end_cap;
if (plp->thin) {
- /* We didn't set up the endpoint parameters before, */
- /* because the line was thin. Do it now. */
- set_thin_widths(plp);
- adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
- compute_caps(plp);
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
+ compute_caps(plp);
}
start_cap = (flags & nf_dash_head ?
pgs_lp->dash_cap : pgs_lp->start_cap);
@@ -1594,7 +1594,7 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
if (start_cap == gs_cap_round) {
vd_moveto(plp->o.co.x, plp->o.co.y);
if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
- (code = add_pie_cap(ppath, &plp->o)) < 0)
+ (code = add_pie_cap(ppath, &plp->o)) < 0)
return code;
moveto_first = false;
} else {
@@ -1617,24 +1617,24 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
return code;
npoints = 0;
nrpoints = 0;
-
+
if (nplp == 0) { /* Add a final cap. */
- if (end_cap == gs_cap_round) {
- code = add_pie_cap(ppath, &plp->e);
- } else {
+ if (end_cap == gs_cap_round) {
+ code = add_pie_cap(ppath, &plp->e);
+ } else {
code = cap_points(end_cap, &plp->e, points);
npoints = code;
}
} else if (nplp->thin) { /* no join */
- code = cap_points(gs_cap_butt, &plp->e, points);
- npoints = code;
+ code = cap_points(gs_cap_butt, &plp->e, points);
+ npoints = code;
} else {
/* We need to do a join */
double l, r;
-
+
l = (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */;
r = (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
-
+
if ((l == r) && (join == gs_join_round)) {
/* Do a cap, and leave the point on the same side as it was
* originally. This is required for paths that come to a stop
@@ -1730,12 +1730,12 @@ stroke_add_fast(gx_path * ppath, gx_path * rpath, bool ensure_closed, int first,
if (npoints > 0) {
code = add_points(ppath, points, npoints, false);
if (code < 0)
- return code;
+ return code;
}
if (nrpoints > 0) {
code = add_points(rpath, rpoints, nrpoints, false);
if (code < 0)
- return code;
+ return code;
}
vd_closepath;
if (ensure_closed)
@@ -1759,7 +1759,7 @@ stroke_add_compat(gx_path * ppath, gx_path *rpath, bool ensure_closed,
gs_line_join join, bool reflected, note_flags flags)
{
/* Actually it adds 2 contours : one for the segment itself,
- and another one for line join or for the ending cap.
+ and another one for line join or for the ending cap.
Note CPSI creates negative contours. */
const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
gs_fixed_point points[5];
@@ -1768,11 +1768,11 @@ stroke_add_compat(gx_path * ppath, gx_path *rpath, bool ensure_closed,
int code;
if (plp->thin) {
- /* We didn't set up the endpoint parameters before, */
- /* because the line was thin. Do it now. */
- set_thin_widths(plp);
- adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
- compute_caps(plp);
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(dev, plp, pis, true, first == 0 && nplp == 0, flags);
+ compute_caps(plp);
}
/* The segment itself : */
ASSIGN_POINT(&points[0], plp->o.ce);
@@ -1781,70 +1781,70 @@ stroke_add_compat(gx_path * ppath, gx_path *rpath, bool ensure_closed,
ASSIGN_POINT(&points[3], plp->o.co);
code = add_points(ppath, points, 4, moveto_first);
if (code < 0)
- return code;
+ return code;
code = gx_path_close_subpath(ppath);
if (code < 0)
- return code;
+ return code;
vd_closepath;
npoints = 0;
if (nplp == 0) {
- /* Add a final cap. */
- if (pgs_lp->start_cap == gs_cap_butt)
- return 0;
- if (pgs_lp->start_cap == gs_cap_round) {
- ASSIGN_POINT(&points[npoints], plp->e.co);
- vd_lineto(points[npoints].x, points[npoints].y);
- ++npoints;
- if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
- return code;
- return add_round_cap(ppath, &plp->e);
- }
- ASSIGN_POINT(&points[0], plp->e.ce);
- ++npoints;
- ASSIGN_POINT(&points[npoints], plp->e.co);
- ++npoints;
- code = cap_points(pgs_lp->start_cap, &plp->e, points + npoints);
- if (code < 0)
- return code;
- npoints += code;
+ /* Add a final cap. */
+ if (pgs_lp->start_cap == gs_cap_butt)
+ return 0;
+ if (pgs_lp->start_cap == gs_cap_round) {
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
+ return add_round_cap(ppath, &plp->e);
+ }
+ ASSIGN_POINT(&points[0], plp->e.ce);
+ ++npoints;
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ ++npoints;
+ code = cap_points(pgs_lp->start_cap, &plp->e, points + npoints);
+ if (code < 0)
+ return code;
+ npoints += code;
} else if (join == gs_join_round) {
- ASSIGN_POINT(&points[npoints], plp->e.co);
- vd_lineto(points[npoints].x, points[npoints].y);
- ++npoints;
- if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
- return code;
- return add_round_cap(ppath, &plp->e);
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
+ return add_round_cap(ppath, &plp->e);
} else if (nplp->thin) { /* no join */
- npoints = 0;
+ npoints = 0;
} else { /* non-round join */
- bool ccw =
- (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */ >
- (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
-
- if (ccw ^ reflected) {
- ASSIGN_POINT(&points[0], plp->e.co);
- vd_lineto(points[0].x, points[0].y);
- ++npoints;
- code = line_join_points(pgs_lp, plp, nplp, points + npoints,
- (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
- join, reflected);
- if (code < 0)
- return code;
- code--; /* Drop the last point of the non-compatible mode. */
- npoints += code;
- } else {
- code = line_join_points(pgs_lp, plp, nplp, points,
- (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
- join, reflected);
- if (code < 0)
- return code;
- ASSIGN_POINT(&points[0], plp->e.ce); /* Replace the starting point of the non-compatible mode. */
- npoints = code;
- }
+ bool ccw =
+ (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */ >
+ (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
+
+ if (ccw ^ reflected) {
+ ASSIGN_POINT(&points[0], plp->e.co);
+ vd_lineto(points[0].x, points[0].y);
+ ++npoints;
+ code = line_join_points(pgs_lp, plp, nplp, points + npoints,
+ (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
+ join, reflected);
+ if (code < 0)
+ return code;
+ code--; /* Drop the last point of the non-compatible mode. */
+ npoints += code;
+ } else {
+ code = line_join_points(pgs_lp, plp, nplp, points,
+ (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
+ join, reflected);
+ if (code < 0)
+ return code;
+ ASSIGN_POINT(&points[0], plp->e.ce); /* Replace the starting point of the non-compatible mode. */
+ npoints = code;
+ }
}
code = add_points(ppath, points, npoints, moveto_first);
if (code < 0)
- return code;
+ return code;
code = gx_path_close_subpath(ppath);
vd_closepath;
return code;
@@ -1858,8 +1858,8 @@ stroke_add_compat(gx_path * ppath, gx_path *rpath, bool ensure_closed,
*/
static int
stroke_add_initial_cap_compat(gx_path * ppath, pl_ptr plp, bool adlust_longitude,
- const gx_device_color * pdevc, gx_device * dev,
- const gs_imager_state * pis)
+ const gx_device_color * pdevc, gx_device * dev,
+ const gs_imager_state * pis)
{
const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
gs_fixed_point points[4];
@@ -1867,56 +1867,56 @@ stroke_add_initial_cap_compat(gx_path * ppath, pl_ptr plp, bool adlust_longitude
int code;
if (pgs_lp->start_cap == gs_cap_butt)
- return 0;
+ return 0;
if (plp->thin) {
- /* We didn't set up the endpoint parameters before, */
- /* because the line was thin. Do it now. */
- set_thin_widths(plp);
- adjust_stroke(dev, plp, pis, true, adlust_longitude, 0);
- compute_caps(plp);
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(dev, plp, pis, true, adlust_longitude, 0);
+ compute_caps(plp);
}
/* Create an initial cap if desired. */
if (pgs_lp->start_cap == gs_cap_round) {
- vd_moveto(plp->o.co.x, plp->o.co.y);
- if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
- (code = add_round_cap(ppath, &plp->o)) < 0
- )
- return code;
- return 0;
+ vd_moveto(plp->o.co.x, plp->o.co.y);
+ if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
+ (code = add_round_cap(ppath, &plp->o)) < 0
+ )
+ return code;
+ return 0;
} else {
- ASSIGN_POINT(&points[0], plp->o.co);
- ++npoints;
- if ((code = cap_points(pgs_lp->start_cap, &plp->o, points + npoints)) < 0)
- return npoints;
- npoints += code;
- ASSIGN_POINT(&points[npoints], plp->o.ce);
- ++npoints;
- code = add_points(ppath, points, npoints, true);
- if (code < 0)
- return code;
- return gx_path_close_subpath(ppath);
+ ASSIGN_POINT(&points[0], plp->o.co);
+ ++npoints;
+ if ((code = cap_points(pgs_lp->start_cap, &plp->o, points + npoints)) < 0)
+ return npoints;
+ npoints += code;
+ ASSIGN_POINT(&points[npoints], plp->o.ce);
+ ++npoints;
+ code = add_points(ppath, points, npoints, true);
+ if (code < 0)
+ return code;
+ return gx_path_close_subpath(ppath);
}
}
/* Add lines with a possible initial moveto. */
static int
add_points(gx_path * ppath, const gs_fixed_point * points, int npoints,
- bool moveto_first)
+ bool moveto_first)
{
int code;
/* vd_setcolor(0); */
vd_setlinewidth(0);
if (moveto_first) {
- code = gx_path_add_point(ppath, points[0].x, points[0].y);
- vd_moveto(points[0].x, points[0].y);
- if (code < 0)
- return code;
- vd_lineto_multi(points + 1, npoints - 1);
- return gx_path_add_lines(ppath, points + 1, npoints - 1);
+ code = gx_path_add_point(ppath, points[0].x, points[0].y);
+ vd_moveto(points[0].x, points[0].y);
+ if (code < 0)
+ return code;
+ vd_lineto_multi(points + 1, npoints - 1);
+ return gx_path_add_lines(ppath, points + 1, npoints - 1);
} else {
- vd_lineto_multi(points, npoints);
- return gx_path_add_lines(ppath, points, npoints);
+ vd_lineto_multi(points, npoints);
+ return gx_path_add_lines(ppath, points, npoints);
}
}
@@ -1952,7 +1952,7 @@ check_miter(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
code = gs_distance_transform_inverse(v1, u1, pmat, &pt);
if (code < 0)
- return code;
+ return code;
v1 = pt.x, u1 = pt.y;
code = gs_distance_transform_inverse(v2, u2, pmat, &pt);
if (code < 0)
@@ -2025,7 +2025,7 @@ check_miter(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
) {
/* OK to use a miter join. */
gs_fixed_point dirn1, dirn2;
-
+
dirn1.x = plp->e.cdelta.x;
dirn1.y = plp->e.cdelta.y;
/* If this direction is small enough that we might have
@@ -2072,8 +2072,8 @@ check_miter(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
/* the miter check. */
static int
line_join_points(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
- gs_fixed_point * join_points, const gs_matrix * pmat,
- gs_line_join join, bool reflected)
+ gs_fixed_point * join_points, const gs_matrix * pmat,
+ gs_line_join join, bool reflected)
{
#define jp1 join_points[0]
#define np1 join_points[1]
@@ -2108,8 +2108,8 @@ line_join_points(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
* that almost all CPUs provide!
*/
bool ccw =
- (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */ >
- (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
+ (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */ >
+ (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
bool ccw0 = ccw;
p_ptr outp, np;
int code;
@@ -2126,34 +2126,34 @@ line_join_points(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
* nplp->o.p as np1 or np2.
*/
if (!ccw) {
- outp = &jp2;
- ASSIGN_POINT(&np2, nplp->o.co);
- ASSIGN_POINT(&np1, nplp->o.p);
- np = &np2;
+ outp = &jp2;
+ ASSIGN_POINT(&np2, nplp->o.co);
+ ASSIGN_POINT(&np1, nplp->o.p);
+ np = &np2;
} else {
- outp = &jp1;
- ASSIGN_POINT(&np1, nplp->o.ce);
- ASSIGN_POINT(&np2, nplp->o.p);
- np = &np1;
+ outp = &jp1;
+ ASSIGN_POINT(&np1, nplp->o.ce);
+ ASSIGN_POINT(&np2, nplp->o.p);
+ np = &np1;
}
if_debug1('O', "[O]use %s\n", (ccw ? "co (ccw)" : "ce (cw)"));
/* Handle triangular joins now. */
if (join == gs_join_triangle) {
- fixed tpx = outp->x - nplp->o.p.x + np->x;
- fixed tpy = outp->y - nplp->o.p.y + np->y;
-
- ASSIGN_POINT(&jpx, jp2);
- if (!ccw) {
- /* Insert tp between np2 and jp2. */
- jp2.x = tpx, jp2.y = tpy;
- } else {
- /* Insert tp between jp1 and np1. */
- ASSIGN_POINT(&jp2, np2);
- ASSIGN_POINT(&np2, np1);
- np1.x = tpx, np1.y = tpy;
- }
- return 5;
+ fixed tpx = outp->x - nplp->o.p.x + np->x;
+ fixed tpy = outp->y - nplp->o.p.y + np->y;
+
+ ASSIGN_POINT(&jpx, jp2);
+ if (!ccw) {
+ /* Insert tp between np2 and jp2. */
+ jp2.x = tpx, jp2.y = tpy;
+ } else {
+ /* Insert tp between jp1 and np1. */
+ ASSIGN_POINT(&jp2, np2);
+ ASSIGN_POINT(&np2, np1);
+ np1.x = tpx, np1.y = tpy;
+ }
+ return 5;
}
/*
* Don't bother with the miter check if the two
@@ -2161,15 +2161,15 @@ line_join_points(const gx_line_params * pgs_lp, pl_ptr plp, pl_ptr nplp,
* namely, in the same square half-pixel.
*/
if (join == gs_join_miter &&
- !(fixed2long(outp->x << 1) == fixed2long(np->x << 1) &&
- fixed2long(outp->y << 1) == fixed2long(np->y << 1))
- ) {
+ !(fixed2long(outp->x << 1) == fixed2long(np->x << 1) &&
+ fixed2long(outp->y << 1) == fixed2long(np->y << 1))
+ ) {
gs_fixed_point mpt;
- code = check_miter(pgs_lp, plp, nplp, pmat, outp, np, &mpt, ccw0);
- if (code < 0)
- return code;
- if (code == 0)
- ASSIGN_POINT(outp, mpt);
+ code = check_miter(pgs_lp, plp, nplp, pmat, outp, np, &mpt, ccw0);
+ if (code < 0)
+ return code;
+ if (code == 0)
+ ASSIGN_POINT(outp, mpt);
}
return 4;
}
@@ -2195,29 +2195,29 @@ line_join_points_fast_cw(const gx_line_params * pgs_lp,
ASSIGN_POINT(&rjoin_points[1], nplp->o.co);
return 2;
}
-
+
/* Set up for a Bevel join */
ASSIGN_POINT(&rjoin_points[0], nplp->o.co);
-
+
/*
* Don't bother with the miter check if the two
* points to be joined are very close together,
* namely, in the same square half-pixel.
*/
if (join == gs_join_miter &&
- !(fixed2long(plp->e.ce.x << 1) == fixed2long(nplp->o.co.x << 1) &&
- fixed2long(plp->e.ce.y << 1) == fixed2long(nplp->o.co.y << 1))
- ) {
+ !(fixed2long(plp->e.ce.x << 1) == fixed2long(nplp->o.co.x << 1) &&
+ fixed2long(plp->e.ce.y << 1) == fixed2long(nplp->o.co.y << 1))
+ ) {
gs_fixed_point mpt;
- int code = check_miter(pgs_lp, plp, nplp, pmat, &plp->e.ce,
- &nplp->o.co, &mpt, false);
- if (code < 0)
- return code;
- if (code == 0) {
+ int code = check_miter(pgs_lp, plp, nplp, pmat, &plp->e.ce,
+ &nplp->o.co, &mpt, false);
+ if (code < 0)
+ return code;
+ if (code == 0) {
ASSIGN_POINT(&rjoin_points[0], mpt);
ASSIGN_POINT(&rjoin_points[1], nplp->o.co);
return 2;
- }
+ }
}
return 1;
}
@@ -2242,7 +2242,7 @@ line_join_points_fast_ccw(const gx_line_params * pgs_lp,
ASSIGN_POINT(&join_points[1], nplp->o.ce);
return 2;
}
-
+
/* Set up for a Bevel join */
ASSIGN_POINT(&join_points[0], nplp->o.ce);
@@ -2252,19 +2252,19 @@ line_join_points_fast_ccw(const gx_line_params * pgs_lp,
* namely, in the same square half-pixel.
*/
if (join == gs_join_miter &&
- !(fixed2long(plp->e.co.x << 1) == fixed2long(nplp->o.ce.x << 1) &&
- fixed2long(plp->e.co.y << 1) == fixed2long(nplp->o.ce.y << 1))
- ) {
+ !(fixed2long(plp->e.co.x << 1) == fixed2long(nplp->o.ce.x << 1) &&
+ fixed2long(plp->e.co.y << 1) == fixed2long(nplp->o.ce.y << 1))
+ ) {
gs_fixed_point mpt;
- int code = check_miter(pgs_lp, plp, nplp, pmat, &plp->e.co,
- &nplp->o.ce, &mpt, true);
- if (code < 0)
- return code;
- if (code == 0) {
+ int code = check_miter(pgs_lp, plp, nplp, pmat, &plp->e.co,
+ &nplp->o.ce, &mpt, true);
+ if (code < 0)
+ return code;
+ if (code == 0) {
ASSIGN_POINT(&join_points[0], mpt);
ASSIGN_POINT(&join_points[1], nplp->o.ce);
return 2;
- }
+ }
}
return 1;
}
@@ -2280,19 +2280,19 @@ compute_caps(pl_ptr plp)
plp->o.co.x = plp->o.p.x + wx2, plp->o.co.y = plp->o.p.y + wy2;
plp->o.cdelta.x = -plp->e.cdelta.x,
- plp->o.cdelta.y = -plp->e.cdelta.y;
+ plp->o.cdelta.y = -plp->e.cdelta.y;
plp->o.ce.x = plp->o.p.x - wx2, plp->o.ce.y = plp->o.p.y - wy2;
plp->e.co.x = plp->e.p.x - wx2, plp->e.co.y = plp->e.p.y - wy2;
plp->e.ce.x = plp->e.p.x + wx2, plp->e.ce.y = plp->e.p.y + wy2;
#ifdef DEBUG
if (gs_debug_c('O')) {
- dlprintf4("[o]Stroke o=(%f,%f) e=(%f,%f)\n",
- fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
- fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
- dlprintf4("\twxy=(%f,%f) lxy=(%f,%f)\n",
- fixed2float(wx2), fixed2float(wy2),
- fixed2float(plp->e.cdelta.x),
- fixed2float(plp->e.cdelta.y));
+ dlprintf4("[o]Stroke o=(%f,%f) e=(%f,%f)\n",
+ fixed2float(plp->o.p.x), fixed2float(plp->o.p.y),
+ fixed2float(plp->e.p.x), fixed2float(plp->e.p.y));
+ dlprintf4("\twxy=(%f,%f) lxy=(%f,%f)\n",
+ fixed2float(wx2), fixed2float(wy2),
+ fixed2float(plp->e.cdelta.x),
+ fixed2float(plp->e.cdelta.y));
}
#endif
}
@@ -2318,19 +2318,19 @@ add_round_cap(gx_path * ppath, const_ep_ptr endp)
* is sufficient for the join.
*/
if ((code = gx_path_add_partial_arc(ppath, px + cdx, py + cdy,
- xo + cdx, yo + cdy,
- quarter_arc_fraction)) < 0 ||
- (code = gx_path_add_partial_arc(ppath, xe, ye, xe + cdx, ye + cdy,
- quarter_arc_fraction)) < 0 ||
- (code = gx_path_add_partial_arc(ppath, px - cdx, py - cdy,
- xe - cdx, ye - cdy,
- quarter_arc_fraction)) < 0 ||
- (code = gx_path_add_partial_arc(ppath, xo, yo, xo - cdx, yo - cdy,
- quarter_arc_fraction)) < 0 ||
- /* The final point must be (xe,ye). */
- (code = gx_path_add_line(ppath, xe, ye)) < 0
- )
- return code;
+ xo + cdx, yo + cdy,
+ quarter_arc_fraction)) < 0 ||
+ (code = gx_path_add_partial_arc(ppath, xe, ye, xe + cdx, ye + cdy,
+ quarter_arc_fraction)) < 0 ||
+ (code = gx_path_add_partial_arc(ppath, px - cdx, py - cdy,
+ xe - cdx, ye - cdy,
+ quarter_arc_fraction)) < 0 ||
+ (code = gx_path_add_partial_arc(ppath, xo, yo, xo - cdx, yo - cdy,
+ quarter_arc_fraction)) < 0 ||
+ /* The final point must be (xe,ye). */
+ (code = gx_path_add_line(ppath, xe, ye)) < 0
+ )
+ return code;
vd_lineto(xe, ye);
return 0;
}
@@ -2393,7 +2393,7 @@ do_pie_join(gx_path * ppath, gs_fixed_point *centre,
tangent.y = -tmp;
}
}
-
+
/* Now we are guaranteed that the remaining arc is 90 degrees or
* less. Find where the tangents meet for this final section. */
if (line_intersect(&current, &tangent,
@@ -2425,14 +2425,14 @@ add_pie_join(gx_path * ppath, pl_ptr plp, pl_ptr nplp, bool reflected,
l = (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */;
r = (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
-
+
if (l == r) {
if (cap)
return add_pie_cap(ppath, &plp->e);
else
return gx_path_add_line(ppath, plp->e.ce.x, plp->e.ce.y);
}
-
+
ccw = (l > r);
ccw ^= reflected;
@@ -2508,14 +2508,14 @@ join_under_pie(gx_path * ppath, pl_ptr plp, pl_ptr nplp, bool reflected)
l = (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */;
r = (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
-
+
if (l == r)
return 0;
-
+
ccw = (l > r);
ccw ^= reflected;
-
+
if (ccw) {
dirn1.x = - plp->width.x;
dirn1.y = - plp->width.y;
@@ -2554,21 +2554,21 @@ cap_points(gs_line_cap type, const_ep_ptr endp, gs_fixed_point *pts /*[3]*/)
#define PUT_POINT(i, px, py)\
pts[i].x = (px), pts[i].y = (py)
switch (type) {
- case gs_cap_butt:
- PUT_POINT(0, xo, yo);
- PUT_POINT(1, xe, ye);
- return 2;
- case gs_cap_square:
- PUT_POINT(0, xo + cdx, yo + cdy);
- PUT_POINT(1, xe + cdx, ye + cdy);
- return 2;
- case gs_cap_triangle: /* (not supported by PostScript) */
- PUT_POINT(0, xo, yo);
- PUT_POINT(1, px + cdx, py + cdy);
- PUT_POINT(2, xe, ye);
- return 3;
- default: /* can't happen */
- return_error(gs_error_unregistered);
+ case gs_cap_butt:
+ PUT_POINT(0, xo, yo);
+ PUT_POINT(1, xe, ye);
+ return 2;
+ case gs_cap_square:
+ PUT_POINT(0, xo + cdx, yo + cdy);
+ PUT_POINT(1, xe + cdx, ye + cdy);
+ return 2;
+ case gs_cap_triangle: /* (not supported by PostScript) */
+ PUT_POINT(0, xo, yo);
+ PUT_POINT(1, px + cdx, py + cdy);
+ PUT_POINT(2, xe, ye);
+ return 3;
+ default: /* can't happen */
+ return_error(gs_error_unregistered);
}
#undef PUT_POINT
}
diff --git a/gs/base/gxsync.c b/gs/base/gxsync.c
index 1a7709809..7cdbab100 100644
--- a/gs/base/gxsync.c
+++ b/gs/base/gxsync.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,7 +25,6 @@
/* This module abstracts the platform-specific synchronization primitives. */
/* Since these routines will see heavy use, performance is important. */
-
/* ----- Semaphore interface ----- */
/* These have the usual queued, counting semaphore semantics: at init time, */
/* the event count is set to 0 ('wait' will wait until 1st signal). */
@@ -33,7 +32,7 @@
/* Allocate & initialize a semaphore */
gx_semaphore_t * /* returns a new semaphore, 0 if error */
gx_semaphore_alloc(
- gs_memory_t * memory /* memory allocator to use */
+ gs_memory_t * memory /* memory allocator to use */
)
{
gx_semaphore_t *sema;
@@ -43,22 +42,22 @@ gx_semaphore_alloc(
= sizeof(*sema) - sizeof(sema->native) + gp_semaphore_sizeof();
if (gp_semaphore_open(0) == 0) /* see if gp_semaphores are movable */
- /* movable */
- sema = (gx_semaphore_t *) gs_alloc_bytes(memory, semaSizeof,
- "gx_semaphore (create)");
+ /* movable */
+ sema = (gx_semaphore_t *) gs_alloc_bytes(memory, semaSizeof,
+ "gx_semaphore (create)");
else
- /* unmovable */
- sema = (gx_semaphore_t *) gs_alloc_bytes_immovable(memory, semaSizeof,
- "gx_semaphore (create)");
+ /* unmovable */
+ sema = (gx_semaphore_t *) gs_alloc_bytes_immovable(memory, semaSizeof,
+ "gx_semaphore (create)");
if (sema == 0)
- return 0;
+ return 0;
/* Make sema remember which allocator was used to allocate it */
sema->memory = memory;
if (gp_semaphore_open(&sema->native) < 0) {
- gs_free_object(memory, sema, "gx_semaphore (alloc)");
- return 0;
+ gs_free_object(memory, sema, "gx_semaphore (alloc)");
+ return 0;
}
return sema;
}
@@ -66,12 +65,12 @@ gx_semaphore_alloc(
/* Deinit & free a semaphore */
void
gx_semaphore_free(
- gx_semaphore_t * sema /* semaphore to delete */
+ gx_semaphore_t * sema /* semaphore to delete */
)
{
if (sema) {
- gp_semaphore_close(&sema->native);
- gs_free_object(sema->memory, sema, "gx_semaphore (free)");
+ gp_semaphore_close(&sema->native);
+ gs_free_object(sema->memory, sema, "gx_semaphore (free)");
}
}
@@ -79,7 +78,6 @@ gx_semaphore_free(
#define gx_semaphore_wait(sema) gp_semaphore_wait(&(sema)->native)
#define gx_semaphore_signal(sema) gp_semaphore_signal(&(sema)->native)
-
/* ----- Monitor interface ----- */
/* These have the usual monitor semantics: at init time, */
/* the event count is set to 1 (1st 'enter' succeeds immediately). */
@@ -87,7 +85,7 @@ gx_semaphore_free(
/* Allocate & Init a monitor */
gx_monitor_t * /* returns a new monitor, 0 if error */
gx_monitor_alloc(
- gs_memory_t * memory /* memory allocator to use */
+ gs_memory_t * memory /* memory allocator to use */
)
{
gx_monitor_t *mon;
@@ -97,22 +95,22 @@ gx_monitor_alloc(
= sizeof(*mon) - sizeof(mon->native) + gp_monitor_sizeof();
if (gp_monitor_open(0) == 0) /* see if gp_monitors are movable */
- /* movable */
- mon = (gx_monitor_t *) gs_alloc_bytes(memory, monSizeof,
- "gx_monitor (create)");
+ /* movable */
+ mon = (gx_monitor_t *) gs_alloc_bytes(memory, monSizeof,
+ "gx_monitor (create)");
else
- /* unmovable */
- mon = (gx_monitor_t *) gs_alloc_bytes_immovable(memory, monSizeof,
- "gx_monitor (create)");
+ /* unmovable */
+ mon = (gx_monitor_t *) gs_alloc_bytes_immovable(memory, monSizeof,
+ "gx_monitor (create)");
if (mon == 0)
- return 0;
+ return 0;
/* Make monitor remember which allocator was used to allocate it */
mon->memory = memory;
if (gp_monitor_open(&mon->native) < 0) {
- gs_free_object(memory, mon, "gx_monitor (alloc)");
- return 0;
+ gs_free_object(memory, mon, "gx_monitor (alloc)");
+ return 0;
}
return mon;
}
@@ -120,12 +118,12 @@ gx_monitor_alloc(
/* Dnit & free a monitor */
void
gx_monitor_free(
- gx_monitor_t * mon /* monitor to delete */
+ gx_monitor_t * mon /* monitor to delete */
)
{
if (mon) {
- gp_monitor_close(&mon->native);
- gs_free_object(mon->memory, mon, "gx_monitor (free)");
+ gp_monitor_close(&mon->native);
+ gs_free_object(mon->memory, mon, "gx_monitor (free)");
}
}
diff --git a/gs/base/gxsync.h b/gs/base/gxsync.h
index 3783356af..cbac28d53 100644
--- a/gs/base/gxsync.h
+++ b/gs/base/gxsync.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,17 +36,16 @@ typedef struct gx_semaphore_s {
gx_semaphore_t * /* returns a new semaphore, 0 if error */
gx_semaphore_alloc(
- gs_memory_t * memory /* memory allocator to use */
- );
+ gs_memory_t * memory /* memory allocator to use */
+ );
void
gx_semaphore_free(
- gx_semaphore_t * sema /* semaphore to delete */
- );
+ gx_semaphore_t * sema /* semaphore to delete */
+ );
#define gx_semaphore_wait(sema) gp_semaphore_wait(&(sema)->native)
#define gx_semaphore_signal(sema) gp_semaphore_signal(&(sema)->native)
-
/* ----- Monitor interface ----- */
/* These have the usual monitor semantics: at init time, */
/* the event count is set to 1 (1st 'enter' succeeds immediately). */
@@ -57,12 +56,12 @@ typedef struct gx_monitor_s {
gx_monitor_t * /* returns a new monitor, 0 if error */
gx_monitor_alloc(
- gs_memory_t * memory /* memory allocator to use */
- );
+ gs_memory_t * memory /* memory allocator to use */
+ );
void
gx_monitor_free(
- gx_monitor_t * mon /* monitor to delete */
- );
+ gx_monitor_t * mon /* monitor to delete */
+ );
#define gx_monitor_enter(sema) gp_monitor_enter(&(sema)->native)
#define gx_monitor_leave(sema) gp_monitor_leave(&(sema)->native)
diff --git a/gs/base/gxtext.h b/gs/base/gxtext.h
index e6b872f17..05b1cb454 100644
--- a/gs/base/gxtext.h
+++ b/gs/base/gxtext.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,9 +54,9 @@ typedef struct gs_text_returned_s {
typedef struct gx_font_stack_item_s {
gs_font *font; /* font at this level */
uint index; /* if *font is a composite font, this is a font number of
- selected discendant font (index in Encoding).
- if *font is a CIDFont, an index of selected FDArray font.
- zero otherwise. */
+ selected discendant font (index in Encoding).
+ if *font is a CIDFont, an index of selected FDArray font.
+ zero otherwise. */
} gx_font_stack_item_t;
typedef struct gx_font_stack_s {
int depth;
@@ -104,7 +104,7 @@ rc_free_proc(rc_free_text_enum);
uint xy_index; /* index within X/Y widths */\
gx_font_stack_t fstack;\
int cmap_code; /* hack for FMapType 9 composite fonts, */\
- /* the value returned by decode_next */\
+ /* the value returned by decode_next */\
gs_point FontBBox_as_Metrics2; /* used with FontType 9,11 && WMode 1 */\
ulong text_enum_id; /* debug purpose only - not used by algorythm. */\
/* The following is controlled by a device. */\
@@ -161,20 +161,20 @@ struct gs_text_enum_s {
gs_public_st_composite(st_gs_text_enum, gs_text_enum_t, "gs_text_enum_t",\
text_enum_enum_ptrs, text_enum_reloc_ptrs)
-/*
+/*
* Initialize a newly created text enumerator. Implementations of
* text_begin must call this just after allocating the enumerator.
* Note that this procedure can return an error, e.g., if attempting
* a glyph-based operation with a composite font.
*/
int gs_text_enum_init(gs_text_enum_t *pte,
- const gs_text_enum_procs_t *procs,
- gx_device *dev, gs_imager_state *pis,
- const gs_text_params_t *text,
- gs_font *font, gx_path *path,
- const gx_device_color *pdcolor,
- const gx_clip_path *pcpath,
- gs_memory_t *mem);
+ const gs_text_enum_procs_t *procs,
+ gx_device *dev, gs_imager_state *pis,
+ const gs_text_params_t *text,
+ gs_font *font, gx_path *path,
+ const gx_device_color *pdcolor,
+ const gx_clip_path *pcpath,
+ gs_memory_t *mem);
/*
* Copy the dynamically changing elements from one enumerator to another.
@@ -183,8 +183,8 @@ int gs_text_enum_init(gs_text_enum_t *pte,
* iff for_return is true.
*/
void gs_text_enum_copy_dynamic(gs_text_enum_t *pto,
- const gs_text_enum_t *pfrom,
- bool for_return);
+ const gs_text_enum_t *pfrom,
+ bool for_return);
/*
* Define some convenience macros for testing aspects of a text
diff --git a/gs/base/gxtmap.h b/gs/base/gxtmap.h
index 4d0418967..04e0bcdfb 100644
--- a/gs/base/gxtmap.h
+++ b/gs/base/gxtmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,8 +37,8 @@ typedef float (*gs_mapping_proc) (floatp, const gx_transfer_map *);
* closure:
*/
typedef float (*gs_mapping_closure_proc_t) (floatp value,
- const gx_transfer_map * pmap,
- const void *proc_data);
+ const gx_transfer_map * pmap,
+ const void *proc_data);
typedef struct gs_mapping_closure_s {
gs_mapping_closure_proc_t proc;
const void *data;
diff --git a/gs/base/gxttf.h b/gs/base/gxttf.h
index 5cec802ac..baaddffc0 100644
--- a/gs/base/gxttf.h
+++ b/gs/base/gxttf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,113 +33,113 @@
typedef struct ttf_head_s {
byte
- version[4], /* version 1.0 */
- fontRevision[4],
- checkSumAdjustment[4],
- magicNumber[4],
- flags[2],
- unitsPerEm[2],
- created[8],
- modified[8],
- xMin[2],
- yMin[2],
- xMax[2],
- yMax[2],
- macStyle[2],
- lowestRecPPM[2],
- fontDirectionHint[2],
- indexToLocFormat[2],
- glyphDataFormat[2];
+ version[4], /* version 1.0 */
+ fontRevision[4],
+ checkSumAdjustment[4],
+ magicNumber[4],
+ flags[2],
+ unitsPerEm[2],
+ created[8],
+ modified[8],
+ xMin[2],
+ yMin[2],
+ xMax[2],
+ yMax[2],
+ macStyle[2],
+ lowestRecPPM[2],
+ fontDirectionHint[2],
+ indexToLocFormat[2],
+ glyphDataFormat[2];
} ttf_head_t;
/* ------ hhea ------ */
typedef struct ttf_hhea_s {
byte
- version[4], /* version 1.0 */
- ascender[2], /* FWord */
- descender[2], /* FWord */
- lineGap[2], /* FWord */
- advanceWidthMax[2], /* uFWord */
- minLeftSideBearing[2], /* FWord */
- minRightSideBearing[2], /* FWord */
- xMaxExtent[2], /* FWord */
- caretSlopeRise[2],
- caretSlopeRun[2],
- caretOffset[2],
- reserved[8],
- metricDataFormat[2], /* 0 */
- numHMetrics[2];
+ version[4], /* version 1.0 */
+ ascender[2], /* FWord */
+ descender[2], /* FWord */
+ lineGap[2], /* FWord */
+ advanceWidthMax[2], /* uFWord */
+ minLeftSideBearing[2], /* FWord */
+ minRightSideBearing[2], /* FWord */
+ xMaxExtent[2], /* FWord */
+ caretSlopeRise[2],
+ caretSlopeRun[2],
+ caretOffset[2],
+ reserved[8],
+ metricDataFormat[2], /* 0 */
+ numHMetrics[2];
} ttf_hhea_t;
/* ------ hmtx ------ */
typedef struct longHorMetric_s {
byte
- advanceWidth[2], /* uFWord */
- lsb[2]; /* FWord */
+ advanceWidth[2], /* uFWord */
+ lsb[2]; /* FWord */
} longHorMetric_t;
/* ------ maxp ------ */
typedef struct ttf_maxp_s {
byte
- version[4], /* 1.0 */
- numGlyphs[2],
- maxPoints[2],
- maxContours[2],
- maxCompositePoints[2],
- maxCompositeContours[2],
- maxZones[2],
- maxTwilightPoints[2],
- maxStorage[2],
- maxFunctionDefs[2],
- maxInstructionDefs[2],
- maxStackElements[2],
- maxSizeOfInstructions[2],
- maxComponentElements[2],
- maxComponentDepth[2];
+ version[4], /* 1.0 */
+ numGlyphs[2],
+ maxPoints[2],
+ maxContours[2],
+ maxCompositePoints[2],
+ maxCompositeContours[2],
+ maxZones[2],
+ maxTwilightPoints[2],
+ maxStorage[2],
+ maxFunctionDefs[2],
+ maxInstructionDefs[2],
+ maxStackElements[2],
+ maxSizeOfInstructions[2],
+ maxComponentElements[2],
+ maxComponentDepth[2];
} ttf_maxp_t;
/* ------ OS/2 ------ */
typedef struct ttf_OS_2_s {
byte
- version[2], /* version 1 */
- xAvgCharWidth[2],
- usWeightClass[2],
- usWidthClass[2],
- fsType[2],
- ySubscriptXSize[2],
- ySubscriptYSize[2],
- ySubscriptXOffset[2],
- ySubscriptYOffset[2],
- ySuperscriptXSize[2],
- ySuperscriptYSize[2],
- ySuperscriptXOffset[2],
- ySuperscriptYOffset[2],
- yStrikeoutSize[2],
- yStrikeoutPosition[2],
- sFamilyClass[2],
- /*panose:*/
- bFamilyType, bSerifStyle, bWeight, bProportion, bContrast,
- bStrokeVariation, bArmStyle, bLetterform, bMidline, bXHeight,
- ulUnicodeRanges[16],
- achVendID[4],
- fsSelection[2],
- usFirstCharIndex[2],
- usLastCharIndex[2],
- sTypoAscender[2],
- sTypoDescender[2],
- sTypoLineGap[2],
- usWinAscent[2],
- usWinDescent[2],
- ulCodePageRanges[8],
+ version[2], /* version 1 */
+ xAvgCharWidth[2],
+ usWeightClass[2],
+ usWidthClass[2],
+ fsType[2],
+ ySubscriptXSize[2],
+ ySubscriptYSize[2],
+ ySubscriptXOffset[2],
+ ySubscriptYOffset[2],
+ ySuperscriptXSize[2],
+ ySuperscriptYSize[2],
+ ySuperscriptXOffset[2],
+ ySuperscriptYOffset[2],
+ yStrikeoutSize[2],
+ yStrikeoutPosition[2],
+ sFamilyClass[2],
+ /*panose:*/
+ bFamilyType, bSerifStyle, bWeight, bProportion, bContrast,
+ bStrokeVariation, bArmStyle, bLetterform, bMidline, bXHeight,
+ ulUnicodeRanges[16],
+ achVendID[4],
+ fsSelection[2],
+ usFirstCharIndex[2],
+ usLastCharIndex[2],
+ sTypoAscender[2],
+ sTypoDescender[2],
+ sTypoLineGap[2],
+ usWinAscent[2],
+ usWinDescent[2],
+ ulCodePageRanges[8],
sxHeight[2], /* version 2 */
- sCapHeight[2],
- usDefaultChar[2],
- usBreakChar[2],
+ sCapHeight[2],
+ usDefaultChar[2],
+ usBreakChar[2],
usMaxContext[2];
} ttf_OS_2_t;
@@ -147,28 +147,28 @@ typedef struct ttf_OS_2_s {
typedef struct ttf_vhea_s {
byte
- version[4], /* version 1.0 */
- ascent[2], /* FWord */
- descent[2], /* FWord */
- lineGap[2], /* FWord */
- advanceHeightMax[2], /* uFWord */
- minTopSideBearing[2], /* FWord */
- minBottomSideBearing[2], /* FWord */
- yMaxExtent[2], /* FWord */
- caretSlopeRise[2],
- caretSlopeRun[2],
- caretOffset[2],
- reserved[8],
- metricDataFormat[2], /* 0 */
- numVMetrics[2];
+ version[4], /* version 1.0 */
+ ascent[2], /* FWord */
+ descent[2], /* FWord */
+ lineGap[2], /* FWord */
+ advanceHeightMax[2], /* uFWord */
+ minTopSideBearing[2], /* FWord */
+ minBottomSideBearing[2], /* FWord */
+ yMaxExtent[2], /* FWord */
+ caretSlopeRise[2],
+ caretSlopeRun[2],
+ caretOffset[2],
+ reserved[8],
+ metricDataFormat[2], /* 0 */
+ numVMetrics[2];
} ttf_vhea_t;
/* ------ vmtx ------ */
typedef struct longVerMetric_s {
byte
- advanceHeight[2], /* uFWord */
- topSideBearing[2]; /* FWord */
+ advanceHeight[2], /* uFWord */
+ topSideBearing[2]; /* FWord */
} longVerMetric_t;
#endif /* gxttf_INCLUDED */
diff --git a/gs/base/gxttfb.c b/gs/base/gxttfb.c
index abbf5f9ac..d485ec32f 100644
--- a/gs/base/gxttfb.c
+++ b/gs/base/gxttfb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,16 +39,16 @@
gs_public_st_composite(st_gx_ttfReader, gx_ttfReader,
"gx_ttfReader", gx_ttfReader_enum_ptrs, gx_ttfReader_reloc_ptrs);
-static
+static
ENUM_PTRS_WITH(gx_ttfReader_enum_ptrs, gx_ttfReader *mptr)
{
- /* The fields 'pfont' and 'glyph_data' may contain pointers from global
- to local memory ( see a comment in gxttfb.h).
- They must be NULL when a garbager is invoked.
- Due to that we don't enumerate and don't relocate them.
- */
- DISCARD(mptr);
- return 0;
+ /* The fields 'pfont' and 'glyph_data' may contain pointers from global
+ to local memory ( see a comment in gxttfb.h).
+ They must be NULL when a garbager is invoked.
+ Due to that we don't enumerate and don't relocate them.
+ */
+ DISCARD(mptr);
+ return 0;
}
ENUM_PTR(0, gx_ttfReader, memory);
ENUM_PTRS_END
@@ -63,7 +63,7 @@ static bool gx_ttfReader__Eof(ttfReader *this)
gx_ttfReader *r = (gx_ttfReader *)this;
if (r->extra_glyph_index != -1)
- return r->pos >= r->glyph_data.bits.size;
+ return r->pos >= r->glyph_data.bits.size;
/* We can't know whether pfont->data.string_proc has more bytes,
so we never report Eof for it. */
return false;
@@ -75,18 +75,18 @@ static void gx_ttfReader__Read(ttfReader *this, void *p, int n)
const byte *q;
if (!r->error) {
- if (r->extra_glyph_index != -1) {
- q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
- gs_note_error(gs_error_invalidfont) : 0);
+ if (r->extra_glyph_index != -1) {
+ q = r->glyph_data.bits.data + r->pos;
+ r->error = (r->glyph_data.bits.size - r->pos < n ?
+ gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
- } else {
+ } else {
unsigned int cnt;
for (cnt = 0; cnt < (uint)n; cnt += r->error) {
- r->error = r->pfont->data.string_proc(r->pfont, (ulong)r->pos + cnt, (ulong)n - cnt, &q);
- if (r->error < 0)
+ r->error = r->pfont->data.string_proc(r->pfont, (ulong)r->pos + cnt, (ulong)n - cnt, &q);
+ if (r->error < 0)
break;
else if ( r->error == 0) {
memcpy((char *)p + cnt, q, n - cnt);
@@ -95,11 +95,11 @@ static void gx_ttfReader__Read(ttfReader *this, void *p, int n)
memcpy((char *)p + cnt, q, r->error);
}
}
- }
+ }
}
if (r->error) {
- memset(p, 0, n);
- return;
+ memset(p, 0, n);
+ return;
}
r->pos += n;
}
@@ -132,22 +132,22 @@ static int gx_ttfReader__LoadGlyph(ttfReader *this, int glyph_index, const byte
int code;
if (r->extra_glyph_index != -1)
- return 0; /* We only maintain a single glyph buffer.
- It's enough because ttfOutliner__BuildGlyphOutline
- is optimized for that, and pfont->data.get_outline
- implements a charstring cache. */
+ return 0; /* We only maintain a single glyph buffer.
+ It's enough because ttfOutliner__BuildGlyphOutline
+ is optimized for that, and pfont->data.get_outline
+ implements a charstring cache. */
r->glyph_data.memory = pfont->memory;
code = pfont->data.get_outline(pfont, (uint)glyph_index, &r->glyph_data);
r->extra_glyph_index = glyph_index;
r->pos = 0;
if (code < 0)
- r->error = code;
+ r->error = code;
else if (code > 0) {
- /* Should not happen. */
- r->error = gs_note_error(gs_error_unregistered);
+ /* Should not happen. */
+ r->error = gs_note_error(gs_error_unregistered);
} else {
- *p = r->glyph_data.bits.data;
- *size = r->glyph_data.bits.size;
+ *p = r->glyph_data.bits.data;
+ *size = r->glyph_data.bits.size;
}
return 2; /* found */
}
@@ -157,7 +157,7 @@ static void gx_ttfReader__ReleaseGlyph(ttfReader *this, int glyph_index)
gx_ttfReader *r = (gx_ttfReader *)this;
if (r->extra_glyph_index != glyph_index)
- return;
+ return;
r->extra_glyph_index = -1;
gs_glyph_data_free(&r->glyph_data, "gx_ttfReader__ReleaseExtraGlyph");
}
@@ -165,8 +165,8 @@ static void gx_ttfReader__ReleaseGlyph(ttfReader *this, int glyph_index)
static void gx_ttfReader__Reset(gx_ttfReader *this)
{
if (this->extra_glyph_index != -1) {
- this->extra_glyph_index = -1;
- gs_glyph_data_free(&this->glyph_data, "gx_ttfReader__Reset");
+ this->extra_glyph_index = -1;
+ gs_glyph_data_free(&this->glyph_data, "gx_ttfReader__Reset");
}
this->error = false;
this->pos = 0;
@@ -177,20 +177,20 @@ gx_ttfReader *gx_ttfReader__create(gs_memory_t *mem)
gx_ttfReader *r = gs_alloc_struct(mem, gx_ttfReader, &st_gx_ttfReader, "gx_ttfReader__create");
if (r != NULL) {
- r->super.Eof = gx_ttfReader__Eof;
- r->super.Read = gx_ttfReader__Read;
- r->super.Seek = gx_ttfReader__Seek;
- r->super.Tell = gx_ttfReader__Tell;
- r->super.Error = gx_ttfReader__Error;
- r->super.LoadGlyph = gx_ttfReader__LoadGlyph;
- r->super.ReleaseGlyph = gx_ttfReader__ReleaseGlyph;
- r->pos = 0;
- r->error = false;
- r->extra_glyph_index = -1;
- memset(&r->glyph_data, 0, sizeof(r->glyph_data));
- r->pfont = NULL;
- r->memory = mem;
- gx_ttfReader__Reset(r);
+ r->super.Eof = gx_ttfReader__Eof;
+ r->super.Read = gx_ttfReader__Read;
+ r->super.Seek = gx_ttfReader__Seek;
+ r->super.Tell = gx_ttfReader__Tell;
+ r->super.Error = gx_ttfReader__Error;
+ r->super.LoadGlyph = gx_ttfReader__LoadGlyph;
+ r->super.ReleaseGlyph = gx_ttfReader__ReleaseGlyph;
+ r->pos = 0;
+ r->error = false;
+ r->extra_glyph_index = -1;
+ memset(&r->glyph_data, 0, sizeof(r->glyph_data));
+ r->pfont = NULL;
+ r->memory = mem;
+ gx_ttfReader__Reset(r);
}
return r;
}
@@ -200,9 +200,9 @@ void gx_ttfReader__destroy(gx_ttfReader *this)
gs_free_object(this->memory, this, "gx_ttfReader__destroy");
}
-static int
-gx_ttfReader__default_get_metrics(const ttfReader *ttf, uint glyph_index, bool bVertical,
- short *sideBearing, unsigned short *nAdvance)
+static int
+gx_ttfReader__default_get_metrics(const ttfReader *ttf, uint glyph_index, bool bVertical,
+ short *sideBearing, unsigned short *nAdvance)
{
gx_ttfReader *this = (gx_ttfReader *)ttf;
float sbw[4];
@@ -211,13 +211,13 @@ gx_ttfReader__default_get_metrics(const ttfReader *ttf, uint glyph_index, bool b
int factor = this->pfont->data.unitsPerEm;
if (bVertical)
- factor = factor; /* See simple_glyph_metrics */
+ factor = factor; /* See simple_glyph_metrics */
code = this->pfont->data.get_metrics(this->pfont, glyph_index, bVertical, sbw);
if (code < 0)
- return code;
+ return code;
/* Due to an obsolete convention, simple_glyph_metrics scales
the metrics into 1x1 rectangle as Postscript like.
- In same time, the True Type interpreter needs
+ In same time, the True Type interpreter needs
the original design units.
Undo the scaling here with accurate rounding. */
*sideBearing = (short)floor(sbw[0 + sbw_offset] * factor + 0.5);
@@ -231,7 +231,6 @@ void gx_ttfReader__set_font(gx_ttfReader *this, gs_font_type42 *pfont)
this->super.get_metrics = gx_ttfReader__default_get_metrics;
}
-
/*----------------------------------------------*/
static void DebugRepaint(ttfFont *ttf)
@@ -245,12 +244,12 @@ static int DebugPrint(ttfFont *ttf, const char *fmt, ...)
int count;
if (gs_debug_c('Y')) {
- va_start(args, fmt);
- count = vsprintf(buf, fmt, args);
- /* NB: moved debug output from stdout to stderr
- */
- errwrite(ttf->DebugMem, buf, count);
- va_end(args);
+ va_start(args, fmt);
+ count = vsprintf(buf, fmt, args);
+ /* NB: moved debug output from stdout to stderr
+ */
+ errwrite(ttf->DebugMem, buf, count);
+ va_end(args);
}
return 0;
}
@@ -262,44 +261,44 @@ static void WarnBadInstruction(gs_font_type42 *pfont, int glyph_index)
gs_font_type42 *base_font = pfont;
while ((gs_font_type42 *)base_font->base != base_font)
- base_font = (gs_font_type42 *)base_font->base;
+ base_font = (gs_font_type42 *)base_font->base;
if (!base_font->data.warning_bad_instruction) {
- l = min(sizeof(buf) - 1, base_font->font_name.size);
- memcpy(buf, base_font->font_name.chars, l);
- buf[l] = 0;
- if (glyph_index >= 0)
+ l = min(sizeof(buf) - 1, base_font->font_name.size);
+ memcpy(buf, base_font->font_name.chars, l);
+ buf[l] = 0;
+ if (glyph_index >= 0)
emprintf2(pfont->memory,
"Failed to interpret TT instructions for glyph index %d of font %s. "
- "Continue ignoring instructions of the font.\n",
+ "Continue ignoring instructions of the font.\n",
glyph_index, buf);
- else
+ else
emprintf1(pfont->memory,
"Failed to interpret TT instructions in font %s. "
- "Continue ignoring instructions of the font.\n",
+ "Continue ignoring instructions of the font.\n",
buf);
- base_font->data.warning_bad_instruction = true;
+ base_font->data.warning_bad_instruction = true;
}
}
static void WarnPatented(gs_font_type42 *pfont, ttfFont *ttf, const char *txt)
{
if (!ttf->design_grid) {
- char buf[gs_font_name_max + 1];
- int l;
- gs_font_type42 *base_font = pfont;
-
- while ((gs_font_type42 *)base_font->base != base_font)
- base_font = (gs_font_type42 *)base_font->base;
- if (!base_font->data.warning_patented) {
- l = min(sizeof(buf) - 1, base_font->font_name.size);
- memcpy(buf, base_font->font_name.chars, l);
- buf[l] = 0;
+ char buf[gs_font_name_max + 1];
+ int l;
+ gs_font_type42 *base_font = pfont;
+
+ while ((gs_font_type42 *)base_font->base != base_font)
+ base_font = (gs_font_type42 *)base_font->base;
+ if (!base_font->data.warning_patented) {
+ l = min(sizeof(buf) - 1, base_font->font_name.size);
+ memcpy(buf, base_font->font_name.chars, l);
+ buf[l] = 0;
emprintf2(pfont->memory,
"%s %s requires a patented True Type interpreter.\n",
txt,
buf);
- base_font->data.warning_patented = true;
- }
+ base_font->data.warning_patented = true;
+ }
}
}
@@ -341,12 +340,12 @@ static inline float reminder(float v, int x)
return ((v / x) - floor(v / x)) * x;
}
-static void decompose_matrix(const gs_font_type42 *pfont, const gs_matrix * char_tm,
+static void decompose_matrix(const gs_font_type42 *pfont, const gs_matrix * char_tm,
const gs_log2_scale_point *log2_scale, bool design_grid,
gs_point *char_size, gs_point *subpix_origin, gs_matrix *post_transform, bool *dg)
{
- /*
- * char_tm maps to subpixels.
+ /*
+ * char_tm maps to subpixels.
*/
/*
* We use a Free Type 1 True Type interpreter, which cannot perform
@@ -363,10 +362,10 @@ static void decompose_matrix(const gs_font_type42 *pfont, const gs_matrix * char
char_size->x = hypot(char_tm->xx, char_tm->xy);
char_size->y = hypot(char_tm->yx, char_tm->yy);
if (char_size->x <= 2 && char_size->y <= 2) {
- /* Disable the grid fitting for very small fonts. */
- design_grid1 = true;
+ /* Disable the grid fitting for very small fonts. */
+ design_grid1 = true;
} else
- design_grid1 = design_grid || !(gs_currentgridfittt(pfont->dir) & 1);
+ design_grid1 = design_grid || !(gs_currentgridfittt(pfont->dir) & 1);
*dg = design_grid1;
subpix_origin->x = (atp ? 0 : reminder(char_tm->tx, scale_x) / scale_x);
subpix_origin->y = (atp ? 0 : reminder(char_tm->ty, scale_y) / scale_y);
@@ -386,23 +385,23 @@ ttfFont *ttfFont__create(gs_font_dir *dir)
ttfFont *ttf;
if (dir->ttm == NULL) {
- gx_ttfMemory *m = gs_alloc_struct(mem, gx_ttfMemory, &st_gx_ttfMemory, "ttfFont__create(gx_ttfMemory)");
-
- if (!m)
- return 0;
- m->super.alloc_struct = gx_ttfMemory__alloc_struct;
- m->super.alloc_bytes = gx_ttfMemory__alloc_bytes;
- m->super.free = gx_ttfMemory__free;
- m->memory = mem;
- dir->ttm = m;
+ gx_ttfMemory *m = gs_alloc_struct(mem, gx_ttfMemory, &st_gx_ttfMemory, "ttfFont__create(gx_ttfMemory)");
+
+ if (!m)
+ return 0;
+ m->super.alloc_struct = gx_ttfMemory__alloc_struct;
+ m->super.alloc_bytes = gx_ttfMemory__alloc_bytes;
+ m->super.free = gx_ttfMemory__free;
+ m->memory = mem;
+ dir->ttm = m;
}
if(ttfInterpreter__obtain(&dir->ttm->super, &dir->tti))
- return 0;
+ return 0;
if(gx_san__obtain(mem, &dir->san))
- return 0;
+ return 0;
ttf = gs_alloc_struct(mem, ttfFont, &st_ttfFont, "ttfFont__create");
if (ttf == NULL)
- return 0;
+ return 0;
#ifdef DEBUG
ttfFont__init(ttf, &dir->ttm->super, DebugRepaint,
(gs_debug_c('Y') ? DebugPrint : NULL), mem);
@@ -414,7 +413,7 @@ ttfFont *ttfFont__create(gs_font_dir *dir)
}
void ttfFont__destroy(ttfFont *this, gs_font_dir *dir)
-{
+{
gs_memory_t *mem = dir->memory->stable_memory;
ttfFont__finit(this);
@@ -422,48 +421,48 @@ void ttfFont__destroy(ttfFont *this, gs_font_dir *dir)
ttfInterpreter__release(&dir->tti);
gx_san__release(&dir->san);
if (dir->tti == NULL && dir->ttm != NULL) {
- gs_free_object(mem, dir->ttm, "ttfFont__destroy(gx_ttfMemory)");
- dir->ttm = NULL;
+ gs_free_object(mem, dir->ttm, "ttfFont__destroy(gx_ttfMemory)");
+ dir->ttm = NULL;
}
}
int ttfFont__Open_aux(ttfFont *this, ttfInterpreter *tti, gx_ttfReader *r, gs_font_type42 *pfont,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid)
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid)
{
gs_point char_size, subpix_origin;
gs_matrix post_transform;
- /*
- * Ghostscript proceses a TTC index in gs/lib/gs_ttf.ps,
+ /*
+ * Ghostscript proceses a TTC index in gs/lib/gs_ttf.ps,
* and *pfont already adjusted to it.
- * Therefore TTC headers never comes here.
+ * Therefore TTC headers never comes here.
*/
- unsigned int nTTC = 0;
+ unsigned int nTTC = 0;
bool dg;
decompose_matrix(pfont, char_tm, log2_scale, design_grid, &char_size, &subpix_origin, &post_transform, &dg);
switch(ttfFont__Open(tti, this, &r->super, nTTC, char_size.x, char_size.y, dg)) {
- case fNoError:
- return 0;
- case fMemoryError:
- return_error(gs_error_VMerror);
- case fUnimplemented:
- return_error(gs_error_unregistered);
- case fBadInstruction:
- WarnBadInstruction(pfont, -1);
- goto recover;
- case fPatented:
- WarnPatented(pfont, this, "The font");
- recover:
- this->patented = true;
- return 0;
- default:
- { int code = r->super.Error(&r->super);
-
- if (code < 0)
- return code;
- return_error(gs_error_invalidfont);
- }
+ case fNoError:
+ return 0;
+ case fMemoryError:
+ return_error(gs_error_VMerror);
+ case fUnimplemented:
+ return_error(gs_error_unregistered);
+ case fBadInstruction:
+ WarnBadInstruction(pfont, -1);
+ goto recover;
+ case fPatented:
+ WarnPatented(pfont, this, "The font");
+ recover:
+ this->patented = true;
+ return 0;
+ default:
+ { int code = r->super.Error(&r->super);
+
+ if (code < 0)
+ return code;
+ return_error(gs_error_invalidfont);
+ }
}
}
@@ -482,7 +481,7 @@ static void gx_ttfExport__MoveTo(ttfExport *this, FloatPoint *p)
gx_ttfExport *e = (gx_ttfExport *)this;
if (!e->error)
- e->error = gx_path_add_point(e->path, float2fixed(p->x), float2fixed(p->y));
+ e->error = gx_path_add_point(e->path, float2fixed(p->x), float2fixed(p->y));
}
static void gx_ttfExport__LineTo(ttfExport *this, FloatPoint *p)
@@ -490,7 +489,7 @@ static void gx_ttfExport__LineTo(ttfExport *this, FloatPoint *p)
gx_ttfExport *e = (gx_ttfExport *)this;
if (!e->error)
- e->error = gx_path_add_line_notes(e->path, float2fixed(p->x), float2fixed(p->y), sn_none);
+ e->error = gx_path_add_line_notes(e->path, float2fixed(p->x), float2fixed(p->y), sn_none);
}
static void gx_ttfExport__CurveTo(ttfExport *this, FloatPoint *p0, FloatPoint *p1, FloatPoint *p2)
@@ -498,18 +497,18 @@ static void gx_ttfExport__CurveTo(ttfExport *this, FloatPoint *p0, FloatPoint *p
gx_ttfExport *e = (gx_ttfExport *)this;
if (!e->error) {
- if (e->monotonize) {
- curve_segment s;
-
- s.notes = sn_none;
- s.p1.x = float2fixed(p0->x), s.p1.y = float2fixed(p0->y),
- s.p2.x = float2fixed(p1->x), s.p2.y = float2fixed(p1->y),
- s.pt.x = float2fixed(p2->x), s.pt.y = float2fixed(p2->y);
- e->error = gx_curve_monotonize(e->path, &s);
- } else
- e->error = gx_path_add_curve_notes(e->path, float2fixed(p0->x), float2fixed(p0->y),
- float2fixed(p1->x), float2fixed(p1->y),
- float2fixed(p2->x), float2fixed(p2->y), sn_none);
+ if (e->monotonize) {
+ curve_segment s;
+
+ s.notes = sn_none;
+ s.p1.x = float2fixed(p0->x), s.p1.y = float2fixed(p0->y),
+ s.p2.x = float2fixed(p1->x), s.p2.y = float2fixed(p1->y),
+ s.pt.x = float2fixed(p2->x), s.pt.y = float2fixed(p2->y);
+ e->error = gx_curve_monotonize(e->path, &s);
+ } else
+ e->error = gx_path_add_curve_notes(e->path, float2fixed(p0->x), float2fixed(p0->y),
+ float2fixed(p1->x), float2fixed(p1->y),
+ float2fixed(p2->x), float2fixed(p2->y), sn_none);
}
}
@@ -518,7 +517,7 @@ static void gx_ttfExport__Close(ttfExport *this)
gx_ttfExport *e = (gx_ttfExport *)this;
if (!e->error)
- e->error = gx_path_close_subpath_notes(e->path, sn_none);
+ e->error = gx_path_close_subpath_notes(e->path, sn_none);
}
static void gx_ttfExport__Point(ttfExport *this, FloatPoint *p, bool bOnCurve, bool bNewPath)
@@ -530,8 +529,8 @@ static void gx_ttfExport__SetWidth(ttfExport *this, FloatPoint *p)
{
gx_ttfExport *e = (gx_ttfExport *)this;
- e->w.x = float2fixed(p->x);
- e->w.y = float2fixed(p->y);
+ e->w.x = float2fixed(p->x);
+ e->w.y = float2fixed(p->y);
}
static void gx_ttfExport__DebugPaint(ttfExport *this)
@@ -551,35 +550,35 @@ path_to_hinter(t1_hinter *h, gx_path *path)
code = gx_path_enum_init(&penum, path);
if (code < 0)
- return code;
+ return code;
while ((op = gx_path_enum_next(&penum, pts)) != 0) {
- switch (op) {
- case gs_pe_moveto:
- if (first) {
- first = false;
- p = pts[0];
- code = t1_hinter__rmoveto(h, p.x, p.y);
- } else
- code = t1_hinter__rmoveto(h, pts[0].x - p.x, pts[0].y - p.y);
- break;
- case gs_pe_lineto:
- code = t1_hinter__rlineto(h, pts[0].x - p.x, pts[0].y - p.y);
- break;
- case gs_pe_curveto:
- code = t1_hinter__rcurveto(h, pts[0].x - p.x, pts[0].y - p.y,
- pts[1].x - pts[0].x, pts[1].y - pts[0].y,
- pts[2].x - pts[1].x, pts[2].y - pts[1].y);
- pts[0] = pts[2];
- break;
- case gs_pe_closepath:
- code = t1_hinter__closepath(h);
- break;
- default:
- return_error(gs_error_unregistered);
- }
- if (code < 0)
- return code;
- p = pts[0];
+ switch (op) {
+ case gs_pe_moveto:
+ if (first) {
+ first = false;
+ p = pts[0];
+ code = t1_hinter__rmoveto(h, p.x, p.y);
+ } else
+ code = t1_hinter__rmoveto(h, pts[0].x - p.x, pts[0].y - p.y);
+ break;
+ case gs_pe_lineto:
+ code = t1_hinter__rlineto(h, pts[0].x - p.x, pts[0].y - p.y);
+ break;
+ case gs_pe_curveto:
+ code = t1_hinter__rcurveto(h, pts[0].x - p.x, pts[0].y - p.y,
+ pts[1].x - pts[0].x, pts[1].y - pts[0].y,
+ pts[2].x - pts[1].x, pts[2].y - pts[1].y);
+ pts[0] = pts[2];
+ break;
+ case gs_pe_closepath:
+ code = t1_hinter__closepath(h);
+ break;
+ default:
+ return_error(gs_error_unregistered);
+ }
+ if (code < 0)
+ return code;
+ p = pts[0];
}
return 0;
}
@@ -593,13 +592,13 @@ transpose_path(gx_path *path)
exch(path->bbox.p.x, path->bbox.p.y);
exch(path->bbox.q.x, path->bbox.q.y);
for (; s; s = s->next) {
- if (s->type == s_curve) {
- curve_segment *c = (curve_segment *)s;
+ if (s->type == s_curve) {
+ curve_segment *c = (curve_segment *)s;
- exch(c->p1.x, c->p1.y);
- exch(c->p2.x, c->p2.y);
- }
- exch(s->pt.x, s->pt.y);
+ exch(c->p1.x, c->p1.y);
+ exch(c->p2.x, c->p2.y);
+ }
+ exch(s->pt.x, s->pt.y);
}
}
@@ -609,39 +608,39 @@ typedef struct {
fixed midx;
} t1_hinter_aux;
-static int
+static int
stem_hint_handler(void *client_data, gx_san_sect *ss)
{
t1_hinter_aux *h = (t1_hinter_aux *)client_data;
if (ss->side_mask == 3) {
- /* Orient horizontal hints to help with top/bottom alignment zones.
- Otherwize glyphs may get a random height due to serif adjustsment. */
- if (ss->xl > h->midx && h->transpose)
- return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem)
- (&h->super, ss->xr, ss->xl - ss->xr);
- else
- return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem)
- (&h->super, ss->xl, ss->xr - ss->xl);
+ /* Orient horizontal hints to help with top/bottom alignment zones.
+ Otherwize glyphs may get a random height due to serif adjustsment. */
+ if (ss->xl > h->midx && h->transpose)
+ return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem)
+ (&h->super, ss->xr, ss->xl - ss->xr);
+ else
+ return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem)
+ (&h->super, ss->xl, ss->xr - ss->xl);
} else
- return t1_hinter__overall_hstem(&h->super, ss->xl, ss->xr - ss->xl, ss->side_mask);
+ return t1_hinter__overall_hstem(&h->super, ss->xl, ss->xr - ss->xl, ss->side_mask);
}
#define OVERALL_HINT 0 /* Overall hints help to emulate Type 1 alignment zones
(except for overshoot suppression.)
- For example, without it comparefiles/type42_glyph_index.ps
- some glyphs have different height due to
- serifs are aligned in same way as horizontal stems,
- but both sides of a stem have same priority.
+ For example, without it comparefiles/type42_glyph_index.ps
+ some glyphs have different height due to
+ serifs are aligned in same way as horizontal stems,
+ but both sides of a stem have same priority.
- This stuff appears low useful, because horizontal
- hint orientation performs this job perfectly.
- fixme : remove.
- fixme : remove side_mask from gxhintn.c .
- */
+ This stuff appears low useful, because horizontal
+ hint orientation performs this job perfectly.
+ fixme : remove.
+ fixme : remove side_mask from gxhintn.c .
+ */
-static int grid_fit(gx_device_spot_analyzer *padev, gx_path *path,
- gs_font_type42 *pfont, const gs_log2_scale_point *pscale, gx_ttfExport *e, ttfOutliner *o)
+static int grid_fit(gx_device_spot_analyzer *padev, gx_path *path,
+ gs_font_type42 *pfont, const gs_log2_scale_point *pscale, gx_ttfExport *e, ttfOutliner *o)
{
/* Not completed yet. */
gs_imager_state is_stub;
@@ -665,81 +664,81 @@ static int grid_fit(gx_device_spot_analyzer *padev, gx_path *path,
m.ty = o->post_transform.ty;
code = gs_matrix_fixed_from_matrix(&ctm_temp, &m);
if (code < 0)
- return code;
+ return code;
code = gs_matrix_scale(&pfont->FontMatrix, scale, scale, &fm);
if (code < 0)
- return code;
+ return code;
code = gs_matrix_scale(&pfont->base->FontMatrix, scale, scale, &fmb);
if (code < 0)
- return code;
+ return code;
t1_hinter__init(&h.super, path); /* Will export to */
code = t1_hinter__set_mapping(&h.super, &ctm_temp,
- &fm, &fmb,
- pscale->x, pscale->x, 0, 0,
- ctm_temp.tx_fixed, ctm_temp.ty_fixed, atp);
+ &fm, &fmb,
+ pscale->x, pscale->x, 0, 0,
+ ctm_temp.tx_fixed, ctm_temp.ty_fixed, atp);
if (code < 0)
- return code;
+ return code;
if (!h.super.disable_hinting) {
- o->post_transform.a = o->post_transform.d = 1;
- o->post_transform.b = o->post_transform.c = 0;
- o->post_transform.tx = o->post_transform.ty = 0;
- ttfOutliner__DrawGlyphOutline(o);
- if (e->error)
- return e->error;
- code = t1_hinter__set_font42_data(&h.super, FontType, &pfont->data, false);
- if (code < 0)
- return code;
- code = t1_hinter__sbw(&h.super, sbx, sby, e->w.x, e->w.y);
- if (code < 0)
- return code;
- code = gx_path_bbox(path, &bbox);
- if (code < 0)
- return code;
- memset(&is_stub, 0, sizeof(is_stub));
+ o->post_transform.a = o->post_transform.d = 1;
+ o->post_transform.b = o->post_transform.c = 0;
+ o->post_transform.tx = o->post_transform.ty = 0;
+ ttfOutliner__DrawGlyphOutline(o);
+ if (e->error)
+ return e->error;
+ code = t1_hinter__set_font42_data(&h.super, FontType, &pfont->data, false);
+ if (code < 0)
+ return code;
+ code = t1_hinter__sbw(&h.super, sbx, sby, e->w.x, e->w.y);
+ if (code < 0)
+ return code;
+ code = gx_path_bbox(path, &bbox);
+ if (code < 0)
+ return code;
+ memset(&is_stub, 0, sizeof(is_stub));
is_stub.memory = padev->memory;
- set_nonclient_dev_color(&devc_stub, 1);
- params.rule = gx_rule_winding_number;
- params.adjust.x = params.adjust.y = 0;
- params.flatness = fixed2float(max(bbox.q.x - bbox.p.x, bbox.q.y - bbox.p.y)) / 100.0;
-
- for (h.transpose = 0; h.transpose < 2; h.transpose++) {
- h.midx = (padev->xmin + padev->xmax) / 2;
- if (h.transpose)
- transpose_path(path);
- gx_san_begin(padev);
- code = dev_proc(padev, fill_path)((gx_device *)padev,
- &is_stub, path, &params, &devc_stub, NULL);
- gx_san_end(padev);
- if (code >= 0)
- code = gx_san_generate_stems(padev, OVERALL_HINT && h.transpose,
- &h, stem_hint_handler);
- if (h.transpose)
- transpose_path(path);
- if (code < 0)
- return code;
- }
-
- /* fixme : Storing hints permanently would be useful.
- Note that if (gftt & 1), the outline and hints are already scaled.
- */
- code = path_to_hinter(&h.super, path);
- if (code < 0)
- return code;
- code = gx_path_new(path);
- if (code < 0)
- return code;
- code = t1_hinter__endglyph(&h.super);
+ set_nonclient_dev_color(&devc_stub, 1);
+ params.rule = gx_rule_winding_number;
+ params.adjust.x = params.adjust.y = 0;
+ params.flatness = fixed2float(max(bbox.q.x - bbox.p.x, bbox.q.y - bbox.p.y)) / 100.0;
+
+ for (h.transpose = 0; h.transpose < 2; h.transpose++) {
+ h.midx = (padev->xmin + padev->xmax) / 2;
+ if (h.transpose)
+ transpose_path(path);
+ gx_san_begin(padev);
+ code = dev_proc(padev, fill_path)((gx_device *)padev,
+ &is_stub, path, &params, &devc_stub, NULL);
+ gx_san_end(padev);
+ if (code >= 0)
+ code = gx_san_generate_stems(padev, OVERALL_HINT && h.transpose,
+ &h, stem_hint_handler);
+ if (h.transpose)
+ transpose_path(path);
+ if (code < 0)
+ return code;
+ }
+
+ /* fixme : Storing hints permanently would be useful.
+ Note that if (gftt & 1), the outline and hints are already scaled.
+ */
+ code = path_to_hinter(&h.super, path);
+ if (code < 0)
+ return code;
+ code = gx_path_new(path);
+ if (code < 0)
+ return code;
+ code = t1_hinter__endglyph(&h.super);
} else {
- ttfOutliner__DrawGlyphOutline(o);
- if (e->error)
- return e->error;
+ ttfOutliner__DrawGlyphOutline(o);
+ if (e->error)
+ return e->error;
}
return code;
}
-int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index,
- const gs_matrix *m, const gs_log2_scale_point *pscale,
- gx_path *path, bool design_grid)
+int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index,
+ const gs_matrix *m, const gs_log2_scale_point *pscale,
+ gx_path *path, bool design_grid)
{
gx_ttfExport e;
ttfOutliner o;
@@ -752,10 +751,10 @@ int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int gly
uint gftt = gs_currentgridfittt(pfont->dir);
bool ttin = (gftt & 1);
/* gs_currentgridfittt values (binary) :
- 00 - no grid fitting;
- 01 - Grid fit with TT interpreter; On failure warn and render unhinted.
- 10 - Interpret in the design grid and then autohint.
- 11 - Grid fit with TT interpreter; On failure render autohinted.
+ 00 - no grid fitting;
+ 01 - Grid fit with TT interpreter; On failure warn and render unhinted.
+ 10 - Interpret in the design grid and then autohint.
+ 11 - Grid fit with TT interpreter; On failure render autohinted.
*/
bool auth = (gftt & 2);
@@ -783,35 +782,34 @@ int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int gly
gx_ttfReader__Reset(r);
ttfOutliner__init(&o, ttf, &r->super, &e.super, true, false, pfont->WMode != 0);
switch(ttfOutliner__Outline(&o, glyph_index, subpix_origin.x, subpix_origin.y, &m1)) {
- case fBadInstruction:
- WarnBadInstruction(pfont, glyph_index);
- goto recover;
- case fPatented:
- /* The returned outline did not apply a bytecode (it is not grid-fitted). */
- if (!auth)
- WarnPatented(pfont, ttf, "Some glyphs of the font");
- recover :
- if (!design_grid && auth)
- return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o);
- /* Falls through. */
- case fNoError:
- if (!design_grid && !ttin && auth)
- return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o);
- ttfOutliner__DrawGlyphOutline(&o);
- if (e.error)
- return e.error;
- return 0;
- case fMemoryError:
- return_error(gs_error_VMerror);
- case fUnimplemented:
- return_error(gs_error_unregistered);
- default:
- { int code = r->super.Error(&r->super);
-
- if (code < 0)
- return code;
- return_error(gs_error_invalidfont);
- }
+ case fBadInstruction:
+ WarnBadInstruction(pfont, glyph_index);
+ goto recover;
+ case fPatented:
+ /* The returned outline did not apply a bytecode (it is not grid-fitted). */
+ if (!auth)
+ WarnPatented(pfont, ttf, "Some glyphs of the font");
+ recover :
+ if (!design_grid && auth)
+ return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o);
+ /* Falls through. */
+ case fNoError:
+ if (!design_grid && !ttin && auth)
+ return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o);
+ ttfOutliner__DrawGlyphOutline(&o);
+ if (e.error)
+ return e.error;
+ return 0;
+ case fMemoryError:
+ return_error(gs_error_VMerror);
+ case fUnimplemented:
+ return_error(gs_error_unregistered);
+ default:
+ { int code = r->super.Error(&r->super);
+
+ if (code < 0)
+ return code;
+ return_error(gs_error_invalidfont);
+ }
}
}
-
diff --git a/gs/base/gxttfb.h b/gs/base/gxttfb.h
index 5e3e93323..dae5f2024 100644
--- a/gs/base/gxttfb.h
+++ b/gs/base/gxttfb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,13 +38,13 @@ struct gx_ttfReader_s {
gs_memory_t *memory;
gs_glyph_data_t glyph_data;
/* When TT interpreter is invoked, a font and the TT interpreter instance
- may use different memory allocators (local and global correspondingly).
- Since we don't want to change Free Type function prototypes,
- we place the gx_ttfReader instance into the global memory,
- to provide an access to it through TExecution_Context.
- Due to that, the fields 'pfont' and 'glyph_data' may contain pointers from global
- to local memory. They must be NULL when a garbager is invoked.
- We reset them whan the TT interpreter exits.
+ may use different memory allocators (local and global correspondingly).
+ Since we don't want to change Free Type function prototypes,
+ we place the gx_ttfReader instance into the global memory,
+ to provide an access to it through TExecution_Context.
+ Due to that, the fields 'pfont' and 'glyph_data' may contain pointers from global
+ to local memory. They must be NULL when a garbager is invoked.
+ We reset them whan the TT interpreter exits.
*/
};
@@ -54,10 +54,10 @@ void gx_ttfReader__set_font(gx_ttfReader *this, gs_font_type42 *pfont);
ttfFont *ttfFont__create(gs_font_dir *dir);
void ttfFont__destroy(ttfFont *this, gs_font_dir *dir);
int ttfFont__Open_aux(ttfFont *this, ttfInterpreter *tti, gx_ttfReader *r, gs_font_type42 *pfont,
- const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
- bool design_grid);
-int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index,
- const gs_matrix *m, const gs_log2_scale_point * pscale,
- gx_path *path, bool grid_fit);
+ const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale,
+ bool design_grid);
+int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index,
+ const gs_matrix *m, const gs_log2_scale_point * pscale,
+ gx_path *path, bool grid_fit);
#endif /* gxttfb_INCLUDED */
diff --git a/gs/base/gxtype1.c b/gs/base/gxtype1.c
index 2117be566..32e1ce4cf 100644
--- a/gs/base/gxtype1.c
+++ b/gs/base/gxtype1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,15 +50,15 @@ public_st_gs_font_type1();
/* Define the structure type for a Type 1 interpreter state. */
public_st_gs_type1_state();
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(gs_type1_state_enum_ptrs, gs_type1_state *pcis)
{
index -= 4;
if (index < pcis->ips_count * ST_GLYPH_DATA_NUM_PTRS)
- return ENUM_USING(st_glyph_data,
- &pcis->ipstack[index / ST_GLYPH_DATA_NUM_PTRS].cs_data,
- sizeof(pcis->ipstack[0].cs_data),
- index % ST_GLYPH_DATA_NUM_PTRS);
+ return ENUM_USING(st_glyph_data,
+ &pcis->ipstack[index / ST_GLYPH_DATA_NUM_PTRS].cs_data,
+ sizeof(pcis->ipstack[0].cs_data),
+ index % ST_GLYPH_DATA_NUM_PTRS);
return 0;
}
ENUM_PTR3(0, gs_type1_state, pfont, pis, path);
@@ -73,11 +73,11 @@ static RELOC_PTRS_WITH(gs_type1_state_reloc_ptrs, gs_type1_state *pcis)
RELOC_PTR(gs_type1_state, path);
RELOC_PTR(gs_type1_state, callback_data);
for (i = 0; i < pcis->ips_count; i++) {
- ip_state_t *ipsp = &pcis->ipstack[i];
- int diff = ipsp->ip - ipsp->cs_data.bits.data;
+ ip_state_t *ipsp = &pcis->ipstack[i];
+ int diff = ipsp->ip - ipsp->cs_data.bits.data;
- RELOC_USING(st_glyph_data, &ipsp->cs_data, sizeof(ipsp->cs_data));
- ipsp->ip = ipsp->cs_data.bits.data + diff;
+ RELOC_USING(st_glyph_data, &ipsp->cs_data, sizeof(ipsp->cs_data));
+ ipsp->ip = ipsp->cs_data.bits.data + diff;
}
} RELOC_PTRS_END
@@ -87,7 +87,6 @@ static RELOC_PTRS_WITH(gs_type1_state_reloc_ptrs, gs_type1_state *pcis)
*/
const char gx_extendeg_glyph_name_separator[] = "~GS~";
-
/* ------ Interpreter services ------ */
#define s (*ps)
@@ -96,15 +95,15 @@ const char gx_extendeg_glyph_name_separator[] = "~GS~";
/* The caller must supply a string to the first call of gs_type1_interpret. */
int
gs_type1_interp_init(register gs_type1_state * pcis, gs_imager_state * pis,
- gx_path * ppath, const gs_log2_scale_point * pscale,
+ gx_path * ppath, const gs_log2_scale_point * pscale,
const gs_log2_scale_point * psubpixels, bool no_grid_fitting,
- int paint_type, gs_font_type1 * pfont)
+ int paint_type, gs_font_type1 * pfont)
{
static const gs_log2_scale_point no_scale = {0, 0};
const gs_log2_scale_point *plog2_scale =
- (FORCE_HINTS_TO_BIG_PIXELS && pscale != NULL ? pscale : &no_scale);
+ (FORCE_HINTS_TO_BIG_PIXELS && pscale != NULL ? pscale : &no_scale);
const gs_log2_scale_point *plog2_subpixels =
- (FORCE_HINTS_TO_BIG_PIXELS ? (psubpixels != NULL ? psubpixels : plog2_scale) : &no_scale);
+ (FORCE_HINTS_TO_BIG_PIXELS ? (psubpixels != NULL ? psubpixels : plog2_scale) : &no_scale);
if_debug0('1', "[1]gs_type1_interp_init\n");
pcis->pfont = pfont;
@@ -141,7 +140,6 @@ gs_type1_set_callback_data(gs_type1_state *pcis, void *callback_data)
pcis->callback_data = callback_data;
}
-
/* Preset the left side bearing and/or width. */
void
gs_type1_set_lsb(gs_type1_state * pcis, const gs_point * psbpt)
@@ -179,14 +177,12 @@ gs_type1_finish_init(gs_type1_state * pcis)
pcis->flex_count = flex_max; /* not in Flex */
pcis->vs_offset.x = pcis->vs_offset.y = 0;
-
/* Compute the flatness needed for accurate rendering. */
pcis->flatness = gs_char_flatness(pis, 0.001);
pcis->init_done = 1;
}
-
#undef s
/* Record the side bearing and character width. */
@@ -194,14 +190,14 @@ int
gs_type1_sbw(gs_type1_state * pcis, fixed lsbx, fixed lsby, fixed wx, fixed wy)
{
if (!pcis->sb_set)
- pcis->lsb.x = lsbx, pcis->lsb.y = lsby,
- pcis->sb_set = true; /* needed for accented chars */
+ pcis->lsb.x = lsbx, pcis->lsb.y = lsby,
+ pcis->sb_set = true; /* needed for accented chars */
if (!pcis->width_set)
- pcis->width.x = wx, pcis->width.y = wy,
- pcis->width_set = true;
+ pcis->width.x = wx, pcis->width.y = wy,
+ pcis->width_set = true;
if_debug4('1', "[1]sb=(%g,%g) w=(%g,%g)\n",
- fixed2float(pcis->lsb.x), fixed2float(pcis->lsb.y),
- fixed2float(pcis->width.x), fixed2float(pcis->width.y));
+ fixed2float(pcis->lsb.x), fixed2float(pcis->lsb.y),
+ fixed2float(pcis->width.x), fixed2float(pcis->width.y));
return 0;
}
@@ -218,17 +214,17 @@ gs_type1_blend(gs_type1_state *pcis, fixed *csp, int num_results)
fixed *deltas;
if (num_values < num_results ||
- num_values % num_results != 0
- )
- return_error(gs_error_invalidfont);
+ num_values % num_results != 0
+ )
+ return_error(gs_error_invalidfont);
base = csp - 1 - num_values;
deltas = base + num_results - 1;
for (j = 0; j < num_results;
- j++, base++, deltas += k1
- )
- for (i = 1; i <= k1; i++)
- *base += (fixed)(deltas[i] *
- pdata->WeightVector.values[i]);
+ j++, base++, deltas += k1
+ )
+ for (i = 1; i <= k1; i++)
+ *base += (fixed)(deltas[i] *
+ pdata->WeightVector.values[i]);
pcis->ignore_pops = num_results;
return num_values - num_results + 2;
}
@@ -240,7 +236,7 @@ gs_type1_blend(gs_type1_state *pcis, fixed *csp, int num_results)
*/
int
gs_type1_seac(gs_type1_state * pcis, const fixed * cstack, fixed asb,
- ip_state_t * ipsp)
+ ip_state_t * ipsp)
{
gs_font_type1 *pfont = pcis->pfont;
gs_glyph_data_t bgdata;
@@ -256,9 +252,9 @@ gs_type1_seac(gs_type1_state * pcis, const fixed * cstack, fixed asb,
pcis->os_count = 0; /* clear */
/* Ask the caller to provide the base character's CharString. */
code = pfont->data.procs.seac_data
- (pfont, fixed2int_var(cstack[2]), NULL, &gstr, &bgdata);
+ (pfont, fixed2int_var(cstack[2]), NULL, &gstr, &bgdata);
if (code < 0)
- return code;
+ return code;
/* Continue with the supplied string. */
ipsp->cs_data = bgdata;
return 0;
@@ -277,56 +273,56 @@ gs_type1_endchar(gs_type1_state * pcis)
gs_imager_state *pis = pcis->pis;
if (pcis->seac_accent >= 0) { /* We just finished the base character of a seac. */
- /* Do the accent. */
- gs_font_type1 *pfont = pcis->pfont;
- gs_glyph_data_t agdata;
- int achar = pcis->seac_accent;
- gs_const_string gstr;
- int code;
-
- agdata.memory = pfont->memory;
- pcis->seac_accent = -1;
- /* Reset the coordinate system origin */
- pcis->asb_diff = pcis->asb - pcis->compound_lsb.x;
- pcis->adxy = pcis->save_adxy;
- pcis->os_count = 0; /* clear */
- /* Clear the ipstack, in case the base character */
- /* ended inside a subroutine. */
- pcis->ips_count = 1;
- /* Ask the caller to provide the accent's CharString. */
- code = pfont->data.procs.seac_data(pfont, achar, NULL, &gstr, &agdata);
- if (code == gs_error_undefined) {
- /*
- * The font is missing the accent's CharString (due to
- * bad subsetting). Just end drawing here without error.
- * This is like Acrobat Reader behaves.
- */
- char buf0[gs_font_name_max + 1], buf1[30];
- int l0 = min(pcis->pfont->font_name.size, sizeof(buf0) - 1);
- int l1 = min(gstr.size, sizeof(buf1) - 1);
-
- memcpy(buf0, pcis->pfont->font_name.chars, l0);
- buf0[l0] = 0;
- memcpy(buf1, gstr.data, l1);
- buf1[l1] = 0;
+ /* Do the accent. */
+ gs_font_type1 *pfont = pcis->pfont;
+ gs_glyph_data_t agdata;
+ int achar = pcis->seac_accent;
+ gs_const_string gstr;
+ int code;
+
+ agdata.memory = pfont->memory;
+ pcis->seac_accent = -1;
+ /* Reset the coordinate system origin */
+ pcis->asb_diff = pcis->asb - pcis->compound_lsb.x;
+ pcis->adxy = pcis->save_adxy;
+ pcis->os_count = 0; /* clear */
+ /* Clear the ipstack, in case the base character */
+ /* ended inside a subroutine. */
+ pcis->ips_count = 1;
+ /* Ask the caller to provide the accent's CharString. */
+ code = pfont->data.procs.seac_data(pfont, achar, NULL, &gstr, &agdata);
+ if (code == gs_error_undefined) {
+ /*
+ * The font is missing the accent's CharString (due to
+ * bad subsetting). Just end drawing here without error.
+ * This is like Acrobat Reader behaves.
+ */
+ char buf0[gs_font_name_max + 1], buf1[30];
+ int l0 = min(pcis->pfont->font_name.size, sizeof(buf0) - 1);
+ int l1 = min(gstr.size, sizeof(buf1) - 1);
+
+ memcpy(buf0, pcis->pfont->font_name.chars, l0);
+ buf0[l0] = 0;
+ memcpy(buf1, gstr.data, l1);
+ buf1[l1] = 0;
emprintf2(pfont->memory,
"The font '%s' misses the glyph '%s' . Continue skipping the glyph.",
buf0,
buf1);
- return 0;
- }
- if (code < 0)
- return code;
- /* Continue with the supplied string. */
- pcis->ips_count = 1;
- pcis->ipstack[0].cs_data = agdata;
- return 1;
+ return 0;
+ }
+ if (code < 0)
+ return code;
+ /* Continue with the supplied string. */
+ pcis->ips_count = 1;
+ pcis->ipstack[0].cs_data = agdata;
+ return 1;
}
if (pcis->pfont->PaintType == 0)
- pis->fill_adjust.x = pis->fill_adjust.y = -1;
+ pis->fill_adjust.x = pis->fill_adjust.y = -1;
/* Set the flatness for curve rendering. */
if (!pcis->no_grid_fitting)
- gs_imager_setflat(pis, pcis->flatness);
+ gs_imager_setflat(pis, pcis->flatness);
return 0;
}
@@ -349,7 +345,7 @@ type1_cis_get_metrics(const gs_type1_state * pcis, double psbw[4])
*/
int
gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
- const gs_glyph_data_t *pgd, gs_char *chars)
+ const gs_glyph_data_t *pgd, gs_char *chars)
{
gs_type1_data *const pdata = &pfont->data;
/*
@@ -374,158 +370,157 @@ gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
crypt_state state;
int c, hhints = 0, vhints = 0;
int code;
-
+
CLEAR_CSTACK(cstack, csp);
cip = pgd->bits.data;
call:
state = crypt_charstring_seed;
if (encrypted) {
- int skip = pdata->lenIV;
+ int skip = pdata->lenIV;
- /* Skip initial random bytes */
- for (; skip > 0; ++cip, --skip)
- decrypt_skip_next(*cip, state);
+ /* Skip initial random bytes */
+ for (; skip > 0; ++cip, --skip)
+ decrypt_skip_next(*cip, state);
}
top:
for (;;) {
- uint c0 = *cip++;
-
- charstring_next(c0, state, c, encrypted);
- if (c >= c_num1) {
- /* This is a number, decode it and push it on the stack. */
- if (c < c_pos2_0) { /* 1-byte number */
- decode_push_num1(csp, cstack, c);
- } else if (c < cx_num4) { /* 2-byte number */
- decode_push_num2(csp, cstack, c, cip, state, encrypted);
- } else if (c == cx_num4) { /* 4-byte number */
- long lw;
-
- decode_num4(lw, cip, state, encrypted);
- CS_CHECK_PUSH(csp, cstack);
- *++csp = int2fixed(lw);
- } else /* not possible */
- return_error(gs_error_invalidfont);
- continue;
- }
+ uint c0 = *cip++;
+
+ charstring_next(c0, state, c, encrypted);
+ if (c >= c_num1) {
+ /* This is a number, decode it and push it on the stack. */
+ if (c < c_pos2_0) { /* 1-byte number */
+ decode_push_num1(csp, cstack, c);
+ } else if (c < cx_num4) { /* 2-byte number */
+ decode_push_num2(csp, cstack, c, cip, state, encrypted);
+ } else if (c == cx_num4) { /* 4-byte number */
+ long lw;
+
+ decode_num4(lw, cip, state, encrypted);
+ CS_CHECK_PUSH(csp, cstack);
+ *++csp = int2fixed(lw);
+ } else /* not possible */
+ return_error(gs_error_invalidfont);
+ continue;
+ }
#define cnext CLEAR_CSTACK(cstack, csp); goto top
- switch ((char_command) c) {
- default:
- cnext;
- goto out;
- case c2_shortint:
- cip += 2;
- break;
- case c2_hstemhm:
- hhints += ((csp - cstack) + 1) / 2;
- cnext;
- break;
- case c2_vstemhm:
- vhints += ((csp - cstack) + 1) / 2;
- cnext;
- break;
- case c2_cntrmask:
- vhints += ((csp - cstack) + 1) / 2;
- cip += (vhints + hhints + 7) / 8;
- cnext;
- break;
- case c2_hintmask:
- {
- if (csp > cstack)
- vhints += ((csp - cstack) + 1) / 2;
- cip += (vhints + hhints + 7) / 8;
- cnext;
- }
- break;
- case c2_callgsubr:
- c = fixed2int_var(*csp) + pdata->gsubrNumberBias;
- code = pdata->procs.subr_data
- (pfont, c, true, &ipsp[1].cs_data);
- if (code < 0)
- return_error(code);
- --csp;
- ipsp->ip = cip, ipsp->dstate = state;
- ++ipsp;
- cip = ipsp->cs_data.bits.data;
- goto call;
- case c_callsubr:
- c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
- code = pdata->procs.subr_data
- (pfont, c, false, &ipsp[1].cs_data);
- if (code < 0)
- return_error(code);
- --csp;
- ipsp->ip = cip, ipsp->dstate = state;
- ++ipsp;
- cip = ipsp->cs_data.bits.data;
- goto call;
- case c_return:
- gs_glyph_data_free(&ipsp->cs_data, "gs_type1_piece_codes");
- --ipsp;
- if (ipsp < ipstack)
- return (gs_note_error(gs_error_invalidfont));
- cip = ipsp->ip, state = ipsp->dstate;
- goto top;
- case cx_hstem:
- hhints += ((csp - cstack) + 1) / 2;
- cnext;
- break;
- case cx_vstem:
- vhints += ((csp - cstack) + 1) / 2;
- cnext;
- break;
- case c1_hsbw:
- cnext;
- case cx_endchar:
- if (csp < cstack + 3)
- goto out; /* not seac */
- do_seac:
- /* This is the payoff for all this code! */
- chars[0] = fixed2int(csp[-1]);
- chars[1] = fixed2int(csp[0]);
- return 1;
- case cx_escape:
- charstring_next(*cip, state, c, encrypted);
- ++cip;
- switch ((char1_extended_command) c) {
- default:
- goto out;
- case ce1_vstem3:
- case ce1_hstem3:
- case ce1_sbw:
- cnext;
- case ce1_pop:
- /*
- * pop must do nothing, since it is used after
- * subr# 1 3 callothersubr.
- */
- goto top;
- case ce1_seac:
- goto do_seac;
- case ce1_callothersubr:
- switch (fixed2int_var(*csp)) {
- default:
- goto out;
- case 3:
- csp -= 2;
- goto top;
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- cnext;
- }
- }
- }
+ switch ((char_command) c) {
+ default:
+ cnext;
+ goto out;
+ case c2_shortint:
+ cip += 2;
+ break;
+ case c2_hstemhm:
+ hhints += ((csp - cstack) + 1) / 2;
+ cnext;
+ break;
+ case c2_vstemhm:
+ vhints += ((csp - cstack) + 1) / 2;
+ cnext;
+ break;
+ case c2_cntrmask:
+ vhints += ((csp - cstack) + 1) / 2;
+ cip += (vhints + hhints + 7) / 8;
+ cnext;
+ break;
+ case c2_hintmask:
+ {
+ if (csp > cstack)
+ vhints += ((csp - cstack) + 1) / 2;
+ cip += (vhints + hhints + 7) / 8;
+ cnext;
+ }
+ break;
+ case c2_callgsubr:
+ c = fixed2int_var(*csp) + pdata->gsubrNumberBias;
+ code = pdata->procs.subr_data
+ (pfont, c, true, &ipsp[1].cs_data);
+ if (code < 0)
+ return_error(code);
+ --csp;
+ ipsp->ip = cip, ipsp->dstate = state;
+ ++ipsp;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ case c_callsubr:
+ c = fixed2int_var(*csp) + pdata->subroutineNumberBias;
+ code = pdata->procs.subr_data
+ (pfont, c, false, &ipsp[1].cs_data);
+ if (code < 0)
+ return_error(code);
+ --csp;
+ ipsp->ip = cip, ipsp->dstate = state;
+ ++ipsp;
+ cip = ipsp->cs_data.bits.data;
+ goto call;
+ case c_return:
+ gs_glyph_data_free(&ipsp->cs_data, "gs_type1_piece_codes");
+ --ipsp;
+ if (ipsp < ipstack)
+ return (gs_note_error(gs_error_invalidfont));
+ cip = ipsp->ip, state = ipsp->dstate;
+ goto top;
+ case cx_hstem:
+ hhints += ((csp - cstack) + 1) / 2;
+ cnext;
+ break;
+ case cx_vstem:
+ vhints += ((csp - cstack) + 1) / 2;
+ cnext;
+ break;
+ case c1_hsbw:
+ cnext;
+ case cx_endchar:
+ if (csp < cstack + 3)
+ goto out; /* not seac */
+ do_seac:
+ /* This is the payoff for all this code! */
+ chars[0] = fixed2int(csp[-1]);
+ chars[1] = fixed2int(csp[0]);
+ return 1;
+ case cx_escape:
+ charstring_next(*cip, state, c, encrypted);
+ ++cip;
+ switch ((char1_extended_command) c) {
+ default:
+ goto out;
+ case ce1_vstem3:
+ case ce1_hstem3:
+ case ce1_sbw:
+ cnext;
+ case ce1_pop:
+ /*
+ * pop must do nothing, since it is used after
+ * subr# 1 3 callothersubr.
+ */
+ goto top;
+ case ce1_seac:
+ goto do_seac;
+ case ce1_callothersubr:
+ switch (fixed2int_var(*csp)) {
+ default:
+ goto out;
+ case 3:
+ csp -= 2;
+ goto top;
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ case 18:
+ cnext;
+ }
+ }
+ }
#undef cnext
}
out:
return 0;
}
-
/*
* Get PIECES and/or NUM_PIECES of a Type 1 glyph. Sets info->num_pieces
* and/or stores into info->pieces. Updates info->members. This is a
@@ -533,20 +528,20 @@ gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
*/
static int
gs_type1_glyph_pieces(gs_font_type1 *pfont, const gs_glyph_data_t *pgd,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
gs_char chars[2];
gs_glyph glyphs[2];
int code = gs_type1_piece_codes(pfont, pgd, chars);
gs_type1_data *const pdata = &pfont->data;
gs_glyph *pieces =
- (members & GLYPH_INFO_PIECES ? info->pieces : glyphs);
+ (members & GLYPH_INFO_PIECES ? info->pieces : glyphs);
gs_const_string gstr;
int acode, bcode;
info->num_pieces = 0; /* default */
if (code <= 0) /* no seac, possibly error */
- return code;
+ return code;
bcode = pdata->procs.seac_data(pfont, chars[0], &pieces[0], &gstr, NULL);
acode = pdata->procs.seac_data(pfont, chars[1], &pieces[1], &gstr, NULL);
code = (bcode < 0 ? bcode : acode);
@@ -556,7 +551,7 @@ gs_type1_glyph_pieces(gs_font_type1 *pfont, const gs_glyph_data_t *pgd,
int
gs_type1_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
gs_font_type1 *const pfont = (gs_font_type1 *)font;
gs_type1_data *const pdata = &pfont->data;
@@ -564,80 +559,80 @@ gs_type1_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
int piece_members = members & (GLYPH_INFO_NUM_PIECES | GLYPH_INFO_PIECES);
int width_members = (members & ((GLYPH_INFO_WIDTH0 << wmode) | (GLYPH_INFO_VVECTOR0 << wmode)));
int default_members = members & ~(piece_members | GLYPH_INFO_WIDTHS |
- GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1 |
- GLYPH_INFO_OUTLINE_WIDTHS);
+ GLYPH_INFO_VVECTOR0 | GLYPH_INFO_VVECTOR1 |
+ GLYPH_INFO_OUTLINE_WIDTHS);
int code = 0;
gs_glyph_data_t gdata;
if (default_members) {
- code = gs_default_glyph_info(font, glyph, pmat, default_members, info);
+ code = gs_default_glyph_info(font, glyph, pmat, default_members, info);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
} else
- info->members = 0;
+ info->members = 0;
if (default_members == members)
- return code; /* all done */
+ return code; /* all done */
gdata.memory = pfont->memory;
if ((code = pdata->procs.glyph_data(pfont, glyph, &gdata)) < 0)
- return code; /* non-existent glyph */
+ return code; /* non-existent glyph */
if (piece_members) {
- code = gs_type1_glyph_pieces(pfont, &gdata, members, info);
- if (code < 0)
- return code;
- info->members |= piece_members;
+ code = gs_type1_glyph_pieces(pfont, &gdata, members, info);
+ if (code < 0)
+ return code;
+ info->members |= piece_members;
}
if (width_members) {
- gx_path path;
- /*
- * Interpret the CharString until we get to the [h]sbw.
- */
- gs_imager_state gis;
- gs_type1_state cis;
- int value;
-
- /* Initialize just enough of the imager state. */
- if (pmat)
- gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
- else {
- gs_matrix imat;
-
- gs_make_identity(&imat);
- gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
- }
- gis.flatness = 0;
- code = gs_type1_interp_init(&cis, &gis, NULL /* no path needed */,
- NULL, NULL, true, 0, pfont);
- if (code < 0)
- return code;
- cis.no_grid_fitting = true;
- gx_path_init_bbox_accumulator(&path);
- cis.path = &path;
- code = pdata->interpret(&cis, &gdata, &value);
- switch (code) {
- case 0: /* done with no [h]sbw, error */
- /* Adobe interpreters ignore the error! */
- info->width[wmode].x = 0;
- info->width[wmode].y = 0;
- info->v.x = 0;
- info->v.y = 0;
- break;
- default: /* code < 0, error */
- return code;
- case type1_result_callothersubr: /* unknown OtherSubr */
- return_error(gs_error_rangecheck); /* can't handle it */
- case type1_result_sbw:
- info->width[wmode].x = fixed2float(cis.width.x);
- info->width[wmode].y = fixed2float(cis.width.y);
- info->v.x = fixed2float(cis.lsb.x);
- info->v.y = fixed2float(cis.lsb.y);
- break;
- }
- info->members |= width_members | (GLYPH_INFO_VVECTOR0 << wmode);
+ gx_path path;
+ /*
+ * Interpret the CharString until we get to the [h]sbw.
+ */
+ gs_imager_state gis;
+ gs_type1_state cis;
+ int value;
+
+ /* Initialize just enough of the imager state. */
+ if (pmat)
+ gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
+ else {
+ gs_matrix imat;
+
+ gs_make_identity(&imat);
+ gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
+ }
+ gis.flatness = 0;
+ code = gs_type1_interp_init(&cis, &gis, NULL /* no path needed */,
+ NULL, NULL, true, 0, pfont);
+ if (code < 0)
+ return code;
+ cis.no_grid_fitting = true;
+ gx_path_init_bbox_accumulator(&path);
+ cis.path = &path;
+ code = pdata->interpret(&cis, &gdata, &value);
+ switch (code) {
+ case 0: /* done with no [h]sbw, error */
+ /* Adobe interpreters ignore the error! */
+ info->width[wmode].x = 0;
+ info->width[wmode].y = 0;
+ info->v.x = 0;
+ info->v.y = 0;
+ break;
+ default: /* code < 0, error */
+ return code;
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return_error(gs_error_rangecheck); /* can't handle it */
+ case type1_result_sbw:
+ info->width[wmode].x = fixed2float(cis.width.x);
+ info->width[wmode].y = fixed2float(cis.width.y);
+ info->v.x = fixed2float(cis.lsb.x);
+ info->v.y = fixed2float(cis.lsb.y);
+ break;
+ }
+ info->members |= width_members | (GLYPH_INFO_VVECTOR0 << wmode);
}
gs_glyph_data_free(&gdata, "gs_type1_glyph_info");
@@ -649,10 +644,10 @@ const gs_font_base *
gs_font_parent(const gs_font_base *pbfont)
{
if (pbfont->FontType == ft_encrypted || pbfont->FontType == ft_encrypted2) {
- const gs_font_type1 *pfont1 = (const gs_font_type1 *)pbfont;
+ const gs_font_type1 *pfont1 = (const gs_font_type1 *)pbfont;
- if (pfont1->data.parent != NULL)
- return pfont1->data.parent;
+ if (pfont1->data.parent != NULL)
+ return pfont1->data.parent;
}
return pbfont;
}
diff --git a/gs/base/gxtype1.h b/gs/base/gxtype1.h
index 22721dd2f..7f569c008 100644
--- a/gs/base/gxtype1.h
+++ b/gs/base/gxtype1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,6 @@ typedef struct point_scale_s {
#define scaled_rounded(v, pps)\
(((v) + (pps)->half) & -(pps)->unit)
-
/*
* The Type 2 charstring documentation says that the total number of hints
* is limited to 96.
@@ -63,7 +62,7 @@ typedef struct {
const byte *ip;
crypt_state dstate;
gs_glyph_data_t cs_data; /* original CharString or Subr, */
- /* for GC */
+ /* for GC */
} ip_state_t;
/* Get the next byte from a CharString. It may or may not be encrypted. */
@@ -71,7 +70,7 @@ typedef struct {
(encrypted ? decrypt_this(ch, state) : ch)
#define charstring_next(ch, state, chvar, encrypted)\
(encrypted ? (chvar = decrypt_this(ch, state),\
- decrypt_skip_next(ch, state)) :\
+ decrypt_skip_next(ch, state)) :\
(chvar = ch))
#define charstring_skip_next(ch, state, encrypted)\
(encrypted ? decrypt_skip_next(ch, state) : 0)
@@ -109,7 +108,7 @@ struct gs_type1_state_s {
ip_state_t ipstack[ipstack_size + 1]; /* control stack */
int ips_count; /* # of occupied entries */
int init_done; /* -1 if not done & not needed, */
- /* 0 if not done & needed, 1 if done */
+ /* 0 if not done & needed, 1 if done */
bool sb_set; /* true if lsb is preset */
bool width_set; /* true if width is set (for seac parts) */
bool seac_flag; /* true if executing the accent */
@@ -119,30 +118,30 @@ struct gs_type1_state_s {
gs_fixed_point width; /* character width (design coords) */
int seac_accent; /* accent character code for seac, or -1 */
fixed asb; /* the asb parameter of seac */
- gs_fixed_point compound_lsb;/* lsb of the compound character
- (i.e. of the accented character
- defined with seac). */
+ gs_fixed_point compound_lsb;/* lsb of the compound character
+ (i.e. of the accented character
+ defined with seac). */
gs_fixed_point save_adxy; /* passes seac adx/ady across the base character. */
fixed asb_diff; /* asb - compound_lsb.x, */
- /* needed to adjust Flex endpoint
- when processing the accent character;
- Zero when processing the base character. */
+ /* needed to adjust Flex endpoint
+ when processing the accent character;
+ Zero when processing the base character. */
gs_fixed_point adxy; /* seac accent displacement,
- needed to adjust currentpoint
- when processing the accent character;
- Zero when processing the base character. */
+ needed to adjust currentpoint
+ when processing the accent character;
+ Zero when processing the base character. */
fixed base_lsb; /* The lsb of the base character for 'seac'. */
int flex_path_state_flags; /* record whether path was open */
- /* at start of Flex section */
+ /* at start of Flex section */
gs_fixed_point origin_offset; /* Origin offset due to replaced metrics. */
#define flex_max 8
int flex_count;
int ignore_pops; /* # of pops to ignore (after */
- /* a known othersubr call) */
+ /* a known othersubr call) */
/* The following are set dynamically. */
gs_fixed_point vs_offset; /* device space offset for centering */
- /* middle stem of vstem3 */
- /* of subpath */
+ /* middle stem of vstem3 */
+ /* of subpath */
fixed transient_array[32]; /* Type 2 transient array, */
/* will be variable-size someday */
};
@@ -195,7 +194,7 @@ typedef fixed *cs_ptr;
int cn = charstring_this(c2, state, encrypted);\
\
var = (c < c_neg2_0 ? c_value_pos2(c, 0) + cn :\
- c_value_neg2(c, 0) - cn);\
+ c_value_neg2(c, 0) - cn);\
charstring_skip_next(c2, state, encrypted);\
END
#define decode_push_num2(csp, cstack, c, cip, state, encrypted)\
@@ -233,7 +232,7 @@ typedef fixed *cs_ptr;
for ( i = 4; --i >= 0; )\
{ charstring_next(*cip, state, c4, encrypted);\
lw = (lw << 8) + c4;\
- cip++;\
+ cip++;\
}\
sign_extend_num4(lw);\
END
@@ -245,13 +244,13 @@ int gs_type1_check_float(crypt_state *state, bool encrypted, const byte **cip, c
void gs_type1_finish_init(gs_type1_state * pcis);
int gs_type1_sbw(gs_type1_state * pcis, fixed sbx, fixed sby,
- fixed wx, fixed wy);
+ fixed wx, fixed wy);
/* blend returns the number of values to pop. */
int gs_type1_blend(gs_type1_state *pcis, fixed *csp, int num_results);
int gs_type1_seac(gs_type1_state * pcis, const fixed * cstack,
- fixed asb_diff, ip_state_t * ipsp);
+ fixed asb_diff, ip_state_t * ipsp);
int gs_type1_endchar(gs_type1_state * pcis);
diff --git a/gs/base/gxwts.c b/gs/base/gxwts.c
index 7752c20fc..f8be9d11a 100644
--- a/gs/base/gxwts.c
+++ b/gs/base/gxwts.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -80,7 +80,7 @@ mul_shr_16 (int a, int b)
#if 0
static int
wts_get_samples_rat(const wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples)
+ int *pcellx, int *pcelly, int *p_nsamples)
{
int d = y / ws->cell_height;
int r = y % ws->cell_height;
@@ -98,7 +98,7 @@ wts_get_samples_rat(const wts_screen_t *ws, int x, int y,
/* Implementation of wts_get_samples for Screen J, with cache. */
static int
wts_get_samples_j(wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples)
+ int *pcellx, int *pcelly, int *p_nsamples)
{
int x_ix, y_ix;
int nsamples;
@@ -107,47 +107,47 @@ wts_get_samples_j(wts_screen_t *ws, int x, int y,
wts_j_cache_el *ycache = &wsj->ycache[y & (WTS_CACHE_SIZE_Y - 1)];
if (xcache->tag != x || (x & 7)) {
- double pad = (wsj->pa) * (1.0 / (1 << 16));
- double pbd = (wsj->pb) * (1.0 / (1 << 16));
- double afrac = x * pad;
- double bfrac = x * pbd;
- int acount = (int)floor(afrac);
- int bcount = (int)floor(bfrac);
- int nsa = (int)ceil((acount + 1 - afrac) / pad);
- int nsb = (int)ceil((acount + 1 - afrac) / pad);
-
- xcache->x = x + acount * wsj->XA + bcount * wsj->XB;
- xcache->y = acount * wsj->YA + bcount * wsj->YB;
+ double pad = (wsj->pa) * (1.0 / (1 << 16));
+ double pbd = (wsj->pb) * (1.0 / (1 << 16));
+ double afrac = x * pad;
+ double bfrac = x * pbd;
+ int acount = (int)floor(afrac);
+ int bcount = (int)floor(bfrac);
+ int nsa = (int)ceil((acount + 1 - afrac) / pad);
+ int nsb = (int)ceil((acount + 1 - afrac) / pad);
+
+ xcache->x = x + acount * wsj->XA + bcount * wsj->XB;
+ xcache->y = acount * wsj->YA + bcount * wsj->YB;
#ifdef MOD_IS_SLOWER_THAN_BRANCH
- xcache->x += (xcache->y / ws->cell_height) * ws->cell_shift;
- xcache->y %= ws->cell_height;
+ xcache->x += (xcache->y / ws->cell_height) * ws->cell_shift;
+ xcache->y %= ws->cell_height;
#endif
- xcache->nsamples = min(nsa, nsb);
- xcache->tag = x;
+ xcache->nsamples = min(nsa, nsb);
+ xcache->tag = x;
}
x_ix = xcache->x;
y_ix = xcache->y;
nsamples = xcache->nsamples;
if (ycache->tag != y) {
- int ccount = mul_shr_16(y, wsj->pc);
- int dcount = mul_shr_16(y, wsj->pd);
+ int ccount = mul_shr_16(y, wsj->pc);
+ int dcount = mul_shr_16(y, wsj->pd);
- ycache->x = ccount * wsj->XC + dcount * wsj->XD;
- ycache->y = y + ccount * wsj->YC + dcount * wsj->YD;
+ ycache->x = ccount * wsj->XC + dcount * wsj->XD;
+ ycache->y = y + ccount * wsj->YC + dcount * wsj->YD;
#ifdef MOD_IS_SLOWER_THAN_BRANCH
- ycache->x += (ycache->y / ws->cell_height) * ws->cell_shift;
- ycache->y %= ws->cell_height;
+ ycache->x += (ycache->y / ws->cell_height) * ws->cell_shift;
+ ycache->y %= ws->cell_height;
#endif
- ycache->tag = y;
+ ycache->tag = y;
}
x_ix += ycache->x;
y_ix += ycache->y;
#ifdef MOD_IS_SLOWER_THAN_BRANCH
if (y_ix >= ws->cell_height) {
- x_ix += ws->cell_shift;
- y_ix -= ws->cell_height;
+ x_ix += ws->cell_shift;
+ y_ix -= ws->cell_height;
}
#else
x_ix += (y_ix / ws->cell_height) * ws->cell_shift;
@@ -165,7 +165,7 @@ wts_get_samples_j(wts_screen_t *ws, int x, int y,
/* Implementation of wts_get_samples for Screen J. */
static int
wts_get_samples_j(wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples)
+ int *pcellx, int *pcelly, int *p_nsamples)
{
const wts_screen_j_t *wsj = (const wts_screen_j_t *)ws;
/* int d = y / ws->cell_height; */
@@ -182,9 +182,9 @@ wts_get_samples_j(wts_screen_t *ws, int x, int y,
int nsamples;
x_ix += acount * wsj->XA + bcount * wsj->XB +
- ccount * wsj->XC + dcount * wsj->XD;
+ ccount * wsj->XC + dcount * wsj->XD;
y_ix += acount * wsj->YA + bcount * wsj->YB +
- ccount * wsj->YC + dcount * wsj->YD;
+ ccount * wsj->YC + dcount * wsj->YD;
x_ix += (y_ix / ws->cell_height) * ws->cell_shift;
x_ix %= ws->cell_width;
@@ -192,13 +192,13 @@ wts_get_samples_j(wts_screen_t *ws, int x, int y,
nsamples = ws->cell_width - x_ix;
if (floor (afrac + (nsamples - 1) * pad) > acount)
- nsamples = (int)ceil((acount + 1 - afrac) / pad);
+ nsamples = (int)ceil((acount + 1 - afrac) / pad);
if (floor (bfrac + (nsamples - 1) * pbd) > bcount)
- nsamples = (int)ceil((bcount + 1 - bfrac) / pbd);
+ nsamples = (int)ceil((bcount + 1 - bfrac) / pbd);
#if 0
printf("get_samples: (%d, %d) -> (%d, %d) %d (cc=%d)\n",
- x, y, x_ix, y_ix, nsamples, ccount);
+ x, y, x_ix, y_ix, nsamples, ccount);
#endif
*p_nsamples = nsamples;
*pcellx = x_ix;
@@ -216,15 +216,15 @@ wts_screen_h_offset(int x, double p1, int m1, int m2)
int this_width;
for (width_so_far = 0;; width_so_far += this_width) {
- running_p += p1;
- if (running_p >= 0.5) {
- this_width = m1;
- running_p -= 1;
- } else {
- this_width = m2;
- }
- if (width_so_far + this_width > x)
- break;
+ running_p += p1;
+ if (running_p >= 0.5) {
+ this_width = m1;
+ running_p -= 1;
+ } else {
+ this_width = m2;
+ }
+ if (width_so_far + this_width > x)
+ break;
}
return x - width_so_far + (this_width == m1 ? 0 : m1);
}
@@ -232,13 +232,13 @@ wts_screen_h_offset(int x, double p1, int m1, int m2)
/* Implementation of wts_get_samples for Screen H. */
static int
wts_get_samples_h(const wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples)
+ int *pcellx, int *pcelly, int *p_nsamples)
{
const wts_screen_h_t *wsh = (const wts_screen_h_t *)ws;
int x_ix = wts_screen_h_offset(x, wsh->px,
- wsh->x1, ws->cell_width - wsh->x1);
+ wsh->x1, ws->cell_width - wsh->x1);
int y_ix = wts_screen_h_offset(y, wsh->py,
- wsh->y1, ws->cell_height - wsh->y1);
+ wsh->y1, ws->cell_height - wsh->y1);
*p_nsamples = (x_ix >= wsh->x1 ? ws->cell_width : wsh->x1) - x_ix;
*pcellx = x_ix;
*pcelly = y_ix;
@@ -270,14 +270,14 @@ wts_get_samples_h(const wts_screen_t *ws, int x, int y,
**/
int
wts_get_samples(wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples)
+ int *pcellx, int *pcelly, int *p_nsamples)
{
if (ws->type == WTS_SCREEN_J)
- return wts_get_samples_j(ws, x, y, pcellx, pcelly, p_nsamples);
+ return wts_get_samples_j(ws, x, y, pcellx, pcelly, p_nsamples);
if (ws->type == WTS_SCREEN_H)
- return wts_get_samples_h(ws, x, y, pcellx, pcelly, p_nsamples);
+ return wts_get_samples_h(ws, x, y, pcellx, pcelly, p_nsamples);
else
- return -1;
+ return -1;
}
/* Device color methods follow. */
@@ -300,7 +300,7 @@ gx_dc_wts_get_dev_halftone(const gx_device_color * pdevc)
static int
gx_dc_wts_load(gx_device_color *pdevc, const gs_imager_state * pis,
- gx_device *ignore_dev, gs_color_select_t select)
+ gx_device *ignore_dev, gs_color_select_t select)
{
return 0;
}
@@ -329,40 +329,40 @@ gx_dc_wts_load(gx_device_color *pdevc, const gs_imager_state * pis,
**/
static int
wts_draw(wts_screen_t *ws, wts_screen_sample_t shade,
- byte *data, int data_raster,
- int x, int y, int w, int h)
+ byte *data, int data_raster,
+ int x, int y, int w, int h)
{
int xo, yo;
unsigned char *line_start = data;
for (yo = 0; yo < h; yo++) {
- unsigned char *line_ptr = line_start;
- int mask = 0x80;
- unsigned char b = 0;
- int imax;
-
- for (xo = 0; xo < w; xo += imax) {
- wts_screen_sample_t *samples;
- int n_samples, i;
- int cx, cy;
-
- wts_get_samples(ws, x + xo, y + yo, &cx, &cy, &n_samples);
- samples = ws->samples + cy * ws->cell_width + cx;
- imax = min(w - xo, n_samples);
- for (i = 0; i < imax; i++) {
- if (shade > samples[i])
- b |= mask;
- mask >>= 1;
- if (mask == 0) {
- *line_ptr++ = b;
- b = 0;
- mask = 0x80;
- }
- }
- }
- if (mask != 0x80)
- *line_ptr = b;
- line_start += data_raster;
+ unsigned char *line_ptr = line_start;
+ int mask = 0x80;
+ unsigned char b = 0;
+ int imax;
+
+ for (xo = 0; xo < w; xo += imax) {
+ wts_screen_sample_t *samples;
+ int n_samples, i;
+ int cx, cy;
+
+ wts_get_samples(ws, x + xo, y + yo, &cx, &cy, &n_samples);
+ samples = ws->samples + cy * ws->cell_width + cx;
+ imax = min(w - xo, n_samples);
+ for (i = 0; i < imax; i++) {
+ if (shade > samples[i])
+ b |= mask;
+ mask >>= 1;
+ if (mask == 0) {
+ *line_ptr++ = b;
+ b = 0;
+ mask = 0x80;
+ }
+ }
+ }
+ if (mask != 0x80)
+ *line_ptr = b;
+ line_start += data_raster;
}
return 0;
}
@@ -373,9 +373,9 @@ wts_draw(wts_screen_t *ws, wts_screen_sample_t shade,
**/
static int
gx_dc_wts_fill_rectangle_1(const gx_device_color *pdevc,
- int x, int y, int w, int h,
- gx_device *dev, gs_logical_operation_t lop,
- const gx_rop_source_t *source)
+ int x, int y, int w, int h,
+ gx_device *dev, gs_logical_operation_t lop,
+ const gx_rop_source_t *source)
{
/* gx_rop_source_t no_source; */
int tile_raster = ((w + 31) & -32) >> 3;
@@ -390,23 +390,23 @@ gx_dc_wts_fill_rectangle_1(const gx_device_color *pdevc,
int yph = pdevc->phase.y;
color0 = dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN ? 0 :
- pdevc->colors.wts.plane_vector[1];
+ pdevc->colors.wts.plane_vector[1];
color1 = pdevc->colors.wts.plane_vector[0];
tile_data = malloc(tile_size);
wts_draw(ws, shade, tile_data, tile_raster, x - xph, y - yph, w, h);
-
+
/* See gx_dc_ht_binary_fill_rectangle() for explanation. */
if (dev->color_info.depth > 1)
- lop &= ~lop_T_transparent;
+ lop &= ~lop_T_transparent;
/* Interesting question: should data_x be (x & 7), rather than 0,
to improve alignment? */
if (source == NULL && lop_no_S_is_T(lop))
- code = (*dev_proc(dev, copy_mono))
- (dev, tile_data, 0, tile_raster, gx_no_bitmap_id,
- x, y, w, h, color0, color1);
+ code = (*dev_proc(dev, copy_mono))
+ (dev, tile_data, 0, tile_raster, gx_no_bitmap_id,
+ x, y, w, h, color0, color1);
free(tile_data);
return code;
@@ -440,7 +440,6 @@ gx_dc_wts_read(
return_error(gs_error_unknownerror);
}
-
/**
* wts_repack_tile_4: Repack four 1-bit tiles into chunky nibbles.
* Note: argument list will change. plane_mask and base_color will
@@ -451,9 +450,9 @@ gx_dc_wts_read(
**/
static void
wts_repack_tile_4(unsigned char *ctile_data, int ctile_raster,
- const unsigned char **tile_data, int tile_raster,
- const gx_color_index *plane_vector, bool invert,
- int w, int h)
+ const unsigned char **tile_data, int tile_raster,
+ const gx_color_index *plane_vector, bool invert,
+ int w, int h)
{
int y;
int tile_idx_start = 0;
@@ -461,37 +460,37 @@ wts_repack_tile_4(unsigned char *ctile_data, int ctile_raster,
byte inv_byte = invert ? 0xff : 0;
for (y = 0; y < h; y++) {
- int x;
- int tile_idx = tile_idx_start;
-
- for (x = 0; x < w; x += 2) {
- byte b = 0;
- byte m0 = 0x80 >> (x & 6);
- byte m1 = m0 >> 1;
- byte td;
-
- td = tile_data[0][tile_idx] ^ inv_byte;
- if (td & m0) b |= plane_vector[0] << 4;
- if (td & m1) b |= plane_vector[0];
-
- td = tile_data[1][tile_idx] ^ inv_byte;
- if (td & m0) b |= plane_vector[1] << 4;
- if (td & m1) b |= plane_vector[1];
-
- td = tile_data[2][tile_idx] ^ inv_byte;
- if (td & m0) b |= plane_vector[2] << 4;
- if (td & m1) b |= plane_vector[2];
-
- td = tile_data[3][tile_idx] ^ inv_byte;
- if (td & m0) b |= plane_vector[3] << 4;
- if (td & m1) b |= plane_vector[3];
-
- if ((x & 6) == 6)
- tile_idx++;
- ctile_start[x >> 1] = b;
- }
- tile_idx_start += tile_raster;
- ctile_start += ctile_raster;
+ int x;
+ int tile_idx = tile_idx_start;
+
+ for (x = 0; x < w; x += 2) {
+ byte b = 0;
+ byte m0 = 0x80 >> (x & 6);
+ byte m1 = m0 >> 1;
+ byte td;
+
+ td = tile_data[0][tile_idx] ^ inv_byte;
+ if (td & m0) b |= plane_vector[0] << 4;
+ if (td & m1) b |= plane_vector[0];
+
+ td = tile_data[1][tile_idx] ^ inv_byte;
+ if (td & m0) b |= plane_vector[1] << 4;
+ if (td & m1) b |= plane_vector[1];
+
+ td = tile_data[2][tile_idx] ^ inv_byte;
+ if (td & m0) b |= plane_vector[2] << 4;
+ if (td & m1) b |= plane_vector[2];
+
+ td = tile_data[3][tile_idx] ^ inv_byte;
+ if (td & m0) b |= plane_vector[3] << 4;
+ if (td & m1) b |= plane_vector[3];
+
+ if ((x & 6) == 6)
+ tile_idx++;
+ ctile_start[x >> 1] = b;
+ }
+ tile_idx_start += tile_raster;
+ ctile_start += ctile_raster;
}
}
@@ -503,9 +502,9 @@ wts_repack_tile_4(unsigned char *ctile_data, int ctile_raster,
*/
static int
gx_dc_wts_fill_rectangle_4(const gx_device_color *pdevc,
- int x, int y, int w, int h,
- gx_device *dev, gs_logical_operation_t lop,
- const gx_rop_source_t *source)
+ int x, int y, int w, int h,
+ gx_device *dev, gs_logical_operation_t lop,
+ const gx_rop_source_t *source)
{
int num_comp = pdevc->colors.wts.num_components;
/* gx_rop_source_t no_source; */
@@ -525,31 +524,31 @@ gx_dc_wts_fill_rectangle_4(const gx_device_color *pdevc,
int yph = pdevc->phase.y;
for (i = 0; i < num_comp; i++) {
- wts_screen_sample_t shade = pdevc->colors.wts.levels[i];
- gx_ht_order_component *components = pdevc->colors.wts.w_ht->components;
- wts_screen_t *ws = components[i].corder.wts;
+ wts_screen_sample_t shade = pdevc->colors.wts.levels[i];
+ gx_ht_order_component *components = pdevc->colors.wts.w_ht->components;
+ wts_screen_t *ws = components[i].corder.wts;
- tile_data[i] = malloc(tile_size);
- wts_draw(ws, shade, tile_data[i], tile_raster, x - xph, y - yph, w, h);
+ tile_data[i] = malloc(tile_size);
+ wts_draw(ws, shade, tile_data[i], tile_raster, x - xph, y - yph, w, h);
}
ctile_data = malloc(ctile_size);
- wts_repack_tile_4(ctile_data, ctile_raster,
- (const unsigned char **)tile_data, tile_raster,
- pdevc->colors.wts.plane_vector, invert, w, h);
-
+ wts_repack_tile_4(ctile_data, ctile_raster,
+ (const unsigned char **)tile_data, tile_raster,
+ pdevc->colors.wts.plane_vector, invert, w, h);
+
/* See gx_dc_ht_binary_fill_rectangle() for explanation. */
if (dev->color_info.depth > 1)
- lop &= ~lop_T_transparent;
+ lop &= ~lop_T_transparent;
if (source == NULL && lop_no_S_is_T(lop))
- code = (*dev_proc(dev, copy_color))
- (dev, ctile_data, 0, ctile_raster, gx_no_bitmap_id,
- x, y, w, h);
+ code = (*dev_proc(dev, copy_color))
+ (dev, ctile_data, 0, ctile_raster, gx_no_bitmap_id,
+ x, y, w, h);
free(ctile_data);
for (i = 0; i < num_comp; i++) {
- free(tile_data[i]);
+ free(tile_data[i]);
}
return code;
@@ -557,37 +556,37 @@ gx_dc_wts_fill_rectangle_4(const gx_device_color *pdevc,
static int
gx_dc_wts_fill_rectangle(const gx_device_color *pdevc,
- int x, int y, int w, int h,
- gx_device *dev, gs_logical_operation_t lop,
- const gx_rop_source_t *source)
+ int x, int y, int w, int h,
+ gx_device *dev, gs_logical_operation_t lop,
+ const gx_rop_source_t *source)
{
int num_comp = pdevc->colors.wts.num_components;
if (num_comp == 1)
- return gx_dc_wts_fill_rectangle_1(pdevc, x, y, w, h, dev, lop, source);
+ return gx_dc_wts_fill_rectangle_1(pdevc, x, y, w, h, dev, lop, source);
else if (num_comp <= 4)
- return gx_dc_wts_fill_rectangle_4(pdevc, x, y, w, h, dev, lop, source);
+ return gx_dc_wts_fill_rectangle_4(pdevc, x, y, w, h, dev, lop, source);
else
- return -1;
+ return -1;
}
/* Compare two wts colors for equality. */
static int
gx_dc_wts_equal(const gx_device_color *pdevc1,
- const gx_device_color *pdevc2)
+ const gx_device_color *pdevc2)
{
uint num_comp = pdevc1->colors.wts.num_components;
if (pdevc2->type != pdevc1->type ||
- pdevc1->phase.x != pdevc2->phase.x ||
- pdevc1->phase.y != pdevc2->phase.y ||
- num_comp != pdevc2->colors.wts.num_components
- )
- return false;
+ pdevc1->phase.x != pdevc2->phase.x ||
+ pdevc1->phase.y != pdevc2->phase.y ||
+ num_comp != pdevc2->colors.wts.num_components
+ )
+ return false;
return
- !memcmp(pdevc1->colors.wts.levels,
- pdevc2->colors.wts.levels,
- num_comp * sizeof(pdevc1->colors.wts.levels[0]));
+ !memcmp(pdevc1->colors.wts.levels,
+ pdevc2->colors.wts.levels,
+ num_comp * sizeof(pdevc1->colors.wts.levels[0]));
}
/*
diff --git a/gs/base/gxwts.h b/gs/base/gxwts.h
index 35bd6a7d1..f5dd03db4 100644
--- a/gs/base/gxwts.h
+++ b/gs/base/gxwts.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@ typedef struct wts_screen_s wts_screen_t;
#endif
/* We cache intermediate results for wts_get_samples_j. In general, if these
- are set so that a band fits, then the hit rate will be excellent. */
+ are set so that a band fits, then the hit rate will be excellent. */
#define WTS_CACHE_SIZE_X 512
#define WTS_CACHE_SIZE_Y 512
@@ -88,6 +88,6 @@ typedef struct {
int
wts_get_samples(wts_screen_t *ws, int x, int y,
- int *pcellx, int *pcelly, int *p_nsamples);
+ int *pcellx, int *pcelly, int *p_nsamples);
#endif
diff --git a/gs/base/gxxfont.h b/gs/base/gxxfont.h
index 3c635047b..6256dae94 100644
--- a/gs/base/gxxfont.h
+++ b/gs/base/gxxfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gzacpath.h b/gs/base/gzacpath.h
index 3927cd0a1..59f6e617b 100644
--- a/gs/base/gzacpath.h
+++ b/gs/base/gzacpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,21 +44,21 @@ void gx_cpath_accum_begin(gx_device_cpath_accum * padev, gs_memory_t * mem);
/* Set the accumulator's clipping box. */
void gx_cpath_accum_set_cbox(gx_device_cpath_accum * padev,
- const gs_fixed_rect * pbox);
+ const gs_fixed_rect * pbox);
/* Finish accumulating a clipping path. */
/* Note that this releases the old contents of the clipping path. */
int gx_cpath_accum_end(const gx_device_cpath_accum * padev,
- gx_clip_path * pcpath);
+ gx_clip_path * pcpath);
/* Discard an accumulator in case of error. */
void gx_cpath_accum_discard(gx_device_cpath_accum * padev);
/* Intersect two clipping paths using an accumulator. */
int gx_cpath_intersect_path_slow(gx_clip_path *, gx_path *, int,
- gs_imager_state *, const gx_fill_params *);
+ gs_imager_state *, const gx_fill_params *);
-int cpath_accum_fill_rect_with(gx_device_cpath_accum *pcdev, gx_device *tdev,
- gx_device_color *pdevc);
+int cpath_accum_fill_rect_with(gx_device_cpath_accum *pcdev, gx_device *tdev,
+ gx_device_color *pdevc);
#endif /* gzacpath_INCLUDED */
diff --git a/gs/base/gzcpath.h b/gs/base/gzcpath.h
index 682a2bf35..b768c177c 100644
--- a/gs/base/gzcpath.h
+++ b/gs/base/gzcpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gzht.h b/gs/base/gzht.h
index 511f54ffe..b0f1828e2 100644
--- a/gs/base/gzht.h
+++ b/gs/base/gzht.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,21 +29,21 @@ void gx_sort_ht_order(gx_ht_bit *, uint);
/* (Internal) procedures for constructing halftone orders. */
int gx_ht_alloc_ht_order(gx_ht_order * porder, uint width, uint height,
- uint num_levels, uint num_bits, uint strip_shift,
- const gx_ht_order_procs_t *procs,
- gs_memory_t * mem);
+ uint num_levels, uint num_bits, uint strip_shift,
+ const gx_ht_order_procs_t *procs,
+ gs_memory_t * mem);
int gx_ht_alloc_order(gx_ht_order * porder, uint width, uint height,
- uint strip_shift, uint num_levels, gs_memory_t *mem);
+ uint strip_shift, uint num_levels, gs_memory_t *mem);
int gx_ht_alloc_threshold_order(gx_ht_order * porder, uint width,
- uint height, uint num_levels,
- gs_memory_t * mem);
+ uint height, uint num_levels,
+ gs_memory_t * mem);
int gx_ht_alloc_client_order(gx_ht_order * porder, uint width, uint height,
- uint num_levels, uint num_bits, gs_memory_t * mem);
+ uint num_levels, uint num_bits, gs_memory_t * mem);
void gx_ht_construct_spot_order(gx_ht_order *);
int gx_ht_construct_threshold_order(gx_ht_order *, const byte *);
void gx_ht_construct_bit(gx_ht_bit * bit, int width, int bit_num);
void gx_ht_construct_bits(gx_ht_order *);
-int gx_ht_construct_threshold(gx_ht_order *d_order, gx_device *dev,
+int gx_ht_construct_threshold(gx_ht_order *d_order, gx_device *dev,
const gs_imager_state * pis, int plane_index);
/* Halftone enumeration structure */
@@ -64,13 +64,13 @@ struct gs_screen_enum_s {
/* Prepare a device halftone for installation, but don't install it. */
int gs_sethalftone_prepare(gs_state *, gs_halftone *,
- gx_device_halftone *);
+ gx_device_halftone *);
/* Allocate and initialize a spot screen. */
/* This is the first half of gs_screen_init_accurate/memory. */
int gs_screen_order_alloc(gx_ht_order *, gs_memory_t *);
int gs_screen_order_init_memory(gx_ht_order *, const gs_state *,
- gs_screen_halftone *, bool, gs_memory_t *);
+ gs_screen_halftone *, bool, gs_memory_t *);
#define gs_screen_order_init(porder, pgs, phsp, accurate)\
gs_screen_order_init_memory(porder, pgs, phsp, accurate, pgs->memory)
@@ -78,16 +78,16 @@ int gs_screen_order_init_memory(gx_ht_order *, const gs_state *,
/* Prepare to sample a spot screen. */
/* This is the second half of gs_screen_init_accurate/memory. */
int gs_screen_enum_init_memory(gs_screen_enum *, const gx_ht_order *,
- gs_state *, const gs_screen_halftone *,
- gs_memory_t *);
+ gs_state *, const gs_screen_halftone *,
+ gs_memory_t *);
#define gs_screen_enum_init(penum, porder, pgs, phsp)\
gs_screen_enum_init_memory(penum, porder, pgs, phsp, pgs->memory)
/* Process an entire screen plane. */
int gx_ht_process_screen_memory(gs_screen_enum * penum, gs_state * pgs,
- gs_screen_halftone * phsp, bool accurate,
- gs_memory_t * mem);
+ gs_screen_halftone * phsp, bool accurate,
+ gs_memory_t * mem);
#define gx_ht_process_screen(penum, pgs, phsp, accurate)\
gx_ht_process_screen_memory(penum, pgs, phsp, accurate, pgs->memory)
@@ -120,16 +120,16 @@ struct gx_ht_cache_s {
int num_cached; /* actual # of cached tiles */
int levels_per_tile; /* # of levels per cached tile */
int tiles_fit; /* -1 if not determined, 0 if no fit, */
- /* 1 if fit */
+ /* 1 if fit */
gx_bitmap_id base_id; /* the base id, to which */
- /* we add the halftone level */
+ /* we add the halftone level */
gx_ht_tile *(*render_ht)(gx_ht_cache *, int); /* rendering procedure */
};
/* Define the sizes of the halftone cache. */
#define max_ht_cached_tiles_LARGE 8192
#define max_ht_cache_bits_size_LARGE (1024*1024) /* enough for 256 levels 167x167 */
- /* see ht_stocht.ps */
+ /* see ht_stocht.ps */
#define max_ht_cached_tiles_SMALL 256
#define max_ht_cache_bits_size_SMALL 8192 /* enough for 256 levels 8x8 */
@@ -187,7 +187,7 @@ bool gx_check_tile_cache(const gs_imager_state *);
/* from the beginning of the tile, and set *ppx to the x phase offset */
/* within the tile; if not, return -1. */
int gx_check_tile_size(const gs_imager_state * pis, int w, int y, int h,
- gs_color_select_t select, int *ppx);
+ gs_color_select_t select, int *ppx);
/* Make a given level current in a halftone cache. */
#define gx_render_ht(pcache, b_level)\
@@ -204,9 +204,9 @@ void gx_ht_order_release(gx_ht_order * porder, gs_memory_t * mem, bool free_cach
* read or update the client halftone.
*/
int gx_imager_dev_ht_install(gs_imager_state * pis,
- gx_device_halftone * pdht,
- gs_halftone_type type,
- const gx_device * dev);
+ gx_device_halftone * pdht,
+ gs_halftone_type type,
+ const gx_device * dev);
/*
* Install a new halftone in the graphics state. Note that we copy the top
@@ -238,7 +238,7 @@ void gx_set_effective_transfer(gs_state * pgs);
* A negative value is returned if the color name is not found.
*/
int gs_color_name_component_number(gx_device * dev, const char * pname,
- int name_size, int halftonetype);
+ int name_size, int halftonetype);
/*
* See gs_color_name_component_number for main description.
*
@@ -246,5 +246,5 @@ int gs_color_name_component_number(gx_device * dev, const char * pname,
* then call gs_color_name_component_number.
*/
int gs_cname_to_colorant_number(gs_state * pgs, byte * pname, uint name_size,
- int halftonetype);
+ int halftonetype);
#endif /* gzht_INCLUDED */
diff --git a/gs/base/gzline.h b/gs/base/gzline.h
index 8ae0532ff..222f339e7 100644
--- a/gs/base/gzline.h
+++ b/gs/base/gzline.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/gzpath.h b/gs/base/gzpath.h
index 6fdaae4f2..4d48f8bbd 100644
--- a/gs/base/gzpath.h
+++ b/gs/base/gzpath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,12 +42,12 @@ typedef enum {
/* Define the common structure for all segments. */
#define segment_common\
- segment *prev;\
- segment *next;\
- ushort /*segment_type*/ type;\
- ushort /*segment_notes*/ notes;\
- gs_fixed_point pt; /* initial point for starts, */\
- /* final point for others */
+ segment *prev;\
+ segment *next;\
+ ushort /*segment_type*/ type;\
+ ushort /*segment_notes*/ notes;\
+ gs_fixed_point pt; /* initial point for starts, */\
+ /* final point for others */
/* Forward declarations for structure types */
#ifndef segment_DEFINED
@@ -152,7 +152,7 @@ struct subpath_s {
/* the start of the next subpath. */
gx_path_rectangular_type
gx_subpath_is_rectangular(const subpath * pstart, gs_fixed_rect * pbox,
- const subpath ** ppnext);
+ const subpath ** ppnext);
#define gx_subpath_is_rectangle(pstart, pbox, ppnext)\
(gx_subpath_is_rectangular(pstart, pbox, ppnext) != prt_none)
@@ -181,7 +181,6 @@ int gx_subdivide_curve(gx_path *, int, curve_segment *, segment_notes);
*/
#define k_sample_max min((size_of(int) * 8 - 1) / 3, 10)
-
/*
* The path state flags reflect the most recent operation on the path
* as follows:
@@ -258,8 +257,8 @@ typedef enum {
typedef struct gx_path_segments_s {
rc_header rc;
struct psc_ {
- subpath *subpath_first;
- subpath *subpath_current;
+ subpath *subpath_first;
+ subpath *subpath_current;
} contents;
} gx_path_segments;
@@ -307,12 +306,12 @@ struct gx_path_s {
gs_memory_t *memory;
gx_path_allocation_t allocation; /* how this path was allocated */
gx_path_segments *segments;
- segment *last_charpath_segment; /* Used only by pdfwrite at present,
- * last segment added by a charpath operation
- */
+ segment *last_charpath_segment; /* Used only by pdfwrite at present,
+ * last segment added by a charpath operation
+ */
gs_fixed_rect bbox; /* bounding box (in device space) */
segment *box_last; /* bbox incorporates segments */
- /* up to & including this one */
+ /* up to & including this one */
#define first_subpath segments->contents.subpath_first /* (hack) */
#define current_subpath segments->contents.subpath_current /* (ditto) */
/*
@@ -393,19 +392,19 @@ struct gx_flattened_iterator_s {
fixed lx0, ly0, lx1, ly1;
};
-bool gx_flattened_iterator__init(gx_flattened_iterator *this,
- fixed x0, fixed y0, const curve_segment *pc, int k);
-bool gx_flattened_iterator__init_line(gx_flattened_iterator *this,
- fixed x0, fixed y0, fixed x1, fixed y1);
+bool gx_flattened_iterator__init(gx_flattened_iterator *this,
+ fixed x0, fixed y0, const curve_segment *pc, int k);
+bool gx_flattened_iterator__init_line(gx_flattened_iterator *this,
+ fixed x0, fixed y0, fixed x1, fixed y1);
void gx_flattened_iterator__switch_to_backscan(gx_flattened_iterator *this, bool not_first);
int gx_flattened_iterator__next(gx_flattened_iterator *this);
int gx_flattened_iterator__prev(gx_flattened_iterator *this);
-bool curve_coeffs_ranged(fixed x0, fixed x1, fixed x2, fixed x3,
- fixed y0, fixed y1, fixed y2, fixed y3,
- fixed *ax, fixed *bx, fixed *cx,
- fixed *ay, fixed *by, fixed *cy,
- int k);
+bool curve_coeffs_ranged(fixed x0, fixed x1, fixed x2, fixed x3,
+ fixed y0, fixed y1, fixed y2, fixed y3,
+ fixed *ax, fixed *bx, fixed *cx,
+ fixed *ay, fixed *by, fixed *cy,
+ int k);
bool gx_check_fixed_diff_overflow(fixed v0, fixed v1);
bool gx_check_fixed_sum_overflow(fixed v0, fixed v1);
diff --git a/gs/base/gzspotan.c b/gs/base/gzspotan.c
index 6a7b32471..dcc313c4b 100644
--- a/gs/base/gzspotan.c
+++ b/gs/base/gzspotan.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,7 +14,7 @@
/*$Id$ */
/* A spot analyzer device implementation. */
/*
- This implements a spot topology analyzis and
+ This implements a spot topology analyzis and
stem recognition for True Type grid fitting.
*/
#include "gx.h"
@@ -42,19 +42,17 @@ private_st_san_trap_contact();
static dev_proc_close_device(san_close);
static dev_proc_get_clipping_box(san_get_clipping_box);
-
/* --------------------- List management ------------------------- */
/* fixme : use something like C++ patterns to generate same functions for various types. */
-
static inline void
free_trap_list(gs_memory_t *mem, gx_san_trap **list)
{
gx_san_trap *t = *list, *t1;
for (t = *list; t != NULL; t = t1) {
- t1 = t->link;
- gs_free_object(mem, t, "free_trap_list");
+ t1 = t->link;
+ gs_free_object(mem, t, "free_trap_list");
}
*list = 0;
}
@@ -65,8 +63,8 @@ free_cont_list(gs_memory_t *mem, gx_san_trap_contact **list)
gx_san_trap_contact *t = *list, *t1;
for (t = *list; t != NULL; t = t1) {
- t1 = t->link;
- gs_free_object(mem, t, "free_cont_list");
+ t1 = t->link;
+ gs_free_object(mem, t, "free_cont_list");
}
*list = 0;
}
@@ -77,21 +75,21 @@ trap_reserve(gx_device_spot_analyzer *padev)
gx_san_trap *t = padev->trap_free;
if (t != NULL) {
- padev->trap_free = t->link;
+ padev->trap_free = t->link;
} else {
- if (padev->trap_buffer_count > 10000)
- return NULL;
- t = gs_alloc_struct(padev->memory, gx_san_trap,
- &st_san_trap, "trap_reserve");
- if (t == NULL)
- return NULL;
- t->link = NULL;
- if (padev->trap_buffer_last == NULL)
- padev->trap_buffer = t;
- else
- padev->trap_buffer_last->link = t;
- padev->trap_buffer_last = t;
- padev->trap_buffer_count++;
+ if (padev->trap_buffer_count > 10000)
+ return NULL;
+ t = gs_alloc_struct(padev->memory, gx_san_trap,
+ &st_san_trap, "trap_reserve");
+ if (t == NULL)
+ return NULL;
+ t->link = NULL;
+ if (padev->trap_buffer_last == NULL)
+ padev->trap_buffer = t;
+ else
+ padev->trap_buffer_last->link = t;
+ padev->trap_buffer_last = t;
+ padev->trap_buffer_count++;
}
return t;
}
@@ -102,21 +100,21 @@ cont_reserve(gx_device_spot_analyzer *padev)
gx_san_trap_contact *t = padev->cont_free;
if (t != NULL) {
- padev->cont_free = t->link;
+ padev->cont_free = t->link;
} else {
- if (padev->cont_buffer_count > 10000)
- return NULL;
- t = gs_alloc_struct(padev->memory, gx_san_trap_contact,
- &st_san_trap_contact, "cont_reserve");
- if (t == NULL)
- return NULL;
- t->link = NULL;
- if (padev->cont_buffer_last == NULL)
- padev->cont_buffer = t;
- else
- padev->cont_buffer_last->link = t;
- padev->cont_buffer_last = t;
- padev->cont_buffer_count++;
+ if (padev->cont_buffer_count > 10000)
+ return NULL;
+ t = gs_alloc_struct(padev->memory, gx_san_trap_contact,
+ &st_san_trap_contact, "cont_reserve");
+ if (t == NULL)
+ return NULL;
+ t->link = NULL;
+ if (padev->cont_buffer_last == NULL)
+ padev->cont_buffer = t;
+ else
+ padev->cont_buffer_last->link = t;
+ padev->cont_buffer_last = t;
+ padev->cont_buffer_count++;
}
return t;
}
@@ -126,7 +124,7 @@ trap_unreserve(gx_device_spot_analyzer *padev, gx_san_trap *t)
{
/* Assuming the last reserved one. */
if (t->link != padev->trap_free)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
padev->trap_free = t;
return 0;
}
@@ -136,7 +134,7 @@ cont_unreserve(gx_device_spot_analyzer *padev, gx_san_trap_contact *t)
{
/* Assuming the last reserved one. */
if (t->link != padev->cont_free)
- return_error(gs_error_unregistered); /* Must not happen. */
+ return_error(gs_error_unregistered); /* Must not happen. */
padev->cont_free = t;
return 0;
}
@@ -160,12 +158,12 @@ band_list_remove(gx_san_trap **list, gx_san_trap *t)
{
/* Assuming a cyclic list, and the element is in it. */
if (t->next == t) {
- *list = NULL;
+ *list = NULL;
} else {
- if (*list == t)
- *list = t->next;
- t->next->prev = t->prev;
- t->prev->next = t->next;
+ if (*list == t)
+ *list = t->next;
+ t->next->prev = t->prev;
+ t->prev->next = t->next;
}
t->next = t->prev = NULL; /* Safety. */
}
@@ -175,14 +173,14 @@ band_list_insert_last(gx_san_trap **list, gx_san_trap *t)
{
/* Assuming a cyclic list. */
if (*list == 0) {
- *list = t->next = t->prev = t;
+ *list = t->next = t->prev = t;
} else {
- gx_san_trap *last = band_list_last(*list);
- gx_san_trap *first = *list;
+ gx_san_trap *last = band_list_last(*list);
+ gx_san_trap *first = *list;
- t->next = first;
- t->prev = last;
- last->next = first->prev = t;
+ t->next = first;
+ t->prev = last;
+ last->next = first->prev = t;
}
}
@@ -191,14 +189,14 @@ cont_list_insert_last(gx_san_trap_contact **list, gx_san_trap_contact *t)
{
/* Assuming a cyclic list. */
if (*list == 0) {
- *list = t->next = t->prev = t;
+ *list = t->next = t->prev = t;
} else {
- gx_san_trap_contact *last = cont_list_last(*list);
- gx_san_trap_contact *first = *list;
+ gx_san_trap_contact *last = cont_list_last(*list);
+ gx_san_trap_contact *first = *list;
- t->next = first;
- t->prev = last;
- last->next = first->prev = t;
+ t->next = first;
+ t->prev = last;
+ last->next = first->prev = t;
}
}
@@ -206,7 +204,7 @@ static inline bool
trap_is_last(const gx_san_trap *list, const gx_san_trap *t)
{
/* Assuming a non-empty cyclic list, and the anchor points to the first element. */
- return t->next == list;
+ return t->next == list;
}
/* ---------------------The device ---------------------------- */
@@ -215,7 +213,7 @@ trap_is_last(const gx_san_trap *list, const gx_san_trap *t)
/* Many of these procedures won't be called; they are set to NULL. */
static const gx_device_spot_analyzer gx_spot_analyzer_device =
{std_device_std_body(gx_device_spot_analyzer, 0, "spot analyzer",
- 0, 0, 1, 1),
+ 0, 0, 1, 1),
{san_open,
NULL,
NULL,
@@ -319,13 +317,13 @@ check_band_list(const gx_san_trap *list)
{
#ifdef DEBUG
if (list != NULL) {
- const gx_san_trap *t = list;
+ const gx_san_trap *t = list;
- while (t->next != list) {
- if (t->xrtop > t->next->xltop)
- return_error(gs_error_unregistered); /* Must not happen. */
- t = t->next;
- }
+ while (t->next != list) {
+ if (t->xrtop > t->next->xltop)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ t = t->next;
+ }
}
#endif
return 0;
@@ -335,51 +333,51 @@ static int
try_unite_last_trap(gx_device_spot_analyzer *padev, fixed xlbot)
{
if (padev->bot_band != NULL && padev->top_band != NULL) {
- gx_san_trap *last = band_list_last(padev->top_band);
- gx_san_trap *t = padev->bot_current;
- /* If the last trapezoid is a prolongation of its bottom contact,
- unite it and release the last trapezoid and the last contact. */
- if (t != NULL && t->upper != NULL && last->xrbot < xlbot &&
- (last->prev == last || last->prev->xrbot < last->xlbot)) {
- if ((t->next == NULL || t->xrtop < t->next->xltop) &&
- (t->upper->next == t->upper &&
- t->l == last->l && t->r == last->r)) {
- int code;
-
- if (padev->bot_current == t)
- padev->bot_current = (t == band_list_last(padev->bot_band) ? NULL : t->next);
- if (t->upper->upper != last)
- return_error(gs_error_unregistered); /* Must not happen. */
- band_list_remove(&padev->top_band, last);
- band_list_remove(&padev->bot_band, t);
- band_list_insert_last(&padev->top_band, t);
- t->ytop = last->ytop;
- t->xltop = last->xltop;
- t->xrtop = last->xrtop;
- t->rightmost &= last->rightmost;
- t->leftmost &= last->leftmost;
- vd_quad(t->xlbot, t->ybot, t->xrbot, t->ybot,
- t->xrtop, t->ytop, t->xltop, t->ytop, 1, VD_TRAP_U_COLOR);
- code = trap_unreserve(padev, last);
- if (code < 0)
- return code;
- code = cont_unreserve(padev, t->upper);
- if (code < 0)
- return code;
- t->upper = NULL;
- }
- }
+ gx_san_trap *last = band_list_last(padev->top_band);
+ gx_san_trap *t = padev->bot_current;
+ /* If the last trapezoid is a prolongation of its bottom contact,
+ unite it and release the last trapezoid and the last contact. */
+ if (t != NULL && t->upper != NULL && last->xrbot < xlbot &&
+ (last->prev == last || last->prev->xrbot < last->xlbot)) {
+ if ((t->next == NULL || t->xrtop < t->next->xltop) &&
+ (t->upper->next == t->upper &&
+ t->l == last->l && t->r == last->r)) {
+ int code;
+
+ if (padev->bot_current == t)
+ padev->bot_current = (t == band_list_last(padev->bot_band) ? NULL : t->next);
+ if (t->upper->upper != last)
+ return_error(gs_error_unregistered); /* Must not happen. */
+ band_list_remove(&padev->top_band, last);
+ band_list_remove(&padev->bot_band, t);
+ band_list_insert_last(&padev->top_band, t);
+ t->ytop = last->ytop;
+ t->xltop = last->xltop;
+ t->xrtop = last->xrtop;
+ t->rightmost &= last->rightmost;
+ t->leftmost &= last->leftmost;
+ vd_quad(t->xlbot, t->ybot, t->xrbot, t->ybot,
+ t->xrtop, t->ytop, t->xltop, t->ytop, 1, VD_TRAP_U_COLOR);
+ code = trap_unreserve(padev, last);
+ if (code < 0)
+ return code;
+ code = cont_unreserve(padev, t->upper);
+ if (code < 0)
+ return code;
+ t->upper = NULL;
+ }
+ }
}
return 0;
}
-static inline double
+static inline double
trap_area(gx_san_trap *t)
{
return (double)(t->xrbot - t->xlbot + t->xrtop - t->xltop) * (t->ytop - t->ybot) / 2;
}
-static inline double
+static inline double
trap_axis_length(gx_san_trap *t)
{
double xbot = (t->xlbot + t->xrbot) / 2.0;
@@ -396,18 +394,18 @@ is_stem_boundaries(gx_san_trap *t, int side_mask)
double dy = t->ytop - t->ybot;
if (side_mask & 1) {
- dx = t->xltop - t->xlbot;
- norm = hypot(dx, dy);
- cosine = dx / norm;
- if (any_abs(cosine) > cosine_threshold)
- return false;
+ dx = t->xltop - t->xlbot;
+ norm = hypot(dx, dy);
+ cosine = dx / norm;
+ if (any_abs(cosine) > cosine_threshold)
+ return false;
}
if (side_mask & 2) {
- dx = t->xrtop - t->xrbot;
- norm = hypot(dx, dy);
- cosine = dx / norm;
- if (any_abs(cosine) > cosine_threshold)
- return false;
+ dx = t->xrtop - t->xrbot;
+ norm = hypot(dx, dy);
+ cosine = dx / norm;
+ if (any_abs(cosine) > cosine_threshold)
+ return false;
}
return true;
}
@@ -422,19 +420,19 @@ gx_san__obtain(gs_memory_t *mem, gx_device_spot_analyzer **ppadev)
int code;
if (*ppadev != 0) {
- (*ppadev)->lock++;
- return 0;
+ (*ppadev)->lock++;
+ return 0;
}
- padev = gs_alloc_struct(mem, gx_device_spot_analyzer,
- &st_device_spot_analyzer, "gx_san__obtain");
+ padev = gs_alloc_struct(mem, gx_device_spot_analyzer,
+ &st_device_spot_analyzer, "gx_san__obtain");
if (padev == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
gx_device_init((gx_device *)padev, (const gx_device *)&gx_spot_analyzer_device,
- mem, false);
+ mem, false);
code = gs_opendevice((gx_device *)padev);
if (code < 0) {
- gs_free_object(mem, padev, "gx_san__obtain");
- return code;
+ gs_free_object(mem, padev, "gx_san__obtain");
+ return code;
}
padev->lock = 1;
*ppadev = padev;
@@ -448,21 +446,21 @@ gx_san__release(gx_device_spot_analyzer **ppadev)
if (padev == NULL) {
/* Can't use emprintf here! */
- eprintf("Extra call to gx_san__release.");
- return;
+ eprintf("Extra call to gx_san__release.");
+ return;
}
if(--padev->lock < 0) {
- emprintf(padev->memory, "Wrong lock to gx_san__release.");
- return;
+ emprintf(padev->memory, "Wrong lock to gx_san__release.");
+ return;
}
if (padev->lock == 0) {
- *ppadev = NULL;
- rc_decrement(padev, "gx_san__release");
+ *ppadev = NULL;
+ rc_decrement(padev, "gx_san__release");
}
}
/* Start accumulating a path. */
-void
+void
gx_san_begin(gx_device_spot_analyzer *padev)
{
padev->bot_band = NULL;
@@ -475,7 +473,7 @@ gx_san_begin(gx_device_spot_analyzer *padev)
/* Store a tarpezoid. */
/* Assumes an Y-band scanning order with increasing X inside a band. */
int
-gx_san_trap_store(gx_device_spot_analyzer *padev,
+gx_san_trap_store(gx_device_spot_analyzer *padev,
fixed ybot, fixed ytop, fixed xlbot, fixed xrbot, fixed xltop, fixed xrtop,
const segment *l, const segment *r, int dir_l, int dir_r)
{
@@ -483,32 +481,32 @@ gx_san_trap_store(gx_device_spot_analyzer *padev,
int code;
if (padev->top_band != NULL && padev->top_band->ytop != ytop) {
- code = try_unite_last_trap(padev, max_int);
- if (code < 0)
- return code;
- /* Step to a new band. */
- padev->bot_band = padev->bot_current = padev->top_band;
- padev->top_band = NULL;
+ code = try_unite_last_trap(padev, max_int);
+ if (code < 0)
+ return code;
+ /* Step to a new band. */
+ padev->bot_band = padev->bot_current = padev->top_band;
+ padev->top_band = NULL;
}
if (padev->bot_band != NULL && padev->bot_band->ytop != ybot) {
- /* The Y-projection of the spot is not contiguous. */
- padev->top_band = NULL;
+ /* The Y-projection of the spot is not contiguous. */
+ padev->top_band = NULL;
}
if (padev->top_band != NULL) {
- code = try_unite_last_trap(padev, xlbot);
- if (code < 0)
- return code;
+ code = try_unite_last_trap(padev, xlbot);
+ if (code < 0)
+ return code;
}
code = check_band_list(padev->bot_band);
if (code < 0)
- return code;
+ return code;
code =check_band_list(padev->top_band);
if (code < 0)
- return code;
+ return code;
/* Make new trapezoid. */
last = trap_reserve(padev);
if (last == NULL)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
last->ybot = ybot;
last->ytop = ytop;
last->xlbot = xlbot;
@@ -523,53 +521,52 @@ gx_san_trap_store(gx_device_spot_analyzer *padev,
last->fork = 0;
last->visited = false;
last->leftmost = last->rightmost = true;
- vd_quad(last->xlbot, last->ybot, last->xrbot, last->ybot,
- last->xrtop, last->ytop, last->xltop, last->ytop, 1, VD_TRAP_N_COLOR);
+ vd_quad(last->xlbot, last->ybot, last->xrbot, last->ybot,
+ last->xrtop, last->ytop, last->xltop, last->ytop, 1, VD_TRAP_N_COLOR);
if (padev->top_band != NULL) {
- padev->top_band->rightmost = false;
- last->leftmost = false;
+ padev->top_band->rightmost = false;
+ last->leftmost = false;
}
band_list_insert_last(&padev->top_band, last);
code = check_band_list(padev->top_band);
if (code < 0)
- return code;
+ return code;
while (padev->bot_current != NULL && padev->bot_current->xrtop < xlbot)
- padev->bot_current = (trap_is_last(padev->bot_band, padev->bot_current)
- ? NULL : padev->bot_current->next);
+ padev->bot_current = (trap_is_last(padev->bot_band, padev->bot_current)
+ ? NULL : padev->bot_current->next);
if (padev->bot_current != 0) {
- gx_san_trap *t = padev->bot_current;
- gx_san_trap *bot_last = band_list_last(padev->bot_band);
-
- while(t->xltop <= xrbot) {
- gx_san_trap_contact *cont = cont_reserve(padev);
-
- if (cont == NULL)
- return_error(gs_error_VMerror);
- cont->lower = t;
- cont->upper = last;
- vd_bar((t->xltop + t->xrtop + t->xlbot + t->xrbot) / 4, (t->ytop + t->ybot) / 2,
- (last->xltop + last->xrtop + last->xlbot + last->xrbot) / 4,
- (last->ytop + last->ybot) / 2, 0, VD_CONT_COLOR);
- cont_list_insert_last(&t->upper, cont);
- last->fork++;
- if (t == bot_last)
- break;
- t = t->next;
- }
+ gx_san_trap *t = padev->bot_current;
+ gx_san_trap *bot_last = band_list_last(padev->bot_band);
+
+ while(t->xltop <= xrbot) {
+ gx_san_trap_contact *cont = cont_reserve(padev);
+
+ if (cont == NULL)
+ return_error(gs_error_VMerror);
+ cont->lower = t;
+ cont->upper = last;
+ vd_bar((t->xltop + t->xrtop + t->xlbot + t->xrbot) / 4, (t->ytop + t->ybot) / 2,
+ (last->xltop + last->xrtop + last->xlbot + last->xrbot) / 4,
+ (last->ytop + last->ybot) / 2, 0, VD_CONT_COLOR);
+ cont_list_insert_last(&t->upper, cont);
+ last->fork++;
+ if (t == bot_last)
+ break;
+ t = t->next;
+ }
}
if (padev->xmin > padev->xmax) {
- padev->xmin = min(xlbot, xltop);
- padev->xmax = max(xrbot, xrtop);
+ padev->xmin = min(xlbot, xltop);
+ padev->xmax = max(xrbot, xrtop);
} else {
- padev->xmin = min(padev->xmin, min(xlbot, xltop));
- padev->xmax = max(padev->xmax, max(xrbot, xrtop));
+ padev->xmin = min(padev->xmin, min(xlbot, xltop));
+ padev->xmax = max(padev->xmax, max(xrbot, xrtop));
}
return 0;
}
-
/* Finish accumulating a path. */
-void
+void
gx_san_end(const gx_device_spot_analyzer *padev)
{
}
@@ -586,88 +583,88 @@ hint_by_trap(gx_device_spot_analyzer *padev, int side_mask,
int code;
for (t = t0; ; t = t->upper->upper) {
- w = t->xrbot - t->xlbot;
- wd = any_abs(w - ave_width);
- if (w > 0 && wd < best_width_diff) {
- best_width_diff = wd;
- best_trap = t;
- }
- if (t == t1)
- break;
+ w = t->xrbot - t->xlbot;
+ wd = any_abs(w - ave_width);
+ if (w > 0 && wd < best_width_diff) {
+ best_width_diff = wd;
+ best_trap = t;
+ }
+ if (t == t1)
+ break;
}
w = t->xrtop - t->xltop;
wd = any_abs(w - ave_width);
if (w > 0 && wd < best_width_diff) {
- best_width_diff = wd;
- best_trap = t;
- at_top = true;
+ best_width_diff = wd;
+ best_trap = t;
+ at_top = true;
}
if (best_trap != NULL) {
- /* Make a stem section hint at_top of best_trap : */
- sect.yl = at_top ? best_trap->ytop : best_trap->ybot;
- sect.yr = sect.yl;
- sect.xl = at_top ? best_trap->xltop : best_trap->xlbot;
- sect.xr = at_top ? best_trap->xrtop : best_trap->xrbot;
- sect.l = best_trap->l;
- sect.r = best_trap->r;
- vd_bar(sect.xl, sect.yl, sect.xr, sect.yr, 0, VD_HINT_COLOR);
- code = handler(client_data, &sect);
- if (code < 0)
- return code;
+ /* Make a stem section hint at_top of best_trap : */
+ sect.yl = at_top ? best_trap->ytop : best_trap->ybot;
+ sect.yr = sect.yl;
+ sect.xl = at_top ? best_trap->xltop : best_trap->xlbot;
+ sect.xr = at_top ? best_trap->xrtop : best_trap->xrbot;
+ sect.l = best_trap->l;
+ sect.r = best_trap->r;
+ vd_bar(sect.xl, sect.yl, sect.xr, sect.yr, 0, VD_HINT_COLOR);
+ code = handler(client_data, &sect);
+ if (code < 0)
+ return code;
}
return 0;
}
static inline void
-choose_by_vector(fixed x0, fixed y0, fixed x1, fixed y1, const segment *s,
- double *slope, double *len, const segment **store_segm, fixed *store_x, fixed *store_y)
+choose_by_vector(fixed x0, fixed y0, fixed x1, fixed y1, const segment *s,
+ double *slope, double *len, const segment **store_segm, fixed *store_x, fixed *store_y)
{
if (y0 != y1) {
- double t = (double)any_abs(x1 - x0) / any_abs(y1 - y0);
- double l = any_abs(y1 - y0); /* Don't want 'hypot'. */
+ double t = (double)any_abs(x1 - x0) / any_abs(y1 - y0);
+ double l = any_abs(y1 - y0); /* Don't want 'hypot'. */
- if (*slope > t || (*slope == t && l > *len)) {
- *slope = t;
- *len = l;
- *store_segm = s;
- *store_x = x1;
- *store_y = y1;
- }
+ if (*slope > t || (*slope == t && l > *len)) {
+ *slope = t;
+ *len = l;
+ *store_segm = s;
+ *store_x = x1;
+ *store_y = y1;
+ }
}
}
static inline void
-choose_by_tangent(const segment *p, const segment *s,
- double *slope, double *len, const segment **store_segm, fixed *store_x, fixed *store_y,
- fixed ybot, fixed ytop)
+choose_by_tangent(const segment *p, const segment *s,
+ double *slope, double *len, const segment **store_segm, fixed *store_x, fixed *store_y,
+ fixed ybot, fixed ytop)
{
if (s->type == s_curve) {
- const curve_segment *c = (const curve_segment *)s;
- vd_curve(p->pt.x, p->pt.y, c->p1.x, c->p1.y, c->p2.x, c->p2.y,
- s->pt.x, s->pt.y, 0, VD_HINT_COLOR);
- if (ybot <= p->pt.y && p->pt.y <= ytop)
- choose_by_vector(c->p1.x, c->p1.y, p->pt.x, p->pt.y, s, slope, len, store_segm, store_x, store_y);
- if (ybot <= s->pt.y && s->pt.y <= ytop)
- choose_by_vector(c->p2.x, c->p2.y, s->pt.x, s->pt.y, s, slope, len, store_segm, store_x, store_y);
+ const curve_segment *c = (const curve_segment *)s;
+ vd_curve(p->pt.x, p->pt.y, c->p1.x, c->p1.y, c->p2.x, c->p2.y,
+ s->pt.x, s->pt.y, 0, VD_HINT_COLOR);
+ if (ybot <= p->pt.y && p->pt.y <= ytop)
+ choose_by_vector(c->p1.x, c->p1.y, p->pt.x, p->pt.y, s, slope, len, store_segm, store_x, store_y);
+ if (ybot <= s->pt.y && s->pt.y <= ytop)
+ choose_by_vector(c->p2.x, c->p2.y, s->pt.x, s->pt.y, s, slope, len, store_segm, store_x, store_y);
} else {
- vd_bar(p->pt.x, p->pt.y, s->pt.x, s->pt.y, 0, VD_HINT_COLOR);
- choose_by_vector(s->pt.x, s->pt.y, p->pt.x, p->pt.y, s, slope, len, store_segm, store_x, store_y);
+ vd_bar(p->pt.x, p->pt.y, s->pt.x, s->pt.y, 0, VD_HINT_COLOR);
+ choose_by_vector(s->pt.x, s->pt.y, p->pt.x, p->pt.y, s, slope, len, store_segm, store_x, store_y);
}
}
-static gx_san_trap *
+static gx_san_trap *
upper_neighbour(gx_san_trap *t0, int left_right)
{
gx_san_trap_contact *cont = t0->upper, *c0 = cont, *c;
fixed x = (!left_right ? cont->upper->xlbot : cont->upper->xrbot);
for (c = c0->next; c != c0; c = c->next) {
- fixed xx = (!left_right ? c->upper->xlbot : c->upper->xrbot);
+ fixed xx = (!left_right ? c->upper->xlbot : c->upper->xrbot);
- if ((xx - x) * (left_right * 2 - 1) > 0) {
- cont = c;
- x = xx;
- }
+ if ((xx - x) * (left_right * 2 - 1) > 0) {
+ cont = c;
+ x = xx;
+ }
}
return cont->upper;
}
@@ -682,57 +679,57 @@ hint_by_tangent(gx_device_spot_analyzer *padev, int side_mask,
const segment *s, *p;
int left_right = (side_mask & 1 ? 0 : 1);
int code;
-
+
sect.l = sect.r = NULL;
sect.xl = t0->xltop; /* only for vdtrace. */
sect.xr = t0->xrtop; /* only for vdtrace. */
sect.yl = sect.yr = t0->ytop; /* only for vdtrace. */
sect.side_mask = side_mask;
for (t = t0; ; t = upper_neighbour(t, left_right)) {
- if (side_mask & 1) {
- s = t->l;
- if (t->dir_l < 0)
- s = (s->type == s_line_close ? ((const line_close_segment *)s)->sub->next : s->next);
- p = (s->type == s_start ? ((const subpath *)s)->last->prev : s->prev);
- choose_by_tangent(p, s, &slope0, &len0, &sect.l, &sect.xl, &sect.yl, t->ybot, t->ytop);
- }
- if (side_mask & 2) {
- s = t->r;
- if (t->dir_r < 0)
- s = (s->type == s_line_close ? ((const line_close_segment *)s)->sub->next : s->next);
- p = (s->type == s_start ? ((const subpath *)s)->last->prev : s->prev);
- choose_by_tangent(p, s, &slope1, &len1, &sect.r, &sect.xr, &sect.yr, t->ybot, t->ytop);
- }
- if (t == t1)
- break;
- }
- if ((sect.l != NULL || !(side_mask & 1)) &&
- (sect.r != NULL || !(side_mask & 2))) {
- const int w = 3;
-
- if (!(side_mask & 1)) {
- if (sect.xr < (padev->xmin * w + padev->xmax) / (w + 1))
- return 0;
- sect.xl = padev->xmin - 1000; /* ignore side */
- }
- if (!(side_mask & 2)) {
- if (sect.xl > (padev->xmax * w + padev->xmin) / (w + 1))
- return 0;
- sect.xr = padev->xmax + 1000; /* ignore side */
- }
- vd_bar(sect.xl, sect.yl, sect.xr, sect.yr, 0, VD_HINT_COLOR);
- code = handler(client_data, &sect);
- if (code < 0)
- return code;
+ if (side_mask & 1) {
+ s = t->l;
+ if (t->dir_l < 0)
+ s = (s->type == s_line_close ? ((const line_close_segment *)s)->sub->next : s->next);
+ p = (s->type == s_start ? ((const subpath *)s)->last->prev : s->prev);
+ choose_by_tangent(p, s, &slope0, &len0, &sect.l, &sect.xl, &sect.yl, t->ybot, t->ytop);
+ }
+ if (side_mask & 2) {
+ s = t->r;
+ if (t->dir_r < 0)
+ s = (s->type == s_line_close ? ((const line_close_segment *)s)->sub->next : s->next);
+ p = (s->type == s_start ? ((const subpath *)s)->last->prev : s->prev);
+ choose_by_tangent(p, s, &slope1, &len1, &sect.r, &sect.xr, &sect.yr, t->ybot, t->ytop);
+ }
+ if (t == t1)
+ break;
+ }
+ if ((sect.l != NULL || !(side_mask & 1)) &&
+ (sect.r != NULL || !(side_mask & 2))) {
+ const int w = 3;
+
+ if (!(side_mask & 1)) {
+ if (sect.xr < (padev->xmin * w + padev->xmax) / (w + 1))
+ return 0;
+ sect.xl = padev->xmin - 1000; /* ignore side */
+ }
+ if (!(side_mask & 2)) {
+ if (sect.xl > (padev->xmax * w + padev->xmin) / (w + 1))
+ return 0;
+ sect.xr = padev->xmax + 1000; /* ignore side */
+ }
+ vd_bar(sect.xl, sect.yl, sect.xr, sect.yr, 0, VD_HINT_COLOR);
+ code = handler(client_data, &sect);
+ if (code < 0)
+ return code;
}
return 0;
}
/* Generate stems. */
-static int
-gx_san_generate_stems_aux(gx_device_spot_analyzer *padev,
- bool overall_hints, void *client_data,
- int (*handler)(void *client_data, gx_san_sect *ss))
+static int
+gx_san_generate_stems_aux(gx_device_spot_analyzer *padev,
+ bool overall_hints, void *client_data,
+ int (*handler)(void *client_data, gx_san_sect *ss))
{
gx_san_trap *t0;
const bool by_trap = false;
@@ -740,116 +737,116 @@ gx_san_generate_stems_aux(gx_device_spot_analyzer *padev,
/* Overall hints : */
/* An overall hint designates an outer side of a glyph,
- being nearly parallel to a coordinate axis.
+ being nearly parallel to a coordinate axis.
It aligns a stem end rather than stem sides.
See t1_hinter__overall_hstem.
*/
for (k = 0; overall_hints && k < 2; k++) { /* left, right. */
- for (t0 = padev->trap_buffer; t0 != padev->trap_free; t0 = t0->link) {
- if (!t0->visited && (!k ? t0->leftmost : t0->rightmost)) {
- if (is_stem_boundaries(t0, 1 << k)) {
- gx_san_trap *t1 = t0, *tt = t0, *t = t0;
- int code;
-
- while (t->upper != NULL) {
- t = upper_neighbour(tt, k);
- if (!k ? !t->leftmost : !t->rightmost) {
- break;
- }
- if (!is_stem_boundaries(t, 1 << k)) {
- t->visited = true;
- break;
- }
- if ((!k ? tt->xltop : tt->xrtop) != (!k ? t->xlbot : t->xrbot))
- break; /* Not a contigouos boundary. */
- t->visited = true;
- tt = t;
- }
- if (!k ? !t->leftmost : !t->rightmost)
- continue;
- t1 = t;
- /* leftmost/rightmost boundary from t0 to t1. */
- code = hint_by_tangent(padev, 1 << k, client_data, t0, t1, 0, handler);
- if (code < 0)
- return code;
- }
- }
- }
- for (t0 = padev->trap_buffer; t0 != padev->trap_free; t0 = t0->link)
- t0->visited = false;
+ for (t0 = padev->trap_buffer; t0 != padev->trap_free; t0 = t0->link) {
+ if (!t0->visited && (!k ? t0->leftmost : t0->rightmost)) {
+ if (is_stem_boundaries(t0, 1 << k)) {
+ gx_san_trap *t1 = t0, *tt = t0, *t = t0;
+ int code;
+
+ while (t->upper != NULL) {
+ t = upper_neighbour(tt, k);
+ if (!k ? !t->leftmost : !t->rightmost) {
+ break;
+ }
+ if (!is_stem_boundaries(t, 1 << k)) {
+ t->visited = true;
+ break;
+ }
+ if ((!k ? tt->xltop : tt->xrtop) != (!k ? t->xlbot : t->xrbot))
+ break; /* Not a contigouos boundary. */
+ t->visited = true;
+ tt = t;
+ }
+ if (!k ? !t->leftmost : !t->rightmost)
+ continue;
+ t1 = t;
+ /* leftmost/rightmost boundary from t0 to t1. */
+ code = hint_by_tangent(padev, 1 << k, client_data, t0, t1, 0, handler);
+ if (code < 0)
+ return code;
+ }
+ }
+ }
+ for (t0 = padev->trap_buffer; t0 != padev->trap_free; t0 = t0->link)
+ t0->visited = false;
}
/* Stem hints : */
for (t0 = padev->trap_buffer; t0 != padev->trap_free; t0 = t0->link) {
- if (!t0->visited) {
- if (is_stem_boundaries(t0, 3)) {
- gx_san_trap_contact *cont = t0->upper;
- gx_san_trap *t1 = t0, *t;
- double area = 0, length = 0, ave_width;
-
- while(cont != NULL && cont->next == cont /* <= 1 descendent. */) {
- gx_san_trap *t = cont->upper;
-
- if (!is_stem_boundaries(t, 3)) {
- t->visited = true;
- break;
- }
- if (t->fork > 1)
- break; /* > 1 accendents. */
- if (t1->xltop != t->xlbot || t1->xrtop != t->xrbot)
- break; /* Not a contigouos boundary. */
- t1 = t;
- cont = t1->upper;
- t1->visited = true;
- }
- /* We've got a stem suspection from t0 to t1. */
- vd_quad(t0->xlbot, t0->ybot, t0->xrbot, t0->ybot,
- t1->xrtop, t1->ytop, t1->xltop, t1->ytop, 1, VD_STEM_COLOR);
- for (t = t0; ; t = t->upper->upper) {
- length += trap_axis_length(t);
- area += trap_area(t);
- if (t == t1)
- break;
- }
- ave_width = area / length;
- if (length > ave_width / ( 2.0 /* arbitrary */)) {
- /* We've got a stem from t0 to t1. */
- int code = (by_trap ? hint_by_trap : hint_by_tangent)(padev,
- 3, client_data, t0, t1, ave_width, handler);
-
- if (code < 0)
- return code;
- }
- }
- }
- t0->visited = true;
+ if (!t0->visited) {
+ if (is_stem_boundaries(t0, 3)) {
+ gx_san_trap_contact *cont = t0->upper;
+ gx_san_trap *t1 = t0, *t;
+ double area = 0, length = 0, ave_width;
+
+ while(cont != NULL && cont->next == cont /* <= 1 descendent. */) {
+ gx_san_trap *t = cont->upper;
+
+ if (!is_stem_boundaries(t, 3)) {
+ t->visited = true;
+ break;
+ }
+ if (t->fork > 1)
+ break; /* > 1 accendents. */
+ if (t1->xltop != t->xlbot || t1->xrtop != t->xrbot)
+ break; /* Not a contigouos boundary. */
+ t1 = t;
+ cont = t1->upper;
+ t1->visited = true;
+ }
+ /* We've got a stem suspection from t0 to t1. */
+ vd_quad(t0->xlbot, t0->ybot, t0->xrbot, t0->ybot,
+ t1->xrtop, t1->ytop, t1->xltop, t1->ytop, 1, VD_STEM_COLOR);
+ for (t = t0; ; t = t->upper->upper) {
+ length += trap_axis_length(t);
+ area += trap_area(t);
+ if (t == t1)
+ break;
+ }
+ ave_width = area / length;
+ if (length > ave_width / ( 2.0 /* arbitrary */)) {
+ /* We've got a stem from t0 to t1. */
+ int code = (by_trap ? hint_by_trap : hint_by_tangent)(padev,
+ 3, client_data, t0, t1, ave_width, handler);
+
+ if (code < 0)
+ return code;
+ }
+ }
+ }
+ t0->visited = true;
}
return 0;
}
-int
-gx_san_generate_stems(gx_device_spot_analyzer *padev,
- bool overall_hints, void *client_data,
- int (*handler)(void *client_data, gx_san_sect *ss))
+int
+gx_san_generate_stems(gx_device_spot_analyzer *padev,
+ bool overall_hints, void *client_data,
+ int (*handler)(void *client_data, gx_san_sect *ss))
{
int code;
bool got_dc = false;
vd_save;
if (vd_allowed('F') || vd_allowed('f')) {
- if (!vd_enabled) {
- vd_get_dc('f');
- got_dc = vd_enabled;
- }
- if (vd_enabled) {
- vd_set_shift(0, 0);
- vd_set_scale(VD_SCALE);
- vd_set_origin(0, 0);
- }
+ if (!vd_enabled) {
+ vd_get_dc('f');
+ got_dc = vd_enabled;
+ }
+ if (vd_enabled) {
+ vd_set_shift(0, 0);
+ vd_set_scale(VD_SCALE);
+ vd_set_origin(0, 0);
+ }
} else
- vd_disable;
+ vd_disable;
code = gx_san_generate_stems_aux(padev, overall_hints, client_data, handler);
if (got_dc)
- vd_release_dc;
+ vd_release_dc;
vd_restore;
return code;
}
diff --git a/gs/base/gzspotan.h b/gs/base/gzspotan.h
index a58584519..d74288d64 100644
--- a/gs/base/gzspotan.h
+++ b/gs/base/gzspotan.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,9 +15,9 @@
/* State and interface definitions for a spot analyzer device. */
/*
- * A spot analyzer device performs an analyzis while handling an output
+ * A spot analyzer device performs an analyzis while handling an output
* of the trapezoid fill algorithm for 2 purposes :
- * a glyph grid fitting, and
+ * a glyph grid fitting, and
* a glyph antialiased rendering any number of alpha bits.
* Currently we only implement a vertical stem recognition for the grid fitting.
*/
@@ -107,9 +107,9 @@ struct gx_device_spot_analyzer_s {
extern_st(st_device_spot_analyzer);
#define public_st_device_spot_analyzer() /* When GC is invoked, only the buffer links are valid. */\
gs_public_st_suffix_add4_final(st_device_spot_analyzer, gx_device_spot_analyzer,\
- "gx_device_spot_analyzer", device_spot_analyzer_enum_ptrs,\
- device_spot_analyzer_reloc_ptrs, gx_device_finalize, st_device,\
- trap_buffer, trap_buffer_last, cont_buffer, cont_buffer_last)
+ "gx_device_spot_analyzer", device_spot_analyzer_enum_ptrs,\
+ device_spot_analyzer_reloc_ptrs, gx_device_finalize, st_device,\
+ trap_buffer, trap_buffer_last, cont_buffer, cont_buffer_last)
/* -------------- Interface methods ----------------------------- */
@@ -124,7 +124,7 @@ void gx_san_begin(gx_device_spot_analyzer *padev);
/* Store a tarpezoid. */
/* Assumes an Y-band scanning order with increasing X inside a band. */
-int gx_san_trap_store(gx_device_spot_analyzer *padev,
+int gx_san_trap_store(gx_device_spot_analyzer *padev,
fixed ybot, fixed ytop, fixed xlbot, fixed xrbot, fixed xltop, fixed xrtop,
const segment *l, const segment *r, int dir_l, int dir_r);
@@ -132,9 +132,9 @@ int gx_san_trap_store(gx_device_spot_analyzer *padev,
void gx_san_end(const gx_device_spot_analyzer *padev);
/* Generate stems. */
-int gx_san_generate_stems(gx_device_spot_analyzer *padev,
- bool overall_hints, void *client_data,
- int (*handler)(void *client_data, gx_san_sect *ss));
+int gx_san_generate_stems(gx_device_spot_analyzer *padev,
+ bool overall_hints, void *client_data,
+ int (*handler)(void *client_data, gx_san_sect *ss));
/* -------------- Other external symbols ------------------------ */
diff --git a/gs/base/gzstate.h b/gs/base/gzstate.h
index 3c302118f..220cc4fa2 100644
--- a/gs/base/gzstate.h
+++ b/gs/base/gzstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -89,7 +89,7 @@ struct gs_state_s {
bool ctm_inverse_valid; /* true if ctm_inverse = ctm^-1 */
gs_matrix ctm_default;
bool ctm_default_set; /* if true, use ctm_default; */
- /* if false, ask device */
+ /* if false, ask device */
/* Paths: */
gx_path *path;
@@ -101,7 +101,7 @@ struct gs_state_s {
gs_id effective_clip_id; /* (key) clip path id */
gs_id effective_view_clip_id; /* (key) view clip path id */
gx_clip_path *effective_clip_path; /* (value) effective clip path, */
- /* possibly = clip_path or view_clip */
+ /* possibly = clip_path or view_clip */
bool effective_clip_shared; /* true iff e.c.p. = c.p. or v.c. */
#define gs_currentdevicecolor_inline(pgs) \
@@ -119,7 +119,7 @@ struct gs_state_s {
gs_client_color *ccolor;
gx_device_color *dev_color;
} color[2];
-
+
/* Font: */
gs_font *font;
@@ -130,7 +130,7 @@ struct gs_state_s {
gs_in_cache_device_t in_cachedevice; /* (see gscpm.h) */
gs_char_path_mode in_charpath; /* (see gscpm.h) */
gs_state *show_gstate; /* gstate when show was invoked */
- /* (so charpath can append to path) */
+ /* (so charpath can append to path) */
/* Other stuff: */
@@ -166,7 +166,7 @@ struct gs_state_s {
m(15,transparency_group_stack)
#define gs_state_num_ptrs 16
-/* The following macro is used for development purpose for designating places
+/* The following macro is used for development purpose for designating places
where current point is changed. Clients must not use it. */
#define gx_setcurrentpoint(pgs, xx, yy)\
(pgs)->current_point.x = xx;\
diff --git a/gs/base/jerror_.h b/gs/base/jerror_.h
index 5fbd78c1f..7f510bc4a 100644
--- a/gs/base/jerror_.h
+++ b/gs/base/jerror_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/locale_.h b/gs/base/locale_.h
index bb1fa0956..10245decb 100644
--- a/gs/base/locale_.h
+++ b/gs/base/locale_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/macos_carbon_d_pre.h b/gs/base/macos_carbon_d_pre.h
index 5da3f31cb..8ccb38ec5 100644
--- a/gs/base/macos_carbon_d_pre.h
+++ b/gs/base/macos_carbon_d_pre.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/macos_carbon_pre.h b/gs/base/macos_carbon_pre.h
index 4e331c58b..4d05da9ef 100644
--- a/gs/base/macos_carbon_pre.h
+++ b/gs/base/macos_carbon_pre.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/macos_classic_d_pre.h b/gs/base/macos_classic_d_pre.h
index 6d1903680..b49655f19 100644
--- a/gs/base/macos_classic_d_pre.h
+++ b/gs/base/macos_classic_d_pre.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,6 +18,6 @@
#define macos_classic_d_pre_INCLUDED
/* turn on (verbose) debugging output */
-#define DEBUG
+#define DEBUG
#endif /* macos_classic_d_pre_INCLUDED */
diff --git a/gs/base/macsystypes.h b/gs/base/macsystypes.h
index c099aa2ff..4c3b950b3 100644
--- a/gs/base/macsystypes.h
+++ b/gs/base/macsystypes.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/malloc_.h b/gs/base/malloc_.h
index 550b684e1..ae15a1c34 100644
--- a/gs/base/malloc_.h
+++ b/gs/base/malloc_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/math_.h b/gs/base/math_.h
index 9f451ee20..e8312b48a 100644
--- a/gs/base/math_.h
+++ b/gs/base/math_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/md5.c b/gs/base/md5.c
index f77a884f8..646191fe3 100644
--- a/gs/base/md5.c
+++ b/gs/base/md5.c
@@ -28,7 +28,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -39,16 +39,16 @@
that follows (in reverse chronological order):
2007-06-08 RG Namespaced the api calls to avoid conflict with other
- implementations when linking gs as a library.
+ implementations when linking gs as a library.
2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
- either statically or dynamically; added missing #include <string.h>
- in library.
+ either statically or dynamically; added missing #include <string.h>
+ in library.
2002-03-11 lpd Corrected argument list for main(), and added int return
- type, in test program and T value program.
+ type, in test program and T value program.
2002-02-21 lpd Added missing #include <stdio.h> in test program.
2000-07-03 lpd Patched to eliminate warnings about "constant is
- unsigned in ANSI C, signed in traditional"; made test program
- self-checking.
+ unsigned in ANSI C, signed in traditional"; made test program
+ self-checking.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
1999-05-03 lpd Original version.
@@ -130,13 +130,12 @@
#define T63 0x2ad7d2bb
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
-
static void
gs_md5_process(gs_md5_state_t *pms, const gs_md5_byte_t *data /*[64]*/)
{
gs_md5_word_t
- a = pms->abcd[0], b = pms->abcd[1],
- c = pms->abcd[2], d = pms->abcd[3];
+ a = pms->abcd[0], b = pms->abcd[1],
+ c = pms->abcd[2], d = pms->abcd[3];
gs_md5_word_t t;
#if BYTE_ORDER > 0
/* Define storage only for big-endian CPUs. */
@@ -149,51 +148,51 @@ gs_md5_process(gs_md5_state_t *pms, const gs_md5_byte_t *data /*[64]*/)
{
#if BYTE_ORDER == 0
- /*
- * Determine dynamically whether this is a big-endian or
- * little-endian machine, since we can use a more efficient
- * algorithm on the latter.
- */
- static const int w = 1;
-
- if (*((const gs_md5_byte_t *)&w)) /* dynamic little-endian */
+ /*
+ * Determine dynamically whether this is a big-endian or
+ * little-endian machine, since we can use a more efficient
+ * algorithm on the latter.
+ */
+ static const int w = 1;
+
+ if (*((const gs_md5_byte_t *)&w)) /* dynamic little-endian */
#endif
#if BYTE_ORDER <= 0 /* little-endian */
- {
- /*
- * On little-endian machines, we can process properly aligned
- * data without copying it.
- */
- if (!((data - (const gs_md5_byte_t *)0) & 3)) {
- /* data are properly aligned */
- X = (const gs_md5_word_t *)data;
- } else {
- /* not aligned */
- memcpy(xbuf, data, 64);
- X = xbuf;
- }
- }
+ {
+ /*
+ * On little-endian machines, we can process properly aligned
+ * data without copying it.
+ */
+ if (!((data - (const gs_md5_byte_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const gs_md5_word_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+ }
#endif
#if BYTE_ORDER == 0
- else /* dynamic big-endian */
+ else /* dynamic big-endian */
#endif
#if BYTE_ORDER >= 0 /* big-endian */
- {
- /*
- * On big-endian machines, we must arrange the bytes in the
- * right order.
- */
- const gs_md5_byte_t *xp = data;
- int i;
+ {
+ /*
+ * On big-endian machines, we must arrange the bytes in the
+ * right order.
+ */
+ const gs_md5_byte_t *xp = data;
+ int i;
# if BYTE_ORDER == 0
- X = xbuf; /* (dynamic only) */
+ X = xbuf; /* (dynamic only) */
# else
# define xbuf X /* (static only) */
# endif
- for (i = 0; i < 16; ++i, xp += 4)
- xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
- }
+ for (i = 0; i < 16; ++i, xp += 4)
+ xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ }
#endif
}
@@ -331,54 +330,54 @@ gs_md5_append(gs_md5_state_t *pms, const gs_md5_byte_t *data, int nbytes)
gs_md5_word_t nbits = (gs_md5_word_t)(nbytes << 3);
if (nbytes <= 0)
- return;
+ return;
/* Update the message length. */
pms->count[1] += nbytes >> 29;
pms->count[0] += nbits;
if (pms->count[0] < nbits)
- pms->count[1]++;
+ pms->count[1]++;
/* Process an initial partial block. */
if (offset) {
- int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
-
- memcpy(pms->buf + offset, p, copy);
- if (offset + copy < 64)
- return;
- p += copy;
- left -= copy;
- gs_md5_process(pms, pms->buf);
+ int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buf + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ gs_md5_process(pms, pms->buf);
}
/* Process full blocks. */
for (; left >= 64; p += 64, left -= 64)
- gs_md5_process(pms, p);
+ gs_md5_process(pms, p);
/* Process a final partial block. */
if (left)
- memcpy(pms->buf, p, left);
+ memcpy(pms->buf, p, left);
}
void
gs_md5_finish(gs_md5_state_t *pms, gs_md5_byte_t digest[16])
{
static const gs_md5_byte_t pad[64] = {
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
gs_md5_byte_t data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
- data[i] = (gs_md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ data[i] = (gs_md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
gs_md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
gs_md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
- digest[i] = (gs_md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+ digest[i] = (gs_md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
diff --git a/gs/base/md5.h b/gs/base/md5.h
index df63b0a72..107c33666 100644
--- a/gs/base/md5.h
+++ b/gs/base/md5.h
@@ -28,7 +28,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -39,12 +39,12 @@
that follows (in reverse chronological order):
2002-04-13 lpd Removed support for non-ANSI compilers; removed
- references to Ghostscript; clarified derivation from RFC 1321;
- now handles byte order either statically or dynamically.
+ references to Ghostscript; clarified derivation from RFC 1321;
+ now handles byte order either statically or dynamically.
1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
- added conditionalization for C++ compilation from Martin
- Purschke <purschke@bnl.gov>.
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
1999-05-03 lpd Original version.
*/
@@ -72,7 +72,7 @@ typedef struct gs_md5_state_s {
} gs_md5_state_t;
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
diff --git a/gs/base/md5main.c b/gs/base/md5main.c
index e2f7db133..ed9a192a7 100644
--- a/gs/base/md5main.c
+++ b/gs/base/md5main.c
@@ -28,7 +28,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ http://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
@@ -39,7 +39,7 @@
that follows (in reverse chronological order):
2007-06-08 RG Namespaced the api calls to avoid conflict with other
- implementations when linking gs as a library.
+ implementations when linking gs as a library.
2002-04-13 lpd Splits off main program into a separate file, md5main.c.
*/
@@ -66,38 +66,38 @@ static int
do_test(void)
{
static const char *const test[7*2] = {
- "", "d41d8cd98f00b204e9800998ecf8427e",
- "a", "0cc175b9c0f1b6a831c399e269772661",
- "abc", "900150983cd24fb0d6963f7d28e17f72",
- "message digest", "f96b697d7cb7938d525a2f31aaf161d0",
- "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b",
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
- "d174ab98d277d9f5a5611c2c9f419d9f",
- "12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"
+ "", "d41d8cd98f00b204e9800998ecf8427e",
+ "a", "0cc175b9c0f1b6a831c399e269772661",
+ "abc", "900150983cd24fb0d6963f7d28e17f72",
+ "message digest", "f96b697d7cb7938d525a2f31aaf161d0",
+ "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
+ "d174ab98d277d9f5a5611c2c9f419d9f",
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a"
};
int i;
int status = 0;
for (i = 0; i < 7*2; i += 2) {
- gs_md5_state_t state;
- gs_md5_byte_t digest[16];
- char hex_output[16*2 + 1];
- int di;
-
- gs_md5_init(&state);
- gs_md5_append(&state, (const gs_md5_byte_t *)test[i], strlen(test[i]));
- gs_md5_finish(&state, digest);
- for (di = 0; di < 16; ++di)
- sprintf(hex_output + di * 2, "%02x", digest[di]);
- if (strcmp(hex_output, test[i + 1])) {
- printf("MD5 (\"%s\") = ", test[i]);
- puts(hex_output);
- printf("**** ERROR, should be: %s\n", test[i + 1]);
- status = 1;
- }
+ gs_md5_state_t state;
+ gs_md5_byte_t digest[16];
+ char hex_output[16*2 + 1];
+ int di;
+
+ gs_md5_init(&state);
+ gs_md5_append(&state, (const gs_md5_byte_t *)test[i], strlen(test[i]));
+ gs_md5_finish(&state, digest);
+ for (di = 0; di < 16; ++di)
+ sprintf(hex_output + di * 2, "%02x", digest[di]);
+ if (strcmp(hex_output, test[i + 1])) {
+ printf("MD5 (\"%s\") = ", test[i]);
+ puts(hex_output);
+ printf("**** ERROR, should be: %s\n", test[i + 1]);
+ status = 1;
+ }
}
if (status == 0)
- puts("md5 self-test completed successfully.");
+ puts("md5 self-test completed successfully.");
return status;
}
@@ -107,18 +107,18 @@ do_t_values(void)
{
int i;
for (i = 1; i <= 64; ++i) {
- unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i)));
-
- /*
- * The following nonsense is only to avoid compiler warnings about
- * "integer constant is unsigned in ANSI C, signed with -traditional".
- */
- if (v >> 31) {
- printf("#define T%d /* 0x%08lx */ (T_MASK ^ 0x%08lx)\n", i,
- v, (unsigned long)(unsigned int)(~v));
- } else {
- printf("#define T%d 0x%08lx\n", i, v);
- }
+ unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i)));
+
+ /*
+ * The following nonsense is only to avoid compiler warnings about
+ * "integer constant is unsigned in ANSI C, signed with -traditional".
+ */
+ if (v >> 31) {
+ printf("#define T%d /* 0x%08lx */ (T_MASK ^ 0x%08lx)\n", i,
+ v, (unsigned long)(unsigned int)(~v));
+ } else {
+ printf("#define T%d 0x%08lx\n", i, v);
+ }
}
return 0;
}
@@ -128,14 +128,14 @@ int
main(int argc, char *argv[])
{
if (argc == 2) {
- if (!strcmp(argv[1], "--test"))
- return do_test();
- if (!strcmp(argv[1], "--t-values"))
- return do_t_values();
- if (!strcmp(argv[1], "--version")) {
- puts(version);
- return 0;
- }
+ if (!strcmp(argv[1], "--test"))
+ return do_test();
+ if (!strcmp(argv[1], "--t-values"))
+ return do_t_values();
+ if (!strcmp(argv[1], "--version")) {
+ puts(version);
+ return 0;
+ }
}
puts(usage);
return 0;
diff --git a/gs/base/memory_.h b/gs/base/memory_.h
index 4aafc29f6..9a5d5a0d5 100644
--- a/gs/base/memory_.h
+++ b/gs/base/memory_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,20 +34,20 @@
# endif
# include <mem.h>
#else
- /* Not Turbo C, no inline functions */
+ /* Not Turbo C, no inline functions */
# define memcmp_inline(b1,b2,len) memcmp(b1,b2,len)
- /*
- * Apparently the newer VMS compilers include prototypes
- * for the mem... routines in <string.h>. Unfortunately,
- * gcc lies on Sun systems: it defines __STDC__ even if
- * the header files in /usr/include are broken.
- * However, Solaris systems, which define __svr4__, do have
- * correct header files.
- */
- /*
- * The exceptions vastly outnumber the BSD4_2 "rule":
- * these tests should be the other way around....
- */
+ /*
+ * Apparently the newer VMS compilers include prototypes
+ * for the mem... routines in <string.h>. Unfortunately,
+ * gcc lies on Sun systems: it defines __STDC__ even if
+ * the header files in /usr/include are broken.
+ * However, Solaris systems, which define __svr4__, do have
+ * correct header files.
+ */
+ /*
+ * The exceptions vastly outnumber the BSD4_2 "rule":
+ * these tests should be the other way around....
+ */
# if defined(VMS) || defined(_POSIX_SOURCE) || (defined(__STDC__) && (!defined(sun) || defined(__svr4__))) || defined(_HPUX_SOURCE) || defined(__WATCOMC__) || defined(THINK_C) || defined(bsdi) || defined(__FreeBSD) || (defined(_MSC_VER) && _MSC_VER >= 1000)
# include <string.h>
# else
@@ -56,7 +56,7 @@ extern bcopy(), bcmp(), bzero();
# define memcpy(dest,src,len) bcopy(src,dest,len)
# define memcmp(b1,b2,len) bcmp(b1,b2,len)
- /* Define our own versions of missing routines (in gsmisc.c). */
+ /* Define our own versions of missing routines (in gsmisc.c). */
# define MEMORY__NEED_MEMMOVE
# include <sys/types.h> /* for size_t */
# define MEMORY__NEED_MEMSET
diff --git a/gs/base/minftrsz.c b/gs/base/minftrsz.c
index b907bb05f..40f36f36f 100644
--- a/gs/base/minftrsz.c
+++ b/gs/base/minftrsz.c
@@ -115,7 +115,6 @@ min_feature_size_init(gs_memory_t *mem, int min_feature_size,
for (i=0; i<256; i++) {
int f = i, l = i, fd = 8, fw;
-
do {
fd = next_one(fd, f); /* value == -1 if past bit_0 */
if (fd < 0)
@@ -347,4 +346,3 @@ fax_adjusted_width(int width)
else
return width;
}
-
diff --git a/gs/base/mkromfs.c b/gs/base/mkromfs.c
index ac642793c..318958747 100644
--- a/gs/base/mkromfs.c
+++ b/gs/base/mkromfs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@
* to "/bin /boot /dev ...". e.g. use "<slash><star>.ttf" or "<slash><star>.ps" instead of "<slash><star>".
*
* options and paths can be interspersed and are processed in order
- *
+ *
* options:
* -o outputfile default: obj/gsromfs.c if this option present, must be first.
* -P prefix use prefix to find path. prefix not included in %rom%
@@ -44,7 +44,7 @@
* -d romprefix directory in %rom% file system (a prefix string on filename)
* -c compression on
* -b compression off (binary).
- * -g initfile gconfig_h
+ * -g initfile gconfig_h
* special handling to read the 'gs_init.ps' file (from
* the current -P prefix path), and read the gconfig.h for
* psfile_ entries and combines them into a whitespace
@@ -58,7 +58,7 @@
* for the init file. Less frequently accessed files, if they
* are large should still be compressed.
*
- */
+ */
#include "stdpre.h"
#include "stdint_.h"
@@ -67,7 +67,7 @@
#include "gsmemret.h" /* for gs_memory_type_ptr_t */
#include "gsmalloc.h"
#include "gsstype.h"
-#include "gp.h"
+#include "gp.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -83,7 +83,7 @@
* in memory structure of each node is:
*
* length_of_uncompressed_file [31-bit big-endian]
- * high bit is compression flag
+ * high bit is compression flag
* data_block_struct[]
* padded_file_name (char *) includes as least one terminating <nul>
* padded_data_blocks
@@ -98,20 +98,20 @@ typedef struct romfs_inode_s {
unsigned long length; /* blocks is (length+ROMFS_BLOCKSIZE-1)/ROMFS_BLOCKSIZE */
char *name; /* nul terminated */
unsigned long *data_lengths; /* this could be short if ROMFS_BLOCKSIZE */
- /* is < 64k, but the cost is small to use int */
+ /* is < 64k, but the cost is small to use int */
unsigned char **data;
} romfs_inode;
typedef struct Xlist_element_s {
- void *next;
- char *path;
+ void *next;
+ char *path;
} Xlist_element;
byte *minimal_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname);
byte *minimal_alloc_byte_array(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname);
+ uint elt_size, client_name_t cname);
void *minimal_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname);
+ client_name_t cname);
void minimal_free_object(gs_memory_t * mem, void * data, client_name_t cname);
void minimal_free_string(gs_memory_t * mem, byte * data, uint nbytes, client_name_t cname);
@@ -126,14 +126,14 @@ minimal_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
byte *
minimal_alloc_byte_array(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
return malloc(num_elements * elt_size);
}
void *
minimal_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
return malloc(pstype->ssize);
}
@@ -165,7 +165,6 @@ void basic_reloc_ptrs() {
exit(1);
}
-
const gs_malloc_memory_t minimal_memory = {
(gs_memory_t *)&minimal_memory, /* stable */
{ minimal_alloc_bytes, /* alloc_bytes_immovable */
@@ -175,7 +174,7 @@ const gs_malloc_memory_t minimal_memory = {
NULL, /* status */
NULL, /* free_all */
NULL, /* consolidate_free */
- minimal_alloc_bytes, /* alloc_bytes */
+ minimal_alloc_bytes, /* alloc_bytes */
minimal_alloc_struct, /* alloc_struct */
minimal_alloc_struct, /* alloc_struct_immovable */
minimal_alloc_byte_array, /* alloc_byte_array */
@@ -188,16 +187,16 @@ const gs_malloc_memory_t minimal_memory = {
minimal_alloc_bytes, /* alloc_string_immovable */
NULL, /* resize_string */
minimal_free_string, /* free_string */
- NULL, /* register_root */
+ NULL, /* register_root */
NULL, /* unregister_root */
- NULL /* enable_free */
- },
+ NULL /* enable_free */
+ },
NULL, /* gs_lib_ctx */
NULL, /* head */
NULL, /* non_gc_memory */
0, /* allocated */
- 0, /* limit */
- 0, /* used */
+ 0, /* limit */
+ 0, /* used */
0 /* max used */
};
@@ -206,11 +205,11 @@ void put_bytes_padded(FILE *out, unsigned char *p, unsigned int len);
void inode_clear(romfs_inode* node);
void inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int*totlen);
void process_path(char *path, const char *os_prefix, const char *rom_prefix,
- Xlist_element *Xlist_head,
- int compression, int *inode_count, int *totlen, FILE *out);
+ Xlist_element *Xlist_head,
+ int compression, int *inode_count, int *totlen, FILE *out);
int process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
- const char *rom_prefix,
- int compression, int *inode_count, int *totlen, FILE *out);
+ const char *rom_prefix,
+ int compression, int *inode_count, int *totlen, FILE *out);
FILE *prefix_open(const char *os_prefix, const char *inname);
void prefix_add(const char *prefix, const char *filename, char *prefixed_path);
@@ -229,24 +228,24 @@ void put_bytes_padded(FILE *out, unsigned char *p, unsigned int len)
{
int i, j=0;
union {
- uint32_t w;
- struct {
- unsigned char c1;
- unsigned char c2;
- unsigned char c3;
- unsigned char c4;
- } c;
+ uint32_t w;
+ struct {
+ unsigned char c1;
+ unsigned char c2;
+ unsigned char c3;
+ unsigned char c4;
+ } c;
} w2c;
for (i=0; i<(len/4); i++) {
- j = i*4;
- w2c.c.c1 = p[j++];
- w2c.c.c2 = p[j++];
- w2c.c.c3 = p[j++];
- w2c.c.c4 = p[j++];
- fprintf(out, "0x%08x,", w2c.w);
- if ((i & 7) == 7)
- fprintf(out, "\n\t");
+ j = i*4;
+ w2c.c.c1 = p[j++];
+ w2c.c.c2 = p[j++];
+ w2c.c.c3 = p[j++];
+ w2c.c.c4 = p[j++];
+ fprintf(out, "0x%08x,", w2c.w);
+ if ((i & 7) == 7)
+ fprintf(out, "\n\t");
}
w2c.w = 0;
switch (len - j) {
@@ -256,7 +255,7 @@ void put_bytes_padded(FILE *out, unsigned char *p, unsigned int len)
w2c.c.c2 = p[j+1];
case 1:
w2c.c.c1 = p[j];
- fprintf(out, "0x%08x,", w2c.w);
+ fprintf(out, "0x%08x,", w2c.w);
default: ;
}
fprintf(out, "\n\t");
@@ -266,7 +265,7 @@ void put_bytes_padded(FILE *out, unsigned char *p, unsigned int len)
void inode_clear(romfs_inode* node)
{
int i, blocks = (node->length+ROMFS_BLOCKSIZE-1)/ROMFS_BLOCKSIZE;
-
+
if (node) {
if (node->data) {
for (i = 0; i < blocks; i++) {
@@ -286,38 +285,38 @@ inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int
int blocks = (node->length+ROMFS_BLOCKSIZE-1)/ROMFS_BLOCKSIZE;
int namelen = strlen(node->name) + 1; /* include terminating <nul> */
int clen = 0; /* compressed length */
-
+
/* write the node header */
fprintf(out," static uint32_t node_%d[] = {\n\t", inode_count);
/* 4 byte file length + compression flag in high bit */
put_uint32(out, node->length | (compression ? 0x80000000 : 0));
fprintf(out, "\t/* compression_flag_bit + file length */\n\t");
-
+
/* write out data block structures */
offset = 4 + (8*blocks) + ((namelen+3) & ~3);
*totlen += offset; /* add in the header size */
for (i = 0; i < blocks; i++) {
- put_uint32(out, node->data_lengths[i]);
- put_uint32(out, offset);
- offset += (node->data_lengths[i]+3) & ~3;
- fprintf(out, "\t/* data_block_length, offset to data_block */\n\t");
+ put_uint32(out, node->data_lengths[i]);
+ put_uint32(out, offset);
+ offset += (node->data_lengths[i]+3) & ~3;
+ fprintf(out, "\t/* data_block_length, offset to data_block */\n\t");
}
/* write file name (path) padded to 4 byte multiple */
fprintf(out, "\t/* file name '%s' */\n\t", node->name);
put_bytes_padded(out, (unsigned char *)node->name, namelen);
-
+
/* write out data */
for (i = 0; i < blocks; i++) {
- put_bytes_padded(out, node->data[i], node->data_lengths[i]);
- clen += node->data_lengths[i];
- *totlen += (node->data_lengths[i]+3) & ~3; /* padded block length */
+ put_bytes_padded(out, node->data[i], node->data_lengths[i]);
+ clen += node->data_lengths[i];
+ *totlen += (node->data_lengths[i]+3) & ~3; /* padded block length */
}
fprintf(out, "\t0 };\t/* end-of-node */\n");
printf("node '%s' len=%ld", node->name, node->length);
printf(" %ld blocks", blocks);
if (compression) {
- printf(", compressed size=%ld", clen);
+ printf(", compressed size=%ld", clen);
}
printf("\n");
}
@@ -331,11 +330,11 @@ prefix_add(const char *prefix, const char *filename, char *prefixed_path)
#if defined(__WIN32__) || defined(__OS2__)
/* On Windows, the paths may (will) have '\' instead of '/' so we translate them */
{
- int i;
+ int i;
- for (i=0; i<strlen(prefixed_path); i++)
- if (prefixed_path[i] == '\\')
- prefixed_path[i] = '/';
+ for (i=0; i<strlen(prefixed_path); i++)
+ if (prefixed_path[i] == '\\')
+ prefixed_path[i] = '/';
}
#endif
}
@@ -344,7 +343,7 @@ prefix_add(const char *prefix, const char *filename, char *prefixed_path)
/* should it recurse into directories (unlike Adobe's implementation) */
/* paths are checked to see if they are an ordinary file or a path */
void process_path(char *path, const char *os_prefix, const char *rom_prefix, Xlist_element *Xlist_head,
- int compression, int *inode_count, int *totlen, FILE *out)
+ int compression, int *inode_count, int *totlen, FILE *out)
{
int namelen, excluded, save_count=*inode_count;
Xlist_element *Xlist_scan;
@@ -363,9 +362,9 @@ void process_path(char *path, const char *os_prefix, const char *rom_prefix, Xli
ubuf = malloc(ROMFS_BLOCKSIZE);
cbuf = malloc(ROMFS_CBUFSIZE);
if (ubuf == NULL || cbuf == NULL || prefixed_path == NULL ||
- found_path == NULL || rom_filename == NULL) {
- printf("malloc fail in process_path\n");
- exit(1);
+ found_path == NULL || rom_filename == NULL) {
+ printf("malloc fail in process_path\n");
+ exit(1);
}
prefix_add(os_prefix, path, prefixed_path);
prefix_add(rom_prefix, "", rom_filename);
@@ -373,81 +372,81 @@ void process_path(char *path, const char *os_prefix, const char *rom_prefix, Xli
/* check for the file on the Xlist */
pfenum = gp_enumerate_files_init(prefixed_path, strlen(prefixed_path),
- (gs_memory_t *)&minimal_memory);
+ (gs_memory_t *)&minimal_memory);
if (pfenum == NULL) {
- printf("gp_enumerate_files_init failed.\n");
- exit(1);
+ printf("gp_enumerate_files_init failed.\n");
+ exit(1);
}
while ((namelen=gp_enumerate_files_next(pfenum, found_path, 1024)) >= 0) {
- excluded = 0;
- found_path[namelen] = 0; /* terminate the string */
- /* check to see if the tail of the path we found matches one on the exclusion list */
- for (Xlist_scan = Xlist_head; Xlist_scan != NULL; Xlist_scan = Xlist_scan->next) {
- if (strlen(found_path) >= strlen(Xlist_scan->path)) {
- if (strcmp(Xlist_scan->path, found_path+strlen(found_path)-strlen(Xlist_scan->path)) == 0) {
- excluded = 1;
- break;
- }
- }
- }
- if (excluded)
- continue;
-
- /* process a file */
- node = calloc(1, sizeof(romfs_inode));
- /* get info for this file */
- in = fopen(found_path, "rb");
- if (in == NULL) {
- printf("unable to open file for processing: %s\n", found_path);
- continue;
- }
- /* rom_filename + strlen(rom_prefix) is first char after the new prefix we want to add */
- /* found_path + strlen(os_prefix) is the file name after the -P prefix */
- rom_filename[strlen(rom_prefix)] = 0; /* truncate afater prefix */
- strcat(rom_filename, found_path + strlen(os_prefix));
- node->name = rom_filename; /* without -P prefix, with -d rom_prefix */
- fseek(in, 0, SEEK_END);
- node->length = ftell(in);
- blocks = (node->length+ROMFS_BLOCKSIZE-1) / ROMFS_BLOCKSIZE + 1;
- node->data_lengths = calloc(blocks, sizeof(*node->data_lengths));
- node->data = calloc(blocks, sizeof(*node->data));
- fclose(in);
- in = fopen(found_path, "rb");
- block = 0;
- while (!feof(in)) {
- ulen = fread(ubuf, 1, ROMFS_BLOCKSIZE, in);
- if (!ulen) break;
- clen = ROMFS_CBUFSIZE;
- if (compression) {
- /* compress data here */
- ret = compress(cbuf, &clen, ubuf, ulen);
- if (ret != Z_OK) {
- printf("error compressing data block!\n");
- exit(1);
- }
- } else {
- memcpy(cbuf, ubuf, ulen);
- clen = ulen;
- }
- node->data_lengths[block] = clen;
- node->data[block] = malloc(clen);
- memcpy(node->data[block], cbuf, clen);
- block++;
- }
- fclose(in);
- /* write out data for this file */
- inode_write(out, node, compression, *inode_count, totlen);
- /* clean up */
- inode_clear(node);
- free(node);
- (*inode_count)++;
+ excluded = 0;
+ found_path[namelen] = 0; /* terminate the string */
+ /* check to see if the tail of the path we found matches one on the exclusion list */
+ for (Xlist_scan = Xlist_head; Xlist_scan != NULL; Xlist_scan = Xlist_scan->next) {
+ if (strlen(found_path) >= strlen(Xlist_scan->path)) {
+ if (strcmp(Xlist_scan->path, found_path+strlen(found_path)-strlen(Xlist_scan->path)) == 0) {
+ excluded = 1;
+ break;
+ }
+ }
+ }
+ if (excluded)
+ continue;
+
+ /* process a file */
+ node = calloc(1, sizeof(romfs_inode));
+ /* get info for this file */
+ in = fopen(found_path, "rb");
+ if (in == NULL) {
+ printf("unable to open file for processing: %s\n", found_path);
+ continue;
+ }
+ /* rom_filename + strlen(rom_prefix) is first char after the new prefix we want to add */
+ /* found_path + strlen(os_prefix) is the file name after the -P prefix */
+ rom_filename[strlen(rom_prefix)] = 0; /* truncate afater prefix */
+ strcat(rom_filename, found_path + strlen(os_prefix));
+ node->name = rom_filename; /* without -P prefix, with -d rom_prefix */
+ fseek(in, 0, SEEK_END);
+ node->length = ftell(in);
+ blocks = (node->length+ROMFS_BLOCKSIZE-1) / ROMFS_BLOCKSIZE + 1;
+ node->data_lengths = calloc(blocks, sizeof(*node->data_lengths));
+ node->data = calloc(blocks, sizeof(*node->data));
+ fclose(in);
+ in = fopen(found_path, "rb");
+ block = 0;
+ while (!feof(in)) {
+ ulen = fread(ubuf, 1, ROMFS_BLOCKSIZE, in);
+ if (!ulen) break;
+ clen = ROMFS_CBUFSIZE;
+ if (compression) {
+ /* compress data here */
+ ret = compress(cbuf, &clen, ubuf, ulen);
+ if (ret != Z_OK) {
+ printf("error compressing data block!\n");
+ exit(1);
+ }
+ } else {
+ memcpy(cbuf, ubuf, ulen);
+ clen = ulen;
+ }
+ node->data_lengths[block] = clen;
+ node->data[block] = malloc(clen);
+ memcpy(node->data[block], cbuf, clen);
+ block++;
+ }
+ fclose(in);
+ /* write out data for this file */
+ inode_write(out, node, compression, *inode_count, totlen);
+ /* clean up */
+ inode_clear(node);
+ free(node);
+ (*inode_count)++;
}
free(cbuf);
free(ubuf);
free(found_path);
free(prefixed_path);
if (save_count == *inode_count) {
- printf("warning: no files found from path '%s%s'\n", os_prefix, path);
+ printf("warning: no files found from path '%s%s'\n", os_prefix, path);
}
}
@@ -479,7 +478,7 @@ char *doit(char *line, bool intact);
void hex_string_to_binary(FILE *in);
void flush_buf(char *buf);
void mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
- bool intact);
+ bool intact);
void flush_line_buf(int len);
typedef struct in_block_s in_block_t;
@@ -488,7 +487,6 @@ struct in_block_s {
unsigned char data[ROMFS_BLOCKSIZE];
};
-
#define LINE_SIZE 128
/* Globals used for gs_init processing */
@@ -499,8 +497,8 @@ unsigned char *curr_block_p, *curr_block_end;
int
process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
- const char *rom_prefix, int compression, int *inode_count,
- int *totlen, FILE *out)
+ const char *rom_prefix, int compression, int *inode_count,
+ int *totlen, FILE *out)
{
int ret, block, blocks;
romfs_inode *node;
@@ -516,10 +514,10 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
prefixed_path = malloc(1024);
rom_filename = malloc(1024);
if (ubuf == NULL || cbuf == NULL || prefixed_path == NULL ||
- rom_filename == NULL) {
- printf("malloc fail in process_initfile\n");
- /* should free whichever buffers got allocated, but don't bother */
- return -1;
+ rom_filename == NULL) {
+ printf("malloc fail in process_initfile\n");
+ /* should free whichever buffers got allocated, but don't bother */
+ return -1;
}
prefix_add(os_prefix, initfile, prefixed_path);
@@ -527,14 +525,14 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
in = fopen(prefixed_path, "r");
if (in == 0) {
- printf("cannot open initfile at: %s\n", prefixed_path);
- return -1;
+ printf("cannot open initfile at: %s\n", prefixed_path);
+ return -1;
}
config = fopen(gconfig_h, "r");
if (config == 0) {
- printf("Cannot open gconfig file %s\n", gconfig_h);
- fclose(in);
- return -1;
+ printf("Cannot open gconfig file %s\n", gconfig_h);
+ fclose(in);
+ return -1;
}
memset(linebuf, 0, sizeof(linebuf));
node = calloc(1, sizeof(romfs_inode));
@@ -549,9 +547,9 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
node->length = 0;
in_block = in_block_head;
while (in_block != NULL) {
- node->length +=
- in_block != in_block_tail ? ROMFS_BLOCKSIZE : curr_block_p - in_block->data;
- in_block = in_block->next;
+ node->length +=
+ in_block != in_block_tail ? ROMFS_BLOCKSIZE : curr_block_p - in_block->data;
+ in_block = in_block->next;
}
blocks = (node->length+ROMFS_BLOCKSIZE-1) / ROMFS_BLOCKSIZE + 1;
@@ -561,26 +559,26 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
in_block = in_block_head;
while (in_block != NULL) {
- int block_len =
- in_block != in_block_tail ? ROMFS_BLOCKSIZE : curr_block_p - in_block->data;
-
- clen = ROMFS_CBUFSIZE;
- if (compression) {
- /* compress data here */
- ret = compress(cbuf, &clen, in_block->data, block_len);
- if (ret != Z_OK) {
- printf("error compressing data block!\n");
- exit(1);
- }
- } else {
- memcpy(cbuf, in_block->data, block_len);
- clen = block_len;
- }
- node->data_lengths[block] = clen;
- node->data[block] = malloc(clen);
- memcpy(node->data[block], cbuf, clen);
- block++;
- in_block = in_block->next;
+ int block_len =
+ in_block != in_block_tail ? ROMFS_BLOCKSIZE : curr_block_p - in_block->data;
+
+ clen = ROMFS_CBUFSIZE;
+ if (compression) {
+ /* compress data here */
+ ret = compress(cbuf, &clen, in_block->data, block_len);
+ if (ret != Z_OK) {
+ printf("error compressing data block!\n");
+ exit(1);
+ }
+ } else {
+ memcpy(cbuf, in_block->data, block_len);
+ clen = block_len;
+ }
+ node->data_lengths[block] = clen;
+ node->data[block] = malloc(clen);
+ memcpy(node->data[block], cbuf, clen);
+ block++;
+ in_block = in_block->next;
}
/* write data for this file */
@@ -603,31 +601,31 @@ flush_line_buf(int len) {
int move_len;
if (len > LINE_SIZE) {
- printf("*** warning, flush_line called with len (%d) > LINE_SIZE (%d)\n",
- len, LINE_SIZE);
- return;
+ printf("*** warning, flush_line called with len (%d) > LINE_SIZE (%d)\n",
+ len, LINE_SIZE);
+ return;
}
/* check for empty list and allocate the first block if needed */
if (in_block_tail == NULL) {
- in_block_head = in_block_tail = calloc(1, sizeof(in_block_t));
- in_block_tail->next = NULL; /* calloc really already does this */
- curr_block_p = in_block_head->data;
- curr_block_end = curr_block_p + ROMFS_BLOCKSIZE;
+ in_block_head = in_block_tail = calloc(1, sizeof(in_block_t));
+ in_block_tail->next = NULL; /* calloc really already does this */
+ curr_block_p = in_block_head->data;
+ curr_block_end = curr_block_p + ROMFS_BLOCKSIZE;
}
/* move the data into the in_block buffer */
do {
- move_len = min(remaining_len, curr_block_end - curr_block_p);
+ move_len = min(remaining_len, curr_block_end - curr_block_p);
memcpy(curr_block_p, linebuf, move_len);
- curr_block_p += move_len;
- if (curr_block_p == curr_block_end) {
- /* start a new data block appended to the list of blocks */
- in_block_tail->next = calloc(1, sizeof(in_block_t));
- in_block_tail = in_block_tail->next;
- in_block_tail->next = NULL; /* calloc really already does this */
- curr_block_p = in_block_tail->data;
- curr_block_end = curr_block_p + ROMFS_BLOCKSIZE;
- }
- remaining_len = max(0, remaining_len - move_len);
+ curr_block_p += move_len;
+ if (curr_block_p == curr_block_end) {
+ /* start a new data block appended to the list of blocks */
+ in_block_tail->next = calloc(1, sizeof(in_block_t));
+ in_block_tail = in_block_tail->next;
+ in_block_tail->next = NULL; /* calloc really already does this */
+ curr_block_p = in_block_tail->data;
+ curr_block_end = curr_block_p + ROMFS_BLOCKSIZE;
+ }
+ remaining_len = max(0, remaining_len - move_len);
} while (remaining_len > 0);
/* clear the line (to allow 'strlen' to work if the data is not binary */
@@ -646,18 +644,18 @@ rl(FILE * in, char *str, int len)
int i = 0, c = getc(in);
if (c < 0)
- return false;
+ return false;
while (i < len - 1) {
- if (c < 0 || c == 10) /* ^J, Unix EOL */
- break;
- if (c == 13) { /* ^M, Mac EOL */
- c = getc(in);
- if (c != 10 && c >= 0) /* ^M^J, PC EOL */
- ungetc(c, in);
- break;
- }
- str[i++] = c;
- c = getc(in);
+ if (c < 0 || c == 10) /* ^J, Unix EOL */
+ break;
+ if (c == 13) { /* ^M, Mac EOL */
+ c = getc(in);
+ if (c != 10 && c >= 0) /* ^M^J, PC EOL */
+ ungetc(c, in);
+ break;
+ }
+ str[i++] = c;
+ c = getc(in);
}
str[i] = 0;
return true;
@@ -671,33 +669,33 @@ wsc(const byte *str, int len)
int i;
if (len >= LINE_SIZE)
- exit(1);
+ exit(1);
for (i = 0; i < len; ++i) {
- int c = str[i];
-
- sprintf(linebuf,
- (c < 32 || c >= 127 ? "%d," :
- c == '\'' || c == '\\' ? "'\\%c'," : "'%c',"),
- c);
- flush_line_buf(strlen(linebuf));
- if (++n == 15) {
- linebuf[0] = '\n';
- flush_line_buf(1);
- n = 0;
- }
+ int c = str[i];
+
+ sprintf(linebuf,
+ (c < 32 || c >= 127 ? "%d," :
+ c == '\'' || c == '\\' ? "'\\%c'," : "'%c',"),
+ c);
+ flush_line_buf(strlen(linebuf));
+ if (++n == 15) {
+ linebuf[0] = '\n';
+ flush_line_buf(1);
+ n = 0;
+ }
}
if (n != 0) {
- flush_line_buf(strlen(linebuf));
- linebuf[0] = '\n';
- flush_line_buf(1);
+ flush_line_buf(strlen(linebuf));
+ linebuf[0] = '\n';
+ flush_line_buf(1);
}
}
void
ws(const byte *str, int len)
{
if (len >= LINE_SIZE)
- exit(1);
+ exit(1);
memcpy(linebuf, str, len);
flush_line_buf(len);
@@ -724,15 +722,15 @@ doit(char *line, bool intact)
int in_string = 0;
if (intact)
- return str;
+ return str;
while (*str == ' ' || *str == '\t') /* strip leading whitespace */
- ++str;
+ ++str;
if (*str == 0) /* all whitespace */
- return NULL;
+ return NULL;
if (!strncmp(str, "%END", 4)) /* keep these for .skipeof */
- return str;
+ return str;
if (str[0] == '%') /* comment line */
- return NULL;
+ return NULL;
/*
* Copy the string over itself removing:
* - All comments not within string literals;
@@ -741,43 +739,43 @@ doit(char *line, bool intact)
* - Whitespace after ')' '>'.
*/
for (to = from = str; (*to = *from) != 0; ++from, ++to) {
- switch (*from) {
- case '%':
- if (!in_string)
- break;
- continue;
- case ' ':
- case '\t':
- if (to > str && !in_string && strchr(" \t>[]{})", to[-1]))
- --to;
- continue;
- case '(':
- case '<':
- case '/':
- case '[':
- case ']':
- case '{':
- case '}':
- if (to > str && !in_string && strchr(" \t", to[-1]))
- *--to = *from;
+ switch (*from) {
+ case '%':
+ if (!in_string)
+ break;
+ continue;
+ case ' ':
+ case '\t':
+ if (to > str && !in_string && strchr(" \t>[]{})", to[-1]))
+ --to;
+ continue;
+ case '(':
+ case '<':
+ case '/':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ if (to > str && !in_string && strchr(" \t", to[-1]))
+ *--to = *from;
if (*from == '(')
++in_string;
- continue;
- case ')':
- --in_string;
- continue;
- case '\\':
- if (from[1] == '\\' || from[1] == '(' || from[1] == ')')
- *++to = *++from;
- continue;
- default:
- continue;
- }
- break;
+ continue;
+ case ')':
+ --in_string;
+ continue;
+ case '\\':
+ if (from[1] == '\\' || from[1] == '(' || from[1] == ')')
+ *++to = *++from;
+ continue;
+ default:
+ continue;
+ }
+ break;
}
/* Strip trailing whitespace. */
while (to > str && (to[-1] == ' ' || to[-1] == '\t'))
- --to;
+ --to;
*to = 0;
return str;
}
@@ -795,38 +793,38 @@ hex_string_to_binary(FILE *in)
byte prefix[3];
if (strbuf == 0) {
- printf("Unable to allocate string token buffer.\n");
- exit(1);
+ printf("Unable to allocate string token buffer.\n");
+ exit(1);
}
while ((c = getc(in)) >= 0) {
- if (isxdigit(c)) {
- c -= (isdigit(c) ? '0' : islower(c) ? 'a' : 'A');
- if ((which = !which)) {
- if (q == strbuf + MAX_STR) {
- printf("Can't handle string token > %d bytes.\n",
- MAX_STR);
- exit(1);
- }
- *q++ = c << 4;
- } else
- q[-1] += c;
- } else if (isspace(c))
- continue;
- else if (c == '>')
- break;
- else
- printf("Unknown character in ASCIIHex string: %c\n", c);
+ if (isxdigit(c)) {
+ c -= (isdigit(c) ? '0' : islower(c) ? 'a' : 'A');
+ if ((which = !which)) {
+ if (q == strbuf + MAX_STR) {
+ printf("Can't handle string token > %d bytes.\n",
+ MAX_STR);
+ exit(1);
+ }
+ *q++ = c << 4;
+ } else
+ q[-1] += c;
+ } else if (isspace(c))
+ continue;
+ else if (c == '>')
+ break;
+ else
+ printf("Unknown character in ASCIIHex string: %c\n", c);
}
len = q - strbuf;
if (len <= 255) {
- prefix[0] = 142;
- prefix[1] = (byte)len;
- ws(prefix, 2);
+ prefix[0] = 142;
+ prefix[1] = (byte)len;
+ ws(prefix, 2);
} else {
- prefix[0] = 143;
- prefix[1] = (byte)(len >> 8);
- prefix[2] = (byte)len;
- ws(prefix, 3);
+ prefix[0] = 143;
+ prefix[1] = (byte)(len >> 8);
+ prefix[2] = (byte)len;
+ ws(prefix, 3);
}
ws(strbuf, len);
free((char *)strbuf);
@@ -838,8 +836,8 @@ void
flush_buf(char *buf)
{
if (buf[0] != 0) {
- wl(buf);
- buf[0] = 0;
+ wl(buf);
+ buf[0] = 0;
}
}
@@ -851,8 +849,8 @@ prefix_open(const char *os_prefix, const char *filename)
prefixed_path = malloc(1024);
if (prefixed_path == NULL) {
- printf("malloc problem in prefix_open\n");
- return NULL;
+ printf("malloc problem in prefix_open\n");
+ return NULL;
}
prefix_add(os_prefix, filename, prefixed_path);
filep = fopen(prefixed_path, "rb");
@@ -862,7 +860,7 @@ prefix_open(const char *os_prefix, const char *filename)
void
mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
- bool intact)
+ bool intact)
{
char line[LINE_SIZE + 1];
char buf[LINE_SIZE + 1];
@@ -872,89 +870,89 @@ mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
buf[0] = 0;
while (rl(in, line, LINE_SIZE)) {
- char psname[LINE_SIZE + 1];
- int nlines;
-
- if (!strncmp(line, "%% Replace", 10) &&
- sscanf(line + 11, "%d %s", &nlines, psname) == 2
- ) {
- bool do_intact = (line[10] == '%');
-
- flush_buf(buf);
- while (nlines-- > 0)
- rl(in, line, LINE_SIZE);
- if (psname[0] == '(') {
- FILE *ps;
-
- psname[strlen(psname) - 1] = 0;
- ps = prefix_open(os_prefix, psname + 1);
- if (ps == 0)
- exit(1);
- mergefile(os_prefix, psname + 1, ps, config, intact || do_intact);
- } else if (!strcmp(psname, "INITFILES")) {
- /*
- * We don't want to bind config.h into geninit, so
- * we parse it ourselves at execution time instead.
- */
- rewind(config);
- while (rl(config, psname, LINE_SIZE))
- if (!strncmp(psname, "psfile_(\"", 9)) {
- FILE *ps;
- char *quote = strchr(psname + 9, '"');
-
- *quote = 0;
- ps = prefix_open(os_prefix, psname + 9);
- if (ps == 0)
- exit(1);
- mergefile(os_prefix, psname + 9, ps, config, false);
- }
- } else {
- printf("Unknown %%%% Replace %d %s\n",
- nlines, psname);
- exit(1);
- }
- } else if (!strcmp(line, "currentfile closefile")) {
- /* The rest of the file is debugging code, stop here. */
- break;
- } else {
- int len;
-
- str = doit(line, intact);
- if (str == 0)
- continue;
- len = strlen(str);
- if (first && len >= 2 && str[len - 2] == '<' &&
- (str[len - 1] == '<' || str[len - 1] == '~')
- ) {
- wl("currentobjectformat 1 setobjectformat\n");
- level = 2;
- }
- if (level > 1 && len > 0 && str[len - 1] == '<' &&
- (len < 2 || str[len - 2] != '<')
- ) {
- /* Convert a hex string to a binary token. */
- flush_buf(buf);
- str[len - 1] = 0;
- wl(str);
- hex_string_to_binary(in);
- continue;
- }
- if (buf[0] != '%' && /* i.e. not special retained comment */
- strlen(buf) + len < LINE_SIZE &&
- (strchr("(/[]{}", str[0]) ||
- (buf[0] != 0 && strchr(")[]{}", buf[strlen(buf) - 1])))
- )
- strcat(buf, str);
- else {
- flush_buf(buf);
- strcpy(buf, str);
- }
- first = false;
- }
+ char psname[LINE_SIZE + 1];
+ int nlines;
+
+ if (!strncmp(line, "%% Replace", 10) &&
+ sscanf(line + 11, "%d %s", &nlines, psname) == 2
+ ) {
+ bool do_intact = (line[10] == '%');
+
+ flush_buf(buf);
+ while (nlines-- > 0)
+ rl(in, line, LINE_SIZE);
+ if (psname[0] == '(') {
+ FILE *ps;
+
+ psname[strlen(psname) - 1] = 0;
+ ps = prefix_open(os_prefix, psname + 1);
+ if (ps == 0)
+ exit(1);
+ mergefile(os_prefix, psname + 1, ps, config, intact || do_intact);
+ } else if (!strcmp(psname, "INITFILES")) {
+ /*
+ * We don't want to bind config.h into geninit, so
+ * we parse it ourselves at execution time instead.
+ */
+ rewind(config);
+ while (rl(config, psname, LINE_SIZE))
+ if (!strncmp(psname, "psfile_(\"", 9)) {
+ FILE *ps;
+ char *quote = strchr(psname + 9, '"');
+
+ *quote = 0;
+ ps = prefix_open(os_prefix, psname + 9);
+ if (ps == 0)
+ exit(1);
+ mergefile(os_prefix, psname + 9, ps, config, false);
+ }
+ } else {
+ printf("Unknown %%%% Replace %d %s\n",
+ nlines, psname);
+ exit(1);
+ }
+ } else if (!strcmp(line, "currentfile closefile")) {
+ /* The rest of the file is debugging code, stop here. */
+ break;
+ } else {
+ int len;
+
+ str = doit(line, intact);
+ if (str == 0)
+ continue;
+ len = strlen(str);
+ if (first && len >= 2 && str[len - 2] == '<' &&
+ (str[len - 1] == '<' || str[len - 1] == '~')
+ ) {
+ wl("currentobjectformat 1 setobjectformat\n");
+ level = 2;
+ }
+ if (level > 1 && len > 0 && str[len - 1] == '<' &&
+ (len < 2 || str[len - 2] != '<')
+ ) {
+ /* Convert a hex string to a binary token. */
+ flush_buf(buf);
+ str[len - 1] = 0;
+ wl(str);
+ hex_string_to_binary(in);
+ continue;
+ }
+ if (buf[0] != '%' && /* i.e. not special retained comment */
+ strlen(buf) + len < LINE_SIZE &&
+ (strchr("(/[]{}", str[0]) ||
+ (buf[0] != 0 && strchr(")[]{}", buf[strlen(buf) - 1])))
+ )
+ strcat(buf, str);
+ else {
+ flush_buf(buf);
+ strcpy(buf, str);
+ }
+ first = false;
+ }
}
flush_buf(buf);
if (level > 1)
- wl("setobjectformat");
+ wl("setobjectformat");
}
/* Merge and produce a PostScript file. */
@@ -964,13 +962,12 @@ merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config)
char line[LINE_SIZE + 1];
while ((rl(in, line, LINE_SIZE), line[0])) {
- sprintf(linebuf, "%s", line );
- wl(linebuf);
+ sprintf(linebuf, "%s", line );
+ wl(linebuf);
}
mergefile(os_prefix, inname, in, config, false);
}
-
int
main(int argc, char *argv[])
{
@@ -984,9 +981,9 @@ main(int argc, char *argv[])
int atarg = 1;
int compression = 1; /* default to doing compression */
Xlist_element *Xlist_scan, *Xlist_head = NULL;
-
+
if (argc < 2) {
- printf("\n"
+ printf("\n"
" Usage: mkromfs [-o outputfile] [options ...] paths\n"
" options and paths can be interspersed and are processed in order\n"
" options:\n"
@@ -1013,17 +1010,17 @@ main(int argc, char *argv[])
" for the init file. Less frequently accessed files, if they\n"
" are large should still be compressed.\n"
"\n"
- );
- exit(1);
+ );
+ exit(1);
}
printf("compression will use %d byte blocksize (zlib output buffer %d bytes)\n",
ROMFS_BLOCKSIZE, ROMFS_CBUFSIZE);
-
+
if (argc > 3 && argv[1][0] == '-' && argv[1][1] == 'o') {
- /* process -o option for outputfile */
- outfilename = argv[2];
- atarg += 2;
+ /* process -o option for outputfile */
+ outfilename = argv[2];
+ atarg += 2;
}
printf(" writing romfs data to '%s'\n", outfilename);
out = fopen(outfilename, "w");
@@ -1039,73 +1036,72 @@ main(int argc, char *argv[])
fprintf(out," time_t gs_romfs_buildtime = %ld;\n\n", time(NULL));
/* process the remaining arguments (options interspersed with paths) */
- for (; atarg < argc; atarg++) {
- if (argv[atarg][0] == '-') {
- /* process an option */
- switch (argv[atarg][1]) {
- case 'b':
- compression = 0;
- break;
- case 'c':
- compression = 1;
- break;
- case 'd':
- if (++atarg == argc) {
- printf(" option %s missing required argument\n", argv[atarg-1]);
- exit(1);
- }
- rom_prefix = argv[atarg];
- break;
- case 'g':
- if ((++atarg) + 1 == argc) {
- printf(" option %s missing required arguments\n", argv[atarg-1]);
- exit(1);
- }
- initfile = argv[atarg++];
- gconfig_h = argv[atarg];
- process_initfile(initfile, gconfig_h, os_prefix, rom_prefix, compression,
- &inode_count, &totlen, out);
- break;
- case 'P':
- if (++atarg == argc) {
- printf(" option %s missing required argument\n", argv[atarg-1]);
- exit(1);
- }
- os_prefix = argv[atarg];
- break;
- case 'X':
- if (++atarg == argc) {
- printf(" option %s missing required argument\n", argv[atarg-1]);
- exit(1);
- }
- Xlist_scan = malloc(sizeof(Xlist_element));
- if (Xlist_scan == NULL) {
- exit(1);
- }
- Xlist_scan->next = Xlist_head;
- Xlist_head = Xlist_scan;
- Xlist_head->path = argv[atarg];
- break;
- default:
- printf(" unknown option: %s \n", argv[atarg]);
- }
- continue;
- }
- /* process a path or file */
- process_path(argv[atarg], os_prefix, rom_prefix, Xlist_head,
- compression, &inode_count, &totlen, out);
+ for (; atarg < argc; atarg++) {
+ if (argv[atarg][0] == '-') {
+ /* process an option */
+ switch (argv[atarg][1]) {
+ case 'b':
+ compression = 0;
+ break;
+ case 'c':
+ compression = 1;
+ break;
+ case 'd':
+ if (++atarg == argc) {
+ printf(" option %s missing required argument\n", argv[atarg-1]);
+ exit(1);
+ }
+ rom_prefix = argv[atarg];
+ break;
+ case 'g':
+ if ((++atarg) + 1 == argc) {
+ printf(" option %s missing required arguments\n", argv[atarg-1]);
+ exit(1);
+ }
+ initfile = argv[atarg++];
+ gconfig_h = argv[atarg];
+ process_initfile(initfile, gconfig_h, os_prefix, rom_prefix, compression,
+ &inode_count, &totlen, out);
+ break;
+ case 'P':
+ if (++atarg == argc) {
+ printf(" option %s missing required argument\n", argv[atarg-1]);
+ exit(1);
+ }
+ os_prefix = argv[atarg];
+ break;
+ case 'X':
+ if (++atarg == argc) {
+ printf(" option %s missing required argument\n", argv[atarg-1]);
+ exit(1);
+ }
+ Xlist_scan = malloc(sizeof(Xlist_element));
+ if (Xlist_scan == NULL) {
+ exit(1);
+ }
+ Xlist_scan->next = Xlist_head;
+ Xlist_head = Xlist_scan;
+ Xlist_head->path = argv[atarg];
+ break;
+ default:
+ printf(" unknown option: %s \n", argv[atarg]);
+ }
+ continue;
+ }
+ /* process a path or file */
+ process_path(argv[atarg], os_prefix, rom_prefix, Xlist_head,
+ compression, &inode_count, &totlen, out);
}
/* now write out the array of nodes */
fprintf(out, " uint32_t *gs_romfs[] = {\n");
for (i=0; i<inode_count; i++)
- fprintf(out, "\tnode_%d,\n", i);
+ fprintf(out, "\tnode_%d,\n", i);
fprintf(out, "\t0 };\n");
-
+
fclose(out);
printf("Total %%rom%% structure size is %d bytes.\n", totlen);
-
+
return 0;
}
-
diff --git a/gs/base/opdfread.h b/gs/base/opdfread.h
index 2b0caa60c..f0606c24b 100644
--- a/gs/base/opdfread.h
+++ b/gs/base/opdfread.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2011 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,9 +15,9 @@
/* opdfread.ps - A procset for interpreting an ordered PDF 1.3 file. */
/* Originally stored in gs/Resource/Init as opdfread.ps and built into
* the ROM file system, this file was referenced by ps2write when
- * writing PostScript output. With the inclusion of ps2write in the
+ * writing PostScript output. With the inclusion of ps2write in the
* PCL and XPS interpreters we can no longer rely on the PostScript
- * resources being present, and so this file has been converted to
+ * resources being present, and so this file has been converted to
* 'C' and included as a header. The original file is now stored
* in gs/lib with the comments intact.
*/
diff --git a/gs/base/pipe_.h b/gs/base/pipe_.h
index e4b7ffffd..fafd2952c 100644
--- a/gs/base/pipe_.h
+++ b/gs/base/pipe_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@
#ifdef __WIN32__
/*
* MS Windows has popen and pclose in stdio.h, but under different names.
- * Unfortunately MSVC5 and 6 have a broken implementation of _popen,
+ * Unfortunately MSVC5 and 6 have a broken implementation of _popen,
* so we use own. Our implementation only supports mode "wb".
*/
extern FILE *mswin_popen(const char *cmd, const char *mode);
diff --git a/gs/base/png_.h b/gs/base/png_.h
index c641b22b3..51ccf9262 100644
--- a/gs/base/png_.h
+++ b/gs/base/png_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/rinkj/evenbetter-rll.c b/gs/base/rinkj/evenbetter-rll.c
index 5abd2a69e..7b7d284ce 100644
--- a/gs/base/rinkj/evenbetter-rll.c
+++ b/gs/base/rinkj/evenbetter-rll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,7 +54,7 @@ typedef struct _eb_srcbuf eb_srcbuf;
int eb_test_sse2(void);
int eb_sse2_core(eb_ctx_sse2 *ctx, unsigned char **out, eb_srcbuf *in,
- int offset);
+ int offset);
int eb_sse2_rev_rs(eb_ctx_sse2 *ctx, int offset);
int eb_sse2_set_daz(void);
void eb_sse2_restore_daz(int save_mxcsr);
@@ -156,7 +156,7 @@ eb_malloc_aligned(int size, int align)
return 0;
pad = (((int)alloced + 12) & 15) + 4;
result = (void *)(pad + (char *)alloced);
- ((int *)result)[-1] = pad;
+ ((int *)result)[-1] = pad;
return result;
}
@@ -175,8 +175,8 @@ eb_compute_rbscale(const EvenBetterParams *params)
if (rbscale == 0.0)
{
rbscale = params->aspect == 1 ? 0.95 :
- params->aspect == 2 ? 1.8 :
- params->aspect == 4 ? 3.6 : 1;
+ params->aspect == 2 ? 1.8 :
+ params->aspect == 4 ? 3.6 : 1;
}
return rbscale;
}
@@ -191,17 +191,17 @@ eb_compute_randshift(int nl, int rs_base, int do_shadows, int levels)
nl < (180 << (EVEN_SHIFT - 10))))
rs--;
else if (nl > (321 << (EVEN_SHIFT - 10)) &&
- nl < (361 << (EVEN_SHIFT - 10)))
+ nl < (361 << (EVEN_SHIFT - 10)))
{
rs--;
if (nl > (331 << (EVEN_SHIFT - 10)) &&
- nl < (351 << (EVEN_SHIFT - 10)))
- rs--;
+ nl < (351 << (EVEN_SHIFT - 10)))
+ rs--;
}
else if ((do_shadows ||
- nl == (levels - 1) << EVEN_SHIFT) &&
- nl > ((levels - 1) << EVEN_SHIFT) -
- (1 << (EVEN_SHIFT - 2)))
+ nl == (levels - 1) << EVEN_SHIFT) &&
+ nl > ((levels - 1) << EVEN_SHIFT) -
+ (1 << (EVEN_SHIFT - 2)))
{
/* don't add randomness in extreme shadows */
}
@@ -272,22 +272,22 @@ eb_ctx_sse2_new(const EvenBetterParams *params, int start_plane, int end_plane)
ctx->luts[i - start_plane] = lut;
for (j = 0; j < ET_SRC_MAX + 1; j++)
- {
- double g = ((1 << 24) - params->luts[i][j]) * im_scale;
- int nl, rs;
-
- lut[j * 3] = g;
- if (g == 0.0)
- lut[j * 3 + 1] = 0.5;
- else
- lut[j * 3 + 1] = 0.5 - r_mul * rbscale / g;
-
- nl = (params->levels - 1 - g) * (1 << EVEN_SHIFT);
- rs = eb_compute_randshift(nl, rs_base,
- params->do_shadows, params->levels);
-
- lut[j * 3 + 2] = 1.0 / (1 << EVEN_SHIFT) / (1 << rs);
- }
+ {
+ double g = ((1 << 24) - params->luts[i][j]) * im_scale;
+ int nl, rs;
+
+ lut[j * 3] = g;
+ if (g == 0.0)
+ lut[j * 3 + 1] = 0.5;
+ else
+ lut[j * 3 + 1] = 0.5 - r_mul * rbscale / g;
+
+ nl = (params->levels - 1 - g) * (1 << EVEN_SHIFT);
+ rs = eb_compute_randshift(nl, rs_base,
+ params->do_shadows, params->levels);
+
+ lut[j * 3 + 2] = 1.0 / (1 << EVEN_SHIFT) / (1 << rs);
+ }
}
for (i = i - start_plane; i < 4; i++)
ctx->luts[i] = NULL;
@@ -370,10 +370,10 @@ eb_ctx_avec_new(const EvenBetterParams *params, int start_plane, int end_plane)
imscale1 = (1 - k) * (params->levels - 1) * (256.0 / 255.0);
imscale2 = k * (params->levels - 1) * sqrt(256.0 / 255.0);
for (i = 0; i < 4; i++)
- {
- ((float *)&ctx->imscale1)[i] = imscale1;
- ((float *)&ctx->imscale2)[i] = imscale2;
- }
+ {
+ ((float *)&ctx->imscale1)[i] = imscale1;
+ ((float *)&ctx->imscale2)[i] = imscale2;
+ }
f0 = vec_rsqrte(almostone);
f0 = vec_madd(f0, almostone, (vector float)zero);
f1 = vec_madd(f0, ctx->imscale2, (vector float)zero);
@@ -381,10 +381,10 @@ eb_ctx_avec_new(const EvenBetterParams *params, int start_plane, int end_plane)
f1 = vec_nmsub(f0, ctx->imscale2, foff);
f1 = vec_nmsub(almostone, ctx->imscale1, f1);
if (vec_all_eq(f1, (vector float)zero))
- {
- ctx->foff = foff;
- break;
- }
+ {
+ ctx->foff = foff;
+ break;
+ }
k += 1e-5;
}
rbmul = -r_mul * rbscale;
@@ -413,21 +413,21 @@ eb_ctx_avec_new(const EvenBetterParams *params, int start_plane, int end_plane)
ctx->luts[i - start_plane] = lut;
for (j = 0; j < ET_SRC_MAX + 1; j++)
- {
- double g = ((1 << 24) - params->luts[i][j]) * im_scale;
- int nl, rs;
-
- lut[j * 3] = g;
- if (g == 0.0)
- lut[j * 3 + 1] = 0.5;
- else
- lut[j * 3 + 1] = 0.5 - r_mul * rbscale / g;
- nl = (params->levels - 1 - g) * (1 << EVEN_SHIFT);
- rs = eb_compute_randshift(nl, rs_base,
- params->do_shadows, params->levels);
-
- lut[j * 3 + 2] = 1.0 / (1 << EVEN_SHIFT) / (1 << rs);
- }
+ {
+ double g = ((1 << 24) - params->luts[i][j]) * im_scale;
+ int nl, rs;
+
+ lut[j * 3] = g;
+ if (g == 0.0)
+ lut[j * 3 + 1] = 0.5;
+ else
+ lut[j * 3 + 1] = 0.5 - r_mul * rbscale / g;
+ nl = (params->levels - 1 - g) * (1 << EVEN_SHIFT);
+ rs = eb_compute_randshift(nl, rs_base,
+ params->do_shadows, params->levels);
+
+ lut[j * 3 + 2] = 1.0 / (1 << EVEN_SHIFT) / (1 << rs);
+ }
}
for (i = i - start_plane; i < 4; i++)
ctx->luts[i] = NULL;
@@ -469,7 +469,7 @@ eb_ctx_avec_free(eb_ctx_avec *ctx)
#ifdef USE_VECTOR
static int
even_better_line_vector(EvenBetterCtx *ebc, uchar **dest,
- const ET_Rll *const *src)
+ const ET_Rll *const *src)
{
int n_planes = ebc->n_planes;
int xd = ebc->dest_width;
@@ -484,7 +484,6 @@ even_better_line_vector(EvenBetterCtx *ebc, uchar **dest,
srcbuf = (eb_srcbuf *)(((int)&sb_alloc + 12) & -16);
-
for (strip = 0; strip < n_planes; strip += 4)
{
#ifdef USE_AVEC
@@ -503,114 +502,114 @@ even_better_line_vector(EvenBetterCtx *ebc, uchar **dest,
last_plane = n_planes - strip < 4 ? n_planes - strip : 4;
for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- count[plane_idx] = 0;
- src_idx[plane_idx] = 0;
- destbufs[plane_idx] = dest[plane_idx + strip];
- }
+ {
+ count[plane_idx] = 0;
+ src_idx[plane_idx] = 0;
+ destbufs[plane_idx] = dest[plane_idx + strip];
+ }
for (; plane_idx < 4; plane_idx++)
- {
- int j;
-
- for (j = 0; j < 16; j++)
- {
- ((float *)&srcbuf->im)[j * 4 + plane_idx] = 0.0;
- ((float *)&srcbuf->rb)[j * 4 + plane_idx] = 0.0;
- ((float *)&srcbuf->rs)[j * 4 + plane_idx] = 0.0;
- }
- }
+ {
+ int j;
+
+ for (j = 0; j < 16; j++)
+ {
+ ((float *)&srcbuf->im)[j * 4 + plane_idx] = 0.0;
+ ((float *)&srcbuf->rb)[j * 4 + plane_idx] = 0.0;
+ ((float *)&srcbuf->rs)[j * 4 + plane_idx] = 0.0;
+ }
+ }
for (i = 0; i < xd; i += 16)
- {
- int jmax = (xd - i) > 16 ? 16 : xd - i;
- int skip = 1;
- int j;
-
- for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- if (count[plane_idx] < 16 || im[plane_idx] != 0.0)
- {
- skip = 0;
- break;
- }
- }
- ctx->skip_line[i >> 4] = skip;
-
- if (skip)
- {
- /* all white */
-
- for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- uchar *dst_ptr = destbufs[plane_idx];
- if (jmax == 16)
- {
- ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
- }
- else
- {
- for (j = 0; j < jmax; j++)
- dst_ptr[i + j] = 0;
- }
- count[plane_idx] -= jmax;
- }
- }
- else
- {
- for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- const float *lut = ctx->luts[plane_idx];
- float imp = im[plane_idx];
- float rbp = rb[plane_idx];
- float rsp = rs[plane_idx];
- for (j = 0; j < jmax; j++)
- {
- if (count[plane_idx] == 0)
- {
- const ET_Rll *src_p = sbuf[plane_idx] +
- src_idx[plane_idx]++;
- ET_SrcPixel src_pixel = src_p->value;
- count[plane_idx] = src_p->length;
- imp = lut[src_pixel * 3];
- rbp = lut[src_pixel * 3 + 1];
- rsp = lut[src_pixel * 3 + 2];
- }
- ((float *)&srcbuf->im)[j * 4 + plane_idx] = imp;
- ((float *)&srcbuf->rb)[j * 4 + plane_idx] = rbp;
- ((float *)&srcbuf->rs)[j * 4 + plane_idx] = rsp;
- count[plane_idx]--;
- }
- im[plane_idx] = imp;
- rb[plane_idx] = rbp;
- rs[plane_idx] = rsp;
- }
- for (; plane_idx < 4; plane_idx++)
- {
- destbufs[plane_idx] = dummy_dst - i;
- }
+ {
+ int jmax = (xd - i) > 16 ? 16 : xd - i;
+ int skip = 1;
+ int j;
+
+ for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
+ {
+ if (count[plane_idx] < 16 || im[plane_idx] != 0.0)
+ {
+ skip = 0;
+ break;
+ }
+ }
+ ctx->skip_line[i >> 4] = skip;
+
+ if (skip)
+ {
+ /* all white */
+
+ for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
+ {
+ uchar *dst_ptr = destbufs[plane_idx];
+ if (jmax == 16)
+ {
+ ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
+ }
+ else
+ {
+ for (j = 0; j < jmax; j++)
+ dst_ptr[i + j] = 0;
+ }
+ count[plane_idx] -= jmax;
+ }
+ }
+ else
+ {
+ for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
+ {
+ const float *lut = ctx->luts[plane_idx];
+ float imp = im[plane_idx];
+ float rbp = rb[plane_idx];
+ float rsp = rs[plane_idx];
+ for (j = 0; j < jmax; j++)
+ {
+ if (count[plane_idx] == 0)
+ {
+ const ET_Rll *src_p = sbuf[plane_idx] +
+ src_idx[plane_idx]++;
+ ET_SrcPixel src_pixel = src_p->value;
+ count[plane_idx] = src_p->length;
+ imp = lut[src_pixel * 3];
+ rbp = lut[src_pixel * 3 + 1];
+ rsp = lut[src_pixel * 3 + 2];
+ }
+ ((float *)&srcbuf->im)[j * 4 + plane_idx] = imp;
+ ((float *)&srcbuf->rb)[j * 4 + plane_idx] = rbp;
+ ((float *)&srcbuf->rs)[j * 4 + plane_idx] = rsp;
+ count[plane_idx]--;
+ }
+ im[plane_idx] = imp;
+ rb[plane_idx] = rbp;
+ rs[plane_idx] = rsp;
+ }
+ for (; plane_idx < 4; plane_idx++)
+ {
+ destbufs[plane_idx] = dummy_dst - i;
+ }
#ifdef USE_AVEC
- eb_avec_core(ctx, (vector unsigned char **)destbufs, srcbuf, i);
+ eb_avec_core(ctx, (vector unsigned char **)destbufs, srcbuf, i);
#endif
#ifdef USE_SSE2
- eb_sse2_core(ctx, destbufs, srcbuf, i);
+ eb_sse2_core(ctx, destbufs, srcbuf, i);
#endif
- }
- }
+ }
+ }
for (i = xd & -16; i >= 0; i -= 16)
- {
- if (!ctx->skip_line[i >> 4])
- {
+ {
+ if (!ctx->skip_line[i >> 4])
+ {
#ifdef USE_AVEC
- eb_avec_rev_rs(ctx, i + 15);
+ eb_avec_rev_rs(ctx, i + 15);
#endif
#ifdef USE_SSE2
- eb_sse2_rev_rs(ctx, i + 15);
+ eb_sse2_rev_rs(ctx, i + 15);
#endif
- }
- }
+ }
+ }
}
#ifdef USE_SSE2
eb_sse2_restore_daz(save_mxcsr);
@@ -622,7 +621,7 @@ even_better_line_vector(EvenBetterCtx *ebc, uchar **dest,
#ifdef USE_AVEC
static int
even_better_line_fastprep(EvenBetterCtx *ebc, uchar **dest,
- const ET_SrcPixel *const *src)
+ const ET_SrcPixel *const *src)
{
int n_planes = ebc->n_planes;
int xd = ebc->dest_width;
@@ -649,47 +648,47 @@ even_better_line_fastprep(EvenBetterCtx *ebc, uchar **dest,
last_plane = n_planes - strip < 4 ? n_planes - strip : 4;
for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- destbufs[plane_idx] = dest[plane_idx + strip];
- }
+ {
+ destbufs[plane_idx] = dest[plane_idx + strip];
+ }
for (i = 0; i < xd; i += 16)
- {
- int noskip;
- noskip = eb_avec_prep_srcbuf(ctx, last_plane, srcbuf, sbuf, i);
- ctx->skip_line[i >> 4] = noskip;
- if (noskip)
- {
- for (plane_idx = last_plane; plane_idx < 4; plane_idx++)
- destbufs[plane_idx] = dummy_dst - i;
- eb_avec_core(ctx, (vector unsigned char **)destbufs, srcbuf, i);
- }
- else
- {
- /* all white */
-
- for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
- {
- uchar *dst_ptr = destbufs[plane_idx];
- ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
- }
- }
- }
+ {
+ int noskip;
+ noskip = eb_avec_prep_srcbuf(ctx, last_plane, srcbuf, sbuf, i);
+ ctx->skip_line[i >> 4] = noskip;
+ if (noskip)
+ {
+ for (plane_idx = last_plane; plane_idx < 4; plane_idx++)
+ destbufs[plane_idx] = dummy_dst - i;
+ eb_avec_core(ctx, (vector unsigned char **)destbufs, srcbuf, i);
+ }
+ else
+ {
+ /* all white */
+
+ for (plane_idx = 0; plane_idx < last_plane; plane_idx++)
+ {
+ uchar *dst_ptr = destbufs[plane_idx];
+ ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
+ }
+ }
+ }
for (i = xd & -16; i >= 0; i -= 16)
- {
- if (ctx->skip_line[i >> 4])
- {
+ {
+ if (ctx->skip_line[i >> 4])
+ {
#ifdef USE_AVEC
- eb_avec_rev_rs(ctx, i + 15);
+ eb_avec_rev_rs(ctx, i + 15);
#endif
#ifdef USE_SSE2
- eb_sse2_rev_rs(ctx, i + 15);
+ eb_sse2_rev_rs(ctx, i + 15);
#endif
- }
- }
+ }
+ }
}
return 0;
}
@@ -701,7 +700,7 @@ even_better_line_fastprep(EvenBetterCtx *ebc, uchar **dest,
static void
even_better_line_hi (EvenBetterCtx *ebc, uchar **dest,
- const ET_Rll *const *src)
+ const ET_Rll *const *src)
{
int a[M], b[M];
int e_1_0[M], e_m1_1[M], e_0_1[M], e_1_1[M];
@@ -763,195 +762,195 @@ even_better_line_hi (EvenBetterCtx *ebc, uchar **dest,
jmax = (xd - i) > 16 ? 16 : xd - i;
for (plane_idx = 0; plane_idx < n_planes; plane_idx++)
- {
- EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
- int *wcl = ctx->white_count_line;
- if (count[plane_idx] >= 16 && iml[plane_idx] == 0)
- wcl[i >> 4]++;
- else
- wcl[i >> 4] = 0;
- if (wcl[i >> 4] > 15)
- {
- uchar *dst_ptr = dest[plane_idx];
- if (jmax == 16)
- {
- ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
- ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
- }
- else
- {
- for (j = 0; j < jmax; j++)
- dst_ptr[i + j] = 0;
- }
- count[plane_idx] -= jmax;
- }
- else
- {
- work_planes[n_work++] = plane_idx;
- }
- }
+ {
+ EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
+ int *wcl = ctx->white_count_line;
+ if (count[plane_idx] >= 16 && iml[plane_idx] == 0)
+ wcl[i >> 4]++;
+ else
+ wcl[i >> 4] = 0;
+ if (wcl[i >> 4] > 15)
+ {
+ uchar *dst_ptr = dest[plane_idx];
+ if (jmax == 16)
+ {
+ ((uint32 *)dst_ptr)[(i >> 2) + 0] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 1] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 2] = 0;
+ ((uint32 *)dst_ptr)[(i >> 2) + 3] = 0;
+ }
+ else
+ {
+ for (j = 0; j < jmax; j++)
+ dst_ptr[i + j] = 0;
+ }
+ count[plane_idx] -= jmax;
+ }
+ else
+ {
+ work_planes[n_work++] = plane_idx;
+ }
+ }
if (n_work == 0)
- {
- /* all planes were white */
- i += jmax;
- continue;
- }
+ {
+ /* all planes were white */
+ i += jmax;
+ continue;
+ }
for (j = 0; j < jmax; j++)
- {
+ {
#ifdef FANCY_COUPLING
- coupling += c_line[i];
+ coupling += c_line[i];
#else
- coupling = 0;
+ coupling = 0;
#endif
- /* Lookup image data and compute R for all planes. */
- for (work_idx = 0; work_idx < n_work; work_idx++)
- {
- int plane_idx = work_planes[work_idx];
- EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
- ET_SrcPixel src_pixel;
- int new_r;
-
- pr = ctx->r_line;
- pa = ctx->a_line;
- pb = ctx->b_line;
- if (count[plane_idx] == 0)
- {
- const ET_Rll *src_p = src[plane_idx] + src_idx[plane_idx]++;
- int *lut = ctx->lut;
- int *rblut = ctx->rb_lut;
- char *rslut = ctx->rs_lut;
-
- count[plane_idx] = src_p->length;
- src_pixel = src_p->value;
- iml[plane_idx] = lut[src_pixel];
- rbl[plane_idx] = rblut[src_pixel];
- rs[plane_idx] = rslut[src_pixel];
- }
- count[plane_idx]--;
-
- if (r[plane_idx] + a[plane_idx] < pr[i])
- {
- r[plane_idx] += a[plane_idx];
- a[plane_idx] += 2;
- }
- else
- {
- a[plane_idx] = pa[i];
- b[plane_idx] = pb[i];
- r[plane_idx] = pr[i];
- }
- if (iml[plane_idx] == 0)
- {
- r_scratch[plane_idx] = 0;
- }
- else
- {
- int r_tmp;
- const int r_max = 0;
- new_r = r[plane_idx];
- if (new_r > even_rlimit)
- new_r = even_rlimit;
- /* Should we store back with the limit? */
-
- rg = new_r << (EVEN_SHIFT - even_c1);
- r_tmp = rg - rbl[plane_idx];
- if (r_tmp > r_max) r_tmp >>= 3;
- r_scratch[plane_idx] = r_tmp;
- }
- }
-
- /* Dither each plane. */
- for (work_idx = 0; work_idx < n_work; work_idx++)
- {
- int plane_idx = work_planes[work_idx];
- EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
- uchar *dst_ptr = dest[plane_idx];
- int new_e_1_0;
- int coupling_contribution;
-
- pr = ctx->r_line;
- pa = ctx->a_line;
- pb = ctx->b_line;
- piir = ctx->iir_line;
-
- im = iml[plane_idx];
- e_m1_1[plane_idx] = e_0_1[plane_idx];
- e_0_1[plane_idx] = e_1_1[plane_idx];
- e_1_1[plane_idx] = i == xd - 1 ? 0 : piir[i + 1];
- new_e_1_0 = ((e_1_0[plane_idx] * 7 + e_m1_1[plane_idx] * 3 +
- e_0_1[plane_idx] * 5 + e_1_1[plane_idx] * 1) >> 4);
- if (im == 0)
- {
- dst_ptr[i] = 0;
- }
- else
- {
- int err;
- int imo;
-
- err = new_e_1_0;
-
- err += r_scratch[plane_idx];
-
- /* Add the two seeds together */
- sum = seed1 + seed2;
-
- /* If the add generated a carry, increment
- * the result of the addition.
- */
- if (sum < seed1 || sum < seed2) sum++;
-
- /* Seed2 becomes old seed1, seed1 becomes result */
- seed2 = seed1;
- seed1 = sum;
-
- rand_shift = rs[plane_idx];
- err -= (sum >> rand_shift) - (0x80000000 >> rand_shift);
-
- if (err < even_elo)
- err = even_elo;
-
- else if (err > even_ehi)
- err = even_ehi;
+ /* Lookup image data and compute R for all planes. */
+ for (work_idx = 0; work_idx < n_work; work_idx++)
+ {
+ int plane_idx = work_planes[work_idx];
+ EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
+ ET_SrcPixel src_pixel;
+ int new_r;
+
+ pr = ctx->r_line;
+ pa = ctx->a_line;
+ pb = ctx->b_line;
+ if (count[plane_idx] == 0)
+ {
+ const ET_Rll *src_p = src[plane_idx] + src_idx[plane_idx]++;
+ int *lut = ctx->lut;
+ int *rblut = ctx->rb_lut;
+ char *rslut = ctx->rs_lut;
+
+ count[plane_idx] = src_p->length;
+ src_pixel = src_p->value;
+ iml[plane_idx] = lut[src_pixel];
+ rbl[plane_idx] = rblut[src_pixel];
+ rs[plane_idx] = rslut[src_pixel];
+ }
+ count[plane_idx]--;
+
+ if (r[plane_idx] + a[plane_idx] < pr[i])
+ {
+ r[plane_idx] += a[plane_idx];
+ a[plane_idx] += 2;
+ }
+ else
+ {
+ a[plane_idx] = pa[i];
+ b[plane_idx] = pb[i];
+ r[plane_idx] = pr[i];
+ }
+ if (iml[plane_idx] == 0)
+ {
+ r_scratch[plane_idx] = 0;
+ }
+ else
+ {
+ int r_tmp;
+ const int r_max = 0;
+ new_r = r[plane_idx];
+ if (new_r > even_rlimit)
+ new_r = even_rlimit;
+ /* Should we store back with the limit? */
+
+ rg = new_r << (EVEN_SHIFT - even_c1);
+ r_tmp = rg - rbl[plane_idx];
+ if (r_tmp > r_max) r_tmp >>= 3;
+ r_scratch[plane_idx] = r_tmp;
+ }
+ }
+
+ /* Dither each plane. */
+ for (work_idx = 0; work_idx < n_work; work_idx++)
+ {
+ int plane_idx = work_planes[work_idx];
+ EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
+ uchar *dst_ptr = dest[plane_idx];
+ int new_e_1_0;
+ int coupling_contribution;
+
+ pr = ctx->r_line;
+ pa = ctx->a_line;
+ pb = ctx->b_line;
+ piir = ctx->iir_line;
+
+ im = iml[plane_idx];
+ e_m1_1[plane_idx] = e_0_1[plane_idx];
+ e_0_1[plane_idx] = e_1_1[plane_idx];
+ e_1_1[plane_idx] = i == xd - 1 ? 0 : piir[i + 1];
+ new_e_1_0 = ((e_1_0[plane_idx] * 7 + e_m1_1[plane_idx] * 3 +
+ e_0_1[plane_idx] * 5 + e_1_1[plane_idx] * 1) >> 4);
+ if (im == 0)
+ {
+ dst_ptr[i] = 0;
+ }
+ else
+ {
+ int err;
+ int imo;
+
+ err = new_e_1_0;
+
+ err += r_scratch[plane_idx];
+
+ /* Add the two seeds together */
+ sum = seed1 + seed2;
+
+ /* If the add generated a carry, increment
+ * the result of the addition.
+ */
+ if (sum < seed1 || sum < seed2) sum++;
+
+ /* Seed2 becomes old seed1, seed1 becomes result */
+ seed2 = seed1;
+ seed1 = sum;
+
+ rand_shift = rs[plane_idx];
+ err -= (sum >> rand_shift) - (0x80000000 >> rand_shift);
+
+ if (err < even_elo)
+ err = even_elo;
+
+ else if (err > even_ehi)
+ err = even_ehi;
#if 1
- err += coupling;
+ err += coupling;
#endif
#ifdef OLD_QUANT
- imo = ((err + im) * dith_mul) >> (EVEN_SHIFT + 8);
+ imo = ((err + im) * dith_mul) >> (EVEN_SHIFT + 8);
#else
- imo = ((err + im) * dith_mul + (1 << (EVEN_SHIFT + 7))) >> (EVEN_SHIFT + 8);
+ imo = ((err + im) * dith_mul + (1 << (EVEN_SHIFT + 7))) >> (EVEN_SHIFT + 8);
#endif
- if (imo < 0) imo = 0;
- else if (imo > levels - 1) imo = levels - 1;
- dst_ptr[i] = imo;
- coupling_contribution = im - ((imo * imo_mul) >> IMO_SHIFT);
- new_e_1_0 += coupling_contribution;
- coupling += (coupling_contribution * strengths[plane_idx]) >> 8;
- }
- if (dst_ptr[i] != 0)
- {
- a[plane_idx] = 1;
- b[plane_idx] = aspect2;
- r[plane_idx] = 0;
- }
- pa[i] = a[plane_idx];
- pb[i] = b[plane_idx];
- pr[i] = r[plane_idx];
- piir[i] = new_e_1_0;
- e_1_0[plane_idx] = new_e_1_0;
- }
+ if (imo < 0) imo = 0;
+ else if (imo > levels - 1) imo = levels - 1;
+ dst_ptr[i] = imo;
+ coupling_contribution = im - ((imo * imo_mul) >> IMO_SHIFT);
+ new_e_1_0 += coupling_contribution;
+ coupling += (coupling_contribution * strengths[plane_idx]) >> 8;
+ }
+ if (dst_ptr[i] != 0)
+ {
+ a[plane_idx] = 1;
+ b[plane_idx] = aspect2;
+ r[plane_idx] = 0;
+ }
+ pa[i] = a[plane_idx];
+ pb[i] = b[plane_idx];
+ pr[i] = r[plane_idx];
+ piir[i] = new_e_1_0;
+ e_1_0[plane_idx] = new_e_1_0;
+ }
#ifdef FANCY_COUPLING
- coupling = coupling >> 1;
- c_line[i] = coupling;
+ coupling = coupling >> 1;
+ c_line[i] = coupling;
#endif
- i++;
- }
+ i++;
+ }
}
/* Note: this isn't white optimized, but the payoff is probably not
@@ -982,33 +981,33 @@ even_better_line_hi (EvenBetterCtx *ebc, uchar **dest,
rv = 0;
jmax = ((xd - 1) & 15) + 1;
for (i = xd - 1; i >= 0;)
- {
- if (wcl[i >> 4] < 16)
- {
- for (j = 0; j < jmax; j++)
- {
- if (rv + bv + av < pr[i] + pb[i])
- {
- rv += av;
- av += 2;
- }
- else
- {
- rv = pr[i];
- av = pa[i];
- bv = pb[i];
- }
- if (rv > even_rlimit) rv = even_rlimit;
- pa[i] = av;
- pb[i] = bv + (aspect2 << 1);
- pr[i] = rv + bv;
- i--;
- }
- }
- else
- i -= jmax;
- jmax = 16;
- }
+ {
+ if (wcl[i >> 4] < 16)
+ {
+ for (j = 0; j < jmax; j++)
+ {
+ if (rv + bv + av < pr[i] + pb[i])
+ {
+ rv += av;
+ av += 2;
+ }
+ else
+ {
+ rv = pr[i];
+ av = pa[i];
+ bv = pb[i];
+ }
+ if (rv > even_rlimit) rv = even_rlimit;
+ pa[i] = av;
+ pb[i] = bv + (aspect2 << 1);
+ pr[i] = rv + bv;
+ i--;
+ }
+ }
+ else
+ i -= jmax;
+ jmax = 16;
+ }
}
ebc->seed1 = seed1;
@@ -1017,7 +1016,7 @@ even_better_line_hi (EvenBetterCtx *ebc, uchar **dest,
static void
even_better_line_both (EvenBetterCtx *ebc, uchar **dest,
- const ET_Rll *const *src)
+ const ET_Rll *const *src)
{
#if 0
int a[M], b[M];
@@ -1089,170 +1088,170 @@ even_better_line_both (EvenBetterCtx *ebc, uchar **dest,
xrem += xs;
if (xrem >= xd)
- {
- for (plane_idx = 0; plane_idx < n_planes; plane_idx++)
- {
- ps = src[plane_idx];
- imraw[plane_idx] = ps[src_idx];
- }
- src_idx++;
- xrem -= xd;
- }
+ {
+ for (plane_idx = 0; plane_idx < n_planes; plane_idx++)
+ {
+ ps = src[plane_idx];
+ imraw[plane_idx] = ps[src_idx];
+ }
+ src_idx++;
+ xrem -= xd;
+ }
/* Lookup image data and compute R for all planes. */
for (plane_idx = 0; plane_idx < n_planes; plane_idx++)
- {
- EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
- ET_SrcPixel src_pixel;
- int new_r;
-
- pr = ctx->r_line;
- pa = ctx->a_line;
- pb = ctx->b_line;
- pr_sh = ctx->r_line_sh;
- pa_sh = ctx->a_line_sh;
- pb_sh = ctx->b_line_sh;
- lut = ctx->lut;
- rblut = ctx->rb_lut;
- src_pixel = imraw[plane_idx];
-
- im = lut[src_pixel];
- iml[plane_idx] = im;
- rb = rblut[src_pixel];
- if (r[plane_idx] + a[plane_idx] < pr[i])
- {
- r[plane_idx] += a[plane_idx];
- a[plane_idx] += 2;
- }
- else
- {
- a[plane_idx] = pa[i];
- b[plane_idx] = pb[i];
- r[plane_idx] = pr[i];
- }
- if (r_sh[plane_idx] + a_sh[plane_idx] < pr_sh[i])
- {
- r_sh[plane_idx] += a_sh[plane_idx];
- a_sh[plane_idx] += 2;
- }
- else
- {
- a_sh[plane_idx] = pa_sh[i];
- b_sh[plane_idx] = pb_sh[i];
- r_sh[plane_idx] = pr_sh[i];
- }
- if (im == 0 || im == (1 << EVEN_SHIFT))
- {
- r_scratch[plane_idx] = 0;
- }
- else
- {
- new_r = r[plane_idx];
- if (new_r > even_rlimit)
- new_r = even_rlimit;
- /* Should we store back with the limit? */
- rg = new_r << (EVEN_SHIFT - even_c1);
-
- new_r = r_sh[plane_idx];
- if (new_r > even_rlimit)
- new_r = even_rlimit;
- rg -= new_r << (EVEN_SHIFT - even_c1);
- r_scratch[plane_idx] = rg - rb;
- }
- }
+ {
+ EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
+ ET_SrcPixel src_pixel;
+ int new_r;
+
+ pr = ctx->r_line;
+ pa = ctx->a_line;
+ pb = ctx->b_line;
+ pr_sh = ctx->r_line_sh;
+ pa_sh = ctx->a_line_sh;
+ pb_sh = ctx->b_line_sh;
+ lut = ctx->lut;
+ rblut = ctx->rb_lut;
+ src_pixel = imraw[plane_idx];
+
+ im = lut[src_pixel];
+ iml[plane_idx] = im;
+ rb = rblut[src_pixel];
+ if (r[plane_idx] + a[plane_idx] < pr[i])
+ {
+ r[plane_idx] += a[plane_idx];
+ a[plane_idx] += 2;
+ }
+ else
+ {
+ a[plane_idx] = pa[i];
+ b[plane_idx] = pb[i];
+ r[plane_idx] = pr[i];
+ }
+ if (r_sh[plane_idx] + a_sh[plane_idx] < pr_sh[i])
+ {
+ r_sh[plane_idx] += a_sh[plane_idx];
+ a_sh[plane_idx] += 2;
+ }
+ else
+ {
+ a_sh[plane_idx] = pa_sh[i];
+ b_sh[plane_idx] = pb_sh[i];
+ r_sh[plane_idx] = pr_sh[i];
+ }
+ if (im == 0 || im == (1 << EVEN_SHIFT))
+ {
+ r_scratch[plane_idx] = 0;
+ }
+ else
+ {
+ new_r = r[plane_idx];
+ if (new_r > even_rlimit)
+ new_r = even_rlimit;
+ /* Should we store back with the limit? */
+ rg = new_r << (EVEN_SHIFT - even_c1);
+
+ new_r = r_sh[plane_idx];
+ if (new_r > even_rlimit)
+ new_r = even_rlimit;
+ rg -= new_r << (EVEN_SHIFT - even_c1);
+ r_scratch[plane_idx] = rg - rb;
+ }
+ }
/* Dither each plane. */
for (plane_idx = 0; plane_idx < n_planes; plane_idx++)
- {
- EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
- uchar *dst_ptr = dest[plane_idx];
- int new_e_1_0;
- int coupling_contribution;
-
- pr = ctx->r_line;
- pa = ctx->a_line;
- pb = ctx->b_line;
- pr_sh = ctx->r_line_sh;
- pa_sh = ctx->a_line_sh;
- pb_sh = ctx->b_line_sh;
- piir = ctx->iir_line;
-
- im = iml[plane_idx];
- e_m1_1[plane_idx] = e_0_1[plane_idx];
- e_0_1[plane_idx] = e_1_1[plane_idx];
- e_1_1[plane_idx] = i == xd - 1 ? 0 : piir[i + 1];
- new_e_1_0 = ((e_1_0[plane_idx] * 7 + e_m1_1[plane_idx] * 3 +
- e_0_1[plane_idx] * 5 + e_1_1[plane_idx] * 1) >> 4);
- if (im == 0)
- {
- dst_ptr[i] = 0;
- }
- else
- {
- int err;
- int imo;
-
- err = new_e_1_0;
-
- err += r_scratch[plane_idx];
-
- /* Add the two seeds together */
- sum = seed1 + seed2;
-
- /* If the add generated a carry, increment
- * the result of the addition.
- */
- if (sum < seed1 || sum < seed2) sum++;
-
- /* Seed2 becomes old seed1, seed1 becomes result */
- seed2 = seed1;
- seed1 = sum;
-
- err -= (sum >> rand_shift) - (0x80000000 >> rand_shift);
-
- if (err < even_elo)
- err = even_elo;
-
- else if (err > even_ehi)
- err = even_ehi;
+ {
+ EBPlaneCtx *ctx = ebc->plane_ctx[plane_idx];
+ uchar *dst_ptr = dest[plane_idx];
+ int new_e_1_0;
+ int coupling_contribution;
+
+ pr = ctx->r_line;
+ pa = ctx->a_line;
+ pb = ctx->b_line;
+ pr_sh = ctx->r_line_sh;
+ pa_sh = ctx->a_line_sh;
+ pb_sh = ctx->b_line_sh;
+ piir = ctx->iir_line;
+
+ im = iml[plane_idx];
+ e_m1_1[plane_idx] = e_0_1[plane_idx];
+ e_0_1[plane_idx] = e_1_1[plane_idx];
+ e_1_1[plane_idx] = i == xd - 1 ? 0 : piir[i + 1];
+ new_e_1_0 = ((e_1_0[plane_idx] * 7 + e_m1_1[plane_idx] * 3 +
+ e_0_1[plane_idx] * 5 + e_1_1[plane_idx] * 1) >> 4);
+ if (im == 0)
+ {
+ dst_ptr[i] = 0;
+ }
+ else
+ {
+ int err;
+ int imo;
+
+ err = new_e_1_0;
+
+ err += r_scratch[plane_idx];
+
+ /* Add the two seeds together */
+ sum = seed1 + seed2;
+
+ /* If the add generated a carry, increment
+ * the result of the addition.
+ */
+ if (sum < seed1 || sum < seed2) sum++;
+
+ /* Seed2 becomes old seed1, seed1 becomes result */
+ seed2 = seed1;
+ seed1 = sum;
+
+ err -= (sum >> rand_shift) - (0x80000000 >> rand_shift);
+
+ if (err < even_elo)
+ err = even_elo;
+
+ else if (err > even_ehi)
+ err = even_ehi;
#if 1
- err += coupling;
+ err += coupling;
#endif
#ifdef OLD_QUANT
- imo = ((err + im) * dith_mul) >> (EVEN_SHIFT + 8);
+ imo = ((err + im) * dith_mul) >> (EVEN_SHIFT + 8);
#else
- imo = ((err + im) * dith_mul + (1 << (EVEN_SHIFT + 7))) >> (EVEN_SHIFT + 8);
+ imo = ((err + im) * dith_mul + (1 << (EVEN_SHIFT + 7))) >> (EVEN_SHIFT + 8);
#endif
- if (imo < 0) imo = 0;
- else if (imo > levels - 1) imo = levels - 1;
- dst_ptr[i] = imo;
- coupling_contribution = im - ((imo * imo_mul) >> IMO_SHIFT);
- new_e_1_0 += coupling_contribution;
- coupling += (coupling_contribution * strengths[plane_idx]) >> 8;
- }
- if (dst_ptr[i] != 0)
- {
- a[plane_idx] = 1;
- b[plane_idx] = aspect2;
- r[plane_idx] = 0;
- }
- if (dst_ptr[i] != levels - 1)
- {
- a_sh[plane_idx] = 1;
- b_sh[plane_idx] = aspect2;
- r_sh[plane_idx] = 0;
- }
- pa[i] = a[plane_idx];
- pb[i] = b[plane_idx];
- pr[i] = r[plane_idx];
- pa_sh[i] = a_sh[plane_idx];
- pb_sh[i] = b_sh[plane_idx];
- pr_sh[i] = r_sh[plane_idx];
- piir[i] = new_e_1_0;
- e_1_0[plane_idx] = new_e_1_0;
- }
+ if (imo < 0) imo = 0;
+ else if (imo > levels - 1) imo = levels - 1;
+ dst_ptr[i] = imo;
+ coupling_contribution = im - ((imo * imo_mul) >> IMO_SHIFT);
+ new_e_1_0 += coupling_contribution;
+ coupling += (coupling_contribution * strengths[plane_idx]) >> 8;
+ }
+ if (dst_ptr[i] != 0)
+ {
+ a[plane_idx] = 1;
+ b[plane_idx] = aspect2;
+ r[plane_idx] = 0;
+ }
+ if (dst_ptr[i] != levels - 1)
+ {
+ a_sh[plane_idx] = 1;
+ b_sh[plane_idx] = aspect2;
+ r_sh[plane_idx] = 0;
+ }
+ pa[i] = a[plane_idx];
+ pb[i] = b[plane_idx];
+ pr[i] = r[plane_idx];
+ pa_sh[i] = a_sh[plane_idx];
+ pb_sh[i] = b_sh[plane_idx];
+ pr_sh[i] = r_sh[plane_idx];
+ piir[i] = new_e_1_0;
+ e_1_0[plane_idx] = new_e_1_0;
+ }
#ifdef FANCY_COUPLING
coupling = coupling >> 1;
c_line[i] = coupling;
@@ -1264,10 +1263,10 @@ even_better_line_both (EvenBetterCtx *ebc, uchar **dest,
for (i = xd - 1; i >= 0; i--)
{
if (plane_idx == 0)
- {
- coupling = (coupling + c_line[i]) >> 1;
- c_line[i] = (coupling - (coupling >> 4));
- }
+ {
+ coupling = (coupling + c_line[i]) >> 1;
+ c_line[i] = (coupling - (coupling >> 4));
+ }
}
#endif
@@ -1292,39 +1291,39 @@ even_better_line_both (EvenBetterCtx *ebc, uchar **dest,
bv_sh = 1;
rv_sh = 0;
for (i = xd - 1; i >= 0; i--)
- {
- if (rv + bv + av < pr[i] + pb[i])
- {
- rv += av;
- av += 2;
- }
- else
- {
- rv = pr[i];
- av = pa[i];
- bv = pb[i];
- }
- if (rv > even_rlimit) rv = even_rlimit;
- pa[i] = av;
- pb[i] = bv + (aspect2 << 1);
- pr[i] = rv + bv;
-
- if (rv_sh + bv_sh + av_sh < pr_sh[i] + pb_sh[i])
- {
- rv_sh += av_sh;
- av_sh += 2;
- }
- else
- {
- rv_sh = pr_sh[i];
- av_sh = pa_sh[i];
- bv_sh = pb_sh[i];
- }
- if (rv_sh > even_rlimit) rv_sh = even_rlimit;
- pa_sh[i] = av_sh;
- pb_sh[i] = bv_sh + (aspect2 << 1);
- pr_sh[i] = rv_sh + bv_sh;
- }
+ {
+ if (rv + bv + av < pr[i] + pb[i])
+ {
+ rv += av;
+ av += 2;
+ }
+ else
+ {
+ rv = pr[i];
+ av = pa[i];
+ bv = pb[i];
+ }
+ if (rv > even_rlimit) rv = even_rlimit;
+ pa[i] = av;
+ pb[i] = bv + (aspect2 << 1);
+ pr[i] = rv + bv;
+
+ if (rv_sh + bv_sh + av_sh < pr_sh[i] + pb_sh[i])
+ {
+ rv_sh += av_sh;
+ av_sh += 2;
+ }
+ else
+ {
+ rv_sh = pr_sh[i];
+ av_sh = pa_sh[i];
+ bv_sh = pb_sh[i];
+ }
+ if (rv_sh > even_rlimit) rv_sh = even_rlimit;
+ pa_sh[i] = av_sh;
+ pb_sh[i] = bv_sh + (aspect2 << 1);
+ pr_sh[i] = rv_sh + bv_sh;
+ }
}
ebc->seed1 = seed1;
@@ -1342,7 +1341,7 @@ even_better_line_both (EvenBetterCtx *ebc, uchar **dest,
**/
void
even_better_line_rll (EvenBetterCtx *ebc, uchar **dest,
- const ET_Rll *const *src)
+ const ET_Rll *const *src)
{
if (ebc->dump_file && ebc->dump_level >= EB_DUMP_INPUT)
@@ -1350,10 +1349,10 @@ even_better_line_rll (EvenBetterCtx *ebc, uchar **dest,
int i;
/* Note: we should calculate the actual number of runlength
- codes here. As it is, it will just waste storage a bit. */
+ codes here. As it is, it will just waste storage a bit. */
for (i = 0; i < ebc->n_planes; i++)
- fwrite (src[i], sizeof(ET_Rll), ebc->source_width,
- ebc->dump_file);
+ fwrite (src[i], sizeof(ET_Rll), ebc->source_width,
+ ebc->dump_file);
}
#ifdef USE_VECTOR
if (ebc->using_vectors)
@@ -1369,8 +1368,8 @@ even_better_line_rll (EvenBetterCtx *ebc, uchar **dest,
int i;
for (i = 0; i < ebc->n_planes; i++)
- fwrite (dest[i], 1, ebc->dest_width,
- ebc->dump_file);
+ fwrite (dest[i], 1, ebc->dest_width,
+ ebc->dump_file);
}
}
@@ -1384,7 +1383,7 @@ even_better_line_rll (EvenBetterCtx *ebc, uchar **dest,
**/
static int
even_better_compress_rll (ET_Rll *dst, const ET_SrcPixel *src,
- int src_width, int dst_width)
+ int src_width, int dst_width)
{
int rll_idx;
int i;
@@ -1400,43 +1399,43 @@ even_better_compress_rll (ET_Rll *dst, const ET_SrcPixel *src,
if (frac == 0)
{
for (i = 1; i < src_width; i++)
- {
- ET_SrcPixel val = src[i];
-
- if (count > 0xffff - whole || val != last_val)
- {
- dst[rll_idx].length = count;
- dst[rll_idx].value = last_val;
- rll_idx++;
- last_val = val;
- count = 0;
- }
- count += whole;
- }
+ {
+ ET_SrcPixel val = src[i];
+
+ if (count > 0xffff - whole || val != last_val)
+ {
+ dst[rll_idx].length = count;
+ dst[rll_idx].value = last_val;
+ rll_idx++;
+ last_val = val;
+ count = 0;
+ }
+ count += whole;
+ }
}
else
{
rem = frac;
for (i = 1; i < src_width; i++)
- {
- ET_SrcPixel val = src[i];
-
- if (count >= 0xffff - whole || val != last_val)
- {
- dst[rll_idx].length = count;
- dst[rll_idx].value = last_val;
- rll_idx++;
- last_val = val;
- count = 0;
- }
- count += whole;
- rem += frac;
- if (rem >= src_width)
- {
- count++;
- rem -= src_width;
- }
- }
+ {
+ ET_SrcPixel val = src[i];
+
+ if (count >= 0xffff - whole || val != last_val)
+ {
+ dst[rll_idx].length = count;
+ dst[rll_idx].value = last_val;
+ rll_idx++;
+ last_val = val;
+ count = 0;
+ }
+ count += whole;
+ rem += frac;
+ if (rem >= src_width)
+ {
+ count++;
+ rem -= src_width;
+ }
+ }
}
dst[rll_idx].length = count;
dst[rll_idx].value = last_val;
@@ -1454,7 +1453,7 @@ even_better_compress_rll (ET_Rll *dst, const ET_SrcPixel *src,
**/
void
even_better_line (EvenBetterCtx *ebc, uchar **dest,
- const ET_SrcPixel *const *src)
+ const ET_SrcPixel *const *src)
{
ET_Rll *rll_buf[M];
int i;
@@ -1470,13 +1469,13 @@ even_better_line (EvenBetterCtx *ebc, uchar **dest,
#endif
{
for (i = 0; i < ebc->n_planes; i++)
- {
- rll_buf[i] = (ET_Rll *)malloc (source_width * sizeof(ET_Rll));
- even_better_compress_rll (rll_buf[i], src[i], source_width, dest_width);
- }
+ {
+ rll_buf[i] = (ET_Rll *)malloc (source_width * sizeof(ET_Rll));
+ even_better_compress_rll (rll_buf[i], src[i], source_width, dest_width);
+ }
even_better_line_rll (ebc, dest, (const ET_Rll * const *)rll_buf);
for (i = 0; i < ebc->n_planes; i++)
- free (rll_buf[i]);
+ free (rll_buf[i]);
}
}
@@ -1531,7 +1530,7 @@ even_log2 (int x)
**/
static EBPlaneCtx *
even_better_plane_new (const EvenBetterParams *params, EvenBetterCtx *ebc,
- int plane_idx)
+ int plane_idx)
{
int source_width = params->source_width;
int dest_width = params->dest_width;
@@ -1559,15 +1558,15 @@ even_better_plane_new (const EvenBetterParams *params, EvenBetterCtx *ebc,
int nli;
if (lut == NULL)
- {
+ {
#if ET_SRC_MAX == 255
- nli = (i * 65793 + (i >> 7)) >> (24 - EVEN_SHIFT);
+ nli = (i * 65793 + (i >> 7)) >> (24 - EVEN_SHIFT);
#else
- nli = (i * ((double) (1 << EVEN_SHIFT)) / ET_SRC_MAX) + 0.5;
+ nli = (i * ((double) (1 << EVEN_SHIFT)) / ET_SRC_MAX) + 0.5;
#endif
- }
+ }
else
- nli = lut[i] >> (24 - EVEN_SHIFT);
+ nli = lut[i] >> (24 - EVEN_SHIFT);
new_lut[i] = (1 << EVEN_SHIFT) - nli;
}
@@ -1584,32 +1583,32 @@ even_better_plane_new (const EvenBetterParams *params, EvenBetterCtx *ebc,
int rs;
if (nl == 0)
- rb = 0;
+ rb = 0;
else
- {
- rb = (rbscale * (1 << (2 * EVEN_SHIFT - even_c1))) / nl;
- if (rb > even_rlimit << (EVEN_SHIFT - even_c1))
- rb = even_rlimit << (EVEN_SHIFT - even_c1);
- }
+ {
+ rb = (rbscale * (1 << (2 * EVEN_SHIFT - even_c1))) / nl;
+ if (rb > even_rlimit << (EVEN_SHIFT - even_c1))
+ rb = even_rlimit << (EVEN_SHIFT - even_c1);
+ }
rs = eb_compute_randshift(nl, rs_base, do_shadows, params->levels);
rs_lut[i] = rs;
if (params->do_shadows)
- {
- nl = ((1 << EVEN_SHIFT) - new_lut[i]) * (params->levels - 1);
-
- if (nl == 0)
- rb = 0;
- else
- {
- int rb_sh;
- rb_sh = (rbscale * (1 << (2 * EVEN_SHIFT - even_c1))) / nl;
- if (rb_sh > even_rlimit << (EVEN_SHIFT - even_c1))
- rb_sh = even_rlimit << (EVEN_SHIFT - even_c1);
- rb -= rb_sh;
- }
- }
+ {
+ nl = ((1 << EVEN_SHIFT) - new_lut[i]) * (params->levels - 1);
+
+ if (nl == 0)
+ rb = 0;
+ else
+ {
+ int rb_sh;
+ rb_sh = (rbscale * (1 << (2 * EVEN_SHIFT - even_c1))) / nl;
+ if (rb_sh > even_rlimit << (EVEN_SHIFT - even_c1))
+ rb_sh = even_rlimit << (EVEN_SHIFT - even_c1);
+ rb -= rb_sh;
+ }
+ }
rb_lut[i] = rb;
}
@@ -1642,10 +1641,10 @@ even_better_plane_new (const EvenBetterParams *params, EvenBetterCtx *ebc,
result->b_line[i] = 1;
result->iir_line[i] = -((rand () & 0x7fff) << 6) >> (24 - EVEN_SHIFT);
if (do_shadows)
- {
- result->a_line_sh[i] = 1;
- result->b_line_sh[i] = 1;
- }
+ {
+ result->a_line_sh[i] = 1;
+ result->b_line_sh[i] = 1;
+ }
}
return result;
@@ -1670,19 +1669,19 @@ even_better_new (const EvenBetterParams *params)
header[3] = ET_SRC_MAX;
header[4] = sizeof(ET_SrcPixel);
fwrite (header, sizeof(int), sizeof(header) / sizeof(header[0]),
- params->dump_file);
+ params->dump_file);
if (params->dump_level >= EB_DUMP_PARAMS)
- {
+ {
- fwrite (params, 1, sizeof(EvenBetterParams), params->dump_file);
- }
+ fwrite (params, 1, sizeof(EvenBetterParams), params->dump_file);
+ }
if (params->dump_level >= EB_DUMP_LUTS)
- {
- int i;
- for (i = 0; i < params->n_planes; i++)
- fwrite (params->luts[i], sizeof(int), ET_SRC_MAX + 1,
- params->dump_file);
- }
+ {
+ int i;
+ for (i = 0; i < params->n_planes; i++)
+ fwrite (params->luts[i], sizeof(int), ET_SRC_MAX + 1,
+ params->dump_file);
+ }
}
result->source_width = params->source_width;
@@ -1697,7 +1696,7 @@ even_better_new (const EvenBetterParams *params)
result->strengths = (int *)malloc (sizeof(int) * n_planes);
memcpy (result->strengths, params->strengths,
- sizeof(int) * n_planes);
+ sizeof(int) * n_planes);
log2_levels = even_log2 (params->levels);
log2_aspect = even_log2 (params->aspect);
@@ -1731,21 +1730,21 @@ even_better_new (const EvenBetterParams *params)
{
#ifdef USE_SSE2
result->sse2_ctx = (eb_ctx_sse2 **)malloc(sizeof(eb_ctx_sse2 *) *
- ((n_planes + 3) >> 2));
+ ((n_planes + 3) >> 2));
for (i = 0; i < n_planes; i += 4)
- {
- int end_plane = i + 4 < n_planes ? i + 4 : n_planes;
- result->sse2_ctx[i >> 2] = eb_ctx_sse2_new(params, i, end_plane);
- }
+ {
+ int end_plane = i + 4 < n_planes ? i + 4 : n_planes;
+ result->sse2_ctx[i >> 2] = eb_ctx_sse2_new(params, i, end_plane);
+ }
#endif
#ifdef USE_AVEC
result->avec_ctx = (eb_ctx_avec **)malloc(sizeof(eb_ctx_avec *) *
- ((n_planes + 3) >> 2));
+ ((n_planes + 3) >> 2));
for (i = 0; i < n_planes; i += 4)
- {
- int end_plane = i + 4 < n_planes ? i + 4 : n_planes;
- result->avec_ctx[i >> 2] = eb_ctx_avec_new(params, i, end_plane);
- }
+ {
+ int end_plane = i + 4 < n_planes ? i + 4 : n_planes;
+ result->avec_ctx[i >> 2] = eb_ctx_avec_new(params, i, end_plane);
+ }
#endif
result->plane_ctx = NULL;
}
@@ -1753,7 +1752,7 @@ even_better_new (const EvenBetterParams *params)
{
result->plane_ctx = (EBPlaneCtx **)malloc(sizeof(EBPlaneCtx *) * n_planes);
for (i = 0; i < n_planes; i++)
- result->plane_ctx[i] = even_better_plane_new (params, result, i);
+ result->plane_ctx[i] = even_better_plane_new (params, result, i);
}
return result;
}
@@ -1778,12 +1777,12 @@ even_better_free (EvenBetterCtx *ctx)
{
#ifdef USE_SSE2
for (i = 0; i < n_planes; i += 4)
- eb_ctx_sse2_free(ctx->sse2_ctx[i >> 2]);
+ eb_ctx_sse2_free(ctx->sse2_ctx[i >> 2]);
free(ctx->sse2_ctx);
#endif
#ifdef USE_AVEC
for (i = 0; i < n_planes; i += 4)
- eb_ctx_avec_free(ctx->avec_ctx[i >> 2]);
+ eb_ctx_avec_free(ctx->avec_ctx[i >> 2]);
free(ctx->avec_ctx);
#endif
}
@@ -1791,7 +1790,7 @@ even_better_free (EvenBetterCtx *ctx)
#endif
{
for (i = 0; i < n_planes; i++)
- even_better_plane_free (ctx->plane_ctx[i]);
+ even_better_plane_free (ctx->plane_ctx[i]);
free(ctx->plane_ctx);
}
free (ctx->strengths);
diff --git a/gs/base/rinkj/evenbetter-rll.h b/gs/base/rinkj/evenbetter-rll.h
index 1f6b9eaba..e0706729f 100644
--- a/gs/base/rinkj/evenbetter-rll.h
+++ b/gs/base/rinkj/evenbetter-rll.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,11 +81,11 @@ even_better_new (const EvenBetterParams *params);
void
even_better_line_rll (EvenBetterCtx *ctx, uchar **dest,
- const ET_Rll *const *src);
+ const ET_Rll *const *src);
void
even_better_line (EvenBetterCtx *ctx, uchar **dest,
- const ET_SrcPixel *const *src);
+ const ET_SrcPixel *const *src);
void
even_better_free (EvenBetterCtx *ctx);
diff --git a/gs/base/rinkj/rinkj-byte-stream.c b/gs/base/rinkj/rinkj-byte-stream.c
index 6158ef18f..417c0db6c 100644
--- a/gs/base/rinkj/rinkj-byte-stream.c
+++ b/gs/base/rinkj/rinkj-byte-stream.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,6 @@ rinkj_byte_stream_printf (RinkjByteStream *bs, const char *fmt, ...)
return rinkj_byte_stream_write (bs, str, len);
}
-
int
rinkj_byte_stream_close (RinkjByteStream *bs)
{
@@ -87,9 +86,9 @@ rinkj_byte_stream_file_write (RinkjByteStream *self, const char *buf, int size)
#endif
status = fwrite (buf, 1, size, z->f);
if (status == size)
- return 0;
+ return 0;
else
- return -1;
+ return -1;
}
}
diff --git a/gs/base/rinkj/rinkj-byte-stream.h b/gs/base/rinkj/rinkj-byte-stream.h
index 4f7c96ff6..d93931724 100644
--- a/gs/base/rinkj/rinkj-byte-stream.h
+++ b/gs/base/rinkj/rinkj-byte-stream.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,6 +32,5 @@ rinkj_byte_stream_printf (RinkjByteStream *bs, const char *fmt, ...);
int
rinkj_byte_stream_close (RinkjByteStream *bs);
-
RinkjByteStream *
rinkj_byte_stream_file_new (FILE *f);
diff --git a/gs/base/rinkj/rinkj-config.c b/gs/base/rinkj/rinkj-config.c
index 0498efe7e..c4c934253 100644
--- a/gs/base/rinkj/rinkj-config.c
+++ b/gs/base/rinkj/rinkj-config.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,29 +66,29 @@ rinkj_config_get (const char *config, const char *key)
p_nl = strchr (config + ix, '\n');
if (p_nl == NULL)
- {
- /* last line not \n terminated */
- ix_eol = strlen (config + ix);
- ix_next = ix_eol;
- }
+ {
+ /* last line not \n terminated */
+ ix_eol = strlen (config + ix);
+ ix_next = ix_eol;
+ }
else
- {
- ix_eol = ix + p_nl - config;
- ix_next = ix_eol + 1;
- }
+ {
+ ix_eol = ix + p_nl - config;
+ ix_next = ix_eol + 1;
+ }
for (key_ix = 0; ix + key_ix < ix_eol; key_ix++)
- {
- if (key[key_ix] == 0 && config[ix + key_ix] == ':')
- {
- ix += key_ix + 1;
- while (ix < ix_eol && isspace (config[ix]))
- ix++;
- return rinkj_strdup_size (config + ix, ix_eol - ix);
- }
- else if (key[key_ix] != config[ix + key_ix])
- break;
- }
+ {
+ if (key[key_ix] == 0 && config[ix + key_ix] == ':')
+ {
+ ix += key_ix + 1;
+ while (ix < ix_eol && isspace (config[ix]))
+ ix++;
+ return rinkj_strdup_size (config + ix, ix_eol - ix);
+ }
+ else if (key[key_ix] != config[ix + key_ix])
+ break;
+ }
}
return NULL;
}
@@ -120,32 +120,32 @@ rinkj_config_keyval (const char *config, char **p_val, const char **p_next)
p_nl = strchr (config + ix, '\n');
if (p_nl == NULL)
- {
- /* last line not \n terminated */
- ix_eol = strlen (config + ix);
- ix_next = ix_eol;
- }
+ {
+ /* last line not \n terminated */
+ ix_eol = strlen (config + ix);
+ ix_next = ix_eol;
+ }
else
- {
- ix_eol = ix + p_nl - config;
- ix_next = ix_eol + 1;
- }
+ {
+ ix_eol = ix + p_nl - config;
+ ix_next = ix_eol + 1;
+ }
for (key_ix = 0; ix + key_ix < ix_eol; key_ix++)
- {
- if (config[ix + key_ix] == ':')
- {
- key = rinkj_strdup_size (config + ix, key_ix);
- ix += key_ix + 1;
- while (ix < ix_eol && isspace (config[ix]))
- ix++;
- if (p_val != NULL)
- *p_val = rinkj_strdup_size (config + ix, ix_eol - ix);
- if (p_next != NULL)
- *p_next = config + ix_next;
- return key;
- }
- }
+ {
+ if (config[ix + key_ix] == ':')
+ {
+ key = rinkj_strdup_size (config + ix, key_ix);
+ ix += key_ix + 1;
+ while (ix < ix_eol && isspace (config[ix]))
+ ix++;
+ if (p_val != NULL)
+ *p_val = rinkj_strdup_size (config + ix, ix_eol - ix);
+ if (p_next != NULL)
+ *p_next = config + ix_next;
+ return key;
+ }
+ }
}
return NULL;
}
diff --git a/gs/base/rinkj/rinkj-config.h b/gs/base/rinkj/rinkj-config.h
index aeeae505e..4584c9941 100644
--- a/gs/base/rinkj/rinkj-config.h
+++ b/gs/base/rinkj/rinkj-config.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/rinkj/rinkj-device.c b/gs/base/rinkj/rinkj-device.c
index a0acdd1f9..7d7a3bd5d 100644
--- a/gs/base/rinkj/rinkj-device.c
+++ b/gs/base/rinkj/rinkj-device.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@ rinkj_device_set (RinkjDevice *self, const char *config)
/* Preferred, as it matches IJS */
int
rinkj_device_set_param (RinkjDevice *self, const char *key,
- const char *value, int value_size)
+ const char *value, int value_size)
{
int keylen = strlen (key);
int bufsize = keylen + value_size + 3;
@@ -51,7 +51,7 @@ rinkj_device_set_param (RinkjDevice *self, const char *key,
int
rinkj_device_set_param_string (RinkjDevice *self, const char *key,
- const char *value)
+ const char *value)
{
return rinkj_device_set_param (self, key, value, strlen (value));
}
diff --git a/gs/base/rinkj/rinkj-device.h b/gs/base/rinkj/rinkj-device.h
index d9b2de3b5..880b12f7d 100644
--- a/gs/base/rinkj/rinkj-device.h
+++ b/gs/base/rinkj/rinkj-device.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,12 +37,12 @@ rinkj_device_set (RinkjDevice *self, const char *config);
int
rinkj_device_set_param (RinkjDevice *self, const char *key,
- const char *value, int value_size);
+ const char *value, int value_size);
/* Convenience functions */
int
rinkj_device_set_param_string (RinkjDevice *self, const char *key,
- const char *value);
+ const char *value);
int
rinkj_device_set_param_int (RinkjDevice *self, const char *key, int value);
diff --git a/gs/base/rinkj/rinkj-dither.c b/gs/base/rinkj/rinkj-dither.c
index 00f0b5b93..213bc2d13 100644
--- a/gs/base/rinkj/rinkj-dither.c
+++ b/gs/base/rinkj/rinkj-dither.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/rinkj/rinkj-dither.h b/gs/base/rinkj/rinkj-dither.h
index ae9babc9d..d4289e64b 100644
--- a/gs/base/rinkj/rinkj-dither.h
+++ b/gs/base/rinkj/rinkj-dither.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,4 +26,3 @@ rinkj_dither_line (RinkjDither *self, unsigned char *dst, const unsigned char *s
void
rinkj_dither_close (RinkjDither *self);
-
diff --git a/gs/base/rinkj/rinkj-epson870.c b/gs/base/rinkj/rinkj-epson870.c
index 3086f3a34..795a4f666 100644
--- a/gs/base/rinkj/rinkj-epson870.c
+++ b/gs/base/rinkj/rinkj-epson870.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -82,71 +82,71 @@ rinkj_escp_set (RinkjDevice *self, const char *config)
for (p = config; (key = rinkj_config_keyval (p, &val, &next)); p = next)
{
if (!strcmp (key, "Resolution"))
- {
- char *p;
-
- z->xres = atoi (val);
- p = strchr (val, 'x');
- if (p != NULL)
- z->yres = atoi (p + 1);
- else
- z->yres = z->xres;
+ {
+ char *p;
+
+ z->xres = atoi (val);
+ p = strchr (val, 'x');
+ if (p != NULL)
+ z->yres = atoi (p + 1);
+ else
+ z->yres = z->xres;
#ifdef VERBOSE
- fprintf (stderr, "Resolution = %d x %d\n", z->xres, z->yres);
+ fprintf (stderr, "Resolution = %d x %d\n", z->xres, z->yres);
#endif
- }
+ }
else if (!strcmp (key, "Manufacturer"))
- {
- if (z->manufacturer)
- free (z->manufacturer);
- z->manufacturer = val;
- val = NULL;
- }
+ {
+ if (z->manufacturer)
+ free (z->manufacturer);
+ z->manufacturer = val;
+ val = NULL;
+ }
else if (!strcmp (key, "Model"))
- {
- if (z->model)
- free (z->model);
- z->model = val;
- val = NULL;
- }
+ {
+ if (z->model)
+ free (z->model);
+ z->model = val;
+ val = NULL;
+ }
else if (!strcmp (key, "BitsPerSample"))
- {
- z->bps = atoi (val);
+ {
+ z->bps = atoi (val);
#ifdef VERBOSE
- fprintf (stderr, "BitsPerSample = %d\n", z->bps);
+ fprintf (stderr, "BitsPerSample = %d\n", z->bps);
#endif
- }
+ }
else if (!strcmp (key, "NumChan"))
- {
- /* This is in params, but should become a setting. */
- z->num_chan = atoi (val);
+ {
+ /* This is in params, but should become a setting. */
+ z->num_chan = atoi (val);
#ifdef VERBOSE
- fprintf (stderr, "NumChan = %d\n", z->num_chan);
+ fprintf (stderr, "NumChan = %d\n", z->num_chan);
#endif
- }
+ }
else if (!strcmp (key, "PrinterWeave"))
- {
- z->printer_weave = atoi (val);
- }
+ {
+ z->printer_weave = atoi (val);
+ }
else if (!strcmp (key, "Microdot"))
- {
- z->microdot = atoi (val);
- }
+ {
+ z->microdot = atoi (val);
+ }
else if (!strcmp (key, "Unidirectional"))
- {
- z->unidir = atoi (val);
- }
+ {
+ z->unidir = atoi (val);
+ }
else if (!strcmp (key, "AutoCut"))
- {
- z->autocut = atoi (val);
- }
+ {
+ z->autocut = atoi (val);
+ }
else if (!strcmp (key, "BlankSkip"))
- {
- z->blankskip = atoi (val);
- }
+ {
+ z->blankskip = atoi (val);
+ }
free (key);
if (val)
- free (val);
+ free (val);
}
return 0;
}
@@ -214,19 +214,19 @@ static int
rinkj_epson_headres (RinkjEscp *z, int baseres)
{
return rinkj_byte_stream_printf (z->out, "\033(D\004%c%c%c%c%c", 0,
- baseres & 255, baseres >> 8,
- baseres / z->head_yres,
- baseres / z->head_xres);
+ baseres & 255, baseres >> 8,
+ baseres / z->head_yres,
+ baseres / z->head_xres);
}
static int
rinkj_epson_units (RinkjEscp *z, int xres, int yres, int baseres)
{
return rinkj_byte_stream_printf (z->out, "\033(U\005%c%c%c%c%c%c", 0,
- baseres / yres,
- baseres / yres,
- baseres / xres,
- baseres & 255, baseres >> 8);
+ baseres / yres,
+ baseres / yres,
+ baseres / xres,
+ baseres & 255, baseres >> 8);
}
static int
@@ -237,7 +237,7 @@ rinkj_epson_set_common (RinkjEscp *z)
if (z->printer_weave >= 0)
/* set microweave */
status = rinkj_byte_stream_printf (z->out, "\033(i\001%c%c", 0,
- z->printer_weave);
+ z->printer_weave);
if (status == 0 && z->unidir >= 0)
/* set unidirectional */
@@ -246,7 +246,7 @@ rinkj_epson_set_common (RinkjEscp *z)
if (status == 0 && z->microdot >= 0)
/* set dot size */
status = rinkj_byte_stream_printf (z->out, "\033(e\002%c%c%c", 0, 0,
- z->microdot);
+ z->microdot);
return status;
}
@@ -261,7 +261,7 @@ rinkj_epson870_init (RinkjDevice *self, const RinkjDeviceParams *params)
RinkjEscp *z = (RinkjEscp *)self;
rinkj_byte_stream_printf (z->out,
- "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
+ "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
rinkj_byte_stream_printf (z->out, "@EJL \n\033@\033@");
/* remote string goes here, but is probably optional */
@@ -301,17 +301,17 @@ rinkj_epson2200_init (RinkjDevice *self, const RinkjDeviceParams *params)
RinkjEscp *z = (RinkjEscp *)self;
rinkj_byte_stream_printf (z->out,
- "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
+ "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
rinkj_byte_stream_printf (z->out, "@EJL \n\033@\033@");
/* remote string */
rinkj_byte_stream_printf( z->out,
- "\033(R%c%c%cREMOTE1", 8, 0, 0);
+ "\033(R%c%c%cREMOTE1", 8, 0, 0);
rinkj_byte_stream_printf( z->out,
- "PP\003%c%c\002%cPH\002%c%c\001SN\003%c%c\004k",
- 0, 0, 0, 0, 0, 0, 0);
+ "PP\003%c%c\002%cPH\002%c%c\001SN\003%c%c\004k",
+ 0, 0, 0, 0, 0, 0, 0);
rinkj_byte_stream_printf( z->out,
- "\033%c%c%c", 0, 0, 0);
+ "\033%c%c%c", 0, 0, 0);
/* set graphics mode */
rinkj_byte_stream_printf (z->out, "\033(G\001%c\001", 0);
@@ -348,7 +348,7 @@ rinkj_epson7600_init (RinkjDevice *self, const RinkjDeviceParams *params)
#if 0
rinkj_byte_stream_printf (z->out,
- "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
+ "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
rinkj_byte_stream_printf (z->out, "@EJL \n");
#endif
rinkj_byte_stream_printf (z->out, "\033@\033@");
@@ -356,7 +356,7 @@ rinkj_epson7600_init (RinkjDevice *self, const RinkjDeviceParams *params)
#if 1
/* remote string */
rinkj_byte_stream_printf( z->out,
- "\033(R%c%c%cREMOTE1", 8, 0, 0);
+ "\033(R%c%c%cREMOTE1", 8, 0, 0);
rinkj_byte_stream_printf( z->out, "SN%c%c%c%c%c", 3, 0, 0, 1, 0);
rinkj_byte_stream_printf( z->out, "SN%c%c%c%c%c", 3, 0, 0, 2, 6);
rinkj_byte_stream_printf( z->out, "SN%c%c%c%c%c", 3, 0, 0, 3, 0);
@@ -381,7 +381,7 @@ rinkj_epson7600_init (RinkjDevice *self, const RinkjDeviceParams *params)
rinkj_byte_stream_printf( z->out, "IK%c%c%c%c", 2, 0, 0, 1);
rinkj_byte_stream_printf( z->out, "EX%c%c%c%c%c%c%c%c", 6, 0, 0, 0, 0, 0, 20, 0);
rinkj_byte_stream_printf( z->out,
- "\033%c%c%c", 0, 0, 0);
+ "\033%c%c%c", 0, 0, 0);
#endif
/* set graphics mode */
@@ -395,12 +395,12 @@ rinkj_epson7600_init (RinkjDevice *self, const RinkjDeviceParams *params)
pl = z->height * 720 / z->yres + 180;
/* set page length to page height + 1/4 inch */
rinkj_byte_stream_printf (z->out, "\033(S\010%c%c%c%c%c%c%c%c%c", 0,
- pw & 255, (pw >> 8) & 255, (pw >> 16) & 255, pw >> 24,
- pl & 255, (pl >> 8) & 255, (pl >> 16) & 255, pl >> 24);
+ pw & 255, (pw >> 8) & 255, (pw >> 16) & 255, pw >> 24,
+ pl & 255, (pl >> 8) & 255, (pl >> 16) & 255, pl >> 24);
rinkj_byte_stream_printf (z->out, "\033(c\010%c%c%c%c%c%c%c%c%c", 0,
- 0, 0, 0, 0,
- pl & 255, (pl >> 8) & 255, (pl >> 16) & 255, pl >> 24);
+ 0, 0, 0, 0,
+ pl & 255, (pl >> 8) & 255, (pl >> 16) & 255, pl >> 24);
rinkj_epson_headres (z, 2880);
@@ -420,7 +420,7 @@ rinkj_epsonc80_init (RinkjDevice *self, const RinkjDeviceParams *params)
RinkjEscp *z = (RinkjEscp *)self;
rinkj_byte_stream_printf (z->out,
- "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
+ "%c%c%c\033\001@EJL 1284.4\n", 0, 0, 0);
rinkj_byte_stream_printf (z->out, "@EJL \n\033@\033@");
/* remote string goes here, but is probably optional */
@@ -438,7 +438,7 @@ rinkj_epsonc80_init (RinkjDevice *self, const RinkjDeviceParams *params)
/* set margins (magic) */
rinkj_byte_stream_printf (z->out, "\033(c\010%c\040\376\377\377\376\036%c%c",
- 0, 0, 0);
+ 0, 0, 0);
/* ESC ( c */
@@ -481,7 +481,7 @@ rinkj_escp_init (RinkjDevice *self, const RinkjDeviceParams *params)
#ifdef VERBOSE
fprintf (stderr, "Manufacturer: %s; Model; %s\n", z->manufacturer,
- z->model);
+ z->model);
#endif
if (z->model && !strcmp (z->model, "Stylus Photo 870"))
@@ -498,10 +498,10 @@ rinkj_escp_init (RinkjDevice *self, const RinkjDeviceParams *params)
z->head_yres = 180;
z->head_bps = 2;
if (z->xres == 2880)
- {
- z->head_xres = 720;
- z->head_bps = 1;
- }
+ {
+ z->head_xres = 720;
+ z->head_bps = 1;
+ }
z->n_pins = 96;
z->printer_weave = 0;
z->plane_offsets[3] = z->yres / 360;
@@ -564,7 +564,7 @@ rinkj_escp_init (RinkjDevice *self, const RinkjDeviceParams *params)
/* todo: error checking */
return 0;
-
+
}
/**
@@ -593,7 +593,7 @@ rinkj_escp_shuffle_dblx (char *dst, const char *src, int pass, int n_bytes)
s0 = src[i * 2] << pass;
s1 = src[i * 2 + 1] << pass;
dst[i] = (s0 & 0x80) | ((s0 & 0x20) << 1) | ((s0 & 8) << 2) | ((s0 & 2) << 3) |
- ((s1 & 0x80) >> 4) | ((s1 & 0x20) >> 3) | ((s1 & 8) >> 2) | ((s1 & 2) >> 1);
+ ((s1 & 0x80) >> 4) | ((s1 & 0x20) >> 3) | ((s1 & 8) >> 2) | ((s1 & 2) >> 1);
}
if (n_bytes & 1)
{
@@ -629,19 +629,19 @@ rinkj_escp_shuffle_4pass_1bit (char *dst, const char *src, int pass, int n_bytes
s2 = src[i * 4 + 2] << shift;
s3 = src[i * 4 + 3] << shift;
dst[i] = (s0 & 0x80) | ((s0 & 8) << 3) |
- ((s1 & 0x80) >> 2) | ((s1 & 8) << 1) |
- ((s2 & 0x80) >> 4) | ((s2 & 8) >> 1) |
- ((s3 & 0x80) >> 6) | ((s3 & 8) >> 3);
+ ((s1 & 0x80) >> 2) | ((s1 & 8) << 1) |
+ ((s2 & 0x80) >> 4) | ((s2 & 8) >> 1) |
+ ((s3 & 0x80) >> 6) | ((s3 & 8) >> 3);
}
if (n_bytes & 3)
{
char d = 0;
for (i = 0; i < (n_bytes & 3); i++)
- {
- s0 = src[n_dst * 4 + i] << shift;
- d |= ((s0 & 0x80) | ((s0 & 8) << 3)) >> (i << 1);
- }
+ {
+ s0 = src[n_dst * 4 + i] << shift;
+ d |= ((s0 & 0x80) | ((s0 & 8) << 3)) >> (i << 1);
+ }
dst[n_dst] = d;
}
}
@@ -671,7 +671,7 @@ rinkj_escp_shuffle_2pass_2bit (char *dst, const char *src, int pass, int n_bytes
s0 = src[i * 2] << shift;
s1 = src[i * 2 + 1] << shift;
dst[i] = (s0 & 0xc0) | ((s0 & 0x0c) << 2) |
- ((s1 & 0xc0) >> 4) | ((s1 & 0x0c) >> 2);
+ ((s1 & 0xc0) >> 4) | ((s1 & 0x0c) >> 2);
}
if (n_bytes & 1)
{
@@ -707,14 +707,14 @@ rinkj_escp_shuffle_4pass_2bit (char *dst, const char *src, int pass, int n_bytes
s2 = src[i * 4 + 2] << shift;
s3 = src[i * 4 + 3] << shift;
dst[i] = (s0 & 0xc0) | ((s1 & 0xc0) >> 2) |
- ((s2 & 0xc0) >> 4) | ((s3 & 0xc0) >> 6);
+ ((s2 & 0xc0) >> 4) | ((s3 & 0xc0) >> 6);
}
if (n_bytes & 3)
{
char d = 0;
for (i = 0; i < (n_bytes & 3); i++)
- d |= ((src[n_dst * 4 + i] << shift) & 0xc0) >> (i << 1);
+ d |= ((src[n_dst * 4 + i] << shift) & 0xc0) >> (i << 1);
dst[n_dst] = d;
}
}
@@ -731,9 +731,9 @@ rinkj_escp_1pass_dblx (char *dst, const char *src, int n_bytes)
{
unsigned char s = src[i];
dst[i * 2] = (((s & 0x80) >> 1) | ((s & 0x40) >> 2) |
- ((s & 0x20) >> 3) | ((s & 0x10) >> 4)) * DOT;
+ ((s & 0x20) >> 3) | ((s & 0x10) >> 4)) * DOT;
dst[i * 2 + 1] = (((s & 8) << 3) | ((s & 4) << 2) |
- ((s & 2) << 1) | (s & 1)) * DOT;
+ ((s & 2) << 1) | (s & 1)) * DOT;
}
}
@@ -759,7 +759,7 @@ rinkj_escp_sel_shuffle_dblx (char *dst, const char *src, int pass, int n_bytes)
s0 = src[i * 2] << pass;
s1 = src[i * 2 + 1] << pass;
dst[i] = (((s0 & 0x80) >> 1) | ((s0 & 8) << 1) |
- ((s1 & 0x80) >> 5) | ((s1 & 0x8) >> 3)) * DOT;
+ ((s1 & 0x80) >> 5) | ((s1 & 0x8) >> 3)) * DOT;
}
if (n_bytes & 1)
{
@@ -770,34 +770,34 @@ rinkj_escp_sel_shuffle_dblx (char *dst, const char *src, int pass, int n_bytes)
static void
rinkj_escp_shuffle (char *dst, const char *src, int pass, int n_bytes,
- int passes_per_scan, int bps, int head_bps)
+ int passes_per_scan, int bps, int head_bps)
{
if (bps == 2 && head_bps == 2)
{
if (passes_per_scan == 1)
- memcpy (dst, src, n_bytes);
+ memcpy (dst, src, n_bytes);
else if (passes_per_scan == 2)
- rinkj_escp_shuffle_2pass_2bit (dst, src, pass, n_bytes);
+ rinkj_escp_shuffle_2pass_2bit (dst, src, pass, n_bytes);
else if (passes_per_scan == 4)
- rinkj_escp_shuffle_4pass_2bit (dst, src, pass, n_bytes);
+ rinkj_escp_shuffle_4pass_2bit (dst, src, pass, n_bytes);
}
else if (bps == 1 && head_bps == 2)
{
if (passes_per_scan == 1)
- rinkj_escp_1pass_dblx (dst, src, n_bytes);
+ rinkj_escp_1pass_dblx (dst, src, n_bytes);
if (passes_per_scan == 2)
- rinkj_escp_select_dblx (dst, src, pass, n_bytes);
+ rinkj_escp_select_dblx (dst, src, pass, n_bytes);
else if (passes_per_scan == 4)
- rinkj_escp_sel_shuffle_dblx (dst, src, pass, n_bytes);
+ rinkj_escp_sel_shuffle_dblx (dst, src, pass, n_bytes);
}
else if (bps == 1 && head_bps == 1)
{
if (passes_per_scan == 1)
- memcpy (dst, src, n_bytes);
+ memcpy (dst, src, n_bytes);
else if (passes_per_scan == 2)
- rinkj_escp_shuffle_dblx (dst, src, pass, n_bytes);
+ rinkj_escp_shuffle_dblx (dst, src, pass, n_bytes);
else if (passes_per_scan == 4)
- rinkj_escp_shuffle_4pass_1bit (dst, src, pass, n_bytes);
+ rinkj_escp_shuffle_4pass_1bit (dst, src, pass, n_bytes);
}
}
@@ -824,26 +824,26 @@ rinkj_escp_compress_rle (char *dst, const char *src, int n)
{
b = src[i];
for (run = 1; run < 129 && i + run < n; run++)
- if (b != src[i + run])
- break;
+ if (b != src[i + run])
+ break;
if (run > 2)
- {
- dst[j++] = 257 - run;
- dst[j++] = b;
- }
+ {
+ dst[j++] = 257 - run;
+ dst[j++] = b;
+ }
else
- {
- for (run = 1; run < 128 && i + run < n; run++)
- {
- b = src[i + run];
- if (i + run + 2 < n &&
- b == src[i + run + 1] && b == src[i + run + 2])
- break;
- }
- dst[j++] = run - 1;
- memcpy (dst + j, src + i, run);
- j += run;
- }
+ {
+ for (run = 1; run < 128 && i + run < n; run++)
+ {
+ b = src[i + run];
+ if (i + run + 2 < n &&
+ b == src[i + run + 1] && b == src[i + run + 2])
+ break;
+ }
+ dst[j++] = run - 1;
+ memcpy (dst + j, src + i, run);
+ j += run;
+ }
}
return j;
@@ -872,7 +872,7 @@ rinkj_escp_flush (RinkjEscp *z)
#ifdef VERBOSE
fprintf (stderr, "flush pass %d: ytop = %d (= %d mod %d), x_pass = %d\n",
- z->pass, ytop, ytop % z->spacing, z->spacing, x_pass);
+ z->pass, ytop, ytop % z->spacing, z->spacing, x_pass);
#endif
xsb = (z->width * z->bps + 7) >> 3;
@@ -887,12 +887,12 @@ rinkj_escp_flush (RinkjEscp *z)
ysc = ytop;
if (z->vertpos == -1)
status = rinkj_byte_stream_printf (z->out, "\033(V%c%c%c%c",
- 2, 0, ysc & 0xff, (ysc >> 8) & 0xff);
+ 2, 0, ysc & 0xff, (ysc >> 8) & 0xff);
else
{
int yrel = ysc - z->vertpos;
status = rinkj_byte_stream_printf (z->out, "\033(v%c%c%c%c%c%c",
- 4, 0, yrel & 0xff, (yrel >> 8) & 0xff, (yrel >> 16) & 0xff, (yrel >> 24) & 0xff);
+ 4, 0, yrel & 0xff, (yrel >> 8) & 0xff, (yrel >> 16) & 0xff, (yrel >> 24) & 0xff);
}
z->vertpos = ysc;
@@ -905,61 +905,61 @@ rinkj_escp_flush (RinkjEscp *z)
m = (z->y - ytop + z->spacing - 1 - plane_off) / z->spacing;
if (m > z->n_pins)
- m = z->n_pins;
+ m = z->n_pins;
if (m <= 0)
- continue;
+ continue;
if (1)
- {
- /* todo: make this calculation fully agile */
- int x = (x_pass & 3);
- status = rinkj_byte_stream_printf (z->out, "\033($\4%c%c%c%c%c",
- 0, x & 0xff,
- (x >> 8) & 0xff,
- (x >> 16) & 0xff,
- (x >> 24) & 0xff);
-
- if (status < 0) return status;
- }
+ {
+ /* todo: make this calculation fully agile */
+ int x = (x_pass & 3);
+ status = rinkj_byte_stream_printf (z->out, "\033($\4%c%c%c%c%c",
+ 0, x & 0xff,
+ (x >> 8) & 0xff,
+ (x >> 16) & 0xff,
+ (x >> 24) & 0xff);
+
+ if (status < 0) return status;
+ }
status = rinkj_byte_stream_printf (z->out, "\033i%c%c%c%c%c%c%c",
- color[i],
- rle,
- z->head_bps,
- xsb_out & 0xff,
- (xsb_out >> 8) & 0xff,
- m & 0xff, m >> 8);
+ color[i],
+ rle,
+ z->head_bps,
+ xsb_out & 0xff,
+ (xsb_out >> 8) & 0xff,
+ m & 0xff, m >> 8);
if (status < 0) return status;
for (j = 0; j < m; j++)
- {
- const char *line;
-
- bufy = (ytop + j * z->spacing + plane_off) % z->bufheight;
- line = z->buf + bufy * z->rowstride + plane[i] * z->planestride;
- if (z->buf_linevalid[bufy * z->num_chan + i] & pass_mask)
- rinkj_escp_shuffle (thisbuf, line, x_pass, xsb,
- z->passes_per_scan, z->bps, z->head_bps);
- else
- memset (thisbuf, 0, xsb_out);
- z->buf_linevalid[bufy * z->num_chan + i] &= ~pass_mask;
+ {
+ const char *line;
+
+ bufy = (ytop + j * z->spacing + plane_off) % z->bufheight;
+ line = z->buf + bufy * z->rowstride + plane[i] * z->planestride;
+ if (z->buf_linevalid[bufy * z->num_chan + i] & pass_mask)
+ rinkj_escp_shuffle (thisbuf, line, x_pass, xsb,
+ z->passes_per_scan, z->bps, z->head_bps);
+ else
+ memset (thisbuf, 0, xsb_out);
+ z->buf_linevalid[bufy * z->num_chan + i] &= ~pass_mask;
#ifdef VERBOSE
- if (i == 0 && j == 0)
- {
- fprintf (stderr, "flush line[0] = %d shuffled[0] = %d\n",
- line[0], thisbuf[0]);
- }
+ if (i == 0 && j == 0)
+ {
+ fprintf (stderr, "flush line[0] = %d shuffled[0] = %d\n",
+ line[0], thisbuf[0]);
+ }
#endif
- if (rle)
- {
- int nbytes;
-
- nbytes = rinkj_escp_compress_rle (compress_buf, thisbuf, xsb_out);
- status = rinkj_byte_stream_write (z->out, compress_buf, nbytes);
- }
- else
- status = rinkj_byte_stream_write (z->out, thisbuf, xsb_out);
- }
+ if (rle)
+ {
+ int nbytes;
+
+ nbytes = rinkj_escp_compress_rle (compress_buf, thisbuf, xsb_out);
+ status = rinkj_byte_stream_write (z->out, compress_buf, nbytes);
+ }
+ else
+ status = rinkj_byte_stream_write (z->out, thisbuf, xsb_out);
+ }
if (status < 0) return status;
#if 0
status = rinkj_byte_stream_puts (z->out, "\r");
@@ -984,10 +984,10 @@ rinkj_escp_flush_bottom (RinkjEscp *z)
{
ytop = rinkj_escp_ytop (z, z->pass, NULL);
if (ytop >= z->y)
- break;
+ break;
status = rinkj_escp_flush (z);
if (status != 0)
- return status;
+ return status;
}
return 0;
}
diff --git a/gs/base/rinkj/rinkj-epson870.h b/gs/base/rinkj/rinkj-epson870.h
index ecf878342..fa069ad2d 100644
--- a/gs/base/rinkj/rinkj-epson870.h
+++ b/gs/base/rinkj/rinkj-epson870.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/rinkj/rinkj-screen-eb.c b/gs/base/rinkj/rinkj-screen-eb.c
index 5c4397305..25ecb5584 100644
--- a/gs/base/rinkj/rinkj-screen-eb.c
+++ b/gs/base/rinkj/rinkj-screen-eb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,19 +53,19 @@ rinkj_screen_eb_set (RinkjDevice *self, const char *config)
for (p = config; (key = rinkj_config_keyval (p, &val, &next)); p = next)
{
if (!strcmp (key, "Dither"))
- {
- if (!strcmp (val, "1"))
- z->bps = 1;
- else if (!strcmp (val, "2"))
- {
- z->bps = 2;
- rinkj_device_set_param_int (z->dev_out, "BitsPerSample", 2);
- }
- }
+ {
+ if (!strcmp (val, "1"))
+ z->bps = 1;
+ else if (!strcmp (val, "2"))
+ {
+ z->bps = 2;
+ rinkj_device_set_param_int (z->dev_out, "BitsPerSample", 2);
+ }
+ }
else if (!strcmp (key, "Aspect"))
- {
- z->aspect = atoi (val);
- }
+ {
+ z->aspect = atoi (val);
+ }
free (key);
free (val);
}
@@ -180,52 +180,52 @@ rinkj_screen_eb_write (RinkjDevice *self, const char **data)
for (; status >= 0 && z->yrem < z->height_out; z->yrem += z->height_in)
{
even_better_line (z->dither,
- (unsigned char *)out_buf,
- (unsigned char *)data_permuted);
+ (unsigned char *)out_buf,
+ (unsigned char *)data_permuted);
for (i = 0; i < n_planes; i++)
- {
- uchar *pd = out_data[permutation[i]];
- uchar *pb = out_buf[i];
- int x;
-
- if (z->bps == 2)
- {
- for (x = 0; x < xs - 3; x += 4)
- {
- pd[x >> 2] = (pb[x] << 6) | (pb[x + 1] << 4) |
- (pb[x + 2] << 2) | pb[x + 3];
- }
- if (x < xs)
- {
- int j;
- uchar b = 0;
-
- for (j = 0; j < xs - x; j++)
- b |= pb[x + j] << ((3 - j) << 1);
- pd[x >> 2] = b;
- }
- }
- else if (z->bps == 1)
- {
- for (x = 0; x < xs - 7; x += 8)
- {
- pd[x >> 3] = (pb[x] << 7) | (pb[x + 1] << 6) |
- (pb[x + 2] << 5) | (pb[x + 3] << 4) |
- (pb[x + 4] << 3) | (pb[x + 5] << 2) |
- (pb[x + 6] << 1) | (pb[x + 7] << 0);
- }
- if (x < xs)
- {
- int j;
- uchar b = 0;
-
- for (j = 0; j < xs - x; j++)
- b |= pb[x + j] << (7 - j);
- pd[x >> 3] = b;
- }
- }
- }
+ {
+ uchar *pd = out_data[permutation[i]];
+ uchar *pb = out_buf[i];
+ int x;
+
+ if (z->bps == 2)
+ {
+ for (x = 0; x < xs - 3; x += 4)
+ {
+ pd[x >> 2] = (pb[x] << 6) | (pb[x + 1] << 4) |
+ (pb[x + 2] << 2) | pb[x + 3];
+ }
+ if (x < xs)
+ {
+ int j;
+ uchar b = 0;
+
+ for (j = 0; j < xs - x; j++)
+ b |= pb[x + j] << ((3 - j) << 1);
+ pd[x >> 2] = b;
+ }
+ }
+ else if (z->bps == 1)
+ {
+ for (x = 0; x < xs - 7; x += 8)
+ {
+ pd[x >> 3] = (pb[x] << 7) | (pb[x + 1] << 6) |
+ (pb[x + 2] << 5) | (pb[x + 3] << 4) |
+ (pb[x + 4] << 3) | (pb[x + 5] << 2) |
+ (pb[x + 6] << 1) | (pb[x + 7] << 0);
+ }
+ if (x < xs)
+ {
+ int j;
+ uchar b = 0;
+
+ for (j = 0; j < xs - x; j++)
+ b |= pb[x + j] << (7 - j);
+ pd[x >> 3] = b;
+ }
+ }
+ }
status = rinkj_device_write (z->dev_out, (const char **)out_data);
}
diff --git a/gs/base/rinkj/rinkj-screen-eb.h b/gs/base/rinkj/rinkj-screen-eb.h
index b96ac6a5a..282241280 100644
--- a/gs/base/rinkj/rinkj-screen-eb.h
+++ b/gs/base/rinkj/rinkj-screen-eb.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sa85d.c b/gs/base/sa85d.c
index 02f657afa..956d765fc 100644
--- a/gs/base/sa85d.c
+++ b/gs/base/sa85d.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@ s_A85D_init(stream_state * st)
static int a85d_finish(int, ulong, stream_cursor_write *);
static int
s_A85D_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_A85D_state *const ss = (stream_A85D_state *) st;
register const byte *p = pr->ptr;
@@ -54,118 +54,118 @@ s_A85D_process(stream_state * st, stream_cursor_read * pr,
/* scan to make sure that an EOD isn't fully contained in the */
/* last part of the buffer (between rlimit and pr->limit). */
while (r < pr->limit) {
- if (*++r == '~')
- while (r < pr->limit)
- if (*++r == '>') {
- /* we have both characters of a complete EOD. */
- rlimit = pr->limit; /* go ahead and process everything */
- r = rlimit; /* break out of the while loops */
- break;
- }
+ if (*++r == '~')
+ while (r < pr->limit)
+ if (*++r == '>') {
+ /* we have both characters of a complete EOD. */
+ rlimit = pr->limit; /* go ahead and process everything */
+ r = rlimit; /* break out of the while loops */
+ break;
+ }
}
while (p < rlimit) {
- int ch = *++p;
- uint ccode = ch - '!';
+ int ch = *++p;
+ uint ccode = ch - '!';
- if (ccode < 85) { /* catches ch < '!' as well */
- if (ccount == 4) {
- /*
- * We've completed a 32-bit group. Make sure we have
- * room for it in the output.
- */
- if (wlimit - q < 4) {
- p--;
- status = 1;
- break;
- }
- /* Check for overflow condition, throw ioerror if so */
- if (word >= 0x03030303 && ccode > 0) {
- status = ERRC;
- break;
- }
- word = word * 85 + ccode;
- q[1] = (byte) (word >> 24);
- q[2] = (byte) (word >> 16);
- q[3] = (byte) ((uint) word >> 8);
- q[4] = (byte) word;
- q += 4;
- word = 0;
- ccount = 0;
- } else {
- word = word * 85 + ccode;
- ++ccount;
- }
- } else if (ch == 'z' && ccount == 0) {
- if (wlimit - q < 4) {
- p--;
- status = 1;
- break;
- }
- q[1] = q[2] = q[3] = q[4] = 0,
- q += 4;
- } else if (scan_char_decoder[ch] == ctype_space)
- DO_NOTHING;
- else if (ch == '~') {
- int i = 1;
+ if (ccode < 85) { /* catches ch < '!' as well */
+ if (ccount == 4) {
+ /*
+ * We've completed a 32-bit group. Make sure we have
+ * room for it in the output.
+ */
+ if (wlimit - q < 4) {
+ p--;
+ status = 1;
+ break;
+ }
+ /* Check for overflow condition, throw ioerror if so */
+ if (word >= 0x03030303 && ccode > 0) {
+ status = ERRC;
+ break;
+ }
+ word = word * 85 + ccode;
+ q[1] = (byte) (word >> 24);
+ q[2] = (byte) (word >> 16);
+ q[3] = (byte) ((uint) word >> 8);
+ q[4] = (byte) word;
+ q += 4;
+ word = 0;
+ ccount = 0;
+ } else {
+ word = word * 85 + ccode;
+ ++ccount;
+ }
+ } else if (ch == 'z' && ccount == 0) {
+ if (wlimit - q < 4) {
+ p--;
+ status = 1;
+ break;
+ }
+ q[1] = q[2] = q[3] = q[4] = 0,
+ q += 4;
+ } else if (scan_char_decoder[ch] == ctype_space)
+ DO_NOTHING;
+ else if (ch == '~') {
+ int i = 1;
- rlimit = pr->limit; /* Here we use the real "limit" */
- /* Handle odd bytes. */
- if (p == rlimit) {
- if (last)
- status = ERRC;
- else
- p--;
- break;
- }
- if ((int)(wlimit - q) < ccount - 1) {
- status = 1;
- p--;
- break;
- }
+ rlimit = pr->limit; /* Here we use the real "limit" */
+ /* Handle odd bytes. */
+ if (p == rlimit) {
+ if (last)
+ status = ERRC;
+ else
+ p--;
+ break;
+ }
+ if ((int)(wlimit - q) < ccount - 1) {
+ status = 1;
+ p--;
+ break;
+ }
- /* According to PLRM 3rd, if the A85 filter encounters '~',
- * the next character must be '>'.
- * And any other characters should raise an ioerror.
- * But Adobe Acrobat allows CR/LF between ~ and >.
- * So we allow CR/LF between them. */
- /* PDF further relaxes the requirements and accepts bare '~'.
- */
- while ((p[i] == 13 || p[i] == 10) && (p+i <= rlimit))
- i++;
- if (p[i] != '>') {
- if (ss->pdf_rules) {
- if (p[i] == 13 || p[i] == 10) {
- if (!last)
- break;
- } else {
- p--;
- }
- } else {
- if (p+i == rlimit) {
- if (last)
- status = ERRC;
- else
- p--; /* we'll see the '~' after filling the buffer */
- }
- break;
- }
- }
- p += i; /* advance to the '>' */
- pw->ptr = q;
- status = a85d_finish(ccount, word, pw);
- q = pw->ptr;
- break;
- } else { /* syntax error or exception */
- status = ERRC;
- break;
- }
+ /* According to PLRM 3rd, if the A85 filter encounters '~',
+ * the next character must be '>'.
+ * And any other characters should raise an ioerror.
+ * But Adobe Acrobat allows CR/LF between ~ and >.
+ * So we allow CR/LF between them. */
+ /* PDF further relaxes the requirements and accepts bare '~'.
+ */
+ while ((p[i] == 13 || p[i] == 10) && (p+i <= rlimit))
+ i++;
+ if (p[i] != '>') {
+ if (ss->pdf_rules) {
+ if (p[i] == 13 || p[i] == 10) {
+ if (!last)
+ break;
+ } else {
+ p--;
+ }
+ } else {
+ if (p+i == rlimit) {
+ if (last)
+ status = ERRC;
+ else
+ p--; /* we'll see the '~' after filling the buffer */
+ }
+ break;
+ }
+ }
+ p += i; /* advance to the '>' */
+ pw->ptr = q;
+ status = a85d_finish(ccount, word, pw);
+ q = pw->ptr;
+ break;
+ } else { /* syntax error or exception */
+ status = ERRC;
+ break;
+ }
}
pw->ptr = q;
if (status == 0 && last) {
- if ((int)(wlimit - q) < ccount - 1)
- status = 1;
- else
- status = a85d_finish(ccount, word, pw);
+ if ((int)(wlimit - q) < ccount - 1)
+ status = 1;
+ else
+ status = a85d_finish(ccount, word, pw);
}
pr->ptr = p;
ss->odd = ccount;
@@ -181,24 +181,24 @@ a85d_finish(int ccount, ulong word, stream_cursor_write * pw)
int status = EOFC;
switch (ccount) {
- case 0:
- break;
- case 1: /* syntax error */
- status = ERRC;
- break;
- case 2: /* 1 odd byte */
- word = word * (85L * 85 * 85) + 85L * 85 * 85 - 1L;
- goto o1;
- case 3: /* 2 odd bytes */
- word = word * (85L * 85) + 85L * 85L - 1L;
- goto o2;
- case 4: /* 3 odd bytes */
- word = word * 85L + 84L;
- q[3] = (byte) (word >> 8);
+ case 0:
+ break;
+ case 1: /* syntax error */
+ status = ERRC;
+ break;
+ case 2: /* 1 odd byte */
+ word = word * (85L * 85 * 85) + 85L * 85 * 85 - 1L;
+ goto o1;
+ case 3: /* 2 odd bytes */
+ word = word * (85L * 85) + 85L * 85L - 1L;
+ goto o2;
+ case 4: /* 3 odd bytes */
+ word = word * 85L + 84L;
+ q[3] = (byte) (word >> 8);
o2: q[2] = (byte) (word >> 16);
o1: q[1] = (byte) (word >> 24);
- q += ccount - 1;
- pw->ptr = q;
+ q += ccount - 1;
+ pw->ptr = q;
}
return status;
}
diff --git a/gs/base/sa85d.h b/gs/base/sa85d.h
index 4a264bb35..0b9fc9eca 100644
--- a/gs/base/sa85d.h
+++ b/gs/base/sa85d.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sa85x.h b/gs/base/sa85x.h
index 27f18c044..60682fd7c 100644
--- a/gs/base/sa85x.h
+++ b/gs/base/sa85x.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/saes.c b/gs/base/saes.c
index a08fc93a1..b7c2cc282 100644
--- a/gs/base/saes.c
+++ b/gs/base/saes.c
@@ -24,19 +24,19 @@
/* stream implementation */
private_st_aes_state(); /* creates a gc object for our state,
- defined in saes.h */
+ defined in saes.h */
/* Store a key in our crypt context */
int
s_aes_set_key(stream_aes_state * state, const unsigned char *key,
- int keylength)
+ int keylength)
{
int code = 0;
if ( (keylength < 1) || (keylength > SAES_MAX_KEYLENGTH) )
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (key == NULL)
- return_error(gs_error_invalidaccess);
+ return_error(gs_error_invalidaccess);
/* we can't set the key here because the interpreter's
filter implementation wants to duplicate our state
@@ -90,7 +90,7 @@ s_aes_release(stream_state *ss)
*/
static int
s_aes_process(stream_state * ss, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_aes_state *const state = (stream_aes_state *) ss;
const unsigned char *limit;
@@ -101,11 +101,11 @@ s_aes_process(stream_state * ss, stream_cursor_read * pr,
/* figure out if we're going to run out of space */
if (in_size > out_size) {
- limit = pr->ptr + out_size;
- status = 1; /* need more output space */
+ limit = pr->ptr + out_size;
+ status = 1; /* need more output space */
} else {
- limit = pr->limit;
- status = last ? EOFC : 0; /* need more input */
+ limit = pr->limit;
+ status = last ? EOFC : 0; /* need more input */
}
/* set up state and context */
@@ -114,30 +114,30 @@ s_aes_process(stream_state * ss, stream_cursor_read * pr,
contains internal pointers, so we need to store it separately
in immovable memory like any opaque structure. */
state->ctx = (aes_context *)gs_alloc_bytes_immovable(state->memory,
- sizeof(aes_context), "aes context structure");
+ sizeof(aes_context), "aes context structure");
if (state->ctx == NULL) {
- gs_throw(gs_error_VMerror, "could not allocate aes context");
- return ERRC;
+ gs_throw(gs_error_VMerror, "could not allocate aes context");
+ return ERRC;
}
if (state->keylength < 1 || state->keylength > SAES_MAX_KEYLENGTH) {
- gs_throw1(gs_error_rangecheck, "invalid aes key length (%d bytes)",
- state->keylength);
- return ERRC;
+ gs_throw1(gs_error_rangecheck, "invalid aes key length (%d bytes)",
+ state->keylength);
+ return ERRC;
}
aes_setkey_dec(state->ctx, state->key, state->keylength * 8);
}
if (!state->initialized) {
- /* read the initialization vector from the first 16 bytes */
- if (in_size < 16) return 0; /* get more data */
- memcpy(state->iv, pr->ptr + 1, 16);
- state->initialized = 1;
- pr->ptr += 16;
+ /* read the initialization vector from the first 16 bytes */
+ if (in_size < 16) return 0; /* get more data */
+ memcpy(state->iv, pr->ptr + 1, 16);
+ state->initialized = 1;
+ pr->ptr += 16;
}
/* decrypt available blocks */
while (pr->ptr + 16 <= limit) {
aes_crypt_cbc(state->ctx, AES_DECRYPT, 16, state->iv,
- pr->ptr + 1, temp);
+ pr->ptr + 1, temp);
pr->ptr += 16;
if (last && pr->ptr == pr->limit) {
/* we're on the last block; unpad if necessary */
diff --git a/gs/base/saes.h b/gs/base/saes.h
index e3dabcac2..d594f5f8e 100644
--- a/gs/base/saes.h
+++ b/gs/base/saes.h
@@ -43,7 +43,7 @@ typedef struct stream_aes_state_s stream_aes_state;
#endif
int s_aes_set_key(stream_aes_state * state,
- const unsigned char *key, int keylength);
+ const unsigned char *key, int keylength);
void s_aes_set_padding(stream_aes_state *state, int use_padding);
/* state declaration macro;
diff --git a/gs/base/sarc4.c b/gs/base/sarc4.c
index fe75e4a15..d3f99733d 100644
--- a/gs/base/sarc4.c
+++ b/gs/base/sarc4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,7 +25,7 @@
* cipher commonly known as 'arcfour' based on Bruce Schneier's
* description of the algorithm in _Applied Cryptography_. Arcfour
* is believed to be functionally equivalent to the RC4(tm) cipher
- * mentioned in the PDF specification. (RC4 is a registered
+ * mentioned in the PDF specification. (RC4 is a registered
* trademark of RSA Data Security, Inc.)
*/
@@ -36,25 +36,25 @@ private_st_arcfour_state(); /* creates a gc object for our state, defined in sar
/* initialize the S box using the given key */
int
s_arcfour_set_key(stream_arcfour_state * state, const unsigned char *key,
- int keylength)
+ int keylength)
{
unsigned int x, y;
unsigned char s, *S = state->S;
if (keylength < 1)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* initialize to eponymous values */
for (x = 0; x < 256; x++)
- S[x] = x;
+ S[x] = x;
/* scramble based on the key */
y = 0;
for (x = 0; x < 256; x++) {
- y = (y + S[x] + key[x % keylength]) & 0xFF;
- s = S[x];
- S[x] = S[y];
- S[y] = s;
+ y = (y + S[x] + key[x % keylength]) & 0xFF;
+ s = S[x];
+ S[x] = S[y];
+ S[y] = s;
}
/* initialize the indicies */
@@ -70,7 +70,7 @@ s_arcfour_set_key(stream_arcfour_state * state, const unsigned char *key,
*/
static int
s_arcfour_process(stream_state * ss, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_arcfour_state *const state = (stream_arcfour_state *) ss;
unsigned int x = state->x;
@@ -82,22 +82,22 @@ s_arcfour_process(stream_state * ss, stream_cursor_read * pr,
/* figure out if we're going to run out of space */
if ((pr->limit - pr->ptr) > (pw->limit - pw->ptr)) {
- limit = pr->ptr + (pw->limit - pw->ptr);
- status = 1;
+ limit = pr->ptr + (pw->limit - pw->ptr);
+ status = 1;
} else {
- limit = pr->limit;
- status = last ? EOFC : 0;
+ limit = pr->limit;
+ status = last ? EOFC : 0;
}
/* generate a pseudorandom byte stream and xor it with the input */
while (pr->ptr < limit) {
- x = (x + 1) & 0xFF;
- y = (y + S[x]) & 0xFF;
- s = S[x];
- S[x] = S[y];
- S[y] = s;
- z = S[(S[x] + S[y]) & 0xFF];
-
- *++pw->ptr = (*++pr->ptr) ^ z;
+ x = (x + 1) & 0xFF;
+ y = (y + S[x]) & 0xFF;
+ s = S[x];
+ S[x] = S[y];
+ S[y] = s;
+ z = S[(S[x] + S[y]) & 0xFF];
+
+ *++pw->ptr = (*++pr->ptr) ^ z;
}
/* save state */
state->x = x;
@@ -125,4 +125,3 @@ s_arcfour_process_buffer(stream_arcfour_state *ss, byte *buf, int buf_size)
r.limit = w.limit = buf - 1 + buf_size;
return s_arcfour_process((stream_state *)ss, &r, &w, unused);
}
-
diff --git a/gs/base/sarc4.h b/gs/base/sarc4.h
index 9b1d927a6..f8117b4e5 100644
--- a/gs/base/sarc4.h
+++ b/gs/base/sarc4.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@ typedef struct stream_arcfour_state_s stream_arcfour_state;
#endif
int s_arcfour_set_key(stream_arcfour_state * state, const unsigned char *key,
- int keylength);
+ int keylength);
#define private_st_arcfour_state() /* used in sarc4.c */\
gs_private_st_simple(st_arcfour_state, stream_arcfour_state,\
diff --git a/gs/base/sbcp.c b/gs/base/sbcp.c
index 169968b74..04798cc86 100644
--- a/gs/base/sbcp.c
+++ b/gs/base/sbcp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@
/* Process a buffer */
static int
s_xBCPE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last, const byte * escaped)
+ stream_cursor_write * pw, bool last, const byte * escaped)
{
const byte *p = pr->ptr;
const byte *rlimit = pr->limit;
@@ -45,19 +45,19 @@ s_xBCPE_process(stream_state * st, stream_cursor_read * pr,
const byte *end = p + min(rcount, wcount);
while (p < end) {
- byte ch = *++p;
-
- if (ch <= 31 && escaped[ch]) {
- if (p == rlimit) {
- p--;
- break;
- }
- *++q = CtrlA;
- ch ^= 0x40;
- if (--wcount < rcount)
- end--;
- }
- *++q = ch;
+ byte ch = *++p;
+
+ if (ch <= 31 && escaped[ch]) {
+ if (p == rlimit) {
+ p--;
+ break;
+ }
+ *++q = CtrlA;
+ ch ^= 0x40;
+ if (--wcount < rcount)
+ end--;
+ }
+ *++q = ch;
}
pr->ptr = p;
pw->ptr = q;
@@ -67,24 +67,24 @@ s_xBCPE_process(stream_state * st, stream_cursor_read * pr,
/* Actual process procedures */
static int
s_BCPE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
static const byte escaped[32] =
{
- 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
+ 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
};
return s_xBCPE_process(st, pr, pw, last, escaped);
}
static int
s_TBCPE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
static const byte escaped[32] =
{
- 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0
+ 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0
};
return s_xBCPE_process(st, pr, pw, last, escaped);
@@ -116,7 +116,7 @@ s_BCPD_init(stream_state * st)
/* Process a buffer */
static int
s_xBCPD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last, bool tagged)
+ stream_cursor_write * pw, bool last, bool tagged)
{
stream_BCPD_state *const ss = (stream_BCPD_state *) st;
const byte *p = pr->ptr;
@@ -128,93 +128,93 @@ s_xBCPD_process(stream_state * st, stream_cursor_read * pr,
bool escaped = ss->escaped;
for (;;) {
- byte ch;
-
- if (copy_count) {
- if (q == wlimit) {
- status = (p < rlimit ? 1 : 0);
- break;
- }
- *++q = *++(ss->copy_ptr);
- copy_count--;
- continue;
- }
- if (p == rlimit) {
- status = 0;
- break;
- }
- ch = *++p;
- if (ch <= 31)
- switch (ch) {
- case CtrlA:
- if (escaped) {
- status = ERRC;
- goto out;
- }
- escaped = true;
- continue;
- case CtrlC:
- status = (*ss->signal_interrupt) (st);
- if (status < 0)
- goto out;
- continue;
- case CtrlD:
- if (escaped) {
- status = ERRC;
- goto out;
- }
- status = EOFC;
- goto out;
- case CtrlE:
- continue;
- case CtrlQ:
- continue;
- case CtrlS:
- continue;
- case CtrlT:
- status = (*ss->request_status) (st);
- if (status < 0)
- goto out;
- continue;
- case CtrlBksl:
- continue;
- }
- if (q == wlimit) {
- p--;
- status = 1;
- break;
- }
- if (escaped) {
- escaped = false;
- switch (ch) {
- case '[':
- if (!tagged) {
- status = ERRC;
- goto out;
- }
- /* falls through */
- case 'A':
- case 'C':
- case 'D':
- case 'E':
- case 'Q':
- case 'S':
- case 'T':
- case '\\':
- ch ^= 0x40;
- break;
- case 'M':
- if (!tagged) {
- status = ERRC;
- goto out;
- }
- continue;
- default:
- status = ERRC;
- goto out;
- }
- }
- *++q = ch;
+ byte ch;
+
+ if (copy_count) {
+ if (q == wlimit) {
+ status = (p < rlimit ? 1 : 0);
+ break;
+ }
+ *++q = *++(ss->copy_ptr);
+ copy_count--;
+ continue;
+ }
+ if (p == rlimit) {
+ status = 0;
+ break;
+ }
+ ch = *++p;
+ if (ch <= 31)
+ switch (ch) {
+ case CtrlA:
+ if (escaped) {
+ status = ERRC;
+ goto out;
+ }
+ escaped = true;
+ continue;
+ case CtrlC:
+ status = (*ss->signal_interrupt) (st);
+ if (status < 0)
+ goto out;
+ continue;
+ case CtrlD:
+ if (escaped) {
+ status = ERRC;
+ goto out;
+ }
+ status = EOFC;
+ goto out;
+ case CtrlE:
+ continue;
+ case CtrlQ:
+ continue;
+ case CtrlS:
+ continue;
+ case CtrlT:
+ status = (*ss->request_status) (st);
+ if (status < 0)
+ goto out;
+ continue;
+ case CtrlBksl:
+ continue;
+ }
+ if (q == wlimit) {
+ p--;
+ status = 1;
+ break;
+ }
+ if (escaped) {
+ escaped = false;
+ switch (ch) {
+ case '[':
+ if (!tagged) {
+ status = ERRC;
+ goto out;
+ }
+ /* falls through */
+ case 'A':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'Q':
+ case 'S':
+ case 'T':
+ case '\\':
+ ch ^= 0x40;
+ break;
+ case 'M':
+ if (!tagged) {
+ status = ERRC;
+ goto out;
+ }
+ continue;
+ default:
+ status = ERRC;
+ goto out;
+ }
+ }
+ *++q = ch;
}
out:ss->copy_count = copy_count;
ss->escaped = escaped;
@@ -226,13 +226,13 @@ s_xBCPD_process(stream_state * st, stream_cursor_read * pr,
/* Actual process procedures */
static int
s_BCPD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
return s_xBCPD_process(st, pr, pw, last, false);
}
static int
s_TBCPD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
return s_xBCPD_process(st, pr, pw, last, true);
}
diff --git a/gs/base/sbcp.h b/gs/base/sbcp.h
index a975b2a49..737d89802 100644
--- a/gs/base/sbcp.h
+++ b/gs/base/sbcp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sbhc.c b/gs/base/sbhc.c
index 58c3b03e6..11d57d050 100644
--- a/gs/base/sbhc.c
+++ b/gs/base/sbhc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,11 +40,11 @@ s_BHCE_init(register stream_state * st)
stream_BHCE_state *const ss = (stream_BHCE_state *) st;
hce_code *encode = ss->encode.codes =
(hce_code *) gs_alloc_byte_array(st->memory,
- ss->definition.num_values,
- sizeof(hce_code), "BHCE encode");
+ ss->definition.num_values,
+ sizeof(hce_code), "BHCE encode");
if (encode == 0)
- return ERRC;
+ return ERRC;
/****** WRONG ******/
hc_make_encoding(encode, &ss->definition);
return s_BHCE_reinit(st);
@@ -62,7 +62,7 @@ s_BHCE_release(stream_state * st)
/* Process a buffer. */
static int
s_BHCE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_BHCE_state *const ss = (stream_BHCE_state *) st;
const byte *p = pr->ptr;
@@ -81,65 +81,65 @@ s_BHCE_process(stream_state * st, stream_cursor_read * pr,
hce_load_state();
while (p < rlimit && q < wlimit) {
- uint value = *++p;
- const hce_code *cp;
+ uint value = *++p;
+ const hce_code *cp;
- if (value >= num_values) {
- status = ERRC;
- break;
- }
- if (value == zero_value) { /* Accumulate a run of zeros. */
- ++zeros;
- if (zeros != zero_max)
- continue;
- /* We've scanned the longest run we can encode. */
- cp = &encode[zeros - 2 + zero_runs];
- zeros = 0;
- hc_put_code((stream_hc_state *) ss, q, cp);
- continue;
- }
- /* Check whether we need to put out a zero run. */
- if (zeros > 0) {
- --p;
- cp = (zeros == 1 ? &encode[0] :
- &encode[zeros - 2 + zero_runs]);
- zeros = 0;
- hc_put_code((stream_hc_state *) ss, q, cp);
- continue;
- }
- cp = &encode[value];
- hc_put_code((stream_hc_state *) ss, q, cp);
+ if (value >= num_values) {
+ status = ERRC;
+ break;
+ }
+ if (value == zero_value) { /* Accumulate a run of zeros. */
+ ++zeros;
+ if (zeros != zero_max)
+ continue;
+ /* We've scanned the longest run we can encode. */
+ cp = &encode[zeros - 2 + zero_runs];
+ zeros = 0;
+ hc_put_code((stream_hc_state *) ss, q, cp);
+ continue;
+ }
+ /* Check whether we need to put out a zero run. */
+ if (zeros > 0) {
+ --p;
+ cp = (zeros == 1 ? &encode[0] :
+ &encode[zeros - 2 + zero_runs]);
+ zeros = 0;
+ hc_put_code((stream_hc_state *) ss, q, cp);
+ continue;
+ }
+ cp = &encode[value];
+ hc_put_code((stream_hc_state *) ss, q, cp);
}
if (q >= wlimit)
- status = 1;
+ status = 1;
wlimit = pw->limit;
if (last && status == 0) {
- if (zeros > 0) { /* Put out a final run of zeros. */
- const hce_code *cp = (zeros == 1 ? &encode[0] :
- &encode[zeros - 2 + zero_runs]);
+ if (zeros > 0) { /* Put out a final run of zeros. */
+ const hce_code *cp = (zeros == 1 ? &encode[0] :
+ &encode[zeros - 2 + zero_runs]);
- if (!hce_bits_available(cp->code_length))
- status = 1;
- else {
- hc_put_code((stream_hc_state *) ss, q, cp);
- zeros = 0;
- }
- }
- if (ss->EndOfData) { /* Put out the EOD code if we have room. */
- const hce_code *cp = &encode[num_values - 1];
+ if (!hce_bits_available(cp->code_length))
+ status = 1;
+ else {
+ hc_put_code((stream_hc_state *) ss, q, cp);
+ zeros = 0;
+ }
+ }
+ if (ss->EndOfData) { /* Put out the EOD code if we have room. */
+ const hce_code *cp = &encode[num_values - 1];
- if (!hce_bits_available(cp->code_length))
- status = 1;
- else
- hc_put_code((stream_hc_state *) ss, q, cp);
- } else {
- if (q >= wlimit)
- status = 1;
- }
- if (!status) {
- q = hc_put_last_bits((stream_hc_state *) ss, q);
- goto ns;
- }
+ if (!hce_bits_available(cp->code_length))
+ status = 1;
+ else
+ hc_put_code((stream_hc_state *) ss, q, cp);
+ } else {
+ if (q >= wlimit)
+ status = 1;
+ }
+ if (!status) {
+ q = hc_put_last_bits((stream_hc_state *) ss, q);
+ goto ns;
+ }
}
hce_store_state();
ns:pr->ptr = p;
@@ -178,11 +178,11 @@ s_BHCD_init(register stream_state * st)
min(hcd_initial_bits, ss->definition.num_counts);
uint dsize = hc_sizeof_decoding(&ss->definition, initial_bits);
hcd_code *decode = ss->decode.codes =
- (hcd_code *) gs_alloc_byte_array(st->memory, dsize,
- sizeof(hcd_code), "BHCD decode");
+ (hcd_code *) gs_alloc_byte_array(st->memory, dsize,
+ sizeof(hcd_code), "BHCD decode");
if (decode == 0)
- return ERRC;
+ return ERRC;
/****** WRONG ******/
hc_make_decoding(decode, &ss->definition, initial_bits);
st->min_left = 1;
@@ -201,7 +201,7 @@ s_BHCD_release(stream_state * st)
/* Process a buffer. */
static int
s_BHCD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_BHCD_state *const ss = (stream_BHCD_state *) st;
@@ -216,58 +216,58 @@ s_BHCD_process(stream_state * st, stream_cursor_read * pr,
bhcd_load_state();
z:for (; zeros > 0; --zeros) {
- if (q >= wlimit) {
- status = 1;
- goto out;
- }
- *++q = 0;
+ if (q >= wlimit) {
+ status = 1;
+ goto out;
+ }
+ *++q = 0;
}
for (;;) {
- const hcd_code *cp;
- int clen;
+ const hcd_code *cp;
+ int clen;
- hcd_ensure_bits(initial_bits, x1);
- cp = &decode[hcd_peek_var_bits(initial_bits)];
+ hcd_ensure_bits(initial_bits, x1);
+ cp = &decode[hcd_peek_var_bits(initial_bits)];
w1:if (q >= wlimit) {
- status = 1;
- break;
- }
- if ((clen = cp->code_length) > initial_bits) {
- if (!hcd_bits_available(clen)) { /* We don't have enough bits for */
- /* all possible codes that begin this way, */
- /* but we might have enough for */
- /* the next code. */
+ status = 1;
+ break;
+ }
+ if ((clen = cp->code_length) > initial_bits) {
+ if (!hcd_bits_available(clen)) { /* We don't have enough bits for */
+ /* all possible codes that begin this way, */
+ /* but we might have enough for */
+ /* the next code. */
/****** NOT IMPLEMENTED YET ******/
- break;
- }
- clen -= initial_bits;
- hcd_skip_bits(initial_bits);
- hcd_ensure_bits(clen, out); /* can't exit */
- cp = &decode[cp->value + hcd_peek_var_bits(clen)];
- hcd_skip_bits(cp->code_length);
- } else {
- hcd_skip_bits(clen);
- }
- if (cp->value >= zero_runs) {
- if (cp->value == eod) {
- status = EOFC;
- goto out;
- }
- /* This code represents a run of zeros, */
- /* not a single output value. */
- zeros = cp->value - zero_runs + 2;
- goto z;
- }
- *++q = cp->value;
- continue;
- /* We don't have enough bits for all possible */
- /* codes, but we might have enough for */
- /* the next code. */
+ break;
+ }
+ clen -= initial_bits;
+ hcd_skip_bits(initial_bits);
+ hcd_ensure_bits(clen, out); /* can't exit */
+ cp = &decode[cp->value + hcd_peek_var_bits(clen)];
+ hcd_skip_bits(cp->code_length);
+ } else {
+ hcd_skip_bits(clen);
+ }
+ if (cp->value >= zero_runs) {
+ if (cp->value == eod) {
+ status = EOFC;
+ goto out;
+ }
+ /* This code represents a run of zeros, */
+ /* not a single output value. */
+ zeros = cp->value - zero_runs + 2;
+ goto z;
+ }
+ *++q = cp->value;
+ continue;
+ /* We don't have enough bits for all possible */
+ /* codes, but we might have enough for */
+ /* the next code. */
x1:cp = &decode[(bits & ((1 << bits_left) - 1)) <<
- (initial_bits - bits_left)];
- if ((clen = cp->code_length) <= bits_left)
- goto w1;
- break;
+ (initial_bits - bits_left)];
+ if ((clen = cp->code_length) <= bits_left)
+ goto w1;
+ break;
}
out:bhcd_store_state();
pw->ptr = q;
diff --git a/gs/base/sbhc.h b/gs/base/sbhc.h
index 38e421b8f..ca64912a5 100644
--- a/gs/base/sbhc.h
+++ b/gs/base/sbhc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,13 +29,13 @@
/* Common state */
#define stream_BHC_state_common\
- stream_hc_state_common;\
- hc_definition definition;\
- /* The client sets the following before initialization. */\
- bool EndOfData;\
- uint EncodeZeroRuns;\
- /* The following are updated dynamically. */\
- int zeros /* # of zeros scanned or left to output */
+ stream_hc_state_common;\
+ hc_definition definition;\
+ /* The client sets the following before initialization. */\
+ bool EndOfData;\
+ uint EncodeZeroRuns;\
+ /* The following are updated dynamically. */\
+ int zeros /* # of zeros scanned or left to output */
typedef struct stream_BHC_state_s {
stream_BHC_state_common;
} stream_BHC_state;
@@ -72,17 +72,17 @@ extern const stream_template s_BHCD_template;
/* Declare variables that hold the decoder state. */
#define bhcd_declare_state\
- hcd_declare_state;\
- int zeros
+ hcd_declare_state;\
+ int zeros
/* Load the state from the stream. */
/* Free variables: pr, ss, p, rlimit, bits, bits_left, zeros. */
#define bhcd_load_state()\
- hcd_load_state(), zeros = ss->zeros
+ hcd_load_state(), zeros = ss->zeros
/* Store the state back in the stream. */
/* Free variables: pr, ss, p, bits, bits_left, zeros. */
#define bhcd_store_state()\
- hcd_store_state(), ss->zeros = zeros
+ hcd_store_state(), ss->zeros = zeros
#endif /* sbhc_INCLUDED */
diff --git a/gs/base/sbtx.h b/gs/base/sbtx.h
index 80aa87e22..cf5d957f6 100644
--- a/gs/base/sbtx.h
+++ b/gs/base/sbtx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sbwbs.c b/gs/base/sbwbs.c
index 384b42d83..88dc52aea 100644
--- a/gs/base/sbwbs.c
+++ b/gs/base/sbwbs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,7 +52,7 @@ s_buffered_block_init(stream_state * st)
s_buffered_no_block_init(st);
ss->buffer = gs_alloc_bytes(st->memory, ss->BlockSize, "buffer");
if (ss->buffer == 0)
- return ERRC;
+ return ERRC;
/****** WRONG ******/
return 0;
}
@@ -72,17 +72,17 @@ s_buffered_process(stream_state * st, stream_cursor_read * pr, bool last)
uint left = ss->bsize - ss->bpos;
if (!ss->filling)
- return 1;
+ return 1;
if (left < count)
- count = left;
+ count = left;
if_debug3('w', "[w]buffering %d bytes to position %d, last = %s\n",
- count, ss->bpos, (last ? "true" : "false"));
+ count, ss->bpos, (last ? "true" : "false"));
memcpy(ss->buffer + ss->bpos, p + 1, count);
pr->ptr = p += count;
ss->bpos += count;
if (ss->bpos == ss->bsize || (p == rlimit && last)) {
- ss->filling = false;
- return 1;
+ ss->filling = false;
+ return 1;
}
return 0;
}
@@ -121,12 +121,12 @@ bwbs_init(stream_state * st, uint osize)
ss->bsize = ss->BlockSize;
code = s_buffered_block_init(st);
if (code != 0)
- return code;
+ return code;
ss->offsets = (void *)gs_alloc_bytes(st->memory, osize,
- "BWBlockSort offsets");
+ "BWBlockSort offsets");
if (ss->offsets == 0) {
- s_BWBS_release(st);
- return ERRC;
+ s_BWBS_release(st);
+ return ERRC;
/****** WRONG ******/
}
ss->I = -1; /* haven't read I yet */
@@ -167,29 +167,29 @@ bwbs_compare_rotations(const void *p1, const void *p2)
int swap;
if (*s1 != *s2)
- return (*s1 < *s2 ? -1 : 1);
+ return (*s1 < *s2 ? -1 : 1);
if (s1 < s2)
- swap = 1;
+ swap = 1;
else {
- const byte *t = s1;
+ const byte *t = s1;
- s1 = s2;
- s2 = t;
- swap = -1;
+ s1 = s2;
+ s2 = t;
+ swap = -1;
}
start1 = s1;
end = buffer + bwbs_compare_ss->N;
for (s1++, s2++; s2 < end; s1++, s2++)
- if (*s1 != *s2)
- return (*s1 < *s2 ? -swap : swap);
+ if (*s1 != *s2)
+ return (*s1 < *s2 ? -swap : swap);
s2 = buffer;
for (; s1 < end; s1++, s2++)
- if (*s1 != *s2)
- return (*s1 < *s2 ? -swap : swap);
+ if (*s1 != *s2)
+ return (*s1 < *s2 ? -swap : swap);
s1 = buffer;
for (; s1 < start1; s1++, s2++)
- if (*s1 != *s2)
- return (*s1 < *s2 ? -swap : swap);
+ if (*s1 != *s2)
+ return (*s1 < *s2 ? -swap : swap);
return 0;
}
/* Sort the strings. */
@@ -204,28 +204,28 @@ bwbse_sort(const byte * buffer, uint * indices, int N)
memset(C, 0, sizeof(Cs));
for (j = 0; j < N; j++)
- C[buffer[j]]++;
+ C[buffer[j]]++;
for (ch = 0; ch <= 255; ch++) {
- sum += C[ch];
- C[ch] = sum - C[ch];
+ sum += C[ch];
+ C[ch] = sum - C[ch];
}
for (j = 0; j < N; j++)
- indices[C[buffer[j]]++] = j;
+ indices[C[buffer[j]]++] = j;
/* Now C[ch] = the number of strings that start */
/* with a character less than or equal to ch. */
sum = 0;
/* qsort each bucket produced by the radix sort. */
for (ch = 0; ch <= 255; sum = C[ch], ch++)
- qsort(indices + sum, C[ch] - sum,
- sizeof(*indices),
- bwbs_compare_rotations);
+ qsort(indices + sum, C[ch] - sum,
+ sizeof(*indices),
+ bwbs_compare_rotations);
#undef C
}
/* Encode a buffer */
static int
s_BWBSE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_BWBS_state *const ss = (stream_BWBS_state *) st;
register byte *q = pw->ptr;
@@ -234,56 +234,56 @@ s_BWBSE_process(stream_state * st, stream_cursor_read * pr,
uint *indices = ss->offsets;
if (ss->filling) {
- int status, j, N;
- byte *buffer = ss->buffer;
- if (wcount < sizeof(int) * 2)
- return 1;
-
- /* Continue filling the buffer. */
- status = s_buffered_process(st, pr, last);
- if (!status)
- return 0;
- ss->N = N = ss->bpos;
- /* We reverse the string before encoding it, */
- /* so it will come out of the decoder correctly. */
- for (j = N / 2 - 1; j >= 0; j--) {
- byte *p0 = &buffer[j];
- byte *p1 = &buffer[N - 1 - j];
- byte b = *p0;
-
- *p0 = *p1;
- *p1 = b;
- }
- /* Save st in a static, because that's the only way */
- /* we can pass it to the comparison procedure (ugh). */
- bwbs_compare_ss = ss;
- /* Sort the strings. */
- bwbse_sort(buffer, indices, N);
- /* Find the unrotated string. */
- for (j = 0; j < N; j++)
- if (indices[j] == 0) {
- ss->I = j;
- break;
- }
- for (j = sizeof(int); --j >= 0;)
- *++q = (byte) (N >> (j * 8));
- for (j = sizeof(int); --j >= 0;)
- *++q = (byte) (ss->I >> (j * 8));
- ss->bpos = 0;
+ int status, j, N;
+ byte *buffer = ss->buffer;
+ if (wcount < sizeof(int) * 2)
+ return 1;
+
+ /* Continue filling the buffer. */
+ status = s_buffered_process(st, pr, last);
+ if (!status)
+ return 0;
+ ss->N = N = ss->bpos;
+ /* We reverse the string before encoding it, */
+ /* so it will come out of the decoder correctly. */
+ for (j = N / 2 - 1; j >= 0; j--) {
+ byte *p0 = &buffer[j];
+ byte *p1 = &buffer[N - 1 - j];
+ byte b = *p0;
+
+ *p0 = *p1;
+ *p1 = b;
+ }
+ /* Save st in a static, because that's the only way */
+ /* we can pass it to the comparison procedure (ugh). */
+ bwbs_compare_ss = ss;
+ /* Sort the strings. */
+ bwbse_sort(buffer, indices, N);
+ /* Find the unrotated string. */
+ for (j = 0; j < N; j++)
+ if (indices[j] == 0) {
+ ss->I = j;
+ break;
+ }
+ for (j = sizeof(int); --j >= 0;)
+ *++q = (byte) (N >> (j * 8));
+ for (j = sizeof(int); --j >= 0;)
+ *++q = (byte) (ss->I >> (j * 8));
+ ss->bpos = 0;
}
/* We're reading out of the buffer, writing the permuted string. */
while (q < wlimit && ss->bpos < ss->N) {
- int i = indices[ss->bpos++];
+ int i = indices[ss->bpos++];
- *++q = ss->buffer[(i == 0 ? ss->N - 1 : i - 1)];
+ *++q = ss->buffer[(i == 0 ? ss->N - 1 : i - 1)];
}
if (ss->bpos == ss->N) {
- ss->filling = true;
- ss->bpos = 0;
+ ss->filling = true;
+ ss->bpos = 0;
}
pw->ptr = q;
if (q == wlimit)
- return 1;
+ return 1;
return 0;
}
@@ -320,7 +320,7 @@ const stream_template s_BWBSE_template = {
* P[i] + C[S[i]], where C[c] is the sum of O(0,N) ... O(c-1,N),
* we add C[c] into P2[k,c] for all k.
*/
- /*typedef struct { uint v[256]; } offsets_full; *//* in sbwbs.h */
+ /*typedef struct { uint v[256]; } offsets_full; *//* in sbwbs.h */
typedef struct {
bits16 v[256];
} offsets_4k;
@@ -359,7 +359,7 @@ s_BWBSD_init(stream_state * st)
static void
bwbsd_construct_offsets(stream_BWBS_state * sst, offsets_full * po64k,
- offsets_4k * po4k, byte * po1, int N)
+ offsets_4k * po4k, byte * po1, int N)
{
offsets_full Cs;
@@ -372,46 +372,46 @@ bwbsd_construct_offsets(stream_BWBS_state * sst, offsets_full * po64k,
memset(C, 0, sizeof(Cs));
for (i1 = 0; i1 < ceil_4k(N); i1++, p1++) {
- int j;
-
- if (!(i1 & 15))
- *++p2 = Cs;
- for (j = 0; j < 256; j++)
- p1->v[j] = C[j] - p2->v[j];
- j = (N + 1 - (i1 << 12)) >> 1;
- if (j > 4096 / 2)
- j = 4096 / 2;
- for (; j > 0; j--, b += 2, p0 += 3) {
- byte b0 = b[0];
- uint d0 = C[b0]++ - (p1->v[b0] + p2->v[b0]);
- byte b1 = b[1];
- uint d1 = C[b1]++ - (p1->v[b1] + p2->v[b1]);
-
- p0[0] = d0 >> 4;
- p0[1] = (byte) ((d0 << 4) + (d1 >> 8));
- p0[2] = (byte) d1;
- }
+ int j;
+
+ if (!(i1 & 15))
+ *++p2 = Cs;
+ for (j = 0; j < 256; j++)
+ p1->v[j] = C[j] - p2->v[j];
+ j = (N + 1 - (i1 << 12)) >> 1;
+ if (j > 4096 / 2)
+ j = 4096 / 2;
+ for (; j > 0; j--, b += 2, p0 += 3) {
+ byte b0 = b[0];
+ uint d0 = C[b0]++ - (p1->v[b0] + p2->v[b0]);
+ byte b1 = b[1];
+ uint d1 = C[b1]++ - (p1->v[b1] + p2->v[b1]);
+
+ p0[0] = d0 >> 4;
+ p0[1] = (byte) ((d0 << 4) + (d1 >> 8));
+ p0[2] = (byte) d1;
+ }
}
/* If the block length is odd, discount the extra byte. */
if (N & 1)
- C[sst->buffer[N]]--;
+ C[sst->buffer[N]]--;
/* Compute the cumulative totals in C. */
{
- int sum = 0, ch;
+ int sum = 0, ch;
- for (ch = 0; ch <= 255; ch++) {
- sum += C[ch];
- C[ch] = sum - C[ch];
- }
+ for (ch = 0; ch <= 255; ch++) {
+ sum += C[ch];
+ C[ch] = sum - C[ch];
+ }
}
/* Add the C values back into the 64K table, */
/* which saves an addition of C[b] in the decoding loop. */
{
- int i2, ch;
+ int i2, ch;
- for (p2 = po64k, i2 = ceil_64k(N); i2 > 0; p2++, i2--)
- for (ch = 0; ch < 256; ch++)
- p2->v[ch] += C[ch];
+ for (p2 = po64k, i2 = ceil_64k(N); i2 > 0; p2++, i2--)
+ for (ch = 0; ch < 256; ch++)
+ p2->v[ch] += C[ch];
}
#undef C
}
@@ -430,19 +430,19 @@ bwbsd_construct_offsets(stream_BWBS_state * sst, int *po, int N)
memset(C, 0, sizeof(Cs));
for (i = 0; i < N; i++, p++, b++)
- *p = C[*b]++;
+ *p = C[*b]++;
/* Compute the cumulative totals in C. */
{
- int sum = 0, ch;
+ int sum = 0, ch;
- for (ch = 0; ch <= 255; ch++) {
- sum += C[ch];
- C[ch] = sum - C[ch];
- }
+ for (ch = 0; ch <= 255; ch++) {
+ sum += C[ch];
+ C[ch] = sum - C[ch];
+ }
}
/* Add the C values back into the offsets. */
for (i = 0, b = sst->buffer, p = po; i < N; i++, b++, p++)
- *p += C[*b];
+ *p += C[*b];
#undef C
}
@@ -451,7 +451,7 @@ bwbsd_construct_offsets(stream_BWBS_state * sst, int *po, int N)
/* Decode a buffer */
static int
s_BWBSD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_BWBS_state *const ss = (stream_BWBS_state *) st;
register const byte *p = pr->ptr;
@@ -472,68 +472,68 @@ s_BWBSD_process(stream_state * st, stream_cursor_read * pr,
#endif /* (!)SHORT_OFFSETS */
if (ss->I < 0) { /* Read block parameters */
- int I, N, j;
- if (count < sizeof(int) * 2)
- return 0;
- for (N = 0, j = 0; j < sizeof(int); j++)
-
- N = (N << 8) + *++p;
- for (I = 0, j = 0; j < sizeof(int); j++)
-
- I = (I << 8) + *++p;
- ss->N = N;
- ss->I = I;
- if_debug2('w', "[w]N=%d I=%d\n", N, I);
- pr->ptr = p;
- if (N < 0 || N > ss->BlockSize || I < 0 || I >= N)
- return ERRC;
- if (N == 0)
- return EOFC;
- count -= sizeof(int) * 2;
-
- ss->bpos = 0;
- ss->bsize = N;
+ int I, N, j;
+ if (count < sizeof(int) * 2)
+ return 0;
+ for (N = 0, j = 0; j < sizeof(int); j++)
+
+ N = (N << 8) + *++p;
+ for (I = 0, j = 0; j < sizeof(int); j++)
+
+ I = (I << 8) + *++p;
+ ss->N = N;
+ ss->I = I;
+ if_debug2('w', "[w]N=%d I=%d\n", N, I);
+ pr->ptr = p;
+ if (N < 0 || N > ss->BlockSize || I < 0 || I >= N)
+ return ERRC;
+ if (N == 0)
+ return EOFC;
+ count -= sizeof(int) * 2;
+
+ ss->bpos = 0;
+ ss->bsize = N;
}
if (ss->filling) { /* Continue filling the buffer. */
- if (!s_buffered_process(st, pr, last))
- return 0;
- /* Construct the inverse sort order. */
+ if (!s_buffered_process(st, pr, last))
+ return 0;
+ /* Construct the inverse sort order. */
#ifdef SHORT_OFFSETS
- bwbsd_construct_offsets(ss, po64k, po4k, po1, ss->bsize);
+ bwbsd_construct_offsets(ss, po64k, po4k, po1, ss->bsize);
#else /* !SHORT_OFFSETS */
- bwbsd_construct_offsets(ss, po, ss->bsize);
+ bwbsd_construct_offsets(ss, po, ss->bsize);
#endif /* (!)SHORT_OFFSETS */
- ss->bpos = 0;
- ss->i = ss->I;
+ ss->bpos = 0;
+ ss->i = ss->I;
}
/* We're reading out of the buffer. */
while (q < wlimit && ss->bpos < ss->bsize) {
- int i = ss->i;
- byte b = ss->buffer[i];
+ int i = ss->i;
+ byte b = ss->buffer[i];
#ifdef SHORT_OFFSETS
- uint d;
- const byte *pd = &po1[(i >> 1) + i];
-
- *++q = b;
- if (!(i & 1))
- d = ((uint) pd[0] << 4) + (pd[1] >> 4);
- else
- d = ((pd[0] & 0xf) << 8) + pd[1];
- ss->i = po64k[i >> 16].v[b] + po4k[i >> 12].v[b] + d;
+ uint d;
+ const byte *pd = &po1[(i >> 1) + i];
+
+ *++q = b;
+ if (!(i & 1))
+ d = ((uint) pd[0] << 4) + (pd[1] >> 4);
+ else
+ d = ((pd[0] & 0xf) << 8) + pd[1];
+ ss->i = po64k[i >> 16].v[b] + po4k[i >> 12].v[b] + d;
#else /* !SHORT_OFFSETS */
- *++q = b;
- ss->i = po[i];
+ *++q = b;
+ ss->i = po[i];
#endif /* (!)SHORT_OFFSETS */
- ss->bpos++;
+ ss->bpos++;
}
if (ss->bpos == ss->bsize) {
- ss->I = -1;
- ss->filling = true;
+ ss->I = -1;
+ ss->filling = true;
}
pw->ptr = q;
if (q == wlimit)
- return 1;
+ return 1;
return 0;
}
diff --git a/gs/base/sbwbs.h b/gs/base/sbwbs.h
index 14348ede8..65a5830e6 100644
--- a/gs/base/sbwbs.h
+++ b/gs/base/sbwbs.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,18 +20,18 @@
/* Common framework for streams that buffer a block for processing */
#define stream_buffered_state_common\
- stream_state_common;\
- /* The client may set the following before initialization, */\
- /* or the stream may set it later. */\
- int BlockSize;\
- /* The init procedure sets the following, */\
- /* if BlockSize has been set. */\
- byte *buffer; /* [BlockSize] */\
- /* The following are updated dynamically. */\
- bool filling; /* true if filling buffer, */\
- /* false if emptying */\
- int bsize; /* size of current block (<= BlockSize) */\
- int bpos /* current index within buffer */
+ stream_state_common;\
+ /* The client may set the following before initialization, */\
+ /* or the stream may set it later. */\
+ int BlockSize;\
+ /* The init procedure sets the following, */\
+ /* if BlockSize has been set. */\
+ byte *buffer; /* [BlockSize] */\
+ /* The following are updated dynamically. */\
+ bool filling; /* true if filling buffer, */\
+ /* false if emptying */\
+ int bsize; /* size of current block (<= BlockSize) */\
+ int bpos /* current index within buffer */
typedef struct stream_buffered_state_s {
stream_buffered_state_common;
} stream_buffered_state;
diff --git a/gs/base/scanchar.h b/gs/base/scanchar.h
index a8fc1ee9a..29ccdebb9 100644
--- a/gs/base/scanchar.h
+++ b/gs/base/scanchar.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/scantab.c b/gs/base/scantab.c
index 2c16928dc..f38101359 100644
--- a/gs/base/scantab.c
+++ b/gs/base/scantab.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
/* Define the character scanning table (see scanchar.h). */
const byte scan_char_array[max_stream_exception + 256] =
{stream_exception_repeat(ctype_exception),
- /* Control characters 0-31. */
+ /* Control characters 0-31. */
ctype_space, /* NULL - standard only in Level 2 */
ctype_name, ctype_name, ctype_name,
ctype_other, /* EOT == ctrl-d <04> */
@@ -34,7 +34,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name,
- /* Printable characters 32-63 */
+ /* Printable characters 32-63 */
ctype_space, /* space (\s) */
ctype_name, ctype_name, ctype_name, ctype_name,
ctype_other, /* % */
@@ -49,7 +49,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name,
ctype_other, /* > */
ctype_name,
- /* Printable characters 64-95 */
+ /* Printable characters 64-95 */
ctype_name,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -58,7 +58,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name,
ctype_other, /* ] */
ctype_name, ctype_name,
- /* Printable characters 96-126 and DEL */
+ /* Printable characters 96-126 and DEL */
ctype_name,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -67,7 +67,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name,
ctype_other, /* } */
ctype_name, ctype_name,
- /* Characters 128-159, binary tokens */
+ /* Characters 128-159, binary tokens */
ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken,
ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken,
ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken,
@@ -75,7 +75,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken,
ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken, ctype_btoken,
ctype_btoken, ctype_btoken,
- /* Characters 160-191, not defined */
+ /* Characters 160-191, not defined */
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
@@ -83,7 +83,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name,
- /* Characters 192-223, not defined */
+ /* Characters 192-223, not defined */
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
@@ -91,7 +91,7 @@ const byte scan_char_array[max_stream_exception + 256] =
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name,
- /* Characters 224-255, not defined */
+ /* Characters 224-255, not defined */
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
ctype_name, ctype_name, ctype_name, ctype_name, ctype_name,
diff --git a/gs/base/scf.h b/gs/base/scf.h
index f5ebf3f31..5805e492a 100644
--- a/gs/base/scf.h
+++ b/gs/base/scf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -62,7 +62,7 @@ extern const cf_runs
extern const cfe_run cf_uncompressed[6];
extern const cfe_run cf_uncompressed_exit[10]; /* indexed by 2 x length of */
- /* white run + (1 if next run black, 0 if white) */
+ /* white run + (1 if next run black, 0 if white) */
/* 1-D encoding. */
extern const cfe_run cf1_run_uncompressed;
@@ -172,10 +172,10 @@ extern const cfd_node cf_uncompressed_decode[];
BEGIN\
rlen = cf_byte_run_length[count & 7][data ^ 0xff];\
if ( rlen >= 8 ) { /* run extends past byte boundary */\
- if ( white_byte == 0 ) {\
+ if ( white_byte == 0 ) {\
register short s;\
- if ( (data = *p++) ) { rlen -= 8; }\
- else if ( (data = *p++) ) { }\
+ if ( (data = *p++) ) { rlen -= 8; }\
+ else if ( (data = *p++) ) { }\
else if ((((int)p) & 1) && (rlen += 8, (data = *p++))) { }\
else if ((((int)p) & 2) && (rlen += 16, p += 2, (s = *(short *)(void *)(p-2)))) {\
if ((data = BYTE0OF2(s))) {rlen -= 8; p--;} else data = BYTE1OF2(s); }\
@@ -186,24 +186,24 @@ BEGIN\
else if ( (data = BYTE1OF4(i)) ) { rlen += 16; p -= 2; }\
else if ( (data = BYTE2OF4(i)) ) { rlen += 24; p -= 1; }\
else { data = BYTE3OF4(i); rlen += 32; }\
- }\
- } else {\
+ }\
+ } else {\
register short s;\
- if ( (data = (byte)~*p++) ) { rlen -= 8; }\
- else if ( (data = (byte)~*p++) ) { }\
+ if ( (data = (byte)~*p++) ) { rlen -= 8; }\
+ else if ( (data = (byte)~*p++) ) { }\
else if ((((int)p) & 1) && (rlen += 8, data = (byte)~*p++)) { }\
else if ((((int)p) & 2) && (rlen += 16, p += 2, s = (short)~*(short *)(void *)(p-2))) {\
if ((data = BYTE0OF2(s))) {rlen -= 8; p--;} else data = BYTE1OF2(s); }\
- else {\
+ else {\
register int i;\
while ((p += 4, (i = ~*(int *)(void *)(p-4))) == 0) rlen += 32; \
if ( (data = BYTE0OF4(i)) ) { rlen += 8; p -= 3; }\
else if ( (data = BYTE1OF4(i)) ) { rlen += 16; p -= 2; }\
else if ( (data = BYTE2OF4(i)) ) { rlen += 24; p -= 1; }\
else { data = BYTE3OF4(i); rlen += 32; }\
- }\
- }\
- rlen += cf_byte_run_length_0[data ^ 0xff];\
+ }\
+ }\
+ rlen += cf_byte_run_length_0[data ^ 0xff];\
}\
count -= rlen;\
END
@@ -214,30 +214,30 @@ END
BEGIN\
rlen = cf_byte_run_length[count & 7][data ^ 0xff];\
if ( rlen >= 8 ) { /* run extends past byte boundary */\
- if ( white_byte == 0 ) {\
- if ( data = *p++ ) { rlen -= 8; }\
- else if ( data = *p++ ) { }\
- else {\
+ if ( white_byte == 0 ) {\
+ if ( data = *p++ ) { rlen -= 8; }\
+ else if ( data = *p++ ) { }\
+ else {\
do {\
if ( data = *p++ ) { rlen += 8; break; }\
else if ( data = *p++ ) { rlen += 16; break; }\
else if ( data = *p++ ) { rlen += 24; break; }\
else { rlen += 32; if (data = *p++) break; }\
} while (1);\
- }\
- } else {\
- if ( data = (byte)~*p++ ) { rlen -= 8; }\
- else if ( data = (byte)~*p++ ) { }\
- else {\
+ }\
+ } else {\
+ if ( data = (byte)~*p++ ) { rlen -= 8; }\
+ else if ( data = (byte)~*p++ ) { }\
+ else {\
do {\
if ( data = (byte)~*p++ ) { rlen += 8; break; }\
else if ( data = (byte)~*p++ ) { rlen += 16; break; }\
else if ( data = (byte)~*p++ ) { rlen += 24; break; }\
else { rlen += 32; if (data = (byte)~*p++) break; }\
} while (1);\
- }\
- }\
- rlen += cf_byte_run_length_0[data ^ 0xff];\
+ }\
+ }\
+ rlen += cf_byte_run_length_0[data ^ 0xff];\
}\
count -= rlen;\
END
@@ -249,40 +249,40 @@ END
BEGIN\
rlen = cf_byte_run_length[count & 7][data ^ 0xff];\
if ( rlen >= 8 ) { /* run extends past byte boundary */\
- if ( white_byte == 0 ) {\
- if ( p[0] ) { data = p[0]; p += 1; rlen -= 8; }\
- else if ( p[1] ) { data = p[1]; p += 2; }\
- else {\
- while ( !(p[2] | p[3] | p[4] | p[5]) )\
- p += 4, rlen += 32;\
- if ( p[2] ) {\
- data = p[2]; p += 3; rlen += 8;\
- } else if ( p[3] ) {\
- data = p[3]; p += 4; rlen += 16;\
- } else if ( p[4] ) {\
- data = p[4]; p += 5; rlen += 24;\
- } else /* p[5] */ {\
- data = p[5]; p += 6; rlen += 32;\
- }\
- }\
- } else {\
- if ( p[0] != 0xff ) { data = (byte)~p[0]; p += 1; rlen -= 8; }\
- else if ( p[1] != 0xff ) { data = (byte)~p[1]; p += 2; }\
- else {\
- while ( (p[2] & p[3] & p[4] & p[5]) == 0xff )\
- p += 4, rlen += 32;\
- if ( p[2] != 0xff ) {\
- data = (byte)~p[2]; p += 3; rlen += 8;\
- } else if ( p[3] != 0xff ) {\
- data = (byte)~p[3]; p += 4; rlen += 16;\
- } else if ( p[4] != 0xff ) {\
- data = (byte)~p[4]; p += 5; rlen += 24;\
- } else /* p[5] != 0xff */ {\
- data = (byte)~p[5]; p += 6; rlen += 32;\
- }\
- }\
- }\
- rlen += cf_byte_run_length_0[data ^ 0xff];\
+ if ( white_byte == 0 ) {\
+ if ( p[0] ) { data = p[0]; p += 1; rlen -= 8; }\
+ else if ( p[1] ) { data = p[1]; p += 2; }\
+ else {\
+ while ( !(p[2] | p[3] | p[4] | p[5]) )\
+ p += 4, rlen += 32;\
+ if ( p[2] ) {\
+ data = p[2]; p += 3; rlen += 8;\
+ } else if ( p[3] ) {\
+ data = p[3]; p += 4; rlen += 16;\
+ } else if ( p[4] ) {\
+ data = p[4]; p += 5; rlen += 24;\
+ } else /* p[5] */ {\
+ data = p[5]; p += 6; rlen += 32;\
+ }\
+ }\
+ } else {\
+ if ( p[0] != 0xff ) { data = (byte)~p[0]; p += 1; rlen -= 8; }\
+ else if ( p[1] != 0xff ) { data = (byte)~p[1]; p += 2; }\
+ else {\
+ while ( (p[2] & p[3] & p[4] & p[5]) == 0xff )\
+ p += 4, rlen += 32;\
+ if ( p[2] != 0xff ) {\
+ data = (byte)~p[2]; p += 3; rlen += 8;\
+ } else if ( p[3] != 0xff ) {\
+ data = (byte)~p[3]; p += 4; rlen += 16;\
+ } else if ( p[4] != 0xff ) {\
+ data = (byte)~p[4]; p += 5; rlen += 24;\
+ } else /* p[5] != 0xff */ {\
+ data = (byte)~p[5]; p += 6; rlen += 32;\
+ }\
+ }\
+ }\
+ rlen += cf_byte_run_length_0[data ^ 0xff];\
}\
count -= rlen;\
END
@@ -295,21 +295,21 @@ END
BEGIN\
rlen = cf_byte_run_length[count & 7][data];\
if ( rlen >= 8 ) {\
- if ( white_byte == 0 )\
- for ( ; ; p += 4, rlen += 32 ) {\
- if ( p[0] != 0xff ) { data = p[0]; p += 1; rlen -= 8; break; }\
- if ( p[1] != 0xff ) { data = p[1]; p += 2; break; }\
- if ( p[2] != 0xff ) { data = p[2]; p += 3; rlen += 8; break; }\
- if ( p[3] != 0xff ) { data = p[3]; p += 4; rlen += 16; break; }\
- }\
- else\
- for ( ; ; p += 4, rlen += 32 ) {\
- if ( p[0] ) { data = (byte)~p[0]; p += 1; rlen -= 8; break; }\
- if ( p[1] ) { data = (byte)~p[1]; p += 2; break; }\
- if ( p[2] ) { data = (byte)~p[2]; p += 3; rlen += 8; break; }\
- if ( p[3] ) { data = (byte)~p[3]; p += 4; rlen += 16; break; }\
- }\
- rlen += cf_byte_run_length_0[data];\
+ if ( white_byte == 0 )\
+ for ( ; ; p += 4, rlen += 32 ) {\
+ if ( p[0] != 0xff ) { data = p[0]; p += 1; rlen -= 8; break; }\
+ if ( p[1] != 0xff ) { data = p[1]; p += 2; break; }\
+ if ( p[2] != 0xff ) { data = p[2]; p += 3; rlen += 8; break; }\
+ if ( p[3] != 0xff ) { data = p[3]; p += 4; rlen += 16; break; }\
+ }\
+ else\
+ for ( ; ; p += 4, rlen += 32 ) {\
+ if ( p[0] ) { data = (byte)~p[0]; p += 1; rlen -= 8; break; }\
+ if ( p[1] ) { data = (byte)~p[1]; p += 2; break; }\
+ if ( p[2] ) { data = (byte)~p[2]; p += 3; rlen += 8; break; }\
+ if ( p[3] ) { data = (byte)~p[3]; p += 4; rlen += 16; break; }\
+ }\
+ rlen += cf_byte_run_length_0[data];\
}\
count -= rlen;\
END
diff --git a/gs/base/scfd.c b/gs/base/scfd.c
index 186e62a5b..37d0fd704 100644
--- a/gs/base/scfd.c
+++ b/gs/base/scfd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,7 +39,7 @@ s_CFD_init(stream_state * st)
{
stream_CFD_state *const ss = (stream_CFD_state *) st;
int raster = ss->raster =
- ROUND_UP((ss->Columns + 7) >> 3, ss->DecodedByteAlign);
+ ROUND_UP((ss->Columns + 7) >> 3, ss->DecodedByteAlign);
byte white = (ss->BlackIs1 ? 0 : 0xff);
s_hcd_init_inline(ss);
@@ -48,16 +48,16 @@ s_CFD_init(stream_state * st)
ss->lbuf = gs_alloc_bytes(st->memory, raster + 4, "CFD lbuf");
ss->lprev = 0;
if (ss->lbuf == 0)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
memset(ss->lbuf, white, raster + 4); /* + 4 for Valgrind */
if (ss->K != 0) {
- ss->lprev = gs_alloc_bytes(st->memory, raster + 4, "CFD lprev");
- if (ss->lprev == 0)
- return ERRC; /****** WRONG ******/
- /* Clear the initial reference line for 2-D encoding. */
- memset(ss->lprev, white, raster + 4); /* + 4 for Valgrind */
- /* Ensure that the scan of the reference line will stop. */
- ss->lprev[raster] = 0xa0;
+ ss->lprev = gs_alloc_bytes(st->memory, raster + 4, "CFD lprev");
+ if (ss->lprev == 0)
+ return ERRC; /****** WRONG ******/
+ /* Clear the initial reference line for 2-D encoding. */
+ memset(ss->lprev, white, raster + 4); /* + 4 for Valgrind */
+ /* Ensure that the scan of the reference line will stop. */
+ ss->lprev[raster] = 0xa0;
}
ss->k_left = min(ss->K, 0);
ss->run_color = 0;
@@ -86,17 +86,17 @@ s_CFD_release(stream_state * st)
/* Declare the variables that hold the state. */
#define cfd_declare_state\
- hcd_declare_state;\
- register byte *q;\
- int qbit
+ hcd_declare_state;\
+ register byte *q;\
+ int qbit
/* Load the state from the stream. */
#define cfd_load_state()\
- hcd_load_state(),\
- q = ss->lbuf + ss->wpos, qbit = ss->cbit
+ hcd_load_state(),\
+ q = ss->lbuf + ss->wpos, qbit = ss->cbit
/* Store the state back in the stream. */
#define cfd_store_state()\
- hcd_store_state(),\
- ss->wpos = q - ss->lbuf, ss->cbit = qbit
+ hcd_store_state(),\
+ ss->wpos = q - ss->lbuf, ss->cbit = qbit
/* Macros to get blocks of bits from the input stream. */
/* Invariants: 0 <= bits_left <= bits_size; */
@@ -116,83 +116,83 @@ s_CFD_release(stream_state * st)
#endif
#define get_run(decode, initial_bits, min_bits, runlen, str, locl, outl)\
BEGIN\
- const cfd_node *np;\
- int clen;\
+ const cfd_node *np;\
+ int clen;\
\
- HCD_ENSURE_BITS_ELSE(initial_bits) {\
- /* We might still have enough bits for the specific code. */\
- if (bits_left < min_bits) goto outl;\
- np = &decode[hcd_peek_bits_left() << (initial_bits - bits_left)];\
- if ((clen = np->code_length) > bits_left) goto outl;\
- goto locl;\
- }\
- np = &decode[peek_bits(initial_bits)];\
- if ((clen = np->code_length) > initial_bits) {\
- IF_DEBUG(uint init_bits = peek_bits(initial_bits));\
- if (!avail_bits(clen)) goto outl;\
- clen -= initial_bits;\
- skip_bits(initial_bits);\
- ensure_bits(clen, outl); /* can't goto outl */\
- np = &decode[np->run_length + peek_var_bits(clen)];\
- if_debug4('W', "%s xcode=0x%x,%d rlen=%d\n", str,\
- (init_bits << np->code_length) +\
- peek_var_bits(np->code_length),\
- initial_bits + np->code_length,\
- np->run_length);\
- skip_bits(np->code_length);\
- } else {\
+ HCD_ENSURE_BITS_ELSE(initial_bits) {\
+ /* We might still have enough bits for the specific code. */\
+ if (bits_left < min_bits) goto outl;\
+ np = &decode[hcd_peek_bits_left() << (initial_bits - bits_left)];\
+ if ((clen = np->code_length) > bits_left) goto outl;\
+ goto locl;\
+ }\
+ np = &decode[peek_bits(initial_bits)];\
+ if ((clen = np->code_length) > initial_bits) {\
+ IF_DEBUG(uint init_bits = peek_bits(initial_bits));\
+ if (!avail_bits(clen)) goto outl;\
+ clen -= initial_bits;\
+ skip_bits(initial_bits);\
+ ensure_bits(clen, outl); /* can't goto outl */\
+ np = &decode[np->run_length + peek_var_bits(clen)];\
+ if_debug4('W', "%s xcode=0x%x,%d rlen=%d\n", str,\
+ (init_bits << np->code_length) +\
+ peek_var_bits(np->code_length),\
+ initial_bits + np->code_length,\
+ np->run_length);\
+ skip_bits(np->code_length);\
+ } else {\
locl: if_debug4('W', "%s code=0x%x,%d rlen=%d\n", str,\
- peek_var_bits(clen), clen, np->run_length);\
- skip_bits(clen);\
- }\
- runlen = np->run_length;\
+ peek_var_bits(clen), clen, np->run_length);\
+ skip_bits(clen);\
+ }\
+ runlen = np->run_length;\
END
/* Skip data bits for a white run. */
/* rlen is either less than 64, or a multiple of 64. */
#define skip_data(rlen, makeup_label)\
- if ( (qbit -= rlen) < 0 )\
- { q -= qbit >> 3, qbit &= 7;\
- if ( rlen >= 64 ) goto makeup_label;\
- }
+ if ( (qbit -= rlen) < 0 )\
+ { q -= qbit >> 3, qbit &= 7;\
+ if ( rlen >= 64 ) goto makeup_label;\
+ }
/* Invert data bits for a black run. */
/* If rlen >= 64, execute makeup_action: this is to handle */
/* makeup codes efficiently, since these are always a multiple of 64. */
#define invert_data(rlen, black_byte, makeup_action, d)\
- if ( rlen > qbit )\
- { if (q >= ss->lbuf) *q++ ^= (1 << qbit) - 1; else q++;\
- rlen -= qbit;\
- switch ( rlen >> 3 )\
- {\
- case 7: /* original rlen possibly >= 64 */\
- if ( rlen + qbit >= 64 ) goto d;\
- *q++ = black_byte;\
- case 6: *q++ = black_byte;\
- case 5: *q++ = black_byte;\
- case 4: *q++ = black_byte;\
- case 3: *q++ = black_byte;\
- case 2: *q++ = black_byte;\
- case 1: *q = black_byte;\
- rlen &= 7;\
- if ( !rlen ) { qbit = 0; break; }\
- q++;\
- case 0: /* know rlen != 0 */\
- qbit = 8 - rlen;\
- *q ^= 0xff << qbit;\
- break;\
- default: /* original rlen >= 64 */\
+ if ( rlen > qbit )\
+ { if (q >= ss->lbuf) *q++ ^= (1 << qbit) - 1; else q++;\
+ rlen -= qbit;\
+ switch ( rlen >> 3 )\
+ {\
+ case 7: /* original rlen possibly >= 64 */\
+ if ( rlen + qbit >= 64 ) goto d;\
+ *q++ = black_byte;\
+ case 6: *q++ = black_byte;\
+ case 5: *q++ = black_byte;\
+ case 4: *q++ = black_byte;\
+ case 3: *q++ = black_byte;\
+ case 2: *q++ = black_byte;\
+ case 1: *q = black_byte;\
+ rlen &= 7;\
+ if ( !rlen ) { qbit = 0; break; }\
+ q++;\
+ case 0: /* know rlen != 0 */\
+ qbit = 8 - rlen;\
+ *q ^= 0xff << qbit;\
+ break;\
+ default: /* original rlen >= 64 */\
d: memset(q, black_byte, rlen >> 3);\
- q += rlen >> 3;\
- rlen &= 7;\
- if ( !rlen ) qbit = 0, q--;\
- else qbit = 8 - rlen, *q ^= 0xff << qbit;\
- makeup_action;\
- }\
- }\
- else\
- qbit -= rlen,\
- *q ^= ((1 << rlen) - 1) << qbit
+ q += rlen >> 3;\
+ rlen &= 7;\
+ if ( !rlen ) qbit = 0, q--;\
+ else qbit = 8 - rlen, *q ^= 0xff << qbit;\
+ makeup_action;\
+ }\
+ }\
+ else\
+ qbit -= rlen,\
+ *q ^= ((1 << rlen) - 1) << qbit
/* Buffer refill for CCITTFaxDecode filter */
static int cf_decode_eol(stream_CFD_state *, stream_cursor_read *);
@@ -201,7 +201,7 @@ static int cf_decode_2d(stream_CFD_state *, stream_cursor_read *);
static int cf_decode_uncompressed(stream_CFD_state *, stream_cursor_read *);
static int
s_CFD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_CFD_state *const ss = (stream_CFD_state *) st;
int wstop = ss->raster - 1;
@@ -219,41 +219,41 @@ s_CFD_process(stream_state * st, stream_cursor_read * pr,
top:
#ifdef DEBUG
{
- hcd_declare_state;
- hcd_load_state();
- if_debug8('w', "[w]CFD_process top: eol_count=%d, k_left=%d, rows_left=%d\n"
- " bits=0x%lx, bits_left=%d, read %u, wrote %u%s\n",
- eol_count, k_left, rows_left,
- (ulong) bits, bits_left,
- (uint) (p - rstart), (uint) (pw->ptr - wstart),
- (ss->skipping_damage ? ", skipping damage" : ""));
+ hcd_declare_state;
+ hcd_load_state();
+ if_debug8('w', "[w]CFD_process top: eol_count=%d, k_left=%d, rows_left=%d\n"
+ " bits=0x%lx, bits_left=%d, read %u, wrote %u%s\n",
+ eol_count, k_left, rows_left,
+ (ulong) bits, bits_left,
+ (uint) (p - rstart), (uint) (pw->ptr - wstart),
+ (ss->skipping_damage ? ", skipping damage" : ""));
}
#endif
if (ss->skipping_damage) { /* Skip until we reach an EOL. */
- hcd_declare_state;
- int skip;
-
- status = 0;
- do {
- switch ((skip = cf_decode_eol(ss, pr))) {
- default: /* not EOL */
- hcd_load_state();
- skip_bits(-skip);
- hcd_store_state();
- continue;
- case 0: /* need more input */
- goto out;
- case 1: /* EOL */
- { /* Back up over the EOL. */
- hcd_load_state();
- bits_left += run_eol_code_length;
- hcd_store_state();
- }
- ss->skipping_damage = false;
- }
- }
- while (ss->skipping_damage);
- ss->damaged_rows++;
+ hcd_declare_state;
+ int skip;
+
+ status = 0;
+ do {
+ switch ((skip = cf_decode_eol(ss, pr))) {
+ default: /* not EOL */
+ hcd_load_state();
+ skip_bits(-skip);
+ hcd_store_state();
+ continue;
+ case 0: /* need more input */
+ goto out;
+ case 1: /* EOL */
+ { /* Back up over the EOL. */
+ hcd_load_state();
+ bits_left += run_eol_code_length;
+ hcd_store_state();
+ }
+ ss->skipping_damage = false;
+ }
+ }
+ while (ss->skipping_damage);
+ ss->damaged_rows++;
}
/*
* Check for a completed input scan line. This isn't quite as
@@ -264,123 +264,123 @@ s_CFD_process(stream_state * st, stream_cursor_read * pr,
* doesn't require a special check, but I haven't found it yet.
*/
if (ss->wpos == wstop && ss->cbit <= (-ss->Columns & 7) &&
- (k_left == 0 ? !(ss->run_color & ~1) : ss->run_color == 0)
- ) { /* Check for completed data to be copied to the client. */
- /* (We could avoid the extra copy step for 1-D, but */
- /* it's simpler not to, and it doesn't cost much.) */
- if (ss->rpos < ss->wpos) {
- stream_cursor_read cr;
-
- cr.ptr = ss->lbuf + ss->rpos;
- cr.limit = ss->lbuf + ss->wpos;
- status = stream_move(&cr, pw);
- ss->rpos = cr.ptr - ss->lbuf;
- if (status)
- goto out;
- }
- ss->row++;
- if (rows_left > 0 && --rows_left == 0)
- goto ck_eol; /* handle EOD if it is present */
- if (ss->K != 0) {
- byte *prev_bits = ss->lprev;
-
- ss->lprev = ss->lbuf;
- ss->lbuf = prev_bits;
- if (ss->K > 0)
- k_left = (k_left == 0 ? ss->K : k_left) - 1;
- }
- ss->rpos = ss->wpos = -1;
- ss->eol_count = eol_count = 0;
- ss->cbit = 0;
- ss->invert = (ss->BlackIs1 ? 0 : 0xff);
- memset(ss->lbuf, ss->invert, wstop + 1);
- ss->run_color = 0;
- /*
- * If EndOfLine is true, we want to include the byte padding
- * in the string of initial zeros in the EOL. If EndOfLine
- * is false, we aren't sure what we should do....
- */
- if (ss->EncodedByteAlign && !ss->EndOfLine)
- ss->bits_left &= ~7;
+ (k_left == 0 ? !(ss->run_color & ~1) : ss->run_color == 0)
+ ) { /* Check for completed data to be copied to the client. */
+ /* (We could avoid the extra copy step for 1-D, but */
+ /* it's simpler not to, and it doesn't cost much.) */
+ if (ss->rpos < ss->wpos) {
+ stream_cursor_read cr;
+
+ cr.ptr = ss->lbuf + ss->rpos;
+ cr.limit = ss->lbuf + ss->wpos;
+ status = stream_move(&cr, pw);
+ ss->rpos = cr.ptr - ss->lbuf;
+ if (status)
+ goto out;
+ }
+ ss->row++;
+ if (rows_left > 0 && --rows_left == 0)
+ goto ck_eol; /* handle EOD if it is present */
+ if (ss->K != 0) {
+ byte *prev_bits = ss->lprev;
+
+ ss->lprev = ss->lbuf;
+ ss->lbuf = prev_bits;
+ if (ss->K > 0)
+ k_left = (k_left == 0 ? ss->K : k_left) - 1;
+ }
+ ss->rpos = ss->wpos = -1;
+ ss->eol_count = eol_count = 0;
+ ss->cbit = 0;
+ ss->invert = (ss->BlackIs1 ? 0 : 0xff);
+ memset(ss->lbuf, ss->invert, wstop + 1);
+ ss->run_color = 0;
+ /*
+ * If EndOfLine is true, we want to include the byte padding
+ * in the string of initial zeros in the EOL. If EndOfLine
+ * is false, we aren't sure what we should do....
+ */
+ if (ss->EncodedByteAlign && !ss->EndOfLine)
+ ss->bits_left &= ~7;
}
/* If we're between scan lines, scan for EOLs. */
if (ss->wpos < 0) {
- /*
- * According to Adobe, the decoder should always check for
- * the EOD sequence, regardless of EndOfBlock: the Red Book's
- * documentation of EndOfBlock is wrong.
- */
+ /*
+ * According to Adobe, the decoder should always check for
+ * the EOD sequence, regardless of EndOfBlock: the Red Book's
+ * documentation of EndOfBlock is wrong.
+ */
ck_eol:
- while ((status = cf_decode_eol(ss, pr)) > 0) {
- if_debug0('w', "[w]EOL\n");
- /* If we are in a Group 3 mixed regime, */
- /* check the next bit for 1- vs. 2-D. */
- if (ss->K > 0) {
- hcd_declare_state;
- hcd_load_state();
- ensure_bits(1, out); /* can't fail */
- k_left = (peek_bits(1) ? 0 : 1);
- skip_bits(1);
- hcd_store_state();
- }
- ++eol_count;
- if (eol_count == (ss->K < 0 ? 2 : 6)) {
- status = EOFC;
- goto out;
- }
- }
- if (rows_left == 0) {
- status = EOFC;
- goto out;
- }
- if (status == 0) /* input empty while scanning EOLs */
- goto out;
- switch (eol_count) {
- case 0:
- if (ss->EndOfLine) { /* EOL is required, but none is present. */
- status = ERRC;
- goto check;
- }
- case 1:
- break;
- default:
- status = ERRC;
- goto check;
- }
+ while ((status = cf_decode_eol(ss, pr)) > 0) {
+ if_debug0('w', "[w]EOL\n");
+ /* If we are in a Group 3 mixed regime, */
+ /* check the next bit for 1- vs. 2-D. */
+ if (ss->K > 0) {
+ hcd_declare_state;
+ hcd_load_state();
+ ensure_bits(1, out); /* can't fail */
+ k_left = (peek_bits(1) ? 0 : 1);
+ skip_bits(1);
+ hcd_store_state();
+ }
+ ++eol_count;
+ if (eol_count == (ss->K < 0 ? 2 : 6)) {
+ status = EOFC;
+ goto out;
+ }
+ }
+ if (rows_left == 0) {
+ status = EOFC;
+ goto out;
+ }
+ if (status == 0) /* input empty while scanning EOLs */
+ goto out;
+ switch (eol_count) {
+ case 0:
+ if (ss->EndOfLine) { /* EOL is required, but none is present. */
+ status = ERRC;
+ goto check;
+ }
+ case 1:
+ break;
+ default:
+ status = ERRC;
+ goto check;
+ }
}
/* Now decode actual data. */
if (k_left < 0) {
- if_debug0('w', "[w2]new row\n");
- status = cf_decode_2d(ss, pr);
+ if_debug0('w', "[w2]new row\n");
+ status = cf_decode_2d(ss, pr);
} else if (k_left == 0) {
- if_debug0('w', "[w1]new row\n");
- status = cf_decode_1d(ss, pr);
+ if_debug0('w', "[w1]new row\n");
+ status = cf_decode_1d(ss, pr);
} else {
- if_debug1('w', "[w1]new 2-D row, k_left=%d\n", k_left);
- status = cf_decode_2d(ss, pr);
+ if_debug1('w', "[w1]new 2-D row, k_left=%d\n", k_left);
+ status = cf_decode_2d(ss, pr);
}
if_debug3('w', "[w]CFD status = %d, wpos = %d, cbit = %d\n",
- status, ss->wpos, ss->cbit);
+ status, ss->wpos, ss->cbit);
check:switch (status) {
- case 1: /* output full */
- goto top;
- case ERRC:
- /* Check for special handling of damaged rows. */
- if (ss->damaged_rows >= ss->DamagedRowsBeforeError ||
- !(ss->EndOfLine && ss->K >= 0)
- )
- break;
- /* Substitute undamaged data if appropriate. */
- /****** NOT IMPLEMENTED YET ******/
- {
- ss->wpos = wstop;
- ss->cbit = -ss->Columns & 7;
- ss->run_color = 0;
- }
- ss->skipping_damage = true;
- goto top;
- default:
- ss->damaged_rows = 0; /* finished a good row */
+ case 1: /* output full */
+ goto top;
+ case ERRC:
+ /* Check for special handling of damaged rows. */
+ if (ss->damaged_rows >= ss->DamagedRowsBeforeError ||
+ !(ss->EndOfLine && ss->K >= 0)
+ )
+ break;
+ /* Substitute undamaged data if appropriate. */
+ /****** NOT IMPLEMENTED YET ******/
+ {
+ ss->wpos = wstop;
+ ss->cbit = -ss->Columns & 7;
+ ss->run_color = 0;
+ }
+ ss->skipping_damage = true;
+ goto top;
+ default:
+ ss->damaged_rows = 0; /* finished a good row */
}
out:ss->k_left = k_left;
ss->rows_left = rows_left;
@@ -407,28 +407,28 @@ cf_decode_eol(stream_CFD_state * ss, stream_cursor_read * pr)
hcd_load_state();
for (zeros = 0; zeros < run_eol_code_length - 1; zeros++) {
- ensure_bits(1, out);
- if (peek_bits(1))
- return -(zeros + 1);
- skip_bits(1);
+ ensure_bits(1, out);
+ if (peek_bits(1))
+ return -(zeros + 1);
+ skip_bits(1);
}
/* We definitely have an EOL. Skip further zero bits. */
look_ahead = (ss->K > 0 ? 2 : 1);
for (;;) {
- ensure_bits(look_ahead, back);
- if (peek_bits(1))
- break;
- skip_bits(1);
+ ensure_bits(look_ahead, back);
+ if (peek_bits(1))
+ break;
+ skip_bits(1);
}
skip_bits(1);
hcd_store_state();
return 1;
back: /*
- * We ran out of data while skipping zeros.
- * We know we are at a byte boundary, and have just skipped
- * at least run_eol_code_length - 1 zeros. However,
- * bits_left may be 1 if look_ahead == 2.
- */
+ * We ran out of data while skipping zeros.
+ * We know we are at a byte boundary, and have just skipped
+ * at least run_eol_code_length - 1 zeros. However,
+ * bits_left may be 1 if look_ahead == 2.
+ */
bits &= (1 << bits_left) - 1;
bits_left += run_eol_code_length - 1;
hcd_store_state();
@@ -450,48 +450,48 @@ cf_decode_1d(stream_CFD_state * ss, stream_cursor_read * pr)
cfd_load_state();
if_debug1('w', "[w1]entry run_color = %d\n", ss->run_color);
if (ss->run_color > 0)
- goto db;
+ goto db;
else
- goto dw;
+ goto dw;
#define q_at_stop() (q >= stop && (qbit <= end_bit || q > stop))
top:run_color = 0;
if (q_at_stop())
- goto done;
+ goto done;
dw: /* Decode a white run. */
get_run(cf_white_decode, cfd_white_initial_bits, cfd_white_min_bits,
- bcnt, "[w1]white", dwl, out0);
+ bcnt, "[w1]white", dwl, out0);
if (bcnt < 0) { /* exceptional situation */
- switch (bcnt) {
- case run_uncompressed: /* Uncompressed data. */
- cfd_store_state();
- bcnt = cf_decode_uncompressed(ss, pr);
- if (bcnt < 0)
- return bcnt;
- cfd_load_state();
- if (bcnt)
- goto db;
- else
- goto dw;
- /*case run_error: */
- /*case run_zeros: *//* Premature end-of-line. */
- default:
- status = ERRC;
- goto out;
- }
+ switch (bcnt) {
+ case run_uncompressed: /* Uncompressed data. */
+ cfd_store_state();
+ bcnt = cf_decode_uncompressed(ss, pr);
+ if (bcnt < 0)
+ return bcnt;
+ cfd_load_state();
+ if (bcnt)
+ goto db;
+ else
+ goto dw;
+ /*case run_error: */
+ /*case run_zeros: *//* Premature end-of-line. */
+ default:
+ status = ERRC;
+ goto out;
+ }
}
skip_data(bcnt, dwx);
if (q_at_stop()) {
- run_color = 0; /* not inside a run */
- goto done;
+ run_color = 0; /* not inside a run */
+ goto done;
}
run_color = 1;
db: /* Decode a black run. */
get_run(cf_black_decode, cfd_black_initial_bits, cfd_black_min_bits,
- bcnt, "[w1]black", dbl, out1);
+ bcnt, "[w1]black", dbl, out1);
if (bcnt < 0) { /* All exceptional codes are invalid here. */
- /****** WRONG, uncompressed IS ALLOWED ******/
- status = ERRC;
- goto out;
+ /****** WRONG, uncompressed IS ALLOWED ******/
+ status = ERRC;
+ goto out;
}
/* Invert bits designated by black run. */
invert_data(bcnt, black_byte, goto dbx, idb);
@@ -505,9 +505,9 @@ cf_decode_1d(stream_CFD_state * ss, stream_cursor_read * pr)
run_color = 2;
goto db;
done:if (q > stop || qbit < end_bit)
- status = ERRC;
+ status = ERRC;
else
- status = 1;
+ status = 1;
out:cfd_store_state();
ss->run_color = run_color;
if_debug1('w', "[w1]exit run_color = %d\n", run_color);
@@ -544,23 +544,23 @@ cf_decode_2d(stream_CFD_state * ss, stream_cursor_read * pr)
/* to ensure run scan will stop */
if_debug1('W', "[w2]raster=%d\n", raster);
switch (ss->run_color) {
- case -2:
- ss->run_color = 0;
- goto hww;
- case -1:
- ss->run_color = 0;
- goto hbw;
- case 1:
- ss->run_color = 0;
- goto hwb;
- case 2:
- ss->run_color = 0;
- goto hbb;
- /*case 0: */
+ case -2:
+ ss->run_color = 0;
+ goto hww;
+ case -1:
+ ss->run_color = 0;
+ goto hbw;
+ case 1:
+ ss->run_color = 0;
+ goto hwb;
+ case 2:
+ ss->run_color = 0;
+ goto hbb;
+ /*case 0: */
}
top:if (count <= end_count) {
- status = (count < end_count ? ERRC : 1);
- goto out;
+ status = (count < end_count ? ERRC : 1);
+ goto out;
}
/* If invert == invert_white, white and black have their */
/* correct meanings; if invert == ~invert_white, */
@@ -569,11 +569,11 @@ cf_decode_2d(stream_CFD_state * ss, stream_cursor_read * pr)
#ifdef DEBUG
/* Check the invariant between q, qbit, and count. */
{
- int pcount = (endptr - q) * 8 + qbit;
+ int pcount = (endptr - q) * 8 + qbit;
- if (pcount != count)
- dlprintf2("[w2]Error: count=%d pcount=%d\n",
- count, pcount);
+ if (pcount != count)
+ dlprintf2("[w2]Error: count=%d pcount=%d\n",
+ count, pcount);
}
#endif
/*
@@ -585,122 +585,122 @@ cf_decode_2d(stream_CFD_state * ss, stream_cursor_read * pr)
ensure_bits(3, out3);
#define vertical_0 (countof(cf2_run_vertical) / 2)
switch (peek_bits(3)) {
- default /*4..7*/ : /* vertical(0) */
+ default /*4..7*/ : /* vertical(0) */
v0: skip_bits(1);
- rlen = vertical_0;
- break;
- case 2: /* vertical(+1) */
- skip_bits(3);
- rlen = vertical_0 + 1;
- break;
- case 3: /* vertical(-1) */
- skip_bits(3);
- rlen = vertical_0 - 1;
- break;
- case 1: /* horizontal */
- skip_bits(3);
- if (invert == invert_white)
- goto hww;
- else
- goto hbb;
- case 0: /* everything else */
- get_run(cf_2d_decode, cfd_2d_initial_bits, cfd_2d_min_bits,
- rlen, "[w2]", d2l, out0);
- /* rlen may be run2_pass, run_uncompressed, or */
- /* 0..countof(cf2_run_vertical)-1. */
- if (rlen < 0)
- switch (rlen) {
- case run2_pass:
- break;
- case run_uncompressed:
- {
- int which;
-
- cfd_store_state();
- which = cf_decode_uncompressed(ss, pr);
- if (which < 0) {
- status = which;
- goto out;
- }
- cfd_load_state();
+ rlen = vertical_0;
+ break;
+ case 2: /* vertical(+1) */
+ skip_bits(3);
+ rlen = vertical_0 + 1;
+ break;
+ case 3: /* vertical(-1) */
+ skip_bits(3);
+ rlen = vertical_0 - 1;
+ break;
+ case 1: /* horizontal */
+ skip_bits(3);
+ if (invert == invert_white)
+ goto hww;
+ else
+ goto hbb;
+ case 0: /* everything else */
+ get_run(cf_2d_decode, cfd_2d_initial_bits, cfd_2d_min_bits,
+ rlen, "[w2]", d2l, out0);
+ /* rlen may be run2_pass, run_uncompressed, or */
+ /* 0..countof(cf2_run_vertical)-1. */
+ if (rlen < 0)
+ switch (rlen) {
+ case run2_pass:
+ break;
+ case run_uncompressed:
+ {
+ int which;
+
+ cfd_store_state();
+ which = cf_decode_uncompressed(ss, pr);
+ if (which < 0) {
+ status = which;
+ goto out;
+ }
+ cfd_load_state();
/****** ADJUST count ******/
- invert = (which ? ~invert_white : invert_white);
- }
- goto top;
- default: /* run_error, run_zeros */
- status = ERRC;
- goto out;
- }
+ invert = (which ? ~invert_white : invert_white);
+ }
+ goto top;
+ default: /* run_error, run_zeros */
+ status = ERRC;
+ goto out;
+ }
}
/* Interpreting the run requires scanning the */
/* previous ('reference') line. */
{
- int prev_count = count;
- byte prev_data;
- int dlen;
- static const byte count_bit[8] =
- {0x80, 1, 2, 4, 8, 0x10, 0x20, 0x40};
- byte *prev_q = prev_q01 + (q - q0);
- int plen;
-
- if (!(count & 7))
- prev_q++; /* because of skip macros */
- prev_data = prev_q[-1] ^ invert;
- /* Find the b1 transition. */
- if ((prev_data & count_bit[prev_count & 7]) &&
- (prev_count < init_count || invert != invert_white)
- ) { /* Look for changing white first. */
- if_debug1('W', " data=0x%x", prev_data);
- skip_black_pixels(prev_data, prev_q,
- prev_count, invert, plen);
- if (prev_count < end_count) /* overshot */
- prev_count = end_count;
- if_debug1('W', " b1 other=%d", prev_count);
- }
- if (prev_count != end_count) {
- if_debug1('W', " data=0x%x", prev_data);
- skip_white_pixels(prev_data, prev_q,
- prev_count, invert, plen);
- if (prev_count < end_count) /* overshot */
- prev_count = end_count;
- if_debug1('W', " b1 same=%d", prev_count);
- }
- /* b1 = prev_count; */
- if (rlen == run2_pass) { /* Pass mode. Find b2. */
- if (prev_count != end_count) {
- if_debug1('W', " data=0x%x", prev_data);
- skip_black_pixels(prev_data, prev_q,
- prev_count, invert, plen);
- if (prev_count < end_count) /* overshot */
- prev_count = end_count;
- }
- /* b2 = prev_count; */
- if_debug2('W', " b2=%d, pass %d\n",
- prev_count, count - prev_count);
- } else { /* Vertical coding. */
- /* Remember that count counts *down*. */
- prev_count += rlen - vertical_0; /* a1 */
- if_debug2('W', " vertical %d -> %d\n",
- rlen - vertical_0, prev_count);
- }
- /* Now either invert or skip from count */
- /* to prev_count, and reset count. */
- if (invert == invert_white) { /* Skip data bits. */
- q = endptr - (prev_count >> 3);
- qbit = prev_count & 7;
- } else { /* Invert data bits. */
- dlen = count - prev_count;
- invert_data(dlen, black_byte, DO_NOTHING, idd);
- }
- count = prev_count;
- if (rlen >= 0) /* vertical mode */
- invert = ~invert; /* polarity changes */
+ int prev_count = count;
+ byte prev_data;
+ int dlen;
+ static const byte count_bit[8] =
+ {0x80, 1, 2, 4, 8, 0x10, 0x20, 0x40};
+ byte *prev_q = prev_q01 + (q - q0);
+ int plen;
+
+ if (!(count & 7))
+ prev_q++; /* because of skip macros */
+ prev_data = prev_q[-1] ^ invert;
+ /* Find the b1 transition. */
+ if ((prev_data & count_bit[prev_count & 7]) &&
+ (prev_count < init_count || invert != invert_white)
+ ) { /* Look for changing white first. */
+ if_debug1('W', " data=0x%x", prev_data);
+ skip_black_pixels(prev_data, prev_q,
+ prev_count, invert, plen);
+ if (prev_count < end_count) /* overshot */
+ prev_count = end_count;
+ if_debug1('W', " b1 other=%d", prev_count);
+ }
+ if (prev_count != end_count) {
+ if_debug1('W', " data=0x%x", prev_data);
+ skip_white_pixels(prev_data, prev_q,
+ prev_count, invert, plen);
+ if (prev_count < end_count) /* overshot */
+ prev_count = end_count;
+ if_debug1('W', " b1 same=%d", prev_count);
+ }
+ /* b1 = prev_count; */
+ if (rlen == run2_pass) { /* Pass mode. Find b2. */
+ if (prev_count != end_count) {
+ if_debug1('W', " data=0x%x", prev_data);
+ skip_black_pixels(prev_data, prev_q,
+ prev_count, invert, plen);
+ if (prev_count < end_count) /* overshot */
+ prev_count = end_count;
+ }
+ /* b2 = prev_count; */
+ if_debug2('W', " b2=%d, pass %d\n",
+ prev_count, count - prev_count);
+ } else { /* Vertical coding. */
+ /* Remember that count counts *down*. */
+ prev_count += rlen - vertical_0; /* a1 */
+ if_debug2('W', " vertical %d -> %d\n",
+ rlen - vertical_0, prev_count);
+ }
+ /* Now either invert or skip from count */
+ /* to prev_count, and reset count. */
+ if (invert == invert_white) { /* Skip data bits. */
+ q = endptr - (prev_count >> 3);
+ qbit = prev_count & 7;
+ } else { /* Invert data bits. */
+ dlen = count - prev_count;
+ invert_data(dlen, black_byte, DO_NOTHING, idd);
+ }
+ count = prev_count;
+ if (rlen >= 0) /* vertical mode */
+ invert = ~invert; /* polarity changes */
}
goto top;
out3:
if (bits_left > 0 && peek_bits(1)) {
- /* This is a 1-bit "vertical 0" code, which we can still process. */
- goto v0;
+ /* This is a 1-bit "vertical 0" code, which we can still process. */
+ goto v0;
}
/* falls through */
out0:status = 0;
@@ -710,7 +710,7 @@ v0: skip_bits(1);
/* Ignore an error (missing EOFB/RTC when EndOfBlock == true) */
/* if we have finished all rows. */
if (status == ERRC && ss->Rows > 0 && ss->row > ss->Rows)
- status = EOFC;
+ status = EOFC;
return status;
/*
* We handle horizontal decoding here, so that we can
@@ -718,18 +718,18 @@ v0: skip_bits(1);
*/
/* White, then black. */
hww:get_run(cf_white_decode, cfd_white_initial_bits, cfd_white_min_bits,
- rlen, " white", wwl, outww);
+ rlen, " white", wwl, outww);
if ((count -= rlen) < end_count) {
- status = ERRC;
- goto out;
+ status = ERRC;
+ goto out;
}
skip_data(rlen, hww);
/* Handle the second half of a white-black horizontal code. */
hwb:get_run(cf_black_decode, cfd_black_initial_bits, cfd_black_min_bits,
- rlen, " black", wbl, outwb);
+ rlen, " black", wbl, outwb);
if ((count -= rlen) < end_count) {
- status = ERRC;
- goto out;
+ status = ERRC;
+ goto out;
}
invert_data(rlen, black_byte, goto hwb, ihwb);
goto top;
@@ -739,18 +739,18 @@ v0: skip_bits(1);
goto out0;
/* Black, then white. */
hbb:get_run(cf_black_decode, cfd_black_initial_bits, cfd_black_min_bits,
- rlen, " black", bbl, outbb);
+ rlen, " black", bbl, outbb);
if ((count -= rlen) < end_count) {
- status = ERRC;
- goto out;
+ status = ERRC;
+ goto out;
}
invert_data(rlen, black_byte, goto hbb, ihbb);
/* Handle the second half of a black-white horizontal code. */
hbw:get_run(cf_white_decode, cfd_white_initial_bits, cfd_white_min_bits,
- rlen, " white", bwl, outbw);
+ rlen, " white", bwl, outbw);
if ((count -= rlen) < end_count) {
- status = ERRC;
- goto out;
+ status = ERRC;
+ goto out;
}
skip_data(rlen, hbw);
goto top;
@@ -780,24 +780,24 @@ cf_decode_uncompressed(stream * s)
cfd_load_state();
while (1) {
- ensure_bits(cfd_uncompressed_initial_bits, NOOUT);
- np = &cf_uncompressed_decode[peek_bits(cfd_uncompressed_initial_bits)];
- clen = np->code_length;
- rlen = np->run_length;
- if (clen > cfd_uncompressed_initial_bits) { /* Must be an exit code. */
- break;
- }
- if (rlen == cfd_uncompressed_initial_bits) { /* Longest representable white run */
- if_debug1('W', "[wu]%d\n", rlen);
- if ((qbit -= cfd_uncompressed_initial_bits) < 0)
- qbit += 8, q++;
- } else {
- if_debug1('W', "[wu]%d+1\n", rlen);
- if (qbit -= rlen < 0)
- qbit += 8, q++;
- *q ^= 1 << qbit;
- }
- skip_bits(clen);
+ ensure_bits(cfd_uncompressed_initial_bits, NOOUT);
+ np = &cf_uncompressed_decode[peek_bits(cfd_uncompressed_initial_bits)];
+ clen = np->code_length;
+ rlen = np->run_length;
+ if (clen > cfd_uncompressed_initial_bits) { /* Must be an exit code. */
+ break;
+ }
+ if (rlen == cfd_uncompressed_initial_bits) { /* Longest representable white run */
+ if_debug1('W', "[wu]%d\n", rlen);
+ if ((qbit -= cfd_uncompressed_initial_bits) < 0)
+ qbit += 8, q++;
+ } else {
+ if_debug1('W', "[wu]%d+1\n", rlen);
+ if (qbit -= rlen < 0)
+ qbit += 8, q++;
+ *q ^= 1 << qbit;
+ }
+ skip_bits(clen);
}
clen -= cfd_uncompressed_initial_bits;
skip_bits(cfd_uncompressed_initial_bits);
@@ -807,9 +807,9 @@ cf_decode_uncompressed(stream * s)
skip_bits(np->code_length);
if_debug1('w', "[wu]exit %d\n", rlen);
if (rlen >= 0) { /* Valid exit code, rlen = 2 * run length + next polarity */
- if ((qbit -= rlen >> 1) < 0)
- qbit += 8, q++;
- rlen &= 1;
+ if ((qbit -= rlen >> 1) < 0)
+ qbit += 8, q++;
+ rlen &= 1;
}
out: /******* WRONG ******/
cfd_store_state();
diff --git a/gs/base/scfdgen.c b/gs/base/scfdgen.c
index 87d812d69..6bf8a2cda 100644
--- a/gs/base/scfdgen.c
+++ b/gs/base/scfdgen.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,29 +66,29 @@ main()
/* Initialize first-level leaves, count second-level nodes. */
static void
cfd_count_nodes(cfd_node * tree, cfd_node * ignore_extn,
- uint code, int code_length, int run_length, int initial_bits)
+ uint code, int code_length, int run_length, int initial_bits)
{
if (code_length <= initial_bits) {
- /* Initialize one or more first-level leaves. */
- int sh = initial_bits - code_length;
- cfd_node *np = &tree[code << sh];
- int i;
-
- for (i = 1 << sh; i > 0; i--, np++)
- np->run_length = run_length,
- np->code_length = code_length;
+ /* Initialize one or more first-level leaves. */
+ int sh = initial_bits - code_length;
+ cfd_node *np = &tree[code << sh];
+ int i;
+
+ for (i = 1 << sh; i > 0; i--, np++)
+ np->run_length = run_length,
+ np->code_length = code_length;
} else {
- /* Note the need for a second level. */
- cfd_node *np = &tree[code >> (code_length - initial_bits)];
+ /* Note the need for a second level. */
+ cfd_node *np = &tree[code >> (code_length - initial_bits)];
- np->code_length = max(np->code_length, code_length);
+ np->code_length = max(np->code_length, code_length);
}
}
/* Initialize second-level nodes. */
static void
cfd_init2_nodes(cfd_node * tree, cfd_node * extn,
- uint code, int code_length, int run_length, int initial_bits)
+ uint code, int code_length, int run_length, int initial_bits)
{
int xbits = code_length - initial_bits;
int xrep;
@@ -96,94 +96,94 @@ cfd_init2_nodes(cfd_node * tree, cfd_node * extn,
int i;
if (xbits <= 0)
- return;
+ return;
np1 = &tree[code >> xbits];
np2 = &extn[np1->run_length - (1 << initial_bits)];
xrep = np1->code_length - code_length;
i = 1 << xrep;
np2 += (code & ((1 << xbits) - 1)) * i;
for (; i > 0; i--, np2++)
- np2->run_length = run_length,
- np2->code_length = xbits;
+ np2->run_length = run_length,
+ np2->code_length = xbits;
}
/* Enumerate all the relevant white or black codes. */
static void
cfd_enumerate_codes(cfd_node_proc proc, cfd_node * tree, cfd_node * extn,
- int initial_bits, const cfe_run * tt, const cfe_run * mut)
+ int initial_bits, const cfe_run * tt, const cfe_run * mut)
{
int i;
const cfe_run *ep;
for (i = 0, ep = tt; i < 64; i++, ep++)
- (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
+ (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
for (i = 1, ep = mut + 1; i < 41; i++, ep++)
- (*proc) (tree, extn, ep->code, ep->code_length, i << 6, initial_bits);
+ (*proc) (tree, extn, ep->code, ep->code_length, i << 6, initial_bits);
(*proc) (tree, extn,
- cf1_run_uncompressed.code, cf1_run_uncompressed.code_length,
- run_uncompressed, initial_bits);
+ cf1_run_uncompressed.code, cf1_run_uncompressed.code_length,
+ run_uncompressed, initial_bits);
(*proc) (tree, extn,
- 0, run_eol_code_length - 1,
- run_zeros, initial_bits);
+ 0, run_eol_code_length - 1,
+ run_zeros, initial_bits);
}
static void
cfd_enumerate_white(cfd_node_proc proc, cfd_node * tree, cfd_node * extn,
- int initial_bits)
+ int initial_bits)
{
cfd_enumerate_codes(proc, tree, extn, initial_bits,
- cf_white_runs.termination, cf_white_runs.make_up);
+ cf_white_runs.termination, cf_white_runs.make_up);
}
static void
cfd_enumerate_black(cfd_node_proc proc, cfd_node * tree, cfd_node * extn,
- int initial_bits)
+ int initial_bits)
{
cfd_enumerate_codes(proc, tree, extn, initial_bits,
- cf_black_runs.termination, cf_black_runs.make_up);
+ cf_black_runs.termination, cf_black_runs.make_up);
}
/* Enumerate the 2-D codes. */
static void
cfd_enumerate_2d(cfd_node_proc proc, cfd_node * tree, cfd_node * extn,
- int initial_bits)
+ int initial_bits)
{
int i;
const cfe_run *ep;
(*proc) (tree, extn, cf2_run_pass.code, cf2_run_pass.code_length,
- run2_pass, initial_bits);
+ run2_pass, initial_bits);
(*proc) (tree, extn, cf2_run_horizontal.code, cf2_run_horizontal.code_length,
- run2_horizontal, initial_bits);
+ run2_horizontal, initial_bits);
for (i = 0; i < countof(cf2_run_vertical); i++) {
- ep = &cf2_run_vertical[i];
- (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
+ ep = &cf2_run_vertical[i];
+ (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
}
(*proc) (tree, extn, cf2_run_uncompressed.code, cf2_run_uncompressed.code_length,
- run_uncompressed, initial_bits);
+ run_uncompressed, initial_bits);
(*proc) (tree, extn, 0, run_eol_code_length - 1, run_zeros, initial_bits);
}
/* Enumerate the uncompressed codes. */
static void
cfd_enumerate_uncompressed(cfd_node_proc proc, cfd_node * tree, cfd_node * extn,
- int initial_bits)
+ int initial_bits)
{
int i;
const cfe_run *ep;
for (i = 0; i < countof(cf_uncompressed); i++) {
- ep = &cf_uncompressed[i];
- (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
+ ep = &cf_uncompressed[i];
+ (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
}
for (i = 0; i < countof(cf_uncompressed_exit); i++) {
- ep = &cf_uncompressed_exit[i];
- (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
+ ep = &cf_uncompressed_exit[i];
+ (*proc) (tree, extn, ep->code, ep->code_length, i, initial_bits);
}
}
/* Build and write out the table. */
static void
cfd_build_tree(cfd_node * tree, cfd_enum_proc enum_proc, int initial_bits,
- FILE * f)
+ FILE * f)
{
cfd_node *np;
const char *prev = "";
@@ -195,20 +195,20 @@ cfd_build_tree(cfd_node * tree, cfd_enum_proc enum_proc, int initial_bits,
(*enum_proc) (cfd_count_nodes, tree, (cfd_node *) 0, initial_bits);
next = 0;
for (i = 0, np = tree; i < 1 << initial_bits; i++, np++) {
- if (np->code_length > initial_bits) { /* second level needed */
- np->run_length = next + (1 << initial_bits);
- next += 1 << (np->code_length - initial_bits);
- }
- fprintf(f, "%s\t{ %d, %d }", prev, np->run_length, np->code_length);
- prev = ",\n";
+ if (np->code_length > initial_bits) { /* second level needed */
+ np->run_length = next + (1 << initial_bits);
+ next += 1 << (np->code_length - initial_bits);
+ }
+ fprintf(f, "%s\t{ %d, %d }", prev, np->run_length, np->code_length);
+ prev = ",\n";
}
/* Construct and write the second level. */
extn = (cfd_node *) malloc(sizeof(cfd_node) * next);
for (i = 0, np = extn; i < next; i++, np++)
- np->run_length = run_error,
- np->code_length = 0;
+ np->run_length = run_error,
+ np->code_length = 0;
(*enum_proc) (cfd_init2_nodes, tree, extn, initial_bits);
for (i = 0, np = extn; i < next; i++, np++)
- fprintf(f, ",\n\t{ %d, %d }", np->run_length, np->code_length);
+ fprintf(f, ",\n\t{ %d, %d }", np->run_length, np->code_length);
free((char *)extn);
}
diff --git a/gs/base/scfdtab.c b/gs/base/scfdtab.c
index 194faf23e..a153edc86 100644
--- a/gs/base/scfdtab.c
+++ b/gs/base/scfdtab.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,922 +24,922 @@
/* White decoding table. */
const cfd_node cf_white_decode[] = {
- { 256, 12 },
- { 272, 12 },
- { 29, 8 },
- { 30, 8 },
- { 45, 8 },
- { 46, 8 },
- { 22, 7 },
- { 22, 7 },
- { 23, 7 },
- { 23, 7 },
- { 47, 8 },
- { 48, 8 },
- { 13, 6 },
- { 13, 6 },
- { 13, 6 },
- { 13, 6 },
- { 20, 7 },
- { 20, 7 },
- { 33, 8 },
- { 34, 8 },
- { 35, 8 },
- { 36, 8 },
- { 37, 8 },
- { 38, 8 },
- { 19, 7 },
- { 19, 7 },
- { 31, 8 },
- { 32, 8 },
- { 1, 6 },
- { 1, 6 },
- { 1, 6 },
- { 1, 6 },
- { 12, 6 },
- { 12, 6 },
- { 12, 6 },
- { 12, 6 },
- { 53, 8 },
- { 54, 8 },
- { 26, 7 },
- { 26, 7 },
- { 39, 8 },
- { 40, 8 },
- { 41, 8 },
- { 42, 8 },
- { 43, 8 },
- { 44, 8 },
- { 21, 7 },
- { 21, 7 },
- { 28, 7 },
- { 28, 7 },
- { 61, 8 },
- { 62, 8 },
- { 63, 8 },
- { 0, 8 },
- { 320, 8 },
- { 384, 8 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 10, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 11, 5 },
- { 27, 7 },
- { 27, 7 },
- { 59, 8 },
- { 60, 8 },
- { 288, 9 },
- { 290, 9 },
- { 18, 7 },
- { 18, 7 },
- { 24, 7 },
- { 24, 7 },
- { 49, 8 },
- { 50, 8 },
- { 51, 8 },
- { 52, 8 },
- { 25, 7 },
- { 25, 7 },
- { 55, 8 },
- { 56, 8 },
- { 57, 8 },
- { 58, 8 },
- { 192, 6 },
- { 192, 6 },
- { 192, 6 },
- { 192, 6 },
- { 1664, 6 },
- { 1664, 6 },
- { 1664, 6 },
- { 1664, 6 },
- { 448, 8 },
- { 512, 8 },
- { 292, 9 },
- { 640, 8 },
- { 576, 8 },
- { 294, 9 },
- { 296, 9 },
- { 298, 9 },
- { 300, 9 },
- { 302, 9 },
- { 256, 7 },
- { 256, 7 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 2, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 128, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 8, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 9, 5 },
- { 16, 6 },
- { 16, 6 },
- { 16, 6 },
- { 16, 6 },
- { 17, 6 },
- { 17, 6 },
- { 17, 6 },
- { 17, 6 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 14, 6 },
- { 14, 6 },
- { 14, 6 },
- { 14, 6 },
- { 15, 6 },
- { 15, 6 },
- { 15, 6 },
- { 15, 6 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 64, 5 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { 7, 4 },
- { -2, 3 },
- { -2, 3 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -3, 4 },
- { 1792, 3 },
- { 1792, 3 },
- { 1984, 4 },
- { 2048, 4 },
- { 2112, 4 },
- { 2176, 4 },
- { 2240, 4 },
- { 2304, 4 },
- { 1856, 3 },
- { 1856, 3 },
- { 1920, 3 },
- { 1920, 3 },
- { 2368, 4 },
- { 2432, 4 },
- { 2496, 4 },
- { 2560, 4 },
- { 1472, 1 },
- { 1536, 1 },
- { 1600, 1 },
- { 1728, 1 },
- { 704, 1 },
- { 768, 1 },
- { 832, 1 },
- { 896, 1 },
- { 960, 1 },
- { 1024, 1 },
- { 1088, 1 },
- { 1152, 1 },
- { 1216, 1 },
- { 1280, 1 },
- { 1344, 1 },
- { 1408, 1 }
+ { 256, 12 },
+ { 272, 12 },
+ { 29, 8 },
+ { 30, 8 },
+ { 45, 8 },
+ { 46, 8 },
+ { 22, 7 },
+ { 22, 7 },
+ { 23, 7 },
+ { 23, 7 },
+ { 47, 8 },
+ { 48, 8 },
+ { 13, 6 },
+ { 13, 6 },
+ { 13, 6 },
+ { 13, 6 },
+ { 20, 7 },
+ { 20, 7 },
+ { 33, 8 },
+ { 34, 8 },
+ { 35, 8 },
+ { 36, 8 },
+ { 37, 8 },
+ { 38, 8 },
+ { 19, 7 },
+ { 19, 7 },
+ { 31, 8 },
+ { 32, 8 },
+ { 1, 6 },
+ { 1, 6 },
+ { 1, 6 },
+ { 1, 6 },
+ { 12, 6 },
+ { 12, 6 },
+ { 12, 6 },
+ { 12, 6 },
+ { 53, 8 },
+ { 54, 8 },
+ { 26, 7 },
+ { 26, 7 },
+ { 39, 8 },
+ { 40, 8 },
+ { 41, 8 },
+ { 42, 8 },
+ { 43, 8 },
+ { 44, 8 },
+ { 21, 7 },
+ { 21, 7 },
+ { 28, 7 },
+ { 28, 7 },
+ { 61, 8 },
+ { 62, 8 },
+ { 63, 8 },
+ { 0, 8 },
+ { 320, 8 },
+ { 384, 8 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 10, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 11, 5 },
+ { 27, 7 },
+ { 27, 7 },
+ { 59, 8 },
+ { 60, 8 },
+ { 288, 9 },
+ { 290, 9 },
+ { 18, 7 },
+ { 18, 7 },
+ { 24, 7 },
+ { 24, 7 },
+ { 49, 8 },
+ { 50, 8 },
+ { 51, 8 },
+ { 52, 8 },
+ { 25, 7 },
+ { 25, 7 },
+ { 55, 8 },
+ { 56, 8 },
+ { 57, 8 },
+ { 58, 8 },
+ { 192, 6 },
+ { 192, 6 },
+ { 192, 6 },
+ { 192, 6 },
+ { 1664, 6 },
+ { 1664, 6 },
+ { 1664, 6 },
+ { 1664, 6 },
+ { 448, 8 },
+ { 512, 8 },
+ { 292, 9 },
+ { 640, 8 },
+ { 576, 8 },
+ { 294, 9 },
+ { 296, 9 },
+ { 298, 9 },
+ { 300, 9 },
+ { 302, 9 },
+ { 256, 7 },
+ { 256, 7 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 2, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 128, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 8, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 9, 5 },
+ { 16, 6 },
+ { 16, 6 },
+ { 16, 6 },
+ { 16, 6 },
+ { 17, 6 },
+ { 17, 6 },
+ { 17, 6 },
+ { 17, 6 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 14, 6 },
+ { 14, 6 },
+ { 14, 6 },
+ { 14, 6 },
+ { 15, 6 },
+ { 15, 6 },
+ { 15, 6 },
+ { 15, 6 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 64, 5 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { 7, 4 },
+ { -2, 3 },
+ { -2, 3 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -3, 4 },
+ { 1792, 3 },
+ { 1792, 3 },
+ { 1984, 4 },
+ { 2048, 4 },
+ { 2112, 4 },
+ { 2176, 4 },
+ { 2240, 4 },
+ { 2304, 4 },
+ { 1856, 3 },
+ { 1856, 3 },
+ { 1920, 3 },
+ { 1920, 3 },
+ { 2368, 4 },
+ { 2432, 4 },
+ { 2496, 4 },
+ { 2560, 4 },
+ { 1472, 1 },
+ { 1536, 1 },
+ { 1600, 1 },
+ { 1728, 1 },
+ { 704, 1 },
+ { 768, 1 },
+ { 832, 1 },
+ { 896, 1 },
+ { 960, 1 },
+ { 1024, 1 },
+ { 1088, 1 },
+ { 1152, 1 },
+ { 1216, 1 },
+ { 1280, 1 },
+ { 1344, 1 },
+ { 1408, 1 }
};
/* Black decoding table. */
const cfd_node cf_black_decode[] = {
- { 128, 12 },
- { 160, 13 },
- { 224, 12 },
- { 256, 12 },
- { 10, 7 },
- { 11, 7 },
- { 288, 12 },
- { 12, 7 },
- { 9, 6 },
- { 9, 6 },
- { 8, 6 },
- { 8, 6 },
- { 7, 5 },
- { 7, 5 },
- { 7, 5 },
- { 7, 5 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 6, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 1, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 3, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { 2, 2 },
- { -2, 4 },
- { -2, 4 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -3, 5 },
- { 1792, 4 },
- { 1792, 4 },
- { 1984, 5 },
- { 2048, 5 },
- { 2112, 5 },
- { 2176, 5 },
- { 2240, 5 },
- { 2304, 5 },
- { 1856, 4 },
- { 1856, 4 },
- { 1920, 4 },
- { 1920, 4 },
- { 2368, 5 },
- { 2432, 5 },
- { 2496, 5 },
- { 2560, 5 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 18, 3 },
- { 52, 5 },
- { 52, 5 },
- { 640, 6 },
- { 704, 6 },
- { 768, 6 },
- { 832, 6 },
- { 55, 5 },
- { 55, 5 },
- { 56, 5 },
- { 56, 5 },
- { 1280, 6 },
- { 1344, 6 },
- { 1408, 6 },
- { 1472, 6 },
- { 59, 5 },
- { 59, 5 },
- { 60, 5 },
- { 60, 5 },
- { 1536, 6 },
- { 1600, 6 },
- { 24, 4 },
- { 24, 4 },
- { 24, 4 },
- { 24, 4 },
- { 25, 4 },
- { 25, 4 },
- { 25, 4 },
- { 25, 4 },
- { 1664, 6 },
- { 1728, 6 },
- { 320, 5 },
- { 320, 5 },
- { 384, 5 },
- { 384, 5 },
- { 448, 5 },
- { 448, 5 },
- { 512, 6 },
- { 576, 6 },
- { 53, 5 },
- { 53, 5 },
- { 54, 5 },
- { 54, 5 },
- { 896, 6 },
- { 960, 6 },
- { 1024, 6 },
- { 1088, 6 },
- { 1152, 6 },
- { 1216, 6 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 64, 3 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 13, 1 },
- { 23, 4 },
- { 23, 4 },
- { 50, 5 },
- { 51, 5 },
- { 44, 5 },
- { 45, 5 },
- { 46, 5 },
- { 47, 5 },
- { 57, 5 },
- { 58, 5 },
- { 61, 5 },
- { 256, 5 },
- { 16, 3 },
- { 16, 3 },
- { 16, 3 },
- { 16, 3 },
- { 17, 3 },
- { 17, 3 },
- { 17, 3 },
- { 17, 3 },
- { 48, 5 },
- { 49, 5 },
- { 62, 5 },
- { 63, 5 },
- { 30, 5 },
- { 31, 5 },
- { 32, 5 },
- { 33, 5 },
- { 40, 5 },
- { 41, 5 },
- { 22, 4 },
- { 22, 4 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 14, 1 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 15, 2 },
- { 128, 5 },
- { 192, 5 },
- { 26, 5 },
- { 27, 5 },
- { 28, 5 },
- { 29, 5 },
- { 19, 4 },
- { 19, 4 },
- { 20, 4 },
- { 20, 4 },
- { 34, 5 },
- { 35, 5 },
- { 36, 5 },
- { 37, 5 },
- { 38, 5 },
- { 39, 5 },
- { 21, 4 },
- { 21, 4 },
- { 42, 5 },
- { 43, 5 },
- { 0, 3 },
- { 0, 3 },
- { 0, 3 },
- { 0, 3 }
+ { 128, 12 },
+ { 160, 13 },
+ { 224, 12 },
+ { 256, 12 },
+ { 10, 7 },
+ { 11, 7 },
+ { 288, 12 },
+ { 12, 7 },
+ { 9, 6 },
+ { 9, 6 },
+ { 8, 6 },
+ { 8, 6 },
+ { 7, 5 },
+ { 7, 5 },
+ { 7, 5 },
+ { 7, 5 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 6, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 1, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 3, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { 2, 2 },
+ { -2, 4 },
+ { -2, 4 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -3, 5 },
+ { 1792, 4 },
+ { 1792, 4 },
+ { 1984, 5 },
+ { 2048, 5 },
+ { 2112, 5 },
+ { 2176, 5 },
+ { 2240, 5 },
+ { 2304, 5 },
+ { 1856, 4 },
+ { 1856, 4 },
+ { 1920, 4 },
+ { 1920, 4 },
+ { 2368, 5 },
+ { 2432, 5 },
+ { 2496, 5 },
+ { 2560, 5 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 18, 3 },
+ { 52, 5 },
+ { 52, 5 },
+ { 640, 6 },
+ { 704, 6 },
+ { 768, 6 },
+ { 832, 6 },
+ { 55, 5 },
+ { 55, 5 },
+ { 56, 5 },
+ { 56, 5 },
+ { 1280, 6 },
+ { 1344, 6 },
+ { 1408, 6 },
+ { 1472, 6 },
+ { 59, 5 },
+ { 59, 5 },
+ { 60, 5 },
+ { 60, 5 },
+ { 1536, 6 },
+ { 1600, 6 },
+ { 24, 4 },
+ { 24, 4 },
+ { 24, 4 },
+ { 24, 4 },
+ { 25, 4 },
+ { 25, 4 },
+ { 25, 4 },
+ { 25, 4 },
+ { 1664, 6 },
+ { 1728, 6 },
+ { 320, 5 },
+ { 320, 5 },
+ { 384, 5 },
+ { 384, 5 },
+ { 448, 5 },
+ { 448, 5 },
+ { 512, 6 },
+ { 576, 6 },
+ { 53, 5 },
+ { 53, 5 },
+ { 54, 5 },
+ { 54, 5 },
+ { 896, 6 },
+ { 960, 6 },
+ { 1024, 6 },
+ { 1088, 6 },
+ { 1152, 6 },
+ { 1216, 6 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 64, 3 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 13, 1 },
+ { 23, 4 },
+ { 23, 4 },
+ { 50, 5 },
+ { 51, 5 },
+ { 44, 5 },
+ { 45, 5 },
+ { 46, 5 },
+ { 47, 5 },
+ { 57, 5 },
+ { 58, 5 },
+ { 61, 5 },
+ { 256, 5 },
+ { 16, 3 },
+ { 16, 3 },
+ { 16, 3 },
+ { 16, 3 },
+ { 17, 3 },
+ { 17, 3 },
+ { 17, 3 },
+ { 17, 3 },
+ { 48, 5 },
+ { 49, 5 },
+ { 62, 5 },
+ { 63, 5 },
+ { 30, 5 },
+ { 31, 5 },
+ { 32, 5 },
+ { 33, 5 },
+ { 40, 5 },
+ { 41, 5 },
+ { 22, 4 },
+ { 22, 4 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 14, 1 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 15, 2 },
+ { 128, 5 },
+ { 192, 5 },
+ { 26, 5 },
+ { 27, 5 },
+ { 28, 5 },
+ { 29, 5 },
+ { 19, 4 },
+ { 19, 4 },
+ { 20, 4 },
+ { 20, 4 },
+ { 34, 5 },
+ { 35, 5 },
+ { 36, 5 },
+ { 37, 5 },
+ { 38, 5 },
+ { 39, 5 },
+ { 21, 4 },
+ { 21, 4 },
+ { 42, 5 },
+ { 43, 5 },
+ { 0, 3 },
+ { 0, 3 },
+ { 0, 3 },
+ { 0, 3 }
};
/* 2-D decoding table. */
const cfd_node cf_2d_decode[] = {
- { 128, 11 },
- { 144, 10 },
- { 6, 7 },
- { 0, 7 },
- { 5, 6 },
- { 5, 6 },
- { 1, 6 },
- { 1, 6 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -4, 4 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { -5, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 4, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { 3, 1 },
- { -2, 4 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -1, 0 },
- { -3, 3 }
+ { 128, 11 },
+ { 144, 10 },
+ { 6, 7 },
+ { 0, 7 },
+ { 5, 6 },
+ { 5, 6 },
+ { 1, 6 },
+ { 1, 6 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -4, 4 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { -5, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 4, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { 3, 1 },
+ { -2, 4 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -1, 0 },
+ { -3, 3 }
};
/* Uncompresssed decoding table. */
const cfd_node cf_uncompressed_decode[] = {
- { 64, 12 },
- { 5, 6 },
- { 4, 5 },
- { 4, 5 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 3, 4 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { 0, 1 },
- { -1, 0 },
- { -1, 0 },
- { 8, 6 },
- { 9, 6 },
- { 6, 5 },
- { 6, 5 },
- { 7, 5 },
- { 7, 5 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 4, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 5, 4 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 2, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 3, 3 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 0, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 },
- { 1, 2 }
+ { 64, 12 },
+ { 5, 6 },
+ { 4, 5 },
+ { 4, 5 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 3, 4 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { 0, 1 },
+ { -1, 0 },
+ { -1, 0 },
+ { 8, 6 },
+ { 9, 6 },
+ { 6, 5 },
+ { 6, 5 },
+ { 7, 5 },
+ { 7, 5 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 4, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 5, 4 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 2, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 3, 3 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 0, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 },
+ { 1, 2 }
};
/* Dummy executable code to pacify compilers. */
diff --git a/gs/base/scfe.c b/gs/base/scfe.c
index 314463ac9..46f86d75c 100644
--- a/gs/base/scfe.c
+++ b/gs/base/scfe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,12 +41,12 @@ print_run_stats(const stats_runs_t * stats)
ulong total;
for (i = 0, total = 0; i < 41; i++)
- dprintf1(" %lu", stats->make_up[i]),
- total += stats->make_up[i];
+ dprintf1(" %lu", stats->make_up[i]),
+ total += stats->make_up[i];
dprintf1(" total=%lu\n\t", total);
for (i = 0, total = 0; i < 64; i++)
- dprintf1(" %lu", stats->termination[i]),
- total += stats->termination[i];
+ dprintf1(" %lu", stats->termination[i]),
+ total += stats->termination[i];
dprintf1(" total=%lu\n", total);
}
@@ -64,10 +64,10 @@ BEGIN\
cfe_run rr;\
\
if ( lenv >= 64 ) {\
- hce_store_state();\
- q = cf_put_long_run(ss, q, lenv, &rt);\
- hce_load_state();\
- lenv &= 63;\
+ hce_store_state();\
+ q = cf_put_long_run(ss, q, lenv, &rt);\
+ hce_load_state();\
+ lenv &= 63;\
}\
rr = rt.termination[lenv];\
COUNT_RUN(stats.termination, lenv);\
@@ -88,10 +88,10 @@ cf_put_long_run(stream_CFE_state * ss, byte * q, int lenv, const cf_runs * prt)
hce_load_state();
while (lenv >= 2560 + 64) {
- rr = prt->make_up[40];
- COUNT_RUN(pstats->make_up, 40);
- hc_put_value(ss, q, rr.code, rr.code_length);
- lenv -= 2560;
+ rr = prt->make_up[40];
+ COUNT_RUN(pstats->make_up, 40);
+ hc_put_value(ss, q, rr.code, rr.code_length);
+ lenv -= 2560;
}
rr = prt->make_up[lenv >> 6];
COUNT_RUN(pstats->make_up, lenv >> 6);
@@ -137,37 +137,37 @@ s_CFE_init(register stream_state * st)
int code_bytes =
((columns * (ss->K == 0 ? 9 : 12)) >> 4) + 20; /* add slop */
int raster = ss->raster =
- ROUND_UP((columns + 7) >> 3, ss->DecodedByteAlign);
+ ROUND_UP((columns + 7) >> 3, ss->DecodedByteAlign);
s_hce_init_inline(ss);
ss->lbuf = ss->lprev = ss->lcode = 0; /* in case we have to release */
if (columns > cfe_max_width)
- return ERRC;
+ return ERRC;
/****** WRONG ******/
/* Because skip_white_pixels can look as many as 4 bytes ahead, */
/* we need to allow 4 extra bytes at the end of the row buffers. */
ss->lbuf = gs_alloc_bytes(st->memory, raster + 4, "CFE lbuf");
ss->lcode = gs_alloc_bytes(st->memory, code_bytes, "CFE lcode");
if (ss->lbuf == 0 || ss->lcode == 0) {
- s_CFE_release(st);
- return ERRC;
+ s_CFE_release(st);
+ return ERRC;
/****** WRONG ******/
}
memset(ss->lbuf + raster, 0, 4); /* to pacify Valgrind */
if (ss->K != 0) {
- ss->lprev = gs_alloc_bytes(st->memory, raster + 4, "CFE lprev");
- if (ss->lprev == 0) {
- s_CFE_release(st);
- return ERRC;
+ ss->lprev = gs_alloc_bytes(st->memory, raster + 4, "CFE lprev");
+ if (ss->lprev == 0) {
+ s_CFE_release(st);
+ return ERRC;
/****** WRONG ******/
- }
- /* Clear the initial reference line for 2-D encoding. */
- /* Make sure it is terminated properly. */
- memset(ss->lprev, (ss->BlackIs1 ? 0 : 0xff), raster + 4); /* +4 to pacify Valgrind */
- if (columns & 7)
- ss->lprev[raster - 1] ^= 0x80 >> (columns & 7);
- else
- ss->lprev[raster] = ~ss->lprev[0];
+ }
+ /* Clear the initial reference line for 2-D encoding. */
+ /* Make sure it is terminated properly. */
+ memset(ss->lprev, (ss->BlackIs1 ? 0 : 0xff), raster + 4); /* +4 to pacify Valgrind */
+ if (columns & 7)
+ ss->lprev[raster - 1] ^= 0x80 >> (columns & 7);
+ else
+ ss->lprev[raster] = ~ss->lprev[0];
}
ss->read_count = raster;
ss->write_count = 0;
@@ -189,12 +189,12 @@ s_CFE_release(stream_state * st)
/* Flush the buffer */
static void cf_encode_1d(stream_CFE_state *, const byte *,
- stream_cursor_write *);
+ stream_cursor_write *);
static void cf_encode_2d(stream_CFE_state *, const byte *,
- stream_cursor_write *, const byte *);
+ stream_cursor_write *, const byte *);
static int
s_CFE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_CFE_state *const ss = (stream_CFE_state *) st;
const byte *rlimit = pr->limit;
@@ -204,172 +204,172 @@ s_CFE_process(stream_state * st, stream_cursor_read * pr,
int status = 0;
for (;;) {
- stream_cursor_write w;
-
- if_debug2('w', "[w]CFE: read_count = %d, write_count=%d,\n",
- ss->read_count, ss->write_count);
- if_debug6('w', " pr = 0x%lx(%d)0x%lx, pw = 0x%lx(%d)0x%lx\n",
- (ulong) pr->ptr, (int)(rlimit - pr->ptr), (ulong) rlimit,
- (ulong) pw->ptr, (int)(wlimit - pw->ptr), (ulong) wlimit);
- if (ss->write_count) {
- /* Copy more of an encoded line to the caller. */
- int wcount = wlimit - pw->ptr;
- int ccount = min(wcount, ss->write_count);
-
- memcpy(pw->ptr + 1, ss->lcode + ss->code_bytes - ss->write_count,
- ccount);
- pw->ptr += ccount;
- if ((ss->write_count -= ccount) > 0) {
- status = 1;
- break;
- }
- }
- if (ss->read_count) {
- /* Copy more of an unencoded line from the caller. */
- int rcount = rlimit - pr->ptr;
- int ccount = min(rcount, ss->read_count);
-
- if (rcount == 0 && last)
- break;
- memcpy(ss->lbuf + raster - ss->read_count,
- pr->ptr + 1, ccount);
- pr->ptr += ccount;
- if ((ss->read_count -= ccount) != 0)
- break;
- }
- /*
- * We have a full scan line in lbuf. Ensure that it ends with
- * two polarity changes.
- */
- {
- byte *end = ss->lbuf + raster - 1;
- byte end_bit = *end & end_mask;
- byte not_bit = end_bit ^ end_mask;
-
- *end &= -end_mask;
- if (end_mask == 1)
- end[1] = (end_bit ? 0x40 : 0x80);
- else if (end_mask == 2)
- *end |= not_bit >> 1, end[1] = end_bit << 7;
- else
- *end |= (not_bit >> 1) | (end_bit >> 2);
- }
- /*
- * Write the output directly to the caller's buffer if it's large
- * enough, otherwise to our own buffer.
- */
- if (wlimit - pw->ptr >= ss->max_code_bytes) {
- w = *pw;
- } else {
- w.ptr = ss->lcode - 1;
- w.limit = w.ptr + ss->max_code_bytes;
- }
+ stream_cursor_write w;
+
+ if_debug2('w', "[w]CFE: read_count = %d, write_count=%d,\n",
+ ss->read_count, ss->write_count);
+ if_debug6('w', " pr = 0x%lx(%d)0x%lx, pw = 0x%lx(%d)0x%lx\n",
+ (ulong) pr->ptr, (int)(rlimit - pr->ptr), (ulong) rlimit,
+ (ulong) pw->ptr, (int)(wlimit - pw->ptr), (ulong) wlimit);
+ if (ss->write_count) {
+ /* Copy more of an encoded line to the caller. */
+ int wcount = wlimit - pw->ptr;
+ int ccount = min(wcount, ss->write_count);
+
+ memcpy(pw->ptr + 1, ss->lcode + ss->code_bytes - ss->write_count,
+ ccount);
+ pw->ptr += ccount;
+ if ((ss->write_count -= ccount) > 0) {
+ status = 1;
+ break;
+ }
+ }
+ if (ss->read_count) {
+ /* Copy more of an unencoded line from the caller. */
+ int rcount = rlimit - pr->ptr;
+ int ccount = min(rcount, ss->read_count);
+
+ if (rcount == 0 && last)
+ break;
+ memcpy(ss->lbuf + raster - ss->read_count,
+ pr->ptr + 1, ccount);
+ pr->ptr += ccount;
+ if ((ss->read_count -= ccount) != 0)
+ break;
+ }
+ /*
+ * We have a full scan line in lbuf. Ensure that it ends with
+ * two polarity changes.
+ */
+ {
+ byte *end = ss->lbuf + raster - 1;
+ byte end_bit = *end & end_mask;
+ byte not_bit = end_bit ^ end_mask;
+
+ *end &= -end_mask;
+ if (end_mask == 1)
+ end[1] = (end_bit ? 0x40 : 0x80);
+ else if (end_mask == 2)
+ *end |= not_bit >> 1, end[1] = end_bit << 7;
+ else
+ *end |= (not_bit >> 1) | (end_bit >> 2);
+ }
+ /*
+ * Write the output directly to the caller's buffer if it's large
+ * enough, otherwise to our own buffer.
+ */
+ if (wlimit - pw->ptr >= ss->max_code_bytes) {
+ w = *pw;
+ } else {
+ w.ptr = ss->lcode - 1;
+ w.limit = w.ptr + ss->max_code_bytes;
+ }
#ifdef DEBUG
- if (ss->K > 0) {
- if_debug2('w', "[w2]new %d-D row, k_left=%d\n",
- (ss->k_left == 1 ? 1 : 2), ss->k_left);
- } else {
- if_debug1('w', "[w%d]new row\n", (ss->K < 0 ? 2 : 1));
- }
+ if (ss->K > 0) {
+ if_debug2('w', "[w2]new %d-D row, k_left=%d\n",
+ (ss->k_left == 1 ? 1 : 2), ss->k_left);
+ } else {
+ if_debug1('w', "[w%d]new row\n", (ss->K < 0 ? 2 : 1));
+ }
#endif
- /*
- * Write an EOL (actually a "beginning of line") if requested.
- */
- if (ss->EndOfLine) {
- const cfe_run *rp =
- (ss->K <= 0 ? &cf_run_eol :
- ss->k_left > 1 ? &cf2_run_eol_2d :
- &cf2_run_eol_1d);
- cfe_run run;
-
- hce_declare_state;
-
- hce_load_state();
- if (ss->EncodedByteAlign) {
- run = *rp;
- /* Pad the run on the left */
- /* so it winds up byte-aligned. */
- run.code_length +=
- (bits_left - run_eol_code_length) & 7;
- if (run.code_length > 16) /* <= 23 */
- bits_left -= run.code_length & 7,
- run.code_length = 16;
- rp = &run;
- }
- hc_put_code(ss, w.ptr, rp);
- hce_store_state();
- } else if (ss->EncodedByteAlign)
- ss->bits_left &= ~7;
- /* Encode the line. */
- if (ss->K == 0)
- cf_encode_1d(ss, ss->lbuf, &w); /* pure 1-D */
- else if (ss->K < 0)
- cf_encode_2d(ss, ss->lbuf, &w, ss->lprev); /* pure 2-D */
- else if (--(ss->k_left)) /* mixed, use 2-D */
- cf_encode_2d(ss, ss->lbuf, &w, ss->lprev);
- else { /* mixed, use 1-D */
- cf_encode_1d(ss, ss->lbuf, &w);
- ss->k_left = ss->K;
- }
- /*
- * If we didn't write directly to the client's buffer, schedule
- * the output data to be written.
- */
- if (w.limit == wlimit)
- pw->ptr = w.ptr;
- else
- ss->write_count = ss->code_bytes = w.ptr - (ss->lcode - 1);
- if (ss->K != 0) {
- /* In 2-D modes, swap the current and previous scan lines. */
- byte *temp = ss->lbuf;
-
- ss->lbuf = ss->lprev;
- ss->lprev = temp;
- }
- /* Note that the input buffer needs refilling. */
- ss->read_count = raster;
+ /*
+ * Write an EOL (actually a "beginning of line") if requested.
+ */
+ if (ss->EndOfLine) {
+ const cfe_run *rp =
+ (ss->K <= 0 ? &cf_run_eol :
+ ss->k_left > 1 ? &cf2_run_eol_2d :
+ &cf2_run_eol_1d);
+ cfe_run run;
+
+ hce_declare_state;
+
+ hce_load_state();
+ if (ss->EncodedByteAlign) {
+ run = *rp;
+ /* Pad the run on the left */
+ /* so it winds up byte-aligned. */
+ run.code_length +=
+ (bits_left - run_eol_code_length) & 7;
+ if (run.code_length > 16) /* <= 23 */
+ bits_left -= run.code_length & 7,
+ run.code_length = 16;
+ rp = &run;
+ }
+ hc_put_code(ss, w.ptr, rp);
+ hce_store_state();
+ } else if (ss->EncodedByteAlign)
+ ss->bits_left &= ~7;
+ /* Encode the line. */
+ if (ss->K == 0)
+ cf_encode_1d(ss, ss->lbuf, &w); /* pure 1-D */
+ else if (ss->K < 0)
+ cf_encode_2d(ss, ss->lbuf, &w, ss->lprev); /* pure 2-D */
+ else if (--(ss->k_left)) /* mixed, use 2-D */
+ cf_encode_2d(ss, ss->lbuf, &w, ss->lprev);
+ else { /* mixed, use 1-D */
+ cf_encode_1d(ss, ss->lbuf, &w);
+ ss->k_left = ss->K;
+ }
+ /*
+ * If we didn't write directly to the client's buffer, schedule
+ * the output data to be written.
+ */
+ if (w.limit == wlimit)
+ pw->ptr = w.ptr;
+ else
+ ss->write_count = ss->code_bytes = w.ptr - (ss->lcode - 1);
+ if (ss->K != 0) {
+ /* In 2-D modes, swap the current and previous scan lines. */
+ byte *temp = ss->lbuf;
+
+ ss->lbuf = ss->lprev;
+ ss->lprev = temp;
+ }
+ /* Note that the input buffer needs refilling. */
+ ss->read_count = raster;
}
/*
* When we exit from the loop, we know that write_count = 0, and
* there is no line waiting to be processed in the input buffer.
*/
if (last && status == 0) {
- const cfe_run *rp =
- (ss->K > 0 ? &cf2_run_eol_1d : &cf_run_eol);
- int i = (!ss->EndOfBlock ? 0 : ss->K < 0 ? 2 : 6);
- uint bits_to_write =
- hc_bits_size - ss->bits_left + i * rp->code_length;
- byte *q = pw->ptr;
-
- hce_declare_state;
-
- if (wlimit - q < (bits_to_write + 7) >> 3) {
- status = 1;
- goto out;
- }
- hce_load_state();
- if (ss->EncodedByteAlign)
- bits_left &= ~7;
- while (--i >= 0)
- hc_put_code(ss, q, rp);
- /* Force out the last byte or bytes. */
- pw->ptr = hc_put_last_bits((stream_hc_state *) ss, q);
+ const cfe_run *rp =
+ (ss->K > 0 ? &cf2_run_eol_1d : &cf_run_eol);
+ int i = (!ss->EndOfBlock ? 0 : ss->K < 0 ? 2 : 6);
+ uint bits_to_write =
+ hc_bits_size - ss->bits_left + i * rp->code_length;
+ byte *q = pw->ptr;
+
+ hce_declare_state;
+
+ if (wlimit - q < (bits_to_write + 7) >> 3) {
+ status = 1;
+ goto out;
+ }
+ hce_load_state();
+ if (ss->EncodedByteAlign)
+ bits_left &= ~7;
+ while (--i >= 0)
+ hc_put_code(ss, q, rp);
+ /* Force out the last byte or bytes. */
+ pw->ptr = hc_put_last_bits((stream_hc_state *) ss, q);
}
out:
if_debug9('w', "[w]CFE exit %d: read_count = %d, write_count = %d,\n pr = 0x%lx(%d)0x%lx; pw = 0x%lx(%d)0x%lx\n",
- status, ss->read_count, ss->write_count,
- (ulong) pr->ptr, (int)(rlimit - pr->ptr), (ulong) rlimit,
- (ulong) pw->ptr, (int)(wlimit - pw->ptr), (ulong) wlimit);
+ status, ss->read_count, ss->write_count,
+ (ulong) pr->ptr, (int)(rlimit - pr->ptr), (ulong) rlimit,
+ (ulong) pw->ptr, (int)(wlimit - pw->ptr), (ulong) wlimit);
#ifdef DEBUG
if (pr->ptr > rlimit || pw->ptr > wlimit) {
- lprintf("Pointer overrun!\n");
- status = ERRC;
+ lprintf("Pointer overrun!\n");
+ status = ERRC;
}
if (gs_debug_c('w') && status == 1) {
- dlputs("[w]white runs:");
- print_run_stats(&stats_white_runs);
- dlputs("[w]black runs:");
- print_run_stats(&stats_black_runs);
+ dlputs("[w]white runs:");
+ print_run_stats(&stats_white_runs);
+ dlputs("[w]black runs:");
+ print_run_stats(&stats_black_runs);
}
#endif
return status;
@@ -393,14 +393,14 @@ cf_encode_1d(stream_CFE_state * ss, const byte * lbuf, stream_cursor_write * pw)
hce_load_state();
while (count != end_count) {
- /* Parse a white run. */
- skip_white_pixels(data, p, count, invert, rlen);
- CF_PUT_WHITE_RUN(ss, rlen);
- if (count == end_count)
- break;
- /* Parse a black run. */
- skip_black_pixels(data, p, count, invert, rlen);
- CF_PUT_BLACK_RUN(ss, rlen);
+ /* Parse a white run. */
+ skip_white_pixels(data, p, count, invert, rlen);
+ CF_PUT_WHITE_RUN(ss, rlen);
+ if (count == end_count)
+ break;
+ /* Parse a black run. */
+ skip_black_pixels(data, p, count, invert, rlen);
+ CF_PUT_BLACK_RUN(ss, rlen);
}
hce_store_state();
pw->ptr = q;
@@ -409,7 +409,7 @@ cf_encode_1d(stream_CFE_state * ss, const byte * lbuf, stream_cursor_write * pw)
/* Encode a 2-D scan line. */
static void
cf_encode_2d(stream_CFE_state * ss, const byte * lbuf, stream_cursor_write * pw,
- const byte * lprev)
+ const byte * lprev)
{
byte invert_white = (ss->BlackIs1 ? 0 : 0xff);
byte invert = invert_white;
@@ -428,91 +428,91 @@ cf_encode_2d(stream_CFE_state * ss, const byte * lbuf, stream_cursor_write * pw,
*/
static const byte initial_count_bit[8] =
{
- 0, 1, 2, 4, 8, 0x10, 0x20, 0x40
+ 0, 1, 2, 4, 8, 0x10, 0x20, 0x40
};
static const byte further_count_bit[8] =
{
- 0x80, 1, 2, 4, 8, 0x10, 0x20, 0x40
+ 0x80, 1, 2, 4, 8, 0x10, 0x20, 0x40
};
const byte *count_bit = initial_count_bit;
hce_load_state();
while (count != end_count) {
- /*
- * If invert == invert_white, white and black have their
- * correct meanings; if invert == ~invert_white,
- * black and white are interchanged.
- */
- uint a0 = count;
- uint a1;
+ /*
+ * If invert == invert_white, white and black have their
+ * correct meanings; if invert == ~invert_white,
+ * black and white are interchanged.
+ */
+ uint a0 = count;
+ uint a1;
#define b1 (a1 - diff) /* only for printing */
- int diff;
- uint prev_count = count;
- const byte *prev_p = p - lbuf + lprev;
- byte prev_data = prev_p[-1] ^ invert;
- int rlen;
-
- /* Find the a1 and b1 transitions. */
- skip_white_pixels(data, p, count, invert, rlen);
- a1 = count;
- if ((prev_data & count_bit[prev_count & 7])) {
- /* Look for changing white first. */
- skip_black_pixels(prev_data, prev_p, prev_count, invert, rlen);
- }
- count_bit = further_count_bit; /* no longer at beginning */
+ int diff;
+ uint prev_count = count;
+ const byte *prev_p = p - lbuf + lprev;
+ byte prev_data = prev_p[-1] ^ invert;
+ int rlen;
+
+ /* Find the a1 and b1 transitions. */
+ skip_white_pixels(data, p, count, invert, rlen);
+ a1 = count;
+ if ((prev_data & count_bit[prev_count & 7])) {
+ /* Look for changing white first. */
+ skip_black_pixels(prev_data, prev_p, prev_count, invert, rlen);
+ }
+ count_bit = further_count_bit; /* no longer at beginning */
pass:
- if (prev_count != end_count)
- skip_white_pixels(prev_data, prev_p, prev_count, invert, rlen);
- diff = a1 - prev_count; /* i.e., logical b1 - a1 */
- /* In all the comparisons below, remember that count */
- /* runs downward, not upward, so the comparisons are */
- /* reversed. */
- if (diff <= -2) {
- /* Could be a pass mode. Find b2. */
- if (prev_count != end_count)
- skip_black_pixels(prev_data, prev_p,
- prev_count, invert, rlen);
- if (prev_count > a1) {
- /* Use pass mode. */
- if_debug4('W', "[W]pass: count = %d, a1 = %d, b1 = %d, new count = %d\n",
- a0, a1, b1, prev_count);
- hc_put_value(ss, q, cf2_run_pass_value, cf2_run_pass_length);
- a0 = prev_count;
- goto pass;
- }
- }
- /* Check for vertical coding. */
- if (diff <= 3 && diff >= -3) {
- /* Use vertical coding. */
- const cfe_run *cp = &cf2_run_vertical[diff + 3];
-
- if_debug5('W', "[W]vertical %d: count = %d, a1 = %d, b1 = %d, new count = %d\n",
- diff, a0, a1, b1, count);
- hc_put_code(ss, q, cp);
- invert = ~invert; /* a1 polarity changes */
- data ^= 0xff;
- continue;
- }
- /* No luck, use horizontal coding. */
- if (count != end_count)
- skip_black_pixels(data, p, count, invert, rlen); /* find a2 */
- hc_put_value(ss, q, cf2_run_horizontal_value,
- cf2_run_horizontal_length);
- a0 -= a1;
- a1 -= count;
- if (invert == invert_white) {
- if_debug3('W', "[W]horizontal: white = %d, black = %d, new count = %d\n",
- a0, a1, count);
- CF_PUT_WHITE_RUN(ss, a0);
- CF_PUT_BLACK_RUN(ss, a1);
- } else {
- if_debug3('W', "[W]horizontal: black = %d, white = %d, new count = %d\n",
- a0, a1, count);
- CF_PUT_BLACK_RUN(ss, a0);
- CF_PUT_WHITE_RUN(ss, a1);
+ if (prev_count != end_count)
+ skip_white_pixels(prev_data, prev_p, prev_count, invert, rlen);
+ diff = a1 - prev_count; /* i.e., logical b1 - a1 */
+ /* In all the comparisons below, remember that count */
+ /* runs downward, not upward, so the comparisons are */
+ /* reversed. */
+ if (diff <= -2) {
+ /* Could be a pass mode. Find b2. */
+ if (prev_count != end_count)
+ skip_black_pixels(prev_data, prev_p,
+ prev_count, invert, rlen);
+ if (prev_count > a1) {
+ /* Use pass mode. */
+ if_debug4('W', "[W]pass: count = %d, a1 = %d, b1 = %d, new count = %d\n",
+ a0, a1, b1, prev_count);
+ hc_put_value(ss, q, cf2_run_pass_value, cf2_run_pass_length);
+ a0 = prev_count;
+ goto pass;
+ }
+ }
+ /* Check for vertical coding. */
+ if (diff <= 3 && diff >= -3) {
+ /* Use vertical coding. */
+ const cfe_run *cp = &cf2_run_vertical[diff + 3];
+
+ if_debug5('W', "[W]vertical %d: count = %d, a1 = %d, b1 = %d, new count = %d\n",
+ diff, a0, a1, b1, count);
+ hc_put_code(ss, q, cp);
+ invert = ~invert; /* a1 polarity changes */
+ data ^= 0xff;
+ continue;
+ }
+ /* No luck, use horizontal coding. */
+ if (count != end_count)
+ skip_black_pixels(data, p, count, invert, rlen); /* find a2 */
+ hc_put_value(ss, q, cf2_run_horizontal_value,
+ cf2_run_horizontal_length);
+ a0 -= a1;
+ a1 -= count;
+ if (invert == invert_white) {
+ if_debug3('W', "[W]horizontal: white = %d, black = %d, new count = %d\n",
+ a0, a1, count);
+ CF_PUT_WHITE_RUN(ss, a0);
+ CF_PUT_BLACK_RUN(ss, a1);
+ } else {
+ if_debug3('W', "[W]horizontal: black = %d, white = %d, new count = %d\n",
+ a0, a1, count);
+ CF_PUT_BLACK_RUN(ss, a0);
+ CF_PUT_WHITE_RUN(ss, a1);
#undef b1
- }
+ }
}
hce_store_state();
pw->ptr = q;
diff --git a/gs/base/scfetab.c b/gs/base/scfetab.c
index abd0bcc8b..927e4f376 100644
--- a/gs/base/scfetab.c
+++ b/gs/base/scfetab.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,35 +63,35 @@ RUN((run_eol_code_value << 1) + 0, run_eol_code_length + 1);
const cf_runs cf_white_runs =
{
{ /* Termination codes */
- RUN(0x35, 8), RUN(0x7, 6), RUN(0x7, 4), RUN(0x8, 4),
- RUN(0xb, 4), RUN(0xc, 4), RUN(0xe, 4), RUN(0xf, 4),
- RUN(0x13, 5), RUN(0x14, 5), RUN(0x7, 5), RUN(0x8, 5),
- RUN(0x8, 6), RUN(0x3, 6), RUN(0x34, 6), RUN(0x35, 6),
- RUN(0x2a, 6), RUN(0x2b, 6), RUN(0x27, 7), RUN(0xc, 7),
- RUN(0x8, 7), RUN(0x17, 7), RUN(0x3, 7), RUN(0x4, 7),
- RUN(0x28, 7), RUN(0x2b, 7), RUN(0x13, 7), RUN(0x24, 7),
- RUN(0x18, 7), RUN(0x2, 8), RUN(0x3, 8), RUN(0x1a, 8),
- RUN(0x1b, 8), RUN(0x12, 8), RUN(0x13, 8), RUN(0x14, 8),
- RUN(0x15, 8), RUN(0x16, 8), RUN(0x17, 8), RUN(0x28, 8),
- RUN(0x29, 8), RUN(0x2a, 8), RUN(0x2b, 8), RUN(0x2c, 8),
- RUN(0x2d, 8), RUN(0x4, 8), RUN(0x5, 8), RUN(0xa, 8),
- RUN(0xb, 8), RUN(0x52, 8), RUN(0x53, 8), RUN(0x54, 8),
- RUN(0x55, 8), RUN(0x24, 8), RUN(0x25, 8), RUN(0x58, 8),
- RUN(0x59, 8), RUN(0x5a, 8), RUN(0x5b, 8), RUN(0x4a, 8),
- RUN(0x4b, 8), RUN(0x32, 8), RUN(0x33, 8), RUN(0x34, 8)
+ RUN(0x35, 8), RUN(0x7, 6), RUN(0x7, 4), RUN(0x8, 4),
+ RUN(0xb, 4), RUN(0xc, 4), RUN(0xe, 4), RUN(0xf, 4),
+ RUN(0x13, 5), RUN(0x14, 5), RUN(0x7, 5), RUN(0x8, 5),
+ RUN(0x8, 6), RUN(0x3, 6), RUN(0x34, 6), RUN(0x35, 6),
+ RUN(0x2a, 6), RUN(0x2b, 6), RUN(0x27, 7), RUN(0xc, 7),
+ RUN(0x8, 7), RUN(0x17, 7), RUN(0x3, 7), RUN(0x4, 7),
+ RUN(0x28, 7), RUN(0x2b, 7), RUN(0x13, 7), RUN(0x24, 7),
+ RUN(0x18, 7), RUN(0x2, 8), RUN(0x3, 8), RUN(0x1a, 8),
+ RUN(0x1b, 8), RUN(0x12, 8), RUN(0x13, 8), RUN(0x14, 8),
+ RUN(0x15, 8), RUN(0x16, 8), RUN(0x17, 8), RUN(0x28, 8),
+ RUN(0x29, 8), RUN(0x2a, 8), RUN(0x2b, 8), RUN(0x2c, 8),
+ RUN(0x2d, 8), RUN(0x4, 8), RUN(0x5, 8), RUN(0xa, 8),
+ RUN(0xb, 8), RUN(0x52, 8), RUN(0x53, 8), RUN(0x54, 8),
+ RUN(0x55, 8), RUN(0x24, 8), RUN(0x25, 8), RUN(0x58, 8),
+ RUN(0x59, 8), RUN(0x5a, 8), RUN(0x5b, 8), RUN(0x4a, 8),
+ RUN(0x4b, 8), RUN(0x32, 8), RUN(0x33, 8), RUN(0x34, 8)
},
{ /* Make-up codes */
- RUN(0, 0) /* dummy */ , RUN(0x1b, 5), RUN(0x12, 5), RUN(0x17, 6),
- RUN(0x37, 7), RUN(0x36, 8), RUN(0x37, 8), RUN(0x64, 8),
- RUN(0x65, 8), RUN(0x68, 8), RUN(0x67, 8), RUN(0xcc, 9),
- RUN(0xcd, 9), RUN(0xd2, 9), RUN(0xd3, 9), RUN(0xd4, 9),
- RUN(0xd5, 9), RUN(0xd6, 9), RUN(0xd7, 9), RUN(0xd8, 9),
- RUN(0xd9, 9), RUN(0xda, 9), RUN(0xdb, 9), RUN(0x98, 9),
- RUN(0x99, 9), RUN(0x9a, 9), RUN(0x18, 6), RUN(0x9b, 9),
- RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12),
- RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12),
- RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12),
- RUN(0x1f, 12)
+ RUN(0, 0) /* dummy */ , RUN(0x1b, 5), RUN(0x12, 5), RUN(0x17, 6),
+ RUN(0x37, 7), RUN(0x36, 8), RUN(0x37, 8), RUN(0x64, 8),
+ RUN(0x65, 8), RUN(0x68, 8), RUN(0x67, 8), RUN(0xcc, 9),
+ RUN(0xcd, 9), RUN(0xd2, 9), RUN(0xd3, 9), RUN(0xd4, 9),
+ RUN(0xd5, 9), RUN(0xd6, 9), RUN(0xd7, 9), RUN(0xd8, 9),
+ RUN(0xd9, 9), RUN(0xda, 9), RUN(0xdb, 9), RUN(0x98, 9),
+ RUN(0x99, 9), RUN(0x9a, 9), RUN(0x18, 6), RUN(0x9b, 9),
+ RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12),
+ RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12),
+ RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12),
+ RUN(0x1f, 12)
}
};
@@ -99,35 +99,35 @@ const cf_runs cf_white_runs =
const cf_runs cf_black_runs =
{
{ /* Termination codes */
- RUN(0x37, 10), RUN(0x2, 3), RUN(0x3, 2), RUN(0x2, 2),
- RUN(0x3, 3), RUN(0x3, 4), RUN(0x2, 4), RUN(0x3, 5),
- RUN(0x5, 6), RUN(0x4, 6), RUN(0x4, 7), RUN(0x5, 7),
- RUN(0x7, 7), RUN(0x4, 8), RUN(0x7, 8), RUN(0x18, 9),
- RUN(0x17, 10), RUN(0x18, 10), RUN(0x8, 10), RUN(0x67, 11),
- RUN(0x68, 11), RUN(0x6c, 11), RUN(0x37, 11), RUN(0x28, 11),
- RUN(0x17, 11), RUN(0x18, 11), RUN(0xca, 12), RUN(0xcb, 12),
- RUN(0xcc, 12), RUN(0xcd, 12), RUN(0x68, 12), RUN(0x69, 12),
- RUN(0x6a, 12), RUN(0x6b, 12), RUN(0xd2, 12), RUN(0xd3, 12),
- RUN(0xd4, 12), RUN(0xd5, 12), RUN(0xd6, 12), RUN(0xd7, 12),
- RUN(0x6c, 12), RUN(0x6d, 12), RUN(0xda, 12), RUN(0xdb, 12),
- RUN(0x54, 12), RUN(0x55, 12), RUN(0x56, 12), RUN(0x57, 12),
- RUN(0x64, 12), RUN(0x65, 12), RUN(0x52, 12), RUN(0x53, 12),
- RUN(0x24, 12), RUN(0x37, 12), RUN(0x38, 12), RUN(0x27, 12),
- RUN(0x28, 12), RUN(0x58, 12), RUN(0x59, 12), RUN(0x2b, 12),
- RUN(0x2c, 12), RUN(0x5a, 12), RUN(0x66, 12), RUN(0x67, 12)
+ RUN(0x37, 10), RUN(0x2, 3), RUN(0x3, 2), RUN(0x2, 2),
+ RUN(0x3, 3), RUN(0x3, 4), RUN(0x2, 4), RUN(0x3, 5),
+ RUN(0x5, 6), RUN(0x4, 6), RUN(0x4, 7), RUN(0x5, 7),
+ RUN(0x7, 7), RUN(0x4, 8), RUN(0x7, 8), RUN(0x18, 9),
+ RUN(0x17, 10), RUN(0x18, 10), RUN(0x8, 10), RUN(0x67, 11),
+ RUN(0x68, 11), RUN(0x6c, 11), RUN(0x37, 11), RUN(0x28, 11),
+ RUN(0x17, 11), RUN(0x18, 11), RUN(0xca, 12), RUN(0xcb, 12),
+ RUN(0xcc, 12), RUN(0xcd, 12), RUN(0x68, 12), RUN(0x69, 12),
+ RUN(0x6a, 12), RUN(0x6b, 12), RUN(0xd2, 12), RUN(0xd3, 12),
+ RUN(0xd4, 12), RUN(0xd5, 12), RUN(0xd6, 12), RUN(0xd7, 12),
+ RUN(0x6c, 12), RUN(0x6d, 12), RUN(0xda, 12), RUN(0xdb, 12),
+ RUN(0x54, 12), RUN(0x55, 12), RUN(0x56, 12), RUN(0x57, 12),
+ RUN(0x64, 12), RUN(0x65, 12), RUN(0x52, 12), RUN(0x53, 12),
+ RUN(0x24, 12), RUN(0x37, 12), RUN(0x38, 12), RUN(0x27, 12),
+ RUN(0x28, 12), RUN(0x58, 12), RUN(0x59, 12), RUN(0x2b, 12),
+ RUN(0x2c, 12), RUN(0x5a, 12), RUN(0x66, 12), RUN(0x67, 12)
},
{ /* Make-up codes. */
- RUN(0, 0) /* dummy */ , RUN(0xf, 10), RUN(0xc8, 12), RUN(0xc9, 12),
- RUN(0x5b, 12), RUN(0x33, 12), RUN(0x34, 12), RUN(0x35, 12),
- RUN(0x6c, 13), RUN(0x6d, 13), RUN(0x4a, 13), RUN(0x4b, 13),
- RUN(0x4c, 13), RUN(0x4d, 13), RUN(0x72, 13), RUN(0x73, 13),
- RUN(0x74, 13), RUN(0x75, 13), RUN(0x76, 13), RUN(0x77, 13),
- RUN(0x52, 13), RUN(0x53, 13), RUN(0x54, 13), RUN(0x55, 13),
- RUN(0x5a, 13), RUN(0x5b, 13), RUN(0x64, 13), RUN(0x65, 13),
- RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12),
- RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12),
- RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12),
- RUN(0x1f, 12)
+ RUN(0, 0) /* dummy */ , RUN(0xf, 10), RUN(0xc8, 12), RUN(0xc9, 12),
+ RUN(0x5b, 12), RUN(0x33, 12), RUN(0x34, 12), RUN(0x35, 12),
+ RUN(0x6c, 13), RUN(0x6d, 13), RUN(0x4a, 13), RUN(0x4b, 13),
+ RUN(0x4c, 13), RUN(0x4d, 13), RUN(0x72, 13), RUN(0x73, 13),
+ RUN(0x74, 13), RUN(0x75, 13), RUN(0x76, 13), RUN(0x77, 13),
+ RUN(0x52, 13), RUN(0x53, 13), RUN(0x54, 13), RUN(0x55, 13),
+ RUN(0x5a, 13), RUN(0x5b, 13), RUN(0x64, 13), RUN(0x65, 13),
+ RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12),
+ RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12),
+ RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12),
+ RUN(0x1f, 12)
}
};
diff --git a/gs/base/scfparam.c b/gs/base/scfparam.c
index 925d43146..580910c77 100644
--- a/gs/base/scfparam.c
+++ b/gs/base/scfparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,10 +54,10 @@ s_CF_get_params(gs_param_list * plist, const stream_CF_state * ss, bool all)
const stream_CF_state *defaults;
if (all)
- defaults = 0;
+ defaults = 0;
else {
- s_CF_set_defaults_inline(&cfs_defaults);
- defaults = &cfs_defaults;
+ s_CF_set_defaults_inline(&cfs_defaults);
+ defaults = &cfs_defaults;
}
return gs_param_write_items(plist, ss, defaults, s_CF_param_items);
}
@@ -73,16 +73,16 @@ s_CF_put_params(gs_param_list * plist, stream_CF_state * ss)
state = *ss;
code = gs_param_read_items(plist, (void *)&state, s_CF_param_items);
if (code >= 0 &&
- (state.K < -cf_max_height || state.K > cf_max_height ||
- state.Columns < 0 || state.Columns > cfe_max_width ||
- state.Rows < 0 || state.Rows > cf_max_height ||
- state.DamagedRowsBeforeError < 0 ||
- state.DamagedRowsBeforeError > cf_max_height ||
- state.DecodedByteAlign < 1 || state.DecodedByteAlign > 16 ||
- (state.DecodedByteAlign & (state.DecodedByteAlign - 1)) != 0)
- )
- code = gs_note_error(gs_error_rangecheck);
+ (state.K < -cf_max_height || state.K > cf_max_height ||
+ state.Columns < 0 || state.Columns > cfe_max_width ||
+ state.Rows < 0 || state.Rows > cf_max_height ||
+ state.DamagedRowsBeforeError < 0 ||
+ state.DamagedRowsBeforeError > cf_max_height ||
+ state.DecodedByteAlign < 1 || state.DecodedByteAlign > 16 ||
+ (state.DecodedByteAlign & (state.DecodedByteAlign - 1)) != 0)
+ )
+ code = gs_note_error(gs_error_rangecheck);
if (code >= 0)
- *ss = state;
+ *ss = state;
return code;
}
diff --git a/gs/base/scfx.h b/gs/base/scfx.h
index d830d6d6d..e350521a9 100644
--- a/gs/base/scfx.h
+++ b/gs/base/scfx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,27 +22,27 @@
/* Common state */
#define stream_CF_state_common\
- stream_hc_state_common;\
- /* The client sets the following before initialization. */\
- bool Uncompressed;\
- int K;\
- bool EndOfLine;\
- bool EncodedByteAlign;\
- int Columns;\
- int Rows;\
- bool EndOfBlock;\
- bool BlackIs1;\
- int DamagedRowsBeforeError; /* (Decode only) */\
- /*bool FirstBitLowOrder;*/ /* in stream_hc_state_common */\
- int DecodedByteAlign;\
- /* The init procedure sets the following. */\
- uint raster;\
- byte *lbuf; /* current scan line buffer */\
- /* (only if decoding or 2-D encoding) */\
- byte *lprev; /* previous scan line buffer (only if 2-D) */\
- /* The following are updated dynamically. */\
- int k_left /* number of next rows to encode in 2-D */\
- /* (only if K > 0) */
+ stream_hc_state_common;\
+ /* The client sets the following before initialization. */\
+ bool Uncompressed;\
+ int K;\
+ bool EndOfLine;\
+ bool EncodedByteAlign;\
+ int Columns;\
+ int Rows;\
+ bool EndOfBlock;\
+ bool BlackIs1;\
+ int DamagedRowsBeforeError; /* (Decode only) */\
+ /*bool FirstBitLowOrder;*/ /* in stream_hc_state_common */\
+ int DecodedByteAlign;\
+ /* The init procedure sets the following. */\
+ uint raster;\
+ byte *lbuf; /* current scan line buffer */\
+ /* (only if decoding or 2-D encoding) */\
+ byte *lprev; /* previous scan line buffer (only if 2-D) */\
+ /* The following are updated dynamically. */\
+ int k_left /* number of next rows to encode in 2-D */\
+ /* (only if K > 0) */
typedef struct stream_CF_state_s {
stream_CF_state_common;
} stream_CF_state;
@@ -57,12 +57,12 @@ typedef struct stream_CF_state_s {
(ss)->Rows = 0,\
(ss)->EndOfBlock = true,\
(ss)->BlackIs1 = false,\
- /* Added by Adobe since the Red Book */\
+ /* Added by Adobe since the Red Book */\
(ss)->DamagedRowsBeforeError = 0, /* always set, for s_CF_get_params */\
(ss)->FirstBitLowOrder = false,\
- /* Added by us */\
+ /* Added by us */\
(ss)->DecodedByteAlign = 1,\
- /* Clear pointers */\
+ /* Clear pointers */\
(ss)->lbuf = 0, (ss)->lprev = 0,\
/* Clear errors */\
(ss)->error_string[0] = 0)
@@ -90,29 +90,29 @@ extern const stream_template s_CFE_template;
typedef struct stream_CFD_state_s {
stream_CF_state_common;
int cbit; /* bits left to fill in current decoded
- byte at lbuf[wpos] (0..7) */
+ byte at lbuf[wpos] (0..7) */
int rows_left; /* number of rows left */
int row; /* current row, first is 0 */
int rpos; /* rptr for copying lbuf to client */
int wpos; /* rlimit/wptr for filling lbuf or
- copying to client */
+ copying to client */
int eol_count; /* number of EOLs seen so far */
byte invert; /* current value of 'white' for 2-D decoding */
int run_color; /* -1 if processing white run,
- 0 if between runs but white is next,
- 1 if between runs and black is next,
- 2 if processing black run */
+ 0 if between runs but white is next,
+ 1 if between runs and black is next,
+ 2 if processing black run */
int damaged_rows; /* # of consecutive damaged rows preceding
- the current row */
+ the current row */
bool skipping_damage; /* true if skipping a damaged row looking
- for EOL */
+ for EOL */
/* The following are not used yet. */
int uncomp_run; /* non-0 iff we are in an uncompressed
- run straddling a scan line (-1 if white,
- 1 if black) */
+ run straddling a scan line (-1 if white,
+ 1 if black) */
int uncomp_left; /* # of bits left in the run */
int uncomp_exit; /* non-0 iff this is an exit run
- (-1 if next run white, 1 if black) */
+ (-1 if next run white, 1 if black) */
} stream_CFD_state;
#define private_st_CFD_state() /* in scfd.c */\
diff --git a/gs/base/scommon.h b/gs/base/scommon.h
index 21b5465b8..4c2eafed7 100644
--- a/gs/base/scommon.h
+++ b/gs/base/scommon.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -157,11 +157,11 @@ stream_proc_report_error(s_no_report_error);
*/
#define STREAM_MAX_ERROR_STRING 79
#define stream_state_common\
- const stream_template *template;\
- gs_memory_t *memory;\
- stream_proc_report_error((*report_error));\
+ const stream_template *template;\
+ gs_memory_t *memory;\
+ stream_proc_report_error((*report_error));\
int min_left; /* required bytes for lookahead */ \
- char error_string[STREAM_MAX_ERROR_STRING + 1]
+ char error_string[STREAM_MAX_ERROR_STRING + 1]
struct stream_state_s {
stream_state_common;
};
diff --git a/gs/base/sdcparam.c b/gs/base/sdcparam.c
index 3ab3a59b1..ec9f9f4e0 100644
--- a/gs/base/sdcparam.c
+++ b/gs/base/sdcparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,7 +48,7 @@ static const gs_param_item_t jsd_param_items[] =
* to natural array order. Older IJG versions want zigzag order.
*/
#if JPEG_LIB_VERSION >= 61
- /* natural array position of n'th element of JPEG zigzag order */
+ /* natural array position of n'th element of JPEG zigzag order */
static const byte natural_order[DCTSIZE2] =
{
0, 1, 8, 16, 9, 2, 3, 10,
@@ -62,7 +62,7 @@ static const byte natural_order[DCTSIZE2] =
};
#define jpeg_order(x) natural_order[x]
- /* invert natural_order for getting parameters */
+ /* invert natural_order for getting parameters */
static const byte inverse_natural_order[DCTSIZE2] =
{
0, 1, 5, 6, 14, 15, 27, 28,
@@ -85,7 +85,7 @@ static const byte inverse_natural_order[DCTSIZE2] =
static int
quant_param_string(gs_param_string * pstr, int count, const UINT16 * pvals,
- floatp QFactor, gs_memory_t * mem)
+ floatp QFactor, gs_memory_t * mem)
{
byte *data;
int code = 0;
@@ -93,12 +93,12 @@ quant_param_string(gs_param_string * pstr, int count, const UINT16 * pvals,
data = gs_alloc_string(mem, count, "quant_param_string");
if (data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < count; ++i) {
- floatp val = pvals[jpeg_inverse_order(i)] / QFactor;
+ floatp val = pvals[jpeg_inverse_order(i)] / QFactor;
- data[i] =
- (val < 1 ? (code = 1) : val > 255 ? (code = 255) : (byte) val);
+ data[i] =
+ (val < 1 ? (code = 1) : val > 255 ? (code = 255) : (byte) val);
}
pstr->data = data;
pstr->size = count;
@@ -108,18 +108,18 @@ quant_param_string(gs_param_string * pstr, int count, const UINT16 * pvals,
static int
quant_param_array(gs_param_float_array * pfa, int count, const UINT16 * pvals,
- floatp QFactor, gs_memory_t * mem)
+ floatp QFactor, gs_memory_t * mem)
{
float *data;
int i;
data = (float *)gs_alloc_byte_array(mem, count, sizeof(float),
- "quant_param_array");
+ "quant_param_array");
if (data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < count; ++i)
- data[i] = pvals[jpeg_inverse_order(i)] / QFactor;
+ data[i] = pvals[jpeg_inverse_order(i)] / QFactor;
pfa->data = data;
pfa->size = count;
pfa->persistent = true;
@@ -128,8 +128,8 @@ quant_param_array(gs_param_float_array * pfa, int count, const UINT16 * pvals,
int
s_DCT_get_quantization_tables(gs_param_list * plist,
- const stream_DCT_state * pdct, const stream_DCT_state * defaults,
- bool is_encode)
+ const stream_DCT_state * pdct, const stream_DCT_state * defaults,
+ bool is_encode)
{
gs_memory_t *mem = pdct->memory;
jpeg_component_info d_comp_info[4];
@@ -144,105 +144,105 @@ s_DCT_get_quantization_tables(gs_param_list * plist,
int code;
if (is_encode) {
- num_in_tables = pdct->data.compress->cinfo.num_components;
- comp_info = pdct->data.compress->cinfo.comp_info;
- table_ptrs = pdct->data.compress->cinfo.quant_tbl_ptrs;
- if (defaults) {
- default_comp_info = defaults->data.compress->cinfo.comp_info;
- default_table_ptrs = defaults->data.compress->cinfo.quant_tbl_ptrs;
- }
+ num_in_tables = pdct->data.compress->cinfo.num_components;
+ comp_info = pdct->data.compress->cinfo.comp_info;
+ table_ptrs = pdct->data.compress->cinfo.quant_tbl_ptrs;
+ if (defaults) {
+ default_comp_info = defaults->data.compress->cinfo.comp_info;
+ default_table_ptrs = defaults->data.compress->cinfo.quant_tbl_ptrs;
+ }
} else {
- quant_tables.size = count_of(d_comp_info);
- num_in_tables = quant_tables.size;
- for (i = 0; i < num_in_tables; ++i)
- d_comp_info[i].quant_tbl_no = i;
- comp_info = d_comp_info;
- table_ptrs = pdct->data.decompress->dinfo.quant_tbl_ptrs;
- if (defaults) {
- default_comp_info = d_comp_info;
- default_table_ptrs =
- defaults->data.decompress->dinfo.quant_tbl_ptrs;
- }
+ quant_tables.size = count_of(d_comp_info);
+ num_in_tables = quant_tables.size;
+ for (i = 0; i < num_in_tables; ++i)
+ d_comp_info[i].quant_tbl_no = i;
+ comp_info = d_comp_info;
+ table_ptrs = pdct->data.decompress->dinfo.quant_tbl_ptrs;
+ if (defaults) {
+ default_comp_info = d_comp_info;
+ default_table_ptrs =
+ defaults->data.decompress->dinfo.quant_tbl_ptrs;
+ }
}
/* Check whether all tables match defaults. */
if (defaults) {
- bool match = true;
-
- for (i = 0; i < num_in_tables; ++i) {
- JQUANT_TBL *tbl = table_ptrs[comp_info[i].quant_tbl_no];
- JQUANT_TBL *default_tbl =
- (default_comp_info == 0 || default_table_ptrs == 0 ? 0 :
- default_table_ptrs[default_comp_info[i].quant_tbl_no]);
-
- if (tbl == default_tbl)
- continue;
- if (tbl == 0 || default_tbl == 0 ||
- memcmp(tbl->quantval, default_tbl->quantval,
- DCTSIZE2 * sizeof(UINT16))
- ) {
- match = false;
- break;
- }
- }
- if (match)
- return 0;
+ bool match = true;
+
+ for (i = 0; i < num_in_tables; ++i) {
+ JQUANT_TBL *tbl = table_ptrs[comp_info[i].quant_tbl_no];
+ JQUANT_TBL *default_tbl =
+ (default_comp_info == 0 || default_table_ptrs == 0 ? 0 :
+ default_table_ptrs[default_comp_info[i].quant_tbl_no]);
+
+ if (tbl == default_tbl)
+ continue;
+ if (tbl == 0 || default_tbl == 0 ||
+ memcmp(tbl->quantval, default_tbl->quantval,
+ DCTSIZE2 * sizeof(UINT16))
+ ) {
+ match = false;
+ break;
+ }
+ }
+ if (match)
+ return 0;
}
quant_tables.size = num_in_tables;
code = param_begin_write_collection(plist, "QuantTables",
- &quant_tables,
- gs_param_collection_array);
+ &quant_tables,
+ gs_param_collection_array);
if (code < 0)
- return code;
+ return code;
for (i = 0; i < num_in_tables; ++i) {
- char key[3];
- gs_param_string str;
- gs_param_float_array fa;
-
- sprintf(key, "%d", i);
- if (QFactor == 1.0) {
- code = quant_param_string(&str, DCTSIZE2,
- table_ptrs[comp_info[i].quant_tbl_no]->quantval,
- QFactor, mem);
- switch (code) {
- case 0:
- code = param_write_string(quant_tables.list, key, &str);
- if (code < 0)
- return code; /* should dealloc */
- continue;
- default:
- return code; /* should dealloc */
- case 1:
- break;
- }
- gs_free_const_string(mem, str.data, str.size,
- "quant_param_string");
- }
- code = quant_param_array(&fa, DCTSIZE2,
- table_ptrs[comp_info[i].quant_tbl_no]->quantval,
- QFactor, mem);
- if (code < 0)
- return code; /* should dealloc */
- code = param_write_float_array(quant_tables.list, key, &fa);
- if (code < 0)
- return code; /* should dealloc */
+ char key[3];
+ gs_param_string str;
+ gs_param_float_array fa;
+
+ sprintf(key, "%d", i);
+ if (QFactor == 1.0) {
+ code = quant_param_string(&str, DCTSIZE2,
+ table_ptrs[comp_info[i].quant_tbl_no]->quantval,
+ QFactor, mem);
+ switch (code) {
+ case 0:
+ code = param_write_string(quant_tables.list, key, &str);
+ if (code < 0)
+ return code; /* should dealloc */
+ continue;
+ default:
+ return code; /* should dealloc */
+ case 1:
+ break;
+ }
+ gs_free_const_string(mem, str.data, str.size,
+ "quant_param_string");
+ }
+ code = quant_param_array(&fa, DCTSIZE2,
+ table_ptrs[comp_info[i].quant_tbl_no]->quantval,
+ QFactor, mem);
+ if (code < 0)
+ return code; /* should dealloc */
+ code = param_write_float_array(quant_tables.list, key, &fa);
+ if (code < 0)
+ return code; /* should dealloc */
}
return param_end_write_dict(plist, "QuantTables", &quant_tables);
}
static int
pack_huff_table(gs_param_string * pstr, const JHUFF_TBL * table,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
int total;
int i;
byte *data;
for (i = 1, total = 0; i <= 16; ++i)
- total += table->bits[i];
+ total += table->bits[i];
data = gs_alloc_string(mem, 16 + total, "pack_huff_table");
if (data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memcpy(data, table->bits + 1, 16);
memcpy(data + 16, table->huffval, total);
pstr->data = data;
@@ -253,8 +253,8 @@ pack_huff_table(gs_param_string * pstr, const JHUFF_TBL * table,
int
s_DCT_get_huffman_tables(gs_param_list * plist,
- const stream_DCT_state * pdct, const stream_DCT_state * defaults,
- bool is_encode)
+ const stream_DCT_state * pdct, const stream_DCT_state * defaults,
+ bool is_encode)
{
gs_memory_t *mem = pdct->memory;
gs_param_string *huff_data;
@@ -267,33 +267,33 @@ s_DCT_get_huffman_tables(gs_param_list * plist,
int code = 0;
if (is_encode) {
- dc_table_ptrs = pdct->data.compress->cinfo.dc_huff_tbl_ptrs;
- ac_table_ptrs = pdct->data.compress->cinfo.ac_huff_tbl_ptrs;
- num_in_tables = pdct->data.compress->cinfo.input_components * 2;
- comp_info = pdct->data.compress->cinfo.comp_info;
+ dc_table_ptrs = pdct->data.compress->cinfo.dc_huff_tbl_ptrs;
+ ac_table_ptrs = pdct->data.compress->cinfo.ac_huff_tbl_ptrs;
+ num_in_tables = pdct->data.compress->cinfo.input_components * 2;
+ comp_info = pdct->data.compress->cinfo.comp_info;
} else {
- dc_table_ptrs = pdct->data.decompress->dinfo.dc_huff_tbl_ptrs;
- ac_table_ptrs = pdct->data.decompress->dinfo.ac_huff_tbl_ptrs;
- for (i = 2; i > 0; --i)
- if (dc_table_ptrs[i - 1] || ac_table_ptrs[i - 1])
- break;
- num_in_tables = i * 2;
- comp_info = NULL; /* do not set for decompress case */
+ dc_table_ptrs = pdct->data.decompress->dinfo.dc_huff_tbl_ptrs;
+ ac_table_ptrs = pdct->data.decompress->dinfo.ac_huff_tbl_ptrs;
+ for (i = 2; i > 0; --i)
+ if (dc_table_ptrs[i - 1] || ac_table_ptrs[i - 1])
+ break;
+ num_in_tables = i * 2;
+ comp_info = NULL; /* do not set for decompress case */
}
/****** byte_array IS WRONG ******/
huff_data = (gs_param_string *)
- gs_alloc_byte_array(mem, num_in_tables, sizeof(gs_param_string),
- "get huffman tables");
+ gs_alloc_byte_array(mem, num_in_tables, sizeof(gs_param_string),
+ "get huffman tables");
if (huff_data == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < num_in_tables; i += 2) {
- if ((code = pack_huff_table(huff_data + i, ac_table_ptrs[i >> 1], mem)) < 0 ||
- (code = pack_huff_table(huff_data + i + 1, dc_table_ptrs[i >> 1], mem))
- )
- break;
+ if ((code = pack_huff_table(huff_data + i, ac_table_ptrs[i >> 1], mem)) < 0 ||
+ (code = pack_huff_table(huff_data + i + 1, dc_table_ptrs[i >> 1], mem))
+ )
+ break;
}
if (code < 0)
- return code;
+ return code;
hta.data = huff_data;
hta.size = num_in_tables;
hta.persistent = true;
@@ -302,16 +302,16 @@ s_DCT_get_huffman_tables(gs_param_list * plist,
int
s_DCT_get_params(gs_param_list * plist, const stream_DCT_state * ss,
- const stream_DCT_state * defaults)
+ const stream_DCT_state * defaults)
{
int code =
gs_param_write_items(plist, ss, defaults, s_DCT_param_items);
if (code >= 0)
- code = gs_param_write_items(plist, ss->data.common,
- (defaults ? defaults->data.common :
- NULL),
- jsd_param_items);
+ code = gs_param_write_items(plist, ss->data.common,
+ (defaults ? defaults->data.common :
+ NULL),
+ jsd_param_items);
return code;
}
@@ -327,7 +327,7 @@ stream_state_proc_put_params(s_DCT_put_params, stream_DCT_state); /* check */
*/
int
s_DCT_byte_params(gs_param_list * plist, gs_param_name key, int start,
- int count, UINT8 * pvals)
+ int count, UINT8 * pvals)
{
int i;
gs_param_string bytes;
@@ -335,41 +335,41 @@ s_DCT_byte_params(gs_param_list * plist, gs_param_name key, int start,
int code = param_read_string(plist, key, &bytes);
switch (code) {
- case 0:
- if (bytes.size < start + count) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- for (i = 0; i < count; ++i)
- pvals[i] = (UINT8) bytes.data[start + i];
- return 0;
- default: /* might be a float array */
- code = param_read_float_array(plist, key, &floats);
- if (!code) {
- if (floats.size < start + count) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- for (i = 0; i < count; ++i) {
- float v = floats.data[start + i];
-
- if (v < 0 || v > 255) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- pvals[i] = (UINT8) (v + 0.5);
- }
- }
+ case 0:
+ if (bytes.size < start + count) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ for (i = 0; i < count; ++i)
+ pvals[i] = (UINT8) bytes.data[start + i];
+ return 0;
+ default: /* might be a float array */
+ code = param_read_float_array(plist, key, &floats);
+ if (!code) {
+ if (floats.size < start + count) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ for (i = 0; i < count; ++i) {
+ float v = floats.data[start + i];
+
+ if (v < 0 || v > 255) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ pvals[i] = (UINT8) (v + 0.5);
+ }
+ }
}
if (code < 0)
- param_signal_error(plist, key, code);
+ param_signal_error(plist, key, code);
return code;
}
/* Get N quantization values from an array or a string. */
static int
quant_params(gs_param_list * plist, gs_param_name key, int count,
- UINT16 * pvals, floatp QFactor)
+ UINT16 * pvals, floatp QFactor)
{
int i;
gs_param_string bytes;
@@ -377,35 +377,35 @@ quant_params(gs_param_list * plist, gs_param_name key, int count,
int code = param_read_string(plist, key, &bytes);
switch (code) {
- case 0:
- if (bytes.size != count) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- for (i = 0; i < count; ++i) {
- double v = bytes.data[i] * QFactor;
-
- pvals[jpeg_order(i)] =
- (UINT16) (v < 1 ? 1 : v > 255 ? 255 : v + 0.5);
- }
- return 0;
- default: /* might be a float array */
- code = param_read_float_array(plist, key, &floats);
- if (!code) {
- if (floats.size != count) {
- code = gs_note_error(gs_error_rangecheck);
- break;
- }
- for (i = 0; i < count; ++i) {
- double v = floats.data[i] * QFactor;
-
- pvals[jpeg_order(i)] =
- (UINT16) (v < 1 ? 1 : v > 255 ? 255 : v + 0.5);
- }
- }
+ case 0:
+ if (bytes.size != count) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ for (i = 0; i < count; ++i) {
+ double v = bytes.data[i] * QFactor;
+
+ pvals[jpeg_order(i)] =
+ (UINT16) (v < 1 ? 1 : v > 255 ? 255 : v + 0.5);
+ }
+ return 0;
+ default: /* might be a float array */
+ code = param_read_float_array(plist, key, &floats);
+ if (!code) {
+ if (floats.size != count) {
+ code = gs_note_error(gs_error_rangecheck);
+ break;
+ }
+ for (i = 0; i < count; ++i) {
+ double v = floats.data[i] * QFactor;
+
+ pvals[jpeg_order(i)] =
+ (UINT16) (v < 1 ? 1 : v > 255 ? 255 : v + 0.5);
+ }
+ }
}
if (code < 0)
- param_signal_error(plist, key, code);
+ param_signal_error(plist, key, code);
return code;
#undef jpeg_order
}
@@ -420,23 +420,23 @@ s_DCT_put_params(gs_param_list * plist, stream_DCT_state * pdct)
gs_param_read_items(plist, pdct, s_DCT_param_items);
if (code < 0)
- return code;
+ return code;
code = gs_param_read_items(plist, pdct->data.common, jsd_param_items);
if (code < 0)
- return code;
+ return code;
if (pdct->data.common->Picky < 0 || pdct->data.common->Picky > 1 ||
- pdct->data.common->Relax < 0 || pdct->data.common->Relax > 1 ||
- pdct->ColorTransform < -1 || pdct->ColorTransform > 2 ||
- pdct->QFactor < 0.0 || pdct->QFactor > 1000000.0
- )
- return_error(gs_error_rangecheck);
+ pdct->data.common->Relax < 0 || pdct->data.common->Relax > 1 ||
+ pdct->ColorTransform < -1 || pdct->ColorTransform > 2 ||
+ pdct->QFactor < 0.0 || pdct->QFactor > 1000000.0
+ )
+ return_error(gs_error_rangecheck);
return 0;
}
/* Put quantization tables. */
int
s_DCT_put_quantization_tables(gs_param_list * plist, stream_DCT_state * pdct,
- bool is_encode)
+ bool is_encode)
{
int code;
int i, j;
@@ -448,55 +448,55 @@ s_DCT_put_quantization_tables(gs_param_list * plist, stream_DCT_state * pdct,
JQUANT_TBL *this_table;
switch ((code = param_begin_read_dict(plist, "QuantTables",
- &quant_tables, true))
- ) {
- case 1:
- return 1;
- default:
- return param_signal_error(plist, "QuantTables", code);
- case 0:
- ;
+ &quant_tables, true))
+ ) {
+ case 1:
+ return 1;
+ default:
+ return param_signal_error(plist, "QuantTables", code);
+ case 0:
+ ;
}
if (is_encode) {
- num_in_tables = pdct->data.compress->cinfo.num_components;
- if (quant_tables.size < num_in_tables)
- return_error(gs_error_rangecheck);
- comp_info = pdct->data.compress->cinfo.comp_info;
- table_ptrs = pdct->data.compress->cinfo.quant_tbl_ptrs;
+ num_in_tables = pdct->data.compress->cinfo.num_components;
+ if (quant_tables.size < num_in_tables)
+ return_error(gs_error_rangecheck);
+ comp_info = pdct->data.compress->cinfo.comp_info;
+ table_ptrs = pdct->data.compress->cinfo.quant_tbl_ptrs;
} else {
- num_in_tables = quant_tables.size;
- comp_info = NULL; /* do not set for decompress case */
- table_ptrs = pdct->data.decompress->dinfo.quant_tbl_ptrs;
+ num_in_tables = quant_tables.size;
+ comp_info = NULL; /* do not set for decompress case */
+ table_ptrs = pdct->data.decompress->dinfo.quant_tbl_ptrs;
}
num_out_tables = 0;
for (i = 0; i < num_in_tables; ++i) {
- char istr[5]; /* i converted to string key */
- UINT16 values[DCTSIZE2];
-
- sprintf(istr, "%d", i);
- code = quant_params(quant_tables.list, istr, DCTSIZE2, values,
- pdct->QFactor);
- if (code < 0)
- return code;
- /* Check for duplicate tables. */
- for (j = 0; j < num_out_tables; j++) {
- if (!memcmp(table_ptrs[j]->quantval, values, sizeof(values)))
- break;
- }
- if (comp_info != NULL)
- comp_info[i].quant_tbl_no = j;
- if (j < num_out_tables) /* found a duplicate */
- continue;
- if (++num_out_tables > NUM_QUANT_TBLS)
- return_error(gs_error_rangecheck);
- this_table = table_ptrs[j];
- if (this_table == NULL) {
- this_table = gs_jpeg_alloc_quant_table(pdct);
- if (this_table == NULL)
- return_error(gs_error_VMerror);
- table_ptrs[j] = this_table;
- }
- memcpy(this_table->quantval, values, sizeof(values));
+ char istr[5]; /* i converted to string key */
+ UINT16 values[DCTSIZE2];
+
+ sprintf(istr, "%d", i);
+ code = quant_params(quant_tables.list, istr, DCTSIZE2, values,
+ pdct->QFactor);
+ if (code < 0)
+ return code;
+ /* Check for duplicate tables. */
+ for (j = 0; j < num_out_tables; j++) {
+ if (!memcmp(table_ptrs[j]->quantval, values, sizeof(values)))
+ break;
+ }
+ if (comp_info != NULL)
+ comp_info[i].quant_tbl_no = j;
+ if (j < num_out_tables) /* found a duplicate */
+ continue;
+ if (++num_out_tables > NUM_QUANT_TBLS)
+ return_error(gs_error_rangecheck);
+ this_table = table_ptrs[j];
+ if (this_table == NULL) {
+ this_table = gs_jpeg_alloc_quant_table(pdct);
+ if (this_table == NULL)
+ return_error(gs_error_VMerror);
+ table_ptrs[j] = this_table;
+ }
+ memcpy(this_table->quantval, values, sizeof(values));
}
return 0;
}
@@ -504,20 +504,20 @@ s_DCT_put_quantization_tables(gs_param_list * plist, stream_DCT_state * pdct,
/* Put Huffman tables. */
static int
find_huff_values(JHUFF_TBL ** table_ptrs, int num_tables,
- const UINT8 counts[16], const UINT8 * values, int codes_size)
+ const UINT8 counts[16], const UINT8 * values, int codes_size)
{
int j;
for (j = 0; j < num_tables; ++j)
- if (!memcmp(table_ptrs[j]->bits, counts, sizeof(counts)) &&
- !memcmp(table_ptrs[j]->huffval, values,
- codes_size * sizeof(values[0])))
- break;
+ if (!memcmp(table_ptrs[j]->bits, counts, sizeof(counts)) &&
+ !memcmp(table_ptrs[j]->huffval, values,
+ codes_size * sizeof(values[0])))
+ break;
return j;
}
int
s_DCT_put_huffman_tables(gs_param_list * plist, stream_DCT_state * pdct,
- bool is_encode)
+ bool is_encode)
{
int code;
int i, j;
@@ -533,82 +533,82 @@ s_DCT_put_huffman_tables(gs_param_list * plist, stream_DCT_state * pdct,
int max_tables = 2; /* baseline limit */
switch ((code = param_begin_read_dict(plist, "HuffTables",
- &huff_tables, true))
- ) {
- case 1:
- return 0;
- default:
- return param_signal_error(plist, "HuffTables", code);
- case 0:
- ;
+ &huff_tables, true))
+ ) {
+ case 1:
+ return 0;
+ default:
+ return param_signal_error(plist, "HuffTables", code);
+ case 0:
+ ;
}
if (is_encode) {
- num_in_tables = pdct->data.compress->cinfo.input_components * 2;
- if (huff_tables.size < num_in_tables)
- return_error(gs_error_rangecheck);
- comp_info = pdct->data.compress->cinfo.comp_info;
- dc_table_ptrs = pdct->data.compress->cinfo.dc_huff_tbl_ptrs;
- ac_table_ptrs = pdct->data.compress->cinfo.ac_huff_tbl_ptrs;
- if (pdct->data.common->Relax)
- max_tables = max(pdct->data.compress->cinfo.input_components, 2);
+ num_in_tables = pdct->data.compress->cinfo.input_components * 2;
+ if (huff_tables.size < num_in_tables)
+ return_error(gs_error_rangecheck);
+ comp_info = pdct->data.compress->cinfo.comp_info;
+ dc_table_ptrs = pdct->data.compress->cinfo.dc_huff_tbl_ptrs;
+ ac_table_ptrs = pdct->data.compress->cinfo.ac_huff_tbl_ptrs;
+ if (pdct->data.common->Relax)
+ max_tables = max(pdct->data.compress->cinfo.input_components, 2);
} else {
- num_in_tables = huff_tables.size;
- comp_info = NULL; /* do not set for decompress case */
- dc_table_ptrs = pdct->data.decompress->dinfo.dc_huff_tbl_ptrs;
- ac_table_ptrs = pdct->data.decompress->dinfo.ac_huff_tbl_ptrs;
- if (pdct->data.common->Relax)
- max_tables = NUM_HUFF_TBLS;
+ num_in_tables = huff_tables.size;
+ comp_info = NULL; /* do not set for decompress case */
+ dc_table_ptrs = pdct->data.decompress->dinfo.dc_huff_tbl_ptrs;
+ ac_table_ptrs = pdct->data.decompress->dinfo.ac_huff_tbl_ptrs;
+ if (pdct->data.common->Relax)
+ max_tables = NUM_HUFF_TBLS;
}
ndc = nac = 0;
for (i = 0; i < num_in_tables; ++i) {
- char istr[5]; /* i converted to string key */
- UINT8 counts[16], values[256];
-
- /* Collect the Huffman parameters. */
- sprintf(istr, "%d", i);
- code = s_DCT_byte_params(huff_tables.list, istr, 0, 16, counts);
- if (code < 0)
- return code;
- for (codes_size = 0, j = 0; j < 16; j++)
- codes_size += counts[j];
- if (codes_size > 256 /*|| r_size(pa) != codes_size+16 */ )
- return_error(gs_error_rangecheck);
- code = s_DCT_byte_params(huff_tables.list, istr, 16, codes_size,
- values);
- if (code < 0)
- return code;
- if (i & 1) {
- j = find_huff_values(ac_table_ptrs, nac, counts, values,
- codes_size);
- if (comp_info != NULL)
- comp_info[i >> 1].ac_tbl_no = j;
- if (j < nac)
- continue;
- if (++nac > NUM_HUFF_TBLS)
- return_error(gs_error_rangecheck);
- this_table_ptr = ac_table_ptrs + j;
- } else {
- j = find_huff_values(dc_table_ptrs, ndc, counts, values,
- codes_size);
- if (comp_info != NULL)
- comp_info[i >> 1].dc_tbl_no = j;
- if (j < ndc)
- continue;
- if (++ndc > NUM_HUFF_TBLS)
- return_error(gs_error_rangecheck);
- this_table_ptr = dc_table_ptrs + j;
- }
- this_table = *this_table_ptr;
- if (this_table == NULL) {
- this_table = gs_jpeg_alloc_huff_table(pdct);
- if (this_table == NULL)
- return_error(gs_error_VMerror);
- *this_table_ptr = this_table;
- }
- memcpy(this_table->bits, counts, sizeof(counts));
- memcpy(this_table->huffval, values, codes_size * sizeof(values[0]));
+ char istr[5]; /* i converted to string key */
+ UINT8 counts[16], values[256];
+
+ /* Collect the Huffman parameters. */
+ sprintf(istr, "%d", i);
+ code = s_DCT_byte_params(huff_tables.list, istr, 0, 16, counts);
+ if (code < 0)
+ return code;
+ for (codes_size = 0, j = 0; j < 16; j++)
+ codes_size += counts[j];
+ if (codes_size > 256 /*|| r_size(pa) != codes_size+16 */ )
+ return_error(gs_error_rangecheck);
+ code = s_DCT_byte_params(huff_tables.list, istr, 16, codes_size,
+ values);
+ if (code < 0)
+ return code;
+ if (i & 1) {
+ j = find_huff_values(ac_table_ptrs, nac, counts, values,
+ codes_size);
+ if (comp_info != NULL)
+ comp_info[i >> 1].ac_tbl_no = j;
+ if (j < nac)
+ continue;
+ if (++nac > NUM_HUFF_TBLS)
+ return_error(gs_error_rangecheck);
+ this_table_ptr = ac_table_ptrs + j;
+ } else {
+ j = find_huff_values(dc_table_ptrs, ndc, counts, values,
+ codes_size);
+ if (comp_info != NULL)
+ comp_info[i >> 1].dc_tbl_no = j;
+ if (j < ndc)
+ continue;
+ if (++ndc > NUM_HUFF_TBLS)
+ return_error(gs_error_rangecheck);
+ this_table_ptr = dc_table_ptrs + j;
+ }
+ this_table = *this_table_ptr;
+ if (this_table == NULL) {
+ this_table = gs_jpeg_alloc_huff_table(pdct);
+ if (this_table == NULL)
+ return_error(gs_error_VMerror);
+ *this_table_ptr = this_table;
+ }
+ memcpy(this_table->bits, counts, sizeof(counts));
+ memcpy(this_table->huffval, values, codes_size * sizeof(values[0]));
}
if (nac > max_tables || ndc > max_tables)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return 0;
}
diff --git a/gs/base/sdcparam.h b/gs/base/sdcparam.h
index 33e1e277b..79c6f80e8 100644
--- a/gs/base/sdcparam.h
+++ b/gs/base/sdcparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,23 +24,23 @@
*/
int s_DCT_get_params(gs_param_list * plist, const stream_DCT_state * ss,
- const stream_DCT_state * defaults);
+ const stream_DCT_state * defaults);
int s_DCT_get_quantization_tables(gs_param_list * plist,
- const stream_DCT_state * pdct,
- const stream_DCT_state * defaults,
- bool is_encode);
+ const stream_DCT_state * pdct,
+ const stream_DCT_state * defaults,
+ bool is_encode);
int s_DCT_get_huffman_tables(gs_param_list * plist,
- const stream_DCT_state * pdct,
- const stream_DCT_state * defaults,
- bool is_encode);
+ const stream_DCT_state * pdct,
+ const stream_DCT_state * defaults,
+ bool is_encode);
int s_DCT_byte_params(gs_param_list * plist, gs_param_name key, int start,
- int count, UINT8 * pvals);
+ int count, UINT8 * pvals);
int s_DCT_put_params(gs_param_list * plist, stream_DCT_state * pdct);
int s_DCT_put_quantization_tables(gs_param_list * plist,
- stream_DCT_state * pdct,
- bool is_encode);
+ stream_DCT_state * pdct,
+ bool is_encode);
int s_DCT_put_huffman_tables(gs_param_list * plist, stream_DCT_state * pdct,
- bool is_encode);
+ bool is_encode);
#endif /* sdcparam_INCLUDED */
diff --git a/gs/base/sdct.h b/gs/base/sdct.h
index 973183083..50141f166 100644
--- a/gs/base/sdct.h
+++ b/gs/base/sdct.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,16 +43,16 @@ struct jpeg_block_s {
* to simplify use of the IJG library.
*/
#define jpeg_stream_data_common\
- /* We put a copy of the stream template here, because */\
- /* the minimum buffer sizes depend on the image parameters. */\
- stream_template template;\
- struct jpeg_error_mgr err;\
- gsfix_jmp_buf exit_jmpbuf;\
- gs_memory_t *memory; /* heap for library allocations */\
+ /* We put a copy of the stream template here, because */\
+ /* the minimum buffer sizes depend on the image parameters. */\
+ stream_template template;\
+ struct jpeg_error_mgr err;\
+ gsfix_jmp_buf exit_jmpbuf;\
+ gs_memory_t *memory; /* heap for library allocations */\
jpeg_block_t *blocks; /* ptr to allocated data block list */\
- /* The following are documented in Adobe TN 5116. */\
- int Picky; /* 0 or 1 */\
- int Relax /* 0 or 1 */
+ /* The following are documented in Adobe TN 5116. */\
+ int Picky; /* 0 or 1 */\
+ int Relax /* 0 or 1 */
typedef struct jpeg_stream_data_s {
jpeg_stream_data_common;
@@ -111,9 +111,9 @@ typedef struct stream_DCT_state_s {
gs_memory_t *jpeg_memory; /* heap for library allocations */
/* This is a pointer to immovable storage. */
union _jd {
- jpeg_stream_data *common;
- jpeg_compress_data *compress;
- jpeg_decompress_data *decompress;
+ jpeg_stream_data *common;
+ jpeg_compress_data *compress;
+ jpeg_decompress_data *decompress;
} data;
/* DCTEncode sets this before initialization;
* DCTDecode cannot set it until the JPEG headers are read.
diff --git a/gs/base/sdctd.c b/gs/base/sdctd.c
index eebecf60f..696600b1f 100644
--- a/gs/base/sdctd.c
+++ b/gs/base/sdctd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,10 +37,10 @@ dctd_fill_input_buffer(j_decompress_ptr dinfo)
{
jpeg_decompress_data *jddp =
(jpeg_decompress_data *) ((char *)dinfo -
- offset_of(jpeg_decompress_data, dinfo));
+ offset_of(jpeg_decompress_data, dinfo));
if (!jddp->input_eod)
- return FALSE; /* normal case: suspend processing */
+ return FALSE; /* normal case: suspend processing */
/* Reached end of source data without finding EOI */
WARNMS(dinfo, JWRN_JPEG_EOF);
/* Insert a fake EOI marker */
@@ -55,17 +55,17 @@ dctd_skip_input_data(j_decompress_ptr dinfo, long num_bytes)
struct jpeg_source_mgr *src = dinfo->src;
jpeg_decompress_data *jddp =
(jpeg_decompress_data *) ((char *)dinfo -
- offset_of(jpeg_decompress_data, dinfo));
+ offset_of(jpeg_decompress_data, dinfo));
if (num_bytes > 0) {
- if (num_bytes > src->bytes_in_buffer) {
- jddp->skip += num_bytes - src->bytes_in_buffer;
- src->next_input_byte += src->bytes_in_buffer;
- src->bytes_in_buffer = 0;
- return;
- }
- src->next_input_byte += num_bytes;
- src->bytes_in_buffer -= num_bytes;
+ if (num_bytes > src->bytes_in_buffer) {
+ jddp->skip += num_bytes - src->bytes_in_buffer;
+ src->next_input_byte += src->bytes_in_buffer;
+ src->bytes_in_buffer = 0;
+ return;
+ }
+ src->next_input_byte += num_bytes;
+ src->bytes_in_buffer -= num_bytes;
}
}
static void
@@ -104,7 +104,7 @@ s_DCTD_init(stream_state * st)
/* Process a buffer */
static int
s_DCTD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_DCT_state *const ss = (stream_DCT_state *) st;
jpeg_decompress_data *jddp = ss->data.decompress;
@@ -112,151 +112,151 @@ s_DCTD_process(stream_state * st, stream_cursor_read * pr,
int code;
if_debug3('w', "[wdd]process avail=%u, skip=%u, last=%d\n",
- (uint) (pr->limit - pr->ptr), (uint) jddp->skip, last);
+ (uint) (pr->limit - pr->ptr), (uint) jddp->skip, last);
if (jddp->skip != 0) {
- long avail = pr->limit - pr->ptr;
+ long avail = pr->limit - pr->ptr;
- if (avail < jddp->skip) {
- jddp->skip -= avail;
- pr->ptr = pr->limit;
- if (!last)
- return 0; /* need more data */
- jddp->skip = 0; /* don't skip past input EOD */
- }
- pr->ptr += jddp->skip;
- jddp->skip = 0;
+ if (avail < jddp->skip) {
+ jddp->skip -= avail;
+ pr->ptr = pr->limit;
+ if (!last)
+ return 0; /* need more data */
+ jddp->skip = 0; /* don't skip past input EOD */
+ }
+ pr->ptr += jddp->skip;
+ jddp->skip = 0;
}
src->next_input_byte = pr->ptr + 1;
src->bytes_in_buffer = pr->limit - pr->ptr;
jddp->input_eod = last;
switch (ss->phase) {
- case 0: /* not initialized yet */
- /*
- * Adobe implementations seem to ignore leading garbage bytes,
- * even though neither the standard nor Adobe's own
- * documentation mention this.
- */
- while (pr->ptr < pr->limit && pr->ptr[1] != 0xff)
- pr->ptr++;
- if (pr->ptr == pr->limit)
- return 0;
- src->next_input_byte = pr->ptr + 1;
- src->bytes_in_buffer = pr->limit - pr->ptr;
- ss->phase = 1;
- /* falls through */
- case 1: /* reading header markers */
- if ((code = gs_jpeg_read_header(ss, TRUE)) < 0)
- return ERRC;
- pr->ptr =
- (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
- switch (code) {
- case JPEG_SUSPENDED:
- return 0;
- /*case JPEG_HEADER_OK: */
- }
- /* If we have a ColorTransform parameter, and it's not
- * overridden by an Adobe marker in the data, set colorspace.
- */
- if (ss->ColorTransform >= 0 &&
- !jddp->dinfo.saw_Adobe_marker) {
- switch (jddp->dinfo.num_components) {
- case 3:
- jddp->dinfo.jpeg_color_space =
- (ss->ColorTransform ? JCS_YCbCr : JCS_RGB);
- /* out_color_space will default to JCS_RGB */
- break;
- case 4:
- jddp->dinfo.jpeg_color_space =
- (ss->ColorTransform ? JCS_YCCK : JCS_CMYK);
- /* out_color_space will default to JCS_CMYK */
- break;
- }
- }
- ss->phase = 2;
- /* falls through */
- case 2: /* start_decompress */
- if ((code = gs_jpeg_start_decompress(ss)) < 0)
- return ERRC;
- pr->ptr =
- (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
- if (code == 0)
- return 0;
- ss->scan_line_size =
- jddp->dinfo.output_width * jddp->dinfo.output_components;
- if_debug4('w', "[wdd]width=%u, components=%d, scan_line_size=%u, min_out_size=%u\n",
- jddp->dinfo.output_width,
- jddp->dinfo.output_components,
- ss->scan_line_size, jddp->template.min_out_size);
- if (ss->scan_line_size > (uint) jddp->template.min_out_size) {
- /* Create a spare buffer for oversize scanline */
- jddp->scanline_buffer =
- gs_alloc_bytes_immovable(gs_memory_stable(jddp->memory),
- ss->scan_line_size,
- "s_DCTD_process(scanline_buffer)");
- if (jddp->scanline_buffer == NULL)
- return ERRC;
- }
- jddp->bytes_in_scanline = 0;
- ss->phase = 3;
- /* falls through */
- case 3: /* reading data */
- dumpbuffer:
- if (jddp->bytes_in_scanline != 0) {
- uint avail = pw->limit - pw->ptr;
- uint tomove = min(jddp->bytes_in_scanline,
- avail);
+ case 0: /* not initialized yet */
+ /*
+ * Adobe implementations seem to ignore leading garbage bytes,
+ * even though neither the standard nor Adobe's own
+ * documentation mention this.
+ */
+ while (pr->ptr < pr->limit && pr->ptr[1] != 0xff)
+ pr->ptr++;
+ if (pr->ptr == pr->limit)
+ return 0;
+ src->next_input_byte = pr->ptr + 1;
+ src->bytes_in_buffer = pr->limit - pr->ptr;
+ ss->phase = 1;
+ /* falls through */
+ case 1: /* reading header markers */
+ if ((code = gs_jpeg_read_header(ss, TRUE)) < 0)
+ return ERRC;
+ pr->ptr =
+ (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
+ switch (code) {
+ case JPEG_SUSPENDED:
+ return 0;
+ /*case JPEG_HEADER_OK: */
+ }
+ /* If we have a ColorTransform parameter, and it's not
+ * overridden by an Adobe marker in the data, set colorspace.
+ */
+ if (ss->ColorTransform >= 0 &&
+ !jddp->dinfo.saw_Adobe_marker) {
+ switch (jddp->dinfo.num_components) {
+ case 3:
+ jddp->dinfo.jpeg_color_space =
+ (ss->ColorTransform ? JCS_YCbCr : JCS_RGB);
+ /* out_color_space will default to JCS_RGB */
+ break;
+ case 4:
+ jddp->dinfo.jpeg_color_space =
+ (ss->ColorTransform ? JCS_YCCK : JCS_CMYK);
+ /* out_color_space will default to JCS_CMYK */
+ break;
+ }
+ }
+ ss->phase = 2;
+ /* falls through */
+ case 2: /* start_decompress */
+ if ((code = gs_jpeg_start_decompress(ss)) < 0)
+ return ERRC;
+ pr->ptr =
+ (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
+ if (code == 0)
+ return 0;
+ ss->scan_line_size =
+ jddp->dinfo.output_width * jddp->dinfo.output_components;
+ if_debug4('w', "[wdd]width=%u, components=%d, scan_line_size=%u, min_out_size=%u\n",
+ jddp->dinfo.output_width,
+ jddp->dinfo.output_components,
+ ss->scan_line_size, jddp->template.min_out_size);
+ if (ss->scan_line_size > (uint) jddp->template.min_out_size) {
+ /* Create a spare buffer for oversize scanline */
+ jddp->scanline_buffer =
+ gs_alloc_bytes_immovable(gs_memory_stable(jddp->memory),
+ ss->scan_line_size,
+ "s_DCTD_process(scanline_buffer)");
+ if (jddp->scanline_buffer == NULL)
+ return ERRC;
+ }
+ jddp->bytes_in_scanline = 0;
+ ss->phase = 3;
+ /* falls through */
+ case 3: /* reading data */
+ dumpbuffer:
+ if (jddp->bytes_in_scanline != 0) {
+ uint avail = pw->limit - pw->ptr;
+ uint tomove = min(jddp->bytes_in_scanline,
+ avail);
- if_debug2('w', "[wdd]moving %u/%u\n",
- tomove, avail);
- memcpy(pw->ptr + 1, jddp->scanline_buffer +
- (ss->scan_line_size - jddp->bytes_in_scanline),
- tomove);
- pw->ptr += tomove;
- jddp->bytes_in_scanline -= tomove;
- if (jddp->bytes_in_scanline != 0)
- return 1; /* need more room */
- }
- while (jddp->dinfo.output_height > jddp->dinfo.output_scanline) {
- int read;
- byte *samples;
+ if_debug2('w', "[wdd]moving %u/%u\n",
+ tomove, avail);
+ memcpy(pw->ptr + 1, jddp->scanline_buffer +
+ (ss->scan_line_size - jddp->bytes_in_scanline),
+ tomove);
+ pw->ptr += tomove;
+ jddp->bytes_in_scanline -= tomove;
+ if (jddp->bytes_in_scanline != 0)
+ return 1; /* need more room */
+ }
+ while (jddp->dinfo.output_height > jddp->dinfo.output_scanline) {
+ int read;
+ byte *samples;
- if (jddp->scanline_buffer != NULL)
- samples = jddp->scanline_buffer;
- else {
- if ((uint) (pw->limit - pw->ptr) < ss->scan_line_size)
- return 1; /* need more room */
- samples = pw->ptr + 1;
- }
- read = gs_jpeg_read_scanlines(ss, &samples, 1);
- if (read < 0)
- return ERRC;
- if_debug3('w', "[wdd]read returns %d, used=%u, faked_eoi=%d\n",
- read,
- (uint) (src->next_input_byte - 1 - pr->ptr),
- (int)jddp->faked_eoi);
- pr->ptr =
- (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
- if (!read)
- return 0; /* need more data */
- if (jddp->scanline_buffer != NULL) {
- jddp->bytes_in_scanline = ss->scan_line_size;
- goto dumpbuffer;
- }
- pw->ptr += ss->scan_line_size;
- }
- ss->phase = 4;
- /* falls through */
- case 4: /* end of image; scan for EOI */
- if ((code = gs_jpeg_finish_decompress(ss)) < 0)
- return ERRC;
- pr->ptr =
- (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
- if (code == 0)
- return 0;
- ss->phase = 5;
- /* falls through */
- case 5: /* we are DONE */
- return EOFC;
+ if (jddp->scanline_buffer != NULL)
+ samples = jddp->scanline_buffer;
+ else {
+ if ((uint) (pw->limit - pw->ptr) < ss->scan_line_size)
+ return 1; /* need more room */
+ samples = pw->ptr + 1;
+ }
+ read = gs_jpeg_read_scanlines(ss, &samples, 1);
+ if (read < 0)
+ return ERRC;
+ if_debug3('w', "[wdd]read returns %d, used=%u, faked_eoi=%d\n",
+ read,
+ (uint) (src->next_input_byte - 1 - pr->ptr),
+ (int)jddp->faked_eoi);
+ pr->ptr =
+ (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
+ if (!read)
+ return 0; /* need more data */
+ if (jddp->scanline_buffer != NULL) {
+ jddp->bytes_in_scanline = ss->scan_line_size;
+ goto dumpbuffer;
+ }
+ pw->ptr += ss->scan_line_size;
+ }
+ ss->phase = 4;
+ /* falls through */
+ case 4: /* end of image; scan for EOI */
+ if ((code = gs_jpeg_finish_decompress(ss)) < 0)
+ return ERRC;
+ pr->ptr =
+ (jddp->faked_eoi ? pr->limit : src->next_input_byte - 1);
+ if (code == 0)
+ return 0;
+ ss->phase = 5;
+ /* falls through */
+ case 5: /* we are DONE */
+ return EOFC;
}
/* Default case can't happen.... */
return ERRC;
@@ -270,11 +270,11 @@ s_DCTD_release(stream_state * st)
gs_jpeg_destroy(ss);
if (ss->data.decompress->scanline_buffer != NULL)
- gs_free_object(gs_memory_stable(ss->data.common->memory),
- ss->data.decompress->scanline_buffer,
- "s_DCTD_release(scanline_buffer)");
+ gs_free_object(gs_memory_stable(ss->data.common->memory),
+ ss->data.decompress->scanline_buffer,
+ "s_DCTD_release(scanline_buffer)");
gs_free_object(ss->data.common->memory, ss->data.decompress,
- "s_DCTD_release");
+ "s_DCTD_release");
/* Switch the template pointer back in case we still need it. */
st->template = &s_DCTD_template;
}
diff --git a/gs/base/sdcte.c b/gs/base/sdcte.c
index d7dd868fe..eea872b7b 100644
--- a/gs/base/sdcte.c
+++ b/gs/base/sdcte.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -75,121 +75,121 @@ s_DCTE_init(stream_state * st)
/* Process a buffer */
static int
s_DCTE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_DCT_state *const ss = (stream_DCT_state *) st;
jpeg_compress_data *jcdp = ss->data.compress;
struct jpeg_destination_mgr *dest = jcdp->cinfo.dest;
if_debug2('w', "[wde]process avail=%u, last=%d\n",
- (uint) (pr->limit - pr->ptr), last);
+ (uint) (pr->limit - pr->ptr), last);
dest->next_output_byte = pw->ptr + 1;
dest->free_in_buffer = pw->limit - pw->ptr;
switch (ss->phase) {
- case 0: /* not initialized yet */
- if (gs_jpeg_start_compress(ss, TRUE) < 0)
- return ERRC;
- if_debug4('w', "[wde]width=%u, height=%u, components=%d, scan_line_size=%u\n",
- jcdp->cinfo.image_width,
- jcdp->cinfo.image_height,
- jcdp->cinfo.input_components,
- ss->scan_line_size);
- pw->ptr = dest->next_output_byte - 1;
- ss->phase = 1;
- /* falls through */
- case 1: /* initialized, Markers not written */
- if (pw->limit - pw->ptr < ss->Markers.size)
- return 1;
- memcpy(pw->ptr + 1, ss->Markers.data, ss->Markers.size);
- pw->ptr += ss->Markers.size;
- ss->phase = 2;
- /* falls through */
- case 2: /* still need to write Adobe marker */
- if (!ss->NoMarker) {
- static const byte Adobe[] =
- {
- 0xFF, JPEG_APP0 + 14, 0, 14, /* parameter length */
- 'A', 'd', 'o', 'b', 'e',
- 0, 100, /* Version */
- 0, 0, /* Flags0 */
- 0, 0, /* Flags1 */
- 0 /* ColorTransform */
- };
+ case 0: /* not initialized yet */
+ if (gs_jpeg_start_compress(ss, TRUE) < 0)
+ return ERRC;
+ if_debug4('w', "[wde]width=%u, height=%u, components=%d, scan_line_size=%u\n",
+ jcdp->cinfo.image_width,
+ jcdp->cinfo.image_height,
+ jcdp->cinfo.input_components,
+ ss->scan_line_size);
+ pw->ptr = dest->next_output_byte - 1;
+ ss->phase = 1;
+ /* falls through */
+ case 1: /* initialized, Markers not written */
+ if (pw->limit - pw->ptr < ss->Markers.size)
+ return 1;
+ memcpy(pw->ptr + 1, ss->Markers.data, ss->Markers.size);
+ pw->ptr += ss->Markers.size;
+ ss->phase = 2;
+ /* falls through */
+ case 2: /* still need to write Adobe marker */
+ if (!ss->NoMarker) {
+ static const byte Adobe[] =
+ {
+ 0xFF, JPEG_APP0 + 14, 0, 14, /* parameter length */
+ 'A', 'd', 'o', 'b', 'e',
+ 0, 100, /* Version */
+ 0, 0, /* Flags0 */
+ 0, 0, /* Flags1 */
+ 0 /* ColorTransform */
+ };
#define ADOBE_MARKER_LEN sizeof(Adobe)
- if (pw->limit - pw->ptr < ADOBE_MARKER_LEN)
- return 1;
- memcpy(pw->ptr + 1, Adobe, ADOBE_MARKER_LEN);
- pw->ptr += ADOBE_MARKER_LEN;
- *pw->ptr = ss->ColorTransform;
+ if (pw->limit - pw->ptr < ADOBE_MARKER_LEN)
+ return 1;
+ memcpy(pw->ptr + 1, Adobe, ADOBE_MARKER_LEN);
+ pw->ptr += ADOBE_MARKER_LEN;
+ *pw->ptr = ss->ColorTransform;
#undef ADOBE_MARKER_LEN
- }
- dest->next_output_byte = pw->ptr + 1;
- dest->free_in_buffer = pw->limit - pw->ptr;
- ss->phase = 3;
- /* falls through */
- case 3: /* markers written, processing data */
- while (jcdp->cinfo.image_height > jcdp->cinfo.next_scanline) {
- int written;
-
- /*
- * The data argument for jpeg_write_scanlines is
- * declared as a JSAMPARRAY. There is no corresponding
- * const type, so we must remove const from the
- * argument that we are passing here. (Tom Lane of IJG
- * judges that providing const analogues of the
- * interface types wouldn't be worth the trouble.)
- */
- /*const */ byte *samples = (byte *) (pr->ptr + 1);
-
- if_debug1('w', "[wde]next_scanline=%u\n",
- jcdp->cinfo.next_scanline);
- if ((uint) (pr->limit - pr->ptr) < ss->scan_line_size) {
- if (last)
- return ERRC; /* premature EOD */
- return 0; /* need more data */
- }
- written = gs_jpeg_write_scanlines(ss, &samples, 1);
- if (written < 0)
- return ERRC;
- if_debug3('w', "[wde]write returns %d, used=%u, written=%u\n",
- written,
- (uint) (samples - 1 - pr->ptr),
- (uint) (dest->next_output_byte - 1 - pw->ptr));
- pw->ptr = dest->next_output_byte - 1;
- if (!written)
- return 1; /* output full */
- pr->ptr += ss->scan_line_size;
- }
- ss->phase = 4;
- /* falls through */
- case 4: /* all data processed, finishing */
- /* jpeg_finish_compress can't suspend, so write its output
- * to a fixed-size internal buffer.
- */
- dest->next_output_byte = jcdp->finish_compress_buf;
- dest->free_in_buffer = sizeof(jcdp->finish_compress_buf);
- if (gs_jpeg_finish_compress(ss) < 0)
- return ERRC;
- jcdp->fcb_size =
- dest->next_output_byte - jcdp->finish_compress_buf;
- jcdp->fcb_pos = 0;
- ss->phase = 5;
- /* falls through */
- case 5: /* copy the final data to the output */
- if (jcdp->fcb_pos < jcdp->fcb_size) {
- int count = min(jcdp->fcb_size - jcdp->fcb_pos,
- pw->limit - pw->ptr);
-
- if_debug1('w', "[wde]copying final %d\n", count);
- memcpy(pw->ptr + 1, jcdp->finish_compress_buf + jcdp->fcb_pos,
- count);
- jcdp->fcb_pos += count;
- pw->ptr += count;
- if (jcdp->fcb_pos < jcdp->fcb_size)
- return 1;
- }
- return EOFC;
+ }
+ dest->next_output_byte = pw->ptr + 1;
+ dest->free_in_buffer = pw->limit - pw->ptr;
+ ss->phase = 3;
+ /* falls through */
+ case 3: /* markers written, processing data */
+ while (jcdp->cinfo.image_height > jcdp->cinfo.next_scanline) {
+ int written;
+
+ /*
+ * The data argument for jpeg_write_scanlines is
+ * declared as a JSAMPARRAY. There is no corresponding
+ * const type, so we must remove const from the
+ * argument that we are passing here. (Tom Lane of IJG
+ * judges that providing const analogues of the
+ * interface types wouldn't be worth the trouble.)
+ */
+ /*const */ byte *samples = (byte *) (pr->ptr + 1);
+
+ if_debug1('w', "[wde]next_scanline=%u\n",
+ jcdp->cinfo.next_scanline);
+ if ((uint) (pr->limit - pr->ptr) < ss->scan_line_size) {
+ if (last)
+ return ERRC; /* premature EOD */
+ return 0; /* need more data */
+ }
+ written = gs_jpeg_write_scanlines(ss, &samples, 1);
+ if (written < 0)
+ return ERRC;
+ if_debug3('w', "[wde]write returns %d, used=%u, written=%u\n",
+ written,
+ (uint) (samples - 1 - pr->ptr),
+ (uint) (dest->next_output_byte - 1 - pw->ptr));
+ pw->ptr = dest->next_output_byte - 1;
+ if (!written)
+ return 1; /* output full */
+ pr->ptr += ss->scan_line_size;
+ }
+ ss->phase = 4;
+ /* falls through */
+ case 4: /* all data processed, finishing */
+ /* jpeg_finish_compress can't suspend, so write its output
+ * to a fixed-size internal buffer.
+ */
+ dest->next_output_byte = jcdp->finish_compress_buf;
+ dest->free_in_buffer = sizeof(jcdp->finish_compress_buf);
+ if (gs_jpeg_finish_compress(ss) < 0)
+ return ERRC;
+ jcdp->fcb_size =
+ dest->next_output_byte - jcdp->finish_compress_buf;
+ jcdp->fcb_pos = 0;
+ ss->phase = 5;
+ /* falls through */
+ case 5: /* copy the final data to the output */
+ if (jcdp->fcb_pos < jcdp->fcb_size) {
+ int count = min(jcdp->fcb_size - jcdp->fcb_pos,
+ pw->limit - pw->ptr);
+
+ if_debug1('w', "[wde]copying final %d\n", count);
+ memcpy(pw->ptr + 1, jcdp->finish_compress_buf + jcdp->fcb_pos,
+ count);
+ jcdp->fcb_pos += count;
+ pw->ptr += count;
+ if (jcdp->fcb_pos < jcdp->fcb_size)
+ return 1;
+ }
+ return EOFC;
}
/* Default case can't happen.... */
return ERRC;
@@ -203,7 +203,7 @@ s_DCTE_release(stream_state * st)
gs_jpeg_destroy(ss);
gs_free_object(ss->data.common->memory, ss->data.compress,
- "s_DCTE_release");
+ "s_DCTE_release");
/* Switch the template pointer back in case we still need it. */
st->template = &s_DCTE_template;
}
diff --git a/gs/base/sddparam.c b/gs/base/sddparam.c
index 2d91919fc..000cd613a 100644
--- a/gs/base/sddparam.c
+++ b/gs/base/sddparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,10 +36,10 @@ s_DCTD_get_params(gs_param_list * plist, const stream_DCT_state * ss, bool all)
const stream_DCT_state *defaults;
if (all)
- defaults = 0;
+ defaults = 0;
else {
- (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
- defaults = &dcts_defaults;
+ (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
+ defaults = &dcts_defaults;
}
/****** NYI ******/
return s_DCT_get_params(plist, ss, defaults);
@@ -59,9 +59,9 @@ s_DCTD_put_params(gs_param_list * plist, stream_DCT_state * pdct)
* DCTDecode accepts quantization and huffman tables
* in case these tables have been omitted from the datastream.
*/
- (code = s_DCT_put_huffman_tables(plist, pdct, false)) < 0 ||
- (code = s_DCT_put_quantization_tables(plist, pdct, false)) < 0
- )
- DO_NOTHING;
+ (code = s_DCT_put_huffman_tables(plist, pdct, false)) < 0 ||
+ (code = s_DCT_put_quantization_tables(plist, pdct, false)) < 0
+ )
+ DO_NOTHING;
return code;
}
diff --git a/gs/base/sdeparam.c b/gs/base/sdeparam.c
index cc826a753..69b152f00 100644
--- a/gs/base/sdeparam.c
+++ b/gs/base/sdeparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -69,20 +69,20 @@ dcte_get_samples(gs_param_list * plist, gs_param_name key, int num_colors,
int i;
for (i = 0; i < num_colors; ++i)
- write |= (samples[i] = (is_vert ? comp_info[i].v_samp_factor :
- comp_info[i].h_samp_factor)) != 1;
+ write |= (samples[i] = (is_vert ? comp_info[i].v_samp_factor :
+ comp_info[i].h_samp_factor)) != 1;
if (write) {
- int *data = (int *)gs_alloc_byte_array(mem, num_colors, sizeof(int),
- "dcte_get_samples");
- gs_param_int_array sa;
+ int *data = (int *)gs_alloc_byte_array(mem, num_colors, sizeof(int),
+ "dcte_get_samples");
+ gs_param_int_array sa;
- if (data == 0)
- return_error(gs_error_VMerror);
- sa.data = data;
- sa.size = num_colors;
- sa.persistent = true;
- memcpy(data, samples, num_colors * sizeof(samples[0]));
- return param_write_int_array(plist, key, &sa);
+ if (data == 0)
+ return_error(gs_error_VMerror);
+ sa.data = data;
+ sa.size = num_colors;
+ sa.persistent = true;
+ memcpy(data, samples, num_colors * sizeof(samples[0]));
+ return param_write_int_array(plist, key, &sa);
}
return 0;
}
@@ -98,19 +98,19 @@ s_DCTE_get_params(gs_param_list * plist, const stream_DCT_state * ss, bool all)
int code;
if (!all) {
- jpeg_compress_data *jcdp_default = gs_alloc_struct_immovable(mem,
+ jpeg_compress_data *jcdp_default = gs_alloc_struct_immovable(mem,
jpeg_compress_data, &st_jpeg_compress_data, "s_DCTE_get_params");
- if (jcdp_default == 0)
- return_error(gs_error_VMerror);
- defaults = &dcts_defaults;
- (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
- dcts_defaults.data.compress = jcdp_default;
- jcdp_default->memory = dcts_defaults.jpeg_memory = mem;
- if ((code = gs_jpeg_create_compress(&dcts_defaults)) < 0)
- goto fail; /* correct to do jpeg_destroy here */
+ if (jcdp_default == 0)
+ return_error(gs_error_VMerror);
+ defaults = &dcts_defaults;
+ (*s_DCTE_template.set_defaults) ((stream_state *) & dcts_defaults);
+ dcts_defaults.data.compress = jcdp_default;
+ jcdp_default->memory = dcts_defaults.jpeg_memory = mem;
+ if ((code = gs_jpeg_create_compress(&dcts_defaults)) < 0)
+ goto fail; /* correct to do jpeg_destroy here */
/****** SET DEFAULTS HERE ******/
- dcts_defaults.data.common->Picky = 0;
- dcts_defaults.data.common->Relax = 0;
+ dcts_defaults.data.common->Picky = 0;
+ dcts_defaults.data.common->Relax = 0;
}
params.Columns = jcdp->cinfo.image_width;
params.Rows = jcdp->cinfo.image_height;
@@ -122,22 +122,22 @@ s_DCTE_get_params(gs_param_list * plist, const stream_DCT_state * ss, bool all)
params.Resync = jcdp->cinfo.restart_interval;
/* What about Blend?? */
if ((code = s_DCT_get_params(plist, ss, defaults)) < 0 ||
- (code = gs_param_write_items(plist, &params,
- &dcte_scalars_default,
- s_DCTE_param_items)) < 0 ||
- (code = dcte_get_samples(plist, "HSamples", params.Colors,
- jcdp, mem, false, all)) < 0 ||
- (code = dcte_get_samples(plist, "VSamples", params.Colors,
- jcdp, mem, true, all)) < 0 ||
+ (code = gs_param_write_items(plist, &params,
+ &dcte_scalars_default,
+ s_DCTE_param_items)) < 0 ||
+ (code = dcte_get_samples(plist, "HSamples", params.Colors,
+ jcdp, mem, false, all)) < 0 ||
+ (code = dcte_get_samples(plist, "VSamples", params.Colors,
+ jcdp, mem, true, all)) < 0 ||
(code = s_DCT_get_quantization_tables(plist, ss, defaults, true)) < 0 ||
- (code = s_DCT_get_huffman_tables(plist, ss, defaults, true)) < 0
- )
- DO_NOTHING;
+ (code = s_DCT_get_huffman_tables(plist, ss, defaults, true)) < 0
+ )
+ DO_NOTHING;
/****** NYI ******/
fail:if (defaults) {
- gs_jpeg_destroy(&dcts_defaults);
- gs_free_object(mem, dcts_defaults.data.compress,
- "s_DCTE_get_params");
+ gs_jpeg_destroy(&dcts_defaults);
+ gs_free_object(mem, dcts_defaults.data.compress,
+ "s_DCTE_get_params");
}
return code;
}
@@ -149,7 +149,7 @@ stream_state_proc_put_params(s_DCTE_put_params, stream_DCT_state); /* check */
/* Put a set of sampling values. */
static int
dcte_put_samples(gs_param_list * plist, gs_param_name key, int num_colors,
- jpeg_compress_data * jcdp, bool is_vert)
+ jpeg_compress_data * jcdp, bool is_vert)
{
int code;
int i;
@@ -161,22 +161,22 @@ dcte_put_samples(gs_param_list * plist, gs_param_name key, int num_colors,
* which is NOT the IJG default, so we must always assign values.
*/
switch ((code = s_DCT_byte_params(plist, key, 0, num_colors,
- samples))
- ) {
- default: /* error */
- return code;
- case 0:
- break;
- case 1:
- samples[0] = samples[1] = samples[2] = samples[3] = 1;
+ samples))
+ ) {
+ default: /* error */
+ return code;
+ case 0:
+ break;
+ case 1:
+ samples[0] = samples[1] = samples[2] = samples[3] = 1;
}
for (i = 0; i < num_colors; i++) {
- if (samples[i] < 1 || samples[i] > 4)
- return_error(gs_error_rangecheck);
- if (is_vert)
- comp_info[i].v_samp_factor = samples[i];
- else
- comp_info[i].h_samp_factor = samples[i];
+ if (samples[i] < 1 || samples[i] > 4)
+ return_error(gs_error_rangecheck);
+ if (is_vert)
+ comp_info[i].v_samp_factor = samples[i];
+ else
+ comp_info[i].h_samp_factor = samples[i];
}
return 0;
}
@@ -197,113 +197,113 @@ s_DCTE_put_params(gs_param_list * plist, stream_DCT_state * pdct)
*/
code = gs_param_read_items(plist, &params, s_DCTE_param_items);
if (code < 0)
- return code;
+ return code;
if (params.Columns <= 0 || params.Columns > 0xffff ||
- params.Rows <= 0 || params.Rows > 0xffff ||
- params.Colors <= 0 || params.Colors == 2 || params.Colors > 4 ||
- params.Resync < 0 || params.Resync > 0xffff ||
- params.Blend < 0 || params.Blend > 1
- )
- return_error(gs_error_rangecheck);
+ params.Rows <= 0 || params.Rows > 0xffff ||
+ params.Colors <= 0 || params.Colors == 2 || params.Colors > 4 ||
+ params.Resync < 0 || params.Resync > 0xffff ||
+ params.Blend < 0 || params.Blend > 1
+ )
+ return_error(gs_error_rangecheck);
jcdp->Picky = 0;
jcdp->Relax = 0;
if ((code = s_DCT_put_params(plist, pdct)) < 0)
- return code;
+ return code;
/* Set up minimal image description & call set_defaults */
jcdp->cinfo.image_width = params.Columns;
jcdp->cinfo.image_height = params.Rows;
jcdp->cinfo.input_components = params.Colors;
switch (params.Colors) {
- case 1:
- jcdp->cinfo.in_color_space = JCS_GRAYSCALE;
- break;
- case 3:
- jcdp->cinfo.in_color_space = JCS_RGB;
- break;
- case 4:
- jcdp->cinfo.in_color_space = JCS_CMYK;
- break;
- default:
- jcdp->cinfo.in_color_space = JCS_UNKNOWN;
+ case 1:
+ jcdp->cinfo.in_color_space = JCS_GRAYSCALE;
+ break;
+ case 3:
+ jcdp->cinfo.in_color_space = JCS_RGB;
+ break;
+ case 4:
+ jcdp->cinfo.in_color_space = JCS_CMYK;
+ break;
+ default:
+ jcdp->cinfo.in_color_space = JCS_UNKNOWN;
}
if ((code = gs_jpeg_set_defaults(pdct)) < 0)
- return code;
+ return code;
if ((code = s_DCT_put_huffman_tables(plist, pdct, true)) < 0)
- return code;
+ return code;
switch ((code = s_DCT_put_quantization_tables(plist, pdct, true))) {
- case 0:
- break;
- default:
- return code;
- case 1:
- /* No QuantTables, but maybe a QFactor to apply to default. */
- if (pdct->QFactor != 1.0) {
- code = gs_jpeg_set_linear_quality(pdct,
- (int)(min(pdct->QFactor, 100.0)
- * 100.0 + 0.5),
- TRUE);
- if (code < 0)
- return code;
- }
+ case 0:
+ break;
+ default:
+ return code;
+ case 1:
+ /* No QuantTables, but maybe a QFactor to apply to default. */
+ if (pdct->QFactor != 1.0) {
+ code = gs_jpeg_set_linear_quality(pdct,
+ (int)(min(pdct->QFactor, 100.0)
+ * 100.0 + 0.5),
+ TRUE);
+ if (code < 0)
+ return code;
+ }
}
/* Change IJG colorspace defaults as needed;
* set ColorTransform to what will go in the Adobe marker.
*/
switch (params.Colors) {
- case 3:
- if (pdct->ColorTransform < 0)
- pdct->ColorTransform = 1; /* default */
- if (pdct->ColorTransform == 0) {
- if ((code = gs_jpeg_set_colorspace(pdct, JCS_RGB)) < 0)
- return code;
- } else
- pdct->ColorTransform = 1; /* flag YCC xform */
- break;
- case 4:
- if (pdct->ColorTransform < 0)
- pdct->ColorTransform = 0; /* default */
- if (pdct->ColorTransform != 0) {
- if ((code = gs_jpeg_set_colorspace(pdct, JCS_YCCK)) < 0)
- return code;
- pdct->ColorTransform = 2; /* flag YCCK xform */
- } else {
- if ((code = gs_jpeg_set_colorspace(pdct, JCS_CMYK)) < 0)
- return code;
- }
- break;
- default:
- pdct->ColorTransform = 0; /* no transform otherwise */
- break;
+ case 3:
+ if (pdct->ColorTransform < 0)
+ pdct->ColorTransform = 1; /* default */
+ if (pdct->ColorTransform == 0) {
+ if ((code = gs_jpeg_set_colorspace(pdct, JCS_RGB)) < 0)
+ return code;
+ } else
+ pdct->ColorTransform = 1; /* flag YCC xform */
+ break;
+ case 4:
+ if (pdct->ColorTransform < 0)
+ pdct->ColorTransform = 0; /* default */
+ if (pdct->ColorTransform != 0) {
+ if ((code = gs_jpeg_set_colorspace(pdct, JCS_YCCK)) < 0)
+ return code;
+ pdct->ColorTransform = 2; /* flag YCCK xform */
+ } else {
+ if ((code = gs_jpeg_set_colorspace(pdct, JCS_CMYK)) < 0)
+ return code;
+ }
+ break;
+ default:
+ pdct->ColorTransform = 0; /* no transform otherwise */
+ break;
}
/* Optional encoding-only parameters */
pdct->Markers.data = params.Markers.data;
pdct->Markers.size = params.Markers.size;
pdct->NoMarker = params.NoMarker;
if ((code = dcte_put_samples(plist, "HSamples", params.Colors,
- jcdp, false)) < 0 ||
- (code = dcte_put_samples(plist, "VSamples", params.Colors,
- jcdp, true)) < 0
- )
- return code;
+ jcdp, false)) < 0 ||
+ (code = dcte_put_samples(plist, "VSamples", params.Colors,
+ jcdp, true)) < 0
+ )
+ return code;
jcdp->cinfo.write_JFIF_header = FALSE;
jcdp->cinfo.write_Adobe_marker = FALSE; /* must do it myself */
jcdp->cinfo.restart_interval = params.Resync;
/* What to do with Blend ??? */
if (pdct->data.common->Relax == 0) {
- jpeg_component_info *comp_info = jcdp->cinfo.comp_info;
- int num_samples;
+ jpeg_component_info *comp_info = jcdp->cinfo.comp_info;
+ int num_samples;
- for (i = 0, num_samples = 0; i < params.Colors; i++)
- num_samples += comp_info[i].h_samp_factor *
- comp_info[i].v_samp_factor;
- if (num_samples > 10)
- return_error(gs_error_rangecheck);
- /*
- * Note: by default the IJG software does not allow
- * num_samples to exceed 10, Relax or no. For full
- * compatibility with Adobe's non-JPEG-compliant
- * software, set MAX_BLOCKS_IN_MCU to 64 in jpeglib.h.
- */
+ for (i = 0, num_samples = 0; i < params.Colors; i++)
+ num_samples += comp_info[i].h_samp_factor *
+ comp_info[i].v_samp_factor;
+ if (num_samples > 10)
+ return_error(gs_error_rangecheck);
+ /*
+ * Note: by default the IJG software does not allow
+ * num_samples to exceed 10, Relax or no. For full
+ * compatibility with Adobe's non-JPEG-compliant
+ * software, set MAX_BLOCKS_IN_MCU to 64 in jpeglib.h.
+ */
}
return 0;
}
diff --git a/gs/base/seexec.c b/gs/base/seexec.c
index b03af582f..e7378e94a 100644
--- a/gs/base/seexec.c
+++ b/gs/base/seexec.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ private_st_exE_state();
/* Process a buffer */
static int
s_exE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_exE_state *const ss = (stream_exE_state *) st;
const byte *p = pr->ptr;
@@ -41,9 +41,9 @@ s_exE_process(stream_state * st, stream_cursor_read * pr,
int status;
if (rcount <= wcount)
- count = rcount, status = 0;
+ count = rcount, status = 0;
else
- count = wcount, status = 1;
+ count = wcount, status = 1;
gs_type1_encrypt(q + 1, p + 1, count, (crypt_state *)&ss->cstate);
pr->ptr += count;
pw->ptr += count;
@@ -89,7 +89,7 @@ s_exD_init(stream_state * st)
/* Process a buffer. */
static int
s_exD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_exD_state *const ss = (stream_exD_state *) st;
const byte *p = pr->ptr;
@@ -101,106 +101,106 @@ s_exD_process(stream_state * st, stream_cursor_read * pr,
int count = (wcount < rcount ? (status = 1, wcount) : rcount);
if (ss->binary < 0) {
- /*
- * This is the very first time we're filling the buffer.
- */
- const byte *const decoder = scan_char_decoder;
- int i;
+ /*
+ * This is the very first time we're filling the buffer.
+ */
+ const byte *const decoder = scan_char_decoder;
+ int i;
if (ss->pfb_state == 0 && !ss->keep_spaces) {
- /*
- * Skip '\t', '\r', '\n', ' ' at the beginning of the input stream,
- * because Adobe PS interpreters do this. Don't skip '\0' or '\f'.
+ /*
+ * Skip '\t', '\r', '\n', ' ' at the beginning of the input stream,
+ * because Adobe PS interpreters do this. Don't skip '\0' or '\f'.
* Acrobat Reader doesn't skip spaces at all.
- */
- for (; rcount; rcount--, p++) {
- byte c = p[1];
- if(c != '\t' && c != char_CR && c != char_EOL && c != ' ')
- break;
- }
- pr->ptr = p;
- count = min(wcount, rcount);
- }
-
- /*
- * Determine whether this is ASCII or hex encoding.
- * Adobe's documentation doesn't actually specify the test
- * that eexec should use, but we believe the following
- * gives correct answers even on certain non-conforming
- * PostScript files encountered in practice:
- */
+ */
+ for (; rcount; rcount--, p++) {
+ byte c = p[1];
+ if(c != '\t' && c != char_CR && c != char_EOL && c != ' ')
+ break;
+ }
+ pr->ptr = p;
+ count = min(wcount, rcount);
+ }
+
+ /*
+ * Determine whether this is ASCII or hex encoding.
+ * Adobe's documentation doesn't actually specify the test
+ * that eexec should use, but we believe the following
+ * gives correct answers even on certain non-conforming
+ * PostScript files encountered in practice:
+ */
if (rcount < 8 && !last)
- return 0;
-
- ss->binary = 0;
- for (i = min(8, rcount); i > 0; i--)
- if (!(decoder[p[i]] <= 0xf ||
- decoder[p[i]] == ctype_space)
- ) {
- ss->binary = 1;
- break;
- }
+ return 0;
+
+ ss->binary = 0;
+ for (i = min(8, rcount); i > 0; i--)
+ if (!(decoder[p[i]] <= 0xf ||
+ decoder[p[i]] == ctype_space)
+ ) {
+ ss->binary = 1;
+ break;
+ }
}
if (ss->binary) {
- /*
- * There is no need to pause at the end of the binary portion.
- * The padding bytes (which are in the text portion, in hexadecimal)
- * do their job, provided the write buffer is <= 256 bytes long.
- * This is (hopefully) ensured by the comment just above the
- * definition of s_exD_template.
- */
- pr->ptr = p + count;
+ /*
+ * There is no need to pause at the end of the binary portion.
+ * The padding bytes (which are in the text portion, in hexadecimal)
+ * do their job, provided the write buffer is <= 256 bytes long.
+ * This is (hopefully) ensured by the comment just above the
+ * definition of s_exD_template.
+ */
+ pr->ptr = p + count;
} else {
- /*
- * We only ignore leading whitespace, in an attempt to
- * keep from reading beyond the end of the encrypted data;
- * but some badly coded files require us to ignore % also.
- */
- stream_cursor_read r;
- const byte *start;
+ /*
+ * We only ignore leading whitespace, in an attempt to
+ * keep from reading beyond the end of the encrypted data;
+ * but some badly coded files require us to ignore % also.
+ */
+ stream_cursor_read r;
+ const byte *start;
hp: r = *pr;
- start = r.ptr;
- if (r.limit - r.ptr > ss->hex_left)
- r.limit = r.ptr + ss->hex_left;
- status = s_hex_process(&r, pw, &ss->odd,
- (ss->is_leading_space ? hex_ignore_leading_whitespace : hex_break_on_whitespace));
+ start = r.ptr;
+ if (r.limit - r.ptr > ss->hex_left)
+ r.limit = r.ptr + ss->hex_left;
+ status = s_hex_process(&r, pw, &ss->odd,
+ (ss->is_leading_space ? hex_ignore_leading_whitespace : hex_break_on_whitespace));
if (status == 2) {
ss->is_leading_space = true;
status = 1;
} else
ss->is_leading_space = false;
- pr->ptr = r.ptr;
- ss->hex_left -= r.ptr - start;
- /*
- * Check for having finished a prematurely decoded hex section of
- * a PFB file.
- */
- if (ss->hex_left == 0)
- ss->binary = 1;
- count = pw->ptr - q;
- if (status < 0 && ss->odd < 0) {
- if (count) {
- --p;
- status = 0; /* reprocess error next time */
- } else if (*p == '%')
- goto hp; /* ignore % */
- }
- p = q;
+ pr->ptr = r.ptr;
+ ss->hex_left -= r.ptr - start;
+ /*
+ * Check for having finished a prematurely decoded hex section of
+ * a PFB file.
+ */
+ if (ss->hex_left == 0)
+ ss->binary = 1;
+ count = pw->ptr - q;
+ if (status < 0 && ss->odd < 0) {
+ if (count) {
+ --p;
+ status = 0; /* reprocess error next time */
+ } else if (*p == '%')
+ goto hp; /* ignore % */
+ }
+ p = q;
}
if (skip >= count && skip != 0) {
- gs_type1_decrypt(q + 1, p + 1, count,
- (crypt_state *) & ss->cstate);
- ss->skip -= count;
- count = 0;
- status = 0;
+ gs_type1_decrypt(q + 1, p + 1, count,
+ (crypt_state *) & ss->cstate);
+ ss->skip -= count;
+ count = 0;
+ status = 0;
} else {
- gs_type1_decrypt(q + 1, p + 1, skip,
- (crypt_state *) & ss->cstate);
- count -= skip;
- gs_type1_decrypt(q + 1, p + 1 + skip, count,
- (crypt_state *) & ss->cstate);
- ss->skip = 0;
+ gs_type1_decrypt(q + 1, p + 1, skip,
+ (crypt_state *) & ss->cstate);
+ count -= skip;
+ gs_type1_decrypt(q + 1, p + 1 + skip, count,
+ (crypt_state *) & ss->cstate);
+ ss->skip = 0;
}
pw->ptr = q + count;
return status;
diff --git a/gs/base/setjmp_.h b/gs/base/setjmp_.h
index 563fb95b0..25ebe52ae 100644
--- a/gs/base/setjmp_.h
+++ b/gs/base/setjmp_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,6 @@ typedef struct {
unsigned char stuff[sizeof(jmp_buf) + gsfix_jmp_buf_align];
} gsfix_jmp_buf;
-
/* This could be moved into a function, but it's fairly harmless as a macro. */
#define find_jmp_buf(gsfjb) \
(*(jmp_buf *)( \
@@ -39,4 +38,3 @@ typedef struct {
))
#endif /* setjmp_INCLUDED */
-
diff --git a/gs/base/sfilter.h b/gs/base/sfilter.h
index 6fc9e7ee1..013c528f1 100644
--- a/gs/base/sfilter.h
+++ b/gs/base/sfilter.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,12 +53,12 @@ typedef struct stream_exD_state_s {
int binary; /* 1=binary, 0=hex, -1=don't know yet */
int lenIV; /* # of initial decoded bytes to skip */
stream_PFBD_state *pfb_state; /* state of underlying */
- /* PFBDecode stream, if any */
+ /* PFBDecode stream, if any */
bool keep_spaces; /* PS skips spaces after eexec, PDF doesn't */
/* The following change dynamically. */
int odd; /* odd digit */
long hex_left; /* # of encoded chars to process as hex */
- /* if binary == 0 */
+ /* if binary == 0 */
int skip; /* # of decoded bytes to skip */
bool is_leading_space; /* handle the space as leading space */
} stream_exD_state;
diff --git a/gs/base/sfilter2.c b/gs/base/sfilter2.c
index 3497584c8..a1cdde4d5 100644
--- a/gs/base/sfilter2.c
+++ b/gs/base/sfilter2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@ s_A85E_init(stream_state * st)
#define LINE_LIMIT 79 /* not 80, to satisfy Genoa FTS */
static int
s_A85E_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_A85E_state *const ss = (stream_A85E_state *) st;
register const byte *p = pr->ptr;
@@ -51,178 +51,178 @@ s_A85E_process(stream_state * st, stream_cursor_read * pr,
int count;
if_debug3('w', "[w85]initial ss->count = %d, rcount = %d, wcount = %d\n",
- ss->count, (int)(rlimit - p), (int)(wlimit - q));
+ ss->count, (int)(rlimit - p), (int)(wlimit - q));
for (; (count = rlimit - p) >= 4; p += 4) {
- ulong word =
- ((ulong) (((uint) p[1] << 8) + p[2]) << 16) +
- (((uint) p[3] << 8) + p[4]);
+ ulong word =
+ ((ulong) (((uint) p[1] << 8) + p[2]) << 16) +
+ (((uint) p[3] << 8) + p[4]);
- if (word == 0) {
- if (q >= qn) {
- if (wlimit - q < 2) {
- status = 1;
- break;
- }
- *++q = prev = '\n';
- qn = q + LINE_LIMIT;
- if_debug1('w', "[w85]EOL at %d bytes written\n",
- (int)(q - pw->ptr));
- } else {
- if (q >= wlimit) {
- status = 1;
- break;
- }
- }
- *++q = prev = 'z';
- } else {
- ulong v4 = word / 85; /* max 85^4 */
- ulong v3 = v4 / 85; /* max 85^3 */
- uint v2 = v3 / 85; /* max 85^2 */
- uint v1 = v2 / 85; /* max 85 */
+ if (word == 0) {
+ if (q >= qn) {
+ if (wlimit - q < 2) {
+ status = 1;
+ break;
+ }
+ *++q = prev = '\n';
+ qn = q + LINE_LIMIT;
+ if_debug1('w', "[w85]EOL at %d bytes written\n",
+ (int)(q - pw->ptr));
+ } else {
+ if (q >= wlimit) {
+ status = 1;
+ break;
+ }
+ }
+ *++q = prev = 'z';
+ } else {
+ ulong v4 = word / 85; /* max 85^4 */
+ ulong v3 = v4 / 85; /* max 85^3 */
+ uint v2 = v3 / 85; /* max 85^2 */
+ uint v1 = v2 / 85; /* max 85 */
put: if (q + 5 > qn) {
- if (q >= wlimit) {
- status = 1;
- break;
- }
- *++q = prev = '\n';
- qn = q + LINE_LIMIT;
- if_debug1('w', "[w85]EOL at %d bytes written\n",
- (int)(q - pw->ptr));
- goto put;
- }
- if (wlimit - q < 5) {
- status = 1;
- break;
- }
- q[1] = (byte) v1 + '!';
- q[2] = (byte) (v2 - v1 * 85) + '!';
- q[3] = (byte) ((uint) v3 - v2 * 85) + '!';
- q[4] = (byte) ((uint) v4 - (uint) v3 * 85) + '!';
- q[5] = (byte) ((uint) word - (uint) v4 * 85) + '!';
- /*
- * '%%' or '%!' at the beginning of the line will confuse some
- * document managers: insert (an) EOL(s) if necessary to prevent
- * this.
- */
- if (q[1] == '%') {
- if (prev == '%') {
- if (qn - q == LINE_LIMIT - 1) {
- /* A line would begin with %%. */
- *++q = prev = '\n';
- qn = q + LINE_LIMIT;
- if_debug1('w',
- "[w85]EOL for %%%% at %d bytes written\n",
- (int)(q - pw->ptr));
- goto put;
- }
- } else if (prev == '\n' && (q[2] == '%' || q[2] == '!')) {
- /*
- * We may have to insert more than one EOL if
- * there are more than two %s in a row.
- */
- int extra =
- (q[2] == '!' ? 1 : /* else q[2] == '%' */
- q[3] == '!' ? 2 :
- q[3] != '%' ? 1 :
- q[4] == '!' ? 3 :
- q[4] != '%' ? 2 :
- q[5] == '!' ? 4 :
- q[5] != '%' ? 3 : 4);
+ if (q >= wlimit) {
+ status = 1;
+ break;
+ }
+ *++q = prev = '\n';
+ qn = q + LINE_LIMIT;
+ if_debug1('w', "[w85]EOL at %d bytes written\n",
+ (int)(q - pw->ptr));
+ goto put;
+ }
+ if (wlimit - q < 5) {
+ status = 1;
+ break;
+ }
+ q[1] = (byte) v1 + '!';
+ q[2] = (byte) (v2 - v1 * 85) + '!';
+ q[3] = (byte) ((uint) v3 - v2 * 85) + '!';
+ q[4] = (byte) ((uint) v4 - (uint) v3 * 85) + '!';
+ q[5] = (byte) ((uint) word - (uint) v4 * 85) + '!';
+ /*
+ * '%%' or '%!' at the beginning of the line will confuse some
+ * document managers: insert (an) EOL(s) if necessary to prevent
+ * this.
+ */
+ if (q[1] == '%') {
+ if (prev == '%') {
+ if (qn - q == LINE_LIMIT - 1) {
+ /* A line would begin with %%. */
+ *++q = prev = '\n';
+ qn = q + LINE_LIMIT;
+ if_debug1('w',
+ "[w85]EOL for %%%% at %d bytes written\n",
+ (int)(q - pw->ptr));
+ goto put;
+ }
+ } else if (prev == '\n' && (q[2] == '%' || q[2] == '!')) {
+ /*
+ * We may have to insert more than one EOL if
+ * there are more than two %s in a row.
+ */
+ int extra =
+ (q[2] == '!' ? 1 : /* else q[2] == '%' */
+ q[3] == '!' ? 2 :
+ q[3] != '%' ? 1 :
+ q[4] == '!' ? 3 :
+ q[4] != '%' ? 2 :
+ q[5] == '!' ? 4 :
+ q[5] != '%' ? 3 : 4);
- if (wlimit - q < 5 + extra) {
- status = 1;
- break;
- }
- if_debug6('w', "[w]%c%c%c%c%c extra = %d\n",
- q[1], q[2], q[3], q[4], q[5], extra);
- switch (extra) {
- case 4:
- q[9] = q[5], q[8] = '\n';
- goto e3;
- case 3:
- q[8] = q[5];
- e3:q[7] = q[4], q[6] = '\n';
- goto e2;
- case 2:
- q[7] = q[5], q[6] = q[4];
- e2:q[5] = q[3], q[4] = '\n';
- goto e1;
- case 1:
- q[6] = q[5], q[5] = q[4], q[4] = q[3];
- e1:q[3] = q[2], q[2] = '\n';
- }
- if_debug1('w', "[w85]EOL at %d bytes written\n",
- (int)(q + 2 * extra - pw->ptr));
- qn = q + 2 * extra + LINE_LIMIT;
- q += extra;
- }
- } else if (q[1] == '!' && prev == '%' &&
- qn - q == LINE_LIMIT - 1
- ) {
- /* A line would begin with %!. */
- *++q = prev = '\n';
- qn = q + LINE_LIMIT;
- if_debug1('w', "[w85]EOL for %%! at %d bytes written\n",
- (int)(q - pw->ptr));
- goto put;
- }
- prev = *(q += 5);
- }
+ if (wlimit - q < 5 + extra) {
+ status = 1;
+ break;
+ }
+ if_debug6('w', "[w]%c%c%c%c%c extra = %d\n",
+ q[1], q[2], q[3], q[4], q[5], extra);
+ switch (extra) {
+ case 4:
+ q[9] = q[5], q[8] = '\n';
+ goto e3;
+ case 3:
+ q[8] = q[5];
+ e3:q[7] = q[4], q[6] = '\n';
+ goto e2;
+ case 2:
+ q[7] = q[5], q[6] = q[4];
+ e2:q[5] = q[3], q[4] = '\n';
+ goto e1;
+ case 1:
+ q[6] = q[5], q[5] = q[4], q[4] = q[3];
+ e1:q[3] = q[2], q[2] = '\n';
+ }
+ if_debug1('w', "[w85]EOL at %d bytes written\n",
+ (int)(q + 2 * extra - pw->ptr));
+ qn = q + 2 * extra + LINE_LIMIT;
+ q += extra;
+ }
+ } else if (q[1] == '!' && prev == '%' &&
+ qn - q == LINE_LIMIT - 1
+ ) {
+ /* A line would begin with %!. */
+ *++q = prev = '\n';
+ qn = q + LINE_LIMIT;
+ if_debug1('w', "[w85]EOL for %%! at %d bytes written\n",
+ (int)(q - pw->ptr));
+ goto put;
+ }
+ prev = *(q += 5);
+ }
}
end:
ss->count = LINE_LIMIT - (qn - q);
/* Check for final partial word. */
if (last && status == 0 && count < 4) {
- char buf[5];
+ char buf[5];
int nchars = (count == 0 ? 2 : count + 3);
- ulong word = 0;
- ulong divisor = 85L * 85 * 85 * 85;
+ ulong word = 0;
+ ulong divisor = 85L * 85 * 85 * 85;
int i, space;
- switch (count) {
- case 3:
- word += (uint) p[3] << 8;
- case 2:
- word += (ulong) p[2] << 16;
- case 1:
- word += (ulong) p[1] << 24;
+ switch (count) {
+ case 3:
+ word += (uint) p[3] << 8;
+ case 2:
+ word += (ulong) p[2] << 16;
+ case 1:
+ word += (ulong) p[1] << 24;
for(i=0; i <= count; i++) {
- ulong v = word / divisor; /* actually only a byte */
+ ulong v = word / divisor; /* actually only a byte */
- buf[i] = (byte) v + '!';
- word -= v * divisor;
- divisor /= 85;
- }
- /*case 0: */
- }
- space = count && buf[0] == '%' &&
+ buf[i] = (byte) v + '!';
+ word -= v * divisor;
+ divisor /= 85;
+ }
+ /*case 0: */
+ }
+ space = count && buf[0] == '%' &&
( (prev == '\n' && ( buf[1] == '%' || buf[1] =='!')) ||
(prev == '%' && qn - q == LINE_LIMIT - 1)
- );
+ );
if (wlimit - q < nchars+space)
- status = 1;
- else if (q + nchars+space > qn) {
- *++q = prev = '\n';
- qn = q + LINE_LIMIT;
- goto end;
- } else {
+ status = 1;
+ else if (q + nchars+space > qn) {
+ *++q = prev = '\n';
+ qn = q + LINE_LIMIT;
+ goto end;
+ } else {
if (count) {
if (space)
- *++q = ' ';
+ *++q = ' ';
memcpy(q+1, buf, count+1);
q += count+1;
- p += count;
+ p += count;
}
*++q = '~';
*++q = '>';
}
}
if_debug3('w', "[w85]final ss->count = %d, %d bytes read, %d written\n",
- ss->count, (int)(p - pr->ptr), (int)(q - pw->ptr));
+ ss->count, (int)(p - pr->ptr), (int)(q - pw->ptr));
pr->ptr = p;
if (q > pw->ptr)
- ss->last_char = *q;
+ ss->last_char = *q;
pw->ptr = q;
return status;
}
@@ -240,7 +240,7 @@ private_st_BT_state();
/* Process a buffer. Note that the same code serves for both streams. */
static int
s_BT_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_BT_state *const ss = (stream_BT_state *) st;
const byte *p = pr->ptr;
@@ -251,11 +251,11 @@ s_BT_process(stream_state * st, stream_cursor_read * pr,
int status;
if (rcount <= wcount)
- count = rcount, status = 0;
+ count = rcount, status = 0;
else
- count = wcount, status = 1;
+ count = wcount, status = 1;
while (count--)
- *++q = ss->table[*++p];
+ *++q = ss->table[*++p];
pr->ptr = p;
pw->ptr = q;
return status;
diff --git a/gs/base/sfxboth.c b/gs/base/sfxboth.c
index 17dd37f13..49a69bcb3 100644
--- a/gs/base/sfxboth.c
+++ b/gs/base/sfxboth.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sfxcommon.c b/gs/base/sfxcommon.c
index 74342f85f..77abb3bf4 100644
--- a/gs/base/sfxcommon.c
+++ b/gs/base/sfxcommon.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@ file_alloc_stream(gs_memory_t * mem, client_name_t cname)
stream *s;
s = s_alloc(mem, cname);
if (s == 0)
- return 0;
+ return 0;
s_init_ids(s);
s->is_temp = 0; /* not a temp stream */
s->foreign = 0;
@@ -57,30 +57,30 @@ file_alloc_stream(gs_memory_t * mem, client_name_t cname)
/* but don't open an OS file or initialize the stream. */
int
file_open_stream(const char *fname, uint len, const char *file_access,
- uint buffer_size, stream ** ps, gx_io_device *iodev,
- iodev_proc_fopen_t fopen_proc, gs_memory_t *mem)
+ uint buffer_size, stream ** ps, gx_io_device *iodev,
+ iodev_proc_fopen_t fopen_proc, gs_memory_t *mem)
{
int code;
FILE *file;
char fmode[4]; /* r/w/a, [+], [b], null */
if (!iodev)
- iodev = iodev_default(mem);
+ iodev = iodev_default(mem);
code = file_prepare_stream(fname, len, file_access, buffer_size, ps, fmode, mem);
if (code < 0)
- return code;
+ return code;
if (fname == 0)
- return 0;
+ return 0;
if (fname[0] == 0) /* fopen_proc gets NUL terminated string, not len */
- return 0; /* so this is the same as len == 0, so return NULL */
+ return 0; /* so this is the same as len == 0, so return NULL */
code = (*fopen_proc)(iodev, (char *)(*ps)->cbuf, fmode, &file,
- (char *)(*ps)->cbuf, (*ps)->bsize);
+ (char *)(*ps)->cbuf, (*ps)->bsize);
if (code < 0) {
- /* discard the stuff we allocated to keep from accumulating stuff needing GC */
- gs_free_object(mem, (*ps)->cbuf, "file_close(buffer)");
- gs_free_object(mem, *ps, "file_prepare_stream(stream)");
- *ps = NULL;
- return code;
+ /* discard the stuff we allocated to keep from accumulating stuff needing GC */
+ gs_free_object(mem, (*ps)->cbuf, "file_close(buffer)");
+ gs_free_object(mem, *ps, "file_prepare_stream(stream)");
+ *ps = NULL;
+ return code;
}
file_init_stream(*ps, file, fmode, (*ps)->cbuf, (*ps)->bsize);
return 0;
@@ -96,7 +96,7 @@ file_close_file(stream * s)
int code = file_close_disable(s);
if (code)
- return code;
+ return code;
/*
* Check for temporary streams created for filters.
* There may be more than one in the case of a procedure-based filter,
@@ -105,19 +105,19 @@ file_close_file(stream * s)
* allocated by file_alloc_stream, so we mustn't free them.
*/
while (stemp != 0 && stemp->is_temp != 0) {
- stream *snext = stemp->strm;
+ stream *snext = stemp->strm;
- mem = stemp->memory;
- if (stemp->is_temp > 1)
- gs_free_object(mem, stemp->cbuf,
- "file_close(temp stream buffer)");
- s_disable(stemp);
- stemp = snext;
+ mem = stemp->memory;
+ if (stemp->is_temp > 1)
+ gs_free_object(mem, stemp->cbuf,
+ "file_close(temp stream buffer)");
+ s_disable(stemp);
+ stemp = snext;
}
mem = s->memory;
gs_free_object(mem, s->cbuf, "file_close(buffer)");
if (s->close_strm && stemp != 0)
- return sclose(stemp);
+ return sclose(stemp);
return 0;
}
@@ -127,27 +127,27 @@ file_close_file(stream * s)
*/
void
file_init_stream(stream *s, FILE *file, const char *fmode, byte *buffer,
- uint buffer_size)
+ uint buffer_size)
{
switch (fmode[0]) {
case 'a':
- sappend_file(s, file, buffer, buffer_size);
- break;
+ sappend_file(s, file, buffer, buffer_size);
+ break;
case 'r':
- /* Defeat buffering for terminals. */
- {
- struct stat rstat;
+ /* Defeat buffering for terminals. */
+ {
+ struct stat rstat;
- fstat(fileno(file), &rstat);
- sread_file(s, file, buffer,
- (S_ISCHR(rstat.st_mode) ? 1 : buffer_size));
- }
- break;
+ fstat(fileno(file), &rstat);
+ sread_file(s, file, buffer,
+ (S_ISCHR(rstat.st_mode) ? 1 : buffer_size));
+ }
+ break;
case 'w':
- swrite_file(s, file, buffer, buffer_size);
+ swrite_file(s, file, buffer, buffer_size);
}
if (fmode[1] == '+')
- s->file_modes |= s_mode_read | s_mode_write;
+ s->file_modes |= s_mode_read | s_mode_write;
s->save_close = s->procs.close;
s->procs.close = file_close_file;
}
@@ -157,8 +157,8 @@ file_init_stream(stream *s, FILE *file, const char *fmode, byte *buffer,
/* On a successful return, the C file name is in the stream buffer. */
/* If fname==0, set up stream, and buffer. */
int
-file_prepare_stream(const char *fname, uint len, const char *file_access,
- uint buffer_size, stream ** ps, char fmode[4], gs_memory_t *mem)
+file_prepare_stream(const char *fname, uint len, const char *file_access,
+ uint buffer_size, stream ** ps, char fmode[4], gs_memory_t *mem)
{
byte *buffer;
register stream *s;
@@ -167,23 +167,23 @@ file_prepare_stream(const char *fname, uint len, const char *file_access,
strcpy(fmode, file_access);
strcat(fmode, gp_fmode_binary_suffix);
if (buffer_size == 0)
- buffer_size = file_default_buffer_size;
+ buffer_size = file_default_buffer_size;
if (len >= buffer_size) /* we copy the file name into the buffer */
- return_error(gs_error_limitcheck);
+ return_error(gs_error_limitcheck);
/* Allocate the stream first, since it persists */
/* even after the file has been closed. */
s = file_alloc_stream(mem, "file_prepare_stream");
if (s == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Allocate the buffer. */
buffer = gs_alloc_bytes(mem, buffer_size, "file_prepare_stream(buffer)");
if (buffer == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (fname != 0) {
- memcpy(buffer, fname, len);
- buffer[len] = 0; /* terminate string */
+ memcpy(buffer, fname, len);
+ buffer[len] = 0; /* terminate string */
} else
- buffer[0] = 0; /* safety */
+ buffer[0] = 0; /* safety */
s->cbuf = buffer;
s->bsize = s->cbsize = buffer_size;
s->save_close = 0; /* in case this stream gets disabled before init finishes */
diff --git a/gs/base/sfxfd.c b/gs/base/sfxfd.c
index a672e913f..cd379f7de 100644
--- a/gs/base/sfxfd.c
+++ b/gs/base/sfxfd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -58,13 +58,13 @@ static int
s_fileno_read_seek(stream *, long),
s_fileno_read_close(stream *),
s_fileno_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
s_fileno_write_seek(stream *, long),
s_fileno_write_flush(stream *),
s_fileno_write_close(stream *),
s_fileno_write_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
s_fileno_switch(stream *, bool);
@@ -107,9 +107,9 @@ void
sread_fileno(register stream * s, FILE * file, byte * buf, uint len)
{
static const stream_procs p = {
- s_fileno_available, s_fileno_read_seek, s_std_read_reset,
- s_std_read_flush, s_fileno_read_close, s_fileno_read_process,
- s_fileno_switch
+ s_fileno_available, s_fileno_read_seek, s_std_read_reset,
+ s_std_read_flush, s_fileno_read_close, s_fileno_read_process,
+ s_fileno_switch
};
/*
* There is no really portable way to test seekability,
@@ -120,9 +120,9 @@ sread_fileno(register stream * s, FILE * file, byte * buf, uint len)
bool seekable = (curpos != -1L && lseek(fd, curpos, SEEK_SET) != -1L);
s_std_init(s, buf, len, &p,
- (seekable ? s_mode_read + s_mode_seek : s_mode_read));
+ (seekable ? s_mode_read + s_mode_seek : s_mode_read));
if_debug2('s', "[s]read file=0x%lx, fd=%d\n", (ulong) file,
- fileno(file));
+ fileno(file));
s->file = file;
s->file_modes = s->modes;
s->file_offset = 0;
@@ -139,11 +139,11 @@ int
sread_subfile(stream *s, long start, long length)
{
if (s->file == 0 || s->modes != s_mode_read + s_mode_seek ||
- s->file_offset != 0 || s->file_limit != max_long ||
- ((s->position < start || s->position > start + length) &&
- sseek(s, start) < 0)
- )
- return ERRC;
+ s->file_offset != 0 || s->file_limit != max_long ||
+ ((s->position < start || s->position > start + length) &&
+ sseek(s, start) < 0)
+ )
+ return ERRC;
s->position -= start;
s->file_offset = start;
s->file_limit = length;
@@ -161,21 +161,21 @@ s_fileno_available(register stream * s, long *pl)
*pl = min(max_avail, buf_avail);
if (sseekable(s)) {
- long pos, end;
+ long pos, end;
- pos = ltell(fd);
- if (pos < 0)
- return ERRC;
- end = lseek(fd, 0L, SEEK_END);
- if (lseek(fd, pos, SEEK_SET) < 0 || end < 0)
- return ERRC;
- buf_avail += end - pos;
- *pl = min(max_avail, buf_avail);
- if (*pl == 0)
- *pl = -1; /* EOF */
+ pos = ltell(fd);
+ if (pos < 0)
+ return ERRC;
+ end = lseek(fd, 0L, SEEK_END);
+ if (lseek(fd, pos, SEEK_SET) < 0 || end < 0)
+ return ERRC;
+ buf_avail += end - pos;
+ *pl = min(max_avail, buf_avail);
+ if (*pl == 0)
+ *pl = -1; /* EOF */
} else {
- if (*pl == 0)
- *pl = -1; /* EOF */
+ if (*pl == 0)
+ *pl = -1; /* EOF */
}
return 0;
}
@@ -186,13 +186,13 @@ s_fileno_read_seek(register stream * s, long pos)
long offset = pos - s->position;
if (offset >= 0 && offset <= end) { /* Staying within the same buffer */
- s->srptr = s->cbuf + offset - 1;
- return 0;
+ s->srptr = s->cbuf + offset - 1;
+ return 0;
}
if (pos < 0 || pos > s->file_limit ||
- lseek(sfileno(s), s->file_offset + pos, SEEK_SET) < 0
- )
- return ERRC;
+ lseek(sfileno(s), s->file_offset + pos, SEEK_SET) < 0
+ )
+ return ERRC;
s->srptr = s->srlimit = s->cbuf - 1;
s->end_status = 0;
s->position = pos;
@@ -204,8 +204,8 @@ s_fileno_read_close(stream * s)
FILE *file = s->file;
if (file != 0) {
- s->file = 0;
- return (fclose(file) ? ERRC : 0);
+ s->file = 0;
+ return (fclose(file) ? ERRC : 0);
}
return 0;
}
@@ -214,7 +214,7 @@ s_fileno_read_close(stream * s)
/* This is the first stream in the pipeline, so pr is irrelevant. */
static int
s_fileno_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream *s = (stream *)st; /* no separate state */
int fd = sfileno(s);
@@ -225,10 +225,10 @@ again:
max_count = pw->limit - pw->ptr;
status = 1;
if (s->file_limit < max_long) {
- long limit_count = s->file_offset + s->file_limit - ltell(fd);
+ long limit_count = s->file_offset + s->file_limit - ltell(fd);
- if (max_count > limit_count)
- max_count = limit_count, status = EOFC;
+ if (max_count > limit_count)
+ max_count = limit_count, status = EOFC;
}
/*
* In the Mac MetroWerks compiler, the prototype for read incorrectly
@@ -237,13 +237,13 @@ again:
*/
nread = read(fd, (void *)(pw->ptr + 1), max_count);
if (nread > 0)
- pw->ptr += nread;
+ pw->ptr += nread;
else if (nread == 0)
- status = EOFC;
+ status = EOFC;
else if (errno_is_retry(errno)) /* Handle System V interrupts */
- goto again;
+ goto again;
else
- status = ERRC;
+ status = ERRC;
process_interrupts(s->memory);
return status;
}
@@ -255,15 +255,15 @@ void
swrite_fileno(register stream * s, FILE * file, byte * buf, uint len)
{
static const stream_procs p = {
- s_std_noavailable, s_fileno_write_seek, s_std_write_reset,
- s_fileno_write_flush, s_fileno_write_close, s_fileno_write_process,
- s_fileno_switch
+ s_std_noavailable, s_fileno_write_seek, s_std_write_reset,
+ s_fileno_write_flush, s_fileno_write_close, s_fileno_write_process,
+ s_fileno_switch
};
s_std_init(s, buf, len, &p,
- (file == stdout ? s_mode_write : s_mode_write + s_mode_seek));
+ (file == stdout ? s_mode_write : s_mode_write + s_mode_seek));
if_debug2('s', "[s]write file=0x%lx, fd=%d\n", (ulong) file,
- fileno(file));
+ fileno(file));
s->file = file;
s->file_modes = s->modes;
s->file_offset = 0; /* in case we switch to reading later */
@@ -286,9 +286,9 @@ s_fileno_write_seek(stream * s, long pos)
int code = sflush(s);
if (code < 0)
- return code;
+ return code;
if (lseek(sfileno(s), pos, SEEK_SET) < 0)
- return ERRC;
+ return ERRC;
s->position = pos;
return 0;
}
@@ -311,7 +311,7 @@ s_fileno_write_close(register stream * s)
/* This is the last stream in the pipeline, so pw is irrelevant. */
static int
s_fileno_write_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
int nwrite, status;
uint count;
@@ -321,18 +321,18 @@ again:
/* Some versions of the DEC C library on AXP architectures */
/* give an error on write if the count is zero! */
if (count == 0) {
- process_interrupts((stream*)st->memory);
- return 0;
+ process_interrupts((stream*)st->memory);
+ return 0;
}
/* See above regarding the Mac MetroWorks compiler. */
nwrite = write(sfileno((stream *)st), (const void *)(pr->ptr + 1), count);
if (nwrite >= 0) {
- pr->ptr += nwrite;
- status = 0;
+ pr->ptr += nwrite;
+ status = 0;
} else if (errno_is_retry(errno)) /* Handle System V interrupts */
- goto again;
+ goto again;
else
- status = ERRC;
+ status = ERRC;
process_interrupts((stream *)st->memory);
return status;
}
@@ -348,31 +348,31 @@ s_fileno_switch(stream * s, bool writing)
long pos;
if (writing) {
- if (!(s->file_modes & s_mode_write))
- return ERRC;
- pos = stell(s);
- if_debug2('s', "[s]switch 0x%lx to write at %ld\n",
- (ulong) s, pos);
- lseek(fd, pos, SEEK_SET); /* pacify OS */
- if (modes & s_mode_append) {
- sappend_file(s, s->file, s->cbuf, s->cbsize); /* sets position */
- } else {
- swrite_file(s, s->file, s->cbuf, s->cbsize);
- s->position = pos;
- }
- s->modes = modes;
+ if (!(s->file_modes & s_mode_write))
+ return ERRC;
+ pos = stell(s);
+ if_debug2('s', "[s]switch 0x%lx to write at %ld\n",
+ (ulong) s, pos);
+ lseek(fd, pos, SEEK_SET); /* pacify OS */
+ if (modes & s_mode_append) {
+ sappend_file(s, s->file, s->cbuf, s->cbsize); /* sets position */
+ } else {
+ swrite_file(s, s->file, s->cbuf, s->cbsize);
+ s->position = pos;
+ }
+ s->modes = modes;
} else {
- if (!(s->file_modes & s_mode_read))
- return ERRC;
- pos = stell(s);
- if_debug2('s', "[s]switch 0x%lx to read at %ld\n",
- (ulong) s, pos);
- if (sflush(s) < 0)
- return ERRC;
- lseek(fd, 0L, SEEK_CUR); /* pacify OS */
- sread_file(s, s->file, s->cbuf, s->cbsize);
- s->modes |= modes & s_mode_append; /* don't lose append info */
- s->position = pos;
+ if (!(s->file_modes & s_mode_read))
+ return ERRC;
+ pos = stell(s);
+ if_debug2('s', "[s]switch 0x%lx to read at %ld\n",
+ (ulong) s, pos);
+ if (sflush(s) < 0)
+ return ERRC;
+ lseek(fd, 0L, SEEK_CUR); /* pacify OS */
+ sread_file(s, s->file, s->cbuf, s->cbsize);
+ s->modes |= modes & s_mode_append; /* don't lose append info */
+ s->position = pos;
}
s->file_modes = modes;
return 0;
diff --git a/gs/base/sfxstdio.c b/gs/base/sfxstdio.c
index 6d68583a4..110d34c2e 100644
--- a/gs/base/sfxstdio.c
+++ b/gs/base/sfxstdio.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,13 +31,13 @@ static int
s_file_read_seek(stream *, long),
s_file_read_close(stream *),
s_file_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
s_file_write_seek(stream *, long),
s_file_write_flush(stream *),
s_file_write_close(stream *),
s_file_write_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
s_file_switch(stream *, bool);
@@ -48,9 +48,9 @@ void
sread_file(register stream * s, FILE * file, byte * buf, uint len)
{
static const stream_procs p = {
- s_file_available, s_file_read_seek, s_std_read_reset,
- s_std_read_flush, s_file_read_close, s_file_read_process,
- s_file_switch
+ s_file_available, s_file_read_seek, s_std_read_reset,
+ s_std_read_flush, s_file_read_close, s_file_read_process,
+ s_file_switch
};
/*
* There is no really portable way to test seekability, but this should
@@ -62,9 +62,9 @@ sread_file(register stream * s, FILE * file, byte * buf, uint len)
bool seekable = (curpos != -1L && fseek(file, curpos, SEEK_SET) == 0);
if (!had_error)
- clearerr(file);
+ clearerr(file);
s_std_init(s, buf, len, &p,
- (seekable ? s_mode_read + s_mode_seek : s_mode_read));
+ (seekable ? s_mode_read + s_mode_seek : s_mode_read));
if_debug1('s', "[s]read file=0x%lx\n", (ulong) file);
s->file = file;
s->file_modes = s->modes;
@@ -77,11 +77,11 @@ int
sread_subfile(stream *s, long start, long length)
{
if (s->file == 0 || s->modes != s_mode_read + s_mode_seek ||
- s->file_offset != 0 || s->file_limit != max_long ||
- ((s->position < start || s->position > start + length) &&
- sseek(s, start) < 0)
- )
- return ERRC;
+ s->file_offset != 0 || s->file_limit != max_long ||
+ ((s->position < start || s->position > start + length) &&
+ sseek(s, start) < 0)
+ )
+ return ERRC;
s->position -= start;
s->file_offset = start;
s->file_limit = length;
@@ -97,21 +97,21 @@ s_file_available(register stream * s, long *pl)
*pl = min(max_avail, buf_avail);
if (sseekable(s)) {
- long pos, end;
+ long pos, end;
- pos = ftell(s->file);
- if (fseek(s->file, 0L, SEEK_END))
- return ERRC;
- end = ftell(s->file);
- if (fseek(s->file, pos, SEEK_SET))
- return ERRC;
- buf_avail += end - pos;
- *pl = min(max_avail, buf_avail);
- if (*pl == 0)
- *pl = -1; /* EOF */
+ pos = ftell(s->file);
+ if (fseek(s->file, 0L, SEEK_END))
+ return ERRC;
+ end = ftell(s->file);
+ if (fseek(s->file, pos, SEEK_SET))
+ return ERRC;
+ buf_avail += end - pos;
+ *pl = min(max_avail, buf_avail);
+ if (*pl == 0)
+ *pl = -1; /* EOF */
} else {
- if (*pl == 0 && feof(s->file))
- *pl = -1; /* EOF */
+ if (*pl == 0 && feof(s->file))
+ *pl = -1; /* EOF */
}
return 0;
}
@@ -122,13 +122,13 @@ s_file_read_seek(register stream * s, long pos)
long offset = pos - s->position;
if (offset >= 0 && offset <= end) { /* Staying within the same buffer */
- s->srptr = s->cbuf + offset - 1;
- return 0;
+ s->srptr = s->cbuf + offset - 1;
+ return 0;
}
if (pos < 0 || pos > s->file_limit ||
- fseek(s->file, s->file_offset + pos, SEEK_SET) != 0
- )
- return ERRC;
+ fseek(s->file, s->file_offset + pos, SEEK_SET) != 0
+ )
+ return ERRC;
s->srptr = s->srlimit = s->cbuf - 1;
s->end_status = 0;
s->position = pos;
@@ -140,8 +140,8 @@ s_file_read_close(stream * s)
FILE *file = s->file;
if (file != 0) {
- s->file = 0;
- return (fclose(file) ? ERRC : 0);
+ s->file = 0;
+ return (fclose(file) ? ERRC : 0);
}
return 0;
}
@@ -152,7 +152,7 @@ s_file_read_close(stream * s)
*/
static int
s_file_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream *s = (stream *)st; /* no separate state */
FILE *file = s->file;
@@ -161,14 +161,14 @@ s_file_read_process(stream_state * st, stream_cursor_read * ignore_pr,
int count;
if (s->file_limit < max_long) {
- long limit_count = s->file_offset + s->file_limit - ftell(file);
+ long limit_count = s->file_offset + s->file_limit - ftell(file);
- if (max_count > limit_count)
- max_count = limit_count, status = EOFC;
+ if (max_count > limit_count)
+ max_count = limit_count, status = EOFC;
}
count = fread(pw->ptr + 1, 1, max_count, file);
if (count < 0)
- count = 0;
+ count = 0;
pw->ptr += count;
process_interrupts(s->memory);
return (ferror(file) ? ERRC : feof(file) ? EOFC : status);
@@ -181,13 +181,13 @@ void
swrite_file(register stream * s, FILE * file, byte * buf, uint len)
{
static const stream_procs p = {
- s_std_noavailable, s_file_write_seek, s_std_write_reset,
- s_file_write_flush, s_file_write_close, s_file_write_process,
- s_file_switch
+ s_std_noavailable, s_file_write_seek, s_std_write_reset,
+ s_file_write_flush, s_file_write_close, s_file_write_process,
+ s_file_switch
};
s_std_init(s, buf, len, &p,
- (file == stdout ? s_mode_write : s_mode_write + s_mode_seek));
+ (file == stdout ? s_mode_write : s_mode_write + s_mode_seek));
if_debug1('s', "[s]write file=0x%lx\n", (ulong) file);
s->file = file;
s->file_modes = s->modes;
@@ -212,9 +212,9 @@ s_file_write_seek(stream * s, long pos)
int code = sflush(s);
if (code < 0)
- return code;
+ return code;
if (fseek(s->file, pos, SEEK_SET) != 0)
- return ERRC;
+ return ERRC;
s->position = pos;
return 0;
}
@@ -239,7 +239,7 @@ s_file_write_close(register stream * s)
*/
static int
s_file_write_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
uint count = pr->limit - pr->ptr;
@@ -248,17 +248,17 @@ s_file_write_process(stream_state * st, stream_cursor_read * pr,
* fwrite if the count is zero!
*/
if (count != 0) {
- FILE *file = ((stream *) st)->file;
- int written = fwrite(pr->ptr + 1, 1, count, file);
+ FILE *file = ((stream *) st)->file;
+ int written = fwrite(pr->ptr + 1, 1, count, file);
- if (written < 0)
- written = 0;
- pr->ptr += written;
- process_interrupts(NULL);
- return (ferror(file) ? ERRC : 0);
+ if (written < 0)
+ written = 0;
+ pr->ptr += written;
+ process_interrupts(NULL);
+ return (ferror(file) ? ERRC : 0);
} else {
- process_interrupts(NULL);
- return 0;
+ process_interrupts(NULL);
+ return 0;
}
}
@@ -273,31 +273,31 @@ s_file_switch(stream * s, bool writing)
long pos;
if (writing) {
- if (!(s->file_modes & s_mode_write))
- return ERRC;
- pos = stell(s);
- if_debug2('s', "[s]switch 0x%lx to write at %ld\n",
- (ulong) s, pos);
- fseek(file, pos, SEEK_SET);
- if (modes & s_mode_append) {
- sappend_file(s, file, s->cbuf, s->cbsize); /* sets position */
- } else {
- swrite_file(s, file, s->cbuf, s->cbsize);
- s->position = pos;
- }
- s->modes = modes;
+ if (!(s->file_modes & s_mode_write))
+ return ERRC;
+ pos = stell(s);
+ if_debug2('s', "[s]switch 0x%lx to write at %ld\n",
+ (ulong) s, pos);
+ fseek(file, pos, SEEK_SET);
+ if (modes & s_mode_append) {
+ sappend_file(s, file, s->cbuf, s->cbsize); /* sets position */
+ } else {
+ swrite_file(s, file, s->cbuf, s->cbsize);
+ s->position = pos;
+ }
+ s->modes = modes;
} else {
- if (!(s->file_modes & s_mode_read))
- return ERRC;
- pos = stell(s);
- if_debug2('s', "[s]switch 0x%lx to read at %ld\n",
- (ulong) s, pos);
- if (sflush(s) < 0)
- return ERRC;
- fseek(file, 0L, SEEK_CUR); /* pacify C library */
- sread_file(s, file, s->cbuf, s->cbsize);
- s->modes |= modes & s_mode_append; /* don't lose append info */
- s->position = pos;
+ if (!(s->file_modes & s_mode_read))
+ return ERRC;
+ pos = stell(s);
+ if_debug2('s', "[s]switch 0x%lx to read at %ld\n",
+ (ulong) s, pos);
+ if (sflush(s) < 0)
+ return ERRC;
+ fseek(file, 0L, SEEK_CUR); /* pacify C library */
+ sread_file(s, file, s->cbuf, s->cbsize);
+ s->modes |= modes & s_mode_append; /* don't lose append info */
+ s->position = pos;
}
s->file_modes = modes;
return 0;
diff --git a/gs/base/sha2.c b/gs/base/sha2.c
index f9ac3ed75..d55438541 100644
--- a/gs/base/sha2.c
+++ b/gs/base/sha2.c
@@ -1,7 +1,7 @@
/*
* FILE: sha2.c
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
- *
+ *
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
@@ -16,7 +16,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -56,7 +56,6 @@
*
*/
-
/*** SHA-256/384/512 Machine Architecture Definitions *****************/
/*
* BYTE_ORDER NOTE:
@@ -74,7 +73,7 @@
*
* And for little-endian machines, add:
*
- * #define BYTE_ORDER LITTLE_ENDIAN
+ * #define BYTE_ORDER LITTLE_ENDIAN
*
* Or for big-endian machines:
*
@@ -103,7 +102,6 @@
# define BYTE_ORDER LITTLE_ENDIAN
#endif
-
#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
#endif
@@ -149,21 +147,20 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16)
#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16)
-
/*** ENDIAN REVERSAL MACROS *******************************************/
#if BYTE_ORDER == LITTLE_ENDIAN
#define REVERSE32(w,x) { \
- sha2_word32 tmp = (w); \
- tmp = (tmp >> 16) | (tmp << 16); \
- (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
+ sha2_word32 tmp = (w); \
+ tmp = (tmp >> 16) | (tmp << 16); \
+ (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
}
#define REVERSE64(w,x) { \
- sha2_word64 tmp = (w); \
- tmp = (tmp >> 32) | (tmp << 32); \
- tmp = ((tmp & ULL(0xff00ff00ff00ff00)) >> 8) | \
- ((tmp & ULL(0x00ff00ff00ff00ff)) << 8); \
- (x) = ((tmp & ULL(0xffff0000ffff0000)) >> 16) | \
- ((tmp & ULL(0x0000ffff0000ffff)) << 16); \
+ sha2_word64 tmp = (w); \
+ tmp = (tmp >> 32) | (tmp << 32); \
+ tmp = ((tmp & ULL(0xff00ff00ff00ff00)) >> 8) | \
+ ((tmp & ULL(0x00ff00ff00ff00ff)) << 8); \
+ (x) = ((tmp & ULL(0xffff0000ffff0000)) >> 16) | \
+ ((tmp & ULL(0x0000ffff0000ffff)) << 16); \
}
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
@@ -173,10 +170,10 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
* 64-bit words):
*/
#define ADDINC128(w,n) { \
- (w)[0] += (sha2_word64)(n); \
- if ((w)[0] < (n)) { \
- (w)[1]++; \
- } \
+ (w)[0] += (sha2_word64)(n); \
+ if ((w)[0] < (n)) { \
+ (w)[1]++; \
+ } \
}
/*
@@ -206,7 +203,6 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l))
#endif
-
/*** THE SIX LOGICAL FUNCTIONS ****************************************/
/*
* Bit shifting and rotation (used by the six SHA-XYZ logical functions:
@@ -248,106 +244,105 @@ void SHA512_Last(SHA512_CTX*);
void SHA256_Transform(SHA256_CTX*, const sha2_word32*);
void SHA512_Transform(SHA512_CTX*, const sha2_word64*);
-
/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
/* Hash constant words K for SHA-256: */
const static sha2_word32 K256[64] = {
- 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
- 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
- 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
- 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
- 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
- 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
- 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
- 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
- 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
- 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
- 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
- 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
- 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
- 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
- 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
- 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
+ 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
+ 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
+ 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
+ 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
+ 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
+ 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
+ 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
+ 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
+ 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
+ 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
+ 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
+ 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
+ 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
+ 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
+ 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
+ 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
};
/* Initial hash value H for SHA-256: */
const static sha2_word32 sha256_initial_hash_value[8] = {
- 0x6a09e667UL,
- 0xbb67ae85UL,
- 0x3c6ef372UL,
- 0xa54ff53aUL,
- 0x510e527fUL,
- 0x9b05688cUL,
- 0x1f83d9abUL,
- 0x5be0cd19UL
+ 0x6a09e667UL,
+ 0xbb67ae85UL,
+ 0x3c6ef372UL,
+ 0xa54ff53aUL,
+ 0x510e527fUL,
+ 0x9b05688cUL,
+ 0x1f83d9abUL,
+ 0x5be0cd19UL
};
/* Hash constant words K for SHA-384 and SHA-512: */
const static sha2_word64 K512[80] = {
- ULL(0x428a2f98d728ae22), ULL(0x7137449123ef65cd),
- ULL(0xb5c0fbcfec4d3b2f), ULL(0xe9b5dba58189dbbc),
- ULL(0x3956c25bf348b538), ULL(0x59f111f1b605d019),
- ULL(0x923f82a4af194f9b), ULL(0xab1c5ed5da6d8118),
- ULL(0xd807aa98a3030242), ULL(0x12835b0145706fbe),
- ULL(0x243185be4ee4b28c), ULL(0x550c7dc3d5ffb4e2),
- ULL(0x72be5d74f27b896f), ULL(0x80deb1fe3b1696b1),
- ULL(0x9bdc06a725c71235), ULL(0xc19bf174cf692694),
- ULL(0xe49b69c19ef14ad2), ULL(0xefbe4786384f25e3),
- ULL(0x0fc19dc68b8cd5b5), ULL(0x240ca1cc77ac9c65),
- ULL(0x2de92c6f592b0275), ULL(0x4a7484aa6ea6e483),
- ULL(0x5cb0a9dcbd41fbd4), ULL(0x76f988da831153b5),
- ULL(0x983e5152ee66dfab), ULL(0xa831c66d2db43210),
- ULL(0xb00327c898fb213f), ULL(0xbf597fc7beef0ee4),
- ULL(0xc6e00bf33da88fc2), ULL(0xd5a79147930aa725),
- ULL(0x06ca6351e003826f), ULL(0x142929670a0e6e70),
- ULL(0x27b70a8546d22ffc), ULL(0x2e1b21385c26c926),
- ULL(0x4d2c6dfc5ac42aed), ULL(0x53380d139d95b3df),
- ULL(0x650a73548baf63de), ULL(0x766a0abb3c77b2a8),
- ULL(0x81c2c92e47edaee6), ULL(0x92722c851482353b),
- ULL(0xa2bfe8a14cf10364), ULL(0xa81a664bbc423001),
- ULL(0xc24b8b70d0f89791), ULL(0xc76c51a30654be30),
- ULL(0xd192e819d6ef5218), ULL(0xd69906245565a910),
- ULL(0xf40e35855771202a), ULL(0x106aa07032bbd1b8),
- ULL(0x19a4c116b8d2d0c8), ULL(0x1e376c085141ab53),
- ULL(0x2748774cdf8eeb99), ULL(0x34b0bcb5e19b48a8),
- ULL(0x391c0cb3c5c95a63), ULL(0x4ed8aa4ae3418acb),
- ULL(0x5b9cca4f7763e373), ULL(0x682e6ff3d6b2b8a3),
- ULL(0x748f82ee5defb2fc), ULL(0x78a5636f43172f60),
- ULL(0x84c87814a1f0ab72), ULL(0x8cc702081a6439ec),
- ULL(0x90befffa23631e28), ULL(0xa4506cebde82bde9),
- ULL(0xbef9a3f7b2c67915), ULL(0xc67178f2e372532b),
- ULL(0xca273eceea26619c), ULL(0xd186b8c721c0c207),
- ULL(0xeada7dd6cde0eb1e), ULL(0xf57d4f7fee6ed178),
- ULL(0x06f067aa72176fba), ULL(0x0a637dc5a2c898a6),
- ULL(0x113f9804bef90dae), ULL(0x1b710b35131c471b),
- ULL(0x28db77f523047d84), ULL(0x32caab7b40c72493),
- ULL(0x3c9ebe0a15c9bebc), ULL(0x431d67c49c100d4c),
- ULL(0x4cc5d4becb3e42b6), ULL(0x597f299cfc657e2a),
- ULL(0x5fcb6fab3ad6faec), ULL(0x6c44198c4a475817)
+ ULL(0x428a2f98d728ae22), ULL(0x7137449123ef65cd),
+ ULL(0xb5c0fbcfec4d3b2f), ULL(0xe9b5dba58189dbbc),
+ ULL(0x3956c25bf348b538), ULL(0x59f111f1b605d019),
+ ULL(0x923f82a4af194f9b), ULL(0xab1c5ed5da6d8118),
+ ULL(0xd807aa98a3030242), ULL(0x12835b0145706fbe),
+ ULL(0x243185be4ee4b28c), ULL(0x550c7dc3d5ffb4e2),
+ ULL(0x72be5d74f27b896f), ULL(0x80deb1fe3b1696b1),
+ ULL(0x9bdc06a725c71235), ULL(0xc19bf174cf692694),
+ ULL(0xe49b69c19ef14ad2), ULL(0xefbe4786384f25e3),
+ ULL(0x0fc19dc68b8cd5b5), ULL(0x240ca1cc77ac9c65),
+ ULL(0x2de92c6f592b0275), ULL(0x4a7484aa6ea6e483),
+ ULL(0x5cb0a9dcbd41fbd4), ULL(0x76f988da831153b5),
+ ULL(0x983e5152ee66dfab), ULL(0xa831c66d2db43210),
+ ULL(0xb00327c898fb213f), ULL(0xbf597fc7beef0ee4),
+ ULL(0xc6e00bf33da88fc2), ULL(0xd5a79147930aa725),
+ ULL(0x06ca6351e003826f), ULL(0x142929670a0e6e70),
+ ULL(0x27b70a8546d22ffc), ULL(0x2e1b21385c26c926),
+ ULL(0x4d2c6dfc5ac42aed), ULL(0x53380d139d95b3df),
+ ULL(0x650a73548baf63de), ULL(0x766a0abb3c77b2a8),
+ ULL(0x81c2c92e47edaee6), ULL(0x92722c851482353b),
+ ULL(0xa2bfe8a14cf10364), ULL(0xa81a664bbc423001),
+ ULL(0xc24b8b70d0f89791), ULL(0xc76c51a30654be30),
+ ULL(0xd192e819d6ef5218), ULL(0xd69906245565a910),
+ ULL(0xf40e35855771202a), ULL(0x106aa07032bbd1b8),
+ ULL(0x19a4c116b8d2d0c8), ULL(0x1e376c085141ab53),
+ ULL(0x2748774cdf8eeb99), ULL(0x34b0bcb5e19b48a8),
+ ULL(0x391c0cb3c5c95a63), ULL(0x4ed8aa4ae3418acb),
+ ULL(0x5b9cca4f7763e373), ULL(0x682e6ff3d6b2b8a3),
+ ULL(0x748f82ee5defb2fc), ULL(0x78a5636f43172f60),
+ ULL(0x84c87814a1f0ab72), ULL(0x8cc702081a6439ec),
+ ULL(0x90befffa23631e28), ULL(0xa4506cebde82bde9),
+ ULL(0xbef9a3f7b2c67915), ULL(0xc67178f2e372532b),
+ ULL(0xca273eceea26619c), ULL(0xd186b8c721c0c207),
+ ULL(0xeada7dd6cde0eb1e), ULL(0xf57d4f7fee6ed178),
+ ULL(0x06f067aa72176fba), ULL(0x0a637dc5a2c898a6),
+ ULL(0x113f9804bef90dae), ULL(0x1b710b35131c471b),
+ ULL(0x28db77f523047d84), ULL(0x32caab7b40c72493),
+ ULL(0x3c9ebe0a15c9bebc), ULL(0x431d67c49c100d4c),
+ ULL(0x4cc5d4becb3e42b6), ULL(0x597f299cfc657e2a),
+ ULL(0x5fcb6fab3ad6faec), ULL(0x6c44198c4a475817)
};
/* Initial hash value H for SHA-384 */
const static sha2_word64 sha384_initial_hash_value[8] = {
- ULL(0xcbbb9d5dc1059ed8),
- ULL(0x629a292a367cd507),
- ULL(0x9159015a3070dd17),
- ULL(0x152fecd8f70e5939),
- ULL(0x67332667ffc00b31),
- ULL(0x8eb44a8768581511),
- ULL(0xdb0c2e0d64f98fa7),
- ULL(0x47b5481dbefa4fa4)
+ ULL(0xcbbb9d5dc1059ed8),
+ ULL(0x629a292a367cd507),
+ ULL(0x9159015a3070dd17),
+ ULL(0x152fecd8f70e5939),
+ ULL(0x67332667ffc00b31),
+ ULL(0x8eb44a8768581511),
+ ULL(0xdb0c2e0d64f98fa7),
+ ULL(0x47b5481dbefa4fa4)
};
/* Initial hash value H for SHA-512 */
const static sha2_word64 sha512_initial_hash_value[8] = {
- ULL(0x6a09e667f3bcc908),
- ULL(0xbb67ae8584caa73b),
- ULL(0x3c6ef372fe94f82b),
- ULL(0xa54ff53a5f1d36f1),
- ULL(0x510e527fade682d1),
- ULL(0x9b05688c2b3e6c1f),
- ULL(0x1f83d9abfb41bd6b),
- ULL(0x5be0cd19137e2179)
+ ULL(0x6a09e667f3bcc908),
+ ULL(0xbb67ae8584caa73b),
+ ULL(0x3c6ef372fe94f82b),
+ ULL(0xa54ff53a5f1d36f1),
+ ULL(0x510e527fade682d1),
+ ULL(0x9b05688c2b3e6c1f),
+ ULL(0x1f83d9abfb41bd6b),
+ ULL(0x5be0cd19137e2179)
};
/*
@@ -356,15 +351,14 @@ const static sha2_word64 sha512_initial_hash_value[8] = {
*/
static const char *sha2_hex_digits = "0123456789abcdef";
-
/*** SHA-256: *********************************************************/
void SHA256_Init(SHA256_CTX* context) {
- if (context == (SHA256_CTX*)0) {
- return;
- }
- MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
- MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
- context->bitcount = 0;
+ if (context == (SHA256_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
+ context->bitcount = 0;
}
#ifdef SHA2_UNROLL_TRANSFORM
@@ -374,325 +368,323 @@ void SHA256_Init(SHA256_CTX* context) {
#if BYTE_ORDER == LITTLE_ENDIAN
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
- REVERSE32(*data++, W256[j]); \
- T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ REVERSE32(*data++, W256[j]); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
K256[j] + W256[j]; \
- (d) += T1; \
- (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
- j++
-
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \
- T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
- K256[j] + (W256[j] = *data++); \
- (d) += T1; \
- (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
- j++
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
+ K256[j] + (W256[j] = *data++); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND256(a,b,c,d,e,f,g,h) \
- s0 = W256[(j+1)&0x0f]; \
- s0 = sigma0_256(s0); \
- s1 = W256[(j+14)&0x0f]; \
- s1 = sigma1_256(s1); \
- T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
- (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
- (d) += T1; \
- (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
- j++
+ s0 = W256[(j+1)&0x0f]; \
+ s0 = sigma0_256(s0); \
+ s1 = W256[(j+14)&0x0f]; \
+ s1 = sigma1_256(s1); \
+ T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
+ (d) += T1; \
+ (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
+ j++
void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
- sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
- sha2_word32 T1, *W256;
- int j;
-
- W256 = (sha2_word32*)context->buffer;
-
- /* Initialize registers with the prev. intermediate value */
- a = context->state[0];
- b = context->state[1];
- c = context->state[2];
- d = context->state[3];
- e = context->state[4];
- f = context->state[5];
- g = context->state[6];
- h = context->state[7];
-
- j = 0;
- do {
- /* Rounds 0 to 15 (unrolled): */
- ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
- ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
- ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
- ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
- ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
- ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
- ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
- ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
- } while (j < 16);
-
- /* Now for the remaining rounds to 64: */
- do {
- ROUND256(a,b,c,d,e,f,g,h);
- ROUND256(h,a,b,c,d,e,f,g);
- ROUND256(g,h,a,b,c,d,e,f);
- ROUND256(f,g,h,a,b,c,d,e);
- ROUND256(e,f,g,h,a,b,c,d);
- ROUND256(d,e,f,g,h,a,b,c);
- ROUND256(c,d,e,f,g,h,a,b);
- ROUND256(b,c,d,e,f,g,h,a);
- } while (j < 64);
-
- /* Compute the current intermediate hash value */
- context->state[0] += a;
- context->state[1] += b;
- context->state[2] += c;
- context->state[3] += d;
- context->state[4] += e;
- context->state[5] += f;
- context->state[6] += g;
- context->state[7] += h;
-
- /* Clean up */
- a = b = c = d = e = f = g = h = T1 = 0;
+ sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word32 T1, *W256;
+ int j;
+
+ W256 = (sha2_word32*)context->buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+ /* Rounds 0 to 15 (unrolled): */
+ ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds to 64: */
+ do {
+ ROUND256(a,b,c,d,e,f,g,h);
+ ROUND256(h,a,b,c,d,e,f,g);
+ ROUND256(g,h,a,b,c,d,e,f);
+ ROUND256(f,g,h,a,b,c,d,e);
+ ROUND256(e,f,g,h,a,b,c,d);
+ ROUND256(d,e,f,g,h,a,b,c);
+ ROUND256(c,d,e,f,g,h,a,b);
+ ROUND256(b,c,d,e,f,g,h,a);
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
}
#else /* SHA2_UNROLL_TRANSFORM */
void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
- sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
- sha2_word32 T1, T2, *W256;
- int j;
-
- W256 = (sha2_word32*)context->buffer;
-
- /* Initialize registers with the prev. intermediate value */
- a = context->state[0];
- b = context->state[1];
- c = context->state[2];
- d = context->state[3];
- e = context->state[4];
- f = context->state[5];
- g = context->state[6];
- h = context->state[7];
-
- j = 0;
- do {
+ sha2_word32 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word32 T1, T2, *W256;
+ int j;
+
+ W256 = (sha2_word32*)context->buffer;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
#if BYTE_ORDER == LITTLE_ENDIAN
- /* Copy data while converting to host byte order */
- REVERSE32(*data++,W256[j]);
- /* Apply the SHA-256 compression function to update a..h */
- T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
+ /* Copy data while converting to host byte order */
+ REVERSE32(*data++,W256[j]);
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
#else /* BYTE_ORDER == LITTLE_ENDIAN */
- /* Apply the SHA-256 compression function to update a..h with copy */
- T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
+ /* Apply the SHA-256 compression function to update a..h with copy */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
- T2 = Sigma0_256(a) + Maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + T1;
- d = c;
- c = b;
- b = a;
- a = T1 + T2;
-
- j++;
- } while (j < 16);
-
- do {
- /* Part of the message block expansion: */
- s0 = W256[(j+1)&0x0f];
- s0 = sigma0_256(s0);
- s1 = W256[(j+14)&0x0f];
- s1 = sigma1_256(s1);
-
- /* Apply the SHA-256 compression function to update a..h */
- T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
- (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
- T2 = Sigma0_256(a) + Maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + T1;
- d = c;
- c = b;
- b = a;
- a = T1 + T2;
-
- j++;
- } while (j < 64);
-
- /* Compute the current intermediate hash value */
- context->state[0] += a;
- context->state[1] += b;
- context->state[2] += c;
- context->state[3] += d;
- context->state[4] += e;
- context->state[5] += f;
- context->state[6] += g;
- context->state[7] += h;
-
- /* Clean up */
- a = b = c = d = e = f = g = h = T1 = T2 = 0;
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W256[(j+1)&0x0f];
+ s0 = sigma0_256(s0);
+ s1 = W256[(j+14)&0x0f];
+ s1 = sigma1_256(s1);
+
+ /* Apply the SHA-256 compression function to update a..h */
+ T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] +
+ (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
+ T2 = Sigma0_256(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 64);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
}
#endif /* SHA2_UNROLL_TRANSFORM */
void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
- unsigned int freespace, usedspace;
-
- if (len == 0) {
- /* Calling with no data is valid - we do nothing */
- return;
- }
-
- /* Sanity check: */
- assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
-
- usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
- if (usedspace > 0) {
- /* Calculate how much free space is available in the buffer */
- freespace = SHA256_BLOCK_LENGTH - usedspace;
-
- if (len >= freespace) {
- /* Fill the buffer completely and process it */
- MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
- context->bitcount += freespace << 3;
- len -= freespace;
- data += freespace;
- SHA256_Transform(context, (sha2_word32*)context->buffer);
- } else {
- /* The buffer is not yet full */
- MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
- context->bitcount += len << 3;
- /* Clean up: */
- usedspace = freespace = 0;
- return;
- }
- }
- while (len >= SHA256_BLOCK_LENGTH) {
- /* Process as many complete blocks as we can */
- SHA256_Transform(context, (sha2_word32*)data);
- context->bitcount += SHA256_BLOCK_LENGTH << 3;
- len -= SHA256_BLOCK_LENGTH;
- data += SHA256_BLOCK_LENGTH;
- }
- if (len > 0) {
- /* There's left-overs, so save 'em */
- MEMCPY_BCOPY(context->buffer, data, len);
- context->bitcount += len << 3;
- }
- /* Clean up: */
- usedspace = freespace = 0;
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
+
+ usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = SHA256_BLOCK_LENGTH - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
+ context->bitcount += freespace << 3;
+ len -= freespace;
+ data += freespace;
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
+ context->bitcount += len << 3;
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= SHA256_BLOCK_LENGTH) {
+ /* Process as many complete blocks as we can */
+ SHA256_Transform(context, (sha2_word32*)data);
+ context->bitcount += SHA256_BLOCK_LENGTH << 3;
+ len -= SHA256_BLOCK_LENGTH;
+ data += SHA256_BLOCK_LENGTH;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->buffer, data, len);
+ context->bitcount += len << 3;
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
}
void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
- sha2_word32 *d = (sha2_word32*)digest;
- unsigned int usedspace;
+ sha2_word32 *d = (sha2_word32*)digest;
+ unsigned int usedspace;
- /* Sanity check: */
- assert(context != (SHA256_CTX*)0);
+ /* Sanity check: */
+ assert(context != (SHA256_CTX*)0);
- /* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
- usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
- /* Convert FROM host byte order */
- REVERSE64(context->bitcount,context->bitcount);
+ /* Convert FROM host byte order */
+ REVERSE64(context->bitcount,context->bitcount);
#endif
- if (usedspace > 0) {
- /* Begin padding with a 1 bit: */
- context->buffer[usedspace++] = 0x80;
-
- if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
- /* Set-up for the last transform: */
- MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
- } else {
- if (usedspace < SHA256_BLOCK_LENGTH) {
- MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace);
- }
- /* Do second-to-last transform: */
- SHA256_Transform(context, (sha2_word32*)context->buffer);
-
- /* And set-up for the last transform: */
- MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
- }
- } else {
- /* Set-up for the last transform: */
- MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
-
- /* Begin padding with a 1 bit: */
- *context->buffer = 0x80;
- }
- /* Set the bit count: */
- *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
-
- /* Final transform: */
- SHA256_Transform(context, (sha2_word32*)context->buffer);
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->buffer[usedspace++] = 0x80;
+
+ if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace);
+ } else {
+ if (usedspace < SHA256_BLOCK_LENGTH) {
+ MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
+ }
+ } else {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH);
+
+ /* Begin padding with a 1 bit: */
+ *context->buffer = 0x80;
+ }
+ /* Set the bit count: */
+ *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+
+ /* Final transform: */
+ SHA256_Transform(context, (sha2_word32*)context->buffer);
#if BYTE_ORDER == LITTLE_ENDIAN
- {
- /* Convert TO host byte order */
- int j;
- for (j = 0; j < 8; j++) {
- REVERSE32(context->state[j],context->state[j]);
- *d++ = context->state[j];
- }
- }
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 8; j++) {
+ REVERSE32(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
#else
- MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH);
+ MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH);
#endif
- }
+ }
- /* Clean up state data: */
- MEMSET_BZERO(context, sizeof(context));
- usedspace = 0;
+ /* Clean up state data: */
+ MEMSET_BZERO(context, sizeof(context));
+ usedspace = 0;
}
char *SHA256_End(SHA256_CTX* context, char buffer[]) {
- sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
- int i;
-
- /* Sanity check: */
- assert(context != (SHA256_CTX*)0);
-
- if (buffer != (char*)0) {
- SHA256_Final(digest, context);
-
- for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char)0;
- } else {
- MEMSET_BZERO(context, sizeof(context));
- }
- MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
- return buffer;
+ sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA256_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA256_Final(digest, context);
+
+ for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(context));
+ }
+ MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
+ return buffer;
}
char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) {
- SHA256_CTX context;
+ SHA256_CTX context;
- SHA256_Init(&context);
- SHA256_Update(&context, data, len);
- return SHA256_End(&context, digest);
+ SHA256_Init(&context);
+ SHA256_Update(&context, data, len);
+ return SHA256_End(&context, digest);
}
-
/*** SHA-512: *********************************************************/
void SHA512_Init(SHA512_CTX* context) {
- if (context == (SHA512_CTX*)0) {
- return;
- }
- MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
- MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
- context->bitcount[0] = context->bitcount[1] = 0;
+ if (context == (SHA512_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
+ context->bitcount[0] = context->bitcount[1] = 0;
}
#ifdef SHA2_UNROLL_TRANSFORM
@@ -701,390 +693,387 @@ void SHA512_Init(SHA512_CTX* context) {
#if BYTE_ORDER == LITTLE_ENDIAN
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
- REVERSE64(*data++, W512[j]); \
- T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ REVERSE64(*data++, W512[j]); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
K512[j] + W512[j]; \
- (d) += T1, \
- (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
- j++
-
+ (d) += T1, \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
+ j++
#else /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \
- T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
K512[j] + (W512[j] = *data++); \
- (d) += T1; \
- (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
- j++
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
#define ROUND512(a,b,c,d,e,f,g,h) \
- s0 = W512[(j+1)&0x0f]; \
- s0 = sigma0_512(s0); \
- s1 = W512[(j+14)&0x0f]; \
- s1 = sigma1_512(s1); \
- T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
+ s0 = W512[(j+1)&0x0f]; \
+ s0 = sigma0_512(s0); \
+ s1 = W512[(j+14)&0x0f]; \
+ s1 = sigma1_512(s1); \
+ T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
(W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
- (d) += T1; \
- (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
- j++
+ (d) += T1; \
+ (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
+ j++
void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
- sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
- sha2_word64 T1, *W512 = (sha2_word64*)context->buffer;
- int j;
-
- /* Initialize registers with the prev. intermediate value */
- a = context->state[0];
- b = context->state[1];
- c = context->state[2];
- d = context->state[3];
- e = context->state[4];
- f = context->state[5];
- g = context->state[6];
- h = context->state[7];
-
- j = 0;
- do {
- ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
- ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
- ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
- ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
- ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
- ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
- ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
- ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
- } while (j < 16);
-
- /* Now for the remaining rounds up to 79: */
- do {
- ROUND512(a,b,c,d,e,f,g,h);
- ROUND512(h,a,b,c,d,e,f,g);
- ROUND512(g,h,a,b,c,d,e,f);
- ROUND512(f,g,h,a,b,c,d,e);
- ROUND512(e,f,g,h,a,b,c,d);
- ROUND512(d,e,f,g,h,a,b,c);
- ROUND512(c,d,e,f,g,h,a,b);
- ROUND512(b,c,d,e,f,g,h,a);
- } while (j < 80);
-
- /* Compute the current intermediate hash value */
- context->state[0] += a;
- context->state[1] += b;
- context->state[2] += c;
- context->state[3] += d;
- context->state[4] += e;
- context->state[5] += f;
- context->state[6] += g;
- context->state[7] += h;
-
- /* Clean up */
- a = b = c = d = e = f = g = h = T1 = 0;
+ sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word64 T1, *W512 = (sha2_word64*)context->buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
+ ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
+ ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
+ ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
+ ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
+ ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
+ ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
+ ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
+ ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
+ } while (j < 16);
+
+ /* Now for the remaining rounds up to 79: */
+ do {
+ ROUND512(a,b,c,d,e,f,g,h);
+ ROUND512(h,a,b,c,d,e,f,g);
+ ROUND512(g,h,a,b,c,d,e,f);
+ ROUND512(f,g,h,a,b,c,d,e);
+ ROUND512(e,f,g,h,a,b,c,d);
+ ROUND512(d,e,f,g,h,a,b,c);
+ ROUND512(c,d,e,f,g,h,a,b);
+ ROUND512(b,c,d,e,f,g,h,a);
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = 0;
}
#else /* SHA2_UNROLL_TRANSFORM */
void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
- sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
- sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer;
- int j;
-
- /* Initialize registers with the prev. intermediate value */
- a = context->state[0];
- b = context->state[1];
- c = context->state[2];
- d = context->state[3];
- e = context->state[4];
- f = context->state[5];
- g = context->state[6];
- h = context->state[7];
-
- j = 0;
- do {
+ sha2_word64 a, b, c, d, e, f, g, h, s0, s1;
+ sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer;
+ int j;
+
+ /* Initialize registers with the prev. intermediate value */
+ a = context->state[0];
+ b = context->state[1];
+ c = context->state[2];
+ d = context->state[3];
+ e = context->state[4];
+ f = context->state[5];
+ g = context->state[6];
+ h = context->state[7];
+
+ j = 0;
+ do {
#if BYTE_ORDER == LITTLE_ENDIAN
- /* Convert TO host byte order */
- REVERSE64(*data++, W512[j]);
- /* Apply the SHA-512 compression function to update a..h */
- T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
+ /* Convert TO host byte order */
+ REVERSE64(*data++, W512[j]);
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
#else /* BYTE_ORDER == LITTLE_ENDIAN */
- /* Apply the SHA-512 compression function to update a..h with copy */
- T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
+ /* Apply the SHA-512 compression function to update a..h with copy */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
- T2 = Sigma0_512(a) + Maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + T1;
- d = c;
- c = b;
- b = a;
- a = T1 + T2;
-
- j++;
- } while (j < 16);
-
- do {
- /* Part of the message block expansion: */
- s0 = W512[(j+1)&0x0f];
- s0 = sigma0_512(s0);
- s1 = W512[(j+14)&0x0f];
- s1 = sigma1_512(s1);
-
- /* Apply the SHA-512 compression function to update a..h */
- T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
- (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
- T2 = Sigma0_512(a) + Maj(a, b, c);
- h = g;
- g = f;
- f = e;
- e = d + T1;
- d = c;
- c = b;
- b = a;
- a = T1 + T2;
-
- j++;
- } while (j < 80);
-
- /* Compute the current intermediate hash value */
- context->state[0] += a;
- context->state[1] += b;
- context->state[2] += c;
- context->state[3] += d;
- context->state[4] += e;
- context->state[5] += f;
- context->state[6] += g;
- context->state[7] += h;
-
- /* Clean up */
- a = b = c = d = e = f = g = h = T1 = T2 = 0;
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 16);
+
+ do {
+ /* Part of the message block expansion: */
+ s0 = W512[(j+1)&0x0f];
+ s0 = sigma0_512(s0);
+ s1 = W512[(j+14)&0x0f];
+ s1 = sigma1_512(s1);
+
+ /* Apply the SHA-512 compression function to update a..h */
+ T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
+ (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
+ T2 = Sigma0_512(a) + Maj(a, b, c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + T1;
+ d = c;
+ c = b;
+ b = a;
+ a = T1 + T2;
+
+ j++;
+ } while (j < 80);
+
+ /* Compute the current intermediate hash value */
+ context->state[0] += a;
+ context->state[1] += b;
+ context->state[2] += c;
+ context->state[3] += d;
+ context->state[4] += e;
+ context->state[5] += f;
+ context->state[6] += g;
+ context->state[7] += h;
+
+ /* Clean up */
+ a = b = c = d = e = f = g = h = T1 = T2 = 0;
}
#endif /* SHA2_UNROLL_TRANSFORM */
void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
- unsigned int freespace, usedspace;
-
- if (len == 0) {
- /* Calling with no data is valid - we do nothing */
- return;
- }
-
- /* Sanity check: */
- assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
-
- usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
- if (usedspace > 0) {
- /* Calculate how much free space is available in the buffer */
- freespace = SHA512_BLOCK_LENGTH - usedspace;
-
- if (len >= freespace) {
- /* Fill the buffer completely and process it */
- MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
- ADDINC128(context->bitcount, freespace << 3);
- len -= freespace;
- data += freespace;
- SHA512_Transform(context, (sha2_word64*)context->buffer);
- } else {
- /* The buffer is not yet full */
- MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
- ADDINC128(context->bitcount, len << 3);
- /* Clean up: */
- usedspace = freespace = 0;
- return;
- }
- }
- while (len >= SHA512_BLOCK_LENGTH) {
- /* Process as many complete blocks as we can */
- SHA512_Transform(context, (sha2_word64*)data);
- ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
- len -= SHA512_BLOCK_LENGTH;
- data += SHA512_BLOCK_LENGTH;
- }
- if (len > 0) {
- /* There's left-overs, so save 'em */
- MEMCPY_BCOPY(context->buffer, data, len);
- ADDINC128(context->bitcount, len << 3);
- }
- /* Clean up: */
- usedspace = freespace = 0;
+ unsigned int freespace, usedspace;
+
+ if (len == 0) {
+ /* Calling with no data is valid - we do nothing */
+ return;
+ }
+
+ /* Sanity check: */
+ assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
+
+ usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
+ if (usedspace > 0) {
+ /* Calculate how much free space is available in the buffer */
+ freespace = SHA512_BLOCK_LENGTH - usedspace;
+
+ if (len >= freespace) {
+ /* Fill the buffer completely and process it */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace);
+ ADDINC128(context->bitcount, freespace << 3);
+ len -= freespace;
+ data += freespace;
+ SHA512_Transform(context, (sha2_word64*)context->buffer);
+ } else {
+ /* The buffer is not yet full */
+ MEMCPY_BCOPY(&context->buffer[usedspace], data, len);
+ ADDINC128(context->bitcount, len << 3);
+ /* Clean up: */
+ usedspace = freespace = 0;
+ return;
+ }
+ }
+ while (len >= SHA512_BLOCK_LENGTH) {
+ /* Process as many complete blocks as we can */
+ SHA512_Transform(context, (sha2_word64*)data);
+ ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
+ len -= SHA512_BLOCK_LENGTH;
+ data += SHA512_BLOCK_LENGTH;
+ }
+ if (len > 0) {
+ /* There's left-overs, so save 'em */
+ MEMCPY_BCOPY(context->buffer, data, len);
+ ADDINC128(context->bitcount, len << 3);
+ }
+ /* Clean up: */
+ usedspace = freespace = 0;
}
void SHA512_Last(SHA512_CTX* context) {
- unsigned int usedspace;
+ unsigned int usedspace;
- usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
+ usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
#if BYTE_ORDER == LITTLE_ENDIAN
- /* Convert FROM host byte order */
- REVERSE64(context->bitcount[0],context->bitcount[0]);
- REVERSE64(context->bitcount[1],context->bitcount[1]);
+ /* Convert FROM host byte order */
+ REVERSE64(context->bitcount[0],context->bitcount[0]);
+ REVERSE64(context->bitcount[1],context->bitcount[1]);
#endif
- if (usedspace > 0) {
- /* Begin padding with a 1 bit: */
- context->buffer[usedspace++] = 0x80;
-
- if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
- /* Set-up for the last transform: */
- MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
- } else {
- if (usedspace < SHA512_BLOCK_LENGTH) {
- MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
- }
- /* Do second-to-last transform: */
- SHA512_Transform(context, (sha2_word64*)context->buffer);
-
- /* And set-up for the last transform: */
- MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
- }
- } else {
- /* Prepare for final transform: */
- MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
-
- /* Begin padding with a 1 bit: */
- *context->buffer = 0x80;
- }
- /* Store the length of input data (in bits): */
- *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
- *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
-
- /* Final transform: */
- SHA512_Transform(context, (sha2_word64*)context->buffer);
+ if (usedspace > 0) {
+ /* Begin padding with a 1 bit: */
+ context->buffer[usedspace++] = 0x80;
+
+ if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
+ /* Set-up for the last transform: */
+ MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
+ } else {
+ if (usedspace < SHA512_BLOCK_LENGTH) {
+ MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace);
+ }
+ /* Do second-to-last transform: */
+ SHA512_Transform(context, (sha2_word64*)context->buffer);
+
+ /* And set-up for the last transform: */
+ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2);
+ }
+ } else {
+ /* Prepare for final transform: */
+ MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH);
+
+ /* Begin padding with a 1 bit: */
+ *context->buffer = 0x80;
+ }
+ /* Store the length of input data (in bits): */
+ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
+ *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
+
+ /* Final transform: */
+ SHA512_Transform(context, (sha2_word64*)context->buffer);
}
void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
- sha2_word64 *d = (sha2_word64*)digest;
+ sha2_word64 *d = (sha2_word64*)digest;
- /* Sanity check: */
- assert(context != (SHA512_CTX*)0);
+ /* Sanity check: */
+ assert(context != (SHA512_CTX*)0);
- /* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
- SHA512_Last(context);
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ SHA512_Last(context);
- /* Save the hash data for output: */
+ /* Save the hash data for output: */
#if BYTE_ORDER == LITTLE_ENDIAN
- {
- /* Convert TO host byte order */
- int j;
- for (j = 0; j < 8; j++) {
- REVERSE64(context->state[j],context->state[j]);
- *d++ = context->state[j];
- }
- }
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 8; j++) {
+ REVERSE64(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
#else
- MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH);
+ MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH);
#endif
- }
+ }
- /* Zero out state data */
- MEMSET_BZERO(context, sizeof(context));
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(context));
}
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
- sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
- int i;
-
- /* Sanity check: */
- assert(context != (SHA512_CTX*)0);
-
- if (buffer != (char*)0) {
- SHA512_Final(digest, context);
-
- for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char)0;
- } else {
- MEMSET_BZERO(context, sizeof(context));
- }
- MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
- return buffer;
+ sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA512_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA512_Final(digest, context);
+
+ for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(context));
+ }
+ MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
+ return buffer;
}
char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) {
- SHA512_CTX context;
+ SHA512_CTX context;
- SHA512_Init(&context);
- SHA512_Update(&context, data, len);
- return SHA512_End(&context, digest);
+ SHA512_Init(&context);
+ SHA512_Update(&context, data, len);
+ return SHA512_End(&context, digest);
}
-
/*** SHA-384: *********************************************************/
void SHA384_Init(SHA384_CTX* context) {
- if (context == (SHA384_CTX*)0) {
- return;
- }
- MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
- MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
- context->bitcount[0] = context->bitcount[1] = 0;
+ if (context == (SHA384_CTX*)0) {
+ return;
+ }
+ MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
+ MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
+ context->bitcount[0] = context->bitcount[1] = 0;
}
void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
- SHA512_Update((SHA512_CTX*)context, data, len);
+ SHA512_Update((SHA512_CTX*)context, data, len);
}
void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
- sha2_word64 *d = (sha2_word64*)digest;
+ sha2_word64 *d = (sha2_word64*)digest;
- /* Sanity check: */
- assert(context != (SHA384_CTX*)0);
+ /* Sanity check: */
+ assert(context != (SHA384_CTX*)0);
- /* If no digest buffer is passed, we don't bother doing this: */
- if (digest != (sha2_byte*)0) {
- SHA512_Last((SHA512_CTX*)context);
+ /* If no digest buffer is passed, we don't bother doing this: */
+ if (digest != (sha2_byte*)0) {
+ SHA512_Last((SHA512_CTX*)context);
- /* Save the hash data for output: */
+ /* Save the hash data for output: */
#if BYTE_ORDER == LITTLE_ENDIAN
- {
- /* Convert TO host byte order */
- int j;
- for (j = 0; j < 6; j++) {
- REVERSE64(context->state[j],context->state[j]);
- *d++ = context->state[j];
- }
- }
+ {
+ /* Convert TO host byte order */
+ int j;
+ for (j = 0; j < 6; j++) {
+ REVERSE64(context->state[j],context->state[j]);
+ *d++ = context->state[j];
+ }
+ }
#else
- MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH);
+ MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH);
#endif
- }
+ }
- /* Zero out state data */
- MEMSET_BZERO(context, sizeof(context));
+ /* Zero out state data */
+ MEMSET_BZERO(context, sizeof(context));
}
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
- sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
- int i;
-
- /* Sanity check: */
- assert(context != (SHA384_CTX*)0);
-
- if (buffer != (char*)0) {
- SHA384_Final(digest, context);
-
- for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
- *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
- *buffer++ = sha2_hex_digits[*d & 0x0f];
- d++;
- }
- *buffer = (char)0;
- } else {
- MEMSET_BZERO(context, sizeof(context));
- }
- MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
- return buffer;
+ sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest;
+ int i;
+
+ /* Sanity check: */
+ assert(context != (SHA384_CTX*)0);
+
+ if (buffer != (char*)0) {
+ SHA384_Final(digest, context);
+
+ for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
+ *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
+ *buffer++ = sha2_hex_digits[*d & 0x0f];
+ d++;
+ }
+ *buffer = (char)0;
+ } else {
+ MEMSET_BZERO(context, sizeof(context));
+ }
+ MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
+ return buffer;
}
char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) {
- SHA384_CTX context;
+ SHA384_CTX context;
- SHA384_Init(&context);
- SHA384_Update(&context, data, len);
- return SHA384_End(&context, digest);
+ SHA384_Init(&context);
+ SHA384_Update(&context, data, len);
+ return SHA384_End(&context, digest);
}
-
diff --git a/gs/base/sha2.h b/gs/base/sha2.h
index 4604d98e7..b0dfbb503 100644
--- a/gs/base/sha2.h
+++ b/gs/base/sha2.h
@@ -1,7 +1,7 @@
/*
* FILE: sha2.h
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
- *
+ *
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
@@ -16,7 +16,7 @@
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -39,13 +39,11 @@
extern "C" {
#endif
-
#include "std.h"
#include "stdint_.h"
#define SHA2_USE_INTTYPES_H
-
/*** SHA-256/384/512 Various Length Definitions ***********************/
#define SHA256_BLOCK_LENGTH 64
#define SHA256_DIGEST_LENGTH 32
@@ -57,7 +55,6 @@ extern "C" {
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
-
/*** SHA-256/384/512 Context Structures *******************************/
/* NOTE: If your architecture does not define either u_intXX_t types or
* uintXX_t (from inttypes.h), you may need to define things by hand
@@ -76,7 +73,7 @@ typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
*
* #include <inttypes.h>
*
- * If you choose to use <inttypes.h> then please define:
+ * If you choose to use <inttypes.h> then please define:
*
* #define SHA2_USE_INTTYPES_H
*
@@ -87,34 +84,33 @@ typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */
#ifdef SHA2_USE_INTTYPES_H
typedef struct _SHA256_CTX {
- uint32_t state[8];
- uint64_t bitcount;
- uint8_t buffer[SHA256_BLOCK_LENGTH];
+ uint32_t state[8];
+ uint64_t bitcount;
+ uint8_t buffer[SHA256_BLOCK_LENGTH];
} SHA256_CTX;
typedef struct _SHA512_CTX {
- uint64_t state[8];
- uint64_t bitcount[2];
- uint8_t buffer[SHA512_BLOCK_LENGTH];
+ uint64_t state[8];
+ uint64_t bitcount[2];
+ uint8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
#else /* SHA2_USE_INTTYPES_H */
typedef struct _SHA256_CTX {
- u_int32_t state[8];
- u_int64_t bitcount;
- u_int8_t buffer[SHA256_BLOCK_LENGTH];
+ u_int32_t state[8];
+ u_int64_t bitcount;
+ u_int8_t buffer[SHA256_BLOCK_LENGTH];
} SHA256_CTX;
typedef struct _SHA512_CTX {
- u_int64_t state[8];
- u_int64_t bitcount[2];
- u_int8_t buffer[SHA512_BLOCK_LENGTH];
+ u_int64_t state[8];
+ u_int64_t bitcount[2];
+ u_int8_t buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
#endif /* SHA2_USE_INTTYPES_H */
typedef SHA512_CTX SHA384_CTX;
-
/*** SHA-256/384/512 Function Prototypes ******************************/
#ifndef NOPROTO
#ifdef SHA2_USE_INTTYPES_H
@@ -186,4 +182,3 @@ char* SHA512_Data();
#endif /* __cplusplus */
#endif /* __SHA2_H__ */
-
diff --git a/gs/base/shc.c b/gs/base/shc.c
index 58e3999ed..86aa88635 100644
--- a/gs/base/shc.c
+++ b/gs/base/shc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,18 +27,18 @@ hc_put_code_proc(bool reverse_bits, byte * q, uint cw)
#define cb(n) ((byte)(cw >> (n * 8)))
if (reverse_bits) {
#if hc_bits_size > 16
- q[-3] = byte_reverse_bits[cb(3)];
- q[-2] = byte_reverse_bits[cb(2)];
+ q[-3] = byte_reverse_bits[cb(3)];
+ q[-2] = byte_reverse_bits[cb(2)];
#endif
- q[-1] = byte_reverse_bits[cb(1)];
- q[0] = byte_reverse_bits[cb(0)];
+ q[-1] = byte_reverse_bits[cb(1)];
+ q[0] = byte_reverse_bits[cb(0)];
} else {
#if hc_bits_size > 16
- q[-3] = cb(3);
- q[-2] = cb(2);
+ q[-3] = cb(3);
+ q[-2] = cb(2);
#endif
- q[-1] = cb(1);
- q[0] = cb(0);
+ q[-1] = cb(1);
+ q[0] = cb(0);
}
#undef cb
}
@@ -49,13 +49,13 @@ byte *
hc_put_last_bits_proc(stream_hc_state * ss, byte * q, uint bits, int bits_left)
{
while (bits_left < hc_bits_size) {
- byte c = (byte) (bits >> (hc_bits_size - 8));
+ byte c = (byte) (bits >> (hc_bits_size - 8));
- if (ss->FirstBitLowOrder)
- c = byte_reverse_bits[c];
- *++q = c;
- bits <<= 8;
- bits_left += 8;
+ if (ss->FirstBitLowOrder)
+ c = byte_reverse_bits[c];
+ *++q = c;
+ bits <<= 8;
+ bits_left += 8;
}
ss->bits = bits;
ss->bits_left = bits_left;
diff --git a/gs/base/shc.h b/gs/base/shc.h
index 30f7d91c5..c2365e68f 100644
--- a/gs/base/shc.h
+++ b/gs/base/shc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,15 +59,15 @@ typedef struct hc_definition_s {
* contain valid data.
*/
#define stream_hc_state_common\
- stream_state_common;\
- /* The client sets the following before initialization. */\
- bool FirstBitLowOrder;\
- /* The following are updated dynamically. */\
- uint bits; /* most recent bits of input or */\
- /* current bits of output */\
- int bits_left /* # of valid low bits (input) or */\
- /* unused low bits (output) in above, */\
- /* 0 <= bits_left <= 7 */
+ stream_state_common;\
+ /* The client sets the following before initialization. */\
+ bool FirstBitLowOrder;\
+ /* The following are updated dynamically. */\
+ uint bits; /* most recent bits of input or */\
+ /* current bits of output */\
+ int bits_left /* # of valid low bits (input) or */\
+ /* unused low bits (output) in above, */\
+ /* 0 <= bits_left <= 7 */
typedef struct stream_hc_state_s {
stream_hc_state_common;
} stream_hc_state;
@@ -116,18 +116,18 @@ typedef struct hce_table_s {
/* Declare variables that hold the encoder state. */
#define hce_declare_state\
- register uint bits;\
- register int bits_left
+ register uint bits;\
+ register int bits_left
/* Load the state from the stream. */
/* Free variables: ss, bits, bits_left. */
#define hce_load_state()\
- bits = ss->bits, bits_left = ss->bits_left
+ bits = ss->bits, bits_left = ss->bits_left
/* Store the state back in the stream. */
/* Free variables: ss, bits, bits_left. */
#define hce_store_state()\
- ss->bits = bits, ss->bits_left = bits_left
+ ss->bits = bits, ss->bits_left = bits_left
/* Put a code on the stream. */
void hc_put_code_proc(bool, byte *, uint);
@@ -137,8 +137,8 @@ void hc_put_code_proc(bool, byte *, uint);
((bits_left -= (clen)) >= 0 ?\
(bits += (code) << bits_left) :\
(hc_put_code_proc((ss)->FirstBitLowOrder,\
- q += hc_bits_size >> 3,\
- (bits + ((code) >> -bits_left))),\
+ q += hc_bits_size >> 3,\
+ (bits + ((code) >> -bits_left))),\
bits = (code) << (bits_left += hc_bits_size))))
#define hc_put_code(ss, q, cp)\
hc_put_value(ss, q, (cp)->code, (cp)->code_length)
@@ -179,26 +179,26 @@ typedef struct hcd_table_s {
/* Declare variables that hold the decoder state. */
#define hcd_declare_state\
- register const byte *p;\
- const byte *rlimit;\
- uint bits;\
- int bits_left
+ register const byte *p;\
+ const byte *rlimit;\
+ uint bits;\
+ int bits_left
/* Load the state from the stream. */
/* Free variables: pr, ss, p, rlimit, bits, bits_left. */
#define hcd_load_state()\
- p = pr->ptr,\
- rlimit = pr->limit,\
- bits = ss->bits,\
- bits_left = ss->bits_left
+ p = pr->ptr,\
+ rlimit = pr->limit,\
+ bits = ss->bits,\
+ bits_left = ss->bits_left
/* Store the state back in the stream. */
/* Put back any complete bytes into the input buffer. */
/* Free variables: pr, ss, p, bits, bits_left. */
#define hcd_store_state()\
- pr->ptr = p -= (bits_left >> 3),\
- ss->bits = bits >>= (bits_left & ~7),\
- ss->bits_left = bits_left &= 7
+ pr->ptr = p -= (bits_left >> 3),\
+ ss->bits = bits >>= (bits_left & ~7),\
+ ss->bits_left = bits_left &= 7
/* Macros to get blocks of bits from the input stream. */
/* Invariants: 0 <= bits_left <= bits_size; */
diff --git a/gs/base/shcgen.c b/gs/base/shcgen.c
index 5460590b1..4493b6e71 100644
--- a/gs/base/shcgen.c
+++ b/gs/base/shcgen.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,19 +48,19 @@ print_nodes_proc(const count_node * nodes, int n, const char *tag, int lengths)
dlprintf1("[w]---------------- %s ----------------\n", tag);
for (i = 0; i < n; ++i)
- dlprintf7("[w]node %d: f=%ld v=%d len=%d N=%d L=%d R=%d\n",
- i, nodes[i].freq, nodes[i].value, nodes[i].code_length,
- (nodes[i].next == 0 ? -1 : (int)(nodes[i].next - nodes)),
- (nodes[i].left == 0 ? -1 : (int)(nodes[i].left - nodes)),
- (nodes[i].right == 0 ? -1 : (int)(nodes[i].right - nodes)));
+ dlprintf7("[w]node %d: f=%ld v=%d len=%d N=%d L=%d R=%d\n",
+ i, nodes[i].freq, nodes[i].value, nodes[i].code_length,
+ (nodes[i].next == 0 ? -1 : (int)(nodes[i].next - nodes)),
+ (nodes[i].left == 0 ? -1 : (int)(nodes[i].left - nodes)),
+ (nodes[i].right == 0 ? -1 : (int)(nodes[i].right - nodes)));
for (i = lengths; i > 0;) {
- int j = i;
- int len = nodes[--j].code_length;
+ int j = i;
+ int len = nodes[--j].code_length;
- while (j > 0 && nodes[j - 1].code_length == len)
- --j;
- dlprintf2("[w]%d codes of length %d\n", i - j, len);
- i = j;
+ while (j > 0 && nodes[j - 1].code_length == len)
+ --j;
+ dlprintf2("[w]%d codes of length %d\n", i - j, len);
+ i = j;
}
}
#else
@@ -91,7 +91,7 @@ static int
compare_values(const void *p1, const void *p2)
{
return (pn1->value < pn2->value ? -1 :
- pn1->value > pn2->value ? 1 : 0);
+ pn1->value > pn2->value ? 1 : 0);
}
#undef pn1
#undef pn2
@@ -106,25 +106,25 @@ hc_limit_code_lengths(count_node * nodes, uint num_values, int max_length)
count_node *longest = nodes + num_values;
{ /* Compute the number of additional max_length codes */
- /* we need to make available. */
- int length = longest[-1].code_length;
- int next_length;
- int avail = 0;
-
- while ((next_length = longest[-1].code_length) > max_length) {
- avail >>= length - next_length;
- length = next_length;
- (--longest)->code_length = max_length;
- ++avail;
- }
- needed = (nodes + num_values - longest) -
- (avail >>= (length - max_length));
- if_debug2('W', "[w]avail=%d, needed=%d\n",
- avail, needed);
+ /* we need to make available. */
+ int length = longest[-1].code_length;
+ int next_length;
+ int avail = 0;
+
+ while ((next_length = longest[-1].code_length) > max_length) {
+ avail >>= length - next_length;
+ length = next_length;
+ (--longest)->code_length = max_length;
+ ++avail;
+ }
+ needed = (nodes + num_values - longest) -
+ (avail >>= (length - max_length));
+ if_debug2('W', "[w]avail=%d, needed=%d\n",
+ avail, needed);
}
/* Skip over all max_length codes. */
while (longest[-1].code_length == max_length)
- --longest;
+ --longest;
/*
* To make available a code of length N, suppose that the next
@@ -140,23 +140,23 @@ hc_limit_code_lengths(count_node * nodes, uint num_values, int max_length)
* In the present situation, N = max_length.
*/
for (; needed > 0; --needed) { /* longest points to the first code of length max_length. */
- /* Since codes are sorted by increasing code length, */
- /* longest-1 is the desired code of length M. */
- int M1 = ++(longest[-1].code_length);
-
- switch (max_length - M1) {
- case 0: /* M == N-1 */
- --longest;
- break;
- case 1: /* M == N-2 */
- longest++->code_length = M1;
- break;
- default:
- longest->code_length = M1 + 1;
- longest[1].code_length = M1 + 1;
- longest[2].code_length--;
- longest += 3;
- }
+ /* Since codes are sorted by increasing code length, */
+ /* longest-1 is the desired code of length M. */
+ int M1 = ++(longest[-1].code_length);
+
+ switch (max_length - M1) {
+ case 0: /* M == N-1 */
+ --longest;
+ break;
+ case 1: /* M == N-2 */
+ longest++->code_length = M1;
+ break;
+ default:
+ longest->code_length = M1 + 1;
+ longest[1].code_length = M1 + 1;
+ longest[2].code_length--;
+ longest += 3;
+ }
}
}
@@ -168,58 +168,58 @@ hc_compute(hc_definition * def, const long *freqs, gs_memory_t * mem)
uint num_values = def->num_values;
count_node *nodes =
(count_node *) gs_alloc_byte_array(mem, num_values * 2 - 1,
- sizeof(count_node), "hc_compute");
+ sizeof(count_node), "hc_compute");
int i;
count_node *lowest;
count_node *comb;
if (nodes == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Create leaf nodes for the input data. */
for (i = 0; i < num_values; ++i)
- nodes[i].freq = freqs[i], nodes[i].value = i;
+ nodes[i].freq = freqs[i], nodes[i].value = i;
/* Create a list sorted by increasing frequency. */
/* Also initialize the tree structure. */
qsort(nodes, num_values, sizeof(count_node), compare_freqs);
for (i = 0; i < num_values; ++i)
- nodes[i].next = &nodes[i - 1],
- nodes[i].code_length = 0,
- nodes[i].left = nodes[i].right = 0;
+ nodes[i].next = &nodes[i - 1],
+ nodes[i].code_length = 0,
+ nodes[i].left = nodes[i].right = 0;
nodes[0].next = 0;
debug_print_nodes(nodes, num_values, "after sort", 0);
/* Construct the Huffman code tree. */
for (lowest = &nodes[num_values - 1], comb = &nodes[num_values];;
- ++comb
- ) {
- count_node *pn1 = lowest;
- count_node *pn2 = pn1->next;
- long freq = pn1->freq + pn2->freq;
-
- /* Create a parent for the two lowest-frequency nodes. */
- lowest = pn2->next;
- comb->freq = freq;
- if (pn1->code_length <= pn2->code_length)
- comb->left = pn1, comb->right = pn2,
- comb->code_length = pn2->code_length + 1;
- else
- comb->left = pn2, comb->right = pn1,
- comb->code_length = pn1->code_length + 1;
- if (lowest == 0) /* no nodes left to combine */
- break;
- /* Insert comb in the sorted list. */
- if (freq < lowest->freq)
- comb->next = lowest, lowest = comb;
- else {
- count_node *here = lowest;
-
- while (here->next != 0 && freq >= here->next->freq)
- here = here->next;
- comb->next = here->next;
- here->next = comb;
- }
+ ++comb
+ ) {
+ count_node *pn1 = lowest;
+ count_node *pn2 = pn1->next;
+ long freq = pn1->freq + pn2->freq;
+
+ /* Create a parent for the two lowest-frequency nodes. */
+ lowest = pn2->next;
+ comb->freq = freq;
+ if (pn1->code_length <= pn2->code_length)
+ comb->left = pn1, comb->right = pn2,
+ comb->code_length = pn2->code_length + 1;
+ else
+ comb->left = pn2, comb->right = pn1,
+ comb->code_length = pn1->code_length + 1;
+ if (lowest == 0) /* no nodes left to combine */
+ break;
+ /* Insert comb in the sorted list. */
+ if (freq < lowest->freq)
+ comb->next = lowest, lowest = comb;
+ else {
+ count_node *here = lowest;
+
+ while (here->next != 0 && freq >= here->next->freq)
+ here = here->next;
+ comb->next = here->next;
+ here->next = comb;
+ }
}
/* comb (i.e., &nodes[num_values * 2 - 2] is the root of the tree. */
@@ -230,9 +230,9 @@ hc_compute(hc_definition * def, const long *freqs, gs_memory_t * mem)
/* sweep. */
comb++->code_length = 0;
while (comb > nodes + num_values) {
- --comb;
- comb->left->code_length = comb->right->code_length =
- comb->code_length + 1;
+ --comb;
+ comb->left->code_length = comb->right->code_length =
+ comb->code_length + 1;
}
debug_print_nodes(nodes, num_values * 2 - 1, "after combine", 0);
@@ -249,20 +249,20 @@ hc_compute(hc_definition * def, const long *freqs, gs_memory_t * mem)
/* the code definition itself compress better using our */
/* incremental encoding. */
for (i = num_values; i > 0;) {
- int j = i;
- int len = nodes[--j].code_length;
+ int j = i;
+ int len = nodes[--j].code_length;
- while (j > 0 && nodes[j - 1].code_length == len)
- --j;
- qsort(&nodes[j], i - j, sizeof(count_node), compare_values);
- i = j;
+ while (j > 0 && nodes[j - 1].code_length == len)
+ --j;
+ qsort(&nodes[j], i - j, sizeof(count_node), compare_values);
+ i = j;
}
/* Extract the definition from the nodes. */
memset(def->counts, 0, sizeof(*def->counts) * (def->num_counts + 1));
for (i = 0; i < num_values; ++i) {
- def->values[i] = nodes[i].value;
- def->counts[nodes[i].code_length]++;
+ def->values[i] = nodes[i].value;
+ def->counts[nodes[i].code_length]++;
}
/* All done, release working storage. */
@@ -300,18 +300,18 @@ hc_bytes_from_definition(byte * dbytes, const hc_definition * def)
/* Temporarily use the output string as a map from */
/* values to code lengths. */
for (i = 1; i <= def->num_counts; i++)
- for (j = 0; j < def->counts[i]; j++)
- bp[*values++] = i;
+ for (j = 0; j < def->counts[i]; j++)
+ bp[*values++] = i;
/* Now construct the actual string. */
while (lp < end) {
- const byte *vp;
- byte len = *lp;
+ const byte *vp;
+ byte len = *lp;
- for (vp = lp + 1; vp < end && vp < lp + 16 && *vp == len;)
- vp++;
- *bp++ = ((vp - lp - 1) << 4) + (len - 1);
- lp = vp;
+ for (vp = lp + 1; vp < end && vp < lp + 16 && *vp == len;)
+ vp++;
+ *bp++ = ((vp - lp - 1) << 4) + (len - 1);
+ lp = vp;
}
return bp - dbytes;
@@ -325,12 +325,12 @@ hc_sizes_from_bytes(hc_definition * def, const byte * dbytes, int num_bytes)
int i;
for (i = 0; i < num_bytes; i++) {
- int n = (dbytes[i] >> 4) + 1;
- int l = (dbytes[i] & 15) + 1;
+ int n = (dbytes[i] >> 4) + 1;
+ int l = (dbytes[i] & 15) + 1;
- if (l > num_counts)
- num_counts = l;
- num_values += n;
+ if (l > num_counts)
+ num_counts = l;
+ num_values += n;
}
def->num_counts = num_counts;
def->num_values = num_values;
@@ -347,28 +347,28 @@ hc_definition_from_bytes(hc_definition * def, const byte * dbytes)
/* Make a first pass to set the counts for each code length. */
memset(counts, 0, sizeof(counts[0]) * (def->num_counts + 1));
for (i = 0, v = 0; v < def->num_values; i++) {
- int n = (dbytes[i] >> 4) + 1;
- int l = (dbytes[i] & 15) + 1;
+ int n = (dbytes[i] >> 4) + 1;
+ int l = (dbytes[i] & 15) + 1;
- counts[l] += n;
- v += n;
+ counts[l] += n;
+ v += n;
}
/* Now fill in the definition. */
memcpy(def->counts, counts, sizeof(counts[0]) * (def->num_counts + 1));
for (i = 1, v = 0; i <= def->num_counts; i++) {
- uint prev = counts[i];
+ uint prev = counts[i];
- counts[i] = v;
- v += prev;
+ counts[i] = v;
+ v += prev;
}
for (i = 0, v = 0; v < def->num_values; i++) {
- int n = (dbytes[i] >> 4) + 1;
- int l = (dbytes[i] & 15) + 1;
- int j;
+ int n = (dbytes[i] >> 4) + 1;
+ int l = (dbytes[i] & 15) + 1;
+ int j;
- for (j = 0; j < n; n++)
- def->values[counts[l]++] = v++;
+ for (j = 0; j < n; n++)
+ def->values[counts[l]++] = v++;
}
}
@@ -384,13 +384,13 @@ hc_make_encoding(hce_code * encode, const hc_definition * def)
uint i, k;
for (i = 1; i <= def->num_counts; i++) {
- for (k = 0; k < def->counts[i]; k++, pvalue++, next++) {
- hce_code *pce = encode + *pvalue;
+ for (k = 0; k < def->counts[i]; k++, pvalue++, next++) {
+ hce_code *pce = encode + *pvalue;
- pce->code = next;
- pce->code_length = i;
- }
- next <<= 1;
+ pce->code = next;
+ pce->code_length = i;
+ }
+ next <<= 1;
}
}
@@ -407,11 +407,11 @@ hc_sizeof_decoding(const hc_definition * def, int initial_bits)
uint i;
for (i = initial_bits + 1; i <= def->num_counts;
- i++, carry <<= 1, mask <<= 1
- ) {
- carry += def->counts[i];
- size += carry & mask;
- carry &= ~mask;
+ i++, carry <<= 1, mask <<= 1
+ ) {
+ carry += def->counts[i];
+ size += carry & mask;
+ carry &= ~mask;
}
return size;
}
@@ -419,62 +419,62 @@ hc_sizeof_decoding(const hc_definition * def, int initial_bits)
/* Generate the decoding tables. */
void
hc_make_decoding(hcd_code * decode, const hc_definition * def,
- int initial_bits)
+ int initial_bits)
{ /* Make entries for single-dispatch codes. */
{
- hcd_code *pcd = decode;
- const ushort *pvalue = def->values;
- uint i, k, d;
-
- for (i = 0; i <= initial_bits; i++) {
- for (k = 0; k < def->counts[i]; k++, pvalue++) {
- for (d = 1 << (initial_bits - i); d > 0;
- d--, pcd++
- )
- pcd->value = *pvalue,
- pcd->code_length = i;
- }
- }
+ hcd_code *pcd = decode;
+ const ushort *pvalue = def->values;
+ uint i, k, d;
+
+ for (i = 0; i <= initial_bits; i++) {
+ for (k = 0; k < def->counts[i]; k++, pvalue++) {
+ for (d = 1 << (initial_bits - i); d > 0;
+ d--, pcd++
+ )
+ pcd->value = *pvalue,
+ pcd->code_length = i;
+ }
+ }
}
/* Make entries for two-dispatch codes. */
/* By working backward, we can do this more easily */
/* in a single pass. */
{
- uint dsize = hc_sizeof_decoding(def, initial_bits);
- hcd_code *pcd = decode + (1 << initial_bits);
- hcd_code *pcd2 = decode + dsize;
- const ushort *pvalue = def->values + def->num_values;
- uint entries_left = 0, slots_left = 0, mult_shift = 0;
- uint i = def->num_counts + 1, j;
-
- for (;;) {
- if (slots_left == 0) {
- if (entries_left != 0) {
- slots_left = 1 << (i - initial_bits);
- mult_shift = 0;
- continue;
- }
- if (--i <= initial_bits)
- break;
- entries_left = def->counts[i];
- continue;
- }
- if (entries_left == 0) {
- entries_left = def->counts[--i];
- mult_shift++;
- continue;
- }
- --entries_left, --pvalue;
- for (j = 1 << mult_shift; j > 0; j--) {
- --pcd2;
- pcd2->value = *pvalue;
- pcd2->code_length = i - initial_bits;
- }
- if ((slots_left -= 1 << mult_shift) == 0) {
- --pcd;
- pcd->value = pcd2 - decode;
- pcd->code_length = i + mult_shift;
- }
- }
+ uint dsize = hc_sizeof_decoding(def, initial_bits);
+ hcd_code *pcd = decode + (1 << initial_bits);
+ hcd_code *pcd2 = decode + dsize;
+ const ushort *pvalue = def->values + def->num_values;
+ uint entries_left = 0, slots_left = 0, mult_shift = 0;
+ uint i = def->num_counts + 1, j;
+
+ for (;;) {
+ if (slots_left == 0) {
+ if (entries_left != 0) {
+ slots_left = 1 << (i - initial_bits);
+ mult_shift = 0;
+ continue;
+ }
+ if (--i <= initial_bits)
+ break;
+ entries_left = def->counts[i];
+ continue;
+ }
+ if (entries_left == 0) {
+ entries_left = def->counts[--i];
+ mult_shift++;
+ continue;
+ }
+ --entries_left, --pvalue;
+ for (j = 1 << mult_shift; j > 0; j--) {
+ --pcd2;
+ pcd2->value = *pvalue;
+ pcd2->code_length = i - initial_bits;
+ }
+ if ((slots_left -= 1 << mult_shift) == 0) {
+ --pcd;
+ pcd->value = pcd2 - decode;
+ pcd->code_length = i + mult_shift;
+ }
+ }
}
}
diff --git a/gs/base/shcgen.h b/gs/base/shcgen.h
index 986088869..9222a9834 100644
--- a/gs/base/shcgen.h
+++ b/gs/base/shcgen.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,6 +45,6 @@ uint hc_sizeof_decoding(const hc_definition * def, int initial_bits);
/* Generate the decoding tables. */
void hc_make_decoding(hcd_code * decode, const hc_definition * def,
- int initial_bits);
+ int initial_bits);
#endif /* shcgen_INCLUDED */
diff --git a/gs/base/sidscale.c b/gs/base/sidscale.c
index 5384e5c1f..431cc90f1 100644
--- a/gs/base/sidscale.c
+++ b/gs/base/sidscale.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -73,66 +73,65 @@ idownscale_x(void /* PixelIn */ * tmp, const void /* PixelIn */ *src, stream_ISp
bool firstline = prev_y != cur_y; /* at the start of a new group of lines */
bool polarity_additive = ss->params.ColorPolarityAdditive;
- /* The following could be a macro, BUT macro's with control */
- /* are not good style and hard to debug */
+ /* The following could be a macro, BUT macro's with control */
+ /* are not good style and hard to debug */
if (ss->sizeofPixelIn == 1) {
- for (c = 0; c < Colors; ++c) {
- byte *tp = (byte *)tmp + c; /* destination */
- const byte *pp = (const byte *)src + c;
-
- ss->dda_x = ss->dda_x_init;
- if_debug1('W', "[W]idownscale_x color %d:", c);
-
- for ( i = 0; i < WidthIn; tp += Colors) {
- int endx = dda_next(ss->dda_x);
- if (firstline)
- *tp = *pp;
- else {
- if ((polarity_additive && (*pp < *tp)) ||
- (!polarity_additive && (*pp > *tp)) )
- *tp = *pp;
- }
- i++; pp += Colors;
- while (i < endx) {
- if (*pp < *tp)
- *tp = *pp;
- i++; pp += Colors;
- }
- if_debug1('W', " %d", *tp);
- }
- if_debug0('W', "\n");
- }
+ for (c = 0; c < Colors; ++c) {
+ byte *tp = (byte *)tmp + c; /* destination */
+ const byte *pp = (const byte *)src + c;
+
+ ss->dda_x = ss->dda_x_init;
+ if_debug1('W', "[W]idownscale_x color %d:", c);
+
+ for ( i = 0; i < WidthIn; tp += Colors) {
+ int endx = dda_next(ss->dda_x);
+ if (firstline)
+ *tp = *pp;
+ else {
+ if ((polarity_additive && (*pp < *tp)) ||
+ (!polarity_additive && (*pp > *tp)) )
+ *tp = *pp;
+ }
+ i++; pp += Colors;
+ while (i < endx) {
+ if (*pp < *tp)
+ *tp = *pp;
+ i++; pp += Colors;
+ }
+ if_debug1('W', " %d", *tp);
+ }
+ if_debug0('W', "\n");
+ }
} else { /* sizeofPixelIn == 2 */
- for (c = 0; c < Colors; ++c) {
- bits16 *tp = (bits16 *)tmp + c; /* destination */
- const bits16 *pp = (const bits16 *)src + c;
-
- ss->dda_x = ss->dda_x_init;
- if_debug1('W', "[W]idownscale_x color %d:", c);
-
- for ( i = 0; i < WidthIn; tp += Colors) {
- int endx = dda_next(ss->dda_x);
- if (firstline)
- *tp = *pp;
- else {
- if ((polarity_additive && (*pp < *tp)) ||
- (!polarity_additive && (*pp > *tp)) )
- *tp = *pp;
- }
- i++; pp += Colors;
- while (i < endx) {
- if (*pp < *tp)
- *tp = *pp;
- i++; pp += Colors;
- }
- if_debug1('W', " %d", *tp);
- }
- if_debug0('W', "\n");
- }
+ for (c = 0; c < Colors; ++c) {
+ bits16 *tp = (bits16 *)tmp + c; /* destination */
+ const bits16 *pp = (const bits16 *)src + c;
+
+ ss->dda_x = ss->dda_x_init;
+ if_debug1('W', "[W]idownscale_x color %d:", c);
+
+ for ( i = 0; i < WidthIn; tp += Colors) {
+ int endx = dda_next(ss->dda_x);
+ if (firstline)
+ *tp = *pp;
+ else {
+ if ((polarity_additive && (*pp < *tp)) ||
+ (!polarity_additive && (*pp > *tp)) )
+ *tp = *pp;
+ }
+ i++; pp += Colors;
+ while (i < endx) {
+ if (*pp < *tp)
+ *tp = *pp;
+ i++; pp += Colors;
+ }
+ if_debug1('W', " %d", *tp);
+ }
+ if_debug0('W', "\n");
+ }
}
}
-
/*
* Copy from tmp to dst, taking into account PixelOut vs. PixelIn sizes
* We do the conversion from PixelIn to PixelOut here (if needed)
@@ -142,7 +141,7 @@ idownscale_x(void /* PixelIn */ * tmp, const void /* PixelIn */ *src, stream_ISp
*/
static void
idownscale_y(void /*PixelOut */ *dst, const void /* PixelIn */ *tmp,
- stream_ISpecialDownScale_state *const ss)
+ stream_ISpecialDownScale_state *const ss)
{
int kn = ss->params.WidthOut * ss->params.Colors;
int kc;
@@ -151,44 +150,43 @@ idownscale_y(void /*PixelOut */ *dst, const void /* PixelIn */ *tmp,
if_debug0('W', "[W]idownscale_y: ");
if (ss->sizeofPixelOut == 1) {
- if (ss->sizeofPixelIn == 1) {
- const byte *pp = (byte *)tmp;
-
- for ( kc = 0; kc < kn; ++kc, pp++ ) {
- if_debug1('W', " %d", *pp);
- ((byte *)dst)[kc] = *pp;
- }
- } else { /* sizeofPixelIn == 2 */
- const bits16 *pp = (bits16 *)tmp;
-
- for ( kc = 0; kc < kn; ++kc, pp++ ) {
- if_debug1('W', " %d", *pp);
- ((byte *)dst)[kc] = frac2byte(*pp);
- }
- }
+ if (ss->sizeofPixelIn == 1) {
+ const byte *pp = (byte *)tmp;
+
+ for ( kc = 0; kc < kn; ++kc, pp++ ) {
+ if_debug1('W', " %d", *pp);
+ ((byte *)dst)[kc] = *pp;
+ }
+ } else { /* sizeofPixelIn == 2 */
+ const bits16 *pp = (bits16 *)tmp;
+
+ for ( kc = 0; kc < kn; ++kc, pp++ ) {
+ if_debug1('W', " %d", *pp);
+ ((byte *)dst)[kc] = frac2byte(*pp);
+ }
+ }
} else { /* sizeofPixelOut == 2 */
- if (ss->sizeofPixelIn == 1) {
- const byte *pp = (byte *)tmp;
-
- for ( kc = 0; kc < kn; ++kc, pp++ ) {
- if_debug1('W', " %d", *pp);
- ((bits16 *)dst)[kc] = (*pp)*scale;
- }
- } else { /* sizeofPixelIn == 2 */
- const bits16 *pp = (bits16 *)tmp;
-
- for ( kc = 0; kc < kn; ++kc, pp++ ) {
- if_debug1('W', " %d", *pp);
- ((bits16 *)dst)[kc] = *pp;
- }
- }
+ if (ss->sizeofPixelIn == 1) {
+ const byte *pp = (byte *)tmp;
+
+ for ( kc = 0; kc < kn; ++kc, pp++ ) {
+ if_debug1('W', " %d", *pp);
+ ((bits16 *)dst)[kc] = (*pp)*scale;
+ }
+ } else { /* sizeofPixelIn == 2 */
+ const bits16 *pp = (bits16 *)tmp;
+
+ for ( kc = 0; kc < kn; ++kc, pp++ ) {
+ if_debug1('W', " %d", *pp);
+ ((bits16 *)dst)[kc] = *pp;
+ }
+ }
}
if_debug0('W', "n");
}
/* ------ Stream implementation ------ */
-
/* Forward references */
static void s_ISpecialDownScale_release(stream_state * st);
@@ -224,18 +222,17 @@ s_ISpecialDownScale_init(stream_state * st)
ss->src_y = ss->dst_y = 0;
dda_init(ss->dda_y, 0, ss->params.HeightOut, ss->params.HeightIn);
-
/* create intermediate image to hold horizontal zoom */
ss->tmp = gs_alloc_byte_array(mem, ss->params.WidthOut * ss->params.Colors,
- ss->sizeofPixelIn, "image_scale tmp");
+ ss->sizeofPixelIn, "image_scale tmp");
/* Allocate buffers for 1 row of source and destination. */
ss->dst = gs_alloc_byte_array(mem, ss->params.WidthOut * ss->params.Colors,
- ss->sizeofPixelOut, "image_scale dst");
+ ss->sizeofPixelOut, "image_scale dst");
ss->src = gs_alloc_byte_array(mem, ss->params.WidthIn * ss->params.Colors,
- ss->sizeofPixelIn, "image_scale src");
+ ss->sizeofPixelIn, "image_scale src");
if (ss->tmp == 0 || ss->dst == 0 || ss->src == 0) {
- s_ISpecialDownScale_release(st);
- return ERRC;
+ s_ISpecialDownScale_release(st);
+ return ERRC;
/****** WRONG ******/
}
@@ -246,7 +243,7 @@ s_ISpecialDownScale_init(stream_state * st)
/* Process a buffer. Note that this handles Encode and Decode identically. */
static int
s_ISpecialDownScale_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_ISpecialDownScale_state *const ss = (stream_ISpecialDownScale_state *) st;
uint cur_y = dda_current(ss->dda_y);
@@ -255,80 +252,80 @@ s_ISpecialDownScale_process(stream_state * st, stream_cursor_read * pr,
top:
if (cur_y > ss->dst_y) {
- /* Deliver some or all of the current scaled row. */
- /* to generate a vertically scaled output row. */
- uint wleft = pw->limit - pw->ptr;
-
- if (ss->dst_y == ss->params.HeightOut)
- return EOFC;
- if (wleft == 0)
- return 1;
- if (ss->dst_offset == 0) {
- byte *row;
-
- if (wleft >= ss->dst_size) { /* We can scale the row directly into the output. */
- row = pw->ptr + 1;
- pw->ptr += ss->dst_size;
- } else { /* We'll have to buffer the row. */
- row = ss->dst;
- }
- /* Apply filter to zoom vertically from tmp to dst. */
- idownscale_y(row, ss->tmp, ss);
- /* Idiotic C coercion rules allow T* and void* to be */
- /* inter-assigned freely, but not compared! */
- if ((void *)row != ss->dst) /* no buffering */
- goto adv;
- } { /* We're delivering a buffered output row. */
- uint wcount = ss->dst_size - ss->dst_offset;
- uint ncopy = min(wleft, wcount);
-
- memcpy(pw->ptr + 1, (byte *) ss->dst + ss->dst_offset, ncopy);
- pw->ptr += ncopy;
- ss->dst_offset += ncopy;
- if (ncopy != wcount)
- return 1;
- ss->dst_offset = 0;
- }
- /* Advance to the next output row. */
+ /* Deliver some or all of the current scaled row. */
+ /* to generate a vertically scaled output row. */
+ uint wleft = pw->limit - pw->ptr;
+
+ if (ss->dst_y == ss->params.HeightOut)
+ return EOFC;
+ if (wleft == 0)
+ return 1;
+ if (ss->dst_offset == 0) {
+ byte *row;
+
+ if (wleft >= ss->dst_size) { /* We can scale the row directly into the output. */
+ row = pw->ptr + 1;
+ pw->ptr += ss->dst_size;
+ } else { /* We'll have to buffer the row. */
+ row = ss->dst;
+ }
+ /* Apply filter to zoom vertically from tmp to dst. */
+ idownscale_y(row, ss->tmp, ss);
+ /* Idiotic C coercion rules allow T* and void* to be */
+ /* inter-assigned freely, but not compared! */
+ if ((void *)row != ss->dst) /* no buffering */
+ goto adv;
+ } { /* We're delivering a buffered output row. */
+ uint wcount = ss->dst_size - ss->dst_offset;
+ uint ncopy = min(wleft, wcount);
+
+ memcpy(pw->ptr + 1, (byte *) ss->dst + ss->dst_offset, ncopy);
+ pw->ptr += ncopy;
+ ss->dst_offset += ncopy;
+ if (ncopy != wcount)
+ return 1;
+ ss->dst_offset = 0;
+ }
+ /* Advance to the next output row. */
adv: ++(ss->dst_y);
}
/* Read input data and scale horizontally into tmp. */
{
- uint rleft = pr->limit - pr->ptr;
- uint rcount = ss->src_size - ss->src_offset;
-
- if (rleft == 0)
- return 0; /* need more input */
- if (ss->src_y >= ss->params.HeightIn)
- return ERRC;
- if (rleft >= rcount) { /* We're going to fill up a row. */
- const byte *row;
-
- if (ss->src_offset == 0) { /* We have a complete row. Read the data */
- /* directly from the input. */
- row = pr->ptr + 1;
- } else { /* We're buffering a row in src. */
- row = ss->src;
- memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1,
- rcount);
- ss->src_offset = 0;
- }
- /* Apply filter to zoom horizontally from src to tmp. */
- if_debug2('w', "[w]idownscale_x y = %d to tmp row %d\n",
- ss->src_y, (ss->src_y % MAX_ISCALE_SUPPORT));
- idownscale_x(ss->tmp, row, ss);
- pr->ptr += rcount;
- ++(ss->src_y);
- cur_y = dda_next(ss->dda_y);
- goto top;
- } else { /* We don't have a complete row. Copy data to src buffer. */
- memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1, rleft);
- ss->src_offset += rleft;
- pr->ptr += rleft;
- return 0;
- }
+ uint rleft = pr->limit - pr->ptr;
+ uint rcount = ss->src_size - ss->src_offset;
+
+ if (rleft == 0)
+ return 0; /* need more input */
+ if (ss->src_y >= ss->params.HeightIn)
+ return ERRC;
+ if (rleft >= rcount) { /* We're going to fill up a row. */
+ const byte *row;
+
+ if (ss->src_offset == 0) { /* We have a complete row. Read the data */
+ /* directly from the input. */
+ row = pr->ptr + 1;
+ } else { /* We're buffering a row in src. */
+ row = ss->src;
+ memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1,
+ rcount);
+ ss->src_offset = 0;
+ }
+ /* Apply filter to zoom horizontally from src to tmp. */
+ if_debug2('w', "[w]idownscale_x y = %d to tmp row %d\n",
+ ss->src_y, (ss->src_y % MAX_ISCALE_SUPPORT));
+ idownscale_x(ss->tmp, row, ss);
+ pr->ptr += rcount;
+ ++(ss->src_y);
+ cur_y = dda_next(ss->dda_y);
+ goto top;
+ } else { /* We don't have a complete row. Copy data to src buffer. */
+ memcpy((byte *) ss->src + ss->src_offset, pr->ptr + 1, rleft);
+ ss->src_offset += rleft;
+ pr->ptr += rleft;
+ return 0;
+ }
}
}
diff --git a/gs/base/sidscale.h b/gs/base/sidscale.h
index b5aadf19e..0f64b0754 100644
--- a/gs/base/sidscale.h
+++ b/gs/base/sidscale.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/siinterp.c b/gs/base/siinterp.c
index fe72ab213..8ef520a47 100644
--- a/gs/base/siinterp.c
+++ b/gs/base/siinterp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,9 +46,9 @@ typedef struct stream_IIEncode_state_s {
uint src_size; /* bytes per row of input */
uint dst_size; /* bytes per row of output */
void /*PixelOut */ *prev; /* previous row of input data in output fmt, */
- /* [WidthIn * sizeofPixelOut] */
+ /* [WidthIn * sizeofPixelOut] */
void /*PixelOut */ *cur; /* current row of input data in output fmt, */
- /* [WidthIn * sizeofPixelOut] */
+ /* [WidthIn * sizeofPixelOut] */
scale_case_t scale_case;
/* The following are updated dynamically. */
int dst_x;
@@ -75,9 +75,9 @@ s_IIEncode_init(stream_state * st)
gs_memory_t *mem = ss->memory;
ss->sizeofPixelIn =
- ss->params.BitsPerComponentIn / 8 * ss->params.Colors;
+ ss->params.BitsPerComponentIn / 8 * ss->params.Colors;
ss->sizeofPixelOut =
- ss->params.BitsPerComponentOut / 8 * ss->params.Colors;
+ ss->params.BitsPerComponentOut / 8 * ss->params.Colors;
ss->src_size = ss->sizeofPixelIn * ss->params.WidthIn;
ss->dst_size = ss->sizeofPixelOut * ss->params.WidthOut;
@@ -91,27 +91,27 @@ s_IIEncode_init(stream_state * st)
/* Allocate buffers for 2 rows of input data. */
ss->prev = gs_alloc_byte_array(mem, ss->params.WidthIn,
- ss->sizeofPixelOut, "IIEncode prev");
+ ss->sizeofPixelOut, "IIEncode prev");
ss->cur = gs_alloc_byte_array(mem, ss->params.WidthIn,
- ss->sizeofPixelOut, "IIEncode cur");
+ ss->sizeofPixelOut, "IIEncode cur");
if (ss->prev == 0 || ss->cur == 0) {
- s_IIEncode_release(st);
- return ERRC; /****** WRONG ******/
+ s_IIEncode_release(st);
+ return ERRC; /****** WRONG ******/
}
/* Determine the case for the inner loop. */
ss->scale_case =
- (ss->params.BitsPerComponentIn == 8 ?
- (ss->params.BitsPerComponentOut == 8 ?
- (ss->params.MaxValueIn == ss->params.MaxValueOut ?
- SCALE_SAME : SCALE_8_8) :
- (ss->params.MaxValueIn == 255 && ss->params.MaxValueOut == frac_1 ?
- (ss->params.Colors == 3 ? SCALE_8_16_BYTE2FRAC_3 :
- SCALE_8_16_BYTE2FRAC) :
- SCALE_8_16_GENERAL)) :
- (ss->params.BitsPerComponentOut == 8 ? SCALE_16_8 :
- ss->params.MaxValueIn == ss->params.MaxValueOut ?
- SCALE_SAME : SCALE_16_16));
+ (ss->params.BitsPerComponentIn == 8 ?
+ (ss->params.BitsPerComponentOut == 8 ?
+ (ss->params.MaxValueIn == ss->params.MaxValueOut ?
+ SCALE_SAME : SCALE_8_8) :
+ (ss->params.MaxValueIn == 255 && ss->params.MaxValueOut == frac_1 ?
+ (ss->params.Colors == 3 ? SCALE_8_16_BYTE2FRAC_3 :
+ SCALE_8_16_BYTE2FRAC) :
+ SCALE_8_16_GENERAL)) :
+ (ss->params.BitsPerComponentOut == 8 ? SCALE_16_8 :
+ ss->params.MaxValueIn == ss->params.MaxValueOut ?
+ SCALE_SAME : SCALE_16_16));
return 0;
}
@@ -119,11 +119,11 @@ s_IIEncode_init(stream_state * st)
/* Process a buffer. */
static int
s_IIEncode_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_IIEncode_state *const ss = (stream_IIEncode_state *) st;
const scale_case_t scale_case = ss->scale_case +
- ALIGNMENT_MOD(pw->ptr, 2); /* ptr odd => buffer is aligned */
+ ALIGNMENT_MOD(pw->ptr, 2); /* ptr odd => buffer is aligned */
byte *out = pw->ptr + 1;
/****** WRONG, requires an entire output pixel ******/
byte *limit = pw->limit + 1 - ss->sizeofPixelOut;
@@ -132,97 +132,97 @@ s_IIEncode_process(stream_state * st, stream_cursor_read * pr,
top:
if (dda_current(ss->dda_y) > ss->dst_y) {
- /* Deliver some or all of the current scaled row. */
- while (ss->dst_x < ss->params.WidthOut) {
- uint sx = dda_current(ss->dda_x) * ss->sizeofPixelIn;
- const byte *in = (const byte *)ss->cur + sx;
- int c;
-
- if (out > limit) {
- pw->ptr = out - 1;
- return 1;
- }
- switch (scale_case) {
- case SCALE_SAME:
- case SCALE_SAME_ALIGNED:
- memcpy(out, in, ss->sizeofPixelIn);
- out += ss->sizeofPixelIn;
- break;
- case SCALE_8_8:
- case SCALE_8_8_ALIGNED:
- for (c = ss->params.Colors; --c >= 0; ++in, ++out)
- *out = (byte)(*in * ss->params.MaxValueOut /
- ss->params.MaxValueIn);
- break;
- case SCALE_8_16_BYTE2FRAC:
- case SCALE_8_16_BYTE2FRAC_ALIGNED: /* could be optimized */
- case SCALE_8_16_BYTE2FRAC_3: /* could be optimized */
- for (c = ss->params.Colors; --c >= 0; ++in, out += 2) {
- uint b = *in;
- uint value = byte2frac(b);
-
- out[0] = (byte)(value >> 8), out[1] = (byte)value;
- }
- break;
- case SCALE_8_16_BYTE2FRAC_3_ALIGNED:
- {
- uint b = in[0];
-
- ((bits16 *)out)[0] = byte2frac(b);
- b = in[1];
- ((bits16 *)out)[1] = byte2frac(b);
- b = in[2];
- ((bits16 *)out)[2] = byte2frac(b);
- }
- out += 6;
- break;
- case SCALE_8_16_GENERAL:
- case SCALE_8_16_GENERAL_ALIGNED: /* could be optimized */
- for (c = ss->params.Colors; --c >= 0; ++in, out += 2) {
- uint value = *in * ss->params.MaxValueOut /
- ss->params.MaxValueIn;
-
- out[0] = (byte)(value >> 8), out[1] = (byte)value;
- }
- break;
- case SCALE_16_8:
- case SCALE_16_8_ALIGNED:
- for (c = ss->params.Colors; --c >= 0; in += 2, ++out)
- *out = (byte)(*(const bits16 *)in *
- ss->params.MaxValueOut /
- ss->params.MaxValueIn);
- break;
- case SCALE_16_16:
- case SCALE_16_16_ALIGNED: /* could be optimized */
- for (c = ss->params.Colors; --c >= 0; in += 2, out += 2) {
- uint value = *(const bits16 *)in *
- ss->params.MaxValueOut / ss->params.MaxValueIn;
-
- out[0] = (byte)(value >> 8), out[1] = (byte)value;
- }
- }
- dda_next(ss->dda_x);
- ss->dst_x++;
- }
- ss->dst_x = 0;
- ss->dst_y++;
- ss->dda_x = ss->dda_x_init;
- goto top;
+ /* Deliver some or all of the current scaled row. */
+ while (ss->dst_x < ss->params.WidthOut) {
+ uint sx = dda_current(ss->dda_x) * ss->sizeofPixelIn;
+ const byte *in = (const byte *)ss->cur + sx;
+ int c;
+
+ if (out > limit) {
+ pw->ptr = out - 1;
+ return 1;
+ }
+ switch (scale_case) {
+ case SCALE_SAME:
+ case SCALE_SAME_ALIGNED:
+ memcpy(out, in, ss->sizeofPixelIn);
+ out += ss->sizeofPixelIn;
+ break;
+ case SCALE_8_8:
+ case SCALE_8_8_ALIGNED:
+ for (c = ss->params.Colors; --c >= 0; ++in, ++out)
+ *out = (byte)(*in * ss->params.MaxValueOut /
+ ss->params.MaxValueIn);
+ break;
+ case SCALE_8_16_BYTE2FRAC:
+ case SCALE_8_16_BYTE2FRAC_ALIGNED: /* could be optimized */
+ case SCALE_8_16_BYTE2FRAC_3: /* could be optimized */
+ for (c = ss->params.Colors; --c >= 0; ++in, out += 2) {
+ uint b = *in;
+ uint value = byte2frac(b);
+
+ out[0] = (byte)(value >> 8), out[1] = (byte)value;
+ }
+ break;
+ case SCALE_8_16_BYTE2FRAC_3_ALIGNED:
+ {
+ uint b = in[0];
+
+ ((bits16 *)out)[0] = byte2frac(b);
+ b = in[1];
+ ((bits16 *)out)[1] = byte2frac(b);
+ b = in[2];
+ ((bits16 *)out)[2] = byte2frac(b);
+ }
+ out += 6;
+ break;
+ case SCALE_8_16_GENERAL:
+ case SCALE_8_16_GENERAL_ALIGNED: /* could be optimized */
+ for (c = ss->params.Colors; --c >= 0; ++in, out += 2) {
+ uint value = *in * ss->params.MaxValueOut /
+ ss->params.MaxValueIn;
+
+ out[0] = (byte)(value >> 8), out[1] = (byte)value;
+ }
+ break;
+ case SCALE_16_8:
+ case SCALE_16_8_ALIGNED:
+ for (c = ss->params.Colors; --c >= 0; in += 2, ++out)
+ *out = (byte)(*(const bits16 *)in *
+ ss->params.MaxValueOut /
+ ss->params.MaxValueIn);
+ break;
+ case SCALE_16_16:
+ case SCALE_16_16_ALIGNED: /* could be optimized */
+ for (c = ss->params.Colors; --c >= 0; in += 2, out += 2) {
+ uint value = *(const bits16 *)in *
+ ss->params.MaxValueOut / ss->params.MaxValueIn;
+
+ out[0] = (byte)(value >> 8), out[1] = (byte)value;
+ }
+ }
+ dda_next(ss->dda_x);
+ ss->dst_x++;
+ }
+ ss->dst_x = 0;
+ ss->dst_y++;
+ ss->dda_x = ss->dda_x_init;
+ goto top;
}
pw->ptr = out - 1;
if (ss->dst_y >= ss->params.HeightOut)
- return EOFC;
+ return EOFC;
if (ss->src_offset < ss->src_size) {
- uint count = min(ss->src_size - ss->src_offset, pr->limit - pr->ptr);
-
- if (count == 0)
- return 0;
- memcpy((byte *)ss->cur + ss->src_offset, pr->ptr + 1, count);
- ss->src_offset += count;
- pr->ptr += count;
- if (ss->src_offset < ss->src_size)
- return 0;
+ uint count = min(ss->src_size - ss->src_offset, pr->limit - pr->ptr);
+
+ if (count == 0)
+ return 0;
+ memcpy((byte *)ss->cur + ss->src_offset, pr->ptr + 1, count);
+ ss->src_offset += count;
+ pr->ptr += count;
+ if (ss->src_offset < ss->src_size)
+ return 0;
}
ss->src_offset = 0;
ss->dst_x = 0;
diff --git a/gs/base/siinterp.h b/gs/base/siinterp.h
index b99188b1f..8b05fd9ea 100644
--- a/gs/base/siinterp.h
+++ b/gs/base/siinterp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/simscale.c b/gs/base/simscale.c
index 7b1b22d5e..c68dba952 100644
--- a/gs/base/simscale.c
+++ b/gs/base/simscale.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -8220,9 +8220,9 @@ const byte imasktab[] = {
};
gs_private_st_ptrs2(st_imscale_state, stream_imscale_state,
- "ImscaleDecode state",
- imscale_state_enum_ptrs, imscale_state_reloc_ptrs,
- window, dst);
+ "ImscaleDecode state",
+ imscale_state_enum_ptrs, imscale_state_reloc_ptrs,
+ window, dst);
static void
s_imscale_release(stream_state *st)
@@ -8251,8 +8251,8 @@ s_imscale_init(stream_state *st)
ss->dst_size = bytesout;
ss->dst_offset = ss->dst_size;
ss->window = (byte *)gs_alloc_byte_array(mem,
- bytesin + 2, 4,
- "imscale window");
+ bytesin + 2, 4,
+ "imscale window");
ss->dst = (byte *)gs_alloc_bytes(mem, bytesout + 1, "imscale dst");
memset(ss->window, 0xff, (bytesin + 2) * 4);
return 0;
@@ -8268,106 +8268,106 @@ zoom_line(stream_imscale_state *ss)
int i;
for (i = 0; i < ss->dst_size + 1; i++) {
- int iw = (i + 3) >> 2;
- int iwshift = 11 - ((i + 3) & 3) * 2;
- int oshift;
- byte l0, l1, l2, l3;
- byte t0, t1;
+ int iw = (i + 3) >> 2;
+ int iwshift = 11 - ((i + 3) & 3) * 2;
+ int oshift;
+ byte l0, l1, l2, l3;
+ byte t0, t1;
- if (y < 2) {
- l3 = (((window[iw] << 8) | window[iw + 1]) >> iwshift) & 0x1f;
- l2 = (((window[w + iw] << 8) |
- window[w + iw + 1]) >> iwshift) & 0x1f;
- l1 = (((window[w * 2 + iw] << 8) |
- window[w * 2 + iw + 1]) >> iwshift) & 0x1f;
- l0 = (((window[w * 3 + iw] << 8) |
- window[w * 3 + iw + 1]) >> iwshift) & 0x1f;
- oshift = 4 * (1 - y);
- } else {
- l0 = (((window[iw] << 8) | window[iw + 1]) >> iwshift) & 0x1f;
- l1 = (((window[w + iw] << 8) |
- window[w + iw + 1]) >> iwshift) & 0x1f;
- l2 = (((window[w * 2 + iw] << 8) |
- window[w * 2 + iw + 1]) >> iwshift) & 0x1f;
- l3 = (((window[w * 3 + iw] << 8) |
- window[w * 3 + iw + 1]) >> iwshift) & 0x1f;
- oshift = 4 * (y & 1);
- }
- t0 = imasktab[((l0 & 0x1e) << 11) |
- ((l1 & 0x1e) << 7) |
- ((l2 & 0x1e) << 3) |
- ((l3 & 0x1e) >> 1)];
- t1 = imasktab[((l0 & 0xf) << 12) |
- ((l1 & 0xf) << 8) |
- ((l2 & 0xf) << 4) |
- (l3 & 0xf)];
- dst[i] = (((t0 >> oshift) & 0xf) << 4) + ((t1 >> oshift) & 0xf);
+ if (y < 2) {
+ l3 = (((window[iw] << 8) | window[iw + 1]) >> iwshift) & 0x1f;
+ l2 = (((window[w + iw] << 8) |
+ window[w + iw + 1]) >> iwshift) & 0x1f;
+ l1 = (((window[w * 2 + iw] << 8) |
+ window[w * 2 + iw + 1]) >> iwshift) & 0x1f;
+ l0 = (((window[w * 3 + iw] << 8) |
+ window[w * 3 + iw + 1]) >> iwshift) & 0x1f;
+ oshift = 4 * (1 - y);
+ } else {
+ l0 = (((window[iw] << 8) | window[iw + 1]) >> iwshift) & 0x1f;
+ l1 = (((window[w + iw] << 8) |
+ window[w + iw + 1]) >> iwshift) & 0x1f;
+ l2 = (((window[w * 2 + iw] << 8) |
+ window[w * 2 + iw + 1]) >> iwshift) & 0x1f;
+ l3 = (((window[w * 3 + iw] << 8) |
+ window[w * 3 + iw + 1]) >> iwshift) & 0x1f;
+ oshift = 4 * (y & 1);
+ }
+ t0 = imasktab[((l0 & 0x1e) << 11) |
+ ((l1 & 0x1e) << 7) |
+ ((l2 & 0x1e) << 3) |
+ ((l3 & 0x1e) >> 1)];
+ t1 = imasktab[((l0 & 0xf) << 12) |
+ ((l1 & 0xf) << 8) |
+ ((l2 & 0xf) << 4) |
+ (l3 & 0xf)];
+ dst[i] = (((t0 >> oshift) & 0xf) << 4) + ((t1 >> oshift) & 0xf);
}
for (i = 0; i < ss->dst_size; i++)
- dst[i] = (dst[i] << 2) + (dst[i + 1] >> 6);
+ dst[i] = (dst[i] << 2) + (dst[i + 1] >> 6);
}
static int
s_imscale_process(stream_state *st, stream_cursor_read *pr,
- stream_cursor_write *pw, bool last)
+ stream_cursor_write *pw, bool last)
{
stream_imscale_state *const ss = (stream_imscale_state *) st;
while (1) {
- /* deliver data from dst buffer */
- if (ss->dst_offset < ss->dst_size) {
- uint ncopy = min(pw->limit - pw->ptr,
- ss->dst_size - ss->dst_offset);
+ /* deliver data from dst buffer */
+ if (ss->dst_offset < ss->dst_size) {
+ uint ncopy = min(pw->limit - pw->ptr,
+ ss->dst_size - ss->dst_offset);
- if (ncopy == 0)
- return 1;
- memcpy(pw->ptr + 1, (byte *)ss->dst + ss->dst_offset, ncopy);
- pw->ptr += ncopy;
- ss->dst_offset += ncopy;
- }
+ if (ncopy == 0)
+ return 1;
+ memcpy(pw->ptr + 1, (byte *)ss->dst + ss->dst_offset, ncopy);
+ pw->ptr += ncopy;
+ ss->dst_offset += ncopy;
+ }
- /* output a row, if possible */
- if (ss->dst_offset == ss->dst_size &&
- ss->dst_y < ss->src_y * 4 - 6) {
- zoom_line(ss);
- ss->dst_offset = 0;
- ss->dst_y += 1;
- }
+ /* output a row, if possible */
+ if (ss->dst_offset == ss->dst_size &&
+ ss->dst_y < ss->src_y * 4 - 6) {
+ zoom_line(ss);
+ ss->dst_offset = 0;
+ ss->dst_y += 1;
+ }
- /* input into window */
- if (ss->dst_y >= ss->src_y * 4 - 6) {
- int w = ss->src_size + 2;
- uint rleft = pr->limit - pr->ptr;
- uint ncopy = min(rleft, ss->src_size - ss->src_offset);
+ /* input into window */
+ if (ss->dst_y >= ss->src_y * 4 - 6) {
+ int w = ss->src_size + 2;
+ uint rleft = pr->limit - pr->ptr;
+ uint ncopy = min(rleft, ss->src_size - ss->src_offset);
- if (ss->src_y >= ss->params.HeightIn) {
- last = true;
- ncopy = 0;
- }
- if (rleft == 0 && !last)
- return 0; /* need more input */
+ if (ss->src_y >= ss->params.HeightIn) {
+ last = true;
+ ncopy = 0;
+ }
+ if (rleft == 0 && !last)
+ return 0; /* need more input */
/* if (rleft == 0)
return EOFC; */ /* end of file. pass along in stream */
- if (ss->src_offset == 0) {
- /* could maintain window as ring (y mod 4 addressing),
- but this is simpler */
- memmove(ss->window, ss->window + w, 3 * w);
- }
- if (ncopy) {
- memcpy(ss->window + 3 * w + ss->src_offset + 1,
- pr->ptr + 1,
- ncopy);
- ss->src_offset += ncopy;
- pr->ptr += ncopy;
- } else {
- memset(ss->window + 3 * w, 0xff, w);
- ss->src_offset += ss->src_size;
- }
- if (ss->src_offset == ss->src_size) {
- ss->src_offset = 0;
- ss->src_y += 1;
- }
- }
+ if (ss->src_offset == 0) {
+ /* could maintain window as ring (y mod 4 addressing),
+ but this is simpler */
+ memmove(ss->window, ss->window + w, 3 * w);
+ }
+ if (ncopy) {
+ memcpy(ss->window + 3 * w + ss->src_offset + 1,
+ pr->ptr + 1,
+ ncopy);
+ ss->src_offset += ncopy;
+ pr->ptr += ncopy;
+ } else {
+ memset(ss->window + 3 * w, 0xff, w);
+ ss->src_offset += ss->src_size;
+ }
+ if (ss->src_offset == ss->src_size) {
+ ss->src_offset = 0;
+ ss->src_y += 1;
+ }
+ }
}
}
diff --git a/gs/base/simscale.h b/gs/base/simscale.h
index a2eddc93e..540411322 100644
--- a/gs/base/simscale.h
+++ b/gs/base/simscale.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/siscale.c b/gs/base/siscale.c
index fdd11f538..5dd125b63 100644
--- a/gs/base/siscale.c
+++ b/gs/base/siscale.c
@@ -104,7 +104,6 @@ Mitchell_filter(double t)
return 0;
}
-
/* Interpolated filter definition */
#define Interp_support 1
#define Interp_min_scale 0
@@ -278,7 +277,6 @@ calculate_contrib(
return last_index;
}
-
/* Apply filter to zoom horizontally from src to tmp. */
static void
zoom_x(byte * tmp, const void /*PixelIn */ *src, int sizeofPixelIn,
@@ -348,7 +346,6 @@ zoom_x(byte * tmp, const void /*PixelIn */ *src, int sizeofPixelIn,
}
}
-
/*
* Apply filter to zoom vertically from tmp to dst.
* This is simpler because we can treat all columns identically
diff --git a/gs/base/siscale.h b/gs/base/siscale.h
index 0dc478b51..1f189630d 100644
--- a/gs/base/siscale.h
+++ b/gs/base/siscale.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/sisparam.h b/gs/base/sisparam.h
index 4197cd9a1..1456e5926 100644
--- a/gs/base/sisparam.h
+++ b/gs/base/sisparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,11 +49,11 @@ typedef struct stream_image_scale_params_s {
int Colors; /* >= 1 */
int BitsPerComponentIn; /* bits per input value, 8 or 16 */
uint MaxValueIn; /* max value of input component, */
- /* 0 < MaxValueIn < 1 << BitsPerComponentIn */
+ /* 0 < MaxValueIn < 1 << BitsPerComponentIn */
int WidthIn, HeightIn; /* > 0 */
int BitsPerComponentOut; /* bits per output value, 8 or 16 */
uint MaxValueOut; /* max value of output component, */
- /* 0 < MaxValueOut < 1 << BitsPerComponentOut*/
+ /* 0 < MaxValueOut < 1 << BitsPerComponentOut*/
int WidthOut, HeightOut; /* > 0 */
bool ColorPolarityAdditive; /* needed by SpecialDownScale filter */
int src_y_offset; /* Offset of the subimage in the source image. */
diff --git a/gs/base/sjbig2.c b/gs/base/sjbig2.c
index 4716c5ded..eb7347808 100644
--- a/gs/base/sjbig2.c
+++ b/gs/base/sjbig2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,10 +40,10 @@ private_st_jbig2decode_state(); /* creates a gc object for our state, defined in
/* error callback for jbig2 decoder */
static int
s_jbig2decode_error(void *error_callback_data, const char *msg, Jbig2Severity severity,
- int32_t seg_idx)
+ int32_t seg_idx)
{
- stream_jbig2decode_state *const state =
- (stream_jbig2decode_state *) error_callback_data;
+ stream_jbig2decode_state *const state =
+ (stream_jbig2decode_state *) error_callback_data;
const char *type;
char segment[22];
int code = 0;
@@ -58,18 +58,18 @@ s_jbig2decode_error(void *error_callback_data, const char *msg, Jbig2Severity se
case JBIG2_SEVERITY_FATAL:
type = "FATAL ERROR decoding image:";
/* pass the fatal error upstream if possible */
- code = gs_error_ioerror;
- if (state != NULL) state->error = code;
- break;;
+ code = gs_error_ioerror;
+ if (state != NULL) state->error = code;
+ break;;
default: type = "unknown message:"; break;;
}
if (seg_idx == -1) segment[0] = '\0';
else sprintf(segment, "(segment 0x%02x)", seg_idx);
if (severity == JBIG2_SEVERITY_FATAL) {
- dlprintf3("jbig2dec %s %s %s\n", type, msg, segment);
+ dlprintf3("jbig2dec %s %s %s\n", type, msg, segment);
} else {
- if_debug3('w', "[w] jbig2dec %s %s %s\n", type, msg, segment);
+ if_debug3('w', "[w] jbig2dec %s %s %s\n", type, msg, segment);
}
return code;
@@ -82,7 +82,7 @@ static void
s_jbig2decode_invert_buffer(unsigned char *buf, int length)
{
int i;
-
+
for (i = 0; i < length; i++)
*buf++ ^= 0xFF;
}
@@ -94,30 +94,30 @@ s_jbig2decode_make_global_data(byte *data, uint length, void **result)
{
Jbig2Ctx *ctx = NULL;
int code;
-
+
/* the cvision encoder likes to include empty global streams */
if (length == 0) {
if_debug0('w', "[w] ignoring zero-length jbig2 global stream.\n");
- *result = NULL;
- return 0;
+ *result = NULL;
+ return 0;
}
-
+
/* allocate a context with which to parse our global segments */
- ctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, NULL,
+ ctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, NULL,
s_jbig2decode_error, NULL);
-
+
/* parse the global bitstream */
code = jbig2_data_in(ctx, data, length);
-
+
if (code) {
- /* error parsing the global stream */
- *result = NULL;
- return code;
+ /* error parsing the global stream */
+ *result = NULL;
+ return code;
}
/* canonize and store our global state */
*result = jbig2_make_global_ctx(ctx);
-
+
return 0; /* todo: check for allocation failure */
}
@@ -149,7 +149,7 @@ s_jbig2decode_init(stream_state * ss)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) ss;
Jbig2GlobalCtx *global_ctx = state->global_ctx; /* may be NULL */
-
+
/* initialize the decoder with the parsed global context if any */
state->decode_ctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED,
global_ctx, s_jbig2decode_error, ss);
@@ -163,15 +163,15 @@ s_jbig2decode_init(stream_state * ss)
*/
static int
s_jbig2decode_process(stream_state * ss, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) ss;
Jbig2Image *image = state->image;
long in_size = pr->limit - pr->ptr;
long out_size = pw->limit - pw->ptr;
int status = 0;
-
- /* there will only be a single page image,
+
+ /* there will only be a single page image,
so pass all data in before looking for any output.
note that the gs stream library expects offset-by-one
indexing of the buffers, while jbig2dec uses normal 0 indexes */
@@ -183,8 +183,8 @@ s_jbig2decode_process(stream_state * ss, stream_cursor_read * pr,
if (last == 1) {
jbig2_complete_page(state->decode_ctx);
}
- /* handle fatal decoding errors reported through our callback */
- if (state->error) return state->error;
+ /* handle fatal decoding errors reported through our callback */
+ if (state->error) return state->error;
}
if (out_size > 0) {
if (image == NULL) {
@@ -205,8 +205,8 @@ s_jbig2decode_process(stream_state * ss, stream_cursor_read * pr,
pw->ptr += usable;
status = (state->offset < image_size) ? 1 : 0;
}
- }
-
+ }
+
return status;
}
@@ -234,7 +234,7 @@ static void
s_jbig2decode_set_defaults(stream_state *ss)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) ss;
-
+
/* state->global_ctx is not owned by us */
state->global_struct = NULL;
state->global_ctx = NULL;
@@ -244,10 +244,9 @@ s_jbig2decode_set_defaults(stream_state *ss)
state->error = 0;
}
-
/* stream template */
const stream_template s_jbig2decode_template = {
- &st_jbig2decode_state,
+ &st_jbig2decode_state,
s_jbig2decode_init,
s_jbig2decode_process,
1, 1, /* min in and out buffer sizes we can handle --should be ~32k,64k for efficiency? */
diff --git a/gs/base/sjbig2.h b/gs/base/sjbig2.h
index a76efa8c5..9f65937ed 100644
--- a/gs/base/sjbig2.h
+++ b/gs/base/sjbig2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,7 +24,7 @@
/* See zfjbig2.c for details. */
typedef struct s_jbig2_global_data_s {
- void *data;
+ void *data;
} s_jbig2_global_data_t;
/* JBIG2Decode internal stream state */
@@ -53,5 +53,5 @@ int
s_jbig2decode_set_global_data(stream_state *ss, s_jbig2_global_data_t *gd);
void
s_jbig2decode_free_global_data(void *data);
-
+
#endif /* sjbig2_INCLUDED */
diff --git a/gs/base/sjbig2_luratech.c b/gs/base/sjbig2_luratech.c
index ee8adcd0d..903c7918b 100644
--- a/gs/base/sjbig2_luratech.c
+++ b/gs/base/sjbig2_luratech.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,25 +30,25 @@
you can change the following undefs to defines and set them here. */
/***
#ifndef JB2_LICENSE_NUM_1
-# undef JB2_LICENSE_NUM_1
+# undef JB2_LICENSE_NUM_1
#endif
#ifndef JB2_LICENSE_NUM_2
-# undef JB2_LICENSE_NUM_2
+# undef JB2_LICENSE_NUM_2
#endif
***/
/* The /JBIG2Decode filter is a fairly memory intensive one to begin with,
- Furthermore, as a PDF 1.4 feature, we can assume a fairly large
- (host-level) machine. We therefore dispense with the normal
- Ghostscript memory discipline and let the library allocate all its
- resources on the heap. The pointers to these are not enumerated and
- so will not be garbage collected. We rely on our release() proc being
+ Furthermore, as a PDF 1.4 feature, we can assume a fairly large
+ (host-level) machine. We therefore dispense with the normal
+ Ghostscript memory discipline and let the library allocate all its
+ resources on the heap. The pointers to these are not enumerated and
+ so will not be garbage collected. We rely on our release() proc being
called to deallocate state.
*/
/* TODO: check allocations for integer overflow */
/* create a gc object for our state, defined in sjbig2_luratech.h */
-private_st_jbig2decode_state();
+private_st_jbig2decode_state();
#define JBIG2_BUFFER_SIZE 4096
@@ -69,8 +69,8 @@ s_jbig2decode_make_global_data(byte *data, uint size, void **result)
global->data = malloc(size);
if (global->data == NULL) {
- free(global);
- return gs_error_VMerror;
+ free(global);
+ return gs_error_VMerror;
}
memcpy(global->data, data, size);
global->size = size;
@@ -86,8 +86,8 @@ s_jbig2decode_free_global_data(void *data)
s_jbig2decode_global_data *global = (s_jbig2decode_global_data*)data;
if (global->size && global->data) {
- free(global->data);
- global->size = 0;
+ free(global->data);
+ global->size = 0;
}
free(global);
}
@@ -99,7 +99,7 @@ s_jbig2decode_set_global_data(stream_state *ss, s_jbig2_global_data_t *gd)
stream_jbig2decode_state *state = (stream_jbig2decode_state*)ss;
if (state == NULL)
return gs_error_VMerror;
-
+
state->global_struct = gd;
if (gd != NULL) {
s_jbig2decode_global_data *global = (s_jbig2decode_global_data*)(gd->data);
@@ -119,7 +119,7 @@ static void
s_jbig2_invert_buffer(unsigned char *buf, int length)
{
int i;
-
+
for (i = 0; i < length; i++)
*buf++ ^= 0xFF;
}
@@ -152,20 +152,20 @@ s_jbig2_message(const char *message, JB2_Message_Level level, void *userdata)
if (message[0] == '\0') return;
switch (level) {
- case cJB2_Message_Information:
+ case cJB2_Message_Information:
type = "info"; break;;
- case cJB2_Message_Warning:
- type = "WARNING"; break;;
- case cJB2_Message_Error:
- type = "ERROR"; break;;
- default:
- type = "unknown message"; break;;
+ case cJB2_Message_Warning:
+ type = "WARNING"; break;;
+ case cJB2_Message_Error:
+ type = "ERROR"; break;;
+ default:
+ type = "unknown message"; break;;
}
if (level == cJB2_Message_Error) {
- dprintf2("Luratech JBIG2 %s %s\n", type, message);
+ dprintf2("Luratech JBIG2 %s %s\n", type, message);
} else {
- if_debug2('w', "[w]Luratech JBIG2 %s %s\n", type, message);
+ if_debug2('w', "[w]Luratech JBIG2 %s %s\n", type, message);
}
return;
@@ -173,18 +173,18 @@ s_jbig2_message(const char *message, JB2_Message_Level level, void *userdata)
/* compressed read callback for jbig2 codec */
static JB2_Size_T JB2_Callback
-s_jbig2_read(unsigned char *buffer,
- JB2_Size_T offset, JB2_Size_T size, void *userdata)
+s_jbig2_read(unsigned char *buffer,
+ JB2_Size_T offset, JB2_Size_T size, void *userdata)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) userdata;
long available;
/* return data from the Globals stream */
if (offset < state->global_size) {
- available = state->global_size - offset;
- if (available > size) available = size;
- memcpy(buffer, state->global_data + offset, available);
- return available;
+ available = state->global_size - offset;
+ if (available > size) available = size;
+ memcpy(buffer, state->global_data + offset, available);
+ return available;
}
/* else return data from the image stream */
@@ -200,16 +200,16 @@ s_jbig2_read(unsigned char *buffer,
/* uncompressed write callback for jbig2 codec */
static JB2_Error JB2_Callback
s_jbig2_write(unsigned char *buffer,
- unsigned long row, unsigned long width,
- unsigned long bbp, void *userdata)
+ unsigned long row, unsigned long width,
+ unsigned long bbp, void *userdata)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) userdata;
unsigned char *line = state->image + row*state->stride;
- long available = ((width - 1) >> 3) + 1;
+ long available = ((width - 1) >> 3) + 1;
if (row >= state->height) {
- dlprintf2("jbig2decode: output for row index %lu of %lu called!\n", row, state->height);
- return cJB2_Error_Invalid_Index;
+ dlprintf2("jbig2decode: output for row index %lu of %lu called!\n", row, state->height);
+ return cJB2_Error_Invalid_Index;
}
memcpy(line, buffer, available);
@@ -218,7 +218,6 @@ s_jbig2_write(unsigned char *buffer,
return cJB2_Error_OK;
}
-
static int
s_jbig2decode_inbuf(stream_jbig2decode_state *state, stream_cursor_read * pr)
{
@@ -285,7 +284,7 @@ s_jbig2decode_init(stream_state * ss)
*/
static int
s_jbig2decode_process(stream_state * ss, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) ss;
long in_size = pr->limit - pr->ptr;
@@ -296,69 +295,69 @@ s_jbig2decode_process(stream_state * ss, stream_cursor_read * pr,
JB2_Rect rect = {0,0,0,0};
ulong result;
int status = last;
-
+
if (in_size > 0) {
/* buffer all available input for the decoder */
- result = s_jbig2decode_inbuf(state, pr);
- if (result) return ERRC;
+ result = s_jbig2decode_inbuf(state, pr);
+ if (result) return ERRC;
}
if (last && out_size > 0) {
- if (state->doc == NULL) {
+ if (state->doc == NULL) {
- /* initialize the codec state and pass our callbacks */
- error = JB2_Document_Start( &(state->doc),
- s_jbig2_alloc, ss, /* alloc and its data */
- s_jbig2_free, ss, /* free and its data */
- s_jbig2_read, ss, /* read callback and data */
- s_jbig2_message, ss); /* message callback and data */
- if (error != cJB2_Error_OK) return ERRC;
+ /* initialize the codec state and pass our callbacks */
+ error = JB2_Document_Start( &(state->doc),
+ s_jbig2_alloc, ss, /* alloc and its data */
+ s_jbig2_free, ss, /* free and its data */
+ s_jbig2_read, ss, /* read callback and data */
+ s_jbig2_message, ss); /* message callback and data */
+ if (error != cJB2_Error_OK) return ERRC;
#if defined(JB2_LICENSE_NUM_1) && defined(JB2_LICENSE_NUM_2)
- /* set the license keys if appropriate */
- error = JB2_Document_Set_License(state->doc,
- JB2_LICENSE_NUM_1, JB2_LICENSE_NUM_2);
- if (error != cJB2_Error_OK) return ERRC;
+ /* set the license keys if appropriate */
+ error = JB2_Document_Set_License(state->doc,
+ JB2_LICENSE_NUM_1, JB2_LICENSE_NUM_2);
+ if (error != cJB2_Error_OK) return ERRC;
#endif
- /* decode relevent image parameters */
- error = JB2_Document_Set_Page(state->doc, 0);
- if (error != cJB2_Error_OK) return ERRC;
- error = JB2_Document_Get_Property(state->doc,
- cJB2_Prop_Page_Width, &result);
- state->width = result;
- error = JB2_Document_Get_Property(state->doc,
- cJB2_Prop_Page_Height, &result);
- if (error != cJB2_Error_OK) return ERRC;
- state->height = result;
- state->stride = ((state->width - 1) >> 3) + 1;
- if_debug2('w', "[w]jbig2decode page is %ldx%ld; allocating image\n", state->width, state->height);
- state->image = malloc(state->height*state->stride);
-
- /* start image decode */
- error = JB2_Document_Decompress_Page(state->doc, scale, rect,
- s_jbig2_write, ss);
- if (error != cJB2_Error_OK) return ERRC;
-
- }
-
- /* copy any buffered image data out */
- available = state->stride*state->height - state->offset;
- if (available > 0) {
- out_size = (out_size > available) ? available : out_size;
- memcpy(pw->ptr+1, state->image + state->offset, out_size);
- state->offset += out_size;
- pw->ptr += out_size;
- }
- /* more data to output? */
- available = state->stride*state->height - state->offset;
- if (available > 0) return 1;
- else return EOFC;
+ /* decode relevent image parameters */
+ error = JB2_Document_Set_Page(state->doc, 0);
+ if (error != cJB2_Error_OK) return ERRC;
+ error = JB2_Document_Get_Property(state->doc,
+ cJB2_Prop_Page_Width, &result);
+ state->width = result;
+ error = JB2_Document_Get_Property(state->doc,
+ cJB2_Prop_Page_Height, &result);
+ if (error != cJB2_Error_OK) return ERRC;
+ state->height = result;
+ state->stride = ((state->width - 1) >> 3) + 1;
+ if_debug2('w', "[w]jbig2decode page is %ldx%ld; allocating image\n", state->width, state->height);
+ state->image = malloc(state->height*state->stride);
+
+ /* start image decode */
+ error = JB2_Document_Decompress_Page(state->doc, scale, rect,
+ s_jbig2_write, ss);
+ if (error != cJB2_Error_OK) return ERRC;
+
+ }
+
+ /* copy any buffered image data out */
+ available = state->stride*state->height - state->offset;
+ if (available > 0) {
+ out_size = (out_size > available) ? available : out_size;
+ memcpy(pw->ptr+1, state->image + state->offset, out_size);
+ state->offset += out_size;
+ pw->ptr += out_size;
+ }
+ /* more data to output? */
+ available = state->stride*state->height - state->offset;
+ if (available > 0) return 1;
+ else return EOFC;
}
-
+
/* handle fatal decoding errors reported through our callback */
if (state->error) return ERRC;
-
+
return status;
}
@@ -369,27 +368,25 @@ s_jbig2decode_release(stream_state *ss)
stream_jbig2decode_state *const state = (stream_jbig2decode_state *) ss;
if (state->doc) {
- JB2_Document_End(&(state->doc));
+ JB2_Document_End(&(state->doc));
if (state->inbuf) free(state->inbuf);
- if (state->image) free(state->image);
+ if (state->image) free(state->image);
}
/* the interpreter calls jbig2decode_free_global_data() separately */
}
/* stream template */
const stream_template s_jbig2decode_template = {
- &st_jbig2decode_state,
+ &st_jbig2decode_state,
s_jbig2decode_init,
s_jbig2decode_process,
1, 1, /* min in and out buffer sizes we can handle --should be ~32k,64k for efficiency? */
s_jbig2decode_release
};
-
-
/** encode support **/
-/* we provide a C-only encode filter for generating embedded JBIG2 image
+/* we provide a C-only encode filter for generating embedded JBIG2 image
data */
/* create a gc object for our state, defined in sjbig2_luratech.h */
@@ -403,9 +400,9 @@ s_jbig2encode_start(stream_jbig2encode_state *state)
/* initialize the compression handle */
err = JB2_Compress_Start(&(state->cmp),
- s_jbig2_alloc, state, /* alloc and its parameter data */
- s_jbig2_free, state, /* free callback */
- s_jbig2_message, state);/* message callback */
+ s_jbig2_alloc, state, /* alloc and its parameter data */
+ s_jbig2_free, state, /* free callback */
+ s_jbig2_message, state);/* message callback */
if (err != cJB2_Error_OK) return err;
/* set the license keys if appropriate */
@@ -417,10 +414,10 @@ s_jbig2encode_start(stream_jbig2encode_state *state)
/* set the image properties */
err = JB2_Compress_Set_Property(state->cmp,
- cJB2_Prop_Page_Width, state->width);
+ cJB2_Prop_Page_Width, state->width);
err = JB2_Compress_Set_Property(state->cmp,
- cJB2_Prop_Page_Height, state->height);
+ cJB2_Prop_Page_Height, state->height);
if (err != cJB2_Error_OK) return err;
/* we otherwise use the default compression parameters */
@@ -431,30 +428,30 @@ s_jbig2encode_start(stream_jbig2encode_state *state)
/* callback for compressed data output */
static JB2_Size_T JB2_Callback
s_jbig2encode_write(const unsigned char *buffer,
- JB2_Size_T pos, JB2_Size_T size, void *userdata)
+ JB2_Size_T pos, JB2_Size_T size, void *userdata)
{
stream_jbig2encode_state *state = (stream_jbig2encode_state *)userdata;
/* allocate the output buffer if necessary */
if (state->outbuf == NULL) {
- state->outbuf = malloc(JBIG2_BUFFER_SIZE);
- if (state->outbuf == NULL) {
- dprintf("jbig2encode: failed to allocate output buffer\n");
- return 0; /* can't return an error! */
- }
- state->outsize = JBIG2_BUFFER_SIZE;
+ state->outbuf = malloc(JBIG2_BUFFER_SIZE);
+ if (state->outbuf == NULL) {
+ dprintf("jbig2encode: failed to allocate output buffer\n");
+ return 0; /* can't return an error! */
+ }
+ state->outsize = JBIG2_BUFFER_SIZE;
}
/* grow the output buffer if necessary */
while (pos+size > state->outsize) {
- unsigned char *new = realloc(state->outbuf, state->outsize*2);
- if (new == NULL) {
- dprintf1("jbig2encode: failed to resize output buffer"
- " beyond %lu bytes\n", state->outsize);
- return 0; /* can't return an error! */
- }
- state->outbuf = new;
- state->outsize *= 2;
+ unsigned char *new = realloc(state->outbuf, state->outsize*2);
+ if (new == NULL) {
+ dprintf1("jbig2encode: failed to resize output buffer"
+ " beyond %lu bytes\n", state->outsize);
+ return 0; /* can't return an error! */
+ }
+ state->outbuf = new;
+ state->outsize *= 2;
}
/* copy data into our buffer; there will now be enough room. */
@@ -462,8 +459,7 @@ s_jbig2encode_write(const unsigned char *buffer,
if (state->outfill < pos + size) state->outfill = pos + size;
return size;
-}
-
+}
/* initialize the steam. */
static int
@@ -508,69 +504,69 @@ s_jbig2encode_process(stream_state * ss, stream_cursor_read * pr,
/* Be greedy in filling our internal line buffer so we always
make read progress on a stream. */
if (in_size > 0) {
- /* initialize the encoder if necessary */
- if (state->cmp == (JB2_Handle_Compress)NULL)
- s_jbig2encode_start(state);
-
- available = in_size;
-
- /* try to fill the line buffer */
- segment = state->stride - state->linefill;
- if (segment > 0) {
- segment = (segment < available) ? segment : available;
- memcpy(state->line + state->linefill, pr->ptr+1, segment);
- pr->ptr += segment;
- available -= segment;
- state->linefill += segment;
- }
- /* pass a full line buffer to the encoder library */
- if (state->linefill == state->stride) {
- s_jbig2_invert_buffer(state->line, state->stride);
- err = JB2_Compress_Line(state->cmp, state->line);
- state->linefill = 0;
- if (err != cJB2_Error_OK) return ERRC;
- }
- /* pass remaining full lines to the encoder library */
- while (available >= state->stride) {
- memcpy(state->line, pr->ptr+1, state->stride);
- s_jbig2_invert_buffer(state->line, state->stride);
- err = JB2_Compress_Line(state->cmp, state->line);
- pr->ptr += state->stride;
- available = pr->limit - pr->ptr;
- if (err != cJB2_Error_OK) return ERRC;
- }
- /* copy remaining data into the line buffer */
- if (available > 0) {
- /* available is always < stride here */
- memcpy(state->line, pr->ptr+1, available);
- pr->ptr += available;
- state->linefill = available;
- }
- if (!last) return 0; /* request more data */
+ /* initialize the encoder if necessary */
+ if (state->cmp == (JB2_Handle_Compress)NULL)
+ s_jbig2encode_start(state);
+
+ available = in_size;
+
+ /* try to fill the line buffer */
+ segment = state->stride - state->linefill;
+ if (segment > 0) {
+ segment = (segment < available) ? segment : available;
+ memcpy(state->line + state->linefill, pr->ptr+1, segment);
+ pr->ptr += segment;
+ available -= segment;
+ state->linefill += segment;
+ }
+ /* pass a full line buffer to the encoder library */
+ if (state->linefill == state->stride) {
+ s_jbig2_invert_buffer(state->line, state->stride);
+ err = JB2_Compress_Line(state->cmp, state->line);
+ state->linefill = 0;
+ if (err != cJB2_Error_OK) return ERRC;
+ }
+ /* pass remaining full lines to the encoder library */
+ while (available >= state->stride) {
+ memcpy(state->line, pr->ptr+1, state->stride);
+ s_jbig2_invert_buffer(state->line, state->stride);
+ err = JB2_Compress_Line(state->cmp, state->line);
+ pr->ptr += state->stride;
+ available = pr->limit - pr->ptr;
+ if (err != cJB2_Error_OK) return ERRC;
+ }
+ /* copy remaining data into the line buffer */
+ if (available > 0) {
+ /* available is always < stride here */
+ memcpy(state->line, pr->ptr+1, available);
+ pr->ptr += available;
+ state->linefill = available;
+ }
+ if (!last) return 0; /* request more data */
}
if (last && state->outbuf == NULL) {
- /* convert the compression context to a document context */
- err = JB2_Compress_End(&(state->cmp), &(state->doc));
- if (err != cJB2_Error_OK) return ERRC;
- /* dump the compressed data out through a callback;
- unfortunately we can't serialize this across process calls */
- err = JB2_Document_Export_Document(state->doc,
- s_jbig2encode_write, state,
- cJB2_Export_Format_Stream_For_PDF);
- if (err != cJB2_Error_OK) return ERRC;
+ /* convert the compression context to a document context */
+ err = JB2_Compress_End(&(state->cmp), &(state->doc));
+ if (err != cJB2_Error_OK) return ERRC;
+ /* dump the compressed data out through a callback;
+ unfortunately we can't serialize this across process calls */
+ err = JB2_Document_Export_Document(state->doc,
+ s_jbig2encode_write, state,
+ cJB2_Export_Format_Stream_For_PDF);
+ if (err != cJB2_Error_OK) return ERRC;
}
if (state->outbuf != NULL) {
- /* copy available output data */
- available = min(out_size, state->outfill - state->offset);
- memcpy(pw->ptr + 1, state->outbuf + state->offset, available);
- pw->ptr += available;
- state->offset += available;
-
- /* need further output space? */
- if (state->outfill - state->offset > 0) return 1;
- else return EOFC; /* all done */
+ /* copy available output data */
+ available = min(out_size, state->outfill - state->offset);
+ memcpy(pw->ptr + 1, state->outbuf + state->offset, available);
+ pw->ptr += available;
+ state->offset += available;
+
+ /* need further output space? */
+ if (state->outfill - state->offset > 0) return 1;
+ else return EOFC; /* all done */
}
/* something went wrong above */
@@ -593,7 +589,7 @@ const stream_template s_jbig2encode_template = {
&st_jbig2encode_state,
s_jbig2encode_init,
s_jbig2encode_process,
- 1024, 1024, /* min in and out buffer sizes; could be smaller, but
- this is more efficient */
+ 1024, 1024, /* min in and out buffer sizes; could be smaller, but
+ this is more efficient */
s_jbig2encode_release
};
diff --git a/gs/base/sjbig2_luratech.h b/gs/base/sjbig2_luratech.h
index 15a34d5ff..171e579ee 100644
--- a/gs/base/sjbig2_luratech.h
+++ b/gs/base/sjbig2_luratech.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@
/* See zfjbig2.c for details. */
typedef struct s_jbig2_global_data_s {
- void *data;
+ void *data;
} s_jbig2_global_data_t;
/* JBIG2Decode internal stream state */
@@ -58,7 +58,6 @@ s_jbig2decode_set_global_data(stream_state *ss, s_jbig2_global_data_t *gs);
void
s_jbig2decode_free_global_data(void *data);
-
/* JBIG2 encoder internal state */
typedef struct stream_jbig2encode_state_s
{
@@ -70,9 +69,9 @@ typedef struct stream_jbig2encode_state_s
unsigned char *line; /* single line working buffer */
unsigned long linefill; /* bytes in the working buffer */
unsigned char *outbuf; /* output data buffer */
- unsigned long outsize; /* bytes available in the buffer */
- unsigned long outfill; /* bytes written to the buffer */
- unsigned long offset; /* bytes written from the buffer */
+ unsigned long outsize; /* bytes available in the buffer */
+ unsigned long outfill; /* bytes written to the buffer */
+ unsigned long offset; /* bytes written from the buffer */
} stream_jbig2encode_state;
diff --git a/gs/base/sjpeg.h b/gs/base/sjpeg.h
index a95329263..94b4d155b 100644
--- a/gs/base/sjpeg.h
+++ b/gs/base/sjpeg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,25 +42,25 @@ int gs_jpeg_destroy(stream_DCT_state * st);
int gs_jpeg_create_compress(stream_DCT_state * st);
int gs_jpeg_set_defaults(stream_DCT_state * st);
int gs_jpeg_set_colorspace(stream_DCT_state * st,
- J_COLOR_SPACE colorspace);
+ J_COLOR_SPACE colorspace);
int gs_jpeg_set_linear_quality(stream_DCT_state * st,
- int scale_factor, boolean force_baseline);
+ int scale_factor, boolean force_baseline);
int gs_jpeg_set_quality(stream_DCT_state * st,
- int quality, boolean force_baseline);
+ int quality, boolean force_baseline);
int gs_jpeg_start_compress(stream_DCT_state * st,
- boolean write_all_tables);
+ boolean write_all_tables);
int gs_jpeg_write_scanlines(stream_DCT_state * st,
- JSAMPARRAY scanlines, int num_lines);
+ JSAMPARRAY scanlines, int num_lines);
int gs_jpeg_finish_compress(stream_DCT_state * st);
/* Decode */
int gs_jpeg_create_decompress(stream_DCT_state * st);
int gs_jpeg_read_header(stream_DCT_state * st,
- boolean require_image);
+ boolean require_image);
int gs_jpeg_start_decompress(stream_DCT_state * st);
int gs_jpeg_read_scanlines(stream_DCT_state * st,
- JSAMPARRAY scanlines, int max_lines);
+ JSAMPARRAY scanlines, int max_lines);
int gs_jpeg_finish_decompress(stream_DCT_state * st);
#endif /* sjpeg_INCLUDED */
diff --git a/gs/base/sjpegc.c b/gs/base/sjpegc.c
index d7a810234..b050191c8 100644
--- a/gs/base/sjpegc.c
+++ b/gs/base/sjpegc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,11 +52,11 @@ typedef void *backing_store_ptr;
long
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed,
- long max_bytes_needed, long already_allocated);
+ long max_bytes_needed, long already_allocated);
void
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info,
- long total_bytes_needed);
+ long total_bytes_needed);
long
jpeg_mem_init(j_common_ptr cinfo);
@@ -82,7 +82,7 @@ gs_jpeg_error_exit(j_common_ptr cinfo)
{
jpeg_stream_data *jcomdp =
(jpeg_stream_data *) ((char *)cinfo -
- offset_of(jpeg_compress_data, cinfo));
+ offset_of(jpeg_compress_data, cinfo));
longjmp(find_jmp_buf(jcomdp->exit_jmpbuf), 1);
}
@@ -91,14 +91,14 @@ static void
gs_jpeg_emit_message(j_common_ptr cinfo, int msg_level)
{
if (msg_level < 0) { /* GS policy is to ignore IJG warnings when Picky=0,
- * treat them as errors when Picky=1.
- */
- jpeg_stream_data *jcomdp =
- (jpeg_stream_data *) ((char *)cinfo -
- offset_of(jpeg_compress_data, cinfo));
-
- if (jcomdp->Picky)
- gs_jpeg_error_exit(cinfo);
+ * treat them as errors when Picky=1.
+ */
+ jpeg_stream_data *jcomdp =
+ (jpeg_stream_data *) ((char *)cinfo -
+ offset_of(jpeg_compress_data, cinfo));
+
+ if (jcomdp->Picky)
+ gs_jpeg_error_exit(cinfo);
}
/* Trace messages are always ignored. */
}
@@ -137,45 +137,42 @@ gs_jpeg_log_error(stream_DCT_state * st)
return gs_error_ioerror; /* caller will do return_error() */
}
-
/*
* Interface routines. This layer of routines exists solely to limit
* side-effects from using setjmp.
*/
-
JQUANT_TBL *
gs_jpeg_alloc_quant_table(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf))) {
- gs_jpeg_log_error(st);
- return NULL;
+ gs_jpeg_log_error(st);
+ return NULL;
}
return jpeg_alloc_quant_table((j_common_ptr)
- & st->data.compress->cinfo);
+ & st->data.compress->cinfo);
}
JHUFF_TBL *
gs_jpeg_alloc_huff_table(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf))) {
- gs_jpeg_log_error(st);
- return NULL;
+ gs_jpeg_log_error(st);
+ return NULL;
}
return jpeg_alloc_huff_table((j_common_ptr)
- & st->data.compress->cinfo);
+ & st->data.compress->cinfo);
}
int
gs_jpeg_destroy(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_destroy((j_common_ptr) & st->data.compress->cinfo);
return 0;
}
-
/*
* These routines replace the low-level memory manager of the IJG library.
* They pass malloc/free calls to the Ghostscript memory manager.
@@ -195,15 +192,15 @@ jpeg_alloc(j_common_ptr cinfo, size_t size, const char *info)
{
jpeg_compress_data *jcd = cinfo2jcd(cinfo);
gs_memory_t *mem = jcd->memory;
-
+
jpeg_block_t *p = gs_alloc_struct_immovable(mem, jpeg_block_t,
- &st_jpeg_block, "jpeg_alloc(block)");
+ &st_jpeg_block, "jpeg_alloc(block)");
void *data = gs_alloc_bytes_immovable(mem, size, info);
if (p == 0 || data == 0) {
- gs_free_object(mem, data, info);
- gs_free_object(mem, p, "jpeg_alloc(block)");
- return 0;
+ gs_free_object(mem, data, info);
+ gs_free_object(mem, p, "jpeg_alloc(block)");
+ return 0;
}
p->data = data;
p->next = jcd->blocks;
@@ -257,14 +254,14 @@ jpeg_free_large(j_common_ptr cinfo, void FAR * object, size_t size)
long
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed,
- long max_bytes_needed, long already_allocated)
+ long max_bytes_needed, long already_allocated)
{
return max_bytes_needed;
}
void
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info,
- long total_bytes_needed)
+ long total_bytes_needed)
{
ERREXIT(cinfo, JERR_NO_BACKING_STORE);
}
diff --git a/gs/base/sjpegd.c b/gs/base/sjpegd.c
index 7f7068d69..82cd852ff 100644
--- a/gs/base/sjpegd.c
+++ b/gs/base/sjpegd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ gs_jpeg_create_decompress(stream_DCT_state * st)
gs_jpeg_error_setup(st);
/* Establish the setjmp return context for gs_jpeg_error_exit to use. */
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_stream_data_common_init(st->data.decompress);
jpeg_create_decompress(&st->data.decompress->dinfo);
@@ -42,10 +42,10 @@ gs_jpeg_create_decompress(stream_DCT_state * st)
int
gs_jpeg_read_header(stream_DCT_state * st,
- boolean require_image)
+ boolean require_image)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
return jpeg_read_header(&st->data.decompress->dinfo, require_image);
}
@@ -53,7 +53,7 @@ int
gs_jpeg_start_decompress(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
#if JPEG_LIB_VERSION > 55
return (int)jpeg_start_decompress(&st->data.decompress->dinfo);
#else
@@ -65,19 +65,19 @@ gs_jpeg_start_decompress(stream_DCT_state * st)
int
gs_jpeg_read_scanlines(stream_DCT_state * st,
- JSAMPARRAY scanlines,
- int max_lines)
+ JSAMPARRAY scanlines,
+ int max_lines)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
return (int)jpeg_read_scanlines(&st->data.decompress->dinfo,
- scanlines, (JDIMENSION) max_lines);
+ scanlines, (JDIMENSION) max_lines);
}
int
gs_jpeg_finish_decompress(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
return (int)jpeg_finish_decompress(&st->data.decompress->dinfo);
}
diff --git a/gs/base/sjpege.c b/gs/base/sjpege.c
index 63994cb24..8e095b06f 100644
--- a/gs/base/sjpege.c
+++ b/gs/base/sjpege.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ gs_jpeg_create_compress(stream_DCT_state * st)
gs_jpeg_error_setup(st);
/* Establish the setjmp return context for gs_jpeg_error_exit to use. */
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_stream_data_common_init(st->data.compress);
jpeg_create_compress(&st->data.compress->cinfo);
@@ -44,69 +44,69 @@ int
gs_jpeg_set_defaults(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_set_defaults(&st->data.compress->cinfo);
return 0;
}
int
gs_jpeg_set_colorspace(stream_DCT_state * st,
- J_COLOR_SPACE colorspace)
+ J_COLOR_SPACE colorspace)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_set_colorspace(&st->data.compress->cinfo, colorspace);
return 0;
}
int
gs_jpeg_set_linear_quality(stream_DCT_state * st,
- int scale_factor, boolean force_baseline)
+ int scale_factor, boolean force_baseline)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_set_linear_quality(&st->data.compress->cinfo,
- scale_factor, force_baseline);
+ scale_factor, force_baseline);
return 0;
}
int
gs_jpeg_set_quality(stream_DCT_state * st,
- int quality, boolean force_baseline)
+ int quality, boolean force_baseline)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_set_quality(&st->data.compress->cinfo,
- quality, force_baseline);
+ quality, force_baseline);
return 0;
}
int
gs_jpeg_start_compress(stream_DCT_state * st,
- boolean write_all_tables)
+ boolean write_all_tables)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_start_compress(&st->data.compress->cinfo, write_all_tables);
return 0;
}
int
gs_jpeg_write_scanlines(stream_DCT_state * st,
- JSAMPARRAY scanlines,
- int num_lines)
+ JSAMPARRAY scanlines,
+ int num_lines)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
return (int)jpeg_write_scanlines(&st->data.compress->cinfo,
- scanlines, (JDIMENSION) num_lines);
+ scanlines, (JDIMENSION) num_lines);
}
int
gs_jpeg_finish_compress(stream_DCT_state * st)
{
if (setjmp(find_jmp_buf(st->data.common->exit_jmpbuf)))
- return_error(gs_jpeg_log_error(st));
+ return_error(gs_jpeg_log_error(st));
jpeg_finish_compress(&st->data.compress->cinfo);
return 0;
}
diff --git a/gs/base/sjpx.c b/gs/base/sjpx.c
index ec325e984..6780692ad 100644
--- a/gs/base/sjpx.c
+++ b/gs/base/sjpx.c
@@ -277,8 +277,7 @@ copy_row_yuv(byte *dest, jas_image_t *image,
return count;
}
-
-static inline bool
+static inline bool
is_color_component(jas_image_t *image, int n)
{
int k = jas_image_cmpttype(image, n) & (JAS_IMAGE_CT_UNKNOWN | JAS_IMAGE_CT_OPACITY);
@@ -381,7 +380,6 @@ copy_row_1comp16(byte *dest, jas_image_t *image,
return bytes-count;
}
-
/* buffer the input stream into our state */
static int
s_jpxd_buffer_input(stream_jpxd_state *const state, stream_cursor_read *pr,
@@ -514,9 +512,9 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr,
usable = min(out_size, stride - x);
/* now samples */
if (bits > 8) {
- x = x/(numcmpts*2);
+ x = x/(numcmpts*2);
} else {
- x = x/numcmpts;
+ x = x/numcmpts;
}
/* Make sure we can return a full pixel.
This can fail if we get the colorspace wrong. */
@@ -630,7 +628,6 @@ s_jpxd_set_defaults(stream_state *ss)
state->alpha = false;
}
-
/* stream template */
const stream_template s_jpxd_template = {
&st_jpxd_state,
diff --git a/gs/base/sjpx_luratech.c b/gs/base/sjpx_luratech.c
index c07b22b31..86b440ec0 100644
--- a/gs/base/sjpx_luratech.c
+++ b/gs/base/sjpx_luratech.c
@@ -145,7 +145,7 @@ s_jpxd_write_data(unsigned char * pucData,
if (state->bpc == 4) {
int even = ulNum & ~1;
dst = &state->image[state->stride * ulRow + ulStart/2];
- for (i = 0; i < even; i += 2)
+ for (i = 0; i < even; i += 2)
*dst++ = pucData[i] << 4 | pucData[i+1];
if (ulNum & 1)
*dst++ = pucData[ulNum - 1] << 4;
@@ -172,8 +172,8 @@ s_jpxd_write_data(unsigned char * pucData,
int i;
unsigned char *dst = &state->image[state->stride * ulRow + ulStart/2];
int even = ulNum & ~1;
-
- for (i = 0; i < even; i+=2)
+
+ for (i = 0; i < even; i+=2)
*dst++ = pucData[i] << 4 | pucData[i+1];
if (ulNum & 1)
*dst++ = pucData[ulNum - 1] << 4;
@@ -225,7 +225,7 @@ s_jpxd_write_data(unsigned char * pucData,
}
/* convert state->image from YCrCb to RGBa */
-static int
+static int
s_jpxd_ycc_to_rgb(stream_jpxd_state *state)
{
int i, y, x;
@@ -353,7 +353,7 @@ s_jpxd_init(stream_state * ss)
static int
s_jpxd_set_defaults(stream_state * ss) {
stream_jpxd_state *const state = (stream_jpxd_state *) ss;
-
+
state->alpha = false;
state->image_is_indexed = false;
return 0;
@@ -597,7 +597,7 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr,
state->stride = (state->width * max(1, state->ncomp) * real_bpc + 7) / 8;
state->image = malloc(state->stride*state->height);
}
- if (state->image == NULL)
+ if (state->image == NULL)
return ERRC;
if (state->ncomp == 0) /* make fully opaque mask */
memset(state->image, 255, state->stride*state->height);
@@ -639,9 +639,9 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr,
pw->ptr += available;
/* more output to deliver? */
if (state->offset == state->stride*state->height)
- return EOFC;
- else
- return 1;
+ return EOFC;
+ else
+ return 1;
}
}
@@ -677,8 +677,6 @@ const stream_template s_jpxd_template = {
s_jpxd_set_defaults
};
-
-
/*** encode support **/
/* we provide a C-only encode filter for generating JPX image data
@@ -955,7 +953,6 @@ s_jpxe_process(stream_state *ss, stream_cursor_read *pr,
return ERRC;
}
-
if (in_size > 0) {
/* allocate our input buffer if necessary */
if (state->inbuf == NULL) {
diff --git a/gs/base/sjpx_luratech.h b/gs/base/sjpx_luratech.h
index 5eab08d3c..71bce5168 100644
--- a/gs/base/sjpx_luratech.h
+++ b/gs/base/sjpx_luratech.h
@@ -76,9 +76,9 @@ typedef struct stream_jpxe_state_s {
/* the following members can be optionally set by the caller: */
unsigned int quality; /* compressed image quality target; 1-100
- leave unset for the default */
+ leave unset for the default */
int lossless; /* set to 1 to specify lossless image
- compression; overrides quality */
+ compression; overrides quality */
/* the remainder are handled internally: */
unsigned int components; /* number of image channels */
diff --git a/gs/base/slzwc.c b/gs/base/slzwc.c
index 705f2652f..9aeadc406 100644
--- a/gs/base/slzwc.c
+++ b/gs/base/slzwc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/slzwd.c b/gs/base/slzwd.c
index f45b12c50..26691f648 100644
--- a/gs/base/slzwd.c
+++ b/gs/base/slzwd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,7 +63,7 @@ s_LZWD_reset(stream_state * st)
dc[code_reset].len = 255;
dc[code_eod].len = 255;
for (i = 0; i < code_escape; i++, dc++)
- dc->datum = i, dc->len = 1, dc->prefix = code_eod;
+ dc->datum = i, dc->len = 1, dc->prefix = code_eod;
return 0;
}
static int
@@ -72,11 +72,11 @@ s_LZWD_init(stream_state * st)
stream_LZW_state *const ss = (stream_LZW_state *) st;
lzw_decode *dc =
gs_alloc_struct_array(st->memory, lzw_decode_max + 1,
- lzw_decode, &st_lzw_decode_element,
- "LZWDecode(init)");
+ lzw_decode, &st_lzw_decode_element,
+ "LZWDecode(init)");
if (dc == 0)
- return ERRC;
+ return ERRC;
/****** WRONG ******/
ss->table.decode = dc;
ss->min_left = 1;
@@ -86,7 +86,7 @@ s_LZWD_init(stream_state * st)
/* Process a buffer */
static int
s_LZWD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_LZW_state *const ss = (stream_LZW_state *) st;
register const byte *p = pr->ptr;
@@ -121,111 +121,111 @@ s_LZWD_process(stream_state * st, stream_cursor_read * pr,
byte *q1;
if_debug2('w', "[w]process decode: code_size=%d next_code=%d\n",
- code_size, next_code);
+ code_size, next_code);
#define set_code_size()\
code_mask = (1 << code_size) - 1,\
switch_code = code_mask + 1 - ss->EarlyChange
set_code_size();
if (!ss->BlockData)
- bytes_left = rlimit - p + 2; /* never stop for bytes_left */
+ bytes_left = rlimit - p + 2; /* never stop for bytes_left */
/* If we are in the middle of copying a string, */
/* do some more now. */
if (code >= 0) {
- int rlen = ss->copy_left;
- int wlen = wlimit - q;
- int n = len = min(rlen, wlen);
+ int rlen = ss->copy_left;
+ int wlen = wlimit - q;
+ int n = len = min(rlen, wlen);
- c = code;
- ss->copy_left = rlen -= len;
- if_debug3('W', "[W]copying 0x%x, %d byte(s) out of %d left\n",
- code, len, rlen + len);
- while (rlen)
- c = table[c].prefix,
- rlen--;
- q1 = q += len;
- n = len;
- while (--n >= 0) {
- *q1-- = (dc = &table[c])->datum;
- c = dc->prefix;
- }
- if (ss->copy_left) { /* more to do */
- pw->ptr = q;
- return 1;
- }
- ss->copy_code = -1;
- len = ss->copy_len;
- /* Retrieve the first byte of the code just copied. */
- if (c == eod) { /* We just copied the entire code, */
- /* so the byte we want is immediately available. */
- b = q1[1];
- } else { /* We have to scan to the beginning of the code. */
- for (; c != eod; c = table[c].prefix)
- b = (byte) c;
- }
- goto add;
+ c = code;
+ ss->copy_left = rlen -= len;
+ if_debug3('W', "[W]copying 0x%x, %d byte(s) out of %d left\n",
+ code, len, rlen + len);
+ while (rlen)
+ c = table[c].prefix,
+ rlen--;
+ q1 = q += len;
+ n = len;
+ while (--n >= 0) {
+ *q1-- = (dc = &table[c])->datum;
+ c = dc->prefix;
+ }
+ if (ss->copy_left) { /* more to do */
+ pw->ptr = q;
+ return 1;
+ }
+ ss->copy_code = -1;
+ len = ss->copy_len;
+ /* Retrieve the first byte of the code just copied. */
+ if (c == eod) { /* We just copied the entire code, */
+ /* so the byte we want is immediately available. */
+ b = q1[1];
+ } else { /* We have to scan to the beginning of the code. */
+ for (; c != eod; c = table[c].prefix)
+ b = (byte) c;
+ }
+ goto add;
}
top:if (code_size > bits_left) {
- if (bytes_left == 0) {
- if (p == rlimit)
- goto out;
- bytes_left = *++p;
- if_debug1('W', "[W]block count %d\n", bytes_left);
- if (bytes_left == 0) {
- status = EOFC;
- goto out;
- }
- goto top;
- }
- if (low_order)
- code = bits >> (8 - bits_left);
- else
- code = (uint) bits << (code_size - bits_left);
- if (bits_left + 8 < code_size) { /* Need 2 more data bytes */
- if (bytes_left == 1) {
- if (rlimit - p < 3)
- goto out;
- bytes_left = p[2];
- if_debug1('W', "[W]block count %d\n",
- bytes_left);
- if (bytes_left == 0) {
- status = EOFC;
- goto out;
- }
- bytes_left++;
- bits = p[1];
- p++;
- } else {
- if (rlimit - p < 2)
- goto out;
- bits = p[1];
- }
- if (low_order)
- code += (uint) bits << bits_left;
- else
- code += (uint) bits << (code_size - 8 - bits_left);
- bits_left += 8;
- bits = p[2];
- p += 2;
- bytes_left -= 2;
- } else {
- if (p == rlimit)
- goto out;
- bits = *++p;
- bytes_left--;
- }
- if (low_order)
- code += (uint) bits << bits_left,
- bits_left += 8 - code_size;
- else
- bits_left += 8 - code_size,
- code += bits >> bits_left;
+ if (bytes_left == 0) {
+ if (p == rlimit)
+ goto out;
+ bytes_left = *++p;
+ if_debug1('W', "[W]block count %d\n", bytes_left);
+ if (bytes_left == 0) {
+ status = EOFC;
+ goto out;
+ }
+ goto top;
+ }
+ if (low_order)
+ code = bits >> (8 - bits_left);
+ else
+ code = (uint) bits << (code_size - bits_left);
+ if (bits_left + 8 < code_size) { /* Need 2 more data bytes */
+ if (bytes_left == 1) {
+ if (rlimit - p < 3)
+ goto out;
+ bytes_left = p[2];
+ if_debug1('W', "[W]block count %d\n",
+ bytes_left);
+ if (bytes_left == 0) {
+ status = EOFC;
+ goto out;
+ }
+ bytes_left++;
+ bits = p[1];
+ p++;
+ } else {
+ if (rlimit - p < 2)
+ goto out;
+ bits = p[1];
+ }
+ if (low_order)
+ code += (uint) bits << bits_left;
+ else
+ code += (uint) bits << (code_size - 8 - bits_left);
+ bits_left += 8;
+ bits = p[2];
+ p += 2;
+ bytes_left -= 2;
+ } else {
+ if (p == rlimit)
+ goto out;
+ bits = *++p;
+ bytes_left--;
+ }
+ if (low_order)
+ code += (uint) bits << bits_left,
+ bits_left += 8 - code_size;
+ else
+ bits_left += 8 - code_size,
+ code += bits >> bits_left;
} else {
- if (low_order)
- code = bits >> (8 - bits_left),
- bits_left -= code_size;
- else
- bits_left -= code_size,
- code = bits >> bits_left;
+ if (low_order)
+ code = bits >> (8 - bits_left),
+ bits_left -= code_size;
+ else
+ bits_left -= code_size,
+ code = bits >> bits_left;
}
code &= code_mask;
if_debug2('W', "[W]reading 0x%x,%d\n", code, code_size);
@@ -239,144 +239,144 @@ s_LZWD_process(stream_state * st, stream_cursor_read * pr,
* equal to next_code.
*/
if (code >= next_code) {
- if (code > next_code) {
+ if (code > next_code) {
#ifdef DEBUG
- lprintf2("[W]code = %d > next_code = %d\n",
- code, next_code);
+ lprintf2("[W]code = %d > next_code = %d\n",
+ code, next_code);
#endif
- status = ERRC;
- goto out;
- }
- /* Fabricate the entry for the code. It will be */
- /* overwritten immediately, of course. */
- for (c = prev_code; c != eod; c = table[c].prefix)
- dc_next->datum = c;
- len = prev_len + 1;
- dc_next->len = min(len, 255);
- dc_next->prefix = prev_code;
- if_debug3('w', "[w]decoding anomalous 0x%x=0x%x+%c\n",
- next_code, prev_code, dc_next->datum);
+ status = ERRC;
+ goto out;
+ }
+ /* Fabricate the entry for the code. It will be */
+ /* overwritten immediately, of course. */
+ for (c = prev_code; c != eod; c = table[c].prefix)
+ dc_next->datum = c;
+ len = prev_len + 1;
+ dc_next->len = min(len, 255);
+ dc_next->prefix = prev_code;
+ if_debug3('w', "[w]decoding anomalous 0x%x=0x%x+%c\n",
+ next_code, prev_code, dc_next->datum);
}
/* See if there is enough room for the code. */
reset:
len = table[code].len;
if (len == 255) { /* Check for special code (reset or end). */
- /* We set their lengths to 255 to avoid doing */
- /* an extra check in the normal case. */
- if (code == code_reset) {
- if_debug1('w', "[w]reset: next_code was %d\n",
- next_code);
- next_code = code_0;
- dc_next = table + code_0;
- code_size = ss->InitialCodeLength + 1;
- set_code_size();
- prev_code = -1;
- goto top;
- } else if (code == eod) {
- status = EOFC;
- goto out;
- }
- /* The code length won't fit in a byte, */
- /* compute it the hard way. */
- for (c = code, len = 0; c != eod; len++)
- c = table[c].prefix;
- if_debug2('w', "[w]long code %d, length=%d\n", code, len);
+ /* We set their lengths to 255 to avoid doing */
+ /* an extra check in the normal case. */
+ if (code == code_reset) {
+ if_debug1('w', "[w]reset: next_code was %d\n",
+ next_code);
+ next_code = code_0;
+ dc_next = table + code_0;
+ code_size = ss->InitialCodeLength + 1;
+ set_code_size();
+ prev_code = -1;
+ goto top;
+ } else if (code == eod) {
+ status = EOFC;
+ goto out;
+ }
+ /* The code length won't fit in a byte, */
+ /* compute it the hard way. */
+ for (c = code, len = 0; c != eod; len++)
+ c = table[c].prefix;
+ if_debug2('w', "[w]long code %d, length=%d\n", code, len);
}
if (wlimit - q < len) {
- ss->copy_code = code;
- ss->copy_left = ss->copy_len = len;
- status = 1;
- goto out;
+ ss->copy_code = code;
+ ss->copy_left = ss->copy_len = len;
+ status = 1;
+ goto out;
}
/* Copy the string to the buffer (back to front). */
/* Optimize for short codes, which are the most frequent. */
dc = &table[code];
switch (len) {
- default:
- {
- byte *q1 = q += len;
+ default:
+ {
+ byte *q1 = q += len;
- c = code;
- do {
- *q1-- = (dc = &table[c])->datum;
- }
- while ((c = dc->prefix) != eod);
- b = q1[1];
- }
- break;
- case 3:
- q[3] = dc->datum;
- dc = &table[dc->prefix];
- case 2:
- q[2] = dc->datum;
- dc = &table[dc->prefix];
- case 1:
- q[1] = b = dc->datum;
- q += len;
+ c = code;
+ do {
+ *q1-- = (dc = &table[c])->datum;
+ }
+ while ((c = dc->prefix) != eod);
+ b = q1[1];
+ }
+ break;
+ case 3:
+ q[3] = dc->datum;
+ dc = &table[dc->prefix];
+ case 2:
+ q[2] = dc->datum;
+ dc = &table[dc->prefix];
+ case 1:
+ q[1] = b = dc->datum;
+ q += len;
}
add: /* Add a new entry to the table */
if (prev_code >= 0) {
- /*
- * Unfortunately, we have to check for next_code ==
- * lzw_decode_max every time: just checking at power
- * of 2 boundaries stops us one code too soon.
- */
- if (next_code == lzw_decode_max) {
- /*
- * A few anomalous files have one data item too many before the
- * reset code. We think this is a bug in the application that
- * produced the files, but Acrobat accepts the files, so we do
- * too.
- */
- if (!ss->BlockData) { /* don't do this for GIF */
- if (bits_left < 8 && p >= rlimit && last) {
- /* We're at EOD. */
- goto out;
- }
- if (bits_left + ((rlimit - p) << 3) < code_size) {
- /*
- * We need more data to decide whether a reset is next.
- * Return an error if we cannot get more.
+ /*
+ * Unfortunately, we have to check for next_code ==
+ * lzw_decode_max every time: just checking at power
+ * of 2 boundaries stops us one code too soon.
+ */
+ if (next_code == lzw_decode_max) {
+ /*
+ * A few anomalous files have one data item too many before the
+ * reset code. We think this is a bug in the application that
+ * produced the files, but Acrobat accepts the files, so we do
+ * too.
+ */
+ if (!ss->BlockData) { /* don't do this for GIF */
+ if (bits_left < 8 && p >= rlimit && last) {
+ /* We're at EOD. */
+ goto out;
+ }
+ if (bits_left + ((rlimit - p) << 3) < code_size) {
+ /*
+ * We need more data to decide whether a reset is next.
+ * Return an error if we cannot get more.
*/
- if (last)
+ if (last)
status = ERRC;
- goto out;
- }
- if (low_order) {
- code = bits >> (8 - bits_left);
- code += (bits = *++p) << bits_left;
- if (bits_left + 8 < code_size)
- code += (bits = *++p) << (bits_left + 8);
- } else {
- code = bits & ((1 << bits_left) - 1);
- code = (code << 8) + (bits = *++p);
- if (bits_left + 8 < code_size)
- code = (code << 8) + (bits = *++p);
- code >>= (bits_left - code_size) & 7;
- }
- bits_left = (bits_left - code_size) & 7;
- if (code == code_reset)
- goto reset;
- }
- status = ERRC;
- goto out;
- }
- dc_next->datum = b; /* added char of string */
- dc_next->len = min(prev_len, 254) + 1;
- dc_next->prefix = prev_code;
- dc_next++;
- if_debug4('W', "[W]adding 0x%x=0x%x+%c(%d)\n",
- next_code, prev_code, b, min(len, 255));
- if (++next_code == switch_code) { /* Crossed a power of 2. */
- /* We have to make a strange special check for */
- /* reaching the end of the code space. */
- if (next_code < lzw_decode_max - 1) {
- code_size++;
- set_code_size();
- if_debug2('w', "[w]crossed power of 2: new code_size=%d, next_code=%d\n",
- code_size, next_code);
- }
- }
+ goto out;
+ }
+ if (low_order) {
+ code = bits >> (8 - bits_left);
+ code += (bits = *++p) << bits_left;
+ if (bits_left + 8 < code_size)
+ code += (bits = *++p) << (bits_left + 8);
+ } else {
+ code = bits & ((1 << bits_left) - 1);
+ code = (code << 8) + (bits = *++p);
+ if (bits_left + 8 < code_size)
+ code = (code << 8) + (bits = *++p);
+ code >>= (bits_left - code_size) & 7;
+ }
+ bits_left = (bits_left - code_size) & 7;
+ if (code == code_reset)
+ goto reset;
+ }
+ status = ERRC;
+ goto out;
+ }
+ dc_next->datum = b; /* added char of string */
+ dc_next->len = min(prev_len, 254) + 1;
+ dc_next->prefix = prev_code;
+ dc_next++;
+ if_debug4('W', "[W]adding 0x%x=0x%x+%c(%d)\n",
+ next_code, prev_code, b, min(len, 255));
+ if (++next_code == switch_code) { /* Crossed a power of 2. */
+ /* We have to make a strange special check for */
+ /* reaching the end of the code space. */
+ if (next_code < lzw_decode_max - 1) {
+ code_size++;
+ set_code_size();
+ if_debug2('w', "[w]crossed power of 2: new code_size=%d, next_code=%d\n",
+ code_size, next_code);
+ }
+ }
}
prev_code = code;
prev_len = len;
@@ -391,7 +391,7 @@ reset:
ss->bytes_left = bytes_left;
ss->next_code = next_code;
if_debug3('w', "[w]decoded %d bytes, prev_code=%d, next_code=%d\n",
- (int)(q - q0), prev_code, next_code);
+ (int)(q - q0), prev_code, next_code);
return status;
}
diff --git a/gs/base/slzwe.c b/gs/base/slzwe.c
index 02afdec75..30320d78a 100644
--- a/gs/base/slzwe.c
+++ b/gs/base/slzwe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,17 +33,17 @@
extern stream_proc_release(s_LZW_release);
typedef struct lzw_encode_s {
- byte datum; /* last byte of this code */
- ushort prefix; /* code for prefix of this code */
+ byte datum; /* last byte of this code */
+ ushort prefix; /* code for prefix of this code */
} lzw_encode;
#define encode_max 4095 /* max # of codes, must be */
- /* > code_0 and <= 4095 */
+ /* > code_0 and <= 4095 */
#define hash_size (encode_max + encode_max / 4)
struct lzw_encode_table_s {
- lzw_encode encode[encode_max];
- ushort hashed[hash_size];
+ lzw_encode encode[encode_max];
+ ushort hashed[hash_size];
};
gs_private_st_simple(st_lzwe_table, lzw_encode_table, "lzw_encode_table");
@@ -59,38 +59,38 @@ gs_private_st_simple(st_lzwe_table, lzw_encode_table, "lzw_encode_table");
static byte *
lzw_put_code(register stream_LZW_state *ss, byte *q, uint code)
{ uint size = ss->code_size;
- byte cb = (ss->bits << ss->bits_left) +
- (code >> (size - ss->bits_left));
- if_debug2('W', "[w]writing 0x%x,%d\n", code, ss->code_size);
- *++q = cb;
- if ( (ss->bits_left += 8 - size) <= 0 )
- { *++q = code >> -ss->bits_left;
- ss->bits_left += 8;
- }
- ss->bits = code;
- return q;
+ byte cb = (ss->bits << ss->bits_left) +
+ (code >> (size - ss->bits_left));
+ if_debug2('W', "[w]writing 0x%x,%d\n", code, ss->code_size);
+ *++q = cb;
+ if ( (ss->bits_left += 8 - size) <= 0 )
+ { *++q = code >> -ss->bits_left;
+ ss->bits_left += 8;
+ }
+ ss->bits = code;
+ return q;
}
/* Internal routine to reset the encoding table */
static void
lzw_reset_encode(stream_LZW_state *ss)
{ register int c;
- lzw_encode_table *table = ss->table.encode;
- ss->next_code = code_0;
- ss->code_size = 9;
- ss->prev_code = code_eod;
- for ( c = 0; c < hash_size; c++ )
- table->hashed[c] = code_eod;
- for ( c = 0; c < 256; c++ )
- { lzw_encode *ec = &table->encode[c];
- register ushort *tc = &table->hashed[encode_hash(code_eod, c)];
- while ( *tc != code_eod )
- if ( ++tc == &table->hashed[hash_size] )
- tc = &table->hashed[0];
- *tc = c;
- ec->datum = c, ec->prefix = code_eod;
- }
- table->encode[code_eod].prefix = code_reset; /* guarantee no match */
+ lzw_encode_table *table = ss->table.encode;
+ ss->next_code = code_0;
+ ss->code_size = 9;
+ ss->prev_code = code_eod;
+ for ( c = 0; c < hash_size; c++ )
+ table->hashed[c] = code_eod;
+ for ( c = 0; c < 256; c++ )
+ { lzw_encode *ec = &table->encode[c];
+ register ushort *tc = &table->hashed[encode_hash(code_eod, c)];
+ while ( *tc != code_eod )
+ if ( ++tc == &table->hashed[hash_size] )
+ tc = &table->hashed[0];
+ *tc = c;
+ ec->datum = c, ec->prefix = code_eod;
+ }
+ table->encode[code_eod].prefix = code_reset; /* guarantee no match */
}
#define ss ((stream_LZW_state *)st)
@@ -100,13 +100,13 @@ static int
s_LZWE_init(stream_state *st)
{ ss->bits_left = 8;
ss->bits = 0; /* for Purify, the value unimportant due to ss->bits_left == 8 */
- ss->table.encode = gs_alloc_struct(st->memory,
- lzw_encode_table, &st_lzwe_table, "LZWEncode init");
- if ( ss->table.encode == 0 )
- return ERRC; /****** WRONG ******/
- ss->first = true;
- lzw_reset_encode(ss);
- return 0;
+ ss->table.encode = gs_alloc_struct(st->memory,
+ lzw_encode_table, &st_lzwe_table, "LZWEncode init");
+ if ( ss->table.encode == 0 )
+ return ERRC; /****** WRONG ******/
+ ss->first = true;
+ lzw_reset_encode(ss);
+ return 0;
}
/* Process a buffer */
@@ -114,85 +114,85 @@ static int
s_LZWE_process(stream_state *st, stream_cursor_read *pr,
stream_cursor_write *pw, bool last)
{ register const byte *p = pr->ptr;
- const byte *rlimit = pr->limit;
- register byte *q = pw->ptr;
- byte *wlimit = pw->limit;
- int code = ss->prev_code;
- lzw_encode_table *table = ss->table.encode;
- ushort *table_end = &table->hashed[hash_size];
- int status = 0;
- int limit_code;
+ const byte *rlimit = pr->limit;
+ register byte *q = pw->ptr;
+ byte *wlimit = pw->limit;
+ int code = ss->prev_code;
+ lzw_encode_table *table = ss->table.encode;
+ ushort *table_end = &table->hashed[hash_size];
+ int status = 0;
+ int limit_code;
#define set_limit_code()\
limit_code = (1 << ss->code_size) - ss->EarlyChange;\
if ( limit_code > encode_max ) limit_code = encode_max
- set_limit_code();
- if ( ss->first )
- { /* Emit the initial reset code. */
- if ( wlimit - q < 2 )
- return 1;
- q = lzw_put_code(ss, q, code_reset);
- ss->first = false;
- }
- while ( p < rlimit )
- { byte c = p[1];
- ushort *tp;
- for ( tp = &table->hashed[encode_hash(code, c)]; ; )
- { lzw_encode *ep = &table->encode[*tp];
- if ( ep->prefix == code && ep->datum == c )
- { code = *tp;
- p++;
- break;
- }
- else if ( *tp != code_eod )
- { if ( ++tp == table_end )
- tp = &table->hashed[0]; /* wrap around */
- }
- else
- { /* end of recognized sequence */
- if ( wlimit - q <= 4 )
- { status = 1;
- goto out;
- }
- q = lzw_put_code(ss, q, code);
- if ( ss->next_code == limit_code )
- { /* Reached power of 2 or limit. */
- /* Determine which. */
- if ( ss->next_code == encode_max )
- { q = lzw_put_code(ss, q, code_reset);
- lzw_reset_encode(ss);
- set_limit_code();
- goto cx;
- }
- ss->code_size++;
- set_limit_code();
- }
- if_debug3('W', "[W]encoding 0x%x=0x%x+%c\n",
- ss->next_code, code, c);
- *tp = ss->next_code++;
- ep = &table->encode[*tp];
- ep->datum = c;
- ep->prefix = code;
+ set_limit_code();
+ if ( ss->first )
+ { /* Emit the initial reset code. */
+ if ( wlimit - q < 2 )
+ return 1;
+ q = lzw_put_code(ss, q, code_reset);
+ ss->first = false;
+ }
+ while ( p < rlimit )
+ { byte c = p[1];
+ ushort *tp;
+ for ( tp = &table->hashed[encode_hash(code, c)]; ; )
+ { lzw_encode *ep = &table->encode[*tp];
+ if ( ep->prefix == code && ep->datum == c )
+ { code = *tp;
+ p++;
+ break;
+ }
+ else if ( *tp != code_eod )
+ { if ( ++tp == table_end )
+ tp = &table->hashed[0]; /* wrap around */
+ }
+ else
+ { /* end of recognized sequence */
+ if ( wlimit - q <= 4 )
+ { status = 1;
+ goto out;
+ }
+ q = lzw_put_code(ss, q, code);
+ if ( ss->next_code == limit_code )
+ { /* Reached power of 2 or limit. */
+ /* Determine which. */
+ if ( ss->next_code == encode_max )
+ { q = lzw_put_code(ss, q, code_reset);
+ lzw_reset_encode(ss);
+ set_limit_code();
+ goto cx;
+ }
+ ss->code_size++;
+ set_limit_code();
+ }
+ if_debug3('W', "[W]encoding 0x%x=0x%x+%c\n",
+ ss->next_code, code, c);
+ *tp = ss->next_code++;
+ ep = &table->encode[*tp];
+ ep->datum = c;
+ ep->prefix = code;
cx: code = code_eod;
- break;
- }
- }
- }
- if ( last && status == 0 )
- { if ( wlimit - q < 4 )
- status = 1;
- else
- { if ( code != code_eod )
- { q = lzw_put_code(ss, q, code); /* put out final code */
- }
- q = lzw_put_code(ss, q, code_eod);
- if ( ss->bits_left < 8 )
- *++q = ss->bits << ss->bits_left; /* final byte */
- }
- }
+ break;
+ }
+ }
+ }
+ if ( last && status == 0 )
+ { if ( wlimit - q < 4 )
+ status = 1;
+ else
+ { if ( code != code_eod )
+ { q = lzw_put_code(ss, q, code); /* put out final code */
+ }
+ q = lzw_put_code(ss, q, code_eod);
+ if ( ss->bits_left < 8 )
+ *++q = ss->bits << ss->bits_left; /* final byte */
+ }
+ }
out: ss->prev_code = code;
- pr->ptr = p;
- pw->ptr = q;
- return status;
+ pr->ptr = p;
+ pw->ptr = q;
+ return status;
}
#undef ss
@@ -200,5 +200,5 @@ out: ss->prev_code = code;
/* Stream template */
const stream_template s_LZWE_template =
{ &st_LZW_state, s_LZWE_init, s_LZWE_process, 1, 4, s_LZW_release,
- s_LZW_set_defaults
+ s_LZW_set_defaults
};
diff --git a/gs/base/slzwx.h b/gs/base/slzwx.h
index a48d49276..7935a05e1 100644
--- a/gs/base/slzwx.h
+++ b/gs/base/slzwx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,20 +34,20 @@ typedef struct stream_LZW_state_s {
/* The following are updated dynamically. */
uint bits; /* buffer for input bits */
int bits_left; /* Decode: # of valid bits left, [0..7] */
- /* (low-order bits if !FirstBitLowOrder, */
- /* high-order bits if FirstBitLowOrder) */
+ /* (low-order bits if !FirstBitLowOrder, */
+ /* high-order bits if FirstBitLowOrder) */
int bytes_left; /* # of bytes left in current block */
- /* (arbitrary large # if not GIF) */
+ /* (arbitrary large # if not GIF) */
union _lzt {
- lzw_decode *decode;
- lzw_encode_table *encode;
+ lzw_decode *decode;
+ lzw_encode_table *encode;
} table;
uint next_code; /* next code to be assigned */
int code_size; /* current # of bits per code */
int prev_code; /* previous code recognized or assigned */
uint prev_len; /* length of prev_code */
int copy_code; /* code whose string is being */
- /* copied, -1 if none */
+ /* copied, -1 if none */
uint copy_len; /* length of copy_code */
int copy_left; /* amount of string left to copy */
bool first; /* true if no output yet */
diff --git a/gs/base/smd5.c b/gs/base/smd5.c
index 2b193d08f..7786fdd27 100644
--- a/gs/base/smd5.c
+++ b/gs/base/smd5.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,22 +35,22 @@ s_MD5E_init(stream_state * st)
/* Process a buffer. */
static int
s_MD5E_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_MD5E_state *const ss = (stream_MD5E_state *) st;
int status = 0;
if (pr->ptr < pr->limit) {
- gs_md5_append(&ss->md5, pr->ptr + 1, pr->limit - pr->ptr);
- pr->ptr = pr->limit;
+ gs_md5_append(&ss->md5, pr->ptr + 1, pr->limit - pr->ptr);
+ pr->ptr = pr->limit;
}
if (last) {
- if (pw->limit - pw->ptr >= 16) {
- gs_md5_finish(&ss->md5, pw->ptr + 1);
- pw->ptr += 16;
- status = EOFC;
- } else
- status = 1;
+ if (pw->limit - pw->ptr >= 16) {
+ gs_md5_finish(&ss->md5, pw->ptr + 1);
+ pw->ptr += 16;
+ status = EOFC;
+ } else
+ status = 1;
}
return status;
}
@@ -67,7 +67,7 @@ s_MD5E_make_stream(gs_memory_t *mem, byte *digest, int digest_size)
stream_state *ss = s_alloc_state(mem, s_MD5E_template.stype, "s_MD5E_make_stream");
if (ss == NULL || s == NULL)
- goto err;
+ goto err;
ss->template = &s_MD5E_template;
if (s_init_filter(s, ss, digest, digest_size, NULL) < 0)
goto err;
@@ -82,7 +82,7 @@ err:
/* Process a buffer. */
static int
s_MD5C_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_MD5E_state *const ss = (stream_MD5E_state *) st;
int nr = pr->limit - pr->ptr;
@@ -94,7 +94,7 @@ s_MD5C_process(stream_state * st, stream_cursor_read * pr,
pr->ptr += n;
pw->ptr += n;
if (pw->limit == pw->ptr)
- return 1;
+ return 1;
return 0;
}
/* Stream template */
@@ -111,10 +111,10 @@ s_MD5C_make_stream(gs_memory_t *mem, stream *strm)
byte *buffer = gs_alloc_bytes(mem, buffer_size, "s_MD5E_make_stream(buffer)");
if (ss == NULL || s == NULL || buffer == NULL)
- goto err;
+ goto err;
ss->template = &s_MD5C_template;
if (s_init_filter(s, ss, buffer, buffer_size, NULL) < 0)
- goto err;
+ goto err;
s->strm = strm;
s->close_strm = true;
return s;
@@ -135,15 +135,13 @@ s_MD5C_get_digest(stream *s, byte *buf, int buf_length)
int l = min(16, buf_length), k;
if (s->procs.process != s_MD5C_process)
- return 0; /* Must not happen. */
+ return 0; /* Must not happen. */
md5 = ss->md5;
gs_md5_finish(&md5, b);
memcpy(buf, b, l);
for (p = b + l; p < b + sizeof(b); p += l) {
- for (k = 0; k < l && p + k < b + sizeof(b); k++)
- buf[k] ^= p[k];
+ for (k = 0; k < l && p + k < b + sizeof(b); k++)
+ buf[k] ^= p[k];
}
return l;
}
-
-
diff --git a/gs/base/smd5.h b/gs/base/smd5.h
index 5d97dccea..a01290e35 100644
--- a/gs/base/smd5.h
+++ b/gs/base/smd5.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ extern const stream_template s_MD5E_template;
stream *s_MD5E_make_stream(gs_memory_t *mem, byte *digest, int digest_size);
/*
- * The MD5Counter filter accepts an arbitrary amount of input data,
+ * The MD5Counter filter accepts an arbitrary amount of input data,
* and copies them to output. It also computes an MD5 digest of the data,
* which may be gathered at any time by s_MD5C_get_digest;
*/
diff --git a/gs/base/smtf.c b/gs/base/smtf.c
index 889dba004..7fbaeb188 100644
--- a/gs/base/smtf.c
+++ b/gs/base/smtf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,14 +29,14 @@ s_MTF_init(stream_state * st)
int i;
for (i = 0; i < 256; i++)
- ss->prev.b[i] = (byte) i;
+ ss->prev.b[i] = (byte) i;
return 0;
}
/* Encode a buffer */
static int
s_MTFE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_MTF_state *const ss = (stream_MTF_state *) st;
register const byte *p = pr->ptr;
@@ -45,17 +45,17 @@ s_MTFE_process(stream_state * st, stream_cursor_read * pr,
uint count = rlimit - p;
uint wcount = pw->limit - q;
int status =
- (count < wcount ? 0 : (rlimit = p + wcount, 1));
+ (count < wcount ? 0 : (rlimit = p + wcount, 1));
while (p < rlimit) {
- byte b = *++p;
- int i;
- byte prev = b, repl;
-
- for (i = 0; (repl = ss->prev.b[i]) != b; i++)
- ss->prev.b[i] = prev, prev = repl;
- ss->prev.b[i] = prev;
- *++q = (byte) i;
+ byte b = *++p;
+ int i;
+ byte prev = b, repl;
+
+ for (i = 0; (repl = ss->prev.b[i]) != b; i++)
+ ss->prev.b[i] = prev, prev = repl;
+ ss->prev.b[i] = prev;
+ *++q = (byte) i;
}
pr->ptr = p;
pw->ptr = q;
@@ -70,7 +70,7 @@ const stream_template s_MTFE_template = {
/* Decode a buffer */
static int
s_MTFD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_MTF_state *const ss = (stream_MTF_state *) st;
register const byte *p = pr->ptr;
@@ -82,80 +82,80 @@ s_MTFD_process(stream_state * st, stream_cursor_read * pr,
/* Cache the first few entries in local variables. */
byte
- v0 = ss->prev.b[0], v1 = ss->prev.b[1],
- v2 = ss->prev.b[2], v3 = ss->prev.b[3];
+ v0 = ss->prev.b[0], v1 = ss->prev.b[1],
+ v2 = ss->prev.b[2], v3 = ss->prev.b[3];
while (p < rlimit) {
- byte first;
-
- /* Zeros far outnumber all other bytes in the BWBS */
- /* code; check for them first. */
- if (*++p == 0) {
- *++q = v0;
- continue;
- }
- switch (*p) {
- default:
- {
- uint b = *p;
- byte *bp = &ss->prev.b[b];
-
- *++q = first = *bp;
+ byte first;
+
+ /* Zeros far outnumber all other bytes in the BWBS */
+ /* code; check for them first. */
+ if (*++p == 0) {
+ *++q = v0;
+ continue;
+ }
+ switch (*p) {
+ default:
+ {
+ uint b = *p;
+ byte *bp = &ss->prev.b[b];
+
+ *++q = first = *bp;
#if arch_sizeof_long == 4
- ss->prev.b[3] = v3;
+ ss->prev.b[3] = v3;
#endif
- /* Move trailing entries individually. */
- for (;; bp--, b--) {
- *bp = bp[-1];
- if (!(b & (sizeof(long) - 1)))
- break;
- }
- /* Move in long-size chunks. */
- for (; (b -= sizeof(long)) != 0;) {
- bp -= sizeof(long);
+ /* Move trailing entries individually. */
+ for (;; bp--, b--) {
+ *bp = bp[-1];
+ if (!(b & (sizeof(long) - 1)))
+ break;
+ }
+ /* Move in long-size chunks. */
+ for (; (b -= sizeof(long)) != 0;) {
+ bp -= sizeof(long);
#if arch_is_big_endian
- *(ulong *) bp =
- (*(ulong *) bp >> 8) |
- ((ulong) bp[-1] << ((sizeof(long) - 1) * 8));
+ *(ulong *) bp =
+ (*(ulong *) bp >> 8) |
+ ((ulong) bp[-1] << ((sizeof(long) - 1) * 8));
#else
- *(ulong *) bp = (*(ulong *) bp << 8) | bp[-1];
+ *(ulong *) bp = (*(ulong *) bp << 8) | bp[-1];
#endif
- }
- }
+ }
+ }
#if arch_sizeof_long > 4 /* better be 8! */
- goto m7;
- case 7:
- *++q = first = ss->prev.b[7];
+ goto m7;
+ case 7:
+ *++q = first = ss->prev.b[7];
m7: ss->prev.b[7] = ss->prev.b[6];
- goto m6;
- case 6:
- *++q = first = ss->prev.b[6];
+ goto m6;
+ case 6:
+ *++q = first = ss->prev.b[6];
m6: ss->prev.b[6] = ss->prev.b[5];
- goto m5;
- case 5:
- *++q = first = ss->prev.b[5];
+ goto m5;
+ case 5:
+ *++q = first = ss->prev.b[5];
m5: ss->prev.b[5] = ss->prev.b[4];
- goto m4;
- case 4:
- *++q = first = ss->prev.b[4];
+ goto m4;
+ case 4:
+ *++q = first = ss->prev.b[4];
m4: ss->prev.b[4] = v3;
#endif
- goto m3;
- case 3:
- *++q = first = v3;
+ goto m3;
+ case 3:
+ *++q = first = v3;
m3: v3 = v2, v2 = v1, v1 = v0, v0 = first;
- break;
- case 2:
- *++q = first = v2;
- v2 = v1, v1 = v0, v0 = first;
- break;
- case 1:
- *++q = first = v1;
- v1 = v0, v0 = first;
- break;
- }
+ break;
+ case 2:
+ *++q = first = v2;
+ v2 = v1, v1 = v0, v0 = first;
+ break;
+ case 1:
+ *++q = first = v1;
+ v1 = v0, v0 = first;
+ break;
+ }
}
ss->prev.b[0] = v0;
ss->prev.b[1] = v1;
diff --git a/gs/base/smtf.h b/gs/base/smtf.h
index cf0f173b4..95fe3719a 100644
--- a/gs/base/smtf.h
+++ b/gs/base/smtf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,8 +23,8 @@ typedef struct stream_MTF_state_s {
stream_state_common;
/* The following change dynamically. */
union _p {
- ulong l[256 / sizeof(long)];
- byte b[256];
+ ulong l[256 / sizeof(long)];
+ byte b[256];
} prev;
} stream_MTF_state;
typedef stream_MTF_state stream_MTFE_state;
diff --git a/gs/base/spdiff.c b/gs/base/spdiff.c
index ce385c613..3e6d378d1 100644
--- a/gs/base/spdiff.c
+++ b/gs/base/spdiff.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -56,17 +56,17 @@ s_PDiffE_init(stream_state * st)
{
stream_PDiff_state *const ss = (stream_PDiff_state *) st;
int bits_per_row =
- ss->Colors * ss->BitsPerComponent * ss->Columns;
+ ss->Colors * ss->BitsPerComponent * ss->Columns;
static const byte cb_values[] = {
- 0, cBits1, cBits2, 0, cBits4, 0, 0, 0, cBits8,
- 0, 0, 0, 0, 0, 0, 0, cBits16
+ 0, cBits1, cBits2, 0, cBits4, 0, 0, 0, cBits8,
+ 0, 0, 0, 0, 0, 0, 0, cBits16
};
ss->row_count = (bits_per_row + 7) >> 3;
ss->end_mask = (1 << (-bits_per_row & 7)) - 1;
ss->case_index =
- cb_values[ss->BitsPerComponent] +
- (ss->Colors > 4 ? 0 : ss->Colors) + cEncode;
+ cb_values[ss->BitsPerComponent] +
+ (ss->Colors > 4 ? 0 : ss->Colors) + cEncode;
return s_PDiff_reinit(st);
}
@@ -84,7 +84,7 @@ s_PDiffD_init(stream_state * st)
/* Process a buffer. Note that this handles both Encode and Decode. */
static int
s_PDiff_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_PDiff_state *const ss = (stream_PDiff_state *) st;
const byte *p = pr->ptr;
@@ -102,17 +102,17 @@ s_PDiff_process(stream_state * st, stream_cursor_read * pr,
row:
if (ss->row_left == 0) {
- ss->row_left = ss->row_count;
- s0 = 0;
- memset(&ss->prev[1], 0, sizeof(uint) * (s_PDiff_max_Colors - 1));
+ ss->row_left = ss->row_count;
+ s0 = 0;
+ memset(&ss->prev[1], 0, sizeof(uint) * (s_PDiff_max_Colors - 1));
}
{
- int rcount = pr->limit - p;
- int wcount = pw->limit - q;
+ int rcount = pr->limit - p;
+ int wcount = pw->limit - q;
- if (ss->row_left < rcount)
- rcount = ss->row_left;
- count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ if (ss->row_left < rcount)
+ rcount = ss->row_left;
+ count = (wcount < rcount ? (status = 1, wcount) : rcount);
}
final = (last && !status ? 1 : nb);
ss->row_left -= count;
@@ -134,7 +134,7 @@ row:
switch (ss->case_index) {
- /* 1 bit per component */
+ /* 1 bit per component */
#define ENCODE1_LOOP(ee)\
LOOP_BY(1, (t = *p, *q = ee, s0 = t)); break
@@ -143,9 +143,9 @@ row:
BEGIN\
ss->prev[0] = s0;\
for (; count >= final; count -= ndone) {\
- ndone = min(count, nb);\
- for (ci = 0; ci < ndone; ++ci)\
- t = *++p, *++q = ee, ss->prev[ci] = t;\
+ ndone = min(count, nb);\
+ for (ci = 0; ci < ndone; ++ci)\
+ t = *++p, *++q = ee, ss->prev[ci] = t;\
}\
s0 = ss->prev[0];\
END
@@ -153,39 +153,39 @@ row:
#define ENCODE_UNALIGNED_LOOP(shift, cshift, de)\
BEGIN\
for (; count >= final; count -= ndone) {\
- ndone = min(count, nb);\
- for (ci = 1; ci <= ndone; ++ci) {\
- ++p;\
- t = (s0 << (cshift)) | (ss->prev[ci] >> (shift));\
- *++q = de;\
- s0 = ss->prev[ci];\
- ss->prev[ci] = *p;\
- }\
+ ndone = min(count, nb);\
+ for (ci = 1; ci <= ndone; ++ci) {\
+ ++p;\
+ t = (s0 << (cshift)) | (ss->prev[ci] >> (shift));\
+ *++q = de;\
+ s0 = ss->prev[ci];\
+ ss->prev[ci] = *p;\
+ }\
}\
END
- case cEncode + cBits1 + 0:
- case cEncode + cBits1 + 2:
- if (colors < 8) { /* 2,5,6,7 */
- int cshift = 8 - colors;
-
- ENCODE1_LOOP(t ^ ((s0 << cshift) | (t >> colors)));
- } else if (colors & 7) {
- int shift = colors & 7;
- int cshift = 8 - shift;
-
- ENCODE_UNALIGNED_LOOP(shift, cshift, *p ^ t);
- } else {
- ENCODE_ALIGNED_LOOP(t ^ ss->prev[ci]);
- }
- break;
-
- case cEncode + cBits1 + 1:
- ENCODE1_LOOP(t ^ ((s0 << 7) | (t >> 1)));
- case cEncode + cBits1 + 3:
- ENCODE1_LOOP(t ^ ((s0 << 5) | (t >> 3)));
- case cEncode + cBits1 + 4:
- ENCODE1_LOOP(t ^ ((s0 << 4) | (t >> 4)));
+ case cEncode + cBits1 + 0:
+ case cEncode + cBits1 + 2:
+ if (colors < 8) { /* 2,5,6,7 */
+ int cshift = 8 - colors;
+
+ ENCODE1_LOOP(t ^ ((s0 << cshift) | (t >> colors)));
+ } else if (colors & 7) {
+ int shift = colors & 7;
+ int cshift = 8 - shift;
+
+ ENCODE_UNALIGNED_LOOP(shift, cshift, *p ^ t);
+ } else {
+ ENCODE_ALIGNED_LOOP(t ^ ss->prev[ci]);
+ }
+ break;
+
+ case cEncode + cBits1 + 1:
+ ENCODE1_LOOP(t ^ ((s0 << 7) | (t >> 1)));
+ case cEncode + cBits1 + 3:
+ ENCODE1_LOOP(t ^ ((s0 << 5) | (t >> 3)));
+ case cEncode + cBits1 + 4:
+ ENCODE1_LOOP(t ^ ((s0 << 4) | (t >> 4)));
#define DECODE1_LOOP(te, de)\
LOOP_BY(1, (t = te, s0 = *q = de)); break
@@ -194,9 +194,9 @@ row:
BEGIN\
ss->prev[0] = s0;\
for (; count >= final; count -= ndone) {\
- ndone = min(count, nb);\
- for (ci = 0; ci < ndone; ++ci)\
- t = *++p, ss->prev[ci] = *++q = de;\
+ ndone = min(count, nb);\
+ for (ci = 0; ci < ndone; ++ci)\
+ t = *++p, ss->prev[ci] = *++q = de;\
}\
s0 = ss->prev[0];\
END
@@ -204,336 +204,336 @@ row:
#define DECODE_UNALIGNED_LOOP(shift, cshift, de)\
BEGIN\
for (; count >= final; count -= ndone) {\
- ndone = min(count, nb);\
- for (ci = 1; ci <= ndone; ++ci) {\
- ++p, ++q;\
- t = (s0 << (cshift)) | (ss->prev[ci] >> (shift));\
- s0 = ss->prev[ci];\
- ss->prev[ci] = *q = de;\
- }\
+ ndone = min(count, nb);\
+ for (ci = 1; ci <= ndone; ++ci) {\
+ ++p, ++q;\
+ t = (s0 << (cshift)) | (ss->prev[ci] >> (shift));\
+ s0 = ss->prev[ci];\
+ ss->prev[ci] = *q = de;\
+ }\
}\
END
- case cDecode + cBits1 + 0:
- if (colors < 8) { /* 5,6,7 */
- int cshift = 8 - colors;
-
- DECODE1_LOOP(*p ^ (s0 << cshift), t ^ (t >> colors));
- } else if (colors & 7) {
- int shift = colors & 7;
- int cshift = 8 - shift;
-
- DECODE_UNALIGNED_LOOP(shift, cshift, *p ^ t);
- } else {
- DECODE_ALIGNED_LOOP(t ^ ss->prev[ci]);
- }
- break;
-
- case cDecode + cBits1 + 1:
- DECODE1_LOOP(*p ^ (s0 << 7),
- (t ^= t >> 1, t ^= t >> 2, t ^ (t >> 4)));
- case cDecode + cBits1 + 2:
- DECODE1_LOOP(*p ^ (s0 << 6),
- (t ^= (t >> 2), t ^ (t >> 4)));
- case cDecode + cBits1 + 3:
- DECODE1_LOOP(*p ^ (s0 << 5),
- t ^ (t >> 3) ^ (t >> 6));
- case cDecode + cBits1 + 4:
- DECODE1_LOOP(*p ^ (s0 << 4),
- t ^ (t >> 4));
-
- /* 2 bits per component */
+ case cDecode + cBits1 + 0:
+ if (colors < 8) { /* 5,6,7 */
+ int cshift = 8 - colors;
+
+ DECODE1_LOOP(*p ^ (s0 << cshift), t ^ (t >> colors));
+ } else if (colors & 7) {
+ int shift = colors & 7;
+ int cshift = 8 - shift;
+
+ DECODE_UNALIGNED_LOOP(shift, cshift, *p ^ t);
+ } else {
+ DECODE_ALIGNED_LOOP(t ^ ss->prev[ci]);
+ }
+ break;
+
+ case cDecode + cBits1 + 1:
+ DECODE1_LOOP(*p ^ (s0 << 7),
+ (t ^= t >> 1, t ^= t >> 2, t ^ (t >> 4)));
+ case cDecode + cBits1 + 2:
+ DECODE1_LOOP(*p ^ (s0 << 6),
+ (t ^= (t >> 2), t ^ (t >> 4)));
+ case cDecode + cBits1 + 3:
+ DECODE1_LOOP(*p ^ (s0 << 5),
+ t ^ (t >> 3) ^ (t >> 6));
+ case cDecode + cBits1 + 4:
+ DECODE1_LOOP(*p ^ (s0 << 4),
+ t ^ (t >> 4));
+
+ /* 2 bits per component */
#define ADD4X2(a, b) ( (((a) & (b) & 0x55) << 1) ^ (a) ^ (b) )
/* The following computation looks very implausible, but it is correct. */
#define SUB4X2(a, b) ( ((~(a) & (b) & 0x55) << 1) ^ (a) ^ (b) )
- case cEncode + cBits2 + 0:
- if (colors & 7) {
- int shift = (colors & 3) << 1;
- int cshift = 8 - shift;
-
- ENCODE_UNALIGNED_LOOP(shift, cshift, SUB4X2(*p, t));
- } else {
- ENCODE_ALIGNED_LOOP(SUB4X2(t, ss->prev[ci]));
- }
- break;
-
- case cEncode + cBits2 + 1:
- ENCODE1_LOOP((s0 = (s0 << 6) | (t >> 2), SUB4X2(t, s0)));
- case cEncode + cBits2 + 2:
- ENCODE1_LOOP((s0 = (s0 << 4) | (t >> 4), SUB4X2(t, s0)));
- case cEncode + cBits2 + 3:
- ENCODE1_LOOP((s0 = (s0 << 2) | (t >> 6), SUB4X2(t, s0)));
- case cEncode + cBits2 + 4:
- ENCODE1_LOOP(SUB4X2(t, s0));
-
- case cDecode + cBits2 + 0:
- if (colors & 7) {
- int shift = (colors & 3) << 1;
- int cshift = 8 - shift;
-
- DECODE_UNALIGNED_LOOP(shift, cshift, ADD4X2(*p, t));
- } else {
- DECODE_ALIGNED_LOOP(ADD4X2(t, ss->prev[ci]));
- }
- break;
-
- case cDecode + cBits2 + 1:
- DECODE1_LOOP(*p + (s0 << 6),
- (t = ADD4X2(t >> 2, t), ADD4X2(t >> 4, t)));
- case cDecode + cBits2 + 2:
- DECODE1_LOOP(*p, (t = ADD4X2(t, s0 << 4), ADD4X2(t >> 4, t)));
- case cDecode + cBits2 + 3:
- DECODE1_LOOP(*p, (t = ADD4X2(t, s0 << 2), ADD4X2(t >> 6, t)));
- case cDecode + cBits2 + 4:
- DECODE1_LOOP(*p, ADD4X2(t, s0));
+ case cEncode + cBits2 + 0:
+ if (colors & 7) {
+ int shift = (colors & 3) << 1;
+ int cshift = 8 - shift;
+
+ ENCODE_UNALIGNED_LOOP(shift, cshift, SUB4X2(*p, t));
+ } else {
+ ENCODE_ALIGNED_LOOP(SUB4X2(t, ss->prev[ci]));
+ }
+ break;
+
+ case cEncode + cBits2 + 1:
+ ENCODE1_LOOP((s0 = (s0 << 6) | (t >> 2), SUB4X2(t, s0)));
+ case cEncode + cBits2 + 2:
+ ENCODE1_LOOP((s0 = (s0 << 4) | (t >> 4), SUB4X2(t, s0)));
+ case cEncode + cBits2 + 3:
+ ENCODE1_LOOP((s0 = (s0 << 2) | (t >> 6), SUB4X2(t, s0)));
+ case cEncode + cBits2 + 4:
+ ENCODE1_LOOP(SUB4X2(t, s0));
+
+ case cDecode + cBits2 + 0:
+ if (colors & 7) {
+ int shift = (colors & 3) << 1;
+ int cshift = 8 - shift;
+
+ DECODE_UNALIGNED_LOOP(shift, cshift, ADD4X2(*p, t));
+ } else {
+ DECODE_ALIGNED_LOOP(ADD4X2(t, ss->prev[ci]));
+ }
+ break;
+
+ case cDecode + cBits2 + 1:
+ DECODE1_LOOP(*p + (s0 << 6),
+ (t = ADD4X2(t >> 2, t), ADD4X2(t >> 4, t)));
+ case cDecode + cBits2 + 2:
+ DECODE1_LOOP(*p, (t = ADD4X2(t, s0 << 4), ADD4X2(t >> 4, t)));
+ case cDecode + cBits2 + 3:
+ DECODE1_LOOP(*p, (t = ADD4X2(t, s0 << 2), ADD4X2(t >> 6, t)));
+ case cDecode + cBits2 + 4:
+ DECODE1_LOOP(*p, ADD4X2(t, s0));
#undef ADD4X2
#undef SUB4X2
- /* 4 bits per component */
+ /* 4 bits per component */
#define ADD2X4(a, b) ( (((a) + (b)) & 0xf) + ((a) & 0xf0) + ((b) & 0xf0) )
#define ADD2X4R4(a) ( (((a) + ((a) >> 4)) & 0xf) + ((a) & 0xf0) )
#define SUB2X4(a, b) ( (((a) - (b)) & 0xf) + ((a) & 0xf0) - ((b) & 0xf0) )
#define SUB2X4R4(a) ( (((a) - ((a) >> 4)) & 0xf) + ((a) & 0xf0) )
- case cEncode + cBits4 + 0:
- case cEncode + cBits4 + 2:
+ case cEncode + cBits4 + 0:
+ case cEncode + cBits4 + 2:
enc4:
- if (colors & 1) {
- ENCODE_UNALIGNED_LOOP(4, 4, SUB2X4(*p, t));
- } else {
- ENCODE_ALIGNED_LOOP(SUB2X4(t, ss->prev[ci]));
- }
- break;
-
- case cEncode + cBits4 + 1:
- ENCODE1_LOOP(((t - (s0 << 4)) & 0xf0) | ((t - (t >> 4)) & 0xf));
-
- case cEncode + cBits4 + 3: {
- uint s1 = ss->prev[1];
-
- LOOP_BY(1,
- (t = *p,
- *q = ((t - (s0 << 4)) & 0xf0) | ((t - (s1 >> 4)) & 0xf),
- s0 = s1, s1 = t));
- ss->prev[1] = s1;
- } break;
-
- case cEncode + cBits4 + 4: {
- uint s1 = ss->prev[1];
-
- LOOP_BY(2,
- (t = p[-1], q[-1] = SUB2X4(t, s0), s0 = t,
- t = *p, *q = SUB2X4(t, s1), s1 = t));
- ss->prev[1] = s1;
- goto enc4; /* handle leftover bytes */
- }
-
- case cDecode + cBits4 + 0:
- case cDecode + cBits4 + 2:
+ if (colors & 1) {
+ ENCODE_UNALIGNED_LOOP(4, 4, SUB2X4(*p, t));
+ } else {
+ ENCODE_ALIGNED_LOOP(SUB2X4(t, ss->prev[ci]));
+ }
+ break;
+
+ case cEncode + cBits4 + 1:
+ ENCODE1_LOOP(((t - (s0 << 4)) & 0xf0) | ((t - (t >> 4)) & 0xf));
+
+ case cEncode + cBits4 + 3: {
+ uint s1 = ss->prev[1];
+
+ LOOP_BY(1,
+ (t = *p,
+ *q = ((t - (s0 << 4)) & 0xf0) | ((t - (s1 >> 4)) & 0xf),
+ s0 = s1, s1 = t));
+ ss->prev[1] = s1;
+ } break;
+
+ case cEncode + cBits4 + 4: {
+ uint s1 = ss->prev[1];
+
+ LOOP_BY(2,
+ (t = p[-1], q[-1] = SUB2X4(t, s0), s0 = t,
+ t = *p, *q = SUB2X4(t, s1), s1 = t));
+ ss->prev[1] = s1;
+ goto enc4; /* handle leftover bytes */
+ }
+
+ case cDecode + cBits4 + 0:
+ case cDecode + cBits4 + 2:
dec4:
- if (colors & 1) {
- DECODE_UNALIGNED_LOOP(4, 4, ADD2X4(*p, t));
- } else {
- DECODE_ALIGNED_LOOP(ADD2X4(t, ss->prev[ci]));
- }
- break;
-
- case cDecode + cBits4 + 1:
- DECODE1_LOOP(*p + (s0 << 4), ADD2X4R4(t));
-
- case cDecode + cBits4 + 3: {
- uint s1 = ss->prev[1];
-
- LOOP_BY(1, (t = (s0 << 4) + (s1 >> 4),
- s0 = s1, s1 = *q = ADD2X4(*p, t)));
- ss->prev[1] = s1;
- } break;
-
- case cDecode + cBits4 + 4: {
- uint s1 = ss->prev[1];
-
- LOOP_BY(2,
- (t = p[-1], s0 = q[-1] = ADD2X4(s0, t),
- t = *p, s1 = *q = ADD2X4(s1, t)));
- ss->prev[1] = s1;
- goto dec4; /* handle leftover bytes */
- }
+ if (colors & 1) {
+ DECODE_UNALIGNED_LOOP(4, 4, ADD2X4(*p, t));
+ } else {
+ DECODE_ALIGNED_LOOP(ADD2X4(t, ss->prev[ci]));
+ }
+ break;
+
+ case cDecode + cBits4 + 1:
+ DECODE1_LOOP(*p + (s0 << 4), ADD2X4R4(t));
+
+ case cDecode + cBits4 + 3: {
+ uint s1 = ss->prev[1];
+
+ LOOP_BY(1, (t = (s0 << 4) + (s1 >> 4),
+ s0 = s1, s1 = *q = ADD2X4(*p, t)));
+ ss->prev[1] = s1;
+ } break;
+
+ case cDecode + cBits4 + 4: {
+ uint s1 = ss->prev[1];
+
+ LOOP_BY(2,
+ (t = p[-1], s0 = q[-1] = ADD2X4(s0, t),
+ t = *p, s1 = *q = ADD2X4(s1, t)));
+ ss->prev[1] = s1;
+ goto dec4; /* handle leftover bytes */
+ }
#undef ADD2X4
#undef ADD2X4R4
#undef SUB2X4
#undef SUB2X4R4
- /* 8 bits per component */
+ /* 8 bits per component */
#define ENCODE8(s, d) (q[d] = p[d] - s, s = p[d])
#define DECODE8(s, d) q[d] = s += p[d]
- case cEncode + cBits8 + 0:
- case cEncode + cBits8 + 2:
- ss->prev[0] = s0;
- for (; count >= colors; count -= colors)
- for (ci = 0; ci < colors; ++ci) {
- *++q = *++p - ss->prev[ci];
- ss->prev[ci] = *p;
- }
- s0 = ss->prev[0];
+ case cEncode + cBits8 + 0:
+ case cEncode + cBits8 + 2:
+ ss->prev[0] = s0;
+ for (; count >= colors; count -= colors)
+ for (ci = 0; ci < colors; ++ci) {
+ *++q = *++p - ss->prev[ci];
+ ss->prev[ci] = *p;
+ }
+ s0 = ss->prev[0];
enc8: /* Handle leftover bytes. */
- if (last && !status)
- for (ci = 0; ci < count; ++ci)
- *++q = *++p - ss->prev[ci],
- ss->prev[ci] = *p;
- break;
-
- case cDecode + cBits8 + 0:
- case cDecode + cBits8 + 2:
- ss->prev[0] = s0;
- for (; count >= colors; count -= colors)
- for (ci = 0; ci < colors; ++ci)
- *++q = ss->prev[ci] += *++p;
- s0 = ss->prev[0];
+ if (last && !status)
+ for (ci = 0; ci < count; ++ci)
+ *++q = *++p - ss->prev[ci],
+ ss->prev[ci] = *p;
+ break;
+
+ case cDecode + cBits8 + 0:
+ case cDecode + cBits8 + 2:
+ ss->prev[0] = s0;
+ for (; count >= colors; count -= colors)
+ for (ci = 0; ci < colors; ++ci)
+ *++q = ss->prev[ci] += *++p;
+ s0 = ss->prev[0];
dec8: /* Handle leftover bytes. */
- if (last && !status)
- for (ci = 0; ci < count; ++ci)
- *++q = ss->prev[ci] += *++p;
- break;
-
- case cEncode + cBits8 + 1:
- LOOP_BY(1, ENCODE8(s0, 0));
- break;
-
- case cDecode + cBits8 + 1:
- LOOP_BY(1, DECODE8(s0, 0));
- break;
-
- case cEncode + cBits8 + 3: {
- uint s1 = ss->prev[1], s2 = ss->prev[2];
-
- LOOP_BY(3, (ENCODE8(s0, -2), ENCODE8(s1, -1),
- ENCODE8(s2, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
- goto enc8;
- }
-
- case cDecode + cBits8 + 3: {
- uint s1 = ss->prev[1], s2 = ss->prev[2];
-
- LOOP_BY(3, (DECODE8(s0, -2), DECODE8(s1, -1),
- DECODE8(s2, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
- goto dec8;
- } break;
-
- case cEncode + cBits8 + 4: {
- uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
-
- LOOP_BY(4, (ENCODE8(s0, -3), ENCODE8(s1, -2),
- ENCODE8(s2, -1), ENCODE8(s3, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
- goto enc8;
- } break;
-
- case cDecode + cBits8 + 4: {
- uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
-
- LOOP_BY(4, (DECODE8(s0, -3), DECODE8(s1, -2),
- DECODE8(s2, -1), DECODE8(s3, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
- goto dec8;
- } break;
+ if (last && !status)
+ for (ci = 0; ci < count; ++ci)
+ *++q = ss->prev[ci] += *++p;
+ break;
+
+ case cEncode + cBits8 + 1:
+ LOOP_BY(1, ENCODE8(s0, 0));
+ break;
+
+ case cDecode + cBits8 + 1:
+ LOOP_BY(1, DECODE8(s0, 0));
+ break;
+
+ case cEncode + cBits8 + 3: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2];
+
+ LOOP_BY(3, (ENCODE8(s0, -2), ENCODE8(s1, -1),
+ ENCODE8(s2, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
+ goto enc8;
+ }
+
+ case cDecode + cBits8 + 3: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2];
+
+ LOOP_BY(3, (DECODE8(s0, -2), DECODE8(s1, -1),
+ DECODE8(s2, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
+ goto dec8;
+ } break;
+
+ case cEncode + cBits8 + 4: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
+
+ LOOP_BY(4, (ENCODE8(s0, -3), ENCODE8(s1, -2),
+ ENCODE8(s2, -1), ENCODE8(s3, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
+ goto enc8;
+ } break;
+
+ case cDecode + cBits8 + 4: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
+
+ LOOP_BY(4, (DECODE8(s0, -3), DECODE8(s1, -2),
+ DECODE8(s2, -1), DECODE8(s3, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
+ goto dec8;
+ } break;
#undef ENCODE8
#undef DECODE8
- /* 16 bits per component */
+ /* 16 bits per component */
#define ENCODE16(s, d) (ti = ((p[d-1] << 8) + p[d]), s = ti - s,\
- q[d-1] = s >> 8, q[d] = s & 0xff, s = ti)
+ q[d-1] = s >> 8, q[d] = s & 0xff, s = ti)
#define DECODE16(s, d) (s = 0xffff & (s + ((p[d-1] << 8) + p[d])), \
- q[d-1] = s >> 8, q[d] = s & 0xff)
-
- case cEncode + cBits16 + 0:
- case cEncode + cBits16 + 2:
- ss->prev[0] = s0;
- for (; count >= colors*2; count -= colors*2)
- for (ci = 0; ci < colors; ++ci) {
- uint k;
+ q[d-1] = s >> 8, q[d] = s & 0xff)
+
+ case cEncode + cBits16 + 0:
+ case cEncode + cBits16 + 2:
+ ss->prev[0] = s0;
+ for (; count >= colors*2; count -= colors*2)
+ for (ci = 0; ci < colors; ++ci) {
+ uint k;
ti = (int)*++p << 8;
- ti += (int)*++p;
+ ti += (int)*++p;
k = ti - ss->prev[ci];
- *++q = k >> 8;
+ *++q = k >> 8;
*++q = k & 0xff;
- ss->prev[ci] = ti;
- }
- s0 = ss->prev[0];
+ ss->prev[ci] = ti;
+ }
+ s0 = ss->prev[0];
enc16: /* Handle leftover bytes. */
- if (last && !status)
- for (ci = 0; ci < count; ++ci)
- *++q = *++p - ss->prev[ci],
- ss->prev[ci] = *p;
- break;
-
- case cDecode + cBits16 + 0:
- case cDecode + cBits16 + 2:
- ss->prev[0] = s0;
- for (; count >= colors*2; count -= colors*2)
- for (ci = 0; ci < colors; ++ci) {
- ti = (int)*++p << 8;
- ss->prev[ci] += ti + *++p;
- *++q = ss->prev[ci] >> 8;
- *++q = ss->prev[ci] & 0xff;
- }
- s0 = ss->prev[0];
+ if (last && !status)
+ for (ci = 0; ci < count; ++ci)
+ *++q = *++p - ss->prev[ci],
+ ss->prev[ci] = *p;
+ break;
+
+ case cDecode + cBits16 + 0:
+ case cDecode + cBits16 + 2:
+ ss->prev[0] = s0;
+ for (; count >= colors*2; count -= colors*2)
+ for (ci = 0; ci < colors; ++ci) {
+ ti = (int)*++p << 8;
+ ss->prev[ci] += ti + *++p;
+ *++q = ss->prev[ci] >> 8;
+ *++q = ss->prev[ci] & 0xff;
+ }
+ s0 = ss->prev[0];
dec16: /* Ignore leftover bytes. */
- break;
+ break;
- case cEncode + cBits16 + 1:
+ case cEncode + cBits16 + 1:
LOOP_BY(2, ENCODE16(s0, 0));
break;
- case cDecode + cBits16 + 1:
+ case cDecode + cBits16 + 1:
LOOP_BY(2, DECODE16(s0, 0));
break;
- case cEncode + cBits16 + 3: {
- uint s1 = ss->prev[1], s2 = ss->prev[2];
+ case cEncode + cBits16 + 3: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2];
- LOOP_BY(6, (ENCODE16(s0, -4), ENCODE16(s1, -2),
- ENCODE16(s2, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
- goto enc16;
- }
+ LOOP_BY(6, (ENCODE16(s0, -4), ENCODE16(s1, -2),
+ ENCODE16(s2, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
+ goto enc16;
+ }
- case cDecode + cBits16 + 3: {
- uint s1 = ss->prev[1], s2 = ss->prev[2];
+ case cDecode + cBits16 + 3: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2];
- LOOP_BY(6, (DECODE16(s0, -4), DECODE16(s1, -2),
- DECODE16(s2, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
- goto dec16;
- } break;
+ LOOP_BY(6, (DECODE16(s0, -4), DECODE16(s1, -2),
+ DECODE16(s2, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2;
+ goto dec16;
+ } break;
- case cEncode + cBits16 + 4: {
- uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
+ case cEncode + cBits16 + 4: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
- LOOP_BY(8, (ENCODE16(s0, -6), ENCODE16(s1, -4),
- ENCODE16(s2, -2), ENCODE16(s3, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
- goto enc16;
- } break;
+ LOOP_BY(8, (ENCODE16(s0, -6), ENCODE16(s1, -4),
+ ENCODE16(s2, -2), ENCODE16(s3, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
+ goto enc16;
+ } break;
- case cDecode + cBits16 + 4: {
- uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
+ case cDecode + cBits16 + 4: {
+ uint s1 = ss->prev[1], s2 = ss->prev[2], s3 = ss->prev[3];
- LOOP_BY(8, (DECODE16(s0, -6), DECODE16(s1, -4),
- DECODE16(s2, -2), DECODE16(s3, 0)));
- ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
- goto dec16;
- } break;
+ LOOP_BY(8, (DECODE16(s0, -6), DECODE16(s1, -4),
+ DECODE16(s2, -2), DECODE16(s3, 0)));
+ ss->prev[0] = s0, ss->prev[1] = s1, ss->prev[2] = s2, ss->prev[3] = s3;
+ goto dec16;
+ } break;
#undef ENCODE16
#undef DECODE16
@@ -544,10 +544,10 @@ row:
#undef DECODE1_LOOP
ss->row_left += count; /* leftover bytes are possible */
if (ss->row_left == 0) {
- if (end_mask != 0)
- *q = (*q & ~end_mask) | (*p & end_mask);
- if (p < pr->limit && q < pw->limit)
- goto row;
+ if (end_mask != 0)
+ *q = (*q & ~end_mask) | (*p & end_mask);
+ if (p < pr->limit && q < pw->limit)
+ goto row;
}
ss->prev[0] = s0;
pr->ptr = p;
diff --git a/gs/base/spdiffx.h b/gs/base/spdiffx.h
index 3e908beea..63bc70fe7 100644
--- a/gs/base/spdiffx.h
+++ b/gs/base/spdiffx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/spngp.c b/gs/base/spngp.c
index 89c05317e..ca9ca4f07 100644
--- a/gs/base/spngp.c
+++ b/gs/base/spngp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,7 +50,7 @@ s_PNGP_reinit(stream_state * st)
stream_PNGP_state *const ss = (stream_PNGP_state *) st;
if (ss->prev_row != 0)
- memset(ss->prev_row + ss->bpp, 0, ss->row_count);
+ memset(ss->prev_row + ss->bpp, 0, ss->row_count);
ss->row_left = 0;
return 0;
}
@@ -66,21 +66,21 @@ s_pngp_init(stream_state * st, bool need_prev)
#if arch_sizeof_long > arch_sizeof_int
if (bits_per_row > max_uint * 7L)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
#endif
ss->row_count = (uint) ((bits_per_row + 7) >> 3);
ss->end_mask = (1 << (-bits_per_row & 7)) - 1;
if (ss->Colors > s_PNG_max_Colors)
- return ERRC; /* Too many colorants */
+ return ERRC; /* Too many colorants */
ss->bpp = (bits_per_pixel + 7) >> 3;
if (need_prev) {
- prev_row = gs_alloc_bytes(st->memory, ss->bpp + ss->row_count,
- "PNGPredictor prev row");
- if (prev_row == 0)
- return ERRC; /****** WRONG ******/
- memset(prev_row, 0, ss->bpp);
+ prev_row = gs_alloc_bytes(st->memory, ss->bpp + ss->row_count,
+ "PNGPredictor prev row");
+ if (prev_row == 0)
+ return ERRC; /****** WRONG ******/
+ memset(prev_row, 0, ss->bpp);
}
ss->prev_row = prev_row;
/* case_index is only preset for encoding */
@@ -110,7 +110,7 @@ s_PNGP_release(stream_state *st)
stream_PNGP_state *const ss = (stream_PNGP_state *) st;
if (ss->prev_row)
- gs_free_object(st->memory, ss->prev_row, "PNGPredictor prev row");
+ gs_free_object(st->memory, ss->prev_row, "PNGPredictor prev row");
}
/*
@@ -128,14 +128,14 @@ paeth_predictor(int a, int b, int c)
/* The definitions of ac and bc are correct, not a typo. */
int ac = b - c, bc = a - c, abcc = ac + bc;
int pa = (ac < 0 ? -ac : ac), pb = (bc < 0 ? -bc : bc),
- pc = (abcc < 0 ? -abcc : abcc);
+ pc = (abcc < 0 ? -abcc : abcc);
return (pa <= pb && pa <= pc ? a : pb <= pc ? b : c);
}
static void
s_pngp_process(stream_state * st, stream_cursor_write * pw,
- const byte * dprev, stream_cursor_read * pr,
- const byte * upprev, const byte * up, uint count)
+ const byte * dprev, stream_cursor_read * pr,
+ const byte * upprev, const byte * up, uint count)
{
stream_PNGP_state *const ss = (stream_PNGP_state *) st;
byte *q = pw->ptr + 1;
@@ -145,42 +145,42 @@ s_pngp_process(stream_state * st, stream_cursor_write * pw,
pw->ptr += count;
ss->row_left -= count;
switch (ss->case_index) {
- case cEncode + cNone:
- case cDecode + cNone:
- memcpy(q, p, count);
- break;
- case cEncode + cSub:
- for (; count; ++q, ++dprev, ++p, --count)
- *q = (byte) (*p - *dprev);
- break;
- case cDecode + cSub:
- for (; count; ++q, ++dprev, ++p, --count)
- *q = (byte) (*p + *dprev);
- break;
- case cEncode + cUp:
- for (; count; ++q, ++up, ++p, --count)
- *q = (byte) (*p - *up);
- break;
- case cDecode + cUp:
- for (; count; ++q, ++up, ++p, --count)
- *q = (byte) (*p + *up);
- break;
- case cEncode + cAverage:
- for (; count; ++q, ++dprev, ++up, ++p, --count)
- *q = (byte) (*p - arith_rshift_1((int)*dprev + (int)*up));
- break;
- case cDecode + cAverage:
- for (; count; ++q, ++dprev, ++up, ++p, --count)
- *q = (byte) (*p + arith_rshift_1((int)*dprev + (int)*up));
- break;
- case cEncode + cPaeth:
- for (; count; ++q, ++dprev, ++up, ++upprev, ++p, --count)
- *q = (byte) (*p - paeth_predictor(*dprev, *up, *upprev));
- break;
- case cDecode + cPaeth:
- for (; count; ++q, ++dprev, ++up, ++upprev, ++p, --count)
- *q = (byte) (*p + paeth_predictor(*dprev, *up, *upprev));
- break;
+ case cEncode + cNone:
+ case cDecode + cNone:
+ memcpy(q, p, count);
+ break;
+ case cEncode + cSub:
+ for (; count; ++q, ++dprev, ++p, --count)
+ *q = (byte) (*p - *dprev);
+ break;
+ case cDecode + cSub:
+ for (; count; ++q, ++dprev, ++p, --count)
+ *q = (byte) (*p + *dprev);
+ break;
+ case cEncode + cUp:
+ for (; count; ++q, ++up, ++p, --count)
+ *q = (byte) (*p - *up);
+ break;
+ case cDecode + cUp:
+ for (; count; ++q, ++up, ++p, --count)
+ *q = (byte) (*p + *up);
+ break;
+ case cEncode + cAverage:
+ for (; count; ++q, ++dprev, ++up, ++p, --count)
+ *q = (byte) (*p - arith_rshift_1((int)*dprev + (int)*up));
+ break;
+ case cDecode + cAverage:
+ for (; count; ++q, ++dprev, ++up, ++p, --count)
+ *q = (byte) (*p + arith_rshift_1((int)*dprev + (int)*up));
+ break;
+ case cEncode + cPaeth:
+ for (; count; ++q, ++dprev, ++up, ++upprev, ++p, --count)
+ *q = (byte) (*p - paeth_predictor(*dprev, *up, *upprev));
+ break;
+ case cDecode + cPaeth:
+ for (; count; ++q, ++dprev, ++up, ++upprev, ++p, --count)
+ *q = (byte) (*p + paeth_predictor(*dprev, *up, *upprev));
+ break;
}
}
@@ -188,18 +188,18 @@ s_pngp_process(stream_state * st, stream_cursor_write * pw,
/* the min of (input data, output data, remaining row length). */
static uint
s_pngp_count(const stream_state * st_const, const stream_cursor_read * pr,
- const stream_cursor_write * pw)
+ const stream_cursor_write * pw)
{
const stream_PNGP_state *const ss_const =
- (const stream_PNGP_state *)st_const;
+ (const stream_PNGP_state *)st_const;
uint rcount = pr->limit - pr->ptr;
uint wcount = pw->limit - pw->ptr;
uint row_left = ss_const->row_left;
if (rcount < row_left)
- row_left = rcount;
+ row_left = rcount;
if (wcount < row_left)
- row_left = wcount;
+ row_left = wcount;
return row_left;
}
@@ -224,80 +224,80 @@ optimum_predictor(const stream_state * st, const stream_cursor_read * pr)
}
static int
s_PNGPE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_PNGP_state *const ss = (stream_PNGP_state *) st;
int bpp = ss->bpp;
int status = 0;
while (pr->ptr < pr->limit) {
- uint count;
-
- if (ss->row_left == 0) {
- /* Beginning of row, write algorithm byte. */
- int predictor;
-
- if (pw->ptr >= pw->limit) {
- status = 1;
- break;
- }
- predictor =
- (ss->Predictor == cOptimum ?
- optimum_predictor(st, pr) :
- ss->Predictor);
- *++(pw->ptr) = (byte) predictor - cNone;
- ss->case_index = predictor + cEncode;
- ss->row_left = ss->row_count;
- memset(ss->prev, 0, bpp);
- continue;
- }
- count = s_pngp_count(st, pr, pw);
- if (count == 0) {
- /* We know we have input, so output must be full. */
- status = 1;
- break;
- } {
- byte *up = ss->prev_row + bpp + ss->row_count - ss->row_left;
- uint n = min(count, bpp);
-
- /* Process bytes whose predecessors are in prev. */
- s_pngp_process(st, pw, ss->prev, pr, up - bpp, up, n);
- if (ss->row_left == 0) {
- if (ss->prev_row) {
- memcpy(up - bpp, ss->prev, bpp);
- memcpy(up, pr->ptr - (n - 1), n);
- }
- continue;
- }
- if (ss->prev_row)
- memcpy(up - bpp, ss->prev, n);
- if (n < bpp) {
- /*
- * We didn't have both enough input data and enough output
- * space to use up all of prev. Shift more data into prev
- * and exit.
- */
- int prev_left = bpp - n;
-
- memmove(ss->prev, ss->prev + n, prev_left);
- memcpy(ss->prev + prev_left, pr->ptr - (n - 1), n);
- if (pw->ptr >= pw->limit && pr->ptr < pr->limit)
- status = 1;
- break;
- }
- /* Process bytes whose predecessors are in the input. */
- /* We know we have at least bpp input and output bytes, */
- /* and that n = bpp. */
- count -= bpp;
- s_pngp_process(st, pw, pr->ptr - (bpp - 1), pr,
- up, up + bpp, count);
- memcpy(ss->prev, pr->ptr - (bpp - 1), bpp);
- if (ss->prev_row) {
- memcpy(up, pr->ptr - (bpp + count - 1), count);
- if (ss->row_left == 0)
- memcpy(up + count, ss->prev, bpp);
- }
- }
+ uint count;
+
+ if (ss->row_left == 0) {
+ /* Beginning of row, write algorithm byte. */
+ int predictor;
+
+ if (pw->ptr >= pw->limit) {
+ status = 1;
+ break;
+ }
+ predictor =
+ (ss->Predictor == cOptimum ?
+ optimum_predictor(st, pr) :
+ ss->Predictor);
+ *++(pw->ptr) = (byte) predictor - cNone;
+ ss->case_index = predictor + cEncode;
+ ss->row_left = ss->row_count;
+ memset(ss->prev, 0, bpp);
+ continue;
+ }
+ count = s_pngp_count(st, pr, pw);
+ if (count == 0) {
+ /* We know we have input, so output must be full. */
+ status = 1;
+ break;
+ } {
+ byte *up = ss->prev_row + bpp + ss->row_count - ss->row_left;
+ uint n = min(count, bpp);
+
+ /* Process bytes whose predecessors are in prev. */
+ s_pngp_process(st, pw, ss->prev, pr, up - bpp, up, n);
+ if (ss->row_left == 0) {
+ if (ss->prev_row) {
+ memcpy(up - bpp, ss->prev, bpp);
+ memcpy(up, pr->ptr - (n - 1), n);
+ }
+ continue;
+ }
+ if (ss->prev_row)
+ memcpy(up - bpp, ss->prev, n);
+ if (n < bpp) {
+ /*
+ * We didn't have both enough input data and enough output
+ * space to use up all of prev. Shift more data into prev
+ * and exit.
+ */
+ int prev_left = bpp - n;
+
+ memmove(ss->prev, ss->prev + n, prev_left);
+ memcpy(ss->prev + prev_left, pr->ptr - (n - 1), n);
+ if (pw->ptr >= pw->limit && pr->ptr < pr->limit)
+ status = 1;
+ break;
+ }
+ /* Process bytes whose predecessors are in the input. */
+ /* We know we have at least bpp input and output bytes, */
+ /* and that n = bpp. */
+ count -= bpp;
+ s_pngp_process(st, pw, pr->ptr - (bpp - 1), pr,
+ up, up + bpp, count);
+ memcpy(ss->prev, pr->ptr - (bpp - 1), bpp);
+ if (ss->prev_row) {
+ memcpy(up, pr->ptr - (bpp + count - 1), count);
+ if (ss->row_left == 0)
+ memcpy(up + count, ss->prev, bpp);
+ }
+ }
}
return status;
}
@@ -318,76 +318,76 @@ s_PNGPE_process(stream_state * st, stream_cursor_read * pr,
*/
static int
s_PNGPD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_PNGP_state *const ss = (stream_PNGP_state *) st;
int bpp = ss->bpp;
int status = 0;
while (pr->ptr < pr->limit) {
- uint count;
-
- if (ss->row_left == 0) {
- /* Beginning of row, read algorithm byte. */
- int predictor = pr->ptr[1];
-
- if (predictor >= cOptimum - cNone) {
- status = ERRC;
- break;
- }
- pr->ptr++;
- ss->case_index = predictor + cNone + cDecode;
- ss->row_left = ss->row_count;
- memset(ss->prev, 0, bpp);
- continue;
- }
- count = s_pngp_count(st, pr, pw);
- if (count == 0) {
- /* We know we have input, so output must be full. */
- status = 1;
- break;
- } {
- byte *up = ss->prev_row + bpp + ss->row_count - ss->row_left;
- uint n = min(count, bpp);
-
- /* Process bytes whose predecessors are in prev. */
- s_pngp_process(st, pw, ss->prev, pr, up - bpp, up, n);
- if (ss->row_left == 0) {
- if (ss->prev_row) {
- memcpy(up - bpp, ss->prev, bpp);
- memcpy(up, pw->ptr - (n - 1), n);
- }
- continue;
- }
- if (ss->prev_row)
- memcpy(up - bpp, ss->prev, n);
- if (n < bpp) {
- /*
- * We didn't have both enough input data and enough output
- * space to use up all of prev. Shift more data into prev
- * and exit.
- */
- int prev_left = bpp - n;
-
- memmove(ss->prev, ss->prev + n, prev_left);
- memcpy(ss->prev + prev_left, pw->ptr - (n - 1), n);
- if (pw->ptr >= pw->limit && pr->ptr < pr->limit)
- status = 1;
- break;
- }
- /* Process bytes whose predecessors are in the output. */
- /* We know we have at least bpp input and output bytes, */
- /* and that n = bpp. */
- count -= bpp;
- s_pngp_process(st, pw, pw->ptr - (bpp - 1), pr,
- up, up + bpp, count);
- memcpy(ss->prev, pw->ptr - (bpp - 1), bpp);
- if (ss->prev_row) {
- memcpy(up, pw->ptr - (bpp + count - 1), count);
- if (ss->row_left == 0)
- memcpy(up + count, ss->prev, bpp);
- }
- }
+ uint count;
+
+ if (ss->row_left == 0) {
+ /* Beginning of row, read algorithm byte. */
+ int predictor = pr->ptr[1];
+
+ if (predictor >= cOptimum - cNone) {
+ status = ERRC;
+ break;
+ }
+ pr->ptr++;
+ ss->case_index = predictor + cNone + cDecode;
+ ss->row_left = ss->row_count;
+ memset(ss->prev, 0, bpp);
+ continue;
+ }
+ count = s_pngp_count(st, pr, pw);
+ if (count == 0) {
+ /* We know we have input, so output must be full. */
+ status = 1;
+ break;
+ } {
+ byte *up = ss->prev_row + bpp + ss->row_count - ss->row_left;
+ uint n = min(count, bpp);
+
+ /* Process bytes whose predecessors are in prev. */
+ s_pngp_process(st, pw, ss->prev, pr, up - bpp, up, n);
+ if (ss->row_left == 0) {
+ if (ss->prev_row) {
+ memcpy(up - bpp, ss->prev, bpp);
+ memcpy(up, pw->ptr - (n - 1), n);
+ }
+ continue;
+ }
+ if (ss->prev_row)
+ memcpy(up - bpp, ss->prev, n);
+ if (n < bpp) {
+ /*
+ * We didn't have both enough input data and enough output
+ * space to use up all of prev. Shift more data into prev
+ * and exit.
+ */
+ int prev_left = bpp - n;
+
+ memmove(ss->prev, ss->prev + n, prev_left);
+ memcpy(ss->prev + prev_left, pw->ptr - (n - 1), n);
+ if (pw->ptr >= pw->limit && pr->ptr < pr->limit)
+ status = 1;
+ break;
+ }
+ /* Process bytes whose predecessors are in the output. */
+ /* We know we have at least bpp input and output bytes, */
+ /* and that n = bpp. */
+ count -= bpp;
+ s_pngp_process(st, pw, pw->ptr - (bpp - 1), pr,
+ up, up + bpp, count);
+ memcpy(ss->prev, pw->ptr - (bpp - 1), bpp);
+ if (ss->prev_row) {
+ memcpy(up, pw->ptr - (bpp + count - 1), count);
+ if (ss->row_left == 0)
+ memcpy(up + count, ss->prev, bpp);
+ }
+ }
}
return status;
}
diff --git a/gs/base/spngpx.h b/gs/base/spngpx.h
index f05b06975..f8bd69c3e 100644
--- a/gs/base/spngpx.h
+++ b/gs/base/spngpx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@
* Define the maximum value for Colors. The PNG specification probably
* defines this as 16, but some PS3 CET files require it to be as large as
* 53. The only cost of larger values is a larger stream state structure.
- * In fact some CET files (09-34.ps) require 250 inks, so bump this to the
+ * In fact some CET files (09-34.ps) require 250 inks, so bump this to the
* current maximum of 256.
*/
#define s_PNG_max_Colors 256
@@ -41,7 +41,7 @@ typedef struct stream_PNGP_state_s {
int bpp; /* bytes per pixel */
byte *prev_row; /* previous row */
int case_index; /* switch index for case dispatch, */
- /* set dynamically when decoding */
+ /* set dynamically when decoding */
/* The following are updated dynamically. */
long row_left; /* # of bytes left in row */
byte prev[2 * s_PNG_max_Colors]; /* previous samples */
@@ -54,7 +54,7 @@ typedef struct stream_PNGP_state_s {
#define s_PNGP_set_defaults_inline(ss)\
((ss)->Colors = 1, (ss)->BitsPerComponent = 8, (ss)->Columns = 1,\
(ss)->Predictor = 15,\
- /* Clear pointers */\
+ /* Clear pointers */\
(ss)->prev_row = 0)
extern const stream_template s_PNGPD_template;
extern const stream_template s_PNGPE_template;
diff --git a/gs/base/spprint.c b/gs/base/spprint.c
index 2f85a54fe..42f746e2b 100644
--- a/gs/base/spprint.c
+++ b/gs/base/spprint.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,12 +50,12 @@ pprintf_scan(stream * s, const char *format)
const char *fp = format;
for (; *fp != 0; ++fp) {
- if (*fp == '%') {
- if (fp[1] != '%')
- break;
- ++fp;
- }
- sputc(s, *fp);
+ if (*fp == '%') {
+ if (fp[1] != '%')
+ break;
+ ++fp;
+ }
+ sputc(s, *fp);
}
return fp;
}
@@ -67,7 +67,7 @@ pputs_short(stream *s, const char *str)
const char *p = str;
for (; *p; ++p)
- sputc(s, *p);
+ sputc(s, *p);
}
/* Print (an) int value(s) using a format. */
@@ -79,7 +79,7 @@ pprintd1(stream * s, const char *format, int v)
#ifdef DEBUG
if (*fp == 0 || fp[1] != 'd') /* shouldn't happen! */
- lprintf1("Bad format in pprintd1: %s\n", format);
+ lprintf1("Bad format in pprintd1: %s\n", format);
#endif
sprintf(str, "%d", v);
pputs_short(s, str);
@@ -111,18 +111,18 @@ pprintg1(stream * s, const char *format, floatp v)
#ifdef DEBUG
if (*fp == 0 || fp[1] != 'g') /* shouldn't happen! */
- lprintf1("Bad format in pprintg: %s\n", format);
+ lprintf1("Bad format in pprintg: %s\n", format);
#endif
sprintf(str, "%f", 1.5);
dot = str[1]; /* locale-dependent */
sprintf(str, "%g", v);
if (strchr(str, 'e')) {
- /* Bad news. Try again using f-format. */
- sprintf(str, (fabs(v) > 1 ? "%1.1f" : "%1.8f"), v);
+ /* Bad news. Try again using f-format. */
+ sprintf(str, (fabs(v) > 1 ? "%1.1f" : "%1.8f"), v);
}
/* Juggling locales isn't thread-safe. Posix me harder. */
if (dot != '.') {
- char *pdot = strchr(str, dot);
+ char *pdot = strchr(str, dot);
if (pdot)
*pdot = '.';
}
@@ -141,13 +141,13 @@ pprintg3(stream * s, const char *format, floatp v1, floatp v2, floatp v3)
}
const char *
pprintg4(stream * s, const char *format, floatp v1, floatp v2, floatp v3,
- floatp v4)
+ floatp v4)
{
return pprintg2(s, pprintg2(s, format, v1, v2), v3, v4);
}
const char *
pprintg6(stream * s, const char *format, floatp v1, floatp v2, floatp v3,
- floatp v4, floatp v5, floatp v6)
+ floatp v4, floatp v5, floatp v6)
{
return pprintg3(s, pprintg3(s, format, v1, v2, v3), v4, v5, v6);
}
@@ -161,7 +161,7 @@ pprintld1(stream * s, const char *format, long v)
#ifdef DEBUG
if (*fp == 0 || fp[1] != 'l' || fp[2] != 'd') /* shouldn't happen! */
- lprintf1("Bad format in pprintld: %s\n", format);
+ lprintf1("Bad format in pprintld: %s\n", format);
#endif
sprintf(str, "%ld", v);
pputs_short(s, str);
@@ -186,7 +186,7 @@ pprints1(stream * s, const char *format, const char *str)
#ifdef DEBUG
if (*fp == 0 || fp[1] != 's') /* shouldn't happen! */
- lprintf1("Bad format in pprints: %s\n", format);
+ lprintf1("Bad format in pprints: %s\n", format);
#endif
pputs_short(s, str);
return pprintf_scan(s, fp + 2);
@@ -198,7 +198,7 @@ pprints2(stream * s, const char *format, const char *str1, const char *str2)
}
const char *
pprints3(stream * s, const char *format, const char *str1, const char *str2,
- const char *str3)
+ const char *str3)
{
return pprints2(s, pprints1(s, format, str1), str2, str3);
}
diff --git a/gs/base/spprint.h b/gs/base/spprint.h
index 99cd661c4..3fe0e117a 100644
--- a/gs/base/spprint.h
+++ b/gs/base/spprint.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,12 +42,12 @@ int stream_puts(stream * s, const char *str);
const char *pprintg1(stream * s, const char *format, floatp v);
const char *pprintg2(stream * s, const char *format, floatp v1, floatp v2);
const char *pprintg3(stream * s, const char *format,
- floatp v1, floatp v2, floatp v3);
+ floatp v1, floatp v2, floatp v3);
const char *pprintg4(stream * s, const char *format,
- floatp v1, floatp v2, floatp v3, floatp v4);
+ floatp v1, floatp v2, floatp v3, floatp v4);
const char *pprintg6(stream * s, const char *format,
- floatp v1, floatp v2, floatp v3, floatp v4,
- floatp v5, floatp v6);
+ floatp v1, floatp v2, floatp v3, floatp v4,
+ floatp v5, floatp v6);
/*
* The rest of these printing functions exist solely because the ANSI C
@@ -58,21 +58,21 @@ const char *pprintg6(stream * s, const char *format,
const char *pprintd1(stream * s, const char *format, int v);
const char *pprintd2(stream * s, const char *format, int v1, int v2);
const char *pprintd3(stream * s, const char *format,
- int v1, int v2, int v3);
+ int v1, int v2, int v3);
const char *pprintd4(stream * s, const char *format,
- int v1, int v2, int v3, int v4);
+ int v1, int v2, int v3, int v4);
/* Print a long value using a format. */
const char *pprintld1(stream * s, const char *format, long v);
const char *pprintld2(stream * s, const char *format, long v1, long v2);
const char *pprintld3(stream * s, const char *format,
- long v1, long v2, long v3);
+ long v1, long v2, long v3);
/* Print (a) string(s) using a format. */
const char *pprints1(stream * s, const char *format, const char *str);
const char *pprints2(stream * s, const char *format,
- const char *str1, const char *str2);
+ const char *str1, const char *str2);
const char *pprints3(stream * s, const char *format,
- const char *str1, const char *str2, const char *str3);
+ const char *str1, const char *str2, const char *str3);
#endif /* spprint_INCLUDED */
diff --git a/gs/base/spsdf.c b/gs/base/spsdf.c
index 5eb69bb61..dc8b90003 100644
--- a/gs/base/spsdf.c
+++ b/gs/base/spsdf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,67 +42,67 @@ s_write_ps_string(stream * s, const byte * str, uint size, int print_ok)
stream_state *st = NULL;
if (print_ok & PRINT_BINARY_OK) {
- /* Only need to escape (, ), \, CR, EOL. */
- stream_putc(s, '(');
- for (i = 0; i < size; ++i) {
- byte ch = str[i];
+ /* Only need to escape (, ), \, CR, EOL. */
+ stream_putc(s, '(');
+ for (i = 0; i < size; ++i) {
+ byte ch = str[i];
- switch (ch) {
- case char_CR:
- stream_puts(s, "\\r");
- continue;
- case char_EOL:
- stream_puts(s, "\\n");
- continue;
- case '(':
- case ')':
- case '\\':
- stream_putc(s, '\\');
- }
- stream_putc(s, ch);
- }
- stream_putc(s, ')');
- return;
+ switch (ch) {
+ case char_CR:
+ stream_puts(s, "\\r");
+ continue;
+ case char_EOL:
+ stream_puts(s, "\\n");
+ continue;
+ case '(':
+ case ')':
+ case '\\':
+ stream_putc(s, '\\');
+ }
+ stream_putc(s, ch);
+ }
+ stream_putc(s, ')');
+ return;
}
for (i = 0; i < size; ++i) {
- byte ch = str[i];
+ byte ch = str[i];
- if (ch == 0 || ch >= 127)
- added += 3;
- else if (strchr("()\\\n\r\t\b\f", ch) != 0)
- ++added;
- else if (ch < 32)
- added += 3;
+ if (ch == 0 || ch >= 127)
+ added += 3;
+ else if (strchr("()\\\n\r\t\b\f", ch) != 0)
+ ++added;
+ else if (ch < 32)
+ added += 3;
}
if (added < size || (print_ok & PRINT_HEX_NOT_OK)) {
- /* More efficient, or mandatory, to represent as PostScript string. */
- template = &s_PSSE_template;
- stream_putc(s, '(');
+ /* More efficient, or mandatory, to represent as PostScript string. */
+ template = &s_PSSE_template;
+ stream_putc(s, '(');
} else {
- /* More efficient, and permitted, to represent as hex string. */
- template = &s_AXE_template;
- st = (stream_state *) & state;
- s_AXE_init_inline(&state);
- stream_putc(s, '<');
+ /* More efficient, and permitted, to represent as hex string. */
+ template = &s_AXE_template;
+ st = (stream_state *) & state;
+ s_AXE_init_inline(&state);
+ stream_putc(s, '<');
}
{
- byte buf[100]; /* size is arbitrary */
- stream_cursor_read r;
- stream_cursor_write w;
- int status;
+ byte buf[100]; /* size is arbitrary */
+ stream_cursor_read r;
+ stream_cursor_write w;
+ int status;
- r.ptr = str - 1;
- r.limit = r.ptr + size;
- w.limit = buf + sizeof(buf) - 1;
- do {
- /* One picky compiler complains if we initialize to buf - 1. */
- w.ptr = buf; w.ptr--;
- status = (*template->process) (st, &r, &w, true);
- stream_write(s, buf, (uint) (w.ptr + 1 - buf));
- }
- while (status == 1);
+ r.ptr = str - 1;
+ r.limit = r.ptr + size;
+ w.limit = buf + sizeof(buf) - 1;
+ do {
+ /* One picky compiler complains if we initialize to buf - 1. */
+ w.ptr = buf; w.ptr--;
+ status = (*template->process) (st, &r, &w, true);
+ stream_write(s, buf, (uint) (w.ptr + 1 - buf));
+ }
+ while (status == 1);
}
}
@@ -113,7 +113,7 @@ s_alloc_position_stream(stream ** ps, gs_memory_t * mem)
stream *s = *ps = s_alloc(mem, "s_alloc_position_stream");
if (s == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
swrite_position_only(s);
return 0;
}
@@ -140,10 +140,10 @@ static const gs_param_list_procs printer_param_list_procs = {
int
s_init_param_printer(printer_param_list_t *prlist,
- const param_printer_params_t * ppp, stream * s)
+ const param_printer_params_t * ppp, stream * s)
{
gs_param_list_init((gs_param_list *)prlist, &printer_param_list_procs,
- NULL);
+ NULL);
prlist->strm = s;
prlist->params = *ppp;
prlist->any = false;
@@ -151,17 +151,17 @@ s_init_param_printer(printer_param_list_t *prlist,
}
int
s_alloc_param_printer(gs_param_list ** pplist,
- const param_printer_params_t * ppp, stream * s,
- gs_memory_t * mem)
+ const param_printer_params_t * ppp, stream * s,
+ gs_memory_t * mem)
{
printer_param_list_t *prlist =
- gs_alloc_struct(mem, printer_param_list_t, &st_printer_param_list,
- "s_alloc_param_printer");
+ gs_alloc_struct(mem, printer_param_list_t, &st_printer_param_list,
+ "s_alloc_param_printer");
int code;
*pplist = (gs_param_list *)prlist;
if (prlist == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
code = s_init_param_printer(prlist, ppp, s);
prlist->memory = mem;
return code;
@@ -171,93 +171,93 @@ void
s_release_param_printer(printer_param_list_t *prlist)
{
if (prlist) {
- if (prlist->any && prlist->params.suffix)
- stream_puts(prlist->strm, prlist->params.suffix);
+ if (prlist->any && prlist->params.suffix)
+ stream_puts(prlist->strm, prlist->params.suffix);
}
}
void
s_free_param_printer(gs_param_list * plist)
{
if (plist) {
- printer_param_list_t *const prlist = (printer_param_list_t *) plist;
+ printer_param_list_t *const prlist = (printer_param_list_t *) plist;
- s_release_param_printer(prlist);
- gs_free_object(prlist->memory, plist, "s_free_param_printer");
+ s_release_param_printer(prlist);
+ gs_free_object(prlist->memory, plist, "s_free_param_printer");
}
}
static int
param_print_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
printer_param_list_t *const prlist = (printer_param_list_t *)plist;
stream *s = prlist->strm;
if (!prlist->any) {
- if (prlist->params.prefix)
- stream_puts(s, prlist->params.prefix);
- prlist->any = true;
+ if (prlist->params.prefix)
+ stream_puts(s, prlist->params.prefix);
+ prlist->any = true;
}
if (prlist->params.item_prefix)
- stream_puts(s, prlist->params.item_prefix);
+ stream_puts(s, prlist->params.item_prefix);
pprints1(s, "/%s", pkey);
switch (pvalue->type) {
- case gs_param_type_null:
- stream_puts(s, " null");
- break;
- case gs_param_type_bool:
- stream_puts(s, (pvalue->value.b ? " true" : " false"));
- break;
- case gs_param_type_int:
- pprintd1(s, " %d", pvalue->value.i);
- break;
- case gs_param_type_long:
- pprintld1(s, " %l", pvalue->value.l);
- break;
- case gs_param_type_float:
- pprintg1(s, " %g", pvalue->value.f);
- break;
- case gs_param_type_string:
- s_write_ps_string(s, pvalue->value.s.data, pvalue->value.s.size,
- prlist->params.print_ok);
- break;
- case gs_param_type_name:
- /****** SHOULD USE #-ESCAPES FOR PDF ******/
- stream_putc(s, '/');
- stream_write(s, pvalue->value.n.data, pvalue->value.n.size);
- break;
- case gs_param_type_int_array:
- {
- uint i;
- char sepr = (pvalue->value.ia.size <= 10 ? ' ' : '\n');
+ case gs_param_type_null:
+ stream_puts(s, " null");
+ break;
+ case gs_param_type_bool:
+ stream_puts(s, (pvalue->value.b ? " true" : " false"));
+ break;
+ case gs_param_type_int:
+ pprintd1(s, " %d", pvalue->value.i);
+ break;
+ case gs_param_type_long:
+ pprintld1(s, " %l", pvalue->value.l);
+ break;
+ case gs_param_type_float:
+ pprintg1(s, " %g", pvalue->value.f);
+ break;
+ case gs_param_type_string:
+ s_write_ps_string(s, pvalue->value.s.data, pvalue->value.s.size,
+ prlist->params.print_ok);
+ break;
+ case gs_param_type_name:
+ /****** SHOULD USE #-ESCAPES FOR PDF ******/
+ stream_putc(s, '/');
+ stream_write(s, pvalue->value.n.data, pvalue->value.n.size);
+ break;
+ case gs_param_type_int_array:
+ {
+ uint i;
+ char sepr = (pvalue->value.ia.size <= 10 ? ' ' : '\n');
- stream_putc(s, '[');
- for (i = 0; i < pvalue->value.ia.size; ++i) {
- pprintd1(s, "%d", pvalue->value.ia.data[i]);
- stream_putc(s, sepr);
- }
- stream_putc(s, ']');
- }
- break;
- case gs_param_type_float_array:
- {
- uint i;
- char sepr = (pvalue->value.fa.size <= 10 ? ' ' : '\n');
+ stream_putc(s, '[');
+ for (i = 0; i < pvalue->value.ia.size; ++i) {
+ pprintd1(s, "%d", pvalue->value.ia.data[i]);
+ stream_putc(s, sepr);
+ }
+ stream_putc(s, ']');
+ }
+ break;
+ case gs_param_type_float_array:
+ {
+ uint i;
+ char sepr = (pvalue->value.fa.size <= 10 ? ' ' : '\n');
- stream_putc(s, '[');
- for (i = 0; i < pvalue->value.fa.size; ++i) {
- pprintg1(s, "%g", pvalue->value.fa.data[i]);
- stream_putc(s, sepr);
- }
- stream_putc(s, ']');
- }
- break;
- /*case gs_param_type_string_array: */
- /*case gs_param_type_name_array: */
- default:
- return_error(gs_error_typecheck);
+ stream_putc(s, '[');
+ for (i = 0; i < pvalue->value.fa.size; ++i) {
+ pprintg1(s, "%g", pvalue->value.fa.data[i]);
+ stream_putc(s, sepr);
+ }
+ stream_putc(s, ']');
+ }
+ break;
+ /*case gs_param_type_string_array: */
+ /*case gs_param_type_name_array: */
+ default:
+ return_error(gs_error_typecheck);
}
if (prlist->params.item_suffix)
- stream_puts(s, prlist->params.item_suffix);
+ stream_puts(s, prlist->params.item_suffix);
return 0;
}
diff --git a/gs/base/spsdf.h b/gs/base/spsdf.h
index a7d7d167a..289e8aa9b 100644
--- a/gs/base/spsdf.h
+++ b/gs/base/spsdf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -69,12 +69,12 @@ typedef struct printer_param_list_s {
#define param_printer_params_default_values 0, 0, 0, "\n", 0
extern const param_printer_params_t param_printer_params_default;
int s_alloc_param_printer(gs_param_list ** pplist,
- const param_printer_params_t * ppp, stream * s,
- gs_memory_t * mem);
+ const param_printer_params_t * ppp, stream * s,
+ gs_memory_t * mem);
void s_free_param_printer(gs_param_list * plist);
/* Initialize or release a list without allocating or freeing it. */
int s_init_param_printer(printer_param_list_t *prlist,
- const param_printer_params_t * ppp, stream * s);
+ const param_printer_params_t * ppp, stream * s);
void s_release_param_printer(printer_param_list_t *prlist);
#endif /* spsdf_INCLUDED */
diff --git a/gs/base/srdline.h b/gs/base/srdline.h
index 678aa2283..01977ed56 100644
--- a/gs/base/srdline.h
+++ b/gs/base/srdline.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,9 +35,9 @@ typedef struct stream_s stream;
#endif
#define sreadline_proc(proc)\
int proc(stream *s_in, stream *s_out, void *readline_data,\
- gs_const_string *prompt, gs_string *buf,\
- gs_memory_t *bufmem, uint *pcount, bool *pin_eol,\
- bool (*is_stdin)(const stream *))
+ gs_const_string *prompt, gs_string *buf,\
+ gs_memory_t *bufmem, uint *pcount, bool *pin_eol,\
+ bool (*is_stdin)(const stream *))
/* Declare the default implementation. */
extern sreadline_proc(sreadline);
diff --git a/gs/base/srld.c b/gs/base/srld.c
index afbd4c809..90df1d8f7 100644
--- a/gs/base/srld.c
+++ b/gs/base/srld.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@ s_RLD_init(stream_state * st)
/* Refill the buffer */
static int
s_RLD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_RLD_state *const ss = (stream_RLD_state *) st;
register const byte *p = pr->ptr;
@@ -55,60 +55,60 @@ s_RLD_process(stream_state * st, stream_cursor_read * pr,
top:
if ((left = ss->copy_left) > 0) {
- /*
- * We suspended because the output buffer was full:;
- * try again now.
- */
- uint avail = wlimit - q;
- int copy_status = 1;
+ /*
+ * We suspended because the output buffer was full:;
+ * try again now.
+ */
+ uint avail = wlimit - q;
+ int copy_status = 1;
- if (left > avail)
- left = avail;
- if (ss->copy_data >= 0)
- memset(q + 1, ss->copy_data, left);
- else {
- avail = rlimit - p;
- if (left >= avail) {
- copy_status = 0;
- left = avail;
- }
- memcpy(q + 1, p + 1, left);
- p += left;
- }
- q += left;
- if ((ss->copy_left -= left) > 0) {
- status = copy_status;
- goto x;
- }
+ if (left > avail)
+ left = avail;
+ if (ss->copy_data >= 0)
+ memset(q + 1, ss->copy_data, left);
+ else {
+ avail = rlimit - p;
+ if (left >= avail) {
+ copy_status = 0;
+ left = avail;
+ }
+ memcpy(q + 1, p + 1, left);
+ p += left;
+ }
+ q += left;
+ if ((ss->copy_left -= left) > 0) {
+ status = copy_status;
+ goto x;
+ }
}
while (p < rlimit) {
- int b = *++p;
+ int b = *++p;
- if (b < 128) {
- if (++b > rlimit - p || b > wlimit - q) {
- ss->copy_left = b;
- ss->copy_data = -1;
- goto top;
- }
- memcpy(q + 1, p + 1, b);
- p += b;
- q += b;
- } else if (b == 128) { /* end of data */
- if (ss->EndOfData) {
- status = EOFC;
- break;
- }
- } else if (p == rlimit) {
- p--;
- break;
- } else if ((b = 257 - b) > wlimit - q) {
- ss->copy_left = b;
- ss->copy_data = *++p;
- goto top;
- } else {
- memset(q + 1, *++p, b);
- q += b;
- }
+ if (b < 128) {
+ if (++b > rlimit - p || b > wlimit - q) {
+ ss->copy_left = b;
+ ss->copy_data = -1;
+ goto top;
+ }
+ memcpy(q + 1, p + 1, b);
+ p += b;
+ q += b;
+ } else if (b == 128) { /* end of data */
+ if (ss->EndOfData) {
+ status = EOFC;
+ break;
+ }
+ } else if (p == rlimit) {
+ p--;
+ break;
+ } else if ((b = 257 - b) > wlimit - q) {
+ ss->copy_left = b;
+ ss->copy_data = *++p;
+ goto top;
+ } else {
+ memset(q + 1, *++p, b);
+ q += b;
+ }
}
x: pr->ptr = p;
pw->ptr = q;
diff --git a/gs/base/srle.c b/gs/base/srle.c
index 194b575ca..e6595ec76 100644
--- a/gs/base/srle.c
+++ b/gs/base/srle.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@ s_RLE_init(stream_state * st)
/* Process a buffer */
static int
s_RLE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_RLE_state *const ss = (stream_RLE_state *) st;
register const byte *p = pr->ptr;
@@ -68,116 +68,116 @@ s_RLE_process(stream_state * st, stream_cursor_read * pr,
/* Check for leftover output. */
copy:
if (ss->copy_left) {
- uint rcount = rlimit - p;
- uint wcount = wlimit - q;
- uint count = ss->copy_left;
+ uint rcount = rlimit - p;
+ uint wcount = wlimit - q;
+ uint count = ss->copy_left;
- if (rcount < count)
- count = rcount;
- if (wcount < count)
- count = wcount;
- if (rleft < count)
- count = rleft;
- memcpy(q + 1, p + 1, count);
- pr->ptr = p += count;
- pw->ptr = q += count;
- if ((ss->record_left = rleft -= count) == 0)
- ss->record_left = rleft = ss->record_size;
- if ((ss->copy_left -= count) != 0)
- return (rcount == 0 ? 0 : 1);
+ if (rcount < count)
+ count = rcount;
+ if (wcount < count)
+ count = wcount;
+ if (rleft < count)
+ count = rleft;
+ memcpy(q + 1, p + 1, count);
+ pr->ptr = p += count;
+ pw->ptr = q += count;
+ if ((ss->record_left = rleft -= count) == 0)
+ ss->record_left = rleft = ss->record_size;
+ if ((ss->copy_left -= count) != 0)
+ return (rcount == 0 ? 0 : 1);
}
while (p < rlimit) {
- const byte *beg = p;
- const byte *p1;
- uint count = rlimit - p;
- bool end = last;
- byte next;
+ const byte *beg = p;
+ const byte *p1;
+ uint count = rlimit - p;
+ bool end = last;
+ byte next;
- if (count > rleft)
- count = rleft, end = true;
- if (count > 128)
- count = 128, end = true;
- p1 = p + count - 1;
- if (count < 3) {
- if (!end || count == 0)
- break; /* can't look ahead far enough */
- if (count == 1) {
- if (wlimit - q < 2) {
- status = 1;
- break;
- }
- *++q = 0;
- } else { /* count == 2 */
- if (p[1] == p[2]) {
- if (wlimit - q < 2) {
- status = 1;
- break;
- }
- *++q = 255;
- } else {
- if (wlimit - q < 3) {
- status = 1;
- break;
- }
- *++q = 1;
- *++q = p[1];
- }
- }
- *++q = p1[1];
- p = p1 + 1;
- } else if ((next = p[1]) == p[2] && next == p[3]) {
- if (wlimit - q < 2) {
- status = 1;
- break;
- }
- /* Recognize leading repeated byte */
- do {
- p++;
- }
- while (p < p1 && p[2] == next);
- if (p == p1 && !end) {
- p = beg; /* need to look ahead further */
- break;
- }
- p++;
- *++q = (byte) (257 - (p - beg));
- *++q = next;
- } else {
- p1--;
- while (p < p1 && (p[2] != p[1] || p[3] != p[1]))
- p++;
- if (p == p1) {
- if (!end) {
- p = beg; /* need to look ahead further */
- break;
- }
- p += 2;
- }
- count = p - beg;
- if (wlimit - q < count + 1) {
- p = beg;
- if (q >= wlimit) {
- status = 1;
- break;
- }
- /* Copy some now and some later. */
- *++q = count - 1;
- ss->copy_left = count;
- goto copy;
- }
- *++q = count - 1;
- memcpy(q + 1, beg + 1, count);
- q += count;
- }
- rleft -= p - beg;
- if (rleft == 0)
- rleft = ss->record_size;
+ if (count > rleft)
+ count = rleft, end = true;
+ if (count > 128)
+ count = 128, end = true;
+ p1 = p + count - 1;
+ if (count < 3) {
+ if (!end || count == 0)
+ break; /* can't look ahead far enough */
+ if (count == 1) {
+ if (wlimit - q < 2) {
+ status = 1;
+ break;
+ }
+ *++q = 0;
+ } else { /* count == 2 */
+ if (p[1] == p[2]) {
+ if (wlimit - q < 2) {
+ status = 1;
+ break;
+ }
+ *++q = 255;
+ } else {
+ if (wlimit - q < 3) {
+ status = 1;
+ break;
+ }
+ *++q = 1;
+ *++q = p[1];
+ }
+ }
+ *++q = p1[1];
+ p = p1 + 1;
+ } else if ((next = p[1]) == p[2] && next == p[3]) {
+ if (wlimit - q < 2) {
+ status = 1;
+ break;
+ }
+ /* Recognize leading repeated byte */
+ do {
+ p++;
+ }
+ while (p < p1 && p[2] == next);
+ if (p == p1 && !end) {
+ p = beg; /* need to look ahead further */
+ break;
+ }
+ p++;
+ *++q = (byte) (257 - (p - beg));
+ *++q = next;
+ } else {
+ p1--;
+ while (p < p1 && (p[2] != p[1] || p[3] != p[1]))
+ p++;
+ if (p == p1) {
+ if (!end) {
+ p = beg; /* need to look ahead further */
+ break;
+ }
+ p += 2;
+ }
+ count = p - beg;
+ if (wlimit - q < count + 1) {
+ p = beg;
+ if (q >= wlimit) {
+ status = 1;
+ break;
+ }
+ /* Copy some now and some later. */
+ *++q = count - 1;
+ ss->copy_left = count;
+ goto copy;
+ }
+ *++q = count - 1;
+ memcpy(q + 1, beg + 1, count);
+ q += count;
+ }
+ rleft -= p - beg;
+ if (rleft == 0)
+ rleft = ss->record_size;
}
if (last && status == 0 && ss->EndOfData) {
- if (q < wlimit)
- *++q = 128;
- else
- status = 1;
+ if (q < wlimit)
+ *++q = 128;
+ else
+ status = 1;
}
pr->ptr = p;
pw->ptr = q;
diff --git a/gs/base/srlx.h b/gs/base/srlx.h
index 8103ed0bc..6fb6c9a14 100644
--- a/gs/base/srlx.h
+++ b/gs/base/srlx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,8 +20,8 @@
/* Common state */
#define stream_RL_state_common\
- stream_state_common;\
- bool EndOfData /* true if 128 = EOD */
+ stream_state_common;\
+ bool EndOfData /* true if 128 = EOD */
/* RunLengthEncode */
typedef struct stream_RLE_state_s {
diff --git a/gs/base/ssha2.c b/gs/base/ssha2.c
index 7a8c70d1e..20613b731 100644
--- a/gs/base/ssha2.c
+++ b/gs/base/ssha2.c
@@ -35,22 +35,22 @@ s_SHA256E_init(stream_state * st)
/* Process a buffer. */
static int
s_SHA256E_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_SHA256E_state *const ss = (stream_SHA256E_state *) st;
int status = 0;
if (pr->ptr < pr->limit) {
- SHA256_Update(&ss->sha256, pr->ptr + 1, pr->limit - pr->ptr);
- pr->ptr = pr->limit;
+ SHA256_Update(&ss->sha256, pr->ptr + 1, pr->limit - pr->ptr);
+ pr->ptr = pr->limit;
}
if (last) {
- if (pw->limit - pw->ptr >= 32) {
- SHA256_Final(pw->ptr + 1, &ss->sha256);
- pw->ptr += 32;
- status = EOFC;
- } else
- status = 1;
+ if (pw->limit - pw->ptr >= 32) {
+ SHA256_Final(pw->ptr + 1, &ss->sha256);
+ pw->ptr += 32;
+ status = EOFC;
+ } else
+ status = 1;
}
return status;
}
@@ -67,10 +67,10 @@ s_SHA256E_make_stream(gs_memory_t *mem, byte *digest, int digest_size)
stream_state *ss = s_alloc_state(mem, s_SHA256E_template.stype, "s_SHA256E_make_stream");
if (ss == NULL || s == NULL)
- goto err;
+ goto err;
ss->template = &s_SHA256E_template;
if (s_init_filter(s, ss, digest, digest_size, NULL) < 0)
- goto err;
+ goto err;
s->strm = s;
return s;
err:
diff --git a/gs/base/sstring.c b/gs/base/sstring.c
index 596ddd592..b1f96a1e5 100644
--- a/gs/base/sstring.c
+++ b/gs/base/sstring.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ s_AXE_init(stream_state * st)
/* Process a buffer */
static int
s_AXE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_AXE_state *const ss = (stream_AXE_state *) st;
const byte *p = pr->ptr;
@@ -49,18 +49,18 @@ s_AXE_process(stream_state * st, stream_cursor_read * pr,
int status = 0;
if (last && ss->EndOfData)
- wcount--; /* leave room for '>' */
+ wcount--; /* leave room for '>' */
wcount -= (wcount + pos * 2) / 65; /* leave room for \n */
wcount >>= 1; /* 2 chars per input byte */
count = (wcount < rcount ? (status = 1, wcount) : rcount);
while (--count >= 0) {
- *++q = hex_digits[*++p >> 4];
- *++q = hex_digits[*p & 0xf];
- if (!(++pos & 31) && (count != 0 || !last))
- *++q = '\n';
+ *++q = hex_digits[*++p >> 4];
+ *++q = hex_digits[*p & 0xf];
+ if (!(++pos & 31) && (count != 0 || !last))
+ *++q = '\n';
}
if (last && status == 0 && ss->EndOfData)
- *++q = '>';
+ *++q = '>';
pr->ptr = p;
pw->ptr = q;
ss->count = pos & 31;
@@ -88,34 +88,34 @@ s_AXD_init(stream_state * st)
/* Process a buffer */
static int
s_AXD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_AXD_state *const ss = (stream_AXD_state *) st;
int code = s_hex_process(pr, pw, &ss->odd, hex_ignore_whitespace);
switch (code) {
- case 0:
- if (ss->odd >= 0 && last) {
- if (pw->ptr == pw->limit)
- return 1;
- *++(pw->ptr) = ss->odd << 4;
- }
- /* falls through */
- case 1:
- /* We still need to read ahead and check for EOD. */
- for (; pr->ptr < pr->limit; pr->ptr++)
- if (scan_char_decoder[pr->ptr[1]] != ctype_space) {
- if (pr->ptr[1] == '>') {
- pr->ptr++;
- goto eod;
- }
- return 1;
- }
- return 0; /* still need to scan ahead */
- default:
- return code;
- case ERRC:
- ;
+ case 0:
+ if (ss->odd >= 0 && last) {
+ if (pw->ptr == pw->limit)
+ return 1;
+ *++(pw->ptr) = ss->odd << 4;
+ }
+ /* falls through */
+ case 1:
+ /* We still need to read ahead and check for EOD. */
+ for (; pr->ptr < pr->limit; pr->ptr++)
+ if (scan_char_decoder[pr->ptr[1]] != ctype_space) {
+ if (pr->ptr[1] == '>') {
+ pr->ptr++;
+ goto eod;
+ }
+ return 1;
+ }
+ return 0; /* still need to scan ahead */
+ default:
+ return code;
+ case ERRC:
+ ;
}
/*
* Check for EOD. ERRC implies at least one more character
@@ -124,13 +124,13 @@ s_AXD_process(stream_state * st, stream_cursor_read * pr,
* the available data, and we might be reading past the end.
*/
if (*pr->ptr != '>') { /* EOD */
- --(pr->ptr);
- return ERRC;
+ --(pr->ptr);
+ return ERRC;
}
eod:if (ss->odd >= 0) {
- if (pw->ptr == pw->limit)
- return 1;
- *++(pw->ptr) = ss->odd << 4;
+ if (pw->ptr == pw->limit)
+ return 1;
+ *++(pw->ptr) = ss->odd << 4;
}
return EOFC;
}
@@ -145,7 +145,7 @@ const stream_template s_AXD_template =
/* Process a buffer */
static int
s_PSSE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
const byte *p = pr->ptr;
const byte *rlimit = pr->limit;
@@ -155,54 +155,54 @@ s_PSSE_process(stream_state * st, stream_cursor_read * pr,
/* This doesn't have to be very efficient. */
while (p < rlimit) {
- int c = *++p;
-
- if (c < 32 || c >= 127) {
- const char *pesc;
- const char *const esc = "\n\r\t\b\f";
-
- if (c < 32 && c != 0 && (pesc = strchr(esc, c)) != 0) {
- if (wlimit - q < 2) {
- --p;
- status = 1;
- break;
- }
- *++q = '\\';
- *++q = "nrtbf"[pesc - esc];
- continue;
- }
- if (wlimit - q < 4) {
- --p;
- status = 1;
- break;
- }
- q[1] = '\\';
- q[2] = (c >> 6) + '0';
- q[3] = ((c >> 3) & 7) + '0';
- q[4] = (c & 7) + '0';
- q += 4;
- continue;
- } else if (c == '(' || c == ')' || c == '\\') {
- if (wlimit - q < 2) {
- --p;
- status = 1;
- break;
- }
- *++q = '\\';
- } else {
- if (q == wlimit) {
- --p;
- status = 1;
- break;
- }
- }
- *++q = c;
+ int c = *++p;
+
+ if (c < 32 || c >= 127) {
+ const char *pesc;
+ const char *const esc = "\n\r\t\b\f";
+
+ if (c < 32 && c != 0 && (pesc = strchr(esc, c)) != 0) {
+ if (wlimit - q < 2) {
+ --p;
+ status = 1;
+ break;
+ }
+ *++q = '\\';
+ *++q = "nrtbf"[pesc - esc];
+ continue;
+ }
+ if (wlimit - q < 4) {
+ --p;
+ status = 1;
+ break;
+ }
+ q[1] = '\\';
+ q[2] = (c >> 6) + '0';
+ q[3] = ((c >> 3) & 7) + '0';
+ q[4] = (c & 7) + '0';
+ q += 4;
+ continue;
+ } else if (c == '(' || c == ')' || c == '\\') {
+ if (wlimit - q < 2) {
+ --p;
+ status = 1;
+ break;
+ }
+ *++q = '\\';
+ } else {
+ if (q == wlimit) {
+ --p;
+ status = 1;
+ break;
+ }
+ }
+ *++q = c;
}
if (last && status == 0) {
- if (q == wlimit)
- status = 1;
- else
- *++q = ')';
+ if (q == wlimit)
+ status = 1;
+ else
+ *++q = ')';
}
pr->ptr = p;
pw->ptr = q;
@@ -231,7 +231,7 @@ s_PSSD_init(stream_state * st)
/* Process a buffer */
static int
s_PSSD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_PSSD_state *const ss = (stream_PSSD_state *) st;
const byte *p = pr->ptr;
@@ -246,104 +246,104 @@ s_PSSD_process(stream_state * st, stream_cursor_read * pr,
#define check_q(n)\
if ( q == wlimit ) { p -= n; status = 1; goto out; }
while (p < rlimit) {
- c = *++p;
- if (c == '\\' && !ss->from_string) {
- check_p(1);
- switch ((c = *++p)) {
- case 'n':
- c = '\n';
- goto put;
- case 'r':
- c = '\r';
- goto put;
- case 't':
- c = '\t';
- goto put;
- case 'b':
- c = '\b';
- goto put;
- case 'f':
- c = '\f';
- goto put;
- default: /* ignore the \ */
- put:check_q(2);
- *++q = c;
- continue;
- case char_CR: /* ignore, check for following \n */
- check_p(2);
- if (p[1] == char_EOL)
- p++;
- continue;
- case char_EOL: /* ignore */
- continue;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int d;
-
- check_p(2);
- d = p[1];
- c -= '0';
- if (d >= '0' && d <= '7') {
- if (p + 1 == rlimit) {
- p -= 2;
- goto out;
- }
- check_q(2);
- c = (c << 3) + d - '0';
- d = p[2];
- if (d >= '0' && d <= '7') {
- c = (c << 3) + d - '0';
- p += 2;
- } else
- p++;
- } else
- check_q(2);
- *++q = c;
- continue;
- }
- }
- } else
- switch (c) {
- case '(':
- check_q(1);
- ss->depth++;
- break;
- case ')':
- if (ss->depth == 0) {
- status = EOFC;
- goto out;
- }
- check_q(1);
- ss->depth--;
- break;
- case char_CR: /* convert to \n */
- check_p(1);
- check_q(1);
- if (p[1] == char_EOL)
- p++;
- *++q = '\n';
- continue;
- case char_EOL:
- c = '\n';
- default:
- check_q(1);
- break;
- }
- *++q = c;
+ c = *++p;
+ if (c == '\\' && !ss->from_string) {
+ check_p(1);
+ switch ((c = *++p)) {
+ case 'n':
+ c = '\n';
+ goto put;
+ case 'r':
+ c = '\r';
+ goto put;
+ case 't':
+ c = '\t';
+ goto put;
+ case 'b':
+ c = '\b';
+ goto put;
+ case 'f':
+ c = '\f';
+ goto put;
+ default: /* ignore the \ */
+ put:check_q(2);
+ *++q = c;
+ continue;
+ case char_CR: /* ignore, check for following \n */
+ check_p(2);
+ if (p[1] == char_EOL)
+ p++;
+ continue;
+ case char_EOL: /* ignore */
+ continue;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int d;
+
+ check_p(2);
+ d = p[1];
+ c -= '0';
+ if (d >= '0' && d <= '7') {
+ if (p + 1 == rlimit) {
+ p -= 2;
+ goto out;
+ }
+ check_q(2);
+ c = (c << 3) + d - '0';
+ d = p[2];
+ if (d >= '0' && d <= '7') {
+ c = (c << 3) + d - '0';
+ p += 2;
+ } else
+ p++;
+ } else
+ check_q(2);
+ *++q = c;
+ continue;
+ }
+ }
+ } else
+ switch (c) {
+ case '(':
+ check_q(1);
+ ss->depth++;
+ break;
+ case ')':
+ if (ss->depth == 0) {
+ status = EOFC;
+ goto out;
+ }
+ check_q(1);
+ ss->depth--;
+ break;
+ case char_CR: /* convert to \n */
+ check_p(1);
+ check_q(1);
+ if (p[1] == char_EOL)
+ p++;
+ *++q = '\n';
+ continue;
+ case char_EOL:
+ c = '\n';
+ default:
+ check_q(1);
+ break;
+ }
+ *++q = c;
}
#undef check_p
#undef check_q
out:pr->ptr = p;
pw->ptr = q;
if (last && status == 0 && p != rlimit)
- status = ERRC;
+ status = ERRC;
return status;
}
@@ -355,7 +355,7 @@ const stream_template s_PSSD_template =
/* ------ Utilities ------ */
/*
- * Convert hex data to binary.
+ * Convert hex data to binary.
* Return 1 if we filled the string,
* 0 if we ran out of input data before filling the string,
* 2 if hex_break_on_whitespace is on and we encounrered
@@ -368,7 +368,7 @@ const stream_template s_PSSD_template =
*/
int
s_hex_process(stream_cursor_read * pr, stream_cursor_write * pw,
- int *odd_digit, hex_syntax syntax)
+ int *odd_digit, hex_syntax syntax)
{
const byte *p = pr->ptr;
const byte *rlimit = pr->limit;
@@ -383,75 +383,75 @@ s_hex_process(stream_cursor_read * pr, stream_cursor_write * pw,
int code = 0;
if (q >= wlimit)
- return 1;
+ return 1;
if (val1 <= 0xf)
- goto d2;
+ goto d2;
d1:if ((rcount = (rlimit - p) >> 1) == 0)
- goto x1;
+ goto x1;
/* Set up a fast end-of-loop check, so we don't have to test */
/* both p and q against their respective limits. */
flimit = (rcount < wlimit - q ? q + rcount : wlimit);
f1:if ((val1 = decoder[p[1]]) <= 0xf &&
- (val2 = decoder[p[2]]) <= 0xf
- ) {
- p += 2;
- *++q = (val1 << 4) + val2;
- if (q < flimit)
- goto f1;
- if (q >= wlimit)
- goto px;
+ (val2 = decoder[p[2]]) <= 0xf
+ ) {
+ p += 2;
+ *++q = (val1 << 4) + val2;
+ if (q < flimit)
+ goto f1;
+ if (q >= wlimit)
+ goto px;
}
x1:if (p >= rlimit)
- goto end1;
+ goto end1;
if ((val1 = decoder[*++p]) > 0xf) {
- if (val1 == ctype_space) {
- switch (syntax) {
- case hex_ignore_garbage:
- case hex_ignore_whitespace:
- goto x1;
- case hex_ignore_leading_whitespace:
- if (q == q0 && *odd_digit < 0)
- goto x1;
- /* pass through */
+ if (val1 == ctype_space) {
+ switch (syntax) {
+ case hex_ignore_garbage:
+ case hex_ignore_whitespace:
+ goto x1;
+ case hex_ignore_leading_whitespace:
+ if (q == q0 && *odd_digit < 0)
+ goto x1;
+ /* pass through */
case hex_break_on_whitespace:
- --p;
- code = 2;
- goto end1;
- }
- } else if (syntax == hex_ignore_garbage)
- goto x1;
- code = ERRC;
- goto end1;
+ --p;
+ code = 2;
+ goto end1;
+ }
+ } else if (syntax == hex_ignore_garbage)
+ goto x1;
+ code = ERRC;
+ goto end1;
}
d2:if (p >= rlimit) {
- *odd_digit = val1;
- goto ended;
+ *odd_digit = val1;
+ goto ended;
}
if ((val2 = decoder[*++p]) > 0xf) {
- if (val2 == ctype_space)
- switch (syntax) {
+ if (val2 == ctype_space)
+ switch (syntax) {
case hex_ignore_garbage:
- case hex_ignore_whitespace:
- goto d2;
- case hex_ignore_leading_whitespace:
- if (q == q0)
- goto d2;
- /* pass through */
+ case hex_ignore_whitespace:
+ goto d2;
+ case hex_ignore_leading_whitespace:
+ if (q == q0)
+ goto d2;
+ /* pass through */
case hex_break_on_whitespace:
- --p;
- *odd_digit = val1;
- code = 2;
- goto ended;
- }
- if (syntax == hex_ignore_garbage)
- goto d2;
- *odd_digit = val1;
- code = ERRC;
- goto ended;
+ --p;
+ *odd_digit = val1;
+ code = 2;
+ goto ended;
+ }
+ if (syntax == hex_ignore_garbage)
+ goto d2;
+ *odd_digit = val1;
+ code = ERRC;
+ goto ended;
}
*++q = (val1 << 4) + val2;
if (q < wlimit)
- goto d1;
+ goto d1;
px:code = 1;
end1:*odd_digit = -1;
ended:pr->ptr = p;
diff --git a/gs/base/sstring.h b/gs/base/sstring.h
index 9f2b89ac6..15a1cdc3c 100644
--- a/gs/base/sstring.h
+++ b/gs/base/sstring.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/stat_.h b/gs/base/stat_.h
index d0d4d20cb..3de0081c6 100644
--- a/gs/base/stat_.h
+++ b/gs/base/stat_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/std.h b/gs/base/std.h
index 68c6c3bdf..7ab75f59c 100644
--- a/gs/base/std.h
+++ b/gs/base/std.h
@@ -154,7 +154,6 @@ typedef struct gs_memory_s gs_memory_t;
#define init_proc(proc)\
int proc(gs_memory_t *)
-
/* dpf and epf may be redefined */
#define dpf errprintf_nomem
#define epf errprintf_nomem
diff --git a/gs/base/stdint_.h b/gs/base/stdint_.h
index 09bf33ee3..3fed85820 100644
--- a/gs/base/stdint_.h
+++ b/gs/base/stdint_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -68,7 +68,7 @@
typedef unsigned long long uint64_t;
# define STDINT_TYPES_DEFINED
# endif
- /* other archs may want to add defines here,
+ /* other archs may want to add defines here,
or use the fallbacks in std.h */
#endif
diff --git a/gs/base/stdio_.h b/gs/base/stdio_.h
index 3d335a8e3..2454f7c4c 100644
--- a/gs/base/stdio_.h
+++ b/gs/base/stdio_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/stdpn.h b/gs/base/stdpn.h
index 0a1019d69..2b873c728 100644
--- a/gs/base/stdpn.h
+++ b/gs/base/stdpn.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/stdpre.h b/gs/base/stdpre.h
index 2ac7de66b..189dbd179 100644
--- a/gs/base/stdpre.h
+++ b/gs/base/stdpre.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -181,9 +181,9 @@ extern_inline int xyz(<<parameters>>)
/*
* Some versions of gcc have a bug such that after
- byte *p;
- ...
- x = *(long *)p;
+ byte *p;
+ ...
+ x = *(long *)p;
* the compiler then thinks that p always points to long-aligned data.
* Detect this here so it can be handled appropriately in the few places
* that (we think) matter.
diff --git a/gs/base/stream.c b/gs/base/stream.c
index 13e3b9cc0..d75bb1ea2 100644
--- a/gs/base/stream.c
+++ b/gs/base/stream.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ static void stream_compact(stream *, bool);
public_st_stream();
public_st_stream_state(); /* default */
/* GC procedures */
-static
+static
ENUM_PTRS_WITH(stream_enum_ptrs, stream *st) return 0;
case 0:
if (st->foreign)
@@ -48,18 +48,18 @@ static RELOC_PTRS_WITH(stream_reloc_ptrs, stream *st)
byte *cbuf_old = st->cbuf;
if (cbuf_old != 0 && !st->foreign) {
- long reloc;
-
- if (st->cbuf_string.data != 0) {
- RELOC_STRING_VAR(st->cbuf_string);
- st->cbuf = st->cbuf_string.data;
- } else
- RELOC_VAR(st->cbuf);
- reloc = cbuf_old - st->cbuf;
- /* Relocate the other buffer pointers. */
- st->srptr -= reloc;
- st->srlimit -= reloc; /* same as swptr */
- st->swlimit -= reloc;
+ long reloc;
+
+ if (st->cbuf_string.data != 0) {
+ RELOC_STRING_VAR(st->cbuf_string);
+ st->cbuf = st->cbuf_string.data;
+ } else
+ RELOC_VAR(st->cbuf);
+ reloc = cbuf_old - st->cbuf;
+ /* Relocate the other buffer pointers. */
+ st->srptr -= reloc;
+ st->srlimit -= reloc; /* same as swptr */
+ st->swlimit -= reloc;
}
RELOC_VAR(st->strm);
RELOC_VAR(st->prev);
@@ -77,15 +77,15 @@ stream_finalize(void *vptr)
stream *const st = vptr;
if_debug2('u', "[u]%s 0x%lx\n",
- (!s_is_valid(st) ? "already closed:" :
- st->is_temp ? "is_temp set:" :
- st->file == 0 ? "not file:" :
- "closing file:"), (ulong) st);
+ (!s_is_valid(st) ? "already closed:" :
+ st->is_temp ? "is_temp set:" :
+ st->file == 0 ? "not file:" :
+ "closing file:"), (ulong) st);
if (s_is_valid(st) && !st->is_temp && st->file != 0) {
- /* Prevent any attempt to free the buffer. */
- st->cbuf = 0;
- st->cbuf_string.data = 0;
- sclose(st); /* ignore errors */
+ /* Prevent any attempt to free the buffer. */
+ st->cbuf = 0;
+ st->cbuf_string.data = 0;
+ sclose(st); /* ignore errors */
}
}
@@ -106,7 +106,7 @@ s_init(stream *s, gs_memory_t * mem)
s->error_string[0] = 0;
s->prev = s->next = 0; /* clean for GC */
s->file_name.data = 0; /* ibid. */
- s->file_name.size = 0;
+ s->file_name.size = 0;
s->close_strm = false; /* default */
s->close_at_eod = true; /* default */
}
@@ -116,9 +116,9 @@ s_alloc(gs_memory_t * mem, client_name_t cname)
stream *s = gs_alloc_struct(mem, stream, &st_stream, cname);
if_debug2('s', "[s]alloc(%s) = 0x%lx\n",
- client_name_string(cname), (ulong) s);
+ client_name_string(cname), (ulong) s);
if (s == 0)
- return 0;
+ return 0;
s_init(s, mem);
return s;
}
@@ -126,7 +126,7 @@ s_alloc(gs_memory_t * mem, client_name_t cname)
/* Allocate a stream state and initialize it minimally. */
void
s_init_state(stream_state *st, const stream_template *template,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
st->template = template;
st->memory = mem;
@@ -136,23 +136,23 @@ s_init_state(stream_state *st, const stream_template *template,
}
stream_state *
s_alloc_state(gs_memory_t * mem, gs_memory_type_ptr_t stype,
- client_name_t cname)
+ client_name_t cname)
{
stream_state *st = gs_alloc_struct(mem, stream_state, stype, cname);
if_debug3('s', "[s]alloc_state %s(%s) = 0x%lx\n",
- client_name_string(cname),
- client_name_string(stype->sname),
- (ulong) st);
+ client_name_string(cname),
+ client_name_string(stype->sname),
+ (ulong) st);
if (st)
- s_init_state(st, NULL, mem);
+ s_init_state(st, NULL, mem);
return st;
}
/* Standard stream initialization */
void
s_std_init(register stream * s, byte * ptr, uint len, const stream_procs * pp,
- int modes)
+ int modes)
{
s->template = &s_no_template;
s->cbuf = ptr;
@@ -172,25 +172,24 @@ s_std_init(register stream * s, byte * ptr, uint len, const stream_procs * pp,
s->file_name.data = 0; /* in case stream is on stack */
s->file_name.size = 0;
if_debug4('s', "[s]init 0x%lx, buf=0x%lx, len=%u, modes=%d\n",
- (ulong) s, (ulong) ptr, len, modes);
+ (ulong) s, (ulong) ptr, len, modes);
}
-
/* Set the file name of a stream, copying the name. */
/* Return <0 if the copy could not be allocated. */
int
ssetfilename(stream *s, const byte *data, uint size)
{
byte *str =
- (s->file_name.data == 0 ?
- gs_alloc_string(s->memory, size + 1, "ssetfilename") :
- gs_resize_string(s->memory,
- (byte *)s->file_name.data, /* break const */
- s->file_name.size,
- size + 1, "ssetfilename"));
+ (s->file_name.data == 0 ?
+ gs_alloc_string(s->memory, size + 1, "ssetfilename") :
+ gs_resize_string(s->memory,
+ (byte *)s->file_name.data, /* break const */
+ s->file_name.size,
+ size + 1, "ssetfilename"));
if (str == 0)
- return -1;
+ return -1;
memcpy(str, data, size);
str[size] = 0;
s->file_name.data = str;
@@ -205,8 +204,8 @@ sfilename(stream *s, gs_const_string *pfname)
{
pfname->data = s->file_name.data;
if (pfname->data == 0) {
- pfname->size = 0;
- return -1;
+ pfname->size = 0;
+ return -1;
}
pfname->size = s->file_name.size - 1; /* omit terminator */
return 0;
@@ -238,10 +237,10 @@ int
s_std_read_flush(stream * s)
{
while (1) {
- s->srptr = s->srlimit = s->cbuf - 1;
- if (s->end_status)
- break;
- s_process_read_buf(s);
+ s->srptr = s->srlimit = s->cbuf - 1;
+ if (s->end_status)
+ break;
+ s_process_read_buf(s);
}
return (s->end_status == EOFC ? 0 : s->end_status);
}
@@ -303,10 +302,10 @@ s_disable(register stream * s)
s->template = &s_no_template;
/* Free the file name. */
if (s->file_name.data) {
- gs_free_const_string(s->memory, s->file_name.data, s->file_name.size,
- "s_disable(file_name)");
- s->file_name.data = 0;
- s->file_name.size = 0;
+ gs_free_const_string(s->memory, s->file_name.data, s->file_name.size,
+ "s_disable(file_name)");
+ s->file_name.data = 0;
+ s->file_name.size = 0;
}
/****** SHOULD DO MORE THAN THIS ******/
if_debug1('s', "[s]disable 0x%lx\n", (ulong) s);
@@ -319,7 +318,7 @@ s_filter_write_flush(register stream * s)
int status = s_process_write_buf(s, false);
if (status != 0)
- return status;
+ return status;
return sflush(s->strm);
}
@@ -333,19 +332,19 @@ s_filter_close(register stream * s)
stream *stemp = s->strm;
if (s_is_writing(s)) {
- int status = s_process_write_buf(s, true);
+ int status = s_process_write_buf(s, true);
- if (status != 0 && status != EOFC)
- return status;
+ if (status != 0 && status != EOFC)
+ return status;
status = sflush(stemp);
- if (status != 0 && status != EOFC)
- return status;
+ if (status != 0 && status != EOFC)
+ return status;
}
status = s_std_close(s);
if (status != 0 && status != EOFC)
- return status;
+ return status;
if (close && stemp != 0)
- return sclose(stemp);
+ return sclose(stemp);
return status;
}
@@ -395,7 +394,7 @@ int
spseek(stream * s, long pos)
{
if_debug3('s', "[s]seek 0x%lx to %ld, position was %ld\n",
- (ulong) s, pos, stell(s));
+ (ulong) s, pos, stell(s));
return (*(s)->procs.seek) (s, pos);
}
@@ -405,7 +404,7 @@ int
sswitch(register stream * s, bool writing)
{
if (s->procs.switch_mode == 0)
- return ERRC;
+ return ERRC;
return (*s->procs.switch_mode) (s, writing);
}
@@ -418,15 +417,15 @@ sclose(register stream * s)
int status = (*s->procs.close) (s);
if (status < 0)
- return status;
+ return status;
st = s->state;
if (st != 0) {
- stream_proc_release((*release)) = st->template->release;
- if (release != 0)
- (*release) (st);
- if (st != (stream_state *) s && st->memory != 0)
- gs_free_object(st->memory, st, "s_std_close");
- s->state = (stream_state *) s;
+ stream_proc_release((*release)) = st->template->release;
+ if (release != 0)
+ (*release) (st);
+ if (st != (stream_state *) s && st->memory != 0)
+ gs_free_object(st->memory, st, "s_std_close");
+ s->state = (stream_state *) s;
}
s_disable(s);
return status;
@@ -445,22 +444,22 @@ spgetcc(register stream * s, bool close_at_eod)
int min_left = sbuf_min_left(s);
while (status = s->end_status,
- left = s->srlimit - s->srptr,
- left <= min_left && status >= 0
- )
- s_process_read_buf(s);
+ left = s->srlimit - s->srptr,
+ left <= min_left && status >= 0
+ )
+ s_process_read_buf(s);
if (left <= min_left &&
- (left == 0 || (status != EOFC && status != ERRC))
- ) {
- /* Compact the stream so stell will return the right result. */
- stream_compact(s, true);
- if (status == EOFC && close_at_eod && s->close_at_eod) {
- status = sclose(s);
- if (status == 0)
- status = EOFC;
- s->end_status = status;
- }
- return status;
+ (left == 0 || (status != EOFC && status != ERRC))
+ ) {
+ /* Compact the stream so stell will return the right result. */
+ stream_compact(s, true);
+ if (status == EOFC && close_at_eod && s->close_at_eod) {
+ status = sclose(s);
+ if (status == 0)
+ status = EOFC;
+ s->end_status = status;
+ }
+ return status;
}
return *++(s->srptr);
}
@@ -471,13 +470,13 @@ int
spputc(register stream * s, byte b)
{
for (;;) {
- if (s->end_status)
- return s->end_status;
- if (!sendwp(s)) {
- *++(s->swptr) = b;
- return b;
- }
- s_process_write_buf(s, false);
+ if (s->end_status)
+ return s->end_status;
+ if (!sendwp(s)) {
+ *++(s->swptr) = b;
+ return b;
+ }
+ s_process_write_buf(s, false);
}
}
@@ -488,7 +487,7 @@ int
sungetc(register stream * s, byte c)
{
if (!s_is_reading(s) || s->srptr < s->cbuf || *(s->srptr) != c)
- return ERRC;
+ return ERRC;
s->srptr--;
return 0;
}
@@ -505,47 +504,47 @@ sgets(stream * s, byte * buf, uint nmax, uint * pn)
cw.ptr = buf - 1;
cw.limit = cw.ptr + nmax;
while (cw.ptr < cw.limit) {
- int left;
-
- if ((left = s->srlimit - s->srptr) > min_left) {
- s->srlimit -= min_left;
- stream_move(&s->cursor.r, &cw);
- s->srlimit += min_left;
- } else {
- uint wanted = cw.limit - cw.ptr;
- int c;
- stream_state *st;
-
- if (wanted >= s->bsize >> 2 &&
- (st = s->state) != 0 &&
- wanted >= st->template->min_out_size &&
- s->end_status == 0 &&
- left == 0
- ) {
- byte *wptr = cw.ptr;
-
- cw.limit -= min_left;
- status = sreadbuf(s, &cw);
- cw.limit += min_left;
- /* Compact the stream so stell will return the right result. */
- stream_compact(s, true);
- /*
- * We know the stream buffer is empty, so it's safe to
- * update position. However, we need to reset the read
- * cursor to indicate that there is no data in the buffer.
- */
- s->srptr = s->srlimit = s->cbuf - 1;
- s->position += cw.ptr - wptr;
- if (status <= 0 || cw.ptr == cw.limit)
- break;
- }
- c = spgetc(s);
- if (c < 0) {
- status = c;
- break;
- }
- *++(cw.ptr) = c;
- }
+ int left;
+
+ if ((left = s->srlimit - s->srptr) > min_left) {
+ s->srlimit -= min_left;
+ stream_move(&s->cursor.r, &cw);
+ s->srlimit += min_left;
+ } else {
+ uint wanted = cw.limit - cw.ptr;
+ int c;
+ stream_state *st;
+
+ if (wanted >= s->bsize >> 2 &&
+ (st = s->state) != 0 &&
+ wanted >= st->template->min_out_size &&
+ s->end_status == 0 &&
+ left == 0
+ ) {
+ byte *wptr = cw.ptr;
+
+ cw.limit -= min_left;
+ status = sreadbuf(s, &cw);
+ cw.limit += min_left;
+ /* Compact the stream so stell will return the right result. */
+ stream_compact(s, true);
+ /*
+ * We know the stream buffer is empty, so it's safe to
+ * update position. However, we need to reset the read
+ * cursor to indicate that there is no data in the buffer.
+ */
+ s->srptr = s->srlimit = s->cbuf - 1;
+ s->position += cw.ptr - wptr;
+ if (status <= 0 || cw.ptr == cw.limit)
+ break;
+ }
+ c = spgetc(s);
+ if (c < 0) {
+ status = c;
+ break;
+ }
+ *++(cw.ptr) = c;
+ }
}
*pn = cw.ptr + 1 - buf;
return (status >= 0 ? 0 : status);
@@ -560,25 +559,25 @@ sputs(register stream * s, const byte * str, uint wlen, uint * pn)
int status = s->end_status;
if (status >= 0)
- while (len > 0) {
- uint count = s->swlimit - s->swptr;
-
- if (count > 0) {
- if (count > len)
- count = len;
- memcpy(s->swptr + 1, str, count);
- s->swptr += count;
- str += count;
- len -= count;
- } else {
- byte ch = *str++;
-
- status = sputc(s, ch);
- if (status < 0)
- break;
- len--;
- }
- }
+ while (len > 0) {
+ uint count = s->swlimit - s->swptr;
+
+ if (count > 0) {
+ if (count > len)
+ count = len;
+ memcpy(s->swptr + 1, str, count);
+ s->swptr += count;
+ str += count;
+ len -= count;
+ } else {
+ byte ch = *str++;
+
+ status = sputc(s, ch);
+ if (status < 0)
+ break;
+ len--;
+ }
+ }
*pn = wlen - len;
return (status >= 0 ? 0 : status);
}
@@ -593,32 +592,32 @@ spskip(register stream * s, long nskip, long *pskipped)
int min_left;
if (nskip < 0 || !s_is_reading(s)) {
- *pskipped = 0;
- return ERRC;
+ *pskipped = 0;
+ return ERRC;
}
if (s_can_seek(s)) {
- long pos = stell(s);
- int status = sseek(s, pos + n);
+ long pos = stell(s);
+ int status = sseek(s, pos + n);
- *pskipped = stell(s) - pos;
- return status;
+ *pskipped = stell(s) - pos;
+ return status;
}
min_left = sbuf_min_left(s);
while (sbufavailable(s) < n + min_left) {
- int status;
-
- n -= sbufavailable(s);
- s->srptr = s->srlimit;
- if (s->end_status) {
- *pskipped = nskip - n;
- return s->end_status;
- }
- status = sgetc(s);
- if (status < 0) {
- *pskipped = nskip - n;
- return status;
- }
- --n;
+ int status;
+
+ n -= sbufavailable(s);
+ s->srptr = s->srlimit;
+ if (s->end_status) {
+ *pskipped = nskip - n;
+ return s->end_status;
+ }
+ status = sgetc(s);
+ if (status < 0) {
+ *pskipped = nskip - n;
+ return status;
+ }
+ --n;
}
/* Note that if min_left > 0, n < 0 is possible; this is harmless. */
s->srptr += n;
@@ -629,9 +628,9 @@ spskip(register stream * s, long nskip, long *pskipped)
/* Read a line from a stream. See srdline.h for the specification. */
int
sreadline(stream *s_in, stream *s_out, void *readline_data,
- gs_const_string *prompt, gs_string * buf,
- gs_memory_t * bufmem, uint * pcount, bool *pin_eol,
- bool (*is_stdin)(const stream *))
+ gs_const_string *prompt, gs_string * buf,
+ gs_memory_t * bufmem, uint * pcount, bool *pin_eol,
+ bool (*is_stdin)(const stream *))
{
uint count = *pcount;
@@ -645,75 +644,75 @@ sreadline(stream *s_in, stream *s_out, void *readline_data,
#endif
if (count == 0 && s_out && prompt) {
- uint ignore_n;
- int ch = sputs(s_out, prompt->data, prompt->size, &ignore_n);
+ uint ignore_n;
+ int ch = sputs(s_out, prompt->data, prompt->size, &ignore_n);
- if (ch < 0)
- return ch;
+ if (ch < 0)
+ return ch;
}
top:
if (*pin_eol) {
- /*
- * We're in the middle of checking for a two-character
- * end-of-line sequence. If we get an EOF here, stop, but
- * don't signal EOF now; wait till the next read.
- */
- int ch = spgetcc(s_in, false);
-
- if (ch == EOFC) {
- *pin_eol = false;
- return 0;
- } else if (ch < 0)
- return ch;
- else if (ch != LF)
- sputback(s_in);
- *pin_eol = false;
- return 0;
+ /*
+ * We're in the middle of checking for a two-character
+ * end-of-line sequence. If we get an EOF here, stop, but
+ * don't signal EOF now; wait till the next read.
+ */
+ int ch = spgetcc(s_in, false);
+
+ if (ch == EOFC) {
+ *pin_eol = false;
+ return 0;
+ } else if (ch < 0)
+ return ch;
+ else if (ch != LF)
+ sputback(s_in);
+ *pin_eol = false;
+ return 0;
}
for (;;) {
- int ch = sgetc(s_in);
-
- if (ch < 0) { /* EOF or exception */
- *pcount = count;
- return ch;
- }
- switch (ch) {
- case '\r':
- {
+ int ch = sgetc(s_in);
+
+ if (ch < 0) { /* EOF or exception */
+ *pcount = count;
+ return ch;
+ }
+ switch (ch) {
+ case '\r':
+ {
#if '\n' == '\r' /* OS-9 or similar */
- if (!is_stdin(s_in))
+ if (!is_stdin(s_in))
#endif
- {
- *pcount = count;
- *pin_eol = true;
- goto top;
- }
- }
- /* falls through */
- case LF:
+ {
+ *pcount = count;
+ *pin_eol = true;
+ goto top;
+ }
+ }
+ /* falls through */
+ case LF:
#undef LF
- *pcount = count;
- return 0;
- }
- if (count >= buf->size) { /* filled the string */
- if (!bufmem) {
- sputback(s_in);
- *pcount = count;
- return 1;
- }
- {
- uint nsize = count + max(count, 20);
- byte *ndata = gs_resize_string(bufmem, buf->data, buf->size,
- nsize, "sreadline(buffer)");
-
- if (ndata == 0)
- return ERRC; /* no better choice */
- buf->data = ndata;
- buf->size = nsize;
- }
- }
- buf->data[count++] = ch;
+ *pcount = count;
+ return 0;
+ }
+ if (count >= buf->size) { /* filled the string */
+ if (!bufmem) {
+ sputback(s_in);
+ *pcount = count;
+ return 1;
+ }
+ {
+ uint nsize = count + max(count, 20);
+ byte *ndata = gs_resize_string(bufmem, buf->data, buf->size,
+ nsize, "sreadline(buffer)");
+
+ if (ndata == 0)
+ return ERRC; /* no better choice */
+ buf->data = ndata;
+ buf->size = nsize;
+ }
+ }
+ buf->data[count++] = ch;
}
/*return 0; *//* not reached */
}
@@ -776,68 +775,68 @@ sreadbuf(stream * s, stream_cursor_write * pbuf)
int status;
for (;;) {
- stream *strm;
- stream_cursor_write *pw;
- byte *oldpos;
-
- for (;;) { /* Descend into the recursion. */
- stream_cursor_read cr;
- stream_cursor_read *pr;
- int left;
- bool eof;
-
- strm = curr->strm;
- if (strm == 0) {
- cr.ptr = 0, cr.limit = 0;
- pr = &cr;
- left = 0;
- eof = false;
- } else {
- pr = &strm->cursor.r;
- left = sbuf_min_left(strm);
- left = min(left, pr->limit - pr->ptr);
- pr->limit -= left;
- eof = strm->end_status == EOFC;
- }
- pw = (prev == 0 ? pbuf : &curr->cursor.w);
- if_debug4('s', "[s]read process 0x%lx, nr=%u, nw=%u, eof=%d\n",
- (ulong) curr, (uint) (pr->limit - pr->ptr),
- (uint) (pw->limit - pw->ptr), eof);
- oldpos = pw->ptr;
- status = (*curr->procs.process) (curr->state, pr, pw, eof);
- pr->limit += left;
- if_debug5('s', "[s]after read 0x%lx, nr=%u, nw=%u, status=%d, position=%ld\n",
- (ulong) curr, (uint) (pr->limit - pr->ptr),
- (uint) (pw->limit - pw->ptr), status, s->position);
- if (strm == 0 || status != 0)
- break;
- if (strm->end_status < 0) {
- if (strm->end_status != EOFC || pw->ptr == oldpos)
- status = strm->end_status;
- break;
- }
- MOVE_AHEAD(curr, prev);
- stream_compact(curr, false);
- }
- /* If curr reached EOD and is a filter or file stream, close it
+ stream *strm;
+ stream_cursor_write *pw;
+ byte *oldpos;
+
+ for (;;) { /* Descend into the recursion. */
+ stream_cursor_read cr;
+ stream_cursor_read *pr;
+ int left;
+ bool eof;
+
+ strm = curr->strm;
+ if (strm == 0) {
+ cr.ptr = 0, cr.limit = 0;
+ pr = &cr;
+ left = 0;
+ eof = false;
+ } else {
+ pr = &strm->cursor.r;
+ left = sbuf_min_left(strm);
+ left = min(left, pr->limit - pr->ptr);
+ pr->limit -= left;
+ eof = strm->end_status == EOFC;
+ }
+ pw = (prev == 0 ? pbuf : &curr->cursor.w);
+ if_debug4('s', "[s]read process 0x%lx, nr=%u, nw=%u, eof=%d\n",
+ (ulong) curr, (uint) (pr->limit - pr->ptr),
+ (uint) (pw->limit - pw->ptr), eof);
+ oldpos = pw->ptr;
+ status = (*curr->procs.process) (curr->state, pr, pw, eof);
+ pr->limit += left;
+ if_debug5('s', "[s]after read 0x%lx, nr=%u, nw=%u, status=%d, position=%ld\n",
+ (ulong) curr, (uint) (pr->limit - pr->ptr),
+ (uint) (pw->limit - pw->ptr), status, s->position);
+ if (strm == 0 || status != 0)
+ break;
+ if (strm->end_status < 0) {
+ if (strm->end_status != EOFC || pw->ptr == oldpos)
+ status = strm->end_status;
+ break;
+ }
+ MOVE_AHEAD(curr, prev);
+ stream_compact(curr, false);
+ }
+ /* If curr reached EOD and is a filter or file stream, close it
* if it is the last filter in the pipeline. Closing the last filter
* seems to contradict PLRM3 but matches Adobe interpreters.
*/
- if ((strm != 0 || curr->file) && status == EOFC &&
- curr->cursor.r.ptr >= curr->cursor.r.limit &&
- curr->close_at_eod &&
+ if ((strm != 0 || curr->file) && status == EOFC &&
+ curr->cursor.r.ptr >= curr->cursor.r.limit &&
+ curr->close_at_eod &&
prev == 0
- ) {
- int cstat = sclose(curr);
-
- if (cstat != 0)
- status = cstat;
- }
- /* Unwind from the recursion. */
- curr->end_status = (status >= 0 ? 0 : status);
- if (prev == 0)
- return status;
- MOVE_BACK(curr, prev);
+ ) {
+ int cstat = sclose(curr);
+
+ if (cstat != 0)
+ status = cstat;
+ }
+ /* Unwind from the recursion. */
+ curr->end_status = (status >= 0 ? 0 : status);
+ if (prev == 0)
+ return status;
+ MOVE_BACK(curr, prev);
}
}
@@ -859,91 +858,91 @@ swritebuf(stream * s, stream_cursor_read * pbuf, bool last)
* end_status = EOFC.
*/
for (;;) {
- for (;;) {
- /* Move ahead in the pipeline. */
- stream *strm = curr->strm;
- stream_cursor_write cw;
- stream_cursor_read *pr;
- stream_cursor_write *pw;
-
- /*
- * We only want to set the last/end flag for
- * the top-level stream and any temporary streams
- * immediately below it.
- */
- bool end = last &&
- (prev == 0 ||
- (depth <= 1 && prev->end_status == EOFC));
-
- if (strm == 0)
- cw.ptr = 0, cw.limit = 0, pw = &cw;
- else
- pw = &strm->cursor.w;
- if (prev == 0)
- pr = pbuf;
- else
- pr = &curr->cursor.r;
- if_debug5('s',
- "[s]write process 0x%lx(%s), nr=%u, nw=%u, end=%d\n",
- (ulong)curr,
- gs_struct_type_name(curr->state->template->stype),
- (uint)(pr->limit - pr->ptr),
- (uint)(pw->limit - pw->ptr), end);
- status = curr->end_status;
- if (status >= 0) {
- status = (*curr->procs.process)(curr->state, pr, pw, end);
- if_debug5('s',
- "[s]after write 0x%lx, nr=%u, nw=%u, end=%d, status=%d\n",
- (ulong) curr, (uint) (pr->limit - pr->ptr),
- (uint) (pw->limit - pw->ptr), end, status);
- if (status == 0 && end)
- status = EOFC;
- if (status == EOFC || status == ERRC)
- curr->end_status = status;
- }
- if (strm == 0 || (status < 0 && status != EOFC))
- break;
- if (status != 1) {
- /*
- * Keep going if we are closing a filter with a sub-stream.
- * We know status == 0 or EOFC.
- */
- if (!end || !strm->is_temp)
- break;
- }
- status = strm->end_status;
- if (status < 0 && (status != EOFC || !end))
- break;
- if (!curr->is_temp)
- ++depth;
- if_debug1('s', "[s]moving ahead, depth = %d\n", depth);
- MOVE_AHEAD(curr, prev);
- stream_compact(curr, false);
- }
- /* Move back in the pipeline. */
- curr->end_status = (status >= 0 ? 0 : status);
- if (status < 0 || prev == 0) {
- /*
- * All streams up to here were called with last = true
- * and returned 0 or EOFC (so their end_status is now EOFC):
- * finish unwinding and then return. Change the status of
- * the prior streams to ERRC if the new status is ERRC,
- * otherwise leave it alone.
- */
- while (prev) {
- if_debug0('s', "[s]unwinding\n");
- MOVE_BACK(curr, prev);
- if (status >= 0)
- curr->end_status = 0;
- else if (status == ERRC)
- curr->end_status = ERRC;
- }
- return status;
- }
- MOVE_BACK(curr, prev);
- if (!curr->is_temp)
- --depth;
- if_debug1('s', "[s]moving back, depth = %d\n", depth);
+ for (;;) {
+ /* Move ahead in the pipeline. */
+ stream *strm = curr->strm;
+ stream_cursor_write cw;
+ stream_cursor_read *pr;
+ stream_cursor_write *pw;
+
+ /*
+ * We only want to set the last/end flag for
+ * the top-level stream and any temporary streams
+ * immediately below it.
+ */
+ bool end = last &&
+ (prev == 0 ||
+ (depth <= 1 && prev->end_status == EOFC));
+
+ if (strm == 0)
+ cw.ptr = 0, cw.limit = 0, pw = &cw;
+ else
+ pw = &strm->cursor.w;
+ if (prev == 0)
+ pr = pbuf;
+ else
+ pr = &curr->cursor.r;
+ if_debug5('s',
+ "[s]write process 0x%lx(%s), nr=%u, nw=%u, end=%d\n",
+ (ulong)curr,
+ gs_struct_type_name(curr->state->template->stype),
+ (uint)(pr->limit - pr->ptr),
+ (uint)(pw->limit - pw->ptr), end);
+ status = curr->end_status;
+ if (status >= 0) {
+ status = (*curr->procs.process)(curr->state, pr, pw, end);
+ if_debug5('s',
+ "[s]after write 0x%lx, nr=%u, nw=%u, end=%d, status=%d\n",
+ (ulong) curr, (uint) (pr->limit - pr->ptr),
+ (uint) (pw->limit - pw->ptr), end, status);
+ if (status == 0 && end)
+ status = EOFC;
+ if (status == EOFC || status == ERRC)
+ curr->end_status = status;
+ }
+ if (strm == 0 || (status < 0 && status != EOFC))
+ break;
+ if (status != 1) {
+ /*
+ * Keep going if we are closing a filter with a sub-stream.
+ * We know status == 0 or EOFC.
+ */
+ if (!end || !strm->is_temp)
+ break;
+ }
+ status = strm->end_status;
+ if (status < 0 && (status != EOFC || !end))
+ break;
+ if (!curr->is_temp)
+ ++depth;
+ if_debug1('s', "[s]moving ahead, depth = %d\n", depth);
+ MOVE_AHEAD(curr, prev);
+ stream_compact(curr, false);
+ }
+ /* Move back in the pipeline. */
+ curr->end_status = (status >= 0 ? 0 : status);
+ if (status < 0 || prev == 0) {
+ /*
+ * All streams up to here were called with last = true
+ * and returned 0 or EOFC (so their end_status is now EOFC):
+ * finish unwinding and then return. Change the status of
+ * the prior streams to ERRC if the new status is ERRC,
+ * otherwise leave it alone.
+ */
+ while (prev) {
+ if_debug0('s', "[s]unwinding\n");
+ MOVE_BACK(curr, prev);
+ if (status >= 0)
+ curr->end_status = 0;
+ else if (status == ERRC)
+ curr->end_status = ERRC;
+ }
+ return status;
+ }
+ MOVE_BACK(curr, prev);
+ if (!curr->is_temp)
+ --depth;
+ if_debug1('s', "[s]moving back, depth = %d\n", depth);
}
}
@@ -958,9 +957,9 @@ stream_move(stream_cursor_read * pr, stream_cursor_write * pw)
int status;
if (rcount <= wcount)
- count = rcount, status = 0;
+ count = rcount, status = 0;
else
- count = wcount, status = 1;
+ count = wcount, status = 1;
memmove(pw->ptr + 1, pr->ptr + 1, count);
pr->ptr += count;
pw->ptr += count;
@@ -972,13 +971,13 @@ static void
stream_compact(stream * s, bool always)
{
if (s->cursor.r.ptr >= s->cbuf && (always || s->end_status >= 0)) {
- uint dist = s->cursor.r.ptr + 1 - s->cbuf;
+ uint dist = s->cursor.r.ptr + 1 - s->cbuf;
- memmove(s->cbuf, s->cursor.r.ptr + 1,
- (uint) (s->cursor.r.limit - s->cursor.r.ptr));
- s->cursor.r.ptr = s->cbuf - 1;
- s->cursor.r.limit -= dist; /* same as w.ptr */
- s->position += dist;
+ memmove(s->cbuf, s->cursor.r.ptr + 1,
+ (uint) (s->cursor.r.limit - s->cursor.r.ptr));
+ s->cursor.r.ptr = s->cbuf - 1;
+ s->cursor.r.limit -= dist; /* same as w.ptr */
+ s->position += dist;
}
}
@@ -990,17 +989,17 @@ static int
s_string_read_seek(stream *, long),
s_string_write_seek(stream *, long),
s_string_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool),
+ stream_cursor_write *, bool),
s_string_write_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
/* Initialize a stream for reading a string. */
void
sread_string(register stream *s, const byte *ptr, uint len)
{
static const stream_procs p = {
- s_string_available, s_string_read_seek, s_std_read_reset,
- s_std_read_flush, s_std_null, s_string_read_process
+ s_string_available, s_string_read_seek, s_std_read_reset,
+ s_std_read_flush, s_std_null, s_string_read_process
};
s_std_init(s, (byte *)ptr, len, &p, s_mode_read + s_mode_seek);
@@ -1030,8 +1029,8 @@ sread_string_reusable(stream *s, const byte *ptr, uint len)
* file_close_disable.
*/
static const stream_procs p = {
- s_string_available, s_string_read_seek, s_string_reusable_reset,
- s_string_reusable_flush, s_close_disable, s_string_read_process
+ s_string_available, s_string_read_seek, s_string_reusable_reset,
+ s_string_reusable_flush, s_close_disable, s_string_read_process
};
sread_string(s, ptr, len);
@@ -1045,7 +1044,7 @@ s_string_available(stream *s, long *pl)
{
*pl = sbufavailable(s);
if (*pl == 0 && s->close_at_eod) /* EOF */
- *pl = -1;
+ *pl = -1;
return 0;
}
@@ -1054,13 +1053,13 @@ static int
s_string_read_seek(register stream * s, long pos)
{
if (pos < 0 || pos > s->bsize)
- return ERRC;
+ return ERRC;
s->srptr = s->cbuf + pos - 1;
/* We might be seeking after a reusable string reached EOF. */
s->srlimit = s->cbuf + s->bsize - 1;
- /*
+ /*
* When the file reaches EOF,
- * stream_compact sets s->position to its end.
+ * stream_compact sets s->position to its end.
* Reset it now to allow stell to work properly
* after calls to this function.
* Note that if the riched EOF and this fuction
@@ -1075,8 +1074,8 @@ void
swrite_string(register stream * s, byte * ptr, uint len)
{
static const stream_procs p = {
- s_std_noavailable, s_string_write_seek, s_std_write_reset,
- s_std_null, s_std_null, s_string_write_process
+ s_std_noavailable, s_string_write_seek, s_std_write_reset,
+ s_std_null, s_std_null, s_string_write_process
};
s_std_init(s, ptr, len, &p, s_mode_write + s_mode_seek);
@@ -1089,7 +1088,7 @@ static int
s_string_write_seek(register stream * s, long pos)
{
if (pos < 0 || pos > s->bsize)
- return ERRC;
+ return ERRC;
s->swptr = s->cbuf + pos - 1;
return 0;
}
@@ -1099,7 +1098,7 @@ s_string_write_seek(register stream * s, long pos)
/* to refill the buffer, we should signal EOF. */
static int
s_string_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
return EOFC;
}
@@ -1107,7 +1106,7 @@ s_string_read_process(stream_state * st, stream_cursor_read * ignore_pr,
/* there has been an overrun (unless we are closing the stream). */
static int
s_string_write_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
return (last ? EOFC : ERRC);
}
@@ -1116,7 +1115,7 @@ s_string_write_process(stream_state * st, stream_cursor_read * pr,
static int
s_write_position_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
/* Set up a write stream that just keeps track of the position. */
void
@@ -1130,7 +1129,7 @@ swrite_position_only(stream *s)
static int
s_write_position_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
pr->ptr = pr->limit; /* discard data */
return 0;
@@ -1145,26 +1144,26 @@ s_write_position_process(stream_state * st, stream_cursor_read * pr,
*/
int
s_init_filter(stream *fs, stream_state *fss, byte *buf, uint bsize,
- stream *target)
+ stream *target)
{
const stream_template *template = fss->template;
if (bsize < template->min_in_size)
- return ERRC;
+ return ERRC;
s_std_init(fs, buf, bsize, &s_filter_write_procs, s_mode_write);
fs->procs.process = template->process;
fs->state = fss;
if (template->init) {
- fs->end_status = (template->init)(fss);
- if (fs->end_status < 0)
- return fs->end_status;
+ fs->end_status = (template->init)(fss);
+ if (fs->end_status < 0)
+ return fs->end_status;
}
fs->strm = target;
return 0;
}
stream *
s_add_filter(stream **ps, const stream_template *template,
- stream_state *ss, gs_memory_t *mem)
+ stream_state *ss, gs_memory_t *mem)
{
stream *es;
stream_state *ess;
@@ -1176,26 +1175,26 @@ s_add_filter(stream **ps, const stream_template *template,
* stream.
*/
if (bsize > (*ps)->bsize && template->process != s_NullE_template.process) {
- stream_template null_template;
+ stream_template null_template;
- null_template = s_NullE_template;
- null_template.min_in_size = bsize;
- if (s_add_filter(ps, &null_template, NULL, mem) == 0)
- return 0;
+ null_template = s_NullE_template;
+ null_template.min_in_size = bsize;
+ if (s_add_filter(ps, &null_template, NULL, mem) == 0)
+ return 0;
}
es = s_alloc(mem, "s_add_filter(stream)");
buf = gs_alloc_bytes(mem, bsize, "s_add_filter(buf)");
if (es == 0 || buf == 0) {
- gs_free_object(mem, buf, "s_add_filter(buf)");
- gs_free_object(mem, es, "s_add_filter(stream)");
- return 0;
+ gs_free_object(mem, buf, "s_add_filter(buf)");
+ gs_free_object(mem, es, "s_add_filter(stream)");
+ return 0;
}
ess = (ss == 0 ? (stream_state *)es : ss);
ess->template = template;
ess->memory = mem;
es->memory = mem;
if (s_init_filter(es, ess, buf, bsize, *ps) < 0)
- return 0;
+ return 0;
*ps = es;
return es;
}
@@ -1208,22 +1207,22 @@ int
s_close_filters(stream **ps, stream *target)
{
while (*ps != target) {
- stream *s = *ps;
- gs_memory_t *mem = s->state->memory;
- byte *sbuf = s->cbuf;
- stream *next = s->strm;
- int status = sclose(s);
- stream_state *ss = s->state; /* sclose may set this to s */
-
- if (status < 0)
- return status;
- if (mem) {
- gs_free_object(mem, sbuf, "s_close_filters(buf)");
- gs_free_object(mem, s, "s_close_filters(stream)");
- if (ss != (stream_state *)s)
- gs_free_object(mem, ss, "s_close_filters(state)");
- }
- *ps = next;
+ stream *s = *ps;
+ gs_memory_t *mem = s->state->memory;
+ byte *sbuf = s->cbuf;
+ stream *next = s->strm;
+ int status = sclose(s);
+ stream_state *ss = s->state; /* sclose may set this to s */
+
+ if (status < 0)
+ return status;
+ if (mem) {
+ gs_free_object(mem, sbuf, "s_close_filters(buf)");
+ gs_free_object(mem, s, "s_close_filters(stream)");
+ if (ss != (stream_state *)s)
+ gs_free_object(mem, ss, "s_close_filters(state)");
+ }
+ *ps = next;
}
return 0;
}
@@ -1261,9 +1260,9 @@ int
file_close_disable(stream * s)
{
int code;
-
+
if ((*s->save_close != NULL) && ((code = (*s->save_close)(s)) != 0))
- return code;
+ return code;
s_close_disable(s);
return file_close_finish(s);
}
@@ -1273,7 +1272,7 @@ file_close_disable(stream * s)
/* Process a buffer */
static int
s_Null_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
return stream_move(pr, pw);
}
diff --git a/gs/base/stream.h b/gs/base/stream.h
index af1bf03bb..34cabd16d 100644
--- a/gs/base/stream.h
+++ b/gs/base/stream.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -126,7 +126,7 @@ struct stream_s {
* CALLC if a callout is required.
*/
short end_status; /* status at end of buffer (when */
- /* reading) or now (when writing) */
+ /* reading) or now (when writing) */
byte foreign; /* true if buffer is outside heap */
byte modes; /* access modes allowed for this stream */
#define s_mode_read 1
@@ -138,19 +138,19 @@ struct stream_s {
#define s_is_writing(s) (((s)->modes & s_mode_write) != 0)
#define s_can_seek(s) (((s)->modes & s_mode_seek) != 0)
gs_string cbuf_string; /* cbuf/cbsize if cbuf is a string, */
- /* 0/? if not */
+ /* 0/? if not */
long position; /* file position of beginning of */
- /* buffer */
+ /* buffer */
stream_procs procs;
stream *strm; /* the underlying stream, non-zero */
- /* iff this is a filter stream */
+ /* iff this is a filter stream */
int is_temp; /* if >0, this is a temporary */
- /* stream and should be freed */
- /* when its source/sink is closed; */
- /* if >1, the buffer is also */
- /* temporary */
+ /* stream and should be freed */
+ /* when its source/sink is closed; */
+ /* if >1, the buffer is also */
+ /* temporary */
int inline_temp; /* temporary for inline access */
- /* (see spgetc_inline below) */
+ /* (see spgetc_inline below) */
stream_state *state; /* state of process */
/*
* The following are for the use of the interpreter.
@@ -159,8 +159,8 @@ struct stream_s {
* zfilter.c for more information on close_strm.
*/
ushort read_id; /* "unique" serial # for detecting */
- /* references to closed streams */
- /* and for validating read access */
+ /* references to closed streams */
+ /* and for validating read access */
ushort write_id; /* ditto to validate write access */
stream *prev, *next; /* keep track of all files */
bool close_strm; /* CloseSource/CloseTarget */
@@ -173,9 +173,9 @@ struct stream_s {
*/
FILE *file; /* file handle for C library */
gs_const_string file_name; /* file name (optional) -- clients must */
- /* access only through procedures */
+ /* access only through procedures */
uint file_modes; /* access modes for the file, */
- /* may be a superset of modes */
+ /* may be a superset of modes */
/* Clients must only set the following through sread_subfile. */
long file_offset; /* starting point in file (reading) */
long file_limit; /* ending point in file (reading) */
@@ -336,15 +336,15 @@ void s_init_state(stream_state *, const stream_template *, gs_memory_t *);
/* create a stream for a file object */
int file_prepare_stream(const char *, uint, const char *,
- uint, stream **, char[4], gs_memory_t *);
+ uint, stream **, char[4], gs_memory_t *);
/* Set up a file stream on an OS file. */
void file_init_stream(stream *, FILE *, const char *, byte *, uint);
/* Open a file stream, optionally on an OS file. */
int file_open_stream(const char *, uint, const char *,
- uint, stream **, gx_io_device *,
- iodev_proc_fopen_t, gs_memory_t *);
+ uint, stream **, gx_io_device *,
+ iodev_proc_fopen_t, gs_memory_t *);
/* Allocate and return a file stream. */
stream * file_alloc_stream(gs_memory_t *, client_name_t);
@@ -422,9 +422,9 @@ extern const stream_procs s_filter_read_procs, s_filter_write_procs;
* an additional filter to provide it.
*/
int s_init_filter(stream *fs, stream_state *fss, byte *buf, uint bsize,
- stream *target);
+ stream *target);
stream *s_add_filter(stream **ps, const stream_template *template,
- stream_state *ss, gs_memory_t *mem);
+ stream_state *ss, gs_memory_t *mem);
/*
* Close the filters in a pipeline, up to a given target stream, freeing
@@ -437,7 +437,7 @@ int s_close_filters(stream **ps, stream *target);
extern const stream_template s_NullE_template;
extern const stream_template s_NullD_template;
- /* for ziodev.c */
+ /* for ziodev.c */
int file_close_finish(stream *);
int file_close_disable(stream *);
diff --git a/gs/base/strimpl.h b/gs/base/strimpl.h
index 5391dce5f..46c887420 100644
--- a/gs/base/strimpl.h
+++ b/gs/base/strimpl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/string_.h b/gs/base/string_.h
index 2ba19bb29..c220679cb 100644
--- a/gs/base/string_.h
+++ b/gs/base/string_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
# endif
# include <string.h>
# if defined(THINK_C)
- /* Patch strlen to return a uint rather than a size_t. */
+ /* Patch strlen to return a uint rather than a size_t. */
# define strlen (uint)strlen
# endif
# ifdef MEMORY__NEED_MEMMOVE
diff --git a/gs/base/strmio.h b/gs/base/strmio.h
index 45bd1736f..30074fe5a 100644
--- a/gs/base/strmio.h
+++ b/gs/base/strmio.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ stream * sfopen(const char *path, const char *mode, gs_memory_t *mem);
* Read a number of bytes from a stream, returning number read. Return count
* will be less than count if EOF or error. Return count is number of elements.
*/
-int sfread(void *ptr, size_t size, size_t count, stream *s);
+int sfread(void *ptr, size_t size, size_t count, stream *s);
/*
* Read a byte from a stream
diff --git a/gs/base/szlibc.c b/gs/base/szlibc.c
index e8e463ada..cd8f916cd 100644
--- a/gs/base/szlibc.c
+++ b/gs/base/szlibc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,15 +48,15 @@ s_zlib_set_defaults(stream_state * st)
int
s_zlib_alloc_dynamic_state(stream_zlib_state *ss)
{
- gs_memory_t *mem = ss->memory;
+ gs_memory_t *mem = ss->memory;
zlib_dynamic_state_t *zds =
- gs_alloc_struct_immovable(mem, zlib_dynamic_state_t,
- &st_zlib_dynamic_state,
- "s_zlib_alloc_dynamic_state");
+ gs_alloc_struct_immovable(mem, zlib_dynamic_state_t,
+ &st_zlib_dynamic_state,
+ "s_zlib_alloc_dynamic_state");
ss->dynamic = zds;
if (zds == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
zds->blocks = 0;
zds->memory = mem;
zds->zstate.zalloc = (alloc_func)s_zlib_alloc;
@@ -70,8 +70,8 @@ void
s_zlib_free_dynamic_state(stream_zlib_state *ss)
{
if (ss->dynamic)
- gs_free_object(ss->dynamic->memory, ss->dynamic,
- "s_zlib_free_dynamic_state");
+ gs_free_object(ss->dynamic->memory, ss->dynamic,
+ "s_zlib_free_dynamic_state");
}
/* Provide zlib-compatible allocation and freeing functions. */
@@ -81,21 +81,21 @@ s_zlib_alloc(void *zmem, uint items, uint size)
zlib_dynamic_state_t *const zds = zmem;
gs_memory_t *mem = zds->memory->stable_memory;
zlib_block_t *block =
- gs_alloc_struct(mem, zlib_block_t, &st_zlib_block,
- "s_zlib_alloc(block)");
+ gs_alloc_struct(mem, zlib_block_t, &st_zlib_block,
+ "s_zlib_alloc(block)");
void *data =
- gs_alloc_byte_array_immovable(mem, items, size, "s_zlib_alloc(data)");
+ gs_alloc_byte_array_immovable(mem, items, size, "s_zlib_alloc(data)");
if (block == 0 || data == 0) {
- gs_free_object(mem, data, "s_zlib_alloc(data)");
- gs_free_object(mem, block, "s_zlib_alloc(block)");
- return Z_NULL;
+ gs_free_object(mem, data, "s_zlib_alloc(data)");
+ gs_free_object(mem, block, "s_zlib_alloc(block)");
+ return Z_NULL;
}
block->data = data;
block->next = zds->blocks;
block->prev = 0;
if (zds->blocks)
- zds->blocks->prev = block;
+ zds->blocks->prev = block;
zds->blocks = block;
return data;
}
@@ -108,18 +108,18 @@ s_zlib_free(void *zmem, void *data)
gs_free_object(mem, data, "s_zlib_free(data)");
for (; ; block = block->next) {
- if (block == 0) {
- lprintf1("Freeing unrecorded data 0x%lx!\n", (ulong)data);
- return;
- }
- if (block->data == data)
- break;
+ if (block == 0) {
+ lprintf1("Freeing unrecorded data 0x%lx!\n", (ulong)data);
+ return;
+ }
+ if (block->data == data)
+ break;
}
if (block->next)
- block->next->prev = block->prev;
+ block->next->prev = block->prev;
if (block->prev)
- block->prev->next = block->next;
+ block->prev->next = block->next;
else
- zds->blocks = block->next;
+ zds->blocks = block->next;
gs_free_object(mem, block, "s_zlib_free(block)");
}
diff --git a/gs/base/szlibe.c b/gs/base/szlibe.c
index 64a343007..060788455 100644
--- a/gs/base/szlibe.c
+++ b/gs/base/szlibe.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,11 +25,11 @@ s_zlibE_init(stream_state * st)
int code = s_zlib_alloc_dynamic_state(ss);
if (code < 0)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
if (deflateInit2(&ss->dynamic->zstate, ss->level, ss->method,
- (ss->no_wrapper ? -ss->windowBits : ss->windowBits),
- ss->memLevel, ss->strategy) != Z_OK)
- return ERRC; /****** WRONG ******/
+ (ss->no_wrapper ? -ss->windowBits : ss->windowBits),
+ ss->memLevel, ss->strategy) != Z_OK)
+ return ERRC; /****** WRONG ******/
return 0;
}
@@ -40,14 +40,14 @@ s_zlibE_reset(stream_state * st)
stream_zlib_state *const ss = (stream_zlib_state *)st;
if (deflateReset(&ss->dynamic->zstate) != Z_OK)
- return ERRC; /****** WRONG ******/
+ return ERRC; /****** WRONG ******/
return 0;
}
/* Process a buffer */
static int
s_zlibE_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_zlib_state *const ss = (stream_zlib_state *)st;
z_stream *zs = &ss->dynamic->zstate;
@@ -57,9 +57,9 @@ s_zlibE_process(stream_state * st, stream_cursor_read * pr,
/* Detect no input or full output so that we don't get */
/* a Z_BUF_ERROR return. */
if (pw->ptr == pw->limit)
- return 1;
+ return 1;
if (p == pr->limit && !last)
- return 0;
+ return 0;
zs->next_in = (Bytef *)p + 1;
zs->avail_in = pr->limit - p;
zs->next_out = pw->ptr + 1;
@@ -68,12 +68,12 @@ s_zlibE_process(stream_state * st, stream_cursor_read * pr,
pr->ptr = zs->next_in - 1;
pw->ptr = zs->next_out - 1;
switch (status) {
- case Z_OK:
- return (pw->ptr == pw->limit ? 1 : pr->ptr > p && !last ? 0 : 1);
- case Z_STREAM_END:
- return (last && pr->ptr == pr->limit ? 0 : ERRC);
- default:
- return ERRC;
+ case Z_OK:
+ return (pw->ptr == pw->limit ? 1 : pr->ptr > p && !last ? 0 : 1);
+ case Z_STREAM_END:
+ return (last && pr->ptr == pr->limit ? 0 : ERRC);
+ default:
+ return ERRC;
}
}
diff --git a/gs/base/szlibx.h b/gs/base/szlibx.h
index 349ccb4cc..ac80e45e4 100644
--- a/gs/base/szlibx.h
+++ b/gs/base/szlibx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/szlibxx.h b/gs/base/szlibxx.h
index f652921ef..a09b552be 100644
--- a/gs/base/szlibxx.h
+++ b/gs/base/szlibxx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/time_.h b/gs/base/time_.h
index c06573f23..87762c17c 100644
--- a/gs/base/time_.h
+++ b/gs/base/time_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,7 +38,7 @@
defined(__hpux) || defined(__SUNPRO_C)
/* Plan 9, SCO, AIX and Sequent's DYNIX/ptx need both time.h and
* sys/time.h! As of version 2.2, at least some glibc
- * installations also require both files.
+ * installations also require both files.
* Following Duraid Madina's request we also do it on Intel compiler.
*/
# include <time.h>
@@ -79,10 +79,10 @@ struct timezone {
#ifdef HAVE_SYS_TIMES_H
# include <sys/times.h>
# define use_times_for_usertime 1
- /* Posix 1003.1b-1993 section 4.8.1.5 says that
- CLK_TCK is obsolescent and that sysconf(_SC_CLK_TCK)
- should be used instead, but this requires including
- <unistd.h>, which is too painful to configure. */
+ /* Posix 1003.1b-1993 section 4.8.1.5 says that
+ CLK_TCK is obsolescent and that sysconf(_SC_CLK_TCK)
+ should be used instead, but this requires including
+ <unistd.h>, which is too painful to configure. */
# ifndef CLK_TCK
# define CLK_TCK 100 /* guess for older hosts */
# endif
@@ -91,4 +91,3 @@ struct timezone {
#endif
#endif /* time__INCLUDED */
-
diff --git a/gs/base/ttcalc.c b/gs/base/ttcalc.c
index efee474e8..5fd9eafd9 100644
--- a/gs/base/ttcalc.c
+++ b/gs/base/ttcalc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
@@ -56,7 +56,6 @@
2147483647
};
-
#ifdef LONG64
Int32 MulDiv( Int32 a, Int32 b, Int32 c )
@@ -71,7 +70,6 @@
return ((s < 0) ? -a : a);
}
-
Int32 MulDiv_Round( Int32 a, Int32 b, Int32 c )
{
int s;
@@ -84,7 +82,6 @@
return ((s < 0) ? -a : a);
}
-
static Int Order64( Int64 z )
{
int j = 0;
@@ -96,7 +93,6 @@
return j - 1;
}
-
Int32 Sqrt64( Int64 l )
{
Int64 r, s;
@@ -133,7 +129,6 @@
return ((s < 0) ? -a : a);
}
-
Int32 MulDiv_Round( Int32 a, Int32 b, Int32 c )
{
Int64 temp, temp2;
@@ -152,7 +147,6 @@
return ((s < 0) ? -a : a);
}
-
static void Neg64__( Int64* x )
{
/* Remember that -(0x80000000) == 0x80000000 with 2-complement! */
@@ -173,7 +167,6 @@
}
}
-
void Add64( Int64* x, Int64* y, Int64* z )
{
register Word32 lo, hi;
@@ -188,7 +181,6 @@
z->hi = hi;
}
-
void Sub64( Int64* x, Int64* y, Int64* z )
{
register Word32 lo, hi;
@@ -202,7 +194,6 @@
z->hi = hi;
}
-
void MulTo64( Int32 x, Int32 y, Int64* z )
{
Int32 s;
@@ -245,7 +236,6 @@
if (s < 0) Neg64__( z );
}
-
Int32 Div64by32( Int64* x, Int32 y )
{
Int32 s;
@@ -286,7 +276,6 @@
return ( (s<0) ? -q : q );
}
-
Int Order64( Int64* z )
{
Word32 i;
@@ -311,7 +300,6 @@
return j-1;
}
-
Int32 Sqrt64( Int64* l )
{
Int64 l2;
@@ -353,7 +341,6 @@
return j - 1;
}
-
Int32 Sqrt32( Int32 l )
{
Int32 r, s;
diff --git a/gs/base/ttcalc.h b/gs/base/ttcalc.h
index 22a27269d..1104917c2 100644
--- a/gs/base/ttcalc.h
+++ b/gs/base/ttcalc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
@@ -93,7 +93,6 @@
#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -163,7 +162,6 @@
#endif /* LONG64 */
-
#define MUL_FIXED( a, b ) MulDiv_Round( (a), (b), 1 << 16 )
#define INT_TO_F26DOT6( x ) ( (Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (Long)(x) << 14 )
@@ -180,5 +178,4 @@
#endif /* TTCALC_H */
-
/* END */
diff --git a/gs/base/ttcommon.h b/gs/base/ttcommon.h
index 170358eac..09a466795 100644
--- a/gs/base/ttcommon.h
+++ b/gs/base/ttcommon.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -186,5 +186,4 @@
#endif /* TTCOMMON_H */
-
/* END */
diff --git a/gs/base/ttconf.h b/gs/base/ttconf.h
index 6c499acb3..c700b7817 100644
--- a/gs/base/ttconf.h
+++ b/gs/base/ttconf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,7 +65,6 @@
/* Define if you have the basename function. */
#undef HAVE_BASENAME
-
/* End of ft_conf.h */
#endif /* TTCONF_H */
diff --git a/gs/base/ttconfig.h b/gs/base/ttconfig.h
index 8da4b4204..22d1f924b 100644
--- a/gs/base/ttconfig.h
+++ b/gs/base/ttconfig.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,23 +16,23 @@
/*******************************************************************
*
- * ttconfig.h 1.0
+ * ttconfig.h 1.0
*
- * Configuration settings header file (spec only).
+ * Configuration settings header file (spec only).
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* Notes:
*
* All the configuration #define statements have been gathered in
- * this file to allow easy check and modification.
+ * this file to allow easy check and modification.
*
******************************************************************/
@@ -47,7 +47,6 @@
#include "ttconf.h"
-
/* ------------ general debugging -------------------------------------- */
/* Define DEBUG if you want the program to output a series of messages */
@@ -55,7 +54,6 @@
/* #define DEBUG */
-
/* ------------ arithmetic and processor support - ttcalc, ttraster ---- */
/* Define ONE_COMPLEMENT if this matches your processor's artihmetic. */
@@ -64,11 +62,9 @@
/* #define ONE_COMPLEMENT */
-
/* BOUND_CALC isn't needed anymore due to changes in the ttcalc */
/* component. All computations are now bounded. */
-
/* Define _GNUC_LONG64_ if you want to enable the use of the 'long long' */
/* 64-bit type provided by gcc. Note that: */
/* */
@@ -86,7 +82,6 @@
/* #define _GNUC_LONG64_ */
-
/* define BUS_ERROR if your processor is unable to access words that */
/* are not aligned to their respective size (i.e. a 4byte dword */
/* beginning at address 3 will result in a bus error on a Sun). */
@@ -95,14 +90,12 @@
/* #define BUS_ERROR */
-
/* define ALIGNMENT to your processor/environment preferred alignment */
/* size. A value of 8 should work on all current processors, even */
/* 64-bits ones. */
#define ALIGNMENT 8
-
/* ------------ rasterizer configuration ----- ttraster ----------------- */
/* Define this if you want to use the 'MulDiv' function from 'ttcalc'. */
@@ -119,7 +112,6 @@
#define SECURE_COMPUTATIONS
-
/* Define this if you want to generate a debug version of the rasterizer. */
/* This will progressively draw the glyphs while the computations are */
/* done directly on the graphics screen... (with inverted glyphs) */
@@ -131,7 +123,6 @@
/* #define DEBUG_RASTER */
-
/* The TrueType specs stipulate that the filled regions delimited by */
/* the contours must be to the right of the drawing orientation. */
/* Unfortunately, a lot of cheapo fonts do not respect this rule. */
@@ -142,9 +133,6 @@
#define IGNORE_FILL_FLOW
/* We want to draw all kinds of glyphs, even incorrect ones... */
-
-
-
/* --------------- automatic setup -- don't touch ------------------ */
/* Some systems can't use vfprintf for error messages on stderr; if */
@@ -210,5 +198,4 @@
#endif /* TTCONFIG_H */
-
/* END */
diff --git a/gs/base/ttfinp.c b/gs/base/ttfinp.c
index 4305e98a3..b8471edeb 100644
--- a/gs/base/ttfinp.c
+++ b/gs/base/ttfinp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,7 +14,6 @@
/* $Id$ */
/* A TT font input support. */
-
#include "ttmisc.h"
#include "ttfoutl.h"
@@ -22,43 +21,42 @@
#include "ttfinp.h"
unsigned char ttfReader__Byte(ttfReader *r)
-{ unsigned char b;
+{ unsigned char b;
- r->Read(r, &b, 1);
+ r->Read(r, &b, 1);
return b;
}
signed char ttfReader__SignedByte(ttfReader *r)
-{ signed char b;
+{ signed char b;
- r->Read(r, &b, 1);
+ r->Read(r, &b, 1);
return b;
}
signed short ttfReader__Short(ttfReader *r)
-{ unsigned char buf[2];
+{ unsigned char buf[2];
r->Read(r, buf, 2);
return ((int16)buf[0] << 8) | (int16)buf[1];
}
unsigned short ttfReader__UShort(ttfReader *r)
-{ unsigned char buf[2];
+{ unsigned char buf[2];
r->Read(r, buf, 2);
return ((uint16)buf[0] << 8) | (uint16)buf[1];
}
unsigned int ttfReader__UInt(ttfReader *r)
-{ unsigned char buf[4];
+{ unsigned char buf[4];
r->Read(r, buf, 4);
- return ((int32)buf[0] << 24) | ((int32)buf[1] << 16) |
- ((int32)buf[2] << 8) | (int32)buf[3];
+ return ((int32)buf[0] << 24) | ((int32)buf[1] << 16) |
+ ((int32)buf[2] << 8) | (int32)buf[3];
}
signed int ttfReader__Int(ttfReader *r)
-{
+{
return (int)ttfReader__UInt(r);
}
-
diff --git a/gs/base/ttfinp.h b/gs/base/ttfinp.h
index 62902ca7b..c565950bb 100644
--- a/gs/base/ttfinp.h
+++ b/gs/base/ttfinp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/ttfmain.c b/gs/base/ttfmain.c
index de20ff63d..ff211627d 100644
--- a/gs/base/ttfmain.c
+++ b/gs/base/ttfmain.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,11 +27,11 @@
static const bool skip_instructions = 0; /* Debug purpose only. */
-typedef struct {
+typedef struct {
TT_Fixed a, b, c, d, tx, ty;
} FixMatrix;
-struct ttfSubGlyphUsage_s {
+struct ttfSubGlyphUsage_s {
FixMatrix m;
int index;
int flags;
@@ -71,29 +71,29 @@ static void TransformF26Dot6PointFloat(FloatPoint *pt, F26Dot6 dx, F26Dot6 dy, F
static ttfPtrElem *ttfFont__get_table_ptr(ttfFont *f, char *id)
{
if (!memcmp(id, "cvt ", 4))
- return &f->t_cvt_;
+ return &f->t_cvt_;
if (!memcmp(id, "fpgm", 4))
- return &f->t_fpgm;
+ return &f->t_fpgm;
if (!memcmp(id, "glyf", 4))
- return &f->t_glyf;
+ return &f->t_glyf;
if (!memcmp(id, "head", 4))
- return &f->t_head;
+ return &f->t_head;
if (!memcmp(id, "hhea", 4))
- return &f->t_hhea;
+ return &f->t_hhea;
if (!memcmp(id, "hmtx", 4))
- return &f->t_hmtx;
+ return &f->t_hmtx;
if (!memcmp(id, "vhea", 4))
- return &f->t_vhea;
+ return &f->t_vhea;
if (!memcmp(id, "vmtx", 4))
- return &f->t_vmtx;
+ return &f->t_vmtx;
if (!memcmp(id, "loca", 4))
- return &f->t_loca;
+ return &f->t_loca;
if (!memcmp(id, "maxp", 4))
- return &f->t_maxp;
+ return &f->t_maxp;
if (!memcmp(id, "prep", 4))
- return &f->t_prep;
+ return &f->t_prep;
if (!memcmp(id, "cmap", 4))
- return &f->t_cmap;
+ return &f->t_cmap;
return 0;
}
@@ -102,17 +102,17 @@ static ttfPtrElem *ttfFont__get_table_ptr(ttfFont *f, char *id)
TT_Error TT_Set_Instance_CharSizes(TT_Instance instance,
TT_F26Dot6 charWidth,
TT_F26Dot6 charHeight)
-{
+{
PInstance ins = instance.z;
if ( !ins )
- return TT_Err_Invalid_Instance_Handle;
+ return TT_Err_Invalid_Instance_Handle;
if (charWidth < 1*64)
- charWidth = 1*64;
+ charWidth = 1*64;
if (charHeight < 1*64)
- charHeight = 1*64;
+ charHeight = 1*64;
ins->metrics.x_scale1 = charWidth;
ins->metrics.y_scale1 = charHeight;
@@ -120,17 +120,17 @@ TT_Error TT_Set_Instance_CharSizes(TT_Instance instance,
ins->metrics.y_scale2 = ins->face->font->nUnitsPerEm;
if (ins->face->font->nFlags & 8) {
- ins->metrics.x_scale1 = (ins->metrics.x_scale1+32) & -64;
- ins->metrics.y_scale1 = (ins->metrics.y_scale1+32) & -64;
+ ins->metrics.x_scale1 = (ins->metrics.x_scale1+32) & -64;
+ ins->metrics.y_scale1 = (ins->metrics.y_scale1+32) & -64;
}
ins->metrics.x_ppem = ins->metrics.x_scale1 / 64;
ins->metrics.y_ppem = ins->metrics.y_scale1 / 64;
if (charWidth > charHeight)
- ins->metrics.pointSize = charWidth;
+ ins->metrics.pointSize = charWidth;
else
- ins->metrics.pointSize = charHeight;
+ ins->metrics.pointSize = charHeight;
ins->valid = FALSE;
return Instance_Reset(ins, FALSE);
@@ -143,20 +143,20 @@ int ttfInterpreter__obtain(ttfMemory *mem, ttfInterpreter **ptti)
ttfInterpreter *tti;
if (*ptti) {
- (*ptti)->lock++;
- return 0;
+ (*ptti)->lock++;
+ return 0;
}
tti = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_ttfInterpreter, "ttfInterpreter__obtain");
if (!tti)
- return fMemoryError;
+ return fMemoryError;
tti->usage = 0;
tti->usage_size = 0;
tti->ttf_memory = mem;
tti->lock = 1;
tti->exec = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TExecution_Context, "ttfInterpreter__obtain");
if (!tti->exec) {
- mem->free(mem, tti, "ttfInterpreter__obtain");
- return fMemoryError;
+ mem->free(mem, tti, "ttfInterpreter__obtain");
+ return fMemoryError;
}
memset(tti->exec, 0, sizeof(*tti->exec));
*ptti = tti;
@@ -169,7 +169,7 @@ void ttfInterpreter__release(ttfInterpreter **ptti)
ttfMemory *mem = tti->ttf_memory;
if(--tti->lock)
- return;
+ return;
mem->free(mem, tti->usage, "ttfInterpreter__release");
mem->free(mem, tti->exec, "ttfInterpreter__release");
mem->free(mem, *ptti, "ttfInterpreter__release");
@@ -178,9 +178,9 @@ void ttfInterpreter__release(ttfInterpreter **ptti)
/*-------------------------------------------------------------------*/
-void ttfFont__init(ttfFont *this, ttfMemory *mem,
- void (*DebugRepaint)(ttfFont *),
- int (*DebugPrint)(ttfFont *, const char *s, ...),
+void ttfFont__init(ttfFont *this, ttfMemory *mem,
+ void (*DebugRepaint)(ttfFont *),
+ int (*DebugPrint)(ttfFont *, const char *s, ...),
const gs_memory_t *DebugMem)
{
memset(this, 0, sizeof(*this));
@@ -193,32 +193,32 @@ void ttfFont__finit(ttfFont *this)
{ ttfMemory *mem = this->tti->ttf_memory;
if (this->exec) {
- if (this->inst)
- Context_Destroy(this->exec);
- else {
- /* Context_Create was not called - see ttfFont__Open.
- Must not call Context_Destroy for proper 'lock' count.
- */
- }
+ if (this->inst)
+ Context_Destroy(this->exec);
+ else {
+ /* Context_Create was not called - see ttfFont__Open.
+ Must not call Context_Destroy for proper 'lock' count.
+ */
+ }
}
this->exec = NULL;
if (this->inst)
- Instance_Destroy(this->inst);
+ Instance_Destroy(this->inst);
mem->free(mem, this->inst, "ttfFont__finit");
this->inst = NULL;
if (this->face)
- Face_Destroy(this->face);
+ Face_Destroy(this->face);
mem->free(mem, this->face, "ttfFont__finit");
this->face = NULL;
}
-#define MAX_SUBGLYPH_NESTING 3 /* Arbitrary. We need this because we don't want
- a ttfOutliner__BuildGlyphOutline recursion
- while a glyph is loaded in ttfReader. */
+#define MAX_SUBGLYPH_NESTING 3 /* Arbitrary. We need this because we don't want
+ a ttfOutliner__BuildGlyphOutline recursion
+ while a glyph is loaded in ttfReader. */
-FontError ttfFont__Open(ttfInterpreter *tti, ttfFont *this, ttfReader *r,
- unsigned int nTTC, float w, float h,
- bool design_grid)
+FontError ttfFont__Open(ttfInterpreter *tti, ttfFont *this, ttfReader *r,
+ unsigned int nTTC, float w, float h,
+ bool design_grid)
{ char sVersion[4], sVersion1[4] = {0, 1, 0, 0};
char sVersion2[4] = {0, 2, 0, 0};
unsigned int nNumTables, i;
@@ -232,43 +232,43 @@ FontError ttfFont__Open(ttfInterpreter *tti, ttfFont *this, ttfReader *r,
this->design_grid = design_grid;
r->Read(r, sVersion, 4);
if(!memcmp(sVersion, "ttcf", 4)) {
- unsigned int nFonts;
- unsigned int nPos = 0xbaadf00d; /* Quiet compiler. */
+ unsigned int nFonts;
+ unsigned int nPos = 0xbaadf00d; /* Quiet compiler. */
- r->Read(r, sVersion, 4);
+ r->Read(r, sVersion, 4);
if(memcmp(sVersion, sVersion1, 4) && memcmp(sVersion, sVersion2, 4))
- return fUnimplemented;
- nFonts = ttfReader__UInt(r);
- if (nFonts == 0)
- return fBadFontData;
- if(nTTC >= nFonts)
- return fTableNotFound;
- for(i = 0; i <= nTTC; i++)
- nPos = ttfReader__UInt(r);
- r->Seek(r, nPos);
- r->Read(r, sVersion, 4);
+ return fUnimplemented;
+ nFonts = ttfReader__UInt(r);
+ if (nFonts == 0)
+ return fBadFontData;
+ if(nTTC >= nFonts)
+ return fTableNotFound;
+ for(i = 0; i <= nTTC; i++)
+ nPos = ttfReader__UInt(r);
+ r->Seek(r, nPos);
+ r->Read(r, sVersion, 4);
}
if(memcmp(sVersion, sVersion1, 4) && memcmp(sVersion, "true", 4))
- return fUnimplemented;
+ return fUnimplemented;
nNumTables = ttfReader__UShort(r);
ttfReader__UShort(r); /* nSearchRange */
ttfReader__UShort(r); /* nEntrySelector */
ttfReader__UShort(r); /* nRangeShift */
for (i = 0; i < nNumTables; i++) {
- char sTag[5];
- unsigned int nOffset, nLength;
- ttfPtrElem *e;
-
- sTag[4] = 0;
- r->Read(r, sTag, 4);
- ttfReader__UInt(r); /* nCheckSum */
- nOffset = ttfReader__UInt(r);
- nLength = ttfReader__UInt(r);
- e = ttfFont__get_table_ptr(this, sTag);
- if (e != NULL) {
- e->nPos = nOffset;
- e->nLen = nLength;
- }
+ char sTag[5];
+ unsigned int nOffset, nLength;
+ ttfPtrElem *e;
+
+ sTag[4] = 0;
+ r->Read(r, sTag, 4);
+ ttfReader__UInt(r); /* nCheckSum */
+ nOffset = ttfReader__UInt(r);
+ nLength = ttfReader__UInt(r);
+ e = ttfFont__get_table_ptr(this, sTag);
+ if (e != NULL) {
+ e->nPos = nOffset;
+ e->nLen = nLength;
+ }
}
r->Seek(r, this->t_head.nPos + offset_of(sfnt_FontHeader, flags));
this->nFlags = ttfReader__UShort(r);
@@ -281,87 +281,87 @@ FontError ttfFont__Open(ttfInterpreter *tti, ttfFont *this, ttfReader *r,
r->Seek(r, this->t_maxp.nPos + offset_of(sfnt_maxProfileTable, maxComponentElements));
this->nMaxComponents = ttfReader__UShort(r);
if(this->nMaxComponents < 10)
- this->nMaxComponents = 10; /* work around DynaLab bug in lgoth.ttf */
+ this->nMaxComponents = 10; /* work around DynaLab bug in lgoth.ttf */
r->Seek(r, this->t_hhea.nPos + offset_of(sfnt_MetricsHeader, numberLongMetrics));
this->nLongMetricsHorz = ttfReader__UShort(r);
if (this->t_vhea.nPos != 0) {
- r->Seek(r, this->t_vhea.nPos + offset_of(sfnt_MetricsHeader, numberLongMetrics));
- this->nLongMetricsVert = ttfReader__UShort(r);
+ r->Seek(r, this->t_vhea.nPos + offset_of(sfnt_MetricsHeader, numberLongMetrics));
+ this->nLongMetricsVert = ttfReader__UShort(r);
} else
- this->nLongMetricsVert = 0;
+ this->nLongMetricsVert = 0;
if (tti->usage_size < this->nMaxComponents * MAX_SUBGLYPH_NESTING) {
- tti->ttf_memory->free(tti->ttf_memory, tti->usage, "ttfFont__Open");
- tti->usage_size = 0;
- tti->usage = mem->alloc_bytes(mem,
- sizeof(ttfSubGlyphUsage) * this->nMaxComponents * MAX_SUBGLYPH_NESTING,
- "ttfFont__Open");
- if (tti->usage == NULL)
- return fMemoryError;
- tti->usage_size = this->nMaxComponents * MAX_SUBGLYPH_NESTING;
+ tti->ttf_memory->free(tti->ttf_memory, tti->usage, "ttfFont__Open");
+ tti->usage_size = 0;
+ tti->usage = mem->alloc_bytes(mem,
+ sizeof(ttfSubGlyphUsage) * this->nMaxComponents * MAX_SUBGLYPH_NESTING,
+ "ttfFont__Open");
+ if (tti->usage == NULL)
+ return fMemoryError;
+ tti->usage_size = this->nMaxComponents * MAX_SUBGLYPH_NESTING;
}
this->face = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TFace, "ttfFont__Open");
if (this->face == NULL)
- return fMemoryError;
+ return fMemoryError;
memset(this->face, 0, sizeof(*this->face));
this->face->r = r;
this->face->font = this;
this->exec = tti->exec;
code = Face_Create(this->face);
if (code)
- return fMemoryError;
+ return fMemoryError;
code = r->Error(r);
if (code < 0)
- return fBadFontData;
+ return fBadFontData;
this->inst = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TInstance, "ttfFont__Open");
if (this->inst == NULL)
- return fMemoryError;
+ return fMemoryError;
memset(this->inst, 0, sizeof(*this->inst));
code = Context_Create(this->exec, this->face); /* See comment in the implementation of Context_Create. */
if (code == TT_Err_Out_Of_Memory)
- return fMemoryError;
+ return fMemoryError;
code = Instance_Create(this->inst, this->face);
if (code == TT_Err_Out_Of_Memory)
- return fMemoryError;
+ return fMemoryError;
if (code)
- return fBadFontData;
+ return fBadFontData;
for(k = 0; k < this->face->cvtSize; k++)
- this->inst->cvt[k] = shortToF26Dot6(this->face->cvt[k]);
+ this->inst->cvt[k] = shortToF26Dot6(this->face->cvt[k]);
code = Instance_Init(this->inst);
if (code == TT_Err_Out_Of_Memory)
- return fMemoryError;
+ return fMemoryError;
if (code >= TT_Err_Invalid_Opcode && code <= TT_Err_Invalid_Displacement)
- code1 = fBadInstruction;
+ code1 = fBadInstruction;
else if (code)
- return fBadFontData;
+ return fBadFontData;
I.z = this->inst;
if (design_grid)
- ww = hh = shortToF26Dot6(this->nUnitsPerEm);
+ ww = hh = shortToF26Dot6(this->nUnitsPerEm);
else {
- /* Round towards zero for a better view of mirrored characters : */
- ww = floatToF26Dot6(w);
- hh = floatToF26Dot6(h);
+ /* Round towards zero for a better view of mirrored characters : */
+ ww = floatToF26Dot6(w);
+ hh = floatToF26Dot6(h);
}
code = TT_Set_Instance_CharSizes(I, ww, hh);
this->inst->metrics = this->exec->metrics;
if (code == TT_Err_Invalid_Engine)
- return fPatented;
+ return fPatented;
if (code == TT_Err_Out_Of_Memory)
- return fMemoryError;
+ return fMemoryError;
if (code >= TT_Err_Invalid_Opcode && code <= TT_Err_Invalid_Displacement)
- return fBadInstruction;
+ return fBadInstruction;
if (code)
- return fBadFontData;
+ return fBadFontData;
if (code1)
- return code1;
+ return code1;
return code;
}
static void ttfFont__StartGlyph(ttfFont *this)
{ Context_Load( this->exec, this->inst );
if ( this->inst->GS.instruct_control & 2 )
- this->exec->GS = Default_GraphicsState;
+ this->exec->GS = Default_GraphicsState;
else
- this->exec->GS = this->inst->GS;
+ this->exec->GS = this->inst->GS;
this->tti->usage_top = 0;
}
@@ -401,9 +401,9 @@ static void Init_Glyph_Component( PSubglyph_Record element,
element->is_hinted = FALSE;
if (original)
- mount_zone( &original->zone, &element->zone );
+ mount_zone( &original->zone, &element->zone );
else
- element->zone = exec->pts;
+ element->zone = exec->pts;
element->zone.n_contours = 0;
element->zone.n_points = 0;
@@ -431,10 +431,10 @@ static void cur_to_org( Int n, PGlyph_Zone zone )
Int k;
for ( k = 0; k < n; k++ )
- zone->org_x[k] = zone->cur_x[k];
+ zone->org_x[k] = zone->cur_x[k];
for ( k = 0; k < n; k++ )
- zone->org_y[k] = zone->cur_y[k];
+ zone->org_y[k] = zone->cur_y[k];
}
static void org_to_cur( Int n, PGlyph_Zone zone )
@@ -442,19 +442,18 @@ static void org_to_cur( Int n, PGlyph_Zone zone )
Int k;
for ( k = 0; k < n; k++ )
- zone->cur_x[k] = zone->org_x[k];
+ zone->cur_x[k] = zone->org_x[k];
for ( k = 0; k < n; k++ )
- zone->cur_y[k] = zone->org_y[k];
+ zone->cur_y[k] = zone->org_y[k];
}
-
/*-------------------------------------------------------------------*/
-void ttfOutliner__init(ttfOutliner *this, ttfFont *f, ttfReader *r, ttfExport *exp,
- bool bOutline, bool bFirst, bool bVertical)
+void ttfOutliner__init(ttfOutliner *this, ttfFont *f, ttfReader *r, ttfExport *exp,
+ bool bOutline, bool bFirst, bool bVertical)
{
- this->r = r;
+ this->r = r;
this->bOutline = bOutline;
this->bFirst = bFirst;
this->pFont = f;
@@ -468,19 +467,19 @@ static void MoveGlyphOutline(TGlyph_Zone *pts, int nOffset, ttfGlyphOutline *out
short count = out->pointCount;
F26Dot6Point p;
- if (m->a == 65536 && m->b == 0 &&
- m->c == 0 && m->d == 65536 &&
- m->tx == 0 && m->ty == 0)
- return;
+ if (m->a == 65536 && m->b == 0 &&
+ m->c == 0 && m->d == 65536 &&
+ m->tx == 0 && m->ty == 0)
+ return;
for (; count != 0; --count) {
- TransformF26Dot6PointFix(&p, *x, *y, m);
- *x++ = p.x;
- *y++ = p.y;
+ TransformF26Dot6PointFix(&p, *x, *y, m);
+ *x++ = p.x;
+ *y++ = p.y;
}
}
-static FontError ttfOutliner__BuildGlyphOutlineAux(ttfOutliner *this, int glyphIndex,
- FixMatrix *m_orig, ttfGlyphOutline* gOutline)
+static FontError ttfOutliner__BuildGlyphOutlineAux(ttfOutliner *this, int glyphIndex,
+ FixMatrix *m_orig, ttfGlyphOutline* gOutline)
{ ttfFont *pFont = this->pFont;
ttfReader *r = this->r;
ttfInterpreter *tti = pFont->tti;
@@ -500,27 +499,26 @@ static FontError ttfOutliner__BuildGlyphOutlineAux(ttfOutliner *this, int glyphI
int glyph_size;
if (r->get_metrics(r, glyphIndex, this->bVertical, &sideBearing, &nAdvance) < 0) {
- /* fixme: the error code is missing due to interface restrictions. */
- goto errex;
+ /* fixme: the error code is missing due to interface restrictions. */
+ goto errex;
}
gOutline->sideBearing = shortToF26Dot6(sideBearing);
gOutline->advance.x = shortToF26Dot6(nAdvance);
gOutline->advance.y = 0;
this->bFirst = FALSE;
-
if (!this->bOutline)
- return fNoError;
+ return fNoError;
if (!r->LoadGlyph(r, glyphIndex, &glyph, &glyph_size))
- return fGlyphNotFound;
+ return fGlyphNotFound;
if (r->Eof(r)) {
- r->ReleaseGlyph(r, glyphIndex);
- gOutline->xMinB = gOutline->yMinB = 0;
- gOutline->xMaxB = gOutline->yMaxB = 0;
- return fNoError;
+ r->ReleaseGlyph(r, glyphIndex);
+ gOutline->xMinB = gOutline->yMinB = 0;
+ gOutline->xMaxB = gOutline->yMaxB = 0;
+ return fNoError;
}
if (r->Error(r))
- goto errex;
+ goto errex;
nPosBeg = r->Tell(r);
gOutline->contourCount = ttfReader__Short(r);
@@ -545,287 +543,287 @@ static FontError ttfOutliner__BuildGlyphOutlineAux(ttfOutliner *this, int glyphI
/* FreeType stuff end */
if (gOutline->contourCount == 0)
- gOutline->pointCount = 0;
+ gOutline->pointCount = 0;
else if (gOutline->contourCount == -1) {
- unsigned short flags, index, bHaveInstructions = 0;
- unsigned int nUsage = 0;
- unsigned int nPos;
- unsigned int n_ins;
-
- gOutline->bCompound = TRUE;
- if (tti->usage_top + pFont->nMaxComponents > tti->usage_size)
- return fBadFontData;
- gOutline->contourCount = gOutline->pointCount = 0;
- do {
- FixMatrix m;
- ttfSubGlyphUsage *e;
-
- if (nUsage >= pFont->nMaxComponents) {
- error = fMemoryError; goto ex;
- }
- flags = ttfReader__UShort(r);
- index = ttfReader__UShort(r);
- bHaveInstructions |= (flags & WE_HAVE_INSTRUCTIONS);
- if (flags & ARG_1_AND_2_ARE_WORDS) {
- arg1 = ttfReader__Short(r);
- arg2 = ttfReader__Short(r);
+ unsigned short flags, index, bHaveInstructions = 0;
+ unsigned int nUsage = 0;
+ unsigned int nPos;
+ unsigned int n_ins;
+
+ gOutline->bCompound = TRUE;
+ if (tti->usage_top + pFont->nMaxComponents > tti->usage_size)
+ return fBadFontData;
+ gOutline->contourCount = gOutline->pointCount = 0;
+ do {
+ FixMatrix m;
+ ttfSubGlyphUsage *e;
+
+ if (nUsage >= pFont->nMaxComponents) {
+ error = fMemoryError; goto ex;
+ }
+ flags = ttfReader__UShort(r);
+ index = ttfReader__UShort(r);
+ bHaveInstructions |= (flags & WE_HAVE_INSTRUCTIONS);
+ if (flags & ARG_1_AND_2_ARE_WORDS) {
+ arg1 = ttfReader__Short(r);
+ arg2 = ttfReader__Short(r);
} else {
- if (flags & ARGS_ARE_XY_VALUES) {
- /* offsets are signed */
- arg1 = ttfReader__SignedByte(r);
- arg2 = ttfReader__SignedByte(r);
+ if (flags & ARGS_ARE_XY_VALUES) {
+ /* offsets are signed */
+ arg1 = ttfReader__SignedByte(r);
+ arg2 = ttfReader__SignedByte(r);
} else { /* anchor points are unsigned */
- arg1 = ttfReader__Byte(r);
- arg2 = ttfReader__Byte(r);
+ arg1 = ttfReader__Byte(r);
+ arg2 = ttfReader__Byte(r);
}
}
- m.b = m.c = m.tx = m.ty = 0;
- if (flags & WE_HAVE_A_SCALE)
- m.a = m.d = (TT_Fixed)ttfReader__Short(r) << 2;
- else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
- m.a = (TT_Fixed)ttfReader__Short(r) << 2;
- m.d = (TT_Fixed)ttfReader__Short(r) << 2;
- } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
- m.a = (TT_Fixed)ttfReader__Short(r)<<2;
- m.b = (TT_Fixed)ttfReader__Short(r)<<2;
- m.c = (TT_Fixed)ttfReader__Short(r)<<2;
- m.d = (TT_Fixed)ttfReader__Short(r)<<2;
- } else
- m.a = m.d = 65536;
- e = &usage[nUsage];
- e->m = m;
- e->index = index;
- e->arg1 = arg1;
- e->arg2 = arg2;
- e->flags = flags;
- nUsage++;
+ m.b = m.c = m.tx = m.ty = 0;
+ if (flags & WE_HAVE_A_SCALE)
+ m.a = m.d = (TT_Fixed)ttfReader__Short(r) << 2;
+ else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
+ m.a = (TT_Fixed)ttfReader__Short(r) << 2;
+ m.d = (TT_Fixed)ttfReader__Short(r) << 2;
+ } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
+ m.a = (TT_Fixed)ttfReader__Short(r)<<2;
+ m.b = (TT_Fixed)ttfReader__Short(r)<<2;
+ m.c = (TT_Fixed)ttfReader__Short(r)<<2;
+ m.d = (TT_Fixed)ttfReader__Short(r)<<2;
+ } else
+ m.a = m.d = 65536;
+ e = &usage[nUsage];
+ e->m = m;
+ e->index = index;
+ e->arg1 = arg1;
+ e->arg2 = arg2;
+ e->flags = flags;
+ nUsage++;
} while (flags & MORE_COMPONENTS);
- /* Some fonts have bad WE_HAVE_INSTRUCTIONS, so use nNextGlyphPtr : */
- if (r->Error(r))
- goto errex;
- nPos = r->Tell(r);
- n_ins = ((!r->Eof(r) && (bHaveInstructions || nPos < nNextGlyphPtr)) ? ttfReader__UShort(r) : 0);
- nPos = r->Tell(r);
- r->ReleaseGlyph(r, glyphIndex);
- glyph = NULL;
- for (i = 0; i < nUsage; i++) {
- ttfGlyphOutline out;
- ttfSubGlyphUsage *e = &usage[i];
- int j;
- TT_Error code;
- int nPointsStored = gOutline->pointCount, nContoursStored = gOutline->contourCount;
-
- out.contourCount = 0;
- out.pointCount = 0;
- out.bCompound = FALSE;
- pts->org_x += nPointsStored;
- pts->org_y += nPointsStored;
- pts->cur_x += nPointsStored;
- pts->cur_y += nPointsStored;
- pts->touch += nPointsStored;
- pts->contours += nContoursStored;
- tti->usage_top += nUsage;
- code = ttfOutliner__BuildGlyphOutlineAux(this, e->index, m_orig, &out);
- pts->org_x -= nPointsStored;
- pts->org_y -= nPointsStored;
- pts->cur_x -= nPointsStored;
- pts->cur_y -= nPointsStored;
- pts->touch -= nPointsStored;
- tti->usage_top -= nUsage;
- pts->contours -= nContoursStored;
- if (code == fPatented)
- error = code;
- else if (code != fNoError) {
- error = code;
- goto ex;
- }
- if (flags & ARGS_ARE_XY_VALUES) {
- e->m.tx = Scale_X( &exec->metrics, e->arg1 ) << 10;
- e->m.ty = Scale_Y( &exec->metrics, e->arg2 ) << 10;
+ /* Some fonts have bad WE_HAVE_INSTRUCTIONS, so use nNextGlyphPtr : */
+ if (r->Error(r))
+ goto errex;
+ nPos = r->Tell(r);
+ n_ins = ((!r->Eof(r) && (bHaveInstructions || nPos < nNextGlyphPtr)) ? ttfReader__UShort(r) : 0);
+ nPos = r->Tell(r);
+ r->ReleaseGlyph(r, glyphIndex);
+ glyph = NULL;
+ for (i = 0; i < nUsage; i++) {
+ ttfGlyphOutline out;
+ ttfSubGlyphUsage *e = &usage[i];
+ int j;
+ TT_Error code;
+ int nPointsStored = gOutline->pointCount, nContoursStored = gOutline->contourCount;
+
+ out.contourCount = 0;
+ out.pointCount = 0;
+ out.bCompound = FALSE;
+ pts->org_x += nPointsStored;
+ pts->org_y += nPointsStored;
+ pts->cur_x += nPointsStored;
+ pts->cur_y += nPointsStored;
+ pts->touch += nPointsStored;
+ pts->contours += nContoursStored;
+ tti->usage_top += nUsage;
+ code = ttfOutliner__BuildGlyphOutlineAux(this, e->index, m_orig, &out);
+ pts->org_x -= nPointsStored;
+ pts->org_y -= nPointsStored;
+ pts->cur_x -= nPointsStored;
+ pts->cur_y -= nPointsStored;
+ pts->touch -= nPointsStored;
+ tti->usage_top -= nUsage;
+ pts->contours -= nContoursStored;
+ if (code == fPatented)
+ error = code;
+ else if (code != fNoError) {
+ error = code;
+ goto ex;
+ }
+ if (flags & ARGS_ARE_XY_VALUES) {
+ e->m.tx = Scale_X( &exec->metrics, e->arg1 ) << 10;
+ e->m.ty = Scale_Y( &exec->metrics, e->arg2 ) << 10;
} else {
- e->m.tx = (pts->org_x[e->arg1] - pts->org_x[gOutline->pointCount + e->arg2]) << 10;
- e->m.ty = (pts->org_y[e->arg1] - pts->org_y[gOutline->pointCount + e->arg2]) << 10;
+ e->m.tx = (pts->org_x[e->arg1] - pts->org_x[gOutline->pointCount + e->arg2]) << 10;
+ e->m.ty = (pts->org_y[e->arg1] - pts->org_y[gOutline->pointCount + e->arg2]) << 10;
}
- MoveGlyphOutline(pts, nPointsStored, &out, &e->m);
- for (j = nContoursStored; j < out.contourCount + nContoursStored; j++)
- pts->contours[j] += nPointsStored;
- gOutline->contourCount += out.contourCount;
- gOutline->pointCount += out.pointCount;
- if(e->flags & USE_MY_METRICS) {
- gOutline->advance.x = out.advance.x;
- gOutline->sideBearing = out.sideBearing;
+ MoveGlyphOutline(pts, nPointsStored, &out, &e->m);
+ for (j = nContoursStored; j < out.contourCount + nContoursStored; j++)
+ pts->contours[j] += nPointsStored;
+ gOutline->contourCount += out.contourCount;
+ gOutline->pointCount += out.pointCount;
+ if(e->flags & USE_MY_METRICS) {
+ gOutline->advance.x = out.advance.x;
+ gOutline->sideBearing = out.sideBearing;
}
}
- if (!skip_instructions && n_ins &&
- !(pFont->inst->GS.instruct_control & 1)) {
- TT_Error code;
-
- r->LoadGlyph(r, glyphIndex, &glyph, &glyph_size);
- if (r->Error(r))
- goto errex;
- if (nPos + n_ins > glyph_size)
- goto errex;
- code = Set_CodeRange(exec, TT_CodeRange_Glyph, (byte *)glyph + nPos, n_ins);
- if (!code) {
- int nPoints = gOutline->pointCount + 2;
- int k;
- F26Dot6 x;
-
- exec->pts = subglyph.zone;
- pts->n_points = nPoints;
- pts->n_contours = gOutline->contourCount;
- /* add phantom points : */
- pts->org_x[nPoints - 2] = Scale_X(&exec->metrics, subglyph.pp1.x);
- pts->org_y[nPoints - 2] = Scale_Y(&exec->metrics, subglyph.pp1.y);
- pts->org_x[nPoints - 1] = Scale_X(&exec->metrics, subglyph.pp2.x);
- pts->org_y[nPoints - 1] = Scale_Y(&exec->metrics, subglyph.pp2.y);
- pts->touch[nPoints - 1] = 0;
- pts->touch[nPoints - 2] = 0;
- /* if hinting, round the phantom points (not sure) : */
- x = pts->org_x[nPoints - 2];
- x = ((x + 32) & -64) - x;
- if (x)
- for (k = 0; k < nPoints; k++)
- pts->org_x[k] += x;
- pts->cur_x[nPoints - 1] = (pts->cur_x[nPoints - 1] + 32) & -64;
- for (k = 0; k < nPoints; k++)
- pts->touch[k] = pts->touch[k] & TT_Flag_On_Curve;
- org_to_cur(nPoints, pts);
- exec->is_composite = TRUE;
- if (pFont->patented)
- code = TT_Err_Invalid_Engine;
- else
- code = Context_Run(exec, FALSE);
- if (!code)
- cur_to_org(nPoints, pts);
- else if (code == TT_Err_Invalid_Engine)
- error = fPatented;
- else
- error = fBadFontData;
+ if (!skip_instructions && n_ins &&
+ !(pFont->inst->GS.instruct_control & 1)) {
+ TT_Error code;
+
+ r->LoadGlyph(r, glyphIndex, &glyph, &glyph_size);
+ if (r->Error(r))
+ goto errex;
+ if (nPos + n_ins > glyph_size)
+ goto errex;
+ code = Set_CodeRange(exec, TT_CodeRange_Glyph, (byte *)glyph + nPos, n_ins);
+ if (!code) {
+ int nPoints = gOutline->pointCount + 2;
+ int k;
+ F26Dot6 x;
+
+ exec->pts = subglyph.zone;
+ pts->n_points = nPoints;
+ pts->n_contours = gOutline->contourCount;
+ /* add phantom points : */
+ pts->org_x[nPoints - 2] = Scale_X(&exec->metrics, subglyph.pp1.x);
+ pts->org_y[nPoints - 2] = Scale_Y(&exec->metrics, subglyph.pp1.y);
+ pts->org_x[nPoints - 1] = Scale_X(&exec->metrics, subglyph.pp2.x);
+ pts->org_y[nPoints - 1] = Scale_Y(&exec->metrics, subglyph.pp2.y);
+ pts->touch[nPoints - 1] = 0;
+ pts->touch[nPoints - 2] = 0;
+ /* if hinting, round the phantom points (not sure) : */
+ x = pts->org_x[nPoints - 2];
+ x = ((x + 32) & -64) - x;
+ if (x)
+ for (k = 0; k < nPoints; k++)
+ pts->org_x[k] += x;
+ pts->cur_x[nPoints - 1] = (pts->cur_x[nPoints - 1] + 32) & -64;
+ for (k = 0; k < nPoints; k++)
+ pts->touch[k] = pts->touch[k] & TT_Flag_On_Curve;
+ org_to_cur(nPoints, pts);
+ exec->is_composite = TRUE;
+ if (pFont->patented)
+ code = TT_Err_Invalid_Engine;
+ else
+ code = Context_Run(exec, FALSE);
+ if (!code)
+ cur_to_org(nPoints, pts);
+ else if (code == TT_Err_Invalid_Engine)
+ error = fPatented;
+ else
+ error = fBadFontData;
}
- Unset_CodeRange(exec);
- Clear_CodeRange(exec, TT_CodeRange_Glyph);
+ Unset_CodeRange(exec);
+ Clear_CodeRange(exec, TT_CodeRange_Glyph);
}
} else if (gOutline->contourCount > 0) {
- uint16 i;
- int nPoints;
- bool bInsOK;
- byte *onCurve, *stop, flag;
- short *endPoints;
- unsigned int nPos;
- unsigned int n_ins;
-
- if (this->nContoursTotal + gOutline->contourCount > exec->n_contours) {
- error = fBadFontData; goto ex;
- }
- endPoints = pts->contours;
- for (i = 0; i < gOutline->contourCount; i++)
- endPoints[i] = ttfReader__Short(r);
- for (i = 1; i < gOutline->contourCount; i++)
- if (endPoints[i - 1] >= endPoints[i]) {
- error = fBadFontData; goto ex;
- }
- nPoints = gOutline->pointCount = endPoints[gOutline->contourCount - 1] + 1;
- if (this->nPointsTotal + nPoints + 2 > exec->n_points) {
- error = fBadFontData; goto ex;
- }
- n_ins = ttfReader__Short(r);
- nPos = r->Tell(r);
- r->Seek(r, nPos + n_ins);
- if (r->Error(r))
- goto errex;
- bInsOK = !Set_CodeRange(exec, TT_CodeRange_Glyph, (byte *)glyph + nPos, n_ins);
- onCurve = pts->touch;
- stop = onCurve + gOutline->pointCount;
-
- while (onCurve < stop) {
- *onCurve++ = flag = ttfReader__Byte(r);
- if (flag & REPEAT_FLAGS) {
- count = ttfReader__Byte(r);
- for (--count; count >= 0; --count)
- *onCurve++ = flag;
+ uint16 i;
+ int nPoints;
+ bool bInsOK;
+ byte *onCurve, *stop, flag;
+ short *endPoints;
+ unsigned int nPos;
+ unsigned int n_ins;
+
+ if (this->nContoursTotal + gOutline->contourCount > exec->n_contours) {
+ error = fBadFontData; goto ex;
+ }
+ endPoints = pts->contours;
+ for (i = 0; i < gOutline->contourCount; i++)
+ endPoints[i] = ttfReader__Short(r);
+ for (i = 1; i < gOutline->contourCount; i++)
+ if (endPoints[i - 1] >= endPoints[i]) {
+ error = fBadFontData; goto ex;
+ }
+ nPoints = gOutline->pointCount = endPoints[gOutline->contourCount - 1] + 1;
+ if (this->nPointsTotal + nPoints + 2 > exec->n_points) {
+ error = fBadFontData; goto ex;
+ }
+ n_ins = ttfReader__Short(r);
+ nPos = r->Tell(r);
+ r->Seek(r, nPos + n_ins);
+ if (r->Error(r))
+ goto errex;
+ bInsOK = !Set_CodeRange(exec, TT_CodeRange_Glyph, (byte *)glyph + nPos, n_ins);
+ onCurve = pts->touch;
+ stop = onCurve + gOutline->pointCount;
+
+ while (onCurve < stop) {
+ *onCurve++ = flag = ttfReader__Byte(r);
+ if (flag & REPEAT_FLAGS) {
+ count = ttfReader__Byte(r);
+ for (--count; count >= 0; --count)
+ *onCurve++ = flag;
+ }
+ }
+ /* Lets do X */
+ { short coord = (this->bVertical ? 0 : sideBearing - subglyph.bbox.xMin);
+ F26Dot6* x = pts->org_x;
+ onCurve = pts->touch;
+ while (onCurve < stop) {
+ if ((flag = *onCurve++) & XSHORT) {
+ if (flag & SHORT_X_IS_POS)
+ coord += ttfReader__Byte(r);
+ else
+ coord -= ttfReader__Byte(r);
+ } else if (!(flag & NEXT_X_IS_ZERO))
+ coord += ttfReader__Short(r);
+ *x++ = Scale_X(&exec->metrics, coord);
+ }
+ }
+ /* Lets do Y */
+ { short coord = 0;
+ F26Dot6* y = pts->org_y;
+ onCurve = pts->touch;
+ while (onCurve < stop) {
+ if((flag = *onCurve) & YSHORT)
+ if ( flag & SHORT_Y_IS_POS )
+ coord += ttfReader__Byte(r);
+ else
+ coord -= ttfReader__Byte(r);
+ else if(!(flag & NEXT_Y_IS_ZERO))
+ coord += ttfReader__Short(r);
+ *y++ = Scale_Y( &exec->metrics, coord );
+
+ /* Filter off the extra bits */
+ *onCurve++ = flag & ONCURVE;
}
}
- /* Lets do X */
- { short coord = (this->bVertical ? 0 : sideBearing - subglyph.bbox.xMin);
- F26Dot6* x = pts->org_x;
- onCurve = pts->touch;
- while (onCurve < stop) {
- if ((flag = *onCurve++) & XSHORT) {
- if (flag & SHORT_X_IS_POS)
- coord += ttfReader__Byte(r);
- else
- coord -= ttfReader__Byte(r);
- } else if (!(flag & NEXT_X_IS_ZERO))
- coord += ttfReader__Short(r);
- *x++ = Scale_X(&exec->metrics, coord);
- }
- }
- /* Lets do Y */
- { short coord = 0;
- F26Dot6* y = pts->org_y;
- onCurve = pts->touch;
- while (onCurve < stop) {
- if((flag = *onCurve) & YSHORT)
- if ( flag & SHORT_Y_IS_POS )
- coord += ttfReader__Byte(r);
- else
- coord -= ttfReader__Byte(r);
- else if(!(flag & NEXT_Y_IS_ZERO))
- coord += ttfReader__Short(r);
- *y++ = Scale_Y( &exec->metrics, coord );
-
- /* Filter off the extra bits */
- *onCurve++ = flag & ONCURVE;
- }
- }
MoveGlyphOutline(pts, 0, gOutline, m_orig);
- this->nContoursTotal += gOutline->contourCount;
- this->nPointsTotal += nPoints;
- if (!skip_instructions &&
- !r->Error(r) && n_ins && bInsOK && !(pFont->inst->GS.instruct_control & 1)) {
- TGlyph_Zone *pts = &exec->pts;
- int k;
- F26Dot6 x;
- TT_Error code;
-
- exec->is_composite = FALSE;
- /* add phantom points : */
- pts->org_x[nPoints ] = Scale_X(&exec->metrics, subglyph.pp1.x);
- pts->org_y[nPoints ] = Scale_Y(&exec->metrics, subglyph.pp1.y);
- pts->org_x[nPoints + 1] = Scale_X(&exec->metrics, subglyph.pp2.x);
- pts->org_y[nPoints + 1] = Scale_Y(&exec->metrics, subglyph.pp2.y);
- pts->touch[nPoints ] = 0;
- pts->touch[nPoints + 1] = 0;
- pts->n_points = nPoints + 2;
- pts->n_contours = gOutline->contourCount;
- /* if hinting, round the phantom points (not sure) : */
- x = pts->org_x[nPoints];
- x = ((x + 32) & -64) - x;
- if (x)
- for (k = 0; k < nPoints + 2; k++)
- pts->org_x[k] += x;
- org_to_cur(nPoints + 2, pts);
- exec->is_composite = FALSE;
- for (k = 0; k < nPoints + 2; k++)
- pts->touch[k] &= TT_Flag_On_Curve;
- if (pFont->patented)
- code = TT_Err_Invalid_Engine;
- else
- code = Context_Run(exec, FALSE );
- if (!code)
- cur_to_org(nPoints + 2, pts);
- else if (code == TT_Err_Invalid_Engine)
- error = fPatented;
- else
- error = fBadInstruction;
- gOutline->sideBearing = subglyph.bbox.xMin - subglyph.pp1.x;
- gOutline->advance.x = subglyph.pp2.x - subglyph.pp1.x;
+ this->nContoursTotal += gOutline->contourCount;
+ this->nPointsTotal += nPoints;
+ if (!skip_instructions &&
+ !r->Error(r) && n_ins && bInsOK && !(pFont->inst->GS.instruct_control & 1)) {
+ TGlyph_Zone *pts = &exec->pts;
+ int k;
+ F26Dot6 x;
+ TT_Error code;
+
+ exec->is_composite = FALSE;
+ /* add phantom points : */
+ pts->org_x[nPoints ] = Scale_X(&exec->metrics, subglyph.pp1.x);
+ pts->org_y[nPoints ] = Scale_Y(&exec->metrics, subglyph.pp1.y);
+ pts->org_x[nPoints + 1] = Scale_X(&exec->metrics, subglyph.pp2.x);
+ pts->org_y[nPoints + 1] = Scale_Y(&exec->metrics, subglyph.pp2.y);
+ pts->touch[nPoints ] = 0;
+ pts->touch[nPoints + 1] = 0;
+ pts->n_points = nPoints + 2;
+ pts->n_contours = gOutline->contourCount;
+ /* if hinting, round the phantom points (not sure) : */
+ x = pts->org_x[nPoints];
+ x = ((x + 32) & -64) - x;
+ if (x)
+ for (k = 0; k < nPoints + 2; k++)
+ pts->org_x[k] += x;
+ org_to_cur(nPoints + 2, pts);
+ exec->is_composite = FALSE;
+ for (k = 0; k < nPoints + 2; k++)
+ pts->touch[k] &= TT_Flag_On_Curve;
+ if (pFont->patented)
+ code = TT_Err_Invalid_Engine;
+ else
+ code = Context_Run(exec, FALSE );
+ if (!code)
+ cur_to_org(nPoints + 2, pts);
+ else if (code == TT_Err_Invalid_Engine)
+ error = fPatented;
+ else
+ error = fBadInstruction;
+ gOutline->sideBearing = subglyph.bbox.xMin - subglyph.pp1.x;
+ gOutline->advance.x = subglyph.pp2.x - subglyph.pp1.x;
}
Unset_CodeRange(exec);
Clear_CodeRange(exec, TT_CodeRange_Glyph);
} else
- error = fBadFontData;
+ error = fBadFontData;
goto ex;
errex:;
error = fBadFontData;
@@ -834,8 +832,8 @@ ex:;
return error;
}
-static FontError ttfOutliner__BuildGlyphOutline(ttfOutliner *this, int glyphIndex,
- float orig_x, float orig_y, ttfGlyphOutline* gOutline)
+static FontError ttfOutliner__BuildGlyphOutline(ttfOutliner *this, int glyphIndex,
+ float orig_x, float orig_y, ttfGlyphOutline* gOutline)
{
FixMatrix m_orig = {1 << 16, 0, 0, 1 << 16, 0, 0};
@@ -845,7 +843,6 @@ static FontError ttfOutliner__BuildGlyphOutline(ttfOutliner *this, int glyphInde
return ttfOutliner__BuildGlyphOutlineAux(this, glyphIndex, &m_orig, gOutline);
}
-
#define AVECTOR_BUG 1 /* Work around a bug in AVector fonts. */
void ttfOutliner__DrawGlyphOutline(ttfOutliner *this)
@@ -875,122 +872,122 @@ void ttfOutliner__DrawGlyphOutline(ttfOutliner *this)
exp->SetWidth(exp, &p1);
sp = -1;
for (ctr = out->contourCount; ctr != 0; --ctr) {
- short pt, pts = *endP - sp;
- short ep = pts - 1;
-
- if (pts < 3) {
- x += pts;
- y += pts;
- onCurve += pts;
- sp = *endP++;
- continue; /* skip 1 and 2 point contours */
+ short pt, pts = *endP - sp;
+ short ep = pts - 1;
+
+ if (pts < 3) {
+ x += pts;
+ y += pts;
+ onCurve += pts;
+ sp = *endP++;
+ continue; /* skip 1 and 2 point contours */
}
- if (exp->bPoints) {
- for (pt = 0; pt <= ep; pt++) {
- px = x[pt], py = y[pt];
+ if (exp->bPoints) {
+ for (pt = 0; pt <= ep; pt++) {
+ px = x[pt], py = y[pt];
# if AVECTOR_BUG
- if (x[pt] < xMin || xMax < x[pt] || y[pt] < yMin || yMax < y[pt]) {
- short prevIndex = pt == 0 ? ep : pt - 1;
- short nextIndex = pt == ep ? 0 : pt + 1;
- if (nextIndex > ep)
- nextIndex = 0;
- px=AVE(x[prevIndex], x[nextIndex]);
- py=AVE(y[prevIndex], y[nextIndex]);
- }
+ if (x[pt] < xMin || xMax < x[pt] || y[pt] < yMin || yMax < y[pt]) {
+ short prevIndex = pt == 0 ? ep : pt - 1;
+ short nextIndex = pt == ep ? 0 : pt + 1;
+ if (nextIndex > ep)
+ nextIndex = 0;
+ px=AVE(x[prevIndex], x[nextIndex]);
+ py=AVE(y[prevIndex], y[nextIndex]);
+ }
# endif
- TransformF26Dot6PointFloat(&p0, px, py, m);
- exp->Point(exp, &p0, onCurve[pt], !pt);
+ TransformF26Dot6PointFloat(&p0, px, py, m);
+ exp->Point(exp, &p0, onCurve[pt], !pt);
}
}
- if (exp->bOutline) {
- pt = 0;
- if(onCurve[ep] & 1) {
- px = x[ep];
- py = y[ep];
+ if (exp->bOutline) {
+ pt = 0;
+ if(onCurve[ep] & 1) {
+ px = x[ep];
+ py = y[ep];
} else if (onCurve[0] & 1) {
- px = x[0];
- py = y[0];
- pt = 1;
+ px = x[0];
+ py = y[0];
+ pt = 1;
} else {
- px = AVE(x[0], x[ep]);
- py = AVE(y[0], y[ep]);
+ px = AVE(x[0], x[ep]);
+ py = AVE(y[0], y[ep]);
}
- this->ppx = px; this->ppy = py;
- TransformF26Dot6PointFloat(&p0, px, py, m);
- exp->MoveTo(exp, &p0);
-
- for (; pt <= ep; pt++) {
- short prevIndex = pt == 0 ? ep : pt - 1;
- short nextIndex = pt == ep ? 0 : pt + 1;
- if (onCurve[pt] & 1) {
- if (onCurve[prevIndex] & 1) {
- px = x[pt];
- py = y[pt];
- if (this->ppx != px || this->ppy != py) {
- TransformF26Dot6PointFloat(&p1, px, py, m);
- exp->LineTo(exp, &p1);
- this->ppx = px; this->ppy = py;
- p0 = p1;
+ this->ppx = px; this->ppy = py;
+ TransformF26Dot6PointFloat(&p0, px, py, m);
+ exp->MoveTo(exp, &p0);
+
+ for (; pt <= ep; pt++) {
+ short prevIndex = pt == 0 ? ep : pt - 1;
+ short nextIndex = pt == ep ? 0 : pt + 1;
+ if (onCurve[pt] & 1) {
+ if (onCurve[prevIndex] & 1) {
+ px = x[pt];
+ py = y[pt];
+ if (this->ppx != px || this->ppy != py) {
+ TransformF26Dot6PointFloat(&p1, px, py, m);
+ exp->LineTo(exp, &p1);
+ this->ppx = px; this->ppy = py;
+ p0 = p1;
}
}
- } else {
- F26Dot6 prevX, prevY, nextX, nextY;
+ } else {
+ F26Dot6 prevX, prevY, nextX, nextY;
- px = x[pt];
- py = y[pt];
+ px = x[pt];
+ py = y[pt];
# if AVECTOR_BUG
- if(x[pt] < xMin || xMax < x[pt] || y[pt] < yMin || yMax < y[pt]) {
- px=AVE(x[prevIndex], x[nextIndex]);
- py=AVE(y[prevIndex], y[nextIndex]);
- }
+ if(x[pt] < xMin || xMax < x[pt] || y[pt] < yMin || yMax < y[pt]) {
+ px=AVE(x[prevIndex], x[nextIndex]);
+ py=AVE(y[prevIndex], y[nextIndex]);
+ }
# endif
- if (onCurve[prevIndex] & 1) {
- prevX = x[prevIndex];
- prevY = y[prevIndex];
+ if (onCurve[prevIndex] & 1) {
+ prevX = x[prevIndex];
+ prevY = y[prevIndex];
} else {
- prevX = AVE(x[prevIndex], px);
- prevY = AVE(y[prevIndex], py);
+ prevX = AVE(x[prevIndex], px);
+ prevY = AVE(y[prevIndex], py);
}
- if (onCurve[nextIndex] & 1) {
- nextX = x[nextIndex];
- nextY = y[nextIndex];
+ if (onCurve[nextIndex] & 1) {
+ nextX = x[nextIndex];
+ nextY = y[nextIndex];
} else {
- nextX = AVE(px, x[nextIndex]);
- nextY = AVE(py, y[nextIndex]);
+ nextX = AVE(px, x[nextIndex]);
+ nextY = AVE(py, y[nextIndex]);
}
- if (this->ppx != nextX || this->ppy != nextY) {
- double dx1, dy1, dx2, dy2, dx3, dy3;
- const double prec = 1e-6;
-
- TransformF26Dot6PointFloat(&p1, (prevX + (px << 1)) / 3, (prevY + (py << 1)) / 3, m);
- TransformF26Dot6PointFloat(&p2, (nextX + (px << 1)) / 3, (nextY + (py << 1)) / 3, m);
- TransformF26Dot6PointFloat(&p3, nextX, nextY, m);
- dx1 = p1.x - p0.x, dy1 = p1.y - p0.y;
- dx2 = p2.x - p0.x, dy2 = p2.y - p0.y;
- dx3 = p3.x - p0.x, dy3 = p3.y - p0.y;
- if (fabs(dx1 * dy3 - dy1 * dx3) > prec * fabs(dx1 * dx3 - dy1 * dy3) ||
- fabs(dx2 * dy3 - dy2 * dx3) > prec * fabs(dx2 * dx3 - dy2 * dy3))
- exp->CurveTo(exp, &p1, &p2, &p3);
- else
- exp->LineTo(exp, &p3);
- this->ppx = nextX; this->ppy = nextY;
- p0 = p3;
+ if (this->ppx != nextX || this->ppy != nextY) {
+ double dx1, dy1, dx2, dy2, dx3, dy3;
+ const double prec = 1e-6;
+
+ TransformF26Dot6PointFloat(&p1, (prevX + (px << 1)) / 3, (prevY + (py << 1)) / 3, m);
+ TransformF26Dot6PointFloat(&p2, (nextX + (px << 1)) / 3, (nextY + (py << 1)) / 3, m);
+ TransformF26Dot6PointFloat(&p3, nextX, nextY, m);
+ dx1 = p1.x - p0.x, dy1 = p1.y - p0.y;
+ dx2 = p2.x - p0.x, dy2 = p2.y - p0.y;
+ dx3 = p3.x - p0.x, dy3 = p3.y - p0.y;
+ if (fabs(dx1 * dy3 - dy1 * dx3) > prec * fabs(dx1 * dx3 - dy1 * dy3) ||
+ fabs(dx2 * dy3 - dy2 * dx3) > prec * fabs(dx2 * dx3 - dy2 * dy3))
+ exp->CurveTo(exp, &p1, &p2, &p3);
+ else
+ exp->LineTo(exp, &p3);
+ this->ppx = nextX; this->ppy = nextY;
+ p0 = p3;
}
}
}
- exp->Close(exp);
+ exp->Close(exp);
}
- x += pts;
- y += pts;
- onCurve += pts;
- sp = *endP++;
+ x += pts;
+ y += pts;
+ onCurve += pts;
+ sp = *endP++;
}
}
FontError ttfOutliner__Outline(ttfOutliner *this, int glyphIndex,
- float orig_x, float orig_y, FloatMatrix *m1)
+ float orig_x, float orig_y, FloatMatrix *m1)
{ ttfFont *pFont = this->pFont;
FontError error;
@@ -1005,14 +1002,14 @@ FontError ttfOutliner__Outline(ttfOutliner *this, int glyphIndex,
error = ttfOutliner__BuildGlyphOutline(this, glyphIndex, orig_x, orig_y, &this->out);
ttfFont__StopGlyph(pFont);
if (pFont->nUnitsPerEm <= 0)
- pFont->nUnitsPerEm = 1024;
+ pFont->nUnitsPerEm = 1024;
if (pFont->design_grid) {
- this->post_transform.a /= pFont->nUnitsPerEm;
- this->post_transform.b /= pFont->nUnitsPerEm;
- this->post_transform.c /= pFont->nUnitsPerEm;
- this->post_transform.d /= pFont->nUnitsPerEm;
+ this->post_transform.a /= pFont->nUnitsPerEm;
+ this->post_transform.b /= pFont->nUnitsPerEm;
+ this->post_transform.c /= pFont->nUnitsPerEm;
+ this->post_transform.d /= pFont->nUnitsPerEm;
}
if (error != fNoError && error != fPatented)
- return error;
+ return error;
return error;
}
diff --git a/gs/base/ttfmemd.c b/gs/base/ttfmemd.c
index ef7bad747..a9fada6f1 100644
--- a/gs/base/ttfmemd.c
+++ b/gs/base/ttfmemd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,14 +21,14 @@
#include "ttfmemd.h"
#include "gsstruct.h"
-gs_public_st_ptrs5(st_TFace, TFace, "TFace",
- st_TFace_enum_ptrs, st_TFace_reloc_ptrs,
+gs_public_st_ptrs5(st_TFace, TFace, "TFace",
+ st_TFace_enum_ptrs, st_TFace_reloc_ptrs,
r, font, fontProgram, cvtProgram, cvt);
gs_public_st_composite(st_TInstance, TInstance,
"TInstance", TInstance_enum_ptrs, TInstance_reloc_ptrs);
-static
+static
ENUM_PTRS_BEGIN(TInstance_enum_ptrs) return 0;
ENUM_PTR(0, TInstance, face);
ENUM_PTR(1, TInstance, FDefs);
@@ -55,7 +55,7 @@ RELOC_PTRS_END
gs_public_st_composite(st_TExecution_Context, TExecution_Context,
"TExecution_Context", TExecution_Context_enum_ptrs, TExecution_Context_reloc_ptrs);
-static
+static
ENUM_PTRS_BEGIN(TExecution_Context_enum_ptrs) return 0;
ENUM_PTR(0, TExecution_Context, current_face);
/* ENUM_PTR(1, TExecution_Context, code); // local, no gc invocations */
@@ -124,7 +124,7 @@ RELOC_PTRS_END
gs_public_st_composite(st_ttfFont, ttfFont,
"ttfFont", ttfFont_enum_ptrs, ttfFont_reloc_ptrs);
-static
+static
ENUM_PTRS_BEGIN(ttfFont_enum_ptrs) return 0;
ENUM_PTR(0, ttfFont, face);
ENUM_PTR(1, ttfFont, inst);
@@ -140,6 +140,6 @@ static RELOC_PTRS_WITH(ttfFont_reloc_ptrs, ttfFont *mptr)
DISCARD(mptr);
RELOC_PTRS_END
-gs_public_st_ptrs3(st_ttfInterpreter, ttfInterpreter, "ttfInterpreter",
- st_ttfInterpreter_enum_ptrs, st_ttfInterpreter_reloc_ptrs,
+gs_public_st_ptrs3(st_ttfInterpreter, ttfInterpreter, "ttfInterpreter",
+ st_ttfInterpreter_enum_ptrs, st_ttfInterpreter_reloc_ptrs,
exec, usage, ttf_memory);
diff --git a/gs/base/ttfmemd.h b/gs/base/ttfmemd.h
index 208b87de0..262070ca3 100644
--- a/gs/base/ttfmemd.h
+++ b/gs/base/ttfmemd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/ttfoutl.h b/gs/base/ttfoutl.h
index 26abd944e..5ea478723 100644
--- a/gs/base/ttfoutl.h
+++ b/gs/base/ttfoutl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,14 +57,14 @@ typedef signed int F26Dot6;
#error "No appropriate type for Fixed 26.6 Floats"
#endif
-typedef struct {
+typedef struct {
F26Dot6 x;
F26Dot6 y;
} F26Dot6Point;
/* Define an abstract class for accessing memory managers from the TT interpreter. */
typedef struct ttfMemory_s ttfMemory;
-struct ttfMemory_s {
+struct ttfMemory_s {
void *(*alloc_bytes)(ttfMemory *, int size, const char *cname);
void *(*alloc_struct)(ttfMemory *, const ttfMemoryDescriptor *, const char *cname);
void (*free)(ttfMemory *, void *p, const char *cname);
@@ -106,8 +106,8 @@ struct ttfReader_s {
bool (*Error)(ttfReader *);
int (*LoadGlyph)(ttfReader *, int nIndex, const byte **, int *);
void (*ReleaseGlyph)(ttfReader *, int nIndex);
- int (*get_metrics)(const ttfReader *ttf, uint glyph_index, bool bVertical,
- short *sideBearing, unsigned short *nAdvance);
+ int (*get_metrics)(const ttfReader *ttf, uint glyph_index, bool bVertical,
+ short *sideBearing, unsigned short *nAdvance);
};
/* Define an auxiliary structure for ttfFont. */
@@ -115,7 +115,7 @@ typedef struct {
int nPos, nLen;
} ttfPtrElem;
-/* Define a capsule for a TT face.
+/* Define a capsule for a TT face.
Diue to historical reason the name is some misleading.
It should be ttfFace. */
#ifndef ttfFont_DEFINED
@@ -153,14 +153,14 @@ struct ttfFont_s {
const gs_memory_t *DebugMem;
};
-void ttfFont__init(ttfFont *this, ttfMemory *mem,
- void (*DebugRepaint)(ttfFont *),
- int (*DebugPrint)(ttfFont *, const char *s, ...),
+void ttfFont__init(ttfFont *this, ttfMemory *mem,
+ void (*DebugRepaint)(ttfFont *),
+ int (*DebugPrint)(ttfFont *, const char *s, ...),
const gs_memory_t *);
void ttfFont__finit(ttfFont *this);
-FontError ttfFont__Open(ttfInterpreter *, ttfFont *, ttfReader *r,
- unsigned int nTTC, float w, float h,
- bool design_grid);
+FontError ttfFont__Open(ttfInterpreter *, ttfFont *, ttfReader *r,
+ unsigned int nTTC, float w, float h,
+ bool design_grid);
/* Define an abstract class for exporting outlines from the TT interpreter. */
typedef struct ttfExport_s ttfExport;
@@ -179,7 +179,7 @@ int ttfInterpreter__obtain(ttfMemory *mem, ttfInterpreter **ptti);
void ttfInterpreter__release(ttfInterpreter **ptti);
/* Define an class for outline description. */
-typedef struct {
+typedef struct {
bool bCompound;
int contourCount;
uint pointCount;
@@ -203,10 +203,10 @@ typedef struct {
FloatMatrix post_transform;
} ttfOutliner;
-void ttfOutliner__init(ttfOutliner *, ttfFont *f, ttfReader *r, ttfExport *exp,
- bool bOutline, bool bFirst, bool bVertical);
+void ttfOutliner__init(ttfOutliner *, ttfFont *f, ttfReader *r, ttfExport *exp,
+ bool bOutline, bool bFirst, bool bVertical);
FontError ttfOutliner__Outline(ttfOutliner *this, int glyphIndex,
- float orig_x, float orig_y, FloatMatrix *m1);
+ float orig_x, float orig_y, FloatMatrix *m1);
void ttfOutliner__DrawGlyphOutline(ttfOutliner *this);
#endif
diff --git a/gs/base/ttfsfnt.h b/gs/base/ttfsfnt.h
index eeda7572e..c6d42fe6c 100644
--- a/gs/base/ttfsfnt.h
+++ b/gs/base/ttfsfnt.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,19 +14,19 @@
/* Changes after Apple: replaced non-portable types with ISO/IEC 988:1999 exact-size types */
/*
- File 'sfnt.h'
-
- Contains 'sfnt' resource structure description
-
- Copyright 1991 Apple Computer, Inc.
-
+ File 'sfnt.h'
+
+ Contains 'sfnt' resource structure description
+
+ Copyright 1991 Apple Computer, Inc.
+
*/
#ifndef sfntIncludes
#define sfntIncludes
#include "stdint_.h" /* make sure stdint types are available */
-
+
typedef uint8_t uint8; /* 8-bit unsigned integer */
typedef int8_t int8; /* 8-bit signed integer */
typedef uint16_t uint16; /* 16-bit unsigned integer */
@@ -42,15 +42,15 @@ typedef int32_t F26Dot6; /* 26.6 32-bit signed fixed-point number */
#endif
typedef struct {
- uint32 bc;
- uint32 ad;
+ uint32 bc;
+ uint32 ad;
} BigDate;
typedef struct {
- uint32 tag;
- uint32 checkSum;
- uint32 offset;
- uint32 length;
+ uint32 tag;
+ uint32 checkSum;
+ uint32 offset;
+ uint32 length;
} sfnt_DirectoryEntry;
#define SFNT_VERSION 0x10000
@@ -59,24 +59,24 @@ typedef struct {
* The search fields limits numOffsets to 4096.
*/
typedef struct {
- TT_Fixed version; /* 1.0 */
- uint16 numOffsets; /* number of tables */
- uint16 searchRange; /* (max2 <= numOffsets)*16 */
- uint16 entrySelector; /* log2(max2 <= numOffsets) */
- uint16 rangeShift; /* numOffsets*16-searchRange*/
- sfnt_DirectoryEntry table[1]; /* table[numOffsets] */
+ TT_Fixed version; /* 1.0 */
+ uint16 numOffsets; /* number of tables */
+ uint16 searchRange; /* (max2 <= numOffsets)*16 */
+ uint16 entrySelector; /* log2(max2 <= numOffsets) */
+ uint16 rangeShift; /* numOffsets*16-searchRange*/
+ sfnt_DirectoryEntry table[1]; /* table[numOffsets] */
} sfnt_OffsetTable;
#define OFFSETTABLESIZE 12 /* not including any entries */
typedef enum sfntHeaderFlagBits {
- Y_POS_SPECS_BASELINE = 1,
- X_POS_SPECS_LSB = 2,
- HINTS_USE_POINTSIZE = 4,
- USE_INTEGER_SCALING = 8,
- INSTRUCTIONS_CHANGE_ADVANCEWIDTHS = 16,
- X_POS_SPECS_BASELINE = 32,
- Y_POS_SPECS_TSB = 64
+ Y_POS_SPECS_BASELINE = 1,
+ X_POS_SPECS_LSB = 2,
+ HINTS_USE_POINTSIZE = 4,
+ USE_INTEGER_SCALING = 8,
+ INSTRUCTIONS_CHANGE_ADVANCEWIDTHS = 16,
+ X_POS_SPECS_BASELINE = 32,
+ Y_POS_SPECS_TSB = 64
} sfntHeaderFlagBits;
#define SFNT_MAGIC 0x5F0F3CF5
@@ -86,54 +86,54 @@ typedef enum sfntHeaderFlagBits {
#define FONT_HEADER_VERSION 0x10000
typedef struct {
- TT_Fixed version; /* for this table, set to 1.0 */
- TT_Fixed fontRevision; /* For Font Manufacturer */
- uint32 checkSumAdjustment;
- uint32 magicNumber; /* signature, should always be 0x5F0F3CF5 == MAGIC */
- uint16 flags;
- uint16 unitsPerEm; /* Specifies how many in Font Units we have per EM */
-
- BigDate created;
- BigDate modified;
-
- /** This is the font wide bounding box in ideal space
- (baselines and metrics are NOT worked into these numbers) **/
- int16 xMin;
- int16 yMin;
- int16 xMax;
- int16 yMax;
-
- uint16 macStyle; /* macintosh style word */
- uint16 lowestRecPPEM; /* lowest recommended pixels per Em */
-
- /* 0: fully mixed directional glyphs, 1: only strongly L->R or T->B glyphs,
- -1: only strongly R->L or B->T glyphs, 2: like 1 but also contains neutrals,
- -2: like -1 but also contains neutrals */
- int16 fontDirectionHint;
-
- int16 indexToLocFormat;
- int16 glyphDataFormat;
+ TT_Fixed version; /* for this table, set to 1.0 */
+ TT_Fixed fontRevision; /* For Font Manufacturer */
+ uint32 checkSumAdjustment;
+ uint32 magicNumber; /* signature, should always be 0x5F0F3CF5 == MAGIC */
+ uint16 flags;
+ uint16 unitsPerEm; /* Specifies how many in Font Units we have per EM */
+
+ BigDate created;
+ BigDate modified;
+
+ /** This is the font wide bounding box in ideal space
+ (baselines and metrics are NOT worked into these numbers) **/
+ int16 xMin;
+ int16 yMin;
+ int16 xMax;
+ int16 yMax;
+
+ uint16 macStyle; /* macintosh style word */
+ uint16 lowestRecPPEM; /* lowest recommended pixels per Em */
+
+ /* 0: fully mixed directional glyphs, 1: only strongly L->R or T->B glyphs,
+ -1: only strongly R->L or B->T glyphs, 2: like 1 but also contains neutrals,
+ -2: like -1 but also contains neutrals */
+ int16 fontDirectionHint;
+
+ int16 indexToLocFormat;
+ int16 glyphDataFormat;
} sfnt_FontHeader;
#define METRIC_HEADER_FORMAT 0x10000
typedef struct {
- TT_Fixed version; /* for this table, set to 1.0 */
- int16 ascender;
- int16 descender;
- int16 lineGap; /* linespacing = ascender - descender + linegap */
- uint16 advanceMax;
- int16 sideBearingMin; /* left or top */
- int16 otherSideBearingMin; /* right or bottom */
- int16 extentMax; /* Max of ( SB[i] + bounds[i] ), i loops through all glyphs */
- int16 caretSlopeNumerator;
- int16 caretSlopeDenominator;
- int16 caretOffset;
-
- uint32 reserved1, reserved2; /* set to 0 */
-
- int16 metricDataFormat; /* set to 0 for current format */
- uint16 numberLongMetrics; /* if format == 0 */
+ TT_Fixed version; /* for this table, set to 1.0 */
+ int16 ascender;
+ int16 descender;
+ int16 lineGap; /* linespacing = ascender - descender + linegap */
+ uint16 advanceMax;
+ int16 sideBearingMin; /* left or top */
+ int16 otherSideBearingMin; /* right or bottom */
+ int16 extentMax; /* Max of ( SB[i] + bounds[i] ), i loops through all glyphs */
+ int16 caretSlopeNumerator;
+ int16 caretSlopeDenominator;
+ int16 caretOffset;
+
+ uint32 reserved1, reserved2; /* set to 0 */
+
+ int16 metricDataFormat; /* set to 0 for current format */
+ uint16 numberLongMetrics; /* if format == 0 */
} sfnt_MetricsHeader;
typedef sfnt_MetricsHeader sfnt_HorizontalHeader;
@@ -142,27 +142,26 @@ typedef sfnt_MetricsHeader sfnt_VerticalHeader;
#define MAX_PROFILE_VERSION 0x10000
typedef struct {
- TT_Fixed version; /* for this table, set to 1.0 */
- uint16 numGlyphs;
- uint16 maxPoints; /* in an individual glyph */
- uint16 maxContours; /* in an individual glyph */
- uint16 maxCompositePoints; /* in an composite glyph */
- uint16 maxCompositeContours; /* in an composite glyph */
- uint16 maxElements; /* set to 2, or 1 if no twilightzone points */
- uint16 maxTwilightPoints; /* max points in element zero */
- uint16 maxStorage; /* max number of storage locations */
- uint16 maxFunctionDefs; /* max number of FDEFs in any preprogram */
- uint16 maxInstructionDefs; /* max number of IDEFs in any preprogram */
- uint16 maxStackElements; /* max number of stack elements for any individual glyph */
- uint16 maxSizeOfInstructions; /* max size in bytes for any individual glyph */
- uint16 maxComponentElements; /* number of glyphs referenced at top level */
- uint16 maxComponentDepth; /* levels of recursion, 1 for simple components */
+ TT_Fixed version; /* for this table, set to 1.0 */
+ uint16 numGlyphs;
+ uint16 maxPoints; /* in an individual glyph */
+ uint16 maxContours; /* in an individual glyph */
+ uint16 maxCompositePoints; /* in an composite glyph */
+ uint16 maxCompositeContours; /* in an composite glyph */
+ uint16 maxElements; /* set to 2, or 1 if no twilightzone points */
+ uint16 maxTwilightPoints; /* max points in element zero */
+ uint16 maxStorage; /* max number of storage locations */
+ uint16 maxFunctionDefs; /* max number of FDEFs in any preprogram */
+ uint16 maxInstructionDefs; /* max number of IDEFs in any preprogram */
+ uint16 maxStackElements; /* max number of stack elements for any individual glyph */
+ uint16 maxSizeOfInstructions; /* max size in bytes for any individual glyph */
+ uint16 maxComponentElements; /* number of glyphs referenced at top level */
+ uint16 maxComponentDepth; /* levels of recursion, 1 for simple components */
} sfnt_maxProfileTable;
-
typedef struct {
- uint16 advance;
- int16 sideBearing;
+ uint16 advance;
+ int16 sideBearing;
} sfnt_GlyphMetrics;
typedef sfnt_GlyphMetrics sfnt_HorizontalMetrics;
@@ -174,37 +173,37 @@ typedef int16 sfnt_ControlValue;
* Char2Index structures, including platform IDs
*/
typedef struct {
- uint16 format;
- uint16 length;
- uint16 version;
+ uint16 format;
+ uint16 length;
+ uint16 version;
} sfnt_mappingTable;
typedef struct {
- uint16 platformID;
- uint16 specificID;
- uint32 offset;
+ uint16 platformID;
+ uint16 specificID;
+ uint32 offset;
} sfnt_platformEntry;
typedef struct {
- uint16 version;
- uint16 numTables;
- sfnt_platformEntry platform[1]; /* platform[numTables] */
+ uint16 version;
+ uint16 numTables;
+ sfnt_platformEntry platform[1]; /* platform[numTables] */
} sfnt_char2IndexDirectory;
#define SIZEOFCHAR2INDEXDIR 4
typedef struct {
- uint16 platformID;
- uint16 specificID;
- uint16 languageID;
- uint16 nameID;
- uint16 length;
- uint16 offset;
+ uint16 platformID;
+ uint16 specificID;
+ uint16 languageID;
+ uint16 nameID;
+ uint16 length;
+ uint16 offset;
} sfnt_NameRecord;
typedef struct {
- uint16 format;
- uint16 count;
- uint16 stringOffset;
+ uint16 format;
+ uint16 count;
+ uint16 stringOffset;
/* sfnt_NameRecord[count] */
} sfnt_NamingTable;
@@ -214,10 +213,10 @@ typedef struct {
* First byte is ppem, second is maxWidth, rest are widths for each glyph
*/
typedef struct {
- int16 version;
- int16 numRecords;
- int32 recordSize;
- /* Byte widths[numGlyphs+DEVWIDTHEXTRA] * numRecords */
+ int16 version;
+ int16 numRecords;
+ int32 recordSize;
+ /* Byte widths[numGlyphs+DEVWIDTHEXTRA] * numRecords */
} sfnt_DeviceMetrics;
#define stdPostTableFormat 0x10000
@@ -226,82 +225,82 @@ typedef struct {
#define richardsPostTableFormat 0x30000
typedef struct {
- TT_Fixed version;
- TT_Fixed italicAngle;
- int16 underlinePosition;
- int16 underlineThickness;
- int16 isFixedPitch;
- int16 pad;
- uint32 minMemType42;
- uint32 maxMemType42;
- uint32 minMemType1;
- uint32 maxMemType1;
+ TT_Fixed version;
+ TT_Fixed italicAngle;
+ int16 underlinePosition;
+ int16 underlineThickness;
+ int16 isFixedPitch;
+ int16 pad;
+ uint32 minMemType42;
+ uint32 maxMemType42;
+ uint32 minMemType1;
+ uint32 maxMemType1;
/* if version == 2.0
- {
- numberGlyphs;
- unsigned short[numberGlyphs];
- pascalString[numberNewNames];
- }
- else if version == 2.5
- {
- numberGlyphs;
- int8[numberGlyphs];
- }
-*/
+ {
+ numberGlyphs;
+ unsigned short[numberGlyphs];
+ pascalString[numberNewNames];
+ }
+ else if version == 2.5
+ {
+ numberGlyphs;
+ int8[numberGlyphs];
+ }
+*/
} sfnt_PostScriptInfo;
typedef enum outlinePacking {
- ONCURVE = 1,
- XSHORT = 2,
- YSHORT = 4,
- REPEAT_FLAGS = 8,
+ ONCURVE = 1,
+ XSHORT = 2,
+ YSHORT = 4,
+ REPEAT_FLAGS = 8,
/* IF XSHORT */
- SHORT_X_IS_POS = 16, /* the short vector is positive */
+ SHORT_X_IS_POS = 16, /* the short vector is positive */
/* ELSE */
- NEXT_X_IS_ZERO = 16, /* the relative x coordinate is zero */
+ NEXT_X_IS_ZERO = 16, /* the relative x coordinate is zero */
/* ENDIF */
/* IF YSHORT */
- SHORT_Y_IS_POS = 32, /* the short vector is positive */
+ SHORT_Y_IS_POS = 32, /* the short vector is positive */
/* ELSE */
- NEXT_Y_IS_ZERO = 32 /* the relative y coordinate is zero */
+ NEXT_Y_IS_ZERO = 32 /* the relative y coordinate is zero */
/* ENDIF */
} outlinePacking;
typedef enum componentPacking {
- COMPONENTCTRCOUNT = -1,
- ARG_1_AND_2_ARE_WORDS = 1, /* if not, they are bytes */
- ARGS_ARE_XY_VALUES = 2, /* if not, they are points */
- ROUND_XY_TO_GRID = 4,
- WE_HAVE_A_SCALE = 8, /* if not, Sx = Sy = 1.0 */
- NON_OVERLAPPING = 16,
- MORE_COMPONENTS = 32, /* if not, this is the last one */
- WE_HAVE_AN_X_AND_Y_SCALE = 64, /* Sx != Sy */
- WE_HAVE_A_TWO_BY_TWO = 128, /* t00, t01, t10, t11 */
- WE_HAVE_INSTRUCTIONS = 256, /* short count followed by instructions follows */
- USE_MY_METRICS = 512 /* use my metrics for parent glyph */
+ COMPONENTCTRCOUNT = -1,
+ ARG_1_AND_2_ARE_WORDS = 1, /* if not, they are bytes */
+ ARGS_ARE_XY_VALUES = 2, /* if not, they are points */
+ ROUND_XY_TO_GRID = 4,
+ WE_HAVE_A_SCALE = 8, /* if not, Sx = Sy = 1.0 */
+ NON_OVERLAPPING = 16,
+ MORE_COMPONENTS = 32, /* if not, this is the last one */
+ WE_HAVE_AN_X_AND_Y_SCALE = 64, /* Sx != Sy */
+ WE_HAVE_A_TWO_BY_TWO = 128, /* t00, t01, t10, t11 */
+ WE_HAVE_INSTRUCTIONS = 256, /* short count followed by instructions follows */
+ USE_MY_METRICS = 512 /* use my metrics for parent glyph */
} componentPacking;
typedef struct {
- uint16 firstCode;
- uint16 entryCount;
- int16 idDelta;
- uint16 idRangeOffset;
+ uint16 firstCode;
+ uint16 entryCount;
+ int16 idDelta;
+ uint16 idRangeOffset;
} sfnt_subheader;
typedef struct {
- uint16 segCountX2;
- uint16 searchRange;
- uint16 entrySelector;
- uint16 rangeShift;
+ uint16 segCountX2;
+ uint16 searchRange;
+ uint16 entrySelector;
+ uint16 rangeShift;
} sfnt_4_subheader;
/* sfnt_enum.h */
typedef enum {
- plat_Unicode,
- plat_Macintosh,
- plat_ISO,
- plat_MS
+ plat_Unicode,
+ plat_Macintosh,
+ plat_ISO,
+ plat_MS
} platformEnums;
#define tag_FontHeader 'daeh' /* (*(LPDWORD)"head") */
@@ -336,9 +335,9 @@ typedef int32 FontError;
#endif
typedef struct FontTableInfo {
- int32 offset; /* from beginning of sfnt to beginning of the table */
- int32 length; /* length of the table */
- int32 checkSum; /* checkSum of the table */
+ int32 offset; /* from beginning of sfnt to beginning of the table */
+ int32 length; /* length of the table */
+ int32 checkSum; /* checkSum of the table */
} FontTableInfo;
#define RAW_TRUE_TYPE_SIZE 512
diff --git a/gs/base/ttinterp.c b/gs/base/ttinterp.c
index e83d4bf57..2a9588449 100644
--- a/gs/base/ttinterp.c
+++ b/gs/base/ttinterp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -68,7 +68,6 @@
#include "ttinterp.h"
#include "ttfinp.h"
-
#ifdef DEBUG
# define DBG_PAINT CUR.current_face->font->DebugRepaint(CUR.current_face->font);
@@ -146,7 +145,6 @@ static int nInstrCount=0;
/* */
/* - it's still open to later experimentation and tuning */
-
#ifndef TT_STATIC_INTERPRETER /* indirect implementation */
#define CUR (*exc) /* see ttobjs.h */
@@ -163,7 +161,6 @@ static int nInstrCount=0;
#endif
-
#define INS_ARG EXEC_OPS PStorage args /* see ttexec.h */
#define SKIP_Code() SkipCode( EXEC_ARG )
@@ -222,8 +219,6 @@ static int nInstrCount=0;
which could cause Apple's patent infringement. */
#define THROW_PATENTED longjmp(find_jmp_buf(CUR.trap), TT_Err_Invalid_Engine)
-
-
/*********************************************************************/
/* */
/* Before an opcode is executed, the interpreter verifies that */
@@ -524,7 +519,6 @@ static int nInstrCount=0;
/* MIRP[31] */ 2, 0
};
-
/*******************************************************************
*
* Function : Norm
@@ -541,7 +535,6 @@ static int nInstrCount=0;
{
Int64 T1, T2;
-
MUL_64( X, X, T1 );
MUL_64( Y, Y, T2 );
@@ -550,7 +543,6 @@ static int nInstrCount=0;
return (TT_F26Dot6)SQRT_64( T1 );
}
-
/*******************************************************************
*
* Function : FUnits_To_Pixels
@@ -570,7 +562,6 @@ static int nInstrCount=0;
CUR.metrics.scale2 );
}
-
/*******************************************************************
*
* Function : Current_Ratio
@@ -600,7 +591,6 @@ static int nInstrCount=0;
{
Long x, y;
-
x = MulDiv_Round( CUR.GS.projVector.x, CUR.metrics.x_ratio, 0x4000 );
y = MulDiv_Round( CUR.GS.projVector.y, CUR.metrics.y_ratio, 0x4000 );
CUR.metrics.ratio = Norm( x, y );
@@ -609,25 +599,21 @@ static int nInstrCount=0;
return CUR.metrics.ratio;
}
-
static Int Current_Ppem( EXEC_OP )
{
return MulDiv_Round( CUR.metrics.ppem, CURRENT_Ratio(), 0x10000 );
}
-
static TT_F26Dot6 Read_CVT( EXEC_OPS Int index )
{
return CUR.cvt[index];
}
-
static TT_F26Dot6 Read_CVT_Stretched( EXEC_OPS Int index )
{
return MulDiv_Round( CUR.cvt[index], CURRENT_Ratio(), 0x10000 );
}
-
static void Write_CVT( EXEC_OPS Int index, TT_F26Dot6 value )
{
int ov=CUR.cvt[index];
@@ -644,7 +630,6 @@ static int nInstrCount=0;
DBG_PRINT3(" cvt[%d]%d:=%d", index, ov, CUR.cvt[index]);
}
-
static void Move_CVT( EXEC_OPS Int index, TT_F26Dot6 value )
{
int ov=CUR.cvt[index];
@@ -661,7 +646,6 @@ static int nInstrCount=0;
DBG_PRINT3(" cvt[%d]%d:=%d", index, ov, CUR.cvt[index]);
}
-
/******************************************************************
*
* Function : Calc_Length
@@ -725,7 +709,6 @@ static int nInstrCount=0;
return SUCCESS;
}
-
/*******************************************************************
*
* Function : GetShortIns
@@ -749,7 +732,6 @@ static int nInstrCount=0;
CUR.code[CUR.IP-1];
}
-
/*******************************************************************
*
* Function : Ins_Goto_CodeRange
@@ -769,7 +751,6 @@ static int nInstrCount=0;
{
TCodeRange* WITH;
-
if ( aRange < 1 || aRange > 3 )
{
CUR.error = TT_Err_Bad_Argument;
@@ -802,7 +783,6 @@ static int nInstrCount=0;
return SUCCESS;
}
-
/*******************************************************************
*
* Function : Direct_Move
@@ -824,7 +804,6 @@ static int nInstrCount=0;
{
TT_F26Dot6 v;
-
v = CUR.GS.freeVector.x;
if ( v != 0 )
@@ -848,7 +827,6 @@ static int nInstrCount=0;
}
}
-
/******************************************************************/
/* */
/* The following versions are used whenever both vectors are both */
@@ -869,7 +847,6 @@ static int nInstrCount=0;
zone->touch[point] |= TT_Flag_Touched_X;
}
-
/*******************************************************************
* Direct_Move_Y
*
@@ -883,7 +860,6 @@ static int nInstrCount=0;
zone->touch[point] |= TT_Flag_Touched_Y;
}
-
/*******************************************************************
*
* Function : Round_None
@@ -923,7 +899,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_To_Grid
@@ -957,11 +932,9 @@ static int nInstrCount=0;
val = 0;
}
-
return val;
}
-
/*******************************************************************
*
* Function : Round_To_Half_Grid
@@ -998,7 +971,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_Down_To_Grid
@@ -1035,7 +1007,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_Up_To_Grid
@@ -1072,7 +1043,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_To_Double_Grid
@@ -1109,7 +1079,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_Super
@@ -1134,7 +1103,6 @@ static int nInstrCount=0;
{
TT_F26Dot6 val;
-
if ( distance >= 0 )
{
val = (distance - CUR.phase + CUR.threshold + compensation) &
@@ -1155,7 +1123,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
*
* Function : Round_Super_45
@@ -1178,7 +1145,6 @@ static int nInstrCount=0;
{
TT_F26Dot6 val;
-
if ( distance >= 0 )
{
val = ( (distance - CUR.phase + CUR.threshold + compensation) /
@@ -1199,7 +1165,6 @@ static int nInstrCount=0;
return val;
}
-
/*******************************************************************
* Compute_Round
*
@@ -1243,7 +1208,6 @@ static int nInstrCount=0;
}
}
-
/*******************************************************************
*
* Function : SetSuperRound
@@ -1328,7 +1292,6 @@ static int nInstrCount=0;
return 0;
}
-
/*******************************************************************
*
* Function : Dual_Project
@@ -1348,7 +1311,6 @@ static int nInstrCount=0;
return 0;
}
-
/*******************************************************************
*
* Function : Free_Project
@@ -1368,8 +1330,6 @@ static int nInstrCount=0;
return 0;
}
-
-
/*******************************************************************
*
* Function : Project_x
@@ -1387,7 +1347,6 @@ static int nInstrCount=0;
return Vx;
}
-
/*******************************************************************
*
* Function : Project_y
@@ -1405,7 +1364,6 @@ static int nInstrCount=0;
return Vy;
}
-
/*******************************************************************
*
* Function : Compute_Funcs
@@ -1505,7 +1463,6 @@ static int nInstrCount=0;
TT_F26Dot6 W;
Bool S1, S2;
-
if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L )
{
Vx *= 0x100;
@@ -1595,8 +1552,6 @@ static int nInstrCount=0;
return SUCCESS;
}
-
-
/****************************************************************/
/* */
/* MANAGING THE STACK */
@@ -1614,7 +1569,6 @@ static int nInstrCount=0;
args[1] = args[0];
}
-
/*******************************************/
/* POP[] : POPs the stack's top elt. */
/* CodeRange : $21 */
@@ -1624,7 +1578,6 @@ static int nInstrCount=0;
/* nothing to do */
}
-
/*******************************************/
/* CLEAR[] : Clear the entire stack */
/* CodeRange : $22 */
@@ -1634,7 +1587,6 @@ static int nInstrCount=0;
CUR.new_top = 0;
}
-
/*******************************************/
/* SWAP[] : Swap the top two elements */
/* CodeRange : $23 */
@@ -1649,7 +1601,6 @@ static int nInstrCount=0;
args[1] = L;
}
-
/*******************************************/
/* DEPTH[] : return the stack depth */
/* CodeRange : $24 */
@@ -1659,7 +1610,6 @@ static int nInstrCount=0;
args[0] = CUR.top;
}
-
/*******************************************/
/* CINDEX[] : copy indexed element */
/* CodeRange : $25 */
@@ -1668,7 +1618,6 @@ static int nInstrCount=0;
{
Long L;
-
L = args[0];
if ( L<0 || L > CUR.args )
@@ -1677,7 +1626,6 @@ static int nInstrCount=0;
args[0] = CUR.stack[CUR.args - L];
}
-
/*******************************************/
/* MINDEX[] : move indexed element */
/* CodeRange : $26 */
@@ -1686,11 +1634,10 @@ static int nInstrCount=0;
{
Long L, K;
-
L = args[0];
if (L == 0)
- return;
+ return;
if ( L<0 || L > CUR.args )
{
@@ -1707,7 +1654,6 @@ static int nInstrCount=0;
CUR.stack[ CUR.args-1 ] = K;
}
-
/*******************************************/
/* ROLL[] : roll top three elements */
/* CodeRange : $8A */
@@ -1726,8 +1672,6 @@ static int nInstrCount=0;
args[0] = B;
}
-
-
/****************************************************************/
/* */
/* MANAGING THE FLOW OF CONTROL */
@@ -1748,7 +1692,6 @@ static int nInstrCount=0;
return FAILURE;
}
-
/*******************************************/
/* IF[] : IF test */
/* CodeRange : $58 */
@@ -1758,7 +1701,6 @@ static int nInstrCount=0;
Int nIfs;
Bool Out;
-
if ( args[0] != 0 )
return;
@@ -1788,7 +1730,6 @@ static int nInstrCount=0;
} while ( Out == 0 );
}
-
/*******************************************/
/* ELSE[] : ELSE */
/* CodeRange : $1B */
@@ -1818,7 +1759,6 @@ static int nInstrCount=0;
} while ( nIfs != 0 );
}
-
/*******************************************/
/* EIF[] : End IF */
/* CodeRange : $59 */
@@ -1828,7 +1768,6 @@ static int nInstrCount=0;
/* nothing to do */
}
-
/*******************************************/
/* JROT[] : Jump Relative On True */
/* CodeRange : $78 */
@@ -1846,7 +1785,6 @@ static int nInstrCount=0;
}
}
-
/*******************************************/
/* JMPR[] : JuMP Relative */
/* CodeRange : $1C */
@@ -1860,14 +1798,13 @@ static int nInstrCount=0;
/* The JPMR is meant to stop at the ENDF instruction to finish
* the function. However the programmer made a mistake, and ended
* up one byte too far. I suspect that some TT interpreters handle this
- * by detecting that the IP has gone off the end of the function. We can
+ * by detecting that the IP has gone off the end of the function. We can
* allow for simple cases here by just checking the preceding byte.
* Fonts with this problem are not uncommon.
*/
CUR.IP -= 1;
}
-
/*******************************************/
/* JROF[] : Jump Relative On False */
/* CodeRange : $79 */
@@ -1885,8 +1822,6 @@ static int nInstrCount=0;
}
}
-
-
/****************************************************************/
/* */
/* LOGICAL FUNCTIONS */
@@ -1907,7 +1842,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* LTEQ[] : Less Than or EQual */
/* CodeRange : $51 */
@@ -1920,7 +1854,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* GT[] : Greater Than */
/* CodeRange : $52 */
@@ -1933,7 +1866,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* GTEQ[] : Greater Than or EQual */
/* CodeRange : $53 */
@@ -1946,7 +1878,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* EQ[] : EQual */
/* CodeRange : $54 */
@@ -1959,7 +1890,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* NEQ[] : Not EQual */
/* CodeRange : $55 */
@@ -1972,7 +1902,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* ODD[] : Odd */
/* CodeRange : $56 */
@@ -1985,7 +1914,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* EVEN[] : Even */
/* CodeRange : $57 */
@@ -1998,7 +1926,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* AND[] : logical AND */
/* CodeRange : $5A */
@@ -2011,7 +1938,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* OR[] : logical OR */
/* CodeRange : $5B */
@@ -2024,7 +1950,6 @@ static int nInstrCount=0;
args[0] = 0;
}
-
/*******************************************/
/* NOT[] : logical NOT */
/* CodeRange : $5C */
@@ -2037,8 +1962,6 @@ static int nInstrCount=0;
args[0] = 1;
}
-
-
/****************************************************************/
/* */
/* ARITHMETIC AND MATH INSTRUCTIONS */
@@ -2056,7 +1979,6 @@ static int nInstrCount=0;
args[0] += args[1];
}
-
/*******************************************/
/* SUB[] : SUBstract */
/* CodeRange : $61 */
@@ -2066,7 +1988,6 @@ static int nInstrCount=0;
args[0] -= args[1];
}
-
/*******************************************/
/* DIV[] : DIVide */
/* CodeRange : $62 */
@@ -2083,7 +2004,6 @@ static int nInstrCount=0;
DBG_PRINT1(" %d", args[0]);
}
-
/*******************************************/
/* MUL[] : MULtiply */
/* CodeRange : $63 */
@@ -2093,7 +2013,6 @@ static int nInstrCount=0;
args[0] = MulDiv_Round( args[0], args[1], 64L );
}
-
/*******************************************/
/* ABS[] : ABSolute value */
/* CodeRange : $64 */
@@ -2103,7 +2022,6 @@ static int nInstrCount=0;
args[0] = ABS( args[0] );
}
-
/*******************************************/
/* NEG[] : NEGate */
/* CodeRange : $65 */
@@ -2113,7 +2031,6 @@ static int nInstrCount=0;
args[0] = -args[0];
}
-
/*******************************************/
/* FLOOR[] : FLOOR */
/* CodeRange : $66 */
@@ -2123,7 +2040,6 @@ static int nInstrCount=0;
args[0] &= -64;
}
-
/*******************************************/
/* CEILING[] : CEILING */
/* CodeRange : $67 */
@@ -2133,7 +2049,6 @@ static int nInstrCount=0;
args[0] = (args[0] + 63) & (-64);
}
-
/*******************************************/
/* MAX[] : MAXimum */
/* CodeRange : $68 */
@@ -2144,7 +2059,6 @@ static int nInstrCount=0;
args[0] = args[1];
}
-
/*******************************************/
/* MIN[] : MINimum */
/* CodeRange : $69 */
@@ -2155,8 +2069,6 @@ static int nInstrCount=0;
args[0] = args[1];
}
-
-
/****************************************************************/
/* */
/* COMPENSATING FOR THE ENGINE CHARACTERISTICS */
@@ -2175,7 +2087,6 @@ static int nInstrCount=0;
CUR.metrics.compensations[CUR.opcode - 0x68] );
}
-
/*******************************************/
/* NROUND[ab]: No ROUNDing of value */
/* CodeRange : $6C-$6F */
@@ -2187,8 +2098,6 @@ static int nInstrCount=0;
CUR.metrics.compensations[CUR.opcode - 0x6C] );
}
-
-
/****************************************************************/
/* */
/* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
@@ -2225,7 +2134,6 @@ static int nInstrCount=0;
{
PDefRecord pRec;
-
if ( BOUNDS( args[0], CUR.numFDefs ) )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -2242,7 +2150,6 @@ static int nInstrCount=0;
skip_FDEF(EXEC_ARG);
}
-
/*******************************************/
/* ENDF[] : END Function definition */
/* CodeRange : $2D */
@@ -2285,7 +2192,6 @@ static int nInstrCount=0;
/* the result of Ins_Goto_CodeRange() here! */
}
-
/*******************************************/
/* CALL[] : CALL function */
/* CodeRange : $2B */
@@ -2294,7 +2200,6 @@ static int nInstrCount=0;
{
PCallRecord pCrec;
-
if ( BOUNDS( args[0], CUR.numFDefs ) || !CUR.FDefs[args[0]].Active )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -2324,7 +2229,6 @@ static int nInstrCount=0;
CUR.step_ins = FALSE;
}
-
/*******************************************/
/* LOOPCALL[]: LOOP and CALL function */
/* CodeRange : $2A */
@@ -2363,7 +2267,6 @@ static int nInstrCount=0;
}
}
-
/*******************************************/
/* IDEF[] : Instruction DEFinition */
/* CodeRange : $89 */
@@ -2371,23 +2274,21 @@ static int nInstrCount=0;
static void Ins_IDEF( INS_ARG )
{
if (CUR.countIDefs >= CUR.numIDefs || args[0] > 255)
- CUR.error = TT_Err_Storage_Overflow;
- else
+ CUR.error = TT_Err_Storage_Overflow;
+ else
{
- PDefRecord pTDR;
+ PDefRecord pTDR;
- CUR.IDefPtr[(Byte)(args[0])] = CUR.countIDefs;
- pTDR = &CUR.IDefs[CUR.countIDefs++];
+ CUR.IDefPtr[(Byte)(args[0])] = CUR.countIDefs;
+ pTDR = &CUR.IDefs[CUR.countIDefs++];
pTDR->Opc = (Byte)(args[0]);
pTDR->Start = CUR.IP + 1;
pTDR->Range = CUR.curRange;
pTDR->Active = TRUE;
- skip_FDEF(EXEC_ARG);
+ skip_FDEF(EXEC_ARG);
}
}
-
-
/****************************************************************/
/* */
/* PUSHING DATA ONTO THE INTERPRETER STACK */
@@ -2420,7 +2321,6 @@ static int nInstrCount=0;
CUR.new_top += L;
}
-
/*******************************************/
/* NPUSHW[] : PUSH N Words */
/* CodeRange : $41 */
@@ -2429,7 +2329,6 @@ static int nInstrCount=0;
{
Int L, K;
-
L = (Int)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
@@ -2449,7 +2348,6 @@ static int nInstrCount=0;
CUR.new_top += L;
}
-
/*******************************************/
/* PUSHB[abc]: PUSH Bytes */
/* CodeRange : $B0-$B7 */
@@ -2472,7 +2370,6 @@ static int nInstrCount=0;
}
}
-
/*******************************************/
/* PUSHW[abc]: PUSH Words */
/* CodeRange : $B8-$BF */
@@ -2481,7 +2378,6 @@ static int nInstrCount=0;
{
Int L, K;
-
L = CUR.opcode - 0xB8 + 1;
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
@@ -2500,8 +2396,6 @@ static int nInstrCount=0;
CUR.step_ins = FALSE;
}
-
-
/****************************************************************/
/* */
/* MANAGING THE STORAGE AREA */
@@ -2525,7 +2419,6 @@ static int nInstrCount=0;
args[0] = CUR.storage[args[0]];
}
-
/*******************************************/
/* WS[] : Write Store */
/* CodeRange : $42 */
@@ -2541,7 +2434,6 @@ static int nInstrCount=0;
CUR.storage[args[0]] = args[1];
}
-
/*******************************************/
/* WCVTP[] : Write CVT in Pixel units */
/* CodeRange : $44 */
@@ -2557,7 +2449,6 @@ static int nInstrCount=0;
CUR_Func_write_cvt( args[0], args[1] );
}
-
/*******************************************/
/* WCVTF[] : Write CVT in FUnits */
/* CodeRange : $70 */
@@ -2577,7 +2468,6 @@ static int nInstrCount=0;
DBG_PRINT3(" cvt[%d]%d:=%d", args[0], ov, CUR.cvt[args[0]]);
}
-
/*******************************************/
/* RCVT[] : Read CVT */
/* CodeRange : $45 */
@@ -2591,7 +2481,7 @@ static int nInstrCount=0;
CUR.error = TT_Err_Invalid_Reference;
return;
#else
- /* A workaround for the Ghostscript Bug 687604.
+ /* A workaround for the Ghostscript Bug 687604.
Ported from FreeType 2 : !FT_LOAD_PEDANTIC by default. */
index=args[0];
args[0] = 0;
@@ -2603,8 +2493,6 @@ static int nInstrCount=0;
DBG_PRINT3(" cvt[%d]%d:%d", index, CUR.cvt[index], args[0]);
}
-
-
/****************************************************************/
/* */
/* MANAGING THE GRAPHICS STATE */
@@ -2640,7 +2528,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SPVTCA[a] : Set PVector to Axis */
/* CodeRange : $02-$03 */
@@ -2665,7 +2552,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SFVTCA[a] : Set FVector to Axis */
/* CodeRange : $04-$05 */
@@ -2688,7 +2574,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
static Bool Ins_SxVTL( EXEC_OPS Int aIdx1,
Int aIdx2,
Int aOpc,
@@ -2725,7 +2610,6 @@ static int nInstrCount=0;
return SUCCESS;
}
-
/*******************************************/
/* SPVTL[a] : Set PVector to Line */
/* CodeRange : $06-$07 */
@@ -2742,7 +2626,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SFVTL[a] : Set FVector to Line */
/* CodeRange : $08-$09 */
@@ -2758,7 +2641,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SFVTPV[] : Set FVector to PVector */
/* CodeRange : $0E */
@@ -2769,7 +2651,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SDPVTL[a] : Set Dual PVector to Line */
/* CodeRange : $86-$87 */
@@ -2779,7 +2660,6 @@ static int nInstrCount=0;
Long A, B, C;
Long p1, p2; /* was Int in pas type ERROR */
-
p1 = args[1];
p2 = args[0];
@@ -2819,7 +2699,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SPVFS[] : Set PVector From Stack */
/* CodeRange : $0A */
@@ -2829,7 +2708,6 @@ static int nInstrCount=0;
Short S;
Long X, Y;
-
/* Only use low 16bits, then sign extend */
S = (Short)args[1];
Y = (Long)S;
@@ -2844,7 +2722,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* SFVFS[] : Set FVector From Stack */
/* CodeRange : $0B */
@@ -2854,7 +2731,6 @@ static int nInstrCount=0;
Short S;
Long X, Y;
-
/* Only use low 16bits, then sign extend */
S = (Short)args[1];
Y = (Long)S;
@@ -2867,7 +2743,6 @@ static int nInstrCount=0;
COMPUTE_Funcs();
}
-
/*******************************************/
/* GPV[] : Get Projection Vector */
/* CodeRange : $0C */
@@ -2878,7 +2753,6 @@ static int nInstrCount=0;
args[1] = CUR.GS.projVector.y;
}
-
/*******************************************/
/* GFV[] : Get Freedom Vector */
/* CodeRange : $0D */
@@ -2889,7 +2763,6 @@ static int nInstrCount=0;
args[1] = CUR.GS.freeVector.y;
}
-
/*******************************************/
/* SRP0[] : Set Reference Point 0 */
/* CodeRange : $10 */
@@ -2899,7 +2772,6 @@ static int nInstrCount=0;
CUR.GS.rp0 = (Int)(args[0]);
}
-
/*******************************************/
/* SRP1[] : Set Reference Point 1 */
/* CodeRange : $11 */
@@ -2909,7 +2781,6 @@ static int nInstrCount=0;
CUR.GS.rp1 = (Int)(args[0]);
}
-
/*******************************************/
/* SRP2[] : Set Reference Point 2 */
/* CodeRange : $12 */
@@ -2919,7 +2790,6 @@ static int nInstrCount=0;
CUR.GS.rp2 = (Int)(args[0]);
}
-
/*******************************************/
/* SZP0[] : Set Zone Pointer 0 */
/* CodeRange : $13 */
@@ -2945,7 +2815,6 @@ static int nInstrCount=0;
CUR.GS.gep0 = (Int)(args[0]);
}
-
/*******************************************/
/* SZP1[] : Set Zone Pointer 1 */
/* CodeRange : $14 */
@@ -2970,7 +2839,6 @@ static int nInstrCount=0;
CUR.GS.gep1 = (Int)(args[0]);
}
-
/*******************************************/
/* SZP2[] : Set Zone Pointer 2 */
/* CodeRange : $15 */
@@ -2995,7 +2863,6 @@ static int nInstrCount=0;
CUR.GS.gep2 = (Int)(args[0]);
}
-
/*******************************************/
/* SZPS[] : Set Zone Pointers */
/* CodeRange : $16 */
@@ -3025,7 +2892,6 @@ static int nInstrCount=0;
CUR.GS.gep2 = (Int)(args[0]);
}
-
/*******************************************/
/* RTHG[] : Round To Half Grid */
/* CodeRange : $19 */
@@ -3037,7 +2903,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_To_Half_Grid;
}
-
/*******************************************/
/* RTG[] : Round To Grid */
/* CodeRange : $18 */
@@ -3049,7 +2914,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_To_Grid;
}
-
/*******************************************/
/* RTDG[] : Round To Double Grid */
/* CodeRange : $3D */
@@ -3061,7 +2925,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_To_Double_Grid;
}
-
/*******************************************/
/* RUTG[] : Round Up To Grid */
/* CodeRange : $7C */
@@ -3073,7 +2936,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_Up_To_Grid;
}
-
/*******************************************/
/* RDTG[] : Round Down To Grid */
/* CodeRange : $7D */
@@ -3085,7 +2947,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_Down_To_Grid;
}
-
/*******************************************/
/* ROFF[] : Round OFF */
/* CodeRange : $7A */
@@ -3097,7 +2958,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_None;
}
-
/*******************************************/
/* SROUND[] : Super ROUND */
/* CodeRange : $76 */
@@ -3110,7 +2970,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_Super;
}
-
/*******************************************/
/* S45ROUND[]: Super ROUND 45 degrees */
/* CodeRange : $77 */
@@ -3123,7 +2982,6 @@ static int nInstrCount=0;
CUR.func_round = (TRound_Function)Round_Super_45;
}
-
/*******************************************/
/* SLOOP[] : Set LOOP variable */
/* CodeRange : $17 */
@@ -3133,7 +2991,6 @@ static int nInstrCount=0;
CUR.GS.loop = args[0];
}
-
/*******************************************/
/* SMD[] : Set Minimum Distance */
/* CodeRange : $1A */
@@ -3143,7 +3000,6 @@ static int nInstrCount=0;
CUR.GS.minimum_distance = args[0];
}
-
/*******************************************/
/* INSTCTRL[]: INSTruction ConTRol */
/* CodeRange : $8e */
@@ -3152,7 +3008,6 @@ static int nInstrCount=0;
{
Long K, L;
-
K = args[1];
L = args[0];
@@ -3165,7 +3020,6 @@ static int nInstrCount=0;
CUR.GS.instruct_control = (Int)((CUR.GS.instruct_control & (~K)) | (L & K));
}
-
/*******************************************/
/* SCANCTRL[]: SCAN ConTRol */
/* CodeRange : $85 */
@@ -3174,7 +3028,6 @@ static int nInstrCount=0;
{
Int A;
-
/* Get Threshold */
A = (Int)(args[0] & 0xFF);
@@ -3210,7 +3063,6 @@ static int nInstrCount=0;
CUR.GS.scan_control = FALSE;
}
-
/*******************************************/
/* SCANTYPE[]: SCAN TYPE */
/* CodeRange : $8D */
@@ -3229,7 +3081,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* SCVTCI[] : Set Control Value Table Cut In */
/* CodeRange : $1D */
@@ -3239,7 +3090,6 @@ static int nInstrCount=0;
CUR.GS.control_value_cutin = (TT_F26Dot6)args[0];
}
-
/**********************************************/
/* SSWCI[] : Set Single Width Cut In */
/* CodeRange : $1E */
@@ -3249,7 +3099,6 @@ static int nInstrCount=0;
CUR.GS.single_width_cutin = (TT_F26Dot6)args[0];
}
-
/**********************************************/
/* SSW[] : Set Single Width */
/* CodeRange : $1F */
@@ -3265,7 +3114,6 @@ static int nInstrCount=0;
CUR.GS.single_width_value = (TT_F26Dot6)(args[0] >> 10);
}
-
/**********************************************/
/* FLIPON[] : Set Auto_flip to On */
/* CodeRange : $4D */
@@ -3275,7 +3123,6 @@ static int nInstrCount=0;
CUR.GS.auto_flip = TRUE;
}
-
/**********************************************/
/* FLIPOFF[] : Set Auto_flip to Off */
/* CodeRange : $4E */
@@ -3285,7 +3132,6 @@ static int nInstrCount=0;
CUR.GS.auto_flip = FALSE;
}
-
/**********************************************/
/* SANGW[] : Set Angle Weight */
/* CodeRange : $7E */
@@ -3295,7 +3141,6 @@ static int nInstrCount=0;
/* instruction not supported anymore */
}
-
/**********************************************/
/* SDB[] : Set Delta Base */
/* CodeRange : $5E */
@@ -3305,7 +3150,6 @@ static int nInstrCount=0;
CUR.GS.delta_base = (Int)args[0];
}
-
/**********************************************/
/* SDS[] : Set Delta Shift */
/* CodeRange : $5F */
@@ -3315,7 +3159,6 @@ static int nInstrCount=0;
CUR.GS.delta_shift = (Int)args[0];
}
-
/**********************************************/
/* GC[a] : Get Coordinate projected onto */
/* CodeRange : $46-$47 */
@@ -3327,7 +3170,6 @@ static int nInstrCount=0;
{
Long L;
-
L = args[0];
if ( BOUNDS( L, CUR.zp2.n_points ) )
@@ -3352,7 +3194,6 @@ static int nInstrCount=0;
args[0] = L;
}
-
/**********************************************/
/* SCFS[] : Set Coordinate From Stack */
/* CodeRange : $48 */
@@ -3367,7 +3208,6 @@ static int nInstrCount=0;
Long K;
Int L;
-
L = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp2.n_points ) )
@@ -3390,7 +3230,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* MD[a] : Measure Distance */
/* CodeRange : $49-$4A */
@@ -3427,7 +3266,6 @@ static int nInstrCount=0;
args[0] = D;
}
-
/**********************************************/
/* MPPEM[] : Measure Pixel Per EM */
/* CodeRange : $4B */
@@ -3438,7 +3276,6 @@ static int nInstrCount=0;
DBG_PRINT1(" %d", args[0]);
}
-
/**********************************************/
/* MPS[] : Measure PointSize */
/* CodeRange : $4C */
@@ -3448,8 +3285,6 @@ static int nInstrCount=0;
args[0] = CUR.metrics.pointSize;
}
-
-
/****************************************************************/
/* */
/* MANAGING OUTLINES */
@@ -3494,7 +3329,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* FLIPRGON[]: FLIP RanGe ON */
/* CodeRange : $81 */
@@ -3503,7 +3337,6 @@ static int nInstrCount=0;
{
Long I, K, L;
-
K = args[1];
L = args[0];
@@ -3518,7 +3351,6 @@ static int nInstrCount=0;
CUR.pts.touch[I] |= TT_Flag_On_Curve;
}
-
/**********************************************/
/* FLIPRGOFF : FLIP RanGe OFF */
/* CodeRange : $82 */
@@ -3527,7 +3359,6 @@ static int nInstrCount=0;
{
Long I, K, L;
-
K = args[1];
L = args[0];
@@ -3542,7 +3373,6 @@ static int nInstrCount=0;
CUR.pts.touch[I] &= ~TT_Flag_On_Curve;
}
-
static Bool Compute_Point_Displacement( EXEC_OPS
PCoordinates x,
PCoordinates y,
@@ -3553,7 +3383,6 @@ static int nInstrCount=0;
Int p;
TT_F26Dot6 d;
-
if ( CUR.opcode & 1 )
{
zp = CUR.zp0;
@@ -3585,7 +3414,6 @@ static int nInstrCount=0;
return SUCCESS;
}
-
static void Move_Zp2_Point( EXEC_OPS
Long point,
TT_F26Dot6 dx,
@@ -3607,7 +3435,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* SHP[a] : SHift Point by the last point */
/* CodeRange : $32-33 */
@@ -3652,7 +3479,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* SHC[a] : SHift Contour */
/* CodeRange : $34-35 */
@@ -3667,13 +3493,12 @@ static int nInstrCount=0;
Long contour, i;
Int first_point, last_point;
-
contour = args[0];
if ( BOUNDS( args[0], CUR.pts.n_contours ) )
{
#if 0
- /* A workaround for the Ghostscript bug 688501.
+ /* A workaround for the Ghostscript bug 688501.
* Ported from FreeType 2
*/
CUR.error = TT_Err_Invalid_Reference;
@@ -3699,7 +3524,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* SHZ[a] : SHift Zone */
/* CodeRange : $36-37 */
@@ -3714,7 +3538,6 @@ static int nInstrCount=0;
Int last_point;
Long i;
-
if ( BOUNDS( args[0], 2 ) )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -3734,7 +3557,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* SHPIX[] : SHift points by a PIXel amount */
/* CodeRange : $38 */
@@ -3744,7 +3566,6 @@ static int nInstrCount=0;
TT_F26Dot6 dx, dy;
Long point;
-
if ( CUR.top < CUR.GS.loop )
{
CUR.error = TT_Err_Invalid_Reference;
@@ -3779,7 +3600,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* MSIRP[a] : Move Stack Indirect Relative */
/* CodeRange : $3A-$3B */
@@ -3789,7 +3609,6 @@ static int nInstrCount=0;
Int point;
TT_F26Dot6 distance;
-
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp1.n_points ) )
@@ -3822,7 +3641,6 @@ static int nInstrCount=0;
CUR.GS.rp0 = point;
}
-
/**********************************************/
/* MDAP[a] : Move Direct Absolute Point */
/* CodeRange : $2E-$2F */
@@ -3833,7 +3651,6 @@ static int nInstrCount=0;
TT_F26Dot6 cur_dist,
distance;
-
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp0.n_points ) )
@@ -3861,7 +3678,6 @@ static int nInstrCount=0;
CUR.GS.rp1 = point;
}
-
/**********************************************/
/* MIAP[a] : Move Indirect Absolute Point */
/* CodeRange : $3E-$3F */
@@ -3872,18 +3688,17 @@ static int nInstrCount=0;
TT_F26Dot6 distance,
org_dist;
-
cvtEntry = (Int)args[1];
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp0.n_points ) ||
BOUNDS( args[1], CUR.cvtSize ) )
{
- /* Ignore these errors, abort the instruction
- * and continue. This restores the FreeType
- * behaviour when pedantic_hinting is false. For bug
- * #689471, see also Ins_SHC above and bug #688501.
- */
+ /* Ignore these errors, abort the instruction
+ * and continue. This restores the FreeType
+ * behaviour when pedantic_hinting is false. For bug
+ * #689471, see also Ins_SHC above and bug #688501.
+ */
return;
}
@@ -3941,7 +3756,6 @@ static int nInstrCount=0;
CUR.GS.rp1 = point;
}
-
/**********************************************/
/* MDRP[abcde] : Move Direct Relative Point */
/* CodeRange : $C0-$DF */
@@ -3952,13 +3766,12 @@ static int nInstrCount=0;
TT_F26Dot6 distance,
org_dist;
-
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp1.n_points ) )
{
- /* Current version of FreeType silently ignores this out of bounds error
- * and drops the instruction, see bug #691121
+ /* Current version of FreeType silently ignores this out of bounds error
+ * and drops the instruction, see bug #691121
CUR.error = TT_Err_Invalid_Reference; */
return;
}
@@ -4023,7 +3836,6 @@ static int nInstrCount=0;
CUR.GS.rp0 = point;
}
-
/**********************************************/
/* MIRP[abcde] : Move Indirect Relative Point */
/* CodeRange : $E0-$FF */
@@ -4038,7 +3850,6 @@ static int nInstrCount=0;
cur_dist,
org_dist;
-
point = (Int)args[0];
cvtEntry = (Int)args[1];
@@ -4149,7 +3960,6 @@ static int nInstrCount=0;
CUR.GS.rp2 = point;
}
-
/**********************************************/
/* ALIGNRP[] : ALIGN Relative Point */
/* CodeRange : $3C */
@@ -4191,7 +4001,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* AA[] : Adjust Angle */
/* CodeRange : $7F */
@@ -4201,7 +4010,6 @@ static int nInstrCount=0;
/* Intentional - no longer supported */
}
-
/**********************************************/
/* ISECT[] : moves point to InterSECTion */
/* CodeRange : $0F */
@@ -4222,7 +4030,6 @@ static int nInstrCount=0;
TT_Vector R;
-
point = args[0];
a0 = args[1];
@@ -4278,7 +4085,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* ALIGNPTS[] : ALIGN PoinTS */
/* CodeRange : $27 */
@@ -4288,7 +4094,6 @@ static int nInstrCount=0;
Int p1, p2;
TT_F26Dot6 distance;
-
p1 = (Int)args[0];
p2 = (Int)args[1];
@@ -4309,7 +4114,6 @@ static int nInstrCount=0;
CUR_Func_move( &CUR.zp0, p2, -distance );
}
-
/**********************************************/
/* IP[] : Interpolate Point */
/* CodeRange : $39 */
@@ -4384,7 +4188,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* UTP[a] : UnTouch Point */
/* CodeRange : $29 */
@@ -4410,7 +4213,6 @@ static int nInstrCount=0;
CUR.zp0.touch[args[0]] &= mask;
}
-
/* Local variables for Ins_IUP: */
struct LOC_Ins_IUP
{
@@ -4418,7 +4220,6 @@ static int nInstrCount=0;
PCoordinates curs; /* arrays */
};
-
static void Shift( Int p1,
Int p2,
Int p,
@@ -4427,7 +4228,6 @@ static int nInstrCount=0;
Int i;
TT_F26Dot6 x;
-
x = LINK->curs[p] - LINK->orgs[p];
for ( i = p1; i < p; i++ )
@@ -4437,7 +4237,6 @@ static int nInstrCount=0;
LINK->curs[i] += x;
}
-
static void Interp( Int p1, Int p2,
Int ref1, Int ref2,
struct LOC_Ins_IUP* LINK )
@@ -4445,7 +4244,6 @@ static int nInstrCount=0;
Long i;
TT_F26Dot6 x, x1, x2, d1, d2;
-
if ( p1 > p2 )
return;
@@ -4514,7 +4312,6 @@ static int nInstrCount=0;
}
}
-
/**********************************************/
/* IUP[a] : Interpolate Untouched Points */
/* CodeRange : $30-$31 */
@@ -4601,7 +4398,6 @@ static int nInstrCount=0;
} while ( contour < CUR.pts.n_contours );
}
-
/**********************************************/
/* DELTAPn[] : DELTA Exceptions P1, P2, P3 */
/* CodeRange : $5D,$71,$72 */
@@ -4611,7 +4407,6 @@ static int nInstrCount=0;
Int k;
Long A, B, C, nump;
-
nump = args[0];
for ( k = 1; k <= nump; k++ )
@@ -4670,7 +4465,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
/**********************************************/
/* DELTACn[] : DELTA Exceptions C1, C2, C3 */
/* CodeRange : $73,$74,$75 */
@@ -4680,7 +4474,6 @@ static int nInstrCount=0;
Long nump, k;
Long A, B, C;
-
nump = args[0];
for ( k = 1; k <= nump; k++ )
@@ -4734,8 +4527,6 @@ static int nInstrCount=0;
CUR.new_top = CUR.args;
}
-
-
/****************************************************************/
/* */
/* MISC. INSTRUCTIONS */
@@ -4753,7 +4544,6 @@ static int nInstrCount=0;
CUR.error = TT_Err_Debug_OpCode;
}
-
/**********************************************/
/* GETINFO[] : GET INFOrmation */
/* CodeRange : $88 */
@@ -4762,7 +4552,6 @@ static int nInstrCount=0;
{
Long K;
-
K = 0;
/* We return then Windows 3.1 version number */
@@ -4781,31 +4570,29 @@ static int nInstrCount=0;
args[0] = K;
}
-
static void Ins_UNKNOWN( INS_ARG )
{ /* Rewritten by igorm. */
Byte i;
TDefRecord* def;
PCallRecord call;
-# if 0 /* The condition below appears always false
- due to limited range of data type
- - skip it to quiet a compiler warning. */
+# if 0 /* The condition below appears always false
+ due to limited range of data type
+ - skip it to quiet a compiler warning. */
if (CUR.opcode > sizeof(CUR.IDefPtr) / sizeof(CUR.IDefPtr[0])) {
- CUR.error = TT_Err_Invalid_Opcode;
- return;
+ CUR.error = TT_Err_Invalid_Opcode;
+ return;
}
# endif
i = CUR.IDefPtr[(Byte)CUR.opcode];
- if (i >= CUR.numIDefs)
+ if (i >= CUR.numIDefs)
{
- CUR.error = TT_Err_Invalid_Opcode;
- return;
+ CUR.error = TT_Err_Invalid_Opcode;
+ return;
}
def = &CUR.IDefs[i];
-
if ( CUR.callTop >= CUR.callSize )
{
CUR.error = TT_Err_Stack_Overflow;
@@ -4825,7 +4612,6 @@ static int nInstrCount=0;
return;
}
-
static struct { const char *sName; TInstruction_Function p; } Instruct_Dispatch[256] =
{
/* Opcodes are gathered in groups of 16. */
@@ -5104,8 +4890,6 @@ static int nInstrCount=0;
,{" MIRP[31] ", Ins_MIRP }
};
-
-
/****************************************************************/
/* */
/* RUN */
@@ -5146,10 +4930,10 @@ static int nInstrCount=0;
bool bFirst;
bool dbg_prt = (DBG_PRT_FUN != NULL);
# ifdef DEBUG
- ttfMemory *mem = exc->current_face->font->tti->ttf_memory;
- F26Dot6 *save_ox, *save_oy, *save_cx, *save_cy;
+ ttfMemory *mem = exc->current_face->font->tti->ttf_memory;
+ F26Dot6 *save_ox, *save_oy, *save_cx, *save_cy;
- DBG_PRINT("\n%% *** Entering RunIns ***");
+ DBG_PRINT("\n%% *** Entering RunIns ***");
# endif
(void)dbg_prt; /* Quiet compiler warning in release build. */
@@ -5181,15 +4965,15 @@ static int nInstrCount=0;
save_cx = mem->alloc_bytes(mem, CUR.pts.n_points * sizeof(*save_cx), "RunIns");
save_cy = mem->alloc_bytes(mem, CUR.pts.n_points * sizeof(*save_cy), "RunIns");
if (!save_ox || !save_oy || !save_cx || !save_cy)
- return TT_Err_Out_Of_Memory;
+ return TT_Err_Out_Of_Memory;
} else
- save_ox = save_oy = save_cx = save_cy = NULL;
+ save_ox = save_oy = save_cx = save_cy = NULL;
# endif
Result = setjmp(find_jmp_buf(exc->trap));
if (Result) {
- CUR.error = Result;
- goto _LExit;
+ CUR.error = Result;
+ goto _LExit;
}
bFirst = true;
@@ -5227,30 +5011,30 @@ static int nInstrCount=0;
# ifdef DEBUG
DBG_PRINT3("\n%%n=%5d IP=%5d OP=%s ", nInstrCount, CUR.IP, Instruct_Dispatch[CUR.opcode].sName);
- /*
+ /*
{ for(int i=0;i<CUR.top;i++)
DBG_PRINT1("% %d",CUR.stack[i]);
}
- */
- if (save_ox != NULL) {
+ */
+ if (save_ox != NULL) {
memcpy(save_ox, CUR.pts.org_x, sizeof(CUR.pts.org_x[0]) * CUR.pts.n_points);
memcpy(save_oy, CUR.pts.org_y, sizeof(CUR.pts.org_y[0]) * CUR.pts.n_points);
memcpy(save_cx, CUR.pts.cur_x, sizeof(CUR.pts.cur_x[0]) * CUR.pts.n_points);
memcpy(save_cy, CUR.pts.cur_y, sizeof(CUR.pts.cur_y[0]) * CUR.pts.n_points);
- }
+ }
# endif
Instruct_Dispatch[CUR.opcode].p( EXEC_ARGS &CUR.stack[CUR.args] );
# ifdef DEBUG
- if (save_ox != NULL) {
- F26Dot6 *pp[4], *qq[4];
+ if (save_ox != NULL) {
+ F26Dot6 *pp[4], *qq[4];
const char *ss[] = {"org.x", "org.y", "cur.x", "cur.y"};
int l = 0, i, j;
- pp[0] = save_ox,
- pp[1] = save_oy,
- pp[2] = save_cx,
+ pp[0] = save_ox,
+ pp[1] = save_oy,
+ pp[2] = save_cx,
pp[3] = save_cy;
qq[0] = CUR.pts.org_x;
qq[1] = CUR.pts.org_y;
@@ -5261,13 +5045,13 @@ static int nInstrCount=0;
for(j = 0;j < CUR.pts.n_points; j++)
{ F26Dot6 *ppi = pp[i], *qqi = qq[i];
if(ppi[j] != qqi[j] || bFirst)
- {
+ {
DBG_PRINT4("%% %s[%d]%d:=%d", ss[i], j, pp[i][j], qq[i][j]);
if(++l > 3)
{ l=0;
DBG_PRINT("\n");
}
- }
+ }
}
nInstrCount++;
bFirst=FALSE;
diff --git a/gs/base/ttinterp.h b/gs/base/ttinterp.h
index dc0fe54f3..2d5f42300 100644
--- a/gs/base/ttinterp.h
+++ b/gs/base/ttinterp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,19 +52,17 @@
#include "ttcommon.h"
#include "ttobjs.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-
+
/* Run instructions in current execution context */
TT_Error RunIns( PExecution_Context exc );
-
+
#ifdef __cplusplus
}
#endif
#endif /* TTINTERP_H */
-
/* END */
diff --git a/gs/base/ttload.c b/gs/base/ttload.c
index 3e5486c20..9d11bb4c4 100644
--- a/gs/base/ttload.c
+++ b/gs/base/ttload.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
*
* ttload.c 1.0
*
- * TrueType Tables Loader.
+ * TrueType Tables Loader.
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -94,7 +94,7 @@
face->numGlyphs = maxProfile->numGlyphs;
- face->maxPoints = MAX( maxProfile->maxCompositePoints,
+ face->maxPoints = MAX( maxProfile->maxCompositePoints,
maxProfile->maxPoints );
face->maxContours = MAX( maxProfile->maxCompositeContours,
maxProfile->maxContours );
@@ -102,7 +102,7 @@
maxProfile->maxComponentDepth;
DebugTrace(font, "loaded\n");
-
+
return TT_Err_Ok;
}
@@ -128,7 +128,6 @@
ttfMemory *mem = font->tti->ttf_memory;
r->Seek(r, font->t_cvt_.nPos);
-
face->cvt=NULL;
DebugTrace(font, "CVT ");
@@ -141,12 +140,11 @@
# endif
if(face->cvtSize > 0) { /* allow fonts with a CVT table */
- face->cvt = mem->alloc_bytes(mem, face->cvtSize * sizeof(Short), "Load_TrueType_CVT");
- if (!face->cvt)
- return TT_Err_Out_Of_Memory;
+ face->cvt = mem->alloc_bytes(mem, face->cvtSize * sizeof(Short), "Load_TrueType_CVT");
+ if (!face->cvt)
+ return TT_Err_Out_Of_Memory;
}
-
limit = face->cvtSize;
for ( n = 0; n < limit && !r->Eof(r); n++ )
@@ -157,7 +155,6 @@
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Load_TrueType_Programs
@@ -180,7 +177,6 @@
face->fontProgram = NULL;
face->cvtProgram = NULL;
-
DebugTrace(font, "Font program ");
/* The font program is optional */
@@ -224,6 +220,3 @@
return TT_Err_Ok;
}
-
-
-
diff --git a/gs/base/ttload.h b/gs/base/ttload.h
index 75d4f9df1..39c7ff490 100644
--- a/gs/base/ttload.h
+++ b/gs/base/ttload.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
*
* ttload.h 1.1
*
- * TrueType Tables Loader.
+ * TrueType Tables Loader.
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -42,7 +42,6 @@
#include "ttcommon.h"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -50,7 +49,7 @@
Int LookUp_TrueType_Table( PFace face,
Long tag );
- TT_Error Load_TrueType_Directory ( PFace face,
+ TT_Error Load_TrueType_Directory ( PFace face,
int faceIndex );
TT_Error Load_TrueType_MaxProfile ( PFace face );
@@ -73,11 +72,9 @@
void* buffer,
Long* length );
-
TT_Error Free_TrueType_Names( PFace face );
TT_Error Free_TrueType_Hdmx ( PFace face );
-
/* The following macros are defined to simplify the writing of */
/* the various table and glyph loaders. */
@@ -100,7 +97,7 @@
#define GET_Short() ttfReader__Short (r)
#define GET_Long() ttfReader__Int (r)
#define GET_ULong() ttfReader__UInt(r)
-
+
#ifdef TT_CONFIG_REENTRANT /* re-entrant implementation */
/* The following macros define the necessary local */
@@ -134,7 +131,6 @@
DEFINE_A_STREAM; \
DEFINE_A_FRAME
-
#define ACCESS_Frame( _size_ ) \
( error = TT_Access_Frame( stream, &frame, _size_ ) )
#define CHECK_ACCESS_Frame( _size_ ) \
@@ -152,7 +148,7 @@
( error = TT_Read_File ( stream, buffer, count ) )
#define FILE_Read_At( pos, buffer, count ) \
( error = TT_Read_At_File( stream, pos, buffer, count ) )
-
+
#else /* thread-safe implementation */
/* Define stream locals with frame -- nothing in thread-safe mode */
@@ -176,7 +172,6 @@
TT_Error error; \
DEFINE_A_STREAM
-
#define ACCESS_Frame( _size_ ) \
( error = TT_Access_Frame( _size_ ) )
#define CHECK_ACCESS_Frame( _size_ ) \
@@ -185,7 +180,7 @@
( error = TT_Forget_Frame() )
#define GET_Tag4() TT_Get_Long ()
-
+
#define FILE_Pos() TT_File_Pos()
#define FILE_Seek( _position_ ) \
@@ -196,7 +191,7 @@
( error = TT_Read_File ( buffer, count ) )
#define FILE_Read_At( pos, buffer, count ) \
( error = TT_Read_At_File( pos, buffer, count ) )
-
+
#endif /* TT_CONFIG_REENTRANT */
#ifdef __cplusplus
@@ -205,5 +200,4 @@
#endif /* TTLOAD_H */
-
/* END */
diff --git a/gs/base/ttmisc.h b/gs/base/ttmisc.h
index 967183bc7..af956f348 100644
--- a/gs/base/ttmisc.h
+++ b/gs/base/ttmisc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/ttobjs.c b/gs/base/ttobjs.c
index d3b79ac7f..cd6d6ac08 100644
--- a/gs/base/ttobjs.c
+++ b/gs/base/ttobjs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
*
* ttobjs.c 1.0
*
- * Objects manager.
+ * Objects manager.
*
* Copyright 1996-1998 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -44,8 +44,6 @@
#ifdef TT_EXTEND_ENGINE
#endif
-
-
/*******************************************************************
* *
* CODERANGE FUNCTIONS *
@@ -60,8 +58,8 @@
* Description : Switch to a new code range (updates Code and IP).
*
* Input : exec target execution context
- * range new execution code range
- * IP new IP in new code range
+ * range new execution code range
+ * IP new IP in new code range
*
* Output : SUCCESS on success. FAILURE on error (no code range).
*
@@ -71,7 +69,6 @@
{
PCodeRange cr;
-
if ( range < 1 || range > 3 )
return TT_Err_Bad_Argument;
@@ -103,7 +100,7 @@
*
* Input : exec target execution context
*
- * Output :
+ * Output :
*
* Note : The pointer must be unset after used to avoid pending pointers
* while a garbager invokation.
@@ -115,7 +112,7 @@
exec->code = 0;
exec->codeSize = 0;
}
-
+
/*******************************************************************
*
* Function : Get_CodeRange
@@ -125,7 +122,7 @@
* 'range' is out of current bounds.
*
* Input : exec target execution context
- * range new execution code range
+ * range new execution code range
*
* Output : Pointer to the code range record. NULL on failure.
*
@@ -139,7 +136,6 @@
return &exec->codeRangeTable[range - 1];
}
-
/*******************************************************************
*
* Function : Set_CodeRange
@@ -169,7 +165,6 @@
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Clear_CodeRange
@@ -196,8 +191,6 @@
return TT_Err_Ok;
}
-
-
/*******************************************************************
* *
* EXECUTION CONTEXT ROUTINES *
@@ -205,12 +198,11 @@
* *
*******************************************************************/
-
#define FREE(ptr) { mem->free(mem, ptr, "ttobjs.c"); ptr = NULL; }
#define ALLOC_ARRAY(ptr, old_count, count, type) \
- (old_count >= count ? 0 : \
- !(free_aux(mem, ptr), \
- ptr = mem->alloc_bytes(mem, (count) * sizeof(type), "ttobjs.c")))
+ (old_count >= count ? 0 : \
+ !(free_aux(mem, ptr), \
+ ptr = mem->alloc_bytes(mem, (count) * sizeof(type), "ttobjs.c")))
#define SETMAX(a, b) a = (a > b ? a : b)
static int free_aux(ttfMemory *mem, void *ptr)
@@ -329,7 +321,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
ALLOC_ARRAY( exec->twilight.touch, exec->twilight.n_points, n_twilight, Byte ) ||
/* reserve twilight zone */
- ALLOC_ARRAY( exec->pts.contours, exec->n_contours, face->maxContours, UShort )
+ ALLOC_ARRAY( exec->pts.contours, exec->n_contours, face->maxContours, UShort )
/* reserve contours array */
)
goto Fail_Memory;
@@ -349,7 +341,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return TT_Err_Out_Of_Memory;
}
-
/*******************************************************************
*
* Function : Context_Load
@@ -361,7 +352,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
{
Int i;
-
exec->current_face = ins->face;
exec->numFDefs = ins->numFDefs;
@@ -393,7 +383,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Context_Save
@@ -426,7 +415,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Context_Run
@@ -438,7 +426,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
{
TT_Error error;
-
if ( ( error = Goto_CodeRange( exec, TT_CodeRange_Glyph, 0 ) ) )
return error;
@@ -466,16 +453,15 @@ static int free_aux(ttfMemory *mem, void *ptr)
if ( !debug ) {
error = RunIns( exec );
- Unset_CodeRange(exec);
+ Unset_CodeRange(exec);
return error;
} else
return TT_Err_Ok;
}
-
const TGraphicsState Default_GraphicsState =
{
- 0, 0, 0,
+ 0, 0, 0,
{ 0x4000, 0 },
{ 0x4000, 0 },
{ 0x4000, 0 },
@@ -484,8 +470,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
0, FALSE, 2, 1, 1, 1
};
-
-
/*******************************************************************
* *
* INSTANCE FUNCTIONS *
@@ -513,7 +497,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
if ( !_instance )
return TT_Err_Ok;
if ( !ins->face ) {
- /* This may happen while closing a high level device, when allocator runs out of memory.
+ /* This may happen while closing a high level device, when allocator runs out of memory.
A test case is 01_001.pdf with pdfwrite and a small vmthreshold.
*/
return TT_Err_Out_Of_Memory;
@@ -535,7 +519,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Instance_Create
@@ -571,10 +554,10 @@ static int free_aux(ttfMemory *mem, void *ptr)
ins->numIDefs = maxp->maxInstructionDefs;
ins->countIDefs = 0;
if (maxp->maxInstructionDefs > 255)
- maxp->maxInstructionDefs = 255; /* Bug 689960 */
+ maxp->maxInstructionDefs = 255; /* Bug 689960 */
memset(ins->IDefPtr, (Byte)ins->numIDefs, sizeof(ins->IDefPtr));
if (ins->numFDefs < 50)
- ins->numFDefs = 50; /* Bug 687858 */
+ ins->numFDefs = 50; /* Bug 687858 */
ins->cvtSize = face->cvtSize;
ins->metrics.pointSize = 10 * 64; /* default pointsize = 10pts */
@@ -682,7 +665,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
goto Fin;
error = RunIns( exec );
- Unset_CodeRange(exec);
+ Unset_CodeRange(exec);
}
else
error = TT_Err_Ok;
@@ -695,7 +678,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return error;
}
-
/*******************************************************************
*
* Function : Instance_Reset
@@ -798,7 +780,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
goto Fin;
error = RunIns( exec );
- Unset_CodeRange(exec);
+ Unset_CodeRange(exec);
}
else
error = TT_Err_Ok;
@@ -815,7 +797,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return error;
}
-
/*******************************************************************
* *
* FACE FUNCTIONS *
@@ -831,7 +812,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
*
* Input : _face typeless pointer to the face object to destroy
*
- * Output : Error code.
+ * Output : Error code.
*
******************************************************************/
@@ -853,7 +834,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return TT_Err_Ok;
}
-
/*******************************************************************
*
* Function : Face_Create
@@ -873,7 +853,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
#define LOAD_( table ) \
( error = Load_TrueType_##table (face) )
-
TT_Error Face_Create( PFace face)
{
TT_Error error;
@@ -886,7 +865,7 @@ static int free_aux(ttfMemory *mem, void *ptr)
/*LOAD_(CMap) ||*/
LOAD_(CVT) ||
/*LOAD_(Horizontal_Header) ||*/
- LOAD_(Programs)
+ LOAD_(Programs)
/*LOAD_(HMTX) ||*/
/*LOAD_(Gasp) ||*/
/*LOAD_(Names) ||*/
@@ -903,9 +882,6 @@ static int free_aux(ttfMemory *mem, void *ptr)
return error;
}
-
-
-
/*******************************************************************
*
* Function : Scale_X
@@ -943,4 +919,3 @@ static int free_aux(ttfMemory *mem, void *ptr)
{
return MulDiv_Round( y, metrics->y_scale1, metrics->y_scale2 );
}
-
diff --git a/gs/base/ttobjs.h b/gs/base/ttobjs.h
index 79d3cbbde..1aa5d9181 100644
--- a/gs/base/ttobjs.h
+++ b/gs/base/ttobjs.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,7 +15,6 @@
/* Changes after FreeType: cut out the TrueType instruction interpreter. */
-
/*******************************************************************
*
* ttobjs.h 1.0
@@ -183,7 +182,6 @@ typedef struct _TExecution_Context TExecution_Context;
typedef struct _TGlyph TGlyph;
typedef TGlyph* PGlyph;
-
/*************************************************************/
/* */
/* ADDITIONAL SUBTABLES */
@@ -234,10 +232,8 @@ typedef struct _TExecution_Context TExecution_Context;
typedef struct _TGraphicsState TGraphicsState;
-
extern const TGraphicsState Default_GraphicsState;
-
/*************************************************************/
/* */
/* EXECUTION SUBTABLES */
@@ -257,7 +253,6 @@ typedef struct _TExecution_Context TExecution_Context;
# define TT_CodeRange_Cvt 2
# define TT_CodeRange_Glyph 3
-
struct _TCodeRange
{
PByte Base;
@@ -267,7 +262,6 @@ typedef struct _TExecution_Context TExecution_Context;
typedef struct _TCodeRange TCodeRange;
typedef TCodeRange* PCodeRange;
-
/* Defintion of a code range */
/* */
/* Code ranges can be resident to a glyph (i.e. the Font Program) */
@@ -306,7 +300,6 @@ typedef struct _TExecution_Context TExecution_Context;
typedef TCallRecord* PCallRecord;
typedef TCallRecord* PCallStack; /* defines a simple call stack */
-
/* This type defining a set of glyph points will be used to represent */
/* each zone (regular and twilight) during instructions decoding. */
struct _TGlyph_Zone
@@ -326,39 +319,37 @@ typedef struct _TExecution_Context TExecution_Context;
typedef struct _TGlyph_Zone TGlyph_Zone;
typedef TGlyph_Zone *PGlyph_Zone;
-
-
#ifndef TT_STATIC_INTERPRETER /* indirect implementation */
#define EXEC_OPS PExecution_Context exc,
#define EXEC_OP PExecution_Context exc
#define EXEC_ARGS exc,
#define EXEC_ARG exc
-
+
#else /* static implementation */
#define EXEC_OPS /* void */
#define EXEC_OP /* void */
#define EXEC_ARGS /* void */
#define EXEC_ARG /* void */
-
+
#endif
/* Rounding function, as used by the interpreter */
typedef TT_F26Dot6 (*TRound_Function)( EXEC_OPS TT_F26Dot6 distance,
TT_F26Dot6 compensation );
-
+
/* Point displacement along the freedom vector routine, as */
/* used by the interpreter */
typedef void (*TMove_Function)( EXEC_OPS PGlyph_Zone zone,
Int point,
TT_F26Dot6 distance );
-
+
/* Distance projection along one of the proj. vectors, as used */
/* by the interpreter */
typedef TT_F26Dot6 (*TProject_Function)( EXEC_OPS TT_F26Dot6 Vx,
TT_F26Dot6 Vy );
-
+
/* reading a cvt value. Take care of non-square pixels when needed */
typedef TT_F26Dot6 (*TGet_CVT_Function)( EXEC_OPS Int index );
@@ -498,8 +489,6 @@ typedef struct _TExecution_Context TExecution_Context;
typedef struct _TIns_Metrics TIns_Metrics;
typedef TIns_Metrics *PIns_Metrics;
-
-
/***********************************************************************/
/* */
/* FreeType Face Type */
@@ -553,8 +542,6 @@ typedef struct _TExecution_Context TExecution_Context;
};
-
-
/***********************************************************************/
/* */
/* FreeType Instance Type */
@@ -590,35 +577,34 @@ typedef struct _TExecution_Context TExecution_Context;
};
-
/***********************************************************************/
/* */
/* FreeType Execution Context Type */
/* */
/***********************************************************************/
- struct _TExecution_Context
+ struct _TExecution_Context
{
PFace current_face;
/* instructions state */
-
+
Int error; /* last execution error */
-
+
Int curRange; /* current code range number */
PByte code; /* current code range */
Int IP; /* current instruction pointer */
Int codeSize; /* size of current range */
-
+
Byte opcode; /* current opcode */
Int length; /* length of current opcode */
-
+
Bool step_ins; /* true if the interpreter must */
/* increment IP after ins. exec */
-
+
Int numFDefs; /* number of function defs */
PDefRecord FDefs; /* table of FDefs entries */
-
+
Int numIDefs; /* number of instruction defs */
PDefRecord IDefs; /* table of IDefs entries */
Int countIDefs;/* The number of defined IDefs (igorm). */
@@ -626,24 +612,24 @@ typedef struct _TExecution_Context TExecution_Context;
PByte glyphIns; /* glyph instructions buffer */
Int glyphSize; /* glyph instructions buffer size */
-
+
Int callTop, /* top of call stack during execution */
callSize; /* size of call stack */
PCallStack callStack; /* call stack */
-
+
TCodeRangeTable codeRangeTable; /* table of valid coderanges */
/* useful for the debugger */
-
+
Int storeSize; /* size of current storage */
PStorage storage; /* storage area */
-
+
Int stackSize; /* size of exec. stack */
Int top; /* top of exec. stack */
PStorage stack; /* current exec. stack */
-
+
Int args,
new_top; /* new top after exec. */
-
+
TT_F26Dot6 period; /* values used for the */
TT_F26Dot6 phase; /* 'SuperRounding' */
TT_F26Dot6 threshold;
@@ -661,36 +647,36 @@ typedef struct _TExecution_Context TExecution_Context;
zp2,
pts,
twilight;
-
+
Bool instruction_trap; /* If True, the interpreter will */
/* exit after each instruction */
-
+
TGraphicsState GS; /* current graphics state */
-
+
TGraphicsState default_GS; /* graphics state resulting from */
/* the prep program */
Bool is_composite; /* ture if the glyph is composite */
Int cvtSize;
PLong cvt;
-
+
/* latest interpreter additions */
-
+
Long F_dot_P; /* dot product of freedom and projection */
/* vectors */
TRound_Function func_round; /* current rounding function */
-
+
TProject_Function func_project, /* current projection function */
func_dualproj, /* current dual proj. function */
func_freeProj; /* current freedom proj. func */
-
+
TMove_Function func_move; /* current point move function */
TGet_CVT_Function func_read_cvt; /* read a cvt entry */
TSet_CVT_Function func_write_cvt; /* write a cvt entry (in pixels) */
TSet_CVT_Function func_move_cvt; /* incr a cvt entry (in pixels) */
/* GS extension */
- gsfix_jmp_buf trap; /* Error throw trap. */
+ gsfix_jmp_buf trap; /* Error throw trap. */
Int n_contours;
Int n_points;
Int maxGlyphSize;
@@ -698,37 +684,34 @@ typedef struct _TExecution_Context TExecution_Context;
ttfMemory *memory;
};
-
/********************************************************************/
/* */
/* Code Range Functions */
/* */
/********************************************************************/
-
+
/* Goto a specified coderange */
TT_Error Goto_CodeRange( PExecution_Context exec, Int range, Int IP );
/* Unset the coderange */
void Unset_CodeRange( PExecution_Context exec );
-
+
/* Return a pointer to a given coderange record. */
/* Used only by the debugger. */
PCodeRange Get_CodeRange( PExecution_Context exec, Int range );
-
+
/* Set a given code range properties */
TT_Error Set_CodeRange( PExecution_Context exec,
Int range,
void* base,
Int length );
-
+
/* Clear a given coderange */
TT_Error Clear_CodeRange( PExecution_Context exec, Int range );
-
PExecution_Context New_Context( PFace face );
TT_Error Done_Context( PExecution_Context exec );
-
TT_Error Context_Load( PExecution_Context exec,
PInstance ins );
@@ -745,7 +728,7 @@ typedef struct _TExecution_Context TExecution_Context;
TT_Error Instance_Create( void* _instance,
void* _face );
-
+
TT_Error Instance_Destroy( void* _instance );
TT_Error Context_Destroy( void* _context );
@@ -781,5 +764,4 @@ TT_Error Face_Destroy( PFace _face);
#endif /* TTOBJS_H */
-
/* END */
diff --git a/gs/base/tttables.h b/gs/base/tttables.h
index 2a4564890..a435350a8 100644
--- a/gs/base/tttables.h
+++ b/gs/base/tttables.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,7 +15,6 @@
/* Changes after FreeType: cut out the TrueType instruction interpreter. */
-
/*******************************************************************
*
* tttables.h 1.1
@@ -61,7 +60,6 @@
typedef struct _TTTCHeader TTTCHeader;
typedef TTTCHeader* PTTCHeader;
-
/* TrueType Table Directory type */
struct _TTableDir
@@ -77,7 +75,6 @@
typedef struct _TTableDir TTableDir;
typedef TTableDir* PTableDir;
-
/* The 'TableDir' is followed by 'numTables' TableDirEntries */
struct _TTableDirEntry
@@ -91,7 +88,6 @@
typedef struct _TTableDirEntry TTableDirEntry;
typedef TTableDirEntry* PTableDirEntry;
-
/* 'cmap' tables */
struct _TCMapDir
@@ -113,7 +109,6 @@
typedef struct _TCMapDirEntry TCMapDirEntry;
typedef TCMapDirEntry* PCMapDirEntries;
-
/* 'maxp' Maximum Profiles table */
struct _TMaxProfile
@@ -138,7 +133,6 @@
typedef struct _TMaxProfile TMaxProfile;
typedef TMaxProfile* PMaxProfile;
-
/* table "gasp" */
# define GASP_GRIDFIT 0x01
@@ -152,7 +146,6 @@
typedef struct _GaspRange GaspRange;
-
struct _TGasp
{
UShort version;
@@ -162,11 +155,9 @@
typedef struct _TGasp TGasp;
-
/* table "head" - now defined in freetype.h */
/* table "hhea" - now defined in freetype.h */
-
/* table "HMTX" */
struct _TLongHorMetric
@@ -178,11 +169,9 @@
typedef struct _TLongHorMetric TLongHorMetric;
typedef TLongHorMetric* PTableHorMetrics;
-
/* 'OS/2' table - now defined in freetype.h */
/* "post" table - now defined in freetype.h */
-
/* 'loca' location table type */
struct _TLoca
@@ -193,7 +182,6 @@
typedef struct _TLoca TLoca;
-
/* table "name" */
struct _TNameRec
@@ -213,7 +201,6 @@
typedef struct _TNameRec TNameRec;
-
struct _TName_Table
{
UShort format;
@@ -225,12 +212,10 @@
typedef struct _TName_Table TName_Table;
-
#ifdef __cplusplus
}
#endif
#endif /* TTTABLES_H */
-
/* END */
diff --git a/gs/base/tttype.h b/gs/base/tttype.h
index 0feee518c..c18e5658d 100644
--- a/gs/base/tttype.h
+++ b/gs/base/tttype.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,7 +15,6 @@
/* Changes after FreeType: cut out the TrueType instruction interpreter. */
-
/*******************************************************************
*
* tttype.h
@@ -27,15 +26,15 @@
*
* This file is part of the FreeType project and may only be used,
* modified, and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
* Notes:
*
- * This is the only file that should be included by client
+ * This is the only file that should be included by client
* application sources for the final release. All other types
- * and functions defined in the "tt*.h" files are library
+ * and functions defined in the "tt*.h" files are library
* internals, and should not be included (except of course
* during development, as now).
*
@@ -50,7 +49,6 @@
extern "C" {
#endif
-
/*******************************************************************/
/* */
/* FreeType types definitions. */
@@ -115,14 +113,13 @@
#endif
struct _TT_UnitVector /* guess what... */
- {
+ {
TT_F2Dot14 x;
TT_F2Dot14 y;
};
typedef struct _TT_UnitVector TT_UnitVector;
-
struct _TT_Vector /* Simple vector type */
{
TT_F26Dot6 x;
@@ -131,7 +128,6 @@
typedef struct _TT_Vector TT_Vector;
-
/* A simple 2x2 matrix used for transformations. */
/* You should use 16.16 fixed floats */
/* */
@@ -139,7 +135,7 @@
/* y' = yx*x + yy*y */
/* */
- struct _TT_Matrix
+ struct _TT_Matrix
{
TT_Fixed xx, xy;
TT_Fixed yx, yy;
@@ -147,7 +143,6 @@
typedef struct _TT_Matrix TT_Matrix;
-
/* A structure used to describe the source glyph to the renderer. */
struct _TT_Outline
@@ -199,7 +194,6 @@
typedef struct _TT_Outline TT_Outline;
-
/* A structure used to describe a simple bounding box */
struct _TT_BBox
@@ -267,7 +261,6 @@
typedef struct _TT_Glyph_Metrics TT_Glyph_Metrics;
typedef struct _TT_Big_Glyph_Metrics TT_Big_Glyph_Metrics;
-
/* A structure used to return instance metrics. */
struct _TT_Instance_Metrics
@@ -286,7 +279,6 @@
typedef struct _TT_Instance_Metrics TT_Instance_Metrics;
-
/* Flow constants: */
/* */
/* The flow of a bitmap refers to the way lines are oriented */
@@ -301,7 +293,6 @@
#define TT_Flow_Up 1 /* bitmap is oriented from bottom to top */
#define TT_Flow_Error 0 /* an error occurred during rendering */
-
/* A structure used to describe the target bitmap or pixmap to the */
/* renderer. Note that there is nothing in this structure that */
/* gives the nature of the buffer. */
@@ -340,8 +331,6 @@
typedef struct _TT_Raster_Map TT_Raster_Map;
-
-
/* ------- The font header TrueType table structure ----- */
struct _TT_Header
@@ -373,7 +362,6 @@
typedef struct _TT_Header TT_Header;
-
/* ------- The horizontal header TrueType table structure ----- */
struct _TT_Horizontal_Header
@@ -399,7 +387,6 @@
typedef struct _TT_Horizontal_Header TT_Horizontal_Header;
-
/* ----------- OS/2 Table ----------------------------- */
struct _TT_OS2
@@ -447,7 +434,6 @@
typedef struct _TT_OS2 TT_OS2;
-
/* ----------- Postscript table ------------------------ */
struct _TT_Postscript
@@ -468,7 +454,6 @@
typedef struct _TT_Postscript TT_Postscript;
-
/* ------------ horizontal device metrics "hdmx" ---------- */
struct _TT_Hdmx_Record
@@ -480,7 +465,6 @@
typedef struct _TT_Hdmx_Record TT_Hdmx_Record;
-
struct _TT_Hdmx
{
TT_UShort version;
@@ -490,7 +474,6 @@
typedef struct _TT_Hdmx TT_Hdmx;
-
/* A structure used to describe face properties. */
struct _TT_Face_Properties
@@ -573,11 +556,9 @@
TT_Error TT_Init_FreeType( TT_Engine* engine );
-
/* Finalize the engine, and release all allocated objects. */
TT_Error TT_Done_FreeType( TT_Engine engine );
-
/* Set the gray level palette. This is an array of 5 bytes used */
/* to produce the font smoothed pixmaps. By convention: */
/* */
@@ -589,7 +570,7 @@
/* */
TT_Error TT_Set_Raster_Gray_Palette( TT_Engine engine, char* palette );
-
+
/* ----------------------- face management ----------------------- */
/* Open a new TrueType font file, and returns a handle for */
@@ -606,7 +587,6 @@
const char* fontpathname,
TT_Face* face );
-
/* Open a TrueType font file located inside a collection. */
/* The font is designed by its index in 'fontIndex'. */
@@ -615,13 +595,11 @@
int fontIndex,
TT_Face* face );
-
/* Return face properties in the 'properties' structure. */
TT_Error TT_Get_Face_Properties( TT_Face face,
TT_Face_Properties* properties );
-
/* Set a face object's generic pointer */
TT_Error TT_Set_Face_Pointer( TT_Face face,
void* data );
@@ -658,7 +636,6 @@
TT_Error TT_New_Instance( TT_Face face,
TT_Instance* instance );
-
/* Set device resolution for a given instance. The values are */
/* given in dpi (Dots Per Inch). Default is 96 in both directions. */
@@ -669,7 +646,6 @@
int x_resolution,
int y_resolution );
-
/* Set the pointsize for a given instance. Default is 10pt. */
TT_Error TT_Set_Instance_CharSize( TT_Instance instance,
@@ -712,7 +688,6 @@
TT_Error TT_Get_Instance_Metrics( TT_Instance instance,
TT_Instance_Metrics* metrics );
-
/* Set an instance's generic pointer */
TT_Error TT_Set_Instance_Pointer( TT_Instance instance,
@@ -722,13 +697,11 @@
void* TT_Get_Instance_Pointer( TT_Instance instance );
-
/* Close a given instance object, destroying all associated */
/* data. */
TT_Error TT_Done_Instance( TT_Instance instance );
-
/* ----------------------- glyph management ----------------------- */
/* Create a new glyph object related to the given 'face'. */
@@ -736,12 +709,10 @@
TT_Error TT_New_Glyph( TT_Face face,
TT_Glyph* glyph );
-
/* Discard (and destroy) a given glyph object. */
TT_Error TT_Done_Glyph( TT_Glyph glyph );
-
#define TTLOAD_SCALE_GLYPH 1
#define TTLOAD_HINT_GLYPH 2
@@ -773,11 +744,10 @@
int glyph_index,
int load_flags );
-
/* Return glyph outline pointers in 'outline'. Note that the returned */
/* pointers are owned by the glyph object, and will be destroyed with */
/* it. The client application should _not_ change the pointers. */
-
+
TT_Error TT_Get_Glyph_Outline( TT_Glyph glyph,
TT_Outline* outline );
@@ -786,7 +756,6 @@
TT_Error TT_Get_Glyph_Metrics( TT_Glyph glyph,
TT_Glyph_Metrics* metrics );
-
/* Render the glyph into a bitmap, with given position offsets. */
/* Note : Only use integer pixel offsets to preserve the fine */
@@ -801,7 +770,6 @@
TT_F26Dot6 x_offset,
TT_F26Dot6 y_offset );
-
/* Render the glyph into a pixmap, with given position offsets. */
/* Note : Only use integer pixel offsets to preserve the fine */
@@ -884,13 +852,11 @@
void TT_Matrix_Multiply( TT_Matrix* a,
TT_Matrix* b );
-
+
/* Invert a transformation matrix */
TT_Error TT_Matrix_Invert( TT_Matrix* matrix );
-
-
/* ----------------- character mappings support ------------- */
/* Return the number of character mappings found in this file. */
@@ -898,7 +864,6 @@
int TT_Get_CharMap_Count( TT_Face face );
-
/* Return the ID of charmap number 'charmapIndex' of a given face */
/* used to enumerate the charmaps present in a TrueType file. */
@@ -907,7 +872,6 @@
short* platformID,
short* encodingID );
-
/* Look up the character maps found in 'face' and return a handle */
/* for the one matching 'platformID' and 'platformEncodingID' */
/* (see the TrueType specs relating to the 'cmap' table for */
@@ -918,7 +882,6 @@
int charmapIndex,
TT_CharMap* charMap );
-
/* Translate a character code through a given character map */
/* and return the corresponding glyph index to be used in */
/* a TT_Load_Glyph call. This function returns -1 in case of */
@@ -927,8 +890,6 @@
int TT_Char_Index( TT_CharMap charMap,
unsigned short charCode );
-
-
/* --------------------- names table support ------------------- */
/* Return the number of name strings found in the name table. */
@@ -936,7 +897,6 @@
int TT_Get_Name_Count( TT_Face face );
-
/* Return the ID of the name number 'nameIndex' of a given face */
/* used to enumerate the charmaps present in a TrueType file. */
@@ -947,7 +907,6 @@
short* languageID,
short* nameID );
-
/* Return the address and length of the name number 'nameIndex' */
/* of a given face. The string is part of the face object and */
/* shouldn't be written to or released. */
@@ -960,8 +919,6 @@
char** stringPtr, /* pointer address */
int* length ); /* str. length address */
-
-
/************************ callback definition ******************/
/* NOTE : Callbacks are still in beta stage, they'll be used to */
@@ -989,19 +946,17 @@
void* callback_ptr );
/************************ error codes declaration **************/
-
+
/* The error codes are grouped in 'classes' used to indicate the */
/* 'level' at which the error happened. */
/* The class is given by an error code's high byte. */
-
/* ------------- Success is always 0 -------- */
#define TT_Err_Ok 0
-
/* -------- High-level API error codes ------ */
-
+
#define TT_Err_Invalid_Face_Handle 0x001
#define TT_Err_Invalid_Instance_Handle 0x002
#define TT_Err_Invalid_Glyph_Handle 0x003
@@ -1011,7 +966,7 @@
#define TT_Err_Invalid_Argument 0x007
#define TT_Err_Could_Not_Open_File 0x008
#define TT_Err_File_Is_Not_Collection 0x009
-
+
#define TT_Err_Table_Missing 0x00A
#define TT_Err_Invalid_Horiz_Metrics 0x00B
#define TT_Err_Invalid_CharMap_Format 0x00C
@@ -1034,7 +989,6 @@
#define TT_Err_OS2_Table_Missing 0x087
#define TT_Err_Post_Table_Missing 0x088
-
/* -------- Memory component error codes ---- */
/* this error indicates that an operation cannot */
@@ -1042,9 +996,8 @@
#define TT_Err_Out_Of_Memory 0x100
-
/* -------- File component error codes ------ */
-
+
/* these error codes indicate that the file could */
/* not be accessed properly. Usually, this means */
/* a broken font file! */
@@ -1053,9 +1006,8 @@
#define TT_Err_Invalid_File_Read 0x201
#define TT_Err_Invalid_Frame_Access 0x202
-
/* -------- Glyph loader error codes -------- */
-
+
/* Produced only by the glyph loader, these error */
/* codes indicate a broken glyph in a font file. */
@@ -1064,9 +1016,8 @@
#define TT_Err_Invalid_Composite 0x302
#define TT_Err_Too_Many_Ins 0x303
-
/* --- bytecode interpreter error codes ----- */
-
+
/* These error codes are produced by the TrueType */
/* bytecode interpreter. They usually indicate a */
/* broken font file, a broken glyph within a font */
@@ -1086,26 +1037,24 @@
#define TT_Err_Debug_OpCode 0x40B
#define TT_Err_ENDF_In_Exec_Stream 0x40C
#define TT_Err_Out_Of_CodeRanges 0x40D
-#define TT_Err_Nested_DEFS 0x40E
+#define TT_Err_Nested_DEFS 0x40E
#define TT_Err_Invalid_CodeRange 0x40F
#define TT_Err_Invalid_Displacement 0x410
-
/* ------ internal failure error codes ----- */
/* These error codes are produced when an incoherent */
/* library state has been detected. These reflect a */
/* severe bug in the engine! (or a major overwrite */
/* of your application into the library's data). */
-
+
#define TT_Err_Nested_Frame_Access 0x500
#define TT_Err_Invalid_Cache_List 0x501
#define TT_Err_Could_Not_Find_Context 0x502
#define TT_Err_Unlisted_Object 0x503
-
/* ---- scan-line converter error codes ----- */
-
+
/* These error codes are produced by the raster component. */
/* They indicate that an outline structure was incoherently */
/* setup, or that you're trying to render an horribly */
@@ -1115,7 +1064,6 @@
#define TT_Err_Raster_Negative_Height 0x601
#define TT_Err_Raster_Invalid_Value 0x602
#define TT_Err_Raster_Not_Initialized 0x603
-
#ifdef __cplusplus
}
@@ -1123,5 +1071,4 @@
#endif /* FREETYPE_H */
-
/* END */
diff --git a/gs/base/tttypes.h b/gs/base/tttypes.h
index 8844b6424..4fd061b42 100644
--- a/gs/base/tttypes.h
+++ b/gs/base/tttypes.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,7 +15,6 @@
/* Changes after FreeType: cut out the TrueType instruction interpreter. */
-
/*******************************************************************
*
* tttypes.h
@@ -28,11 +27,11 @@
*
* This file is part of the FreeType project, and may only be used
* modified and distributed under the terms of the FreeType project
- * license, LICENSE.TXT. By continuing to use, modify, or distribute
+ * license, LICENSE.TXT. By continuing to use, modify, or distribute
* this file you indicate that you have read the license and
* understand and accept it fully.
*
- * NOTE:
+ * NOTE:
*
* All these declarations are library internals, and *not* part
* of the high-level interface. See also 'freetype.h'.
@@ -65,7 +64,7 @@
typedef int Int;
typedef long Integer;
-
+
/* Simple access types: pointers and tables */
typedef Byte* PByte;
@@ -81,7 +80,6 @@
typedef TT_F26Dot6* PCoordinates;
typedef unsigned char* PTouchTable;
-
#ifndef Bool
typedef int Bool; /* No boolean type in C */
#endif
@@ -100,7 +98,6 @@
typedef Long* PStorage;
-
/* Rounding mode constants */
#define TT_Round_Off 5
@@ -112,7 +109,6 @@
#define TT_Round_Super 6
#define TT_Round_Super_45 7
-
/* Touch flag masks */
#define TT_Flag_On_Curve 1
@@ -120,13 +116,11 @@
#define TT_Flag_Touched_Y 4
#define TT_Flag_Touched_Both 6
-
/* Error management constants :) */
#define SUCCESS 0
#define FAILURE -1
-
/* The min and max functions missing in C. As usual, be careful not to */
/* write things like MIN( a++, b++ ) to avoid side effects. */
@@ -160,8 +154,6 @@
#define HANDLE_Set( handle, val ) ((handle).z = (void*)(val))
-
#endif /* TTTYPES_H */
-
/* END */
diff --git a/gs/base/unistd_.h b/gs/base/unistd_.h
index 14c158c49..276f6e125 100644
--- a/gs/base/unistd_.h
+++ b/gs/base/unistd_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@
# include <io.h>
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER)
# define fsync(handle) _commit(handle)
# define read(fd, buf, len) _read(fd, buf, len)
# define isatty(fd) _isatty(fd)
@@ -42,7 +42,7 @@
# define dup(fd) _dup(fd)
# define open(fname, flags, mode) _open(fname, flags, mode)
# define close(fd) _close(fd)
-#elif defined(__BORLANDC__) && defined(__WIN32__)
+#elif defined(__BORLANDC__) && defined(__WIN32__)
# define fsync(handle) _commit(handle)
# define read(fd, buf, len) _read(fd, buf, len)
# define isatty(fd) _isatty(fd)
@@ -52,4 +52,3 @@
#endif
#endif /* unistd__INCLUDED */
-
diff --git a/gs/base/valgrind.h b/gs/base/valgrind.h
index e25a7254f..d544f2cbf 100755..100644
--- a/gs/base/valgrind.h
+++ b/gs/base/valgrind.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/vdtrace.c b/gs/base/vdtrace.c
index 978747e6b..198c65df8 100644
--- a/gs/base/vdtrace.c
+++ b/gs/base/vdtrace.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ static inline double bezier_point(double p0, double p1, double p2, double p3, do
}
static void vd_flatten(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y, double p3x, double p3y)
-{
+{
#ifdef DEBUG
double flat = 0.5;
double d2x0 = (p0x - 2 * p1x + p2x), d2y0 = (p0y - 2 * p1y + p2y);
@@ -60,11 +60,11 @@ static void vd_flatten(double p0x, double p0y, double p1x, double p1y, double p2
double e = 0.5 / N;
for (i = 0; i < N; i++) {
- double t = (double)i / N + e;
- double px = bezier_point(p0x, p1x, p2x, p3x, t);
- double py = bezier_point(p0y, p1y, p2y, p3y, t);
+ double t = (double)i / N + e;
+ double px = bezier_point(p0x, p1x, p2x, p3x, t);
+ double py = bezier_point(p0y, p1y, p2y, p3y, t);
- vd_lineto(px, py);
+ vd_lineto(px, py);
}
vd_lineto(p3x, p3y);
#endif
diff --git a/gs/base/vdtrace.h b/gs/base/vdtrace.h
index fab15317c..d13189b47 100644
--- a/gs/base/vdtrace.h
+++ b/gs/base/vdtrace.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,7 +18,7 @@
# define vdtrace_INCLUDED
/* Painting contract :
-
+
First use vd_get_dc.
Then paint with vd_* functionns.
When completed, use vd_release_dc.
@@ -97,10 +97,10 @@ void vd_setflag(char f, char v);
#endif
#if VD_TRACE && defined(DEBUG)
-# define vd_allowed(f) (vd_flags[(f) & 127])
+# define vd_allowed(f) (vd_flags[(f) & 127])
# define vd_get_dc(f) while (vd_trace0 && vd_allowed(f)) { vd_trace0->get_dc(vd_trace0, &vd_trace1); break; }
# define vd_release_dc BEGIN if (vd_trace1) vd_trace1->release_dc(vd_trace1, &vd_trace1); END
-# define vd_enabled (vd_trace1 != 0)
+# define vd_enabled (vd_trace1 != 0)
# define vd_get_size_unscaled_x (vd_trace1 ? vd_trace1->get_size_x(vd_trace1) : 100)
# define vd_get_size_unscaled_y (vd_trace1 ? vd_trace1->get_size_y(vd_trace1) : 100)
# define vd_get_size_scaled_x (vd_trace1 ? vd_trace1->get_size_x(vd_trace1) / vd_trace1->scale_x : 100)
@@ -137,13 +137,13 @@ void vd_setflag(char f, char v);
# define vd_text(x,y,s,c) BEGIN if (vd_trace1) vd_impl_text(x,y,s,c); END
# define vd_wait BEGIN if (vd_trace1) vd_trace1->wait(vd_trace1); END
# define vd_save vd_trace_interface * vd_trace_save; vd_trace_save = vd_trace1; /* NOTE :
- Use vd_save at end of the definition group of a block,
- because in release build it compiles to the empty operator.
- We intentionally defined an operator here for a compatible syntax check. */
+ Use vd_save at end of the definition group of a block,
+ because in release build it compiles to the empty operator.
+ We intentionally defined an operator here for a compatible syntax check. */
# define vd_restore vd_trace1 = vd_trace_save
-# define vd_disable vd_trace1 = NULL
+# define vd_disable vd_trace1 = NULL
#else
-# define vd_allowed(f) false
+# define vd_allowed(f) false
# define vd_get_dc(f) DO_NOTHING
# define vd_release_dc DO_NOTHING
# define vd_enabled 0
diff --git a/gs/base/vms_x_fix.h b/gs/base/vms_x_fix.h
index 2ee18eb7b..8dbda4583 100644
--- a/gs/base/vms_x_fix.h
+++ b/gs/base/vms_x_fix.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -692,7 +692,7 @@
#define XwcTextExtents XWCTEXTEXTENTS
#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY
#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST
-#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE
+#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE
#define _XUnregisterFilter _XUNREGISTERFILTER
#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT
#define _XmClearBorder _XMCLEARBORDER
@@ -886,7 +886,6 @@
#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS
#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/gs/base/vmsmath.h b/gs/base/vmsmath.h
index 417b02d9f..679b8d923 100644
--- a/gs/base/vmsmath.h
+++ b/gs/base/vmsmath.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/whitelst.c b/gs/base/whitelst.c
index 2332b252b..dc38e78d3 100644
--- a/gs/base/whitelst.c
+++ b/gs/base/whitelst.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,9 +15,9 @@
/* The following font names are taken from the Adobe webs site
(http://www.adobe.com/type/browser/legal/embeddingeula.html)
and comprise a list of font names for which permission is granted to embed
- either for preview and print or fully editable. These names are used to
+ either for preview and print or fully editable. These names are used to
override the embedding flags in TrueType fonts for pdfwrite and ps2write.
-
+
Its not entirely clear whether the font names should include TM and R
characters or not, and the only example font we have contains neither. For
the moment the fonts are stored without TM and R characters but this may
@@ -500,29 +500,29 @@ static int whitelist_strncmp(const char *s1, const char *s2, int length)
s1_index = s2_index = 0;
while (s2_index < length && s1[s1_index] != 0x00) {
- while (s1[s1_index] == ' ')
- s1_index++;
- while (s2[s2_index] == ' ' && s2_index < length)
- s2_index++;
- if (s2_index > length) {
- if (s1[s1_index] == 0x00)
- return 0;
- return 1;
- }
- if (s1[s1_index] == 0x00) {
- if (s2_index > length)
- return 0;
- return -1;
- }
- if (s1[s1_index] == s2[s2_index]) {
- s1_index++;
- s2_index++;
- continue;
- }
- if(s1[s1_index] < s2[s2_index])
- return -1;
- if(s1[s1_index] > s2[s2_index])
- return 1;
+ while (s1[s1_index] == ' ')
+ s1_index++;
+ while (s2[s2_index] == ' ' && s2_index < length)
+ s2_index++;
+ if (s2_index > length) {
+ if (s1[s1_index] == 0x00)
+ return 0;
+ return 1;
+ }
+ if (s1[s1_index] == 0x00) {
+ if (s2_index > length)
+ return 0;
+ return -1;
+ }
+ if (s1[s1_index] == s2[s2_index]) {
+ s1_index++;
+ s2_index++;
+ continue;
+ }
+ if(s1[s1_index] < s2[s2_index])
+ return -1;
+ if(s1[s1_index] > s2[s2_index])
+ return 1;
}
return result;
}
@@ -532,16 +532,16 @@ int IsInWhiteList (const char *Name, int size)
int low = 0, mid, high = WHITE_LIST_SIZE, test;
while (low < high) {
- /* bisect current range */
- mid = (low + high) / 2;
- test = whitelist_strncmp(EmbeddingWhiteList[mid], Name, size);
- if (test == 0)
- return 1;
- /* Not a match, select either upper or lower group and try again */
- if(test < 0)
- low = mid + 1;
- else
- high = mid - 1;
+ /* bisect current range */
+ mid = (low + high) / 2;
+ test = whitelist_strncmp(EmbeddingWhiteList[mid], Name, size);
+ if (test == 0)
+ return 1;
+ /* Not a match, select either upper or lower group and try again */
+ if(test < 0)
+ low = mid + 1;
+ else
+ high = mid - 1;
}
return 0;
}
diff --git a/gs/base/whitelst.h b/gs/base/whitelst.h
index 18bada5ba..8267ddcdc 100644
--- a/gs/base/whitelst.h
+++ b/gs/base/whitelst.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/base/windows_.h b/gs/base/windows_.h
index 93846f8f2..d8ddc7d3d 100644
--- a/gs/base/windows_.h
+++ b/gs/base/windows_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,13 +23,13 @@
#ifdef __WATCOMC__
typedef RGBQUAD FAR * LPRGBQUAD;
- /* Watcom's _beginthread takes an extra stack_bottom argument. */
+ /* Watcom's _beginthread takes an extra stack_bottom argument. */
# define BEGIN_THREAD(proc, stksize, data)\
_beginthread(proc, NULL, stksize, data)
#else
# define BEGIN_THREAD(proc, stksize, data)\
_beginthread(proc, stksize, data)
- /* Define null equivalents of the Watcom 32-to-16-bit glue. */
+ /* Define null equivalents of the Watcom 32-to-16-bit glue. */
# define AllocAlias16(ptr) ((DWORD)(ptr))
# define FreeAlias16(dword) /* */
# define MK_FP16(fp32) ((DWORD)(fp32))
@@ -45,7 +45,7 @@ typedef RGBQUAD FAR * LPRGBQUAD;
#endif
#if defined(__BORLANDC__)
-# define exception_code() __exception_code
+# define exception_code() __exception_code
#endif
#endif /* windows__INCLUDED */
diff --git a/gs/base/wtsimdi.c b/gs/base/wtsimdi.c
index 44ae6c11c..f1fa44c43 100644
--- a/gs/base/wtsimdi.c
+++ b/gs/base/wtsimdi.c
@@ -27,28 +27,28 @@ wtsimdi_create_buf_device(gx_device **pbdev, gx_device *target,
gx_device_memory *mdev;
if (plane_index >= 0)
- depth = render_plane->depth;
+ depth = render_plane->depth;
else
- depth = target->color_info.depth;
+ depth = target->color_info.depth;
mdproto = gdev_mem_device_for_bits(depth);
if (mdproto == 0)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (mem) {
- mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
- "create_buf_device");
- if (mdev == 0)
- return_error(gs_error_VMerror);
+ mdev = gs_alloc_struct(mem, gx_device_memory, &st_device_memory,
+ "create_buf_device");
+ if (mdev == 0)
+ return_error(gs_error_VMerror);
} else {
- mdev = (gx_device_memory *)*pbdev;
+ mdev = (gx_device_memory *)*pbdev;
}
if (target == (gx_device *)mdev) {
- /* The following is a special hack for setting up printer devices. */
- assign_dev_procs(mdev, mdproto);
+ /* The following is a special hack for setting up printer devices. */
+ assign_dev_procs(mdev, mdproto);
check_device_separable((gx_device *)mdev);
- gx_device_fill_in_procs((gx_device *)mdev);
+ gx_device_fill_in_procs((gx_device *)mdev);
} else
- gs_make_mem_device(mdev, mdproto, mem, (for_band ? 1 : 0),
- (target == (gx_device *)mdev ? NULL : target));
+ gs_make_mem_device(mdev, mdproto, mem, (for_band ? 1 : 0),
+ (target == (gx_device *)mdev ? NULL : target));
mdev->width = target->width;
/*
* The matrix in the memory device is irrelevant,
@@ -64,17 +64,16 @@ wtsimdi_create_buf_device(gx_device **pbdev, gx_device *target,
}
#define wtsimdi_prn_procs(print_page)\
- { print_page,\
- gx_default_print_page_copies,\
- { wtsimdi_create_buf_device,\
- gx_default_size_buf_device,\
- gx_default_setup_buf_device,\
- gx_default_destroy_buf_device\
- },\
- gdev_prn_default_get_space_params,\
- gx_default_start_render_thread,\
- gx_default_open_render_device,\
- gx_default_close_render_device,\
- gx_default_buffer_page\
- }
-
+ { print_page,\
+ gx_default_print_page_copies,\
+ { wtsimdi_create_buf_device,\
+ gx_default_size_buf_device,\
+ gx_default_setup_buf_device,\
+ gx_default_destroy_buf_device\
+ },\
+ gdev_prn_default_get_space_params,\
+ gx_default_start_render_thread,\
+ gx_default_open_render_device,\
+ gx_default_close_render_device,\
+ gx_default_buffer_page\
+ }
diff --git a/gs/base/x_.h b/gs/base/x_.h
index d44606094..050366d78 100644
--- a/gs/base/x_.h
+++ b/gs/base/x_.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -111,7 +111,7 @@
# define XtToolkitInitialize xttoolkitinitialize
# define CADDR_T /* Without this DEFINE, VAX GNUC */
- /* gets trashed reading Intrinsic.h */
+ /* gets trashed reading Intrinsic.h */
#else
#include <vms_x_fix.h>
# endif /* ifdef __GNUC__ */
diff --git a/gs/contrib/defs.h b/gs/contrib/defs.h
index f7e781051..4e6e03ffc 100644
--- a/gs/contrib/defs.h
+++ b/gs/contrib/defs.h
@@ -82,7 +82,6 @@ typedef struct _SIZEL /* sizl */
} SIZEL;
typedef SIZEL *PSIZEL;
-
typedef struct _POINTL {
LONG x;
LONG y;
@@ -114,7 +113,6 @@ typedef LONG APIRET;
#define LOUSHORT(l) ((USHORT)((ULONG)l))
#define HIUSHORT(l) ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
-
#define CLR_FALSE (-5L)
#define CLR_TRUE (-4L)
@@ -151,8 +149,6 @@ typedef LONG APIRET;
#define RGB_YELLOW 0x00FFFF00L
#define RGB_WHITE 0x00FFFFFFL
-
-
#define BMAP_MEMORY 0x00000001
/* bitmap parameterization used by GpiCreateBitmap and others */
@@ -166,7 +162,6 @@ typedef struct _BITMAPINFOHEADER /* bmp */
} BITMAPINFOHEADER;
typedef BITMAPINFOHEADER *PBITMAPINFOHEADER;
-
typedef struct _BMAPINFO /* bmapinfo */
{
ULONG ulLength;
@@ -226,7 +221,6 @@ typedef struct _BITMAPINFO2 /* bmi2 */
} BITMAPINFO2;
typedef BITMAPINFO2 *PBITMAPINFO2;
-
/******************************************************************************/
/* PPOINTL pptlSrc; // src left, bottom, width and height. */
/* PPOINTL pptlDst; // dst left, bottom, width and height. */
@@ -268,7 +262,6 @@ typedef IMAGEINFOS * PIMAGEINFO; /* pimginfo */
#define GDM_DITHER_END 0x0010 /* Use System error propigation dithering */
#define GDM_COLOR_CONVERT 0x0020 /* use device's clr mapping functions */
-
/*******************************************************************************************/
/* ULONG ulLength; // length of structure - 88 */
/* ULONG ulType; // type of dither info structure - GDM_MATRIX_DITHER*/
diff --git a/gs/contrib/eplaser/gdevescv.c b/gs/contrib/eplaser/gdevescv.c
index 0b665b0cd..274e863fd 100644
--- a/gs/contrib/eplaser/gdevescv.c
+++ b/gs/contrib/eplaser/gdevescv.c
@@ -17,13 +17,11 @@
things, the copyright notice and this notice must be preserved on all
copies.
-
SPECIAL THANKS:
Ëܥɥ饤¥Ð¤ÎºîÀ®¤Ë¤¢¤¿¤ê¡¢Â翹µª¿Í¤µ¤ó¤Î gdevlips, gdevl4v.c ¤ò»²¹Í¤Ë
¤µ¤»¤Æ夭¤Þ¤·¤¿¡£
-
NOTES:
- About Ghostscript 5.10/5.50 BUGS
@@ -82,10 +80,8 @@
#endif /* GS_VERSION_MAJOR */
-
#define ESCV_FORCEDRAWPATH 0 /* 0: correct LP-9200C path trouble. */
-
/* ---------------- Device definition ---------------- */
/* Device procedures */
@@ -99,11 +95,9 @@ static dev_proc_get_params(escv_get_params);
static dev_proc_fill_mask(escv_fill_mask);
static dev_proc_begin_image(escv_begin_image);
-
gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv,
- "gx_device_escv", device_escv_enum_ptrs, device_escv_reloc_ptrs,
- gx_device_finalize, st_device_vector);
-
+ "gx_device_escv", device_escv_enum_ptrs, device_escv_reloc_ptrs,
+ gx_device_finalize, st_device_vector);
/* for ESC/Page-Color
** ¸¶ÅÀ¤ÎÃͤò 0 ¤È¤·¤¿¾ì¹ç,·×»»¸íº¹¡©¤ÎÌäÂ꤫¤éÉÁ²è¥¨¥ê¥¢¤¬¶¸¤¦¤¿¤á
@@ -117,7 +111,6 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv,
offset_margin_values(0.001, 0.001, lm, 0, 0, tm),\
std_device_part3_()
-
/* for ESC/Page (Monochrome) */
#define esmv_device_full_body(dtype, pprocs, dname, stype, w, h, xdpi, ydpi, \
ncomp, depth, mg, mc, dg, dc, lm, bm, rm, tm)\
@@ -128,135 +121,127 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv,
0, 0, 5.0 / (MMETER_PER_INCH / POINT)), /* LPD.2. 041203 saito */\
std_device_part3_()
-
/* for ESC/Page-Color */
#define escv_device_body(name) \
escv_device_full_body(gx_device_escv, 0, name, \
- &st_device_escv,\
+ &st_device_escv,\
/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\
/* default resolution */ X_DPI, Y_DPI,\
/* color info */ 3, 24, 255, 255, 256, 256,\
- ESCPAGE_LEFT_MARGIN_DEFAULT,\
- ESCPAGE_BOTTOM_MARGIN_DEFAULT,\
- ESCPAGE_RIGHT_MARGIN_DEFAULT,\
- ESCPAGE_TOP_MARGIN_DEFAULT)
-
+ ESCPAGE_LEFT_MARGIN_DEFAULT,\
+ ESCPAGE_BOTTOM_MARGIN_DEFAULT,\
+ ESCPAGE_RIGHT_MARGIN_DEFAULT,\
+ ESCPAGE_TOP_MARGIN_DEFAULT)
/* for ESC/Page (Monochrome) */
#define esmv_device_body(name) \
esmv_device_full_body(gx_device_escv, 0, name, \
- &st_device_escv,\
+ &st_device_escv,\
/* width & height */ ESCPAGE_DEFAULT_WIDTH, ESCPAGE_DEFAULT_HEIGHT,\
/* default resolution */ X_DPI, Y_DPI,\
/* color info */ 1, 8, 255, 255, 256, 256,\
- ESCPAGE_LEFT_MARGIN_DEFAULT,\
- ESCPAGE_BOTTOM_MARGIN_DEFAULT,\
- ESCPAGE_RIGHT_MARGIN_DEFAULT,\
- ESCPAGE_TOP_MARGIN_DEFAULT)
-
-
+ ESCPAGE_LEFT_MARGIN_DEFAULT,\
+ ESCPAGE_BOTTOM_MARGIN_DEFAULT,\
+ ESCPAGE_RIGHT_MARGIN_DEFAULT,\
+ ESCPAGE_TOP_MARGIN_DEFAULT)
#define escv_procs_part1 \
- escv_open, /* open_device */\
- gx_default_get_initial_matrix, /* get_initial_matrix */\
- NULL, /* sync_output */\
- escv_output_page, /* output_page */\
- escv_close /* close_device */
+ escv_open, /* open_device */\
+ gx_default_get_initial_matrix, /* get_initial_matrix */\
+ NULL, /* sync_output */\
+ escv_output_page, /* output_page */\
+ escv_close /* close_device */
#define escv_procs_part2 \
- gdev_vector_fill_rectangle, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- escv_copy_mono, /* dev_t_proc_copy_mono */\
- escv_copy_color, /* dev_t_proc_copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- escv_get_params, /* dev_t_proc_get_params */\
- escv_put_params, /* dev_t_proc_put_params */\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device, /* dev_t_proc_get_page_device */\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- gdev_vector_fill_path, /* fill_path */\
- gdev_vector_stroke_path, /* stroke_path */\
- escv_fill_mask, /* fill_mask */\
- gdev_vector_fill_trapezoid, /* fill_trapezoid */\
- gdev_vector_fill_parallelogram, /* fill_parallelogram */\
- gdev_vector_fill_triangle, /* fill_triangle */\
- NULL, /****** WRONG ******/ /* draw_thin_line */\
- escv_begin_image, /* begin_image */\
- NULL, /* image_data */\
- NULL, /* end_image */\
- NULL, /* strip_tile_rectangle */\
- NULL /******strip_copy_rop******/
-
-
+ gdev_vector_fill_rectangle, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ escv_copy_mono, /* dev_t_proc_copy_mono */\
+ escv_copy_color, /* dev_t_proc_copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ escv_get_params, /* dev_t_proc_get_params */\
+ escv_put_params, /* dev_t_proc_put_params */\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device, /* dev_t_proc_get_page_device */\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ gdev_vector_fill_path, /* fill_path */\
+ gdev_vector_stroke_path, /* stroke_path */\
+ escv_fill_mask, /* fill_mask */\
+ gdev_vector_fill_trapezoid, /* fill_trapezoid */\
+ gdev_vector_fill_parallelogram, /* fill_parallelogram */\
+ gdev_vector_fill_triangle, /* fill_triangle */\
+ NULL, /****** WRONG ******/ /* draw_thin_line */\
+ escv_begin_image, /* begin_image */\
+ NULL, /* image_data */\
+ NULL, /* end_image */\
+ NULL, /* strip_tile_rectangle */\
+ NULL /******strip_copy_rop******/
/* for ESC/Page-Color */
#define escv_procs \
{\
escv_procs_part1,\
- gx_default_rgb_map_rgb_color, /* map_rgb_color */\
- gx_default_rgb_map_color_rgb, /* map_color_rgb */\
+ gx_default_rgb_map_rgb_color, /* map_rgb_color */\
+ gx_default_rgb_map_color_rgb, /* map_color_rgb */\
escv_procs_part2\
}
-
/* for ESC/Page (Monochrome) */
#define esmv_procs \
{\
escv_procs_part1,\
- gx_default_gray_map_rgb_color, /* map_rgb_color */\
- gx_default_gray_map_color_rgb, /* map_color_rgb */\
+ gx_default_gray_map_rgb_color, /* map_rgb_color */\
+ gx_default_gray_map_color_rgb, /* map_color_rgb */\
escv_procs_part2\
}
-
#define escv_init_code_common \
- ESCPAGE_MANUALFEED_DEFAULT, /* bool manualFeed; * Use manual feed * */\
- ESCPAGE_CASSETFEED_DEFAULT, /* int cassetFeed; * Input Casset * */\
- ESCPAGE_RIT_DEFAULT, /* bool RITOff; * RIT Control * */\
- FALSE, /* bool Collate; */\
- 0, /* int toner_density; */\
- FALSE, /* bool toner_saving; */\
- 0, /* int prev_paper_size; */\
- 0, /* int prev_paper_width; */\
- 0, /* int prev_paper_height; */\
- 0, /* int prev_num_copies; */\
- -1, /* int prev_feed_mode; */\
- 0, /* int orientation; */\
- ESCPAGE_FACEUP_DEFAULT, /* bool faceup; */\
- ESCPAGE_MEDIATYPE_DEFAULT, /* int MediaType; */\
- 0, /* bool first_page; */\
- 0, /* bool Duplex; */\
- ESCPAGE_TUMBLE_DEFAULT, /* bool Tumble; */\
- 0, /* int ncomp; */\
- 0, /* int MaskReverse; */\
- 0, /* int MaskState; */\
- TRUE, /* bool c4map; * 4bit ColorMap * */\
- TRUE, /* bool c8map; * 8bit ColorMap * */\
- 0, /* int prev_x; */\
- 0, /* int prev_y; */\
- 0, /* gx_color_index prev_color; */\
- 0, /* gx_color_index current_color; */\
- 3, /* floatp lwidth; */\
- 0, /* long cap; */\
- 3, /* long join; */\
- 0, /* long reverse_x; */\
- 0, /* long reverse_y; */\
+ ESCPAGE_MANUALFEED_DEFAULT, /* bool manualFeed; * Use manual feed * */\
+ ESCPAGE_CASSETFEED_DEFAULT, /* int cassetFeed; * Input Casset * */\
+ ESCPAGE_RIT_DEFAULT, /* bool RITOff; * RIT Control * */\
+ FALSE, /* bool Collate; */\
+ 0, /* int toner_density; */\
+ FALSE, /* bool toner_saving; */\
+ 0, /* int prev_paper_size; */\
+ 0, /* int prev_paper_width; */\
+ 0, /* int prev_paper_height; */\
+ 0, /* int prev_num_copies; */\
+ -1, /* int prev_feed_mode; */\
+ 0, /* int orientation; */\
+ ESCPAGE_FACEUP_DEFAULT, /* bool faceup; */\
+ ESCPAGE_MEDIATYPE_DEFAULT, /* int MediaType; */\
+ 0, /* bool first_page; */\
+ 0, /* bool Duplex; */\
+ ESCPAGE_TUMBLE_DEFAULT, /* bool Tumble; */\
+ 0, /* int ncomp; */\
+ 0, /* int MaskReverse; */\
+ 0, /* int MaskState; */\
+ TRUE, /* bool c4map; * 4bit ColorMap * */\
+ TRUE, /* bool c8map; * 8bit ColorMap * */\
+ 0, /* int prev_x; */\
+ 0, /* int prev_y; */\
+ 0, /* gx_color_index prev_color; */\
+ 0, /* gx_color_index current_color; */\
+ 3, /* floatp lwidth; */\
+ 0, /* long cap; */\
+ 3, /* long join; */\
+ 0, /* long reverse_x; */\
+ 0, /* long reverse_y; */\
{0,}, /* gs_matrix xmat; * matrix * */\
- 0, /* int bx; */\
- 0, /* int by; */\
- 0, /* int w; * width * */\
- 0, /* int h; * height * */\
- 0, /* int roll; */\
- 0, /* float sx; * scale x * */\
- 0, /* float sy; * scale y * */\
- 0, /* long dd; */\
+ 0, /* int bx; */\
+ 0, /* int by; */\
+ 0, /* int w; * width * */\
+ 0, /* int h; * height * */\
+ 0, /* int roll; */\
+ 0, /* float sx; * scale x * */\
+ 0, /* float sy; * scale y * */\
+ 0, /* long dd; */\
0, /* int ispath */\
{0,}, /* gx_bitmap_id id_cache[VCACHE + 1]; * for Font Downloading * */\
{0,}, /* char JobID[ESCPAGE_JOBID_MAX + 1]; */\
@@ -274,21 +259,18 @@ gs_public_st_suffix_add0_final(st_device_escv, gx_device_escv,
false, /* bool capDuplexUnit; */\
RES600 /* int capMaxResolution; */
-
/* for ESC/Page-Color */
#define escv_init_code \
vector_initial_values,\
- 1, /* int colormode; 1=ESC/Page-Color */\
+ 1, /* int colormode; 1=ESC/Page-Color */\
escv_init_code_common
-
/* for ESC/Page (Monochrome) */
#define esmv_init_code \
vector_initial_values,\
- 0, /* int colormode; 0=ESC/Page(Monochrome) */\
+ 0, /* int colormode; 0=ESC/Page(Monochrome) */\
escv_init_code_common
-
/* for ESC/Page (Monochrome) */
gx_device_escv far_data gs_epl2050_device ={esmv_device_body("epl2050"), esmv_procs, esmv_init_code};
gx_device_escv far_data gs_epl2050p_device={esmv_device_body("epl2050p"),esmv_procs, esmv_init_code};
@@ -345,31 +327,30 @@ gx_device_escv far_data gs_lp9800c_device ={escv_device_body("lp9800c"), escv_pr
gx_device_escv far_data gs_lps6500_device ={escv_device_body("lps6500"), escv_procs, escv_init_code};
gx_device_escv far_data gs_eplcolor_device ={escv_device_body(ESCPAGE_DEVICENAME_COLOR), escv_procs, escv_init_code};
-
/* Vector device implementation */
#if ( 6 > GS_VERSION_MAJOR )
static int escv_beginpage(P1(gx_device_vector * vdev));
static int escv_setfillcolor(P2(gx_device_vector * vdev, const gx_drawing_color * pdc));
static int escv_setstrokecolor(P2(gx_device_vector * vdev, const gx_drawing_color * pdc));
-static int escv_setdash(P4(gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset));
+static int escv_setdash(P4(gx_device_vector * vdev, const float *pattern,
+ uint count, floatp offset));
static int escv_setflat(P2(gx_device_vector * vdev, floatp flatness));
-static int escv_setlogop(P3(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff));
+static int escv_setlogop(P3(gx_device_vector * vdev, gs_logical_operation_t lop,
+ gs_logical_operation_t diff));
static int escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type);
+ fixed y1, gx_path_type_t type);
static int escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
- gx_path_type_t type);
+ gx_path_type_t type);
static int escv_beginpath(P2(gx_device_vector * vdev, gx_path_type_t type));
static int escv_moveto(P6(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type));
+ floatp x, floatp y, gx_path_type_t type));
static int escv_lineto(P6(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type));
+ floatp x, floatp y, gx_path_type_t type));
static int escv_curveto(P10(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type));
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type));
static int escv_closepath(P6(gx_device_vector * vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type));
+ floatp x_start, floatp y_start, gx_path_type_t type));
static int escv_endpath(P2(gx_device_vector * vdev, gx_path_type_t type));
static int escv_setlinewidth(gx_device_vector * vdev, floatp width);
@@ -387,18 +368,18 @@ static int escv_setlinecap (gx_device_vector * vdev, gs_line_cap cap);
static int escv_setlinejoin (gx_device_vector * vdev, gs_line_join join);
static int escv_setmiterlimit (gx_device_vector * vdev, floatp limit);
static int escv_setdash (gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset);
+ uint count, floatp offset);
static int escv_setflat (gx_device_vector * vdev, floatp flatness);
static int escv_setlogop (gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff);
+ gs_logical_operation_t diff);
/* Other state */
#if ( 8 <= GS_VERSION_MAJOR )
static bool escv_can_handle_hl_color (gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc);
-static int escv_setfillcolor (gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc);
+ const gx_drawing_color * pdc);
+static int escv_setfillcolor (gx_device_vector * vdev, const gs_imager_state * pis,
+ const gx_drawing_color * pdc);
static int escv_setstrokecolor (gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc);
+ const gx_drawing_color * pdc);
#else
static int escv_setfillcolor (gx_device_vector * vdev, const gx_drawing_color * pdc);
static int escv_setstrokecolor (gx_device_vector * vdev, const gx_drawing_color * pdc);
@@ -406,19 +387,19 @@ static int escv_setstrokecolor (gx_device_vector * vdev, const gx_drawing_color
/* Paths */
/* dopath and dorect are normally defaulted */
static int escv_vector_dopath (gx_device_vector * vdev, const gx_path * ppath,
- gx_path_type_t type, const gs_matrix *pmat);
+ gx_path_type_t type, const gs_matrix *pmat);
static int escv_vector_dorect (gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type);
+ fixed y1, gx_path_type_t type);
static int escv_beginpath (gx_device_vector * vdev, gx_path_type_t type);
static int escv_moveto (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
static int escv_lineto (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x, floatp y, gx_path_type_t type);
+ floatp x, floatp y, gx_path_type_t type);
static int escv_curveto (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, gx_path_type_t type);
+ floatp x1, floatp y1, floatp x2, floatp y2,
+ floatp x3, floatp y3, gx_path_type_t type);
static int escv_closepath (gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x_start, floatp y_start, gx_path_type_t type);
+ floatp x_start, floatp y_start, gx_path_type_t type);
static int escv_endpath (gx_device_vector * vdev, gx_path_type_t type);
#endif /* GS_VERSION_MAJOR */
@@ -456,7 +437,6 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int w, int ras);
static void escv_write_end(gx_device *dev, int bits);
-
/* ---------------- Utilities ---------------- */
/* Put a string on a stream.
@@ -482,7 +462,6 @@ put_bytes(stream * s, const byte * data, uint count)
sputs(s, data, count, &used);
}
-
static int
escv_range_check(gx_device * dev)
{
@@ -494,16 +473,16 @@ escv_range_check(gx_device * dev)
/* Paper Size Check */
if (width <= height) { /* portrait */
if ((width < ESCPAGE_WIDTH_MIN ||
- width > ESCPAGE_WIDTH_MAX ||
- height < ESCPAGE_HEIGHT_MIN ||
- height > ESCPAGE_HEIGHT_MAX)) {
+ width > ESCPAGE_WIDTH_MAX ||
+ height < ESCPAGE_HEIGHT_MIN ||
+ height > ESCPAGE_HEIGHT_MAX)) {
return_error(gs_error_rangecheck);
}
} else { /* landscape */
if ((width < ESCPAGE_HEIGHT_MIN ||
- width > ESCPAGE_HEIGHT_MAX ||
- height < ESCPAGE_WIDTH_MIN ||
- height > ESCPAGE_WIDTH_MAX )) {
+ width > ESCPAGE_HEIGHT_MAX ||
+ height < ESCPAGE_WIDTH_MIN ||
+ height > ESCPAGE_WIDTH_MAX )) {
return_error(gs_error_rangecheck);
}
}
@@ -521,16 +500,15 @@ escv_range_check(gx_device * dev)
return 0; /* pass */
}
-
/* ---------------- Vector device implementation ---------------- */
static int
escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
- gx_path_type_t type
+ gx_path_type_t type
#if ( 6 <= GS_VERSION_MAJOR )
- , const gs_matrix *pmat
+ , const gs_matrix *pmat
#endif
- )
+ )
{
gx_device_escv *pdev = (gx_device_escv *) vdev;
bool do_close = (type & gx_path_type_stroke) != 0;
@@ -556,7 +534,6 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
int pe_op, cnt;
const segment *pseg;
-
pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
sw:switch (pe_op) {
@@ -584,8 +561,8 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
do {
(void)sprintf(obuf, ";%d;%d",
- (int)(fixed2float(vs[0]) / scale.x),
- (int)(fixed2float(vs[1]) / scale.y));
+ (int)(fixed2float(vs[0]) / scale.x),
+ (int)(fixed2float(vs[1]) / scale.y));
lputs(s, obuf);
pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
@@ -605,9 +582,9 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
do {
(void)sprintf(obuf, ";%d;%d;%d;%d;%d;%d",
- (int)(fixed2float(vs[0]) / scale.x), (int)(fixed2float(vs[1]) / scale.y),
- (int)(fixed2float(vs[2]) / scale.x), (int)(fixed2float(vs[3]) / scale.y),
- (int)(fixed2float(vs[4]) / scale.x), (int)(fixed2float(vs[5]) / scale.y));
+ (int)(fixed2float(vs[0]) / scale.x), (int)(fixed2float(vs[1]) / scale.y),
+ (int)(fixed2float(vs[2]) / scale.x), (int)(fixed2float(vs[3]) / scale.y),
+ (int)(fixed2float(vs[4]) / scale.x), (int)(fixed2float(vs[5]) / scale.y));
lputs(s, obuf);
pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
@@ -631,7 +608,7 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
lputs(s, ESC_GS "clpG");
if (code < 0)
- return code;
+ return code;
goto sw;
}
return (*vdev_proc(vdev, endpath)) (vdev, type);
@@ -644,10 +621,9 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
}
}
-
static int
escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
- fixed y1, gx_path_type_t type)
+ fixed y1, gx_path_type_t type)
{
gx_device_escv *pdev = (gx_device_escv *) vdev;
int code;
@@ -662,10 +638,10 @@ escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
scale = vdev->scale;
(void)sprintf(obuf, ESC_GS "0;%d;%d;%d;%d;0;0rrpG",
- (int)(fixed2float(x0) / scale.x),
- (int)(fixed2float(y0) / scale.y),
- (int)(fixed2float(x1) / scale.x),
- (int)(fixed2float(y1) / scale.y));
+ (int)(fixed2float(x0) / scale.x),
+ (int)(fixed2float(y0) / scale.y),
+ (int)(fixed2float(x1) / scale.x),
+ (int)(fixed2float(y1) / scale.y));
lputs(s, obuf);
pdev->ispath = 1;
@@ -679,7 +655,6 @@ escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
return (*vdev_proc(vdev, endpath))(vdev, type);
}
-
/* ---------- */
static const EPaperTable ePaperTable[NUM_OF_PAPER_TABLES] =
@@ -717,7 +692,6 @@ escv_checkpapersize(gx_device_vector * vdev)
paper_candidate candidate[NUM_OF_PAPER_TABLES];
int num_candidate;
-
if (pdev->MediaSize[0] < pdev->MediaSize[1]) {
/* portrait */
devw = pdev->MediaSize[0];
@@ -737,35 +711,35 @@ escv_checkpapersize(gx_device_vector * vdev)
for (delta = 0; delta <= MAX_PAPER_SIZE_DELTA; delta++) {
for (pt = ePaperTable; 0 <= pt->escpage; pt++) {
- if ( (pt->width + delta) >= devw &&
- (pt->width - delta) <= devw &&
- (pt->height + delta) >= devh &&
- (pt->height - delta) <= devh) {
-
- candidate[num_candidate].paper = pt;
- candidate[num_candidate].absw = abs(pt->width - devw);
- candidate[num_candidate].absh = abs(pt->height - devh);
- candidate[num_candidate].score = 0;
- candidate[num_candidate].isfillw = false;
- candidate[num_candidate].isfillh = false;
- candidate[num_candidate].isminw = false;
- candidate[num_candidate].isminh = false;
-
- if( 0 <= (pt->width - devw) ){
- candidate[num_candidate].isfillw = true;
- }
- if( 0 <= (pt->height - devh) ){
- candidate[num_candidate].isfillh = true;
- }
- num_candidate++;
- }
+ if ( (pt->width + delta) >= devw &&
+ (pt->width - delta) <= devw &&
+ (pt->height + delta) >= devh &&
+ (pt->height - delta) <= devh) {
+
+ candidate[num_candidate].paper = pt;
+ candidate[num_candidate].absw = abs(pt->width - devw);
+ candidate[num_candidate].absh = abs(pt->height - devh);
+ candidate[num_candidate].score = 0;
+ candidate[num_candidate].isfillw = false;
+ candidate[num_candidate].isfillh = false;
+ candidate[num_candidate].isminw = false;
+ candidate[num_candidate].isminh = false;
+
+ if( 0 <= (pt->width - devw) ){
+ candidate[num_candidate].isfillw = true;
+ }
+ if( 0 <= (pt->height - devh) ){
+ candidate[num_candidate].isfillh = true;
+ }
+ num_candidate++;
+ }
}
if ( 0 < num_candidate ) {
- break;
+ break;
}
}
}
-
+
/* no papersize match, so use default paper size */
if ( 0 == num_candidate ) {
return (const EPaperTable *)0; /* not found */
@@ -785,45 +759,45 @@ escv_checkpapersize(gx_device_vector * vdev)
absminh = candidate[0].absh;
for (i = 1; i < num_candidate; i++) {
if (absminw > candidate[i].absw) {
- absminw = candidate[i].absw;
+ absminw = candidate[i].absw;
}
if (absminh > candidate[i].absh) {
- absminh = candidate[i].absh;
+ absminh = candidate[i].absh;
}
}
/* check isminw & isminh flag */
for (i = 0; i < num_candidate; i++) {
if (absminw == candidate[i].absw) {
- candidate[i].isminw = true;
+ candidate[i].isminw = true;
}
if (absminh == candidate[i].absh) {
- candidate[i].isminh = true;
+ candidate[i].isminh = true;
}
}
/* add score */
for (i = 0; i < num_candidate; i++) {
if (candidate[i].isminw == true) {
- candidate[i].score += 100;
+ candidate[i].score += 100;
}
if (candidate[i].isminh == true) {
- candidate[i].score += 100;
+ candidate[i].score += 100;
}
if (candidate[i].isfillw == true) {
- candidate[i].score += 10;
+ candidate[i].score += 10;
}
if (candidate[i].isfillh == true) {
- candidate[i].score += 10;
+ candidate[i].score += 10;
}
if (absminw < absminh) {
- if (candidate[i].isminw == true) {
- candidate[i].score += 1;
- }
+ if (candidate[i].isminw == true) {
+ candidate[i].score += 1;
+ }
} else {
- if (candidate[i].isminh == true) {
- candidate[i].score += 1;
- }
+ if (candidate[i].isminh == true) {
+ candidate[i].score += 1;
+ }
}
}
}
@@ -836,7 +810,7 @@ escv_checkpapersize(gx_device_vector * vdev)
best_candidate = 0;
for (i = 1; i < num_candidate; i++) {
if ( candidate[best_candidate].score <= candidate[i].score ) {
- best_candidate = i;
+ best_candidate = i;
}
}
return candidate[best_candidate].paper;
@@ -859,7 +833,7 @@ get_sysname ( void )
/* EPSON printer model name translation.
return: 0 unknown model, not translated.
1 completed.
- -1 error. ... This value not return now.
+ -1 error. ... This value not return now.
*/
static int
trans_modelname ( char *dest, const char * src, size_t dest_len )
@@ -898,7 +872,6 @@ trans_modelname ( char *dest, const char * src, size_t dest_len )
return 1;
}
-
static int
escv_beginpage(gx_device_vector * vdev)
{
@@ -984,7 +957,6 @@ escv_beginpage(gx_device_vector * vdev)
if ( !*pdev->JobID )
strcpy(pdev->JobID, "0");
-
lputs(s, "\033\001@EJL \012");
lputs(s, "@EJL SJ ID=\"");
@@ -1002,16 +974,16 @@ escv_beginpage(gx_device_vector * vdev)
lputs(s, " DATE=\"");
{
- struct tm *tm;
- char str[32];
- size_t i;
+ struct tm *tm;
+ char str[32];
+ size_t i;
- tm = localtime( &t );
- i = strftime(str, 30, "%Y/%m/%d %H:%M:%S", tm);
- if ( 30 >= i )
- str[i] = '\0';
+ tm = localtime( &t );
+ i = strftime(str, 30, "%Y/%m/%d %H:%M:%S", tm);
+ if ( 30 >= i )
+ str[i] = '\0';
- lputs(s, str);
+ lputs(s, str);
}
lputs(s, "\"");
@@ -1022,17 +994,17 @@ escv_beginpage(gx_device_vector * vdev)
{
lputs(s, " USER=\"");
if ( *pdev->UserName )
- lputs(s, pdev->UserName);
+ lputs(s, pdev->UserName);
lputs(s, "\"");
lputs(s, " MACHINE=\"");
if ( *pdev->HostName )
- lputs(s, pdev->HostName);
+ lputs(s, pdev->HostName);
lputs(s, "\"");
lputs(s, " DOCUMENT=\"");
if ( *pdev->Document )
- lputs(s, pdev->Document);
+ lputs(s, pdev->Document);
lputs(s, "\"");
}
lputs(s, "\012");
@@ -1041,34 +1013,32 @@ escv_beginpage(gx_device_vector * vdev)
{
char *sysname = get_sysname ();
if (sysname)
- {
- lputs(s, sysname );
- free (sysname);
- sysname = NULL;
- }
+ {
+ lputs(s, sysname );
+ free (sysname);
+ sysname = NULL;
+ }
}
lputs(s, "\"\012");
-
if ( ( 0 == strcmp( pdev->dname, ESCPAGE_DEVICENAME_COLOR ) ) ||
- ( 0 == strcmp( pdev->dname, ESCPAGE_DEVICENAME_MONO ) ) )
+ ( 0 == strcmp( pdev->dname, ESCPAGE_DEVICENAME_MONO ) ) )
{
- Local = pdev->modelJP;
- FaceUp = pdev->capFaceUp;
- Duplex = pdev->capDuplexUnit;
- MaxRes = pdev->capMaxResolution;
+ Local = pdev->modelJP;
+ FaceUp = pdev->capFaceUp;
+ Duplex = pdev->capDuplexUnit;
+ MaxRes = pdev->capMaxResolution;
- lputs(s, "@EJL JI DRIVER=\"");
- lputs(s, pdev->dname);
- lputs(s, "\"\012");
+ lputs(s, "@EJL JI DRIVER=\"");
+ lputs(s, pdev->dname);
+ lputs(s, "\"\012");
- lputs(s, "@EJL JI PRINTER=\"");
- lputs(s, pdev->dname);
- lputs(s, "\"\012");
+ lputs(s, "@EJL JI PRINTER=\"");
+ lputs(s, pdev->dname);
+ lputs(s, "\"\012");
} else {
-
char _modelname[ ESCPAGE_MODELNAME_MAX + 1 ] = {0,};
const char *modelname;
int i;
@@ -1076,23 +1046,23 @@ escv_beginpage(gx_device_vector * vdev)
modelname = pdev->dname;
for ( i = 0; (-1) != model_resource[i].resolution; i++ ) {
- if ( 0 == strcmp( pdev->dname, model_resource[i].name ) )
- break;
+ if ( 0 == strcmp( pdev->dname, model_resource[i].name ) )
+ break;
}
lputs(s, "@EJL JI DRIVER=\"");
if ( (-1) != model_resource[i].resolution ) {
- MaxRes = model_resource[i].resolution;
- Local = model_resource[i].locale;
- Duplex = model_resource[i].duplex;
- FaceUp = model_resource[i].faceup;
+ MaxRes = model_resource[i].resolution;
+ Local = model_resource[i].locale;
+ Duplex = model_resource[i].duplex;
+ FaceUp = model_resource[i].faceup;
- if ( 0 <= trans_modelname( _modelname, model_resource[i].name, ESCPAGE_MODELNAME_MAX ) )
- modelname = _modelname;
+ if ( 0 <= trans_modelname( _modelname, model_resource[i].name, ESCPAGE_MODELNAME_MAX ) )
+ modelname = _modelname;
- lputs(s, modelname);
+ lputs(s, modelname);
} else {
- lputs(s, "Ghostscript");
+ lputs(s, "Ghostscript");
}
lputs(s, "\"\012");
@@ -1114,9 +1084,9 @@ escv_beginpage(gx_device_vector * vdev)
/* Resolusion */
if (vdev->x_pixels_per_inch == 1200){
if (MaxRes == 1200){
- lputs(s, " RS=1200");
+ lputs(s, " RS=1200");
} else {
- lputs(s, " RS=FN");
+ lputs(s, " RS=FN");
}
} else if (vdev->x_pixels_per_inch == 600) {
lputs(s, " RS=FN");
@@ -1134,22 +1104,22 @@ escv_beginpage(gx_device_vector * vdev)
/* Paper unit */
if (pdev->MediaType){
if (Local == ENG){
- lputs(s, " PU=1");
+ lputs(s, " PU=1");
} else {
- lputs(s, " PU=15");
+ lputs(s, " PU=15");
}
}else{
if (pdev->manualFeed) {
- if (Local == ENG){
- lputs(s, " PU=1");
- } else {
- lputs(s, " PU=15");
- }
+ if (Local == ENG){
+ lputs(s, " PU=1");
+ } else {
+ lputs(s, " PU=15");
+ }
} else if (pdev->cassetFeed) {
- (void)sprintf(ebuf, " PU=%d", pdev->cassetFeed);
- lputs(s, ebuf);
+ (void)sprintf(ebuf, " PU=%d", pdev->cassetFeed);
+ lputs(s, ebuf);
} else {
- lputs(s, " PU=AU");
+ lputs(s, " PU=AU");
}
}
@@ -1159,9 +1129,9 @@ escv_beginpage(gx_device_vector * vdev)
/* binding type */
if (pdev->Tumble) {
- lputs(s, " BD=SE");
+ lputs(s, " BD=SE");
} else {
- lputs(s, " BD=LE");
+ lputs(s, " BD=LE");
}
} else {
/* Duplex off */
@@ -1171,20 +1141,20 @@ escv_beginpage(gx_device_vector * vdev)
/* Number of copies */
if (pdev->NumCopies) {
if (pdev->NumCopies >= 1000) {
- pdev->NumCopies = 999;
+ pdev->NumCopies = 999;
}
/* lp8000c not have QT */
if (strcmp(pdev->dname, "lp8000c") == 0) {
- (void)sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
+ (void)sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
} else {
- if (pdev->Collate) {
- /* CO is 1, when set QT */
- (void)sprintf(ebuf, " QT=%d CO=1", pdev->NumCopies);
- } else {
- /* QT is 1, when not specified QT */
- (void)sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
- }
+ if (pdev->Collate) {
+ /* CO is 1, when set QT */
+ (void)sprintf(ebuf, " QT=%d CO=1", pdev->NumCopies);
+ } else {
+ /* QT is 1, when not specified QT */
+ (void)sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
+ }
}
lputs(s, ebuf);
} else {
@@ -1230,13 +1200,12 @@ escv_beginpage(gx_device_vector * vdev)
pt = escv_checkpapersize(vdev);
if ( 0 == pt ) {
- lputs(s, "A4");
+ lputs(s, "A4");
} else {
- lputs(s, pt->name);
+ lputs(s, pt->name);
}
}
-
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
#define START_CODE1 ESC_GS "1tsE" ESC_GS "1owE" ESC_GS "0alfP" ESC_GS "0affP" ESC_GS "0;0;0clfP" ESC_GS "0pmP" ESC_GS "1024ibI" ESC_GS "2cmE" ESC_GS "0bcI" ESC_GS "1;10mlG"
@@ -1251,21 +1220,21 @@ escv_beginpage(gx_device_vector * vdev)
lputs(s, STRAT_CODE);
if (vdev->x_pixels_per_inch == 1200) {
- /* 1200 dpi */
- lputs(s, ESC_GS "0;0.06muE");
- lputs(s, ESC_GS "1;45;156htmE");
- lputs(s, ESC_GS "9;1200;1200drE" ESC_GS "2;1200;1200drE" ESC_GS "1;1200;1200drE" ESC_GS "0;1200;1200drE");
- lputs(s, ESC_GS "1;1;raE");
+ /* 1200 dpi */
+ lputs(s, ESC_GS "0;0.06muE");
+ lputs(s, ESC_GS "1;45;156htmE");
+ lputs(s, ESC_GS "9;1200;1200drE" ESC_GS "2;1200;1200drE" ESC_GS "1;1200;1200drE" ESC_GS "0;1200;1200drE");
+ lputs(s, ESC_GS "1;1;raE");
} else if (vdev->x_pixels_per_inch == 600) {
- /* 600 dpi */
- lputs(s, ESC_GS "0;0.12muE");
- lputs(s, ESC_GS "1;45;106htmE");
- lputs(s, ESC_GS "9;600;600drE" ESC_GS "2;600;600drE" ESC_GS "1;600;600drE" ESC_GS "0;600;600drE");
+ /* 600 dpi */
+ lputs(s, ESC_GS "0;0.12muE");
+ lputs(s, ESC_GS "1;45;106htmE");
+ lputs(s, ESC_GS "9;600;600drE" ESC_GS "2;600;600drE" ESC_GS "1;600;600drE" ESC_GS "0;600;600drE");
} else {
- /* 300 dpi */
- lputs(s, ESC_GS "0;0.24muE");
- lputs(s, ESC_GS "1;45;71htmE");
- lputs(s, ESC_GS "9;300;300drE" ESC_GS "2;300;300drE" ESC_GS "1;300;300drE" ESC_GS "0;300;300drE");
+ /* 300 dpi */
+ lputs(s, ESC_GS "0;0.24muE");
+ lputs(s, ESC_GS "1;45;71htmE");
+ lputs(s, ESC_GS "9;300;300drE" ESC_GS "2;300;300drE" ESC_GS "1;300;300drE" ESC_GS "0;300;300drE");
}
lputs(s, START_CODE1);
@@ -1281,33 +1250,32 @@ escv_beginpage(gx_device_vector * vdev)
#define LP8200_CODE ESC_GS "0pddO" ESC_GS "0;0cmmE" ESC_GS "1;2;3ccmE" ESC_GS "2;2;3ccmE" ESC_GS "3;2;4ccmE" ESC_GS "1;1raE" ESC_GS "2;1raE" ESC_GS "3;1raE"
-
lputs(s, " ZO=OFF EC=ON SZ=OFF SL=YES TO=0 LO=0\012");
lputs(s, "@EJL EN LA=ESC/PAGE-COLOR\012");
lputs(s, ESC_GS "rhE");
if (strcmp(vdev -> dname, "lp8000c") == 0) {
- lputs(s, LP8000_CODE);
+ lputs(s, LP8000_CODE);
} else {
- lputs(s, LP8200_CODE);
+ lputs(s, LP8200_CODE);
}
put_bytes(s, ESC_GS "7;0;2;0cam{E\012\000\000\000\000\000\000", 20);
lputs(s, ESC_GS "0;0cmmE");
if (vdev->x_pixels_per_inch == 1200) {
- /* 1200 dpi */
- lputs(s, ESC_GS "0;0.06muE");
- lputs(s, ESC_GS "3;1200;1200drE" ESC_GS "2;1200;1200drE" ESC_GS "1;1200;1200drE" ESC_GS "0;1200;1200drE");
+ /* 1200 dpi */
+ lputs(s, ESC_GS "0;0.06muE");
+ lputs(s, ESC_GS "3;1200;1200drE" ESC_GS "2;1200;1200drE" ESC_GS "1;1200;1200drE" ESC_GS "0;1200;1200drE");
} else if (vdev->x_pixels_per_inch == 600) {
- /* 600 dpi */
- lputs(s, ESC_GS "0;0.12muE");
- lputs(s, ESC_GS "3;600;600drE" ESC_GS "2;600;600drE" ESC_GS "1;600;600drE" ESC_GS "0;600;600drE");
+ /* 600 dpi */
+ lputs(s, ESC_GS "0;0.12muE");
+ lputs(s, ESC_GS "3;600;600drE" ESC_GS "2;600;600drE" ESC_GS "1;600;600drE" ESC_GS "0;600;600drE");
} else {
- /* 300 dpi */
- lputs(s, ESC_GS "0;0.24muE");
- lputs(s, ESC_GS "3;300;300drE" ESC_GS "2;300;300drE" ESC_GS "1;300;300drE" ESC_GS "0;300;300drE");
+ /* 300 dpi */
+ lputs(s, ESC_GS "0;0.24muE");
+ lputs(s, ESC_GS "3;300;300drE" ESC_GS "2;300;300drE" ESC_GS "1;300;300drE" ESC_GS "0;300;300drE");
}
lputs(s, ESC_GS "0;0loE");
@@ -1323,11 +1291,10 @@ escv_beginpage(gx_device_vector * vdev)
} /* ESC/Page-Color */
}
-
+
return 0;
}
-
static int
escv_setlinewidth(gx_device_vector * vdev, floatp width)
{
@@ -1354,15 +1321,14 @@ escv_setlinewidth(gx_device_vector * vdev, floatp width)
pdev -> lwidth = width;
(void)sprintf(obuf, ESC_GS "%d;%d;%dlwG",
- (int)(pdev -> lwidth),
- (int)(pdev -> cap),
- (int)(pdev -> join));
+ (int)(pdev -> lwidth),
+ (int)(pdev -> cap),
+ (int)(pdev -> join));
lputs(s, obuf);
return 0;
}
-
static int
escv_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
{
@@ -1376,15 +1342,14 @@ escv_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
if (pdev -> cap >= 3) return -1;
(void)sprintf(obuf, ESC_GS "%d;%d;%dlwG",
- (int)(pdev -> lwidth),
- (int)(pdev -> cap),
- (int)(pdev -> join));
+ (int)(pdev -> lwidth),
+ (int)(pdev -> cap),
+ (int)(pdev -> join));
lputs(s, obuf);
return 0;
}
-
static int
escv_setlinejoin(gx_device_vector * vdev, gs_line_join join)
{
@@ -1408,15 +1373,14 @@ escv_setlinejoin(gx_device_vector * vdev, gs_line_join join)
}
(void)sprintf(obuf, ESC_GS "%d;%d;%dlwG",
- (int)(pdev -> lwidth),
- (int)(pdev -> cap),
- (int)(pdev -> join));
+ (int)(pdev -> lwidth),
+ (int)(pdev -> cap),
+ (int)(pdev -> join));
lputs(s, obuf);
return 0;
}
-
static int
escv_setmiterlimit(gx_device_vector * vdev, floatp limit)
{
@@ -1431,9 +1395,9 @@ escv_setmiterlimit(gx_device_vector * vdev, floatp limit)
/* ¶¯À©Åª¤ËÀܹçÉô»ØÄê¤ò¹Ô¤¦ */
pdev -> join = 3;
(void)sprintf(obuf, ESC_GS "%d;%d;%dlwG",
- (int)(pdev -> lwidth),
- (int)(pdev -> cap),
- (int)(pdev -> join));
+ (int)(pdev -> lwidth),
+ (int)(pdev -> cap),
+ (int)(pdev -> join));
lputs(s, obuf);
}
@@ -1443,23 +1407,21 @@ escv_setmiterlimit(gx_device_vector * vdev, floatp limit)
return 0;
}
-
#if ( 8 <= GS_VERSION_MAJOR )
static bool
-escv_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
+escv_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc)
{
return false;
}
#endif
-
static int
escv_setfillcolor(gx_device_vector * vdev,
#if ( 8 <= GS_VERSION_MAJOR )
- const gs_imager_state * pis,
+ const gs_imager_state * pis,
#endif
- const gx_drawing_color * pdc)
+ const gx_drawing_color * pdc)
{
stream *s = gdev_vector_stream(vdev);
gx_device_escv *const pdev = (gx_device_escv *) vdev;
@@ -1484,12 +1446,11 @@ escv_setfillcolor(gx_device_vector * vdev,
} else { /* ESC/Page-Color */
-
/* ¥Ñ¥¿¡¼¥ó£Ï£Î»ØÄê¡¿¥½¥ê¥Ã¥É¥Ñ¥¿¡¼¥ó»ØÄê */
(void)sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE",
- (unsigned char)(color >> 16 & 0xff),
- (unsigned char)(color >> 8 & 0xff),
- (unsigned char)(color & 0xff));
+ (unsigned char)(color >> 16 & 0xff),
+ (unsigned char)(color >> 8 & 0xff),
+ (unsigned char)(color & 0xff));
lputs(s, obuf);
lputs(s, ESC_GS "3;2;1;0;0cpE" ESC_GS "1;2;1;0;0cpE" ESC_GS "5;2;1;0;0cpE");
@@ -1498,13 +1459,12 @@ escv_setfillcolor(gx_device_vector * vdev,
return 0;
}
-
static int
escv_setstrokecolor(gx_device_vector * vdev,
#if ( 8 <= GS_VERSION_MAJOR )
- const gs_imager_state * pis,
+ const gs_imager_state * pis,
#endif
- const gx_drawing_color * pdc)
+ const gx_drawing_color * pdc)
{
stream *s = gdev_vector_stream(vdev);
gx_device_escv *const pdev = (gx_device_escv *) vdev;
@@ -1535,9 +1495,9 @@ escv_setstrokecolor(gx_device_vector * vdev,
pdev->current_color = color;
/* ¥Ñ¥¿¡¼¥ó£Ï£Î¿§»ØÄê¡¿¥½¥ê¥Ã¥É¥Ñ¥¿¡¼¥ó»ØÄê */
(void)sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE" ESC_GS "2;2;1;0;0cpE",
- (unsigned char)(color >> 16 & 0xff),
- (unsigned char)(color >> 8 & 0xff),
- (unsigned char)(color & 0xff));
+ (unsigned char)(color >> 16 & 0xff),
+ (unsigned char)(color >> 8 & 0xff),
+ (unsigned char)(color & 0xff));
lputs(s, obuf);
}
@@ -1546,7 +1506,6 @@ escv_setstrokecolor(gx_device_vector * vdev,
return 0;
}
-
/* Àþ¼ï»ØÄêÌ¿Îá */
static int
escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, floatp offset)
@@ -1572,16 +1531,16 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, floatp o
lputs(s, ESC_GS "0;0lpG");
return 0;
}
-
+
/* offset ¤¬£°°Ê³°¤Î¾ì¹ç¤ÏÉÁ²èÉԲĤȤ·¤ÆÊÖµÑ */
if (offset != 0) return -1;
if (count) {
if (count == 1) {
#if GS_VERSION_MAJOR == 5
- (void)sprintf(obuf, ESC_GS "1;%d;%ddlG",
- (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5),
- (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5));
+ (void)sprintf(obuf, ESC_GS "1;%d;%ddlG",
+ (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5),
+ (int)(pattern[0] * scale / vdev->x_pixels_per_inch + 0.5));
#else
(void)sprintf(obuf, ESC_GS "1;%d;%ddlG", (int) pattern[0], (int) pattern[0]);
#endif
@@ -1589,18 +1548,18 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, floatp o
} else {
/* pattern ¤Ë£°¤¬¤¢¤Ã¤¿¾ì¹ç¤ÏÉÁ²èÉԲĤȤ·¤ÆÊÖµÑ */
for (i = 0; i < count; ++i) {
- if (pattern[i] == 0) return -1;
+ if (pattern[i] == 0) return -1;
}
lputs(s, ESC_GS "1");
for (i = 0; i < count; ++i) {
#if GS_VERSION_MAJOR == 5
- (void)sprintf(obuf, ";%d", (int)(pattern[i] * scale / vdev->x_pixels_per_inch + 0.5));
+ (void)sprintf(obuf, ";%d", (int)(pattern[i] * scale / vdev->x_pixels_per_inch + 0.5));
#else
- (void)sprintf(obuf, ";%d", (int) pattern[i]);
+ (void)sprintf(obuf, ";%d", (int) pattern[i]);
#endif
- lputs(s, obuf);
+ lputs(s, obuf);
}
lputs(s, "dlG");
}
@@ -1609,7 +1568,6 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, floatp o
return 0;
}
-
/* ¥Ñ¥¹Ê¿³êÅÙ»ØÄê */
static int
escv_setflat(gx_device_vector * vdev, floatp flatness)
@@ -1617,16 +1575,14 @@ escv_setflat(gx_device_vector * vdev, floatp flatness)
return 0;
}
-
static int
escv_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff)
+ gs_logical_operation_t diff)
{
/****** SHOULD AT LEAST DETECT SET-0 & SET-1 ******/
return 0;
}
-
static int
escv_beginpath(gx_device_vector * vdev, gx_path_type_t type)
{
@@ -1644,10 +1600,9 @@ escv_beginpath(gx_device_vector * vdev, gx_path_type_t type)
return 0;
}
-
static int
escv_moveto(gx_device_vector * vdev,
- floatp x0, floatp y0, floatp x1, floatp y1, gx_path_type_t type)
+ floatp x0, floatp y0, floatp x1, floatp y1, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
char obuf[64];
@@ -1659,10 +1614,9 @@ escv_moveto(gx_device_vector * vdev,
return 0;
}
-
static int
escv_lineto(gx_device_vector * vdev,
- floatp x0, floatp y0, floatp x1, floatp y1, gx_path_type_t type)
+ floatp x0, floatp y0, floatp x1, floatp y1, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
gx_device_escv *pdev = (gx_device_escv *) vdev;
@@ -1675,11 +1629,10 @@ escv_lineto(gx_device_vector * vdev,
return 0;
}
-
static int
escv_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
gx_device_escv *pdev = (gx_device_escv *) vdev;
@@ -1687,17 +1640,16 @@ escv_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
/* ¥Ù¥¸¥§¶ÊÀþ */
(void)sprintf(obuf, ESC_GS "0;3;%d;%d;%d;%d;%d;%dbzpG",
- (int)x1, (int)y1, (int)x2, (int)y2, (int)x3, (int)y3);
+ (int)x1, (int)y1, (int)x2, (int)y2, (int)x3, (int)y3);
lputs(s, obuf);
pdev->ispath = 1;
return 0;
}
-
static int
escv_closepath(gx_device_vector * vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
@@ -1705,7 +1657,6 @@ escv_closepath(gx_device_vector * vdev, floatp x, floatp y,
return 0;
}
-
static int
escv_endpath(gx_device_vector * vdev, gx_path_type_t type)
{
@@ -1726,7 +1677,7 @@ escv_endpath(gx_device_vector * vdev, gx_path_type_t type)
if ( ( 0 != ESCV_FORCEDRAWPATH ) || ( 0 != pdev->ispath ) ) {
/* ¥¯¥ê¥Ã¥×»ØÄê
** ¥¯¥ê¥Ã¥×¤Ë¤â gx_path_type_winding_number, gx_path_type_even_odd ¤ÎȽÃǤ¬
- ** ɬÍפÀ¤È»×¤¦¤¬ gs ¦¤¬Éղ䷤Ƥ³¤Ê¤¤¡£
+ ** ɬÍפÀ¤È»×¤¦¤¬ gs ¦¤¬Éղ䷤Ƥ³¤Ê¤¤¡£
** ¤È¤ê¤¢¤¨¤º gx_path_type_even_odd ¤ò¥Ç¥Õ¥©¥ë¥È¤Ë¤¹¤ë¡£
*/
lputs(s, ESC_GS "1;2capG");
@@ -1739,7 +1690,7 @@ escv_endpath(gx_device_vector * vdev, gx_path_type_t type)
} else {
lputs(s, ESC_GS "0;1drpG"); /* Åɤê¤Ä¤Ö¤·ÉÁ²è */
}
- } else {
+ } else {
lputs(s, ESC_GS "0;0drpG"); /* ÎسÔÀþÉÁ²è */
}
@@ -1768,7 +1719,7 @@ escv_open(gx_device * dev)
vdev->vec_procs = &escv_vector_procs;
code = gdev_vector_open_file_options(vdev, 512, VECTOR_OPEN_FILE_BBOX
- | VECTOR_OPEN_FILE_SEQUENTIAL_OK);
+ | VECTOR_OPEN_FILE_SEQUENTIAL_OK);
if (code < 0) return code;
gdev_vector_init(vdev);
@@ -1779,15 +1730,15 @@ escv_open(gx_device * dev)
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
pdev->Margins[1] = (pdev->width - pdev->height - \
- ESCPAGE_LEFT_MARGIN_DEFAULT * vdev->x_pixels_per_inch / 72.0) * \
- X_DPI / vdev->x_pixels_per_inch;
+ ESCPAGE_LEFT_MARGIN_DEFAULT * vdev->x_pixels_per_inch / 72.0) * \
+ X_DPI / vdev->x_pixels_per_inch;
} else { /* ESC/Page-Color */
/* pdev->Margins[1] = pdev->width - pdev->height + dev->HWMargins[0];
*/
pdev->Margins[1] = (pdev->width - pdev->height) * \
- X_DPI / vdev->x_pixels_per_inch;
+ X_DPI / vdev->x_pixels_per_inch;
} /* ESC/Page-Color */
@@ -1800,7 +1751,6 @@ escv_open(gx_device * dev)
return 0;
}
-
/* Wrap up ("output") a page. */
static int
escv_output_page(gx_device * dev, int num_copies, int flush)
@@ -1821,7 +1771,6 @@ escv_output_page(gx_device * dev, int num_copies, int flush)
return 0;
}
-
static int
escv_close(gx_device *dev)
{
@@ -1842,7 +1791,6 @@ escv_close(gx_device *dev)
/* ---------------- Get/put parameters ---------------- */
-
static int
escv_get_str_param( gs_param_list * plist, gs_param_name key, gs_param_string *pgsstr, int code )
{
@@ -1921,7 +1869,6 @@ escv_get_params(gx_device * dev, gs_param_list * plist)
return code;
}
-
static int
escv_set_str_param( gs_param_list * plist, const char * key, char *strvalue, int bufmax, int ecode )
{
@@ -1977,7 +1924,6 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
ecode = escv_set_str_param( plist, ESCPAGE_OPTION_DOCUMENT, pdev->Document, ESCPAGE_DOCUMENT_MAX, ecode );
ecode = escv_set_str_param( plist, ESCPAGE_OPTION_COMMENT, pdev->Comment, ESCPAGE_COMMENT_MAX, ecode );
-
modelJP = pdev->modelJP;
param_name = ESCPAGE_OPTION_EPLModelJP;
code = param_read_bool(plist, param_name, &modelJP);
@@ -2012,9 +1958,9 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
case 0:
if ( ( 600 != capMaxResolution ) &&
- ( 1200 != capMaxResolution ) ) {
- ecode = gs_error_limitcheck;
- goto maxrese;
+ ( 1200 != capMaxResolution ) ) {
+ ecode = gs_error_limitcheck;
+ goto maxrese;
}
break;
@@ -2059,30 +2005,30 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
} else { /* Check the validity of ``MediaType'' characters */
if (strcmp(pmedia.data, "NM") == 0) {
- pdev->MediaType = 0;
+ pdev->MediaType = 0;
} else if ((strcmp(pmedia.data, "THICK") == 0) ||
- (strcmp(pmedia.data, "TH") == 0)) {
- pdev->MediaType = 1;
+ (strcmp(pmedia.data, "TH") == 0)) {
+ pdev->MediaType = 1;
} else if ((strcmp(pmedia.data, "TRANS") == 0) ||
- (strcmp(pmedia.data, "TR") == 0)) {
- pdev->MediaType = 2;
+ (strcmp(pmedia.data, "TR") == 0)) {
+ pdev->MediaType = 2;
} else if (strcmp(pmedia.data, "TN") == 0) {
- pdev->MediaType = 3;
+ pdev->MediaType = 3;
} else if (strcmp(pmedia.data, "LH") == 0) {
- pdev->MediaType = 4;
+ pdev->MediaType = 4;
} else if (strcmp(pmedia.data, "CT") == 0) {
- pdev->MediaType = 5;
+ pdev->MediaType = 5;
} else if (strcmp(pmedia.data, "ET") == 0) {
- pdev->MediaType = 6;
+ pdev->MediaType = 6;
} else if (strcmp(pmedia.data, "HQ") == 0) {
- pdev->MediaType = 7;
+ pdev->MediaType = 7;
} else if (strcmp(pmedia.data, "UT") == 0) {
- pdev->MediaType = 8;
+ pdev->MediaType = 8;
} else if (strcmp(pmedia.data, "UM") == 0) {
- pdev->MediaType = 9;
+ pdev->MediaType = 9;
} else {
- ecode = gs_error_rangecheck;
- goto pmediae;
+ ecode = gs_error_rangecheck;
+ goto pmediae;
}
}
break;
@@ -2099,7 +2045,7 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
}
switch (code = param_read_int(plist,
- (param_name = ESCPAGE_OPTION_TONERDENSITY), &toner_density)) {
+ (param_name = ESCPAGE_OPTION_TONERDENSITY), &toner_density)) {
case 0:
if (toner_density < 0 || toner_density > 5)
ecode = gs_error_rangecheck;
@@ -2124,7 +2070,7 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
ecode = code;
param_signal_error(plist, param_name, ecode);
case 1:
- break;
+ break;
}
if ((code = param_read_bool(plist, (param_name = ESCPAGE_OPTION_DUPLEX), &duplex)) < 0)
@@ -2140,7 +2086,6 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
param_signal_error(plist, param_name, ecode = code);
}
-
switch (code = param_read_int(plist, (param_name = "BitsPerPixel"), &bpp)) {
case 0:
if (bpp != 8 && bpp != 24)
@@ -2194,11 +2139,10 @@ escv_put_params(gx_device * dev, gs_param_list * plist)
/* ---------------- Images ---------------- */
-
static int
escv_copy_mono(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w, int h,
+ gx_color_index zero, gx_color_index one)
{
gx_device_escv *const pdev = (gx_device_escv *) dev;
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -2219,9 +2163,9 @@ escv_copy_mono(gx_device * dev, const byte * data,
color_set_pure(&dcolor, one);
escv_setfillcolor(vdev,
#if ( 8 <= GS_VERSION_MAJOR )
- pis,
+ pis,
#endif
- &dcolor); /* FIXME! gs815 */
+ &dcolor); /* FIXME! gs815 */
}
if (zero == gx_no_color_index) {
@@ -2231,26 +2175,26 @@ escv_copy_mono(gx_device * dev, const byte * data,
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/
- (void)sprintf(obuf, ESC_GS "1;1;%ldccE", c_color);
- lputs(s, obuf);
+ /* lputs(s, ESC_GS "1owE");*/
+ (void)sprintf(obuf, ESC_GS "1;1;%ldccE", c_color);
+ lputs(s, obuf);
- if (vdev->x_pixels_per_inch == 1200) {
- lputs(s, ESC_GS "1;45;156htmE");
- } else if (vdev->x_pixels_per_inch == 600) {
- lputs(s, ESC_GS "1;45;106htmE");
- } else {
- lputs(s, ESC_GS "1;45;71htmE");
- }
+ if (vdev->x_pixels_per_inch == 1200) {
+ lputs(s, ESC_GS "1;45;156htmE");
+ } else if (vdev->x_pixels_per_inch == 600) {
+ lputs(s, ESC_GS "1;45;106htmE");
+ } else {
+ lputs(s, ESC_GS "1;45;71htmE");
+ }
} else { /* ESC/Page-Color */
- lputs(s, ESC_GS "2;184wfE" ESC_GS "3;184wfE" ESC_GS "5;184wfE");
+ lputs(s, ESC_GS "2;184wfE" ESC_GS "3;184wfE" ESC_GS "5;184wfE");
} /* ESC/Page-Color */
- pdev->MaskState = 1;
- }
+ pdev->MaskState = 1;
+ }
c_color = one;
} else if (one == gx_no_color_index)
@@ -2258,58 +2202,58 @@ escv_copy_mono(gx_device * dev, const byte * data,
{
if (pdev->MaskState != 1) {
- if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
+ if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/
+ /* lputs(s, ESC_GS "1owE");*/
- } else { /* ESC/Page-Color */
+ } else { /* ESC/Page-Color */
- lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
+ lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
- } /* ESC/Page-Color */
+ } /* ESC/Page-Color */
- pdev->MaskState = 1;
+ pdev->MaskState = 1;
}
c_color = zero;
} else if (one == vdev->white) {
if (pdev->MaskState != 0) {
- if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
+ if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/
+ /* lputs(s, ESC_GS "1owE");*/
- } else { /* ESC/Page-Color */
+ } else { /* ESC/Page-Color */
- lputs(s, ESC_GS "3;204wfE" ESC_GS "5;204wfE");
+ lputs(s, ESC_GS "3;204wfE" ESC_GS "5;204wfE");
- } /* ESC/Page-Color */
+ } /* ESC/Page-Color */
- pdev->MaskState = 0;
+ pdev->MaskState = 0;
}
c_color = zero;
} else {
if (pdev->MaskState != 1) {
- if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
+ if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/
+ /* lputs(s, ESC_GS "1owE");*/
- } else { /* ESC/Page-Color */
+ } else { /* ESC/Page-Color */
- lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
+ lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
- } /* ESC/Page-Color */
+ } /* ESC/Page-Color */
- pdev->MaskState = 1;
+ pdev->MaskState = 1;
}
color_set_pure(&color, one);
code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
#if ( 8 <= GS_VERSION_MAJOR )
- pis,
+ pis,
#endif
- &color);
+ &color);
/* ¤³¤³¤òÄ̲ᤷ¤¿¤é°Ê²¼¤Î¿§ÀßÄê¤Ï̵°ÕÌ£¡© */
}
@@ -2320,9 +2264,9 @@ escv_copy_mono(gx_device * dev, const byte * data,
/* ¥Ñ¥¿¡¼¥ó£Ï£Î»ØÄê¡¿¥½¥ê¥Ã¥É¥Ñ¥¿¡¼¥ó»ØÄê */
(void)sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE",
- (unsigned char)(c_color >> 16 & 0xff),
- (unsigned char)(c_color >> 8 & 0xff),
- (unsigned char)(c_color & 0xff));
+ (unsigned char)(c_color >> 16 & 0xff),
+ (unsigned char)(c_color >> 8 & 0xff),
+ (unsigned char)(c_color & 0xff));
lputs(s, obuf);
lputs(s, ESC_GS "5;2;1;0;0cpE");
@@ -2333,21 +2277,21 @@ escv_copy_mono(gx_device * dev, const byte * data,
{
int i, j;
uint width_bytes = (w + 7) >> 3;
- uint num_bytes = width_bytes * h;
+ uint num_bytes = width_bytes * h;
byte *buf = gs_alloc_bytes(vdev->memory, num_bytes, "escv_copy_mono(buf)");
if (data_x % 8 == 0) {
for (i = 0; i < h; ++i) {
- memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes);
+ memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes);
}
} else {
for (i = 0; i < h; ++i) {
- for (j = 0; j < width_bytes; j++) {
- *(buf + i * width_bytes + j) =
- *(data + (data_x >> 3) + i * raster + j) << (data_x % 8) |
- *(data + (data_x >> 3) + i * raster + j + 1) >> (8 - data_x % 8);
- }
+ for (j = 0; j < width_bytes; j++) {
+ *(buf + i * width_bytes + j) =
+ *(data + (data_x >> 3) + i * raster + j) << (data_x % 8) |
+ *(data + (data_x >> 3) + i * raster + j + 1) >> (8 - data_x % 8);
+ }
}
}
@@ -2358,12 +2302,11 @@ escv_copy_mono(gx_device * dev, const byte * data,
return 0;
}
-
/* Copy a color bitmap. */
static int
escv_copy_color(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_escv *const pdev = (gx_device_escv *) dev;
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -2406,14 +2349,13 @@ escv_copy_color(gx_device * dev,
return 0;
}
-
/* Fill a mask. */
static int
escv_fill_mask(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
gx_device_escv *const pdev = (gx_device_escv *) dev;
@@ -2428,18 +2370,18 @@ escv_fill_mask(gx_device * dev,
#endif
if (w <= 0 || h <= 0) return 0;
-
+
if (depth > 1 ||
gdev_vector_update_fill_color(vdev,
#if ( 8 <= GS_VERSION_MAJOR )
- pis,
+ pis,
#endif
- pdcolor) < 0 ||
+ pdcolor) < 0 ||
gdev_vector_update_clip_path(vdev, pcpath) < 0 ||
gdev_vector_update_log_op(vdev, lop) < 0
- )
+ )
return gx_default_fill_mask(dev, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth, lop, pcpath);
+ x, y, w, h, pdcolor, depth, lop, pcpath);
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
@@ -2449,7 +2391,6 @@ escv_fill_mask(gx_device * dev,
(void)sprintf(obuf, ESC_GS "0;0;100spE" ESC_GS "1;1;%ldccE" ,color);
lputs(s, obuf);
-
if (vdev->x_pixels_per_inch == 1200) {
lputs(s, ESC_GS "1;45;156htmE");
} else if (vdev->x_pixels_per_inch == 600) {
@@ -2480,19 +2421,19 @@ escv_fill_mask(gx_device * dev,
if (pdev -> id_cache[id & VCACHE] != id) {
- buf = gs_alloc_bytes(vdev->memory, num_bytes, "escv_fill_mask(buf)");
+ buf = gs_alloc_bytes(vdev->memory, num_bytes, "escv_fill_mask(buf)");
- /* cache entry */
- for (i = 0; i < h; ++i) {
- memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes);
- }
+ /* cache entry */
+ for (i = 0; i < h; ++i) {
+ memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes);
+ }
- (void)sprintf(obuf, ESC_GS "%d;%d;%d;%d;0db{F", num_bytes, (int)(id & VCACHE), w, h);
- lputs(s, obuf);
- put_bytes(s, buf, num_bytes);
+ (void)sprintf(obuf, ESC_GS "%d;%d;%d;%d;0db{F", num_bytes, (int)(id & VCACHE), w, h);
+ lputs(s, obuf);
+ put_bytes(s, buf, num_bytes);
- gs_free_object(vdev->memory, buf, "escv_fill_mask(buf)");
- pdev -> id_cache[id & VCACHE] = id;
+ gs_free_object(vdev->memory, buf, "escv_fill_mask(buf)");
+ pdev -> id_cache[id & VCACHE] = id;
}
(void)sprintf(obuf, ESC_GS "%dX" ESC_GS "%dY", x, y);
@@ -2532,19 +2473,18 @@ static const gx_image_enum_procs_t escv_image_enum_procs =
escv_image_plane_data, escv_image_end_image
};
-
/* Start processing an image. */
static int
escv_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
- gs_memory_t * mem, gx_image_enum_common_t **pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * mem, gx_image_enum_common_t **pinfo)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
gx_device_escv *const pdev = (gx_device_escv *) dev;
stream *s = gdev_vector_stream((gx_device_vector *) pdev);
- gdev_vector_image_enum_t *pie =
+ gdev_vector_image_enum_t *pie =
gs_alloc_struct(mem, gdev_vector_image_enum_t, &st_vector_image_enum, "escv_begin_image");
const gs_color_space *pcs = pim->ColorSpace;
gs_color_space_index index;
@@ -2563,38 +2503,38 @@ escv_begin_image(gx_device * dev,
if (pie == 0) return_error(gs_error_VMerror);
pie->memory = mem;
code = gdev_vector_begin_image(vdev, pis, pim, format, prect,
- pdcolor, pcpath, mem, &escv_image_enum_procs, pie);
+ pdcolor, pcpath, mem, &escv_image_enum_procs, pie);
if (code < 0) return code;
-
+
*pinfo = (gx_image_enum_common_t *) pie;
if (!pim->ImageMask) {
index = gs_color_space_get_index(pcs);
num_components = gs_color_space_num_components(pcs);
- if (pim->CombineWithColor) {
+ if (pim->CombineWithColor) {
can_do = false;
} else {
switch (index) {
case gs_color_space_index_DeviceGray:
- if ((pim->Decode[0] != 0 || pim->Decode[1] != 1)
- && (pim->Decode[0] != 1 || pim->Decode[1] != 0))
- can_do = false;
- break;
+ if ((pim->Decode[0] != 0 || pim->Decode[1] != 1)
+ && (pim->Decode[0] != 1 || pim->Decode[1] != 0))
+ can_do = false;
+ break;
case gs_color_space_index_DeviceRGB:
- if (pim->Decode[0] != 0 || pim->Decode[1] != 1 ||
- pim->Decode[2] != 0 || pim->Decode[3] != 1 ||
- pim->Decode[4] != 0)
- can_do = false;
- break;
+ if (pim->Decode[0] != 0 || pim->Decode[1] != 1 ||
+ pim->Decode[2] != 0 || pim->Decode[3] != 1 ||
+ pim->Decode[4] != 0)
+ can_do = false;
+ break;
default:
- can_do = false;
+ can_do = false;
}
}
}
if (!can_do) {
return gx_default_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, mem, &pie->default_info);
+ pdcolor, pcpath, mem, &pie->default_info);
}
if (pim->ImageMask || (pim->BitsPerComponent == 1 && num_components == 1)) {
@@ -2603,8 +2543,8 @@ escv_begin_image(gx_device * dev,
} else {
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
} else { /* ESC/Page-Color */
- lputs(s, ESC_GS "8;1;2;2;2plr{E");
- put_bytes(s, "\000\000\000\000\377\377\377\377", 8);
+ lputs(s, ESC_GS "8;1;2;2;2plr{E");
+ put_bytes(s, "\000\000\000\000\377\377\377\377", 8);
} /* ESC/Page-Color */
pdev->MaskReverse = 0;
}
@@ -2662,22 +2602,22 @@ escv_begin_image(gx_device * dev,
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/
- (void)sprintf(obuf, ESC_GS "1;1;%ldccE", color);
- lputs(s, obuf);
+ /* lputs(s, ESC_GS "1owE");*/
+ (void)sprintf(obuf, ESC_GS "1;1;%ldccE", color);
+ lputs(s, obuf);
- if (vdev->x_pixels_per_inch == 1200) {
- lputs(s, ESC_GS "1;45;156htmE");
- } else if (vdev->x_pixels_per_inch == 600) {
- lputs(s, ESC_GS "1;45;106htmE");
- } else {
- lputs(s, ESC_GS "1;45;71htmE");
- }
+ if (vdev->x_pixels_per_inch == 1200) {
+ lputs(s, ESC_GS "1;45;156htmE");
+ } else if (vdev->x_pixels_per_inch == 600) {
+ lputs(s, ESC_GS "1;45;106htmE");
+ } else {
+ lputs(s, ESC_GS "1;45;71htmE");
+ }
} else { /* ESC/Page-Color */
- lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
- pdev->MaskState = 1;
+ lputs(s, ESC_GS "3;184wfE" ESC_GS "5;184wfE");
+ pdev->MaskState = 1;
} /* ESC/Page-Color */
@@ -2689,9 +2629,9 @@ escv_begin_image(gx_device * dev,
if (pdev->MaskState != 0) {
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- /* lputs(s, ESC_GS "1owE");*/ /* 184->204 */
+ /* lputs(s, ESC_GS "1owE");*/ /* 184->204 */
} else { /* ESC/Page-Color */
- lputs(s, ESC_GS "3;204wfE" ESC_GS "5;204wfE");
+ lputs(s, ESC_GS "3;204wfE" ESC_GS "5;204wfE");
} /* ESC/Page-Color */
pdev->MaskState = 0;
@@ -2702,11 +2642,10 @@ escv_begin_image(gx_device * dev,
if (pdev -> reverse_y) return 0;
escv_write_begin(dev, pie->bits_per_pixel, (int)imat.tx, (int)imat.ty, pie->width, pie->height, sx, sy, pdev -> roll);
-
+
return 0;
}
-
/* Process the next piece of an image. */
static int
#if GS_VERSION_MAJOR >= 6
@@ -2744,49 +2683,48 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan
if (pdev -> reverse_y) {
if (pdev -> h == height) {
- if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
-
- if(tbyte == 1){
- if(strcmp(pdev->dname, "lp1800") != 0 &&
- strcmp(pdev->dname, "lp9600") != 0) {
- pdev->w += pdev->sx / 2048;
- height += pdev->sy / 2048;
- }
- }
+ if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- } else { /* ESC/Page-Color */
+ if(tbyte == 1){
+ if(strcmp(pdev->dname, "lp1800") != 0 &&
+ strcmp(pdev->dname, "lp9600") != 0) {
+ pdev->w += pdev->sx / 2048;
+ height += pdev->sy / 2048;
+ }
+ }
- if(tbyte == 1){
- pdev->w += pdev->sx / 2048;
- height += pdev->sy / 2048;
- }
+ } else { /* ESC/Page-Color */
- } /* ESC/Page-Color */
+ if(tbyte == 1){
+ pdev->w += pdev->sx / 2048;
+ height += pdev->sy / 2048;
+ }
+ } /* ESC/Page-Color */
- escv_write_begin(dev, pie->bits_per_pixel, (int)pdev -> xmat.tx, (int)pdev -> xmat.ty, pdev -> w, height, (int)pdev -> sx, (int)pdev -> sy, pdev -> roll);
+ escv_write_begin(dev, pie->bits_per_pixel, (int)pdev -> xmat.tx, (int)pdev -> xmat.ty, pdev -> w, height, (int)pdev -> sx, (int)pdev -> sy, pdev -> roll);
} else {
- float yy, sy;
-
- yy = (pdev -> h * pdev->xmat.yy) - (pdev -> dd * pdev -> xmat.yy) - (height * pdev -> xmat.yy);
- if (yy == 0) {
- yy = (pdev -> h * pdev->xmat.yx) - (pdev -> dd * pdev -> xmat.yx) - (height * pdev -> xmat.yx);
- }
-
- if (pdev -> by) {
- sy = (int)pdev -> xmat.ty - (int)yy;
- sy = pdev -> by - (int)sy;
- } else {
- sy = height * pdev -> xmat.yy + 0.5;
- }
- if (sy < 0) {
- sy = -sy;
- }
-
- escv_write_begin(dev, pie->bits_per_pixel, (int)pdev -> xmat.tx, (int)pdev -> xmat.ty - (int)yy, pdev -> w, height, (int)pdev -> sx, (int)sy, pdev -> roll);
-
- pdev -> by = (int)pdev -> xmat.ty - (int)yy;
+ float yy, sy;
+
+ yy = (pdev -> h * pdev->xmat.yy) - (pdev -> dd * pdev -> xmat.yy) - (height * pdev -> xmat.yy);
+ if (yy == 0) {
+ yy = (pdev -> h * pdev->xmat.yx) - (pdev -> dd * pdev -> xmat.yx) - (height * pdev -> xmat.yx);
+ }
+
+ if (pdev -> by) {
+ sy = (int)pdev -> xmat.ty - (int)yy;
+ sy = pdev -> by - (int)sy;
+ } else {
+ sy = height * pdev -> xmat.yy + 0.5;
+ }
+ if (sy < 0) {
+ sy = -sy;
+ }
+
+ escv_write_begin(dev, pie->bits_per_pixel, (int)pdev -> xmat.tx, (int)pdev -> xmat.ty - (int)yy, pdev -> w, height, (int)pdev -> sx, (int)sy, pdev -> roll);
+
+ pdev -> by = (int)pdev -> xmat.ty - (int)yy;
}
}
pdev -> dd += height;
@@ -2795,60 +2733,60 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan
for (y = 0; y < height; ++y) {
- int bit, w;
- const byte *p;
- byte *d;
- byte c;
-
- p = planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3) + y * planes[plane].raster;
- if (pdev -> reverse_y) {
-
- d = buf + (height - y) * width_bytes;
-
- if (!pdev -> reverse_x) {
- (void)memcpy(buf + (height - y - 1) * width_bytes,
- planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
- + y * planes[plane].raster, width_bytes);
-
- }
-
- } else {
-
- d = buf + (y + 1) * width_bytes;
-
- if (!pdev -> reverse_x) {
-
- (void)memcpy(buf + y * width_bytes,
- planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
- + y * planes[plane].raster, width_bytes);
-
- }
- }
- if (pdev -> reverse_x) {
- if (pie->bits_per_pixel == 1) {
- for (w = 0; w < width_bytes; w++) {
- c = 0;
- for (bit = 0; bit < 8; bit++) {
- if (*p & 1 << (7 - bit)) {
- c |= 1 << bit;
- }
- }
- p++;
- *--d = c;
- }
- } else if (pie->bits_per_pixel == 8){
- for (w = 0; w < width_bytes; w++) {
- *--d = *p++;
- }
- } else {
- for (w = 0; w < width_bytes / 3; w++) {
- *--d = *(p + 2);
- *--d = *(p + 1);
- *--d = *p;
- p += 3;
- }
- }
- }
+ int bit, w;
+ const byte *p;
+ byte *d;
+ byte c;
+
+ p = planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3) + y * planes[plane].raster;
+ if (pdev -> reverse_y) {
+
+ d = buf + (height - y) * width_bytes;
+
+ if (!pdev -> reverse_x) {
+ (void)memcpy(buf + (height - y - 1) * width_bytes,
+ planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
+ + y * planes[plane].raster, width_bytes);
+
+ }
+
+ } else {
+
+ d = buf + (y + 1) * width_bytes;
+
+ if (!pdev -> reverse_x) {
+
+ (void)memcpy(buf + y * width_bytes,
+ planes[plane].data + ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
+ + y * planes[plane].raster, width_bytes);
+
+ }
+ }
+ if (pdev -> reverse_x) {
+ if (pie->bits_per_pixel == 1) {
+ for (w = 0; w < width_bytes; w++) {
+ c = 0;
+ for (bit = 0; bit < 8; bit++) {
+ if (*p & 1 << (7 - bit)) {
+ c |= 1 << bit;
+ }
+ }
+ p++;
+ *--d = c;
+ }
+ } else if (pie->bits_per_pixel == 8){
+ for (w = 0; w < width_bytes; w++) {
+ *--d = *p++;
+ }
+ } else {
+ for (w = 0; w < width_bytes / 3; w++) {
+ *--d = *(p + 2);
+ *--d = *(p + 1);
+ *--d = *p;
+ p += 3;
+ }
+ }
+ }
}
}
@@ -2857,56 +2795,56 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- gs_free_object(vdev->memory, buf, "escv_image_data(buf)");
- if(strcmp(pdev->dname, "lp1800") == 0 ||
- strcmp(pdev->dname, "lp9600") == 0) {
- if(pdev->sx > pdev->sy){
- height = pdev->sy;
- pdev->w = pdev->sx;
- tbyte = ((pdev->sx + 7) / 8) * pdev->sy;
- } else {
- if(pdev->sx < pdev->sy){
- height = pdev->sy;
- pdev->w = pdev->sx;
- tbyte = ((pdev->sx + 7) / 8) * pdev->sy;
- } else {
- tbyte = 1;
- }
- }
-
- } else {
- if(pdev->sx > pdev->sy){
- tbyte = 1;
- } else {
- if(pdev->sx < pdev->sy){
- tbyte = tbyte * height;
- } else {
- tbyte = 1;
- }
- }
- }
- buf = gs_alloc_bytes(vdev->memory, tbyte, "escv_image_data(buf)");
- for(t = 0; t < tbyte; t++){
- buf[t] = 0xff;
- }
+ gs_free_object(vdev->memory, buf, "escv_image_data(buf)");
+ if(strcmp(pdev->dname, "lp1800") == 0 ||
+ strcmp(pdev->dname, "lp9600") == 0) {
+ if(pdev->sx > pdev->sy){
+ height = pdev->sy;
+ pdev->w = pdev->sx;
+ tbyte = ((pdev->sx + 7) / 8) * pdev->sy;
+ } else {
+ if(pdev->sx < pdev->sy){
+ height = pdev->sy;
+ pdev->w = pdev->sx;
+ tbyte = ((pdev->sx + 7) / 8) * pdev->sy;
+ } else {
+ tbyte = 1;
+ }
+ }
+
+ } else {
+ if(pdev->sx > pdev->sy){
+ tbyte = 1;
+ } else {
+ if(pdev->sx < pdev->sy){
+ tbyte = tbyte * height;
+ } else {
+ tbyte = 1;
+ }
+ }
+ }
+ buf = gs_alloc_bytes(vdev->memory, tbyte, "escv_image_data(buf)");
+ for(t = 0; t < tbyte; t++){
+ buf[t] = 0xff;
+ }
} else { /* ESC/Page-Color */
- gs_free_object(vdev->memory, buf, "escv_image_data(buf)");
- if(pdev->sx > pdev->sy){
- tbyte = 1;
- } else {
- if(pdev->sx < pdev->sy){
- tbyte = tbyte * height;
- } else {
- tbyte = 1;
- }
- }
-
- buf = gs_alloc_bytes(vdev->memory, tbyte, "escv_image_data(buf)");
- for(t = 0; t < tbyte; t++){
- buf[t] = 0x00;
- }
+ gs_free_object(vdev->memory, buf, "escv_image_data(buf)");
+ if(pdev->sx > pdev->sy){
+ tbyte = 1;
+ } else {
+ if(pdev->sx < pdev->sy){
+ tbyte = tbyte * height;
+ } else {
+ tbyte = 1;
+ }
+ }
+
+ buf = gs_alloc_bytes(vdev->memory, tbyte, "escv_image_data(buf)");
+ for(t = 0; t < tbyte; t++){
+ buf[t] = 0x00;
+ }
} /* ESC/Page-Color */
@@ -2923,7 +2861,6 @@ escv_image_plane_data(gx_image_enum_common_t *info, const gx_image_plane_t *plan
return (pie->y += height) >= pie->height;
}
-
static int
#if GS_VERSION_MAJOR >= 6
escv_image_end_image(gx_image_enum_common_t * info, bool draw_last)
@@ -2961,7 +2898,6 @@ escv_image_end_image(gx_image_enum_common_t * info, bool draw_last)
return code;
}
-
static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int sh, int dw, int dh, int roll)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -2980,24 +2916,24 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
if (bits == 1) {
if (strcmp(pdev->dname, "lp1800") == 0 ||
strcmp(pdev->dname, "lp9600") == 0) {
- (void)sprintf(obuf, ESC_GS "0bcI");
+ (void)sprintf(obuf, ESC_GS "0bcI");
}else{
- (void)sprintf(obuf, ESC_GS "5;%d;%d;%d;%d;%dsrI", sw, sh, dw, dh, roll);
+ (void)sprintf(obuf, ESC_GS "5;%d;%d;%d;%d;%dsrI", sw, sh, dw, dh, roll);
}
} else if (bits == 4) {
if (pdev -> c4map) {
- pdev -> c4map = FALSE;
+ pdev -> c4map = FALSE;
}
(void)sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 8) {
if (pdev -> c8map) {
- pdev -> c8map = FALSE;
+ pdev -> c8map = FALSE;
}
(void)sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else {
/* 24 bit */
(void)sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
- }
+ }
} else { /* ESC/Page-Color */
@@ -3010,40 +2946,40 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
(void)sprintf(obuf, ESC_GS "2;201;1;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 4) {
if (pdev -> c4map) {
- /* ¥«¥é¡¼¥Þ¥Ã¥×ÅÐÏ¿ */
- lputs(s, ESC_GS "64;2;2;16;16plr{E");
- p = tmp = gs_alloc_bytes(vdev->memory, 64, "escv_write_begin(tmp4)");
- for (i = 0; i < 16; i++) {
- *p++ = i << 4;
- *p++ = i << 4;
- *p++ = i << 4;
- *p++ = i << 4;
- }
- put_bytes(s, tmp, 64);
- gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp4)");
- pdev -> c4map = FALSE;
+ /* ¥«¥é¡¼¥Þ¥Ã¥×ÅÐÏ¿ */
+ lputs(s, ESC_GS "64;2;2;16;16plr{E");
+ p = tmp = gs_alloc_bytes(vdev->memory, 64, "escv_write_begin(tmp4)");
+ for (i = 0; i < 16; i++) {
+ *p++ = i << 4;
+ *p++ = i << 4;
+ *p++ = i << 4;
+ *p++ = i << 4;
+ }
+ put_bytes(s, tmp, 64);
+ gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp4)");
+ pdev -> c4map = FALSE;
}
(void)sprintf(obuf, ESC_GS "2;203;2;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 8) {
if (pdev -> c8map) {
- /* ¥«¥é¡¼¥Þ¥Ã¥×ÅÐÏ¿ */
- lputs(s, ESC_GS "1024;4;2;256;256plr{E");
- p = tmp = gs_alloc_bytes(vdev->memory, 1024, "escv_write_begin(tmp)");
- for (i = 0; i < 256; i++) {
- *p++ = i;
- *p++ = i;
- *p++ = i;
- *p++ = i;
- }
- put_bytes(s, tmp, 1024);
- gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp)");
- pdev -> c8map = FALSE;
+ /* ¥«¥é¡¼¥Þ¥Ã¥×ÅÐÏ¿ */
+ lputs(s, ESC_GS "1024;4;2;256;256plr{E");
+ p = tmp = gs_alloc_bytes(vdev->memory, 1024, "escv_write_begin(tmp)");
+ for (i = 0; i < 256; i++) {
+ *p++ = i;
+ *p++ = i;
+ *p++ = i;
+ *p++ = i;
+ }
+ put_bytes(s, tmp, 1024);
+ gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp)");
+ pdev -> c8map = FALSE;
}
(void)sprintf(obuf, ESC_GS "2;204;4;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else {
/* 24 bit */
(void)sprintf(obuf, ESC_GS "2;102;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
- }
+ }
} /* ESC/Page-Color */
@@ -3052,7 +2988,6 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
return;
}
-
static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int w, int ras)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -3072,8 +3007,8 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
if (bits == 12) {
p = tmps = gs_alloc_bytes(vdev->memory, bsize * 2, "escv_write_data(tmp)");
for (size = 0; size < bsize; size++) {
- *p++ = buf[size] & 0xF0;
- *p++ = buf[size] << 4;
+ *p++ = buf[size] & 0xF0;
+ *p++ = buf[size] << 4;
}
bsize = bsize * 2;
buf = tmps;
@@ -3082,8 +3017,8 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
if(bits == 4) {
p = tmps = gs_alloc_bytes(vdev->memory, bsize * 2, "escv_write_data(tmp)");
for (size = 0; size < bsize; size++) {
- *p++ = ((buf[size] & 0xF0) * 0xFF / 0xF0);
- *p++ = ((buf[size] << 4 & 0xF0) * 0xFF / 0xF0);
+ *p++ = ((buf[size] & 0xF0) * 0xFF / 0xF0);
+ *p++ = ((buf[size] << 4 & 0xF0) * 0xFF / 0xF0);
}
bsize = bsize * 2;
buf = tmps;
@@ -3096,12 +3031,12 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
rgbbuf = buf;
ucp = tmps;
for (size = 0; size < bsize; size = size + 3) {
- gray8 = (0.299L * rgbbuf[size]) + (0.587L * rgbbuf[size + 1]) + (0.114L * rgbbuf[size + 2]);
- if ( gray8 > 255L )
- *ucp = 255;
- else
- *ucp = gray8;
- ucp++;
+ gray8 = (0.299L * rgbbuf[size]) + (0.587L * rgbbuf[size + 1]) + (0.114L * rgbbuf[size + 2]);
+ if ( gray8 > 255L )
+ *ucp = 255;
+ else
+ *ucp = gray8;
+ ucp++;
}
bsize = bsize / 3;
buf = tmps;
@@ -3109,10 +3044,10 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
if(bits == 1){
if (strcmp(pdev->dname, "lp1800") == 0 || \
- strcmp(pdev->dname, "lp9600") == 0) {
- (void)sprintf(obuf, ESC_GS "%d;1;%d;%d;0db{I", bsize, w, ras);
+ strcmp(pdev->dname, "lp9600") == 0) {
+ (void)sprintf(obuf, ESC_GS "%d;1;%d;%d;0db{I", bsize, w, ras);
}else{
- (void)sprintf(obuf, ESC_GS "%d;%du{I", bsize, ras);
+ (void)sprintf(obuf, ESC_GS "%d;%du{I", bsize, ras);
}
}else{
(void)sprintf(obuf, ESC_GS "%d;%dcu{I", bsize, ras);
@@ -3133,10 +3068,10 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
if (bits == 12) {
p = tmps = gs_alloc_bytes(vdev->memory, bsize * 2, "escv_write_data(tmp)");
for (size = 0; size < bsize; size++) {
- tmp = buf[size] & 0xF0;
- *p++ = (tmp + (tmp >> 4 & 0x0F));
- tmp = buf[size] << 4;
- *p++ = (tmp + (tmp >> 4 & 0x0F));
+ tmp = buf[size] & 0xF0;
+ *p++ = (tmp + (tmp >> 4 & 0x0F));
+ tmp = buf[size] << 4;
+ *p++ = (tmp + (tmp >> 4 & 0x0F));
}
bsize = bsize * 2;
buf = tmps;
@@ -3154,7 +3089,6 @@ static void escv_write_data(gx_device *dev, int bits, char *buf, int bsize, int
return;
}
-
static void escv_write_end(gx_device *dev, int bits)
{
gx_device_escv *const pdev = (gx_device_escv *) dev;
@@ -3164,10 +3098,10 @@ static void escv_write_end(gx_device *dev, int bits)
if(bits == 1){
if (strcmp(pdev->dname, "lp1800") == 0 || \
- strcmp(pdev->dname, "lp9600") == 0) {
- lputs(s, ESC_GS "1dbI");
+ strcmp(pdev->dname, "lp9600") == 0) {
+ lputs(s, ESC_GS "1dbI");
} else {
- lputs(s, ESC_GS "erI");
+ lputs(s, ESC_GS "erI");
}
}else{
lputs(s, ESC_GS "ecrI");
diff --git a/gs/contrib/eplaser/gdevescv.h b/gs/contrib/eplaser/gdevescv.h
index 6782c95fc..2d640a547 100644
--- a/gs/contrib/eplaser/gdevescv.h
+++ b/gs/contrib/eplaser/gdevescv.h
@@ -109,15 +109,14 @@
#define ESCPAGE_DEVICENAME_COLOR "eplcolor"
#define ESCPAGE_DEVICENAME_MONO "eplmono"
-
/* ---------------- Device definition ---------------- */
typedef struct gx_device_escv_s {
gx_device_vector_common;
int colormode; /* 0=ESC/Page(Monochrome), 1=ESC/Page-Color */
- bool manualFeed; /* Use manual feed */
- int cassetFeed; /* Input Casset */
+ bool manualFeed; /* Use manual feed */
+ int cassetFeed; /* Input Casset */
bool RITOff; /* RIT Control */
bool Collate;
int toner_density;
@@ -192,7 +191,6 @@ typedef struct paper_candidate_s {
bool isminh; /* best fit height? */
} paper_candidate;
-
#endif /* gdevescv_INCLUDED */
/* end of file */
diff --git a/gs/contrib/gdevbjc_.c b/gs/contrib/gdevbjc_.c
index 9dd26a25b..2c108d26b 100644
--- a/gs/contrib/gdevbjc_.c
+++ b/gs/contrib/gdevbjc_.c
@@ -20,7 +20,7 @@
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111
* U.S.A.
*/
-
+
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved.
This program may also be distributed as part of AFPL Ghostscript, under the
@@ -80,7 +80,6 @@ BJL_command BJL_command_set[] = {
{ NULL }
};
-
/* String parameter definitions */
stringParamDescription strPrinterType[] = {
@@ -215,95 +214,87 @@ static media_t media_codes[] = {
static const gx_device_procs bjcmono_procs =
prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- NULL, NULL,
- gdev_bjc_get_params, gdev_bjc_put_params);
+ NULL, NULL,
+ gdev_bjc_get_params, gdev_bjc_put_params);
const gx_device_bjc_printer gs_bjcmono_device =
bjc_device(bjcmono_procs, "bjcmono",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
(3.4 / 25.4), (7.0 / 25.4), (3.4 / 25.4), (3.0 / 25.4),
- 1, /* num components */
- 1, /* depth */
- 1, /* max gray */
- 0, /* max color */
- 2, /* dither gray */
+ 1, /* num components */
+ 1, /* depth */
+ 1, /* max gray */
+ 0, /* max color */
+ 2, /* dither gray */
0, /* dither color */
bjc_print_page_mono, INK_K); /* printer rutin, default ink */
-
/***************************************************************************/
/* -------------------------- 8 bit Grayscale ---------------------------- */
/***************************************************************************/
static const gx_device_procs bjcgray_procs =
prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb,
- gdev_bjc_get_params, gdev_bjc_put_params);
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb,
+ gdev_bjc_get_params, gdev_bjc_put_params);
const gx_device_bjc_printer gs_bjcgray_device =
bjc_device(bjcgray_procs, "bjcgray",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
(3.4 / 25.4), (7.0 / 25.4), (3.4 / 25.4), (3.0 / 25.4),
- 1, /* num components */
- 8, /* depth */
- 255, /* max gray */
- 0, /* max color */
- 256, /* dither gray */
- 0, /* dither color */
- bjc_print_page_gray, INK_K);
-
+ 1, /* num components */
+ 8, /* depth */
+ 255, /* max gray */
+ 0, /* max color */
+ 256, /* dither gray */
+ 0, /* dither color */
+ bjc_print_page_gray, INK_K);
/***************************************************************************/
/* --------------------------- 3 bit CMYK Color -------------------------- */
/***************************************************************************/
-
-
static const gx_device_procs bjc_cmykcolor_procs =
bjc_cmyk_param_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
cmyk_1bit_map_color_rgb, cmyk_1bit_map_cmyk_color,
- gdev_bjc_get_params, gdev_bjc_put_params);
+ gdev_bjc_get_params, gdev_bjc_put_params);
const gx_device_bjc_printer gs_bjccmyk_device =
bjc_device(bjc_cmykcolor_procs, "bjccmyk",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
(3.4 / 25.4), (7.0 / 25.4), (3.4 / 25.4), (3.0 / 25.4),
- 4, /* num components */
- 4, /* depth */
- 1, /* max gray */
- 1, /* max color */
- 2, /* dither gray */
- 2, /* dither color */
- bjc_print_page_cmyk, (INK_K|INK_C|INK_M|INK_Y));
-
+ 4, /* num components */
+ 4, /* depth */
+ 1, /* max gray */
+ 1, /* max color */
+ 2, /* dither gray */
+ 2, /* dither color */
+ bjc_print_page_cmyk, (INK_K|INK_C|INK_M|INK_Y));
/***************************************************************************/
/* --------------------------- 24 bit TrueColor -------------------------- */
/***************************************************************************/
-
-
static const gx_device_procs bjc_truecolor_procs =
bjc_cmyk_param_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
cmyk_8bit_map_color_rgb, cmyk_8bit_map_cmyk_color,
- gdev_bjc_get_params, gdev_bjc_put_params);
+ gdev_bjc_get_params, gdev_bjc_put_params);
const gx_device_bjc_printer gs_bjccolor_device =
bjc_device(bjc_truecolor_procs, "bjccolor",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
(3.4 / 25.4), (7.0 / 25.4), (3.4 / 25.4), (3.0 / 25.4),
- 4, /* num components */
- 32, /* depth */
- 255, /* max gray */
- 255, /* max color */
- 256, /* dither gray */
- 256, /* dither color */
- bjc_print_page_color, (INK_K|INK_C|INK_M|INK_Y));
-
+ 4, /* num components */
+ 32, /* depth */
+ 255, /* max gray */
+ 255, /* max color */
+ 256, /* dither gray */
+ 256, /* dither color */
+ bjc_print_page_color, (INK_K|INK_C|INK_M|INK_Y));
/***************************************************************************/
/* ---------------------------Print a page routine------------------------ */
@@ -324,22 +315,20 @@ bjc_print_page(gx_device_printer * pdev, FILE * file)
char alma[512];
sprintf(alma, "\nNumC: %d, Depth: %d, Mgray: %d, Mrgb: %d\n"
- "Dgray: %d, Drgb: %d", pdev->color_info.num_components,
- pdev->color_info.depth,
- pdev->color_info.max_gray,
- pdev->color_info.max_color,
- pdev->color_info.dither_grays,
- pdev->color_info.dither_colors
- );
-
- if (row == 0)
- return_error(gs_error_VMerror);
+ "Dgray: %d, Drgb: %d", pdev->color_info.num_components,
+ pdev->color_info.depth,
+ pdev->color_info.max_gray,
+ pdev->color_info.max_color,
+ pdev->color_info.dither_grays,
+ pdev->color_info.dither_colors
+ );
+ if (row == 0)
+ return_error(gs_error_VMerror);
done:
gs_free_object(pdev->memory, row, "bjc file buffer");
-
fwrite((const char *) alma, 512, 1, file);
return code;
@@ -352,17 +341,15 @@ bjc_put_bjl_command(FILE * file, int bjl_command)
{
BJL_command *command = BJL_command_set;
for( ; command->string; command++)
- if(command->numeric == bjl_command) break;
+ if(command->numeric == bjl_command) break;
if(command->string) {
fwrite((const char *)"\033[K\002\000\000\037BJLSTART\012", 16, 1, file);
fwrite(command->string, command->length, 1, file);
fwrite((const char *)"\012BJLEND\012", 8, 1, file); }
}
-
/* ------ Get/put parameters ------ */
-
/* Functions for manipulation params strings */
const stringParamDescription *
@@ -370,9 +357,9 @@ paramValueToParam(const stringParamDescription * params, int value)
{
for (; params->p_string.data; ++params) {
- if (params->p_value == value) {
- return params;
- }
+ if (params->p_value == value) {
+ return params;
+ }
}
return (stringParamDescription *) NULL;
@@ -380,20 +367,19 @@ paramValueToParam(const stringParamDescription * params, int value)
const stringParamDescription *
paramStringToParam(const stringParamDescription * params,
- const char * name, uint len)
+ const char * name, uint len)
{
for (; params->p_string.data; ++params) {
if (len == params->p_string.size)
- if (!(strncmp((const char *)params->p_string.data,
- name, len))) {
- return params;
- }
+ if (!(strncmp((const char *)params->p_string.data,
+ name, len))) {
+ return params;
+ }
}
return (stringParamDescription *) NULL;
}
-
/* Get parameters. BJC printer devices add several more parameters */
/* to the default set. */
static int
@@ -403,33 +389,33 @@ gdev_bjc_get_params(gx_device * pdev, gs_param_list * plist)
int code = gdev_prn_get_params(pdev, plist);
if (code < 0 ||
- (code = param_write_string(plist, "PrinterType",
- &paramValueToParam(strPrinterType, ppdev->printerType)->p_string)) < 0 ||
- (code = param_write_string(plist, "Feeder",
- &paramValueToParam(strFeeder, ppdev->feeder)->p_string)) < 0 ||
- (code = param_write_string(plist, "Media",
- &paramValueToParam(strMedia, ppdev->mediaType)->p_string)) < 0 ||
- (code = param_write_string(plist, "Quality",
- &paramValueToParam(strQuality, ppdev->quality)->p_string)) < 0 ||
- (code = param_write_string(plist, "InkColor",
- &paramValueToParam(strInk, ppdev->ink)->p_string)) < 0 ||
-
- (code = param_write_bool(plist, "Inverse", &ppdev->inverse)) < 0 ||
- (code = param_write_bool(plist, "Smooth", &ppdev->smooth)) < 0 ||
- (code = param_write_bool(plist, "Compress", &ppdev->compress)) < 0 ||
- (code = param_write_bool(plist, "LimitCheck", &ppdev->limit)) < 0 ||
- (code = param_write_bool(plist, "DecomposeK", &ppdev->compose)) < 0 ||
-
- (code = param_write_int(plist, "PaperRed", &ppdev->paperColor.red)) < 0 ||
- (code = param_write_int(plist, "PaperGreen", &ppdev->paperColor.green)) < 0 ||
- (code = param_write_int(plist, "PaperBlue", &ppdev->paperColor.blue)) < 0 ||
- (code = param_write_int(plist, "Random", &ppdev->rnd)) < 0 ||
-
- (code = param_write_float(plist, "Gamma", &ppdev->gamma)) < 0 ||
- (code = param_write_float(plist, "RedGamma", &ppdev->redGamma)) < 0 ||
- (code = param_write_float(plist, "GreenGamma", &ppdev->greenGamma)) < 0 ||
- (code = param_write_float(plist, "BlueGamma", &ppdev->blueGamma)) < 0)
- return code;
+ (code = param_write_string(plist, "PrinterType",
+ &paramValueToParam(strPrinterType, ppdev->printerType)->p_string)) < 0 ||
+ (code = param_write_string(plist, "Feeder",
+ &paramValueToParam(strFeeder, ppdev->feeder)->p_string)) < 0 ||
+ (code = param_write_string(plist, "Media",
+ &paramValueToParam(strMedia, ppdev->mediaType)->p_string)) < 0 ||
+ (code = param_write_string(plist, "Quality",
+ &paramValueToParam(strQuality, ppdev->quality)->p_string)) < 0 ||
+ (code = param_write_string(plist, "InkColor",
+ &paramValueToParam(strInk, ppdev->ink)->p_string)) < 0 ||
+
+ (code = param_write_bool(plist, "Inverse", &ppdev->inverse)) < 0 ||
+ (code = param_write_bool(plist, "Smooth", &ppdev->smooth)) < 0 ||
+ (code = param_write_bool(plist, "Compress", &ppdev->compress)) < 0 ||
+ (code = param_write_bool(plist, "LimitCheck", &ppdev->limit)) < 0 ||
+ (code = param_write_bool(plist, "DecomposeK", &ppdev->compose)) < 0 ||
+
+ (code = param_write_int(plist, "PaperRed", &ppdev->paperColor.red)) < 0 ||
+ (code = param_write_int(plist, "PaperGreen", &ppdev->paperColor.green)) < 0 ||
+ (code = param_write_int(plist, "PaperBlue", &ppdev->paperColor.blue)) < 0 ||
+ (code = param_write_int(plist, "Random", &ppdev->rnd)) < 0 ||
+
+ (code = param_write_float(plist, "Gamma", &ppdev->gamma)) < 0 ||
+ (code = param_write_float(plist, "RedGamma", &ppdev->redGamma)) < 0 ||
+ (code = param_write_float(plist, "GreenGamma", &ppdev->greenGamma)) < 0 ||
+ (code = param_write_float(plist, "BlueGamma", &ppdev->blueGamma)) < 0)
+ return code;
return code;
}
@@ -448,118 +434,118 @@ gdev_bjc_put_params(gx_device * pdev, gs_param_list * plist)
#define CHECK_PARAM_CASES(good, label) \
case 1: \
- break; \
+ break; \
case 0: \
if ( good ) break; \
- ecode = gs_error_rangecheck; goto label; \
+ ecode = gs_error_rangecheck; goto label; \
default: \
- ecode = code; \
+ ecode = code; \
label: \
- param_signal_error(plist, param_name, ecode)
+ param_signal_error(plist, param_name, ecode)
#define CHECK_str_PARAM_CASES(set, str, label) \
case 1: \
- break; \
+ break; \
case 0: \
parsize = tmppar.size; \
tmpstr = paramStringToParam(str, \
- (const char *)tmppar.data, \
- parsize); \
+ (const char *)tmppar.data, \
+ parsize); \
if ( tmpstr ) { set = tmpstr->p_value; break;} \
- ecode = gs_error_rangecheck; goto label; \
+ ecode = gs_error_rangecheck; goto label; \
default: \
- ecode = code; \
+ ecode = code; \
label: \
- param_signal_error(plist, param_name, ecode)
+ param_signal_error(plist, param_name, ecode)
switch ( code = param_read_string(plist, (param_name = "PrinterType"),
- &tmppar)) {
- CHECK_str_PARAM_CASES(ppdev->printerType, strPrinterType, label_Type);
+ &tmppar)) {
+ CHECK_str_PARAM_CASES(ppdev->printerType, strPrinterType, label_Type);
}
switch (code = param_read_string(plist, (param_name = "Feeder"),
- &tmppar)) {
- CHECK_str_PARAM_CASES(ppdev->feeder, strFeeder, label_Feeder);
+ &tmppar)) {
+ CHECK_str_PARAM_CASES(ppdev->feeder, strFeeder, label_Feeder);
}
switch (code = param_read_string(plist, (param_name = "Media"),
- &tmppar)) {
- CHECK_str_PARAM_CASES(ppdev->mediaType, strMedia, label_Paper);
+ &tmppar)) {
+ CHECK_str_PARAM_CASES(ppdev->mediaType, strMedia, label_Paper);
}
switch (code = param_read_string(plist, (param_name = "Quality"),
- &tmppar)) {
- CHECK_str_PARAM_CASES(ppdev->quality, strQuality, label_Quality);
+ &tmppar)) {
+ CHECK_str_PARAM_CASES(ppdev->quality, strQuality, label_Quality);
}
switch (code = param_read_string(plist, (param_name = "InkColor"),
- &tmppar)) {
- CHECK_str_PARAM_CASES(ppdev->ink, strInk, label_Ink);
+ &tmppar)) {
+ CHECK_str_PARAM_CASES(ppdev->ink, strInk, label_Ink);
}
switch (code = param_read_bool(plist, (param_name = "Inverse"),
- &ppdev->inverse)) {
- CHECK_PARAM_CASES( ppdev->inverse == true ||
- ppdev->inverse == false , label_Inverse);
+ &ppdev->inverse)) {
+ CHECK_PARAM_CASES( ppdev->inverse == true ||
+ ppdev->inverse == false , label_Inverse);
}
switch (code = param_read_bool(plist, (param_name = "Compress"),
- &ppdev->compress)) {
- CHECK_PARAM_CASES( ppdev->compress == true ||
- ppdev->compress == false , label_Compress);
+ &ppdev->compress)) {
+ CHECK_PARAM_CASES( ppdev->compress == true ||
+ ppdev->compress == false , label_Compress);
}
switch (code = param_read_bool(plist, (param_name = "Smooth"),
- &ppdev->smooth)) {
- CHECK_PARAM_CASES( ppdev->smooth == true ||
- ppdev->smooth == false , label_Smooth);
+ &ppdev->smooth)) {
+ CHECK_PARAM_CASES( ppdev->smooth == true ||
+ ppdev->smooth == false , label_Smooth);
}
switch (code = param_read_bool(plist, (param_name = "LimitCheck"),
- &ppdev->limit)) {
- CHECK_PARAM_CASES( ppdev->limit == true ||
- ppdev->limit == false , label_Limit);
+ &ppdev->limit)) {
+ CHECK_PARAM_CASES( ppdev->limit == true ||
+ ppdev->limit == false , label_Limit);
}
switch (code = param_read_bool(plist, (param_name = "DecomposeK"),
- &ppdev->compose)) {
- CHECK_PARAM_CASES( ppdev->compose == true ||
- ppdev->compose == false , label_Compose);
+ &ppdev->compose)) {
+ CHECK_PARAM_CASES( ppdev->compose == true ||
+ ppdev->compose == false , label_Compose);
}
switch (code = param_read_int(plist, (param_name = "PaperRed"),
- &ppdev->paperColor.red)) {
- CHECK_PARAM_CASES( ppdev->paperColor.red >= 0 &&
- ppdev->paperColor.red <= 255 , label_Red);
+ &ppdev->paperColor.red)) {
+ CHECK_PARAM_CASES( ppdev->paperColor.red >= 0 &&
+ ppdev->paperColor.red <= 255 , label_Red);
}
switch (code = param_read_int(plist, (param_name = "PaperGreen"),
- &ppdev->paperColor.green)) {
- CHECK_PARAM_CASES(ppdev->paperColor.green >= 0 &&
- ppdev->paperColor.green <= 255 , label_Green);
+ &ppdev->paperColor.green)) {
+ CHECK_PARAM_CASES(ppdev->paperColor.green >= 0 &&
+ ppdev->paperColor.green <= 255 , label_Green);
}
switch (code = param_read_int(plist, (param_name = "PaperBlue"),
- &ppdev->paperColor.blue)) {
- CHECK_PARAM_CASES(ppdev->paperColor.blue >= 0 &&
- ppdev->paperColor.blue <= 255 , label_Blue);
+ &ppdev->paperColor.blue)) {
+ CHECK_PARAM_CASES(ppdev->paperColor.blue >= 0 &&
+ ppdev->paperColor.blue <= 255 , label_Blue);
}
switch (code = param_read_int(plist, (param_name = "Random"),
- &ppdev->rnd)) {
- CHECK_PARAM_CASES(ppdev->rnd >= 0 &&
- ppdev->rnd <= 100 , label_Random);
+ &ppdev->rnd)) {
+ CHECK_PARAM_CASES(ppdev->rnd >= 0 &&
+ ppdev->rnd <= 100 , label_Random);
}
switch (code = param_read_float(plist, (param_name = "Gamma"),
- &ppdev->gamma)) {
- CHECK_PARAM_CASES(ppdev->gamma >= 0.0 &&
- ppdev->gamma <= 10.0 , label_Gamma);
+ &ppdev->gamma)) {
+ CHECK_PARAM_CASES(ppdev->gamma >= 0.0 &&
+ ppdev->gamma <= 10.0 , label_Gamma);
}
switch (code = param_read_float(plist, (param_name = "RedGamma"),
- &ppdev->redGamma)) {
- CHECK_PARAM_CASES(ppdev->redGamma >= 0.0 &&
- ppdev->redGamma <= 10.0 , label_Rgamma);
+ &ppdev->redGamma)) {
+ CHECK_PARAM_CASES(ppdev->redGamma >= 0.0 &&
+ ppdev->redGamma <= 10.0 , label_Rgamma);
}
switch (code = param_read_float(plist, (param_name = "GreenGamma"),
- &ppdev->greenGamma)) {
- CHECK_PARAM_CASES(ppdev->greenGamma >= 0.0 &&
- ppdev->greenGamma <= 10.0 , label_Ggamma);
+ &ppdev->greenGamma)) {
+ CHECK_PARAM_CASES(ppdev->greenGamma >= 0.0 &&
+ ppdev->greenGamma <= 10.0 , label_Ggamma);
}
switch (code = param_read_float(plist, (param_name = "BlueGamma"),
- &ppdev->blueGamma)) {
- CHECK_PARAM_CASES(ppdev->blueGamma >= 0.0 &&
- ppdev->blueGamma <= 10.0 , label_Bgamma);
+ &ppdev->blueGamma)) {
+ CHECK_PARAM_CASES(ppdev->blueGamma >= 0.0 &&
+ ppdev->blueGamma <= 10.0 , label_Bgamma);
}
if (ecode < 0) return ecode;
@@ -577,12 +563,12 @@ bjc_print_page_mono(gx_device_printer * pdev, FILE * file)
uint cmplen;
byte *row = gs_alloc_bytes(pdev->memory, raster, "bjc mono file buffer");
byte *cmp = gs_alloc_bytes(pdev->memory, (raster << 1) + 1,
- "bjc mono comp buffer"); /*worst case */
+ "bjc mono comp buffer"); /*worst case */
byte *outrow; /* misc variable for send a row */
int y;
int skip; /* empty raster lines */
char color = (ppdev->smooth == true ? 0x12 : /* smooted black */
- ((ppdev->ink & INK_K) ? 0x11: 0x10)); /* black or color */
+ ((ppdev->ink & INK_K) ? 0x11: 0x10)); /* black or color */
char ink = 0x01; /* regular ink type */
char compress = (ppdev->compress == true ? 0x01 : 0x00); /* compression or not */
int x_resolution = pdev->HWResolution[0];
@@ -593,7 +579,7 @@ bjc_print_page_mono(gx_device_printer * pdev, FILE * file)
byte lastmask = mask_array[pdev->width % 8];
if (row == 0 || cmp == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Write the setup data. */
@@ -605,25 +591,24 @@ bjc_print_page_mono(gx_device_printer * pdev, FILE * file)
bjc_put_set_compression(file, compress);
bjc_put_image_format(file, 0, 0, ink); /* normal ink */
-
/* Write the contents of the image. */
skip = 0;
for (y = 0; y < pdev->height ; y++) {
gdev_prn_copy_scan_lines(pdev, y, row, raster);
if (bjc_invert_bytes(row, raster, ppdev->inverse, lastmask)) /* black -> K and check empty line*/
{ /* empty line raster */
- if (skip) bjc_put_raster_skip(file, skip);
- skip = 1;
- if(compress) cmplen = bjc_compress(row, raster, cmp), outrow = cmp;
+ if (skip) bjc_put_raster_skip(file, skip);
+ skip = 1;
+ if(compress) cmplen = bjc_compress(row, raster, cmp), outrow = cmp;
else outrow = row, cmplen = raster; /* compress or not */
if(inkc & INK_K) bjc_put_cmyk_image(file, CMYK_K, outrow, cmplen),
- bjc_put_CR(file);
+ bjc_put_CR(file);
if(inkc & INK_C) bjc_put_cmyk_image(file, CMYK_C, outrow, cmplen),
- bjc_put_CR(file);
+ bjc_put_CR(file);
if(inkc & INK_M) bjc_put_cmyk_image(file, CMYK_M, outrow, cmplen),
- bjc_put_CR(file);
+ bjc_put_CR(file);
if(inkc & INK_Y) bjc_put_cmyk_image(file, CMYK_Y, outrow, cmplen),
- bjc_put_CR(file); /* use the needed ink(s) */
+ bjc_put_CR(file); /* use the needed ink(s) */
}
else skip++; /* +1 empty line */
}
@@ -651,12 +636,12 @@ bjc_print_page_gray(gx_device_printer * pdev, FILE * file)
byte *row = gs_alloc_bytes(pdev->memory, width, "bjc gray file buffer");
byte *dit = gs_alloc_bytes(pdev->memory, raster, "bjc gray dither buffer");
byte *cmp = gs_alloc_bytes(pdev->memory, (raster << 1) + 1,
- "bjc gray comp buffer"); /*worst case */
+ "bjc gray comp buffer"); /*worst case */
byte *out; /* misc variable for send a row */
int y;
int skip; /* empty raster lines */
char color = (ppdev->smooth == true ? 0x12 : /* smooted black */
- ((ppdev->ink & INK_K) ? 0x11: 0x10)); /* black or color */
+ ((ppdev->ink & INK_K) ? 0x11: 0x10)); /* black or color */
char ink = 0x01; /* regular ink type */
char compress = (ppdev->compress == true ? 0x01 : 0x00); /* compression or not */
int x_resolution = pdev->HWResolution[0];
@@ -668,7 +653,7 @@ bjc_print_page_gray(gx_device_printer * pdev, FILE * file)
if (row == 0 || cmp == 0 ||
dit == 0 ) /* can't allocate row buffers */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Write the setup data. */
@@ -682,31 +667,30 @@ bjc_print_page_gray(gx_device_printer * pdev, FILE * file)
bjc_put_set_compression(file, compress);
bjc_put_image_format(file, 0, 0, ink); /* normal ink */
-
/* Write the contents of the image. */
skip = 0;
if(FloydSteinbergInitG(pdev) == -1)
- return_error(gs_error_VMerror); /* initiate the dithering */
+ return_error(gs_error_VMerror); /* initiate the dithering */
for (y = 0; y < pdev->height ; y++) {
gdev_prn_copy_scan_lines(pdev, y, row, width); /* image -> row */
FloydSteinbergDitheringG(row, dit, width, raster, ppdev->limit); /* gray */
if (bjc_invert_bytes(dit, raster, ppdev->inverse, lastmask)) /* black -> K and check empty line*/
{ /* end of empty lines */
- if (skip) bjc_put_raster_skip(file, skip);
- skip = 1;
+ if (skip) bjc_put_raster_skip(file, skip);
+ skip = 1;
- if(compress) cmplen = bjc_compress(dit, raster, cmp), out = cmp;
+ if(compress) cmplen = bjc_compress(dit, raster, cmp), out = cmp;
else cmplen = raster, out = dit; /* compress or not */
- if(inkc & INK_K) bjc_put_cmyk_image(file, CMYK_K, out, cmplen),
- bjc_put_CR(file);
+ if(inkc & INK_K) bjc_put_cmyk_image(file, CMYK_K, out, cmplen),
+ bjc_put_CR(file);
if(inkc & INK_C) bjc_put_cmyk_image(file, CMYK_C, out, cmplen),
- bjc_put_CR(file);
+ bjc_put_CR(file);
if(inkc & INK_M) bjc_put_cmyk_image(file, CMYK_M, out, cmplen),
- bjc_put_CR(file);
+ bjc_put_CR(file);
if(inkc & INK_Y) bjc_put_cmyk_image(file, CMYK_Y, out, cmplen),
- bjc_put_CR(file); /* use the needed ink(s) */
+ bjc_put_CR(file); /* use the needed ink(s) */
} else skip++; /* +1 empty line */
}
@@ -734,9 +718,9 @@ bjc_print_page_cmyk(gx_device_printer * pdev, FILE * file)
uint a_raster; /* a tmp variable */
uint cmplen;
byte *row = gs_alloc_bytes(pdev->memory, raster*4,
- "bjc cmyk file buffer"); /* one for each component */
+ "bjc cmyk file buffer"); /* one for each component */
byte *cmp = gs_alloc_bytes(pdev->memory, (raster << 1) + 1,
- "bjc cmyk comp buffer"); /*worst case */
+ "bjc cmyk comp buffer"); /*worst case */
byte *rows[4];
byte *outrow; /* misc variable for send a row */
int y;
@@ -757,7 +741,7 @@ bjc_print_page_cmyk(gx_device_printer * pdev, FILE * file)
gx_render_plane_t render_plane;
if (row == 0 || cmp == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Write the setup data. */
@@ -769,7 +753,6 @@ bjc_print_page_cmyk(gx_device_printer * pdev, FILE * file)
bjc_put_set_compression(file, compress);
bjc_put_image_format(file, 0, 0, ink); /* normal ink */
-
/* Write the contents of the image. */
skip = 0;
@@ -853,11 +836,11 @@ bjc_print_page_color(gx_device_printer * pdev, FILE * file)
uint raster = (pdev->width >> 3) + ( (pdev->width % 8) ? 1:0);
uint cmplen;
byte *row = gs_alloc_bytes(pdev->memory, width*4,
- "bjc true file buffer"); /* one for each component */
+ "bjc true file buffer"); /* one for each component */
byte *dit = gs_alloc_bytes(pdev->memory, raster*4,
"bjc true dither buffer");
byte *cmp = gs_alloc_bytes(pdev->memory, (raster << 1) + 1,
- "bjc true comp buffer"); /*worst case */
+ "bjc true comp buffer"); /*worst case */
byte *rowC = dit; /*C*/
byte *rowM = dit + raster; /*M*/
byte *rowY = dit + 2*raster; /*Y*/
@@ -880,7 +863,7 @@ bjc_print_page_color(gx_device_printer * pdev, FILE * file)
float bgamma = ppdev->gamma != 1.0 ? ppdev->gamma:ppdev->blueGamma;
if (row == 0 || cmp == 0 || dit == 0) /* can't allocate row buffer */
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
bjc_build_gamma_table(rgamma, CMYK_C); /* set up the gamma table */
bjc_build_gamma_table(ggamma, CMYK_M); /* set up the gamma table */
@@ -896,16 +879,15 @@ bjc_print_page_color(gx_device_printer * pdev, FILE * file)
bjc_put_set_compression(file, compress);
bjc_put_image_format(file, 0, 0, ink); /* normal ink */
-
/* Write the contents of the image. */
skip = 0;
if(FloydSteinbergInitC(pdev) == -1)
- return_error(gs_error_VMerror); /* initiate the dithering */
+ return_error(gs_error_VMerror); /* initiate the dithering */
for (y = 0; y < pdev->height ; y++) {
gdev_prn_copy_scan_lines(pdev, y, row, gdev_prn_raster(pdev));
- /* image -> row */
+ /* image -> row */
FloydSteinbergDitheringC(row, dit, width, raster, ppdev->limit,
ppdev->compose);
diff --git a/gs/contrib/gdevbjc_.h b/gs/contrib/gdevbjc_.h
index 5ad3f7514..a11f80d4d 100644
--- a/gs/contrib/gdevbjc_.h
+++ b/gs/contrib/gdevbjc_.h
@@ -20,7 +20,7 @@
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111
* U.S.A.
*/
-
+
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved.
This program may also be distributed as part of AFPL Ghostscript, under the
@@ -98,25 +98,25 @@ struct gx_device_bjc_printer_s {
float greenGamma;
float blueGamma;
struct {
- int red;
- int green;
- int blue;
+ int red;
+ int green;
+ int blue;
} paperColor; /* paper color for color correction */
};
typedef struct gx_device_bjc_printer_s gx_device_bjc_printer;
#define bjc_device_margins_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page)\
- std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
- (int)((long)(w10) * (xdpi) / 10),\
- (int)((long)(h10) * (ydpi) / 10),\
- xdpi, ydpi,\
- ncomp, depth, mg, mc, dg, dc,\
- -(lo) * (xdpi), -(to) * (ydpi),\
- (lm) * 72.0, (bm) * 72.0,\
- (rm) * 72.0, (tm) * 72.0\
- ),\
- prn_device_body_rest_(print_page)
+ std_device_full_body_type(dtype, &procs, dname, &st_device_printer,\
+ (int)((long)(w10) * (xdpi) / 10),\
+ (int)((long)(h10) * (ydpi) / 10),\
+ xdpi, ydpi,\
+ ncomp, depth, mg, mc, dg, dc,\
+ -(lo) * (xdpi), -(to) * (ydpi),\
+ (lm) * 72.0, (bm) * 72.0,\
+ (rm) * 72.0, (tm) * 72.0\
+ ),\
+ prn_device_body_rest_(print_page)
#define bjc_device_margins(procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, def_ink)\
{ bjc_device_margins_body(gx_device_bjc_printer, procs, dname,\
@@ -142,21 +142,18 @@ typedef struct gx_device_bjc_printer_s gx_device_bjc_printer;
(int) 255 } /* */ \
}
-
#define bjc_device(procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, def_ink)\
bjc_device_margins(procs, dname, w10, h10, xdpi, ydpi,\
lm, tm, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, def_ink)
-
#define bjc_cmyk_param_procs(v_prn_open, v_prn_output_page, v_prn_close, \
p_map_color_rgb, p_map_cmyk_color, \
- v_prn_get_params, v_prn_put_params)\
+ v_prn_get_params, v_prn_put_params)\
{v_prn_open, NULL, NULL, v_prn_output_page, v_prn_close,\
NULL, p_map_color_rgb, NULL, NULL, NULL, NULL, NULL, NULL,\
v_prn_get_params, v_prn_put_params,\
p_map_cmyk_color, NULL, NULL, NULL, gx_page_device_get_page_device}
-
/* There are the definitions of commands for the Canon BJC printers. */
#define BJC_BJL_CLEANING 0x00 /* "@Cleaning=1\n" */
diff --git a/gs/contrib/gdevbjca.c b/gs/contrib/gdevbjca.c
index d8000b8fc..8da579254 100644
--- a/gs/contrib/gdevbjca.c
+++ b/gs/contrib/gdevbjca.c
@@ -20,7 +20,7 @@
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111
* U.S.A.
*/
-
+
/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved.
This program may also be distributed as part of AFPL Ghostscript, under the
@@ -136,13 +136,13 @@ bjc_put_print_method_short(FILE *file, char color)
}
void
bjc_put_print_method(FILE *file, char color, char media, char quality,
- char density)
+ char density)
{
bjc_put_command(file, 'c', 2 + (density != 0));
fputc(color, file);
fputc(media | quality, file);
- if (density)
- fputc(density, file);
+ if (density)
+ fputc(density, file);
}
/* Set raster resolution (ESC ( d <count> <y_res> [<x_res>]) */
@@ -150,10 +150,10 @@ void
bjc_put_raster_resolution(FILE *file, int x_resolution, int y_resolution)
{
if (x_resolution == y_resolution) {
- bjc_put_command(file, 'd', 2);
+ bjc_put_command(file, 'd', 2);
} else {
- bjc_put_command(file, 'd', 4);
- bjc_put_hi_lo(file, y_resolution);
+ bjc_put_command(file, 'd', 4);
+ bjc_put_hi_lo(file, y_resolution);
}
bjc_put_hi_lo(file, x_resolution);
}
@@ -190,7 +190,7 @@ bjc_put_media_supply(FILE *file, char supply, char type)
/* Identify ink cartridge (ESC ( m <count> <type>) */ /*
void
bjc_put_identify_cartridge(FILE *file,
- bjc_identify_cartridge_command_t command)
+ bjc_identify_cartridge_command_t command)
{
bjc_put_command(s, 'm', 1);
spputc(s, command);
@@ -199,7 +199,7 @@ bjc_put_identify_cartridge(FILE *file,
/* CMYK raster image (ESC ( A <count> <color>) */
void
bjc_put_cmyk_image(FILE *file, char component,
- const char *data, int count)
+ const char *data, int count)
{
bjc_put_command(file, 'A', count + 1);
fputc(component, file);
@@ -272,7 +272,6 @@ bjc_put_indexed_image(FILE *file, int dot_rows, int dot_cols, int layers)
fputc(layers, file);
}
-
/* ------------------------------------------------------------------ */
/* Invert a raster line ( we need it for Black -> K ) */
@@ -281,10 +280,10 @@ bjc_invert_bytes(byte *row, uint raster, bool inverse, byte lastmask)
{ bool ret=false;
for(; raster > 1; row++, raster--) {
- if(!(inverse)) *row = ~(*row);
- if(*row) ret = true;
+ if(!(inverse)) *row = ~(*row);
+ if(*row) ret = true;
}
- if(!(inverse)) *row ^= 0xff;
+ if(!(inverse)) *row ^= 0xff;
*row &= lastmask;
return ret;
}
@@ -302,11 +301,11 @@ bjc_invert_cmyk_bytes(byte *rowC, byte *rowM, byte *rowY, byte *rowK,
skip->skipK=false;
for(; raster > 1; rowC++, rowM++, rowY++, rowK++, raster--) {
- if(inverse) {
- tmpC = ~(*rowC|*rowK);
- tmpM = ~(*rowM|*rowK);
- tmpY = ~(*rowY|*rowK);
- *rowK = ~(*rowC|*rowM|*rowY|*rowK);
+ if(inverse) {
+ tmpC = ~(*rowC|*rowK);
+ tmpM = ~(*rowM|*rowK);
+ tmpY = ~(*rowY|*rowK);
+ *rowK = ~(*rowC|*rowM|*rowY|*rowK);
*rowC = tmpC;
*rowM = tmpM;
*rowY = tmpY;
@@ -315,7 +314,7 @@ bjc_invert_cmyk_bytes(byte *rowC, byte *rowM, byte *rowY, byte *rowK,
if(*rowM) skip->skipM=true;
if(*rowY) skip->skipY=true;
if(*rowK) skip->skipK=true;
- if(*rowC|*rowM|*rowY|*rowK) ret = true;
+ if(*rowC|*rowM|*rowY|*rowK) ret = true;
}
return ret;
}
@@ -332,7 +331,7 @@ bjc_compress(const byte *row, uint raster, byte *compressed)
const byte *end_row = row;
register const byte *exam = row;
register byte *cptr = compressed; /* output pointer into compressed bytes */
-
+
end_row += raster;
while ( exam < end_row ) {
@@ -347,26 +346,23 @@ bjc_compress(const byte *row, uint raster, byte *compressed)
while ( exam < end_row ) {
test2 = *++exam;
if ( test == test2 )
- break;
+ break;
test = test2;
}
-
/* Find out how long the run is */
end_dis = exam - 1;
if ( exam == end_row ) { /* no run */
next = --end_row;
- } else {
+ } else {
next = exam + 1;
while ( next < end_row && *next == test ) next++;
}
-
/* Now [compr..end_dis) should be encoded as dissimilar, */
/* and [end_dis..next) should be encoded as similar. */
/* Note that either of these ranges may be empty. */
-
for ( ; ; ) { /* Encode up to 128 dissimilar bytes */
uint count = end_dis - compr; /* uint for faster switch */
@@ -377,32 +373,31 @@ bjc_compress(const byte *row, uint raster, byte *compressed)
case 3: cptr[3] = compr[2];
case 2: cptr[2] = compr[1];
case 1: cptr[1] = compr[0];
- *cptr = count - 1;
- cptr += count + 1;
+ *cptr = count - 1;
+ cptr += count + 1;
case 0: /* all done */
- break;
+ break;
default:
- if ( count > 128 ) count = 128;
- *cptr++ = count - 1;
- memcpy(cptr, compr, count);
- cptr += count, compr += count;
- continue;
+ if ( count > 128 ) count = 128;
+ *cptr++ = count - 1;
+ memcpy(cptr, compr, count);
+ cptr += count, compr += count;
+ continue;
}
break;
}
-
{ /* Encode up to 128 similar bytes. */
/* Note that count may be <0 at end of row. */
int count = next - end_dis;
if (next < end_row || test != 0)
- while ( count > 0 ) {
+ while ( count > 0 ) {
- int this = (count > 128 ? 128 : count);
- *cptr++ = 257 - this;
- *cptr++ = (byte)test;
- count -= this;
- }
+ int this = (count > 128 ? 128 : count);
+ *cptr++ = 257 - this;
+ *cptr++ = (byte)test;
+ count -= this;
+ }
exam = next;
}
}
@@ -417,7 +412,7 @@ void bjc_rgb_to_cmy(byte r, byte g, byte b,
}
void bjc_rgb_to_gray(byte r, byte g, byte b,
- int *k)
+ int *k)
{
*k = ( (int)r * 77 + (int)g * 151 + (int)b * 28) >> 8;
}
@@ -433,14 +428,14 @@ void bjc_build_gamma_table(float gamma, char color)
switch(color) {
case CMYK_C:
- table = bjc_gamma_tableC;
- break;
+ table = bjc_gamma_tableC;
+ break;
case CMYK_M:
- table = bjc_gamma_tableM;
- break;
+ table = bjc_gamma_tableM;
+ break;
case CMYK_Y:
- table = bjc_gamma_tableY;
- break;
+ table = bjc_gamma_tableY;
+ break;
case CMYK_K:
default:
table = bjc_gamma_tableK;
@@ -475,7 +470,6 @@ uint bjc_rand(void)
return ret & 0x03ff;
} /* random numbers 0-1023 */
-
void bjc_init_tresh(int rnd)
{
int i=(int)(time(NULL) & 0x0ff);
@@ -485,7 +479,6 @@ void bjc_init_tresh(int rnd)
(int)(delta * i / 1024.0 + 2040);
} /* init treshold array ~rnd% around halfway (127*16) */
-
/* Declarations for Floyd-Steinberg dithering.
*
* Errors are accumulated into the array fserrors[], at a resolution of
@@ -530,14 +523,14 @@ FloydSteinbergErrorsG = (int *) gs_alloc_bytes(pdev->memory,
sizeof(int)*(pdev->width+3),
"bjc error buffer");
if (FloydSteinbergErrorsG == 0) /* can't allocate error buffer */
- return -1;
+ return -1;
FloydSteinbergDirectionForward=true;
for (i=0; i < pdev->width+3; i++) FloydSteinbergErrorsG[i] = 0;
/* clear */
bjc_rgb_to_gray(ppdev->paperColor.red,
- ppdev->paperColor.green,
- ppdev->paperColor.blue,
+ ppdev->paperColor.green,
+ ppdev->paperColor.blue,
&FloydSteinbergG);
FloydSteinbergG = (255 - FloydSteinbergG) << 4; /* Maybe */
bjc_init_tresh(ppdev->rnd);
@@ -547,8 +540,8 @@ return 0;
void
FloydSteinbergDitheringG(byte *row, byte *dithered, uint width,
- uint raster, bool limit_extr)
-{
+ uint raster, bool limit_extr)
+{
byte byteG=0, bitmask = 0x80; /* first bit */
int i;
int error = 0, delta;
@@ -559,10 +552,10 @@ FloydSteinbergDitheringG(byte *row, byte *dithered, uint width,
/* First point */
err_vect = FloydSteinbergErrorsG + 1;
- for( i=width; i>0; i--, row++, err_vect++) { /* i, sample, error */
- err_corr = bjc_gamma_tableK[255-(*row)] + FloydSteinbergG;
+ for( i=width; i>0; i--, row++, err_vect++) { /* i, sample, error */
+ err_corr = bjc_gamma_tableK[255-(*row)] + FloydSteinbergG;
if(err_corr > 4080 && limit_extr) err_corr = 4080;
- error += err_corr + *(err_vect+1); /* the error in 1/16 */
+ error += err_corr + *(err_vect+1); /* the error in 1/16 */
if(error > bjc_treshold[bjc_rand()]) {
error -= 4080;
@@ -588,7 +581,7 @@ FloydSteinbergDitheringG(byte *row, byte *dithered, uint width,
*dithered = byteG;
}
else bitmask >>= 1;
- }
+ }
FloydSteinbergDirectionForward=false;
}
else {
@@ -597,8 +590,8 @@ FloydSteinbergDitheringG(byte *row, byte *dithered, uint width,
bitmask = 1 << ((raster << 3 ) - width) ;
err_vect = FloydSteinbergErrorsG + width + 1;
- for( i=width; i>0; i--, row--, err_vect--) {
- err_corr = bjc_gamma_tableK[255-(*row)] + FloydSteinbergG;
+ for( i=width; i>0; i--, row--, err_vect--) {
+ err_corr = bjc_gamma_tableK[255-(*row)] + FloydSteinbergG;
if(err_corr > 4080 && limit_extr) err_corr = 4080;
error += err_corr + *(err_vect - 1);
@@ -626,7 +619,7 @@ FloydSteinbergDitheringG(byte *row, byte *dithered, uint width,
*dithered = byteG;
}
else bitmask <<= 1;
- }
+ }
FloydSteinbergDirectionForward=true;
}
}
@@ -645,16 +638,16 @@ FloydSteinbergErrorsC = (int *) gs_alloc_bytes(pdev->memory,
3*sizeof(int)*(pdev->width+3),
"bjc CMY error buffer");
if (FloydSteinbergErrorsC == 0 ) /* can't allocate error buffer */
- return -1;
+ return -1;
for (i=0; i < 3 * (pdev->width+3); i++) FloydSteinbergErrorsC[i] = 0;
FloydSteinbergDirectionForward=true;
bjc_rgb_to_cmy(ppdev->paperColor.red,
- ppdev->paperColor.green,
- ppdev->paperColor.blue,
- &FloydSteinbergC,
- &FloydSteinbergM,
+ ppdev->paperColor.green,
+ ppdev->paperColor.blue,
+ &FloydSteinbergC,
+ &FloydSteinbergM,
&FloydSteinbergY);
FloydSteinbergC <<= 4;
@@ -667,7 +660,7 @@ return 0;
void
FloydSteinbergDitheringC(byte *row, byte *dithered, uint width,
- uint raster, bool limit_extr, bool composeK)
+ uint raster, bool limit_extr, bool composeK)
{ byte byteC=0, byteM=0, byteY=0, byteK=0, bitmask = 0x80; /* first bit */
int i;
int errorC = 0, errorM = 0, errorY = 0, delta;
@@ -676,7 +669,7 @@ FloydSteinbergDitheringC(byte *row, byte *dithered, uint width,
if (FloydSteinbergDirectionForward) {
err_vect = FloydSteinbergErrorsC + 3; /* errCMY */
- /* First point */
+ /* First point */
for( i=width; i>0; i--, row+=4, err_vect+=3) { /*separate components */
@@ -770,12 +763,12 @@ FloydSteinbergDitheringC(byte *row, byte *dithered, uint width,
FloydSteinbergDirectionForward=false;
}
else {
- row += (width << 2) - 4; /* point to the end of the row */
+ row += (width << 2) - 4; /* point to the end of the row */
dithered += raster - 1;
err_vect = FloydSteinbergErrorsC + 3 * width + 3; /* errCMY */
bitmask = 1 << ((raster << 3 ) - width) ;
- for( i=width; i>0; i--, row-=4, err_vect-=3) {
+ for( i=width; i>0; i--, row-=4, err_vect-=3) {
err_corrC = bjc_gamma_tableC[ (*row) + (*(row+3))]
+ FloydSteinbergC;
@@ -861,7 +854,7 @@ FloydSteinbergDitheringC(byte *row, byte *dithered, uint width,
*(dithered+2*raster) = byteY;
*(dithered+3*raster) = byteK;
}
- else bitmask <<= 1;
+ else bitmask <<= 1;
}
FloydSteinbergDirectionForward=true;
}
diff --git a/gs/contrib/gdevcd8.c b/gs/contrib/gdevcd8.c
index bdca4e6cc..82ba3e65c 100644
--- a/gs/contrib/gdevcd8.c
+++ b/gs/contrib/gdevcd8.c
@@ -36,29 +36,29 @@
HP870, HP890, HP1100, HP1600 and HP2200 color printers.
Also work with HP DesignJet 500 large-format color printer.
To be used with the Ghostscript printing system.
-
+
CREDITS: Much of the driver is based on ideas derived
from the cdj550 driver of George Cameron.
-
- The support for the hp670, hp690, hp890
- and hp1600 was added by Martin Gerbershagen.
- The support for the hp2200 was added by Siow-Kiat Tan.
+ The support for the hp670, hp690, hp890
+ and hp1600 was added by Martin Gerbershagen.
+
+ The support for the hp2200 was added by Siow-Kiat Tan.
- The support for the dnj500 was added by Timur Maximov.
+ The support for the dnj500 was added by Timur Maximov.
-------------------------------------------------------------------*/
-/* Note: Depending on how you transfered the files,
+/* Note: Depending on how you transfered the files,
you might need to remove some CR-codes used on intel-based machines:
simply type: unzip -a hp850.zip
- to compile with gs5.x, simply add
+ to compile with gs5.x, simply add
DEVICE_DEVS4=cdj850.dev cdj670.dev cdj890.dev cdj1600.dev
- to your makefile.
+ to your makefile.
BTW, it is always a good idea to read Make.htm found in the
gs-distrib before attempting to recompile.....
@@ -77,12 +77,11 @@
Problems : Dark colors are still pale.
-
The driver no longer needs special switches to be invoked
except -sDEVICE=cdj850, or -sDEVICE=CDJ890, or sDEVICE=CDJ670
or -sDEVICE=CDJ1600
- The hp690 is supported through the hp670 device, the hp855, hp870
+ The hp690 is supported through the hp670 device, the hp855, hp870
and the hp1100 through the hp850 device.
The driver implements the following switches:
@@ -97,9 +96,9 @@
for printing on special paper or transperencies.
Please revert to the gamma functions in this case.
- -dQuality= -1 draft
+ -dQuality= -1 draft
0 normal [default]
- 1 presentation
+ 1 presentation
-dRetStatus= 0 C-RET off
1 C-RET on [default]
@@ -107,9 +106,9 @@
-dMasterGamma= 3.0 [default = 1.0]
__Note__: To take advantage of the calibrated color-transfer
functions, be sure not to have any Gamma-Statements
- left! If you need to (i.e. overhead sheets),
- you still can use the gamma-functions, but they will
- override the built-in calibration. To use gamma in the
+ left! If you need to (i.e. overhead sheets),
+ you still can use the gamma-functions, but they will
+ override the built-in calibration. To use gamma in the
traditional way, set MasterGamma to any value greater
1.0 and less 10.0. To adjust individual gamma-values,
you have to additionally set MasterGamma to a value
@@ -163,7 +162,7 @@
*/
-/* 25.08.97 Version 1.2. Resolved all but one of the
+/* 25.08.97 Version 1.2. Resolved all but one of the
known bugs, introduced a couple
of perfomance improvements. Complete
new color-transfer-function handling.
@@ -201,39 +200,39 @@ typedef struct hp850_cmyk_init_s {
static const hp850_cmyk_init_t hp850_cmyk_init =
{
{
- 0x02, /* format */
- 0x04, /* number of components */
+ 0x02, /* format */
+ 0x04, /* number of components */
/* black */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* cyan */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* magenta */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* yellow */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02 /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02 /* LSB intensity levels */
}
};
@@ -317,7 +316,6 @@ static const Gamma gammat850 =
166, 169, 174, 177, 182, 187, 194, 203, 215, 255}
};
-
static const Gamma gammat890 =
{
/* Lookup values for cyan */
@@ -360,7 +358,7 @@ static const Gamma gammat890 =
210, 210, 211, 211, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217,
217, 218, 218, 218, 219, 219, 219, 220, 220},
-/* Lookup values for yellow */
+/* Lookup values for yellow */
/* gamma 0.7 */
{0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 17, 18, 20, 21, 23, 24, 25,
@@ -412,23 +410,23 @@ static const Gamma * const gammat[] =
static int
rescale_byte_wise1x1(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise2x1(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise1x2(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise2x2(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int (* const rescale_color_plane[2][2]) (int, const byte *, const byte *, byte *) = {
{
- rescale_byte_wise1x1, rescale_byte_wise1x2
+ rescale_byte_wise1x1, rescale_byte_wise1x2
},
{
- rescale_byte_wise2x1, rescale_byte_wise2x2
+ rescale_byte_wise2x1, rescale_byte_wise2x2
}
};
@@ -446,7 +444,6 @@ static int (* const rescale_color_plane[2][2]) (int, const byte *, const byte *,
#endif
#define DOFFSET (dev_t_margin(pdev) - DESKJET_PRINT_LIMIT) /* Print position */
-
#define W sizeof(word)
#define I sizeof(int)
@@ -465,7 +462,6 @@ typedef enum {
DJ670C, DJ850C, DJ880C, DJ890C, DJ1600C, HP2200C, DNJ500C
} cdj_printer_type_t;
-
/* No. of ink jets (used to minimise head movements)
* NOTE: These don't appear to actually be used anywhere. Can they
* be removed?
@@ -473,7 +469,6 @@ typedef enum {
#define HEAD_ROWS_MONO 50
#define HEAD_ROWS_COLOUR 16
-
/*
* Colour mapping procedures
*/
@@ -484,7 +479,6 @@ static dev_proc_map_color_rgb(gdev_cmyk_map_color_rgb);
static dev_proc_map_rgb_color(gdev_pcl_map_rgb_color);
static dev_proc_map_color_rgb(gdev_pcl_map_color_rgb);
-
/*
* Print-page, parameters and miscellaneous procedures
*/
@@ -505,16 +499,13 @@ static dev_proc_print_page(cdnj500_print_page);
#define prn_colour_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, cmyk, correct)\
prn_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page), cmyk, depth /* default */, correct
-
-
#define gx_prn_colour_device_common \
gx_prn_device_common; \
int cmyk; /* 0: not CMYK-capable, > 0: printing CMYK, */ \
- /* < 0 : CMYK-capable, not printing CMYK */ \
+ /* < 0 : CMYK-capable, not printing CMYK */ \
uint default_depth; /* Used only for CMYK-capable printers now. */ \
uint correction
-
/* some definitions needed later */
struct error_val_field {
int c; /* Current value of Cyan error during dithering */
@@ -578,13 +569,13 @@ struct misc_struct {
/* function pointer typedefs for device driver struct */
typedef void (*StartRasterMode) (gx_device_printer * pdev, int paper_size,
- FILE * prn_stream);
+ FILE * prn_stream);
typedef void (*PrintNonBlankLines) (gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
typedef void (*TerminatePage) (gx_device_printer * pdev, FILE * prn_stream);
@@ -600,10 +591,10 @@ typedef struct gx_device_cdj850_s {
int compression; /* compression level */
float mastergamma; /* Gammavalue applied to all colors */
float gammavalc; /* range to which gamma-correction is
- applied to bw values */
+ applied to bw values */
float gammavalm; /* amount of gamma correction for bw */
float gammavaly; /* range to which gamma-correction i
- applied to color values */
+ applied to color values */
float gammavalk; /* amount of gamma correction for color */
float blackcorrect; /* amount of gamma correction for color */
StartRasterMode start_raster_mode; /* output function to start raster mode */
@@ -616,7 +607,6 @@ typedef struct {
gx_prn_colour_device_common;
} gx_device_colour_prn;
-
/* Use the cprn_device macro to access generic fields (like cmyk,
default_depth and correction), and specific macros for specific
devices. */
@@ -708,40 +698,39 @@ typedef struct {
}
#define cmyk_colour_procs(proc_colour_open, proc_get_params, proc_put_params, \
- map_rgb_color, map_color_rgb, map_cmyk_color)\
+ map_rgb_color, map_color_rgb, map_cmyk_color)\
{ proc_colour_open,\
- gx_default_get_initial_matrix,\
- gx_default_sync_output,\
- gdev_prn_output_page,\
- gdev_prn_close,\
- map_rgb_color,\
- map_color_rgb,\
- NULL /* fill_rectangle */,\
- NULL /* tile_rectangle */,\
- NULL /* copy_mono */,\
- NULL /* copy_color */,\
- NULL /* draw_line */,\
- gx_default_get_bits,\
- proc_get_params,\
- proc_put_params,\
+ gx_default_get_initial_matrix,\
+ gx_default_sync_output,\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ map_rgb_color,\
+ map_color_rgb,\
+ NULL /* fill_rectangle */,\
+ NULL /* tile_rectangle */,\
+ NULL /* copy_mono */,\
+ NULL /* copy_color */,\
+ NULL /* draw_line */,\
+ gx_default_get_bits,\
+ proc_get_params,\
+ proc_put_params,\
map_cmyk_color\
}
-
/* Printer-specific functions. Most printers are handled by the cdj850_xx()
* functions.
*/
static void
cdj850_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
cdj850_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
static void
cdj850_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
@@ -751,15 +740,15 @@ static void
*/
static void
cdj880_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
cdj880_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
static void
cdj880_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
@@ -768,21 +757,21 @@ static void
*/
static void
cdj1600_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
cdj1600_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
static void
cdj1600_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
/* Functions for the HP2200C */
static void
chp2200_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
chp2200_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
@@ -790,98 +779,95 @@ static void
/* Functions for the DNJ500C */
static void
cdnj500_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
cdnj500_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
-
static const gx_device_procs cdj670_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
+ NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
static const gx_device_procs cdj850_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
+ NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
static const gx_device_procs cdj880_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
+ NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
static const gx_device_procs cdj890_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
+ NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
static const gx_device_procs cdj1600_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- gdev_pcl_map_rgb_color, gdev_pcl_map_color_rgb, NULL);
+ gdev_pcl_map_rgb_color, gdev_pcl_map_color_rgb, NULL);
/* HP2200 and DNJ500 is a RGB printer */
static const gx_device_procs chp2200_procs =
cmyk_colour_procs(hp_colour_open, cdj850_get_params, cdj850_put_params,
- gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, NULL);
-
+ gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb, NULL);
const gx_device_cdj850 gs_cdj670_device =
cdj_850_device(cdj670_procs, "cdj670", 600, 600, 32, cdj850_print_page, 0,
- PRESENTATION, PLAIN_PAPER, 2, DJ670C, 9,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj850_start_raster_mode, cdj850_print_non_blank_lines,
- cdj850_terminate_page);
+ PRESENTATION, PLAIN_PAPER, 2, DJ670C, 9,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj850_start_raster_mode, cdj850_print_non_blank_lines,
+ cdj850_terminate_page);
const gx_device_cdj850 gs_cdj850_device =
cdj_850_device(cdj850_procs, "cdj850", 600, 600, 32, cdj850_print_page, 0,
- PRESENTATION, PLAIN_PAPER, 4, DJ850C, 9,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj850_start_raster_mode, cdj850_print_non_blank_lines,
- cdj850_terminate_page);
+ PRESENTATION, PLAIN_PAPER, 4, DJ850C, 9,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj850_start_raster_mode, cdj850_print_non_blank_lines,
+ cdj850_terminate_page);
const gx_device_cdj850 gs_cdj880_device =
cdj_850_device(cdj880_procs, "cdj880", 600, 600, 32, cdj850_print_page, 0,
- PRESENTATION, PLAIN_PAPER, 4, DJ880C, 2,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj880_start_raster_mode, cdj880_print_non_blank_lines,
- cdj880_terminate_page);
+ PRESENTATION, PLAIN_PAPER, 4, DJ880C, 2,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj880_start_raster_mode, cdj880_print_non_blank_lines,
+ cdj880_terminate_page);
const gx_device_cdj850 gs_cdj890_device =
cdj_850_device(cdj890_procs, "cdj890", 600, 600, 32, cdj850_print_page, 0,
- PRESENTATION, PLAIN_PAPER, 4, DJ890C, 9,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj850_start_raster_mode, cdj850_print_non_blank_lines,
- cdj850_terminate_page);
+ PRESENTATION, PLAIN_PAPER, 4, DJ890C, 9,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj850_start_raster_mode, cdj850_print_non_blank_lines,
+ cdj850_terminate_page);
const gx_device_cdj850 gs_cdj1600_device =
cdj_1600_device(cdj1600_procs, "cdj1600", 300, 300, 24, cdj850_print_page, 0,
- PRESENTATION, PLAIN_PAPER, 2, DJ1600C, 3,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj1600_start_raster_mode, cdj1600_print_non_blank_lines,
- cdj1600_terminate_page);
+ PRESENTATION, PLAIN_PAPER, 2, DJ1600C, 3,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj1600_start_raster_mode, cdj1600_print_non_blank_lines,
+ cdj1600_terminate_page);
/* HP2200 does not need color matching and halftoning parameters */
const gx_device_cdj850 gs_chp2200_device =
chp_2200_device(chp2200_procs, "chp2200", 300, 300, 24, chp2200_print_page, 0,
- NORMAL, PLAIN_PAPER, 0 /*unused*/, HP2200C, 10,
- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/
- chp2200_start_raster_mode, NULL /*unused*/,
- chp2200_terminate_page);
+ NORMAL, PLAIN_PAPER, 0 /*unused*/, HP2200C, 10,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/
+ chp2200_start_raster_mode, NULL /*unused*/,
+ chp2200_terminate_page);
/* DNJ500 does not need color matching and halftoning parameters */
const gx_device_cdj850 gs_cdnj500_device =
chp_2200_device(chp2200_procs, "cdnj500", 300, 300, 24, cdnj500_print_page, 0,
- NORMAL, PLAIN_PAPER, 0 /*unused*/, DNJ500C, 10,
- 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/
- cdnj500_start_raster_mode, NULL /*unused*/,
- cdnj500_terminate_page);
+ NORMAL, PLAIN_PAPER, 0 /*unused*/, DNJ500C, 10,
+ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, /*all unused*/
+ cdnj500_start_raster_mode, NULL /*unused*/,
+ cdnj500_terminate_page);
/* Forward references */
static int cdj_put_param_int(gs_param_list *, gs_param_name,
- int *, int, int, int);
+ int *, int, int, int);
static int cdj_put_param_float(gs_param_list *, gs_param_name, float
- *, float, float, int);
+ *, float, float, int);
static int cdj_put_param_bpp(gx_device *, gs_param_list *, int, int, int);
static int cdj_set_bpp(gx_device *, int, int);
-
/* hp_colour_open()
*
* Open the printer and set up the margins. Also, set parameters for
@@ -893,165 +879,165 @@ static int
hp_colour_open(gx_device * pdev)
{ /* Change the margins if necessary. */
static const float dj_a4[4] = {
- DESKJET_MARGINS_A4
+ DESKJET_MARGINS_A4
};
static const float dj_letter[4] = {
- DESKJET_MARGINS_LETTER
+ DESKJET_MARGINS_LETTER
};
/* margins for DJ1600C from manual */
static const float m_cdj1600[4] = {
- 0.25, 0.5, 0.25, 0.5
+ 0.25, 0.5, 0.25, 0.5
};
/* margins for HP2200C */
static const float chp2200_a4[4] = {
- 0.13, 0.46, 0.13, 0.08
+ 0.13, 0.46, 0.13, 0.08
};
static const float chp2200_letter[4] = {
- 0.25, 0.46, 0.25, 0.08
+ 0.25, 0.46, 0.25, 0.08
};
/* margins for DNJ500C */
static const float cdnj500[4] = {
- 0.00, 0.00, 0.00, 0.00
+ 0.00, 0.00, 0.00, 0.00
};
const float *m = (float *)0;
/* Set up colour params if put_params has not already done so */
if (pdev->color_info.num_components == 0) {
- int code = cdj_set_bpp(pdev, pdev->color_info.depth,
- pdev->color_info.num_components);
+ int code = cdj_set_bpp(pdev, pdev->color_info.depth,
+ pdev->color_info.num_components);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
/* assign printer type and set resolution dependent on printer type */
switch (cdj850->ptype) {
case DJ670C:
- if (cdj850->papertype <= SPECIAL_PAPER) { /* paper */
- if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- cdj850->xscal = 0;
- cdj850->yscal = 0;
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 600.0, 300.0);
- cdj850->xscal = 1;
- cdj850->yscal = 0;
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- cdj850->xscal = 1;
- cdj850->yscal = 1;
- }
- } else { /* film */
- gx_device_set_resolution(pdev, 600.0, 300.0);
- cdj850->xscal = 1;
- cdj850->yscal = 0;
- }
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
- break;
+ if (cdj850->papertype <= SPECIAL_PAPER) { /* paper */
+ if (cdj850->quality == DRAFT) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ cdj850->xscal = 0;
+ cdj850->yscal = 0;
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 600.0, 300.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 0;
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 1;
+ }
+ } else { /* film */
+ gx_device_set_resolution(pdev, 600.0, 300.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 0;
+ }
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
+ break;
case DJ850C:
if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- cdj850->xscal = 0;
- cdj850->yscal = 0;
- cdj850->intensities = 2;
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 600.0, 600.0);
- cdj850->xscal = 1;
- cdj850->yscal = 1;
- /* only 3 intensities for normal paper */
- if (cdj850->papertype <= PLAIN_PAPER) {
- cdj850->intensities = 3;
- } /* else cdj850->intensities = 4 from initialization */
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- cdj850->xscal = 1;
- cdj850->yscal = 1;
- /* intensities = 4 from initialization */
- }
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
- break;
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ cdj850->xscal = 0;
+ cdj850->yscal = 0;
+ cdj850->intensities = 2;
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 1;
+ /* only 3 intensities for normal paper */
+ if (cdj850->papertype <= PLAIN_PAPER) {
+ cdj850->intensities = 3;
+ } /* else cdj850->intensities = 4 from initialization */
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 1;
+ /* intensities = 4 from initialization */
+ }
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
+ break;
case DJ880C:
- if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- cdj850->xscal = 0;
- cdj850->yscal = 0;
- cdj850->intensities = 2;
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 600.0, 300.0);
- cdj850->xscal = 1;
- cdj850->yscal = 0;
- /* only 3 intensities for normal paper */
- if (cdj850->papertype <= PLAIN_PAPER) {
- cdj850->intensities = 4;
- } /* else cdj850->intensities = 4 from initialization */
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- cdj850->xscal = 0; /* color is also 600dpi in PRESENTATION mode */
- cdj850->yscal = 0;
- cdj850->intensities = 4;
- }
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
- break;
+ if (cdj850->quality == DRAFT) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ cdj850->xscal = 0;
+ cdj850->yscal = 0;
+ cdj850->intensities = 2;
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 600.0, 300.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 0;
+ /* only 3 intensities for normal paper */
+ if (cdj850->papertype <= PLAIN_PAPER) {
+ cdj850->intensities = 4;
+ } /* else cdj850->intensities = 4 from initialization */
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ cdj850->xscal = 0; /* color is also 600dpi in PRESENTATION mode */
+ cdj850->yscal = 0;
+ cdj850->intensities = 4;
+ }
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
+ break;
case DJ890C:
- if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- cdj850->xscal = 0;
- cdj850->yscal = 0;
- cdj850->intensities = 2;
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 600.0, 300.0);
- cdj850->xscal = 1;
- cdj850->yscal = 0;
- /* only 3 intensities for normal paper */
- if (cdj850->papertype <= PLAIN_PAPER) {
- cdj850->intensities = 3;
- } /* else cdj850->intensities = 4 from initialization */
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- cdj850->xscal = 1;
- cdj850->yscal = 1;
- /* intensities = 4 from initialization */
- }
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
- break;
+ if (cdj850->quality == DRAFT) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ cdj850->xscal = 0;
+ cdj850->yscal = 0;
+ cdj850->intensities = 2;
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 600.0, 300.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 0;
+ /* only 3 intensities for normal paper */
+ if (cdj850->papertype <= PLAIN_PAPER) {
+ cdj850->intensities = 3;
+ } /* else cdj850->intensities = 4 from initialization */
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ cdj850->xscal = 1;
+ cdj850->yscal = 1;
+ /* intensities = 4 from initialization */
+ }
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
+ break;
case DJ1600C:
- gx_device_set_resolution(pdev, 300.0, 300.0);
- m = m_cdj1600;
- break;
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ m = m_cdj1600;
+ break;
/* HP2200 supports 300dpi draft/normal and 600dpi normal/best
for all media types. For normal, we are only using 300dpi here*/
case HP2200C:
cdj850->xscal = 0; /* unused */
cdj850->yscal = 0; /* unused */
cdj850->intensities = 0; /* unused */
- if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- }
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? chp2200_a4 : chp2200_letter);
- break;
+ if (cdj850->quality == DRAFT) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ }
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? chp2200_a4 : chp2200_letter);
+ break;
/* DNJ500 supports 300dpi and 600dpi with any combinations */
case DNJ500C:
cdj850->xscal = 0; /* unused */
cdj850->yscal = 0; /* unused */
cdj850->intensities = 0; /* unused */
- if (cdj850->quality == DRAFT) {
- gx_device_set_resolution(pdev, 300.0, 300.0);
- } else if (cdj850->quality == NORMAL) {
- gx_device_set_resolution(pdev, 600.0, 600.0);
- } else { /* quality == PRESENTATION */
- gx_device_set_resolution(pdev, 600.0, 600.0);
- }
- m = cdnj500;
- break;
+ if (cdj850->quality == DRAFT) {
+ gx_device_set_resolution(pdev, 300.0, 300.0);
+ } else if (cdj850->quality == NORMAL) {
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ } else { /* quality == PRESENTATION */
+ gx_device_set_resolution(pdev, 600.0, 600.0);
+ }
+ m = cdnj500;
+ break;
default:
- assert(0);
+ assert(0);
}
gx_device_set_margins(pdev, m, true);
return gdev_prn_open(pdev);
@@ -1064,22 +1050,22 @@ cdj850_get_params(gx_device * pdev, gs_param_list * plist)
int code = gdev_prn_get_params(pdev, plist);
if (code < 0 ||
- (code = param_write_int(plist, "Quality", &cdj850->quality)) < 0 ||
- (code = param_write_int(plist, "Papertype", &cdj850->papertype)) < 0 ||
- (code = param_write_float(plist, "MasterGamma", &cdj850->gammavalc))
- < 0 ||
- (code = param_write_float(plist, "GammaValC", &cdj850->gammavalc)) <
- 0 ||
- (code = param_write_float(plist, "GammaValM", &cdj850->gammavalm)) <
- 0 ||
- (code = param_write_float(plist, "GammaValY", &cdj850->gammavaly)) <
- 0 ||
- (code = param_write_float(plist, "GammaValK", &cdj850->gammavalk)) <
- 0 ||
- (code = param_write_float(plist, "BlackCorrect",
- &cdj850->blackcorrect)) < 0
- )
- return code;
+ (code = param_write_int(plist, "Quality", &cdj850->quality)) < 0 ||
+ (code = param_write_int(plist, "Papertype", &cdj850->papertype)) < 0 ||
+ (code = param_write_float(plist, "MasterGamma", &cdj850->gammavalc))
+ < 0 ||
+ (code = param_write_float(plist, "GammaValC", &cdj850->gammavalc)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValM", &cdj850->gammavalm)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValY", &cdj850->gammavaly)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValK", &cdj850->gammavalk)) <
+ 0 ||
+ (code = param_write_float(plist, "BlackCorrect",
+ &cdj850->blackcorrect)) < 0
+ )
+ return code;
return code;
}
@@ -1107,14 +1093,13 @@ cdj850_put_params(gx_device * pdev, gs_param_list * plist)
code = cdj_put_param_float(plist, "GammaValY", &gammavaly, 0.0, 9.0, code);
code = cdj_put_param_float(plist, "GammaValK", &gammavalk, 0.0, 9.0, code);
code = cdj_put_param_float(plist, "BlackCorrect", &blackcorrect, 0.0,
- 9.0, code);
-
+ 9.0, code);
if (code < 0)
- return code;
+ return code;
code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
if (code < 0)
- return code;
+ return code;
cdj850->quality = quality;
cdj850->papertype = papertype;
@@ -1130,7 +1115,6 @@ cdj850_put_params(gx_device * pdev, gs_param_list * plist)
/* ------ Internal routines ------ */
/* The DeskJet850C can compress (mode 9) */
-
/* Some convenient shorthand .. */
#define x_dpi (pdev->x_pixels_per_inch)
#define y_dpi (pdev->y_pixels_per_inch)
@@ -1141,46 +1125,46 @@ cdj850_put_params(gx_device * pdev, gs_param_list * plist)
/* internal functions */
static void
FSDlinebw(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * kP,
- int n, int *ep, byte * dp);
+ struct error_val_field *error_values,
+ byte * kP,
+ int n, int *ep, byte * dp);
static void
FSDlinec2(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa, int n,
- byte * dp, int *ep);
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa, int n,
+ byte * dp, int *ep);
static void
FSDlinec3(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep);
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep);
static void
FSDlinec4(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep);
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep);
static void
init_error_buffer(struct misc_struct *misc_vars,
- struct ptr_arrays *data_ptrs);
+ struct ptr_arrays *data_ptrs);
static void
do_floyd_steinberg(int scan, int cscan, int plane_size,
- int plane_size_c, int n,
- struct ptr_arrays *data_ptrs,
- gx_device_printer * pdev,
- struct error_val_field *error_values);
+ int plane_size_c, int n,
+ struct ptr_arrays *data_ptrs,
+ gx_device_printer * pdev,
+ struct error_val_field *error_values);
static int
do_gcr(int bytecount, byte * inbyte, const byte * kvalues,
- const byte * cvalues, const byte * mvalues,
- const byte * yvalues, const int *kcorrect,
- word * inword);
+ const byte * cvalues, const byte * mvalues,
+ const byte * yvalues, const int *kcorrect,
+ word * inword);
/* UNUSED
*static int
- *test_scan (P4(int size,
+ *test_scan (P4(int size,
* byte * current,
- * byte * last,
+ * byte * last,
* byte * control));
*static void
*save_color_data(P3(int size,
@@ -1190,11 +1174,11 @@ static int
*/
static void
send_scan_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
static void
do_gamma(float mastergamma, float gammaval, byte * values);
static void
@@ -1202,22 +1186,21 @@ static void
static void
init_data_structure(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars);
static void
calculate_memory_size(gx_device_printer * pdev,
- struct misc_struct *misc_vars);
-
+ struct misc_struct *misc_vars);
static void
assign_dpi(int dpi, byte * msb)
{
if (dpi == 600) {
- msb[0] = 0x02;
- msb[1] = 0x58;
+ msb[0] = 0x02;
+ msb[1] = 0x58;
} else {
- msb[0] = 0x01;
- msb[1] = 0x2c;
+ msb[0] = 0x01;
+ msb[1] = 0x2c;
}
}
@@ -1271,9 +1254,9 @@ cdj850_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* gamma.k[i] = (int)(sqrt((float)i)/16);*/
/* if mastergamma, don't use the built in functions */
/* if (cdj850->mastergamma > 1.0) {*/
- /* prepare the bw lookup table */
+ /* prepare the bw lookup table */
/* do_gamma(cdj850->mastergamma, cdj850->gammavalk, gamma.k);*/
- /* prepare the color lookup table */
+ /* prepare the color lookup table */
for (i=0; i<256; i++)
gamma.c[i] = (int)(((float)(i*i*i))/(256.0*256.0));
/* do_gamma(cdj850->mastergamma, cdj850->gammavalc, gamma.c);*/
@@ -1304,11 +1287,11 @@ cdj850_print_page(gx_device_printer * pdev, FILE * prn_stream)
storagee contains the errors from b/w fs-ditherng */
data_ptrs.storage = (ulong *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), misc_vars.storage_size_words, W,
- "cdj850_print_page");
+ "cdj850_print_page");
/* if we can't allocate working area */
if (data_ptrs.storage == 0) {
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
}
/* Initialise the needed pointers */
init_data_structure(pdev, &data_ptrs, &misc_vars);
@@ -1318,14 +1301,14 @@ cdj850_print_page(gx_device_printer * pdev, FILE * prn_stream)
/* Send each scan line in turn */
send_scan_lines(pdev, &data_ptrs, &misc_vars,
- &error_values, &gamma, prn_stream);
+ &error_values, &gamma, prn_stream);
/* terminate page and eject paper */
(*cdj850->terminate_page) (pdev, prn_stream);
/* Free Memory */
gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)data_ptrs.storage, misc_vars.storage_size_words, W,
- "hp850_print_page");
+ "hp850_print_page");
return 0;
}
@@ -1369,7 +1352,7 @@ getPixel(byte* pixAddress, unsigned int pixelOffset)
/* BGRBGR format */
/*
- return (((unsigned int)(*(pixAddress+2)) << 16) +
+ return (((unsigned int)(*(pixAddress+2)) << 16) +
((unsigned int)(*(pixAddress+1)) << 8 ) +
((*(pixAddress)) & kWhite));
*/
@@ -1464,8 +1447,8 @@ Mode10(unsigned int planeWidthInPixels,
curPixel++;
}
seedRowPixelCopyCount = curPixel - seedRowPixelCopyCount;
-
- /* On last pixel of row. RLE could also leave us on the last pixel of the row
+
+ /* On last pixel of row. RLE could also leave us on the last pixel of the row
from the previous iteration. */
if (curPixel == lastPixel)
{
@@ -1534,7 +1517,7 @@ Mode10(unsigned int planeWidthInPixels,
if (0 == replacementCount) /* no RLE so it's a literal by default.*/
{
unsigned int tempPixel = getPixel(curPtr, curPixel);
- unsigned int tempPixel2 = 0;
+ unsigned int tempPixel2 = 0;
CMDByte = eLiteral;
if (cachedColor == tempPixel)
@@ -1743,19 +1726,19 @@ chp2200_print_page(gx_device_printer * pdev, FILE * prn_stream)
int width_in_pixels = pdev->width;
int width_in_bytes = width_in_pixels * 3; /* assume 24 bits (3 bytes per pixel) */
byte *lbuf = gs_alloc_bytes(mem, width_in_bytes,
- "(input)chp2200_print_page");
+ "(input)chp2200_print_page");
byte *lseedbuf = gs_alloc_bytes(mem, width_in_bytes,
- "(seed)chp2200_print_page");
+ "(seed)chp2200_print_page");
/* allocate twice the input size for worse case compressed output*/
- byte *loutputbuf = gs_alloc_bytes(mem, width_in_bytes*2,
- "(output)chp2200_print_page");
+ byte *loutputbuf = gs_alloc_bytes(mem, width_in_bytes*2,
+ "(output)chp2200_print_page");
int lnum = 0;
int iEmptyRows = 0;
byte *data = lbuf;
if ((lbuf == 0) || (lseedbuf == 0) || (loutputbuf == 0))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Start Raster mode */
(*cdj850->start_raster_mode) (pdev,
@@ -1772,17 +1755,17 @@ chp2200_print_page(gx_device_printer * pdev, FILE * prn_stream)
{
int result = -1;
- /*gdev_prn_get_bits(pdev, lnum, lbuf, &data);*/
+ /*gdev_prn_get_bits(pdev, lnum, lbuf, &data);*/
result = gdev_prn_copy_scan_lines(pdev, lnum, data, width_in_bytes);
if ((result == 1) && IsScanlineDirty(data, width_in_bytes))
{
- unsigned int OutputLen = 0;
+ unsigned int OutputLen = 0;
if (iEmptyRows)
{
- /* send vertical Y move */
- fprintf(prn_stream, "%dy", iEmptyRows);
+ /* send vertical Y move */
+ fprintf(prn_stream, "%dy", iEmptyRows);
/* reset empty row count */
iEmptyRows = 0;
@@ -1799,14 +1782,14 @@ chp2200_print_page(gx_device_printer * pdev, FILE * prn_stream)
if (OutputLen)
{
fprintf(prn_stream, "%dw", OutputLen);
- fwrite(loutputbuf, sizeof(byte), OutputLen, prn_stream);
+ fwrite(loutputbuf, sizeof(byte), OutputLen, prn_stream);
/* save the current scanline as the seed for the next scanline*/
memcpy((void*)lseedbuf, (const void*)data, width_in_bytes);
}
else
{
- fputs("0w", prn_stream);
+ fputs("0w", prn_stream);
}
}
else
@@ -1848,12 +1831,12 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
int width_in_pixels = pdev->width;
int width_in_bytes = width_in_pixels * 3; /* assume 24 bits (3 bytes per pixel) */
byte *lbuf = gs_alloc_bytes(mem, width_in_bytes,
- "(input)cdnj500_print_page");
+ "(input)cdnj500_print_page");
byte *lseedbuf = gs_alloc_bytes(mem, width_in_bytes,
- "(seed)cdnj500_print_page");
+ "(seed)cdnj500_print_page");
/* allocate twice the input size for worse case compressed output*/
- byte *loutputbuf = gs_alloc_bytes(mem, width_in_bytes*2,
- "(output)cdnj500_print_page");
+ byte *loutputbuf = gs_alloc_bytes(mem, width_in_bytes*2,
+ "(output)cdnj500_print_page");
int lnum = 0;
int iEmptyRows = 0;
@@ -1862,7 +1845,7 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
byte *data = lbuf;
if ((lbuf == 0) || (lseedbuf == 0) || (loutputbuf == 0))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Start Raster mode */
(*cdj850->start_raster_mode) (pdev,
@@ -1879,7 +1862,7 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
{
int result = -1;
- /*gdev_prn_get_bits(pdev, lnum, lbuf, &data);*/
+ /*gdev_prn_get_bits(pdev, lnum, lbuf, &data);*/
result = gdev_prn_copy_scan_lines(pdev, lnum, data, width_in_bytes);
if ((result == 1) && IsScanlineDirty(data, width_in_bytes))
@@ -1906,7 +1889,7 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
{
/* Send CRD */
fwrite(CRD_SeqC, sizeof(byte), sizeof(CRD_SeqC), prn_stream);
-
+
/* Raster mode */
fputs("\033*r1A", prn_stream);
@@ -1920,8 +1903,8 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
if (iEmptyRows)
{
- /* send vertical Y move */
- fprintf(prn_stream, "%dy", iEmptyRows);
+ /* send vertical Y move */
+ fprintf(prn_stream, "%dy", iEmptyRows);
/* reset empty row count */
iEmptyRows = 0;
@@ -1938,14 +1921,14 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
if (OutputLen)
{
fprintf(prn_stream, "%dw", OutputLen);
- fwrite(loutputbuf, sizeof(byte), OutputLen, prn_stream);
+ fwrite(loutputbuf, sizeof(byte), OutputLen, prn_stream);
/* save the current scanline as the seed for the next scanline*/
memcpy((void*)lseedbuf, (const void*)data, width_in_bytes);
}
else
{
- fputs("0w", prn_stream);
+ fputs("0w", prn_stream);
}
/* Content printing already started */
@@ -1971,14 +1954,13 @@ cdnj500_print_page(gx_device_printer * pdev, FILE * prn_stream)
return 0;
}
-
#define odd(i) ((i & 01) != 0)
static int
GetScanLine(gx_device_printer * pdev, int *lnum,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- word rmask)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ word rmask)
{
word *data_words = (word *) data_ptrs->data[misc_vars->scan];
register word *end_data = data_words + misc_vars->line_size_words;
@@ -1994,7 +1976,7 @@ GetScanLine(gx_device_printer * pdev, int *lnum,
/* Remove trailing 0s. */
while (end_data > data_words && end_data[-1] == 0)
- end_data--;
+ end_data--;
return end_data - data_words;
}
@@ -2002,11 +1984,11 @@ GetScanLine(gx_device_printer * pdev, int *lnum,
/* Send the scan lines to the printer */
static void
send_scan_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream)
{
int lnum, lend, llen;
int num_blank_lines = 0;
@@ -2017,7 +1999,7 @@ send_scan_lines(gx_device_printer * pdev,
lend = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi;
error_values->c = error_values->m = error_values->y =
- error_values->k = 0;
+ error_values->k = 0;
/* init the error buffer */
init_error_buffer(misc_vars, data_ptrs);
@@ -2026,59 +2008,58 @@ send_scan_lines(gx_device_printer * pdev,
lnum = -1;
llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
while (lnum < lend) {
- num_blank_lines = 0;
- while (lnum < lend && llen == 0) {
- ++num_blank_lines;
- llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
- }
- if (lnum >= lend) {
- break;
- }
- /* Skip blank lines if any */
- if (num_blank_lines > 0) {
- fprintf(prn_stream, "\033*b%dY", num_blank_lines / (cdj850->yscal + 1));
- memset(data_ptrs->plane_data[0][0], 0,
- (misc_vars->plane_size * 2 * misc_vars->num_comps));
- memset(data_ptrs->plane_data_c[0][0], 0,
- (misc_vars->plane_size_c * 2 * misc_vars->num_comps));
-
- }
- /* all blank lines printed, now for the non-blank lines */
- if (cdj850->yscal && odd(lnum)) {
- /* output a blank black plane for odd lines */
- fprintf(prn_stream, "\033*b0V");
- }
- /* now output all non blank lines */
- while (lnum < lend && llen != 0) {
- misc_vars->is_color_data = 0; /* maybe we have color ? */
- (*cdj850->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
- error_values, gamma, prn_stream);
- llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
- }
- if (cdj850->yscal && odd(lnum)) { /* output empty line for odd lines */
- (*cdj850->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
- error_values, gamma, prn_stream);
- }
- /* the current line is empty => run the next iteration */
+ num_blank_lines = 0;
+ while (lnum < lend && llen == 0) {
+ ++num_blank_lines;
+ llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
+ }
+ if (lnum >= lend) {
+ break;
+ }
+ /* Skip blank lines if any */
+ if (num_blank_lines > 0) {
+ fprintf(prn_stream, "\033*b%dY", num_blank_lines / (cdj850->yscal + 1));
+ memset(data_ptrs->plane_data[0][0], 0,
+ (misc_vars->plane_size * 2 * misc_vars->num_comps));
+ memset(data_ptrs->plane_data_c[0][0], 0,
+ (misc_vars->plane_size_c * 2 * misc_vars->num_comps));
+
+ }
+ /* all blank lines printed, now for the non-blank lines */
+ if (cdj850->yscal && odd(lnum)) {
+ /* output a blank black plane for odd lines */
+ fprintf(prn_stream, "\033*b0V");
+ }
+ /* now output all non blank lines */
+ while (lnum < lend && llen != 0) {
+ misc_vars->is_color_data = 0; /* maybe we have color ? */
+ (*cdj850->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
+ error_values, gamma, prn_stream);
+ llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
+ }
+ if (cdj850->yscal && odd(lnum)) { /* output empty line for odd lines */
+ (*cdj850->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
+ error_values, gamma, prn_stream);
+ }
+ /* the current line is empty => run the next iteration */
}
}
/* print_line compresses (mode 9) and outputs one plane */
static void
print_c9plane(FILE * prn_stream, char plane_code, int plane_size,
- const byte * curr, const byte * prev, byte * out_data)
+ const byte * curr, const byte * prev, byte * out_data)
{
/* Compress the output data */
int out_count = gdev_pcl_mode9compress(plane_size, curr, prev, out_data);
/* and output the data */
- fprintf(prn_stream, "%d%c", out_count, plane_code);
+ fprintf(prn_stream, "%d%c", out_count, plane_code);
if (out_count > 0) {
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
}
}
-
/* print_c2plane()
*
* Compresses a single plane with mode 2 (TIFF 4 format) and sends the
@@ -2102,7 +2083,6 @@ print_c2plane(FILE *prn_stream, char plane_code, int plane_size,
fwrite(out_data, sizeof(byte), out_count, prn_stream);
}
-
/* print_c0plane()
*
* Outputs a plane with no compression.
@@ -2116,15 +2096,14 @@ print_c0plane(FILE *prn_stream, char plane_code, int plane_size,
fwrite(curr, sizeof(byte), plane_size, prn_stream);
}
-
/* Printing non-blank lines */
static void
cdj850_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream)
{
static const char *const plane_code[2] =
{"wvvv", "vvvv"};
@@ -2140,57 +2119,57 @@ cdj850_print_non_blank_lines(gx_device_printer * pdev,
might generate black */
misc_vars->is_color_data =
- do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
- gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct,
- (word *) data_ptrs->data[misc_vars->scan]);
+ do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
+ gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct,
+ (word *) data_ptrs->data[misc_vars->scan]);
/* dithering the black-plane */
FSDlinebw(misc_vars->scan, misc_vars->plane_size,
- error_values, kP, misc_vars->num_comps, ep, dp);
+ error_values, kP, misc_vars->num_comps, ep, dp);
/* output the black plane */
print_c9plane(prn_stream, 'v', misc_vars->plane_size,
- data_ptrs->plane_data[misc_vars->scan][3],
- data_ptrs->plane_data[1 - misc_vars->scan][3],
- data_ptrs->out_data);
+ data_ptrs->plane_data[misc_vars->scan][3],
+ data_ptrs->plane_data[1 - misc_vars->scan][3],
+ data_ptrs->out_data);
/* since color resolution is only half of the b/w-resolution,
we only output every second row */
if (!cdj850->yscal || misc_vars->is_two_pass) {
- int plane_size_c = (*rescale_color_plane[cdj850->xscal][cdj850->yscal])
- (misc_vars->databuff_size,
- data_ptrs->data[misc_vars->scan],
- data_ptrs->data[!misc_vars->scan],
- data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
-
- /* dither the color planes */
- do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
- misc_vars->plane_size, plane_size_c,
- misc_vars->num_comps, data_ptrs, pdev, error_values);
-
- /* Transfer raster graphics in the order C, M, Y, that is
- planes 2,1,0 */
- for (i = misc_vars->num_comps - 2; i >= 0; i--) {
-
- /* output the lower color planes */
- print_c9plane(prn_stream, plane_code[cdj850->intensities > 2][i],
- plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i],
- data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
- data_ptrs->out_data);
-
- /* output the upper color planes */
- if (cdj850->intensities > 2) {
- print_c9plane(prn_stream, plane_code[0][i], plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
- data_ptrs->plane_data_c[1 -
- misc_vars->cscan][i
- + 4],
- data_ptrs->out_data);
- } /* end cdj850->intensities > 2 */
- } /* End For i = num_comps */
- misc_vars->cscan = 1 - misc_vars->cscan;
+ int plane_size_c = (*rescale_color_plane[cdj850->xscal][cdj850->yscal])
+ (misc_vars->databuff_size,
+ data_ptrs->data[misc_vars->scan],
+ data_ptrs->data[!misc_vars->scan],
+ data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
+
+ /* dither the color planes */
+ do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
+ misc_vars->plane_size, plane_size_c,
+ misc_vars->num_comps, data_ptrs, pdev, error_values);
+
+ /* Transfer raster graphics in the order C, M, Y, that is
+ planes 2,1,0 */
+ for (i = misc_vars->num_comps - 2; i >= 0; i--) {
+
+ /* output the lower color planes */
+ print_c9plane(prn_stream, plane_code[cdj850->intensities > 2][i],
+ plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i],
+ data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
+ data_ptrs->out_data);
+
+ /* output the upper color planes */
+ if (cdj850->intensities > 2) {
+ print_c9plane(prn_stream, plane_code[0][i], plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
+ data_ptrs->plane_data_c[1 -
+ misc_vars->cscan][i
+ + 4],
+ data_ptrs->out_data);
+ } /* end cdj850->intensities > 2 */
+ } /* End For i = num_comps */
+ misc_vars->cscan = 1 - misc_vars->cscan;
} /* End of is_two_pass */
return;
}
@@ -2198,11 +2177,11 @@ cdj850_print_non_blank_lines(gx_device_printer * pdev,
/* Printing non-blank lines */
static void
cdj880_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream)
{
static const char *const plane_code[2] =
{"WVVV", "VVVV"};
@@ -2218,61 +2197,61 @@ cdj880_print_non_blank_lines(gx_device_printer * pdev,
might generate black */
misc_vars->is_color_data =
- do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
- gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct,
- (word *) data_ptrs->data[misc_vars->scan]);
+ do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
+ gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct,
+ (word *) data_ptrs->data[misc_vars->scan]);
/* dithering the black-plane */
FSDlinebw(misc_vars->scan, misc_vars->plane_size,
- error_values, kP, misc_vars->num_comps, ep, dp);
+ error_values, kP, misc_vars->num_comps, ep, dp);
/* output the black plane */
fputs("\033*b", prn_stream);
print_c2plane(prn_stream, 'V', misc_vars->plane_size,
- data_ptrs->plane_data[misc_vars->scan][3],
+ data_ptrs->plane_data[misc_vars->scan][3],
/* data_ptrs->plane_data[1 - misc_vars->scan][3],*/
- data_ptrs->out_data);
+ data_ptrs->out_data);
/* fputs("\033*b0V", prn_stream);*/
/* since color resolution is only half of the b/w-resolution,
we only output every second row */
if (!cdj850->yscal || misc_vars->is_two_pass) {
- int plane_size_c = (*rescale_color_plane[cdj850->xscal][cdj850->yscal])
- (misc_vars->databuff_size,
- data_ptrs->data[misc_vars->scan],
- data_ptrs->data[!misc_vars->scan],
- data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
+ int plane_size_c = (*rescale_color_plane[cdj850->xscal][cdj850->yscal])
+ (misc_vars->databuff_size,
+ data_ptrs->data[misc_vars->scan],
+ data_ptrs->data[!misc_vars->scan],
+ data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
- /* dither the color planes */
- do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
- misc_vars->plane_size, plane_size_c,
- misc_vars->num_comps, data_ptrs, pdev, error_values);
+ /* dither the color planes */
+ do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
+ misc_vars->plane_size, plane_size_c,
+ misc_vars->num_comps, data_ptrs, pdev, error_values);
- /* Transfer raster graphics in the order C, M, Y, that is
- planes 2,1,0 */
- for (i = misc_vars->num_comps - 2; i >= 0; i--) {
+ /* Transfer raster graphics in the order C, M, Y, that is
+ planes 2,1,0 */
+ for (i = misc_vars->num_comps - 2; i >= 0; i--) {
- /* output the lower color planes */
+ /* output the lower color planes */
fputs("\033*b", prn_stream);
- print_c2plane(prn_stream, plane_code[cdj850->intensities > 2][i],
- plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i],
+ print_c2plane(prn_stream, plane_code[cdj850->intensities > 2][i],
+ plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i],
/* data_ptrs->plane_data_c[1 - misc_vars->cscan][i],*/
- data_ptrs->out_data);
+ data_ptrs->out_data);
- /* output the upper color planes */
- if (cdj850->intensities > 2) {
+ /* output the upper color planes */
+ if (cdj850->intensities > 2) {
fputs("\033*b", prn_stream);
- print_c2plane(prn_stream, plane_code[0][i], plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
+ print_c2plane(prn_stream, plane_code[0][i], plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
/* data_ptrs->plane_data_c[1 -
- misc_vars->cscan][i
- + 4],*/
- data_ptrs->out_data);
- } /* end cdj850->intensities > 2 */
- } /* End For i = num_comps */
- misc_vars->cscan = 1 - misc_vars->cscan;
+ misc_vars->cscan][i
+ + 4],*/
+ data_ptrs->out_data);
+ } /* end cdj850->intensities > 2 */
+ } /* End For i = num_comps */
+ misc_vars->cscan = 1 - misc_vars->cscan;
} /* End of is_two_pass */
return;
}
@@ -2281,10 +2260,10 @@ cdj880_print_non_blank_lines(gx_device_printer * pdev,
somewhat clumsy */
static void
do_floyd_steinberg(int scan, int cscan, int plane_size,
- int plane_size_c, int n,
- struct ptr_arrays *data_ptrs,
- gx_device_printer * pdev,
- struct error_val_field *error_values)
+ int plane_size_c, int n,
+ struct ptr_arrays *data_ptrs,
+ gx_device_printer * pdev,
+ struct error_val_field *error_values)
{
/* the color pointers */
byte *cPa, *mPa, *yPa, *cPb, *mPb, *yPb;
@@ -2312,20 +2291,20 @@ do_floyd_steinberg(int scan, int cscan, int plane_size,
ep = data_ptrs->errors[scan];
switch (cdj850->intensities) {
- case 2:
- FSDlinec2(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, n, dpc, epc);
- break;
- case 3:
- FSDlinec3(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
- break;
- case 4:
- FSDlinec4(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
- break;
- default:
- assert(0);
+ case 2:
+ FSDlinec2(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, n, dpc, epc);
+ break;
+ case 3:
+ FSDlinec3(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
+ break;
+ case 4:
+ FSDlinec4(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
+ break;
+ default:
+ assert(0);
}
return;
}
@@ -2338,15 +2317,15 @@ do_gamma(float mastergamma, float gammaval, byte values[256])
float gamma;
if (gammaval > 0.0) {
- gamma = gammaval;
+ gamma = gammaval;
} else {
- gamma = mastergamma;
+ gamma = mastergamma;
}
for (i = 0; i < 256; i++) {
- values[i] = (byte) (255.0 *
- (1.0 - pow(((double)(255.0 - (float)i) / 255.0),
- (double)(1.0 / gamma))));
+ values[i] = (byte) (255.0 *
+ (1.0 - pow(((double)(255.0 - (float)i) / 255.0),
+ (double)(1.0 / gamma))));
}
return;
@@ -2354,7 +2333,7 @@ do_gamma(float mastergamma, float gammaval, byte values[256])
/* here we calculate a lookup-table which is used to compensate the
relative loss of color due to undercolor-removal */
-static void
+static void
do_black_correction(float kvalue, int kcorrect[256])
{
int i;
@@ -2362,14 +2341,14 @@ do_black_correction(float kvalue, int kcorrect[256])
for (i = 0; i < 256; i++) {
kcorrect[i] = 0;
#if 0
- kcorrect[i] = (int)
- (100.0 * kvalue * (
- pow(10.0,
- pow((i / 255.0), 3.0)
- )
- - 1.0
- )
- );
+ kcorrect[i] = (int)
+ (100.0 * kvalue * (
+ pow(10.0,
+ pow((i / 255.0), 3.0)
+ )
+ - 1.0
+ )
+ );
#endif /* 0 */
}
@@ -2445,9 +2424,9 @@ do_gcr(int bytecount, byte * inbyte, const byte kvalues[256],
last_color = &last_color_value;
/* Grey component replacement */
for (i = 0; i < bytecount; i += 4) {
-
+
/* Assign to black the current address of inbyte */
- black = inbyte++;
+ black = inbyte++;
cyan = inbyte++;
magenta = inbyte++;
yellow = inbyte++;
@@ -2464,61 +2443,61 @@ do_gcr(int bytecount, byte * inbyte, const byte kvalues[256],
debug_print_string(output, strlen(output));
}
#endif /* 0 */
-
+
is_color = 1;
/* Test whether we 've already computet the value */
if (*inword == last_color_value) {
- /* save a copy of the current color before it will be modified */
- last_color_value = *inword;
+ /* save a copy of the current color before it will be modified */
+ last_color_value = *inword;
/* debug_print_string("\n", 1);*/
- /* copy the result of the old value onto the new position */
- *inword = *last_color;
+ /* copy the result of the old value onto the new position */
+ *inword = *last_color;
} else {
- /* save a copy of the current color before it will be modified */
- last_color_value = *inword;
+ /* save a copy of the current color before it will be modified */
+ last_color_value = *inword;
NOBLACK(cyan, magenta, yellow, black);
- if ((*cyan >= *magenta)
- && (*magenta >= *yellow)
- && (*yellow > 0)) { /* if any grey component */
- NOBLACK(cyan, magenta, yellow, black);
- } else if ((*cyan >= *yellow)
- && (*yellow >= *magenta)
- && (*magenta > 0)) {
- NOBLACK(cyan, yellow, magenta, black);
- } else if ((*yellow >= *magenta)
- && (*magenta >= *cyan)
- && (*cyan > 0)) {
- NOBLACK(yellow, magenta, cyan, black);
- } else if ((*yellow >= *cyan)
- && (*cyan >= *magenta)
- && (*magenta > 0)) {
- NOBLACK(yellow, cyan, magenta, black);
- } else if ((*magenta >= *yellow)
- && (*yellow >= *cyan)
- && (*cyan > 0)) {
- NOBLACK(magenta, yellow, cyan, black);
- } else if ((*magenta >= *cyan)
- && (*cyan >= *yellow)
- && (*yellow > 0)) {
- NOBLACK(magenta, cyan, yellow, black);
- } else { /* do gamma only if no black */
- }
+ if ((*cyan >= *magenta)
+ && (*magenta >= *yellow)
+ && (*yellow > 0)) { /* if any grey component */
+ NOBLACK(cyan, magenta, yellow, black);
+ } else if ((*cyan >= *yellow)
+ && (*yellow >= *magenta)
+ && (*magenta > 0)) {
+ NOBLACK(cyan, yellow, magenta, black);
+ } else if ((*yellow >= *magenta)
+ && (*magenta >= *cyan)
+ && (*cyan > 0)) {
+ NOBLACK(yellow, magenta, cyan, black);
+ } else if ((*yellow >= *cyan)
+ && (*cyan >= *magenta)
+ && (*magenta > 0)) {
+ NOBLACK(yellow, cyan, magenta, black);
+ } else if ((*magenta >= *yellow)
+ && (*yellow >= *cyan)
+ && (*cyan > 0)) {
+ NOBLACK(magenta, yellow, cyan, black);
+ } else if ((*magenta >= *cyan)
+ && (*cyan >= *yellow)
+ && (*yellow > 0)) {
+ NOBLACK(magenta, cyan, yellow, black);
+ } else { /* do gamma only if no black */
+ }
#if 0
- if (ucr > 0)
- {
+ if (ucr > 0)
+ {
sprintf(output, "%3d %3d %3d %3d - %5d\n", *cyan, *magenta, *yellow, *black, ucr);
debug_print_string(output, strlen(output));
}
#endif /* 0 */
- if ( *cyan > 255) *cyan = 255;
- if (*magenta > 255) *magenta = 255;
- if ( *yellow > 255) *yellow = 255;
-
- *cyan = *(cvalues + *cyan);
- *magenta = *(mvalues + *magenta);
- *yellow = *(yvalues + *yellow);
- last_color = inword; /* save pointer */
+ if ( *cyan > 255) *cyan = 255;
+ if (*magenta > 255) *magenta = 255;
+ if ( *yellow > 255) *yellow = 255;
+
+ *cyan = *(cvalues + *cyan);
+ *magenta = *(mvalues + *magenta);
+ *yellow = *(yvalues + *yellow);
+ last_color = inword; /* save pointer */
}/* end current_color */
} /* end of if c+m+y > 0 */
*black = *(kvalues + *black);
@@ -2531,22 +2510,22 @@ do_gcr(int bytecount, byte * inbyte, const byte kvalues[256],
rescale the data byte by byte */
static int
rescale_byte_wise2x2(int bytecount, const byte * inbytea, const byte * inbyteb,
- byte * outbyte)
+ byte * outbyte)
{
register int i, j;
int max = bytecount / 2;
for (i = 0; i < max; i += 4) {
- j = 2 * i;
- /* cyan */
- outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5] + inbyteb[j + 1] +
- inbyteb[j + 5]) / 4;
- /* magenta */
- outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6] + inbyteb[j + 2] +
- inbyteb[j + 6]) / 4;
- /* yellow */
- outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7] + inbyteb[j + 3] +
- inbyteb[j + 7]) / 4;
+ j = 2 * i;
+ /* cyan */
+ outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5] + inbyteb[j + 1] +
+ inbyteb[j + 5]) / 4;
+ /* magenta */
+ outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6] + inbyteb[j + 2] +
+ inbyteb[j + 6]) / 4;
+ /* yellow */
+ outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7] + inbyteb[j + 3] +
+ inbyteb[j + 7]) / 4;
}
return max;
}
@@ -2555,19 +2534,19 @@ rescale_byte_wise2x2(int bytecount, const byte * inbytea, const byte * inbyteb,
rescale the data byte by byte */
static int
rescale_byte_wise2x1(int bytecount, const byte * inbytea, const byte * inbyteb,
- byte * outbyte)
+ byte * outbyte)
{
register int i, j;
int max = bytecount / 2;
for (i = 0; i < max; i += 4) {
- j = 2 * i;
- /* cyan */
- outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5]) / 2;
- /* magenta */
- outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6]) / 2;
- /* yellow */
- outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7]) / 2;
+ j = 2 * i;
+ /* cyan */
+ outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5]) / 2;
+ /* magenta */
+ outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6]) / 2;
+ /* yellow */
+ outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7]) / 2;
}
return max;
}
@@ -2576,17 +2555,17 @@ rescale_byte_wise2x1(int bytecount, const byte * inbytea, const byte * inbyteb,
rescale the data byte by byte */
static int
rescale_byte_wise1x2(int bytecount, const byte * inbytea, const byte * inbyteb,
- byte * outbyte)
+ byte * outbyte)
{
register int i;
for (i = 0; i < bytecount; i += 4) {
- /* cyan */
- outbyte[i + 1] = (inbytea[i + 1] + inbyteb[i + 1]) / 2;
- /* magenta */
- outbyte[i + 2] = (inbytea[i + 2] + inbyteb[i + 2]) / 2;
- /* yellow */
- outbyte[i + 3] = (inbytea[i + 3] + inbyteb[i + 3]) / 2;
+ /* cyan */
+ outbyte[i + 1] = (inbytea[i + 1] + inbyteb[i + 1]) / 2;
+ /* magenta */
+ outbyte[i + 2] = (inbytea[i + 2] + inbyteb[i + 2]) / 2;
+ /* yellow */
+ outbyte[i + 3] = (inbytea[i + 3] + inbyteb[i + 3]) / 2;
}
return bytecount;
}
@@ -2595,17 +2574,17 @@ rescale_byte_wise1x2(int bytecount, const byte * inbytea, const byte * inbyteb,
rescale the data byte by byte */
static int
rescale_byte_wise1x1(int bytecount, const byte * inbytea, const byte * inbyteb,
- byte * outbyte)
+ byte * outbyte)
{
register int i;
for (i = 0; i < bytecount; i += 4) {
- /* cyan */
- outbyte[i + 1] = inbytea[i + 1];
- /* magenta */
- outbyte[i + 2] = inbytea[i + 2];
- /* yellow */
- outbyte[i + 3] = inbytea[i + 3];
+ /* cyan */
+ outbyte[i + 1] = inbytea[i + 1];
+ /* magenta */
+ outbyte[i + 2] = inbytea[i + 2];
+ /* yellow */
+ outbyte[i + 3] = inbytea[i + 3];
}
return bytecount;
}
@@ -2674,26 +2653,26 @@ have a pixel rate >50%.
/* --------------------------- */
/* initialise the error_buffer */
-static void
-init_error_buffer(struct misc_struct * misc_vars,
- struct ptr_arrays * data_ptrs)
+static void
+init_error_buffer(struct misc_struct * misc_vars,
+ struct ptr_arrays * data_ptrs)
{
int i;
int *ep;
int *epc;
-
+
ep = data_ptrs->errors[0];
epc = data_ptrs->errors_c[0];
-
+
if (misc_vars->bits_per_pixel > 4) { /* Randomly seed initial error
- buffer */
+ buffer */
/* Otherwise, the first dithered rows would look rather uniform */
for (i = 0; i < misc_vars->databuff_size; i++) { /* 600dpi planes */
*ep++ = RANDOM;
}
-
+
/* Now for the 2 * 300dpi color planes */
- for (i = 0; i < misc_vars->databuff_size_c; i++) {
+ for (i = 0; i < misc_vars->databuff_size_c; i++) {
*epc++ = CRANDOM;
}
}
@@ -2703,18 +2682,17 @@ init_error_buffer(struct misc_struct * misc_vars,
#define FSdither(inP, out, errP, Err, Bit, Offset, Element)\
{\
oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int)*(inP + Element) << SHIFT));\
- if (Err > THRESHOLD || *(inP + Element) == 255 /* b/w optimization */) {\
- out |= Bit;\
- Err -= MAXVALUE;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int)*(inP + Element) << SHIFT));\
+ if (Err > THRESHOLD || *(inP + Element) == 255 /* b/w optimization */) {\
+ out |= Bit;\
+ Err -= MAXVALUE;\
}\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
-
/* FSDlinebw()
*
* Floyd-steinberg dithering for the black plane. The 850C has 600dpi
@@ -2738,38 +2716,38 @@ init_error_buffer(struct misc_struct * misc_vars,
* Returns: Nothing.
*/
static void
-FSDlinebw(int scan, int plane_size,
- struct error_val_field * error_values,
- byte * kP, int n, int * ep, byte * dp)
+FSDlinebw(int scan, int plane_size,
+ struct error_val_field * error_values,
+ byte * kP, int n, int * ep, byte * dp)
{
if (scan == 0) { /* going_up */
byte k, bitmask; /* k = outbyte byte, whereas bitmask defines the
- bit to be set within k */
+ bit to be set within k */
int oldErr, i;
-
+
for (i = 0; i < plane_size; i++) {
bitmask = 0x80;
for (k = 0; bitmask != 0; bitmask >>= 1) {
- /* dp points to the first word of the input data which is in
- kcmy-format */
- /* k points to the beginning of the first outbut byte, which
- is filled up, bit by bit while looping over bytemask */
- /* ep points to the first word of the error-plane which
- contains the errors kcmy format */
- /* err_values->k tempararily holds the error-value */
- /* bitmask selects the bit to be set in the outbyte */
- /* n gives the offset for the byte selection within
- words. With simple cmyk-printing, this should be 4 */
- /* 0 points to the active color within the input-word, i.e. 0
- = black, 1 = cyan, 2 = yellow, 3 = magenta */
-
- FSdither(dp, k, ep, error_values->k, bitmask, -n, 0);
- dp += n, ep += n; /* increment the input and error pointer one
- word (=4 byte) further, in order to
- convert the next word into an bit */
+ /* dp points to the first word of the input data which is in
+ kcmy-format */
+ /* k points to the beginning of the first outbut byte, which
+ is filled up, bit by bit while looping over bytemask */
+ /* ep points to the first word of the error-plane which
+ contains the errors kcmy format */
+ /* err_values->k tempararily holds the error-value */
+ /* bitmask selects the bit to be set in the outbyte */
+ /* n gives the offset for the byte selection within
+ words. With simple cmyk-printing, this should be 4 */
+ /* 0 points to the active color within the input-word, i.e. 0
+ = black, 1 = cyan, 2 = yellow, 3 = magenta */
+
+ FSdither(dp, k, ep, error_values->k, bitmask, -n, 0);
+ dp += n, ep += n; /* increment the input and error pointer one
+ word (=4 byte) further, in order to
+ convert the next word into an bit */
}
*kP++ = k; /* fill the output-plane byte with the computed byte
- and increment the output plane pointer one byte */
+ and increment the output plane pointer one byte */
}
} else { /* going_down */
@@ -2778,8 +2756,8 @@ FSDlinebw(int scan, int plane_size,
for (i = 0; i < plane_size; i++) {
bitmask = 0x01;
for (k = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither(dp, k, ep, error_values->k, bitmask, n, 0);
+ dp -= n, ep -= n;
+ FSdither(dp, k, ep, error_values->k, bitmask, n, 0);
}
*--kP = k;
}
@@ -2791,45 +2769,45 @@ FSDlinebw(int scan, int plane_size,
an adapted dither algorythm */
static void
FSDlinec2(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa, int n,
- byte * dp, int *ep)
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa, int n,
+ byte * dp, int *ep)
{
if (scan == 0) { /* going_up */
- int oldErr, i;
- byte ca, ya, ma, bitmask;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = 0;
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither(dp, ca, ep, error_values->c, bitmask, -n, n - 3);
- FSdither(dp, ma, ep, error_values->m, bitmask, -n, n - 2);
- FSdither(dp, ya, ep, error_values->y, bitmask, -n, n - 1);
- dp += n, ep += n;
- }
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- }
+ int oldErr, i;
+ byte ca, ya, ma, bitmask;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = 0;
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither(dp, ca, ep, error_values->c, bitmask, -n, n - 3);
+ FSdither(dp, ma, ep, error_values->m, bitmask, -n, n - 2);
+ FSdither(dp, ya, ep, error_values->y, bitmask, -n, n - 1);
+ dp += n, ep += n;
+ }
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ }
} else { /* going_down */
- byte ca, ya, ma, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = 0;
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither(dp, ya, ep, error_values->y, bitmask, n, n - 1);
- FSdither(dp, ma, ep, error_values->m, bitmask, n, n - 2);
- FSdither(dp, ca, ep, error_values->c, bitmask, n, n - 3);
- }
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- }
+ byte ca, ya, ma, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = 0;
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither(dp, ya, ep, error_values->y, bitmask, n, n - 1);
+ FSdither(dp, ma, ep, error_values->m, bitmask, n, n - 2);
+ FSdither(dp, ca, ep, error_values->c, bitmask, n, n - 3);
+ }
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ }
}
return;
}
@@ -2837,169 +2815,167 @@ FSDlinec2(int scan, int plane_size,
/* while printing on paper, we only use 3 -intensities */
#define FSdither8503(inP, outa, outb, errP, Err, Bit, Offset, Element)\
{\
- oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int) *(inP + Element) << SHIFT));\
- if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
- outa |= Bit;\
- Err -= MAXVALUES;\
- }\
- if (Err > THRESHOLDM) {\
- outb |= Bit;\
- Err -= MAXVALUEM;\
- }\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ oldErr = Err;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int) *(inP + Element) << SHIFT));\
+ if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
+ outa |= Bit;\
+ Err -= MAXVALUES;\
+ }\
+ if (Err > THRESHOLDM) {\
+ outb |= Bit;\
+ Err -= MAXVALUEM;\
+ }\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
/* On ordinary paper, we'll only use 3 intensities with the hp850 */
static void
FSDlinec3(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep)
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep)
{
if (scan == 0) { /* going_up */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = cb = yb = mb = 0;
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither8503(dp, ca, cb, ep, error_values->c, bitmask, -n, n
- - 3);
- FSdither8503(dp, ma, mb, ep, error_values->m, bitmask, -n, n
- - 2);
- FSdither8503(dp, ya, yb, ep, error_values->y, bitmask, -n, n
- - 1);
- dp += n, ep += n;
- }
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- *cPb++ = cb;
- *mPb++ = mb;
- *yPb++ = yb;
- }
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = cb = yb = mb = 0;
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither8503(dp, ca, cb, ep, error_values->c, bitmask, -n, n
+ - 3);
+ FSdither8503(dp, ma, mb, ep, error_values->m, bitmask, -n, n
+ - 2);
+ FSdither8503(dp, ya, yb, ep, error_values->y, bitmask, -n, n
+ - 1);
+ dp += n, ep += n;
+ }
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ *cPb++ = cb;
+ *mPb++ = mb;
+ *yPb++ = yb;
+ }
} else { /* going_down */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = cb = yb = mb = 0;
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither8503(dp, ya, yb, ep, error_values->y, bitmask, n, n
- - 1);
- FSdither8503(dp, ma, mb, ep, error_values->m, bitmask, n, n
- - 2);
- FSdither8503(dp, ca, cb, ep, error_values->c, bitmask, n, n
- - 3);
- }
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- *--yPb = yb;
- *--mPb = mb;
- *--cPb = cb;
- }
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = cb = yb = mb = 0;
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither8503(dp, ya, yb, ep, error_values->y, bitmask, n, n
+ - 1);
+ FSdither8503(dp, ma, mb, ep, error_values->m, bitmask, n, n
+ - 2);
+ FSdither8503(dp, ca, cb, ep, error_values->c, bitmask, n, n
+ - 3);
+ }
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ *--yPb = yb;
+ *--mPb = mb;
+ *--cPb = cb;
+ }
}
return;
}
-
/* the hp850 knows about 4 different color intensities per color */
#define FSdither8504(inP, outa, outb, errP, Err, Bit, Offset, Element)\
{\
- oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int) *(inP + Element) << SHIFT));\
- if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
- outa |= Bit;\
- Err -= MAXVALUES;\
- }\
- if ((Err > THRESHOLDM) && (Err <= THRESHOLDL)) {\
- outb |= Bit;\
- Err -= MAXVALUEM;\
- }\
- if (Err > THRESHOLDL) {\
+ oldErr = Err;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int) *(inP + Element) << SHIFT));\
+ if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
+ outa |= Bit;\
+ Err -= MAXVALUES;\
+ }\
+ if ((Err > THRESHOLDM) && (Err <= THRESHOLDL)) {\
+ outb |= Bit;\
+ Err -= MAXVALUEM;\
+ }\
+ if (Err > THRESHOLDL) {\
outa |= Bit;\
- outb |= Bit;\
- Err -= MAXVALUEL;\
- }\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ outb |= Bit;\
+ Err -= MAXVALUEL;\
+ }\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
/* The hp850c knows about 4 intensity levels per color. Once more, we need
an adapted dither algorythm */
static void
FSDlinec4(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep)
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep)
{
if (scan == 0) { /* going_up */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = cb = yb = mb = 0;
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither8504(dp, ca, cb, ep, error_values->c, bitmask, -n, n
- - 3);
- FSdither8504(dp, ma, mb, ep, error_values->m, bitmask, -n, n
- - 2);
- FSdither8504(dp, ya, yb, ep, error_values->y, bitmask, -n, n
- - 1);
- dp += n, ep += n;
- }
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- *cPb++ = cb;
- *mPb++ = mb;
- *yPb++ = yb;
- }
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = cb = yb = mb = 0;
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither8504(dp, ca, cb, ep, error_values->c, bitmask, -n, n
+ - 3);
+ FSdither8504(dp, ma, mb, ep, error_values->m, bitmask, -n, n
+ - 2);
+ FSdither8504(dp, ya, yb, ep, error_values->y, bitmask, -n, n
+ - 1);
+ dp += n, ep += n;
+ }
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ *cPb++ = cb;
+ *mPb++ = mb;
+ *yPb++ = yb;
+ }
} else { /* going_down */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = cb = yb = mb = 0;
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither8504(dp, ya, yb, ep, error_values->y, bitmask, n, n
- - 1);
- FSdither8504(dp, ma, mb, ep, error_values->m, bitmask, n, n
- - 2);
- FSdither8504(dp, ca, cb, ep, error_values->c, bitmask, n, n
- - 3);
- }
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- *--yPb = yb;
- *--mPb = mb;
- *--cPb = cb;
- }
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = cb = yb = mb = 0;
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither8504(dp, ya, yb, ep, error_values->y, bitmask, n, n
+ - 1);
+ FSdither8504(dp, ma, mb, ep, error_values->m, bitmask, n, n
+ - 2);
+ FSdither8504(dp, ca, cb, ep, error_values->c, bitmask, n, n
+ - 3);
+ }
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ *--yPb = yb;
+ *--mPb = mb;
+ *--cPb = cb;
+ }
}
return;
}
-
/* calculate the needed memory */
static void
calculate_memory_size(gx_device_printer * pdev,
- struct misc_struct *misc_vars)
+ struct misc_struct *misc_vars)
{
int xfac = cdj850->xscal ? 2 : 1;
@@ -3023,46 +2999,44 @@ calculate_memory_size(gx_device_printer * pdev,
/* 4n extra values for line ends */
/* might be wrong, see gdevcdj.c */
misc_vars->errbuff_size =
- calc_buffsize((misc_vars->plane_size * misc_vars->expanded_bpp +
- misc_vars->num_comps * 4) * I, 1);
+ calc_buffsize((misc_vars->plane_size * misc_vars->expanded_bpp +
+ misc_vars->num_comps * 4) * I, 1);
/* 4n extra values for line ends */
misc_vars->errbuff_size_c =
- calc_buffsize((misc_vars->plane_size_c / 2 * misc_vars->expanded_bpp
- + misc_vars->num_comps * 4) * I, 1);
+ calc_buffsize((misc_vars->plane_size_c / 2 * misc_vars->expanded_bpp
+ + misc_vars->num_comps * 4) * I, 1);
misc_vars->databuff_size =
- misc_vars->plane_size * misc_vars->storage_bpp;
+ misc_vars->plane_size * misc_vars->storage_bpp;
misc_vars->databuff_size_c =
- misc_vars->plane_size_c / 2 * misc_vars->storage_bpp;
-
+ misc_vars->plane_size_c / 2 * misc_vars->storage_bpp;
misc_vars->outbuff_size = misc_vars->plane_size * 4;
misc_vars->storage_size_words = (((misc_vars->plane_size)
- * 2
- * misc_vars->num_comps)
- + misc_vars->databuff_size
- + misc_vars->errbuff_size
- + misc_vars->outbuff_size
- + ((misc_vars->plane_size_c)
- * 2
- * misc_vars->num_comps)
- + misc_vars->databuff_size_c
- + misc_vars->errbuff_size_c
- + (4 * misc_vars->plane_size_c))
- / W;
+ * 2
+ * misc_vars->num_comps)
+ + misc_vars->databuff_size
+ + misc_vars->errbuff_size
+ + misc_vars->outbuff_size
+ + ((misc_vars->plane_size_c)
+ * 2
+ * misc_vars->num_comps)
+ + misc_vars->databuff_size_c
+ + misc_vars->errbuff_size_c
+ + (4 * misc_vars->plane_size_c))
+ / W;
return;
}
-
/* Initialise the needed pointers */
static void
init_data_structure(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars)
{
int i;
byte *p = (byte *) data_ptrs->storage;
@@ -3077,27 +3051,27 @@ init_data_structure(gx_device_printer * pdev,
/* Note: The output data will overwrite part of the input-data */
if (misc_vars->bits_per_pixel > 1) {
- p += misc_vars->databuff_size;
+ p += misc_vars->databuff_size;
}
if (misc_vars->bits_per_pixel > 4) {
- data_ptrs->errors[0] = (int *)p + misc_vars->num_comps * 2;
- data_ptrs->errors[1] = data_ptrs->errors[0] + misc_vars->databuff_size;
- p += misc_vars->errbuff_size;
+ data_ptrs->errors[0] = (int *)p + misc_vars->num_comps * 2;
+ data_ptrs->errors[1] = data_ptrs->errors[0] + misc_vars->databuff_size;
+ p += misc_vars->errbuff_size;
}
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data[0][i] = data_ptrs->plane_data[2][i] = p;
- p += misc_vars->plane_size;
+ data_ptrs->plane_data[0][i] = data_ptrs->plane_data[2][i] = p;
+ p += misc_vars->plane_size;
}
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data[1][i] = p;
- data_ptrs->plane_data[3][i] = p + misc_vars->plane_size;
- p += misc_vars->plane_size;
+ data_ptrs->plane_data[1][i] = p;
+ data_ptrs->plane_data[3][i] = p + misc_vars->plane_size;
+ p += misc_vars->plane_size;
}
data_ptrs->out_data = p;
p += misc_vars->outbuff_size;
/* ---------------------------------------------------------
- now for the color pointers
+ now for the color pointers
--------------------------------------------------------- */
data_ptrs->data_c[0] = data_ptrs->data_c[1] = data_ptrs->data_c[2] = p;
@@ -3105,39 +3079,39 @@ init_data_structure(gx_device_printer * pdev,
/* Note: The output data will overwrite part of the input-data */
if (misc_vars->bits_per_pixel > 1) {
- p += misc_vars->databuff_size_c;
+ p += misc_vars->databuff_size_c;
}
if (misc_vars->bits_per_pixel > 4) {
- data_ptrs->errors_c[0] = (int *)p + misc_vars->num_comps * 2;
- data_ptrs->errors_c[1] = data_ptrs->errors_c[0] + misc_vars->databuff_size_c;
- p += misc_vars->errbuff_size_c;
+ data_ptrs->errors_c[0] = (int *)p + misc_vars->num_comps * 2;
+ data_ptrs->errors_c[1] = data_ptrs->errors_c[0] + misc_vars->databuff_size_c;
+ p += misc_vars->errbuff_size_c;
}
/* pointer for the lower bits of the output data */
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[0][i] = data_ptrs->plane_data_c[2][i] = p;
- p += misc_vars->plane_size_c / 2;
+ data_ptrs->plane_data_c[0][i] = data_ptrs->plane_data_c[2][i] = p;
+ p += misc_vars->plane_size_c / 2;
}
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[1][i] = p;
- data_ptrs->plane_data_c[3][i] = p + misc_vars->plane_size_c / 2;
- p += misc_vars->plane_size_c / 2;
+ data_ptrs->plane_data_c[1][i] = p;
+ data_ptrs->plane_data_c[3][i] = p + misc_vars->plane_size_c / 2;
+ p += misc_vars->plane_size_c / 2;
}
/* pointer for the upper bits of the output data */
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[0][i + 4] = data_ptrs->plane_data_c[2][i +
- 4] = p;
- p += misc_vars->plane_size_c / 2;
+ data_ptrs->plane_data_c[0][i + 4] = data_ptrs->plane_data_c[2][i +
+ 4] = p;
+ p += misc_vars->plane_size_c / 2;
}
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[1][i + 4] = p;
- data_ptrs->plane_data_c[3][i + 4] = p + misc_vars->plane_size_c / 2;
- p += misc_vars->plane_size_c / 2;
+ data_ptrs->plane_data_c[1][i + 4] = p;
+ data_ptrs->plane_data_c[3][i + 4] = p + misc_vars->plane_size_c / 2;
+ p += misc_vars->plane_size_c / 2;
}
for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->test_data[i] = p;
- p += misc_vars->plane_size_c / 2;
+ data_ptrs->test_data[i] = p;
+ p += misc_vars->plane_size_c / 2;
}
/* Clear temp storage */
@@ -3149,7 +3123,7 @@ init_data_structure(gx_device_printer * pdev,
/* Configure the printer and start Raster mode */
static void
cdj850_start_raster_mode(gx_device_printer * pdev, int paper_size,
- FILE * prn_stream)
+ FILE * prn_stream)
{
int xres, yres; /* x,y resolution for color planes */
hp850_cmyk_init_t init;
@@ -3191,16 +3165,16 @@ cdj850_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* This will start and configure the raster-mode */
fprintf(prn_stream, "\033*g%dW", (int)sizeof(init.a)); /* The new configure
- raster data comand */
+ raster data comand */
fwrite(init.a, sizeof(byte), sizeof(init.a),
- prn_stream); /* Transmit config
- data */
+ prn_stream); /* Transmit config
+ data */
/* From now on, all escape commands start with \033*b, so we
* combine them (if the printer supports this). */
fputs("\033*b", prn_stream);
/* Set compression if the mode has been defined. */
if (cdj850->compression)
- fprintf(prn_stream, "%dm", cdj850->compression);
+ fprintf(prn_stream, "%dm", cdj850->compression);
return;
} /* end configure raster-mode */
@@ -3208,7 +3182,7 @@ cdj850_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* Configure the printer and start Raster mode */
static void
cdj880_start_raster_mode(gx_device_printer * pdev, int paper_size,
- FILE * prn_stream)
+ FILE * prn_stream)
{
int xres, yres; /* x,y resolution for color planes */
hp850_cmyk_init_t init;
@@ -3254,11 +3228,11 @@ cdj880_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* This will configure the raster-mode */
fprintf(prn_stream, "\033*g%dW", (int)sizeof(init.a)); /* The new configure
- raster data comand */
+ raster data comand */
fwrite(init.a, sizeof(byte), sizeof(init.a),
- prn_stream); /* Transmit config
- data */
-
+ prn_stream); /* Transmit config
+ data */
+
/* Start the raster graphics mode. The 880C needs this explicit command.
*/
fputs("\033*r1A", prn_stream);
@@ -3269,7 +3243,7 @@ cdj880_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* Set compression if the mode has been defined. */
/* if (cdj850->compression)*/
- fprintf(prn_stream, "\033*b%dm", cdj850->compression);
+ fprintf(prn_stream, "\033*b%dm", cdj850->compression);
return;
} /* end configure raster-mode */
@@ -3277,7 +3251,7 @@ cdj880_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* Start Raster mode for HP2200 */
static void
chp2200_start_raster_mode(gx_device_printer * pdev, int paper_size,
- FILE * prn_stream)
+ FILE * prn_stream)
{
byte CRD_SeqC[] = {0x1b, 0x2a, 0x67, 0x31, 0x32, 0x57, 0x06, 0x07, 0x00, 0x01,
/* Esc * |g |# of bytes |W |frmt |SP |# of cmpnts*/
@@ -3334,7 +3308,7 @@ chp2200_start_raster_mode(gx_device_printer * pdev, int paper_size,
CRD_SeqC[12] = HIBYTE(yres);
CRD_SeqC[13] = LOBYTE(yres);
fwrite(CRD_SeqC, sizeof(byte), sizeof(CRD_SeqC), prn_stream);
-
+
fputs("\033*r1A", prn_stream);
return;
@@ -3343,7 +3317,7 @@ chp2200_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* Start Raster mode for DNJ500 */
static void
cdnj500_start_raster_mode(gx_device_printer * pdev, int paper_size,
- FILE * prn_stream)
+ FILE * prn_stream)
{
/* x,y resolution for color planes, assume x=y */
int xres = cdj850->x_pixels_per_inch;
@@ -3394,40 +3368,40 @@ cdnj500_start_raster_mode(gx_device_printer * pdev, int paper_size,
static int near
cdj_put_param_int(gs_param_list * plist, gs_param_name pname, int *pvalue,
- int minval, int maxval, int ecode)
+ int minval, int maxval, int ecode)
{
int code, value;
switch (code = param_read_int(plist, pname, &value)) {
- default:
- return code;
- case 1:
- return ecode;
- case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
+ default:
+ return code;
+ case 1:
+ return ecode;
+ case 0:
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
}
}
static int near
cdj_put_param_float(gs_param_list * plist, gs_param_name pname, float *pvalue,
- float minval, float maxval, int ecode)
+ float minval, float maxval, int ecode)
{
int code;
float value;
switch (code = param_read_float(plist, pname, &value)) {
- default:
- return code;
- case 1:
- return ecode;
- case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
+ default:
+ return code;
+ case 1:
+ return ecode;
+ case 0:
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
}
}
@@ -3437,169 +3411,168 @@ cdj_set_bpp(gx_device * pdev, int bpp, int ccomps)
gx_device_color_info *ci = &pdev->color_info;
if (ccomps && bpp == 0) {
- if (cprn_device->cmyk) {
- switch (ccomps) {
- default:
- return gs_error_rangecheck;
- /*NOTREACHED */
- break;
-
- case 1:
- bpp = 1;
- break;
-
- case 3:
- bpp = 24;
- break;
-
- case 4:
- switch (ci->depth) {
- case 8:
- case 16:
- case 24:
- case 32:
- break;
-
- default:
- bpp = cprn_device->default_depth;
- break;
- }
- break;
- }
- }
+ if (cprn_device->cmyk) {
+ switch (ccomps) {
+ default:
+ return gs_error_rangecheck;
+ /*NOTREACHED */
+ break;
+
+ case 1:
+ bpp = 1;
+ break;
+
+ case 3:
+ bpp = 24;
+ break;
+
+ case 4:
+ switch (ci->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
+ bpp = cprn_device->default_depth;
+ break;
+ }
+ break;
+ }
+ }
}
if (bpp == 0) {
- bpp = ci->depth; /* Use the current setting. */
+ bpp = ci->depth; /* Use the current setting. */
}
if (cprn_device->cmyk < 0) {
- /* Reset procedures because we may have been in another mode. */
+ /* Reset procedures because we may have been in another mode. */
- dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
- dev_proc(pdev, map_rgb_color) = NULL;
- dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
+ dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
+ dev_proc(pdev, map_rgb_color) = NULL;
+ dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
- if (pdev->is_open)
- gs_closedevice(pdev);
+ if (pdev->is_open)
+ gs_closedevice(pdev);
}
/* Check for valid bpp values */
switch (bpp) {
- case 16:
- case 32:
- if (cprn_device->cmyk && ccomps && ccomps != 4)
- goto bppe;
- break;
-
- case 24:
- if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
- break;
- } else if (ccomps == 1) {
- goto bppe;
- } else {
-
- /* 3 components 24 bpp printing for CMYK device. */
-
- cprn_device->cmyk = -1;
- }
- break;
-
- case 8:
- if (cprn_device->cmyk) {
- if (ccomps) {
- if (ccomps == 3) {
- cprn_device->cmyk = -1;
- bpp = 3;
- } else if (ccomps != 1 && ccomps != 4) {
- goto bppe;
- }
- }
- if (ccomps != 1)
- break;
- } else {
- break;
- }
-
- case 1:
- if (ccomps != 1)
- goto bppe;
-
- if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
-
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
- }
- break;
-
- case 3:
- if (!cprn_device->cmyk) {
- break;
- }
- default:
+ case 16:
+ case 32:
+ if (cprn_device->cmyk && ccomps && ccomps != 4)
+ goto bppe;
+ break;
+
+ case 24:
+ if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
+ break;
+ } else if (ccomps == 1) {
+ goto bppe;
+ } else {
+
+ /* 3 components 24 bpp printing for CMYK device. */
+
+ cprn_device->cmyk = -1;
+ }
+ break;
+
+ case 8:
+ if (cprn_device->cmyk) {
+ if (ccomps) {
+ if (ccomps == 3) {
+ cprn_device->cmyk = -1;
+ bpp = 3;
+ } else if (ccomps != 1 && ccomps != 4) {
+ goto bppe;
+ }
+ }
+ if (ccomps != 1)
+ break;
+ } else {
+ break;
+ }
+
+ case 1:
+ if (ccomps != 1)
+ goto bppe;
+
+ if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
+
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
+ }
+ break;
+
+ case 3:
+ if (!cprn_device->cmyk) {
+ break;
+ }
+ default:
bppe:return gs_error_rangecheck;
}
-
if (cprn_device->cmyk == -1) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
}
switch (ccomps) {
- case 0:
- break;
-
- case 1:
- if (bpp != 1 && bpp != 8)
- goto cce;
- break;
-
- case 4:
- if (cprn_device->cmyk) {
- if (bpp >= 8)
- break;
- }
- case 3:
- if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
- || bpp == 24 || bpp == 32) {
- break;
- }
- cce: default:
- return gs_error_rangecheck;
+ case 0:
+ break;
+
+ case 1:
+ if (bpp != 1 && bpp != 8)
+ goto cce;
+ break;
+
+ case 4:
+ if (cprn_device->cmyk) {
+ if (bpp >= 8)
+ break;
+ }
+ case 3:
+ if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
+ || bpp == 24 || bpp == 32) {
+ break;
+ }
+ cce: default:
+ return gs_error_rangecheck;
}
if (cprn_device->cmyk) {
- if (cprn_device->cmyk > 0) {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
- } else {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
- }
- if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
- bpp = bpp < 8 ? 8 : bpp;
- }
- ci->max_color = (1 << (bpp >> 2)) - 1;
- ci->max_gray = (bpp >= 8 ? 255 : 1);
-
- if (ci->num_components == 1) {
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- } else {
- ci->dither_grays = (bpp > 8 ? 5 : 2);
- ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
- }
+ if (cprn_device->cmyk > 0) {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
+ } else {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
+ }
+ if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
+ bpp = bpp < 8 ? 8 : bpp;
+ }
+ ci->max_color = (1 << (bpp >> 2)) - 1;
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+
+ if (ci->num_components == 1) {
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ } else {
+ ci->dither_grays = (bpp > 8 ? 5 : 2);
+ ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
+ }
} else {
- ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
- ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
- ci->max_gray = (bpp >= 8 ? 255 : 1);
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
+ ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
}
ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
@@ -3635,7 +3608,7 @@ cdj_set_bpp(gx_device * pdev, int bpp, int ccomps)
static gx_color_index
gdev_cmyk_map_cmyk_color(gx_device * pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_index color;
@@ -3643,28 +3616,28 @@ gdev_cmyk_map_cmyk_color(gx_device * pdev,
cyan = cv[0]; magenta = cv[1]; yellow = cv[2]; black = cv[3];
switch (pdev->color_info.depth) {
- case 1:
- color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0;
- break;
-
- default:{
- int nbits = pdev->color_info.depth;
-
- if (cyan == magenta && magenta == yellow) {
- /* Convert CMYK to gray -- Red Book 6.2.2 */
- float bpart = ((float)cyan) * (lum_red_weight / 100.) +
- ((float)magenta) * (lum_green_weight / 100.) +
- ((float)yellow) * (lum_blue_weight / 100.) +
- (float)black;
-
- cyan = magenta = yellow = (gx_color_index) 0;
- black = (gx_color_index) (bpart > gx_max_color_value ?
- gx_max_color_value : bpart);
- }
- color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
- nbits >> 2);
- }
+ case 1:
+ color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0;
+ break;
+
+ default:{
+ int nbits = pdev->color_info.depth;
+
+ if (cyan == magenta && magenta == yellow) {
+ /* Convert CMYK to gray -- Red Book 6.2.2 */
+ float bpart = ((float)cyan) * (lum_red_weight / 100.) +
+ ((float)magenta) * (lum_green_weight / 100.) +
+ ((float)yellow) * (lum_blue_weight / 100.) +
+ (float)black;
+
+ cyan = magenta = yellow = (gx_color_index) 0;
+ black = (gx_color_index) (bpart > gx_max_color_value ?
+ gx_max_color_value : bpart);
+ }
+ color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
+ nbits >> 2);
+ }
}
return color;
@@ -3679,27 +3652,27 @@ gdev_cmyk_map_rgb_color(gx_device * pdev, const gx_color_value cv[])
r = cv[0]; g = cv[1]; b = cv[2];
if (gx_color_value_to_byte(r & g & b) == 0xff) {
- return (gx_color_index) 0; /* White */
+ return (gx_color_index) 0; /* White */
} else {
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
-
- switch (pdev->color_info.depth) {
- case 1:
- return (c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED */
- break;
-
- case 8:
- return ((ulong) c * lum_red_weight * 10
- + (ulong) m * lum_green_weight * 10
- + (ulong) y * lum_blue_weight * 10)
- >> (gx_color_value_bits + 2);
- /*NOTREACHED */
- break;
- }
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return (c | m | y) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0;
+ /*NOTREACHED */
+ break;
+
+ case 8:
+ return ((ulong) c * lum_red_weight * 10
+ + (ulong) m * lum_green_weight * 10
+ + (ulong) y * lum_blue_weight * 10)
+ >> (gx_color_value_bits + 2);
+ /*NOTREACHED */
+ break;
+ }
}
return (gx_color_index) 0; /* This should never happen. */
@@ -3708,57 +3681,57 @@ gdev_cmyk_map_rgb_color(gx_device * pdev, const gx_color_value cv[])
/* Mapping of CMYK colors. */
static int
gdev_cmyk_map_color_rgb(gx_device * pdev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
- break;
+ case 1:
+ prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
+ break;
- case 8:
- if (pdev->color_info.num_components == 1) {
- gx_color_value value = (gx_color_value) color ^ 0xff;
+ case 8:
+ if (pdev->color_info.num_components == 1) {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- break;
- }
- default:{
- unsigned long bcyan, bmagenta, byellow, black;
- int nbits = pdev->color_info.depth;
+ break;
+ }
+ default:{
+ unsigned long bcyan, bmagenta, byellow, black;
+ int nbits = pdev->color_info.depth;
- gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
- nbits >> 2);
+ gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
+ nbits >> 2);
#ifdef USE_ADOBE_CMYK_RGB
- /* R = 1.0 - min(1.0, C + K), etc. */
+ /* R = 1.0 - min(1.0, C + K), etc. */
- bcyan += black, bmagenta += black, byellow += black;
- prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bcyan);
- prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bmagenta);
- prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - byellow);
+ bcyan += black, bmagenta += black, byellow += black;
+ prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bcyan);
+ prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bmagenta);
+ prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - byellow);
#else
- /* R = (1.0 - C) * (1.0 - K), etc. */
+ /* R = (1.0 - C) * (1.0 - K), etc. */
- prgb[0] = (gx_color_value)
- ((ulong) (gx_max_color_value - bcyan) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[1] = (gx_color_value)
- ((ulong) (gx_max_color_value - bmagenta) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[2] = (gx_color_value)
- ((ulong) (gx_max_color_value - byellow) *
- (gx_max_color_value - black) / gx_max_color_value);
+ prgb[0] = (gx_color_value)
+ ((ulong) (gx_max_color_value - bcyan) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[1] = (gx_color_value)
+ ((ulong) (gx_max_color_value - bmagenta) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[2] = (gx_color_value)
+ ((ulong) (gx_max_color_value - byellow) *
+ (gx_max_color_value - black) / gx_max_color_value);
#endif
- }
+ }
}
return 0;
@@ -3771,49 +3744,49 @@ gdev_pcl_map_rgb_color(gx_device * pdev, const gx_color_value cv[])
r = cv[0]; g = cv[1]; b = cv[2];
if (gx_color_value_to_byte(r & g & b) == 0xff)
- return (gx_color_index) 0; /* white */
+ return (gx_color_index) 0; /* white */
else {
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
-
- switch (pdev->color_info.depth) {
- case 1:
- return ((c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0);
- case 8:
- if (pdev->color_info.num_components >= 3)
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return ((c | m | y) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0);
+ case 8:
+ if (pdev->color_info.num_components >= 3)
#define gx_color_value_to_1bit(cv) ((cv) >> (gx_color_value_bits - 1))
- return (gx_color_value_to_1bit(c) +
- (gx_color_value_to_1bit(m) << 1) +
- (gx_color_value_to_1bit(y) << 2));
- else
+ return (gx_color_value_to_1bit(c) +
+ (gx_color_value_to_1bit(m) << 1) +
+ (gx_color_value_to_1bit(y) << 2));
+ else
#define red_weight 306
#define green_weight 601
#define blue_weight 117
- return ((((ulong) c * red_weight +
- (ulong) m * green_weight +
- (ulong) y * blue_weight)
- >> (gx_color_value_bits + 2)));
- case 16:
+ return ((((ulong) c * red_weight +
+ (ulong) m * green_weight +
+ (ulong) y * blue_weight)
+ >> (gx_color_value_bits + 2)));
+ case 16:
#define gx_color_value_to_5bits(cv) ((cv) >> (gx_color_value_bits - 5))
#define gx_color_value_to_6bits(cv) ((cv) >> (gx_color_value_bits - 6))
- return (gx_color_value_to_5bits(y) +
- (gx_color_value_to_6bits(m) << 5) +
- (gx_color_value_to_5bits(c) << 11));
- case 24:
- return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16));
- case 32:
- {
- return ((c == m && c == y) ? ((ulong)
- gx_color_value_to_byte(c) << 24)
- : (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16)));
- }
- }
+ return (gx_color_value_to_5bits(y) +
+ (gx_color_value_to_6bits(m) << 5) +
+ (gx_color_value_to_5bits(c) << 11));
+ case 24:
+ return (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong) gx_color_value_to_byte(c) << 16));
+ case 32:
+ {
+ return ((c == m && c == y) ? ((ulong)
+ gx_color_value_to_byte(c) << 24)
+ : (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong) gx_color_value_to_byte(c) << 16)));
+ }
+ }
}
return (gx_color_index) 0; /* This never happens */
}
@@ -3821,60 +3794,60 @@ gdev_pcl_map_rgb_color(gx_device * pdev, const gx_color_value cv[])
/* Map a color index to a r-g-b color. */
static int
gdev_pcl_map_color_rgb(gx_device * pdev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
/* For the moment, we simply ignore any black correction */
switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
- break;
- case 8:
- if (pdev->color_info.num_components >= 3) {
- gx_color_value c = (gx_color_value) color ^ 7;
-
- prgb[0] = -(c & 1);
- prgb[1] = -((c >> 1) & 1);
- prgb[2] = -(c >> 2);
- } else {
- gx_color_value value = (gx_color_value) color ^ 0xff;
-
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- }
- break;
- case 16:
- {
- gx_color_value c = (gx_color_value) color ^ 0xffff;
- ushort value = c >> 11;
-
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (c >> 6) & 0x3f;
- prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
- value = c & 0x1f;
- prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- }
- break;
- case 24:
- {
- gx_color_value c = (gx_color_value) color ^ 0xffffff;
-
- prgb[0] = gx_color_value_from_byte(c >> 16);
- prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
- prgb[2] = gx_color_value_from_byte(c & 0xff);
- }
- break;
- case 32:
+ case 1:
+ prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
+ break;
+ case 8:
+ if (pdev->color_info.num_components >= 3) {
+ gx_color_value c = (gx_color_value) color ^ 7;
+
+ prgb[0] = -(c & 1);
+ prgb[1] = -((c >> 1) & 1);
+ prgb[2] = -(c >> 2);
+ } else {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
+
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ }
+ break;
+ case 16:
+ {
+ gx_color_value c = (gx_color_value) color ^ 0xffff;
+ ushort value = c >> 11;
+
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (c >> 6) & 0x3f;
+ prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
+ >> (16 - gx_color_value_bits);
+ value = c & 0x1f;
+ prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ }
+ break;
+ case 24:
+ {
+ gx_color_value c = (gx_color_value) color ^ 0xffffff;
+
+ prgb[0] = gx_color_value_from_byte(c >> 16);
+ prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
+ prgb[2] = gx_color_value_from_byte(c & 0xff);
+ }
+ break;
+ case 32:
#define gx_maxcol gx_color_value_from_byte(gx_color_value_to_byte(gx_max_color_value))
- {
- gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
-
- prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
- prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[2] = w - gx_color_value_from_byte(color & 0xff);
- }
- break;
+ {
+ gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
+
+ prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
+ prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[2] = w - gx_color_value_from_byte(color & 0xff);
+ }
+ break;
}
return 0;
}
@@ -3886,38 +3859,38 @@ gdev_pcl_map_color_rgb(gx_device * pdev, gx_color_index color,
*/
static int
cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
- int real_bpp, int ccomps)
+ int real_bpp, int ccomps)
{
if (new_bpp == 0 && ccomps == 0)
- return gdev_prn_put_params(pdev, plist);
+ return gdev_prn_put_params(pdev, plist);
else {
- gx_device_color_info save_info;
- int save_bpp;
- int code;
+ gx_device_color_info save_info;
+ int save_bpp;
+ int code;
- save_info = pdev->color_info;
- save_bpp = save_info.depth;
+ save_info = pdev->color_info;
+ save_bpp = save_info.depth;
#define save_ccomps save_info.num_components
- if (save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
- save_bpp = 3;
- code = cdj_set_bpp(pdev, real_bpp, ccomps);
- if (code < 0) {
- param_signal_error(plist, "BitsPerPixel", code);
- param_signal_error(plist, "ProcessColorModel", code);
- return code;
- }
- pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
- code = gdev_prn_put_params(pdev, plist);
- if (code < 0) {
- cdj_set_bpp(pdev, save_bpp, save_ccomps);
- return code;
- }
- cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
- if ((cdj850->color_info.depth != save_bpp ||
- (ccomps != 0 && ccomps != save_ccomps))
- && pdev->is_open)
- return gs_closedevice(pdev);
- return 0;
+ if (save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
+ save_bpp = 3;
+ code = cdj_set_bpp(pdev, real_bpp, ccomps);
+ if (code < 0) {
+ param_signal_error(plist, "BitsPerPixel", code);
+ param_signal_error(plist, "ProcessColorModel", code);
+ return code;
+ }
+ pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
+ code = gdev_prn_put_params(pdev, plist);
+ if (code < 0) {
+ cdj_set_bpp(pdev, save_bpp, save_ccomps);
+ return code;
+ }
+ cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
+ if ((cdj850->color_info.depth != save_bpp ||
+ (ccomps != 0 && ccomps != save_ccomps))
+ && pdev->is_open)
+ return gs_closedevice(pdev);
+ return 0;
#undef save_ccomps
}
}
@@ -3926,14 +3899,14 @@ cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
* static int
* x_mul_div (int a, int b, int c)
- * {
+ * {
* int result;
- *
+ *
* result = (int) ((a * b) / c) ;
* return result;
* }
- *
- * static void
+ *
+ * static void
* save_color_data(int size,
* byte * current,
* byte * saved)
@@ -3944,30 +3917,30 @@ cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
* }
* return;
* }
- *
- * static int
- * test_scan (int size,
+ *
+ * static int
+ * test_scan (int size,
* byte * current,
- * byte * last,
+ * byte * last,
* byte * control)
* {
* int error = 0;
* int i;
- *
+ *
* for (i=0;i<size;i++){
* if (*control != *last){
* error = 1;
* }
* *control = *current;
- *
+ *
* control++;
* last++;
* current++;
* }
* return error;
* }
- *
- * * Transform from cmy into hsv
+ *
+ * * Transform from cmy into hsv
* static void
* cmy2hsv(int *c, int *m, int *y, int *h, int *s, int *v)
* {
@@ -3975,21 +3948,21 @@ cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
* int r, g, b;
* int r1, g1, b1;
* int maxValue, minValue, diff;
- *
+ *
* r = 255 - *c;
* g = 255 - *m;
* b = 255 - *y;
- *
+ *
* maxValue = max(r, max(g,b));
* minValue = min(r,min(g,b));
* diff = maxValue - minValue;
* *v = maxValue;
- *
+ *
* if (maxValue != 0)
* *s = x_mul_div(diff,255,maxValue);
* else
* *s = 0;
- *
+ *
* if (*s == 0)
* {
* hue = 0;
@@ -3999,31 +3972,30 @@ cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
* r1 = x_mul_div(maxValue - r,255,diff);
* g1 = x_mul_div(maxValue - g,255,diff);
* b1 = x_mul_div(maxValue - b,255,diff);
- *
+ *
* if (r == maxValue)
* hue = b1 - g1;
* else if (g == maxValue)
* hue = 510 + r1 - b1;
* else
* hue = 1020 + g1 - r1;
- *
+ *
* if (hue < 0)
* hue += 1530;
* }
- *
+ *
* *h = (hue + 3) / 6;
- *
+ *
* return;
* }
* end of unused code */
-
/************************ the routines for the cdj1600 printer ***************/
/* Configure the printer and start Raster mode */
static void
cdj1600_start_raster_mode(gx_device_printer * pdev, int paper_size,
- FILE * prn_stream)
+ FILE * prn_stream)
{
uint raster_width = pdev->width -
pdev->x_pixels_per_inch * (dev_l_margin(pdev) + dev_r_margin(pdev));
@@ -4055,7 +4027,7 @@ cdj1600_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* raster width and number of planes */
fprintf(prn_stream, "\033*r%ds-%du0A",
- raster_width, pdev->color_info.num_components);
+ raster_width, pdev->color_info.num_components);
/* start raster graphics */
fputs("\033*r1A", prn_stream);
@@ -4066,7 +4038,7 @@ cdj1600_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* Set compression if the mode has been defined. */
if (cdj850->compression)
- fprintf(prn_stream, "%dm", cdj850->compression);
+ fprintf(prn_stream, "%dm", cdj850->compression);
return;
} /* end configure raster-mode */
@@ -4074,17 +4046,17 @@ cdj1600_start_raster_mode(gx_device_printer * pdev, int paper_size,
/* print_plane compresses (mode 3) and outputs one plane */
static void
print_c3plane(FILE * prn_stream, char plane_code, int plane_size,
- const byte * curr, byte * prev, byte * out_data)
+ const byte * curr, byte * prev, byte * out_data)
{
/* Compress the output data */
int out_count = gdev_pcl_mode3compress(plane_size, curr, prev, out_data);
/* and output the data */
if (out_count > 0) {
- fprintf(prn_stream, "%d%c", out_count, plane_code);
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ fprintf(prn_stream, "%d%c", out_count, plane_code);
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
} else {
- putc(plane_code, prn_stream);
+ putc(plane_code, prn_stream);
}
}
@@ -4097,7 +4069,7 @@ copy_color_data(byte * dest, const byte * src, int n)
register const word *s = (const word *)src;
while (i-- > 0) {
- *d++ = *s++;
+ *d++ = *s++;
}
return n;
}
@@ -4105,34 +4077,34 @@ copy_color_data(byte * dest, const byte * src, int n)
/* Printing non-blank lines */
static void
cdj1600_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream)
{
int i, plane_size_c;
/* copy data to data_c in order to make do_floyd_steinberg work */
plane_size_c = copy_color_data
- (data_ptrs->data_c[misc_vars->cscan],
- data_ptrs->data[misc_vars->scan],
- misc_vars->databuff_size) / misc_vars->storage_bpp;
+ (data_ptrs->data_c[misc_vars->cscan],
+ data_ptrs->data[misc_vars->scan],
+ misc_vars->databuff_size) / misc_vars->storage_bpp;
/* dither the color planes */
do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
- misc_vars->plane_size, plane_size_c,
- misc_vars->num_comps, data_ptrs, pdev, error_values);
+ misc_vars->plane_size, plane_size_c,
+ misc_vars->num_comps, data_ptrs, pdev, error_values);
/* Transfer raster graphics in the order C, M, Y, that is
planes 2,1,0 */
for (i = misc_vars->num_comps - 1; i >= 0; i--) {
- /* output the lower color planes */
- print_c3plane(prn_stream, "wvv"[i], plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i],
- data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
- data_ptrs->out_data);
+ /* output the lower color planes */
+ print_c3plane(prn_stream, "wvv"[i], plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i],
+ data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
+ data_ptrs->out_data);
} /* End For i = num_comps */
misc_vars->cscan = 1 - misc_vars->cscan;
}
diff --git a/gs/contrib/gdevdj9.c b/gs/contrib/gdevdj9.c
index f4ad2fcba..2d38ef918 100644
--- a/gs/contrib/gdevdj9.c
+++ b/gs/contrib/gdevdj9.c
@@ -1,7 +1,7 @@
/*
- Copyright (C) 2000 <Rene Harsch, Switzerland>
+ Copyright (C) 2000 <Rene Harsch, Switzerland>
written by <Rene Harsch rene@harsch.net>
- modification by Mark Burton <markb@ordern.com>
+ modification by Mark Burton <markb@ordern.com>
Portions Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
@@ -33,7 +33,7 @@
/*$Id: gdevdj9.c,v 1.4 2002/09/03 02:23:05 easysw Exp $*/
/*
- A printer driver for the HP970Cxi color printer.
+ A printer driver for the HP970Cxi color printer.
To be used with the Ghostscript printing system.
Please report all problems to rene@harsch.net
@@ -42,12 +42,11 @@
from the cdj550 driver of George Cameron
and cdj850 of Uli Wortmann
-
- 2000-04-18 Version 1.0
+ 2000-04-18 Version 1.0
- The driver implements the following switches:
- Please note this switches are all copied from Uli Wortmann driver
- for hp850 (gdevcd8.c).
+ The driver implements the following switches:
+ Please note this switches are all copied from Uli Wortmann driver
+ for hp850 (gdevcd8.c).
-dPapertype= 0 plain paper [default]
1 bond paper
@@ -59,9 +58,9 @@
for printing on special paper or transperencies.
Please revert to the gamma functions in this case.
- -dQuality= -1 draft
+ -dQuality= -1 draft
0 normal [default]
- 1 presentation
+ 1 presentation
-dRetStatus= 0 C-RET off
1 C-RET on [default]
@@ -69,35 +68,34 @@
-dMasterGamma= 3.0 [default = 1.0]
__Note__: To take advantage of the calibrated color-transfer
functions, be sure not to have any Gamma-Statements
- left! If you need to (i.e. overhead sheets),
- you still can use the gamma-functions, but they will
- override the built-in calibration. To use gamma in the
+ left! If you need to (i.e. overhead sheets),
+ you still can use the gamma-functions, but they will
+ override the built-in calibration. To use gamma in the
traditional way, set MasterGamma to any value greater
1.0 and less 10.0. To adjust individual gamma-values,
you have to additionally set MasterGamma to a value
greater 1.0 and less 10.0
- new switches:
- -dDuplex= 0 [default] None Duplex Mode
- 1 Duplex Print Block Mode
- 2 Duplex Print Book Mode
+ new switches:
+ -dDuplex= 0 [default] None Duplex Mode
+ 1 Duplex Print Block Mode
+ 2 Duplex Print Book Mode
+ known bug: Black planes in duplex mode are still "clumsy"
- known bug: Black planes in duplex mode are still "clumsy"
+ for further information please look on my homepage @
+ http://www.harsch.net
- for further information please look on my homepage @
- http://www.harsch.net
-
- Have Fun.
+ Have Fun.
Rene
- 2001-12-24: Version 1.1
- Changes made by Mark Burton <markb@ordern.com>
- (many thanks :-)
+ 2001-12-24: Version 1.1
+ Changes made by Mark Burton <markb@ordern.com>
+ (many thanks :-)
- I have modified gdevdj9.c so that both the Quality and
- the Duplex parameter can be set using setpagedevice.
+ I have modified gdevdj9.c so that both the Quality and
+ the Duplex parameter can be set using setpagedevice.
One other minor fix was to the initialisation values for
gs_cdj970_device which seemed to use PRESENTATION rather than NORMAL.
@@ -121,39 +119,39 @@ typedef struct hp970_cmyk_init_s {
static const hp970_cmyk_init_t hp970_cmyk_init =
{
{
- 0x02, /* format */
- 0x04, /* number of components */
+ 0x02, /* format */
+ 0x04, /* number of components */
/* black */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* cyan */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* magenta */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02, /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02, /* LSB intensity levels */
/* yellow */
- 0x01, /* MSB x resolution */
- 0x2c, /* LSB x resolution */
- 0x01, /* MSB y resolution */
- 0x2c, /* LSB y resolution */
- 0x00, /* MSB intensity levels */
- 0x02 /* LSB intensity levels */
+ 0x01, /* MSB x resolution */
+ 0x2c, /* LSB x resolution */
+ 0x01, /* MSB y resolution */
+ 0x2c, /* LSB y resolution */
+ 0x00, /* MSB intensity levels */
+ 0x02 /* LSB intensity levels */
}
};
@@ -244,32 +242,32 @@ static const Gamma * const gammat[] =
static int
rescale_byte_wise1x1(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise2x1(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise1x2(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int
rescale_byte_wise2x2(int bytecount, const byte * inbytea,
- const byte * inbyteb, byte * outbyte);
+ const byte * inbyteb, byte * outbyte);
static int (* const rescale_color_plane[2][2]) (int, const byte *, const byte *, byte *) = {
{
- rescale_byte_wise1x1, rescale_byte_wise1x2
+ rescale_byte_wise1x1, rescale_byte_wise1x2
},
{
- rescale_byte_wise2x1, rescale_byte_wise2x2
+ rescale_byte_wise2x1, rescale_byte_wise2x2
}
};
/*
static int (* const rescale_color_plane[2][2]) (int, const byte *, const byte *, byte *) = {
{
- rescale_byte_wise1x1, rescale_byte_wise1x1
+ rescale_byte_wise1x1, rescale_byte_wise1x1
},
{
- rescale_byte_wise1x1, rescale_byte_wise1x1
+ rescale_byte_wise1x1, rescale_byte_wise1x1
}
};
*/
@@ -297,7 +295,6 @@ static int cdj970_write_trailer(gx_device *, FILE *);
#endif
#define DOFFSET (dev_t_margin(pdev) - DESKJET_PRINT_LIMIT) /* Print position */
-
#define W sizeof(word)
#define I sizeof(int)
@@ -313,12 +310,12 @@ typedef enum {
/* duplex mode */
typedef enum {
- NONE, BLOCK, BOOK
+ NONE, BLOCK, BOOK
} cdj_duplex_t;
/* Printer types */
typedef enum {
- DJ970C
+ DJ970C
} cdj_printer_type_t;
/* No. of ink jets (used to minimise head movements) */
@@ -350,16 +347,13 @@ static dev_proc_print_page(cdj970_print_page);
#define prn_colour_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, cmyk, correct)\
prn_device_body(dtype, procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page), cmyk, depth /* default */, correct
-
-
#define gx_prn_colour_device_common \
gx_prn_device_common; \
int cmyk; /* 0: not CMYK-capable, > 0: printing CMYK, */ \
- /* < 0 : CMYK-capable, not printing CMYK */ \
+ /* < 0 : CMYK-capable, not printing CMYK */ \
uint default_depth; /* Used only for CMYK-capable printers now. */ \
uint correction
-
/* some definitions needed later */
struct error_val_field {
int c; /* Current value of Cyan error during dithering */
@@ -423,13 +417,13 @@ struct misc_struct {
/* function pointer typedefs for device driver struct */
typedef void (*StartRasterMode) (gx_device_printer * pdev, int paper_size,
- FILE * prn_stream);
+ FILE * prn_stream);
typedef void (*PrintNonBlankLines) (gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
typedef void (*TerminatePage) (gx_device_printer * pdev, FILE * prn_stream);
@@ -446,10 +440,10 @@ typedef struct gx_device_cdj970_s {
int compression; /* compression level */
float mastergamma; /* Gammavalue applied to all colors */
float gammavalc; /* range to which gamma-correction is
- applied to bw values */
+ applied to bw values */
float gammavalm; /* amount of gamma correction for bw */
float gammavaly; /* range to which gamma-correction i
- applied to color values */
+ applied to color values */
float gammavalk; /* amount of gamma correction for color */
float blackcorrect; /* amount of gamma correction for color */
StartRasterMode start_raster_mode; /* output function to start raster mode */
@@ -462,7 +456,6 @@ typedef struct {
gx_prn_colour_device_common;
} gx_device_colour_prn;
-
/* Use the cprn_device macro to access generic fields (like cmyk,
default_depth and correction), and specific macros for specific
devices. */
@@ -478,7 +471,6 @@ typedef struct {
(bpp > 8 ? 5 : 2), (bpp > 8 ? 5 : bpp > 1 ? 2 : 0),\
print_page, 1 /* cmyk */, correct)
-
#define prn_cmy_colour_device(dtype, procs, dev_name, x_dpi, y_dpi, bpp, print_page, correct)\
prn_colour_device_body(dtype, procs, dev_name,\
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, x_dpi, y_dpi, 0, 0, 0, 0,\
@@ -487,7 +479,6 @@ typedef struct {
(bpp > 8 ? 5 : 2), (bpp > 8 ? 5 : bpp > 1 ? 2 : 0),\
print_page, -1 /* cmyk */, correct)
-
#define cdj_970_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page, correction, quality, papertype, duplex, intensities,ptype,compression,mastergamma,gammavalc,gammavalm,gammavaly,gammavalk,blackcorrect,start_raster_mode,print_non_blank_line,terminate_page)\
{ prn_cmyk_colour_device(gx_device_cdj970, procs, dev_name, x_dpi, y_dpi, bpp, print_page, correction),\
quality,\
@@ -509,56 +500,55 @@ typedef struct {
}
#define cmyk_colour_procs(proc_colour_open, proc_get_params, proc_put_params, \
- proc_colour_close, map_rgb_color, map_color_rgb, map_cmyk_color) {\
- proc_colour_open,\
- gx_default_get_initial_matrix,\
- gx_default_sync_output,\
- gdev_prn_output_page,\
- proc_colour_close,\
- map_rgb_color,\
- map_color_rgb,\
- NULL /* fill_rectangle */,\
- NULL /* tile_rectangle */,\
- NULL /* copy_mono */,\
- NULL /* copy_color */,\
- NULL /* draw_line */,\
- gx_default_get_bits,\
- proc_get_params,\
- proc_put_params,\
+ proc_colour_close, map_rgb_color, map_color_rgb, map_cmyk_color) {\
+ proc_colour_open,\
+ gx_default_get_initial_matrix,\
+ gx_default_sync_output,\
+ gdev_prn_output_page,\
+ proc_colour_close,\
+ map_rgb_color,\
+ map_color_rgb,\
+ NULL /* fill_rectangle */,\
+ NULL /* tile_rectangle */,\
+ NULL /* copy_mono */,\
+ NULL /* copy_color */,\
+ NULL /* draw_line */,\
+ gx_default_get_bits,\
+ proc_get_params,\
+ proc_put_params,\
map_cmyk_color\
}
static void
cdj970_start_raster_mode(gx_device_printer * pdev,
- int papersize, FILE * prn_stream);
+ int papersize, FILE * prn_stream);
static void
cdj970_print_non_blank_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
static void
cdj970_terminate_page(gx_device_printer * pdev, FILE * prn_stream);
-
static const gx_device_procs cdj970_procs =
cmyk_colour_procs(hp_colour_open, cdj970_get_params, cdj970_put_params,
- cdj970_close, NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
+ cdj970_close, NULL, gdev_cmyk_map_color_rgb, gdev_cmyk_map_cmyk_color);
const gx_device_cdj970 gs_cdj970_device =
- cdj_970_device(cdj970_procs, "cdj970", 600, 600, 32, cdj970_print_page, 0,
- NORMAL, PLAIN_PAPER, NONE, 4, DJ970C, 2,
- 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
- cdj970_start_raster_mode, cdj970_print_non_blank_lines,
- cdj970_terminate_page);
+ cdj_970_device(cdj970_procs, "cdj970", 600, 600, 32, cdj970_print_page, 0,
+ NORMAL, PLAIN_PAPER, NONE, 4, DJ970C, 2,
+ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
+ cdj970_start_raster_mode, cdj970_print_non_blank_lines,
+ cdj970_terminate_page);
/* Forward references */
static int cdj_put_param_int(gs_param_list *, gs_param_name,
- int *, int, int, int);
+ int *, int, int, int);
static int cdj_put_param_float(gs_param_list *, gs_param_name, float
- *, float, float, int);
+ *, float, float, int);
static int cdj_put_param_bpp(gx_device *, gs_param_list *, int, int, int);
static int cdj_set_bpp(gx_device *, int, int);
@@ -570,61 +560,61 @@ static int PageCtr = 0;
/* */
/**********************************************************************************/
-/* hp_colour_open: Open the printer and set up the margins.
+/* hp_colour_open: Open the printer and set up the margins.
----------------------------------------------------------------------------------*/
-static int hp_colour_open(gx_device * pdev)
-{
- int retCode;
-
- /* Set up colour params if put_params has not already done so */
- if (pdev->color_info.num_components == 0) {
- int code = cdj_set_bpp(pdev, pdev->color_info.depth,
- pdev->color_info.num_components);
-
- if (code < 0)
- return code;
- }
-
- retCode = gdev_prn_open (pdev);
- if (retCode < 0)
- return (retCode);
- else {
- retCode = gdev_prn_open_printer(pdev, true);
- if (retCode < 0)
- return (retCode);
- }
-
- return 0;
+static int hp_colour_open(gx_device * pdev)
+{
+ int retCode;
+
+ /* Set up colour params if put_params has not already done so */
+ if (pdev->color_info.num_components == 0) {
+ int code = cdj_set_bpp(pdev, pdev->color_info.depth,
+ pdev->color_info.num_components);
+
+ if (code < 0)
+ return code;
+ }
+
+ retCode = gdev_prn_open (pdev);
+ if (retCode < 0)
+ return (retCode);
+ else {
+ retCode = gdev_prn_open_printer(pdev, true);
+ if (retCode < 0)
+ return (retCode);
+ }
+
+ return 0;
}
/* cdj970_get_params: Added parameters for DeskJet 970C
----------------------------------------------------------------------------------*/
static int cdj970_get_params(gx_device * pdev, gs_param_list * plist)
{
- int code = gdev_prn_get_params(pdev, plist);
-
- if (code < 0 ||
- (code = param_write_int(plist, "Quality", &cdj970->quality)) < 0 ||
- (code = param_write_int(plist, "Duplex", &cdj970->duplex)) < 0 ||
- (code = param_write_int(plist, "Papertype", &cdj970->papertype)) < 0 ||
- (code = param_write_float(plist, "MasterGamma", &cdj970->gammavalc))
- < 0 ||
- (code = param_write_float(plist, "GammaValC", &cdj970->gammavalc)) <
- 0 ||
- (code = param_write_float(plist, "GammaValM", &cdj970->gammavalm)) <
- 0 ||
- (code = param_write_float(plist, "GammaValY", &cdj970->gammavaly)) <
- 0 ||
- (code = param_write_float(plist, "GammaValK", &cdj970->gammavalk)) <
- 0 ||
- (code = param_write_float(plist, "BlackCorrect",
- &cdj970->blackcorrect)) < 0)
-
- return (code);
- return (code);
+ int code = gdev_prn_get_params(pdev, plist);
+
+ if (code < 0 ||
+ (code = param_write_int(plist, "Quality", &cdj970->quality)) < 0 ||
+ (code = param_write_int(plist, "Duplex", &cdj970->duplex)) < 0 ||
+ (code = param_write_int(plist, "Papertype", &cdj970->papertype)) < 0 ||
+ (code = param_write_float(plist, "MasterGamma", &cdj970->gammavalc))
+ < 0 ||
+ (code = param_write_float(plist, "GammaValC", &cdj970->gammavalc)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValM", &cdj970->gammavalm)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValY", &cdj970->gammavaly)) <
+ 0 ||
+ (code = param_write_float(plist, "GammaValK", &cdj970->gammavalk)) <
+ 0 ||
+ (code = param_write_float(plist, "BlackCorrect",
+ &cdj970->blackcorrect)) < 0)
+
+ return (code);
+ return (code);
}
-/* cdj970_put_params:
+/* cdj970_put_params:
----------------------------------------------------------------------------------*/
static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
{
@@ -637,7 +627,7 @@ static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
float gammavaly = cdj970->gammavaly;
float gammavalk = cdj970->gammavalk;
float blackcorrect = cdj970->blackcorrect;
-
+
int bpp = 0;
int code = 0;
@@ -651,15 +641,15 @@ static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
code = cdj_put_param_float(plist, "GammaValY", &gammavaly, 0.0, 9.0, code);
code = cdj_put_param_float(plist, "GammaValK", &gammavalk, 0.0, 9.0, code);
code = cdj_put_param_float(plist, "BlackCorrect", &blackcorrect, 0.0,
- 9.0, code);
+ 9.0, code);
if (code < 0)
- return code;
-
+ return code;
+
code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
-
+
if (code < 0)
- return code;
+ return code;
cdj970->quality = quality;
cdj970->papertype = papertype;
@@ -670,7 +660,7 @@ static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
cdj970->gammavaly = gammavaly;
cdj970->gammavalk = gammavalk;
cdj970->blackcorrect = blackcorrect;
-
+
return 0;
}
@@ -682,7 +672,6 @@ static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
/* The DeskJet970C can compress (mode 9) */
-
/* Some convenient shorthand .. */
#define x_dpi (pdev->x_pixels_per_inch)
#define y_dpi (pdev->y_pixels_per_inch)
@@ -693,123 +682,121 @@ static int cdj970_put_params(gx_device * pdev, gs_param_list * plist)
/* internal functions */
static void
FSDlinebw(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * kP,
- int n, int *ep, byte * dp);
-
+ struct error_val_field *error_values,
+ byte * kP,
+ int n, int *ep, byte * dp);
+
static void
FSDlinec2(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa, int n,
- byte * dp, int *ep);
-
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa, int n,
+ byte * dp, int *ep);
+
static void
FSDlinec3(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep);
-
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep);
+
static void
FSDlinec4(int scan, int plane_size,
- struct error_val_field *error_values,
- byte * cPa, byte * mPa, byte * yPa,
- byte * cPb, byte * mPb, byte * yPb,
- int n, byte * dp, int *ep);
+ struct error_val_field *error_values,
+ byte * cPa, byte * mPa, byte * yPa,
+ byte * cPb, byte * mPb, byte * yPb,
+ int n, byte * dp, int *ep);
static void
init_error_buffer(struct misc_struct *misc_vars,
- struct ptr_arrays *data_ptrs);
-
+ struct ptr_arrays *data_ptrs);
+
static void
do_floyd_steinberg(int scan, int cscan, int plane_size,
- int plane_size_c, int n,
- struct ptr_arrays *data_ptrs,
- gx_device_printer * pdev,
- struct error_val_field *error_values);
+ int plane_size_c, int n,
+ struct ptr_arrays *data_ptrs,
+ gx_device_printer * pdev,
+ struct error_val_field *error_values);
-
static int
do_gcr(int bytecount, byte * inbyte, const byte * kvalues,
- const byte * cvalues, const byte * mvalues,
- const byte * yvalues, const int *kcorrect);
-
+ const byte * cvalues, const byte * mvalues,
+ const byte * yvalues, const int *kcorrect);
+
static void
send_scan_lines(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE * prn_stream);
-
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE * prn_stream);
+
static void
do_gamma(float mastergamma, float gammaval, byte * values);
-
+
static void
do_black_correction(float kvalue, int *kcorrect);
static void
init_data_structure(gx_device_printer * pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars);
-
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars);
+
static void
calculate_memory_size(gx_device_printer * pdev,
- struct misc_struct *misc_vars);
-
+ struct misc_struct *misc_vars);
-/* assign_dpi:
+/* assign_dpi:
----------------------------------------------------------------------------------*/
static void assign_dpi(int dpi, byte * msb)
{
- if (dpi == 600) {
- msb[0] = 0x02;
- msb[1] = 0x58;
- } else {
- msb[0] = 0x01;
- msb[1] = 0x2c;
- }
+ if (dpi == 600) {
+ msb[0] = 0x02;
+ msb[1] = 0x58;
+ } else {
+ msb[0] = 0x01;
+ msb[1] = 0x2c;
+ }
}
-/* cdj970_terminate_page:
+/* cdj970_terminate_page:
----------------------------------------------------------------------------------*/
static void cdj970_terminate_page(gx_device_printer * pdev, FILE * prn_stream)
{
- fputs("\033*rC\f\033&l-2H", prn_stream); /* End Graphics, Reset */
+ fputs("\033*rC\f\033&l-2H", prn_stream); /* End Graphics, Reset */
}
-/* cdj970_one_time_initialisation:
+/* cdj970_one_time_initialisation:
----------------------------------------------------------------------------------*/
static void cdj970_one_time_initialisation(gx_device_printer * pdev)
{
/* Change the margins if necessary. */
static const float dj_a4[4] = {
- DESKJET_MARGINS_A4
+ DESKJET_MARGINS_A4
};
-
+
static const float dj_letter[4] = {
- DESKJET_MARGINS_LETTER
+ DESKJET_MARGINS_LETTER
};
const float *m = (float *)0;
/* quality setup */
if (cdj970->quality == DRAFT) {
- gx_device_set_resolution((gx_device *)pdev, 300.0, 300.0);
- cdj970->xscal = 0;
- cdj970->yscal = 0;
- cdj970->intensities = 2;
+ gx_device_set_resolution((gx_device *)pdev, 300.0, 300.0);
+ cdj970->xscal = 0;
+ cdj970->yscal = 0;
+ cdj970->intensities = 2;
} else if (cdj970->quality == NORMAL) {
- gx_device_set_resolution((gx_device *)pdev, 600.0, 600.0);
- cdj970->xscal = 1;
- cdj970->yscal = 1;
- /* intensities = 4 from initialization */
+ gx_device_set_resolution((gx_device *)pdev, 600.0, 600.0);
+ cdj970->xscal = 1;
+ cdj970->yscal = 1;
+ /* intensities = 4 from initialization */
} else { /* quality == PRESENTATION */
- gx_device_set_resolution((gx_device *)pdev, 600.0, 600.0);
- cdj970->xscal = 0;
- cdj970->yscal = 0 ;
- /* intensities = 4 from initialization */
+ gx_device_set_resolution((gx_device *)pdev, 600.0, 600.0);
+ cdj970->xscal = 0;
+ cdj970->yscal = 0 ;
+ /* intensities = 4 from initialization */
}
-
+
m = (gdev_pcl_paper_size((gx_device *)pdev) == PAPER_SIZE_A4 ? dj_a4 : dj_letter);
gx_device_set_margins((gx_device *)pdev, m, true);
@@ -821,422 +808,414 @@ static void cdj970_one_time_initialisation(gx_device_printer * pdev)
----------------------------------------------------------------------------------*/
static int cdj970_print_page(gx_device_printer * pdev, FILE * prn_stream)
{
- struct error_val_field error_values;
- struct ptr_arrays data_ptrs;
- struct misc_struct misc_vars;
-
- Gamma gamma;
-
- if (PageCtr == 0 && cdj970->ptype == DJ970C) {
- cdj970_one_time_initialisation(pdev);
- }
-
- /* make a local writable copy of the Gamma tables */
- memcpy(&gamma, gammat[cdj970->ptype], sizeof(Gamma));
-
- /* if mastergamma, don't use the built in functions */
- if (cdj970->mastergamma > 1.0) {
- /* prepare the bw lookup table */
- do_gamma(cdj970->mastergamma, cdj970->gammavalk, gamma.k);
- /* prepare the color lookup table */
- do_gamma(cdj970->mastergamma, cdj970->gammavalc, gamma.c);
- do_gamma(cdj970->mastergamma, cdj970->gammavalm, gamma.m);
- do_gamma(cdj970->mastergamma, cdj970->gammavaly, gamma.y);
- }
-
- /* prepare the black correction table for the unbunt mask */
- do_black_correction(cdj970->blackcorrect, gamma.correct);
-
- /* Calculate the needed memory */
- calculate_memory_size(pdev, &misc_vars);
-
- /* and allocate the memory */
-
- /* Since we need 600 and 300 dpi, we set up several buffers:
+ struct error_val_field error_values;
+ struct ptr_arrays data_ptrs;
+ struct misc_struct misc_vars;
+
+ Gamma gamma;
+
+ if (PageCtr == 0 && cdj970->ptype == DJ970C) {
+ cdj970_one_time_initialisation(pdev);
+ }
+
+ /* make a local writable copy of the Gamma tables */
+ memcpy(&gamma, gammat[cdj970->ptype], sizeof(Gamma));
+
+ /* if mastergamma, don't use the built in functions */
+ if (cdj970->mastergamma > 1.0) {
+ /* prepare the bw lookup table */
+ do_gamma(cdj970->mastergamma, cdj970->gammavalk, gamma.k);
+ /* prepare the color lookup table */
+ do_gamma(cdj970->mastergamma, cdj970->gammavalc, gamma.c);
+ do_gamma(cdj970->mastergamma, cdj970->gammavalm, gamma.m);
+ do_gamma(cdj970->mastergamma, cdj970->gammavaly, gamma.y);
+ }
+
+ /* prepare the black correction table for the unbunt mask */
+ do_black_correction(cdj970->blackcorrect, gamma.correct);
+
+ /* Calculate the needed memory */
+ calculate_memory_size(pdev, &misc_vars);
+
+ /* and allocate the memory */
+
+ /* Since we need 600 and 300 dpi, we set up several buffers:
storage contains the data as copied from gs, as well as the
- plane-data and the out_row buffer.
- storagec will contain the rescaled color data. It also contains the
- plane_data for the color-planes - these are needed by the
- compression routine, but would be overwritten by the
- b/w-dithering. The color planes allow for overwriting the
- color-data by the error-data. Since we might use the
- 2bpp feature of the hp970 someday, it is sized like storage.
- storagee contains the errors from b/w fs-ditherng */
-
- data_ptrs.storage = (ulong *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), misc_vars.storage_size_words, W,
- "cdj970_print_page");
-
- /* if we can't allocate working area */
- if (data_ptrs.storage == 0) {
- return_error(gs_error_VMerror);
- }
-
- /* Initialise the needed pointers */
- init_data_structure(pdev, &data_ptrs, &misc_vars);
-
- /* Start Raster mode */
- (*cdj970->start_raster_mode) (pdev, misc_vars.paper_size, prn_stream);
-
- /* Send each scan line in turn */
- send_scan_lines(pdev, &data_ptrs, &misc_vars, &error_values, &gamma, prn_stream);
-
- /* terminate page and eject paper */
- (*cdj970->terminate_page) (pdev, prn_stream);
-
- /* Free Memory */
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)data_ptrs.storage, misc_vars.storage_size_words, W,
- "hp970_print_page");
-
- PageCtr ++;
-
- return (0);
+ plane-data and the out_row buffer.
+ storagec will contain the rescaled color data. It also contains the
+ plane_data for the color-planes - these are needed by the
+ compression routine, but would be overwritten by the
+ b/w-dithering. The color planes allow for overwriting the
+ color-data by the error-data. Since we might use the
+ 2bpp feature of the hp970 someday, it is sized like storage.
+ storagee contains the errors from b/w fs-ditherng */
+
+ data_ptrs.storage = (ulong *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), misc_vars.storage_size_words, W,
+ "cdj970_print_page");
+
+ /* if we can't allocate working area */
+ if (data_ptrs.storage == 0) {
+ return_error(gs_error_VMerror);
+ }
+
+ /* Initialise the needed pointers */
+ init_data_structure(pdev, &data_ptrs, &misc_vars);
+
+ /* Start Raster mode */
+ (*cdj970->start_raster_mode) (pdev, misc_vars.paper_size, prn_stream);
+
+ /* Send each scan line in turn */
+ send_scan_lines(pdev, &data_ptrs, &misc_vars, &error_values, &gamma, prn_stream);
+
+ /* terminate page and eject paper */
+ (*cdj970->terminate_page) (pdev, prn_stream);
+
+ /* Free Memory */
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)data_ptrs.storage, misc_vars.storage_size_words, W,
+ "hp970_print_page");
+
+ PageCtr ++;
+
+ return (0);
}
#define odd(i) ((i & 01) != 0)
#define BUFFER_SIZE 5000
-/* GetScanLine:
+/* GetScanLine:
----------------------------------------------------------------------------------*/
-static int GetScanLine( gx_device_printer * pdev,
- int *lnum,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- word rmask)
+static int GetScanLine( gx_device_printer * pdev,
+ int *lnum,
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ word rmask)
{
- word *data_words = (word *) data_ptrs->data[misc_vars->scan];
- register word *end_data = data_words + misc_vars->line_size_words;
- unsigned long tempBuffer[BUFFER_SIZE];
- int i = 0;
- register word *enddata2;
+ word *data_words = (word *) data_ptrs->data[misc_vars->scan];
+ register word *end_data = data_words + misc_vars->line_size_words;
+ unsigned long tempBuffer[BUFFER_SIZE];
+ int i = 0;
+ register word *enddata2;
- if ((cdj970->duplex == BOOK) && (PageCtr%2 == 1)) --(*lnum);
- else ++(*lnum);
+ if ((cdj970->duplex == BOOK) && (PageCtr%2 == 1)) --(*lnum);
+ else ++(*lnum);
- gdev_prn_copy_scan_lines(pdev, *lnum, (byte *) data_words, misc_vars->line_size);
+ gdev_prn_copy_scan_lines(pdev, *lnum, (byte *) data_words, misc_vars->line_size);
- if (cdj970->quality == DRAFT)
- enddata2 = (unsigned long*)end_data - ((gdev_pcl_paper_size((gx_device*)pdev) ==
- PAPER_SIZE_A4 ? DUPLEX_LEFT_MARGIN_A4/2 : DUPLEX_LEFT_MARGIN_LETTER/2));
+ if (cdj970->quality == DRAFT)
+ enddata2 = (unsigned long*)end_data - ((gdev_pcl_paper_size((gx_device*)pdev) ==
+ PAPER_SIZE_A4 ? DUPLEX_LEFT_MARGIN_A4/2 : DUPLEX_LEFT_MARGIN_LETTER/2));
- else
- enddata2 = (unsigned long*)end_data - ((gdev_pcl_paper_size((gx_device*)pdev) ==
- PAPER_SIZE_A4 ? DUPLEX_LEFT_MARGIN_A4 : DUPLEX_LEFT_MARGIN_LETTER));
+ else
+ enddata2 = (unsigned long*)end_data - ((gdev_pcl_paper_size((gx_device*)pdev) ==
+ PAPER_SIZE_A4 ? DUPLEX_LEFT_MARGIN_A4 : DUPLEX_LEFT_MARGIN_LETTER));
- end_data = enddata2;
+ end_data = enddata2;
- if ((cdj970->duplex == BOOK) && (PageCtr%2 == 1)) {
- memset (tempBuffer, 0, BUFFER_SIZE*sizeof(unsigned long));
+ if ((cdj970->duplex == BOOK) && (PageCtr%2 == 1)) {
+ memset (tempBuffer, 0, BUFFER_SIZE*sizeof(unsigned long));
- while (enddata2 > data_words) {
- tempBuffer[i++] = *((unsigned long*)enddata2);
- enddata2 --;
- }
+ while (enddata2 > data_words) {
+ tempBuffer[i++] = *((unsigned long*)enddata2);
+ enddata2 --;
+ }
- memcpy (data_words, tempBuffer, i*sizeof(unsigned long));
+ memcpy (data_words, tempBuffer, i*sizeof(unsigned long));
- }
+ }
- misc_vars->scan = 1 - misc_vars->scan; /* toggle scan direction */
- misc_vars->is_two_pass = odd(*lnum); /* color output for odd lines */
+ misc_vars->scan = 1 - misc_vars->scan; /* toggle scan direction */
+ misc_vars->is_two_pass = odd(*lnum); /* color output for odd lines */
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while (end_data > data_words && end_data[-1] == 0)
+ end_data--;
- /* Remove trailing 0s. */
- while (end_data > data_words && end_data[-1] == 0)
- end_data--;
-
-
- return (end_data - data_words);
+ return (end_data - data_words);
}
-
-#define PAGE_CTR_OK ( ((cdj970->duplex < BOOK) && (lnum < lend)) || ((cdj970->duplex == BOOK) && (lnum >= 0) && (PageCtr%2 == 1)) || ((cdj970->duplex == BOOK) && (PageCtr%2 == 0) && (lnum < lend)))
+#define PAGE_CTR_OK ( ((cdj970->duplex < BOOK) && (lnum < lend)) || ((cdj970->duplex == BOOK) && (lnum >= 0) && (PageCtr%2 == 1)) || ((cdj970->duplex == BOOK) && (PageCtr%2 == 0) && (lnum < lend)))
/* send_scan_lines: Send the scan lines to the printer
----------------------------------------------------------------------------------*/
static void send_scan_lines( gx_device_printer *pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE *prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE *prn_stream)
{
- int lnum, lend, llen;
- int num_blank_lines = 0;
-
- word rmask = ~(word) 0 << ((-pdev->width * misc_vars->storage_bpp) & (W * 8 - 1));
-
- lend = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi;
-
- error_values->c = error_values->m = error_values->y = error_values->k = 0;
-
- /* init the error buffer */
- init_error_buffer(misc_vars, data_ptrs);
-
- misc_vars->zero_row_count = 0;
-
- if ((cdj970->duplex == BOOK) && (PageCtr%2==1)) {
- lnum = lend;
-
- if (cdj970->quality == DRAFT)
- num_blank_lines = (gdev_pcl_paper_size((gx_device*)pdev) == PAPER_SIZE_A4
- ? DUPLEX_BOTTOM_MARGIN_A4/2 : DUPLEX_BOTTOM_MARGIN_LETTER/2);
- else
- num_blank_lines = (gdev_pcl_paper_size((gx_device*)pdev) == PAPER_SIZE_A4
- ? DUPLEX_BOTTOM_MARGIN_A4 : DUPLEX_BOTTOM_MARGIN_LETTER);
- } else lnum = -1;
-
- llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
-
- while ( PAGE_CTR_OK ) {
-
- while (PAGE_CTR_OK && llen == 0) {
- ++num_blank_lines;
- llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
- }
-
- if (! PAGE_CTR_OK) {
- break;
- }
-
- /* Skip blank lines if any */
- if (num_blank_lines > 0) {
- fprintf(prn_stream, "%dy", num_blank_lines / (cdj970->yscal + 1));
- memset(data_ptrs->plane_data[0][0], 0, (misc_vars->plane_size * 2 * misc_vars->num_comps));
- memset(data_ptrs->plane_data_c[0][0], 0, (misc_vars->plane_size_c * 2 * misc_vars->num_comps));
-
- }
-
- /* all blank lines printed, now for the non-blank lines */
- if (cdj970->yscal && odd(lnum)) {
- /* output a blank black plane for odd lines */
- putc('v', prn_stream);
- }
- /* now output all non blank lines */
- while (PAGE_CTR_OK && llen != 0) {
- misc_vars->is_color_data = 0; /* maybe we have color ? */
- (*cdj970->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
- error_values, gamma, prn_stream);
- llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
- }
- if (cdj970->yscal && odd(lnum)) { /* output empty line for odd lines */
- (*cdj970->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
- error_values, gamma, prn_stream);
- }
- /* the current line is empty => run the next iteration */
- num_blank_lines = 0;
- }
+ int lnum, lend, llen;
+ int num_blank_lines = 0;
+
+ word rmask = ~(word) 0 << ((-pdev->width * misc_vars->storage_bpp) & (W * 8 - 1));
+
+ lend = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi;
+
+ error_values->c = error_values->m = error_values->y = error_values->k = 0;
+
+ /* init the error buffer */
+ init_error_buffer(misc_vars, data_ptrs);
+
+ misc_vars->zero_row_count = 0;
+
+ if ((cdj970->duplex == BOOK) && (PageCtr%2==1)) {
+ lnum = lend;
+
+ if (cdj970->quality == DRAFT)
+ num_blank_lines = (gdev_pcl_paper_size((gx_device*)pdev) == PAPER_SIZE_A4
+ ? DUPLEX_BOTTOM_MARGIN_A4/2 : DUPLEX_BOTTOM_MARGIN_LETTER/2);
+ else
+ num_blank_lines = (gdev_pcl_paper_size((gx_device*)pdev) == PAPER_SIZE_A4
+ ? DUPLEX_BOTTOM_MARGIN_A4 : DUPLEX_BOTTOM_MARGIN_LETTER);
+ } else lnum = -1;
+
+ llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
+
+ while ( PAGE_CTR_OK ) {
+
+ while (PAGE_CTR_OK && llen == 0) {
+ ++num_blank_lines;
+ llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
+ }
+
+ if (! PAGE_CTR_OK) {
+ break;
+ }
+
+ /* Skip blank lines if any */
+ if (num_blank_lines > 0) {
+ fprintf(prn_stream, "%dy", num_blank_lines / (cdj970->yscal + 1));
+ memset(data_ptrs->plane_data[0][0], 0, (misc_vars->plane_size * 2 * misc_vars->num_comps));
+ memset(data_ptrs->plane_data_c[0][0], 0, (misc_vars->plane_size_c * 2 * misc_vars->num_comps));
+
+ }
+
+ /* all blank lines printed, now for the non-blank lines */
+ if (cdj970->yscal && odd(lnum)) {
+ /* output a blank black plane for odd lines */
+ putc('v', prn_stream);
+ }
+ /* now output all non blank lines */
+ while (PAGE_CTR_OK && llen != 0) {
+ misc_vars->is_color_data = 0; /* maybe we have color ? */
+ (*cdj970->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
+ error_values, gamma, prn_stream);
+ llen = GetScanLine(pdev, &lnum, data_ptrs, misc_vars, rmask);
+ }
+ if (cdj970->yscal && odd(lnum)) { /* output empty line for odd lines */
+ (*cdj970->print_non_blank_lines) (pdev, data_ptrs, misc_vars,
+ error_values, gamma, prn_stream);
+ }
+ /* the current line is empty => run the next iteration */
+ num_blank_lines = 0;
+ }
}
/* print_c2plane: Sprint_line compresses (mode 2) and outputs one plane
----------------------------------------------------------------------------------*/
-static void print_c2plane( FILE *prn_stream,
- char plane_code,
- int plane_size,
- const byte *curr,
- const byte *prev,
- byte *out_data)
+static void print_c2plane( FILE *prn_stream,
+ char plane_code,
+ int plane_size,
+ const byte *curr,
+ const byte *prev,
+ byte *out_data)
{
- const word *row = (const word *)curr;
- const word *end_row = row + plane_size/W;
- int out_count;
-
- out_count = gdev_pcl_mode2compress(row, end_row, out_data);
-
- /* and output the data */
- if (out_count > 0) {
- fprintf(prn_stream, "%d%c", out_count, plane_code);
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
- } else {
- putc(plane_code, prn_stream);
- }
+ const word *row = (const word *)curr;
+ const word *end_row = row + plane_size/W;
+ int out_count;
+
+ out_count = gdev_pcl_mode2compress(row, end_row, out_data);
+
+ /* and output the data */
+ if (out_count > 0) {
+ fprintf(prn_stream, "%d%c", out_count, plane_code);
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ } else {
+ putc(plane_code, prn_stream);
+ }
}
#define SET_BLACK(n) *cPa=*cPa|n; *mPa=*mPa|n; *yPa=*yPa|n;
-/* cdj970_print_non_blank_lines: Printing non-blank lines
+/* cdj970_print_non_blank_lines: Printing non-blank lines
----------------------------------------------------------------------------------*/
static void cdj970_print_non_blank_lines( gx_device_printer *pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars,
- struct error_val_field *error_values,
- const Gamma *gamma,
- FILE *prn_stream)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars,
+ struct error_val_field *error_values,
+ const Gamma *gamma,
+ FILE *prn_stream)
{
- static const char *const plane_code[2] = {"vvvv", "wvvv"};
-
- int i;
- byte *kP = data_ptrs->plane_data[misc_vars->scan + 2][3];
- byte *dp = data_ptrs->data[misc_vars->scan + 2];
- int *ep = data_ptrs->errors[misc_vars->scan];
-
- /* we need cmyk color separation befor all the rest, since
- black may be contained in the color fields. This needs to
- be done on all pixel-rows, since even unused color-bytes
- might generate black */
-
- misc_vars->is_color_data =
- do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
- gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct);
-
- /* dithering the black-plane */
- FSDlinebw(misc_vars->scan, misc_vars->plane_size,
- error_values, kP, misc_vars->num_comps, ep, dp);
- /* output the black plane */
- print_c2plane(prn_stream, 'v', misc_vars->plane_size,
- data_ptrs->plane_data[misc_vars->scan][3],
- data_ptrs->plane_data[1 - misc_vars->scan][3],
- data_ptrs->out_data);
-
-
- /* since color resolution is only half of the b/w-resolution,
- we only output every second row */
- if (!cdj970->yscal || misc_vars->is_two_pass) {
- int plane_size_c = (*rescale_color_plane[cdj970->xscal][cdj970->yscal])
- (misc_vars->databuff_size,
- data_ptrs->data[misc_vars->scan],
- data_ptrs->data[1 - misc_vars->scan],
- data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
-
- /* dither the color planes */
- do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
- misc_vars->plane_size, plane_size_c,
- misc_vars->num_comps, data_ptrs, pdev, error_values);
-
-
- /* the color pointers, lower byte */
- /* Transfer raster graphics in the order C, M, Y, that is planes 2,1,0 */
- for (i = misc_vars->num_comps - 2; i >= 0; i--) {
-
- /* output the lower color planes */
- if (cdj970->intensities > 2) {
- /* output the upper color planes */
- print_c2plane(prn_stream, plane_code[0][i], plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
- data_ptrs->plane_data_c[1 - misc_vars->cscan][i + 4],
- data_ptrs->out_data);
-
- }
- print_c2plane(prn_stream, plane_code[1][i],
- plane_size_c,
- data_ptrs->plane_data_c[misc_vars->cscan][i],
- data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
- data_ptrs->out_data);
-
- } /* End For i = num_comps */
-
- misc_vars->cscan = 1 - misc_vars->cscan;
-
- } /* End of is_two_pass */
-
- return;
+ static const char *const plane_code[2] = {"vvvv", "wvvv"};
+
+ int i;
+ byte *kP = data_ptrs->plane_data[misc_vars->scan + 2][3];
+ byte *dp = data_ptrs->data[misc_vars->scan + 2];
+ int *ep = data_ptrs->errors[misc_vars->scan];
+
+ /* we need cmyk color separation befor all the rest, since
+ black may be contained in the color fields. This needs to
+ be done on all pixel-rows, since even unused color-bytes
+ might generate black */
+
+ misc_vars->is_color_data =
+ do_gcr(misc_vars->databuff_size, data_ptrs->data[misc_vars->scan],
+ gamma->k, gamma->c, gamma->m, gamma->y, gamma->correct);
+
+ /* dithering the black-plane */
+ FSDlinebw(misc_vars->scan, misc_vars->plane_size,
+ error_values, kP, misc_vars->num_comps, ep, dp);
+ /* output the black plane */
+ print_c2plane(prn_stream, 'v', misc_vars->plane_size,
+ data_ptrs->plane_data[misc_vars->scan][3],
+ data_ptrs->plane_data[1 - misc_vars->scan][3],
+ data_ptrs->out_data);
+
+ /* since color resolution is only half of the b/w-resolution,
+ we only output every second row */
+ if (!cdj970->yscal || misc_vars->is_two_pass) {
+ int plane_size_c = (*rescale_color_plane[cdj970->xscal][cdj970->yscal])
+ (misc_vars->databuff_size,
+ data_ptrs->data[misc_vars->scan],
+ data_ptrs->data[1 - misc_vars->scan],
+ data_ptrs->data_c[misc_vars->cscan]) / misc_vars->storage_bpp;
+
+ /* dither the color planes */
+ do_floyd_steinberg(misc_vars->scan, misc_vars->cscan,
+ misc_vars->plane_size, plane_size_c,
+ misc_vars->num_comps, data_ptrs, pdev, error_values);
+
+ /* the color pointers, lower byte */
+ /* Transfer raster graphics in the order C, M, Y, that is planes 2,1,0 */
+ for (i = misc_vars->num_comps - 2; i >= 0; i--) {
+
+ /* output the lower color planes */
+ if (cdj970->intensities > 2) {
+ /* output the upper color planes */
+ print_c2plane(prn_stream, plane_code[0][i], plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i + 4],
+ data_ptrs->plane_data_c[1 - misc_vars->cscan][i + 4],
+ data_ptrs->out_data);
+
+ }
+ print_c2plane(prn_stream, plane_code[1][i],
+ plane_size_c,
+ data_ptrs->plane_data_c[misc_vars->cscan][i],
+ data_ptrs->plane_data_c[1 - misc_vars->cscan][i],
+ data_ptrs->out_data);
+
+ } /* End For i = num_comps */
+
+ misc_vars->cscan = 1 - misc_vars->cscan;
+
+ } /* End of is_two_pass */
+
+ return;
}
-/* do_floyd_steinberg: moved that code into his own subroutine,
+/* do_floyd_steinberg: moved that code into his own subroutine,
* otherwise things get somewhat clumsy
----------------------------------------------------------------------------------*/
-static void do_floyd_steinberg( int scan,
- int cscan,
- int plane_size,
- int plane_size_c,
- int n,
- struct ptr_arrays *data_ptrs,
- gx_device_printer *pdev,
- struct error_val_field *error_values)
+static void do_floyd_steinberg( int scan,
+ int cscan,
+ int plane_size,
+ int plane_size_c,
+ int n,
+ struct ptr_arrays *data_ptrs,
+ gx_device_printer *pdev,
+ struct error_val_field *error_values)
{
- /* the color pointers */
- byte *cPa, *mPa, *yPa, *cPb, *mPb, *yPb;
- byte *dpc;
- int *epc;
-
- /* the b/w pointers */
- byte *kP, *dp;
- int *ep;
-
- /* the color pointers, lower byte */
- cPa = data_ptrs->plane_data_c[cscan + 2][2];
- mPa = data_ptrs->plane_data_c[cscan + 2][1];
- yPa = data_ptrs->plane_data_c[cscan + 2][0];
-
- /* upper byte */
- cPb = data_ptrs->plane_data_c[cscan + 2][6];
- mPb = data_ptrs->plane_data_c[cscan + 2][5];
- yPb = data_ptrs->plane_data_c[cscan + 2][4];
-
- /* data and error */
- dpc = data_ptrs->data_c[cscan + 2];
- epc = data_ptrs->errors_c[cscan];
-
- /* the b/w pointers */
- kP = data_ptrs->plane_data[scan + 2][3];
- dp = data_ptrs->data[scan + 2];
- ep = data_ptrs->errors[scan];
-
- switch (cdj970->intensities) {
- case 2:
- FSDlinec2(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, n, dpc, epc);
- break;
-
- case 3:
- FSDlinec3(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
- break;
-
- case 4:
- FSDlinec4(cscan, plane_size_c, error_values,
- cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
- break;
-
- default:
- assert(0);
- }
-
- return;
+ /* the color pointers */
+ byte *cPa, *mPa, *yPa, *cPb, *mPb, *yPb;
+ byte *dpc;
+ int *epc;
+
+ /* the b/w pointers */
+ byte *kP, *dp;
+ int *ep;
+
+ /* the color pointers, lower byte */
+ cPa = data_ptrs->plane_data_c[cscan + 2][2];
+ mPa = data_ptrs->plane_data_c[cscan + 2][1];
+ yPa = data_ptrs->plane_data_c[cscan + 2][0];
+
+ /* upper byte */
+ cPb = data_ptrs->plane_data_c[cscan + 2][6];
+ mPb = data_ptrs->plane_data_c[cscan + 2][5];
+ yPb = data_ptrs->plane_data_c[cscan + 2][4];
+
+ /* data and error */
+ dpc = data_ptrs->data_c[cscan + 2];
+ epc = data_ptrs->errors_c[cscan];
+
+ /* the b/w pointers */
+ kP = data_ptrs->plane_data[scan + 2][3];
+ dp = data_ptrs->data[scan + 2];
+ ep = data_ptrs->errors[scan];
+
+ switch (cdj970->intensities) {
+ case 2:
+ FSDlinec2(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, n, dpc, epc);
+ break;
+
+ case 3:
+ FSDlinec3(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
+ break;
+
+ case 4:
+ FSDlinec4(cscan, plane_size_c, error_values,
+ cPa, mPa, yPa, cPb, mPb, yPb, n, dpc, epc);
+ break;
+
+ default:
+ assert(0);
+ }
+
+ return;
}
-
-/* do_gamma: here we do our own gamma-correction
+/* do_gamma: here we do our own gamma-correction
----------------------------------------------------------------------------------*/
static void do_gamma(float mastergamma, float gammaval, byte values[256])
{
- int i;
- float gamma;
+ int i;
+ float gamma;
- if (gammaval > 0.0) {
- gamma = gammaval;
- } else {
- gamma = mastergamma;
- }
+ if (gammaval > 0.0) {
+ gamma = gammaval;
+ } else {
+ gamma = mastergamma;
+ }
- for (i = 0; i < 256; i++) {
- values[i] = (byte) (255.0 * (1.0 - pow(((double)(255.0 - (float)i) / 255.0),
- (double)(1.0 / gamma))));
- }
+ for (i = 0; i < 256; i++) {
+ values[i] = (byte) (255.0 * (1.0 - pow(((double)(255.0 - (float)i) / 255.0),
+ (double)(1.0 / gamma))));
+ }
- return;
+ return;
}
-
-/* do_black_correction: here we calculate a lookup-table which is used to
- * compensate the relativ loss of color due to
+/* do_black_correction: here we calculate a lookup-table which is used to
+ * compensate the relativ loss of color due to
* undercolor-removal
----------------------------------------------------------------------------------*/
static void do_black_correction(float kvalue, int kcorrect[256])
{
- int i;
+ int i;
- for (i = 0; i < 256; i++) {
- kcorrect[i] = (int)(100.0 * kvalue * (pow(10.0, pow((i / 255.0), 3.0)) - 1.0));
- }
+ for (i = 0; i < 256; i++) {
+ kcorrect[i] = (int)(100.0 * kvalue * (pow(10.0, pow((i / 255.0), 3.0)) - 1.0));
+ }
- return;
+ return;
}
-
-/* DOUCR: For Better Performance we use a macro here
+/* DOUCR: For Better Performance we use a macro here
----------------------------------------------------------------------------------*/
#define DOUCR(col1, col2, col3, col4)\
{\
@@ -1263,8 +1242,7 @@ static void do_black_correction(float kvalue, int kcorrect[256])
*col3 = *col3 - ucr ;\
}
-
-/* DOGCR: For Better Performance we use a macro here
+/* DOGCR: For Better Performance we use a macro here
----------------------------------------------------------------------------------*/
#define DOGCR(col1, col2, col3, col4)\
{\
@@ -1279,160 +1257,158 @@ static void do_black_correction(float kvalue, int kcorrect[256])
*col2 *= uca_fac;\
}
-
/* do_gcr: Since resolution can be different on different planes, we need to
* do real color separation, here we try a real grey component
* replacement
----------------------------------------------------------------------------------*/
-static int do_gcr( int bytecount,
- byte *inbyte,
- const byte kvalues[256],
- const byte cvalues[256],
- const byte mvalues[256],
- const byte yvalues[256],
- const int kcorrect[256])
+static int do_gcr( int bytecount,
+ byte *inbyte,
+ const byte kvalues[256],
+ const byte cvalues[256],
+ const byte mvalues[256],
+ const byte yvalues[256],
+ const int kcorrect[256])
{
- int i, ucr, kadd, is_color = 0;
- byte *black, *cyan, *magenta, *yellow;
- float uca_fac;
-
- /* Grey component replacement */
- for (i = 0; i < bytecount; i += 4) {
- black = inbyte++; /* Assign to black the current address of inbyte */
- cyan = inbyte++;
- magenta = inbyte++;
- yellow = inbyte++;
-
- if (*magenta + *yellow + *cyan > 0) { /* if any color at all */
- is_color = 1;
-
- if ((*cyan >= *magenta) && (*magenta >= *yellow) && (*yellow > 0)) { /* if any grey component */
- DOGCR(cyan, magenta, yellow, black);
- } else if ((*cyan >= *yellow) && (*yellow >= *magenta) && (*magenta > 0)) {
- DOGCR(cyan, yellow, magenta, black);
- } else if ((*yellow >= *magenta) && (*magenta >= *cyan) && (*cyan > 0)) {
- DOGCR(yellow, magenta, cyan, black);
- } else if ((*yellow >= *cyan) && (*cyan >= *magenta) && (*magenta > 0)) {
- DOGCR(yellow, cyan, magenta, black);
- } else if ((*magenta >= *yellow) && (*yellow >= *cyan) && (*cyan > 0)) {
- DOGCR(magenta, yellow, cyan, black);
- } else if ((*magenta >= *cyan) && (*cyan >= *yellow) && (*yellow > 0)) {
- DOGCR(magenta, cyan, yellow, black);
- } else { /* do gamma only if no black */
- ;
- }
-
- *cyan = *(cvalues + *cyan);
- *magenta = *(mvalues + *magenta);
- *yellow = *(yvalues + *yellow);
- } /* end of if c+m+y > 0 */
-
- *black = *(kvalues + *black);
- } /* end of for bytecount */
-
- return (is_color);
+ int i, ucr, kadd, is_color = 0;
+ byte *black, *cyan, *magenta, *yellow;
+ float uca_fac;
+
+ /* Grey component replacement */
+ for (i = 0; i < bytecount; i += 4) {
+ black = inbyte++; /* Assign to black the current address of inbyte */
+ cyan = inbyte++;
+ magenta = inbyte++;
+ yellow = inbyte++;
+
+ if (*magenta + *yellow + *cyan > 0) { /* if any color at all */
+ is_color = 1;
+
+ if ((*cyan >= *magenta) && (*magenta >= *yellow) && (*yellow > 0)) { /* if any grey component */
+ DOGCR(cyan, magenta, yellow, black);
+ } else if ((*cyan >= *yellow) && (*yellow >= *magenta) && (*magenta > 0)) {
+ DOGCR(cyan, yellow, magenta, black);
+ } else if ((*yellow >= *magenta) && (*magenta >= *cyan) && (*cyan > 0)) {
+ DOGCR(yellow, magenta, cyan, black);
+ } else if ((*yellow >= *cyan) && (*cyan >= *magenta) && (*magenta > 0)) {
+ DOGCR(yellow, cyan, magenta, black);
+ } else if ((*magenta >= *yellow) && (*yellow >= *cyan) && (*cyan > 0)) {
+ DOGCR(magenta, yellow, cyan, black);
+ } else if ((*magenta >= *cyan) && (*cyan >= *yellow) && (*yellow > 0)) {
+ DOGCR(magenta, cyan, yellow, black);
+ } else { /* do gamma only if no black */
+ ;
+ }
+
+ *cyan = *(cvalues + *cyan);
+ *magenta = *(mvalues + *magenta);
+ *yellow = *(yvalues + *yellow);
+ } /* end of if c+m+y > 0 */
+
+ *black = *(kvalues + *black);
+ } /* end of for bytecount */
+
+ return (is_color);
}
-/* rescale_byte_wise2x2: Since resolution can be different on different planes,
+/* rescale_byte_wise2x2: Since resolution can be different on different planes,
* we need to rescale the data byte by byte
----------------------------------------------------------------------------------*/
-static int rescale_byte_wise2x2( int bytecount,
- const byte *inbytea,
- const byte *inbyteb,
- byte *outbyte)
+static int rescale_byte_wise2x2( int bytecount,
+ const byte *inbytea,
+ const byte *inbyteb,
+ byte *outbyte)
{
- register int i, j;
- int max = bytecount / 2;
-
- for (i = 0; i < max; i += 4) {
- j = 2 * i;
- /* cyan */
- outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5] + inbyteb[j + 1] + inbyteb[j + 5]) / 4;
-
- /* magenta */
- outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6] + inbyteb[j + 2] + inbyteb[j + 6]) / 4;
-
- /* yellow */
- outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7] + inbyteb[j + 3] + inbyteb[j + 7]) / 4;
- }
-
- return (max);
-}
+ register int i, j;
+ int max = bytecount / 2;
+
+ for (i = 0; i < max; i += 4) {
+ j = 2 * i;
+ /* cyan */
+ outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5] + inbyteb[j + 1] + inbyteb[j + 5]) / 4;
+
+ /* magenta */
+ outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6] + inbyteb[j + 2] + inbyteb[j + 6]) / 4;
+
+ /* yellow */
+ outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7] + inbyteb[j + 3] + inbyteb[j + 7]) / 4;
+ }
+ return (max);
+}
-/* rescale_byte_wise2x1: Since resolution can be different on different planes,
+/* rescale_byte_wise2x1: Since resolution can be different on different planes,
* we need to rescale the data byte by byte
----------------------------------------------------------------------------------*/
-static int rescale_byte_wise2x1( int bytecount,
- const byte *inbytea,
- const byte *inbyteb,
- byte *outbyte)
+static int rescale_byte_wise2x1( int bytecount,
+ const byte *inbytea,
+ const byte *inbyteb,
+ byte *outbyte)
{
- register int i, j;
- int max = bytecount / 2;
-
- for (i = 0; i < max; i += 4) {
- j = 2 * i;
-
- /* cyan */
- outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5]) / 2;
-
- /* magenta */
- outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6]) / 2;
-
- /* yellow */
- outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7]) / 2;
- }
-
- return (max);
+ register int i, j;
+ int max = bytecount / 2;
+
+ for (i = 0; i < max; i += 4) {
+ j = 2 * i;
+
+ /* cyan */
+ outbyte[i + 1] = (inbytea[j + 1] + inbytea[j + 5]) / 2;
+
+ /* magenta */
+ outbyte[i + 2] = (inbytea[j + 2] + inbytea[j + 6]) / 2;
+
+ /* yellow */
+ outbyte[i + 3] = (inbytea[j + 3] + inbytea[j + 7]) / 2;
+ }
+
+ return (max);
}
-/* rescale_byte_wise1x2: Since resolution can be different on different planes,
+/* rescale_byte_wise1x2: Since resolution can be different on different planes,
* we need to rescale the data byte by byte
----------------------------------------------------------------------------------*/
-static int rescale_byte_wise1x2( int bytecount,
- const byte *inbytea,
- const byte *inbyteb,
- byte *outbyte)
+static int rescale_byte_wise1x2( int bytecount,
+ const byte *inbytea,
+ const byte *inbyteb,
+ byte *outbyte)
{
- register int i;
-
- for (i = 0; i < bytecount; i += 4) {
- /* cyan */
- outbyte[i + 1] = (inbytea[i + 1] + inbyteb[i + 1]) / 2;
-
- /* magenta */
- outbyte[i + 2] = (inbytea[i + 2] + inbyteb[i + 2]) / 2;
-
- /* yellow */
- outbyte[i + 3] = (inbytea[i + 3] + inbyteb[i + 3]) / 2;
- }
-
- return bytecount;
+ register int i;
+
+ for (i = 0; i < bytecount; i += 4) {
+ /* cyan */
+ outbyte[i + 1] = (inbytea[i + 1] + inbyteb[i + 1]) / 2;
+
+ /* magenta */
+ outbyte[i + 2] = (inbytea[i + 2] + inbyteb[i + 2]) / 2;
+
+ /* yellow */
+ outbyte[i + 3] = (inbytea[i + 3] + inbyteb[i + 3]) / 2;
+ }
+
+ return bytecount;
}
-/* rescale_byte_wise1x1: Since resolution can be different on different planes,
+/* rescale_byte_wise1x1: Since resolution can be different on different planes,
* we need to rescale the data byte by byte
----------------------------------------------------------------------------------*/
-static int rescale_byte_wise1x1( int bytecount,
- const byte *inbytea,
- const byte *inbyteb,
- byte *outbyte)
+static int rescale_byte_wise1x1( int bytecount,
+ const byte *inbytea,
+ const byte *inbyteb,
+ byte *outbyte)
{
- register int i;
-
- for (i = 0; i < bytecount; i += 4) {
- /* cyan */
- outbyte[i + 1] = inbytea[i + 1];
-
- /* magenta */
- outbyte[i + 2] = inbytea[i + 2];
-
- /* yellow */
- outbyte[i + 3] = inbytea[i + 3];
- }
-
- return (bytecount);
+ register int i;
+
+ for (i = 0; i < bytecount; i += 4) {
+ /* cyan */
+ outbyte[i + 1] = inbytea[i + 1];
+
+ /* magenta */
+ outbyte[i + 2] = inbytea[i + 2];
+
+ /* yellow */
+ outbyte[i + 3] = inbytea[i + 3];
+ }
+
+ return (bytecount);
}
/* MACROS FOR DITHERING (we use macros for compact source and faster code) */
@@ -1465,802 +1441,792 @@ static int rescale_byte_wise1x1( int bytecount,
#define THRESHOLDM (192 << SHIFTM)
#define THRESHOLDL (226 << SHIFTM)
-
/* --------------------------- */
-/* init_error_buffer: initialise the error_buffer
+/* init_error_buffer: initialise the error_buffer
----------------------------------------------------------------------------------*/
static void init_error_buffer( struct misc_struct *misc_vars,
- struct ptr_arrays *data_ptrs)
+ struct ptr_arrays *data_ptrs)
{
- int i;
- int *ep;
- int *epc;
-
- ep = data_ptrs->errors[0];
- epc = data_ptrs->errors_c[0];
-
- if (misc_vars->bits_per_pixel > 4) { /* Randomly seed initial error buffer */
- /* Otherwise, the first dithered rows would look rather uniform */
- for (i = 0; i < misc_vars->databuff_size; i++) { /* 600dpi planes */
- *ep++ = RANDOM;
- }
-
- /* Now for the 2 * 300dpi color planes */
- for (i = 0; i < misc_vars->databuff_size_c; i++) {
- *epc++ = RANDOM;
- }
- }
-
- return;
+ int i;
+ int *ep;
+ int *epc;
+
+ ep = data_ptrs->errors[0];
+ epc = data_ptrs->errors_c[0];
+
+ if (misc_vars->bits_per_pixel > 4) { /* Randomly seed initial error buffer */
+ /* Otherwise, the first dithered rows would look rather uniform */
+ for (i = 0; i < misc_vars->databuff_size; i++) { /* 600dpi planes */
+ *ep++ = RANDOM;
+ }
+
+ /* Now for the 2 * 300dpi color planes */
+ for (i = 0; i < misc_vars->databuff_size_c; i++) {
+ *epc++ = RANDOM;
+ }
+ }
+
+ return;
}
-/* FSdither:
+/* FSdither:
----------------------------------------------------------------------------------*/
#define FSdither(inP, out, errP, Err, Bit, Offset, Element)\
{\
- oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int)*(inP + Element) << SHIFT));\
- if (Err > THRESHOLD) {\
- out |= Bit;\
- Err -= MAXVALUE;\
- }\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ oldErr = Err;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int)*(inP + Element) << SHIFT));\
+ if (Err > THRESHOLD) {\
+ out |= Bit;\
+ Err -= MAXVALUE;\
+ }\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
-
/* FSDlinebw: The hp970 has 600dpi black and 300 dpi color.
----------------------------------------------------------------------------------*/
-static void FSDlinebw( int scan,
- int plane_size,
- struct error_val_field *error_values,
- byte *kP,
- int n,
- int *ep,
- byte *dp)
+static void FSDlinebw( int scan,
+ int plane_size,
+ struct error_val_field *error_values,
+ byte *kP,
+ int n,
+ int *ep,
+ byte *dp)
{
- if (scan == 0) { /* going_up */
- byte k, bitmask; /* k = outbyte byte, whereas bitmask defines the
- bit to be set within k */
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
-
- for (k = 0; bitmask != 0; bitmask >>= 1) {
- /* dp points to the first word of the input data which is in kcmy-format */
- /* k points to the beginning of the first outbut byte, which
- is filled up, bit by bit while looping over bytemask */
- /* ep points to the first word of the error-plane which
- contains the errors kcmy format */
- /* err_values->k tempararily holds the error-value */
- /* bitmask selects the bit to be set in the outbyte */
- /* n gives the offset for the byte selection within
- words. With simple cmyk-printing, this should be 4 */
- /* 0 points to the active color within the input-word, i.e. 0
- = black, 1 = cyan, 2 = yellow, 3 = magenta */
-
- FSdither(dp, k, ep, error_values->k, bitmask, -n, 0);
- dp += n, ep += n; /* increment the input and error pointer one
- word (=4 byte) further, in order to
- convert the next word into an bit */
- }
- *kP++ = k; /* fill the output-plane byte with the computet byte
- and increment the output plane pointer one byte */
- }
- } else { /* going_down */
- byte k, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
-
- for (k = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither(dp, k, ep, error_values->k, bitmask, n, 0);
- }
- *--kP = k;
- }
- }
-
- return;
+ if (scan == 0) { /* going_up */
+ byte k, bitmask; /* k = outbyte byte, whereas bitmask defines the
+ bit to be set within k */
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+
+ for (k = 0; bitmask != 0; bitmask >>= 1) {
+ /* dp points to the first word of the input data which is in kcmy-format */
+ /* k points to the beginning of the first outbut byte, which
+ is filled up, bit by bit while looping over bytemask */
+ /* ep points to the first word of the error-plane which
+ contains the errors kcmy format */
+ /* err_values->k tempararily holds the error-value */
+ /* bitmask selects the bit to be set in the outbyte */
+ /* n gives the offset for the byte selection within
+ words. With simple cmyk-printing, this should be 4 */
+ /* 0 points to the active color within the input-word, i.e. 0
+ = black, 1 = cyan, 2 = yellow, 3 = magenta */
+
+ FSdither(dp, k, ep, error_values->k, bitmask, -n, 0);
+ dp += n, ep += n; /* increment the input and error pointer one
+ word (=4 byte) further, in order to
+ convert the next word into an bit */
+ }
+ *kP++ = k; /* fill the output-plane byte with the computet byte
+ and increment the output plane pointer one byte */
+ }
+ } else { /* going_down */
+ byte k, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+
+ for (k = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither(dp, k, ep, error_values->k, bitmask, n, 0);
+ }
+ *--kP = k;
+ }
+ }
+
+ return;
}
-
/* FSDlinec2: Since bw has already been dithered for the hp970c, we need
* an adapted dither algorythm
----------------------------------------------------------------------------------*/
-static void FSDlinec2( int scan,
- int plane_size,
- struct error_val_field *error_values,
- byte *cPa,
- byte *mPa,
- byte *yPa,
- int n,
- byte *dp,
- int *ep)
+static void FSDlinec2( int scan,
+ int plane_size,
+ struct error_val_field *error_values,
+ byte *cPa,
+ byte *mPa,
+ byte *yPa,
+ int n,
+ byte *dp,
+ int *ep)
{
- if (scan == 0) { /* going_up */
- int oldErr, i;
- byte ca, ya, ma, bitmask;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = 0;
-
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither(dp, ca, ep, error_values->c, bitmask, -n, n - 3);
- FSdither(dp, ma, ep, error_values->m, bitmask, -n, n - 2);
- FSdither(dp, ya, ep, error_values->y, bitmask, -n, n - 1);
- dp += n, ep += n;
- }
-
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- }
- } else { /* going_down */
- byte ca, ya, ma, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = 0;
-
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither(dp, ya, ep, error_values->y, bitmask, n, n - 1);
- FSdither(dp, ma, ep, error_values->m, bitmask, n, n - 2);
- FSdither(dp, ca, ep, error_values->c, bitmask, n, n - 3);
- }
-
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- }
- }
-
- return;
+ if (scan == 0) { /* going_up */
+ int oldErr, i;
+ byte ca, ya, ma, bitmask;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = 0;
+
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither(dp, ca, ep, error_values->c, bitmask, -n, n - 3);
+ FSdither(dp, ma, ep, error_values->m, bitmask, -n, n - 2);
+ FSdither(dp, ya, ep, error_values->y, bitmask, -n, n - 1);
+ dp += n, ep += n;
+ }
+
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ }
+ } else { /* going_down */
+ byte ca, ya, ma, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = 0;
+
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither(dp, ya, ep, error_values->y, bitmask, n, n - 1);
+ FSdither(dp, ma, ep, error_values->m, bitmask, n, n - 2);
+ FSdither(dp, ca, ep, error_values->c, bitmask, n, n - 3);
+ }
+
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ }
+ }
+
+ return;
}
-
/* FSdither9703: while printing on paper, we only use 3 -intensities
----------------------------------------------------------------------------------*/
#define FSdither9703(inP, outa, outb, errP, Err, Bit, Offset, Element)\
{\
- oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int) *(inP + Element) << SHIFT));\
- if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
- outa |= Bit;\
- Err -= MAXVALUES;\
- }\
- if (Err > THRESHOLDM) {\
- outb |= Bit;\
- Err -= MAXVALUEM;\
- }\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ oldErr = Err;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int) *(inP + Element) << SHIFT));\
+ if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
+ outa |= Bit;\
+ Err -= MAXVALUES;\
+ }\
+ if (Err > THRESHOLDM) {\
+ outb |= Bit;\
+ Err -= MAXVALUEM;\
+ }\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
-
/* FSDlinec3: On ordinary paper, we'll only use 3 intensities with the hp970
----------------------------------------------------------------------------------*/
-static void FSDlinec3( int scan,
- int plane_size,
- struct error_val_field *error_values,
- byte *cPa,
- byte *mPa,
- byte *yPa,
- byte *cPb,
- byte *mPb,
- byte *yPb,
- int n,
- byte *dp,
- int *ep)
+static void FSDlinec3( int scan,
+ int plane_size,
+ struct error_val_field *error_values,
+ byte *cPa,
+ byte *mPa,
+ byte *yPa,
+ byte *cPb,
+ byte *mPb,
+ byte *yPb,
+ int n,
+ byte *dp,
+ int *ep)
{
- if (scan == 0) { /* going_up */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = cb = yb = mb = 0;
-
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither9703(dp, ca, cb, ep, error_values->c, bitmask, -n, n - 3);
- FSdither9703(dp, ma, mb, ep, error_values->m, bitmask, -n, n - 2);
- FSdither9703(dp, ya, yb, ep, error_values->y, bitmask, -n, n - 1);
- dp += n, ep += n;
- }
-
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- *cPb++ = cb;
- *mPb++ = mb;
- *yPb++ = yb;
- }
- } else { /* going_down */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = cb = yb = mb = 0;
-
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither9703(dp, ya, yb, ep, error_values->y, bitmask, n, n - 1);
- FSdither9703(dp, ma, mb, ep, error_values->m, bitmask, n, n - 2);
- FSdither9703(dp, ca, cb, ep, error_values->c, bitmask, n, n - 3);
- }
-
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- *--yPb = yb;
- *--mPb = mb;
- *--cPb = cb;
- }
- }
-
- return;
+ if (scan == 0) { /* going_up */
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = cb = yb = mb = 0;
+
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither9703(dp, ca, cb, ep, error_values->c, bitmask, -n, n - 3);
+ FSdither9703(dp, ma, mb, ep, error_values->m, bitmask, -n, n - 2);
+ FSdither9703(dp, ya, yb, ep, error_values->y, bitmask, -n, n - 1);
+ dp += n, ep += n;
+ }
+
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ *cPb++ = cb;
+ *mPb++ = mb;
+ *yPb++ = yb;
+ }
+ } else { /* going_down */
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = cb = yb = mb = 0;
+
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither9703(dp, ya, yb, ep, error_values->y, bitmask, n, n - 1);
+ FSdither9703(dp, ma, mb, ep, error_values->m, bitmask, n, n - 2);
+ FSdither9703(dp, ca, cb, ep, error_values->c, bitmask, n, n - 3);
+ }
+
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ *--yPb = yb;
+ *--mPb = mb;
+ *--cPb = cb;
+ }
+ }
+
+ return;
}
-
/* FSdither9704: the hp970 knows about 4 different color intensities per color
----------------------------------------------------------------------------------*/
#define FSdither9704(inP, outa, outb, errP, Err, Bit, Offset, Element)\
{\
- oldErr = Err;\
- Err = (*(errP + Element)\
- + ((Err * 7 + C) >> 4)\
- + ((int) *(inP + Element) << SHIFT));\
- if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
- outa |= Bit;\
- Err -= MAXVALUES;\
- }\
- if ((Err > THRESHOLDM) && (Err <= THRESHOLDL)) {\
- outb |= Bit;\
- Err -= MAXVALUEM;\
- }\
- if (Err > THRESHOLDL) {\
+ oldErr = Err;\
+ Err = (*(errP + Element)\
+ + ((Err * 7 + C) >> 4)\
+ + ((int) *(inP + Element) << SHIFT));\
+ if ((Err > THRESHOLDS) && (Err <= THRESHOLDM)) {\
outa |= Bit;\
- outb |= Bit;\
- Err -= MAXVALUEL;\
- }\
- *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
- *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
+ Err -= MAXVALUES;\
+ }\
+ if ((Err > THRESHOLDM) && (Err <= THRESHOLDL)) {\
+ outb |= Bit;\
+ Err -= MAXVALUEM;\
+ }\
+ if (Err > THRESHOLDL) {\
+ outa |= Bit;\
+ outb |= Bit;\
+ Err -= MAXVALUEL;\
+ }\
+ *(errP + (Element + Offset)) += ((Err * 3 + C) >> 4);\
+ *(errP + Element) = ((Err * 5 + oldErr + C) >> 4);\
}
-
-/* FSDlinec4: The hp970c knows about 4 intensity levels per color. Once more,
+/* FSDlinec4: The hp970c knows about 4 intensity levels per color. Once more,
* we need an adapted dither algorythm
----------------------------------------------------------------------------------*/
-static void FSDlinec4( int scan,
- int plane_size,
- struct error_val_field *error_values,
- byte *cPa,
- byte *mPa,
- byte *yPa,
- byte *cPb,
- byte *mPb,
- byte *yPb,
- int n,
- byte *dp,
- int *ep)
+static void FSDlinec4( int scan,
+ int plane_size,
+ struct error_val_field *error_values,
+ byte *cPa,
+ byte *mPa,
+ byte *yPa,
+ byte *cPb,
+ byte *mPb,
+ byte *yPb,
+ int n,
+ byte *dp,
+ int *ep)
{
- if (scan == 0) { /* going_up */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x80;
- ca = ya = ma = cb = yb = mb = 0;
-
- for (ca = 0; bitmask != 0; bitmask >>= 1) {
- FSdither9704(dp, ca, cb, ep, error_values->c, bitmask, -n, n - 3);
- FSdither9704(dp, ma, mb, ep, error_values->m, bitmask, -n, n - 2);
- FSdither9704(dp, ya, yb, ep, error_values->y, bitmask, -n, n - 1);
- dp += n, ep += n;
-
- }
-
- *cPa++ = ca;
- *mPa++ = ma;
- *yPa++ = ya;
- *cPb++ = cb;
- *mPb++ = mb;
- *yPb++ = yb;
- }
- } else { /* going_down */
- byte ca, ya, ma, cb, yb, mb, bitmask;
- int oldErr, i;
-
- for (i = 0; i < plane_size; i++) {
- bitmask = 0x01;
- ca = ya = ma = cb = yb = mb = 0;
-
- for (ca = 0; bitmask != 0; bitmask <<= 1) {
- dp -= n, ep -= n;
- FSdither9704(dp, ya, yb, ep, error_values->y, bitmask, n, n - 1);
- FSdither9704(dp, ma, mb, ep, error_values->m, bitmask, n, n - 2);
- FSdither9704(dp, ca, cb, ep, error_values->c, bitmask, n, n - 3);
- }
- *--yPa = ya;
- *--mPa = ma;
- *--cPa = ca;
- *--yPb = yb;
- *--mPb = mb;
- *--cPb = cb;
- }
- }
-
- return;
+ if (scan == 0) { /* going_up */
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x80;
+ ca = ya = ma = cb = yb = mb = 0;
+
+ for (ca = 0; bitmask != 0; bitmask >>= 1) {
+ FSdither9704(dp, ca, cb, ep, error_values->c, bitmask, -n, n - 3);
+ FSdither9704(dp, ma, mb, ep, error_values->m, bitmask, -n, n - 2);
+ FSdither9704(dp, ya, yb, ep, error_values->y, bitmask, -n, n - 1);
+ dp += n, ep += n;
+
+ }
+
+ *cPa++ = ca;
+ *mPa++ = ma;
+ *yPa++ = ya;
+ *cPb++ = cb;
+ *mPb++ = mb;
+ *yPb++ = yb;
+ }
+ } else { /* going_down */
+ byte ca, ya, ma, cb, yb, mb, bitmask;
+ int oldErr, i;
+
+ for (i = 0; i < plane_size; i++) {
+ bitmask = 0x01;
+ ca = ya = ma = cb = yb = mb = 0;
+
+ for (ca = 0; bitmask != 0; bitmask <<= 1) {
+ dp -= n, ep -= n;
+ FSdither9704(dp, ya, yb, ep, error_values->y, bitmask, n, n - 1);
+ FSdither9704(dp, ma, mb, ep, error_values->m, bitmask, n, n - 2);
+ FSdither9704(dp, ca, cb, ep, error_values->c, bitmask, n, n - 3);
+ }
+ *--yPa = ya;
+ *--mPa = ma;
+ *--cPa = ca;
+ *--yPb = yb;
+ *--mPb = mb;
+ *--cPb = cb;
+ }
+ }
+
+ return;
}
/* calculate_memory_size: calculate the needed memory
----------------------------------------------------------------------------------*/
static void calculate_memory_size( gx_device_printer *pdev,
- struct misc_struct *misc_vars)
+ struct misc_struct *misc_vars)
{
- int xfac = cdj970->xscal ? 2 : 1;
-
- misc_vars->line_size = gdev_prn_raster(pdev);
- misc_vars->line_size_c = misc_vars->line_size / xfac;
- misc_vars->line_size_words = (misc_vars->line_size + W - 1) / W;
- misc_vars->paper_size = gdev_pcl_paper_size((gx_device *) pdev);
- misc_vars->num_comps = pdev->color_info.num_components;
- misc_vars->bits_per_pixel = pdev->color_info.depth;
- misc_vars->storage_bpp = misc_vars->num_comps * 8;
- misc_vars->expanded_bpp = misc_vars->num_comps * 8;
- misc_vars->errbuff_size = 0;
- misc_vars->errbuff_size_c = 0;
-
- misc_vars->plane_size = calc_buffsize(misc_vars->line_size, misc_vars->storage_bpp);
-
- /* plane_size_c is dependedend on the bits used for
- dithering. Currently 2 bits are sufficient */
- misc_vars->plane_size_c = 2 * misc_vars->plane_size / xfac;
-
- /* 4n extra values for line ends */
- /* might be wrong, see gdevcdj.c */
- misc_vars->errbuff_size =
- calc_buffsize((misc_vars->plane_size * misc_vars->expanded_bpp +
- misc_vars->num_comps * 4) * I, 1);
-
- /* 4n extra values for line ends */
- misc_vars->errbuff_size_c =
- calc_buffsize((misc_vars->plane_size_c / 2 * misc_vars->expanded_bpp
- + misc_vars->num_comps * 4) * I, 1);
-
- misc_vars->databuff_size =
- misc_vars->plane_size * misc_vars->storage_bpp;
-
- misc_vars->databuff_size_c =
- misc_vars->plane_size_c / 2 * misc_vars->storage_bpp;
-
-
- misc_vars->outbuff_size = misc_vars->plane_size * 4;
-
- misc_vars->storage_size_words = (((misc_vars->plane_size) * 2
- * misc_vars->num_comps)
- + misc_vars->databuff_size
- + misc_vars->errbuff_size
- + misc_vars->outbuff_size
- + ((misc_vars->plane_size_c)
- * 2
- * misc_vars->num_comps)
- + misc_vars->databuff_size_c
- + misc_vars->errbuff_size_c
- + (4 * misc_vars->plane_size_c))
- / W;
-
- return;
+ int xfac = cdj970->xscal ? 2 : 1;
+
+ misc_vars->line_size = gdev_prn_raster(pdev);
+ misc_vars->line_size_c = misc_vars->line_size / xfac;
+ misc_vars->line_size_words = (misc_vars->line_size + W - 1) / W;
+ misc_vars->paper_size = gdev_pcl_paper_size((gx_device *) pdev);
+ misc_vars->num_comps = pdev->color_info.num_components;
+ misc_vars->bits_per_pixel = pdev->color_info.depth;
+ misc_vars->storage_bpp = misc_vars->num_comps * 8;
+ misc_vars->expanded_bpp = misc_vars->num_comps * 8;
+ misc_vars->errbuff_size = 0;
+ misc_vars->errbuff_size_c = 0;
+
+ misc_vars->plane_size = calc_buffsize(misc_vars->line_size, misc_vars->storage_bpp);
+
+ /* plane_size_c is dependedend on the bits used for
+ dithering. Currently 2 bits are sufficient */
+ misc_vars->plane_size_c = 2 * misc_vars->plane_size / xfac;
+
+ /* 4n extra values for line ends */
+ /* might be wrong, see gdevcdj.c */
+ misc_vars->errbuff_size =
+ calc_buffsize((misc_vars->plane_size * misc_vars->expanded_bpp +
+ misc_vars->num_comps * 4) * I, 1);
+
+ /* 4n extra values for line ends */
+ misc_vars->errbuff_size_c =
+ calc_buffsize((misc_vars->plane_size_c / 2 * misc_vars->expanded_bpp
+ + misc_vars->num_comps * 4) * I, 1);
+
+ misc_vars->databuff_size =
+ misc_vars->plane_size * misc_vars->storage_bpp;
+
+ misc_vars->databuff_size_c =
+ misc_vars->plane_size_c / 2 * misc_vars->storage_bpp;
+
+ misc_vars->outbuff_size = misc_vars->plane_size * 4;
+
+ misc_vars->storage_size_words = (((misc_vars->plane_size) * 2
+ * misc_vars->num_comps)
+ + misc_vars->databuff_size
+ + misc_vars->errbuff_size
+ + misc_vars->outbuff_size
+ + ((misc_vars->plane_size_c)
+ * 2
+ * misc_vars->num_comps)
+ + misc_vars->databuff_size_c
+ + misc_vars->errbuff_size_c
+ + (4 * misc_vars->plane_size_c))
+ / W;
+
+ return;
}
/* init_data_structure: Initialise the needed pointers
----------------------------------------------------------------------------------*/
static void init_data_structure( gx_device_printer *pdev,
- struct ptr_arrays *data_ptrs,
- struct misc_struct *misc_vars)
+ struct ptr_arrays *data_ptrs,
+ struct misc_struct *misc_vars)
{
- int i;
- byte *p = (byte *) data_ptrs->storage;
-
- misc_vars->scan = 0;
- misc_vars->cscan = 0;
- misc_vars->is_two_pass = 1;
-
- /* the b/w pointer */
- data_ptrs->data[0] = data_ptrs->data[1] = data_ptrs->data[2] = p;
- data_ptrs->data[3] = p + misc_vars->databuff_size;
- /* Note: The output data will overwrite part of the input-data */
-
- if (misc_vars->bits_per_pixel > 1) {
- p += misc_vars->databuff_size;
- }
-
- if (misc_vars->bits_per_pixel > 4) {
- data_ptrs->errors[0] = (int *)p + misc_vars->num_comps * 2;
- data_ptrs->errors[1] = data_ptrs->errors[0] + misc_vars->databuff_size;
- p += misc_vars->errbuff_size;
- }
-
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data[0][i] = data_ptrs->plane_data[2][i] = p;
- p += misc_vars->plane_size;
- }
-
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data[1][i] = p;
- data_ptrs->plane_data[3][i] = p + misc_vars->plane_size;
- p += misc_vars->plane_size;
- }
-
- data_ptrs->out_data = p;
- p += misc_vars->outbuff_size;
-
- /* ---------------------------------------------------------
- now for the color pointers
- --------------------------------------------------------- */
-
- data_ptrs->data_c[0] = data_ptrs->data_c[1] = data_ptrs->data_c[2] = p;
- data_ptrs->data_c[3] = p + misc_vars->databuff_size_c;
- /* Note: The output data will overwrite part of the input-data */
-
- if (misc_vars->bits_per_pixel > 1) {
- p += misc_vars->databuff_size_c;
- }
-
- if (misc_vars->bits_per_pixel > 4) {
- data_ptrs->errors_c[0] = (int *)p + misc_vars->num_comps * 2;
- data_ptrs->errors_c[1] = data_ptrs->errors_c[0] + misc_vars->databuff_size_c;
- p += misc_vars->errbuff_size_c;
- }
-
- /* pointer for the lower bits of the output data */
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[0][i] = data_ptrs->plane_data_c[2][i] = p;
- p += misc_vars->plane_size_c / 2;
- }
-
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[1][i] = p;
- data_ptrs->plane_data_c[3][i] = p + misc_vars->plane_size_c / 2;
- p += misc_vars->plane_size_c / 2;
- }
-
- /* pointer for the upper bits of the output data */
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[0][i + 4] = data_ptrs->plane_data_c[2][i + 4] = p;
- p += misc_vars->plane_size_c / 2;
- }
-
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->plane_data_c[1][i + 4] = p;
- data_ptrs->plane_data_c[3][i + 4] = p + misc_vars->plane_size_c / 2;
- p += misc_vars->plane_size_c / 2;
- }
-
- for (i = 0; i < misc_vars->num_comps; i++) {
- data_ptrs->test_data[i] = p;
- p += misc_vars->plane_size_c / 2;
- }
-
- /* Clear temp storage */
- memset(data_ptrs->storage, 0, misc_vars->storage_size_words * W);
-
- return;
-}
-
-
-/* cdj970_start_raster_mode: Configure the printer and start Raster mode
+ int i;
+ byte *p = (byte *) data_ptrs->storage;
+
+ misc_vars->scan = 0;
+ misc_vars->cscan = 0;
+ misc_vars->is_two_pass = 1;
+
+ /* the b/w pointer */
+ data_ptrs->data[0] = data_ptrs->data[1] = data_ptrs->data[2] = p;
+ data_ptrs->data[3] = p + misc_vars->databuff_size;
+ /* Note: The output data will overwrite part of the input-data */
+
+ if (misc_vars->bits_per_pixel > 1) {
+ p += misc_vars->databuff_size;
+ }
+
+ if (misc_vars->bits_per_pixel > 4) {
+ data_ptrs->errors[0] = (int *)p + misc_vars->num_comps * 2;
+ data_ptrs->errors[1] = data_ptrs->errors[0] + misc_vars->databuff_size;
+ p += misc_vars->errbuff_size;
+ }
+
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data[0][i] = data_ptrs->plane_data[2][i] = p;
+ p += misc_vars->plane_size;
+ }
+
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data[1][i] = p;
+ data_ptrs->plane_data[3][i] = p + misc_vars->plane_size;
+ p += misc_vars->plane_size;
+ }
+
+ data_ptrs->out_data = p;
+ p += misc_vars->outbuff_size;
+
+ /* ---------------------------------------------------------
+ now for the color pointers
+ --------------------------------------------------------- */
+
+ data_ptrs->data_c[0] = data_ptrs->data_c[1] = data_ptrs->data_c[2] = p;
+ data_ptrs->data_c[3] = p + misc_vars->databuff_size_c;
+ /* Note: The output data will overwrite part of the input-data */
+
+ if (misc_vars->bits_per_pixel > 1) {
+ p += misc_vars->databuff_size_c;
+ }
+
+ if (misc_vars->bits_per_pixel > 4) {
+ data_ptrs->errors_c[0] = (int *)p + misc_vars->num_comps * 2;
+ data_ptrs->errors_c[1] = data_ptrs->errors_c[0] + misc_vars->databuff_size_c;
+ p += misc_vars->errbuff_size_c;
+ }
+
+ /* pointer for the lower bits of the output data */
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data_c[0][i] = data_ptrs->plane_data_c[2][i] = p;
+ p += misc_vars->plane_size_c / 2;
+ }
+
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data_c[1][i] = p;
+ data_ptrs->plane_data_c[3][i] = p + misc_vars->plane_size_c / 2;
+ p += misc_vars->plane_size_c / 2;
+ }
+
+ /* pointer for the upper bits of the output data */
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data_c[0][i + 4] = data_ptrs->plane_data_c[2][i + 4] = p;
+ p += misc_vars->plane_size_c / 2;
+ }
+
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->plane_data_c[1][i + 4] = p;
+ data_ptrs->plane_data_c[3][i + 4] = p + misc_vars->plane_size_c / 2;
+ p += misc_vars->plane_size_c / 2;
+ }
+
+ for (i = 0; i < misc_vars->num_comps; i++) {
+ data_ptrs->test_data[i] = p;
+ p += misc_vars->plane_size_c / 2;
+ }
+
+ /* Clear temp storage */
+ memset(data_ptrs->storage, 0, misc_vars->storage_size_words * W);
+
+ return;
+}
+
+/* cdj970_start_raster_mode: Configure the printer and start Raster mode
----------------------------------------------------------------------------------*/
-static void cdj970_start_raster_mode( gx_device_printer *pdev,
- int paper_size,
- FILE *prn_stream)
+static void cdj970_start_raster_mode( gx_device_printer *pdev,
+ int paper_size,
+ FILE *prn_stream)
{
- int xres, yres; /* x,y resolution for color planes */
- hp970_cmyk_init_t init;
-
- init = hp970_cmyk_init;
-
- init.a[13] = cdj970->intensities; /* Intensity levels cyan */
- init.a[19] = cdj970->intensities; /* Intensity levels magenta */
- init.a[25] = cdj970->intensities; /* Intensity levels yellow */
-
- /* black plane resolution */
- assign_dpi(cdj970->x_pixels_per_inch, init.a + 2);
- assign_dpi(cdj970->y_pixels_per_inch, init.a + 4);
-
- /* color plane resolution */
- xres = cdj970->x_pixels_per_inch / (cdj970->xscal + 1);
- yres = cdj970->y_pixels_per_inch / (cdj970->yscal + 1);
-
- /* cyan */
- assign_dpi(xres, init.a + 8);
- assign_dpi(yres, init.a + 10);
-
- /* magenta */
- assign_dpi(xres, init.a + 14);
- assign_dpi(yres, init.a + 16);
-
- /* yellow */
- assign_dpi(xres, init.a + 20);
- assign_dpi(yres, init.a + 22);
-
- /* Page size, orientation, top margin & perforation skip */
- fprintf(prn_stream, "\033&l%dA", paper_size);
-
- /* Print Quality, -1 = draft, 0 = normal, 1 = presentation */
- fprintf(prn_stream, "\033*o%dM", cdj970->quality);
-
- /* Media Type,0 = plain paper, 1 = bond paper, 2 = special
- paper, 3 = glossy film, 4 = transparency film */
- fprintf(prn_stream, "\033&l%dM", cdj970->papertype);
-
- fprintf (prn_stream, "\033u%dD\033&l0e0L", xres);
-
- /* fputs("\033u%dD\033&l0e0L", prn_stream); */
-
- fprintf(prn_stream, "\033*p%dY", (int)(600 * DOFFSET));
-
- /* This will start and configure the raster-mode */
- fprintf(prn_stream, "\033*g%dW", (int)sizeof(init.a)); /* The new configure
- raster data comand */
- fwrite(init.a, sizeof(byte), sizeof(init.a), prn_stream); /* Transmit config
- data */
- fputs("\033&l0H", prn_stream);
- fputs("\033*r1A", prn_stream);
- /* From now on, all escape commands start with \033*b, so we
- * combine them (if the printer supports this). */
- fputs("\033*b", prn_stream);
-
- /* Set compression if the mode has been defined. */
- if (cdj970->compression)
- fprintf(prn_stream, "%dm", cdj970->compression);
-
- return;
-}
-
-/* cdj_put_param_int:
+ int xres, yres; /* x,y resolution for color planes */
+ hp970_cmyk_init_t init;
+
+ init = hp970_cmyk_init;
+
+ init.a[13] = cdj970->intensities; /* Intensity levels cyan */
+ init.a[19] = cdj970->intensities; /* Intensity levels magenta */
+ init.a[25] = cdj970->intensities; /* Intensity levels yellow */
+
+ /* black plane resolution */
+ assign_dpi(cdj970->x_pixels_per_inch, init.a + 2);
+ assign_dpi(cdj970->y_pixels_per_inch, init.a + 4);
+
+ /* color plane resolution */
+ xres = cdj970->x_pixels_per_inch / (cdj970->xscal + 1);
+ yres = cdj970->y_pixels_per_inch / (cdj970->yscal + 1);
+
+ /* cyan */
+ assign_dpi(xres, init.a + 8);
+ assign_dpi(yres, init.a + 10);
+
+ /* magenta */
+ assign_dpi(xres, init.a + 14);
+ assign_dpi(yres, init.a + 16);
+
+ /* yellow */
+ assign_dpi(xres, init.a + 20);
+ assign_dpi(yres, init.a + 22);
+
+ /* Page size, orientation, top margin & perforation skip */
+ fprintf(prn_stream, "\033&l%dA", paper_size);
+
+ /* Print Quality, -1 = draft, 0 = normal, 1 = presentation */
+ fprintf(prn_stream, "\033*o%dM", cdj970->quality);
+
+ /* Media Type,0 = plain paper, 1 = bond paper, 2 = special
+ paper, 3 = glossy film, 4 = transparency film */
+ fprintf(prn_stream, "\033&l%dM", cdj970->papertype);
+
+ fprintf (prn_stream, "\033u%dD\033&l0e0L", xres);
+
+ /* fputs("\033u%dD\033&l0e0L", prn_stream); */
+
+ fprintf(prn_stream, "\033*p%dY", (int)(600 * DOFFSET));
+
+ /* This will start and configure the raster-mode */
+ fprintf(prn_stream, "\033*g%dW", (int)sizeof(init.a)); /* The new configure
+ raster data comand */
+ fwrite(init.a, sizeof(byte), sizeof(init.a), prn_stream); /* Transmit config
+ data */
+ fputs("\033&l0H", prn_stream);
+ fputs("\033*r1A", prn_stream);
+ /* From now on, all escape commands start with \033*b, so we
+ * combine them (if the printer supports this). */
+ fputs("\033*b", prn_stream);
+
+ /* Set compression if the mode has been defined. */
+ if (cdj970->compression)
+ fprintf(prn_stream, "%dm", cdj970->compression);
+
+ return;
+}
+
+/* cdj_put_param_int:
----------------------------------------------------------------------------------*/
-static int cdj_put_param_int( gs_param_list *plist,
- gs_param_name pname,
- int *pvalue,
- int minval,
- int maxval,
- int ecode)
+static int cdj_put_param_int( gs_param_list *plist,
+ gs_param_name pname,
+ int *pvalue,
+ int minval,
+ int maxval,
+ int ecode)
{
- int code, value;
-
- switch (code = param_read_int(plist, pname, &value)) {
- default:
- return code;
-
- case 1:
- return ecode;
-
- case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
- }
+ int code, value;
+
+ switch (code = param_read_int(plist, pname, &value)) {
+ default:
+ return code;
+
+ case 1:
+ return ecode;
+
+ case 0:
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
+ }
}
-/* cdj_put_param_float:
+/* cdj_put_param_float:
----------------------------------------------------------------------------------*/
-static int cdj_put_param_float( gs_param_list *plist,
- gs_param_name pname,
- float *pvalue,
- float minval,
- float maxval,
- int ecode)
+static int cdj_put_param_float( gs_param_list *plist,
+ gs_param_name pname,
+ float *pvalue,
+ float minval,
+ float maxval,
+ int ecode)
{
- int code;
- float value;
-
- switch (code = param_read_float(plist, pname, &value)) {
- default:
- return code;
-
- case 1:
- return ecode;
-
- case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
- }
+ int code;
+ float value;
+
+ switch (code = param_read_float(plist, pname, &value)) {
+ default:
+ return code;
+
+ case 1:
+ return ecode;
+
+ case 0:
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
+ }
}
-/* cdj_set_bpp:
+/* cdj_set_bpp:
----------------------------------------------------------------------------------*/
static int cdj_set_bpp(gx_device * pdev, int bpp, int ccomps)
{
- gx_device_color_info *ci = &pdev->color_info;
-
- if (ccomps && bpp == 0) {
- if (cprn_device->cmyk) {
- switch (ccomps) {
-
- default:
- return gs_error_rangecheck;
- /*NOTREACHED */
- break;
-
- case 1:
- bpp = 1;
- break;
-
- case 3:
- bpp = 24;
- break;
-
- case 4:
- switch (ci->depth) {
- case 8:
- case 16:
- case 24:
- case 32:
- break;
-
- default:
- bpp = cprn_device->default_depth;
- break;
- }
- break;
- }
- }
- }
-
- if (bpp == 0) {
- bpp = ci->depth; /* Use the current setting. */
- }
-
- if (cprn_device->cmyk < 0) {
- /* Reset procedures because we may have been in another mode. */
- dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
- dev_proc(pdev, map_rgb_color) = NULL;
- dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
-
- if (pdev->is_open)
- gs_closedevice(pdev);
+ gx_device_color_info *ci = &pdev->color_info;
+
+ if (ccomps && bpp == 0) {
+ if (cprn_device->cmyk) {
+ switch (ccomps) {
+
+ default:
+ return gs_error_rangecheck;
+ /*NOTREACHED */
+ break;
+
+ case 1:
+ bpp = 1;
+ break;
+
+ case 3:
+ bpp = 24;
+ break;
+
+ case 4:
+ switch (ci->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
+ bpp = cprn_device->default_depth;
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ if (bpp == 0) {
+ bpp = ci->depth; /* Use the current setting. */
+ }
+
+ if (cprn_device->cmyk < 0) {
+ /* Reset procedures because we may have been in another mode. */
+ dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
+ dev_proc(pdev, map_rgb_color) = NULL;
+ dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
+
+ if (pdev->is_open)
+ gs_closedevice(pdev);
}
/* Check for valid bpp values */
switch (bpp) {
- case 16:
- case 32:
- if (cprn_device->cmyk && ccomps && ccomps != 4)
- goto bppe;
- break;
-
- case 24:
- if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
- break;
- } else if (ccomps == 1) {
- goto bppe;
- } else {
- /* 3 components 24 bpp printing for CMYK device. */
- cprn_device->cmyk = -1;
- }
- break;
-
- case 8:
- if (cprn_device->cmyk) {
- if (ccomps) {
- if (ccomps == 3) {
- cprn_device->cmyk = -1;
- bpp = 3;
- } else if (ccomps != 1 && ccomps != 4) {
- goto bppe;
- }
- }
-
- if (ccomps != 1)
- break;
- } else {
- break;
- }
- case 1:
- if (ccomps != 1)
- goto bppe;
-
- if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
-
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
- }
- break;
-
- case 3:
- if (!cprn_device->cmyk) {
- break;
- }
- default:
- bppe:return gs_error_rangecheck;
+ case 16:
+ case 32:
+ if (cprn_device->cmyk && ccomps && ccomps != 4)
+ goto bppe;
+ break;
+
+ case 24:
+ if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
+ break;
+ } else if (ccomps == 1) {
+ goto bppe;
+ } else {
+ /* 3 components 24 bpp printing for CMYK device. */
+ cprn_device->cmyk = -1;
+ }
+ break;
+
+ case 8:
+ if (cprn_device->cmyk) {
+ if (ccomps) {
+ if (ccomps == 3) {
+ cprn_device->cmyk = -1;
+ bpp = 3;
+ } else if (ccomps != 1 && ccomps != 4) {
+ goto bppe;
+ }
+ }
+
+ if (ccomps != 1)
+ break;
+ } else {
+ break;
+ }
+ case 1:
+ if (ccomps != 1)
+ goto bppe;
+
+ if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
+
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
+ }
+ break;
+
+ case 3:
+ if (!cprn_device->cmyk) {
+ break;
+ }
+ default:
+ bppe:return gs_error_rangecheck;
}
-
if (cprn_device->cmyk == -1) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
}
-
+
switch (ccomps) {
- case 0:
- break;
-
- case 1:
- if (bpp != 1 && bpp != 8)
- goto cce;
- break;
-
- case 4:
- if (cprn_device->cmyk) {
- if (bpp >= 8)
- break;
- }
-
- case 3:
- if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16 || bpp == 24 || bpp == 32) {
- break;
- }
-
- cce:
- default:
- return gs_error_rangecheck;
+ case 0:
+ break;
+
+ case 1:
+ if (bpp != 1 && bpp != 8)
+ goto cce;
+ break;
+
+ case 4:
+ if (cprn_device->cmyk) {
+ if (bpp >= 8)
+ break;
+ }
+
+ case 3:
+ if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16 || bpp == 24 || bpp == 32) {
+ break;
+ }
+
+ cce:
+ default:
+ return gs_error_rangecheck;
}
if (cprn_device->cmyk) {
- if (cprn_device->cmyk > 0) {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
- } else {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
- }
-
- if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
- bpp = bpp < 8 ? 8 : bpp;
- }
-
- ci->max_color = (1 << (bpp >> 2)) - 1;
- ci->max_gray = (bpp >= 8 ? 255 : 1);
-
- if (ci->num_components == 1) {
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- } else {
- ci->dither_grays = (bpp > 8 ? 5 : 2);
- ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
- }
- } else {
- ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
- ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
- ci->max_gray = (bpp >= 8 ? 255 : 1);
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- }
-
- ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
-
- return (0);
+ if (cprn_device->cmyk > 0) {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
+ } else {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
+ }
+
+ if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
+ bpp = bpp < 8 ? 8 : bpp;
+ }
+
+ ci->max_color = (1 << (bpp >> 2)) - 1;
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+
+ if (ci->num_components == 1) {
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ } else {
+ ci->dither_grays = (bpp > 8 ? 5 : 2);
+ ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
+ }
+ } else {
+ ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
+ ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ }
+
+ ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
+
+ return (0);
}
/*
@@ -2289,132 +2255,130 @@ static int cdj_set_bpp(gx_device * pdev, int bpp, int ccomps)
(m) = gx_bits_to_color_value(((v) >> (b)) & ((1 << (b)) - 1), (b)), \
(y) = gx_bits_to_color_value((v) & ((1 << (b)) - 1), (b))
-/* gdev_cmyk_map_cmyk_color:
+/* gdev_cmyk_map_cmyk_color:
----------------------------------------------------------------------------------*/
static gx_color_index gdev_cmyk_map_cmyk_color(gx_device * pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
- gx_color_index color;
- gx_color_value cyan, magenta, yellow, black;
-
- cyan = cv[0]; magenta = cv[1]; yellow = cv[2]; black = cv[3];
- switch (pdev->color_info.depth) {
- case 1:
- color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
- ( gx_color_index) 1 : (gx_color_index) 0;
- break;
-
- default:{
- int nbits = pdev->color_info.depth;
-
- if (cyan == magenta && magenta == yellow) {
- /* Convert CMYK to gray -- Red Book 6.2.2 */
- float bpart = ((float)cyan) * (lum_red_weight / 100.) +
- ((float)magenta) * (lum_green_weight / 100.) +
- ((float)yellow) * (lum_blue_weight / 100.) +
- (float)black;
-
- cyan = magenta = yellow = (gx_color_index) 0;
- black = (gx_color_index) (bpart > gx_max_color_value ?
- gx_max_color_value : bpart);
- }
- color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
- nbits >> 2);
- }
- }
-
- return (color);
+ gx_color_index color;
+ gx_color_value cyan, magenta, yellow, black;
+
+ cyan = cv[0]; magenta = cv[1]; yellow = cv[2]; black = cv[3];
+ switch (pdev->color_info.depth) {
+ case 1:
+ color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
+ ( gx_color_index) 1 : (gx_color_index) 0;
+ break;
+
+ default:{
+ int nbits = pdev->color_info.depth;
+
+ if (cyan == magenta && magenta == yellow) {
+ /* Convert CMYK to gray -- Red Book 6.2.2 */
+ float bpart = ((float)cyan) * (lum_red_weight / 100.) +
+ ((float)magenta) * (lum_green_weight / 100.) +
+ ((float)yellow) * (lum_blue_weight / 100.) +
+ (float)black;
+
+ cyan = magenta = yellow = (gx_color_index) 0;
+ black = (gx_color_index) (bpart > gx_max_color_value ?
+ gx_max_color_value : bpart);
+ }
+ color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
+ nbits >> 2);
+ }
+ }
+
+ return (color);
}
-
-/* gdev_cmyk_map_rgb_color: Mapping of RGB colors to gray values.
+/* gdev_cmyk_map_rgb_color: Mapping of RGB colors to gray values.
----------------------------------------------------------------------------------*/
static gx_color_index gdev_cmyk_map_rgb_color( gx_device * pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_value r, g, b;
- r = cv[0]; g = cv[1]; b = cv[2];
- if (gx_color_value_to_byte(r & g & b) == 0xff) {
- return (gx_color_index) 0; /* White */
- } else {
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
-
- switch (pdev->color_info.depth) {
- case 1:
- return (c | m | y) > gx_max_color_value / 2 ? (gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED */
- break;
-
- case 8:
- return ((ulong) c * lum_red_weight * 10
- + (ulong) m * lum_green_weight * 10
- + (ulong) y * lum_blue_weight * 10)
- >> (gx_color_value_bits + 2);
- /*NOTREACHED */
- break;
- }
- }
-
- return (gx_color_index) 0; /* This should never happen. */
+ r = cv[0]; g = cv[1]; b = cv[2];
+ if (gx_color_value_to_byte(r & g & b) == 0xff) {
+ return (gx_color_index) 0; /* White */
+ } else {
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return (c | m | y) > gx_max_color_value / 2 ? (gx_color_index) 1 : (gx_color_index) 0;
+ /*NOTREACHED */
+ break;
+
+ case 8:
+ return ((ulong) c * lum_red_weight * 10
+ + (ulong) m * lum_green_weight * 10
+ + (ulong) y * lum_blue_weight * 10)
+ >> (gx_color_value_bits + 2);
+ /*NOTREACHED */
+ break;
+ }
+ }
+
+ return (gx_color_index) 0; /* This should never happen. */
}
-
-/* gdev_cmyk_map_rgb_color: Mapping of CMYK colors.
+/* gdev_cmyk_map_rgb_color: Mapping of CMYK colors.
----------------------------------------------------------------------------------*/
-static int gdev_cmyk_map_color_rgb( gx_device *pdev,
- gx_color_index color,
- gx_color_value prgb[3])
+static int gdev_cmyk_map_color_rgb( gx_device *pdev,
+ gx_color_index color,
+ gx_color_value prgb[3])
{
- switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
- break;
-
- case 8:
- if (pdev->color_info.num_components == 1) {
- gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- break;
- }
-
- default:{
- unsigned long bcyan, bmagenta, byellow, black;
- int nbits = pdev->color_info.depth;
-
- gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black, nbits >> 2);
+ switch (pdev->color_info.depth) {
+ case 1:
+ prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
+ break;
+
+ case 8:
+ if (pdev->color_info.num_components == 1) {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ break;
+ }
+
+ default:{
+ unsigned long bcyan, bmagenta, byellow, black;
+ int nbits = pdev->color_info.depth;
+
+ gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black, nbits >> 2);
# ifdef USE_ADOBE_CMYK_RGB
- /* R = 1.0 - min(1.0, C + K), etc. */
+ /* R = 1.0 - min(1.0, C + K), etc. */
- bcyan += black, bmagenta += black, byellow += black;
- prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bcyan);
- prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bmagenta);
- prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - byellow);
+ bcyan += black, bmagenta += black, byellow += black;
+ prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bcyan);
+ prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bmagenta);
+ prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - byellow);
# else
- /* R = (1.0 - C) * (1.0 - K), etc. */
+ /* R = (1.0 - C) * (1.0 - K), etc. */
- prgb[0] = (gx_color_value)((ulong) (gx_max_color_value - bcyan) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[1] = (gx_color_value)((ulong) (gx_max_color_value - bmagenta) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[2] = (gx_color_value)((ulong) (gx_max_color_value - byellow) *
- (gx_max_color_value - black) / gx_max_color_value);
+ prgb[0] = (gx_color_value)((ulong) (gx_max_color_value - bcyan) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[1] = (gx_color_value)((ulong) (gx_max_color_value - bmagenta) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[2] = (gx_color_value)((ulong) (gx_max_color_value - byellow) *
+ (gx_max_color_value - black) / gx_max_color_value);
#endif
- }
- }
+ }
+ }
- return (0);
+ return (0);
}
#define gx_color_value_to_1bit(cv) ((cv) >> (gx_color_value_bits - 1))
@@ -2424,233 +2388,229 @@ static int gdev_cmyk_map_color_rgb( gx_device *pdev,
#define gx_color_value_to_5bits(cv) ((cv) >> (gx_color_value_bits - 5))
#define gx_color_value_to_6bits(cv) ((cv) >> (gx_color_value_bits - 6))
-/* gdev_pcl_map_rgb_color:
+/* gdev_pcl_map_rgb_color:
----------------------------------------------------------------------------------*/
static gx_color_index gdev_pcl_map_rgb_color( gx_device * pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_value r, g, b;
- r = cv[0]; g = cv[1]; b = cv[2];
- if (gx_color_value_to_byte(r & g & b) == 0xff)
- return (gx_color_index) 0; /* white */
- else {
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
-
- switch (pdev->color_info.depth) {
- case 1:
- return ((c | m | y) > gx_max_color_value / 2 ? (gx_color_index) 1 : (gx_color_index) 0);
-
- case 8:
- if (pdev->color_info.num_components >= 3)
- return (gx_color_value_to_1bit(c)
- + (gx_color_value_to_1bit(m) << 1)
- + (gx_color_value_to_1bit(y) << 2));
- else
- return ((((ulong) c * red_weight + (ulong) m * green_weight + (ulong) y * blue_weight)
- >> (gx_color_value_bits + 2)));
-
- case 16:
- return (gx_color_value_to_5bits(y) +
- (gx_color_value_to_6bits(m) << 5) +
- (gx_color_value_to_5bits(c) << 11));
- case 24:
- return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16));
- case 32: {
- return ((c == m && c == y) ? ((ulong) gx_color_value_to_byte(c) << 24)
- : (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16)));
- }
- }
- }
-
- return ((gx_color_index) 0); /* This never happens */
+ r = cv[0]; g = cv[1]; b = cv[2];
+ if (gx_color_value_to_byte(r & g & b) == 0xff)
+ return (gx_color_index) 0; /* white */
+ else {
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return ((c | m | y) > gx_max_color_value / 2 ? (gx_color_index) 1 : (gx_color_index) 0);
+
+ case 8:
+ if (pdev->color_info.num_components >= 3)
+ return (gx_color_value_to_1bit(c)
+ + (gx_color_value_to_1bit(m) << 1)
+ + (gx_color_value_to_1bit(y) << 2));
+ else
+ return ((((ulong) c * red_weight + (ulong) m * green_weight + (ulong) y * blue_weight)
+ >> (gx_color_value_bits + 2)));
+
+ case 16:
+ return (gx_color_value_to_5bits(y) +
+ (gx_color_value_to_6bits(m) << 5) +
+ (gx_color_value_to_5bits(c) << 11));
+ case 24:
+ return (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong) gx_color_value_to_byte(c) << 16));
+ case 32: {
+ return ((c == m && c == y) ? ((ulong) gx_color_value_to_byte(c) << 24)
+ : (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong) gx_color_value_to_byte(c) << 16)));
+ }
+ }
+ }
+
+ return ((gx_color_index) 0); /* This never happens */
}
#define gx_maxcol gx_color_value_from_byte(gx_color_value_to_byte(gx_max_color_value))
/* gdev_pcl_map_color_rgb: Map a color index to a r-g-b color.
----------------------------------------------------------------------------------*/
-static int gdev_pcl_map_color_rgb( gx_device *pdev,
- gx_color_index color,
- gx_color_value prgb[3])
+static int gdev_pcl_map_color_rgb( gx_device *pdev,
+ gx_color_index color,
+ gx_color_value prgb[3])
{
- /* For the moment, we simply ignore any black correction */
- switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
- break;
-
- case 8:
- if (pdev->color_info.num_components >= 3) {
- gx_color_value c = (gx_color_value) color ^ 7;
-
- prgb[0] = -(c & 1);
- prgb[1] = -((c >> 1) & 1);
- prgb[2] = -(c >> 2);
- } else {
- gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- }
- break;
- case 16: {
- gx_color_value c = (gx_color_value) color ^ 0xffff;
- ushort value = c >> 11;
-
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (c >> 6) & 0x3f;
- prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
- value = c & 0x1f;
- prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- }
- break;
-
- case 24: {
- gx_color_value c = (gx_color_value) color ^ 0xffffff;
-
- prgb[0] = gx_color_value_from_byte(c >> 16);
- prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
- prgb[2] = gx_color_value_from_byte(c & 0xff);
- }
- break;
-
- case 32: {
- gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
-
- prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
- prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[2] = w - gx_color_value_from_byte(color & 0xff);
- }
- break;
- }
-
- return (0);
+ /* For the moment, we simply ignore any black correction */
+ switch (pdev->color_info.depth) {
+ case 1:
+ prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
+ break;
+
+ case 8:
+ if (pdev->color_info.num_components >= 3) {
+ gx_color_value c = (gx_color_value) color ^ 7;
+
+ prgb[0] = -(c & 1);
+ prgb[1] = -((c >> 1) & 1);
+ prgb[2] = -(c >> 2);
+ } else {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ }
+ break;
+ case 16: {
+ gx_color_value c = (gx_color_value) color ^ 0xffff;
+ ushort value = c >> 11;
+
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (c >> 6) & 0x3f;
+ prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
+ >> (16 - gx_color_value_bits);
+ value = c & 0x1f;
+ prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ }
+ break;
+
+ case 24: {
+ gx_color_value c = (gx_color_value) color ^ 0xffffff;
+
+ prgb[0] = gx_color_value_from_byte(c >> 16);
+ prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
+ prgb[2] = gx_color_value_from_byte(c & 0xff);
+ }
+ break;
+
+ case 32: {
+ gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
+
+ prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
+ prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[2] = w - gx_color_value_from_byte(color & 0xff);
+ }
+ break;
+ }
+
+ return (0);
}
#define save_ccomps save_info.num_components
-
/* cdj_put_param_bpp: new_bpp == save_bpp or new_bpp == 0 means don't change bpp.
* ccomps == 0 means don't change number of color comps.
* If new_bpp != 0, it must be the value of the BitsPerPixel element of
* the plist; real_bpp may differ from new_bpp.
----------------------------------------------------------------------------------*/
-static int cdj_put_param_bpp( gx_device *pdev,
- gs_param_list *plist,
- int new_bpp,
- int real_bpp,
- int ccomps)
+static int cdj_put_param_bpp( gx_device *pdev,
+ gs_param_list *plist,
+ int new_bpp,
+ int real_bpp,
+ int ccomps)
{
- if (new_bpp == 0 && ccomps == 0)
- return gdev_prn_put_params(pdev, plist);
- else {
- gx_device_color_info save_info;
- int save_bpp;
- int code;
-
- save_info = pdev->color_info;
- save_bpp = save_info.depth;
-
- if (save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
- save_bpp = 3;
-
- code = cdj_set_bpp(pdev, real_bpp, ccomps);
-
- if (code < 0) {
- param_signal_error(plist, "BitsPerPixel", code);
- param_signal_error(plist, "ProcessColorModel", code);
- return (code);
- }
-
- pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
- code = gdev_prn_put_params(pdev, plist);
-
- if (code < 0) {
- cdj_set_bpp(pdev, save_bpp, save_ccomps);
- return (code);
- }
-
- cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
- if ((cdj970->color_info.depth != save_bpp
- || (ccomps != 0 && ccomps != save_ccomps))
- && pdev->is_open)
- return (gs_closedevice(pdev));
-
- return (0);
-
+ if (new_bpp == 0 && ccomps == 0)
+ return gdev_prn_put_params(pdev, plist);
+ else {
+ gx_device_color_info save_info;
+ int save_bpp;
+ int code;
+
+ save_info = pdev->color_info;
+ save_bpp = save_info.depth;
+
+ if (save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
+ save_bpp = 3;
+
+ code = cdj_set_bpp(pdev, real_bpp, ccomps);
+
+ if (code < 0) {
+ param_signal_error(plist, "BitsPerPixel", code);
+ param_signal_error(plist, "ProcessColorModel", code);
+ return (code);
+ }
+
+ pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
+ code = gdev_prn_put_params(pdev, plist);
+
+ if (code < 0) {
+ cdj_set_bpp(pdev, save_bpp, save_ccomps);
+ return (code);
+ }
+
+ cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
+ if ((cdj970->color_info.depth != save_bpp
+ || (ccomps != 0 && ccomps != save_ccomps))
+ && pdev->is_open)
+ return (gs_closedevice(pdev));
+
+ return (0);
+
#undef save_ccomps
- }
+ }
}
-
-/* cdj970_write_header:
+/* cdj970_write_header:
----------------------------------------------------------------------------------*/
static int cdj970_write_header (gx_device *pdev, FILE * prn_stream)
{
- char startbuffer[1260];
-
- memset (startbuffer, 0, 1260);
-
- sprintf (&(startbuffer[600]), "\033E\033%%-12345X@PJL JOB NAME = \"GHOST BY RENE HARSCH\"\n@PJL ENTER LANGUAGE=PCL3GUI\n");
-
- fwrite (startbuffer, sizeof(char), 678, prn_stream);
-
- fputs("\033&l1H\033&l-2H", prn_stream); /* reverse engineering */
-
- /* enter duplex mode / reverse engineering */
- if (cdj970->duplex > NONE) {
- fputs("\033&l2S\033&b16WPML", prn_stream);
-
- fputc (0x20, prn_stream);
- fputc (0x04, prn_stream);
- fputc (0x00, prn_stream);
- fputc (0x06, prn_stream);
- fputc (0x01, prn_stream);
- fputc (0x04, prn_stream);
- fputc (0x01, prn_stream);
- fputc (0x04, prn_stream);
- fputc (0x01, prn_stream);
- fputc (0x06, prn_stream);
- fputc (0x08, prn_stream);
- fputc (0x01, prn_stream);
- fputc (0x00, prn_stream);
- }
-
- return 0;
+ char startbuffer[1260];
+
+ memset (startbuffer, 0, 1260);
+
+ sprintf (&(startbuffer[600]), "\033E\033%%-12345X@PJL JOB NAME = \"GHOST BY RENE HARSCH\"\n@PJL ENTER LANGUAGE=PCL3GUI\n");
+
+ fwrite (startbuffer, sizeof(char), 678, prn_stream);
+
+ fputs("\033&l1H\033&l-2H", prn_stream); /* reverse engineering */
+
+ /* enter duplex mode / reverse engineering */
+ if (cdj970->duplex > NONE) {
+ fputs("\033&l2S\033&b16WPML", prn_stream);
+
+ fputc (0x20, prn_stream);
+ fputc (0x04, prn_stream);
+ fputc (0x00, prn_stream);
+ fputc (0x06, prn_stream);
+ fputc (0x01, prn_stream);
+ fputc (0x04, prn_stream);
+ fputc (0x01, prn_stream);
+ fputc (0x04, prn_stream);
+ fputc (0x01, prn_stream);
+ fputc (0x06, prn_stream);
+ fputc (0x08, prn_stream);
+ fputc (0x01, prn_stream);
+ fputc (0x00, prn_stream);
+ }
+
+ return 0;
}
-/* cdj970_write_trailer:
+/* cdj970_write_trailer:
----------------------------------------------------------------------------------*/
static int cdj970_write_trailer (gx_device *pdev, FILE * prn_stream)
{
- fprintf(prn_stream, "\033E\033%%-12345X"); /* reverse engineering */
-
- return 0;
-}
+ fprintf(prn_stream, "\033E\033%%-12345X"); /* reverse engineering */
+ return 0;
+}
-/* cdj970_close:
+/* cdj970_close:
----------------------------------------------------------------------------------*/
static int cdj970_close(gx_device *pdev)
-{
- gx_device_printer *const ppdev = (gx_device_printer *)pdev;
- int retCode = gdev_prn_open_printer (pdev, true);
-
- if (retCode < 0)
- return (retCode);
-
- cdj970_write_trailer (pdev, ppdev->file);
-
- return gdev_prn_close(pdev);
+{
+ gx_device_printer *const ppdev = (gx_device_printer *)pdev;
+ int retCode = gdev_prn_open_printer (pdev, true);
-}
+ if (retCode < 0)
+ return (retCode);
+
+ cdj970_write_trailer (pdev, ppdev->file);
+ return gdev_prn_close(pdev);
+
+}
diff --git a/gs/contrib/gdevgdi.c b/gs/contrib/gdevgdi.c
index 20f8d2779..473925f34 100644
--- a/gs/contrib/gdevgdi.c
+++ b/gs/contrib/gdevgdi.c
@@ -1,12 +1,12 @@
/*
This file is part of GNU Ghostscript.
-
+
GNU Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to
anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer to
the GNU General Public License for full details.
-
+
Everyone is granted permission to copy, modify and redistribute GNU
Ghostscript, but only under the conditions described in the GNU General
Public License. A copy of this license is supposed to have been given to
@@ -14,7 +14,7 @@
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
copies.
-
+
Aladdin Enterprises is not affiliated with the Free Software Foundation or
the GNU Project. GNU Ghostscript, as distributed by Aladdin Enterprises,
does not depend on any other GNU software.
@@ -25,7 +25,6 @@
#include "gdevprn.h"
#include "gdevpcl.h"
-
/*
* You may select a default resolution of 300 or 600 DPI
* in the makefile, or an actual resolution
@@ -97,33 +96,33 @@ static dev_proc_print_page(gdi_print_page);
static gx_device_procs prn_gdi_procs =
prn_params_procs(gdi_open, gdev_prn_output_page, gdi_close,
- gdev_prn_get_params, gdev_prn_put_params);
+ gdev_prn_get_params, gdev_prn_put_params);
gx_device_printer far_data gs_gdi_device =
prn_device(prn_gdi_procs, "gdi",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */
- X_DPI2, Y_DPI2,
- 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */
- 1, /* color bit */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */
+ X_DPI2, Y_DPI2,
+ 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */
+ 1, /* color bit */
gdi_print_page);
gx_device_printer far_data gs_samsunggdi_device =
prn_device(prn_gdi_procs, "samsunggdi",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */
- X_DPI2, Y_DPI2,
- 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */
- 1, /* color bit */
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS, /* paper size (unit : 10/72 inch size) */
+ X_DPI2, Y_DPI2,
+ 0.20, 0.25, 0.25, 0.25, /* margins filled in by gdi_open */
+ 1, /* color bit */
gdi_print_page);
static FILE *WritePJLHeaderData(gx_device_printer *pdev, FILE *fp);
-static FILE *WriteBandHeader(FILE *fp, unsigned int usBandNo,
- unsigned char ubCompMode, unsigned int usBandWidth,
+static FILE *WriteBandHeader(FILE *fp, unsigned int usBandNo,
+ unsigned char ubCompMode, unsigned int usBandWidth,
unsigned int usBandHeight, unsigned long ulBandSize);
static FILE *WriteTrailerData(FILE *fp);
-static unsigned long FrameTiffComp(unsigned char *pubDest, unsigned char *pubSrc,
- unsigned int usTotalLines, unsigned int usBytesPerLine,
+static unsigned long FrameTiffComp(unsigned char *pubDest, unsigned char *pubSrc,
+ unsigned int usTotalLines, unsigned int usBytesPerLine,
unsigned char ubMode);
-static unsigned int FrameTiff_Comp(unsigned char *lpSrcBuf, unsigned char *lpTgtBuf,
+static unsigned int FrameTiff_Comp(unsigned char *lpSrcBuf, unsigned char *lpTgtBuf,
unsigned int nSrcBytes);
static unsigned int PreTiffComp(unsigned char *lpSrcBuf, unsigned int nSrcBytes);
static long bmp2run(unsigned char *out_buf, unsigned char *in_buf, unsigned int sizeY, unsigned int sizeX, unsigned char ubMode);
@@ -134,29 +133,29 @@ static long bmp2run(unsigned char *out_buf, unsigned char *in_buf, unsigned int
static int
gdi_open(gx_device *pdev)
{ /* Change the margins if necessary. */
- const float *m = 0;
- bool move_origin = true;
-
- static const float m_a4[4] = { GDI_MARGINS_A4 };
- static const float m_letter[4] = { GDI_MARGINS_LETTER };
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
- m_letter);
- move_origin = false;
-
- if ( m != 0 )
- gx_device_set_margins(pdev, m, move_origin);
-
- return gdev_prn_open(pdev);
+ const float *m = 0;
+ bool move_origin = true;
+
+ static const float m_a4[4] = { GDI_MARGINS_A4 };
+ static const float m_letter[4] = { GDI_MARGINS_LETTER };
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? m_a4 :
+ m_letter);
+ move_origin = false;
+
+ if ( m != 0 )
+ gx_device_set_margins(pdev, m, move_origin);
+
+ return gdev_prn_open(pdev);
}
/* gdi_close is only here to eject odd numbered pages in duplex mode. */
static int
gdi_close(gx_device *pdev)
{ if ( ppdev->Duplex_set >= 0 && ppdev->Duplex )
- { gdev_prn_open_printer(pdev, 1);
- fputs("\033&l0H", ppdev->file) ;
- }
- return gdev_prn_close(pdev);
+ { gdev_prn_open_printer(pdev, 1);
+ fputs("\033&l0H", ppdev->file) ;
+ }
+ return gdev_prn_close(pdev);
}
#undef ppdev
@@ -178,27 +177,27 @@ gdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
int real_line_width;
long ul_band_size, ul_comp_size, ul_tiff_size, ul_min_size;
byte *ibp=NULL, *obp=NULL, *tmp=NULL;
- byte paper_type=0, compression_type;
+ byte paper_type=0, compression_type;
switch (gdev_pcl_paper_size((gx_device*)pdev))
- {
- case PAPER_SIZE_A4 : paper_type = 0;
- break;
- case PAPER_SIZE_LETTER : paper_type = 1;
- break;
- case PAPER_SIZE_LEGAL : paper_type = 1;
- break;
- default:
- paper_type = 1;
- break;
- }
- if (dots_per_inch == 600) { /* 600dpi */
+ {
+ case PAPER_SIZE_A4 : paper_type = 0;
+ break;
+ case PAPER_SIZE_LETTER : paper_type = 1;
+ break;
+ case PAPER_SIZE_LEGAL : paper_type = 1;
+ break;
+ default:
+ paper_type = 1;
+ break;
+ }
+ if (dots_per_inch == 600) { /* 600dpi */
band_width_bytes = (GDI_BAND_WIDTH[paper_type]+31)/32*4;
band_height = GDI_BAND_HEIGHT;
- } else { /* 300dpi */
+ } else { /* 300dpi */
band_width_bytes = (GDI_BAND_WIDTH[paper_type]+31)/32*4/2;
band_height = GDI_BAND_HEIGHT*2;
- }
+ }
ul_band_size = band_width_bytes * band_height;
ibp = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), ul_band_size, 1, "gdi_print_page");
@@ -218,109 +217,109 @@ gdi_print_page(gx_device_printer *pdev, FILE *prn_stream)
if (raster > band_width_bytes)
real_line_width = band_width_bytes;
- else
+ else
real_line_width = raster;
-
- /* Real Data Output */
- y = 0;
+
+ /* Real Data Output */
+ y = 0;
for (i=0; i< band_num; i++) {
memset(ibp, 0x00, ul_band_size);
memset(obp, 0x00, ul_band_size*13/10);
for (j=0; j<band_height; j++) {
memset(tmp, 0x00, raster);
/*code = gdev_prn_copy_scan_lines(pdev, i*band_height+j, */
- if (y == num_rows) break;
- code = gdev_prn_copy_scan_lines(pdev, y++,
+ if (y == num_rows) break;
+ code = gdev_prn_copy_scan_lines(pdev, y++,
(byte*)tmp, raster);
if (code < 0) break;
memcpy(ibp+j*band_width_bytes, tmp, real_line_width);
}
- if ( i>= GDI_MAX_BAND) continue;
+ if ( i>= GDI_MAX_BAND) continue;
- /* Write Band Data
- Because of Scanline compression, extract Scanline compression mode */
+ /* Write Band Data
+ Because of Scanline compression, extract Scanline compression mode */
/*ul_tiff_size = FrameTiffComp(obp, ibp, band_height, band_width_bytes, GDI_PRE_COMP);*/
/*ul_scan_size = (unsigned long)bmp2run(obp, ibp, band_height, band_width_bytes, GDI_PRE_COMP);*/
- /*ul_min_size = (ul_scan_size > ul_tiff_size) ? ul_tiff_size : ul_scan_size;*/
- ul_min_size = ul_tiff_size;
- compression_type = GDI_COMP_MODITIFF;
- /*compression_type = (ul_scan_size > ul_tiff_size) ? GDI_COMP_MODITIFF : GDI_COMP_SCANLINE;*/
+ /*ul_min_size = (ul_scan_size > ul_tiff_size) ? ul_tiff_size : ul_scan_size;*/
+ ul_min_size = ul_tiff_size;
+ compression_type = GDI_COMP_MODITIFF;
+ /*compression_type = (ul_scan_size > ul_tiff_size) ? GDI_COMP_MODITIFF : GDI_COMP_SCANLINE;*/
switch (compression_type) {
- case GDI_COMP_MODITIFF:
+ case GDI_COMP_MODITIFF:
#define FUDGE_BIG_BANDS
#ifndef FUDGE_BIG_BANDS
ul_comp_size = FrameTiffComp(obp, ibp, band_height, band_width_bytes, GDI_REAL_COMP);
#else
- {
- /* Very ugly. The printer will hose if the compressed
+ {
+ /* Very ugly. The printer will hose if the compressed
band size is over 65536, so we "fudge" the data in
- this case repeatedly until we get what we want.
+ this case repeatedly until we get what we want.
- The fudge algorithm is simple, this is kinda-sorta
- RLE, so we just round groups of bits in groups of
- 2, then 3, then 4, etc until the thing works. */
+ The fudge algorithm is simple, this is kinda-sorta
+ RLE, so we just round groups of bits in groups of
+ 2, then 3, then 4, etc until the thing works. */
#define MAXBAND 0xffff
#define ASSERT(x)
- int fudge=0;
- byte *use_band=ibp;
- do {
- ul_comp_size = FrameTiffComp(obp, use_band,
- band_height, band_width_bytes,
- GDI_REAL_COMP);
- if (ul_comp_size > MAXBAND-8) {
- int f, g, h;
- if (!fudge) {
- ASSERT(use_band == ibp);
- use_band = (byte*)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), ul_band_size, 1, "gdi_print_page/fudge");
- fudge=1;
- }
- memcpy(use_band, ibp, ul_band_size);
- fudge++;
- ASSERT(fudge>=2);
- {
+ int fudge=0;
+ byte *use_band=ibp;
+ do {
+ ul_comp_size = FrameTiffComp(obp, use_band,
+ band_height, band_width_bytes,
+ GDI_REAL_COMP);
+ if (ul_comp_size > MAXBAND-8) {
+ int f, g, h;
+ if (!fudge) {
+ ASSERT(use_band == ibp);
+ use_band = (byte*)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), ul_band_size, 1, "gdi_print_page/fudge");
+ fudge=1;
+ }
+ memcpy(use_band, ibp, ul_band_size);
+ fudge++;
+ ASSERT(fudge>=2);
+ {
#define FUDGE2(x) ( (((((x)>>6)&0x3)?3:0)<<6) \
- | (((((x)>>4)&0x3)?3:0)<<4) \
- | (((((x)>>2)&0x3)?3:0)<<2) \
- | (((((x)>>0)&0x3)?3:0)) )
+ | (((((x)>>4)&0x3)?3:0)<<4) \
+ | (((((x)>>2)&0x3)?3:0)<<2) \
+ | (((((x)>>0)&0x3)?3:0)) )
#define FUDGE4(x) ( (((((x)>>4)&0xf)?0xf:0)<<4) \
- | (((((x)>>0)&0xf)?0xf:0)) )
+ | (((((x)>>0)&0xf)?0xf:0)) )
#define FUDGE8(x) ( (((((x)>>0)&0xff)?0xf:0)) )
#define FUDGE(fudge, x) ( (fudge == 2 ? FUDGE2(x) \
- : fudge == 3 ? FUDGE4(x) \
- : fudge == 4 ? FUDGE8(x) \
- : 0 ) )
-
- for(f=0;f<ul_band_size; f++) {
- use_band[f] = FUDGE(fudge, ibp[f]);
- }
- }
- }
- } while (ul_comp_size > MAXBAND-8);
- oh_well:
- if (fudge > 1) {
- ASSERT(use_band != ibp);
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), use_band, ul_band_size, 1, "gdi_print_page/fudge");
- /*dprintf2("smartgdi: band %d fudge factor is %d\n", i, fudge);*/
- }
- }
+ : fudge == 3 ? FUDGE4(x) \
+ : fudge == 4 ? FUDGE8(x) \
+ : 0 ) )
+
+ for(f=0;f<ul_band_size; f++) {
+ use_band[f] = FUDGE(fudge, ibp[f]);
+ }
+ }
+ }
+ } while (ul_comp_size > MAXBAND-8);
+ oh_well:
+ if (fudge > 1) {
+ ASSERT(use_band != ibp);
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), use_band, ul_band_size, 1, "gdi_print_page/fudge");
+ /*dprintf2("smartgdi: band %d fudge factor is %d\n", i, fudge);*/
+ }
+ }
#endif
- break;
- case GDI_COMP_SCANLINE:
+ break;
+ case GDI_COMP_SCANLINE:
ul_comp_size = bmp2run(obp, ibp, band_height, band_width_bytes, GDI_REAL_COMP);
- break;
- default:
+ break;
+ default:
ul_comp_size = FrameTiffComp(obp, ibp, band_height, band_width_bytes, GDI_REAL_COMP);
- compression_type = GDI_COMP_MODITIFF;
- break;
- }
+ compression_type = GDI_COMP_MODITIFF;
+ break;
+ }
prn_stream = WriteBandHeader(prn_stream, i, compression_type, (band_width_bytes * 8),
- band_height, ul_comp_size);
+ band_height, ul_comp_size);
/*dprintf2(prn_stream, "[%d] band, size : %d\n", i, ul_tiff_size);*/
fwrite(obp, ul_comp_size, 1, prn_stream);
}
-
+
/* Trailer Output */
WriteTrailerData(prn_stream);
gs_free(gs_lib_ctx_get_non_gc_memory_t(), ibp, ul_band_size, 1, "gdi_line_buffer");
@@ -336,7 +335,7 @@ FILE *WritePJLHeaderData(gx_device_printer *pdev, FILE *fp)
int dots_per_inch = (int)pdev->y_pixels_per_inch;
strcpy(buffer, "\033%-12345X");
-
+
/* Paper Type*/
strcat(buffer, "@PJL SET PAPERTYPE = NORMAL ON\015\012");
/*Density*/
@@ -357,20 +356,20 @@ FILE *WritePJLHeaderData(gx_device_printer *pdev, FILE *fp)
/* Copies*/
strcat(buffer, "$PJL COPIES = 1\015\012");
/* Paper Size*/
- switch (gdev_pcl_paper_size((gx_device*)pdev))
+ switch (gdev_pcl_paper_size((gx_device*)pdev))
{
- case PAPER_SIZE_A4:
- strcat(buffer, "$PJL PAGE A4 AUTO\015\012");
- break;
- case PAPER_SIZE_LETTER:
- strcat(buffer, "$PJL PAGE LETTER AUTO\015\012");
- break;
- case PAPER_SIZE_LEGAL:
- strcat(buffer, "$PJL PAGE LEGAL AUTO\015\012");
- break;
- default:
- strcat(buffer, "$PJL PAGE LETTER AUTO\015\012");
- break;
+ case PAPER_SIZE_A4:
+ strcat(buffer, "$PJL PAGE A4 AUTO\015\012");
+ break;
+ case PAPER_SIZE_LETTER:
+ strcat(buffer, "$PJL PAGE LETTER AUTO\015\012");
+ break;
+ case PAPER_SIZE_LEGAL:
+ strcat(buffer, "$PJL PAGE LEGAL AUTO\015\012");
+ break;
+ default:
+ strcat(buffer, "$PJL PAGE LETTER AUTO\015\012");
+ break;
}
/* bitmap start*/
strcat(buffer, "$PJL BITMAP START\015\012");
@@ -380,7 +379,6 @@ FILE *WritePJLHeaderData(gx_device_printer *pdev, FILE *fp)
return(fp);
} /* WritePJLHeaderData() */
-
FILE *WriteBandHeader
(
FILE *fp,
@@ -404,8 +402,8 @@ unsigned long ulBandSize
buf[i++] = (unsigned char)((ulBandSize >> 16) & 0xff);
buf[i++] = (unsigned char)((ulBandSize >> 8) & 0xff);
buf[i++] = (unsigned char)(ulBandSize & 0xff);
-
- /* id */
+
+ /* id */
buf[i++] = (unsigned char)((usBandNo >> 8) & 0xff);
buf[i++] = (unsigned char)(usBandNo & 0xff);
@@ -419,7 +417,7 @@ unsigned long ulBandSize
buf[i++] = (unsigned char)((usBandHeight >> 8) & 0xff);
buf[i++] = (unsigned char)(usBandHeight & 0xff);
- /* width */
+ /* width */
buf[i++] = (unsigned char)((usBandWidth >> 8) & 0xff);
buf[i++] = (unsigned char)(usBandWidth & 0xff);
@@ -446,9 +444,9 @@ FILE *WriteTrailerData(FILE *fp)
return(fp);
} /* WriteTrailerData()*/
-unsigned long FrameTiffComp(unsigned char *pubDest,
- unsigned char *pubSrc,
- unsigned int usTotalLines,
+unsigned long FrameTiffComp(unsigned char *pubDest,
+ unsigned char *pubSrc,
+ unsigned int usTotalLines,
unsigned int usBytesPerLine,
unsigned char ubMode)
{
@@ -784,7 +782,7 @@ unsigned int PreTiffComp(unsigned char *lpSrcBuf, unsigned int nSrcBytes)
return (usret);
}
-typedef struct
+typedef struct
{
unsigned char ubDx;
unsigned char ubRl;
@@ -793,69 +791,69 @@ typedef struct
static sc_tbl gdi_ScanTbl[256] = {
{ 8, 0, 0 }, { 7, 1, 1 }, { 6, 1, 0 }, { 6, 2, 1 }, /* 0x00*/
-{ 5, 1, 0 }, { 0, 0, 1 }, { 5, 2, 0 }, { 5, 3, 1 },
-{ 4, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 4, 2, 0 }, { 0, 0, 1 }, { 4, 3, 0 }, { 4, 4, 1 },
+{ 5, 1, 0 }, { 0, 0, 1 }, { 5, 2, 0 }, { 5, 3, 1 },
+{ 4, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 4, 2, 0 }, { 0, 0, 1 }, { 4, 3, 0 }, { 4, 4, 1 },
{ 3, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x10*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 3, 2, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 3, 3, 0 }, { 0, 0, 1 }, { 3, 4, 0 }, { 3, 5, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 3, 2, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 3, 3, 0 }, { 0, 0, 1 }, { 3, 4, 0 }, { 3, 5, 1 },
{ 2, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x20*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 2, 2, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x30*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 2, 3, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 2, 4, 0 }, { 0, 0, 1 }, { 2, 5, 0 }, { 2, 6, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 2, 3, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 2, 4, 0 }, { 0, 0, 1 }, { 2, 5, 0 }, { 2, 6, 1 },
{ 1, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x40*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x50*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 1, 2, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x60*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 1, 3, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x70*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 1, 4, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 1, 5, 0 }, { 0, 0, 1 }, { 1, 6, 0 }, { 1, 7, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 1, 4, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 1, 5, 0 }, { 0, 0, 1 }, { 1, 6, 0 }, { 1, 7, 1 },
{ 0, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x80*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0x90*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xa0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xb0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 2, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xc0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xd0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 3, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xe0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
{ 0, 4, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 }, /* 0xf0*/
-{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 5, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
-{ 0, 6, 0 }, { 0, 0, 1 }, { 0, 7, 0 }, { 0, 8, 1 },
+{ 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 5, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 1 },
+{ 0, 6, 0 }, { 0, 0, 1 }, { 0, 7, 0 }, { 0, 8, 1 },
};
static sc_tbl gdi_ScanTbl4[16] = {
@@ -952,11 +950,11 @@ static long Save2Bytes(unsigned char *out_buf, unsigned short usDy, unsigned sh
return(2);
} /* end of Save2Bytes()*/
-long SaveScanData (unsigned char *out_buf,
- unsigned short us1Cnt,
- unsigned short usDy,
- unsigned short usPosX10,
- unsigned short usPosX01,
+long SaveScanData (unsigned char *out_buf,
+ unsigned short us1Cnt,
+ unsigned short usDy,
+ unsigned short usPosX10,
+ unsigned short usPosX01,
unsigned short usWarp)
{
short sDisX;
@@ -965,19 +963,19 @@ long SaveScanData (unsigned char *out_buf,
sDisX = (int)usPosX01 - (int)usPosX10;
/* 48 bit*/
- if ( (usDy > 3) || (us1Cnt > 4095) )
+ if ( (usDy > 3) || (us1Cnt > 4095) )
{
Save6Bytes(out_buf, usDy, us1Cnt, sDisX, usWarp);
lRet = 6;
}
/* 32 bit*/
- else if ( (usDy > 1) || (us1Cnt > 63) || (sDisX > 127) || (sDisX < -128) )
+ else if ( (usDy > 1) || (us1Cnt > 63) || (sDisX > 127) || (sDisX < -128) )
{
Save4Bytes(out_buf, usDy, us1Cnt, sDisX);
lRet = 4;
}
/* 16 bit*/
- else
+ else
{
Save2Bytes(out_buf, usDy, us1Cnt, sDisX);
lRet = 2;
@@ -985,12 +983,11 @@ long SaveScanData (unsigned char *out_buf,
return(lRet);
} /* end of SaveScanData()*/
-
-long UpdateScanSize (unsigned char *out_buf,
- unsigned short us1Cnt,
- unsigned short usDy,
- unsigned short usPosX10,
- unsigned short usPosX01,
+long UpdateScanSize (unsigned char *out_buf,
+ unsigned short us1Cnt,
+ unsigned short usDy,
+ unsigned short usPosX10,
+ unsigned short usPosX01,
unsigned short usWarp)
{
short sDisX;
@@ -999,7 +996,7 @@ long UpdateScanSize (unsigned char *out_buf,
sDisX = usPosX01 - usPosX10;
/* 48 bit*/
- if ( (usDy > 3) || (us1Cnt > 4095) )
+ if ( (usDy > 3) || (us1Cnt > 4095) )
{
lRet = 6;
}
@@ -1017,11 +1014,11 @@ long UpdateScanSize (unsigned char *out_buf,
} /* end of UpdateScanSize() by bglee 19981224*/
static long GetSimpleScan(unsigned char *out_buf,
- unsigned char ubSizeMode,
- unsigned short *us1Count,
- unsigned short *usDy,
- unsigned short *usPosX10,
- unsigned short *usPosX01,
+ unsigned char ubSizeMode,
+ unsigned short *us1Count,
+ unsigned short *usDy,
+ unsigned short *usPosX10,
+ unsigned short *usPosX01,
unsigned short usBytePos,
unsigned char ubCrtByte,
unsigned char ubSize,
@@ -1032,13 +1029,13 @@ static long GetSimpleScan(unsigned char *out_buf,
unsigned char ubDx, ubRl, ubLastBit;
lScanSize = 0;
- if (ubSize == 8)
+ if (ubSize == 8)
{
ubDx = gdi_ScanTbl[ubCrtByte].ubDx;
ubRl = gdi_ScanTbl[ubCrtByte].ubRl;
ubLastBit = gdi_ScanTbl[ubCrtByte].ubLastBit;
}
- else
+ else
{
ubCrtByte &= 0x0f;
ubDx = gdi_ScanTbl4[ubCrtByte].ubDx;
@@ -1046,12 +1043,11 @@ static long GetSimpleScan(unsigned char *out_buf,
ubLastBit = gdi_ScanTbl4[ubCrtByte].ubLastBit;
}
-
/* 1 X 1 X*/
- if (ubPreBit)
+ if (ubPreBit)
{
/* 1 0 1 X*/
- if (ubDx)
+ if (ubDx)
{
lScanSize += (*UpdateScanLine[ubSizeMode])(out_buf, *us1Count, *usDy, *usPosX10, *usPosX01, usWidth);
*usPosX10 = usBytePos - *us1Count;
@@ -1059,11 +1055,11 @@ static long GetSimpleScan(unsigned char *out_buf,
*us1Count = ubRl;
*usDy = 0;
/* 1 0 1 0*/
- if (!ubLastBit)
+ if (!ubLastBit)
{
/* 19990330 by bglee*/
out_buf = out_buf + lScanSize;
-
+
lScanSize += (*UpdateScanLine[ubSizeMode])(out_buf, *us1Count, *usDy, *usPosX10, *usPosX01, usWidth);
*usPosX10 = *usPosX01 ;
*us1Count = 0;
@@ -1071,11 +1067,11 @@ static long GetSimpleScan(unsigned char *out_buf,
/* 1 0 1 1*/
}
/* 1 1 1 X*/
- else
+ else
{
*us1Count += ubRl;
/* 1 1 1 0*/
- if (!ubLastBit)
+ if (!ubLastBit)
{
lScanSize += (*UpdateScanLine[ubSizeMode])(out_buf, *us1Count, *usDy, *usPosX10, *usPosX01, usWidth);
*usPosX10 = usBytePos + ubRl - *us1Count;
@@ -1086,13 +1082,13 @@ static long GetSimpleScan(unsigned char *out_buf,
}
}
/* 0 X 1 X*/
- else
+ else
{
/* 0 X 1 X*/
*usPosX01 = usBytePos + ubDx;
*us1Count += ubRl;
/* 0 X 1 0*/
- if (!ubLastBit)
+ if (!ubLastBit)
{
lScanSize += (*UpdateScanLine[ubSizeMode])(out_buf, *us1Count, *usDy, *usPosX10, *usPosX01, usWidth);
*usPosX10 = *usPosX01 + ubRl - *us1Count;
@@ -1105,12 +1101,11 @@ static long GetSimpleScan(unsigned char *out_buf,
return(lScanSize);
} /* end of GetSimpleScan() */
-
-static long scan_map (unsigned char *in_buf,
+static long scan_map (unsigned char *in_buf,
unsigned char *out_buf,
- unsigned short usWidth,
- unsigned short usHeight,
- unsigned char ubMode)
+ unsigned short usWidth,
+ unsigned short usHeight,
+ unsigned char ubMode)
{
unsigned int i, j, k;
unsigned char ubPreBit, ubCrtByte;/*, ubLastBit;*/
@@ -1127,11 +1122,11 @@ static long scan_map (unsigned char *in_buf,
lScanSize = 0;
ubRevMode = ubMode & 0x01;
ubSizeMode = (ubMode & 0x02) >> 1;
- for (i = 0; i < usHeight; i++)
+ for (i = 0; i < usHeight; i++)
{
ubPreBit = 0;
us1Count = 0;
- for (j = 0; j < usWidth; j++)
+ for (j = 0; j < usWidth; j++)
{
ubCrtByte = *in_buf++;
if (ubRevMode)
@@ -1139,11 +1134,11 @@ static long scan_map (unsigned char *in_buf,
ubCrtByte = ~ubCrtByte;
}
- switch (ubCrtByte)
+ switch (ubCrtByte)
{
case 0x00:
/* 1 0 */
- if (ubPreBit)
+ if (ubPreBit)
{
lTmp = (*UpdateScanLine[ubSizeMode])(out_buf, us1Count, usDy, usPosX10, usPosX01, usWidth);
out_buf = out_buf + lTmp;
@@ -1162,16 +1157,16 @@ static long scan_map (unsigned char *in_buf,
us1Count += 8;
}
/* 0 1*/
- else
+ else
{
us1Count = 8;
- usPosX01 = (j << 3);
+ usPosX01 = (j << 3);
}
break;
default:
/* X X 1 X*/
- if (gdi_ScanTbl[ubCrtByte].ubRl)
+ if (gdi_ScanTbl[ubCrtByte].ubRl)
{
usBytePos = (j << 3);
lTmp = GetSimpleScan(out_buf, ubSizeMode, &us1Count, &usDy, &usPosX10, &usPosX01, usBytePos, ubCrtByte, 8, ubPreBit, usWidth);
@@ -1179,22 +1174,22 @@ static long scan_map (unsigned char *in_buf,
lScanSize += lTmp;
}
/* complex pattern*/
- else
+ else
{
- for (k = 0; k < 2; k++)
+ for (k = 0; k < 2; k++)
{ /*we calculate 4bit*/
ubTemp = (ubCrtByte >> (4 - (k * 4)) ) & 0x0f;
usBytePos = (j << 3) + (k << 2);
- switch (ubTemp)
+ switch (ubTemp)
{
case 0x00:
/* 1 0*/
- if (ubPreBit)
+ if (ubPreBit)
{
lTmp = (*UpdateScanLine[ubSizeMode])(out_buf, us1Count, usDy, usPosX10, usPosX01, usWidth);
out_buf = out_buf + lTmp;
lScanSize += lTmp;
- usPosX10 = usBytePos - us1Count;
+ usPosX10 = usBytePos - us1Count;
us1Count = 0;
usDy = 0;
}
@@ -1208,16 +1203,16 @@ static long scan_map (unsigned char *in_buf,
us1Count += 4;
}
/* 0 1*/
- else
+ else
{
us1Count = 4;
- usPosX01 = (j << 3) + (k << 2);
+ usPosX01 = (j << 3) + (k << 2);
}
break;
case 0x05:
/* 1 0101*/
- if (ubPreBit)
+ if (ubPreBit)
{
lTmp = (*UpdateScanLine[ubSizeMode])(out_buf, us1Count, usDy, usPosX10, usPosX01, usWidth);
out_buf = out_buf + lTmp;
@@ -1246,7 +1241,7 @@ static long scan_map (unsigned char *in_buf,
us1Count++;
}
/* 0 1001*/
- else
+ else
{
usPosX01 = usBytePos;
us1Count = 1;
@@ -1257,7 +1252,7 @@ static long scan_map (unsigned char *in_buf,
/* next*/
if (ubPreBit)
- {
+ {
usPosX10 = usBytePos - us1Count + 1;
usPosX01 = usBytePos + 3;
}
@@ -1265,7 +1260,7 @@ static long scan_map (unsigned char *in_buf,
{
usPosX10 = 0;
usPosX01 = 3;
- }
+ }
usDy = 0;
us1Count = 1;
break;
@@ -1277,7 +1272,7 @@ static long scan_map (unsigned char *in_buf,
us1Count++;
}
/* 0 1010*/
- else
+ else
{
us1Count = 1;
usPosX01 = usBytePos;
@@ -1305,7 +1300,7 @@ static long scan_map (unsigned char *in_buf,
us1Count++;
}
/* 0 1011*/
- else
+ else
{
us1Count = 1;
usPosX01 = usBytePos;
@@ -1316,7 +1311,7 @@ static long scan_map (unsigned char *in_buf,
/* next*/
if (ubPreBit)
- {
+ {
usPosX10 = usBytePos - us1Count + 1;
usPosX01 = usBytePos + 2;
}
@@ -1324,7 +1319,7 @@ static long scan_map (unsigned char *in_buf,
{
usPosX10 = 0;
usPosX01 = 2;
- }
+ }
usDy = 0;
us1Count = 2;
@@ -1337,7 +1332,7 @@ static long scan_map (unsigned char *in_buf,
us1Count += 2;
}
/* 0 1101*/
- else
+ else
{
us1Count = 2;
usPosX01 = usBytePos;
@@ -1353,10 +1348,10 @@ static long scan_map (unsigned char *in_buf,
usPosX01 = usBytePos + 3;
}
else
- {
+ {
usPosX10 = 0;
usPosX01 = 3;
- }
+ }
usDy = 0;
us1Count = 1;
break;
@@ -1377,7 +1372,7 @@ static long scan_map (unsigned char *in_buf,
ubPreBit = ubCrtByte & 0x01;
} /*for usWidth */
- if (us1Count)
+ if (us1Count)
{
lTmp = (*UpdateScanLine[ubSizeMode])(out_buf, us1Count, usDy, usPosX10, usPosX01, usWidth);
out_buf = out_buf + lTmp;
@@ -1391,7 +1386,7 @@ static long scan_map (unsigned char *in_buf,
usDy++;
/* check size over*/
- if ( (i % 5) == 4 )
+ if ( (i % 5) == 4 )
{
lCrtSize = (long)((long)usWidth * (long)(i + 1));
if ( lScanSize >= lCrtSize )
@@ -1422,16 +1417,16 @@ static long scan_map (unsigned char *in_buf,
* P : scanline table compression
****************************************************************/
long bmp2run(unsigned char *out_buf, unsigned char *in_buf, unsigned int sizeY, unsigned int sizeX, unsigned char ubMode)
-{
+{
unsigned char *tmp_buf1, *tmp_buf2;
long scan_size;
/*return(-1);*/ /* 19990323 by bglee - request from SM Lee*/
-
+
tmp_buf1 = in_buf;
tmp_buf2 = out_buf;
scan_size = scan_map(tmp_buf1, tmp_buf2, sizeX, sizeY, ubMode);
- if (scan_size == -1)
+ if (scan_size == -1)
{
return(-1);
}
@@ -1442,7 +1437,7 @@ long bmp2run(unsigned char *out_buf, unsigned char *in_buf, unsigned int sizeY,
*out_buf++ = 0x00;
*out_buf++ = 0x00;
scan_size += 2;
- if (scan_size % 4)
+ if (scan_size % 4)
{
*out_buf++ = 0x00;
*out_buf++ = 0x00;
@@ -1452,11 +1447,10 @@ long bmp2run(unsigned char *out_buf, unsigned char *in_buf, unsigned int sizeY,
else /* pre-compression*/
{
scan_size += 2;
- if (scan_size % 4)
+ if (scan_size % 4)
{
scan_size += 2;
}
}
- return(scan_size);
-}
-
+ return(scan_size);
+}
diff --git a/gs/contrib/gdevhl12.c b/gs/contrib/gdevhl12.c
index e21878127..db5855581 100644
--- a/gs/contrib/gdevhl12.c
+++ b/gs/contrib/gdevhl12.c
@@ -28,36 +28,36 @@
differ only in the default (maximum) resolution:
-sDEVICE=hl1240
- 600x600 dpi, for HL-1030/1240 (uses standard PCL modes 2 and 3)
+ 600x600 dpi, for HL-1030/1240 (uses standard PCL modes 2 and 3)
-sDEVICE=hl1250
- 1200x600 dpi, for HL-1050/1070/1250/1270N
- (uses special compression mode 1027 for 1200x600 dpi,
- otherwise modes 2 and 3 as above)
+ 1200x600 dpi, for HL-1050/1070/1250/1270N
+ (uses special compression mode 1027 for 1200x600 dpi,
+ otherwise modes 2 and 3 as above)
Tested with a HL-1250, both 1200x600 and 600x600 dpi. Please test
with other models and report results (both problems and success).
Some notes on the other models:
HL-1070 and HL-1270N
- can also print Postscript directly, at maximum 600x600 dpi
- (this driver can print 1200x600 dpi using mode 1027).
+ can also print Postscript directly, at maximum 600x600 dpi
+ (this driver can print 1200x600 dpi using mode 1027).
HL-1240
- should no longer be limited to 300 dpi - this driver sends
- the recommended "@PJL SET RESOLUTION=..." command. PLEASE TEST.
- There have been some vague problem reports (wrong margins? not
- clear for what paper size, quite possibly Letter, not A4?) with
- this printer, if you have it and some Ghostscript hacking skills,
- _please_ try to help, fix it and send me a patch - thanks!
+ should no longer be limited to 300 dpi - this driver sends
+ the recommended "@PJL SET RESOLUTION=..." command. PLEASE TEST.
+ There have been some vague problem reports (wrong margins? not
+ clear for what paper size, quite possibly Letter, not A4?) with
+ this printer, if you have it and some Ghostscript hacking skills,
+ _please_ try to help, fix it and send me a patch - thanks!
HL-1030
- should no longer be "Paperweight" despite the "for Windows only"
- warning :-) - it knows enough PCL to print raster graphics, but
- *requires* "@PJL ENTER LANGUAGE=PCL", so it does not work with
- the ljet4 driver sending raw PCL. The windows driver uses an
- undocumented compression mode 1030, but modes 2 and 3 work too.
- PLEASE TEST.
+ should no longer be "Paperweight" despite the "for Windows only"
+ warning :-) - it knows enough PCL to print raster graphics, but
+ *requires* "@PJL ENTER LANGUAGE=PCL", so it does not work with
+ the ljet4 driver sending raw PCL. The windows driver uses an
+ undocumented compression mode 1030, but modes 2 and 3 work too.
+ PLEASE TEST.
New models, still need to be tested:
HL-1230 (GDI printer)
@@ -68,15 +68,15 @@
Additional settings (gs command line options) for this driver:
-dEconoMode=0...2
- toner save mode: 0 = disabled (default), 1 = 25%, 2 = 50%
+ toner save mode: 0 = disabled (default), 1 = 25%, 2 = 50%
-dPaperType=0...4
- paper type: 0 = plain (default), 1 = thin, 2 = thick, 3 = thicker,
- 4 = transparency
+ paper type: 0 = plain (default), 1 = thin, 2 = thick, 3 = thicker,
+ 4 = transparency
-dSourceTray=0...4
- paper source: 0 = auto (default), 1 = dual, 2 = upper, 3 = lower,
- 4 = manual (not all models support the optional lower tray)
+ paper source: 0 = auto (default), 1 = dual, 2 = upper, 3 = lower,
+ 4 = manual (not all models support the optional lower tray)
The 1200x600 dpi mode may require a lot of printer memory - the manual
recommends at least 10 MB; for me it seems to work well with 8 MB: 4 MB
@@ -161,15 +161,15 @@ static dev_proc_put_params(hl1250_put_params);
static const gx_device_procs prn_hl1250_procs =
prn_params_procs(hl1250_open, gdev_prn_output_page, hl1250_close,
- hl1250_get_params, hl1250_put_params);
+ hl1250_get_params, hl1250_put_params);
#define hl1250_device_copies(dname, xdpi, ydpi)\
{ prn_device_std_body_copies(gx_device_hl1250, prn_hl1250_procs,\
- dname,\
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
- xdpi, ydpi,\
- 0, 0, 0, 0,\
- 1, hl1250_print_page_copies),\
+ dname,\
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
+ xdpi, ydpi,\
+ 0, 0, 0, 0,\
+ 1, hl1250_print_page_copies),\
ECONO_OFF, PTYPE_PLAIN, TRAY_AUTO\
}
@@ -256,32 +256,32 @@ hl1250_check_area(hl1250_state_t * s)
ybottom = s->yt;
ytop = s->yb;
for (y = s->yt; y < s->yb; y++) {
- line_not_white = 0;
- for (x = s->xl; x < s->xr; x++) {
- if (s->in_buf[y][x]) {
- if (xleft > x)
- xleft = x;
- if (xright <= x)
- xright = x + 1;
- line_not_white = 1;
- }
- }
- if (line_not_white) {
- if (ytop > y)
- ytop = y;
- if (ybottom <= y)
- ybottom = y + 1;
- band_not_white = 1;
- }
+ line_not_white = 0;
+ for (x = s->xl; x < s->xr; x++) {
+ if (s->in_buf[y][x]) {
+ if (xleft > x)
+ xleft = x;
+ if (xright <= x)
+ xright = x + 1;
+ line_not_white = 1;
+ }
+ }
+ if (line_not_white) {
+ if (ytop > y)
+ ytop = y;
+ if (ybottom <= y)
+ ybottom = y + 1;
+ band_not_white = 1;
+ }
}
if (band_not_white) {
- s->xl = xleft;
- s->xr = xright;
- s->yt = ytop;
- s->yb = ybottom;
+ s->xl = xleft;
+ s->xr = xright;
+ s->yt = ytop;
+ s->yb = ybottom;
} else {
- s->xr = s->xl;
- s->yb = s->yt;
+ s->xr = s->xl;
+ s->yb = s->yt;
}
return band_not_white;
}
@@ -303,18 +303,18 @@ hl1250_lose_resolution(hl1250_state_t * s)
out = s->out_buf;
for (y = s->yt; y < s->yb; y += 2) {
- line0 = &s->in_buf[y][s->xl];
- line1 = line0;
- if (y + 1 < s->yb)
- line1 = &s->in_buf[y + 1][s->xl];
- mask = (y & 2) ? 0x5555 : 0xAAAA;
- *out++ = cpu_to_be16(HL_COPY(width));
- for (x = 0; x < width; x++) {
- data0 = line0[x];
- data1 = line1[x];
- *out++ = (data0 & data1) | (data0 & mask) | (data1 & mask);
- }
- *out++ = cpu_to_be16(HL_VERT(width));
+ line0 = &s->in_buf[y][s->xl];
+ line1 = line0;
+ if (y + 1 < s->yb)
+ line1 = &s->in_buf[y + 1][s->xl];
+ mask = (y & 2) ? 0x5555 : 0xAAAA;
+ *out++ = cpu_to_be16(HL_COPY(width));
+ for (x = 0; x < width; x++) {
+ data0 = line0[x];
+ data1 = line1[x];
+ *out++ = (data0 & data1) | (data0 & mask) | (data1 & mask);
+ }
+ *out++ = cpu_to_be16(HL_VERT(width));
}
s->out_count = out - s->out_buf;
}
@@ -344,90 +344,90 @@ hl1250_compress_line(hl1250_state_t * s, unsigned int y)
copy_len = 0;
total_len = s->out_count;
while (x < width) {
- data = line[x];
-
- /* how many words (hlen >= 1) to repeat */
- for (i = x + 1; i < width; i++) {
- if (line[i] != data)
- break;
- }
- hlen = i - x;
- /* if not the first line, try vertical compression */
- vlen = 0;
- if (prev) {
- for (i = x; i < width; i++) {
- if (line[i] != prev[i])
- break;
- }
- vlen = i - x;
- }
- /* find the best method to encode the data */
- ulen = hlen;
- clen = 1;
- if (vlen >= hlen) {
- /* vertical compression */
- ulen = vlen;
- hl_code = HL_VERT(vlen);
- } else if ((data ^ (data >> 8)) & 0xFF) {
- /* 16-bit horizontal compression */
- hl_code = HL_HOR16(hlen);
- clen = 2;
- } else if ((data ^ (data >> 4)) & 0x0F) {
- /* 8-bit horizontal compression (if possible) */
- if (hlen < 32) {
- hl_code = HL_HOR8(hlen, data);
- } else {
- hl_code = HL_HOR16(hlen);
- clen = 2;
- }
- } else {
- /* 4-bit horizontal compression (if possible) */
- if (hlen < 512) {
- hl_code = HL_HOR4(hlen, data);
- } else {
- hl_code = HL_HOR16(hlen);
- clen = 2;
- }
- }
- /*
- now see if we should copy the word without compression
- (the cost of leaving/re-entering copy mode is one word).
- */
- if (ulen < clen + (copy_len > 0)) {
- /* yes, copy */
- copy_len += ulen;
- } else {
- if (copy_len) {
- /* first, copy data (if any) */
- total_len += copy_len + 1;
- if (total_len > MAX_BAND_WORDS)
- goto error_out;
- *out++ = cpu_to_be16(HL_COPY(copy_len));
- memcpy(out, &line[x - copy_len], copy_len * sizeof(u16));
- out += copy_len;
- copy_len = 0;
- }
- /* now send the current code */
- total_len += clen;
- if (total_len > MAX_BAND_WORDS)
- goto error_out;
- *out++ = cpu_to_be16(hl_code);
- if (clen == 2) {
- /* 16-bit compression */
- *out++ = data;
- }
- }
- /* move to the next word to process */
- x += ulen;
+ data = line[x];
+
+ /* how many words (hlen >= 1) to repeat */
+ for (i = x + 1; i < width; i++) {
+ if (line[i] != data)
+ break;
+ }
+ hlen = i - x;
+ /* if not the first line, try vertical compression */
+ vlen = 0;
+ if (prev) {
+ for (i = x; i < width; i++) {
+ if (line[i] != prev[i])
+ break;
+ }
+ vlen = i - x;
+ }
+ /* find the best method to encode the data */
+ ulen = hlen;
+ clen = 1;
+ if (vlen >= hlen) {
+ /* vertical compression */
+ ulen = vlen;
+ hl_code = HL_VERT(vlen);
+ } else if ((data ^ (data >> 8)) & 0xFF) {
+ /* 16-bit horizontal compression */
+ hl_code = HL_HOR16(hlen);
+ clen = 2;
+ } else if ((data ^ (data >> 4)) & 0x0F) {
+ /* 8-bit horizontal compression (if possible) */
+ if (hlen < 32) {
+ hl_code = HL_HOR8(hlen, data);
+ } else {
+ hl_code = HL_HOR16(hlen);
+ clen = 2;
+ }
+ } else {
+ /* 4-bit horizontal compression (if possible) */
+ if (hlen < 512) {
+ hl_code = HL_HOR4(hlen, data);
+ } else {
+ hl_code = HL_HOR16(hlen);
+ clen = 2;
+ }
+ }
+ /*
+ now see if we should copy the word without compression
+ (the cost of leaving/re-entering copy mode is one word).
+ */
+ if (ulen < clen + (copy_len > 0)) {
+ /* yes, copy */
+ copy_len += ulen;
+ } else {
+ if (copy_len) {
+ /* first, copy data (if any) */
+ total_len += copy_len + 1;
+ if (total_len > MAX_BAND_WORDS)
+ goto error_out;
+ *out++ = cpu_to_be16(HL_COPY(copy_len));
+ memcpy(out, &line[x - copy_len], copy_len * sizeof(u16));
+ out += copy_len;
+ copy_len = 0;
+ }
+ /* now send the current code */
+ total_len += clen;
+ if (total_len > MAX_BAND_WORDS)
+ goto error_out;
+ *out++ = cpu_to_be16(hl_code);
+ if (clen == 2) {
+ /* 16-bit compression */
+ *out++ = data;
+ }
+ }
+ /* move to the next word to process */
+ x += ulen;
}
/* copy anything left at the end */
if (copy_len) {
- total_len += copy_len + 1;
- if (total_len > MAX_BAND_WORDS)
- goto error_out;
- *out++ = cpu_to_be16(HL_COPY(copy_len));
- memcpy(out, &line[width - copy_len], copy_len * sizeof(u16));
- out += copy_len;
+ total_len += copy_len + 1;
+ if (total_len > MAX_BAND_WORDS)
+ goto error_out;
+ *out++ = cpu_to_be16(HL_COPY(copy_len));
+ memcpy(out, &line[width - copy_len], copy_len * sizeof(u16));
+ out += copy_len;
}
error_out:
s->out_count = out - s->out_buf;
@@ -457,7 +457,7 @@ hl1250_compress_band(FILE * prn_stream, hl1250_state_t * s, unsigned int band)
s->out_count = 0;
if (!hl1250_check_area(s))
- return;
+ return;
/*
It seems HL-1250 1200x600 dpi mode has an undocumented feature -
@@ -470,31 +470,30 @@ hl1250_compress_band(FILE * prn_stream, hl1250_state_t * s, unsigned int band)
ytop = s->yt;
ybottom = s->yb;
for (y = ytop; y < ybottom; y++) {
- if (hl1250_compress_line(s, y))
- continue;
+ if (hl1250_compress_line(s, y))
+ continue;
#if 1
- /* XXX - please report if you ever see this, then change to #if 0 */
- dprintf1("hl1250: compression failed (y=%u), doing 1200x300 dpi\n",
- band + y);
+ /* XXX - please report if you ever see this, then change to #if 0 */
+ dprintf1("hl1250: compression failed (y=%u), doing 1200x300 dpi\n",
+ band + y);
#endif
- hl1250_lose_resolution(s);
- break;
+ hl1250_lose_resolution(s);
+ break;
}
if (s->out_count) {
- fprintf(prn_stream, "\033*b%uW", s->out_count * sizeof(u16) + 9);
- put_be16(prn_stream, s->out_count * sizeof(u16) + 7);
- put_be16(prn_stream, s->xl * 16);
- put_be16(prn_stream, band + ytop);
- putc(ybottom - ytop, prn_stream);
- put_be16(prn_stream, s->xr - s->xl);
- fwrite(s->out_buf, sizeof(u16), s->out_count, prn_stream);
+ fprintf(prn_stream, "\033*b%uW", s->out_count * sizeof(u16) + 9);
+ put_be16(prn_stream, s->out_count * sizeof(u16) + 7);
+ put_be16(prn_stream, s->xl * 16);
+ put_be16(prn_stream, band + ytop);
+ putc(ybottom - ytop, prn_stream);
+ put_be16(prn_stream, s->xr - s->xl);
+ fwrite(s->out_buf, sizeof(u16), s->out_count, prn_stream);
}
}
-
static int
hl1250_print_1200dpi(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies, const char *page_init)
+ int num_copies, const char *page_init)
{
int band, lnum;
int code = 0;
@@ -504,18 +503,18 @@ hl1250_print_1200dpi(gx_device_printer * pdev, FILE * prn_stream,
int paper_size = gdev_pcl_paper_size((gx_device *) pdev);
s = (hl1250_state_t *) gs_alloc_byte_array(pdev->memory, 1, sizeof(*s),
- "hl1250_print_1200dpi");
+ "hl1250_print_1200dpi");
if (!s)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
memset(s, 0, sizeof(*s));
if (line_size > sizeof(s->in_buf[0]))
- line_size = sizeof(s->in_buf[0]);
+ line_size = sizeof(s->in_buf[0]);
if (pdev->PageCount == 0) {
- /* reset, set paper size */
- fprintf(prn_stream, "\033E\033&l%dA", paper_size);
+ /* reset, set paper size */
+ fprintf(prn_stream, "\033E\033&l%dA", paper_size);
}
fputs("\033&u1200D", prn_stream);
fputs("\033&l0o0l0E", prn_stream);
@@ -533,21 +532,21 @@ hl1250_print_1200dpi(gx_device_printer * pdev, FILE * prn_stream,
fputs("\033*b1027M", prn_stream);
for (band = 0; band < num_rows; band += BAND_SCANS) {
- int next_band = band + BAND_SCANS;
-
- if (next_band > num_rows)
- next_band = num_rows;
- for (lnum = band; lnum < next_band; lnum++) {
- code = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *) (s->in_buf[lnum - band]), line_size);
- if (code < 0)
- goto error_out;
- }
- s->yt = 0;
- s->yb = next_band - band;
- s->xl = 0;
- s->xr = 635; /* max width */
- hl1250_compress_band(prn_stream, s, band);
+ int next_band = band + BAND_SCANS;
+
+ if (next_band > num_rows)
+ next_band = num_rows;
+ for (lnum = band; lnum < next_band; lnum++) {
+ code = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *) (s->in_buf[lnum - band]), line_size);
+ if (code < 0)
+ goto error_out;
+ }
+ s->yt = 0;
+ s->yb = next_band - band;
+ s->xl = 0;
+ s->xr = 635; /* max width */
+ hl1250_compress_band(prn_stream, s, band);
}
error_out:
fputs("\033*rB\f", prn_stream);
@@ -555,7 +554,6 @@ hl1250_print_1200dpi(gx_device_printer * pdev, FILE * prn_stream,
return code;
}
-
static int
hl1250_open(gx_device * pdev)
{
@@ -570,15 +568,15 @@ hl1250_open(gx_device * pdev)
int paper_size = gdev_pcl_paper_size(pdev);
if (x_dpi == 1200) {
- if (paper_size == PAPER_SIZE_A4)
- gx_device_set_margins(pdev, margins_a4_1200, true);
- else
- gx_device_set_margins(pdev, margins_letter_1200, true);
+ if (paper_size == PAPER_SIZE_A4)
+ gx_device_set_margins(pdev, margins_a4_1200, true);
+ else
+ gx_device_set_margins(pdev, margins_letter_1200, true);
} else {
- if (paper_size == PAPER_SIZE_A4)
- gx_device_set_margins(pdev, margins_a4_600, false);
- else
- gx_device_set_margins(pdev, margins_letter_600, false);
+ if (paper_size == PAPER_SIZE_A4)
+ gx_device_set_margins(pdev, margins_a4_600, false);
+ else
+ gx_device_set_margins(pdev, margins_letter_600, false);
}
return gdev_prn_open(pdev);
}
@@ -595,7 +593,7 @@ hl1250_close(gx_device * pdev)
FILE *fp;
if (code < 0)
- return code;
+ return code;
fp = ((gx_device_printer *) pdev)->file;
/* job separation, reset, UEL */
fputs("\033&l1T\033E", fp);
@@ -605,10 +603,9 @@ hl1250_close(gx_device * pdev)
return gdev_prn_close(pdev);
}
-
static int
hl1250_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
- int num_copies)
+ int num_copies)
{
int x_dpi = (int)pdev->x_pixels_per_inch;
int y_dpi = (int)pdev->y_pixels_per_inch;
@@ -620,54 +617,54 @@ hl1250_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
hl1250_tray_t source_tray = hl1250->source_tray;
static const char * const onoff[2] = { "OFF", "ON" };
static const char * const papertypes[5] =
- { "REGULAR", "THIN", "THICK", "THICK2", "TRANSPARENCY" };
+ { "REGULAR", "THIN", "THICK", "THICK2", "TRANSPARENCY" };
tray_pjl = "AUTO";
tray_pcl = "";
switch (source_tray) {
- case TRAY_DUAL:
- tray_pcl = "\033&l0H";
- break;
- case TRAY_UPPER:
- tray_pjl = "TRAY1";
- tray_pcl = "\033&l1H";
- break;
- case TRAY_LOWER:
- tray_pjl = "TRAY2";
- tray_pcl = "\033&l5H";
- break;
- case TRAY_MANUAL:
- tray_pcl = "\033&l2H";
- break;
- default:
- break;
+ case TRAY_DUAL:
+ tray_pcl = "\033&l0H";
+ break;
+ case TRAY_UPPER:
+ tray_pjl = "TRAY1";
+ tray_pcl = "\033&l1H";
+ break;
+ case TRAY_LOWER:
+ tray_pjl = "TRAY2";
+ tray_pcl = "\033&l5H";
+ break;
+ case TRAY_MANUAL:
+ tray_pcl = "\033&l2H";
+ break;
+ default:
+ break;
}
if (pdev->PageCount == 0) {
- /* initialize printer */
- fputs(UEL, prn_stream);
- fputs("@PJL \r\n", prn_stream);
- fprintf(prn_stream, "@PJL JOB NAME=\"%s\"\r\n", PJL_JOB_NAME);
- fprintf(prn_stream, "@PJL SET ECONOMODE=%s\n", onoff[econo_mode != 0]);
- if (econo_mode)
- fprintf(prn_stream, "@PJL SET ECONOLEVEL=%d\n", 3 - (int)econo_mode);
- fprintf(prn_stream, "@PJL SET MEDIATYPE=%s\n", papertypes[paper_type]);
- fprintf(prn_stream, "@PJL SET SOURCETRAY=%s\n", tray_pjl);
- fprintf(prn_stream, "@PJL SET RESOLUTION=%d\n", y_dpi);
- fprintf(prn_stream, "@PJL SET RAS1200MODE=%s\n", onoff[x_dpi == 1200]);
-
- fputs("@PJL ENTER LANGUAGE=PCL\n", prn_stream);
+ /* initialize printer */
+ fputs(UEL, prn_stream);
+ fputs("@PJL \r\n", prn_stream);
+ fprintf(prn_stream, "@PJL JOB NAME=\"%s\"\r\n", PJL_JOB_NAME);
+ fprintf(prn_stream, "@PJL SET ECONOMODE=%s\n", onoff[econo_mode != 0]);
+ if (econo_mode)
+ fprintf(prn_stream, "@PJL SET ECONOLEVEL=%d\n", 3 - (int)econo_mode);
+ fprintf(prn_stream, "@PJL SET MEDIATYPE=%s\n", papertypes[paper_type]);
+ fprintf(prn_stream, "@PJL SET SOURCETRAY=%s\n", tray_pjl);
+ fprintf(prn_stream, "@PJL SET RESOLUTION=%d\n", y_dpi);
+ fprintf(prn_stream, "@PJL SET RAS1200MODE=%s\n", onoff[x_dpi == 1200]);
+
+ fputs("@PJL ENTER LANGUAGE=PCL\n", prn_stream);
}
if (x_dpi != 1200) {
- char page_init[100];
+ char page_init[100];
- /* We get the printer to translate the coordinate system for us.
- It seems the HL-1250 needs a slightly different translation
- (-120, 0) compared to the one in the ljet4 driver (-180, 36)
- (X, Y coordinates here are specified in 1/720-inch units). */
+ /* We get the printer to translate the coordinate system for us.
+ It seems the HL-1250 needs a slightly different translation
+ (-120, 0) compared to the one in the ljet4 driver (-180, 36)
+ (X, Y coordinates here are specified in 1/720-inch units). */
- sprintf(page_init, "\033&l-120U\033*r0F\033&u%dD%s", y_dpi, tray_pcl);
- return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
- y_dpi, PCL_LJ4_FEATURES,
+ sprintf(page_init, "\033&l-120U\033*r0F\033&u%dD%s", y_dpi, tray_pcl);
+ return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
+ y_dpi, PCL_LJ4_FEATURES,
page_init, page_init, false);
}
return hl1250_print_1200dpi(pdev, prn_stream, num_copies, tray_pcl);
@@ -675,21 +672,21 @@ hl1250_print_page_copies(gx_device_printer * pdev, FILE * prn_stream,
static int
hl1250_put_param_int(gs_param_list * plist, gs_param_name pname,
- int *pvalue, int minval, int maxval, int ecode)
+ int *pvalue, int minval, int maxval, int ecode)
{
int code, value;
code = param_read_int(plist, pname, &value);
switch (code) {
- case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
- case 1:
- return ecode;
- default:
- return code;
+ case 0:
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
+ case 1:
+ return ecode;
+ default:
+ return code;
}
}
@@ -701,15 +698,15 @@ hl1250_get_params(gx_device * pdev, gs_param_list * plist)
code = gdev_prn_get_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
val = hl1250->econo_mode;
code = param_write_int(plist, "EconoMode", &val);
if (code < 0)
- return code;
+ return code;
val = hl1250->paper_type;
code = param_write_int(plist, "PaperType", &val);
if (code < 0)
- return code;
+ return code;
val = hl1250->source_tray;
code = param_write_int(plist, "SourceTray", &val);
return code;
@@ -725,16 +722,16 @@ hl1250_put_params(gx_device * pdev, gs_param_list * plist)
int source_tray = hl1250->source_tray;
code = hl1250_put_param_int(plist, "EconoMode", &econo_mode,
- ECONO_OFF, ECONO_50, code);
+ ECONO_OFF, ECONO_50, code);
code = hl1250_put_param_int(plist, "PaperType", &paper_type,
- PTYPE_PLAIN, PTYPE_TRANS, code);
+ PTYPE_PLAIN, PTYPE_TRANS, code);
code = hl1250_put_param_int(plist, "SourceTray", &source_tray,
- TRAY_AUTO, TRAY_MANUAL, code);
+ TRAY_AUTO, TRAY_MANUAL, code);
if (code < 0)
- return code;
+ return code;
code = gdev_prn_put_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
hl1250->econo_mode = econo_mode;
hl1250->paper_type = paper_type;
hl1250->source_tray = source_tray;
diff --git a/gs/contrib/gdevln03.c b/gs/contrib/gdevln03.c
index 474c191d5..1da5419a6 100644
--- a/gs/contrib/gdevln03.c
+++ b/gs/contrib/gdevln03.c
@@ -26,7 +26,7 @@ This code is subject to the GNU General Public License
ulm 91-02-13 created as driver for gs 2.1.1
ulm 91-07-23 adapted to gs 2.2
ulm 91-08-21 changed memory allocation to gs_malloc,
- ported to VMS (contributed by Martin Stiftinger, TU Vienna)
+ ported to VMS (contributed by Martin Stiftinger, TU Vienna)
lpd 91-11-24 sped up by removing multiplies from inner loop
ijmp 92-04-14 add support for la75/la50 (macphed@dvinci.usask.ca)
ulm 92-09-25 support letter size paper (8.5" x 11")
@@ -60,10 +60,10 @@ static gx_device_procs sixel_procs =
#endif
gx_device_printer gs_ln03_device =
prn_device(sixel_procs, "ln03",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 300, 300, /* x_dpi, y_dpi */
- 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */
- 1, ln03_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 300, 300, /* x_dpi, y_dpi */
+ 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */
+ 1, ln03_print_page);
/*
* Initialization string: switch to graphics mode, 300 dpi
@@ -97,10 +97,10 @@ ln03_print_page(gx_device_printer *pdev, FILE *prn_stream)
static dev_proc_print_page(dl2100_print_page);
gx_device_printer gs_dl2100_device =
prn_device(sixel_procs, "dl2100",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 300, 300, /* x_dpi, y_dpi */
- 0, 0, 0, 0, /* left, bottom, right, top margin */
- 1, dl2100_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 300, 300, /* x_dpi, y_dpi */
+ 0, 0, 0, 0, /* left, bottom, right, top margin */
+ 1, dl2100_print_page);
/*
* Initialization string: same as for LN03, plus top/bottom margins.
@@ -122,11 +122,11 @@ dl2100_print_page(gx_device_printer *pdev, FILE *prn_stream)
static dev_proc_print_page(la50_print_page);
gx_device_printer gs_la50_device =
prn_device(sixel_procs, "la50",
- 85,
- 110,
- 144, 72,
- 0, 0, 0.5, 0,
- 1, la50_print_page);
+ 85,
+ 110,
+ 144, 72,
+ 0, 0, 0.5, 0,
+ 1, la50_print_page);
/* LA50's use a very primitive form of initialization */
#define LA50_INIT "\033Pq"
@@ -149,11 +149,11 @@ la50_print_page(gx_device_printer *pdev, FILE *prn_stream)
static dev_proc_print_page(la70_print_page);
gx_device_printer gs_la70_device =
prn_device(sixel_procs, "la70",
- 85,
- 110,
- 144, 144,
- 0, 0, 0.5, 0,
- 1, la70_print_page);
+ 85,
+ 110,
+ 144, 144,
+ 0, 0, 0.5, 0,
+ 1, la70_print_page);
#define LA70_INIT "\033P0;0;0q\"1;1"
@@ -175,11 +175,11 @@ la70_print_page(gx_device_printer *pdev, FILE *prn_stream)
static dev_proc_print_page(la75_print_page);
gx_device_printer gs_la75_device =
prn_device(sixel_procs, "la75",
- 85,
- 110,
- 144, 72,
- 0, 0, 0.5, 0,
- 1, la75_print_page);
+ 85,
+ 110,
+ 144, 72,
+ 0, 0, 0.5, 0,
+ 1, la75_print_page);
#define LA75_INIT "\033P0;0;0q"
@@ -262,9 +262,9 @@ sxlcrt_print_page(gx_device_printer *pdev, FILE *prn_stream)
static int
sixel_output_page(gx_device *pdev, int num_copies, int flush)
{ int code = gdev_prn_open_printer(pdev, 0);
- if ( code < 0 )
- return code;
- return gdev_prn_output_page(pdev, num_copies, flush);
+ if ( code < 0 )
+ return code;
+ return gdev_prn_output_page(pdev, num_copies, flush);
}
/* Send the page to the printer. */
@@ -289,32 +289,32 @@ sixel_print_page(gx_device_printer *pdev, FILE *prn_stream,
/* Print lines of graphics */
for (lnum = lcount = 0; lnum < pdev->height; lnum+=6, lcount++) {
- gdev_prn_copy_scan_lines(pdev, lnum, inp = in, line_size * 6);
-
- mask = 0200;
- oldc = 077;
- empty = 1;
-
- for (l = pdev->width, count = 0; --l >= 0; count++) {
- /* transpose 6*8 rectangle */
- register byte *iptr = inp;
- c = 077;
- if (*iptr & mask)
- c += 1;
- if (*(iptr += line_size) & mask)
- c += 2;
- if (*(iptr += line_size) & mask)
- c += 4;
- if (*(iptr += line_size) & mask)
- c += 010;
- if (*(iptr += line_size) & mask)
- c += 020;
- if (*(iptr += line_size) & mask)
- c += 040;
- if (!(mask >>= 1)) {
- mask = 0200;
- inp++;
- }
+ gdev_prn_copy_scan_lines(pdev, lnum, inp = in, line_size * 6);
+
+ mask = 0200;
+ oldc = 077;
+ empty = 1;
+
+ for (l = pdev->width, count = 0; --l >= 0; count++) {
+ /* transpose 6*8 rectangle */
+ register byte *iptr = inp;
+ c = 077;
+ if (*iptr & mask)
+ c += 1;
+ if (*(iptr += line_size) & mask)
+ c += 2;
+ if (*(iptr += line_size) & mask)
+ c += 4;
+ if (*(iptr += line_size) & mask)
+ c += 010;
+ if (*(iptr += line_size) & mask)
+ c += 020;
+ if (*(iptr += line_size) & mask)
+ c += 040;
+ if (!(mask >>= 1)) {
+ mask = 0200;
+ inp++;
+ }
if (c != oldc) {
if (empty) {
diff --git a/gs/contrib/gdevlx32.c b/gs/contrib/gdevlx32.c
index aeb2e875a..bb19f36ae 100644
--- a/gs/contrib/gdevlx32.c
+++ b/gs/contrib/gdevlx32.c
@@ -3,7 +3,7 @@
*
* version 0.4.1
*
- * Copyright 2000 by Daniel Gordini (dgordin@tin.it)
+ * Copyright 2000 by Daniel Gordini (dgordin@tin.it)
*
* --------------------------------------------------------------------
*
@@ -20,13 +20,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
+ *
* --------------------------------------------------------------------
*
* This driver is almost 100% original code but it is based
- * on protocol information partly discovered by Andrew Onifer III
- * (http://www.mindspring.com/~aonifer) and Peter B. West
- * (http://www.powerup.com.au/~pbwest) that were used as a starting
+ * on protocol information partly discovered by Andrew Onifer III
+ * (http://www.mindspring.com/~aonifer) and Peter B. West
+ * (http://www.powerup.com.au/~pbwest) that were used as a starting
* base for the reverse-engineering of the protocol.
*
* Please mail me bug reports, comments and suggestions.
@@ -90,27 +90,27 @@ static void print_photo_page(void);
#define LXM3200_C 1 /* Standard color mode */
#define LXM3200_P 2 /* Photo color mode */
-/* Initial horizontal position for the printheads,
+/* Initial horizontal position for the printheads,
* in 1200ths of an inch. Note that "left" and "right"
- * head here refers to paper margin, and so looking at
+ * head here refers to paper margin, and so looking at
* them from the front of printer they will appear reversed.
*/
/* Left head (B&W/photo) start position */
#define LHSTART (gendata.leftoffset+6254)
/* added for Lexmark Z12 28.09.2002 */
-#define LHSTART_z12 (gendata.leftoffset+5000)
+#define LHSTART_z12 (gendata.leftoffset+5000)
-/* Right head (color) start position. This is relative to
+/* Right head (color) start position. This is relative to
* LHSTART so we only need to change one parameter to adjust
* the head starting position. In the case of the Lexmark Z12
- * we have only one cartridge: black or color, so
+ * we have only one cartridge: black or color, so
* LHSTART_Z12 = RHSTART_Z12
*/
#define RHSTART (LHSTART-2120)
#define RHSTART_z12 (LHSTART_z12) /* added for Lexmark Z12 28.9.2002 */
-/* Difference in starting position between left-to-right
+/* Difference in starting position between left-to-right
* and right-to-left passes, in 1200ths of an inch.
* Obviously only used in bidirectional mode.
*/
@@ -136,13 +136,13 @@ static void print_photo_page(void);
/* Offset of color pens from first row, in 1/600ths of an inch.
* Pen 0 is the topmost and is the CYAN or LIGHTCYAN pen (depending
- * on the cartridge: standard color or photo). Pen 1 is the middle
- * one, which carries MAGENTA or LIGHTMAGENTA color. Pen 2 is the
+ * on the cartridge: standard color or photo). Pen 1 is the middle
+ * one, which carries MAGENTA or LIGHTMAGENTA color. Pen 2 is the
* bottom one, which is YELLOW or BLACK.
*/
#define PEN0OFS 0
#define PEN1OFS 92
-#define PEN2OFS 184
+#define PEN2OFS 184
/* Number of nozzles in each pen type */
#define COLORPEN 64 /* Each color pen of a color/photo cartridge */
@@ -164,9 +164,9 @@ static void print_photo_page(void);
#define LHDATA 0x02 /* The buffer contains data for the left head */
#define RHDATA 0x04 /* The buffer contains data for the right head */
-/* Printer's margins, in inches. The Lexmark 3200 has two settings
- * for the side margins: one is used with A4-sized paper and one
- * (here called conventionally "LETTER") is used for all other paper
+/* Printer's margins, in inches. The Lexmark 3200 has two settings
+ * for the side margins: one is used with A4-sized paper and one
+ * (here called conventionally "LETTER") is used for all other paper
* sizes. Envelopes have different margins as well, but under ghostscript
* it's quite hard to know, from inside a printer driver, if we are
* printing on envelopes or on standard paper, so we just ignore that.
@@ -184,60 +184,59 @@ static void print_photo_page(void);
#define LXM3200_LETTER_TOPOFFSET 84
#define LXM3200_LETTER_LEFTOFFSET 300
-
-/*
- * ------ The device descriptor ------
+/*
+ * ------ The device descriptor ------
*/
/* Device procedures */
static gx_device_procs lxm3200_procs =
prn_color_params_procs(lxm3200_open, gdev_prn_output_page, gdev_prn_close,
- lxm3200_map_rgb_color, lxm3200_map_color_rgb, lxm3200_get_params,
- lxm3200_put_params);
+ lxm3200_map_rgb_color, lxm3200_map_color_rgb, lxm3200_get_params,
+ lxm3200_put_params);
/* Define an extension (subclass) of gx_device_printer. */
-typedef struct lxm_device_s
-{
- gx_device_common;
- gx_prn_device_common;
- int rendermode; /* Rendering mode (BW, CMYK, CcMmYK) */
- int algnA; /* Horizontal alignment between left and right cartridges */
- int algnB; /* Vertical alignment between left and right cartridges */
- int algnC; /* Nozzle column separation of left cartridge */
- int algnD; /* Nozzle column separation of right cartridge */
- int bidir; /* Bidirectional printing active ? */
- int numpass; /* Number of head passes for each stripe */
- int leftoffset; /* Offset of first column from left side of paper */
- int topoffset; /* Offset of first row from top of paper */
+typedef struct lxm_device_s
+{
+ gx_device_common;
+ gx_prn_device_common;
+ int rendermode; /* Rendering mode (BW, CMYK, CcMmYK) */
+ int algnA; /* Horizontal alignment between left and right cartridges */
+ int algnB; /* Vertical alignment between left and right cartridges */
+ int algnC; /* Nozzle column separation of left cartridge */
+ int algnD; /* Nozzle column separation of right cartridge */
+ int bidir; /* Bidirectional printing active ? */
+ int numpass; /* Number of head passes for each stripe */
+ int leftoffset; /* Offset of first column from left side of paper */
+ int topoffset; /* Offset of first row from top of paper */
int model; /* Parameter to choose the model - lxm3200=0, z12=1, z31=2 */
int z31m; /* Alignment parameter for the Z31 */
} lxm_device;
/* Device definition: Lexmark 3200 */
-lxm_device far_data gs_lxm3200_device =
+lxm_device far_data gs_lxm3200_device =
{
- prn_device_body(lxm_device,
- lxm3200_procs,
- "lxm3200",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, /* default x dpi */
- 600, /* default y dpi */
- 0.0, /* left margin, inches (filled-in later) */
- 0.0, /* bottom margin, inches (filled-in later) */
- 0.0, /* right margin, inches (filled-in later) */
- 0.0, /* top margin, inches (filled-in later) */
- 1, /* number of color components (mono) */
- 8, /* bits per pixel */
- 1, /* number of gray levels-1: B&W only */
- 0, /* number of color levels-1: no color */
- 2, /* dither gray: maximum 2 distinct gray levels */
- 0, /* dither rgb: no RGB dithering in this mode */
- lxm3200_print_page),
- LXM3200_C, /* default printing mode */
- 16, 8, 16, 16, /* default aligment parameters value */
- 0, 1, /* default bidirectional and numpasses value */
- 0, 0, /* left and top offsets (filled-in later) */
+ prn_device_body(lxm_device,
+ lxm3200_procs,
+ "lxm3200",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, /* default x dpi */
+ 600, /* default y dpi */
+ 0.0, /* left margin, inches (filled-in later) */
+ 0.0, /* bottom margin, inches (filled-in later) */
+ 0.0, /* right margin, inches (filled-in later) */
+ 0.0, /* top margin, inches (filled-in later) */
+ 1, /* number of color components (mono) */
+ 8, /* bits per pixel */
+ 1, /* number of gray levels-1: B&W only */
+ 0, /* number of color levels-1: no color */
+ 2, /* dither gray: maximum 2 distinct gray levels */
+ 0, /* dither rgb: no RGB dithering in this mode */
+ lxm3200_print_page),
+ LXM3200_C, /* default printing mode */
+ 16, 8, 16, 16, /* default aligment parameters value */
+ 0, 1, /* default bidirectional and numpasses value */
+ 0, 0, /* left and top offsets (filled-in later) */
0, /* default model = Lexmark 3200 */
100 /* default z31m */
};
@@ -249,7 +248,7 @@ static byte bits[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
static byte ibits[8] = { 0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
/* Lookup table for masking color pens in color/photo cartridges.
- * This is used to check the raster buffer for the presence of a
+ * This is used to check the raster buffer for the presence of a
* particular color in the pixel we are encoding.
* The first index is the head (LEFT or RIGHT) which is used to
* distinguish between photo and color cartridges. The second index
@@ -257,16 +256,16 @@ static byte ibits[8] = { 0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
* lower pen) on that cartridge.
*/
static byte colmask[2][3] =
-{
- { LIGHTCYAN, LIGHTMAGENTA, BLACK},
- { CYAN, MAGENTA, YELLOW }
+{
+ { LIGHTCYAN, LIGHTMAGENTA, BLACK},
+ { CYAN, MAGENTA, YELLOW }
};
-/* Lookup table for pen position offsets of color/photo cartridges.
+/* Lookup table for pen position offsets of color/photo cartridges.
* Parameter is the pen number, as defined by the pen offsets above:
- * pen 0 is CYAN/LIGHTCYAN, pen 1 is MAGENTA/LIGHTMAGENTA, pen 2 is
+ * pen 0 is CYAN/LIGHTCYAN, pen 1 is MAGENTA/LIGHTMAGENTA, pen 2 is
* YELLOW/BLACK. This is used to properly take account the position
- * of each color pen relative to the vertical position of the
+ * of each color pen relative to the vertical position of the
* color/photo cartridge.
*/
static int penofs[3];
@@ -288,16 +287,16 @@ static int hoffset[2][2];
/* Initialization sequence needed at the beginning of the data stream.
* This is invariant and contains a reset sequence, meaning each single
- * page in a multiple page output is sent to the printer as an independent
+ * page in a multiple page output is sent to the printer as an independent
* print job.
*/
static byte init_sequence[] =
{
- 0x1b, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33,
- 0x1b, 0x30, 0x80, 0x0C, 0x02, 0x00, 0x00, 0xbe,
- 0x1b, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21
-};
+ 0x1b, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33,
+ 0x1b, 0x30, 0x80, 0x0C, 0x02, 0x00, 0x00, 0xbe,
+ 0x1b, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21
+};
static byte z12_init_sequence[] =
{
@@ -309,63 +308,63 @@ static byte z12_init_sequence[] =
};
/* General global data that must be accessible
- * by all routines.
+ * by all routines.
*/
typedef struct pagedata_s
{
- /* General invariant data */
- int numbytes; /* Number of bytes in a scanline of the buffer */
- int numrbytes; /* Width (in bytes) of one rasterized scanline */
- int goffset; /* Guard offset at each side of each scanline (columns) */
- int numblines; /* Number of lines in a buffer */
- int numlines; /* Number of lines in a vertical head pass */
- int rendermode; /* Type of rendering */
- int numvlines; /* Number of lines in the page */
- int numcols; /* Number of columns in a row */
- int numpasses; /* Number of passes used to print one stripe */
- int bidirprint; /* Bidirectional printing enabled ? */
- int select; /* Resolution selector */
+ /* General invariant data */
+ int numbytes; /* Number of bytes in a scanline of the buffer */
+ int numrbytes; /* Width (in bytes) of one rasterized scanline */
+ int goffset; /* Guard offset at each side of each scanline (columns) */
+ int numblines; /* Number of lines in a buffer */
+ int numlines; /* Number of lines in a vertical head pass */
+ int rendermode; /* Type of rendering */
+ int numvlines; /* Number of lines in the page */
+ int numcols; /* Number of columns in a row */
+ int numpasses; /* Number of passes used to print one stripe */
+ int bidirprint; /* Bidirectional printing enabled ? */
+ int select; /* Resolution selector */
int modelprint; /* which printer? - lxm3200=0, z12=1, z31=2 */
int z31margin; /* margin for the Z31 */
- /* Printing offsets */
- int leftoffset; /* Start printing offset from left margin */
- int topoffset; /* Start printing offset from top margin */
-
- /* Resolution settings */
- int xres; /* Horizontal dots per inch */
- int yres; /* Vertical dots per inch */
- int xrmul; /* Horizontal coordinate multiplier */
- int yrmul; /* Vertical coordinate multiplier */
-
- /* Pagewide status */
- int curheadpos; /* Current absolute printhead position */
- int linetoeject; /* Number of lines for the eject command */
- int direction; /* Printing direction for next stripe */
-
- /* Alignment data */
- int bwsep; /* Nozzle columns separation in B&W/photo cartridge */
- int colsep; /* Nozzle columns separation in color cartridge */
- int vertalign; /* Vertical alignment offset of the two cartridges */
- int lrhalign; /* Horizontal alignment between left and right cartridges */
-
- /* Data pointers */
- byte *outdata; /* Buffer to output data codes for one full stripe */
- byte *scanbuf; /* Buffer to contain the rasterized scanlines */
- FILE *stream; /* Output stream */
- lxm_device *dev; /* Pointer to our device */
-
- /* Buffer data */
- int left, right; /* Actual left and right margins */
- int firstline; /* Head of the circular scanline buffer */
- int lastblack; /* Line of last black pass rendered in a color print */
- int curvline; /* Current vertical position */
-
- /* Stripe related data */
- byte header[24]; /* Stripe header data */
- int fullflag; /* A stripe is ready to be output */
- int stripebytes; /* Number of bytes in a stripe */
- int ileave; /* Interleaving pass: 0=even lines, 1=odd lines */
+ /* Printing offsets */
+ int leftoffset; /* Start printing offset from left margin */
+ int topoffset; /* Start printing offset from top margin */
+
+ /* Resolution settings */
+ int xres; /* Horizontal dots per inch */
+ int yres; /* Vertical dots per inch */
+ int xrmul; /* Horizontal coordinate multiplier */
+ int yrmul; /* Vertical coordinate multiplier */
+
+ /* Pagewide status */
+ int curheadpos; /* Current absolute printhead position */
+ int linetoeject; /* Number of lines for the eject command */
+ int direction; /* Printing direction for next stripe */
+
+ /* Alignment data */
+ int bwsep; /* Nozzle columns separation in B&W/photo cartridge */
+ int colsep; /* Nozzle columns separation in color cartridge */
+ int vertalign; /* Vertical alignment offset of the two cartridges */
+ int lrhalign; /* Horizontal alignment between left and right cartridges */
+
+ /* Data pointers */
+ byte *outdata; /* Buffer to output data codes for one full stripe */
+ byte *scanbuf; /* Buffer to contain the rasterized scanlines */
+ FILE *stream; /* Output stream */
+ lxm_device *dev; /* Pointer to our device */
+
+ /* Buffer data */
+ int left, right; /* Actual left and right margins */
+ int firstline; /* Head of the circular scanline buffer */
+ int lastblack; /* Line of last black pass rendered in a color print */
+ int curvline; /* Current vertical position */
+
+ /* Stripe related data */
+ byte header[24]; /* Stripe header data */
+ int fullflag; /* A stripe is ready to be output */
+ int stripebytes; /* Number of bytes in a stripe */
+ int ileave; /* Interleaving pass: 0=even lines, 1=odd lines */
} pagedata;
@@ -379,42 +378,42 @@ static pagedata gendata;
* into the printer, we calculate the line width
* and then anything between 8.25 and 8.4 inches
* is considered to be A4.
- * This routine is inspired by the omologous
+ * This routine is inspired by the omologous
* routine from the "gdevbj10" driver.
*/
static int
lxm3200_open(gx_device *pdev)
{
- float linewidth;
-
- static const float a4_margins[4] =
- {
- LXM3200_A4_LEFT_MARGIN, LXM3200_BOTTOM_MARGIN,
- LXM3200_A4_RIGHT_MARGIN, LXM3200_TOP_MARGIN
- };
-
- static const float letter_margins[4] =
- {
- LXM3200_LETTER_LEFT_MARGIN, LXM3200_BOTTOM_MARGIN,
- LXM3200_LETTER_RIGHT_MARGIN, LXM3200_TOP_MARGIN
- };
-
- linewidth = (float)(pdev->width) / (float)(pdev->x_pixels_per_inch);
-
- if(linewidth >= 8.25 && linewidth <= 8.4)
- {
- gx_device_set_margins(pdev, a4_margins, true);
- ((lxm_device *)pdev)->topoffset = LXM3200_A4_TOPOFFSET;
- ((lxm_device *)pdev)->leftoffset = LXM3200_A4_LEFTOFFSET;
- }
- else
- {
- gx_device_set_margins(pdev, letter_margins, true);
- ((lxm_device *)pdev)->topoffset = LXM3200_LETTER_TOPOFFSET;
- ((lxm_device *)pdev)->leftoffset = LXM3200_LETTER_LEFTOFFSET;
- }
-
- return gdev_prn_open(pdev);
+ float linewidth;
+
+ static const float a4_margins[4] =
+ {
+ LXM3200_A4_LEFT_MARGIN, LXM3200_BOTTOM_MARGIN,
+ LXM3200_A4_RIGHT_MARGIN, LXM3200_TOP_MARGIN
+ };
+
+ static const float letter_margins[4] =
+ {
+ LXM3200_LETTER_LEFT_MARGIN, LXM3200_BOTTOM_MARGIN,
+ LXM3200_LETTER_RIGHT_MARGIN, LXM3200_TOP_MARGIN
+ };
+
+ linewidth = (float)(pdev->width) / (float)(pdev->x_pixels_per_inch);
+
+ if(linewidth >= 8.25 && linewidth <= 8.4)
+ {
+ gx_device_set_margins(pdev, a4_margins, true);
+ ((lxm_device *)pdev)->topoffset = LXM3200_A4_TOPOFFSET;
+ ((lxm_device *)pdev)->leftoffset = LXM3200_A4_LEFTOFFSET;
+ }
+ else
+ {
+ gx_device_set_margins(pdev, letter_margins, true);
+ ((lxm_device *)pdev)->topoffset = LXM3200_LETTER_TOPOFFSET;
+ ((lxm_device *)pdev)->leftoffset = LXM3200_LETTER_LEFTOFFSET;
+ }
+
+ return gdev_prn_open(pdev);
}
/* Function used by ghostscript to map a RGB
@@ -424,365 +423,364 @@ lxm3200_open(gx_device *pdev)
static gx_color_index
lxm3200_map_rgb_color(gx_device *dev, const gx_color_value cv[])
{
- gx_color_index col;
- gx_color_value r, g, b;
- int c, m, y;
- gx_color_value tmpcv[3];
-
- r = cv[0]; g = cv[1]; b = cv[2];
- /* In case R, G and B values are equal, ghostscript
- * prescribes that the color value must be turned
- * into a gray shade. In our case this means either
- * black or white
- */
- if(r == g && r == b)
- {
- if(r > HALFTONE)
- return(WHITE);
- else
- return(BLACK);
- }
-
- /* Calculate CMY values from RGB. This is *overly*
- * simple, but it's enough to print something.
- */
- c = FULLTONE - r;
- m = FULLTONE - g;
- y = FULLTONE - b;
-
- /* Now encode the calculated color into the internal
- * format. This means simply to turn on or off the
- * bits representing each color depending on the value
- * of the appropriate CMY component.
- * Note that we are not doing black separation or any
- * other fancy stuff: this is spartane code just to
- * make the printer work.
- */
- col = 0;
- if(y > HALFTONE)col |= YELLOW;
-
- switch(((lxm_device *)dev)->rendermode)
- {
- case LXM3200_C:
- if(c > HALFTONE)col |= CYAN;
- if(m > HALFTONE)col |= MAGENTA;
- break;
-
- case LXM3200_P:
- if(c > TWOTHIRD)
- col |= CYAN;
- else
- if(c > ONETHIRD)col |= LIGHTCYAN;
-
- if(m > TWOTHIRD)
- col |= MAGENTA;
- else
- if(m > ONETHIRD)col |= LIGHTMAGENTA;
- break;
-
- default:
- tmpcv[0] = r; tmpcv[1] = g; tmpcv[2] = b;
- col = gdev_prn_map_rgb_color(dev, tmpcv);
- break;
- }
-
- return(col);
+ gx_color_index col;
+ gx_color_value r, g, b;
+ int c, m, y;
+ gx_color_value tmpcv[3];
+
+ r = cv[0]; g = cv[1]; b = cv[2];
+ /* In case R, G and B values are equal, ghostscript
+ * prescribes that the color value must be turned
+ * into a gray shade. In our case this means either
+ * black or white
+ */
+ if(r == g && r == b)
+ {
+ if(r > HALFTONE)
+ return(WHITE);
+ else
+ return(BLACK);
+ }
+
+ /* Calculate CMY values from RGB. This is *overly*
+ * simple, but it's enough to print something.
+ */
+ c = FULLTONE - r;
+ m = FULLTONE - g;
+ y = FULLTONE - b;
+
+ /* Now encode the calculated color into the internal
+ * format. This means simply to turn on or off the
+ * bits representing each color depending on the value
+ * of the appropriate CMY component.
+ * Note that we are not doing black separation or any
+ * other fancy stuff: this is spartane code just to
+ * make the printer work.
+ */
+ col = 0;
+ if(y > HALFTONE)col |= YELLOW;
+
+ switch(((lxm_device *)dev)->rendermode)
+ {
+ case LXM3200_C:
+ if(c > HALFTONE)col |= CYAN;
+ if(m > HALFTONE)col |= MAGENTA;
+ break;
+
+ case LXM3200_P:
+ if(c > TWOTHIRD)
+ col |= CYAN;
+ else
+ if(c > ONETHIRD)col |= LIGHTCYAN;
+
+ if(m > TWOTHIRD)
+ col |= MAGENTA;
+ else
+ if(m > ONETHIRD)col |= LIGHTMAGENTA;
+ break;
+
+ default:
+ tmpcv[0] = r; tmpcv[1] = g; tmpcv[2] = b;
+ col = gdev_prn_map_rgb_color(dev, tmpcv);
+ break;
+ }
+
+ return(col);
}
-
+
/* Function called by ghostscript to map the
* internal representation of a color to a
- * RGB value.
+ * RGB value.
*/
static int
lxm3200_map_color_rgb(gx_device *dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
- int c, m, y;
-
- if(color == WHITE)
- {
- prgb[0] = FULLTONE;
- prgb[1] = FULLTONE;
- prgb[2] = FULLTONE;
- return(0);
- }
-
- if(color & BLACK)
- {
- prgb[0] = 0;
- prgb[1] = 0;
- prgb[2] = 0;
- return(0);
- }
-
- /* Calculate back CMY components from the internal
- * representation of the color
- */
- c = 0;
- m = 0;
- y = 0;
-
- switch(((lxm_device *)dev)->rendermode)
- {
- case LXM3200_C:
- color &= (CYAN|MAGENTA|YELLOW);
- if(color & CYAN)c = 2;
- if(color & MAGENTA)m = 2;
- if(color & YELLOW)y = 2;
- break;
-
- case LXM3200_P:
- default:
- color &= (CYAN|MAGENTA|YELLOW|LIGHTCYAN|LIGHTMAGENTA);
- if(color & LIGHTCYAN)c = 1;
- if(color & LIGHTMAGENTA)m = 1;
- if(color & YELLOW)y = 2;
- if(color & CYAN)c = 2;
- if(color & MAGENTA)m = 2;
- break;
- }
-
- /* And now turn CMY to RGB, in the usual spartane way */
-
- prgb[0] = (gx_color_value)((2 - c) * HALFTONE);
- prgb[1] = (gx_color_value)((2 - m) * HALFTONE);
- prgb[2] = (gx_color_value)((2 - y) * HALFTONE);
-
- return(0);
+ int c, m, y;
+
+ if(color == WHITE)
+ {
+ prgb[0] = FULLTONE;
+ prgb[1] = FULLTONE;
+ prgb[2] = FULLTONE;
+ return(0);
+ }
+
+ if(color & BLACK)
+ {
+ prgb[0] = 0;
+ prgb[1] = 0;
+ prgb[2] = 0;
+ return(0);
+ }
+
+ /* Calculate back CMY components from the internal
+ * representation of the color
+ */
+ c = 0;
+ m = 0;
+ y = 0;
+
+ switch(((lxm_device *)dev)->rendermode)
+ {
+ case LXM3200_C:
+ color &= (CYAN|MAGENTA|YELLOW);
+ if(color & CYAN)c = 2;
+ if(color & MAGENTA)m = 2;
+ if(color & YELLOW)y = 2;
+ break;
+
+ case LXM3200_P:
+ default:
+ color &= (CYAN|MAGENTA|YELLOW|LIGHTCYAN|LIGHTMAGENTA);
+ if(color & LIGHTCYAN)c = 1;
+ if(color & LIGHTMAGENTA)m = 1;
+ if(color & YELLOW)y = 2;
+ if(color & CYAN)c = 2;
+ if(color & MAGENTA)m = 2;
+ break;
+ }
+
+ /* And now turn CMY to RGB, in the usual spartane way */
+
+ prgb[0] = (gx_color_value)((2 - c) * HALFTONE);
+ prgb[1] = (gx_color_value)((2 - m) * HALFTONE);
+ prgb[2] = (gx_color_value)((2 - y) * HALFTONE);
+
+ return(0);
}
/* Main routine of the driver. This takes care of
- * all parameters and static data initialization
+ * all parameters and static data initialization
* and calls the proper page printing routines
- * depending on the selected printing mode.
+ * depending on the selected printing mode.
*/
-static int
+static int
lxm3200_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- /* Store data passed by ghostscript to the driver */
- gendata.dev = (lxm_device *)pdev;
- gendata.stream = prn_stream;
- gendata.rendermode = (gendata.dev)->rendermode;
-
- /* Snap resolution on one of the three supported setting
- * (300, 600, 1200 dpi) depending on the input resoution value.
- * Horizontal and vertical resolution are treated independently.
+ /* Store data passed by ghostscript to the driver */
+ gendata.dev = (lxm_device *)pdev;
+ gendata.stream = prn_stream;
+ gendata.rendermode = (gendata.dev)->rendermode;
+
+ /* Snap resolution on one of the three supported setting
+ * (300, 600, 1200 dpi) depending on the input resoution value.
+ * Horizontal and vertical resolution are treated independently.
*/
- gendata.xres = 600;
- if((gendata.dev)->x_pixels_per_inch < 450)gendata.xres = 300;
- if((gendata.dev)->x_pixels_per_inch > 900)gendata.xres = 1200;
- gendata.xrmul = 1200 / gendata.xres;
-
- gendata.yres = 600;
- if((gendata.dev)->y_pixels_per_inch < 450)gendata.yres = 300;
- if((gendata.dev)->y_pixels_per_inch > 900)gendata.yres = 1200;
- gendata.yrmul = 1200 / gendata.yres;
-
- /* Cache horizontal and vertical starting offsets */
- gendata.topoffset = (gendata.dev)->topoffset;
- gendata.leftoffset = (gendata.dev)->leftoffset;
-
- /* Build lookup table for pen offset, adjusting for
- * vertical resolution setting
- */
- penofs[0] = (PEN0OFS * 2) / gendata.yrmul;
- penofs[1] = (PEN1OFS * 2) / gendata.yrmul;
- penofs[2] = (PEN2OFS * 2) / gendata.yrmul;
-
- /* Build lookup table for vertical heads alignment,
- * adjusting for vertical resolution setting
- */
- valign[COLORVALIGN] = (COLORVALIGN_V * 2) / gendata.yrmul;
- valign[BLACKVALIGN] = (BLACKVALIGN_V * 2) / gendata.yrmul;
- valign[PHOTOVALIGN] = (PHOTOVALIGN_V * 2) / gendata.yrmul;
-
- /* Build lookup tables for initial horizontal offsets,
- * adjusting for horizontal resolution setting
- */
- /* choose whether to use lxm3200 or Z12 settings */
+ gendata.xres = 600;
+ if((gendata.dev)->x_pixels_per_inch < 450)gendata.xres = 300;
+ if((gendata.dev)->x_pixels_per_inch > 900)gendata.xres = 1200;
+ gendata.xrmul = 1200 / gendata.xres;
+
+ gendata.yres = 600;
+ if((gendata.dev)->y_pixels_per_inch < 450)gendata.yres = 300;
+ if((gendata.dev)->y_pixels_per_inch > 900)gendata.yres = 1200;
+ gendata.yrmul = 1200 / gendata.yres;
+
+ /* Cache horizontal and vertical starting offsets */
+ gendata.topoffset = (gendata.dev)->topoffset;
+ gendata.leftoffset = (gendata.dev)->leftoffset;
+
+ /* Build lookup table for pen offset, adjusting for
+ * vertical resolution setting
+ */
+ penofs[0] = (PEN0OFS * 2) / gendata.yrmul;
+ penofs[1] = (PEN1OFS * 2) / gendata.yrmul;
+ penofs[2] = (PEN2OFS * 2) / gendata.yrmul;
+
+ /* Build lookup table for vertical heads alignment,
+ * adjusting for vertical resolution setting
+ */
+ valign[COLORVALIGN] = (COLORVALIGN_V * 2) / gendata.yrmul;
+ valign[BLACKVALIGN] = (BLACKVALIGN_V * 2) / gendata.yrmul;
+ valign[PHOTOVALIGN] = (PHOTOVALIGN_V * 2) / gendata.yrmul;
+
+ /* Build lookup tables for initial horizontal offsets,
+ * adjusting for horizontal resolution setting
+ */
+ /* choose whether to use lxm3200 or Z12 settings */
gendata.modelprint=(gendata.dev)->model; /* which model? */
gendata.z31margin=(gendata.dev)->z31m; /*which additional margin for z31*/
switch(gendata.modelprint){
case 1: /* we use the Lexmark Z12 */
hoffset[LEFT][LEFT] = LHSTART_z12;
- hoffset[RIGHT][LEFT] = RHSTART_z12 + gendata.lrhalign;
- break;
+ hoffset[RIGHT][LEFT] = RHSTART_z12 + gendata.lrhalign;
+ break;
default: /* default (if one uses the Lexmark 3200 or the Lexmark Z31) */
hoffset[LEFT][LEFT] = LHSTART;
hoffset[RIGHT][LEFT] = RHSTART + gendata.lrhalign;
break;
}
- hoffset[LEFT][RIGHT] = hoffset[LEFT][LEFT] - LRPASSHOFS;
+ hoffset[LEFT][RIGHT] = hoffset[LEFT][LEFT] - LRPASSHOFS;
hoffset[RIGHT][RIGHT] = hoffset[RIGHT][LEFT] - LRPASSHOFS;
- /* Initialization of general parameters */
- gendata.outdata = NULL;
- gendata.scanbuf = NULL;
- gendata.curheadpos = 0;
- gendata.left = 0;
- gendata.right = 0;
- gendata.lastblack = 0;
- gendata.curvline = 0;
- gendata.firstline = 0;
- gendata.fullflag = FALSE;
- gendata.direction = LEFT;
- gendata.ileave = 0;
-
- gendata.bidirprint = (gendata.dev)->bidir;
- gendata.numpasses = (gendata.dev)->numpass;
-
-
- /* Set some parameters that depend on resolution and
- * printing mode. We calculate all at 600dpi (the native
- * resolution) and then correct later for different
- * resolution settings.
- */
- switch(gendata.rendermode)
- {
- /* In monochrome mode we try to use all 208 nozzles of
- * the black cartridge to speed up printing. But if we
- * are printing at 1200 dpi horizontal, only 192 nozzles
- * are available anyway (it seems an hardware limitation).
- * We print a full buffer at every pass, so the number of
- * lines in the buffer is the same as the number of nozzles
- * of the head.
- */
- case LXM3200_M:
- gendata.numblines = 208;
- gendata.numlines = 208;
- gendata.select = 0x10;
- if(gendata.xres == 1200)
- {
- gendata.numblines = 192;
- gendata.numlines = 192;
- gendata.select = 0x00;
- }
- break;
-
- /* In color or photo mode we must use 192 nozzles only in
- * the black cartridge, to cope with the color and photo
- * cartridges (which have 3 color pen of 64 nozzles each,
- * for a total of 192 nozzles). But the color pens are
- * vertically spaced and misaligned with respect to the
- * black pen. To solve this problem, we need a buffer which
- * is larger than 192 lines and then we print only the
- * proper "windows" from it. We choose to set the buffer
- * height to 256, which is the smallest power of two large
- * enough to hold all the needed data. We use a power of
- * two for speed, since in this way the modulo operation
- * in the inner loops (needed to take care of buffer rolling)
- * becomes a simple and much faster bitwise AND.
- */
- case LXM3200_P:
- case LXM3200_C:
- gendata.numblines = 256;
- gendata.numlines = 192;
- gendata.select = 0x00;
- break;
- }
-
- /* Correct the number of lines of the buffer to take care
- * of different vertical resolution modes. Since the buffer
- * does cover a constant vertical spacing, we must double the
- * number of lines at 1200dpi and half it at 300dpi, to take
- * into account the different thickness of the lines at the
- * three different vertical resolutions.
- */
- gendata.numblines = (gendata.numblines * 2) / gendata.yrmul;
-
- /* Now correct the "select" field to adjust the horizontal
- * motor speed depending on position. Meanwhile, if we are
- * at 1200 dpi, double the number of horizontal passes
- * because each stripe at 1200 dpi horizontal must be printed
- * in two passes.
- */
- switch(gendata.xres)
- {
- case 300:
- gendata.select |= 0x60;
- break;
-
- case 1200:
- gendata.select |= 0x40;
- gendata.numpasses *= 2;
- break;
- }
-
- /* Now store some useful info taken from the ghostscript
- * device structure to speed up access.
- */
- gendata.numcols = (gendata.dev)->width;
- gendata.numvlines = (gendata.dev)->height;
- gendata.lrhalign = (gendata.dev)->algnA;
- gendata.vertalign = (gendata.dev)->algnB;
- gendata.bwsep = (gendata.dev)->algnC;
- gendata.colsep = (gendata.dev)->algnD;
- gendata.goffset = (max(gendata.bwsep, gendata.colsep) * 2) / gendata.xrmul;
- gendata.numbytes = gendata.numcols + (2 * gendata.goffset);
- gendata.numrbytes = gdev_mem_bytes_per_scan_line(gendata.dev);
-
- /* Calculate number of lines in the page and initialize the
- * counter of the lines to eject. At the end of the printing,
- * to eject the paper sheet we must send to the printer a
- * command to move the paper forward. The amount to move is
- * the length of paper which is still inside the printer plus
- * two inches (the number is expressed in 1200ths of an inch,
- * so "plus two inches" means "add 2400").
- */
- gendata.linetoeject = gendata.numvlines * gendata.yrmul;
- gendata.linetoeject += 2400;
-
- /* Allocate memory for the buffers and
- * verify that the allocation was done properly.
- */
- gendata.scanbuf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), gendata.numbytes, gendata.numblines,
- "lxm3200_print_page(scanbuf)");
-
- gendata.outdata = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), gendata.numbytes, 30,
- "lxm3200_print_page(outdata)");
-
- if(gendata.scanbuf == NULL ||
- gendata.outdata == NULL)
- {
- freeresources(pdev);
- return_error(gs_error_VMerror);
- }
-
- /* Send initialization sequence to the printer */
- if(gendata.modelprint==1) fwrite(z12_init_sequence, sizeof(z12_init_sequence), 1, prn_stream);
- else fwrite(init_sequence, sizeof(init_sequence), 1, prn_stream);
-
- /* Choose the right page printing routine
- * depending on the printing mode.
- */
- switch(gendata.rendermode)
- {
- case LXM3200_P:
- print_photo_page();
- break;
-
- case LXM3200_C:
- print_color_page();
- break;
-
- case LXM3200_M:
- default:
- print_mono_page();
- break;
- }
-
- /* Output the end-of-page epilogue */
- outputepilogue();
-
- /* Free the allocated resources */
- freeresources(pdev);
-
- /* Done. Bye bye, see you on next page. */
- return(0);
+ /* Initialization of general parameters */
+ gendata.outdata = NULL;
+ gendata.scanbuf = NULL;
+ gendata.curheadpos = 0;
+ gendata.left = 0;
+ gendata.right = 0;
+ gendata.lastblack = 0;
+ gendata.curvline = 0;
+ gendata.firstline = 0;
+ gendata.fullflag = FALSE;
+ gendata.direction = LEFT;
+ gendata.ileave = 0;
+
+ gendata.bidirprint = (gendata.dev)->bidir;
+ gendata.numpasses = (gendata.dev)->numpass;
+
+ /* Set some parameters that depend on resolution and
+ * printing mode. We calculate all at 600dpi (the native
+ * resolution) and then correct later for different
+ * resolution settings.
+ */
+ switch(gendata.rendermode)
+ {
+ /* In monochrome mode we try to use all 208 nozzles of
+ * the black cartridge to speed up printing. But if we
+ * are printing at 1200 dpi horizontal, only 192 nozzles
+ * are available anyway (it seems an hardware limitation).
+ * We print a full buffer at every pass, so the number of
+ * lines in the buffer is the same as the number of nozzles
+ * of the head.
+ */
+ case LXM3200_M:
+ gendata.numblines = 208;
+ gendata.numlines = 208;
+ gendata.select = 0x10;
+ if(gendata.xres == 1200)
+ {
+ gendata.numblines = 192;
+ gendata.numlines = 192;
+ gendata.select = 0x00;
+ }
+ break;
+
+ /* In color or photo mode we must use 192 nozzles only in
+ * the black cartridge, to cope with the color and photo
+ * cartridges (which have 3 color pen of 64 nozzles each,
+ * for a total of 192 nozzles). But the color pens are
+ * vertically spaced and misaligned with respect to the
+ * black pen. To solve this problem, we need a buffer which
+ * is larger than 192 lines and then we print only the
+ * proper "windows" from it. We choose to set the buffer
+ * height to 256, which is the smallest power of two large
+ * enough to hold all the needed data. We use a power of
+ * two for speed, since in this way the modulo operation
+ * in the inner loops (needed to take care of buffer rolling)
+ * becomes a simple and much faster bitwise AND.
+ */
+ case LXM3200_P:
+ case LXM3200_C:
+ gendata.numblines = 256;
+ gendata.numlines = 192;
+ gendata.select = 0x00;
+ break;
+ }
+
+ /* Correct the number of lines of the buffer to take care
+ * of different vertical resolution modes. Since the buffer
+ * does cover a constant vertical spacing, we must double the
+ * number of lines at 1200dpi and half it at 300dpi, to take
+ * into account the different thickness of the lines at the
+ * three different vertical resolutions.
+ */
+ gendata.numblines = (gendata.numblines * 2) / gendata.yrmul;
+
+ /* Now correct the "select" field to adjust the horizontal
+ * motor speed depending on position. Meanwhile, if we are
+ * at 1200 dpi, double the number of horizontal passes
+ * because each stripe at 1200 dpi horizontal must be printed
+ * in two passes.
+ */
+ switch(gendata.xres)
+ {
+ case 300:
+ gendata.select |= 0x60;
+ break;
+
+ case 1200:
+ gendata.select |= 0x40;
+ gendata.numpasses *= 2;
+ break;
+ }
+
+ /* Now store some useful info taken from the ghostscript
+ * device structure to speed up access.
+ */
+ gendata.numcols = (gendata.dev)->width;
+ gendata.numvlines = (gendata.dev)->height;
+ gendata.lrhalign = (gendata.dev)->algnA;
+ gendata.vertalign = (gendata.dev)->algnB;
+ gendata.bwsep = (gendata.dev)->algnC;
+ gendata.colsep = (gendata.dev)->algnD;
+ gendata.goffset = (max(gendata.bwsep, gendata.colsep) * 2) / gendata.xrmul;
+ gendata.numbytes = gendata.numcols + (2 * gendata.goffset);
+ gendata.numrbytes = gdev_mem_bytes_per_scan_line(gendata.dev);
+
+ /* Calculate number of lines in the page and initialize the
+ * counter of the lines to eject. At the end of the printing,
+ * to eject the paper sheet we must send to the printer a
+ * command to move the paper forward. The amount to move is
+ * the length of paper which is still inside the printer plus
+ * two inches (the number is expressed in 1200ths of an inch,
+ * so "plus two inches" means "add 2400").
+ */
+ gendata.linetoeject = gendata.numvlines * gendata.yrmul;
+ gendata.linetoeject += 2400;
+
+ /* Allocate memory for the buffers and
+ * verify that the allocation was done properly.
+ */
+ gendata.scanbuf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), gendata.numbytes, gendata.numblines,
+ "lxm3200_print_page(scanbuf)");
+
+ gendata.outdata = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), gendata.numbytes, 30,
+ "lxm3200_print_page(outdata)");
+
+ if(gendata.scanbuf == NULL ||
+ gendata.outdata == NULL)
+ {
+ freeresources(pdev);
+ return_error(gs_error_VMerror);
+ }
+
+ /* Send initialization sequence to the printer */
+ if(gendata.modelprint==1) fwrite(z12_init_sequence, sizeof(z12_init_sequence), 1, prn_stream);
+ else fwrite(init_sequence, sizeof(init_sequence), 1, prn_stream);
+
+ /* Choose the right page printing routine
+ * depending on the printing mode.
+ */
+ switch(gendata.rendermode)
+ {
+ case LXM3200_P:
+ print_photo_page();
+ break;
+
+ case LXM3200_C:
+ print_color_page();
+ break;
+
+ case LXM3200_M:
+ default:
+ print_mono_page();
+ break;
+ }
+
+ /* Output the end-of-page epilogue */
+ outputepilogue();
+
+ /* Free the allocated resources */
+ freeresources(pdev);
+
+ /* Done. Bye bye, see you on next page. */
+ return(0);
}
/* Function that Ghostscript calls to ask the driver
- * the value of its parameters. This function is based
+ * the value of its parameters. This function is based
* on the equivalent from the HP850 driver (gdevcd8.c)
* by Uli Wortmann.
* I won't comment it because I haven't even tried
@@ -792,50 +790,50 @@ static int
lxm3200_get_params(gx_device *pdev, gs_param_list *plist)
{
int code;
-
+
code = gdev_prn_get_params(pdev, plist);
if(code < 0)return(code);
- code = param_write_int(plist, "algnA", &((lxm_device *)pdev)->algnA);
- if(code < 0)return(code);
+ code = param_write_int(plist, "algnA", &((lxm_device *)pdev)->algnA);
+ if(code < 0)return(code);
- code = param_write_int(plist, "algnB", &((lxm_device *)pdev)->algnB);
- if(code < 0)return(code);
+ code = param_write_int(plist, "algnB", &((lxm_device *)pdev)->algnB);
+ if(code < 0)return(code);
- code = param_write_int(plist, "algnC", &((lxm_device *)pdev)->algnC);
- if(code < 0)return(code);
+ code = param_write_int(plist, "algnC", &((lxm_device *)pdev)->algnC);
+ if(code < 0)return(code);
- code = param_write_int(plist, "algnD", &((lxm_device *)pdev)->algnD);
- if(code < 0)return(code);
+ code = param_write_int(plist, "algnD", &((lxm_device *)pdev)->algnD);
+ if(code < 0)return(code);
- code = param_write_int(plist, "bidir", &((lxm_device *)pdev)->bidir);
- if(code < 0)return(code);
+ code = param_write_int(plist, "bidir", &((lxm_device *)pdev)->bidir);
+ if(code < 0)return(code);
- code = param_write_int(plist, "numpass", &((lxm_device *)pdev)->numpass);
- if(code < 0)return(code);
+ code = param_write_int(plist, "numpass", &((lxm_device *)pdev)->numpass);
+ if(code < 0)return(code);
- code = param_write_int(plist, "mode", &((lxm_device *)pdev)->rendermode);
+ code = param_write_int(plist, "mode", &((lxm_device *)pdev)->rendermode);
if(code < 0)return(code);
code = param_write_int(plist, "model", &((lxm_device *)pdev)->model);
if(code < 0)return(code);
- code = param_write_int(plist, "z31m", &((lxm_device *)pdev)->z31m);
+ code = param_write_int(plist, "z31m", &((lxm_device *)pdev)->z31m);
return code;
}
/* Function that Ghostscript calls to let the driver
- * set the value of its parameters. This function is
- * based on the equivalent from the HP850 driver
+ * set the value of its parameters. This function is
+ * based on the equivalent from the HP850 driver
* (gdevcd8.c) by Uli Wortmann.
* I won't comment it because I haven't even tried
* to understand this code... :)
*/
static int
lxm3200_put_params(gx_device *pdev, gs_param_list *plist)
-{
+{
int algnA = ((lxm_device *)pdev)->algnA;
int algnB = ((lxm_device *)pdev)->algnB;
int algnC = ((lxm_device *)pdev)->algnC;
@@ -848,49 +846,49 @@ lxm3200_put_params(gx_device *pdev, gs_param_list *plist)
int z31m = ((lxm_device *)pdev)->z31m; /* additional margin for the z31 */
code = param_read_int(plist, "algnA", &algnA);
- if(code < 0)return(code);
- if(algnA < 0 || algnA > 30)
- param_signal_error(plist, "algnA", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(algnA < 0 || algnA > 30)
+ param_signal_error(plist, "algnA", gs_error_rangecheck);
code = param_read_int(plist, "algnB", &algnB);
- if(code < 0)return(code);
- if(algnB < 0 || algnB > 15)
- param_signal_error(plist, "algnB", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(algnB < 0 || algnB > 15)
+ param_signal_error(plist, "algnB", gs_error_rangecheck);
code = param_read_int(plist, "algnC", &algnC);
- if(code < 0)return(code);
- if(algnC < 0 || algnC > 30)
- param_signal_error(plist, "algnC", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(algnC < 0 || algnC > 30)
+ param_signal_error(plist, "algnC", gs_error_rangecheck);
code = param_read_int(plist, "algnD", &algnD);
- if(code < 0)return(code);
- if(algnD < 0 || algnD > 30)
- param_signal_error(plist, "algnD", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(algnD < 0 || algnD > 30)
+ param_signal_error(plist, "algnD", gs_error_rangecheck);
code = param_read_int(plist, "bidir", &bidir);
- if(code < 0)return(code);
- if(bidir != 0 && bidir != 1)
- param_signal_error(plist, "bidir", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(bidir != 0 && bidir != 1)
+ param_signal_error(plist, "bidir", gs_error_rangecheck);
code = param_read_int(plist, "numpass", &numpass);
- if(code < 0)return(code);
- if(numpass < 1 || numpass > 16)
- param_signal_error(plist, "numpass", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(numpass < 1 || numpass > 16)
+ param_signal_error(plist, "numpass", gs_error_rangecheck);
code = param_read_int(plist, "mode", &mode);
- if(code < 0)return(code);
- if(mode != LXM3200_M && mode != LXM3200_C && mode != LXM3200_P)
- param_signal_error(plist, "mode", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(mode != LXM3200_M && mode != LXM3200_C && mode != LXM3200_P)
+ param_signal_error(plist, "mode", gs_error_rangecheck);
code = param_read_int(plist, "model", &model); /* asking for the model of printer: lxm3200 , Z12, Z31 */
- if(code < 0)return(code);
- if(model < 0 || model > 2 )
- param_signal_error(plist, "model", gs_error_rangecheck);
+ if(code < 0)return(code);
+ if(model < 0 || model > 2 )
+ param_signal_error(plist, "model", gs_error_rangecheck);
code = param_read_int(plist, "z31m", &z31m); /* What additional margin for the Z31 */
- if(code < 0)return(code);
+ if(code < 0)return(code);
- code = gdev_prn_put_params(pdev, plist);
+ code = gdev_prn_put_params(pdev, plist);
if(code < 0)return code;
((lxm_device *)pdev)->algnA = algnA;
@@ -903,127 +901,126 @@ lxm3200_put_params(gx_device *pdev, gs_param_list *plist)
((lxm_device *)pdev)->model = model; /* Model selection: lxm3200, Z12, Z31. */
((lxm_device *)pdev)->z31m = z31m; /* Additional margin for the Z31 */
- /* Depending on the selected rendering mode, change the
- * driver's parameters that ghostscript needs for the
- * dithering. We need to do it here because the "get_params"
- * and "put_params" are the only routines in the driver that
- * ghostscript calls before using the dithering parameters.
- */
- switch(mode)
- {
- case LXM3200_M:
- pdev->color_info.num_components = 1;
- pdev->color_info.max_gray = 1;
- pdev->color_info.max_color = 0;
- pdev->color_info.dither_grays = 2;
- pdev->color_info.dither_colors = 0;
- break;
-
- case LXM3200_C:
- pdev->color_info.num_components = 3;
- pdev->color_info.max_gray = 1;
- pdev->color_info.max_color = 1;
- pdev->color_info.dither_grays = 2;
- pdev->color_info.dither_colors = 2;
- break;
-
- case LXM3200_P:
- pdev->color_info.num_components = 3;
- pdev->color_info.max_gray = 1;
- pdev->color_info.max_color = 2;
- pdev->color_info.dither_grays = 2;
- pdev->color_info.dither_colors = 3;
- break;
- }
+ /* Depending on the selected rendering mode, change the
+ * driver's parameters that ghostscript needs for the
+ * dithering. We need to do it here because the "get_params"
+ * and "put_params" are the only routines in the driver that
+ * ghostscript calls before using the dithering parameters.
+ */
+ switch(mode)
+ {
+ case LXM3200_M:
+ pdev->color_info.num_components = 1;
+ pdev->color_info.max_gray = 1;
+ pdev->color_info.max_color = 0;
+ pdev->color_info.dither_grays = 2;
+ pdev->color_info.dither_colors = 0;
+ break;
+
+ case LXM3200_C:
+ pdev->color_info.num_components = 3;
+ pdev->color_info.max_gray = 1;
+ pdev->color_info.max_color = 1;
+ pdev->color_info.dither_grays = 2;
+ pdev->color_info.dither_colors = 2;
+ break;
+
+ case LXM3200_P:
+ pdev->color_info.num_components = 3;
+ pdev->color_info.max_gray = 1;
+ pdev->color_info.max_color = 2;
+ pdev->color_info.dither_grays = 2;
+ pdev->color_info.dither_colors = 3;
+ break;
+ }
return 0;
}
-
/* --------- Internal routines --------- */
/* Free the resources allocated by the driver */
static void
freeresources(gx_device *pdev)
{
- if(gendata.scanbuf)
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)gendata.scanbuf, gendata.numbytes, gendata.numblines,
- "lxm3200:freeresources(scanbuf)");
+ if(gendata.scanbuf)
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)gendata.scanbuf, gendata.numbytes, gendata.numblines,
+ "lxm3200:freeresources(scanbuf)");
- if(gendata.outdata)
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)gendata.outdata, gendata.numbytes, 30,
- "lxm3200:freeresources(outdata)");
+ if(gendata.outdata)
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)gendata.outdata, gendata.numbytes, 30,
+ "lxm3200:freeresources(outdata)");
}
/* Calculate the checksum of an escape sequence.
- * It is defined as the sum modulo 256 of the
+ * It is defined as the sum modulo 256 of the
* six bytes following the escape character.
*
* data: pointer to the first of the 8 characters
* of an escape sequence.
*/
-static byte
+static byte
calccheck8(byte *data)
{
- int ck, i;
-
- ck = 0;
- for(i=1; i<7; i++)ck += data[i];
-
- return(ck);
+ int ck, i;
+
+ ck = 0;
+ for(i=1; i<7; i++)ck += data[i];
+
+ return(ck);
}
/* Output the page epilogue. This procedure outputs
* the escape sequence needed to eject the page and
* take the printheads to the "park" position.
*/
-static void
+static void
outputepilogue(void)
{
- byte trailer[24];
- int pos;
-
- /* Page eject sequence */
- trailer[0] = 0x1b;
- trailer[1] = 0x22;
- trailer[2] = 0x80;
- trailer[3] = gendata.linetoeject >> 8;
- trailer[4] = gendata.linetoeject & 0xff;
- trailer[5] = 0x00;
- trailer[6] = 0x00;
- trailer[7] = calccheck8(trailer);
-
- /* Calculate the value we need to take the head back
- * to the park position. This is the current head position
- * if we printed the last stripe left-to-right, and the
- * current head position minus 168 (0xa8) if we printed the
- * last stripe right-to-left.
- */
- pos = gendata.curheadpos;
- if(gendata.bidirprint && gendata.direction == LEFT)pos -= 0xa8;
- if(pos < 0)pos = 0;
-
- /* Horizontal back sequence */
- trailer[8] = 0x1b;
- trailer[9] = 0x31;
- trailer[10] = 0x10;
- trailer[11] = pos >> 8;
- trailer[12] = pos & 0xff;
- trailer[13] = 0x00;
- trailer[14] = 0x00;
- trailer[15] = calccheck8(trailer+8);
-
- /* Reset sequence */
- trailer[16] = 0x1b;
- trailer[17] = 0x33;
- trailer[18] = 0x00;
- trailer[19] = 0x00;
- trailer[20] = 0x00;
- trailer[21] = 0x00;
- trailer[22] = 0x00;
- trailer[23] = 0x33;
-
- fwrite(trailer, 8, 3, gendata.stream);
+ byte trailer[24];
+ int pos;
+
+ /* Page eject sequence */
+ trailer[0] = 0x1b;
+ trailer[1] = 0x22;
+ trailer[2] = 0x80;
+ trailer[3] = gendata.linetoeject >> 8;
+ trailer[4] = gendata.linetoeject & 0xff;
+ trailer[5] = 0x00;
+ trailer[6] = 0x00;
+ trailer[7] = calccheck8(trailer);
+
+ /* Calculate the value we need to take the head back
+ * to the park position. This is the current head position
+ * if we printed the last stripe left-to-right, and the
+ * current head position minus 168 (0xa8) if we printed the
+ * last stripe right-to-left.
+ */
+ pos = gendata.curheadpos;
+ if(gendata.bidirprint && gendata.direction == LEFT)pos -= 0xa8;
+ if(pos < 0)pos = 0;
+
+ /* Horizontal back sequence */
+ trailer[8] = 0x1b;
+ trailer[9] = 0x31;
+ trailer[10] = 0x10;
+ trailer[11] = pos >> 8;
+ trailer[12] = pos & 0xff;
+ trailer[13] = 0x00;
+ trailer[14] = 0x00;
+ trailer[15] = calccheck8(trailer+8);
+
+ /* Reset sequence */
+ trailer[16] = 0x1b;
+ trailer[17] = 0x33;
+ trailer[18] = 0x00;
+ trailer[19] = 0x00;
+ trailer[20] = 0x00;
+ trailer[21] = 0x00;
+ trailer[22] = 0x00;
+ trailer[23] = 0x33;
+
+ fwrite(trailer, 8, 3, gendata.stream);
}
/* Output a "page forward" escape sequence,
@@ -1035,33 +1032,33 @@ outputepilogue(void)
static void
skiplines(int skiprow, int skipin)
{
- byte escape[8];
- int vskip;
-
- /* The vertical skip command accepts a spacing expressed in
- * 1200ths of an inch, so we must convert lines to 1200ths
- * of an inch. After the conversion we sum an offset directly
- * expressed in 1200ths of an inch: this way we can use this
- * routine to skip both a certain amount of lines (which exact
- * spacing value depends on the vertical resolution) and a
- * fixed offset that we directly know in spacing units.
- */
- vskip = skiprow*gendata.yrmul + skipin;
-
- escape[0] = 0x1b;
- escape[1] = 0x23;
- escape[2] = 0x80;
- escape[3] = vskip >> 8;
- escape[4] = vskip & 0xff;
- escape[5] = 0x00;
- escape[6] = 0x00;
- escape[7] = calccheck8(escape);
-
- /* Adjust the number of lines still inside the printer */
- gendata.linetoeject -= vskip;
-
- fwrite(escape, 8, 1, gendata.stream);
-}
+ byte escape[8];
+ int vskip;
+
+ /* The vertical skip command accepts a spacing expressed in
+ * 1200ths of an inch, so we must convert lines to 1200ths
+ * of an inch. After the conversion we sum an offset directly
+ * expressed in 1200ths of an inch: this way we can use this
+ * routine to skip both a certain amount of lines (which exact
+ * spacing value depends on the vertical resolution) and a
+ * fixed offset that we directly know in spacing units.
+ */
+ vskip = skiprow*gendata.yrmul + skipin;
+
+ escape[0] = 0x1b;
+ escape[1] = 0x23;
+ escape[2] = 0x80;
+ escape[3] = vskip >> 8;
+ escape[4] = vskip & 0xff;
+ escape[5] = 0x00;
+ escape[6] = 0x00;
+ escape[7] = calccheck8(escape);
+
+ /* Adjust the number of lines still inside the printer */
+ gendata.linetoeject -= vskip;
+
+ fwrite(escape, 8, 1, gendata.stream);
+}
/* Fill a stripe header with data.
*
@@ -1072,143 +1069,143 @@ skiplines(int skiprow, int skipin)
* bytes: total number of bytes in the stripe, including directories
* (but excluding the 24 bytes of the header).
*/
-static void
+static void
fillheader(int head, int numcol, int firstcol, int bytes)
{
- int len, offs1, startabs;
- int endabs, select, fwd;
- int back, nabspos, sep;
- byte *header;
-
- header = gendata.header;
-
- /* Correct the measures: firstcol and len need to
- * be in 1200ths of an inch.
- */
- firstcol *= gendata.xrmul;
- len = numcol * gendata.xrmul;
-
- /* Alter select to choose direction */
- select = gendata.select | (gendata.direction == LEFT ? 0x01 : 0x00);
-
- /* Calculate the proper horizontal offset */
- offs1 = hoffset[head][gendata.direction];
-
- /* Now calculate the correct separation depending on the
- * head type and adjust "select" to choose between left
- * or right head.
- */
- if(head == LEFT)
- {
- sep = (gendata.bwsep * 2) / gendata.xrmul;
- }
- else
- {
- sep = (gendata.colsep * 2) / gendata.xrmul;
- select |= 0x80;
- }
-
- /* Now calculate absolute starting and ending positions
- * of this stripe, taking into account the printing direction
- */
- startabs = firstcol + offs1;
-
- if(gendata.direction == LEFT)
- endabs = startabs + len;
- else
- endabs = startabs - len;
-
- /* And now, basing on current head position,
- * transform the absolute coordinates in a
- * relative movement of the head.
- * The formulas used for this are "black magic",
- * since this is a part of the protocol which is
- * still not well known. What you see here is an
- * empyrical formula devised by examination and
- * parameter fitting on the data output by the
- * Windows driver.
- */
- if(gendata.direction == LEFT)
- {
- nabspos = (((endabs - 3600) >> 3) & 0xfff0) + 9;
- fwd = nabspos - gendata.curheadpos;
- }
- else
- {
- if(endabs > 4816)
- nabspos = (((endabs - 4800) >> 3) & 0xfff0) + 9;
- else
- nabspos = (((endabs - 3600) >> 3) & 0xfff0) + 9;
- fwd = gendata.curheadpos - nabspos;
- }
-
- gendata.curheadpos += (gendata.direction == LEFT ? fwd : -fwd);
-
- /* If we are printing unidirectionally, calculate
- * the backward movement to return the printing head
- * at the beginning of this stripe.
- */
- back = 0;
- if(gendata.bidirprint == FALSE)
- {
- if(startabs > 4816)
- nabspos = ((startabs - 4800) >> 3) & 0xfff0;
- else
- nabspos = ((startabs - 3600) >> 3) & 0xfff0;
-
- if(gendata.direction == LEFT)
- back = gendata.curheadpos - nabspos;
- else
- back = nabspos - gendata.curheadpos;
- }
-
- gendata.curheadpos -= (gendata.direction == LEFT ? back : -back);
-
- /* First part of the header */
- header[0] = 0x1b;
- header[1] = 0x40;
- header[2] = select; /* Printing type flags */
- header[3] = numcol >> 8; /* MSB of the number of columns to print */
- header[4] = numcol & 0xff; /* LSB of the number of columns to print */
- header[5] = fwd >> 8; /* MSB of the relative forward head motion */
- header[6] = fwd & 0xff; /* LSB of the relative forward head motion */
- header[7] = calccheck8(&header[0]);
-
- /* Second part of the header */
- header[8] = 0x1b;
- header[9] = 0x42;
- header[10] = 0x00;
- if(gendata.modelprint==1) header[10] = 0x10; /* Lexmark Z12 protocol */
- header[11] = back >> 8; /* MSB of the relative backward head motion */
- header[12] = back & 0xff; /* LSB of the relative backward head motion */
- header[13] = 0x00; /* MSB of the relative downward head motion */
- header[14] = 0x00; /* LSB of the relative downward head motion */
- header[15] = calccheck8(&header[8]);
-
- /* Third (and last) part of the header */
- header[16] = 0x1b;
- header[17] = 0x43;
- header[18] = (bytes >> 16) & 0xff;
- header[19] = (bytes >> 8) & 0xff;
- header[20] = bytes & 0xff; /* LSB of the number of bytes in this stripe */
- header[21] = startabs >> 8; /* MSB of the starting column of this stripe */
- header[22] = startabs & 0xff; /* LSB of the starting column of this stripe */
- header[23] = calccheck8(&header[16]);
-
- /* Signal to other routines that the output buffer
- * is full and how many bytes it is long.
- */
- gendata.stripebytes = bytes;
- gendata.fullflag = TRUE;
-
- /* If bidirectional printing is in effect, change
- * the printing direction for the next stripe
- */
- if(gendata.bidirprint)
- gendata.direction = (gendata.direction == LEFT ? RIGHT : LEFT);
+ int len, offs1, startabs;
+ int endabs, select, fwd;
+ int back, nabspos, sep;
+ byte *header;
+
+ header = gendata.header;
+
+ /* Correct the measures: firstcol and len need to
+ * be in 1200ths of an inch.
+ */
+ firstcol *= gendata.xrmul;
+ len = numcol * gendata.xrmul;
+
+ /* Alter select to choose direction */
+ select = gendata.select | (gendata.direction == LEFT ? 0x01 : 0x00);
+
+ /* Calculate the proper horizontal offset */
+ offs1 = hoffset[head][gendata.direction];
+
+ /* Now calculate the correct separation depending on the
+ * head type and adjust "select" to choose between left
+ * or right head.
+ */
+ if(head == LEFT)
+ {
+ sep = (gendata.bwsep * 2) / gendata.xrmul;
+ }
+ else
+ {
+ sep = (gendata.colsep * 2) / gendata.xrmul;
+ select |= 0x80;
+ }
+
+ /* Now calculate absolute starting and ending positions
+ * of this stripe, taking into account the printing direction
+ */
+ startabs = firstcol + offs1;
+
+ if(gendata.direction == LEFT)
+ endabs = startabs + len;
+ else
+ endabs = startabs - len;
+
+ /* And now, basing on current head position,
+ * transform the absolute coordinates in a
+ * relative movement of the head.
+ * The formulas used for this are "black magic",
+ * since this is a part of the protocol which is
+ * still not well known. What you see here is an
+ * empyrical formula devised by examination and
+ * parameter fitting on the data output by the
+ * Windows driver.
+ */
+ if(gendata.direction == LEFT)
+ {
+ nabspos = (((endabs - 3600) >> 3) & 0xfff0) + 9;
+ fwd = nabspos - gendata.curheadpos;
+ }
+ else
+ {
+ if(endabs > 4816)
+ nabspos = (((endabs - 4800) >> 3) & 0xfff0) + 9;
+ else
+ nabspos = (((endabs - 3600) >> 3) & 0xfff0) + 9;
+ fwd = gendata.curheadpos - nabspos;
+ }
+
+ gendata.curheadpos += (gendata.direction == LEFT ? fwd : -fwd);
+
+ /* If we are printing unidirectionally, calculate
+ * the backward movement to return the printing head
+ * at the beginning of this stripe.
+ */
+ back = 0;
+ if(gendata.bidirprint == FALSE)
+ {
+ if(startabs > 4816)
+ nabspos = ((startabs - 4800) >> 3) & 0xfff0;
+ else
+ nabspos = ((startabs - 3600) >> 3) & 0xfff0;
+
+ if(gendata.direction == LEFT)
+ back = gendata.curheadpos - nabspos;
+ else
+ back = nabspos - gendata.curheadpos;
+ }
+
+ gendata.curheadpos -= (gendata.direction == LEFT ? back : -back);
+
+ /* First part of the header */
+ header[0] = 0x1b;
+ header[1] = 0x40;
+ header[2] = select; /* Printing type flags */
+ header[3] = numcol >> 8; /* MSB of the number of columns to print */
+ header[4] = numcol & 0xff; /* LSB of the number of columns to print */
+ header[5] = fwd >> 8; /* MSB of the relative forward head motion */
+ header[6] = fwd & 0xff; /* LSB of the relative forward head motion */
+ header[7] = calccheck8(&header[0]);
+
+ /* Second part of the header */
+ header[8] = 0x1b;
+ header[9] = 0x42;
+ header[10] = 0x00;
+ if(gendata.modelprint==1) header[10] = 0x10; /* Lexmark Z12 protocol */
+ header[11] = back >> 8; /* MSB of the relative backward head motion */
+ header[12] = back & 0xff; /* LSB of the relative backward head motion */
+ header[13] = 0x00; /* MSB of the relative downward head motion */
+ header[14] = 0x00; /* LSB of the relative downward head motion */
+ header[15] = calccheck8(&header[8]);
+
+ /* Third (and last) part of the header */
+ header[16] = 0x1b;
+ header[17] = 0x43;
+ header[18] = (bytes >> 16) & 0xff;
+ header[19] = (bytes >> 8) & 0xff;
+ header[20] = bytes & 0xff; /* LSB of the number of bytes in this stripe */
+ header[21] = startabs >> 8; /* MSB of the starting column of this stripe */
+ header[22] = startabs & 0xff; /* LSB of the starting column of this stripe */
+ header[23] = calccheck8(&header[16]);
+
+ /* Signal to other routines that the output buffer
+ * is full and how many bytes it is long.
+ */
+ gendata.stripebytes = bytes;
+ gendata.fullflag = TRUE;
+
+ /* If bidirectional printing is in effect, change
+ * the printing direction for the next stripe
+ */
+ if(gendata.bidirprint)
+ gendata.direction = (gendata.direction == LEFT ? RIGHT : LEFT);
}
-/* Set final information in the header and output all
+/* Set final information in the header and output all
* the data passes. This routine is needed because the
* actual values of two fields of the header (final
* head position and number of vertical lines to reach
@@ -1218,192 +1215,192 @@ fillheader(int head, int numcol, int firstcol, int bytes)
* vskip : number of lines to skip to reach next stripe
* newhead: head used for the next stripe (LEFT or RIGHT)
*/
-static void
+static void
finalizeheader(int vskip, int newhead)
{
- int offs2, nstartabs, back, fwd;
- int habs, p, dir, endabs, col;
- int newstart, sep;
- byte *header;
-
- header = gendata.header;
-
- /* Check the printing direction this stripe
- * was originally intended for.
- */
- dir = (header[2] & 0x01 ? LEFT : RIGHT);
-
- /* Retrieve the horizontal offset for the next stripe */
- offs2 = hoffset[newhead][gendata.direction];
-
- /* Calculate the separation adjust in 1200ths of an inch */
- if(newhead == LEFT)
- sep = (gendata.bwsep * 2) / gendata.xrmul;
- else
- sep = (gendata.colsep * 2) / gendata.xrmul;
-
- /* Now calculate the correct starting column
- * of the next stripe
- */
- if(gendata.direction == LEFT)
- newstart = (gendata.left * gendata.xrmul) - sep;
- else
- newstart = (gendata.right * gendata.xrmul);
-
- vskip *= gendata.yrmul;
-
- /* Calculate absolute starting position of new stripe */
- nstartabs = newstart + offs2;
-
- /* Calculate absolute ending position of this stripe
- * by summing (with proper sign) the starting position
- * and the width.
- */
- endabs = header[21]*256 + header[22]; /* Starting position */
- col = (header[3]*256 + header[4]); /* Width in columns */
- col *= gendata.xrmul; /* Transformed in 1200ths of an inch */
-
- if(dir == LEFT)
- endabs += col; /* Printing left-to-right */
- else
- endabs -= col; /* Printing right-to-left */
-
- /* Correct head position neutralizing the effect
- * of the last issued head movement commands. The
- * head movement for this stripe needs to be
- * recalculated from scratch to take into account
- * the correct beginning position of the next stripe.
- */
- if(dir == LEFT)
- {
- gendata.curheadpos += header[11]*256 + header[12]; /* Back movement */
- gendata.curheadpos -= header[5]*256 + header[6]; /* Forward movement */
- }
- else
- {
- gendata.curheadpos -= header[11]*256 + header[12]; /* Back movement */
- gendata.curheadpos += header[5]*256 + header[6]; /* Forward movement */
- }
-
- /* We use a convention of passing a negative value for
- * "newhead" to mean that this is the last stripe of the
- * sheet, so we don't need to care for the next stripe.
- */
- if(newhead < 0)
- {
- /* Last stripe: we only need to calculate proper forward
- * motion to print all the current stripe.
- */
- fwd = ((header[5]*256 + header[6]) & 0xfff0) + 9;
- }
- else
- {
- /* This is not the last stripe, so we need to calculate
- * the forward (in the printing direction) movement
- * that will take the printing head at the end of the
- * current stripe or at the beginning of the next,
- * whichever is farther. Note that we are always
- * talking relative to printing direction, so we must
- * take into proper account if we are printing from left
- * to right or from right to left.
- */
- if(dir == LEFT)
- {
- p = max(endabs, nstartabs);
- habs = (((p - 3600) >> 3) & 0xfff0) + 9;
- fwd = habs - gendata.curheadpos;
-
- /* part for the Lexmark Z31!!! */
- if(gendata.modelprint==2) fwd += gendata.z31margin;
-
- }
- else
- {
- p = min(endabs, nstartabs);
- if(p > 4816)
- habs = (((p - 4800) >> 3) & 0xfff0);
- else
- habs = (((p - 3600) >> 3) & 0xfff0);
- fwd = gendata.curheadpos - habs;
- }
- }
-
- /* Now update the current head position to take into
- * account the forward movement just computed
- */
- gendata.curheadpos += (dir == LEFT ? fwd : -fwd);
-
- /* Now calculate the value of the needed backward movement
- * to poisition the head correctly for the start of the
- * next stripe.
- */
- if(newhead < 0 || gendata.bidirprint)
- {
- /* If this is the last stripe of the page,
- * there is no need to take back the head:
- * it will be done by the parking command.
- * Or if we are printing bidirectionally,
- * the forward command has taken the head to
- * the correct position, so no need to move it.
- */
- back = 0;
- }
- else
- {
- /* Calculate the right backward movement basing
- * on the start of the next stripe.
- */
- if(nstartabs > 4856)
- habs = ((nstartabs - 4840) >> 3) & 0xfff0;
- else
- habs = ((nstartabs - 3600) >> 3) & 0xfff0;
-
- back = gendata.curheadpos - habs;
-
- /* If the next stripe starts at the right
- * of this one, "back" will be too small or
- * negative, so correct it.
- * It appears that 16 is the minimum allowable
- * backward movement that does not make the 3200
- * misbehave in the next stripe. This does not hold
- * if we are changing printing direction (in such a
- * case backward movement may be zero). This means
- * we are moving the head a little more than needed,
- * but it seems unavoidable.
- */
- if(back < 16)back = 16;
- }
+ int offs2, nstartabs, back, fwd;
+ int habs, p, dir, endabs, col;
+ int newstart, sep;
+ byte *header;
+
+ header = gendata.header;
+
+ /* Check the printing direction this stripe
+ * was originally intended for.
+ */
+ dir = (header[2] & 0x01 ? LEFT : RIGHT);
+
+ /* Retrieve the horizontal offset for the next stripe */
+ offs2 = hoffset[newhead][gendata.direction];
+
+ /* Calculate the separation adjust in 1200ths of an inch */
+ if(newhead == LEFT)
+ sep = (gendata.bwsep * 2) / gendata.xrmul;
+ else
+ sep = (gendata.colsep * 2) / gendata.xrmul;
+
+ /* Now calculate the correct starting column
+ * of the next stripe
+ */
+ if(gendata.direction == LEFT)
+ newstart = (gendata.left * gendata.xrmul) - sep;
+ else
+ newstart = (gendata.right * gendata.xrmul);
+
+ vskip *= gendata.yrmul;
+
+ /* Calculate absolute starting position of new stripe */
+ nstartabs = newstart + offs2;
+
+ /* Calculate absolute ending position of this stripe
+ * by summing (with proper sign) the starting position
+ * and the width.
+ */
+ endabs = header[21]*256 + header[22]; /* Starting position */
+ col = (header[3]*256 + header[4]); /* Width in columns */
+ col *= gendata.xrmul; /* Transformed in 1200ths of an inch */
+
+ if(dir == LEFT)
+ endabs += col; /* Printing left-to-right */
+ else
+ endabs -= col; /* Printing right-to-left */
+
+ /* Correct head position neutralizing the effect
+ * of the last issued head movement commands. The
+ * head movement for this stripe needs to be
+ * recalculated from scratch to take into account
+ * the correct beginning position of the next stripe.
+ */
+ if(dir == LEFT)
+ {
+ gendata.curheadpos += header[11]*256 + header[12]; /* Back movement */
+ gendata.curheadpos -= header[5]*256 + header[6]; /* Forward movement */
+ }
+ else
+ {
+ gendata.curheadpos -= header[11]*256 + header[12]; /* Back movement */
+ gendata.curheadpos += header[5]*256 + header[6]; /* Forward movement */
+ }
+
+ /* We use a convention of passing a negative value for
+ * "newhead" to mean that this is the last stripe of the
+ * sheet, so we don't need to care for the next stripe.
+ */
+ if(newhead < 0)
+ {
+ /* Last stripe: we only need to calculate proper forward
+ * motion to print all the current stripe.
+ */
+ fwd = ((header[5]*256 + header[6]) & 0xfff0) + 9;
+ }
+ else
+ {
+ /* This is not the last stripe, so we need to calculate
+ * the forward (in the printing direction) movement
+ * that will take the printing head at the end of the
+ * current stripe or at the beginning of the next,
+ * whichever is farther. Note that we are always
+ * talking relative to printing direction, so we must
+ * take into proper account if we are printing from left
+ * to right or from right to left.
+ */
+ if(dir == LEFT)
+ {
+ p = max(endabs, nstartabs);
+ habs = (((p - 3600) >> 3) & 0xfff0) + 9;
+ fwd = habs - gendata.curheadpos;
+
+ /* part for the Lexmark Z31!!! */
+ if(gendata.modelprint==2) fwd += gendata.z31margin;
+
+ }
+ else
+ {
+ p = min(endabs, nstartabs);
+ if(p > 4816)
+ habs = (((p - 4800) >> 3) & 0xfff0);
+ else
+ habs = (((p - 3600) >> 3) & 0xfff0);
+ fwd = gendata.curheadpos - habs;
+ }
+ }
+
+ /* Now update the current head position to take into
+ * account the forward movement just computed
+ */
+ gendata.curheadpos += (dir == LEFT ? fwd : -fwd);
+
+ /* Now calculate the value of the needed backward movement
+ * to poisition the head correctly for the start of the
+ * next stripe.
+ */
+ if(newhead < 0 || gendata.bidirprint)
+ {
+ /* If this is the last stripe of the page,
+ * there is no need to take back the head:
+ * it will be done by the parking command.
+ * Or if we are printing bidirectionally,
+ * the forward command has taken the head to
+ * the correct position, so no need to move it.
+ */
+ back = 0;
+ }
+ else
+ {
+ /* Calculate the right backward movement basing
+ * on the start of the next stripe.
+ */
+ if(nstartabs > 4856)
+ habs = ((nstartabs - 4840) >> 3) & 0xfff0;
+ else
+ habs = ((nstartabs - 3600) >> 3) & 0xfff0;
+
+ back = gendata.curheadpos - habs;
+
+ /* If the next stripe starts at the right
+ * of this one, "back" will be too small or
+ * negative, so correct it.
+ * It appears that 16 is the minimum allowable
+ * backward movement that does not make the 3200
+ * misbehave in the next stripe. This does not hold
+ * if we are changing printing direction (in such a
+ * case backward movement may be zero). This means
+ * we are moving the head a little more than needed,
+ * but it seems unavoidable.
+ */
+ if(back < 16)back = 16;
+ }
/* Lastly, update the current head position with the
- * backward movement just calculated.
- */
- gendata.curheadpos -= (dir == LEFT ? back : -back);
-
- /* Modify first part of the header */
- header[5] = fwd >> 8;
- header[6] = fwd & 0xff;
- header[7] = calccheck8(&header[0]);
-
- /* Modify second part of the header */
- header[8] = 0x1b;
- header[9] = 0x42;
- header[10] = 0x00;
- if(gendata.modelprint==1) header[10] = 0x10; /* Lexmark Z12 protocol */
- header[11] = back >> 8; /* MSB of the relative backward head motion */
- header[12] = back & 0xff; /* LSB of the relative backward head motion */
- header[13] = vskip >> 8; /* MSB of the relative downward head motion */
- header[14] = vskip & 0xff; /* LSB of the relative downward head motion */
- header[15] = calccheck8(&header[8]);
-
- /* Now output the data, signalling that the output
- * buffer is now empty.
- */
- fwrite(header, 3, 8, gendata.stream);
- fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
- gendata.fullflag = FALSE;
+ * backward movement just calculated.
+ */
+ gendata.curheadpos -= (dir == LEFT ? back : -back);
+
+ /* Modify first part of the header */
+ header[5] = fwd >> 8;
+ header[6] = fwd & 0xff;
+ header[7] = calccheck8(&header[0]);
+
+ /* Modify second part of the header */
+ header[8] = 0x1b;
+ header[9] = 0x42;
+ header[10] = 0x00;
+ if(gendata.modelprint==1) header[10] = 0x10; /* Lexmark Z12 protocol */
+ header[11] = back >> 8; /* MSB of the relative backward head motion */
+ header[12] = back & 0xff; /* LSB of the relative backward head motion */
+ header[13] = vskip >> 8; /* MSB of the relative downward head motion */
+ header[14] = vskip & 0xff; /* LSB of the relative downward head motion */
+ header[15] = calccheck8(&header[8]);
+
+ /* Now output the data, signalling that the output
+ * buffer is now empty.
+ */
+ fwrite(header, 3, 8, gendata.stream);
+ fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
+ gendata.fullflag = FALSE;
}
-/* Convert a buffer data stream into
+/* Convert a buffer data stream into
* directory/data representation, using the
* shortest coding (either direct or RLE)
*
@@ -1414,166 +1411,166 @@ finalizeheader(int vskip, int newhead)
static void
convbuf(int head, int numcols, int firstcol)
{
- byte *read, *write;
- int x, i, c, p, q, cnt, rle, std;
- int nby, ofs, dts0, dtr0, dtr1;
- int bytes;
-
- /* Initialize the pointers. We use the same buffer
- * for both input and output (we can do it because
- * the output data is at most as long as the input).
- * Note that the encode routines skipped 4 bytes at
- * each column to make room for the directory word.
- */
- read = gendata.outdata + 4;
- write = gendata.outdata;
-
- /* Set the parameters that will be used to create the directory and
- * to access the data. These parameters define the structure of the
- * directory word (32 bit) and depend on the number of nozzles that
- * are used. Note that the directory bitfield is initialized to all
- * ones (but read below for further info) because it works in negative
- * logic (i.e. a change is marked by a zero bit).
- * Below, nby is the number of bytes needed in the input data to map
- * a column (each nozzle is 1 bit, so 208 nozzles are 26 bytes and
- * 192 nozzles are 24 bytes). Ofs is the number of the first bit of
- * the directory bitfield in the directory word (with 208 nozzles we
- * need 26 bits, from 6 to 31, with 192 nozzles we need 24 bits, from
- * 8 to 31). The other three parameters are the values needed to
- * initialize the directory word properly: the key is the first two
- * bits, which must be "10" for a directly encoded stripe and "01" for
- * a RLE encoded one. In the lexmark directory, each bit represents a
- * group of 8 nozzles: in a directly encoded stripe if the bit is "1"
- * it means none of the nozzles in the group are used, if it is a "0"
- * it means at least one is used and we need to append a data byte to
- * define the exact usage pattern. So, for direct encoded stripes we
- * start with the first two bits set to "10" and all the directory
- * bitfield set to "1" (we will unset to "0" only the needed bits in
- * the encoding loop). If we are using RLE encoding, each "0" bits
- * means that there is a data byte that defines a pattern for the
- * group of 8 nozzles associated to that bit, and an "1" means that
- * the pattern for the associated group of nozzles is the same as the
- * previous group. This means that for RLE encoded stripes we start the
- * directory word with two bits set to "01" and then initialize to "1"
- * all the directory bitfield, except the first one which must be 0
- * because we must have at least one data byte to define the initial
- * pattern that will be eventually repeated.
- */
- if(gendata.numlines == 208)
- {
- nby = 26;
- ofs = 6;
- dts0 = 0x83;
- dtr0 = 0x41;
- dtr1 = 0xff;
- }
- else
- {
- nby = 24;
- ofs = 8;
- dts0 = 0x80;
- dtr0 = 0x40;
- dtr1 = 0x7f;
- }
-
- /* The variable "bytes" will contain the total
- * number of output bytes in the data stripe.
- */
- bytes = 0;
-
- /* For all the columns in the stripe */
- for(x = 0; x < numcols; x++)
- {
- /* Calculate which representation is smaller by counting
- * the number of non zero data bytes for the direct encoding
- * and the number of changes between data bytes for the RLE.
- * At the end we have in "std" the length of the output data
- * if encoded with standard encoding, and in "rle" the length
- * of the output data if encoded with RLE.
- */
- rle = 1;
- c = read[0];
- std = (c ? 1 : 0);
- for(i=1; i<nby; i++)
- {
- if((p = read[i]))std++;
- if(p != c)
- {
- rle++;
- c = read[i];
- }
- }
-
- /* Now initialize the last two bytes in the directory
- * word. These always belong to the directory bitfield
- * and must be set to all ones.
- */
- write[2] = 0xff;
- write[3] = 0xff;
-
- /* And now encode the column, using the shortest encoding.
- * If the two encodings are of equal length we prefer the
- * standard encoding to the RLE one. No real reason for
- * this: it could have been done the other way, but it
- * seems the Windows driver does this way as well...
- */
- if(std > rle)
- {
- /* Run-length encoding */
-
- write[0] = dtr0;
- write[1] = dtr1;
-
- p = read[0];
- write[4] = p;
- cnt = 5;
- q = ofs + 1;
-
- for(i=1; i<nby; i++)
- {
- if(read[i] != p)
- {
- p = read[i];
- write[cnt] = p;
- write[q>>3] &= ibits[q & 7];
- cnt++;
- }
- q++;
- }
- }
- else
- {
- /* Standard encoding */
-
- write[0] = dts0;
- write[1] = 0xff;
-
- cnt = 4;
- q = ofs;
-
- for(i=0; i<nby; i++)
- {
- p = read[i];
- if(p)
- {
- write[cnt] = p;
- write[q>>3] &= ibits[q & 7];
- cnt++;
- }
- q++;
- }
- }
-
- /* Update the counters and pointers. Note that when
- * we are here "cnt" is the number of bytes that we
- * have actually output, including the directory word.
- */
- read += (nby + 4);
- write += cnt;
- bytes += cnt;
- }
-
- fillheader(head, numcols, firstcol, bytes);
+ byte *read, *write;
+ int x, i, c, p, q, cnt, rle, std;
+ int nby, ofs, dts0, dtr0, dtr1;
+ int bytes;
+
+ /* Initialize the pointers. We use the same buffer
+ * for both input and output (we can do it because
+ * the output data is at most as long as the input).
+ * Note that the encode routines skipped 4 bytes at
+ * each column to make room for the directory word.
+ */
+ read = gendata.outdata + 4;
+ write = gendata.outdata;
+
+ /* Set the parameters that will be used to create the directory and
+ * to access the data. These parameters define the structure of the
+ * directory word (32 bit) and depend on the number of nozzles that
+ * are used. Note that the directory bitfield is initialized to all
+ * ones (but read below for further info) because it works in negative
+ * logic (i.e. a change is marked by a zero bit).
+ * Below, nby is the number of bytes needed in the input data to map
+ * a column (each nozzle is 1 bit, so 208 nozzles are 26 bytes and
+ * 192 nozzles are 24 bytes). Ofs is the number of the first bit of
+ * the directory bitfield in the directory word (with 208 nozzles we
+ * need 26 bits, from 6 to 31, with 192 nozzles we need 24 bits, from
+ * 8 to 31). The other three parameters are the values needed to
+ * initialize the directory word properly: the key is the first two
+ * bits, which must be "10" for a directly encoded stripe and "01" for
+ * a RLE encoded one. In the lexmark directory, each bit represents a
+ * group of 8 nozzles: in a directly encoded stripe if the bit is "1"
+ * it means none of the nozzles in the group are used, if it is a "0"
+ * it means at least one is used and we need to append a data byte to
+ * define the exact usage pattern. So, for direct encoded stripes we
+ * start with the first two bits set to "10" and all the directory
+ * bitfield set to "1" (we will unset to "0" only the needed bits in
+ * the encoding loop). If we are using RLE encoding, each "0" bits
+ * means that there is a data byte that defines a pattern for the
+ * group of 8 nozzles associated to that bit, and an "1" means that
+ * the pattern for the associated group of nozzles is the same as the
+ * previous group. This means that for RLE encoded stripes we start the
+ * directory word with two bits set to "01" and then initialize to "1"
+ * all the directory bitfield, except the first one which must be 0
+ * because we must have at least one data byte to define the initial
+ * pattern that will be eventually repeated.
+ */
+ if(gendata.numlines == 208)
+ {
+ nby = 26;
+ ofs = 6;
+ dts0 = 0x83;
+ dtr0 = 0x41;
+ dtr1 = 0xff;
+ }
+ else
+ {
+ nby = 24;
+ ofs = 8;
+ dts0 = 0x80;
+ dtr0 = 0x40;
+ dtr1 = 0x7f;
+ }
+
+ /* The variable "bytes" will contain the total
+ * number of output bytes in the data stripe.
+ */
+ bytes = 0;
+
+ /* For all the columns in the stripe */
+ for(x = 0; x < numcols; x++)
+ {
+ /* Calculate which representation is smaller by counting
+ * the number of non zero data bytes for the direct encoding
+ * and the number of changes between data bytes for the RLE.
+ * At the end we have in "std" the length of the output data
+ * if encoded with standard encoding, and in "rle" the length
+ * of the output data if encoded with RLE.
+ */
+ rle = 1;
+ c = read[0];
+ std = (c ? 1 : 0);
+ for(i=1; i<nby; i++)
+ {
+ if((p = read[i]))std++;
+ if(p != c)
+ {
+ rle++;
+ c = read[i];
+ }
+ }
+
+ /* Now initialize the last two bytes in the directory
+ * word. These always belong to the directory bitfield
+ * and must be set to all ones.
+ */
+ write[2] = 0xff;
+ write[3] = 0xff;
+
+ /* And now encode the column, using the shortest encoding.
+ * If the two encodings are of equal length we prefer the
+ * standard encoding to the RLE one. No real reason for
+ * this: it could have been done the other way, but it
+ * seems the Windows driver does this way as well...
+ */
+ if(std > rle)
+ {
+ /* Run-length encoding */
+
+ write[0] = dtr0;
+ write[1] = dtr1;
+
+ p = read[0];
+ write[4] = p;
+ cnt = 5;
+ q = ofs + 1;
+
+ for(i=1; i<nby; i++)
+ {
+ if(read[i] != p)
+ {
+ p = read[i];
+ write[cnt] = p;
+ write[q>>3] &= ibits[q & 7];
+ cnt++;
+ }
+ q++;
+ }
+ }
+ else
+ {
+ /* Standard encoding */
+
+ write[0] = dts0;
+ write[1] = 0xff;
+
+ cnt = 4;
+ q = ofs;
+
+ for(i=0; i<nby; i++)
+ {
+ p = read[i];
+ if(p)
+ {
+ write[cnt] = p;
+ write[q>>3] &= ibits[q & 7];
+ cnt++;
+ }
+ q++;
+ }
+ }
+
+ /* Update the counters and pointers. Note that when
+ * we are here "cnt" is the number of bytes that we
+ * have actually output, including the directory word.
+ */
+ read += (nby + 4);
+ write += cnt;
+ bytes += cnt;
+ }
+
+ fillheader(head, numcols, firstcol, bytes);
}
/* This routine takes one full buffer of data and
@@ -1583,347 +1580,347 @@ convbuf(int head, int numcols, int firstcol)
static void
encode_bw_buf(void)
{
- int left, right, x, y, nn, mod;
- int nxp, yy, numcols, incr;
- int dy, dy2, csep, pass, f1;
- int f2, start, s1, s2, yincr;
- int q, mask, lines;
- byte *scan, *data;
-
- /* Set some parameters that depend on resolution and are
- * used in the inner loop to select lines to print.
- * We basically encode all the even nozzles in a loop and
- * all the odd nozzles in another loop. The values of s1
- * and s2 are the starting offset in the line buffer for
- * the first and second loop, and yincr is the number of lines
- * in the buffer we move on at each cycle.
- */
- switch(gendata.yres)
- {
- /* At 300 dpi we use only one nozzle column, and
- * each line in the buffer is printed. So both offsets
- * are zero (only one is used, actually) and yincr is 1.
- * The mask is set to 127 because the buffer is 128 lines.
- */
- case 300:
- yincr = 1;
- s1 = 0;
- s2 = 0;
- mask = 127;
- break;
-
- /* At 600 dpi we use both nozzle columns: each row goes
- * alternatively to the left or right nozzle column. So
- * the even offset is zero, the odd offset is 1 and the
- * increment is 2: in this way the even loop scans lines
- * 0, 2, 4, ... and the odd loop lines 1, 3, 5, ...
- * Here the buffer is 256 lines so mask is set to 255.
- */
- default:
- case 600:
- yincr = 2;
- s1 = 0;
- s2 = 1;
- mask = 255;
- break;
-
- /* At 1200 dpi we are printing two interleaved passes. Each
- * nozzle column sees every fourth line in the buffer (so
- * yincr is 4) and the starting offset varies depending on
- * which interleaved pass we are doing.
- * During the first pass, even nozzles are used to print
- * lines 0, 4, 8, ... and odd nozzles are used to print
- * lines 2, 6, 10, ... while in the second pass the even
- * nozzles print lines 1, 5, 9, ... and the odd nozzles
- * print lines 3, 7, 11, ...
- * The buffer is 512 lines, so mask is set to 511 */
- case 1200:
- yincr = 4;
- s1 = (gendata.ileave ? 1 : 0);
- s2 = (gendata.ileave ? 3 : 2);
- mask = 511;
- break;
- }
-
- /* Now we must calculate the offset q from the beginning of
- * the buffer of the first line to print in this pass, and
- * the total number of lines to be printed. We print as many
- * lines as we can in a single pass, i.e. the value of "lines"
- * is simply the number of lines that at the current vertical
- * resolution fully cover the printing pen.
- * Note that in case of monochrome printing we print all
- * buffer lines, from first to last, so we also need to set
- * the mask to a neutral value because we don't use wrapping.
- */
- if(gendata.rendermode == LXM3200_M)
- {
- mask = 511;
- q = 0;
- lines = gendata.numblines;
- }
- else
- {
- q = gendata.firstline + valign[BLACKVALIGN];
- lines = (BWCOLPEN * 2) / gendata.yrmul;
- }
-
- /* Adjust the value of the nozzle column separation to the
- * horizontal resolution we are using now.
- */
- csep = (gendata.bwsep * 2) / gendata.xrmul;
-
- /* Here we calculate how many "real" passes we are doing.
- * A "real" pass is a pass where a full column is printed
- * and then some columns (maybe zero) are skipped before
- * printing another one. If we are at 1200 dpi horizontal
- * then we must use only one nozzle column at a time, so each
- * real pass comprises two subpasses, one where we print with
- * even nozzles only and another where we print with odd
- * nozzles only. So at 1200 dpi the "real" passes are half the
- * total number of passes. Another way of looking at it: the
- * "nxp" variable holds the separation, in columns, between two
- * dot columns printed in the same head sweep.
- */
- nxp = gendata.numpasses;
- if(gendata.xres == 1200)nxp /= 2;
-
- /* Now calculate the byte increments for the *output* data
- * buffer (i.e. the encoded buffer). The first variable,
- * dy, is the number of bytes taken by a single data burst
- * (both even and odd nozzle columns). The second variable,
- * dy2, tells how many bytes we must skip from one column
- * to the other (if we are printing multipass we skip some
- * columns that will be printed in subsequent passes).
- */
- dy = (gendata.numlines / 8) + 4;
- dy2 = dy * nxp;
-
- /* Calculate the starting and ending horizontal positions for
- * this head pass. There are the margins corrected to take
- * into account the displacement between the odd and even
- * nozzle columns (csep). Moreover we start "csep" pixels
- * before the margin to give the head a little more room to
- * accelerate properly (not sure if this really works, but it
- * doesn't cost much, so I've left it in).
- */
- if(gendata.direction == LEFT)
- {
- left = gendata.left - 2*csep;
- right = gendata.right + csep;
- }
- else
- {
- left = gendata.left - csep;
- right = gendata.right + 2*csep;
- }
-
- /* Number of columns in a full row */
- numcols = right - left;
-
- /* Calculate the last pixel of the first pass of the
- * stripe. If we are printing bidirectionally, this
- * will be the base to calculate the start of the
- * passes printed right-to-left.
- */
- mod = numcols - (numcols % nxp);
-
- /* f1 and f2 are two flags that define which nozzle columns
- * we are using in this stripe, f1 for the even nozzle column
- * and f2 for the odd nozzle column: if they are zero that
- * nozzle column is not used in this pass.
- */
- f1 = 1;
- f2 = 1;
- if(gendata.yres == 300)
- {
- /* At 300 dpi we use only one nozzle column. As of now this
- * is always the even one, but maybe it could be tried to
- * alternate between columns at each pass, to improve the
- * output quality.
- */
- f1 = 1;
- f2 = 0;
- }
-
- /* Now start the passes to fill all the stripe */
- for(pass = 0; pass < gendata.numpasses; pass++)
- {
- /* If there is data in the buffer which has not been
- * sent to the printer yet, send it now.
- */
- if(gendata.fullflag)
- {
- fwrite(gendata.header, 3, 8, gendata.stream);
- fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
- gendata.fullflag = FALSE;
- }
-
- /* Clear the output buffer to avoid problems with the bitwise
- * operations we will do later on.
- */
- memset(gendata.outdata, 0, gendata.numbytes * 30);
-
- /* Calculate standard increments, starting column
- * and start of output data. They will be corrected
- * later for 1200dpi or right-to-left printing direction.
- */
- incr = nxp;
- start = left + pass;
- data = gendata.outdata + (pass*dy) + 4;
-
- /* It appears that at 1200dpi, in addition of not being able
- * to use 208 nozzles mode for the black cartridge, the Lexmark
- * 3200 cannot print at full rate with all the 192 useable nozzles.
- * Maybe the reason is that the data rate of 1200dpi horizontal
- * resolution exceeds the mechanical/thermal limits of the heads.
- * So if we are printing at 1200dpi we need to use alternatively
- * only odd or even numbered nozzles, for each printed column, to
- * half the data rate towards the head.
- * This obviously means that, at 1200dpi horizontal, a minimum of
- * two passes are required to print each stripe. Since if we are
- * printing at 1200dpi vertical we need two interlaced passes, a
- * minimum grand total of 4 passes are needed to print one full
- * 1200x1200 dpi stripe with the Lexmark 3200.
- */
- if(gendata.xres == 1200)
- {
- f1 = pass & 1;
- f2 = 1 - f1;
-
- start = left + (pass/2);
- data = gendata.outdata + ((pass/2)*dy) + 4;
- }
-
- /* If printing right-to-left we need to present data
- * to the printer in that direction, inverting the
- * normal flow of data.
- */
- if(gendata.direction == RIGHT)
- {
- incr = -nxp;
- start += mod;
- }
-
- /* Start column scanning */
- x = start;
-
- /* Now we split the behaviour depending on the printing
- * direction. To be honest, the inner loops are almost
- * identical between left-to-right and right-to-left
- * directions. The only difference is where is computed
- * the contribute of the nozzle columns separation ("csep"),
- * but having the "if" outside the loop it's somehow better.
- */
- if(gendata.direction == LEFT)
- {
- /* For all the columns in this pass */
- for(nn = 0; nn < numcols; nn += nxp)
- {
- /* Encode the even numbered nozzles */
- if((x >= 0) && f1)
- {
- scan = gendata.scanbuf + x;
- yy = 0;
- for(y = s1; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
-
- /* Encode the odd numbered nozzles */
- if(((x+csep) < gendata.numbytes) && f2)
- {
- scan = gendata.scanbuf + x + csep;
- yy = 1;
- for(y = s2; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
-
- /* If we are in 1200dpi horizontal resolution,
- * alternate between nozzle columns to avoid
- * overstressing the printing head.
- */
- if(gendata.xres == 1200)
- {
- f1 = 1 - f1;
- f2 = 1 - f2;
- }
-
- /* Adjust data pointers */
- data += dy2;
- x += incr;
- }
- }
- else /* direction == RIGHT */
- {
- /* For all the columns in this pass */
- for(nn = 0; nn < numcols; nn += nxp)
- {
- /* Encode the odd numbered nozzles */
- if((x < gendata.numbytes) && f1)
- {
- scan = gendata.scanbuf + x;
- yy = 1;
- for(y = s1; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
-
- /* Encode the even numbered nozzles */
- if(((x-csep) >= 0) && f2)
- {
- scan = gendata.scanbuf + x - csep;
- yy = 0;
- for(y = s2; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask)*gendata.numbytes] & BLACK)
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
-
- /* If we are in 1200dpi horizontal resolution,
- * alternate between nozzle columns to avoid
- * overstressing the printing head.
- */
- if(gendata.xres == 1200)
- {
- f1 = 1 - f1;
- f2 = 1 - f2;
- }
-
- /* Adjust data pointers */
- data += dy2;
- x += incr;
- }
- }
-
- /* Convert the buffer to the shortest output format.
- * Which is the first column of the output depends
- * on the printing direction: it will be the left
- * margin if we are printing left to right or the
- * right margin if we are printing right to left.
- */
- if(gendata.direction == LEFT)
- convbuf(LEFT, numcols, left);
- else
- convbuf(LEFT, numcols, right);
- }
+ int left, right, x, y, nn, mod;
+ int nxp, yy, numcols, incr;
+ int dy, dy2, csep, pass, f1;
+ int f2, start, s1, s2, yincr;
+ int q, mask, lines;
+ byte *scan, *data;
+
+ /* Set some parameters that depend on resolution and are
+ * used in the inner loop to select lines to print.
+ * We basically encode all the even nozzles in a loop and
+ * all the odd nozzles in another loop. The values of s1
+ * and s2 are the starting offset in the line buffer for
+ * the first and second loop, and yincr is the number of lines
+ * in the buffer we move on at each cycle.
+ */
+ switch(gendata.yres)
+ {
+ /* At 300 dpi we use only one nozzle column, and
+ * each line in the buffer is printed. So both offsets
+ * are zero (only one is used, actually) and yincr is 1.
+ * The mask is set to 127 because the buffer is 128 lines.
+ */
+ case 300:
+ yincr = 1;
+ s1 = 0;
+ s2 = 0;
+ mask = 127;
+ break;
+
+ /* At 600 dpi we use both nozzle columns: each row goes
+ * alternatively to the left or right nozzle column. So
+ * the even offset is zero, the odd offset is 1 and the
+ * increment is 2: in this way the even loop scans lines
+ * 0, 2, 4, ... and the odd loop lines 1, 3, 5, ...
+ * Here the buffer is 256 lines so mask is set to 255.
+ */
+ default:
+ case 600:
+ yincr = 2;
+ s1 = 0;
+ s2 = 1;
+ mask = 255;
+ break;
+
+ /* At 1200 dpi we are printing two interleaved passes. Each
+ * nozzle column sees every fourth line in the buffer (so
+ * yincr is 4) and the starting offset varies depending on
+ * which interleaved pass we are doing.
+ * During the first pass, even nozzles are used to print
+ * lines 0, 4, 8, ... and odd nozzles are used to print
+ * lines 2, 6, 10, ... while in the second pass the even
+ * nozzles print lines 1, 5, 9, ... and the odd nozzles
+ * print lines 3, 7, 11, ...
+ * The buffer is 512 lines, so mask is set to 511 */
+ case 1200:
+ yincr = 4;
+ s1 = (gendata.ileave ? 1 : 0);
+ s2 = (gendata.ileave ? 3 : 2);
+ mask = 511;
+ break;
+ }
+
+ /* Now we must calculate the offset q from the beginning of
+ * the buffer of the first line to print in this pass, and
+ * the total number of lines to be printed. We print as many
+ * lines as we can in a single pass, i.e. the value of "lines"
+ * is simply the number of lines that at the current vertical
+ * resolution fully cover the printing pen.
+ * Note that in case of monochrome printing we print all
+ * buffer lines, from first to last, so we also need to set
+ * the mask to a neutral value because we don't use wrapping.
+ */
+ if(gendata.rendermode == LXM3200_M)
+ {
+ mask = 511;
+ q = 0;
+ lines = gendata.numblines;
+ }
+ else
+ {
+ q = gendata.firstline + valign[BLACKVALIGN];
+ lines = (BWCOLPEN * 2) / gendata.yrmul;
+ }
+
+ /* Adjust the value of the nozzle column separation to the
+ * horizontal resolution we are using now.
+ */
+ csep = (gendata.bwsep * 2) / gendata.xrmul;
+
+ /* Here we calculate how many "real" passes we are doing.
+ * A "real" pass is a pass where a full column is printed
+ * and then some columns (maybe zero) are skipped before
+ * printing another one. If we are at 1200 dpi horizontal
+ * then we must use only one nozzle column at a time, so each
+ * real pass comprises two subpasses, one where we print with
+ * even nozzles only and another where we print with odd
+ * nozzles only. So at 1200 dpi the "real" passes are half the
+ * total number of passes. Another way of looking at it: the
+ * "nxp" variable holds the separation, in columns, between two
+ * dot columns printed in the same head sweep.
+ */
+ nxp = gendata.numpasses;
+ if(gendata.xres == 1200)nxp /= 2;
+
+ /* Now calculate the byte increments for the *output* data
+ * buffer (i.e. the encoded buffer). The first variable,
+ * dy, is the number of bytes taken by a single data burst
+ * (both even and odd nozzle columns). The second variable,
+ * dy2, tells how many bytes we must skip from one column
+ * to the other (if we are printing multipass we skip some
+ * columns that will be printed in subsequent passes).
+ */
+ dy = (gendata.numlines / 8) + 4;
+ dy2 = dy * nxp;
+
+ /* Calculate the starting and ending horizontal positions for
+ * this head pass. There are the margins corrected to take
+ * into account the displacement between the odd and even
+ * nozzle columns (csep). Moreover we start "csep" pixels
+ * before the margin to give the head a little more room to
+ * accelerate properly (not sure if this really works, but it
+ * doesn't cost much, so I've left it in).
+ */
+ if(gendata.direction == LEFT)
+ {
+ left = gendata.left - 2*csep;
+ right = gendata.right + csep;
+ }
+ else
+ {
+ left = gendata.left - csep;
+ right = gendata.right + 2*csep;
+ }
+
+ /* Number of columns in a full row */
+ numcols = right - left;
+
+ /* Calculate the last pixel of the first pass of the
+ * stripe. If we are printing bidirectionally, this
+ * will be the base to calculate the start of the
+ * passes printed right-to-left.
+ */
+ mod = numcols - (numcols % nxp);
+
+ /* f1 and f2 are two flags that define which nozzle columns
+ * we are using in this stripe, f1 for the even nozzle column
+ * and f2 for the odd nozzle column: if they are zero that
+ * nozzle column is not used in this pass.
+ */
+ f1 = 1;
+ f2 = 1;
+ if(gendata.yres == 300)
+ {
+ /* At 300 dpi we use only one nozzle column. As of now this
+ * is always the even one, but maybe it could be tried to
+ * alternate between columns at each pass, to improve the
+ * output quality.
+ */
+ f1 = 1;
+ f2 = 0;
+ }
+
+ /* Now start the passes to fill all the stripe */
+ for(pass = 0; pass < gendata.numpasses; pass++)
+ {
+ /* If there is data in the buffer which has not been
+ * sent to the printer yet, send it now.
+ */
+ if(gendata.fullflag)
+ {
+ fwrite(gendata.header, 3, 8, gendata.stream);
+ fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
+ gendata.fullflag = FALSE;
+ }
+
+ /* Clear the output buffer to avoid problems with the bitwise
+ * operations we will do later on.
+ */
+ memset(gendata.outdata, 0, gendata.numbytes * 30);
+
+ /* Calculate standard increments, starting column
+ * and start of output data. They will be corrected
+ * later for 1200dpi or right-to-left printing direction.
+ */
+ incr = nxp;
+ start = left + pass;
+ data = gendata.outdata + (pass*dy) + 4;
+
+ /* It appears that at 1200dpi, in addition of not being able
+ * to use 208 nozzles mode for the black cartridge, the Lexmark
+ * 3200 cannot print at full rate with all the 192 useable nozzles.
+ * Maybe the reason is that the data rate of 1200dpi horizontal
+ * resolution exceeds the mechanical/thermal limits of the heads.
+ * So if we are printing at 1200dpi we need to use alternatively
+ * only odd or even numbered nozzles, for each printed column, to
+ * half the data rate towards the head.
+ * This obviously means that, at 1200dpi horizontal, a minimum of
+ * two passes are required to print each stripe. Since if we are
+ * printing at 1200dpi vertical we need two interlaced passes, a
+ * minimum grand total of 4 passes are needed to print one full
+ * 1200x1200 dpi stripe with the Lexmark 3200.
+ */
+ if(gendata.xres == 1200)
+ {
+ f1 = pass & 1;
+ f2 = 1 - f1;
+
+ start = left + (pass/2);
+ data = gendata.outdata + ((pass/2)*dy) + 4;
+ }
+
+ /* If printing right-to-left we need to present data
+ * to the printer in that direction, inverting the
+ * normal flow of data.
+ */
+ if(gendata.direction == RIGHT)
+ {
+ incr = -nxp;
+ start += mod;
+ }
+
+ /* Start column scanning */
+ x = start;
+
+ /* Now we split the behaviour depending on the printing
+ * direction. To be honest, the inner loops are almost
+ * identical between left-to-right and right-to-left
+ * directions. The only difference is where is computed
+ * the contribute of the nozzle columns separation ("csep"),
+ * but having the "if" outside the loop it's somehow better.
+ */
+ if(gendata.direction == LEFT)
+ {
+ /* For all the columns in this pass */
+ for(nn = 0; nn < numcols; nn += nxp)
+ {
+ /* Encode the even numbered nozzles */
+ if((x >= 0) && f1)
+ {
+ scan = gendata.scanbuf + x;
+ yy = 0;
+ for(y = s1; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+
+ /* Encode the odd numbered nozzles */
+ if(((x+csep) < gendata.numbytes) && f2)
+ {
+ scan = gendata.scanbuf + x + csep;
+ yy = 1;
+ for(y = s2; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+
+ /* If we are in 1200dpi horizontal resolution,
+ * alternate between nozzle columns to avoid
+ * overstressing the printing head.
+ */
+ if(gendata.xres == 1200)
+ {
+ f1 = 1 - f1;
+ f2 = 1 - f2;
+ }
+
+ /* Adjust data pointers */
+ data += dy2;
+ x += incr;
+ }
+ }
+ else /* direction == RIGHT */
+ {
+ /* For all the columns in this pass */
+ for(nn = 0; nn < numcols; nn += nxp)
+ {
+ /* Encode the odd numbered nozzles */
+ if((x < gendata.numbytes) && f1)
+ {
+ scan = gendata.scanbuf + x;
+ yy = 1;
+ for(y = s1; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & BLACK)
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+
+ /* Encode the even numbered nozzles */
+ if(((x-csep) >= 0) && f2)
+ {
+ scan = gendata.scanbuf + x - csep;
+ yy = 0;
+ for(y = s2; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask)*gendata.numbytes] & BLACK)
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+
+ /* If we are in 1200dpi horizontal resolution,
+ * alternate between nozzle columns to avoid
+ * overstressing the printing head.
+ */
+ if(gendata.xres == 1200)
+ {
+ f1 = 1 - f1;
+ f2 = 1 - f2;
+ }
+
+ /* Adjust data pointers */
+ data += dy2;
+ x += incr;
+ }
+ }
+
+ /* Convert the buffer to the shortest output format.
+ * Which is the first column of the output depends
+ * on the printing direction: it will be the left
+ * margin if we are printing left to right or the
+ * right margin if we are printing right to left.
+ */
+ if(gendata.direction == LEFT)
+ convbuf(LEFT, numcols, left);
+ else
+ convbuf(LEFT, numcols, right);
+ }
}
/* This routine is the equivalent of encode_bw_buf() but
* for color or photo cartridge. Since this routine is
* heavily based on the B/W one, the comments here will
- * be somewhat less esaurient. Please have a look at
+ * be somewhat less esaurient. Please have a look at
* encode_bw_buf() to understand better how this routine
* works: I will only pinpoint the differences between this
* routine and encode_bw_buf().
@@ -1931,377 +1928,377 @@ encode_bw_buf(void)
* head: the head we are calculating the buffer for. It will
* be LEFT for a photo cartridge or RIGHT for a color one.
*/
-static void
+static void
encode_col_buf(int head)
{
- int left, right, x, y, nn, mod;
- int nxp, yy, numcols, incr;
- int dy, dy2, csep, pass, f1;
- int f2, start, s1, s2, yincr;
- int q, mask, k, align, lines;
- byte *scan, *data;
-
- /* Here there are two more parameters: mask and lines, that
- * for color cartridges are both dependent on vertical
- * resolution. Since the buffer is "rolling", i.e. it is
- * implemented as a circular array, all the coordinates of
- * the buffer lines must be taken modulo the buffer length.
- * We choose a buffer length that is a power of two to be
- * able to turn the modulo operation into a bitwise AND, so
- * we need to set "mask" to the correct value for the AND.
- * Another difference is that "lines", i.e. the number of
- * lines to print in each pass, is based on the height of a
- * color pen. Since there are three color pens in each cartridge,
- * each color pen is treated separately to fully cover the
- * printing head.
- */
- switch(gendata.yres)
- {
- case 300:
- yincr = 1;
- s1 = 0;
- s2 = 0;
- mask = 127;
- lines = COLORPEN/2;
- break;
-
- default:
- case 600:
- yincr = 2;
- s1 = 0;
- s2 = 1;
- mask = 255;
- lines = COLORPEN;
- break;
-
- case 1200:
- yincr = 4;
- s1 = (gendata.ileave ? 1 : 0);
- s2 = (gendata.ileave ? 3 : 2);
- mask = 511;
- lines = COLORPEN*2;
- break;
- }
-
- /* Choose the vertical alignment depending on the head.
- * This is needed to vertically align the color cartridge
- * with the photo or black cartridge.
- */
- if(head == LEFT)
- align = valign[PHOTOVALIGN];
- else
- align = valign[COLORVALIGN];
-
- /* All the stuff below is exactly the same as in
- * encode_bw_buf(), and is therefore commented there.
- */
-
- csep = (gendata.bwsep * 2) / gendata.xrmul;
- nxp = gendata.numpasses;
- if(gendata.xres == 1200)nxp /= 2;
-
- dy = (gendata.numlines / 8) + 4;
- dy2 = dy * nxp;
-
- if(gendata.direction == LEFT)
- {
- left = gendata.left - 2*csep;
- right = gendata.right + csep;
- }
- else
- {
- left = gendata.left - csep;
- right = gendata.right + 2*csep;
- }
-
- numcols = right - left;
- mod = numcols - (numcols % nxp);
-
- f1 = 1;
- f2 = 1;
- if(gendata.yres == 300)
- {
- f1 = 1;
- f2 = 0;
- }
-
- /* For all passes */
- for(pass = 0; pass < gendata.numpasses; pass++)
- {
- /* If there is data in the buffer which has not been
- * sent to the printer yet, do it now.
- */
- if(gendata.fullflag)
- {
- fwrite(gendata.header, 3, 8, gendata.stream);
- fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
- gendata.fullflag = FALSE;
- }
-
- /* All the stuff below is exactly the same as in
- * encode_bw_buf(), and is therefore commented there.
- */
-
- memset(gendata.outdata, 0, gendata.numbytes * 30);
-
- incr = nxp;
- start = left + pass;
- data = gendata.outdata + (pass*dy) + 4;
-
- if(gendata.xres == 1200)
- {
- f1 = pass & 1;
- f2 = 1 - f1;
-
- start = left + (pass/2);
- data = gendata.outdata + ((pass/2)*dy) + 4;
- }
-
- if(gendata.direction == RIGHT)
- {
- incr = -nxp;
- start += mod;
- }
-
- /* Start column scanning */
- x = start;
-
- if(gendata.direction == LEFT)
- {
- /* For all the columns */
- for(nn = 0; nn < numcols; nn += nxp)
- {
- /* Encode the even numbered nozzles */
- if((x >= 0) && f1)
- {
- scan = gendata.scanbuf + x;
- yy = 0;
-
- /* In color printing there is one more loop to scan
- * all three color pens. We have to do exactly the
- * same things for all pens: the only differences are
- * the color encoding bit we are testing and the offset
- * from the beginning of the buffer and the offset of the
- * output data. All of this is stored into arrays. The
- * "penofs" array stores the offset of the first line of
- * each pen in the raster buffer. The array "colmask" stores
- * the encoding bits for the color of each pen, and it
- * is bidimensional because pen masks are different between
- * a color cartridge (where pens are Cyan, Magenta, Yellow)
- * and a photo cartridge (where pens are LightCyan,
- * LightMagenta and Black).
- */
- for(k=0; k<3; k++)
- {
- q = gendata.firstline + align + penofs[k];
- for(y = s1; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
- }
-
- /* Encode the odd numbered nozzles */
- if(((x+csep) < gendata.numbytes) && f2)
- {
- scan = gendata.scanbuf + x + csep;
- yy = 1;
- for(k=0; k<3; k++)
- {
- q = gendata.firstline + align + penofs[k];
- for(y = s2; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
- }
-
- /* If we are in 1200dpi horizontal resolution,
- * alternate between nozzle columns to avoid
- * overstressing the printing head.
- */
- if(gendata.xres == 1200)
- {
- f1 = 1 - f1;
- f2 = 1 - f2;
- }
-
- /* Adjust data pointers */
- data += dy2;
- x += incr;
- }
- }
- else
- {
- /* For all the columns */
- for(nn = 0; nn < numcols; nn += nxp)
- {
- /* Encode the odd numbered nozzles */
- if((x < gendata.numbytes) && f1)
- {
- scan = gendata.scanbuf + x;
- yy = 1;
- for(k=0; k<3; k++)
- {
- q = gendata.firstline + align + penofs[k];
- for(y = s1; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
- }
-
- /* Encode the even numbered nozzles */
- if(((x-csep) >= 0) && f2)
- {
- scan = gendata.scanbuf + x - csep;
- yy = 0;
- for(k=0; k<3; k++)
- {
- q = gendata.firstline + align + penofs[k];
- for(y = s2; y < lines; y += yincr)
- {
- if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
- data[yy/8] |= bits[yy&7];
- yy += 2;
- }
- }
- }
-
- /* If we are in 1200dpi horizontal resolution,
- * alternate between nozzle columns to avoid
- * overstressing the printing head.
- */
- if(gendata.xres == 1200)
- {
- f1 = 1 - f1;
- f2 = 1 - f2;
- }
-
- /* Adjust data pointers */
- data += dy2;
- x += incr;
- }
- }
-
- if(gendata.direction == LEFT)
- convbuf(head, numcols, left);
- else
- convbuf(head, numcols, right);
- }
+ int left, right, x, y, nn, mod;
+ int nxp, yy, numcols, incr;
+ int dy, dy2, csep, pass, f1;
+ int f2, start, s1, s2, yincr;
+ int q, mask, k, align, lines;
+ byte *scan, *data;
+
+ /* Here there are two more parameters: mask and lines, that
+ * for color cartridges are both dependent on vertical
+ * resolution. Since the buffer is "rolling", i.e. it is
+ * implemented as a circular array, all the coordinates of
+ * the buffer lines must be taken modulo the buffer length.
+ * We choose a buffer length that is a power of two to be
+ * able to turn the modulo operation into a bitwise AND, so
+ * we need to set "mask" to the correct value for the AND.
+ * Another difference is that "lines", i.e. the number of
+ * lines to print in each pass, is based on the height of a
+ * color pen. Since there are three color pens in each cartridge,
+ * each color pen is treated separately to fully cover the
+ * printing head.
+ */
+ switch(gendata.yres)
+ {
+ case 300:
+ yincr = 1;
+ s1 = 0;
+ s2 = 0;
+ mask = 127;
+ lines = COLORPEN/2;
+ break;
+
+ default:
+ case 600:
+ yincr = 2;
+ s1 = 0;
+ s2 = 1;
+ mask = 255;
+ lines = COLORPEN;
+ break;
+
+ case 1200:
+ yincr = 4;
+ s1 = (gendata.ileave ? 1 : 0);
+ s2 = (gendata.ileave ? 3 : 2);
+ mask = 511;
+ lines = COLORPEN*2;
+ break;
+ }
+
+ /* Choose the vertical alignment depending on the head.
+ * This is needed to vertically align the color cartridge
+ * with the photo or black cartridge.
+ */
+ if(head == LEFT)
+ align = valign[PHOTOVALIGN];
+ else
+ align = valign[COLORVALIGN];
+
+ /* All the stuff below is exactly the same as in
+ * encode_bw_buf(), and is therefore commented there.
+ */
+
+ csep = (gendata.bwsep * 2) / gendata.xrmul;
+ nxp = gendata.numpasses;
+ if(gendata.xres == 1200)nxp /= 2;
+
+ dy = (gendata.numlines / 8) + 4;
+ dy2 = dy * nxp;
+
+ if(gendata.direction == LEFT)
+ {
+ left = gendata.left - 2*csep;
+ right = gendata.right + csep;
+ }
+ else
+ {
+ left = gendata.left - csep;
+ right = gendata.right + 2*csep;
+ }
+
+ numcols = right - left;
+ mod = numcols - (numcols % nxp);
+
+ f1 = 1;
+ f2 = 1;
+ if(gendata.yres == 300)
+ {
+ f1 = 1;
+ f2 = 0;
+ }
+
+ /* For all passes */
+ for(pass = 0; pass < gendata.numpasses; pass++)
+ {
+ /* If there is data in the buffer which has not been
+ * sent to the printer yet, do it now.
+ */
+ if(gendata.fullflag)
+ {
+ fwrite(gendata.header, 3, 8, gendata.stream);
+ fwrite(gendata.outdata, gendata.stripebytes, 1, gendata.stream);
+ gendata.fullflag = FALSE;
+ }
+
+ /* All the stuff below is exactly the same as in
+ * encode_bw_buf(), and is therefore commented there.
+ */
+
+ memset(gendata.outdata, 0, gendata.numbytes * 30);
+
+ incr = nxp;
+ start = left + pass;
+ data = gendata.outdata + (pass*dy) + 4;
+
+ if(gendata.xres == 1200)
+ {
+ f1 = pass & 1;
+ f2 = 1 - f1;
+
+ start = left + (pass/2);
+ data = gendata.outdata + ((pass/2)*dy) + 4;
+ }
+
+ if(gendata.direction == RIGHT)
+ {
+ incr = -nxp;
+ start += mod;
+ }
+
+ /* Start column scanning */
+ x = start;
+
+ if(gendata.direction == LEFT)
+ {
+ /* For all the columns */
+ for(nn = 0; nn < numcols; nn += nxp)
+ {
+ /* Encode the even numbered nozzles */
+ if((x >= 0) && f1)
+ {
+ scan = gendata.scanbuf + x;
+ yy = 0;
+
+ /* In color printing there is one more loop to scan
+ * all three color pens. We have to do exactly the
+ * same things for all pens: the only differences are
+ * the color encoding bit we are testing and the offset
+ * from the beginning of the buffer and the offset of the
+ * output data. All of this is stored into arrays. The
+ * "penofs" array stores the offset of the first line of
+ * each pen in the raster buffer. The array "colmask" stores
+ * the encoding bits for the color of each pen, and it
+ * is bidimensional because pen masks are different between
+ * a color cartridge (where pens are Cyan, Magenta, Yellow)
+ * and a photo cartridge (where pens are LightCyan,
+ * LightMagenta and Black).
+ */
+ for(k=0; k<3; k++)
+ {
+ q = gendata.firstline + align + penofs[k];
+ for(y = s1; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+ }
+
+ /* Encode the odd numbered nozzles */
+ if(((x+csep) < gendata.numbytes) && f2)
+ {
+ scan = gendata.scanbuf + x + csep;
+ yy = 1;
+ for(k=0; k<3; k++)
+ {
+ q = gendata.firstline + align + penofs[k];
+ for(y = s2; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+ }
+
+ /* If we are in 1200dpi horizontal resolution,
+ * alternate between nozzle columns to avoid
+ * overstressing the printing head.
+ */
+ if(gendata.xres == 1200)
+ {
+ f1 = 1 - f1;
+ f2 = 1 - f2;
+ }
+
+ /* Adjust data pointers */
+ data += dy2;
+ x += incr;
+ }
+ }
+ else
+ {
+ /* For all the columns */
+ for(nn = 0; nn < numcols; nn += nxp)
+ {
+ /* Encode the odd numbered nozzles */
+ if((x < gendata.numbytes) && f1)
+ {
+ scan = gendata.scanbuf + x;
+ yy = 1;
+ for(k=0; k<3; k++)
+ {
+ q = gendata.firstline + align + penofs[k];
+ for(y = s1; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+ }
+
+ /* Encode the even numbered nozzles */
+ if(((x-csep) >= 0) && f2)
+ {
+ scan = gendata.scanbuf + x - csep;
+ yy = 0;
+ for(k=0; k<3; k++)
+ {
+ q = gendata.firstline + align + penofs[k];
+ for(y = s2; y < lines; y += yincr)
+ {
+ if(scan[((y+q) & mask) * gendata.numbytes] & colmask[head][k])
+ data[yy/8] |= bits[yy&7];
+ yy += 2;
+ }
+ }
+ }
+
+ /* If we are in 1200dpi horizontal resolution,
+ * alternate between nozzle columns to avoid
+ * overstressing the printing head.
+ */
+ if(gendata.xres == 1200)
+ {
+ f1 = 1 - f1;
+ f2 = 1 - f2;
+ }
+
+ /* Adjust data pointers */
+ data += dy2;
+ x += incr;
+ }
+ }
+
+ if(gendata.direction == LEFT)
+ convbuf(head, numcols, left);
+ else
+ convbuf(head, numcols, right);
+ }
}
-/* Fill monochrome buffer: this routine fills the buffer
- * with rasterized lines, skipping over vertical spacing
- * (i.e. completely blank lines). The routine is only
- * used in monochrome mode, where we print a full buffer
- * at each stripe. The color printing needs a different
+/* Fill monochrome buffer: this routine fills the buffer
+ * with rasterized lines, skipping over vertical spacing
+ * (i.e. completely blank lines). The routine is only
+ * used in monochrome mode, where we print a full buffer
+ * at each stripe. The color printing needs a different
* routine which makes use of a circular buffer.
- *
+ *
* vline: the line from which to start searching for data.
*/
static int
fill_mono_buffer(int vline)
{
- byte *in_data, *data;
- int i, ret, ofs;
-
- /* Initialize the "data" pointer, that will be used to
- * scan all the lines in the buffer, and the "ofs" pointer
- * that will be used to mark the start of the "real" rasterized
- * data into the buffer (see below). To compensate for the offsets
- * caused by the horizontal spacing between nozzle columns on a
- * cartridge, the head must start before the horizontal margin, so
- * the buffer width is slightly bigger than the width of the
- * rasterized lines. The difference is the "guard offset", and the
- * variables gendata.numbytes and gendata.numrbytes hold respectively
- * the number of bytes in a buffer line and the number of bytes in a
- * rasterized scanline, while gendata.goffset contains the number of
- * bytes reserved to the guard offset on each side of the scanline.
- */
- data = gendata.scanbuf;
- ofs = gendata.goffset;
-
- /* Cycle until we have no more lines on the page */
- while(vline < gendata.numvlines)
- {
- /* Ask Ghostscript for one rasterized line */
- gdev_prn_get_bits((gx_device_printer *)gendata.dev,
- vline, data+ofs, &in_data);
-
- /* And check if it's all zero: if not, break out of
- * the loop. This nice trick with memcpy it's by Stephen
- * Taylor (if I'm not wrong...)
-
- */
- if(in_data[0] != 0 ||
- memcmp(in_data, in_data+1,gendata.numrbytes-1))break;
- vline++;
- }
-
- /* If we are here because no non-empty lines were found before
- * the end of the page, our work is over. Return to the caller
- * saying that this is the last buffer (LAST bit set) and it's
- * empty (no LHDATA or RHDATA bit set).
- */
- if(vline >= gendata.numvlines)return(LAST);
-
- /* This buffer contains at least one non-empty line.
- * Adjust the current vertical position and load the first
- * line into the buffer.
- */
- gendata.curvline = vline;
- memset(data, 0, gendata.numbytes);
- if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
-
- vline++;
- data += gendata.numbytes;
-
- /* Now initialize the return value to LHDATA (since at least
- * one non-blank line was found, this buffer contains data, and
- * it is obviously left-head data because we are in monochromatic
- * mode and so we are printing with left head only).
- * After that, get as many rasterized lines as needed to fill the
- * buffer, checking if in the process we have reached the end of
- * the page.
- */
- ret = LHDATA;
- for(i=1; i<gendata.numblines; i++)
- {
- memset(data, 0, gendata.numbytes);
- if(vline > gendata.numvlines)
- {
- /* Ok, we are at the end of the page, so set the LAST bit
- * in the return value but don't exit the loop because we
- * need to make sure all remaining lines in the buffer will
- * be blanked (exiting now would leave them untouched from
- * the previous stripe). This is needed to avoid printing
- * random data under the bottom margin.
- */
- ret = LHDATA | LAST;
- }
- else
- {
- /* If we are not at the end of the page, copy one more
- * scanline into the buffer.
- */
- gdev_prn_get_bits((gx_device_printer *)gendata.dev,
- vline, data+ofs, &in_data);
- if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
- }
-
- vline++;
- data += gendata.numbytes;
-
- }
-
- return(ret);
+ byte *in_data, *data;
+ int i, ret, ofs;
+
+ /* Initialize the "data" pointer, that will be used to
+ * scan all the lines in the buffer, and the "ofs" pointer
+ * that will be used to mark the start of the "real" rasterized
+ * data into the buffer (see below). To compensate for the offsets
+ * caused by the horizontal spacing between nozzle columns on a
+ * cartridge, the head must start before the horizontal margin, so
+ * the buffer width is slightly bigger than the width of the
+ * rasterized lines. The difference is the "guard offset", and the
+ * variables gendata.numbytes and gendata.numrbytes hold respectively
+ * the number of bytes in a buffer line and the number of bytes in a
+ * rasterized scanline, while gendata.goffset contains the number of
+ * bytes reserved to the guard offset on each side of the scanline.
+ */
+ data = gendata.scanbuf;
+ ofs = gendata.goffset;
+
+ /* Cycle until we have no more lines on the page */
+ while(vline < gendata.numvlines)
+ {
+ /* Ask Ghostscript for one rasterized line */
+ gdev_prn_get_bits((gx_device_printer *)gendata.dev,
+ vline, data+ofs, &in_data);
+
+ /* And check if it's all zero: if not, break out of
+ * the loop. This nice trick with memcpy it's by Stephen
+ * Taylor (if I'm not wrong...)
+
+ */
+ if(in_data[0] != 0 ||
+ memcmp(in_data, in_data+1,gendata.numrbytes-1))break;
+ vline++;
+ }
+
+ /* If we are here because no non-empty lines were found before
+ * the end of the page, our work is over. Return to the caller
+ * saying that this is the last buffer (LAST bit set) and it's
+ * empty (no LHDATA or RHDATA bit set).
+ */
+ if(vline >= gendata.numvlines)return(LAST);
+
+ /* This buffer contains at least one non-empty line.
+ * Adjust the current vertical position and load the first
+ * line into the buffer.
+ */
+ gendata.curvline = vline;
+ memset(data, 0, gendata.numbytes);
+ if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
+
+ vline++;
+ data += gendata.numbytes;
+
+ /* Now initialize the return value to LHDATA (since at least
+ * one non-blank line was found, this buffer contains data, and
+ * it is obviously left-head data because we are in monochromatic
+ * mode and so we are printing with left head only).
+ * After that, get as many rasterized lines as needed to fill the
+ * buffer, checking if in the process we have reached the end of
+ * the page.
+ */
+ ret = LHDATA;
+ for(i=1; i<gendata.numblines; i++)
+ {
+ memset(data, 0, gendata.numbytes);
+ if(vline > gendata.numvlines)
+ {
+ /* Ok, we are at the end of the page, so set the LAST bit
+ * in the return value but don't exit the loop because we
+ * need to make sure all remaining lines in the buffer will
+ * be blanked (exiting now would leave them untouched from
+ * the previous stripe). This is needed to avoid printing
+ * random data under the bottom margin.
+ */
+ ret = LHDATA | LAST;
+ }
+ else
+ {
+ /* If we are not at the end of the page, copy one more
+ * scanline into the buffer.
+ */
+ gdev_prn_get_bits((gx_device_printer *)gendata.dev,
+ vline, data+ofs, &in_data);
+ if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
+ }
+
+ vline++;
+ data += gendata.numbytes;
+
+ }
+
+ return(ret);
}
/* Fill the buffer with initial data.
@@ -2310,181 +2307,181 @@ fill_mono_buffer(int vline)
* mode, we just call fill_mono_buffer for the first line.
* If we are printing in color mode, we have a problem to
* solve: since the color pen are stacked vertically, we
- * need multiple head passes to print all colors on the
+ * need multiple head passes to print all colors on the
* same line. So, to simplify all, we start with the paper
* at a fixed vertical position, even if it's blank, and
* then we go down in fixed increments, equal to the height
* of a color pen. This means we check all buffers without
* skipping over blank ones, but since we actually send the
* printing commands to the printer only when there is something
- * to print, there is no speed impact.
+ * to print, there is no speed impact.
*/
-static int
+static int
init_buffer(void)
{
- byte *in_data, *data;
- int i, ret, p1, p2, ofs;
-
- data = gendata.scanbuf;
- ofs = gendata.goffset;
-
- if(gendata.rendermode == LXM3200_M)return(fill_mono_buffer(0));
-
- /* We position the heads with the bottom color pen (the
- * yellow one in the color cartridge and the black one
- * in the photo cartridge) just covering the first lines
- * of the paper sheet. So the first buffer is divided in
- * two parts: "p1" is the number of lines above the top
- * border and "p2" the number of lines below.
- */
- p1 = 368 / gendata.yrmul;
- p2 = 144 / gendata.yrmul;
-
- /* Initialize the counters */
- gendata.curvline = -p1;
- gendata.lastblack = gendata.curvline - 1;
- data = gendata.scanbuf;
-
- /* Clear the lines of the buffer that correspond to
- * lines above the top margin: of course we don't
- * want to print anything on the air...
- */
- for(i=0; i<p1; i++)
- {
- memset(data, 0, gendata.numbytes);
- data += gendata.numbytes;
- }
-
- /* And now load the last part of the buffer.
- * Note that here we don't check for blank lines,
- * this will be cared for later.
- */
- for(i=0; i<p2; i++)
- {
- memset(data, 0, gendata.numbytes);
-
- if(i < gendata.numvlines)
- {
- gdev_prn_get_bits((gx_device_printer *)gendata.dev,
- i, data+ofs, &in_data);
- if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
- }
-
- data += gendata.numbytes;
- }
-
- gendata.firstline = 0;
-
- /* Now check the return value. If by chance we are under
- * the bottom margin, add the LAST bit to the return value.
- * Of course, since this is the first buffer of the page,
- * it's not likely we will reach the bottom margin in
- * this pass. Anyway this is code that will be executed
- * only once per page, so better safe than sorry.
- */
- ret = (gendata.numvlines < p2 ? LAST : 0) | qualify_buffer();
-
- return(ret);
+ byte *in_data, *data;
+ int i, ret, p1, p2, ofs;
+
+ data = gendata.scanbuf;
+ ofs = gendata.goffset;
+
+ if(gendata.rendermode == LXM3200_M)return(fill_mono_buffer(0));
+
+ /* We position the heads with the bottom color pen (the
+ * yellow one in the color cartridge and the black one
+ * in the photo cartridge) just covering the first lines
+ * of the paper sheet. So the first buffer is divided in
+ * two parts: "p1" is the number of lines above the top
+ * border and "p2" the number of lines below.
+ */
+ p1 = 368 / gendata.yrmul;
+ p2 = 144 / gendata.yrmul;
+
+ /* Initialize the counters */
+ gendata.curvline = -p1;
+ gendata.lastblack = gendata.curvline - 1;
+ data = gendata.scanbuf;
+
+ /* Clear the lines of the buffer that correspond to
+ * lines above the top margin: of course we don't
+ * want to print anything on the air...
+ */
+ for(i=0; i<p1; i++)
+ {
+ memset(data, 0, gendata.numbytes);
+ data += gendata.numbytes;
+ }
+
+ /* And now load the last part of the buffer.
+ * Note that here we don't check for blank lines,
+ * this will be cared for later.
+ */
+ for(i=0; i<p2; i++)
+ {
+ memset(data, 0, gendata.numbytes);
+
+ if(i < gendata.numvlines)
+ {
+ gdev_prn_get_bits((gx_device_printer *)gendata.dev,
+ i, data+ofs, &in_data);
+ if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
+ }
+
+ data += gendata.numbytes;
+ }
+
+ gendata.firstline = 0;
+
+ /* Now check the return value. If by chance we are under
+ * the bottom margin, add the LAST bit to the return value.
+ * Of course, since this is the first buffer of the page,
+ * it's not likely we will reach the bottom margin in
+ * this pass. Anyway this is code that will be executed
+ * only once per page, so better safe than sorry.
+ */
+ ret = (gendata.numvlines < p2 ? LAST : 0) | qualify_buffer();
+
+ return(ret);
}
/* This function checks if the current buffer contains
* data to be printed with the left or right head.
* It assumes that we are printing in color mode, and it
* is useful to minimize the number of needed passes.
- * When we are printing in monochrome mode we directly skip
+ * When we are printing in monochrome mode we directly skip
* over blank lines, so this routine is not needed.
*/
static int
qualify_buffer(void)
{
- int i, j, k, ret;
- int rmsk, q, v1;
- int bpsz, cpsz;
- byte *data;
-
- ret = 0;
-
- /* Set variables which contains the size, in rows, of
- * each color pen and of the black pen in color mode,
- * adjusting for different resolution settings.
- * Also set the mask used to rollover the buffer.
- */
- cpsz = (COLORPEN * 2) / gendata.yrmul;
- bpsz = (BWCOLPEN * 2) / gendata.yrmul;
- rmsk = gendata.numblines - 1;
-
- /* Check the right head data, it is always a color cartridge */
- for(k=0; k<3 && ret==0; k++)
- {
- /* For each pen, scan all the bytes on each row of
- * the buffer that is covered by the current pen,
- * ORing together all the bits.
- */
- v1 = 0;
- q = gendata.firstline + valign[COLORVALIGN] + penofs[k];
- for(i=0; i<cpsz; i++)
- {
- data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
- for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
- }
- /* If the result of the OR has the proper color bit
- * set, it means that this buffer contains at least
- * one pixel of this pen, so we need a color pass.
- * Note that we exit as soon as we find a color bit
- * set, because if at least one color pen is used
- * in this buffer we need to do a color pass anyway,
- * so there's no need to check the other two pens.
- */
- if(v1 & colmask[RIGHT][k])ret |= RHDATA;
- }
-
- /* Check the left head data: it could be a black or
- * a photo cartridge, depending on the printing mode.
- */
- if(gendata.rendermode == LXM3200_C)
- {
- /* We are in standard color mode: the left cartridge
- * is a black cartridge used in 192 nozzles mode.
- * This is done exactly in the same way as above, but
- * without the outer loop because we have only one
- * color pen on this cartridge.
- */
- v1 = 0;
- q = gendata.firstline + valign[BLACKVALIGN];
- for(i=0; i<bpsz; i++)
- {
- data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
- for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
- }
- if(v1 & BLACK)ret |= LHDATA;
- }
- else
- {
- /* If we are here we need to check for a photo cartridge
- * (this routine is never called in monochrome mode, so
- * if we are not in color mode we must be in photo mode).
- * This routine is identical to the color routine above.
- */
- for(k=0; k<3 && !(ret & LHDATA); k++)
- {
- v1 = 0;
- q = gendata.firstline + valign[PHOTOVALIGN] + penofs[k];
- for(i=0; i<cpsz; i++)
- {
- data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
- for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
- }
- if(v1 & colmask[LEFT][k])ret |= LHDATA;
- }
- }
-
- return(ret);
+ int i, j, k, ret;
+ int rmsk, q, v1;
+ int bpsz, cpsz;
+ byte *data;
+
+ ret = 0;
+
+ /* Set variables which contains the size, in rows, of
+ * each color pen and of the black pen in color mode,
+ * adjusting for different resolution settings.
+ * Also set the mask used to rollover the buffer.
+ */
+ cpsz = (COLORPEN * 2) / gendata.yrmul;
+ bpsz = (BWCOLPEN * 2) / gendata.yrmul;
+ rmsk = gendata.numblines - 1;
+
+ /* Check the right head data, it is always a color cartridge */
+ for(k=0; k<3 && ret==0; k++)
+ {
+ /* For each pen, scan all the bytes on each row of
+ * the buffer that is covered by the current pen,
+ * ORing together all the bits.
+ */
+ v1 = 0;
+ q = gendata.firstline + valign[COLORVALIGN] + penofs[k];
+ for(i=0; i<cpsz; i++)
+ {
+ data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
+ for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
+ }
+ /* If the result of the OR has the proper color bit
+ * set, it means that this buffer contains at least
+ * one pixel of this pen, so we need a color pass.
+ * Note that we exit as soon as we find a color bit
+ * set, because if at least one color pen is used
+ * in this buffer we need to do a color pass anyway,
+ * so there's no need to check the other two pens.
+ */
+ if(v1 & colmask[RIGHT][k])ret |= RHDATA;
+ }
+
+ /* Check the left head data: it could be a black or
+ * a photo cartridge, depending on the printing mode.
+ */
+ if(gendata.rendermode == LXM3200_C)
+ {
+ /* We are in standard color mode: the left cartridge
+ * is a black cartridge used in 192 nozzles mode.
+ * This is done exactly in the same way as above, but
+ * without the outer loop because we have only one
+ * color pen on this cartridge.
+ */
+ v1 = 0;
+ q = gendata.firstline + valign[BLACKVALIGN];
+ for(i=0; i<bpsz; i++)
+ {
+ data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
+ for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
+ }
+ if(v1 & BLACK)ret |= LHDATA;
+ }
+ else
+ {
+ /* If we are here we need to check for a photo cartridge
+ * (this routine is never called in monochrome mode, so
+ * if we are not in color mode we must be in photo mode).
+ * This routine is identical to the color routine above.
+ */
+ for(k=0; k<3 && !(ret & LHDATA); k++)
+ {
+ v1 = 0;
+ q = gendata.firstline + valign[PHOTOVALIGN] + penofs[k];
+ for(i=0; i<cpsz; i++)
+ {
+ data = gendata.scanbuf + ((q+i) & rmsk)*gendata.numbytes;
+ for(j=0; j<gendata.numbytes; j++)v1 |= *data++;
+ }
+ if(v1 & colmask[LEFT][k])ret |= LHDATA;
+ }
+ }
+
+ return(ret);
}
/* This functions rolls the circular buffer by the
* number of lines of one color pen, reading new
* lines to refill the buffer.
- * In color mode we use a circular buffer because
+ * In color mode we use a circular buffer because
* we need to read the same lines more than once.
* So when we are forwarding to the next pass we
* simply read in the new lines and then update the
@@ -2500,72 +2497,72 @@ qualify_buffer(void)
static int
roll_buffer(void)
{
- int i, ret, fline, vl, ofs;
- int cpen, cmask, lline;
- byte *data, *in_data;
-
- /* Adjust the size of the color pen and the
- * mask to take into account the current resolution
- */
- cpen = (COLORPEN * 2) / gendata.yrmul;
- cmask = (gendata.numblines) - 1;
-
- /* Calculate the line number corresponding to
- * the last buffer we can print before being
- * forced to eject the page. At 600dpi this
- * has been experimentally determined to be
- * 112 lines from the bottom of the page.
- */
- lline = gendata.numvlines - (224 / gendata.yrmul);
-
- /* Roll the buffer by advancing the first line
- * pointer by the height of one color pen.
- */
- fline = gendata.firstline;
- gendata.firstline = (fline + cpen) & cmask;
-
- /* Now calculate the pointer to the first "fresh"
- * line on the page, i.e. the first line we must
- * read into the buffer at this pass.
- */
- vl = gendata.curvline + cmask + 1;
-
- /* Take into account the guard offset */
- ofs = gendata.goffset;
-
- /* Initialize the return value and update the
- * current vertical position on the page, while
- * checking if we have reached the last printable
- * buffer.
- */
- ret = 0;
- gendata.curvline += cpen;
- if(gendata.curvline >= lline)ret = LAST;
-
- /* Now read "fresh" rasterized scanlines into the
- * input buffer.
- */
- for(i=0; i<cpen; i++)
- {
- data = gendata.scanbuf + ((fline + i) & cmask) * gendata.numbytes;
-
- memset(data, 0, gendata.numbytes);
- if(vl < gendata.numvlines)
- {
- gdev_prn_get_bits((gx_device_printer *)gendata.dev,
- vl, data+ofs, &in_data);
- if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
- }
- vl++;
- }
-
- /* And test for the presence of actual data to print */
- ret |= qualify_buffer();
-
- return(ret);
+ int i, ret, fline, vl, ofs;
+ int cpen, cmask, lline;
+ byte *data, *in_data;
+
+ /* Adjust the size of the color pen and the
+ * mask to take into account the current resolution
+ */
+ cpen = (COLORPEN * 2) / gendata.yrmul;
+ cmask = (gendata.numblines) - 1;
+
+ /* Calculate the line number corresponding to
+ * the last buffer we can print before being
+ * forced to eject the page. At 600dpi this
+ * has been experimentally determined to be
+ * 112 lines from the bottom of the page.
+ */
+ lline = gendata.numvlines - (224 / gendata.yrmul);
+
+ /* Roll the buffer by advancing the first line
+ * pointer by the height of one color pen.
+ */
+ fline = gendata.firstline;
+ gendata.firstline = (fline + cpen) & cmask;
+
+ /* Now calculate the pointer to the first "fresh"
+ * line on the page, i.e. the first line we must
+ * read into the buffer at this pass.
+ */
+ vl = gendata.curvline + cmask + 1;
+
+ /* Take into account the guard offset */
+ ofs = gendata.goffset;
+
+ /* Initialize the return value and update the
+ * current vertical position on the page, while
+ * checking if we have reached the last printable
+ * buffer.
+ */
+ ret = 0;
+ gendata.curvline += cpen;
+ if(gendata.curvline >= lline)ret = LAST;
+
+ /* Now read "fresh" rasterized scanlines into the
+ * input buffer.
+ */
+ for(i=0; i<cpen; i++)
+ {
+ data = gendata.scanbuf + ((fline + i) & cmask) * gendata.numbytes;
+
+ memset(data, 0, gendata.numbytes);
+ if(vl < gendata.numvlines)
+ {
+ gdev_prn_get_bits((gx_device_printer *)gendata.dev,
+ vl, data+ofs, &in_data);
+ if(in_data != data+ofs)memcpy(data+ofs, in_data, gendata.numrbytes);
+ }
+ vl++;
+ }
+
+ /* And test for the presence of actual data to print */
+ ret |= qualify_buffer();
+
+ return(ret);
}
-/* Calculate the margins of one line, i.e. the leftmost
+/* Calculate the margins of one line, i.e. the leftmost
* and the rightmost non-blank pixel on the line.
*
* data: the pointer to the data for this line
@@ -2575,129 +2572,129 @@ roll_buffer(void)
* left: calculated left margin (output variable)
* right: calculated right margin (output variable)
*/
-static void
+static void
calclinemargins(byte *data, int mask, int *left, int *right)
{
- int l,r,num;
+ int l,r,num;
+
+ num = gendata.numbytes - 1;
- num = gendata.numbytes - 1;
+ l = 0;
+ while((l <= num) && ((data[l] & mask) == 0))l++;
- l = 0;
- while((l <= num) && ((data[l] & mask) == 0))l++;
-
- r = num;
- while((r >= 0) && ((data[r] & mask) == 0))r--;
+ r = num;
+ while((r >= 0) && ((data[r] & mask) == 0))r--;
- *left = l;
- *right = r;
+ *left = l;
+ *right = r;
}
/* Calculate the margins of the whole buffer. The
* calculation accounts separately for the data to
* be printed with the left or with the right head,
- * so we can try to minimize the head movement even
+ * so we can try to minimize the head movement even
* on multiple passes.
- *
+ *
* head: the code of the head we are calculating
* margins for (LEFT or RIGHT)
*/
static void
calcbufmargins(int head)
{
- int i, l1, r1, q, k;
- int mleft, mright, nl;
- int cpen, cmask, al;
- byte *scan;
-
- /* Adjust mask and pen height according to vertical resolution */
- cpen = (COLORPEN * 2) / gendata.yrmul;
- cmask = (gendata.numblines) - 1;
-
- /* Calculate margins for a color or photo cartridge */
- if(head == RIGHT || (gendata.rendermode == LXM3200_P))
- {
- /* Get correct vertical aligment */
- al = (head == LEFT ? PHOTOVALIGN : COLORVALIGN);
-
- q = gendata.firstline + valign[al];
-
- /* Calculate margins for first line, using those values
- * to initialize the max and min values.
- */
- scan = gendata.scanbuf + ((q+penofs[0]) & cmask)*gendata.numbytes;
- calclinemargins(scan, colmask[head][0], &mleft, &mright);
-
- /* And now scan all the remaining buffer. We scan according
- * to color pens, i.e. we calculate the margin on the rows
- * where magenta will be laid down taking into account magenta
- * pixels only, and this will be the magenta submargin. After
- * having done that for cyan and yellow as well, we take as the
- * global margin the smaller space that contains all the three
- * submargins.
- */
- for(k=0; k<3; k++)
- {
- for(i=0; i<cpen; i++)
- {
- scan = gendata.scanbuf + ((q+i+penofs[k]) & cmask)*gendata.numbytes;
- calclinemargins(scan, colmask[head][k], &l1, &r1);
- mleft = min(mleft, l1);
- mright = max(mright, r1);
- }
- }
-
- gendata.left = mleft;
- gendata.right = mright;
-
- return;
- }
-
- /* Calculate buffer margins for a black head. This is
- * almost exactly the same as before, but now we do
- * a single pass because we have only one black pen.
- */
- if(gendata.rendermode == LXM3200_M)
- {
- /* Monochromatic mode: we use 208 nozzles and
- * all the buffer, so the initial offset is zero.
- */
-
- scan = gendata.scanbuf;
- calclinemargins(scan, BLACK, &mleft, &mright);
-
- for(i=1; i<gendata.numblines; i++)
- {
- scan += gendata.numbytes;
- calclinemargins(scan, BLACK, &l1, &r1);
- mleft = min(mleft, l1);
- mright = max(mright, r1);
- }
-
- gendata.left = mleft;
- gendata.right = mright;
-
- return;
- }
-
- /* Standard color mode: we use 192 nozzles and must
- * take into account the vertical alignment.
- */
-
- nl = (gendata.numlines * 2) / gendata.yrmul;
- q = gendata.firstline + valign[BLACKVALIGN];
-
- scan = gendata.scanbuf + (q & cmask)*gendata.numbytes;
- calclinemargins(scan, BLACK, &mleft, &mright);
-
- for(i=1; i<nl; i++)
- {
- scan = gendata.scanbuf + ((q+i) & cmask)*gendata.numbytes;
- calclinemargins(scan, BLACK, &l1, &r1);
- mleft = min(mleft, l1);
- mright = max(mright, r1);
- }
- gendata.left = mleft;
- gendata.right = mright;
+ int i, l1, r1, q, k;
+ int mleft, mright, nl;
+ int cpen, cmask, al;
+ byte *scan;
+
+ /* Adjust mask and pen height according to vertical resolution */
+ cpen = (COLORPEN * 2) / gendata.yrmul;
+ cmask = (gendata.numblines) - 1;
+
+ /* Calculate margins for a color or photo cartridge */
+ if(head == RIGHT || (gendata.rendermode == LXM3200_P))
+ {
+ /* Get correct vertical aligment */
+ al = (head == LEFT ? PHOTOVALIGN : COLORVALIGN);
+
+ q = gendata.firstline + valign[al];
+
+ /* Calculate margins for first line, using those values
+ * to initialize the max and min values.
+ */
+ scan = gendata.scanbuf + ((q+penofs[0]) & cmask)*gendata.numbytes;
+ calclinemargins(scan, colmask[head][0], &mleft, &mright);
+
+ /* And now scan all the remaining buffer. We scan according
+ * to color pens, i.e. we calculate the margin on the rows
+ * where magenta will be laid down taking into account magenta
+ * pixels only, and this will be the magenta submargin. After
+ * having done that for cyan and yellow as well, we take as the
+ * global margin the smaller space that contains all the three
+ * submargins.
+ */
+ for(k=0; k<3; k++)
+ {
+ for(i=0; i<cpen; i++)
+ {
+ scan = gendata.scanbuf + ((q+i+penofs[k]) & cmask)*gendata.numbytes;
+ calclinemargins(scan, colmask[head][k], &l1, &r1);
+ mleft = min(mleft, l1);
+ mright = max(mright, r1);
+ }
+ }
+
+ gendata.left = mleft;
+ gendata.right = mright;
+
+ return;
+ }
+
+ /* Calculate buffer margins for a black head. This is
+ * almost exactly the same as before, but now we do
+ * a single pass because we have only one black pen.
+ */
+ if(gendata.rendermode == LXM3200_M)
+ {
+ /* Monochromatic mode: we use 208 nozzles and
+ * all the buffer, so the initial offset is zero.
+ */
+
+ scan = gendata.scanbuf;
+ calclinemargins(scan, BLACK, &mleft, &mright);
+
+ for(i=1; i<gendata.numblines; i++)
+ {
+ scan += gendata.numbytes;
+ calclinemargins(scan, BLACK, &l1, &r1);
+ mleft = min(mleft, l1);
+ mright = max(mright, r1);
+ }
+
+ gendata.left = mleft;
+ gendata.right = mright;
+
+ return;
+ }
+
+ /* Standard color mode: we use 192 nozzles and must
+ * take into account the vertical alignment.
+ */
+
+ nl = (gendata.numlines * 2) / gendata.yrmul;
+ q = gendata.firstline + valign[BLACKVALIGN];
+
+ scan = gendata.scanbuf + (q & cmask)*gendata.numbytes;
+ calclinemargins(scan, BLACK, &mleft, &mright);
+
+ for(i=1; i<nl; i++)
+ {
+ scan = gendata.scanbuf + ((q+i) & cmask)*gendata.numbytes;
+ calclinemargins(scan, BLACK, &l1, &r1);
+ mleft = min(mleft, l1);
+ mright = max(mright, r1);
+ }
+ gendata.left = mleft;
+ gendata.right = mright;
}
/*
@@ -2707,656 +2704,656 @@ calcbufmargins(int head)
static void
print_color_page(void)
{
- int res, lline, cmask;
- int i, j, nl, q, sk;
- byte *scan;
-
- /* Set the blackskip value depending on vertical resolution.
- * Since we have a black pen which is 3 times as high as
- * each color pen, we must print black only once every three
- * passes. So we take into account on which line we printed
- * the last black stripe and then we print another only if
- * the current line is at least "sk" lines after that.
- */
- sk = (BWCOLPEN * 2) / gendata.yrmul;
-
- /* Get the first buffer, and if it's empty continue
- * to skip forward without doing anything.
- */
- res = init_buffer();
- while(res == 0)res = roll_buffer();
-
- /* If this buffer happens to be the last one,
- * and empty as well, we had a blank page.
- * Just exit without ado.
- */
- if(res == LAST)return;
-
- /* This is the first non-blank line of the
- * page: issue a vertical skip command to
- * advance the paper to proper position.
- */
- skiplines(gendata.curvline, COLTOPSTART);
-
- /* "lline" holds the number of the first line of
- * the last buffer printed, either with left or
- * right head. This is needed to keep track of
- * how many lines we must skip from one stripe to
- * the next (if we encounter blank buffers we just
- * ignore them without moving the head, so we need
- * to do the proper vertical motion in one single
- * pass as soon as we encounter a non-blank buffer).
- */
- lline = gendata.curvline;
-
- /* Now depending on the data we have into the
- * buffer, print with the left head, right
- * head or both.
- * NOTE: this is the first buffer, and it needs
- * to be treated specially from the others.
- * The main difference is that we usually finalize
- * the buffer (issuing the print commands) at the
- * start of the next buffer, and not at the end of
- * the current one. This is because the Lexmark 3200
- * wants to know where to leave the printing head
- * at the end of each printing command, but we can't
- * know that until we start the next buffer so discovering
- * its margins and position. The solution is that we keep
- * "suspended" each buffer until we find another valid one.
- * The first buffer is special since there is no previous
- * buffer to finalize.
- * NOTE: I will comment the general case below, because
- * this code is simply a subset of the main loop.
- */
- switch(res)
- {
- case LHDATA:
- calcbufmargins(LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- gendata.lastblack = gendata.curvline + sk;
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- lline++;
- }
- break;
-
- case RHDATA:
- calcbufmargins(RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- gendata.lastblack = gendata.curvline + sk;
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
- }
-
- /* Skip to next buffer */
- res = roll_buffer();
-
- /* Start the main loop. Here we do all the stuff required
- * to print buffers properly.
- */
- while(!(res & LAST))
- {
- /* If we haven't forwarded until "lastblack", do not
- * print black data because it has been printed on
- * previous passes. So, if we are below gendata.lastblack
- * clear the LHDATA flag to ignore left-head data.
- */
- if(gendata.curvline < gendata.lastblack)res &= ~LHDATA;
-
- /* And now start examining the buffer for data */
- switch(res)
- {
- /* We have left head data */
- case LHDATA:
-
- /* Calculate the margins of this buffer */
- calcbufmargins(LEFT);
-
- /* And then finalize the previous buffer. We can't
- * do this until now, because only now we know the
- * margins and vertical position of the next buffer,
- * which are required data to calculate the final
- * head position at the end of the previous buffer.
- */
- finalizeheader(gendata.curvline - lline, LEFT);
-
- /* Set interleave to zero (only meaningful in 1200dpi
- * vertical mode.
- */
- gendata.ileave = 0;
-
- /* Encode this buffer making it the current buffer */
- encode_bw_buf();
-
- /* Since we are printing a black buffer, update
- * gendata.lastblack to point to the first line
- * not covered by this black pass.
- */
- gendata.lastblack = gendata.curvline + sk;
-
- /* And update "lline" as well */
- lline = gendata.curvline;
-
- /* If we are printing at 1200 dpi vertical, we must
- * do one more pass, interleaved with the one before.
- */
- if(gendata.yres == 1200)
- {
- /* Finalize previous buffer, moving down 1/1200th
- * of an inch to properly interleave the two passes.
- * This is naive: we should do something here, because
- * this way two adjacent lines are printed by the same
- * nozzle, and there is the danger of having a slight
- * banding on output (no more than 1/600th of an inch,
- * but maybe noticeable).
- */
- finalizeheader(1, LEFT);
-
- /* Set interleave to 1 to start an interleaved pass */
- gendata.ileave = 1;
-
- /* Encode the buffer, and not finalize it: we leave
- * the buffer suspended until we find another buffer
- * to print.
- */
- encode_bw_buf();
-
- /* And adjust "lline" because to print the interleaved
- * pass we have moved down one line, so we need to
- * skip one line less to print the next buffer.
- */
- lline++;
- }
- break;
-
- /* Right head data. This is absolutely identical to the
- * code above for left head data, with two exceptions: all
- * the "LEFT" codes are changed to "RIGHT" and we don't
- * update gendata.lastblack because we are printing a
- * color stripe and not a black one.
- */
- case RHDATA:
- calcbufmargins(RIGHT);
- finalizeheader(gendata.curvline - lline, RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- /* We have both left and right head data (i.e. black and
- * color on the same stripe).
- * The code here is identical to the code for the left data
- * only and right data only cases above. But they are
- * interleaved, because since we can't take back the paper
- * once it's advanced, in case we are printing at 1200 dpi
- * vertical (and so we need two interlaced passes) we need
- * to do both the first black and the first color pass,
- * advance the paper and then do the second black and the
- * second color pass. Simply appendig the two code pieces
- * above would not work.
- */
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- gendata.lastblack = gendata.curvline + sk;
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
- }
-
- /* Get another buffer */
- res = roll_buffer();
- }
-
- /* Last buffer. We treat this one specially as well,
- * because we don't have a subsequent buffer to print,
- * and so we need to finalize this buffers as soon as
- * possible.
- */
- res = qualify_buffer();
-
- /* Void the printed blacks. Since we are printing the
- * last buffer, it could happen that we have advanced
- * from the last time we printed a black stripe but
- * we are not yet at the point where another black
- * stripe would have been triggered. This would cause
- * an eventual black component in the last lines of
- * the page to be ignored.
- * To avoid the problem we do an unconditional black
- * pass, but we also must clear the black bits from the
- * lines we have already printed otherwise we would
- * print them twice.
- */
- if((res & LHDATA) && (gendata.curvline <= gendata.lastblack))
- {
- /* Find how many black lines we have yet printed
- * are still in the buffer
- */
- nl = gendata.lastblack - gendata.curvline;
-
- /* And now remove the BLACK bit from them */
-
- q = gendata.firstline + valign[BLACKVALIGN];
- cmask = (gendata.numblines) - 1;
- for(i=0; i<nl; i++)
- {
- scan = gendata.scanbuf + ((i+q) & cmask)*gendata.numbytes;
- for(j=0; j<gendata.numbytes; j++)
- {
- *scan &= ~BLACK;
- scan++;
- }
- }
- }
-
- /* Now we can print the last buffer as usual.
- * This is perfectly identical to the code
- * into the loop above: we are replicating it
- * only because we need the blanking code above
- * to be executed before this code.
- * Maybe there is a better way to do it...
- */
- switch(res)
- {
- case LHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- lline++;
- }
- break;
-
- case RHDATA:
- calcbufmargins(RIGHT);
- finalizeheader(gendata.curvline - lline, RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
- }
-
- /* Now finalize the header using a value of "0" for
- * the vertical skip (no need to move down: the
- * paper is about to be ejected) and -1 for the
- * head (meaning: last buffer, don't care for the
- * final head position, it will be reset unconditionally
- * by the trailing sequence).
- */
- finalizeheader(0, -1);
+ int res, lline, cmask;
+ int i, j, nl, q, sk;
+ byte *scan;
+
+ /* Set the blackskip value depending on vertical resolution.
+ * Since we have a black pen which is 3 times as high as
+ * each color pen, we must print black only once every three
+ * passes. So we take into account on which line we printed
+ * the last black stripe and then we print another only if
+ * the current line is at least "sk" lines after that.
+ */
+ sk = (BWCOLPEN * 2) / gendata.yrmul;
+
+ /* Get the first buffer, and if it's empty continue
+ * to skip forward without doing anything.
+ */
+ res = init_buffer();
+ while(res == 0)res = roll_buffer();
+
+ /* If this buffer happens to be the last one,
+ * and empty as well, we had a blank page.
+ * Just exit without ado.
+ */
+ if(res == LAST)return;
+
+ /* This is the first non-blank line of the
+ * page: issue a vertical skip command to
+ * advance the paper to proper position.
+ */
+ skiplines(gendata.curvline, COLTOPSTART);
+
+ /* "lline" holds the number of the first line of
+ * the last buffer printed, either with left or
+ * right head. This is needed to keep track of
+ * how many lines we must skip from one stripe to
+ * the next (if we encounter blank buffers we just
+ * ignore them without moving the head, so we need
+ * to do the proper vertical motion in one single
+ * pass as soon as we encounter a non-blank buffer).
+ */
+ lline = gendata.curvline;
+
+ /* Now depending on the data we have into the
+ * buffer, print with the left head, right
+ * head or both.
+ * NOTE: this is the first buffer, and it needs
+ * to be treated specially from the others.
+ * The main difference is that we usually finalize
+ * the buffer (issuing the print commands) at the
+ * start of the next buffer, and not at the end of
+ * the current one. This is because the Lexmark 3200
+ * wants to know where to leave the printing head
+ * at the end of each printing command, but we can't
+ * know that until we start the next buffer so discovering
+ * its margins and position. The solution is that we keep
+ * "suspended" each buffer until we find another valid one.
+ * The first buffer is special since there is no previous
+ * buffer to finalize.
+ * NOTE: I will comment the general case below, because
+ * this code is simply a subset of the main loop.
+ */
+ switch(res)
+ {
+ case LHDATA:
+ calcbufmargins(LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ gendata.lastblack = gendata.curvline + sk;
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ lline++;
+ }
+ break;
+
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ gendata.lastblack = gendata.curvline + sk;
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+ }
+
+ /* Skip to next buffer */
+ res = roll_buffer();
+
+ /* Start the main loop. Here we do all the stuff required
+ * to print buffers properly.
+ */
+ while(!(res & LAST))
+ {
+ /* If we haven't forwarded until "lastblack", do not
+ * print black data because it has been printed on
+ * previous passes. So, if we are below gendata.lastblack
+ * clear the LHDATA flag to ignore left-head data.
+ */
+ if(gendata.curvline < gendata.lastblack)res &= ~LHDATA;
+
+ /* And now start examining the buffer for data */
+ switch(res)
+ {
+ /* We have left head data */
+ case LHDATA:
+
+ /* Calculate the margins of this buffer */
+ calcbufmargins(LEFT);
+
+ /* And then finalize the previous buffer. We can't
+ * do this until now, because only now we know the
+ * margins and vertical position of the next buffer,
+ * which are required data to calculate the final
+ * head position at the end of the previous buffer.
+ */
+ finalizeheader(gendata.curvline - lline, LEFT);
+
+ /* Set interleave to zero (only meaningful in 1200dpi
+ * vertical mode.
+ */
+ gendata.ileave = 0;
+
+ /* Encode this buffer making it the current buffer */
+ encode_bw_buf();
+
+ /* Since we are printing a black buffer, update
+ * gendata.lastblack to point to the first line
+ * not covered by this black pass.
+ */
+ gendata.lastblack = gendata.curvline + sk;
+
+ /* And update "lline" as well */
+ lline = gendata.curvline;
+
+ /* If we are printing at 1200 dpi vertical, we must
+ * do one more pass, interleaved with the one before.
+ */
+ if(gendata.yres == 1200)
+ {
+ /* Finalize previous buffer, moving down 1/1200th
+ * of an inch to properly interleave the two passes.
+ * This is naive: we should do something here, because
+ * this way two adjacent lines are printed by the same
+ * nozzle, and there is the danger of having a slight
+ * banding on output (no more than 1/600th of an inch,
+ * but maybe noticeable).
+ */
+ finalizeheader(1, LEFT);
+
+ /* Set interleave to 1 to start an interleaved pass */
+ gendata.ileave = 1;
+
+ /* Encode the buffer, and not finalize it: we leave
+ * the buffer suspended until we find another buffer
+ * to print.
+ */
+ encode_bw_buf();
+
+ /* And adjust "lline" because to print the interleaved
+ * pass we have moved down one line, so we need to
+ * skip one line less to print the next buffer.
+ */
+ lline++;
+ }
+ break;
+
+ /* Right head data. This is absolutely identical to the
+ * code above for left head data, with two exceptions: all
+ * the "LEFT" codes are changed to "RIGHT" and we don't
+ * update gendata.lastblack because we are printing a
+ * color stripe and not a black one.
+ */
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ finalizeheader(gendata.curvline - lline, RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ /* We have both left and right head data (i.e. black and
+ * color on the same stripe).
+ * The code here is identical to the code for the left data
+ * only and right data only cases above. But they are
+ * interleaved, because since we can't take back the paper
+ * once it's advanced, in case we are printing at 1200 dpi
+ * vertical (and so we need two interlaced passes) we need
+ * to do both the first black and the first color pass,
+ * advance the paper and then do the second black and the
+ * second color pass. Simply appendig the two code pieces
+ * above would not work.
+ */
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ gendata.lastblack = gendata.curvline + sk;
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+ }
+
+ /* Get another buffer */
+ res = roll_buffer();
+ }
+
+ /* Last buffer. We treat this one specially as well,
+ * because we don't have a subsequent buffer to print,
+ * and so we need to finalize this buffers as soon as
+ * possible.
+ */
+ res = qualify_buffer();
+
+ /* Void the printed blacks. Since we are printing the
+ * last buffer, it could happen that we have advanced
+ * from the last time we printed a black stripe but
+ * we are not yet at the point where another black
+ * stripe would have been triggered. This would cause
+ * an eventual black component in the last lines of
+ * the page to be ignored.
+ * To avoid the problem we do an unconditional black
+ * pass, but we also must clear the black bits from the
+ * lines we have already printed otherwise we would
+ * print them twice.
+ */
+ if((res & LHDATA) && (gendata.curvline <= gendata.lastblack))
+ {
+ /* Find how many black lines we have yet printed
+ * are still in the buffer
+ */
+ nl = gendata.lastblack - gendata.curvline;
+
+ /* And now remove the BLACK bit from them */
+
+ q = gendata.firstline + valign[BLACKVALIGN];
+ cmask = (gendata.numblines) - 1;
+ for(i=0; i<nl; i++)
+ {
+ scan = gendata.scanbuf + ((i+q) & cmask)*gendata.numbytes;
+ for(j=0; j<gendata.numbytes; j++)
+ {
+ *scan &= ~BLACK;
+ scan++;
+ }
+ }
+ }
+
+ /* Now we can print the last buffer as usual.
+ * This is perfectly identical to the code
+ * into the loop above: we are replicating it
+ * only because we need the blanking code above
+ * to be executed before this code.
+ * Maybe there is a better way to do it...
+ */
+ switch(res)
+ {
+ case LHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ lline++;
+ }
+ break;
+
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ finalizeheader(gendata.curvline - lline, RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+ }
+
+ /* Now finalize the header using a value of "0" for
+ * the vertical skip (no need to move down: the
+ * paper is about to be ejected) and -1 for the
+ * head (meaning: last buffer, don't care for the
+ * final head position, it will be reset unconditionally
+ * by the trailing sequence).
+ */
+ finalizeheader(0, -1);
}
-/* This is the equivalent of print_color_page()
+/* This is the equivalent of print_color_page()
* for monochrome output. It is almost identical,
* only much simpler because now we are printing
* with only one head.
*/
static void
print_mono_page(void)
-{
- int res, lline;
-
- /* Load the first buffer, skipping over
- * blank lines (if any).
- */
- res = init_buffer();
-
- /* If we happen to have a buffer which is LAST
- * and empty, we have a blank page to print:
- * just say goodbye.
- */
- if(res == LAST)return;
-
- /* Skip enough lines to reach the start of
- * the first stripe to print.
- */
- skiplines(gendata.curvline, BWTOPSTART);
- lline = gendata.curvline;
-
- /* And now print the first buffer. This part of
- * the code is identical to the LHDATA part in
- * print_color_page()
- */
- calcbufmargins(LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- lline++;
- }
-
- /* And now load another buffer, starting to
- * look for it from the first line after the
- * pass we have just done.
- */
- res = fill_mono_buffer(gendata.curvline + gendata.numblines);
-
- /* Now loop. Even this code is identical
- * to the code above: the only difference
- * is that here we also finalize the previous
- * buffer before encoding this one. No need
- * to check if the buffer is empty because
- * a buffer is reported only if it's full
- * or if it is the last one, so if it's not
- * the last it must be full.
- */
- while(!(res & LAST))
- {
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_bw_buf();
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- lline++;
- }
-
- /* Get another buffer, and so on */
- res = fill_mono_buffer(gendata.curvline + gendata.numblines);
- }
-
- /* Last buffer. This can be either empty or full.
- * If it's not empty (LHDATA bit set), print it.
- */
- if(res & LHDATA)
- {
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- encode_bw_buf();
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_bw_buf();
- lline++;
- }
- }
-
- /* Finalize the last buffer */
- finalizeheader(0, -1);
+{
+ int res, lline;
+
+ /* Load the first buffer, skipping over
+ * blank lines (if any).
+ */
+ res = init_buffer();
+
+ /* If we happen to have a buffer which is LAST
+ * and empty, we have a blank page to print:
+ * just say goodbye.
+ */
+ if(res == LAST)return;
+
+ /* Skip enough lines to reach the start of
+ * the first stripe to print.
+ */
+ skiplines(gendata.curvline, BWTOPSTART);
+ lline = gendata.curvline;
+
+ /* And now print the first buffer. This part of
+ * the code is identical to the LHDATA part in
+ * print_color_page()
+ */
+ calcbufmargins(LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ lline++;
+ }
+
+ /* And now load another buffer, starting to
+ * look for it from the first line after the
+ * pass we have just done.
+ */
+ res = fill_mono_buffer(gendata.curvline + gendata.numblines);
+
+ /* Now loop. Even this code is identical
+ * to the code above: the only difference
+ * is that here we also finalize the previous
+ * buffer before encoding this one. No need
+ * to check if the buffer is empty because
+ * a buffer is reported only if it's full
+ * or if it is the last one, so if it's not
+ * the last it must be full.
+ */
+ while(!(res & LAST))
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_bw_buf();
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ lline++;
+ }
+
+ /* Get another buffer, and so on */
+ res = fill_mono_buffer(gendata.curvline + gendata.numblines);
+ }
+
+ /* Last buffer. This can be either empty or full.
+ * If it's not empty (LHDATA bit set), print it.
+ */
+ if(res & LHDATA)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ encode_bw_buf();
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_bw_buf();
+ lline++;
+ }
+ }
+
+ /* Finalize the last buffer */
+ finalizeheader(0, -1);
}
-/* This is the equivalent of print_color_page()
+/* This is the equivalent of print_color_page()
* for photoquality output. They are almost identical,
* the only real difference is that we now are
* printing with two identical heads, so there is
* no need to care for different heights of the
* printing pens (i.e.: no "lastblack" tricks).
- */
+ */
static void
print_photo_page(void)
{
- int res, lline;
-
- res = init_buffer();
- while(res == 0)res = roll_buffer();
-
- if(res == LAST)return;
-
- skiplines(gendata.curvline, COLTOPSTART);
- lline = gendata.curvline;
-
- switch(res)
- {
- case LHDATA:
- calcbufmargins(LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- lline++;
- }
- break;
-
- case RHDATA:
- calcbufmargins(RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
-
- break;
- }
-
- res = roll_buffer();
-
- while(!(res & LAST))
- {
- switch(res)
- {
- case LHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- lline++;
- }
- break;
-
- case RHDATA:
- calcbufmargins(RIGHT);
- finalizeheader(gendata.curvline - lline, RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline = gendata.curvline;
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
- }
-
- res = roll_buffer();
- }
-
- switch(res)
- {
- case LHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- if(gendata.yres == 1200)
- {
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- lline++;
- }
-
- case RHDATA:
- calcbufmargins(RIGHT);
- finalizeheader(gendata.curvline - lline, RIGHT);
- gendata.ileave = 0;
- encode_col_buf(RIGHT);
- if(gendata.yres == 1200)
- {
- finalizeheader(1, RIGHT);
- gendata.ileave = 1;
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
-
- case LHDATA|RHDATA:
- calcbufmargins(LEFT);
- finalizeheader(gendata.curvline - lline, LEFT);
- gendata.ileave = 0;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- if(gendata.yres == 1200)
- {
- calcbufmargins(LEFT);
- finalizeheader(1, LEFT);
- gendata.ileave = 1;
- encode_col_buf(LEFT);
- calcbufmargins(RIGHT);
- finalizeheader(0, RIGHT);
- encode_col_buf(RIGHT);
- lline++;
- }
- break;
- }
-
- finalizeheader(0, -1);
+ int res, lline;
+
+ res = init_buffer();
+ while(res == 0)res = roll_buffer();
+
+ if(res == LAST)return;
+
+ skiplines(gendata.curvline, COLTOPSTART);
+ lline = gendata.curvline;
+
+ switch(res)
+ {
+ case LHDATA:
+ calcbufmargins(LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ lline++;
+ }
+ break;
+
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+
+ break;
+ }
+
+ res = roll_buffer();
+
+ while(!(res & LAST))
+ {
+ switch(res)
+ {
+ case LHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ lline++;
+ }
+ break;
+
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ finalizeheader(gendata.curvline - lline, RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline = gendata.curvline;
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+ }
+
+ res = roll_buffer();
+ }
+
+ switch(res)
+ {
+ case LHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ lline++;
+ }
+
+ case RHDATA:
+ calcbufmargins(RIGHT);
+ finalizeheader(gendata.curvline - lline, RIGHT);
+ gendata.ileave = 0;
+ encode_col_buf(RIGHT);
+ if(gendata.yres == 1200)
+ {
+ finalizeheader(1, RIGHT);
+ gendata.ileave = 1;
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+
+ case LHDATA|RHDATA:
+ calcbufmargins(LEFT);
+ finalizeheader(gendata.curvline - lline, LEFT);
+ gendata.ileave = 0;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ if(gendata.yres == 1200)
+ {
+ calcbufmargins(LEFT);
+ finalizeheader(1, LEFT);
+ gendata.ileave = 1;
+ encode_col_buf(LEFT);
+ calcbufmargins(RIGHT);
+ finalizeheader(0, RIGHT);
+ encode_col_buf(RIGHT);
+ lline++;
+ }
+ break;
+ }
+
+ finalizeheader(0, -1);
}
diff --git a/gs/contrib/gdevlx50.c b/gs/contrib/gdevlx50.c
index 9d6b7da83..1c240247c 100644
--- a/gs/contrib/gdevlx50.c
+++ b/gs/contrib/gdevlx50.c
@@ -38,9 +38,9 @@
Based on the driver for the Lexmark 5700, pioneered by
Stephen Taylor setaylor@ma.ultranet.com staylor@cs.wpi.edu
- and on other pioneering work on the Lexmark 7000 by
+ and on other pioneering work on the Lexmark 7000 by
Henryk Paluch <paluch@bimbo.fjfi.cvut.cz>
-
+
My heartfelt thanks to these blokes (i.e. guys, fellows).
I should also like to thank Marija Svilans, through whom I discovered the
@@ -50,10 +50,10 @@
is Good, Beautiful and True; my Lord and my God, Jesus Christ.
"...all things were made through Him, and without Him was not anything
made that was made." John 1:3
-
+
Peter B. West pbwest@netscape.net
(First release: Friday, 8th October, 1999.)
-
+
*/
/*$Id: gdevlx50.c,v 1.4 2002/07/30 18:53:21 easysw Exp $*/
@@ -111,7 +111,7 @@
* DryingTime is used to include a delay after printing a page, to allow the
* page to dry to some extent before a subsequent page is printed and fed on
* top of it. The range of values is 0-60.
- *
+ *
* Ancilliary files:
*
* blckalgn.out As mentioned above,this is a file of printer commands
@@ -132,7 +132,7 @@
* Usage: cat parkcarts.out >/dev/lp0
*
================== K N O W N P R O B L E M S =======================
-
+
PROBLEMS WITH 1200dpi horizontally
This release was delayed by a bug in the production of black output
@@ -237,12 +237,12 @@
* R C S I D E N T S T R I N G S *
************************************************************************/
const char Id[] =
- "$Id: gdevlx50.c,v 1.4 2002/07/30 18:53:21 easysw Exp $";
+ "$Id: gdevlx50.c,v 1.4 2002/07/30 18:53:21 easysw Exp $";
const char RCSFile[] = "$RCSFile$";
const char Revision[] = "$Revision: 1.4 $";
const char Author[] =
- "Peter B. West pbwest@netscape.net\n"
- "$Author: easysw $\n";
+ "Peter B. West pbwest@netscape.net\n"
+ "$Author: easysw $\n";
/*===========================================================================
In gxdevice.h, the default width and height are expressed in 10ths of an
inch. The conversion to mm will therefore, not be exact.
@@ -398,7 +398,6 @@ const char Author[] =
is always constant, and with respect to the 208 pen, can be determined
from Alignment B.
-
*===========================================================================*/
/************************************************************************
@@ -408,25 +407,23 @@ const char Author[] =
#define A5_11_5000 1
#define A5_11_5700 2
-
#define ALIGN_A_DEF 15
#define ALIGN_A_OFFSET 5 /* in pageinit escape sequence */
#define ALIGN_B_DEF 8
#define ALIGN_B_OFFSET 6 /* in pageinit escape sequence */
#define HEADSEP_DEF 16
- /* number of pixels between even columns in */
- /* output and odd ones */
+ /* number of pixels between even columns in */
+ /* output and odd ones */
#define DRY_TIME_DEF 0 /* Default pause for page to dry */
-
/************************************************************************
* P R I N T E R T Y P E D E F I N I T I O N S *
************************************************************************/
#ifndef LX_BI
# define LX_UNI
- /* or define LX_BI */
+ /* or define LX_BI */
#endif
#define MIN_LX5000_X 300
#define MAX_LX5000_X 1200
@@ -442,8 +439,8 @@ const char Author[] =
# define LX5000_YDPI DEF_LX5000_Y
#endif
- /* Multiply lines by FEED_FACTOR when feeding
- paper. The 5000 feeds in 1200ths. */
+ /* Multiply lines by FEED_FACTOR when feeding
+ paper. The 5000 feeds in 1200ths. */
#define FEED_FACTOR ( 1200/LX5000_YDPI )
#define LX5000_XOFFSET_TO_0_0_XDPI (-48.0)
@@ -463,62 +460,62 @@ const char Author[] =
*/
#define LINE_PAD_BYTES 8
- /* number of bytes of padding on each end of */
- /* scan line to account for head separation */
- /* N.B. Keep this value 16-bit aligned. */
+ /* number of bytes of padding on each end of */
+ /* scan line to account for head separation */
+ /* N.B. Keep this value 16-bit aligned. */
#define RIGHTWARD 0
#define LEFTWARD 1
#define SWIPE_WORD_BITS 16
- /* Bits per directory word */
+ /* Bits per directory word */
#define BLACK_NOZZLES 208
- /* height of printhead in pixels */
+ /* height of printhead in pixels */
#define _1COLOUR_NOZZLES 64
- /* Height of one colour pen in pixels */
+ /* Height of one colour pen in pixels */
- /* Height of colour compatible black swipe */
+ /* Height of colour compatible black swipe */
#define BLK_COLOUR_NOZZLES (_1COLOUR_NOZZLES * 3)
- /* number of shorts described by each */
- /* full black column directory */
+ /* number of shorts described by each */
+ /* full black column directory */
#define BLK_SWIPE_WORDS ( BLACK_NOZZLES / SWIPE_WORD_BITS )
#define COLOUR_SWIPE_WORDS ( BLK_COLOUR_NOZZLES / SWIPE_WORD_BITS )
- /* and for a colour swipe command */
+ /* and for a colour swipe command */
#define _1COLOUR_WORDS ( _1COLOUR_NOZZLES / SWIPE_WORD_BITS )
- /* and for a single colour pen */
+ /* and for a single colour pen */
#define BLK_DIRECTORY_MASK (( ~0 << BLK_SWIPE_WORDS ) ^ ~0 )
#define COLOUR_DIRECTORY_MASK (( ~0 << COLOUR_SWIPE_WORDS ) ^ ~0 )
#define DIRECTORY_TYPE_BIT 0x2000
- /* Directory type: Set = normal;
- unset = repeat compression */
+ /* Directory type: Set = normal;
+ unset = repeat compression */
#define COLOUR_PEN_GAP 24 /* Defined in equivalent nozzles. This will */
- /* also be the offset from the top of the */
- /* first colour pen to the top of the colour */
- /* compatible black pen. */
+ /* also be the offset from the top of the */
+ /* first colour pen to the top of the colour */
+ /* compatible black pen. */
#define COLOUR_PEN_DIFF ( _1COLOUR_NOZZLES + COLOUR_PEN_GAP )
- /* The difference between corresponding */
- /* nozzle positions (e.g. bottom nozzle) on */
- /* contiguous colour pens. */
-
- /* The intial pen scanline positions are */
- /* defined with reference to the first */
- /* printable line (line 0) on the page. The */
- /* initial colour cartridge position is */
- /* immediately above line 0. */
+ /* The difference between corresponding */
+ /* nozzle positions (e.g. bottom nozzle) on */
+ /* contiguous colour pens. */
+
+ /* The intial pen scanline positions are */
+ /* defined with reference to the first */
+ /* printable line (line 0) on the page. The */
+ /* initial colour cartridge position is */
+ /* immediately above line 0. */
#define INITIAL_YELLOW_BOTTOM_LINE ( -1 )
- /* The pen buffer size must be a power of */
- /* 2, so that the index into the buffer */
- /* will either wrap within that size on */
- /* increment, or be able to be masked to */
- /* force a wrap of the index into the */
- /* circular pen buffers. See discussion */
- /* of pen buffers in lx5000_print_page(). */
+ /* The pen buffer size must be a power of */
+ /* 2, so that the index into the buffer */
+ /* will either wrap within that size on */
+ /* increment, or be able to be masked to */
+ /* force a wrap of the index into the */
+ /* circular pen buffers. See discussion */
+ /* of pen buffers in lx5000_print_page(). */
#define COLOUR_BUF_MASK 0xff
- /* 2^8 - 1 */
+ /* 2^8 - 1 */
#define COLOUR_BUF_LINES ( COLOUR_BUF_MASK + 1 )
/************************************************************************
@@ -526,53 +523,53 @@ const char Author[] =
************************************************************************/
#define SWIPE_LEADER 0x1b, '*', 4
- /* Lead-in bytes for swipe command */
+ /* Lead-in bytes for swipe command */
#define CMDLEN_X 3
- /* Index in swipe command of 4 byte */
+ /* Index in swipe command of 4 byte */
#define DIRECTION_X 7
- /* Index in swipe cmd of direction flag */
+ /* Index in swipe cmd of direction flag */
#define UNIDIRECTIONAL 0
#define BIDIRECTIONAL 1
#define HEADSPEED_X 8
- /* Index in swipe cmd of head speed */
- /* Head speeds for various densities */
+ /* Index in swipe cmd of head speed */
+ /* Head speeds for various densities */
#define _300X 1
#define _600X 2
#define _1200X 5
#define PEN_X 9
- /* Index of 2 byte pen selectors */
+ /* Index of 2 byte pen selectors */
#define BLACK0 1
#define BLACK1 1
#define COLOUR0 2
#define COLOUR1 0
#define NOZZLE_COUNT_X 11
- /* Index of nozzle count selector */
+ /* Index of nozzle count selector */
#define _192NOZZLES 0x18
#define _208NOZZLES 0x1a
#define UNKNOWN1_X 12
- /* Index of an unknown byte */
+ /* Index of an unknown byte */
#define UNKNOWN1VAL 0
#define NUM_COLUMNS_X 13
- /* Index in swipe command of 2 byte */
- /* column count */
+ /* Index in swipe command of 2 byte */
+ /* column count */
#define _1ST_COLUMN_X 15
- /* Index in swipe command of 2 byte */
- /* first column horizontal offset */
+ /* Index in swipe command of 2 byte */
+ /* first column horizontal offset */
#define LAST_COLUMN_X 17
- /* Index in swipe command of 2 byte */
- /* last column horizontal offset */
+ /* Index in swipe command of 2 byte */
+ /* last column horizontal offset */
#define SWIPE_HDR_END_X 19
#define SWIPE_HDR_END_LEN 7
#define SWIPE_HDR_END 0, 0, '+', 'p', 'b', 'w', 1
- /* Final byte sequence of swipe cmd header */
+ /* Final byte sequence of swipe cmd header */
#define SWIPE_HDR_LEN ( SWIPE_HDR_END_X + SWIPE_HDR_END_LEN )
@@ -591,7 +588,7 @@ const char Author[] =
#define LO_PEN 0
#define HI_PEN 1
- /* Colour defines for lx5000 black printer */
+ /* Colour defines for lx5000 black printer */
# define NUM_COMPONENTS_BLK 1
# define BITS_PER_PIXEL_BLK 1
@@ -600,7 +597,7 @@ const char Author[] =
# define DITHER_GREYS_BLK 2
# define DITHER_COLOURS_BLK 0
- /* Colour defines for lx5000 colour printer */
+ /* Colour defines for lx5000 colour printer */
# define NUM_COMPONENTS_CMY 4
# define BITS_PER_PIXEL_CMY 4
# define MAX_GREY_CMY 1
@@ -615,8 +612,8 @@ const char Author[] =
# define LAST_CMY_COLOUR CYAN_X
#define BPP BITS_PER_PIXEL_CMY
- /* N.B. This is only required for
- processCMYKline */
+ /* N.B. This is only required for
+ processCMYKline */
# define PIXEL_MASK (( 1 << BPP ) - 1 )
# define INITIAL_PIXEL_SHIFT ( ( sizeof( uchar ) * 8 ) - BPP )
@@ -631,12 +628,12 @@ const char Author[] =
#define DEF_LINE_INCREMENT 1
/* !!!!!!!!!!!!!!!!!!!!! WARNING, WARNING, WILL ROBINSON !!!!!!!!!!!!!!!!!!!!*/
- /* If BPP ever exceeds 8, this will break
- badly, as will the whole of processCMYKline.
- PIXELS_PER_BYTE is used when skipping over
- empty bytes in processCMYKline(). Each
- empty scanline byte skips over this many
- bits in the colourBufs. */
+ /* If BPP ever exceeds 8, this will break
+ badly, as will the whole of processCMYKline.
+ PIXELS_PER_BYTE is used when skipping over
+ empty bytes in processCMYKline(). Each
+ empty scanline byte skips over this many
+ bits in the colourBufs. */
#define PIXELS_PER_BYTE (8 / BPP)
#define COLOUR_MASK (( 1 << ( BITS_PER_COLOUR ) ) - 1 )
@@ -656,24 +653,23 @@ const char Author[] =
************************************************************************/
#define FILL_SWIPE_HEADER( swipeHdr, len, dir, speed, pen0, pen1, nozzles, \
- unknown, numcols, firstcol, lastcol ) \
- swipeHdr[ CMDLEN_X ] = ( ( len >> 24 ) & 0xff ); \
- swipeHdr[ CMDLEN_X + 1 ] = ( ( len >> 16 ) & 0xff ); \
- swipeHdr[ CMDLEN_X + 2 ] = ( ( len >> 8 ) & 0xff ); \
- swipeHdr[ CMDLEN_X + 3 ] = ( len & 0xff ); \
- swipeHdr[ DIRECTION_X ] = dir; \
- swipeHdr[ HEADSPEED_X ] = speed; \
- swipeHdr[ PEN_X ] = pen0; \
- swipeHdr[ PEN_X + 1 ] = pen1; \
- swipeHdr[ NOZZLE_COUNT_X ] = nozzles; \
- swipeHdr[ UNKNOWN1_X ] = unknown; \
- swipeHdr[ NUM_COLUMNS_X ] = ( numcols >> 8 ); \
- swipeHdr[ NUM_COLUMNS_X + 1 ] = ( numcols & 0xff ); \
- swipeHdr[ _1ST_COLUMN_X ] = ( firstcol >> 8 ); \
- swipeHdr[ _1ST_COLUMN_X + 1 ] = ( firstcol & 0xff ); \
- swipeHdr[ LAST_COLUMN_X ] = ( lastcol >> 8 ); \
- swipeHdr[ LAST_COLUMN_X + 1 ] = ( lastcol & 0xff )
-
+ unknown, numcols, firstcol, lastcol ) \
+ swipeHdr[ CMDLEN_X ] = ( ( len >> 24 ) & 0xff ); \
+ swipeHdr[ CMDLEN_X + 1 ] = ( ( len >> 16 ) & 0xff ); \
+ swipeHdr[ CMDLEN_X + 2 ] = ( ( len >> 8 ) & 0xff ); \
+ swipeHdr[ CMDLEN_X + 3 ] = ( len & 0xff ); \
+ swipeHdr[ DIRECTION_X ] = dir; \
+ swipeHdr[ HEADSPEED_X ] = speed; \
+ swipeHdr[ PEN_X ] = pen0; \
+ swipeHdr[ PEN_X + 1 ] = pen1; \
+ swipeHdr[ NOZZLE_COUNT_X ] = nozzles; \
+ swipeHdr[ UNKNOWN1_X ] = unknown; \
+ swipeHdr[ NUM_COLUMNS_X ] = ( numcols >> 8 ); \
+ swipeHdr[ NUM_COLUMNS_X + 1 ] = ( numcols & 0xff ); \
+ swipeHdr[ _1ST_COLUMN_X ] = ( firstcol >> 8 ); \
+ swipeHdr[ _1ST_COLUMN_X + 1 ] = ( firstcol & 0xff ); \
+ swipeHdr[ LAST_COLUMN_X ] = ( lastcol >> 8 ); \
+ swipeHdr[ LAST_COLUMN_X + 1 ] = ( lastcol & 0xff )
/************************************************************************
* Macros to manipulate bit pointers in bitBuf & scanPixels structs *
@@ -682,13 +678,13 @@ const char Author[] =
#define INC_BIT( bitPtr ) \
do { \
if ( ! ((bitPtr).xBit >>= 1 )) \
- { (bitPtr).xByte++ ; (bitPtr).xBit = 0x80; } \
+ { (bitPtr).xByte++ ; (bitPtr).xBit = 0x80; } \
} while (0)
#define DEC_BIT( bitPtr ) \
do { \
if ( ! ( (bitPtr).xBit = (( (bitPtr).xBit << 1 ) & 0xff ))) \
- { (bitPtr).xByte-- ; (bitPtr).xBit = 1; } \
+ { (bitPtr).xByte-- ; (bitPtr).xBit = 1; } \
} while (0)
/************************************************************************
@@ -697,32 +693,32 @@ do { \
#define lx5000_proctab(get_params, put_params, map_color_rgb, map_cmyk_color)\
{ gdev_prn_open,\
- gx_default_get_initial_matrix,\
- NULL, /* sync_output */\
- gdev_prn_output_page,\
- gdev_prn_close,\
- NULL, /* map_rgb_color */\
- map_color_rgb,\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- get_params,\
- put_params,\
- map_cmyk_color,\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device /* get_page_device */\
+ gx_default_get_initial_matrix,\
+ NULL, /* sync_output */\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ NULL, /* map_rgb_color */\
+ map_color_rgb,\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ get_params,\
+ put_params,\
+ map_cmyk_color,\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device /* get_page_device */\
}
/************************************************************************
* T Y P E D E F S E N U M S & E X T E R N A L S T O R A G E *
************************************************************************/
- /* The procedure descriptors */
- /* declare functions */
+ /* The procedure descriptors */
+ /* declare functions */
static dev_proc_print_page(lx5000_print_page);
static dev_proc_get_params(lx5000_get_params);
static dev_proc_put_params(lx5000_put_params);
@@ -730,17 +726,17 @@ static dev_proc_put_params(lx5000_put_params);
static dev_proc_map_cmyk_color(lx5000_map_cmyk_color);
static dev_proc_map_color_rgb(lx5000_map_color_rgb);
-static const gx_device_procs lx5000_procs =
+static const gx_device_procs lx5000_procs =
lx5000_proctab(
lx5000_get_params,
- lx5000_put_params,
- lx5000_map_color_rgb,
- lx5000_map_cmyk_color
- );
-
- /* The device descriptors */
- /* define a subclass containing useful state */
- /* a sub-class of gx_device_printer */
+ lx5000_put_params,
+ lx5000_map_color_rgb,
+ lx5000_map_cmyk_color
+ );
+
+ /* The device descriptors */
+ /* define a subclass containing useful state */
+ /* a sub-class of gx_device_printer */
typedef struct lx5000_device_s {
gx_device_common;
gx_prn_device_common;
@@ -752,22 +748,21 @@ typedef struct lx5000_device_s {
int lineIncrement; /* 1 for 600Y; 2 for 1200Y */
int scanLineBytes; /* Returned by GS */
int penLineBytes; /* When scanline colour elements are each
- reduced to a single bit, this is the result-
- ing line length in bytes. */
+ reduced to a single bit, this is the result-
+ ing line length in bytes. */
int penLineLen; /* penLineBytes + BOL + EOL padding */
int penBufSize; /* penLineLen * no. of lines */
int swipeBufSize; /* calculated size of a swipe command buffer */
bool isCMYK;
} lx5000_device;
- /* Define a structure for a pointer to an */
- /* individual bit in a scanline */
+ /* Define a structure for a pointer to an */
+ /* individual bit in a scanline */
typedef struct bufBit_s {
byte *xByte; /* Pointer to byte in buffer */
uchar xBit; /* Mask for invidual bit in byte */
} bufBit;
-
typedef struct penData_s {
int topLine; /* Top printable line of this pen */
int bottomLine; /* Bottom printable line of this pen */
@@ -779,40 +774,40 @@ typedef struct penData_s {
int finalLine;
} penData;
- /* Structure for extracting pixels from the
- initial scan line, which must be int
- aligned. */
+ /* Structure for extracting pixels from the
+ initial scan line, which must be int
+ aligned. */
typedef struct scanPixels_s {
uchar *scanByte; /* Pointer to a byte in the scan buffer */
int pixShift; /* Shift required to get next pixel to */
} scanPixels; /* the LSBits of the word. */
- /* Standard lx5000 device */
+ /* Standard lx5000 device */
lx5000_device far_data gs_lx5000_device = {
prn_device_margins_body
- ( lx5000_device,
- lx5000_procs,
- "lx5000",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- LX5000_XDPI, /* x dpi */
- LX5000_YDPI, /* y dpi */
- /* Offset inches from page left to 0,0 */
- LX5000_XOFFSET_TO_0_0,
- /* Offset inches from page top to 0,0 */
- LX5000_YOFFSET_TO_0_0,
- LX5000_LEFT_HWMARGIN_INS, /* margins */
- LX5000_BOTTOM_HWMARGIN_INS,
- LX5000_RIGHT_HWMARGIN_INS,
- LX5000_TOP_HWMARGIN_INS,
- NUM_COMPONENTS_CMY, /* colour info */
- BITS_PER_PIXEL_CMY, /* " */
- MAX_GREY_CMY, /* " */
- MAX_RGB_CMY, /* " */
- DITHER_GREYS_CMY, /* " */
- DITHER_COLOURS_CMY, /* " */
- lx5000_print_page
- ),
+ ( lx5000_device,
+ lx5000_procs,
+ "lx5000",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ LX5000_XDPI, /* x dpi */
+ LX5000_YDPI, /* y dpi */
+ /* Offset inches from page left to 0,0 */
+ LX5000_XOFFSET_TO_0_0,
+ /* Offset inches from page top to 0,0 */
+ LX5000_YOFFSET_TO_0_0,
+ LX5000_LEFT_HWMARGIN_INS, /* margins */
+ LX5000_BOTTOM_HWMARGIN_INS,
+ LX5000_RIGHT_HWMARGIN_INS,
+ LX5000_TOP_HWMARGIN_INS,
+ NUM_COMPONENTS_CMY, /* colour info */
+ BITS_PER_PIXEL_CMY, /* " */
+ MAX_GREY_CMY, /* " */
+ MAX_RGB_CMY, /* " */
+ DITHER_GREYS_CMY, /* " */
+ DITHER_COLOURS_CMY, /* " */
+ lx5000_print_page
+ ),
ALIGN_A_DEF, /* default(!) horizontal pen alignment */
ALIGN_B_DEF, /* default(!) vertical pen alignment */
HEADSEP_DEF, /* default headSeparation value */
@@ -829,19 +824,19 @@ lx5000_device far_data gs_lx5000_device = {
static const gx_device_color_info color_info_cmy =
dci_values(NUM_COMPONENTS_CMY,
- BITS_PER_PIXEL_CMY,
- MAX_GREY_CMY,
- MAX_RGB_CMY,
- DITHER_GREYS_CMY,
- DITHER_COLOURS_CMY);
+ BITS_PER_PIXEL_CMY,
+ MAX_GREY_CMY,
+ MAX_RGB_CMY,
+ DITHER_GREYS_CMY,
+ DITHER_COLOURS_CMY);
static const gx_device_color_info color_info_blk =
dci_values(NUM_COMPONENTS_BLK,
- BITS_PER_PIXEL_BLK,
- MAX_GREY_BLK,
- MAX_RGB_BLK,
- DITHER_GREYS_BLK,
- DITHER_COLOURS_BLK);
+ BITS_PER_PIXEL_BLK,
+ MAX_GREY_BLK,
+ MAX_RGB_BLK,
+ DITHER_GREYS_BLK,
+ DITHER_COLOURS_BLK);
/************************************************************************
************************************************************************
@@ -859,15 +854,15 @@ static const gx_device_color_info color_info_blk =
*----------------------------------------------------------------------*/
static void
initPenConstants( lx5000_device *lx5000dev,
- penData pens[NUM_COLOURS][PENS_PER_COLOUR] )
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR] )
{
- /* Indexed by pensPerColour. */
+ /* Indexed by pensPerColour. */
static const int nozzleCount[ NUM_COLOURS ][ PENS_PER_COLOUR + 1 ] =
{
- { -1, BLACK_NOZZLES, (BLACK_NOZZLES / 2) },
- { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) },
- { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) },
- { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) }
+ { -1, BLACK_NOZZLES, (BLACK_NOZZLES / 2) },
+ { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) },
+ { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) },
+ { -1, _1COLOUR_NOZZLES, (_1COLOUR_NOZZLES / 2) }
};
int colour, pen;
@@ -875,89 +870,89 @@ initPenConstants( lx5000_device *lx5000dev,
pens[YELLOW_X][LO_PEN].initialBottomLine = -1;
pens[MAGENTA_X][LO_PEN].initialBottomLine =
- pens[YELLOW_X][LO_PEN].initialBottomLine
- - COLOUR_PEN_DIFF;
+ pens[YELLOW_X][LO_PEN].initialBottomLine
+ - COLOUR_PEN_DIFF;
pens[CYAN_X][LO_PEN].initialBottomLine =
- pens[MAGENTA_X][LO_PEN].initialBottomLine
- - COLOUR_PEN_DIFF;
+ pens[MAGENTA_X][LO_PEN].initialBottomLine
+ - COLOUR_PEN_DIFF;
pens[BLACK_X][LO_PEN].initialBottomLine =
- pens[YELLOW_X][LO_PEN].initialBottomLine
- - COLOUR_PEN_GAP
- + ( SWIPE_WORD_BITS - lx5000dev->alignB );
+ pens[YELLOW_X][LO_PEN].initialBottomLine
+ - COLOUR_PEN_GAP
+ + ( SWIPE_WORD_BITS - lx5000dev->alignB );
for ( colour = 0; colour < NUM_COLOURS; colour++ )
{
- pens[colour][LO_PEN].bottomToBottomYellow
- = pens[YELLOW_X][LO_PEN].initialBottomLine
- - pens[colour][LO_PEN].initialBottomLine;
+ pens[colour][LO_PEN].bottomToBottomYellow
+ = pens[YELLOW_X][LO_PEN].initialBottomLine
+ - pens[colour][LO_PEN].initialBottomLine;
}
if ( pensPerColour == 1 )
{
- pens[BLACK_X][LO_PEN].topToBottomYellow =
- BLK_COLOUR_NOZZLES + COLOUR_PEN_GAP
- + lx5000dev->alignB - 1;
- pens[YELLOW_X][LO_PEN].topToBottomYellow = _1COLOUR_NOZZLES - 1;
- pens[MAGENTA_X][LO_PEN].topToBottomYellow =
- pens[YELLOW_X][LO_PEN].topToBottomYellow
- + COLOUR_PEN_DIFF;
- pens[CYAN_X][LO_PEN].topToBottomYellow =
- pens[MAGENTA_X][LO_PEN].topToBottomYellow
- + COLOUR_PEN_DIFF;
-
- for ( colour = 0; colour < NUM_COLOURS; colour++ )
- {
- pens[colour][HI_PEN].topToBottomYellow
- = pens[colour][LO_PEN].topToBottomYellow;
- pens[colour][HI_PEN].initialBottomLine
- = pens[colour][LO_PEN].initialBottomLine;
- pens[colour][HI_PEN].bottomToBottomYellow
- = pens[colour][LO_PEN].bottomToBottomYellow;
- }
+ pens[BLACK_X][LO_PEN].topToBottomYellow =
+ BLK_COLOUR_NOZZLES + COLOUR_PEN_GAP
+ + lx5000dev->alignB - 1;
+ pens[YELLOW_X][LO_PEN].topToBottomYellow = _1COLOUR_NOZZLES - 1;
+ pens[MAGENTA_X][LO_PEN].topToBottomYellow =
+ pens[YELLOW_X][LO_PEN].topToBottomYellow
+ + COLOUR_PEN_DIFF;
+ pens[CYAN_X][LO_PEN].topToBottomYellow =
+ pens[MAGENTA_X][LO_PEN].topToBottomYellow
+ + COLOUR_PEN_DIFF;
+
+ for ( colour = 0; colour < NUM_COLOURS; colour++ )
+ {
+ pens[colour][HI_PEN].topToBottomYellow
+ = pens[colour][LO_PEN].topToBottomYellow;
+ pens[colour][HI_PEN].initialBottomLine
+ = pens[colour][LO_PEN].initialBottomLine;
+ pens[colour][HI_PEN].bottomToBottomYellow
+ = pens[colour][LO_PEN].bottomToBottomYellow;
+ }
}
else /* pensPerColour > 1 */
{
- pens[BLACK_X][HI_PEN].topToBottomYellow =
- BLK_COLOUR_NOZZLES + COLOUR_PEN_GAP
- + lx5000dev->alignB - 1;
- pens[BLACK_X][LO_PEN].topToBottomYellow =
- pens[BLACK_X][HI_PEN].topToBottomYellow
- - nozzleCount[BLACK_X][pensPerColour];
- pens[YELLOW_X][HI_PEN].topToBottomYellow = _1COLOUR_NOZZLES - 1;
- pens[YELLOW_X][LO_PEN].topToBottomYellow =
- pens[YELLOW_X][HI_PEN].topToBottomYellow
- - nozzleCount[YELLOW_X][pensPerColour];
- pens[MAGENTA_X][HI_PEN].topToBottomYellow =
- pens[YELLOW_X][HI_PEN].topToBottomYellow
- + COLOUR_PEN_DIFF;
- pens[MAGENTA_X][LO_PEN].topToBottomYellow =
- pens[MAGENTA_X][HI_PEN].topToBottomYellow
- -nozzleCount[MAGENTA_X][pensPerColour];
- pens[CYAN_X][HI_PEN].topToBottomYellow =
- pens[MAGENTA_X][HI_PEN].topToBottomYellow
- + COLOUR_PEN_DIFF;
- pens[CYAN_X][LO_PEN].topToBottomYellow =
- pens[CYAN_X][HI_PEN].topToBottomYellow
- - nozzleCount[CYAN_X][pensPerColour];
-
- for ( colour = 0; colour < NUM_COLOURS; colour++ )
- {
- pens[colour][HI_PEN].bottomToBottomYellow =
- pens[colour][LO_PEN].bottomToBottomYellow
- + nozzleCount[colour][pensPerColour];
- pens[colour][HI_PEN].initialBottomLine =
- pens[colour][LO_PEN].initialBottomLine
- - nozzleCount[colour][pensPerColour];
- }
+ pens[BLACK_X][HI_PEN].topToBottomYellow =
+ BLK_COLOUR_NOZZLES + COLOUR_PEN_GAP
+ + lx5000dev->alignB - 1;
+ pens[BLACK_X][LO_PEN].topToBottomYellow =
+ pens[BLACK_X][HI_PEN].topToBottomYellow
+ - nozzleCount[BLACK_X][pensPerColour];
+ pens[YELLOW_X][HI_PEN].topToBottomYellow = _1COLOUR_NOZZLES - 1;
+ pens[YELLOW_X][LO_PEN].topToBottomYellow =
+ pens[YELLOW_X][HI_PEN].topToBottomYellow
+ - nozzleCount[YELLOW_X][pensPerColour];
+ pens[MAGENTA_X][HI_PEN].topToBottomYellow =
+ pens[YELLOW_X][HI_PEN].topToBottomYellow
+ + COLOUR_PEN_DIFF;
+ pens[MAGENTA_X][LO_PEN].topToBottomYellow =
+ pens[MAGENTA_X][HI_PEN].topToBottomYellow
+ -nozzleCount[MAGENTA_X][pensPerColour];
+ pens[CYAN_X][HI_PEN].topToBottomYellow =
+ pens[MAGENTA_X][HI_PEN].topToBottomYellow
+ + COLOUR_PEN_DIFF;
+ pens[CYAN_X][LO_PEN].topToBottomYellow =
+ pens[CYAN_X][HI_PEN].topToBottomYellow
+ - nozzleCount[CYAN_X][pensPerColour];
+
+ for ( colour = 0; colour < NUM_COLOURS; colour++ )
+ {
+ pens[colour][HI_PEN].bottomToBottomYellow =
+ pens[colour][LO_PEN].bottomToBottomYellow
+ + nozzleCount[colour][pensPerColour];
+ pens[colour][HI_PEN].initialBottomLine =
+ pens[colour][LO_PEN].initialBottomLine
+ - nozzleCount[colour][pensPerColour];
+ }
}
for ( colour = 0; colour < NUM_COLOURS; colour++ )
{
- for ( pen = 0; pen < PENS_PER_COLOUR; pen++ )
- {
- pens[colour][pen].finalLine =
- ( lx5000dev->height ) + pens[colour][pen].topToBottomYellow;
- }
+ for ( pen = 0; pen < PENS_PER_COLOUR; pen++ )
+ {
+ pens[colour][pen].finalLine =
+ ( lx5000dev->height ) + pens[colour][pen].topToBottomYellow;
+ }
}
}
@@ -974,7 +969,7 @@ pageInit( unsigned int alignA, unsigned int alignB, FILE *prn_stream )
page_init[ALIGN_A_OFFSET] = (uchar)alignA;
page_init[ALIGN_B_OFFSET] = (uchar)alignB;
-
+
fwrite( page_init, 1, sizeof( page_init ), prn_stream );
}
@@ -986,12 +981,12 @@ static void
pageEnd( FILE *prn_stream )
{
static const char page_end[] = {
- 0x1b,'*', 7, 0x65
+ 0x1b,'*', 7, 0x65
};
fwrite( page_end, 1, sizeof( page_end ), prn_stream );
- /* Do it twice - that's what the Windows */
- /* driver for the 5000 does */
+ /* Do it twice - that's what the Windows */
+ /* driver for the 5000 does */
fwrite( page_end, 1, sizeof( page_end ), prn_stream );
}
@@ -1001,11 +996,11 @@ pageEnd( FILE *prn_stream )
*----------------------------------------------------------------------*/
static void
feedPaper( lx5000_device *lx5000dev, int newLine, int *currentLine,
- penData pens[NUM_COLOURS][PENS_PER_COLOUR],
- FILE *prn_stream )
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR],
+ FILE *prn_stream )
{
static const char feed_paper[] = {
- 0x1b, '*', 3
+ 0x1b, '*', 3
};
ushort _1200ths;
@@ -1013,28 +1008,27 @@ feedPaper( lx5000_device *lx5000dev, int newLine, int *currentLine,
if ( newLine >= *currentLine )
{
- _1200ths = (ushort)(( newLine - *currentLine ) * FEED_FACTOR );
- fwrite( feed_paper, 1, sizeof( feed_paper ), prn_stream );
- putc( _1200ths >> 8 , prn_stream);
- putc( _1200ths & 0xff, prn_stream );
-
- *currentLine = newLine;
-
- for ( colour = 0;
- colour < lx5000dev->color_info.num_components;
- colour++ )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- pens[colour][pen].topLine =
- newLine - pens[colour][pen].topToBottomYellow;
- pens[colour][pen].bottomLine =
- newLine - pens[colour][pen].bottomToBottomYellow;
- }
+ _1200ths = (ushort)(( newLine - *currentLine ) * FEED_FACTOR );
+ fwrite( feed_paper, 1, sizeof( feed_paper ), prn_stream );
+ putc( _1200ths >> 8 , prn_stream);
+ putc( _1200ths & 0xff, prn_stream );
+
+ *currentLine = newLine;
+
+ for ( colour = 0;
+ colour < lx5000dev->color_info.num_components;
+ colour++ )
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ pens[colour][pen].topLine =
+ newLine - pens[colour][pen].topToBottomYellow;
+ pens[colour][pen].bottomLine =
+ newLine - pens[colour][pen].bottomToBottomYellow;
+ }
}
}
-
/*----------------------------------------------------------------------*
* g e t C o l o u r B u f s ( ) *
*----------------------------------------------------------------------*
@@ -1062,11 +1056,11 @@ feedPaper( lx5000_device *lx5000dev, int newLine, int *currentLine,
*----------------------------------------------------------------------*/
static int
getColourBufs( lx5000_device *lx5000dev,
- byte **lineBufferPtr, byte *colourBufPtrs[],
- byte **swipeBufPtr, bool allocate )
+ byte **lineBufferPtr, byte *colourBufPtrs[],
+ byte **swipeBufPtr, bool allocate )
{
static byte *colourBufs[ NUM_COLOURS ];
- /* Only an array of pointers; OK if too big */
+ /* Only an array of pointers; OK if too big */
static byte *lineBuffer = NULL;
static byte *swipeBuf = NULL;
@@ -1076,124 +1070,123 @@ getColourBufs( lx5000_device *lx5000dev,
if ( allocate )
{
- if ( lineBuffer == NULL )
- {
- /* Initialise the pen buffers */
- for ( colour = 0; colour < numColours; colour++ )
- colourBufs[ colour ] = NULL;
-
- /*---------------------------------------------------------------*
- Derive the size of a colour buffer line: If the number of
- components is one and the number of bits per pixel is one, then
- there is only one bit per pixel in the scan line, so the colour
- buffer line is the same size.
-
- Otherwise, reduce each gx_color_index element in the scan line to
- one bit in the penprint buffer.
- *--------------------------------------------------------------*/
-
- if (lx5000dev->color_info.num_components > GX_DEVICE_COLOR_MAX_COMPONENTS)
- return_error(gs_error_limitcheck);
-
- lx5000dev->scanLineBytes = gdev_mem_bytes_per_scan_line(
- (gx_device *)lx5000dev );
- lx5000dev->penLineBytes =
- ( lx5000dev->color_info.num_components == 1
- && lx5000dev->color_info.depth == 1 )
- ? lx5000dev->scanLineBytes
- : ( lx5000dev->scanLineBytes / lx5000dev->color_info.num_components);
-
- lx5000dev->penLineLen =
- lx5000dev->penLineBytes + ( LINE_PAD_BYTES * 2);
-
- lx5000dev->penBufSize
- = lx5000dev->penLineLen * COLOUR_BUF_LINES;
-
- /* swipeBuf size:
- * No. of columns = No. of bits in the linebuf
- * Bits per column = maximum swipe height
- * Bytes per column = Bits per column / 8 + 2 byte directory
- * Total bytes = Bytes/column * no. of columns + header bytes
- */
- lx5000dev->swipeBufSize =
- ((lx5000dev->penLineLen * 8)
- * ((BLACK_NOZZLES / 8) + 2) + SWIPE_HDR_LEN);
-
- /* Allocate a buffer for a single scan line */
- lineBuffer = (byte *)gs_alloc_byte_array
- ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->scanLineBytes, 1,
- "lx5000_print_page(lineBuffer)" );
-
- swipeBuf = (byte *)gs_alloc_byte_array
- ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->swipeBufSize, 1,
- "lx5000_print_page(swipeBuf)" );
-
- for ( colour = 0 ; colour < numColours; colour++ )
- {
- if ( ( colourBufs[colour] =
- (byte *)gs_alloc_byte_array
- ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->penBufSize, 1,
- "lx5000_print_page(colourBufs)"
- )
- ) == NULL )
- {
- colourBufNull = 1;
- colour = numColours;
- }
- }
- /* Check allocations */
- if ( lineBuffer == NULL || colourBufNull || swipeBuf == NULL ) {
- getColourBufs( lx5000dev, lineBufferPtr, colourBufPtrs,
- swipeBufPtr, DEALLOCATE );
- return_error( gs_error_VMerror );
- }
- }
- /* Clear the black buffer, iff ! isCMYK. If CMYK, scan lines are
- processed by processCMYKlines(), and buffer lines are cleared
- individually, before a new scan line is processed. As part of this
- clearing, the line EOL and BOL pads are also cleared.
- If ! CMYK, the black-only scan line is read or copied directly
- into the black buffer, without clearing the buffer. Therefore, the
- line pad regions must either be cleared individually for each line
- processed, or cleared once when the buffer is allocated.
- */
- if ( ! lx5000dev->isCMYK )
- memset( colourBufs[BLACK_X], 0, lx5000dev->penBufSize );
-
- /* Return the values */
- *lineBufferPtr = lineBuffer;
- *swipeBufPtr = swipeBuf;
- for ( colour = 0; colour < numColours; colour++ )
- colourBufPtrs[colour] = colourBufs[colour];
-
- return 0;
+ if ( lineBuffer == NULL )
+ {
+ /* Initialise the pen buffers */
+ for ( colour = 0; colour < numColours; colour++ )
+ colourBufs[ colour ] = NULL;
+
+ /*---------------------------------------------------------------*
+ Derive the size of a colour buffer line: If the number of
+ components is one and the number of bits per pixel is one, then
+ there is only one bit per pixel in the scan line, so the colour
+ buffer line is the same size.
+
+ Otherwise, reduce each gx_color_index element in the scan line to
+ one bit in the penprint buffer.
+ *--------------------------------------------------------------*/
+
+ if (lx5000dev->color_info.num_components > GX_DEVICE_COLOR_MAX_COMPONENTS)
+ return_error(gs_error_limitcheck);
+
+ lx5000dev->scanLineBytes = gdev_mem_bytes_per_scan_line(
+ (gx_device *)lx5000dev );
+ lx5000dev->penLineBytes =
+ ( lx5000dev->color_info.num_components == 1
+ && lx5000dev->color_info.depth == 1 )
+ ? lx5000dev->scanLineBytes
+ : ( lx5000dev->scanLineBytes / lx5000dev->color_info.num_components);
+
+ lx5000dev->penLineLen =
+ lx5000dev->penLineBytes + ( LINE_PAD_BYTES * 2);
+
+ lx5000dev->penBufSize
+ = lx5000dev->penLineLen * COLOUR_BUF_LINES;
+
+ /* swipeBuf size:
+ * No. of columns = No. of bits in the linebuf
+ * Bits per column = maximum swipe height
+ * Bytes per column = Bits per column / 8 + 2 byte directory
+ * Total bytes = Bytes/column * no. of columns + header bytes
+ */
+ lx5000dev->swipeBufSize =
+ ((lx5000dev->penLineLen * 8)
+ * ((BLACK_NOZZLES / 8) + 2) + SWIPE_HDR_LEN);
+
+ /* Allocate a buffer for a single scan line */
+ lineBuffer = (byte *)gs_alloc_byte_array
+ ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->scanLineBytes, 1,
+ "lx5000_print_page(lineBuffer)" );
+
+ swipeBuf = (byte *)gs_alloc_byte_array
+ ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->swipeBufSize, 1,
+ "lx5000_print_page(swipeBuf)" );
+
+ for ( colour = 0 ; colour < numColours; colour++ )
+ {
+ if ( ( colourBufs[colour] =
+ (byte *)gs_alloc_byte_array
+ ( gs_lib_ctx_get_non_gc_memory_t(), lx5000dev->penBufSize, 1,
+ "lx5000_print_page(colourBufs)"
+ )
+ ) == NULL )
+ {
+ colourBufNull = 1;
+ colour = numColours;
+ }
+ }
+ /* Check allocations */
+ if ( lineBuffer == NULL || colourBufNull || swipeBuf == NULL ) {
+ getColourBufs( lx5000dev, lineBufferPtr, colourBufPtrs,
+ swipeBufPtr, DEALLOCATE );
+ return_error( gs_error_VMerror );
+ }
+ }
+ /* Clear the black buffer, iff ! isCMYK. If CMYK, scan lines are
+ processed by processCMYKlines(), and buffer lines are cleared
+ individually, before a new scan line is processed. As part of this
+ clearing, the line EOL and BOL pads are also cleared.
+ If ! CMYK, the black-only scan line is read or copied directly
+ into the black buffer, without clearing the buffer. Therefore, the
+ line pad regions must either be cleared individually for each line
+ processed, or cleared once when the buffer is allocated.
+ */
+ if ( ! lx5000dev->isCMYK )
+ memset( colourBufs[BLACK_X], 0, lx5000dev->penBufSize );
+
+ /* Return the values */
+ *lineBufferPtr = lineBuffer;
+ *swipeBufPtr = swipeBuf;
+ for ( colour = 0; colour < numColours; colour++ )
+ colourBufPtrs[colour] = colourBufs[colour];
+
+ return 0;
}
else /* Deallocate the buffers */
{
- for ( colour = 0; colour < numColours; colour++ )
- {
- if ( colourBufs[colour] != NULL )
- gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
- (char *)colourBufs[colour],
- "lx5000_print_page(colourBufs)" );
- colourBufs[ colour ] = NULL;
- colourBufPtrs[ colour ] = NULL;
- }
- if ( swipeBuf != NULL )
- gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
- (char *)swipeBuf, "lx5000_print_page(swipeBuf)" );
- swipeBuf = NULL;
- *swipeBufPtr = NULL;
- if ( lineBuffer != NULL )
- gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
- (char *)lineBuffer, "lx5000_print_page(lineBuffer)" );
- lineBuffer = NULL;
- *lineBufferPtr = NULL;
- return 0;
+ for ( colour = 0; colour < numColours; colour++ )
+ {
+ if ( colourBufs[colour] != NULL )
+ gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
+ (char *)colourBufs[colour],
+ "lx5000_print_page(colourBufs)" );
+ colourBufs[ colour ] = NULL;
+ colourBufPtrs[ colour ] = NULL;
+ }
+ if ( swipeBuf != NULL )
+ gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
+ (char *)swipeBuf, "lx5000_print_page(swipeBuf)" );
+ swipeBuf = NULL;
+ *swipeBufPtr = NULL;
+ if ( lineBuffer != NULL )
+ gs_free_object( gs_lib_ctx_get_non_gc_memory_t(),
+ (char *)lineBuffer, "lx5000_print_page(lineBuffer)" );
+ lineBuffer = NULL;
+ *lineBufferPtr = NULL;
+ return 0;
}
}
-
/*----------------------------------------------------------------------*
* p r o c e s s C M Y K l i n e ( ) *
*----------------------------------------------------------------------*
@@ -1203,17 +1196,17 @@ getColourBufs( lx5000_device *lx5000dev,
N.B. The empty indicator for each line for each pen buffer must also be
set by this procedure.
-
+
Things like dithering may well end up in here.
*----------------------------------------------------------------------*/
static void
processCMYKline( lx5000_device *lx5000dev, int linenum,
- byte *lineBuffer, byte *scanLine,
- byte *colourBufs[NUM_COLOURS],
- bufBit
- colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
- penData pens[NUM_COLOURS][PENS_PER_COLOUR],
- bool lineEmpty[NUM_COLOURS][ COLOUR_BUF_LINES ] )
+ byte *lineBuffer, byte *scanLine,
+ byte *colourBufs[NUM_COLOURS],
+ bufBit
+ colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR],
+ bool lineEmpty[NUM_COLOURS][ COLOUR_BUF_LINES ] )
{
int colour;
int numColours = lx5000dev->color_info.num_components;
@@ -1223,7 +1216,7 @@ processCMYKline( lx5000_device *lx5000dev, int linenum,
uchar scanPixel;
scanPixels nextPixel;
bufBit nextBit[ 8 ];
- /* The end of the (scan)line. */
+ /* The end of the (scan)line. */
uchar *scanEnd = scanLine + lx5000dev->scanLineBytes;
nextPixel.scanByte = scanLine; /* Set up the moving pixel pointer. */
@@ -1232,102 +1225,101 @@ processCMYKline( lx5000_device *lx5000dev, int linenum,
for ( colour = 0; colour < numColours; colour++ )
{
- /* Set up the moving output bit pointer for
- each of the colours. */
- nextBit[ colour ].xByte = colourBufs[ colour ] + LINE_PAD_BYTES
- + ( lineIndex * lx5000dev->penLineLen );
- nextBit[ colour ].xBit = BIT_TO_MASK( 0 );
- /* Clear the colourBuf line if necessary */
- if ( ! lineEmpty[ colour ][ lineIndex ] )
- {
- memset( nextBit[ colour ].xByte - LINE_PAD_BYTES,
- 0, lx5000dev->penLineLen );
- lineEmpty[ colour ][ lineIndex ] = true;
- }
+ /* Set up the moving output bit pointer for
+ each of the colours. */
+ nextBit[ colour ].xByte = colourBufs[ colour ] + LINE_PAD_BYTES
+ + ( lineIndex * lx5000dev->penLineLen );
+ nextBit[ colour ].xBit = BIT_TO_MASK( 0 );
+ /* Clear the colourBuf line if necessary */
+ if ( ! lineEmpty[ colour ][ lineIndex ] )
+ {
+ memset( nextBit[ colour ].xByte - LINE_PAD_BYTES,
+ 0, lx5000dev->penLineLen );
+ lineEmpty[ colour ][ lineIndex ] = true;
+ }
}
- /* Is the line empty? */
+ /* Is the line empty? */
if (( ! *scanLine ) &&
- ! memcmp( scanLine, scanLine + 1, lx5000dev->scanLineBytes - 1 ))
- return; /* N.B. empty flag is pre-set to true */
+ ! memcmp( scanLine, scanLine + 1, lx5000dev->scanLineBytes - 1 ))
+ return; /* N.B. empty flag is pre-set to true */
while ( nextPixel.scanByte < scanEnd )
{
- int colour;
- int cmy; /* Used to detect if C+M+Y set */
- int skipPixels, skipBytes, skipBits;
- /* Number of consecutive empty pixels, equiv-
- alent bytes and remainder bits just skipped
- over in the CMYK line being processed. */
-
- /* Get next pixel and increment the pointer */
- scanPixel =
- ( ( *(nextPixel.scanByte) >> nextPixel.pixShift ) & PIXEL_MASK );
-
- /* pixShift is the number of bits to right-shift the scanByte
- before applying PIXEL_MASK. When we attempt to decrement
- it past 0, it's time to look at the next scanByte.
- N.B. We assume that the subtraction of BPP will end with
- zero, i.e., that there are an integral number of BPPs in
- INITIAL_PIXEL_SHIFT. We test for <= 0 just
- in case this condition gets violated.
- */
- skipPixels = 0;
- if ( nextPixel.pixShift <= 0 )
- {
- nextPixel.scanByte++;
- nextPixel.pixShift = INITIAL_PIXEL_SHIFT;
- /* If the next byte is empty, skip it */
- while (( ! *nextPixel.scanByte ) && nextPixel.scanByte < scanEnd )
- {
- nextPixel.scanByte++;
- skipPixels += PIXELS_PER_BYTE;
- }
- }
- else
- nextPixel.pixShift -= BPP;
- /* Get the black bit(s) */
- colourBits[ BLACK_X ] = scanPixel & COLOUR_MASK;
- scanPixel >>= BITS_PER_COLOUR;
- /* Set to catch all ANDed bits from colours */
- cmy = ~0;
- for ( colour = YELLOW_X; colour <= CYAN_X; colour++ )
- {
- colourBits[ colour ] = scanPixel & COLOUR_MASK;
- cmy &= scanPixel & COLOUR_MASK;
- scanPixel >>= BITS_PER_COLOUR;
- }
- if ( ( cmy ^ COLOUR_MASK ) == 0 ) /* C, M & Y all set == COLOUR_MASK */
- {
- colourBits[ YELLOW_X ] =
- colourBits[ MAGENTA_X ] = colourBits[ CYAN_X ] = 0;
- colourBits[ BLACK_X ] = COLOUR_MASK;
- }
- /* Now set the colourBuf bits */
- skipBytes = skipPixels >> 3;
- skipBits = skipPixels & 7;
- for ( colour = 0; colour < numColours; colour++ )
- {
- if ( colourBits[ colour ] )
- {
- *( nextBit[ colour ].xByte ) |= nextBit[ colour ].xBit;
- lineEmpty[ colour ][ lineIndex ] = false;
- }
- INC_BIT( nextBit[ colour ] );
- if ( skipPixels )
- {
- int bitSkip = skipBits;
-
- nextBit[ colour ].xByte += skipBytes;
- while ( bitSkip-- )
- {
- INC_BIT( nextBit[ colour ] );
- }
- }
- }
+ int colour;
+ int cmy; /* Used to detect if C+M+Y set */
+ int skipPixels, skipBytes, skipBits;
+ /* Number of consecutive empty pixels, equiv-
+ alent bytes and remainder bits just skipped
+ over in the CMYK line being processed. */
+
+ /* Get next pixel and increment the pointer */
+ scanPixel =
+ ( ( *(nextPixel.scanByte) >> nextPixel.pixShift ) & PIXEL_MASK );
+
+ /* pixShift is the number of bits to right-shift the scanByte
+ before applying PIXEL_MASK. When we attempt to decrement
+ it past 0, it's time to look at the next scanByte.
+ N.B. We assume that the subtraction of BPP will end with
+ zero, i.e., that there are an integral number of BPPs in
+ INITIAL_PIXEL_SHIFT. We test for <= 0 just
+ in case this condition gets violated.
+ */
+ skipPixels = 0;
+ if ( nextPixel.pixShift <= 0 )
+ {
+ nextPixel.scanByte++;
+ nextPixel.pixShift = INITIAL_PIXEL_SHIFT;
+ /* If the next byte is empty, skip it */
+ while (( ! *nextPixel.scanByte ) && nextPixel.scanByte < scanEnd )
+ {
+ nextPixel.scanByte++;
+ skipPixels += PIXELS_PER_BYTE;
+ }
+ }
+ else
+ nextPixel.pixShift -= BPP;
+ /* Get the black bit(s) */
+ colourBits[ BLACK_X ] = scanPixel & COLOUR_MASK;
+ scanPixel >>= BITS_PER_COLOUR;
+ /* Set to catch all ANDed bits from colours */
+ cmy = ~0;
+ for ( colour = YELLOW_X; colour <= CYAN_X; colour++ )
+ {
+ colourBits[ colour ] = scanPixel & COLOUR_MASK;
+ cmy &= scanPixel & COLOUR_MASK;
+ scanPixel >>= BITS_PER_COLOUR;
+ }
+ if ( ( cmy ^ COLOUR_MASK ) == 0 ) /* C, M & Y all set == COLOUR_MASK */
+ {
+ colourBits[ YELLOW_X ] =
+ colourBits[ MAGENTA_X ] = colourBits[ CYAN_X ] = 0;
+ colourBits[ BLACK_X ] = COLOUR_MASK;
+ }
+ /* Now set the colourBuf bits */
+ skipBytes = skipPixels >> 3;
+ skipBits = skipPixels & 7;
+ for ( colour = 0; colour < numColours; colour++ )
+ {
+ if ( colourBits[ colour ] )
+ {
+ *( nextBit[ colour ].xByte ) |= nextBit[ colour ].xBit;
+ lineEmpty[ colour ][ lineIndex ] = false;
+ }
+ INC_BIT( nextBit[ colour ] );
+ if ( skipPixels )
+ {
+ int bitSkip = skipBits;
+
+ nextBit[ colour ].xByte += skipBytes;
+ while ( bitSkip-- )
+ {
+ INC_BIT( nextBit[ colour ] );
+ }
+ }
+ }
}
}
-
/*----------------------------------------------------------------------*
* r e f r e s h B u f f e r ( ) *
*----------------------------------------------------------------------*
@@ -1353,12 +1345,12 @@ processCMYKline( lx5000_device *lx5000dev, int linenum,
*----------------------------------------------------------------------*/
static void
refreshBuffer( lx5000_device *lx5000dev,
- int *nextLineToGet, int *nextLineToPrint,
- byte *lineBuffer, byte *colourBufs[],
- bufBit
- colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
- penData pens[NUM_COLOURS][PENS_PER_COLOUR],
- bool lineEmpty[NUM_COLOURS][COLOUR_BUF_LINES] )
+ int *nextLineToGet, int *nextLineToPrint,
+ byte *lineBuffer, byte *colourBufs[],
+ bufBit
+ colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR],
+ bool lineEmpty[NUM_COLOURS][COLOUR_BUF_LINES] )
{
byte *lineBuf;
uchar nextToGet; /* Circular buffer pointer, 0 to ff */
@@ -1367,99 +1359,99 @@ refreshBuffer( lx5000_device *lx5000dev,
int _1stPrintable; /* Across all pens */
int numColours = lx5000dev->color_info.num_components;
- /* Establish the next line to print, if it
- is already in the buffer. */
+ /* Establish the next line to print, if it
+ is already in the buffer. */
_1stPrintable = pens[YELLOW_X][LO_PEN].finalLine;
for ( colour = 0; colour < numColours; colour++ )
{
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- if ( pens[ colour ][ pen ].nextPrintLine < _1stPrintable)
- _1stPrintable = pens[ colour ][ pen ].nextPrintLine;
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ if ( pens[ colour ][ pen ].nextPrintLine < _1stPrintable)
+ _1stPrintable = pens[ colour ][ pen ].nextPrintLine;
}
*nextLineToPrint = _1stPrintable;
nextToGet = (uchar)(*nextLineToGet & COLOUR_BUF_MASK);
- /* nextLineToPrint may be set high (i.e. not
- known), or may be a known print line. */
+ /* nextLineToPrint may be set high (i.e. not
+ known), or may be a known print line. */
while ( ( *nextLineToGet < *nextLineToPrint
- || ( *nextLineToGet - *nextLineToPrint ) < COLOUR_BUF_LINES )
- && *nextLineToGet < lx5000dev->height )
+ || ( *nextLineToGet - *nextLineToPrint ) < COLOUR_BUF_LINES )
+ && *nextLineToGet < lx5000dev->height )
{
- bufferOffset = LINE_PAD_BYTES + ( lx5000dev->penLineLen * nextToGet );
-
- if ( ! lx5000dev->isCMYK )
- {
- /* For black-only, read the bits directly into
- the colour buffer. */
- gdev_prn_get_bits( (gx_device_printer *)lx5000dev, *nextLineToGet,
- colourBufs[BLACK_X] + bufferOffset, &lineBuf );
- /* If necessary, copy the bits into the actual
- buffer. */
- if ( lineBuf != colourBufs[BLACK_X] + bufferOffset )
- memcpy(colourBufs[BLACK_X] + bufferOffset,
- lineBuf, lx5000dev->penLineBytes);
- /* Check for a printing line */
- if ( *(colourBufs[BLACK_X] + bufferOffset) != 0
- || memcmp( colourBufs[BLACK_X] + bufferOffset,
- colourBufs[BLACK_X] + bufferOffset + 1,
- lx5000dev->scanLineBytes - 1 ))
- lineEmpty[ BLACK_X ][ nextToGet ] = false;
- else
- lineEmpty[ BLACK_X ][ nextToGet ] = true;
- }
- else /* CMYK printing */
- {
- /* Process a CMYK line from GS */
- gdev_prn_get_bits( (gx_device_printer *)lx5000dev,
- *nextLineToGet, lineBuffer, &lineBuf );
- processCMYKline( lx5000dev, *nextLineToGet, lineBuffer, lineBuf,
- colourBufs, colourLines, pens, lineEmpty );
- }
- for (colour = 0; colour < numColours; colour++ )
- {
- /* Check for printing line -
- N.B. For two-pen colour, this becomes more
- complicated. The relationship between the
- first print line of the lower and of the
- upper pen is determined by odd/even line
- numbers, although this is not an essential
- relationship. Blank lines at the top of
- the lower pen could be skipped, and the
- first available line could be printed by
- the lower pen. */
- if ( ! lineEmpty[colour][nextToGet] )
- {
- if ( pens[colour][LO_PEN].nextPrintLine > *nextLineToGet )
- pens[colour][LO_PEN].nextPrintLine = *nextLineToGet;
- if ( *nextLineToPrint > *nextLineToGet )
- *nextLineToPrint = *nextLineToGet;
- }
- }
- ++*nextLineToGet;
- nextToGet = ( *nextLineToGet & COLOUR_BUF_MASK ); /* N.B. This is safer
- than just doing the increment, in case the
- buffer length changes. */
+ bufferOffset = LINE_PAD_BYTES + ( lx5000dev->penLineLen * nextToGet );
+
+ if ( ! lx5000dev->isCMYK )
+ {
+ /* For black-only, read the bits directly into
+ the colour buffer. */
+ gdev_prn_get_bits( (gx_device_printer *)lx5000dev, *nextLineToGet,
+ colourBufs[BLACK_X] + bufferOffset, &lineBuf );
+ /* If necessary, copy the bits into the actual
+ buffer. */
+ if ( lineBuf != colourBufs[BLACK_X] + bufferOffset )
+ memcpy(colourBufs[BLACK_X] + bufferOffset,
+ lineBuf, lx5000dev->penLineBytes);
+ /* Check for a printing line */
+ if ( *(colourBufs[BLACK_X] + bufferOffset) != 0
+ || memcmp( colourBufs[BLACK_X] + bufferOffset,
+ colourBufs[BLACK_X] + bufferOffset + 1,
+ lx5000dev->scanLineBytes - 1 ))
+ lineEmpty[ BLACK_X ][ nextToGet ] = false;
+ else
+ lineEmpty[ BLACK_X ][ nextToGet ] = true;
+ }
+ else /* CMYK printing */
+ {
+ /* Process a CMYK line from GS */
+ gdev_prn_get_bits( (gx_device_printer *)lx5000dev,
+ *nextLineToGet, lineBuffer, &lineBuf );
+ processCMYKline( lx5000dev, *nextLineToGet, lineBuffer, lineBuf,
+ colourBufs, colourLines, pens, lineEmpty );
+ }
+ for (colour = 0; colour < numColours; colour++ )
+ {
+ /* Check for printing line -
+ N.B. For two-pen colour, this becomes more
+ complicated. The relationship between the
+ first print line of the lower and of the
+ upper pen is determined by odd/even line
+ numbers, although this is not an essential
+ relationship. Blank lines at the top of
+ the lower pen could be skipped, and the
+ first available line could be printed by
+ the lower pen. */
+ if ( ! lineEmpty[colour][nextToGet] )
+ {
+ if ( pens[colour][LO_PEN].nextPrintLine > *nextLineToGet )
+ pens[colour][LO_PEN].nextPrintLine = *nextLineToGet;
+ if ( *nextLineToPrint > *nextLineToGet )
+ *nextLineToPrint = *nextLineToGet;
+ }
+ }
+ ++*nextLineToGet;
+ nextToGet = ( *nextLineToGet & COLOUR_BUF_MASK ); /* N.B. This is safer
+ than just doing the increment, in case the
+ buffer length changes. */
}
- /* Check that no buffer padding is necessary */
+ /* Check that no buffer padding is necessary */
if ( *nextLineToPrint < lx5000dev->height )
{
- while ( ( *nextLineToGet - *nextLineToPrint ) < COLOUR_BUF_LINES )
- { /* Last refresh fell short of COLOUR_BUF_LINES
- because last line of page was reached.
- Pad the buffer to COLOUR_BUF_LINES with 0
- (no print) bytes. */
- for ( colour = 0; colour < numColours; colour++ )
- { /* Fill the colour line buffer, incl pad */
- memset( colourBufs[colour]
- + ( lx5000dev->penLineLen * nextToGet ),
- 0, lx5000dev->penLineLen );
- /* Set empty indicator - note that firstBit
- is NOT set here. */
- lineEmpty[colour][nextToGet] = true;
- }
- ++*nextLineToGet;
- nextToGet = ( *nextLineToGet & COLOUR_BUF_MASK );
- }
+ while ( ( *nextLineToGet - *nextLineToPrint ) < COLOUR_BUF_LINES )
+ { /* Last refresh fell short of COLOUR_BUF_LINES
+ because last line of page was reached.
+ Pad the buffer to COLOUR_BUF_LINES with 0
+ (no print) bytes. */
+ for ( colour = 0; colour < numColours; colour++ )
+ { /* Fill the colour line buffer, incl pad */
+ memset( colourBufs[colour]
+ + ( lx5000dev->penLineLen * nextToGet ),
+ 0, lx5000dev->penLineLen );
+ /* Set empty indicator - note that firstBit
+ is NOT set here. */
+ lineEmpty[colour][nextToGet] = true;
+ }
+ ++*nextLineToGet;
+ nextToGet = ( *nextLineToGet & COLOUR_BUF_MASK );
+ }
}
}
@@ -1476,31 +1468,31 @@ refreshBuffer( lx5000_device *lx5000dev,
*----------------------------------------------------------------------*/
static int
cartridgeMoveTo( lx5000_device *lx5000dev,
- penData pens[NUM_COLOURS][PENS_PER_COLOUR],
- int _1stColour, int lastColour )
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR],
+ int _1stColour, int lastColour )
{
if ( _1stColour != BLACK_X && ! lx5000dev->isCMYK )
- /* Send back an off-the-page value */
- return pens[CYAN_X][LO_PEN].finalLine;
+ /* Send back an off-the-page value */
+ return pens[CYAN_X][LO_PEN].finalLine;
else
{
- int colour, pen, minLine;
-
- minLine = pens[CYAN_X][LO_PEN].finalLine; /* Initialise high */
- /* For each pen, calculate a moveto value
- which will print the next line with the
- first nozzle of that pen.
- Return the minimum of these values. */
- for ( colour = _1stColour; colour <= lastColour; colour++ )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- if ( ( pens[colour][pen].nextPrintLine
- + pens[colour][pen].topToBottomYellow )
- < minLine )
- minLine =
- pens[colour][pen].nextPrintLine
- + pens[colour][pen].topToBottomYellow;
-
- return minLine;
+ int colour, pen, minLine;
+
+ minLine = pens[CYAN_X][LO_PEN].finalLine; /* Initialise high */
+ /* For each pen, calculate a moveto value
+ which will print the next line with the
+ first nozzle of that pen.
+ Return the minimum of these values. */
+ for ( colour = _1stColour; colour <= lastColour; colour++ )
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ if ( ( pens[colour][pen].nextPrintLine
+ + pens[colour][pen].topToBottomYellow )
+ < minLine )
+ minLine =
+ pens[colour][pen].nextPrintLine
+ + pens[colour][pen].topToBottomYellow;
+
+ return minLine;
}
}
/*----------------------------------------------------------------------*
@@ -1513,9 +1505,9 @@ cartridgeMoveTo( lx5000_device *lx5000dev,
*----------------------------------------------------------------------*/
static void
setColourColumnExtent( lx5000_device *lx5000dev, byte *colourBuf,
- bool lineEmpty[COLOUR_BUF_LINES],
- int _1stLine, int _1stNozzle, int lastLine,
- int *_1stColumn, int *lastColumn, int *columnExtent )
+ bool lineEmpty[COLOUR_BUF_LINES],
+ int _1stLine, int _1stNozzle, int lastLine,
+ int *_1stColumn, int *lastColumn, int *columnExtent )
{
uchar _1stIndex;
int firstPrintByte, lastPrintByte;
@@ -1527,47 +1519,47 @@ setColourColumnExtent( lx5000_device *lx5000dev, byte *colourBuf,
for ( ; line <= lastLine; line += lx5000dev->lineIncrement )
{ /* For each active line in swipe */
- int columnByte;
-
- _1stIndex = line & COLOUR_BUF_MASK;
- if ( lineEmpty[ _1stIndex ] )
- continue; /* If the line is empty, skip it. */
- /* Otherwise, scan from the beginning to any
- previously found non-zero byte for the
- beginning of the active column extent. */
- for ( columnByte = 0; columnByte < firstPrintByte; columnByte++ )
- if ( colourBuf[ _1stIndex * lx5000dev->penLineLen
- + LINE_PAD_BYTES + columnByte ] )
- {
- firstPrintByte = columnByte;
- break;
- }
- /* Scan from the end of the line to any pre-
- viously found non-zero byte for the end of
- the active column extent. */
- for ( columnByte = lx5000dev->penLineBytes;
- columnByte > lastPrintByte; columnByte-- )
- if ( colourBuf[ _1stIndex * lx5000dev->penLineLen
- + LINE_PAD_BYTES + columnByte ] )
- {
- lastPrintByte = columnByte;
- break;
- }
+ int columnByte;
+
+ _1stIndex = line & COLOUR_BUF_MASK;
+ if ( lineEmpty[ _1stIndex ] )
+ continue; /* If the line is empty, skip it. */
+ /* Otherwise, scan from the beginning to any
+ previously found non-zero byte for the
+ beginning of the active column extent. */
+ for ( columnByte = 0; columnByte < firstPrintByte; columnByte++ )
+ if ( colourBuf[ _1stIndex * lx5000dev->penLineLen
+ + LINE_PAD_BYTES + columnByte ] )
+ {
+ firstPrintByte = columnByte;
+ break;
+ }
+ /* Scan from the end of the line to any pre-
+ viously found non-zero byte for the end of
+ the active column extent. */
+ for ( columnByte = lx5000dev->penLineBytes;
+ columnByte > lastPrintByte; columnByte-- )
+ if ( colourBuf[ _1stIndex * lx5000dev->penLineLen
+ + LINE_PAD_BYTES + columnByte ] )
+ {
+ lastPrintByte = columnByte;
+ break;
+ }
}
- /* If we have no extent, there are no
- printable lines for this pen. */
+ /* If we have no extent, there are no
+ printable lines for this pen. */
if ( firstPrintByte > lastPrintByte )
{
- *_1stColumn = firstPrintByte * 8;
- *lastColumn = lastPrintByte * 8;
- *columnExtent = 0;
- return;
+ *_1stColumn = firstPrintByte * 8;
+ *lastColumn = lastPrintByte * 8;
+ *columnExtent = 0;
+ return;
}
*_1stColumn = firstPrintByte * 8;
*lastColumn = lastPrintByte * 8 + 7 + lx5000dev->headSeparation;
*columnExtent = ( *lastColumn - *_1stColumn ) + 1;
-
+
}
/*----------------------------------------------------------------------*
@@ -1581,102 +1573,102 @@ setColourColumnExtent( lx5000_device *lx5000dev, byte *colourBuf,
*----------------------------------------------------------------------*/
static void
setColourLines( lx5000_device *lx5000dev,
- byte *colourBuf, bufBit colourLines[COLOUR_BUF_LINES],
- int _1stLine, int _1stNozzle, int lastLine, int direction,
- int _1stColumn, int lastColumn )
+ byte *colourBuf, bufBit colourLines[COLOUR_BUF_LINES],
+ int _1stLine, int _1stNozzle, int lastLine, int direction,
+ int _1stColumn, int lastColumn )
{
uchar _1stIndex;
int line, nozzle, bit, headSep, headSepBytes, headSepBits;
int firstPrintByte, lastPrintByte, lastPrintBit;
bufBit startPtr;
-
+
/* Now initialize the penBits bufBit structures to point to the
beginning and end of the extent for each of the active lines in
this swipe
-
+
Adjust the beginning for all EVEN nozzles by moving it to the
left by HeadSeparation bits.
*/
headSep = lx5000dev->headSeparation;
if ( lx5000dev->x_pixels_per_inch == 300.0 )
- headSep = headSep >> 1; /* Halve the value at 300 dpi */
+ headSep = headSep >> 1; /* Halve the value at 300 dpi */
if ( lx5000dev->x_pixels_per_inch == 1200.0 )
- headSep = headSep << 1; /* Double the value at 1200dpi */
+ headSep = headSep << 1; /* Double the value at 1200dpi */
headSepBytes = headSep / 8;
headSepBits = headSep % 8;
firstPrintByte = _1stColumn / 8;
lastPrintByte = lastColumn / 8;
lastPrintBit = lastColumn % 8;
-
+
if ( direction == RIGHTWARD )
{
- /* Set up the ODD columns first */
- startPtr.xByte = colourBuf + LINE_PAD_BYTES + firstPrintByte;
- startPtr.xBit = BIT_TO_MASK( 0 );
- line = _1stLine;
- nozzle = _1stNozzle; /* Is 1st nozzle effectively odd? */
- if ( ! ( nozzle & 1 ) ) /* Nozzle is even, so increment */
- line += lx5000dev->lineIncrement;
- for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
- {
- _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
- colourLines[_1stIndex].xByte =
- startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
- colourLines[_1stIndex].xBit = startPtr.xBit;
- }
- /* Set up EVEN columns */
- startPtr.xByte -= headSepBytes;
- for ( bit = 0; bit < headSepBits; bit++ )
- {
- DEC_BIT( startPtr );
- }
- line = _1stLine;
- nozzle = _1stNozzle; /* Is 1st nozzle effectively even? */
- if ( nozzle & 1 ) /* Nozzle is odd, so increment */
- line += lx5000dev->lineIncrement;
- for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
- {
- _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
- colourLines[_1stIndex].xByte =
- startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
- colourLines[_1stIndex].xBit = startPtr.xBit;
- }
+ /* Set up the ODD columns first */
+ startPtr.xByte = colourBuf + LINE_PAD_BYTES + firstPrintByte;
+ startPtr.xBit = BIT_TO_MASK( 0 );
+ line = _1stLine;
+ nozzle = _1stNozzle; /* Is 1st nozzle effectively odd? */
+ if ( ! ( nozzle & 1 ) ) /* Nozzle is even, so increment */
+ line += lx5000dev->lineIncrement;
+ for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
+ {
+ _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
+ colourLines[_1stIndex].xByte =
+ startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
+ colourLines[_1stIndex].xBit = startPtr.xBit;
+ }
+ /* Set up EVEN columns */
+ startPtr.xByte -= headSepBytes;
+ for ( bit = 0; bit < headSepBits; bit++ )
+ {
+ DEC_BIT( startPtr );
+ }
+ line = _1stLine;
+ nozzle = _1stNozzle; /* Is 1st nozzle effectively even? */
+ if ( nozzle & 1 ) /* Nozzle is odd, so increment */
+ line += lx5000dev->lineIncrement;
+ for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
+ {
+ _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
+ colourLines[_1stIndex].xByte =
+ startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
+ colourLines[_1stIndex].xBit = startPtr.xBit;
+ }
}
else /* direction == LEFTWARD */
{
- /* Set up the ODD columns first */
- startPtr.xByte = colourBuf + LINE_PAD_BYTES + lastPrintByte;
- startPtr.xBit = BIT_TO_MASK( lastPrintBit );
- line = _1stLine;
- nozzle = _1stNozzle; /* Is 1st nozzle effectively odd? */
- if ( ! ( nozzle & 1 ) ) /* Nozzle is even, so increment */
- line += lx5000dev->lineIncrement;
- for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
- {
- _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
- colourLines[_1stIndex].xByte =
- startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
- colourLines[_1stIndex].xBit = startPtr.xBit;
- }
- /* Set up EVEN columns */
- startPtr.xByte -= headSepBytes;
- for ( bit = 0; bit < headSepBits; bit++ )
- {
- DEC_BIT( startPtr );
- }
- line = _1stLine;
- nozzle = _1stNozzle; /* Is 1st nozzle effectively even? */
- if ( nozzle & 1 ) /* Nozzle is odd, so increment */
- line += lx5000dev->lineIncrement;
- for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
- {
- _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
- colourLines[_1stIndex].xByte =
- startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
- colourLines[_1stIndex].xBit = startPtr.xBit;
- }
+ /* Set up the ODD columns first */
+ startPtr.xByte = colourBuf + LINE_PAD_BYTES + lastPrintByte;
+ startPtr.xBit = BIT_TO_MASK( lastPrintBit );
+ line = _1stLine;
+ nozzle = _1stNozzle; /* Is 1st nozzle effectively odd? */
+ if ( ! ( nozzle & 1 ) ) /* Nozzle is even, so increment */
+ line += lx5000dev->lineIncrement;
+ for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
+ {
+ _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
+ colourLines[_1stIndex].xByte =
+ startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
+ colourLines[_1stIndex].xBit = startPtr.xBit;
+ }
+ /* Set up EVEN columns */
+ startPtr.xByte -= headSepBytes;
+ for ( bit = 0; bit < headSepBits; bit++ )
+ {
+ DEC_BIT( startPtr );
+ }
+ line = _1stLine;
+ nozzle = _1stNozzle; /* Is 1st nozzle effectively even? */
+ if ( nozzle & 1 ) /* Nozzle is odd, so increment */
+ line += lx5000dev->lineIncrement;
+ for ( ; line <= lastLine; line += ( lx5000dev->lineIncrement << 1 ) )
+ {
+ _1stIndex = (uchar)( line & COLOUR_BUF_MASK );
+ colourLines[_1stIndex].xByte =
+ startPtr.xByte + _1stIndex * lx5000dev->penLineLen;
+ colourLines[_1stIndex].xBit = startPtr.xBit;
+ }
}
}
@@ -1686,12 +1678,12 @@ setColourLines( lx5000_device *lx5000dev,
*----------------------------------------------------------------------*/
static void
printSwipe( lx5000_device *lx5000dev, byte *colourBufs[NUM_COLOURS],
- bufBit
- colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
- penData pens[NUM_COLOURS][PENS_PER_COLOUR],
- bool lineEmpty[NUM_COLOURS][COLOUR_BUF_LINES], byte *swipeBuf,
- int *nextLineToPrint, int *nextLineToGet, int direction,
- int _1stColour, int lastColour, FILE *prn_stream )
+ bufBit
+ colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES],
+ penData pens[NUM_COLOURS][PENS_PER_COLOUR],
+ bool lineEmpty[NUM_COLOURS][COLOUR_BUF_LINES], byte *swipeBuf,
+ int *nextLineToPrint, int *nextLineToGet, int direction,
+ int _1stColour, int lastColour, FILE *prn_stream )
{
/*--------------------------------------------------------------------*
For unidirectional colour swathes, the effective print direction on
@@ -1703,320 +1695,320 @@ printSwipe( lx5000_device *lx5000dev, byte *colourBufs[NUM_COLOURS],
*--------------------------------------------------------------------*/
static const char swipeHeader[SWIPE_HDR_LEN] = {
- SWIPE_LEADER,
- 0, 0, 0, 0, /* command length */
- 0, /* direction */
- 0, /* head speed */
- 0, 0, /* pen selector */
- 0, /* nozzle count */
- 0, /* don't know */
- 0, 0, /* number of columns */
- 0, 0, /* 1st column */
- 0, 0, /* last column */
- SWIPE_HDR_END
+ SWIPE_LEADER,
+ 0, 0, 0, 0, /* command length */
+ 0, /* direction */
+ 0, /* head speed */
+ 0, 0, /* pen selector */
+ 0, /* nozzle count */
+ 0, /* don't know */
+ 0, 0, /* number of columns */
+ 0, 0, /* 1st column */
+ 0, 0, /* last column */
+ SWIPE_HDR_END
};
static const int wordsPerPen[NUM_COLOURS][PENS_PER_COLOUR + 1] =
{
- { -1,
- BLACK_NOZZLES / SWIPE_WORD_BITS,
- BLACK_NOZZLES / SWIPE_WORD_BITS / 2
- },
- { -1,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
- },
- { -1,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
- },
- { -1,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
- _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
- }
- };
+ { -1,
+ BLACK_NOZZLES / SWIPE_WORD_BITS,
+ BLACK_NOZZLES / SWIPE_WORD_BITS / 2
+ },
+ { -1,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
+ },
+ { -1,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
+ },
+ { -1,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS,
+ _1COLOUR_NOZZLES / SWIPE_WORD_BITS / 2
+ }
+ };
int _1stNozzle[NUM_COLOURS][PENS_PER_COLOUR];
- /* 1st active nozzle for pen */
+ /* 1st active nozzle for pen */
int lastNozzle[NUM_COLOURS][PENS_PER_COLOUR];
- /* Last nozzle of this pen */
+ /* Last nozzle of this pen */
int _1stLine[NUM_COLOURS][PENS_PER_COLOUR];
- /* Line no. of first print line for pen */
+ /* Line no. of first print line for pen */
int _1stPenColumn[NUM_COLOURS][PENS_PER_COLOUR];
int lastPenColumn[NUM_COLOURS][PENS_PER_COLOUR];
- /* Per-pen values... */
+ /* Per-pen values... */
int penExtent[NUM_COLOURS][PENS_PER_COLOUR];
int _1stColumn; /* ...and overall values of... */
int lastColumn;
int columnExtent; /* Column range after */
- /* stripping leading and trailing white space*/
+ /* stripping leading and trailing white space*/
int column; /* Loop variable - current column */
int line; /* Loop variables - line corresponding to
- current nozzle & temp line variable. */
+ current nozzle & temp line variable. */
uchar lineIndex; /* Circular index into pen buffer,
- corresponding to current line. */
+ corresponding to current line. */
int swipeCmdLen; /* Length of the swipe command */
int colour, pen;
byte *outp;
int x_dpi = (int)( lx5000dev->x_pixels_per_inch + 0.1 );
- /* Initialize worst case values for column
- extremities. */
+ /* Initialize worst case values for column
+ extremities. */
_1stColumn = lx5000dev->penLineBytes * 8
- + 7 + lx5000dev->headSeparation;
+ + 7 + lx5000dev->headSeparation;
lastColumn = 0;
- /* Set up extents on a per-colour basis. */
+ /* Set up extents on a per-colour basis. */
for ( colour = _1stColour; colour <= lastColour; colour++ )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- _1stLine[colour][pen] = pens[colour][pen].nextPrintLine;
- _1stNozzle[colour][pen] = _1stLine[colour][pen]
- - pens[colour][pen].topLine;
- lastNozzle[colour][pen] = pens[colour][pen].bottomLine
- - pens[colour][pen].topLine;
-
- setColourColumnExtent( lx5000dev, colourBufs[colour],
- lineEmpty[colour], _1stLine[colour][pen],
- _1stNozzle[colour][pen],
- pens[colour][pen].bottomLine,
- &_1stPenColumn[colour][pen],
- &lastPenColumn[colour][pen],
- &penExtent[colour][pen] );
- /* Get the overall extents for the swipe */
- if ( _1stPenColumn[colour][pen] < _1stColumn )
- _1stColumn = _1stPenColumn[colour][pen];
- if ( lastPenColumn[colour][pen] > lastColumn )
- lastColumn = lastPenColumn[colour][pen];
- }
- /* Set overall extent */
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ _1stLine[colour][pen] = pens[colour][pen].nextPrintLine;
+ _1stNozzle[colour][pen] = _1stLine[colour][pen]
+ - pens[colour][pen].topLine;
+ lastNozzle[colour][pen] = pens[colour][pen].bottomLine
+ - pens[colour][pen].topLine;
+
+ setColourColumnExtent( lx5000dev, colourBufs[colour],
+ lineEmpty[colour], _1stLine[colour][pen],
+ _1stNozzle[colour][pen],
+ pens[colour][pen].bottomLine,
+ &_1stPenColumn[colour][pen],
+ &lastPenColumn[colour][pen],
+ &penExtent[colour][pen] );
+ /* Get the overall extents for the swipe */
+ if ( _1stPenColumn[colour][pen] < _1stColumn )
+ _1stColumn = _1stPenColumn[colour][pen];
+ if ( lastPenColumn[colour][pen] > lastColumn )
+ lastColumn = lastPenColumn[colour][pen];
+ }
+ /* Set overall extent */
columnExtent = ( lastColumn - _1stColumn ) + 1;
- /* Set the column range for each of the colour
- pens now that the full extent is known. */
+ /* Set the column range for each of the colour
+ pens now that the full extent is known. */
for ( colour = _1stColour; colour <= lastColour; colour++ )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- setColourLines( lx5000dev, colourBufs[colour],
- colourLines[colour][pen],
- _1stLine[colour][pen], _1stNozzle[colour][pen],
- pens[colour][pen].bottomLine, direction,
- _1stColumn, lastColumn );
- }
-
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ setColourLines( lx5000dev, colourBufs[colour],
+ colourLines[colour][pen],
+ _1stLine[colour][pen], _1stNozzle[colour][pen],
+ pens[colour][pen].bottomLine, direction,
+ _1stColumn, lastColumn );
+ }
+
memcpy( swipeBuf, swipeHeader, SWIPE_HDR_LEN );
outp = swipeBuf + SWIPE_HDR_LEN;
- /* For each column of the output, build two
- stripes. One uses the standard directory
- scheme, and the other uses the repeat
- compression scheme. Output the more
- compact result. */
+ /* For each column of the output, build two
+ stripes. One uses the standard directory
+ scheme, and the other uses the repeat
+ compression scheme. Output the more
+ compact result. */
for ( column = _1stColumn; column <= lastColumn; column++ )
{
- ushort dataword; /* Loop transient - contents of swipe data
- word currently under construction. */
- ushort lastWord; /* Last data word constructed for repeat
- compression directory method. */
- int nozzle; /* Loop variable - current nozzle */
- /* The arrays of the two sets of data words
- generated by each of the swipe construction
- methods for a single swipe. Does not
- include the 16 bit directory word. */
- int wordCount1; /* The count of words in the column arrays, */
- int wordCount2; /* below. */
- ushort column1[BLK_SWIPE_WORDS];
- ushort column2[BLK_SWIPE_WORDS];
- int columnWord; /* Current word within column. */
- bufBit *lineBit; /* Loop transient - current scan line bit */
- ushort wordBit; /* Current bit within swipe word - incremented
- by right shifts. */
- ushort directoryBit; /* Current bit within directory word. It
- indicates the currently active set of 16
- nozzles. Incremented by left shifts. */
- ushort directory1; /* The directories for the two methods. Each */
- ushort directory2; /* bit controls one following 16bit word. */
-
- if ( _1stColour == BLACK_X )
- {
- directory1 = (ushort)(BLK_DIRECTORY_MASK); /* empty */
- directory2 = (ushort)(BLK_DIRECTORY_MASK); /* empty */
- }
- else
- {
- directory1 = (ushort)(COLOUR_DIRECTORY_MASK); /* empty */
- directory2 = (ushort)(COLOUR_DIRECTORY_MASK); /* empty */
- }
- directory1 |= DIRECTORY_TYPE_BIT; /* Normal directory */
- directory2 &= ~DIRECTORY_TYPE_BIT; /* Repeat compression
- directory */
- /* LSBit of directory refers to 1st following
- word */
- directoryBit = 1;
- lastWord = 0;
- wordCount1 = 0;
- wordCount2 = 0;
- /* Note that the order of the pens in the
- datawords (top nozzle to bottom) is
- CMY, the reverse of the numbering */
- /*------------------------------------------
- N.B. What are the implications of this for
- pen processing within a colour?
- -----------------------------------------*/
- for ( colour = lastColour; colour >= _1stColour; colour-- )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- dataword = 0;
- nozzle = 0;
- line = _1stLine[colour][pen];
- /* If there are any non-printing nozzles at
- the top of the printhead, set up the entries
- for them here. */
- while ( ( ( _1stNozzle[colour][pen] - nozzle )
- >= SWIPE_WORD_BITS )
- && ( nozzle <= lastNozzle[colour][pen] ) )
- {
- if ( lastWord != 0 )
- {
- directory2 &= ~directoryBit;
- column2[ wordCount2++ ] = dataword;
- lastWord = dataword;
- }
- nozzle += SWIPE_WORD_BITS;
- directoryBit <<= 1;
- }
- /* Shift over any remaining empty bits in
- the current column word. */
- wordBit = ( 1 << ( SWIPE_WORD_BITS - 1 ));
- wordBit >>= ( _1stNozzle[colour][pen] - nozzle );
-
- for ( columnWord = _1stNozzle[colour][pen] / SWIPE_WORD_BITS;
- columnWord <
- wordsPerPen[colour][lx5000dev->pensPerColour];
- columnWord++ )
- {
- while ( wordBit )
- {
- lineIndex = (uchar)( line & COLOUR_BUF_MASK );
- /* Get the bit from the next line */
- lineBit = &colourLines[colour][pen][lineIndex];
- if ( *(lineBit->xByte) & lineBit->xBit )
- dataword |= wordBit;
- wordBit >>= 1;
- if ( direction == LEFTWARD )
- {
- DEC_BIT( *lineBit );
- }
- else
- {
- INC_BIT( *lineBit );
- }
- line += lx5000dev->lineIncrement;
- }
- /* Do we have a non-null dataword? */
- if ( dataword )/* For normal compression, every nonempty */
- { /* dataword is noted and sent to printer */
- directory1 &= ~directoryBit;
- column1[ wordCount1++ ] = dataword;
- }
- if ( dataword != lastWord ) /* For repeat compression, */
- { /* only datawords which change are recorded */
- directory2 &= ~directoryBit;
- column2[ wordCount2++ ] = dataword;
- lastWord = dataword;
- }
- /* Look at next set of nozzles */
- directoryBit <<= 1;
- dataword = 0;
- /* Reset dataword bit mask to 1st bit */
- wordBit = ( 1 << ( SWIPE_WORD_BITS - 1 ));
- }
- }
- /* Output the smaller array of column words -
- is it normal or repeat compressed? */
- if ( wordCount1 < wordCount2 )
- { /* A normal directory + data */
- int i;
-
- *outp++ = directory1 >> 8;
- *outp++ = directory1 & 0xff;
- for ( i = 0; i < wordCount1; i++ )
- {
- *outp++ = column1[ i ] >> 8;
- *outp++ = column1[ i ] & 0xff;
- }
- }
- else
- { /* A repeat compression directory + data */
- int i;
-
- *outp++ = directory2 >> 8;
- *outp++ = directory2 & 0xff;
- for ( i = 0; i < wordCount2; i++ )
- {
- *outp++ = column2[ i ] >> 8;
- *outp++ = column2[ i ] & 0xff;
- }
- }
+ ushort dataword; /* Loop transient - contents of swipe data
+ word currently under construction. */
+ ushort lastWord; /* Last data word constructed for repeat
+ compression directory method. */
+ int nozzle; /* Loop variable - current nozzle */
+ /* The arrays of the two sets of data words
+ generated by each of the swipe construction
+ methods for a single swipe. Does not
+ include the 16 bit directory word. */
+ int wordCount1; /* The count of words in the column arrays, */
+ int wordCount2; /* below. */
+ ushort column1[BLK_SWIPE_WORDS];
+ ushort column2[BLK_SWIPE_WORDS];
+ int columnWord; /* Current word within column. */
+ bufBit *lineBit; /* Loop transient - current scan line bit */
+ ushort wordBit; /* Current bit within swipe word - incremented
+ by right shifts. */
+ ushort directoryBit; /* Current bit within directory word. It
+ indicates the currently active set of 16
+ nozzles. Incremented by left shifts. */
+ ushort directory1; /* The directories for the two methods. Each */
+ ushort directory2; /* bit controls one following 16bit word. */
+
+ if ( _1stColour == BLACK_X )
+ {
+ directory1 = (ushort)(BLK_DIRECTORY_MASK); /* empty */
+ directory2 = (ushort)(BLK_DIRECTORY_MASK); /* empty */
+ }
+ else
+ {
+ directory1 = (ushort)(COLOUR_DIRECTORY_MASK); /* empty */
+ directory2 = (ushort)(COLOUR_DIRECTORY_MASK); /* empty */
+ }
+ directory1 |= DIRECTORY_TYPE_BIT; /* Normal directory */
+ directory2 &= ~DIRECTORY_TYPE_BIT; /* Repeat compression
+ directory */
+ /* LSBit of directory refers to 1st following
+ word */
+ directoryBit = 1;
+ lastWord = 0;
+ wordCount1 = 0;
+ wordCount2 = 0;
+ /* Note that the order of the pens in the
+ datawords (top nozzle to bottom) is
+ CMY, the reverse of the numbering */
+ /*------------------------------------------
+ N.B. What are the implications of this for
+ pen processing within a colour?
+ -----------------------------------------*/
+ for ( colour = lastColour; colour >= _1stColour; colour-- )
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ dataword = 0;
+ nozzle = 0;
+ line = _1stLine[colour][pen];
+ /* If there are any non-printing nozzles at
+ the top of the printhead, set up the entries
+ for them here. */
+ while ( ( ( _1stNozzle[colour][pen] - nozzle )
+ >= SWIPE_WORD_BITS )
+ && ( nozzle <= lastNozzle[colour][pen] ) )
+ {
+ if ( lastWord != 0 )
+ {
+ directory2 &= ~directoryBit;
+ column2[ wordCount2++ ] = dataword;
+ lastWord = dataword;
+ }
+ nozzle += SWIPE_WORD_BITS;
+ directoryBit <<= 1;
+ }
+ /* Shift over any remaining empty bits in
+ the current column word. */
+ wordBit = ( 1 << ( SWIPE_WORD_BITS - 1 ));
+ wordBit >>= ( _1stNozzle[colour][pen] - nozzle );
+
+ for ( columnWord = _1stNozzle[colour][pen] / SWIPE_WORD_BITS;
+ columnWord <
+ wordsPerPen[colour][lx5000dev->pensPerColour];
+ columnWord++ )
+ {
+ while ( wordBit )
+ {
+ lineIndex = (uchar)( line & COLOUR_BUF_MASK );
+ /* Get the bit from the next line */
+ lineBit = &colourLines[colour][pen][lineIndex];
+ if ( *(lineBit->xByte) & lineBit->xBit )
+ dataword |= wordBit;
+ wordBit >>= 1;
+ if ( direction == LEFTWARD )
+ {
+ DEC_BIT( *lineBit );
+ }
+ else
+ {
+ INC_BIT( *lineBit );
+ }
+ line += lx5000dev->lineIncrement;
+ }
+ /* Do we have a non-null dataword? */
+ if ( dataword )/* For normal compression, every nonempty */
+ { /* dataword is noted and sent to printer */
+ directory1 &= ~directoryBit;
+ column1[ wordCount1++ ] = dataword;
+ }
+ if ( dataword != lastWord ) /* For repeat compression, */
+ { /* only datawords which change are recorded */
+ directory2 &= ~directoryBit;
+ column2[ wordCount2++ ] = dataword;
+ lastWord = dataword;
+ }
+ /* Look at next set of nozzles */
+ directoryBit <<= 1;
+ dataword = 0;
+ /* Reset dataword bit mask to 1st bit */
+ wordBit = ( 1 << ( SWIPE_WORD_BITS - 1 ));
+ }
+ }
+ /* Output the smaller array of column words -
+ is it normal or repeat compressed? */
+ if ( wordCount1 < wordCount2 )
+ { /* A normal directory + data */
+ int i;
+
+ *outp++ = directory1 >> 8;
+ *outp++ = directory1 & 0xff;
+ for ( i = 0; i < wordCount1; i++ )
+ {
+ *outp++ = column1[ i ] >> 8;
+ *outp++ = column1[ i ] & 0xff;
+ }
+ }
+ else
+ { /* A repeat compression directory + data */
+ int i;
+
+ *outp++ = directory2 >> 8;
+ *outp++ = directory2 & 0xff;
+ for ( i = 0; i < wordCount2; i++ )
+ {
+ *outp++ = column2[ i ] >> 8;
+ *outp++ = column2[ i ] & 0xff;
+ }
+ }
}
- /* Set up the header and output the swipe */
+ /* Set up the header and output the swipe */
swipeCmdLen = outp - swipeBuf;
{
- int ps1, ps2, direction, density, nozzles;
-
- direction = UNIDIRECTIONAL;
- if ( x_dpi == 300 )
- {
- density = _300X;
- }
- else
- {
- if ( x_dpi == 1200 )
- density = _1200X;
- else
- density = _600X;
- }
-
- if ( _1stColour == BLACK_X )
- {
- ps1 = BLACK0;
- ps2 = BLACK1;
- nozzles = _208NOZZLES;
- }
- else
- {
- ps1 = COLOUR0;
- ps2 = COLOUR1;
- nozzles = _192NOZZLES;
- }
- FILL_SWIPE_HEADER( swipeBuf, swipeCmdLen, direction, density,
- ps1, ps2, nozzles, UNKNOWN1VAL,
- columnExtent, _1stColumn, lastColumn );
+ int ps1, ps2, direction, density, nozzles;
+
+ direction = UNIDIRECTIONAL;
+ if ( x_dpi == 300 )
+ {
+ density = _300X;
+ }
+ else
+ {
+ if ( x_dpi == 1200 )
+ density = _1200X;
+ else
+ density = _600X;
+ }
+
+ if ( _1stColour == BLACK_X )
+ {
+ ps1 = BLACK0;
+ ps2 = BLACK1;
+ nozzles = _208NOZZLES;
+ }
+ else
+ {
+ ps1 = COLOUR0;
+ ps2 = COLOUR1;
+ nozzles = _192NOZZLES;
+ }
+ FILL_SWIPE_HEADER( swipeBuf, swipeCmdLen, direction, density,
+ ps1, ps2, nozzles, UNKNOWN1VAL,
+ columnExtent, _1stColumn, lastColumn );
}
fwrite( swipeBuf,1, outp - swipeBuf, prn_stream );
for ( colour = _1stColour; colour <= lastColour; colour++ )
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- /* Scan the buffer for the next print line,
- if present. If not, set sentinel value. */
- if ( pens[colour][pen].nextPrintLine
- <= pens[colour][pen].bottomLine
- || pens[colour][pen].nextPrintLine >= *nextLineToGet )
- {
- pens[colour][pen].nextPrintLine =
- pens[YELLOW_X][LO_PEN].finalLine;
- line = pens[colour][pen].bottomLine + 1;
- while ( line < *nextLineToGet )
- {
- lineIndex = (uchar)( line & COLOUR_BUF_MASK );
- if ( ! lineEmpty[colour][ lineIndex ] )
- {
- pens[colour][pen].nextPrintLine = line;
- break;
- }
- line += lx5000dev->lineIncrement;
- }
- }
- }
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ /* Scan the buffer for the next print line,
+ if present. If not, set sentinel value. */
+ if ( pens[colour][pen].nextPrintLine
+ <= pens[colour][pen].bottomLine
+ || pens[colour][pen].nextPrintLine >= *nextLineToGet )
+ {
+ pens[colour][pen].nextPrintLine =
+ pens[YELLOW_X][LO_PEN].finalLine;
+ line = pens[colour][pen].bottomLine + 1;
+ while ( line < *nextLineToGet )
+ {
+ lineIndex = (uchar)( line & COLOUR_BUF_MASK );
+ if ( ! lineEmpty[colour][ lineIndex ] )
+ {
+ pens[colour][pen].nextPrintLine = line;
+ break;
+ }
+ line += lx5000dev->lineIncrement;
+ }
+ }
+ }
}
/*----------------------------------------------------------------------*
@@ -2029,28 +2021,28 @@ lx5000_print_page( gx_device_printer *pdev, FILE *prn_stream )
{
/*
Data structures for the buffer:
-
+
------------------------------------------------------------------*
- C O L O U R B U F F E R S
+ C O L O U R B U F F E R S
------------------------------------------------------------------*
The colour buffers contain the individual colour bits that will
actually be passed to the print heads; therefore, there is one bit
per printable element. So far, the correspondence between the
gx_color_index elements in the scan line and the individual print
bits is 1-to-1.
-
+
For the colour driver, the colour buffers will be:
- Cbuffer, Mbuffer, Ybuffer and Kbuffer
+ Cbuffer, Mbuffer, Ybuffer and Kbuffer
while for the black driver, only Kbuffer is used.
(See BUFFER HANDLING MACROS.)
-
+
------------------------------------------------------------------*
- D E T E R M I N I N G B U F F E R S I Z E
+ D E T E R M I N I N G B U F F E R S I Z E
------------------------------------------------------------------*
The colour buffers are circular buffers: in order to implement this
characteristic, the size of the buffer must be 2^n. The buffers may
then be indexed by the scan line number, masked by 2^n - 1.
-
+
The buffer must be able to accommodate the maximum range of scan
lines that might be affected by a single swipe command. For colour
pens this is 240 ( 3 x 64 pens + 2 x 24 inter-pen gaps). For the
@@ -2058,72 +2050,72 @@ lx5000_print_page( gx_device_printer *pdev, FILE *prn_stream )
In fact, this is probably also the optimal buffer size, as there seems
to be no advantage in buffering twice the number of scan line required
to hold any individual swipe.
-
+
------------------------------------------------------------------*
- S T R U C T U R E O F T H E C O L O U R B U F F E R S
+ S T R U C T U R E O F T H E C O L O U R B U F F E R S
------------------------------------------------------------------*
The colour buffers hold the data for individual colour printheads,
extracted from the original data provided as scan lines. When the
data for each colour is extracted from the scan line, it is placed
into a line of the colour buffer corresponding to the scan line.
-
+
Within each line of the colour buffer, the data is structured like so:
+-------+------------------- ~ ---------------------+-------+
| Pad | Scan line data bits for one colour | Pad |
| bytes | | bytes |
+-------+-------------------------------------------+-------+
-
+
When the scan line data is first processed, the colour data is copied
into the colour buffer in the position indicated above. This line of
data is padded on both ends. The size of the pad is sufficient to
account for the number of bits of head separation between the EVEN
and ODD rows of nozzles in each print head; by default 16.
-
+
The individual lines are accessed through an array of colourLines struct-
ures. This is defined in the TYPEDEFS & EXTERNAL STORAGE secion above.
-
+
The colourLines structure contains a byte pointer which points to one of
the bytes of an individual colour buffer line, and an unsigned char
which is a single bit mask isolating one bit of the byte pointed to by
the other element.
- typedef struct bufBit_s {
- byte * xByte;
- uchar xBit;
- } bufBit;
-
+ typedef struct bufBit_s {
+ byte * xByte;
+ uchar xBit;
+ } bufBit;
+
The colourLines structure holds one instance of a bufBit; it points to
the first bit of the scan line. In general, the bit pointers for the
first bit of the EVEN columns will point to the beginning of the
extracted scan line data. For the ODD columns, the first bit
will point into the leading PAD bytes by 16 bits before the start of
the actual scan line data.
-
+
In this way, all of the complications of managing the separation
between the EVEN and ODD columns on the heads is contained in the
set-up procedures for the pointers in the scanLines array. If it is
required to reverse the adjustments of EVEN and ODD columns (for bi-
directional printing, for example) this is achieved by adjusting the
firstBit entries in this array.
-
+
That, at any rate, is the theory. It seemed like a good idea at the
time.
-
+
*/
static const unsigned char init_string[] = {
- 0xa5, 0, 6, 0x40, 3, 3, 0xc0, 0x0f, 0x0f,
- 0xa5, 0, 3, 0x40, 4, 5,
- 0xa5, 0, 3, 0x40, 4, 6,
- 0xa5, 0, 3, 0x40, 4, 7,
- 0xa5, 0, 3, 0x40, 4, 8,
- 0xa5, 0, 4, 0x40, 0xe0, 0xb, 3,
- 0xa5, 0, 11, 0x40, 0xe0, 0x41, 0, 0, 0, 0, 0, 0, 0, A5_11_5000,
- 0xa5, 0, 6, 0x40, 5, 0, 0, 0x80, 0,
- 0x1b, '*', 7, 0x73, 0x30,
- 0x1b, '*', 'm', 0, 0x14, 3, 0x84, 2, 0, 1, 0xf4,
- 0x1b, '*', 7, 0x63,
- 0x1b, '*', 'm', 0, 0x42, 0, 0,
- 0xa5, 0, 5, 0x40, 0xe0, 0x80, 8, 7
+ 0xa5, 0, 6, 0x40, 3, 3, 0xc0, 0x0f, 0x0f,
+ 0xa5, 0, 3, 0x40, 4, 5,
+ 0xa5, 0, 3, 0x40, 4, 6,
+ 0xa5, 0, 3, 0x40, 4, 7,
+ 0xa5, 0, 3, 0x40, 4, 8,
+ 0xa5, 0, 4, 0x40, 0xe0, 0xb, 3,
+ 0xa5, 0, 11, 0x40, 0xe0, 0x41, 0, 0, 0, 0, 0, 0, 0, A5_11_5000,
+ 0xa5, 0, 6, 0x40, 5, 0, 0, 0x80, 0,
+ 0x1b, '*', 7, 0x73, 0x30,
+ 0x1b, '*', 'm', 0, 0x14, 3, 0x84, 2, 0, 1, 0xf4,
+ 0x1b, '*', 7, 0x63,
+ 0x1b, '*', 'm', 0, 0x42, 0, 0,
+ 0xa5, 0, 5, 0x40, 0xe0, 0x80, 8, 7
};
byte *lineBuffer;
@@ -2132,183 +2124,183 @@ lx5000_print_page( gx_device_printer *pdev, FILE *prn_stream )
bufBit colourLines[NUM_COLOURS][PENS_PER_COLOUR][COLOUR_BUF_LINES];
bool lineEmpty[ NUM_COLOURS ][ COLOUR_BUF_LINES ];
penData pens[ NUM_COLOURS ][ PENS_PER_COLOUR ];
- /* nextLineToPrint is the top unprinted line
- in the buffers. It is adjusted as lines
- are processed and printed. Its sentinel
- value is pens[YELLOW_X][LO_PEN].finalLine.
- When any line
- which is not blank is read from GS &
- processed, nextLineToPrint will be set to
- this line if it is less than the current
- value.
-
- nextLineToGet is the next scanline to read
- from GS. */
+ /* nextLineToPrint is the top unprinted line
+ in the buffers. It is adjusted as lines
+ are processed and printed. Its sentinel
+ value is pens[YELLOW_X][LO_PEN].finalLine.
+ When any line
+ which is not blank is read from GS &
+ processed, nextLineToPrint will be set to
+ this line if it is less than the current
+ value.
+
+ nextLineToGet is the next scanline to read
+ from GS. */
int nextLineToPrint;
int nextLineToGet = 0;
- /* The current bottom line position of
- the colour cartridge. */
+ /* The current bottom line position of
+ the colour cartridge. */
int bottomYellowLine;
int retval;
-
+
lx5000_device *lx5000dev = (lx5000_device *)pdev;
nextLineToPrint = pens[YELLOW_X][LO_PEN].finalLine;
bottomYellowLine = INITIAL_YELLOW_BOTTOM_LINE;
- /* Allocate the buffer storage */
+ /* Allocate the buffer storage */
if ( ( retval = getColourBufs( lx5000dev, &lineBuffer, colourBufs,
- &swipeBuffer, ALLOCATE ) ))
- return retval;
+ &swipeBuffer, ALLOCATE ) ))
+ return retval;
initPenConstants( lx5000dev, pens );
- /* Initialize the lineEmpty[] and pens[] arrays -
- should happen during parameter setup process */
+ /* Initialize the lineEmpty[] and pens[] arrays -
+ should happen during parameter setup process */
{
- int colour, pen, line;
-
- for ( colour = 0;
- colour < lx5000dev->color_info.num_components;
- colour++ )
- {
- for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
- {
- pens[colour][pen].nextPrintLine =
- pens[YELLOW_X][LO_PEN].finalLine;
-
- pens[colour][pen].bottomLine =
- pens[colour][pen].initialBottomLine;
- pens[colour][pen].topLine =
- bottomYellowLine
- - pens[colour][pen].topToBottomYellow;
- }
- for ( line = 0; line < COLOUR_BUF_LINES; line++ )
- /* Force the zeroing of the line first time through */
- lineEmpty[colour][line] = false;
- }
+ int colour, pen, line;
+
+ for ( colour = 0;
+ colour < lx5000dev->color_info.num_components;
+ colour++ )
+ {
+ for ( pen = 0; pen < lx5000dev->pensPerColour; pen++ )
+ {
+ pens[colour][pen].nextPrintLine =
+ pens[YELLOW_X][LO_PEN].finalLine;
+
+ pens[colour][pen].bottomLine =
+ pens[colour][pen].initialBottomLine;
+ pens[colour][pen].topLine =
+ bottomYellowLine
+ - pens[colour][pen].topToBottomYellow;
+ }
+ for ( line = 0; line < COLOUR_BUF_LINES; line++ )
+ /* Force the zeroing of the line first time through */
+ lineEmpty[colour][line] = false;
+ }
}
- /* Initialize the printer and reset margins. */
+ /* Initialize the printer and reset margins. */
pageInit( (uchar)lx5000dev->alignA, (uchar)lx5000dev->alignB, prn_stream );
fwrite( init_string, 1, sizeof( init_string ), prn_stream );
- /*--------------------------------------------------------------*
- Assume that COLOUR_BUF_LINES of data are available, starting with
- nextLineToPrint. Work out which cartridge will be doing the
- printing, and how far it will have to move.
-
- Something is available to be printed. This may (should?) involve
- initial paper movement to line up the appropriate pen. Deciding
- on when to move the paper and by how much is tricky. One aim is
- to minimize paper movements.
-
- Check for black vs colour printing first. If the required
- movement for any of the colour pens is less than the required
- movement for the black pen, print a colour swathe, adjust all of
- the colour buffer values, and the nextLineToPrint value if
- necessary.
-
- Then refreshBuffer() and take another look. Sooner or later,
- the next required movement of the colour cartridge will exceed
- the movement required of the black cartridge. Print a black
- swathe. Whether to move the black cartridge for this print is
- determined by checking on the subsequent colour cartridge
- movement.
-
- If the difference between the required movement for the black
- and the required movement for the colour is less than or equal
- to one colour pen depth, do not move the pen before printing the
- black swathe.
-
- Adjust black buffer values, including nextLineToPrint, which will
- (almost?) certainly change after a black print. refreshBuffer()
- and try again.
-
- A note on 192 vs 208 black swathes. I can see the reasons for
- using the 192 swathes. When printing solid blocks with some of
- each colour and black on each scan line, use of 192 nozzles
- obviates the need for any black-related head movement. A black
- swathe can be printed on every third movement of the heads, and,
- in the circumstances sketched above, will use all 192 nozzles.
-
- Obviously, the same simple algorithm can be used when the colours
- are less densely packed. The Alignment B value, coded into the
- header of every swipe command, automatically adjusts the first
- pen of the set of 192 within a range of 0-15, so that the 192
- nozzles are symmetrically arranged with respect to the colour
- pens. The complication is that the EVEN/ODD status of the
- nozzles in the 208 set is unaffected, even though the numbering
- may change.
-
- It originally seemed to me that it was completely unnecessary
- to use the 192 nozzle set. The alignment value was needed to
- get the positioning right, but for all other purposes, the
- 208 set could be used, and adjustments made on the fly.
- However, I when considering the printing of pseudo 1200Y
- pages, which involves the use of half-height pseudo-pens, it
- became clear that the calculation of the half-height of a
- pens would be greatly simplified by the use of 192 nozzles.
- This would leave the height of a pseudo-pen at an integral
- number of 16-bit datawords.
-
- As a result, I will use 192 nozzles only when printing at
- Nx1200Ydpi.
-
- *--------------------------------------------------------------*/
+ /*--------------------------------------------------------------*
+ Assume that COLOUR_BUF_LINES of data are available, starting with
+ nextLineToPrint. Work out which cartridge will be doing the
+ printing, and how far it will have to move.
+
+ Something is available to be printed. This may (should?) involve
+ initial paper movement to line up the appropriate pen. Deciding
+ on when to move the paper and by how much is tricky. One aim is
+ to minimize paper movements.
+
+ Check for black vs colour printing first. If the required
+ movement for any of the colour pens is less than the required
+ movement for the black pen, print a colour swathe, adjust all of
+ the colour buffer values, and the nextLineToPrint value if
+ necessary.
+
+ Then refreshBuffer() and take another look. Sooner or later,
+ the next required movement of the colour cartridge will exceed
+ the movement required of the black cartridge. Print a black
+ swathe. Whether to move the black cartridge for this print is
+ determined by checking on the subsequent colour cartridge
+ movement.
+
+ If the difference between the required movement for the black
+ and the required movement for the colour is less than or equal
+ to one colour pen depth, do not move the pen before printing the
+ black swathe.
+
+ Adjust black buffer values, including nextLineToPrint, which will
+ (almost?) certainly change after a black print. refreshBuffer()
+ and try again.
+
+ A note on 192 vs 208 black swathes. I can see the reasons for
+ using the 192 swathes. When printing solid blocks with some of
+ each colour and black on each scan line, use of 192 nozzles
+ obviates the need for any black-related head movement. A black
+ swathe can be printed on every third movement of the heads, and,
+ in the circumstances sketched above, will use all 192 nozzles.
+
+ Obviously, the same simple algorithm can be used when the colours
+ are less densely packed. The Alignment B value, coded into the
+ header of every swipe command, automatically adjusts the first
+ pen of the set of 192 within a range of 0-15, so that the 192
+ nozzles are symmetrically arranged with respect to the colour
+ pens. The complication is that the EVEN/ODD status of the
+ nozzles in the 208 set is unaffected, even though the numbering
+ may change.
+
+ It originally seemed to me that it was completely unnecessary
+ to use the 192 nozzle set. The alignment value was needed to
+ get the positioning right, but for all other purposes, the
+ 208 set could be used, and adjustments made on the fly.
+ However, I when considering the printing of pseudo 1200Y
+ pages, which involves the use of half-height pseudo-pens, it
+ became clear that the calculation of the half-height of a
+ pens would be greatly simplified by the use of 192 nozzles.
+ This would leave the height of a pseudo-pen at an integral
+ number of 16-bit datawords.
+
+ As a result, I will use 192 nozzles only when printing at
+ Nx1200Ydpi.
+
+ *--------------------------------------------------------------*/
refreshBuffer( lx5000dev, &nextLineToGet, &nextLineToPrint,
- lineBuffer, colourBufs, colourLines, pens, lineEmpty );
+ lineBuffer, colourBufs, colourLines, pens, lineEmpty );
while ( nextLineToPrint < pdev->height )
{
- int blackDirection = RIGHTWARD;
- int colourDirection = LEFTWARD;
- /* Target of next move of colour cartridge */
- int nextColourLine;
- int nextBlack208Line = cartridgeMoveTo( lx5000dev, pens,
- BLACK_X,
- BLACK_X );
-
- /* In Black-only mode, cartridgeMoveTo
- will return an off-page value for the
- colour pens. */
- nextColourLine = cartridgeMoveTo( lx5000dev, pens,
- _1ST_CMY_COLOUR,
- LAST_CMY_COLOUR );
- if ( lx5000dev->isCMYK && nextColourLine <= nextBlack208Line )
- { /* Move the head & print a 3-colour swathe */
- feedPaper( lx5000dev, nextColourLine, &bottomYellowLine, pens,
- prn_stream );
- printSwipe( lx5000dev, colourBufs, colourLines, pens,
- lineEmpty, swipeBuffer,
- &nextLineToPrint, &nextLineToGet, colourDirection,
- _1ST_CMY_COLOUR, LAST_CMY_COLOUR,
- prn_stream );
- }
- else
- {
- feedPaper( lx5000dev, nextBlack208Line, &bottomYellowLine,
- pens, prn_stream );
- printSwipe( lx5000dev, colourBufs, colourLines, pens,
- lineEmpty, swipeBuffer,
- &nextLineToPrint, &nextLineToGet, blackDirection,
- BLACK_X, BLACK_X,
- prn_stream );
- }
- refreshBuffer( lx5000dev, &nextLineToGet, &nextLineToPrint,
- lineBuffer, colourBufs, colourLines, pens, lineEmpty );
+ int blackDirection = RIGHTWARD;
+ int colourDirection = LEFTWARD;
+ /* Target of next move of colour cartridge */
+ int nextColourLine;
+ int nextBlack208Line = cartridgeMoveTo( lx5000dev, pens,
+ BLACK_X,
+ BLACK_X );
+
+ /* In Black-only mode, cartridgeMoveTo
+ will return an off-page value for the
+ colour pens. */
+ nextColourLine = cartridgeMoveTo( lx5000dev, pens,
+ _1ST_CMY_COLOUR,
+ LAST_CMY_COLOUR );
+ if ( lx5000dev->isCMYK && nextColourLine <= nextBlack208Line )
+ { /* Move the head & print a 3-colour swathe */
+ feedPaper( lx5000dev, nextColourLine, &bottomYellowLine, pens,
+ prn_stream );
+ printSwipe( lx5000dev, colourBufs, colourLines, pens,
+ lineEmpty, swipeBuffer,
+ &nextLineToPrint, &nextLineToGet, colourDirection,
+ _1ST_CMY_COLOUR, LAST_CMY_COLOUR,
+ prn_stream );
+ }
+ else
+ {
+ feedPaper( lx5000dev, nextBlack208Line, &bottomYellowLine,
+ pens, prn_stream );
+ printSwipe( lx5000dev, colourBufs, colourLines, pens,
+ lineEmpty, swipeBuffer,
+ &nextLineToPrint, &nextLineToGet, blackDirection,
+ BLACK_X, BLACK_X,
+ prn_stream );
+ }
+ refreshBuffer( lx5000dev, &nextLineToGet, &nextLineToPrint,
+ lineBuffer, colourBufs, colourLines, pens, lineEmpty );
} /* ends the loop for swipes of the print head.*/
- /* Eject the page, reinitialize the printer */
+ /* Eject the page, reinitialize the printer */
pageEnd( prn_stream );
fflush( prn_stream );
getColourBufs( lx5000dev, &lineBuffer, colourBufs, &swipeBuffer,
- DEALLOCATE );
+ DEALLOCATE );
if ( lx5000dev->dryTime )
- sleep( lx5000dev->dryTime );
+ sleep( lx5000dev->dryTime );
return 0;
}
-/*
- * There are a number of parameters which can differ between ink cartridges.
+/*
+ * There are a number of parameters which can differ between ink cartridges.
* The Windows driver asks you to recalibrate every time you load a new
* cartridge.
*
@@ -2358,22 +2350,22 @@ lx5000_print_page( gx_device_printer *pdev, FILE *prn_stream )
static int
lx5000_get_params( gx_device *pdev, gs_param_list *plist )
/*----------------------------------------------------------------------*/
-{
+{
lx5000_device *lx5000dev = (lx5000_device *)pdev;
int code = gdev_prn_get_params( pdev, plist );
if ( code < 0 ||
- ( code =
- param_write_int( plist, "HeadSeparation",
- &lx5000dev->headSeparation )) < 0 ||
- ( code = param_write_int(plist, "AlignA", &lx5000dev->alignA)) < 0 ||
- ( code = param_write_int(plist, "AlignB", &lx5000dev->alignB)) < 0 ||
- ( code = param_write_bool( plist, "CMYK", &lx5000dev->isCMYK )) < 0 ||
- ( code = param_write_bool( plist,
- "DryingTime", &lx5000dev->dryTime )) < 0
- )
- return code;
-
+ ( code =
+ param_write_int( plist, "HeadSeparation",
+ &lx5000dev->headSeparation )) < 0 ||
+ ( code = param_write_int(plist, "AlignA", &lx5000dev->alignA)) < 0 ||
+ ( code = param_write_int(plist, "AlignB", &lx5000dev->alignB)) < 0 ||
+ ( code = param_write_bool( plist, "CMYK", &lx5000dev->isCMYK )) < 0 ||
+ ( code = param_write_bool( plist,
+ "DryingTime", &lx5000dev->dryTime )) < 0
+ )
+ return code;
+
return code;
}
@@ -2382,28 +2374,28 @@ lx5000_get_params( gx_device *pdev, gs_param_list *plist )
*----------------------------------------------------------------------*/
static int
lx5000_put_param_int(
- gs_param_list *plist, gs_param_name pname,
- int *pvalue, int minval, int maxval, int ecode
- )
+ gs_param_list *plist, gs_param_name pname,
+ int *pvalue, int minval, int maxval, int ecode
+ )
/*----------------------------------------------------------------------*/
{
int code, value;
-
+
switch ( code = param_read_int( plist, pname, &value ) )
{
default:
- return code;
+ return code;
case 0:
- if ( value < minval || value > maxval )
- {
- code =
- param_signal_error( plist, pname, gs_error_rangecheck );
- ecode = ( code < 0 ? code : ecode );
- }
- else
- *pvalue = value;
+ if ( value < minval || value > maxval )
+ {
+ code =
+ param_signal_error( plist, pname, gs_error_rangecheck );
+ ecode = ( code < 0 ? code : ecode );
+ }
+ else
+ *pvalue = value;
case 1:
- return ecode;
+ return ecode;
}
}
@@ -2412,9 +2404,9 @@ lx5000_put_param_int(
*----------------------------------------------------------------------*/
static int
lx5000_put_param_bool(
- gs_param_list *plist, gs_param_name pname,
- bool *pvalue, int ecode
- )
+ gs_param_list *plist, gs_param_name pname,
+ bool *pvalue, int ecode
+ )
/*----------------------------------------------------------------------*/
{
int code;
@@ -2422,12 +2414,12 @@ lx5000_put_param_bool(
switch ( code = param_read_bool( plist, pname, pvalue ) )
{
default:
- ecode = code;
- param_signal_error(plist, pname, ecode);
- return code;
+ ecode = code;
+ param_signal_error(plist, pname, ecode);
+ return code;
case 1:
case 0:
- return ecode;
+ return ecode;
}
}
@@ -2453,119 +2445,118 @@ lx5000_put_params( gx_device *pdev, gs_param_list *plist )
bool isCMYK_old = isCMYK;
code = lx5000_put_param_int( plist, "HeadSeparation", &headSeparation,
- 8, 24, code ); /* 8 - 24 columns */
+ 8, 24, code ); /* 8 - 24 columns */
code = lx5000_put_param_int( plist, "AlignA", &alignA, 0, 30, code );
- /* 0 - 30 columns */
+ /* 0 - 30 columns */
code = lx5000_put_param_int( plist, "AlignB", &alignB, 0, 15, code );
- /* 0 -15 nozzles */
+ /* 0 -15 nozzles */
code = lx5000_put_param_int( plist, "DryingTime", &dryTime, 0, 60, code );
- /* 0 -60 seconds */
+ /* 0 -60 seconds */
code = lx5000_put_param_int
- ( plist, "BitsPerPixel", &bitsPerPixel, 1, 4, code );
- /* Black cartridge only */
+ ( plist, "BitsPerPixel", &bitsPerPixel, 1, 4, code );
+ /* Black cartridge only */
code = lx5000_put_param_bool( plist, "CMYK", &isCMYK, code );
- /* Black cartridge only */
+ /* Black cartridge only */
/* Take precautions against input errors */
if ( bitsPerPixel != 1 ) { bitsPerPixel = 4; }
if ( isCMYK != isCMYK_old || bitsPerPixel != oldBPP )
{
- bool isCMYK_new;
- /* What has changed? Assume that initial values were consistent,
- and set isCMYK to a value consistent with the changed args
- If both have changed, give precedence to isCMYK
- */
- if ( bitsPerPixel != oldBPP )
- {
- if ( bitsPerPixel == 1 )
- { isCMYK_new = false; }
- else
- { isCMYK_new = true; };
- }
- if ( isCMYK != isCMYK_old )
- { isCMYK_new = isCMYK; }
-
- isCMYK = isCMYK_new;
- bitsPerPixel = isCMYK ? 4 : 1;
-
- if ( isCMYK )
- {
- lx5000dev->color_info = color_info_cmy;
- dev_proc(pdev, map_cmyk_color) = lx5000_map_cmyk_color;
- dev_proc(pdev, map_rgb_color) = NULL;
- dev_proc(pdev, map_color_rgb) = lx5000_map_color_rgb;
- }
- else
- {
- lx5000dev->color_info = color_info_blk;
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_prn_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_prn_map_color_rgb;
- }
- if ( pdev->is_open )
- gs_closedevice(pdev);
+ bool isCMYK_new;
+ /* What has changed? Assume that initial values were consistent,
+ and set isCMYK to a value consistent with the changed args
+ If both have changed, give precedence to isCMYK
+ */
+ if ( bitsPerPixel != oldBPP )
+ {
+ if ( bitsPerPixel == 1 )
+ { isCMYK_new = false; }
+ else
+ { isCMYK_new = true; };
+ }
+ if ( isCMYK != isCMYK_old )
+ { isCMYK_new = isCMYK; }
+
+ isCMYK = isCMYK_new;
+ bitsPerPixel = isCMYK ? 4 : 1;
+
+ if ( isCMYK )
+ {
+ lx5000dev->color_info = color_info_cmy;
+ dev_proc(pdev, map_cmyk_color) = lx5000_map_cmyk_color;
+ dev_proc(pdev, map_rgb_color) = NULL;
+ dev_proc(pdev, map_color_rgb) = lx5000_map_color_rgb;
+ }
+ else
+ {
+ lx5000dev->color_info = color_info_blk;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_prn_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_prn_map_color_rgb;
+ }
+ if ( pdev->is_open )
+ gs_closedevice(pdev);
}
- /* call super class put_params */
+ /* call super class put_params */
ecode = gdev_prn_put_params( pdev, plist );
if ( ecode < 0 || code < 0 )
{
- if ( isCMYK != isCMYK_old )
- {
- if ( ! isCMYK )
- {
- lx5000dev->color_info = color_info_cmy;
- dev_proc(pdev, map_cmyk_color) = lx5000_map_cmyk_color;
- dev_proc(pdev, map_rgb_color) = NULL;
- dev_proc(pdev, map_color_rgb) = lx5000_map_color_rgb;
- }
- else
- {
- lx5000dev->color_info = color_info_blk;
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_prn_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_prn_map_color_rgb;
- }
- if ( pdev->is_open )
- gs_closedevice(pdev);
- }
- return ecode < 0 ? ecode : code;
+ if ( isCMYK != isCMYK_old )
+ {
+ if ( ! isCMYK )
+ {
+ lx5000dev->color_info = color_info_cmy;
+ dev_proc(pdev, map_cmyk_color) = lx5000_map_cmyk_color;
+ dev_proc(pdev, map_rgb_color) = NULL;
+ dev_proc(pdev, map_color_rgb) = lx5000_map_color_rgb;
+ }
+ else
+ {
+ lx5000dev->color_info = color_info_blk;
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_prn_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_prn_map_color_rgb;
+ }
+ if ( pdev->is_open )
+ gs_closedevice(pdev);
+ }
+ return ecode < 0 ? ecode : code;
}
- /* looks like everything okay; */
- /* go ahead and set parameters */
+ /* looks like everything okay; */
+ /* go ahead and set parameters */
lx5000dev->headSeparation = headSeparation;
lx5000dev->alignA = alignA;
lx5000dev->alignB = alignB;
lx5000dev->dryTime = dryTime;
lx5000dev->isCMYK = isCMYK;
- /* N.B. I am only setting these values here -
- should they also be set as part of the "two
- phase commit" of parameter changes? My
- code is the only place these things are
- accessed. */
+ /* N.B. I am only setting these values here -
+ should they also be set as part of the "two
+ phase commit" of parameter changes? My
+ code is the only place these things are
+ accessed. */
if ( lx5000dev->y_pixels_per_inch == MAX_LX5000_Y )
{
- lx5000dev->pensPerColour = 2;
- lx5000dev->lineIncrement = 2;
+ lx5000dev->pensPerColour = 2;
+ lx5000dev->lineIncrement = 2;
}
else
{
- lx5000dev->pensPerColour = 1;
- lx5000dev->lineIncrement = 1;
+ lx5000dev->pensPerColour = 1;
+ lx5000dev->lineIncrement = 1;
}
- if ( code == 1 ) return ecode;
+ if ( code == 1 ) return ecode;
return 0;
}
-
/*----------------------------------------------------------------------*
* The following colour handling procedures are lifted from gdevbit.c
*----------------------------------------------------------------------*/
@@ -2573,7 +2564,7 @@ lx5000_put_params( gx_device *pdev, gs_param_list *plist )
/* used, we do a case test rather than providing 3 separate routines. */
static int
lx5000_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value rgb[3])
+ gx_color_value rgb[3])
{
int depth = dev->color_info.depth;
int ncomp = dev->color_info.num_components;
@@ -2611,7 +2602,7 @@ lx5000_map_cmyk_color(gx_device * dev, const gx_color_value cv[])
gx_color_value cyan = cv[0], magenta = cv[1], yellow = cv[2], black = cv[3];
gx_color_index color =
((((((cyan >> drop) << bpc) +
- (magenta >> drop)) << bpc) +
+ (magenta >> drop)) << bpc) +
(yellow >> drop)) << bpc) +
(black >> drop);
diff --git a/gs/contrib/gdevlx7.c b/gs/contrib/gdevlx7.c
index 03a48a154..5dbda1a99 100644
--- a/gs/contrib/gdevlx7.c
+++ b/gs/contrib/gdevlx7.c
@@ -1,13 +1,13 @@
#include "gdevprn.h"
/* Copyright (C) 1989-1994, 1998, 1999 Aladdin Enterprises. All rights reserved.
This file is part of GNU Ghostscript.
-
+
GNU Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to
anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer to
the GNU General Public License for full details.
-
+
Everyone is granted permission to copy, modify and redistribute GNU
Ghostscript, but only under the conditions described in the GNU General
Public License. A copy of this license is supposed to have been given to
@@ -15,7 +15,7 @@
responsibilities. It should be in a file named COPYING. Among other
things, the copyright notice and this notice must be preserved on all
copies.
-
+
Aladdin Enterprises is not affiliated with the Free Software Foundation or
the GNU Project. GNU Ghostscript, as distributed by Aladdin Enterprises,
does not depend on any other GNU software.
@@ -24,19 +24,19 @@
* $Id: gdevlx7.c,v 1.5 2002/08/03 03:08:26 tillkamppeter Exp $
* Lexmark 7000 ink-jet "GDI" printer driver
* * just started...
- *
+ *
* Henryk Paluch paluch@bimbo.fjfi.cvut.cz
* http://bimbo.fjfi.cvut.cz/~paluch/l7kdriver/
- *
+ *
* BIG thanks to Peter B. West that discovered and described many
* "funny" things of the Lexmark 5xxx protocol.
- *
- * THIS GHOSTSCRIPT DRIVER USES MANY THINGS FROM
+ *
+ * THIS GHOSTSCRIPT DRIVER USES MANY THINGS FROM
* STEPHEN'S LEXMARK 5700 GHOSCRIPT DRIVER:
- *
+ *
* Stephen Taylor setaylor@ma.ultranet.com staylor@cs.wpi.edu
* http://www.ultranet.com/~setaylor/papers.htm
- *
+ *
* ALL INTRODUCED BUGS ARE PROPERTY OF HENRYK :-)
*/
@@ -48,7 +48,7 @@
#define LX7_CSW_H 192
/* maximum data bytes per packet: 13 * 2 = 26
- * 13 - compression bits, 2 = data words
+ * 13 - compression bits, 2 = data words
*/
#define LX7_MAX_SWBYTES 26
/* 13 * 2 databytes + 2 bytes for header = 28 bytes */
@@ -65,30 +65,30 @@
#define LXH_DSKIP2 (LXH_SKIP2*2+1)
/* Lexmark 7000 prologue */
/* 1st time initialization - INIT1 is common for all modes */
-#define LX7_INIT1 0x1b,0x2a,0x6d,0x00,0x40,0x10,0x03,0x10,0x11
+#define LX7_INIT1 0x1b,0x2a,0x6d,0x00,0x40,0x10,0x03,0x10,0x11
/* LX_INIT2 - for 1200dpi - currently not needed */
#define LX7_INIT2 0xa5,0x00,0x06,0x50,0x03,0x03,0xc0,0x0f,0x0f, \
0xa5,0x00,0x03,0x50,0x04,0x05, \
- 0xa5,0x00,0x03,0x50,0x04,0x06, \
- 0xa5,0x00,0x03,0x50,0x04,0x07, \
- 0xa5,0x00,0x03,0x50,0x04,0x08, \
- 0xa5,0x00,0x04,0x50,0x04,0x0c,0x00, \
- 0xa5,0x00,0x04,0x50,0xe0,0x0b,0x03
+ 0xa5,0x00,0x03,0x50,0x04,0x06, \
+ 0xa5,0x00,0x03,0x50,0x04,0x07, \
+ 0xa5,0x00,0x03,0x50,0x04,0x08, \
+ 0xa5,0x00,0x04,0x50,0x04,0x0c,0x00, \
+ 0xa5,0x00,0x04,0x50,0xe0,0x0b,0x03
/* LX_INIT3 - after 1200dpi prologue, or immediately after INIT1
* in other modes
*/
#define LX7_INIT3 0xa5,0x00,0x0b,0x50,0xe0,0x41,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x02,\
- 0xa5,0x00,0x06,0x50,0x05,0x00,0x00,0x80,0x00, \
- 0xa5,0x00,0x04,0x50,0x04,0x0c,0x00
+ 0xa5,0x00,0x06,0x50,0x05,0x00,0x00,0x80,0x00, \
+ 0xa5,0x00,0x04,0x50,0x04,0x0c,0x00
/* this is used also for new page prologue ... */
-#define LX7_INIT4 0x1b,0x2a,0x07,0x73,0x30
+#define LX7_INIT4 0x1b,0x2a,0x07,0x73,0x30
#define LX7_INIT5 0x1b,0x2a,0x07,0x63
/* mysterious reinitialization ???? */
#define LX7_INIT6 0x1b,0x2a,0x6d,0x00,0x42,0x00,0x00
-#define LX7_INIT7 0xa5,0x00,0x05,0x40,0xe0,0x80,0x07,0x08
-
+#define LX7_INIT7 0xa5,0x00,0x05,0x40,0xe0,0x80,0x07,0x08
+
static byte lx7_fullinit[]={LX7_INIT1, /*LX7_INIT2, LX7_INIT3,*/ LX7_INIT4,
LX7_INIT5, LX7_INIT6};
static byte lx7_pageinit[]={LX7_INIT4, LX7_INIT4, LX7_INIT5, LX7_INIT6};
@@ -107,7 +107,7 @@ static dev_proc_get_params(lxm_get_params);
static dev_proc_put_params(lxm_put_params);
/* set up dispatch table. I follow gdevdjet in using gdev_prn_output_page */
-static const gx_device_procs lxm7000m_procs =
+static const gx_device_procs lxm7000m_procs =
prn_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
lxm_get_params, lxm_put_params);
@@ -141,18 +141,18 @@ typedef struct lxm_device_s { /* a sub-class of gx_device_printer */
lxm_device far_data gs_lex7000_device = {
prn_device_std_body(lxm_device, lxm7000m_procs, "lex7000",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- /* total width & height in 10x " - A4 or letter compiled in.
- * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
- */
- 600, 600, /* x dpi, y dpi */
- 0.0, 0.1, 0.3, 0.1, /* margins */
- /* unlike most other Ink printers Lexmark is able to print at
- * whole top and bottom of paper :-)
- */
- 1, lxmgen_print_page),
- /* 1 = bits per color, generic routines*/
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ /* total width & height in 10x " - A4 or letter compiled in.
+ * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
+ */
+ 600, 600, /* x dpi, y dpi */
+ 0.0, 0.1, 0.3, 0.1, /* margins */
+ /* unlike most other Ink printers Lexmark is able to print at
+ * whole top and bottom of paper :-)
+ */
+ 1, lxmgen_print_page),
+ /* 1 = bits per color, generic routines*/
+
/* our extended attributes follow...*/
16, /* default headSeparation value */
lx7_fullinit,
@@ -164,18 +164,18 @@ lxm_device far_data gs_lex7000_device = {
lxm_device far_data gs_lex5700_device = {
prn_device_std_body(lxm_device, lxm7000m_procs, "lex5700",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- /* total width & height in 10x " - A4 or letter compiled in.
- * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
- */
- 600, 600, /* x dpi, y dpi */
- 0.1, 0.1, 0.1, 0.0, /* margins */
- /* unlike most other Ink printers Lexmark is able to print at
- * whole top and bottom of paper :-)
- */
- 1, lxmgen_print_page),
- /* 1 = bits per color, generic routines*/
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ /* total width & height in 10x " - A4 or letter compiled in.
+ * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
+ */
+ 600, 600, /* x dpi, y dpi */
+ 0.1, 0.1, 0.1, 0.0, /* margins */
+ /* unlike most other Ink printers Lexmark is able to print at
+ * whole top and bottom of paper :-)
+ */
+ 1, lxmgen_print_page),
+ /* 1 = bits per color, generic routines*/
+
/* our extended attributes follow...*/
16, /* default headSeparation value */
lx7_fullinit,
@@ -187,18 +187,18 @@ lxm_device far_data gs_lex5700_device = {
lxm_device far_data gs_lex3200_device = {
prn_device_std_body(lxm_device, lxm7000m_procs, "lex3200",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- /* total width & height in 10x " - A4 or letter compiled in.
- * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
- */
- 600, 600, /* x dpi, y dpi */
- 0.1, 0.1, 0.1, 0.0, /* margins */
- /* unlike most other Ink printers Lexmark is able to print at
- * whole top and bottom of paper :-)
- */
- 1, lxmgen_print_page),
- /* 1 = bits per color, generic routines*/
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ /* total width & height in 10x " - A4 or letter compiled in.
+ * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
+ */
+ 600, 600, /* x dpi, y dpi */
+ 0.1, 0.1, 0.1, 0.0, /* margins */
+ /* unlike most other Ink printers Lexmark is able to print at
+ * whole top and bottom of paper :-)
+ */
+ 1, lxmgen_print_page),
+ /* 1 = bits per color, generic routines*/
+
/* our extended attributes follow...*/
16, /* default headSeparation value */
lx7_fullinit,
@@ -210,18 +210,18 @@ lxm_device far_data gs_lex3200_device = {
lxm_device far_data gs_lex2050_device = {
prn_device_std_body(lxm_device, lxm7000m_procs, "lex2050",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- /* total width & height in 10x " - A4 or letter compiled in.
- * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
- */
- 600, 600, /* x dpi, y dpi */
- 0.1, 0.1, 0.1, 0.0, /* margins */
- /* unlike most other Ink printers Lexmark is able to print at
- * whole top and bottom of paper :-)
- */
- 1, lxmgen_print_page),
- /* 1 = bits per color, generic routines*/
-
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ /* total width & height in 10x " - A4 or letter compiled in.
+ * may be overriden by -sPAPERSIZE=a4 of -sPAPERSIZE=letter
+ */
+ 600, 600, /* x dpi, y dpi */
+ 0.1, 0.1, 0.1, 0.0, /* margins */
+ /* unlike most other Ink printers Lexmark is able to print at
+ * whole top and bottom of paper :-)
+ */
+ 1, lxmgen_print_page),
+ /* 1 = bits per color, generic routines*/
+
/* our extended attributes follow...*/
16, /* default headSeparation value */
lx7_fullinit,
@@ -231,14 +231,9 @@ lxm_device far_data gs_lex2050_device = {
LXT_2050
};
-
-
-
#define get_lx_type(pdev) \
(((lxm_device*)pdev)->printertype)
-
-
/* ------ Local Lexmark printer utilities ------*/
#define LX_LINE_EMPTY(buf,len) \
@@ -268,7 +263,7 @@ static void paper_shift(FILE *out,int offset)
buf[4]=(byte)(offset & 0xFF);
#ifdef DEBUG
dprintf3("paper_shift() %d 1200dpi = %d 600dpi = %d 300dpi pixels\n",
- offset,offset/2,offset/4);
+ offset,offset/2,offset/4);
#endif
fwrite(buf,sizeof(buf),1,out);
}
@@ -291,8 +286,8 @@ static int leftmost_pixel(byte *buf, int bytelen)
b= *r;
for(i=0;i<8;i++)
if ( ( b & ofs8[i])!=0)
- break;
- return (r-buf)*8+i;
+ break;
+ return (r-buf)*8+i;
}
/* return coordinate of rightmost pixel (in pixels) */
@@ -313,8 +308,8 @@ static int rightmost_pixel(byte *buf, int bytelen)
b= *r;
for(i=7;i>=0;i--)
if ( ( b & ofs8[i])!=0)
- break;
- return (r-buf)*8+i;
+ break;
+ return (r-buf)*8+i;
}
/* find leftmost and rightmost pixel in whole pass
@@ -335,7 +330,7 @@ static void find_lr_pixels(byte *buf[],int bytelen,int bufheight,
int left=maxright;
int right=0;
int i;
-
+
for(i=0;i<bufheight;i++)
{
int ltmp,rtmp;
@@ -343,27 +338,26 @@ static void find_lr_pixels(byte *buf[],int bytelen,int bufheight,
rtmp=rightmost_pixel(buf[i],bytelen);
#if 0
dprintf3("buf[%d]: leftmost %d, rightmost %d\n",
- i,ltmp,rtmp);
+ i,ltmp,rtmp);
#endif
if (interlaced && (i & 1)==1) /* interlaced && line is odd */
{
- ltmp=MAX((ltmp-intershift),0);
- rtmp=MIN((rtmp+intershift),maxright);
- if (ltmp==maxright)
- ltmp--; /* print at least one pixel to avoid races ?? */
+ ltmp=MAX((ltmp-intershift),0);
+ rtmp=MIN((rtmp+intershift),maxright);
+ if (ltmp==maxright)
+ ltmp--; /* print at least one pixel to avoid races ?? */
}
if (ltmp<left)
- left=ltmp;
+ left=ltmp;
if (rtmp>right)
- right=rtmp;
+ right=rtmp;
}
*leftmost = left;
- *rightmost = right;
+ *rightmost = right;
return;
}
-
/* ------ Driver procedures ------ */
/*** THIS NEED TO BE REWORKED SOON ***/
@@ -394,7 +388,7 @@ static const int IDX_CARTRIDGE=10;
* in gs binary
*/
static byte outb[]={0x1B,0x2A,0x04,0x00,0x00,0xFF,0xFF,
- /* number of packets ---- vvvvvvvvv */
+ /* number of packets ---- vvvvvvvvv */
0x00,0x02,0x01,0x01,0x1A,0x11,0xFF,0xFF,
/* horiz start, horiz end: packets = (horiz end - horiz start) +1 */
0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x22,0x33,0x44,0x55,0x01};
@@ -409,13 +403,13 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
unsigned char mask[8]={128,64,32,16,8,4,2,1};
unsigned int mask16[16]={0x8000,0x4000,0x2000,0x1000,
0x0800,0x0400,0x0200,0x0100,
- 0x0080,0x0040,0x0020,0x0010,
- 0x0008,0x0004,0x0002,0x0001};
+ 0x0080,0x0040,0x0020,0x0010,
+ 0x0008,0x0004,0x0002,0x0001};
int l8,r8,packets;
byte *p=outbuf+IDX_DATA;
int clen;
int i,k;
- unsigned int vbuf[LX7_MAX_SWWORDS];
+ unsigned int vbuf[LX7_MAX_SWWORDS];
int vi;
unsigned char *vp,*vp2;
int smask,smask2;
@@ -425,7 +419,6 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
packets=r8-l8+1;
-
outbuf[IDX_PACKETS] =(unsigned char)(packets >> 8);
outbuf[IDX_PACKETS+1]=(unsigned char)(packets & 0xFF);
outbuf[IDX_HSTART] =(unsigned char)(l8 >> 8);
@@ -443,7 +436,7 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
if ( (p-outbuf)>=OUT_BUF_SIZE-28 ) /* 13*2+2 */
{
- return -1;
+ return -1;
}
tbits=p;
p+=2; /* add room for RLE packet (2 bytes) */
@@ -457,40 +450,40 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
vi=vstart*2; /* vbuf index in pixels (not array index) */
for(k=vstart;k<vend;k++)
{
- vp=buf[k*2]+DIV8(i);
- /* vp points to current column for Left Ink */
- vp2=buf[k*2+1]+DIV8(i+LR_SHIFT);
- /* vp2 for right Ink jets */
- if ( ( vp[0] & smask) != 0)
- vbuf[DIV16(vi)] |= mask16[MOD16(vi)];
- vi++;
- if (i+LR_SHIFT<width*8)
- {
- if ( (vp2[0] & smask2) !=0 )
- vbuf[DIV16(vi)] |=mask16[MOD16(vi)];
- }
- vi++;
+ vp=buf[k*2]+DIV8(i);
+ /* vp points to current column for Left Ink */
+ vp2=buf[k*2+1]+DIV8(i+LR_SHIFT);
+ /* vp2 for right Ink jets */
+ if ( ( vp[0] & smask) != 0)
+ vbuf[DIV16(vi)] |= mask16[MOD16(vi)];
+ vi++;
+ if (i+LR_SHIFT<width*8)
+ {
+ if ( (vp2[0] & smask2) !=0 )
+ vbuf[DIV16(vi)] |=mask16[MOD16(vi)];
+ }
+ vi++;
}
/* every packet contains 13 info bits
* 1 = 8x left white, 8x right white
* 0 = 2 data bytes follow (8 bits left, 8 bits right)
*/
-
+
for(k=0;k<LX7_MAX_SWWORDS;k++)
{
- unsigned int t=vbuf[k];
-
- bits= (bits>>1);
- if (t==0) /* packet is empty */
- {
- bits+=BITSTART12;
- }
- else
- {
- *(p++)=(t >> 8) & 0xFF;
- *(p++)=(t & 0xFF);
- }
+ unsigned int t=vbuf[k];
+
+ bits= (bits>>1);
+ if (t==0) /* packet is empty */
+ {
+ bits+=BITSTART12;
+ }
+ else
+ {
+ *(p++)=(t >> 8) & 0xFF;
+ *(p++)=(t & 0xFF);
+ }
}
tbits[1]=(unsigned char)( (bits) & 0xFF);
*tbits =(unsigned char)( ((bits>>8) & 0x1f) | 0x20 );
@@ -500,28 +493,28 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
#endif
if (rle1size>6) /* try to use RLE2 compression for larger packets */
{
- byte ob[LX7_MAX_PACKET];
- unsigned int lastword=0x8FFF; /* impossible value */
- int byts=0;
- byte *pp=ob+2;
-
- memset(ob,0,LX7_MAX_PACKET);
- for(k=0;k<LX7_MAX_SWWORDS;k++)
- {
- unsigned int t=vbuf[k];
-
- byts= (byts>>1);
- if (t==lastword)
- {
- byts+=BITSTART12;
- }
- else
- {
- *(pp++)=(t >> 8) & 0xFF;
- *(pp++)=(t & 0xFF);
- lastword=t;
- }
- }
+ byte ob[LX7_MAX_PACKET];
+ unsigned int lastword=0x8FFF; /* impossible value */
+ int byts=0;
+ byte *pp=ob+2;
+
+ memset(ob,0,LX7_MAX_PACKET);
+ for(k=0;k<LX7_MAX_SWWORDS;k++)
+ {
+ unsigned int t=vbuf[k];
+
+ byts= (byts>>1);
+ if (t==lastword)
+ {
+ byts+=BITSTART12;
+ }
+ else
+ {
+ *(pp++)=(t >> 8) & 0xFF;
+ *(pp++)=(t & 0xFF);
+ lastword=t;
+ }
+ }
ob[1]=(unsigned char)( (byts) & 0xFF);
ob[0]=(unsigned char)( (byts>>8) & 0x1f );
rle2size=(pp-ob);
@@ -532,18 +525,17 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
if (rle1size>rle2size)
{
#if 0
- dprintf2("\n**RLE2 WIN** %d > %d \n",rle1size,rle2size);
- dprintf("\nUsing RLE2 compression\n");
+ dprintf2("\n**RLE2 WIN** %d > %d \n",rle1size,rle2size);
+ dprintf("\nUsing RLE2 compression\n");
#endif
- memcpy(tbits,ob,rle2size);
- p=tbits+rle2size;
+ memcpy(tbits,ob,rle2size);
+ p=tbits+rle2size;
}
}
}
-
/* ------------ */
- clen=p-outbuf;
+ clen=p-outbuf;
outbuf[IDX_SEQLEN-1] =(unsigned char)(clen >> 16);
outbuf[IDX_SEQLEN] =(unsigned char)(clen >> 8);
outbuf[IDX_SEQLEN+1]=(unsigned char)(clen & 0xFF);
@@ -554,14 +546,13 @@ static int print_cols(FILE *prn_stream,gx_device_printer *pdev,
return 0;
}
-
/*** THIS NEED TO BE REWORKED SOON - END ***/
/* Send the page to the printer. */
/* Lexmark generic print page routine */
static int
lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
-{
+{
int pheight=pdev->height; /* page height (pixels) */
#ifdef DEBUG
int pwidth=pdev->width; /* page width (pixels) */
@@ -577,9 +568,9 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
byte *pbuf; /* printer buffer - dynamic allocation */
byte *ppbuf,*ppbuf2; /* pointer returned by _prn_get_bits() */
byte *outbuf; /* output buffer - used by print_cols(),
- * but allocated here, to avoid unnecessary
- * de & allocation
- */
+ * but allocated here, to avoid unnecessary
+ * de & allocation
+ */
int pbufsize,rpbufsize; /* printer buffer size */
int hres,vres;
int interlaced;
@@ -617,7 +608,7 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
dprintf1("One pass buffer size %d\n",pbufsize);
dprintf1("Output buffer size %d\n",OUT_BUF_SIZE);
dprintf2("Current resolution is %f width x %f height dpi\n",
- pdev->x_pixels_per_inch, pdev->y_pixels_per_inch );
+ pdev->x_pixels_per_inch, pdev->y_pixels_per_inch );
#endif
pbuf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), rpbufsize, 1, "lxmgen_print_page(pbuf)");
if (pbuf == NULL)
@@ -635,7 +626,6 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* zero fake line (used for non-interlaced resolutions etc)...*/
memset(pbuf+pbufsize,0,bwidth);
-
/* initiate hres mapping variable */
hres=LXR_600; /* default horizontal resolution */
if (pdev->x_pixels_per_inch<301.0)
@@ -661,36 +651,31 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
dprintf1("Choosed motor speed %d\n",(int)outbuf[IDX_HORRES]);
#endif
-
if(vres==LXR_600)
{
int i;
for(i=0;i<LX7_BSW_H;i++)
- obp[i]=pbuf+(i*bwidth);
+ obp[i]=pbuf+(i*bwidth);
}
if(vres==LXR_300)
{
int i;
for(i=0;i<LX7_BSW_H;i++)
- if ( (i & 1)!=0)
- obp[i]=pbuf+pbufsize; /* odd line is empty for 300dpi */
- else
- obp[i]=pbuf+(i/2*bwidth);
+ if ( (i & 1)!=0)
+ obp[i]=pbuf+pbufsize; /* odd line is empty for 300dpi */
+ else
+ obp[i]=pbuf+(i/2*bwidth);
}
-
-
-
if(gdev_prn_file_is_new(pdev))
fwrite(((lxm_device*)pdev)->fullInit,
- ((lxm_device*)pdev)->nfullInit,
- 1,prn_stream);
+ ((lxm_device*)pdev)->nfullInit,
+ 1,prn_stream);
else
fwrite(((lxm_device*)pdev)->pageInit,
- ((lxm_device*)pdev)->npageInit,
- 1,prn_stream);
-
+ ((lxm_device*)pdev)->npageInit,
+ 1,prn_stream);
while(prest>0)
{
@@ -701,103 +686,102 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* copy one line & test for all zeroes */
gdev_prn_get_bits(pdev, pheight-prest, /* current line No. */
- pbuf, /* our buffer if needed */
- &ppbuf); /* returns pointer to scanline
- * either our buffer or
- * gs internal data buffer
- */
+ pbuf, /* our buffer if needed */
+ &ppbuf); /* returns pointer to scanline
+ * either our buffer or
+ * gs internal data buffer
+ */
if (vres==LXR_1200 && (pheight-prest+LXH_DSKIP1<pheight))
{
- gdev_prn_get_bits(pdev, pheight-prest+LXH_DSKIP1,
- /* current line No. */
- pbuf+bwidth, /* our buffer if needed */
- &ppbuf2);
+ gdev_prn_get_bits(pdev, pheight-prest+LXH_DSKIP1,
+ /* current line No. */
+ pbuf+bwidth, /* our buffer if needed */
+ &ppbuf2);
c1200=LX_LINE_EMPTY(ppbuf2,bwidth);
}
- else
- c1200=1;
+ else
+ c1200=1;
/* test for empty line (nice Stephen's trick w/ memcmp() :-) */
- if (LX_LINE_EMPTY(ppbuf,bwidth) && c1200)
+ if (LX_LINE_EMPTY(ppbuf,bwidth) && c1200)
{ /* line empty */
- prest--;
- skipline++;
- continue; /* Loop thgrough the while(prest>0) ... */
- }
+ prest--;
+ skipline++;
+ continue; /* Loop thgrough the while(prest>0) ... */
+ }
/* 1pass printing for 300 & 600 dpi */
/* 2pass printing for 1200dpi */
for(i=0;i<(vres==LXR_1200 ? 2 : 1);i++)
{
- /* skip empty lines on paper, if any */
- if (skipline>0)
- {
- int mult[3]={4,2,1}; /* multiply: 300dpi=4, 600dpi=2, 1200dpi=1 */
- paper_shift(prn_stream,skipline*mult[vres]);
- skipline=0;
- }
-
- /* for 1200dpi we need to setup interlaced buffer entries */
- if (vres==LXR_1200)
- {
- int j;
- for(j=0;j<LX7_BSW_H;j++)
- if ( (j & 1)!=i) /* i==0 for 1st pass i==1 for 2nd pass */
- obp[j]=pbuf+pbufsize; /* "odd" line is empty for 300dpi */
- else
- obp[j]=pbuf+(j*2*bwidth);
- }
-
-
- /* copy remaining lines to buffer */
- brest=MIN(bufHeight,prest);
+ /* skip empty lines on paper, if any */
+ if (skipline>0)
+ {
+ int mult[3]={4,2,1}; /* multiply: 300dpi=4, 600dpi=2, 1200dpi=1 */
+ paper_shift(prn_stream,skipline*mult[vres]);
+ skipline=0;
+ }
+
+ /* for 1200dpi we need to setup interlaced buffer entries */
+ if (vres==LXR_1200)
+ {
+ int j;
+ for(j=0;j<LX7_BSW_H;j++)
+ if ( (j & 1)!=i) /* i==0 for 1st pass i==1 for 2nd pass */
+ obp[j]=pbuf+pbufsize; /* "odd" line is empty for 300dpi */
+ else
+ obp[j]=pbuf+(j*2*bwidth);
+ }
+
+ /* copy remaining lines to buffer */
+ brest=MIN(bufHeight,prest);
#ifdef DEBUG
- dprintf2("Copying %d lines to buffer, vertpos %d\n",brest,
- pheight-prest);
+ dprintf2("Copying %d lines to buffer, vertpos %d\n",brest,
+ pheight-prest);
#endif
- gdev_prn_copy_scan_lines(pdev,pheight-prest,pbuf,pbufsize);
- /* zero unused lines (on bottom of page) */
- if (bufHeight-brest>0)
- memset(pbuf+(brest*bwidth),0,(bufHeight-brest)*bwidth);
-
- /* look for leftmost and rightmost pixels */
- find_lr_pixels(obp,bwidth,LX7_BSW_H,interlaced,
- ((lxm_device*)pdev)->headSeparation,
- &leftmost,&rightmost);
+ gdev_prn_copy_scan_lines(pdev,pheight-prest,pbuf,pbufsize);
+ /* zero unused lines (on bottom of page) */
+ if (bufHeight-brest>0)
+ memset(pbuf+(brest*bwidth),0,(bufHeight-brest)*bwidth);
+
+ /* look for leftmost and rightmost pixels */
+ find_lr_pixels(obp,bwidth,LX7_BSW_H,interlaced,
+ ((lxm_device*)pdev)->headSeparation,
+ &leftmost,&rightmost);
#ifdef DEBUG
- dprintf2("Leftmost pixel %d, rightmost pixel %d\n",
- leftmost,rightmost);
+ dprintf2("Leftmost pixel %d, rightmost pixel %d\n",
+ leftmost,rightmost);
#endif
- /* print the data */
- if (leftmost<rightmost)
- if (print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,
- 0,VERTSIZE/2,obp,bwidth,lr_shift)==-1)
- {
- print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,0,
- VERTSIZE/4,obp,bwidth,lr_shift);
+ /* print the data */
+ if (leftmost<rightmost)
+ if (print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,
+ 0,VERTSIZE/2,obp,bwidth,lr_shift)==-1)
+ {
+ print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,0,
+ VERTSIZE/4,obp,bwidth,lr_shift);
- print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,
- VERTSIZE/4,VERTSIZE/2,
- obp,bwidth,lr_shift);
+ print_cols(prn_stream,pdev,outbuf,leftmost,rightmost,
+ VERTSIZE/4,VERTSIZE/2,
+ obp,bwidth,lr_shift);
#ifdef DEBUG
- dprintf("Overflow workaround used\n");
+ dprintf("Overflow workaround used\n");
#endif
- }
-
- if (vres!=LXR_1200)
- {
- skipline=brest; /* skip already printed lines */
- }
- else
- {
- skipline+=( i==0 ? LXH_DSKIP1 : LXH_DSKIP2 );
- }
- prest-=skipline; /* decrease number of remaining lines */
- if (prest<=0)
- break;
+ }
+
+ if (vres!=LXR_1200)
+ {
+ skipline=brest; /* skip already printed lines */
+ }
+ else
+ {
+ skipline+=( i==0 ? LXH_DSKIP1 : LXH_DSKIP2 );
+ }
+ prest-=skipline; /* decrease number of remaining lines */
+ if (prest<=0)
+ break;
}
}
@@ -814,15 +798,15 @@ lxmgen_print_page(gx_device_printer *pdev, FILE *prn_stream)
static int
lxm_get_params(gx_device *pdev, gs_param_list *plist)
-{
+{
lxm_device* const ldev = (lxm_device*)pdev;
int code = gdev_prn_get_params(pdev, plist);
if ( code < 0 ) return code;
- code = param_write_int(plist,
- "HeadSeparation",
- (int *)&(ldev->headSeparation));
-
+ code = param_write_int(plist,
+ "HeadSeparation",
+ (int *)&(ldev->headSeparation));
+
return code;
}
@@ -836,7 +820,7 @@ lxm_put_params(gx_device *pdev, gs_param_list *plist)
int code = param_read_int(plist, "HeadSeparation", &trialHeadSeparation);
if ( trialHeadSeparation < 1 || trialHeadSeparation > 32 )
- param_signal_error(plist, "HeadSeparation", gs_error_rangecheck);
+ param_signal_error(plist, "HeadSeparation", gs_error_rangecheck);
/* looks like param_signal_error is not expected to return */
ecode = gdev_prn_put_params(pdev, plist); /* call super class put_params */
if ( code < 0 ) return code;
@@ -847,4 +831,3 @@ lxm_put_params(gx_device *pdev, gs_param_list *plist)
if ( code == 1) return ecode; /* I guess this means there is no "HeadSeparation" parameter */
return 0;
}
-
diff --git a/gs/contrib/gdevmd2k.c b/gs/contrib/gdevmd2k.c
index 53957efb2..7a186a02a 100644
--- a/gs/contrib/gdevmd2k.c
+++ b/gs/contrib/gdevmd2k.c
@@ -1,13 +1,13 @@
/* Copyright (C) 1991, 1995-1999 Aladdin Enterprises. All rights reserved.
-
+
This file is part of Aladdin Ghostscript.
-
+
Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing. Refer to the Aladdin Ghostscript Free Public
License (the "License") for full details.
-
+
Every copy of Aladdin Ghostscript must include a copy of the License,
normally in a plain ASCII text file named PUBLIC. The License grants you
the right to copy, modify and redistribute Aladdin Ghostscript, but only
@@ -45,7 +45,6 @@ static dev_proc_map_cmyk_color(alps_map_cmy_color);
static dev_proc_map_rgb_color(alps_map_rgb_color);
static dev_proc_map_color_rgb(alps_map_color_rgb);
-
struct gx_device_alps_s {
gx_device_common;
gx_prn_device_common;
@@ -91,10 +90,10 @@ static gx_device_procs alps_procs = {
#define alps_device(dname, print_page) \
{\
prn_device_body(gx_device_alps, alps_procs, dname,\
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
- 600, 600,\
- 0, 0, 0, 0, /* margin */\
- 4, 0, 0, 0, 0, 0, print_page),\
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,\
+ 600, 600,\
+ 0, 0, 0, 0, /* margin */\
+ 4, 0, 0, 0, 0, 0, print_page),\
true, false, false, false, false, 0, 1024, 1024, 1024, 1024\
}
@@ -108,17 +107,16 @@ typedef enum {
MD5000
} alps_printer_type;
-
static int
alps_open(gx_device *pdev)
{
int xdpi = pdev->x_pixels_per_inch;
int ydpi = pdev->y_pixels_per_inch;
const float margins[4] = {
- LEFT_MARGIN,
- BOTTOM_MARGIN,
- RIGHT_MARGIN,
- TOP_MARGIN
+ LEFT_MARGIN,
+ BOTTOM_MARGIN,
+ RIGHT_MARGIN,
+ TOP_MARGIN
};
float density;
@@ -128,7 +126,7 @@ alps_open(gx_device *pdev)
if ((ydpi != 300 || xdpi != 300)
&& (ydpi != 600 || xdpi != 600)
&& (ydpi != 600 || xdpi != 1200))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
density = (xdpi == 300 ? 0.75 : xdpi == 600 ? 0.44 : 0.4);
dev_alps->cyan *= density;
@@ -139,62 +137,61 @@ alps_open(gx_device *pdev)
return gdev_prn_open(pdev);
}
-
static int
alps_get_params(gx_device *pdev, gs_param_list *plist)
{
gs_param_string mediaType = { "", 1, false };
int code = gdev_prn_get_params(pdev, plist);
if (code < 0 ||
- (code = param_write_bool(plist, "Color", &dev_alps->color)) < 0 ||
- (code = param_write_bool(plist, "Dither", &dev_alps->dither)) < 0 ||
- (code = param_write_bool(plist, "ManualFeed",
- &dev_alps->manualFeed)) < 0 ||
- (code = param_write_bool(plist, "ReverseSide",
- &dev_alps->reverseSide)) < 0 ||
- (code = param_write_bool(plist, "EcoBlack",
- &dev_alps->ecoBlack)) < 0 ||
- (code = param_write_int (plist, "Cyan", &dev_alps->cyan)) < 0 ||
- (code = param_write_int (plist, "Magenta", &dev_alps->magenta)) < 0 ||
- (code = param_write_int (plist, "Yellow", &dev_alps->yellow)) < 0 ||
- (code = param_write_int (plist, "Black", &dev_alps->black)) < 0 ||
- (code = param_write_string(plist, "MediaType", &mediaType)) < 0)
- return code;
+ (code = param_write_bool(plist, "Color", &dev_alps->color)) < 0 ||
+ (code = param_write_bool(plist, "Dither", &dev_alps->dither)) < 0 ||
+ (code = param_write_bool(plist, "ManualFeed",
+ &dev_alps->manualFeed)) < 0 ||
+ (code = param_write_bool(plist, "ReverseSide",
+ &dev_alps->reverseSide)) < 0 ||
+ (code = param_write_bool(plist, "EcoBlack",
+ &dev_alps->ecoBlack)) < 0 ||
+ (code = param_write_int (plist, "Cyan", &dev_alps->cyan)) < 0 ||
+ (code = param_write_int (plist, "Magenta", &dev_alps->magenta)) < 0 ||
+ (code = param_write_int (plist, "Yellow", &dev_alps->yellow)) < 0 ||
+ (code = param_write_int (plist, "Black", &dev_alps->black)) < 0 ||
+ (code = param_write_string(plist, "MediaType", &mediaType)) < 0)
+ return code;
return code;
}
static int
alps_put_param_bool(gs_param_list *plist, gs_param_name pname, int *pvalue,
- int ecode)
+ int ecode)
{
int code, value;
switch (code = param_read_bool(plist, pname, &value)) {
default:
- return code;
+ return code;
case 1:
- return ecode;
+ return ecode;
case 0:
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
}
}
static int
alps_put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue,
- int minval, int maxval, int ecode)
+ int minval, int maxval, int ecode)
{
int code, value;
switch (code = param_read_int(plist, pname, &value)) {
default:
- return code;
+ return code;
case 1:
- return ecode;
+ return ecode;
case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
+ if (value < minval || value > maxval)
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
}
}
@@ -228,34 +225,34 @@ alps_put_params(gx_device *pdev, gs_param_list *plist)
#define mediaTypeCmp(mname) strncmp(mediaType.data, mname, mediaType.size)
if (param_read_string(plist, "MediaType", &mediaType) == 0) {
- dev_alps->mediaType
- = (! mediaTypeCmp("PlainPaper" ) ? 0
- : ! mediaTypeCmp("OHP_MD2000" ) ? 1
- : ! mediaTypeCmp("IronSeal" ) ? 2
- : ! mediaTypeCmp("RebecaFree" ) ? 3
- : ! mediaTypeCmp("CardBoard" ) ? 5
- : ! mediaTypeCmp("PostCard" ) ? 6
- : ! mediaTypeCmp("FinePaper" ) ? 7
- : ! mediaTypeCmp("CoatedFilm" ) ? 9
- : ! mediaTypeCmp("GlossyPaper" ) ? 15
- : ! mediaTypeCmp("TransparencyFilm") ? 0x108
- : ! mediaTypeCmp("OHP" ) ? 0x108 : -1);
- switch (dev_alps->mediaType) {
- case -1:
- param_signal_error(plist, "MediaType", code = gs_error_rangecheck);
- break;
- case 1: /* MD-2000 transparency mode */
- dev_proc(pdev, map_cmyk_color) = alps_map_cmy_color;
- break;
- case 6: /* hagaki */
- pdev->MediaSize[0] = 284;
- pdev->MediaSize[1] = 419;
- default:
- break;
- }
+ dev_alps->mediaType
+ = (! mediaTypeCmp("PlainPaper" ) ? 0
+ : ! mediaTypeCmp("OHP_MD2000" ) ? 1
+ : ! mediaTypeCmp("IronSeal" ) ? 2
+ : ! mediaTypeCmp("RebecaFree" ) ? 3
+ : ! mediaTypeCmp("CardBoard" ) ? 5
+ : ! mediaTypeCmp("PostCard" ) ? 6
+ : ! mediaTypeCmp("FinePaper" ) ? 7
+ : ! mediaTypeCmp("CoatedFilm" ) ? 9
+ : ! mediaTypeCmp("GlossyPaper" ) ? 15
+ : ! mediaTypeCmp("TransparencyFilm") ? 0x108
+ : ! mediaTypeCmp("OHP" ) ? 0x108 : -1);
+ switch (dev_alps->mediaType) {
+ case -1:
+ param_signal_error(plist, "MediaType", code = gs_error_rangecheck);
+ break;
+ case 1: /* MD-2000 transparency mode */
+ dev_proc(pdev, map_cmyk_color) = alps_map_cmy_color;
+ break;
+ case 6: /* hagaki */
+ pdev->MediaSize[0] = 284;
+ pdev->MediaSize[1] = 419;
+ default:
+ break;
+ }
}
if (code < 0)
- return code;
+ return code;
dev_alps->color = color;
dev_alps->dither = dither;
@@ -268,16 +265,16 @@ alps_put_params(gx_device *pdev, gs_param_list *plist)
dev_alps->black = black;
if (bpp)
- /* Only valid bits-per-pixel are 1, 4, 8, 32 */
- bpp = (bpp < 4 ? 1 : bpp < 8 ? 4 : bpp > 8 ? 32 : 8);
+ /* Only valid bits-per-pixel are 1, 4, 8, 32 */
+ bpp = (bpp < 4 ? 1 : bpp < 8 ? 4 : bpp > 8 ? 32 : 8);
else
- bpp = (color ? 4 : 1) * (dither ? 8 : 1);
-
+ bpp = (color ? 4 : 1) * (dither ? 8 : 1);
+
if (ecoBlack && ! strcmp(pdev->dname, "md5k"))
- bpp = 1;
+ bpp = 1;
if (bpp == 1 || bpp == 8)
- dev_proc(pdev, map_rgb_color) = alps_map_rgb_color;
+ dev_proc(pdev, map_rgb_color) = alps_map_rgb_color;
pdev->color_info.depth = bpp;
pdev->color_info.num_components = (bpp == 1 || bpp == 8 ? 1 : 4);
@@ -290,7 +287,6 @@ alps_put_params(gx_device *pdev, gs_param_list *plist)
return 0;
}
-
/*
* these F/S dithering macros are based on gdevcdj.c
*/
@@ -315,8 +311,8 @@ alps_put_params(gx_device *pdev, gs_param_list *plist)
Err = (*errP + ((Err * 7 + C) >> 4) + (*inP << SHIFT));\
inP += Offset;\
if (Err > THRESHOLD) {\
- out |= Bit;\
- Err -= MAXVALUE;\
+ out |= Bit;\
+ Err -= MAXVALUE;\
}\
errP[-Offset] += ((Err * 3 + C) >> 4);\
*errP++ = ((Err * 5 + oldErr + C) >> 4);
@@ -330,8 +326,8 @@ alps_put_params(gx_device *pdev, gs_param_list *plist)
for (c = j = 0; j < 8; j++) {\
FSdither(dp, c, ep, Err, bitmask, n);\
bitmask >>= 1;\
- }\
- *outP++ = c;\
+ }\
+ *outP++ = c;\
}\
}
/* END MACROS FOR DITHERING */
@@ -351,22 +347,21 @@ cmyk_to_bit(byte *out, byte *in, int length, int c_comp)
mask2 = mask1 >> 4;
while(p_in < p_end) {
- int i;
-
- out_data = 0;
- for(i = 0; i < 4; i ++) {
- in_data = (p_in < p_end ? *p_in++ : 0);
- out_data <<= 2;
- out_data |= (in_data & mask1) >> (6-c_comp)
- | (in_data & mask2) >> (3-c_comp);
- }
- *p_out ++ = out_data;
+ int i;
+
+ out_data = 0;
+ for(i = 0; i < 4; i ++) {
+ in_data = (p_in < p_end ? *p_in++ : 0);
+ out_data <<= 2;
+ out_data |= (in_data & mask1) >> (6-c_comp)
+ | (in_data & mask2) >> (3-c_comp);
+ }
+ *p_out ++ = out_data;
}
return p_out - out;
}
-
/*
* run-length compression
*/
@@ -379,35 +374,34 @@ runlength(byte *out, byte *in, int length)
p_end = p_in + length;
while(p_in < p_end) {
- /* loop until 3 same data found */
- count = 0;
- climit = min(128, p_end - p_in);
- for( ; count < climit; count++, p_in ++) {
- contflag = (*p_in == *(p_in+1) && *p_in == *(p_in+2));
- if (contflag)
- break;
- }
- if (count > 0) {
- *p_out ++ = count - 1;
- memcpy(p_out, p_in - count, count);
- p_out += count;
- }
-
- if (contflag) {
- climit = min(129, p_end - p_in);
- p_in += 3;
- count = 3;
- for( ; count < climit && *(p_in-1) == *p_in; count++, p_in++);
-
- *p_out ++ = (byte) (0x101 - count);
- *p_out ++ = *(p_in-1);
- }
+ /* loop until 3 same data found */
+ count = 0;
+ climit = min(128, p_end - p_in);
+ for( ; count < climit; count++, p_in ++) {
+ contflag = (*p_in == *(p_in+1) && *p_in == *(p_in+2));
+ if (contflag)
+ break;
+ }
+ if (count > 0) {
+ *p_out ++ = count - 1;
+ memcpy(p_out, p_in - count, count);
+ p_out += count;
+ }
+
+ if (contflag) {
+ climit = min(129, p_end - p_in);
+ p_in += 3;
+ count = 3;
+ for( ; count < climit && *(p_in-1) == *p_in; count++, p_in++);
+
+ *p_out ++ = (byte) (0x101 - count);
+ *p_out ++ = *(p_in-1);
+ }
}
return p_out - out;
}
-
#define write_short(data, stream) { \
fputc((unsigned char) (data), stream); \
fputc((unsigned short) (data) >> 8, stream); \
@@ -423,32 +417,32 @@ static void
alps_init(gx_device_printer *pdev, FILE *prn_stream, alps_printer_type ptype)
{
short height; /* page height (unit: dots) */
-
+
fwrite ("\033\145"
- "\033\045\200\101"
- "\033\032\0\0\114", 1, 11, prn_stream);
+ "\033\045\200\101"
+ "\033\032\0\0\114", 1, 11, prn_stream);
/* paper feed (auto=1, manual=2) */
alps_cmd("\033\046\154", (dev_alps->manualFeed ? 2 : 1), 0110, prn_stream);
/* media type */
alps_cmd("\033\046\154", dev_alps->mediaType, 0115, prn_stream);
-
+
/* paper size */
alps_cmd("\033\046\154", (pdev->MediaSize[0] == 612) ? 2 : /* letter */
- (pdev->MediaSize[0] >= 595 &&
- pdev->MediaSize[0] <= 598) ? 4 : /* A4 */
- (pdev->MediaSize[0] == 516 ||
- pdev->MediaSize[0] == 501) ? 5 : /* B5 */
- (pdev->MediaSize[0] == 284) ? 6 : 0, /* hagaki */
- 0101, prn_stream);
+ (pdev->MediaSize[0] >= 595 &&
+ pdev->MediaSize[0] <= 598) ? 4 : /* A4 */
+ (pdev->MediaSize[0] == 516 ||
+ pdev->MediaSize[0] == 501) ? 5 : /* B5 */
+ (pdev->MediaSize[0] == 284) ? 6 : 0, /* hagaki */
+ 0101, prn_stream);
/* monocrome=0, eco black=1, CMYK=4, CMYK(MD-5000)=8 */
fwrite("\033\052\162", 1, 3, prn_stream);
fputc((dev_alps->mediaType == 1 ? 4 :
- pdev->color_info.num_components == 1 ? dev_alps->ecoBlack ? 1 : 0
- : ptype == MD5000 ? 8 : 4),
- prn_stream);
+ pdev->color_info.num_components == 1 ? dev_alps->ecoBlack ? 1 : 0
+ : ptype == MD5000 ? 8 : 4),
+ prn_stream);
fputc(0125, prn_stream);
-
+
/* set resolution (300dpi = 2, 600dpi = 3, 1200x600dpi = 4) */
fwrite("\033\052\164", 1, 3, prn_stream);
fputc((pdev->x_pixels_per_inch == 300 ? 2
@@ -456,7 +450,7 @@ alps_init(gx_device_printer *pdev, FILE *prn_stream, alps_printer_type ptype)
fputc(0122, prn_stream);
height = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3])
- * pdev->y_pixels_per_inch / 72.;
+ * pdev->y_pixels_per_inch / 72.;
alps_cmd("\033\046\154", height, 0120, prn_stream);
/* if -dReverseSide ... */
@@ -465,26 +459,26 @@ alps_init(gx_device_printer *pdev, FILE *prn_stream, alps_printer_type ptype)
fwrite("\0\101", 1, 2, prn_stream);
if (ptype == MD5000) {
- if (dev_alps->ecoBlack) {
- fwrite("\033\032\001\0\103", 1, 5, prn_stream);
- fwrite("\033\046\154\001\0\103\027", 1, 7, prn_stream);
- } else if (pdev->color_info.num_components == 1)
- fwrite("\033\046\154\001\0\103\0", 1, 7, prn_stream);
- else
- fwrite("\033\046\154\004\0\103\003\002\001\0", 1, 10, prn_stream);
- fwrite("\033\032\0\0\125", 1, 5, prn_stream);
- fwrite("\033\052\162\1\101", 1, 5, prn_stream);
- fwrite("\033\052\142\0\0\115", 1, 6, prn_stream);
+ if (dev_alps->ecoBlack) {
+ fwrite("\033\032\001\0\103", 1, 5, prn_stream);
+ fwrite("\033\046\154\001\0\103\027", 1, 7, prn_stream);
+ } else if (pdev->color_info.num_components == 1)
+ fwrite("\033\046\154\001\0\103\0", 1, 7, prn_stream);
+ else
+ fwrite("\033\046\154\004\0\103\003\002\001\0", 1, 10, prn_stream);
+ fwrite("\033\032\0\0\125", 1, 5, prn_stream);
+ fwrite("\033\052\162\1\101", 1, 5, prn_stream);
+ fwrite("\033\052\142\0\0\115", 1, 6, prn_stream);
} else {
- fwrite("\033\052\162\0\101", 1, 5, prn_stream);
- fwrite("\033\052\142\2\0\115", 1, 6, prn_stream);
+ fwrite("\033\052\162\0\101", 1, 5, prn_stream);
+ fwrite("\033\052\142\2\0\115", 1, 6, prn_stream);
}
}
/* Send the page to the printer. */
static int
alps_print_page(gx_device_printer *pdev, FILE *prn_stream,
- alps_printer_type ptype)
+ alps_printer_type ptype)
{
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
byte *in, *out, *work, *dp, *outP;
@@ -496,106 +490,106 @@ alps_print_page(gx_device_printer *pdev, FILE *prn_stream,
/* allocate memory */
work = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 3+sizeof(int), line_size,
- "alps_print_page(work)");
+ "alps_print_page(work)");
if (work == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
in = work + line_size;
out = in + line_size;
error = (int *)(out + line_size);
/* initialize printer */
alps_init(pdev, prn_stream, ptype);
-
+
for(c_comp = 0; c_comp < n_comp; c_comp ++) {
- int yskip = 0;
- int color_weight;
-
- for(i = 0; i < line_size; i ++)
- error[i] = RANDOM();
-
- if (n_comp == 1)
- color_weight = dev_alps->black;
- else
- color_weight = (c_comp < 2
- ? c_comp == 0 ? dev_alps->cyan : dev_alps->magenta
- : c_comp == 2 ? dev_alps->yellow : dev_alps->black);
-
- /* select color (black=0, cyan=1, magenta=2, yellow=3,
- gold=4, metalic red=5, metalic blue=6, silver=7,
- rebeca black=8, rebeca red=9, rebeca blue=10,
- white=11, glossy=14) */
- fwrite("\033\032", 1, 2, prn_stream);
- fputc((n_comp == 1 ? dev_alps->ecoBlack ? 026 : 0 : (c_comp+1) % 4),
- prn_stream);
- fputc((c_comp == n_comp-1 && ptype == MD5000 ? 0200 : 0),
- prn_stream);
- fputc(0162, prn_stream);
-
- for(y = 0; y < y_height; y ++) {
- uint len = line_size;
-
- gdev_prn_get_bits(pdev, y, in, &dp);
-
- switch (pdev->color_info.depth) {
- case 4:
- /* get a component of CMYK from raster data */
- len = cmyk_to_bit(work, dp, len, c_comp);
- dp = work;
- case 1:
- /* remove trailing 0s */
- for( ; len > 0 && dp[len-1] == 0; len --);
- break;
- case 32:
- dp += c_comp;
- case 8:
- outP = work;
- ep = error;
-
- /* remove trailing 0s */
- for( ; len > 0 && dp[len-num_comp] == 0; len -= num_comp);
-
- for(i = 0; i < len; i += num_comp)
- dp[i] = (dp[i] * color_weight) >> 10;
- len = (len / num_comp + 7) >> 3;
-
- FSDline(i, j, len, outP, num_comp);
- dp = work;
- break;
- }
-
- if (len == 0)
- yskip ++;
- else {
- if (yskip) {
- alps_cmd("\033\052\142", yskip, 0131, prn_stream);
- yskip = 0;
- }
- if (ptype == MD5000) {
- int xskip = 0;
-
- /* Count pre print skip octets */
- for( ; len > 0 && *dp == 0; len --, dp ++, xskip ++);
-
- alps_cmd("\033\052\142", len, 0124, prn_stream);
- write_short(xskip, prn_stream);
- fwrite(dp, 1, len, prn_stream);
- } else {
- len = runlength(out, dp, len);
- alps_cmd("\033\052\142", len, 0127, prn_stream);
- fwrite(out, 1, len, prn_stream);
- }
- }
- }
-
- /* rewind */
- if (c_comp + 1 < n_comp)
- fwrite("\033\032\0\0\014", 1, 5, prn_stream);
+ int yskip = 0;
+ int color_weight;
+
+ for(i = 0; i < line_size; i ++)
+ error[i] = RANDOM();
+
+ if (n_comp == 1)
+ color_weight = dev_alps->black;
+ else
+ color_weight = (c_comp < 2
+ ? c_comp == 0 ? dev_alps->cyan : dev_alps->magenta
+ : c_comp == 2 ? dev_alps->yellow : dev_alps->black);
+
+ /* select color (black=0, cyan=1, magenta=2, yellow=3,
+ gold=4, metalic red=5, metalic blue=6, silver=7,
+ rebeca black=8, rebeca red=9, rebeca blue=10,
+ white=11, glossy=14) */
+ fwrite("\033\032", 1, 2, prn_stream);
+ fputc((n_comp == 1 ? dev_alps->ecoBlack ? 026 : 0 : (c_comp+1) % 4),
+ prn_stream);
+ fputc((c_comp == n_comp-1 && ptype == MD5000 ? 0200 : 0),
+ prn_stream);
+ fputc(0162, prn_stream);
+
+ for(y = 0; y < y_height; y ++) {
+ uint len = line_size;
+
+ gdev_prn_get_bits(pdev, y, in, &dp);
+
+ switch (pdev->color_info.depth) {
+ case 4:
+ /* get a component of CMYK from raster data */
+ len = cmyk_to_bit(work, dp, len, c_comp);
+ dp = work;
+ case 1:
+ /* remove trailing 0s */
+ for( ; len > 0 && dp[len-1] == 0; len --);
+ break;
+ case 32:
+ dp += c_comp;
+ case 8:
+ outP = work;
+ ep = error;
+
+ /* remove trailing 0s */
+ for( ; len > 0 && dp[len-num_comp] == 0; len -= num_comp);
+
+ for(i = 0; i < len; i += num_comp)
+ dp[i] = (dp[i] * color_weight) >> 10;
+ len = (len / num_comp + 7) >> 3;
+
+ FSDline(i, j, len, outP, num_comp);
+ dp = work;
+ break;
+ }
+
+ if (len == 0)
+ yskip ++;
+ else {
+ if (yskip) {
+ alps_cmd("\033\052\142", yskip, 0131, prn_stream);
+ yskip = 0;
+ }
+ if (ptype == MD5000) {
+ int xskip = 0;
+
+ /* Count pre print skip octets */
+ for( ; len > 0 && *dp == 0; len --, dp ++, xskip ++);
+
+ alps_cmd("\033\052\142", len, 0124, prn_stream);
+ write_short(xskip, prn_stream);
+ fwrite(dp, 1, len, prn_stream);
+ } else {
+ len = runlength(out, dp, len);
+ alps_cmd("\033\052\142", len, 0127, prn_stream);
+ fwrite(out, 1, len, prn_stream);
+ }
+ }
+ }
+
+ /* rewind */
+ if (c_comp + 1 < n_comp)
+ fwrite("\033\032\0\0\014", 1, 5, prn_stream);
}
-
+
/* end of print */
fwrite("\014"
- "\033\052\162\103"
- "\033\045\0\130", 1, 9, prn_stream);
+ "\033\052\162\103"
+ "\033\045\0\130", 1, 9, prn_stream);
gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)work, 3+sizeof(int), line_size, "alps_print_page(work)");
return 0;
@@ -613,7 +607,6 @@ md5k_print_page(gx_device_printer *pdev, FILE *prn_stream)
return alps_print_page(pdev, prn_stream, MD5000);
}
-
/* functions below are mainly based on gdevcdj.c */
/*
* Map a CMYK color to a color index. We just use depth / 4 bits per color
@@ -639,7 +632,7 @@ md5k_print_page(gx_device_printer *pdev, FILE *prn_stream)
static gx_color_index
alps_map_cmyk_color(gx_device* pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_index color;
gx_color_value c, m, y, k;
@@ -647,28 +640,28 @@ alps_map_cmyk_color(gx_device* pdev,
c = cv[0]; m = cv[1]; y = cv[2]; k = cv[3];
switch (pdev->color_info.depth) {
case 1:
- color = ((c | m | y | k) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0);
- break;
+ color = ((c | m | y | k) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0);
+ break;
default:
{
- int nbits = pdev->color_info.depth;
- ulong weight;
-
- ulong black = (c <= y ? c <= m ? c : m : m <= y ? m : y);
- weight = (black < gx_max_color_value
- ? (gx_max_color_value << 10) / (gx_max_color_value - black)
- : 0);
- c = ((c - black) * weight) >> 10;
- m = ((m - black) * weight) >> 10;
- y = ((y - black) * weight) >> 10;
-
- black += k;
- k = (gx_color_index) (black <= gx_max_color_value
- ? black : gx_max_color_value);
-
- color = gx_cmyk_value_bits(c, m, y, k, nbits >> 2);
+ int nbits = pdev->color_info.depth;
+ ulong weight;
+
+ ulong black = (c <= y ? c <= m ? c : m : m <= y ? m : y);
+ weight = (black < gx_max_color_value
+ ? (gx_max_color_value << 10) / (gx_max_color_value - black)
+ : 0);
+ c = ((c - black) * weight) >> 10;
+ m = ((m - black) * weight) >> 10;
+ y = ((y - black) * weight) >> 10;
+
+ black += k;
+ k = (gx_color_index) (black <= gx_max_color_value
+ ? black : gx_max_color_value);
+
+ color = gx_cmyk_value_bits(c, m, y, k, nbits >> 2);
}
}
@@ -677,7 +670,7 @@ alps_map_cmyk_color(gx_device* pdev,
static gx_color_index
alps_map_cmy_color(gx_device* pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
int nbits = pdev->color_info.depth;
gx_color_value c = cv[0], m = cv[1], y = cv[2], k = cv[3];
@@ -696,7 +689,7 @@ alps_map_cmy_color(gx_device* pdev,
static gx_color_index
alps_map_rgb_color(gx_device *pdev,
- const gx_color_value cv[])
+ const gx_color_value cv[])
{
gx_color_value r, g, b;
@@ -710,19 +703,19 @@ alps_map_rgb_color(gx_device *pdev,
switch (pdev->color_info.depth) {
case 1:
- return ((c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0);
- break;
+ return ((c | m | y) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0);
+ break;
case 8:
#define red_weight 306
#define green_weight 601
#define blue_weight 117
- return ((ulong)c * red_weight
- + (ulong)m * green_weight
- + (ulong)y * blue_weight)
- >> (gx_color_value_bits + 2);
- break;
+ return ((ulong)c * red_weight
+ + (ulong)m * green_weight
+ + (ulong)y * blue_weight)
+ >> (gx_color_value_bits + 2);
+ break;
}
}
@@ -733,56 +726,56 @@ alps_map_rgb_color(gx_device *pdev,
static int
alps_map_color_rgb(gx_device *pdev,
- gx_color_index color, gx_color_value prgb[3])
+ gx_color_index color, gx_color_value prgb[3])
{
switch (pdev->color_info.depth) {
case 1:
- prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
- break;
+ prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
+ break;
case 8:
- if (pdev->color_info.num_components == 1) {
- gx_color_value value = (gx_color_value) color ^ 0xff;
+ if (pdev->color_info.num_components == 1) {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- break;
- }
+ break;
+ }
default:
{
- unsigned long bcyan, bmagenta, byellow, black;
- int nbits = pdev->color_info.depth;
+ unsigned long bcyan, bmagenta, byellow, black;
+ int nbits = pdev->color_info.depth;
- gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
- nbits >> 2);
+ gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
+ nbits >> 2);
#ifdef USE_ADOBE_CMYK_RGB
- /* R = 1.0 - min(1.0, C + K), etc. */
+ /* R = 1.0 - min(1.0, C + K), etc. */
- bcyan += black, bmagenta += black, byellow += black;
- prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bcyan);
- prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bmagenta);
- prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - byellow);
+ bcyan += black, bmagenta += black, byellow += black;
+ prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bcyan);
+ prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bmagenta);
+ prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - byellow);
#else
- /* R = (1.0 - C) * (1.0 - K), etc. */
-
- prgb[0] = (gx_color_value)
- ((ulong)(gx_max_color_value - bcyan) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[1] = (gx_color_value)
- ((ulong)(gx_max_color_value - bmagenta) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[2] = (gx_color_value)
- ((ulong)(gx_max_color_value - byellow) *
- (gx_max_color_value - black) / gx_max_color_value);
-
+ /* R = (1.0 - C) * (1.0 - K), etc. */
+
+ prgb[0] = (gx_color_value)
+ ((ulong)(gx_max_color_value - bcyan) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[1] = (gx_color_value)
+ ((ulong)(gx_max_color_value - bmagenta) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[2] = (gx_color_value)
+ ((ulong)(gx_max_color_value - byellow) *
+ (gx_max_color_value - black) / gx_max_color_value);
+
#endif
}
diff --git a/gs/contrib/gdevop4w.c b/gs/contrib/gdevop4w.c
index 29072da7f..248bd614d 100644
--- a/gs/contrib/gdevop4w.c
+++ b/gs/contrib/gdevop4w.c
@@ -2,7 +2,7 @@
Copyright (C)1998 Ivan Schreter
This file is part of GNU Ghostscript.
-
+
GNU Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to
anyone for the consequences of using it or for whether it serves any
@@ -42,26 +42,26 @@
* real world.
%!
- newpath
- 0 0 moveto 144 72 lineto 72 144 lineto
- closepath fill stroke 0 0 moveto 144 144 lineto stroke
+ newpath
+ 0 0 moveto 144 72 lineto 72 144 lineto
+ closepath fill stroke 0 0 moveto 144 144 lineto stroke
- 595.27 841.88 moveto 451.27 769.88 lineto 523.27 697.88 lineto
- closepath fill stroke 595.27 841.88 moveto 451.27 697.88 lineto stroke
+ 595.27 841.88 moveto 451.27 769.88 lineto 523.27 697.88 lineto
+ closepath fill stroke 595.27 841.88 moveto 451.27 697.88 lineto stroke
- 0 841.88 moveto 144 769.88 lineto 72 697.88 lineto
- closepath fill stroke 0 841.88 moveto 144 697.88 lineto stroke
+ 0 841.88 moveto 144 769.88 lineto 72 697.88 lineto
+ closepath fill stroke 0 841.88 moveto 144 697.88 lineto stroke
- 595.27 0 moveto 451.27 72 lineto 523.27 144 lineto
- closepath fill stroke 595.27 0 moveto 451.27 144 lineto stroke
+ 595.27 0 moveto 451.27 72 lineto 523.27 144 lineto
+ closepath fill stroke 595.27 0 moveto 451.27 144 lineto stroke
- /Helvetica findfont
- 14 scalefont setfont
- 100 600 moveto
- (This is an A4 testpage. The arrows should point exactly to the) show
- 100 580 moveto
- (corners and the margins should match those given in gdev*.c) show
- showpage
+ /Helvetica findfont
+ 14 scalefont setfont
+ 100 600 moveto
+ (This is an A4 testpage. The arrows should point exactly to the) show
+ 100 580 moveto
+ (corners and the margins should match those given in gdev*.c) show
+ showpage
*/
@@ -96,14 +96,14 @@ static dev_proc_print_page(oki4w_print_page);
static gx_device_procs prn_hp_procs =
prn_params_procs(oki4w_open, gdev_prn_output_page, oki4w_close,
- gdev_prn_get_params, gdev_prn_put_params);
+ gdev_prn_get_params, gdev_prn_put_params);
gx_device_printer far_data gs_oki4w_device =
prn_device(prn_hp_procs, "oki4w",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins filled in by oki4w_open */
- 1, oki4w_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0, 0, /* margins filled in by oki4w_open */
+ 1, oki4w_print_page);
#define ppdev ((gx_device_printer *)pdev)
@@ -111,26 +111,26 @@ gx_device_printer far_data gs_oki4w_device =
static int
oki_paper_size(gx_device *dev)
{
- float height_inches = dev->height / dev->y_pixels_per_inch;
- return
- height_inches >= 15.9 ? 0x1b/*PAPER_SIZE_A3*/ :
- height_inches >= 11.8 ? 0x03/*PAPER_SIZE_LEGAL*/ :
- height_inches >= 11.1 ? 0x1a /*PAPER_SIZE_A4*/ :
- height_inches >= 8.3 ? 0x02 /*PAPER_SIZE_LETTER*/ :
- 0x19 /*PAPER_SIZE_A5*/;
+ float height_inches = dev->height / dev->y_pixels_per_inch;
+ return
+ height_inches >= 15.9 ? 0x1b/*PAPER_SIZE_A3*/ :
+ height_inches >= 11.8 ? 0x03/*PAPER_SIZE_LEGAL*/ :
+ height_inches >= 11.1 ? 0x1a /*PAPER_SIZE_A4*/ :
+ height_inches >= 8.3 ? 0x02 /*PAPER_SIZE_LETTER*/ :
+ 0x19 /*PAPER_SIZE_A5*/;
}
/* Open the printer, adjusting the margins if necessary. */
static int
oki4w_open(gx_device *pdev)
{ /* Change the margins if necessary. */
- const float *m = 0;
- static const float m_a4[4] = { OKI4W_MARGINS_A4 };
- static const float m_letter[4] = { OKI4W_MARGINS_LETTER };
- m = (oki_paper_size(pdev) == 0x1a /*PAPER_SIZE_A4*/ ? m_a4 : m_letter);
- if ( m != 0 )
- gx_device_set_margins(pdev, m, true);
- return gdev_prn_open(pdev);
+ const float *m = 0;
+ static const float m_a4[4] = { OKI4W_MARGINS_A4 };
+ static const float m_letter[4] = { OKI4W_MARGINS_LETTER };
+ m = (oki_paper_size(pdev) == 0x1a /*PAPER_SIZE_A4*/ ? m_a4 : m_letter);
+ if ( m != 0 )
+ gx_device_set_margins(pdev, m, true);
+ return gdev_prn_open(pdev);
}
/* oki4w_close is only here to eject odd numbered pages in duplex mode. */
@@ -138,14 +138,14 @@ static int
oki4w_close(gx_device *pdev)
{
/*
- if ( pdev->Duplex_set >= 0 && pdev->Duplex )
- { gdev_prn_open_printer(pdev, 1);
- fputs("\033$B\033\177", ppdev->file);
- fputc(0, ppdev->file);
- return gdev_prn_close_printer(pdev);
- }
+ if ( pdev->Duplex_set >= 0 && pdev->Duplex )
+ { gdev_prn_open_printer(pdev, 1);
+ fputs("\033$B\033\177", ppdev->file);
+ fputc(0, ppdev->file);
+ return gdev_prn_close_printer(pdev);
+ }
*/
- return 0;
+ return 0;
}
#undef ppdev
@@ -155,74 +155,74 @@ oki4w_close(gx_device *pdev)
static int
oki_compress(byte *src, byte *dst, int count)
{
- int dcnt = 0;
- byte lastval = *src;
- int run = 1;
- src++;
- count--;
- while (count-- > 0) {
- byte newval = *src++;
- if (newval == lastval) {
- run++;
- } else {
- /* end of run, flush data */
- if (run == 1) {
- byte *backptr = dst++;
- *dst++ = lastval;
- dcnt++;
- lastval = newval;
- while (run < 128 && count > 0) {
- run++;
- newval = *src++;
- *dst++ = newval;
- dcnt++;
- count--;
- if (newval == lastval) {
- break;
- }
- }
- if (newval == lastval) {
- run--;
- dst--;
- dcnt--;
- }
- *backptr = dst - backptr - 2;
- if (newval == lastval) {
- run = 2;
- } else {
- run = 1;
- }
- continue;
- }
- while (run > 128) {
- *dst++ = 0x81;
- *dst++ = lastval;
- run -= 128;
- dcnt += 2;
- }
- if (run > 0) {
- *dst++ = (0x101 - run) & 0xff;
- *dst++ = lastval;
- dcnt += 2;
- }
- lastval = newval;
- run = 1;
- }
- }
- /* end of run, flush data */
- while (run > 128) {
- *dst++ = 0x81;
- *dst++ = lastval;
- run -= 128;
- dcnt += 2;
- }
- if (run > 0) {
- *dst++ = (0x101 - run) & 0xff;
- *dst++ = lastval;
- dcnt += 2;
- }
-
- return dcnt;
+ int dcnt = 0;
+ byte lastval = *src;
+ int run = 1;
+ src++;
+ count--;
+ while (count-- > 0) {
+ byte newval = *src++;
+ if (newval == lastval) {
+ run++;
+ } else {
+ /* end of run, flush data */
+ if (run == 1) {
+ byte *backptr = dst++;
+ *dst++ = lastval;
+ dcnt++;
+ lastval = newval;
+ while (run < 128 && count > 0) {
+ run++;
+ newval = *src++;
+ *dst++ = newval;
+ dcnt++;
+ count--;
+ if (newval == lastval) {
+ break;
+ }
+ }
+ if (newval == lastval) {
+ run--;
+ dst--;
+ dcnt--;
+ }
+ *backptr = dst - backptr - 2;
+ if (newval == lastval) {
+ run = 2;
+ } else {
+ run = 1;
+ }
+ continue;
+ }
+ while (run > 128) {
+ *dst++ = 0x81;
+ *dst++ = lastval;
+ run -= 128;
+ dcnt += 2;
+ }
+ if (run > 0) {
+ *dst++ = (0x101 - run) & 0xff;
+ *dst++ = lastval;
+ dcnt += 2;
+ }
+ lastval = newval;
+ run = 1;
+ }
+ }
+ /* end of run, flush data */
+ while (run > 128) {
+ *dst++ = 0x81;
+ *dst++ = lastval;
+ run -= 128;
+ dcnt += 2;
+ }
+ if (run > 0) {
+ *dst++ = (0x101 - run) & 0xff;
+ *dst++ = lastval;
+ dcnt += 2;
+ }
+
+ return dcnt;
}
/* Send the page to the printer. For speed, compress each scan line, */
@@ -230,138 +230,138 @@ oki_compress(byte *src, byte *dst, int count)
static int
oki4w_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- int line_size_words = (line_size + W - 1) / W;
- uint storage_size_words = line_size_words * 8; /* data, out_row, out_row_alt, prev_row */
- word *storage = (ulong *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), storage_size_words, W,
- "oki4w_print_page");
- word
- *data_words,
- *out_row_words,
- *out_row_alt_words,
- *prev_row_words;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int line_size_words = (line_size + W - 1) / W;
+ uint storage_size_words = line_size_words * 8; /* data, out_row, out_row_alt, prev_row */
+ word *storage = (ulong *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), storage_size_words, W,
+ "oki4w_print_page");
+ word
+ *data_words,
+ *out_row_words,
+ *out_row_alt_words,
+ *prev_row_words;
#define data ((byte *)data_words)
#define out_row ((byte *)out_row_words)
#define out_row_alt ((byte *)out_row_alt_words)
#define prev_row ((byte *)prev_row_words)
- byte *out_data;
- int x_dpi = pdev->x_pixels_per_inch;
- int y_dpi = pdev->y_pixels_per_inch;
- int y_dots_per_pixel = x_dpi / y_dpi;
- int dpi_code, compress_code;
- int num_rows = dev_print_scan_lines(pdev);
-
- int out_count;
- int paper_size = oki_paper_size((gx_device *)pdev);
- int code = 0;
- /* bool dup = pdev->Duplex;
- bool dupset = pdev->Duplex_set >= 0; */
-
- if ( storage == 0 ) /* can't allocate working area */
- return_error(gs_error_VMerror);
- data_words = storage;
- out_row_words = data_words + (line_size_words * 2);
- out_row_alt_words = out_row_words + (line_size_words * 2);
- prev_row_words = out_row_alt_words + (line_size_words * 2);
- /* Clear temp storage */
- memset(data, 0, storage_size_words * W);
-
- out_data = out_row;
-
- if (y_dpi == 150) {
- dpi_code = 3;
- compress_code = 2;
- } else if (y_dpi == 300) {
- dpi_code = 5;
- compress_code = 2;
- } else {
- dpi_code = 7;
- compress_code = 2;
- }
-
- /* Initialize printer. */
+ byte *out_data;
+ int x_dpi = pdev->x_pixels_per_inch;
+ int y_dpi = pdev->y_pixels_per_inch;
+ int y_dots_per_pixel = x_dpi / y_dpi;
+ int dpi_code, compress_code;
+ int num_rows = dev_print_scan_lines(pdev);
+
+ int out_count;
+ int paper_size = oki_paper_size((gx_device *)pdev);
+ int code = 0;
+ /* bool dup = pdev->Duplex;
+ bool dupset = pdev->Duplex_set >= 0; */
+
+ if ( storage == 0 ) /* can't allocate working area */
+ return_error(gs_error_VMerror);
+ data_words = storage;
+ out_row_words = data_words + (line_size_words * 2);
+ out_row_alt_words = out_row_words + (line_size_words * 2);
+ prev_row_words = out_row_alt_words + (line_size_words * 2);
+ /* Clear temp storage */
+ memset(data, 0, storage_size_words * W);
+
+ out_data = out_row;
+
+ if (y_dpi == 150) {
+ dpi_code = 3;
+ compress_code = 2;
+ } else if (y_dpi == 300) {
+ dpi_code = 5;
+ compress_code = 2;
+ } else {
+ dpi_code = 7;
+ compress_code = 2;
+ }
+
+ /* Initialize printer. */
/* if ( pdev->PageCount == 0 ) { */
- /* Put out init string before page. */
- fprintf(prn_stream, "\x1B%%-98765X\x1C\x14\x03\x41i\x10\x1C"
- "\x14\x05\x41\x65%cf%c\x1C\x14\x09\x42\x61%cb\x02\x63"
- "\x01\x65%c\x1C\x7F\x39\x1B&B\x1B&A\x07%c\x01%c"
- "\x01%c%c%c%c\x1B$A",
- dpi_code, dpi_code, 0, 0, 0, paper_size,
- 0, dpi_code, dpi_code, 0);
+ /* Put out init string before page. */
+ fprintf(prn_stream, "\x1B%%-98765X\x1C\x14\x03\x41i\x10\x1C"
+ "\x14\x05\x41\x65%cf%c\x1C\x14\x09\x42\x61%cb\x02\x63"
+ "\x01\x65%c\x1C\x7F\x39\x1B&B\x1B&A\x07%c\x01%c"
+ "\x01%c%c%c%c\x1B$A",
+ dpi_code, dpi_code, 0, 0, 0, paper_size,
+ 0, dpi_code, dpi_code, 0);
/* } */
- /* Send each scan line in turn */
- { int lnum;
- int num_blank_lines = 0;
- word rmask = ~(word)0 << (-pdev->width & (W * 8 - 1));
-
- /* Transfer raster graphics. */
- for ( lnum = 0; lnum < num_rows; lnum++ )
- { register word *end_data =
- data_words + line_size_words;
- int i;
- code = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
- if ( code < 0 )
- break;
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while ( end_data > data_words && end_data[-1] == 0 )
- end_data--;
- if ( end_data == data_words )
- { /* Blank line */
- num_blank_lines++;
- continue;
- }
-
- /* We've reached a non-blank line. */
- /* Put out a spacing command if necessary. */
- if ( num_blank_lines == lnum )
- { /* We're at the top of a page. */
- /* TODO: skip top_margin lines... */
- /* num_blank_lines += xxx */
- /* Skip blank lines if any */
- if (num_blank_lines > 0) {
- fprintf(prn_stream, "\x1b*B%c%c",
- num_blank_lines & 0xff,
- num_blank_lines >> 8);
- }
- }
- else if ( num_blank_lines != 0 )
- {
- /* Skip blank lines if any */
- fprintf(prn_stream, "\x1b*B%c%c",
- num_blank_lines & 0xff,
- num_blank_lines >> 8);
- }
- num_blank_lines = 0;
-
- /* Compress the data */
- if (compress_code == 6) {
- out_count = oki_compress(data, out_data,
- (end_data - data_words) * W);
- } else {
- out_count = gdev_pcl_mode2compress(data_words,
- end_data, out_data);
- }
-
- /* Transfer the data */
- for (i = 0; i < y_dots_per_pixel; ++i) {
- fprintf(prn_stream, "\033*A%c%c%c",
- compress_code,
- out_count & 0xff, out_count >> 8);
- fwrite(out_data, sizeof(byte), out_count,
- prn_stream);
- }
- }
- }
-
- /* end raster graphics and eject page */
- fprintf(prn_stream, "\x1b$B\x1b\x7f%c", 0);
-
- /* free temporary storage */
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)storage, storage_size_words, W, "oki4w_print_page");
-
- return code;
+ /* Send each scan line in turn */
+ { int lnum;
+ int num_blank_lines = 0;
+ word rmask = ~(word)0 << (-pdev->width & (W * 8 - 1));
+
+ /* Transfer raster graphics. */
+ for ( lnum = 0; lnum < num_rows; lnum++ )
+ { register word *end_data =
+ data_words + line_size_words;
+ int i;
+ code = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ if ( code < 0 )
+ break;
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while ( end_data > data_words && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data == data_words )
+ { /* Blank line */
+ num_blank_lines++;
+ continue;
+ }
+
+ /* We've reached a non-blank line. */
+ /* Put out a spacing command if necessary. */
+ if ( num_blank_lines == lnum )
+ { /* We're at the top of a page. */
+ /* TODO: skip top_margin lines... */
+ /* num_blank_lines += xxx */
+ /* Skip blank lines if any */
+ if (num_blank_lines > 0) {
+ fprintf(prn_stream, "\x1b*B%c%c",
+ num_blank_lines & 0xff,
+ num_blank_lines >> 8);
+ }
+ }
+ else if ( num_blank_lines != 0 )
+ {
+ /* Skip blank lines if any */
+ fprintf(prn_stream, "\x1b*B%c%c",
+ num_blank_lines & 0xff,
+ num_blank_lines >> 8);
+ }
+ num_blank_lines = 0;
+
+ /* Compress the data */
+ if (compress_code == 6) {
+ out_count = oki_compress(data, out_data,
+ (end_data - data_words) * W);
+ } else {
+ out_count = gdev_pcl_mode2compress(data_words,
+ end_data, out_data);
+ }
+
+ /* Transfer the data */
+ for (i = 0; i < y_dots_per_pixel; ++i) {
+ fprintf(prn_stream, "\033*A%c%c%c",
+ compress_code,
+ out_count & 0xff, out_count >> 8);
+ fwrite(out_data, sizeof(byte), out_count,
+ prn_stream);
+ }
+ }
+ }
+
+ /* end raster graphics and eject page */
+ fprintf(prn_stream, "\x1b$B\x1b\x7f%c", 0);
+
+ /* free temporary storage */
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)storage, storage_size_words, W, "oki4w_print_page");
+
+ return code;
}
diff --git a/gs/contrib/gdevxes.c b/gs/contrib/gdevxes.c
index 9fa572c49..eea303c85 100644
--- a/gs/contrib/gdevxes.c
+++ b/gs/contrib/gdevxes.c
@@ -43,7 +43,7 @@ are compressed to an ascii count and a single character.
/* Forward references */
static int sixel_print_page(gx_device_printer *pdev,
- FILE *prn_stream, const char *init);
+ FILE *prn_stream, const char *init);
/* The device descriptor */
static dev_proc_output_page(sixel_output_page);
@@ -61,10 +61,10 @@ static gx_device_procs xes_procs =
gx_device_printer gs_xes_device =
prn_device(xes_procs, "xes",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 300, 300, /* x_dpi, y_dpi */
- 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */
- 1, xes_print_page);
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 300, 300, /* x_dpi, y_dpi */
+ 0, BOTTOM_MARGIN, 0, 0, /* left, bottom, right, top margin */
+ 1, xes_print_page);
/*
* Initialization string: switch to graphics mode, 300 dpi
@@ -90,9 +90,9 @@ xes_print_page(gx_device_printer *pdev, FILE *prn_stream)
static int
sixel_output_page(gx_device *pdev, int num_copies, int flush)
{ int code = gdev_prn_open_printer(pdev, 0);
- if ( code < 0 )
- return code;
- return gdev_prn_output_page(pdev, num_copies, flush);
+ if ( code < 0 )
+ return code;
+ return gdev_prn_output_page(pdev, num_copies, flush);
}
/* Send the page to the printer. */
@@ -109,7 +109,7 @@ sixel_print_page(gx_device_printer *pdev, FILE *prn_stream, const char *init)
int count = 0;
line_size = gdev_mem_bytes_per_scan_line(pdev);
- height = pdev->height;
+ height = pdev->height;
/* Default page rectangle */
top = pdev->height;
left = line_size;
@@ -120,93 +120,93 @@ sixel_print_page(gx_device_printer *pdev, FILE *prn_stream, const char *init)
end = buf + line_size - 1;
/* Check allocation */
- if (!buf)
+ if (!buf)
return_error(gs_error_VMerror);
/* Compute required window size */
for (lnum=0; lnum < pdev->height; lnum++ ) {
- gdev_prn_copy_scan_lines(pdev, lnum, buf, line_size);
- for( b=buf; b<=end; b++ ) if(*b) break;
- if ( b<=end ) {
- top = min( top, lnum );
- left = min( left, (int)(b-buf));
- bottom = max( bottom, lnum );
- for( b=end; b>=buf; b-- ) if(*b) break;
- if ( b>=buf ) right = max( right, (int)(b-buf) );
- } /* endif */
- } /* endfor */
- width = right - left + 1; /* width in bytes */
- height= bottom- top + 1; /* height in pels */
- /* round width to multiple of 3 bytes */
- width = ( (width+2) / 3 ) * 3;
- right = min( line_size-1, left+width-1 );
- end = buf + right; /* recompute EOL */
+ gdev_prn_copy_scan_lines(pdev, lnum, buf, line_size);
+ for( b=buf; b<=end; b++ ) if(*b) break;
+ if ( b<=end ) {
+ top = min( top, lnum );
+ left = min( left, (int)(b-buf));
+ bottom = max( bottom, lnum );
+ for( b=end; b>=buf; b-- ) if(*b) break;
+ if ( b>=buf ) right = max( right, (int)(b-buf) );
+ } /* endif */
+ } /* endfor */
+ width = right - left + 1; /* width in bytes */
+ height= bottom- top + 1; /* height in pels */
+ /* round width to multiple of 3 bytes */
+ width = ( (width+2) / 3 ) * 3;
+ right = min( line_size-1, left+width-1 );
+ end = buf + right; /* recompute EOL */
fputs( init, prn_stream );
/* Position and size graphics window */
- fprintf( prn_stream, "%s%d,%d,%d,%d\n",
- XES_GRAPHICS,
- left*8, PAGE_LENGTH_PELS-top,
+ fprintf( prn_stream, "%s%d,%d,%d,%d\n",
+ XES_GRAPHICS,
+ left*8, PAGE_LENGTH_PELS-top,
width*8, height );
/* Print lines of graphics */
for (lnum = top; lnum <= bottom; lnum++ ) {
- gdev_prn_copy_scan_lines(pdev, lnum, buf, line_size);
- for ( b=buf+left; b<=end ; ) {
- /* grab data in 3-byte chunks */
- /* with zero pad at end-of-line */
- tmp[0]=tmp[1]=tmp[2]='\0';
- tmp[0]=*b++;
- if (b<=end) tmp[1]=*b++;
- if (b<=end) tmp[2]=*b++;
- /* sixellize data */
- tmp[3] = ( tmp[2] & 0x3F) + 0x3F;
- tmp[2] = ( tmp[2] >> 6 |
- (tmp[1] & 0x0F) << 2 ) + 0x3F;
- tmp[1] = ( tmp[1] >> 4 |
- (tmp[0] & 0x03) << 4 ) + 0x3F;
- tmp[0] = ( tmp[0] >> 2 ) + 0x3F;
- /* build runs of identical characters */
- /* longest run length is 32767 bytes */
- for ( l=0; l<4; l++) {
- if ( tmp[l] == last ) {
- count++;
- if (count==32767) {
- run[sprintf(run, "%d", count)]='\0';
- for (t=run; *t; t++)fputc( *t, prn_stream );
- fputc( last, prn_stream );
- last = '\0';
- count = 0;
- } /* end if count */
- } /* end if tmp[l] */
- else {
- /* emit single character or run */
- switch (count) {
- case 0: break;
- case 1: fputc( last, prn_stream );
- break;
- default:run[sprintf(run, "%d", count)]='\0';
- for (t=run; *t; t++) fputc( *t, prn_stream );
- fputc( last, prn_stream );
- break;
- } /* end switch */
- last = tmp[l];
- count = 1;
- } /* end else */
- } /* end for l */
- } /* end for b */
+ gdev_prn_copy_scan_lines(pdev, lnum, buf, line_size);
+ for ( b=buf+left; b<=end ; ) {
+ /* grab data in 3-byte chunks */
+ /* with zero pad at end-of-line */
+ tmp[0]=tmp[1]=tmp[2]='\0';
+ tmp[0]=*b++;
+ if (b<=end) tmp[1]=*b++;
+ if (b<=end) tmp[2]=*b++;
+ /* sixellize data */
+ tmp[3] = ( tmp[2] & 0x3F) + 0x3F;
+ tmp[2] = ( tmp[2] >> 6 |
+ (tmp[1] & 0x0F) << 2 ) + 0x3F;
+ tmp[1] = ( tmp[1] >> 4 |
+ (tmp[0] & 0x03) << 4 ) + 0x3F;
+ tmp[0] = ( tmp[0] >> 2 ) + 0x3F;
+ /* build runs of identical characters */
+ /* longest run length is 32767 bytes */
+ for ( l=0; l<4; l++) {
+ if ( tmp[l] == last ) {
+ count++;
+ if (count==32767) {
+ run[sprintf(run, "%d", count)]='\0';
+ for (t=run; *t; t++)fputc( *t, prn_stream );
+ fputc( last, prn_stream );
+ last = '\0';
+ count = 0;
+ } /* end if count */
+ } /* end if tmp[l] */
+ else {
+ /* emit single character or run */
+ switch (count) {
+ case 0: break;
+ case 1: fputc( last, prn_stream );
+ break;
+ default:run[sprintf(run, "%d", count)]='\0';
+ for (t=run; *t; t++) fputc( *t, prn_stream );
+ fputc( last, prn_stream );
+ break;
+ } /* end switch */
+ last = tmp[l];
+ count = 1;
+ } /* end else */
+ } /* end for l */
+ } /* end for b */
} /* end for lnum */
/* Write final run */
switch (count) {
case 0: break;
case 1: fputc( last, prn_stream );
- break;
+ break;
default:run[sprintf(run, "%d", count)]='\0';
- for (t=run; *t; t++) fputc( *t, prn_stream );
- fputc( last, prn_stream );
- break;
+ for (t=run; *t; t++) fputc( *t, prn_stream );
+ fputc( last, prn_stream );
+ break;
} /* end switch */
/* Eject page and reset */
diff --git a/gs/contrib/gomni.c b/gs/contrib/gomni.c
index 8405cfa7c..e7a01aa4e 100644
--- a/gs/contrib/gomni.c
+++ b/gs/contrib/gomni.c
@@ -102,8 +102,8 @@ typedef void* gpointer;
#define g_module_close dlclose
int dlsym_wrapper(void *lib, char const *name, void **symbol)
{
- *symbol=dlsym(lib, name);
- return *symbol != 0;
+ *symbol=dlsym(lib, name);
+ return *symbol != 0;
}
#define g_module_symbol dlsym_wrapper
#define g_module_error dlerror
@@ -271,7 +271,6 @@ typedef struct gx_device_omni_s {
} gx_device_omni;
typedef gx_device_omni omni_device;
-
/* Define initializer for device */
#define omni_device(procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, color_bits, print_page)\
{ prn_device_std_margins_body(gx_device_omni, procs, dname,\
@@ -331,7 +330,6 @@ static gx_device_procs omni16m_procs = {
SetupDevice /** Import parameters, special */
};
-
gx_device_omni far_data gs_omni_device =
omni_device (omni16m_procs,
"omni",
@@ -342,7 +340,6 @@ gx_device_omni far_data gs_omni_device =
1, /* Bpp value */
omni_print_page); /* sync routine for output of raster data */
-
/* ------------------------------------------------------*/
/* ------------------------------------------------------*/
@@ -359,14 +356,14 @@ omni_map_16m_rgb_color(gx_device * dev, const gx_color_value cv[])
gx_color_value r, g, b;
r = cv[0]; g = cv[1]; b = cv[2];
return gx_color_value_to_byte(r) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- ((ulong) gx_color_value_to_byte(b) << 16);
+ ((uint) gx_color_value_to_byte(g) << 8) +
+ ((ulong) gx_color_value_to_byte(b) << 16);
}
/* Map a color index to a r-g-b color. */
static int
omni_map_16m_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
prgb[2] = gx_color_value_from_byte(color >> 16);
prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
@@ -1540,7 +1537,6 @@ PrintPage (gx_device_printer *pgx_prt_dev, FILE *prn_stream, int num_copies)
rectPageLocation.xLeft = 0;
rectPageLocation.xRight = pasyncDev->width;
-
if (pDev->iPageNumber == 1)
{
pDev->pcoreOmni->pfpOut = prn_stream;
@@ -1692,9 +1688,9 @@ PrintPage (gx_device_printer *pgx_prt_dev, FILE *prn_stream, int num_copies)
}
/*
- * implemented based on the number of lines sent to the
+ * implemented based on the number of lines sent to the
* printer and not based on the bandsize
- */
+ */
rectPageLocation.yTop -= iYBand;
@@ -2032,7 +2028,7 @@ GetSpaceParams (const gx_device_printer *pgx_prt_dev,
space_params->band.BandHeight = (pgx_prt_dev->height + min_band_count - 1) / min_band_count;
gdev_mem_data_size ((const gx_device_memory *)pgx_prt_dev, space_params->band.BandWidth,
- space_params->band.BandHeight, &render_space);
+ space_params->band.BandHeight, &render_space);
/* need to include minimal writer requirements to satisfy rasterizer init */
writer_space = 5000 /* add 5K slop for good measure */
diff --git a/gs/contrib/japanese/dviprlib.c b/gs/contrib/japanese/dviprlib.c
index 6da3e7509..d7ccd93db 100644
--- a/gs/contrib/japanese/dviprlib.c
+++ b/gs/contrib/japanese/dviprlib.c
@@ -1,14 +1,14 @@
/* COPYRIGHT (C) 1990, 1992 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
-
+
This file is part of Ghostscript.
-
+
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
-
+
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
@@ -33,24 +33,22 @@
/* The remainder of this file is a copy of the library for dviprt. */
-
/***** From rcfg.c *****/
/* $Id: RCFG.C 1.1 1994/08/30 02:27:02 kaz Exp kaz $ */
-
/*--- forward declarations ---*/
static int dviprt_read_S_cfg(dviprt_cfg_t *,dviprt_cfg_i *);
static int dviprt_read_QR_cfg(dviprt_cfg_t *,dviprt_cfg_i *);
-
+
/*--- library functions ---*/
-int
+int
dviprt_readcfg(char *ifname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
uchar *pworkbuf,int workbuf_s)
{
int code;
int ver;
dviprt_cfg_i info;
-
+
info.fname = ifname;
info.line_no = -1;
if (ifname) {
@@ -63,7 +61,7 @@ dviprt_readcfg(char *ifname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
else {
info.file = stdin;
}
-
+
fseek(info.file,16,0);
ver = fgetc(info.file);
fseek(info.file,0,0);
@@ -71,15 +69,15 @@ dviprt_readcfg(char *ifname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
info.readbuf = pworkbuf;
info.codebuf_size = codebuf_s;
info.readbuf_size = workbuf_s;
- code = (ver == 'S') ? dviprt_read_S_cfg(pcfg,&info)
+ code = (ver == 'S') ? dviprt_read_S_cfg(pcfg,&info)
: dviprt_read_QR_cfg(pcfg,&info);
-
+
if (ifname) fclose(info.file);
return code;
}
/*--- internal routines ---*/
-static int
+static int
dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
{
FILE *ifp;
@@ -89,13 +87,13 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
int code;
char *ptype;
int n;
-
+
if ((code = dviprt_setcfgbuffer_(pinfo,100,0)) < 0) return code;
dviprt_initcfg_(pcfg,pinfo);
-
+
ifp = pinfo->file;
rbuf = pinfo->readbuf;
-
+
if (fread(rbuf,20,1,ifp) < 1) {
dviprt_printcfgerror(pinfo,"Read error.\n",-1);
}
@@ -109,22 +107,22 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
pcfg->version = rbuf[2] | ((uint)rbuf[3] << 8);
if (pcfg->version > CFG_VERSION) {
sprintf(dviprt_message_buffer,
- "This *.CFG file is too new version(ver.%u).\n",pcfg->version);
+ "This *.CFG file is too new version(ver.%u).\n",pcfg->version);
dviprt_printcfgerror(pinfo,dviprt_message_buffer,-1);
return CFG_ERROR_OTHER;
}
-
+
#define bytes2long(p) ((p)[0] | ((long)(p)[1]<<8) | \
- ((long)(p)[2]<<16) | ((long)(p)[3]<<24))
+ ((long)(p)[2]<<16) | ((long)(p)[3]<<24))
intoff = bytes2long(rbuf+4);
stroff = bytes2long(rbuf+8);
codeoff = bytes2long(rbuf+12);
#undef bytes2long
-
+
fseek(ifp,intoff,0);
count = fgetc(ifp);
fread(rbuf,count*3,1,ifp);
-
+
pbuf = rbuf;
for (i=0;i<count;i++) {
n = pbuf[0];
@@ -132,14 +130,14 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
ptype = "integer";
unknown_no:
sprintf(dviprt_message_buffer,
- "Unknown %s type value No.%d is found.\n",ptype,n);
+ "Unknown %s type value No.%d is found.\n",ptype,n);
dviprt_printcfgerror(pinfo,dviprt_message_buffer,-1);
return CFG_ERROR_OTHER;
}
pcfg->integer[n] = pbuf[1] | ((uint)pbuf[2]<<8);
pbuf += 3;
}
-
+
fseek(ifp,stroff,0);
count = fgetc(ifp);
pbuf = NULL;
@@ -167,7 +165,7 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
fread(pcfg->strings[n],l,1,ifp);
*(pcfg->strings[n]+l) = 0;
}
-
+
fseek(ifp,codeoff,0);
count = fgetc(ifp);
for (i=0;i<count;i++) {
@@ -175,7 +173,7 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
fread(rbuf,3,1,ifp);
n = rbuf[0];
l = rbuf[1] | ((uint)rbuf[2]<<8);
-
+
if (n >= CFG_PRTCODE_TYPE_COUNT) {
ptype = "printer code";
goto unknown_no;
@@ -197,11 +195,11 @@ dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
return 0;
}
-static int
+static int
dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
{
#define TYPE_BIT 0xc0
-
+
#define NO_NUM 0
#define BINARY_LTOH 1
#define BINARY_HTOL 2
@@ -209,7 +207,7 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
#define DECIMAL_4 4
#define DECIMAL_5 5
#define DECIMAL_V 6
-
+
#define TOTAL_BYTE 0x80
#define ISO_NUMBER 0x40
#define DIVIDEBY_2 0x10
@@ -239,7 +237,7 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
CFG_AFTER_BIT_IMAGE,
CFG_BIT_ROW_HEADER,
};
-
+
ch =dviprt_setcfgbuffer_(pinfo,300,TEMP_CODEBUF_SIZE);
if (ch < 0) return CFG_ERROR_MEMORY;
dviprt_initcfg_(pcfg,pinfo);
@@ -277,13 +275,13 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
pinfo->pcodebuf++;
}
strcpy(pcfg->strings[CFG_NAME],cfg_buf);
-
+
pcfg->integer[CFG_UPPER_POS] =
(cfg_buf[17] & (CFG_LEFT_IS_LOW|CFG_NON_MOVING));
pcfg->integer[CFG_ENCODE] =
(cfg_buf[17] & 0x10) ? CFG_ENCODE_HEX : CFG_ENCODE_NULL;
pcfg->integer[CFG_PINS] = ((uint) (cfg_buf[17]) & 0x0f);
-
+
ptr = cfg_buf+23;
pcfg->integer[CFG_MINIMAL_UNIT] = (uint)ptr[0] | ((uint)ptr[1]<<8);
pcfg->integer[CFG_MAXIMAL_UNIT] = (uint)ptr[2] | ((uint)ptr[3]<<8);
@@ -293,7 +291,7 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
pcfg->integer[CFG_CONSTANT] = cfg_buf[20];
offset = cfg_buf[19];
fseek(pinfo->file,offset,0);
-
+
for (i = 0; i <= BIT_ROW_HEADER; i++) {
uchar *pstart,*plength;
uchar prev = 1;
@@ -310,81 +308,81 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
pos = *ptr++;
f_type = *ptr++;
type = f_type & 0x7;
-
+
for (j = 0; j < lens; j++) {
- ch = *ptr++;
- if (pos == j && type != NO_NUM) {
- uchar *pfmt = pinfo->pcodebuf++;
- plength = pinfo->pcodebuf++;
- *pinfo->pcodebuf++ = CFG_VAL_DEFAULT;
- *plength = 1;
- j++;
- ptr++;
- switch (type) {
- case (BINARY_LTOH):
- *pfmt = CFG_FMT_BIT | CFG_FMT_BIN_LTOH | 2;
- break;
- case (BINARY_HTOL):
- *pfmt = CFG_FMT_BIT | CFG_FMT_BIN_HTOL | 2;
- break;
- case (DECIMAL_3):
- *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 3;
- j++;
- ptr++;
- break;
- case (DECIMAL_4):
- *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 4;
- j += 2;
- ptr += 2;
- break;
- case (DECIMAL_5):
- *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 5;
- j += 3;
- ptr += 3;
- break;
- case (DECIMAL_V):
- *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL;
- j++;
- ptr++;
- break;
- default:
- sprintf(dviprt_message_buffer,"Unknown format %02X",type);
- dviprt_printcfgerror(pinfo,dviprt_message_buffer,-1);
- goto ex_func;
- }
- if (f_type & TOTAL_BYTE) {
- *pinfo->pcodebuf++ = CFG_VAL_PINS_BYTE;
- *pinfo->pcodebuf++ = CFG_OP_MUL;
- (*plength) += 2;
- }
- if ((k = (f_type & DIVIDE_ALL)) != 0) {
- *pinfo->pcodebuf = 0;
- for (; k > 0; k -= DIVIDEBY_2) {
- (*pinfo->pcodebuf)++;
- }
- pinfo->pcodebuf++;
- *pinfo->pcodebuf++ = CFG_OP_SHR;
- (*plength) += 2;
- }
- if (f_type & ISO_NUMBER) {
- *pfmt |= CFG_FMT_ISO_BIT;
- }
- if (f_type & MULT_CONST) {
- *pinfo->pcodebuf++ = CFG_VAL_CONSTANT;
- *pinfo->pcodebuf++ = CFG_OP_MUL;
- (*plength) += 2;
- }
- prev = 1;
- }
- else {
- if (prev == 1 || *plength >= 127) {
- plength = pinfo->pcodebuf++;
- *plength = 0;
- }
- (*plength)++;
- *pinfo->pcodebuf++ = ch;
- prev = 0;
- }
+ ch = *ptr++;
+ if (pos == j && type != NO_NUM) {
+ uchar *pfmt = pinfo->pcodebuf++;
+ plength = pinfo->pcodebuf++;
+ *pinfo->pcodebuf++ = CFG_VAL_DEFAULT;
+ *plength = 1;
+ j++;
+ ptr++;
+ switch (type) {
+ case (BINARY_LTOH):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_BIN_LTOH | 2;
+ break;
+ case (BINARY_HTOL):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_BIN_HTOL | 2;
+ break;
+ case (DECIMAL_3):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 3;
+ j++;
+ ptr++;
+ break;
+ case (DECIMAL_4):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 4;
+ j += 2;
+ ptr += 2;
+ break;
+ case (DECIMAL_5):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL | 5;
+ j += 3;
+ ptr += 3;
+ break;
+ case (DECIMAL_V):
+ *pfmt = CFG_FMT_BIT | CFG_FMT_DECIMAL;
+ j++;
+ ptr++;
+ break;
+ default:
+ sprintf(dviprt_message_buffer,"Unknown format %02X",type);
+ dviprt_printcfgerror(pinfo,dviprt_message_buffer,-1);
+ goto ex_func;
+ }
+ if (f_type & TOTAL_BYTE) {
+ *pinfo->pcodebuf++ = CFG_VAL_PINS_BYTE;
+ *pinfo->pcodebuf++ = CFG_OP_MUL;
+ (*plength) += 2;
+ }
+ if ((k = (f_type & DIVIDE_ALL)) != 0) {
+ *pinfo->pcodebuf = 0;
+ for (; k > 0; k -= DIVIDEBY_2) {
+ (*pinfo->pcodebuf)++;
+ }
+ pinfo->pcodebuf++;
+ *pinfo->pcodebuf++ = CFG_OP_SHR;
+ (*plength) += 2;
+ }
+ if (f_type & ISO_NUMBER) {
+ *pfmt |= CFG_FMT_ISO_BIT;
+ }
+ if (f_type & MULT_CONST) {
+ *pinfo->pcodebuf++ = CFG_VAL_CONSTANT;
+ *pinfo->pcodebuf++ = CFG_OP_MUL;
+ (*plength) += 2;
+ }
+ prev = 1;
+ }
+ else {
+ if (prev == 1 || *plength >= 127) {
+ plength = pinfo->pcodebuf++;
+ *plength = 0;
+ }
+ (*plength)++;
+ *pinfo->pcodebuf++ = ch;
+ prev = 0;
+ }
}
} while (f_cont & 0x80);
*pinfo->pcodebuf++ = 0;
@@ -392,13 +390,13 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
uint l = pinfo->pcodebuf-pstart;
pcfg->prtcode_size[n] = l - 1;
if (pinfo->temp_codebuf_f) { /* allocate buffer */
- pcfg->prtcode[n] = (uchar *)malloc(l);
+ pcfg->prtcode[n] = (uchar *)malloc(l);
if (pcfg->prtcode[n] == NULL)
goto no_memory;
- memcpy(pcfg->prtcode[n],pstart,l);
+ memcpy(pcfg->prtcode[n],pstart,l);
}
else {
- pcfg->prtcode[n] = pstart;
+ pcfg->prtcode[n] = pstart;
}
}
}
@@ -408,11 +406,9 @@ dviprt_read_QR_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
}
/***** End of rcfg.c *****/
-
/***** From rsrc.c *****/
/* $Id: RSRC.C 1.1 1994/08/30 02:27:02 kaz Exp kaz $ */
-
typedef struct {
char *name;
signed char type;
@@ -442,14 +438,14 @@ static int dviprt_set_code
static long dviprt_oct2long(uchar *,uchar *,uchar **);
static long dviprt_dec2long(uchar *,uchar *,uchar **);
static long dviprt_hex2long(uchar *,uchar *,uchar **);
-
+
static int dviprt_printtokenerror(dviprt_cfg_i *,char *,int ,int);
-
+
/*--- macros ---*/
#define strlcmp(tmplt,str,len) \
(!(strncmp(tmplt,str,(int)(len)) == 0 && (int)(len) == strlen(tmplt)))
#define set_version(pcfg,v) ((pcfg)->version = MAX(v,(pcfg)->version))
-
+
enum {
ERROR_UNKNOWN_VALUE,ERROR_UNKNOWN_FORMAT,ERROR_UNKNOWN_ESCSEQ,
ERROR_OUTOFRANGE,
@@ -459,7 +455,7 @@ enum {
};
/*--- library functions ---*/
-int
+int
dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
uchar *pworkbuf,int workbuf_s)
{
@@ -496,7 +492,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
"encode",T_STRINGS,CFG_ENCODE_INFO,0,0,NULL
};
int prtcode_output_bytes[CFG_PRTCODE_TYPE_COUNT];
-
+
info.line_no = -1;
info.fname = fname;
if (fname) {
@@ -510,7 +506,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
ifp = stdin;
}
ifp = info.file;
-
+
info.codebuf = pcodebuf;
info.readbuf = pworkbuf;
info.codebuf_size = codebuf_s;
@@ -520,7 +516,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
fclose(info.file);
return CFG_ERROR_MEMORY;
}
-
+
/* initialize */
dviprt_initcfg_(pcfg,&info);
for (pitem = dviprt_items;pitem->type>=0;pitem++) {
@@ -546,12 +542,12 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
for (i=0;i<CFG_PRTCODE_TYPE_COUNT;i++)
prtcode_output_bytes[i] = 0;
}
-
+
pcfg->version = 1;
for ( ; ; ) {
uchar *pbuf = info.readbuf;
uchar *pchar;
-
+
if (fgets(info.readbuf,info.readbuf_size,ifp) == NULL) break;
info.line_no++;
{
@@ -592,7 +588,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
if (pitem->spec_f) {
dviprt_printcfgerror(&info,NULL,0);
sprintf(dviprt_message_buffer,
- "Item `%s' is specified twice.\n",pitem->name);
+ "Item `%s' is specified twice.\n",pitem->name);
dviprt_printmessage(dviprt_message_buffer,-1);
code = CFG_ERROR_SYNTAX;
goto end_process;
@@ -614,7 +610,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
if (info.temp_codebuf_f)
info.pcodebuf = info.codebuf;
if ((code = dviprt_set_strings(pitem,pbuf,pcfg,&info)) < 0)
- goto end_process;
+ goto end_process;
if (info.temp_codebuf_f) {
pcfg->strings[pitem->no] =
(uchar*)malloc(strlen(pcfg->strings[pitem->no])+1);
@@ -640,7 +636,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
goto end_process;
}
memcpy(pcfg->prtcode[pitem->no],info.codebuf,
- pcfg->prtcode_size[pitem->no]+1);
+ pcfg->prtcode_size[pitem->no]+1);
}
break;
case T_SELECT:
@@ -690,7 +686,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
pitem->spec_f = 1;
}
end_scan:
-
+
info.line_no = -1;
code = 0;
for (pitem = dviprt_items;pitem->name;pitem++) {
@@ -701,7 +697,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
}
}
if (code) { code = CFG_ERROR_RANGE; goto end_process; }
-
+
if (pcfg->prtcode[CFG_LINE_FEED] == NULL) {
if (info.temp_codebuf_f) {
pcfg->prtcode[CFG_LINE_FEED] = info.pcodebuf;
@@ -746,11 +742,11 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
MAX(prtcode_output_bytes[CFG_AFTER_BIT_IMAGE],0) +
MAX(prtcode_output_bytes[CFG_SKIP_SPACES],0))
/ (pcfg->integer[CFG_PINS]*8) +
- MAX(prtcode_output_bytes[CFG_BIT_ROW_HEADER],0);
+ MAX(prtcode_output_bytes[CFG_BIT_ROW_HEADER],0);
if (v == 0) v = 1;
pcfg->integer[CFG_MINIMAL_UNIT] = v;
}
-
+
for (pitem = dviprt_items;pitem->type>=0;pitem++) {
if (pitem->spec_f == 0) {
sprintf(dviprt_message_buffer,": %s:",pitem->name);
@@ -768,23 +764,23 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
}
}
}
-
+
end_process:
if (fname) fclose(ifp);
dviprt_resetcfgbuffer_(&info);
-
+
return code;
}
/*--- internal routines ---*/
-static int
+static int
dviprt_set_integer(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_cfg_i *pinfo)
{
uchar *pbuf = buf;
long v = 0;
long max = -1 ,min = -1;
-
+
if (pitem->info != NULL) {
dviprt_cfg_limit_t *plimit = (dviprt_cfg_limit_t *)pitem->info;
min = plimit->min;
@@ -807,14 +803,14 @@ dviprt_set_integer(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_printtokenerror(pinfo,buf,strlen(buf),ERROR_OUTOFRANGE);
dviprt_printcfgerror(pinfo,"",-1);
sprintf(dviprt_message_buffer,
- "(%u <= value <= %u).\n",(uint)min,(uint)max);
+ "(%u <= value <= %u).\n",(uint)min,(uint)max);
dviprt_printmessage(dviprt_message_buffer,-1);
return CFG_ERROR_RANGE;
}
pbuf++;
}
if (v < min) goto out_of_range;
-
+
while (*pbuf) {
if (!isspace(*pbuf)) {
invalid_val:
@@ -824,11 +820,11 @@ dviprt_set_integer(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
pbuf++;
}
pcfg->integer[pitem->no] = v;
-
+
return 0;
}
-static int
+static int
dviprt_set_strings(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_cfg_i *pinfo)
{
@@ -842,7 +838,7 @@ dviprt_set_strings(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_printcfgerror(pinfo,"Too long strings.\n",-1);
return CFG_ERROR_RANGE;
}
-
+
pcfg->strings[pitem->no] = pinfo->pcodebuf;
strncpy(pinfo->pcodebuf,buf,(int)len);
pinfo->pcodebuf[len] = 0;
@@ -864,7 +860,7 @@ dviprt_set_select(dviprt_cfg_item_t *pitem,uchar **buf,dviprt_cfg_t *pcfg,
return CFG_ERROR_SYNTAX;
}
while (*ptmp && !isspace(*ptmp)) ptmp++;
-
+
for (i=0,opt=(uchar**)pitem->info;*opt;i++,opt++) {
if (strlcmp(*opt,pstart,ptmp-pstart) == 0) {
pcfg->integer[pitem->no] = i;
@@ -880,7 +876,7 @@ dviprt_set_select(dviprt_cfg_item_t *pitem,uchar **buf,dviprt_cfg_t *pcfg,
#define CFG_TOKEN_LIMIT_BIT 0x100
#define CFG_TOKEN_FMT 0x200
-static int
+static int
dviprt_get_codetype_token(dviprt_cfg_i *pinfo,uchar *pstart,uchar *pend,uchar *stopescseqchars,
uchar *limitchars)
{
@@ -898,7 +894,7 @@ dviprt_get_codetype_token(dviprt_cfg_i *pinfo,uchar *pstart,uchar *pend,uchar *s
int c;
long v;
uchar *pexpr,*pnext;
-
+
pexpr = pinfo->token = pstart++;
while (pstart < pend && !isspace(*pstart) &&
*pstart != '\\' && !strchr(stopescseqchars,*pstart)) {
@@ -936,12 +932,12 @@ dviprt_get_codetype_token(dviprt_cfg_i *pinfo,uchar *pstart,uchar *pend,uchar *s
check_numb_range:
if (pstart != pnext) {
dviprt_printtokenerror(pinfo,pinfo->token,
- (int)(pinfo->endtoken - pinfo->token), ERROR_INVALID_VALUE);
+ (int)(pinfo->endtoken - pinfo->token), ERROR_INVALID_VALUE);
return CFG_TOKEN_ERROR;
}
if (v >= 256) {
dviprt_printtokenerror(pinfo,pinfo->token,
- (int)(pinfo->endtoken - pinfo->token), ERROR_OUTOFRANGE);
+ (int)(pinfo->endtoken - pinfo->token), ERROR_OUTOFRANGE);
return CFG_TOKEN_ERROR;
}
pinfo->endtoken = pnext;
@@ -965,7 +961,7 @@ dviprt_get_codetype_token(dviprt_cfg_i *pinfo,uchar *pstart,uchar *pend,uchar *s
}
}
-static long
+static long
dviprt_dec2long(uchar *start,uchar *end,uchar **next)
{
long v = 0;
@@ -979,7 +975,7 @@ dviprt_dec2long(uchar *start,uchar *end,uchar **next)
return v;
}
-static long
+static long
dviprt_oct2long(uchar *start,uchar *end,uchar **next)
{
long v = 0;
@@ -993,7 +989,7 @@ dviprt_oct2long(uchar *start,uchar *end,uchar **next)
return v;
}
-static long
+static long
dviprt_hex2long(uchar *start,uchar *end,uchar **next)
{
long v = 0;
@@ -1009,14 +1005,14 @@ dviprt_hex2long(uchar *start,uchar *end,uchar **next)
return v;
}
-static int
+static int
dviprt_set_rpexpr(dviprt_cfg_item_t *pitem,uchar *pbuf,int len,dviprt_cfg_t *pcfg,
dviprt_cfg_i *pinfo,int sp)
{
uchar *pend = pbuf + len;
uchar *plastop = NULL;
int code;
-
+
/* get left expr */
while (pbuf < pend) {
int par_count = 0;
@@ -1041,7 +1037,7 @@ dviprt_set_rpexpr(dviprt_cfg_item_t *pitem,uchar *pbuf,int len,dviprt_cfg_t *pcf
}
else break;
}
-
+
if (plastop == NULL) { /* no operator */
ulong v;
uchar *pdummy;
@@ -1051,8 +1047,8 @@ dviprt_set_rpexpr(dviprt_cfg_item_t *pitem,uchar *pbuf,int len,dviprt_cfg_t *pcf
check_intval:
if (pdummy != pend) goto unknown_value;
if (v > 0xffff) {
- dviprt_printtokenerror(pinfo,pbuf,(int)(pend-pbuf),ERROR_OUTOFRANGE);
- return CFG_ERROR_RANGE;
+ dviprt_printtokenerror(pinfo,pbuf,(int)(pend-pbuf),ERROR_OUTOFRANGE);
+ return CFG_ERROR_RANGE;
}
a = v & 0x7f;
b = (v>>7) & 0x7f;
@@ -1129,12 +1125,12 @@ dviprt_set_rpexpr(dviprt_cfg_item_t *pitem,uchar *pbuf,int len,dviprt_cfg_t *pcf
}
else { /* has operator */
uchar op;
-
+
code = dviprt_set_rpexpr(pitem,pbuf,(int)(plastop-pbuf),pcfg,pinfo,sp+1);
if (code < 0) return code;
code = dviprt_set_rpexpr(pitem,plastop+1,(int)(pend-plastop-1),pcfg,pinfo,sp+2);
if (code < 0) return code;
-
+
switch (*plastop) {
case '+': op = CFG_OP_ADD; break;
case '-': op = CFG_OP_SUB; break;
@@ -1156,11 +1152,11 @@ dviprt_set_rpexpr(dviprt_cfg_item_t *pitem,uchar *pbuf,int len,dviprt_cfg_t *pcf
}
*pinfo->pcodebuf++ = op;
}
-
+
return code;
}
-static int
+static int
dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_cfg_i *pinfo)
{
@@ -1170,11 +1166,11 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
uchar *pcode_begin;
uchar *rbuf;
int obytes = 0;
-
+
prev_line = ftell(pinfo->file);
pcode_begin = pinfo->pcodebuf;
rbuf = pinfo->readbuf;
-
+
for ( ; ; ) {
while (*buf) {
int c;
@@ -1198,12 +1194,12 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
uchar *pexpr = pinfo->token;
int div=0,iso=0,mul=0,tl=0;
int cols=0;
- int fmt;
+ int fmt;
uchar *plength;
uchar *pstart;
-
+
buf = pinfo->token+1;
-
+
/* formats */
switch (*buf) {
case 'b': fmt = CFG_FMT_BIN_LTOH; break;
@@ -1220,11 +1216,11 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
default:
unknown_format:
dviprt_printtokenerror(pinfo,pexpr,(int)(pinfo->endtoken-pexpr),
- ERROR_UNKNOWN_FORMAT);
+ ERROR_UNKNOWN_FORMAT);
return CFG_ERROR_SYNTAX;
}
buf++;
-
+
/* columns */
if (fmt == CFG_FMT_STRINGS) ;
else {
@@ -1232,22 +1228,22 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_printtokenerror(pinfo,pexpr,(int)(pinfo->token-pexpr),ERROR_INCOMPLETE);
return CFG_ERROR_SYNTAX;
}
-
+
if (!(*buf >= '1' && *buf <= '7') && *buf != '?') {
invalid_cols:
dviprt_printtokenerror(pinfo,pexpr,(int)(pinfo->endtoken-pexpr),
- ERROR_UNKNOWN_FORMAT);
+ ERROR_UNKNOWN_FORMAT);
return CFG_ERROR_SYNTAX;
}
cols = (*buf == '?') ? 0 : *buf - '0';
if (cols == 0 &&
(fmt == CFG_FMT_BIN_LTOH || fmt == CFG_FMT_BIN_HTOL))
goto invalid_cols;
-
+
buf++;
obytes += (cols == 0) ? 5 : cols;
}
-
+
/* additional format */
while (buf < pinfo->endtoken) {
switch (*buf) {
@@ -1270,22 +1266,22 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
plength = pinfo->pcodebuf;
pinfo->pcodebuf++;
pstart = pinfo->pcodebuf;
-
+
if (*buf == ',' && *(buf+1) != '\"') {
- int code;
+ int code;
buf++;
pinfo->token = buf;
while (*pinfo->token && *pinfo->token != ',' &&
*pinfo->token != '\\' && !isspace(*pinfo->token))
pinfo->token++;
- if (pinfo->token == buf) {
+ if (pinfo->token == buf) {
dviprt_printcfgerror(pinfo,"No expression is specified in ",-1);
dviprt_printmessage(pexpr,(int)(buf-pexpr));
dviprt_printmessage(".\n",-1);
return CFG_ERROR_SYNTAX;
}
if ((code = dviprt_set_rpexpr(pitem,buf,(int)(pinfo->token-buf),pcfg,pinfo,0)) < 0)
- return code;
+ return code;
buf = pinfo->token;
}
else {
@@ -1303,21 +1299,21 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
*pinfo->pcodebuf++ = div;
*pinfo->pcodebuf++ = CFG_OP_SHR;
}
- {
- int length = pinfo->pcodebuf-pstart;
- if (length > 255) {
- dviprt_printtokenerror(pinfo,pexpr,(int)(buf-pexpr),ERROR_COMPLICATED_EXPR);
- return CFG_ERROR_RANGE;
- }
- *plength++ = length & 0xff;
- }
+ {
+ int length = pinfo->pcodebuf-pstart;
+ if (length > 255) {
+ dviprt_printtokenerror(pinfo,pexpr,(int)(buf-pexpr),ERROR_COMPLICATED_EXPR);
+ return CFG_ERROR_RANGE;
+ }
+ *plength++ = length & 0xff;
+ }
if (fmt == CFG_FMT_STRINGS) {
uchar *pslen = pinfo->pcodebuf++;
int len;
if (strlen(buf) < 2 || *buf != ',' || *(buf+1) != '\"') {
- dviprt_printcfgerror(pinfo,"No strings specified in ",-1);
- dviprt_printmessage(pexpr,(int)(buf-pexpr));
- dviprt_printmessage(".\n",-1);
+ dviprt_printcfgerror(pinfo,"No strings specified in ",-1);
+ dviprt_printmessage(pexpr,(int)(buf-pexpr));
+ dviprt_printmessage(".\n",-1);
return CFG_ERROR_SYNTAX;
}
buf += 2;
@@ -1327,15 +1323,15 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
else if (c == CFG_TOKEN_FMT) {
dviprt_printcfgerror(pinfo,"The format ",-1);
dviprt_printmessage(pinfo->token,
- (int)(pinfo->endtoken-pinfo->token));
+ (int)(pinfo->endtoken-pinfo->token));
dviprt_printmessage(" cannot to be specified here.\n",-1);
return CFG_ERROR_SYNTAX;
}
else if (c & CFG_TOKEN_LIMIT_BIT) {
if ((c & 0xff) != '\"') {
dviprt_printcfgerror(pinfo,
- "Strings must be enclosed with "
- "double quotations (\").\n",-1);
+ "Strings must be enclosed with "
+ "double quotations (\").\n",-1);
return CFG_ERROR_SYNTAX;
}
buf = pinfo->endtoken;
@@ -1348,15 +1344,15 @@ dviprt_set_code(dviprt_cfg_item_t *pitem,uchar *buf,dviprt_cfg_t *pcfg,
dviprt_printcfgerror(pinfo,"Too long strings.\n",-1);
return CFG_ERROR_RANGE;
}
- *pslen = len;
- }
+ *pslen = len;
+ }
prev_type = 1;
}
else {
- dviprt_printcfgerror(pinfo,"Parse error. Unexpected token ",-1);
- dviprt_printmessage(pinfo->token,(int)(pinfo->endtoken-pinfo->token));
- dviprt_printmessage(".\n",-1);
- return CFG_ERROR_SYNTAX;
+ dviprt_printcfgerror(pinfo,"Parse error. Unexpected token ",-1);
+ dviprt_printmessage(pinfo->token,(int)(pinfo->endtoken-pinfo->token));
+ dviprt_printmessage(".\n",-1);
+ return CFG_ERROR_SYNTAX;
}
}
next_line:
@@ -1406,14 +1402,14 @@ dviprt_src_errorno2message(int type)
}
}
-static int
+static int
dviprt_printtokenerror(dviprt_cfg_i *pinfo,char *token,int len,int type)
{
char *msg;
-
+
dviprt_printcfgerror(pinfo,token,len);
dviprt_printmessage("\n",-1);
-
+
if ((msg = dviprt_src_errorno2message(type)) != NULL)
dviprt_printcfgerror(pinfo,msg,-1);
return 0;
@@ -1423,11 +1419,9 @@ dviprt_printtokenerror(dviprt_cfg_i *pinfo,char *token,int len,int type)
#undef set_version
/***** End of rsrc.c *****/
-
/***** From util.c *****/
/* $Id: UTIL.C 1.1 1994/08/30 02:27:02 kaz Exp kaz $ */
-
char *dviprt_integername[] = { CFG_INTEGER_NAME, NULL };
char *dviprt_stringsname[] = { CFG_STRINGS_NAME, NULL };
char *dviprt_prtcodename[] = { CFG_PRTCODE_NAME, NULL };
@@ -1448,11 +1442,11 @@ dviprt_setmessagestream(FILE *fp)
}
/*--- internal routines ---*/
-static int
+static int
dviprt_initcfg_(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
{
int i;
-
+
for (i=0;i<CFG_INTEGER_TYPE_COUNT;i++)
pcfg->integer[i] = -1;
for (i=0;i<CFG_STRINGS_TYPE_COUNT;i++)
@@ -1466,11 +1460,11 @@ dviprt_initcfg_(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
return 0;
}
-static int
+static int
dviprt_setcfgbuffer_(dviprt_cfg_i *pinfo,int rsize,int csize)
{
pinfo->temp_readbuf_f = pinfo->temp_codebuf_f = 0;
-
+
if (pinfo->readbuf == NULL) {
pinfo->readbuf_size = rsize;
if (rsize>0) {
@@ -1495,7 +1489,7 @@ dviprt_setcfgbuffer_(dviprt_cfg_i *pinfo,int rsize,int csize)
return 0;
}
-static int
+static int
dviprt_resetcfgbuffer_(dviprt_cfg_i *pinfo)
{
if (pinfo->temp_readbuf_f) free(pinfo->readbuf);
@@ -1541,7 +1535,7 @@ dviprt_printerror(char *msg,int len)
return 0;
}
-static int
+static int
dviprt_printcfgerror(dviprt_cfg_i *pinfo,char *msg,int len)
{
dviprt_printcfgerrorheader(pinfo);
@@ -1557,7 +1551,7 @@ dviprt_printwarning(char *msg,int len)
return 0;
}
-static int
+static int
dviprt_printcfgwarning(dviprt_cfg_i *pinfo,char *msg,int len)
{
dviprt_printcfgerrorheader(pinfo);
@@ -1566,11 +1560,9 @@ dviprt_printcfgwarning(dviprt_cfg_i *pinfo,char *msg,int len)
}
/***** End of util.c *****/
-
/***** From print.c *****/
/* $Id: PRINT.C 1.1 1994/08/30 02:27:02 kaz Exp kaz $ */
-
/*--- forward declarations ---*/
static int dviprt_getmaximalwidth(dviprt_print *);
static int dviprt_flush_buffer(dviprt_print *,uchar far *);
@@ -1582,14 +1574,14 @@ static int dviprt_transpose8x8(uchar far *,uint, uchar far *,uint);
static int dviprt_output_expr(dviprt_print *,int,uint,uint);
static int dviprt_default_outputproc(uchar far *,long ,void *);
static long dviprt_getbuffersize(dviprt_print *);
-
+
/*--- library functions ---*/
long
dviprt_initlibrary(dviprt_print *pprint,dviprt_cfg_t *pprt,uint width,uint height)
{
dviprt_encoder *pencode;
uint pins = pprt->integer[CFG_PINS]*8;
-
+
pprint->printer = pprt;
height += (pins-1);
height /= pins;
@@ -1604,15 +1596,15 @@ dviprt_initlibrary(dviprt_print *pprint,dviprt_cfg_t *pprt,uint width,uint heigh
if (pencode == NULL) return CFG_ERROR_NOT_SUPPORTED;
pprint->encode_getbuffersize_proc = pencode->getworksize;
pprint->encode_encode_proc = pencode->encode;
-
+
pprint->output_bytes = 0;
pprint->pstream = NULL;
pprint->output_proc = NULL;
-
+
if (pprt->integer[CFG_UPPER_POS] & CFG_NON_TRANSPOSE_BIT) {
pprint->output_maximal_unit =
(pprt->integer[CFG_UPPER_POS] & CFG_REVERSE_BIT) ?
- dviprt_output_nontranspose_reverse : dviprt_output_nontranspose;
+ dviprt_output_nontranspose_reverse : dviprt_output_nontranspose;
}
else
pprint->output_maximal_unit = dviprt_output_transpose;
@@ -1685,10 +1677,10 @@ dviprt_outputscanlines(dviprt_print *pprint,uchar far *fb)
dviprt_cfg_t *pprt;
int code;
uint bw;
-
+
pprt = pprint->printer;
bw = pprint->bitmap_width;
-
+
if (pprt->prtcode_size[CFG_SKIP_SPACES] <= 0) {
pprint->bitmap_x = bw;
pprint->last_x = 0;
@@ -1700,11 +1692,11 @@ dviprt_outputscanlines(dviprt_print *pprint,uchar far *fb)
uint pins = dviprt_getscanlines(pprint);
mu = pprt->integer[CFG_MINIMAL_UNIT];
bx = lx = 0;
-
+
for (rw= bw; rw > 0 ;rw -= uw) {
uint x,y;
uchar far *in;
-
+
uw = MIN(mu,rw);
in = fb + bx;
for (x = uw; x>0 ; x--) {
@@ -1716,7 +1708,7 @@ dviprt_outputscanlines(dviprt_print *pprint,uchar far *fb)
}
in++;
}
-
+
if (bx > lx) {
pprint->bitmap_x = bx;
pprint->last_x = lx;
@@ -1725,7 +1717,7 @@ dviprt_outputscanlines(dviprt_print *pprint,uchar far *fb)
lx = pprint->last_x + uw;
}
else lx += uw;
-
+
next_unit:
bx += uw;
}
@@ -1778,7 +1770,7 @@ dviprt_getbuffersize(dviprt_print *pprint)
long w = dviprt_getmaximalwidth(pprint);
long e = pprint->encode_getbuffersize_proc(pprint,w);
switch (pprint->printer->integer[CFG_UPPER_POS]
- & (CFG_NON_TRANSPOSE_BIT | CFG_REVERSE_BIT)) {
+ & (CFG_NON_TRANSPOSE_BIT | CFG_REVERSE_BIT)) {
case CFG_LEFT_IS_HIGH:
return e;
default:
@@ -1791,7 +1783,7 @@ dviprt_flush_buffer(dviprt_print *pprint,uchar far *fb)
{
dviprt_cfg_t *pprt;
int code;
-
+
pprt = pprint->printer;
while (pprint->device_y < pprint->bitmap_y) { /* skip vertical spaces */
pprint->device_y++;
@@ -1802,7 +1794,7 @@ dviprt_flush_buffer(dviprt_print *pprint,uchar far *fb)
int w;
while (pprint->device_x < pprint->last_x) { /* skip horizontal spaces */
w = MIN(pprt->integer[CFG_MAXIMAL_UNIT],
- pprint->last_x - pprint->device_x);
+ pprint->last_x - pprint->device_x);
code = dviprt_output_expr(pprint,CFG_SKIP_SPACES,w,0);
pprint->device_x += w;
}
@@ -1823,9 +1815,9 @@ dviprt_output_nontranspose(dviprt_print *pprint,uchar far *fb,uint width)
uint dsize;
uint y;
uint pins;
-
+
pins = dviprt_getscanlines(pprint);
-
+
dsize = 0;
pprint->psource = fb;
for (y = pins ; y>0 ; y--) {
@@ -1835,10 +1827,10 @@ dviprt_output_nontranspose(dviprt_print *pprint,uchar far *fb,uint width)
dsize += dsize_line;
pprint->psource += pprint->bitmap_width;
}
-
+
code = dviprt_output_expr(pprint,CFG_SEND_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
pprint->psource = fb;
for (y = pins ; y>0 ; y--) {
int dsize_line;
@@ -1849,14 +1841,13 @@ dviprt_output_nontranspose(dviprt_print *pprint,uchar far *fb,uint width)
if (code < 0) return code;
pprint->psource += pprint->bitmap_width;
}
-
+
code = dviprt_output_expr(pprint,CFG_AFTER_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
return 0;
}
-
static int
dviprt_output_nontranspose_reverse(dviprt_print *pprint,uchar far *fb,uint width)
{
@@ -1867,10 +1858,10 @@ dviprt_output_nontranspose_reverse(dviprt_print *pprint,uchar far *fb,uint width
uint dsize;
uint y;
uint pins;
-
+
pins = dviprt_getscanlines(pprint);
src_size = width * pins;
-
+
psrc = pprint->source_buffer;
for (y = pins ; y > 0; y--) {
uint i;
@@ -1878,12 +1869,11 @@ dviprt_output_nontranspose_reverse(dviprt_print *pprint,uchar far *fb,uint width
for (i=width;i>0;i--) *psrc++ = *pbuf++;
fb += pprint->bitmap_width;
}
-
+
/* here, reverse bits */
psrc = pprint->source_buffer;
dviprt_reverse_bits(psrc,src_size);
-
-
+
dsize = 0;
pprint->psource = pprint->source_buffer;
for (y = pins ; y>0 ; y--) {
@@ -1893,10 +1883,10 @@ dviprt_output_nontranspose_reverse(dviprt_print *pprint,uchar far *fb,uint width
dsize += dsize_line;
pprint->psource += width;
}
-
+
code = dviprt_output_expr(pprint,CFG_SEND_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
pprint->psource = pprint->source_buffer;
for (y = pins ; y>0 ; y--) {
int dsize_line;
@@ -1907,10 +1897,10 @@ dviprt_output_nontranspose_reverse(dviprt_print *pprint,uchar far *fb,uint width
if (code < 0) return code;
pprint->psource += width;
}
-
+
code = dviprt_output_expr(pprint,CFG_AFTER_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
return 0;
}
@@ -1924,7 +1914,7 @@ dviprt_output_transpose(dviprt_print *pprint,uchar far *fb,uint width)
uint dsize;
uint pins,pins8;
int y;
-
+
pins8 = pprint->printer->integer[CFG_PINS];
pins = pins8 * 8;
src_size = width * pins;
@@ -1946,13 +1936,13 @@ dviprt_output_transpose(dviprt_print *pprint,uchar far *fb,uint width)
psrc++;
}
}
-
+
psrc = pprint->source_buffer;
-
+
/* here, reverse bits */
if (pprint->printer->integer[CFG_UPPER_POS] & CFG_REVERSE_BIT)
dviprt_reverse_bits(psrc,src_size);
-
+
dsize = 0;
pprint->psource = pprint->source_buffer;
for (y = pins ; y>0 ; y--) {
@@ -1962,10 +1952,10 @@ dviprt_output_transpose(dviprt_print *pprint,uchar far *fb,uint width)
dsize += dsize_line;
pprint->psource += width;
}
-
+
code = dviprt_output_expr(pprint,CFG_SEND_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
pprint->psource = pprint->source_buffer;
for (y = pins ; y>0 ; y--) {
uint dsize_line;
@@ -1974,10 +1964,10 @@ dviprt_output_transpose(dviprt_print *pprint,uchar far *fb,uint width)
if (code < 0) return code;
pprint->psource += width;
}
-
+
code = dviprt_output_expr(pprint,CFG_AFTER_BIT_IMAGE,width,dsize);
if (code < 0) return code;
-
+
return 0;
}
@@ -2017,27 +2007,27 @@ dviprt_transpose8x8(uchar far *inp,uint line_size,uchar far *outp,uint dist)
}
else {
register uint temp;
-
+
/* Transpose a block of bits between registers. */
#define transpose(r,s,mask,shift)\
r ^= (temp = ((s >> shift) ^ r) & mask);\
s ^= temp << shift
-
- /* Transpose blocks of 4 x 4 */
+
+ /* Transpose blocks of 4 x 4 */
#define transpose4(r) transpose(r,r,0x00f0,4)
- transpose4(ae);
+ transpose4(ae);
transpose4(bf);
transpose4(cg);
transpose4(dh);
-
+
/* Transpose blocks of 2 x 2 */
transpose(ae, cg, 0x3333, 2);
transpose(bf, dh, 0x3333, 2);
-
+
/* Transpose blocks of 1 x 1 */
transpose(ae, bf, 0x5555, 1);
transpose(cg, dh, 0x5555, 1);
-
+
store: *outp = ae >> 8;
outp += dist;
*outp = bf >> 8;
@@ -2061,38 +2051,38 @@ static int
dviprt_reverse_bits(uchar far *buf,uint s)
{
static uchar rev[256] = {
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
- 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
- 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
- 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
- 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
- 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
- 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
- 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
- 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
- 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
- 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
- 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
- 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
- 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
- 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
- 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
};
while (s-- > 0) {
*buf = rev[*buf];
@@ -2101,7 +2091,6 @@ dviprt_reverse_bits(uchar far *buf,uint s)
return 0;
}
-
static int
dviprt_output_expr(dviprt_print *pprint,int numb,uint width,uint dsize)
{
@@ -2109,12 +2098,12 @@ dviprt_output_expr(dviprt_print *pprint,int numb,uint width,uint dsize)
dviprt_cfg_t *pprt;
uint v;
uint len;
-
+
pprt = pprint->printer;
if (pprt->prtcode[numb] == NULL) return 0;
pcode = pprt->prtcode[numb];
len = pprt->prtcode_size[numb];
-
+
while (*pcode && len>0) {
if (*pcode & CFG_FMT_BIT) {
uint stack[CFG_STACK_DEPTH];
@@ -2164,7 +2153,7 @@ dviprt_output_expr(dviprt_print *pprint,int numb,uint width,uint dsize)
case CFG_VAL_X_DPI: v = (int)pprt->integer[CFG_DPI]; break;
case CFG_VAL_Y_DPI:
v = pprt->integer[CFG_Y_DPI] > 0 ?
- pprt->integer[CFG_Y_DPI] : pprt->integer[CFG_DPI];
+ pprt->integer[CFG_Y_DPI] : pprt->integer[CFG_DPI];
break;
case CFG_VAL_PINS_BYTE: v = pprt->integer[CFG_PINS]; break;
case CFG_VAL_X_POS: v = pprint->device_x*8; break;
@@ -2193,45 +2182,45 @@ dviprt_output_expr(dviprt_print *pprint,int numb,uint width,uint dsize)
pprint->uservar[fmt&0x0f] = v;
}
else { uchar valbuf[10];
- int cols = fmt & CFG_FMT_COLUMN_BIT;
- int i;
-
- switch (fmt & CFG_FMT_FORMAT_BIT) {
- case CFG_FMT_BIN_LTOH:
- for (i=0;i<cols;i++) {
- valbuf[i] = v&0xff;
- v >>= 8;
- }
- break;
- case CFG_FMT_BIN_HTOL:
- for (i=cols-1;i>=0;i--) {
- valbuf[i] = v&0xff;
- v >>= 8;
- }
- break;
- default:
- { char *f;
- char fmtbuf[10];
- switch(fmt & CFG_FMT_FORMAT_BIT) {
- case CFG_FMT_HEX_UPPER: f = "X"; break;
- case CFG_FMT_HEX_LOWER: f = "x"; break;
- case CFG_FMT_DECIMAL: f = "u"; break;
- case CFG_FMT_OCTAL: f = "o"; break;
- }
- if (cols == 0)
- strcpy(fmtbuf,"%");
- else
- sprintf(fmtbuf,"%%0%d",cols);
- strcat(fmtbuf,f);
- sprintf(valbuf,fmtbuf,stack[stack_p]);
- cols = strlen(valbuf);
- if (fmt & CFG_FMT_ISO_BIT)
- valbuf[cols-1] |= 0x10;
- }
- break;
- }
- dviprt_output(pprint,(uchar far *)valbuf, cols);
- }
+ int cols = fmt & CFG_FMT_COLUMN_BIT;
+ int i;
+
+ switch (fmt & CFG_FMT_FORMAT_BIT) {
+ case CFG_FMT_BIN_LTOH:
+ for (i=0;i<cols;i++) {
+ valbuf[i] = v&0xff;
+ v >>= 8;
+ }
+ break;
+ case CFG_FMT_BIN_HTOL:
+ for (i=cols-1;i>=0;i--) {
+ valbuf[i] = v&0xff;
+ v >>= 8;
+ }
+ break;
+ default:
+ { char *f;
+ char fmtbuf[10];
+ switch(fmt & CFG_FMT_FORMAT_BIT) {
+ case CFG_FMT_HEX_UPPER: f = "X"; break;
+ case CFG_FMT_HEX_LOWER: f = "x"; break;
+ case CFG_FMT_DECIMAL: f = "u"; break;
+ case CFG_FMT_OCTAL: f = "o"; break;
+ }
+ if (cols == 0)
+ strcpy(fmtbuf,"%");
+ else
+ sprintf(fmtbuf,"%%0%d",cols);
+ strcat(fmtbuf,f);
+ sprintf(valbuf,fmtbuf,stack[stack_p]);
+ cols = strlen(valbuf);
+ if (fmt & CFG_FMT_ISO_BIT)
+ valbuf[cols-1] |= 0x10;
+ }
+ break;
+ }
+ dviprt_output(pprint,(uchar far *)valbuf, cols);
+ }
}
else {
uint l = *pcode++;
@@ -2259,11 +2248,9 @@ dviprt_default_outputproc(uchar far *buf,long s,void *fp)
}
/***** End of print.c *****/
-
/***** From encode.c *****/
/* $Id: ENCODE.C 1.1 1994/08/30 02:27:02 kaz Exp kaz $ */
-
#define DVIPRT_SUPPORT_FAX 1
#define DVIPRT_SUPPORT_PCL 1
@@ -2282,7 +2269,7 @@ static long dviprt_pcl1_encode(dviprt_print *,long ,int );
static long dviprt_pcl2_getworksize(dviprt_print *,long );
static long dviprt_pcl2_encode(dviprt_print *,long ,int );
#endif
-
+
static dviprt_encoder dviprt_encoder_list[] = {
{ CFG_ENCODE_NULL, dviprt_null_getworksize,dviprt_null_encode},
{ CFG_ENCODE_HEX, dviprt_hex_getworksize,dviprt_hex_encode},
@@ -2308,24 +2295,24 @@ dviprt_getencoder_(int no)
return NULL;
}
-static long
+static long
dviprt_null_getworksize(dviprt_print *pprint,long s)
{
return 0;
}
-static long
+static long
dviprt_null_encode(dviprt_print *pprint,long s,int f)
{
pprint->poutput = pprint->psource;
return s;
}
-static long
+static long
dviprt_hex_getworksize(dviprt_print *pprint,long s)
{
return s*2;
}
-static long
+static long
dviprt_hex_encode(dviprt_print *pprint,long s,int f)
{
if (f) {
@@ -2350,18 +2337,18 @@ dviprt_pcl1_getworksize(dviprt_print *pprint,long s)
{
return s*2;
}
-static long
+static long
dviprt_pcl1_encode(dviprt_print *pprint,long s,int f)
{
uchar far *src;
uchar far *end;
uchar far *out;
long total = 0;
-
+
src = pprint->psource;
end = src + s;
out = pprint->poutput = pprint->encode_buffer;
-
+
while ( src < end ) {
uchar test = *src++;
uchar far *run = src;
@@ -2384,12 +2371,12 @@ dviprt_pcl1_encode(dviprt_print *pprint,long s,int f)
return total;
}
-static long
+static long
dviprt_pcl2_getworksize(dviprt_print *pprint,long s)
{
return s + s/127 + 1;
}
-static long
+static long
dviprt_pcl2_encode(dviprt_print *pprint,long s,int f)
{
uchar far *exam;
@@ -2397,12 +2384,12 @@ dviprt_pcl2_encode(dviprt_print *pprint,long s,int f)
uchar far *end;
uchar far *src;
long total = 0;
-
+
src = pprint->psource;
exam = src;
cptr = pprint->poutput = pprint->encode_buffer;
end = exam + s;
-
+
for ( ; ; ) {
uchar test = *exam++;
int len;
@@ -2450,7 +2437,7 @@ dviprt_pcl2_encode(dviprt_print *pprint,long s,int f)
#endif /* DVIPRT_SUPPORT_PCL */
#if DVIPRT_SUPPORT_FAX
-static long
+static long
dviprt_fax_getworksize(dviprt_print *pprint,long s)
{
long size = s * 8 + 7;
@@ -2466,7 +2453,7 @@ typedef struct {
uchar i_bitbuf;
uchar far *i_buf;
int i_count;
-
+
uchar o_bitbuf;
uchar far *o_buf;
int o_count;
@@ -2475,8 +2462,8 @@ typedef struct {
static int dviprt_fax_set_white(int,FaxEncodeInfo *);
static int dviprt_fax_set_black(int,FaxEncodeInfo *);
static int dviprt_fax_set_bitcount(FaxEncode_t *,FaxEncodeInfo *);
-
-static long
+
+static long
dviprt_fax_encode(dviprt_print *pprint,long s,int f)
{
static FaxEncode_t eol_code = {0x800,12};
@@ -2486,11 +2473,11 @@ dviprt_fax_encode(dviprt_print *pprint,long s,int f)
FaxEncodeInfo info;
uchar far *src_end;
uchar recover;
-
+
src_end = pprint->psource + s;
recover = *src_end;
*src_end = 0xaa;
-
+
/* initializing */
info.i_buf = pprint->psource;
info.i_bitbuf = *info.i_buf++;
@@ -2499,9 +2486,9 @@ dviprt_fax_encode(dviprt_print *pprint,long s,int f)
info.o_bitbuf = 0;
info.o_count = 8;
info.o_bufcount = 0;
-
+
dviprt_fax_set_bitcount(&eol_code,&info);
-
+
for(;;){
static uchar ROW[9] =
{0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
@@ -2509,12 +2496,12 @@ dviprt_fax_encode(dviprt_print *pprint,long s,int f)
{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
int white_run_length;
int black_run_length;
-
+
/* count run-length */
/* remaining bits in the current byte are white? */
if (!(info.i_bitbuf &= MASK[info.i_count])){
do{
- top_bit_count += 8; /* next byte is also white */
+ top_bit_count += 8; /* next byte is also white */
} while(!(info.i_bitbuf = *info.i_buf++));
info.i_count = 8;
}
@@ -2522,22 +2509,22 @@ dviprt_fax_encode(dviprt_print *pprint,long s,int f)
while(!(info.i_bitbuf & ROW[info.i_count]))
info.i_count--; /* skip white bits */
white_run_length = top_bit_count - (black_run_length = info.i_count);
-
+
/* remaining bits in the current byte are black? */
if (info.i_bitbuf == MASK[info.i_count]){
do{
- black_run_length += 8;
- /* next byte is also black */
+ black_run_length += 8;
+ /* next byte is also black */
} while((info.i_bitbuf = *info.i_buf++) == 0xff);
info.i_count = 8;
}
else info.i_count--; /* skip the top black bit */
-
+
/* current byte contains white and black bits */
while(info.i_bitbuf & ROW[info.i_count])
info.i_count--; /* skip black bits */
black_run_length -= (top_bit_count = info.i_count);
-
+
/* output */
if((allruns += white_run_length) < width)
dviprt_fax_set_white(white_run_length,&info);
@@ -2552,22 +2539,22 @@ dviprt_fax_encode(dviprt_print *pprint,long s,int f)
break;
}
}
-
+
info.o_bufcount++;
if (info.o_count < 8)
*info.o_buf++ = info.o_bitbuf;
else
*info.o_buf++ = 0;
*src_end = recover;
-
+
return info.o_bufcount;
}
-static int
+static int
dviprt_fax_set_bitcount(FaxEncode_t *pt,FaxEncodeInfo *info)
{
int data, length;
-
+
data = pt->data;
length = pt->length;
while( (length -= info->o_count) >= 0 ){
@@ -2582,7 +2569,7 @@ dviprt_fax_set_bitcount(FaxEncode_t *pt,FaxEncodeInfo *info)
return 0;
}
-static int
+static int
dviprt_fax_set_white(int count,FaxEncodeInfo *info)
{
static FaxEncode_t white_count_list[]={
@@ -2650,7 +2637,7 @@ dviprt_fax_set_white(int count,FaxEncodeInfo *info)
{ 0x004C, 8, }, /* 61 */
{ 0x00CC, 8, }, /* 62 */
{ 0x002C, 8, }, /* 63 */
-
+
{ 0x001B, 5, }, /* 64 */
{ 0x0009, 5, }, /* 128 */
{ 0x003A, 6, }, /* 192 */
@@ -2678,7 +2665,7 @@ dviprt_fax_set_white(int count,FaxEncodeInfo *info)
{ 0x00B2, 9, }, /* 1600 */
{ 0x0006, 6, }, /* 1664 */
{ 0x01B2, 9, }, /* 1728 */
-
+
{ 0x0080, 11, }, /* 1792 */
{ 0x0180, 11, }, /* 1856 */
{ 0x0580, 11, }, /* 1920 */
@@ -2706,7 +2693,7 @@ dviprt_fax_set_white(int count,FaxEncodeInfo *info)
return 0;
}
-static int
+static int
dviprt_fax_set_black(int count,FaxEncodeInfo *info)
{
static FaxEncode_t black_count_list[]={
@@ -2774,7 +2761,7 @@ dviprt_fax_set_black(int count,FaxEncodeInfo *info)
{ 0x05A0, 12, }, /* 61 */
{ 0x0660, 12, }, /* 62 */
{ 0x0E60, 12, }, /* 63 */
-
+
{ 0x03C0, 10, }, /* 64 */
{ 0x0130, 12, }, /* 128 */
{ 0x0930, 12, }, /* 192 */
@@ -2802,7 +2789,7 @@ dviprt_fax_set_black(int count,FaxEncodeInfo *info)
{ 0x1B40, 13, }, /* 1600 */
{ 0x04C0, 13, }, /* 1664 */
{ 0x14C0, 13, }, /* 1728 */
-
+
{ 0x0080, 11, }, /* 1792 */
{ 0x0180, 11, }, /* 1856 */
{ 0x0580, 11, }, /* 1920 */
@@ -2817,7 +2804,7 @@ dviprt_fax_set_black(int count,FaxEncodeInfo *info)
{ 0x0780, 12, }, /* 2496 */
{ 0x0F80, 12, }, /* 2560 */
};
-
+
while (count >= 64){
if(count <= MAX_FAX_WIDTH){
dviprt_fax_set_bitcount((black_count_list + 63) + (count/64),info);
diff --git a/gs/contrib/japanese/dviprlib.h b/gs/contrib/japanese/dviprlib.h
index 7275afb19..bb8b649e2 100644
--- a/gs/contrib/japanese/dviprlib.h
+++ b/gs/contrib/japanese/dviprlib.h
@@ -1,14 +1,14 @@
/* COPYRIGHT (C) 1990, 1992 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
-
+
This file is part of Ghostscript.
-
+
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
-
+
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
@@ -23,7 +23,6 @@
#ifndef s_cfgbld_h_INCLUDED
-
/* $Id: S_CFG.H 1.1 1994/08/30 02:27:18 kaz Exp kaz $ */
#ifndef s_cfg_h_INCLUDED
@@ -48,7 +47,7 @@
#define CFG_INTEGER_NAME "pins","minimal_unit","maximal_unit","dpi",\
"upper_position","encode","constant","y_dpi"
-
+
#define CFG_BIT_IMAGE_MODE 0
#define CFG_SEND_BIT_IMAGE 1
#define CFG_BIT_ROW_HEADER 2
@@ -58,16 +57,16 @@
#define CFG_NORMAL_MODE 6
#define CFG_SKIP_SPACES 7
#define CFG_PRTCODE_TYPE_COUNT 8
-
+
#define CFG_PRTCODE_NAME "bit_image_mode", "send_bit_image", "bit_row_header",\
"after_bit_image", "line_feed", "form_feed",\
"normal_mode", "skip_spaces"
-
+
#define CFG_FMT_BIT 0x80
#define CFG_FMT_FORMAT_BIT 0x70
#define CFG_FMT_COLUMN_BIT 0x07
#define CFG_FMT_ISO_BIT 0x08
-
+
#define CFG_FMT_BIN_LTOH 0x00
#define CFG_FMT_BIN_HTOL 0x10
#define CFG_FMT_HEX_UPPER 0x20
@@ -76,7 +75,7 @@
#define CFG_FMT_OCTAL 0x50
#define CFG_FMT_ASSIGNMENT 0x60 /* assignment(user variables) */
#define CFG_FMT_STRINGS 0x70
-
+
#define CFG_EXPR_TYPE_BIT 0xe0
#define CFG_EXPR_VAL_BIT 0x1f
#define CFG_VAL 0x80
@@ -131,7 +130,7 @@
NULL,NULL,\
\
"pop","null"
-
+
#define CFG_TOP_IS_HIGH 0x00
#define CFG_TOP_IS_LOW 0x80
#define CFG_LEFT_IS_HIGH 0x40
@@ -140,7 +139,7 @@
#define CFG_NON_TRANSPOSE_BIT 0x40
#define CFG_REVERSE_BIT 0x80
#define CFG_PIN_POSITION_BITS 0xc0
-
+
#define CFG_ENCODE_NAME "NULL","HEX","FAX","PCL1","PCL2"
#define CFG_ENCODE_NULL 0x00
#define CFG_ENCODE_HEX 0x01
@@ -150,21 +149,21 @@
#define CFG_ENCODE_LIPS3 0x05 /* Not implemented yet. */
#define CFG_ENCODE_ESCPAGE 0x06 /* Not implemented yet. */
#define CFG_ENCODE_COUNT 0x05
-
+
#define CFG_STACK_DEPTH 20
-
+
#define CFG_ERROR_OTHER -1
-
+
#define CFG_ERROR_SYNTAX -2
#define CFG_ERROR_RANGE -3
#define CFG_ERROR_TYPE -4
-
+
#define CFG_ERROR_FILE_OPEN -5
#define CFG_ERROR_OUTPUT -6
#define CFG_ERROR_MEMORY -7
#define CFG_ERROR_DIV0 -8
#define CFG_ERROR_NOT_SUPPORTED -9
-
+
#if defined(MSDOS) || defined(_MSDOS)
# ifndef __MSDOS__
# define __MSDOS__
@@ -191,7 +190,7 @@
typedef struct {
unsigned int version;
-
+
long integer[CFG_INTEGER_TYPE_COUNT];
unsigned char *strings[CFG_STRINGS_TYPE_COUNT];
unsigned char *prtcode[CFG_PRTCODE_TYPE_COUNT];
@@ -204,20 +203,20 @@ struct dviprt_print_s {
unsigned int bitmap_width;
unsigned int bitmap_height;
unsigned int buffer_width;
-
+
unsigned int device_x;
unsigned int device_y;
unsigned int bitmap_x;
unsigned int bitmap_y;
unsigned int last_x;
-
+
int page_count;
unsigned char far *source_buffer;
unsigned char far *encode_buffer;
unsigned char far *psource;
unsigned char far *poutput;
int tempbuffer_f;
-
+
#ifdef __PROTOTYPES__
int (*output_proc)(unsigned char far *,long ,void *);
int (*output_maximal_unit)(dviprt_print *,unsigned char far *,unsigned int );
@@ -230,7 +229,7 @@ struct dviprt_print_s {
long (*encode_encode_proc)();
#endif
void *pstream;
-
+
unsigned long output_bytes;
unsigned int uservar[CFG_USERVAL_COUNT];
};
@@ -240,13 +239,13 @@ struct dviprt_print_s {
#ifdef __PROTOTYPES__
extern int dviprt_readsrc(char *,dviprt_cfg_t *,
- unsigned char *,int ,unsigned char *, int);
+ unsigned char *,int ,unsigned char *, int);
extern int dviprt_readcfg(char *,dviprt_cfg_t *,
- unsigned char *,int , unsigned char *,int);
+ unsigned char *,int , unsigned char *,int);
extern int dviprt_beginpage(dviprt_print *);
extern long dviprt_initlibrary(dviprt_print *,dviprt_cfg_t *,
- unsigned int ,unsigned int );
+ unsigned int ,unsigned int );
extern int dviprt_endbitmap(dviprt_print *);
extern int dviprt_setstream
(dviprt_print *p,int(*f)(unsigned char far*,long,void*),void *s);
@@ -284,7 +283,6 @@ extern char *dviprt_encodename[];
#define s_cfg_h_INCLUDED
#endif /* s_cfg_h_INCLUDED */
-
#define TEMP_CODEBUF_SIZE 2048
#define TEMP_READBUF_SIZE 1024
@@ -320,16 +318,16 @@ typedef struct {
uchar *fname;
FILE *file;
int line_no;
-
+
char temp_readbuf_f;
char temp_codebuf_f;
uchar *readbuf;
uchar *codebuf;
int readbuf_size;
int codebuf_size;
-
+
uchar *pcodebuf;
-
+
uchar *token;
uchar *endtoken;
} dviprt_cfg_i;
@@ -354,6 +352,6 @@ static int dviprt_printcfgwarning(dviprt_cfg_i *,char *,int);
extern int dviprt_print_headercomment_(char *,char *,char *,FILE *);
extern char dviprt_message_buffer[];
#endif dviprlib_implementation
-
+
#define s_cfgbld_h_INCLUDED
#endif /* s_cfgbld_h_INCLUDED */
diff --git a/gs/contrib/japanese/gdev10v.c b/gs/contrib/japanese/gdev10v.c
index eeb3d72c3..58b045f03 100644
--- a/gs/contrib/japanese/gdev10v.c
+++ b/gs/contrib/japanese/gdev10v.c
@@ -39,26 +39,26 @@ copies. */
#if 0
#define prn_matrix_procs(p_open, p_get_initial_matrix, p_output_page, p_close) {\
- p_open,\
- p_get_initial_matrix,\
- NULL, /* sync_output */\
- p_output_page,\
- p_close,\
- gdev_prn_map_rgb_color,\
- gdev_prn_map_color_rgb,\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- gdev_prn_get_params,\
- gdev_prn_put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device\
+ p_open,\
+ p_get_initial_matrix,\
+ NULL, /* sync_output */\
+ p_output_page,\
+ p_close,\
+ gdev_prn_map_rgb_color,\
+ gdev_prn_map_color_rgb,\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ gdev_prn_get_params,\
+ gdev_prn_put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device\
}
#endif
@@ -78,21 +78,21 @@ gx_device_procs prn_bj10v_procs =
gx_device_printer gs_bj10v_device =
prn_device(prn_bj10v_procs, "bj10v",
- DEFAULT_WIDTH_10THS, /* width_10ths */
- DEFAULT_HEIGHT_10THS, /* height_10ths */
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0.134, 0.507, 0.166, 0.867, /* l, b, r, t margins */
- 1, bj10v_print_page);
+ DEFAULT_WIDTH_10THS, /* width_10ths */
+ DEFAULT_HEIGHT_10THS, /* height_10ths */
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0.134, 0.507, 0.166, 0.867, /* l, b, r, t margins */
+ 1, bj10v_print_page);
gx_device_printer gs_bj10vh_device =
prn_device(prn_bj10v_procs, "bj10vh",
- DEFAULT_WIDTH_10THS, /* width_10ths */
- DEFAULT_HEIGHT_10THS, /* height_10ths */
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0.134, 0.507, 0.166, 0.335, /* l, b, r, t margins */
- 1, bj10v_print_page);
+ DEFAULT_WIDTH_10THS, /* width_10ths */
+ DEFAULT_HEIGHT_10THS, /* height_10ths */
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0.134, 0.507, 0.166, 0.335, /* l, b, r, t margins */
+ 1, bj10v_print_page);
/* ------ Internal routines ------ */
@@ -102,8 +102,8 @@ gx_device_printer gs_bj10vh_device =
static void
bj10v_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
{ gx_default_get_initial_matrix(dev, pmat);
- pmat->tx -= dev_l_margin(dev) * dev->x_pixels_per_inch;
- pmat->ty -= dev_t_margin(dev) * dev->y_pixels_per_inch;
+ pmat->tx -= dev_l_margin(dev) * dev->x_pixels_per_inch;
+ pmat->ty -= dev_t_margin(dev) * dev->y_pixels_per_inch;
}
#endif
@@ -111,63 +111,63 @@ bj10v_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
/* Note: Following code is stolen from gdevp201.c. On NEC PC9801 series,
which is very popular PC in Japan, DOS printer driver strips off
- some control characters. So we must bypass the driver and put
- data directly to get correct results. */
+ some control characters. So we must bypass the driver and put
+ data directly to get correct results. */
#ifdef PC9801
static int
is_printer(gx_device_printer *pdev)
{
- return (strlen(pdev->fname) == 0 || strcmp(pdev->fname, "PRN") == 0);
+ return (strlen(pdev->fname) == 0 || strcmp(pdev->fname, "PRN") == 0);
}
static void
pc98_prn_out(int c)
{
- while(!(inportb(0x42) & 0x04));
- outportb(0x40, c);
- outportb(0x46, 0x0e);
- outportb(0x46, 0x0f);
+ while(!(inportb(0x42) & 0x04));
+ outportb(0x40, c);
+ outportb(0x46, 0x0e);
+ outportb(0x46, 0x0f);
}
static int
prn_putc(gx_device_printer *pdev, int c)
{
- if(is_printer(pdev)) {
- pc98_prn_out(c);
- return 0;
- }
- return fputc(c, pdev->file);
+ if(is_printer(pdev)) {
+ pc98_prn_out(c);
+ return 0;
+ }
+ return fputc(c, pdev->file);
}
static int
prn_puts(gx_device_printer *pdev, char *ptr)
{
- if(is_printer(pdev)) {
- while(*ptr)
- pc98_prn_out(*ptr ++);
- return 0;
- }
- return fputs(ptr, pdev->file);
+ if(is_printer(pdev)) {
+ while(*ptr)
+ pc98_prn_out(*ptr ++);
+ return 0;
+ }
+ return fputs(ptr, pdev->file);
}
static int
prn_write(gx_device_printer *pdev, char *ptr, int size)
{
- if(is_printer(pdev)) {
- while(size --)
- pc98_prn_out(*ptr ++);
- return size;
- }
- return fwrite(ptr, 1, size, pdev->file);
+ if(is_printer(pdev)) {
+ while(size --)
+ pc98_prn_out(*ptr ++);
+ return size;
+ }
+ return fwrite(ptr, 1, size, pdev->file);
}
static int
prn_flush(gx_device_printer *pdev)
{
- if(is_printer(pdev))
- return 0;
- return fflush(pdev->file);
+ if(is_printer(pdev))
+ return 0;
+ return fflush(pdev->file);
}
#else /* PC9801 */
@@ -183,152 +183,152 @@ prn_flush(gx_device_printer *pdev)
static void
bj10v_output_run(byte *data, int dnum, int bytes,
- char *mode, gx_device_printer *pdev)
+ char *mode, gx_device_printer *pdev)
{
- prn_putc(pdev, '\033');
- prn_puts(pdev, mode);
- prn_putc(pdev, dnum & 0xff);
- prn_putc(pdev, dnum >> 8);
- prn_write(pdev, data, bytes);
+ prn_putc(pdev, '\033');
+ prn_puts(pdev, mode);
+ prn_putc(pdev, dnum & 0xff);
+ prn_putc(pdev, dnum >> 8);
+ prn_write(pdev, data, bytes);
}
/* Send the page to the printer. */
static int
bj10v_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size = gdev_prn_raster((gx_device *)pdev);
- int xres = pdev->x_pixels_per_inch;
- int yres = pdev->y_pixels_per_inch;
- char *mode = (yres == 180 ?
- (xres == 180 ? "\052\047" : "\052\050") :
- "|*");
- int bits_per_column = 24 * (yres / 180);
- int bytes_per_column = bits_per_column / 8;
- int x_skip_unit = bytes_per_column * (xres / 180);
- int y_skip_unit = (yres / 180);
- byte *in = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 8, line_size, "bj10v_print_page(in)");
- byte *out = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "bj10v_print_page(out)");
- int lnum = 0;
- int y_skip = 0;
- int code = 0;
- int blank_lines = 0;
- int bytes_per_data = ((xres == 360) && (yres == 360)) ? 1 : 3;
-
- if ( in == 0 || out == 0 )
- return -1;
-
- /* Initialize the printer. */
- prn_puts(pdev, "\033@");
- /* Transfer pixels to printer */
- while ( lnum < pdev->height )
- { byte *out_beg;
- byte *out_end;
- byte *outl, *outp;
- byte *zp;
- int count, bnum;
-
- /* Copy 1 scan line and test for all zero. */
- code = gdev_prn_get_bits(pdev, lnum + blank_lines, in, NULL);
- if ( code < 0 ) goto xit;
- /* The mem... or str... functions should be faster than */
- /* the following code, but all systems seem to implement */
- /* them so badly that this code is faster. */
- { register long *zip = (long *)in;
- register int zcnt = line_size;
- static const long zeroes[4] = { 0, 0, 0, 0 };
- for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
- { if ( zip[0] | zip[1] | zip[2] | zip[3] )
- goto notz;
- }
- if ( !memcmp(in, (const char *)zeroes, zcnt) )
- { /* Line is all zero, skip */
- if (++blank_lines >= y_skip_unit) {
- lnum += y_skip_unit;
- y_skip++;
- blank_lines = 0;
- }
- continue;
- }
- }
+ int xres = pdev->x_pixels_per_inch;
+ int yres = pdev->y_pixels_per_inch;
+ char *mode = (yres == 180 ?
+ (xres == 180 ? "\052\047" : "\052\050") :
+ "|*");
+ int bits_per_column = 24 * (yres / 180);
+ int bytes_per_column = bits_per_column / 8;
+ int x_skip_unit = bytes_per_column * (xres / 180);
+ int y_skip_unit = (yres / 180);
+ byte *in = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 8, line_size, "bj10v_print_page(in)");
+ byte *out = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "bj10v_print_page(out)");
+ int lnum = 0;
+ int y_skip = 0;
+ int code = 0;
+ int blank_lines = 0;
+ int bytes_per_data = ((xres == 360) && (yres == 360)) ? 1 : 3;
+
+ if ( in == 0 || out == 0 )
+ return -1;
+
+ /* Initialize the printer. */
+ prn_puts(pdev, "\033@");
+ /* Transfer pixels to printer */
+ while ( lnum < pdev->height )
+ { byte *out_beg;
+ byte *out_end;
+ byte *outl, *outp;
+ byte *zp;
+ int count, bnum;
+
+ /* Copy 1 scan line and test for all zero. */
+ code = gdev_prn_get_bits(pdev, lnum + blank_lines, in, NULL);
+ if ( code < 0 ) goto xit;
+ /* The mem... or str... functions should be faster than */
+ /* the following code, but all systems seem to implement */
+ /* them so badly that this code is faster. */
+ { register long *zip = (long *)in;
+ register int zcnt = line_size;
+ static const long zeroes[4] = { 0, 0, 0, 0 };
+ for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
+ { if ( zip[0] | zip[1] | zip[2] | zip[3] )
+ goto notz;
+ }
+ if ( !memcmp(in, (const char *)zeroes, zcnt) )
+ { /* Line is all zero, skip */
+ if (++blank_lines >= y_skip_unit) {
+ lnum += y_skip_unit;
+ y_skip++;
+ blank_lines = 0;
+ }
+ continue;
+ }
+ }
notz:
- blank_lines = 0;
- out_end = out + bytes_per_column * pdev->width;
- /* Vertical tab to the appropriate position. */
- while ( y_skip > 255 )
- { prn_puts(pdev, "\033J\377");
- y_skip -= 255;
- }
- if ( y_skip ) {
- prn_puts(pdev, "\033J");
- prn_putc(pdev, y_skip);
- }
-
- /* Transpose in blocks of 8 scan lines. */
- for ( bnum = 0, outl = out; bnum < bits_per_column; bnum += 8, lnum += 8 )
- { int lcnt = gdev_prn_copy_scan_lines(pdev,
- lnum, in, 8 * line_size);
- byte *inp = in;
- if ( lcnt < 0 )
- { code = lcnt;
- goto xit;
- }
- if ( lcnt < 8 )
- memset(in + lcnt * line_size, 0,
- (8 - lcnt) * line_size);
- for (outp = outl ; inp < in + line_size; inp++, outp += bits_per_column )
- { memflip8x8(inp, line_size,
- outp, bytes_per_column);
- }
- outl++;
- }
-
- /* Remove trailing 0s. */
- /* Note that non zero byte always exists. */
- outl = out_end;
- while ( *--outl == 0 )
- ;
- count = ((out_end - (outl + 1)) / bytes_per_column) * bytes_per_column;
- out_end -= count;
- *out_end = 1; /* sentinel */
-
- for ( out_beg = outp = out; outp < out_end; )
- { /* Skip a run of leading 0s. */
- /* At least 10 bytes are needed to make tabbing worth it. */
- byte *zp = outp;
- int x_skip;
- while ( *outp == 0 )
- outp++;
- x_skip = ((outp - zp) / x_skip_unit) * x_skip_unit;
- outp = zp + x_skip;
- if (x_skip >= 10) {
- /* Output preceding bit data. */
- int bytes = zp - out_beg;
- if (bytes > 0)
- /* Only false at beginning of line. */
- bj10v_output_run(out_beg, bytes / bytes_per_data, bytes,
- mode, pdev);
- /* Tab over to the appropriate position. */
- { int skip = x_skip / x_skip_unit;
- prn_puts(pdev, "\033\\");
- prn_putc(pdev, skip & 0xff);
- prn_putc(pdev, skip >> 8);
- }
- out_beg = outp;
- } else
- outp += x_skip_unit;
- }
- if (out_end > out_beg) {
- int bytes = out_end - out_beg;
- bj10v_output_run(out_beg, bytes / bytes_per_data, bytes,
- mode, pdev);
- }
- prn_putc(pdev, '\r');
- y_skip = 24;
- }
-
- /* Eject the page */
+ blank_lines = 0;
+ out_end = out + bytes_per_column * pdev->width;
+ /* Vertical tab to the appropriate position. */
+ while ( y_skip > 255 )
+ { prn_puts(pdev, "\033J\377");
+ y_skip -= 255;
+ }
+ if ( y_skip ) {
+ prn_puts(pdev, "\033J");
+ prn_putc(pdev, y_skip);
+ }
+
+ /* Transpose in blocks of 8 scan lines. */
+ for ( bnum = 0, outl = out; bnum < bits_per_column; bnum += 8, lnum += 8 )
+ { int lcnt = gdev_prn_copy_scan_lines(pdev,
+ lnum, in, 8 * line_size);
+ byte *inp = in;
+ if ( lcnt < 0 )
+ { code = lcnt;
+ goto xit;
+ }
+ if ( lcnt < 8 )
+ memset(in + lcnt * line_size, 0,
+ (8 - lcnt) * line_size);
+ for (outp = outl ; inp < in + line_size; inp++, outp += bits_per_column )
+ { memflip8x8(inp, line_size,
+ outp, bytes_per_column);
+ }
+ outl++;
+ }
+
+ /* Remove trailing 0s. */
+ /* Note that non zero byte always exists. */
+ outl = out_end;
+ while ( *--outl == 0 )
+ ;
+ count = ((out_end - (outl + 1)) / bytes_per_column) * bytes_per_column;
+ out_end -= count;
+ *out_end = 1; /* sentinel */
+
+ for ( out_beg = outp = out; outp < out_end; )
+ { /* Skip a run of leading 0s. */
+ /* At least 10 bytes are needed to make tabbing worth it. */
+ byte *zp = outp;
+ int x_skip;
+ while ( *outp == 0 )
+ outp++;
+ x_skip = ((outp - zp) / x_skip_unit) * x_skip_unit;
+ outp = zp + x_skip;
+ if (x_skip >= 10) {
+ /* Output preceding bit data. */
+ int bytes = zp - out_beg;
+ if (bytes > 0)
+ /* Only false at beginning of line. */
+ bj10v_output_run(out_beg, bytes / bytes_per_data, bytes,
+ mode, pdev);
+ /* Tab over to the appropriate position. */
+ { int skip = x_skip / x_skip_unit;
+ prn_puts(pdev, "\033\\");
+ prn_putc(pdev, skip & 0xff);
+ prn_putc(pdev, skip >> 8);
+ }
+ out_beg = outp;
+ } else
+ outp += x_skip_unit;
+ }
+ if (out_end > out_beg) {
+ int bytes = out_end - out_beg;
+ bj10v_output_run(out_beg, bytes / bytes_per_data, bytes,
+ mode, pdev);
+ }
+ prn_putc(pdev, '\r');
+ y_skip = 24;
+ }
+
+ /* Eject the page */
xit: prn_putc(pdev, 014); /* form feed */
- prn_flush(pdev);
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out, bits_per_column, line_size, "bj10v_print_page(out)");
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in, 8, line_size, "bj10v_print_page(in)");
- return code;
+ prn_flush(pdev);
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out, bits_per_column, line_size, "bj10v_print_page(out)");
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in, 8, line_size, "bj10v_print_page(in)");
+ return code;
}
diff --git a/gs/contrib/japanese/gdevalps.c b/gs/contrib/japanese/gdevalps.c
index c6f3e0703..57b9d62aa 100644
--- a/gs/contrib/japanese/gdevalps.c
+++ b/gs/contrib/japanese/gdevalps.c
@@ -1,13 +1,13 @@
/* Copyright (C) 1990, 1995, 1997 Aladdin Enterprises. All rights reserved.
-
+
This file is part of Aladdin Ghostscript.
-
+
Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing. Refer to the Aladdin Ghostscript Free Public
License (the "License") for full details.
-
+
Every copy of Aladdin Ghostscript must include a copy of the License,
normally in a plain ASCII text file named PUBLIC. The License grants you
the right to copy, modify and redistribute Aladdin Ghostscript, but only
@@ -23,20 +23,20 @@
Mar. 19 1999 Ver. 0.2 old MD series monochrome compressed mode
support. contributed by Kousuke Ikeda.
- There is no printer command refernces, so the sequence of initializing,
+ There is no printer command refernces, so the sequence of initializing,
inc cartridge selecting, paper feeding and many specs are not clear yet.
ESC 0x2a 0x62 n2 n1 0x59 raster line skip command.
skip (n1 * 0x100 + n2) lines.
ESC 0x2a 0x62 n2 n1 0x54 s2 s1 raster line print command.
- skip (s1 * 0x100 + s2) * 8 dots from
+ skip (s1 * 0x100 + s2) * 8 dots from
paper side, then (n1 * 0x100 + n2) bytes
- of MSB first data streams following.
+ of MSB first data streams following.
ESC 0x2a 0x62 n2 n1 0x57 raster line print command for MD1300.
(applicable to MD1xxx and MD2xxx ?)
- (n1 * 0x100 + n2) bytes of MSB first data
- streams following,
- but the data must be compressed.
+ (n1 * 0x100 + n2) bytes of MSB first data
+ streams following,
+ but the data must be compressed.
*/
/* gdevalps.c */
@@ -62,91 +62,91 @@ static gx_device_procs prn_md_procs =
gx_device_printer far_data gs_md50Mono_device =
prn_device(prn_md_procs, "md50Mono",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, /* x_dpi */
- 600, /* y_dpi */
- 0, 0, 0, 0, /* margins */
- 1, md50m_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, /* x_dpi */
+ 600, /* y_dpi */
+ 0, 0, 0, 0, /* margins */
+ 1, md50m_print_page);
gx_device_printer far_data gs_md50Eco_device =
prn_device(prn_md_procs, "md50Eco",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, /* x_dpi */
- 600, /* y_dpi */
- 0, 0, 0, 0, /* margins */
- 1, md50e_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, /* x_dpi */
+ 600, /* y_dpi */
+ 0, 0, 0, 0, /* margins */
+ 1, md50e_print_page);
gx_device_printer far_data gs_md1xMono_device =
prn_device(prn_md_procs, "md1xMono",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, /* x_dpi */
- 600, /* y_dpi */
- 0, 0, 0, 0, /* margins */
- 1, md1xm_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, /* x_dpi */
+ 600, /* y_dpi */
+ 0, 0, 0, 0, /* margins */
+ 1, md1xm_print_page);
/* Normal black 600 x 600 dpi mode. */
static const char init_50mono[] = {
-0x1b, 0x65,
-0x1b, 0x25, 0x80, 0x41,
-0x1b, 0x1a, 0x00, 0x00, 0x4c,
-0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
-0x1b, 0x26, 0x6c, 0x07, 0x00, 0x4d,
-0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
-0x1b, 0x2a, 0x72, 0x00, 0x55,
-0x1b, 0x2a, 0x74, 0x03, 0x52,
-0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
-0x1b, 0x1a, 0x00, 0x00, 0x41,
-0x1b, 0x26, 0x6c, 0x01, 0x00, 0x43, 0x00,
-0x1b, 0x1a, 0x00, 0x00, 0x55,
-0x1b, 0x2a, 0x72, 0x01, 0x41,
-0x1b, 0x2a, 0x62, 0x00, 0x00, 0x4d,
-0x1b, 0x1a, 0x00, 0x80, 0x72,
+0x1b, 0x65,
+0x1b, 0x25, 0x80, 0x41,
+0x1b, 0x1a, 0x00, 0x00, 0x4c,
+0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
+0x1b, 0x26, 0x6c, 0x07, 0x00, 0x4d,
+0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
+0x1b, 0x2a, 0x72, 0x00, 0x55,
+0x1b, 0x2a, 0x74, 0x03, 0x52,
+0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
+0x1b, 0x1a, 0x00, 0x00, 0x41,
+0x1b, 0x26, 0x6c, 0x01, 0x00, 0x43, 0x00,
+0x1b, 0x1a, 0x00, 0x00, 0x55,
+0x1b, 0x2a, 0x72, 0x01, 0x41,
+0x1b, 0x2a, 0x62, 0x00, 0x00, 0x4d,
+0x1b, 0x1a, 0x00, 0x80, 0x72,
};
/* ECO black 600 x 600 dpi mode. */
/* If you wanto to use ECO black casette, use this sequence for initialize. */
static const char init_50eco[] = {
0x1b, 0x65,
-0x1b, 0x25, 0x80, 0x41,
-0x1b, 0x1a, 0x00, 0x00, 0x4c,
-0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
-0x1b, 0x26, 0x6c, 0x07, 0x00, 0x4d,
-0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
-0x1b, 0x2a, 0x72, 0x01, 0x55,
-0x1b, 0x2a, 0x74, 0x03, 0x52,
-0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
-0x1b, 0x1a, 0x00, 0x00, 0x41,
-0x1b, 0x1a, 0x01, 0x00, 0x43,
-0x1b, 0x26, 0x6c, 0x01, 0x00, 0x43, 0x17,
-0x1b, 0x1a, 0x00, 0x00, 0x55,
-0x1b, 0x2a, 0x72, 0x01, 0x41,
-0x1b, 0x2a, 0x62, 0x00, 0x00, 0x4d,
-0x1b, 0x1a, 0x16, 0x80, 0x72,
+0x1b, 0x25, 0x80, 0x41,
+0x1b, 0x1a, 0x00, 0x00, 0x4c,
+0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
+0x1b, 0x26, 0x6c, 0x07, 0x00, 0x4d,
+0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
+0x1b, 0x2a, 0x72, 0x01, 0x55,
+0x1b, 0x2a, 0x74, 0x03, 0x52,
+0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
+0x1b, 0x1a, 0x00, 0x00, 0x41,
+0x1b, 0x1a, 0x01, 0x00, 0x43,
+0x1b, 0x26, 0x6c, 0x01, 0x00, 0x43, 0x17,
+0x1b, 0x1a, 0x00, 0x00, 0x55,
+0x1b, 0x2a, 0x72, 0x01, 0x41,
+0x1b, 0x2a, 0x62, 0x00, 0x00, 0x4d,
+0x1b, 0x1a, 0x16, 0x80, 0x72,
};
/* Mono Black 600x600 mode for MD1300 */
static const char init_md13[] = {
-0x1b, 0x65,
-0x1b, 0x25, 0x80, 0x41,
-0x1b, 0x1a, 0x00, 0x00, 0x4c,
-0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
+0x1b, 0x65,
+0x1b, 0x25, 0x80, 0x41,
+0x1b, 0x1a, 0x00, 0x00, 0x4c,
+0x1b, 0x26, 0x6c, 0x01, 0x00, 0x48,
0x1b, 0x26, 0x6c, 0x00, 0x00, 0x4d,
-0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
-0x1b, 0x2a, 0x72, 0x00, 0x55,
-0x1b, 0x2a, 0x74, 0x03, 0x52,
-0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
-0x1b, 0x1a, 0x00, 0x00, 0x41,
+0x1b, 0x26, 0x6c, 0x04, 0x00, 0x41,
+0x1b, 0x2a, 0x72, 0x00, 0x55,
+0x1b, 0x2a, 0x74, 0x03, 0x52,
+0x1b, 0x26, 0x6c, 0xe5, 0x18, 0x50,
+0x1b, 0x1a, 0x00, 0x00, 0x41,
0x1b, 0x2a, 0x72, 0x00, 0x41,
0x1b, 0x2a, 0x62, 0x02, 0x00, 0x4d,
-0x1b, 0x1a, 0x00, 0x00, 0x72,
+0x1b, 0x1a, 0x00, 0x00, 0x72,
};
static const char end_md[] = {
0x0c,
-0x1b, 0x2a, 0x72, 0x43,
+0x1b, 0x2a, 0x72, 0x43,
0x1b, 0x25, 0x00, 0x58
};
/* ------ Internal routines ------ */
@@ -155,13 +155,13 @@ static const char end_md[] = {
static int
md_open(gx_device *pdev)
{
- static const float md_margins[4] =
- { MD_SIDE_MARGIN, MD_BOTTOM_MARGIN,
- MD_SIDE_MARGIN, MD_TOP_MARGIN
- };
+ static const float md_margins[4] =
+ { MD_SIDE_MARGIN, MD_BOTTOM_MARGIN,
+ MD_SIDE_MARGIN, MD_TOP_MARGIN
+ };
- gx_device_set_margins(pdev, md_margins, true);
- return gdev_prn_open(pdev);
+ gx_device_set_margins(pdev, md_margins, true);
+ return gdev_prn_open(pdev);
}
/* MD5000 monochrome mode entrance. */
@@ -181,7 +181,7 @@ md50e_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* MD5000 monochrome mode print. */
static int
md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
- const char *init_str, int init_size)
+ const char *init_str, int init_size)
{
int lnum;
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
@@ -200,7 +200,7 @@ md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
byte *start_data = data;
memset(data, 0, LINE_SIZE);
n = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
+ (byte *)data, line_size);
/* Remove trailing 0s. */
while ( end_data > data && end_data[-1] == 0 )
@@ -213,28 +213,28 @@ md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
if(nbyte == 0)
{
- skipping++;
- continue;
+ skipping++;
+ continue;
}
else
{
- if(skipping)
- {
- fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
- skipping = 0;
- }
- fprintf(prn_stream, "%c%c%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x54,
- nskip & 0xff, (nskip & 0xff00) / 0x100);
- fwrite(start_data, sizeof(char), nbyte, prn_stream);
+ if(skipping)
+ {
+ fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
+ skipping = 0;
+ }
+ fprintf(prn_stream, "%c%c%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x54,
+ nskip & 0xff, (nskip & 0xff00) / 0x100);
+ fwrite(start_data, sizeof(char), nbyte, prn_stream);
}
}
/* Eject Page */
fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
fflush(prn_stream);
-
+
return 0;
}
@@ -262,131 +262,131 @@ md1xm_print_page(gx_device_printer *pdev, FILE *prn_stream)
gdev_prn_copy_scan_lines(pdev, lnum, data, line_size);
/* Remove trailing 0s. */
- while ( end_data > data && end_data[-1] == 0 )
- end_data--;
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
nbyte = end_data - data_p;
if(nbyte == 0)
{
- skipping++;
- continue;
+ skipping++;
+ continue;
}
else
{
- if(skipping)
- {
- fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
- skipping = 0;
- }
-
- /* Following codes are borrowed from gdevescp.c */
-
- for ( p = data_p, q = data_p + 1; q < end_data; ){
-
- if( *p != *q ) {
-
- p += 2;
- q += 2;
-
- } else {
- /*
- ** Check behind us, just in case:
- */
-
- if( p > data_p && *p == *(p-1) )
- p--;
-
- /*
- ** walk forward, looking for matches:
- */
-
- for( q++ ; *q == *p && q < end_data ; q++ ) {
- if( (q-p) >= 128 ) {
- if( p > data_p ) {
- count = p - data_p;
- while( count > 128 ) {
- *out_data++ = '\177';
- memcpy(out_data, data_p, 128); /* data */
- data_p += 128;
- out_data += 128;
- count -= 128;
- }
- *out_data++ = (char) (count - 1); /* count */
- memcpy(out_data, data_p, count); /* data */
- out_data += count;
- }
- *out_data++ = '\201'; /* Repeat 128 times */
- *out_data++ = *p;
- p += 128;
- data_p = p;
- }
- }
-
- if( (q - p) > 2 ) { /* output this sequence */
- if( p > data_p ) {
- count = p - data_p;
- while( count > 128 ) {
- *out_data++ = '\177';
- memcpy(out_data, data_p, 128); /* data */
- data_p += 128;
- out_data += 128;
- count -= 128;
- }
- *out_data++ = (char) (count - 1); /* byte count */
- memcpy(out_data, data_p, count); /* data */
- out_data += count;
- }
- count = q - p;
- *out_data++ = (char) (256 - count + 1);
- *out_data++ = *p;
- p += count;
- data_p = p;
- } else /* add to non-repeating data list */
- p = q;
- if( q < end_data )
- q++;
- }
- }
- /*
- ** copy remaining part of line:
- */
-
- if( data_p < end_data ) {
-
- count = end_data - data_p;
-
- /*
- ** If we've had a long run of varying data followed by a
- ** sequence of repeated data and then hit the end of line,
- ** it's possible to get data counts > 128.
- */
-
- while( count > 128 ) {
- *out_data++ = '\177';
- memcpy(out_data, data_p, 128); /* data */
- data_p += 128;
- out_data += 128;
- count -= 128;
- }
-
- *out_data++ = (char) (count - 1); /* byte count */
- memcpy(out_data, data_p, count); /* data */
- out_data += count;
- }
-
- nbyte = out_data - out_start;
+ if(skipping)
+ {
+ fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
+ skipping = 0;
+ }
+
+ /* Following codes are borrowed from gdevescp.c */
+
+ for ( p = data_p, q = data_p + 1; q < end_data; ){
+
+ if( *p != *q ) {
+
+ p += 2;
+ q += 2;
+
+ } else {
+ /*
+ ** Check behind us, just in case:
+ */
+
+ if( p > data_p && *p == *(p-1) )
+ p--;
+
+ /*
+ ** walk forward, looking for matches:
+ */
+
+ for( q++ ; *q == *p && q < end_data ; q++ ) {
+ if( (q-p) >= 128 ) {
+ if( p > data_p ) {
+ count = p - data_p;
+ while( count > 128 ) {
+ *out_data++ = '\177';
+ memcpy(out_data, data_p, 128); /* data */
+ data_p += 128;
+ out_data += 128;
+ count -= 128;
+ }
+ *out_data++ = (char) (count - 1); /* count */
+ memcpy(out_data, data_p, count); /* data */
+ out_data += count;
+ }
+ *out_data++ = '\201'; /* Repeat 128 times */
+ *out_data++ = *p;
+ p += 128;
+ data_p = p;
+ }
+ }
+
+ if( (q - p) > 2 ) { /* output this sequence */
+ if( p > data_p ) {
+ count = p - data_p;
+ while( count > 128 ) {
+ *out_data++ = '\177';
+ memcpy(out_data, data_p, 128); /* data */
+ data_p += 128;
+ out_data += 128;
+ count -= 128;
+ }
+ *out_data++ = (char) (count - 1); /* byte count */
+ memcpy(out_data, data_p, count); /* data */
+ out_data += count;
+ }
+ count = q - p;
+ *out_data++ = (char) (256 - count + 1);
+ *out_data++ = *p;
+ p += count;
+ data_p = p;
+ } else /* add to non-repeating data list */
+ p = q;
+ if( q < end_data )
+ q++;
+ }
+ }
+ /*
+ ** copy remaining part of line:
+ */
+
+ if( data_p < end_data ) {
+
+ count = end_data - data_p;
+
+ /*
+ ** If we've had a long run of varying data followed by a
+ ** sequence of repeated data and then hit the end of line,
+ ** it's possible to get data counts > 128.
+ */
+
+ while( count > 128 ) {
+ *out_data++ = '\177';
+ memcpy(out_data, data_p, 128); /* data */
+ data_p += 128;
+ out_data += 128;
+ count -= 128;
+ }
+
+ *out_data++ = (char) (count - 1); /* byte count */
+ memcpy(out_data, data_p, count); /* data */
+ out_data += count;
+ }
+
+ nbyte = out_data - out_start;
fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x57);
- fwrite(out_start, sizeof(char), nbyte, prn_stream);
+ nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x57);
+ fwrite(out_start, sizeof(char), nbyte, prn_stream);
}
}
-
+
/* Eject Page */
fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
fflush(prn_stream);
-
+
return 0;
}
diff --git a/gs/contrib/japanese/gdevdmpr.c b/gs/contrib/japanese/gdevdmpr.c
index 2da8571e7..5cd5b93a9 100644
--- a/gs/contrib/japanese/gdevdmpr.c
+++ b/gs/contrib/japanese/gdevdmpr.c
@@ -1,14 +1,14 @@
/* COPYRIGHT (C) 1990, 1992 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
-
+
This file is part of Ghostscript.
-
+
Ghostscript is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
to anyone for the consequences of using it or for whether it serves any
particular purpose or works at all, unless he says so in writing. Refer
to the Ghostscript General Public License for full details.
-
+
Everyone is granted permission to copy, modify and redistribute
Ghostscript, but only under the conditions described in the Ghostscript
General Public License. A copy of this license is supposed to have been
@@ -55,13 +55,13 @@ struct gx_device_dmprt_local_s {
int x_offset;
int y_offset;
-
+
int spec_width;
int spec_height;
int max_width;
int max_height;
int dev_margin[4]; /* left bottom right top */
-
+
int prtcfg_init_f;
int verbose_f;
int debug_f;
@@ -74,7 +74,7 @@ typedef struct gx_device_dmprt_s gx_device_dmprt;
struct gx_device_dmprt_s {
gx_device_common;
gx_prn_device_common;
-
+
gx_device_dmprt_local dmprt;
};
@@ -136,7 +136,7 @@ gx_device_dmprt gs_dmprt_device = {
DEFAULT_DPI*DEFAULT_HEIGHT, /* specified height */
-1,-1, /* maximal width,height */
{ 0,0,0,0 }, /* margins */
-
+
/* status of the device */
0, /* printer configuration is not initialized */
0, /* verbose mode */
@@ -147,7 +147,6 @@ gx_device_dmprt gs_dmprt_device = {
#define ppdev ((gx_device_printer *)pdev)
#define pddev ((gx_device_dmprt *)pdev)
-
typedef struct {
char *name;
int no;
@@ -161,7 +160,6 @@ static dmprt_encoding gdev_dmprt_encode_list[] = {
{0},
};
-
/* --- Get properties of printer device. --- */
static int gdev_dmprt_get_dmprt_params(gx_device *pdev, gs_param_list *plist);
static int
@@ -173,30 +171,30 @@ gdev_dmprt_get_params(gx_device *pdev, gs_param_list *plist)
int code;
gs_param_dict dict;
const char *param_name;
-
+
if (!pddev->dmprt.prtcfg_init_f)
gdev_dmprt_init_printer_props(pddev);
dict.size = 30;
code = param_begin_write_dict(plist, (param_name = "DmprtParams"),
- &dict, false);
+ &dict, false);
if (code < 0) return code;
if (code == 0) {
code = gdev_dmprt_get_dmprt_params(pdev, dict.list);
param_end_write_dict(plist, param_name, &dict);
if (code < 0) return code;
}
-
+
dict.size = 30;
code = param_begin_write_dict(plist, (param_name = "DviprtParams"),
- &dict, false);
+ &dict, false);
if (code < 0) return code;
if (code == 0) {
code = gdev_dmprt_get_dviprt_params(pdev, dict.list);
param_end_write_dict(plist, param_name, &dict);
if (code < 0) return code;
}
-
+
{
int w = pddev->width;
int h = pddev->height;
@@ -206,7 +204,7 @@ gdev_dmprt_get_params(gx_device *pdev, gs_param_list *plist)
pddev->width = w;
pddev->height = h;
}
-
+
return code;
}
@@ -219,7 +217,7 @@ gdev_dmprt_get_dmprt_params(gx_device *pdev, gs_param_list *plist)
bool vbool;
gs_param_int_array vaint;
int int_data[4];
-
+
vlong = DEVICE_VERSION;
code = param_write_long(plist, "Version", &vlong);
if (code < 0) return code;
@@ -227,7 +225,7 @@ gdev_dmprt_get_dmprt_params(gx_device *pdev, gs_param_list *plist)
vbool = pddev->dmprt.debug_f;
code = param_write_bool(plist, "Debug", &vbool);
if (code < 0) return code;
-
+
vbool = pddev->dmprt.verbose_f;
code = param_write_bool(plist, "Verbose", &vbool);
if (code < 0) return code;
@@ -247,7 +245,7 @@ gdev_dmprt_get_dmprt_params(gx_device *pdev, gs_param_list *plist)
int_data[1] = pddev->dmprt.y_offset;
code = param_write_int_array(plist, "Offsets", &vaint);
if (code < 0) return code;
-
+
vaint.size = 4;
vaint.data = int_data;
vaint.persistent = false;
@@ -270,15 +268,15 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
const char *vchar;
int code;
int i;
-
+
vlong = pprt->integer[CFG_PINS] * 8;
code = param_write_long(plist,"Pins", &vlong);
if (code < 0) return code;
code = param_write_long(plist, "MinimalUnit",
- pprt->integer+CFG_MINIMAL_UNIT);
+ pprt->integer+CFG_MINIMAL_UNIT);
if (code < 0) return code;
code = param_write_long(plist,"MaximalUnit",
- pprt->integer+CFG_MAXIMAL_UNIT);
+ pprt->integer+CFG_MAXIMAL_UNIT);
if (code < 0) return code;
code = param_write_int(plist,"HDpi" , &pddev->dmprt.orig_x_dpi);
if (code < 0) return code;
@@ -286,7 +284,7 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
if (code < 0) return code;
code = param_write_long(plist,"Constant", pprt->integer+CFG_CONSTANT);
if (code < 0) return code;
-
+
vbool = pprt->integer[CFG_UPPER_POS] & CFG_NON_TRANSPOSE_BIT ? 0 : 1;
code = param_write_bool(plist,"Transpose", &vbool);
if (code < 0) return code;
@@ -301,7 +299,7 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
param_string_from_string(vstr, vchar);
code = param_write_string(plist, "Name", &vstr);
if (code < 0) return code;
-
+
for (i=0;gdev_dmprt_encode_list[i].name;i++) {
if (pprt->integer[CFG_ENCODE] == gdev_dmprt_encode_list[i].no)
break;
@@ -310,7 +308,7 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
param_string_from_string(vstr, gdev_dmprt_encode_list[i].name);
code = param_write_string(plist, "Encoding", &vstr);
if (code < 0) return code;
-
+
#define param_string_from_prt(ps, pprt, n) \
((ps).data = pprt->prtcode[n] ? pprt->prtcode[n] : (const byte*)"", \
(ps).size = pprt->prtcode[n] ? pprt->prtcode_size[n] : 0, \
@@ -320,16 +318,16 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
param_write_string(plist, name, &vstr))
code = param_write_prt(plist, "BitImageMode",
- pprt, CFG_BIT_IMAGE_MODE);
+ pprt, CFG_BIT_IMAGE_MODE);
if (code < 0) return code;
code = param_write_prt(plist, "SendBitImage",
- pprt, CFG_SEND_BIT_IMAGE);
+ pprt, CFG_SEND_BIT_IMAGE);
if (code < 0) return code;
code = param_write_prt(plist, "BitRowHeader",
- pprt, CFG_BIT_ROW_HEADER);
+ pprt, CFG_BIT_ROW_HEADER);
if (code < 0) return code;
code = param_write_prt(plist, "AfterBitImage",
- pprt, CFG_AFTER_BIT_IMAGE);
+ pprt, CFG_AFTER_BIT_IMAGE);
if (code < 0) return code;
code = param_write_prt(plist, "LineFeed", pprt, CFG_LINE_FEED);
if (code < 0) return code;
@@ -344,17 +342,16 @@ gdev_dmprt_get_dviprt_params(gx_device *pdev, gs_param_list *plist)
}
/* end of internal routines for get_params */
-
/* --- Put properties of printer device. --- */
static int gdev_dmprt_put_dmprt_params(gx_device *pdev, gs_param_list *plist);
static int
gdev_dmprt_put_dviprt_params(gx_device *pdev, gs_param_list *plist);
static int gdev_dmprt_put_prt_code_param(gs_param_list *plist,
- dviprt_cfg_t *pprt,
- const char* name, int idx);
+ dviprt_cfg_t *pprt,
+ const char* name, int idx);
static int
gdev_dmprt_put_prt_string_param(gs_param_list *plist,
- dviprt_cfg_t *pprt, const char* name, int idx);
+ dviprt_cfg_t *pprt, const char* name, int idx);
static int
gdev_dmprt_put_params(gx_device *pdev, gs_param_list *plist)
@@ -362,35 +359,35 @@ gdev_dmprt_put_params(gx_device *pdev, gs_param_list *plist)
int code = 0;
const char *param_name;
gs_param_dict dict;
-
+
if (!pddev->dmprt.prtcfg_init_f)
gdev_dmprt_init_printer_props(pddev);
/* dmprt parameters */
code = param_begin_read_dict(plist, (param_name = "DmprtParams"),
- &dict, false);
+ &dict, false);
if (code < 0) return code;
if (code == 0) {
code = gdev_dmprt_put_dmprt_params(pdev, dict.list);
param_end_read_dict(plist, param_name, &dict);
if (code < 0) return code;
}
-
+
/* dviprt parameters */
code = param_begin_read_dict(plist, (param_name = "DviprtParams"),
- &dict, false);
+ &dict, false);
if (code < 0) return code;
if (code == 0) {
code = gdev_dmprt_put_dviprt_params(pdev, dict.list);
param_end_read_dict(plist, param_name, &dict);
if (code < 0) return code;
}
-
+
if (pdev->is_open && code) {
int ccode = gs_closedevice(pdev);
if (ccode < 0) return ccode;
}
-
+
pddev->width = pddev->dmprt.spec_width;
pddev->height = pddev->dmprt.spec_height;
code = gdev_prn_put_params(pdev, plist);
@@ -399,14 +396,14 @@ gdev_dmprt_put_params(gx_device *pdev, gs_param_list *plist)
pddev->width -= (pddev->dmprt.dev_margin[0] + pddev->dmprt.dev_margin[2]);
pddev->height -= (pddev->dmprt.dev_margin[1] + pddev->dmprt.dev_margin[3]);
if (code < 0) return code;
-
+
if (pddev->dmprt.max_width>0 && pddev->dmprt.max_width<pddev->width)
pddev->width = pddev->dmprt.max_width;
if (pddev->dmprt.max_height>0 && pddev->dmprt.max_height<pddev->height)
pddev->height = pddev->dmprt.max_height;
-
+
dviprt_setmessagestream(pddev->dmprt.debug_f ? stderr : NULL);
-
+
return code;
}
@@ -419,14 +416,14 @@ gdev_dmprt_put_dmprt_params(gx_device *pdev, gs_param_list *plist)
long vlong;
bool vbool;
gs_param_int_array vaint;
-
+
/* debug flag */
code = param_read_bool(plist, "Debug", &vbool);
if (code < 0) return code;
if (code == 0) pddev->dmprt.debug_f = vbool;
-
+
dviprt_setmessagestream(pddev->dmprt.debug_f ? stderr : NULL);
-
+
code = param_read_bool(plist, "Verbose", &vbool);
if (code < 0) return code;
pddev->dmprt.verbose_f = vbool;
@@ -450,7 +447,7 @@ gdev_dmprt_put_dmprt_params(gx_device *pdev, gs_param_list *plist)
pddev->dmprt.x_offset = vaint.data[0];
pddev->dmprt.y_offset = vaint.data[1];
}
-
+
code = param_read_int_array(plist, "Margins", &vaint);
if (code < 0) return code;
if (code == 0) {
@@ -458,7 +455,7 @@ gdev_dmprt_put_dmprt_params(gx_device *pdev, gs_param_list *plist)
if (vaint.size != 4) return e_typecheck;
for (i=0;i<4;i++) pddev->dmprt.dev_margin[i] = vaint.data[i];
}
-
+
return code;
}
@@ -470,13 +467,13 @@ gdev_dmprt_put_dviprt_params(gx_device *pdev, gs_param_list *plist)
gs_param_string vstr;
long vlong;
bool vbool;
-
+
/* load .cfg/.src file */
code = param_read_string(plist, "FileName", &vstr);
if (code < 0) return code;
if (code == 0) {
char *filename = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), vstr.size + 1, 1,
- "gdev_dmprt_put_props(filename)");
+ "gdev_dmprt_put_props(filename)");
int ccode;
if (filename == 0) return e_VMerror;
strncpy(filename, (const char*)vstr.data, vstr.size);
@@ -509,7 +506,7 @@ gdev_dmprt_put_dviprt_params(gx_device *pdev, gs_param_list *plist)
code = param_read_long(plist, "Constant", &vlong);
if (code < 0) return code;
if (code == 0) pprt->integer[CFG_CONSTANT] = vlong;
-
+
{
long tr = pprt->integer[CFG_UPPER_POS] & CFG_NON_TRANSPOSE_BIT;
long rv = pprt->integer[CFG_UPPER_POS] & CFG_REVERSE_BIT;
@@ -527,32 +524,32 @@ gdev_dmprt_put_dviprt_params(gx_device *pdev, gs_param_list *plist)
}
code = gdev_dmprt_put_prt_code_param(plist, pprt, "BitImageMode",
- CFG_BIT_IMAGE_MODE);
+ CFG_BIT_IMAGE_MODE);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "SendBitImage",
- CFG_SEND_BIT_IMAGE);
+ CFG_SEND_BIT_IMAGE);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "BitRowHeader",
- CFG_BIT_ROW_HEADER);
+ CFG_BIT_ROW_HEADER);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "AfterBitImage",
- CFG_AFTER_BIT_IMAGE);
+ CFG_AFTER_BIT_IMAGE);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "LineFeed",
- CFG_LINE_FEED);
+ CFG_LINE_FEED);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "FormFeed",
- CFG_FORM_FEED);
+ CFG_FORM_FEED);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "NormalMode",
- CFG_NORMAL_MODE);
+ CFG_NORMAL_MODE);
if (code < 0) return code;
code = gdev_dmprt_put_prt_code_param(plist, pprt, "SkipSpaces",
- CFG_SKIP_SPACES);
+ CFG_SKIP_SPACES);
if (code < 0) return code;
code = gdev_dmprt_put_prt_string_param(plist, pprt, "Name",
- CFG_NAME);
+ CFG_NAME);
if (code < 0) return code;
code = param_read_string(plist, "Encoding", &vstr);
@@ -561,26 +558,26 @@ gdev_dmprt_put_dviprt_params(gx_device *pdev, gs_param_list *plist)
int i;
for (i=0; gdev_dmprt_encode_list[i].name ; i++) {
if (strlen(gdev_dmprt_encode_list[i].name) == vstr.size) {
- if (strncmp(gdev_dmprt_encode_list[i].name,
- vstr.data, vstr.size) == 0) {
- pprt->integer[CFG_ENCODE] = gdev_dmprt_encode_list[i].no;
- break;
- }
+ if (strncmp(gdev_dmprt_encode_list[i].name,
+ vstr.data, vstr.size) == 0) {
+ pprt->integer[CFG_ENCODE] = gdev_dmprt_encode_list[i].no;
+ break;
+ }
}
}
if (gdev_dmprt_encode_list[i].name == 0)
return e_rangecheck;
}
-
+
return code;
}
static int
gdev_dmprt_put_prt_code_param(gs_param_list *plist,
- dviprt_cfg_t *pprt, const char* name, int idx)
+ dviprt_cfg_t *pprt, const char* name, int idx)
{
gs_param_string vstr;
-
+
int code = param_read_string(plist, name, &vstr);
if (code == 0) {
int ccode = gdev_dmprt_check_code_props(vstr.data, vstr.size);
@@ -599,10 +596,10 @@ gdev_dmprt_put_prt_code_param(gs_param_list *plist,
static int
gdev_dmprt_put_prt_string_param(gs_param_list *plist,
- dviprt_cfg_t *pprt, const char* name, int idx)
+ dviprt_cfg_t *pprt, const char* name, int idx)
{
gs_param_string vstr;
-
+
int code = param_read_string(plist, name, &vstr);
if (code == 0) {
byte *pbyte;
@@ -617,7 +614,6 @@ gdev_dmprt_put_prt_string_param(gs_param_list *plist,
}
/* end of internal routines for put_params */
-
/* --- Get initial matrix. --- */
static void
gdev_dmprt_get_initial_matrix(gx_device *pdev, gs_matrix *pmat)
@@ -637,7 +633,7 @@ gdev_dmprt_open(gx_device *pdev)
pprint = &pddev->dmprt.prtinfo;
pcfg = &pddev->dmprt.prtcfg;
-
+
if ((code = gdev_prn_open(pdev)) < 0)
return code;
pcfg->integer[CFG_DPI] = (int)ppdev->x_pixels_per_inch;
@@ -646,7 +642,7 @@ gdev_dmprt_open(gx_device *pdev)
if (code < 0) return gdev_dmprt_error_no_dviprt_to_gs(code);
code = dviprt_setbuffer(pprint,NULL);
if (code < 0) return gdev_dmprt_error_no_dviprt_to_gs(code);
-
+
return 0;
}
@@ -656,7 +652,7 @@ gdev_dmprt_close(gx_device *pdev)
{
int code;
dviprt_print *pprint;
-
+
pprint = &pddev->dmprt.prtinfo;
if (!strchr(pddev->fname,'%')) {
@@ -686,12 +682,12 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
int lnum = 0;
ulong prev_bytes;
byte *in;
-
+
/* get work buffer */
in = (byte *)gs_malloc(pdev->memory->non_gc_memory, 1, i_buf_size ,"gdev_dmprt_print_page(in)");
if ( in == 0 )
return e_VMerror;
-
+
/* Initialize this printer driver */
if (pdev->file_is_new) {
code = dviprt_setstream(pprint,NULL,prn_stream);
@@ -711,30 +707,30 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
prev_bytes = dviprt_getoutputbytes(pprint);
code = dviprt_beginpage(pprint);
if (code < 0) return gdev_dmprt_error_no_dviprt_to_gs(code);
-
+
/* Transfer pixels to printer */
- while ( lnum < pdev->height ) {
+ while ( lnum < pdev->height ) {
int num_lines;
-
+
num_lines = pdev->height-lnum;
if (num_lines > pins)
num_lines = pins;
-
+
code = gdev_prn_copy_scan_lines(pdev,lnum,in,line_size*num_lines);
if (code < 0) goto error_ex;
-
+
lnum += num_lines;
if (num_lines < pins) {
memset(in+line_size*num_lines,0,line_size*(pins-num_lines));
}
-
+
code = dviprt_outputscanlines(pprint,in);
if (code < 0) {
code = gdev_dmprt_error_no_dviprt_to_gs(code);
goto error_ex;
}
}
-
+
/* Eject the page and set printer normal mode. */
if (strchr(pdev->fname,'%')) {
code = dviprt_endbitmap(pprint);
@@ -748,11 +744,10 @@ gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
}
error_ex:
gs_free(pdev->memory->non_gc_memory, (char *)in, 1, i_buf_size,"gdev_dmprt_print_page(in)");
-
+
return code;
}
-
/************************** Internal Routines **************************/
/************************ Get printer properties. ***********************/
@@ -787,7 +782,7 @@ gdev_dmprt_init_printer_props(gx_device_dmprt *pdev)
int i;
pprt = &pdev->dmprt.prtcfg;
-
+
for (i=0;i<CFG_INTEGER_TYPE_COUNT;i++)
pprt->integer[i] = 0;
for (i=0;i<CFG_STRINGS_TYPE_COUNT;i++)
@@ -809,7 +804,7 @@ gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
fname = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 256,1,"dviprt_lib_fname");
if (fname == NULL) return e_VMerror;
-
+
fp = gdev_dmprt_dviprt_lib_fopen(fnamebase,fname);
if (fp == NULL) {
return e_undefinedfilename;
@@ -818,7 +813,7 @@ gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
return e_ioerror;
code = fgetc(fp);
fclose(fp);
-
+
if (code == EOF)
code = e_ioerror;
else if (code == 0xff) {
@@ -827,7 +822,7 @@ gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
else {
code = dviprt_readsrc(fname,&cfg,NULL,0,NULL,0);
}
-
+
if (code < 0) {
code = gdev_dmprt_error_no_dviprt_to_gs(code);
}
@@ -837,9 +832,9 @@ gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
pddev->dmprt.orig_y_dpi =
cfg.integer[CFG_Y_DPI] > 0 ? cfg.integer[CFG_Y_DPI] : pddev->dmprt.orig_x_dpi;
}
-
+
gs_free(gs_lib_ctx_get_non_gc_memory_t(), fname,256,1,"dviprt_lib_fname");
-
+
return code;
}
diff --git a/gs/contrib/japanese/gdevespg.c b/gs/contrib/japanese/gdevespg.c
index c4c05905a..bc37a8fe7 100644
--- a/gs/contrib/japanese/gdevespg.c
+++ b/gs/contrib/japanese/gdevespg.c
@@ -50,13 +50,13 @@ lprn_procs(escpage_open, gdev_prn_output_page, escpage_close);
gx_device_lprn far_data gs_lp2000_device =
lprn_device(gx_device_lprn, lp2000_prn_procs, "lp2000",
- DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
- lp2000_print_page_copies, escpage_image_out);
+ DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
+ lp2000_print_page_copies, escpage_image_out);
gx_device_lprn far_data gs_escpage_device =
lprn_duplex_device(gx_device_lprn, escpage_prn_procs, "escpage",
- DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
- escpage_print_page_copies, escpage_image_out);
+ DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
+ escpage_print_page_copies, escpage_image_out);
#define ppdev ((gx_device_printer *)pdev)
@@ -71,9 +71,9 @@ escpage_open(gx_device * pdev)
/* Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (xdpi < 60 || xdpi > 600)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gdev_prn_open(pdev);
}
@@ -86,9 +86,9 @@ lp2000_open(gx_device * pdev)
/* Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (xdpi < 60 || xdpi > 300)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gdev_prn_open(pdev);
}
@@ -98,7 +98,7 @@ escpage_close(gx_device * pdev)
{
gdev_prn_open_printer(pdev, 1);
if (ppdev->Duplex && (pdev->PageCount & 1)) {
- fprintf(ppdev->file, "%c0dpsE", GS);
+ fprintf(ppdev->file, "%c0dpsE", GS);
}
fputs(epson_remote_start, ppdev->file);
fputs(epson_remote_start, ppdev->file);
@@ -111,21 +111,21 @@ escpage_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
if (pdev->PageCount == 0) {
- double xDpi = pdev->x_pixels_per_inch;
+ double xDpi = pdev->x_pixels_per_inch;
- /* Goto REMOTE MODE */
- fputs(epson_remote_start, fp);
- fprintf(fp, "@EJL SELECT LANGUAGE=ESC/PAGE\r\n");
+ /* Goto REMOTE MODE */
+ fputs(epson_remote_start, fp);
+ fprintf(fp, "@EJL SELECT LANGUAGE=ESC/PAGE\r\n");
- /* RIT (Resolution Improvement Technology) Setting */
- if (lprn->RITOff)
- fprintf(fp, "@EJL SET RI=OFF\r\n");
- else
- fprintf(fp, "@EJL SET RI=ON\r\n");
+ /* RIT (Resolution Improvement Technology) Setting */
+ if (lprn->RITOff)
+ fprintf(fp, "@EJL SET RI=OFF\r\n");
+ else
+ fprintf(fp, "@EJL SET RI=ON\r\n");
- /* Resolution Setting */
- fprintf(fp, "@EJL SET RS=%s\r\n", xDpi > 300 ? "FN" : "QK");
- fprintf(fp, "@EJL ENTER LANGUAGE=ESC/PAGE\r\n");
+ /* Resolution Setting */
+ fprintf(fp, "@EJL SET RS=%s\r\n", xDpi > 300 ? "FN" : "QK");
+ fprintf(fp, "@EJL ENTER LANGUAGE=ESC/PAGE\r\n");
}
return lp2000_print_page_copies(pdev, fp, num_coipes);
}
@@ -140,26 +140,26 @@ lp2000_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
/* printer initialize */
if (pdev->PageCount == 0)
- escpage_printer_initialize(pdev, fp, num_coipes);
+ escpage_printer_initialize(pdev, fp, num_coipes);
if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "lp2000_print_page_copies(CompBuf)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (lprn->NegativePrint) {
- fprintf(fp, "%c1dmG", GS);
- fprintf(fp, "%c0;0;%d;%d;0rG", GS, pdev->width, pdev->height);
- fprintf(fp, "%c2owE", GS);
+ fprintf(fp, "%c1dmG", GS);
+ fprintf(fp, "%c0;0;%d;%d;0rG", GS, pdev->width, pdev->height);
+ fprintf(fp, "%c2owE", GS);
}
code = lprn_print_image(pdev, fp);
if (code < 0)
- return code;
+ return code;
gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "lp2000_print_page_copies(CompBuf)");
if (pdev->Duplex)
- fprintf(fp, "%c0dpsE", GS);
+ fprintf(fp, "%c0dpsE", GS);
else
- fprintf(fp, "\014"); /* eject page */
+ fprintf(fp, "\014"); /* eject page */
return code;
}
@@ -175,13 +175,13 @@ escpage_image_out(gx_device_printer * pdev, FILE * fp, int x, int y, int width,
Len = lips_mode3format_encode(lprn->TmpBuf, lprn->CompBuf, width / 8 * height);
fprintf(fp, "%c%d;%d;%d;0bi{I", GS, Len,
- width, height);
+ width, height);
fwrite(lprn->CompBuf, 1, Len, fp);
if (lprn->ShowBubble) {
- fprintf(fp, "%c0dmG", GS);
- fprintf(fp, "%c%d;%d;%d;%d;0rG", GS,
- x, y, x + width, y + height);
+ fprintf(fp, "%c0dmG", GS);
+ fprintf(fp, "%c%d;%d;%d;%d;0rG", GS,
+ x, y, x + width, y + height);
}
}
@@ -212,14 +212,14 @@ escpage_printer_initialize(gx_device_printer * pdev, FILE * fp, int copies)
fwrite(can_inits, sizeof(can_inits), 1, fp);
/* Duplex Setting */
if (pdev->Duplex_set > 0) {
- if (pdev->Duplex) {
- fprintf(fp, "%c1sdE", GS);
- if (lprn->Tumble == 0)
- fprintf(fp, "%c0bdE", GS);
- else
- fprintf(fp, "%c1bdE", GS);
- } else
- fprintf(fp, "%c0sdE", GS);
+ if (pdev->Duplex) {
+ fprintf(fp, "%c1sdE", GS);
+ if (lprn->Tumble == 0)
+ fprintf(fp, "%c0bdE", GS);
+ else
+ fprintf(fp, "%c1bdE", GS);
+ } else
+ fprintf(fp, "%c0sdE", GS);
}
/* Set the Size Unit */
fprintf(fp, "%c0;%4.2fmuE", GS, 72.0 / xDpi);
@@ -275,26 +275,26 @@ escpage_paper_set(gx_device_printer * pdev, FILE * fp)
height = pdev->MediaSize[1];
if (width < height) {
- bLandscape = 0;
- w = width;
- h = height;
- wp = width / 72.0 * pdev->x_pixels_per_inch;
- hp = height / 72.0 * pdev->y_pixels_per_inch;
+ bLandscape = 0;
+ w = width;
+ h = height;
+ wp = width / 72.0 * pdev->x_pixels_per_inch;
+ hp = height / 72.0 * pdev->y_pixels_per_inch;
} else {
- bLandscape = 1;
- w = height;
- h = width;
- wp = height / 72.0 * pdev->y_pixels_per_inch;
- hp = width / 72.0 * pdev->x_pixels_per_inch;
+ bLandscape = 1;
+ w = height;
+ h = width;
+ wp = height / 72.0 * pdev->y_pixels_per_inch;
+ hp = width / 72.0 * pdev->x_pixels_per_inch;
}
for (pt = epagPaperTable; pt->escpage > 0; pt++)
- if (pt->width == w && pt->height == h)
- break;
+ if (pt->width == w && pt->height == h)
+ break;
fprintf(fp, "%c%d", GS, pt->escpage);
if (pt->escpage < 0)
- fprintf(fp, ";%d;%d", wp, hp);
+ fprintf(fp, ";%d;%d", wp, hp);
fprintf(fp, "psE");
fprintf(fp, "%c%dpoE", GS, bLandscape);
diff --git a/gs/contrib/japanese/gdevfmlbp.c b/gs/contrib/japanese/gdevfmlbp.c
index 7d3723583..2fd116760 100644
--- a/gs/contrib/japanese/gdevfmlbp.c
+++ b/gs/contrib/japanese/gdevfmlbp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
This file is part of Ghostscript.
@@ -64,11 +64,11 @@ fmlbp_get_initial_matrix(gx_device *dev, gs_matrix *pmat)
gx_device_printer gs_fmlbp_device =
prn_device(PRNFMLBP, "fmlbp",
- DEFAULT_WIDTH_10THS_A4, /* width_10ths, 8.3" */
- DEFAULT_HEIGHT_10THS_A4, /* height_10ths, 11.7" */
- X_DPI, Y_DPI,
- 0.20, 0.35, 0.21, 0.20, /* left,bottom,right,top margins */
- 1, fmlbp_print_page);
+ DEFAULT_WIDTH_10THS_A4, /* width_10ths, 8.3" */
+ DEFAULT_HEIGHT_10THS_A4, /* height_10ths, 11.7" */
+ X_DPI, Y_DPI,
+ 0.20, 0.35, 0.21, 0.20, /* left,bottom,right,top margins */
+ 1, fmlbp_print_page);
/* ------ Internal routines ------ */
@@ -122,13 +122,12 @@ gdev_fmlbp_paper_size(gx_device_printer *dev)
height_inches >= 7.6 ? PAPER_SIZE_A5 : PAPER_SIZE_HAGAKI), landscape);
#ifdef FMLBP_DEBUG
dprintf5("w=%d(%f) x h=%d(%f) -> %s\n",
- dev->width, width_inches, dev->height, height_inches, paper);
+ dev->width, width_inches, dev->height, height_inches, paper);
#endif/*FMLBP_DEBUG*/
return paper;
}
#endif/*FMLBP_NOPAPERSIZE*/
-
/* move down and move across */
static void goto_xy(FILE *prn_stream,int x,int y)
{
@@ -140,20 +139,20 @@ static void goto_xy(FILE *prn_stream,int x,int y)
sprintf(buff,"%d",x);
while (*p)
{
- if (!*(p+1)) fputc((*p)+0x30,prn_stream);
- else
- fputc((*p)-0x10,prn_stream);
- p++;
+ if (!*(p+1)) fputc((*p)+0x30,prn_stream);
+ else
+ fputc((*p)-0x10,prn_stream);
+ p++;
}
p=buff;
sprintf(buff,"%d",y);
while (*p)
{
- if (!*(p+1)) fputc((*p)+0x40,prn_stream);
- else
- fputc((*p)-0x10,prn_stream);
- p++;
+ if (!*(p+1)) fputc((*p)+0x40,prn_stream);
+ else
+ fputc((*p)-0x10,prn_stream);
+ p++;
}
}
@@ -174,49 +173,49 @@ fmlbp_print_page(gx_device_printer *pdev, FILE *prn_stream)
fprintf(prn_stream, "%c%c%d!I", PU1, 0); /* 100% */
#ifndef OLD_FMLBP_400DPI
fprintf(prn_stream, "%c%c%d!A", PU1,
- (int)(pdev->x_pixels_per_inch)); /* 240dpi or 400dpi */
+ (int)(pdev->x_pixels_per_inch)); /* 240dpi or 400dpi */
#endif/*!OLD_FMLBP_400DPI*/
#ifndef FMLBP_NOPAPERSIZE
fprintf(prn_stream, "%c%c%s!F", PU1,
- gdev_fmlbp_paper_size(pdev)); /* Paper size */
+ gdev_fmlbp_paper_size(pdev)); /* Paper size */
#endif/*!FMLBP_NOPAPERSIZE*/
/* Send each scan line in turn */
{ int lnum;
- byte rmask = (byte)(0xff << (-pdev->width & 7));
-
- for ( lnum = 0; lnum < pdev->height; lnum++ )
- { byte *end_data = data + line_size;
- int s = gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *)data, line_size);
- if(s < 0) return_error(s);
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while ( end_data > data && end_data[-1] == 0 )
- end_data--;
- if ( end_data != data ) {
- int num_cols = 0;
- int out_count = 0;
- byte *out_data = data;
-
- while(out_data < end_data && *out_data == 0) {
- num_cols += 8;
- out_data++;
- }
- out_count = end_data - out_data;
-
- /* move down */ /* move across */
- goto_xy(prn_stream, num_cols, lnum);
-
- /* transfer raster graphics */
- fprintf(prn_stream, "%c%c%d;%d;0!a",
- PU1, out_count, out_count*8 );
-
- /* send the row */
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
- }
- }
+ byte rmask = (byte)(0xff << (-pdev->width & 7));
+
+ for ( lnum = 0; lnum < pdev->height; lnum++ )
+ { byte *end_data = data + line_size;
+ int s = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ if(s < 0) return_error(s);
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data != data ) {
+ int num_cols = 0;
+ int out_count = 0;
+ byte *out_data = data;
+
+ while(out_data < end_data && *out_data == 0) {
+ num_cols += 8;
+ out_data++;
+ }
+ out_count = end_data - out_data;
+
+ /* move down */ /* move across */
+ goto_xy(prn_stream, num_cols, lnum);
+
+ /* transfer raster graphics */
+ fprintf(prn_stream, "%c%c%d;%d;0!a",
+ PU1, out_count, out_count*8 );
+
+ /* send the row */
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ }
+ }
}
/* eject page */
fputc(0x0c,prn_stream);
diff --git a/gs/contrib/japanese/gdevfmpr.c b/gs/contrib/japanese/gdevfmpr.c
index 9dfd1d95f..a17d7f344 100644
--- a/gs/contrib/japanese/gdevfmpr.c
+++ b/gs/contrib/japanese/gdevfmpr.c
@@ -31,15 +31,15 @@ static dev_proc_print_page(fmpr_print_page);
/* The device descriptor */
gx_device_printer gs_fmpr_device =
prn_device(prn_std_procs, "fmpr",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 180, /* x_dpi */
- 180, /* y_dpi */
- 0, /* 0.35, */ /* left margins */
- 0, /* bottom margins */
- 0, /* 0.84, */ /* top margins */
- 0, /* right margins */
- 1, fmpr_print_page);
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 180, /* x_dpi */
+ 180, /* y_dpi */
+ 0, /* 0.35, */ /* left margins */
+ 0, /* bottom margins */
+ 0, /* 0.84, */ /* top margins */
+ 0, /* right margins */
+ 1, fmpr_print_page);
/* ---- Printer output routines ---- */
@@ -140,7 +140,7 @@ fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
num_lines = bits_per_column;
size = line_size * num_lines;
- if(in[0] == 0 &&
+ if(in[0] == 0 &&
!memcmp((char *)in, (char *)in + 1, size - 1)) {
lnum += bits_per_column;
prn_putc(pdev, '\n');
@@ -157,10 +157,10 @@ fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
inp = in + line_size * 8 * y;
outp = out + y;
for(x = 0; x < line_size; x ++) {
- fmpr_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- inp ++;
- outp += bits_per_column;
+ fmpr_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ inp ++;
+ outp += bits_per_column;
}
}
@@ -168,7 +168,7 @@ fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
out_end = out + chunk_size - 1;
while(out_end >= out) {
if(*out_end)
- break;
+ break;
out_end --;
}
size = (out_end - out) + 1;
@@ -179,13 +179,13 @@ fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
out_beg = out;
while(out_beg <= out_end) {
if(*out_beg)
- break;
+ break;
out_beg ++;
}
out_beg -= (out_beg - out) % bytes_per_column;
- sprintf(prn_buf, "\033[%da",
- (out_beg - out) / bytes_per_column);
+ sprintf(prn_buf, "\033[%da",
+ (out_beg - out) / bytes_per_column);
prn_puts(pdev, prn_buf);
/* Dot graphics */
@@ -201,10 +201,10 @@ fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
prn_putc(pdev, '\f');
prn_flush(pdev);
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
- bits_per_column, line_size, "fmpr_print_page(out)");
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
+ bits_per_column, line_size, "fmpr_print_page(out)");
gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in,
- bits_per_column, line_size, "fmpr_print_page(in)");
+ bits_per_column, line_size, "fmpr_print_page(in)");
return 0;
}
diff --git a/gs/contrib/japanese/gdevj100.c b/gs/contrib/japanese/gdevj100.c
index d8130ec23..127abff8b 100644
--- a/gs/contrib/japanese/gdevj100.c
+++ b/gs/contrib/japanese/gdevj100.c
@@ -32,10 +32,10 @@ gx_device_printer gs_jj100_device =
prn_device(prn_std_procs, "jj100",
82, /* width_10ths, 8.2" = 210mm(A4) */
115 /*113, 117*/, /* height_10ths, 11.7" = 297mm(A4) */
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0,0,0,0, /* margins */
- 1, jj100_print_page);
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, jj100_print_page);
/* ------ internal routines ------ */
@@ -43,158 +43,158 @@ gx_device_printer gs_jj100_device =
static int
jj100_transpose_8x8(byte *src, int src_step, byte *dst, int dst_step)
{
- byte mask, s, d0, d1, d2, d3, d4, d5, d6, d7;
- int i;
-
- d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;
-
- for(i=0, mask=0x01; i<8; i++, mask <<= 1) {
- s = *src;
- if(s & 0x80) d0 |= mask;
- if(s & 0x40) d1 |= mask;
- if(s & 0x20) d2 |= mask;
- if(s & 0x10) d3 |= mask;
- if(s & 0x08) d4 |= mask;
- if(s & 0x04) d5 |= mask;
- if(s & 0x02) d6 |= mask;
- if(s & 0x01) d7 |= mask;
- src += src_step;
- }
-
- *dst = d0;
- *(dst += dst_step) = d1;
- *(dst += dst_step) = d2;
- *(dst += dst_step) = d3;
- *(dst += dst_step) = d4;
- *(dst += dst_step) = d5;
- *(dst += dst_step) = d6;
- *(dst += dst_step) = d7;
-
- return 0;
+ byte mask, s, d0, d1, d2, d3, d4, d5, d6, d7;
+ int i;
+
+ d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;
+
+ for(i=0, mask=0x01; i<8; i++, mask <<= 1) {
+ s = *src;
+ if(s & 0x80) d0 |= mask;
+ if(s & 0x40) d1 |= mask;
+ if(s & 0x20) d2 |= mask;
+ if(s & 0x10) d3 |= mask;
+ if(s & 0x08) d4 |= mask;
+ if(s & 0x04) d5 |= mask;
+ if(s & 0x02) d6 |= mask;
+ if(s & 0x01) d7 |= mask;
+ src += src_step;
+ }
+
+ *dst = d0;
+ *(dst += dst_step) = d1;
+ *(dst += dst_step) = d2;
+ *(dst += dst_step) = d3;
+ *(dst += dst_step) = d4;
+ *(dst += dst_step) = d5;
+ *(dst += dst_step) = d6;
+ *(dst += dst_step) = d7;
+
+ return 0;
}
/* Send the page to the printer. */
static int
jj100_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size = gdev_prn_raster(pdev);
- int height = pdev->height;
- int bits_per_column = 48;
- int bytes_per_column = bits_per_column / 8;
- int chunk_size = bits_per_column * line_size;
- byte *in, *out;
- int lnum, skip;
- char prn_buf[16];
-
- in = (byte *)
- gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "jj100_print_page(in)");
- out = (byte *)
- gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "jj100_print_page(out)");
- if(in == 0 || out == 0)
- return -1;
-
- /* Initialize printer */
- fputs("\033P", pdev->file); /* Proportional Mode */
+ int height = pdev->height;
+ int bits_per_column = 48;
+ int bytes_per_column = bits_per_column / 8;
+ int chunk_size = bits_per_column * line_size;
+ byte *in, *out;
+ int lnum, skip;
+ char prn_buf[16];
+
+ in = (byte *)
+ gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "jj100_print_page(in)");
+ out = (byte *)
+ gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "jj100_print_page(out)");
+ if(in == 0 || out == 0)
+ return -1;
+
+ /* Initialize printer */
+ fputs("\033P", pdev->file); /* Proportional Mode */
fputs("\033G", pdev->file); /* 1/180 inch per line */
- fputs("\033T16", pdev->file); /* 16/180 inch per line */
-
- /* Send Data to printer */
- lnum = 0;
- skip = 0;
- while(lnum < height) {
- byte *inp, *outp, *out_beg, *out_end;
- int x, y, num_lines, size, mod;
-
- /* Copy scan lines */
- if(gdev_prn_copy_scan_lines(pdev, lnum, in, chunk_size) < 0)
- break;
-
- /* The number of lines to process */
- if((num_lines = height - lnum) > bits_per_column)
- num_lines = bits_per_column;
-
- /* Test for all zero */
- size = line_size * num_lines;
- if(in[0] == 0 &&
- !memcmp((char *)in, (char *)in + 1, size - 1)) {
- lnum += bits_per_column;
- skip ++;
- continue;
- }
-
- /* Fill zero */
- if(num_lines < bits_per_column) {
- size = line_size * (bits_per_column - num_lines);
- memset(in + line_size * num_lines, 0, size);
- }
- lnum += bits_per_column;
-
- /* Vertical tab to the appropriate position. */
- while(skip > 15) {
- sprintf(prn_buf, "\037%c", 16 + 15);
- fputs(prn_buf, pdev->file);
- skip -= 15;
- }
- if(skip > 0) {
- sprintf(prn_buf, "\037%c", 16 + skip);
- fputs(prn_buf, pdev->file);
- }
-
- /* Transpose in blocks of 8 scan lines. */
- for(y = 0; y < bytes_per_column; y ++) {
- inp = in + line_size * 8 * y;
- outp = out + y;
- for(x = 0; x < line_size; x ++) {
- jj100_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- inp ++;
- outp += bits_per_column;
- }
- }
-
- /* Remove trailing 0s. */
- out_end = out + chunk_size - 1;
- while(out_end >= out) {
- if(*out_end)
- break;
- out_end --;
- }
- size = (out_end - out) + 1;
- if((mod = size % bytes_per_column) != 0)
- out_end += bytes_per_column - mod;
-
- /* Remove leading 0s. */
- out_beg = out;
- while(out_beg <= out_end) {
- if(*out_beg)
- break;
- out_beg ++;
- }
- out_beg -= (out_beg - out) % (bytes_per_column * 2);
-
- /* Dot addressing */
- sprintf(prn_buf, "\033F%04d",
- (out_beg - out) / bytes_per_column / 2);
- fputs(prn_buf, pdev->file);
-
- /* Dot graphics */
- size = out_end - out_beg + 1;
- sprintf(prn_buf, "\034bP,48,%04d.", size / bytes_per_column);
- fputs(prn_buf, pdev->file);
- fwrite(out_beg, 1, size, pdev->file);
-
- /* Carriage Return */
- fputc('\r', pdev->file);
- skip = 1;
- }
-
- /* Form Feed */
- fputc('\f', pdev->file);
- fflush(pdev->file);
-
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
- bits_per_column, line_size, "jj100_print_page(out)");
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in,
- bits_per_column, line_size, "jj100_print_page(in)");
-
- return 0;
+ fputs("\033T16", pdev->file); /* 16/180 inch per line */
+
+ /* Send Data to printer */
+ lnum = 0;
+ skip = 0;
+ while(lnum < height) {
+ byte *inp, *outp, *out_beg, *out_end;
+ int x, y, num_lines, size, mod;
+
+ /* Copy scan lines */
+ if(gdev_prn_copy_scan_lines(pdev, lnum, in, chunk_size) < 0)
+ break;
+
+ /* The number of lines to process */
+ if((num_lines = height - lnum) > bits_per_column)
+ num_lines = bits_per_column;
+
+ /* Test for all zero */
+ size = line_size * num_lines;
+ if(in[0] == 0 &&
+ !memcmp((char *)in, (char *)in + 1, size - 1)) {
+ lnum += bits_per_column;
+ skip ++;
+ continue;
+ }
+
+ /* Fill zero */
+ if(num_lines < bits_per_column) {
+ size = line_size * (bits_per_column - num_lines);
+ memset(in + line_size * num_lines, 0, size);
+ }
+ lnum += bits_per_column;
+
+ /* Vertical tab to the appropriate position. */
+ while(skip > 15) {
+ sprintf(prn_buf, "\037%c", 16 + 15);
+ fputs(prn_buf, pdev->file);
+ skip -= 15;
+ }
+ if(skip > 0) {
+ sprintf(prn_buf, "\037%c", 16 + skip);
+ fputs(prn_buf, pdev->file);
+ }
+
+ /* Transpose in blocks of 8 scan lines. */
+ for(y = 0; y < bytes_per_column; y ++) {
+ inp = in + line_size * 8 * y;
+ outp = out + y;
+ for(x = 0; x < line_size; x ++) {
+ jj100_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ inp ++;
+ outp += bits_per_column;
+ }
+ }
+
+ /* Remove trailing 0s. */
+ out_end = out + chunk_size - 1;
+ while(out_end >= out) {
+ if(*out_end)
+ break;
+ out_end --;
+ }
+ size = (out_end - out) + 1;
+ if((mod = size % bytes_per_column) != 0)
+ out_end += bytes_per_column - mod;
+
+ /* Remove leading 0s. */
+ out_beg = out;
+ while(out_beg <= out_end) {
+ if(*out_beg)
+ break;
+ out_beg ++;
+ }
+ out_beg -= (out_beg - out) % (bytes_per_column * 2);
+
+ /* Dot addressing */
+ sprintf(prn_buf, "\033F%04d",
+ (out_beg - out) / bytes_per_column / 2);
+ fputs(prn_buf, pdev->file);
+
+ /* Dot graphics */
+ size = out_end - out_beg + 1;
+ sprintf(prn_buf, "\034bP,48,%04d.", size / bytes_per_column);
+ fputs(prn_buf, pdev->file);
+ fwrite(out_beg, 1, size, pdev->file);
+
+ /* Carriage Return */
+ fputc('\r', pdev->file);
+ skip = 1;
+ }
+
+ /* Form Feed */
+ fputc('\f', pdev->file);
+ fflush(pdev->file);
+
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
+ bits_per_column, line_size, "jj100_print_page(out)");
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in,
+ bits_per_column, line_size, "jj100_print_page(in)");
+
+ return 0;
}
diff --git a/gs/contrib/japanese/gdevlbp3.c b/gs/contrib/japanese/gdevlbp3.c
index 8f837c1c2..02872c187 100644
--- a/gs/contrib/japanese/gdevlbp3.c
+++ b/gs/contrib/japanese/gdevlbp3.c
@@ -4,7 +4,7 @@
*
* If any comment, write to naoya@mahoroba.ne.jp
*/
-
+
#include "gdevprn.h"
#define mm_to_inch(x) (x)/25.4
@@ -16,54 +16,54 @@ static dev_proc_print_page(lbp320PrintPage);
gx_device_printer far_data gs_lbp310_device =
prn_device(prn_std_procs,
- "lbp310",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, 600,
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- 1, lbp310PrintPage);
+ "lbp310",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, 600,
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ 1, lbp310PrintPage);
gx_device_printer far_data gs_lbp320_device =
prn_device(prn_std_procs,
- "lbp320",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 600, 600,
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- mm_to_inch(5.0),
- 1, lbp320PrintPage);
+ "lbp320",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 600, 600,
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ mm_to_inch(5.0),
+ 1, lbp320PrintPage);
enum Paper
- {
- a4, a5, postcard, b5, letter
- };
+ {
+ a4, a5, postcard, b5, letter
+ };
struct bounding
- {
- enum Paper paper;
- int Top, Bottom, Left, Right;
- };
+ {
+ enum Paper paper;
+ int Top, Bottom, Left, Right;
+ };
struct ppi
- {
- int w;
- int h;
- int id;
- };
+ {
+ int w;
+ int h;
+ int id;
+ };
static const struct ppi PaperInfo[] =
{
- {2100, 2960, 14}, /* A4 */
- {1485, 2098, 16}, /* A5 */
- {1000, 1480, 18}, /* Postcard */
- {1820, 2570, 26}, /* B5 */
- {2100, 2790, 14} /* Letter */
- };
+ {2100, 2960, 14}, /* A4 */
+ {1485, 2098, 16}, /* A5 */
+ {1000, 1480, 18}, /* Postcard */
+ {1820, 2570, 26}, /* B5 */
+ {2100, 2790, 14} /* Letter */
+ };
static void BoundImage(gx_device_printer *, struct bounding *);
static long CompressImage(gx_device_printer *, struct bounding *, FILE *, const char *);
@@ -71,207 +71,207 @@ static long CompressImage(gx_device_printer *, struct bounding *, FILE *, const
static int
lbp310PrintPage(gx_device_printer *pDev, FILE *fp)
{
- int i;
- byte Buf[10];
- long DataSize;
- struct bounding Box;
+ int i;
+ byte Buf[10];
+ long DataSize;
+ struct bounding Box;
- BoundImage(pDev, &Box);
+ BoundImage(pDev, &Box);
- DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.r");
+ DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.r");
- /* ----==== Set size ====---- */
- sprintf(Buf, "0%ld", DataSize);
- i = (DataSize+strlen(Buf)+1)&1;
- /* ----==== escape to LIPS ====---- */
- fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
- fprintf(fp, "\x1bP0J\x1b\\");
+ /* ----==== Set size ====---- */
+ sprintf(Buf, "0%ld", DataSize);
+ i = (DataSize+strlen(Buf)+1)&1;
+ /* ----==== escape to LIPS ====---- */
+ fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
+ fprintf(fp, "\x1bP0J\x1b\\");
- return(0);
+ return(0);
}
static int
lbp320PrintPage(gx_device_printer *pDev, FILE *fp)
{
- int i;
- byte Buf[16];
- long DataSize;
- struct bounding Box;
+ int i;
+ byte Buf[16];
+ long DataSize;
+ struct bounding Box;
- BoundImage(pDev, &Box);
+ BoundImage(pDev, &Box);
- /* ----==== fix bounding box 4-byte align ====---- */
- Box.Left &= ~1;
- Box.Right |= 1;
+ /* ----==== fix bounding box 4-byte align ====---- */
+ Box.Left &= ~1;
+ Box.Right |= 1;
- /* ----==== JOB start ??? ====---- */
- fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL JOB\n");
+ /* ----==== JOB start ??? ====---- */
+ fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL JOB\n");
- DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.&r");
+ DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.&r");
- /* ----==== Set size ====---- */
- sprintf(Buf, "000%ld", DataSize);
- i = (DataSize+strlen(Buf)+1)&3;
- /* ----==== escape to LIPS ====---- */
- fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
- fprintf(fp, "\x1bP0J\x1b\\");
- fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL EOJ\n\x1b%%-12345X");
+ /* ----==== Set size ====---- */
+ sprintf(Buf, "000%ld", DataSize);
+ i = (DataSize+strlen(Buf)+1)&3;
+ /* ----==== escape to LIPS ====---- */
+ fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
+ fprintf(fp, "\x1bP0J\x1b\\");
+ fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL EOJ\n\x1b%%-12345X");
- return(0);
+ return(0);
}
static void
BoundImage(gx_device_printer *pDev, struct bounding *pBox)
{
- int x, y, flag;
- int LineSize = gdev_mem_bytes_per_scan_line((gx_device *)pDev);
- int Xsize, Ysize, Pt, Pb, Pl, Pr;
- int Xres = (int)pDev->x_pixels_per_inch,
- Yres = (int)pDev->y_pixels_per_inch,
- height = pDev->height;
- byte *Buf;
- enum Paper paper;
+ int x, y, flag;
+ int LineSize = gdev_mem_bytes_per_scan_line((gx_device *)pDev);
+ int Xsize, Ysize, Pt, Pb, Pl, Pr;
+ int Xres = (int)pDev->x_pixels_per_inch,
+ Yres = (int)pDev->y_pixels_per_inch,
+ height = pDev->height;
+ byte *Buf;
+ enum Paper paper;
/* ----==== Check parameters ====---- */
- paper = height*10/Yres < 82 ? postcard :\
- height*10/Yres < 98 ? a5 :\
- height*10/Yres < 109 ? b5 :\
- height*10/Yres < 116 ? letter : a4;
- Xsize = Xres * mm_to_inch(PaperInfo[paper].w-100) / 160;
- Ysize = Yres * mm_to_inch(PaperInfo[paper].h-100) / 10;
- /* ----==== Allocate momory ====---- */
- if (LineSize < Xsize*2+1) {
- LineSize = Xsize*2+1;
- }
- Buf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 1, LineSize, "LineBuffer");
- /* ----==== bounding image ====---- */
- Pt = Pb = Pl = Pr = -1;
- for(y=0 ; y<height && y<Ysize ; y++){
- flag = 0;
- gdev_prn_copy_scan_lines(pDev, y, Buf, LineSize);
- for (x=0 ; x<min(LineSize/2, Xsize) ; x++) {
- if (*(Buf+x*2) || *(Buf+x*2+1)) {
- if (Pl == -1 || Pl > x) {
- Pl = x;
- }
- if (Pr < x) {
- Pr = x;
- }
- flag = 1;
- }
- }
- if (flag) {
- if (Pt == -1) {
- Pt = y;
- }
- Pb = y;
- }
- }
- pBox->paper = paper;
- pBox->Top = Pt;
- pBox->Bottom = Pb;
- pBox->Left = Pl;
- pBox->Right = Pr;
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), Buf, 1, LineSize, "LineBuffer");
+ paper = height*10/Yres < 82 ? postcard :\
+ height*10/Yres < 98 ? a5 :\
+ height*10/Yres < 109 ? b5 :\
+ height*10/Yres < 116 ? letter : a4;
+ Xsize = Xres * mm_to_inch(PaperInfo[paper].w-100) / 160;
+ Ysize = Yres * mm_to_inch(PaperInfo[paper].h-100) / 10;
+ /* ----==== Allocate momory ====---- */
+ if (LineSize < Xsize*2+1) {
+ LineSize = Xsize*2+1;
+ }
+ Buf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 1, LineSize, "LineBuffer");
+ /* ----==== bounding image ====---- */
+ Pt = Pb = Pl = Pr = -1;
+ for(y=0 ; y<height && y<Ysize ; y++){
+ flag = 0;
+ gdev_prn_copy_scan_lines(pDev, y, Buf, LineSize);
+ for (x=0 ; x<min(LineSize/2, Xsize) ; x++) {
+ if (*(Buf+x*2) || *(Buf+x*2+1)) {
+ if (Pl == -1 || Pl > x) {
+ Pl = x;
+ }
+ if (Pr < x) {
+ Pr = x;
+ }
+ flag = 1;
+ }
+ }
+ if (flag) {
+ if (Pt == -1) {
+ Pt = y;
+ }
+ Pb = y;
+ }
+ }
+ pBox->paper = paper;
+ pBox->Top = Pt;
+ pBox->Bottom = Pb;
+ pBox->Left = Pl;
+ pBox->Right = Pr;
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), Buf, 1, LineSize, "LineBuffer");
}
static long
CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const char *format)
{
- int x, y, i, count = 255;
- int Xres = (int)pDev->x_pixels_per_inch;
- int LineSize = gdev_mem_bytes_per_scan_line((gx_device *)pDev);
- byte *Buf, oBuf[128], c_prev, c_cur, c_tmp;
- long DataSize = 0;
+ int x, y, i, count = 255;
+ int Xres = (int)pDev->x_pixels_per_inch;
+ int LineSize = gdev_mem_bytes_per_scan_line((gx_device *)pDev);
+ byte *Buf, oBuf[128], c_prev, c_cur, c_tmp;
+ long DataSize = 0;
- /* ----==== Printer initialize ====---- */
- /* ----==== start TEXT mode ====---- */
- fprintf(fp, "\x1b%%@");
- /* ----==== job start ====---- */
- fprintf(fp, "\x1bP35;%d;1J;GhostScript\x1b\\", Xres);
- /* ----==== soft reset ====---- */
- fprintf(fp, "\x1b<");
- /* ----==== select size as dot ====---- */
- fprintf(fp, "\x1b[7 I");
- /* ----==== ??? ====---- */
- fprintf(fp, "\x1b[;1;'v");
- /* ----==== set paper size ====---- */
- fprintf(fp, "\x1b[%d;;p", PaperInfo[pBox->paper].id);
- /* ----==== select sheet feeder ====---- */
- fprintf(fp, "\x1b[1q");
- /* ----==== disable automatic FF ====---- */
- fprintf(fp, "\x1b[?2h");
- /* ----==== set number of copies ====---- */
- fprintf(fp, "\x1b[%dv", 1);
- /* ----==== move CAP location ====---- */
- fprintf(fp, "\x1b[%d;%df", pBox->Top, pBox->Left*16);
- /* ----==== draw raster image ====---- */
- fprintf(fp, format, pBox->Right-pBox->Left+1,
- Xres, pBox->Bottom-pBox->Top+1);
+ /* ----==== Printer initialize ====---- */
+ /* ----==== start TEXT mode ====---- */
+ fprintf(fp, "\x1b%%@");
+ /* ----==== job start ====---- */
+ fprintf(fp, "\x1bP35;%d;1J;GhostScript\x1b\\", Xres);
+ /* ----==== soft reset ====---- */
+ fprintf(fp, "\x1b<");
+ /* ----==== select size as dot ====---- */
+ fprintf(fp, "\x1b[7 I");
+ /* ----==== ??? ====---- */
+ fprintf(fp, "\x1b[;1;'v");
+ /* ----==== set paper size ====---- */
+ fprintf(fp, "\x1b[%d;;p", PaperInfo[pBox->paper].id);
+ /* ----==== select sheet feeder ====---- */
+ fprintf(fp, "\x1b[1q");
+ /* ----==== disable automatic FF ====---- */
+ fprintf(fp, "\x1b[?2h");
+ /* ----==== set number of copies ====---- */
+ fprintf(fp, "\x1b[%dv", 1);
+ /* ----==== move CAP location ====---- */
+ fprintf(fp, "\x1b[%d;%df", pBox->Top, pBox->Left*16);
+ /* ----==== draw raster image ====---- */
+ fprintf(fp, format, pBox->Right-pBox->Left+1,
+ Xres, pBox->Bottom-pBox->Top+1);
- /* ----==== Allocate momory ====---- */
- Buf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 1, LineSize, "LineBuffer");
- /* ----==== transfer raster image ====---- */
- for (y=pBox->Top ; y<=pBox->Bottom ; y++) {
- gdev_prn_copy_scan_lines(pDev, y, Buf, LineSize);
- for (x=pBox->Left*2 ; x<=pBox->Right*2+1 ; x++) {
- /* ----==== check pointer & Reverse bit order ====---- */
- c_cur = 0;
- if (x<LineSize) {
- c_tmp = *(Buf+x);
- for (i=0 ; i<8 ; i++) {
- c_cur = (c_cur << 1) | (c_tmp & 1);
- c_tmp = c_tmp >> 1;
- }
- }
- /* ----==== Compress data ====---- */
- if (count < 0) {
- if (c_prev == c_cur && count > -127) {
- count--;
- continue;
- } else {
- fprintf(fp, "%c%c", count, c_prev);
- DataSize += 2;
- }
- } else if (count == 0) {
- if (c_prev == c_cur) {
- count--;
- } else {
- count++;
- c_prev = *(oBuf+count) = c_cur;
- }
- continue;
- } else if (count < 127) {
- if (c_prev == c_cur) {
- fprintf(fp, "%c", count-1);
- fwrite(oBuf, 1, count, fp);
- DataSize += (count+1);
- count = -1;
- } else {
- count++;
- c_prev = *(oBuf+count) = c_cur;
- }
- continue;
- } else if (count == 127) {
- fprintf(fp, "%c", count);
- fwrite(oBuf, 1, count+1, fp);
- DataSize += (count+2);
- }
- c_prev = *oBuf = c_cur;
- count = 0;
- }
- }
+ /* ----==== Allocate momory ====---- */
+ Buf = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), 1, LineSize, "LineBuffer");
+ /* ----==== transfer raster image ====---- */
+ for (y=pBox->Top ; y<=pBox->Bottom ; y++) {
+ gdev_prn_copy_scan_lines(pDev, y, Buf, LineSize);
+ for (x=pBox->Left*2 ; x<=pBox->Right*2+1 ; x++) {
+ /* ----==== check pointer & Reverse bit order ====---- */
+ c_cur = 0;
+ if (x<LineSize) {
+ c_tmp = *(Buf+x);
+ for (i=0 ; i<8 ; i++) {
+ c_cur = (c_cur << 1) | (c_tmp & 1);
+ c_tmp = c_tmp >> 1;
+ }
+ }
+ /* ----==== Compress data ====---- */
+ if (count < 0) {
+ if (c_prev == c_cur && count > -127) {
+ count--;
+ continue;
+ } else {
+ fprintf(fp, "%c%c", count, c_prev);
+ DataSize += 2;
+ }
+ } else if (count == 0) {
+ if (c_prev == c_cur) {
+ count--;
+ } else {
+ count++;
+ c_prev = *(oBuf+count) = c_cur;
+ }
+ continue;
+ } else if (count < 127) {
+ if (c_prev == c_cur) {
+ fprintf(fp, "%c", count-1);
+ fwrite(oBuf, 1, count, fp);
+ DataSize += (count+1);
+ count = -1;
+ } else {
+ count++;
+ c_prev = *(oBuf+count) = c_cur;
+ }
+ continue;
+ } else if (count == 127) {
+ fprintf(fp, "%c", count);
+ fwrite(oBuf, 1, count+1, fp);
+ DataSize += (count+2);
+ }
+ c_prev = *oBuf = c_cur;
+ count = 0;
+ }
+ }
- /* ----==== flush data ====---- */
- if (count < 0) {
- fprintf(fp, "%c%c", count, c_prev);
- DataSize += 2;
- } else {
- fprintf(fp, "%c", count);
- fwrite(oBuf, 1, count+1, fp);
- DataSize += (count+2);
- }
+ /* ----==== flush data ====---- */
+ if (count < 0) {
+ fprintf(fp, "%c%c", count, c_prev);
+ DataSize += 2;
+ } else {
+ fprintf(fp, "%c", count);
+ fwrite(oBuf, 1, count+1, fp);
+ DataSize += (count+2);
+ }
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), Buf, 1, LineSize, "LineBuffer");
- return(DataSize);
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), Buf, 1, LineSize, "LineBuffer");
+ return(DataSize);
}
diff --git a/gs/contrib/japanese/gdevmag.c b/gs/contrib/japanese/gdevmag.c
index c5b507f3b..036d0eb76 100644
--- a/gs/contrib/japanese/gdevmag.c
+++ b/gs/contrib/japanese/gdevmag.c
@@ -49,10 +49,10 @@ static gx_device_procs mag16_procs =
pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
gx_device_printer far_data gs_mag16_device =
prn_device(mag16_procs, "mag16",
- (int)WIDTH_10THS, (int)HEIGHT_10THS,
- DPI, DPI,
- 0,0,0,0, /* margins */
- 4, mag_4bit_print_page);
+ (int)WIDTH_10THS, (int)HEIGHT_10THS,
+ DPI, DPI,
+ 0,0,0,0, /* margins */
+ 4, mag_4bit_print_page);
/* 8-bit planar color. */
@@ -61,10 +61,10 @@ static gx_device_procs mag256_procs =
pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
gx_device_printer far_data gs_mag256_device =
prn_device(mag256_procs, "mag256",
- (int)WIDTH_10THS, (int)HEIGHT_10THS,
- DPI, DPI,
- 0,0,0,0, /* margins */
- 8, mag_8bit_print_page);
+ (int)WIDTH_10THS, (int)HEIGHT_10THS,
+ DPI, DPI,
+ 0,0,0,0, /* margins */
+ 8, mag_8bit_print_page);
/* ------ Private definitions ------ */
@@ -197,7 +197,7 @@ mag_print_page(gx_device_printer *pdev, int depth, FILE *file)
f2 = f0; f0 = f1; f1 = f2;
}
if (next_bit) fputc(flag_a[0],file);
-
+
/* flag B */
memset(f0,0,flag_size);
for (y=0;y<height;y++) {
@@ -224,7 +224,7 @@ mag_done:
fflush(file);
- return code;
+ return code;
}
/* make flag and pixel data */
@@ -252,9 +252,9 @@ mag_make_flag(gx_device_printer *pdev,int line_no, int depth,
}
#define check_pixel(a,b) \
- (x >= (a) && line_no >= (b) && \
+ (x >= (a) && line_no >= (b) && \
*(row[0]+x) == *(row[b] + (x - (a))) && \
- *(row[0]+x+1) == *(row[b] + (x+1 - (a))))
+ *(row[0]+x+1) == *(row[b] + (x+1 - (a))))
#define set_flag(v) \
((x & 2) ? (flag[x>>2] |= (v)) : (flag[x>>2] = (v)<<4))
@@ -293,7 +293,7 @@ mag_comp_flag(gx_device_printer *pdev, int size,byte *f0,byte *f1,
{
byte mask = 0x80>>next_bit;
byte *pflag_b = flag_b;
-
+
for ( ;size>0 ; size--) {
byte b = *f0 ^ *f1;
if (mask == 0x80) {
@@ -322,7 +322,7 @@ mag_write_palette(gx_device_printer *pdev,int depth)
uint i;
gx_color_value rgb[3];
int max_index = 1 << depth;
-
+
for ( i = 0; i < max_index; i++ ) {
byte grb[3];
(pdev->orig_procs.map_color_rgb)((gx_device *)pdev, (gx_color_index)i, rgb);
diff --git a/gs/contrib/japanese/gdevmjc.c b/gs/contrib/japanese/gdevmjc.c
index bafec428f..56645d637 100644
--- a/gs/contrib/japanese/gdevmjc.c
+++ b/gs/contrib/japanese/gdevmjc.c
@@ -22,12 +22,12 @@ copies. */
/* EPSON MJ-700V2C colour printer drivers for Ghostscript */
/*
- These drivers may also work with EPSON Stylus color printer,
- though the author hasn't tried.
+ These drivers may also work with EPSON Stylus color printer,
+ though the author hasn't tried.
*/
/*
- Any comments, suggestions, and bug reports are welcomed.
+ Any comments, suggestions, and bug reports are welcomed.
The e-mail address of the author Kubo, Hiroshi is
h-kubo@kuee.kyoto-u.ac.jp
@@ -38,7 +38,6 @@ copies. */
*/
-
/*
Modified by Norihito Ohmori.
@@ -55,23 +54,22 @@ copies. */
#include "gdevmjc.h"
/***
- *** Note: Original driver gdevcdj.c for HP color printer was written
+ *** Note: Original driver gdevcdj.c for HP color printer was written
*** by a user, George Cameron.
***
- *** An idea of Kuniyoshi Yoshio to borrow the codes of gdevcdj.c
+ *** An idea of Kuniyoshi Yoshio to borrow the codes of gdevcdj.c
*** for another color printer BJC-600J inspired the author.
***
*** Basic control sequences and compression algorithm for ESC/P
*** V2 printer are taken from gdevescp.c, written by Richard Brown.
***
- *** The author Kubo, Hiroshi gathered necessary codes for EPSON
+ *** The author Kubo, Hiroshi gathered necessary codes for EPSON
*** MJ-700V2C and Sylus color printer in gdevmjc.c.
***/
-
/*
available drivers
-
+
1. mj700v2c EPSON Mach Jet Color, for ALL CMYK printer
2. mj500c EPSON Mach Jet Color,
@@ -85,21 +83,21 @@ copies. */
A2 Paper Size Margin is different from mj6000c
*/
-/*
+/*
** Options **
*
name type description
Density int Controls densty of dots. 1024 is normal setting
- for 360dpi.
+ for 360dpi.
Cyan int Controls depth of Cyan. 1024 is normal setting.
Magenta int Controls depth of Magenta. 1024 is normal setting.
Yellow int Controls depth of Yellow. 1024 is normal setting.
Black int Controls depth of Black. 1024 is normal setting.
Unidirectional bool if true, Force unidirectional printing.
Microweave bool if true, set micro weave mode.
- DotSize int Controls the size of the dots. 0 means default,
- 1 means small, 2 means normal.
+ DotSize int Controls the size of the dots. 0 means default,
+ 1 means small, 2 means normal.
** Examples **
@@ -111,7 +109,6 @@ copies. */
*/
-
#define MJ700V2C_PRINT_LIMIT 0.34 /* taken from gdevescp.c */
/* Margins are left, bottom, right, top. */
@@ -120,7 +117,6 @@ copies. */
#define MJ6000C_MARGINS_A2 0.948, 0.52, 1.969, 0.33465
#define MJ8000C_MARGINS_A2 0.194, 0.52, 0.194, 0.33465
-
/* Define bits-per-pixel for generic drivers - default is 24-bit mode */
#ifndef BITSPERPIXEL
#define BITSPERPIXEL 32
@@ -173,15 +169,15 @@ static gx_color_index mjc_correct_color(gx_device_printer *, gx_color_index);
struct gx_device_mj_s {
gx_device_common;
gx_prn_device_common;
- int colorcomp; /* 1: grayscale 3: CMY 4: CMYK */
+ int colorcomp; /* 1: grayscale 3: CMY 4: CMYK */
int density; /* (color depth) * density/1024 = otuput */
- int cyan; /* weight for cyan */
- int magenta; /* weight for magenta */
- int yellow; /* weight for yellow */
- int black; /* weight for black */
- bool direction; /* direction of the head. 1: one way 2: both way */
- bool microweave; /* Micro weave switch. 0: off 1: on */
- int dotsize; /* dot size switch.
+ int cyan; /* weight for cyan */
+ int magenta; /* weight for magenta */
+ int yellow; /* weight for yellow */
+ int black; /* weight for black */
+ bool direction; /* direction of the head. 1: one way 2: both way */
+ bool microweave; /* Micro weave switch. 0: off 1: on */
+ int dotsize; /* dot size switch.
0: default, 1: small, 2: normal */
};
@@ -199,33 +195,33 @@ typedef struct gx_device_mj_s gx_device_mj;
print_page)
#define mjcmyk_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page,\
- dns, r, g, b, k, drct, mcrwv, dtsz)\
+ dns, r, g, b, k, drct, mcrwv, dtsz)\
{ prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page),\
- (bpp == 32 ? 4 : 1), dns, r, g, b, k, drct, mcrwv, dtsz \
+ (bpp == 32 ? 4 : 1), dns, r, g, b, k, drct, mcrwv, dtsz \
}
#define mjcmy_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page,\
- dns, r, g, b, k, drct, mcrwv, dtsz)\
+ dns, r, g, b, k, drct, mcrwv, dtsz)\
{ prn_hp_colour_device(procs, dev_name, x_dpi, y_dpi, bpp, print_page),\
- (bpp == 32 ? 3 : 1), dns, r, g, b, k, drct, mcrwv, dtsz \
+ (bpp == 32 ? 3 : 1), dns, r, g, b, k, drct, mcrwv, dtsz \
}
#define mj_colour_procs(proc_colour_open, proc_get_params, proc_put_params)\
{ proc_colour_open,\
- gx_default_get_initial_matrix,\
- gx_default_sync_output,\
- gdev_prn_output_page,\
- gdev_prn_close,\
- gdev_mjc_map_rgb_color,\
- gdev_mjc_map_color_rgb,\
- NULL, /* fill_rectangle */\
- NULL, /* tile_rectangle */\
- NULL, /* copy_mono */\
- NULL, /* copy_color */\
- NULL, /* draw_line */\
- gx_default_get_bits,\
- proc_get_params,\
- proc_put_params\
+ gx_default_get_initial_matrix,\
+ gx_default_sync_output,\
+ gdev_prn_output_page,\
+ gdev_prn_close,\
+ gdev_mjc_map_rgb_color,\
+ gdev_mjc_map_color_rgb,\
+ NULL, /* fill_rectangle */\
+ NULL, /* tile_rectangle */\
+ NULL, /* copy_mono */\
+ NULL, /* copy_color */\
+ NULL, /* draw_line */\
+ gx_default_get_bits,\
+ proc_get_params,\
+ proc_put_params\
}
static gx_device_procs mj700v2c_procs =
@@ -344,7 +340,7 @@ mj_open(gx_device *pdev, int ptype)
return gdev_prn_open(pdev);
}
-/* Get properties. In addition to the standard and printer
+/* Get properties. In addition to the standard and printer
* properties, we supply shingling and depletion parameters,
* and control over the bits-per-pixel used in output rendering */
/* Added properties for DeskJet 5xxC */
@@ -352,7 +348,7 @@ mj_open(gx_device *pdev, int ptype)
static int
mj_get_params(gx_device *pdev, gs_param_list *plist)
{
- int code = gdev_prn_get_params(pdev, plist);
+ int code = gdev_prn_get_params(pdev, plist);
if ( code < 0 ||
(code = param_write_int(plist, "Density", &mj->density)) < 0 ||
@@ -396,8 +392,8 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
bool direction = mj->direction;
bool microweave = mj->microweave;
int dotsize = mj->dotsize;
- gs_param_name param_name;
- int ecode = 0;
+ gs_param_name param_name;
+ int ecode = 0;
code = put_param_int(plist, "Density", &density, 0, INT_MAX, code);
code = put_param_int(plist, "Cyan", &cyan, 0, INT_MAX, code);
@@ -405,22 +401,22 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
code = put_param_int(plist, "Yellow", &yellow, 0, INT_MAX, code);
code = put_param_int(plist, "Black", &black, 0, INT_MAX, code);
- if ((code == param_read_bool(plist,
- (param_name = "Unidirectional"),
- &direction))< 0) {
- param_signal_error(plist, param_name, ecode = code);
- }
+ if ((code == param_read_bool(plist,
+ (param_name = "Unidirectional"),
+ &direction))< 0) {
+ param_signal_error(plist, param_name, ecode = code);
+ }
- if ((code == param_read_bool(plist,
- (param_name = "Microweave"),
- &microweave))< 0) {
- param_signal_error(plist, param_name, ecode = code);
- }
- if (ecode < 0)
- return code;
+ if ((code == param_read_bool(plist,
+ (param_name = "Microweave"),
+ &microweave))< 0) {
+ param_signal_error(plist, param_name, ecode = code);
+ }
+ if (ecode < 0)
+ return code;
- if (microweave && pdev->x_pixels_per_inch == 180)
- return_error(gs_error_rangecheck);
+ if (microweave && pdev->x_pixels_per_inch == 180)
+ return_error(gs_error_rangecheck);
code = put_param_int(plist, "DotSize", &dotsize, 0, 1, code);
code = put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
@@ -438,13 +434,13 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
mj->dotsize = dotsize;
if ( bpp != 0 ) {
- if (bpp != 8 && bpp != 32)
- return_error(gs_error_rangecheck);
+ if (bpp != 8 && bpp != 32)
+ return_error(gs_error_rangecheck);
- if (ptype == MJ500C)
- mj500c_set_bpp(pdev, bpp);
- else
- set_bpp(pdev, bpp);
+ if (ptype == MJ500C)
+ mj500c_set_bpp(pdev, bpp);
+ else
+ set_bpp(pdev, bpp);
gdev_prn_put_params(pdev, plist);
if ( bpp != old_bpp && pdev->is_open )
return gs_closedevice(pdev);
@@ -469,99 +465,98 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
#define THRESHOLD (128 << SHIFT)
#define FSditherI(inP, out, errP, Err, Bit, Offset)\
- oldErr = Err;\
- Err = (*errP + ((Err * 7) >> 4) + (*inP++ << SHIFT));\
+ oldErr = Err;\
+ Err = (*errP + ((Err * 7) >> 4) + (*inP++ << SHIFT));\
if (Err > MAXVALUE) Err = MAXVALUE;\
else if (Err < MINVALUE) Err = MINVALUE;\
- if (Err > THRESHOLD) {\
- out |= Bit;\
- Err -= MAXVALUE;\
- }\
- errP[Offset] += ((Err * 3) >> 4);\
- *errP++ = ((Err * 5 + oldErr) >> 4);
+ if (Err > THRESHOLD) {\
+ out |= Bit;\
+ Err -= MAXVALUE;\
+ }\
+ errP[Offset] += ((Err * 3) >> 4);\
+ *errP++ = ((Err * 5 + oldErr) >> 4);
#define FSditherD(inP, out, errP, Err, Bit, Offset)\
- oldErr = Err;\
- Err = (*--errP + ((Err * 7) >> 4) + (*--inP << SHIFT));\
+ oldErr = Err;\
+ Err = (*--errP + ((Err * 7) >> 4) + (*--inP << SHIFT));\
if (Err > MAXVALUE) Err = MAXVALUE;\
else if (Err < MINVALUE) Err = MINVALUE;\
- if (Err > THRESHOLD) {\
- out |= Bit;\
- Err -= MAXVALUE;\
- }\
- errP[Offset] += ((Err * 3) >> 4);\
- *errP = ((Err * 5 + oldErr) >> 4);
+ if (Err > THRESHOLD) {\
+ out |= Bit;\
+ Err -= MAXVALUE;\
+ }\
+ errP[Offset] += ((Err * 3) >> 4);\
+ *errP = ((Err * 5 + oldErr) >> 4);
#define MATRIX_I(inP, out, Bit, Offset)\
- if ((*inP++ << 6) > Offset) {\
- out |= Bit;\
- }
+ if ((*inP++ << 6) > Offset) {\
+ out |= Bit;\
+ }
#define MATRIX_D(inP, out, Bit, Offset)\
- if ((*--inP << 6) > Offset) {\
- out |= Bit;\
- }
-
+ if ((*--inP << 6) > Offset) {\
+ out |= Bit;\
+ }
/* Here we rely on compiler optimisation to remove lines of the form
* (if (1 >= 4) {...}, ie. the constant boolean expressions */
#define FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr, cP, mP, yP, kP, n)\
{\
- unsigned short *mat = matrix2 + (lnum & 127)*128;\
- int x;\
+ unsigned short *mat = matrix2 + (lnum & 127)*128;\
+ int x;\
if (scan == 0) { /* going_up */\
x = 0;\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int val;\
- bitmask = 0x80;\
- for (c = m = y = k = j = 0; j < 8; j++) {\
- val = *(mat + (x++ & 127));\
- if (n >= 4)\
- {\
- MATRIX_I(dp, k, bitmask, val);\
- }\
- if (n >= 3)\
- { MATRIX_I(dp, c, bitmask, val);\
- MATRIX_I(dp, m, bitmask, val);\
- }\
- MATRIX_I(dp, y, bitmask, val);\
- bitmask >>= 1;\
- }\
- if (n >= 4)\
- *kP++ = k;\
- if (n >= 3)\
- { *cP++ = c;\
+ byte c, y, m, k, bitmask;\
+ int val;\
+ bitmask = 0x80;\
+ for (c = m = y = k = j = 0; j < 8; j++) {\
+ val = *(mat + (x++ & 127));\
+ if (n >= 4)\
+ {\
+ MATRIX_I(dp, k, bitmask, val);\
+ }\
+ if (n >= 3)\
+ { MATRIX_I(dp, c, bitmask, val);\
+ MATRIX_I(dp, m, bitmask, val);\
+ }\
+ MATRIX_I(dp, y, bitmask, val);\
+ bitmask >>= 1;\
+ }\
+ if (n >= 4)\
+ *kP++ = k;\
+ if (n >= 3)\
+ { *cP++ = c;\
*mP++ = m;\
- }\
- *yP++ = y;\
+ }\
+ *yP++ = y;\
}\
} else { /* going_down */\
x = plane_size*8;\
for (i = 0; i < plane_size; i++) {\
- byte c, y, m, k, bitmask;\
- int val;\
- bitmask = 0x01;\
- for (c = m = y = k = j = 0; j < 8; j++) {\
- val = *(mat + (--x & 127));\
- MATRIX_D(dp, y, bitmask, val);\
- if (n >= 3)\
- { MATRIX_D(dp, m, bitmask, val);\
- MATRIX_D(dp, c, bitmask, val);\
- }\
- if (n >= 4)\
- { MATRIX_D(dp, k, bitmask, val);\
- }\
- bitmask <<= 1;\
- }\
- *--yP = y;\
- if (n >= 3)\
- { *--mP = m;\
- *--cP = c;\
- }\
- if (n >= 4)\
- *--kP = k;\
+ byte c, y, m, k, bitmask;\
+ int val;\
+ bitmask = 0x01;\
+ for (c = m = y = k = j = 0; j < 8; j++) {\
+ val = *(mat + (--x & 127));\
+ MATRIX_D(dp, y, bitmask, val);\
+ if (n >= 3)\
+ { MATRIX_D(dp, m, bitmask, val);\
+ MATRIX_D(dp, c, bitmask, val);\
+ }\
+ if (n >= 4)\
+ { MATRIX_D(dp, k, bitmask, val);\
+ }\
+ bitmask <<= 1;\
+ }\
+ *--yP = y;\
+ if (n >= 3)\
+ { *--mP = m;\
+ *--cP = c;\
+ }\
+ if (n >= 4)\
+ *--kP = k;\
}\
}\
}
@@ -581,20 +576,18 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
*/
#define fputshort(n, f) fputc((n)%256,f);fputc((n)/256,f)
-
#define row_bytes (img_rows / 8)
#define row_words (row_bytes / sizeof(word))
#define min_rows (32) /* for optimization of text image printing */
-
-static int
+static int
mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
- gx_device_printer* pdev, FILE* prn_stream)
+ gx_device_printer* pdev, FILE* prn_stream)
{
int band_size = 1; /* 1, 8, or 24 */
-
+
byte *out = buf2;
-
+
int width = in_size;
int count;
@@ -613,88 +606,88 @@ mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
/* end of specifying a colour */
- /* Following codes for compression are borrowed from gdevescp.c */
+ /* Following codes for compression are borrowed from gdevescp.c */
for( p = inp, q = inp + 1 ; q < in_end ; ) {
-
+
if( *p != *q ) {
p += 2;
q += 2;
} else {
-
+
/*
** Check behind us, just in case:
*/
-
+
if( p > inp && *p == *(p-1) )
- p--;
-
+ p--;
+
/*
** walk forward, looking for matches:
*/
-
+
for( q++ ; *q == *p && q < in_end ; q++ ) {
- if( (q-p) >= 128 ) {
- if( p > inp ) {
- count = p - inp;
- while( count > 128 ) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
- *outp++ = (char) (count - 1); /* count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- *outp++ = '\201'; /* Repeat 128 times */
- *outp++ = *p;
- p += 128;
- inp = p;
- }
+ if( (q-p) >= 128 ) {
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+ *outp++ = (char) (count - 1); /* count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ *outp++ = '\201'; /* Repeat 128 times */
+ *outp++ = *p;
+ p += 128;
+ inp = p;
+ }
}
-
+
if( (q - p) > 2 ) { /* output this sequence */
- if( p > inp ) {
- count = p - inp;
- while( count > 128 ) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
- *outp++ = (char) (count - 1); /* byte count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- count = q - p;
- *outp++ = (char) (256 - count + 1);
- *outp++ = *p;
- p += count;
- inp = p;
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+ *outp++ = (char) (count - 1); /* byte count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ count = q - p;
+ *outp++ = (char) (256 - count + 1);
+ *outp++ = *p;
+ p += count;
+ inp = p;
} else /* add to non-repeating data list */
- p = q;
+ p = q;
if( q < in_end )
- q++;
+ q++;
}
}
-
+
/*
** copy remaining part of line:
*/
-
+
if( inp < in_end ) {
-
+
count = in_end - inp;
-
+
/*
** If we've had a long run of varying data followed by a
** sequence of repeated data and then hit the end of line,
** it's possible to get data counts > 128.
*/
-
+
while( count > 128 ) {
*outp++ = '\177';
memcpy(outp, inp, 128); /* data */
@@ -702,7 +695,7 @@ mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
outp += 128;
count -= 128;
}
-
+
*outp++ = (char) (count - 1); /* byte count */
memcpy(outp, inp, count); /* data */
outp += count;
@@ -710,40 +703,40 @@ mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
/*
** Output data:
*/
-
+
fwrite("\033.\001", 1, 3, prn_stream);
-
+
if(pdev->y_pixels_per_inch == 720)
fputc('\005', prn_stream);
else if(pdev->y_pixels_per_inch == 180)
fputc('\024', prn_stream);
else /* pdev->y_pixels_per_inch == 360 */
fputc('\012', prn_stream);
-
+
if(pdev->x_pixels_per_inch == 720)
fputc('\005', prn_stream);
else if(pdev->x_pixels_per_inch == 180)
fputc('\024', prn_stream);
else /* pdev->x_pixels_per_inch == 360 */
fputc('\012', prn_stream);
-
+
fputc(band_size, prn_stream);
-
+
fputc((width << 3) & 0xff, prn_stream);
fputc( width >> 5, prn_stream);
-
+
fwrite(out, 1, (outp - out), prn_stream);
-
+
fputc('\r', prn_stream);
-
+
return 0;
}
static int
mj_v_skip(int n, gx_device_printer *pdev, FILE *stream)
{
- /* This is a kind of magic number. */
- static const int max_y_step = (256 * 15 + 255);
+ /* This is a kind of magic number. */
+ static const int max_y_step = (256 * 15 + 255);
int l = n - max_y_step;
for (; l > 0; l -= max_y_step) { /* move 256 * 15 + 255 dots at once*/
@@ -751,7 +744,7 @@ mj_v_skip(int n, gx_device_printer *pdev, FILE *stream)
}
l += max_y_step;
/* move to the end. */
- {
+ {
int n2 = l / 256;
int n1 = l - n2 * 256;
fwrite("\033(v\2\0", sizeof(byte) ,5 ,stream);
@@ -764,142 +757,138 @@ mj_v_skip(int n, gx_device_printer *pdev, FILE *stream)
/* NOZ */
-static void
+static void
bld_barrier( short **bar , int x )
{
- int i , j;
-
- short t;
- short *p;
- short *b;
- short *dat = barrier_dat + 1;
-
- p = *bar++ + x + 1;
-
- for ( i = 0 ; i < 11 ; i++ ) {
- t = *dat++;
- if (*p < t )
- *p = t;
- p++;
- }
-
- for ( j = 0 ; j < 11 ; j++ ) {
- p = *bar++ + x;
- b = p;
-
- t = *dat++;
- if (*p < t )
- *p = t;
- p++;
- for ( i = 0 ; i < 11 ; i++ ) {
- t = *dat++;
- if (*p < t )
- *p = t;
- p++;
-
- if (*(--b) < t )
- *b = t;
- }
- }
-}
+ int i , j;
+
+ short t;
+ short *p;
+ short *b;
+ short *dat = barrier_dat + 1;
+ p = *bar++ + x + 1;
+
+ for ( i = 0 ; i < 11 ; i++ ) {
+ t = *dat++;
+ if (*p < t )
+ *p = t;
+ p++;
+ }
+
+ for ( j = 0 ; j < 11 ; j++ ) {
+ p = *bar++ + x;
+ b = p;
+
+ t = *dat++;
+ if (*p < t )
+ *p = t;
+ p++;
+ for ( i = 0 ; i < 11 ; i++ ) {
+ t = *dat++;
+ if (*p < t )
+ *p = t;
+ p++;
+
+ if (*(--b) < t )
+ *b = t;
+ }
+ }
+}
static void
DifSubK( int d0 , short *a4 , short *a5 )
{
/*
- +---+---+---+
- | | X |1/2|
- +---+---+---+
- |1/4|1/8|1/8|
- +---+---+---+
+ +---+---+---+
+ | | X |1/2|
+ +---+---+---+
+ |1/4|1/8|1/8|
+ +---+---+---+
*/
- *a4++ = 0;
- d0 >>= 1;
- *a4 += d0;
- d0 >>= 1;
- *(a5-1) += d0;
- d0 >>= 1;
- *a5++ += d0;
- *a5 += d0;
+ *a4++ = 0;
+ d0 >>= 1;
+ *a4 += d0;
+ d0 >>= 1;
+ *(a5-1) += d0;
+ d0 >>= 1;
+ *a5++ += d0;
+ *a5 += d0;
}
-
/* a4.w , a5.w , */
static byte
Xtal( byte bitmask , short d0 , int x , short **bar , short *b1 , short *b2 )
{
- short *a2;
+ short *a2;
- if (d0 != 0)
- d0 += *b1;
+ if (d0 != 0)
+ d0 += *b1;
- a2 = *bar + x;
+ a2 = *bar + x;
/*dprintf1("[%02X]",*a2);*/
- if (*a2 < d0) {
- d0 -= 16400;
- if (-4096 >= d0) {
- DifSubK( d0 , b1 , b2 );
- bld_barrier( bar , x );
- } else {
- DifSubK( d0 , b1 , b2 );
- }
- return( bitmask );
- } else {
- if (d0 > 56)
- d0 -= 56;
- DifSubK( d0 , b1 , b2 );
- return( 0 );
- }
+ if (*a2 < d0) {
+ d0 -= 16400;
+ if (-4096 >= d0) {
+ DifSubK( d0 , b1 , b2 );
+ bld_barrier( bar , x );
+ } else {
+ DifSubK( d0 , b1 , b2 );
+ }
+ return( bitmask );
+ } else {
+ if (d0 > 56)
+ d0 -= 56;
+ DifSubK( d0 , b1 , b2 );
+ return( 0 );
+ }
}
-
static void
xtal_plane( byte *dp , short *buf[] , byte *oP , short **bar , int plane_size , int xtalbuff_size )
{
- int i;
- int j;
- int x = 0;
- byte bitmask;
- byte out;
- short *p;
- short *b1 , *b2;
-
- b1 = buf[0];
- b2 = buf[1];
+ int i;
+ int j;
+ int x = 0;
+ byte bitmask;
+ byte out;
+ short *p;
+ short *b1 , *b2;
+
+ b1 = buf[0];
+ b2 = buf[1];
/*
- for ( i = 0 ; i < 100 ; i++ ) {
- dprintf1("[%04X]",bar[0][i]);
- }
- dprintf("\n");
+ for ( i = 0 ; i < 100 ; i++ ) {
+ dprintf1("[%04X]",bar[0][i]);
+ }
+ dprintf("\n");
*/
- for ( i = 0 ; i < plane_size ; i++ ) {
- bitmask = 0x80;
- out = 0;
- for ( j = 0 ; j < 8 ; j++ ) {
- out |= Xtal( bitmask , (short)(*dp) << 6 , x++ , bar , b1++ , b2++ );
- dp += 4;
- bitmask >>= 1;
- }
- *oP++ = out;
- }
+ for ( i = 0 ; i < plane_size ; i++ ) {
+ bitmask = 0x80;
+ out = 0;
+ for ( j = 0 ; j < 8 ; j++ ) {
+ out |= Xtal( bitmask , (short)(*dp) << 6 , x++ , bar , b1++ , b2++ );
+ dp += 4;
+ bitmask >>= 1;
+ }
+ *oP++ = out;
+ }
/*dprintf("\n");*/
- p = buf[0];
+ p = buf[0];
/* dprintf("\n"); */
- buf[0] = buf[1];
- buf[1] = p;
-
-
- p = bar[0];
- for ( i = 0 ; i < plane_size*8 ; i++ )
- *p++ = 0;
-
- /* memset( p, 0, (xtalbuff_size-16) * W);*/
- p = bar[0];
- for ( i = 0 ; i <= 14 ; i++ )
- bar[i] = bar[i+1];
- bar[15] = p;
+ buf[0] = buf[1];
+ buf[1] = p;
+
+ p = bar[0];
+ for ( i = 0 ; i < plane_size*8 ; i++ )
+ *p++ = 0;
+
+ /* memset( p, 0, (xtalbuff_size-16) * W);*/
+ p = bar[0];
+ for ( i = 0 ; i <= 14 ; i++ )
+ bar[i] = bar[i+1];
+ bar[15] = p;
}
static int
@@ -971,7 +960,7 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
databuff_size = 0; /* so no data buffer required, */
outbuff_size = plane_size * 4; /* but need separate output buffers */
}
-
+
if (bits_per_pixel > 4) { /* Error buffer for FS dithering */
expanded_bpp = storage_bpp = /* 8, 24 or 32 bits */
num_comps * 8;
@@ -982,47 +971,47 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
databuff_size = plane_size * storage_bpp;
storage_size_words = ((plane_size + plane_size) * num_comps +
- databuff_size + errbuff_size + outbuff_size) / W;
+ databuff_size + errbuff_size + outbuff_size) / W;
/* NOZ */
xtalbuff_size = plane_size*8 + 64;
xtalbuff = (short *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), xtalbuff_size*(16*4+2*4) , W, "mj_colour_print_barrier");
memset(xtalbuff, 0, xtalbuff_size*(16*4+2*4) * W);
{
- int i;
- short *p = xtalbuff + 16;
- for ( i = 0 ; i < 16 ; i++ ) {
- Cbar[i] = p;
- p += xtalbuff_size;
- }
- for ( i = 0 ; i < 16 ; i++ ) {
- Mbar[i] = p;
- p += xtalbuff_size;
- }
- for ( i = 0 ; i < 16 ; i++ ) {
- Ybar[i] = p;
- p += xtalbuff_size;
- }
- for ( i = 0 ; i < 16 ; i++ ) {
- Kbar[i] = p;
- p += xtalbuff_size;
- }
- Cbuf[0] = p;
- p += xtalbuff_size;
- Cbuf[1] = p;
- p += xtalbuff_size;
- Mbuf[0] = p;
- p += xtalbuff_size;
- Mbuf[1] = p;
- p += xtalbuff_size;
- Ybuf[0] = p;
- p += xtalbuff_size;
- Ybuf[1] = p;
- p += xtalbuff_size;
- Kbuf[0] = p;
- p += xtalbuff_size;
- Kbuf[1] = p;
- p += xtalbuff_size;
+ int i;
+ short *p = xtalbuff + 16;
+ for ( i = 0 ; i < 16 ; i++ ) {
+ Cbar[i] = p;
+ p += xtalbuff_size;
+ }
+ for ( i = 0 ; i < 16 ; i++ ) {
+ Mbar[i] = p;
+ p += xtalbuff_size;
+ }
+ for ( i = 0 ; i < 16 ; i++ ) {
+ Ybar[i] = p;
+ p += xtalbuff_size;
+ }
+ for ( i = 0 ; i < 16 ; i++ ) {
+ Kbar[i] = p;
+ p += xtalbuff_size;
+ }
+ Cbuf[0] = p;
+ p += xtalbuff_size;
+ Cbuf[1] = p;
+ p += xtalbuff_size;
+ Mbuf[0] = p;
+ p += xtalbuff_size;
+ Mbuf[1] = p;
+ p += xtalbuff_size;
+ Ybuf[0] = p;
+ p += xtalbuff_size;
+ Ybuf[1] = p;
+ p += xtalbuff_size;
+ Kbuf[0] = p;
+ p += xtalbuff_size;
+ Kbuf[1] = p;
+ p += xtalbuff_size;
}
storage = (word *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), storage_size_words, W, "mj_colour_print_page");
@@ -1044,7 +1033,7 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
* the buffer alternation required for line-difference compression.
*
* Thus, the number of pointers required is as follows:
- *
+ *
* errors: 2 (scan direction only)
* data: 4 (scan direction and alternating buffers)
* plane_data: 4 (scan direction and alternating buffers)
@@ -1082,16 +1071,16 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
data[3] += databuff_size;
}
}
-
+
/* Clear temp storage */
memset(storage, 0, storage_size_words * W);
-
+
/* Initialize printer. */
{
/** Reset printer, enter graphics mode: */
-
+
fwrite("\033@\033(G\001\000\001", sizeof(byte), 8, prn_stream);
-
+
/** Micro-weave-Mode */
if (mj->microweave) {
fwrite("\033(i\001\000\001", sizeof(byte), 6, prn_stream);
@@ -1099,12 +1088,12 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
/** Dot-Size define */
if (mj->dotsize) {
fwrite("\033(e\002\000\000\001", sizeof(byte), 7, prn_stream);
- }
+ }
if (ptype == MJ6000C || ptype == MJ8000C) {
/* Select Monochrome/Color Printing Mode Command */
if (pdev->color_info.depth == 8)
- fwrite("\033(K\002\000\000\001", sizeof(byte), 7, prn_stream);
+ fwrite("\033(K\002\000\000\001", sizeof(byte), 7, prn_stream);
}
if (mj->direction) /* set the direction of the head */
@@ -1114,34 +1103,34 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
#if 0
#ifdef A4
- /*
- ** After reset, the Stylus is set up for US letter paper.
- ** We need to set the page size appropriately for A4 paper.
- ** For some bizarre reason the ESC/P2 language wants the bottom
- ** margin measured from the *top* of the page:
- */
-
- fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
- 1, 22, prn_stream);
+ /*
+ ** After reset, the Stylus is set up for US letter paper.
+ ** We need to set the page size appropriately for A4 paper.
+ ** For some bizarre reason the ESC/P2 language wants the bottom
+ ** margin measured from the *top* of the page:
+ */
+
+ fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
+ 1, 22, prn_stream);
#endif
#endif
- /*
- ** Set the line spacing to match the band height:
- */
+ /*
+ ** Set the line spacing to match the band height:
+ */
- if( pdev->y_pixels_per_inch >= 720 ) {
- fwrite("\033(U\001\0\005\033+\001", sizeof(byte), 9, prn_stream);
- }
- else if( pdev->y_pixels_per_inch >= 360 )
- fwrite("\033(U\001\0\012\033+\001", sizeof(byte), 9, prn_stream);
- else /* 180 dpi */
- fwrite("\033(U\001\0\024\033+\002", sizeof(byte), 9, prn_stream);
+ if( pdev->y_pixels_per_inch >= 720 ) {
+ fwrite("\033(U\001\0\005\033+\001", sizeof(byte), 9, prn_stream);
+ }
+ else if( pdev->y_pixels_per_inch >= 360 )
+ fwrite("\033(U\001\0\012\033+\001", sizeof(byte), 9, prn_stream);
+ else /* 180 dpi */
+ fwrite("\033(U\001\0\024\033+\002", sizeof(byte), 9, prn_stream);
/* set the length of the page */
- fwrite("\033(C\2\0", sizeof(byte), 5, prn_stream);
- fputc(((pdev->height) % 256), prn_stream);
- fputc(((pdev->height) / 256), prn_stream);
+ fwrite("\033(C\2\0", sizeof(byte), 5, prn_stream);
+ fputc(((pdev->height) % 256), prn_stream);
+ fputc(((pdev->height) / 256), prn_stream);
}
#define MOFFSET (pdev->t_margin - MJ700V2C_PRINT_LIMIT) /* Print position */
@@ -1156,7 +1145,7 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
/* Send each scan line in turn */
{
- long int lend = pdev->height -
+ long int lend = pdev->height -
(dev_t_margin_points(pdev) + dev_b_margin_points(pdev));
int cErr, mErr, yErr, kErr;
int this_pass, i;
@@ -1171,14 +1160,12 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
if (bits_per_pixel > 4) { /* Randomly seed initial error buffer */
int *ep = errors[0];
for (i = 0; i < databuff_size; i++) {
- *ep++ = (rand() % (MAXVALUE / 2)) - MAXVALUE / 4;
+ *ep++ = (rand() % (MAXVALUE / 2)) - MAXVALUE / 4;
}
}
-
this_pass = start_rows;
-
lnum = 0;
/* for Debug */
@@ -1195,197 +1182,195 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
/* Remove trailing 0s. */
while (end_data > data_words && end_data[-1] == 0)
- end_data--;
+ end_data--;
if (end_data == data_words) { /* Blank line */
- num_blank_lines++;
- continue; /* skip to for (lnum) loop */
+ num_blank_lines++;
+ continue; /* skip to for (lnum) loop */
}
/* Skip blank lines if any */
if (num_blank_lines > 0 ) {
- mj_v_skip(num_blank_lines, pdev, prn_stream);
- memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
- num_blank_lines = 0;
- this_pass = start_rows;
+ mj_v_skip(num_blank_lines, pdev, prn_stream);
+ memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
+ num_blank_lines = 0;
+ this_pass = start_rows;
}
/* Correct color depth. */
- if (mj->density != 1024 || mj->yellow != 1024 || mj->cyan != 1024
- || mj->magenta != 1024 || mj->black != 1024 ) {
- for (p_data = (gx_color_index*) data_words; p_data < (gx_color_index *)end_data; p_data++) {
- *p_data = mjc_correct_color(pdev, *p_data);
- }
- }
+ if (mj->density != 1024 || mj->yellow != 1024 || mj->cyan != 1024
+ || mj->magenta != 1024 || mj->black != 1024 ) {
+ for (p_data = (gx_color_index*) data_words; p_data < (gx_color_index *)end_data; p_data++) {
+ *p_data = mjc_correct_color(pdev, *p_data);
+ }
+ }
{ /* Printing non-blank lines */
- register byte *kP = plane_data[scan + 2][3];
- register byte *cP = plane_data[scan + 2][2];
- register byte *mP = plane_data[scan + 2][1];
- register byte *yP = plane_data[scan + 2][0];
- register byte *dp = data[scan + 2];
- int zero_row_count;
- int i, j;
- byte *odp;
-
- if (this_pass)
- this_pass--;
- else
- this_pass = start_rows;
-
- if (expanded_bpp > bits_per_pixel) /* Expand line if required */
- expand_line(data_words, line_size, bits_per_pixel, expanded_bpp);
-
- /* In colour modes, we have some bit-shuffling to do before
- * we can print the data; in FS mode we also have the
- * dithering to take care of. */
- switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
- case 3:
- /* Transpose the data to get pixel planes. */
- for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
- i += 8, odp++) { /* The following is for 16-bit
- * machines */
+ register byte *kP = plane_data[scan + 2][3];
+ register byte *cP = plane_data[scan + 2][2];
+ register byte *mP = plane_data[scan + 2][1];
+ register byte *yP = plane_data[scan + 2][0];
+ register byte *dp = data[scan + 2];
+ int zero_row_count;
+ int i, j;
+ byte *odp;
+
+ if (this_pass)
+ this_pass--;
+ else
+ this_pass = start_rows;
+
+ if (expanded_bpp > bits_per_pixel) /* Expand line if required */
+ expand_line(data_words, line_size, bits_per_pixel, expanded_bpp);
+
+ /* In colour modes, we have some bit-shuffling to do before
+ * we can print the data; in FS mode we also have the
+ * dithering to take care of. */
+ switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
+ case 3:
+ /* Transpose the data to get pixel planes. */
+ for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
+ i += 8, odp++) { /* The following is for 16-bit
+ * machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static word spr40[8] = spread3(0x40);
- static word spr08[8] = spread3(8);
- static word spr02[8] = spread3(2);
- register byte *dp = data[scan] + i;
- register word pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr08[dp[3]] << 1) +
- (spr08[dp[4]]) +
- (spr08[dp[5]] >> 1) +
- (spr02[dp[6]]) +
- (spr02[dp[7]] >> 1);
- odp[0] = (byte) (pword >> 16);
- odp[plane_size] = (byte) (pword >> 8);
- odp[plane_size * 2] = (byte) (pword);
- }
- break;
-
- case 8:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 1);
- break;
- case 24:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 3);
- break;
- case 32:
- if (scan == 1) {
- dp -= plane_size*8*4;
- cP -= plane_size;
- mP -= plane_size;
- yP -= plane_size;
- kP -= plane_size;
- }
+ static word spr40[8] = spread3(0x40);
+ static word spr08[8] = spread3(8);
+ static word spr02[8] = spread3(2);
+ register byte *dp = data[scan] + i;
+ register word pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr08[dp[3]] << 1) +
+ (spr08[dp[4]]) +
+ (spr08[dp[5]] >> 1) +
+ (spr02[dp[6]]) +
+ (spr02[dp[7]] >> 1);
+ odp[0] = (byte) (pword >> 16);
+ odp[plane_size] = (byte) (pword >> 8);
+ odp[plane_size * 2] = (byte) (pword);
+ }
+ break;
+
+ case 8:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 1);
+ break;
+ case 24:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 3);
+ break;
+ case 32:
+ if (scan == 1) {
+ dp -= plane_size*8*4;
+ cP -= plane_size;
+ mP -= plane_size;
+ yP -= plane_size;
+ kP -= plane_size;
+ }
/*
{
- byte *p = dp;
- int i;
- for ( i = 0 ; i < plane_size ; i++ ) {
- dprintf4 ( "[%02X%02X%02X%02X]" , p[0] , p[1] , p[2] , p[3] );
- p += 4;
- }
- dprintf("\n");
-
+ byte *p = dp;
+ int i;
+ for ( i = 0 ; i < plane_size ; i++ ) {
+ dprintf4 ( "[%02X%02X%02X%02X]" , p[0] , p[1] , p[2] , p[3] );
+ p += 4;
+ }
+ dprintf("\n");
+
}
*/
/*
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 4);
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 4);
*/
/* NOZ */
- xtal_plane( dp++ , Kbuf , kP , Kbar , plane_size , xtalbuff_size );
- xtal_plane( dp++ , Cbuf , cP , Cbar , plane_size , xtalbuff_size );
- xtal_plane( dp++ , Mbuf , mP , Mbar , plane_size , xtalbuff_size );
- xtal_plane( dp++ , Ybuf , yP , Ybar , plane_size , xtalbuff_size );
-
- break;
-
- } /* switch(expanded_bpp) */
-
-
- /* Make sure all black is in the k plane */
- if (num_comps == 4 ) {
- if (mj->colorcomp > 3 ) {
- register word *kp = (word *)plane_data[scan][3];
- register word *cp = (word *)plane_data[scan][2];
- register word *mp = (word *)plane_data[scan][1];
- register word *yp = (word *)plane_data[scan][0];
- if (bits_per_pixel > 4) { /* This has been done as 4 planes */
+ xtal_plane( dp++ , Kbuf , kP , Kbar , plane_size , xtalbuff_size );
+ xtal_plane( dp++ , Cbuf , cP , Cbar , plane_size , xtalbuff_size );
+ xtal_plane( dp++ , Mbuf , mP , Mbar , plane_size , xtalbuff_size );
+ xtal_plane( dp++ , Ybuf , yP , Ybar , plane_size , xtalbuff_size );
+
+ break;
+
+ } /* switch(expanded_bpp) */
+
+ /* Make sure all black is in the k plane */
+ if (num_comps == 4 ) {
+ if (mj->colorcomp > 3 ) {
+ register word *kp = (word *)plane_data[scan][3];
+ register word *cp = (word *)plane_data[scan][2];
+ register word *mp = (word *)plane_data[scan][1];
+ register word *yp = (word *)plane_data[scan][0];
+ if (bits_per_pixel > 4) { /* This has been done as 4 planes */
#if 0
- for (i = 0; i < plane_size / W; i++) {
- word bits = ~*kp++;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = ~*kp++;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
#endif
- } else { /* This has really been done as 3 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *cp & *mp & *yp;
- *kp++ = bits;
- bits = ~bits;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
- }
- } else if (mj->colorcomp == 3 ) {
- register word *kp = (word *)plane_data[scan][3];
- register word *cp = (word *)plane_data[scan][2];
- register word *mp = (word *)plane_data[scan][1];
- register word *yp = (word *)plane_data[scan][0];
- if (bits_per_pixel > 4) { /* This has been done as 4 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *kp++; /* kp will not be used when printing */
- *cp++ |= bits;
- *mp++ |= bits;
- *yp++ |= bits;
- }
- } else { /* This has really been done as 3 planes */
- }
- }
- }
-
- /* Transfer raster graphics
- * in the order (K), C, M, Y. */
- switch (mj->colorcomp) {
- case 1:
- zero_row_count = 0;
- out_data = (byte*) plane_data[scan][0];
- /* 3 for balck */
- mj_raster_cmd(3, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
- break;
- case 3:
- for (zero_row_count = 0, i = 3 - 1; i >= 0; i--) {
- out_data = (byte*) plane_data[scan][i];
- mj_raster_cmd(i, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
- }
- break;
- default:
- for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
- out_data = (byte*) plane_data[scan][i];
- mj_raster_cmd(i, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
- }
- break;
- } /* Transfer Raster Graphics ... */
+ } else { /* This has really been done as 3 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *cp & *mp & *yp;
+ *kp++ = bits;
+ bits = ~bits;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
+ }
+ } else if (mj->colorcomp == 3 ) {
+ register word *kp = (word *)plane_data[scan][3];
+ register word *cp = (word *)plane_data[scan][2];
+ register word *mp = (word *)plane_data[scan][1];
+ register word *yp = (word *)plane_data[scan][0];
+ if (bits_per_pixel > 4) { /* This has been done as 4 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *kp++; /* kp will not be used when printing */
+ *cp++ |= bits;
+ *mp++ |= bits;
+ *yp++ |= bits;
+ }
+ } else { /* This has really been done as 3 planes */
+ }
+ }
+ }
+
+ /* Transfer raster graphics
+ * in the order (K), C, M, Y. */
+ switch (mj->colorcomp) {
+ case 1:
+ zero_row_count = 0;
+ out_data = (byte*) plane_data[scan][0];
+ /* 3 for balck */
+ mj_raster_cmd(3, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
+ break;
+ case 3:
+ for (zero_row_count = 0, i = 3 - 1; i >= 0; i--) {
+ out_data = (byte*) plane_data[scan][i];
+ mj_raster_cmd(i, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
+ }
+ break;
+ default:
+ for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
+ out_data = (byte*) plane_data[scan][i];
+ mj_raster_cmd(i, plane_size, out_data, mj_tmp_buf, pdev, prn_stream);
+ }
+ break;
+ } /* Transfer Raster Graphics ... */
{
- if ( pdev->y_pixels_per_inch > 360 ) {
- fwrite("\033(v\2\0\1\0",sizeof(byte),7, prn_stream);
- } else {
- fputc('\n', prn_stream);
- }
- }
- scan = 1 - scan; /* toggle scan direction */
+ if ( pdev->y_pixels_per_inch > 360 ) {
+ fwrite("\033(v\2\0\1\0",sizeof(byte),7, prn_stream);
+ } else {
+ fputc('\n', prn_stream);
+ }
+ }
+ scan = 1 - scan; /* toggle scan direction */
} /* Printing non-blank lines */
} /* for lnum ... */
} /* send each scan line in turn */
-
/* end raster graphics & reset printer */
/* eject page */
@@ -1403,100 +1388,99 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
static void
mj_color_correct(gx_color_value *Rptr ,gx_color_value *Gptr , gx_color_value *Bptr )
- /* R,G,B : 0 to 255 */
+ /* R,G,B : 0 to 255 */
{
- short R,G,B; /* R,G,B : 0 to 255 */
- short C,M,Y; /* C,M,Y : 0 to 1023 */
- short H,D,Wa; /* ese-HSV */
- long S; /* HSV */
-
-
- R = *Rptr;
- G = *Gptr;
- B = *Bptr;
- if (R==G) {
- if (G==B) { /* R=G=B */
- C=M=Y=1023-v_tbl[R];
- *Rptr = C;
- *Gptr = M;
- *Bptr = Y;
- return;
- } else if (G>B) { /* R=G>B */
- D = G-B;
- Wa = R;
- H = 256;
- } else { /* B>R=G */
- D = G-B;
- Wa = R;
- H = 1024;
- }
- }
-
- if (R>G) {
- if (G>=B) { /* R>G>B */
- Wa=R;
- D=R-B;
- H=(G-B)*256/D;
- } else if (R>B) { /* R>B>G */
- Wa=R;
- D=R-G;
- H=1536-(B-G)*256/D;
- } else { /* B>R>G */
- Wa=B;
- D=B-G;
- H=1024+(R-G)*256/D;
- }
- } else {
- if (R>B) { /* G>R>B */
- Wa=G;
- D=G-B;
- H=512-(R-B)*256/D;
- } else if (G>B) { /* G>B>R */
- Wa=G;
- D=G-R;
- H=512+(B-R)*256/D;
- } else { /* B>G>R */
- Wa=B;
- D=B-R;
- H=1024-(G-R)*256/D;
- }
- }
-
- if(Wa!=0){
- if(Wa==D){
- Wa=v_tbl[Wa];
- D=Wa/4;
- } else {
- S=((long)D<<16)/Wa;
- Wa=v_tbl[Wa];
- D= ( ((long)S*Wa)>>18 );
- }
- }
- Wa=1023-Wa;
-
- C=(HtoCMY[H*3 ])*D/256+Wa;
- M=(HtoCMY[H*3+1])*D/256+Wa;
- Y=(HtoCMY[H*3+2])*D/256+Wa;
- if (C<0)
- C=0;
- if (M<0)
- M=0;
- if (Y<0)
- Y=0;
-
- if(H>256 && H<1024){ /* green correct */
- short work;
- work=(((long)grnsep[M]*(long)grnsep2[H-256])>>16);
- C+=work;
- Y+=work+work;
- M-=work+work;
- if(C>1023) C=1023;
- if(Y>1023) Y=1023;
- }
-
- *Rptr = C;
- *Gptr = M;
- *Bptr = Y;
+ short R,G,B; /* R,G,B : 0 to 255 */
+ short C,M,Y; /* C,M,Y : 0 to 1023 */
+ short H,D,Wa; /* ese-HSV */
+ long S; /* HSV */
+
+ R = *Rptr;
+ G = *Gptr;
+ B = *Bptr;
+ if (R==G) {
+ if (G==B) { /* R=G=B */
+ C=M=Y=1023-v_tbl[R];
+ *Rptr = C;
+ *Gptr = M;
+ *Bptr = Y;
+ return;
+ } else if (G>B) { /* R=G>B */
+ D = G-B;
+ Wa = R;
+ H = 256;
+ } else { /* B>R=G */
+ D = G-B;
+ Wa = R;
+ H = 1024;
+ }
+ }
+
+ if (R>G) {
+ if (G>=B) { /* R>G>B */
+ Wa=R;
+ D=R-B;
+ H=(G-B)*256/D;
+ } else if (R>B) { /* R>B>G */
+ Wa=R;
+ D=R-G;
+ H=1536-(B-G)*256/D;
+ } else { /* B>R>G */
+ Wa=B;
+ D=B-G;
+ H=1024+(R-G)*256/D;
+ }
+ } else {
+ if (R>B) { /* G>R>B */
+ Wa=G;
+ D=G-B;
+ H=512-(R-B)*256/D;
+ } else if (G>B) { /* G>B>R */
+ Wa=G;
+ D=G-R;
+ H=512+(B-R)*256/D;
+ } else { /* B>G>R */
+ Wa=B;
+ D=B-R;
+ H=1024-(G-R)*256/D;
+ }
+ }
+
+ if(Wa!=0){
+ if(Wa==D){
+ Wa=v_tbl[Wa];
+ D=Wa/4;
+ } else {
+ S=((long)D<<16)/Wa;
+ Wa=v_tbl[Wa];
+ D= ( ((long)S*Wa)>>18 );
+ }
+ }
+ Wa=1023-Wa;
+
+ C=(HtoCMY[H*3 ])*D/256+Wa;
+ M=(HtoCMY[H*3+1])*D/256+Wa;
+ Y=(HtoCMY[H*3+2])*D/256+Wa;
+ if (C<0)
+ C=0;
+ if (M<0)
+ M=0;
+ if (Y<0)
+ Y=0;
+
+ if(H>256 && H<1024){ /* green correct */
+ short work;
+ work=(((long)grnsep[M]*(long)grnsep2[H-256])>>16);
+ C+=work;
+ Y+=work+work;
+ M-=work+work;
+ if(C>1023) C=1023;
+ if(Y>1023) Y=1023;
+ }
+
+ *Rptr = C;
+ *Gptr = M;
+ *Bptr = Y;
}
/*
@@ -1519,66 +1503,66 @@ gdev_mjc_map_rgb_color(gx_device *pdev, const gx_color_value cv[])
gx_color_value c = gx_max_color_value - r;
gx_color_value m = gx_max_color_value - g;
gx_color_value y = gx_max_color_value - b;
-
+
switch (pdev->color_info.depth) {
case 1:
return ((c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index)1 : (gx_color_index)0);
+ (gx_color_index)1 : (gx_color_index)0);
case 8:
if (pdev->color_info.num_components >= 3)
#define gx_color_value_to_1bit(cv) ((cv) >> (gx_color_value_bits - 1))
- return (gx_color_value_to_1bit(c) +
- (gx_color_value_to_1bit(m) << 1) +
- (gx_color_value_to_1bit(y) << 2));
+ return (gx_color_value_to_1bit(c) +
+ (gx_color_value_to_1bit(m) << 1) +
+ (gx_color_value_to_1bit(y) << 2));
else
#define red_weight 306
#define green_weight 601
#define blue_weight 117
- return ((((word)c * red_weight +
- (word)m * green_weight +
- (word)y * blue_weight)
- >> (gx_color_value_bits + 2)));
+ return ((((word)c * red_weight +
+ (word)m * green_weight +
+ (word)y * blue_weight)
+ >> (gx_color_value_bits + 2)));
case 16:
#define gx_color_value_to_5bits(cv) ((cv) >> (gx_color_value_bits - 5))
#define gx_color_value_to_6bits(cv) ((cv) >> (gx_color_value_bits - 6))
return (gx_color_value_to_5bits(y) +
- (gx_color_value_to_6bits(m) << 5) +
- (gx_color_value_to_5bits(c) << 11));
+ (gx_color_value_to_6bits(m) << 5) +
+ (gx_color_value_to_5bits(c) << 11));
case 24:
return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((word)gx_color_value_to_byte(c) << 16));
+ (gx_color_value_to_byte(m) << 8) +
+ ((word)gx_color_value_to_byte(c) << 16));
case 32:
- {
- gx_color_value k;
- c = gx_color_value_to_byte(r);
- m = gx_color_value_to_byte(g);
- y = gx_color_value_to_byte(b);
+ {
+ gx_color_value k;
+ c = gx_color_value_to_byte(r);
+ m = gx_color_value_to_byte(g);
+ y = gx_color_value_to_byte(b);
- mj_color_correct( &c , &m , &y );
+ mj_color_correct( &c , &m , &y );
- c = esp_dat_c[c];
- m = esp_dat_m[m];
- y = esp_dat_y[y];
+ c = esp_dat_c[c];
+ m = esp_dat_m[m];
+ y = esp_dat_y[y];
- k = c <= m ? (c <= y ? c : y) : (m <= y ? m : y);
- k = black_sep[ k >> 4 ] >> 6;
- c >>= 6;
- m >>= 6;
- y >>= 6;
+ k = c <= m ? (c <= y ? c : y) : (m <= y ? m : y);
+ k = black_sep[ k >> 4 ] >> 6;
+ c >>= 6;
+ m >>= 6;
+ y >>= 6;
return ( (y - k) + ((m - k) << 8) +
- ((word)(c - k) << 16) + ((word)(k) << 24) );
+ ((word)(c - k) << 16) + ((word)(k) << 24) );
}
}
}
return (gx_color_index)0; /* This never happens */
}
-
+
/* Map a color index to a r-g-b color. */
static int
gdev_mjc_map_color_rgb(gx_device *pdev, gx_color_index color,
- gx_color_value prgb[3])
+ gx_color_value prgb[3])
{
/* For the moment, we simply ignore any black correction */
switch (pdev->color_info.depth) {
@@ -1587,27 +1571,27 @@ gdev_mjc_map_color_rgb(gx_device *pdev, gx_color_index color,
break;
case 8:
if (pdev->color_info.num_components >= 3)
- { gx_color_value c = (gx_color_value)color ^ 7;
- prgb[0] = -(c & 1);
- prgb[1] = -((c >> 1) & 1);
- prgb[2] = -(c >> 2);
- }
+ { gx_color_value c = (gx_color_value)color ^ 7;
+ prgb[0] = -(c & 1);
+ prgb[1] = -((c >> 1) & 1);
+ prgb[2] = -(c >> 2);
+ }
else
- { gx_color_value value = (gx_color_value)color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- }
+ { gx_color_value value = (gx_color_value)color ^ 0xff;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ }
break;
case 16:
{ gx_color_value c = (gx_color_value)color ^ 0xffff;
ushort value = c >> 11;
prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
+ (value >> 4)) >> (16 - gx_color_value_bits);
value = (c >> 6) & 0x3f;
prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
+ >> (16 - gx_color_value_bits);
value = c & 0x1f;
prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
+ (value >> 4)) >> (16 - gx_color_value_bits);
}
break;
case 24:
@@ -1648,14 +1632,14 @@ expand_line(word *line, int linesize, int bpp, int ebpp)
endline = ((endline + 1) / 2);
in = start + endline * 2;
out = start + (endline *= 3);
-
+
while (in > start)
- { b0 = *--in;
- b1 = *--in;
- *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
- *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
- *--out = (b1 & 0xf8) + (b1 >> 5);
- }
+ { b0 = *--in;
+ b1 = *--in;
+ *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
+ *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
+ *--out = (b1 & 0xf8) + (b1 >> 5);
+ }
}
if (ebpp == 32) /* 24 (cmy) to 32 (cmyk) if required */
@@ -1665,15 +1649,15 @@ expand_line(word *line, int linesize, int bpp, int ebpp)
out = start + endline * 4;
while (in > start)
- { y = *--in;
- m = *--in;
- c = *--in;
- k = c < m ? (c < y ? c : y) : (m < y ? m : y);
- *--out = y - k;
- *--out = m - k;
- *--out = c - k;
- *--out = k;
- }
+ { y = *--in;
+ m = *--in;
+ c = *--in;
+ k = c < m ? (c < y ? c : y) : (m < y ? m : y);
+ *--out = y - k;
+ *--out = m - k;
+ *--out = c - k;
+ *--out = k;
+ }
}
}
@@ -1692,13 +1676,13 @@ put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue, int minval
*pvalue = value;
return (ecode < 0 ? ecode : 1);
}
-}
+}
static void
set_bpp(gx_device *pdev, int bits_per_pixel)
{ gx_device_color_info *ci = &pdev->color_info;
/* Only valid bits-per-pixel are 1, 3, 8, 16, 24, 32 */
- int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
+ int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
(bits_per_pixel >> 3) << 3;
ci->num_components = ((bpp == 1) || (bpp == 8) ? 1 : 3);
ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
@@ -1713,7 +1697,7 @@ static void
mj500c_set_bpp(gx_device *pdev, int bits_per_pixel)
{ gx_device_color_info *ci = &pdev->color_info;
/* Only valid bits-per-pixel are 1, 3, 8, 16, 24, 32 */
- int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
+ int bpp = bits_per_pixel < 3 ? 1 : bits_per_pixel < 8 ? 3 :
(bits_per_pixel >> 3) << 3;
ci->num_components = ((bpp == 1) || (bpp == 8) ? 1 : 3);
ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
@@ -1750,19 +1734,19 @@ mjc_correct_color(gx_device_printer *pdev, gx_color_index ci)
/* This code is ugly... (for 64 bit OS) */
if (sizeof(word) == 8)
{
- k5 = (((ci >> 32) & cmask) * (mjb)) >> 10;
- k5 = (k5 < cmask) ? k5 : cmask;
- k6 = (((ci >> 40) & cmask) * (mjb)) >> 10;
- k6 = (k6 < cmask) ? k6 : cmask;
- k7 = (((ci >> 48) & cmask) * (mjb)) >> 10;
- k7 = (k7 < cmask) ? k7 : cmask;
- k8 = (((ci >> 56) & cmask) * (mjb)) >> 10;
- k8 = (k8 < cmask) ? k8 : cmask;
- co = k + (k2 << 8) + (k3 << 16) + (k4 << 24)
- + (k5 << 32) + (k6 << 40) + (k7 << 48) + (k8 << 56);
- if (ci != co)
- dprintf1("%s\n", "error");
- return co;
+ k5 = (((ci >> 32) & cmask) * (mjb)) >> 10;
+ k5 = (k5 < cmask) ? k5 : cmask;
+ k6 = (((ci >> 40) & cmask) * (mjb)) >> 10;
+ k6 = (k6 < cmask) ? k6 : cmask;
+ k7 = (((ci >> 48) & cmask) * (mjb)) >> 10;
+ k7 = (k7 < cmask) ? k7 : cmask;
+ k8 = (((ci >> 56) & cmask) * (mjb)) >> 10;
+ k8 = (k8 < cmask) ? k8 : cmask;
+ co = k + (k2 << 8) + (k3 << 16) + (k4 << 24)
+ + (k5 << 32) + (k6 << 40) + (k7 << 48) + (k8 << 56);
+ if (ci != co)
+ dprintf1("%s\n", "error");
+ return co;
}
#endif
return k + (k2 << 8) + (k3 << 16) + (k << 24);
@@ -1771,37 +1755,37 @@ mjc_correct_color(gx_device_printer *pdev, gx_color_index ci)
y = ((ci & cmask) * mjy * dn) >> 20;
y = (y < cmask) ? y : cmask;
m = (((ci >> 8) & cmask) * mjm * dn) >> 20;
- m = (m < cmask) ? m : cmask;
+ m = (m < cmask) ? m : cmask;
c = (((ci >> 16) & cmask) * mjc * dn) >> 20;
- c = (c < cmask) ? c : cmask;
+ c = (c < cmask) ? c : cmask;
k = (((ci >> 24) & cmask) * mjb * dn) >> 20;
- k = (k < cmask) ? k : cmask;
+ k = (k < cmask) ? k : cmask;
#if __WORDSIZE == 64
/* This code is ugly... (for 64 bit OS) */
- if (sizeof(word) == 8)
+ if (sizeof(word) == 8)
{
- y2 = (((ci >> 32) & cmask) * mjy * dn) >> 20;
- y2 = (y2 < cmask) ? y2 : cmask;
- m2 = (((ci >> 40) & cmask) * mjm * dn) >> 20;
- m2 = (m2 < cmask) ? m2 : cmask;
- c2 = (((ci >> 48) & cmask) * mjc * dn) >> 20;
- c2 = (c2 < cmask) ? c2 : cmask;
- k2 = (((ci >> 56) & cmask) * mjb * dn) >> 20;
- k2 = (k2 < cmask) ? k2 : cmask;
-
- co = y + (m << 8) + (c << 16) + (k << 24)
- + (y2 << 32) + (m2 << 40) + (c2 << 48) + (k2 << 56);
-
- return co;
+ y2 = (((ci >> 32) & cmask) * mjy * dn) >> 20;
+ y2 = (y2 < cmask) ? y2 : cmask;
+ m2 = (((ci >> 40) & cmask) * mjm * dn) >> 20;
+ m2 = (m2 < cmask) ? m2 : cmask;
+ c2 = (((ci >> 48) & cmask) * mjc * dn) >> 20;
+ c2 = (c2 < cmask) ? c2 : cmask;
+ k2 = (((ci >> 56) & cmask) * mjb * dn) >> 20;
+ k2 = (k2 < cmask) ? k2 : cmask;
+
+ co = y + (m << 8) + (c << 16) + (k << 24)
+ + (y2 << 32) + (m2 << 40) + (c2 << 48) + (k2 << 56);
+
+ return co;
}
#endif
co = (y + (m << 8) + (c << 16) + (k << 24));
/* dprintf6("%d,%d:%d,%d,%d,%d\n", ci,co, y, m, c, k); */
return co;
/* return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((word)gx_color_value_to_byte(c) << 16) +
- ((word)gx_color_value_to_byte(k) << 24)); */
+ (gx_color_value_to_byte(m) << 8) +
+ ((word)gx_color_value_to_byte(c) << 16) +
+ ((word)gx_color_value_to_byte(k) << 24)); */
break;
}
return ci;
diff --git a/gs/contrib/japanese/gdevmjc.h b/gs/contrib/japanese/gdevmjc.h
index 36e22256f..782bdd3f0 100644
--- a/gs/contrib/japanese/gdevmjc.h
+++ b/gs/contrib/japanese/gdevmjc.h
@@ -1,2183 +1,2183 @@
unsigned short matrix2[] = { /* 128 x 128 */
- 0x0C3E,0x31BE,0x249A,0x0B88,0x2898,0x162F,0x2AEE,0x12D4,
- 0x20F1,0x3E08,0x0E3C,0x244A,0x3C5C,0x102A,0x36AE,0x0DB5,
- 0x27D2,0x3774,0x01D0,0x3A3B,0x18C7,0x356C,0x0E6C,0x2938,
- 0x1AB3,0x3B3E,0x04D9,0x2BF8,0x1C80,0x087C,0x2F7E,0x043B,
- 0x295E,0x097F,0x30AE,0x1722,0x38C5,0x1F2A,0x0491,0x2B7B,
- 0x169B,0x2887,0x1413,0x325B,0x03CD,0x2CF4,0x119A,0x2471,
- 0x19A8,0x2735,0x14AA,0x3D50,0x20F5,0x0141,0x22B3,0x2FA0,
- 0x0656,0x23CF,0x1BE4,0x3010,0x0712,0x1D9F,0x375C,0x1205,
- 0x3080,0x06B0,0x2922,0x0307,0x2CC4,0x0823,0x3E98,0x2587,
- 0x0CA3,0x2954,0x038C,0x3073,0x2549,0x0DE1,0x3124,0x0445,
- 0x2C5E,0x07B5,0x2A4E,0x0A5E,0x35B0,0x0332,0x2382,0x3192,
- 0x04A9,0x2C00,0x171D,0x2F1A,0x0DDC,0x2927,0x03A5,0x261E,
- 0x083F,0x3B04,0x1DFE,0x044C,0x2B6C,0x09BA,0x1735,0x3D78,
- 0x1D30,0x08BD,0x37CD,0x20D0,0x0682,0x22CF,0x2FCC,0x1155,
- 0x326E,0x1845,0x2364,0x2C10,0x19E2,0x088A,0x3B49,0x1873,
- 0x3482,0x0FF4,0x27F5,0x0CD4,0x2E0A,0x1382,0x22D3,0x2B6E,
- 0x3BFF,0x016F,0x1992,0x3F5F,0x05CB,0x38EF,0x0CFB,0x356B,
- 0x275C,0x0403,0x2DAF,0x1D82,0x010F,0x2645,0x1A9D,0x2EF8,
- 0x05D7,0x1C57,0x30C4,0x0BA3,0x2E75,0x0429,0x1DF0,0x3D8E,
- 0x0960,0x2096,0x3321,0x0EF7,0x3AAE,0x2316,0x1939,0x37FD,
- 0x1469,0x3B05,0x1034,0x2CAE,0x0842,0x2EB8,0x22EC,0x0C54,
- 0x3443,0x0143,0x2F86,0x1859,0x39D5,0x15D1,0x3584,0x0019,
- 0x3C08,0x09C2,0x2B6F,0x073C,0x2F02,0x1B5B,0x3A29,0x1058,
- 0x1F25,0x3CEB,0x03E2,0x24FA,0x18A2,0x31A8,0x0922,0x2611,
- 0x1A5B,0x3F46,0x11A2,0x3515,0x1543,0x3105,0x0F0C,0x1FAF,
- 0x2D16,0x17D3,0x3D90,0x1F42,0x0699,0x3BFD,0x1355,0x37A8,
- 0x10CD,0x3FA7,0x12A9,0x27DA,0x160A,0x2DBE,0x1AE2,0x10A4,
- 0x3E93,0x1DD2,0x0A31,0x21BC,0x3BFB,0x155A,0x35CD,0x13C5,
- 0x32B2,0x22D7,0x105B,0x33BE,0x1AA7,0x221E,0x3243,0x0377,
- 0x2F55,0x1FFF,0x0EB8,0x32F2,0x1B3E,0x3A3C,0x03AB,0x28B3,
- 0x0829,0x3F37,0x029E,0x154A,0x3D3D,0x2269,0x14C2,0x2EE5,
- 0x0798,0x2A1B,0x02FD,0x3251,0x1B18,0x3DEC,0x0467,0x1CB9,
- 0x104F,0x220F,0x2C3C,0x1118,0x2DD5,0x1ADD,0x2407,0x06E0,
- 0x1928,0x37FC,0x13AB,0x34E2,0x1772,0x3ABA,0x08A2,0x22D6,
- 0x3D59,0x10FF,0x25AF,0x1ED2,0x0F89,0x394D,0x23CC,0x14F4,
- 0x2D0A,0x1286,0x24D3,0x1E4A,0x00A5,0x3409,0x0C91,0x208F,
- 0x26C4,0x01A7,0x23A8,0x198B,0x35B5,0x0F08,0x3C7E,0x1929,
- 0x21C5,0x3B6A,0x0D90,0x2594,0x07F0,0x29F6,0x0BF1,0x28A2,
- 0x13FA,0x30B3,0x1890,0x389C,0x10DB,0x291C,0x0B24,0x259C,
- 0x31ED,0x0EE0,0x2AC5,0x0C6C,0x3C50,0x157E,0x20B0,0x3B87,
- 0x04B0,0x1FFC,0x24C1,0x09CD,0x27A8,0x18F8,0x35AD,0x015E,
- 0x39AB,0x08C8,0x2300,0x1515,0x3478,0x1C1E,0x2378,0x094E,
- 0x25F0,0x1D94,0x33B2,0x0590,0x3D54,0x0D15,0x3840,0x268E,
- 0x0882,0x2819,0x36C8,0x1C99,0x0674,0x2E0F,0x09A0,0x2A2F,
- 0x1C23,0x0126,0x37F3,0x2014,0x0640,0x3AB3,0x112E,0x2A22,
- 0x14B0,0x3C39,0x2744,0x00D1,0x2BDF,0x1465,0x31C8,0x1330,
- 0x2DEA,0x1AF8,0x2179,0x2E74,0x0C89,0x2ADF,0x0127,0x1D92,
- 0x382E,0x162D,0x3CED,0x2143,0x08D9,0x2745,0x180B,0x3045,
- 0x1F0F,0x3956,0x0857,0x369A,0x207B,0x0256,0x3C98,0x1D3B,
- 0x2CC1,0x1057,0x28E2,0x0B17,0x2C13,0x155E,0x3148,0x0E65,
- 0x203F,0x336D,0x0721,0x3F48,0x2A60,0x19D6,0x0853,0x35A3,
- 0x0335,0x3891,0x0753,0x3F18,0x27C0,0x12E6,0x2CD6,0x06BD,
- 0x32E4,0x1B13,0x3F98,0x0594,0x2569,0x1E35,0x0265,0x321C,
- 0x08AF,0x1B82,0x2CAF,0x1304,0x32F8,0x1DED,0x3D27,0x0FFC,
- 0x34F8,0x1D1A,0x0300,0x21D3,0x32D2,0x04F2,0x3E36,0x1A8F,
- 0x023B,0x3811,0x1406,0x3350,0x1D51,0x0157,0x2EFF,0x103E,
- 0x33C9,0x0E9A,0x3728,0x1B00,0x3B2E,0x0523,0x1CD1,0x2A38,
- 0x11C7,0x1E8F,0x36FE,0x0D0A,0x2762,0x0105,0x2F49,0x1A9A,
- 0x3244,0x01C8,0x18BA,0x2E6E,0x1DFB,0x24F9,0x0116,0x1861,
- 0x3520,0x15FA,0x02D0,0x2CCE,0x178F,0x22CB,0x38C1,0x0ED0,
- 0x3DC7,0x18D5,0x29E2,0x0B5E,0x2E3D,0x16A7,0x2652,0x0C06,
- 0x317D,0x072F,0x1988,0x355F,0x0C2C,0x248C,0x08F1,0x3834,
- 0x1FB3,0x0D5B,0x340E,0x064F,0x36BE,0x113B,0x3A1D,0x256B,
- 0x0DF3,0x2C2B,0x0C0F,0x196C,0x33AB,0x11DA,0x37BC,0x066B,
- 0x326C,0x0F18,0x1DBD,0x2513,0x14C6,0x3023,0x0F72,0x3425,
- 0x0907,0x3FC1,0x030D,0x3670,0x2217,0x04DD,0x1CB2,0x3836,
- 0x026C,0x184D,0x2DA6,0x165B,0x004B,0x2616,0x305D,0x11D1,
- 0x289B,0x17E4,0x2E62,0x1685,0x0A47,0x370B,0x1855,0x3D62,
- 0x10E5,0x2E22,0x0E19,0x2BD3,0x1182,0x3A07,0x28F0,0x104D,
- 0x2048,0x35F4,0x04E2,0x3FC7,0x1A0A,0x0299,0x2183,0x2E4B,
- 0x05D9,0x25EC,0x3F5E,0x0D2F,0x1D95,0x2A52,0x13A4,0x2DCC,
- 0x217B,0x1818,0x2C96,0x05A4,0x26C5,0x392A,0x0B6F,0x2B16,
- 0x1850,0x2E72,0x00A2,0x2C36,0x1320,0x230C,0x3CB8,0x0D59,
- 0x340F,0x2512,0x0330,0x2D9C,0x185D,0x3B23,0x1204,0x38A8,
- 0x0EA0,0x2111,0x39EB,0x14D2,0x08DB,0x3AB7,0x1C61,0x30DB,
- 0x0E0B,0x2457,0x3952,0x1009,0x3E4B,0x01B0,0x1EDD,0x30A0,
- 0x0562,0x2788,0x0F85,0x3CB0,0x1447,0x357D,0x019B,0x3F72,
- 0x1003,0x246B,0x3931,0x1196,0x1EA8,0x3EA2,0x18CA,0x2620,
- 0x018E,0x3A95,0x1703,0x269A,0x1BAF,0x31F0,0x0933,0x19AA,
- 0x30CD,0x0555,0x24A5,0x39B5,0x00E3,0x29A0,0x0D84,0x247E,
- 0x02E4,0x2805,0x3D48,0x047B,0x3359,0x0A70,0x2A68,0x1797,
- 0x2568,0x1414,0x2E1C,0x1C39,0x0D69,0x3DE2,0x2834,0x116C,
- 0x2978,0x3C1C,0x0968,0x21E9,0x3227,0x13BE,0x1FEA,0x3E14,
- 0x0BEB,0x349B,0x0D6C,0x20E3,0x30FE,0x1C05,0x02D8,0x245E,
- 0x1F4C,0x080E,0x386D,0x1EBA,0x313B,0x09E4,0x16F9,0x3E62,
- 0x26B7,0x0B8A,0x2A64,0x0F94,0x2750,0x3717,0x0B06,0x17E7,
- 0x3AA6,0x1247,0x2360,0x19CE,0x37B1,0x0C3B,0x3607,0x07B7,
- 0x39F6,0x0976,0x1E03,0x3FD4,0x0DA2,0x1964,0x34FA,0x22EF,
- 0x07FB,0x1D79,0x395D,0x2158,0x0954,0x3208,0x15CB,0x2EE6,
- 0x06FB,0x19A7,0x3FD4,0x13A6,0x3331,0x0BAD,0x2A9B,0x0476,
- 0x26D3,0x347E,0x0C34,0x2331,0x2BAE,0x0FF8,0x2D57,0x06A6,
- 0x3D10,0x1E54,0x0B85,0x3219,0x1A77,0x2994,0x0C3F,0x23DD,
- 0x158B,0x36F8,0x20A9,0x03FB,0x2BE2,0x0EF6,0x2893,0x17B0,
- 0x2CBF,0x1DAE,0x031B,0x21E6,0x2E89,0x049B,0x324A,0x1101,
- 0x3032,0x22B0,0x098B,0x3DD1,0x03EF,0x23C9,0x1E0B,0x3F5A,
- 0x11D3,0x3522,0x0E61,0x1C04,0x2F7A,0x15A6,0x3EA8,0x1AB0,
- 0x3A8B,0x1875,0x0C74,0x2BF0,0x130B,0x3B22,0x1C73,0x0130,
- 0x38C0,0x1F32,0x0698,0x3B50,0x1903,0x239D,0x0A5F,0x34A2,
- 0x2110,0x0F04,0x1DD7,0x380C,0x0C9A,0x3B76,0x052A,0x1AC4,
- 0x2B8B,0x01E1,0x2442,0x3BC4,0x0545,0x268A,0x39AD,0x0DC6,
- 0x362A,0x2760,0x1521,0x0042,0x1A4D,0x367C,0x2218,0x038B,
- 0x1498,0x394F,0x1D77,0x31FB,0x0718,0x2348,0x1CDD,0x2AD3,
- 0x0E17,0x2ED7,0x0844,0x2CD2,0x0103,0x2691,0x173E,0x2837,
- 0x12CE,0x3143,0x24A6,0x11A0,0x2DAC,0x2195,0x0439,0x1468,
- 0x3E12,0x29C5,0x0E00,0x1696,0x3ED9,0x1C46,0x0297,0x2200,
- 0x385D,0x285D,0x09E5,0x298C,0x05E4,0x24C6,0x16E3,0x3EB8,
- 0x1CA2,0x0719,0x1FFB,0x3DA7,0x03BE,0x3625,0x16D4,0x2097,
- 0x28AA,0x04C2,0x2B63,0x1F84,0x0735,0x3784,0x140E,0x3C3D,
- 0x1DCC,0x08E7,0x31F5,0x1885,0x21E5,0x38DE,0x0A64,0x34BF,
- 0x05BA,0x3B71,0x1A7B,0x3432,0x0F4D,0x2A95,0x0B0C,0x3C62,
- 0x1D48,0x0E79,0x2C8C,0x129F,0x2A7C,0x1404,0x2D42,0x0225,
- 0x29CE,0x16B7,0x3C61,0x21B8,0x0A37,0x348F,0x076C,0x2B43,
- 0x099B,0x2247,0x352B,0x1647,0x2669,0x0605,0x2E7C,0x225E,
- 0x0E82,0x3264,0x2709,0x10EC,0x2F20,0x009D,0x2D32,0x1A21,
- 0x0666,0x3638,0x26B6,0x0461,0x29DD,0x0F63,0x2766,0x360E,
- 0x103F,0x3913,0x1D47,0x0F0D,0x2D70,0x1138,0x1E34,0x29C0,
- 0x04A2,0x1803,0x3CD5,0x200D,0x2B19,0x0789,0x2D82,0x1CA3,
- 0x3056,0x22A3,0x00BF,0x1839,0x386E,0x10EB,0x3DEA,0x019F,
- 0x3540,0x1E70,0x397E,0x1695,0x3CA0,0x115A,0x3418,0x0419,
- 0x3C09,0x1BFB,0x0071,0x36C9,0x078E,0x3B0B,0x1CE0,0x3252,
- 0x1777,0x0355,0x27E0,0x3090,0x0636,0x2452,0x2CEF,0x0C11,
- 0x1450,0x1E26,0x35CF,0x1121,0x3C3E,0x1488,0x317E,0x0F69,
- 0x2C58,0x181A,0x3044,0x10A7,0x1D41,0x2770,0x0AE5,0x333F,
- 0x11BE,0x3A75,0x10E2,0x2F4A,0x169C,0x224E,0x3164,0x032F,
- 0x2EC7,0x2317,0x1360,0x3ED8,0x078C,0x1B19,0x2F00,0x15C5,
- 0x270A,0x10F9,0x2915,0x07AC,0x3D66,0x1724,0x2767,0x2083,
- 0x055E,0x385A,0x1A32,0x35EC,0x0800,0x3A88,0x0DAA,0x3741,
- 0x0B75,0x27AE,0x0422,0x2D94,0x1341,0x25AE,0x1F93,0x143A,
- 0x1C91,0x2FC8,0x0066,0x3EE5,0x0F4E,0x36E3,0x1511,0x3E1E,
- 0x1DB3,0x0AA4,0x2101,0x35AA,0x0C70,0x3982,0x11E8,0x3F12,
- 0x1D27,0x2333,0x1301,0x2F92,0x1790,0x33B0,0x20D2,0x082E,
- 0x1E6A,0x25DE,0x06DB,0x3289,0x1764,0x3F6B,0x089F,0x32AA,
- 0x1C6F,0x2FC9,0x0B2A,0x336F,0x1089,0x3B85,0x0CF8,0x378E,
- 0x06C1,0x167F,0x3BD4,0x2555,0x0C8E,0x2C69,0x15F2,0x3154,
- 0x1A80,0x053A,0x26F4,0x0A46,0x212F,0x2E16,0x0E4E,0x29B0,
- 0x1039,0x2384,0x2F74,0x1502,0x28C3,0x1271,0x2AAE,0x0BF6,
- 0x254E,0x3893,0x0AB6,0x1BA9,0x364B,0x0F80,0x3A79,0x1FC5,
- 0x3DC6,0x0047,0x2169,0x2E4D,0x0D76,0x2B7C,0x026B,0x369C,
- 0x09BF,0x3BD0,0x008F,0x2271,0x3861,0x0EE9,0x3F2E,0x0240,
- 0x2596,0x19D7,0x33EA,0x0053,0x3FC0,0x0952,0x1B2A,0x2B32,
- 0x0CF7,0x3A8C,0x00B2,0x1C72,0x2D75,0x2346,0x02C3,0x3DB6,
- 0x0D0B,0x36BB,0x1539,0x3003,0x1C97,0x0205,0x3524,0x1085,
- 0x2F3A,0x236F,0x008E,0x2017,0x30F3,0x1909,0x2429,0x1C27,
- 0x3087,0x0FD8,0x332A,0x1E64,0x3B7C,0x01F5,0x3829,0x294A,
- 0x342B,0x0D5C,0x2A12,0x1E98,0x3150,0x09F7,0x27B3,0x043F,
- 0x2921,0x3A4A,0x0283,0x1D0B,0x2A88,0x1607,0x27A9,0x0B4D,
- 0x30D6,0x0202,0x38EB,0x0A98,0x3FD4,0x0134,0x15AC,0x3AE0,
- 0x2A35,0x13EB,0x3CF3,0x21BE,0x00E7,0x2847,0x1F87,0x0E5B,
- 0x3B2D,0x13B1,0x2832,0x040A,0x24F1,0x18A1,0x29B6,0x123A,
- 0x27B2,0x341B,0x0901,0x1BD3,0x3024,0x046B,0x2889,0x0D50,
- 0x2401,0x375F,0x1294,0x32AB,0x1B75,0x0614,0x3F16,0x17BB,
- 0x35AE,0x0AFD,0x19AF,0x3D9D,0x0CF9,0x3535,0x01EA,0x3D22,
- 0x207E,0x10F3,0x337E,0x2387,0x136E,0x2A15,0x0450,0x16CF,
- 0x25DD,0x30EA,0x1925,0x04E1,0x377D,0x1DBB,0x260F,0x1A00,
- 0x2054,0x272C,0x14E9,0x3229,0x0601,0x2EE9,0x2172,0x1B68,
- 0x301A,0x0805,0x2481,0x1ECC,0x0F15,0x3459,0x2687,0x1128,
- 0x32D3,0x1659,0x2968,0x35EE,0x0D86,0x3986,0x13E3,0x2132,
- 0x2D9A,0x0021,0x2B40,0x09F0,0x3384,0x229B,0x0BB7,0x3B25,
- 0x1E72,0x14F3,0x3EF1,0x0F2C,0x26E1,0x034B,0x3CC3,0x070A,
- 0x2161,0x3E76,0x15EF,0x0938,0x1AE0,0x2BE4,0x16DC,0x0592,
- 0x11F3,0x39B6,0x17D8,0x080C,0x1A90,0x2C7A,0x12AE,0x33CD,
- 0x0F9D,0x2381,0x1807,0x3D08,0x07A3,0x33A2,0x03BB,0x3736,
- 0x16C1,0x28BB,0x193C,0x2BC9,0x1166,0x2257,0x3292,0x198C,
- 0x0373,0x3033,0x0B57,0x1BC7,0x3600,0x120B,0x381D,0x23D9,
- 0x01F7,0x2C73,0x0FA3,0x3EF4,0x14FB,0x34B3,0x01C0,0x3D88,
- 0x1FA5,0x0F4F,0x20DC,0x3F13,0x11F6,0x363D,0x1408,0x3B44,
- 0x0752,0x1D91,0x2A16,0x0250,0x3A7B,0x252F,0x13FC,0x2BC5,
- 0x02F7,0x25C6,0x3275,0x04CB,0x235A,0x1C3B,0x2FCF,0x1893,
- 0x072B,0x2C4C,0x1A31,0x0131,0x3BD6,0x0C64,0x3332,0x229A,
- 0x0957,0x126F,0x342A,0x27D1,0x153D,0x0AAE,0x3E26,0x055A,
- 0x3470,0x0B79,0x3990,0x1E32,0x2B4F,0x177B,0x0C9B,0x3BA8,
- 0x1387,0x3671,0x0C29,0x3B29,0x2818,0x198F,0x0435,0x3D71,
- 0x236C,0x0638,0x1FE4,0x09DA,0x2631,0x19AC,0x3100,0x084A,
- 0x1E9B,0x3AC4,0x1948,0x2592,0x0F99,0x393E,0x19DE,0x27FE,
- 0x06E8,0x34AA,0x09CB,0x2EF4,0x121C,0x3378,0x1520,0x2E6B,
- 0x1856,0x0010,0x2A58,0x22CC,0x3552,0x0B58,0x3FD4,0x20F3,
- 0x2482,0x03A4,0x2BA1,0x1FB2,0x3BBA,0x01D6,0x384F,0x1A08,
- 0x3074,0x0C13,0x2D03,0x12E7,0x287E,0x19CA,0x24A4,0x1417,
- 0x2C81,0x0CB0,0x3D4D,0x05C5,0x1E25,0x2E51,0x0996,0x241F,
- 0x34D1,0x110C,0x2704,0x2ED3,0x0A6F,0x2BD7,0x0714,0x18FB,
- 0x34FE,0x1FCC,0x3188,0x0668,0x291D,0x0C19,0x2EB0,0x1C2B,
- 0x0553,0x3231,0x2622,0x02CE,0x29C9,0x0A88,0x1F6E,0x2DBB,
- 0x188D,0x3EB4,0x101E,0x2F21,0x1FDF,0x08D7,0x3650,0x0C95,
- 0x38E3,0x1EB3,0x0F34,0x292D,0x3A4C,0x0904,0x159C,0x2759,
- 0x398A,0x0E41,0x3F6D,0x25F4,0x152A,0x2E97,0x1176,0x3809,
- 0x1CC5,0x39F5,0x0811,0x1B64,0x3AAB,0x21CE,0x1742,0x2D3C,
- 0x119E,0x29B9,0x1AF3,0x07A1,0x135D,0x37BD,0x2650,0x0503,
- 0x298E,0x0FA4,0x2D02,0x1734,0x0688,0x3832,0x219D,0x0B9E,
- 0x18C0,0x3892,0x2A9F,0x16F0,0x3C6B,0x04B7,0x22EA,0x37DA,
- 0x0E18,0x243D,0x0662,0x3FB6,0x1E4E,0x0501,0x2E2D,0x0ECF,
- 0x31A1,0x139B,0x25CA,0x1B8F,0x39CB,0x0880,0x2AE2,0x0A96,
- 0x36F7,0x1CF5,0x3947,0x0693,0x17BD,0x28BF,0x10CA,0x3050,
- 0x1B3C,0x3CEF,0x1086,0x34BE,0x0E5E,0x2613,0x2137,0x06FD,
- 0x1FF1,0x390E,0x056B,0x3579,0x0EBC,0x3E61,0x0D4C,0x3A26,
- 0x051D,0x335F,0x0FEC,0x251F,0x3706,0x150B,0x3C85,0x1332,
- 0x1FAA,0x3E60,0x058E,0x179A,0x3BF0,0x138A,0x2649,0x3D7D,
- 0x1551,0x091E,0x1B62,0x3730,0x1776,0x3A54,0x12F7,0x2423,
- 0x3813,0x0D8B,0x18CD,0x33B8,0x1599,0x39C2,0x23B3,0x005B,
- 0x2904,0x0B7D,0x342E,0x197A,0x0DD4,0x3093,0x227D,0x1A06,
- 0x29CF,0x0816,0x3E78,0x1CC7,0x10BE,0x2104,0x3665,0x03A0,
- 0x1F31,0x3220,0x05EB,0x1DCF,0x36BA,0x07C7,0x281C,0x0237,
- 0x2D61,0x1609,0x2118,0x2BEA,0x0147,0x2F35,0x08E4,0x2302,
- 0x381F,0x02AD,0x3F8D,0x23F8,0x3146,0x016A,0x1FAE,0x34BD,
- 0x18EB,0x3DF1,0x0314,0x213D,0x2E5F,0x1084,0x2C20,0x1CA6,
- 0x31A4,0x12E3,0x0269,0x3021,0x0E69,0x3421,0x0BE6,0x1D01,
- 0x2C59,0x1620,0x2FB2,0x11D5,0x3242,0x21A6,0x178B,0x3DF5,
- 0x0290,0x20F4,0x3BBC,0x046A,0x1FE3,0x2508,0x1A5E,0x321F,
- 0x0EE3,0x28EC,0x1308,0x252B,0x3B1F,0x0318,0x366C,0x08D8,
- 0x3308,0x152D,0x2F43,0x05E0,0x1D9A,0x3296,0x157A,0x3F8E,
- 0x11BC,0x257D,0x1BDD,0x21CB,0x2E35,0x018C,0x2962,0x1AFC,
- 0x268D,0x164E,0x2FD6,0x200E,0x07C8,0x2951,0x02CF,0x2BFD,
- 0x0875,0x1A11,0x3217,0x221C,0x027B,0x314B,0x1AF7,0x0428,
- 0x2F09,0x1EB7,0x2B61,0x0DA9,0x266C,0x0354,0x2CB7,0x09F9,
- 0x1A4E,0x2AAA,0x3B1B,0x098D,0x2F8C,0x069A,0x1AD5,0x3CDE,
- 0x1314,0x2BF5,0x03CC,0x244C,0x3D79,0x15EC,0x00CC,0x3BB9,
- 0x138D,0x2167,0x2C93,0x018B,0x3786,0x2868,0x0E9E,0x30E8,
- 0x1074,0x246D,0x190A,0x2DC2,0x0EED,0x2B21,0x12ED,0x3C94,
- 0x2211,0x057A,0x3F08,0x0DD0,0x34E1,0x1233,0x3CDB,0x1BD9,
- 0x0EA6,0x31D5,0x17EA,0x0ABB,0x1ED8,0x3AD1,0x14A5,0x2BB8,
- 0x09B4,0x23DC,0x1BC9,0x39FF,0x1467,0x3510,0x0135,0x3BB5,
- 0x08B7,0x2776,0x3FA6,0x21C7,0x1B98,0x290D,0x14B5,0x3E89,
- 0x0341,0x3580,0x0AB1,0x2A23,0x016B,0x37BB,0x092B,0x2646,
- 0x1ADC,0x2D77,0x105F,0x2A8D,0x0D55,0x311A,0x01B4,0x21C6,
- 0x3E0D,0x04ED,0x34D9,0x0A5A,0x1FB8,0x2E4E,0x13B7,0x205E,
- 0x00C6,0x295D,0x0BA9,0x24C9,0x3DA6,0x03E1,0x298D,0x0AC2,
- 0x2F96,0x002F,0x3C8B,0x0A26,0x1926,0x37D5,0x1366,0x34F5,
- 0x0BB6,0x3C27,0x00AE,0x1AAB,0x3B20,0x0E56,0x3543,0x1068,
- 0x39FE,0x2528,0x0F26,0x380A,0x1E65,0x0FE1,0x3958,0x2123,
- 0x0D20,0x33F1,0x0082,0x3C53,0x11D8,0x358A,0x15C7,0x3FD4,
- 0x220B,0x0113,0x201A,0x1393,0x24E1,0x1DB2,0x312D,0x0F75,
- 0x3549,0x16DE,0x38B3,0x1DE8,0x078F,0x331A,0x203E,0x2AFB,
- 0x056C,0x34B6,0x15B4,0x2664,0x1E2B,0x0697,0x3CCC,0x1ACB,
- 0x2A43,0x0A16,0x3820,0x02CA,0x3E3A,0x1D23,0x3147,0x0B59,
- 0x1BE2,0x2FF4,0x13AF,0x26C7,0x1840,0x299B,0x04AB,0x2DF6,
- 0x210C,0x0854,0x228F,0x2FD1,0x1072,0x27F3,0x08BE,0x1D31,
- 0x38CF,0x11FB,0x32D8,0x0778,0x29AC,0x0C3A,0x26EE,0x0FBC,
- 0x2F24,0x1E59,0x1529,0x0973,0x3A2F,0x00FA,0x31F1,0x1A2C,
- 0x2558,0x129C,0x3CC2,0x18A4,0x277F,0x1310,0x304C,0x1584,
- 0x3909,0x0B2E,0x3577,0x17CD,0x3FD4,0x1640,0x37E4,0x0C01,
- 0x1E58,0x2EC1,0x1144,0x2C32,0x19C9,0x0CFA,0x3DE6,0x2667,
- 0x3914,0x0EC1,0x3733,0x20D5,0x0F47,0x2EC9,0x1322,0x3538,
- 0x1884,0x2B04,0x14CA,0x3235,0x2127,0x0944,0x2B54,0x0626,
- 0x2D49,0x1278,0x2290,0x3240,0x13B0,0x279E,0x1707,0x2DC5,
- 0x205F,0x0010,0x2B53,0x0C17,0x2F79,0x2597,0x09BD,0x288E,
- 0x3EAD,0x12A3,0x245D,0x1D03,0x2DC4,0x0ABE,0x28BC,0x076B,
- 0x2F05,0x1709,0x2913,0x3DC5,0x03FE,0x38FD,0x0B0A,0x27CC,
- 0x053C,0x2608,0x0CEB,0x2E3A,0x1B23,0x280E,0x0A1B,0x170C,
- 0x399B,0x1BCC,0x08D4,0x33A8,0x0CEA,0x2D5B,0x1F74,0x0012,
- 0x3B62,0x1451,0x2794,0x16F3,0x23C1,0x063C,0x1756,0x35B1,
- 0x2560,0x0A1A,0x32EF,0x032D,0x3731,0x0CA4,0x39B2,0x14C3,
- 0x35CE,0x1C37,0x3C54,0x040B,0x363E,0x1660,0x3ED4,0x2547,
- 0x00C5,0x28FF,0x0DB7,0x2FC7,0x1D05,0x3F35,0x1345,0x372A,
- 0x228D,0x03CB,0x3475,0x2390,0x1889,0x2084,0x269D,0x07F3,
- 0x3367,0x1F26,0x05ED,0x2C21,0x0CF2,0x3BDD,0x1D8D,0x05C1,
- 0x2897,0x1F02,0x00E6,0x2CED,0x069E,0x2864,0x133E,0x2B76,
- 0x14EC,0x2310,0x3BF9,0x0183,0x3796,0x2230,0x0715,0x1917,
- 0x1239,0x2ADA,0x1D22,0x07F6,0x3A0D,0x1B90,0x23FE,0x0772,
- 0x3B86,0x0BF5,0x27D4,0x0468,0x3AF5,0x1C06,0x2216,0x3ECE,
- 0x0E68,0x1E97,0x3885,0x0AED,0x2B05,0x04E6,0x3EEB,0x092E,
- 0x1B6F,0x3679,0x1644,0x3FB7,0x05F6,0x1981,0x31D2,0x169F,
- 0x076E,0x20B4,0x38D6,0x0595,0x1825,0x328D,0x1D55,0x3888,
- 0x10B4,0x369D,0x0C73,0x1B0E,0x2D36,0x1518,0x2B3E,0x194B,
- 0x3293,0x1581,0x3C67,0x0206,0x3588,0x12C4,0x3F49,0x22F0,
- 0x0DCD,0x3017,0x20E0,0x118C,0x3FB4,0x1367,0x356A,0x17B7,
- 0x2224,0x31AC,0x0886,0x2F60,0x0D36,0x3A1E,0x28F5,0x00A7,
- 0x19BE,0x3B0C,0x15C2,0x2906,0x1B0A,0x2488,0x0FA9,0x288B,
- 0x0026,0x2A2B,0x0E20,0x26FA,0x0C7B,0x2DC0,0x05F8,0x1A9F,
- 0x358F,0x154D,0x3C9F,0x1851,0x02B0,0x20CB,0x2867,0x0599,
- 0x182A,0x39A8,0x0EE1,0x2F9E,0x06B8,0x355E,0x0CC6,0x3B8D,
- 0x0EA3,0x23C3,0x3850,0x1016,0x3400,0x0400,0x2420,0x372B,
- 0x0E1D,0x3CFA,0x24AF,0x127B,0x32B9,0x0CC3,0x3B4C,0x03DB,
- 0x3681,0x0858,0x1B6A,0x2827,0x0FDF,0x2F5E,0x1DB4,0x2D60,
- 0x3CBC,0x02D4,0x324F,0x1A10,0x26E6,0x0165,0x30DE,0x1EDF,
- 0x110F,0x31BC,0x176F,0x2BB4,0x106B,0x2ED4,0x021A,0x1871,
- 0x3301,0x24DD,0x0393,0x2F2F,0x1CAF,0x31C4,0x1217,0x2439,
- 0x30D8,0x0CB9,0x297F,0x1445,0x23B9,0x3AC3,0x0186,0x36F2,
- 0x1C9A,0x3086,0x0E90,0x26B2,0x3E19,0x1471,0x0236,0x216D,
- 0x2B0E,0x04FC,0x309B,0x2434,0x0891,0x3408,0x0180,0x3FA2,
- 0x0915,0x2CBC,0x1173,0x28E7,0x0EFC,0x25A9,0x045C,0x2DFD,
- 0x1E09,0x0274,0x37E5,0x2716,0x03EE,0x2984,0x0A44,0x2E69,
- 0x0512,0x1EAD,0x393B,0x1A5C,0x33E4,0x1F4D,0x1197,0x3FD4,
- 0x20D3,0x075E,0x2CB5,0x0B8C,0x3D3B,0x05B5,0x335B,0x12EA,
- 0x3E65,0x15C9,0x3511,0x1942,0x3B5F,0x1446,0x2399,0x317F,
- 0x0A09,0x2B1D,0x0541,0x2374,0x37E8,0x0B05,0x35BB,0x1C32,
- 0x2CE2,0x0A8D,0x2A67,0x16A0,0x3D2A,0x1319,0x2B56,0x1726,
- 0x2D4C,0x01C9,0x1B15,0x3089,0x146D,0x29B1,0x0C04,0x1C4B,
- 0x2F19,0x1676,0x08C2,0x3A00,0x22B7,0x1BFE,0x213E,0x2F25,
- 0x0F62,0x2004,0x33A3,0x144B,0x3F85,0x0425,0x35A5,0x09FA,
- 0x163B,0x25A7,0x13FD,0x3F40,0x1193,0x3655,0x149D,0x3889,
- 0x21F1,0x0282,0x3F1F,0x0DAF,0x35C3,0x1536,0x395E,0x27BF,
- 0x0841,0x15D7,0x3D24,0x183E,0x0DFB,0x2102,0x37C5,0x0239,
- 0x18ED,0x3B5D,0x048B,0x3483,0x0ADD,0x1ED4,0x2AA4,0x0F82,
- 0x2C05,0x03AD,0x364E,0x1A9E,0x08F7,0x230E,0x3AE6,0x19CF,
- 0x0EC9,0x3C77,0x13CE,0x1ED1,0x3ABF,0x111B,0x2370,0x0ED6,
- 0x24B3,0x1BCA,0x37A9,0x06F6,0x3B24,0x18FE,0x368D,0x11F4,
- 0x3C22,0x225B,0x0B95,0x184E,0x31F6,0x1CFA,0x385C,0x103D,
- 0x3D74,0x0D5E,0x24AD,0x01E4,0x2681,0x082F,0x2E01,0x0DE5,
- 0x274C,0x3666,0x10E8,0x3066,0x16AE,0x2ACD,0x1968,0x264F,
- 0x0BFE,0x2C9E,0x06C9,0x2F03,0x0212,0x2A87,0x0D8D,0x1EF3,
- 0x3A7A,0x199B,0x325D,0x10B8,0x2A1F,0x1DC0,0x0F24,0x30A5,
- 0x144E,0x3E34,0x1FCB,0x021E,0x1E15,0x28CE,0x0462,0x32A1,
- 0x1136,0x3F7E,0x27DB,0x077C,0x1F7E,0x3E49,0x1843,0x350F,
- 0x0333,0x20B6,0x2BF3,0x1918,0x025C,0x35B9,0x0A0E,0x1863,
- 0x3D73,0x25FA,0x05B3,0x2B17,0x0C14,0x24A3,0x172D,0x28AE,
- 0x32DE,0x0AFE,0x2A51,0x0559,0x2DEB,0x09DC,0x2A9A,0x0637,
- 0x2D12,0x158E,0x1FD2,0x26DB,0x0738,0x2449,0x0B16,0x1D2B,
- 0x3720,0x294E,0x0C51,0x2660,0x398B,0x070C,0x2738,0x1C52,
- 0x2C6B,0x0FA1,0x27F4,0x12EF,0x2E84,0x1510,0x21B2,0x3D11,
- 0x0BCF,0x278F,0x1177,0x2CDF,0x1DE4,0x2FC4,0x065E,0x34A3,
- 0x22A7,0x092D,0x31EF,0x028B,0x283D,0x186F,0x3746,0x1C88,
- 0x334E,0x0353,0x2148,0x2E91,0x145C,0x2991,0x0BFD,0x2792,
- 0x07CE,0x32F1,0x1C7A,0x3A08,0x14F7,0x0779,0x2285,0x2BD5,
- 0x1613,0x2A7B,0x1542,0x3BCE,0x12AA,0x3766,0x17E2,0x327B,
- 0x04C7,0x1D67,0x23D3,0x01A9,0x3922,0x0A81,0x3626,0x02E7,
- 0x3A72,0x1B38,0x249E,0x1236,0x37BE,0x16EE,0x3D1C,0x0387,
- 0x262A,0x0C88,0x2150,0x3E92,0x066D,0x24BF,0x3C43,0x003D,
- 0x2688,0x07B3,0x337A,0x1B10,0x3689,0x0FF9,0x3AF3,0x0A59,
- 0x249C,0x1EB5,0x1246,0x39EE,0x238E,0x0050,0x2B4E,0x0DBF,
- 0x2573,0x3EBE,0x0F7D,0x3709,0x2713,0x1187,0x2DB3,0x226A,
- 0x009F,0x16AC,0x3A37,0x1AB1,0x3435,0x1297,0x3ADF,0x05F5,
- 0x1D6B,0x3BCD,0x0F64,0x378A,0x194C,0x23B8,0x0FC0,0x3D32,
- 0x19A5,0x393A,0x0579,0x345B,0x1AB5,0x3DB4,0x13AE,0x2CB4,
- 0x04A8,0x1EE4,0x32A0,0x015F,0x1DD5,0x3336,0x0D0C,0x3DF9,
- 0x08B8,0x3582,0x1D7F,0x3DA9,0x02A1,0x376F,0x07C0,0x1AEE,
- 0x338C,0x1749,0x3BEE,0x012D,0x3970,0x0C93,0x2809,0x104C,
- 0x2D64,0x1946,0x20BB,0x3E7E,0x0BA2,0x3016,0x05E5,0x29C3,
- 0x0C1D,0x3E31,0x1819,0x099D,0x33D1,0x003C,0x3049,0x16A1,
- 0x2B7A,0x13C1,0x2D25,0x013B,0x2342,0x3E02,0x192F,0x02B2,
- 0x3514,0x06DE,0x30F4,0x099F,0x2C9B,0x1E4C,0x034E,0x2047,
- 0x38A0,0x13F8,0x3DD4,0x1F3E,0x11E9,0x296B,0x1479,0x2DA0,
- 0x21C9,0x0F7E,0x3200,0x20A8,0x092A,0x2C04,0x1056,0x2FEC,
- 0x1652,0x3933,0x0194,0x1AAC,0x2DE8,0x0D21,0x204B,0x320F,
- 0x1258,0x2C06,0x0F57,0x2822,0x0B7A,0x2EC0,0x2207,0x1B9D,
- 0x3778,0x0534,0x2F81,0x09DB,0x19F1,0x3632,0x1402,0x3A76,
- 0x1D0C,0x09A2,0x315F,0x05FA,0x1B29,0x3F26,0x0771,0x38DF,
- 0x1D5C,0x30B8,0x0D64,0x27A5,0x0213,0x29AF,0x0DE7,0x2CEE,
- 0x004F,0x2281,0x2FE7,0x1DEE,0x036A,0x31E6,0x1C43,0x2628,
- 0x0B20,0x22A1,0x2DF7,0x0D12,0x2A21,0x0078,0x30C6,0x1BC8,
- 0x3B79,0x0ED3,0x2319,0x3F58,0x12BC,0x28CD,0x1F49,0x11DE,
- 0x3040,0x16FB,0x06B3,0x229E,0x2B80,0x111E,0x312C,0x2409,
- 0x04CC,0x296A,0x0D54,0x2523,0x1365,0x33A9,0x14DC,0x3F75,
- 0x001D,0x3805,0x0DF5,0x265B,0x1E20,0x106A,0x3A45,0x164B,
- 0x2EE7,0x11BD,0x2BA2,0x2206,0x1C33,0x3D4A,0x0E0C,0x3877,
- 0x04A0,0x3E9A,0x0C7E,0x1EC7,0x2F83,0x0AAB,0x3353,0x2128,
- 0x0F4B,0x3EF6,0x198E,0x23DE,0x0F06,0x3D17,0x1A23,0x2A37,
- 0x0A33,0x2B48,0x07B4,0x279C,0x3508,0x0641,0x3EDE,0x1CE5,
- 0x0974,0x371D,0x03E3,0x3FAB,0x19D5,0x221B,0x340A,0x074D,
- 0x2932,0x0E2D,0x253F,0x3612,0x13C8,0x384E,0x18A9,0x0A0B,
- 0x3B30,0x1E81,0x3710,0x0588,0x3F00,0x1802,0x00A6,0x3197,
- 0x0CBE,0x299A,0x15E0,0x32F3,0x2524,0x0B4A,0x2953,0x0676,
- 0x2E30,0x1715,0x23DB,0x1DF2,0x2FF1,0x142F,0x2621,0x0EC4,
- 0x2967,0x08EF,0x36CD,0x136A,0x3CE0,0x1826,0x3724,0x1A74,
- 0x346C,0x1595,0x089A,0x2694,0x3DF7,0x0C86,0x3518,0x00F3,
- 0x36F1,0x129B,0x1E28,0x3BC6,0x16F6,0x368B,0x238B,0x0909,
- 0x1665,0x2F93,0x17C6,0x09E7,0x2EA4,0x0436,0x3A25,0x2472,
- 0x00F1,0x2853,0x36CA,0x1923,0x0970,0x3A73,0x1F39,0x121F,
- 0x3F3D,0x15E7,0x305A,0x18B4,0x2A27,0x047C,0x2C61,0x1C28,
- 0x2580,0x16C8,0x2F62,0x041F,0x3492,0x27AA,0x1FD4,0x00D7,
- 0x1F1B,0x3659,0x0509,0x3992,0x107A,0x24D4,0x1A57,0x23B6,
- 0x1F5A,0x0FD9,0x2684,0x3B42,0x1172,0x28CC,0x1325,0x2DD4,
- 0x1C34,0x25BC,0x00F5,0x36DC,0x1F91,0x05B8,0x337D,0x1507,
- 0x3B6D,0x129D,0x31E7,0x0EB1,0x1DF4,0x241B,0x0E77,0x3159,
- 0x1827,0x29A3,0x1E83,0x0D53,0x2E4A,0x008C,0x1B7A,0x3DD9,
- 0x14E0,0x32C7,0x1BF8,0x08DE,0x2AF3,0x03BA,0x2F72,0x272D,
- 0x16B4,0x0322,0x1A5D,0x2D14,0x10FA,0x20CF,0x2AC3,0x1546,
- 0x3D87,0x1062,0x38F1,0x0276,0x1DC2,0x3C28,0x162A,0x347D,
- 0x0FDC,0x3882,0x0123,0x3B91,0x0B11,0x2B2C,0x02F3,0x31AA,
- 0x1245,0x2C97,0x1993,0x243E,0x0678,0x2DD9,0x0948,0x20BE,
- 0x0B9D,0x27C6,0x3969,0x17A8,0x10AE,0x2C0E,0x1430,0x299D,
- 0x0DD1,0x3046,0x0398,0x24AE,0x09A5,0x1F67,0x0FEA,0x3430,
- 0x2107,0x02D5,0x389A,0x21BA,0x1A76,0x3485,0x0BB5,0x1C2E,
- 0x3CB7,0x20BA,0x0F54,0x2E21,0x1CBE,0x251A,0x0070,0x2EDF,
- 0x0A2D,0x34E6,0x0683,0x3819,0x0B7C,0x3C96,0x21EF,0x09A6,
- 0x3166,0x06F0,0x1CDE,0x39A7,0x15DC,0x07FF,0x3DB0,0x1AEC,
- 0x3128,0x0F0A,0x275F,0x0B63,0x2DAB,0x0382,0x313E,0x094D,
- 0x2A0D,0x35B2,0x1ABA,0x06CF,0x3444,0x0446,0x3A7F,0x07FE,
- 0x37CA,0x0C39,0x2B55,0x1134,0x308A,0x26DC,0x0CCE,0x2D2C,
- 0x0067,0x2491,0x1BFC,0x3812,0x037F,0x3AE4,0x1F9C,0x00FB,
- 0x3C31,0x080B,0x2504,0x3973,0x1151,0x3684,0x242D,0x0B66,
- 0x2A66,0x04D4,0x3BE3,0x1FFA,0x111A,0x3FD4,0x20ED,0x0776,
- 0x343B,0x1F94,0x3CB5,0x094F,0x2476,0x351C,0x0D7B,0x2E56,
- 0x0448,0x265E,0x20FB,0x18CE,0x2CFC,0x080D,0x2728,0x03A7,
- 0x2BBB,0x1A09,0x27D3,0x111D,0x33F3,0x1513,0x3C56,0x1EFA,
- 0x35EA,0x0417,0x3E6A,0x0C99,0x3282,0x14F9,0x2559,0x3EF0,
- 0x2C45,0x1BBD,0x0238,0x30F9,0x2198,0x0667,0x3A93,0x1CB8,
- 0x3E8B,0x18C8,0x2085,0x3355,0x15BE,0x3FD4,0x22FC,0x067E,
- 0x3CA9,0x2A6C,0x0CE4,0x3189,0x065B,0x25A5,0x1864,0x2D83,
- 0x14AC,0x09FB,0x3908,0x03EC,0x3E63,0x0E75,0x3548,0x14EA,
- 0x2AFC,0x1B9F,0x260B,0x1266,0x2D13,0x1AE9,0x0FC9,0x371A,
- 0x1571,0x3B8C,0x22D9,0x0A72,0x21AF,0x2DA9,0x0F8C,0x2AE8,
- 0x08FD,0x3CBE,0x1E91,0x34DF,0x13A8,0x3F33,0x152F,0x3725,
- 0x1680,0x0244,0x30BE,0x2400,0x1291,0x2CC0,0x1B8B,0x243B,
- 0x171C,0x326D,0x1A87,0x3AC0,0x0B03,0x1D83,0x3E32,0x1019,
- 0x1EC8,0x343C,0x06A5,0x1872,0x2BEC,0x1418,0x3029,0x25A6,
- 0x12D0,0x34A4,0x173D,0x04FB,0x2878,0x1F48,0x1225,0x37D4,
- 0x180A,0x2ED5,0x1293,0x2661,0x331F,0x0BB2,0x19DB,0x3A1B,
- 0x1388,0x2B28,0x11CA,0x320D,0x1CFE,0x064A,0x3B9D,0x2028,
- 0x1A3B,0x33EC,0x0BA0,0x3F3B,0x0F3C,0x3592,0x12C7,0x3DC0,
- 0x1DA4,0x0937,0x32C0,0x1F71,0x0517,0x29AA,0x18BE,0x0807,
- 0x1C02,0x2701,0x15A2,0x2942,0x1047,0x38B6,0x0389,0x171F,
- 0x06D5,0x3B6C,0x1FB9,0x0E9D,0x37A5,0x1B50,0x23C5,0x04F9,
- 0x25D5,0x0A67,0x3831,0x07A0,0x29AE,0x01B2,0x309C,0x1C86,
- 0x10DC,0x1E04,0x278D,0x15EB,0x3E6D,0x0DBE,0x377C,0x0311,
- 0x351B,0x2637,0x15C6,0x29DC,0x1711,0x290E,0x082B,0x39DA,
- 0x2196,0x031D,0x3DFE,0x1F11,0x01CA,0x32B7,0x2058,0x0394,
- 0x2996,0x0D6A,0x2B96,0x19C0,0x330C,0x02E3,0x37C6,0x135A,
- 0x28AD,0x1794,0x01F2,0x1B46,0x2828,0x0D57,0x2A94,0x0645,
- 0x2553,0x3D05,0x1798,0x09E6,0x3950,0x2081,0x0E14,0x3C90,
- 0x0366,0x27FA,0x062B,0x21B1,0x2EFD,0x0306,0x22BB,0x35AB,
- 0x2811,0x0B6A,0x3F94,0x269E,0x0D38,0x33DE,0x0B35,0x1B05,
- 0x2B8D,0x0F02,0x2D3F,0x1C60,0x3CC4,0x085D,0x312A,0x02EE,
- 0x27FB,0x0A75,0x34EF,0x00EA,0x175C,0x2C64,0x2327,0x023C,
- 0x305C,0x0ADB,0x28AC,0x0144,0x39E8,0x1912,0x255B,0x0A9D,
- 0x3843,0x1199,0x2F63,0x056A,0x2802,0x1D28,0x2D91,0x0BC7,
- 0x25A1,0x3AE5,0x1232,0x239F,0x3E16,0x0E0D,0x369B,0x206D,
- 0x3979,0x0A74,0x3369,0x0150,0x2F57,0x225C,0x1D36,0x332F,
- 0x287F,0x1302,0x356E,0x252C,0x0A8F,0x2D2E,0x1241,0x318B,
- 0x16BB,0x2ACA,0x117D,0x2F46,0x1A1F,0x38F0,0x0E22,0x280B,
- 0x36E8,0x07FD,0x3AE7,0x0041,0x1CE2,0x2982,0x11AE,0x2C39,
- 0x1E76,0x05C6,0x2FAA,0x0C50,0x33C2,0x1066,0x31B4,0x1E3F,
- 0x1399,0x2DC3,0x10F7,0x23D1,0x3A6B,0x0CE3,0x275A,0x3D86,
- 0x12AD,0x3621,0x0181,0x3EC3,0x0E2A,0x24C8,0x18EE,0x3259,
- 0x05FF,0x3853,0x1FC7,0x3BD7,0x0744,0x3303,0x19B3,0x39DF,
- 0x1EFC,0x0F33,0x2C01,0x1CDA,0x286C,0x007E,0x3011,0x1429,
- 0x33FE,0x1587,0x3F5C,0x0D9F,0x1B0D,0x39BE,0x16CD,0x054F,
- 0x147E,0x2EBE,0x2094,0x1065,0x3A3A,0x048D,0x21AB,0x3D9B,
- 0x02A7,0x38C8,0x09AF,0x3315,0x152B,0x2614,0x1D54,0x3F1E,
- 0x0F74,0x39BA,0x229D,0x1CF7,0x3CE1,0x0817,0x3797,0x1E43,
- 0x101D,0x3DE7,0x1596,0x2FBB,0x0E9C,0x2BAB,0x14DD,0x303E,
- 0x01A2,0x1EA6,0x2450,0x1762,0x3962,0x00D5,0x19A6,0x3757,
- 0x16AF,0x023D,0x2F8E,0x089B,0x1A6B,0x2D63,0x0036,0x28C7,
- 0x0F53,0x2CB0,0x16BC,0x3A14,0x1B09,0x081E,0x3C35,0x0D3F,
- 0x1010,0x2E54,0x0496,0x1967,0x3FAF,0x0174,0x39F1,0x0BBE,
- 0x3609,0x024C,0x3D99,0x22E9,0x0F5B,0x215D,0x2E94,0x0455,
- 0x1F19,0x3137,0x1778,0x222F,0x3570,0x08F4,0x3C24,0x2142,
- 0x0EC0,0x3FCC,0x1BBA,0x3785,0x01FC,0x2026,0x2498,0x053B,
- 0x3BF8,0x0BE0,0x3368,0x073E,0x19EC,0x2EB9,0x16E0,0x08BC,
- 0x2404,0x1BF5,0x304B,0x1755,0x2059,0x3A80,0x0B87,0x1CCD,
- 0x2BEF,0x1282,0x29C8,0x1100,0x2C79,0x1E00,0x0118,0x232C,
- 0x0A7E,0x34A7,0x0405,0x3FD4,0x1552,0x3711,0x0C0A,0x2516,
- 0x0931,0x2C71,0x109E,0x262F,0x3486,0x08C0,0x2B0A,0x1E1E,
- 0x3C9B,0x1913,0x018A,0x30FB,0x22F7,0x19FC,0x2F0D,0x10A2,
- 0x274E,0x18F3,0x204F,0x23F3,0x01B1,0x2F6F,0x0AF2,0x1686,
- 0x2C49,0x1A05,0x06A0,0x2F9F,0x0F8B,0x29D6,0x14C8,0x31A7,
- 0x21AE,0x04FA,0x25B5,0x1AB4,0x3613,0x03FA,0x3EC5,0x0D49,
- 0x27A6,0x3C65,0x0912,0x3298,0x1478,0x22ED,0x30D2,0x0631,
- 0x2239,0x2C1D,0x13F4,0x391F,0x2489,0x1147,0x328E,0x1718,
- 0x3F7A,0x0475,0x24FC,0x10F8,0x2B08,0x2062,0x138B,0x3144,
- 0x3E2C,0x1D7C,0x217C,0x3006,0x14A4,0x28C2,0x1A41,0x2765,
- 0x15DF,0x2CA6,0x1BA8,0x058D,0x3B11,0x0921,0x189E,0x3D25,
- 0x1415,0x2526,0x0EBB,0x2E47,0x12B1,0x2BCA,0x19E8,0x0702,
- 0x31E5,0x2273,0x0FF0,0x256E,0x1A6D,0x3CEA,0x124C,0x3494,
- 0x1821,0x2A04,0x1575,0x38F4,0x24FD,0x04C4,0x35B7,0x1D6D,
- 0x33B9,0x0615,0x259E,0x0A20,0x2DE9,0x0566,0x26D2,0x3F9A,
- 0x0DA5,0x35DE,0x0423,0x3407,0x0B1D,0x3AE9,0x1495,0x36A3,
- 0x28B1,0x12AB,0x2D98,0x2240,0x08A8,0x270F,0x1B5F,0x3DA0,
- 0x1878,0x1FF0,0x384A,0x014B,0x183A,0x30A9,0x1227,0x32AF,
- 0x0C7D,0x28D2,0x3749,0x168F,0x0A27,0x357A,0x0775,0x1ED6,
- 0x30D1,0x0600,0x3E53,0x0FE2,0x3837,0x178A,0x354B,0x21F8,
- 0x045E,0x33A4,0x208D,0x1324,0x38BA,0x040C,0x270B,0x09D9,
- 0x3AFE,0x1BDA,0x373D,0x08F3,0x23B1,0x1F64,0x12D9,0x3267,
- 0x1B7E,0x1042,0x2AC0,0x1F10,0x076A,0x3D19,0x0D68,0x2027,
- 0x3FC4,0x099E,0x3457,0x1F2D,0x04EB,0x3C97,0x1E93,0x07AB,
- 0x1FC9,0x341E,0x0C5C,0x3D84,0x0574,0x3770,0x2410,0x00B8,
- 0x17D5,0x086A,0x34C6,0x0C37,0x2A9D,0x0E01,0x32F0,0x0709,
- 0x3C57,0x09EF,0x1FE9,0x3512,0x161F,0x2673,0x318E,0x0B72,
- 0x2B9C,0x033A,0x33E2,0x0987,0x3A5C,0x0266,0x22F6,0x394B,
- 0x179D,0x0117,0x3AB6,0x0A24,0x2EBF,0x075F,0x2A6F,0x0AE4,
- 0x27B8,0x00F8,0x2F68,0x0A84,0x1DD6,0x3F10,0x1213,0x2ADE,
- 0x0ECD,0x3C32,0x1347,0x38E2,0x15A8,0x3509,0x1D98,0x0081,
- 0x23D0,0x1A8B,0x25D6,0x20B5,0x17D0,0x2717,0x2174,0x07E1,
- 0x18AC,0x3BF1,0x0C96,0x1A22,0x3168,0x102C,0x2E88,0x0279,
- 0x353F,0x06F7,0x2884,0x1C4E,0x3C60,0x0E13,0x2581,0x0253,
- 0x393F,0x1F69,0x07CC,0x2606,0x3EA3,0x132C,0x2858,0x3BB0,
- 0x0DE8,0x3411,0x13DC,0x2C22,0x0CBF,0x2A07,0x0724,0x3BCF,
- 0x1E0E,0x0E07,0x3D81,0x25CF,0x0BD1,0x326B,0x185B,0x2CA3,
- 0x1275,0x2998,0x1433,0x2D96,0x113A,0x396F,0x2856,0x06CE,
- 0x237D,0x371F,0x036C,0x3A9B,0x1BB9,0x25F2,0x1822,0x331B,
- 0x0F03,0x1C90,0x2671,0x0DD6,0x308D,0x1002,0x2B57,0x1AC0,
- 0x2E46,0x13D3,0x2817,0x1781,0x3051,0x0CE2,0x1BCD,0x2B5A,
- 0x36D7,0x2700,0x1191,0x3CFE,0x041D,0x3802,0x11E3,0x2D72,
- 0x13CC,0x24E5,0x3071,0x1035,0x2BE5,0x00E5,0x1C14,0x3760,
- 0x1203,0x3F41,0x1952,0x2050,0x26A1,0x1560,0x2DD0,0x0D24,
- 0x273D,0x2FED,0x14C9,0x28D4,0x1335,0x32FF,0x1D3A,0x3F82,
- 0x0F9A,0x382F,0x228B,0x1908,0x30D5,0x0D43,0x27E9,0x006E,
- 0x2FF7,0x1B14,0x2C1C,0x0340,0x2872,0x10CF,0x309F,0x1701,
- 0x3910,0x0878,0x3DE3,0x09C1,0x3565,0x0325,0x3ECC,0x1C9D,
- 0x32A2,0x01C2,0x2023,0x37B2,0x0499,0x3A49,0x21A3,0x15BD,
- 0x2322,0x319B,0x0D11,0x2E06,0x050E,0x1F23,0x2F2B,0x1766,
- 0x23E8,0x118A,0x2FD7,0x1B21,0x035B,0x2DD8,0x1C7C,0x0091,
- 0x2468,0x1BB2,0x26BB,0x03D6,0x3B2A,0x12C0,0x27B7,0x148F,
- 0x3001,0x2309,0x01CF,0x1C6B,0x2E6C,0x140D,0x3E4C,0x0089,
- 0x3561,0x07A6,0x3F9B,0x0241,0x32E2,0x0A12,0x16E4,0x3D63,
- 0x1927,0x0C2A,0x2EE4,0x120F,0x3422,0x0B39,0x2E8D,0x03F3,
- 0x281F,0x38AD,0x017F,0x2AC2,0x180C,0x3572,0x02B7,0x3B39,
- 0x0B26,0x37FB,0x01B9,0x2BF6,0x0FBA,0x25C5,0x3ABB,0x0AC7,
- 0x2018,0x029A,0x2ED0,0x18B5,0x24D5,0x1C66,0x235B,0x0022,
- 0x38A3,0x19CD,0x03D5,0x3ECD,0x0CAF,0x3439,0x226E,0x0762,
- 0x20C9,0x25D9,0x05AC,0x37E7,0x0B15,0x3E13,0x1E5B,0x3631,
- 0x08CE,0x1C44,0x36A5,0x04AC,0x3B8A,0x21B4,0x02E6,0x16C3,
- 0x3084,0x1AF4,0x088C,0x3B2F,0x0378,0x2BA7,0x14B3,0x3A3D,
- 0x213B,0x0967,0x2263,0x36C7,0x0C4B,0x3CEE,0x079F,0x2B46,
- 0x0E8A,0x2D97,0x164A,0x2F5F,0x11E4,0x2B24,0x13D6,0x2DF2,
- 0x0F98,0x25B3,0x2F13,0x1379,0x2949,0x1D1D,0x07A2,0x3B92,
- 0x0E4D,0x1DA9,0x3E58,0x164C,0x2238,0x3A13,0x0AD8,0x3637,
- 0x05AD,0x3D6A,0x0B33,0x3448,0x219A,0x0ECE,0x3924,0x1800,
- 0x2E79,0x0899,0x362C,0x195B,0x2241,0x322E,0x0010,0x2B2A,
- 0x0A00,0x34B5,0x192B,0x3AB2,0x065A,0x2A96,0x0D01,0x24C0,
- 0x1097,0x203A,0x2412,0x1989,0x264B,0x1D13,0x2B36,0x001F,
- 0x3536,0x24FB,0x15DD,0x2A0B,0x01D4,0x28DF,0x13A5,0x3BA9,
- 0x210A,0x10D3,0x1E52,0x3EAF,0x07D8,0x1C4A,0x2972,0x153F,
- 0x263F,0x1226,0x3165,0x1D42,0x3526,0x03BD,0x15CE,0x30DD,
- 0x1697,0x3BCC,0x22A2,0x0988,0x339F,0x0796,0x3F39,0x1ECD,
- 0x0E47,0x33DF,0x20AC,0x1540,0x2976,0x1292,0x3A2B,0x19B9,
- 0x3295,0x0ED8,0x2D44,0x1186,0x2934,0x1A38,0x0527,0x1442,
- 0x3186,0x245A,0x1112,0x2C03,0x19C4,0x0D06,0x37DB,0x2729,
- 0x05CE,0x2CC5,0x1FFD,0x1289,0x3314,0x1753,0x3534,0x07BD,
- 0x189A,0x3FCF,0x105A,0x19EE,0x2D06,0x1400,0x246A,0x1984,
- 0x36F6,0x1FFE,0x021B,0x1CC2,0x3984,0x0CBB,0x28FA,0x05B4,
- 0x35AF,0x197D,0x0840,0x3E43,0x0D73,0x35D9,0x16D6,0x23B7,
- 0x302D,0x03C2,0x277C,0x09C6,0x31EB,0x13BF,0x26E5,0x1D2D,
- 0x2D71,0x14D9,0x2A55,0x127D,0x3B0F,0x1E80,0x0BA1,0x34FC,
- 0x10BA,0x3FD3,0x1564,0x2FCA,0x0A50,0x1D68,0x3771,0x1059,
- 0x3F60,0x157D,0x28A5,0x0F19,0x35D7,0x2184,0x1A4C,0x3373,
- 0x1C0C,0x3A50,0x0C4A,0x37C1,0x0582,0x349D,0x0DAB,0x2F45,
- 0x20A2,0x05E3,0x39B1,0x0D4E,0x3E88,0x1011,0x35E2,0x1B2B,
- 0x0984,0x3516,0x28F1,0x0E57,0x23FC,0x3A89,0x0A8C,0x3654,
- 0x05F3,0x3D2D,0x2243,0x08BF,0x19E3,0x3FD4,0x22E7,0x0748,
- 0x325A,0x0D82,0x1B95,0x3997,0x1580,0x2BC1,0x135C,0x26CA,
- 0x2F56,0x0846,0x279A,0x395C,0x05E2,0x2EDD,0x0A29,0x2B37,
- 0x020F,0x3B9A,0x1B42,0x3586,0x00A4,0x33A6,0x1F8E,0x3C8A,
- 0x18C4,0x034C,0x3EDA,0x0A62,0x2666,0x3255,0x11EC,0x20C4,
- 0x35FF,0x0E52,0x3DF8,0x2544,0x0BB3,0x2941,0x0F65,0x26F2,
- 0x3225,0x0440,0x23DF,0x337C,0x01D8,0x1E9F,0x3194,0x0482,
- 0x2695,0x0BEF,0x3C92,0x250D,0x0681,0x3344,0x1EC6,0x3D33,
- 0x0D3B,0x2109,0x31E9,0x11D7,0x2B98,0x00C8,0x2D4F,0x0991,
- 0x1E5E,0x38ED,0x1207,0x36BD,0x1C10,0x0029,0x3F6F,0x091C,
- 0x1A13,0x37EA,0x0119,0x275D,0x0687,0x3038,0x228A,0x0522,
- 0x2AFF,0x2036,0x02BC,0x1F09,0x3DBE,0x11D6,0x2556,0x20B8,
- 0x04A5,0x2DDE,0x085C,0x30B1,0x1E84,0x0334,0x3C4E,0x088D,
- 0x2E50,0x044A,0x2912,0x1007,0x2C42,0x15F1,0x3B13,0x1E11,
- 0x0F61,0x31AB,0x1A73,0x26EB,0x1DB5,0x310B,0x0705,0x24D0,
- 0x2FF9,0x178E,0x05C9,0x36EB,0x1FA9,0x0F44,0x2D92,0x190D,
- 0x27E6,0x1EE0,0x10BF,0x3943,0x2A84,0x0A54,0x2F2E,0x1D16,
- 0x059A,0x217F,0x2CCF,0x01A3,0x2869,0x0B31,0x315E,0x035C,
- 0x1ABF,0x3D3E,0x0F36,0x1DDD,0x244E,0x13E0,0x3D65,0x16A4,
- 0x2807,0x1EBD,0x08A3,0x1FF4,0x2A54,0x1358,0x2E52,0x0808,
- 0x2298,0x2AA7,0x1638,0x30CA,0x1FBF,0x0016,0x3D8D,0x09AC,
- 0x1CD5,0x2B42,0x01DB,0x1BC2,0x3927,0x053F,0x3D40,0x1E27,
- 0x1159,0x1F76,0x394A,0x0E5D,0x21D5,0x3E41,0x0F22,0x3A1F,
- 0x124D,0x32D6,0x20EC,0x0DDA,0x2CF1,0x1AA3,0x0010,0x1737,
- 0x27CD,0x3926,0x039D,0x248E,0x1B8E,0x3C89,0x190B,0x3481,
- 0x0F6E,0x2270,0x2CEB,0x06A3,0x2548,0x2FBC,0x157F,0x2BCB,
- 0x21F3,0x0E7A,0x3223,0x18B8,0x2B64,0x1323,0x3CDD,0x1D89,
- 0x0E50,0x31D4,0x1AA9,0x29B7,0x0597,0x2C62,0x090E,0x3A53,
- 0x1DD4,0x1228,0x38D9,0x2340,0x0C83,0x2CE0,0x1189,0x27AF,
- 0x0E6A,0x3647,0x171E,0x3C21,0x1F1D,0x08C5,0x2353,0x0386,
- 0x3FD4,0x2147,0x0945,0x36B5,0x0466,0x18C6,0x2B9B,0x1630,
- 0x0083,0x3D55,0x1D21,0x255C,0x036D,0x306C,0x1CD3,0x00E2,
- 0x33AD,0x09D6,0x2FEB,0x02F9,0x15FD,0x2565,0x126D,0x38B8,
- 0x19A3,0x3E86,0x12F3,0x3593,0x173C,0x3AC8,0x108C,0x3777,
- 0x23A9,0x147B,0x3261,0x0187,0x3718,0x1F51,0x042A,0x332C,
- 0x0D74,0x365F,0x14FD,0x3E5A,0x0C8A,0x39CC,0x0F3A,0x1DFF,
- 0x3B0A,0x109C,0x3759,0x064E,0x151C,0x2E8E,0x22B5,0x17C5,
- 0x3A47,0x10E1,0x23BF,0x31BF,0x133A,0x2DB5,0x232B,0x013F,
- 0x3780,0x29E0,0x0802,0x1D43,0x2E63,0x06DC,0x2A5F,0x1C82,
- 0x2EB5,0x074F,0x1860,0x3787,0x131F,0x3B58,0x1FAB,0x2FB4,
- 0x091A,0x14CB,0x1EF9,0x3085,0x0C58,0x2641,0x0569,0x20CD,
- 0x3F24,0x0218,0x1CC9,0x3C06,0x181C,0x0A7D,0x35B8,0x0489,
- 0x3B64,0x1ED9,0x0849,0x3EDC,0x0A8E,0x337B,0x01EE,0x265A,
- 0x38BD,0x0799,0x3BEB,0x0F78,0x364C,0x170A,0x33AE,0x139E,
- 0x3131,0x224C,0x0121,0x189B,0x3EA7,0x154E,0x32BA,0x17AA,
- 0x2AF1,0x1493,0x2507,0x011B,0x2E76,0x1BB1,0x3140,0x175B,
- 0x261C,0x131E,0x2CA9,0x14B8,0x242A,0x3C81,0x0A04,0x3801,
- 0x238D,0x1122,0x3286,0x12D6,0x38C2,0x1497,0x3C1F,0x21F7,
- 0x167E,0x3E09,0x1B67,0x2988,0x2078,0x3C5F,0x0057,0x27D9,
- 0x31EC,0x0B92,0x267A,0x0E64,0x2E14,0x0620,0x2546,0x1F03,
- 0x06E9,0x2D66,0x0C65,0x2918,0x10B3,0x2FEF,0x239B,0x1024,
- 0x2A4F,0x0633,0x2DF5,0x182F,0x26D1,0x057B,0x21DA,0x34A5,
- 0x0184,0x2D56,0x0C52,0x23EB,0x3C41,0x1AC3,0x07E7,0x313D,
- 0x03EB,0x2D1C,0x1A37,0x06BA,0x36D1,0x09D1,0x1965,0x311E,
- 0x1656,0x0BEC,0x22C3,0x3B80,0x12DA,0x3597,0x1815,0x00DF,
- 0x22B2,0x3F64,0x26F8,0x035E,0x2B06,0x0B60,0x3434,0x0FEE,
- 0x3FAC,0x237B,0x36E1,0x06DD,0x39B7,0x1612,0x327D,0x0B6D,
- 0x2839,0x154F,0x2AC1,0x10E3,0x34BC,0x2408,0x0F40,0x28DA,
- 0x10F5,0x2F82,0x24DF,0x119B,0x2877,0x1717,0x2CFB,0x1441,
- 0x1F52,0x248F,0x17C0,0x2D93,0x0B51,0x279B,0x0229,0x2939,
- 0x09C3,0x3C78,0x1C53,0x33FB,0x07A9,0x2566,0x01FD,0x3844,
- 0x0621,0x3F15,0x0B86,0x33EF,0x11AB,0x3DB2,0x0D1D,0x38D4,
- 0x07EA,0x34CD,0x012B,0x3AEA,0x0C76,0x20A7,0x2D4A,0x1C01,
- 0x0B91,0x2F07,0x0722,0x29E1,0x0A3B,0x275E,0x0673,0x2C6D,
- 0x0BE3,0x24BC,0x055D,0x37C2,0x0AFF,0x140B,0x3471,0x1549,
- 0x1F99,0x2C66,0x03E9,0x3BEF,0x2226,0x1BF2,0x3DF4,0x115B,
- 0x3608,0x18E8,0x38B9,0x1658,0x3B3A,0x0AEF,0x1AD3,0x3F90,
- 0x15F8,0x3852,0x1DC4,0x028E,0x3113,0x1BBC,0x2C8A,0x0BA8,
- 0x27C3,0x16E7,0x3429,0x1C75,0x0DA8,0x353D,0x29A6,0x1349,
- 0x387B,0x0F1A,0x3EB9,0x25E6,0x1531,0x2AF2,0x21A8,0x0DCC,
- 0x3E90,0x1BF7,0x33F6,0x02D7,0x2BC6,0x0ACD,0x2617,0x388B,
- 0x15A7,0x0A02,0x1B60,0x30D4,0x165D,0x258F,0x04F8,0x2990,
- 0x1B4A,0x025A,0x1805,0x2A7E,0x12E1,0x2916,0x1049,0x387A,
- 0x19DF,0x33BB,0x08C4,0x3063,0x030E,0x1BE8,0x3DCC,0x15E8,
- 0x38F8,0x029F,0x1B77,0x3761,0x04D5,0x3A0C,0x0DB4,0x34C7,
- 0x0BD0,0x306A,0x00DD,0x1D15,0x39D1,0x117F,0x3D30,0x1B16,
- 0x2EE0,0x0E1F,0x2B18,0x107C,0x1F5C,0x3B06,0x1AA8,0x21FC,
- 0x2F61,0x12B9,0x2971,0x18DE,0x273B,0x059E,0x2A86,0x1B1A,
- 0x2DDF,0x1107,0x27D5,0x1962,0x3232,0x1576,0x02C4,0x3F23,
- 0x27A4,0x1391,0x34C8,0x1B11,0x3F9F,0x11E2,0x362E,0x1838,
- 0x3A39,0x11A6,0x32FC,0x1940,0x230F,0x2DB6,0x1E37,0x07F2,
- 0x3A77,0x11D0,0x33AA,0x1934,0x0982,0x30C7,0x00AA,0x29D5,
- 0x0AB7,0x264E,0x02BF,0x2B59,0x0684,0x253C,0x34F9,0x0051,
- 0x285A,0x0B52,0x24CA,0x3D00,0x1120,0x3715,0x12C2,0x3FD4,
- 0x1457,0x2A02,0x04FE,0x3991,0x2612,0x0245,0x1F15,0x2448,
- 0x0925,0x27D6,0x1E6F,0x0C5E,0x3BC2,0x031C,0x34B2,0x1ECB,
- 0x05B7,0x2D46,0x1023,0x27AB,0x1601,0x3CCB,0x2092,0x0D4B,
- 0x326F,0x1F12,0x3A70,0x10B2,0x3652,0x0E6E,0x3C25,0x1158,
- 0x2EDA,0x1E23,0x3379,0x0DA6,0x3EB0,0x0176,0x2E67,0x22DD,
- 0x04D0,0x2008,0x3960,0x0DEB,0x2144,0x2DF9,0x0655,0x2B8F,
- 0x0C24,0x32E5,0x23A1,0x14C7,0x29A7,0x1A6E,0x2598,0x0401,
- 0x3E85,0x1331,0x3827,0x21DF,0x0706,0x31FD,0x2001,0x05EE,
- 0x233B,0x352E,0x039F,0x26BD,0x3054,0x0D7D,0x2BF9,0x0918,
- 0x1E14,0x3571,0x0327,0x3A35,0x0ECC,0x3624,0x201D,0x0268,
- 0x1EA9,0x3BED,0x0A87,0x3769,0x0650,0x25A0,0x30DC,0x17DA,
- 0x04FD,0x3A5E,0x2037,0x01A1,0x1EAE,0x314A,0x0DEC,0x2A0F,
- 0x0263,0x2D34,0x2146,0x090C,0x3EFB,0x0458,0x3747,0x1A99,
- 0x020E,0x2825,0x0DB8,0x2B91,0x2073,0x12BD,0x391C,0x16C7,
- 0x3469,0x1230,0x3EFC,0x1F1A,0x32BE,0x1CF6,0x0CE8,0x2F3D,
- 0x1284,0x3187,0x193F,0x09E3,0x23BE,0x0750,0x25AB,0x03CA,
- 0x3246,0x0E60,0x2EFC,0x0AF0,0x1955,0x3F2A,0x0FE7,0x349C,
- 0x18FC,0x2F94,0x00C2,0x327A,0x1862,0x2EDC,0x0B3D,0x39FB,
- 0x2362,0x1721,0x3AB9,0x09C0,0x328A,0x052C,0x1A36,0x2E18,
- 0x062F,0x2A25,0x02A0,0x2823,0x07E6,0x2CA2,0x1973,0x32B3,
- 0x09FE,0x3AAC,0x0824,0x2579,0x1A92,0x3502,0x1E8B,0x0ACB,
- 0x3D97,0x138C,0x24C5,0x1B07,0x3C9E,0x0EB9,0x36EA,0x18F5,
- 0x26AC,0x1F70,0x07F7,0x3416,0x0CC9,0x3D6E,0x1263,0x2A98,
- 0x1674,0x2866,0x0F13,0x2BFC,0x1A54,0x251C,0x1459,0x3035,
- 0x10A8,0x17D7,0x39A6,0x19BD,0x0548,0x36A7,0x1689,0x3D47,
- 0x10EA,0x20BD,0x263A,0x165C,0x2D7F,0x0A2C,0x2C14,0x16C4,
- 0x2FDA,0x12A6,0x2911,0x165F,0x2B7D,0x1C2D,0x0DEF,0x370E,
- 0x245F,0x0FA8,0x2ACB,0x187E,0x2D67,0x04C1,0x25E8,0x15B5,
- 0x3532,0x1BFA,0x0EE5,0x30B9,0x16B2,0x2723,0x0FDE,0x29F7,
- 0x3D5D,0x1E85,0x37B4,0x052B,0x3FD4,0x2440,0x0D3A,0x2BD6,
- 0x0572,0x2849,0x1B4B,0x0959,0x139C,0x3CB2,0x1879,0x2201,
- 0x3C0D,0x0493,0x3955,0x1D72,0x35CB,0x1738,0x3AC9,0x2072,
- 0x19FE,0x3CAF,0x1C1D,0x214C,0x31DB,0x13F2,0x2E9E,0x047F,
- 0x3A9C,0x1500,0x3789,0x24D8,0x0E04,0x1C70,0x28D3,0x1420,
- 0x30A7,0x0034,0x1C3F,0x2AB9,0x1361,0x249B,0x375E,0x1076,
- 0x3D93,0x175F,0x34E8,0x1425,0x3E6C,0x1D75,0x0122,0x211D,
- 0x277A,0x15EE,0x2065,0x2FF3,0x05BE,0x240A,0x14EE,0x2F3F,
- 0x0F2A,0x318A,0x009B,0x2C0F,0x0871,0x28B5,0x1D73,0x013E,
- 0x3FD4,0x0FCE,0x3859,0x135F,0x2F14,0x006A,0x3190,0x0A19,
- 0x2E73,0x0580,0x336A,0x0A76,0x3F8A,0x0365,0x3688,0x0C59,
- 0x3E1C,0x2157,0x08FA,0x31B1,0x22E1,0x0C0E,0x2A28,0x00C4,
- 0x2DF1,0x0A93,0x3C93,0x0797,0x1DD0,0x385F,0x105C,0x3F3E,
- 0x0889,0x359A,0x03BF,0x3DCF,0x0CEF,0x3461,0x21D8,0x082C,
- 0x1D85,0x32DC,0x0BFC,0x3C59,0x1505,0x377E,0x0CD7,0x3E73,
- 0x06F9,0x23E0,0x3B99,0x014C,0x2AEF,0x0C35,0x3364,0x13AD,
- 0x1C21,0x08F9,0x1651,0x2FF8,0x1B0C,0x02DE,0x3226,0x1EAA,
- 0x3BAF,0x0EC3,0x366B,0x20E1,0x2ADD,0x039A,0x2D7B,0x0870,
- 0x1C3C,0x2B9A,0x0D40,0x28E3,0x0128,0x2D19,0x0AA1,0x3078,
- 0x085B,0x24A1,0x0093,0x37DC,0x06D2,0x2734,0x0C32,0x2BBE,
- 0x2208,0x0D48,0x1FC3,0x067B,0x2246,0x3FC2,0x03FF,0x36F4,
- 0x0F59,0x228E,0x342D,0x071D,0x3F50,0x1CE9,0x01B5,0x287C,
- 0x211E,0x0C4D,0x1C18,0x2D5D,0x0EF5,0x2397,0x3A40,0x13CF,
- 0x355C,0x03E5,0x3CBD,0x0E1E,0x37DF,0x0C07,0x3B73,0x0356,
- 0x2800,0x18D7,0x3A60,0x164D,0x363F,0x1240,0x3272,0x22EB,
- 0x16FC,0x2D2A,0x045A,0x2AD5,0x1DEA,0x2444,0x1858,0x36B2,
- 0x1BF0,0x3B4E,0x18D6,0x2720,0x11C4,0x2D2F,0x16A8,0x28FE,
- 0x0046,0x2BB5,0x1E7E,0x0F0F,0x3FC9,0x1DB9,0x1219,0x3883,
- 0x14F0,0x328F,0x2335,0x1941,0x3114,0x0060,0x1F06,0x25D8,
- 0x199A,0x23BB,0x1F2C,0x100D,0x2F76,0x00A3,0x39A1,0x1A43,
- 0x3E4A,0x0284,0x2E82,0x1F1E,0x086F,0x1FE7,0x2928,0x1795,
- 0x2FB5,0x0B53,0x1F0D,0x34AD,0x1105,0x39C5,0x05D4,0x2FD4,
- 0x2605,0x35DA,0x211C,0x0EE8,0x26F0,0x370A,0x150F,0x0832,
- 0x1A66,0x298B,0x013C,0x3101,0x1583,0x39AA,0x0F84,0x3636,
- 0x2561,0x14D5,0x2FD9,0x11F9,0x33EE,0x1B12,0x266F,0x1677,
- 0x38BF,0x0F73,0x2CDC,0x12E9,0x2B14,0x16F4,0x3B5E,0x1D1C,
- 0x084B,0x3D53,0x29FA,0x1782,0x2F2D,0x10F1,0x2C92,0x0AAC,
- 0x1E06,0x3C4B,0x1117,0x2833,0x0E35,0x2DA4,0x18B1,0x3230,
- 0x07A7,0x3972,0x2748,0x0472,0x3815,0x0B07,0x2AE4,0x0725,
- 0x1C85,0x2A32,0x16BF,0x2C53,0x1208,0x26CB,0x1A1E,0x3262,
- 0x1198,0x2AF8,0x0CA9,0x25CB,0x0421,0x2DA3,0x0B28,0x3AB0,
- 0x072D,0x1D17,0x3C74,0x19BC,0x0986,0x3AA7,0x0632,0x2156,
- 0x0BE8,0x23DA,0x0188,0x37C3,0x20F6,0x07BB,0x3C0F,0x0FB2,
- 0x3568,0x13C3,0x3A92,0x25B1,0x02AF,0x2EEC,0x2210,0x0760,
- 0x2B84,0x1C65,0x040D,0x379E,0x0F7A,0x2A30,0x3A99,0x0521,
- 0x33C1,0x0B55,0x3941,0x250F,0x15E3,0x2A80,0x12E8,0x2D09,
- 0x1178,0x26C2,0x1448,0x368A,0x19F2,0x3AFD,0x0011,0x3325,
- 0x1352,0x2B9E,0x14B7,0x25B8,0x1B41,0x21D0,0x2CA8,0x0CFD,
- 0x159B,0x008D,0x297B,0x3A03,0x0703,0x18FA,0x2D1E,0x1FC2,
- 0x37FE,0x140C,0x3DB3,0x1E1B,0x08E8,0x1F9B,0x2940,0x17C7,
- 0x01E7,0x380B,0x07CA,0x3EE6,0x2199,0x0DBD,0x3D4F,0x0302,
- 0x1D60,0x335C,0x1841,0x3E42,0x0D91,0x33E1,0x019A,0x302B,
- 0x1A1B,0x23AC,0x02B3,0x3949,0x0906,0x35A6,0x194A,0x217A,
- 0x2BA0,0x05F1,0x2F78,0x1ED7,0x3682,0x0B25,0x3BA4,0x118B,
- 0x1DFC,0x235D,0x11D2,0x301D,0x1D09,0x33AC,0x1705,0x21FD,
- 0x3DC8,0x0AA9,0x3653,0x005A,0x1F21,0x30EF,0x0784,0x214E,
- 0x3F8B,0x05F7,0x3566,0x142E,0x3E0E,0x1B88,0x2711,0x15C1,
- 0x215F,0x34D7,0x0ED7,0x25C4,0x321E,0x0FB9,0x2814,0x3EF8,
- 0x1593,0x2F3B,0x1E16,0x0CE5,0x30E6,0x1970,0x1FA6,0x2680,
- 0x09DD,0x312F,0x06AE,0x1C35,0x36F9,0x135E,0x3B84,0x1EA1,
- 0x0C9E,0x3EE1,0x13D5,0x280A,0x1F8D,0x0BB4,0x17AE,0x2935,
- 0x1483,0x2E23,0x1AF9,0x05F2,0x3D06,0x0A66,0x262E,0x0691,
- 0x316D,0x0AA3,0x29B8,0x057E,0x2B27,0x1103,0x2782,0x0F5E,
- 0x3D77,0x03FD,0x382C,0x07FA,0x3F74,0x0369,0x1896,0x3B18,
- 0x2031,0x3E22,0x173F,0x0B6E,0x2267,0x3CD7,0x0C94,0x32DD,
- 0x045D,0x2618,0x0D88,0x2CA4,0x195A,0x342C,0x05A8,0x3E77,
- 0x222A,0x0E83,0x273C,0x1EDB,0x0528,0x2BD4,0x1424,0x2F8D,
- 0x2435,0x0972,0x29A8,0x04B6,0x255D,0x146E,0x2931,0x0F2F,
- 0x35DB,0x137E,0x32DA,0x11D4,0x1F04,0x255E,0x016E,0x3DDA,
- 0x0CED,0x37ED,0x1A58,0x02DF,0x1779,0x2A6E,0x04CF,0x26B1,
- 0x3629,0x0076,0x3F17,0x19CC,0x08B9,0x264D,0x024B,0x2DF4,
- 0x0F3E,0x289D,0x1455,0x2464,0x3E6B,0x132D,0x371E,0x1BE5,
- 0x0B68,0x2DDD,0x1006,0x290A,0x1EFD,0x08E6,0x3976,0x032B,
- 0x2A6A,0x0A61,0x3059,0x01FE,0x174D,0x3735,0x1D39,0x0321,
- 0x330F,0x0898,0x3DAE,0x238F,0x14ED,0x398C,0x026F,0x3742,
- 0x1B43,0x2417,0x174F,0x2D5A,0x0ACA,0x2830,0x04C0,0x3454,
- 0x22FD,0x1816,0x3357,0x06D3,0x3D1D,0x23C0,0x352C,0x0985,
- 0x3E3D,0x01C3,0x209D,0x30F6,0x170D,0x3403,0x1416,0x3BD2,
- 0x1B47,0x35D3,0x0F0B,0x3CC6,0x1CB0,0x33F0,0x0940,0x2ECF,
- 0x1D0F,0x2430,0x10C4,0x2F65,0x0E5F,0x32C9,0x2894,0x0847,
- 0x24E3,0x0E15,0x324D,0x1D5F,0x348B,0x01D9,0x28B2,0x131A,
- 0x2AFE,0x119F,0x3372,0x0326,0x3AD4,0x0CB4,0x2EA3,0x10F0,
- 0x30BD,0x19CB,0x3300,0x13B9,0x3A59,0x0B30,0x3639,0x2021,
- 0x126A,0x3BA7,0x1614,0x3554,0x0B37,0x397A,0x1B7C,0x3F84,
- 0x062E,0x2C6F,0x0A6E,0x270D,0x3B27,0x0ED2,0x3177,0x12C1,
- 0x2772,0x1428,0x3349,0x2063,0x3E29,0x0FB7,0x34B9,0x1F75,
- 0x0BC2,0x2BAF,0x0EAF,0x24B5,0x3BD1,0x0FC8,0x36D2,0x1C40,
- 0x38FF,0x04EA,0x330E,0x1AFF,0x0953,0x2CD5,0x0227,0x29E8,
- 0x227A,0x185C,0x3C1E,0x01A6,0x2FAB,0x18DF,0x232F,0x3377,
- 0x1095,0x3E39,0x1CAC,0x2214,0x2D74,0x07A8,0x2BA4,0x19FA,
- 0x2763,0x2009,0x1372,0x34CE,0x05FB,0x2282,0x2E8A,0x1300,
- 0x2A8A,0x03FC,0x3CD3,0x101B,0x32CA,0x16DD,0x29D4,0x0EBA,
- 0x2C8F,0x01BD,0x2177,0x2E27,0x1605,0x030F,0x1B91,0x2B3F,
- 0x0EAB,0x2479,0x387C,0x10DF,0x2BBD,0x0372,0x28ED,0x1FB1,
- 0x016C,0x1E53,0x2DC7,0x22DC,0x033C,0x16E6,0x3918,0x196E,
- 0x061D,0x31AD,0x20C8,0x191C,0x26DD,0x1ECF,0x122C,0x33FC,
- 0x1A20,0x2D0B,0x053E,0x280C,0x0EA7,0x2F2C,0x1CCC,0x38D5,
- 0x0A68,0x3ED5,0x2145,0x1BC1,0x26C0,0x161B,0x243C,0x1E6C,
- 0x0942,0x391A,0x0359,0x2CFF,0x1001,0x28A0,0x1A7A,0x06FE,
- 0x313F,0x023E,0x2835,0x10C8,0x2A8B,0x1FEF,0x038F,0x1EBC,
- 0x287B,0x1566,0x3CD1,0x1B02,0x0552,0x2D33,0x1C94,0x38F3,
- 0x046E,0x2A11,0x0A1F,0x2E40,0x0815,0x1D37,0x244D,0x14AB,
- 0x3A65,0x168C,0x32D1,0x03F5,0x2020,0x306E,0x15D6,0x09B3,
- 0x22F2,0x2F85,0x1194,0x39DE,0x21C4,0x1036,0x3AF9,0x1547,
- 0x3466,0x0518,0x1CC8,0x32E1,0x12D1,0x3676,0x0C00,0x16AA,
- 0x2C9A,0x1950,0x06F5,0x3627,0x1427,0x3BE7,0x11F8,0x37CF,
- 0x0DC3,0x39F8,0x042C,0x1C76,0x2C3F,0x1869,0x0C8C,0x3F32,
- 0x0E84,0x34C5,0x1D7D,0x26F1,0x013D,0x3E9B,0x0964,0x37EC,
- 0x127C,0x3B15,0x1AF0,0x0AC6,0x370D,0x1E42,0x3BA0,0x1235,
- 0x324E,0x19EF,0x083E,0x2697,0x0CD0,0x39FC,0x1026,0x3763,
- 0x17C2,0x3ECF,0x07D2,0x162C,0x3070,0x2133,0x0E25,0x2A45,
- 0x3AA1,0x0C0C,0x36DE,0x010D,0x3CF1,0x099A,0x38E5,0x02A2,
- 0x3BEC,0x0AE7,0x3838,0x1362,0x3F83,0x1876,0x0774,0x220D,
- 0x3028,0x17FD,0x06A2,0x2EF0,0x0A0D,0x35C2,0x00DE,0x3B89,
- 0x2AE6,0x1690,0x2505,0x1B6C,0x3745,0x002E,0x3F68,0x223D,
- 0x0EDB,0x376A,0x1CEC,0x3DC9,0x0768,0x3390,0x17EF,0x2ECC,
- 0x0E02,0x324B,0x0069,0x22FB,0x374C,0x1627,0x089D,0x22AE,
- 0x3068,0x15CD,0x3B1C,0x1220,0x28FC,0x397F,0x0216,0x2FC2,
- 0x068A,0x28C9,0x110A,0x3881,0x1832,0x063F,0x29BB,0x3FD1,
- 0x18E2,0x0BCD,0x2B72,0x0310,0x30AA,0x1E46,0x0812,0x2BC3,
- 0x0D02,0x392D,0x2525,0x0DCB,0x296F,0x05B9,0x3F4F,0x20AF,
- 0x0024,0x38FA,0x2564,0x1013,0x293D,0x0C1A,0x267F,0x00EE,
- 0x2E13,0x17AF,0x2313,0x3291,0x0FE8,0x3ADE,0x20AA,0x0679,
- 0x2CAD,0x1924,0x0833,0x38DA,0x206F,0x112C,0x301F,0x1A27,
- 0x260C,0x085F,0x3138,0x2372,0x1340,0x2D1F,0x07E3,0x27DF,
- 0x0464,0x36A6,0x1CD2,0x3FA5,0x1882,0x2185,0x3214,0x0B70,
- 0x2C35,0x12B5,0x24FF,0x3664,0x0C33,0x3FD4,0x2554,0x0201,
- 0x1EE9,0x263B,0x1691,0x2D78,0x0FBE,0x2BD0,0x1CA1,0x2294,
- 0x142A,0x29E7,0x195D,0x2E49,0x0413,0x2473,0x3A56,0x15F0,
- 0x0010,0x2315,0x3551,0x0F70,0x3D41,0x1A26,0x2808,0x0D5A,
- 0x2051,0x06EF,0x3D9A,0x0C15,0x215A,0x3248,0x1149,0x2E9A,
- 0x18CF,0x258B,0x0BDE,0x1975,0x3015,0x1317,0x3835,0x07F8,
- 0x3A6C,0x218A,0x1852,0x2B67,0x0B00,0x2076,0x3EFE,0x17DF,
- 0x0B76,0x351A,0x00CF,0x23E3,0x1F58,0x0E70,0x2B38,0x1306,
- 0x3D4E,0x18DB,0x2E8C,0x0CA2,0x27C1,0x3533,0x2134,0x00F2,
- 0x1FA0,0x3573,0x1723,0x27BE,0x13EF,0x3D76,0x25EA,0x1307,
- 0x2F6C,0x20D8,0x09C4,0x3B33,0x1F8C,0x2EC8,0x111C,0x2756,
- 0x323E,0x0E0A,0x2005,0x3D1E,0x0380,0x2F75,0x16C6,0x3452,
- 0x21E2,0x090D,0x3CCF,0x0B5F,0x29E9,0x00AB,0x3559,0x25E3,
- 0x1422,0x322A,0x24D9,0x0EF3,0x2D22,0x1BEC,0x23F9,0x035A,
- 0x3519,0x1FE1,0x1573,0x3F76,0x00EB,0x219C,0x3980,0x1662,
- 0x2A03,0x0FC4,0x2CBD,0x0038,0x30A6,0x0700,0x1D62,0x26F5,
- 0x04F1,0x33A0,0x0DC2,0x1E0D,0x28A6,0x06CB,0x1C2C,0x3558,
- 0x0D89,0x3C51,0x0757,0x1D9B,0x34DE,0x177D,0x06C3,0x3129,
- 0x355B,0x00F4,0x269F,0x0CD6,0x36B0,0x1BE0,0x094B,0x341C,
- 0x1D65,0x3C3B,0x12EB,0x2B6D,0x1D2A,0x0603,0x3318,0x14B2,
- 0x2975,0x34F0,0x10D0,0x2F58,0x05DB,0x1DDA,0x2B58,0x093A,
- 0x3442,0x0452,0x39D8,0x2B02,0x00E8,0x2462,0x0C84,0x276B,
- 0x1DE7,0x0506,0x2FB6,0x1249,0x346E,0x266D,0x0242,0x2DD3,
- 0x1D81,0x2503,0x199D,0x3FD0,0x0731,0x35E6,0x1AA2,0x339A,
- 0x0A90,0x25B7,0x0193,0x3E40,0x1DC9,0x0910,0x1436,0x3A6D,
- 0x26E7,0x066C,0x3C15,0x0AB9,0x34B4,0x048C,0x1B33,0x3863,
- 0x00BE,0x193B,0x313C,0x161D,0x02B6,0x1A94,0x3506,0x0863,
- 0x1A03,0x2BE1,0x054A,0x1BDB,0x32E8,0x14AD,0x3FA3,0x0D46,
- 0x1AE5,0x2CC7,0x1476,0x27EA,0x1625,0x307C,0x1A67,0x0B21,
- 0x3BB4,0x0211,0x1B6B,0x343E,0x0530,0x39BC,0x0C41,0x3DA2,
- 0x0DD5,0x2EAF,0x0596,0x1C42,0x333C,0x183F,0x0DBC,0x346F,
- 0x0BD4,0x3C8E,0x21FA,0x15E4,0x2391,0x3B70,0x0EDD,0x2FE2,
- 0x19AB,0x20F7,0x3B2C,0x00B5,0x385E,0x151E,0x2E04,0x1243,
- 0x2923,0x158C,0x3103,0x246F,0x049F,0x3ECA,0x20F2,0x106C,
- 0x0BE9,0x3DD7,0x1610,0x2B13,0x125E,0x2F9C,0x25EB,0x1063,
- 0x2D0D,0x0BEA,0x2722,0x027E,0x30FF,0x21B3,0x1844,0x3FBD,
- 0x03D2,0x1E7F,0x26A8,0x1799,0x3C20,0x0D96,0x237E,0x3AF8,
- 0x133D,0x2881,0x1E69,0x10A3,0x1F6D,0x3C9D,0x16AB,0x2E05,
- 0x1067,0x3E91,0x0D35,0x3901,0x06F2,0x1971,0x32AE,0x0DA0,
- 0x3BB2,0x0627,0x30F1,0x0CCC,0x297A,0x1E7B,0x03AF,0x1FEB,
- 0x2AB8,0x11F5,0x31EA,0x2236,0x1031,0x3792,0x295B,0x1ACC,
- 0x0CEC,0x2EBD,0x15CC,0x2A3C,0x10CB,0x23AE,0x3285,0x1152,
- 0x24B7,0x3EBC,0x07C2,0x2B62,0x1DFA,0x3CFC,0x0F6D,0x245B,
- 0x3B8B,0x1256,0x383E,0x26D9,0x09FC,0x2B29,0x069D,0x1FB4,
- 0x3900,0x0259,0x366D,0x0653,0x3E9D,0x0A1C,0x1FA2,0x2BFF,
- 0x1157,0x2042,0x3E2B,0x0BAF,0x2848,0x159D,0x31B3,0x1757,
- 0x2A2E,0x11C6,0x3590,0x26B0,0x093B,0x2FE3,0x25C7,0x02C1,
- 0x2E5A,0x1E48,0x05D2,0x381E,0x0A3F,0x1EA7,0x34F3,0x0247,
- 0x3DCB,0x09BB,0x25FF,0x18B9,0x201E,0x32E7,0x0900,0x3E04,
- 0x0385,0x388F,0x09F4,0x1A88,0x2AA0,0x0EB5,0x300E,0x253E,
- 0x2A5E,0x112A,0x3215,0x07A5,0x3D20,0x0246,0x2002,0x3B21,
- 0x048F,0x29BA,0x172C,0x35E7,0x0E6D,0x389D,0x0908,0x2330,
- 0x3018,0x0B71,0x362F,0x01AF,0x2280,0x31B8,0x1667,0x02BB,
- 0x20D1,0x3E15,0x06C6,0x234D,0x3127,0x0916,0x358C,0x02FA,
- 0x3343,0x2227,0x1A71,0x24E8,0x1D5E,0x3D0E,0x11C5,0x29D9,
- 0x148E,0x2C1A,0x10D5,0x3707,0x1371,0x39D7,0x16B3,0x3CBF,
- 0x07C1,0x36AF,0x1B86,0x057D,0x3004,0x209C,0x034D,0x33DB,
- 0x2487,0x1004,0x3238,0x01A8,0x3F34,0x1EFE,0x0770,0x2CB6,
- 0x0D51,0x1E86,0x3587,0x0E80,0x308B,0x0695,0x2A42,0x1D66,
- 0x0251,0x2E2C,0x0AEC,0x189F,0x355A,0x11CB,0x247B,0x3149,
- 0x0F1B,0x2A8E,0x1B5D,0x2EB3,0x12B0,0x2698,0x3A38,0x056E,
- 0x368F,0x2446,0x14F1,0x2FCB,0x1052,0x2B4C,0x0010,0x2773,
- 0x077E,0x3C2D,0x20A3,0x0E7C,0x3D6C,0x1FBA,0x12B8,0x3A86,
- 0x224F,0x10E6,0x2AFA,0x1758,0x2DA2,0x11C2,0x2292,0x2A93,
- 0x143D,0x2CE6,0x1202,0x30C0,0x04C5,0x26BC,0x1AF1,0x22C6,
- 0x2C50,0x1048,0x205B,0x36B3,0x14B4,0x3985,0x02E8,0x1AD1,
- 0x0671,0x3755,0x2314,0x180E,0x21E8,0x319D,0x0D9D,0x1B63,
- 0x3347,0x149F,0x3F27,0x07DD,0x2A6D,0x13F5,0x2C1F,0x1028,
- 0x19D9,0x3A2E,0x1517,0x2E64,0x1B93,0x086B,0x372C,0x1C64,
- 0x2F54,0x0E6B,0x1BF9,0x3649,0x0F17,0x2B82,0x189C,0x25E1,
- 0x1F17,0x095B,0x30A3,0x0159,0x2C52,0x0A49,0x27C9,0x03D3,
- 0x3886,0x1ADF,0x25D0,0x0271,0x2EC6,0x0956,0x313A,0x0F14,
- 0x2CFD,0x13B4,0x2668,0x3C2E,0x0D34,0x160F,0x3ECB,0x17CB,
- 0x0543,0x3A01,0x20D6,0x19DD,0x2862,0x123D,0x3AC1,0x1591,
- 0x33E7,0x04B2,0x2675,0x1829,0x223E,0x376E,0x0BBC,0x33BC,
- 0x17BE,0x22F4,0x3279,0x208E,0x0166,0x3A83,0x1C56,0x048E,
- 0x3D85,0x20CA,0x0876,0x234B,0x37F8,0x0328,0x1716,0x3112,
- 0x19FB,0x0804,0x2A39,0x03C7,0x3B61,0x1D97,0x3825,0x12D2,
- 0x30B5,0x1A48,0x025D,0x2D5E,0x1910,0x04B8,0x328B,0x09F6,
- 0x1A82,0x3E4E,0x0CD5,0x35D6,0x03A3,0x3F2B,0x0864,0x1C5A,
- 0x329D,0x066E,0x3A51,0x0EBE,0x3D31,0x1333,0x3779,0x0CD2,
- 0x173A,0x334C,0x2754,0x003F,0x2D37,0x0B44,0x1FD7,0x3B5B,
- 0x2F4F,0x1DA3,0x03C0,0x2E77,0x0A32,0x1655,0x37D1,0x2780,
- 0x0AE9,0x2E08,0x0F43,0x247A,0x1A83,0x3AE2,0x0104,0x345E,
- 0x2074,0x070F,0x2AD8,0x0E11,0x3EA6,0x25CD,0x0CBD,0x2933,
- 0x079C,0x334F,0x26A5,0x01DD,0x3F1A,0x1CCA,0x05E8,0x3BB8,
- 0x128F,0x36D8,0x160D,0x3B07,0x16F5,0x3674,0x13D2,0x33F5,
- 0x2222,0x087B,0x3D80,0x2112,0x181B,0x24CD,0x1BB4,0x2705,
- 0x0028,0x3A9D,0x0935,0x1976,0x2C76,0x234F,0x096B,0x308E,
- 0x1C8F,0x28F4,0x0867,0x37D8,0x0B65,0x300C,0x02C8,0x2AB6,
- 0x1FE2,0x3C7B,0x0C66,0x39AF,0x013A,0x15E1,0x2D53,0x13CA,
- 0x3F22,0x07E5,0x1514,0x3C70,0x25E9,0x0CAD,0x3041,0x1806,
- 0x253B,0x11A1,0x3193,0x18C5,0x0DAD,0x219B,0x2B68,0x0FB4,
- 0x257E,0x3AA8,0x124E,0x3312,0x1ACA,0x0A91,0x22C9,0x33D3,
- 0x0CB7,0x2480,0x39D6,0x105D,0x3628,0x2973,0x151F,0x2518,
- 0x33B4,0x017B,0x2F9D,0x14B6,0x1F6F,0x27AC,0x1808,0x389F,
- 0x0FA2,0x2758,0x1D2E,0x2AA5,0x0A6D,0x2D24,0x0192,0x2175,
- 0x3BA6,0x05DF,0x1986,0x3F57,0x1279,0x248D,0x3410,0x0FE9,
- 0x20FE,0x0E48,0x3FD4,0x1EAF,0x39E0,0x235E,0x05C4,0x18B0,
- 0x3BD9,0x0191,0x1F44,0x319E,0x054C,0x1D87,0x2F37,0x0C80,
- 0x3CE2,0x24B0,0x11D9,0x32A4,0x0502,0x1867,0x397C,0x12BE,
- 0x3C73,0x1ED5,0x1381,0x2D15,0x1524,0x2422,0x304F,0x0CE0,
- 0x2A17,0x0495,0x28B7,0x0B94,0x26C3,0x0672,0x2E42,0x1D1B,
- 0x0EF1,0x303D,0x1555,0x343D,0x0AF4,0x3E9C,0x052F,0x386F,
- 0x20FC,0x1713,0x22AD,0x358E,0x022E,0x38C4,0x1E60,0x1161,
- 0x3D2F,0x0EEE,0x3319,0x16CC,0x2567,0x1BB8,0x373F,0x1466,
- 0x093E,0x19B0,0x29C6,0x124B,0x27F1,0x3DF6,0x217D,0x041C,
- 0x2786,0x1CAD,0x2D0E,0x05AE,0x1E66,0x29C1,0x13E8,0x3890,
- 0x0A30,0x35F2,0x0044,0x3B95,0x1CDC,0x35BA,0x0B6C,0x3FCD,
- 0x011C,0x1E4D,0x2DD1,0x092C,0x26D0,0x3EEF,0x1813,0x05AF,
- 0x2C34,0x1D18,0x08B2,0x271B,0x20EA,0x0C56,0x3C0E,0x072A,
- 0x1D35,0x2A72,0x0F49,0x2405,0x398F,0x0B1C,0x2C9F,0x0108,
- 0x2373,0x3712,0x02F4,0x182E,0x35DD,0x2358,0x1B8A,0x2EF7,
- 0x0B7E,0x2AF5,0x1F96,0x0D1B,0x31B5,0x1881,0x07E2,0x27CE,
- 0x0168,0x34D5,0x1A0E,0x0836,0x1396,0x304E,0x1D11,0x2CBB,
- 0x1190,0x23EA,0x36D6,0x10A9,0x3D57,0x2625,0x12BB,0x29F8,
- 0x17EB,0x02FF,0x38DD,0x1AB8,0x2130,0x2B3C,0x009C,0x2DAA,
- 0x229C,0x0414,0x38AE,0x0D71,0x33AF,0x0AB2,0x19E5,0x35EB,
- 0x144F,0x3FA8,0x10F6,0x34AE,0x1329,0x3DFA,0x22D1,0x007F,
- 0x39EF,0x1FA1,0x0565,0x1E31,0x2BBF,0x1251,0x333D,0x1508,
- 0x2F50,0x0C44,0x3173,0x10F2,0x2B0D,0x0DF1,0x2E57,0x21EB,
- 0x0094,0x26BE,0x203C,0x0411,0x3CD6,0x0A2E,0x22FF,0x31D3,
- 0x1DE2,0x2F10,0x03C5,0x3327,0x1ED0,0x0883,0x1B5A,0x3501,
- 0x1045,0x38EE,0x0E54,0x360F,0x15DE,0x3ED7,0x02B9,0x1D20,
- 0x2C7E,0x1327,0x293F,0x0C31,0x2891,0x05E1,0x2D9D,0x1933,
- 0x3180,0x0E51,0x227E,0x3740,0x149A,0x01F0,0x2171,0x3942,
- 0x13D0,0x36C0,0x17A2,0x3FD4,0x00AF,0x1DDC,0x2845,0x1958,
- 0x38C6,0x1380,0x3D28,0x0649,0x19E6,0x323A,0x13A9,0x3C29,
- 0x1AB2,0x0D4F,0x20A1,0x2E1D,0x14E2,0x059F,0x3F06,0x0FAD,
- 0x3578,0x12FB,0x39E6,0x25B9,0x0410,0x38DC,0x1CC1,0x3C8F,
- 0x2DB4,0x11DD,0x2875,0x32F4,0x20C5,0x0086,0x3E8E,0x0C6B,
- 0x34AB,0x1BD7,0x0B54,0x2C55,0x1763,0x0994,0x37EB,0x066A,
- 0x325C,0x1D2F,0x273F,0x09F1,0x2FDE,0x0DDF,0x3530,0x1DBE,
- 0x1168,0x3139,0x17B6,0x2A91,0x04D2,0x3A98,0x27BD,0x0010,
- 0x237F,0x1C22,0x2C8E,0x0298,0x2F11,0x1DDB,0x101A,0x2D2D,
- 0x0B9B,0x2A44,0x1A78,0x3BDE,0x017E,0x2886,0x1FCD,0x0773,
- 0x1DE9,0x3F92,0x0451,0x2737,0x1C58,0x3BC0,0x05DC,0x3696,
- 0x1954,0x34A8,0x0DCE,0x2F9B,0x12D7,0x2E11,0x1784,0x0043,
- 0x3FBE,0x0D70,0x383C,0x2343,0x0FA7,0x36C1,0x28C6,0x14E4,
- 0x2EDE,0x0087,0x1F65,0x285F,0x0941,0x2278,0x33ED,0x2685,
- 0x074E,0x3E4D,0x1FC1,0x3383,0x1071,0x3D0F,0x2305,0x118F,
- 0x2024,0x38D3,0x04C6,0x16E9,0x2C87,0x1D3C,0x2EC5,0x0FD5,
- 0x2874,0x0374,0x2F42,0x14FE,0x2BE9,0x37AD,0x0D9C,0x3065,
- 0x0349,0x28A8,0x0B9C,0x347A,0x25E2,0x0463,0x2983,0x0A1D,
- 0x3341,0x2470,0x3E46,0x092F,0x3928,0x2223,0x18D3,0x27E8,
- 0x0291,0x309D,0x08AC,0x1B20,0x2A56,0x0F38,0x2C3B,0x1481,
- 0x0A7F,0x3AB8,0x04C3,0x15DA,0x383F,0x2672,0x0FCD,0x29D7,
- 0x0514,0x27D7,0x392E,0x0396,0x2232,0x307E,0x1C45,0x2529,
- 0x0ECA,0x3EF5,0x1309,0x3716,0x15B8,0x3B48,0x2192,0x062D,
- 0x29CB,0x0BB9,0x3D1F,0x10B0,0x254C,0x1E1D,0x0FDA,0x2BF7,
- 0x392F,0x0861,0x1877,0x3C18,0x23F0,0x07AF,0x374E,0x18E0,
- 0x3F59,0x1171,0x34E9,0x0E28,0x2EFB,0x0FCB,0x31DE,0x1A44,
- 0x2C3D,0x0F4C,0x1F4A,0x37AE,0x083D,0x17B8,0x2A77,0x1472,
- 0x2CD0,0x07E0,0x3AE1,0x1A85,0x2769,0x06B7,0x396C,0x20FF,
- 0x11ED,0x2B3B,0x1A3F,0x0AE3,0x2FB0,0x187B,0x05D8,0x3A61,
- 0x0C53,0x23ED,0x3B1A,0x1280,0x3027,0x1A1C,0x0AF8,0x1673,
- 0x2F36,0x1A91,0x03AE,0x16B8,0x2AFD,0x1C5E,0x0292,0x3428,
- 0x08A1,0x271F,0x1BA3,0x3CD9,0x0A2F,0x3616,0x0710,0x3E18,
- 0x0D10,0x34E5,0x224D,0x0BE7,0x1FA3,0x0624,0x24A7,0x11FE,
- 0x336B,0x1558,0x2DFB,0x1E22,0x0FE6,0x361C,0x1D00,0x2F52,
- 0x145A,0x051B,0x1633,0x3120,0x11E0,0x29EC,0x082A,0x386A,
- 0x20DA,0x16FA,0x2336,0x3DB8,0x13A0,0x366F,0x0647,0x2406,
- 0x1785,0x2593,0x1D63,0x2B9D,0x08C7,0x1B03,0x35ED,0x14FF,
- 0x3CA1,0x191F,0x0E38,0x1E4B,0x3E67,0x155C,0x004E,0x3A97,
- 0x1FF2,0x07DF,0x2CE3,0x0243,0x2A53,0x08B6,0x1961,0x3FD4,
- 0x1421,0x3467,0x0171,0x201C,0x2FF6,0x08EC,0x3DED,0x1CBC,
- 0x0E27,0x210F,0x3134,0x1553,0x0C81,0x1F0A,0x282B,0x0392,
- 0x2197,0x311F,0x0648,0x23AF,0x17C9,0x3816,0x0A0C,0x3CFB,
- 0x0289,0x360C,0x24B4,0x1273,0x31FF,0x2539,0x0C0B,0x3E87,
- 0x0FC6,0x1F3F,0x23EF,0x024A,0x3E2D,0x1E47,0x0E29,0x3473,
- 0x2603,0x050C,0x3C0A,0x2040,0x0221,0x3D43,0x2519,0x12DB,
- 0x2BB6,0x1B1E,0x081C,0x3304,0x0454,0x3C19,0x1F4F,0x3702,
- 0x0F27,0x3A15,0x1EDA,0x3562,0x0917,0x3987,0x17C4,0x2394,
- 0x3C17,0x0DC1,0x2F8B,0x1142,0x2AA2,0x18AD,0x25C1,0x1356,
- 0x2D01,0x19B8,0x081F,0x3C30,0x2A08,0x187F,0x3EC8,0x2032,
- 0x0920,0x3A22,0x2117,0x004A,0x3F7F,0x22FE,0x072C,0x17A0,
- 0x3D01,0x1EAB,0x2B99,0x1C71,0x0084,0x349E,0x1F7B,0x1378,
- 0x323C,0x0AF7,0x2E87,0x00F7,0x3123,0x0C8F,0x2006,0x3E51,
- 0x2ED8,0x0D6E,0x3477,0x0F09,0x3D98,0x238A,0x0338,0x30B4,
- 0x0A11,0x209B,0x3280,0x28C5,0x090B,0x34D8,0x2710,0x116A,
- 0x2DE6,0x1AE8,0x222B,0x348C,0x0FF7,0x2679,0x30A2,0x0CAB,
- 0x2BDE,0x22EE,0x19C2,0x3800,0x123C,0x34D0,0x2339,0x0347,
- 0x29CC,0x379D,0x0533,0x22B9,0x39AE,0x2A31,0x0DE0,0x3233,
- 0x0A56,0x19D2,0x29AD,0x3AD5,0x0361,0x1C95,0x27FD,0x1463,
- 0x2A1E,0x192D,0x09AD,0x3DC4,0x0120,0x1B25,0x2D9F,0x034A,
- 0x27BB,0x38A5,0x13D7,0x32D7,0x11A7,0x3055,0x2268,0x08CA,
- 0x1920,0x2EA1,0x13F1,0x274A,0x329F,0x0E93,0x1E3B,0x35C8,
- 0x035F,0x3FD4,0x2624,0x0FB5,0x2B45,0x14AF,0x2DC9,0x00D6,
- 0x2A69,0x06A9,0x2E7A,0x1385,0x2820,0x0EFE,0x2FE8,0x0686,
- 0x1C9C,0x2A24,0x0079,0x346B,0x220A,0x03F6,0x3B4B,0x1F40,
- 0x0137,0x3846,0x1CD9,0x2385,0x0E8F,0x31A2,0x021C,0x3544,
- 0x1B71,0x2530,0x1135,0x2FFC,0x18F2,0x0CF1,0x3A9A,0x27DD,
- 0x0222,0x341A,0x0AC0,0x3A1A,0x22F3,0x15AE,0x3C9C,0x0459,
- 0x1C1F,0x3B08,0x10A6,0x1E24,0x26AE,0x1914,0x3260,0x02D2,
- 0x1C4C,0x39A3,0x01FF,0x2FBF,0x1F35,0x12D8,0x2D38,0x1727,
- 0x2433,0x39C8,0x01CC,0x1370,0x2E4C,0x205C,0x0D31,0x3691,
- 0x0485,0x3BE5,0x0B3E,0x18C2,0x3D5E,0x1F7A,0x033B,0x3865,
- 0x1E08,0x0551,0x2E28,0x0ACE,0x2AEB,0x0663,0x175A,0x3278,
- 0x1FCA,0x0F5D,0x1CCE,0x3329,0x01A5,0x176C,0x3CA3,0x1376,
- 0x38B5,0x2653,0x1577,0x0C55,0x2261,0x3575,0x06EC,0x3959,
- 0x0B77,0x345D,0x28C1,0x1390,0x2388,0x399F,0x0EC5,0x35F5,
- 0x1DAD,0x0717,0x2A09,0x0A95,0x2B86,0x0449,0x37AB,0x1C9B,
- 0x3B36,0x1078,0x371B,0x061A,0x1AD0,0x2C72,0x08FC,0x20EE,
- 0x3170,0x0D2E,0x190E,0x386B,0x21E3,0x0A6B,0x1C03,0x3DEE,
- 0x12BA,0x2583,0x0CD9,0x3F89,0x018F,0x364F,0x2225,0x163E,
- 0x3254,0x100A,0x3F5B,0x1E36,0x0E2E,0x30D3,0x1083,0x32EA,
- 0x24A8,0x0D77,0x2FEE,0x045B,0x3A6F,0x1648,0x2870,0x0F01,
- 0x2D84,0x04E0,0x3C6C,0x08AE,0x1FF7,0x31B0,0x11A3,0x20C6,
- 0x2E99,0x12D5,0x26FD,0x0F48,0x2D6C,0x08D1,0x2917,0x2135,
- 0x2B3A,0x0741,0x2251,0x3727,0x0544,0x3C14,0x1443,0x2749,
- 0x079A,0x234E,0x1AAD,0x24E0,0x0694,0x3B0D,0x0B1F,0x3732,
- 0x074C,0x1589,0x25F9,0x355D,0x182D,0x05BF,0x2FF5,0x13E4,
- 0x2997,0x1604,0x27A2,0x2F44,0x06BE,0x1570,0x33D8,0x239E,
- 0x0E46,0x3AD0,0x1663,0x3E69,0x1BC6,0x216B,0x3B90,0x14DB,
- 0x0936,0x3EC9,0x276C,0x11C8,0x2CE4,0x2136,0x0746,0x2FB8,
- 0x1EC2,0x010B,0x3E47,0x1CF4,0x30C3,0x10A0,0x2D1B,0x21CC,
- 0x15D3,0x1F77,0x04A4,0x2F95,0x1D12,0x08BA,0x308C,0x20AB,
- 0x1114,0x338B,0x18F9,0x3A0E,0x1557,0x268C,0x132A,0x29E6,
- 0x018D,0x2BF4,0x0BA6,0x21FE,0x3E9F,0x1592,0x39EC,0x11B3,
- 0x248A,0x1CE6,0x2E44,0x01DA,0x1692,0x35DF,0x2357,0x08DF,
- 0x210B,0x31F4,0x18DA,0x22AF,0x2D40,0x14D0,0x0B2F,0x3A8D,
- 0x046C,0x2791,0x206E,0x08FB,0x39AC,0x1C0A,0x2BA5,0x09EB,
- 0x1B36,0x3D7F,0x13F7,0x2957,0x0B5C,0x2F08,0x07DB,0x3DC3,
- 0x132E,0x291B,0x1698,0x35AC,0x2657,0x0397,0x3824,0x097D,
- 0x1A1A,0x3799,0x05AA,0x3FC5,0x1842,0x3388,0x0D67,0x14DA,
- 0x3EA9,0x1788,0x2FE9,0x12A2,0x2BFE,0x21E0,0x0969,0x305B,
- 0x376D,0x1237,0x3F11,0x10D8,0x32D4,0x1945,0x2B0B,0x1167,
- 0x2860,0x3F88,0x1A96,0x0831,0x3C47,0x22CA,0x1B28,0x3A21,
- 0x0999,0x330A,0x0111,0x2022,0x38F7,0x2328,0x0961,0x16ED,
- 0x2FA1,0x21B5,0x081B,0x25A8,0x0258,0x2DE5,0x0B2D,0x263C,
- 0x340D,0x20D7,0x05FD,0x3AA5,0x0AD5,0x3489,0x1A97,0x2563,
- 0x0E99,0x2D7A,0x113E,0x2B22,0x047E,0x3C80,0x1B2E,0x0077,
- 0x3F38,0x241A,0x3698,0x0F28,0x3B63,0x169A,0x26E4,0x04DE,
- 0x3FA1,0x2460,0x00D3,0x1D56,0x2E78,0x0822,0x3EEA,0x0F2D,
- 0x3392,0x14F6,0x1E9A,0x30EE,0x0CAE,0x28EE,0x00FC,0x2D39,
- 0x06C7,0x3414,0x0B73,0x3DA1,0x28E9,0x0542,0x3162,0x181E,
- 0x3790,0x03F9,0x3929,0x09A9,0x1D7E,0x3C8C,0x1BEB,0x2993,
- 0x192E,0x350B,0x127F,0x2EC2,0x2354,0x0654,0x15B6,0x37C9,
- 0x27B1,0x059D,0x3453,0x170B,0x3782,0x1264,0x241C,0x1ACD,
- 0x32E3,0x0C08,0x2E55,0x0E1C,0x1A70,0x2B1F,0x14DE,0x24F6,
- 0x30E2,0x0E8C,0x294C,0x1FB0,0x02C5,0x1E01,0x38BB,0x260E,
- 0x01BE,0x29D3,0x0BD3,0x3A7D,0x0DEA,0x1B52,0x344A,0x15E5,
- 0x0C26,0x2909,0x03B2,0x2A01,0x0C3D,0x2731,0x00CD,0x33E5,
- 0x1E7C,0x0426,0x2F7B,0x1FD3,0x1069,0x3153,0x02AE,0x25C8,
- 0x1E6B,0x1214,0x3E3B,0x17CA,0x0CF5,0x2CA0,0x1CB1,0x3CF8,
- 0x006D,0x1ADE,0x36CE,0x0EF9,0x34F4,0x1354,0x3988,0x1B74,
- 0x00B9,0x17E5,0x2E7D,0x15DB,0x2AE1,0x12CF,0x3DBA,0x0465,
- 0x37AA,0x1880,0x339E,0x0B1E,0x28AF,0x0E81,0x2678,0x316A,
- 0x131D,0x0895,0x1996,0x2B6A,0x01ED,0x3269,0x109D,0x2CAB,
- 0x17BA,0x0D5D,0x2205,0x3C4F,0x0EA5,0x350A,0x1C20,0x2789,
- 0x076F,0x3CE6,0x258D,0x0368,0x381C,0x13A2,0x361F,0x1503,
- 0x3CAD,0x1783,0x26E8,0x1154,0x1D99,0x3AB4,0x1053,0x2BCE,
- 0x0E1B,0x1E3A,0x27E1,0x160E,0x2AC8,0x02F8,0x3324,0x07D1,
- 0x2465,0x0A7B,0x3876,0x02AB,0x177C,0x3E72,0x2245,0x020A,
- 0x1846,0x2E31,0x0F6F,0x2665,0x008A,0x20B7,0x3106,0x03D0,
- 0x1FC0,0x3ADA,0x01AE,0x215B,0x395A,0x07A4,0x3E84,0x1C2A,
- 0x0132,0x3B7B,0x13E6,0x35E3,0x1AA4,0x3057,0x06A7,0x1F34,
- 0x3651,0x1A24,0x336C,0x037C,0x211A,0x3FB1,0x002A,0x2B1A,
- 0x3A23,0x1BF1,0x3513,0x1556,0x3C5D,0x1684,0x385B,0x21C1,
- 0x0D37,0x2C17,0x0ED9,0x38BE,0x24EF,0x0BC0,0x3F51,0x0E74,
- 0x379C,0x21EC,0x088E,0x2366,0x32B0,0x03DF,0x356F,0x0DA4,
- 0x2627,0x3171,0x1449,0x2947,0x1938,0x27EF,0x06DF,0x30E5,
- 0x1EBB,0x3D3A,0x09C5,0x3821,0x02CB,0x242F,0x0D23,0x2F5A,
- 0x200B,0x06E2,0x235F,0x39FD,0x13D9,0x373B,0x0793,0x17FF,
- 0x3539,0x1E82,0x3C13,0x0C02,0x25BA,0x1A33,0x3D18,0x0B23,
- 0x36BF,0x1C6D,0x2DBF,0x05EF,0x29AB,0x1809,0x02E0,0x3157,
- 0x1FBE,0x1679,0x0A5D,0x2D8F,0x18BD,0x26B4,0x07BF,0x2ADB,
- 0x1C69,0x03CF,0x3699,0x206C,0x07AD,0x22D5,0x2F91,0x022F,
- 0x20AD,0x3B82,0x0726,0x33FA,0x0F96,0x304D,0x1321,0x1F1C,
- 0x3DE9,0x16E5,0x2642,0x1D19,0x3161,0x0FC1,0x33DA,0x1D76,
- 0x3B94,0x08C3,0x1EEE,0x3FA0,0x1B26,0x39F3,0x10AC,0x36D9,
- 0x14A7,0x2483,0x1BA5,0x3245,0x1410,0x2F6D,0x109B,0x33E8,
- 0x2193,0x0C2D,0x2E39,0x07C3,0x2B07,0x0CB5,0x3C55,0x1146,
- 0x23A0,0x0F93,0x2543,0x1C68,0x2DD7,0x11A5,0x2633,0x17E3,
- 0x05CD,0x2461,0x0A42,0x2F1E,0x052D,0x2CCC,0x09D2,0x1B83,
- 0x3CF9,0x128A,0x3365,0x014F,0x1CBD,0x2AF4,0x14A8,0x2C70,
- 0x0457,0x3203,0x196A,0x39CF,0x0F68,0x287D,0x12A5,0x2B44,
- 0x1BFD,0x0A13,0x3A32,0x04A6,0x3F4E,0x0C2E,0x365D,0x106E,
- 0x2BA6,0x0E55,0x29FC,0x2173,0x18D0,0x3553,0x1B9E,0x26CC,
- 0x1216,0x3F1C,0x1AD7,0x026E,0x3088,0x218E,0x1D46,0x2AAD,
- 0x05A3,0x2E24,0x1533,0x20C0,0x390A,0x0729,0x1DE6,0x2A33,
- 0x039B,0x312E,0x0C87,0x3791,0x1165,0x3297,0x22E5,0x0D05,
- 0x39BD,0x23A4,0x354C,0x0FE4,0x3BD8,0x0DE2,0x3370,0x102D,
- 0x241E,0x312B,0x0EDF,0x29BF,0x3974,0x0C1F,0x155F,0x3EE4,
- 0x25F7,0x1127,0x2E12,0x1CBF,0x3E99,0x0979,0x21C2,0x359F,
- 0x012F,0x2C25,0x0BA5,0x3BD3,0x07AA,0x2BE0,0x0C79,0x29DE,
- 0x11FD,0x3356,0x23A7,0x0C49,0x2E98,0x0759,0x2A46,0x0A38,
- 0x2C09,0x06B9,0x3F0C,0x0AD3,0x26C6,0x0320,0x28B8,0x094A,
- 0x2C6A,0x164F,0x2283,0x39DD,0x1255,0x26DE,0x1740,0x32F9,
- 0x049C,0x3E1A,0x0A07,0x393C,0x06B2,0x3694,0x0ADF,0x3119,
- 0x3DD5,0x165A,0x37C4,0x1A63,0x255A,0x143B,0x30E1,0x22F1,
- 0x05FE,0x204E,0x2793,0x15AA,0x3B51,0x0708,0x33D7,0x1760,
- 0x2838,0x0FD4,0x2A13,0x0217,0x2ECE,0x1FC4,0x3F81,0x0629,
- 0x375A,0x23E5,0x10D6,0x2C4B,0x125D,0x2EA0,0x158D,0x26FE,
- 0x041E,0x36ED,0x1B3B,0x0727,0x301B,0x0A4D,0x3B9B,0x004D,
- 0x32ED,0x0A9A,0x212E,0x2B8E,0x1767,0x0C46,0x3B17,0x11C9,
- 0x384B,0x22A6,0x02FE,0x2C30,0x0DB9,0x317B,0x23E9,0x11B2,
- 0x3A64,0x15FB,0x253A,0x1A4F,0x2841,0x0A9C,0x3D89,0x1D8F,
- 0x137B,0x0063,0x1B27,0x289F,0x0532,0x2FF2,0x1A72,0x3AFF,
- 0x0ABC,0x1F60,0x3F6A,0x0015,0x188A,0x284D,0x3397,0x19D4,
- 0x0ADA,0x3589,0x17B2,0x008B,0x2496,0x1ABC,0x2A47,0x0E85,
- 0x2F6E,0x1224,0x349F,0x13DA,0x2531,0x19A0,0x3AD3,0x060F,
- 0x2FAE,0x19DA,0x033E,0x363A,0x1681,0x2752,0x13BB,0x3CF6,
- 0x1D29,0x303C,0x117E,0x2A26,0x1733,0x3BC1,0x122E,0x3658,
- 0x1E67,0x3DD8,0x03C6,0x1B89,0x2EFA,0x00DC,0x2A36,0x0EAD,
- 0x2D58,0x1364,0x319C,0x15A0,0x2AE0,0x19B5,0x2846,0x1475,
- 0x0CE1,0x295F,0x017A,0x2BA3,0x0B6B,0x3ED2,0x0304,0x396D,
- 0x18E9,0x3583,0x091B,0x3094,0x199E,0x2659,0x0F1E,0x3D75,
- 0x0AF3,0x3634,0x1E8A,0x3C03,0x16FE,0x07C4,0x1A2E,0x2D88,
- 0x1675,0x02BD,0x3386,0x1D45,0x251D,0x0164,0x3C58,0x1966,
- 0x2D6E,0x133F,0x24D7,0x3FCB,0x10EF,0x2813,0x144D,0x2D5C,
- 0x22F9,0x1694,0x34DD,0x0F60,0x3D29,0x25EE,0x0152,0x320A,
- 0x0AEB,0x1B61,0x3DAF,0x1426,0x35C4,0x1887,0x0010,0x3031,
- 0x1CF2,0x096D,0x3E10,0x01D1,0x3920,0x1EDE,0x0515,0x291F,
- 0x363B,0x1EFF,0x3F47,0x1268,0x2B4D,0x2025,0x01CE,0x1E74,
- 0x2E1F,0x0659,0x24DA,0x1C30,0x303F,0x13C6,0x0494,0x1FAC,
- 0x2C9D,0x0612,0x26FC,0x3A34,0x0D45,0x3743,0x04F0,0x3C44,
- 0x1DB0,0x26CE,0x044F,0x20A5,0x307D,0x0027,0x240C,0x1F37,
- 0x0EAA,0x3E3C,0x2600,0x1140,0x2CB2,0x04AA,0x3216,0x21DB,
- 0x0101,0x18EF,0x3830,0x0511,0x34F6,0x0DC0,0x2D8E,0x1AFD,
- 0x0616,0x134D,0x2896,0x3529,0x0FDB,0x3F69,0x0B2C,0x382D,
- 0x1E19,0x276D,0x0162,0x240B,0x0BA7,0x3C9A,0x02BA,0x2D11,
- 0x35BC,0x1106,0x3B98,0x1215,0x34B8,0x16D0,0x2806,0x0CB6,
- 0x2B60,0x1386,0x3DDE,0x2119,0x04DC,0x374B,0x1F33,0x0017,
- 0x302A,0x1B97,0x05D6,0x13D4,0x328C,0x1EF0,0x3948,0x0D56,
- 0x26B3,0x3DD6,0x18AF,0x080A,0x3133,0x1F5F,0x0ED5,0x33CE,
- 0x0B5A,0x3A2A,0x01E5,0x1EED,0x3433,0x050F,0x3869,0x1C8A,
- 0x08BB,0x3A6A,0x04BB,0x2F9A,0x0809,0x1BE3,0x2CC3,0x15E6,
- 0x2497,0x2F69,0x0A18,0x297E,0x067A,0x2629,0x3F0B,0x0E7D,
- 0x2BB1,0x2256,0x16FD,0x2D4B,0x104A,0x2428,0x31F3,0x1492,
- 0x0934,0x2C43,0x069B,0x3228,0x0B0F,0x3DBD,0x1833,0x36F3,
- 0x11CF,0x34B1,0x0CFF,0x3868,0x08C1,0x3CC8,0x2395,0x372F,
- 0x0FD6,0x3D58,0x20E7,0x143C,0x2BB0,0x15D5,0x2DE1,0x184A,
- 0x085A,0x37B6,0x1A69,0x3F09,0x0DF7,0x35D1,0x1192,0x38A9,
- 0x293B,0x0A4E,0x205A,0x3965,0x0D07,0x3BE2,0x1A52,0x0BCB,
- 0x3685,0x2619,0x0D3D,0x2CE7,0x19BB,0x254B,0x0018,0x3CD2,
- 0x239C,0x373E,0x17F1,0x0879,0x244F,0x1CEB,0x310D,0x196D,
- 0x0765,0x3BDF,0x18AA,0x360A,0x1F16,0x109A,0x32B4,0x181F,
- 0x0473,0x2379,0x1CB5,0x25E7,0x0651,0x2EA5,0x0FB1,0x31DC,
- 0x1D8C,0x01E2,0x243A,0x0D18,0x2DB8,0x144C,0x2F0E,0x24BA,
- 0x1113,0x2787,0x383B,0x2188,0x09FF,0x294B,0x00E4,0x3484,
- 0x1DA1,0x0A5B,0x2265,0x3B43,0x12E4,0x37A7,0x2393,0x05B2,
- 0x2AB3,0x17B3,0x306B,0x1201,0x2274,0x2E09,0x0E4A,0x2A8F,
- 0x181D,0x26FF,0x1FDC,0x123E,0x226C,0x36F0,0x1064,0x3FD4,
- 0x0539,0x1836,0x3333,0x1EF2,0x3873,0x0F97,0x203B,0x3476,
- 0x0479,0x3622,0x0839,0x1C59,0x33CC,0x0C48,0x194D,0x3854,
- 0x2190,0x17CC,0x3945,0x1BDF,0x2623,0x1501,0x2CFA,0x04DA,
- 0x2892,0x16F1,0x2985,0x12FC,0x2C40,0x2105,0x157C,0x01AD,
- 0x3156,0x1DCB,0x0BC8,0x344B,0x0363,0x283A,0x0B36,0x32B8,
- 0x23A5,0x0F67,0x2955,0x097A,0x2C98,0x1729,0x27E5,0x0481,
- 0x1828,0x31CF,0x0153,0x1B6D,0x2873,0x120D,0x2BB3,0x1DD9,
- 0x2350,0x12A8,0x3D68,0x1D3D,0x08E2,0x3122,0x2129,0x150E,
- 0x1F79,0x0BC5,0x31FA,0x1DC3,0x3AD6,0x058C,0x155D,0x2B74,
- 0x2234,0x14BF,0x2CCB,0x05A5,0x2E8B,0x217E,0x08D6,0x26A0,
- 0x1512,0x38EC,0x0825,0x3371,0x1B56,0x2191,0x3C16,0x0856,
- 0x3521,0x158F,0x2FD2,0x1E0F,0x103A,0x3ACF,0x0A92,0x19F5,
- 0x3C95,0x0B78,0x1621,0x2B11,0x3E64,0x112F,0x2FDF,0x141B,
- 0x2A9E,0x1554,0x2E4F,0x0376,0x2A3E,0x0923,0x1AEF,0x3E0B,
- 0x13FB,0x2840,0x0C2F,0x3BFC,0x07E8,0x1DCD,0x3E7B,0x0305,
- 0x361B,0x0C9D,0x3DEF,0x1A39,0x323D,0x03D7,0x29D0,0x0D2D,
- 0x2781,0x39A9,0x135B,0x0223,0x1BAB,0x2F23,0x07C6,0x1B22,
- 0x2A63,0x12FA,0x3C1D,0x272E,0x0402,0x3FB0,0x2638,0x0169,
- 0x2E33,0x0BF2,0x2437,0x029B,0x3064,0x08E5,0x22BA,0x38FE,
- 0x109F,0x3E5E,0x02F0,0x3615,0x1A2F,0x057C,0x3938,0x1BD1,
- 0x2784,0x06EE,0x2FB9,0x1090,0x3826,0x12A1,0x3F91,0x1C16,
- 0x01AA,0x3AF6,0x151B,0x36C6,0x1C07,0x06EA,0x3D02,0x1CD8,
- 0x373C,0x1000,0x226F,0x3449,0x07DE,0x37A6,0x028F,0x3F4D,
- 0x0897,0x3323,0x0407,0x2812,0x3ACA,0x12F8,0x3488,0x06C2,
- 0x3939,0x27A7,0x01F8,0x2BC4,0x0D1E,0x262B,0x3713,0x0260,
- 0x3A6E,0x09B7,0x1D4F,0x3DA5,0x12B2,0x370C,0x1BCB,0x3F4A,
- 0x315C,0x18FF,0x2E71,0x0DE9,0x3A2D,0x0061,0x1804,0x2A71,
- 0x1FDA,0x3FD2,0x06D9,0x38B2,0x22C8,0x02CC,0x2154,0x3195,
- 0x0490,0x33FF,0x2055,0x0285,0x1CF8,0x24DE,0x094C,0x3CC7,
- 0x056F,0x383D,0x1C87,0x3346,0x0F83,0x2495,0x31E3,0x0D83,
- 0x2F1B,0x03E4,0x32E0,0x1561,0x29FD,0x1394,0x21D9,0x31F9,
- 0x110E,0x2C4F,0x01A4,0x28DE,0x0B4F,0x3BBE,0x1437,0x3569,
- 0x1D78,0x08DC,0x2231,0x3E71,0x2844,0x1262,0x3C83,0x24F4,
- 0x0A60,0x2FDC,0x2080,0x0E8D,0x2EE1,0x201F,0x11EA,0x3AD2,
- 0x1579,0x34C9,0x1222,0x3C6D,0x1747,0x3431,0x0E26,0x1DEB,
- 0x257B,0x0A89,0x2DC1,0x0F00,0x2644,0x31EE,0x110B,0x2B51,
- 0x0E2F,0x3A81,0x231B,0x18EA,0x2194,0x2C68,0x05BD,0x2609,
- 0x2FA2,0x10FD,0x2B7F,0x02E5,0x3117,0x22F8,0x10C2,0x2D45,
- 0x0B62,0x1E8E,0x3C76,0x141F,0x2EF6,0x166B,0x3160,0x17DD,
- 0x2B01,0x0F10,0x2F47,0x160B,0x2045,0x02C0,0x1C8B,0x2AD2,
- 0x100E,0x19A1,0x3E9E,0x162B,0x3290,0x12EE,0x2060,0x2FCE,
- 0x0F6C,0x331E,0x259D,0x0D4D,0x28F9,0x0095,0x2BEE,0x0A25,
- 0x2501,0x024E,0x276F,0x20A6,0x161C,0x235C,0x36AB,0x12CA,
- 0x0424,0x1A3A,0x28BA,0x0BD9,0x3351,0x1B4E,0x3F1B,0x11CC,
- 0x2B89,0x0DE4,0x265D,0x3A5B,0x121B,0x3542,0x1F56,0x0F2B,
- 0x2D21,0x21A2,0x0C47,0x16C2,0x3EFF,0x1DE0,0x003A,0x3935,
- 0x20D4,0x19D8,0x2320,0x38B0,0x00F9,0x3729,0x0B34,0x1EB8,
- 0x254D,0x1900,0x3814,0x0F37,0x2E92,0x1C6C,0x2454,0x0097,
- 0x3098,0x197F,0x2C95,0x1578,0x096A,0x33BD,0x02C6,0x16BA,
- 0x39E9,0x19C8,0x00E9,0x3557,0x1857,0x0732,0x30F2,0x0AE1,
- 0x28DB,0x04A1,0x2A5D,0x1F4E,0x071A,0x2053,0x3B67,0x0112,
- 0x35BD,0x195C,0x2272,0x3BAA,0x0B3A,0x1F20,0x3F21,0x0828,
- 0x332E,0x1EC4,0x0264,0x3E21,0x08CD,0x1AA0,0x38D7,0x1641,
- 0x0A4A,0x3387,0x1C9E,0x24D2,0x0E43,0x392C,0x1F7C,0x021D,
- 0x3250,0x2582,0x051A,0x29F9,0x0A8A,0x24E7,0x0635,0x27CB,
- 0x1350,0x3A7C,0x21B9,0x09BE,0x36A4,0x2485,0x3FD4,0x0993,
- 0x3598,0x23CA,0x0DE6,0x294F,0x04B9,0x3D46,0x0A08,0x1A18,
- 0x29DB,0x1B78,0x03D4,0x353A,0x168A,0x39D4,0x11F2,0x1EC9,
- 0x0F5F,0x37E0,0x0BE5,0x3E75,0x0561,0x2C4A,0x0AE2,0x2E25,
- 0x1E55,0x3136,0x116F,0x2C8D,0x13DE,0x299E,0x0658,0x2855,
- 0x15C3,0x37E3,0x1A7C,0x0884,0x2E9B,0x03EA,0x27EC,0x3739,
- 0x1901,0x01BF,0x3A78,0x2751,0x066F,0x2CD9,0x187A,0x267D,
- 0x08AD,0x3115,0x0D2B,0x1D6E,0x2B94,0x1022,0x3019,0x0571,
- 0x3C2F,0x08A6,0x2160,0x317A,0x16D2,0x0777,0x3964,0x1F5D,
- 0x10C3,0x3B69,0x04D8,0x367B,0x233E,0x1A75,0x215C,0x2C63,
- 0x0FCA,0x31C7,0x258A,0x113D,0x3B93,0x2262,0x1AD2,0x35D5,
- 0x1D86,0x3DFB,0x0F87,0x379B,0x1B37,0x2EF2,0x149E,0x29DA,
- 0x0F46,0x311C,0x0607,0x1CC4,0x3005,0x00BB,0x23F2,0x19B1,
- 0x2586,0x11B0,0x2D8B,0x0EC6,0x28B9,0x33C7,0x0D1C,0x2044,
- 0x3C5B,0x18AE,0x065F,0x3DD3,0x1DA2,0x0819,0x28D1,0x3FD4,
- 0x18E4,0x0DED,0x339D,0x1296,0x3EAB,0x1977,0x39EA,0x0CF0,
- 0x3463,0x016D,0x1C00,0x30E4,0x153E,0x0C5A,0x1719,0x2DE2,
- 0x1BA2,0x0384,0x33C5,0x1384,0x2C5D,0x1143,0x2585,0x38A6,
- 0x06A4,0x3EEC,0x23E7,0x10AA,0x2EFE,0x07DA,0x2275,0x3C46,
- 0x2F5C,0x1E0A,0x309E,0x1038,0x32E9,0x1A9C,0x3D56,0x1530,
- 0x3874,0x095E,0x3B7A,0x00E0,0x3667,0x0E45,0x3903,0x0C5B,
- 0x30F8,0x0158,0x2C6C,0x2219,0x179E,0x3FD4,0x14BD,0x0788,
- 0x22BC,0x3206,0x10B5,0x1BC4,0x35BE,0x1343,0x3CF2,0x1040,
- 0x3610,0x163F,0x3F54,0x0751,0x2361,0x3D0A,0x1616,0x289C,
- 0x150A,0x2D20,0x1AE4,0x0447,0x3EE2,0x292E,0x0E2C,0x31E4,
- 0x251B,0x0B7F,0x291E,0x114B,0x305E,0x0C6D,0x3A96,0x061B,
- 0x36CF,0x0929,0x1BB7,0x2B34,0x0B9F,0x2CCA,0x0288,0x24A2,
- 0x098C,0x18F6,0x2DA8,0x0C7A,0x2910,0x03ED,0x3257,0x09CC,
- 0x3FD4,0x20F8,0x1780,0x2AAF,0x1470,0x3468,0x0D16,0x36C2,
- 0x043C,0x3B56,0x1623,0x365C,0x1BFF,0x0056,0x2F32,0x243F,
- 0x0399,0x286B,0x3574,0x0F23,0x2761,0x327C,0x148A,0x0997,
- 0x21BF,0x3B3B,0x15B0,0x2743,0x0068,0x2A75,0x102F,0x2E6D,
- 0x1628,0x245C,0x3E57,0x0680,0x2859,0x38DB,0x22B1,0x05E6,
- 0x3C6A,0x274D,0x0AF9,0x3B47,0x1D90,0x3617,0x0062,0x17A6,
- 0x2DCB,0x163A,0x095D,0x3AEE,0x207C,0x19F0,0x3464,0x04BD,
- 0x1ABE,0x0782,0x16F2,0x29EE,0x1F0C,0x0946,0x2334,0x0286,
- 0x206B,0x2726,0x18B2,0x2467,0x1C48,0x2FFA,0x197E,0x25C2,
- 0x1DAF,0x3DB7,0x10BC,0x3697,0x0BF7,0x1D4D,0x3309,0x1C13,
- 0x3C4C,0x09C9,0x2522,0x30BB,0x0BB0,0x2ABF,0x04CD,0x2E6F,
- 0x2000,0x028D,0x1F3A,0x2DEC,0x1774,0x03B3,0x33DC,0x0D5F,
- 0x367D,0x10CE,0x3A30,0x22F5,0x119D,0x2069,0x36A8,0x0628,
- 0x1C36,0x2F39,0x1650,0x3D5B,0x014E,0x1E75,0x279F,0x1631,
- 0x23D5,0x1DBA,0x3D35,0x0488,0x3446,0x1646,0x3EC7,0x1405,
- 0x3847,0x26BF,0x0088,0x32A7,0x15F5,0x3D37,0x12A4,0x1E13,
- 0x2510,0x027A,0x386C,0x095A,0x3CAC,0x1041,0x2BDA,0x133C,
- 0x2E83,0x0B9A,0x2708,0x0644,0x2170,0x3BAB,0x1748,0x1021,
- 0x30C1,0x12B3,0x1FF3,0x2E9D,0x00D0,0x2103,0x374F,0x1BD2,
- 0x2EC4,0x03F4,0x2B87,0x0C18,0x35F9,0x1BA1,0x380F,0x0460,
- 0x2961,0x0AC9,0x185E,0x2C5F,0x1A30,0x00EC,0x3196,0x1EE5,
- 0x0E7E,0x16AD,0x2F40,0x1A68,0x0767,0x2306,0x308F,0x1FF5,
- 0x0E4C,0x35D2,0x1CC6,0x26B8,0x01A0,0x2CB1,0x0CDF,0x2926,
- 0x3661,0x202D,0x3CB6,0x0110,0x38CA,0x13ED,0x35C0,0x2B92,
- 0x0E49,0x3268,0x0756,0x3D16,0x0A57,0x2376,0x034F,0x3AE3,
- 0x08D2,0x1899,0x292F,0x04F7,0x30A8,0x260D,0x0090,0x29B5,
- 0x130A,0x2BFA,0x17FE,0x02FB,0x38EA,0x1A28,0x25D3,0x0E0F,
- 0x3AEF,0x1AE3,0x3496,0x09E1,0x3998,0x2233,0x1BB6,0x2E2E,
- 0x0020,0x2736,0x0B01,0x3417,0x1D61,0x01DC,0x2635,0x17DB,
- 0x3E37,0x0358,0x3491,0x0CDE,0x2284,0x377B,0x0DF0,0x3F61,
- 0x0367,0x2E02,0x0D9B,0x27D8,0x1285,0x299C,0x0DC4,0x2ED1,
- 0x06D6,0x1CFF,0x3A46,0x10AB,0x25DA,0x083C,0x2213,0x39E2,
- 0x118E,0x32E6,0x1373,0x2F38,0x1C7E,0x262C,0x072E,0x3DB9,
- 0x2235,0x1B2F,0x316F,0x1403,0x2CA5,0x0C43,0x25B2,0x37EE,
- 0x0A03,0x3EBD,0x0749,0x1A04,0x3A67,0x16BE,0x0576,0x29A2,
- 0x0D65,0x38CD,0x1C5D,0x3039,0x1EF6,0x075D,0x2351,0x14E3,
- 0x3CD8,0x1DA5,0x352D,0x0FED,0x3BDA,0x2159,0x0B99,0x3762,
- 0x2392,0x3316,0x0199,0x283B,0x3953,0x1499,0x0C28,0x3E3E,
- 0x2890,0x0357,0x2B88,0x0FF5,0x3360,0x1338,0x3FD4,0x14A3,
- 0x030A,0x27AD,0x0DC8,0x2DCA,0x1847,0x287A,0x0675,0x1D84,
- 0x37C7,0x163C,0x292B,0x1153,0x3179,0x1754,0x2C0C,0x149C,
- 0x2413,0x3499,0x0D92,0x3BB3,0x20C2,0x1020,0x3B26,0x0CFC,
- 0x3678,0x059B,0x3EB2,0x1D6F,0x23A6,0x0FAE,0x3270,0x1E3D,
- 0x06E5,0x2C78,0x112D,0x28D7,0x0EAC,0x2B41,0x0850,0x2131,
- 0x3F95,0x167D,0x2C08,0x0692,0x2863,0x3CC5,0x0DBB,0x2D47,
- 0x100F,0x2ACC,0x2153,0x1527,0x2D95,0x07B1,0x2B12,0x1892,
- 0x329A,0x14F8,0x3603,0x1768,0x3AF7,0x0634,0x373A,0x21F9,
- 0x16DF,0x2C7C,0x0A97,0x1F97,0x3645,0x19F3,0x2D7E,0x0567,
- 0x2A3A,0x0CBC,0x286D,0x1936,0x038A,0x39B0,0x1FBC,0x15B3,
- 0x0172,0x37A4,0x08A5,0x3FB3,0x19F9,0x3258,0x0540,0x1E12,
- 0x28CF,0x17AB,0x22C0,0x3487,0x0AD4,0x260A,0x3D7A,0x1200,
- 0x34CA,0x229F,0x084D,0x145B,0x3E03,0x1765,0x32A5,0x1FA7,
- 0x08E3,0x2D9B,0x033D,0x26EF,0x0D22,0x2E43,0x1E05,0x1485,
- 0x07D3,0x1FBD,0x3F45,0x0D04,0x1810,0x3440,0x20E9,0x060A,
- 0x1E49,0x37A2,0x0BB8,0x3CE5,0x18BC,0x248B,0x0862,0x2D68,
- 0x3B3C,0x15F4,0x3395,0x1C51,0x0B8E,0x3F70,0x220E,0x0CB1,
- 0x23AA,0x01BB,0x395F,0x1F78,0x04BC,0x3EE9,0x0BD7,0x35D4,
- 0x062C,0x1B72,0x2D89,0x167A,0x0983,0x2F88,0x1865,0x247F,
- 0x1DFD,0x2DF8,0x0DCA,0x29F2,0x0803,0x3B7F,0x0133,0x3754,
- 0x220C,0x182B,0x3E2E,0x01BA,0x35FB,0x130F,0x3B4A,0x18BF,
- 0x0C4E,0x3311,0x1267,0x38C3,0x0FC2,0x1F46,0x32D9,0x0873,
- 0x3906,0x1E21,0x06C4,0x3B31,0x19E4,0x333A,0x116B,0x28A9,
- 0x0B19,0x2689,0x004C,0x2D28,0x0C09,0x2533,0x1EB0,0x01C7,
- 0x33FD,0x0FC5,0x3F29,0x2425,0x02C9,0x3130,0x0DFF,0x36EC,
- 0x1AAF,0x3E38,0x07BC,0x37E6,0x22A4,0x0BE4,0x33DD,0x2A40,
- 0x1D40,0x24E4,0x1837,0x281B,0x02B4,0x206A,0x3CC1,0x14CF,
- 0x32EE,0x020C,0x2CF9,0x1353,0x2AC6,0x1126,0x1EBE,0x3069,
- 0x017C,0x17E1,0x3AA2,0x26B9,0x02F6,0x2C51,0x0C7F,0x3B02,
- 0x25C0,0x125F,0x3923,0x1671,0x3602,0x0508,0x3E1F,0x24B2,
- 0x39C3,0x10B6,0x25AC,0x1CF0,0x2D76,0x02E2,0x2785,0x32B1,
- 0x0DC9,0x21FF,0x30B7,0x1C3E,0x044B,0x3828,0x1FA8,0x10D7,
- 0x0ADC,0x2946,0x0526,0x3A9E,0x20D9,0x03AA,0x3420,0x17C1,
- 0x3D9E,0x1E99,0x0DB0,0x348D,0x2589,0x156B,0x2E6A,0x11CD,
- 0x282D,0x3E5B,0x0226,0x2299,0x3894,0x1C50,0x03C3,0x31F7,
- 0x0A52,0x174C,0x3406,0x1170,0x3022,0x14B1,0x2A48,0x12CC,
- 0x2EDB,0x0BD2,0x24F0,0x2098,0x19F4,0x2FCD,0x049E,0x3132,
- 0x2347,0x02F1,0x27A1,0x1CD4,0x2FBD,0x03F2,0x23E1,0x1A64,
- 0x26F6,0x1244,0x3025,0x23B0,0x0278,0x20DD,0x3C26,0x0570,
- 0x38B7,0x107B,0x3DCD,0x212A,0x1A0F,0x3302,0x1102,0x3CA7,
- 0x1990,0x2774,0x051C,0x1820,0x3912,0x143F,0x2803,0x2007,
- 0x002C,0x1EB4,0x2C24,0x0F92,0x3062,0x1E29,0x1496,0x05E7,
- 0x3B28,0x0C60,0x34D2,0x1160,0x3917,0x0D85,0x2AD7,0x07FC,
- 0x1F8A,0x370F,0x0CDB,0x3B75,0x036B,0x33F4,0x0913,0x2490,
- 0x1CF9,0x2D1D,0x0F8A,0x2088,0x3798,0x1050,0x292A,0x01D2,
- 0x1A93,0x3116,0x0813,0x2A2C,0x107F,0x2930,0x17C8,0x025F,
- 0x1ABD,0x3224,0x04A3,0x37E1,0x0A85,0x3D5F,0x0F25,0x1C81,
- 0x3B9C,0x1590,0x0701,0x2816,0x2E60,0x11AF,0x31FC,0x23FD,
- 0x3079,0x12F2,0x2C0B,0x0FCC,0x25FE,0x2F97,0x0EB7,0x2ABB,
- 0x06F1,0x26DF,0x2F22,0x16E2,0x09D8,0x2A00,0x003B,0x39C0,
- 0x1F53,0x0EE6,0x1E2E,0x3423,0x075B,0x266E,0x3F2F,0x12C3,
- 0x3A52,0x21DD,0x01F1,0x3DD2,0x1B94,0x2415,0x09B9,0x3C99,
- 0x0412,0x350C,0x142D,0x3A58,0x0AC3,0x2604,0x2019,0x0FAB,
- 0x37FA,0x1A46,0x3D94,0x0943,0x1812,0x3BC8,0x146A,0x3738,
- 0x0075,0x3FA4,0x0AFB,0x17B1,0x383A,0x0EF2,0x1C0D,0x2C1E,
- 0x1637,0x3178,0x1BE9,0x0881,0x3975,0x03C4,0x2FA3,0x2321,
- 0x0958,0x30A1,0x1CA4,0x2D1A,0x0D3C,0x2B15,0x08A9,0x3BE8,
- 0x1792,0x3391,0x13EC,0x2682,0x0208,0x3EE3,0x2368,0x310E,
- 0x0FAA,0x298A,0x04BF,0x2E36,0x21F6,0x16D9,0x233D,0x3A10,
- 0x0F35,0x26DA,0x1A86,0x2034,0x2F64,0x186E,0x388D,0x0DC7,
- 0x3F73,0x05D3,0x337F,0x09CA,0x1B06,0x30AF,0x1348,0x34DA,
- 0x23E2,0x0E72,0x3F9D,0x1CEA,0x335D,0x0947,0x3002,0x1F68,
- 0x2CD1,0x0EDC,0x2974,0x114C,0x2B9F,0x22E3,0x16B0,0x2FA9,
- 0x011A,0x2634,0x3971,0x1730,0x099C,0x3DF2,0x0010,0x1CF3,
- 0x0720,0x3EB6,0x1EC3,0x3767,0x0892,0x1BA0,0x39CE,0x13AA,
- 0x3306,0x199F,0x031F,0x3A57,0x2079,0x36E0,0x1AEB,0x238C,
- 0x07D6,0x32DF,0x2747,0x1444,0x2CFE,0x108E,0x2057,0x2ABA,
- 0x06B6,0x2CA1,0x19AD,0x2721,0x053D,0x31CE,0x1EF1,0x157B,
- 0x2B90,0x107D,0x2944,0x0606,0x31B9,0x14F2,0x3D21,0x1DF5,
- 0x07E9,0x2CF8,0x0F05,0x2577,0x3528,0x0C1B,0x2979,0x0EA4,
- 0x2C12,0x13F0,0x3234,0x21A9,0x08AB,0x2307,0x307B,0x0BDF,
- 0x255F,0x0441,0x2ACE,0x223F,0x0F39,0x280F,0x1DAB,0x0E78,
- 0x3AA4,0x14D3,0x359B,0x077A,0x3DEB,0x1E73,0x34EE,0x0DBA,
- 0x2FC1,0x06AC,0x3ACD,0x0B40,0x34BB,0x17D1,0x0924,0x1B8D,
- 0x3642,0x1569,0x3E5F,0x1C3D,0x08EE,0x30F0,0x010E,0x1BCE,
- 0x321D,0x04DF,0x3EFA,0x0A15,0x2514,0x068C,0x2178,0x2DD6,
- 0x1565,0x27F8,0x16D8,0x3C12,0x2209,0x067D,0x3E83,0x1F2E,
- 0x0537,0x2D31,0x1963,0x0030,0x20DF,0x3B78,0x13FE,0x3643,
- 0x0B50,0x3BF5,0x15E9,0x35C6,0x1B81,0x06BF,0x3AC6,0x0B2B,
- 0x2ABD,0x1A47,0x0D00,0x34BA,0x1DA6,0x24C7,0x193E,0x369E,
- 0x2995,0x1AEA,0x0207,0x166A,0x327F,0x2380,0x0080,0x28F2,
- 0x0A6C,0x3C2A,0x1D4E,0x24C4,0x1328,0x05C0,0x3212,0x0D72,
- 0x3BF3,0x19E0,0x0433,0x3CF5,0x0AE6,0x3614,0x00E1,0x1AB6,
- 0x36D0,0x0CC4,0x396A,0x152E,0x359C,0x0E44,0x384D,0x256F,
- 0x08CF,0x3FD4,0x1E87,0x36AD,0x0DDB,0x2AD0,0x00DB,0x2E9C,
- 0x2253,0x1618,0x3361,0x0163,0x20B1,0x2E58,0x0625,0x3441,
- 0x1CB3,0x25D2,0x0471,0x3C71,0x1B35,0x35A4,0x0100,0x3E80,
- 0x1490,0x37F0,0x124F,0x362B,0x178C,0x3FD4,0x060B,0x2C0D,
- 0x20B3,0x00C9,0x1F7D,0x299F,0x167B,0x022C,0x1B7D,0x26FB,
- 0x126E,0x29F3,0x2090,0x2EA8,0x1130,0x2A61,0x1F5B,0x2DAD,
- 0x007B,0x2798,0x0E21,0x2477,0x3772,0x107E,0x3DDB,0x25D4,
- 0x130D,0x29ED,0x1626,0x314C,0x1438,0x3D49,0x1B4F,0x026D,
- 0x35A7,0x0B0D,0x2A92,0x0099,0x2F67,0x193A,0x2550,0x0B5D,
- 0x3978,0x113C,0x3692,0x233F,0x156D,0x2418,0x05A7,0x1E5F,
- 0x28AB,0x0716,0x2538,0x0085,0x2ED6,0x2189,0x1960,0x3198,
- 0x104B,0x3F28,0x22E6,0x02A5,0x3125,0x0DF8,0x2C83,0x11FC,
- 0x0A3A,0x33F2,0x1FAD,0x2CF0,0x0E16,0x18D9,0x3E94,0x15F9,
- 0x2B6B,0x1055,0x30BA,0x0826,0x3F9C,0x27A3,0x1664,0x2AA1,
- 0x1253,0x2466,0x304A,0x117B,0x290B,0x159E,0x24EC,0x315A,
- 0x11E1,0x288F,0x1F2B,0x0851,0x2043,0x2E19,0x0055,0x1A6C,
- 0x2F27,0x1787,0x027F,0x1B5C,0x281E,0x12A7,0x33B7,0x0CCF,
- 0x39F9,0x0547,0x1C74,0x3F0F,0x102E,0x1AE1,0x3AC2,0x186A,
- 0x0905,0x2F3E,0x1EDC,0x0F58,0x2E0E,0x12E0,0x2987,0x18D1,
- 0x283C,0x0D3E,0x2DBA,0x0209,0x3097,0x0C4F,0x3382,0x114A,
- 0x3734,0x1A6F,0x3CE7,0x0A79,0x32CE,0x2030,0x2EEF,0x04E8,
- 0x3F97,0x1B01,0x0324,0x18F4,0x3D15,0x0478,0x38A4,0x1334,
- 0x3B83,0x1706,0x2F71,0x03B9,0x1A7F,0x2C90,0x17DE,0x0AEE,
- 0x3845,0x0DFE,0x3662,0x0010,0x2C2D,0x0E95,0x3201,0x267B,
- 0x11A8,0x3AEC,0x13CB,0x32C5,0x0F6B,0x2C18,0x0E42,0x31A3,
- 0x1D50,0x2A82,0x06ED,0x31DA,0x0A48,0x3818,0x1B9A,0x3D7E,
- 0x120C,0x34A9,0x184F,0x3FC3,0x0D9E,0x38BC,0x03E7,0x202E,
- 0x357C,0x0639,0x2EAA,0x1F59,0x13DD,0x391B,0x054D,0x3BE4,
- 0x2843,0x1339,0x3B52,0x06B1,0x37F9,0x2783,0x0BFF,0x33B6,
- 0x0513,0x3722,0x1506,0x2D23,0x1CB7,0x0AEA,0x3904,0x02C7,
- 0x2EEB,0x0B93,0x1FDB,0x3752,0x06C8,0x3A0F,0x1C19,0x08F6,
- 0x3D60,0x02DA,0x3493,0x1932,0x3EDB,0x0FD3,0x2259,0x3B54,
- 0x0EFF,0x3497,0x1F92,0x3919,0x0763,0x3E74,0x1CEE,0x2714,
- 0x1741,0x2311,0x2B5C,0x09B0,0x3047,0x2458,0x02CD,0x2768,
- 0x3E25,0x0E10,0x3794,0x24AC,0x06FA,0x3A1C,0x0A7A,0x341D,
- 0x0516,0x3A71,0x1B54,0x1FE5,0x242E,0x195E,0x2632,0x1E92,
- 0x0834,0x2D8A,0x0F88,0x274B,0x13BC,0x39B9,0x1046,0x35EF,
- 0x0AFA,0x31C2,0x1F1F,0x2CDE,0x0E59,0x2702,0x103C,0x2B65,
- 0x06DA,0x3376,0x0CE9,0x3C86,0x21BB,0x0622,0x354E,0x20C7,
- 0x032C,0x2DC8,0x1D80,0x23C4,0x19A4,0x399E,0x073B,0x200F,
- 0x2B77,0x04CA,0x2432,0x1DB8,0x36F5,0x0443,0x3CFD,0x1831,
- 0x027D,0x2187,0x3C8D,0x1752,0x2B09,0x0F81,0x2E1A,0x01FA,
- 0x29BC,0x0D1F,0x2B3D,0x12F6,0x286F,0x161E,0x2C3A,0x11DB,
- 0x258C,0x1D69,0x0EB4,0x3C6F,0x27E4,0x0B56,0x25BE,0x17E9,
- 0x036E,0x2EEE,0x0C9F,0x2562,0x1E79,0x0418,0x300D,0x1B44,
- 0x23E4,0x0D13,0x2663,0x0142,0x344C,0x13F3,0x223B,0x3345,
- 0x153C,0x3E11,0x01AB,0x1B79,0x2B50,0x0EF8,0x2E37,0x21C8,
- 0x182C,0x2D41,0x0D94,0x2AF9,0x0497,0x1D64,0x2C2C,0x0A0A,
- 0x28D9,0x05C7,0x29FF,0x0C82,0x2D29,0x197B,0x038E,0x361D,
- 0x0A58,0x3B9F,0x1456,0x36FB,0x1F00,0x11E7,0x3930,0x137D,
- 0x1F8B,0x3141,0x01C1,0x1A0B,0x2BBC,0x1683,0x266B,0x1357,
- 0x2C89,0x21BD,0x0865,0x3D4B,0x0A43,0x36B9,0x02FC,0x3E28,
- 0x2264,0x172A,0x3839,0x037D,0x2BC7,0x0704,0x24C2,0x16EA,
- 0x2A9C,0x1462,0x3A3E,0x0792,0x36B8,0x1B51,0x32A3,0x0B38,
- 0x24F7,0x19B6,0x29D1,0x13B3,0x3185,0x1E07,0x0FC7,0x2945,
- 0x3AAA,0x1550,0x0845,0x3CB1,0x0C6E,0x2591,0x1E2C,0x0BBB,
- 0x3472,0x1A01,0x3EA4,0x079D,0x1B53,0x2A05,0x1383,0x271E,
- 0x3A4F,0x14E6,0x097B,0x2F99,0x0388,0x2778,0x13B6,0x3263,
- 0x1AA1,0x3A33,0x046F,0x33D2,0x084C,0x36E6,0x0A45,0x3E07,
- 0x01B3,0x338F,0x2260,0x07AE,0x1C83,0x36C5,0x14C1,0x32BD,
- 0x3D23,0x22BF,0x1906,0x35CA,0x1179,0x3BBD,0x2166,0x0FE5,
- 0x3DCE,0x1C38,0x3879,0x172F,0x20E2,0x3CE8,0x0893,0x1D1E,
- 0x28A4,0x0F91,0x31B7,0x23E6,0x1474,0x3FBA,0x0391,0x33B1,
- 0x0A9B,0x1CE8,0x39D0,0x122B,0x2693,0x3AA3,0x12DE,0x3693,
- 0x158A,0x3D91,0x115F,0x32C1,0x13DF,0x2486,0x314E,0x11AA,
- 0x2CD8,0x1BEE,0x025E,0x25ED,0x071F,0x3277,0x0B08,0x2DB0,
- 0x05BC,0x23EC,0x1CE7,0x3D8B,0x10FC,0x34FB,0x0329,0x3F25,
- 0x1E63,0x11A9,0x2F0A,0x15B7,0x29C2,0x13A1,0x2E96,0x0D08,
- 0x31CD,0x0589,0x1D59,0x323B,0x17F7,0x3C49,0x0C05,0x332D,
- 0x00FD,0x25CC,0x0CA5,0x29A9,0x1E45,0x0190,0x1FCE,0x3F66,
- 0x14D6,0x35E8,0x023F,0x39D2,0x09E8,0x2676,0x3F3F,0x0C0D,
- 0x1AFE,0x2730,0x34ED,0x1044,0x2FB1,0x03F8,0x2A3B,0x380D,
- 0x12F5,0x282E,0x0CEE,0x21D1,0x39C9,0x10BD,0x3419,0x0A65,
- 0x1C31,0x3126,0x2478,0x1060,0x3F07,0x0C72,0x38D8,0x230D,
- 0x0AE8,0x1FCF,0x26E9,0x19AE,0x23CE,0x1C08,0x2E80,0x14EF,
- 0x2936,0x1377,0x3AAF,0x1617,0x300A,0x00FF,0x2B39,0x0D42,
- 0x1B5E,0x089E,0x31C6,0x015A,0x2B95,0x19F8,0x0930,0x2CCD,
- 0x0254,0x29E4,0x09A8,0x2FDB,0x0584,0x2A06,0x18E5,0x367E,
- 0x04B1,0x3A31,0x2099,0x060E,0x34F7,0x0BE2,0x2790,0x16F7,
- 0x3BB1,0x253D,0x0179,0x3110,0x1EA4,0x07C5,0x2D9E,0x0301,
- 0x23C6,0x1ACF,0x26D5,0x0185,0x3C07,0x08B0,0x1EBF,0x38C7,
- 0x06A1,0x218D,0x3398,0x16B6,0x3EB3,0x156A,0x28F3,0x176D,
- 0x3606,0x1094,0x322C,0x0646,0x28D5,0x0C77,0x2D6A,0x22AC,
- 0x0939,0x38D2,0x0156,0x354A,0x0660,0x3BE9,0x168D,0x278E,
- 0x12B4,0x39FA,0x24EE,0x0EBF,0x28CA,0x1206,0x2DDB,0x1CCB,
- 0x3D67,0x10D2,0x3495,0x15F3,0x3C10,0x141E,0x2C75,0x0520,
- 0x290C,0x0C40,0x27F6,0x11C1,0x2E0B,0x1888,0x014A,0x2286,
- 0x3075,0x058A,0x193D,0x2B1C,0x137C,0x3FD4,0x15FC,0x2296,
- 0x011D,0x326A,0x186D,0x2E3C,0x0B4E,0x28C4,0x0160,0x24F2,
- 0x375B,0x0578,0x1AFA,0x3541,0x1672,0x2BCF,0x1BEF,0x04E3,
- 0x3E6E,0x1452,0x3683,0x0CC7,0x3D36,0x0309,0x21CD,0x39A0,
- 0x0C45,0x2DFC,0x0486,0x26D8,0x1979,0x3F63,0x122A,0x28E1,
- 0x3862,0x20F0,0x10C6,0x3FD4,0x0E03,0x250A,0x3A27,0x147C,
- 0x35E5,0x1274,0x3B2B,0x1A6A,0x25D7,0x0E3D,0x30D0,0x1368,
- 0x2BE6,0x1A9B,0x0CA0,0x2E15,0x194F,0x29F5,0x12B7,0x3091,
- 0x065D,0x1528,0x3601,0x221F,0x10FE,0x3381,0x14A0,0x1F4B,
- 0x341F,0x0877,0x3981,0x204D,0x17D6,0x2F1C,0x0F3B,0x2658,
- 0x18FD,0x3CDF,0x0FE0,0x2A83,0x0D30,0x2ECB,0x00C1,0x3BBF,
- 0x0CF6,0x2A8C,0x15CA,0x38A1,0x17F4,0x3B72,0x1B45,0x1005,
- 0x31B6,0x1746,0x2854,0x1A8D,0x2537,0x0BA4,0x2BB9,0x006B,
- 0x2E0C,0x1AE7,0x091D,0x3F0D,0x0196,0x353C,0x1A3D,0x05CA,
- 0x22CE,0x2F29,0x0444,0x27C8,0x0A35,0x30C9,0x18C1,0x37F5,
- 0x0F4A,0x3D70,0x1F89,0x34AF,0x0505,0x38B1,0x1F6B,0x3635,
- 0x116E,0x3C01,0x2484,0x01C6,0x32B6,0x1CAA,0x08CB,0x3B03,
- 0x2061,0x1523,0x3D38,0x0362,0x3604,0x1454,0x3F65,0x18B6,
- 0x0DA7,0x2151,0x2D08,0x00CA,0x26A2,0x07F4,0x33CA,0x21F0,
- 0x0E2B,0x3167,0x010C,0x2D17,0x116D,0x2A79,0x1891,0x0689,
- 0x32EB,0x0FA5,0x202C,0x3556,0x09AE,0x219E,0x3465,0x04EC,
- 0x0F21,0x2AAC,0x17BC,0x21F5,0x2F8A,0x0598,0x1C6E,0x30A4,
- 0x073A,0x1F3C,0x237A,0x0F8E,0x3253,0x1EF7,0x00AD,0x3F42,
- 0x0A23,0x265C,0x37D3,0x1316,0x3C7C,0x0010,0x3898,0x0D60,
- 0x204A,0x2BD8,0x1A1D,0x0568,0x3C7A,0x0B98,0x25E5,0x3F52,
- 0x0D7C,0x2BF2,0x155B,0x3205,0x0D0D,0x22C7,0x3F6E,0x0049,
- 0x2C33,0x0AAA,0x284A,0x0456,0x388E,0x2341,0x19B4,0x21ED,
- 0x2FE1,0x03B1,0x27E2,0x0AB0,0x259F,0x0010,0x302F,0x2035,
- 0x0556,0x3C7D,0x0DD8,0x33D0,0x120A,0x3851,0x1D06,0x3ADB,
- 0x0E3F,0x34CB,0x23B2,0x14C4,0x2B2B,0x0AB8,0x2643,0x391E,
- 0x13E2,0x1E8C,0x3EBB,0x122F,0x3870,0x21B0,0x0764,0x234C,
- 0x3042,0x1AA5,0x0801,0x1789,0x2BBA,0x2344,0x150D,0x069C,
- 0x2C41,0x0AC1,0x1E94,0x3905,0x0EB2,0x26C9,0x30B2,0x0DD9,
- 0x2C5B,0x06FF,0x25CE,0x1FDE,0x1A3E,0x2C85,0x0C38,0x3009,
- 0x1D2C,0x3D95,0x11B1,0x3842,0x1359,0x3B4F,0x0FA6,0x2F4B,
- 0x1A3C,0x2066,0x25C3,0x17CF,0x3AF0,0x09D4,0x34EC,0x1DD1,
- 0x24FE,0x1A0C,0x3CB9,0x1311,0x2FA5,0x10EE,0x1E1C,0x2D79,
- 0x3DA3,0x02D9,0x36FD,0x0787,0x1526,0x3897,0x2696,0x114D,
- 0x2885,0x3500,0x0360,0x3E48,0x07E4,0x378F,0x240F,0x1109,
- 0x2E90,0x1CE4,0x02DD,0x24E9,0x0F55,0x2D65,0x1654,0x24AB,
- 0x3E7C,0x0926,0x37FF,0x270E,0x16C0,0x2F90,0x00B1,0x18B7,
- 0x30BF,0x1C2F,0x03DD,0x2500,0x37D2,0x058F,0x1CA7,0x33E9,
- 0x12F4,0x35A9,0x14BA,0x30ED,0x1D70,0x083B,0x31E8,0x09A3,
- 0x1DC7,0x3FD4,0x1276,0x365E,0x13E9,0x2B2F,0x0EB3,0x34AC,
- 0x24D1,0x1432,0x2A4D,0x03E0,0x2D2B,0x1902,0x07B2,0x20C1,
- 0x2880,0x0430,0x1DBC,0x366A,0x1098,0x3B74,0x2068,0x0D81,
- 0x2C48,0x0838,0x2212,0x2DA5,0x02AA,0x1BBE,0x3673,0x1634,
- 0x00B6,0x2CBE,0x1E6D,0x3BB7,0x12DC,0x09AA,0x3E79,0x284C,
- 0x1669,0x33E0,0x1229,0x2229,0x2E59,0x0546,0x1B76,0x3594,
- 0x163D,0x3896,0x0F95,0x3342,0x0664,0x2332,0x3921,0x03C8,
- 0x2992,0x0734,0x27F7,0x0AA8,0x2DED,0x1D8A,0x2A3F,0x029D,
- 0x3C2C,0x0A22,0x3768,0x0742,0x1CC3,0x2FC5,0x12AC,0x3EE7,
- 0x005E,0x3109,0x081D,0x2A74,0x024D,0x3A4D,0x08F0,0x22A0,
- 0x0C30,0x315D,0x1ADB,0x236D,0x3247,0x186B,0x0040,0x3EC4,
- 0x0A0F,0x19BF,0x2DDC,0x1666,0x2AEC,0x13D1,0x1DF6,0x3564,
- 0x0766,0x3AC7,0x17D9,0x3385,0x212D,0x0A63,0x365A,0x03F7,
- 0x13FF,0x2DDA,0x1E2A,0x1054,0x2A20,0x0EC7,0x38E7,0x2453,
- 0x06E3,0x3ABE,0x212B,0x0B3F,0x1DC1,0x3052,0x0E98,0x2777,
- 0x1FD8,0x07BE,0x3AF1,0x2113,0x10F4,0x3DA4,0x1643,0x382A,
- 0x0FB3,0x227C,0x2C65,0x073D,0x30FD,0x1CA5,0x3DFD,0x0A14,
- 0x1E10,0x375D,0x0B29,0x3F8F,0x0FA0,0x267E,0x363C,0x10D1,
- 0x3E97,0x184B,0x2FF0,0x071B,0x28FD,0x198D,0x0319,0x3783,
- 0x11AD,0x33CF,0x1956,0x0CC0,0x34EA,0x2948,0x09B8,0x207A,
- 0x3A69,0x0D14,0x32CC,0x0364,0x2126,0x31C1,0x1FE0,0x0DA1,
- 0x2FE0,0x037A,0x3DBF,0x0872,0x1751,0x3C52,0x2396,0x02B1,
- 0x28D6,0x0AD1,0x2DEF,0x1720,0x3C45,0x1032,0x1E02,0x322F,
- 0x128C,0x2F01,0x15D0,0x3490,0x2295,0x0618,0x18F1,0x34FD,
- 0x15AD,0x2B0F,0x1257,0x30D9,0x249F,0x0404,0x288A,0x0D29,
- 0x2C11,0x16EF,0x378D,0x2087,0x1A7E,0x2369,0x33B5,0x176A,
- 0x1CBA,0x2753,0x101C,0x3ADD,0x0B47,0x215E,0x2C88,0x15E2,
- 0x2447,0x3999,0x0EA2,0x2725,0x0CD3,0x3B7D,0x043E,0x2852,
- 0x20DB,0x0D80,0x28F6,0x063A,0x3F02,0x19EB,0x27D0,0x1C63,
- 0x343F,0x22E8,0x0252,0x3DA8,0x0781,0x34CF,0x1EB6,0x134B,
- 0x2B47,0x108B,0x2861,0x3DDF,0x121A,0x225D,0x3A4B,0x032A,
- 0x2E95,0x1A42,0x2506,0x01B7,0x2BA9,0x1F24,0x04CE,0x2029,
- 0x2DEE,0x0230,0x1AA6,0x3A74,0x16FF,0x0480,0x2326,0x2EB2,
- 0x028C,0x28B4,0x1B70,0x2186,0x30EB,0x020B,0x1BB5,0x31FE,
- 0x0B0B,0x25A2,0x154C,0x3CBA,0x0E8E,0x3313,0x2338,0x1C5C,
- 0x3067,0x0023,0x3B41,0x2584,0x174A,0x0EEA,0x3D2C,0x26A6,
- 0x1124,0x2A1A,0x13C0,0x2610,0x3833,0x1598,0x0039,0x39E4,
- 0x2100,0x19B2,0x2771,0x1D5A,0x2F80,0x0D78,0x1916,0x3701,
- 0x1411,0x3E0C,0x1C7B,0x005C,0x2958,0x2089,0x08E0,0x22D0,
- 0x37D0,0x0D6F,0x3BB6,0x0316,0x170E,0x3FD4,0x2656,0x0B32,
- 0x28A7,0x0564,0x3DAD,0x1E61,0x0ED1,0x345F,0x1409,0x3925,
- 0x1D38,0x0BC3,0x268B,0x0DC5,0x3E55,0x0609,0x14B9,0x2C82,
- 0x3BFA,0x084E,0x2EBB,0x03D8,0x1DB1,0x3CAE,0x106D,0x3620,
- 0x04E5,0x1C1B,0x3204,0x01E3,0x2C6E,0x1811,0x3082,0x1265,
- 0x3D9C,0x1653,0x2F98,0x1FB7,0x14D7,0x2ABE,0x06FC,0x3A90,
- 0x09EC,0x1870,0x316E,0x15A3,0x2C44,0x21AA,0x0350,0x3CCA,
- 0x0BF0,0x3714,0x198A,0x01D3,0x2D5F,0x090F,0x1895,0x34C3,
- 0x125B,0x3E5D,0x0F8D,0x2FB7,0x0DF9,0x3330,0x19E9,0x3567,
- 0x0E67,0x3CA8,0x26A3,0x0966,0x2908,0x37F2,0x0D52,0x188B,
- 0x3C0C,0x1088,0x357F,0x06E7,0x1668,0x3B10,0x22E4,0x05A2,
- 0x1FEC,0x38F9,0x012C,0x1C78,0x2BEB,0x0577,0x3FD4,0x0963,
- 0x151A,0x282C,0x1DF9,0x0617,0x3983,0x22A9,0x03B5,0x191D,
- 0x35C5,0x055C,0x3FBF,0x1B1C,0x08A0,0x2DB2,0x1C9F,0x257A,
- 0x078D,0x37A0,0x0BCE,0x34F2,0x00B3,0x24D6,0x3169,0x0965,
- 0x2A90,0x05B0,0x2459,0x3560,0x0E3B,0x3A44,0x2B2D,0x1538,
- 0x01AC,0x261F,0x1AB9,0x2149,0x3092,0x0F3D,0x200A,0x3954,
- 0x1137,0x3393,0x2220,0x01DE,0x39E3,0x19D3,0x2E5C,0x0657,
- 0x2474,0x3C23,0x03A9,0x2D90,0x15C8,0x2829,0x3672,0x00A9,
- 0x12CB,0x3288,0x1473,0x20CE,0x30E0,0x068F,0x2919,0x0C63,
- 0x2E70,0x222D,0x0B3B,0x3D0C,0x115E,0x36D4,0x0BAE,0x2535,
- 0x0151,0x3320,0x098E,0x394E,0x0235,0x3283,0x1F3B,0x11EE,
- 0x2EC3,0x20A0,0x0E37,0x37BA,0x0C75,0x1B0B,0x321B,0x1710,
- 0x2F1F,0x054E,0x2012,0x3581,0x15BB,0x3C33,0x25F6,0x0BD5,
- 0x2AC7,0x0685,0x35FA,0x1B85,0x3A5D,0x0A2A,0x288C,0x0785,
- 0x24E2,0x1EA3,0x10CC,0x32F5,0x1F9D,0x1184,0x2114,0x3284,
- 0x0BED,0x271D,0x1978,0x2258,0x2B20,0x0980,0x2E2F,0x17B4,
- 0x2A7A,0x101F,0x3104,0x26A9,0x1129,0x2F7F,0x174B,0x2A0A,
- 0x20EB,0x3DB5,0x0BF4,0x2B8A,0x1061,0x2E2A,0x1D4C,0x3135,
- 0x0BC1,0x2D3D,0x0FAC,0x23D7,0x3462,0x0E87,0x3DE8,0x0FFA,
- 0x3155,0x130C,0x2AC4,0x16A5,0x3EF3,0x11CE,0x1F50,0x3B45,
- 0x19EA,0x320C,0x10E7,0x1EC0,0x2707,0x0487,0x1BB3,0x3EAC,
- 0x1CFC,0x3413,0x0843,0x2BB2,0x09BC,0x32FA,0x001B,0x1B3F,
- 0x2E9F,0x0932,0x1736,0x2C07,0x205D,0x098F,0x1F22,0x36EE,
- 0x10B1,0x1B1D,0x3328,0x1017,0x38E4,0x095C,0x1F86,0x252D,
- 0x1E38,0x0B8D,0x3F0A,0x26EA,0x0D87,0x37EF,0x1EB1,0x3405,
- 0x11C3,0x3ABD,0x1725,0x2052,0x27B4,0x0550,0x1F95,0x38D1,
- 0x1B84,0x2389,0x18C9,0x2739,0x1DE1,0x0F20,0x3D51,0x261B,
- 0x0107,0x3BE6,0x2824,0x049D,0x2599,0x3EC6,0x0F5C,0x28B0,
- 0x145F,0x23F7,0x311B,0x0CC5,0x290F,0x0608,0x2077,0x3294,
- 0x15D2,0x289E,0x1EE1,0x037B,0x236E,0x141D,0x3F43,0x17E8,
- 0x38D0,0x042B,0x3687,0x192C,0x0145,0x3ED1,0x29E3,0x04EE,
- 0x1E3E,0x3957,0x00B0,0x3E52,0x0D98,0x35C9,0x141A,0x3D9F,
- 0x0C1C,0x36AC,0x1F85,0x09A4,0x3A5A,0x2291,0x0D27,0x395B,
- 0x0406,0x1344,0x32FD,0x1FB5,0x3619,0x096C,0x3EC2,0x1460,
- 0x2727,0x1B9B,0x377F,0x020D,0x184C,0x2924,0x04D3,0x2C16,
- 0x1A84,0x3B8E,0x0575,0x286E,0x0A40,0x2D3A,0x041B,0x2636,
- 0x0CA6,0x20E4,0x3FAD,0x0818,0x372E,0x17B9,0x3281,0x0B18,
- 0x2FA6,0x100B,0x3D5A,0x1987,0x387E,0x1687,0x22D8,0x3E17,
- 0x13C4,0x254F,0x37C0,0x0E30,0x3F77,0x151D,0x2AB2,0x0139,
- 0x2CF2,0x21DE,0x087E,0x2712,0x1D08,0x3207,0x0E3E,0x3963,
- 0x2CD4,0x227B,0x0267,0x1930,0x2C15,0x16CA,0x0177,0x1A14,
- 0x2865,0x0339,0x2D07,0x0835,0x33A1,0x197C,0x2FE4,0x0FEF,
- 0x2AD6,0x0C8B,0x3C36,0x0531,0x3723,0x2237,0x07DC,0x17F9,
- 0x351F,0x0B81,0x1980,0x33BA,0x1D6A,0x086E,0x2E07,0x0064,
- 0x331D,0x0A10,0x1AC8,0x3FD4,0x137F,0x3848,0x1A98,0x00F0,
- 0x3A02,0x0A8B,0x3380,0x169E,0x2EBC,0x20E6,0x0092,0x307A,
- 0x1545,0x2D48,0x0C2B,0x278A,0x31D0,0x0AF5,0x15AB,0x3474,
- 0x2469,0x130E,0x316C,0x154B,0x2F7C,0x20B9,0x02B8,0x23F4,
- 0x2C94,0x0477,0x18CC,0x344E,0x1606,0x01F6,0x3199,0x1A17,
- 0x2375,0x2E61,0x187C,0x0233,0x1682,0x29DF,0x1C55,0x0138,
- 0x393D,0x08FE,0x24F3,0x1DF8,0x3B14,0x1250,0x36AA,0x1E39,
- 0x029C,0x2202,0x3030,0x10C1,0x332B,0x1461,0x3968,0x15FF,
- 0x35FD,0x0200,0x281A,0x1D96,0x0EEC,0x2D86,0x1397,0x293C,
- 0x05D1,0x1F73,0x2438,0x042E,0x272A,0x0B69,0x2D51,0x0795,
- 0x2A73,0x036F,0x1BC0,0x302E,0x0498,0x32BF,0x177E,0x3D09,
- 0x0E5A,0x35E9,0x1823,0x3FB5,0x01EB,0x19A2,0x2977,0x04C8,
- 0x0F5A,0x37A3,0x1C79,0x3550,0x0747,0x3A2C,0x1F98,0x3F80,
- 0x0A80,0x3675,0x1BD6,0x3DE4,0x1548,0x25E4,0x08ED,0x3FD4,
- 0x03B8,0x33CB,0x1482,0x2EF5,0x0BD8,0x31A9,0x1C98,0x2A50,
- 0x1132,0x3083,0x242B,0x1027,0x398E,0x168B,0x21F2,0x37F6,
- 0x1164,0x3B19,0x252A,0x0294,0x2CF6,0x0AB3,0x300F,0x24B8,
- 0x1489,0x2C84,0x1029,0x3C68,0x081A,0x3700,0x1B0F,0x2557,
- 0x0896,0x1C3A,0x3D82,0x2141,0x0FEB,0x201B,0x3B46,0x1A5F,
- 0x07CD,0x2C37,0x0A83,0x29A5,0x061E,0x1BD4,0x396E,0x19C5,
- 0x0DF6,0x3B6F,0x2363,0x075C,0x214D,0x3E3F,0x1E40,0x07C9,
- 0x3737,0x09ED,0x38AC,0x1EF5,0x3BC7,0x073F,0x3273,0x21E1,
- 0x17BF,0x2F48,0x0DFD,0x321A,0x06BC,0x2CB8,0x0A69,0x2655,
- 0x34B7,0x17ED,0x0928,0x3858,0x1BF6,0x23F1,0x07D7,0x2C38,
- 0x0FF6,0x30AC,0x1336,0x38CE,0x24AA,0x0270,0x3CAA,0x0E1A,
- 0x39B3,0x2A18,0x1412,0x35A2,0x121E,0x3B81,0x1D0A,0x361E,
- 0x1081,0x3C02,0x23F6,0x0CE6,0x2950,0x1FE8,0x07D4,0x1E9E,
- 0x28E0,0x04FF,0x2F41,0x142C,0x22C4,0x3591,0x10DE,0x3D72,
- 0x25DF,0x0810,0x2DE0,0x148D,0x29F4,0x123F,0x2E34,0x0F12,
- 0x2B7E,0x21AC,0x0DA3,0x2421,0x00A0,0x3A20,0x209A,0x1A55,
- 0x2CEA,0x10D4,0x2888,0x1739,0x2B73,0x132F,0x39ED,0x039C,
- 0x3F93,0x1FF6,0x0611,0x2BAD,0x028A,0x303A,0x0955,0x1CC0,
- 0x2952,0x0643,0x1F6A,0x29B3,0x17C3,0x3680,0x1E1A,0x0E23,
- 0x3EED,0x0591,0x25AD,0x1D10,0x2AEA,0x0DB6,0x320E,0x10BB,
- 0x3B32,0x2A76,0x147A,0x05DE,0x3996,0x296D,0x0331,0x25A3,
- 0x378B,0x1163,0x3D12,0x16B1,0x33A5,0x2386,0x0949,0x21B6,
- 0x2FD8,0x1305,0x325E,0x1B04,0x2A34,0x0FB0,0x2DB9,0x1594,
- 0x2797,0x1D7B,0x0E97,0x2D27,0x136F,0x27E7,0x1014,0x3CA5,
- 0x0630,0x22DE,0x3E24,0x1484,0x277E,0x1997,0x3CF7,0x1602,
- 0x0D28,0x3F8C,0x1DB6,0x2542,0x015B,0x3D3F,0x1AF2,0x216C,
- 0x3BC9,0x0A55,0x2A70,0x06CC,0x1F13,0x3396,0x18C3,0x23CD,
- 0x1E5D,0x0102,0x2EB1,0x0CF3,0x2C74,0x188E,0x0248,0x208B,
- 0x2FD5,0x08D5,0x1849,0x3841,0x1210,0x3B59,0x1B3A,0x347F,
- 0x1299,0x3ACC,0x2122,0x0A1E,0x2BCC,0x06D1,0x2E7E,0x17EE,
- 0x3121,0x1F41,0x0ECB,0x3E66,0x0BDB,0x261D,0x0474,0x348A,
- 0x1B1F,0x067C,0x316B,0x176B,0x2FC3,0x13B2,0x3498,0x0E62,
- 0x22B4,0x3878,0x0791,0x3E20,0x0054,0x2571,0x0D7E,0x2CC8,
- 0x0A99,0x1B34,0x36D5,0x13A3,0x3DB1,0x231D,0x1A35,0x3C3F,
- 0x14CC,0x3507,0x0FDD,0x39E1,0x07EC,0x2352,0x03B6,0x3445,
- 0x2106,0x19C3,0x38AA,0x023A,0x1801,0x3DF0,0x0536,0x28DC,
- 0x1DA8,0x0280,0x22C2,0x339B,0x1835,0x0CA8,0x3013,0x0EA9,
- 0x1EE3,0x2F3C,0x01B8,0x276E,0x0E33,0x374A,0x149B,0x3F20,
- 0x0058,0x2AB4,0x0A86,0x3CF0,0x0342,0x3823,0x0B4B,0x352F,
- 0x00AC,0x3F44,0x2349,0x0484,0x3438,0x0D2A,0x2B5D,0x15A9,
- 0x306D,0x1AC9,0x0375,0x2B85,0x0B96,0x2F04,0x0106,0x23C2,
- 0x2E7B,0x061C,0x2B52,0x1174,0x2F2A,0x0F3F,0x33E6,0x03D9,
- 0x190C,0x2F06,0x1C41,0x3D7C,0x0D47,0x2795,0x076D,0x3222,
- 0x0C10,0x378C,0x1A25,0x3F56,0x06A8,0x2248,0x31BD,0x115D,
- 0x268F,0x1C62,0x323F,0x00BA,0x2D4D,0x0A9F,0x27C5,0x030C,
- 0x2E00,0x0B64,0x1AAA,0x374D,0x15A4,0x3B3D,0x1D5B,0x0313,
- 0x1269,0x3B9E,0x23C7,0x00CB,0x31A6,0x18D4,0x3995,0x1318,
- 0x2517,0x3C42,0x1145,0x37D7,0x0B74,0x29F0,0x06C0,0x2EAD,
- 0x0261,0x1D88,0x2683,0x1272,0x32C4,0x1953,0x35CC,0x1535,
- 0x2699,0x2FD3,0x0EA1,0x2A4B,0x1830,0x0AD6,0x31C0,0x0415,
- 0x2BFB,0x0C36,0x2EAC,0x12F1,0x1EF4,0x3D8A,0x1509,0x2815,
- 0x0874,0x2F4C,0x0CCA,0x33D6,0x2402,0x11BB,0x2D0C,0x0E96,
- 0x3145,0x18CB,0x2DF0,0x0975,0x280D,0x37F7,0x129E,0x3FBC,
- 0x06BB,0x2365,0x14E7,0x3A12,0x1FD6,0x03DE,0x285B,0x1834,
- 0x31DD,0x11B9,0x2732,0x146B,0x2CB9,0x2308,0x169D,0x21AD,
- 0x2C28,0x0F52,0x2F15,0x18F7,0x2164,0x39F2,0x02AC,0x35F7,
- 0x0A17,0x2015,0x33F7,0x16C5,0x390D,0x13E5,0x3703,0x1C15,
- 0x0E76,0x33C0,0x1791,0x3A63,0x0C57,0x29BD,0x13B8,0x27A0,
- 0x3806,0x148B,0x0096,0x222E,0x350D,0x1290,0x3AF4,0x1670,
- 0x28C0,0x20FA,0x104E,0x2551,0x1BE1,0x39CA,0x0A3C,0x36E2,
- 0x04F3,0x3EC0,0x147F,0x2575,0x1DAC,0x3648,0x1169,0x3E8A,
- 0x16B5,0x2534,0x31E1,0x002D,0x28A1,0x0C16,0x24B6,0x381A,
- 0x2B78,0x05DA,0x1B49,0x36A0,0x1537,0x28A3,0x0D6D,0x2F18,
- 0x0214,0x1D9D,0x2A1C,0x042F,0x26ED,0x108A,0x3BCB,0x1FED,
- 0x35A8,0x0EEB,0x3B01,0x1F5E,0x09B5,0x2960,0x04D1,0x3C87,
- 0x2091,0x01CB,0x3B6B,0x0783,0x2163,0x361A,0x11B4,0x23D8,
- 0x1DA0,0x3E70,0x0173,0x24DB,0x317C,0x0CA1,0x2E26,0x173B,
- 0x3B37,0x12D3,0x291A,0x1E2F,0x08E9,0x3630,0x1CCF,0x3A16,
- 0x0A53,0x35FC,0x134E,0x3E95,0x1F80,0x0052,0x1D58,0x26C1,
- 0x1897,0x3183,0x1D8B,0x0BDC,0x30E7,0x1A8A,0x2EE8,0x0890,
- 0x2116,0x3A8A,0x04F6,0x35A0,0x1CFD,0x087D,0x3B8F,0x0538,
- 0x1C8D,0x36D3,0x06CD,0x3C64,0x0ACC,0x1B87,0x28F7,0x125A,
- 0x24C3,0x3AFB,0x0D95,0x292C,0x051E,0x257C,0x09CF,0x288D,
- 0x3C1B,0x21A0,0x033F,0x22C5,0x32C3,0x0500,0x3E6F,0x1D44,
- 0x0852,0x232A,0x311D,0x1814,0x0510,0x2CB3,0x1CA0,0x02ED,
- 0x3E2A,0x0885,0x3366,0x03B7,0x2B31,0x12E2,0x28BD,0x16CB,
- 0x2C46,0x1E2D,0x09B2,0x3A8E,0x06B5,0x195F,0x2EF1,0x0D75,
- 0x2A0C,0x075A,0x1EC1,0x3D64,0x11BF,0x333B,0x196F,0x0A94,
- 0x1600,0x3517,0x273E,0x09F5,0x2AF6,0x0519,0x3DD0,0x2152,
- 0x17E6,0x329E,0x0C8D,0x3E8C,0x14BC,0x2DB1,0x1AE6,0x093C,
- 0x179C,0x2A29,0x0586,0x2455,0x34EB,0x136D,0x2E65,0x0FD2,
- 0x18E1,0x3211,0x140A,0x1E68,0x2E17,0x00C3,0x277B,0x3944,
- 0x0DAC,0x176E,0x2AED,0x1C4F,0x05E9,0x37A1,0x20B2,0x001C,
- 0x1BD0,0x327E,0x044D,0x3BFE,0x18E6,0x26E3,0x0136,0x1704,
- 0x2B4B,0x1F01,0x045F,0x2456,0x156C,0x2345,0x352A,0x09F8,
- 0x36CC,0x04C9,0x3C69,0x2242,0x0730,0x3DFF,0x102B,0x37B9,
- 0x1BA4,0x0C6F,0x29B4,0x0F11,0x2EA6,0x1853,0x2419,0x3176,
- 0x10B9,0x2670,0x2056,0x1714,0x2323,0x31E0,0x0814,0x3F7C,
- 0x1D3F,0x005F,0x2FAF,0x1180,0x3E96,0x18AB,0x3274,0x1661,
- 0x074B,0x1B2C,0x2FD0,0x0B3C,0x1E62,0x25F3,0x0E9F,0x2EA2,
- 0x1728,0x345A,0x09E2,0x3F6C,0x264A,0x0FE3,0x30F7,0x21F4,
- 0x1150,0x2FFE,0x17FA,0x3C48,0x0DD3,0x3527,0x015C,0x3D3C,
- 0x0C61,0x23A3,0x318F,0x15D8,0x2B79,0x2266,0x0203,0x38C9,
- 0x14C5,0x34C1,0x1099,0x22E2,0x2B26,0x0560,0x3EF9,0x2377,
- 0x2ECD,0x0C42,0x2049,0x3B00,0x118D,0x33BF,0x1E41,0x0977,
- 0x3895,0x1431,0x25AA,0x1C17,0x343A,0x0189,0x3677,0x1E90,
- 0x3F53,0x1156,0x320B,0x0DFA,0x1DE5,0x3EEE,0x0894,0x232D,
- 0x397B,0x0BC9,0x22DA,0x380E,0x1248,0x3F30,0x199C,0x06E4,
- 0x21CF,0x36B4,0x0B14,0x3BAD,0x1937,0x271C,0x108F,0x34C2,
- 0x265F,0x0EEF,0x2A19,0x1125,0x2C47,0x0E09,0x3F7D,0x24CC,
- 0x074A,0x3C6E,0x1B4D,0x389E,0x0827,0x2E3E,0x0F30,0x2A14,
- 0x137A,0x2882,0x0F77,0x2D35,0x1773,0x263D,0x2046,0x0257,
- 0x236B,0x3305,0x13EA,0x3FA9,0x0167,0x3776,0x0D99,0x1F9A,
- 0x3DE1,0x09D0,0x33D4,0x0178,0x38CB,0x1541,0x2C2E,0x10B7,
- 0x2DA7,0x1943,0x2228,0x34DC,0x0B0E,0x27EE,0x01E9,0x39B4,
- 0x1EF8,0x359D,0x14CD,0x3CA4,0x1313,0x388C,0x20A4,0x022B,
- 0x3A94,0x1567,0x2B93,0x0E58,0x200C,0x3A17,0x0AD9,0x36E7,
- 0x1AD8,0x26AA,0x0BC6,0x1CEF,0x2D50,0x15B1,0x2746,0x13C7,
- 0x2E68,0x1A81,0x0346,0x3576,0x0FBD,0x3CA6,0x1BA6,0x214A,
- 0x2C02,0x0420,0x39B8,0x08FF,0x1770,0x30AD,0x1C4D,0x0197,
- 0x11DC,0x3D2E,0x180F,0x02DC,0x2D52,0x21FB,0x10C0,0x3026,
- 0x2312,0x05CC,0x3AD7,0x08A7,0x2182,0x2BD1,0x0D1A,0x2799,
- 0x0317,0x2C77,0x185F,0x38FB,0x012A,0x25FB,0x1A4A,0x30B6,
- 0x02D3,0x1D49,0x2D10,0x05B6,0x2ADC,0x09A1,0x3012,0x1C8E,
- 0x3236,0x0469,0x2F1D,0x13F9,0x3322,0x09FD,0x3F67,0x1DAA,
- 0x0B02,0x3D2B,0x1C84,0x3803,0x06D8,0x32F6,0x207F,0x11A4,
- 0x3191,0x1522,0x2F77,0x0FBB,0x32AD,0x17A3,0x3DC1,0x031A,
- 0x3911,0x1F18,0x3427,0x0124,0x39C7,0x0CC2,0x3480,0x1657,
- 0x3BD5,0x05CF,0x25DC,0x1AC5,0x2AC9,0x134C,0x2FDD,0x02EA,
- 0x19FD,0x2980,0x1212,0x2B0C,0x0CB2,0x2775,0x03CE,0x3352,
- 0x0A78,0x3A42,0x0733,0x1CE3,0x2AE9,0x127A,0x30B0,0x0F9C,
- 0x2C54,0x0BFB,0x2883,0x0014,0x2A57,0x0919,0x34B0,0x1AC7,
- 0x2536,0x05BB,0x1C6A,0x3644,0x01C5,0x1957,0x2AB5,0x0661,
- 0x2CDB,0x0032,0x38E8,0x247D,0x052E,0x3ACE,0x0B4C,0x349A,
- 0x06D7,0x391D,0x2615,0x0CD1,0x296E,0x05C3,0x3077,0x0A51,
- 0x132B,0x3151,0x1CD0,0x2181,0x3C4D,0x0F1F,0x2662,0x3704,
- 0x2C26,0x067F,0x256C,0x377A,0x1A29,0x088F,0x3B6E,0x0013,
- 0x1BBF,0x2B2E,0x1632,0x31D6,0x1008,0x19BA,0x3CEC,0x15CF,
- 0x37AF,0x1F07,0x07D9,0x2075,0x2F26,0x1494,0x3773,0x0E86,
- 0x21A4,0x3E00,0x0F71,0x357B,0x17E0,0x263E,0x0EFA,0x3AD8,
- 0x11EB,0x28E6,0x0E5C,0x2572,0x0272,0x2C80,0x221D,0x04D7,
- 0x3099,0x2329,0x0204,0x16EC,0x2DBD,0x1A51,0x0395,0x3750,
- 0x0B7B,0x2674,0x01DF,0x2965,0x1FE6,0x0585,0x1E7A,0x2BB7,
- 0x162E,0x08D3,0x1BAC,0x28FB,0x1223,0x2A41,0x065C,0x2E66,
- 0x0DE3,0x1E71,0x3102,0x0A77,0x21C3,0x3C40,0x0C20,0x20F9,
- 0x39A4,0x0642,0x3618,0x1B2D,0x3E59,0x12EC,0x3804,0x14A2,
- 0x1F72,0x269B,0x1769,0x37BF,0x0432,0x3D7B,0x1A62,0x246E,
- 0x055B,0x3F5D,0x108D,0x36DA,0x19E7,0x2F51,0x113F,0x2C19,
- 0x0DDD,0x3D03,0x27F9,0x1119,0x3048,0x2509,0x0F76,0x3CD0,
- 0x131B,0x3404,0x2038,0x0E34,0x31E2,0x1D9E,0x2905,0x186C,
- 0x23FF,0x1F8F,0x1270,0x3FD4,0x146C,0x36B1,0x17F2,0x2426,
- 0x3F2D,0x18D2,0x0B90,0x2D4E,0x02A3,0x2A1D,0x084F,0x1ACE,
- 0x0F6A,0x3060,0x1D93,0x0ADE,0x325F,0x293E,0x1519,0x2703,
- 0x3F31,0x0BE1,0x3708,0x0343,0x22CD,0x30C8,0x04F5,0x28EB,
- 0x0A28,0x32CF,0x1B7F,0x3C0B,0x10A1,0x2963,0x048A,0x1EB9,
- 0x335A,0x0820,0x2902,0x1C1A,0x0370,0x3CF4,0x2359,0x01E6,
- 0x2C60,0x189D,0x3E1B,0x15BA,0x38E0,0x1D0E,0x0D9A,0x39F4,
- 0x1F2F,0x134F,0x3525,0x2288,0x09A7,0x397D,0x286A,0x143E,
- 0x2AF0,0x12DD,0x3BA5,0x0B09,0x3668,0x1A34,0x3A28,0x0B48,
- 0x3335,0x23FB,0x3F55,0x0A39,0x353E,0x1D4A,0x3D45,0x1931,
- 0x223C,0x38E6,0x1015,0x36CB,0x046D,0x171A,0x32C6,0x26E0,
- 0x0E3A,0x2B8C,0x1E96,0x0431,0x1FD0,0x2A10,0x07CB,0x2499,
- 0x3CFF,0x0249,0x32C2,0x0DFC,0x2EA7,0x1DC8,0x08B4,0x31BB,
- 0x20E8,0x17D4,0x3007,0x230A,0x05EC,0x1F81,0x3ED0,0x03A6,
- 0x32F7,0x1EC5,0x08CC,0x390C,0x20DE,0x0BFA,0x3256,0x1D0D,
- 0x27BA,0x0927,0x1743,0x3FAA,0x1635,0x0848,0x3744,0x0295,
- 0x3DDD,0x0A9E,0x2FAC,0x0065,0x2879,0x1D1F,0x08AA,0x344D,
- 0x0146,0x22B6,0x3872,0x1562,0x35C7,0x1374,0x3A87,0x23BC,
- 0x3FD4,0x14FA,0x38FC,0x133B,0x209F,0x056D,0x3623,0x0A3E,
- 0x18EC,0x2D6F,0x125C,0x1F0E,0x2A89,0x0B41,0x3A06,0x13BA,
- 0x2EAE,0x1288,0x2AA6,0x0563,0x33C4,0x0CB8,0x3A5F,0x24EA,
- 0x12A0,0x2BDD,0x1434,0x38AF,0x20EF,0x1093,0x1DC6,0x379A,
- 0x0C5F,0x30DF,0x0737,0x2850,0x0B8F,0x2E3F,0x1AC6,0x25DB,
- 0x07CF,0x2EE2,0x0E4B,0x3EA1,0x1DCA,0x0F42,0x210E,0x3D14,
- 0x06AD,0x3436,0x1CA9,0x2D00,0x0ED4,0x27C7,0x126B,0x2989,
- 0x1AFB,0x0232,0x1588,0x2DFA,0x183C,0x03A1,0x2576,0x09B1,
- 0x2CE1,0x00B4,0x2B35,0x1CBB,0x233A,0x2D73,0x0713,0x1969,
- 0x34D4,0x1435,0x3CBB,0x16CE,0x3266,0x1025,0x2F6B,0x1CAB,
- 0x0C85,0x2CF5,0x115C,0x28EA,0x13B5,0x2521,0x3B16,0x0D62,
- 0x3641,0x02D1,0x1F9E,0x0C90,0x3B68,0x0F51,0x26D6,0x18F0,
- 0x240D,0x1254,0x2D43,0x19D0,0x04DB,0x3E56,0x17D2,0x0345,
- 0x3A55,0x211B,0x2A4A,0x03DA,0x2ED9,0x221A,0x19ED,0x30C2,
- 0x11AC,0x2C1B,0x1534,0x3348,0x0EC2,0x3B96,0x2303,0x1688,
- 0x202F,0x2F17,0x05D5,0x25F8,0x0992,0x31A5,0x1F36,0x0408,
- 0x0CA7,0x2AE3,0x012E,0x2796,0x3E05,0x1796,0x2445,0x1DE3,
- 0x3095,0x06B4,0x24F5,0x3C88,0x0F66,0x3354,0x1C5F,0x2588,
- 0x00A1,0x3E27,0x0C1E,0x2779,0x165E,0x2D85,0x1B48,0x09EA,
- 0x3BCA,0x002B,0x318D,0x0B83,0x281D,0x34E4,0x0A71,0x271A,
- 0x1F55,0x134A,0x365B,0x16DA,0x3437,0x03F1,0x3CB3,0x10DD,
- 0x3751,0x1603,0x2AAB,0x051F,0x31F2,0x2403,0x009E,0x1C67,
- 0x30CF,0x17F3,0x0437,0x22A8,0x3EC1,0x00EF,0x3555,0x0736,
- 0x3C3C,0x1F6C,0x36DD,0x0D7A,0x22D2,0x3A84,0x110D,0x35E4,
- 0x12CD,0x3E7A,0x17F6,0x0CF4,0x382B,0x1287,0x3EF2,0x1FF8,
- 0x0025,0x28BE,0x088B,0x2DE7,0x0A4C,0x3ADC,0x010A,0x340C,
- 0x1848,0x228C,0x3F14,0x0859,0x3887,0x00C7,0x1985,0x2AB1,
- 0x12E5,0x283F,0x396B,0x1693,0x2355,0x3202,0x0761,0x381B,
- 0x0AF6,0x3AFC,0x00D2,0x3505,0x28E8,0x1218,0x2427,0x2FBE,
- 0x14D4,0x0D03,0x3793,0x1E78,0x1110,0x3B55,0x0EA8,0x24EB,
- 0x1F27,0x050B,0x39DC,0x1A60,0x2AF7,0x03C9,0x3111,0x0CFE,
- 0x3DAA,0x1030,0x1E30,0x3BF2,0x19C6,0x2463,0x0E8B,0x33E3,
- 0x2857,0x1624,0x3310,0x1B8C,0x095F,0x3460,0x025B,0x3810,
- 0x144A,0x3A41,0x1A8C,0x0129,0x2CF7,0x17FB,0x0623,0x3866,
- 0x1F45,0x14DF,0x34CC,0x0FF3,0x3D6D,0x0215,0x2221,0x3523,
- 0x159F,0x26AF,0x177A,0x3FCE,0x064D,0x1A15,0x2D8D,0x04F4,
- 0x3CA2,0x239A,0x007A,0x2986,0x1185,0x246C,0x17F5,0x29EA,
- 0x0114,0x324C,0x0C3C,0x2692,0x1139,0x3B66,0x167C,0x2BA8,
- 0x097E,0x273A,0x39E5,0x11BA,0x1E51,0x315B,0x1947,0x2DA1,
- 0x0E94,0x2BD9,0x05F0,0x1DEC,0x3239,0x07EB,0x3020,0x19D1,
- 0x278C,0x08B5,0x2162,0x2F34,0x030B,0x29C7,0x0B27,0x251E,
- 0x3A48,0x10AD,0x3764,0x190F,0x26B5,0x1BCF,0x240E,0x1574,
- 0x39D3,0x055F,0x1E1F,0x31DF,0x1C0F,0x218B,0x357E,0x0670,
- 0x3D44,0x1BE7,0x08F2,0x3375,0x0149,0x1B30,0x29CD,0x1392,
- 0x2ECA,0x1745,0x25BD,0x1E9D,0x0AA5,0x31B2,0x07B9,0x1B4C,
- 0x3611,0x26BA,0x06AB,0x3158,0x259B,0x00ED,0x3399,0x093D,
- 0x3C1A,0x284E,0x1E17,0x080F,0x1F83,0x37C8,0x1221,0x2CAA,
- 0x071C,0x26F3,0x322D,0x0C62,0x2B97,0x0074,0x2E93,0x1281,
- 0x0610,0x3AA9,0x0AC8,0x22AB,0x2F87,0x121D,0x2C56,0x0EFB,
- 0x283E,0x0C78,0x346A,0x218C,0x0A5C,0x3FBB,0x2337,0x0E73,
- 0x3036,0x22DB,0x03F0,0x2F5D,0x2011,0x1874,0x2B71,0x0739,
- 0x3058,0x0D8A,0x2EED,0x1133,0x1FD9,0x3A24,0x147D,0x32A9,
- 0x1959,0x0F86,0x3967,0x1A59,0x3FAE,0x0690,0x35D0,0x0D2C,
- 0x3A8F,0x2140,0x1919,0x3043,0x1F82,0x07B0,0x3451,0x0CDC,
- 0x3FD4,0x2039,0x0E63,0x2E81,0x086C,0x2532,0x0C67,0x20C3,
- 0x3849,0x166C,0x2215,0x3E2F,0x1261,0x2A78,0x1CB6,0x02A9,
- 0x3961,0x1B58,0x350E,0x11B7,0x3B35,0x161A,0x358B,0x1A79,
- 0x09F2,0x2CF3,0x1CFB,0x035D,0x3FD4,0x0BAA,0x35DC,0x06F8,
- 0x2801,0x12B6,0x2BC0,0x15FE,0x0C27,0x303B,0x1559,0x2999,
- 0x1104,0x23D4,0x2EF9,0x0FD1,0x204C,0x3DFC,0x0EB0,0x35F8,
- 0x2138,0x063E,0x3FD4,0x0EE7,0x3748,0x1487,0x3C05,0x2AD9,
- 0x0161,0x18A6,0x3D13,0x0FF2,0x1A2D,0x2D18,0x14F5,0x29C4,
- 0x179B,0x0D19,0x33C8,0x1423,0x2F59,0x09DF,0x2590,0x1C7D,
- 0x399C,0x1944,0x0383,0x37E9,0x13EE,0x3E44,0x1B3D,0x36B6,
- 0x2D69,0x216E,0x1744,0x3C37,0x047D,0x2648,0x1A07,0x3EB1,
- 0x03E8,0x29FB,0x1033,0x2EB7,0x1E5C,0x1111,0x3547,0x1D33,
- 0x077F,0x3B0E,0x1951,0x2602,0x08C6,0x376C,0x0E12,0x3E82,
- 0x1D07,0x2899,0x0529,0x367F,0x2520,0x019C,0x29D8,0x0CCB,
- 0x2502,0x2FC6,0x0887,0x2B1E,0x0BF8,0x3163,0x156F,0x27CA,
- 0x1BBB,0x08DA,0x3E01,0x02F5,0x390B,0x1AD6,0x224B,0x2F0C,
- 0x1A12,0x0255,0x35B3,0x1702,0x37CC,0x159A,0x3D96,0x0348,
- 0x2654,0x09D3,0x2ED2,0x0010,0x26F7,0x0AD0,0x3CDC,0x2318,
- 0x1491,0x2E32,0x04E4,0x2626,0x0BF3,0x2821,0x05C2,0x3182,
- 0x241D,0x11F0,0x30E3,0x225A,0x1363,0x2BE8,0x1116,0x2FFB,
- 0x1D71,0x3788,0x02B5,0x3AB1,0x25D1,0x04AF,0x3BE0,0x0B1B,
- 0x3456,0x03AC,0x1922,0x37CE,0x275B,0x09E9,0x2DCE,0x0312,
- 0x1A4B,0x2B25,0x12C8,0x2E2B,0x02A8,0x284B,0x2010,0x0E71,
- 0x227F,0x2D7D,0x0A21,0x23D2,0x3817,0x0C22,0x3EE0,0x0453,
- 0x35E0,0x2250,0x01B6,0x3E8F,0x1817,0x20FD,0x3C66,0x0219,
- 0x153A,0x2FFD,0x23AB,0x0F9B,0x2920,0x1FDD,0x07D5,0x1E77,
- 0x139D,0x01F4,0x318C,0x0DB2,0x2003,0x3951,0x07F5,0x1D74,
- 0x339C,0x13AC,0x3D69,0x05A9,0x36E9,0x2740,0x0296,0x2C7B,
- 0x213C,0x0BDA,0x35F1,0x15B2,0x30EC,0x1234,0x2929,0x19E1,
- 0x02C2,0x3880,0x2324,0x0C71,0x1B80,0x347B,0x120E,0x3EDD,
- 0x0344,0x1E44,0x3389,0x1407,0x26A7,0x1037,0x2C7D,0x039E,
- 0x30CB,0x231A,0x16A3,0x2BED,0x0DF2,0x2A4C,0x04B4,0x13E7,
- 0x3867,0x2356,0x0C23,0x2C29,0x04D6,0x28EF,0x0DAE,0x32D0,
- 0x1A89,0x3B09,0x0FD0,0x35FE,0x1866,0x2C3E,0x0F9E,0x31D1,
- 0x0780,0x1D52,0x3F62,0x16EB,0x338D,0x1070,0x3DCA,0x1ECE,
- 0x0220,0x3C75,0x07F1,0x366E,0x1EEA,0x04E9,0x3B5C,0x21CA,
- 0x0CE7,0x18DD,0x30FA,0x2095,0x0F16,0x2CE8,0x11F1,0x27DE,
- 0x1477,0x3FB9,0x2570,0x06F3,0x14E1,0x3A04,0x1CDB,0x22E0,
- 0x3C72,0x0A41,0x368E,0x21A1,0x1B08,0x39DB,0x0557,0x1DBF,
- 0x3F3C,0x1398,0x32D5,0x1D5D,0x05AB,0x27F2,0x1B73,0x2BDB,
- 0x114E,0x2DFE,0x1B24,0x274F,0x059C,0x31C5,0x0D79,0x29FE,
- 0x35E1,0x08A4,0x1BED,0x330B,0x0525,0x35B4,0x17EC,0x3CE9,
- 0x27CF,0x388A,0x2325,0x1991,0x2BDC,0x1188,0x30FC,0x2416,
- 0x0AD7,0x2CBA,0x1C89,0x254A,0x0D26,0x1775,0x3276,0x12F0,
- 0x3EB5,0x1AF6,0x279D,0x0148,0x21D6,0x3C34,0x05B1,0x334D,
- 0x2093,0x0EE4,0x16E1,0x3CDA,0x27DC,0x0989,0x2CDD,0x202B,
- 0x359E,0x0E9B,0x21B7,0x3BF7,0x0228,0x36A2,0x1ECA,0x3B7E,
- 0x0F90,0x37F1,0x0BDD,0x21E4,0x3695,0x1586,0x3DAB,0x25BF,
- 0x07EE,0x2DE3,0x14CE,0x216A,0x3C04,0x123B,0x2B49,0x1EA5,
- 0x0821,0x1FBB,0x289A,0x14BB,0x310A,0x054B,0x37DD,0x1731,
- 0x21D2,0x2B5F,0x0AA6,0x297C,0x0140,0x2DAE,0x2204,0x13C9,
- 0x2C5C,0x18B3,0x2925,0x0D8E,0x2640,0x32EC,0x177F,0x01BC,
- 0x3D92,0x2970,0x140F,0x0978,0x3EAA,0x1CD7,0x3337,0x019D,
- 0x2F84,0x1F08,0x0E4F,0x32BB,0x2AD1,0x1708,0x05A0,0x33D5,
- 0x11B8,0x3014,0x188C,0x0723,0x2C9C,0x1091,0x2647,0x30F5,
- 0x0903,0x2907,0x02E9,0x3A9F,0x16A6,0x3657,0x0EFD,0x214F,
- 0x38F2,0x0769,0x3B1D,0x1051,0x36FC,0x1649,0x2431,0x1EE2,
- 0x10C7,0x278B,0x3F79,0x0E0E,0x2DC6,0x1073,0x2A5C,0x0BF9,
- 0x1F57,0x1532,0x0652,0x3F71,0x09C8,0x3669,0x00BC,0x16BD,
- 0x3B60,0x1886,0x01E0,0x38A7,0x2287,0x3C11,0x09D7,0x2871,
- 0x04B3,0x331C,0x11E5,0x39BF,0x1D57,0x0D09,0x2C0A,0x0B46,
- 0x3B38,0x2441,0x3241,0x069F,0x15D4,0x3A85,0x1AC2,0x07F9,
- 0x17AC,0x2B81,0x05F4,0x1C26,0x2EE3,0x171B,0x07B6,0x1B6E,
- 0x2943,0x0554,0x2E3B,0x1C09,0x015D,0x2D7C,0x0A73,0x1E6E,
- 0x3504,0x188F,0x3A68,0x0669,0x1D24,0x2FE6,0x0195,0x3503,
- 0x17B5,0x36FF,0x03D1,0x3FD4,0x0C03,0x1F28,0x2515,0x01D5,
- 0x3BA3,0x0EF4,0x3656,0x139A,0x39F0,0x1DD8,0x0962,0x3401,
- 0x0677,0x3705,0x12FE,0x3A09,0x1A8E,0x0995,0x2F12,0x24DC,
- 0x1C0E,0x0740,0x36E5,0x233C,0x2A2A,0x06AA,0x1793,0x394C,
- 0x22FA,0x082D,0x3AAD,0x1D9C,0x007C,0x2254,0x2CDA,0x0E31,
- 0x2956,0x01E8,0x249D,0x3DAC,0x1544,0x3363,0x0C97,0x191A,
- 0x389B,0x1238,0x2F4D,0x0D61,0x2601,0x0888,0x309A,0x0231,
- 0x1D6C,0x2690,0x0B61,0x209E,0x2AD4,0x0ABD,0x3D6F,0x04A7,
- 0x3857,0x18A7,0x0109,0x24BE,0x1A2A,0x3AE8,0x02EB,0x3455,
- 0x0950,0x3061,0x1D32,0x28E5,0x1608,0x24A9,0x1DD3,0x2E7F,
- 0x0868,0x26AB,0x329B,0x15D9,0x071E,0x1B59,0x2FFF,0x1563,
- 0x2A7F,0x0F0E,0x2D04,0x0837,0x31D7,0x1525,0x22BD,0x2F4E,
- 0x145E,0x00BD,0x1BB0,0x2EAB,0x23BD,0x0308,0x314F,0x1EEB,
- 0x3DBC,0x1260,0x3808,0x24BD,0x09AB,0x3E7F,0x1F90,0x34A0,
- 0x1211,0x3F2C,0x141C,0x33F8,0x2071,0x12C9,0x3993,0x0FFF,
- 0x28F8,0x0059,0x2279,0x31C3,0x0F32,0x230B,0x3E7D,0x10A5,
- 0x27E3,0x0E66,0x2E10,0x12F9,0x298F,0x3902,0x0D97,0x3326,
- 0x18E7,0x2FE5,0x0470,0x2041,0x24A0,0x1108,0x38A2,0x17A5,
- 0x26F9,0x0CAA,0x2E5D,0x0098,0x2064,0x3ED3,0x14E8,0x0B43,
- 0x33C3,0x2715,0x1AB7,0x0045,0x1629,0x37B8,0x21D7,0x0A34,
- 0x1A0D,0x2DBC,0x12C6,0x29EF,0x1AAE,0x3E81,0x0951,0x37AC,
- 0x13F6,0x39A5,0x1D3E,0x0B22,0x27B9,0x0031,0x3AED,0x234A,
- 0x0442,0x34C0,0x21D4,0x1BC5,0x3E33,0x1854,0x231C,0x3CCD,
- 0x0F7C,0x2F0B,0x19C7,0x347C,0x0010,0x282F,0x179F,0x2D81,
- 0x0B67,0x2B5B,0x1DCE,0x3934,0x0998,0x2383,0x1C25,0x2541,
- 0x36A9,0x0F79,0x3A0A,0x037E,0x34D6,0x0D25,0x3D34,0x1131,
- 0x36BC,0x20BC,0x0FBF,0x2E38,0x1E89,0x2B23,0x0033,0x3A0B,
- 0x0AA2,0x3D1B,0x1BD5,0x24CE,0x17DC,0x3F1D,0x03A8,0x1911,
- 0x3415,0x1F29,0x3F87,0x0A36,0x18E3,0x37B3,0x136C,0x28C8,
- 0x00D4,0x2E20,0x0AFC,0x1894,0x2D55,0x1303,0x29F1,0x0037,
- 0x259A,0x0AC5,0x2831,0x0855,0x3CE3,0x264C,0x043A,0x30AB,
- 0x16A9,0x3F4B,0x0E39,0x1EE7,0x3795,0x08EB,0x1C24,0x2AA9,
- 0x061F,0x3B77,0x1D7A,0x2451,0x0707,0x16A2,0x2D0F,0x213A,
- 0x08B1,0x2595,0x1BDC,0x3D4C,0x0790,0x2FA7,0x02E1,0x2A81,
- 0x0F56,0x3E30,0x1639,0x23C8,0x34A1,0x0613,0x27B0,0x38E9,
- 0x1678,0x0DB1,0x3BEA,0x1F3D,0x2D30,0x0FAF,0x314D,0x1D53,
- 0x3C4A,0x041A,0x36B7,0x0BCC,0x34DB,0x10E0,0x30CC,0x19A9,
- 0x2630,0x085E,0x32AC,0x1786,0x35C1,0x208A,0x1012,0x2DE4,
- 0x1F14,0x15F6,0x0971,0x2E5E,0x009A,0x3424,0x1175,0x1E88,
- 0x3317,0x0427,0x3FC6,0x14C0,0x1FC6,0x3A91,0x0E32,0x219F,
- 0x34A6,0x13D8,0x3000,0x1115,0x34E3,0x14EB,0x3EBA,0x129A,
- 0x0048,0x2E03,0x17A1,0x25FC,0x1A65,0x2D54,0x0573,0x2937,
- 0x1BDE,0x032E,0x398D,0x0B97,0x3DC2,0x10D9,0x3595,0x1998,
- 0x2574,0x207D,0x026A,0x37B0,0x06CA,0x26A4,0x1DC5,0x3946,
- 0x087A,0x2AE5,0x11B5,0x34FF,0x25B0,0x0CAC,0x2BF1,0x0FD7,
- 0x3937,0x1BF3,0x2203,0x3412,0x0381,0x39CD,0x0D4A,0x376B,
- 0x1A45,0x32A8,0x1771,0x2FEA,0x0F1C,0x18D8,0x371C,0x2176,
- 0x09B6,0x23AD,0x2F28,0x0409,0x272B,0x18A3,0x340B,0x13A7,
- 0x329C,0x1999,0x00FE,0x30BC,0x1C29,0x3C5A,0x0336,0x1AC1,
- 0x3EAE,0x1464,0x342F,0x11E6,0x28D0,0x14E5,0x3CB4,0x1B92,
- 0x3174,0x04B5,0x2B75,0x0ABF,0x17F0,0x305F,0x1D25,0x031E,
- 0x21E7,0x2EBA,0x0507,0x334A,0x0AC4,0x3E0F,0x02EC,0x2B33,
- 0x0D6B,0x2733,0x156E,0x2C4E,0x063D,0x256A,0x203D,0x0293,
- 0x3CD4,0x212C,0x1326,0x2EB6,0x0619,0x3EB7,0x1C93,0x078B,
- 0x3BF4,0x2475,0x37F4,0x0FB6,0x296C,0x0B82,0x2C7F,0x068B,
- 0x27FC,0x172E,0x24F8,0x0CDA,0x301C,0x064C,0x3213,0x1A95,
- 0x0273,0x3B53,0x07B8,0x270C,0x0434,0x2D05,0x0728,0x2B00,
- 0x3BF6,0x2125,0x08D0,0x3E23,0x0C12,0x21C0,0x3871,0x0F1D,
- 0x32FE,0x168E,0x27ED,0x211F,0x044E,0x2719,0x1FB6,0x068E,
- 0x3447,0x100C,0x2E86,0x1395,0x319F,0x0E7F,0x2BC2,0x1315,
- 0x2764,0x0F45,0x30C5,0x0416,0x1D8E,0x3C38,0x06E1,0x330D,
- 0x2139,0x058B,0x3D0B,0x1096,0x27BC,0x1AD9,0x2443,0x1458,
- 0x2CC6,0x064B,0x3B34,0x02EF,0x1FD1,0x2D26,0x070B,0x1BAA,
- 0x3394,0x1079,0x1A53,0x38E1,0x1298,0x3C91,0x02D6,0x2D62,
- 0x0A06,0x25E0,0x3936,0x0E08,0x348E,0x1018,0x2297,0x3596,
- 0x0C92,0x2810,0x007D,0x2C4D,0x0D0E,0x3209,0x216F,0x09D5,
- 0x2293,0x362D,0x114F,0x3A82,0x2493,0x0E05,0x3CE4,0x19B7,
- 0x351D,0x0FFB,0x29BE,0x126C,0x27FF,0x1935,0x250E,0x145D,
- 0x33F9,0x18A5,0x3F04,0x0FFD,0x1E3C,0x3B97,0x0DD7,0x2E85,
- 0x15BF,0x353B,0x03C1,0x1EAC,0x29CA,0x0EDE,0x26CD,0x3181,
- 0x1486,0x0234,0x1ABB,0x31CA,0x13E1,0x3BA2,0x2013,0x3899,
- 0x0DD2,0x3686,0x083A,0x3977,0x18DC,0x2651,0x1075,0x3F19,
- 0x25A4,0x124A,0x2A3D,0x15B9,0x319A,0x11B6,0x2804,0x16D5,
- 0x0EBD,0x1ADA,0x2AB7,0x12C5,0x31C9,0x019E,0x1CE1,0x2C27,
- 0x079E,0x3EDF,0x0E06,0x360B,0x18BB,0x3338,0x0C6A,0x2F0F,
- 0x1750,0x38F5,0x0914,0x242C,0x1AD4,0x3AA0,0x09F3,0x35B6,
- 0x01F3,0x3DE0,0x222C,0x170F,0x2DFF,0x14A6,0x282A,0x1B40,
- 0x0E53,0x3034,0x15BC,0x2B03,0x0BAB,0x32C8,0x050A,0x3D6B,
- 0x0C7C,0x28D8,0x1572,0x2494,0x35F6,0x0CD8,0x3C3A,0x22BE,
- 0x0287,0x3D42,0x2851,0x0794,0x2CC2,0x0D8F,0x24ED,0x1CD6,
- 0x3F0E,0x0F8F,0x208C,0x2B70,0x0866,0x1EE6,0x2F6A,0x05D0,
- 0x2AB0,0x106F,0x3A3F,0x1E8D,0x36EF,0x057F,0x194E,0x2DF3,
- 0x1351,0x1EE8,0x2876,0x0281,0x1DA7,0x2CEC,0x0786,0x28DD,
- 0x091F,0x3F86,0x1B32,0x39C4,0x060D,0x368C,0x0BB1,0x3B12,
- 0x077B,0x2F66,0x0170,0x21EA,0x3008,0x049A,0x3458,0x1D26,
- 0x08F8,0x2741,0x1AF5,0x3210,0x1439,0x2F73,0x0AAD,0x20CC,
- 0x34F1,0x1E50,0x3F7B,0x05FC,0x27B6,0x1A16,0x0390,0x16B9,
- 0x2DD2,0x2244,0x1B99,0x294D,0x0337,0x2E45,0x1EA2,0x08F5,
- 0x1C11,0x333E,0x0CB3,0x3D0D,0x1BAD,0x39D9,0x0BBF,0x32CD,
- 0x267C,0x3585,0x04AE,0x37D6,0x2398,0x1642,0x3BA1,0x1181,
- 0x25B6,0x1C77,0x2D8C,0x0981,0x2B69,0x13CD,0x3F9E,0x2165,
- 0x0352,0x27C4,0x1C12,0x3E45,0x00F6,0x2155,0x2DCD,0x1619,
- 0x2903,0x1CF1,0x0758,0x39F7,0x0AA0,0x35F0,0x0262,0x3EFD,
- 0x2289,0x0911,0x36E4,0x017D,0x3AEB,0x1699,0x2A65,0x1907,
- 0x33B3,0x10C5,0x3855,0x093F,0x19DC,0x2A97,0x11C0,0x31AE,
- 0x152C,0x1F38,0x0BD6,0x3599,0x1759,0x20E5,0x3142,0x0754,
- 0x1824,0x354F,0x0483,0x15C4,0x3D8F,0x2742,0x1389,0x3ACB,
- 0x1611,0x32FB,0x1B31,0x08DD,0x1712,0x26AD,0x3B4D,0x0155,
- 0x3860,0x086D,0x3FCA,0x1585,0x3758,0x11F7,0x3307,0x14D1,
- 0x2C31,0x1E7D,0x022A,0x1FD5,0x3081,0x1597,0x2C67,0x1732,
- 0x2981,0x1242,0x1F54,0x3856,0x0EB6,0x2901,0x1195,0x247C,
- 0x3F78,0x0F2E,0x3765,0x0BAC,0x3A05,0x0154,0x3D61,0x17AD,
- 0x050D,0x293A,0x10DA,0x2CD3,0x0E92,0x35D8,0x1F63,0x3D52,
- 0x12FD,0x014D,0x3299,0x1419,0x3D8C,0x0D93,0x364A,0x23D6,
- 0x38AB,0x05A6,0x2BCD,0x2121,0x0198,0x2255,0x2E48,0x03A2,
- 0x1F9F,0x0D41,0x2D6D,0x1E33,0x0DEE,0x300B,0x063B,0x2086,
- 0x31AF,0x00D8,0x172B,0x3BE1,0x1ED3,0x01EF,0x23B5,0x15A5,
- 0x3AD9,0x0E36,0x336E,0x128E,0x3053,0x1868,0x060C,0x3B88,
- 0x0B8B,0x351E,0x1982,0x2511,0x1F7F,0x10ED,0x2A62,0x13C2,
- 0x346D,0x1A49,0x2578,0x1EEC,0x0F29,0x2FC0,0x1295,0x2677,
- 0x01D7,0x2E8F,0x1C1C,0x2120,0x3F99,0x00CE,0x2706,0x08E1,
- 0x39BB,0x23EE,0x307F,0x1C92,0x00A8,0x3753,0x0C68,0x39C1,
- 0x2A6B,0x117A,0x22DF,0x2EA9,0x19F6,0x0182,0x33EB,0x0A82,
- 0x25BB,0x02F2,0x2EB4,0x1FEE,0x3F36,0x0EE2,0x1F43,0x3265,
- 0x0FF1,0x261A,0x1A02,0x30CE,0x09C7,0x256D,0x0125,0x3989,
- 0x0D58,0x3249,0x16C9,0x2B83,0x0A3D,0x26D4,0x00D9,0x32DB,
- 0x0D0F,0x3D07,0x25FD,0x09DE,0x3339,0x1C7F,0x3A7E,0x00B7,
- 0x183D,0x2959,0x0581,0x2BAC,0x1974,0x258E,0x0D7F,0x226D,
- 0x392B,0x0C21,0x3726,0x1D02,0x3076,0x070E,0x2A5B,0x0B04,
- 0x26C8,0x37D9,0x213F,0x0A6A,0x236A,0x3172,0x15C0,0x00C0,
- 0x16D3,0x2F16,0x1994,0x0A7C,0x37B5,0x0E89,0x191B,0x3DDC,
- 0x1568,0x399D,0x22D4,0x077D,0x3FD4,0x2276,0x1A5A,0x35F3,
- 0x0B49,0x3A36,0x24BB,0x06E6,0x3107,0x1B39,0x3781,0x0860,
- 0x1CED,0x2C99,0x0524,0x2AA3,0x0B13,0x3875,0x24B9,0x1504,
- 0x2A49,0x1231,0x2D3B,0x0010,0x297D,0x3B1E,0x08B3,0x2F30,
- 0x0492,0x2C5A,0x112B,0x3FD4,0x23B4,0x0696,0x379F,0x0AB4,
- 0x3E54,0x225F,0x04BE,0x2BD2,0x1342,0x2FAD,0x16DB,0x2C86,
- 0x1AED,0x0535,0x1312,0x3E4F,0x2304,0x15ED,0x26E2,0x1FA4,
- 0x01FB,0x1E18,0x3374,0x0BC4,0x387D,0x2492,0x111F,0x2DCF,
- 0x183B,0x3C79,0x0F41,0x2966,0x040E,0x301E,0x0BCA,0x23CB,
- 0x1C0B,0x2F7D,0x03E6,0x2367,0x1C47,0x3BC3,0x187D,0x20AE,
- 0x266A,0x068D,0x37DE,0x0F7F,0x3DBB,0x1375,0x3A18,0x1BC3,
- 0x2414,0x0549,0x1995,0x2D59,0x1700,0x0711,0x2A7D,0x1BE6,
- 0x356D,0x1123,0x3BAC,0x21DC,0x105E,0x3646,0x1B9C,0x3108,
- 0x1283,0x2BC8,0x231F,0x011E,0x18A0,0x3AB5,0x139F,0x3362,
- 0x1C54,0x098A,0x1636,0x3A43,0x1972,0x06D0,0x21EE,0x3BBB,
- 0x1FC8,0x0EF0,0x3EA0,0x231E,0x131C,0x338E,0x2964,0x0830,
- 0x2371,0x011F,0x1898,0x3218,0x16D1,0x02BE,0x2BE7,0x1077,
- 0x2A85,0x202A,0x0D8C,0x369F,0x11EF,0x2ABC,0x0FC3,0x31F8,
- 0x25F5,0x1141,0x3C84,0x1A50,0x26D7,0x1E95,0x0DF4,0x32CB,
- 0x03BC,0x3D39,0x0F07,0x3822,0x1346,0x1DF3,0x23F5,0x1905,
- 0x38F6,0x0C4C,0x30D7,0x03B0,0x1B96,0x31BA,0x0EC8,0x2C2F,
- 0x1E9C,0x0FFE,0x3A19,0x0CBA,0x3563,0x06C5,0x3B5A,0x0F7B,
- 0x36A1,0x1E4F,0x2B1B,0x0A2B,0x2D87,0x06AF,0x3BDC,0x0E40,
- 0x2969,0x3DE5,0x0602,0x2C23,0x12FF,0x1E56,0x3FB8,0x0665,
- 0x28B6,0x0B80,0x34E0,0x1C96,0x38B4,0x117C,0x2BAA,0x05F9,
- 0x358D,0x0CC1,0x3C63,0x0E6F,0x3546,0x05A1,0x2EEA,0x1043,
- 0x3E68,0x1A40,0x24B1,0x1F05,0x042D,0x310F,0x223A,0x08EA,
- 0x3640,0x1DB7,0x3916,0x02A4,0x3E1D,0x22AA,0x0C9C,0x3184,
- 0x0806,0x2CA7,0x1EFB,0x0371,0x2E1E,0x0869,0x2AE7,0x0303,
- 0x3C5E,0x079B,0x1622,0x3E0A,0x25EF,0x0BBD,0x2895,0x02DB,
- 0x3ED6,0x23BA,0x2F5B,0x040F,0x2B66,0x1D34,0x3072,0x0B89,
- 0x354D,0x26CF,0x0351,0x2F8F,0x1E57,0x04E7,0x2082,0x360D,
- 0x3096,0x1D04,0x3B57,0x0AA7,0x26EC,0x3721,0x14AE,0x3D83,
- 0x0558,0x19F7,0x2E53,0x15F7,0x2826,0x04AD,0x3D04,0x2070,
- 0x0073,0x3545,0x21A7,0x0990,0x364D,0x02A6,0x3FD4,0x22A5,
- 0x1B7B,0x2033,0x2FA4,0x09CE,0x334B,0x05C8,0x3CAB,0x0DB3,
- 0x2639,0x1FF9,0x17CE,0x3660,0x2A0E,0x138E,0x3BC5,0x21A5,
- 0x05EA,0x2F33,0x1645,0x2836,0x1A7D,0x24E6,0x0C25,0x27C2,
- 0x01CD,0x31D9,0x14FC,0x3A66,0x1915,0x3334,0x1259,0x302C,
- 0x1C8C,0x0B10,0x257F,0x0EAE,0x36DB,0x03B4,0x2108,0x3221,
- 0x1401,0x2FBA,0x2277,0x0755,0x166F,0x335E,0x1883,0x3E06,
- 0x14A1,0x2A5A,0x1761,0x2C8B,0x127E,0x2757,0x0C5D,0x34C4,
- 0x0379,0x2E41,0x0B1A,0x3426,0x2842,0x0E91,0x1904,0x2FB3,
- 0x11FA,0x2AA8,0x10FB,0x285E,0x14D8,0x2E5B,0x1EA0,0x128B,
- 0x3D1A,0x237C,0x0D32,0x3864,0x1CDF,0x3F03,0x1369,0x276A,
- 0x16E8,0x3037,0x218F,0x096E,0x1DF7,0x3118,0x150C,0x2C2A,
- 0x17A4,0x078A,0x1B55,0x3450,0x119C,0x3E5C,0x148C,0x2914,
- 0x0604,0x1A56,0x33D9,0x0D17,0x284F,0x3A62,0x166E,0x0B12,
- 0x10E9,0x2CC9,0x1277,0x2A59,0x1B66,0x0902,0x2FA8,0x0C98,
- 0x22B8,0x387F,0x022D,0x3F3A,0x0AE0,0x2CE5,0x0CC8,0x196B,
- 0x2F70,0x0EDA,0x175D,0x3152,0x14BE,0x2D6B,0x180D,0x0ABA,
- 0x310C,0x062A,0x25C9,0x19FF,0x2115,0x285C,0x16D7,0x3237,
- 0x0115,0x3A4E,0x07BA,0x210D,0x0A01,0x272F,0x0072,0x19C1,
- 0x3932,0x1162,0x34D3,0x024F,0x3CC0,0x146F,0x3402,0x178D,
- 0x3EF7,0x1F61,0x087F,0x2249,0x0323,0x2545,0x1F0B,0x047A,
- 0x3633,0x17A7,0x3AFA,0x1B1B,0x224A,0x30E9,0x174E,0x096F,
- 0x3BAE,0x00DA,0x192A,0x3D5C,0x2686,0x0224,0x29E5,0x0A4F,
- 0x2724,0x001A,0x390F,0x07EF,0x1F62,0x31CB,0x1949,0x2436,
- 0x1E5A,0x1183,0x3940,0x17FC,0x0745,0x3C82,0x2016,0x01F9,
- 0x3F4C,0x06F4,0x338A,0x0AAF,0x372D,0x04EF,0x3966,0x2180,
- 0x01EC,0x17F8,0x31D8,0x166D,0x0B45,0x2301,0x3271,0x0C69,
- 0x29A4,0x1080,0x345C,0x1A61,0x36DF,0x04BA,0x399A,0x0E88,
- 0x35A1,0x1EEF,0x3C7F,0x0AD2,0x2755,0x01C4,0x2CD7,0x0DDE,
- 0x39E7,0x2424,0x1209,0x3C2B,0x17A9,0x09E0,0x2900,0x3F05,
- 0x25F1,0x07D0,0x3807,0x03DC,0x3CCE,0x1DDF,0x252E,0x185A,
- 0x30DA,0x10E4,0x269C,0x1CA8,0x33C6,0x1440,0x39A2,0x22C1,
- 0x07ED,0x3EA5,0x29D2,0x0587,0x3C00,0x08C9,0x2552,0x39C6,
- 0x1582,0x3690,0x1082,0x3EBF,0x027C,0x3756,0x0ACF,0x1CB4,
- 0x2B4A,0x12AF,0x27F0,0x3D26,0x15EA,0x3358,0x1D4B,0x2DB7,
- 0x0B42,0x2607,0x1B57,0x2B30,0x0AB5,0x2EF3,0x0583,0x295A,
- 0x1087,0x2E0D,0x1BAE,0x29B2,0x37E2,0x0F9F,0x3F96,0x27B5,
- 0x0D63,0x2A2D,0x0035,0x2CE9,0x09EE,0x1516,0x3994,0x232E,
- 0x1BA7,0x2168,0x2D99,0x0AF1,0x1F30,0x37CB,0x12BF,0x32B5,
- 0x1A2B,0x2E29,0x15A1,0x23A2,0x3F01,0x021F,0x384C,0x097C,
- 0x3CC9,0x226B,0x006C,0x214B,0x2F31,0x13BD,0x34E7,0x24CB,
- 0x1480,0x295C,0x1A19,0x2527,0x1337,0x27EB,0x0BBA,0x306F,
- 0x1C5B,0x36C3,0x06D4,0x20BF,0x2F89,0x006F,0x1B65,0x367A,
- 0x05DD,0x3B40,0x0210,0x2D3E,0x0DCF,0x2A99,0x1CAE,0x2540,
- 0x003E,0x2D80,0x138F,0x29EB,0x103B,0x3884,0x128D,0x322B,
- 0x1BD8,0x090A,0x2CAC,0x005D,0x24CF,0x32A6,0x1C49,0x0277,
- 0x35BF,0x1F66,0x1453,0x2F53,0x0FCF,0x33A7,0x001E,0x3ABC,
- 0x089C,0x1EB2,0x32BC,0x0743,0x18A8,0x29A1,0x038D,0x31CC,
- 0x1E0C,0x122D,0x1F88,0x244B,0x10AF,0x2ACF,0x1F47,0x0175,
- 0x2E1B,0x0CCD,0x28E4,0x13DB,0x3175,0x160C,0x2252,0x3E50,
- 0x0F50,0x3531,0x1D14,0x0315,0x250C,0x0D39,0x3DF3,0x11FF,
- 0x36C4,0x06EB,0x3EE8,0x0F31,0x23FA,0x1BF4,0x3AF2,0x0D33,
- 0x36FA,0x0438,0x344F,0x0B84,0x16F8,0x31A0,0x0A4B,0x1983,
- 0x38CC,0x136B,0x3537,0x1148,0x3E8D,0x277D,0x0275,0x2BE3,
- 0x0D44,0x3663,0x14A9,0x3A11,0x10C9,0x2411,0x1DF1,0x0504,
- 0x3AC5,0x1092,0x3605,0x0BEE,0x1B17,0x2B5E,0x1615,0x28CB,
- 0x142B,0x3287,0x1B69,0x3B3F,0x0FB8,0x2B10,0x0B5B,0x1BEA,
- 0x3775,0x0D66,0x3B65,0x0010,0x3479,0x1921,0x3FC8,0x11DF,
- 0x2C57,0x0E7B,0x2718,0x3E35,0x12DF,0x3907,0x250B,0x0E24,
- 0x2C91,0x191E,0x25B4,0x1252,0x3FD4,0x175E,0x0A05,0x3BDB,
- 0x2067,0x0CDD,0x37B7,0x0593,0x3340,0x1DEF,0x262D,0x043D,
- 0x2124,0x3FB2,0x15AF,0x3719,0x1DDE,0x070D,0x3915,0x153B,
+ 0x0C3E,0x31BE,0x249A,0x0B88,0x2898,0x162F,0x2AEE,0x12D4,
+ 0x20F1,0x3E08,0x0E3C,0x244A,0x3C5C,0x102A,0x36AE,0x0DB5,
+ 0x27D2,0x3774,0x01D0,0x3A3B,0x18C7,0x356C,0x0E6C,0x2938,
+ 0x1AB3,0x3B3E,0x04D9,0x2BF8,0x1C80,0x087C,0x2F7E,0x043B,
+ 0x295E,0x097F,0x30AE,0x1722,0x38C5,0x1F2A,0x0491,0x2B7B,
+ 0x169B,0x2887,0x1413,0x325B,0x03CD,0x2CF4,0x119A,0x2471,
+ 0x19A8,0x2735,0x14AA,0x3D50,0x20F5,0x0141,0x22B3,0x2FA0,
+ 0x0656,0x23CF,0x1BE4,0x3010,0x0712,0x1D9F,0x375C,0x1205,
+ 0x3080,0x06B0,0x2922,0x0307,0x2CC4,0x0823,0x3E98,0x2587,
+ 0x0CA3,0x2954,0x038C,0x3073,0x2549,0x0DE1,0x3124,0x0445,
+ 0x2C5E,0x07B5,0x2A4E,0x0A5E,0x35B0,0x0332,0x2382,0x3192,
+ 0x04A9,0x2C00,0x171D,0x2F1A,0x0DDC,0x2927,0x03A5,0x261E,
+ 0x083F,0x3B04,0x1DFE,0x044C,0x2B6C,0x09BA,0x1735,0x3D78,
+ 0x1D30,0x08BD,0x37CD,0x20D0,0x0682,0x22CF,0x2FCC,0x1155,
+ 0x326E,0x1845,0x2364,0x2C10,0x19E2,0x088A,0x3B49,0x1873,
+ 0x3482,0x0FF4,0x27F5,0x0CD4,0x2E0A,0x1382,0x22D3,0x2B6E,
+ 0x3BFF,0x016F,0x1992,0x3F5F,0x05CB,0x38EF,0x0CFB,0x356B,
+ 0x275C,0x0403,0x2DAF,0x1D82,0x010F,0x2645,0x1A9D,0x2EF8,
+ 0x05D7,0x1C57,0x30C4,0x0BA3,0x2E75,0x0429,0x1DF0,0x3D8E,
+ 0x0960,0x2096,0x3321,0x0EF7,0x3AAE,0x2316,0x1939,0x37FD,
+ 0x1469,0x3B05,0x1034,0x2CAE,0x0842,0x2EB8,0x22EC,0x0C54,
+ 0x3443,0x0143,0x2F86,0x1859,0x39D5,0x15D1,0x3584,0x0019,
+ 0x3C08,0x09C2,0x2B6F,0x073C,0x2F02,0x1B5B,0x3A29,0x1058,
+ 0x1F25,0x3CEB,0x03E2,0x24FA,0x18A2,0x31A8,0x0922,0x2611,
+ 0x1A5B,0x3F46,0x11A2,0x3515,0x1543,0x3105,0x0F0C,0x1FAF,
+ 0x2D16,0x17D3,0x3D90,0x1F42,0x0699,0x3BFD,0x1355,0x37A8,
+ 0x10CD,0x3FA7,0x12A9,0x27DA,0x160A,0x2DBE,0x1AE2,0x10A4,
+ 0x3E93,0x1DD2,0x0A31,0x21BC,0x3BFB,0x155A,0x35CD,0x13C5,
+ 0x32B2,0x22D7,0x105B,0x33BE,0x1AA7,0x221E,0x3243,0x0377,
+ 0x2F55,0x1FFF,0x0EB8,0x32F2,0x1B3E,0x3A3C,0x03AB,0x28B3,
+ 0x0829,0x3F37,0x029E,0x154A,0x3D3D,0x2269,0x14C2,0x2EE5,
+ 0x0798,0x2A1B,0x02FD,0x3251,0x1B18,0x3DEC,0x0467,0x1CB9,
+ 0x104F,0x220F,0x2C3C,0x1118,0x2DD5,0x1ADD,0x2407,0x06E0,
+ 0x1928,0x37FC,0x13AB,0x34E2,0x1772,0x3ABA,0x08A2,0x22D6,
+ 0x3D59,0x10FF,0x25AF,0x1ED2,0x0F89,0x394D,0x23CC,0x14F4,
+ 0x2D0A,0x1286,0x24D3,0x1E4A,0x00A5,0x3409,0x0C91,0x208F,
+ 0x26C4,0x01A7,0x23A8,0x198B,0x35B5,0x0F08,0x3C7E,0x1929,
+ 0x21C5,0x3B6A,0x0D90,0x2594,0x07F0,0x29F6,0x0BF1,0x28A2,
+ 0x13FA,0x30B3,0x1890,0x389C,0x10DB,0x291C,0x0B24,0x259C,
+ 0x31ED,0x0EE0,0x2AC5,0x0C6C,0x3C50,0x157E,0x20B0,0x3B87,
+ 0x04B0,0x1FFC,0x24C1,0x09CD,0x27A8,0x18F8,0x35AD,0x015E,
+ 0x39AB,0x08C8,0x2300,0x1515,0x3478,0x1C1E,0x2378,0x094E,
+ 0x25F0,0x1D94,0x33B2,0x0590,0x3D54,0x0D15,0x3840,0x268E,
+ 0x0882,0x2819,0x36C8,0x1C99,0x0674,0x2E0F,0x09A0,0x2A2F,
+ 0x1C23,0x0126,0x37F3,0x2014,0x0640,0x3AB3,0x112E,0x2A22,
+ 0x14B0,0x3C39,0x2744,0x00D1,0x2BDF,0x1465,0x31C8,0x1330,
+ 0x2DEA,0x1AF8,0x2179,0x2E74,0x0C89,0x2ADF,0x0127,0x1D92,
+ 0x382E,0x162D,0x3CED,0x2143,0x08D9,0x2745,0x180B,0x3045,
+ 0x1F0F,0x3956,0x0857,0x369A,0x207B,0x0256,0x3C98,0x1D3B,
+ 0x2CC1,0x1057,0x28E2,0x0B17,0x2C13,0x155E,0x3148,0x0E65,
+ 0x203F,0x336D,0x0721,0x3F48,0x2A60,0x19D6,0x0853,0x35A3,
+ 0x0335,0x3891,0x0753,0x3F18,0x27C0,0x12E6,0x2CD6,0x06BD,
+ 0x32E4,0x1B13,0x3F98,0x0594,0x2569,0x1E35,0x0265,0x321C,
+ 0x08AF,0x1B82,0x2CAF,0x1304,0x32F8,0x1DED,0x3D27,0x0FFC,
+ 0x34F8,0x1D1A,0x0300,0x21D3,0x32D2,0x04F2,0x3E36,0x1A8F,
+ 0x023B,0x3811,0x1406,0x3350,0x1D51,0x0157,0x2EFF,0x103E,
+ 0x33C9,0x0E9A,0x3728,0x1B00,0x3B2E,0x0523,0x1CD1,0x2A38,
+ 0x11C7,0x1E8F,0x36FE,0x0D0A,0x2762,0x0105,0x2F49,0x1A9A,
+ 0x3244,0x01C8,0x18BA,0x2E6E,0x1DFB,0x24F9,0x0116,0x1861,
+ 0x3520,0x15FA,0x02D0,0x2CCE,0x178F,0x22CB,0x38C1,0x0ED0,
+ 0x3DC7,0x18D5,0x29E2,0x0B5E,0x2E3D,0x16A7,0x2652,0x0C06,
+ 0x317D,0x072F,0x1988,0x355F,0x0C2C,0x248C,0x08F1,0x3834,
+ 0x1FB3,0x0D5B,0x340E,0x064F,0x36BE,0x113B,0x3A1D,0x256B,
+ 0x0DF3,0x2C2B,0x0C0F,0x196C,0x33AB,0x11DA,0x37BC,0x066B,
+ 0x326C,0x0F18,0x1DBD,0x2513,0x14C6,0x3023,0x0F72,0x3425,
+ 0x0907,0x3FC1,0x030D,0x3670,0x2217,0x04DD,0x1CB2,0x3836,
+ 0x026C,0x184D,0x2DA6,0x165B,0x004B,0x2616,0x305D,0x11D1,
+ 0x289B,0x17E4,0x2E62,0x1685,0x0A47,0x370B,0x1855,0x3D62,
+ 0x10E5,0x2E22,0x0E19,0x2BD3,0x1182,0x3A07,0x28F0,0x104D,
+ 0x2048,0x35F4,0x04E2,0x3FC7,0x1A0A,0x0299,0x2183,0x2E4B,
+ 0x05D9,0x25EC,0x3F5E,0x0D2F,0x1D95,0x2A52,0x13A4,0x2DCC,
+ 0x217B,0x1818,0x2C96,0x05A4,0x26C5,0x392A,0x0B6F,0x2B16,
+ 0x1850,0x2E72,0x00A2,0x2C36,0x1320,0x230C,0x3CB8,0x0D59,
+ 0x340F,0x2512,0x0330,0x2D9C,0x185D,0x3B23,0x1204,0x38A8,
+ 0x0EA0,0x2111,0x39EB,0x14D2,0x08DB,0x3AB7,0x1C61,0x30DB,
+ 0x0E0B,0x2457,0x3952,0x1009,0x3E4B,0x01B0,0x1EDD,0x30A0,
+ 0x0562,0x2788,0x0F85,0x3CB0,0x1447,0x357D,0x019B,0x3F72,
+ 0x1003,0x246B,0x3931,0x1196,0x1EA8,0x3EA2,0x18CA,0x2620,
+ 0x018E,0x3A95,0x1703,0x269A,0x1BAF,0x31F0,0x0933,0x19AA,
+ 0x30CD,0x0555,0x24A5,0x39B5,0x00E3,0x29A0,0x0D84,0x247E,
+ 0x02E4,0x2805,0x3D48,0x047B,0x3359,0x0A70,0x2A68,0x1797,
+ 0x2568,0x1414,0x2E1C,0x1C39,0x0D69,0x3DE2,0x2834,0x116C,
+ 0x2978,0x3C1C,0x0968,0x21E9,0x3227,0x13BE,0x1FEA,0x3E14,
+ 0x0BEB,0x349B,0x0D6C,0x20E3,0x30FE,0x1C05,0x02D8,0x245E,
+ 0x1F4C,0x080E,0x386D,0x1EBA,0x313B,0x09E4,0x16F9,0x3E62,
+ 0x26B7,0x0B8A,0x2A64,0x0F94,0x2750,0x3717,0x0B06,0x17E7,
+ 0x3AA6,0x1247,0x2360,0x19CE,0x37B1,0x0C3B,0x3607,0x07B7,
+ 0x39F6,0x0976,0x1E03,0x3FD4,0x0DA2,0x1964,0x34FA,0x22EF,
+ 0x07FB,0x1D79,0x395D,0x2158,0x0954,0x3208,0x15CB,0x2EE6,
+ 0x06FB,0x19A7,0x3FD4,0x13A6,0x3331,0x0BAD,0x2A9B,0x0476,
+ 0x26D3,0x347E,0x0C34,0x2331,0x2BAE,0x0FF8,0x2D57,0x06A6,
+ 0x3D10,0x1E54,0x0B85,0x3219,0x1A77,0x2994,0x0C3F,0x23DD,
+ 0x158B,0x36F8,0x20A9,0x03FB,0x2BE2,0x0EF6,0x2893,0x17B0,
+ 0x2CBF,0x1DAE,0x031B,0x21E6,0x2E89,0x049B,0x324A,0x1101,
+ 0x3032,0x22B0,0x098B,0x3DD1,0x03EF,0x23C9,0x1E0B,0x3F5A,
+ 0x11D3,0x3522,0x0E61,0x1C04,0x2F7A,0x15A6,0x3EA8,0x1AB0,
+ 0x3A8B,0x1875,0x0C74,0x2BF0,0x130B,0x3B22,0x1C73,0x0130,
+ 0x38C0,0x1F32,0x0698,0x3B50,0x1903,0x239D,0x0A5F,0x34A2,
+ 0x2110,0x0F04,0x1DD7,0x380C,0x0C9A,0x3B76,0x052A,0x1AC4,
+ 0x2B8B,0x01E1,0x2442,0x3BC4,0x0545,0x268A,0x39AD,0x0DC6,
+ 0x362A,0x2760,0x1521,0x0042,0x1A4D,0x367C,0x2218,0x038B,
+ 0x1498,0x394F,0x1D77,0x31FB,0x0718,0x2348,0x1CDD,0x2AD3,
+ 0x0E17,0x2ED7,0x0844,0x2CD2,0x0103,0x2691,0x173E,0x2837,
+ 0x12CE,0x3143,0x24A6,0x11A0,0x2DAC,0x2195,0x0439,0x1468,
+ 0x3E12,0x29C5,0x0E00,0x1696,0x3ED9,0x1C46,0x0297,0x2200,
+ 0x385D,0x285D,0x09E5,0x298C,0x05E4,0x24C6,0x16E3,0x3EB8,
+ 0x1CA2,0x0719,0x1FFB,0x3DA7,0x03BE,0x3625,0x16D4,0x2097,
+ 0x28AA,0x04C2,0x2B63,0x1F84,0x0735,0x3784,0x140E,0x3C3D,
+ 0x1DCC,0x08E7,0x31F5,0x1885,0x21E5,0x38DE,0x0A64,0x34BF,
+ 0x05BA,0x3B71,0x1A7B,0x3432,0x0F4D,0x2A95,0x0B0C,0x3C62,
+ 0x1D48,0x0E79,0x2C8C,0x129F,0x2A7C,0x1404,0x2D42,0x0225,
+ 0x29CE,0x16B7,0x3C61,0x21B8,0x0A37,0x348F,0x076C,0x2B43,
+ 0x099B,0x2247,0x352B,0x1647,0x2669,0x0605,0x2E7C,0x225E,
+ 0x0E82,0x3264,0x2709,0x10EC,0x2F20,0x009D,0x2D32,0x1A21,
+ 0x0666,0x3638,0x26B6,0x0461,0x29DD,0x0F63,0x2766,0x360E,
+ 0x103F,0x3913,0x1D47,0x0F0D,0x2D70,0x1138,0x1E34,0x29C0,
+ 0x04A2,0x1803,0x3CD5,0x200D,0x2B19,0x0789,0x2D82,0x1CA3,
+ 0x3056,0x22A3,0x00BF,0x1839,0x386E,0x10EB,0x3DEA,0x019F,
+ 0x3540,0x1E70,0x397E,0x1695,0x3CA0,0x115A,0x3418,0x0419,
+ 0x3C09,0x1BFB,0x0071,0x36C9,0x078E,0x3B0B,0x1CE0,0x3252,
+ 0x1777,0x0355,0x27E0,0x3090,0x0636,0x2452,0x2CEF,0x0C11,
+ 0x1450,0x1E26,0x35CF,0x1121,0x3C3E,0x1488,0x317E,0x0F69,
+ 0x2C58,0x181A,0x3044,0x10A7,0x1D41,0x2770,0x0AE5,0x333F,
+ 0x11BE,0x3A75,0x10E2,0x2F4A,0x169C,0x224E,0x3164,0x032F,
+ 0x2EC7,0x2317,0x1360,0x3ED8,0x078C,0x1B19,0x2F00,0x15C5,
+ 0x270A,0x10F9,0x2915,0x07AC,0x3D66,0x1724,0x2767,0x2083,
+ 0x055E,0x385A,0x1A32,0x35EC,0x0800,0x3A88,0x0DAA,0x3741,
+ 0x0B75,0x27AE,0x0422,0x2D94,0x1341,0x25AE,0x1F93,0x143A,
+ 0x1C91,0x2FC8,0x0066,0x3EE5,0x0F4E,0x36E3,0x1511,0x3E1E,
+ 0x1DB3,0x0AA4,0x2101,0x35AA,0x0C70,0x3982,0x11E8,0x3F12,
+ 0x1D27,0x2333,0x1301,0x2F92,0x1790,0x33B0,0x20D2,0x082E,
+ 0x1E6A,0x25DE,0x06DB,0x3289,0x1764,0x3F6B,0x089F,0x32AA,
+ 0x1C6F,0x2FC9,0x0B2A,0x336F,0x1089,0x3B85,0x0CF8,0x378E,
+ 0x06C1,0x167F,0x3BD4,0x2555,0x0C8E,0x2C69,0x15F2,0x3154,
+ 0x1A80,0x053A,0x26F4,0x0A46,0x212F,0x2E16,0x0E4E,0x29B0,
+ 0x1039,0x2384,0x2F74,0x1502,0x28C3,0x1271,0x2AAE,0x0BF6,
+ 0x254E,0x3893,0x0AB6,0x1BA9,0x364B,0x0F80,0x3A79,0x1FC5,
+ 0x3DC6,0x0047,0x2169,0x2E4D,0x0D76,0x2B7C,0x026B,0x369C,
+ 0x09BF,0x3BD0,0x008F,0x2271,0x3861,0x0EE9,0x3F2E,0x0240,
+ 0x2596,0x19D7,0x33EA,0x0053,0x3FC0,0x0952,0x1B2A,0x2B32,
+ 0x0CF7,0x3A8C,0x00B2,0x1C72,0x2D75,0x2346,0x02C3,0x3DB6,
+ 0x0D0B,0x36BB,0x1539,0x3003,0x1C97,0x0205,0x3524,0x1085,
+ 0x2F3A,0x236F,0x008E,0x2017,0x30F3,0x1909,0x2429,0x1C27,
+ 0x3087,0x0FD8,0x332A,0x1E64,0x3B7C,0x01F5,0x3829,0x294A,
+ 0x342B,0x0D5C,0x2A12,0x1E98,0x3150,0x09F7,0x27B3,0x043F,
+ 0x2921,0x3A4A,0x0283,0x1D0B,0x2A88,0x1607,0x27A9,0x0B4D,
+ 0x30D6,0x0202,0x38EB,0x0A98,0x3FD4,0x0134,0x15AC,0x3AE0,
+ 0x2A35,0x13EB,0x3CF3,0x21BE,0x00E7,0x2847,0x1F87,0x0E5B,
+ 0x3B2D,0x13B1,0x2832,0x040A,0x24F1,0x18A1,0x29B6,0x123A,
+ 0x27B2,0x341B,0x0901,0x1BD3,0x3024,0x046B,0x2889,0x0D50,
+ 0x2401,0x375F,0x1294,0x32AB,0x1B75,0x0614,0x3F16,0x17BB,
+ 0x35AE,0x0AFD,0x19AF,0x3D9D,0x0CF9,0x3535,0x01EA,0x3D22,
+ 0x207E,0x10F3,0x337E,0x2387,0x136E,0x2A15,0x0450,0x16CF,
+ 0x25DD,0x30EA,0x1925,0x04E1,0x377D,0x1DBB,0x260F,0x1A00,
+ 0x2054,0x272C,0x14E9,0x3229,0x0601,0x2EE9,0x2172,0x1B68,
+ 0x301A,0x0805,0x2481,0x1ECC,0x0F15,0x3459,0x2687,0x1128,
+ 0x32D3,0x1659,0x2968,0x35EE,0x0D86,0x3986,0x13E3,0x2132,
+ 0x2D9A,0x0021,0x2B40,0x09F0,0x3384,0x229B,0x0BB7,0x3B25,
+ 0x1E72,0x14F3,0x3EF1,0x0F2C,0x26E1,0x034B,0x3CC3,0x070A,
+ 0x2161,0x3E76,0x15EF,0x0938,0x1AE0,0x2BE4,0x16DC,0x0592,
+ 0x11F3,0x39B6,0x17D8,0x080C,0x1A90,0x2C7A,0x12AE,0x33CD,
+ 0x0F9D,0x2381,0x1807,0x3D08,0x07A3,0x33A2,0x03BB,0x3736,
+ 0x16C1,0x28BB,0x193C,0x2BC9,0x1166,0x2257,0x3292,0x198C,
+ 0x0373,0x3033,0x0B57,0x1BC7,0x3600,0x120B,0x381D,0x23D9,
+ 0x01F7,0x2C73,0x0FA3,0x3EF4,0x14FB,0x34B3,0x01C0,0x3D88,
+ 0x1FA5,0x0F4F,0x20DC,0x3F13,0x11F6,0x363D,0x1408,0x3B44,
+ 0x0752,0x1D91,0x2A16,0x0250,0x3A7B,0x252F,0x13FC,0x2BC5,
+ 0x02F7,0x25C6,0x3275,0x04CB,0x235A,0x1C3B,0x2FCF,0x1893,
+ 0x072B,0x2C4C,0x1A31,0x0131,0x3BD6,0x0C64,0x3332,0x229A,
+ 0x0957,0x126F,0x342A,0x27D1,0x153D,0x0AAE,0x3E26,0x055A,
+ 0x3470,0x0B79,0x3990,0x1E32,0x2B4F,0x177B,0x0C9B,0x3BA8,
+ 0x1387,0x3671,0x0C29,0x3B29,0x2818,0x198F,0x0435,0x3D71,
+ 0x236C,0x0638,0x1FE4,0x09DA,0x2631,0x19AC,0x3100,0x084A,
+ 0x1E9B,0x3AC4,0x1948,0x2592,0x0F99,0x393E,0x19DE,0x27FE,
+ 0x06E8,0x34AA,0x09CB,0x2EF4,0x121C,0x3378,0x1520,0x2E6B,
+ 0x1856,0x0010,0x2A58,0x22CC,0x3552,0x0B58,0x3FD4,0x20F3,
+ 0x2482,0x03A4,0x2BA1,0x1FB2,0x3BBA,0x01D6,0x384F,0x1A08,
+ 0x3074,0x0C13,0x2D03,0x12E7,0x287E,0x19CA,0x24A4,0x1417,
+ 0x2C81,0x0CB0,0x3D4D,0x05C5,0x1E25,0x2E51,0x0996,0x241F,
+ 0x34D1,0x110C,0x2704,0x2ED3,0x0A6F,0x2BD7,0x0714,0x18FB,
+ 0x34FE,0x1FCC,0x3188,0x0668,0x291D,0x0C19,0x2EB0,0x1C2B,
+ 0x0553,0x3231,0x2622,0x02CE,0x29C9,0x0A88,0x1F6E,0x2DBB,
+ 0x188D,0x3EB4,0x101E,0x2F21,0x1FDF,0x08D7,0x3650,0x0C95,
+ 0x38E3,0x1EB3,0x0F34,0x292D,0x3A4C,0x0904,0x159C,0x2759,
+ 0x398A,0x0E41,0x3F6D,0x25F4,0x152A,0x2E97,0x1176,0x3809,
+ 0x1CC5,0x39F5,0x0811,0x1B64,0x3AAB,0x21CE,0x1742,0x2D3C,
+ 0x119E,0x29B9,0x1AF3,0x07A1,0x135D,0x37BD,0x2650,0x0503,
+ 0x298E,0x0FA4,0x2D02,0x1734,0x0688,0x3832,0x219D,0x0B9E,
+ 0x18C0,0x3892,0x2A9F,0x16F0,0x3C6B,0x04B7,0x22EA,0x37DA,
+ 0x0E18,0x243D,0x0662,0x3FB6,0x1E4E,0x0501,0x2E2D,0x0ECF,
+ 0x31A1,0x139B,0x25CA,0x1B8F,0x39CB,0x0880,0x2AE2,0x0A96,
+ 0x36F7,0x1CF5,0x3947,0x0693,0x17BD,0x28BF,0x10CA,0x3050,
+ 0x1B3C,0x3CEF,0x1086,0x34BE,0x0E5E,0x2613,0x2137,0x06FD,
+ 0x1FF1,0x390E,0x056B,0x3579,0x0EBC,0x3E61,0x0D4C,0x3A26,
+ 0x051D,0x335F,0x0FEC,0x251F,0x3706,0x150B,0x3C85,0x1332,
+ 0x1FAA,0x3E60,0x058E,0x179A,0x3BF0,0x138A,0x2649,0x3D7D,
+ 0x1551,0x091E,0x1B62,0x3730,0x1776,0x3A54,0x12F7,0x2423,
+ 0x3813,0x0D8B,0x18CD,0x33B8,0x1599,0x39C2,0x23B3,0x005B,
+ 0x2904,0x0B7D,0x342E,0x197A,0x0DD4,0x3093,0x227D,0x1A06,
+ 0x29CF,0x0816,0x3E78,0x1CC7,0x10BE,0x2104,0x3665,0x03A0,
+ 0x1F31,0x3220,0x05EB,0x1DCF,0x36BA,0x07C7,0x281C,0x0237,
+ 0x2D61,0x1609,0x2118,0x2BEA,0x0147,0x2F35,0x08E4,0x2302,
+ 0x381F,0x02AD,0x3F8D,0x23F8,0x3146,0x016A,0x1FAE,0x34BD,
+ 0x18EB,0x3DF1,0x0314,0x213D,0x2E5F,0x1084,0x2C20,0x1CA6,
+ 0x31A4,0x12E3,0x0269,0x3021,0x0E69,0x3421,0x0BE6,0x1D01,
+ 0x2C59,0x1620,0x2FB2,0x11D5,0x3242,0x21A6,0x178B,0x3DF5,
+ 0x0290,0x20F4,0x3BBC,0x046A,0x1FE3,0x2508,0x1A5E,0x321F,
+ 0x0EE3,0x28EC,0x1308,0x252B,0x3B1F,0x0318,0x366C,0x08D8,
+ 0x3308,0x152D,0x2F43,0x05E0,0x1D9A,0x3296,0x157A,0x3F8E,
+ 0x11BC,0x257D,0x1BDD,0x21CB,0x2E35,0x018C,0x2962,0x1AFC,
+ 0x268D,0x164E,0x2FD6,0x200E,0x07C8,0x2951,0x02CF,0x2BFD,
+ 0x0875,0x1A11,0x3217,0x221C,0x027B,0x314B,0x1AF7,0x0428,
+ 0x2F09,0x1EB7,0x2B61,0x0DA9,0x266C,0x0354,0x2CB7,0x09F9,
+ 0x1A4E,0x2AAA,0x3B1B,0x098D,0x2F8C,0x069A,0x1AD5,0x3CDE,
+ 0x1314,0x2BF5,0x03CC,0x244C,0x3D79,0x15EC,0x00CC,0x3BB9,
+ 0x138D,0x2167,0x2C93,0x018B,0x3786,0x2868,0x0E9E,0x30E8,
+ 0x1074,0x246D,0x190A,0x2DC2,0x0EED,0x2B21,0x12ED,0x3C94,
+ 0x2211,0x057A,0x3F08,0x0DD0,0x34E1,0x1233,0x3CDB,0x1BD9,
+ 0x0EA6,0x31D5,0x17EA,0x0ABB,0x1ED8,0x3AD1,0x14A5,0x2BB8,
+ 0x09B4,0x23DC,0x1BC9,0x39FF,0x1467,0x3510,0x0135,0x3BB5,
+ 0x08B7,0x2776,0x3FA6,0x21C7,0x1B98,0x290D,0x14B5,0x3E89,
+ 0x0341,0x3580,0x0AB1,0x2A23,0x016B,0x37BB,0x092B,0x2646,
+ 0x1ADC,0x2D77,0x105F,0x2A8D,0x0D55,0x311A,0x01B4,0x21C6,
+ 0x3E0D,0x04ED,0x34D9,0x0A5A,0x1FB8,0x2E4E,0x13B7,0x205E,
+ 0x00C6,0x295D,0x0BA9,0x24C9,0x3DA6,0x03E1,0x298D,0x0AC2,
+ 0x2F96,0x002F,0x3C8B,0x0A26,0x1926,0x37D5,0x1366,0x34F5,
+ 0x0BB6,0x3C27,0x00AE,0x1AAB,0x3B20,0x0E56,0x3543,0x1068,
+ 0x39FE,0x2528,0x0F26,0x380A,0x1E65,0x0FE1,0x3958,0x2123,
+ 0x0D20,0x33F1,0x0082,0x3C53,0x11D8,0x358A,0x15C7,0x3FD4,
+ 0x220B,0x0113,0x201A,0x1393,0x24E1,0x1DB2,0x312D,0x0F75,
+ 0x3549,0x16DE,0x38B3,0x1DE8,0x078F,0x331A,0x203E,0x2AFB,
+ 0x056C,0x34B6,0x15B4,0x2664,0x1E2B,0x0697,0x3CCC,0x1ACB,
+ 0x2A43,0x0A16,0x3820,0x02CA,0x3E3A,0x1D23,0x3147,0x0B59,
+ 0x1BE2,0x2FF4,0x13AF,0x26C7,0x1840,0x299B,0x04AB,0x2DF6,
+ 0x210C,0x0854,0x228F,0x2FD1,0x1072,0x27F3,0x08BE,0x1D31,
+ 0x38CF,0x11FB,0x32D8,0x0778,0x29AC,0x0C3A,0x26EE,0x0FBC,
+ 0x2F24,0x1E59,0x1529,0x0973,0x3A2F,0x00FA,0x31F1,0x1A2C,
+ 0x2558,0x129C,0x3CC2,0x18A4,0x277F,0x1310,0x304C,0x1584,
+ 0x3909,0x0B2E,0x3577,0x17CD,0x3FD4,0x1640,0x37E4,0x0C01,
+ 0x1E58,0x2EC1,0x1144,0x2C32,0x19C9,0x0CFA,0x3DE6,0x2667,
+ 0x3914,0x0EC1,0x3733,0x20D5,0x0F47,0x2EC9,0x1322,0x3538,
+ 0x1884,0x2B04,0x14CA,0x3235,0x2127,0x0944,0x2B54,0x0626,
+ 0x2D49,0x1278,0x2290,0x3240,0x13B0,0x279E,0x1707,0x2DC5,
+ 0x205F,0x0010,0x2B53,0x0C17,0x2F79,0x2597,0x09BD,0x288E,
+ 0x3EAD,0x12A3,0x245D,0x1D03,0x2DC4,0x0ABE,0x28BC,0x076B,
+ 0x2F05,0x1709,0x2913,0x3DC5,0x03FE,0x38FD,0x0B0A,0x27CC,
+ 0x053C,0x2608,0x0CEB,0x2E3A,0x1B23,0x280E,0x0A1B,0x170C,
+ 0x399B,0x1BCC,0x08D4,0x33A8,0x0CEA,0x2D5B,0x1F74,0x0012,
+ 0x3B62,0x1451,0x2794,0x16F3,0x23C1,0x063C,0x1756,0x35B1,
+ 0x2560,0x0A1A,0x32EF,0x032D,0x3731,0x0CA4,0x39B2,0x14C3,
+ 0x35CE,0x1C37,0x3C54,0x040B,0x363E,0x1660,0x3ED4,0x2547,
+ 0x00C5,0x28FF,0x0DB7,0x2FC7,0x1D05,0x3F35,0x1345,0x372A,
+ 0x228D,0x03CB,0x3475,0x2390,0x1889,0x2084,0x269D,0x07F3,
+ 0x3367,0x1F26,0x05ED,0x2C21,0x0CF2,0x3BDD,0x1D8D,0x05C1,
+ 0x2897,0x1F02,0x00E6,0x2CED,0x069E,0x2864,0x133E,0x2B76,
+ 0x14EC,0x2310,0x3BF9,0x0183,0x3796,0x2230,0x0715,0x1917,
+ 0x1239,0x2ADA,0x1D22,0x07F6,0x3A0D,0x1B90,0x23FE,0x0772,
+ 0x3B86,0x0BF5,0x27D4,0x0468,0x3AF5,0x1C06,0x2216,0x3ECE,
+ 0x0E68,0x1E97,0x3885,0x0AED,0x2B05,0x04E6,0x3EEB,0x092E,
+ 0x1B6F,0x3679,0x1644,0x3FB7,0x05F6,0x1981,0x31D2,0x169F,
+ 0x076E,0x20B4,0x38D6,0x0595,0x1825,0x328D,0x1D55,0x3888,
+ 0x10B4,0x369D,0x0C73,0x1B0E,0x2D36,0x1518,0x2B3E,0x194B,
+ 0x3293,0x1581,0x3C67,0x0206,0x3588,0x12C4,0x3F49,0x22F0,
+ 0x0DCD,0x3017,0x20E0,0x118C,0x3FB4,0x1367,0x356A,0x17B7,
+ 0x2224,0x31AC,0x0886,0x2F60,0x0D36,0x3A1E,0x28F5,0x00A7,
+ 0x19BE,0x3B0C,0x15C2,0x2906,0x1B0A,0x2488,0x0FA9,0x288B,
+ 0x0026,0x2A2B,0x0E20,0x26FA,0x0C7B,0x2DC0,0x05F8,0x1A9F,
+ 0x358F,0x154D,0x3C9F,0x1851,0x02B0,0x20CB,0x2867,0x0599,
+ 0x182A,0x39A8,0x0EE1,0x2F9E,0x06B8,0x355E,0x0CC6,0x3B8D,
+ 0x0EA3,0x23C3,0x3850,0x1016,0x3400,0x0400,0x2420,0x372B,
+ 0x0E1D,0x3CFA,0x24AF,0x127B,0x32B9,0x0CC3,0x3B4C,0x03DB,
+ 0x3681,0x0858,0x1B6A,0x2827,0x0FDF,0x2F5E,0x1DB4,0x2D60,
+ 0x3CBC,0x02D4,0x324F,0x1A10,0x26E6,0x0165,0x30DE,0x1EDF,
+ 0x110F,0x31BC,0x176F,0x2BB4,0x106B,0x2ED4,0x021A,0x1871,
+ 0x3301,0x24DD,0x0393,0x2F2F,0x1CAF,0x31C4,0x1217,0x2439,
+ 0x30D8,0x0CB9,0x297F,0x1445,0x23B9,0x3AC3,0x0186,0x36F2,
+ 0x1C9A,0x3086,0x0E90,0x26B2,0x3E19,0x1471,0x0236,0x216D,
+ 0x2B0E,0x04FC,0x309B,0x2434,0x0891,0x3408,0x0180,0x3FA2,
+ 0x0915,0x2CBC,0x1173,0x28E7,0x0EFC,0x25A9,0x045C,0x2DFD,
+ 0x1E09,0x0274,0x37E5,0x2716,0x03EE,0x2984,0x0A44,0x2E69,
+ 0x0512,0x1EAD,0x393B,0x1A5C,0x33E4,0x1F4D,0x1197,0x3FD4,
+ 0x20D3,0x075E,0x2CB5,0x0B8C,0x3D3B,0x05B5,0x335B,0x12EA,
+ 0x3E65,0x15C9,0x3511,0x1942,0x3B5F,0x1446,0x2399,0x317F,
+ 0x0A09,0x2B1D,0x0541,0x2374,0x37E8,0x0B05,0x35BB,0x1C32,
+ 0x2CE2,0x0A8D,0x2A67,0x16A0,0x3D2A,0x1319,0x2B56,0x1726,
+ 0x2D4C,0x01C9,0x1B15,0x3089,0x146D,0x29B1,0x0C04,0x1C4B,
+ 0x2F19,0x1676,0x08C2,0x3A00,0x22B7,0x1BFE,0x213E,0x2F25,
+ 0x0F62,0x2004,0x33A3,0x144B,0x3F85,0x0425,0x35A5,0x09FA,
+ 0x163B,0x25A7,0x13FD,0x3F40,0x1193,0x3655,0x149D,0x3889,
+ 0x21F1,0x0282,0x3F1F,0x0DAF,0x35C3,0x1536,0x395E,0x27BF,
+ 0x0841,0x15D7,0x3D24,0x183E,0x0DFB,0x2102,0x37C5,0x0239,
+ 0x18ED,0x3B5D,0x048B,0x3483,0x0ADD,0x1ED4,0x2AA4,0x0F82,
+ 0x2C05,0x03AD,0x364E,0x1A9E,0x08F7,0x230E,0x3AE6,0x19CF,
+ 0x0EC9,0x3C77,0x13CE,0x1ED1,0x3ABF,0x111B,0x2370,0x0ED6,
+ 0x24B3,0x1BCA,0x37A9,0x06F6,0x3B24,0x18FE,0x368D,0x11F4,
+ 0x3C22,0x225B,0x0B95,0x184E,0x31F6,0x1CFA,0x385C,0x103D,
+ 0x3D74,0x0D5E,0x24AD,0x01E4,0x2681,0x082F,0x2E01,0x0DE5,
+ 0x274C,0x3666,0x10E8,0x3066,0x16AE,0x2ACD,0x1968,0x264F,
+ 0x0BFE,0x2C9E,0x06C9,0x2F03,0x0212,0x2A87,0x0D8D,0x1EF3,
+ 0x3A7A,0x199B,0x325D,0x10B8,0x2A1F,0x1DC0,0x0F24,0x30A5,
+ 0x144E,0x3E34,0x1FCB,0x021E,0x1E15,0x28CE,0x0462,0x32A1,
+ 0x1136,0x3F7E,0x27DB,0x077C,0x1F7E,0x3E49,0x1843,0x350F,
+ 0x0333,0x20B6,0x2BF3,0x1918,0x025C,0x35B9,0x0A0E,0x1863,
+ 0x3D73,0x25FA,0x05B3,0x2B17,0x0C14,0x24A3,0x172D,0x28AE,
+ 0x32DE,0x0AFE,0x2A51,0x0559,0x2DEB,0x09DC,0x2A9A,0x0637,
+ 0x2D12,0x158E,0x1FD2,0x26DB,0x0738,0x2449,0x0B16,0x1D2B,
+ 0x3720,0x294E,0x0C51,0x2660,0x398B,0x070C,0x2738,0x1C52,
+ 0x2C6B,0x0FA1,0x27F4,0x12EF,0x2E84,0x1510,0x21B2,0x3D11,
+ 0x0BCF,0x278F,0x1177,0x2CDF,0x1DE4,0x2FC4,0x065E,0x34A3,
+ 0x22A7,0x092D,0x31EF,0x028B,0x283D,0x186F,0x3746,0x1C88,
+ 0x334E,0x0353,0x2148,0x2E91,0x145C,0x2991,0x0BFD,0x2792,
+ 0x07CE,0x32F1,0x1C7A,0x3A08,0x14F7,0x0779,0x2285,0x2BD5,
+ 0x1613,0x2A7B,0x1542,0x3BCE,0x12AA,0x3766,0x17E2,0x327B,
+ 0x04C7,0x1D67,0x23D3,0x01A9,0x3922,0x0A81,0x3626,0x02E7,
+ 0x3A72,0x1B38,0x249E,0x1236,0x37BE,0x16EE,0x3D1C,0x0387,
+ 0x262A,0x0C88,0x2150,0x3E92,0x066D,0x24BF,0x3C43,0x003D,
+ 0x2688,0x07B3,0x337A,0x1B10,0x3689,0x0FF9,0x3AF3,0x0A59,
+ 0x249C,0x1EB5,0x1246,0x39EE,0x238E,0x0050,0x2B4E,0x0DBF,
+ 0x2573,0x3EBE,0x0F7D,0x3709,0x2713,0x1187,0x2DB3,0x226A,
+ 0x009F,0x16AC,0x3A37,0x1AB1,0x3435,0x1297,0x3ADF,0x05F5,
+ 0x1D6B,0x3BCD,0x0F64,0x378A,0x194C,0x23B8,0x0FC0,0x3D32,
+ 0x19A5,0x393A,0x0579,0x345B,0x1AB5,0x3DB4,0x13AE,0x2CB4,
+ 0x04A8,0x1EE4,0x32A0,0x015F,0x1DD5,0x3336,0x0D0C,0x3DF9,
+ 0x08B8,0x3582,0x1D7F,0x3DA9,0x02A1,0x376F,0x07C0,0x1AEE,
+ 0x338C,0x1749,0x3BEE,0x012D,0x3970,0x0C93,0x2809,0x104C,
+ 0x2D64,0x1946,0x20BB,0x3E7E,0x0BA2,0x3016,0x05E5,0x29C3,
+ 0x0C1D,0x3E31,0x1819,0x099D,0x33D1,0x003C,0x3049,0x16A1,
+ 0x2B7A,0x13C1,0x2D25,0x013B,0x2342,0x3E02,0x192F,0x02B2,
+ 0x3514,0x06DE,0x30F4,0x099F,0x2C9B,0x1E4C,0x034E,0x2047,
+ 0x38A0,0x13F8,0x3DD4,0x1F3E,0x11E9,0x296B,0x1479,0x2DA0,
+ 0x21C9,0x0F7E,0x3200,0x20A8,0x092A,0x2C04,0x1056,0x2FEC,
+ 0x1652,0x3933,0x0194,0x1AAC,0x2DE8,0x0D21,0x204B,0x320F,
+ 0x1258,0x2C06,0x0F57,0x2822,0x0B7A,0x2EC0,0x2207,0x1B9D,
+ 0x3778,0x0534,0x2F81,0x09DB,0x19F1,0x3632,0x1402,0x3A76,
+ 0x1D0C,0x09A2,0x315F,0x05FA,0x1B29,0x3F26,0x0771,0x38DF,
+ 0x1D5C,0x30B8,0x0D64,0x27A5,0x0213,0x29AF,0x0DE7,0x2CEE,
+ 0x004F,0x2281,0x2FE7,0x1DEE,0x036A,0x31E6,0x1C43,0x2628,
+ 0x0B20,0x22A1,0x2DF7,0x0D12,0x2A21,0x0078,0x30C6,0x1BC8,
+ 0x3B79,0x0ED3,0x2319,0x3F58,0x12BC,0x28CD,0x1F49,0x11DE,
+ 0x3040,0x16FB,0x06B3,0x229E,0x2B80,0x111E,0x312C,0x2409,
+ 0x04CC,0x296A,0x0D54,0x2523,0x1365,0x33A9,0x14DC,0x3F75,
+ 0x001D,0x3805,0x0DF5,0x265B,0x1E20,0x106A,0x3A45,0x164B,
+ 0x2EE7,0x11BD,0x2BA2,0x2206,0x1C33,0x3D4A,0x0E0C,0x3877,
+ 0x04A0,0x3E9A,0x0C7E,0x1EC7,0x2F83,0x0AAB,0x3353,0x2128,
+ 0x0F4B,0x3EF6,0x198E,0x23DE,0x0F06,0x3D17,0x1A23,0x2A37,
+ 0x0A33,0x2B48,0x07B4,0x279C,0x3508,0x0641,0x3EDE,0x1CE5,
+ 0x0974,0x371D,0x03E3,0x3FAB,0x19D5,0x221B,0x340A,0x074D,
+ 0x2932,0x0E2D,0x253F,0x3612,0x13C8,0x384E,0x18A9,0x0A0B,
+ 0x3B30,0x1E81,0x3710,0x0588,0x3F00,0x1802,0x00A6,0x3197,
+ 0x0CBE,0x299A,0x15E0,0x32F3,0x2524,0x0B4A,0x2953,0x0676,
+ 0x2E30,0x1715,0x23DB,0x1DF2,0x2FF1,0x142F,0x2621,0x0EC4,
+ 0x2967,0x08EF,0x36CD,0x136A,0x3CE0,0x1826,0x3724,0x1A74,
+ 0x346C,0x1595,0x089A,0x2694,0x3DF7,0x0C86,0x3518,0x00F3,
+ 0x36F1,0x129B,0x1E28,0x3BC6,0x16F6,0x368B,0x238B,0x0909,
+ 0x1665,0x2F93,0x17C6,0x09E7,0x2EA4,0x0436,0x3A25,0x2472,
+ 0x00F1,0x2853,0x36CA,0x1923,0x0970,0x3A73,0x1F39,0x121F,
+ 0x3F3D,0x15E7,0x305A,0x18B4,0x2A27,0x047C,0x2C61,0x1C28,
+ 0x2580,0x16C8,0x2F62,0x041F,0x3492,0x27AA,0x1FD4,0x00D7,
+ 0x1F1B,0x3659,0x0509,0x3992,0x107A,0x24D4,0x1A57,0x23B6,
+ 0x1F5A,0x0FD9,0x2684,0x3B42,0x1172,0x28CC,0x1325,0x2DD4,
+ 0x1C34,0x25BC,0x00F5,0x36DC,0x1F91,0x05B8,0x337D,0x1507,
+ 0x3B6D,0x129D,0x31E7,0x0EB1,0x1DF4,0x241B,0x0E77,0x3159,
+ 0x1827,0x29A3,0x1E83,0x0D53,0x2E4A,0x008C,0x1B7A,0x3DD9,
+ 0x14E0,0x32C7,0x1BF8,0x08DE,0x2AF3,0x03BA,0x2F72,0x272D,
+ 0x16B4,0x0322,0x1A5D,0x2D14,0x10FA,0x20CF,0x2AC3,0x1546,
+ 0x3D87,0x1062,0x38F1,0x0276,0x1DC2,0x3C28,0x162A,0x347D,
+ 0x0FDC,0x3882,0x0123,0x3B91,0x0B11,0x2B2C,0x02F3,0x31AA,
+ 0x1245,0x2C97,0x1993,0x243E,0x0678,0x2DD9,0x0948,0x20BE,
+ 0x0B9D,0x27C6,0x3969,0x17A8,0x10AE,0x2C0E,0x1430,0x299D,
+ 0x0DD1,0x3046,0x0398,0x24AE,0x09A5,0x1F67,0x0FEA,0x3430,
+ 0x2107,0x02D5,0x389A,0x21BA,0x1A76,0x3485,0x0BB5,0x1C2E,
+ 0x3CB7,0x20BA,0x0F54,0x2E21,0x1CBE,0x251A,0x0070,0x2EDF,
+ 0x0A2D,0x34E6,0x0683,0x3819,0x0B7C,0x3C96,0x21EF,0x09A6,
+ 0x3166,0x06F0,0x1CDE,0x39A7,0x15DC,0x07FF,0x3DB0,0x1AEC,
+ 0x3128,0x0F0A,0x275F,0x0B63,0x2DAB,0x0382,0x313E,0x094D,
+ 0x2A0D,0x35B2,0x1ABA,0x06CF,0x3444,0x0446,0x3A7F,0x07FE,
+ 0x37CA,0x0C39,0x2B55,0x1134,0x308A,0x26DC,0x0CCE,0x2D2C,
+ 0x0067,0x2491,0x1BFC,0x3812,0x037F,0x3AE4,0x1F9C,0x00FB,
+ 0x3C31,0x080B,0x2504,0x3973,0x1151,0x3684,0x242D,0x0B66,
+ 0x2A66,0x04D4,0x3BE3,0x1FFA,0x111A,0x3FD4,0x20ED,0x0776,
+ 0x343B,0x1F94,0x3CB5,0x094F,0x2476,0x351C,0x0D7B,0x2E56,
+ 0x0448,0x265E,0x20FB,0x18CE,0x2CFC,0x080D,0x2728,0x03A7,
+ 0x2BBB,0x1A09,0x27D3,0x111D,0x33F3,0x1513,0x3C56,0x1EFA,
+ 0x35EA,0x0417,0x3E6A,0x0C99,0x3282,0x14F9,0x2559,0x3EF0,
+ 0x2C45,0x1BBD,0x0238,0x30F9,0x2198,0x0667,0x3A93,0x1CB8,
+ 0x3E8B,0x18C8,0x2085,0x3355,0x15BE,0x3FD4,0x22FC,0x067E,
+ 0x3CA9,0x2A6C,0x0CE4,0x3189,0x065B,0x25A5,0x1864,0x2D83,
+ 0x14AC,0x09FB,0x3908,0x03EC,0x3E63,0x0E75,0x3548,0x14EA,
+ 0x2AFC,0x1B9F,0x260B,0x1266,0x2D13,0x1AE9,0x0FC9,0x371A,
+ 0x1571,0x3B8C,0x22D9,0x0A72,0x21AF,0x2DA9,0x0F8C,0x2AE8,
+ 0x08FD,0x3CBE,0x1E91,0x34DF,0x13A8,0x3F33,0x152F,0x3725,
+ 0x1680,0x0244,0x30BE,0x2400,0x1291,0x2CC0,0x1B8B,0x243B,
+ 0x171C,0x326D,0x1A87,0x3AC0,0x0B03,0x1D83,0x3E32,0x1019,
+ 0x1EC8,0x343C,0x06A5,0x1872,0x2BEC,0x1418,0x3029,0x25A6,
+ 0x12D0,0x34A4,0x173D,0x04FB,0x2878,0x1F48,0x1225,0x37D4,
+ 0x180A,0x2ED5,0x1293,0x2661,0x331F,0x0BB2,0x19DB,0x3A1B,
+ 0x1388,0x2B28,0x11CA,0x320D,0x1CFE,0x064A,0x3B9D,0x2028,
+ 0x1A3B,0x33EC,0x0BA0,0x3F3B,0x0F3C,0x3592,0x12C7,0x3DC0,
+ 0x1DA4,0x0937,0x32C0,0x1F71,0x0517,0x29AA,0x18BE,0x0807,
+ 0x1C02,0x2701,0x15A2,0x2942,0x1047,0x38B6,0x0389,0x171F,
+ 0x06D5,0x3B6C,0x1FB9,0x0E9D,0x37A5,0x1B50,0x23C5,0x04F9,
+ 0x25D5,0x0A67,0x3831,0x07A0,0x29AE,0x01B2,0x309C,0x1C86,
+ 0x10DC,0x1E04,0x278D,0x15EB,0x3E6D,0x0DBE,0x377C,0x0311,
+ 0x351B,0x2637,0x15C6,0x29DC,0x1711,0x290E,0x082B,0x39DA,
+ 0x2196,0x031D,0x3DFE,0x1F11,0x01CA,0x32B7,0x2058,0x0394,
+ 0x2996,0x0D6A,0x2B96,0x19C0,0x330C,0x02E3,0x37C6,0x135A,
+ 0x28AD,0x1794,0x01F2,0x1B46,0x2828,0x0D57,0x2A94,0x0645,
+ 0x2553,0x3D05,0x1798,0x09E6,0x3950,0x2081,0x0E14,0x3C90,
+ 0x0366,0x27FA,0x062B,0x21B1,0x2EFD,0x0306,0x22BB,0x35AB,
+ 0x2811,0x0B6A,0x3F94,0x269E,0x0D38,0x33DE,0x0B35,0x1B05,
+ 0x2B8D,0x0F02,0x2D3F,0x1C60,0x3CC4,0x085D,0x312A,0x02EE,
+ 0x27FB,0x0A75,0x34EF,0x00EA,0x175C,0x2C64,0x2327,0x023C,
+ 0x305C,0x0ADB,0x28AC,0x0144,0x39E8,0x1912,0x255B,0x0A9D,
+ 0x3843,0x1199,0x2F63,0x056A,0x2802,0x1D28,0x2D91,0x0BC7,
+ 0x25A1,0x3AE5,0x1232,0x239F,0x3E16,0x0E0D,0x369B,0x206D,
+ 0x3979,0x0A74,0x3369,0x0150,0x2F57,0x225C,0x1D36,0x332F,
+ 0x287F,0x1302,0x356E,0x252C,0x0A8F,0x2D2E,0x1241,0x318B,
+ 0x16BB,0x2ACA,0x117D,0x2F46,0x1A1F,0x38F0,0x0E22,0x280B,
+ 0x36E8,0x07FD,0x3AE7,0x0041,0x1CE2,0x2982,0x11AE,0x2C39,
+ 0x1E76,0x05C6,0x2FAA,0x0C50,0x33C2,0x1066,0x31B4,0x1E3F,
+ 0x1399,0x2DC3,0x10F7,0x23D1,0x3A6B,0x0CE3,0x275A,0x3D86,
+ 0x12AD,0x3621,0x0181,0x3EC3,0x0E2A,0x24C8,0x18EE,0x3259,
+ 0x05FF,0x3853,0x1FC7,0x3BD7,0x0744,0x3303,0x19B3,0x39DF,
+ 0x1EFC,0x0F33,0x2C01,0x1CDA,0x286C,0x007E,0x3011,0x1429,
+ 0x33FE,0x1587,0x3F5C,0x0D9F,0x1B0D,0x39BE,0x16CD,0x054F,
+ 0x147E,0x2EBE,0x2094,0x1065,0x3A3A,0x048D,0x21AB,0x3D9B,
+ 0x02A7,0x38C8,0x09AF,0x3315,0x152B,0x2614,0x1D54,0x3F1E,
+ 0x0F74,0x39BA,0x229D,0x1CF7,0x3CE1,0x0817,0x3797,0x1E43,
+ 0x101D,0x3DE7,0x1596,0x2FBB,0x0E9C,0x2BAB,0x14DD,0x303E,
+ 0x01A2,0x1EA6,0x2450,0x1762,0x3962,0x00D5,0x19A6,0x3757,
+ 0x16AF,0x023D,0x2F8E,0x089B,0x1A6B,0x2D63,0x0036,0x28C7,
+ 0x0F53,0x2CB0,0x16BC,0x3A14,0x1B09,0x081E,0x3C35,0x0D3F,
+ 0x1010,0x2E54,0x0496,0x1967,0x3FAF,0x0174,0x39F1,0x0BBE,
+ 0x3609,0x024C,0x3D99,0x22E9,0x0F5B,0x215D,0x2E94,0x0455,
+ 0x1F19,0x3137,0x1778,0x222F,0x3570,0x08F4,0x3C24,0x2142,
+ 0x0EC0,0x3FCC,0x1BBA,0x3785,0x01FC,0x2026,0x2498,0x053B,
+ 0x3BF8,0x0BE0,0x3368,0x073E,0x19EC,0x2EB9,0x16E0,0x08BC,
+ 0x2404,0x1BF5,0x304B,0x1755,0x2059,0x3A80,0x0B87,0x1CCD,
+ 0x2BEF,0x1282,0x29C8,0x1100,0x2C79,0x1E00,0x0118,0x232C,
+ 0x0A7E,0x34A7,0x0405,0x3FD4,0x1552,0x3711,0x0C0A,0x2516,
+ 0x0931,0x2C71,0x109E,0x262F,0x3486,0x08C0,0x2B0A,0x1E1E,
+ 0x3C9B,0x1913,0x018A,0x30FB,0x22F7,0x19FC,0x2F0D,0x10A2,
+ 0x274E,0x18F3,0x204F,0x23F3,0x01B1,0x2F6F,0x0AF2,0x1686,
+ 0x2C49,0x1A05,0x06A0,0x2F9F,0x0F8B,0x29D6,0x14C8,0x31A7,
+ 0x21AE,0x04FA,0x25B5,0x1AB4,0x3613,0x03FA,0x3EC5,0x0D49,
+ 0x27A6,0x3C65,0x0912,0x3298,0x1478,0x22ED,0x30D2,0x0631,
+ 0x2239,0x2C1D,0x13F4,0x391F,0x2489,0x1147,0x328E,0x1718,
+ 0x3F7A,0x0475,0x24FC,0x10F8,0x2B08,0x2062,0x138B,0x3144,
+ 0x3E2C,0x1D7C,0x217C,0x3006,0x14A4,0x28C2,0x1A41,0x2765,
+ 0x15DF,0x2CA6,0x1BA8,0x058D,0x3B11,0x0921,0x189E,0x3D25,
+ 0x1415,0x2526,0x0EBB,0x2E47,0x12B1,0x2BCA,0x19E8,0x0702,
+ 0x31E5,0x2273,0x0FF0,0x256E,0x1A6D,0x3CEA,0x124C,0x3494,
+ 0x1821,0x2A04,0x1575,0x38F4,0x24FD,0x04C4,0x35B7,0x1D6D,
+ 0x33B9,0x0615,0x259E,0x0A20,0x2DE9,0x0566,0x26D2,0x3F9A,
+ 0x0DA5,0x35DE,0x0423,0x3407,0x0B1D,0x3AE9,0x1495,0x36A3,
+ 0x28B1,0x12AB,0x2D98,0x2240,0x08A8,0x270F,0x1B5F,0x3DA0,
+ 0x1878,0x1FF0,0x384A,0x014B,0x183A,0x30A9,0x1227,0x32AF,
+ 0x0C7D,0x28D2,0x3749,0x168F,0x0A27,0x357A,0x0775,0x1ED6,
+ 0x30D1,0x0600,0x3E53,0x0FE2,0x3837,0x178A,0x354B,0x21F8,
+ 0x045E,0x33A4,0x208D,0x1324,0x38BA,0x040C,0x270B,0x09D9,
+ 0x3AFE,0x1BDA,0x373D,0x08F3,0x23B1,0x1F64,0x12D9,0x3267,
+ 0x1B7E,0x1042,0x2AC0,0x1F10,0x076A,0x3D19,0x0D68,0x2027,
+ 0x3FC4,0x099E,0x3457,0x1F2D,0x04EB,0x3C97,0x1E93,0x07AB,
+ 0x1FC9,0x341E,0x0C5C,0x3D84,0x0574,0x3770,0x2410,0x00B8,
+ 0x17D5,0x086A,0x34C6,0x0C37,0x2A9D,0x0E01,0x32F0,0x0709,
+ 0x3C57,0x09EF,0x1FE9,0x3512,0x161F,0x2673,0x318E,0x0B72,
+ 0x2B9C,0x033A,0x33E2,0x0987,0x3A5C,0x0266,0x22F6,0x394B,
+ 0x179D,0x0117,0x3AB6,0x0A24,0x2EBF,0x075F,0x2A6F,0x0AE4,
+ 0x27B8,0x00F8,0x2F68,0x0A84,0x1DD6,0x3F10,0x1213,0x2ADE,
+ 0x0ECD,0x3C32,0x1347,0x38E2,0x15A8,0x3509,0x1D98,0x0081,
+ 0x23D0,0x1A8B,0x25D6,0x20B5,0x17D0,0x2717,0x2174,0x07E1,
+ 0x18AC,0x3BF1,0x0C96,0x1A22,0x3168,0x102C,0x2E88,0x0279,
+ 0x353F,0x06F7,0x2884,0x1C4E,0x3C60,0x0E13,0x2581,0x0253,
+ 0x393F,0x1F69,0x07CC,0x2606,0x3EA3,0x132C,0x2858,0x3BB0,
+ 0x0DE8,0x3411,0x13DC,0x2C22,0x0CBF,0x2A07,0x0724,0x3BCF,
+ 0x1E0E,0x0E07,0x3D81,0x25CF,0x0BD1,0x326B,0x185B,0x2CA3,
+ 0x1275,0x2998,0x1433,0x2D96,0x113A,0x396F,0x2856,0x06CE,
+ 0x237D,0x371F,0x036C,0x3A9B,0x1BB9,0x25F2,0x1822,0x331B,
+ 0x0F03,0x1C90,0x2671,0x0DD6,0x308D,0x1002,0x2B57,0x1AC0,
+ 0x2E46,0x13D3,0x2817,0x1781,0x3051,0x0CE2,0x1BCD,0x2B5A,
+ 0x36D7,0x2700,0x1191,0x3CFE,0x041D,0x3802,0x11E3,0x2D72,
+ 0x13CC,0x24E5,0x3071,0x1035,0x2BE5,0x00E5,0x1C14,0x3760,
+ 0x1203,0x3F41,0x1952,0x2050,0x26A1,0x1560,0x2DD0,0x0D24,
+ 0x273D,0x2FED,0x14C9,0x28D4,0x1335,0x32FF,0x1D3A,0x3F82,
+ 0x0F9A,0x382F,0x228B,0x1908,0x30D5,0x0D43,0x27E9,0x006E,
+ 0x2FF7,0x1B14,0x2C1C,0x0340,0x2872,0x10CF,0x309F,0x1701,
+ 0x3910,0x0878,0x3DE3,0x09C1,0x3565,0x0325,0x3ECC,0x1C9D,
+ 0x32A2,0x01C2,0x2023,0x37B2,0x0499,0x3A49,0x21A3,0x15BD,
+ 0x2322,0x319B,0x0D11,0x2E06,0x050E,0x1F23,0x2F2B,0x1766,
+ 0x23E8,0x118A,0x2FD7,0x1B21,0x035B,0x2DD8,0x1C7C,0x0091,
+ 0x2468,0x1BB2,0x26BB,0x03D6,0x3B2A,0x12C0,0x27B7,0x148F,
+ 0x3001,0x2309,0x01CF,0x1C6B,0x2E6C,0x140D,0x3E4C,0x0089,
+ 0x3561,0x07A6,0x3F9B,0x0241,0x32E2,0x0A12,0x16E4,0x3D63,
+ 0x1927,0x0C2A,0x2EE4,0x120F,0x3422,0x0B39,0x2E8D,0x03F3,
+ 0x281F,0x38AD,0x017F,0x2AC2,0x180C,0x3572,0x02B7,0x3B39,
+ 0x0B26,0x37FB,0x01B9,0x2BF6,0x0FBA,0x25C5,0x3ABB,0x0AC7,
+ 0x2018,0x029A,0x2ED0,0x18B5,0x24D5,0x1C66,0x235B,0x0022,
+ 0x38A3,0x19CD,0x03D5,0x3ECD,0x0CAF,0x3439,0x226E,0x0762,
+ 0x20C9,0x25D9,0x05AC,0x37E7,0x0B15,0x3E13,0x1E5B,0x3631,
+ 0x08CE,0x1C44,0x36A5,0x04AC,0x3B8A,0x21B4,0x02E6,0x16C3,
+ 0x3084,0x1AF4,0x088C,0x3B2F,0x0378,0x2BA7,0x14B3,0x3A3D,
+ 0x213B,0x0967,0x2263,0x36C7,0x0C4B,0x3CEE,0x079F,0x2B46,
+ 0x0E8A,0x2D97,0x164A,0x2F5F,0x11E4,0x2B24,0x13D6,0x2DF2,
+ 0x0F98,0x25B3,0x2F13,0x1379,0x2949,0x1D1D,0x07A2,0x3B92,
+ 0x0E4D,0x1DA9,0x3E58,0x164C,0x2238,0x3A13,0x0AD8,0x3637,
+ 0x05AD,0x3D6A,0x0B33,0x3448,0x219A,0x0ECE,0x3924,0x1800,
+ 0x2E79,0x0899,0x362C,0x195B,0x2241,0x322E,0x0010,0x2B2A,
+ 0x0A00,0x34B5,0x192B,0x3AB2,0x065A,0x2A96,0x0D01,0x24C0,
+ 0x1097,0x203A,0x2412,0x1989,0x264B,0x1D13,0x2B36,0x001F,
+ 0x3536,0x24FB,0x15DD,0x2A0B,0x01D4,0x28DF,0x13A5,0x3BA9,
+ 0x210A,0x10D3,0x1E52,0x3EAF,0x07D8,0x1C4A,0x2972,0x153F,
+ 0x263F,0x1226,0x3165,0x1D42,0x3526,0x03BD,0x15CE,0x30DD,
+ 0x1697,0x3BCC,0x22A2,0x0988,0x339F,0x0796,0x3F39,0x1ECD,
+ 0x0E47,0x33DF,0x20AC,0x1540,0x2976,0x1292,0x3A2B,0x19B9,
+ 0x3295,0x0ED8,0x2D44,0x1186,0x2934,0x1A38,0x0527,0x1442,
+ 0x3186,0x245A,0x1112,0x2C03,0x19C4,0x0D06,0x37DB,0x2729,
+ 0x05CE,0x2CC5,0x1FFD,0x1289,0x3314,0x1753,0x3534,0x07BD,
+ 0x189A,0x3FCF,0x105A,0x19EE,0x2D06,0x1400,0x246A,0x1984,
+ 0x36F6,0x1FFE,0x021B,0x1CC2,0x3984,0x0CBB,0x28FA,0x05B4,
+ 0x35AF,0x197D,0x0840,0x3E43,0x0D73,0x35D9,0x16D6,0x23B7,
+ 0x302D,0x03C2,0x277C,0x09C6,0x31EB,0x13BF,0x26E5,0x1D2D,
+ 0x2D71,0x14D9,0x2A55,0x127D,0x3B0F,0x1E80,0x0BA1,0x34FC,
+ 0x10BA,0x3FD3,0x1564,0x2FCA,0x0A50,0x1D68,0x3771,0x1059,
+ 0x3F60,0x157D,0x28A5,0x0F19,0x35D7,0x2184,0x1A4C,0x3373,
+ 0x1C0C,0x3A50,0x0C4A,0x37C1,0x0582,0x349D,0x0DAB,0x2F45,
+ 0x20A2,0x05E3,0x39B1,0x0D4E,0x3E88,0x1011,0x35E2,0x1B2B,
+ 0x0984,0x3516,0x28F1,0x0E57,0x23FC,0x3A89,0x0A8C,0x3654,
+ 0x05F3,0x3D2D,0x2243,0x08BF,0x19E3,0x3FD4,0x22E7,0x0748,
+ 0x325A,0x0D82,0x1B95,0x3997,0x1580,0x2BC1,0x135C,0x26CA,
+ 0x2F56,0x0846,0x279A,0x395C,0x05E2,0x2EDD,0x0A29,0x2B37,
+ 0x020F,0x3B9A,0x1B42,0x3586,0x00A4,0x33A6,0x1F8E,0x3C8A,
+ 0x18C4,0x034C,0x3EDA,0x0A62,0x2666,0x3255,0x11EC,0x20C4,
+ 0x35FF,0x0E52,0x3DF8,0x2544,0x0BB3,0x2941,0x0F65,0x26F2,
+ 0x3225,0x0440,0x23DF,0x337C,0x01D8,0x1E9F,0x3194,0x0482,
+ 0x2695,0x0BEF,0x3C92,0x250D,0x0681,0x3344,0x1EC6,0x3D33,
+ 0x0D3B,0x2109,0x31E9,0x11D7,0x2B98,0x00C8,0x2D4F,0x0991,
+ 0x1E5E,0x38ED,0x1207,0x36BD,0x1C10,0x0029,0x3F6F,0x091C,
+ 0x1A13,0x37EA,0x0119,0x275D,0x0687,0x3038,0x228A,0x0522,
+ 0x2AFF,0x2036,0x02BC,0x1F09,0x3DBE,0x11D6,0x2556,0x20B8,
+ 0x04A5,0x2DDE,0x085C,0x30B1,0x1E84,0x0334,0x3C4E,0x088D,
+ 0x2E50,0x044A,0x2912,0x1007,0x2C42,0x15F1,0x3B13,0x1E11,
+ 0x0F61,0x31AB,0x1A73,0x26EB,0x1DB5,0x310B,0x0705,0x24D0,
+ 0x2FF9,0x178E,0x05C9,0x36EB,0x1FA9,0x0F44,0x2D92,0x190D,
+ 0x27E6,0x1EE0,0x10BF,0x3943,0x2A84,0x0A54,0x2F2E,0x1D16,
+ 0x059A,0x217F,0x2CCF,0x01A3,0x2869,0x0B31,0x315E,0x035C,
+ 0x1ABF,0x3D3E,0x0F36,0x1DDD,0x244E,0x13E0,0x3D65,0x16A4,
+ 0x2807,0x1EBD,0x08A3,0x1FF4,0x2A54,0x1358,0x2E52,0x0808,
+ 0x2298,0x2AA7,0x1638,0x30CA,0x1FBF,0x0016,0x3D8D,0x09AC,
+ 0x1CD5,0x2B42,0x01DB,0x1BC2,0x3927,0x053F,0x3D40,0x1E27,
+ 0x1159,0x1F76,0x394A,0x0E5D,0x21D5,0x3E41,0x0F22,0x3A1F,
+ 0x124D,0x32D6,0x20EC,0x0DDA,0x2CF1,0x1AA3,0x0010,0x1737,
+ 0x27CD,0x3926,0x039D,0x248E,0x1B8E,0x3C89,0x190B,0x3481,
+ 0x0F6E,0x2270,0x2CEB,0x06A3,0x2548,0x2FBC,0x157F,0x2BCB,
+ 0x21F3,0x0E7A,0x3223,0x18B8,0x2B64,0x1323,0x3CDD,0x1D89,
+ 0x0E50,0x31D4,0x1AA9,0x29B7,0x0597,0x2C62,0x090E,0x3A53,
+ 0x1DD4,0x1228,0x38D9,0x2340,0x0C83,0x2CE0,0x1189,0x27AF,
+ 0x0E6A,0x3647,0x171E,0x3C21,0x1F1D,0x08C5,0x2353,0x0386,
+ 0x3FD4,0x2147,0x0945,0x36B5,0x0466,0x18C6,0x2B9B,0x1630,
+ 0x0083,0x3D55,0x1D21,0x255C,0x036D,0x306C,0x1CD3,0x00E2,
+ 0x33AD,0x09D6,0x2FEB,0x02F9,0x15FD,0x2565,0x126D,0x38B8,
+ 0x19A3,0x3E86,0x12F3,0x3593,0x173C,0x3AC8,0x108C,0x3777,
+ 0x23A9,0x147B,0x3261,0x0187,0x3718,0x1F51,0x042A,0x332C,
+ 0x0D74,0x365F,0x14FD,0x3E5A,0x0C8A,0x39CC,0x0F3A,0x1DFF,
+ 0x3B0A,0x109C,0x3759,0x064E,0x151C,0x2E8E,0x22B5,0x17C5,
+ 0x3A47,0x10E1,0x23BF,0x31BF,0x133A,0x2DB5,0x232B,0x013F,
+ 0x3780,0x29E0,0x0802,0x1D43,0x2E63,0x06DC,0x2A5F,0x1C82,
+ 0x2EB5,0x074F,0x1860,0x3787,0x131F,0x3B58,0x1FAB,0x2FB4,
+ 0x091A,0x14CB,0x1EF9,0x3085,0x0C58,0x2641,0x0569,0x20CD,
+ 0x3F24,0x0218,0x1CC9,0x3C06,0x181C,0x0A7D,0x35B8,0x0489,
+ 0x3B64,0x1ED9,0x0849,0x3EDC,0x0A8E,0x337B,0x01EE,0x265A,
+ 0x38BD,0x0799,0x3BEB,0x0F78,0x364C,0x170A,0x33AE,0x139E,
+ 0x3131,0x224C,0x0121,0x189B,0x3EA7,0x154E,0x32BA,0x17AA,
+ 0x2AF1,0x1493,0x2507,0x011B,0x2E76,0x1BB1,0x3140,0x175B,
+ 0x261C,0x131E,0x2CA9,0x14B8,0x242A,0x3C81,0x0A04,0x3801,
+ 0x238D,0x1122,0x3286,0x12D6,0x38C2,0x1497,0x3C1F,0x21F7,
+ 0x167E,0x3E09,0x1B67,0x2988,0x2078,0x3C5F,0x0057,0x27D9,
+ 0x31EC,0x0B92,0x267A,0x0E64,0x2E14,0x0620,0x2546,0x1F03,
+ 0x06E9,0x2D66,0x0C65,0x2918,0x10B3,0x2FEF,0x239B,0x1024,
+ 0x2A4F,0x0633,0x2DF5,0x182F,0x26D1,0x057B,0x21DA,0x34A5,
+ 0x0184,0x2D56,0x0C52,0x23EB,0x3C41,0x1AC3,0x07E7,0x313D,
+ 0x03EB,0x2D1C,0x1A37,0x06BA,0x36D1,0x09D1,0x1965,0x311E,
+ 0x1656,0x0BEC,0x22C3,0x3B80,0x12DA,0x3597,0x1815,0x00DF,
+ 0x22B2,0x3F64,0x26F8,0x035E,0x2B06,0x0B60,0x3434,0x0FEE,
+ 0x3FAC,0x237B,0x36E1,0x06DD,0x39B7,0x1612,0x327D,0x0B6D,
+ 0x2839,0x154F,0x2AC1,0x10E3,0x34BC,0x2408,0x0F40,0x28DA,
+ 0x10F5,0x2F82,0x24DF,0x119B,0x2877,0x1717,0x2CFB,0x1441,
+ 0x1F52,0x248F,0x17C0,0x2D93,0x0B51,0x279B,0x0229,0x2939,
+ 0x09C3,0x3C78,0x1C53,0x33FB,0x07A9,0x2566,0x01FD,0x3844,
+ 0x0621,0x3F15,0x0B86,0x33EF,0x11AB,0x3DB2,0x0D1D,0x38D4,
+ 0x07EA,0x34CD,0x012B,0x3AEA,0x0C76,0x20A7,0x2D4A,0x1C01,
+ 0x0B91,0x2F07,0x0722,0x29E1,0x0A3B,0x275E,0x0673,0x2C6D,
+ 0x0BE3,0x24BC,0x055D,0x37C2,0x0AFF,0x140B,0x3471,0x1549,
+ 0x1F99,0x2C66,0x03E9,0x3BEF,0x2226,0x1BF2,0x3DF4,0x115B,
+ 0x3608,0x18E8,0x38B9,0x1658,0x3B3A,0x0AEF,0x1AD3,0x3F90,
+ 0x15F8,0x3852,0x1DC4,0x028E,0x3113,0x1BBC,0x2C8A,0x0BA8,
+ 0x27C3,0x16E7,0x3429,0x1C75,0x0DA8,0x353D,0x29A6,0x1349,
+ 0x387B,0x0F1A,0x3EB9,0x25E6,0x1531,0x2AF2,0x21A8,0x0DCC,
+ 0x3E90,0x1BF7,0x33F6,0x02D7,0x2BC6,0x0ACD,0x2617,0x388B,
+ 0x15A7,0x0A02,0x1B60,0x30D4,0x165D,0x258F,0x04F8,0x2990,
+ 0x1B4A,0x025A,0x1805,0x2A7E,0x12E1,0x2916,0x1049,0x387A,
+ 0x19DF,0x33BB,0x08C4,0x3063,0x030E,0x1BE8,0x3DCC,0x15E8,
+ 0x38F8,0x029F,0x1B77,0x3761,0x04D5,0x3A0C,0x0DB4,0x34C7,
+ 0x0BD0,0x306A,0x00DD,0x1D15,0x39D1,0x117F,0x3D30,0x1B16,
+ 0x2EE0,0x0E1F,0x2B18,0x107C,0x1F5C,0x3B06,0x1AA8,0x21FC,
+ 0x2F61,0x12B9,0x2971,0x18DE,0x273B,0x059E,0x2A86,0x1B1A,
+ 0x2DDF,0x1107,0x27D5,0x1962,0x3232,0x1576,0x02C4,0x3F23,
+ 0x27A4,0x1391,0x34C8,0x1B11,0x3F9F,0x11E2,0x362E,0x1838,
+ 0x3A39,0x11A6,0x32FC,0x1940,0x230F,0x2DB6,0x1E37,0x07F2,
+ 0x3A77,0x11D0,0x33AA,0x1934,0x0982,0x30C7,0x00AA,0x29D5,
+ 0x0AB7,0x264E,0x02BF,0x2B59,0x0684,0x253C,0x34F9,0x0051,
+ 0x285A,0x0B52,0x24CA,0x3D00,0x1120,0x3715,0x12C2,0x3FD4,
+ 0x1457,0x2A02,0x04FE,0x3991,0x2612,0x0245,0x1F15,0x2448,
+ 0x0925,0x27D6,0x1E6F,0x0C5E,0x3BC2,0x031C,0x34B2,0x1ECB,
+ 0x05B7,0x2D46,0x1023,0x27AB,0x1601,0x3CCB,0x2092,0x0D4B,
+ 0x326F,0x1F12,0x3A70,0x10B2,0x3652,0x0E6E,0x3C25,0x1158,
+ 0x2EDA,0x1E23,0x3379,0x0DA6,0x3EB0,0x0176,0x2E67,0x22DD,
+ 0x04D0,0x2008,0x3960,0x0DEB,0x2144,0x2DF9,0x0655,0x2B8F,
+ 0x0C24,0x32E5,0x23A1,0x14C7,0x29A7,0x1A6E,0x2598,0x0401,
+ 0x3E85,0x1331,0x3827,0x21DF,0x0706,0x31FD,0x2001,0x05EE,
+ 0x233B,0x352E,0x039F,0x26BD,0x3054,0x0D7D,0x2BF9,0x0918,
+ 0x1E14,0x3571,0x0327,0x3A35,0x0ECC,0x3624,0x201D,0x0268,
+ 0x1EA9,0x3BED,0x0A87,0x3769,0x0650,0x25A0,0x30DC,0x17DA,
+ 0x04FD,0x3A5E,0x2037,0x01A1,0x1EAE,0x314A,0x0DEC,0x2A0F,
+ 0x0263,0x2D34,0x2146,0x090C,0x3EFB,0x0458,0x3747,0x1A99,
+ 0x020E,0x2825,0x0DB8,0x2B91,0x2073,0x12BD,0x391C,0x16C7,
+ 0x3469,0x1230,0x3EFC,0x1F1A,0x32BE,0x1CF6,0x0CE8,0x2F3D,
+ 0x1284,0x3187,0x193F,0x09E3,0x23BE,0x0750,0x25AB,0x03CA,
+ 0x3246,0x0E60,0x2EFC,0x0AF0,0x1955,0x3F2A,0x0FE7,0x349C,
+ 0x18FC,0x2F94,0x00C2,0x327A,0x1862,0x2EDC,0x0B3D,0x39FB,
+ 0x2362,0x1721,0x3AB9,0x09C0,0x328A,0x052C,0x1A36,0x2E18,
+ 0x062F,0x2A25,0x02A0,0x2823,0x07E6,0x2CA2,0x1973,0x32B3,
+ 0x09FE,0x3AAC,0x0824,0x2579,0x1A92,0x3502,0x1E8B,0x0ACB,
+ 0x3D97,0x138C,0x24C5,0x1B07,0x3C9E,0x0EB9,0x36EA,0x18F5,
+ 0x26AC,0x1F70,0x07F7,0x3416,0x0CC9,0x3D6E,0x1263,0x2A98,
+ 0x1674,0x2866,0x0F13,0x2BFC,0x1A54,0x251C,0x1459,0x3035,
+ 0x10A8,0x17D7,0x39A6,0x19BD,0x0548,0x36A7,0x1689,0x3D47,
+ 0x10EA,0x20BD,0x263A,0x165C,0x2D7F,0x0A2C,0x2C14,0x16C4,
+ 0x2FDA,0x12A6,0x2911,0x165F,0x2B7D,0x1C2D,0x0DEF,0x370E,
+ 0x245F,0x0FA8,0x2ACB,0x187E,0x2D67,0x04C1,0x25E8,0x15B5,
+ 0x3532,0x1BFA,0x0EE5,0x30B9,0x16B2,0x2723,0x0FDE,0x29F7,
+ 0x3D5D,0x1E85,0x37B4,0x052B,0x3FD4,0x2440,0x0D3A,0x2BD6,
+ 0x0572,0x2849,0x1B4B,0x0959,0x139C,0x3CB2,0x1879,0x2201,
+ 0x3C0D,0x0493,0x3955,0x1D72,0x35CB,0x1738,0x3AC9,0x2072,
+ 0x19FE,0x3CAF,0x1C1D,0x214C,0x31DB,0x13F2,0x2E9E,0x047F,
+ 0x3A9C,0x1500,0x3789,0x24D8,0x0E04,0x1C70,0x28D3,0x1420,
+ 0x30A7,0x0034,0x1C3F,0x2AB9,0x1361,0x249B,0x375E,0x1076,
+ 0x3D93,0x175F,0x34E8,0x1425,0x3E6C,0x1D75,0x0122,0x211D,
+ 0x277A,0x15EE,0x2065,0x2FF3,0x05BE,0x240A,0x14EE,0x2F3F,
+ 0x0F2A,0x318A,0x009B,0x2C0F,0x0871,0x28B5,0x1D73,0x013E,
+ 0x3FD4,0x0FCE,0x3859,0x135F,0x2F14,0x006A,0x3190,0x0A19,
+ 0x2E73,0x0580,0x336A,0x0A76,0x3F8A,0x0365,0x3688,0x0C59,
+ 0x3E1C,0x2157,0x08FA,0x31B1,0x22E1,0x0C0E,0x2A28,0x00C4,
+ 0x2DF1,0x0A93,0x3C93,0x0797,0x1DD0,0x385F,0x105C,0x3F3E,
+ 0x0889,0x359A,0x03BF,0x3DCF,0x0CEF,0x3461,0x21D8,0x082C,
+ 0x1D85,0x32DC,0x0BFC,0x3C59,0x1505,0x377E,0x0CD7,0x3E73,
+ 0x06F9,0x23E0,0x3B99,0x014C,0x2AEF,0x0C35,0x3364,0x13AD,
+ 0x1C21,0x08F9,0x1651,0x2FF8,0x1B0C,0x02DE,0x3226,0x1EAA,
+ 0x3BAF,0x0EC3,0x366B,0x20E1,0x2ADD,0x039A,0x2D7B,0x0870,
+ 0x1C3C,0x2B9A,0x0D40,0x28E3,0x0128,0x2D19,0x0AA1,0x3078,
+ 0x085B,0x24A1,0x0093,0x37DC,0x06D2,0x2734,0x0C32,0x2BBE,
+ 0x2208,0x0D48,0x1FC3,0x067B,0x2246,0x3FC2,0x03FF,0x36F4,
+ 0x0F59,0x228E,0x342D,0x071D,0x3F50,0x1CE9,0x01B5,0x287C,
+ 0x211E,0x0C4D,0x1C18,0x2D5D,0x0EF5,0x2397,0x3A40,0x13CF,
+ 0x355C,0x03E5,0x3CBD,0x0E1E,0x37DF,0x0C07,0x3B73,0x0356,
+ 0x2800,0x18D7,0x3A60,0x164D,0x363F,0x1240,0x3272,0x22EB,
+ 0x16FC,0x2D2A,0x045A,0x2AD5,0x1DEA,0x2444,0x1858,0x36B2,
+ 0x1BF0,0x3B4E,0x18D6,0x2720,0x11C4,0x2D2F,0x16A8,0x28FE,
+ 0x0046,0x2BB5,0x1E7E,0x0F0F,0x3FC9,0x1DB9,0x1219,0x3883,
+ 0x14F0,0x328F,0x2335,0x1941,0x3114,0x0060,0x1F06,0x25D8,
+ 0x199A,0x23BB,0x1F2C,0x100D,0x2F76,0x00A3,0x39A1,0x1A43,
+ 0x3E4A,0x0284,0x2E82,0x1F1E,0x086F,0x1FE7,0x2928,0x1795,
+ 0x2FB5,0x0B53,0x1F0D,0x34AD,0x1105,0x39C5,0x05D4,0x2FD4,
+ 0x2605,0x35DA,0x211C,0x0EE8,0x26F0,0x370A,0x150F,0x0832,
+ 0x1A66,0x298B,0x013C,0x3101,0x1583,0x39AA,0x0F84,0x3636,
+ 0x2561,0x14D5,0x2FD9,0x11F9,0x33EE,0x1B12,0x266F,0x1677,
+ 0x38BF,0x0F73,0x2CDC,0x12E9,0x2B14,0x16F4,0x3B5E,0x1D1C,
+ 0x084B,0x3D53,0x29FA,0x1782,0x2F2D,0x10F1,0x2C92,0x0AAC,
+ 0x1E06,0x3C4B,0x1117,0x2833,0x0E35,0x2DA4,0x18B1,0x3230,
+ 0x07A7,0x3972,0x2748,0x0472,0x3815,0x0B07,0x2AE4,0x0725,
+ 0x1C85,0x2A32,0x16BF,0x2C53,0x1208,0x26CB,0x1A1E,0x3262,
+ 0x1198,0x2AF8,0x0CA9,0x25CB,0x0421,0x2DA3,0x0B28,0x3AB0,
+ 0x072D,0x1D17,0x3C74,0x19BC,0x0986,0x3AA7,0x0632,0x2156,
+ 0x0BE8,0x23DA,0x0188,0x37C3,0x20F6,0x07BB,0x3C0F,0x0FB2,
+ 0x3568,0x13C3,0x3A92,0x25B1,0x02AF,0x2EEC,0x2210,0x0760,
+ 0x2B84,0x1C65,0x040D,0x379E,0x0F7A,0x2A30,0x3A99,0x0521,
+ 0x33C1,0x0B55,0x3941,0x250F,0x15E3,0x2A80,0x12E8,0x2D09,
+ 0x1178,0x26C2,0x1448,0x368A,0x19F2,0x3AFD,0x0011,0x3325,
+ 0x1352,0x2B9E,0x14B7,0x25B8,0x1B41,0x21D0,0x2CA8,0x0CFD,
+ 0x159B,0x008D,0x297B,0x3A03,0x0703,0x18FA,0x2D1E,0x1FC2,
+ 0x37FE,0x140C,0x3DB3,0x1E1B,0x08E8,0x1F9B,0x2940,0x17C7,
+ 0x01E7,0x380B,0x07CA,0x3EE6,0x2199,0x0DBD,0x3D4F,0x0302,
+ 0x1D60,0x335C,0x1841,0x3E42,0x0D91,0x33E1,0x019A,0x302B,
+ 0x1A1B,0x23AC,0x02B3,0x3949,0x0906,0x35A6,0x194A,0x217A,
+ 0x2BA0,0x05F1,0x2F78,0x1ED7,0x3682,0x0B25,0x3BA4,0x118B,
+ 0x1DFC,0x235D,0x11D2,0x301D,0x1D09,0x33AC,0x1705,0x21FD,
+ 0x3DC8,0x0AA9,0x3653,0x005A,0x1F21,0x30EF,0x0784,0x214E,
+ 0x3F8B,0x05F7,0x3566,0x142E,0x3E0E,0x1B88,0x2711,0x15C1,
+ 0x215F,0x34D7,0x0ED7,0x25C4,0x321E,0x0FB9,0x2814,0x3EF8,
+ 0x1593,0x2F3B,0x1E16,0x0CE5,0x30E6,0x1970,0x1FA6,0x2680,
+ 0x09DD,0x312F,0x06AE,0x1C35,0x36F9,0x135E,0x3B84,0x1EA1,
+ 0x0C9E,0x3EE1,0x13D5,0x280A,0x1F8D,0x0BB4,0x17AE,0x2935,
+ 0x1483,0x2E23,0x1AF9,0x05F2,0x3D06,0x0A66,0x262E,0x0691,
+ 0x316D,0x0AA3,0x29B8,0x057E,0x2B27,0x1103,0x2782,0x0F5E,
+ 0x3D77,0x03FD,0x382C,0x07FA,0x3F74,0x0369,0x1896,0x3B18,
+ 0x2031,0x3E22,0x173F,0x0B6E,0x2267,0x3CD7,0x0C94,0x32DD,
+ 0x045D,0x2618,0x0D88,0x2CA4,0x195A,0x342C,0x05A8,0x3E77,
+ 0x222A,0x0E83,0x273C,0x1EDB,0x0528,0x2BD4,0x1424,0x2F8D,
+ 0x2435,0x0972,0x29A8,0x04B6,0x255D,0x146E,0x2931,0x0F2F,
+ 0x35DB,0x137E,0x32DA,0x11D4,0x1F04,0x255E,0x016E,0x3DDA,
+ 0x0CED,0x37ED,0x1A58,0x02DF,0x1779,0x2A6E,0x04CF,0x26B1,
+ 0x3629,0x0076,0x3F17,0x19CC,0x08B9,0x264D,0x024B,0x2DF4,
+ 0x0F3E,0x289D,0x1455,0x2464,0x3E6B,0x132D,0x371E,0x1BE5,
+ 0x0B68,0x2DDD,0x1006,0x290A,0x1EFD,0x08E6,0x3976,0x032B,
+ 0x2A6A,0x0A61,0x3059,0x01FE,0x174D,0x3735,0x1D39,0x0321,
+ 0x330F,0x0898,0x3DAE,0x238F,0x14ED,0x398C,0x026F,0x3742,
+ 0x1B43,0x2417,0x174F,0x2D5A,0x0ACA,0x2830,0x04C0,0x3454,
+ 0x22FD,0x1816,0x3357,0x06D3,0x3D1D,0x23C0,0x352C,0x0985,
+ 0x3E3D,0x01C3,0x209D,0x30F6,0x170D,0x3403,0x1416,0x3BD2,
+ 0x1B47,0x35D3,0x0F0B,0x3CC6,0x1CB0,0x33F0,0x0940,0x2ECF,
+ 0x1D0F,0x2430,0x10C4,0x2F65,0x0E5F,0x32C9,0x2894,0x0847,
+ 0x24E3,0x0E15,0x324D,0x1D5F,0x348B,0x01D9,0x28B2,0x131A,
+ 0x2AFE,0x119F,0x3372,0x0326,0x3AD4,0x0CB4,0x2EA3,0x10F0,
+ 0x30BD,0x19CB,0x3300,0x13B9,0x3A59,0x0B30,0x3639,0x2021,
+ 0x126A,0x3BA7,0x1614,0x3554,0x0B37,0x397A,0x1B7C,0x3F84,
+ 0x062E,0x2C6F,0x0A6E,0x270D,0x3B27,0x0ED2,0x3177,0x12C1,
+ 0x2772,0x1428,0x3349,0x2063,0x3E29,0x0FB7,0x34B9,0x1F75,
+ 0x0BC2,0x2BAF,0x0EAF,0x24B5,0x3BD1,0x0FC8,0x36D2,0x1C40,
+ 0x38FF,0x04EA,0x330E,0x1AFF,0x0953,0x2CD5,0x0227,0x29E8,
+ 0x227A,0x185C,0x3C1E,0x01A6,0x2FAB,0x18DF,0x232F,0x3377,
+ 0x1095,0x3E39,0x1CAC,0x2214,0x2D74,0x07A8,0x2BA4,0x19FA,
+ 0x2763,0x2009,0x1372,0x34CE,0x05FB,0x2282,0x2E8A,0x1300,
+ 0x2A8A,0x03FC,0x3CD3,0x101B,0x32CA,0x16DD,0x29D4,0x0EBA,
+ 0x2C8F,0x01BD,0x2177,0x2E27,0x1605,0x030F,0x1B91,0x2B3F,
+ 0x0EAB,0x2479,0x387C,0x10DF,0x2BBD,0x0372,0x28ED,0x1FB1,
+ 0x016C,0x1E53,0x2DC7,0x22DC,0x033C,0x16E6,0x3918,0x196E,
+ 0x061D,0x31AD,0x20C8,0x191C,0x26DD,0x1ECF,0x122C,0x33FC,
+ 0x1A20,0x2D0B,0x053E,0x280C,0x0EA7,0x2F2C,0x1CCC,0x38D5,
+ 0x0A68,0x3ED5,0x2145,0x1BC1,0x26C0,0x161B,0x243C,0x1E6C,
+ 0x0942,0x391A,0x0359,0x2CFF,0x1001,0x28A0,0x1A7A,0x06FE,
+ 0x313F,0x023E,0x2835,0x10C8,0x2A8B,0x1FEF,0x038F,0x1EBC,
+ 0x287B,0x1566,0x3CD1,0x1B02,0x0552,0x2D33,0x1C94,0x38F3,
+ 0x046E,0x2A11,0x0A1F,0x2E40,0x0815,0x1D37,0x244D,0x14AB,
+ 0x3A65,0x168C,0x32D1,0x03F5,0x2020,0x306E,0x15D6,0x09B3,
+ 0x22F2,0x2F85,0x1194,0x39DE,0x21C4,0x1036,0x3AF9,0x1547,
+ 0x3466,0x0518,0x1CC8,0x32E1,0x12D1,0x3676,0x0C00,0x16AA,
+ 0x2C9A,0x1950,0x06F5,0x3627,0x1427,0x3BE7,0x11F8,0x37CF,
+ 0x0DC3,0x39F8,0x042C,0x1C76,0x2C3F,0x1869,0x0C8C,0x3F32,
+ 0x0E84,0x34C5,0x1D7D,0x26F1,0x013D,0x3E9B,0x0964,0x37EC,
+ 0x127C,0x3B15,0x1AF0,0x0AC6,0x370D,0x1E42,0x3BA0,0x1235,
+ 0x324E,0x19EF,0x083E,0x2697,0x0CD0,0x39FC,0x1026,0x3763,
+ 0x17C2,0x3ECF,0x07D2,0x162C,0x3070,0x2133,0x0E25,0x2A45,
+ 0x3AA1,0x0C0C,0x36DE,0x010D,0x3CF1,0x099A,0x38E5,0x02A2,
+ 0x3BEC,0x0AE7,0x3838,0x1362,0x3F83,0x1876,0x0774,0x220D,
+ 0x3028,0x17FD,0x06A2,0x2EF0,0x0A0D,0x35C2,0x00DE,0x3B89,
+ 0x2AE6,0x1690,0x2505,0x1B6C,0x3745,0x002E,0x3F68,0x223D,
+ 0x0EDB,0x376A,0x1CEC,0x3DC9,0x0768,0x3390,0x17EF,0x2ECC,
+ 0x0E02,0x324B,0x0069,0x22FB,0x374C,0x1627,0x089D,0x22AE,
+ 0x3068,0x15CD,0x3B1C,0x1220,0x28FC,0x397F,0x0216,0x2FC2,
+ 0x068A,0x28C9,0x110A,0x3881,0x1832,0x063F,0x29BB,0x3FD1,
+ 0x18E2,0x0BCD,0x2B72,0x0310,0x30AA,0x1E46,0x0812,0x2BC3,
+ 0x0D02,0x392D,0x2525,0x0DCB,0x296F,0x05B9,0x3F4F,0x20AF,
+ 0x0024,0x38FA,0x2564,0x1013,0x293D,0x0C1A,0x267F,0x00EE,
+ 0x2E13,0x17AF,0x2313,0x3291,0x0FE8,0x3ADE,0x20AA,0x0679,
+ 0x2CAD,0x1924,0x0833,0x38DA,0x206F,0x112C,0x301F,0x1A27,
+ 0x260C,0x085F,0x3138,0x2372,0x1340,0x2D1F,0x07E3,0x27DF,
+ 0x0464,0x36A6,0x1CD2,0x3FA5,0x1882,0x2185,0x3214,0x0B70,
+ 0x2C35,0x12B5,0x24FF,0x3664,0x0C33,0x3FD4,0x2554,0x0201,
+ 0x1EE9,0x263B,0x1691,0x2D78,0x0FBE,0x2BD0,0x1CA1,0x2294,
+ 0x142A,0x29E7,0x195D,0x2E49,0x0413,0x2473,0x3A56,0x15F0,
+ 0x0010,0x2315,0x3551,0x0F70,0x3D41,0x1A26,0x2808,0x0D5A,
+ 0x2051,0x06EF,0x3D9A,0x0C15,0x215A,0x3248,0x1149,0x2E9A,
+ 0x18CF,0x258B,0x0BDE,0x1975,0x3015,0x1317,0x3835,0x07F8,
+ 0x3A6C,0x218A,0x1852,0x2B67,0x0B00,0x2076,0x3EFE,0x17DF,
+ 0x0B76,0x351A,0x00CF,0x23E3,0x1F58,0x0E70,0x2B38,0x1306,
+ 0x3D4E,0x18DB,0x2E8C,0x0CA2,0x27C1,0x3533,0x2134,0x00F2,
+ 0x1FA0,0x3573,0x1723,0x27BE,0x13EF,0x3D76,0x25EA,0x1307,
+ 0x2F6C,0x20D8,0x09C4,0x3B33,0x1F8C,0x2EC8,0x111C,0x2756,
+ 0x323E,0x0E0A,0x2005,0x3D1E,0x0380,0x2F75,0x16C6,0x3452,
+ 0x21E2,0x090D,0x3CCF,0x0B5F,0x29E9,0x00AB,0x3559,0x25E3,
+ 0x1422,0x322A,0x24D9,0x0EF3,0x2D22,0x1BEC,0x23F9,0x035A,
+ 0x3519,0x1FE1,0x1573,0x3F76,0x00EB,0x219C,0x3980,0x1662,
+ 0x2A03,0x0FC4,0x2CBD,0x0038,0x30A6,0x0700,0x1D62,0x26F5,
+ 0x04F1,0x33A0,0x0DC2,0x1E0D,0x28A6,0x06CB,0x1C2C,0x3558,
+ 0x0D89,0x3C51,0x0757,0x1D9B,0x34DE,0x177D,0x06C3,0x3129,
+ 0x355B,0x00F4,0x269F,0x0CD6,0x36B0,0x1BE0,0x094B,0x341C,
+ 0x1D65,0x3C3B,0x12EB,0x2B6D,0x1D2A,0x0603,0x3318,0x14B2,
+ 0x2975,0x34F0,0x10D0,0x2F58,0x05DB,0x1DDA,0x2B58,0x093A,
+ 0x3442,0x0452,0x39D8,0x2B02,0x00E8,0x2462,0x0C84,0x276B,
+ 0x1DE7,0x0506,0x2FB6,0x1249,0x346E,0x266D,0x0242,0x2DD3,
+ 0x1D81,0x2503,0x199D,0x3FD0,0x0731,0x35E6,0x1AA2,0x339A,
+ 0x0A90,0x25B7,0x0193,0x3E40,0x1DC9,0x0910,0x1436,0x3A6D,
+ 0x26E7,0x066C,0x3C15,0x0AB9,0x34B4,0x048C,0x1B33,0x3863,
+ 0x00BE,0x193B,0x313C,0x161D,0x02B6,0x1A94,0x3506,0x0863,
+ 0x1A03,0x2BE1,0x054A,0x1BDB,0x32E8,0x14AD,0x3FA3,0x0D46,
+ 0x1AE5,0x2CC7,0x1476,0x27EA,0x1625,0x307C,0x1A67,0x0B21,
+ 0x3BB4,0x0211,0x1B6B,0x343E,0x0530,0x39BC,0x0C41,0x3DA2,
+ 0x0DD5,0x2EAF,0x0596,0x1C42,0x333C,0x183F,0x0DBC,0x346F,
+ 0x0BD4,0x3C8E,0x21FA,0x15E4,0x2391,0x3B70,0x0EDD,0x2FE2,
+ 0x19AB,0x20F7,0x3B2C,0x00B5,0x385E,0x151E,0x2E04,0x1243,
+ 0x2923,0x158C,0x3103,0x246F,0x049F,0x3ECA,0x20F2,0x106C,
+ 0x0BE9,0x3DD7,0x1610,0x2B13,0x125E,0x2F9C,0x25EB,0x1063,
+ 0x2D0D,0x0BEA,0x2722,0x027E,0x30FF,0x21B3,0x1844,0x3FBD,
+ 0x03D2,0x1E7F,0x26A8,0x1799,0x3C20,0x0D96,0x237E,0x3AF8,
+ 0x133D,0x2881,0x1E69,0x10A3,0x1F6D,0x3C9D,0x16AB,0x2E05,
+ 0x1067,0x3E91,0x0D35,0x3901,0x06F2,0x1971,0x32AE,0x0DA0,
+ 0x3BB2,0x0627,0x30F1,0x0CCC,0x297A,0x1E7B,0x03AF,0x1FEB,
+ 0x2AB8,0x11F5,0x31EA,0x2236,0x1031,0x3792,0x295B,0x1ACC,
+ 0x0CEC,0x2EBD,0x15CC,0x2A3C,0x10CB,0x23AE,0x3285,0x1152,
+ 0x24B7,0x3EBC,0x07C2,0x2B62,0x1DFA,0x3CFC,0x0F6D,0x245B,
+ 0x3B8B,0x1256,0x383E,0x26D9,0x09FC,0x2B29,0x069D,0x1FB4,
+ 0x3900,0x0259,0x366D,0x0653,0x3E9D,0x0A1C,0x1FA2,0x2BFF,
+ 0x1157,0x2042,0x3E2B,0x0BAF,0x2848,0x159D,0x31B3,0x1757,
+ 0x2A2E,0x11C6,0x3590,0x26B0,0x093B,0x2FE3,0x25C7,0x02C1,
+ 0x2E5A,0x1E48,0x05D2,0x381E,0x0A3F,0x1EA7,0x34F3,0x0247,
+ 0x3DCB,0x09BB,0x25FF,0x18B9,0x201E,0x32E7,0x0900,0x3E04,
+ 0x0385,0x388F,0x09F4,0x1A88,0x2AA0,0x0EB5,0x300E,0x253E,
+ 0x2A5E,0x112A,0x3215,0x07A5,0x3D20,0x0246,0x2002,0x3B21,
+ 0x048F,0x29BA,0x172C,0x35E7,0x0E6D,0x389D,0x0908,0x2330,
+ 0x3018,0x0B71,0x362F,0x01AF,0x2280,0x31B8,0x1667,0x02BB,
+ 0x20D1,0x3E15,0x06C6,0x234D,0x3127,0x0916,0x358C,0x02FA,
+ 0x3343,0x2227,0x1A71,0x24E8,0x1D5E,0x3D0E,0x11C5,0x29D9,
+ 0x148E,0x2C1A,0x10D5,0x3707,0x1371,0x39D7,0x16B3,0x3CBF,
+ 0x07C1,0x36AF,0x1B86,0x057D,0x3004,0x209C,0x034D,0x33DB,
+ 0x2487,0x1004,0x3238,0x01A8,0x3F34,0x1EFE,0x0770,0x2CB6,
+ 0x0D51,0x1E86,0x3587,0x0E80,0x308B,0x0695,0x2A42,0x1D66,
+ 0x0251,0x2E2C,0x0AEC,0x189F,0x355A,0x11CB,0x247B,0x3149,
+ 0x0F1B,0x2A8E,0x1B5D,0x2EB3,0x12B0,0x2698,0x3A38,0x056E,
+ 0x368F,0x2446,0x14F1,0x2FCB,0x1052,0x2B4C,0x0010,0x2773,
+ 0x077E,0x3C2D,0x20A3,0x0E7C,0x3D6C,0x1FBA,0x12B8,0x3A86,
+ 0x224F,0x10E6,0x2AFA,0x1758,0x2DA2,0x11C2,0x2292,0x2A93,
+ 0x143D,0x2CE6,0x1202,0x30C0,0x04C5,0x26BC,0x1AF1,0x22C6,
+ 0x2C50,0x1048,0x205B,0x36B3,0x14B4,0x3985,0x02E8,0x1AD1,
+ 0x0671,0x3755,0x2314,0x180E,0x21E8,0x319D,0x0D9D,0x1B63,
+ 0x3347,0x149F,0x3F27,0x07DD,0x2A6D,0x13F5,0x2C1F,0x1028,
+ 0x19D9,0x3A2E,0x1517,0x2E64,0x1B93,0x086B,0x372C,0x1C64,
+ 0x2F54,0x0E6B,0x1BF9,0x3649,0x0F17,0x2B82,0x189C,0x25E1,
+ 0x1F17,0x095B,0x30A3,0x0159,0x2C52,0x0A49,0x27C9,0x03D3,
+ 0x3886,0x1ADF,0x25D0,0x0271,0x2EC6,0x0956,0x313A,0x0F14,
+ 0x2CFD,0x13B4,0x2668,0x3C2E,0x0D34,0x160F,0x3ECB,0x17CB,
+ 0x0543,0x3A01,0x20D6,0x19DD,0x2862,0x123D,0x3AC1,0x1591,
+ 0x33E7,0x04B2,0x2675,0x1829,0x223E,0x376E,0x0BBC,0x33BC,
+ 0x17BE,0x22F4,0x3279,0x208E,0x0166,0x3A83,0x1C56,0x048E,
+ 0x3D85,0x20CA,0x0876,0x234B,0x37F8,0x0328,0x1716,0x3112,
+ 0x19FB,0x0804,0x2A39,0x03C7,0x3B61,0x1D97,0x3825,0x12D2,
+ 0x30B5,0x1A48,0x025D,0x2D5E,0x1910,0x04B8,0x328B,0x09F6,
+ 0x1A82,0x3E4E,0x0CD5,0x35D6,0x03A3,0x3F2B,0x0864,0x1C5A,
+ 0x329D,0x066E,0x3A51,0x0EBE,0x3D31,0x1333,0x3779,0x0CD2,
+ 0x173A,0x334C,0x2754,0x003F,0x2D37,0x0B44,0x1FD7,0x3B5B,
+ 0x2F4F,0x1DA3,0x03C0,0x2E77,0x0A32,0x1655,0x37D1,0x2780,
+ 0x0AE9,0x2E08,0x0F43,0x247A,0x1A83,0x3AE2,0x0104,0x345E,
+ 0x2074,0x070F,0x2AD8,0x0E11,0x3EA6,0x25CD,0x0CBD,0x2933,
+ 0x079C,0x334F,0x26A5,0x01DD,0x3F1A,0x1CCA,0x05E8,0x3BB8,
+ 0x128F,0x36D8,0x160D,0x3B07,0x16F5,0x3674,0x13D2,0x33F5,
+ 0x2222,0x087B,0x3D80,0x2112,0x181B,0x24CD,0x1BB4,0x2705,
+ 0x0028,0x3A9D,0x0935,0x1976,0x2C76,0x234F,0x096B,0x308E,
+ 0x1C8F,0x28F4,0x0867,0x37D8,0x0B65,0x300C,0x02C8,0x2AB6,
+ 0x1FE2,0x3C7B,0x0C66,0x39AF,0x013A,0x15E1,0x2D53,0x13CA,
+ 0x3F22,0x07E5,0x1514,0x3C70,0x25E9,0x0CAD,0x3041,0x1806,
+ 0x253B,0x11A1,0x3193,0x18C5,0x0DAD,0x219B,0x2B68,0x0FB4,
+ 0x257E,0x3AA8,0x124E,0x3312,0x1ACA,0x0A91,0x22C9,0x33D3,
+ 0x0CB7,0x2480,0x39D6,0x105D,0x3628,0x2973,0x151F,0x2518,
+ 0x33B4,0x017B,0x2F9D,0x14B6,0x1F6F,0x27AC,0x1808,0x389F,
+ 0x0FA2,0x2758,0x1D2E,0x2AA5,0x0A6D,0x2D24,0x0192,0x2175,
+ 0x3BA6,0x05DF,0x1986,0x3F57,0x1279,0x248D,0x3410,0x0FE9,
+ 0x20FE,0x0E48,0x3FD4,0x1EAF,0x39E0,0x235E,0x05C4,0x18B0,
+ 0x3BD9,0x0191,0x1F44,0x319E,0x054C,0x1D87,0x2F37,0x0C80,
+ 0x3CE2,0x24B0,0x11D9,0x32A4,0x0502,0x1867,0x397C,0x12BE,
+ 0x3C73,0x1ED5,0x1381,0x2D15,0x1524,0x2422,0x304F,0x0CE0,
+ 0x2A17,0x0495,0x28B7,0x0B94,0x26C3,0x0672,0x2E42,0x1D1B,
+ 0x0EF1,0x303D,0x1555,0x343D,0x0AF4,0x3E9C,0x052F,0x386F,
+ 0x20FC,0x1713,0x22AD,0x358E,0x022E,0x38C4,0x1E60,0x1161,
+ 0x3D2F,0x0EEE,0x3319,0x16CC,0x2567,0x1BB8,0x373F,0x1466,
+ 0x093E,0x19B0,0x29C6,0x124B,0x27F1,0x3DF6,0x217D,0x041C,
+ 0x2786,0x1CAD,0x2D0E,0x05AE,0x1E66,0x29C1,0x13E8,0x3890,
+ 0x0A30,0x35F2,0x0044,0x3B95,0x1CDC,0x35BA,0x0B6C,0x3FCD,
+ 0x011C,0x1E4D,0x2DD1,0x092C,0x26D0,0x3EEF,0x1813,0x05AF,
+ 0x2C34,0x1D18,0x08B2,0x271B,0x20EA,0x0C56,0x3C0E,0x072A,
+ 0x1D35,0x2A72,0x0F49,0x2405,0x398F,0x0B1C,0x2C9F,0x0108,
+ 0x2373,0x3712,0x02F4,0x182E,0x35DD,0x2358,0x1B8A,0x2EF7,
+ 0x0B7E,0x2AF5,0x1F96,0x0D1B,0x31B5,0x1881,0x07E2,0x27CE,
+ 0x0168,0x34D5,0x1A0E,0x0836,0x1396,0x304E,0x1D11,0x2CBB,
+ 0x1190,0x23EA,0x36D6,0x10A9,0x3D57,0x2625,0x12BB,0x29F8,
+ 0x17EB,0x02FF,0x38DD,0x1AB8,0x2130,0x2B3C,0x009C,0x2DAA,
+ 0x229C,0x0414,0x38AE,0x0D71,0x33AF,0x0AB2,0x19E5,0x35EB,
+ 0x144F,0x3FA8,0x10F6,0x34AE,0x1329,0x3DFA,0x22D1,0x007F,
+ 0x39EF,0x1FA1,0x0565,0x1E31,0x2BBF,0x1251,0x333D,0x1508,
+ 0x2F50,0x0C44,0x3173,0x10F2,0x2B0D,0x0DF1,0x2E57,0x21EB,
+ 0x0094,0x26BE,0x203C,0x0411,0x3CD6,0x0A2E,0x22FF,0x31D3,
+ 0x1DE2,0x2F10,0x03C5,0x3327,0x1ED0,0x0883,0x1B5A,0x3501,
+ 0x1045,0x38EE,0x0E54,0x360F,0x15DE,0x3ED7,0x02B9,0x1D20,
+ 0x2C7E,0x1327,0x293F,0x0C31,0x2891,0x05E1,0x2D9D,0x1933,
+ 0x3180,0x0E51,0x227E,0x3740,0x149A,0x01F0,0x2171,0x3942,
+ 0x13D0,0x36C0,0x17A2,0x3FD4,0x00AF,0x1DDC,0x2845,0x1958,
+ 0x38C6,0x1380,0x3D28,0x0649,0x19E6,0x323A,0x13A9,0x3C29,
+ 0x1AB2,0x0D4F,0x20A1,0x2E1D,0x14E2,0x059F,0x3F06,0x0FAD,
+ 0x3578,0x12FB,0x39E6,0x25B9,0x0410,0x38DC,0x1CC1,0x3C8F,
+ 0x2DB4,0x11DD,0x2875,0x32F4,0x20C5,0x0086,0x3E8E,0x0C6B,
+ 0x34AB,0x1BD7,0x0B54,0x2C55,0x1763,0x0994,0x37EB,0x066A,
+ 0x325C,0x1D2F,0x273F,0x09F1,0x2FDE,0x0DDF,0x3530,0x1DBE,
+ 0x1168,0x3139,0x17B6,0x2A91,0x04D2,0x3A98,0x27BD,0x0010,
+ 0x237F,0x1C22,0x2C8E,0x0298,0x2F11,0x1DDB,0x101A,0x2D2D,
+ 0x0B9B,0x2A44,0x1A78,0x3BDE,0x017E,0x2886,0x1FCD,0x0773,
+ 0x1DE9,0x3F92,0x0451,0x2737,0x1C58,0x3BC0,0x05DC,0x3696,
+ 0x1954,0x34A8,0x0DCE,0x2F9B,0x12D7,0x2E11,0x1784,0x0043,
+ 0x3FBE,0x0D70,0x383C,0x2343,0x0FA7,0x36C1,0x28C6,0x14E4,
+ 0x2EDE,0x0087,0x1F65,0x285F,0x0941,0x2278,0x33ED,0x2685,
+ 0x074E,0x3E4D,0x1FC1,0x3383,0x1071,0x3D0F,0x2305,0x118F,
+ 0x2024,0x38D3,0x04C6,0x16E9,0x2C87,0x1D3C,0x2EC5,0x0FD5,
+ 0x2874,0x0374,0x2F42,0x14FE,0x2BE9,0x37AD,0x0D9C,0x3065,
+ 0x0349,0x28A8,0x0B9C,0x347A,0x25E2,0x0463,0x2983,0x0A1D,
+ 0x3341,0x2470,0x3E46,0x092F,0x3928,0x2223,0x18D3,0x27E8,
+ 0x0291,0x309D,0x08AC,0x1B20,0x2A56,0x0F38,0x2C3B,0x1481,
+ 0x0A7F,0x3AB8,0x04C3,0x15DA,0x383F,0x2672,0x0FCD,0x29D7,
+ 0x0514,0x27D7,0x392E,0x0396,0x2232,0x307E,0x1C45,0x2529,
+ 0x0ECA,0x3EF5,0x1309,0x3716,0x15B8,0x3B48,0x2192,0x062D,
+ 0x29CB,0x0BB9,0x3D1F,0x10B0,0x254C,0x1E1D,0x0FDA,0x2BF7,
+ 0x392F,0x0861,0x1877,0x3C18,0x23F0,0x07AF,0x374E,0x18E0,
+ 0x3F59,0x1171,0x34E9,0x0E28,0x2EFB,0x0FCB,0x31DE,0x1A44,
+ 0x2C3D,0x0F4C,0x1F4A,0x37AE,0x083D,0x17B8,0x2A77,0x1472,
+ 0x2CD0,0x07E0,0x3AE1,0x1A85,0x2769,0x06B7,0x396C,0x20FF,
+ 0x11ED,0x2B3B,0x1A3F,0x0AE3,0x2FB0,0x187B,0x05D8,0x3A61,
+ 0x0C53,0x23ED,0x3B1A,0x1280,0x3027,0x1A1C,0x0AF8,0x1673,
+ 0x2F36,0x1A91,0x03AE,0x16B8,0x2AFD,0x1C5E,0x0292,0x3428,
+ 0x08A1,0x271F,0x1BA3,0x3CD9,0x0A2F,0x3616,0x0710,0x3E18,
+ 0x0D10,0x34E5,0x224D,0x0BE7,0x1FA3,0x0624,0x24A7,0x11FE,
+ 0x336B,0x1558,0x2DFB,0x1E22,0x0FE6,0x361C,0x1D00,0x2F52,
+ 0x145A,0x051B,0x1633,0x3120,0x11E0,0x29EC,0x082A,0x386A,
+ 0x20DA,0x16FA,0x2336,0x3DB8,0x13A0,0x366F,0x0647,0x2406,
+ 0x1785,0x2593,0x1D63,0x2B9D,0x08C7,0x1B03,0x35ED,0x14FF,
+ 0x3CA1,0x191F,0x0E38,0x1E4B,0x3E67,0x155C,0x004E,0x3A97,
+ 0x1FF2,0x07DF,0x2CE3,0x0243,0x2A53,0x08B6,0x1961,0x3FD4,
+ 0x1421,0x3467,0x0171,0x201C,0x2FF6,0x08EC,0x3DED,0x1CBC,
+ 0x0E27,0x210F,0x3134,0x1553,0x0C81,0x1F0A,0x282B,0x0392,
+ 0x2197,0x311F,0x0648,0x23AF,0x17C9,0x3816,0x0A0C,0x3CFB,
+ 0x0289,0x360C,0x24B4,0x1273,0x31FF,0x2539,0x0C0B,0x3E87,
+ 0x0FC6,0x1F3F,0x23EF,0x024A,0x3E2D,0x1E47,0x0E29,0x3473,
+ 0x2603,0x050C,0x3C0A,0x2040,0x0221,0x3D43,0x2519,0x12DB,
+ 0x2BB6,0x1B1E,0x081C,0x3304,0x0454,0x3C19,0x1F4F,0x3702,
+ 0x0F27,0x3A15,0x1EDA,0x3562,0x0917,0x3987,0x17C4,0x2394,
+ 0x3C17,0x0DC1,0x2F8B,0x1142,0x2AA2,0x18AD,0x25C1,0x1356,
+ 0x2D01,0x19B8,0x081F,0x3C30,0x2A08,0x187F,0x3EC8,0x2032,
+ 0x0920,0x3A22,0x2117,0x004A,0x3F7F,0x22FE,0x072C,0x17A0,
+ 0x3D01,0x1EAB,0x2B99,0x1C71,0x0084,0x349E,0x1F7B,0x1378,
+ 0x323C,0x0AF7,0x2E87,0x00F7,0x3123,0x0C8F,0x2006,0x3E51,
+ 0x2ED8,0x0D6E,0x3477,0x0F09,0x3D98,0x238A,0x0338,0x30B4,
+ 0x0A11,0x209B,0x3280,0x28C5,0x090B,0x34D8,0x2710,0x116A,
+ 0x2DE6,0x1AE8,0x222B,0x348C,0x0FF7,0x2679,0x30A2,0x0CAB,
+ 0x2BDE,0x22EE,0x19C2,0x3800,0x123C,0x34D0,0x2339,0x0347,
+ 0x29CC,0x379D,0x0533,0x22B9,0x39AE,0x2A31,0x0DE0,0x3233,
+ 0x0A56,0x19D2,0x29AD,0x3AD5,0x0361,0x1C95,0x27FD,0x1463,
+ 0x2A1E,0x192D,0x09AD,0x3DC4,0x0120,0x1B25,0x2D9F,0x034A,
+ 0x27BB,0x38A5,0x13D7,0x32D7,0x11A7,0x3055,0x2268,0x08CA,
+ 0x1920,0x2EA1,0x13F1,0x274A,0x329F,0x0E93,0x1E3B,0x35C8,
+ 0x035F,0x3FD4,0x2624,0x0FB5,0x2B45,0x14AF,0x2DC9,0x00D6,
+ 0x2A69,0x06A9,0x2E7A,0x1385,0x2820,0x0EFE,0x2FE8,0x0686,
+ 0x1C9C,0x2A24,0x0079,0x346B,0x220A,0x03F6,0x3B4B,0x1F40,
+ 0x0137,0x3846,0x1CD9,0x2385,0x0E8F,0x31A2,0x021C,0x3544,
+ 0x1B71,0x2530,0x1135,0x2FFC,0x18F2,0x0CF1,0x3A9A,0x27DD,
+ 0x0222,0x341A,0x0AC0,0x3A1A,0x22F3,0x15AE,0x3C9C,0x0459,
+ 0x1C1F,0x3B08,0x10A6,0x1E24,0x26AE,0x1914,0x3260,0x02D2,
+ 0x1C4C,0x39A3,0x01FF,0x2FBF,0x1F35,0x12D8,0x2D38,0x1727,
+ 0x2433,0x39C8,0x01CC,0x1370,0x2E4C,0x205C,0x0D31,0x3691,
+ 0x0485,0x3BE5,0x0B3E,0x18C2,0x3D5E,0x1F7A,0x033B,0x3865,
+ 0x1E08,0x0551,0x2E28,0x0ACE,0x2AEB,0x0663,0x175A,0x3278,
+ 0x1FCA,0x0F5D,0x1CCE,0x3329,0x01A5,0x176C,0x3CA3,0x1376,
+ 0x38B5,0x2653,0x1577,0x0C55,0x2261,0x3575,0x06EC,0x3959,
+ 0x0B77,0x345D,0x28C1,0x1390,0x2388,0x399F,0x0EC5,0x35F5,
+ 0x1DAD,0x0717,0x2A09,0x0A95,0x2B86,0x0449,0x37AB,0x1C9B,
+ 0x3B36,0x1078,0x371B,0x061A,0x1AD0,0x2C72,0x08FC,0x20EE,
+ 0x3170,0x0D2E,0x190E,0x386B,0x21E3,0x0A6B,0x1C03,0x3DEE,
+ 0x12BA,0x2583,0x0CD9,0x3F89,0x018F,0x364F,0x2225,0x163E,
+ 0x3254,0x100A,0x3F5B,0x1E36,0x0E2E,0x30D3,0x1083,0x32EA,
+ 0x24A8,0x0D77,0x2FEE,0x045B,0x3A6F,0x1648,0x2870,0x0F01,
+ 0x2D84,0x04E0,0x3C6C,0x08AE,0x1FF7,0x31B0,0x11A3,0x20C6,
+ 0x2E99,0x12D5,0x26FD,0x0F48,0x2D6C,0x08D1,0x2917,0x2135,
+ 0x2B3A,0x0741,0x2251,0x3727,0x0544,0x3C14,0x1443,0x2749,
+ 0x079A,0x234E,0x1AAD,0x24E0,0x0694,0x3B0D,0x0B1F,0x3732,
+ 0x074C,0x1589,0x25F9,0x355D,0x182D,0x05BF,0x2FF5,0x13E4,
+ 0x2997,0x1604,0x27A2,0x2F44,0x06BE,0x1570,0x33D8,0x239E,
+ 0x0E46,0x3AD0,0x1663,0x3E69,0x1BC6,0x216B,0x3B90,0x14DB,
+ 0x0936,0x3EC9,0x276C,0x11C8,0x2CE4,0x2136,0x0746,0x2FB8,
+ 0x1EC2,0x010B,0x3E47,0x1CF4,0x30C3,0x10A0,0x2D1B,0x21CC,
+ 0x15D3,0x1F77,0x04A4,0x2F95,0x1D12,0x08BA,0x308C,0x20AB,
+ 0x1114,0x338B,0x18F9,0x3A0E,0x1557,0x268C,0x132A,0x29E6,
+ 0x018D,0x2BF4,0x0BA6,0x21FE,0x3E9F,0x1592,0x39EC,0x11B3,
+ 0x248A,0x1CE6,0x2E44,0x01DA,0x1692,0x35DF,0x2357,0x08DF,
+ 0x210B,0x31F4,0x18DA,0x22AF,0x2D40,0x14D0,0x0B2F,0x3A8D,
+ 0x046C,0x2791,0x206E,0x08FB,0x39AC,0x1C0A,0x2BA5,0x09EB,
+ 0x1B36,0x3D7F,0x13F7,0x2957,0x0B5C,0x2F08,0x07DB,0x3DC3,
+ 0x132E,0x291B,0x1698,0x35AC,0x2657,0x0397,0x3824,0x097D,
+ 0x1A1A,0x3799,0x05AA,0x3FC5,0x1842,0x3388,0x0D67,0x14DA,
+ 0x3EA9,0x1788,0x2FE9,0x12A2,0x2BFE,0x21E0,0x0969,0x305B,
+ 0x376D,0x1237,0x3F11,0x10D8,0x32D4,0x1945,0x2B0B,0x1167,
+ 0x2860,0x3F88,0x1A96,0x0831,0x3C47,0x22CA,0x1B28,0x3A21,
+ 0x0999,0x330A,0x0111,0x2022,0x38F7,0x2328,0x0961,0x16ED,
+ 0x2FA1,0x21B5,0x081B,0x25A8,0x0258,0x2DE5,0x0B2D,0x263C,
+ 0x340D,0x20D7,0x05FD,0x3AA5,0x0AD5,0x3489,0x1A97,0x2563,
+ 0x0E99,0x2D7A,0x113E,0x2B22,0x047E,0x3C80,0x1B2E,0x0077,
+ 0x3F38,0x241A,0x3698,0x0F28,0x3B63,0x169A,0x26E4,0x04DE,
+ 0x3FA1,0x2460,0x00D3,0x1D56,0x2E78,0x0822,0x3EEA,0x0F2D,
+ 0x3392,0x14F6,0x1E9A,0x30EE,0x0CAE,0x28EE,0x00FC,0x2D39,
+ 0x06C7,0x3414,0x0B73,0x3DA1,0x28E9,0x0542,0x3162,0x181E,
+ 0x3790,0x03F9,0x3929,0x09A9,0x1D7E,0x3C8C,0x1BEB,0x2993,
+ 0x192E,0x350B,0x127F,0x2EC2,0x2354,0x0654,0x15B6,0x37C9,
+ 0x27B1,0x059D,0x3453,0x170B,0x3782,0x1264,0x241C,0x1ACD,
+ 0x32E3,0x0C08,0x2E55,0x0E1C,0x1A70,0x2B1F,0x14DE,0x24F6,
+ 0x30E2,0x0E8C,0x294C,0x1FB0,0x02C5,0x1E01,0x38BB,0x260E,
+ 0x01BE,0x29D3,0x0BD3,0x3A7D,0x0DEA,0x1B52,0x344A,0x15E5,
+ 0x0C26,0x2909,0x03B2,0x2A01,0x0C3D,0x2731,0x00CD,0x33E5,
+ 0x1E7C,0x0426,0x2F7B,0x1FD3,0x1069,0x3153,0x02AE,0x25C8,
+ 0x1E6B,0x1214,0x3E3B,0x17CA,0x0CF5,0x2CA0,0x1CB1,0x3CF8,
+ 0x006D,0x1ADE,0x36CE,0x0EF9,0x34F4,0x1354,0x3988,0x1B74,
+ 0x00B9,0x17E5,0x2E7D,0x15DB,0x2AE1,0x12CF,0x3DBA,0x0465,
+ 0x37AA,0x1880,0x339E,0x0B1E,0x28AF,0x0E81,0x2678,0x316A,
+ 0x131D,0x0895,0x1996,0x2B6A,0x01ED,0x3269,0x109D,0x2CAB,
+ 0x17BA,0x0D5D,0x2205,0x3C4F,0x0EA5,0x350A,0x1C20,0x2789,
+ 0x076F,0x3CE6,0x258D,0x0368,0x381C,0x13A2,0x361F,0x1503,
+ 0x3CAD,0x1783,0x26E8,0x1154,0x1D99,0x3AB4,0x1053,0x2BCE,
+ 0x0E1B,0x1E3A,0x27E1,0x160E,0x2AC8,0x02F8,0x3324,0x07D1,
+ 0x2465,0x0A7B,0x3876,0x02AB,0x177C,0x3E72,0x2245,0x020A,
+ 0x1846,0x2E31,0x0F6F,0x2665,0x008A,0x20B7,0x3106,0x03D0,
+ 0x1FC0,0x3ADA,0x01AE,0x215B,0x395A,0x07A4,0x3E84,0x1C2A,
+ 0x0132,0x3B7B,0x13E6,0x35E3,0x1AA4,0x3057,0x06A7,0x1F34,
+ 0x3651,0x1A24,0x336C,0x037C,0x211A,0x3FB1,0x002A,0x2B1A,
+ 0x3A23,0x1BF1,0x3513,0x1556,0x3C5D,0x1684,0x385B,0x21C1,
+ 0x0D37,0x2C17,0x0ED9,0x38BE,0x24EF,0x0BC0,0x3F51,0x0E74,
+ 0x379C,0x21EC,0x088E,0x2366,0x32B0,0x03DF,0x356F,0x0DA4,
+ 0x2627,0x3171,0x1449,0x2947,0x1938,0x27EF,0x06DF,0x30E5,
+ 0x1EBB,0x3D3A,0x09C5,0x3821,0x02CB,0x242F,0x0D23,0x2F5A,
+ 0x200B,0x06E2,0x235F,0x39FD,0x13D9,0x373B,0x0793,0x17FF,
+ 0x3539,0x1E82,0x3C13,0x0C02,0x25BA,0x1A33,0x3D18,0x0B23,
+ 0x36BF,0x1C6D,0x2DBF,0x05EF,0x29AB,0x1809,0x02E0,0x3157,
+ 0x1FBE,0x1679,0x0A5D,0x2D8F,0x18BD,0x26B4,0x07BF,0x2ADB,
+ 0x1C69,0x03CF,0x3699,0x206C,0x07AD,0x22D5,0x2F91,0x022F,
+ 0x20AD,0x3B82,0x0726,0x33FA,0x0F96,0x304D,0x1321,0x1F1C,
+ 0x3DE9,0x16E5,0x2642,0x1D19,0x3161,0x0FC1,0x33DA,0x1D76,
+ 0x3B94,0x08C3,0x1EEE,0x3FA0,0x1B26,0x39F3,0x10AC,0x36D9,
+ 0x14A7,0x2483,0x1BA5,0x3245,0x1410,0x2F6D,0x109B,0x33E8,
+ 0x2193,0x0C2D,0x2E39,0x07C3,0x2B07,0x0CB5,0x3C55,0x1146,
+ 0x23A0,0x0F93,0x2543,0x1C68,0x2DD7,0x11A5,0x2633,0x17E3,
+ 0x05CD,0x2461,0x0A42,0x2F1E,0x052D,0x2CCC,0x09D2,0x1B83,
+ 0x3CF9,0x128A,0x3365,0x014F,0x1CBD,0x2AF4,0x14A8,0x2C70,
+ 0x0457,0x3203,0x196A,0x39CF,0x0F68,0x287D,0x12A5,0x2B44,
+ 0x1BFD,0x0A13,0x3A32,0x04A6,0x3F4E,0x0C2E,0x365D,0x106E,
+ 0x2BA6,0x0E55,0x29FC,0x2173,0x18D0,0x3553,0x1B9E,0x26CC,
+ 0x1216,0x3F1C,0x1AD7,0x026E,0x3088,0x218E,0x1D46,0x2AAD,
+ 0x05A3,0x2E24,0x1533,0x20C0,0x390A,0x0729,0x1DE6,0x2A33,
+ 0x039B,0x312E,0x0C87,0x3791,0x1165,0x3297,0x22E5,0x0D05,
+ 0x39BD,0x23A4,0x354C,0x0FE4,0x3BD8,0x0DE2,0x3370,0x102D,
+ 0x241E,0x312B,0x0EDF,0x29BF,0x3974,0x0C1F,0x155F,0x3EE4,
+ 0x25F7,0x1127,0x2E12,0x1CBF,0x3E99,0x0979,0x21C2,0x359F,
+ 0x012F,0x2C25,0x0BA5,0x3BD3,0x07AA,0x2BE0,0x0C79,0x29DE,
+ 0x11FD,0x3356,0x23A7,0x0C49,0x2E98,0x0759,0x2A46,0x0A38,
+ 0x2C09,0x06B9,0x3F0C,0x0AD3,0x26C6,0x0320,0x28B8,0x094A,
+ 0x2C6A,0x164F,0x2283,0x39DD,0x1255,0x26DE,0x1740,0x32F9,
+ 0x049C,0x3E1A,0x0A07,0x393C,0x06B2,0x3694,0x0ADF,0x3119,
+ 0x3DD5,0x165A,0x37C4,0x1A63,0x255A,0x143B,0x30E1,0x22F1,
+ 0x05FE,0x204E,0x2793,0x15AA,0x3B51,0x0708,0x33D7,0x1760,
+ 0x2838,0x0FD4,0x2A13,0x0217,0x2ECE,0x1FC4,0x3F81,0x0629,
+ 0x375A,0x23E5,0x10D6,0x2C4B,0x125D,0x2EA0,0x158D,0x26FE,
+ 0x041E,0x36ED,0x1B3B,0x0727,0x301B,0x0A4D,0x3B9B,0x004D,
+ 0x32ED,0x0A9A,0x212E,0x2B8E,0x1767,0x0C46,0x3B17,0x11C9,
+ 0x384B,0x22A6,0x02FE,0x2C30,0x0DB9,0x317B,0x23E9,0x11B2,
+ 0x3A64,0x15FB,0x253A,0x1A4F,0x2841,0x0A9C,0x3D89,0x1D8F,
+ 0x137B,0x0063,0x1B27,0x289F,0x0532,0x2FF2,0x1A72,0x3AFF,
+ 0x0ABC,0x1F60,0x3F6A,0x0015,0x188A,0x284D,0x3397,0x19D4,
+ 0x0ADA,0x3589,0x17B2,0x008B,0x2496,0x1ABC,0x2A47,0x0E85,
+ 0x2F6E,0x1224,0x349F,0x13DA,0x2531,0x19A0,0x3AD3,0x060F,
+ 0x2FAE,0x19DA,0x033E,0x363A,0x1681,0x2752,0x13BB,0x3CF6,
+ 0x1D29,0x303C,0x117E,0x2A26,0x1733,0x3BC1,0x122E,0x3658,
+ 0x1E67,0x3DD8,0x03C6,0x1B89,0x2EFA,0x00DC,0x2A36,0x0EAD,
+ 0x2D58,0x1364,0x319C,0x15A0,0x2AE0,0x19B5,0x2846,0x1475,
+ 0x0CE1,0x295F,0x017A,0x2BA3,0x0B6B,0x3ED2,0x0304,0x396D,
+ 0x18E9,0x3583,0x091B,0x3094,0x199E,0x2659,0x0F1E,0x3D75,
+ 0x0AF3,0x3634,0x1E8A,0x3C03,0x16FE,0x07C4,0x1A2E,0x2D88,
+ 0x1675,0x02BD,0x3386,0x1D45,0x251D,0x0164,0x3C58,0x1966,
+ 0x2D6E,0x133F,0x24D7,0x3FCB,0x10EF,0x2813,0x144D,0x2D5C,
+ 0x22F9,0x1694,0x34DD,0x0F60,0x3D29,0x25EE,0x0152,0x320A,
+ 0x0AEB,0x1B61,0x3DAF,0x1426,0x35C4,0x1887,0x0010,0x3031,
+ 0x1CF2,0x096D,0x3E10,0x01D1,0x3920,0x1EDE,0x0515,0x291F,
+ 0x363B,0x1EFF,0x3F47,0x1268,0x2B4D,0x2025,0x01CE,0x1E74,
+ 0x2E1F,0x0659,0x24DA,0x1C30,0x303F,0x13C6,0x0494,0x1FAC,
+ 0x2C9D,0x0612,0x26FC,0x3A34,0x0D45,0x3743,0x04F0,0x3C44,
+ 0x1DB0,0x26CE,0x044F,0x20A5,0x307D,0x0027,0x240C,0x1F37,
+ 0x0EAA,0x3E3C,0x2600,0x1140,0x2CB2,0x04AA,0x3216,0x21DB,
+ 0x0101,0x18EF,0x3830,0x0511,0x34F6,0x0DC0,0x2D8E,0x1AFD,
+ 0x0616,0x134D,0x2896,0x3529,0x0FDB,0x3F69,0x0B2C,0x382D,
+ 0x1E19,0x276D,0x0162,0x240B,0x0BA7,0x3C9A,0x02BA,0x2D11,
+ 0x35BC,0x1106,0x3B98,0x1215,0x34B8,0x16D0,0x2806,0x0CB6,
+ 0x2B60,0x1386,0x3DDE,0x2119,0x04DC,0x374B,0x1F33,0x0017,
+ 0x302A,0x1B97,0x05D6,0x13D4,0x328C,0x1EF0,0x3948,0x0D56,
+ 0x26B3,0x3DD6,0x18AF,0x080A,0x3133,0x1F5F,0x0ED5,0x33CE,
+ 0x0B5A,0x3A2A,0x01E5,0x1EED,0x3433,0x050F,0x3869,0x1C8A,
+ 0x08BB,0x3A6A,0x04BB,0x2F9A,0x0809,0x1BE3,0x2CC3,0x15E6,
+ 0x2497,0x2F69,0x0A18,0x297E,0x067A,0x2629,0x3F0B,0x0E7D,
+ 0x2BB1,0x2256,0x16FD,0x2D4B,0x104A,0x2428,0x31F3,0x1492,
+ 0x0934,0x2C43,0x069B,0x3228,0x0B0F,0x3DBD,0x1833,0x36F3,
+ 0x11CF,0x34B1,0x0CFF,0x3868,0x08C1,0x3CC8,0x2395,0x372F,
+ 0x0FD6,0x3D58,0x20E7,0x143C,0x2BB0,0x15D5,0x2DE1,0x184A,
+ 0x085A,0x37B6,0x1A69,0x3F09,0x0DF7,0x35D1,0x1192,0x38A9,
+ 0x293B,0x0A4E,0x205A,0x3965,0x0D07,0x3BE2,0x1A52,0x0BCB,
+ 0x3685,0x2619,0x0D3D,0x2CE7,0x19BB,0x254B,0x0018,0x3CD2,
+ 0x239C,0x373E,0x17F1,0x0879,0x244F,0x1CEB,0x310D,0x196D,
+ 0x0765,0x3BDF,0x18AA,0x360A,0x1F16,0x109A,0x32B4,0x181F,
+ 0x0473,0x2379,0x1CB5,0x25E7,0x0651,0x2EA5,0x0FB1,0x31DC,
+ 0x1D8C,0x01E2,0x243A,0x0D18,0x2DB8,0x144C,0x2F0E,0x24BA,
+ 0x1113,0x2787,0x383B,0x2188,0x09FF,0x294B,0x00E4,0x3484,
+ 0x1DA1,0x0A5B,0x2265,0x3B43,0x12E4,0x37A7,0x2393,0x05B2,
+ 0x2AB3,0x17B3,0x306B,0x1201,0x2274,0x2E09,0x0E4A,0x2A8F,
+ 0x181D,0x26FF,0x1FDC,0x123E,0x226C,0x36F0,0x1064,0x3FD4,
+ 0x0539,0x1836,0x3333,0x1EF2,0x3873,0x0F97,0x203B,0x3476,
+ 0x0479,0x3622,0x0839,0x1C59,0x33CC,0x0C48,0x194D,0x3854,
+ 0x2190,0x17CC,0x3945,0x1BDF,0x2623,0x1501,0x2CFA,0x04DA,
+ 0x2892,0x16F1,0x2985,0x12FC,0x2C40,0x2105,0x157C,0x01AD,
+ 0x3156,0x1DCB,0x0BC8,0x344B,0x0363,0x283A,0x0B36,0x32B8,
+ 0x23A5,0x0F67,0x2955,0x097A,0x2C98,0x1729,0x27E5,0x0481,
+ 0x1828,0x31CF,0x0153,0x1B6D,0x2873,0x120D,0x2BB3,0x1DD9,
+ 0x2350,0x12A8,0x3D68,0x1D3D,0x08E2,0x3122,0x2129,0x150E,
+ 0x1F79,0x0BC5,0x31FA,0x1DC3,0x3AD6,0x058C,0x155D,0x2B74,
+ 0x2234,0x14BF,0x2CCB,0x05A5,0x2E8B,0x217E,0x08D6,0x26A0,
+ 0x1512,0x38EC,0x0825,0x3371,0x1B56,0x2191,0x3C16,0x0856,
+ 0x3521,0x158F,0x2FD2,0x1E0F,0x103A,0x3ACF,0x0A92,0x19F5,
+ 0x3C95,0x0B78,0x1621,0x2B11,0x3E64,0x112F,0x2FDF,0x141B,
+ 0x2A9E,0x1554,0x2E4F,0x0376,0x2A3E,0x0923,0x1AEF,0x3E0B,
+ 0x13FB,0x2840,0x0C2F,0x3BFC,0x07E8,0x1DCD,0x3E7B,0x0305,
+ 0x361B,0x0C9D,0x3DEF,0x1A39,0x323D,0x03D7,0x29D0,0x0D2D,
+ 0x2781,0x39A9,0x135B,0x0223,0x1BAB,0x2F23,0x07C6,0x1B22,
+ 0x2A63,0x12FA,0x3C1D,0x272E,0x0402,0x3FB0,0x2638,0x0169,
+ 0x2E33,0x0BF2,0x2437,0x029B,0x3064,0x08E5,0x22BA,0x38FE,
+ 0x109F,0x3E5E,0x02F0,0x3615,0x1A2F,0x057C,0x3938,0x1BD1,
+ 0x2784,0x06EE,0x2FB9,0x1090,0x3826,0x12A1,0x3F91,0x1C16,
+ 0x01AA,0x3AF6,0x151B,0x36C6,0x1C07,0x06EA,0x3D02,0x1CD8,
+ 0x373C,0x1000,0x226F,0x3449,0x07DE,0x37A6,0x028F,0x3F4D,
+ 0x0897,0x3323,0x0407,0x2812,0x3ACA,0x12F8,0x3488,0x06C2,
+ 0x3939,0x27A7,0x01F8,0x2BC4,0x0D1E,0x262B,0x3713,0x0260,
+ 0x3A6E,0x09B7,0x1D4F,0x3DA5,0x12B2,0x370C,0x1BCB,0x3F4A,
+ 0x315C,0x18FF,0x2E71,0x0DE9,0x3A2D,0x0061,0x1804,0x2A71,
+ 0x1FDA,0x3FD2,0x06D9,0x38B2,0x22C8,0x02CC,0x2154,0x3195,
+ 0x0490,0x33FF,0x2055,0x0285,0x1CF8,0x24DE,0x094C,0x3CC7,
+ 0x056F,0x383D,0x1C87,0x3346,0x0F83,0x2495,0x31E3,0x0D83,
+ 0x2F1B,0x03E4,0x32E0,0x1561,0x29FD,0x1394,0x21D9,0x31F9,
+ 0x110E,0x2C4F,0x01A4,0x28DE,0x0B4F,0x3BBE,0x1437,0x3569,
+ 0x1D78,0x08DC,0x2231,0x3E71,0x2844,0x1262,0x3C83,0x24F4,
+ 0x0A60,0x2FDC,0x2080,0x0E8D,0x2EE1,0x201F,0x11EA,0x3AD2,
+ 0x1579,0x34C9,0x1222,0x3C6D,0x1747,0x3431,0x0E26,0x1DEB,
+ 0x257B,0x0A89,0x2DC1,0x0F00,0x2644,0x31EE,0x110B,0x2B51,
+ 0x0E2F,0x3A81,0x231B,0x18EA,0x2194,0x2C68,0x05BD,0x2609,
+ 0x2FA2,0x10FD,0x2B7F,0x02E5,0x3117,0x22F8,0x10C2,0x2D45,
+ 0x0B62,0x1E8E,0x3C76,0x141F,0x2EF6,0x166B,0x3160,0x17DD,
+ 0x2B01,0x0F10,0x2F47,0x160B,0x2045,0x02C0,0x1C8B,0x2AD2,
+ 0x100E,0x19A1,0x3E9E,0x162B,0x3290,0x12EE,0x2060,0x2FCE,
+ 0x0F6C,0x331E,0x259D,0x0D4D,0x28F9,0x0095,0x2BEE,0x0A25,
+ 0x2501,0x024E,0x276F,0x20A6,0x161C,0x235C,0x36AB,0x12CA,
+ 0x0424,0x1A3A,0x28BA,0x0BD9,0x3351,0x1B4E,0x3F1B,0x11CC,
+ 0x2B89,0x0DE4,0x265D,0x3A5B,0x121B,0x3542,0x1F56,0x0F2B,
+ 0x2D21,0x21A2,0x0C47,0x16C2,0x3EFF,0x1DE0,0x003A,0x3935,
+ 0x20D4,0x19D8,0x2320,0x38B0,0x00F9,0x3729,0x0B34,0x1EB8,
+ 0x254D,0x1900,0x3814,0x0F37,0x2E92,0x1C6C,0x2454,0x0097,
+ 0x3098,0x197F,0x2C95,0x1578,0x096A,0x33BD,0x02C6,0x16BA,
+ 0x39E9,0x19C8,0x00E9,0x3557,0x1857,0x0732,0x30F2,0x0AE1,
+ 0x28DB,0x04A1,0x2A5D,0x1F4E,0x071A,0x2053,0x3B67,0x0112,
+ 0x35BD,0x195C,0x2272,0x3BAA,0x0B3A,0x1F20,0x3F21,0x0828,
+ 0x332E,0x1EC4,0x0264,0x3E21,0x08CD,0x1AA0,0x38D7,0x1641,
+ 0x0A4A,0x3387,0x1C9E,0x24D2,0x0E43,0x392C,0x1F7C,0x021D,
+ 0x3250,0x2582,0x051A,0x29F9,0x0A8A,0x24E7,0x0635,0x27CB,
+ 0x1350,0x3A7C,0x21B9,0x09BE,0x36A4,0x2485,0x3FD4,0x0993,
+ 0x3598,0x23CA,0x0DE6,0x294F,0x04B9,0x3D46,0x0A08,0x1A18,
+ 0x29DB,0x1B78,0x03D4,0x353A,0x168A,0x39D4,0x11F2,0x1EC9,
+ 0x0F5F,0x37E0,0x0BE5,0x3E75,0x0561,0x2C4A,0x0AE2,0x2E25,
+ 0x1E55,0x3136,0x116F,0x2C8D,0x13DE,0x299E,0x0658,0x2855,
+ 0x15C3,0x37E3,0x1A7C,0x0884,0x2E9B,0x03EA,0x27EC,0x3739,
+ 0x1901,0x01BF,0x3A78,0x2751,0x066F,0x2CD9,0x187A,0x267D,
+ 0x08AD,0x3115,0x0D2B,0x1D6E,0x2B94,0x1022,0x3019,0x0571,
+ 0x3C2F,0x08A6,0x2160,0x317A,0x16D2,0x0777,0x3964,0x1F5D,
+ 0x10C3,0x3B69,0x04D8,0x367B,0x233E,0x1A75,0x215C,0x2C63,
+ 0x0FCA,0x31C7,0x258A,0x113D,0x3B93,0x2262,0x1AD2,0x35D5,
+ 0x1D86,0x3DFB,0x0F87,0x379B,0x1B37,0x2EF2,0x149E,0x29DA,
+ 0x0F46,0x311C,0x0607,0x1CC4,0x3005,0x00BB,0x23F2,0x19B1,
+ 0x2586,0x11B0,0x2D8B,0x0EC6,0x28B9,0x33C7,0x0D1C,0x2044,
+ 0x3C5B,0x18AE,0x065F,0x3DD3,0x1DA2,0x0819,0x28D1,0x3FD4,
+ 0x18E4,0x0DED,0x339D,0x1296,0x3EAB,0x1977,0x39EA,0x0CF0,
+ 0x3463,0x016D,0x1C00,0x30E4,0x153E,0x0C5A,0x1719,0x2DE2,
+ 0x1BA2,0x0384,0x33C5,0x1384,0x2C5D,0x1143,0x2585,0x38A6,
+ 0x06A4,0x3EEC,0x23E7,0x10AA,0x2EFE,0x07DA,0x2275,0x3C46,
+ 0x2F5C,0x1E0A,0x309E,0x1038,0x32E9,0x1A9C,0x3D56,0x1530,
+ 0x3874,0x095E,0x3B7A,0x00E0,0x3667,0x0E45,0x3903,0x0C5B,
+ 0x30F8,0x0158,0x2C6C,0x2219,0x179E,0x3FD4,0x14BD,0x0788,
+ 0x22BC,0x3206,0x10B5,0x1BC4,0x35BE,0x1343,0x3CF2,0x1040,
+ 0x3610,0x163F,0x3F54,0x0751,0x2361,0x3D0A,0x1616,0x289C,
+ 0x150A,0x2D20,0x1AE4,0x0447,0x3EE2,0x292E,0x0E2C,0x31E4,
+ 0x251B,0x0B7F,0x291E,0x114B,0x305E,0x0C6D,0x3A96,0x061B,
+ 0x36CF,0x0929,0x1BB7,0x2B34,0x0B9F,0x2CCA,0x0288,0x24A2,
+ 0x098C,0x18F6,0x2DA8,0x0C7A,0x2910,0x03ED,0x3257,0x09CC,
+ 0x3FD4,0x20F8,0x1780,0x2AAF,0x1470,0x3468,0x0D16,0x36C2,
+ 0x043C,0x3B56,0x1623,0x365C,0x1BFF,0x0056,0x2F32,0x243F,
+ 0x0399,0x286B,0x3574,0x0F23,0x2761,0x327C,0x148A,0x0997,
+ 0x21BF,0x3B3B,0x15B0,0x2743,0x0068,0x2A75,0x102F,0x2E6D,
+ 0x1628,0x245C,0x3E57,0x0680,0x2859,0x38DB,0x22B1,0x05E6,
+ 0x3C6A,0x274D,0x0AF9,0x3B47,0x1D90,0x3617,0x0062,0x17A6,
+ 0x2DCB,0x163A,0x095D,0x3AEE,0x207C,0x19F0,0x3464,0x04BD,
+ 0x1ABE,0x0782,0x16F2,0x29EE,0x1F0C,0x0946,0x2334,0x0286,
+ 0x206B,0x2726,0x18B2,0x2467,0x1C48,0x2FFA,0x197E,0x25C2,
+ 0x1DAF,0x3DB7,0x10BC,0x3697,0x0BF7,0x1D4D,0x3309,0x1C13,
+ 0x3C4C,0x09C9,0x2522,0x30BB,0x0BB0,0x2ABF,0x04CD,0x2E6F,
+ 0x2000,0x028D,0x1F3A,0x2DEC,0x1774,0x03B3,0x33DC,0x0D5F,
+ 0x367D,0x10CE,0x3A30,0x22F5,0x119D,0x2069,0x36A8,0x0628,
+ 0x1C36,0x2F39,0x1650,0x3D5B,0x014E,0x1E75,0x279F,0x1631,
+ 0x23D5,0x1DBA,0x3D35,0x0488,0x3446,0x1646,0x3EC7,0x1405,
+ 0x3847,0x26BF,0x0088,0x32A7,0x15F5,0x3D37,0x12A4,0x1E13,
+ 0x2510,0x027A,0x386C,0x095A,0x3CAC,0x1041,0x2BDA,0x133C,
+ 0x2E83,0x0B9A,0x2708,0x0644,0x2170,0x3BAB,0x1748,0x1021,
+ 0x30C1,0x12B3,0x1FF3,0x2E9D,0x00D0,0x2103,0x374F,0x1BD2,
+ 0x2EC4,0x03F4,0x2B87,0x0C18,0x35F9,0x1BA1,0x380F,0x0460,
+ 0x2961,0x0AC9,0x185E,0x2C5F,0x1A30,0x00EC,0x3196,0x1EE5,
+ 0x0E7E,0x16AD,0x2F40,0x1A68,0x0767,0x2306,0x308F,0x1FF5,
+ 0x0E4C,0x35D2,0x1CC6,0x26B8,0x01A0,0x2CB1,0x0CDF,0x2926,
+ 0x3661,0x202D,0x3CB6,0x0110,0x38CA,0x13ED,0x35C0,0x2B92,
+ 0x0E49,0x3268,0x0756,0x3D16,0x0A57,0x2376,0x034F,0x3AE3,
+ 0x08D2,0x1899,0x292F,0x04F7,0x30A8,0x260D,0x0090,0x29B5,
+ 0x130A,0x2BFA,0x17FE,0x02FB,0x38EA,0x1A28,0x25D3,0x0E0F,
+ 0x3AEF,0x1AE3,0x3496,0x09E1,0x3998,0x2233,0x1BB6,0x2E2E,
+ 0x0020,0x2736,0x0B01,0x3417,0x1D61,0x01DC,0x2635,0x17DB,
+ 0x3E37,0x0358,0x3491,0x0CDE,0x2284,0x377B,0x0DF0,0x3F61,
+ 0x0367,0x2E02,0x0D9B,0x27D8,0x1285,0x299C,0x0DC4,0x2ED1,
+ 0x06D6,0x1CFF,0x3A46,0x10AB,0x25DA,0x083C,0x2213,0x39E2,
+ 0x118E,0x32E6,0x1373,0x2F38,0x1C7E,0x262C,0x072E,0x3DB9,
+ 0x2235,0x1B2F,0x316F,0x1403,0x2CA5,0x0C43,0x25B2,0x37EE,
+ 0x0A03,0x3EBD,0x0749,0x1A04,0x3A67,0x16BE,0x0576,0x29A2,
+ 0x0D65,0x38CD,0x1C5D,0x3039,0x1EF6,0x075D,0x2351,0x14E3,
+ 0x3CD8,0x1DA5,0x352D,0x0FED,0x3BDA,0x2159,0x0B99,0x3762,
+ 0x2392,0x3316,0x0199,0x283B,0x3953,0x1499,0x0C28,0x3E3E,
+ 0x2890,0x0357,0x2B88,0x0FF5,0x3360,0x1338,0x3FD4,0x14A3,
+ 0x030A,0x27AD,0x0DC8,0x2DCA,0x1847,0x287A,0x0675,0x1D84,
+ 0x37C7,0x163C,0x292B,0x1153,0x3179,0x1754,0x2C0C,0x149C,
+ 0x2413,0x3499,0x0D92,0x3BB3,0x20C2,0x1020,0x3B26,0x0CFC,
+ 0x3678,0x059B,0x3EB2,0x1D6F,0x23A6,0x0FAE,0x3270,0x1E3D,
+ 0x06E5,0x2C78,0x112D,0x28D7,0x0EAC,0x2B41,0x0850,0x2131,
+ 0x3F95,0x167D,0x2C08,0x0692,0x2863,0x3CC5,0x0DBB,0x2D47,
+ 0x100F,0x2ACC,0x2153,0x1527,0x2D95,0x07B1,0x2B12,0x1892,
+ 0x329A,0x14F8,0x3603,0x1768,0x3AF7,0x0634,0x373A,0x21F9,
+ 0x16DF,0x2C7C,0x0A97,0x1F97,0x3645,0x19F3,0x2D7E,0x0567,
+ 0x2A3A,0x0CBC,0x286D,0x1936,0x038A,0x39B0,0x1FBC,0x15B3,
+ 0x0172,0x37A4,0x08A5,0x3FB3,0x19F9,0x3258,0x0540,0x1E12,
+ 0x28CF,0x17AB,0x22C0,0x3487,0x0AD4,0x260A,0x3D7A,0x1200,
+ 0x34CA,0x229F,0x084D,0x145B,0x3E03,0x1765,0x32A5,0x1FA7,
+ 0x08E3,0x2D9B,0x033D,0x26EF,0x0D22,0x2E43,0x1E05,0x1485,
+ 0x07D3,0x1FBD,0x3F45,0x0D04,0x1810,0x3440,0x20E9,0x060A,
+ 0x1E49,0x37A2,0x0BB8,0x3CE5,0x18BC,0x248B,0x0862,0x2D68,
+ 0x3B3C,0x15F4,0x3395,0x1C51,0x0B8E,0x3F70,0x220E,0x0CB1,
+ 0x23AA,0x01BB,0x395F,0x1F78,0x04BC,0x3EE9,0x0BD7,0x35D4,
+ 0x062C,0x1B72,0x2D89,0x167A,0x0983,0x2F88,0x1865,0x247F,
+ 0x1DFD,0x2DF8,0x0DCA,0x29F2,0x0803,0x3B7F,0x0133,0x3754,
+ 0x220C,0x182B,0x3E2E,0x01BA,0x35FB,0x130F,0x3B4A,0x18BF,
+ 0x0C4E,0x3311,0x1267,0x38C3,0x0FC2,0x1F46,0x32D9,0x0873,
+ 0x3906,0x1E21,0x06C4,0x3B31,0x19E4,0x333A,0x116B,0x28A9,
+ 0x0B19,0x2689,0x004C,0x2D28,0x0C09,0x2533,0x1EB0,0x01C7,
+ 0x33FD,0x0FC5,0x3F29,0x2425,0x02C9,0x3130,0x0DFF,0x36EC,
+ 0x1AAF,0x3E38,0x07BC,0x37E6,0x22A4,0x0BE4,0x33DD,0x2A40,
+ 0x1D40,0x24E4,0x1837,0x281B,0x02B4,0x206A,0x3CC1,0x14CF,
+ 0x32EE,0x020C,0x2CF9,0x1353,0x2AC6,0x1126,0x1EBE,0x3069,
+ 0x017C,0x17E1,0x3AA2,0x26B9,0x02F6,0x2C51,0x0C7F,0x3B02,
+ 0x25C0,0x125F,0x3923,0x1671,0x3602,0x0508,0x3E1F,0x24B2,
+ 0x39C3,0x10B6,0x25AC,0x1CF0,0x2D76,0x02E2,0x2785,0x32B1,
+ 0x0DC9,0x21FF,0x30B7,0x1C3E,0x044B,0x3828,0x1FA8,0x10D7,
+ 0x0ADC,0x2946,0x0526,0x3A9E,0x20D9,0x03AA,0x3420,0x17C1,
+ 0x3D9E,0x1E99,0x0DB0,0x348D,0x2589,0x156B,0x2E6A,0x11CD,
+ 0x282D,0x3E5B,0x0226,0x2299,0x3894,0x1C50,0x03C3,0x31F7,
+ 0x0A52,0x174C,0x3406,0x1170,0x3022,0x14B1,0x2A48,0x12CC,
+ 0x2EDB,0x0BD2,0x24F0,0x2098,0x19F4,0x2FCD,0x049E,0x3132,
+ 0x2347,0x02F1,0x27A1,0x1CD4,0x2FBD,0x03F2,0x23E1,0x1A64,
+ 0x26F6,0x1244,0x3025,0x23B0,0x0278,0x20DD,0x3C26,0x0570,
+ 0x38B7,0x107B,0x3DCD,0x212A,0x1A0F,0x3302,0x1102,0x3CA7,
+ 0x1990,0x2774,0x051C,0x1820,0x3912,0x143F,0x2803,0x2007,
+ 0x002C,0x1EB4,0x2C24,0x0F92,0x3062,0x1E29,0x1496,0x05E7,
+ 0x3B28,0x0C60,0x34D2,0x1160,0x3917,0x0D85,0x2AD7,0x07FC,
+ 0x1F8A,0x370F,0x0CDB,0x3B75,0x036B,0x33F4,0x0913,0x2490,
+ 0x1CF9,0x2D1D,0x0F8A,0x2088,0x3798,0x1050,0x292A,0x01D2,
+ 0x1A93,0x3116,0x0813,0x2A2C,0x107F,0x2930,0x17C8,0x025F,
+ 0x1ABD,0x3224,0x04A3,0x37E1,0x0A85,0x3D5F,0x0F25,0x1C81,
+ 0x3B9C,0x1590,0x0701,0x2816,0x2E60,0x11AF,0x31FC,0x23FD,
+ 0x3079,0x12F2,0x2C0B,0x0FCC,0x25FE,0x2F97,0x0EB7,0x2ABB,
+ 0x06F1,0x26DF,0x2F22,0x16E2,0x09D8,0x2A00,0x003B,0x39C0,
+ 0x1F53,0x0EE6,0x1E2E,0x3423,0x075B,0x266E,0x3F2F,0x12C3,
+ 0x3A52,0x21DD,0x01F1,0x3DD2,0x1B94,0x2415,0x09B9,0x3C99,
+ 0x0412,0x350C,0x142D,0x3A58,0x0AC3,0x2604,0x2019,0x0FAB,
+ 0x37FA,0x1A46,0x3D94,0x0943,0x1812,0x3BC8,0x146A,0x3738,
+ 0x0075,0x3FA4,0x0AFB,0x17B1,0x383A,0x0EF2,0x1C0D,0x2C1E,
+ 0x1637,0x3178,0x1BE9,0x0881,0x3975,0x03C4,0x2FA3,0x2321,
+ 0x0958,0x30A1,0x1CA4,0x2D1A,0x0D3C,0x2B15,0x08A9,0x3BE8,
+ 0x1792,0x3391,0x13EC,0x2682,0x0208,0x3EE3,0x2368,0x310E,
+ 0x0FAA,0x298A,0x04BF,0x2E36,0x21F6,0x16D9,0x233D,0x3A10,
+ 0x0F35,0x26DA,0x1A86,0x2034,0x2F64,0x186E,0x388D,0x0DC7,
+ 0x3F73,0x05D3,0x337F,0x09CA,0x1B06,0x30AF,0x1348,0x34DA,
+ 0x23E2,0x0E72,0x3F9D,0x1CEA,0x335D,0x0947,0x3002,0x1F68,
+ 0x2CD1,0x0EDC,0x2974,0x114C,0x2B9F,0x22E3,0x16B0,0x2FA9,
+ 0x011A,0x2634,0x3971,0x1730,0x099C,0x3DF2,0x0010,0x1CF3,
+ 0x0720,0x3EB6,0x1EC3,0x3767,0x0892,0x1BA0,0x39CE,0x13AA,
+ 0x3306,0x199F,0x031F,0x3A57,0x2079,0x36E0,0x1AEB,0x238C,
+ 0x07D6,0x32DF,0x2747,0x1444,0x2CFE,0x108E,0x2057,0x2ABA,
+ 0x06B6,0x2CA1,0x19AD,0x2721,0x053D,0x31CE,0x1EF1,0x157B,
+ 0x2B90,0x107D,0x2944,0x0606,0x31B9,0x14F2,0x3D21,0x1DF5,
+ 0x07E9,0x2CF8,0x0F05,0x2577,0x3528,0x0C1B,0x2979,0x0EA4,
+ 0x2C12,0x13F0,0x3234,0x21A9,0x08AB,0x2307,0x307B,0x0BDF,
+ 0x255F,0x0441,0x2ACE,0x223F,0x0F39,0x280F,0x1DAB,0x0E78,
+ 0x3AA4,0x14D3,0x359B,0x077A,0x3DEB,0x1E73,0x34EE,0x0DBA,
+ 0x2FC1,0x06AC,0x3ACD,0x0B40,0x34BB,0x17D1,0x0924,0x1B8D,
+ 0x3642,0x1569,0x3E5F,0x1C3D,0x08EE,0x30F0,0x010E,0x1BCE,
+ 0x321D,0x04DF,0x3EFA,0x0A15,0x2514,0x068C,0x2178,0x2DD6,
+ 0x1565,0x27F8,0x16D8,0x3C12,0x2209,0x067D,0x3E83,0x1F2E,
+ 0x0537,0x2D31,0x1963,0x0030,0x20DF,0x3B78,0x13FE,0x3643,
+ 0x0B50,0x3BF5,0x15E9,0x35C6,0x1B81,0x06BF,0x3AC6,0x0B2B,
+ 0x2ABD,0x1A47,0x0D00,0x34BA,0x1DA6,0x24C7,0x193E,0x369E,
+ 0x2995,0x1AEA,0x0207,0x166A,0x327F,0x2380,0x0080,0x28F2,
+ 0x0A6C,0x3C2A,0x1D4E,0x24C4,0x1328,0x05C0,0x3212,0x0D72,
+ 0x3BF3,0x19E0,0x0433,0x3CF5,0x0AE6,0x3614,0x00E1,0x1AB6,
+ 0x36D0,0x0CC4,0x396A,0x152E,0x359C,0x0E44,0x384D,0x256F,
+ 0x08CF,0x3FD4,0x1E87,0x36AD,0x0DDB,0x2AD0,0x00DB,0x2E9C,
+ 0x2253,0x1618,0x3361,0x0163,0x20B1,0x2E58,0x0625,0x3441,
+ 0x1CB3,0x25D2,0x0471,0x3C71,0x1B35,0x35A4,0x0100,0x3E80,
+ 0x1490,0x37F0,0x124F,0x362B,0x178C,0x3FD4,0x060B,0x2C0D,
+ 0x20B3,0x00C9,0x1F7D,0x299F,0x167B,0x022C,0x1B7D,0x26FB,
+ 0x126E,0x29F3,0x2090,0x2EA8,0x1130,0x2A61,0x1F5B,0x2DAD,
+ 0x007B,0x2798,0x0E21,0x2477,0x3772,0x107E,0x3DDB,0x25D4,
+ 0x130D,0x29ED,0x1626,0x314C,0x1438,0x3D49,0x1B4F,0x026D,
+ 0x35A7,0x0B0D,0x2A92,0x0099,0x2F67,0x193A,0x2550,0x0B5D,
+ 0x3978,0x113C,0x3692,0x233F,0x156D,0x2418,0x05A7,0x1E5F,
+ 0x28AB,0x0716,0x2538,0x0085,0x2ED6,0x2189,0x1960,0x3198,
+ 0x104B,0x3F28,0x22E6,0x02A5,0x3125,0x0DF8,0x2C83,0x11FC,
+ 0x0A3A,0x33F2,0x1FAD,0x2CF0,0x0E16,0x18D9,0x3E94,0x15F9,
+ 0x2B6B,0x1055,0x30BA,0x0826,0x3F9C,0x27A3,0x1664,0x2AA1,
+ 0x1253,0x2466,0x304A,0x117B,0x290B,0x159E,0x24EC,0x315A,
+ 0x11E1,0x288F,0x1F2B,0x0851,0x2043,0x2E19,0x0055,0x1A6C,
+ 0x2F27,0x1787,0x027F,0x1B5C,0x281E,0x12A7,0x33B7,0x0CCF,
+ 0x39F9,0x0547,0x1C74,0x3F0F,0x102E,0x1AE1,0x3AC2,0x186A,
+ 0x0905,0x2F3E,0x1EDC,0x0F58,0x2E0E,0x12E0,0x2987,0x18D1,
+ 0x283C,0x0D3E,0x2DBA,0x0209,0x3097,0x0C4F,0x3382,0x114A,
+ 0x3734,0x1A6F,0x3CE7,0x0A79,0x32CE,0x2030,0x2EEF,0x04E8,
+ 0x3F97,0x1B01,0x0324,0x18F4,0x3D15,0x0478,0x38A4,0x1334,
+ 0x3B83,0x1706,0x2F71,0x03B9,0x1A7F,0x2C90,0x17DE,0x0AEE,
+ 0x3845,0x0DFE,0x3662,0x0010,0x2C2D,0x0E95,0x3201,0x267B,
+ 0x11A8,0x3AEC,0x13CB,0x32C5,0x0F6B,0x2C18,0x0E42,0x31A3,
+ 0x1D50,0x2A82,0x06ED,0x31DA,0x0A48,0x3818,0x1B9A,0x3D7E,
+ 0x120C,0x34A9,0x184F,0x3FC3,0x0D9E,0x38BC,0x03E7,0x202E,
+ 0x357C,0x0639,0x2EAA,0x1F59,0x13DD,0x391B,0x054D,0x3BE4,
+ 0x2843,0x1339,0x3B52,0x06B1,0x37F9,0x2783,0x0BFF,0x33B6,
+ 0x0513,0x3722,0x1506,0x2D23,0x1CB7,0x0AEA,0x3904,0x02C7,
+ 0x2EEB,0x0B93,0x1FDB,0x3752,0x06C8,0x3A0F,0x1C19,0x08F6,
+ 0x3D60,0x02DA,0x3493,0x1932,0x3EDB,0x0FD3,0x2259,0x3B54,
+ 0x0EFF,0x3497,0x1F92,0x3919,0x0763,0x3E74,0x1CEE,0x2714,
+ 0x1741,0x2311,0x2B5C,0x09B0,0x3047,0x2458,0x02CD,0x2768,
+ 0x3E25,0x0E10,0x3794,0x24AC,0x06FA,0x3A1C,0x0A7A,0x341D,
+ 0x0516,0x3A71,0x1B54,0x1FE5,0x242E,0x195E,0x2632,0x1E92,
+ 0x0834,0x2D8A,0x0F88,0x274B,0x13BC,0x39B9,0x1046,0x35EF,
+ 0x0AFA,0x31C2,0x1F1F,0x2CDE,0x0E59,0x2702,0x103C,0x2B65,
+ 0x06DA,0x3376,0x0CE9,0x3C86,0x21BB,0x0622,0x354E,0x20C7,
+ 0x032C,0x2DC8,0x1D80,0x23C4,0x19A4,0x399E,0x073B,0x200F,
+ 0x2B77,0x04CA,0x2432,0x1DB8,0x36F5,0x0443,0x3CFD,0x1831,
+ 0x027D,0x2187,0x3C8D,0x1752,0x2B09,0x0F81,0x2E1A,0x01FA,
+ 0x29BC,0x0D1F,0x2B3D,0x12F6,0x286F,0x161E,0x2C3A,0x11DB,
+ 0x258C,0x1D69,0x0EB4,0x3C6F,0x27E4,0x0B56,0x25BE,0x17E9,
+ 0x036E,0x2EEE,0x0C9F,0x2562,0x1E79,0x0418,0x300D,0x1B44,
+ 0x23E4,0x0D13,0x2663,0x0142,0x344C,0x13F3,0x223B,0x3345,
+ 0x153C,0x3E11,0x01AB,0x1B79,0x2B50,0x0EF8,0x2E37,0x21C8,
+ 0x182C,0x2D41,0x0D94,0x2AF9,0x0497,0x1D64,0x2C2C,0x0A0A,
+ 0x28D9,0x05C7,0x29FF,0x0C82,0x2D29,0x197B,0x038E,0x361D,
+ 0x0A58,0x3B9F,0x1456,0x36FB,0x1F00,0x11E7,0x3930,0x137D,
+ 0x1F8B,0x3141,0x01C1,0x1A0B,0x2BBC,0x1683,0x266B,0x1357,
+ 0x2C89,0x21BD,0x0865,0x3D4B,0x0A43,0x36B9,0x02FC,0x3E28,
+ 0x2264,0x172A,0x3839,0x037D,0x2BC7,0x0704,0x24C2,0x16EA,
+ 0x2A9C,0x1462,0x3A3E,0x0792,0x36B8,0x1B51,0x32A3,0x0B38,
+ 0x24F7,0x19B6,0x29D1,0x13B3,0x3185,0x1E07,0x0FC7,0x2945,
+ 0x3AAA,0x1550,0x0845,0x3CB1,0x0C6E,0x2591,0x1E2C,0x0BBB,
+ 0x3472,0x1A01,0x3EA4,0x079D,0x1B53,0x2A05,0x1383,0x271E,
+ 0x3A4F,0x14E6,0x097B,0x2F99,0x0388,0x2778,0x13B6,0x3263,
+ 0x1AA1,0x3A33,0x046F,0x33D2,0x084C,0x36E6,0x0A45,0x3E07,
+ 0x01B3,0x338F,0x2260,0x07AE,0x1C83,0x36C5,0x14C1,0x32BD,
+ 0x3D23,0x22BF,0x1906,0x35CA,0x1179,0x3BBD,0x2166,0x0FE5,
+ 0x3DCE,0x1C38,0x3879,0x172F,0x20E2,0x3CE8,0x0893,0x1D1E,
+ 0x28A4,0x0F91,0x31B7,0x23E6,0x1474,0x3FBA,0x0391,0x33B1,
+ 0x0A9B,0x1CE8,0x39D0,0x122B,0x2693,0x3AA3,0x12DE,0x3693,
+ 0x158A,0x3D91,0x115F,0x32C1,0x13DF,0x2486,0x314E,0x11AA,
+ 0x2CD8,0x1BEE,0x025E,0x25ED,0x071F,0x3277,0x0B08,0x2DB0,
+ 0x05BC,0x23EC,0x1CE7,0x3D8B,0x10FC,0x34FB,0x0329,0x3F25,
+ 0x1E63,0x11A9,0x2F0A,0x15B7,0x29C2,0x13A1,0x2E96,0x0D08,
+ 0x31CD,0x0589,0x1D59,0x323B,0x17F7,0x3C49,0x0C05,0x332D,
+ 0x00FD,0x25CC,0x0CA5,0x29A9,0x1E45,0x0190,0x1FCE,0x3F66,
+ 0x14D6,0x35E8,0x023F,0x39D2,0x09E8,0x2676,0x3F3F,0x0C0D,
+ 0x1AFE,0x2730,0x34ED,0x1044,0x2FB1,0x03F8,0x2A3B,0x380D,
+ 0x12F5,0x282E,0x0CEE,0x21D1,0x39C9,0x10BD,0x3419,0x0A65,
+ 0x1C31,0x3126,0x2478,0x1060,0x3F07,0x0C72,0x38D8,0x230D,
+ 0x0AE8,0x1FCF,0x26E9,0x19AE,0x23CE,0x1C08,0x2E80,0x14EF,
+ 0x2936,0x1377,0x3AAF,0x1617,0x300A,0x00FF,0x2B39,0x0D42,
+ 0x1B5E,0x089E,0x31C6,0x015A,0x2B95,0x19F8,0x0930,0x2CCD,
+ 0x0254,0x29E4,0x09A8,0x2FDB,0x0584,0x2A06,0x18E5,0x367E,
+ 0x04B1,0x3A31,0x2099,0x060E,0x34F7,0x0BE2,0x2790,0x16F7,
+ 0x3BB1,0x253D,0x0179,0x3110,0x1EA4,0x07C5,0x2D9E,0x0301,
+ 0x23C6,0x1ACF,0x26D5,0x0185,0x3C07,0x08B0,0x1EBF,0x38C7,
+ 0x06A1,0x218D,0x3398,0x16B6,0x3EB3,0x156A,0x28F3,0x176D,
+ 0x3606,0x1094,0x322C,0x0646,0x28D5,0x0C77,0x2D6A,0x22AC,
+ 0x0939,0x38D2,0x0156,0x354A,0x0660,0x3BE9,0x168D,0x278E,
+ 0x12B4,0x39FA,0x24EE,0x0EBF,0x28CA,0x1206,0x2DDB,0x1CCB,
+ 0x3D67,0x10D2,0x3495,0x15F3,0x3C10,0x141E,0x2C75,0x0520,
+ 0x290C,0x0C40,0x27F6,0x11C1,0x2E0B,0x1888,0x014A,0x2286,
+ 0x3075,0x058A,0x193D,0x2B1C,0x137C,0x3FD4,0x15FC,0x2296,
+ 0x011D,0x326A,0x186D,0x2E3C,0x0B4E,0x28C4,0x0160,0x24F2,
+ 0x375B,0x0578,0x1AFA,0x3541,0x1672,0x2BCF,0x1BEF,0x04E3,
+ 0x3E6E,0x1452,0x3683,0x0CC7,0x3D36,0x0309,0x21CD,0x39A0,
+ 0x0C45,0x2DFC,0x0486,0x26D8,0x1979,0x3F63,0x122A,0x28E1,
+ 0x3862,0x20F0,0x10C6,0x3FD4,0x0E03,0x250A,0x3A27,0x147C,
+ 0x35E5,0x1274,0x3B2B,0x1A6A,0x25D7,0x0E3D,0x30D0,0x1368,
+ 0x2BE6,0x1A9B,0x0CA0,0x2E15,0x194F,0x29F5,0x12B7,0x3091,
+ 0x065D,0x1528,0x3601,0x221F,0x10FE,0x3381,0x14A0,0x1F4B,
+ 0x341F,0x0877,0x3981,0x204D,0x17D6,0x2F1C,0x0F3B,0x2658,
+ 0x18FD,0x3CDF,0x0FE0,0x2A83,0x0D30,0x2ECB,0x00C1,0x3BBF,
+ 0x0CF6,0x2A8C,0x15CA,0x38A1,0x17F4,0x3B72,0x1B45,0x1005,
+ 0x31B6,0x1746,0x2854,0x1A8D,0x2537,0x0BA4,0x2BB9,0x006B,
+ 0x2E0C,0x1AE7,0x091D,0x3F0D,0x0196,0x353C,0x1A3D,0x05CA,
+ 0x22CE,0x2F29,0x0444,0x27C8,0x0A35,0x30C9,0x18C1,0x37F5,
+ 0x0F4A,0x3D70,0x1F89,0x34AF,0x0505,0x38B1,0x1F6B,0x3635,
+ 0x116E,0x3C01,0x2484,0x01C6,0x32B6,0x1CAA,0x08CB,0x3B03,
+ 0x2061,0x1523,0x3D38,0x0362,0x3604,0x1454,0x3F65,0x18B6,
+ 0x0DA7,0x2151,0x2D08,0x00CA,0x26A2,0x07F4,0x33CA,0x21F0,
+ 0x0E2B,0x3167,0x010C,0x2D17,0x116D,0x2A79,0x1891,0x0689,
+ 0x32EB,0x0FA5,0x202C,0x3556,0x09AE,0x219E,0x3465,0x04EC,
+ 0x0F21,0x2AAC,0x17BC,0x21F5,0x2F8A,0x0598,0x1C6E,0x30A4,
+ 0x073A,0x1F3C,0x237A,0x0F8E,0x3253,0x1EF7,0x00AD,0x3F42,
+ 0x0A23,0x265C,0x37D3,0x1316,0x3C7C,0x0010,0x3898,0x0D60,
+ 0x204A,0x2BD8,0x1A1D,0x0568,0x3C7A,0x0B98,0x25E5,0x3F52,
+ 0x0D7C,0x2BF2,0x155B,0x3205,0x0D0D,0x22C7,0x3F6E,0x0049,
+ 0x2C33,0x0AAA,0x284A,0x0456,0x388E,0x2341,0x19B4,0x21ED,
+ 0x2FE1,0x03B1,0x27E2,0x0AB0,0x259F,0x0010,0x302F,0x2035,
+ 0x0556,0x3C7D,0x0DD8,0x33D0,0x120A,0x3851,0x1D06,0x3ADB,
+ 0x0E3F,0x34CB,0x23B2,0x14C4,0x2B2B,0x0AB8,0x2643,0x391E,
+ 0x13E2,0x1E8C,0x3EBB,0x122F,0x3870,0x21B0,0x0764,0x234C,
+ 0x3042,0x1AA5,0x0801,0x1789,0x2BBA,0x2344,0x150D,0x069C,
+ 0x2C41,0x0AC1,0x1E94,0x3905,0x0EB2,0x26C9,0x30B2,0x0DD9,
+ 0x2C5B,0x06FF,0x25CE,0x1FDE,0x1A3E,0x2C85,0x0C38,0x3009,
+ 0x1D2C,0x3D95,0x11B1,0x3842,0x1359,0x3B4F,0x0FA6,0x2F4B,
+ 0x1A3C,0x2066,0x25C3,0x17CF,0x3AF0,0x09D4,0x34EC,0x1DD1,
+ 0x24FE,0x1A0C,0x3CB9,0x1311,0x2FA5,0x10EE,0x1E1C,0x2D79,
+ 0x3DA3,0x02D9,0x36FD,0x0787,0x1526,0x3897,0x2696,0x114D,
+ 0x2885,0x3500,0x0360,0x3E48,0x07E4,0x378F,0x240F,0x1109,
+ 0x2E90,0x1CE4,0x02DD,0x24E9,0x0F55,0x2D65,0x1654,0x24AB,
+ 0x3E7C,0x0926,0x37FF,0x270E,0x16C0,0x2F90,0x00B1,0x18B7,
+ 0x30BF,0x1C2F,0x03DD,0x2500,0x37D2,0x058F,0x1CA7,0x33E9,
+ 0x12F4,0x35A9,0x14BA,0x30ED,0x1D70,0x083B,0x31E8,0x09A3,
+ 0x1DC7,0x3FD4,0x1276,0x365E,0x13E9,0x2B2F,0x0EB3,0x34AC,
+ 0x24D1,0x1432,0x2A4D,0x03E0,0x2D2B,0x1902,0x07B2,0x20C1,
+ 0x2880,0x0430,0x1DBC,0x366A,0x1098,0x3B74,0x2068,0x0D81,
+ 0x2C48,0x0838,0x2212,0x2DA5,0x02AA,0x1BBE,0x3673,0x1634,
+ 0x00B6,0x2CBE,0x1E6D,0x3BB7,0x12DC,0x09AA,0x3E79,0x284C,
+ 0x1669,0x33E0,0x1229,0x2229,0x2E59,0x0546,0x1B76,0x3594,
+ 0x163D,0x3896,0x0F95,0x3342,0x0664,0x2332,0x3921,0x03C8,
+ 0x2992,0x0734,0x27F7,0x0AA8,0x2DED,0x1D8A,0x2A3F,0x029D,
+ 0x3C2C,0x0A22,0x3768,0x0742,0x1CC3,0x2FC5,0x12AC,0x3EE7,
+ 0x005E,0x3109,0x081D,0x2A74,0x024D,0x3A4D,0x08F0,0x22A0,
+ 0x0C30,0x315D,0x1ADB,0x236D,0x3247,0x186B,0x0040,0x3EC4,
+ 0x0A0F,0x19BF,0x2DDC,0x1666,0x2AEC,0x13D1,0x1DF6,0x3564,
+ 0x0766,0x3AC7,0x17D9,0x3385,0x212D,0x0A63,0x365A,0x03F7,
+ 0x13FF,0x2DDA,0x1E2A,0x1054,0x2A20,0x0EC7,0x38E7,0x2453,
+ 0x06E3,0x3ABE,0x212B,0x0B3F,0x1DC1,0x3052,0x0E98,0x2777,
+ 0x1FD8,0x07BE,0x3AF1,0x2113,0x10F4,0x3DA4,0x1643,0x382A,
+ 0x0FB3,0x227C,0x2C65,0x073D,0x30FD,0x1CA5,0x3DFD,0x0A14,
+ 0x1E10,0x375D,0x0B29,0x3F8F,0x0FA0,0x267E,0x363C,0x10D1,
+ 0x3E97,0x184B,0x2FF0,0x071B,0x28FD,0x198D,0x0319,0x3783,
+ 0x11AD,0x33CF,0x1956,0x0CC0,0x34EA,0x2948,0x09B8,0x207A,
+ 0x3A69,0x0D14,0x32CC,0x0364,0x2126,0x31C1,0x1FE0,0x0DA1,
+ 0x2FE0,0x037A,0x3DBF,0x0872,0x1751,0x3C52,0x2396,0x02B1,
+ 0x28D6,0x0AD1,0x2DEF,0x1720,0x3C45,0x1032,0x1E02,0x322F,
+ 0x128C,0x2F01,0x15D0,0x3490,0x2295,0x0618,0x18F1,0x34FD,
+ 0x15AD,0x2B0F,0x1257,0x30D9,0x249F,0x0404,0x288A,0x0D29,
+ 0x2C11,0x16EF,0x378D,0x2087,0x1A7E,0x2369,0x33B5,0x176A,
+ 0x1CBA,0x2753,0x101C,0x3ADD,0x0B47,0x215E,0x2C88,0x15E2,
+ 0x2447,0x3999,0x0EA2,0x2725,0x0CD3,0x3B7D,0x043E,0x2852,
+ 0x20DB,0x0D80,0x28F6,0x063A,0x3F02,0x19EB,0x27D0,0x1C63,
+ 0x343F,0x22E8,0x0252,0x3DA8,0x0781,0x34CF,0x1EB6,0x134B,
+ 0x2B47,0x108B,0x2861,0x3DDF,0x121A,0x225D,0x3A4B,0x032A,
+ 0x2E95,0x1A42,0x2506,0x01B7,0x2BA9,0x1F24,0x04CE,0x2029,
+ 0x2DEE,0x0230,0x1AA6,0x3A74,0x16FF,0x0480,0x2326,0x2EB2,
+ 0x028C,0x28B4,0x1B70,0x2186,0x30EB,0x020B,0x1BB5,0x31FE,
+ 0x0B0B,0x25A2,0x154C,0x3CBA,0x0E8E,0x3313,0x2338,0x1C5C,
+ 0x3067,0x0023,0x3B41,0x2584,0x174A,0x0EEA,0x3D2C,0x26A6,
+ 0x1124,0x2A1A,0x13C0,0x2610,0x3833,0x1598,0x0039,0x39E4,
+ 0x2100,0x19B2,0x2771,0x1D5A,0x2F80,0x0D78,0x1916,0x3701,
+ 0x1411,0x3E0C,0x1C7B,0x005C,0x2958,0x2089,0x08E0,0x22D0,
+ 0x37D0,0x0D6F,0x3BB6,0x0316,0x170E,0x3FD4,0x2656,0x0B32,
+ 0x28A7,0x0564,0x3DAD,0x1E61,0x0ED1,0x345F,0x1409,0x3925,
+ 0x1D38,0x0BC3,0x268B,0x0DC5,0x3E55,0x0609,0x14B9,0x2C82,
+ 0x3BFA,0x084E,0x2EBB,0x03D8,0x1DB1,0x3CAE,0x106D,0x3620,
+ 0x04E5,0x1C1B,0x3204,0x01E3,0x2C6E,0x1811,0x3082,0x1265,
+ 0x3D9C,0x1653,0x2F98,0x1FB7,0x14D7,0x2ABE,0x06FC,0x3A90,
+ 0x09EC,0x1870,0x316E,0x15A3,0x2C44,0x21AA,0x0350,0x3CCA,
+ 0x0BF0,0x3714,0x198A,0x01D3,0x2D5F,0x090F,0x1895,0x34C3,
+ 0x125B,0x3E5D,0x0F8D,0x2FB7,0x0DF9,0x3330,0x19E9,0x3567,
+ 0x0E67,0x3CA8,0x26A3,0x0966,0x2908,0x37F2,0x0D52,0x188B,
+ 0x3C0C,0x1088,0x357F,0x06E7,0x1668,0x3B10,0x22E4,0x05A2,
+ 0x1FEC,0x38F9,0x012C,0x1C78,0x2BEB,0x0577,0x3FD4,0x0963,
+ 0x151A,0x282C,0x1DF9,0x0617,0x3983,0x22A9,0x03B5,0x191D,
+ 0x35C5,0x055C,0x3FBF,0x1B1C,0x08A0,0x2DB2,0x1C9F,0x257A,
+ 0x078D,0x37A0,0x0BCE,0x34F2,0x00B3,0x24D6,0x3169,0x0965,
+ 0x2A90,0x05B0,0x2459,0x3560,0x0E3B,0x3A44,0x2B2D,0x1538,
+ 0x01AC,0x261F,0x1AB9,0x2149,0x3092,0x0F3D,0x200A,0x3954,
+ 0x1137,0x3393,0x2220,0x01DE,0x39E3,0x19D3,0x2E5C,0x0657,
+ 0x2474,0x3C23,0x03A9,0x2D90,0x15C8,0x2829,0x3672,0x00A9,
+ 0x12CB,0x3288,0x1473,0x20CE,0x30E0,0x068F,0x2919,0x0C63,
+ 0x2E70,0x222D,0x0B3B,0x3D0C,0x115E,0x36D4,0x0BAE,0x2535,
+ 0x0151,0x3320,0x098E,0x394E,0x0235,0x3283,0x1F3B,0x11EE,
+ 0x2EC3,0x20A0,0x0E37,0x37BA,0x0C75,0x1B0B,0x321B,0x1710,
+ 0x2F1F,0x054E,0x2012,0x3581,0x15BB,0x3C33,0x25F6,0x0BD5,
+ 0x2AC7,0x0685,0x35FA,0x1B85,0x3A5D,0x0A2A,0x288C,0x0785,
+ 0x24E2,0x1EA3,0x10CC,0x32F5,0x1F9D,0x1184,0x2114,0x3284,
+ 0x0BED,0x271D,0x1978,0x2258,0x2B20,0x0980,0x2E2F,0x17B4,
+ 0x2A7A,0x101F,0x3104,0x26A9,0x1129,0x2F7F,0x174B,0x2A0A,
+ 0x20EB,0x3DB5,0x0BF4,0x2B8A,0x1061,0x2E2A,0x1D4C,0x3135,
+ 0x0BC1,0x2D3D,0x0FAC,0x23D7,0x3462,0x0E87,0x3DE8,0x0FFA,
+ 0x3155,0x130C,0x2AC4,0x16A5,0x3EF3,0x11CE,0x1F50,0x3B45,
+ 0x19EA,0x320C,0x10E7,0x1EC0,0x2707,0x0487,0x1BB3,0x3EAC,
+ 0x1CFC,0x3413,0x0843,0x2BB2,0x09BC,0x32FA,0x001B,0x1B3F,
+ 0x2E9F,0x0932,0x1736,0x2C07,0x205D,0x098F,0x1F22,0x36EE,
+ 0x10B1,0x1B1D,0x3328,0x1017,0x38E4,0x095C,0x1F86,0x252D,
+ 0x1E38,0x0B8D,0x3F0A,0x26EA,0x0D87,0x37EF,0x1EB1,0x3405,
+ 0x11C3,0x3ABD,0x1725,0x2052,0x27B4,0x0550,0x1F95,0x38D1,
+ 0x1B84,0x2389,0x18C9,0x2739,0x1DE1,0x0F20,0x3D51,0x261B,
+ 0x0107,0x3BE6,0x2824,0x049D,0x2599,0x3EC6,0x0F5C,0x28B0,
+ 0x145F,0x23F7,0x311B,0x0CC5,0x290F,0x0608,0x2077,0x3294,
+ 0x15D2,0x289E,0x1EE1,0x037B,0x236E,0x141D,0x3F43,0x17E8,
+ 0x38D0,0x042B,0x3687,0x192C,0x0145,0x3ED1,0x29E3,0x04EE,
+ 0x1E3E,0x3957,0x00B0,0x3E52,0x0D98,0x35C9,0x141A,0x3D9F,
+ 0x0C1C,0x36AC,0x1F85,0x09A4,0x3A5A,0x2291,0x0D27,0x395B,
+ 0x0406,0x1344,0x32FD,0x1FB5,0x3619,0x096C,0x3EC2,0x1460,
+ 0x2727,0x1B9B,0x377F,0x020D,0x184C,0x2924,0x04D3,0x2C16,
+ 0x1A84,0x3B8E,0x0575,0x286E,0x0A40,0x2D3A,0x041B,0x2636,
+ 0x0CA6,0x20E4,0x3FAD,0x0818,0x372E,0x17B9,0x3281,0x0B18,
+ 0x2FA6,0x100B,0x3D5A,0x1987,0x387E,0x1687,0x22D8,0x3E17,
+ 0x13C4,0x254F,0x37C0,0x0E30,0x3F77,0x151D,0x2AB2,0x0139,
+ 0x2CF2,0x21DE,0x087E,0x2712,0x1D08,0x3207,0x0E3E,0x3963,
+ 0x2CD4,0x227B,0x0267,0x1930,0x2C15,0x16CA,0x0177,0x1A14,
+ 0x2865,0x0339,0x2D07,0x0835,0x33A1,0x197C,0x2FE4,0x0FEF,
+ 0x2AD6,0x0C8B,0x3C36,0x0531,0x3723,0x2237,0x07DC,0x17F9,
+ 0x351F,0x0B81,0x1980,0x33BA,0x1D6A,0x086E,0x2E07,0x0064,
+ 0x331D,0x0A10,0x1AC8,0x3FD4,0x137F,0x3848,0x1A98,0x00F0,
+ 0x3A02,0x0A8B,0x3380,0x169E,0x2EBC,0x20E6,0x0092,0x307A,
+ 0x1545,0x2D48,0x0C2B,0x278A,0x31D0,0x0AF5,0x15AB,0x3474,
+ 0x2469,0x130E,0x316C,0x154B,0x2F7C,0x20B9,0x02B8,0x23F4,
+ 0x2C94,0x0477,0x18CC,0x344E,0x1606,0x01F6,0x3199,0x1A17,
+ 0x2375,0x2E61,0x187C,0x0233,0x1682,0x29DF,0x1C55,0x0138,
+ 0x393D,0x08FE,0x24F3,0x1DF8,0x3B14,0x1250,0x36AA,0x1E39,
+ 0x029C,0x2202,0x3030,0x10C1,0x332B,0x1461,0x3968,0x15FF,
+ 0x35FD,0x0200,0x281A,0x1D96,0x0EEC,0x2D86,0x1397,0x293C,
+ 0x05D1,0x1F73,0x2438,0x042E,0x272A,0x0B69,0x2D51,0x0795,
+ 0x2A73,0x036F,0x1BC0,0x302E,0x0498,0x32BF,0x177E,0x3D09,
+ 0x0E5A,0x35E9,0x1823,0x3FB5,0x01EB,0x19A2,0x2977,0x04C8,
+ 0x0F5A,0x37A3,0x1C79,0x3550,0x0747,0x3A2C,0x1F98,0x3F80,
+ 0x0A80,0x3675,0x1BD6,0x3DE4,0x1548,0x25E4,0x08ED,0x3FD4,
+ 0x03B8,0x33CB,0x1482,0x2EF5,0x0BD8,0x31A9,0x1C98,0x2A50,
+ 0x1132,0x3083,0x242B,0x1027,0x398E,0x168B,0x21F2,0x37F6,
+ 0x1164,0x3B19,0x252A,0x0294,0x2CF6,0x0AB3,0x300F,0x24B8,
+ 0x1489,0x2C84,0x1029,0x3C68,0x081A,0x3700,0x1B0F,0x2557,
+ 0x0896,0x1C3A,0x3D82,0x2141,0x0FEB,0x201B,0x3B46,0x1A5F,
+ 0x07CD,0x2C37,0x0A83,0x29A5,0x061E,0x1BD4,0x396E,0x19C5,
+ 0x0DF6,0x3B6F,0x2363,0x075C,0x214D,0x3E3F,0x1E40,0x07C9,
+ 0x3737,0x09ED,0x38AC,0x1EF5,0x3BC7,0x073F,0x3273,0x21E1,
+ 0x17BF,0x2F48,0x0DFD,0x321A,0x06BC,0x2CB8,0x0A69,0x2655,
+ 0x34B7,0x17ED,0x0928,0x3858,0x1BF6,0x23F1,0x07D7,0x2C38,
+ 0x0FF6,0x30AC,0x1336,0x38CE,0x24AA,0x0270,0x3CAA,0x0E1A,
+ 0x39B3,0x2A18,0x1412,0x35A2,0x121E,0x3B81,0x1D0A,0x361E,
+ 0x1081,0x3C02,0x23F6,0x0CE6,0x2950,0x1FE8,0x07D4,0x1E9E,
+ 0x28E0,0x04FF,0x2F41,0x142C,0x22C4,0x3591,0x10DE,0x3D72,
+ 0x25DF,0x0810,0x2DE0,0x148D,0x29F4,0x123F,0x2E34,0x0F12,
+ 0x2B7E,0x21AC,0x0DA3,0x2421,0x00A0,0x3A20,0x209A,0x1A55,
+ 0x2CEA,0x10D4,0x2888,0x1739,0x2B73,0x132F,0x39ED,0x039C,
+ 0x3F93,0x1FF6,0x0611,0x2BAD,0x028A,0x303A,0x0955,0x1CC0,
+ 0x2952,0x0643,0x1F6A,0x29B3,0x17C3,0x3680,0x1E1A,0x0E23,
+ 0x3EED,0x0591,0x25AD,0x1D10,0x2AEA,0x0DB6,0x320E,0x10BB,
+ 0x3B32,0x2A76,0x147A,0x05DE,0x3996,0x296D,0x0331,0x25A3,
+ 0x378B,0x1163,0x3D12,0x16B1,0x33A5,0x2386,0x0949,0x21B6,
+ 0x2FD8,0x1305,0x325E,0x1B04,0x2A34,0x0FB0,0x2DB9,0x1594,
+ 0x2797,0x1D7B,0x0E97,0x2D27,0x136F,0x27E7,0x1014,0x3CA5,
+ 0x0630,0x22DE,0x3E24,0x1484,0x277E,0x1997,0x3CF7,0x1602,
+ 0x0D28,0x3F8C,0x1DB6,0x2542,0x015B,0x3D3F,0x1AF2,0x216C,
+ 0x3BC9,0x0A55,0x2A70,0x06CC,0x1F13,0x3396,0x18C3,0x23CD,
+ 0x1E5D,0x0102,0x2EB1,0x0CF3,0x2C74,0x188E,0x0248,0x208B,
+ 0x2FD5,0x08D5,0x1849,0x3841,0x1210,0x3B59,0x1B3A,0x347F,
+ 0x1299,0x3ACC,0x2122,0x0A1E,0x2BCC,0x06D1,0x2E7E,0x17EE,
+ 0x3121,0x1F41,0x0ECB,0x3E66,0x0BDB,0x261D,0x0474,0x348A,
+ 0x1B1F,0x067C,0x316B,0x176B,0x2FC3,0x13B2,0x3498,0x0E62,
+ 0x22B4,0x3878,0x0791,0x3E20,0x0054,0x2571,0x0D7E,0x2CC8,
+ 0x0A99,0x1B34,0x36D5,0x13A3,0x3DB1,0x231D,0x1A35,0x3C3F,
+ 0x14CC,0x3507,0x0FDD,0x39E1,0x07EC,0x2352,0x03B6,0x3445,
+ 0x2106,0x19C3,0x38AA,0x023A,0x1801,0x3DF0,0x0536,0x28DC,
+ 0x1DA8,0x0280,0x22C2,0x339B,0x1835,0x0CA8,0x3013,0x0EA9,
+ 0x1EE3,0x2F3C,0x01B8,0x276E,0x0E33,0x374A,0x149B,0x3F20,
+ 0x0058,0x2AB4,0x0A86,0x3CF0,0x0342,0x3823,0x0B4B,0x352F,
+ 0x00AC,0x3F44,0x2349,0x0484,0x3438,0x0D2A,0x2B5D,0x15A9,
+ 0x306D,0x1AC9,0x0375,0x2B85,0x0B96,0x2F04,0x0106,0x23C2,
+ 0x2E7B,0x061C,0x2B52,0x1174,0x2F2A,0x0F3F,0x33E6,0x03D9,
+ 0x190C,0x2F06,0x1C41,0x3D7C,0x0D47,0x2795,0x076D,0x3222,
+ 0x0C10,0x378C,0x1A25,0x3F56,0x06A8,0x2248,0x31BD,0x115D,
+ 0x268F,0x1C62,0x323F,0x00BA,0x2D4D,0x0A9F,0x27C5,0x030C,
+ 0x2E00,0x0B64,0x1AAA,0x374D,0x15A4,0x3B3D,0x1D5B,0x0313,
+ 0x1269,0x3B9E,0x23C7,0x00CB,0x31A6,0x18D4,0x3995,0x1318,
+ 0x2517,0x3C42,0x1145,0x37D7,0x0B74,0x29F0,0x06C0,0x2EAD,
+ 0x0261,0x1D88,0x2683,0x1272,0x32C4,0x1953,0x35CC,0x1535,
+ 0x2699,0x2FD3,0x0EA1,0x2A4B,0x1830,0x0AD6,0x31C0,0x0415,
+ 0x2BFB,0x0C36,0x2EAC,0x12F1,0x1EF4,0x3D8A,0x1509,0x2815,
+ 0x0874,0x2F4C,0x0CCA,0x33D6,0x2402,0x11BB,0x2D0C,0x0E96,
+ 0x3145,0x18CB,0x2DF0,0x0975,0x280D,0x37F7,0x129E,0x3FBC,
+ 0x06BB,0x2365,0x14E7,0x3A12,0x1FD6,0x03DE,0x285B,0x1834,
+ 0x31DD,0x11B9,0x2732,0x146B,0x2CB9,0x2308,0x169D,0x21AD,
+ 0x2C28,0x0F52,0x2F15,0x18F7,0x2164,0x39F2,0x02AC,0x35F7,
+ 0x0A17,0x2015,0x33F7,0x16C5,0x390D,0x13E5,0x3703,0x1C15,
+ 0x0E76,0x33C0,0x1791,0x3A63,0x0C57,0x29BD,0x13B8,0x27A0,
+ 0x3806,0x148B,0x0096,0x222E,0x350D,0x1290,0x3AF4,0x1670,
+ 0x28C0,0x20FA,0x104E,0x2551,0x1BE1,0x39CA,0x0A3C,0x36E2,
+ 0x04F3,0x3EC0,0x147F,0x2575,0x1DAC,0x3648,0x1169,0x3E8A,
+ 0x16B5,0x2534,0x31E1,0x002D,0x28A1,0x0C16,0x24B6,0x381A,
+ 0x2B78,0x05DA,0x1B49,0x36A0,0x1537,0x28A3,0x0D6D,0x2F18,
+ 0x0214,0x1D9D,0x2A1C,0x042F,0x26ED,0x108A,0x3BCB,0x1FED,
+ 0x35A8,0x0EEB,0x3B01,0x1F5E,0x09B5,0x2960,0x04D1,0x3C87,
+ 0x2091,0x01CB,0x3B6B,0x0783,0x2163,0x361A,0x11B4,0x23D8,
+ 0x1DA0,0x3E70,0x0173,0x24DB,0x317C,0x0CA1,0x2E26,0x173B,
+ 0x3B37,0x12D3,0x291A,0x1E2F,0x08E9,0x3630,0x1CCF,0x3A16,
+ 0x0A53,0x35FC,0x134E,0x3E95,0x1F80,0x0052,0x1D58,0x26C1,
+ 0x1897,0x3183,0x1D8B,0x0BDC,0x30E7,0x1A8A,0x2EE8,0x0890,
+ 0x2116,0x3A8A,0x04F6,0x35A0,0x1CFD,0x087D,0x3B8F,0x0538,
+ 0x1C8D,0x36D3,0x06CD,0x3C64,0x0ACC,0x1B87,0x28F7,0x125A,
+ 0x24C3,0x3AFB,0x0D95,0x292C,0x051E,0x257C,0x09CF,0x288D,
+ 0x3C1B,0x21A0,0x033F,0x22C5,0x32C3,0x0500,0x3E6F,0x1D44,
+ 0x0852,0x232A,0x311D,0x1814,0x0510,0x2CB3,0x1CA0,0x02ED,
+ 0x3E2A,0x0885,0x3366,0x03B7,0x2B31,0x12E2,0x28BD,0x16CB,
+ 0x2C46,0x1E2D,0x09B2,0x3A8E,0x06B5,0x195F,0x2EF1,0x0D75,
+ 0x2A0C,0x075A,0x1EC1,0x3D64,0x11BF,0x333B,0x196F,0x0A94,
+ 0x1600,0x3517,0x273E,0x09F5,0x2AF6,0x0519,0x3DD0,0x2152,
+ 0x17E6,0x329E,0x0C8D,0x3E8C,0x14BC,0x2DB1,0x1AE6,0x093C,
+ 0x179C,0x2A29,0x0586,0x2455,0x34EB,0x136D,0x2E65,0x0FD2,
+ 0x18E1,0x3211,0x140A,0x1E68,0x2E17,0x00C3,0x277B,0x3944,
+ 0x0DAC,0x176E,0x2AED,0x1C4F,0x05E9,0x37A1,0x20B2,0x001C,
+ 0x1BD0,0x327E,0x044D,0x3BFE,0x18E6,0x26E3,0x0136,0x1704,
+ 0x2B4B,0x1F01,0x045F,0x2456,0x156C,0x2345,0x352A,0x09F8,
+ 0x36CC,0x04C9,0x3C69,0x2242,0x0730,0x3DFF,0x102B,0x37B9,
+ 0x1BA4,0x0C6F,0x29B4,0x0F11,0x2EA6,0x1853,0x2419,0x3176,
+ 0x10B9,0x2670,0x2056,0x1714,0x2323,0x31E0,0x0814,0x3F7C,
+ 0x1D3F,0x005F,0x2FAF,0x1180,0x3E96,0x18AB,0x3274,0x1661,
+ 0x074B,0x1B2C,0x2FD0,0x0B3C,0x1E62,0x25F3,0x0E9F,0x2EA2,
+ 0x1728,0x345A,0x09E2,0x3F6C,0x264A,0x0FE3,0x30F7,0x21F4,
+ 0x1150,0x2FFE,0x17FA,0x3C48,0x0DD3,0x3527,0x015C,0x3D3C,
+ 0x0C61,0x23A3,0x318F,0x15D8,0x2B79,0x2266,0x0203,0x38C9,
+ 0x14C5,0x34C1,0x1099,0x22E2,0x2B26,0x0560,0x3EF9,0x2377,
+ 0x2ECD,0x0C42,0x2049,0x3B00,0x118D,0x33BF,0x1E41,0x0977,
+ 0x3895,0x1431,0x25AA,0x1C17,0x343A,0x0189,0x3677,0x1E90,
+ 0x3F53,0x1156,0x320B,0x0DFA,0x1DE5,0x3EEE,0x0894,0x232D,
+ 0x397B,0x0BC9,0x22DA,0x380E,0x1248,0x3F30,0x199C,0x06E4,
+ 0x21CF,0x36B4,0x0B14,0x3BAD,0x1937,0x271C,0x108F,0x34C2,
+ 0x265F,0x0EEF,0x2A19,0x1125,0x2C47,0x0E09,0x3F7D,0x24CC,
+ 0x074A,0x3C6E,0x1B4D,0x389E,0x0827,0x2E3E,0x0F30,0x2A14,
+ 0x137A,0x2882,0x0F77,0x2D35,0x1773,0x263D,0x2046,0x0257,
+ 0x236B,0x3305,0x13EA,0x3FA9,0x0167,0x3776,0x0D99,0x1F9A,
+ 0x3DE1,0x09D0,0x33D4,0x0178,0x38CB,0x1541,0x2C2E,0x10B7,
+ 0x2DA7,0x1943,0x2228,0x34DC,0x0B0E,0x27EE,0x01E9,0x39B4,
+ 0x1EF8,0x359D,0x14CD,0x3CA4,0x1313,0x388C,0x20A4,0x022B,
+ 0x3A94,0x1567,0x2B93,0x0E58,0x200C,0x3A17,0x0AD9,0x36E7,
+ 0x1AD8,0x26AA,0x0BC6,0x1CEF,0x2D50,0x15B1,0x2746,0x13C7,
+ 0x2E68,0x1A81,0x0346,0x3576,0x0FBD,0x3CA6,0x1BA6,0x214A,
+ 0x2C02,0x0420,0x39B8,0x08FF,0x1770,0x30AD,0x1C4D,0x0197,
+ 0x11DC,0x3D2E,0x180F,0x02DC,0x2D52,0x21FB,0x10C0,0x3026,
+ 0x2312,0x05CC,0x3AD7,0x08A7,0x2182,0x2BD1,0x0D1A,0x2799,
+ 0x0317,0x2C77,0x185F,0x38FB,0x012A,0x25FB,0x1A4A,0x30B6,
+ 0x02D3,0x1D49,0x2D10,0x05B6,0x2ADC,0x09A1,0x3012,0x1C8E,
+ 0x3236,0x0469,0x2F1D,0x13F9,0x3322,0x09FD,0x3F67,0x1DAA,
+ 0x0B02,0x3D2B,0x1C84,0x3803,0x06D8,0x32F6,0x207F,0x11A4,
+ 0x3191,0x1522,0x2F77,0x0FBB,0x32AD,0x17A3,0x3DC1,0x031A,
+ 0x3911,0x1F18,0x3427,0x0124,0x39C7,0x0CC2,0x3480,0x1657,
+ 0x3BD5,0x05CF,0x25DC,0x1AC5,0x2AC9,0x134C,0x2FDD,0x02EA,
+ 0x19FD,0x2980,0x1212,0x2B0C,0x0CB2,0x2775,0x03CE,0x3352,
+ 0x0A78,0x3A42,0x0733,0x1CE3,0x2AE9,0x127A,0x30B0,0x0F9C,
+ 0x2C54,0x0BFB,0x2883,0x0014,0x2A57,0x0919,0x34B0,0x1AC7,
+ 0x2536,0x05BB,0x1C6A,0x3644,0x01C5,0x1957,0x2AB5,0x0661,
+ 0x2CDB,0x0032,0x38E8,0x247D,0x052E,0x3ACE,0x0B4C,0x349A,
+ 0x06D7,0x391D,0x2615,0x0CD1,0x296E,0x05C3,0x3077,0x0A51,
+ 0x132B,0x3151,0x1CD0,0x2181,0x3C4D,0x0F1F,0x2662,0x3704,
+ 0x2C26,0x067F,0x256C,0x377A,0x1A29,0x088F,0x3B6E,0x0013,
+ 0x1BBF,0x2B2E,0x1632,0x31D6,0x1008,0x19BA,0x3CEC,0x15CF,
+ 0x37AF,0x1F07,0x07D9,0x2075,0x2F26,0x1494,0x3773,0x0E86,
+ 0x21A4,0x3E00,0x0F71,0x357B,0x17E0,0x263E,0x0EFA,0x3AD8,
+ 0x11EB,0x28E6,0x0E5C,0x2572,0x0272,0x2C80,0x221D,0x04D7,
+ 0x3099,0x2329,0x0204,0x16EC,0x2DBD,0x1A51,0x0395,0x3750,
+ 0x0B7B,0x2674,0x01DF,0x2965,0x1FE6,0x0585,0x1E7A,0x2BB7,
+ 0x162E,0x08D3,0x1BAC,0x28FB,0x1223,0x2A41,0x065C,0x2E66,
+ 0x0DE3,0x1E71,0x3102,0x0A77,0x21C3,0x3C40,0x0C20,0x20F9,
+ 0x39A4,0x0642,0x3618,0x1B2D,0x3E59,0x12EC,0x3804,0x14A2,
+ 0x1F72,0x269B,0x1769,0x37BF,0x0432,0x3D7B,0x1A62,0x246E,
+ 0x055B,0x3F5D,0x108D,0x36DA,0x19E7,0x2F51,0x113F,0x2C19,
+ 0x0DDD,0x3D03,0x27F9,0x1119,0x3048,0x2509,0x0F76,0x3CD0,
+ 0x131B,0x3404,0x2038,0x0E34,0x31E2,0x1D9E,0x2905,0x186C,
+ 0x23FF,0x1F8F,0x1270,0x3FD4,0x146C,0x36B1,0x17F2,0x2426,
+ 0x3F2D,0x18D2,0x0B90,0x2D4E,0x02A3,0x2A1D,0x084F,0x1ACE,
+ 0x0F6A,0x3060,0x1D93,0x0ADE,0x325F,0x293E,0x1519,0x2703,
+ 0x3F31,0x0BE1,0x3708,0x0343,0x22CD,0x30C8,0x04F5,0x28EB,
+ 0x0A28,0x32CF,0x1B7F,0x3C0B,0x10A1,0x2963,0x048A,0x1EB9,
+ 0x335A,0x0820,0x2902,0x1C1A,0x0370,0x3CF4,0x2359,0x01E6,
+ 0x2C60,0x189D,0x3E1B,0x15BA,0x38E0,0x1D0E,0x0D9A,0x39F4,
+ 0x1F2F,0x134F,0x3525,0x2288,0x09A7,0x397D,0x286A,0x143E,
+ 0x2AF0,0x12DD,0x3BA5,0x0B09,0x3668,0x1A34,0x3A28,0x0B48,
+ 0x3335,0x23FB,0x3F55,0x0A39,0x353E,0x1D4A,0x3D45,0x1931,
+ 0x223C,0x38E6,0x1015,0x36CB,0x046D,0x171A,0x32C6,0x26E0,
+ 0x0E3A,0x2B8C,0x1E96,0x0431,0x1FD0,0x2A10,0x07CB,0x2499,
+ 0x3CFF,0x0249,0x32C2,0x0DFC,0x2EA7,0x1DC8,0x08B4,0x31BB,
+ 0x20E8,0x17D4,0x3007,0x230A,0x05EC,0x1F81,0x3ED0,0x03A6,
+ 0x32F7,0x1EC5,0x08CC,0x390C,0x20DE,0x0BFA,0x3256,0x1D0D,
+ 0x27BA,0x0927,0x1743,0x3FAA,0x1635,0x0848,0x3744,0x0295,
+ 0x3DDD,0x0A9E,0x2FAC,0x0065,0x2879,0x1D1F,0x08AA,0x344D,
+ 0x0146,0x22B6,0x3872,0x1562,0x35C7,0x1374,0x3A87,0x23BC,
+ 0x3FD4,0x14FA,0x38FC,0x133B,0x209F,0x056D,0x3623,0x0A3E,
+ 0x18EC,0x2D6F,0x125C,0x1F0E,0x2A89,0x0B41,0x3A06,0x13BA,
+ 0x2EAE,0x1288,0x2AA6,0x0563,0x33C4,0x0CB8,0x3A5F,0x24EA,
+ 0x12A0,0x2BDD,0x1434,0x38AF,0x20EF,0x1093,0x1DC6,0x379A,
+ 0x0C5F,0x30DF,0x0737,0x2850,0x0B8F,0x2E3F,0x1AC6,0x25DB,
+ 0x07CF,0x2EE2,0x0E4B,0x3EA1,0x1DCA,0x0F42,0x210E,0x3D14,
+ 0x06AD,0x3436,0x1CA9,0x2D00,0x0ED4,0x27C7,0x126B,0x2989,
+ 0x1AFB,0x0232,0x1588,0x2DFA,0x183C,0x03A1,0x2576,0x09B1,
+ 0x2CE1,0x00B4,0x2B35,0x1CBB,0x233A,0x2D73,0x0713,0x1969,
+ 0x34D4,0x1435,0x3CBB,0x16CE,0x3266,0x1025,0x2F6B,0x1CAB,
+ 0x0C85,0x2CF5,0x115C,0x28EA,0x13B5,0x2521,0x3B16,0x0D62,
+ 0x3641,0x02D1,0x1F9E,0x0C90,0x3B68,0x0F51,0x26D6,0x18F0,
+ 0x240D,0x1254,0x2D43,0x19D0,0x04DB,0x3E56,0x17D2,0x0345,
+ 0x3A55,0x211B,0x2A4A,0x03DA,0x2ED9,0x221A,0x19ED,0x30C2,
+ 0x11AC,0x2C1B,0x1534,0x3348,0x0EC2,0x3B96,0x2303,0x1688,
+ 0x202F,0x2F17,0x05D5,0x25F8,0x0992,0x31A5,0x1F36,0x0408,
+ 0x0CA7,0x2AE3,0x012E,0x2796,0x3E05,0x1796,0x2445,0x1DE3,
+ 0x3095,0x06B4,0x24F5,0x3C88,0x0F66,0x3354,0x1C5F,0x2588,
+ 0x00A1,0x3E27,0x0C1E,0x2779,0x165E,0x2D85,0x1B48,0x09EA,
+ 0x3BCA,0x002B,0x318D,0x0B83,0x281D,0x34E4,0x0A71,0x271A,
+ 0x1F55,0x134A,0x365B,0x16DA,0x3437,0x03F1,0x3CB3,0x10DD,
+ 0x3751,0x1603,0x2AAB,0x051F,0x31F2,0x2403,0x009E,0x1C67,
+ 0x30CF,0x17F3,0x0437,0x22A8,0x3EC1,0x00EF,0x3555,0x0736,
+ 0x3C3C,0x1F6C,0x36DD,0x0D7A,0x22D2,0x3A84,0x110D,0x35E4,
+ 0x12CD,0x3E7A,0x17F6,0x0CF4,0x382B,0x1287,0x3EF2,0x1FF8,
+ 0x0025,0x28BE,0x088B,0x2DE7,0x0A4C,0x3ADC,0x010A,0x340C,
+ 0x1848,0x228C,0x3F14,0x0859,0x3887,0x00C7,0x1985,0x2AB1,
+ 0x12E5,0x283F,0x396B,0x1693,0x2355,0x3202,0x0761,0x381B,
+ 0x0AF6,0x3AFC,0x00D2,0x3505,0x28E8,0x1218,0x2427,0x2FBE,
+ 0x14D4,0x0D03,0x3793,0x1E78,0x1110,0x3B55,0x0EA8,0x24EB,
+ 0x1F27,0x050B,0x39DC,0x1A60,0x2AF7,0x03C9,0x3111,0x0CFE,
+ 0x3DAA,0x1030,0x1E30,0x3BF2,0x19C6,0x2463,0x0E8B,0x33E3,
+ 0x2857,0x1624,0x3310,0x1B8C,0x095F,0x3460,0x025B,0x3810,
+ 0x144A,0x3A41,0x1A8C,0x0129,0x2CF7,0x17FB,0x0623,0x3866,
+ 0x1F45,0x14DF,0x34CC,0x0FF3,0x3D6D,0x0215,0x2221,0x3523,
+ 0x159F,0x26AF,0x177A,0x3FCE,0x064D,0x1A15,0x2D8D,0x04F4,
+ 0x3CA2,0x239A,0x007A,0x2986,0x1185,0x246C,0x17F5,0x29EA,
+ 0x0114,0x324C,0x0C3C,0x2692,0x1139,0x3B66,0x167C,0x2BA8,
+ 0x097E,0x273A,0x39E5,0x11BA,0x1E51,0x315B,0x1947,0x2DA1,
+ 0x0E94,0x2BD9,0x05F0,0x1DEC,0x3239,0x07EB,0x3020,0x19D1,
+ 0x278C,0x08B5,0x2162,0x2F34,0x030B,0x29C7,0x0B27,0x251E,
+ 0x3A48,0x10AD,0x3764,0x190F,0x26B5,0x1BCF,0x240E,0x1574,
+ 0x39D3,0x055F,0x1E1F,0x31DF,0x1C0F,0x218B,0x357E,0x0670,
+ 0x3D44,0x1BE7,0x08F2,0x3375,0x0149,0x1B30,0x29CD,0x1392,
+ 0x2ECA,0x1745,0x25BD,0x1E9D,0x0AA5,0x31B2,0x07B9,0x1B4C,
+ 0x3611,0x26BA,0x06AB,0x3158,0x259B,0x00ED,0x3399,0x093D,
+ 0x3C1A,0x284E,0x1E17,0x080F,0x1F83,0x37C8,0x1221,0x2CAA,
+ 0x071C,0x26F3,0x322D,0x0C62,0x2B97,0x0074,0x2E93,0x1281,
+ 0x0610,0x3AA9,0x0AC8,0x22AB,0x2F87,0x121D,0x2C56,0x0EFB,
+ 0x283E,0x0C78,0x346A,0x218C,0x0A5C,0x3FBB,0x2337,0x0E73,
+ 0x3036,0x22DB,0x03F0,0x2F5D,0x2011,0x1874,0x2B71,0x0739,
+ 0x3058,0x0D8A,0x2EED,0x1133,0x1FD9,0x3A24,0x147D,0x32A9,
+ 0x1959,0x0F86,0x3967,0x1A59,0x3FAE,0x0690,0x35D0,0x0D2C,
+ 0x3A8F,0x2140,0x1919,0x3043,0x1F82,0x07B0,0x3451,0x0CDC,
+ 0x3FD4,0x2039,0x0E63,0x2E81,0x086C,0x2532,0x0C67,0x20C3,
+ 0x3849,0x166C,0x2215,0x3E2F,0x1261,0x2A78,0x1CB6,0x02A9,
+ 0x3961,0x1B58,0x350E,0x11B7,0x3B35,0x161A,0x358B,0x1A79,
+ 0x09F2,0x2CF3,0x1CFB,0x035D,0x3FD4,0x0BAA,0x35DC,0x06F8,
+ 0x2801,0x12B6,0x2BC0,0x15FE,0x0C27,0x303B,0x1559,0x2999,
+ 0x1104,0x23D4,0x2EF9,0x0FD1,0x204C,0x3DFC,0x0EB0,0x35F8,
+ 0x2138,0x063E,0x3FD4,0x0EE7,0x3748,0x1487,0x3C05,0x2AD9,
+ 0x0161,0x18A6,0x3D13,0x0FF2,0x1A2D,0x2D18,0x14F5,0x29C4,
+ 0x179B,0x0D19,0x33C8,0x1423,0x2F59,0x09DF,0x2590,0x1C7D,
+ 0x399C,0x1944,0x0383,0x37E9,0x13EE,0x3E44,0x1B3D,0x36B6,
+ 0x2D69,0x216E,0x1744,0x3C37,0x047D,0x2648,0x1A07,0x3EB1,
+ 0x03E8,0x29FB,0x1033,0x2EB7,0x1E5C,0x1111,0x3547,0x1D33,
+ 0x077F,0x3B0E,0x1951,0x2602,0x08C6,0x376C,0x0E12,0x3E82,
+ 0x1D07,0x2899,0x0529,0x367F,0x2520,0x019C,0x29D8,0x0CCB,
+ 0x2502,0x2FC6,0x0887,0x2B1E,0x0BF8,0x3163,0x156F,0x27CA,
+ 0x1BBB,0x08DA,0x3E01,0x02F5,0x390B,0x1AD6,0x224B,0x2F0C,
+ 0x1A12,0x0255,0x35B3,0x1702,0x37CC,0x159A,0x3D96,0x0348,
+ 0x2654,0x09D3,0x2ED2,0x0010,0x26F7,0x0AD0,0x3CDC,0x2318,
+ 0x1491,0x2E32,0x04E4,0x2626,0x0BF3,0x2821,0x05C2,0x3182,
+ 0x241D,0x11F0,0x30E3,0x225A,0x1363,0x2BE8,0x1116,0x2FFB,
+ 0x1D71,0x3788,0x02B5,0x3AB1,0x25D1,0x04AF,0x3BE0,0x0B1B,
+ 0x3456,0x03AC,0x1922,0x37CE,0x275B,0x09E9,0x2DCE,0x0312,
+ 0x1A4B,0x2B25,0x12C8,0x2E2B,0x02A8,0x284B,0x2010,0x0E71,
+ 0x227F,0x2D7D,0x0A21,0x23D2,0x3817,0x0C22,0x3EE0,0x0453,
+ 0x35E0,0x2250,0x01B6,0x3E8F,0x1817,0x20FD,0x3C66,0x0219,
+ 0x153A,0x2FFD,0x23AB,0x0F9B,0x2920,0x1FDD,0x07D5,0x1E77,
+ 0x139D,0x01F4,0x318C,0x0DB2,0x2003,0x3951,0x07F5,0x1D74,
+ 0x339C,0x13AC,0x3D69,0x05A9,0x36E9,0x2740,0x0296,0x2C7B,
+ 0x213C,0x0BDA,0x35F1,0x15B2,0x30EC,0x1234,0x2929,0x19E1,
+ 0x02C2,0x3880,0x2324,0x0C71,0x1B80,0x347B,0x120E,0x3EDD,
+ 0x0344,0x1E44,0x3389,0x1407,0x26A7,0x1037,0x2C7D,0x039E,
+ 0x30CB,0x231A,0x16A3,0x2BED,0x0DF2,0x2A4C,0x04B4,0x13E7,
+ 0x3867,0x2356,0x0C23,0x2C29,0x04D6,0x28EF,0x0DAE,0x32D0,
+ 0x1A89,0x3B09,0x0FD0,0x35FE,0x1866,0x2C3E,0x0F9E,0x31D1,
+ 0x0780,0x1D52,0x3F62,0x16EB,0x338D,0x1070,0x3DCA,0x1ECE,
+ 0x0220,0x3C75,0x07F1,0x366E,0x1EEA,0x04E9,0x3B5C,0x21CA,
+ 0x0CE7,0x18DD,0x30FA,0x2095,0x0F16,0x2CE8,0x11F1,0x27DE,
+ 0x1477,0x3FB9,0x2570,0x06F3,0x14E1,0x3A04,0x1CDB,0x22E0,
+ 0x3C72,0x0A41,0x368E,0x21A1,0x1B08,0x39DB,0x0557,0x1DBF,
+ 0x3F3C,0x1398,0x32D5,0x1D5D,0x05AB,0x27F2,0x1B73,0x2BDB,
+ 0x114E,0x2DFE,0x1B24,0x274F,0x059C,0x31C5,0x0D79,0x29FE,
+ 0x35E1,0x08A4,0x1BED,0x330B,0x0525,0x35B4,0x17EC,0x3CE9,
+ 0x27CF,0x388A,0x2325,0x1991,0x2BDC,0x1188,0x30FC,0x2416,
+ 0x0AD7,0x2CBA,0x1C89,0x254A,0x0D26,0x1775,0x3276,0x12F0,
+ 0x3EB5,0x1AF6,0x279D,0x0148,0x21D6,0x3C34,0x05B1,0x334D,
+ 0x2093,0x0EE4,0x16E1,0x3CDA,0x27DC,0x0989,0x2CDD,0x202B,
+ 0x359E,0x0E9B,0x21B7,0x3BF7,0x0228,0x36A2,0x1ECA,0x3B7E,
+ 0x0F90,0x37F1,0x0BDD,0x21E4,0x3695,0x1586,0x3DAB,0x25BF,
+ 0x07EE,0x2DE3,0x14CE,0x216A,0x3C04,0x123B,0x2B49,0x1EA5,
+ 0x0821,0x1FBB,0x289A,0x14BB,0x310A,0x054B,0x37DD,0x1731,
+ 0x21D2,0x2B5F,0x0AA6,0x297C,0x0140,0x2DAE,0x2204,0x13C9,
+ 0x2C5C,0x18B3,0x2925,0x0D8E,0x2640,0x32EC,0x177F,0x01BC,
+ 0x3D92,0x2970,0x140F,0x0978,0x3EAA,0x1CD7,0x3337,0x019D,
+ 0x2F84,0x1F08,0x0E4F,0x32BB,0x2AD1,0x1708,0x05A0,0x33D5,
+ 0x11B8,0x3014,0x188C,0x0723,0x2C9C,0x1091,0x2647,0x30F5,
+ 0x0903,0x2907,0x02E9,0x3A9F,0x16A6,0x3657,0x0EFD,0x214F,
+ 0x38F2,0x0769,0x3B1D,0x1051,0x36FC,0x1649,0x2431,0x1EE2,
+ 0x10C7,0x278B,0x3F79,0x0E0E,0x2DC6,0x1073,0x2A5C,0x0BF9,
+ 0x1F57,0x1532,0x0652,0x3F71,0x09C8,0x3669,0x00BC,0x16BD,
+ 0x3B60,0x1886,0x01E0,0x38A7,0x2287,0x3C11,0x09D7,0x2871,
+ 0x04B3,0x331C,0x11E5,0x39BF,0x1D57,0x0D09,0x2C0A,0x0B46,
+ 0x3B38,0x2441,0x3241,0x069F,0x15D4,0x3A85,0x1AC2,0x07F9,
+ 0x17AC,0x2B81,0x05F4,0x1C26,0x2EE3,0x171B,0x07B6,0x1B6E,
+ 0x2943,0x0554,0x2E3B,0x1C09,0x015D,0x2D7C,0x0A73,0x1E6E,
+ 0x3504,0x188F,0x3A68,0x0669,0x1D24,0x2FE6,0x0195,0x3503,
+ 0x17B5,0x36FF,0x03D1,0x3FD4,0x0C03,0x1F28,0x2515,0x01D5,
+ 0x3BA3,0x0EF4,0x3656,0x139A,0x39F0,0x1DD8,0x0962,0x3401,
+ 0x0677,0x3705,0x12FE,0x3A09,0x1A8E,0x0995,0x2F12,0x24DC,
+ 0x1C0E,0x0740,0x36E5,0x233C,0x2A2A,0x06AA,0x1793,0x394C,
+ 0x22FA,0x082D,0x3AAD,0x1D9C,0x007C,0x2254,0x2CDA,0x0E31,
+ 0x2956,0x01E8,0x249D,0x3DAC,0x1544,0x3363,0x0C97,0x191A,
+ 0x389B,0x1238,0x2F4D,0x0D61,0x2601,0x0888,0x309A,0x0231,
+ 0x1D6C,0x2690,0x0B61,0x209E,0x2AD4,0x0ABD,0x3D6F,0x04A7,
+ 0x3857,0x18A7,0x0109,0x24BE,0x1A2A,0x3AE8,0x02EB,0x3455,
+ 0x0950,0x3061,0x1D32,0x28E5,0x1608,0x24A9,0x1DD3,0x2E7F,
+ 0x0868,0x26AB,0x329B,0x15D9,0x071E,0x1B59,0x2FFF,0x1563,
+ 0x2A7F,0x0F0E,0x2D04,0x0837,0x31D7,0x1525,0x22BD,0x2F4E,
+ 0x145E,0x00BD,0x1BB0,0x2EAB,0x23BD,0x0308,0x314F,0x1EEB,
+ 0x3DBC,0x1260,0x3808,0x24BD,0x09AB,0x3E7F,0x1F90,0x34A0,
+ 0x1211,0x3F2C,0x141C,0x33F8,0x2071,0x12C9,0x3993,0x0FFF,
+ 0x28F8,0x0059,0x2279,0x31C3,0x0F32,0x230B,0x3E7D,0x10A5,
+ 0x27E3,0x0E66,0x2E10,0x12F9,0x298F,0x3902,0x0D97,0x3326,
+ 0x18E7,0x2FE5,0x0470,0x2041,0x24A0,0x1108,0x38A2,0x17A5,
+ 0x26F9,0x0CAA,0x2E5D,0x0098,0x2064,0x3ED3,0x14E8,0x0B43,
+ 0x33C3,0x2715,0x1AB7,0x0045,0x1629,0x37B8,0x21D7,0x0A34,
+ 0x1A0D,0x2DBC,0x12C6,0x29EF,0x1AAE,0x3E81,0x0951,0x37AC,
+ 0x13F6,0x39A5,0x1D3E,0x0B22,0x27B9,0x0031,0x3AED,0x234A,
+ 0x0442,0x34C0,0x21D4,0x1BC5,0x3E33,0x1854,0x231C,0x3CCD,
+ 0x0F7C,0x2F0B,0x19C7,0x347C,0x0010,0x282F,0x179F,0x2D81,
+ 0x0B67,0x2B5B,0x1DCE,0x3934,0x0998,0x2383,0x1C25,0x2541,
+ 0x36A9,0x0F79,0x3A0A,0x037E,0x34D6,0x0D25,0x3D34,0x1131,
+ 0x36BC,0x20BC,0x0FBF,0x2E38,0x1E89,0x2B23,0x0033,0x3A0B,
+ 0x0AA2,0x3D1B,0x1BD5,0x24CE,0x17DC,0x3F1D,0x03A8,0x1911,
+ 0x3415,0x1F29,0x3F87,0x0A36,0x18E3,0x37B3,0x136C,0x28C8,
+ 0x00D4,0x2E20,0x0AFC,0x1894,0x2D55,0x1303,0x29F1,0x0037,
+ 0x259A,0x0AC5,0x2831,0x0855,0x3CE3,0x264C,0x043A,0x30AB,
+ 0x16A9,0x3F4B,0x0E39,0x1EE7,0x3795,0x08EB,0x1C24,0x2AA9,
+ 0x061F,0x3B77,0x1D7A,0x2451,0x0707,0x16A2,0x2D0F,0x213A,
+ 0x08B1,0x2595,0x1BDC,0x3D4C,0x0790,0x2FA7,0x02E1,0x2A81,
+ 0x0F56,0x3E30,0x1639,0x23C8,0x34A1,0x0613,0x27B0,0x38E9,
+ 0x1678,0x0DB1,0x3BEA,0x1F3D,0x2D30,0x0FAF,0x314D,0x1D53,
+ 0x3C4A,0x041A,0x36B7,0x0BCC,0x34DB,0x10E0,0x30CC,0x19A9,
+ 0x2630,0x085E,0x32AC,0x1786,0x35C1,0x208A,0x1012,0x2DE4,
+ 0x1F14,0x15F6,0x0971,0x2E5E,0x009A,0x3424,0x1175,0x1E88,
+ 0x3317,0x0427,0x3FC6,0x14C0,0x1FC6,0x3A91,0x0E32,0x219F,
+ 0x34A6,0x13D8,0x3000,0x1115,0x34E3,0x14EB,0x3EBA,0x129A,
+ 0x0048,0x2E03,0x17A1,0x25FC,0x1A65,0x2D54,0x0573,0x2937,
+ 0x1BDE,0x032E,0x398D,0x0B97,0x3DC2,0x10D9,0x3595,0x1998,
+ 0x2574,0x207D,0x026A,0x37B0,0x06CA,0x26A4,0x1DC5,0x3946,
+ 0x087A,0x2AE5,0x11B5,0x34FF,0x25B0,0x0CAC,0x2BF1,0x0FD7,
+ 0x3937,0x1BF3,0x2203,0x3412,0x0381,0x39CD,0x0D4A,0x376B,
+ 0x1A45,0x32A8,0x1771,0x2FEA,0x0F1C,0x18D8,0x371C,0x2176,
+ 0x09B6,0x23AD,0x2F28,0x0409,0x272B,0x18A3,0x340B,0x13A7,
+ 0x329C,0x1999,0x00FE,0x30BC,0x1C29,0x3C5A,0x0336,0x1AC1,
+ 0x3EAE,0x1464,0x342F,0x11E6,0x28D0,0x14E5,0x3CB4,0x1B92,
+ 0x3174,0x04B5,0x2B75,0x0ABF,0x17F0,0x305F,0x1D25,0x031E,
+ 0x21E7,0x2EBA,0x0507,0x334A,0x0AC4,0x3E0F,0x02EC,0x2B33,
+ 0x0D6B,0x2733,0x156E,0x2C4E,0x063D,0x256A,0x203D,0x0293,
+ 0x3CD4,0x212C,0x1326,0x2EB6,0x0619,0x3EB7,0x1C93,0x078B,
+ 0x3BF4,0x2475,0x37F4,0x0FB6,0x296C,0x0B82,0x2C7F,0x068B,
+ 0x27FC,0x172E,0x24F8,0x0CDA,0x301C,0x064C,0x3213,0x1A95,
+ 0x0273,0x3B53,0x07B8,0x270C,0x0434,0x2D05,0x0728,0x2B00,
+ 0x3BF6,0x2125,0x08D0,0x3E23,0x0C12,0x21C0,0x3871,0x0F1D,
+ 0x32FE,0x168E,0x27ED,0x211F,0x044E,0x2719,0x1FB6,0x068E,
+ 0x3447,0x100C,0x2E86,0x1395,0x319F,0x0E7F,0x2BC2,0x1315,
+ 0x2764,0x0F45,0x30C5,0x0416,0x1D8E,0x3C38,0x06E1,0x330D,
+ 0x2139,0x058B,0x3D0B,0x1096,0x27BC,0x1AD9,0x2443,0x1458,
+ 0x2CC6,0x064B,0x3B34,0x02EF,0x1FD1,0x2D26,0x070B,0x1BAA,
+ 0x3394,0x1079,0x1A53,0x38E1,0x1298,0x3C91,0x02D6,0x2D62,
+ 0x0A06,0x25E0,0x3936,0x0E08,0x348E,0x1018,0x2297,0x3596,
+ 0x0C92,0x2810,0x007D,0x2C4D,0x0D0E,0x3209,0x216F,0x09D5,
+ 0x2293,0x362D,0x114F,0x3A82,0x2493,0x0E05,0x3CE4,0x19B7,
+ 0x351D,0x0FFB,0x29BE,0x126C,0x27FF,0x1935,0x250E,0x145D,
+ 0x33F9,0x18A5,0x3F04,0x0FFD,0x1E3C,0x3B97,0x0DD7,0x2E85,
+ 0x15BF,0x353B,0x03C1,0x1EAC,0x29CA,0x0EDE,0x26CD,0x3181,
+ 0x1486,0x0234,0x1ABB,0x31CA,0x13E1,0x3BA2,0x2013,0x3899,
+ 0x0DD2,0x3686,0x083A,0x3977,0x18DC,0x2651,0x1075,0x3F19,
+ 0x25A4,0x124A,0x2A3D,0x15B9,0x319A,0x11B6,0x2804,0x16D5,
+ 0x0EBD,0x1ADA,0x2AB7,0x12C5,0x31C9,0x019E,0x1CE1,0x2C27,
+ 0x079E,0x3EDF,0x0E06,0x360B,0x18BB,0x3338,0x0C6A,0x2F0F,
+ 0x1750,0x38F5,0x0914,0x242C,0x1AD4,0x3AA0,0x09F3,0x35B6,
+ 0x01F3,0x3DE0,0x222C,0x170F,0x2DFF,0x14A6,0x282A,0x1B40,
+ 0x0E53,0x3034,0x15BC,0x2B03,0x0BAB,0x32C8,0x050A,0x3D6B,
+ 0x0C7C,0x28D8,0x1572,0x2494,0x35F6,0x0CD8,0x3C3A,0x22BE,
+ 0x0287,0x3D42,0x2851,0x0794,0x2CC2,0x0D8F,0x24ED,0x1CD6,
+ 0x3F0E,0x0F8F,0x208C,0x2B70,0x0866,0x1EE6,0x2F6A,0x05D0,
+ 0x2AB0,0x106F,0x3A3F,0x1E8D,0x36EF,0x057F,0x194E,0x2DF3,
+ 0x1351,0x1EE8,0x2876,0x0281,0x1DA7,0x2CEC,0x0786,0x28DD,
+ 0x091F,0x3F86,0x1B32,0x39C4,0x060D,0x368C,0x0BB1,0x3B12,
+ 0x077B,0x2F66,0x0170,0x21EA,0x3008,0x049A,0x3458,0x1D26,
+ 0x08F8,0x2741,0x1AF5,0x3210,0x1439,0x2F73,0x0AAD,0x20CC,
+ 0x34F1,0x1E50,0x3F7B,0x05FC,0x27B6,0x1A16,0x0390,0x16B9,
+ 0x2DD2,0x2244,0x1B99,0x294D,0x0337,0x2E45,0x1EA2,0x08F5,
+ 0x1C11,0x333E,0x0CB3,0x3D0D,0x1BAD,0x39D9,0x0BBF,0x32CD,
+ 0x267C,0x3585,0x04AE,0x37D6,0x2398,0x1642,0x3BA1,0x1181,
+ 0x25B6,0x1C77,0x2D8C,0x0981,0x2B69,0x13CD,0x3F9E,0x2165,
+ 0x0352,0x27C4,0x1C12,0x3E45,0x00F6,0x2155,0x2DCD,0x1619,
+ 0x2903,0x1CF1,0x0758,0x39F7,0x0AA0,0x35F0,0x0262,0x3EFD,
+ 0x2289,0x0911,0x36E4,0x017D,0x3AEB,0x1699,0x2A65,0x1907,
+ 0x33B3,0x10C5,0x3855,0x093F,0x19DC,0x2A97,0x11C0,0x31AE,
+ 0x152C,0x1F38,0x0BD6,0x3599,0x1759,0x20E5,0x3142,0x0754,
+ 0x1824,0x354F,0x0483,0x15C4,0x3D8F,0x2742,0x1389,0x3ACB,
+ 0x1611,0x32FB,0x1B31,0x08DD,0x1712,0x26AD,0x3B4D,0x0155,
+ 0x3860,0x086D,0x3FCA,0x1585,0x3758,0x11F7,0x3307,0x14D1,
+ 0x2C31,0x1E7D,0x022A,0x1FD5,0x3081,0x1597,0x2C67,0x1732,
+ 0x2981,0x1242,0x1F54,0x3856,0x0EB6,0x2901,0x1195,0x247C,
+ 0x3F78,0x0F2E,0x3765,0x0BAC,0x3A05,0x0154,0x3D61,0x17AD,
+ 0x050D,0x293A,0x10DA,0x2CD3,0x0E92,0x35D8,0x1F63,0x3D52,
+ 0x12FD,0x014D,0x3299,0x1419,0x3D8C,0x0D93,0x364A,0x23D6,
+ 0x38AB,0x05A6,0x2BCD,0x2121,0x0198,0x2255,0x2E48,0x03A2,
+ 0x1F9F,0x0D41,0x2D6D,0x1E33,0x0DEE,0x300B,0x063B,0x2086,
+ 0x31AF,0x00D8,0x172B,0x3BE1,0x1ED3,0x01EF,0x23B5,0x15A5,
+ 0x3AD9,0x0E36,0x336E,0x128E,0x3053,0x1868,0x060C,0x3B88,
+ 0x0B8B,0x351E,0x1982,0x2511,0x1F7F,0x10ED,0x2A62,0x13C2,
+ 0x346D,0x1A49,0x2578,0x1EEC,0x0F29,0x2FC0,0x1295,0x2677,
+ 0x01D7,0x2E8F,0x1C1C,0x2120,0x3F99,0x00CE,0x2706,0x08E1,
+ 0x39BB,0x23EE,0x307F,0x1C92,0x00A8,0x3753,0x0C68,0x39C1,
+ 0x2A6B,0x117A,0x22DF,0x2EA9,0x19F6,0x0182,0x33EB,0x0A82,
+ 0x25BB,0x02F2,0x2EB4,0x1FEE,0x3F36,0x0EE2,0x1F43,0x3265,
+ 0x0FF1,0x261A,0x1A02,0x30CE,0x09C7,0x256D,0x0125,0x3989,
+ 0x0D58,0x3249,0x16C9,0x2B83,0x0A3D,0x26D4,0x00D9,0x32DB,
+ 0x0D0F,0x3D07,0x25FD,0x09DE,0x3339,0x1C7F,0x3A7E,0x00B7,
+ 0x183D,0x2959,0x0581,0x2BAC,0x1974,0x258E,0x0D7F,0x226D,
+ 0x392B,0x0C21,0x3726,0x1D02,0x3076,0x070E,0x2A5B,0x0B04,
+ 0x26C8,0x37D9,0x213F,0x0A6A,0x236A,0x3172,0x15C0,0x00C0,
+ 0x16D3,0x2F16,0x1994,0x0A7C,0x37B5,0x0E89,0x191B,0x3DDC,
+ 0x1568,0x399D,0x22D4,0x077D,0x3FD4,0x2276,0x1A5A,0x35F3,
+ 0x0B49,0x3A36,0x24BB,0x06E6,0x3107,0x1B39,0x3781,0x0860,
+ 0x1CED,0x2C99,0x0524,0x2AA3,0x0B13,0x3875,0x24B9,0x1504,
+ 0x2A49,0x1231,0x2D3B,0x0010,0x297D,0x3B1E,0x08B3,0x2F30,
+ 0x0492,0x2C5A,0x112B,0x3FD4,0x23B4,0x0696,0x379F,0x0AB4,
+ 0x3E54,0x225F,0x04BE,0x2BD2,0x1342,0x2FAD,0x16DB,0x2C86,
+ 0x1AED,0x0535,0x1312,0x3E4F,0x2304,0x15ED,0x26E2,0x1FA4,
+ 0x01FB,0x1E18,0x3374,0x0BC4,0x387D,0x2492,0x111F,0x2DCF,
+ 0x183B,0x3C79,0x0F41,0x2966,0x040E,0x301E,0x0BCA,0x23CB,
+ 0x1C0B,0x2F7D,0x03E6,0x2367,0x1C47,0x3BC3,0x187D,0x20AE,
+ 0x266A,0x068D,0x37DE,0x0F7F,0x3DBB,0x1375,0x3A18,0x1BC3,
+ 0x2414,0x0549,0x1995,0x2D59,0x1700,0x0711,0x2A7D,0x1BE6,
+ 0x356D,0x1123,0x3BAC,0x21DC,0x105E,0x3646,0x1B9C,0x3108,
+ 0x1283,0x2BC8,0x231F,0x011E,0x18A0,0x3AB5,0x139F,0x3362,
+ 0x1C54,0x098A,0x1636,0x3A43,0x1972,0x06D0,0x21EE,0x3BBB,
+ 0x1FC8,0x0EF0,0x3EA0,0x231E,0x131C,0x338E,0x2964,0x0830,
+ 0x2371,0x011F,0x1898,0x3218,0x16D1,0x02BE,0x2BE7,0x1077,
+ 0x2A85,0x202A,0x0D8C,0x369F,0x11EF,0x2ABC,0x0FC3,0x31F8,
+ 0x25F5,0x1141,0x3C84,0x1A50,0x26D7,0x1E95,0x0DF4,0x32CB,
+ 0x03BC,0x3D39,0x0F07,0x3822,0x1346,0x1DF3,0x23F5,0x1905,
+ 0x38F6,0x0C4C,0x30D7,0x03B0,0x1B96,0x31BA,0x0EC8,0x2C2F,
+ 0x1E9C,0x0FFE,0x3A19,0x0CBA,0x3563,0x06C5,0x3B5A,0x0F7B,
+ 0x36A1,0x1E4F,0x2B1B,0x0A2B,0x2D87,0x06AF,0x3BDC,0x0E40,
+ 0x2969,0x3DE5,0x0602,0x2C23,0x12FF,0x1E56,0x3FB8,0x0665,
+ 0x28B6,0x0B80,0x34E0,0x1C96,0x38B4,0x117C,0x2BAA,0x05F9,
+ 0x358D,0x0CC1,0x3C63,0x0E6F,0x3546,0x05A1,0x2EEA,0x1043,
+ 0x3E68,0x1A40,0x24B1,0x1F05,0x042D,0x310F,0x223A,0x08EA,
+ 0x3640,0x1DB7,0x3916,0x02A4,0x3E1D,0x22AA,0x0C9C,0x3184,
+ 0x0806,0x2CA7,0x1EFB,0x0371,0x2E1E,0x0869,0x2AE7,0x0303,
+ 0x3C5E,0x079B,0x1622,0x3E0A,0x25EF,0x0BBD,0x2895,0x02DB,
+ 0x3ED6,0x23BA,0x2F5B,0x040F,0x2B66,0x1D34,0x3072,0x0B89,
+ 0x354D,0x26CF,0x0351,0x2F8F,0x1E57,0x04E7,0x2082,0x360D,
+ 0x3096,0x1D04,0x3B57,0x0AA7,0x26EC,0x3721,0x14AE,0x3D83,
+ 0x0558,0x19F7,0x2E53,0x15F7,0x2826,0x04AD,0x3D04,0x2070,
+ 0x0073,0x3545,0x21A7,0x0990,0x364D,0x02A6,0x3FD4,0x22A5,
+ 0x1B7B,0x2033,0x2FA4,0x09CE,0x334B,0x05C8,0x3CAB,0x0DB3,
+ 0x2639,0x1FF9,0x17CE,0x3660,0x2A0E,0x138E,0x3BC5,0x21A5,
+ 0x05EA,0x2F33,0x1645,0x2836,0x1A7D,0x24E6,0x0C25,0x27C2,
+ 0x01CD,0x31D9,0x14FC,0x3A66,0x1915,0x3334,0x1259,0x302C,
+ 0x1C8C,0x0B10,0x257F,0x0EAE,0x36DB,0x03B4,0x2108,0x3221,
+ 0x1401,0x2FBA,0x2277,0x0755,0x166F,0x335E,0x1883,0x3E06,
+ 0x14A1,0x2A5A,0x1761,0x2C8B,0x127E,0x2757,0x0C5D,0x34C4,
+ 0x0379,0x2E41,0x0B1A,0x3426,0x2842,0x0E91,0x1904,0x2FB3,
+ 0x11FA,0x2AA8,0x10FB,0x285E,0x14D8,0x2E5B,0x1EA0,0x128B,
+ 0x3D1A,0x237C,0x0D32,0x3864,0x1CDF,0x3F03,0x1369,0x276A,
+ 0x16E8,0x3037,0x218F,0x096E,0x1DF7,0x3118,0x150C,0x2C2A,
+ 0x17A4,0x078A,0x1B55,0x3450,0x119C,0x3E5C,0x148C,0x2914,
+ 0x0604,0x1A56,0x33D9,0x0D17,0x284F,0x3A62,0x166E,0x0B12,
+ 0x10E9,0x2CC9,0x1277,0x2A59,0x1B66,0x0902,0x2FA8,0x0C98,
+ 0x22B8,0x387F,0x022D,0x3F3A,0x0AE0,0x2CE5,0x0CC8,0x196B,
+ 0x2F70,0x0EDA,0x175D,0x3152,0x14BE,0x2D6B,0x180D,0x0ABA,
+ 0x310C,0x062A,0x25C9,0x19FF,0x2115,0x285C,0x16D7,0x3237,
+ 0x0115,0x3A4E,0x07BA,0x210D,0x0A01,0x272F,0x0072,0x19C1,
+ 0x3932,0x1162,0x34D3,0x024F,0x3CC0,0x146F,0x3402,0x178D,
+ 0x3EF7,0x1F61,0x087F,0x2249,0x0323,0x2545,0x1F0B,0x047A,
+ 0x3633,0x17A7,0x3AFA,0x1B1B,0x224A,0x30E9,0x174E,0x096F,
+ 0x3BAE,0x00DA,0x192A,0x3D5C,0x2686,0x0224,0x29E5,0x0A4F,
+ 0x2724,0x001A,0x390F,0x07EF,0x1F62,0x31CB,0x1949,0x2436,
+ 0x1E5A,0x1183,0x3940,0x17FC,0x0745,0x3C82,0x2016,0x01F9,
+ 0x3F4C,0x06F4,0x338A,0x0AAF,0x372D,0x04EF,0x3966,0x2180,
+ 0x01EC,0x17F8,0x31D8,0x166D,0x0B45,0x2301,0x3271,0x0C69,
+ 0x29A4,0x1080,0x345C,0x1A61,0x36DF,0x04BA,0x399A,0x0E88,
+ 0x35A1,0x1EEF,0x3C7F,0x0AD2,0x2755,0x01C4,0x2CD7,0x0DDE,
+ 0x39E7,0x2424,0x1209,0x3C2B,0x17A9,0x09E0,0x2900,0x3F05,
+ 0x25F1,0x07D0,0x3807,0x03DC,0x3CCE,0x1DDF,0x252E,0x185A,
+ 0x30DA,0x10E4,0x269C,0x1CA8,0x33C6,0x1440,0x39A2,0x22C1,
+ 0x07ED,0x3EA5,0x29D2,0x0587,0x3C00,0x08C9,0x2552,0x39C6,
+ 0x1582,0x3690,0x1082,0x3EBF,0x027C,0x3756,0x0ACF,0x1CB4,
+ 0x2B4A,0x12AF,0x27F0,0x3D26,0x15EA,0x3358,0x1D4B,0x2DB7,
+ 0x0B42,0x2607,0x1B57,0x2B30,0x0AB5,0x2EF3,0x0583,0x295A,
+ 0x1087,0x2E0D,0x1BAE,0x29B2,0x37E2,0x0F9F,0x3F96,0x27B5,
+ 0x0D63,0x2A2D,0x0035,0x2CE9,0x09EE,0x1516,0x3994,0x232E,
+ 0x1BA7,0x2168,0x2D99,0x0AF1,0x1F30,0x37CB,0x12BF,0x32B5,
+ 0x1A2B,0x2E29,0x15A1,0x23A2,0x3F01,0x021F,0x384C,0x097C,
+ 0x3CC9,0x226B,0x006C,0x214B,0x2F31,0x13BD,0x34E7,0x24CB,
+ 0x1480,0x295C,0x1A19,0x2527,0x1337,0x27EB,0x0BBA,0x306F,
+ 0x1C5B,0x36C3,0x06D4,0x20BF,0x2F89,0x006F,0x1B65,0x367A,
+ 0x05DD,0x3B40,0x0210,0x2D3E,0x0DCF,0x2A99,0x1CAE,0x2540,
+ 0x003E,0x2D80,0x138F,0x29EB,0x103B,0x3884,0x128D,0x322B,
+ 0x1BD8,0x090A,0x2CAC,0x005D,0x24CF,0x32A6,0x1C49,0x0277,
+ 0x35BF,0x1F66,0x1453,0x2F53,0x0FCF,0x33A7,0x001E,0x3ABC,
+ 0x089C,0x1EB2,0x32BC,0x0743,0x18A8,0x29A1,0x038D,0x31CC,
+ 0x1E0C,0x122D,0x1F88,0x244B,0x10AF,0x2ACF,0x1F47,0x0175,
+ 0x2E1B,0x0CCD,0x28E4,0x13DB,0x3175,0x160C,0x2252,0x3E50,
+ 0x0F50,0x3531,0x1D14,0x0315,0x250C,0x0D39,0x3DF3,0x11FF,
+ 0x36C4,0x06EB,0x3EE8,0x0F31,0x23FA,0x1BF4,0x3AF2,0x0D33,
+ 0x36FA,0x0438,0x344F,0x0B84,0x16F8,0x31A0,0x0A4B,0x1983,
+ 0x38CC,0x136B,0x3537,0x1148,0x3E8D,0x277D,0x0275,0x2BE3,
+ 0x0D44,0x3663,0x14A9,0x3A11,0x10C9,0x2411,0x1DF1,0x0504,
+ 0x3AC5,0x1092,0x3605,0x0BEE,0x1B17,0x2B5E,0x1615,0x28CB,
+ 0x142B,0x3287,0x1B69,0x3B3F,0x0FB8,0x2B10,0x0B5B,0x1BEA,
+ 0x3775,0x0D66,0x3B65,0x0010,0x3479,0x1921,0x3FC8,0x11DF,
+ 0x2C57,0x0E7B,0x2718,0x3E35,0x12DF,0x3907,0x250B,0x0E24,
+ 0x2C91,0x191E,0x25B4,0x1252,0x3FD4,0x175E,0x0A05,0x3BDB,
+ 0x2067,0x0CDD,0x37B7,0x0593,0x3340,0x1DEF,0x262D,0x043D,
+ 0x2124,0x3FB2,0x15AF,0x3719,0x1DDE,0x070D,0x3915,0x153B,
};
unsigned short black_sep[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0081,0x008A,0x0094,0x009F,
- 0x00A9,0x00B4,0x00BE,0x00C9,0x00D4,0x00E0,0x00EB,0x00F6,
- 0x0102,0x010E,0x011A,0x0126,0x0133,0x013F,0x014C,0x0159,
- 0x0166,0x0173,0x0180,0x018E,0x019B,0x01A9,0x01B7,0x01C5,
- 0x01D4,0x01E2,0x01F1,0x0200,0x020F,0x021E,0x022D,0x023C,
- 0x024C,0x025C,0x026C,0x027C,0x028C,0x029C,0x02AD,0x02BE,
- 0x02CF,0x02DF,0x02F1,0x0302,0x0313,0x0325,0x0336,0x0348,
- 0x035A,0x036C,0x037F,0x0391,0x03A3,0x03B6,0x03C9,0x03DC,
- 0x03EF,0x0402,0x0415,0x0428,0x043C,0x044F,0x0463,0x0477,
- 0x048A,0x049E,0x04B2,0x04C7,0x04DB,0x04EF,0x0504,0x0518,
- 0x052D,0x0541,0x0556,0x056B,0x0580,0x0595,0x05AA,0x05BF,
- 0x05D4,0x05EA,0x05FF,0x0614,0x062A,0x063F,0x0655,0x066A,
- 0x0680,0x0696,0x06AC,0x06C1,0x06D7,0x06ED,0x0703,0x0719,
- 0x072F,0x0745,0x075B,0x0771,0x0787,0x079D,0x07B3,0x07C9,
- 0x07E0,0x07F6,0x080C,0x0822,0x0838,0x084F,0x0865,0x087B,
- 0x0891,0x08A7,0x08BE,0x08D4,0x08EA,0x0900,0x0917,0x092D,
- 0x0943,0x0959,0x096F,0x0986,0x099C,0x09B2,0x09C8,0x09DE,
- 0x09F4,0x0A0A,0x0A20,0x0A36,0x0A4C,0x0A62,0x0A78,0x0A8E,
- 0x0AA4,0x0ABA,0x0AD0,0x0AE6,0x0AFB,0x0B11,0x0B27,0x0B3D,
- 0x0B52,0x0B68,0x0B7E,0x0B93,0x0BA9,0x0BBE,0x0BD4,0x0BE9,
- 0x0BFE,0x0C14,0x0C29,0x0C3E,0x0C54,0x0C69,0x0C7E,0x0C93,
- 0x0CA8,0x0CBD,0x0CD2,0x0CE7,0x0CFC,0x0D11,0x0D26,0x0D3B,
- 0x0D50,0x0D64,0x0D79,0x0D8E,0x0DA2,0x0DB7,0x0DCC,0x0DE0,
- 0x0DF4,0x0E09,0x0E1D,0x0E32,0x0E46,0x0E5A,0x0E6E,0x0E83,
- 0x0E97,0x0EAB,0x0EBF,0x0ED3,0x0EE7,0x0EFB,0x0F0F,0x0F23,
- 0x0F36,0x0F4A,0x0F5E,0x0F72,0x0F85,0x0F99,0x0FAD,0x0FC0,
- 0x0FD4,0x0FE7,0x0FFB,0x100E,0x1021,0x1035,0x1048,0x105B,
- 0x106F,0x1082,0x1095,0x10A8,0x10BB,0x10CE,0x10E1,0x10F4,
- 0x1107,0x111A,0x112D,0x1140,0x1153,0x1166,0x1178,0x118B,
- 0x119E,0x11B1,0x11C3,0x11D6,0x11E8,0x11FB,0x120E,0x1220,
- 0x1232,0x1245,0x1257,0x126A,0x127C,0x128E,0x12A1,0x12B3,
- 0x12C5,0x12D8,0x12EA,0x12FC,0x130E,0x1320,0x1332,0x1344,
- 0x1356,0x1368,0x137A,0x138C,0x139E,0x13B0,0x13C2,0x13D4,
- 0x13E6,0x13F8,0x140A,0x141B,0x142D,0x143F,0x1451,0x1462,
- 0x1474,0x1486,0x1497,0x14A9,0x14BB,0x14CC,0x14DE,0x14F0,
- 0x1501,0x1513,0x1524,0x1536,0x1547,0x1559,0x156A,0x157B,
- 0x158D,0x159E,0x15B0,0x15C1,0x15D2,0x15E4,0x15F5,0x1606,
- 0x1618,0x1629,0x163A,0x164B,0x165C,0x166E,0x167F,0x1690,
- 0x16A1,0x16B2,0x16C4,0x16D5,0x16E6,0x16F7,0x1708,0x1719,
- 0x172A,0x173B,0x174C,0x175D,0x176E,0x177F,0x1790,0x17A1,
- 0x17B2,0x17C3,0x17D4,0x17E5,0x17F6,0x1807,0x1818,0x1829,
- 0x183A,0x184B,0x185C,0x186C,0x187D,0x188E,0x189F,0x18B0,
- 0x18C1,0x18D1,0x18E2,0x18F3,0x1904,0x1915,0x1925,0x1936,
- 0x1947,0x1958,0x1968,0x1979,0x198A,0x199B,0x19AB,0x19BC,
- 0x19CD,0x19DD,0x19EE,0x19FF,0x1A10,0x1A20,0x1A31,0x1A41,
- 0x1A52,0x1A63,0x1A73,0x1A84,0x1A95,0x1AA5,0x1AB6,0x1AC7,
- 0x1AD7,0x1AE8,0x1AF8,0x1B09,0x1B1A,0x1B2A,0x1B3B,0x1B4B,
- 0x1B5C,0x1B6C,0x1B7D,0x1B8D,0x1B9E,0x1BAF,0x1BBF,0x1BD0,
- 0x1BE0,0x1BF1,0x1C01,0x1C12,0x1C22,0x1C33,0x1C43,0x1C54,
- 0x1C64,0x1C75,0x1C85,0x1C96,0x1CA6,0x1CB7,0x1CC7,0x1CD8,
- 0x1CE8,0x1CF9,0x1D09,0x1D19,0x1D2A,0x1D3A,0x1D4B,0x1D5B,
- 0x1D6C,0x1D7C,0x1D8D,0x1D9D,0x1DAD,0x1DBE,0x1DCE,0x1DDF,
- 0x1DEF,0x1E00,0x1E10,0x1E20,0x1E31,0x1E41,0x1E52,0x1E62,
- 0x1E72,0x1E83,0x1E93,0x1EA4,0x1EB4,0x1EC4,0x1ED5,0x1EE5,
- 0x1EF5,0x1F06,0x1F16,0x1F27,0x1F37,0x1F47,0x1F58,0x1F68,
- 0x1F78,0x1F89,0x1F99,0x1FAA,0x1FBA,0x1FCA,0x1FDB,0x1FEB,
- 0x1FFB,0x200C,0x201C,0x202C,0x203D,0x204D,0x205D,0x206E,
- 0x207E,0x208E,0x209F,0x20AF,0x20BF,0x20D0,0x20E0,0x20F0,
- 0x2101,0x2111,0x2121,0x2132,0x2142,0x2152,0x2163,0x2173,
- 0x2183,0x2194,0x21A4,0x21B4,0x21C5,0x21D5,0x21E5,0x21F6,
- 0x2206,0x2216,0x2226,0x2237,0x2247,0x2257,0x2268,0x2278,
- 0x2288,0x2299,0x22A9,0x22B9,0x22CA,0x22DA,0x22EA,0x22FA,
- 0x230B,0x231B,0x232B,0x233C,0x234C,0x235C,0x236D,0x237D,
- 0x238D,0x239D,0x23AE,0x23BE,0x23CE,0x23DF,0x23EF,0x23FF,
- 0x240F,0x2420,0x2430,0x2440,0x2451,0x2461,0x2471,0x2481,
- 0x2492,0x24A2,0x24B2,0x24C3,0x24D3,0x24E3,0x24F3,0x2504,
- 0x2514,0x2524,0x2534,0x2545,0x2555,0x2565,0x2576,0x2586,
- 0x2596,0x25A6,0x25B7,0x25C7,0x25D7,0x25E8,0x25F8,0x2608,
- 0x2618,0x2629,0x2639,0x2649,0x2659,0x266A,0x267A,0x268A,
- 0x269A,0x26AB,0x26BB,0x26CB,0x26DC,0x26EC,0x26FC,0x270C,
- 0x271D,0x272D,0x273D,0x274D,0x275E,0x276E,0x277E,0x278E,
- 0x279F,0x27AF,0x27BF,0x27D0,0x27E0,0x27F0,0x2800,0x2811,
- 0x2821,0x2831,0x2841,0x2852,0x2862,0x2872,0x2882,0x2893,
- 0x28A3,0x28B3,0x28C3,0x28D4,0x28E4,0x28F4,0x2905,0x2915,
- 0x2925,0x2935,0x2946,0x2956,0x2966,0x2976,0x2987,0x2997,
- 0x29A7,0x29B7,0x29C8,0x29D8,0x29E8,0x29F8,0x2A09,0x2A19,
- 0x2A29,0x2A39,0x2A4A,0x2A5A,0x2A6A,0x2A7A,0x2A8B,0x2A9B,
- 0x2AAB,0x2ABC,0x2ACC,0x2ADC,0x2AEC,0x2AFD,0x2B0D,0x2B1D,
- 0x2B2D,0x2B3E,0x2B4E,0x2B5E,0x2B6E,0x2B7F,0x2B8F,0x2B9F,
- 0x2BAF,0x2BC0,0x2BD0,0x2BE0,0x2BF0,0x2C01,0x2C11,0x2C21,
- 0x2C31,0x2C42,0x2C52,0x2C62,0x2C72,0x2C83,0x2C93,0x2CA3,
- 0x2CB3,0x2CC4,0x2CD4,0x2CE4,0x2CF4,0x2D05,0x2D15,0x2D25,
- 0x2D35,0x2D46,0x2D56,0x2D66,0x2D76,0x2D87,0x2D97,0x2DA7,
- 0x2DB7,0x2DC8,0x2DD8,0x2DE8,0x2DF9,0x2E09,0x2E19,0x2E29,
- 0x2E3A,0x2E4A,0x2E5A,0x2E6A,0x2E7B,0x2E8B,0x2E9B,0x2EAB,
- 0x2EBC,0x2ECC,0x2EDC,0x2EEC,0x2EFD,0x2F0D,0x2F1D,0x2F2D,
- 0x2F3E,0x2F4E,0x2F5E,0x2F6E,0x2F7F,0x2F8F,0x2F9F,0x2FAF,
- 0x2FC0,0x2FD0,0x2FE0,0x2FF0,0x3001,0x3011,0x3021,0x3031,
- 0x3042,0x3052,0x3062,0x3072,0x3083,0x3093,0x30A3,0x30B3,
- 0x30C4,0x30D4,0x30E4,0x30F4,0x3105,0x3115,0x3125,0x3135,
- 0x3146,0x3156,0x3166,0x3176,0x3187,0x3197,0x31A7,0x31B7,
- 0x31C8,0x31D8,0x31E8,0x31F8,0x3209,0x3219,0x3229,0x3239,
- 0x324A,0x325A,0x326A,0x327A,0x328B,0x329B,0x32AB,0x32BB,
- 0x32CC,0x32DC,0x32EC,0x32FC,0x330D,0x331D,0x332D,0x333D,
- 0x334E,0x335E,0x336E,0x337E,0x338F,0x339F,0x33AF,0x33BF,
- 0x33D0,0x33E0,0x33F0,0x3400,0x3411,0x3421,0x3431,0x3441,
- 0x3452,0x3462,0x3472,0x3482,0x3493,0x34A3,0x34B3,0x34C3,
- 0x34D4,0x34E4,0x34F4,0x3504,0x3515,0x3525,0x3535,0x3545,
- 0x3556,0x3566,0x3576,0x3586,0x3597,0x35A7,0x35B7,0x35C7,
- 0x35D8,0x35E8,0x35F8,0x3608,0x3619,0x3629,0x3639,0x3649,
- 0x365A,0x366A,0x367A,0x368A,0x369B,0x36AB,0x36BB,0x36CB,
- 0x36DC,0x36EC,0x36FC,0x370C,0x371D,0x372D,0x373D,0x374D,
- 0x375E,0x376E,0x377E,0x378E,0x379F,0x37AF,0x37BF,0x37CF,
- 0x37E0,0x37F0,0x3800,0x3810,0x3821,0x3831,0x3841,0x3851,
- 0x3862,0x3872,0x3882,0x3892,0x38A3,0x38B3,0x38C3,0x38D3,
- 0x38E4,0x38F4,0x3904,0x3914,0x3925,0x3935,0x3945,0x3955,
- 0x3966,0x3976,0x3986,0x3996,0x39A7,0x39B7,0x39C7,0x39D7,
- 0x39E8,0x39F8,0x3A08,0x3A18,0x3A29,0x3A39,0x3A49,0x3A59,
- 0x3A6A,0x3A7A,0x3A8A,0x3A9A,0x3AAB,0x3ABB,0x3ACB,0x3ADB,
- 0x3AEC,0x3AFC,0x3B0C,0x3B1C,0x3B2D,0x3B3D,0x3B4D,0x3B5D,
- 0x3B6E,0x3B7E,0x3B8E,0x3B9E,0x3BAF,0x3BBF,0x3BCF,0x3BDF,
- 0x3BF0,0x3C00,0x3C10,0x3C20,0x3C31,0x3C41,0x3C51,0x3C61,
- 0x3C72,0x3C82,0x3C92,0x3CA2,0x3CB3,0x3CC3,0x3CD3,0x3CE3,
- 0x3CF4,0x3D04,0x3D14,0x3D24,0x3D35,0x3D45,0x3D55,0x3D65,
- 0x3D76,0x3D86,0x3D96,0x3DA6,0x3DB7,0x3DC7,0x3DD7,0x3DE7,
- 0x3DF8,0x3E08,0x3E18,0x3E28,0x3E39,0x3E49,0x3E59,0x3E69,
- 0x3E7A,0x3E8A,0x3E9A,0x3EAA,0x3EBB,0x3ECB,0x3EDB,0x3EEB,
- 0x3EFC,0x3F0C,0x3F1C,0x3F2C,0x3F3D,0x3F4D,0x3F5D,0x3F6D,
- 0x3F7E,0x3F8E,0x3F9E,0x3FAE,0x3FBF,0x3FCF,0x3FDF,0x3FEF
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0081,0x008A,0x0094,0x009F,
+ 0x00A9,0x00B4,0x00BE,0x00C9,0x00D4,0x00E0,0x00EB,0x00F6,
+ 0x0102,0x010E,0x011A,0x0126,0x0133,0x013F,0x014C,0x0159,
+ 0x0166,0x0173,0x0180,0x018E,0x019B,0x01A9,0x01B7,0x01C5,
+ 0x01D4,0x01E2,0x01F1,0x0200,0x020F,0x021E,0x022D,0x023C,
+ 0x024C,0x025C,0x026C,0x027C,0x028C,0x029C,0x02AD,0x02BE,
+ 0x02CF,0x02DF,0x02F1,0x0302,0x0313,0x0325,0x0336,0x0348,
+ 0x035A,0x036C,0x037F,0x0391,0x03A3,0x03B6,0x03C9,0x03DC,
+ 0x03EF,0x0402,0x0415,0x0428,0x043C,0x044F,0x0463,0x0477,
+ 0x048A,0x049E,0x04B2,0x04C7,0x04DB,0x04EF,0x0504,0x0518,
+ 0x052D,0x0541,0x0556,0x056B,0x0580,0x0595,0x05AA,0x05BF,
+ 0x05D4,0x05EA,0x05FF,0x0614,0x062A,0x063F,0x0655,0x066A,
+ 0x0680,0x0696,0x06AC,0x06C1,0x06D7,0x06ED,0x0703,0x0719,
+ 0x072F,0x0745,0x075B,0x0771,0x0787,0x079D,0x07B3,0x07C9,
+ 0x07E0,0x07F6,0x080C,0x0822,0x0838,0x084F,0x0865,0x087B,
+ 0x0891,0x08A7,0x08BE,0x08D4,0x08EA,0x0900,0x0917,0x092D,
+ 0x0943,0x0959,0x096F,0x0986,0x099C,0x09B2,0x09C8,0x09DE,
+ 0x09F4,0x0A0A,0x0A20,0x0A36,0x0A4C,0x0A62,0x0A78,0x0A8E,
+ 0x0AA4,0x0ABA,0x0AD0,0x0AE6,0x0AFB,0x0B11,0x0B27,0x0B3D,
+ 0x0B52,0x0B68,0x0B7E,0x0B93,0x0BA9,0x0BBE,0x0BD4,0x0BE9,
+ 0x0BFE,0x0C14,0x0C29,0x0C3E,0x0C54,0x0C69,0x0C7E,0x0C93,
+ 0x0CA8,0x0CBD,0x0CD2,0x0CE7,0x0CFC,0x0D11,0x0D26,0x0D3B,
+ 0x0D50,0x0D64,0x0D79,0x0D8E,0x0DA2,0x0DB7,0x0DCC,0x0DE0,
+ 0x0DF4,0x0E09,0x0E1D,0x0E32,0x0E46,0x0E5A,0x0E6E,0x0E83,
+ 0x0E97,0x0EAB,0x0EBF,0x0ED3,0x0EE7,0x0EFB,0x0F0F,0x0F23,
+ 0x0F36,0x0F4A,0x0F5E,0x0F72,0x0F85,0x0F99,0x0FAD,0x0FC0,
+ 0x0FD4,0x0FE7,0x0FFB,0x100E,0x1021,0x1035,0x1048,0x105B,
+ 0x106F,0x1082,0x1095,0x10A8,0x10BB,0x10CE,0x10E1,0x10F4,
+ 0x1107,0x111A,0x112D,0x1140,0x1153,0x1166,0x1178,0x118B,
+ 0x119E,0x11B1,0x11C3,0x11D6,0x11E8,0x11FB,0x120E,0x1220,
+ 0x1232,0x1245,0x1257,0x126A,0x127C,0x128E,0x12A1,0x12B3,
+ 0x12C5,0x12D8,0x12EA,0x12FC,0x130E,0x1320,0x1332,0x1344,
+ 0x1356,0x1368,0x137A,0x138C,0x139E,0x13B0,0x13C2,0x13D4,
+ 0x13E6,0x13F8,0x140A,0x141B,0x142D,0x143F,0x1451,0x1462,
+ 0x1474,0x1486,0x1497,0x14A9,0x14BB,0x14CC,0x14DE,0x14F0,
+ 0x1501,0x1513,0x1524,0x1536,0x1547,0x1559,0x156A,0x157B,
+ 0x158D,0x159E,0x15B0,0x15C1,0x15D2,0x15E4,0x15F5,0x1606,
+ 0x1618,0x1629,0x163A,0x164B,0x165C,0x166E,0x167F,0x1690,
+ 0x16A1,0x16B2,0x16C4,0x16D5,0x16E6,0x16F7,0x1708,0x1719,
+ 0x172A,0x173B,0x174C,0x175D,0x176E,0x177F,0x1790,0x17A1,
+ 0x17B2,0x17C3,0x17D4,0x17E5,0x17F6,0x1807,0x1818,0x1829,
+ 0x183A,0x184B,0x185C,0x186C,0x187D,0x188E,0x189F,0x18B0,
+ 0x18C1,0x18D1,0x18E2,0x18F3,0x1904,0x1915,0x1925,0x1936,
+ 0x1947,0x1958,0x1968,0x1979,0x198A,0x199B,0x19AB,0x19BC,
+ 0x19CD,0x19DD,0x19EE,0x19FF,0x1A10,0x1A20,0x1A31,0x1A41,
+ 0x1A52,0x1A63,0x1A73,0x1A84,0x1A95,0x1AA5,0x1AB6,0x1AC7,
+ 0x1AD7,0x1AE8,0x1AF8,0x1B09,0x1B1A,0x1B2A,0x1B3B,0x1B4B,
+ 0x1B5C,0x1B6C,0x1B7D,0x1B8D,0x1B9E,0x1BAF,0x1BBF,0x1BD0,
+ 0x1BE0,0x1BF1,0x1C01,0x1C12,0x1C22,0x1C33,0x1C43,0x1C54,
+ 0x1C64,0x1C75,0x1C85,0x1C96,0x1CA6,0x1CB7,0x1CC7,0x1CD8,
+ 0x1CE8,0x1CF9,0x1D09,0x1D19,0x1D2A,0x1D3A,0x1D4B,0x1D5B,
+ 0x1D6C,0x1D7C,0x1D8D,0x1D9D,0x1DAD,0x1DBE,0x1DCE,0x1DDF,
+ 0x1DEF,0x1E00,0x1E10,0x1E20,0x1E31,0x1E41,0x1E52,0x1E62,
+ 0x1E72,0x1E83,0x1E93,0x1EA4,0x1EB4,0x1EC4,0x1ED5,0x1EE5,
+ 0x1EF5,0x1F06,0x1F16,0x1F27,0x1F37,0x1F47,0x1F58,0x1F68,
+ 0x1F78,0x1F89,0x1F99,0x1FAA,0x1FBA,0x1FCA,0x1FDB,0x1FEB,
+ 0x1FFB,0x200C,0x201C,0x202C,0x203D,0x204D,0x205D,0x206E,
+ 0x207E,0x208E,0x209F,0x20AF,0x20BF,0x20D0,0x20E0,0x20F0,
+ 0x2101,0x2111,0x2121,0x2132,0x2142,0x2152,0x2163,0x2173,
+ 0x2183,0x2194,0x21A4,0x21B4,0x21C5,0x21D5,0x21E5,0x21F6,
+ 0x2206,0x2216,0x2226,0x2237,0x2247,0x2257,0x2268,0x2278,
+ 0x2288,0x2299,0x22A9,0x22B9,0x22CA,0x22DA,0x22EA,0x22FA,
+ 0x230B,0x231B,0x232B,0x233C,0x234C,0x235C,0x236D,0x237D,
+ 0x238D,0x239D,0x23AE,0x23BE,0x23CE,0x23DF,0x23EF,0x23FF,
+ 0x240F,0x2420,0x2430,0x2440,0x2451,0x2461,0x2471,0x2481,
+ 0x2492,0x24A2,0x24B2,0x24C3,0x24D3,0x24E3,0x24F3,0x2504,
+ 0x2514,0x2524,0x2534,0x2545,0x2555,0x2565,0x2576,0x2586,
+ 0x2596,0x25A6,0x25B7,0x25C7,0x25D7,0x25E8,0x25F8,0x2608,
+ 0x2618,0x2629,0x2639,0x2649,0x2659,0x266A,0x267A,0x268A,
+ 0x269A,0x26AB,0x26BB,0x26CB,0x26DC,0x26EC,0x26FC,0x270C,
+ 0x271D,0x272D,0x273D,0x274D,0x275E,0x276E,0x277E,0x278E,
+ 0x279F,0x27AF,0x27BF,0x27D0,0x27E0,0x27F0,0x2800,0x2811,
+ 0x2821,0x2831,0x2841,0x2852,0x2862,0x2872,0x2882,0x2893,
+ 0x28A3,0x28B3,0x28C3,0x28D4,0x28E4,0x28F4,0x2905,0x2915,
+ 0x2925,0x2935,0x2946,0x2956,0x2966,0x2976,0x2987,0x2997,
+ 0x29A7,0x29B7,0x29C8,0x29D8,0x29E8,0x29F8,0x2A09,0x2A19,
+ 0x2A29,0x2A39,0x2A4A,0x2A5A,0x2A6A,0x2A7A,0x2A8B,0x2A9B,
+ 0x2AAB,0x2ABC,0x2ACC,0x2ADC,0x2AEC,0x2AFD,0x2B0D,0x2B1D,
+ 0x2B2D,0x2B3E,0x2B4E,0x2B5E,0x2B6E,0x2B7F,0x2B8F,0x2B9F,
+ 0x2BAF,0x2BC0,0x2BD0,0x2BE0,0x2BF0,0x2C01,0x2C11,0x2C21,
+ 0x2C31,0x2C42,0x2C52,0x2C62,0x2C72,0x2C83,0x2C93,0x2CA3,
+ 0x2CB3,0x2CC4,0x2CD4,0x2CE4,0x2CF4,0x2D05,0x2D15,0x2D25,
+ 0x2D35,0x2D46,0x2D56,0x2D66,0x2D76,0x2D87,0x2D97,0x2DA7,
+ 0x2DB7,0x2DC8,0x2DD8,0x2DE8,0x2DF9,0x2E09,0x2E19,0x2E29,
+ 0x2E3A,0x2E4A,0x2E5A,0x2E6A,0x2E7B,0x2E8B,0x2E9B,0x2EAB,
+ 0x2EBC,0x2ECC,0x2EDC,0x2EEC,0x2EFD,0x2F0D,0x2F1D,0x2F2D,
+ 0x2F3E,0x2F4E,0x2F5E,0x2F6E,0x2F7F,0x2F8F,0x2F9F,0x2FAF,
+ 0x2FC0,0x2FD0,0x2FE0,0x2FF0,0x3001,0x3011,0x3021,0x3031,
+ 0x3042,0x3052,0x3062,0x3072,0x3083,0x3093,0x30A3,0x30B3,
+ 0x30C4,0x30D4,0x30E4,0x30F4,0x3105,0x3115,0x3125,0x3135,
+ 0x3146,0x3156,0x3166,0x3176,0x3187,0x3197,0x31A7,0x31B7,
+ 0x31C8,0x31D8,0x31E8,0x31F8,0x3209,0x3219,0x3229,0x3239,
+ 0x324A,0x325A,0x326A,0x327A,0x328B,0x329B,0x32AB,0x32BB,
+ 0x32CC,0x32DC,0x32EC,0x32FC,0x330D,0x331D,0x332D,0x333D,
+ 0x334E,0x335E,0x336E,0x337E,0x338F,0x339F,0x33AF,0x33BF,
+ 0x33D0,0x33E0,0x33F0,0x3400,0x3411,0x3421,0x3431,0x3441,
+ 0x3452,0x3462,0x3472,0x3482,0x3493,0x34A3,0x34B3,0x34C3,
+ 0x34D4,0x34E4,0x34F4,0x3504,0x3515,0x3525,0x3535,0x3545,
+ 0x3556,0x3566,0x3576,0x3586,0x3597,0x35A7,0x35B7,0x35C7,
+ 0x35D8,0x35E8,0x35F8,0x3608,0x3619,0x3629,0x3639,0x3649,
+ 0x365A,0x366A,0x367A,0x368A,0x369B,0x36AB,0x36BB,0x36CB,
+ 0x36DC,0x36EC,0x36FC,0x370C,0x371D,0x372D,0x373D,0x374D,
+ 0x375E,0x376E,0x377E,0x378E,0x379F,0x37AF,0x37BF,0x37CF,
+ 0x37E0,0x37F0,0x3800,0x3810,0x3821,0x3831,0x3841,0x3851,
+ 0x3862,0x3872,0x3882,0x3892,0x38A3,0x38B3,0x38C3,0x38D3,
+ 0x38E4,0x38F4,0x3904,0x3914,0x3925,0x3935,0x3945,0x3955,
+ 0x3966,0x3976,0x3986,0x3996,0x39A7,0x39B7,0x39C7,0x39D7,
+ 0x39E8,0x39F8,0x3A08,0x3A18,0x3A29,0x3A39,0x3A49,0x3A59,
+ 0x3A6A,0x3A7A,0x3A8A,0x3A9A,0x3AAB,0x3ABB,0x3ACB,0x3ADB,
+ 0x3AEC,0x3AFC,0x3B0C,0x3B1C,0x3B2D,0x3B3D,0x3B4D,0x3B5D,
+ 0x3B6E,0x3B7E,0x3B8E,0x3B9E,0x3BAF,0x3BBF,0x3BCF,0x3BDF,
+ 0x3BF0,0x3C00,0x3C10,0x3C20,0x3C31,0x3C41,0x3C51,0x3C61,
+ 0x3C72,0x3C82,0x3C92,0x3CA2,0x3CB3,0x3CC3,0x3CD3,0x3CE3,
+ 0x3CF4,0x3D04,0x3D14,0x3D24,0x3D35,0x3D45,0x3D55,0x3D65,
+ 0x3D76,0x3D86,0x3D96,0x3DA6,0x3DB7,0x3DC7,0x3DD7,0x3DE7,
+ 0x3DF8,0x3E08,0x3E18,0x3E28,0x3E39,0x3E49,0x3E59,0x3E69,
+ 0x3E7A,0x3E8A,0x3E9A,0x3EAA,0x3EBB,0x3ECB,0x3EDB,0x3EEB,
+ 0x3EFC,0x3F0C,0x3F1C,0x3F2C,0x3F3D,0x3F4D,0x3F5D,0x3F6D,
+ 0x3F7E,0x3F8E,0x3F9E,0x3FAE,0x3FBF,0x3FCF,0x3FDF,0x3FEF
};
#ifdef __STDC__
static signed short HtoCMY[]
@@ -2185,1036 +2185,1036 @@ static signed short HtoCMY[]
static short HtoCMY[]
#endif
= {
- 0xFFAF,0x03E6,0x03E4,0xFFAF,0x03E4,0x03E4,0xFFAF,0x03E1,0x03E4,0xFFAF,0x03DE,0x03E4,
- 0xFFAF,0x03DB,0x03E4,0xFFAF,0x03D7,0x03E4,0xFFAF,0x03D3,0x03E4,0xFFAF,0x03D0,0x03E4,
- 0xFFAF,0x03CC,0x03E4,0xFFAF,0x03C8,0x03E4,0xFFAF,0x03C4,0x03E4,0xFFAF,0x03C0,0x03E4,
- 0xFFAF,0x03BB,0x03E4,0xFFAF,0x03B7,0x03E4,0xFFAF,0x03B3,0x03E4,0xFFAF,0x03AE,0x03E4,
- 0xFFAF,0x03AA,0x03E4,0xFFAF,0x03A5,0x03E3,0xFFAF,0x03A1,0x03E3,0xFFAF,0x039C,0x03E3,
- 0xFFAF,0x0397,0x03E3,0xFFAF,0x0393,0x03E3,0xFFAF,0x038E,0x03E3,0xFFAF,0x0389,0x03E3,
- 0xFFAF,0x0384,0x03E3,0xFFAF,0x037F,0x03E3,0xFFAF,0x037A,0x03E3,0xFFAF,0x0375,0x03E3,
- 0xFFAF,0x0370,0x03E3,0xFFAF,0x036B,0x03E3,0xFFAF,0x0366,0x03E3,0xFFAF,0x0361,0x03E3,
- 0xFFAF,0x035C,0x03E2,0xFFAF,0x0357,0x03E2,0xFFAF,0x0352,0x03E2,0xFFAF,0x034C,0x03E2,
- 0xFFAF,0x0347,0x03E2,0xFFAF,0x0342,0x03E2,0xFFAF,0x033C,0x03E2,0xFFAE,0x0337,0x03E2,
- 0xFFAE,0x0332,0x03E2,0xFFAE,0x032C,0x03E2,0xFFAE,0x0327,0x03E2,0xFFAE,0x0321,0x03E1,
- 0xFFAE,0x031C,0x03E1,0xFFAE,0x0316,0x03E1,0xFFAE,0x0311,0x03E1,0xFFAE,0x030B,0x03E1,
- 0xFFAE,0x0305,0x03E1,0xFFAE,0x0300,0x03E1,0xFFAE,0x02FA,0x03E1,0xFFAE,0x02F4,0x03E1,
- 0xFFAE,0x02EF,0x03E0,0xFFAE,0x02E9,0x03E0,0xFFAE,0x02E3,0x03E0,0xFFAE,0x02DE,0x03E0,
- 0xFFAE,0x02D8,0x03E0,0xFFAE,0x02D2,0x03E0,0xFFAE,0x02CC,0x03E0,0xFFAE,0x02C6,0x03E0,
- 0xFFAE,0x02C0,0x03DF,0xFFAD,0x02BB,0x03DF,0xFFAD,0x02B5,0x03DF,0xFFAD,0x02AF,0x03DF,
- 0xFFAD,0x02A9,0x03DF,0xFFAD,0x02A3,0x03DF,0xFFAD,0x029D,0x03DF,0xFFAD,0x0297,0x03DE,
- 0xFFAD,0x0291,0x03DE,0xFFAD,0x028B,0x03DE,0xFFAD,0x0285,0x03DE,0xFFAD,0x027F,0x03DE,
- 0xFFAD,0x0279,0x03DE,0xFFAD,0x0273,0x03DE,0xFFAD,0x026C,0x03DD,0xFFAC,0x0266,0x03DD,
- 0xFFAC,0x0260,0x03DD,0xFFAC,0x025A,0x03DD,0xFFAC,0x0254,0x03DD,0xFFAC,0x024E,0x03DD,
- 0xFFAC,0x0247,0x03DD,0xFFAC,0x0241,0x03DC,0xFFAC,0x023B,0x03DC,0xFFAC,0x0235,0x03DC,
- 0xFFAC,0x022E,0x03DC,0xFFAC,0x0228,0x03DC,0xFFAC,0x0222,0x03DC,0xFFAB,0x021C,0x03DB,
- 0xFFAB,0x0215,0x03DB,0xFFAB,0x020F,0x03DB,0xFFAB,0x0208,0x03DB,0xFFAB,0x0202,0x03DB,
- 0xFFAB,0x01FC,0x03DB,0xFFAB,0x01F5,0x03DA,0xFFAB,0x01EF,0x03DA,0xFFAB,0x01E8,0x03DA,
- 0xFFAA,0x01E2,0x03DA,0xFFAA,0x01DC,0x03DA,0xFFAA,0x01D5,0x03D9,0xFFAA,0x01CF,0x03D9,
- 0xFFAA,0x01C8,0x03D9,0xFFAA,0x01C2,0x03D9,0xFFAA,0x01BB,0x03D9,0xFFAA,0x01B5,0x03D9,
- 0xFFA9,0x01AE,0x03D8,0xFFA9,0x01A9,0x03D8,0xFFA9,0x01A3,0x03D8,0xFFA9,0x019E,0x03D8,
- 0xFFA9,0x0199,0x03D8,0xFFA9,0x0194,0x03D7,0xFFA9,0x018F,0x03D7,0xFFA9,0x018A,0x03D7,
- 0xFFA8,0x0184,0x03D7,0xFFA8,0x017F,0x03D7,0xFFA8,0x017A,0x03D6,0xFFA8,0x0175,0x03D6,
- 0xFFA8,0x0170,0x03D6,0xFFA8,0x016B,0x03D6,0xFFA8,0x0166,0x03D6,0xFFA7,0x0161,0x03D5,
- 0xFFA7,0x015C,0x03D5,0xFFA7,0x0157,0x03D5,0xFFA7,0x0152,0x03D5,0xFFA7,0x014E,0x03D4,
- 0xFFA7,0x0149,0x03D4,0xFFA6,0x0144,0x03D4,0xFFA6,0x013F,0x03D4,0xFFA6,0x013A,0x03D4,
- 0xFFA6,0x0136,0x03D3,0xFFA6,0x0131,0x03D3,0xFFA6,0x012C,0x03D3,0xFFA5,0x0127,0x03D3,
- 0xFFA5,0x0123,0x03D2,0xFFA5,0x011E,0x03D2,0xFFA5,0x011A,0x03D2,0xFFA5,0x0115,0x03D2,
- 0xFFA5,0x0110,0x03D2,0xFFA4,0x010C,0x03D1,0xFFA4,0x0107,0x03D1,0xFFA4,0x0103,0x03D1,
- 0xFFA4,0x00FE,0x03D1,0xFFA4,0x00FA,0x03D0,0xFFA3,0x00F6,0x03D0,0xFFA3,0x00F1,0x03D0,
- 0xFFA3,0x00ED,0x03D0,0xFFA3,0x00E9,0x03CF,0xFFA3,0x00E4,0x03CF,0xFFA2,0x00E0,0x03CF,
- 0xFFA2,0x00DC,0x03CF,0xFFA2,0x00D8,0x03CE,0xFFA2,0x00D3,0x03CE,0xFFA2,0x00CF,0x03CE,
- 0xFFA1,0x00CB,0x03CE,0xFFA1,0x00C7,0x03CD,0xFFA1,0x00C3,0x03CD,0xFFA1,0x00BF,0x03CD,
- 0xFFA0,0x00BB,0x03CD,0xFFA0,0x00B7,0x03CC,0xFFA0,0x00B3,0x03CC,0xFFA0,0x00AF,0x03CC,
- 0xFFA0,0x00AB,0x03CC,0xFF9F,0x00A7,0x03CB,0xFF9F,0x00A3,0x03CB,0xFF9F,0x00A0,0x03CB,
- 0xFF9F,0x009C,0x03CB,0xFF9E,0x0098,0x03CA,0xFF9E,0x0094,0x03CA,0xFF9E,0x0091,0x03CA,
- 0xFF9E,0x008D,0x03CA,0xFF9D,0x0089,0x03C9,0xFF9D,0x0086,0x03C9,0xFF9D,0x0082,0x03C9,
- 0xFF9D,0x007F,0x03C9,0xFF9C,0x007B,0x03C8,0xFF9C,0x0078,0x03C8,0xFF9C,0x0074,0x03C8,
- 0xFF9C,0x0071,0x03C7,0xFF9B,0x006D,0x03C7,0xFF9B,0x006A,0x03C7,0xFF9B,0x0067,0x03C7,
- 0xFF9A,0x0064,0x03C6,0xFF9A,0x0060,0x03C6,0xFF9A,0x005D,0x03C6,0xFF9A,0x005A,0x03C5,
- 0xFF99,0x0057,0x03C5,0xFF99,0x0054,0x03C5,0xFF99,0x0051,0x03C5,0xFF98,0x004E,0x03C4,
- 0xFF98,0x004B,0x03C4,0xFF98,0x0048,0x03C4,0xFF98,0x0045,0x03C3,0xFF97,0x0042,0x03C3,
- 0xFF97,0x003F,0x03C3,0xFF97,0x003C,0x03C3,0xFF96,0x003A,0x03C2,0xFF96,0x0037,0x03C2,
- 0xFF96,0x0034,0x03C2,0xFF95,0x0032,0x03C1,0xFF95,0x002F,0x03C1,0xFF95,0x002D,0x03C1,
- 0xFF95,0x002A,0x03C1,0xFF94,0x0028,0x03C0,0xFF94,0x0026,0x03C0,0xFF94,0x0023,0x03C0,
- 0xFF93,0x0021,0x03BF,0xFF93,0x001F,0x03BF,0xFF93,0x001D,0x03BF,0xFF92,0x001A,0x03BE,
- 0xFF92,0x0018,0x03BE,0xFF92,0x0016,0x03BE,0xFF91,0x0014,0x03BD,0xFF91,0x0013,0x03BD,
- 0xFF91,0x0011,0x03BD,0xFF90,0x000F,0x03BC,0xFF90,0x000D,0x03BC,0xFF90,0x000C,0x03BC,
- 0xFF8F,0x000A,0x03BC,0xFF8F,0x0009,0x03BB,0xFF8E,0x0007,0x03BB,0xFF8E,0x0006,0x03BB,
- 0xFF8E,0x0005,0x03BA,0xFF8D,0x0004,0x03BA,0xFF8D,0x0003,0x03BA,0xFF8D,0x0002,0x03B9,
- 0xFF8C,0x0001,0x03B9,0xFF8C,0x0000,0x03B9,0xFF8C,0x0000,0x03B8,0xFF8B,0xFFFD,0x03B8,
- 0xFF8B,0xFFFB,0x03B8,0xFF8A,0xFFF8,0x03B7,0xFF8A,0xFFF5,0x03B7,0xFF8A,0xFFF2,0x03B7,
- 0xFF89,0xFFF0,0x03B6,0xFF89,0xFFED,0x03B6,0xFF88,0xFFEA,0x03B6,0xFF88,0xFFE7,0x03B5,
- 0xFF88,0xFFE5,0x03B5,0xFF87,0xFFE2,0x03B5,0xFF87,0xFFDF,0x03B4,0xFF86,0xFFDC,0x03B4,
- 0xFF86,0xFFDA,0x03B4,0xFF88,0xFFD7,0x03B3,0xFF8B,0xFFD4,0x03B3,0xFF8D,0xFFD1,0x03B3,
- 0xFF8F,0xFFCF,0x03B2,0xFF92,0xFFCC,0x03B2,0xFF94,0xFFC9,0x03B2,0xFF96,0xFFC6,0x03B1,
- 0xFF99,0xFFC4,0x03B1,0xFF9B,0xFFC1,0x03B0,0xFF9D,0xFFBE,0x03B0,0xFFA0,0xFFBC,0x03B0,
- 0xFFA2,0xFFB9,0x03AF,0xFFA5,0xFFB6,0x03AF,0xFFA7,0xFFB3,0x03AF,0xFFA9,0xFFB1,0x03AE,
- 0xFFAC,0xFFAE,0x03AE,0xFFAE,0xFFAB,0x03AE,0xFFB0,0xFFA8,0x03AE,0xFFB3,0xFFA6,0x03AE,
- 0xFFB5,0xFFA3,0x03AE,0xFFB7,0xFFA0,0x03AE,0xFFBA,0xFF9D,0x03AE,0xFFBC,0xFF9B,0x03AE,
- 0xFFBE,0xFF98,0x03AE,0xFFC1,0xFF95,0x03AE,0xFFC3,0xFF92,0x03AE,0xFFC5,0xFF90,0x03AE,
- 0xFFC8,0xFF8D,0x03AE,0xFFCA,0xFF8A,0x03AE,0xFFCC,0xFF87,0x03AE,0xFFCF,0xFF85,0x03AE,
- 0xFFD1,0xFF82,0x03AE,0xFFD3,0xFF82,0x03AE,0xFFD6,0xFF81,0x03AE,0xFFD8,0xFF81,0x03AD,
- 0xFFDA,0xFF80,0x03AD,0xFFDD,0xFF80,0x03AD,0xFFDF,0xFF7F,0x03AD,0xFFE2,0xFF7F,0x03AD,
- 0xFFE4,0xFF7E,0x03AD,0xFFE6,0xFF7E,0x03AD,0xFFE9,0xFF7E,0x03AD,0xFFEB,0xFF7D,0x03AD,
- 0xFFED,0xFF7D,0x03AD,0xFFF0,0xFF7C,0x03AD,0xFFF2,0xFF7C,0x03AD,0xFFF4,0xFF7B,0x03AD,
- 0xFFF7,0xFF7B,0x03AD,0xFFF9,0xFF7B,0x03AD,0xFFFB,0xFF7A,0x03AD,0xFFFE,0xFF7A,0x03AD,
- 0x0000,0xFF79,0x03AD,0x0001,0xFF79,0x03AC,0x0001,0xFF78,0x03AC,0x0002,0xFF78,0x03AC,
- 0x0002,0xFF78,0x03AC,0x0003,0xFF77,0x03AC,0x0004,0xFF77,0x03AC,0x0005,0xFF76,0x03AC,
- 0x0006,0xFF76,0x03AC,0x0007,0xFF76,0x03AC,0x0008,0xFF75,0x03AC,0x0009,0xFF75,0x03AC,
- 0x000A,0xFF74,0x03AC,0x000C,0xFF74,0x03AC,0x000D,0xFF74,0x03AC,0x000E,0xFF73,0x03AB,
- 0x000F,0xFF73,0x03AB,0x0011,0xFF72,0x03AB,0x0012,0xFF72,0x03AB,0x0014,0xFF72,0x03AB,
- 0x0015,0xFF71,0x03AB,0x0017,0xFF71,0x03AB,0x0018,0xFF71,0x03AB,0x001A,0xFF70,0x03AB,
- 0x001B,0xFF70,0x03AB,0x001D,0xFF6F,0x03AB,0x001F,0xFF6F,0x03AA,0x0021,0xFF6F,0x03AA,
- 0x0022,0xFF6E,0x03AA,0x0024,0xFF6E,0x03AA,0x0026,0xFF6E,0x03AA,0x0028,0xFF6D,0x03AA,
- 0x002A,0xFF6D,0x03AA,0x002C,0xFF6C,0x03AA,0x002E,0xFF6C,0x03AA,0x0030,0xFF6C,0x03AA,
- 0x0031,0xFF6B,0x03AA,0x0034,0xFF6B,0x03A9,0x0036,0xFF6B,0x03A9,0x0038,0xFF6A,0x03A9,
- 0x003A,0xFF6A,0x03A9,0x003C,0xFF6A,0x03A9,0x003E,0xFF69,0x03A9,0x0040,0xFF69,0x03A9,
- 0x0042,0xFF69,0x03A9,0x0045,0xFF68,0x03A9,0x0047,0xFF68,0x03A8,0x0049,0xFF68,0x03A8,
- 0x004B,0xFF67,0x03A8,0x004E,0xFF67,0x03A8,0x0050,0xFF67,0x03A8,0x0052,0xFF66,0x03A8,
- 0x0055,0xFF66,0x03A8,0x0057,0xFF66,0x03A8,0x005A,0xFF65,0x03A8,0x005C,0xFF65,0x03A8,
- 0x005F,0xFF65,0x03A7,0x0061,0xFF64,0x03A7,0x0064,0xFF64,0x03A7,0x0066,0xFF64,0x03A7,
- 0x0069,0xFF63,0x03A7,0x006B,0xFF63,0x03A7,0x006E,0xFF63,0x03A7,0x0071,0xFF62,0x03A7,
- 0x0073,0xFF62,0x03A6,0x0076,0xFF62,0x03A6,0x0079,0xFF62,0x03A6,0x007B,0xFF61,0x03A6,
- 0x007E,0xFF61,0x03A6,0x0081,0xFF61,0x03A6,0x0084,0xFF60,0x03A6,0x0086,0xFF60,0x03A6,
- 0x0089,0xFF60,0x03A5,0x008C,0xFF5F,0x03A5,0x008F,0xFF5F,0x03A5,0x0092,0xFF5F,0x03A5,
- 0x0095,0xFF5F,0x03A5,0x0097,0xFF5E,0x03A5,0x009A,0xFF5E,0x03A5,0x009D,0xFF5E,0x03A5,
- 0x00A0,0xFF5D,0x03A4,0x00A3,0xFF5D,0x03A4,0x00A6,0xFF5D,0x03A4,0x00A9,0xFF5D,0x03A4,
- 0x00AC,0xFF5C,0x03A4,0x00AF,0xFF5C,0x03A4,0x00B2,0xFF5C,0x03A4,0x00B6,0xFF5C,0x03A3,
- 0x00B9,0xFF5B,0x03A3,0x00BC,0xFF5B,0x03A3,0x00BF,0xFF5B,0x03A3,0x00C2,0xFF5B,0x03A3,
- 0x00C5,0xFF5A,0x03A3,0x00C8,0xFF5A,0x03A3,0x00CC,0xFF5A,0x03A3,0x00CF,0xFF5A,0x03A2,
- 0x00D2,0xFF59,0x03A2,0x00D5,0xFF59,0x03A2,0x00D9,0xFF59,0x03A2,0x00DC,0xFF59,0x03A2,
- 0x00DF,0xFF58,0x03A2,0x00E3,0xFF58,0x03A1,0x00E6,0xFF58,0x03A1,0x00E9,0xFF58,0x03A1,
- 0x00ED,0xFF57,0x03A1,0x00F0,0xFF57,0x03A1,0x00F0,0xFF57,0x03A1,0x00F2,0xFF57,0x03A1,
- 0x00F3,0xFF56,0x03A0,0x00F5,0xFF56,0x03A0,0x00F6,0xFF56,0x03A0,0x00F8,0xFF56,0x03A0,
- 0x00F9,0xFF56,0x03A0,0x00FB,0xFF55,0x03A0,0x00FC,0xFF55,0x03A0,0x00FE,0xFF55,0x039F,
- 0x00FF,0xFF55,0x039F,0x0101,0xFF54,0x039F,0x0102,0xFF54,0x039F,0x0104,0xFF54,0x039F,
- 0x0105,0xFF54,0x039F,0x0106,0xFF54,0x039E,0x0108,0xFF53,0x039E,0x0109,0xFF53,0x039E,
- 0x010B,0xFF53,0x039E,0x010C,0xFF53,0x039E,0x010D,0xFF53,0x039E,0x010F,0xFF52,0x039D,
- 0x0110,0xFF52,0x039D,0x0112,0xFF52,0x039D,0x0113,0xFF52,0x039D,0x0114,0xFF52,0x039D,
- 0x0116,0xFF51,0x039D,0x0117,0xFF51,0x039D,0x0118,0xFF51,0x039C,0x011A,0xFF51,0x039C,
- 0x011B,0xFF51,0x039C,0x011C,0xFF51,0x039C,0x011D,0xFF50,0x039C,0x011F,0xFF50,0x039C,
- 0x0120,0xFF50,0x039B,0x0121,0xFF50,0x039B,0x0123,0xFF50,0x039B,0x0124,0xFF50,0x039B,
- 0x0125,0xFF4F,0x039B,0x0126,0xFF4F,0x039A,0x0127,0xFF4F,0x039A,0x0129,0xFF4F,0x039A,
- 0x012A,0xFF4F,0x039A,0x012B,0xFF4F,0x039A,0x012C,0xFF4E,0x039A,0x012D,0xFF4E,0x0399,
- 0x012E,0xFF4E,0x0399,0x0130,0xFF4E,0x0399,0x0131,0xFF4E,0x0399,0x0132,0xFF4E,0x0399,
- 0x0133,0xFF4E,0x0399,0x0134,0xFF4D,0x0398,0x0135,0xFF4D,0x0398,0x0136,0xFF4D,0x0398,
- 0x0137,0xFF4D,0x0398,0x0138,0xFF4D,0x0398,0x0139,0xFF4D,0x0397,0x013A,0xFF4D,0x0397,
- 0x013B,0xFF4D,0x0397,0x013C,0xFF4C,0x0397,0x013D,0xFF4C,0x0397,0x013E,0xFF4C,0x0397,
- 0x013F,0xFF4C,0x0396,0x0140,0xFF4C,0x0396,0x0141,0xFF4C,0x0396,0x0142,0xFF4C,0x0396,
- 0x0143,0xFF4C,0x0396,0x0144,0xFF4C,0x0395,0x0145,0xFF4B,0x0395,0x0146,0xFF4B,0x0395,
- 0x0147,0xFF4B,0x0395,0x0148,0xFF4B,0x0395,0x0149,0xFF4B,0x0394,0x0149,0xFF4B,0x0394,
- 0x014A,0xFF4B,0x0394,0x014B,0xFF4B,0x0394,0x014C,0xFF4B,0x0394,0x014D,0xFF4B,0x0394,
- 0x014D,0xFF4B,0x0393,0x014E,0xFF4A,0x0393,0x014F,0xFF4A,0x0393,0x0150,0xFF4A,0x0393,
- 0x0150,0xFF4A,0x0393,0x0151,0xFF4A,0x0392,0x0152,0xFF4A,0x0392,0x0153,0xFF4A,0x0392,
- 0x0153,0xFF4A,0x0392,0x0154,0xFF4A,0x0392,0x0155,0xFF4A,0x0391,0x0155,0xFF4A,0x0391,
- 0x0156,0xFF4A,0x0391,0x0156,0xFF4A,0x0391,0x0157,0xFF4A,0x0391,0x0158,0xFF4A,0x0390,
- 0x0158,0xFF4A,0x0390,0x0159,0xFF49,0x0390,0x0159,0xFF49,0x0390,0x015A,0xFF49,0x0390,
- 0x015A,0xFF49,0x038F,0x015B,0xFF49,0x038F,0x015B,0xFF49,0x038F,0x015C,0xFF49,0x038F,
- 0x015C,0xFF49,0x038F,0x015C,0xFF49,0x038E,0x015D,0xFF49,0x038E,0x015D,0xFF49,0x038E,
- 0x015D,0xFF49,0x038E,0x015E,0xFF49,0x038D,0x015E,0xFF49,0x038D,0x015E,0xFF49,0x038D,
- 0x015E,0xFF49,0x038D,0x015F,0xFF49,0x038D,0x015F,0xFF49,0x038C,0x015F,0xFF49,0x038C,
- 0x015F,0xFF49,0x038C,0x015F,0xFF49,0x038C,0x015F,0xFF48,0x038B,0x015F,0xFF48,0x038A,
- 0x015F,0xFF48,0x038A,0x015F,0xFF48,0x0389,0x015F,0xFF47,0x0387,0x015F,0xFF47,0x0386,
- 0x015F,0xFF47,0x0385,0x015F,0xFF47,0x0384,0x015F,0xFF46,0x0382,0x015F,0xFF46,0x0381,
- 0x015F,0xFF46,0x037F,0x015F,0xFF46,0x037E,0x015F,0xFF45,0x037C,0x015F,0xFF45,0x037A,
- 0x015F,0xFF45,0x0378,0x015F,0xFF45,0x0377,0x015F,0xFF44,0x0375,0x015F,0xFF44,0x0373,
- 0x015F,0xFF44,0x0371,0x015F,0xFF44,0x036F,0x015F,0xFF43,0x036C,0x015F,0xFF43,0x036A,
- 0x015F,0xFF43,0x0368,0x015F,0xFF43,0x0366,0x015F,0xFF42,0x0363,0x015F,0xFF42,0x0361,
- 0x015F,0xFF42,0x035F,0x015F,0xFF42,0x035C,0x015F,0xFF41,0x035A,0x015F,0xFF41,0x0357,
- 0x015F,0xFF41,0x0355,0x015F,0xFF41,0x0352,0x015F,0xFF41,0x034F,0x015F,0xFF40,0x034D,
- 0x015F,0xFF40,0x034A,0x015F,0xFF40,0x0347,0x015F,0xFF40,0x0344,0x015F,0xFF3F,0x0341,
- 0x015F,0xFF3F,0x033E,0x015F,0xFF3F,0x033C,0x015F,0xFF3F,0x0339,0x015F,0xFF3F,0x0336,
- 0x015F,0xFF3E,0x0333,0x015F,0xFF3E,0x032F,0x015F,0xFF3E,0x032C,0x015F,0xFF3E,0x0329,
- 0x015E,0xFF3D,0x0326,0x015E,0xFF3D,0x0323,0x015E,0xFF3D,0x0320,0x015E,0xFF3D,0x031C,
- 0x015E,0xFF3D,0x0319,0x015E,0xFF3C,0x0316,0x015E,0xFF3C,0x0312,0x015E,0xFF3C,0x030F,
- 0x015E,0xFF3C,0x030C,0x015E,0xFF3C,0x0308,0x015E,0xFF3B,0x0305,0x015E,0xFF3B,0x0301,
- 0x015E,0xFF3B,0x02FE,0x015E,0xFF3B,0x02FA,0x015E,0xFF3A,0x02F6,0x015E,0xFF3A,0x02F3,
- 0x015E,0xFF3A,0x02EF,0x015E,0xFF3A,0x02EB,0x015E,0xFF3A,0x02E8,0x015E,0xFF39,0x02E4,
- 0x015E,0xFF39,0x02E0,0x015E,0xFF39,0x02DC,0x015E,0xFF39,0x02D9,0x015E,0xFF39,0x02D5,
- 0x015E,0xFF39,0x02D1,0x015E,0xFF38,0x02CD,0x015E,0xFF38,0x02C9,0x015D,0xFF38,0x02C5,
- 0x015D,0xFF38,0x02C1,0x015D,0xFF38,0x02BD,0x015D,0xFF37,0x02B9,0x015D,0xFF37,0x02B5,
- 0x015D,0xFF37,0x02B1,0x015D,0xFF37,0x02AD,0x015D,0xFF37,0x02A8,0x015D,0xFF36,0x02A4,
- 0x015D,0xFF36,0x02A0,0x015D,0xFF36,0x029C,0x015D,0xFF36,0x0298,0x015D,0xFF36,0x0293,
- 0x015D,0xFF36,0x028F,0x015D,0xFF35,0x028B,0x015D,0xFF35,0x0286,0x015D,0xFF35,0x0282,
- 0x015D,0xFF35,0x027E,0x015C,0xFF35,0x0279,0x015C,0xFF35,0x0275,0x015C,0xFF34,0x0270,
- 0x015C,0xFF34,0x026C,0x015C,0xFF34,0x0267,0x015C,0xFF34,0x0263,0x015C,0xFF34,0x025E,
- 0x015C,0xFF34,0x025A,0x015C,0xFF33,0x0255,0x015C,0xFF33,0x0250,0x015C,0xFF33,0x024C,
- 0x015C,0xFF33,0x0247,0x015C,0xFF33,0x0242,0x015C,0xFF33,0x023E,0x015B,0xFF32,0x0239,
- 0x015B,0xFF32,0x0234,0x015B,0xFF32,0x022F,0x015B,0xFF32,0x022A,0x015B,0xFF32,0x0226,
- 0x015B,0xFF32,0x0221,0x015B,0xFF32,0x021C,0x015B,0xFF31,0x0217,0x015B,0xFF31,0x0212,
- 0x015B,0xFF31,0x020D,0x015B,0xFF31,0x0208,0x015A,0xFF31,0x0203,0x015A,0xFF31,0x01FE,
- 0x015A,0xFF31,0x01F9,0x015A,0xFF30,0x01F4,0x015A,0xFF30,0x01EF,0x015A,0xFF30,0x01EA,
- 0x015A,0xFF30,0x01E5,0x015A,0xFF30,0x01E0,0x015A,0xFF30,0x01DB,0x015A,0xFF30,0x01D5,
- 0x015A,0xFF2F,0x01D0,0x0159,0xFF2F,0x01CB,0x0159,0xFF2F,0x01C6,0x0159,0xFF2F,0x01C1,
- 0x0159,0xFF2F,0x01BB,0x0159,0xFF2F,0x01B6,0x0159,0xFF2F,0x01B1,0x0159,0xFF2F,0x01AB,
- 0x0159,0xFF2E,0x01A6,0x0159,0xFF2E,0x01A1,0x0158,0xFF2E,0x019C,0x0158,0xFF2E,0x0197,
- 0x0158,0xFF2E,0x0193,0x0158,0xFF2E,0x018E,0x0158,0xFF2E,0x0189,0x0158,0xFF2E,0x0184,
- 0x0158,0xFF2E,0x017F,0x0158,0xFF2D,0x017A,0x0157,0xFF2D,0x0176,0x0157,0xFF2D,0x0171,
- 0x0157,0xFF2D,0x016C,0x0157,0xFF2D,0x0167,0x0157,0xFF2D,0x0163,0x0157,0xFF2D,0x015E,
- 0x0157,0xFF2D,0x0159,0x0157,0xFF2D,0x0155,0x0156,0xFF2C,0x0150,0x0156,0xFF2C,0x014B,
- 0x0156,0xFF2C,0x0147,0x0156,0xFF2C,0x0142,0x0156,0xFF2C,0x013E,0x0156,0xFF2C,0x0139,
- 0x0156,0xFF2C,0x0134,0x0155,0xFF2C,0x0130,0x0155,0xFF2C,0x012B,0x0155,0xFF2C,0x0127,
- 0x0155,0xFF2B,0x0122,0x0155,0xFF2B,0x011E,0x0155,0xFF2B,0x0119,0x0155,0xFF2B,0x0115,
- 0x0154,0xFF2B,0x0110,0x0154,0xFF2B,0x010C,0x0154,0xFF2B,0x0108,0x0154,0xFF2B,0x0103,
- 0x0154,0xFF2B,0x00FF,0x0154,0xFF2B,0x00FB,0x0154,0xFF2B,0x00F6,0x0153,0xFF2B,0x00F2,
- 0x0153,0xFF2A,0x00EE,0x0153,0xFF2A,0x00E9,0x0153,0xFF2A,0x00E5,0x0153,0xFF2A,0x00E1,
- 0x0153,0xFF2A,0x00DD,0x0152,0xFF2A,0x00D8,0x0152,0xFF2A,0x00D4,0x0152,0xFF2A,0x00D0,
- 0x0152,0xFF2A,0x00CC,0x0152,0xFF2A,0x00C8,0x0152,0xFF2A,0x00C4,0x0151,0xFF2A,0x00C0,
- 0x0151,0xFF2A,0x00BB,0x0151,0xFF2A,0x00B7,0x0151,0xFF29,0x00B3,0x0151,0xFF29,0x00AF,
- 0x0150,0xFF29,0x00AB,0x0150,0xFF29,0x00A7,0x0150,0xFF29,0x00A3,0x0150,0xFF29,0x00A0,
- 0x0150,0xFF29,0x009C,0x0150,0xFF29,0x0098,0x014F,0xFF29,0x0094,0x014F,0xFF29,0x0090,
- 0x014F,0xFF29,0x008C,0x014F,0xFF29,0x0088,0x014F,0xFF29,0x0085,0x014E,0xFF29,0x0081,
- 0x014E,0xFF29,0x007D,0x014E,0xFF29,0x007A,0x014E,0xFF29,0x0076,0x014E,0xFF29,0x0072,
- 0x014D,0xFF29,0x006F,0x014D,0xFF29,0x006B,0x014D,0xFF28,0x0068,0x014D,0xFF28,0x0064,
- 0x014D,0xFF28,0x0060,0x014C,0xFF28,0x005D,0x014C,0xFF28,0x005A,0x014C,0xFF28,0x0056,
- 0x014C,0xFF28,0x0053,0x014B,0xFF28,0x004F,0x014B,0xFF28,0x004C,0x014B,0xFF28,0x0049,
- 0x014B,0xFF28,0x0046,0x014B,0xFF28,0x0042,0x014A,0xFF28,0x003F,0x014A,0xFF28,0x003C,
- 0x014A,0xFF28,0x0039,0x014A,0xFF28,0x0036,0x0149,0xFF28,0x0033,0x0149,0xFF28,0x0030,
- 0x0149,0xFF28,0x002D,0x0149,0xFF28,0x002A,0x0149,0xFF28,0x0027,0x0148,0xFF28,0x0024,
- 0x0148,0xFF28,0x0022,0x0148,0xFF28,0x001F,0x0148,0xFF28,0x001C,0x0147,0xFF28,0x001A,
- 0x0147,0xFF28,0x0017,0x0147,0xFF2B,0x0015,0x0147,0xFF2E,0x0012,0x0146,0xFF31,0x0010,
- 0x0146,0xFF33,0x000E,0x0146,0xFF36,0x000B,0x0146,0xFF39,0x0009,0x0145,0xFF3C,0x0007,
- 0x0145,0xFF3F,0x0006,0x0145,0xFF42,0x0004,0x0145,0xFF44,0x0002,0x0144,0xFF47,0x0001,
- 0x0144,0xFF4A,0x0000,0x0144,0xFF4D,0xFFF7,0x0144,0xFF50,0xFFEE,0x0143,0xFF53,0xFFE5,
- 0x0143,0xFF55,0xFFDD,0x0143,0xFF58,0xFFD4,0x0143,0xFF5B,0xFFCC,0x0142,0xFF5E,0xFFC3,
- 0x0142,0xFF61,0xFFBB,0x0146,0xFF64,0xFFB3,0x0149,0xFF67,0xFFAB,0x014D,0xFF69,0xFFA2,
- 0x0151,0xFF6C,0xFF9B,0x0154,0xFF6F,0xFF93,0x0158,0xFF72,0xFF8B,0x015C,0xFF75,0xFF83,
- 0x015F,0xFF78,0xFF7C,0x0163,0xFF7A,0xFF75,0x0166,0xFF7D,0xFF6D,0x016A,0xFF80,0xFF66,
- 0x016E,0xFF83,0xFF5F,0x0171,0xFF86,0xFF58,0x0175,0xFF89,0xFF52,0x0178,0xFF8B,0xFF4B,
- 0x017C,0xFF8E,0xFF44,0x0180,0xFF91,0xFF3E,0x0183,0xFF94,0xFF38,0x0187,0xFF97,0xFF32,
- 0x018A,0xFF9A,0xFF2C,0x018E,0xFF9D,0xFF26,0x0191,0xFF9F,0xFF21,0x0195,0xFFA2,0xFF1B,
- 0x0199,0xFFA5,0xFF16,0x019C,0xFFA8,0xFF11,0x01A0,0xFFAB,0xFF0C,0x01A3,0xFFAE,0xFF08,
- 0x01A7,0xFFB0,0xFF04,0x01AA,0xFFB3,0xFF00,0x01AE,0xFFB6,0xFEFC,0x01B1,0xFFB9,0xFEF9,
- 0x01B5,0xFFBC,0xFEF6,0x01B8,0xFFBF,0xFEF3,0x01BC,0xFFC1,0xFEF2,0x01BF,0xFFC4,0xFEF2,
- 0x01C2,0xFFC7,0xFEF1,0x01C6,0xFFCA,0xFEF1,0x01C9,0xFFCD,0xFEF0,0x01CD,0xFFD0,0xFEF0,
- 0x01D0,0xFFD3,0xFEEF,0x01D4,0xFFD5,0xFEEF,0x01D7,0xFFD8,0xFEEE,0x01DB,0xFFDB,0xFEEE,
- 0x01DE,0xFFDE,0xFEED,0x01E1,0xFFE1,0xFEED,0x01E5,0xFFE4,0xFEEC,0x01E8,0xFFE6,0xFEEC,
- 0x01EC,0xFFE9,0xFEEB,0x01EF,0xFFEC,0xFEEB,0x01F2,0xFFEF,0xFEEA,0x01F6,0xFFF2,0xFEEA,
- 0x01F9,0xFFF5,0xFEEA,0x01FC,0xFFF7,0xFEE9,0x0200,0xFFFA,0xFEE9,0x0203,0xFFFD,0xFEE8,
- 0x0206,0x0000,0xFEE8,0x020A,0x0000,0xFEE7,0x020D,0x0000,0xFEE7,0x0210,0x0001,0xFEE6,
- 0x0214,0x0001,0xFEE6,0x0217,0x0002,0xFEE6,0x021A,0x0002,0xFEE5,0x021E,0x0003,0xFEE5,
- 0x0221,0x0004,0xFEE4,0x0224,0x0004,0xFEE4,0x0227,0x0005,0xFEE4,0x022B,0x0006,0xFEE3,
- 0x022E,0x0007,0xFEE3,0x0231,0x0008,0xFEE2,0x0234,0x0009,0xFEE2,0x0238,0x000A,0xFEE1,
- 0x023B,0x000B,0xFEE1,0x023E,0x000C,0xFEE1,0x0241,0x000D,0xFEE0,0x0244,0x000E,0xFEE0,
- 0x0248,0x000F,0xFEE0,0x024B,0x0010,0xFEDF,0x024E,0x0011,0xFEDF,0x0251,0x0012,0xFEDE,
- 0x0254,0x0013,0xFEDE,0x0257,0x0015,0xFEDE,0x025B,0x0016,0xFEDD,0x025E,0x0017,0xFEDD,
- 0x0261,0x0018,0xFEDD,0x0264,0x001A,0xFEDC,0x0267,0x001B,0xFEDC,0x026A,0x001C,0xFEDB,
- 0x026D,0x001E,0xFEDB,0x0270,0x001F,0xFEDB,0x0274,0x0021,0xFEDA,0x0277,0x0022,0xFEDA,
- 0x027A,0x0024,0xFEDA,0x027D,0x0025,0xFED9,0x0280,0x0027,0xFED9,0x0283,0x0028,0xFED9,
- 0x0286,0x002A,0xFED8,0x0289,0x002B,0xFED8,0x028C,0x002D,0xFED8,0x028F,0x002E,0xFED7,
- 0x0292,0x0030,0xFED7,0x0295,0x0032,0xFED7,0x0298,0x0033,0xFED6,0x029B,0x0035,0xFED6,
- 0x029E,0x0037,0xFED6,0x02A1,0x0039,0xFED5,0x02A4,0x003A,0xFED5,0x02A7,0x003C,0xFED5,
- 0x02AA,0x003E,0xFED4,0x02AD,0x0040,0xFED4,0x02B0,0x0041,0xFED4,0x02B3,0x0043,0xFED4,
- 0x02B6,0x0045,0xFED3,0x02B9,0x0047,0xFED3,0x02BC,0x0049,0xFED3,0x02BE,0x004B,0xFED2,
- 0x02C1,0x004D,0xFED2,0x02C4,0x004E,0xFED2,0x02C7,0x0050,0xFED2,0x02CA,0x0052,0xFED1,
- 0x02CD,0x0054,0xFED1,0x02D0,0x0056,0xFED1,0x02D2,0x0058,0xFED0,0x02D5,0x005A,0xFED0,
- 0x02D8,0x005C,0xFED0,0x02DB,0x005E,0xFED0,0x02DE,0x0060,0xFECF,0x02E1,0x0063,0xFECF,
- 0x02E3,0x0065,0xFECF,0x02E6,0x0067,0xFECF,0x02E9,0x0069,0xFECE,0x02EC,0x006B,0xFECE,
- 0x02EE,0x006D,0xFECE,0x02F1,0x006F,0xFECE,0x02F4,0x0071,0xFECD,0x02F7,0x0074,0xFECD,
- 0x02F9,0x0076,0xFECD,0x02FC,0x0078,0xFECD,0x02FF,0x007A,0xFECC,0x0301,0x007D,0xFECC,
- 0x0304,0x007F,0xFECC,0x0307,0x0081,0xFECC,0x0309,0x0083,0xFECC,0x030C,0x0086,0xFECB,
- 0x030F,0x0088,0xFECB,0x0311,0x008A,0xFECB,0x0314,0x008D,0xFECB,0x0317,0x008F,0xFECA,
- 0x0319,0x0091,0xFECA,0x031C,0x0094,0xFECA,0x031E,0x0096,0xFECA,0x0321,0x0099,0xFECA,
- 0x0324,0x009B,0xFEC9,0x0326,0x009D,0xFEC9,0x0329,0x00A0,0xFEC9,0x032B,0x00A2,0xFEC9,
- 0x032E,0x00A5,0xFEC9,0x0330,0x00A7,0xFEC8,0x0333,0x00AA,0xFEC8,0x0335,0x00AC,0xFEC8,
- 0x0338,0x00AF,0xFEC8,0x033A,0x00B1,0xFEC8,0x033D,0x00B4,0xFEC8,0x033F,0x00B6,0xFEC7,
- 0x0342,0x00B9,0xFEC7,0x0344,0x00BB,0xFEC7,0x0346,0x00BE,0xFEC7,0x0349,0x00C1,0xFEC7,
- 0x034B,0x00C3,0xFEC7,0x034E,0x00C6,0xFEC6,0x0350,0x00C9,0xFEC6,0x0352,0x00CB,0xFEC6,
- 0x0355,0x00CE,0xFEC6,0x0357,0x00D1,0xFEC6,0x0359,0x00D3,0xFEC6,0x035C,0x00D6,0xFEC5,
- 0x035E,0x00D9,0xFEC5,0x0360,0x00DB,0xFEC5,0x0363,0x00DE,0xFEC5,0x0365,0x00E1,0xFEC5,
- 0x0367,0x00E3,0xFEC5,0x036A,0x00E6,0xFEC5,0x036C,0x00E9,0xFEC4,0x036E,0x00EC,0xFEC4,
- 0x0370,0x00EF,0xFEC4,0x0372,0x00F1,0xFEC4,0x0375,0x00F4,0xFEC4,0x0377,0x00F7,0xFEC4,
- 0x0379,0x00FA,0xFEC4,0x037B,0x00FD,0xFEC4,0x037D,0x0100,0xFEC3,0x037F,0x0102,0xFEC3,
- 0x0382,0x0105,0xFEC3,0x0384,0x0108,0xFEC3,0x0386,0x010B,0xFEC3,0x0388,0x010E,0xFEC3,
- 0x038A,0x0111,0xFEC3,0x038C,0x0114,0xFEC3,0x038E,0x0117,0xFEC3,0x0390,0x011A,0xFEC3,
- 0x0392,0x011D,0xFEC2,0x0394,0x0120,0xFEC2,0x0396,0x0123,0xFEC2,0x0398,0x0126,0xFEC2,
- 0x039A,0x0129,0xFEC2,0x039C,0x012C,0xFEC2,0x039E,0x012F,0xFEC2,0x03A0,0x0132,0xFEC2,
- 0x03A1,0x0135,0xFEC2,0x03A3,0x0138,0xFEC2,0x03A5,0x013B,0xFEC2,0x03A7,0x013E,0xFEC1,
- 0x03A9,0x0141,0xFEC1,0x03AB,0x0144,0xFEC1,0x03AC,0x0147,0xFEC1,0x03AE,0x014A,0xFEC1,
- 0x03B0,0x014D,0xFEC1,0x03B2,0x0151,0xFEC1,0x03B3,0x0154,0xFEC1,0x03B5,0x0157,0xFEC1,
- 0x03B7,0x015A,0xFEC1,0x03B9,0x015D,0xFEC1,0x03BA,0x0160,0xFEC1,0x03BC,0x0164,0xFEC1,
- 0x03BD,0x0167,0xFEC1,0x03BF,0x016A,0xFEC1,0x03C1,0x016D,0xFEC1,0x03C2,0x0170,0xFEC1,
- 0x03C4,0x0174,0xFEC1,0x03C5,0x0177,0xFEC0,0x03C7,0x017A,0xFEC0,0x03C8,0x017D,0xFEC0,
- 0x03CA,0x0181,0xFEC0,0x03CB,0x0184,0xFEC0,0x03CC,0x0187,0xFEC0,0x03CE,0x018B,0xFEC0,
- 0x03CF,0x018E,0xFEC0,0x03D0,0x0191,0xFEC0,0x03D2,0x0195,0xFEC0,0x03D3,0x0198,0xFEC0,
- 0x03D4,0x019B,0xFEC0,0x03D5,0x019F,0xFEC0,0x03D7,0x01A2,0xFEC0,0x03D8,0x01A5,0xFEC0,
- 0x03D9,0x01A9,0xFEC0,0x03DA,0x01AC,0xFEC0,0x03DB,0x01AF,0xFEC0,0x03DC,0x01B3,0xFEC0,
- 0x03DD,0x01B6,0xFEC0,0x03DE,0x01BA,0xFEC0,0x03DE,0x01BD,0xFEC0,0x03DF,0x01C1,0xFEC0,
- 0x03E0,0x01C4,0xFEC0,0x03E1,0x01C8,0xFEC0,0x03E1,0x01CB,0xFEC0,0x03E2,0x01CF,0xFEC0,
- 0x03E2,0x01D2,0xFEC0,0x03E1,0x01D3,0xFEC0,0x03DF,0x01D5,0xFEC0,0x03DD,0x01D6,0xFEC0,
- 0x03DB,0x01D8,0xFEC0,0x03D9,0x01D9,0xFEC0,0x03D6,0x01DB,0xFEC0,0x03D4,0x01DC,0xFEC0,
- 0x03D1,0x01DD,0xFEC0,0x03CE,0x01DF,0xFEC0,0x03CB,0x01E0,0xFEC0,0x03C8,0x01E2,0xFEC0,
- 0x03C5,0x01E3,0xFEC0,0x03C2,0x01E4,0xFEC0,0x03BF,0x01E6,0xFEC0,0x03BC,0x01E7,0xFEC0,
- 0x03B8,0x01E9,0xFEC0,0x03B5,0x01EA,0xFEC0,0x03B1,0x01EB,0xFEC0,0x03AE,0x01ED,0xFEC0,
- 0x03AA,0x01EE,0xFEC0,0x03A7,0x01EF,0xFEC1,0x03A3,0x01F1,0xFEC1,0x039F,0x01F2,0xFEC1,
- 0x039B,0x01F4,0xFEC1,0x0398,0x01F5,0xFEC1,0x0394,0x01F6,0xFEC1,0x0390,0x01F8,0xFEC1,
- 0x038C,0x01F9,0xFEC1,0x0388,0x01FA,0xFEC1,0x0384,0x01FC,0xFEC1,0x0380,0x01FD,0xFEC1,
- 0x037B,0x01FE,0xFEC1,0x0377,0x0200,0xFEC2,0x0373,0x0201,0xFEC2,0x036F,0x0202,0xFEC2,
- 0x036B,0x0204,0xFEC2,0x0366,0x0205,0xFEC2,0x0362,0x0206,0xFEC2,0x035D,0x0207,0xFEC2,
- 0x0359,0x0209,0xFEC2,0x0354,0x020A,0xFEC3,0x0350,0x020B,0xFEC3,0x034B,0x020D,0xFEC3,
- 0x0347,0x020E,0xFEC3,0x0342,0x020F,0xFEC3,0x033E,0x0210,0xFEC3,0x0339,0x0212,0xFEC4,
- 0x0334,0x0213,0xFEC4,0x0330,0x0214,0xFEC4,0x032B,0x0216,0xFEC4,0x0326,0x0217,0xFEC4,
- 0x0321,0x0218,0xFEC4,0x031C,0x0219,0xFEC5,0x0318,0x021B,0xFEC5,0x0313,0x021C,0xFEC5,
- 0x030E,0x021D,0xFEC5,0x0309,0x021E,0xFEC6,0x0304,0x0220,0xFEC6,0x02FF,0x0221,0xFEC6,
- 0x02FA,0x0222,0xFEC6,0x02F5,0x0223,0xFEC6,0x02F0,0x0224,0xFEC7,0x02EB,0x0226,0xFEC7,
- 0x02E6,0x0227,0xFEC7,0x02E0,0x0228,0xFEC8,0x02DB,0x0229,0xFEC8,0x02D6,0x022A,0xFEC8,
- 0x02D1,0x022C,0xFEC8,0x02CC,0x022D,0xFEC9,0x02C6,0x022E,0xFEC9,0x02C1,0x022F,0xFEC9,
- 0x02BC,0x0230,0xFEC9,0x02B6,0x0232,0xFECA,0x02B1,0x0233,0xFECA,0x02AC,0x0234,0xFECA,
- 0x02A6,0x0235,0xFECB,0x02A1,0x0236,0xFECB,0x029C,0x0237,0xFECB,0x0296,0x0239,0xFECC,
- 0x0291,0x023A,0xFECC,0x028B,0x023B,0xFECC,0x0286,0x023C,0xFECD,0x0280,0x023D,0xFECD,
- 0x027A,0x023E,0xFECE,0x0275,0x023F,0xFECE,0x026F,0x0241,0xFECE,0x026A,0x0242,0xFECF,
- 0x0264,0x0243,0xFECF,0x025E,0x0244,0xFECF,0x0259,0x0245,0xFED0,0x0253,0x0246,0xFED0,
- 0x024D,0x0247,0xFED1,0x0248,0x0248,0xFED1,0x0242,0x0249,0xFED2,0x023C,0x024A,0xFED2,
- 0x0236,0x024C,0xFED2,0x0231,0x024D,0xFED3,0x022B,0x024E,0xFED3,0x0225,0x024F,0xFED4,
- 0x021F,0x0250,0xFED4,0x0219,0x0251,0xFED5,0x0213,0x0252,0xFED5,0x020D,0x0253,0xFED6,
- 0x0207,0x0254,0xFED6,0x0202,0x0255,0xFED7,0x01FC,0x0256,0xFED7,0x01F6,0x0257,0xFED8,
- 0x01F0,0x0258,0xFED8,0x01EA,0x0259,0xFED9,0x01E4,0x025A,0xFED9,0x01DE,0x025B,0xFEDA,
- 0x01D7,0x025C,0xFEDA,0x01D1,0x025D,0xFEDB,0x01CB,0x025E,0xFEDB,0x01C5,0x025F,0xFEDC,
- 0x01BF,0x0260,0xFEDC,0x01B9,0x0261,0xFEDD,0x01B3,0x0262,0xFEDE,0x01AD,0x0263,0xFEDE,
- 0x01A6,0x0264,0xFEDF,0x01A0,0x0265,0xFEDF,0x019A,0x0266,0xFEE0,0x0195,0x0267,0xFEE1,
- 0x0190,0x0268,0xFEE1,0x018B,0x0269,0xFEE2,0x0186,0x026A,0xFEE2,0x0181,0x026B,0xFEE3,
- 0x017C,0x026C,0xFEE4,0x0177,0x026D,0xFEE4,0x0172,0x026E,0xFEE5,0x016E,0x026F,0xFEE6,
- 0x0169,0x0270,0xFEE6,0x0164,0x0271,0xFEE7,0x015F,0x0272,0xFEE8,0x015A,0x0273,0xFEE8,
- 0x0156,0x0274,0xFEE9,0x0151,0x0274,0xFEEA,0x014C,0x0275,0xFEEA,0x0148,0x0276,0xFEEB,
- 0x0143,0x0277,0xFEEC,0x013E,0x0278,0xFEED,0x013A,0x0279,0xFEED,0x0135,0x027A,0xFEEE,
- 0x0131,0x027B,0xFEEF,0x012C,0x027C,0xFEEF,0x0128,0x027C,0xFEF0,0x0123,0x027D,0xFEF1,
- 0x011F,0x027E,0xFEF2,0x011A,0x027F,0xFEF3,0x0116,0x0280,0xFEF3,0x0112,0x0281,0xFEF4,
- 0x010D,0x0282,0xFEF5,0x0109,0x0282,0xFEF6,0x0105,0x0283,0xFEF7,0x0101,0x0284,0xFEF7,
- 0x00FC,0x0285,0xFEF8,0x00F8,0x0286,0xFEF9,0x00F4,0x0287,0xFEFA,0x00F0,0x0287,0xFEFB,
- 0x00EC,0x0288,0xFEFC,0x00E8,0x0289,0xFEFC,0x00E4,0x028A,0xFEFD,0x00E0,0x028A,0xFEFE,
- 0x00DC,0x028B,0xFEFF,0x00D8,0x028C,0xFF00,0x00D4,0x028D,0xFF01,0x00D0,0x028E,0xFF02,
- 0x00CC,0x028E,0xFF03,0x00C8,0x028F,0xFF04,0x00C4,0x0290,0xFF04,0x00C0,0x0291,0xFF05,
- 0x00BD,0x0291,0xFF06,0x00B9,0x0292,0xFF07,0x00B5,0x0293,0xFF08,0x00B1,0x0294,0xFF09,
- 0x00AE,0x0294,0xFF0A,0x00AA,0x0295,0xFF0B,0x00A6,0x0296,0xFF0C,0x00A3,0x0296,0xFF0D,
- 0x009F,0x0297,0xFF0E,0x009C,0x0298,0xFF0F,0x0098,0x0298,0xFF10,0x0095,0x0299,0xFF11,
- 0x0091,0x029A,0xFF12,0x008E,0x029A,0xFF13,0x008B,0x029B,0xFF14,0x0087,0x029C,0xFF15,
- 0x0084,0x029C,0xFF16,0x0081,0x029D,0xFF17,0x007D,0x029E,0xFF18,0x007A,0x029E,0xFF1A,
- 0x0077,0x029F,0xFF1B,0x0074,0x02A0,0xFF1C,0x0071,0x02A0,0xFF1D,0x006E,0x02A1,0xFF1E,
- 0x006B,0x02A1,0xFF1F,0x0068,0x02A2,0xFF20,0x0065,0x02A3,0xFF21,0x0062,0x02A3,0xFF22,
- 0x005F,0x02A4,0xFF24,0x005C,0x02A4,0xFF25,0x0059,0x02A5,0xFF26,0x0056,0x02A5,0xFF27,
- 0x0053,0x02A6,0xFF28,0x0051,0x02A7,0xFF29,0x004E,0x02A7,0xFF2B,0x004B,0x02A8,0xFF2C,
- 0x0048,0x02A8,0xFF2D,0x0046,0x02A9,0xFF2E,0x0043,0x02A9,0xFF2F,0x0041,0x02AA,0xFF31,
- 0x003E,0x02AA,0xFF32,0x003C,0x02AB,0xFF33,0x0039,0x02AB,0xFF34,0x0037,0x02AC,0xFF36,
- 0x0035,0x02AC,0xFF37,0x0032,0x02AD,0xFF38,0x0030,0x02AD,0xFF39,0x002E,0x02AE,0xFF3B,
- 0x002C,0x02AE,0xFF3C,0x0029,0x02AE,0xFF3D,0x0027,0x02AF,0xFF3F,0x0025,0x02AF,0xFF40,
- 0x0023,0x02B0,0xFF41,0x0021,0x02B0,0xFF42,0x001F,0x02B1,0xFF44,0x001D,0x02B1,0xFF45,
- 0x001B,0x02B1,0xFF47,0x001A,0x02B2,0xFF48,0x0018,0x02B2,0xFF49,0x0016,0x02B2,0xFF4B,
- 0x0015,0x02B3,0xFF4C,0x0013,0x02B3,0xFF4F,0x0011,0x02B3,0xFF52,0x0010,0x02B4,0xFF55,
- 0x000E,0x02B4,0xFF58,0x000D,0x02B4,0xFF5B,0x000C,0x02B5,0xFF5D,0x000A,0x02B5,0xFF60,
- 0x0009,0x02B5,0xFF63,0x0008,0x02B6,0xFF66,0x0007,0x02B6,0xFF69,0x0006,0x02B6,0xFF6C,
- 0x0005,0x02B6,0xFF6F,0x0004,0x02B7,0xFF72,0x0003,0x02B7,0xFF75,0x0002,0x02B7,0xFF78,
- 0x0002,0x02B7,0xFF7A,0x0001,0x02B7,0xFF7D,0x0001,0x02B7,0xFF80,0x0000,0x02B8,0xFF83,
- 0x0000,0x02B8,0xFF86,0xFFFD,0x02B8,0xFF89,0xFFFA,0x02B8,0xFF8C,0xFFF7,0x02B8,0xFF8F,
- 0xFFF4,0x02B8,0xFF92,0xFFF1,0x02BA,0xFF95,0xFFEE,0x02BC,0xFF97,0xFFEB,0x02BE,0xFF9A,
- 0xFFE9,0x02C0,0xFF9D,0xFFE6,0x02C1,0xFFA0,0xFFE3,0x02C3,0xFFA3,0xFFE0,0x02C5,0xFFA6,
- 0xFFDD,0x02C7,0xFFA9,0xFFDB,0x02C9,0xFFAC,0xFFD8,0x02CB,0xFFAF,0xFFD5,0x02CC,0xFFB2,
- 0xFFD3,0x02CE,0xFFB5,0xFFD0,0x02D0,0xFFB7,0xFFCE,0x02D2,0xFFBA,0xFFCB,0x02D4,0xFFBD,
- 0xFFC9,0x02D6,0xFFC0,0xFFC6,0x02D7,0xFFC3,0xFFC4,0x02D9,0xFFC6,0xFFC2,0x02DB,0xFFC9,
- 0xFFBF,0x02DD,0xFFCC,0xFFBD,0x02DF,0xFFCF,0xFFBB,0x02E0,0xFFD2,0xFFB9,0x02E2,0xFFD4,
- 0xFFB6,0x02E4,0xFFD7,0xFFB4,0x02E6,0xFFDA,0xFFB2,0x02E8,0xFFDD,0xFFB0,0x02E9,0xFFE0,
- 0xFFAE,0x02EB,0xFFE3,0xFFAD,0x02ED,0xFFE6,0xFFAB,0x02EF,0xFFE9,0xFFA9,0x02F0,0xFFEC,
- 0xFFA8,0x02F2,0xFFEF,0xFFA6,0x02F4,0xFFF1,0xFFA5,0x02F6,0xFFF4,0xFFA4,0x02F7,0xFFF7,
- 0xFFA3,0x02F9,0xFFFA,0xFFA3,0x02FB,0xFFFD,0xFFA3,0x02FC,0x0000,0xFFA3,0x02FE,0x0000,
- 0xFFA3,0x0300,0x0001,0xFFA3,0x0302,0x0002,0xFFA4,0x0303,0x0002,0xFFA4,0x0305,0x0003,
- 0xFFA4,0x0307,0x0005,0xFFA4,0x0308,0x0006,0xFFA4,0x030A,0x0007,0xFFA4,0x030C,0x0008,
- 0xFFA4,0x030D,0x000A,0xFFA4,0x030F,0x000B,0xFFA4,0x0311,0x000D,0xFFA4,0x0312,0x000F,
- 0xFFA4,0x0314,0x0010,0xFFA4,0x0316,0x0012,0xFFA5,0x0317,0x0014,0xFFA5,0x0319,0x0016,
- 0xFFA5,0x031B,0x0018,0xFFA5,0x031C,0x001A,0xFFA5,0x031E,0x001C,0xFFA5,0x031F,0x001E,
- 0xFFA5,0x0321,0x0020,0xFFA5,0x0323,0x0022,0xFFA5,0x0324,0x0024,0xFFA5,0x0326,0x0027,
- 0xFFA5,0x0327,0x0029,0xFFA5,0x0329,0x002B,0xFFA6,0x032B,0x002E,0xFFA6,0x032C,0x0030,
- 0xFFA6,0x032E,0x0033,0xFFA6,0x032F,0x0035,0xFFA6,0x0331,0x0038,0xFFA6,0x0332,0x003B,
- 0xFFA6,0x0334,0x003D,0xFFA6,0x0335,0x0040,0xFFA6,0x0337,0x0043,0xFFA6,0x0339,0x0046,
- 0xFFA6,0x033A,0x0048,0xFFA6,0x033C,0x004B,0xFFA6,0x033D,0x004E,0xFFA7,0x033F,0x0051,
- 0xFFA7,0x0340,0x0054,0xFFA7,0x0342,0x0057,0xFFA7,0x0343,0x005A,0xFFA7,0x0345,0x005D,
- 0xFFA7,0x0346,0x0061,0xFFA7,0x0348,0x0064,0xFFA7,0x0349,0x0067,0xFFA7,0x034B,0x006A,
- 0xFFA7,0x034C,0x006D,0xFFA7,0x034E,0x0071,0xFFA7,0x034F,0x0074,0xFFA7,0x0350,0x0077,
- 0xFFA8,0x0352,0x007B,0xFFA8,0x0353,0x007E,0xFFA8,0x0355,0x0082,0xFFA8,0x0356,0x0085,
- 0xFFA8,0x0358,0x0089,0xFFA8,0x0359,0x008C,0xFFA8,0x035A,0x0090,0xFFA8,0x035C,0x0093,
- 0xFFA8,0x035D,0x0097,0xFFA8,0x035F,0x009B,0xFFA8,0x0360,0x009E,0xFFA8,0x0361,0x00A2,
- 0xFFA8,0x0363,0x00A6,0xFFA8,0x0364,0x00AA,0xFFA8,0x0366,0x00AE,0xFFA9,0x0367,0x00B1,
- 0xFFA9,0x0368,0x00B5,0xFFA9,0x036A,0x00B9,0xFFA9,0x036B,0x00BD,0xFFA9,0x036C,0x00C1,
- 0xFFA9,0x036E,0x00C5,0xFFA9,0x036F,0x00C9,0xFFA9,0x0370,0x00CD,0xFFA9,0x0372,0x00D1,
- 0xFFA9,0x0373,0x00D5,0xFFA9,0x0374,0x00D9,0xFFA9,0x0376,0x00DD,0xFFA9,0x0377,0x00E2,
- 0xFFA9,0x0378,0x00E6,0xFFAA,0x037A,0x00EA,0xFFAA,0x037B,0x00EE,0xFFAA,0x037C,0x00F2,
- 0xFFAA,0x037D,0x00F7,0xFFAA,0x037F,0x00FB,0xFFAA,0x0380,0x00FF,0xFFAA,0x0381,0x0104,
- 0xFFAA,0x0382,0x0108,0xFFAA,0x0384,0x010D,0xFFAA,0x0385,0x0111,0xFFAA,0x0386,0x0116,
- 0xFFAA,0x0387,0x011A,0xFFAA,0x0389,0x011F,0xFFAA,0x038A,0x0123,0xFFAA,0x038B,0x0128,
- 0xFFAA,0x038C,0x012C,0xFFAB,0x038D,0x0131,0xFFAB,0x038F,0x0135,0xFFAB,0x0390,0x013A,
- 0xFFAB,0x0391,0x013F,0xFFAB,0x0392,0x0143,0xFFAB,0x0393,0x0148,0xFFAB,0x0394,0x014D,
- 0xFFAB,0x0396,0x0152,0xFFAB,0x0397,0x0156,0xFFAB,0x0398,0x015B,0xFFAB,0x0399,0x0160,
- 0xFFAB,0x039A,0x0165,0xFFAB,0x039B,0x016A,0xFFAB,0x039C,0x016F,0xFFAB,0x039D,0x0174,
- 0xFFAB,0x039F,0x0179,0xFFAB,0x03A0,0x017E,0xFFAB,0x03A1,0x0183,0xFFAC,0x03A2,0x0188,
- 0xFFAC,0x03A3,0x018D,0xFFAC,0x03A4,0x0192,0xFFAC,0x03A5,0x0197,0xFFAC,0x03A6,0x019C,
- 0xFFAC,0x03A7,0x01A1,0xFFAC,0x03A8,0x01A6,0xFFAC,0x03A9,0x01AB,0xFFAC,0x03AA,0x01B0,
- 0xFFAC,0x03AB,0x01B6,0xFFAC,0x03AC,0x01BB,0xFFAC,0x03AD,0x01C0,0xFFAC,0x03AE,0x01C5,
- 0xFFAC,0x03AF,0x01CB,0xFFAC,0x03B0,0x01D0,0xFFAC,0x03B1,0x01D5,0xFFAC,0x03B2,0x01DB,
- 0xFFAC,0x03B3,0x01E0,0xFFAC,0x03B4,0x01E5,0xFFAD,0x03B5,0x01EB,0xFFAD,0x03B6,0x01F0,
- 0xFFAD,0x03B7,0x01F6,0xFFAD,0x03B8,0x01FB,0xFFAD,0x03B9,0x0201,0xFFAD,0x03BA,0x0206,
- 0xFFAD,0x03BB,0x020C,0xFFAD,0x03BC,0x0211,0xFFAD,0x03BD,0x0217,0xFFAD,0x03BD,0x021C,
- 0xFFAD,0x03BE,0x0222,0xFFAD,0x03BF,0x0228,0xFFAD,0x03C0,0x022D,0xFFAD,0x03C1,0x0233,
- 0xFFAD,0x03C2,0x0238,0xFFAD,0x03C3,0x023E,0xFFAD,0x03C3,0x0244,0xFFAD,0x03C4,0x024A,
- 0xFFAD,0x03C5,0x024F,0xFFAD,0x03C6,0x0255,0xFFAD,0x03C7,0x025B,0xFFAD,0x03C8,0x0261,
- 0xFFAD,0x03C8,0x0267,0xFFAE,0x03C9,0x026C,0xFFAE,0x03CA,0x0272,0xFFAE,0x03CB,0x0278,
- 0xFFAE,0x03CB,0x027E,0xFFAE,0x03CC,0x0284,0xFFAE,0x03CD,0x028A,0xFFAE,0x03CE,0x0290,
- 0xFFAE,0x03CE,0x0296,0xFFAE,0x03CF,0x029C,0xFFAE,0x03D0,0x02A2,0xFFAE,0x03D1,0x02A8,
- 0xFFAE,0x03D1,0x02AE,0xFFAE,0x03D2,0x02B4,0xFFAE,0x03D3,0x02BA,0xFFAE,0x03D3,0x02C0,
- 0xFFAE,0x03D4,0x02C6,0xFFAE,0x03D5,0x02CC,0xFFAE,0x03D5,0x02D3,0xFFAE,0x03D6,0x02D9,
- 0xFFAE,0x03D7,0x02DF,0xFFAE,0x03D7,0x02E5,0xFFAE,0x03D8,0x02EB,0xFFAE,0x03D8,0x02F2,
- 0xFFAE,0x03D9,0x02F8,0xFFAE,0x03D9,0x02FE,0xFFAE,0x03DA,0x0304,0xFFAE,0x03DB,0x030B,
- 0xFFAE,0x03DB,0x0311,0xFFAE,0x03DC,0x0317,0xFFAF,0x03DC,0x031E,0xFFAF,0x03DD,0x0324,
- 0xFFAF,0x03DD,0x032A,0xFFAF,0x03DE,0x0331,0xFFAF,0x03DE,0x0337,0xFFAF,0x03DF,0x033E,
- 0xFFAF,0x03DF,0x0344,0xFFAF,0x03E0,0x034B,0xFFAF,0x03E0,0x0351,0xFFAF,0x03E0,0x0358,
- 0xFFAF,0x03E1,0x035E,0xFFAF,0x03E1,0x0365,0xFFAF,0x03E2,0x036B,0xFFAF,0x03E2,0x0372,
- 0xFFAF,0x03E2,0x0378,0xFFAF,0x03E3,0x037F,0xFFAF,0x03E3,0x0386,0xFFAF,0x03E3,0x038C,
- 0xFFAF,0x03E4,0x0393,0xFFAF,0x03E4,0x039A,0xFFAF,0x03E4,0x03A0,0xFFAF,0x03E5,0x03A7,
- 0xFFAF,0x03E5,0x03AE,0xFFAF,0x03E5,0x03B4,0xFFAF,0x03E5,0x03BB,0xFFAF,0x03E5,0x03C2,
- 0xFFAF,0x03E6,0x03C9,0xFFAF,0x03E6,0x03D0,0xFFAF,0x03E6,0x03D6,0xFFAF,0x03E6,0x03DD
+ 0xFFAF,0x03E6,0x03E4,0xFFAF,0x03E4,0x03E4,0xFFAF,0x03E1,0x03E4,0xFFAF,0x03DE,0x03E4,
+ 0xFFAF,0x03DB,0x03E4,0xFFAF,0x03D7,0x03E4,0xFFAF,0x03D3,0x03E4,0xFFAF,0x03D0,0x03E4,
+ 0xFFAF,0x03CC,0x03E4,0xFFAF,0x03C8,0x03E4,0xFFAF,0x03C4,0x03E4,0xFFAF,0x03C0,0x03E4,
+ 0xFFAF,0x03BB,0x03E4,0xFFAF,0x03B7,0x03E4,0xFFAF,0x03B3,0x03E4,0xFFAF,0x03AE,0x03E4,
+ 0xFFAF,0x03AA,0x03E4,0xFFAF,0x03A5,0x03E3,0xFFAF,0x03A1,0x03E3,0xFFAF,0x039C,0x03E3,
+ 0xFFAF,0x0397,0x03E3,0xFFAF,0x0393,0x03E3,0xFFAF,0x038E,0x03E3,0xFFAF,0x0389,0x03E3,
+ 0xFFAF,0x0384,0x03E3,0xFFAF,0x037F,0x03E3,0xFFAF,0x037A,0x03E3,0xFFAF,0x0375,0x03E3,
+ 0xFFAF,0x0370,0x03E3,0xFFAF,0x036B,0x03E3,0xFFAF,0x0366,0x03E3,0xFFAF,0x0361,0x03E3,
+ 0xFFAF,0x035C,0x03E2,0xFFAF,0x0357,0x03E2,0xFFAF,0x0352,0x03E2,0xFFAF,0x034C,0x03E2,
+ 0xFFAF,0x0347,0x03E2,0xFFAF,0x0342,0x03E2,0xFFAF,0x033C,0x03E2,0xFFAE,0x0337,0x03E2,
+ 0xFFAE,0x0332,0x03E2,0xFFAE,0x032C,0x03E2,0xFFAE,0x0327,0x03E2,0xFFAE,0x0321,0x03E1,
+ 0xFFAE,0x031C,0x03E1,0xFFAE,0x0316,0x03E1,0xFFAE,0x0311,0x03E1,0xFFAE,0x030B,0x03E1,
+ 0xFFAE,0x0305,0x03E1,0xFFAE,0x0300,0x03E1,0xFFAE,0x02FA,0x03E1,0xFFAE,0x02F4,0x03E1,
+ 0xFFAE,0x02EF,0x03E0,0xFFAE,0x02E9,0x03E0,0xFFAE,0x02E3,0x03E0,0xFFAE,0x02DE,0x03E0,
+ 0xFFAE,0x02D8,0x03E0,0xFFAE,0x02D2,0x03E0,0xFFAE,0x02CC,0x03E0,0xFFAE,0x02C6,0x03E0,
+ 0xFFAE,0x02C0,0x03DF,0xFFAD,0x02BB,0x03DF,0xFFAD,0x02B5,0x03DF,0xFFAD,0x02AF,0x03DF,
+ 0xFFAD,0x02A9,0x03DF,0xFFAD,0x02A3,0x03DF,0xFFAD,0x029D,0x03DF,0xFFAD,0x0297,0x03DE,
+ 0xFFAD,0x0291,0x03DE,0xFFAD,0x028B,0x03DE,0xFFAD,0x0285,0x03DE,0xFFAD,0x027F,0x03DE,
+ 0xFFAD,0x0279,0x03DE,0xFFAD,0x0273,0x03DE,0xFFAD,0x026C,0x03DD,0xFFAC,0x0266,0x03DD,
+ 0xFFAC,0x0260,0x03DD,0xFFAC,0x025A,0x03DD,0xFFAC,0x0254,0x03DD,0xFFAC,0x024E,0x03DD,
+ 0xFFAC,0x0247,0x03DD,0xFFAC,0x0241,0x03DC,0xFFAC,0x023B,0x03DC,0xFFAC,0x0235,0x03DC,
+ 0xFFAC,0x022E,0x03DC,0xFFAC,0x0228,0x03DC,0xFFAC,0x0222,0x03DC,0xFFAB,0x021C,0x03DB,
+ 0xFFAB,0x0215,0x03DB,0xFFAB,0x020F,0x03DB,0xFFAB,0x0208,0x03DB,0xFFAB,0x0202,0x03DB,
+ 0xFFAB,0x01FC,0x03DB,0xFFAB,0x01F5,0x03DA,0xFFAB,0x01EF,0x03DA,0xFFAB,0x01E8,0x03DA,
+ 0xFFAA,0x01E2,0x03DA,0xFFAA,0x01DC,0x03DA,0xFFAA,0x01D5,0x03D9,0xFFAA,0x01CF,0x03D9,
+ 0xFFAA,0x01C8,0x03D9,0xFFAA,0x01C2,0x03D9,0xFFAA,0x01BB,0x03D9,0xFFAA,0x01B5,0x03D9,
+ 0xFFA9,0x01AE,0x03D8,0xFFA9,0x01A9,0x03D8,0xFFA9,0x01A3,0x03D8,0xFFA9,0x019E,0x03D8,
+ 0xFFA9,0x0199,0x03D8,0xFFA9,0x0194,0x03D7,0xFFA9,0x018F,0x03D7,0xFFA9,0x018A,0x03D7,
+ 0xFFA8,0x0184,0x03D7,0xFFA8,0x017F,0x03D7,0xFFA8,0x017A,0x03D6,0xFFA8,0x0175,0x03D6,
+ 0xFFA8,0x0170,0x03D6,0xFFA8,0x016B,0x03D6,0xFFA8,0x0166,0x03D6,0xFFA7,0x0161,0x03D5,
+ 0xFFA7,0x015C,0x03D5,0xFFA7,0x0157,0x03D5,0xFFA7,0x0152,0x03D5,0xFFA7,0x014E,0x03D4,
+ 0xFFA7,0x0149,0x03D4,0xFFA6,0x0144,0x03D4,0xFFA6,0x013F,0x03D4,0xFFA6,0x013A,0x03D4,
+ 0xFFA6,0x0136,0x03D3,0xFFA6,0x0131,0x03D3,0xFFA6,0x012C,0x03D3,0xFFA5,0x0127,0x03D3,
+ 0xFFA5,0x0123,0x03D2,0xFFA5,0x011E,0x03D2,0xFFA5,0x011A,0x03D2,0xFFA5,0x0115,0x03D2,
+ 0xFFA5,0x0110,0x03D2,0xFFA4,0x010C,0x03D1,0xFFA4,0x0107,0x03D1,0xFFA4,0x0103,0x03D1,
+ 0xFFA4,0x00FE,0x03D1,0xFFA4,0x00FA,0x03D0,0xFFA3,0x00F6,0x03D0,0xFFA3,0x00F1,0x03D0,
+ 0xFFA3,0x00ED,0x03D0,0xFFA3,0x00E9,0x03CF,0xFFA3,0x00E4,0x03CF,0xFFA2,0x00E0,0x03CF,
+ 0xFFA2,0x00DC,0x03CF,0xFFA2,0x00D8,0x03CE,0xFFA2,0x00D3,0x03CE,0xFFA2,0x00CF,0x03CE,
+ 0xFFA1,0x00CB,0x03CE,0xFFA1,0x00C7,0x03CD,0xFFA1,0x00C3,0x03CD,0xFFA1,0x00BF,0x03CD,
+ 0xFFA0,0x00BB,0x03CD,0xFFA0,0x00B7,0x03CC,0xFFA0,0x00B3,0x03CC,0xFFA0,0x00AF,0x03CC,
+ 0xFFA0,0x00AB,0x03CC,0xFF9F,0x00A7,0x03CB,0xFF9F,0x00A3,0x03CB,0xFF9F,0x00A0,0x03CB,
+ 0xFF9F,0x009C,0x03CB,0xFF9E,0x0098,0x03CA,0xFF9E,0x0094,0x03CA,0xFF9E,0x0091,0x03CA,
+ 0xFF9E,0x008D,0x03CA,0xFF9D,0x0089,0x03C9,0xFF9D,0x0086,0x03C9,0xFF9D,0x0082,0x03C9,
+ 0xFF9D,0x007F,0x03C9,0xFF9C,0x007B,0x03C8,0xFF9C,0x0078,0x03C8,0xFF9C,0x0074,0x03C8,
+ 0xFF9C,0x0071,0x03C7,0xFF9B,0x006D,0x03C7,0xFF9B,0x006A,0x03C7,0xFF9B,0x0067,0x03C7,
+ 0xFF9A,0x0064,0x03C6,0xFF9A,0x0060,0x03C6,0xFF9A,0x005D,0x03C6,0xFF9A,0x005A,0x03C5,
+ 0xFF99,0x0057,0x03C5,0xFF99,0x0054,0x03C5,0xFF99,0x0051,0x03C5,0xFF98,0x004E,0x03C4,
+ 0xFF98,0x004B,0x03C4,0xFF98,0x0048,0x03C4,0xFF98,0x0045,0x03C3,0xFF97,0x0042,0x03C3,
+ 0xFF97,0x003F,0x03C3,0xFF97,0x003C,0x03C3,0xFF96,0x003A,0x03C2,0xFF96,0x0037,0x03C2,
+ 0xFF96,0x0034,0x03C2,0xFF95,0x0032,0x03C1,0xFF95,0x002F,0x03C1,0xFF95,0x002D,0x03C1,
+ 0xFF95,0x002A,0x03C1,0xFF94,0x0028,0x03C0,0xFF94,0x0026,0x03C0,0xFF94,0x0023,0x03C0,
+ 0xFF93,0x0021,0x03BF,0xFF93,0x001F,0x03BF,0xFF93,0x001D,0x03BF,0xFF92,0x001A,0x03BE,
+ 0xFF92,0x0018,0x03BE,0xFF92,0x0016,0x03BE,0xFF91,0x0014,0x03BD,0xFF91,0x0013,0x03BD,
+ 0xFF91,0x0011,0x03BD,0xFF90,0x000F,0x03BC,0xFF90,0x000D,0x03BC,0xFF90,0x000C,0x03BC,
+ 0xFF8F,0x000A,0x03BC,0xFF8F,0x0009,0x03BB,0xFF8E,0x0007,0x03BB,0xFF8E,0x0006,0x03BB,
+ 0xFF8E,0x0005,0x03BA,0xFF8D,0x0004,0x03BA,0xFF8D,0x0003,0x03BA,0xFF8D,0x0002,0x03B9,
+ 0xFF8C,0x0001,0x03B9,0xFF8C,0x0000,0x03B9,0xFF8C,0x0000,0x03B8,0xFF8B,0xFFFD,0x03B8,
+ 0xFF8B,0xFFFB,0x03B8,0xFF8A,0xFFF8,0x03B7,0xFF8A,0xFFF5,0x03B7,0xFF8A,0xFFF2,0x03B7,
+ 0xFF89,0xFFF0,0x03B6,0xFF89,0xFFED,0x03B6,0xFF88,0xFFEA,0x03B6,0xFF88,0xFFE7,0x03B5,
+ 0xFF88,0xFFE5,0x03B5,0xFF87,0xFFE2,0x03B5,0xFF87,0xFFDF,0x03B4,0xFF86,0xFFDC,0x03B4,
+ 0xFF86,0xFFDA,0x03B4,0xFF88,0xFFD7,0x03B3,0xFF8B,0xFFD4,0x03B3,0xFF8D,0xFFD1,0x03B3,
+ 0xFF8F,0xFFCF,0x03B2,0xFF92,0xFFCC,0x03B2,0xFF94,0xFFC9,0x03B2,0xFF96,0xFFC6,0x03B1,
+ 0xFF99,0xFFC4,0x03B1,0xFF9B,0xFFC1,0x03B0,0xFF9D,0xFFBE,0x03B0,0xFFA0,0xFFBC,0x03B0,
+ 0xFFA2,0xFFB9,0x03AF,0xFFA5,0xFFB6,0x03AF,0xFFA7,0xFFB3,0x03AF,0xFFA9,0xFFB1,0x03AE,
+ 0xFFAC,0xFFAE,0x03AE,0xFFAE,0xFFAB,0x03AE,0xFFB0,0xFFA8,0x03AE,0xFFB3,0xFFA6,0x03AE,
+ 0xFFB5,0xFFA3,0x03AE,0xFFB7,0xFFA0,0x03AE,0xFFBA,0xFF9D,0x03AE,0xFFBC,0xFF9B,0x03AE,
+ 0xFFBE,0xFF98,0x03AE,0xFFC1,0xFF95,0x03AE,0xFFC3,0xFF92,0x03AE,0xFFC5,0xFF90,0x03AE,
+ 0xFFC8,0xFF8D,0x03AE,0xFFCA,0xFF8A,0x03AE,0xFFCC,0xFF87,0x03AE,0xFFCF,0xFF85,0x03AE,
+ 0xFFD1,0xFF82,0x03AE,0xFFD3,0xFF82,0x03AE,0xFFD6,0xFF81,0x03AE,0xFFD8,0xFF81,0x03AD,
+ 0xFFDA,0xFF80,0x03AD,0xFFDD,0xFF80,0x03AD,0xFFDF,0xFF7F,0x03AD,0xFFE2,0xFF7F,0x03AD,
+ 0xFFE4,0xFF7E,0x03AD,0xFFE6,0xFF7E,0x03AD,0xFFE9,0xFF7E,0x03AD,0xFFEB,0xFF7D,0x03AD,
+ 0xFFED,0xFF7D,0x03AD,0xFFF0,0xFF7C,0x03AD,0xFFF2,0xFF7C,0x03AD,0xFFF4,0xFF7B,0x03AD,
+ 0xFFF7,0xFF7B,0x03AD,0xFFF9,0xFF7B,0x03AD,0xFFFB,0xFF7A,0x03AD,0xFFFE,0xFF7A,0x03AD,
+ 0x0000,0xFF79,0x03AD,0x0001,0xFF79,0x03AC,0x0001,0xFF78,0x03AC,0x0002,0xFF78,0x03AC,
+ 0x0002,0xFF78,0x03AC,0x0003,0xFF77,0x03AC,0x0004,0xFF77,0x03AC,0x0005,0xFF76,0x03AC,
+ 0x0006,0xFF76,0x03AC,0x0007,0xFF76,0x03AC,0x0008,0xFF75,0x03AC,0x0009,0xFF75,0x03AC,
+ 0x000A,0xFF74,0x03AC,0x000C,0xFF74,0x03AC,0x000D,0xFF74,0x03AC,0x000E,0xFF73,0x03AB,
+ 0x000F,0xFF73,0x03AB,0x0011,0xFF72,0x03AB,0x0012,0xFF72,0x03AB,0x0014,0xFF72,0x03AB,
+ 0x0015,0xFF71,0x03AB,0x0017,0xFF71,0x03AB,0x0018,0xFF71,0x03AB,0x001A,0xFF70,0x03AB,
+ 0x001B,0xFF70,0x03AB,0x001D,0xFF6F,0x03AB,0x001F,0xFF6F,0x03AA,0x0021,0xFF6F,0x03AA,
+ 0x0022,0xFF6E,0x03AA,0x0024,0xFF6E,0x03AA,0x0026,0xFF6E,0x03AA,0x0028,0xFF6D,0x03AA,
+ 0x002A,0xFF6D,0x03AA,0x002C,0xFF6C,0x03AA,0x002E,0xFF6C,0x03AA,0x0030,0xFF6C,0x03AA,
+ 0x0031,0xFF6B,0x03AA,0x0034,0xFF6B,0x03A9,0x0036,0xFF6B,0x03A9,0x0038,0xFF6A,0x03A9,
+ 0x003A,0xFF6A,0x03A9,0x003C,0xFF6A,0x03A9,0x003E,0xFF69,0x03A9,0x0040,0xFF69,0x03A9,
+ 0x0042,0xFF69,0x03A9,0x0045,0xFF68,0x03A9,0x0047,0xFF68,0x03A8,0x0049,0xFF68,0x03A8,
+ 0x004B,0xFF67,0x03A8,0x004E,0xFF67,0x03A8,0x0050,0xFF67,0x03A8,0x0052,0xFF66,0x03A8,
+ 0x0055,0xFF66,0x03A8,0x0057,0xFF66,0x03A8,0x005A,0xFF65,0x03A8,0x005C,0xFF65,0x03A8,
+ 0x005F,0xFF65,0x03A7,0x0061,0xFF64,0x03A7,0x0064,0xFF64,0x03A7,0x0066,0xFF64,0x03A7,
+ 0x0069,0xFF63,0x03A7,0x006B,0xFF63,0x03A7,0x006E,0xFF63,0x03A7,0x0071,0xFF62,0x03A7,
+ 0x0073,0xFF62,0x03A6,0x0076,0xFF62,0x03A6,0x0079,0xFF62,0x03A6,0x007B,0xFF61,0x03A6,
+ 0x007E,0xFF61,0x03A6,0x0081,0xFF61,0x03A6,0x0084,0xFF60,0x03A6,0x0086,0xFF60,0x03A6,
+ 0x0089,0xFF60,0x03A5,0x008C,0xFF5F,0x03A5,0x008F,0xFF5F,0x03A5,0x0092,0xFF5F,0x03A5,
+ 0x0095,0xFF5F,0x03A5,0x0097,0xFF5E,0x03A5,0x009A,0xFF5E,0x03A5,0x009D,0xFF5E,0x03A5,
+ 0x00A0,0xFF5D,0x03A4,0x00A3,0xFF5D,0x03A4,0x00A6,0xFF5D,0x03A4,0x00A9,0xFF5D,0x03A4,
+ 0x00AC,0xFF5C,0x03A4,0x00AF,0xFF5C,0x03A4,0x00B2,0xFF5C,0x03A4,0x00B6,0xFF5C,0x03A3,
+ 0x00B9,0xFF5B,0x03A3,0x00BC,0xFF5B,0x03A3,0x00BF,0xFF5B,0x03A3,0x00C2,0xFF5B,0x03A3,
+ 0x00C5,0xFF5A,0x03A3,0x00C8,0xFF5A,0x03A3,0x00CC,0xFF5A,0x03A3,0x00CF,0xFF5A,0x03A2,
+ 0x00D2,0xFF59,0x03A2,0x00D5,0xFF59,0x03A2,0x00D9,0xFF59,0x03A2,0x00DC,0xFF59,0x03A2,
+ 0x00DF,0xFF58,0x03A2,0x00E3,0xFF58,0x03A1,0x00E6,0xFF58,0x03A1,0x00E9,0xFF58,0x03A1,
+ 0x00ED,0xFF57,0x03A1,0x00F0,0xFF57,0x03A1,0x00F0,0xFF57,0x03A1,0x00F2,0xFF57,0x03A1,
+ 0x00F3,0xFF56,0x03A0,0x00F5,0xFF56,0x03A0,0x00F6,0xFF56,0x03A0,0x00F8,0xFF56,0x03A0,
+ 0x00F9,0xFF56,0x03A0,0x00FB,0xFF55,0x03A0,0x00FC,0xFF55,0x03A0,0x00FE,0xFF55,0x039F,
+ 0x00FF,0xFF55,0x039F,0x0101,0xFF54,0x039F,0x0102,0xFF54,0x039F,0x0104,0xFF54,0x039F,
+ 0x0105,0xFF54,0x039F,0x0106,0xFF54,0x039E,0x0108,0xFF53,0x039E,0x0109,0xFF53,0x039E,
+ 0x010B,0xFF53,0x039E,0x010C,0xFF53,0x039E,0x010D,0xFF53,0x039E,0x010F,0xFF52,0x039D,
+ 0x0110,0xFF52,0x039D,0x0112,0xFF52,0x039D,0x0113,0xFF52,0x039D,0x0114,0xFF52,0x039D,
+ 0x0116,0xFF51,0x039D,0x0117,0xFF51,0x039D,0x0118,0xFF51,0x039C,0x011A,0xFF51,0x039C,
+ 0x011B,0xFF51,0x039C,0x011C,0xFF51,0x039C,0x011D,0xFF50,0x039C,0x011F,0xFF50,0x039C,
+ 0x0120,0xFF50,0x039B,0x0121,0xFF50,0x039B,0x0123,0xFF50,0x039B,0x0124,0xFF50,0x039B,
+ 0x0125,0xFF4F,0x039B,0x0126,0xFF4F,0x039A,0x0127,0xFF4F,0x039A,0x0129,0xFF4F,0x039A,
+ 0x012A,0xFF4F,0x039A,0x012B,0xFF4F,0x039A,0x012C,0xFF4E,0x039A,0x012D,0xFF4E,0x0399,
+ 0x012E,0xFF4E,0x0399,0x0130,0xFF4E,0x0399,0x0131,0xFF4E,0x0399,0x0132,0xFF4E,0x0399,
+ 0x0133,0xFF4E,0x0399,0x0134,0xFF4D,0x0398,0x0135,0xFF4D,0x0398,0x0136,0xFF4D,0x0398,
+ 0x0137,0xFF4D,0x0398,0x0138,0xFF4D,0x0398,0x0139,0xFF4D,0x0397,0x013A,0xFF4D,0x0397,
+ 0x013B,0xFF4D,0x0397,0x013C,0xFF4C,0x0397,0x013D,0xFF4C,0x0397,0x013E,0xFF4C,0x0397,
+ 0x013F,0xFF4C,0x0396,0x0140,0xFF4C,0x0396,0x0141,0xFF4C,0x0396,0x0142,0xFF4C,0x0396,
+ 0x0143,0xFF4C,0x0396,0x0144,0xFF4C,0x0395,0x0145,0xFF4B,0x0395,0x0146,0xFF4B,0x0395,
+ 0x0147,0xFF4B,0x0395,0x0148,0xFF4B,0x0395,0x0149,0xFF4B,0x0394,0x0149,0xFF4B,0x0394,
+ 0x014A,0xFF4B,0x0394,0x014B,0xFF4B,0x0394,0x014C,0xFF4B,0x0394,0x014D,0xFF4B,0x0394,
+ 0x014D,0xFF4B,0x0393,0x014E,0xFF4A,0x0393,0x014F,0xFF4A,0x0393,0x0150,0xFF4A,0x0393,
+ 0x0150,0xFF4A,0x0393,0x0151,0xFF4A,0x0392,0x0152,0xFF4A,0x0392,0x0153,0xFF4A,0x0392,
+ 0x0153,0xFF4A,0x0392,0x0154,0xFF4A,0x0392,0x0155,0xFF4A,0x0391,0x0155,0xFF4A,0x0391,
+ 0x0156,0xFF4A,0x0391,0x0156,0xFF4A,0x0391,0x0157,0xFF4A,0x0391,0x0158,0xFF4A,0x0390,
+ 0x0158,0xFF4A,0x0390,0x0159,0xFF49,0x0390,0x0159,0xFF49,0x0390,0x015A,0xFF49,0x0390,
+ 0x015A,0xFF49,0x038F,0x015B,0xFF49,0x038F,0x015B,0xFF49,0x038F,0x015C,0xFF49,0x038F,
+ 0x015C,0xFF49,0x038F,0x015C,0xFF49,0x038E,0x015D,0xFF49,0x038E,0x015D,0xFF49,0x038E,
+ 0x015D,0xFF49,0x038E,0x015E,0xFF49,0x038D,0x015E,0xFF49,0x038D,0x015E,0xFF49,0x038D,
+ 0x015E,0xFF49,0x038D,0x015F,0xFF49,0x038D,0x015F,0xFF49,0x038C,0x015F,0xFF49,0x038C,
+ 0x015F,0xFF49,0x038C,0x015F,0xFF49,0x038C,0x015F,0xFF48,0x038B,0x015F,0xFF48,0x038A,
+ 0x015F,0xFF48,0x038A,0x015F,0xFF48,0x0389,0x015F,0xFF47,0x0387,0x015F,0xFF47,0x0386,
+ 0x015F,0xFF47,0x0385,0x015F,0xFF47,0x0384,0x015F,0xFF46,0x0382,0x015F,0xFF46,0x0381,
+ 0x015F,0xFF46,0x037F,0x015F,0xFF46,0x037E,0x015F,0xFF45,0x037C,0x015F,0xFF45,0x037A,
+ 0x015F,0xFF45,0x0378,0x015F,0xFF45,0x0377,0x015F,0xFF44,0x0375,0x015F,0xFF44,0x0373,
+ 0x015F,0xFF44,0x0371,0x015F,0xFF44,0x036F,0x015F,0xFF43,0x036C,0x015F,0xFF43,0x036A,
+ 0x015F,0xFF43,0x0368,0x015F,0xFF43,0x0366,0x015F,0xFF42,0x0363,0x015F,0xFF42,0x0361,
+ 0x015F,0xFF42,0x035F,0x015F,0xFF42,0x035C,0x015F,0xFF41,0x035A,0x015F,0xFF41,0x0357,
+ 0x015F,0xFF41,0x0355,0x015F,0xFF41,0x0352,0x015F,0xFF41,0x034F,0x015F,0xFF40,0x034D,
+ 0x015F,0xFF40,0x034A,0x015F,0xFF40,0x0347,0x015F,0xFF40,0x0344,0x015F,0xFF3F,0x0341,
+ 0x015F,0xFF3F,0x033E,0x015F,0xFF3F,0x033C,0x015F,0xFF3F,0x0339,0x015F,0xFF3F,0x0336,
+ 0x015F,0xFF3E,0x0333,0x015F,0xFF3E,0x032F,0x015F,0xFF3E,0x032C,0x015F,0xFF3E,0x0329,
+ 0x015E,0xFF3D,0x0326,0x015E,0xFF3D,0x0323,0x015E,0xFF3D,0x0320,0x015E,0xFF3D,0x031C,
+ 0x015E,0xFF3D,0x0319,0x015E,0xFF3C,0x0316,0x015E,0xFF3C,0x0312,0x015E,0xFF3C,0x030F,
+ 0x015E,0xFF3C,0x030C,0x015E,0xFF3C,0x0308,0x015E,0xFF3B,0x0305,0x015E,0xFF3B,0x0301,
+ 0x015E,0xFF3B,0x02FE,0x015E,0xFF3B,0x02FA,0x015E,0xFF3A,0x02F6,0x015E,0xFF3A,0x02F3,
+ 0x015E,0xFF3A,0x02EF,0x015E,0xFF3A,0x02EB,0x015E,0xFF3A,0x02E8,0x015E,0xFF39,0x02E4,
+ 0x015E,0xFF39,0x02E0,0x015E,0xFF39,0x02DC,0x015E,0xFF39,0x02D9,0x015E,0xFF39,0x02D5,
+ 0x015E,0xFF39,0x02D1,0x015E,0xFF38,0x02CD,0x015E,0xFF38,0x02C9,0x015D,0xFF38,0x02C5,
+ 0x015D,0xFF38,0x02C1,0x015D,0xFF38,0x02BD,0x015D,0xFF37,0x02B9,0x015D,0xFF37,0x02B5,
+ 0x015D,0xFF37,0x02B1,0x015D,0xFF37,0x02AD,0x015D,0xFF37,0x02A8,0x015D,0xFF36,0x02A4,
+ 0x015D,0xFF36,0x02A0,0x015D,0xFF36,0x029C,0x015D,0xFF36,0x0298,0x015D,0xFF36,0x0293,
+ 0x015D,0xFF36,0x028F,0x015D,0xFF35,0x028B,0x015D,0xFF35,0x0286,0x015D,0xFF35,0x0282,
+ 0x015D,0xFF35,0x027E,0x015C,0xFF35,0x0279,0x015C,0xFF35,0x0275,0x015C,0xFF34,0x0270,
+ 0x015C,0xFF34,0x026C,0x015C,0xFF34,0x0267,0x015C,0xFF34,0x0263,0x015C,0xFF34,0x025E,
+ 0x015C,0xFF34,0x025A,0x015C,0xFF33,0x0255,0x015C,0xFF33,0x0250,0x015C,0xFF33,0x024C,
+ 0x015C,0xFF33,0x0247,0x015C,0xFF33,0x0242,0x015C,0xFF33,0x023E,0x015B,0xFF32,0x0239,
+ 0x015B,0xFF32,0x0234,0x015B,0xFF32,0x022F,0x015B,0xFF32,0x022A,0x015B,0xFF32,0x0226,
+ 0x015B,0xFF32,0x0221,0x015B,0xFF32,0x021C,0x015B,0xFF31,0x0217,0x015B,0xFF31,0x0212,
+ 0x015B,0xFF31,0x020D,0x015B,0xFF31,0x0208,0x015A,0xFF31,0x0203,0x015A,0xFF31,0x01FE,
+ 0x015A,0xFF31,0x01F9,0x015A,0xFF30,0x01F4,0x015A,0xFF30,0x01EF,0x015A,0xFF30,0x01EA,
+ 0x015A,0xFF30,0x01E5,0x015A,0xFF30,0x01E0,0x015A,0xFF30,0x01DB,0x015A,0xFF30,0x01D5,
+ 0x015A,0xFF2F,0x01D0,0x0159,0xFF2F,0x01CB,0x0159,0xFF2F,0x01C6,0x0159,0xFF2F,0x01C1,
+ 0x0159,0xFF2F,0x01BB,0x0159,0xFF2F,0x01B6,0x0159,0xFF2F,0x01B1,0x0159,0xFF2F,0x01AB,
+ 0x0159,0xFF2E,0x01A6,0x0159,0xFF2E,0x01A1,0x0158,0xFF2E,0x019C,0x0158,0xFF2E,0x0197,
+ 0x0158,0xFF2E,0x0193,0x0158,0xFF2E,0x018E,0x0158,0xFF2E,0x0189,0x0158,0xFF2E,0x0184,
+ 0x0158,0xFF2E,0x017F,0x0158,0xFF2D,0x017A,0x0157,0xFF2D,0x0176,0x0157,0xFF2D,0x0171,
+ 0x0157,0xFF2D,0x016C,0x0157,0xFF2D,0x0167,0x0157,0xFF2D,0x0163,0x0157,0xFF2D,0x015E,
+ 0x0157,0xFF2D,0x0159,0x0157,0xFF2D,0x0155,0x0156,0xFF2C,0x0150,0x0156,0xFF2C,0x014B,
+ 0x0156,0xFF2C,0x0147,0x0156,0xFF2C,0x0142,0x0156,0xFF2C,0x013E,0x0156,0xFF2C,0x0139,
+ 0x0156,0xFF2C,0x0134,0x0155,0xFF2C,0x0130,0x0155,0xFF2C,0x012B,0x0155,0xFF2C,0x0127,
+ 0x0155,0xFF2B,0x0122,0x0155,0xFF2B,0x011E,0x0155,0xFF2B,0x0119,0x0155,0xFF2B,0x0115,
+ 0x0154,0xFF2B,0x0110,0x0154,0xFF2B,0x010C,0x0154,0xFF2B,0x0108,0x0154,0xFF2B,0x0103,
+ 0x0154,0xFF2B,0x00FF,0x0154,0xFF2B,0x00FB,0x0154,0xFF2B,0x00F6,0x0153,0xFF2B,0x00F2,
+ 0x0153,0xFF2A,0x00EE,0x0153,0xFF2A,0x00E9,0x0153,0xFF2A,0x00E5,0x0153,0xFF2A,0x00E1,
+ 0x0153,0xFF2A,0x00DD,0x0152,0xFF2A,0x00D8,0x0152,0xFF2A,0x00D4,0x0152,0xFF2A,0x00D0,
+ 0x0152,0xFF2A,0x00CC,0x0152,0xFF2A,0x00C8,0x0152,0xFF2A,0x00C4,0x0151,0xFF2A,0x00C0,
+ 0x0151,0xFF2A,0x00BB,0x0151,0xFF2A,0x00B7,0x0151,0xFF29,0x00B3,0x0151,0xFF29,0x00AF,
+ 0x0150,0xFF29,0x00AB,0x0150,0xFF29,0x00A7,0x0150,0xFF29,0x00A3,0x0150,0xFF29,0x00A0,
+ 0x0150,0xFF29,0x009C,0x0150,0xFF29,0x0098,0x014F,0xFF29,0x0094,0x014F,0xFF29,0x0090,
+ 0x014F,0xFF29,0x008C,0x014F,0xFF29,0x0088,0x014F,0xFF29,0x0085,0x014E,0xFF29,0x0081,
+ 0x014E,0xFF29,0x007D,0x014E,0xFF29,0x007A,0x014E,0xFF29,0x0076,0x014E,0xFF29,0x0072,
+ 0x014D,0xFF29,0x006F,0x014D,0xFF29,0x006B,0x014D,0xFF28,0x0068,0x014D,0xFF28,0x0064,
+ 0x014D,0xFF28,0x0060,0x014C,0xFF28,0x005D,0x014C,0xFF28,0x005A,0x014C,0xFF28,0x0056,
+ 0x014C,0xFF28,0x0053,0x014B,0xFF28,0x004F,0x014B,0xFF28,0x004C,0x014B,0xFF28,0x0049,
+ 0x014B,0xFF28,0x0046,0x014B,0xFF28,0x0042,0x014A,0xFF28,0x003F,0x014A,0xFF28,0x003C,
+ 0x014A,0xFF28,0x0039,0x014A,0xFF28,0x0036,0x0149,0xFF28,0x0033,0x0149,0xFF28,0x0030,
+ 0x0149,0xFF28,0x002D,0x0149,0xFF28,0x002A,0x0149,0xFF28,0x0027,0x0148,0xFF28,0x0024,
+ 0x0148,0xFF28,0x0022,0x0148,0xFF28,0x001F,0x0148,0xFF28,0x001C,0x0147,0xFF28,0x001A,
+ 0x0147,0xFF28,0x0017,0x0147,0xFF2B,0x0015,0x0147,0xFF2E,0x0012,0x0146,0xFF31,0x0010,
+ 0x0146,0xFF33,0x000E,0x0146,0xFF36,0x000B,0x0146,0xFF39,0x0009,0x0145,0xFF3C,0x0007,
+ 0x0145,0xFF3F,0x0006,0x0145,0xFF42,0x0004,0x0145,0xFF44,0x0002,0x0144,0xFF47,0x0001,
+ 0x0144,0xFF4A,0x0000,0x0144,0xFF4D,0xFFF7,0x0144,0xFF50,0xFFEE,0x0143,0xFF53,0xFFE5,
+ 0x0143,0xFF55,0xFFDD,0x0143,0xFF58,0xFFD4,0x0143,0xFF5B,0xFFCC,0x0142,0xFF5E,0xFFC3,
+ 0x0142,0xFF61,0xFFBB,0x0146,0xFF64,0xFFB3,0x0149,0xFF67,0xFFAB,0x014D,0xFF69,0xFFA2,
+ 0x0151,0xFF6C,0xFF9B,0x0154,0xFF6F,0xFF93,0x0158,0xFF72,0xFF8B,0x015C,0xFF75,0xFF83,
+ 0x015F,0xFF78,0xFF7C,0x0163,0xFF7A,0xFF75,0x0166,0xFF7D,0xFF6D,0x016A,0xFF80,0xFF66,
+ 0x016E,0xFF83,0xFF5F,0x0171,0xFF86,0xFF58,0x0175,0xFF89,0xFF52,0x0178,0xFF8B,0xFF4B,
+ 0x017C,0xFF8E,0xFF44,0x0180,0xFF91,0xFF3E,0x0183,0xFF94,0xFF38,0x0187,0xFF97,0xFF32,
+ 0x018A,0xFF9A,0xFF2C,0x018E,0xFF9D,0xFF26,0x0191,0xFF9F,0xFF21,0x0195,0xFFA2,0xFF1B,
+ 0x0199,0xFFA5,0xFF16,0x019C,0xFFA8,0xFF11,0x01A0,0xFFAB,0xFF0C,0x01A3,0xFFAE,0xFF08,
+ 0x01A7,0xFFB0,0xFF04,0x01AA,0xFFB3,0xFF00,0x01AE,0xFFB6,0xFEFC,0x01B1,0xFFB9,0xFEF9,
+ 0x01B5,0xFFBC,0xFEF6,0x01B8,0xFFBF,0xFEF3,0x01BC,0xFFC1,0xFEF2,0x01BF,0xFFC4,0xFEF2,
+ 0x01C2,0xFFC7,0xFEF1,0x01C6,0xFFCA,0xFEF1,0x01C9,0xFFCD,0xFEF0,0x01CD,0xFFD0,0xFEF0,
+ 0x01D0,0xFFD3,0xFEEF,0x01D4,0xFFD5,0xFEEF,0x01D7,0xFFD8,0xFEEE,0x01DB,0xFFDB,0xFEEE,
+ 0x01DE,0xFFDE,0xFEED,0x01E1,0xFFE1,0xFEED,0x01E5,0xFFE4,0xFEEC,0x01E8,0xFFE6,0xFEEC,
+ 0x01EC,0xFFE9,0xFEEB,0x01EF,0xFFEC,0xFEEB,0x01F2,0xFFEF,0xFEEA,0x01F6,0xFFF2,0xFEEA,
+ 0x01F9,0xFFF5,0xFEEA,0x01FC,0xFFF7,0xFEE9,0x0200,0xFFFA,0xFEE9,0x0203,0xFFFD,0xFEE8,
+ 0x0206,0x0000,0xFEE8,0x020A,0x0000,0xFEE7,0x020D,0x0000,0xFEE7,0x0210,0x0001,0xFEE6,
+ 0x0214,0x0001,0xFEE6,0x0217,0x0002,0xFEE6,0x021A,0x0002,0xFEE5,0x021E,0x0003,0xFEE5,
+ 0x0221,0x0004,0xFEE4,0x0224,0x0004,0xFEE4,0x0227,0x0005,0xFEE4,0x022B,0x0006,0xFEE3,
+ 0x022E,0x0007,0xFEE3,0x0231,0x0008,0xFEE2,0x0234,0x0009,0xFEE2,0x0238,0x000A,0xFEE1,
+ 0x023B,0x000B,0xFEE1,0x023E,0x000C,0xFEE1,0x0241,0x000D,0xFEE0,0x0244,0x000E,0xFEE0,
+ 0x0248,0x000F,0xFEE0,0x024B,0x0010,0xFEDF,0x024E,0x0011,0xFEDF,0x0251,0x0012,0xFEDE,
+ 0x0254,0x0013,0xFEDE,0x0257,0x0015,0xFEDE,0x025B,0x0016,0xFEDD,0x025E,0x0017,0xFEDD,
+ 0x0261,0x0018,0xFEDD,0x0264,0x001A,0xFEDC,0x0267,0x001B,0xFEDC,0x026A,0x001C,0xFEDB,
+ 0x026D,0x001E,0xFEDB,0x0270,0x001F,0xFEDB,0x0274,0x0021,0xFEDA,0x0277,0x0022,0xFEDA,
+ 0x027A,0x0024,0xFEDA,0x027D,0x0025,0xFED9,0x0280,0x0027,0xFED9,0x0283,0x0028,0xFED9,
+ 0x0286,0x002A,0xFED8,0x0289,0x002B,0xFED8,0x028C,0x002D,0xFED8,0x028F,0x002E,0xFED7,
+ 0x0292,0x0030,0xFED7,0x0295,0x0032,0xFED7,0x0298,0x0033,0xFED6,0x029B,0x0035,0xFED6,
+ 0x029E,0x0037,0xFED6,0x02A1,0x0039,0xFED5,0x02A4,0x003A,0xFED5,0x02A7,0x003C,0xFED5,
+ 0x02AA,0x003E,0xFED4,0x02AD,0x0040,0xFED4,0x02B0,0x0041,0xFED4,0x02B3,0x0043,0xFED4,
+ 0x02B6,0x0045,0xFED3,0x02B9,0x0047,0xFED3,0x02BC,0x0049,0xFED3,0x02BE,0x004B,0xFED2,
+ 0x02C1,0x004D,0xFED2,0x02C4,0x004E,0xFED2,0x02C7,0x0050,0xFED2,0x02CA,0x0052,0xFED1,
+ 0x02CD,0x0054,0xFED1,0x02D0,0x0056,0xFED1,0x02D2,0x0058,0xFED0,0x02D5,0x005A,0xFED0,
+ 0x02D8,0x005C,0xFED0,0x02DB,0x005E,0xFED0,0x02DE,0x0060,0xFECF,0x02E1,0x0063,0xFECF,
+ 0x02E3,0x0065,0xFECF,0x02E6,0x0067,0xFECF,0x02E9,0x0069,0xFECE,0x02EC,0x006B,0xFECE,
+ 0x02EE,0x006D,0xFECE,0x02F1,0x006F,0xFECE,0x02F4,0x0071,0xFECD,0x02F7,0x0074,0xFECD,
+ 0x02F9,0x0076,0xFECD,0x02FC,0x0078,0xFECD,0x02FF,0x007A,0xFECC,0x0301,0x007D,0xFECC,
+ 0x0304,0x007F,0xFECC,0x0307,0x0081,0xFECC,0x0309,0x0083,0xFECC,0x030C,0x0086,0xFECB,
+ 0x030F,0x0088,0xFECB,0x0311,0x008A,0xFECB,0x0314,0x008D,0xFECB,0x0317,0x008F,0xFECA,
+ 0x0319,0x0091,0xFECA,0x031C,0x0094,0xFECA,0x031E,0x0096,0xFECA,0x0321,0x0099,0xFECA,
+ 0x0324,0x009B,0xFEC9,0x0326,0x009D,0xFEC9,0x0329,0x00A0,0xFEC9,0x032B,0x00A2,0xFEC9,
+ 0x032E,0x00A5,0xFEC9,0x0330,0x00A7,0xFEC8,0x0333,0x00AA,0xFEC8,0x0335,0x00AC,0xFEC8,
+ 0x0338,0x00AF,0xFEC8,0x033A,0x00B1,0xFEC8,0x033D,0x00B4,0xFEC8,0x033F,0x00B6,0xFEC7,
+ 0x0342,0x00B9,0xFEC7,0x0344,0x00BB,0xFEC7,0x0346,0x00BE,0xFEC7,0x0349,0x00C1,0xFEC7,
+ 0x034B,0x00C3,0xFEC7,0x034E,0x00C6,0xFEC6,0x0350,0x00C9,0xFEC6,0x0352,0x00CB,0xFEC6,
+ 0x0355,0x00CE,0xFEC6,0x0357,0x00D1,0xFEC6,0x0359,0x00D3,0xFEC6,0x035C,0x00D6,0xFEC5,
+ 0x035E,0x00D9,0xFEC5,0x0360,0x00DB,0xFEC5,0x0363,0x00DE,0xFEC5,0x0365,0x00E1,0xFEC5,
+ 0x0367,0x00E3,0xFEC5,0x036A,0x00E6,0xFEC5,0x036C,0x00E9,0xFEC4,0x036E,0x00EC,0xFEC4,
+ 0x0370,0x00EF,0xFEC4,0x0372,0x00F1,0xFEC4,0x0375,0x00F4,0xFEC4,0x0377,0x00F7,0xFEC4,
+ 0x0379,0x00FA,0xFEC4,0x037B,0x00FD,0xFEC4,0x037D,0x0100,0xFEC3,0x037F,0x0102,0xFEC3,
+ 0x0382,0x0105,0xFEC3,0x0384,0x0108,0xFEC3,0x0386,0x010B,0xFEC3,0x0388,0x010E,0xFEC3,
+ 0x038A,0x0111,0xFEC3,0x038C,0x0114,0xFEC3,0x038E,0x0117,0xFEC3,0x0390,0x011A,0xFEC3,
+ 0x0392,0x011D,0xFEC2,0x0394,0x0120,0xFEC2,0x0396,0x0123,0xFEC2,0x0398,0x0126,0xFEC2,
+ 0x039A,0x0129,0xFEC2,0x039C,0x012C,0xFEC2,0x039E,0x012F,0xFEC2,0x03A0,0x0132,0xFEC2,
+ 0x03A1,0x0135,0xFEC2,0x03A3,0x0138,0xFEC2,0x03A5,0x013B,0xFEC2,0x03A7,0x013E,0xFEC1,
+ 0x03A9,0x0141,0xFEC1,0x03AB,0x0144,0xFEC1,0x03AC,0x0147,0xFEC1,0x03AE,0x014A,0xFEC1,
+ 0x03B0,0x014D,0xFEC1,0x03B2,0x0151,0xFEC1,0x03B3,0x0154,0xFEC1,0x03B5,0x0157,0xFEC1,
+ 0x03B7,0x015A,0xFEC1,0x03B9,0x015D,0xFEC1,0x03BA,0x0160,0xFEC1,0x03BC,0x0164,0xFEC1,
+ 0x03BD,0x0167,0xFEC1,0x03BF,0x016A,0xFEC1,0x03C1,0x016D,0xFEC1,0x03C2,0x0170,0xFEC1,
+ 0x03C4,0x0174,0xFEC1,0x03C5,0x0177,0xFEC0,0x03C7,0x017A,0xFEC0,0x03C8,0x017D,0xFEC0,
+ 0x03CA,0x0181,0xFEC0,0x03CB,0x0184,0xFEC0,0x03CC,0x0187,0xFEC0,0x03CE,0x018B,0xFEC0,
+ 0x03CF,0x018E,0xFEC0,0x03D0,0x0191,0xFEC0,0x03D2,0x0195,0xFEC0,0x03D3,0x0198,0xFEC0,
+ 0x03D4,0x019B,0xFEC0,0x03D5,0x019F,0xFEC0,0x03D7,0x01A2,0xFEC0,0x03D8,0x01A5,0xFEC0,
+ 0x03D9,0x01A9,0xFEC0,0x03DA,0x01AC,0xFEC0,0x03DB,0x01AF,0xFEC0,0x03DC,0x01B3,0xFEC0,
+ 0x03DD,0x01B6,0xFEC0,0x03DE,0x01BA,0xFEC0,0x03DE,0x01BD,0xFEC0,0x03DF,0x01C1,0xFEC0,
+ 0x03E0,0x01C4,0xFEC0,0x03E1,0x01C8,0xFEC0,0x03E1,0x01CB,0xFEC0,0x03E2,0x01CF,0xFEC0,
+ 0x03E2,0x01D2,0xFEC0,0x03E1,0x01D3,0xFEC0,0x03DF,0x01D5,0xFEC0,0x03DD,0x01D6,0xFEC0,
+ 0x03DB,0x01D8,0xFEC0,0x03D9,0x01D9,0xFEC0,0x03D6,0x01DB,0xFEC0,0x03D4,0x01DC,0xFEC0,
+ 0x03D1,0x01DD,0xFEC0,0x03CE,0x01DF,0xFEC0,0x03CB,0x01E0,0xFEC0,0x03C8,0x01E2,0xFEC0,
+ 0x03C5,0x01E3,0xFEC0,0x03C2,0x01E4,0xFEC0,0x03BF,0x01E6,0xFEC0,0x03BC,0x01E7,0xFEC0,
+ 0x03B8,0x01E9,0xFEC0,0x03B5,0x01EA,0xFEC0,0x03B1,0x01EB,0xFEC0,0x03AE,0x01ED,0xFEC0,
+ 0x03AA,0x01EE,0xFEC0,0x03A7,0x01EF,0xFEC1,0x03A3,0x01F1,0xFEC1,0x039F,0x01F2,0xFEC1,
+ 0x039B,0x01F4,0xFEC1,0x0398,0x01F5,0xFEC1,0x0394,0x01F6,0xFEC1,0x0390,0x01F8,0xFEC1,
+ 0x038C,0x01F9,0xFEC1,0x0388,0x01FA,0xFEC1,0x0384,0x01FC,0xFEC1,0x0380,0x01FD,0xFEC1,
+ 0x037B,0x01FE,0xFEC1,0x0377,0x0200,0xFEC2,0x0373,0x0201,0xFEC2,0x036F,0x0202,0xFEC2,
+ 0x036B,0x0204,0xFEC2,0x0366,0x0205,0xFEC2,0x0362,0x0206,0xFEC2,0x035D,0x0207,0xFEC2,
+ 0x0359,0x0209,0xFEC2,0x0354,0x020A,0xFEC3,0x0350,0x020B,0xFEC3,0x034B,0x020D,0xFEC3,
+ 0x0347,0x020E,0xFEC3,0x0342,0x020F,0xFEC3,0x033E,0x0210,0xFEC3,0x0339,0x0212,0xFEC4,
+ 0x0334,0x0213,0xFEC4,0x0330,0x0214,0xFEC4,0x032B,0x0216,0xFEC4,0x0326,0x0217,0xFEC4,
+ 0x0321,0x0218,0xFEC4,0x031C,0x0219,0xFEC5,0x0318,0x021B,0xFEC5,0x0313,0x021C,0xFEC5,
+ 0x030E,0x021D,0xFEC5,0x0309,0x021E,0xFEC6,0x0304,0x0220,0xFEC6,0x02FF,0x0221,0xFEC6,
+ 0x02FA,0x0222,0xFEC6,0x02F5,0x0223,0xFEC6,0x02F0,0x0224,0xFEC7,0x02EB,0x0226,0xFEC7,
+ 0x02E6,0x0227,0xFEC7,0x02E0,0x0228,0xFEC8,0x02DB,0x0229,0xFEC8,0x02D6,0x022A,0xFEC8,
+ 0x02D1,0x022C,0xFEC8,0x02CC,0x022D,0xFEC9,0x02C6,0x022E,0xFEC9,0x02C1,0x022F,0xFEC9,
+ 0x02BC,0x0230,0xFEC9,0x02B6,0x0232,0xFECA,0x02B1,0x0233,0xFECA,0x02AC,0x0234,0xFECA,
+ 0x02A6,0x0235,0xFECB,0x02A1,0x0236,0xFECB,0x029C,0x0237,0xFECB,0x0296,0x0239,0xFECC,
+ 0x0291,0x023A,0xFECC,0x028B,0x023B,0xFECC,0x0286,0x023C,0xFECD,0x0280,0x023D,0xFECD,
+ 0x027A,0x023E,0xFECE,0x0275,0x023F,0xFECE,0x026F,0x0241,0xFECE,0x026A,0x0242,0xFECF,
+ 0x0264,0x0243,0xFECF,0x025E,0x0244,0xFECF,0x0259,0x0245,0xFED0,0x0253,0x0246,0xFED0,
+ 0x024D,0x0247,0xFED1,0x0248,0x0248,0xFED1,0x0242,0x0249,0xFED2,0x023C,0x024A,0xFED2,
+ 0x0236,0x024C,0xFED2,0x0231,0x024D,0xFED3,0x022B,0x024E,0xFED3,0x0225,0x024F,0xFED4,
+ 0x021F,0x0250,0xFED4,0x0219,0x0251,0xFED5,0x0213,0x0252,0xFED5,0x020D,0x0253,0xFED6,
+ 0x0207,0x0254,0xFED6,0x0202,0x0255,0xFED7,0x01FC,0x0256,0xFED7,0x01F6,0x0257,0xFED8,
+ 0x01F0,0x0258,0xFED8,0x01EA,0x0259,0xFED9,0x01E4,0x025A,0xFED9,0x01DE,0x025B,0xFEDA,
+ 0x01D7,0x025C,0xFEDA,0x01D1,0x025D,0xFEDB,0x01CB,0x025E,0xFEDB,0x01C5,0x025F,0xFEDC,
+ 0x01BF,0x0260,0xFEDC,0x01B9,0x0261,0xFEDD,0x01B3,0x0262,0xFEDE,0x01AD,0x0263,0xFEDE,
+ 0x01A6,0x0264,0xFEDF,0x01A0,0x0265,0xFEDF,0x019A,0x0266,0xFEE0,0x0195,0x0267,0xFEE1,
+ 0x0190,0x0268,0xFEE1,0x018B,0x0269,0xFEE2,0x0186,0x026A,0xFEE2,0x0181,0x026B,0xFEE3,
+ 0x017C,0x026C,0xFEE4,0x0177,0x026D,0xFEE4,0x0172,0x026E,0xFEE5,0x016E,0x026F,0xFEE6,
+ 0x0169,0x0270,0xFEE6,0x0164,0x0271,0xFEE7,0x015F,0x0272,0xFEE8,0x015A,0x0273,0xFEE8,
+ 0x0156,0x0274,0xFEE9,0x0151,0x0274,0xFEEA,0x014C,0x0275,0xFEEA,0x0148,0x0276,0xFEEB,
+ 0x0143,0x0277,0xFEEC,0x013E,0x0278,0xFEED,0x013A,0x0279,0xFEED,0x0135,0x027A,0xFEEE,
+ 0x0131,0x027B,0xFEEF,0x012C,0x027C,0xFEEF,0x0128,0x027C,0xFEF0,0x0123,0x027D,0xFEF1,
+ 0x011F,0x027E,0xFEF2,0x011A,0x027F,0xFEF3,0x0116,0x0280,0xFEF3,0x0112,0x0281,0xFEF4,
+ 0x010D,0x0282,0xFEF5,0x0109,0x0282,0xFEF6,0x0105,0x0283,0xFEF7,0x0101,0x0284,0xFEF7,
+ 0x00FC,0x0285,0xFEF8,0x00F8,0x0286,0xFEF9,0x00F4,0x0287,0xFEFA,0x00F0,0x0287,0xFEFB,
+ 0x00EC,0x0288,0xFEFC,0x00E8,0x0289,0xFEFC,0x00E4,0x028A,0xFEFD,0x00E0,0x028A,0xFEFE,
+ 0x00DC,0x028B,0xFEFF,0x00D8,0x028C,0xFF00,0x00D4,0x028D,0xFF01,0x00D0,0x028E,0xFF02,
+ 0x00CC,0x028E,0xFF03,0x00C8,0x028F,0xFF04,0x00C4,0x0290,0xFF04,0x00C0,0x0291,0xFF05,
+ 0x00BD,0x0291,0xFF06,0x00B9,0x0292,0xFF07,0x00B5,0x0293,0xFF08,0x00B1,0x0294,0xFF09,
+ 0x00AE,0x0294,0xFF0A,0x00AA,0x0295,0xFF0B,0x00A6,0x0296,0xFF0C,0x00A3,0x0296,0xFF0D,
+ 0x009F,0x0297,0xFF0E,0x009C,0x0298,0xFF0F,0x0098,0x0298,0xFF10,0x0095,0x0299,0xFF11,
+ 0x0091,0x029A,0xFF12,0x008E,0x029A,0xFF13,0x008B,0x029B,0xFF14,0x0087,0x029C,0xFF15,
+ 0x0084,0x029C,0xFF16,0x0081,0x029D,0xFF17,0x007D,0x029E,0xFF18,0x007A,0x029E,0xFF1A,
+ 0x0077,0x029F,0xFF1B,0x0074,0x02A0,0xFF1C,0x0071,0x02A0,0xFF1D,0x006E,0x02A1,0xFF1E,
+ 0x006B,0x02A1,0xFF1F,0x0068,0x02A2,0xFF20,0x0065,0x02A3,0xFF21,0x0062,0x02A3,0xFF22,
+ 0x005F,0x02A4,0xFF24,0x005C,0x02A4,0xFF25,0x0059,0x02A5,0xFF26,0x0056,0x02A5,0xFF27,
+ 0x0053,0x02A6,0xFF28,0x0051,0x02A7,0xFF29,0x004E,0x02A7,0xFF2B,0x004B,0x02A8,0xFF2C,
+ 0x0048,0x02A8,0xFF2D,0x0046,0x02A9,0xFF2E,0x0043,0x02A9,0xFF2F,0x0041,0x02AA,0xFF31,
+ 0x003E,0x02AA,0xFF32,0x003C,0x02AB,0xFF33,0x0039,0x02AB,0xFF34,0x0037,0x02AC,0xFF36,
+ 0x0035,0x02AC,0xFF37,0x0032,0x02AD,0xFF38,0x0030,0x02AD,0xFF39,0x002E,0x02AE,0xFF3B,
+ 0x002C,0x02AE,0xFF3C,0x0029,0x02AE,0xFF3D,0x0027,0x02AF,0xFF3F,0x0025,0x02AF,0xFF40,
+ 0x0023,0x02B0,0xFF41,0x0021,0x02B0,0xFF42,0x001F,0x02B1,0xFF44,0x001D,0x02B1,0xFF45,
+ 0x001B,0x02B1,0xFF47,0x001A,0x02B2,0xFF48,0x0018,0x02B2,0xFF49,0x0016,0x02B2,0xFF4B,
+ 0x0015,0x02B3,0xFF4C,0x0013,0x02B3,0xFF4F,0x0011,0x02B3,0xFF52,0x0010,0x02B4,0xFF55,
+ 0x000E,0x02B4,0xFF58,0x000D,0x02B4,0xFF5B,0x000C,0x02B5,0xFF5D,0x000A,0x02B5,0xFF60,
+ 0x0009,0x02B5,0xFF63,0x0008,0x02B6,0xFF66,0x0007,0x02B6,0xFF69,0x0006,0x02B6,0xFF6C,
+ 0x0005,0x02B6,0xFF6F,0x0004,0x02B7,0xFF72,0x0003,0x02B7,0xFF75,0x0002,0x02B7,0xFF78,
+ 0x0002,0x02B7,0xFF7A,0x0001,0x02B7,0xFF7D,0x0001,0x02B7,0xFF80,0x0000,0x02B8,0xFF83,
+ 0x0000,0x02B8,0xFF86,0xFFFD,0x02B8,0xFF89,0xFFFA,0x02B8,0xFF8C,0xFFF7,0x02B8,0xFF8F,
+ 0xFFF4,0x02B8,0xFF92,0xFFF1,0x02BA,0xFF95,0xFFEE,0x02BC,0xFF97,0xFFEB,0x02BE,0xFF9A,
+ 0xFFE9,0x02C0,0xFF9D,0xFFE6,0x02C1,0xFFA0,0xFFE3,0x02C3,0xFFA3,0xFFE0,0x02C5,0xFFA6,
+ 0xFFDD,0x02C7,0xFFA9,0xFFDB,0x02C9,0xFFAC,0xFFD8,0x02CB,0xFFAF,0xFFD5,0x02CC,0xFFB2,
+ 0xFFD3,0x02CE,0xFFB5,0xFFD0,0x02D0,0xFFB7,0xFFCE,0x02D2,0xFFBA,0xFFCB,0x02D4,0xFFBD,
+ 0xFFC9,0x02D6,0xFFC0,0xFFC6,0x02D7,0xFFC3,0xFFC4,0x02D9,0xFFC6,0xFFC2,0x02DB,0xFFC9,
+ 0xFFBF,0x02DD,0xFFCC,0xFFBD,0x02DF,0xFFCF,0xFFBB,0x02E0,0xFFD2,0xFFB9,0x02E2,0xFFD4,
+ 0xFFB6,0x02E4,0xFFD7,0xFFB4,0x02E6,0xFFDA,0xFFB2,0x02E8,0xFFDD,0xFFB0,0x02E9,0xFFE0,
+ 0xFFAE,0x02EB,0xFFE3,0xFFAD,0x02ED,0xFFE6,0xFFAB,0x02EF,0xFFE9,0xFFA9,0x02F0,0xFFEC,
+ 0xFFA8,0x02F2,0xFFEF,0xFFA6,0x02F4,0xFFF1,0xFFA5,0x02F6,0xFFF4,0xFFA4,0x02F7,0xFFF7,
+ 0xFFA3,0x02F9,0xFFFA,0xFFA3,0x02FB,0xFFFD,0xFFA3,0x02FC,0x0000,0xFFA3,0x02FE,0x0000,
+ 0xFFA3,0x0300,0x0001,0xFFA3,0x0302,0x0002,0xFFA4,0x0303,0x0002,0xFFA4,0x0305,0x0003,
+ 0xFFA4,0x0307,0x0005,0xFFA4,0x0308,0x0006,0xFFA4,0x030A,0x0007,0xFFA4,0x030C,0x0008,
+ 0xFFA4,0x030D,0x000A,0xFFA4,0x030F,0x000B,0xFFA4,0x0311,0x000D,0xFFA4,0x0312,0x000F,
+ 0xFFA4,0x0314,0x0010,0xFFA4,0x0316,0x0012,0xFFA5,0x0317,0x0014,0xFFA5,0x0319,0x0016,
+ 0xFFA5,0x031B,0x0018,0xFFA5,0x031C,0x001A,0xFFA5,0x031E,0x001C,0xFFA5,0x031F,0x001E,
+ 0xFFA5,0x0321,0x0020,0xFFA5,0x0323,0x0022,0xFFA5,0x0324,0x0024,0xFFA5,0x0326,0x0027,
+ 0xFFA5,0x0327,0x0029,0xFFA5,0x0329,0x002B,0xFFA6,0x032B,0x002E,0xFFA6,0x032C,0x0030,
+ 0xFFA6,0x032E,0x0033,0xFFA6,0x032F,0x0035,0xFFA6,0x0331,0x0038,0xFFA6,0x0332,0x003B,
+ 0xFFA6,0x0334,0x003D,0xFFA6,0x0335,0x0040,0xFFA6,0x0337,0x0043,0xFFA6,0x0339,0x0046,
+ 0xFFA6,0x033A,0x0048,0xFFA6,0x033C,0x004B,0xFFA6,0x033D,0x004E,0xFFA7,0x033F,0x0051,
+ 0xFFA7,0x0340,0x0054,0xFFA7,0x0342,0x0057,0xFFA7,0x0343,0x005A,0xFFA7,0x0345,0x005D,
+ 0xFFA7,0x0346,0x0061,0xFFA7,0x0348,0x0064,0xFFA7,0x0349,0x0067,0xFFA7,0x034B,0x006A,
+ 0xFFA7,0x034C,0x006D,0xFFA7,0x034E,0x0071,0xFFA7,0x034F,0x0074,0xFFA7,0x0350,0x0077,
+ 0xFFA8,0x0352,0x007B,0xFFA8,0x0353,0x007E,0xFFA8,0x0355,0x0082,0xFFA8,0x0356,0x0085,
+ 0xFFA8,0x0358,0x0089,0xFFA8,0x0359,0x008C,0xFFA8,0x035A,0x0090,0xFFA8,0x035C,0x0093,
+ 0xFFA8,0x035D,0x0097,0xFFA8,0x035F,0x009B,0xFFA8,0x0360,0x009E,0xFFA8,0x0361,0x00A2,
+ 0xFFA8,0x0363,0x00A6,0xFFA8,0x0364,0x00AA,0xFFA8,0x0366,0x00AE,0xFFA9,0x0367,0x00B1,
+ 0xFFA9,0x0368,0x00B5,0xFFA9,0x036A,0x00B9,0xFFA9,0x036B,0x00BD,0xFFA9,0x036C,0x00C1,
+ 0xFFA9,0x036E,0x00C5,0xFFA9,0x036F,0x00C9,0xFFA9,0x0370,0x00CD,0xFFA9,0x0372,0x00D1,
+ 0xFFA9,0x0373,0x00D5,0xFFA9,0x0374,0x00D9,0xFFA9,0x0376,0x00DD,0xFFA9,0x0377,0x00E2,
+ 0xFFA9,0x0378,0x00E6,0xFFAA,0x037A,0x00EA,0xFFAA,0x037B,0x00EE,0xFFAA,0x037C,0x00F2,
+ 0xFFAA,0x037D,0x00F7,0xFFAA,0x037F,0x00FB,0xFFAA,0x0380,0x00FF,0xFFAA,0x0381,0x0104,
+ 0xFFAA,0x0382,0x0108,0xFFAA,0x0384,0x010D,0xFFAA,0x0385,0x0111,0xFFAA,0x0386,0x0116,
+ 0xFFAA,0x0387,0x011A,0xFFAA,0x0389,0x011F,0xFFAA,0x038A,0x0123,0xFFAA,0x038B,0x0128,
+ 0xFFAA,0x038C,0x012C,0xFFAB,0x038D,0x0131,0xFFAB,0x038F,0x0135,0xFFAB,0x0390,0x013A,
+ 0xFFAB,0x0391,0x013F,0xFFAB,0x0392,0x0143,0xFFAB,0x0393,0x0148,0xFFAB,0x0394,0x014D,
+ 0xFFAB,0x0396,0x0152,0xFFAB,0x0397,0x0156,0xFFAB,0x0398,0x015B,0xFFAB,0x0399,0x0160,
+ 0xFFAB,0x039A,0x0165,0xFFAB,0x039B,0x016A,0xFFAB,0x039C,0x016F,0xFFAB,0x039D,0x0174,
+ 0xFFAB,0x039F,0x0179,0xFFAB,0x03A0,0x017E,0xFFAB,0x03A1,0x0183,0xFFAC,0x03A2,0x0188,
+ 0xFFAC,0x03A3,0x018D,0xFFAC,0x03A4,0x0192,0xFFAC,0x03A5,0x0197,0xFFAC,0x03A6,0x019C,
+ 0xFFAC,0x03A7,0x01A1,0xFFAC,0x03A8,0x01A6,0xFFAC,0x03A9,0x01AB,0xFFAC,0x03AA,0x01B0,
+ 0xFFAC,0x03AB,0x01B6,0xFFAC,0x03AC,0x01BB,0xFFAC,0x03AD,0x01C0,0xFFAC,0x03AE,0x01C5,
+ 0xFFAC,0x03AF,0x01CB,0xFFAC,0x03B0,0x01D0,0xFFAC,0x03B1,0x01D5,0xFFAC,0x03B2,0x01DB,
+ 0xFFAC,0x03B3,0x01E0,0xFFAC,0x03B4,0x01E5,0xFFAD,0x03B5,0x01EB,0xFFAD,0x03B6,0x01F0,
+ 0xFFAD,0x03B7,0x01F6,0xFFAD,0x03B8,0x01FB,0xFFAD,0x03B9,0x0201,0xFFAD,0x03BA,0x0206,
+ 0xFFAD,0x03BB,0x020C,0xFFAD,0x03BC,0x0211,0xFFAD,0x03BD,0x0217,0xFFAD,0x03BD,0x021C,
+ 0xFFAD,0x03BE,0x0222,0xFFAD,0x03BF,0x0228,0xFFAD,0x03C0,0x022D,0xFFAD,0x03C1,0x0233,
+ 0xFFAD,0x03C2,0x0238,0xFFAD,0x03C3,0x023E,0xFFAD,0x03C3,0x0244,0xFFAD,0x03C4,0x024A,
+ 0xFFAD,0x03C5,0x024F,0xFFAD,0x03C6,0x0255,0xFFAD,0x03C7,0x025B,0xFFAD,0x03C8,0x0261,
+ 0xFFAD,0x03C8,0x0267,0xFFAE,0x03C9,0x026C,0xFFAE,0x03CA,0x0272,0xFFAE,0x03CB,0x0278,
+ 0xFFAE,0x03CB,0x027E,0xFFAE,0x03CC,0x0284,0xFFAE,0x03CD,0x028A,0xFFAE,0x03CE,0x0290,
+ 0xFFAE,0x03CE,0x0296,0xFFAE,0x03CF,0x029C,0xFFAE,0x03D0,0x02A2,0xFFAE,0x03D1,0x02A8,
+ 0xFFAE,0x03D1,0x02AE,0xFFAE,0x03D2,0x02B4,0xFFAE,0x03D3,0x02BA,0xFFAE,0x03D3,0x02C0,
+ 0xFFAE,0x03D4,0x02C6,0xFFAE,0x03D5,0x02CC,0xFFAE,0x03D5,0x02D3,0xFFAE,0x03D6,0x02D9,
+ 0xFFAE,0x03D7,0x02DF,0xFFAE,0x03D7,0x02E5,0xFFAE,0x03D8,0x02EB,0xFFAE,0x03D8,0x02F2,
+ 0xFFAE,0x03D9,0x02F8,0xFFAE,0x03D9,0x02FE,0xFFAE,0x03DA,0x0304,0xFFAE,0x03DB,0x030B,
+ 0xFFAE,0x03DB,0x0311,0xFFAE,0x03DC,0x0317,0xFFAF,0x03DC,0x031E,0xFFAF,0x03DD,0x0324,
+ 0xFFAF,0x03DD,0x032A,0xFFAF,0x03DE,0x0331,0xFFAF,0x03DE,0x0337,0xFFAF,0x03DF,0x033E,
+ 0xFFAF,0x03DF,0x0344,0xFFAF,0x03E0,0x034B,0xFFAF,0x03E0,0x0351,0xFFAF,0x03E0,0x0358,
+ 0xFFAF,0x03E1,0x035E,0xFFAF,0x03E1,0x0365,0xFFAF,0x03E2,0x036B,0xFFAF,0x03E2,0x0372,
+ 0xFFAF,0x03E2,0x0378,0xFFAF,0x03E3,0x037F,0xFFAF,0x03E3,0x0386,0xFFAF,0x03E3,0x038C,
+ 0xFFAF,0x03E4,0x0393,0xFFAF,0x03E4,0x039A,0xFFAF,0x03E4,0x03A0,0xFFAF,0x03E5,0x03A7,
+ 0xFFAF,0x03E5,0x03AE,0xFFAF,0x03E5,0x03B4,0xFFAF,0x03E5,0x03BB,0xFFAF,0x03E5,0x03C2,
+ 0xFFAF,0x03E6,0x03C9,0xFFAF,0x03E6,0x03D0,0xFFAF,0x03E6,0x03D6,0xFFAF,0x03E6,0x03DD
};
#ifdef __STDC__
static signed short v_tbl[] = {
#else
static short v_tbl[] = {
#endif
- 0x0000,0x0005,0x000B,0x0010,0x0016,0x001B,0x0020,0x0026,
- 0x002B,0x0030,0x0036,0x003B,0x0040,0x0046,0x004B,0x0050,
- 0x0056,0x005B,0x0060,0x0066,0x006B,0x0070,0x0075,0x007B,
- 0x0080,0x0085,0x008A,0x008F,0x0095,0x009A,0x009F,0x00A4,
- 0x00A9,0x00AF,0x00B4,0x00B9,0x00BE,0x00C3,0x00C8,0x00CD,
- 0x00D2,0x00D8,0x00DD,0x00E2,0x00E7,0x00EC,0x00F1,0x00F6,
- 0x00FB,0x0100,0x0105,0x010A,0x010F,0x0114,0x0119,0x011E,
- 0x0123,0x0128,0x012D,0x0132,0x0137,0x013C,0x0141,0x0146,
- 0x014A,0x014F,0x0154,0x0159,0x015E,0x0163,0x0168,0x016D,
- 0x0171,0x0176,0x017B,0x0180,0x0185,0x0189,0x018E,0x0193,
- 0x0198,0x019C,0x01A1,0x01A6,0x01AB,0x01AF,0x01B4,0x01B9,
- 0x01BD,0x01C2,0x01C7,0x01CB,0x01D0,0x01D5,0x01D9,0x01DE,
- 0x01E2,0x01E7,0x01EB,0x01F0,0x01F5,0x01F9,0x01FE,0x0202,
- 0x0207,0x020B,0x0210,0x0214,0x0219,0x021D,0x0222,0x0226,
- 0x022A,0x022F,0x0233,0x0238,0x023C,0x0240,0x0245,0x0249,
- 0x024D,0x0252,0x0256,0x025A,0x025F,0x0263,0x0267,0x026C,
- 0x0270,0x0274,0x0278,0x027C,0x0281,0x0285,0x0289,0x028D,
- 0x0291,0x0296,0x029A,0x029E,0x02A2,0x02A6,0x02AA,0x02AE,
- 0x02B2,0x02B6,0x02BA,0x02BE,0x02C2,0x02C6,0x02CA,0x02CE,
- 0x02D2,0x02D6,0x02DA,0x02DE,0x02E2,0x02E6,0x02EA,0x02ED,
- 0x02F1,0x02F5,0x02F9,0x02FD,0x0300,0x0304,0x0308,0x030C,
- 0x030F,0x0313,0x0317,0x031B,0x031E,0x0322,0x0325,0x0329,
- 0x032D,0x0330,0x0334,0x0337,0x033B,0x033E,0x0342,0x0345,
- 0x0349,0x034C,0x0350,0x0353,0x0357,0x035A,0x035D,0x0361,
- 0x0364,0x0367,0x036B,0x036E,0x0371,0x0374,0x0378,0x037B,
- 0x037E,0x0381,0x0384,0x0387,0x038B,0x038E,0x0391,0x0394,
- 0x0397,0x039A,0x039D,0x03A0,0x03A2,0x03A5,0x03A8,0x03AB,
- 0x03AE,0x03B1,0x03B3,0x03B6,0x03B9,0x03BC,0x03BE,0x03C1,
- 0x03C4,0x03C6,0x03C9,0x03CB,0x03CE,0x03D0,0x03D3,0x03D5,
- 0x03D7,0x03DA,0x03DC,0x03DE,0x03E0,0x03E2,0x03E5,0x03E7,
- 0x03E9,0x03EB,0x03ED,0x03EE,0x03F0,0x03F2,0x03F4,0x03F5,
- 0x03F7,0x03F9,0x03FA,0x03FB,0x03FC,0x03FE,0x03FE,0x03FF
+ 0x0000,0x0005,0x000B,0x0010,0x0016,0x001B,0x0020,0x0026,
+ 0x002B,0x0030,0x0036,0x003B,0x0040,0x0046,0x004B,0x0050,
+ 0x0056,0x005B,0x0060,0x0066,0x006B,0x0070,0x0075,0x007B,
+ 0x0080,0x0085,0x008A,0x008F,0x0095,0x009A,0x009F,0x00A4,
+ 0x00A9,0x00AF,0x00B4,0x00B9,0x00BE,0x00C3,0x00C8,0x00CD,
+ 0x00D2,0x00D8,0x00DD,0x00E2,0x00E7,0x00EC,0x00F1,0x00F6,
+ 0x00FB,0x0100,0x0105,0x010A,0x010F,0x0114,0x0119,0x011E,
+ 0x0123,0x0128,0x012D,0x0132,0x0137,0x013C,0x0141,0x0146,
+ 0x014A,0x014F,0x0154,0x0159,0x015E,0x0163,0x0168,0x016D,
+ 0x0171,0x0176,0x017B,0x0180,0x0185,0x0189,0x018E,0x0193,
+ 0x0198,0x019C,0x01A1,0x01A6,0x01AB,0x01AF,0x01B4,0x01B9,
+ 0x01BD,0x01C2,0x01C7,0x01CB,0x01D0,0x01D5,0x01D9,0x01DE,
+ 0x01E2,0x01E7,0x01EB,0x01F0,0x01F5,0x01F9,0x01FE,0x0202,
+ 0x0207,0x020B,0x0210,0x0214,0x0219,0x021D,0x0222,0x0226,
+ 0x022A,0x022F,0x0233,0x0238,0x023C,0x0240,0x0245,0x0249,
+ 0x024D,0x0252,0x0256,0x025A,0x025F,0x0263,0x0267,0x026C,
+ 0x0270,0x0274,0x0278,0x027C,0x0281,0x0285,0x0289,0x028D,
+ 0x0291,0x0296,0x029A,0x029E,0x02A2,0x02A6,0x02AA,0x02AE,
+ 0x02B2,0x02B6,0x02BA,0x02BE,0x02C2,0x02C6,0x02CA,0x02CE,
+ 0x02D2,0x02D6,0x02DA,0x02DE,0x02E2,0x02E6,0x02EA,0x02ED,
+ 0x02F1,0x02F5,0x02F9,0x02FD,0x0300,0x0304,0x0308,0x030C,
+ 0x030F,0x0313,0x0317,0x031B,0x031E,0x0322,0x0325,0x0329,
+ 0x032D,0x0330,0x0334,0x0337,0x033B,0x033E,0x0342,0x0345,
+ 0x0349,0x034C,0x0350,0x0353,0x0357,0x035A,0x035D,0x0361,
+ 0x0364,0x0367,0x036B,0x036E,0x0371,0x0374,0x0378,0x037B,
+ 0x037E,0x0381,0x0384,0x0387,0x038B,0x038E,0x0391,0x0394,
+ 0x0397,0x039A,0x039D,0x03A0,0x03A2,0x03A5,0x03A8,0x03AB,
+ 0x03AE,0x03B1,0x03B3,0x03B6,0x03B9,0x03BC,0x03BE,0x03C1,
+ 0x03C4,0x03C6,0x03C9,0x03CB,0x03CE,0x03D0,0x03D3,0x03D5,
+ 0x03D7,0x03DA,0x03DC,0x03DE,0x03E0,0x03E2,0x03E5,0x03E7,
+ 0x03E9,0x03EB,0x03ED,0x03EE,0x03F0,0x03F2,0x03F4,0x03F5,
+ 0x03F7,0x03F9,0x03FA,0x03FB,0x03FC,0x03FE,0x03FE,0x03FF
};
static unsigned short grnsep[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
- 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
- 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
- 0x0001,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
- 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
- 0x0002,0x0002,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
- 0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
- 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
- 0x0004,0x0004,0x0004,0x0004,0x0005,0x0005,0x0005,0x0005,
- 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0006,
- 0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
- 0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
- 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
- 0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,
- 0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000B,0x000B,
- 0x000B,0x000B,0x000B,0x000B,0x000B,0x000C,0x000C,0x000C,
- 0x000C,0x000C,0x000C,0x000D,0x000D,0x000D,0x000D,0x000D,
- 0x000D,0x000E,0x000E,0x000E,0x000E,0x000E,0x000F,0x000F,
- 0x000F,0x000F,0x000F,0x000F,0x0010,0x0010,0x0010,0x0010,
- 0x0010,0x0011,0x0011,0x0011,0x0011,0x0011,0x0012,0x0012,
- 0x0012,0x0012,0x0012,0x0013,0x0013,0x0013,0x0013,0x0014,
- 0x0014,0x0014,0x0014,0x0014,0x0015,0x0015,0x0015,0x0015,
- 0x0015,0x0016,0x0016,0x0016,0x0016,0x0017,0x0017,0x0017,
- 0x0017,0x0018,0x0018,0x0018,0x0018,0x0018,0x0019,0x0019,
- 0x0019,0x0019,0x001A,0x001A,0x001A,0x001A,0x001B,0x001B,
- 0x001B,0x001B,0x001C,0x001C,0x001C,0x001C,0x001D,0x001D,
- 0x001D,0x001D,0x001E,0x001E,0x001E,0x001E,0x001F,0x001F,
- 0x001F,0x001F,0x0020,0x0020,0x0020,0x0021,0x0021,0x0021,
- 0x0021,0x0022,0x0022,0x0022,0x0022,0x0023,0x0023,0x0023,
- 0x0023,0x0024,0x0024,0x0024,0x0025,0x0025,0x0025,0x0025,
- 0x0026,0x0026,0x0026,0x0026,0x0027,0x0027,0x0027,0x0028,
- 0x0028,0x0028,0x0028,0x0029,0x0029,0x0029,0x0029,0x002A,
- 0x002A,0x002A,0x002B,0x002B,0x002B,0x002B,0x002C,0x002C,
- 0x002C,0x002D,0x002D,0x002D,0x002D,0x002E,0x002E,0x002E,
- 0x002E,0x002F,0x002F,0x002F,0x0030,0x0030,0x0030,0x0030,
- 0x0031,0x0031,0x0031,0x0032,0x0032,0x0032,0x0032,0x0033,
- 0x0033,0x0033,0x0033,0x0034,0x0034,0x0034,0x0035,0x0035,
- 0x0035,0x0035,0x0036,0x0036,0x0036,0x0036,0x0037,0x0037,
- 0x0037,0x0038,0x0038,0x0038,0x0038,0x0039,0x0039,0x0039,
- 0x0039,0x003A,0x003A,0x003A,0x003B,0x003B,0x003B,0x003B,
- 0x003C,0x003C,0x003C,0x003C,0x003D,0x003D,0x003D,0x003D,
- 0x003E,0x003E,0x003E,0x003E,0x003F,0x003F,0x003F,0x003F,
- 0x0040,0x0040,0x0040,0x0040,0x0041,0x0041,0x0041,0x0041,
- 0x0042,0x0042,0x0042,0x0042,0x0043,0x0043,0x0043,0x0043,
- 0x0044,0x0044,0x0044,0x0044,0x0045,0x0045,0x0045,0x0045,
- 0x0046,0x0046,0x0046,0x0046,0x0047,0x0047,0x0047,0x0047,
- 0x0047,0x0048,0x0048,0x0048,0x0048,0x0049,0x0049,0x0049,
- 0x0049,0x004A,0x004A,0x004A,0x004A,0x004A,0x004B,0x004B,
- 0x004B,0x004B,0x004B,0x004C,0x004C,0x004C,0x004C,0x004D,
- 0x004D,0x004D,0x004D,0x004D,0x004E,0x004E,0x004E,0x004E,
- 0x004E,0x004F,0x004F,0x004F,0x004F,0x004F,0x0050,0x0050,
- 0x0050,0x0050,0x0050,0x0050,0x0051,0x0051,0x0051,0x0051,
- 0x0051,0x0052,0x0052,0x0052,0x0052,0x0052,0x0052,0x0053,
- 0x0053,0x0053,0x0053,0x0053,0x0053,0x0054,0x0054,0x0054,
- 0x0054,0x0054,0x0054,0x0055,0x0055,0x0055,0x0055,0x0055,
- 0x0055,0x0055,0x0056,0x0056,0x0056,0x0056,0x0056,0x0056,
- 0x0056,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,
- 0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,
- 0x0058,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,
- 0x0059,0x0059,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,
- 0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005B,0x005B,
- 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,
- 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005C,
- 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
- 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
- 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
- 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
- 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005B,
- 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,
- 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005A,
- 0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,
- 0x005A,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,
- 0x0059,0x0059,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,
- 0x0058,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,
- 0x0056,0x0056,0x0056,0x0056,0x0056,0x0056,0x0055,0x0055,
- 0x0055,0x0055,0x0055,0x0055,0x0054,0x0054,0x0054,0x0054,
- 0x0054,0x0053,0x0053,0x0053,0x0053,0x0053,0x0052,0x0052,
- 0x0052,0x0052,0x0051,0x0051,0x0051,0x0051,0x0051,0x0050,
- 0x0050,0x0050,0x0050,0x004F,0x004F,0x004F,0x004F,0x004E,
- 0x004E,0x004E,0x004E,0x004D,0x004D,0x004D,0x004D,0x004C,
- 0x004C,0x004C,0x004C,0x004B,0x004B,0x004B,0x004B,0x004A,
- 0x004A,0x004A,0x004A,0x0049,0x0049,0x0049,0x0048,0x0048,
- 0x0048,0x0048,0x0047,0x0047,0x0047,0x0046,0x0046,0x0046,
- 0x0046,0x0045,0x0045,0x0045,0x0044,0x0044,0x0044,0x0044,
- 0x0043,0x0043,0x0043,0x0042,0x0042,0x0042,0x0041,0x0041,
- 0x0041,0x0041,0x0040,0x0040,0x0040,0x003F,0x003F,0x003F,
- 0x003E,0x003E,0x003E,0x003D,0x003D,0x003D,0x003D,0x003C,
- 0x003C,0x003C,0x003B,0x003B,0x003B,0x003A,0x003A,0x003A,
- 0x0039,0x0039,0x0039,0x0038,0x0038,0x0038,0x0038,0x0037,
- 0x0037,0x0037,0x0036,0x0036,0x0036,0x0035,0x0035,0x0035,
- 0x0034,0x0034,0x0034,0x0033,0x0033,0x0033,0x0033,0x0032,
- 0x0032,0x0032,0x0031,0x0031,0x0031,0x0030,0x0030,0x0030,
- 0x002F,0x002F,0x002F,0x002F,0x002E,0x002E,0x002E,0x002D,
- 0x002D,0x002D,0x002C,0x002C,0x002C,0x002C,0x002B,0x002B,
- 0x002B,0x002A,0x002A,0x002A,0x002A,0x0029,0x0029,0x0029,
- 0x0028,0x0028,0x0028,0x0028,0x0027,0x0027,0x0027,0x0026,
- 0x0026,0x0026,0x0026,0x0025,0x0025,0x0025,0x0025,0x0024,
- 0x0024,0x0024,0x0023,0x0023,0x0023,0x0023,0x0022,0x0022,
- 0x0022,0x0022,0x0021,0x0021,0x0021,0x0021,0x0020,0x0020,
- 0x0020,0x0020,0x001F,0x001F,0x001F,0x001F,0x001E,0x001E,
- 0x001E,0x001E,0x001D,0x001D,0x001D,0x001D,0x001D,0x001C,
- 0x001C,0x001C,0x001C,0x001B,0x001B,0x001B,0x001B,0x001B,
- 0x001A,0x001A,0x001A,0x001A,0x0019,0x0019,0x0019,0x0019,
- 0x0019,0x0018,0x0018,0x0018,0x0018,0x0018,0x0017,0x0017,
- 0x0017,0x0017,0x0017,0x0016,0x0016,0x0016,0x0016,0x0016,
- 0x0016,0x0015,0x0015,0x0015,0x0015,0x0015,0x0014,0x0014,
- 0x0014,0x0014,0x0014,0x0014,0x0013,0x0013,0x0013,0x0013,
- 0x0013,0x0013,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,
- 0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0010,
- 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x000F,0x000F,
- 0x000F,0x000F,0x000F,0x000F,0x000F,0x000E,0x000E,0x000E,
- 0x000E,0x000E,0x000E,0x000E,0x000E,0x000D,0x000D,0x000D,
- 0x000D,0x000D,0x000D,0x000D,0x000D,0x000C,0x000C,0x000C,
- 0x000C,0x000C,0x000C,0x000C,0x000C,0x000C,0x000B,0x000B,
- 0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,
- 0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,
- 0x000A,0x000A,0x000A,0x0009,0x0009,0x0009,0x0009,0x0009,
- 0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0008,0x0008,
- 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
- 0x0008,0x0008,0x0008,0x0007,0x0007,0x0007,0x0007,0x0007,
- 0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
- 0x0007,0x0007,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
- 0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
- 0x0006,0x0006,0x0006,0x0005,0x0005,0x0005,0x0005,0x0005,
- 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,
- 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
+ 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
+ 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
+ 0x0001,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
+ 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,
+ 0x0002,0x0002,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
+ 0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,0x0003,
+ 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,
+ 0x0004,0x0004,0x0004,0x0004,0x0005,0x0005,0x0005,0x0005,
+ 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0006,
+ 0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
+ 0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
+ 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
+ 0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,
+ 0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000B,0x000B,
+ 0x000B,0x000B,0x000B,0x000B,0x000B,0x000C,0x000C,0x000C,
+ 0x000C,0x000C,0x000C,0x000D,0x000D,0x000D,0x000D,0x000D,
+ 0x000D,0x000E,0x000E,0x000E,0x000E,0x000E,0x000F,0x000F,
+ 0x000F,0x000F,0x000F,0x000F,0x0010,0x0010,0x0010,0x0010,
+ 0x0010,0x0011,0x0011,0x0011,0x0011,0x0011,0x0012,0x0012,
+ 0x0012,0x0012,0x0012,0x0013,0x0013,0x0013,0x0013,0x0014,
+ 0x0014,0x0014,0x0014,0x0014,0x0015,0x0015,0x0015,0x0015,
+ 0x0015,0x0016,0x0016,0x0016,0x0016,0x0017,0x0017,0x0017,
+ 0x0017,0x0018,0x0018,0x0018,0x0018,0x0018,0x0019,0x0019,
+ 0x0019,0x0019,0x001A,0x001A,0x001A,0x001A,0x001B,0x001B,
+ 0x001B,0x001B,0x001C,0x001C,0x001C,0x001C,0x001D,0x001D,
+ 0x001D,0x001D,0x001E,0x001E,0x001E,0x001E,0x001F,0x001F,
+ 0x001F,0x001F,0x0020,0x0020,0x0020,0x0021,0x0021,0x0021,
+ 0x0021,0x0022,0x0022,0x0022,0x0022,0x0023,0x0023,0x0023,
+ 0x0023,0x0024,0x0024,0x0024,0x0025,0x0025,0x0025,0x0025,
+ 0x0026,0x0026,0x0026,0x0026,0x0027,0x0027,0x0027,0x0028,
+ 0x0028,0x0028,0x0028,0x0029,0x0029,0x0029,0x0029,0x002A,
+ 0x002A,0x002A,0x002B,0x002B,0x002B,0x002B,0x002C,0x002C,
+ 0x002C,0x002D,0x002D,0x002D,0x002D,0x002E,0x002E,0x002E,
+ 0x002E,0x002F,0x002F,0x002F,0x0030,0x0030,0x0030,0x0030,
+ 0x0031,0x0031,0x0031,0x0032,0x0032,0x0032,0x0032,0x0033,
+ 0x0033,0x0033,0x0033,0x0034,0x0034,0x0034,0x0035,0x0035,
+ 0x0035,0x0035,0x0036,0x0036,0x0036,0x0036,0x0037,0x0037,
+ 0x0037,0x0038,0x0038,0x0038,0x0038,0x0039,0x0039,0x0039,
+ 0x0039,0x003A,0x003A,0x003A,0x003B,0x003B,0x003B,0x003B,
+ 0x003C,0x003C,0x003C,0x003C,0x003D,0x003D,0x003D,0x003D,
+ 0x003E,0x003E,0x003E,0x003E,0x003F,0x003F,0x003F,0x003F,
+ 0x0040,0x0040,0x0040,0x0040,0x0041,0x0041,0x0041,0x0041,
+ 0x0042,0x0042,0x0042,0x0042,0x0043,0x0043,0x0043,0x0043,
+ 0x0044,0x0044,0x0044,0x0044,0x0045,0x0045,0x0045,0x0045,
+ 0x0046,0x0046,0x0046,0x0046,0x0047,0x0047,0x0047,0x0047,
+ 0x0047,0x0048,0x0048,0x0048,0x0048,0x0049,0x0049,0x0049,
+ 0x0049,0x004A,0x004A,0x004A,0x004A,0x004A,0x004B,0x004B,
+ 0x004B,0x004B,0x004B,0x004C,0x004C,0x004C,0x004C,0x004D,
+ 0x004D,0x004D,0x004D,0x004D,0x004E,0x004E,0x004E,0x004E,
+ 0x004E,0x004F,0x004F,0x004F,0x004F,0x004F,0x0050,0x0050,
+ 0x0050,0x0050,0x0050,0x0050,0x0051,0x0051,0x0051,0x0051,
+ 0x0051,0x0052,0x0052,0x0052,0x0052,0x0052,0x0052,0x0053,
+ 0x0053,0x0053,0x0053,0x0053,0x0053,0x0054,0x0054,0x0054,
+ 0x0054,0x0054,0x0054,0x0055,0x0055,0x0055,0x0055,0x0055,
+ 0x0055,0x0055,0x0056,0x0056,0x0056,0x0056,0x0056,0x0056,
+ 0x0056,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,
+ 0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,
+ 0x0058,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,
+ 0x0059,0x0059,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,
+ 0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005B,0x005B,
+ 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,
+ 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005C,
+ 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
+ 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
+ 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
+ 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,
+ 0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005C,0x005B,
+ 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,
+ 0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005B,0x005A,
+ 0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,0x005A,
+ 0x005A,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,0x0059,
+ 0x0059,0x0059,0x0058,0x0058,0x0058,0x0058,0x0058,0x0058,
+ 0x0058,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,0x0057,
+ 0x0056,0x0056,0x0056,0x0056,0x0056,0x0056,0x0055,0x0055,
+ 0x0055,0x0055,0x0055,0x0055,0x0054,0x0054,0x0054,0x0054,
+ 0x0054,0x0053,0x0053,0x0053,0x0053,0x0053,0x0052,0x0052,
+ 0x0052,0x0052,0x0051,0x0051,0x0051,0x0051,0x0051,0x0050,
+ 0x0050,0x0050,0x0050,0x004F,0x004F,0x004F,0x004F,0x004E,
+ 0x004E,0x004E,0x004E,0x004D,0x004D,0x004D,0x004D,0x004C,
+ 0x004C,0x004C,0x004C,0x004B,0x004B,0x004B,0x004B,0x004A,
+ 0x004A,0x004A,0x004A,0x0049,0x0049,0x0049,0x0048,0x0048,
+ 0x0048,0x0048,0x0047,0x0047,0x0047,0x0046,0x0046,0x0046,
+ 0x0046,0x0045,0x0045,0x0045,0x0044,0x0044,0x0044,0x0044,
+ 0x0043,0x0043,0x0043,0x0042,0x0042,0x0042,0x0041,0x0041,
+ 0x0041,0x0041,0x0040,0x0040,0x0040,0x003F,0x003F,0x003F,
+ 0x003E,0x003E,0x003E,0x003D,0x003D,0x003D,0x003D,0x003C,
+ 0x003C,0x003C,0x003B,0x003B,0x003B,0x003A,0x003A,0x003A,
+ 0x0039,0x0039,0x0039,0x0038,0x0038,0x0038,0x0038,0x0037,
+ 0x0037,0x0037,0x0036,0x0036,0x0036,0x0035,0x0035,0x0035,
+ 0x0034,0x0034,0x0034,0x0033,0x0033,0x0033,0x0033,0x0032,
+ 0x0032,0x0032,0x0031,0x0031,0x0031,0x0030,0x0030,0x0030,
+ 0x002F,0x002F,0x002F,0x002F,0x002E,0x002E,0x002E,0x002D,
+ 0x002D,0x002D,0x002C,0x002C,0x002C,0x002C,0x002B,0x002B,
+ 0x002B,0x002A,0x002A,0x002A,0x002A,0x0029,0x0029,0x0029,
+ 0x0028,0x0028,0x0028,0x0028,0x0027,0x0027,0x0027,0x0026,
+ 0x0026,0x0026,0x0026,0x0025,0x0025,0x0025,0x0025,0x0024,
+ 0x0024,0x0024,0x0023,0x0023,0x0023,0x0023,0x0022,0x0022,
+ 0x0022,0x0022,0x0021,0x0021,0x0021,0x0021,0x0020,0x0020,
+ 0x0020,0x0020,0x001F,0x001F,0x001F,0x001F,0x001E,0x001E,
+ 0x001E,0x001E,0x001D,0x001D,0x001D,0x001D,0x001D,0x001C,
+ 0x001C,0x001C,0x001C,0x001B,0x001B,0x001B,0x001B,0x001B,
+ 0x001A,0x001A,0x001A,0x001A,0x0019,0x0019,0x0019,0x0019,
+ 0x0019,0x0018,0x0018,0x0018,0x0018,0x0018,0x0017,0x0017,
+ 0x0017,0x0017,0x0017,0x0016,0x0016,0x0016,0x0016,0x0016,
+ 0x0016,0x0015,0x0015,0x0015,0x0015,0x0015,0x0014,0x0014,
+ 0x0014,0x0014,0x0014,0x0014,0x0013,0x0013,0x0013,0x0013,
+ 0x0013,0x0013,0x0012,0x0012,0x0012,0x0012,0x0012,0x0012,
+ 0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011,0x0010,
+ 0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x000F,0x000F,
+ 0x000F,0x000F,0x000F,0x000F,0x000F,0x000E,0x000E,0x000E,
+ 0x000E,0x000E,0x000E,0x000E,0x000E,0x000D,0x000D,0x000D,
+ 0x000D,0x000D,0x000D,0x000D,0x000D,0x000C,0x000C,0x000C,
+ 0x000C,0x000C,0x000C,0x000C,0x000C,0x000C,0x000B,0x000B,
+ 0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,0x000B,
+ 0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,0x000A,
+ 0x000A,0x000A,0x000A,0x0009,0x0009,0x0009,0x0009,0x0009,
+ 0x0009,0x0009,0x0009,0x0009,0x0009,0x0009,0x0008,0x0008,
+ 0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
+ 0x0008,0x0008,0x0008,0x0007,0x0007,0x0007,0x0007,0x0007,
+ 0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,0x0007,
+ 0x0007,0x0007,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
+ 0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,0x0006,
+ 0x0006,0x0006,0x0006,0x0005,0x0005,0x0005,0x0005,0x0005,
+ 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,
+ 0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005,0x0005
};
static unsigned short grnsep2[] = {
- 0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
- 0x0001,0x0001,0x0001,0x0001,0x0001,0x0002,0x0002,0x0002,
- 0x0002,0x0002,0x0002,0x0003,0x0003,0x0003,0x0003,0x0004,
- 0x0004,0x0004,0x0005,0x0005,0x0006,0x0006,0x0007,0x0007,
- 0x0008,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,
- 0x000F,0x0010,0x0011,0x0013,0x0014,0x0016,0x0017,0x0019,
- 0x001B,0x001D,0x0020,0x0022,0x0025,0x0027,0x002A,0x002E,
- 0x0031,0x0035,0x0038,0x003D,0x0041,0x0046,0x004B,0x0050,
- 0x0056,0x005C,0x0063,0x006A,0x0071,0x0079,0x0081,0x008A,
- 0x0094,0x009E,0x00A9,0x00B4,0x00C0,0x00CD,0x00DB,0x00E9,
- 0x00F8,0x0109,0x011A,0x012C,0x013F,0x0153,0x0169,0x0180,
- 0x0197,0x01B1,0x01CC,0x01E8,0x0206,0x0225,0x0246,0x0269,
- 0x028E,0x02B4,0x02DD,0x0308,0x0334,0x0364,0x0395,0x03C9,
- 0x0400,0x043A,0x0476,0x04B5,0x04F7,0x053C,0x0585,0x05D1,
- 0x0620,0x0674,0x06CB,0x0725,0x0784,0x07E7,0x084F,0x08BB,
- 0x092B,0x09A1,0x0A1B,0x0A9A,0x0B1F,0x0BA9,0x0C39,0x0CCE,
- 0x0D69,0x0E0A,0x0EB2,0x0F60,0x1014,0x10CF,0x1191,0x125A,
- 0x132B,0x1402,0x14E2,0x15C9,0x16B7,0x17AE,0x18AD,0x19B5,
- 0x1AC5,0x1BDE,0x1CFF,0x1E2A,0x1F5D,0x209A,0x21E0,0x2330,
- 0x2489,0x25EC,0x2759,0x28D0,0x2A51,0x2BDC,0x2D71,0x2F11,
- 0x30BB,0x326F,0x342E,0x35F7,0x37CB,0x39A9,0x3B92,0x3D86,
- 0x3F84,0x418C,0x439F,0x45BC,0x47E3,0x4A15,0x4C50,0x4E96,
- 0x50E6,0x533F,0x55A2,0x580E,0x5A83,0x5D02,0x5F89,0x6219,
- 0x64B1,0x6751,0x69F9,0x6CA8,0x6F5F,0x721C,0x74E0,0x77AA,
- 0x7A79,0x7D4E,0x8028,0x8307,0x85E9,0x88D0,0x8BB9,0x8EA5,
- 0x9193,0x9484,0x9775,0x9A67,0x9D59,0xA04B,0xA33C,0xA62B,
- 0xA918,0xAC03,0xAEEA,0xB1CE,0xB4AD,0xB787,0xBA5B,0xBD29,
- 0xBFF0,0xC2B0,0xC568,0xC817,0xCABC,0xCD58,0xCFE9,0xD26E,
- 0xD4E8,0xD756,0xD9B7,0xDC0A,0xDE4E,0xE085,0xE2AC,0xE4C3,
- 0xE6CA,0xE8C0,0xEAA4,0xEC77,0xEE37,0xEFE5,0xF17F,0xF306,
- 0xF479,0xF5D7,0xF720,0xF854,0xF973,0xFA7C,0xFB6F,0xFC4B,
- 0xFD11,0xFDC1,0xFE59,0xFEDA,0xFF44,0xFF96,0xFFD1,0xFFF4,
- 0xFFFF,0xFFF4,0xFFD1,0xFF96,0xFF44,0xFEDA,0xFE59,0xFDC1,
- 0xFD11,0xFC4B,0xFB6F,0xFA7C,0xF973,0xF854,0xF720,0xF5D7,
- 0xF479,0xF306,0xF17F,0xEFE5,0xEE37,0xEC77,0xEAA4,0xE8C0,
- 0xE6CA,0xE4C3,0xE2AC,0xE085,0xDE4E,0xDC0A,0xD9B7,0xD756,
- 0xD4E8,0xD26E,0xCFE9,0xCD58,0xCABC,0xC817,0xC568,0xC2B0,
- 0xBFF0,0xBD29,0xBA5B,0xB787,0xB4AD,0xB1CE,0xAEEA,0xAC03,
- 0xA918,0xA62B,0xA33C,0xA04B,0x9D59,0x9A67,0x9775,0x9484,
- 0x9193,0x8EA5,0x8BB9,0x88D0,0x85E9,0x8307,0x8028,0x7D4E,
- 0x7A79,0x77AA,0x74E0,0x721C,0x6F5F,0x6CA8,0x69F9,0x6751,
- 0x64B1,0x6219,0x5F89,0x5D02,0x5A83,0x580E,0x55A2,0x533F,
- 0x50E6,0x4E96,0x4C50,0x4A15,0x47E3,0x45BC,0x439F,0x418C,
- 0x3F84,0x3D86,0x3B92,0x39A9,0x37CB,0x35F7,0x342E,0x326F,
- 0x30BB,0x2F11,0x2D71,0x2BDC,0x2A51,0x28D0,0x2759,0x25EC,
- 0x2489,0x2330,0x21E0,0x209A,0x1F5D,0x1E2A,0x1CFF,0x1BDE,
- 0x1AC5,0x19B5,0x18AD,0x17AE,0x16B7,0x15C9,0x14E2,0x1402,
- 0x132B,0x125A,0x1191,0x10CF,0x1014,0x0F60,0x0EB2,0x0E0A,
- 0x0D69,0x0CCE,0x0C39,0x0BA9,0x0B1F,0x0A9A,0x0A1B,0x09A1,
- 0x092B,0x08BB,0x084F,0x07E7,0x0784,0x0725,0x06CB,0x0674,
- 0x0620,0x05D1,0x0585,0x053C,0x04F7,0x04B5,0x0476,0x043A,
- 0x0400,0x03C9,0x0395,0x0364,0x0334,0x0308,0x02DD,0x02B4,
- 0x028E,0x0269,0x0246,0x0225,0x0206,0x01E8,0x01CC,0x01B1,
- 0x0197,0x0180,0x0169,0x0153,0x013F,0x012C,0x011A,0x0109,
- 0x00F8,0x00E9,0x00DB,0x00CD,0x00C0,0x00B4,0x00A9,0x009E,
- 0x0094,0x008A,0x0081,0x0079,0x0071,0x006A,0x0063,0x005C,
- 0x0056,0x0050,0x004B,0x0046,0x0041,0x003D,0x0038,0x0035,
- 0x0031,0x002E,0x002A,0x0027,0x0025,0x0022,0x0020,0x001D,
- 0x001B,0x0019,0x0017,0x0016,0x0014,0x0013,0x0011,0x0010,
- 0x000F,0x000E,0x000D,0x000C,0x000B,0x000A,0x0009,0x0008,
- 0x0008,0x0007,0x0007,0x0006,0x0006,0x0005,0x0005,0x0004,
- 0x0004,0x0004,0x0003,0x0003,0x0003,0x0003,0x0002,0x0002,
- 0x0002,0x0002,0x0002,0x0002,0x0001,0x0001,0x0001,0x0001,
- 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001
+ 0x0000,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
+ 0x0001,0x0001,0x0001,0x0001,0x0001,0x0002,0x0002,0x0002,
+ 0x0002,0x0002,0x0002,0x0003,0x0003,0x0003,0x0003,0x0004,
+ 0x0004,0x0004,0x0005,0x0005,0x0006,0x0006,0x0007,0x0007,
+ 0x0008,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,
+ 0x000F,0x0010,0x0011,0x0013,0x0014,0x0016,0x0017,0x0019,
+ 0x001B,0x001D,0x0020,0x0022,0x0025,0x0027,0x002A,0x002E,
+ 0x0031,0x0035,0x0038,0x003D,0x0041,0x0046,0x004B,0x0050,
+ 0x0056,0x005C,0x0063,0x006A,0x0071,0x0079,0x0081,0x008A,
+ 0x0094,0x009E,0x00A9,0x00B4,0x00C0,0x00CD,0x00DB,0x00E9,
+ 0x00F8,0x0109,0x011A,0x012C,0x013F,0x0153,0x0169,0x0180,
+ 0x0197,0x01B1,0x01CC,0x01E8,0x0206,0x0225,0x0246,0x0269,
+ 0x028E,0x02B4,0x02DD,0x0308,0x0334,0x0364,0x0395,0x03C9,
+ 0x0400,0x043A,0x0476,0x04B5,0x04F7,0x053C,0x0585,0x05D1,
+ 0x0620,0x0674,0x06CB,0x0725,0x0784,0x07E7,0x084F,0x08BB,
+ 0x092B,0x09A1,0x0A1B,0x0A9A,0x0B1F,0x0BA9,0x0C39,0x0CCE,
+ 0x0D69,0x0E0A,0x0EB2,0x0F60,0x1014,0x10CF,0x1191,0x125A,
+ 0x132B,0x1402,0x14E2,0x15C9,0x16B7,0x17AE,0x18AD,0x19B5,
+ 0x1AC5,0x1BDE,0x1CFF,0x1E2A,0x1F5D,0x209A,0x21E0,0x2330,
+ 0x2489,0x25EC,0x2759,0x28D0,0x2A51,0x2BDC,0x2D71,0x2F11,
+ 0x30BB,0x326F,0x342E,0x35F7,0x37CB,0x39A9,0x3B92,0x3D86,
+ 0x3F84,0x418C,0x439F,0x45BC,0x47E3,0x4A15,0x4C50,0x4E96,
+ 0x50E6,0x533F,0x55A2,0x580E,0x5A83,0x5D02,0x5F89,0x6219,
+ 0x64B1,0x6751,0x69F9,0x6CA8,0x6F5F,0x721C,0x74E0,0x77AA,
+ 0x7A79,0x7D4E,0x8028,0x8307,0x85E9,0x88D0,0x8BB9,0x8EA5,
+ 0x9193,0x9484,0x9775,0x9A67,0x9D59,0xA04B,0xA33C,0xA62B,
+ 0xA918,0xAC03,0xAEEA,0xB1CE,0xB4AD,0xB787,0xBA5B,0xBD29,
+ 0xBFF0,0xC2B0,0xC568,0xC817,0xCABC,0xCD58,0xCFE9,0xD26E,
+ 0xD4E8,0xD756,0xD9B7,0xDC0A,0xDE4E,0xE085,0xE2AC,0xE4C3,
+ 0xE6CA,0xE8C0,0xEAA4,0xEC77,0xEE37,0xEFE5,0xF17F,0xF306,
+ 0xF479,0xF5D7,0xF720,0xF854,0xF973,0xFA7C,0xFB6F,0xFC4B,
+ 0xFD11,0xFDC1,0xFE59,0xFEDA,0xFF44,0xFF96,0xFFD1,0xFFF4,
+ 0xFFFF,0xFFF4,0xFFD1,0xFF96,0xFF44,0xFEDA,0xFE59,0xFDC1,
+ 0xFD11,0xFC4B,0xFB6F,0xFA7C,0xF973,0xF854,0xF720,0xF5D7,
+ 0xF479,0xF306,0xF17F,0xEFE5,0xEE37,0xEC77,0xEAA4,0xE8C0,
+ 0xE6CA,0xE4C3,0xE2AC,0xE085,0xDE4E,0xDC0A,0xD9B7,0xD756,
+ 0xD4E8,0xD26E,0xCFE9,0xCD58,0xCABC,0xC817,0xC568,0xC2B0,
+ 0xBFF0,0xBD29,0xBA5B,0xB787,0xB4AD,0xB1CE,0xAEEA,0xAC03,
+ 0xA918,0xA62B,0xA33C,0xA04B,0x9D59,0x9A67,0x9775,0x9484,
+ 0x9193,0x8EA5,0x8BB9,0x88D0,0x85E9,0x8307,0x8028,0x7D4E,
+ 0x7A79,0x77AA,0x74E0,0x721C,0x6F5F,0x6CA8,0x69F9,0x6751,
+ 0x64B1,0x6219,0x5F89,0x5D02,0x5A83,0x580E,0x55A2,0x533F,
+ 0x50E6,0x4E96,0x4C50,0x4A15,0x47E3,0x45BC,0x439F,0x418C,
+ 0x3F84,0x3D86,0x3B92,0x39A9,0x37CB,0x35F7,0x342E,0x326F,
+ 0x30BB,0x2F11,0x2D71,0x2BDC,0x2A51,0x28D0,0x2759,0x25EC,
+ 0x2489,0x2330,0x21E0,0x209A,0x1F5D,0x1E2A,0x1CFF,0x1BDE,
+ 0x1AC5,0x19B5,0x18AD,0x17AE,0x16B7,0x15C9,0x14E2,0x1402,
+ 0x132B,0x125A,0x1191,0x10CF,0x1014,0x0F60,0x0EB2,0x0E0A,
+ 0x0D69,0x0CCE,0x0C39,0x0BA9,0x0B1F,0x0A9A,0x0A1B,0x09A1,
+ 0x092B,0x08BB,0x084F,0x07E7,0x0784,0x0725,0x06CB,0x0674,
+ 0x0620,0x05D1,0x0585,0x053C,0x04F7,0x04B5,0x0476,0x043A,
+ 0x0400,0x03C9,0x0395,0x0364,0x0334,0x0308,0x02DD,0x02B4,
+ 0x028E,0x0269,0x0246,0x0225,0x0206,0x01E8,0x01CC,0x01B1,
+ 0x0197,0x0180,0x0169,0x0153,0x013F,0x012C,0x011A,0x0109,
+ 0x00F8,0x00E9,0x00DB,0x00CD,0x00C0,0x00B4,0x00A9,0x009E,
+ 0x0094,0x008A,0x0081,0x0079,0x0071,0x006A,0x0063,0x005C,
+ 0x0056,0x0050,0x004B,0x0046,0x0041,0x003D,0x0038,0x0035,
+ 0x0031,0x002E,0x002A,0x0027,0x0025,0x0022,0x0020,0x001D,
+ 0x001B,0x0019,0x0017,0x0016,0x0014,0x0013,0x0011,0x0010,
+ 0x000F,0x000E,0x000D,0x000C,0x000B,0x000A,0x0009,0x0008,
+ 0x0008,0x0007,0x0007,0x0006,0x0006,0x0005,0x0005,0x0004,
+ 0x0004,0x0004,0x0003,0x0003,0x0003,0x0003,0x0002,0x0002,
+ 0x0002,0x0002,0x0002,0x0002,0x0001,0x0001,0x0001,0x0001,
+ 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001
};
static short esp_dat_c[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x004A,0x0050,0x0056,0x005B,0x0061,0x0067,0x006C,
- 0x0072,0x0078,0x007D,0x0083,0x0089,0x008F,0x0095,0x009B,
- 0x00A0,0x00A6,0x00AC,0x00B2,0x00B8,0x00BE,0x00C4,0x00CA,
- 0x00D0,0x00D6,0x00DC,0x00E2,0x00E8,0x00EE,0x00F5,0x00FB,
- 0x0101,0x0107,0x010D,0x0113,0x011A,0x0120,0x0126,0x012D,
- 0x0133,0x0139,0x013F,0x0146,0x014C,0x0153,0x0159,0x015F,
- 0x0166,0x016C,0x0173,0x0179,0x0180,0x0186,0x018D,0x0193,
- 0x019A,0x01A1,0x01A7,0x01AE,0x01B5,0x01BB,0x01C2,0x01C9,
- 0x01CF,0x01D6,0x01DD,0x01E3,0x01EA,0x01F1,0x01F8,0x01FF,
- 0x0205,0x020C,0x0213,0x021A,0x0221,0x0228,0x022F,0x0236,
- 0x023D,0x0243,0x024A,0x0251,0x0258,0x025F,0x0266,0x026D,
- 0x0274,0x027C,0x0283,0x028A,0x0291,0x0298,0x029F,0x02A6,
- 0x02AD,0x02B4,0x02BC,0x02C3,0x02CA,0x02D1,0x02D8,0x02E0,
- 0x02E7,0x02EE,0x02F5,0x02FD,0x0304,0x030B,0x0312,0x031A,
- 0x0321,0x0328,0x0330,0x0337,0x033E,0x0346,0x034D,0x0355,
- 0x035C,0x0363,0x036B,0x0372,0x037A,0x0381,0x0389,0x0390,
- 0x0398,0x039F,0x03A7,0x03AE,0x03B6,0x03BD,0x03C5,0x03CC,
- 0x03D4,0x03DB,0x03E3,0x03EA,0x03F2,0x03F9,0x0401,0x0409,
- 0x0410,0x0418,0x041F,0x0427,0x042F,0x0436,0x043E,0x0445,
- 0x044D,0x0455,0x045C,0x0464,0x046C,0x0473,0x047B,0x0483,
- 0x048A,0x0492,0x049A,0x04A1,0x04A9,0x04B1,0x04B9,0x04C0,
- 0x04C8,0x04D0,0x04D7,0x04DF,0x04E7,0x04EF,0x04F6,0x04FE,
- 0x0506,0x050E,0x0515,0x051D,0x0525,0x052D,0x0534,0x053C,
- 0x0544,0x054C,0x0553,0x055B,0x0563,0x056B,0x0572,0x057A,
- 0x0582,0x058A,0x0592,0x0599,0x05A1,0x05A9,0x05B1,0x05B9,
- 0x05C0,0x05C8,0x05D0,0x05D8,0x05DF,0x05E7,0x05EF,0x05F7,
- 0x05FF,0x0606,0x060E,0x0616,0x061E,0x0626,0x062D,0x0635,
- 0x063D,0x0645,0x064D,0x0654,0x065C,0x0664,0x066C,0x0674,
- 0x067B,0x0683,0x068B,0x0693,0x069B,0x06A2,0x06AA,0x06B2,
- 0x06BA,0x06C1,0x06C9,0x06D1,0x06D9,0x06E1,0x06E8,0x06F0,
- 0x06F8,0x0700,0x0707,0x070F,0x0717,0x071F,0x0727,0x072E,
- 0x0736,0x073E,0x0746,0x074D,0x0755,0x075D,0x0765,0x076C,
- 0x0774,0x077C,0x0783,0x078B,0x0793,0x079B,0x07A2,0x07AA,
- 0x07B2,0x07BA,0x07C1,0x07C9,0x07D1,0x07D8,0x07E0,0x07E8,
- 0x07F0,0x07F7,0x07FF,0x0807,0x080E,0x0816,0x081E,0x0825,
- 0x082D,0x0835,0x083C,0x0844,0x084C,0x0853,0x085B,0x0863,
- 0x086A,0x0872,0x087A,0x0881,0x0889,0x0891,0x0898,0x08A0,
- 0x08A7,0x08AF,0x08B7,0x08BE,0x08C6,0x08CE,0x08D5,0x08DD,
- 0x08E4,0x08EC,0x08F4,0x08FB,0x0903,0x090A,0x0912,0x091A,
- 0x0921,0x0929,0x0930,0x0938,0x093F,0x0947,0x094F,0x0956,
- 0x095E,0x0965,0x096D,0x0974,0x097C,0x0983,0x098B,0x0993,
- 0x099A,0x09A2,0x09A9,0x09B1,0x09B8,0x09C0,0x09C7,0x09CF,
- 0x09D6,0x09DE,0x09E5,0x09ED,0x09F4,0x09FC,0x0A03,0x0A0B,
- 0x0A12,0x0A1A,0x0A21,0x0A29,0x0A30,0x0A38,0x0A3F,0x0A47,
- 0x0A4E,0x0A56,0x0A5D,0x0A65,0x0A6C,0x0A74,0x0A7B,0x0A83,
- 0x0A8A,0x0A92,0x0A99,0x0AA1,0x0AA8,0x0AB0,0x0AB7,0x0ABE,
- 0x0AC6,0x0ACD,0x0AD5,0x0ADC,0x0AE4,0x0AEB,0x0AF3,0x0AFA,
- 0x0B02,0x0B09,0x0B11,0x0B18,0x0B1F,0x0B27,0x0B2E,0x0B36,
- 0x0B3D,0x0B45,0x0B4C,0x0B54,0x0B5B,0x0B63,0x0B6A,0x0B71,
- 0x0B79,0x0B80,0x0B88,0x0B8F,0x0B97,0x0B9E,0x0BA6,0x0BAD,
- 0x0BB4,0x0BBC,0x0BC3,0x0BCB,0x0BD2,0x0BDA,0x0BE1,0x0BE9,
- 0x0BF0,0x0BF8,0x0BFF,0x0C07,0x0C0E,0x0C15,0x0C1D,0x0C24,
- 0x0C2C,0x0C33,0x0C3B,0x0C42,0x0C4A,0x0C51,0x0C59,0x0C60,
- 0x0C68,0x0C6F,0x0C77,0x0C7E,0x0C86,0x0C8D,0x0C95,0x0C9C,
- 0x0CA4,0x0CAB,0x0CB3,0x0CBA,0x0CC2,0x0CC9,0x0CD1,0x0CD8,
- 0x0CE0,0x0CE8,0x0CEF,0x0CF7,0x0CFE,0x0D06,0x0D0D,0x0D15,
- 0x0D1C,0x0D24,0x0D2C,0x0D33,0x0D3B,0x0D42,0x0D4A,0x0D52,
- 0x0D59,0x0D61,0x0D68,0x0D70,0x0D78,0x0D7F,0x0D87,0x0D8E,
- 0x0D96,0x0D9E,0x0DA5,0x0DAD,0x0DB5,0x0DBC,0x0DC4,0x0DCC,
- 0x0DD3,0x0DDB,0x0DE3,0x0DEB,0x0DF2,0x0DFA,0x0E02,0x0E0A,
- 0x0E11,0x0E19,0x0E21,0x0E29,0x0E30,0x0E38,0x0E40,0x0E48,
- 0x0E4F,0x0E57,0x0E5F,0x0E67,0x0E6F,0x0E77,0x0E7E,0x0E86,
- 0x0E8E,0x0E96,0x0E9E,0x0EA6,0x0EAE,0x0EB6,0x0EBE,0x0EC6,
- 0x0ECD,0x0ED5,0x0EDD,0x0EE5,0x0EED,0x0EF5,0x0EFD,0x0F05,
- 0x0F0D,0x0F15,0x0F1D,0x0F25,0x0F2E,0x0F36,0x0F3E,0x0F46,
- 0x0F4E,0x0F56,0x0F5E,0x0F66,0x0F6E,0x0F77,0x0F7F,0x0F87,
- 0x0F8F,0x0F97,0x0FA0,0x0FA8,0x0FB0,0x0FB8,0x0FC1,0x0FC9,
- 0x0FD1,0x0FD9,0x0FE2,0x0FEA,0x0FF2,0x0FFB,0x1003,0x100C,
- 0x1014,0x101C,0x1025,0x102D,0x1036,0x103E,0x1047,0x104F,
- 0x1058,0x1060,0x1069,0x1071,0x107A,0x1083,0x108B,0x1094,
- 0x109C,0x10A5,0x10AE,0x10B6,0x10BF,0x10C8,0x10D1,0x10D9,
- 0x10E2,0x10EB,0x10F4,0x10FD,0x1105,0x110E,0x1117,0x1120,
- 0x1129,0x1132,0x113B,0x1144,0x114D,0x1156,0x115F,0x1168,
- 0x1171,0x117A,0x1183,0x118C,0x1195,0x119F,0x11A8,0x11B1,
- 0x11BA,0x11C3,0x11CD,0x11D6,0x11DF,0x11E9,0x11F2,0x11FB,
- 0x1205,0x120E,0x1218,0x1221,0x122B,0x1234,0x123E,0x1247,
- 0x1251,0x125A,0x1264,0x126E,0x1277,0x1281,0x128B,0x1294,
- 0x129E,0x12A8,0x12B2,0x12BC,0x12C5,0x12CF,0x12D9,0x12E3,
- 0x12ED,0x12F7,0x1301,0x130B,0x1315,0x131F,0x132A,0x1334,
- 0x133E,0x1348,0x1352,0x135D,0x1367,0x1371,0x137C,0x1386,
- 0x1390,0x139B,0x13A5,0x13B0,0x13BA,0x13C5,0x13D0,0x13DA,
- 0x13E5,0x13F0,0x13FA,0x1405,0x1410,0x141B,0x1426,0x1430,
- 0x143B,0x1446,0x1451,0x145C,0x1467,0x1472,0x147E,0x1489,
- 0x1494,0x149F,0x14AA,0x14B6,0x14C1,0x14CC,0x14D8,0x14E3,
- 0x14EF,0x14FA,0x1506,0x1511,0x151D,0x1529,0x1534,0x1540,
- 0x154C,0x1558,0x1564,0x1570,0x157C,0x1588,0x1594,0x15A0,
- 0x15AC,0x15B8,0x15C4,0x15D0,0x15DD,0x15E9,0x15F5,0x1602,
- 0x160E,0x161B,0x1627,0x1634,0x1641,0x164D,0x165A,0x1667,
- 0x1674,0x1681,0x168D,0x169A,0x16A7,0x16B5,0x16C2,0x16CF,
- 0x16DC,0x16E9,0x16F7,0x1704,0x1711,0x171F,0x172C,0x173A,
- 0x1748,0x1755,0x1763,0x1771,0x177F,0x178D,0x179B,0x17A9,
- 0x17B7,0x17C5,0x17D3,0x17E1,0x17F0,0x17FE,0x180C,0x181B,
- 0x1829,0x1838,0x1847,0x1855,0x1864,0x1873,0x1882,0x1891,
- 0x18A0,0x18AF,0x18BE,0x18CD,0x18DD,0x18EC,0x18FC,0x190B,
- 0x191B,0x192A,0x193A,0x194A,0x195A,0x196A,0x197A,0x198A,
- 0x199A,0x19AA,0x19BA,0x19CB,0x19DB,0x19EC,0x19FC,0x1A0D,
- 0x1A1E,0x1A2F,0x1A40,0x1A51,0x1A62,0x1A73,0x1A84,0x1A95,
- 0x1AA7,0x1AB8,0x1ACA,0x1ADB,0x1AED,0x1AFF,0x1B11,0x1B23,
- 0x1B35,0x1B47,0x1B5A,0x1B6C,0x1B7E,0x1B91,0x1BA4,0x1BB6,
- 0x1BC9,0x1BDC,0x1BEF,0x1C02,0x1C16,0x1C29,0x1C3C,0x1C50,
- 0x1C64,0x1C77,0x1C8B,0x1C9F,0x1CB3,0x1CC7,0x1CDC,0x1CF0,
- 0x1D05,0x1D19,0x1D2E,0x1D43,0x1D58,0x1D6D,0x1D82,0x1D97,
- 0x1DAD,0x1DC2,0x1DD8,0x1DEE,0x1E04,0x1E1A,0x1E30,0x1E46,
- 0x1E5D,0x1E73,0x1E8A,0x1EA1,0x1EB8,0x1ECF,0x1EE6,0x1EFE,
- 0x1F15,0x1F2D,0x1F45,0x1F5D,0x1F75,0x1F8D,0x1FA5,0x1FBE,
- 0x1FD7,0x1FF0,0x2009,0x2022,0x203B,0x2055,0x206E,0x2088,
- 0x20A2,0x20BC,0x20D7,0x20F1,0x210C,0x2127,0x2142,0x215D,
- 0x2178,0x2194,0x21AF,0x21CB,0x21E7,0x2204,0x2220,0x223D,
- 0x225A,0x2277,0x2294,0x22B2,0x22CF,0x22ED,0x230B,0x232A,
- 0x2348,0x2367,0x2386,0x23A5,0x23C5,0x23E4,0x2404,0x2424,
- 0x2445,0x2465,0x2486,0x24A7,0x24C9,0x24EA,0x250C,0x252E,
- 0x2550,0x2573,0x2596,0x25B9,0x25DD,0x2600,0x2624,0x2648,
- 0x266D,0x2692,0x26B7,0x26DC,0x2702,0x2728,0x274F,0x2775,
- 0x279C,0x27C4,0x27EB,0x2813,0x283C,0x2864,0x288D,0x28B7,
- 0x28E0,0x290A,0x2935,0x2960,0x298B,0x29B6,0x29E2,0x2A0F,
- 0x2A3B,0x2A69,0x2A96,0x2AC4,0x2AF2,0x2B21,0x2B50,0x2B80,
- 0x2BB0,0x2BE1,0x2C12,0x2C43,0x2C75,0x2CA8,0x2CDB,0x2D0E,
- 0x2D42,0x2D76,0x2DAB,0x2DE1,0x2E17,0x2E4D,0x2E85,0x2EBC,
- 0x2EF4,0x2F2D,0x2F67,0x2FA1,0x2FDB,0x3016,0x3052,0x308F,
- 0x30CC,0x310A,0x3148,0x3187,0x31C7,0x3208,0x3249,0x328B,
- 0x32CE,0x3311,0x3355,0x339A,0x33E0,0x3427,0x346E,0x34B6,
- 0x3500,0x354A,0x3595,0x35E0,0x362D,0x367B,0x36CA,0x3719,
- 0x376A,0x37BB,0x380E,0x3862,0x38B7,0x390D,0x3964,0x39BC,
- 0x3A15,0x3A70,0x3ACB,0x3B28,0x3B87,0x3BE6,0x3C47,0x3CA9,
- 0x3D0D,0x3D72,0x3DD8,0x3E40,0x3EAA,0x3F15,0x3F81,0x3FF0
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x004A,0x0050,0x0056,0x005B,0x0061,0x0067,0x006C,
+ 0x0072,0x0078,0x007D,0x0083,0x0089,0x008F,0x0095,0x009B,
+ 0x00A0,0x00A6,0x00AC,0x00B2,0x00B8,0x00BE,0x00C4,0x00CA,
+ 0x00D0,0x00D6,0x00DC,0x00E2,0x00E8,0x00EE,0x00F5,0x00FB,
+ 0x0101,0x0107,0x010D,0x0113,0x011A,0x0120,0x0126,0x012D,
+ 0x0133,0x0139,0x013F,0x0146,0x014C,0x0153,0x0159,0x015F,
+ 0x0166,0x016C,0x0173,0x0179,0x0180,0x0186,0x018D,0x0193,
+ 0x019A,0x01A1,0x01A7,0x01AE,0x01B5,0x01BB,0x01C2,0x01C9,
+ 0x01CF,0x01D6,0x01DD,0x01E3,0x01EA,0x01F1,0x01F8,0x01FF,
+ 0x0205,0x020C,0x0213,0x021A,0x0221,0x0228,0x022F,0x0236,
+ 0x023D,0x0243,0x024A,0x0251,0x0258,0x025F,0x0266,0x026D,
+ 0x0274,0x027C,0x0283,0x028A,0x0291,0x0298,0x029F,0x02A6,
+ 0x02AD,0x02B4,0x02BC,0x02C3,0x02CA,0x02D1,0x02D8,0x02E0,
+ 0x02E7,0x02EE,0x02F5,0x02FD,0x0304,0x030B,0x0312,0x031A,
+ 0x0321,0x0328,0x0330,0x0337,0x033E,0x0346,0x034D,0x0355,
+ 0x035C,0x0363,0x036B,0x0372,0x037A,0x0381,0x0389,0x0390,
+ 0x0398,0x039F,0x03A7,0x03AE,0x03B6,0x03BD,0x03C5,0x03CC,
+ 0x03D4,0x03DB,0x03E3,0x03EA,0x03F2,0x03F9,0x0401,0x0409,
+ 0x0410,0x0418,0x041F,0x0427,0x042F,0x0436,0x043E,0x0445,
+ 0x044D,0x0455,0x045C,0x0464,0x046C,0x0473,0x047B,0x0483,
+ 0x048A,0x0492,0x049A,0x04A1,0x04A9,0x04B1,0x04B9,0x04C0,
+ 0x04C8,0x04D0,0x04D7,0x04DF,0x04E7,0x04EF,0x04F6,0x04FE,
+ 0x0506,0x050E,0x0515,0x051D,0x0525,0x052D,0x0534,0x053C,
+ 0x0544,0x054C,0x0553,0x055B,0x0563,0x056B,0x0572,0x057A,
+ 0x0582,0x058A,0x0592,0x0599,0x05A1,0x05A9,0x05B1,0x05B9,
+ 0x05C0,0x05C8,0x05D0,0x05D8,0x05DF,0x05E7,0x05EF,0x05F7,
+ 0x05FF,0x0606,0x060E,0x0616,0x061E,0x0626,0x062D,0x0635,
+ 0x063D,0x0645,0x064D,0x0654,0x065C,0x0664,0x066C,0x0674,
+ 0x067B,0x0683,0x068B,0x0693,0x069B,0x06A2,0x06AA,0x06B2,
+ 0x06BA,0x06C1,0x06C9,0x06D1,0x06D9,0x06E1,0x06E8,0x06F0,
+ 0x06F8,0x0700,0x0707,0x070F,0x0717,0x071F,0x0727,0x072E,
+ 0x0736,0x073E,0x0746,0x074D,0x0755,0x075D,0x0765,0x076C,
+ 0x0774,0x077C,0x0783,0x078B,0x0793,0x079B,0x07A2,0x07AA,
+ 0x07B2,0x07BA,0x07C1,0x07C9,0x07D1,0x07D8,0x07E0,0x07E8,
+ 0x07F0,0x07F7,0x07FF,0x0807,0x080E,0x0816,0x081E,0x0825,
+ 0x082D,0x0835,0x083C,0x0844,0x084C,0x0853,0x085B,0x0863,
+ 0x086A,0x0872,0x087A,0x0881,0x0889,0x0891,0x0898,0x08A0,
+ 0x08A7,0x08AF,0x08B7,0x08BE,0x08C6,0x08CE,0x08D5,0x08DD,
+ 0x08E4,0x08EC,0x08F4,0x08FB,0x0903,0x090A,0x0912,0x091A,
+ 0x0921,0x0929,0x0930,0x0938,0x093F,0x0947,0x094F,0x0956,
+ 0x095E,0x0965,0x096D,0x0974,0x097C,0x0983,0x098B,0x0993,
+ 0x099A,0x09A2,0x09A9,0x09B1,0x09B8,0x09C0,0x09C7,0x09CF,
+ 0x09D6,0x09DE,0x09E5,0x09ED,0x09F4,0x09FC,0x0A03,0x0A0B,
+ 0x0A12,0x0A1A,0x0A21,0x0A29,0x0A30,0x0A38,0x0A3F,0x0A47,
+ 0x0A4E,0x0A56,0x0A5D,0x0A65,0x0A6C,0x0A74,0x0A7B,0x0A83,
+ 0x0A8A,0x0A92,0x0A99,0x0AA1,0x0AA8,0x0AB0,0x0AB7,0x0ABE,
+ 0x0AC6,0x0ACD,0x0AD5,0x0ADC,0x0AE4,0x0AEB,0x0AF3,0x0AFA,
+ 0x0B02,0x0B09,0x0B11,0x0B18,0x0B1F,0x0B27,0x0B2E,0x0B36,
+ 0x0B3D,0x0B45,0x0B4C,0x0B54,0x0B5B,0x0B63,0x0B6A,0x0B71,
+ 0x0B79,0x0B80,0x0B88,0x0B8F,0x0B97,0x0B9E,0x0BA6,0x0BAD,
+ 0x0BB4,0x0BBC,0x0BC3,0x0BCB,0x0BD2,0x0BDA,0x0BE1,0x0BE9,
+ 0x0BF0,0x0BF8,0x0BFF,0x0C07,0x0C0E,0x0C15,0x0C1D,0x0C24,
+ 0x0C2C,0x0C33,0x0C3B,0x0C42,0x0C4A,0x0C51,0x0C59,0x0C60,
+ 0x0C68,0x0C6F,0x0C77,0x0C7E,0x0C86,0x0C8D,0x0C95,0x0C9C,
+ 0x0CA4,0x0CAB,0x0CB3,0x0CBA,0x0CC2,0x0CC9,0x0CD1,0x0CD8,
+ 0x0CE0,0x0CE8,0x0CEF,0x0CF7,0x0CFE,0x0D06,0x0D0D,0x0D15,
+ 0x0D1C,0x0D24,0x0D2C,0x0D33,0x0D3B,0x0D42,0x0D4A,0x0D52,
+ 0x0D59,0x0D61,0x0D68,0x0D70,0x0D78,0x0D7F,0x0D87,0x0D8E,
+ 0x0D96,0x0D9E,0x0DA5,0x0DAD,0x0DB5,0x0DBC,0x0DC4,0x0DCC,
+ 0x0DD3,0x0DDB,0x0DE3,0x0DEB,0x0DF2,0x0DFA,0x0E02,0x0E0A,
+ 0x0E11,0x0E19,0x0E21,0x0E29,0x0E30,0x0E38,0x0E40,0x0E48,
+ 0x0E4F,0x0E57,0x0E5F,0x0E67,0x0E6F,0x0E77,0x0E7E,0x0E86,
+ 0x0E8E,0x0E96,0x0E9E,0x0EA6,0x0EAE,0x0EB6,0x0EBE,0x0EC6,
+ 0x0ECD,0x0ED5,0x0EDD,0x0EE5,0x0EED,0x0EF5,0x0EFD,0x0F05,
+ 0x0F0D,0x0F15,0x0F1D,0x0F25,0x0F2E,0x0F36,0x0F3E,0x0F46,
+ 0x0F4E,0x0F56,0x0F5E,0x0F66,0x0F6E,0x0F77,0x0F7F,0x0F87,
+ 0x0F8F,0x0F97,0x0FA0,0x0FA8,0x0FB0,0x0FB8,0x0FC1,0x0FC9,
+ 0x0FD1,0x0FD9,0x0FE2,0x0FEA,0x0FF2,0x0FFB,0x1003,0x100C,
+ 0x1014,0x101C,0x1025,0x102D,0x1036,0x103E,0x1047,0x104F,
+ 0x1058,0x1060,0x1069,0x1071,0x107A,0x1083,0x108B,0x1094,
+ 0x109C,0x10A5,0x10AE,0x10B6,0x10BF,0x10C8,0x10D1,0x10D9,
+ 0x10E2,0x10EB,0x10F4,0x10FD,0x1105,0x110E,0x1117,0x1120,
+ 0x1129,0x1132,0x113B,0x1144,0x114D,0x1156,0x115F,0x1168,
+ 0x1171,0x117A,0x1183,0x118C,0x1195,0x119F,0x11A8,0x11B1,
+ 0x11BA,0x11C3,0x11CD,0x11D6,0x11DF,0x11E9,0x11F2,0x11FB,
+ 0x1205,0x120E,0x1218,0x1221,0x122B,0x1234,0x123E,0x1247,
+ 0x1251,0x125A,0x1264,0x126E,0x1277,0x1281,0x128B,0x1294,
+ 0x129E,0x12A8,0x12B2,0x12BC,0x12C5,0x12CF,0x12D9,0x12E3,
+ 0x12ED,0x12F7,0x1301,0x130B,0x1315,0x131F,0x132A,0x1334,
+ 0x133E,0x1348,0x1352,0x135D,0x1367,0x1371,0x137C,0x1386,
+ 0x1390,0x139B,0x13A5,0x13B0,0x13BA,0x13C5,0x13D0,0x13DA,
+ 0x13E5,0x13F0,0x13FA,0x1405,0x1410,0x141B,0x1426,0x1430,
+ 0x143B,0x1446,0x1451,0x145C,0x1467,0x1472,0x147E,0x1489,
+ 0x1494,0x149F,0x14AA,0x14B6,0x14C1,0x14CC,0x14D8,0x14E3,
+ 0x14EF,0x14FA,0x1506,0x1511,0x151D,0x1529,0x1534,0x1540,
+ 0x154C,0x1558,0x1564,0x1570,0x157C,0x1588,0x1594,0x15A0,
+ 0x15AC,0x15B8,0x15C4,0x15D0,0x15DD,0x15E9,0x15F5,0x1602,
+ 0x160E,0x161B,0x1627,0x1634,0x1641,0x164D,0x165A,0x1667,
+ 0x1674,0x1681,0x168D,0x169A,0x16A7,0x16B5,0x16C2,0x16CF,
+ 0x16DC,0x16E9,0x16F7,0x1704,0x1711,0x171F,0x172C,0x173A,
+ 0x1748,0x1755,0x1763,0x1771,0x177F,0x178D,0x179B,0x17A9,
+ 0x17B7,0x17C5,0x17D3,0x17E1,0x17F0,0x17FE,0x180C,0x181B,
+ 0x1829,0x1838,0x1847,0x1855,0x1864,0x1873,0x1882,0x1891,
+ 0x18A0,0x18AF,0x18BE,0x18CD,0x18DD,0x18EC,0x18FC,0x190B,
+ 0x191B,0x192A,0x193A,0x194A,0x195A,0x196A,0x197A,0x198A,
+ 0x199A,0x19AA,0x19BA,0x19CB,0x19DB,0x19EC,0x19FC,0x1A0D,
+ 0x1A1E,0x1A2F,0x1A40,0x1A51,0x1A62,0x1A73,0x1A84,0x1A95,
+ 0x1AA7,0x1AB8,0x1ACA,0x1ADB,0x1AED,0x1AFF,0x1B11,0x1B23,
+ 0x1B35,0x1B47,0x1B5A,0x1B6C,0x1B7E,0x1B91,0x1BA4,0x1BB6,
+ 0x1BC9,0x1BDC,0x1BEF,0x1C02,0x1C16,0x1C29,0x1C3C,0x1C50,
+ 0x1C64,0x1C77,0x1C8B,0x1C9F,0x1CB3,0x1CC7,0x1CDC,0x1CF0,
+ 0x1D05,0x1D19,0x1D2E,0x1D43,0x1D58,0x1D6D,0x1D82,0x1D97,
+ 0x1DAD,0x1DC2,0x1DD8,0x1DEE,0x1E04,0x1E1A,0x1E30,0x1E46,
+ 0x1E5D,0x1E73,0x1E8A,0x1EA1,0x1EB8,0x1ECF,0x1EE6,0x1EFE,
+ 0x1F15,0x1F2D,0x1F45,0x1F5D,0x1F75,0x1F8D,0x1FA5,0x1FBE,
+ 0x1FD7,0x1FF0,0x2009,0x2022,0x203B,0x2055,0x206E,0x2088,
+ 0x20A2,0x20BC,0x20D7,0x20F1,0x210C,0x2127,0x2142,0x215D,
+ 0x2178,0x2194,0x21AF,0x21CB,0x21E7,0x2204,0x2220,0x223D,
+ 0x225A,0x2277,0x2294,0x22B2,0x22CF,0x22ED,0x230B,0x232A,
+ 0x2348,0x2367,0x2386,0x23A5,0x23C5,0x23E4,0x2404,0x2424,
+ 0x2445,0x2465,0x2486,0x24A7,0x24C9,0x24EA,0x250C,0x252E,
+ 0x2550,0x2573,0x2596,0x25B9,0x25DD,0x2600,0x2624,0x2648,
+ 0x266D,0x2692,0x26B7,0x26DC,0x2702,0x2728,0x274F,0x2775,
+ 0x279C,0x27C4,0x27EB,0x2813,0x283C,0x2864,0x288D,0x28B7,
+ 0x28E0,0x290A,0x2935,0x2960,0x298B,0x29B6,0x29E2,0x2A0F,
+ 0x2A3B,0x2A69,0x2A96,0x2AC4,0x2AF2,0x2B21,0x2B50,0x2B80,
+ 0x2BB0,0x2BE1,0x2C12,0x2C43,0x2C75,0x2CA8,0x2CDB,0x2D0E,
+ 0x2D42,0x2D76,0x2DAB,0x2DE1,0x2E17,0x2E4D,0x2E85,0x2EBC,
+ 0x2EF4,0x2F2D,0x2F67,0x2FA1,0x2FDB,0x3016,0x3052,0x308F,
+ 0x30CC,0x310A,0x3148,0x3187,0x31C7,0x3208,0x3249,0x328B,
+ 0x32CE,0x3311,0x3355,0x339A,0x33E0,0x3427,0x346E,0x34B6,
+ 0x3500,0x354A,0x3595,0x35E0,0x362D,0x367B,0x36CA,0x3719,
+ 0x376A,0x37BB,0x380E,0x3862,0x38B7,0x390D,0x3964,0x39BC,
+ 0x3A15,0x3A70,0x3ACB,0x3B28,0x3B87,0x3BE6,0x3C47,0x3CA9,
+ 0x3D0D,0x3D72,0x3DD8,0x3E40,0x3EAA,0x3F15,0x3F81,0x3FF0
};
static short esp_dat_m[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x004A,0x004E,0x0052,0x0057,0x005B,0x005F,0x0064,
- 0x0068,0x006C,0x0071,0x0075,0x007A,0x007E,0x0083,0x0087,
- 0x008C,0x0090,0x0095,0x0099,0x009E,0x00A2,0x00A7,0x00AB,
- 0x00B0,0x00B5,0x00B9,0x00BE,0x00C2,0x00C7,0x00CC,0x00D1,
- 0x00D5,0x00DA,0x00DF,0x00E3,0x00E8,0x00ED,0x00F2,0x00F6,
- 0x00FB,0x0100,0x0105,0x010A,0x010F,0x0114,0x0118,0x011D,
- 0x0122,0x0127,0x012C,0x0131,0x0136,0x013B,0x0140,0x0145,
- 0x014A,0x014F,0x0154,0x0159,0x015E,0x0163,0x0168,0x016E,
- 0x0173,0x0178,0x017D,0x0182,0x0187,0x018C,0x0192,0x0197,
- 0x019C,0x01A1,0x01A6,0x01AC,0x01B1,0x01B6,0x01BC,0x01C1,
- 0x01C6,0x01CB,0x01D1,0x01D6,0x01DC,0x01E1,0x01E6,0x01EC,
- 0x01F1,0x01F6,0x01FC,0x0201,0x0207,0x020C,0x0212,0x0217,
- 0x021D,0x0222,0x0228,0x022D,0x0233,0x0238,0x023E,0x0243,
- 0x0249,0x024F,0x0254,0x025A,0x025F,0x0265,0x026B,0x0270,
- 0x0276,0x027C,0x0281,0x0287,0x028D,0x0292,0x0298,0x029E,
- 0x02A4,0x02A9,0x02AF,0x02B5,0x02BB,0x02C0,0x02C6,0x02CC,
- 0x02D2,0x02D8,0x02DE,0x02E3,0x02E9,0x02EF,0x02F5,0x02FB,
- 0x0301,0x0307,0x030D,0x0312,0x0318,0x031E,0x0324,0x032A,
- 0x0330,0x0336,0x033C,0x0342,0x0348,0x034E,0x0354,0x035A,
- 0x0360,0x0366,0x036C,0x0372,0x0378,0x037E,0x0384,0x038A,
- 0x0391,0x0397,0x039D,0x03A3,0x03A9,0x03AF,0x03B5,0x03BB,
- 0x03C1,0x03C8,0x03CE,0x03D4,0x03DA,0x03E0,0x03E6,0x03ED,
- 0x03F3,0x03F9,0x03FF,0x0405,0x040C,0x0412,0x0418,0x041E,
- 0x0425,0x042B,0x0431,0x0437,0x043E,0x0444,0x044A,0x0450,
- 0x0457,0x045D,0x0463,0x046A,0x0470,0x0476,0x047D,0x0483,
- 0x0489,0x0490,0x0496,0x049C,0x04A3,0x04A9,0x04AF,0x04B6,
- 0x04BC,0x04C2,0x04C9,0x04CF,0x04D6,0x04DC,0x04E2,0x04E9,
- 0x04EF,0x04F6,0x04FC,0x0502,0x0509,0x050F,0x0516,0x051C,
- 0x0523,0x0529,0x052F,0x0536,0x053C,0x0543,0x0549,0x0550,
- 0x0556,0x055D,0x0563,0x056A,0x0570,0x0577,0x057D,0x0584,
- 0x058A,0x0591,0x0597,0x059E,0x05A4,0x05AB,0x05B1,0x05B8,
- 0x05BE,0x05C5,0x05CB,0x05D2,0x05D8,0x05DF,0x05E6,0x05EC,
- 0x05F3,0x05F9,0x0600,0x0606,0x060D,0x0613,0x061A,0x0621,
- 0x0627,0x062E,0x0634,0x063B,0x0641,0x0648,0x064F,0x0655,
- 0x065C,0x0662,0x0669,0x0670,0x0676,0x067D,0x0683,0x068A,
- 0x0691,0x0697,0x069E,0x06A4,0x06AB,0x06B2,0x06B8,0x06BF,
- 0x06C6,0x06CC,0x06D3,0x06DA,0x06E0,0x06E7,0x06ED,0x06F4,
- 0x06FB,0x0701,0x0708,0x070F,0x0715,0x071C,0x0723,0x0729,
- 0x0730,0x0737,0x073D,0x0744,0x074B,0x0751,0x0758,0x075F,
- 0x0765,0x076C,0x0773,0x0779,0x0780,0x0787,0x078D,0x0794,
- 0x079B,0x07A2,0x07A8,0x07AF,0x07B6,0x07BC,0x07C3,0x07CA,
- 0x07D0,0x07D7,0x07DE,0x07E5,0x07EB,0x07F2,0x07F9,0x07FF,
- 0x0806,0x080D,0x0814,0x081A,0x0821,0x0828,0x082F,0x0835,
- 0x083C,0x0843,0x0849,0x0850,0x0857,0x085E,0x0864,0x086B,
- 0x0872,0x0879,0x0880,0x0886,0x088D,0x0894,0x089B,0x08A1,
- 0x08A8,0x08AF,0x08B6,0x08BC,0x08C3,0x08CA,0x08D1,0x08D8,
- 0x08DE,0x08E5,0x08EC,0x08F3,0x08FA,0x0900,0x0907,0x090E,
- 0x0915,0x091C,0x0922,0x0929,0x0930,0x0937,0x093E,0x0945,
- 0x094B,0x0952,0x0959,0x0960,0x0967,0x096E,0x0975,0x097B,
- 0x0982,0x0989,0x0990,0x0997,0x099E,0x09A5,0x09AB,0x09B2,
- 0x09B9,0x09C0,0x09C7,0x09CE,0x09D5,0x09DC,0x09E3,0x09EA,
- 0x09F0,0x09F7,0x09FE,0x0A05,0x0A0C,0x0A13,0x0A1A,0x0A21,
- 0x0A28,0x0A2F,0x0A36,0x0A3D,0x0A44,0x0A4B,0x0A52,0x0A59,
- 0x0A60,0x0A67,0x0A6E,0x0A75,0x0A7C,0x0A83,0x0A8A,0x0A91,
- 0x0A98,0x0A9F,0x0AA6,0x0AAD,0x0AB4,0x0ABB,0x0AC2,0x0AC9,
- 0x0AD0,0x0AD7,0x0ADE,0x0AE5,0x0AEC,0x0AF4,0x0AFB,0x0B02,
- 0x0B09,0x0B10,0x0B17,0x0B1E,0x0B25,0x0B2D,0x0B34,0x0B3B,
- 0x0B42,0x0B49,0x0B50,0x0B58,0x0B5F,0x0B66,0x0B6D,0x0B74,
- 0x0B7C,0x0B83,0x0B8A,0x0B91,0x0B98,0x0BA0,0x0BA7,0x0BAE,
- 0x0BB6,0x0BBD,0x0BC4,0x0BCB,0x0BD3,0x0BDA,0x0BE1,0x0BE9,
- 0x0BF0,0x0BF7,0x0BFF,0x0C06,0x0C0D,0x0C15,0x0C1C,0x0C24,
- 0x0C2B,0x0C32,0x0C3A,0x0C41,0x0C49,0x0C50,0x0C58,0x0C5F,
- 0x0C67,0x0C6E,0x0C76,0x0C7D,0x0C85,0x0C8C,0x0C94,0x0C9B,
- 0x0CA3,0x0CAA,0x0CB2,0x0CBA,0x0CC1,0x0CC9,0x0CD0,0x0CD8,
- 0x0CE0,0x0CE7,0x0CEF,0x0CF7,0x0CFE,0x0D06,0x0D0E,0x0D16,
- 0x0D1D,0x0D25,0x0D2D,0x0D35,0x0D3C,0x0D44,0x0D4C,0x0D54,
- 0x0D5C,0x0D63,0x0D6B,0x0D73,0x0D7B,0x0D83,0x0D8B,0x0D93,
- 0x0D9B,0x0DA3,0x0DAB,0x0DB3,0x0DBB,0x0DC3,0x0DCB,0x0DD3,
- 0x0DDB,0x0DE3,0x0DEB,0x0DF3,0x0DFB,0x0E03,0x0E0B,0x0E14,
- 0x0E1C,0x0E24,0x0E2C,0x0E34,0x0E3D,0x0E45,0x0E4D,0x0E55,
- 0x0E5E,0x0E66,0x0E6E,0x0E77,0x0E7F,0x0E87,0x0E90,0x0E98,
- 0x0EA1,0x0EA9,0x0EB2,0x0EBA,0x0EC2,0x0ECB,0x0ED4,0x0EDC,
- 0x0EE5,0x0EED,0x0EF6,0x0EFF,0x0F07,0x0F10,0x0F19,0x0F21,
- 0x0F2A,0x0F33,0x0F3B,0x0F44,0x0F4D,0x0F56,0x0F5F,0x0F68,
- 0x0F71,0x0F79,0x0F82,0x0F8B,0x0F94,0x0F9D,0x0FA6,0x0FAF,
- 0x0FB8,0x0FC2,0x0FCB,0x0FD4,0x0FDD,0x0FE6,0x0FEF,0x0FF9,
- 0x1002,0x100B,0x1014,0x101E,0x1027,0x1030,0x103A,0x1043,
- 0x104D,0x1056,0x1060,0x1069,0x1073,0x107C,0x1086,0x108F,
- 0x1099,0x10A3,0x10AC,0x10B6,0x10C0,0x10CA,0x10D3,0x10DD,
- 0x10E7,0x10F1,0x10FB,0x1105,0x110F,0x1119,0x1123,0x112D,
- 0x1137,0x1141,0x114B,0x1156,0x1160,0x116A,0x1174,0x117F,
- 0x1189,0x1193,0x119E,0x11A8,0x11B3,0x11BD,0x11C8,0x11D2,
- 0x11DD,0x11E8,0x11F2,0x11FD,0x1208,0x1213,0x121D,0x1228,
- 0x1233,0x123E,0x1249,0x1254,0x125F,0x126A,0x1275,0x1280,
- 0x128B,0x1297,0x12A2,0x12AD,0x12B9,0x12C4,0x12CF,0x12DB,
- 0x12E6,0x12F2,0x12FD,0x1309,0x1315,0x1320,0x132C,0x1338,
- 0x1344,0x1350,0x135B,0x1367,0x1373,0x137F,0x138C,0x1398,
- 0x13A4,0x13B0,0x13BC,0x13C9,0x13D5,0x13E1,0x13EE,0x13FA,
- 0x1407,0x1414,0x1420,0x142D,0x143A,0x1446,0x1453,0x1460,
- 0x146D,0x147A,0x1487,0x1494,0x14A2,0x14AF,0x14BC,0x14C9,
- 0x14D7,0x14E4,0x14F2,0x14FF,0x150D,0x151A,0x1528,0x1536,
- 0x1544,0x1552,0x1560,0x156E,0x157C,0x158A,0x1598,0x15A6,
- 0x15B5,0x15C3,0x15D1,0x15E0,0x15EF,0x15FD,0x160C,0x161B,
- 0x1629,0x1638,0x1647,0x1656,0x1665,0x1675,0x1684,0x1693,
- 0x16A3,0x16B2,0x16C2,0x16D1,0x16E1,0x16F1,0x1700,0x1710,
- 0x1720,0x1730,0x1741,0x1751,0x1761,0x1771,0x1782,0x1792,
- 0x17A3,0x17B4,0x17C5,0x17D5,0x17E6,0x17F7,0x1808,0x181A,
- 0x182B,0x183C,0x184E,0x185F,0x1871,0x1883,0x1895,0x18A7,
- 0x18B9,0x18CB,0x18DD,0x18EF,0x1902,0x1914,0x1927,0x1939,
- 0x194C,0x195F,0x1972,0x1985,0x1998,0x19AC,0x19BF,0x19D3,
- 0x19E6,0x19FA,0x1A0E,0x1A22,0x1A36,0x1A4A,0x1A5F,0x1A73,
- 0x1A88,0x1A9C,0x1AB1,0x1AC6,0x1ADB,0x1AF0,0x1B06,0x1B1B,
- 0x1B31,0x1B46,0x1B5C,0x1B72,0x1B88,0x1B9E,0x1BB5,0x1BCB,
- 0x1BE2,0x1BF8,0x1C0F,0x1C26,0x1C3E,0x1C55,0x1C6C,0x1C84,
- 0x1C9C,0x1CB4,0x1CCC,0x1CE4,0x1CFC,0x1D15,0x1D2E,0x1D47,
- 0x1D60,0x1D79,0x1D92,0x1DAC,0x1DC5,0x1DDF,0x1DF9,0x1E14,
- 0x1E2E,0x1E49,0x1E63,0x1E7E,0x1E99,0x1EB5,0x1ED0,0x1EEC,
- 0x1F08,0x1F24,0x1F40,0x1F5D,0x1F79,0x1F96,0x1FB4,0x1FD1,
- 0x1FEE,0x200C,0x202A,0x2048,0x2067,0x2085,0x20A4,0x20C3,
- 0x20E3,0x2102,0x2122,0x2142,0x2163,0x2183,0x21A4,0x21C5,
- 0x21E6,0x2208,0x222A,0x224C,0x226E,0x2291,0x22B4,0x22D7,
- 0x22FB,0x231F,0x2343,0x2367,0x238C,0x23B1,0x23D6,0x23FC,
- 0x2422,0x2448,0x246F,0x2496,0x24BD,0x24E5,0x250D,0x2535,
- 0x255E,0x2587,0x25B0,0x25DA,0x2604,0x262F,0x265A,0x2685,
- 0x26B1,0x26DD,0x2709,0x2736,0x2764,0x2791,0x27C0,0x27EE,
- 0x281E,0x284D,0x287D,0x28AE,0x28DF,0x2910,0x2942,0x2974,
- 0x29A7,0x29DB,0x2A0F,0x2A43,0x2A79,0x2AAE,0x2AE4,0x2B1B,
- 0x2B52,0x2B8A,0x2BC3,0x2BFC,0x2C36,0x2C70,0x2CAB,0x2CE7,
- 0x2D23,0x2D60,0x2D9D,0x2DDC,0x2E1B,0x2E5A,0x2E9B,0x2EDC,
- 0x2F1E,0x2F61,0x2FA4,0x2FE9,0x302E,0x3074,0x30BB,0x3102,
- 0x314B,0x3194,0x31DF,0x322A,0x3276,0x32C3,0x3311,0x3361,
- 0x33B1,0x3402,0x3454,0x34A8,0x34FC,0x3552,0x35A9,0x3601,
- 0x365A,0x36B4,0x3710,0x376D,0x37CB,0x382B,0x388C,0x38EE,
- 0x3952,0x39B7,0x3A1E,0x3A86,0x3AF0,0x3B5B,0x3BC9,0x3C37,
- 0x3CA8,0x3D1A,0x3D8E,0x3E04,0x3E7C,0x3EF6,0x3F72,0x3FF0
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x004A,0x004E,0x0052,0x0057,0x005B,0x005F,0x0064,
+ 0x0068,0x006C,0x0071,0x0075,0x007A,0x007E,0x0083,0x0087,
+ 0x008C,0x0090,0x0095,0x0099,0x009E,0x00A2,0x00A7,0x00AB,
+ 0x00B0,0x00B5,0x00B9,0x00BE,0x00C2,0x00C7,0x00CC,0x00D1,
+ 0x00D5,0x00DA,0x00DF,0x00E3,0x00E8,0x00ED,0x00F2,0x00F6,
+ 0x00FB,0x0100,0x0105,0x010A,0x010F,0x0114,0x0118,0x011D,
+ 0x0122,0x0127,0x012C,0x0131,0x0136,0x013B,0x0140,0x0145,
+ 0x014A,0x014F,0x0154,0x0159,0x015E,0x0163,0x0168,0x016E,
+ 0x0173,0x0178,0x017D,0x0182,0x0187,0x018C,0x0192,0x0197,
+ 0x019C,0x01A1,0x01A6,0x01AC,0x01B1,0x01B6,0x01BC,0x01C1,
+ 0x01C6,0x01CB,0x01D1,0x01D6,0x01DC,0x01E1,0x01E6,0x01EC,
+ 0x01F1,0x01F6,0x01FC,0x0201,0x0207,0x020C,0x0212,0x0217,
+ 0x021D,0x0222,0x0228,0x022D,0x0233,0x0238,0x023E,0x0243,
+ 0x0249,0x024F,0x0254,0x025A,0x025F,0x0265,0x026B,0x0270,
+ 0x0276,0x027C,0x0281,0x0287,0x028D,0x0292,0x0298,0x029E,
+ 0x02A4,0x02A9,0x02AF,0x02B5,0x02BB,0x02C0,0x02C6,0x02CC,
+ 0x02D2,0x02D8,0x02DE,0x02E3,0x02E9,0x02EF,0x02F5,0x02FB,
+ 0x0301,0x0307,0x030D,0x0312,0x0318,0x031E,0x0324,0x032A,
+ 0x0330,0x0336,0x033C,0x0342,0x0348,0x034E,0x0354,0x035A,
+ 0x0360,0x0366,0x036C,0x0372,0x0378,0x037E,0x0384,0x038A,
+ 0x0391,0x0397,0x039D,0x03A3,0x03A9,0x03AF,0x03B5,0x03BB,
+ 0x03C1,0x03C8,0x03CE,0x03D4,0x03DA,0x03E0,0x03E6,0x03ED,
+ 0x03F3,0x03F9,0x03FF,0x0405,0x040C,0x0412,0x0418,0x041E,
+ 0x0425,0x042B,0x0431,0x0437,0x043E,0x0444,0x044A,0x0450,
+ 0x0457,0x045D,0x0463,0x046A,0x0470,0x0476,0x047D,0x0483,
+ 0x0489,0x0490,0x0496,0x049C,0x04A3,0x04A9,0x04AF,0x04B6,
+ 0x04BC,0x04C2,0x04C9,0x04CF,0x04D6,0x04DC,0x04E2,0x04E9,
+ 0x04EF,0x04F6,0x04FC,0x0502,0x0509,0x050F,0x0516,0x051C,
+ 0x0523,0x0529,0x052F,0x0536,0x053C,0x0543,0x0549,0x0550,
+ 0x0556,0x055D,0x0563,0x056A,0x0570,0x0577,0x057D,0x0584,
+ 0x058A,0x0591,0x0597,0x059E,0x05A4,0x05AB,0x05B1,0x05B8,
+ 0x05BE,0x05C5,0x05CB,0x05D2,0x05D8,0x05DF,0x05E6,0x05EC,
+ 0x05F3,0x05F9,0x0600,0x0606,0x060D,0x0613,0x061A,0x0621,
+ 0x0627,0x062E,0x0634,0x063B,0x0641,0x0648,0x064F,0x0655,
+ 0x065C,0x0662,0x0669,0x0670,0x0676,0x067D,0x0683,0x068A,
+ 0x0691,0x0697,0x069E,0x06A4,0x06AB,0x06B2,0x06B8,0x06BF,
+ 0x06C6,0x06CC,0x06D3,0x06DA,0x06E0,0x06E7,0x06ED,0x06F4,
+ 0x06FB,0x0701,0x0708,0x070F,0x0715,0x071C,0x0723,0x0729,
+ 0x0730,0x0737,0x073D,0x0744,0x074B,0x0751,0x0758,0x075F,
+ 0x0765,0x076C,0x0773,0x0779,0x0780,0x0787,0x078D,0x0794,
+ 0x079B,0x07A2,0x07A8,0x07AF,0x07B6,0x07BC,0x07C3,0x07CA,
+ 0x07D0,0x07D7,0x07DE,0x07E5,0x07EB,0x07F2,0x07F9,0x07FF,
+ 0x0806,0x080D,0x0814,0x081A,0x0821,0x0828,0x082F,0x0835,
+ 0x083C,0x0843,0x0849,0x0850,0x0857,0x085E,0x0864,0x086B,
+ 0x0872,0x0879,0x0880,0x0886,0x088D,0x0894,0x089B,0x08A1,
+ 0x08A8,0x08AF,0x08B6,0x08BC,0x08C3,0x08CA,0x08D1,0x08D8,
+ 0x08DE,0x08E5,0x08EC,0x08F3,0x08FA,0x0900,0x0907,0x090E,
+ 0x0915,0x091C,0x0922,0x0929,0x0930,0x0937,0x093E,0x0945,
+ 0x094B,0x0952,0x0959,0x0960,0x0967,0x096E,0x0975,0x097B,
+ 0x0982,0x0989,0x0990,0x0997,0x099E,0x09A5,0x09AB,0x09B2,
+ 0x09B9,0x09C0,0x09C7,0x09CE,0x09D5,0x09DC,0x09E3,0x09EA,
+ 0x09F0,0x09F7,0x09FE,0x0A05,0x0A0C,0x0A13,0x0A1A,0x0A21,
+ 0x0A28,0x0A2F,0x0A36,0x0A3D,0x0A44,0x0A4B,0x0A52,0x0A59,
+ 0x0A60,0x0A67,0x0A6E,0x0A75,0x0A7C,0x0A83,0x0A8A,0x0A91,
+ 0x0A98,0x0A9F,0x0AA6,0x0AAD,0x0AB4,0x0ABB,0x0AC2,0x0AC9,
+ 0x0AD0,0x0AD7,0x0ADE,0x0AE5,0x0AEC,0x0AF4,0x0AFB,0x0B02,
+ 0x0B09,0x0B10,0x0B17,0x0B1E,0x0B25,0x0B2D,0x0B34,0x0B3B,
+ 0x0B42,0x0B49,0x0B50,0x0B58,0x0B5F,0x0B66,0x0B6D,0x0B74,
+ 0x0B7C,0x0B83,0x0B8A,0x0B91,0x0B98,0x0BA0,0x0BA7,0x0BAE,
+ 0x0BB6,0x0BBD,0x0BC4,0x0BCB,0x0BD3,0x0BDA,0x0BE1,0x0BE9,
+ 0x0BF0,0x0BF7,0x0BFF,0x0C06,0x0C0D,0x0C15,0x0C1C,0x0C24,
+ 0x0C2B,0x0C32,0x0C3A,0x0C41,0x0C49,0x0C50,0x0C58,0x0C5F,
+ 0x0C67,0x0C6E,0x0C76,0x0C7D,0x0C85,0x0C8C,0x0C94,0x0C9B,
+ 0x0CA3,0x0CAA,0x0CB2,0x0CBA,0x0CC1,0x0CC9,0x0CD0,0x0CD8,
+ 0x0CE0,0x0CE7,0x0CEF,0x0CF7,0x0CFE,0x0D06,0x0D0E,0x0D16,
+ 0x0D1D,0x0D25,0x0D2D,0x0D35,0x0D3C,0x0D44,0x0D4C,0x0D54,
+ 0x0D5C,0x0D63,0x0D6B,0x0D73,0x0D7B,0x0D83,0x0D8B,0x0D93,
+ 0x0D9B,0x0DA3,0x0DAB,0x0DB3,0x0DBB,0x0DC3,0x0DCB,0x0DD3,
+ 0x0DDB,0x0DE3,0x0DEB,0x0DF3,0x0DFB,0x0E03,0x0E0B,0x0E14,
+ 0x0E1C,0x0E24,0x0E2C,0x0E34,0x0E3D,0x0E45,0x0E4D,0x0E55,
+ 0x0E5E,0x0E66,0x0E6E,0x0E77,0x0E7F,0x0E87,0x0E90,0x0E98,
+ 0x0EA1,0x0EA9,0x0EB2,0x0EBA,0x0EC2,0x0ECB,0x0ED4,0x0EDC,
+ 0x0EE5,0x0EED,0x0EF6,0x0EFF,0x0F07,0x0F10,0x0F19,0x0F21,
+ 0x0F2A,0x0F33,0x0F3B,0x0F44,0x0F4D,0x0F56,0x0F5F,0x0F68,
+ 0x0F71,0x0F79,0x0F82,0x0F8B,0x0F94,0x0F9D,0x0FA6,0x0FAF,
+ 0x0FB8,0x0FC2,0x0FCB,0x0FD4,0x0FDD,0x0FE6,0x0FEF,0x0FF9,
+ 0x1002,0x100B,0x1014,0x101E,0x1027,0x1030,0x103A,0x1043,
+ 0x104D,0x1056,0x1060,0x1069,0x1073,0x107C,0x1086,0x108F,
+ 0x1099,0x10A3,0x10AC,0x10B6,0x10C0,0x10CA,0x10D3,0x10DD,
+ 0x10E7,0x10F1,0x10FB,0x1105,0x110F,0x1119,0x1123,0x112D,
+ 0x1137,0x1141,0x114B,0x1156,0x1160,0x116A,0x1174,0x117F,
+ 0x1189,0x1193,0x119E,0x11A8,0x11B3,0x11BD,0x11C8,0x11D2,
+ 0x11DD,0x11E8,0x11F2,0x11FD,0x1208,0x1213,0x121D,0x1228,
+ 0x1233,0x123E,0x1249,0x1254,0x125F,0x126A,0x1275,0x1280,
+ 0x128B,0x1297,0x12A2,0x12AD,0x12B9,0x12C4,0x12CF,0x12DB,
+ 0x12E6,0x12F2,0x12FD,0x1309,0x1315,0x1320,0x132C,0x1338,
+ 0x1344,0x1350,0x135B,0x1367,0x1373,0x137F,0x138C,0x1398,
+ 0x13A4,0x13B0,0x13BC,0x13C9,0x13D5,0x13E1,0x13EE,0x13FA,
+ 0x1407,0x1414,0x1420,0x142D,0x143A,0x1446,0x1453,0x1460,
+ 0x146D,0x147A,0x1487,0x1494,0x14A2,0x14AF,0x14BC,0x14C9,
+ 0x14D7,0x14E4,0x14F2,0x14FF,0x150D,0x151A,0x1528,0x1536,
+ 0x1544,0x1552,0x1560,0x156E,0x157C,0x158A,0x1598,0x15A6,
+ 0x15B5,0x15C3,0x15D1,0x15E0,0x15EF,0x15FD,0x160C,0x161B,
+ 0x1629,0x1638,0x1647,0x1656,0x1665,0x1675,0x1684,0x1693,
+ 0x16A3,0x16B2,0x16C2,0x16D1,0x16E1,0x16F1,0x1700,0x1710,
+ 0x1720,0x1730,0x1741,0x1751,0x1761,0x1771,0x1782,0x1792,
+ 0x17A3,0x17B4,0x17C5,0x17D5,0x17E6,0x17F7,0x1808,0x181A,
+ 0x182B,0x183C,0x184E,0x185F,0x1871,0x1883,0x1895,0x18A7,
+ 0x18B9,0x18CB,0x18DD,0x18EF,0x1902,0x1914,0x1927,0x1939,
+ 0x194C,0x195F,0x1972,0x1985,0x1998,0x19AC,0x19BF,0x19D3,
+ 0x19E6,0x19FA,0x1A0E,0x1A22,0x1A36,0x1A4A,0x1A5F,0x1A73,
+ 0x1A88,0x1A9C,0x1AB1,0x1AC6,0x1ADB,0x1AF0,0x1B06,0x1B1B,
+ 0x1B31,0x1B46,0x1B5C,0x1B72,0x1B88,0x1B9E,0x1BB5,0x1BCB,
+ 0x1BE2,0x1BF8,0x1C0F,0x1C26,0x1C3E,0x1C55,0x1C6C,0x1C84,
+ 0x1C9C,0x1CB4,0x1CCC,0x1CE4,0x1CFC,0x1D15,0x1D2E,0x1D47,
+ 0x1D60,0x1D79,0x1D92,0x1DAC,0x1DC5,0x1DDF,0x1DF9,0x1E14,
+ 0x1E2E,0x1E49,0x1E63,0x1E7E,0x1E99,0x1EB5,0x1ED0,0x1EEC,
+ 0x1F08,0x1F24,0x1F40,0x1F5D,0x1F79,0x1F96,0x1FB4,0x1FD1,
+ 0x1FEE,0x200C,0x202A,0x2048,0x2067,0x2085,0x20A4,0x20C3,
+ 0x20E3,0x2102,0x2122,0x2142,0x2163,0x2183,0x21A4,0x21C5,
+ 0x21E6,0x2208,0x222A,0x224C,0x226E,0x2291,0x22B4,0x22D7,
+ 0x22FB,0x231F,0x2343,0x2367,0x238C,0x23B1,0x23D6,0x23FC,
+ 0x2422,0x2448,0x246F,0x2496,0x24BD,0x24E5,0x250D,0x2535,
+ 0x255E,0x2587,0x25B0,0x25DA,0x2604,0x262F,0x265A,0x2685,
+ 0x26B1,0x26DD,0x2709,0x2736,0x2764,0x2791,0x27C0,0x27EE,
+ 0x281E,0x284D,0x287D,0x28AE,0x28DF,0x2910,0x2942,0x2974,
+ 0x29A7,0x29DB,0x2A0F,0x2A43,0x2A79,0x2AAE,0x2AE4,0x2B1B,
+ 0x2B52,0x2B8A,0x2BC3,0x2BFC,0x2C36,0x2C70,0x2CAB,0x2CE7,
+ 0x2D23,0x2D60,0x2D9D,0x2DDC,0x2E1B,0x2E5A,0x2E9B,0x2EDC,
+ 0x2F1E,0x2F61,0x2FA4,0x2FE9,0x302E,0x3074,0x30BB,0x3102,
+ 0x314B,0x3194,0x31DF,0x322A,0x3276,0x32C3,0x3311,0x3361,
+ 0x33B1,0x3402,0x3454,0x34A8,0x34FC,0x3552,0x35A9,0x3601,
+ 0x365A,0x36B4,0x3710,0x376D,0x37CB,0x382B,0x388C,0x38EE,
+ 0x3952,0x39B7,0x3A1E,0x3A86,0x3AF0,0x3B5B,0x3BC9,0x3C37,
+ 0x3CA8,0x3D1A,0x3D8E,0x3E04,0x3E7C,0x3EF6,0x3F72,0x3FF0
};
static short esp_dat_y[] = {
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
- 0x0000,0x004B,0x004F,0x0054,0x0058,0x005D,0x0061,0x0066,
- 0x006A,0x006F,0x0073,0x0078,0x007D,0x0081,0x0086,0x008B,
- 0x008F,0x0094,0x0099,0x009D,0x00A2,0x00A7,0x00AC,0x00B1,
- 0x00B5,0x00BA,0x00BF,0x00C4,0x00C9,0x00CE,0x00D3,0x00D8,
- 0x00DD,0x00E2,0x00E7,0x00EC,0x00F1,0x00F6,0x00FB,0x0100,
- 0x0105,0x010A,0x010F,0x0115,0x011A,0x011F,0x0124,0x012A,
- 0x012F,0x0134,0x0139,0x013F,0x0144,0x0149,0x014F,0x0154,
- 0x015A,0x015F,0x0164,0x016A,0x016F,0x0175,0x017A,0x0180,
- 0x0185,0x018B,0x0191,0x0196,0x019C,0x01A1,0x01A7,0x01AD,
- 0x01B3,0x01B8,0x01BE,0x01C4,0x01C9,0x01CF,0x01D5,0x01DB,
- 0x01E1,0x01E7,0x01EC,0x01F2,0x01F8,0x01FE,0x0204,0x020A,
- 0x0210,0x0216,0x021C,0x0222,0x0228,0x022E,0x0234,0x023A,
- 0x0240,0x0246,0x024C,0x0253,0x0259,0x025F,0x0265,0x026B,
- 0x0272,0x0278,0x027E,0x0284,0x028B,0x0291,0x0297,0x029E,
- 0x02A4,0x02AA,0x02B1,0x02B7,0x02BE,0x02C4,0x02CB,0x02D1,
- 0x02D8,0x02DE,0x02E5,0x02EB,0x02F2,0x02F8,0x02FF,0x0305,
- 0x030C,0x0313,0x0319,0x0320,0x0327,0x032D,0x0334,0x033B,
- 0x0341,0x0348,0x034F,0x0356,0x035D,0x0363,0x036A,0x0371,
- 0x0378,0x037F,0x0386,0x038C,0x0393,0x039A,0x03A1,0x03A8,
- 0x03AF,0x03B6,0x03BD,0x03C4,0x03CB,0x03D2,0x03D9,0x03E0,
- 0x03E7,0x03EE,0x03F5,0x03FD,0x0404,0x040B,0x0412,0x0419,
- 0x0420,0x0427,0x042F,0x0436,0x043D,0x0444,0x044C,0x0453,
- 0x045A,0x0461,0x0469,0x0470,0x0477,0x047F,0x0486,0x048D,
- 0x0495,0x049C,0x04A3,0x04AB,0x04B2,0x04BA,0x04C1,0x04C9,
- 0x04D0,0x04D7,0x04DF,0x04E6,0x04EE,0x04F5,0x04FD,0x0504,
- 0x050C,0x0514,0x051B,0x0523,0x052A,0x0532,0x0539,0x0541,
- 0x0549,0x0550,0x0558,0x0560,0x0567,0x056F,0x0577,0x057E,
- 0x0586,0x058E,0x0595,0x059D,0x05A5,0x05AD,0x05B4,0x05BC,
- 0x05C4,0x05CC,0x05D3,0x05DB,0x05E3,0x05EB,0x05F3,0x05FB,
- 0x0602,0x060A,0x0612,0x061A,0x0622,0x062A,0x0632,0x0639,
- 0x0641,0x0649,0x0651,0x0659,0x0661,0x0669,0x0671,0x0679,
- 0x0681,0x0689,0x0691,0x0699,0x06A1,0x06A9,0x06B1,0x06B9,
- 0x06C1,0x06C9,0x06D1,0x06D9,0x06E1,0x06E9,0x06F1,0x06F9,
- 0x0701,0x0709,0x0711,0x0719,0x0722,0x072A,0x0732,0x073A,
- 0x0742,0x074A,0x0752,0x075A,0x0762,0x076B,0x0773,0x077B,
- 0x0783,0x078B,0x0793,0x079C,0x07A4,0x07AC,0x07B4,0x07BC,
- 0x07C5,0x07CD,0x07D5,0x07DD,0x07E5,0x07EE,0x07F6,0x07FE,
- 0x0806,0x080F,0x0817,0x081F,0x0827,0x0830,0x0838,0x0840,
- 0x0848,0x0851,0x0859,0x0861,0x086A,0x0872,0x087A,0x0883,
- 0x088B,0x0893,0x089B,0x08A4,0x08AC,0x08B4,0x08BD,0x08C5,
- 0x08CD,0x08D6,0x08DE,0x08E6,0x08EF,0x08F7,0x0900,0x0908,
- 0x0910,0x0919,0x0921,0x0929,0x0932,0x093A,0x0943,0x094B,
- 0x0953,0x095C,0x0964,0x096D,0x0975,0x097D,0x0986,0x098E,
- 0x0997,0x099F,0x09A8,0x09B0,0x09B8,0x09C1,0x09C9,0x09D2,
- 0x09DA,0x09E3,0x09EB,0x09F4,0x09FC,0x0A04,0x0A0D,0x0A15,
- 0x0A1E,0x0A26,0x0A2F,0x0A37,0x0A40,0x0A48,0x0A51,0x0A59,
- 0x0A62,0x0A6A,0x0A73,0x0A7B,0x0A84,0x0A8C,0x0A95,0x0A9D,
- 0x0AA6,0x0AAE,0x0AB7,0x0ABF,0x0AC8,0x0AD0,0x0AD9,0x0AE2,
- 0x0AEA,0x0AF3,0x0AFB,0x0B04,0x0B0C,0x0B15,0x0B1D,0x0B26,
- 0x0B2F,0x0B37,0x0B40,0x0B48,0x0B51,0x0B5A,0x0B62,0x0B6B,
- 0x0B73,0x0B7C,0x0B84,0x0B8D,0x0B96,0x0B9E,0x0BA7,0x0BB0,
- 0x0BB8,0x0BC1,0x0BC9,0x0BD2,0x0BDB,0x0BE3,0x0BEC,0x0BF5,
- 0x0BFD,0x0C06,0x0C0F,0x0C17,0x0C20,0x0C29,0x0C31,0x0C3A,
- 0x0C43,0x0C4B,0x0C54,0x0C5D,0x0C65,0x0C6E,0x0C77,0x0C80,
- 0x0C88,0x0C91,0x0C9A,0x0CA2,0x0CAB,0x0CB4,0x0CBD,0x0CC5,
- 0x0CCE,0x0CD7,0x0CE0,0x0CE9,0x0CF1,0x0CFA,0x0D03,0x0D0C,
- 0x0D14,0x0D1D,0x0D26,0x0D2F,0x0D38,0x0D40,0x0D49,0x0D52,
- 0x0D5B,0x0D64,0x0D6D,0x0D75,0x0D7E,0x0D87,0x0D90,0x0D99,
- 0x0DA2,0x0DAB,0x0DB4,0x0DBC,0x0DC5,0x0DCE,0x0DD7,0x0DE0,
- 0x0DE9,0x0DF2,0x0DFB,0x0E04,0x0E0D,0x0E16,0x0E1F,0x0E28,
- 0x0E31,0x0E3A,0x0E43,0x0E4C,0x0E55,0x0E5E,0x0E67,0x0E70,
- 0x0E79,0x0E82,0x0E8B,0x0E94,0x0E9D,0x0EA6,0x0EAF,0x0EB8,
- 0x0EC1,0x0ECA,0x0ED4,0x0EDD,0x0EE6,0x0EEF,0x0EF8,0x0F01,
- 0x0F0A,0x0F14,0x0F1D,0x0F26,0x0F2F,0x0F38,0x0F42,0x0F4B,
- 0x0F54,0x0F5D,0x0F67,0x0F70,0x0F79,0x0F82,0x0F8C,0x0F95,
- 0x0F9E,0x0FA8,0x0FB1,0x0FBA,0x0FC4,0x0FCD,0x0FD6,0x0FE0,
- 0x0FE9,0x0FF3,0x0FFC,0x1006,0x100F,0x1018,0x1022,0x102B,
- 0x1035,0x103E,0x1048,0x1051,0x105B,0x1065,0x106E,0x1078,
- 0x1081,0x108B,0x1094,0x109E,0x10A8,0x10B1,0x10BB,0x10C5,
- 0x10CE,0x10D8,0x10E2,0x10EC,0x10F5,0x10FF,0x1109,0x1113,
- 0x111C,0x1126,0x1130,0x113A,0x1144,0x114E,0x1158,0x1161,
- 0x116B,0x1175,0x117F,0x1189,0x1193,0x119D,0x11A7,0x11B1,
- 0x11BB,0x11C5,0x11CF,0x11DA,0x11E4,0x11EE,0x11F8,0x1202,
- 0x120C,0x1217,0x1221,0x122B,0x1235,0x1240,0x124A,0x1254,
- 0x125E,0x1269,0x1273,0x127E,0x1288,0x1292,0x129D,0x12A7,
- 0x12B2,0x12BC,0x12C7,0x12D1,0x12DC,0x12E7,0x12F1,0x12FC,
- 0x1306,0x1311,0x131C,0x1327,0x1331,0x133C,0x1347,0x1352,
- 0x135C,0x1367,0x1372,0x137D,0x1388,0x1393,0x139E,0x13A9,
- 0x13B4,0x13BF,0x13CA,0x13D5,0x13E0,0x13EB,0x13F6,0x1402,
- 0x140D,0x1418,0x1423,0x142F,0x143A,0x1445,0x1451,0x145C,
- 0x1468,0x1473,0x147E,0x148A,0x1496,0x14A1,0x14AD,0x14B8,
- 0x14C4,0x14D0,0x14DB,0x14E7,0x14F3,0x14FF,0x150A,0x1516,
- 0x1522,0x152E,0x153A,0x1546,0x1552,0x155E,0x156A,0x1576,
- 0x1582,0x158F,0x159B,0x15A7,0x15B3,0x15C0,0x15CC,0x15D8,
- 0x15E5,0x15F1,0x15FE,0x160A,0x1617,0x1623,0x1630,0x163D,
- 0x1649,0x1656,0x1663,0x1670,0x167D,0x168A,0x1696,0x16A3,
- 0x16B0,0x16BE,0x16CB,0x16D8,0x16E5,0x16F2,0x16FF,0x170D,
- 0x171A,0x1727,0x1735,0x1742,0x1750,0x175D,0x176B,0x1779,
- 0x1786,0x1794,0x17A2,0x17B0,0x17BD,0x17CB,0x17D9,0x17E7,
- 0x17F5,0x1803,0x1812,0x1820,0x182E,0x183C,0x184B,0x1859,
- 0x1867,0x1876,0x1884,0x1893,0x18A2,0x18B0,0x18BF,0x18CE,
- 0x18DD,0x18EC,0x18FB,0x190A,0x1919,0x1928,0x1937,0x1946,
- 0x1956,0x1965,0x1974,0x1984,0x1993,0x19A3,0x19B3,0x19C2,
- 0x19D2,0x19E2,0x19F2,0x1A02,0x1A12,0x1A22,0x1A32,0x1A42,
- 0x1A53,0x1A63,0x1A73,0x1A84,0x1A94,0x1AA5,0x1AB6,0x1AC6,
- 0x1AD7,0x1AE8,0x1AF9,0x1B0A,0x1B1B,0x1B2C,0x1B3E,0x1B4F,
- 0x1B60,0x1B72,0x1B83,0x1B95,0x1BA7,0x1BB8,0x1BCA,0x1BDC,
- 0x1BEE,0x1C00,0x1C13,0x1C25,0x1C37,0x1C4A,0x1C5C,0x1C6F,
- 0x1C81,0x1C94,0x1CA7,0x1CBA,0x1CCD,0x1CE0,0x1CF3,0x1D06,
- 0x1D1A,0x1D2D,0x1D41,0x1D55,0x1D68,0x1D7C,0x1D90,0x1DA4,
- 0x1DB8,0x1DCD,0x1DE1,0x1DF5,0x1E0A,0x1E1E,0x1E33,0x1E48,
- 0x1E5D,0x1E72,0x1E87,0x1E9D,0x1EB2,0x1EC7,0x1EDD,0x1EF3,
- 0x1F09,0x1F1F,0x1F35,0x1F4B,0x1F61,0x1F78,0x1F8E,0x1FA5,
- 0x1FBC,0x1FD2,0x1FE9,0x2001,0x2018,0x202F,0x2047,0x205F,
- 0x2076,0x208E,0x20A6,0x20BF,0x20D7,0x20EF,0x2108,0x2121,
- 0x213A,0x2153,0x216C,0x2185,0x219F,0x21B9,0x21D2,0x21EC,
- 0x2206,0x2221,0x223B,0x2256,0x2271,0x228B,0x22A7,0x22C2,
- 0x22DD,0x22F9,0x2315,0x2330,0x234D,0x2369,0x2385,0x23A2,
- 0x23BF,0x23DC,0x23F9,0x2416,0x2434,0x2452,0x2470,0x248E,
- 0x24AC,0x24CB,0x24EA,0x2509,0x2528,0x2547,0x2567,0x2587,
- 0x25A7,0x25C7,0x25E8,0x2609,0x262A,0x264B,0x266C,0x268E,
- 0x26B0,0x26D2,0x26F4,0x2717,0x273A,0x275D,0x2781,0x27A4,
- 0x27C8,0x27ED,0x2811,0x2836,0x285B,0x2880,0x28A6,0x28CC,
- 0x28F2,0x2919,0x2940,0x2967,0x298E,0x29B6,0x29DE,0x2A06,
- 0x2A2F,0x2A58,0x2A81,0x2AAB,0x2AD5,0x2B00,0x2B2A,0x2B55,
- 0x2B81,0x2BAD,0x2BD9,0x2C06,0x2C33,0x2C60,0x2C8E,0x2CBC,
- 0x2CEA,0x2D19,0x2D49,0x2D78,0x2DA9,0x2DD9,0x2E0A,0x2E3C,
- 0x2E6E,0x2EA0,0x2ED3,0x2F07,0x2F3B,0x2F6F,0x2FA4,0x2FD9,
- 0x300F,0x3046,0x307C,0x30B4,0x30EC,0x3124,0x315E,0x3197,
- 0x31D1,0x320C,0x3248,0x3284,0x32C0,0x32FE,0x333C,0x337A,
- 0x33B9,0x33F9,0x343A,0x347B,0x34BD,0x3500,0x3543,0x3587,
- 0x35CC,0x3612,0x3658,0x369F,0x36E7,0x3730,0x377A,0x37C4,
- 0x3810,0x385C,0x38A9,0x38F7,0x3946,0x3996,0x39E7,0x3A39,
- 0x3A8C,0x3AE0,0x3B35,0x3B8B,0x3BE2,0x3C3B,0x3C94,0x3CEF,
- 0x3D4A,0x3DA7,0x3E05,0x3E65,0x3EC6,0x3F28,0x3F8B,0x3FF0
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
+ 0x0000,0x004B,0x004F,0x0054,0x0058,0x005D,0x0061,0x0066,
+ 0x006A,0x006F,0x0073,0x0078,0x007D,0x0081,0x0086,0x008B,
+ 0x008F,0x0094,0x0099,0x009D,0x00A2,0x00A7,0x00AC,0x00B1,
+ 0x00B5,0x00BA,0x00BF,0x00C4,0x00C9,0x00CE,0x00D3,0x00D8,
+ 0x00DD,0x00E2,0x00E7,0x00EC,0x00F1,0x00F6,0x00FB,0x0100,
+ 0x0105,0x010A,0x010F,0x0115,0x011A,0x011F,0x0124,0x012A,
+ 0x012F,0x0134,0x0139,0x013F,0x0144,0x0149,0x014F,0x0154,
+ 0x015A,0x015F,0x0164,0x016A,0x016F,0x0175,0x017A,0x0180,
+ 0x0185,0x018B,0x0191,0x0196,0x019C,0x01A1,0x01A7,0x01AD,
+ 0x01B3,0x01B8,0x01BE,0x01C4,0x01C9,0x01CF,0x01D5,0x01DB,
+ 0x01E1,0x01E7,0x01EC,0x01F2,0x01F8,0x01FE,0x0204,0x020A,
+ 0x0210,0x0216,0x021C,0x0222,0x0228,0x022E,0x0234,0x023A,
+ 0x0240,0x0246,0x024C,0x0253,0x0259,0x025F,0x0265,0x026B,
+ 0x0272,0x0278,0x027E,0x0284,0x028B,0x0291,0x0297,0x029E,
+ 0x02A4,0x02AA,0x02B1,0x02B7,0x02BE,0x02C4,0x02CB,0x02D1,
+ 0x02D8,0x02DE,0x02E5,0x02EB,0x02F2,0x02F8,0x02FF,0x0305,
+ 0x030C,0x0313,0x0319,0x0320,0x0327,0x032D,0x0334,0x033B,
+ 0x0341,0x0348,0x034F,0x0356,0x035D,0x0363,0x036A,0x0371,
+ 0x0378,0x037F,0x0386,0x038C,0x0393,0x039A,0x03A1,0x03A8,
+ 0x03AF,0x03B6,0x03BD,0x03C4,0x03CB,0x03D2,0x03D9,0x03E0,
+ 0x03E7,0x03EE,0x03F5,0x03FD,0x0404,0x040B,0x0412,0x0419,
+ 0x0420,0x0427,0x042F,0x0436,0x043D,0x0444,0x044C,0x0453,
+ 0x045A,0x0461,0x0469,0x0470,0x0477,0x047F,0x0486,0x048D,
+ 0x0495,0x049C,0x04A3,0x04AB,0x04B2,0x04BA,0x04C1,0x04C9,
+ 0x04D0,0x04D7,0x04DF,0x04E6,0x04EE,0x04F5,0x04FD,0x0504,
+ 0x050C,0x0514,0x051B,0x0523,0x052A,0x0532,0x0539,0x0541,
+ 0x0549,0x0550,0x0558,0x0560,0x0567,0x056F,0x0577,0x057E,
+ 0x0586,0x058E,0x0595,0x059D,0x05A5,0x05AD,0x05B4,0x05BC,
+ 0x05C4,0x05CC,0x05D3,0x05DB,0x05E3,0x05EB,0x05F3,0x05FB,
+ 0x0602,0x060A,0x0612,0x061A,0x0622,0x062A,0x0632,0x0639,
+ 0x0641,0x0649,0x0651,0x0659,0x0661,0x0669,0x0671,0x0679,
+ 0x0681,0x0689,0x0691,0x0699,0x06A1,0x06A9,0x06B1,0x06B9,
+ 0x06C1,0x06C9,0x06D1,0x06D9,0x06E1,0x06E9,0x06F1,0x06F9,
+ 0x0701,0x0709,0x0711,0x0719,0x0722,0x072A,0x0732,0x073A,
+ 0x0742,0x074A,0x0752,0x075A,0x0762,0x076B,0x0773,0x077B,
+ 0x0783,0x078B,0x0793,0x079C,0x07A4,0x07AC,0x07B4,0x07BC,
+ 0x07C5,0x07CD,0x07D5,0x07DD,0x07E5,0x07EE,0x07F6,0x07FE,
+ 0x0806,0x080F,0x0817,0x081F,0x0827,0x0830,0x0838,0x0840,
+ 0x0848,0x0851,0x0859,0x0861,0x086A,0x0872,0x087A,0x0883,
+ 0x088B,0x0893,0x089B,0x08A4,0x08AC,0x08B4,0x08BD,0x08C5,
+ 0x08CD,0x08D6,0x08DE,0x08E6,0x08EF,0x08F7,0x0900,0x0908,
+ 0x0910,0x0919,0x0921,0x0929,0x0932,0x093A,0x0943,0x094B,
+ 0x0953,0x095C,0x0964,0x096D,0x0975,0x097D,0x0986,0x098E,
+ 0x0997,0x099F,0x09A8,0x09B0,0x09B8,0x09C1,0x09C9,0x09D2,
+ 0x09DA,0x09E3,0x09EB,0x09F4,0x09FC,0x0A04,0x0A0D,0x0A15,
+ 0x0A1E,0x0A26,0x0A2F,0x0A37,0x0A40,0x0A48,0x0A51,0x0A59,
+ 0x0A62,0x0A6A,0x0A73,0x0A7B,0x0A84,0x0A8C,0x0A95,0x0A9D,
+ 0x0AA6,0x0AAE,0x0AB7,0x0ABF,0x0AC8,0x0AD0,0x0AD9,0x0AE2,
+ 0x0AEA,0x0AF3,0x0AFB,0x0B04,0x0B0C,0x0B15,0x0B1D,0x0B26,
+ 0x0B2F,0x0B37,0x0B40,0x0B48,0x0B51,0x0B5A,0x0B62,0x0B6B,
+ 0x0B73,0x0B7C,0x0B84,0x0B8D,0x0B96,0x0B9E,0x0BA7,0x0BB0,
+ 0x0BB8,0x0BC1,0x0BC9,0x0BD2,0x0BDB,0x0BE3,0x0BEC,0x0BF5,
+ 0x0BFD,0x0C06,0x0C0F,0x0C17,0x0C20,0x0C29,0x0C31,0x0C3A,
+ 0x0C43,0x0C4B,0x0C54,0x0C5D,0x0C65,0x0C6E,0x0C77,0x0C80,
+ 0x0C88,0x0C91,0x0C9A,0x0CA2,0x0CAB,0x0CB4,0x0CBD,0x0CC5,
+ 0x0CCE,0x0CD7,0x0CE0,0x0CE9,0x0CF1,0x0CFA,0x0D03,0x0D0C,
+ 0x0D14,0x0D1D,0x0D26,0x0D2F,0x0D38,0x0D40,0x0D49,0x0D52,
+ 0x0D5B,0x0D64,0x0D6D,0x0D75,0x0D7E,0x0D87,0x0D90,0x0D99,
+ 0x0DA2,0x0DAB,0x0DB4,0x0DBC,0x0DC5,0x0DCE,0x0DD7,0x0DE0,
+ 0x0DE9,0x0DF2,0x0DFB,0x0E04,0x0E0D,0x0E16,0x0E1F,0x0E28,
+ 0x0E31,0x0E3A,0x0E43,0x0E4C,0x0E55,0x0E5E,0x0E67,0x0E70,
+ 0x0E79,0x0E82,0x0E8B,0x0E94,0x0E9D,0x0EA6,0x0EAF,0x0EB8,
+ 0x0EC1,0x0ECA,0x0ED4,0x0EDD,0x0EE6,0x0EEF,0x0EF8,0x0F01,
+ 0x0F0A,0x0F14,0x0F1D,0x0F26,0x0F2F,0x0F38,0x0F42,0x0F4B,
+ 0x0F54,0x0F5D,0x0F67,0x0F70,0x0F79,0x0F82,0x0F8C,0x0F95,
+ 0x0F9E,0x0FA8,0x0FB1,0x0FBA,0x0FC4,0x0FCD,0x0FD6,0x0FE0,
+ 0x0FE9,0x0FF3,0x0FFC,0x1006,0x100F,0x1018,0x1022,0x102B,
+ 0x1035,0x103E,0x1048,0x1051,0x105B,0x1065,0x106E,0x1078,
+ 0x1081,0x108B,0x1094,0x109E,0x10A8,0x10B1,0x10BB,0x10C5,
+ 0x10CE,0x10D8,0x10E2,0x10EC,0x10F5,0x10FF,0x1109,0x1113,
+ 0x111C,0x1126,0x1130,0x113A,0x1144,0x114E,0x1158,0x1161,
+ 0x116B,0x1175,0x117F,0x1189,0x1193,0x119D,0x11A7,0x11B1,
+ 0x11BB,0x11C5,0x11CF,0x11DA,0x11E4,0x11EE,0x11F8,0x1202,
+ 0x120C,0x1217,0x1221,0x122B,0x1235,0x1240,0x124A,0x1254,
+ 0x125E,0x1269,0x1273,0x127E,0x1288,0x1292,0x129D,0x12A7,
+ 0x12B2,0x12BC,0x12C7,0x12D1,0x12DC,0x12E7,0x12F1,0x12FC,
+ 0x1306,0x1311,0x131C,0x1327,0x1331,0x133C,0x1347,0x1352,
+ 0x135C,0x1367,0x1372,0x137D,0x1388,0x1393,0x139E,0x13A9,
+ 0x13B4,0x13BF,0x13CA,0x13D5,0x13E0,0x13EB,0x13F6,0x1402,
+ 0x140D,0x1418,0x1423,0x142F,0x143A,0x1445,0x1451,0x145C,
+ 0x1468,0x1473,0x147E,0x148A,0x1496,0x14A1,0x14AD,0x14B8,
+ 0x14C4,0x14D0,0x14DB,0x14E7,0x14F3,0x14FF,0x150A,0x1516,
+ 0x1522,0x152E,0x153A,0x1546,0x1552,0x155E,0x156A,0x1576,
+ 0x1582,0x158F,0x159B,0x15A7,0x15B3,0x15C0,0x15CC,0x15D8,
+ 0x15E5,0x15F1,0x15FE,0x160A,0x1617,0x1623,0x1630,0x163D,
+ 0x1649,0x1656,0x1663,0x1670,0x167D,0x168A,0x1696,0x16A3,
+ 0x16B0,0x16BE,0x16CB,0x16D8,0x16E5,0x16F2,0x16FF,0x170D,
+ 0x171A,0x1727,0x1735,0x1742,0x1750,0x175D,0x176B,0x1779,
+ 0x1786,0x1794,0x17A2,0x17B0,0x17BD,0x17CB,0x17D9,0x17E7,
+ 0x17F5,0x1803,0x1812,0x1820,0x182E,0x183C,0x184B,0x1859,
+ 0x1867,0x1876,0x1884,0x1893,0x18A2,0x18B0,0x18BF,0x18CE,
+ 0x18DD,0x18EC,0x18FB,0x190A,0x1919,0x1928,0x1937,0x1946,
+ 0x1956,0x1965,0x1974,0x1984,0x1993,0x19A3,0x19B3,0x19C2,
+ 0x19D2,0x19E2,0x19F2,0x1A02,0x1A12,0x1A22,0x1A32,0x1A42,
+ 0x1A53,0x1A63,0x1A73,0x1A84,0x1A94,0x1AA5,0x1AB6,0x1AC6,
+ 0x1AD7,0x1AE8,0x1AF9,0x1B0A,0x1B1B,0x1B2C,0x1B3E,0x1B4F,
+ 0x1B60,0x1B72,0x1B83,0x1B95,0x1BA7,0x1BB8,0x1BCA,0x1BDC,
+ 0x1BEE,0x1C00,0x1C13,0x1C25,0x1C37,0x1C4A,0x1C5C,0x1C6F,
+ 0x1C81,0x1C94,0x1CA7,0x1CBA,0x1CCD,0x1CE0,0x1CF3,0x1D06,
+ 0x1D1A,0x1D2D,0x1D41,0x1D55,0x1D68,0x1D7C,0x1D90,0x1DA4,
+ 0x1DB8,0x1DCD,0x1DE1,0x1DF5,0x1E0A,0x1E1E,0x1E33,0x1E48,
+ 0x1E5D,0x1E72,0x1E87,0x1E9D,0x1EB2,0x1EC7,0x1EDD,0x1EF3,
+ 0x1F09,0x1F1F,0x1F35,0x1F4B,0x1F61,0x1F78,0x1F8E,0x1FA5,
+ 0x1FBC,0x1FD2,0x1FE9,0x2001,0x2018,0x202F,0x2047,0x205F,
+ 0x2076,0x208E,0x20A6,0x20BF,0x20D7,0x20EF,0x2108,0x2121,
+ 0x213A,0x2153,0x216C,0x2185,0x219F,0x21B9,0x21D2,0x21EC,
+ 0x2206,0x2221,0x223B,0x2256,0x2271,0x228B,0x22A7,0x22C2,
+ 0x22DD,0x22F9,0x2315,0x2330,0x234D,0x2369,0x2385,0x23A2,
+ 0x23BF,0x23DC,0x23F9,0x2416,0x2434,0x2452,0x2470,0x248E,
+ 0x24AC,0x24CB,0x24EA,0x2509,0x2528,0x2547,0x2567,0x2587,
+ 0x25A7,0x25C7,0x25E8,0x2609,0x262A,0x264B,0x266C,0x268E,
+ 0x26B0,0x26D2,0x26F4,0x2717,0x273A,0x275D,0x2781,0x27A4,
+ 0x27C8,0x27ED,0x2811,0x2836,0x285B,0x2880,0x28A6,0x28CC,
+ 0x28F2,0x2919,0x2940,0x2967,0x298E,0x29B6,0x29DE,0x2A06,
+ 0x2A2F,0x2A58,0x2A81,0x2AAB,0x2AD5,0x2B00,0x2B2A,0x2B55,
+ 0x2B81,0x2BAD,0x2BD9,0x2C06,0x2C33,0x2C60,0x2C8E,0x2CBC,
+ 0x2CEA,0x2D19,0x2D49,0x2D78,0x2DA9,0x2DD9,0x2E0A,0x2E3C,
+ 0x2E6E,0x2EA0,0x2ED3,0x2F07,0x2F3B,0x2F6F,0x2FA4,0x2FD9,
+ 0x300F,0x3046,0x307C,0x30B4,0x30EC,0x3124,0x315E,0x3197,
+ 0x31D1,0x320C,0x3248,0x3284,0x32C0,0x32FE,0x333C,0x337A,
+ 0x33B9,0x33F9,0x343A,0x347B,0x34BD,0x3500,0x3543,0x3587,
+ 0x35CC,0x3612,0x3658,0x369F,0x36E7,0x3730,0x377A,0x37C4,
+ 0x3810,0x385C,0x38A9,0x38F7,0x3946,0x3996,0x39E7,0x3A39,
+ 0x3A8C,0x3AE0,0x3B35,0x3B8B,0x3BE2,0x3C3B,0x3C94,0x3CEF,
+ 0x3D4A,0x3DA7,0x3E05,0x3E65,0x3EC6,0x3F28,0x3F8B,0x3FF0
};
#ifdef __STDC__
static signed short barrier_dat[] = {
#else
static short barrier_dat[] = {
#endif
- 0x3FF0,0x3FF0,0x3000,0x1555,0x0C00,0x07AE,0x0555,0x03EB,
- 0x0300,0x025E,0x01EB,0x0196,0x3FF0,0x3FF0,0x2666,0x1333,
- 0x0B4B,0x0762,0x0530,0x03D7,0x02F4,0x0257,0x01E6,0x0192,
- 0x3000,0x2666,0x1800,0x0EC4,0x0999,0x069E,0x04CC,0x039F,
- 0x02D2,0x0242,0x01D8,0x0189,0x1555,0x1333,0x0EC4,0x0AAA,
- 0x07AE,0x05A5,0x0444,0x034F,0x02A1,0x0222,0x01C2,0x017A,
- 0x0C00,0x0B4B,0x0999,0x07AE,0x0600,0x04AE,0x03B1,0x02F4,
- 0x0266,0x01FA,0x01A7,0x0166,0x07AE,0x0762,0x069E,0x05A5,
- 0x04AE,0x03D7,0x0325,0x0298,0x0228,0x01CF,0x0189,0x0150,
- 0x0555,0x0530,0x04CC,0x0444,0x03B1,0x0325,0x02AA,0x0242,
- 0x01EB,0x01A4,0x0169,0x0139,0x03EB,0x03D7,0x039F,0x034F,
- 0x02F4,0x0298,0x0242,0x01F5,0x01B2,0x017A,0x0149,0x0121,
- 0x0300,0x02F4,0x02D2,0x02A1,0x0266,0x0228,0x01EB,0x01B2,
- 0x0180,0x0152,0x012B,0x0109,0x025E,0x0257,0x0242,0x0222,
- 0x01FA,0x01CF,0x01A4,0x017A,0x0152,0x012F,0x010F,0x00F3,
- 0x01EB,0x01E6,0x01D8,0x01C2,0x01A7,0x0189,0x0169,0x0149,
- 0x012B,0x010F,0x00F5,0x00DE,0x0196,0x0192,0x0189,0x017A,
- 0x0166,0x0150,0x0139,0x0121,0x0109,0x00F3,0x00DE,0x00CB
+ 0x3FF0,0x3FF0,0x3000,0x1555,0x0C00,0x07AE,0x0555,0x03EB,
+ 0x0300,0x025E,0x01EB,0x0196,0x3FF0,0x3FF0,0x2666,0x1333,
+ 0x0B4B,0x0762,0x0530,0x03D7,0x02F4,0x0257,0x01E6,0x0192,
+ 0x3000,0x2666,0x1800,0x0EC4,0x0999,0x069E,0x04CC,0x039F,
+ 0x02D2,0x0242,0x01D8,0x0189,0x1555,0x1333,0x0EC4,0x0AAA,
+ 0x07AE,0x05A5,0x0444,0x034F,0x02A1,0x0222,0x01C2,0x017A,
+ 0x0C00,0x0B4B,0x0999,0x07AE,0x0600,0x04AE,0x03B1,0x02F4,
+ 0x0266,0x01FA,0x01A7,0x0166,0x07AE,0x0762,0x069E,0x05A5,
+ 0x04AE,0x03D7,0x0325,0x0298,0x0228,0x01CF,0x0189,0x0150,
+ 0x0555,0x0530,0x04CC,0x0444,0x03B1,0x0325,0x02AA,0x0242,
+ 0x01EB,0x01A4,0x0169,0x0139,0x03EB,0x03D7,0x039F,0x034F,
+ 0x02F4,0x0298,0x0242,0x01F5,0x01B2,0x017A,0x0149,0x0121,
+ 0x0300,0x02F4,0x02D2,0x02A1,0x0266,0x0228,0x01EB,0x01B2,
+ 0x0180,0x0152,0x012B,0x0109,0x025E,0x0257,0x0242,0x0222,
+ 0x01FA,0x01CF,0x01A4,0x017A,0x0152,0x012F,0x010F,0x00F3,
+ 0x01EB,0x01E6,0x01D8,0x01C2,0x01A7,0x0189,0x0169,0x0149,
+ 0x012B,0x010F,0x00F5,0x00DE,0x0196,0x0192,0x0189,0x017A,
+ 0x0166,0x0150,0x0139,0x0121,0x0109,0x00F3,0x00DE,0x00CB
};
diff --git a/gs/contrib/japanese/gdevml6.c b/gs/contrib/japanese/gdevml6.c
index 7876299fd..3562a3ba2 100644
--- a/gs/contrib/japanese/gdevml6.c
+++ b/gs/contrib/japanese/gdevml6.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
Distributed by Free Software Foundation, Inc.
This file is part of Ghostscript.
@@ -20,9 +20,9 @@ copies. */
/* gdevml6.c */
/* OKI MICROLINE 620CL IPL mode driver for Ghostscript */
/*
- Mar. 14, 1998 N.Tagawa
+ Mar. 14, 1998 N.Tagawa
- $Id: gdevml6.c,v 1.4 2002/07/30 18:53:22 easysw Exp $
+ $Id: gdevml6.c,v 1.4 2002/07/30 18:53:22 easysw Exp $
*/
#include "gdevprn.h"
@@ -33,51 +33,50 @@ static dev_proc_close_device(ml600_close);
static dev_proc_print_page(ml600_print_page);
static gx_device_procs ml600_procs =
- prn_procs(ml600_open, gdev_prn_output_page, ml600_close);
+ prn_procs(ml600_open, gdev_prn_output_page, ml600_close);
gx_device_printer gs_ml600_device =
prn_device(ml600_procs, "ml600",
- 83, /* width_10ths, 8.3" */
- 117, /* height_10ths, 11.7" */
- 600, 600,
- 0.20, 0.20, 0.20, 0.20, /* margins, lbrt */
- 1, ml600_print_page);
-
+ 83, /* width_10ths, 8.3" */
+ 117, /* height_10ths, 11.7" */
+ 600, 600,
+ 0.20, 0.20, 0.20, 0.20, /* margins, lbrt */
+ 1, ml600_print_page);
/* ------ prototype ------ */
static int
ml_finish(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ FILE *fp);
static int
ml_init(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ FILE *fp);
static int
move_pos(
- FILE *fp,
- int n,
- int m);
+ FILE *fp,
+ int n,
+ int m);
static int
make_line_data(
- byte *curr_data,
- byte *last_data,
- int line_size,
- byte *buf);
+ byte *curr_data,
+ byte *last_data,
+ int line_size,
+ byte *buf);
static int
send_line(
- byte *buf,
- int cnt,
- FILE *fp);
+ byte *buf,
+ int cnt,
+ FILE *fp);
static int
page_header(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ FILE *fp);
/* ------ Internal routines ------ */
@@ -85,269 +84,261 @@ page_header(
#define LINE_SIZE ((7016+7) / 8) /* bytes per line (A4 600 DPI) */
#define ppdev ((gx_device_printer *)pdev)
-
static int
ml600_open(
- gx_device *pdev)
+ gx_device *pdev)
{
- int code = gdev_prn_open(pdev);
- FILE *prn_stream;
-
- /* dprintf("gdevml6: ml600_open called\n");*/
+ int code = gdev_prn_open(pdev);
+ FILE *prn_stream;
+
+ /* dprintf("gdevml6: ml600_open called\n");*/
if (code < 0)
- return code;
+ return code;
- code = gdev_prn_open_printer(pdev, true);
- if (code < 0)
- return code;
+ code = gdev_prn_open_printer(pdev, true);
+ if (code < 0)
+ return code;
- prn_stream = ppdev->file;
- return ml_init(ppdev, prn_stream);
+ prn_stream = ppdev->file;
+ return ml_init(ppdev, prn_stream);
}
static int
ml600_close(
- gx_device *pdev)
+ gx_device *pdev)
{
- int code = gdev_prn_open_printer(pdev, true);
- FILE *prn_stream;
-
- /* dprintf("gdevml6: ml600_close called\n"); */
+ int code = gdev_prn_open_printer(pdev, true);
+ FILE *prn_stream;
+
+ /* dprintf("gdevml6: ml600_close called\n"); */
if (code < 0)
- return code;
+ return code;
- prn_stream = ppdev->file;
- ml_finish(ppdev, prn_stream);
+ prn_stream = ppdev->file;
+ ml_finish(ppdev, prn_stream);
- return gdev_prn_close(pdev);
+ return gdev_prn_close(pdev);
}
-
/* Send the page to the printer. */
static int
ml600_print_page(
- gx_device_printer *pdev,
- FILE *prn_stream)
+ gx_device_printer *pdev,
+ FILE *prn_stream)
{
- int ystep;
- byte data[2][LINE_SIZE*2];
- byte buf[LINE_SIZE*2];
- int skip;
- int current;
- int c_size;
- int lnum;
- int line_size;
- byte rmask;
- int i;
+ int ystep;
+ byte data[2][LINE_SIZE*2];
+ byte buf[LINE_SIZE*2];
+ int skip;
+ int current;
+ int c_size;
+ int lnum;
+ int line_size;
+ byte rmask;
+ int i;
#define LAST ((current ^ 1) & 1)
- /* initialize this page */
- ystep = page_header(pdev, prn_stream);
- ystep /= 300;
-
- /* clear last sent line buffer */
- skip = 0;
- current = 0;
- for (i = 0; i < LINE_SIZE*2; i++)
- data[LAST][i] = 0;
-
- /* Send each scan line */
- line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- if (line_size > LINE_SIZE || line_size == 0)
- return 0;
-
- rmask = (byte)(0xff << (-pdev->width & 7)); /* right edge */
-
- for (lnum = 0; lnum < pdev->height; lnum++) {
- int s;
-
- s = gdev_prn_copy_scan_lines(pdev, lnum, data[current],
- line_size);
- /* Mask right edge bits */
- *(data[current] + line_size - 1) &= rmask;
-
- /* blank line ? */
- for (i = 0; i < line_size; i++)
- if (data[current][i] != 0)
- break;
-
- if (i == line_size) {
- skip = 1;
- current = LAST;
- continue;
- }
-
- /* move position, if previous lines are skipped */
- if (skip) {
- move_pos(prn_stream, lnum / ystep, lnum % ystep);
- skip = 0;
- }
-
- /* create one line data */
- c_size = make_line_data(data[current], data[LAST],
- line_size, buf);
-
- /* send one line data */
- send_line(buf, c_size, prn_stream);
-
- /* swap line buffer */
- current = LAST;
- }
-
- /* eject page */
- fprintf(prn_stream, "\014");
-
- return 0;
-}
+ /* initialize this page */
+ ystep = page_header(pdev, prn_stream);
+ ystep /= 300;
+
+ /* clear last sent line buffer */
+ skip = 0;
+ current = 0;
+ for (i = 0; i < LINE_SIZE*2; i++)
+ data[LAST][i] = 0;
+
+ /* Send each scan line */
+ line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ if (line_size > LINE_SIZE || line_size == 0)
+ return 0;
+
+ rmask = (byte)(0xff << (-pdev->width & 7)); /* right edge */
+
+ for (lnum = 0; lnum < pdev->height; lnum++) {
+ int s;
+
+ s = gdev_prn_copy_scan_lines(pdev, lnum, data[current],
+ line_size);
+ /* Mask right edge bits */
+ *(data[current] + line_size - 1) &= rmask;
+
+ /* blank line ? */
+ for (i = 0; i < line_size; i++)
+ if (data[current][i] != 0)
+ break;
+ if (i == line_size) {
+ skip = 1;
+ current = LAST;
+ continue;
+ }
+
+ /* move position, if previous lines are skipped */
+ if (skip) {
+ move_pos(prn_stream, lnum / ystep, lnum % ystep);
+ skip = 0;
+ }
+
+ /* create one line data */
+ c_size = make_line_data(data[current], data[LAST],
+ line_size, buf);
+
+ /* send one line data */
+ send_line(buf, c_size, prn_stream);
+
+ /* swap line buffer */
+ current = LAST;
+ }
+
+ /* eject page */
+ fprintf(prn_stream, "\014");
+
+ return 0;
+}
static int
move_pos(
- FILE *fp,
- int n,
- int m)
+ FILE *fp,
+ int n,
+ int m)
{
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 2);
- fprintf(fp, "%c%c%c%c%c%c%c%c%c", ESC, 0x7c, 0xa4, 4, 0,
- (n >> 8) & 0xff, n & 0xff, 0, 0);
- if (m > 0) {
- int i;
-
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 0);
- for (i = 0; i < m; i++) {
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa7, 0, 1, 0);
- }
- }
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
-
- return 0;
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 2);
+ fprintf(fp, "%c%c%c%c%c%c%c%c%c", ESC, 0x7c, 0xa4, 4, 0,
+ (n >> 8) & 0xff, n & 0xff, 0, 0);
+ if (m > 0) {
+ int i;
+
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 0);
+ for (i = 0; i < m; i++) {
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa7, 0, 1, 0);
+ }
+ }
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
+
+ return 0;
}
-
static int
make_line_data(
- byte *curr_data,
- byte *last_data,
- int line_size,
- byte *buf)
+ byte *curr_data,
+ byte *last_data,
+ int line_size,
+ byte *buf)
{
- int i; /* raster data index */
- int n; /* output data index */
- int bytes; /* num of bitimage bytes in one block */
- int offs;
+ int i; /* raster data index */
+ int n; /* output data index */
+ int bytes; /* num of bitimage bytes in one block */
+ int offs;
#define TOP_BYTE(bytes,offs) ((((bytes - 1) & 7) << 5) | (offs & 0x1f))
- i = 0;
- n = 0;
-
- while (i < line_size) {
- /* skip unchanged bytes */
- offs = 0;
- while (i < line_size && curr_data[i] == last_data[i]) {
- i++;
- offs++;
- }
- if (i >= line_size)
- break;
-
- /* count changed bytes (max 8) */
- bytes = 1;
- while (i + bytes < line_size && bytes < 8 &&
- curr_data[i + bytes] != last_data[i + bytes]) {
- bytes++;
- }
-
- /* make data */
- if (offs < 0x1f) {
- buf[n++] = TOP_BYTE(bytes, offs);
- }
- else {
- offs -= 0x1f;
- buf[n++] = TOP_BYTE(bytes, 0x1f);
-
- while (offs >= 0xff) {
- offs -= 0xff;
- buf[n++] = 0xff;
- }
- buf[n++] = offs;
- }
-
- /* write bitimage */
- while (bytes > 0) {
- buf[n++] = curr_data[i++];
- --bytes;
- }
- }
-
- return n;
+ i = 0;
+ n = 0;
+
+ while (i < line_size) {
+ /* skip unchanged bytes */
+ offs = 0;
+ while (i < line_size && curr_data[i] == last_data[i]) {
+ i++;
+ offs++;
+ }
+ if (i >= line_size)
+ break;
+
+ /* count changed bytes (max 8) */
+ bytes = 1;
+ while (i + bytes < line_size && bytes < 8 &&
+ curr_data[i + bytes] != last_data[i + bytes]) {
+ bytes++;
+ }
+
+ /* make data */
+ if (offs < 0x1f) {
+ buf[n++] = TOP_BYTE(bytes, offs);
+ }
+ else {
+ offs -= 0x1f;
+ buf[n++] = TOP_BYTE(bytes, 0x1f);
+
+ while (offs >= 0xff) {
+ offs -= 0xff;
+ buf[n++] = 0xff;
+ }
+ buf[n++] = offs;
+ }
+
+ /* write bitimage */
+ while (bytes > 0) {
+ buf[n++] = curr_data[i++];
+ --bytes;
+ }
+ }
+
+ return n;
}
-
static int
send_line(
- byte *buf,
- int cnt,
- FILE *fp)
+ byte *buf,
+ int cnt,
+ FILE *fp)
{
- fprintf(fp, "%c%c%c", ESC, 0x7c, 0xa7);
- fprintf(fp, "%c%c", (cnt >> 8) & 0xff, cnt & 0xff);
- return fwrite(buf, sizeof(byte), cnt, fp);
+ fprintf(fp, "%c%c%c", ESC, 0x7c, 0xa7);
+ fprintf(fp, "%c%c", (cnt >> 8) & 0xff, cnt & 0xff);
+ return fwrite(buf, sizeof(byte), cnt, fp);
}
-
static int
ml_init(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ FILE *fp)
{
- /* dprintf("gdevml6: ml_init called\n"); */
+ /* dprintf("gdevml6: ml_init called\n"); */
- fprintf(fp, "%c%c%c", ESC, 0x2f, 0xf2);
+ fprintf(fp, "%c%c%c", ESC, 0x2f, 0xf2);
- return 0;
+ return 0;
}
-
static int
page_header(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ FILE *fp)
{
- int ydpi;
-
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa0, 1, 0, 1);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa1, 1, 0, 1);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa2, 1, 0, 1);
- if (pdev->y_pixels_per_inch > 600) { /* 600 x 1200 dpi */
- fprintf(fp, "%c%c%c%c%c%c%c%c%c",
- ESC, 0x7c, 0xa5, 4, 0, 2, 0x58, 4, 0xb0);
- ydpi = 1200;
- }
- else if (pdev->y_pixels_per_inch > 300) { /* 600 dpi */
- fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 2, 0x58);
- ydpi = 600;
- }
- else {
- fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 1, 0x2c);
- ydpi = 300;
- }
- fprintf(fp, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- ESC, 0x7c, 0xf1, 0x0c, 0, 0, 1 , 0, 2, 0, 0, 0, 0, 0, 0, 0, 0);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
-
- return ydpi;
+ int ydpi;
+
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa0, 1, 0, 1);
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa1, 1, 0, 1);
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa2, 1, 0, 1);
+ if (pdev->y_pixels_per_inch > 600) { /* 600 x 1200 dpi */
+ fprintf(fp, "%c%c%c%c%c%c%c%c%c",
+ ESC, 0x7c, 0xa5, 4, 0, 2, 0x58, 4, 0xb0);
+ ydpi = 1200;
+ }
+ else if (pdev->y_pixels_per_inch > 300) { /* 600 dpi */
+ fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 2, 0x58);
+ ydpi = 600;
+ }
+ else {
+ fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 1, 0x2c);
+ ydpi = 300;
+ }
+ fprintf(fp, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ ESC, 0x7c, 0xf1, 0x0c, 0, 0, 1 , 0, 2, 0, 0, 0, 0, 0, 0, 0, 0);
+ fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
+
+ return ydpi;
}
-
static int
ml_finish(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ FILE *fp)
{
- fprintf(fp, "%c%c%c", ESC, 0x2f, 0xfe);
+ fprintf(fp, "%c%c%c", ESC, 0x2f, 0xfe);
- return 0;
+ return 0;
}
diff --git a/gs/contrib/japanese/gdevnpdl.c b/gs/contrib/japanese/gdevnpdl.c
index 769f6535c..f98070d92 100644
--- a/gs/contrib/japanese/gdevnpdl.c
+++ b/gs/contrib/japanese/gdevnpdl.c
@@ -25,7 +25,7 @@
* language printers such as NEC MultiWriter series.
*
* Any test reports, comments, suggestions, and bug reports are welcome.
- *
+ *
* -- Osamu Watanabe <owatanab@ceres.dti.ne.jp>
*
* $Id: gdevnpdl.c,v 1.10 1998/09/28 16:20:04 watanabe Exp $
@@ -120,15 +120,13 @@ static dev_proc_image_out(npdl_image_out);
static gx_device_procs npdl_prn_procs =
prn_params_procs(npdl_open, gdev_prn_output_page, npdl_close,
- lprn_get_params, npdl_put_params);
+ lprn_get_params, npdl_put_params);
gx_device_lprn far_data gs_npdl_device =
lprn_duplex_device(gx_device_lprn, npdl_prn_procs, "npdl",
- X_DPI, Y_DPI, /* default resolution */
- 0.0, 0.0, 0.0, 0.0, /* margins */
- 1, npdl_print_page_copies, npdl_image_out);
-
-
+ X_DPI, Y_DPI, /* default resolution */
+ 0.0, 0.0, 0.0, 0.0, /* margins */
+ 1, npdl_print_page_copies, npdl_image_out);
/* ------ internal routines ------ */
@@ -235,26 +233,26 @@ mh_write_to_buffer(byte * out, int chunk_size, int num_bits, char *code)
for (code_length = 0; code[code_length] != '\0'; code_length++);
if (((num_bits + code_length) / 8) >= chunk_size)
- return 0;
+ return 0;
p = num_bits / 8;
q = num_bits % 8;
for (i = 0; i < code_length; i++) {
- /*
- * MH compressed data are stored from 2^0 to 2^7,
- * whereas uncompressed data are stored from 2^7 to 2^0.
- */
- if (code[i] == '0')
- out[p] &= ~(mask[7 - q]);
- else
- out[p] |= mask[7 - q];
-
- if (q < 7)
- q++;
- else {
- p++;
- q = 0;
- }
+ /*
+ * MH compressed data are stored from 2^0 to 2^7,
+ * whereas uncompressed data are stored from 2^7 to 2^0.
+ */
+ if (code[i] == '0')
+ out[p] &= ~(mask[7 - q]);
+ else
+ out[p] |= mask[7 - q];
+
+ if (q < 7)
+ q++;
+ else {
+ p++;
+ q = 0;
+ }
}
return code_length;
@@ -270,15 +268,15 @@ mh_set_runlength(byte * out, int chunk_size, int num_bits, int phase, int count)
/* Set makeup code */
if (count / 64 > 0) {
- if ((n = mh_write_to_buffer(out, chunk_size, num_bits,
- makeup[phase][(count / 64) - 1])) == 0)
- return 0;
- code_length += n;
+ if ((n = mh_write_to_buffer(out, chunk_size, num_bits,
+ makeup[phase][(count / 64) - 1])) == 0)
+ return 0;
+ code_length += n;
}
/* Set terminating code */
if ((n = mh_write_to_buffer(out, chunk_size, num_bits + code_length,
- terminating[phase][count % 64])) == 0)
- return 0;
+ terminating[phase][count % 64])) == 0)
+ return 0;
code_length += n;
return code_length;
@@ -302,19 +300,19 @@ mh_set_rtc(byte * out, int chunk_size, int num_bits)
/* Set FILL bits */
num_fills = (EOL_SIZE * 6 + (num_bits % 8)) % 8;
if (num_fills != 0) {
- for (i = 0; i < 8 - num_fills; i++) {
- if ((n = mh_write_to_buffer(out, chunk_size, num_bits + code_length,
- fill)) == 0)
- return 0;
- code_length += n;
- }
+ for (i = 0; i < 8 - num_fills; i++) {
+ if ((n = mh_write_to_buffer(out, chunk_size, num_bits + code_length,
+ fill)) == 0)
+ return 0;
+ code_length += n;
+ }
}
/* Set RTC (that is, six EOL) code */
for (i = 0; i < 6; i++) {
- if ((n = mh_write_to_buffer(out, chunk_size, num_bits + code_length,
- eol)) == 0)
- return 0;
- code_length += n;
+ if ((n = mh_write_to_buffer(out, chunk_size, num_bits + code_length,
+ eol)) == 0)
+ return 0;
+ code_length += n;
}
return code_length;
@@ -331,79 +329,79 @@ mh_compression(byte * in, byte * out, int line_size, int column_size)
num_bits = 0;
for (i = 0; i < column_size; i++) {
- r = i * line_size;
-
- /* Synchronization of 1-dot line */
- if ((n = mh_set_eol(out, chunk_size, num_bits)) == 0)
- return 0;
- num_bits += n;
-
- /* Data compression of 1-dot line */
- phase = count = 0;
- for (p = 0; p < line_size; p++) {
- if (phase == 0)
- src = ~(in[r + p]);
- else
- src = in[r + p];
- for (q = 0; q < 8; q++) {
-
- /*
- * If the dot has reversed, write the
- * run-length of the continuous dots.
- */
- if (!(src & mask[q])) {
- if ((n = mh_set_runlength(out, chunk_size, num_bits,
- phase, count)) == 0)
- return 0;
- num_bits += n;
- phase = (phase == 0) ? 1 : 0;
- count = 1;
- src = ~src;
- }
- /*
- * If the dot is not reversed, check the
- * length of this continuous dots,
- */
- else {
- if (count < MAX_RUNLENGTH)
- count++;
- /*
- * and if the length >= MAX_RUNLENGTH,
- * stop and restart counting.
- */
- else {
- if ((n = mh_set_runlength(out, chunk_size, num_bits,
- phase, MAX_RUNLENGTH)) == 0)
- return 0;
- num_bits += n;
- phase = (phase == 0) ? 1 : 0;
- if ((n = mh_set_runlength(out, chunk_size, num_bits,
- phase, 0)) == 0)
- return 0;
- num_bits += n;
- phase = (phase == 0) ? 1 : 0;
- count = 1;
- }
- }
- }
- }
-
- /* Write the last run-length of 1-dot line */
- if ((n = mh_set_runlength(out, chunk_size, num_bits, phase,
- count)) == 0)
- return 0;
- num_bits += n;
+ r = i * line_size;
+
+ /* Synchronization of 1-dot line */
+ if ((n = mh_set_eol(out, chunk_size, num_bits)) == 0)
+ return 0;
+ num_bits += n;
+
+ /* Data compression of 1-dot line */
+ phase = count = 0;
+ for (p = 0; p < line_size; p++) {
+ if (phase == 0)
+ src = ~(in[r + p]);
+ else
+ src = in[r + p];
+ for (q = 0; q < 8; q++) {
+
+ /*
+ * If the dot has reversed, write the
+ * run-length of the continuous dots.
+ */
+ if (!(src & mask[q])) {
+ if ((n = mh_set_runlength(out, chunk_size, num_bits,
+ phase, count)) == 0)
+ return 0;
+ num_bits += n;
+ phase = (phase == 0) ? 1 : 0;
+ count = 1;
+ src = ~src;
+ }
+ /*
+ * If the dot is not reversed, check the
+ * length of this continuous dots,
+ */
+ else {
+ if (count < MAX_RUNLENGTH)
+ count++;
+ /*
+ * and if the length >= MAX_RUNLENGTH,
+ * stop and restart counting.
+ */
+ else {
+ if ((n = mh_set_runlength(out, chunk_size, num_bits,
+ phase, MAX_RUNLENGTH)) == 0)
+ return 0;
+ num_bits += n;
+ phase = (phase == 0) ? 1 : 0;
+ if ((n = mh_set_runlength(out, chunk_size, num_bits,
+ phase, 0)) == 0)
+ return 0;
+ num_bits += n;
+ phase = (phase == 0) ? 1 : 0;
+ count = 1;
+ }
+ }
+ }
+ }
+
+ /* Write the last run-length of 1-dot line */
+ if ((n = mh_set_runlength(out, chunk_size, num_bits, phase,
+ count)) == 0)
+ return 0;
+ num_bits += n;
}
/* RTC (return to control) */
if ((n = mh_set_rtc(out, chunk_size, num_bits)) == 0)
- return 0;
+ return 0;
num_bits += n;
return (num_bits / 8);
}
-/* Get the paper size code based on the width and the height.
+/* Get the paper size code based on the width and the height.
modified from gdevpcl.c and gdevmjc.c */
static int
npdl_get_paper_size(gx_device * dev)
@@ -411,14 +409,14 @@ npdl_get_paper_size(gx_device * dev)
float media_height = (dev->MediaSize[0] > dev->MediaSize[1]) ? dev->MediaSize[0] : dev->MediaSize[1];
return (media_height > 1032 ? PAPER_SIZE_A3 :
- media_height > 842 ? PAPER_SIZE_B4 :
- media_height > 792 ? PAPER_SIZE_A4 :
- media_height > 756 ? PAPER_SIZE_LETTER :
- media_height > 729 ? PAPER_SIZE_ENV4 :
- media_height > 595 ? PAPER_SIZE_BPOSTCARD :
- media_height > 568 ? PAPER_SIZE_B5 :
- media_height > 419 ? PAPER_SIZE_A5 :
- PAPER_SIZE_POSTCARD);
+ media_height > 842 ? PAPER_SIZE_B4 :
+ media_height > 792 ? PAPER_SIZE_A4 :
+ media_height > 756 ? PAPER_SIZE_LETTER :
+ media_height > 729 ? PAPER_SIZE_ENV4 :
+ media_height > 595 ? PAPER_SIZE_BPOSTCARD :
+ media_height > 568 ? PAPER_SIZE_B5 :
+ media_height > 419 ? PAPER_SIZE_A5 :
+ PAPER_SIZE_POSTCARD);
}
static int
@@ -429,98 +427,98 @@ npdl_set_page_layout(gx_device * dev)
/* Change the margins according to the paper size. */
switch (npdl_get_paper_size(dev)) {
- case PAPER_SIZE_A3:
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[0] = L_MARGIN_A3;
- margins[1] = B_MARGIN_A3;
- margins[2] = R_MARGIN_A3;
- margins[3] = T_MARGIN_A3;
- } else { /* Portrait */
- margins[1] = L_MARGIN_A3;
- margins[2] = B_MARGIN_A3;
- margins[3] = R_MARGIN_A3;
- margins[0] = T_MARGIN_A3;
- }
- break;
- case PAPER_SIZE_A5:
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[0] = L_MARGIN_A5;
- margins[1] = B_MARGIN_A5;
- margins[2] = R_MARGIN_A5;
- margins[3] = T_MARGIN_A5;
- } else { /* Portrait */
- margins[1] = L_MARGIN_A5;
- margins[2] = B_MARGIN_A5;
- margins[3] = R_MARGIN_A5;
- margins[0] = T_MARGIN_A5;
- }
- break;
- case PAPER_SIZE_B5:
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[1] = L_MARGIN_B5;
- margins[2] = B_MARGIN_B5;
- margins[3] = R_MARGIN_B5;
- margins[0] = T_MARGIN_B5;
- } else { /* Portrait */
- margins[0] = L_MARGIN_B5;
- margins[1] = B_MARGIN_B5;
- margins[2] = R_MARGIN_B5;
- margins[3] = T_MARGIN_B5;
- }
- break;
- case PAPER_SIZE_LETTER:
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[1] = L_MARGIN_LETTER;
- margins[2] = B_MARGIN_LETTER;
- margins[3] = R_MARGIN_LETTER;
- margins[0] = T_MARGIN_LETTER;
- } else { /* Portrait */
- margins[0] = L_MARGIN_LETTER;
- margins[1] = B_MARGIN_LETTER;
- margins[2] = R_MARGIN_LETTER;
- margins[3] = T_MARGIN_LETTER;
- }
- break;
- case PAPER_SIZE_POSTCARD:
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[1] = L_MARGIN_POSTCARD;
- margins[2] = B_MARGIN_POSTCARD;
- margins[3] = R_MARGIN_POSTCARD;
- margins[0] = T_MARGIN_POSTCARD;
- } else { /* Portrait */
- margins[0] = L_MARGIN_POSTCARD;
- margins[1] = B_MARGIN_POSTCARD;
- margins[2] = R_MARGIN_POSTCARD;
- margins[3] = T_MARGIN_POSTCARD;
- }
- break;
- case PAPER_SIZE_ENV4:
- case PAPER_SIZE_BPOSTCARD:
- margins[1] = L_MARGIN_ENV4;
- margins[2] = B_MARGIN_ENV4;
- margins[3] = R_MARGIN_ENV4;
- margins[0] = T_MARGIN_ENV4;
- break;
- default: /* A4 */
- if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
- margins[1] = L_MARGIN_A4;
- margins[2] = B_MARGIN_A4;
- margins[3] = R_MARGIN_A4;
- margins[0] = T_MARGIN_A4;
- } else { /* Portrait */
- margins[0] = L_MARGIN_A4;
- margins[1] = B_MARGIN_A4;
- margins[2] = R_MARGIN_A4;
- margins[3] = T_MARGIN_A4;
- }
- break;
+ case PAPER_SIZE_A3:
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[0] = L_MARGIN_A3;
+ margins[1] = B_MARGIN_A3;
+ margins[2] = R_MARGIN_A3;
+ margins[3] = T_MARGIN_A3;
+ } else { /* Portrait */
+ margins[1] = L_MARGIN_A3;
+ margins[2] = B_MARGIN_A3;
+ margins[3] = R_MARGIN_A3;
+ margins[0] = T_MARGIN_A3;
+ }
+ break;
+ case PAPER_SIZE_A5:
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[0] = L_MARGIN_A5;
+ margins[1] = B_MARGIN_A5;
+ margins[2] = R_MARGIN_A5;
+ margins[3] = T_MARGIN_A5;
+ } else { /* Portrait */
+ margins[1] = L_MARGIN_A5;
+ margins[2] = B_MARGIN_A5;
+ margins[3] = R_MARGIN_A5;
+ margins[0] = T_MARGIN_A5;
+ }
+ break;
+ case PAPER_SIZE_B5:
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[1] = L_MARGIN_B5;
+ margins[2] = B_MARGIN_B5;
+ margins[3] = R_MARGIN_B5;
+ margins[0] = T_MARGIN_B5;
+ } else { /* Portrait */
+ margins[0] = L_MARGIN_B5;
+ margins[1] = B_MARGIN_B5;
+ margins[2] = R_MARGIN_B5;
+ margins[3] = T_MARGIN_B5;
+ }
+ break;
+ case PAPER_SIZE_LETTER:
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[1] = L_MARGIN_LETTER;
+ margins[2] = B_MARGIN_LETTER;
+ margins[3] = R_MARGIN_LETTER;
+ margins[0] = T_MARGIN_LETTER;
+ } else { /* Portrait */
+ margins[0] = L_MARGIN_LETTER;
+ margins[1] = B_MARGIN_LETTER;
+ margins[2] = R_MARGIN_LETTER;
+ margins[3] = T_MARGIN_LETTER;
+ }
+ break;
+ case PAPER_SIZE_POSTCARD:
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[1] = L_MARGIN_POSTCARD;
+ margins[2] = B_MARGIN_POSTCARD;
+ margins[3] = R_MARGIN_POSTCARD;
+ margins[0] = T_MARGIN_POSTCARD;
+ } else { /* Portrait */
+ margins[0] = L_MARGIN_POSTCARD;
+ margins[1] = B_MARGIN_POSTCARD;
+ margins[2] = R_MARGIN_POSTCARD;
+ margins[3] = T_MARGIN_POSTCARD;
+ }
+ break;
+ case PAPER_SIZE_ENV4:
+ case PAPER_SIZE_BPOSTCARD:
+ margins[1] = L_MARGIN_ENV4;
+ margins[2] = B_MARGIN_ENV4;
+ margins[3] = R_MARGIN_ENV4;
+ margins[0] = T_MARGIN_ENV4;
+ break;
+ default: /* A4 */
+ if (dev->MediaSize[0] > dev->MediaSize[1]) { /* Landscape */
+ margins[1] = L_MARGIN_A4;
+ margins[2] = B_MARGIN_A4;
+ margins[3] = R_MARGIN_A4;
+ margins[0] = T_MARGIN_A4;
+ } else { /* Portrait */
+ margins[0] = L_MARGIN_A4;
+ margins[1] = B_MARGIN_A4;
+ margins[2] = R_MARGIN_A4;
+ margins[3] = T_MARGIN_A4;
+ }
+ break;
}
gx_device_set_margins(dev, margins, true);
if (dev->is_open) {
- gdev_prn_close(dev);
- code = gdev_prn_open(dev);
- if (code < 0)
- return code;
+ gdev_prn_close(dev);
+ code = gdev_prn_open(dev);
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -534,10 +532,10 @@ npdl_open(gx_device * dev)
/* Print Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else if (xdpi != 160 && xdpi != 200 && xdpi != 240 &&
- xdpi != 400 && xdpi != 600)
- return_error(gs_error_rangecheck);
+ xdpi != 400 && xdpi != 600)
+ return_error(gs_error_rangecheck);
npdl_set_page_layout(dev);
@@ -554,7 +552,6 @@ npdl_close(gx_device *pdev)
return gdev_prn_close(pdev);
}
-
static int
npdl_put_params(gx_device * pdev, gs_param_list * plist)
{
@@ -563,9 +560,9 @@ npdl_put_params(gx_device * pdev, gs_param_list * plist)
code = lprn_put_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
if (pdev->is_open && !lprn->initialized) {
- npdl_set_page_layout(pdev);
+ npdl_set_page_layout(pdev);
}
return 0;
}
@@ -583,71 +580,69 @@ npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copi
int maxY = lprn->BlockLine / lprn->nBh * lprn->nBh;
if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), line_size * maxY, sizeof(byte), "npdl_print_page_copies(CompBuf)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
-
- /* Initialize printer */
+ /* Initialize printer */
if (pdev->PageCount == 0) {
-
+
/* Initialize printer */
fputs("\033c1", prn_stream); /* Software Reset */
fputs("\034d240.", prn_stream); /* Page Printer Mode */
-
- /* Check paper size */
- switch (npdl_get_paper_size((gx_device *) pdev)) {
- case PAPER_SIZE_POSTCARD:
- sprintf(paper_command, "PC");
- break;
- case PAPER_SIZE_A5:
- sprintf(paper_command, "A5");
- break;
- case PAPER_SIZE_A4:
- sprintf(paper_command, "A4");
- break;
- case PAPER_SIZE_A3:
- sprintf(paper_command, "A3");
- break;
- case PAPER_SIZE_B5:
- sprintf(paper_command, "B5");
- break;
- case PAPER_SIZE_B4:
- sprintf(paper_command, "B4");
- break;
- case PAPER_SIZE_LETTER:
- sprintf(paper_command, "LT");
- break;
- case PAPER_SIZE_ENV4:
- sprintf(paper_command, "ENV4");
- break;
- case PAPER_SIZE_BPOSTCARD:
- sprintf(paper_command, "UPPC");
- break;
- }
-
- if (lprn->ManualFeed) {
- fprintf(prn_stream, "\034f%cM0.",
- (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P');
- /* Page Orientation P: Portrait, L: Landscape */
- } else {
- fprintf(prn_stream, "\034f%c%s.",
- (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P',
- /* Page Orientation P: Portrait, L: Landscape */
- paper_command); /* Paper Size */
- }
-
- fprintf(prn_stream, "\034<1/%d,i.", x_dpi); /* Image Resolution */
-
- /* Duplex Setting */
- if (pdev->Duplex_set > 0) {
- if (pdev->Duplex) {
- if (lprn->Tumble == 0)
- fprintf(prn_stream, "\034'B,,1,0.");
- else
- fprintf(prn_stream, "\034'B,,2,0.");
- } else
- fprintf(prn_stream, "\034'S,,,0.");
- }
+ /* Check paper size */
+ switch (npdl_get_paper_size((gx_device *) pdev)) {
+ case PAPER_SIZE_POSTCARD:
+ sprintf(paper_command, "PC");
+ break;
+ case PAPER_SIZE_A5:
+ sprintf(paper_command, "A5");
+ break;
+ case PAPER_SIZE_A4:
+ sprintf(paper_command, "A4");
+ break;
+ case PAPER_SIZE_A3:
+ sprintf(paper_command, "A3");
+ break;
+ case PAPER_SIZE_B5:
+ sprintf(paper_command, "B5");
+ break;
+ case PAPER_SIZE_B4:
+ sprintf(paper_command, "B4");
+ break;
+ case PAPER_SIZE_LETTER:
+ sprintf(paper_command, "LT");
+ break;
+ case PAPER_SIZE_ENV4:
+ sprintf(paper_command, "ENV4");
+ break;
+ case PAPER_SIZE_BPOSTCARD:
+ sprintf(paper_command, "UPPC");
+ break;
+ }
+
+ if (lprn->ManualFeed) {
+ fprintf(prn_stream, "\034f%cM0.",
+ (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P');
+ /* Page Orientation P: Portrait, L: Landscape */
+ } else {
+ fprintf(prn_stream, "\034f%c%s.",
+ (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P',
+ /* Page Orientation P: Portrait, L: Landscape */
+ paper_command); /* Paper Size */
+ }
+
+ fprintf(prn_stream, "\034<1/%d,i.", x_dpi); /* Image Resolution */
+
+ /* Duplex Setting */
+ if (pdev->Duplex_set > 0) {
+ if (pdev->Duplex) {
+ if (lprn->Tumble == 0)
+ fprintf(prn_stream, "\034'B,,1,0.");
+ else
+ fprintf(prn_stream, "\034'B,,2,0.");
+ } else
+ fprintf(prn_stream, "\034'S,,,0.");
+ }
}
if (num_copies > 99)
@@ -657,25 +652,24 @@ npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copi
lprn->initialized = false;
if (lprn->NegativePrint) {
- fprintf(prn_stream, "\034e0,0."); /* move to (0, 0) */
- fprintf(prn_stream, "\034Y"); /* goto figure mode */
- fprintf(prn_stream, "SU1,%d,0;", (int)pdev->x_pixels_per_inch);
- /* Setting Printer Unit */
- fprintf(prn_stream, "SG0,0;"); /* select black color */
- fprintf(prn_stream, "NP;"); /* begin path */
- fprintf(prn_stream, "PA%d,0,%d,%d,0,%d;",
- pdev->width, pdev->width, pdev->height, pdev->height);
- /* draw rectangle */
- fprintf(prn_stream, "CP"); /* close path */
- fprintf(prn_stream, "EP;"); /* end path */
- fprintf(prn_stream, "FL0;"); /* fill path */
- fprintf(prn_stream, "\034Z"); /* end of figure mode */
- fprintf(prn_stream, "\034\"R."); /* `R'eplace Mode */
+ fprintf(prn_stream, "\034e0,0."); /* move to (0, 0) */
+ fprintf(prn_stream, "\034Y"); /* goto figure mode */
+ fprintf(prn_stream, "SU1,%d,0;", (int)pdev->x_pixels_per_inch);
+ /* Setting Printer Unit */
+ fprintf(prn_stream, "SG0,0;"); /* select black color */
+ fprintf(prn_stream, "NP;"); /* begin path */
+ fprintf(prn_stream, "PA%d,0,%d,%d,0,%d;",
+ pdev->width, pdev->width, pdev->height, pdev->height);
+ /* draw rectangle */
+ fprintf(prn_stream, "CP"); /* close path */
+ fprintf(prn_stream, "EP;"); /* end path */
+ fprintf(prn_stream, "FL0;"); /* fill path */
+ fprintf(prn_stream, "\034Z"); /* end of figure mode */
+ fprintf(prn_stream, "\034\"R."); /* `R'eplace Mode */
}
code = lprn_print_image(pdev, prn_stream);
if (code < 0)
- return code;
-
+ return code;
/* Form Feed */
fputs("\014", prn_stream);
@@ -700,16 +694,16 @@ npdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
* If the compression ratio >= 100%, send uncompressed data
*/
if (num_bytes == 0) {
- fprintf(prn_stream, "\034i%d,%d,0,1/1,1/1,%d,%d.", width,
- height, width * height / 8, x_dpi);
- fwrite(lprn->TmpBuf, 1, width * height / 8, prn_stream);
+ fprintf(prn_stream, "\034i%d,%d,0,1/1,1/1,%d,%d.", width,
+ height, width * height / 8, x_dpi);
+ fwrite(lprn->TmpBuf, 1, width * height / 8, prn_stream);
}
/*
* If the compression ratio < 100%, send compressed data
*/
else {
- fprintf(prn_stream, "\034i%d,%d,1,1/1,1/1,%d,%d.", width,
- height, num_bytes, x_dpi);
- fwrite(lprn->CompBuf, 1, num_bytes, prn_stream);
+ fprintf(prn_stream, "\034i%d,%d,1,1/1,1/1,%d,%d.", width,
+ height, num_bytes, x_dpi);
+ fwrite(lprn->CompBuf, 1, num_bytes, prn_stream);
}
}
diff --git a/gs/contrib/japanese/gdevp201.c b/gs/contrib/japanese/gdevp201.c
index a042fd1a1..3805fdd1c 100644
--- a/gs/contrib/japanese/gdevp201.c
+++ b/gs/contrib/japanese/gdevp201.c
@@ -25,11 +25,11 @@ copies. */
#include "gdevprn.h"
/* There are NEC PC-PR printer paramaters.
- MODEL DEVICE_NAME X_DPI,Y_DPI HEAD_PINS LF_PITCH
- PC-PR201 "nec160" 160 24 18
- PC-PR1000 "nec240" 240 40 20
- PC-PR150 "nec320" 320 48 18
- PC-PR1000/4 "nec400" 400 60 18
+ MODEL DEVICE_NAME X_DPI,Y_DPI HEAD_PINS LF_PITCH
+ PC-PR201 "nec160" 160 24 18
+ PC-PR1000 "nec240" 240 40 20
+ PC-PR150 "nec320" 320 48 18
+ PC-PR1000/4 "nec400" 400 60 18
*/
#define WIDTH 80 /* width_10ths, 8" */
@@ -42,232 +42,231 @@ static dev_proc_print_page(pr201_print_page);
/* The device descriptor */
gx_device_printer gs_pr201_device =
prn_device(prn_std_procs, "pr201",
- WIDTH,
- HEIGHT,
- 160,
- 160,
- 0,0,0,0, /* margins */
- 1, pr201_print_page);
+ WIDTH,
+ HEIGHT,
+ 160,
+ 160,
+ 0,0,0,0, /* margins */
+ 1, pr201_print_page);
gx_device_printer gs_pr1000_device =
prn_device(prn_std_procs, "pr1000",
- WIDTH,
- HEIGHT,
- 240,
- 240,
- 0,0,0,0, /* margins */
- 1, pr201_print_page);
+ WIDTH,
+ HEIGHT,
+ 240,
+ 240,
+ 0,0,0,0, /* margins */
+ 1, pr201_print_page);
gx_device_printer gs_pr150_device =
prn_device(prn_std_procs, "pr150",
- WIDTH,
- HEIGHT,
- 320,
- 320,
- 0,0,0,0, /* margins */
- 1, pr201_print_page);
+ WIDTH,
+ HEIGHT,
+ 320,
+ 320,
+ 0,0,0,0, /* margins */
+ 1, pr201_print_page);
gx_device_printer gs_pr1000_4_device =
prn_device(prn_std_procs, "pr1000_4",
- WIDTH,
- HEIGHT,
- 400,
- 400,
- 0,0,0,0, /* margins */
- 1, pr201_print_page);
-
+ WIDTH,
+ HEIGHT,
+ 400,
+ 400,
+ 0,0,0,0, /* margins */
+ 1, pr201_print_page);
/* Transpose a block of 8x8 bits */
static int
pr201_transpose_8x8(byte *src, int src_step, byte *dst, int dst_step)
{
- byte mask, s, d0, d1, d2, d3, d4, d5, d6, d7;
- int i;
-
- d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;
-
- for(i=0, mask=0x01; i<8; i++, mask <<= 1) {
- s = *src;
- if(s & 0x80) d0 |= mask;
- if(s & 0x40) d1 |= mask;
- if(s & 0x20) d2 |= mask;
- if(s & 0x10) d3 |= mask;
- if(s & 0x08) d4 |= mask;
- if(s & 0x04) d5 |= mask;
- if(s & 0x02) d6 |= mask;
- if(s & 0x01) d7 |= mask;
- src += src_step;
- }
-
- *dst = d0;
- *(dst += dst_step) = d1;
- *(dst += dst_step) = d2;
- *(dst += dst_step) = d3;
- *(dst += dst_step) = d4;
- *(dst += dst_step) = d5;
- *(dst += dst_step) = d6;
- *(dst += dst_step) = d7;
-
- return 0;
+ byte mask, s, d0, d1, d2, d3, d4, d5, d6, d7;
+ int i;
+
+ d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;
+
+ for(i=0, mask=0x01; i<8; i++, mask <<= 1) {
+ s = *src;
+ if(s & 0x80) d0 |= mask;
+ if(s & 0x40) d1 |= mask;
+ if(s & 0x20) d2 |= mask;
+ if(s & 0x10) d3 |= mask;
+ if(s & 0x08) d4 |= mask;
+ if(s & 0x04) d5 |= mask;
+ if(s & 0x02) d6 |= mask;
+ if(s & 0x01) d7 |= mask;
+ src += src_step;
+ }
+
+ *dst = d0;
+ *(dst += dst_step) = d1;
+ *(dst += dst_step) = d2;
+ *(dst += dst_step) = d3;
+ *(dst += dst_step) = d4;
+ *(dst += dst_step) = d5;
+ *(dst += dst_step) = d6;
+ *(dst += dst_step) = d7;
+
+ return 0;
}
static int
check_mode(const char* modename)
{
- if (!strcmp(modename, "pr201"))
- return PR201;
- else if (!strcmp(modename, "pr1000"))
- return PR1000;
- else if (!strcmp(modename, "pr150"))
- return PR150;
- else
- return PR1K4;
+ if (!strcmp(modename, "pr201"))
+ return PR201;
+ else if (!strcmp(modename, "pr1000"))
+ return PR1000;
+ else if (!strcmp(modename, "pr150"))
+ return PR150;
+ else
+ return PR1K4;
}
/* Send the page to the printer. */
static int
pr201_print_page(gx_device_printer *pdev, FILE *prn_stream)
{ int line_size;
- int height;
- int bits_per_column;
- int bytes_per_column;
- int chunk_size;
- byte *in, *out;
- int lnum, skip;
- int head_pins, lr_pitch, x_dpi;
-
- switch (check_mode(pdev->dname)){
- case PR201:
- head_pins=24; lr_pitch=18; x_dpi=160; break;
- case PR1000:
- head_pins=40; lr_pitch=20; x_dpi=240; break;
- case PR150:
- head_pins=48; lr_pitch=18; x_dpi=320; break;
- case PR1K4:
- head_pins=60; lr_pitch=18; x_dpi=400; break;
- }
-
- line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
- height = pdev->height;
- bits_per_column = head_pins;
- bytes_per_column = bits_per_column / 8;
- chunk_size = bits_per_column * line_size;
-
- in = (byte *)
- gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "pr201_print_page(in)");
- out = (byte *)
- gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "pr201_print_page(out)");
- if(in == 0 || out == 0)
- return -1;
-
- /* Initialize printer */
- fputs("\033cl", pdev->file); /* Software Reset */
- fputs("\033P", pdev->file); /* Proportional Mode */
- if (check_mode(pdev->dname)==PR150){
- fprintf(pdev->file, "\034d%d.", x_dpi); /* 320 dpi mode. */
- }
- fprintf(pdev->file, "\033T%d" , lr_pitch);
- /* 18/120 inch per line */
-
- /* Send Data to printer */
- lnum = 0;
- skip = 0;
- while(lnum < height) {
- byte *inp, *outp, *out_beg, *out_end;
- int x, y, num_lines, size, mod;
-
- /* Copy scan lines */
- if(gdev_prn_copy_scan_lines(pdev, lnum, in, chunk_size) < 0)
- break;
-
- /* The number of lines to process */
- if((num_lines = height - lnum) > bits_per_column)
- num_lines = bits_per_column;
-
- /* Test for all zero */
- size = line_size * num_lines;
- if(in[0] == 0 &&
- !memcmp((char *)in, (char *)in + 1, size - 1)) {
- lnum += bits_per_column;
- skip ++;
- continue;
- }
-
- /* Fill zero */
- if(num_lines < bits_per_column) {
- size = line_size * (bits_per_column - num_lines);
- memset(in + line_size * num_lines, 0, size);
- }
- lnum += bits_per_column;
-
- /* Vertical tab to the appropriate position. */
- while(skip > 72) {
- fprintf(pdev->file, "\037%c", 16 + 72);
- skip -= 72;
- }
- if(skip > 0) {
- fprintf(pdev->file, "\037%c", 16 + skip);
- }
-
- /* Transpose in blocks of 8 scan lines. */
- for(y = 0; y < bytes_per_column; y ++) {
- inp = in + line_size * 8 * y;
- outp = out + y;
- for(x = 0; x < line_size; x ++) {
- pr201_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- inp ++;
- outp += bits_per_column;
- }
- }
-
- /* Remove trailing 0s. */
- out_end = out + chunk_size - 1;
- while(out_end >= out) {
- if(*out_end)
- break;
- out_end --;
- }
- size = (out_end - out) + 1;
- if((mod = size % bytes_per_column) != 0)
- out_end += bytes_per_column - mod;
-
- /* Remove leading 0s. */
- out_beg = out;
- while(out_beg <= out_end) {
- if(*out_beg)
- break;
- out_beg ++;
- }
- out_beg -= (out_beg - out) % bytes_per_column;
-
- /* Dot addressing */
- fprintf(pdev->file, "\033F%04d",
- (out_beg - out) / bytes_per_column);
-
- /* Dot graphics */
- size = out_end - out_beg + 1;
- if (check_mode(pdev->dname)==PR201){
- fprintf(pdev->file,"\033J%04d", size / bytes_per_column);
- }else{
- fprintf(pdev->file,"\034bP,48,%04d.",
- size / bytes_per_column);
- }
- fwrite(out_beg, size, 1, pdev->file);
-
- /* Carriage Return */
- fputc('\r', pdev->file);
- skip = 1;
- }
-
- /* Form Feed */
- fputc('\f',pdev->file);
- fflush(pdev->file);
-
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
- bits_per_column, line_size, "pr201_print_page(out)");
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in,
- bits_per_column, line_size, "pr201_print_page(in)");
-
- return 0;
+ int height;
+ int bits_per_column;
+ int bytes_per_column;
+ int chunk_size;
+ byte *in, *out;
+ int lnum, skip;
+ int head_pins, lr_pitch, x_dpi;
+
+ switch (check_mode(pdev->dname)){
+ case PR201:
+ head_pins=24; lr_pitch=18; x_dpi=160; break;
+ case PR1000:
+ head_pins=40; lr_pitch=20; x_dpi=240; break;
+ case PR150:
+ head_pins=48; lr_pitch=18; x_dpi=320; break;
+ case PR1K4:
+ head_pins=60; lr_pitch=18; x_dpi=400; break;
+ }
+
+ line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ height = pdev->height;
+ bits_per_column = head_pins;
+ bytes_per_column = bits_per_column / 8;
+ chunk_size = bits_per_column * line_size;
+
+ in = (byte *)
+ gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "pr201_print_page(in)");
+ out = (byte *)
+ gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bits_per_column, line_size, "pr201_print_page(out)");
+ if(in == 0 || out == 0)
+ return -1;
+
+ /* Initialize printer */
+ fputs("\033cl", pdev->file); /* Software Reset */
+ fputs("\033P", pdev->file); /* Proportional Mode */
+ if (check_mode(pdev->dname)==PR150){
+ fprintf(pdev->file, "\034d%d.", x_dpi); /* 320 dpi mode. */
+ }
+ fprintf(pdev->file, "\033T%d" , lr_pitch);
+ /* 18/120 inch per line */
+
+ /* Send Data to printer */
+ lnum = 0;
+ skip = 0;
+ while(lnum < height) {
+ byte *inp, *outp, *out_beg, *out_end;
+ int x, y, num_lines, size, mod;
+
+ /* Copy scan lines */
+ if(gdev_prn_copy_scan_lines(pdev, lnum, in, chunk_size) < 0)
+ break;
+
+ /* The number of lines to process */
+ if((num_lines = height - lnum) > bits_per_column)
+ num_lines = bits_per_column;
+
+ /* Test for all zero */
+ size = line_size * num_lines;
+ if(in[0] == 0 &&
+ !memcmp((char *)in, (char *)in + 1, size - 1)) {
+ lnum += bits_per_column;
+ skip ++;
+ continue;
+ }
+
+ /* Fill zero */
+ if(num_lines < bits_per_column) {
+ size = line_size * (bits_per_column - num_lines);
+ memset(in + line_size * num_lines, 0, size);
+ }
+ lnum += bits_per_column;
+
+ /* Vertical tab to the appropriate position. */
+ while(skip > 72) {
+ fprintf(pdev->file, "\037%c", 16 + 72);
+ skip -= 72;
+ }
+ if(skip > 0) {
+ fprintf(pdev->file, "\037%c", 16 + skip);
+ }
+
+ /* Transpose in blocks of 8 scan lines. */
+ for(y = 0; y < bytes_per_column; y ++) {
+ inp = in + line_size * 8 * y;
+ outp = out + y;
+ for(x = 0; x < line_size; x ++) {
+ pr201_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ inp ++;
+ outp += bits_per_column;
+ }
+ }
+
+ /* Remove trailing 0s. */
+ out_end = out + chunk_size - 1;
+ while(out_end >= out) {
+ if(*out_end)
+ break;
+ out_end --;
+ }
+ size = (out_end - out) + 1;
+ if((mod = size % bytes_per_column) != 0)
+ out_end += bytes_per_column - mod;
+
+ /* Remove leading 0s. */
+ out_beg = out;
+ while(out_beg <= out_end) {
+ if(*out_beg)
+ break;
+ out_beg ++;
+ }
+ out_beg -= (out_beg - out) % bytes_per_column;
+
+ /* Dot addressing */
+ fprintf(pdev->file, "\033F%04d",
+ (out_beg - out) / bytes_per_column);
+
+ /* Dot graphics */
+ size = out_end - out_beg + 1;
+ if (check_mode(pdev->dname)==PR201){
+ fprintf(pdev->file,"\033J%04d", size / bytes_per_column);
+ }else{
+ fprintf(pdev->file,"\034bP,48,%04d.",
+ size / bytes_per_column);
+ }
+ fwrite(out_beg, size, 1, pdev->file);
+
+ /* Carriage Return */
+ fputc('\r', pdev->file);
+ skip = 1;
+ }
+
+ /* Form Feed */
+ fputc('\f',pdev->file);
+ fflush(pdev->file);
+
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)out,
+ bits_per_column, line_size, "pr201_print_page(out)");
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)in,
+ bits_per_column, line_size, "pr201_print_page(in)");
+
+ return 0;
}
diff --git a/gs/contrib/japanese/gdevrpdl.c b/gs/contrib/japanese/gdevrpdl.c
index eb02c3155..4d2901727 100644
--- a/gs/contrib/japanese/gdevrpdl.c
+++ b/gs/contrib/japanese/gdevrpdl.c
@@ -38,8 +38,8 @@ lprn_procs(rpdl_open, gdev_prn_output_page, rpdl_close);
gx_device_lprn far_data gs_rpdl_device =
lprn_device(gx_device_lprn, rpdl_prn_procs, "rpdl",
- DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
- rpdl_print_page_copies, rpdl_image_out);
+ DPI, DPI, 0.0, 0.0, 0.0, 0.0, 1,
+ rpdl_print_page_copies, rpdl_image_out);
#define ppdev ((gx_device_printer *)pdev)
@@ -52,9 +52,9 @@ rpdl_open(gx_device * pdev)
/* Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
if (xdpi != 240 && xdpi != 400 && xdpi != 600)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
return gdev_prn_open(pdev);
}
@@ -64,7 +64,7 @@ rpdl_close(gx_device * pdev)
{
gdev_prn_open_printer(pdev, 1);
if (ppdev->Duplex && (pdev->PageCount & 1)) {
- fprintf(ppdev->file, "\014"); /* Form Feed */
+ fprintf(ppdev->file, "\014"); /* Form Feed */
}
return gdev_prn_close(pdev);
}
@@ -79,16 +79,16 @@ rpdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_coip
/* printer initialize */
if (pdev->PageCount == 0)
- rpdl_printer_initialize(pdev, prn_stream, num_coipes);
+ rpdl_printer_initialize(pdev, prn_stream, num_coipes);
if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "rpdl_print_page_copies(CompBuf)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
lprn->NegativePrint = false; /* Not Support */
code = lprn_print_image(pdev, prn_stream);
if (code < 0)
- return code;
+ return code;
gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "rpdl_print_page_copies(CompBuf)");
@@ -108,24 +108,24 @@ rpdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
if (Len < width / 8 * height) {
if (pdev->x_pixels_per_inch == 240) {
- /* Unit Size is 1/720 inch */
- fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
- width, height, x * 3, y * 3, Len);
+ /* Unit Size is 1/720 inch */
+ fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
+ width, height, x * 3, y * 3, Len);
} else {
- fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
- width, height, x, y, Len);
+ fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
+ width, height, x, y, Len);
}
fwrite(lprn->CompBuf, 1, Len, prn_stream);
} else { /* compression result is bad. So, raw data is used. */
if (pdev->x_pixels_per_inch == 240) {
- /* Unit Size is 1/720 inch */
- fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
- width, height, x * 3, y * 3);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ /* Unit Size is 1/720 inch */
+ fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
+ width, height, x * 3, y * 3);
+ fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
} else {
- fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
- width, height, x, y);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
+ width, height, x, y);
+ fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
}
}
}
@@ -149,21 +149,21 @@ rpdl_printer_initialize(gx_device_printer * pdev, FILE * prn_stream, int num_cop
fprintf(prn_stream, "\033\022YL,1 "); /* Top Margin - 0 mm */
fprintf(prn_stream, "\033\022YM,1 "); /* 100 % */
fprintf(prn_stream, "\033\022YQ,2 "); /* Page Length - Maximum */
-
+
/* Paper Size Selection */
rpdl_paper_set(pdev, prn_stream);
/* Option Setting */
/* Duplex Setting */
if (pdev->Duplex_set > 0) {
- if (pdev->Duplex) {
- fprintf(prn_stream, "\033\02261,");
- if (lprn->Tumble == 0)
- fprintf(prn_stream, "\033\022YA01,2 ");
- else
- fprintf(prn_stream, "\033\022YA01,1 ");
- } else
- fprintf(prn_stream, "\033\02260,");
+ if (pdev->Duplex) {
+ fprintf(prn_stream, "\033\02261,");
+ if (lprn->Tumble == 0)
+ fprintf(prn_stream, "\033\022YA01,2 ");
+ else
+ fprintf(prn_stream, "\033\022YA01,1 ");
+ } else
+ fprintf(prn_stream, "\033\02260,");
}
/* Resolution and Unit Setting */
@@ -236,15 +236,15 @@ rpdl_paper_set(gx_device_printer * pdev, FILE * prn_stream)
height = pdev->MediaSize[1];
if (width < height) {
- w = width;
- h = height;
- wp = width / 72.0 * pdev->x_pixels_per_inch;
- hp = height / 72.0 * pdev->y_pixels_per_inch;
+ w = width;
+ h = height;
+ wp = width / 72.0 * pdev->x_pixels_per_inch;
+ hp = height / 72.0 * pdev->y_pixels_per_inch;
} else {
- w = height;
- h = width;
- wp = height / 72.0 * pdev->y_pixels_per_inch;
- hp = width / 72.0 * pdev->x_pixels_per_inch;
+ w = height;
+ h = width;
+ wp = height / 72.0 * pdev->y_pixels_per_inch;
+ hp = width / 72.0 * pdev->x_pixels_per_inch;
}
if (w == 1684 && h == 2380) /* A1 */
@@ -290,7 +290,7 @@ rpdl_paper_set(gx_device_printer * pdev, FILE * prn_stream)
fprintf(prn_stream, "\033\02251@DLR\033 ");
} else { /* Free Size (mm) */
fprintf(prn_stream, "\033\022?5%d,%d\033 ",
- (int)((w * 25.4) / 72),
- (int)((h * 25.4) / 72));
+ (int)((w * 25.4) / 72),
+ (int)((h * 25.4) / 72));
}
}
diff --git a/gs/contrib/lips4/gdevl4r.c b/gs/contrib/lips4/gdevl4r.c
index 96420d7a0..f7a4c1407 100644
--- a/gs/contrib/lips4/gdevl4r.c
+++ b/gs/contrib/lips4/gdevl4r.c
@@ -51,7 +51,7 @@ static dev_proc_image_out(lips2p_image_out);
static dev_proc_image_out(lips4_image_out);
#define lips_device(dtype, procs, dname, xdpi, ydpi, lm, bm, rm, tm, color_bits,\
- print_page_copies, image_out, cassetFeed, username)\
+ print_page_copies, image_out, cassetFeed, username)\
{ std_device_std_color_full_body(dtype, &procs, dname,\
(int)((long)(DEFAULT_WIDTH_10THS) * (xdpi) / 10),\
(int)((long)(DEFAULT_HEIGHT_10THS) * (ydpi) / 10),\
@@ -61,12 +61,12 @@ static dev_proc_image_out(lips4_image_out);
(rm) * 72.0, (tm) * 72.0\
),\
lp_device_body_rest_(print_page_copies, image_out),\
- cassetFeed, username, LIPS_PJL_DEFAULT,\
- 0, 0, 0, 0, 0, 0, 0, -1\
+ cassetFeed, username, LIPS_PJL_DEFAULT,\
+ 0, 0, 0, 0, 0, 0, 0, -1\
}
#define lips4_device(dtype, procs, dname, xdpi, ydpi, lm, bm, rm, tm, color_bits,\
- print_page_copies, image_out, cassetFeed, username)\
+ print_page_copies, image_out, cassetFeed, username)\
{ std_device_std_color_full_body(dtype, &procs, dname,\
(int)((long)(DEFAULT_WIDTH_10THS) * (xdpi) / 10),\
(int)((long)(DEFAULT_HEIGHT_10THS) * (ydpi) / 10),\
@@ -101,67 +101,67 @@ struct gx_device_lips4_s {
static gx_device_procs lips2p_prn_procs =
prn_params_procs(lips2p_open, gdev_prn_output_page, lips_close,
- lips_get_params, lips_put_params);
+ lips_get_params, lips_put_params);
static gx_device_procs lips3_prn_procs =
prn_params_procs(lips3_open, gdev_prn_output_page, lips_close,
- lips_get_params, lips_put_params);
+ lips_get_params, lips_put_params);
static gx_device_procs bjc880j_prn_color_procs =
prn_params_procs(bjc880j_open, gdev_prn_output_page, lips_close,
- lips4_get_params, lips4_put_params);
+ lips4_get_params, lips4_put_params);
static gx_device_procs lips4_prn_procs =
prn_params_procs(lips4_open, gdev_prn_output_page, lips_close,
- lips4_get_params, lips4_put_params);
+ lips4_get_params, lips4_put_params);
gx_device_lips far_data gs_lips2p_device =
lips_device(gx_device_lips, lips2p_prn_procs, "lips2p",
- LIPS2P_DPI_DEFAULT,
- LIPS2P_DPI_DEFAULT,
- LIPS2P_LEFT_MARGIN_DEFAULT,
- LIPS2P_BOTTOM_MARGIN_DEFAULT,
- LIPS2P_RIGHT_MARGIN_DEFAULT,
- LIPS2P_TOP_MARGIN_DEFAULT,
- 1, lips2p_print_page_copies, lips2p_image_out,
- LIPS_CASSETFEED_DEFAULT,
- LIPS_USERNAME_DEFAULT);
+ LIPS2P_DPI_DEFAULT,
+ LIPS2P_DPI_DEFAULT,
+ LIPS2P_LEFT_MARGIN_DEFAULT,
+ LIPS2P_BOTTOM_MARGIN_DEFAULT,
+ LIPS2P_RIGHT_MARGIN_DEFAULT,
+ LIPS2P_TOP_MARGIN_DEFAULT,
+ 1, lips2p_print_page_copies, lips2p_image_out,
+ LIPS_CASSETFEED_DEFAULT,
+ LIPS_USERNAME_DEFAULT);
gx_device_lips far_data gs_lips3_device =
lips_device(gx_device_lips, lips3_prn_procs, "lips3",
- LIPS3_DPI_DEFAULT,
- LIPS3_DPI_DEFAULT,
- LIPS3_LEFT_MARGIN_DEFAULT,
- LIPS3_BOTTOM_MARGIN_DEFAULT,
- LIPS3_RIGHT_MARGIN_DEFAULT,
- LIPS3_TOP_MARGIN_DEFAULT,
- 1, lips3_print_page_copies, lips2p_image_out,
- LIPS_CASSETFEED_DEFAULT,
- LIPS_USERNAME_DEFAULT);
+ LIPS3_DPI_DEFAULT,
+ LIPS3_DPI_DEFAULT,
+ LIPS3_LEFT_MARGIN_DEFAULT,
+ LIPS3_BOTTOM_MARGIN_DEFAULT,
+ LIPS3_RIGHT_MARGIN_DEFAULT,
+ LIPS3_TOP_MARGIN_DEFAULT,
+ 1, lips3_print_page_copies, lips2p_image_out,
+ LIPS_CASSETFEED_DEFAULT,
+ LIPS_USERNAME_DEFAULT);
gx_device_lips4 far_data gs_bjc880j_device =
lips4_device(gx_device_lips4, bjc880j_prn_color_procs, "bjc880j",
- BJC880J_DPI_DEFAULT,
- BJC880J_DPI_DEFAULT,
- BJC880J_LEFT_MARGIN_DEFAULT,
- BJC880J_BOTTOM_MARGIN_DEFAULT,
- BJC880J_RIGHT_MARGIN_DEFAULT,
- BJC880J_TOP_MARGIN_DEFAULT,
- 1, bjc880j_print_page_copies, lips4_image_out,
- LIPS_CASSETFEED_DEFAULT,
- LIPS_USERNAME_DEFAULT);
+ BJC880J_DPI_DEFAULT,
+ BJC880J_DPI_DEFAULT,
+ BJC880J_LEFT_MARGIN_DEFAULT,
+ BJC880J_BOTTOM_MARGIN_DEFAULT,
+ BJC880J_RIGHT_MARGIN_DEFAULT,
+ BJC880J_TOP_MARGIN_DEFAULT,
+ 1, bjc880j_print_page_copies, lips4_image_out,
+ LIPS_CASSETFEED_DEFAULT,
+ LIPS_USERNAME_DEFAULT);
gx_device_lips4 far_data gs_lips4_device =
lips4_device(gx_device_lips4, lips4_prn_procs, "lips4",
- LIPS4_DPI_DEFAULT,
- LIPS4_DPI_DEFAULT,
- LIPS4_LEFT_MARGIN_DEFAULT,
- LIPS4_BOTTOM_MARGIN_DEFAULT,
- LIPS4_RIGHT_MARGIN_DEFAULT,
- LIPS4_TOP_MARGIN_DEFAULT,
- 1, lips4_print_page_copies, lips4_image_out,
- LIPS_CASSETFEED_DEFAULT,
- LIPS_USERNAME_DEFAULT);
+ LIPS4_DPI_DEFAULT,
+ LIPS4_DPI_DEFAULT,
+ LIPS4_LEFT_MARGIN_DEFAULT,
+ LIPS4_BOTTOM_MARGIN_DEFAULT,
+ LIPS4_RIGHT_MARGIN_DEFAULT,
+ LIPS4_TOP_MARGIN_DEFAULT,
+ 1, lips4_print_page_copies, lips4_image_out,
+ LIPS_CASSETFEED_DEFAULT,
+ LIPS_USERNAME_DEFAULT);
/* Printer types */
typedef enum {
@@ -221,34 +221,34 @@ lips_open(gx_device * pdev, lips_printer_type ptype)
/* Paper Size Check */
if (width <= height) { /* portrait */
- if ((width < LIPS_WIDTH_MIN || width > LIPS_WIDTH_MAX ||
- height < LIPS_HEIGHT_MIN || height > LIPS_HEIGHT_MAX) &&
- !(width == LIPS_LEDGER_WIDTH && height == LIPS_LEDGER_HEIGHT))
- return_error(gs_error_rangecheck);
+ if ((width < LIPS_WIDTH_MIN || width > LIPS_WIDTH_MAX ||
+ height < LIPS_HEIGHT_MIN || height > LIPS_HEIGHT_MAX) &&
+ !(width == LIPS_LEDGER_WIDTH && height == LIPS_LEDGER_HEIGHT))
+ return_error(gs_error_rangecheck);
} else { /* landscape */
- if ((width < LIPS_HEIGHT_MIN || width > LIPS_HEIGHT_MAX ||
- height < LIPS_WIDTH_MIN || height > LIPS_WIDTH_MAX) &&
- !(width == LIPS_LEDGER_HEIGHT && height == LIPS_LEDGER_WIDTH))
- return_error(gs_error_rangecheck);
+ if ((width < LIPS_HEIGHT_MIN || width > LIPS_HEIGHT_MAX ||
+ height < LIPS_WIDTH_MIN || height > LIPS_WIDTH_MAX) &&
+ !(width == LIPS_LEDGER_HEIGHT && height == LIPS_LEDGER_WIDTH))
+ return_error(gs_error_rangecheck);
}
/* Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else if (ptype == LIPS2P) {
- /* LIPS II+ support DPI is 240x240 */
- if (xdpi != LIPS2P_DPI_MAX)
- return_error(gs_error_rangecheck);
+ /* LIPS II+ support DPI is 240x240 */
+ if (xdpi != LIPS2P_DPI_MAX)
+ return_error(gs_error_rangecheck);
} else if (ptype == LIPS3) {
- /* LIPS III supports DPI is 300x300 */
- if (xdpi != LIPS3_DPI_MAX)
- return_error(gs_error_rangecheck);
+ /* LIPS III supports DPI is 300x300 */
+ if (xdpi != LIPS3_DPI_MAX)
+ return_error(gs_error_rangecheck);
} else if (ptype == BJC880J) {
- if (xdpi < LIPS_DPI_MIN || xdpi > BJC880J_DPI_MAX)
- return_error(gs_error_rangecheck);
+ if (xdpi < LIPS_DPI_MIN || xdpi > BJC880J_DPI_MAX)
+ return_error(gs_error_rangecheck);
} else { /* LIPS4 supprts DPI is 60x60 - 600x600 and 1200x1200 */
- if ((xdpi < LIPS_DPI_MIN || xdpi > LIPS4_DPI_MAX) && xdpi != LIPS4_DPI_SUPERFINE)
- return_error(gs_error_rangecheck);
+ if ((xdpi < LIPS_DPI_MIN || xdpi > LIPS4_DPI_MAX) && xdpi != LIPS4_DPI_SUPERFINE)
+ return_error(gs_error_rangecheck);
}
return gdev_prn_open(pdev);
@@ -264,11 +264,11 @@ lips_close(gx_device * pdev)
fprintf(ppdev->file, "%c0J%c", LIPS_DCS, LIPS_ST);
if (lips->pjl)
- fprintf(ppdev->file,
- "%c%%-12345X"
- "@PJL SET LPARM : LIPS SW2 = OFF\n"
- "@PJL EOJ\n"
- "%c%%-12345X", LIPS_ESC, LIPS_ESC);
+ fprintf(ppdev->file,
+ "%c%%-12345X"
+ "@PJL SET LPARM : LIPS SW2 = OFF\n"
+ "@PJL EOJ\n"
+ "%c%%-12345X", LIPS_ESC, LIPS_ESC);
return gdev_prn_close(pdev);
}
@@ -283,32 +283,32 @@ lips_get_params(gx_device * pdev, gs_param_list * plist)
gs_param_string usern;
if (code < 0)
- return code;
+ return code;
if ((ncode = param_write_int(plist, LIPS_OPTION_CASSETFEED,
- &lips->cassetFeed)) < 0)
- code = ncode;
+ &lips->cassetFeed)) < 0)
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_PJL,
- &lips->pjl)) < 0)
- code = ncode;
+ &lips->pjl)) < 0)
+ code = ncode;
if ((ncode = param_write_int(plist, LIPS_OPTION_TONERDENSITY,
- &lips->toner_density)) < 0)
- code = ncode;
+ &lips->toner_density)) < 0)
+ code = ncode;
if (lips->toner_saving_set >= 0 &&
- (code = (lips->toner_saving_set ?
+ (code = (lips->toner_saving_set ?
param_write_bool(plist, LIPS_OPTION_TONERSAVING, &lips->toner_saving) :
- param_write_null(plist, LIPS_OPTION_TONERSAVING))) < 0)
- code = ncode;
+ param_write_null(plist, LIPS_OPTION_TONERSAVING))) < 0)
+ code = ncode;
if (code < 0)
- return code;
+ return code;
usern.data = (const byte *)lips->Username,
- usern.size = strlen(lips->Username),
- usern.persistent = false;
+ usern.size = strlen(lips->Username),
+ usern.persistent = false;
return param_write_string(plist, LIPS_OPTION_USER_NAME, &usern);
}
@@ -322,22 +322,22 @@ lips4_get_params(gx_device * pdev, gs_param_list * plist)
gs_param_string pmedia;
if (code < 0)
- return code;
+ return code;
if ((ncode = param_write_int(plist, LIPS_OPTION_NUP,
- &lips4->nup)) < 0)
- code = ncode;
+ &lips4->nup)) < 0)
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_FACEUP,
- &lips4->faceup)) < 0)
- code = ncode;
+ &lips4->faceup)) < 0)
+ code = ncode;
if (code < 0)
- return code;
+ return code;
pmedia.data = (const byte *)lips4->mediaType,
- pmedia.size = strlen(lips4->mediaType),
- pmedia.persistent = false;
+ pmedia.size = strlen(lips4->mediaType),
+ pmedia.persistent = false;
return param_write_string(plist, LIPS_OPTION_MEDIATYPE, &pmedia);
}
@@ -358,94 +358,94 @@ lips_put_params(gx_device * pdev, gs_param_list * plist)
gs_param_string usern;
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_CASSETFEED),
- &cass)) {
- case 0:
- if (cass < -1 || cass > 17 || (cass > 3 && cass < 10))
- ecode = gs_error_rangecheck;
- else
- break;
- goto casse;
- default:
- ecode = code;
- casse:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ (param_name = LIPS_OPTION_CASSETFEED),
+ &cass)) {
+ case 0:
+ if (cass < -1 || cass > 17 || (cass > 3 && cass < 10))
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto casse;
+ default:
+ ecode = code;
+ casse:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_PJL),
- &pjl)) < 0)
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_PJL),
+ &pjl)) < 0)
+ param_signal_error(plist, param_name, ecode = code);
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_TONERDENSITY),
- &toner_density)) {
- case 0:
- if (toner_density < 0 || toner_density > 8)
- ecode = gs_error_rangecheck;
- else
- break;
- goto tden;
- default:
- ecode = code;
- tden:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ (param_name = LIPS_OPTION_TONERDENSITY),
+ &toner_density)) {
+ case 0:
+ if (toner_density < 0 || toner_density > 8)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto tden;
+ default:
+ ecode = code;
+ tden:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
if (lips->toner_saving_set >= 0)
- switch (code = param_read_bool(plist, (param_name = LIPS_OPTION_TONERSAVING),
- &toner_saving)) {
- case 0:
- toner_saving_set = 1;
- break;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- toner_saving_set = 0;
- break;
- }
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
- }
+ switch (code = param_read_bool(plist, (param_name = LIPS_OPTION_TONERSAVING),
+ &toner_saving)) {
+ case 0:
+ toner_saving_set = 1;
+ break;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ toner_saving_set = 0;
+ break;
+ }
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
+ }
switch (code = param_read_string(plist,
- (param_name = LIPS_OPTION_USER_NAME),
- &usern)) {
- case 0:
- if (usern.size > LIPS_USERNAME_MAX) {
- ecode = gs_error_limitcheck;
+ (param_name = LIPS_OPTION_USER_NAME),
+ &usern)) {
+ case 0:
+ if (usern.size > LIPS_USERNAME_MAX) {
+ ecode = gs_error_limitcheck;
goto userne;
- } else { /* Check the validity of ``User Name'' characters */
- int i;
-
- for (i = 0; i < usern.size; i++)
- if (usern.data[i] < 0x20 ||
- usern.data[i] > 0x7e
- /*
- && usern.data[i] < 0xa0) ||
- usern.data[i] > 0xfe
- */
- ) {
- ecode = gs_error_rangecheck;
- goto userne;
- }
- }
- break;
- default:
- ecode = code;
- userne:param_signal_error(plist, param_name, ecode);
- case 1:
- usern.data = 0;
- break;
+ } else { /* Check the validity of ``User Name'' characters */
+ int i;
+
+ for (i = 0; i < usern.size; i++)
+ if (usern.data[i] < 0x20 ||
+ usern.data[i] > 0x7e
+ /*
+ && usern.data[i] < 0xa0) ||
+ usern.data[i] > 0xfe
+ */
+ ) {
+ ecode = gs_error_rangecheck;
+ goto userne;
+ }
+ }
+ break;
+ default:
+ ecode = code;
+ userne:param_signal_error(plist, param_name, ecode);
+ case 1:
+ usern.data = 0;
+ break;
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = lprn_put_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
lips->cassetFeed = cass;
lips->pjl = pjl;
@@ -454,11 +454,11 @@ lips_put_params(gx_device * pdev, gs_param_list * plist)
lips->toner_saving_set = toner_saving_set;
if (usern.data != 0 &&
- bytes_compare(usern.data, usern.size,
- (const byte *)lips->Username, strlen(lips->Username))
- ) {
- memcpy(lips->Username, usern.data, usern.size);
- lips->Username[usern.size] = 0;
+ bytes_compare(usern.data, usern.size,
+ (const byte *)lips->Username, strlen(lips->Username))
+ ) {
+ memcpy(lips->Username, usern.data, usern.size);
+ lips->Username[usern.size] = 0;
}
return 0;
}
@@ -477,102 +477,101 @@ lips4_put_params(gx_device * pdev, gs_param_list * plist)
int bpp = 0;
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_NUP),
- &nup)) {
- case 0:
- if (nup != 1 && nup != 2 && nup != 4)
- ecode = gs_error_rangecheck;
- else
- break;
- goto nupe;
- default:
- ecode = code;
- nupe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ (param_name = LIPS_OPTION_NUP),
+ &nup)) {
+ case 0:
+ if (nup != 1 && nup != 2 && nup != 4)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto nupe;
+ default:
+ ecode = code;
+ nupe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_FACEUP),
- &faceup)) < 0)
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_FACEUP),
+ &faceup)) < 0)
+ param_signal_error(plist, param_name, ecode = code);
switch (code = param_read_string(plist,
- (param_name = LIPS_OPTION_MEDIATYPE),
- &pmedia)) {
- case 0:
- if (pmedia.size > LIPS_MEDIACHAR_MAX) {
- ecode = gs_error_limitcheck;
- goto pmediae;
- } else { /* Check the validity of ``MediaType'' characters */
- if (strcmp(pmedia.data, "PlainPaper") != 0 &&
- strcmp(pmedia.data, "OHP") != 0 &&
- strcmp(pmedia.data, "TransparencyFilm") != 0 && /* same as OHP */
- strcmp(pmedia.data, "GlossyFilm") != 0 &&
- strcmp(pmedia.data, "CardBoard") != 0
- ) {
- ecode = gs_error_rangecheck;
- goto pmediae;
- }
- }
- break;
- default:
- ecode = code;
- pmediae:param_signal_error(plist, param_name, ecode);
- case 1:
- pmedia.data = 0;
- break;
+ (param_name = LIPS_OPTION_MEDIATYPE),
+ &pmedia)) {
+ case 0:
+ if (pmedia.size > LIPS_MEDIACHAR_MAX) {
+ ecode = gs_error_limitcheck;
+ goto pmediae;
+ } else { /* Check the validity of ``MediaType'' characters */
+ if (strcmp(pmedia.data, "PlainPaper") != 0 &&
+ strcmp(pmedia.data, "OHP") != 0 &&
+ strcmp(pmedia.data, "TransparencyFilm") != 0 && /* same as OHP */
+ strcmp(pmedia.data, "GlossyFilm") != 0 &&
+ strcmp(pmedia.data, "CardBoard") != 0
+ ) {
+ ecode = gs_error_rangecheck;
+ goto pmediae;
+ }
+ }
+ break;
+ default:
+ ecode = code;
+ pmediae:param_signal_error(plist, param_name, ecode);
+ case 1:
+ pmedia.data = 0;
+ break;
}
switch (code = param_read_int(plist,
- (param_name = "BitsPerPixel"),
- &bpp)) {
- case 0:
- if (bpp != 1 && bpp != 24)
- ecode = gs_error_rangecheck;
- else
- break;
- goto bppe;
- default:
- ecode = code;
- bppe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ (param_name = "BitsPerPixel"),
+ &bpp)) {
+ case 0:
+ if (bpp != 1 && bpp != 24)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto bppe;
+ default:
+ ecode = code;
+ bppe:param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
}
if (bpp != 0)
{
- pdev->color_info.depth = bpp;
- pdev->color_info.num_components = ((bpp == 1) ? 1 : 3);
- pdev->color_info.max_gray = (bpp >= 8 ? 255 : 1);
- pdev->color_info.max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
- pdev->color_info.dither_grays = (bpp >= 8 ? 5 : 2);
- pdev->color_info.dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- dev_proc(pdev, map_rgb_color) = ((bpp == 1) ? gdev_prn_map_rgb_color : gx_default_rgb_map_rgb_color);
+ pdev->color_info.depth = bpp;
+ pdev->color_info.num_components = ((bpp == 1) ? 1 : 3);
+ pdev->color_info.max_gray = (bpp >= 8 ? 255 : 1);
+ pdev->color_info.max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
+ pdev->color_info.dither_grays = (bpp >= 8 ? 5 : 2);
+ pdev->color_info.dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ dev_proc(pdev, map_rgb_color) = ((bpp == 1) ? gdev_prn_map_rgb_color : gx_default_rgb_map_rgb_color);
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = lips_put_params(pdev, plist);
if (code < 0)
- return code;
+ return code;
lips4->nup = nup;
lips4->faceup = faceup;
if (pmedia.data != 0 &&
- bytes_compare(pmedia.data, pmedia.size,
- (const byte *)lips4->mediaType, strlen(lips4->mediaType))
- ) {
- memcpy(lips4->mediaType, pmedia.data, pmedia.size);
- lips4->mediaType[pmedia.size] = 0;
+ bytes_compare(pmedia.data, pmedia.size,
+ (const byte *)lips4->mediaType, strlen(lips4->mediaType))
+ ) {
+ memcpy(lips4->mediaType, pmedia.data, pmedia.size);
+ lips4->mediaType[pmedia.size] = 0;
}
if (bpp != 0 && bpp != old_bpp && pdev->is_open)
- return gs_closedevice(pdev);
+ return gs_closedevice(pdev);
return 0;
}
-
/* ------ Internal routines ------ */
static int
@@ -602,21 +601,19 @@ lips_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, lips_printer
lips_job_start(pdev, ptype, prn_stream, num_copies);
if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "(CompBuf)")))
- return_error(gs_error_VMerror);
-
+ return_error(gs_error_VMerror);
lprn->NegativePrint = false; /* not support */
lprn->prev_x = lprn->prev_y = 0;
code = lprn_print_image(pdev, prn_stream);
if (code < 0)
- return code;
+ return code;
gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "(CompBuf)");
/* eject page */
lips_job_end(pdev, prn_stream);
-
return 0;
}
@@ -645,43 +642,41 @@ lips4type_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num
if (pdev->color_info.depth == 1)
{
- if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "(CompBuf)")))
- return_error(gs_error_VMerror);
- if (!(lprn->CompBuf2 = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "(CompBuf2)")))
- return_error(gs_error_VMerror);
-
- if (lprn->NegativePrint) {
- int rm = pdev->width - (dev_l_margin(pdev) + dev_r_margin(pdev)) * pdev->x_pixels_per_inch;
- int bm = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * pdev->y_pixels_per_inch;
- /* Draw black rectangle */
- fprintf(prn_stream,
- "%c{%c%da%c%de%c;;;3}",
- LIPS_CSI, LIPS_CSI, rm, LIPS_CSI, bm, LIPS_CSI);
- fprintf(prn_stream, "%c%dj%c%dk",
- LIPS_CSI, rm, LIPS_CSI, bm);
- }
-
-
- lprn->prev_x = lprn->prev_y = 0;
- code = lprn_print_image(pdev, prn_stream);
- if (code < 0)
- return code;
-
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "(CompBuf)");
- gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf2, bpl * 3 / 2 + 1, maxY, "(CompBuf2)");
+ if (!(lprn->CompBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "(CompBuf)")))
+ return_error(gs_error_VMerror);
+ if (!(lprn->CompBuf2 = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl * 3 / 2 + 1, maxY, "(CompBuf2)")))
+ return_error(gs_error_VMerror);
+
+ if (lprn->NegativePrint) {
+ int rm = pdev->width - (dev_l_margin(pdev) + dev_r_margin(pdev)) * pdev->x_pixels_per_inch;
+ int bm = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * pdev->y_pixels_per_inch;
+ /* Draw black rectangle */
+ fprintf(prn_stream,
+ "%c{%c%da%c%de%c;;;3}",
+ LIPS_CSI, LIPS_CSI, rm, LIPS_CSI, bm, LIPS_CSI);
+ fprintf(prn_stream, "%c%dj%c%dk",
+ LIPS_CSI, rm, LIPS_CSI, bm);
+ }
+
+ lprn->prev_x = lprn->prev_y = 0;
+ code = lprn_print_image(pdev, prn_stream);
+ if (code < 0)
+ return code;
+
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "(CompBuf)");
+ gs_free(gs_lib_ctx_get_non_gc_memory_t(), lprn->CompBuf2, bpl * 3 / 2 + 1, maxY, "(CompBuf2)");
}
else
{
- code = lips4c_output_page(pdev, prn_stream);
-
- if (code < 0)
- return code;
+ code = lips4c_output_page(pdev, prn_stream);
+
+ if (code < 0)
+ return code;
}
/* eject page */
lips_job_end(pdev, prn_stream);
-
return 0;
}
@@ -698,7 +693,7 @@ lips4c_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_co
code = lips4c_output_page(pdev, prn_stream);
if (code < 0)
- return code;
+ return code;
/* eject page */
lips_job_end(pdev, prn_stream);
@@ -713,20 +708,20 @@ move_cap(gx_device_printer * pdev, FILE * prn_stream, int x, int y)
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
if (x != lprn->prev_x) {
- if (x > lprn->prev_x)
- fprintf(prn_stream, "%c%da", LIPS_CSI, x - lprn->prev_x);
- else
- fprintf(prn_stream, "%c%dj", LIPS_CSI, lprn->prev_x - x);
+ if (x > lprn->prev_x)
+ fprintf(prn_stream, "%c%da", LIPS_CSI, x - lprn->prev_x);
+ else
+ fprintf(prn_stream, "%c%dj", LIPS_CSI, lprn->prev_x - x);
- lprn->prev_x = x;
+ lprn->prev_x = x;
}
if (y != lprn->prev_y) {
- if (y > lprn->prev_y)
- fprintf(prn_stream, "%c%de", LIPS_CSI, y - lprn->prev_y);
- else
- fprintf(prn_stream, "%c%dk", LIPS_CSI, lprn->prev_y - y);
+ if (y > lprn->prev_y)
+ fprintf(prn_stream, "%c%de", LIPS_CSI, y - lprn->prev_y);
+ else
+ fprintf(prn_stream, "%c%dk", LIPS_CSI, lprn->prev_y - y);
- lprn->prev_y = y;
+ lprn->prev_y = y;
}
}
@@ -735,13 +730,12 @@ draw_bubble(FILE * prn_stream, int width, int height)
{
/* Draw a rectangle */
fprintf(prn_stream,
- "%c{%c%da%c%de%c}",
- LIPS_CSI, LIPS_CSI, width, LIPS_CSI, height, LIPS_CSI);
+ "%c{%c%da%c%de%c}",
+ LIPS_CSI, LIPS_CSI, width, LIPS_CSI, height, LIPS_CSI);
fprintf(prn_stream, "%c%dj%c%dk",
- LIPS_CSI, width, LIPS_CSI, height);
+ LIPS_CSI, width, LIPS_CSI, height);
}
-
#if 0
/* Non Compression Version of image_out */
static void
@@ -756,17 +750,17 @@ lips_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
move_cap(pdev, prn_stream, x, y);
fprintf(prn_stream, "%c%d;%d;%d.r", LIPS_CSI,
- width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
+ width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
for (i = 0; i < height; i++) {
- p = lprn->ImageBuf + ((i + y) % maxY) * raster;
- for (j = 0; j < width / 8; j++) {
- fputc(p[j + data_x], prn_stream);
- }
+ p = lprn->ImageBuf + ((i + y) % maxY) * raster;
+ for (j = 0; j < width / 8; j++) {
+ fputc(p[j + data_x], prn_stream);
+ }
}
if (lprn->ShowBubble)
- draw_bubble(prn_stream, width, height);
+ draw_bubble(prn_stream, width, height);
}
#endif
@@ -782,21 +776,21 @@ lips2p_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int
Len = lips_mode3format_encode(lprn->TmpBuf, lprn->CompBuf, width / 8 * height);
sprintf(raw_str, "%c%d;%d;%d.r", LIPS_CSI,
- width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
+ width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
sprintf(comp_str, "%c%d;%d;%d;9;%d.r", LIPS_CSI,
- Len, width / 8, (int)pdev->x_pixels_per_inch, height);
+ Len, width / 8, (int)pdev->x_pixels_per_inch, height);
if (Len < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
- fprintf(prn_stream, "%s", comp_str);
- fwrite(lprn->CompBuf, 1, Len, prn_stream);
+ fprintf(prn_stream, "%s", comp_str);
+ fwrite(lprn->CompBuf, 1, Len, prn_stream);
} else {
- /* compression result is bad. */
- fprintf(prn_stream, "%s", raw_str);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ /* compression result is bad. */
+ fprintf(prn_stream, "%s", raw_str);
+ fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
}
if (lprn->ShowBubble)
- draw_bubble(prn_stream, width, height);
+ draw_bubble(prn_stream, width, height);
}
static void
@@ -813,34 +807,34 @@ lips4_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int w
Len_rle = lips_rle_encode(lprn->TmpBuf, lprn->CompBuf2, width / 8 * height);
sprintf(raw_str, "%c%d;%d;%d.r", LIPS_CSI,
- width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
+ width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
if (Len < Len_rle) {
- sprintf(comp_str, "%c%d;%d;%d;11;%d.r", LIPS_CSI,
- Len, width / 8, (int)pdev->x_pixels_per_inch, height);
- if (Len < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
- fprintf(prn_stream, "%s", comp_str);
- fwrite(lprn->CompBuf, 1, Len, prn_stream);
- } else {
- /* compression result is bad. */
- fprintf(prn_stream, "%s", raw_str);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
- }
+ sprintf(comp_str, "%c%d;%d;%d;11;%d.r", LIPS_CSI,
+ Len, width / 8, (int)pdev->x_pixels_per_inch, height);
+ if (Len < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
+ fprintf(prn_stream, "%s", comp_str);
+ fwrite(lprn->CompBuf, 1, Len, prn_stream);
+ } else {
+ /* compression result is bad. */
+ fprintf(prn_stream, "%s", raw_str);
+ fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ }
} else {
- sprintf(comp_str, "%c%d;%d;%d;10;%d.r", LIPS_CSI,
- Len, width / 8, (int)pdev->x_pixels_per_inch, height);
- if (Len_rle < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
- fprintf(prn_stream, "%s", comp_str);
- fwrite(lprn->CompBuf2, 1, Len, prn_stream);
- } else {
- /* compression result is bad. */
- fprintf(prn_stream, "%s", raw_str);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
- }
+ sprintf(comp_str, "%c%d;%d;%d;10;%d.r", LIPS_CSI,
+ Len, width / 8, (int)pdev->x_pixels_per_inch, height);
+ if (Len_rle < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
+ fprintf(prn_stream, "%s", comp_str);
+ fwrite(lprn->CompBuf2, 1, Len, prn_stream);
+ } else {
+ /* compression result is bad. */
+ fprintf(prn_stream, "%s", raw_str);
+ fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ }
}
if (lprn->ShowBubble)
- draw_bubble(prn_stream, width, height);
+ draw_bubble(prn_stream, width, height);
}
static int
@@ -856,40 +850,40 @@ lips4c_write_raster(gx_device_printer * pdev, FILE * prn_stream, byte * pBuff, b
int i, y, Len;
for (i = 0; i < nBytesPerLine; i++) {
- *(prevBuff + i) = 0x00; /* initialize */
+ *(prevBuff + i) = 0x00; /* initialize */
}
for (y = lnum; y < lnum + raster_height; y++) {
- gdev_prn_copy_scan_lines(pdev, y, pBuff, nBytesPerLine);
-
- Len = lips_delta_encode(pBuff,
- prevBuff, ComBuff, diffBuff,
- Xpixel * num_components);
-
- if (Len == 2 && *ComBuff == 0x01) {
- if (zerobyte_flag == false) {
- zerobyte_flag = true;
- TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
- } else {
- if (num_zerobyte > 255) {
- TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
- } else {
- *(TotalBuff + TotalLen - 1) = num_zerobyte;
- }
- num_zerobyte++;
- }
- } else {
- TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
- zerobyte_flag = false;
- num_zerobyte = 0;
- }
+ gdev_prn_copy_scan_lines(pdev, y, pBuff, nBytesPerLine);
+
+ Len = lips_delta_encode(pBuff,
+ prevBuff, ComBuff, diffBuff,
+ Xpixel * num_components);
+
+ if (Len == 2 && *ComBuff == 0x01) {
+ if (zerobyte_flag == false) {
+ zerobyte_flag = true;
+ TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
+ } else {
+ if (num_zerobyte > 255) {
+ TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
+ } else {
+ *(TotalBuff + TotalLen - 1) = num_zerobyte;
+ }
+ num_zerobyte++;
+ }
+ } else {
+ TotalLen = lips_byte_cat(TotalBuff, ComBuff, TotalLen, Len);
+ zerobyte_flag = false;
+ num_zerobyte = 0;
+ }
}
fprintf(prn_stream, "%c%d;%d;%d;12;%d;;%d;%d;;1.r", LIPS_CSI,
- TotalLen, Xpixel, (int)pdev->x_pixels_per_inch,
- raster_height,
- bits_per_pixel / num_components,
- num_components < 3 ? 0 : 10);
+ TotalLen, Xpixel, (int)pdev->x_pixels_per_inch,
+ raster_height,
+ bits_per_pixel / num_components,
+ num_components < 3 ? 0 : 10);
fwrite(TotalBuff, 1, TotalLen, prn_stream);
fputc(0x85, prn_stream); /* CR + LF */
@@ -908,27 +902,27 @@ lips4c_output_page(gx_device_printer * pdev, FILE * prn_stream)
/* Memory Allocate */
if (!(pBuff = (byte *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), nBytesPerLine, sizeof(byte), "lips4c_compress_output_page(pBuff)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(prevBuff = (byte *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), nBytesPerLine, sizeof(byte), "lips4c_compress_output_page(prevBuff)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(ComBuff = (byte *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), Xpixel * num_components + (Xpixel * num_components + 127) * 129 / 128, sizeof(byte), "lips4c_compress_output_page(ComBuff)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(TotalBuff = (byte *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), (Xpixel * num_components + (Xpixel * num_components + 127) * 129 / 128) * NUM_LINES_4C, sizeof(byte), "lips4c_compress_output_page(TotalBuff)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(diffBuff = (byte *) gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), Xpixel * num_components * 2, sizeof(byte), "lips_print_page")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* make output data */
while (lnum < pdev->height) {
- lips4c_write_raster(pdev, prn_stream, pBuff, prevBuff, ComBuff,
- TotalBuff, diffBuff, lnum, NUM_LINES_4C);
- lnum += NUM_LINES_4C;
+ lips4c_write_raster(pdev, prn_stream, pBuff, prevBuff, ComBuff,
+ TotalBuff, diffBuff, lnum, NUM_LINES_4C);
+ lnum += NUM_LINES_4C;
}
if (pdev->height - (lnum - NUM_LINES_4C) > 0) {
- lips4c_write_raster(pdev, prn_stream, pBuff, prevBuff, ComBuff,
- TotalBuff, diffBuff, lnum - NUM_LINES_4C,
- pdev->height - (lnum - NUM_LINES_4C));
+ lips4c_write_raster(pdev, prn_stream, pBuff, prevBuff, ComBuff,
+ TotalBuff, diffBuff, lnum - NUM_LINES_4C,
+ pdev->height - (lnum - NUM_LINES_4C));
}
/* Free Memory */
gs_free(gs_lib_ctx_get_non_gc_memory_t(), pBuff, nBytesPerLine, sizeof(byte), "lips4c_compress_output_page(pBuff)");
@@ -940,7 +934,6 @@ lips4c_output_page(gx_device_printer * pdev, FILE * prn_stream)
return 0;
}
-
static void
lips_job_start(gx_device_printer * pdev, lips_printer_type ptype, FILE * prn_stream, int num_copies)
{
@@ -952,57 +945,57 @@ lips_job_start(gx_device_printer * pdev, lips_printer_type ptype, FILE * prn_str
int tm, lm, rm, bm;
if (pdev->PageCount == 0) {
- if (lips->pjl) {
- fprintf(prn_stream,
- "%c%%-12345X@PJL CJLMODE\n"
- "@PJL JOB\n", LIPS_ESC);
- if (ptype == LIPS4) {
- fprintf(prn_stream,
- "%c%%-12345X@PJL CJLMODE\n", LIPS_ESC);
- if ((int)pdev->x_pixels_per_inch == 1200)
- fprintf(prn_stream, "@PJL SET RESOLUTION = SUPERFINE\n");
- else if ((int)pdev->x_pixels_per_inch == 600)
- fprintf(prn_stream, "@PJL SET RESOLUTION = FINE\n");
- else if ((int)pdev->x_pixels_per_inch == 300)
- fprintf(prn_stream, "@PJL SET RESOLUTION = QUICK\n");
- }
- if (lips->toner_density)
- fprintf(prn_stream, "@PJL SET TONER-DENSITY=%d\n",
- lips->toner_density);
- if (lips->toner_saving_set) {
- fprintf(prn_stream, "@PJL SET TONER-SAVING=");
- if (lips->toner_saving)
- fprintf(prn_stream, "ON\n");
- else
- fprintf(prn_stream, "OFF\n");
- }
- fprintf(prn_stream,
- "@PJL SET LPARM : LIPS SW2 = ON\n"
- "@PJL ENTER LANGUAGE = LIPS\n");
- }
- fprintf(prn_stream, "%c%%@", LIPS_ESC);
- if (ptype == LIPS2P)
- fprintf(prn_stream, "%c21;%d;0J" LIPS2P_STRING LIPS_VERSION "%c",
- LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
- else if (ptype == LIPS3)
- fprintf(prn_stream, "%c31;%d;0J" LIPS3_STRING LIPS_VERSION "%c",
- LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
- else if (ptype == LIPS4)
- fprintf(prn_stream, "%c41;%d;0J" LIPS4_STRING LIPS_VERSION "%c",
- LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
- else if (ptype == BJC880J)
- fprintf(prn_stream, "%c41;%d;0J" BJC880J_STRING LIPS_VERSION "%c",
- LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
-
- if (ptype == LIPS4 || ptype == BJC880J)
- {
- if (pdev->color_info.depth == 24)
- fprintf(prn_stream, "%c1\"p", LIPS_CSI);
- else
- fprintf(prn_stream, "%c0\"p", LIPS_CSI);
- }
- fprintf(prn_stream, "%c<", LIPS_ESC);
- fprintf(prn_stream, "%c11h", LIPS_CSI); /* Size Unit Mode */
+ if (lips->pjl) {
+ fprintf(prn_stream,
+ "%c%%-12345X@PJL CJLMODE\n"
+ "@PJL JOB\n", LIPS_ESC);
+ if (ptype == LIPS4) {
+ fprintf(prn_stream,
+ "%c%%-12345X@PJL CJLMODE\n", LIPS_ESC);
+ if ((int)pdev->x_pixels_per_inch == 1200)
+ fprintf(prn_stream, "@PJL SET RESOLUTION = SUPERFINE\n");
+ else if ((int)pdev->x_pixels_per_inch == 600)
+ fprintf(prn_stream, "@PJL SET RESOLUTION = FINE\n");
+ else if ((int)pdev->x_pixels_per_inch == 300)
+ fprintf(prn_stream, "@PJL SET RESOLUTION = QUICK\n");
+ }
+ if (lips->toner_density)
+ fprintf(prn_stream, "@PJL SET TONER-DENSITY=%d\n",
+ lips->toner_density);
+ if (lips->toner_saving_set) {
+ fprintf(prn_stream, "@PJL SET TONER-SAVING=");
+ if (lips->toner_saving)
+ fprintf(prn_stream, "ON\n");
+ else
+ fprintf(prn_stream, "OFF\n");
+ }
+ fprintf(prn_stream,
+ "@PJL SET LPARM : LIPS SW2 = ON\n"
+ "@PJL ENTER LANGUAGE = LIPS\n");
+ }
+ fprintf(prn_stream, "%c%%@", LIPS_ESC);
+ if (ptype == LIPS2P)
+ fprintf(prn_stream, "%c21;%d;0J" LIPS2P_STRING LIPS_VERSION "%c",
+ LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
+ else if (ptype == LIPS3)
+ fprintf(prn_stream, "%c31;%d;0J" LIPS3_STRING LIPS_VERSION "%c",
+ LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
+ else if (ptype == LIPS4)
+ fprintf(prn_stream, "%c41;%d;0J" LIPS4_STRING LIPS_VERSION "%c",
+ LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
+ else if (ptype == BJC880J)
+ fprintf(prn_stream, "%c41;%d;0J" BJC880J_STRING LIPS_VERSION "%c",
+ LIPS_DCS, (int)pdev->x_pixels_per_inch, LIPS_ST);
+
+ if (ptype == LIPS4 || ptype == BJC880J)
+ {
+ if (pdev->color_info.depth == 24)
+ fprintf(prn_stream, "%c1\"p", LIPS_CSI);
+ else
+ fprintf(prn_stream, "%c0\"p", LIPS_CSI);
+ }
+ fprintf(prn_stream, "%c<", LIPS_ESC);
+ fprintf(prn_stream, "%c11h", LIPS_CSI); /* Size Unit Mode */
}
/* */
/* Print Environment Setting */
@@ -1011,53 +1004,53 @@ lips_job_start(gx_device_printer * pdev, lips_printer_type ptype, FILE * prn_str
paper_size = lips_media_selection(width, height);
if (ptype == BJC880J) {
- /* Paint Memory Mode Setting */
- /* for BJC-680J/BJC-880J */
- if (paper_size == B4_SIZE ||
- paper_size == B4_SIZE + LANDSCAPE ||
- paper_size == LEGAL_SIZE ||
- paper_size == LEGAL_SIZE + LANDSCAPE)
- /* for BJC-880J */
- fprintf(prn_stream, "%c3&z", LIPS_CSI);
- else if (paper_size == A3_SIZE ||
- paper_size == A3_SIZE + LANDSCAPE ||
- paper_size == LEDGER_SIZE ||
- paper_size == LEDGER_SIZE + LANDSCAPE)
- /* for BJC-880J */
- fprintf(prn_stream, "%c4&z", LIPS_CSI);
- else
- fprintf(prn_stream, "%c2&z", LIPS_CSI);
+ /* Paint Memory Mode Setting */
+ /* for BJC-680J/BJC-880J */
+ if (paper_size == B4_SIZE ||
+ paper_size == B4_SIZE + LANDSCAPE ||
+ paper_size == LEGAL_SIZE ||
+ paper_size == LEGAL_SIZE + LANDSCAPE)
+ /* for BJC-880J */
+ fprintf(prn_stream, "%c3&z", LIPS_CSI);
+ else if (paper_size == A3_SIZE ||
+ paper_size == A3_SIZE + LANDSCAPE ||
+ paper_size == LEDGER_SIZE ||
+ paper_size == LEDGER_SIZE + LANDSCAPE)
+ /* for BJC-880J */
+ fprintf(prn_stream, "%c4&z", LIPS_CSI);
+ else
+ fprintf(prn_stream, "%c2&z", LIPS_CSI);
}
if (ptype == LIPS4) {
- if (strcmp(lips4->mediaType, "PlainPaper") == 0)
- fprintf(prn_stream, "%c20\'t", LIPS_CSI);
- else if (strcmp(lips4->mediaType, "OHP") == 0 ||
- strcmp(lips4->mediaType, "TransparencyFilm") == 0)
- fprintf(prn_stream, "%c40\'t", LIPS_CSI); /* OHP mode (for LBP-2160) */
- else if (strcmp(lips4->mediaType, "CardBoard") == 0)
- fprintf(prn_stream, "%c30\'t", LIPS_CSI); /* CardBoard mode (for LBP-2160) */
- else if (strcmp(lips4->mediaType, "GlossyFilm") == 0)
- fprintf(prn_stream, "%c41\'t", LIPS_CSI); /* GlossyFile mode (for LBP-2160) */
+ if (strcmp(lips4->mediaType, "PlainPaper") == 0)
+ fprintf(prn_stream, "%c20\'t", LIPS_CSI);
+ else if (strcmp(lips4->mediaType, "OHP") == 0 ||
+ strcmp(lips4->mediaType, "TransparencyFilm") == 0)
+ fprintf(prn_stream, "%c40\'t", LIPS_CSI); /* OHP mode (for LBP-2160) */
+ else if (strcmp(lips4->mediaType, "CardBoard") == 0)
+ fprintf(prn_stream, "%c30\'t", LIPS_CSI); /* CardBoard mode (for LBP-2160) */
+ else if (strcmp(lips4->mediaType, "GlossyFilm") == 0)
+ fprintf(prn_stream, "%c41\'t", LIPS_CSI); /* GlossyFile mode (for LBP-2160) */
}
if (ptype == LIPS4 || ptype == BJC880J) {
- if (lips4->ManualFeed ||
- (strcmp(lips4->mediaType, "PlainPaper") != 0 && strcmp(lips4->mediaType, LIPS_MEDIATYPE_DEFAULT) != 0)) {
- if (lips->prev_feed_mode != 10)
- fprintf(prn_stream, "%c10q", LIPS_CSI);
- lips->prev_feed_mode = 10;
- } else {
- if (lips->prev_feed_mode != lips->cassetFeed)
- fprintf(prn_stream, "%c%dq", LIPS_CSI, lips->cassetFeed);
- lips->prev_feed_mode = lips->cassetFeed;
- }
+ if (lips4->ManualFeed ||
+ (strcmp(lips4->mediaType, "PlainPaper") != 0 && strcmp(lips4->mediaType, LIPS_MEDIATYPE_DEFAULT) != 0)) {
+ if (lips->prev_feed_mode != 10)
+ fprintf(prn_stream, "%c10q", LIPS_CSI);
+ lips->prev_feed_mode = 10;
+ } else {
+ if (lips->prev_feed_mode != lips->cassetFeed)
+ fprintf(prn_stream, "%c%dq", LIPS_CSI, lips->cassetFeed);
+ lips->prev_feed_mode = lips->cassetFeed;
+ }
} else if (lips->ManualFeed) { /* Use ManualFeed */
- if (lips->prev_feed_mode != 1)
- fprintf(prn_stream, "%c1q", LIPS_CSI);
- lips->prev_feed_mode = 1;
+ if (lips->prev_feed_mode != 1)
+ fprintf(prn_stream, "%c1q", LIPS_CSI);
+ lips->prev_feed_mode = 1;
} else {
- if (lips->prev_feed_mode != lips->cassetFeed)
- fprintf(prn_stream, "%c%dq", LIPS_CSI, lips->cassetFeed);
- lips->prev_feed_mode = lips->cassetFeed;
+ if (lips->prev_feed_mode != lips->cassetFeed)
+ fprintf(prn_stream, "%c%dq", LIPS_CSI, lips->cassetFeed);
+ lips->prev_feed_mode = lips->cassetFeed;
}
/* Use Verious Paper Size */
@@ -1066,140 +1059,140 @@ lips_job_start(gx_device_printer * pdev, lips_printer_type ptype, FILE * prn_str
prev_paper_height = lips->prev_paper_height;
if (prev_paper_size != paper_size) {
- if (paper_size == USER_SIZE) {
- fprintf(prn_stream, "%c2 I", LIPS_CSI);
- fprintf(prn_stream, "%c80;%d;%dp", LIPS_CSI,
- width * 10, height * 10);
- } else if (paper_size == USER_SIZE + LANDSCAPE) {
- fprintf(prn_stream, "%c2 I", LIPS_CSI);
- fprintf(prn_stream, "%c81;%d;%dp", LIPS_CSI,
- height * 10, width * 10);
- } else {
- fprintf(prn_stream, "%c%dp", LIPS_CSI, paper_size);
- }
+ if (paper_size == USER_SIZE) {
+ fprintf(prn_stream, "%c2 I", LIPS_CSI);
+ fprintf(prn_stream, "%c80;%d;%dp", LIPS_CSI,
+ width * 10, height * 10);
+ } else if (paper_size == USER_SIZE + LANDSCAPE) {
+ fprintf(prn_stream, "%c2 I", LIPS_CSI);
+ fprintf(prn_stream, "%c81;%d;%dp", LIPS_CSI,
+ height * 10, width * 10);
+ } else {
+ fprintf(prn_stream, "%c%dp", LIPS_CSI, paper_size);
+ }
} else if (paper_size == USER_SIZE) {
- if (prev_paper_width != width ||
- prev_paper_height != height) {
- fprintf(prn_stream, "%c2 I", LIPS_CSI);
- fprintf(prn_stream, "%c80;%d;%dp", LIPS_CSI,
- width * 10, height * 10);
- }
+ if (prev_paper_width != width ||
+ prev_paper_height != height) {
+ fprintf(prn_stream, "%c2 I", LIPS_CSI);
+ fprintf(prn_stream, "%c80;%d;%dp", LIPS_CSI,
+ width * 10, height * 10);
+ }
} else if (paper_size == USER_SIZE + LANDSCAPE) {
- if (prev_paper_width != width ||
- prev_paper_height != height) {
- fprintf(prn_stream, "%c2 I", LIPS_CSI);
- fprintf(prn_stream, "%c81;%d;%dp", LIPS_CSI,
- height * 10, width * 10);
- }
+ if (prev_paper_width != width ||
+ prev_paper_height != height) {
+ fprintf(prn_stream, "%c2 I", LIPS_CSI);
+ fprintf(prn_stream, "%c81;%d;%dp", LIPS_CSI,
+ height * 10, width * 10);
+ }
}
/* desired number of copies */
if (num_copies > 255)
- num_copies = 255;
+ num_copies = 255;
if (lips->prev_num_copies != num_copies) {
- fprintf(prn_stream, "%c%dv", LIPS_CSI, num_copies);
- lips->prev_num_copies = num_copies;
+ fprintf(prn_stream, "%c%dv", LIPS_CSI, num_copies);
+ lips->prev_num_copies = num_copies;
}
if (ptype == LIPS4) {
- if (lips4->faceup)
- fprintf(prn_stream, "%c11;12;12~", LIPS_CSI);
+ if (lips4->faceup)
+ fprintf(prn_stream, "%c11;12;12~", LIPS_CSI);
}
if (ptype == LIPS4) {
- if (pdev->PageCount == 0) {
- /* N-up Printing */
- if (lips4->nup != 1) {
- fprintf(prn_stream, "%c%d1;;%do", LIPS_CSI, lips4->nup, paper_size);
- }
- }
- /* Duplex mode */
- {
- bool dup = lips4->Duplex;
- int dupset = lips4->Duplex_set;
- bool tum = lips4->Tumble;
-
- if (dupset && dup) {
- if (lips4->prev_duplex_mode == 0 ||
- lips4->prev_duplex_mode == 1)
- fprintf(prn_stream, "%c2;#x", LIPS_CSI); /* duplex */
- if (!tum) {
- /* long edge binding */
- if (lips4->prev_duplex_mode != 2)
- fprintf(prn_stream, "%c0;#w", LIPS_CSI);
- lips4->prev_duplex_mode = 2;
- } else {
- /* short edge binding */
- if (lips4->prev_duplex_mode != 3)
- fprintf(prn_stream, "%c2;#w", LIPS_CSI);
- lips4->prev_duplex_mode = 3;
- }
- } else if (dupset && !dup) {
- if (lips4->prev_duplex_mode != 1)
- fprintf(prn_stream, "%c0;#x", LIPS_CSI); /* simplex */
- lips4->prev_duplex_mode = 1;
- }
- }
+ if (pdev->PageCount == 0) {
+ /* N-up Printing */
+ if (lips4->nup != 1) {
+ fprintf(prn_stream, "%c%d1;;%do", LIPS_CSI, lips4->nup, paper_size);
+ }
+ }
+ /* Duplex mode */
+ {
+ bool dup = lips4->Duplex;
+ int dupset = lips4->Duplex_set;
+ bool tum = lips4->Tumble;
+
+ if (dupset && dup) {
+ if (lips4->prev_duplex_mode == 0 ||
+ lips4->prev_duplex_mode == 1)
+ fprintf(prn_stream, "%c2;#x", LIPS_CSI); /* duplex */
+ if (!tum) {
+ /* long edge binding */
+ if (lips4->prev_duplex_mode != 2)
+ fprintf(prn_stream, "%c0;#w", LIPS_CSI);
+ lips4->prev_duplex_mode = 2;
+ } else {
+ /* short edge binding */
+ if (lips4->prev_duplex_mode != 3)
+ fprintf(prn_stream, "%c2;#w", LIPS_CSI);
+ lips4->prev_duplex_mode = 3;
+ }
+ } else if (dupset && !dup) {
+ if (lips4->prev_duplex_mode != 1)
+ fprintf(prn_stream, "%c0;#x", LIPS_CSI); /* simplex */
+ lips4->prev_duplex_mode = 1;
+ }
+ }
}
if (pdev->PageCount == 0) {
- /* Display text on printer panel */
- fprintf(prn_stream, "%c2y%s%c", LIPS_DCS, lips->Username, LIPS_ST);
+ /* Display text on printer panel */
+ fprintf(prn_stream, "%c2y%s%c", LIPS_DCS, lips->Username, LIPS_ST);
- fprintf(prn_stream, "%c11h", LIPS_CSI); /* Size Unit Mode */
+ fprintf(prn_stream, "%c11h", LIPS_CSI); /* Size Unit Mode */
- fprintf(prn_stream, "%c?2;3h", LIPS_CSI);
- /* 2: Disable Auto FF */
- /* 3: Disable Auto CAP Movement */
+ fprintf(prn_stream, "%c?2;3h", LIPS_CSI);
+ /* 2: Disable Auto FF */
+ /* 3: Disable Auto CAP Movement */
- fprintf(prn_stream, "%c?1;4;5;6l", LIPS_CSI);
- /* 1: Disable Auto NF */
- /* 4: Disable Auto LF at CR */
- /* 5: Disable Auto CR at LF */
- /* 6: Disable Auto CR at FF */
+ fprintf(prn_stream, "%c?1;4;5;6l", LIPS_CSI);
+ /* 1: Disable Auto NF */
+ /* 4: Disable Auto LF at CR */
+ /* 5: Disable Auto CR at LF */
+ /* 6: Disable Auto CR at FF */
}
if (prev_paper_size != paper_size || paper_size == USER_SIZE ||
- paper_size == USER_SIZE + LANDSCAPE) {
- if (ptype == LIPS4 || ptype == BJC880J) {
- fprintf(prn_stream, "%c?7;%d I", LIPS_CSI,
- (int)pdev->x_pixels_per_inch); /* SelectSizeUnit */
- } else {
- fprintf(prn_stream, "%c7 I", LIPS_CSI); /* SelectSizeUnit */
- }
-
- if (ptype == LIPS4 || ptype == BJC880J)
- {
- if (pdev->color_info.depth == 24)
- fprintf(prn_stream, "%c%d G", LIPS_CSI, NUM_LINES_4C); /* VMI (dots) */
- else
- fprintf(prn_stream, "%c%d G", LIPS_CSI, NUM_LINES); /* VMI (dots) */
- }
+ paper_size == USER_SIZE + LANDSCAPE) {
+ if (ptype == LIPS4 || ptype == BJC880J) {
+ fprintf(prn_stream, "%c?7;%d I", LIPS_CSI,
+ (int)pdev->x_pixels_per_inch); /* SelectSizeUnit */
+ } else {
+ fprintf(prn_stream, "%c7 I", LIPS_CSI); /* SelectSizeUnit */
+ }
+
+ if (ptype == LIPS4 || ptype == BJC880J)
+ {
+ if (pdev->color_info.depth == 24)
+ fprintf(prn_stream, "%c%d G", LIPS_CSI, NUM_LINES_4C); /* VMI (dots) */
+ else
+ fprintf(prn_stream, "%c%d G", LIPS_CSI, NUM_LINES); /* VMI (dots) */
+ }
}
if (prev_paper_size != paper_size) {
- /* Top Margin: 63/300 inch + 5 mm */
- tm = (63. / 300. + 5. / MMETER_PER_INCH - dev_t_margin(pdev)) * pdev->x_pixels_per_inch;
- if (tm > 0)
- fprintf(prn_stream, "%c%dk", LIPS_CSI, tm);
- if (tm < 0)
- fprintf(prn_stream, "%c%de", LIPS_CSI, -tm);
-
- /* Left Margin: 5 mm left */
- lm = (5. / MMETER_PER_INCH - dev_l_margin(pdev)) * pdev->x_pixels_per_inch;
- if (lm > 0)
- fprintf(prn_stream, "%c%dj", LIPS_CSI, lm);
- if (lm < 0)
- fprintf(prn_stream, "%c%da", LIPS_CSI, -lm);
-
- /* Set Top/Left Margins */
- fprintf(prn_stream, "%c0;2t", LIPS_CSI);
-
- /* Bottom Margin: height */
- bm = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * pdev->y_pixels_per_inch;
- fprintf(prn_stream, "%c%de", LIPS_CSI, bm);
- /* Right Margin: width */
- rm = pdev->width - (dev_l_margin(pdev) + dev_r_margin(pdev)) * pdev->x_pixels_per_inch;
- fprintf(prn_stream, "%c%da", LIPS_CSI, rm);
- fprintf(prn_stream, "%c1;3t", LIPS_CSI);
-
- /* move CAP to (0, 0) */
- fprintf(prn_stream, "%c%dk\r", LIPS_CSI, bm);
+ /* Top Margin: 63/300 inch + 5 mm */
+ tm = (63. / 300. + 5. / MMETER_PER_INCH - dev_t_margin(pdev)) * pdev->x_pixels_per_inch;
+ if (tm > 0)
+ fprintf(prn_stream, "%c%dk", LIPS_CSI, tm);
+ if (tm < 0)
+ fprintf(prn_stream, "%c%de", LIPS_CSI, -tm);
+
+ /* Left Margin: 5 mm left */
+ lm = (5. / MMETER_PER_INCH - dev_l_margin(pdev)) * pdev->x_pixels_per_inch;
+ if (lm > 0)
+ fprintf(prn_stream, "%c%dj", LIPS_CSI, lm);
+ if (lm < 0)
+ fprintf(prn_stream, "%c%da", LIPS_CSI, -lm);
+
+ /* Set Top/Left Margins */
+ fprintf(prn_stream, "%c0;2t", LIPS_CSI);
+
+ /* Bottom Margin: height */
+ bm = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * pdev->y_pixels_per_inch;
+ fprintf(prn_stream, "%c%de", LIPS_CSI, bm);
+ /* Right Margin: width */
+ rm = pdev->width - (dev_l_margin(pdev) + dev_r_margin(pdev)) * pdev->x_pixels_per_inch;
+ fprintf(prn_stream, "%c%da", LIPS_CSI, rm);
+ fprintf(prn_stream, "%c1;3t", LIPS_CSI);
+
+ /* move CAP to (0, 0) */
+ fprintf(prn_stream, "%c%dk\r", LIPS_CSI, bm);
}
lips->prev_paper_size = paper_size;
lips->prev_paper_width = width;
@@ -1220,32 +1213,29 @@ lips_delta_encode(byte * inBuff, byte * prevBuff, byte * outBuff, byte * diffBuf
{
int i, j, k, com_size;
-
-
com_size = lips_delta_compress(inBuff, prevBuff, diffBuff, Length);
if (com_size < 0) { /* data is white raster */
- *outBuff = 0x01;
- *(outBuff + 1) = 0000;
- for (k = 0; k < Length; k++)
- *(prevBuff + k) = 0000;
- return 2;
+ *outBuff = 0x01;
+ *(outBuff + 1) = 0000;
+ for (k = 0; k < Length; k++)
+ *(prevBuff + k) = 0000;
+ return 2;
} else if (com_size == 0) { /* data is the same raster */
- *outBuff = 0000;
- return 1;
+ *outBuff = 0000;
+ return 1;
}
for (i = 0; i < com_size / 255; i++) {
- *(outBuff + i) = 0377;
+ *(outBuff + i) = 0377;
}
*(outBuff + i) = (byte) (com_size % 255);
for (j = 0; j < com_size; j++) {
- *(outBuff + i + j + 1) = *(diffBuff + j);
+ *(outBuff + i + j + 1) = *(diffBuff + j);
}
for (k = 0; k < Length; k++)
- *(prevBuff + k) = *(inBuff + k);
-
+ *(prevBuff + k) = *(inBuff + k);
return i + j + 1;
}
@@ -1262,85 +1252,85 @@ lips_delta_compress(byte * inBuff, byte * prevBuff, byte * diffBuff, int Length)
int offset = 0;
for (i = 0; i < Length; i++) {
- if (*(inBuff + i) != 0x00)
- zero_flag = FALSE;
-
- /* Compare Buffer */
- if (*(inBuff + i) != *(prevBuff + i)) {
- num_bytes++;
-
- if (same_flag == TRUE) {
- /* first byte is offset */
- if (offset > 31)
- *(diffBuff + size) = 0037;
- else
- *(diffBuff + size) = offset;
-
- size++;
- num_commandbyte++;
-
- for (j = 0; j < (offset - 31) / 255; j++) {
- *(diffBuff + size) = 0377;
- size++;
- num_commandbyte++;
- }
-
- if ((offset - 31) % 255 >= 0) {
- *(diffBuff + size) = (offset - 31) % 255;
- size++;
- num_commandbyte++;
- }
- same_flag = FALSE;
-
- }
- } else {
- same_flag = TRUE;
- offset++;
- }
-
- if (num_bytes > 8) {
- /* write number of data for replace */
- *(diffBuff + size - num_commandbyte)
- = *(diffBuff + size - num_commandbyte) | 0340;
-
- for (j = 0; j < 8; j++, size++) {
- *(diffBuff + size) = *(inBuff + i + j - 8);
- }
-
- /* offset is 0 */
- *(diffBuff + size) = 0000;
- size++;
-
- num_bytes = 1;
- same_flag = FALSE;
- num_commandbyte = 1;
- } else if (same_flag == true && num_bytes > 0) {
- offset = 1;
-
- /* write number of data for replace */
- *(diffBuff + size - num_commandbyte)
- = *(diffBuff + size - num_commandbyte) | ((num_bytes - 1) << 5);
-
- /* write a different bytes */
- for (j = 0; j < num_bytes; j++, size++) {
- *(diffBuff + size) = *(inBuff + i + j - num_bytes);
- }
- num_bytes = 0;
- num_commandbyte = 0;
- }
+ if (*(inBuff + i) != 0x00)
+ zero_flag = FALSE;
+
+ /* Compare Buffer */
+ if (*(inBuff + i) != *(prevBuff + i)) {
+ num_bytes++;
+
+ if (same_flag == TRUE) {
+ /* first byte is offset */
+ if (offset > 31)
+ *(diffBuff + size) = 0037;
+ else
+ *(diffBuff + size) = offset;
+
+ size++;
+ num_commandbyte++;
+
+ for (j = 0; j < (offset - 31) / 255; j++) {
+ *(diffBuff + size) = 0377;
+ size++;
+ num_commandbyte++;
+ }
+
+ if ((offset - 31) % 255 >= 0) {
+ *(diffBuff + size) = (offset - 31) % 255;
+ size++;
+ num_commandbyte++;
+ }
+ same_flag = FALSE;
+
+ }
+ } else {
+ same_flag = TRUE;
+ offset++;
+ }
+
+ if (num_bytes > 8) {
+ /* write number of data for replace */
+ *(diffBuff + size - num_commandbyte)
+ = *(diffBuff + size - num_commandbyte) | 0340;
+
+ for (j = 0; j < 8; j++, size++) {
+ *(diffBuff + size) = *(inBuff + i + j - 8);
+ }
+
+ /* offset is 0 */
+ *(diffBuff + size) = 0000;
+ size++;
+
+ num_bytes = 1;
+ same_flag = FALSE;
+ num_commandbyte = 1;
+ } else if (same_flag == true && num_bytes > 0) {
+ offset = 1;
+
+ /* write number of data for replace */
+ *(diffBuff + size - num_commandbyte)
+ = *(diffBuff + size - num_commandbyte) | ((num_bytes - 1) << 5);
+
+ /* write a different bytes */
+ for (j = 0; j < num_bytes; j++, size++) {
+ *(diffBuff + size) = *(inBuff + i + j - num_bytes);
+ }
+ num_bytes = 0;
+ num_commandbyte = 0;
+ }
}
if (num_bytes > 0) {
- /* write number of data for replace */
- *(diffBuff + size - num_commandbyte)
- = *(diffBuff + size - num_commandbyte) | ((num_bytes - 1) << 5);
+ /* write number of data for replace */
+ *(diffBuff + size - num_commandbyte)
+ = *(diffBuff + size - num_commandbyte) | ((num_bytes - 1) << 5);
- for (j = 0; j < num_bytes; j++, size++) {
- *(diffBuff + size) = *(inBuff + i + j - num_bytes);
- }
+ for (j = 0; j < num_bytes; j++, size++) {
+ *(diffBuff + size) = *(inBuff + i + j - num_bytes);
+ }
}
if (zero_flag)
- return -1;
+ return -1;
return size;
}
@@ -1352,7 +1342,7 @@ lips_byte_cat(byte * TotalBuff, byte * Buff, int TotalLen, int Len)
int i;
for (i = 0; i < Len; i++)
- *(TotalBuff + TotalLen + i) = *(Buff + i);
+ *(TotalBuff + TotalLen + i) = *(Buff + i);
return TotalLen + Len;
}
diff --git a/gs/contrib/lips4/gdevl4v.c b/gs/contrib/lips4/gdevl4v.c
index e4df5dd96..457a3df30 100644
--- a/gs/contrib/lips4/gdevl4v.c
+++ b/gs/contrib/lips4/gdevl4v.c
@@ -28,7 +28,6 @@
Hi-level bitmap imaging ¤Î»ÅÍͤ¬ÊѤï¤Ã¤Æ¤¤¤Þ¤¹¡£
Ghostscript 6.0 ¤Ç¤Ï¹¹¤Ë text_begin ¤È¤¤¤¦ API ¤¬Äɲ䵤ì¤ë¤è¤¦¤Ç¤¹¡£
-
¡ûGhostscript 5.10/5.50 ¤Î¥Ð¥°¤Ë¤Ä¤¤¤Æ
Ghostscript 5.10/5.50 ¤Î Vector driver ¤Î setlinewidth ´Ø¿ô¤Ë¤Ï
@@ -46,7 +45,6 @@
fill_trapezoid¡¢fill_parallelogram¡¢fill_triangle
¤Î´Ø¿ô¤ÎµóÆ°¤¬ÊѤˤʤ뤳¤È¤¬¤¢¤Ã¤¿¤Î¤Ç¤³¤ì¤é¤Ï»È¤Ã¤Æ¤¤¤Þ¤»¤ó¡£
-
¡û LIPS IV ¤Î¥Ð¥°¤Ë¤Ä¤¤¤Æ
¤³¤Î¥É¥é¥¤¥Ð¤Ï³«È¯Ãæ¤Ëȯ¸«¤·¤¿¼¡¤Î LIPS IV ¤Î¥Ð¥°¤ò²óÈò¤·¤Æ¤¤¤Þ¤¹¡£
@@ -58,7 +56,6 @@
2. ¤Ï¥¤¥á¡¼¥¸Îΰè³ÎÊÝÌ¿Îá¤Çʬ³ä¤ò»ØÄꤹ¤ë¤³¤È¤Ë¤è¤ê²óÈò¤·¤Þ¤·¤¿¡£
3. ¤Ï¥¯¥ê¥Ã¥Ô¥ó¥°Ì¿Îá¤ò»È¤ï¤Ê¤¤¤³¤È¤Ë¤·¤Æ²óÈò¤·¤Þ¤·¤¿¡£
-
¡û LIPS IV ¤Î»ÅÍͤˤĤ¤¤Æ
1. ñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá¤Ï¥°¥ì¡¼¥¹¥±¡¼¥ë¥¤¥á¡¼¥¸¤ËÂФ·¤Æ¤â
@@ -101,7 +98,6 @@ static dev_proc_get_params(lips4v_get_params);
static dev_proc_fill_mask(lips4v_fill_mask);
static dev_proc_begin_image(lips4v_begin_image);
-
#define X_DPI 600
#define Y_DPI 600
@@ -136,9 +132,9 @@ typedef struct gx_device_lips4v_s
gx_device_lips4v;
gs_public_st_suffix_add0_final(st_device_lips4v, gx_device_lips4v,
- "gx_device_lips4v", device_lips4v_enum_ptrs,
- device_lips4v_reloc_ptrs, gx_device_finalize,
- st_device_vector);
+ "gx_device_lips4v", device_lips4v_enum_ptrs,
+ device_lips4v_reloc_ptrs, gx_device_finalize,
+ st_device_vector);
#define lips_device_full_body(dtype, pprocs, dname, stype, w, h, xdpi, ydpi, ncomp, depth, mg, mc, dg, dc, lm, bm, rm, tm)\
std_device_part1_(dtype, pprocs, dname, stype, open_init_closed),\
@@ -149,55 +145,54 @@ gs_public_st_suffix_add0_final(st_device_lips4v, gx_device_lips4v,
#define lips4v_device_body\
lips_device_full_body(gx_device_lips4v, 0, "lips4v",\
- &st_device_lips4v,\
- DEFAULT_WIDTH_10THS * X_DPI / 10,\
- DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
- X_DPI, Y_DPI,\
- 1, 8, 1000, 1000, 5, 2,\
- LIPS4_LEFT_MARGIN_DEFAULT,\
- LIPS4_BOTTOM_MARGIN_DEFAULT,\
- LIPS4_RIGHT_MARGIN_DEFAULT,\
- LIPS4_TOP_MARGIN_DEFAULT)
-
+ &st_device_lips4v,\
+ DEFAULT_WIDTH_10THS * X_DPI / 10,\
+ DEFAULT_HEIGHT_10THS * Y_DPI / 10,\
+ X_DPI, Y_DPI,\
+ 1, 8, 1000, 1000, 5, 2,\
+ LIPS4_LEFT_MARGIN_DEFAULT,\
+ LIPS4_BOTTOM_MARGIN_DEFAULT,\
+ LIPS4_RIGHT_MARGIN_DEFAULT,\
+ LIPS4_TOP_MARGIN_DEFAULT)
#define lips4v_procs\
- { lips4v_open,\
- gx_upright_get_initial_matrix,\
- NULL, /* sync_output */\
- lips4v_output_page,\
- lips4v_close,\
- gx_default_gray_map_rgb_color,\
- gx_default_gray_map_color_rgb,\
- gdev_vector_fill_rectangle,\
- NULL, /* tile_rectangle */\
- lips4v_copy_mono,\
- lips4v_copy_color,\
- NULL, /* draw_line */\
- NULL, /* get_bits */\
- lips4v_get_params,\
- lips4v_put_params,\
- NULL, /* map_cmyk_color */\
- NULL, /* get_xfont_procs */\
- NULL, /* get_xfont_device */\
- NULL, /* map_rgb_alpha_color */\
- gx_page_device_get_page_device,\
- NULL, /* get_alpha_bits */\
- NULL, /* copy_alpha */\
- NULL, /* get_band */\
- NULL, /* copy_rop */\
- gdev_vector_fill_path,\
- gdev_vector_stroke_path,\
- lips4v_fill_mask,\
- gdev_vector_fill_trapezoid,\
- gdev_vector_fill_parallelogram,\
- gdev_vector_fill_triangle,\
- NULL /****** WRONG ******/, /* draw_thin_line */\
- lips4v_begin_image,\
- NULL,\
- NULL,\
- NULL, /* strip_tile_rectangle */\
- NULL/******strip_copy_rop******/\
- }
+ { lips4v_open,\
+ gx_upright_get_initial_matrix,\
+ NULL, /* sync_output */\
+ lips4v_output_page,\
+ lips4v_close,\
+ gx_default_gray_map_rgb_color,\
+ gx_default_gray_map_color_rgb,\
+ gdev_vector_fill_rectangle,\
+ NULL, /* tile_rectangle */\
+ lips4v_copy_mono,\
+ lips4v_copy_color,\
+ NULL, /* draw_line */\
+ NULL, /* get_bits */\
+ lips4v_get_params,\
+ lips4v_put_params,\
+ NULL, /* map_cmyk_color */\
+ NULL, /* get_xfont_procs */\
+ NULL, /* get_xfont_device */\
+ NULL, /* map_rgb_alpha_color */\
+ gx_page_device_get_page_device,\
+ NULL, /* get_alpha_bits */\
+ NULL, /* copy_alpha */\
+ NULL, /* get_band */\
+ NULL, /* copy_rop */\
+ gdev_vector_fill_path,\
+ gdev_vector_stroke_path,\
+ lips4v_fill_mask,\
+ gdev_vector_fill_trapezoid,\
+ gdev_vector_fill_parallelogram,\
+ gdev_vector_fill_triangle,\
+ NULL /****** WRONG ******/, /* draw_thin_line */\
+ lips4v_begin_image,\
+ NULL,\
+ NULL,\
+ NULL, /* strip_tile_rectangle */\
+ NULL/******strip_copy_rop******/\
+ }
gx_device_lips4v far_data gs_lips4v_device = {
lips4v_device_body,
@@ -233,69 +228,69 @@ gx_device_lips4v far_data gs_lips4v_device = {
#if GS_VERSION_MAJOR >= 8
static int lips4v_beginpage(gx_device_vector * vdev);
static int lips4v_setfillcolor(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc);
+ const gx_drawing_color * pdc);
static int lips4v_setstrokecolor(gx_device_vector * vdev, const gs_imager_state * pis,
- const gx_drawing_color * pdc);
+ const gx_drawing_color * pdc);
static int lips4v_setdash(gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset);
+ uint count, floatp offset);
static int lips4v_setflat(gx_device_vector * vdev, floatp flatness);
static int
lips4v_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff);
-static int lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
+ gs_logical_operation_t diff);
+static int lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis,
const gx_drawing_color * pdc);
static int
lips4v_beginpath(gx_device_vector * vdev, gx_path_type_t type);
static int
lips4v_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type);
+ floatp y, gx_path_type_t type);
static int
lips4v_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type);
+ floatp y, gx_path_type_t type);
static int
lips4v_curveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x1,
- floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type);
+ floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type);
static int
lips4v_closepath(gx_device_vector * vdev, floatp x, floatp y, floatp x_start,
- floatp y_start, gx_path_type_t type);
+ floatp y_start, gx_path_type_t type);
static int lips4v_endpath(gx_device_vector * vdev, gx_path_type_t type);
#else
static int lips4v_beginpage(P1(gx_device_vector * vdev));
static int lips4v_setfillcolor(P2(gx_device_vector * vdev,
- const gx_drawing_color * pdc));
+ const gx_drawing_color * pdc));
static int lips4v_setstrokecolor(P2(gx_device_vector * vdev,
- const gx_drawing_color * pdc));
+ const gx_drawing_color * pdc));
static int lips4v_setdash(P4(gx_device_vector * vdev, const float *pattern,
- uint count, floatp offset));
+ uint count, floatp offset));
static int lips4v_setflat(P2(gx_device_vector * vdev, floatp flatness));
static int
lips4v_setlogop(P3
- (gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff));
+ (gx_device_vector * vdev, gs_logical_operation_t lop,
+ gs_logical_operation_t diff));
static int
lips4v_beginpath(P2(gx_device_vector * vdev, gx_path_type_t type));
static int
lips4v_moveto(P6
- (gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type));
+ (gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
+ floatp y, gx_path_type_t type));
static int
lips4v_lineto(P6
- (gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type));
+ (gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
+ floatp y, gx_path_type_t type));
static int
lips4v_curveto(P10
- (gx_device_vector * vdev, floatp x0, floatp y0, floatp x1,
- floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
- gx_path_type_t type));
+ (gx_device_vector * vdev, floatp x0, floatp y0, floatp x1,
+ floatp y1, floatp x2, floatp y2, floatp x3, floatp y3,
+ gx_path_type_t type));
static int
lips4v_closepath(P6
- (gx_device_vector * vdev, floatp x, floatp y, floatp x_start,
- floatp y_start, gx_path_type_t type));
+ (gx_device_vector * vdev, floatp x, floatp y, floatp x_start,
+ floatp y_start, gx_path_type_t type));
static int lips4v_endpath(P2(gx_device_vector * vdev, gx_path_type_t type));
#endif
@@ -340,7 +335,6 @@ static const char *l4v_file_header2 = "@PJL SET LPARM : LIPS SW2 = ON\n";
static const char *l4v_file_header3 = "@PJL ENTER LANGUAGE = LIPS\n";
static const char *l4v_file_header4 = "\033%@\033P41;";
-
static const char *l4vmono_file_header =
";1J" L4VMONO_STRING LIPS_VERSION "\033\\\033[0\"p\033<";
@@ -359,24 +353,24 @@ lips_param(int param, char *c)
bSign = TRUE;
if (param < 0) {
- bSign = FALSE;
- param = -param;
+ bSign = FALSE;
+ param = -param;
}
if (param < 16)
- i = 1;
+ i = 1;
else if (param < 1024)
- i = 2;
+ i = 2;
else if (param < 65536)
- i = 3;
+ i = 3;
else
- i = 4;
+ i = 4;
c[i] = '\0';
c[i - 1] = (param & 0x0f) | 0x20 | (bSign ? 0x10 : 0x00);
param >>= 4;
for (j = i - 2; j >= 0; j--) {
- c[j] = (param & 0x3f) | 0x40;
- param >>= 6;
+ c[j] = (param & 0x3f) | 0x40;
+ param >>= 6;
}
}
@@ -388,7 +382,7 @@ sput_lips_int(stream * s, int param)
lips_param(param, c);
for (i = 0; i < strlen(c); i++)
- sputc(s, c[i]);
+ sputc(s, c[i]);
}
/* Put a string on a stream.
@@ -430,29 +424,28 @@ lips4v_range_check(gx_device * dev)
/* Paper Size Check */
if (width <= height) { /* portrait */
- if ((width < LIPS_WIDTH_MIN || width > LIPS_WIDTH_MAX ||
- height < LIPS_HEIGHT_MIN || height > LIPS_HEIGHT_MAX) &&
- !(width == LIPS_LEDGER_WIDTH && height == LIPS_LEDGER_HEIGHT))
- return_error(gs_error_rangecheck);
+ if ((width < LIPS_WIDTH_MIN || width > LIPS_WIDTH_MAX ||
+ height < LIPS_HEIGHT_MIN || height > LIPS_HEIGHT_MAX) &&
+ !(width == LIPS_LEDGER_WIDTH && height == LIPS_LEDGER_HEIGHT))
+ return_error(gs_error_rangecheck);
} else { /* landscape */
- if ((width < LIPS_HEIGHT_MIN || width > LIPS_HEIGHT_MAX ||
- height < LIPS_WIDTH_MIN || height > LIPS_WIDTH_MAX) &&
- !(width == LIPS_LEDGER_HEIGHT && height == LIPS_LEDGER_WIDTH))
- return_error(gs_error_rangecheck);
+ if ((width < LIPS_HEIGHT_MIN || width > LIPS_HEIGHT_MAX ||
+ height < LIPS_WIDTH_MIN || height > LIPS_WIDTH_MAX) &&
+ !(width == LIPS_LEDGER_HEIGHT && height == LIPS_LEDGER_WIDTH))
+ return_error(gs_error_rangecheck);
}
/* Resolution Check */
if (xdpi != ydpi)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
else {
- if ((xdpi < LIPS_DPI_MIN || xdpi > LIPS4_DPI_MAX)
- && xdpi != LIPS4_DPI_SUPERFINE) return_error(gs_error_rangecheck);
+ if ((xdpi < LIPS_DPI_MIN || xdpi > LIPS4_DPI_MAX)
+ && xdpi != LIPS4_DPI_SUPERFINE) return_error(gs_error_rangecheck);
}
return 0;
}
-
static void
lips4v_set_cap(gx_device * dev, int x, int y)
{
@@ -463,20 +456,19 @@ lips4v_set_cap(gx_device * dev, int x, int y)
int dx = x - pdev->prev_x;
int dy = y - pdev->prev_y;
-
if (dx > 0) {
- sprintf(cap, "%c%da", LIPS_CSI, dx);
- lputs(s, cap);
+ sprintf(cap, "%c%da", LIPS_CSI, dx);
+ lputs(s, cap);
} else if (dx < 0) {
- sprintf(cap, "%c%dj", LIPS_CSI, -dx);
- lputs(s, cap);
+ sprintf(cap, "%c%dj", LIPS_CSI, -dx);
+ lputs(s, cap);
}
if (dy > 0) {
- sprintf(cap, "%c%dk", LIPS_CSI, dy);
- lputs(s, cap);
+ sprintf(cap, "%c%dk", LIPS_CSI, dy);
+ lputs(s, cap);
} else if (dy < 0) {
- sprintf(cap, "%c%de", LIPS_CSI, -dy);
- lputs(s, cap);
+ sprintf(cap, "%c%de", LIPS_CSI, -dy);
+ lputs(s, cap);
}
pdev->prev_x = x;
pdev->prev_y = y;
@@ -487,7 +479,7 @@ lips4v_set_cap(gx_device * dev, int x, int y)
/* Font Downloading Routine */
static int
lips4v_copy_text_char(gx_device * dev, const byte * data,
- int raster, gx_bitmap_id id, int x, int y, int w, int h)
+ int raster, gx_bitmap_id id, int x, int y, int w, int h)
{
gx_device_lips4v *const pdev = (gx_device_lips4v *) dev;
stream *s = gdev_vector_stream((gx_device_vector *) dev);
@@ -500,132 +492,132 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
bool download = TRUE;
if (w > cell_length || h > cell_length || !pdev->FontDL)
- return -1;
+ return -1;
for (j = pdev->count - 1; j >= 0; j--) {
- if (pdev->id_table[j] == id)
- /* font is found */
- {
- download = FALSE;
- ccode = j;
- for (i = j; i < pdev->count - 1; i++) {
- pdev->id_cache[i] = pdev->id_cache[i + 1];
- }
- pdev->id_cache[pdev->count - 1] = id;
- break;
- }
+ if (pdev->id_table[j] == id)
+ /* font is found */
+ {
+ download = FALSE;
+ ccode = j;
+ for (i = j; i < pdev->count - 1; i++) {
+ pdev->id_cache[i] = pdev->id_cache[i + 1];
+ }
+ pdev->id_cache[pdev->count - 1] = id;
+ break;
+ }
}
if (download) {
- if (pdev->count > max_cached_chars - 1) {
- gx_bitmap_id tmpid = pdev->id_cache[0];
-
- for (j = pdev->count - 1; j >= 0; j--) {
- if (pdev->id_table[j] == tmpid) {
- ccode = j;
- break;
- }
- }
- for (i = j; i < pdev->count - 1; i++) {
- pdev->id_cache[i] = pdev->id_cache[i + 1];
- }
- pdev->id_cache[pdev->count - 1] = tmpid;
- } else {
- ccode = pdev->count;
- pdev->id_cache[pdev->count] = id;
- }
+ if (pdev->count > max_cached_chars - 1) {
+ gx_bitmap_id tmpid = pdev->id_cache[0];
+
+ for (j = pdev->count - 1; j >= 0; j--) {
+ if (pdev->id_table[j] == tmpid) {
+ ccode = j;
+ break;
+ }
+ }
+ for (i = j; i < pdev->count - 1; i++) {
+ pdev->id_cache[i] = pdev->id_cache[i + 1];
+ }
+ pdev->id_cache[pdev->count - 1] = tmpid;
+ } else {
+ ccode = pdev->count;
+ pdev->id_cache[pdev->count] = id;
+ }
}
if (pdev->TextMode == FALSE) {
- /* Text mode */
- lputs(s, "}p");
- sput_lips_int(s, x);
- sput_lips_int(s, y);
- sputc(s, LIPS_IS2);
- pdev->TextMode = TRUE;
- pdev->prev_x = x;
- pdev->prev_y = y;
+ /* Text mode */
+ lputs(s, "}p");
+ sput_lips_int(s, x);
+ sput_lips_int(s, y);
+ sputc(s, LIPS_IS2);
+ pdev->TextMode = TRUE;
+ pdev->prev_x = x;
+ pdev->prev_y = y;
} else
- lips4v_set_cap(dev, x, y);
+ lips4v_set_cap(dev, x, y);
if (download) {
- if (ccode % 128 == 0 && ccode == pdev->count) {
- /* ʸ»ú¥»¥Ã¥ÈÅÐÏ¿Êä½õÌ¿Îá */
- sprintf(cset_sub, "%c%dx%c", LIPS_DCS, ccode / 128, LIPS_ST);
- lputs(s, cset_sub);
- /* ʸ»ú¥»¥Ã¥ÈÅÐÏ¿Ì¿Îá */
- sprintf(cset,
- "%c%d;1;0;0;3840;8;400;100;0;0;200;%d;%d;0;0;;;;;%d.p",
- LIPS_CSI,
- size + 9, cell_length, /* Cell Width */
- cell_length, /* Cell Height */
- (int)dev->x_pixels_per_inch);
- lputs(s, cset);
- } else {
- /* 1ʸ»úÅÐÏ¿Ì¿Îá */
- sprintf(cset,
- "%c%d;%d;8;%d.q", LIPS_CSI,
- size + 9, ccode / 128, (int)dev->x_pixels_per_inch);
- lputs(s, cset);
- }
-
- /* ¥æ¡¼¥¶Ê¸»úÅÐÏ¿¥Ç¡¼¥¿ ¤Î¥Ø¥Ã¥À */
- sputc(s, ccode % 128); /* charcter code */
- put_int(s, w);
- put_int(s, 0);
- put_int(s, h);
- put_int(s, 0);
- for (i = h - 1; i >= 0; --i) {
- put_bytes(s, data + i * raster, width_bytes);
- }
+ if (ccode % 128 == 0 && ccode == pdev->count) {
+ /* ʸ»ú¥»¥Ã¥ÈÅÐÏ¿Êä½õÌ¿Îá */
+ sprintf(cset_sub, "%c%dx%c", LIPS_DCS, ccode / 128, LIPS_ST);
+ lputs(s, cset_sub);
+ /* ʸ»ú¥»¥Ã¥ÈÅÐÏ¿Ì¿Îá */
+ sprintf(cset,
+ "%c%d;1;0;0;3840;8;400;100;0;0;200;%d;%d;0;0;;;;;%d.p",
+ LIPS_CSI,
+ size + 9, cell_length, /* Cell Width */
+ cell_length, /* Cell Height */
+ (int)dev->x_pixels_per_inch);
+ lputs(s, cset);
+ } else {
+ /* 1ʸ»úÅÐÏ¿Ì¿Îá */
+ sprintf(cset,
+ "%c%d;%d;8;%d.q", LIPS_CSI,
+ size + 9, ccode / 128, (int)dev->x_pixels_per_inch);
+ lputs(s, cset);
+ }
+
+ /* ¥æ¡¼¥¶Ê¸»úÅÐÏ¿¥Ç¡¼¥¿ ¤Î¥Ø¥Ã¥À */
+ sputc(s, ccode % 128); /* charcter code */
+ put_int(s, w);
+ put_int(s, 0);
+ put_int(s, h);
+ put_int(s, 0);
+ for (i = h - 1; i >= 0; --i) {
+ put_bytes(s, data + i * raster, width_bytes);
+ }
}
/* ʸ»ú¥»¥Ã¥È¡¦¥¢¥µ¥¤¥óÈÖ¹æÁªÂòÌ¿Îá2 */
if (download) {
- if (pdev->current_font != ccode / 128) {
- sprintf(cset_number, "%c%d%%v", LIPS_CSI, ccode / 128);
- lputs(s, cset_number);
- pdev->current_font = ccode / 128;
- }
+ if (pdev->current_font != ccode / 128) {
+ sprintf(cset_number, "%c%d%%v", LIPS_CSI, ccode / 128);
+ lputs(s, cset_number);
+ pdev->current_font = ccode / 128;
+ }
} else {
- if (pdev->current_font != ccode / 128) {
- sprintf(cset_number, "%c%d%%v", LIPS_CSI, ccode / 128);
- lputs(s, cset_number);
- pdev->current_font = ccode / 128;
- }
+ if (pdev->current_font != ccode / 128) {
+ sprintf(cset_number, "%c%d%%v", LIPS_CSI, ccode / 128);
+ lputs(s, cset_number);
+ pdev->current_font = ccode / 128;
+ }
}
/* ¥«¥é¡¼ */
if (pdev->current_color != pdev->prev_color) {
- if (pdev->color_info.depth == 8) {
- sputc(s, LIPS_CSI);
- lputs(s, "?10;2;");
- sprintf(text_color, "%d",
- (int)(pdev->color_info.max_gray - pdev->current_color));
- } else {
- int r = (pdev->current_color >> 16) * 1000.0 / 255.0;
- int g = ((pdev->current_color >> 8) & 0xff) * 1000.0 / 255.0;
- int b = (pdev->current_color & 0xff) * 1000.0 / 255.0;
-
- sputc(s, LIPS_CSI);
- lputs(s, "?10;;");
- sprintf(text_color, "%d;%d;%d", r, g, b);
- }
- lputs(s, text_color);
- lputs(s, "%p");
- pdev->prev_color = pdev->current_color;
+ if (pdev->color_info.depth == 8) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "?10;2;");
+ sprintf(text_color, "%d",
+ (int)(pdev->color_info.max_gray - pdev->current_color));
+ } else {
+ int r = (pdev->current_color >> 16) * 1000.0 / 255.0;
+ int g = ((pdev->current_color >> 8) & 0xff) * 1000.0 / 255.0;
+ int b = (pdev->current_color & 0xff) * 1000.0 / 255.0;
+
+ sputc(s, LIPS_CSI);
+ lputs(s, "?10;;");
+ sprintf(text_color, "%d;%d;%d", r, g, b);
+ }
+ lputs(s, text_color);
+ lputs(s, "%p");
+ pdev->prev_color = pdev->current_color;
}
/* À©¸æʸ»ú°õ»úÌ¿Îá */
if (ccode % 128 == 0x00 ||
- (ccode % 128 >= 0x07 && ccode % 128 <= 0x0F) ||
- ccode % 128 == 0x1B) {
- sputc(s, LIPS_CSI);
- lputs(s, "1.v");
+ (ccode % 128 >= 0x07 && ccode % 128 <= 0x0F) ||
+ ccode % 128 == 0x1B) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "1.v");
}
sputc(s, ccode % 128);
if (download) {
- pdev->id_table[ccode] = id;
- if (pdev->count < max_cached_chars - 1)
- pdev->count++;
+ pdev->id_table[ccode] = id;
+ if (pdev->count < max_cached_chars - 1)
+ pdev->count++;
}
return 0;
}
@@ -636,64 +628,62 @@ reverse_buffer(byte * buf, int Len)
int i;
for (i = 0; i < Len; i++)
- *(buf + i) = ~*(buf + i);
+ *(buf + i) = ~*(buf + i);
}
static void
lips4v_write_image_data(gx_device_vector * vdev, byte * buf, int tbyte,
- int reverse)
+ int reverse)
{
stream *s = gdev_vector_stream(vdev);
byte *cbuf = gs_alloc_bytes(vdev->memory, tbyte * 3 / 2,
- "lips4v_write_image_data(cbuf)");
+ "lips4v_write_image_data(cbuf)");
byte *cbuf_rle = gs_alloc_bytes(vdev->memory, tbyte * 3,
- "lips4v_write_image_data(cbuf_rle)");
+ "lips4v_write_image_data(cbuf_rle)");
int Len, Len_rle;
if (reverse)
- reverse_buffer(buf, tbyte);
-
+ reverse_buffer(buf, tbyte);
Len = lips_packbits_encode(buf, cbuf, tbyte);
Len_rle = lips_rle_encode(buf, cbuf_rle, tbyte);
if (Len > tbyte && Len_rle > tbyte) {
- /* Not compress */
- lputs(s, "0");
- sput_lips_int(s, tbyte);
- sputc(s, LIPS_IS2);
+ /* Not compress */
+ lputs(s, "0");
+ sput_lips_int(s, tbyte);
+ sputc(s, LIPS_IS2);
- put_bytes(s, buf, tbyte);
+ put_bytes(s, buf, tbyte);
} else if (Len > Len_rle) {
- /* Use RunLength encode */
- lputs(s, ":");
- sput_lips_int(s, Len_rle);
- sputc(s, LIPS_IS2);
+ /* Use RunLength encode */
+ lputs(s, ":");
+ sput_lips_int(s, Len_rle);
+ sputc(s, LIPS_IS2);
- put_bytes(s, cbuf_rle, Len_rle);
+ put_bytes(s, cbuf_rle, Len_rle);
} else {
- /* Use PackBits encode */
- lputs(s, ";");
- sput_lips_int(s, Len);
- sputc(s, LIPS_IS2);
+ /* Use PackBits encode */
+ lputs(s, ";");
+ sput_lips_int(s, Len);
+ sputc(s, LIPS_IS2);
- put_bytes(s, cbuf, Len);
+ put_bytes(s, cbuf, Len);
}
gs_free_object(vdev->memory, cbuf, "lips4v_write_image_data(cbuf)");
gs_free_object(vdev->memory, cbuf_rle,
- "lips4v_write_image_data(cbuf_rle)");
+ "lips4v_write_image_data(cbuf_rle)");
}
-
/* ---------------- Vector device implementation ---------------- */
static int
lips4v_beginpage(gx_device_vector * vdev)
{ /*
- * We can't use gdev_vector_stream here, because this may be called
- * from there before in_page is set.
- */
+ * We can't use gdev_vector_stream here, because this may be called
+ * from there before in_page is set.
+ */
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
stream *s = vdev->strm;
int dpi = vdev->x_pixels_per_inch;
@@ -704,10 +694,10 @@ lips4v_beginpage(gx_device_vector * vdev)
char page_header[8], l4vmono_page_header[7], l4vcolor_page_header[7];
char duplex_char[6], tumble_char[6], toner_d[26], toner_s[5],
- nup_char[10];
+ nup_char[10];
char username[6 + LIPS_USERNAME_MAX], feedmode[5], paper[16],
- faceup_char[256];
+ faceup_char[256];
bool dup = pdev->Duplex;
int dupset = pdev->Duplex_set;
bool tum = pdev->Tumble;
@@ -715,183 +705,183 @@ lips4v_beginpage(gx_device_vector * vdev)
/* ¥Ù¥¯¥¿¡¦¥â¡¼¥É°Ü¹ÔÌ¿Îá CSI &} ¤ÏÊǤ´¤È¤Ëȯ¹Ô¤¹¤ë */
if (pdev->first_page) {
- if (pdev->pjl) {
- lputs(s, l4v_file_header1);
- if ((int)pdev->x_pixels_per_inch == 1200)
- lputs(s, "@PJL SET RESOLUTION = SUPERFINE\n");
- else if ((int)pdev->x_pixels_per_inch == 600)
- lputs(s, "@PJL SET RESOLUTION = FINE\n");
- else if ((int)pdev->x_pixels_per_inch == 300)
- lputs(s, "@PJL SET RESOLUTION = QUICK\n");
- lputs(s, l4v_file_header2);
- if (pdev->toner_density) {
- sprintf(toner_d, "@PJL SET TONER-DENSITY=%d\n",
- pdev->toner_density);
- lputs(s, toner_d);
- }
- if (pdev->toner_saving_set) {
- lputs(s, "@PJL SET TONER-SAVING=");
- if (pdev->toner_saving)
- sprintf(toner_s, "ON\n");
- else
- sprintf(toner_s, "OFF\n");
- lputs(s, toner_s);
- }
- lputs(s, l4v_file_header3);
- }
- lputs(s, l4v_file_header4);
-
- if (dpi > 9999)
- return_error(gs_error_rangecheck);
-
- /* set reaolution (dpi) */
- sprintf(dpi_char, "%d", dpi);
- lputs(s, dpi_char);
-
- if (pdev->color_info.depth == 8)
- lputs(s, l4vmono_file_header);
- else
- lputs(s, l4vcolor_file_header);
-
- /* username */
- sprintf(username, "%c2y%s%c", LIPS_DCS, pdev->Username, LIPS_ST);
- lputs(s, username);
+ if (pdev->pjl) {
+ lputs(s, l4v_file_header1);
+ if ((int)pdev->x_pixels_per_inch == 1200)
+ lputs(s, "@PJL SET RESOLUTION = SUPERFINE\n");
+ else if ((int)pdev->x_pixels_per_inch == 600)
+ lputs(s, "@PJL SET RESOLUTION = FINE\n");
+ else if ((int)pdev->x_pixels_per_inch == 300)
+ lputs(s, "@PJL SET RESOLUTION = QUICK\n");
+ lputs(s, l4v_file_header2);
+ if (pdev->toner_density) {
+ sprintf(toner_d, "@PJL SET TONER-DENSITY=%d\n",
+ pdev->toner_density);
+ lputs(s, toner_d);
+ }
+ if (pdev->toner_saving_set) {
+ lputs(s, "@PJL SET TONER-SAVING=");
+ if (pdev->toner_saving)
+ sprintf(toner_s, "ON\n");
+ else
+ sprintf(toner_s, "OFF\n");
+ lputs(s, toner_s);
+ }
+ lputs(s, l4v_file_header3);
+ }
+ lputs(s, l4v_file_header4);
+
+ if (dpi > 9999)
+ return_error(gs_error_rangecheck);
+
+ /* set reaolution (dpi) */
+ sprintf(dpi_char, "%d", dpi);
+ lputs(s, dpi_char);
+
+ if (pdev->color_info.depth == 8)
+ lputs(s, l4vmono_file_header);
+ else
+ lputs(s, l4vcolor_file_header);
+
+ /* username */
+ sprintf(username, "%c2y%s%c", LIPS_DCS, pdev->Username, LIPS_ST);
+ lputs(s, username);
}
if (strcmp(pdev->mediaType, "PlainPaper") == 0) {
- sputc(s, LIPS_CSI);
- lputs(s, "20\'t");
+ sputc(s, LIPS_CSI);
+ lputs(s, "20\'t");
}
else if (strcmp(pdev->mediaType, "OHP") == 0 ||
- strcmp(pdev->mediaType, "TransparencyFilm") == 0) {
- sputc(s, LIPS_CSI);
- lputs(s, "40\'t"); /* OHP mode (for LBP-2160) */
+ strcmp(pdev->mediaType, "TransparencyFilm") == 0) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "40\'t"); /* OHP mode (for LBP-2160) */
}
else if (strcmp(pdev->mediaType, "CardBoard") == 0) {
sputc(s, LIPS_CSI);
- lputs(s, "30\'t"); /* CardBoard mode (for LBP-2160) */
+ lputs(s, "30\'t"); /* CardBoard mode (for LBP-2160) */
}
else if (strcmp(pdev->mediaType, "GlossyFilm") == 0) {
sputc(s, LIPS_CSI);
- lputs(s, "41\'t"); /* GlossyFilm mode (for LBP-2160) */
+ lputs(s, "41\'t"); /* GlossyFilm mode (for LBP-2160) */
}
/* µë»æ¥â¡¼¥É */
if (pdev->ManualFeed ||
- (strcmp(pdev->mediaType, "PlainPaper") != 0
- && strcmp(pdev->mediaType, LIPS_MEDIATYPE_DEFAULT) != 0)) {
- /* Use ManualFeed */
- if (pdev->prev_feed_mode != 10) {
- sprintf(feedmode, "%c10q", LIPS_CSI);
- lputs(s, feedmode);
- pdev->prev_feed_mode = 10;
- }
+ (strcmp(pdev->mediaType, "PlainPaper") != 0
+ && strcmp(pdev->mediaType, LIPS_MEDIATYPE_DEFAULT) != 0)) {
+ /* Use ManualFeed */
+ if (pdev->prev_feed_mode != 10) {
+ sprintf(feedmode, "%c10q", LIPS_CSI);
+ lputs(s, feedmode);
+ pdev->prev_feed_mode = 10;
+ }
} else {
- if (pdev->prev_feed_mode != pdev->cassetFeed) {
- sprintf(feedmode, "%c%dq", LIPS_CSI, pdev->cassetFeed);
- lputs(s, feedmode);
- pdev->prev_feed_mode = pdev->cassetFeed;
- }
+ if (pdev->prev_feed_mode != pdev->cassetFeed) {
+ sprintf(feedmode, "%c%dq", LIPS_CSI, pdev->cassetFeed);
+ lputs(s, feedmode);
+ pdev->prev_feed_mode = pdev->cassetFeed;
+ }
}
paper_size = lips_media_selection(width, height);
/* Íѻ極¥¤¥º */
if (pdev->prev_paper_size != paper_size) {
- if (paper_size == USER_SIZE) {
- /* modified by shige 06/27 2003
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- /* modified by shige 11/09 2003
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
- (height * 10 > LIPS_HEIGHT_MAX_720)?
- LIPS_HEIGHT_MAX_720 : (height * 10),
- (width * 10 > LIPS_WIDTH_MAX_720)?
- LIPS_WIDTH_MAX_720 : (width * 10));
- lputs(s, paper);
- } else if (paper_size == USER_SIZE + LANDSCAPE) {
- /* modified by shige 06/27 2003
- sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- /* modified by shige 11/09 2003
- sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
- (width * 10 > LIPS_HEIGHT_MAX_720)?
- LIPS_HEIGHT_MAX_720 : (width * 10),
- (height * 10 > LIPS_WIDTH_MAX_720)?
- LIPS_WIDTH_MAX_720 : (height * 10));
- lputs(s, paper);
- } else {
- sprintf(paper, "%c%dp", LIPS_CSI, paper_size);
- lputs(s, paper);
- }
+ if (paper_size == USER_SIZE) {
+ /* modified by shige 06/27 2003
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ /* modified by shige 11/09 2003
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ (height * 10 > LIPS_HEIGHT_MAX_720)?
+ LIPS_HEIGHT_MAX_720 : (height * 10),
+ (width * 10 > LIPS_WIDTH_MAX_720)?
+ LIPS_WIDTH_MAX_720 : (width * 10));
+ lputs(s, paper);
+ } else if (paper_size == USER_SIZE + LANDSCAPE) {
+ /* modified by shige 06/27 2003
+ sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ /* modified by shige 11/09 2003
+ sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ (width * 10 > LIPS_HEIGHT_MAX_720)?
+ LIPS_HEIGHT_MAX_720 : (width * 10),
+ (height * 10 > LIPS_WIDTH_MAX_720)?
+ LIPS_WIDTH_MAX_720 : (height * 10));
+ lputs(s, paper);
+ } else {
+ sprintf(paper, "%c%dp", LIPS_CSI, paper_size);
+ lputs(s, paper);
+ }
} else if (paper_size == USER_SIZE) {
- if (pdev->prev_paper_width != width ||
- pdev->prev_paper_height != height)
- /* modified by shige 06/27 2003
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- /* modified by shige 11/09 2003
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
- (height * 10 > LIPS_HEIGHT_MAX_720)?
- LIPS_HEIGHT_MAX_720 : (height * 10),
- (width * 10 > LIPS_WIDTH_MAX_720)?
- LIPS_WIDTH_MAX_720 : (width * 10));
- lputs(s, paper);
+ if (pdev->prev_paper_width != width ||
+ pdev->prev_paper_height != height)
+ /* modified by shige 06/27 2003
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ /* modified by shige 11/09 2003
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ (height * 10 > LIPS_HEIGHT_MAX_720)?
+ LIPS_HEIGHT_MAX_720 : (height * 10),
+ (width * 10 > LIPS_WIDTH_MAX_720)?
+ LIPS_WIDTH_MAX_720 : (width * 10));
+ lputs(s, paper);
} else if (paper_size == USER_SIZE + LANDSCAPE) {
- if (pdev->prev_paper_width != width ||
- pdev->prev_paper_height != height)
- /* modified by shige 06/27 2003
- sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- /* modified by shige 11/09 2003
- sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
- (width * 10 > LIPS_HEIGHT_MAX_720)?
- LIPS_HEIGHT_MAX_720 : (width * 10),
- (height * 10 > LIPS_WIDTH_MAX_720)?
- LIPS_WIDTH_MAX_720 : (height * 10));
- lputs(s, paper);
+ if (pdev->prev_paper_width != width ||
+ pdev->prev_paper_height != height)
+ /* modified by shige 06/27 2003
+ sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ /* modified by shige 11/09 2003
+ sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ (width * 10 > LIPS_HEIGHT_MAX_720)?
+ LIPS_HEIGHT_MAX_720 : (width * 10),
+ (height * 10 > LIPS_WIDTH_MAX_720)?
+ LIPS_WIDTH_MAX_720 : (height * 10));
+ lputs(s, paper);
}
pdev->prev_paper_size = paper_size;
pdev->prev_paper_width = width;
pdev->prev_paper_height = height;
if (pdev->faceup) {
- sprintf(faceup_char, "%c11;12;12~", LIPS_CSI);
- lputs(s, faceup_char);
+ sprintf(faceup_char, "%c11;12;12~", LIPS_CSI);
+ lputs(s, faceup_char);
}
/* N-up Printing Setting */
if (pdev->first_page) {
- if (pdev->nup != 1) {
- sprintf(nup_char, "%c%d1;;%do", LIPS_CSI, pdev->nup, paper_size);
- lputs(s, nup_char);
- }
+ if (pdev->nup != 1) {
+ sprintf(nup_char, "%c%d1;;%do", LIPS_CSI, pdev->nup, paper_size);
+ lputs(s, nup_char);
+ }
}
/* Duplex Setting */
if (dupset && dup) {
- if (pdev->prev_duplex_mode == 0 || pdev->prev_duplex_mode == 1) {
- sprintf(duplex_char, "%c2;#x", LIPS_CSI); /* duplex */
- lputs(s, duplex_char);
- if (!tum) {
- /* long edge binding */
- if (pdev->prev_duplex_mode != 2) {
- sprintf(tumble_char, "%c0;#w", LIPS_CSI);
- lputs(s, tumble_char);
- }
- pdev->prev_duplex_mode = 2;
- } else {
- /* short edge binding */
- if (pdev->prev_duplex_mode != 3) {
- sprintf(tumble_char, "%c2;#w", LIPS_CSI);
- lputs(s, tumble_char);
- }
- pdev->prev_duplex_mode = 3;
- }
- }
+ if (pdev->prev_duplex_mode == 0 || pdev->prev_duplex_mode == 1) {
+ sprintf(duplex_char, "%c2;#x", LIPS_CSI); /* duplex */
+ lputs(s, duplex_char);
+ if (!tum) {
+ /* long edge binding */
+ if (pdev->prev_duplex_mode != 2) {
+ sprintf(tumble_char, "%c0;#w", LIPS_CSI);
+ lputs(s, tumble_char);
+ }
+ pdev->prev_duplex_mode = 2;
+ } else {
+ /* short edge binding */
+ if (pdev->prev_duplex_mode != 3) {
+ sprintf(tumble_char, "%c2;#w", LIPS_CSI);
+ lputs(s, tumble_char);
+ }
+ pdev->prev_duplex_mode = 3;
+ }
+ }
} else if (dupset && !dup) {
- if (pdev->prev_duplex_mode != 1) {
- sprintf(duplex_char, "%c0;#x", LIPS_CSI); /* simplex */
- lputs(s, duplex_char);
- }
- pdev->prev_duplex_mode = 1;
+ if (pdev->prev_duplex_mode != 1) {
+ sprintf(duplex_char, "%c0;#x", LIPS_CSI); /* simplex */
+ lputs(s, duplex_char);
+ }
+ pdev->prev_duplex_mode = 1;
}
sputc(s, LIPS_CSI);
lputs(s, "?1;4;5;6;14l");
@@ -912,20 +902,20 @@ lips4v_beginpage(gx_device_vector * vdev)
sputc(s, LIPS_IS2);
if (pdev->color_info.depth == 8) {
- sprintf(l4vmono_page_header, "!13%c$%c", LIPS_IS2, LIPS_IS2);
- lputs(s, l4vmono_page_header);
+ sprintf(l4vmono_page_header, "!13%c$%c", LIPS_IS2, LIPS_IS2);
+ lputs(s, l4vmono_page_header);
} else {
- sprintf(l4vcolor_page_header, "!11%c$%c", LIPS_IS2, LIPS_IS2);
- lputs(s, l4vcolor_page_header);
+ sprintf(l4vcolor_page_header, "!11%c$%c", LIPS_IS2, LIPS_IS2);
+ lputs(s, l4vcolor_page_header);
}
lputs(s, "(00");
sput_lips_int(s,
- ((width - dev_l_margin(vdev) - dev_r_margin(vdev)) * dpi) /
- 72);
+ ((width - dev_l_margin(vdev) - dev_r_margin(vdev)) * dpi) /
+ 72);
sput_lips_int(s,
- ((height - dev_b_margin(vdev) - dev_t_margin(vdev)) * dpi) /
- 72);
+ ((height - dev_b_margin(vdev) - dev_t_margin(vdev)) * dpi) /
+ 72);
sputc(s, LIPS_IS2);
/* ¸¶ÅÀ°ÜÆ°Ì¿Îá */
@@ -933,10 +923,10 @@ lips4v_beginpage(gx_device_vector * vdev)
y0 = (dev_b_margin(vdev) - 5. / MMETER_PER_INCH) * dpi;
if (x0 != 0 && y0 != 0) {
- lputs(s, "}\"");
- sput_lips_int(s, x0);
- sput_lips_int(s, y0);
- sputc(s, LIPS_IS2);
+ lputs(s, "}\"");
+ sput_lips_int(s, x0);
+ sput_lips_int(s, y0);
+ sputc(s, LIPS_IS2);
}
lputs(s, "I00");
sputc(s, LIPS_IS2);
@@ -958,14 +948,12 @@ lips4v_beginpage(gx_device_vector * vdev)
return 0;
}
-
static int
lips4v_setlinewidth(gx_device_vector * vdev, floatp width)
{
stream *s = gdev_vector_stream(vdev);
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
-
#if 0
/* Scale ¤ò³Ý¤±¤Æ¤¤¤ë¤Î¤Ï, Ghostscript 5.10/5.50 ¤Î¥Ð¥°¤Î¤¿¤á */
floatp xscale, yscale;
@@ -974,18 +962,18 @@ lips4v_setlinewidth(gx_device_vector * vdev, floatp width)
yscale = fabs(igs->ctm.xy);
if (xscale == 0 || yscale > xscale) /* if portrait */
- width = ceil(width * yscale);
+ width = ceil(width * yscale);
else
- width = ceil(width * xscale);
+ width = ceil(width * xscale);
#endif
if (pdev->TextMode) {
sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
if (width < 1)
- width = 1;
+ width = 1;
lputs(s, "F1");
sput_lips_int(s, width);
@@ -1003,21 +991,21 @@ lips4v_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
int line_cap = 0;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
switch (cap) {
- case 0:
- case 3:
- line_cap = 0; /* butt */
- break;
- case 1:
- line_cap = 1; /* round */
- break;
- case 2:
- line_cap = 2; /* square */
- break;
+ case 0:
+ case 3:
+ line_cap = 0; /* butt */
+ break;
+ case 1:
+ line_cap = 1; /* round */
+ break;
+ case 2:
+ line_cap = 2; /* square */
+ break;
}
/* Àþü·Á¾õ»ØÄêÌ¿Îá */
sprintf(c, "}E%d%c", line_cap, LIPS_IS2);
@@ -1039,25 +1027,25 @@ lips4v_setlinejoin(gx_device_vector * vdev, gs_line_join join)
int lips_join = 0;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
switch (join) {
- case 0:
- lips_join = 2; /* miter */
- break;
- case 1:
- lips_join = 1; /* round */
- break;
- case 2:
- lips_join = 3; /* bevel */
- break;
- case 3:
- case 4:
- lips_join = 0; /* none */
- break;
+ case 0:
+ lips_join = 2; /* miter */
+ break;
+ case 1:
+ lips_join = 1; /* round */
+ break;
+ case 2:
+ lips_join = 3; /* bevel */
+ break;
+ case 3:
+ case 4:
+ lips_join = 0; /* none */
+ break;
}
sprintf(c, "}F%d%c", lips_join, LIPS_IS2);
@@ -1074,9 +1062,9 @@ lips4v_setmiterlimit(gx_device_vector * vdev, floatp limit)
floatp lips_miterlimit;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
lips_miterlimit = (16383.0 * 2.0) / limit;
@@ -1097,60 +1085,60 @@ lips4v_setfillcolor(gx_device_vector * vdev, const gx_drawing_color * pdc)
{
if (!gx_dc_is_pure(pdc))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
{
- stream *s = gdev_vector_stream(vdev);
- gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
- gx_color_index color = gx_dc_pure_color(pdc);
- int drawing_color;
- float r, g, b;
-
- if (vdev->color_info.depth == 8) {
- drawing_color = vdev->color_info.max_gray - color;
- } else {
- r = (color >> 16) * 1000.0 / 255.0;
- g = ((color >> 8) & 0xff) * 1000.0 / 255.0;
- b = (color & 0xff) * 1000.0 / 255.0;
- }
-
- if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
- }
- pdev->current_color = color;
-
- if (color == gx_no_color_index) {
- lputs(s, "I0");
- sputc(s, LIPS_IS2);
- } else {
- lputs(s, "I1");
- sputc(s, LIPS_IS2);
- }
-
- /* Åɤê¤Ä¤Ö¤·¥«¥é¡¼»ØÄêÌ¿Îá */
- /* J {color} IS2 */
- lputs(s, "J");
- if (vdev->color_info.depth == 8) {
- sput_lips_int(s, drawing_color);
- } else {
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- }
- sputc(s, LIPS_IS2);
-
- /* ñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá */
- /* }T {color} IS2 */
- lputs(s, "}T");
- if (vdev->color_info.depth == 8) {
- sput_lips_int(s, drawing_color);
- } else {
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- }
- sputc(s, LIPS_IS2);
+ stream *s = gdev_vector_stream(vdev);
+ gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
+ gx_color_index color = gx_dc_pure_color(pdc);
+ int drawing_color;
+ float r, g, b;
+
+ if (vdev->color_info.depth == 8) {
+ drawing_color = vdev->color_info.max_gray - color;
+ } else {
+ r = (color >> 16) * 1000.0 / 255.0;
+ g = ((color >> 8) & 0xff) * 1000.0 / 255.0;
+ b = (color & 0xff) * 1000.0 / 255.0;
+ }
+
+ if (pdev->TextMode) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
+ }
+ pdev->current_color = color;
+
+ if (color == gx_no_color_index) {
+ lputs(s, "I0");
+ sputc(s, LIPS_IS2);
+ } else {
+ lputs(s, "I1");
+ sputc(s, LIPS_IS2);
+ }
+
+ /* Åɤê¤Ä¤Ö¤·¥«¥é¡¼»ØÄêÌ¿Îá */
+ /* J {color} IS2 */
+ lputs(s, "J");
+ if (vdev->color_info.depth == 8) {
+ sput_lips_int(s, drawing_color);
+ } else {
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ }
+ sputc(s, LIPS_IS2);
+
+ /* ñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá */
+ /* }T {color} IS2 */
+ lputs(s, "}T");
+ if (vdev->color_info.depth == 8) {
+ sput_lips_int(s, drawing_color);
+ } else {
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ }
+ sputc(s, LIPS_IS2);
}
return 0;
}
@@ -1164,35 +1152,35 @@ lips4v_setstrokecolor(gx_device_vector * vdev, const gx_drawing_color * pdc)
#endif
{
if (!gx_dc_is_pure(pdc))
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
{
- stream *s = gdev_vector_stream(vdev);
- gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
- gx_color_index color = gx_dc_pure_color(pdc);
- float r, g, b;
-
- if (vdev->color_info.depth == 24) {
- r = (color >> 16) * 1000 / 255.0;
- g = ((color >> 8) & 0xff) * 1000 / 255.0;
- b = (color & 0xff) * 1000 / 255.0;
- }
-
- if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
- }
- /* ¥é¥¤¥ó¥«¥é¡¼»ØÄêÌ¿Îá */
- /* G {color} IS2 */
- lputs(s, "G");
- if (vdev->color_info.depth == 8) {
- sput_lips_int(s, vdev->color_info.max_gray - color);
- } else {
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- }
- sputc(s, LIPS_IS2);
+ stream *s = gdev_vector_stream(vdev);
+ gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
+ gx_color_index color = gx_dc_pure_color(pdc);
+ float r, g, b;
+
+ if (vdev->color_info.depth == 24) {
+ r = (color >> 16) * 1000 / 255.0;
+ g = ((color >> 8) & 0xff) * 1000 / 255.0;
+ b = (color & 0xff) * 1000 / 255.0;
+ }
+
+ if (pdev->TextMode) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
+ }
+ /* ¥é¥¤¥ó¥«¥é¡¼»ØÄêÌ¿Îá */
+ /* G {color} IS2 */
+ lputs(s, "G");
+ if (vdev->color_info.depth == 8) {
+ sput_lips_int(s, vdev->color_info.max_gray - color);
+ } else {
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ }
+ sputc(s, LIPS_IS2);
}
return 0;
}
@@ -1200,7 +1188,7 @@ lips4v_setstrokecolor(gx_device_vector * vdev, const gx_drawing_color * pdc)
/* Àþ¼ï»ØÄêÌ¿Îá */
static int
lips4v_setdash(gx_device_vector * vdev, const float *pattern, uint count,
- floatp offset)
+ floatp offset)
{
stream *s = gdev_vector_stream(vdev);
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
@@ -1208,9 +1196,9 @@ lips4v_setdash(gx_device_vector * vdev, const float *pattern, uint count,
float scale, xscale, yscale;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
#if 0
/* Scale ¤ò³Ý¤±¤Æ¤¤¤ë¤Î¤Ï, Ghostscript 5.10/5.50 ¤Î¥Ð¥°¤Î¤¿¤á */
@@ -1218,51 +1206,51 @@ lips4v_setdash(gx_device_vector * vdev, const float *pattern, uint count,
yscale = fabs(igs->ctm.xy);
if (xscale == 0) /* if portrait */
- scale = yscale;
+ scale = yscale;
else
- scale = xscale;
+ scale = xscale;
#endif
if (count == 0) {
- lputs(s, "E10");
- sputc(s, LIPS_IS2);
+ lputs(s, "E10");
+ sputc(s, LIPS_IS2);
} else {
- lputs(s, "}d");
- sputc(s, 0x2c);
- lputs(s, "1");
+ lputs(s, "}d");
+ sputc(s, 0x2c);
+ lputs(s, "1");
#if 0
- sput_lips_int(s, offset * scale / vdev->x_pixels_per_inch + 0.5);
+ sput_lips_int(s, offset * scale / vdev->x_pixels_per_inch + 0.5);
#else
- sput_lips_int(s, offset);
+ sput_lips_int(s, offset);
#endif
- for (i = 0; i < count; ++i) {
- if (pdev->linecap == 1 && count == 2 && pattern[0] == 0) {
- if (i == 0) {
- sput_lips_int(s, 1);
- } else {
+ for (i = 0; i < count; ++i) {
+ if (pdev->linecap == 1 && count == 2 && pattern[0] == 0) {
+ if (i == 0) {
+ sput_lips_int(s, 1);
+ } else {
#if 0
- sput_lips_int(s,
- pattern[i] * scale /
- vdev->x_pixels_per_inch - 0.5);
+ sput_lips_int(s,
+ pattern[i] * scale /
+ vdev->x_pixels_per_inch - 0.5);
#else
- sput_lips_int(s, pattern[i] - 1);
+ sput_lips_int(s, pattern[i] - 1);
#endif
- }
- } else {
+ }
+ } else {
#if 0
- sput_lips_int(s,
- pattern[i] * scale / vdev->x_pixels_per_inch +
- 0.5);
+ sput_lips_int(s,
+ pattern[i] * scale / vdev->x_pixels_per_inch +
+ 0.5);
#else
- sput_lips_int(s, pattern[i]);
+ sput_lips_int(s, pattern[i]);
#endif
- }
- }
- sputc(s, LIPS_IS2);
- lputs(s, "E1");
- sputc(s, 0x2c);
- lputs(s, "0");
- sputc(s, LIPS_IS2);
+ }
+ }
+ sputc(s, LIPS_IS2);
+ lputs(s, "E1");
+ sputc(s, 0x2c);
+ lputs(s, "0");
+ sputc(s, LIPS_IS2);
}
return 0;
@@ -1276,9 +1264,9 @@ lips4v_setflat(gx_device_vector * vdev, floatp flatness)
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
lputs(s, "Pf");
sput_lips_int(s, flatness);
@@ -1289,7 +1277,7 @@ lips4v_setflat(gx_device_vector * vdev, floatp flatness)
static int
lips4v_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
- gs_logical_operation_t diff)
+ gs_logical_operation_t diff)
{
/****** SHOULD AT LEAST DETECT SET-0 & SET-1 ******/
return 0;
@@ -1298,7 +1286,7 @@ lips4v_setlogop(gx_device_vector * vdev, gs_logical_operation_t lop,
#if GS_VERSION_MAJOR >= 8
/*--- added for Ghostscritp 8.15 ---*/
static int
-lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis1,
+lips4v_can_handle_hl_color(gx_device_vector * vdev, const gs_imager_state * pis1,
const gx_drawing_color * pdc)
{
return false; /* High level color is not implemented yet. */
@@ -1312,24 +1300,24 @@ lips4v_beginpath(gx_device_vector * vdev, gx_path_type_t type)
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
/* ¥Ñ¥¹¹½ÃÛ³«»ÏÌ¿Îá */
if (type & gx_path_type_clip) {
- lputs(s, "P(10");
- sputc(s, LIPS_IS2);
+ lputs(s, "P(10");
+ sputc(s, LIPS_IS2);
} else
- lputs(s, "P(00");
- sputc(s, LIPS_IS2);
+ lputs(s, "P(00");
+ sputc(s, LIPS_IS2);
return 0;
}
static int
lips4v_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type)
+ floatp y, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
@@ -1344,15 +1332,15 @@ lips4v_moveto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
static int
lips4v_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
- floatp y, gx_path_type_t type)
+ floatp y, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
gx_device_lips4v *const pdev = (gx_device_lips4v *) vdev;
/* if round cap */
if (pdev->linecap == 1) {
- if ((x0 == x) && (y0 == y))
- x += 1;
+ if ((x0 == x) && (y0 == y))
+ x += 1;
}
/* ¥Ñ¥¹¡¦¥Ý¥ê¥é¥¤¥óÌ¿Îá */
@@ -1366,8 +1354,8 @@ lips4v_lineto(gx_device_vector * vdev, floatp x0, floatp y0, floatp x,
static int
lips4v_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
- floatp x1, floatp y1, floatp x2, floatp y2, floatp x3,
- floatp y3, gx_path_type_t type)
+ floatp x1, floatp y1, floatp x2, floatp y2, floatp x3,
+ floatp y3, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
@@ -1386,7 +1374,7 @@ lips4v_curveto(gx_device_vector * vdev, floatp x0, floatp y0,
static int
lips4v_closepath(gx_device_vector * vdev, floatp x, floatp y,
- floatp x_start, floatp y_start, gx_path_type_t type)
+ floatp x_start, floatp y_start, gx_path_type_t type)
{
stream *s = gdev_vector_stream(vdev);
@@ -1403,30 +1391,30 @@ lips4v_endpath(gx_device_vector * vdev, gx_path_type_t type)
lputs(s, "P)");
sputc(s, LIPS_IS2);
if (type & gx_path_type_rule) {
- if (type & gx_path_type_winding_number) {
- lputs(s, "}I1");
- sputc(s, LIPS_IS2);
- } else {
- lputs(s, "}I0");
- sputc(s, LIPS_IS2);
- }
+ if (type & gx_path_type_winding_number) {
+ lputs(s, "}I1");
+ sputc(s, LIPS_IS2);
+ } else {
+ lputs(s, "}I0");
+ sputc(s, LIPS_IS2);
+ }
}
if (type & gx_path_type_fill) {
- if (type & gx_path_type_stroke) {
- lputs(s, "P&00");
- sputc(s, LIPS_IS2);
- } else {
- lputs(s, "PF00");
- sputc(s, LIPS_IS2);
- }
+ if (type & gx_path_type_stroke) {
+ lputs(s, "P&00");
+ sputc(s, LIPS_IS2);
+ } else {
+ lputs(s, "PF00");
+ sputc(s, LIPS_IS2);
+ }
}
if (type & gx_path_type_stroke) {
- lputs(s, "PS00");
- sputc(s, LIPS_IS2);
+ lputs(s, "PS00");
+ sputc(s, LIPS_IS2);
}
if (type & gx_path_type_clip) {
- lputs(s, "PC10");
- sputc(s, LIPS_IS2);
+ lputs(s, "PC10");
+ sputc(s, LIPS_IS2);
}
return 0;
}
@@ -1446,26 +1434,26 @@ lips4v_open(gx_device * dev)
code = lips4v_range_check(dev);
if (code < 0)
- return code;
+ return code;
vdev->v_memory = dev->memory;
/****** WRONG ******/
vdev->vec_procs = &lips4v_vector_procs;
#if GS_VERSION_MAJOR >= 8
- code = gdev_vector_open_file_options(vdev, 512,
- (VECTOR_OPEN_FILE_SEQUENTIAL|VECTOR_OPEN_FILE_BBOX));
+ code = gdev_vector_open_file_options(vdev, 512,
+ (VECTOR_OPEN_FILE_SEQUENTIAL|VECTOR_OPEN_FILE_BBOX));
#else
code = gdev_vector_open_file_bbox(vdev, 512, true);
#endif
if (code < 0)
- return code;
+ return code;
#if GS_VERSION_MAJOR >= 8
- if (pdev->bbox_device != NULL) {
- if (pdev->bbox_device->memory == NULL)
- pdev->bbox_device->memory = gs_memory_stable(dev->memory);
- }
+ if (pdev->bbox_device != NULL) {
+ if (pdev->bbox_device->memory == NULL)
+ pdev->bbox_device->memory = gs_memory_stable(dev->memory);
+ }
#endif
gdev_vector_init(vdev);
@@ -1484,9 +1472,9 @@ lips4v_output_page(gx_device * dev, int num_copies, int flush)
char str[6];
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
lputs(s, "%");
sputc(s, LIPS_IS2);
@@ -1494,11 +1482,11 @@ lips4v_output_page(gx_device * dev, int num_copies, int flush)
sputc(s, LIPS_IS2);
if (num_copies > 255)
- num_copies = 255;
+ num_copies = 255;
if (pdev->prev_num_copies != num_copies) {
- sprintf(str, "%c%dv", LIPS_CSI, num_copies);
- lputs(s, str);
- pdev->prev_num_copies = num_copies;
+ sprintf(str, "%c%dv", LIPS_CSI, num_copies);
+ lputs(s, str);
+ pdev->prev_num_copies = num_copies;
}
sputc(s, LIPS_FF);
sflush(s);
@@ -1517,10 +1505,10 @@ lips4v_close(gx_device * dev)
fprintf(f, "%c0J%c", LIPS_DCS, LIPS_ST);
if (pdev->pjl) {
- fprintf(f, "%c%%-12345X@PJL SET LPARM : LIPS SW2 = OFF\n", LIPS_ESC);
- fprintf(f,
- "%c%%-12345X%c%%-12345X@PJL EOJ\n"
- "%c%%-12345X", LIPS_ESC, LIPS_ESC, LIPS_ESC);
+ fprintf(f, "%c%%-12345X@PJL SET LPARM : LIPS SW2 = OFF\n", LIPS_ESC);
+ fprintf(f,
+ "%c%%-12345X%c%%-12345X@PJL EOJ\n"
+ "%c%%-12345X", LIPS_ESC, LIPS_ESC, LIPS_ESC);
}
gdev_vector_close_file(vdev);
@@ -1544,63 +1532,63 @@ lips4v_get_params(gx_device * dev, gs_param_list * plist)
gs_param_string pmedia;
if (code < 0)
- return code;
+ return code;
if ((ncode = param_write_bool(plist, LIPS_OPTION_MANUALFEED,
- &pdev->ManualFeed)) < 0)
- code = ncode;
+ &pdev->ManualFeed)) < 0)
+ code = ncode;
if ((ncode = param_write_int(plist, LIPS_OPTION_CASSETFEED,
- &pdev->cassetFeed)) < 0)
- code = ncode;
+ &pdev->cassetFeed)) < 0)
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_DUPLEX_TUMBLE,
- &pdev->Tumble)) < 0)
- code = ncode;
+ &pdev->Tumble)) < 0)
+ code = ncode;
if ((ncode = param_write_int(plist, LIPS_OPTION_NUP, &pdev->nup)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_PJL, &pdev->pjl)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_int(plist, LIPS_OPTION_TONERDENSITY,
- &pdev->toner_density)) < 0)
- code = ncode;
+ &pdev->toner_density)) < 0)
+ code = ncode;
if (pdev->toner_saving_set >= 0 &&
- (code = (pdev->toner_saving_set ?
- param_write_bool(plist, LIPS_OPTION_TONERSAVING,
- &pdev->
- toner_saving) : param_write_null(plist,
- LIPS_OPTION_TONERSAVING)))
- < 0)
- code = ncode;
+ (code = (pdev->toner_saving_set ?
+ param_write_bool(plist, LIPS_OPTION_TONERSAVING,
+ &pdev->
+ toner_saving) : param_write_null(plist,
+ LIPS_OPTION_TONERSAVING)))
+ < 0)
+ code = ncode;
if (pdev->Duplex_set >= 0 &&
- (ncode = (pdev->Duplex_set ?
- param_write_bool(plist, "Duplex", &pdev->Duplex) :
- param_write_null(plist, "Duplex"))) < 0)
- code = ncode;
+ (ncode = (pdev->Duplex_set ?
+ param_write_bool(plist, "Duplex", &pdev->Duplex) :
+ param_write_null(plist, "Duplex"))) < 0)
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_FONTDOWNLOAD,
- &pdev->FontDL)) < 0)
- code = ncode;
+ &pdev->FontDL)) < 0)
+ code = ncode;
if ((ncode = param_write_bool(plist, LIPS_OPTION_FACEUP,
- &pdev->faceup)) < 0) code = ncode;
+ &pdev->faceup)) < 0) code = ncode;
pmedia.data = (const byte *)pdev->mediaType,
- pmedia.size = strlen(pdev->mediaType), pmedia.persistent = false;
+ pmedia.size = strlen(pdev->mediaType), pmedia.persistent = false;
if ((ncode = param_write_string(plist, LIPS_OPTION_MEDIATYPE,
- &pmedia)) < 0) code = ncode;
+ &pmedia)) < 0) code = ncode;
if (code < 0)
- return code;
+ return code;
usern.data = (const byte *)pdev->Username,
- usern.size = strlen(pdev->Username), usern.persistent = false;
+ usern.size = strlen(pdev->Username), usern.persistent = false;
return param_write_string(plist, LIPS_OPTION_USER_NAME, &usern);
}
@@ -1631,204 +1619,201 @@ lips4v_put_params(gx_device * dev, gs_param_list * plist)
int bpp = 0;
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_MANUALFEED),
- &mf)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_MANUALFEED),
+ &mf)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_CASSETFEED),
- &cass)) {
- case 0:
- if (cass < -1 || cass > 17 || (cass > 3 && cass < 10))
- ecode = gs_error_limitcheck;
- else
- break;
- goto casse;
- default:
- ecode = code;
+ (param_name = LIPS_OPTION_CASSETFEED),
+ &cass)) {
+ case 0:
+ if (cass < -1 || cass > 17 || (cass > 3 && cass < 10))
+ ecode = gs_error_limitcheck;
+ else
+ break;
+ goto casse;
+ default:
+ ecode = code;
casse:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 1:
+ break;
}
switch (code = param_read_string(plist,
- (param_name = LIPS_OPTION_MEDIATYPE),
- &pmedia)) {
- case 0:
- if (pmedia.size > LIPS_MEDIACHAR_MAX) {
- ecode = gs_error_limitcheck;
- goto pmediae;
- } else { /* Check the validity of ``MediaType'' characters */
- if (strcmp(pmedia.data, "PlainPaper") != 0 &&
- strcmp(pmedia.data, "OHP") != 0 &&
- strcmp(pmedia.data, "TransparencyFilm") != 0 && /* same as OHP */
- strcmp(pmedia.data, "GlossyFilm") != 0 &&
- strcmp(pmedia.data, "CardBoard") != 0) {
- ecode = gs_error_rangecheck;
- goto pmediae;
- }
- }
- break;
- default:
- ecode = code;
+ (param_name = LIPS_OPTION_MEDIATYPE),
+ &pmedia)) {
+ case 0:
+ if (pmedia.size > LIPS_MEDIACHAR_MAX) {
+ ecode = gs_error_limitcheck;
+ goto pmediae;
+ } else { /* Check the validity of ``MediaType'' characters */
+ if (strcmp(pmedia.data, "PlainPaper") != 0 &&
+ strcmp(pmedia.data, "OHP") != 0 &&
+ strcmp(pmedia.data, "TransparencyFilm") != 0 && /* same as OHP */
+ strcmp(pmedia.data, "GlossyFilm") != 0 &&
+ strcmp(pmedia.data, "CardBoard") != 0) {
+ ecode = gs_error_rangecheck;
+ goto pmediae;
+ }
+ }
+ break;
+ default:
+ ecode = code;
pmediae:param_signal_error(plist, param_name, ecode);
- case 1:
- pmedia.data = 0;
- break;
+ case 1:
+ pmedia.data = 0;
+ break;
}
switch (code = param_read_string(plist,
- (param_name = LIPS_OPTION_USER_NAME),
- &usern)) {
- case 0:
- if (usern.size > LIPS_USERNAME_MAX) {
- ecode = gs_error_limitcheck;
- goto userne;
- } else { /* Check the validity of ``User Name'' characters */
- int i;
-
- for (i = 0; i < usern.size; i++)
- if (usern.data[i] < 0x20 || usern.data[i] > 0x7e
- /*
- && usern.data[i] < 0xa0) ||
- usern.data[i] > 0xfe
- */
- ) {
- ecode = gs_error_rangecheck;
- goto userne;
- }
- }
- break;
- default:
- ecode = code;
+ (param_name = LIPS_OPTION_USER_NAME),
+ &usern)) {
+ case 0:
+ if (usern.size > LIPS_USERNAME_MAX) {
+ ecode = gs_error_limitcheck;
+ goto userne;
+ } else { /* Check the validity of ``User Name'' characters */
+ int i;
+
+ for (i = 0; i < usern.size; i++)
+ if (usern.data[i] < 0x20 || usern.data[i] > 0x7e
+ /*
+ && usern.data[i] < 0xa0) ||
+ usern.data[i] > 0xfe
+ */
+ ) {
+ ecode = gs_error_rangecheck;
+ goto userne;
+ }
+ }
+ break;
+ default:
+ ecode = code;
userne:param_signal_error(plist, param_name, ecode);
- case 1:
- usern.data = 0;
- break;
+ case 1:
+ usern.data = 0;
+ break;
}
-
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_DUPLEX_TUMBLE),
- &tum)) < 0)
- param_signal_error(plist, param_name, ecode = code);
-
+ (param_name = LIPS_OPTION_DUPLEX_TUMBLE),
+ &tum)) < 0)
+ param_signal_error(plist, param_name, ecode = code);
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_NUP), &nup)) {
- case 0:
- if (nup != 1 && nup != 2 && nup != 4)
- ecode = gs_error_rangecheck;
- else
- break;
- goto nupe;
- default:
- ecode = code;
+ (param_name = LIPS_OPTION_NUP), &nup)) {
+ case 0:
+ if (nup != 1 && nup != 2 && nup != 4)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto nupe;
+ default:
+ ecode = code;
nupe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 1:
+ break;
}
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_PJL), &pjl)) < 0)
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_PJL), &pjl)) < 0)
+ param_signal_error(plist, param_name, ecode = code);
switch (code = param_read_int(plist,
- (param_name = LIPS_OPTION_TONERDENSITY),
- &toner_density)) {
- case 0:
- if (toner_density < 0 || toner_density > 8)
- ecode = gs_error_rangecheck;
- else
- break;
- goto tden;
- default:
- ecode = code;
+ (param_name = LIPS_OPTION_TONERDENSITY),
+ &toner_density)) {
+ case 0:
+ if (toner_density < 0 || toner_density > 8)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto tden;
+ default:
+ ecode = code;
tden:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 1:
+ break;
}
if (pdev->toner_saving_set >= 0)
- switch (code =
- param_read_bool(plist, (param_name = LIPS_OPTION_TONERSAVING),
- &toner_saving)) {
- case 0:
- toner_saving_set = 1;
- break;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- toner_saving_set = 0;
- break;
- }
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
- }
+ switch (code =
+ param_read_bool(plist, (param_name = LIPS_OPTION_TONERSAVING),
+ &toner_saving)) {
+ case 0:
+ toner_saving_set = 1;
+ break;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ toner_saving_set = 0;
+ break;
+ }
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
+ }
if (pdev->Duplex_set >= 0) /* i.e., Duplex is supported */
- switch (code = param_read_bool(plist, (param_name = "Duplex"),
- &duplex)) {
- case 0:
- duplex_set = 1;
- break;
- default:
- if ((code = param_read_null(plist, param_name)) == 0) {
- duplex_set = 0;
- break;
- }
- ecode = code;
- param_signal_error(plist, param_name, ecode);
- case 1:
- break;
- }
+ switch (code = param_read_bool(plist, (param_name = "Duplex"),
+ &duplex)) {
+ case 0:
+ duplex_set = 1;
+ break;
+ default:
+ if ((code = param_read_null(plist, param_name)) == 0) {
+ duplex_set = 0;
+ break;
+ }
+ ecode = code;
+ param_signal_error(plist, param_name, ecode);
+ case 1:
+ break;
+ }
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_FONTDOWNLOAD),
- &fontdl)) < 0)
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_FONTDOWNLOAD),
+ &fontdl)) < 0)
+ param_signal_error(plist, param_name, ecode = code);
if ((code = param_read_bool(plist,
- (param_name = LIPS_OPTION_FACEUP),
- &faceup)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = LIPS_OPTION_FACEUP),
+ &faceup)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
-
switch (code = param_read_int(plist, (param_name = "BitsPerPixel"), &bpp)) {
- case 0:
- if (bpp != 8 && bpp != 24)
- ecode = gs_error_rangecheck;
- else
- break;
- goto bppe;
- default:
- ecode = code;
+ case 0:
+ if (bpp != 8 && bpp != 24)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto bppe;
+ default:
+ ecode = code;
bppe:param_signal_error(plist, param_name, ecode);
- case 1:
- break;
+ case 1:
+ break;
}
if (bpp != 0) {
- dev->color_info.depth = bpp;
- dev->color_info.num_components = ((bpp == 8) ? 1 : 3);
- dev->color_info.max_gray = (bpp > 8 ? 255 : 1000);
- dev->color_info.max_color = (bpp > 8 ? 255 : 1000);
- dev->color_info.dither_grays = (bpp > 8 ? 256 : 5);
- dev->color_info.dither_colors = (bpp > 8 ? 256 : 2);
- dev_proc(pdev, map_rgb_color) =
- ((bpp == 8) ? gx_default_gray_map_rgb_color :
- gx_default_rgb_map_rgb_color);
- dev_proc(pdev, map_color_rgb) =
- ((bpp == 8) ? gx_default_gray_map_color_rgb :
- gx_default_rgb_map_color_rgb);
+ dev->color_info.depth = bpp;
+ dev->color_info.num_components = ((bpp == 8) ? 1 : 3);
+ dev->color_info.max_gray = (bpp > 8 ? 255 : 1000);
+ dev->color_info.max_color = (bpp > 8 ? 255 : 1000);
+ dev->color_info.dither_grays = (bpp > 8 ? 256 : 5);
+ dev->color_info.dither_colors = (bpp > 8 ? 256 : 2);
+ dev_proc(pdev, map_rgb_color) =
+ ((bpp == 8) ? gx_default_gray_map_rgb_color :
+ gx_default_rgb_map_rgb_color);
+ dev_proc(pdev, map_color_rgb) =
+ ((bpp == 8) ? gx_default_gray_map_color_rgb :
+ gx_default_rgb_map_color_rgb);
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gdev_vector_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
pdev->ManualFeed = mf;
pdev->cassetFeed = cass;
@@ -1842,25 +1827,25 @@ lips4v_put_params(gx_device * dev, gs_param_list * plist)
pdev->faceup = faceup;
if (duplex_set >= 0) {
- pdev->Duplex = duplex;
- pdev->Duplex_set = duplex_set;
+ pdev->Duplex = duplex;
+ pdev->Duplex_set = duplex_set;
}
if (pmedia.data != 0 &&
- bytes_compare(pmedia.data, pmedia.size,
- (const byte *)pdev->mediaType, strlen(pdev->mediaType))
- ) {
- memcpy(pdev->mediaType, pmedia.data, pmedia.size);
- pdev->mediaType[pmedia.size] = 0;
+ bytes_compare(pmedia.data, pmedia.size,
+ (const byte *)pdev->mediaType, strlen(pdev->mediaType))
+ ) {
+ memcpy(pdev->mediaType, pmedia.data, pmedia.size);
+ pdev->mediaType[pmedia.size] = 0;
}
if (usern.data != 0 &&
- bytes_compare(usern.data, usern.size,
- (const byte *)pdev->Username, strlen(pdev->Username))
- ) {
- memcpy(pdev->Username, usern.data, usern.size);
- pdev->Username[usern.size] = 0;
+ bytes_compare(usern.data, usern.size,
+ (const byte *)pdev->Username, strlen(pdev->Username))
+ ) {
+ memcpy(pdev->Username, usern.data, usern.size);
+ pdev->Username[usern.size] = 0;
}
if (bpp != 0 && bpp != old_bpp && pdev->is_open)
- return gs_closedevice(dev);
+ return gs_closedevice(dev);
return 0;
}
@@ -1868,8 +1853,8 @@ lips4v_put_params(gx_device * dev, gs_param_list * plist)
static int
lips4v_copy_mono(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id, int x, int y, int w,
- int h, gx_color_index zero, gx_color_index one)
+ int data_x, int raster, gx_bitmap_id id, int x, int y, int w,
+ int h, gx_color_index zero, gx_color_index one)
{
gx_device_lips4v *const pdev = (gx_device_lips4v *) dev;
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -1880,23 +1865,23 @@ lips4v_copy_mono(gx_device * dev, const byte * data,
floatp r, g, b;
if (id != gs_no_id && zero == gx_no_color_index &&
- one != gx_no_color_index && data_x == 0) {
- gx_drawing_color dcolor;
+ one != gx_no_color_index && data_x == 0) {
+ gx_drawing_color dcolor;
- color_set_pure(&dcolor, one);
+ color_set_pure(&dcolor, one);
#if GS_VERSION_MAJOR >= 8
- lips4v_setfillcolor(vdev, NULL, &dcolor);
+ lips4v_setfillcolor(vdev, NULL, &dcolor);
#else
- lips4v_setfillcolor(vdev, &dcolor);
+ lips4v_setfillcolor(vdev, &dcolor);
#endif
- if (lips4v_copy_text_char(dev, data, raster, id, x, y, w, h) >= 0)
- return 0;
+ if (lips4v_copy_text_char(dev, data, raster, id, x, y, w, h) >= 0)
+ return 0;
}
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
/*
(*dev_proc(vdev->bbox_device, copy_mono))
@@ -1904,100 +1889,100 @@ lips4v_copy_mono(gx_device * dev, const byte * data,
x, y, w, h, zero, one);
*/
if (zero == gx_no_color_index) {
- if (one == gx_no_color_index)
- return 0;
- /* one ¿§¤ËÀ÷¤á¡¢Æ©²á¤Ë¤¹¤ë */
- if (pdev->MaskState != 1) {
- lputs(s, "}H1");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 1;
- }
- if (pdev->color_info.depth == 8) {
- gx_color_index one_color = vdev->color_info.max_gray - one;
-
- lputs(s, "}T");
- sput_lips_int(s, one_color);
- sputc(s, LIPS_IS2);
- } else {
- r = (one >> 16) * 1000.0 / 255.0;
- g = ((one >> 8) & 0xff) * 1000.0 / 255.0;
- b = (one & 0xff) * 1000.0 / 255.0;
- lputs(s, "}T");
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- sputc(s, LIPS_IS2);
- }
+ if (one == gx_no_color_index)
+ return 0;
+ /* one ¿§¤ËÀ÷¤á¡¢Æ©²á¤Ë¤¹¤ë */
+ if (pdev->MaskState != 1) {
+ lputs(s, "}H1");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 1;
+ }
+ if (pdev->color_info.depth == 8) {
+ gx_color_index one_color = vdev->color_info.max_gray - one;
+
+ lputs(s, "}T");
+ sput_lips_int(s, one_color);
+ sputc(s, LIPS_IS2);
+ } else {
+ r = (one >> 16) * 1000.0 / 255.0;
+ g = ((one >> 8) & 0xff) * 1000.0 / 255.0;
+ b = (one & 0xff) * 1000.0 / 255.0;
+ lputs(s, "}T");
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ sputc(s, LIPS_IS2);
+ }
} else if (one == gx_no_color_index)
- /* 1bit ¤ÏÆ©ÌÀ ¥Ó¥Ã¥Èȿž¡¦zero ¿§¤ËÀ÷¤á¤ë */
+ /* 1bit ¤ÏÆ©ÌÀ ¥Ó¥Ã¥Èȿž¡¦zero ¿§¤ËÀ÷¤á¤ë */
{
- gx_color_index zero_color = vdev->color_info.max_gray - zero;
-
- if (pdev->MaskState != 1) {
- lputs(s, "}H1");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 1;
- }
- if (pdev->color_info.depth == 8) {
- lputs(s, "}T");
- sput_lips_int(s, zero_color);
- sputc(s, LIPS_IS2);
- } else {
- r = (zero >> 16) * 1000.0 / 255.0;
- g = ((zero >> 8) & 0xff) * 1000.0 / 255.0;
- b = (zero & 0xff) * 1000.0 / 255.0;
- lputs(s, "}T");
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- sputc(s, LIPS_IS2);
- }
+ gx_color_index zero_color = vdev->color_info.max_gray - zero;
+
+ if (pdev->MaskState != 1) {
+ lputs(s, "}H1");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 1;
+ }
+ if (pdev->color_info.depth == 8) {
+ lputs(s, "}T");
+ sput_lips_int(s, zero_color);
+ sputc(s, LIPS_IS2);
+ } else {
+ r = (zero >> 16) * 1000.0 / 255.0;
+ g = ((zero >> 8) & 0xff) * 1000.0 / 255.0;
+ b = (zero & 0xff) * 1000.0 / 255.0;
+ lputs(s, "}T");
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ sputc(s, LIPS_IS2);
+ }
} else if (one == vdev->white) {
- /* ¥Ó¥Ã¥Èȿž ÇòÅɤê zero ¿§¤ËÀ÷¤á¤ë */
- gx_color_index zero_color = vdev->color_info.max_gray - zero;
-
- if (pdev->MaskState != 0) {
- lputs(s, "}H0");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 0;
- }
- if (pdev->color_info.depth == 8) {
- lputs(s, "}T");
- sput_lips_int(s, zero_color);
- sputc(s, LIPS_IS2);
- } else {
- r = (zero >> 16) * 1000.0 / 255.0;
- g = ((zero >> 8) & 0xff) * 1000.0 / 255.0;
- b = (zero & 0xff) * 1000.0 / 255.0;
- lputs(s, "}T");
- sput_lips_int(s, r);
- sput_lips_int(s, g);
- sput_lips_int(s, b);
- sputc(s, LIPS_IS2);
- }
+ /* ¥Ó¥Ã¥Èȿž ÇòÅɤê zero ¿§¤ËÀ÷¤á¤ë */
+ gx_color_index zero_color = vdev->color_info.max_gray - zero;
+
+ if (pdev->MaskState != 0) {
+ lputs(s, "}H0");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 0;
+ }
+ if (pdev->color_info.depth == 8) {
+ lputs(s, "}T");
+ sput_lips_int(s, zero_color);
+ sputc(s, LIPS_IS2);
+ } else {
+ r = (zero >> 16) * 1000.0 / 255.0;
+ g = ((zero >> 8) & 0xff) * 1000.0 / 255.0;
+ b = (zero & 0xff) * 1000.0 / 255.0;
+ lputs(s, "}T");
+ sput_lips_int(s, r);
+ sput_lips_int(s, g);
+ sput_lips_int(s, b);
+ sputc(s, LIPS_IS2);
+ }
} else {
- if (zero != gx_no_color_index) {
- code = (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h, zero);
- if (code < 0)
- return code;
- }
- if (pdev->MaskState != 1) {
- lputs(s, "}H1");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 1;
- }
- color_set_pure(&color, one);
+ if (zero != gx_no_color_index) {
+ code = (*dev_proc(dev, fill_rectangle)) (dev, x, y, w, h, zero);
+ if (code < 0)
+ return code;
+ }
+ if (pdev->MaskState != 1) {
+ lputs(s, "}H1");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 1;
+ }
+ color_set_pure(&color, one);
#if GS_VERSION_MAJOR >= 8
- code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
- NULL, &color);
+ code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
+ NULL, &color);
#else
- code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
- &color);
+ code = gdev_vector_update_fill_color((gx_device_vector *) pdev,
+ &color);
#endif
}
if (code < 0)
- return 0;
+ return 0;
lputs(s, "}P");
sput_lips_int(s, x); /* Position X */
sput_lips_int(s, y); /* Position Y */
@@ -2011,41 +1996,40 @@ lips4v_copy_mono(gx_device * dev, const byte * data,
lputs(s, "}Q11");
{
- int i, j;
- uint width_bytes = (w + 7) >> 3;
- uint num_bytes = round_up(width_bytes, 4) * h;
- byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
- "lips4v_copy_mono(buf)");
-
- if (data_x % 8 == 0) {
- for (i = 0; i < h; ++i) {
- memcpy(buf + i * width_bytes,
- data + (data_x >> 3) + i * raster, width_bytes);
- }
- } else {
- for (i = 0; i < h; ++i) {
- for (j = 0; j < width_bytes; j++) {
- *(buf + i * width_bytes + j) =
- *(data + (data_x >> 3) + i * raster +
- j) << (data_x % 8) | *(data + (data_x >> 3) +
- i * raster + j + 1) >> (8 -
- data_x
- % 8);
- }
- }
- }
-
-
- if (one == gx_no_color_index
- || (one == vdev->white
- && zero != gx_no_color_index)) lips4v_write_image_data(vdev,
- buf,
- num_bytes,
- TRUE);
- else
- lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
-
- gs_free_object(vdev->memory, buf, "lips4v_copy_mono(buf)");
+ int i, j;
+ uint width_bytes = (w + 7) >> 3;
+ uint num_bytes = round_up(width_bytes, 4) * h;
+ byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
+ "lips4v_copy_mono(buf)");
+
+ if (data_x % 8 == 0) {
+ for (i = 0; i < h; ++i) {
+ memcpy(buf + i * width_bytes,
+ data + (data_x >> 3) + i * raster, width_bytes);
+ }
+ } else {
+ for (i = 0; i < h; ++i) {
+ for (j = 0; j < width_bytes; j++) {
+ *(buf + i * width_bytes + j) =
+ *(data + (data_x >> 3) + i * raster +
+ j) << (data_x % 8) | *(data + (data_x >> 3) +
+ i * raster + j + 1) >> (8 -
+ data_x
+ % 8);
+ }
+ }
+ }
+
+ if (one == gx_no_color_index
+ || (one == vdev->white
+ && zero != gx_no_color_index)) lips4v_write_image_data(vdev,
+ buf,
+ num_bytes,
+ TRUE);
+ else
+ lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
+
+ gs_free_object(vdev->memory, buf, "lips4v_copy_mono(buf)");
}
return 0;
@@ -2054,8 +2038,8 @@ lips4v_copy_mono(gx_device * dev, const byte * data,
/* Copy a color bitmap. */
static int
lips4v_copy_color(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
{
gx_device_lips4v *const pdev = (gx_device_lips4v *) dev;
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -2066,30 +2050,29 @@ lips4v_copy_color(gx_device * dev,
int num_components = (depth < 24 ? 1 : 3);
uint width_bytes = w * num_components;
-
if (dev->color_info.depth == 8) {
- gx_drawing_color dcolor;
+ gx_drawing_color dcolor;
- /* LIPS IV ¤Ç¤Ï¥°¥ì¡¼¥¹¥±¡¼¥ë¤âñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá¤Ë
- ±Æ¶Á¤µ¤ì¤ë¤Î¤Ç¹õ¿§¤ò»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */
- color_set_pure(&dcolor, vdev->black);
+ /* LIPS IV ¤Ç¤Ï¥°¥ì¡¼¥¹¥±¡¼¥ë¤âñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá¤Ë
+ ±Æ¶Á¤µ¤ì¤ë¤Î¤Ç¹õ¿§¤ò»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */
+ color_set_pure(&dcolor, vdev->black);
#if GS_VERSION_MAJOR >= 8
- lips4v_setfillcolor(vdev, NULL, &dcolor);
+ lips4v_setfillcolor(vdev, NULL, &dcolor);
#else
- lips4v_setfillcolor(vdev, &dcolor);
+ lips4v_setfillcolor(vdev, &dcolor);
#endif
} else {
- if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
- }
+ if (pdev->TextMode) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
+ }
}
if (pdev->MaskState != 0) {
- lputs(s, "}H0"); /* ÏÀÍýÉÁ²èÀßÄêÌ¿Îá */
- sputc(s, LIPS_IS2);
- pdev->MaskState = 0;
+ lputs(s, "}H0"); /* ÏÀÍýÉÁ²èÀßÄêÌ¿Îá */
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 0;
}
lputs(s, "}P");
sput_lips_int(s, x);
@@ -2104,24 +2087,24 @@ lips4v_copy_color(gx_device * dev,
sputc(s, LIPS_IS2);
{
- int i;
- uint num_bytes = width_bytes * h;
- byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
- "lips4v_copy_color(buf)");
+ int i;
+ uint num_bytes = width_bytes * h;
+ byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
+ "lips4v_copy_color(buf)");
- lputs(s, "}Q11");
+ lputs(s, "}Q11");
- for (i = 0; i < h; ++i) {
- memcpy(buf + i * width_bytes,
- data + ((data_x * depth) >> 3) + i * raster, width_bytes);
- }
+ for (i = 0; i < h; ++i) {
+ memcpy(buf + i * width_bytes,
+ data + ((data_x * depth) >> 3) + i * raster, width_bytes);
+ }
- if (dev->color_info.depth == 8)
- lips4v_write_image_data(vdev, buf, num_bytes, TRUE);
- else
- lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
+ if (dev->color_info.depth == 8)
+ lips4v_write_image_data(vdev, buf, num_bytes, TRUE);
+ else
+ lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
- gs_free_object(vdev->memory, buf, "lips4v_copy_color(buf)");
+ gs_free_object(vdev->memory, buf, "lips4v_copy_color(buf)");
}
return 0;
@@ -2130,10 +2113,10 @@ lips4v_copy_color(gx_device * dev,
/* Fill a mask. */
static int
lips4v_fill_mask(gx_device * dev,
- const byte * data, int data_x, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
gx_device_lips4v *const pdev = (gx_device_lips4v *) dev;
@@ -2141,36 +2124,36 @@ lips4v_fill_mask(gx_device * dev,
int dpi = dev->x_pixels_per_inch;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
if (depth > 1 ||
#if GS_VERSION_MAJOR >= 8
- gdev_vector_update_fill_color(vdev, NULL, pdcolor) < 0 ||
+ gdev_vector_update_fill_color(vdev, NULL, pdcolor) < 0 ||
#else
- gdev_vector_update_fill_color(vdev, pdcolor) < 0 ||
+ gdev_vector_update_fill_color(vdev, pdcolor) < 0 ||
#endif
- gdev_vector_update_clip_path(vdev, pcpath) < 0 ||
- gdev_vector_update_log_op(vdev, lop) < 0)
- return gx_default_fill_mask(dev, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth, lop, pcpath);
+ gdev_vector_update_clip_path(vdev, pcpath) < 0 ||
+ gdev_vector_update_log_op(vdev, lop) < 0)
+ return gx_default_fill_mask(dev, data, data_x, raster, id,
+ x, y, w, h, pdcolor, depth, lop, pcpath);
#if 1
(*dev_proc(vdev->bbox_device, fill_mask))
- ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
- x, y, w, h, pdcolor, depth, lop, pcpath);
+ ((gx_device *) vdev->bbox_device, data, data_x, raster, id,
+ x, y, w, h, pdcolor, depth, lop, pcpath);
#endif
if (id != gs_no_id && data_x == 0) {
- if (lips4v_copy_text_char(dev, data, raster, id, x, y, w, h) >= 0)
- return 0;
+ if (lips4v_copy_text_char(dev, data, raster, id, x, y, w, h) >= 0)
+ return 0;
}
if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
}
/* ½ñ¤­¤À¤· */
if (pdev->MaskState != 1) {
- lputs(s, "}H1"); /* ÏÀÍýÉÁ²èÀßÄêÌ¿Îá */
- sputc(s, LIPS_IS2);
- pdev->MaskState = 1;
+ lputs(s, "}H1"); /* ÏÀÍýÉÁ²èÀßÄêÌ¿Îá */
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 1;
}
lputs(s, "}P");
sput_lips_int(s, x);
@@ -2185,20 +2168,20 @@ lips4v_fill_mask(gx_device * dev,
lputs(s, "}Q11");
{
- int i;
- uint width_bytes = (w + 7) >> 3;
- uint num_bytes = round_up(width_bytes, 4) * h;
- byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
- "lips4v_fill_mask(buf)");
+ int i;
+ uint width_bytes = (w + 7) >> 3;
+ uint num_bytes = round_up(width_bytes, 4) * h;
+ byte *buf = gs_alloc_bytes(vdev->memory, num_bytes,
+ "lips4v_fill_mask(buf)");
- for (i = 0; i < h; ++i) {
- memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster,
- width_bytes);
- }
+ for (i = 0; i < h; ++i) {
+ memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster,
+ width_bytes);
+ }
- lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
+ lips4v_write_image_data(vdev, buf, num_bytes, FALSE);
- gs_free_object(vdev->memory, buf, "lips4v_fill_mask(buf)");
+ gs_free_object(vdev->memory, buf, "lips4v_fill_mask(buf)");
}
return 0;
@@ -2215,195 +2198,195 @@ static const gx_image_enum_procs_t lips4v_image_enum_procs = {
/* Start processing an image. */
static int
lips4v_begin_image(gx_device * dev,
- const gs_imager_state * pis, const gs_image_t * pim,
- gs_image_format_t format, const gs_int_rect * prect,
- const gx_drawing_color * pdcolor,
- const gx_clip_path * pcpath, gs_memory_t * mem,
- gx_image_enum_common_t ** pinfo)
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor,
+ const gx_clip_path * pcpath, gs_memory_t * mem,
+ gx_image_enum_common_t ** pinfo)
{
gx_device_vector *const vdev = (gx_device_vector *) dev;
gx_device_lips4v *const pdev = (gx_device_lips4v *) dev;
gdev_vector_image_enum_t *pie =
- gs_alloc_struct(mem, gdev_vector_image_enum_t,
- &st_vector_image_enum, "lips4v_begin_image");
+ gs_alloc_struct(mem, gdev_vector_image_enum_t,
+ &st_vector_image_enum, "lips4v_begin_image");
const gs_color_space *pcs = pim->ColorSpace;
gs_color_space_index index;
int num_components = 1;
bool can_do = prect == 0 &&
- (pim->format == gs_image_format_chunky ||
+ (pim->format == gs_image_format_chunky ||
- pim->format == gs_image_format_component_planar);
+ pim->format == gs_image_format_component_planar);
int code;
if (pie == 0)
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
pie->memory = mem;
code = gdev_vector_begin_image(vdev, pis, pim, format, prect,
- pdcolor, pcpath, mem,
- &lips4v_image_enum_procs, pie);
+ pdcolor, pcpath, mem,
+ &lips4v_image_enum_procs, pie);
if (code < 0)
- return code;
+ return code;
*pinfo = (gx_image_enum_common_t *) pie;
if (!pim->ImageMask) {
- index = gs_color_space_get_index(pcs);
- num_components = gs_color_space_num_components(pcs);
-
- if (pim->CombineWithColor)
- can_do = false;
- else {
- switch (index) {
- case gs_color_space_index_DeviceGray:
- if ((pim->Decode[0] != 0 || pim->Decode[1] != 1)
- && (pim->Decode[0] != 1 || pim->Decode[1] != 0))
- can_do = false;
- break;
- case gs_color_space_index_DeviceRGB:
- /* LIPS ¤Ç¤Ï RGB ¤òȿž¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤ */
- if (pim->Decode[0] != 0 || pim->Decode[1] != 1 ||
- pim->Decode[2] != 0 || pim->Decode[3] != 1 ||
- pim->Decode[4] != 0)
- can_do = false;
- break;
- default:
- /*
- LIPS ¤Ç¤Ï L*a*b* ·Á¼°¤Î¥«¥é¡¼¥¹¥Ú¡¼¥¹¤¬»È¤¨¤Þ¤¹¡£
- CIEBasedABC ¤ò»È¤Ã¤Æɽ¸½¤Ç¤­¤Ê¤¤¤³¤È¤â¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢
- Æ°ºî³Îǧ¤Ç¤­¤Ê¤¤¤Î¤ÇÄã¥ì¥Ù¥ë¤Î´Ø¿ô¤Ë¤Þ¤«¤»¤ë¤³¤È¤Ë
- ¤·¤Á¤ã¤¤¤Þ¤¹¡£
- ¤½¤ì¤è¤ê¤â CMYK ¤Î¥«¥é¡¼¥¹¥Ú¡¼¥¹¤¬Íߤ·¤¤...
- */
- can_do = false;
- }
- }
+ index = gs_color_space_get_index(pcs);
+ num_components = gs_color_space_num_components(pcs);
+
+ if (pim->CombineWithColor)
+ can_do = false;
+ else {
+ switch (index) {
+ case gs_color_space_index_DeviceGray:
+ if ((pim->Decode[0] != 0 || pim->Decode[1] != 1)
+ && (pim->Decode[0] != 1 || pim->Decode[1] != 0))
+ can_do = false;
+ break;
+ case gs_color_space_index_DeviceRGB:
+ /* LIPS ¤Ç¤Ï RGB ¤òȿž¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤ */
+ if (pim->Decode[0] != 0 || pim->Decode[1] != 1 ||
+ pim->Decode[2] != 0 || pim->Decode[3] != 1 ||
+ pim->Decode[4] != 0)
+ can_do = false;
+ break;
+ default:
+ /*
+ LIPS ¤Ç¤Ï L*a*b* ·Á¼°¤Î¥«¥é¡¼¥¹¥Ú¡¼¥¹¤¬»È¤¨¤Þ¤¹¡£
+ CIEBasedABC ¤ò»È¤Ã¤Æɽ¸½¤Ç¤­¤Ê¤¤¤³¤È¤â¤Ê¤¤¤Î¤Ç¤¹¤¬¡¢
+ Æ°ºî³Îǧ¤Ç¤­¤Ê¤¤¤Î¤ÇÄã¥ì¥Ù¥ë¤Î´Ø¿ô¤Ë¤Þ¤«¤»¤ë¤³¤È¤Ë
+ ¤·¤Á¤ã¤¤¤Þ¤¹¡£
+ ¤½¤ì¤è¤ê¤â CMYK ¤Î¥«¥é¡¼¥¹¥Ú¡¼¥¹¤¬Íߤ·¤¤...
+ */
+ can_do = false;
+ }
+ }
}
if (!can_do)
- return gx_default_begin_image(dev, pis, pim, format, prect,
- pdcolor, pcpath, mem,
- &pie->default_info);
+ return gx_default_begin_image(dev, pis, pim, format, prect,
+ pdcolor, pcpath, mem,
+ &pie->default_info);
else if (index == gs_color_space_index_DeviceGray) {
- gx_drawing_color dcolor;
+ gx_drawing_color dcolor;
- /* LIPS IV ¤Ç¤Ï¥°¥ì¡¼¥¹¥±¡¼¥ë¤âñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá¤Ë
- ±Æ¶Á¤µ¤ì¤ë¤Î¤Ç¹õ¿§¤òÌÀ¼¨Åª¤Ë»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */
- color_set_pure(&dcolor, vdev->black);
+ /* LIPS IV ¤Ç¤Ï¥°¥ì¡¼¥¹¥±¡¼¥ë¤âñ¿§¥¤¥á¡¼¥¸¡¦¥«¥é¡¼»ØÄêÌ¿Îá¤Ë
+ ±Æ¶Á¤µ¤ì¤ë¤Î¤Ç¹õ¿§¤òÌÀ¼¨Åª¤Ë»ØÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ */
+ color_set_pure(&dcolor, vdev->black);
#if GS_VERSION_MAJOR >= 8
- lips4v_setfillcolor(vdev, NULL, &dcolor);
+ lips4v_setfillcolor(vdev, NULL, &dcolor);
#else
- lips4v_setfillcolor(vdev, &dcolor);
+ lips4v_setfillcolor(vdev, &dcolor);
#endif
}
if (pim->ImageMask || (pim->BitsPerComponent == 1 && num_components == 1)) {
- if (pim->Decode[0] > pim->Decode[1])
- pdev->MaskReverse = 1;
- else
- pdev->MaskReverse = 0;
+ if (pim->Decode[0] > pim->Decode[1])
+ pdev->MaskReverse = 1;
+ else
+ pdev->MaskReverse = 0;
}
/* Write the image/colorimage/imagemask preamble. */
{
- stream *s = gdev_vector_stream((gx_device_vector *) pdev);
- int ax, ay, bx, by, cx, cy, dx, dy;
- int tbyte;
- gs_matrix imat;
- int interpolate = 0;
-
- if (pdev->TextMode) {
- sputc(s, LIPS_CSI);
- lputs(s, "&}");
- pdev->TextMode = FALSE;
- }
- gs_matrix_invert(&pim->ImageMatrix, &imat);
- gs_matrix_multiply(&imat, &ctm_only(pis), &imat);
- /*
- [xx xy yx yy tx ty]
- LIPS ¤ÎºÂɸ·Ï¤ËÊÑ´¹¤ò¹Ô¤Ê¤¦¡£
-
- }U{Ax}{Ay}{Bx}{By}{Cx}{Cy}{pie->height}{pie->width}
- {pim->BitsPerComponent}{0}{0}{1} LIPS_IS2
- */
-
- /* }Q110{byte} LIPS_IS2 */
- ax = imat.tx;
- ay = imat.ty;
- bx = imat.xx * pim->Width + imat.yx * pim->Height + imat.tx;
- by = imat.xy * pim->Width + imat.yy * pim->Height + imat.ty;
- cx = imat.yx * pim->Height + imat.tx;
- cy = imat.yy * pim->Height + imat.ty;
- dx = imat.xx * pim->Width + imat.tx;
- dy = imat.xy * pim->Width + imat.ty;
-
- if (pim->ImageMask) {
- tbyte =
- (pie->width * pim->BitsPerComponent +
- 7) / 8 * num_components * pie->height;
- pdev->ncomp = 1;
- if (tbyte == 1) {
- /* LIPS IV ¤Ç¤Ï 1 dot ¤Î¥¤¥á¡¼¥¸¤òÊÑ·Á¤¹¤ë¤ÈºÂɸ¤¬¶¸¤¦¥Ð¥°¤¬
- ¤¢¤ë¡£¤è¤Ã¤Æ 1 dot ¤Î¥¤¥á¡¼¥¸¤Ï¶ë·Á¤È¤·¤Æ½èÍý¤¹¤ë¡£ */
- pdev->OneBitMask = true;
- /* Draw Rectangle */
- lputs(s, "2");
- sput_lips_int(s, ax);
- sput_lips_int(s, ay);
- sput_lips_int(s, cx - ax);
- sput_lips_int(s, cy - ay);
- sput_lips_int(s, bx - cx);
- sput_lips_int(s, by - cy);
- sput_lips_int(s, dx - bx);
- sput_lips_int(s, dy - by);
- sputc(s, LIPS_IS2);
- return 0;
- } else {
- /* ÉÁ²èÏÀÍýÀßÄêÌ¿Îá - Æ©²á */
- if (pdev->MaskState != 1) {
- lputs(s, "}H1");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 1;
- }
- }
- } else {
- /* ÉÁ²èÏÀÍýÀßÄêÌ¿Îá - ÇòÅɤê */
- if (pdev->MaskState != 0) {
- lputs(s, "}H0");
- sputc(s, LIPS_IS2);
- pdev->MaskState = 0;
- }
- pdev->ncomp = num_components;
- }
-
- lputs(s, "}U");
- sput_lips_int(s, ax);
- sput_lips_int(s, ay);
- sput_lips_int(s, bx);
- sput_lips_int(s, by);
- sput_lips_int(s, cx);
- sput_lips_int(s, cy);
- sput_lips_int(s, pie->height);
- sput_lips_int(s, pie->width);
- sput_lips_int(s, pim->BitsPerComponent);
-
- if (pim->Interpolate) {
- if (pim->BitsPerComponent * pie->num_planes == 1)
- interpolate = 1;
- else
- interpolate = 3;
- }
- if (pim->ImageMask) { /* 1bit ¤Î¤È¤­ */
- lputs(s, "0");
- } else {
- if (index == gs_color_space_index_DeviceGray)
- lputs(s, "0");
- else {
- if (format == gs_image_format_chunky) /* RGBRGBRGB... */
- sputc(s, 0x3a);
- else /* RRR...GGG...BBB... */
- sputc(s, 0x3b);
- }
- }
- if (interpolate > 0)
- sput_lips_int(s, interpolate);
- sputc(s, LIPS_IS2);
+ stream *s = gdev_vector_stream((gx_device_vector *) pdev);
+ int ax, ay, bx, by, cx, cy, dx, dy;
+ int tbyte;
+ gs_matrix imat;
+ int interpolate = 0;
+
+ if (pdev->TextMode) {
+ sputc(s, LIPS_CSI);
+ lputs(s, "&}");
+ pdev->TextMode = FALSE;
+ }
+ gs_matrix_invert(&pim->ImageMatrix, &imat);
+ gs_matrix_multiply(&imat, &ctm_only(pis), &imat);
+ /*
+ [xx xy yx yy tx ty]
+ LIPS ¤ÎºÂɸ·Ï¤ËÊÑ´¹¤ò¹Ô¤Ê¤¦¡£
+
+ }U{Ax}{Ay}{Bx}{By}{Cx}{Cy}{pie->height}{pie->width}
+ {pim->BitsPerComponent}{0}{0}{1} LIPS_IS2
+ */
+
+ /* }Q110{byte} LIPS_IS2 */
+ ax = imat.tx;
+ ay = imat.ty;
+ bx = imat.xx * pim->Width + imat.yx * pim->Height + imat.tx;
+ by = imat.xy * pim->Width + imat.yy * pim->Height + imat.ty;
+ cx = imat.yx * pim->Height + imat.tx;
+ cy = imat.yy * pim->Height + imat.ty;
+ dx = imat.xx * pim->Width + imat.tx;
+ dy = imat.xy * pim->Width + imat.ty;
+
+ if (pim->ImageMask) {
+ tbyte =
+ (pie->width * pim->BitsPerComponent +
+ 7) / 8 * num_components * pie->height;
+ pdev->ncomp = 1;
+ if (tbyte == 1) {
+ /* LIPS IV ¤Ç¤Ï 1 dot ¤Î¥¤¥á¡¼¥¸¤òÊÑ·Á¤¹¤ë¤ÈºÂɸ¤¬¶¸¤¦¥Ð¥°¤¬
+ ¤¢¤ë¡£¤è¤Ã¤Æ 1 dot ¤Î¥¤¥á¡¼¥¸¤Ï¶ë·Á¤È¤·¤Æ½èÍý¤¹¤ë¡£ */
+ pdev->OneBitMask = true;
+ /* Draw Rectangle */
+ lputs(s, "2");
+ sput_lips_int(s, ax);
+ sput_lips_int(s, ay);
+ sput_lips_int(s, cx - ax);
+ sput_lips_int(s, cy - ay);
+ sput_lips_int(s, bx - cx);
+ sput_lips_int(s, by - cy);
+ sput_lips_int(s, dx - bx);
+ sput_lips_int(s, dy - by);
+ sputc(s, LIPS_IS2);
+ return 0;
+ } else {
+ /* ÉÁ²èÏÀÍýÀßÄêÌ¿Îá - Æ©²á */
+ if (pdev->MaskState != 1) {
+ lputs(s, "}H1");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 1;
+ }
+ }
+ } else {
+ /* ÉÁ²èÏÀÍýÀßÄêÌ¿Îá - ÇòÅɤê */
+ if (pdev->MaskState != 0) {
+ lputs(s, "}H0");
+ sputc(s, LIPS_IS2);
+ pdev->MaskState = 0;
+ }
+ pdev->ncomp = num_components;
+ }
+
+ lputs(s, "}U");
+ sput_lips_int(s, ax);
+ sput_lips_int(s, ay);
+ sput_lips_int(s, bx);
+ sput_lips_int(s, by);
+ sput_lips_int(s, cx);
+ sput_lips_int(s, cy);
+ sput_lips_int(s, pie->height);
+ sput_lips_int(s, pie->width);
+ sput_lips_int(s, pim->BitsPerComponent);
+
+ if (pim->Interpolate) {
+ if (pim->BitsPerComponent * pie->num_planes == 1)
+ interpolate = 1;
+ else
+ interpolate = 3;
+ }
+ if (pim->ImageMask) { /* 1bit ¤Î¤È¤­ */
+ lputs(s, "0");
+ } else {
+ if (index == gs_color_space_index_DeviceGray)
+ lputs(s, "0");
+ else {
+ if (format == gs_image_format_chunky) /* RGBRGBRGB... */
+ sputc(s, 0x3a);
+ else /* RRR...GGG...BBB... */
+ sputc(s, 0x3b);
+ }
+ }
+ if (interpolate > 0)
+ sput_lips_int(s, interpolate);
+ sputc(s, LIPS_IS2);
}
return 0;
}
@@ -2411,8 +2394,8 @@ lips4v_begin_image(gx_device * dev,
/* Process the next piece of an image. */
static int
lips4v_image_plane_data(gx_image_enum_common_t * info,
- const gx_image_plane_t * planes, int height,
- int *rows_used)
+ const gx_image_plane_t * planes, int height,
+ int *rows_used)
{
gx_device *dev = info->dev;
gx_device_vector *const vdev = (gx_device_vector *) dev;
@@ -2423,43 +2406,43 @@ lips4v_image_plane_data(gx_image_enum_common_t * info,
int y;
if (pdev->OneBitMask) {
- /*
- lputs(s, "\200");
- */
- pie->y += height;
- return 1;
+ /*
+ lputs(s, "\200");
+ */
+ pie->y += height;
+ return 1;
}
if (pie->default_info)
- return gx_image_plane_data(pie->default_info, planes, height);
+ return gx_image_plane_data(pie->default_info, planes, height);
gx_image_plane_data(pie->bbox_info, planes, height);
{
- int plane;
- int width_bytes, tbyte;
- byte *buf;
+ int plane;
+ int width_bytes, tbyte;
+ byte *buf;
- width_bytes =
- (pie->width * pie->bits_per_pixel / pdev->ncomp +
- 7) / 8 * pdev->ncomp;
- tbyte = width_bytes * height;
- buf = gs_alloc_bytes(vdev->memory, tbyte, "lips4v_image_data(buf)");
+ width_bytes =
+ (pie->width * pie->bits_per_pixel / pdev->ncomp +
+ 7) / 8 * pdev->ncomp;
+ tbyte = width_bytes * height;
+ buf = gs_alloc_bytes(vdev->memory, tbyte, "lips4v_image_data(buf)");
- for (plane = 0; plane < pie->num_planes; ++plane)
- for (y = 0; y < height; ++y) {
- memcpy(buf + y * width_bytes,
- planes[plane].data +
- ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
- + y * planes[plane].raster, width_bytes);
- }
+ for (plane = 0; plane < pie->num_planes; ++plane)
+ for (y = 0; y < height; ++y) {
+ memcpy(buf + y * width_bytes,
+ planes[plane].data +
+ ((planes[plane].data_x * pie->bits_per_pixel) >> 3)
+ + y * planes[plane].raster, width_bytes);
+ }
- lputs(s, "}Q10");
+ lputs(s, "}Q10");
- if ((pie->bits_per_pixel > 1 && pdev->ncomp == 1) ||
- pdev->MaskReverse == 0) {
- lips4v_write_image_data(vdev, buf, tbyte, TRUE);
- } else
- lips4v_write_image_data(vdev, buf, tbyte, FALSE);
+ if ((pie->bits_per_pixel > 1 && pdev->ncomp == 1) ||
+ pdev->MaskReverse == 0) {
+ lips4v_write_image_data(vdev, buf, tbyte, TRUE);
+ } else
+ lips4v_write_image_data(vdev, buf, tbyte, FALSE);
- gs_free_object(vdev->memory, buf, "lips4v_image_data(buf)");
+ gs_free_object(vdev->memory, buf, "lips4v_image_data(buf)");
}
@@ -2477,14 +2460,14 @@ lips4v_image_end_image(gx_image_enum_common_t * info, bool draw_last)
int code;
if (pdev->OneBitMask)
- pdev->OneBitMask = false;
+ pdev->OneBitMask = false;
else
- lputs(s, "}Q1100");
- sputc(s, LIPS_IS2); /* End of Image */
+ lputs(s, "}Q1100");
+ sputc(s, LIPS_IS2); /* End of Image */
pdev->MaskReverse = -1;
code = gdev_vector_end_image(vdev, (gdev_vector_image_enum_t *) pie,
- draw_last, pdev->white);
+ draw_last, pdev->white);
return code;
}
diff --git a/gs/contrib/lips4/gdevlips.c b/gs/contrib/lips4/gdevlips.c
index b24c36589..11aa8323d 100644
--- a/gs/contrib/lips4/gdevlips.c
+++ b/gs/contrib/lips4/gdevlips.c
@@ -56,14 +56,14 @@ lips_media_selection(int width, int height)
paper_table *pt;
if (width > height) {
- landscape = 1;
- tmp = width;
- width = height;
- height = tmp;
+ landscape = 1;
+ tmp = width;
+ width = height;
+ height = tmp;
}
for (pt = lips_paper_table; pt->num_unit < 80; pt++)
- if (pt->width == width && pt->height == height)
- break;
+ if (pt->width == width && pt->height == height)
+ break;
return pt->num_unit + landscape;
}
@@ -78,26 +78,26 @@ lips_packbits_encode(byte * inBuff, byte * outBuff, int Length)
int size = 0;
while (Length) {
- int count;
-
- if (1 < (count = GetNumSameData(inBuff,
- Length > 128 ? 128 : Length))) {
- Length -= count;
- size += 2;
-
- *outBuff++ = -(count - 1);
- *outBuff++ = *inBuff;
- inBuff += count;
- } else {
- count = GetNumWrongData(inBuff, Length > 128 ? 128 : Length);
- Length -= count;
- size += count + 1;
-
- *outBuff++ = count - 1;
- while (count--) {
- *outBuff++ = *inBuff++;
- }
- }
+ int count;
+
+ if (1 < (count = GetNumSameData(inBuff,
+ Length > 128 ? 128 : Length))) {
+ Length -= count;
+ size += 2;
+
+ *outBuff++ = -(count - 1);
+ *outBuff++ = *inBuff;
+ inBuff += count;
+ } else {
+ count = GetNumWrongData(inBuff, Length > 128 ? 128 : Length);
+ Length -= count;
+ size += count + 1;
+
+ *outBuff++ = count - 1;
+ while (count--) {
+ *outBuff++ = *inBuff++;
+ }
+ }
}
return (size);
@@ -112,26 +112,26 @@ lips_mode3format_encode(byte * inBuff, byte * outBuff, int Length)
int size = 0;
while (Length) {
- int count;
-
- if (1 < (count = GetNumSameData(inBuff,
- Length > 257 ? 257 : Length))) {
- Length -= count;
- size += 3;
-
- *outBuff++ = *inBuff;
- *outBuff++ = *inBuff;
- *outBuff++ = count - 2;
- inBuff += count;
- } else {
- count = GetNumWrongData(inBuff, Length);
- Length -= count;
- size += count;
-
- while (count--) {
- *outBuff++ = *inBuff++;
- }
- }
+ int count;
+
+ if (1 < (count = GetNumSameData(inBuff,
+ Length > 257 ? 257 : Length))) {
+ Length -= count;
+ size += 3;
+
+ *outBuff++ = *inBuff;
+ *outBuff++ = *inBuff;
+ *outBuff++ = count - 2;
+ inBuff += count;
+ } else {
+ count = GetNumWrongData(inBuff, Length);
+ Length -= count;
+ size += count;
+
+ while (count--) {
+ *outBuff++ = *inBuff++;
+ }
+ }
}
return (size);
@@ -143,10 +143,10 @@ GetNumSameData(const byte * curPtr, const int maxnum)
int count = 1;
if (1 == maxnum) {
- return (1);
+ return (1);
}
while (*curPtr == *(curPtr + count) && maxnum > count) {
- count++;
+ count++;
}
return (count);
@@ -158,16 +158,15 @@ GetNumWrongData(const byte * curPtr, const int maxnum)
int count = 0;
if (1 == maxnum) {
- return (1);
+ return (1);
}
while (*(curPtr + count) != *(curPtr + count + 1) && maxnum > count) {
- count++;
+ count++;
}
return (count);
}
-
/*
This routine takes from gdevlips4-1.1.0.
@@ -186,22 +185,22 @@ lips_rle_encode(byte * inBuff, byte * outBuff, int Length)
ptr++;
while (ptr < inBuff + Length) {
- if (*ptr == value) {
- count++;
- if (count > RLECOUNTMAX) {
- *outBuff++ = RLECOUNTMAX;
- *outBuff++ = value;
- i += 2;
- count = 0;
- }
- } else {
- *outBuff++ = count;
- *outBuff++ = value;
- i += 2;
- count = 0;
- value = *ptr;
- }
- ptr++;
+ if (*ptr == value) {
+ count++;
+ if (count > RLECOUNTMAX) {
+ *outBuff++ = RLECOUNTMAX;
+ *outBuff++ = value;
+ i += 2;
+ count = 0;
+ }
+ } else {
+ *outBuff++ = count;
+ *outBuff++ = value;
+ i += 2;
+ count = 0;
+ value = *ptr;
+ }
+ ptr++;
}
*outBuff++ = count;
*outBuff++ = value;
diff --git a/gs/contrib/lips4/gdevlips.h b/gs/contrib/lips4/gdevlips.h
index 0236115a8..0083d70f9 100644
--- a/gs/contrib/lips4/gdevlips.h
+++ b/gs/contrib/lips4/gdevlips.h
@@ -103,8 +103,8 @@
#define LIPS_FACEUP_DEFAULT FALSE
/* display text to printer panel */
-#define LIPS_USERNAME_MAX 12 /* If your printer have two line display,
- this value can change to 14 */
+#define LIPS_USERNAME_MAX 12 /* If your printer have two line display,
+ this value can change to 14 */
#define LIPS_MEDIACHAR_MAX 32
#define LIPS_USERNAME_DEFAULT "Ghostscript"
#define LIPS_MEDIATYPE_DEFAULT "Default" /* Dummy */
diff --git a/gs/contrib/lips4/gdevlprn.c b/gs/contrib/lips4/gdevlprn.c
index db8bc4931..92510d7c3 100644
--- a/gs/contrib/lips4/gdevlprn.c
+++ b/gs/contrib/lips4/gdevlprn.c
@@ -28,7 +28,7 @@
/*
************************
- * This Library Options *
+ * This Library Options *
************************
-dTumble : for Duplex
@@ -54,31 +54,31 @@ lprn_get_params(gx_device * dev, gs_param_list * plist)
int ncode;
if (code < 0)
- return code;
+ return code;
if ((ncode = param_write_bool(plist, "ManualFeed", &lprn->ManualFeed)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_bool(plist, "NegativePrint", &lprn->NegativePrint)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_bool(plist, "Tumble", &lprn->Tumble)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_bool(plist, "RITOff", &lprn->RITOff)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_int(plist, "BlockLine", &lprn->BlockLine)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_int(plist, "BlockWidth", &lprn->nBw)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_int(plist, "BlockHeight", &lprn->nBh)) < 0)
- code = ncode;
+ code = ncode;
if ((ncode = param_write_bool(plist, "ShowBubble", &lprn->ShowBubble)) < 0)
- code = ncode;
+ code = ncode;
return code;
}
@@ -101,84 +101,84 @@ lprn_put_params(gx_device * dev, gs_param_list * plist)
bool ShowBubble = lprn->ShowBubble;
if ((code = param_read_bool(plist,
- (param_name = "ManualFeed"),
- &ManualFeed)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = "ManualFeed"),
+ &ManualFeed)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
if ((code = param_read_bool(plist,
- (param_name = "NegativePrint"),
- &NegativePrint)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = "NegativePrint"),
+ &NegativePrint)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
if ((code = param_read_bool(plist,
- (param_name = "Tumble"),
- &Tumble)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = "Tumble"),
+ &Tumble)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
if ((code = param_read_bool(plist,
- (param_name = "RITOff"),
- &RITOff)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = "RITOff"),
+ &RITOff)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
switch (code = param_read_int(plist,
- (param_name = "BlockWidth"),
- &BlockWidth)) {
- case 0:
- if (BlockWidth < 0)
- ecode = gs_error_rangecheck;
- else
- break;
- goto bwidthe;
- default:
- ecode = code;
- bwidthe:param_signal_error(plist, param_name, ecode = code);
- case 1:
- break;
+ (param_name = "BlockWidth"),
+ &BlockWidth)) {
+ case 0:
+ if (BlockWidth < 0)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto bwidthe;
+ default:
+ ecode = code;
+ bwidthe:param_signal_error(plist, param_name, ecode = code);
+ case 1:
+ break;
}
switch (code = param_read_int(plist,
- (param_name = "BlockLine"),
- &BlockLine)) {
- case 0:
- if (BlockLine < 0)
- ecode = gs_error_rangecheck;
- else
- break;
- goto crowe;
- default:
- ecode = code;
- crowe:param_signal_error(plist, param_name, ecode = code);
- case 1:
- break;
+ (param_name = "BlockLine"),
+ &BlockLine)) {
+ case 0:
+ if (BlockLine < 0)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto crowe;
+ default:
+ ecode = code;
+ crowe:param_signal_error(plist, param_name, ecode = code);
+ case 1:
+ break;
}
switch (code = param_read_int(plist,
- (param_name = "BlockHeight"),
- &BlockHeight)) {
- case 0:
- if (BlockHeight < 0)
- ecode = gs_error_rangecheck;
- else
- break;
- goto bheighte;
- default:
- ecode = code;
- bheighte:param_signal_error(plist, param_name, ecode = code);
- case 1:
- break;
+ (param_name = "BlockHeight"),
+ &BlockHeight)) {
+ case 0:
+ if (BlockHeight < 0)
+ ecode = gs_error_rangecheck;
+ else
+ break;
+ goto bheighte;
+ default:
+ ecode = code;
+ bheighte:param_signal_error(plist, param_name, ecode = code);
+ case 1:
+ break;
}
if ((code = param_read_bool(plist,
- (param_name = "ShowBubble"),
- &ShowBubble)) < 0) {
- param_signal_error(plist, param_name, ecode = code);
+ (param_name = "ShowBubble"),
+ &ShowBubble)) < 0) {
+ param_signal_error(plist, param_name, ecode = code);
}
if (ecode < 0)
- return ecode;
+ return ecode;
code = gdev_prn_put_params(dev, plist);
if (code < 0)
- return code;
+ return code;
lprn->ManualFeed = ManualFeed;
lprn->NegativePrint = NegativePrint;
@@ -220,44 +220,44 @@ lprn_print_image(gx_device_printer * pdev, FILE * fp)
maxY = lprn->BlockLine / lprn->nBh * lprn->nBh;
if (!(lprn->ImageBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl, maxY, "lprn_print_image(ImageBuf)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(lprn->TmpBuf = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl, maxY, "lprn_print_iamge(TmpBuf)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(lprn->bubbleTbl = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(Bubble *), maxBx, "lprn_print_image(bubbleTbl)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
if (!(bubbleBuffer = gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(Bubble), maxBx, "lprn_print_image(bubbleBuffer)")))
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
for (i = 0; i < maxBx; i++)
- lprn->bubbleTbl[i] = NULL;
+ lprn->bubbleTbl[i] = NULL;
bbtbl = bubbleBuffer;
for (i = 0; i < maxBx - 1; i++)
- bbtbl[i].next = &bbtbl[i + 1];
+ bbtbl[i].next = &bbtbl[i + 1];
bbtbl[i].next = NULL;
lprn->freeBubbleList = &bbtbl[0];
for (y = 0; y < maxBy; y++) {
- if (num_y_blocks + lprn->nBh > maxY) { /* bubble flush for next data */
- rmin = start_y_block + lprn->nBh; /* process the data under rmin */
- for (i = 0; i < maxBx; i++) {
- bbl = lprn->bubbleTbl[i];
- if (bbl != NULL && bbl->brect.p.y < rmin)
- lprn_bubble_flush(pdev, fp, bbl);
- }
- num_y_blocks -= lprn->nBh; /* data if keeps in [r:r+h] */
- start_y_block += lprn->nBh;
-
- }
- ri = start_y_block + num_y_blocks; /* read position */
- read_y = ri % maxY; /* end of read position */
- code = gdev_prn_copy_scan_lines(pdev, ri, lprn->ImageBuf + bpl * read_y, bpl * lprn->nBh);
- if (code < 0)
- return code;
-
- num_y_blocks += lprn->nBh;
-
- lprn_process_line(pdev, fp, start_y_block, num_y_blocks);
+ if (num_y_blocks + lprn->nBh > maxY) { /* bubble flush for next data */
+ rmin = start_y_block + lprn->nBh; /* process the data under rmin */
+ for (i = 0; i < maxBx; i++) {
+ bbl = lprn->bubbleTbl[i];
+ if (bbl != NULL && bbl->brect.p.y < rmin)
+ lprn_bubble_flush(pdev, fp, bbl);
+ }
+ num_y_blocks -= lprn->nBh; /* data if keeps in [r:r+h] */
+ start_y_block += lprn->nBh;
+
+ }
+ ri = start_y_block + num_y_blocks; /* read position */
+ read_y = ri % maxY; /* end of read position */
+ code = gdev_prn_copy_scan_lines(pdev, ri, lprn->ImageBuf + bpl * read_y, bpl * lprn->nBh);
+ if (code < 0)
+ return code;
+
+ num_y_blocks += lprn->nBh;
+
+ lprn_process_line(pdev, fp, start_y_block, num_y_blocks);
}
lprn_bubble_flush_all(pdev, fp); /* flush the rest of bubble */
@@ -269,7 +269,6 @@ lprn_print_image(gx_device_printer * pdev, FILE * fp)
return code;
}
-
/*
* epag_bubble_flush_all: Output the rect of bubble.
*/
@@ -282,10 +281,10 @@ lprn_bubble_flush_all(gx_device_printer * pdev, FILE * fp)
int maxBx = (bpl + lprn->nBw - 1) / lprn->nBw;
for (i = 0; i < maxBx; i++) {
- if (lprn->bubbleTbl[i] != NULL) {
- lprn_bubble_flush(pdev, fp, lprn->bubbleTbl[i]);
- } else
- break;
+ if (lprn->bubbleTbl[i] != NULL) {
+ lprn_bubble_flush(pdev, fp, lprn->bubbleTbl[i]);
+ } else
+ break;
}
}
@@ -303,21 +302,21 @@ lprn_process_line(gx_device_printer * pdev, FILE * fp, int r, int h)
bInBlack = 0;
for (bx = 0; bx < maxBx; bx++) {
- bBlack = lprn_is_black(pdev, r, h, bx);
- if (!bInBlack) {
- if (bBlack) {
- start = bx;
- bInBlack = 1;
- }
- } else {
- if (!bBlack) {
- bInBlack = 0;
- lprn_rect_add(pdev, fp, r, h, start, bx);
- }
- }
+ bBlack = lprn_is_black(pdev, r, h, bx);
+ if (!bInBlack) {
+ if (bBlack) {
+ start = bx;
+ bInBlack = 1;
+ }
+ } else {
+ if (!bBlack) {
+ bInBlack = 0;
+ lprn_rect_add(pdev, fp, r, h, start, bx);
+ }
+ }
}
if (bInBlack)
- lprn_rect_add(pdev, fp, r, h, start, bx - 1);
+ lprn_rect_add(pdev, fp, r, h, start, bx - 1);
}
/* Search the bx line to make output */
@@ -334,10 +333,10 @@ lprn_is_black(gx_device_printer * pdev, int r, int h, int bx)
y0 = (r + h - bh) % maxY;
for (y = 0; y < bh; y++) {
- p = &lprn->ImageBuf[(y0 + y) * bpl + bx * lprn->nBw];
- for (x = 0; x < lprn->nBw; x++)
- if (p[x] != 0)
- return 1;
+ p = &lprn->ImageBuf[(y0 + y) * bpl + bx * lprn->nBw];
+ for (x = 0; x < lprn->nBw; x++)
+ if (p[x] != 0)
+ return 1;
}
return 0;
}
@@ -355,15 +354,15 @@ lprn_rect_add(gx_device_printer * pdev, FILE * fp, int r, int h, int start, int
Bubble *bbl;
if ((bbl = lprn->bubbleTbl[start]) != NULL &&
- bbl->brect.q.y == y0 - 1 &&
- bbl->brect.p.x == x0 &&
- bbl->brect.q.x == x1) {
- bbl->brect.q.y = y1;
+ bbl->brect.q.y == y0 - 1 &&
+ bbl->brect.p.x == x0 &&
+ bbl->brect.q.x == x1) {
+ bbl->brect.q.y = y1;
} else {
- for (i = start; i <= end; i++)
- if (lprn->bubbleTbl[i] != NULL)
- lprn_bubble_flush(pdev, fp, lprn->bubbleTbl[i]);
- lprn_bubble_gen(pdev, x0, x1, y0, y1);
+ for (i = start; i <= end; i++)
+ if (lprn->bubbleTbl[i] != NULL)
+ lprn_bubble_flush(pdev, fp, lprn->bubbleTbl[i]);
+ lprn_bubble_gen(pdev, x0, x1, y0, y1);
}
}
@@ -389,8 +388,8 @@ lprn_bubble_gen(gx_device_printer * pdev, int x0, int x1, int y0, int y1)
bx1 = (x1 + lprn->nBw - 1) / lprn->nBw;
for (bx = bx0; bx <= bx1; bx++) {
- assert(lprn->bubbleTbl[bx] == NULL);
- lprn->bubbleTbl[bx] = bbl;
+ assert(lprn->bubbleTbl[bx] == NULL);
+ lprn->bubbleTbl[bx] = bbl;
}
}
@@ -411,21 +410,21 @@ lprn_bubble_flush(gx_device_printer * pdev, FILE * fp, Bubble * bbl)
int maxY = lprn->BlockLine / lprn->nBh * lprn->nBh;
for (i = 0; i < height; i++) {
- p = lprn->ImageBuf + ((i + y) % maxY) * bpl;
- for (j = 0; j < width / 8; j++) {
- if (lprn->NegativePrint)
- *(lprn->TmpBuf + i * width / 8 + j) = ~*(p + j + bbl->brect.p.x);
- else
- *(lprn->TmpBuf + i * width / 8 + j) = *(p + j + bbl->brect.p.x);
- }
+ p = lprn->ImageBuf + ((i + y) % maxY) * bpl;
+ for (j = 0; j < width / 8; j++) {
+ if (lprn->NegativePrint)
+ *(lprn->TmpBuf + i * width / 8 + j) = ~*(p + j + bbl->brect.p.x);
+ else
+ *(lprn->TmpBuf + i * width / 8 + j) = *(p + j + bbl->brect.p.x);
+ }
}
(*lprn->image_out) (pdev, fp, x, y, width, height);
/* Initialize bubbleTbl */
for (bx = bx0; bx <= bx1; bx++) {
- assert(lprn->bubbleTbl[bx] == bbl);
- lprn->bubbleTbl[bx] = NULL;
+ assert(lprn->bubbleTbl[bx] == bbl);
+ lprn->bubbleTbl[bx] = NULL;
}
bbl->next = lprn->freeBubbleList;
diff --git a/gs/contrib/lips4/gdevlprn.h b/gs/contrib/lips4/gdevlprn.h
index a45001189..fcbe37bba 100644
--- a/gs/contrib/lips4/gdevlprn.h
+++ b/gs/contrib/lips4/gdevlprn.h
@@ -39,24 +39,24 @@
#define dev_proc_image_out(proc) lprn_dev_proc_image_out(proc)
#define gx_lprn_device_common\
- lprn_dev_proc_image_out((*image_out));\
+ lprn_dev_proc_image_out((*image_out));\
bool initialized;\
bool ManualFeed;\
bool NegativePrint;\
- bool Tumble; /* for Duplex */\
- bool RITOff; /* currently only escpage.dev use this */\
- int prev_x;\
- int prev_y;\
- int BlockLine;\
- byte *ImageBuf; /* Image Buffer */\
- byte *TmpBuf; /* Tmporary buffer */\
- byte *CompBuf; /* Compress buffer */\
- byte *CompBuf2; /* Compress buffer */\
- int nBw; /* block width (byte,8dot) */\
- int nBh; /* block height(line) */\
- struct _Bubble **bubbleTbl;\
- struct _Bubble *freeBubbleList;\
- bool ShowBubble
+ bool Tumble; /* for Duplex */\
+ bool RITOff; /* currently only escpage.dev use this */\
+ int prev_x;\
+ int prev_y;\
+ int BlockLine;\
+ byte *ImageBuf; /* Image Buffer */\
+ byte *TmpBuf; /* Tmporary buffer */\
+ byte *CompBuf; /* Compress buffer */\
+ byte *CompBuf2; /* Compress buffer */\
+ int nBw; /* block width (byte,8dot) */\
+ int nBh; /* block height(line) */\
+ struct _Bubble **bubbleTbl;\
+ struct _Bubble *freeBubbleList;\
+ bool ShowBubble
#define lp_device_body_rest_(print_page_copies, image_out)\
prn_device_body_rest2_(NULL, print_page_copies, -1),\
@@ -91,7 +91,7 @@
0 /*false */
#define lprn_device(dtype, procs, dname, xdpi, ydpi, lm, bm, rm, tm, color_bits,\
- print_page_copies, image_out)\
+ print_page_copies, image_out)\
{ std_device_std_color_full_body(dtype, &procs, dname,\
(int)((long)(DEFAULT_WIDTH_10THS) * (xdpi) / 10),\
(int)((long)(DEFAULT_HEIGHT_10THS) * (ydpi) / 10),\
@@ -104,7 +104,7 @@
}
#define lprn_duplex_device(dtype, procs, dname, xdpi, ydpi, lm, bm, rm, tm, color_bits,\
- print_page_copies, image_out)\
+ print_page_copies, image_out)\
{ std_device_std_color_full_body(dtype, &procs, dname,\
(int)((long)(DEFAULT_WIDTH_10THS) * (xdpi) / 10),\
(int)((long)(DEFAULT_HEIGHT_10THS) * (ydpi) / 10),\
diff --git a/gs/contrib/opvp/gdevopvp.c b/gs/contrib/opvp/gdevopvp.c
index 1d113c453..d27227956 100644
--- a/gs/contrib/opvp/gdevopvp.c
+++ b/gs/contrib/opvp/gdevopvp.c
@@ -369,7 +369,6 @@ gs_public_st_suffix_add0_final(
NULL /* discard_transparency_layer */\
}
-
/* vector procs */
static gx_device_vector_procs opvp_vector_procs =
{
@@ -1198,7 +1197,6 @@ typedef struct bbox_image_enum_s {
/* The following is already defined in stdpre.h */
/*#define min(a, b) (((a) < (b))? (a) : (b))*/
-
/* ----- Utilities ----- */
/* initialize Graphic State */
@@ -3009,7 +3007,6 @@ opvp_copy_color(
ecode = code;
}
-
#if !(ENABLE_SIMPLE_MODE)
/* call RestoreGS */
if (apiEntry->opvpRestoreGS) {
@@ -3444,19 +3441,19 @@ static int checkPath(const gx_path *ppath)
gx_path_enum_init(&path, ppath);
while ((op = gx_path_enum_next(&path, (gs_fixed_point *)vs)) != 0) {
- switch (op) {
- case gs_pe_lineto:
- case gs_pe_moveto:
+ switch (op) {
+ case gs_pe_lineto:
+ case gs_pe_moveto:
npoints += 1;
- break;
- case gs_pe_curveto:
+ break;
+ case gs_pe_curveto:
npoints += 3;
- break;
- case gs_pe_closepath:
- break;
- default:
- break;
- }
+ break;
+ case gs_pe_closepath:
+ break;
+ default:
+ break;
+ }
if (npoints > MAX_PATH_POINTS) {
return 0;
}
@@ -3507,7 +3504,7 @@ opvp_fill_path(
/* check if paths are too complex */
if (!checkPath(ppath) || !checkCPath(pxpath)) {
- return gx_default_fill_path(dev, pis, ppath, params, pdevc, pxpath);
+ return gx_default_fill_path(dev, pis, ppath, params, pdevc, pxpath);
}
/* check clippath support */
if (!(apiEntry->opvpSetClipPath)) {
@@ -3546,8 +3543,8 @@ opvp_stroke_path(
/* check if paths are too complex */
if (!checkPath(ppath) || !checkCPath(pxpath)) {
- return gx_default_stroke_path(dev, pis, ppath,
- params, pdcolor, pxpath);
+ return gx_default_stroke_path(dev, pis, ppath,
+ params, pdcolor, pxpath);
}
/* check clippath support */
if (!(apiEntry->opvpSetClipPath)) {
diff --git a/gs/contrib/opvp/opvp.h b/gs/contrib/opvp/opvp.h
index 37aa1cdaa..426e8cf74 100644
--- a/gs/contrib/opvp/opvp.h
+++ b/gs/contrib/opvp/opvp.h
@@ -36,14 +36,14 @@
#define OPVP_OK 0 /* -1 for errors */
#define OPVP_FATALERROR -1 /* error: cannot be recovered */
#define OPVP_BADREQUEST -2 /* error: called where it should
- not be called */
+ not be called */
#define OPVP_BADCONTEXT -3 /* error: invalid printer context */
#define OPVP_NOTSUPPORTED -4 /* error: combination of
- parameters are set
- which cannot be handled
- by driver or printer */
+ parameters are set
+ which cannot be handled
+ by driver or printer */
#define OPVP_JOBCANCELED -5 /* error: job has been canceled
- by some cause */
+ by some cause */
#define OPVP_PARAMERROR -6 /* error: invalid parameter */
#define OPVP_VERSIONERROR -7 /* error: invalid API version */
@@ -66,134 +66,134 @@ typedef unsigned int opvp_rop_t; /* raster operation */
/* convert macro */
#define OPVP_I2FIX(i,fix) (fix=i<<OPVP_FIX_FRACT_WIDTH)
#define OPVP_F2FIX(f,fix) (fix=((int)floor(f)<<OPVP_FIX_FRACT_WIDTH)\
- |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
- &(OPVP_FIX_FRACT_DENOM-1)))
+ |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
+ &(OPVP_FIX_FRACT_DENOM-1)))
/* graphic elements */
typedef struct _opvp_point {
- opvp_fix_t x, y;
+ opvp_fix_t x, y;
} opvp_point_t;
typedef struct _opvp_rectangle {
- opvp_point_t p0; /* start point */
- opvp_point_t p1; /* diagonal point */
+ opvp_point_t p0; /* start point */
+ opvp_point_t p1; /* diagonal point */
} opvp_rectangle_t;
typedef struct _opvp_roundrectangle {
- opvp_point_t p0; /* start point */
- opvp_point_t p1; /* diagonal point */
- opvp_fix_t xellipse, yellipse;
+ opvp_point_t p0; /* start point */
+ opvp_point_t p1; /* diagonal point */
+ opvp_fix_t xellipse, yellipse;
} opvp_roundrectangle_t;
/* Image Formats */
typedef enum _opvp_imageformat {
- OPVP_IFORMAT_RAW = 0,
- OPVP_IFORMAT_MASK = 1,
- OPVP_IFORMAT_RLE = 2,
- OPVP_IFORMAT_JPEG = 3,
- OPVP_IFORMAT_PNG = 4
+ OPVP_IFORMAT_RAW = 0,
+ OPVP_IFORMAT_MASK = 1,
+ OPVP_IFORMAT_RLE = 2,
+ OPVP_IFORMAT_JPEG = 3,
+ OPVP_IFORMAT_PNG = 4
} opvp_imageformat_t;
/* Color Presentation */
typedef enum _opvp_colormapping {
- OPVP_CMAP_DIRECT = 0,
- OPVP_CMAP_INDEXED = 1
+ OPVP_CMAP_DIRECT = 0,
+ OPVP_CMAP_INDEXED = 1
} opvp_colormapping_t;
typedef enum _opvp_cspace {
- OPVP_CSPACE_BW = 0,
- OPVP_CSPACE_DEVICEGRAY = 1,
- OPVP_CSPACE_DEVICECMY = 2,
- OPVP_CSPACE_DEVICECMYK = 3,
- OPVP_CSPACE_DEVICERGB = 4,
- OPVP_CSPACE_DEVICEKRGB = 5,
- OPVP_CSPACE_STANDARDRGB = 6,
- OPVP_CSPACE_STANDARDRGB64 = 7
+ OPVP_CSPACE_BW = 0,
+ OPVP_CSPACE_DEVICEGRAY = 1,
+ OPVP_CSPACE_DEVICECMY = 2,
+ OPVP_CSPACE_DEVICECMYK = 3,
+ OPVP_CSPACE_DEVICERGB = 4,
+ OPVP_CSPACE_DEVICEKRGB = 5,
+ OPVP_CSPACE_STANDARDRGB = 6,
+ OPVP_CSPACE_STANDARDRGB64 = 7
} opvp_cspace_t;
/* Fill, Paint, Clip */
typedef enum _opvp_fillmode {
- OPVP_FILLMODE_EVENODD = 0,
- OPVP_FILLMODE_WINDING = 1
+ OPVP_FILLMODE_EVENODD = 0,
+ OPVP_FILLMODE_WINDING = 1
} opvp_fillmode_t;
typedef enum _opvp_paintmode {
- OPVP_PAINTMODE_OPAQUE = 0,
- OPVP_PAINTMODE_TRANSPARENT = 1
+ OPVP_PAINTMODE_OPAQUE = 0,
+ OPVP_PAINTMODE_TRANSPARENT = 1
} opvp_paintmode_t;
typedef enum _opvp_cliprule {
- OPVP_CLIPRULE_EVENODD = 0,
- OPVP_CLIPRULE_WINDING = 1
+ OPVP_CLIPRULE_EVENODD = 0,
+ OPVP_CLIPRULE_WINDING = 1
} opvp_cliprule_t;
/* Line */
typedef enum _opvp_linestyle {
- OPVP_LINESTYLE_SOLID = 0,
- OPVP_LINESTYLE_DASH = 1
+ OPVP_LINESTYLE_SOLID = 0,
+ OPVP_LINESTYLE_DASH = 1
} opvp_linestyle_t;
typedef enum _opvp_linecap {
- OPVP_LINECAP_BUTT = 0,
- OPVP_LINECAP_ROUND = 1,
- OPVP_LINECAP_SQUARE = 2
+ OPVP_LINECAP_BUTT = 0,
+ OPVP_LINECAP_ROUND = 1,
+ OPVP_LINECAP_SQUARE = 2
} opvp_linecap_t;
typedef enum _opvp_linejoin {
- OPVP_LINEJOIN_MITER = 0,
- OPVP_LINEJOIN_ROUND = 1,
- OPVP_LINEJOIN_BEVEL = 2
+ OPVP_LINEJOIN_MITER = 0,
+ OPVP_LINEJOIN_ROUND = 1,
+ OPVP_LINEJOIN_BEVEL = 2
} opvp_linejoin_t;
/* Brush */
typedef enum _opvp_bdtype {
- OPVP_BDTYPE_NORMAL = 0
+ OPVP_BDTYPE_NORMAL = 0
} opvp_bdtype_t;
typedef struct _opvp_brushdata {
- opvp_bdtype_t type;
- opvp_int_t width, height, pitch;
+ opvp_bdtype_t type;
+ opvp_int_t width, height, pitch;
#if defined(__GNUC__) && __GNUC__ <= 2
- opvp_byte_t data[1];
+ opvp_byte_t data[1];
#elif defined(__SUNPRO_C)
- opvp_byte_t data[1];
+ opvp_byte_t data[1];
#elif defined(__HP_cc)
- opvp_byte_t data[1];
+ opvp_byte_t data[1];
#else
- opvp_byte_t data[];
+ opvp_byte_t data[];
#endif
} opvp_brushdata_t;
typedef struct _opvp_brush {
- opvp_cspace_t colorSpace;
- opvp_int_t color[4]; /* aRGB quadruplet */
- opvp_int_t xorg, yorg; /* brush origin */
- /* ignored for opvpSetBgColor */
- opvp_brushdata_t *pbrush; /* pointer to brush data */
- /* solid brush used, if NULL */
+ opvp_cspace_t colorSpace;
+ opvp_int_t color[4]; /* aRGB quadruplet */
+ opvp_int_t xorg, yorg; /* brush origin */
+ /* ignored for opvpSetBgColor */
+ opvp_brushdata_t *pbrush; /* pointer to brush data */
+ /* solid brush used, if NULL */
} opvp_brush_t;
/* Misc. Flags */
typedef enum _opvp_arcmode {
- OPVP_ARC = 0,
- OPVP_CHORD = 1,
- OPVP_PIE = 2
+ OPVP_ARC = 0,
+ OPVP_CHORD = 1,
+ OPVP_PIE = 2
} opvp_arcmode_t;
typedef enum _opvp_arcdir {
- OPVP_CLOCKWISE = 0,
- OPVP_COUNTERCLOCKWISE = 1
+ OPVP_CLOCKWISE = 0,
+ OPVP_COUNTERCLOCKWISE = 1
} opvp_arcdir_t;
typedef enum _opvp_pathmode {
- OPVP_PATHCLOSE = 0,
- OPVP_PATHOPEN = 1
+ OPVP_PATHCLOSE = 0,
+ OPVP_PATHOPEN = 1
} opvp_pathmode_t;
/* CTM */
typedef struct _opvp_ctm {
- opvp_float_t a, b, c, d, e, f;
+ opvp_float_t a, b, c, d, e, f;
} opvp_ctm_t;
/* Device Information and Capabilites */
@@ -207,92 +207,91 @@ typedef enum _opvp_queryinfoflags {
OPVP_QF_MEDIADESTINATION = 0x00000040,
OPVP_QF_MEDIATYPE = 0x00000080,
OPVP_QF_MEDIACOPY = 0x00000100, /* Maximum copy number
- supported */
+ supported */
OPVP_QF_PRINTREGION = 0x00010000 /* only for opvpQueryDeviceInfo */
} opvp_queryinfoflags_t;
-
/* API Procedure Entries */
typedef struct _opvp_api_procs {
- opvp_dc_t (*opvpOpenPrinter)(opvp_int_t,const opvp_char_t*,const opvp_int_t[2],struct _opvp_api_procs**);
- opvp_result_t (*opvpClosePrinter)(opvp_dc_t);
- opvp_result_t (*opvpStartJob)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndJob)(opvp_dc_t);
- opvp_result_t (*opvpAbortJob)(opvp_dc_t);
- opvp_result_t (*opvpStartDoc)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndDoc)(opvp_dc_t);
- opvp_result_t (*opvpStartPage)(opvp_dc_t,const opvp_char_t*);
- opvp_result_t (*opvpEndPage)(opvp_dc_t);
- opvp_result_t (*opvpQueryDeviceCapability)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_byte_t*);
- opvp_result_t (*opvpQueryDeviceInfo)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_char_t*);
- opvp_result_t (*opvpResetCTM)(opvp_dc_t);
- opvp_result_t (*opvpSetCTM)(opvp_dc_t,const opvp_ctm_t*);
- opvp_result_t (*opvpGetCTM)(opvp_dc_t,opvp_ctm_t*);
- opvp_result_t (*opvpInitGS)(opvp_dc_t);
- opvp_result_t (*opvpSaveGS)(opvp_dc_t);
- opvp_result_t (*opvpRestoreGS)(opvp_dc_t);
- opvp_result_t (*opvpQueryColorSpace)(opvp_dc_t,opvp_int_t*,opvp_cspace_t*);
- opvp_result_t (*opvpSetColorSpace)(opvp_dc_t,opvp_cspace_t);
- opvp_result_t (*opvpGetColorSpace)(opvp_dc_t,opvp_cspace_t*);
- opvp_result_t (*opvpSetFillMode)(opvp_dc_t,opvp_fillmode_t);
- opvp_result_t (*opvpGetFillMode)(opvp_dc_t,opvp_fillmode_t*);
- opvp_result_t (*opvpSetAlphaConstant)(opvp_dc_t,opvp_float_t);
- opvp_result_t (*opvpGetAlphaConstant)(opvp_dc_t,opvp_float_t*);
- opvp_result_t (*opvpSetLineWidth)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetLineWidth)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetLineDash)(opvp_dc_t,opvp_int_t,const opvp_fix_t*);
- opvp_result_t (*opvpGetLineDash)(opvp_dc_t,opvp_int_t*,opvp_fix_t*);
- opvp_result_t (*opvpSetLineDashOffset)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetLineDashOffset)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetLineStyle)(opvp_dc_t,opvp_linestyle_t);
- opvp_result_t (*opvpGetLineStyle)(opvp_dc_t,opvp_linestyle_t*);
- opvp_result_t (*opvpSetLineCap)(opvp_dc_t,opvp_linecap_t);
- opvp_result_t (*opvpGetLineCap)(opvp_dc_t,opvp_linecap_t*);
- opvp_result_t (*opvpSetLineJoin)(opvp_dc_t,opvp_linejoin_t);
- opvp_result_t (*opvpGetLineJoin)(opvp_dc_t,opvp_linejoin_t*);
- opvp_result_t (*opvpSetMiterLimit)(opvp_dc_t,opvp_fix_t);
- opvp_result_t (*opvpGetMiterLimit)(opvp_dc_t,opvp_fix_t*);
- opvp_result_t (*opvpSetPaintMode)(opvp_dc_t,opvp_paintmode_t);
- opvp_result_t (*opvpGetPaintMode)(opvp_dc_t,opvp_paintmode_t*);
- opvp_result_t (*opvpSetStrokeColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpSetFillColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpSetBgColor)(opvp_dc_t,const opvp_brush_t*);
- opvp_result_t (*opvpNewPath)(opvp_dc_t);
- opvp_result_t (*opvpEndPath)(opvp_dc_t);
- opvp_result_t (*opvpStrokePath)(opvp_dc_t);
- opvp_result_t (*opvpFillPath)(opvp_dc_t);
- opvp_result_t (*opvpStrokeFillPath)(opvp_dc_t);
- opvp_result_t (*opvpSetClipPath)(opvp_dc_t,opvp_cliprule_t);
- opvp_result_t (*opvpResetClipPath)(opvp_dc_t);
- opvp_result_t (*opvpSetCurrentPoint)(opvp_dc_t,opvp_fix_t,opvp_fix_t);
- opvp_result_t (*opvpLinePath)(opvp_dc_t,opvp_pathmode_t,opvp_int_t,const opvp_point_t*);
- opvp_result_t (*opvpPolygonPath)(opvp_dc_t,opvp_int_t,const opvp_int_t*,const opvp_point_t*);
- opvp_result_t (*opvpRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_rectangle_t*);
- opvp_result_t (*opvpRoundRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_roundrectangle_t*);
- opvp_result_t (*opvpBezierPath)(opvp_dc_t,opvp_int_t,const opvp_point_t*);
- opvp_result_t (*opvpArcPath)(opvp_dc_t,opvp_arcmode_t,opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t);
- opvp_result_t (*opvpDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t ,const void*);
- opvp_result_t (*opvpStartDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t);
- opvp_result_t (*opvpTransferDrawImage)(opvp_dc_t,opvp_int_t,const void*);
- opvp_result_t (*opvpEndDrawImage)(opvp_dc_t);
- opvp_result_t (*opvpStartScanline)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpScanline)(opvp_dc_t,opvp_int_t,const opvp_int_t*);
- opvp_result_t (*opvpEndScanline)(opvp_dc_t);
- opvp_result_t (*opvpStartRaster)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpTransferRasterData)(opvp_dc_t,opvp_int_t,const opvp_byte_t*);
- opvp_result_t (*opvpSkipRaster)(opvp_dc_t,opvp_int_t);
- opvp_result_t (*opvpEndRaster)(opvp_dc_t);
- opvp_result_t (*opvpStartStream)(opvp_dc_t);
- opvp_result_t (*opvpTransferStreamData)(opvp_dc_t,opvp_int_t,const void*);
- opvp_result_t (*opvpEndStream)(opvp_dc_t);
+ opvp_dc_t (*opvpOpenPrinter)(opvp_int_t,const opvp_char_t*,const opvp_int_t[2],struct _opvp_api_procs**);
+ opvp_result_t (*opvpClosePrinter)(opvp_dc_t);
+ opvp_result_t (*opvpStartJob)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndJob)(opvp_dc_t);
+ opvp_result_t (*opvpAbortJob)(opvp_dc_t);
+ opvp_result_t (*opvpStartDoc)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndDoc)(opvp_dc_t);
+ opvp_result_t (*opvpStartPage)(opvp_dc_t,const opvp_char_t*);
+ opvp_result_t (*opvpEndPage)(opvp_dc_t);
+ opvp_result_t (*opvpQueryDeviceCapability)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_byte_t*);
+ opvp_result_t (*opvpQueryDeviceInfo)(opvp_dc_t,opvp_flag_t,opvp_int_t*,opvp_char_t*);
+ opvp_result_t (*opvpResetCTM)(opvp_dc_t);
+ opvp_result_t (*opvpSetCTM)(opvp_dc_t,const opvp_ctm_t*);
+ opvp_result_t (*opvpGetCTM)(opvp_dc_t,opvp_ctm_t*);
+ opvp_result_t (*opvpInitGS)(opvp_dc_t);
+ opvp_result_t (*opvpSaveGS)(opvp_dc_t);
+ opvp_result_t (*opvpRestoreGS)(opvp_dc_t);
+ opvp_result_t (*opvpQueryColorSpace)(opvp_dc_t,opvp_int_t*,opvp_cspace_t*);
+ opvp_result_t (*opvpSetColorSpace)(opvp_dc_t,opvp_cspace_t);
+ opvp_result_t (*opvpGetColorSpace)(opvp_dc_t,opvp_cspace_t*);
+ opvp_result_t (*opvpSetFillMode)(opvp_dc_t,opvp_fillmode_t);
+ opvp_result_t (*opvpGetFillMode)(opvp_dc_t,opvp_fillmode_t*);
+ opvp_result_t (*opvpSetAlphaConstant)(opvp_dc_t,opvp_float_t);
+ opvp_result_t (*opvpGetAlphaConstant)(opvp_dc_t,opvp_float_t*);
+ opvp_result_t (*opvpSetLineWidth)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetLineWidth)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineDash)(opvp_dc_t,opvp_int_t,const opvp_fix_t*);
+ opvp_result_t (*opvpGetLineDash)(opvp_dc_t,opvp_int_t*,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineDashOffset)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetLineDashOffset)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetLineStyle)(opvp_dc_t,opvp_linestyle_t);
+ opvp_result_t (*opvpGetLineStyle)(opvp_dc_t,opvp_linestyle_t*);
+ opvp_result_t (*opvpSetLineCap)(opvp_dc_t,opvp_linecap_t);
+ opvp_result_t (*opvpGetLineCap)(opvp_dc_t,opvp_linecap_t*);
+ opvp_result_t (*opvpSetLineJoin)(opvp_dc_t,opvp_linejoin_t);
+ opvp_result_t (*opvpGetLineJoin)(opvp_dc_t,opvp_linejoin_t*);
+ opvp_result_t (*opvpSetMiterLimit)(opvp_dc_t,opvp_fix_t);
+ opvp_result_t (*opvpGetMiterLimit)(opvp_dc_t,opvp_fix_t*);
+ opvp_result_t (*opvpSetPaintMode)(opvp_dc_t,opvp_paintmode_t);
+ opvp_result_t (*opvpGetPaintMode)(opvp_dc_t,opvp_paintmode_t*);
+ opvp_result_t (*opvpSetStrokeColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpSetFillColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpSetBgColor)(opvp_dc_t,const opvp_brush_t*);
+ opvp_result_t (*opvpNewPath)(opvp_dc_t);
+ opvp_result_t (*opvpEndPath)(opvp_dc_t);
+ opvp_result_t (*opvpStrokePath)(opvp_dc_t);
+ opvp_result_t (*opvpFillPath)(opvp_dc_t);
+ opvp_result_t (*opvpStrokeFillPath)(opvp_dc_t);
+ opvp_result_t (*opvpSetClipPath)(opvp_dc_t,opvp_cliprule_t);
+ opvp_result_t (*opvpResetClipPath)(opvp_dc_t);
+ opvp_result_t (*opvpSetCurrentPoint)(opvp_dc_t,opvp_fix_t,opvp_fix_t);
+ opvp_result_t (*opvpLinePath)(opvp_dc_t,opvp_pathmode_t,opvp_int_t,const opvp_point_t*);
+ opvp_result_t (*opvpPolygonPath)(opvp_dc_t,opvp_int_t,const opvp_int_t*,const opvp_point_t*);
+ opvp_result_t (*opvpRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_rectangle_t*);
+ opvp_result_t (*opvpRoundRectanglePath)(opvp_dc_t,opvp_int_t,const opvp_roundrectangle_t*);
+ opvp_result_t (*opvpBezierPath)(opvp_dc_t,opvp_int_t,const opvp_point_t*);
+ opvp_result_t (*opvpArcPath)(opvp_dc_t,opvp_arcmode_t,opvp_arcdir_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t,opvp_fix_t);
+ opvp_result_t (*opvpDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t ,const void*);
+ opvp_result_t (*opvpStartDrawImage)(opvp_dc_t,opvp_int_t,opvp_int_t,opvp_int_t,opvp_imageformat_t,opvp_int_t, opvp_int_t);
+ opvp_result_t (*opvpTransferDrawImage)(opvp_dc_t,opvp_int_t,const void*);
+ opvp_result_t (*opvpEndDrawImage)(opvp_dc_t);
+ opvp_result_t (*opvpStartScanline)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpScanline)(opvp_dc_t,opvp_int_t,const opvp_int_t*);
+ opvp_result_t (*opvpEndScanline)(opvp_dc_t);
+ opvp_result_t (*opvpStartRaster)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpTransferRasterData)(opvp_dc_t,opvp_int_t,const opvp_byte_t*);
+ opvp_result_t (*opvpSkipRaster)(opvp_dc_t,opvp_int_t);
+ opvp_result_t (*opvpEndRaster)(opvp_dc_t);
+ opvp_result_t (*opvpStartStream)(opvp_dc_t);
+ opvp_result_t (*opvpTransferStreamData)(opvp_dc_t,opvp_int_t,const void*);
+ opvp_result_t (*opvpEndStream)(opvp_dc_t);
} opvp_api_procs_t;
/* Function prototype */
opvp_dc_t opvpOpenPrinter(
- opvp_int_t outputFD,
- const opvp_char_t *printerModel,
- const opvp_int_t apiVersion[2],
- opvp_api_procs_t **apiProcs);
+ opvp_int_t outputFD,
+ const opvp_char_t *printerModel,
+ const opvp_int_t apiVersion[2],
+ opvp_api_procs_t **apiProcs);
/* error no */
extern opvp_int_t opvpErrorNo;
diff --git a/gs/contrib/opvp/opvp_0_2_0.h b/gs/contrib/opvp/opvp_0_2_0.h
index 6d0902d0d..6030971a3 100644
--- a/gs/contrib/opvp/opvp_0_2_0.h
+++ b/gs/contrib/opvp/opvp_0_2_0.h
@@ -37,7 +37,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Error Codes */
#define OPVP_FATALERROR -101 /* unrecoverable error occurred within the */
- /* library */
+ /* library */
#define OPVP_BADREQUEST -102 /* invalid function parameters */
#define OPVP_BADCONTEXT -103 /* bad parameter precontext */
#define OPVP_NOTSUPPORTED -104 /* printer or driver request not supported */
@@ -53,137 +53,137 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define OPVP_FIX_FLOOR_WIDTH (sizeof(int)*8-OPVP_FIX_FRACT_WIDTH)
#if 0
typedef struct {
- unsigned int fract : OPVP_FIX_FRACT_WIDTH;
- signed int floor : OPVP_FIX_FLOOR_WIDTH;
+ unsigned int fract : OPVP_FIX_FRACT_WIDTH;
+ signed int floor : OPVP_FIX_FLOOR_WIDTH;
} OPVP_Fix;
#define OPVP_i2Fix(i,fix) (fix.fract=0,fix.floor=i)
#define OPVP_Fix2f(fix,f) (f=(double)fix.floor\
- +(double)(fix.fract)/OPVP_FIX_FRACT_DENOM)
+ +(double)(fix.fract)/OPVP_FIX_FRACT_DENOM)
#define OPVP_f2Fix(f,fix) (fix.fract=(f-floor(f))*OPVP_FIX_FRACT_DENOM,\
- fix.floor=floor(f))
+ fix.floor=floor(f))
#else
typedef int OPVP_Fix;
#define OPVP_i2Fix(i,fix) (fix=i<<8)
#define OPVP_f2Fix(f,fix) (fix=((int)floor(f)<<8)\
- |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
- &0x000000ff))
+ |((int)((f-floor(f))*OPVP_FIX_FRACT_DENOM)\
+ &0x000000ff))
#endif
/* Basic Types */
typedef struct _OPVP_Point {
- OPVP_Fix x;
- OPVP_Fix y;
+ OPVP_Fix x;
+ OPVP_Fix y;
} OPVP_Point;
typedef struct _OPVP_Rectangle {
- OPVP_Point p0; /* start point */
- OPVP_Point p1; /* end point */
+ OPVP_Point p0; /* start point */
+ OPVP_Point p1; /* end point */
} OPVP_Rectangle;
typedef struct _OPVP_RoundRectangle {
- OPVP_Point p0; /* start point */
- OPVP_Point p1; /* end point */
- OPVP_Fix xellipse;
- OPVP_Fix yellipse;
+ OPVP_Point p0; /* start point */
+ OPVP_Point p1; /* end point */
+ OPVP_Fix xellipse;
+ OPVP_Fix yellipse;
} OPVP_RoundRectangle;
/* Image Formats */
typedef enum _OPVP_ImageFormat {
- OPVP_iformatRaw = 0,
- OPVP_iformatRLE = 1,
- OPVP_iformatJPEG = 2,
- OPVP_iformatPNG = 3
+ OPVP_iformatRaw = 0,
+ OPVP_iformatRLE = 1,
+ OPVP_iformatJPEG = 2,
+ OPVP_iformatPNG = 3
} OPVP_ImageFormat;
/* Color Presentation */
typedef enum _OPVP_ColorMapping {
- OPVP_cmapDirect = 0,
- OPVP_cmapIndexed = 1
+ OPVP_cmapDirect = 0,
+ OPVP_cmapIndexed = 1
} OPVP_ColorMapping;
typedef enum _OPVP_ColorSpace {
- OPVP_cspaceBW = 0,
- OPVP_cspaceDeviceGray = 1,
- OPVP_cspaceDeviceCMY = 2,
- OPVP_cspaceDeviceCMYK = 3,
- OPVP_cspaceDeviceRGB = 4,
- OPVP_cspaceStandardRGB = 5,
- OPVP_cspaceStandardRGB64 = 6
+ OPVP_cspaceBW = 0,
+ OPVP_cspaceDeviceGray = 1,
+ OPVP_cspaceDeviceCMY = 2,
+ OPVP_cspaceDeviceCMYK = 3,
+ OPVP_cspaceDeviceRGB = 4,
+ OPVP_cspaceStandardRGB = 5,
+ OPVP_cspaceStandardRGB64 = 6
} OPVP_ColorSpace;
/* Raster Operation modes */
typedef enum _OPVP_ROP {
- OPVP_ropPset = 0,
- OPVP_ropPreset = 1,
- OPVP_ropOr = 2,
- OPVP_ropAnd = 3,
- OPVP_ropXor = 4
+ OPVP_ropPset = 0,
+ OPVP_ropPreset = 1,
+ OPVP_ropOr = 2,
+ OPVP_ropAnd = 3,
+ OPVP_ropXor = 4
} OPVP_ROP;
/* Fill, Paint, Clip */
typedef enum _OPVP_FillMode {
- OPVP_fillModeEvenOdd = 0,
- OPVP_fillModeWinding = 1
+ OPVP_fillModeEvenOdd = 0,
+ OPVP_fillModeWinding = 1
} OPVP_FillMode;
typedef enum _OPVP_PaintMode {
- OPVP_paintModeOpaque = 0,
- OPVP_paintModeTransparent = 1
+ OPVP_paintModeOpaque = 0,
+ OPVP_paintModeTransparent = 1
} OPVP_PaintMode;
typedef enum _OPVP_ClipRule {
- OPVP_clipRuleEvenOdd = 0,
- OPVP_clipRuleWinding = 1
+ OPVP_clipRuleEvenOdd = 0,
+ OPVP_clipRuleWinding = 1
} OPVP_ClipRule;
/* Line */
typedef enum _OPVP_LineStyle {
- OPVP_lineStyleSolid = 0,
- OPVP_lineStyleDash = 1
+ OPVP_lineStyleSolid = 0,
+ OPVP_lineStyleDash = 1
} OPVP_LineStyle;
typedef enum _OPVP_LineCap {
- OPVP_lineCapButt = 0,
- OPVP_lineCapRound = 1,
- OPVP_lineCapSquare = 2
+ OPVP_lineCapButt = 0,
+ OPVP_lineCapRound = 1,
+ OPVP_lineCapSquare = 2
} OPVP_LineCap;
typedef enum _OPVP_LineJoin {
- OPVP_lineJoinMiter = 0,
- OPVP_lineJoinRound = 1,
- OPVP_lineJoinBevel = 2
+ OPVP_lineJoinMiter = 0,
+ OPVP_lineJoinRound = 1,
+ OPVP_lineJoinBevel = 2
} OPVP_LineJoin;
/* Brush */
typedef enum _OPVP_BrushDataType {
- OPVP_bdtypeNormal = 0
+ OPVP_bdtypeNormal = 0
} OPVP_BrushDataType;
typedef struct _OPVP_BrushData {
- OPVP_BrushDataType type;
- int width;
- int height;
- int pitch;
+ OPVP_BrushDataType type;
+ int width;
+ int height;
+ int pitch;
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- void *data; /* pointer to actual data */
+ void *data; /* pointer to actual data */
#else
- char data[1];
+ char data[1];
#endif
} OPVP_BrushData;
typedef struct _OPVP_Brush {
- OPVP_ColorSpace colorSpace;
- int color[4]; /* aRGB quadruplet */
+ OPVP_ColorSpace colorSpace;
+ int color[4]; /* aRGB quadruplet */
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- OPVP_BrushData *pbrush; /* pointer to brush data */
- /* solid brush used, if null */
- int xorg; /* brush origin */
- int yorg; /* ignored for SetBgColor */
+ OPVP_BrushData *pbrush; /* pointer to brush data */
+ /* solid brush used, if null */
+ int xorg; /* brush origin */
+ int yorg; /* ignored for SetBgColor */
#else
- int xorg; /* brush origin */
- int yorg; /* ignored for SetBgColor */
- OPVP_BrushData *pbrush; /* pointer to brush data */
- /* solid brush used, if null */
+ int xorg; /* brush origin */
+ int yorg; /* ignored for SetBgColor */
+ OPVP_BrushData *pbrush; /* pointer to brush data */
+ /* solid brush used, if null */
#endif
} OPVP_Brush;
@@ -198,102 +198,101 @@ typedef struct _OPVP_Brush {
/* CTM */
typedef struct _OPVP_CTM {
- float a;
- float b;
- float c;
- float d;
- float e;
- float f;
+ float a;
+ float b;
+ float c;
+ float d;
+ float e;
+ float f;
} OPVP_CTM;
/* Vector Driver API Proc. Entries */
typedef struct _OPVP_api_procs {
- int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **);
- int (*ClosePrinter)(int);
- int (*StartJob)(int,char *);
- int (*EndJob)(int);
- int (*StartDoc)(int,char *);
- int (*EndDoc)(int);
- int (*StartPage)(int,char *);
- int (*EndPage)(int);
+ int (*OpenPrinter)(int,char *,int *,struct _OPVP_api_procs **);
+ int (*ClosePrinter)(int);
+ int (*StartJob)(int,char *);
+ int (*EndJob)(int);
+ int (*StartDoc)(int,char *);
+ int (*EndDoc)(int);
+ int (*StartPage)(int,char *);
+ int (*EndPage)(int);
#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
- int (*QueryDeviceCapability)(int,int,int,char *);
- int (*QueryDeviceInfo)(int,int,int,char *);
+ int (*QueryDeviceCapability)(int,int,int,char *);
+ int (*QueryDeviceInfo)(int,int,int,char *);
#endif
- int (*ResetCTM)(int);
- int (*SetCTM)(int,OPVP_CTM *);
- int (*GetCTM)(int,OPVP_CTM *);
- int (*InitGS)(int);
- int (*SaveGS)(int);
- int (*RestoreGS)(int);
- int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *);
- int (*SetColorSpace)(int,OPVP_ColorSpace);
- int (*GetColorSpace)(int,OPVP_ColorSpace *);
- int (*QueryROP)(int,int *,int *);
- int (*SetROP)(int,int);
- int (*GetROP)(int,int *);
- int (*SetFillMode)(int,OPVP_FillMode);
- int (*GetFillMode)(int,OPVP_FillMode *);
- int (*SetAlphaConstant)(int,float);
- int (*GetAlphaConstant)(int,float *);
- int (*SetLineWidth)(int,OPVP_Fix);
- int (*GetLineWidth)(int,OPVP_Fix *);
- int (*SetLineDash)(int,OPVP_Fix *,int);
- int (*GetLineDash)(int,OPVP_Fix *,int *);
- int (*SetLineDashOffset)(int,OPVP_Fix);
- int (*GetLineDashOffset)(int,OPVP_Fix *);
- int (*SetLineStyle)(int,OPVP_LineStyle);
- int (*GetLineStyle)(int,OPVP_LineStyle *);
- int (*SetLineCap)(int,OPVP_LineCap);
- int (*GetLineCap)(int,OPVP_LineCap *);
- int (*SetLineJoin)(int,OPVP_LineJoin);
- int (*GetLineJoin)(int,OPVP_LineJoin *);
- int (*SetMiterLimit)(int,OPVP_Fix);
- int (*GetMiterLimit)(int,OPVP_Fix *);
- int (*SetPaintMode)(int,OPVP_PaintMode);
- int (*GetPaintMode)(int,OPVP_PaintMode *);
- int (*SetStrokeColor)(int,OPVP_Brush *);
- int (*SetFillColor)(int,OPVP_Brush *);
- int (*SetBgColor)(int,OPVP_Brush *);
- int (*NewPath)(int);
- int (*EndPath)(int);
- int (*StrokePath)(int);
- int (*FillPath)(int);
- int (*StrokeFillPath)(int);
- int (*SetClipPath)(int,OPVP_ClipRule);
+ int (*ResetCTM)(int);
+ int (*SetCTM)(int,OPVP_CTM *);
+ int (*GetCTM)(int,OPVP_CTM *);
+ int (*InitGS)(int);
+ int (*SaveGS)(int);
+ int (*RestoreGS)(int);
+ int (*QueryColorSpace)(int,OPVP_ColorSpace *,int *);
+ int (*SetColorSpace)(int,OPVP_ColorSpace);
+ int (*GetColorSpace)(int,OPVP_ColorSpace *);
+ int (*QueryROP)(int,int *,int *);
+ int (*SetROP)(int,int);
+ int (*GetROP)(int,int *);
+ int (*SetFillMode)(int,OPVP_FillMode);
+ int (*GetFillMode)(int,OPVP_FillMode *);
+ int (*SetAlphaConstant)(int,float);
+ int (*GetAlphaConstant)(int,float *);
+ int (*SetLineWidth)(int,OPVP_Fix);
+ int (*GetLineWidth)(int,OPVP_Fix *);
+ int (*SetLineDash)(int,OPVP_Fix *,int);
+ int (*GetLineDash)(int,OPVP_Fix *,int *);
+ int (*SetLineDashOffset)(int,OPVP_Fix);
+ int (*GetLineDashOffset)(int,OPVP_Fix *);
+ int (*SetLineStyle)(int,OPVP_LineStyle);
+ int (*GetLineStyle)(int,OPVP_LineStyle *);
+ int (*SetLineCap)(int,OPVP_LineCap);
+ int (*GetLineCap)(int,OPVP_LineCap *);
+ int (*SetLineJoin)(int,OPVP_LineJoin);
+ int (*GetLineJoin)(int,OPVP_LineJoin *);
+ int (*SetMiterLimit)(int,OPVP_Fix);
+ int (*GetMiterLimit)(int,OPVP_Fix *);
+ int (*SetPaintMode)(int,OPVP_PaintMode);
+ int (*GetPaintMode)(int,OPVP_PaintMode *);
+ int (*SetStrokeColor)(int,OPVP_Brush *);
+ int (*SetFillColor)(int,OPVP_Brush *);
+ int (*SetBgColor)(int,OPVP_Brush *);
+ int (*NewPath)(int);
+ int (*EndPath)(int);
+ int (*StrokePath)(int);
+ int (*FillPath)(int);
+ int (*StrokeFillPath)(int);
+ int (*SetClipPath)(int,OPVP_ClipRule);
#if (_PDAPI_VERSION_MAJOR_ > 0 || _PDAPI_VERSION_MINOR_ >= 2)
- int (*ResetClipPath)(int);
+ int (*ResetClipPath)(int);
#endif
- int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix);
- int (*LinePath)(int,int,int,OPVP_Point *);
- int (*PolygonPath)(int,int,int *,OPVP_Point *);
- int (*RectanglePath)(int,int,OPVP_Rectangle *);
- int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *);
+ int (*SetCurrentPoint)(int,OPVP_Fix,OPVP_Fix);
+ int (*LinePath)(int,int,int,OPVP_Point *);
+ int (*PolygonPath)(int,int,int *,OPVP_Point *);
+ int (*RectanglePath)(int,int,OPVP_Rectangle *);
+ int (*RoundRectanglePath)(int,int,OPVP_RoundRectangle *);
#if (_PDAPI_VERSION_MAJOR_ == 0 && _PDAPI_VERSION_MINOR_ < 2)
- int (*BezierPath)(int,int *,OPVP_Point *);
+ int (*BezierPath)(int,int *,OPVP_Point *);
#else
- int (*BezierPath)(int,int,OPVP_Point *);
+ int (*BezierPath)(int,int,OPVP_Point *);
#endif
- int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix,
- OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix);
- int (*DrawBitmapText)(int,int,int,int,void *);
- int (*DrawImage)(int,int,int,int,
- OPVP_ImageFormat,OPVP_Rectangle,int,void *);
- int (*StartDrawImage)(int,int,int,int,
- OPVP_ImageFormat,OPVP_Rectangle);
- int (*TransferDrawImage)(int,int,void *);
- int (*EndDrawImage)(int);
- int (*StartScanline)(int,int);
- int (*Scanline)(int,int,int *);
- int (*EndScanline)(int);
- int (*StartRaster)(int,int);
- int (*TransferRasterData)(int,int,unsigned char *);
- int (*SkipRaster)(int,int);
- int (*EndRaster)(int);
- int (*StartStream)(int);
- int (*TransferStreamData)(int,int,void *);
- int (*EndStream)(int);
+ int (*ArcPath)(int,int,int,OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix,
+ OPVP_Fix,OPVP_Fix,OPVP_Fix,OPVP_Fix);
+ int (*DrawBitmapText)(int,int,int,int,void *);
+ int (*DrawImage)(int,int,int,int,
+ OPVP_ImageFormat,OPVP_Rectangle,int,void *);
+ int (*StartDrawImage)(int,int,int,int,
+ OPVP_ImageFormat,OPVP_Rectangle);
+ int (*TransferDrawImage)(int,int,void *);
+ int (*EndDrawImage)(int);
+ int (*StartScanline)(int,int);
+ int (*Scanline)(int,int,int *);
+ int (*EndScanline)(int);
+ int (*StartRaster)(int,int);
+ int (*TransferRasterData)(int,int,unsigned char *);
+ int (*SkipRaster)(int,int);
+ int (*EndRaster)(int);
+ int (*StartStream)(int);
+ int (*TransferStreamData)(int,int,void *);
+ int (*EndStream)(int);
} OPVP_api_procs;
#endif /* _OPVP_COMMON_H_ */
-
diff --git a/gs/contrib/opvp/opvp_common.h b/gs/contrib/opvp/opvp_common.h
index 5d65b3208..9161c4bc6 100644
--- a/gs/contrib/opvp/opvp_common.h
+++ b/gs/contrib/opvp/opvp_common.h
@@ -51,4 +51,3 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define OPVP_INFO_PREFIX ""
#endif /* _OPVP_COMMON_H_ */
-
diff --git a/gs/contrib/pcl3/eprn/eprnfs.c b/gs/contrib/pcl3/eprn/eprnfs.c
index 97278b238..e02b5807e 100644
--- a/gs/contrib/pcl3/eprn/eprnfs.c
+++ b/gs/contrib/pcl3/eprn/eprnfs.c
@@ -43,21 +43,21 @@ static const char
#define fit_to_octet(value) ((value) < 0? 0: (value) > 255? 255: (value))
#define FS_assign() \
- new_value = *to + correction; \
- if (new_value < 0) { \
- *to = 0; \
- remaining_error += new_value; \
- } \
- else if (255 < new_value) { \
- *to = 255; \
- remaining_error += new_value - 255; \
- } \
- else *to = new_value;
+ new_value = *to + correction; \
+ if (new_value < 0) { \
+ *to = 0; \
+ remaining_error += new_value; \
+ } \
+ else if (255 < new_value) { \
+ *to = 255; \
+ remaining_error += new_value - 255; \
+ } \
+ else *to = new_value;
#define error_propagation_Gray() \
if (error != 0) { \
remaining_error = error; \
- \
+ \
/* 7/16 of the error goes to the right */ \
correction = (7*error)/16; \
remaining_error -= correction; \
@@ -65,11 +65,11 @@ static const char
to = from + 1; \
FS_assign() \
if (pixel == pixels - 1 && *to > 0) { \
- pixels++; \
- line->length++; \
+ pixels++; \
+ line->length++; \
} \
} \
- \
+ \
/* 3/16 of the error goes to the left and below */ \
correction = (3*error)/16; \
remaining_error -= correction; \
@@ -78,14 +78,14 @@ static const char
FS_assign() \
if (next_line->length < pixel && *to > 0) next_line->length = pixel; \
} \
- \
+ \
/* 5/16 of the error goes below */ \
correction = (5*error)/16; \
remaining_error -= correction; \
to = next_line->str + pixel; \
FS_assign() \
if (next_line->length <= pixel && *to > 0) next_line->length = pixel + 1; \
- \
+ \
/* The remainder (about 1/16 of the error) is added to the right and */ \
/* below. */ \
if (pixel < max_pixel) { \
@@ -93,7 +93,7 @@ static const char
new_value = *to + remaining_error; \
*to = fit_to_octet(new_value); \
if (next_line->length < pixel + 2 && *to > 0) \
- next_line->length = pixel + 2; \
+ next_line->length = pixel + 2; \
} \
}
@@ -103,7 +103,7 @@ static const char
#define error_propagation_colour() \
if (error != 0) { \
remaining_error = error; \
- \
+ \
/* 7/16 of the error goes to the right */ \
correction = (7*error)/16; \
remaining_error -= correction; \
@@ -111,11 +111,11 @@ static const char
to = from + OCTETS_PER_PIXEL; \
FS_assign() \
if (pixel == pixels - 1 && *to > 0) { \
- pixels++; \
- line->length += OCTETS_PER_PIXEL; \
+ pixels++; \
+ line->length += OCTETS_PER_PIXEL; \
} \
} \
- \
+ \
/* 3/16 of the error goes to the left and below */ \
correction = (3*error)/16; \
remaining_error -= correction; \
@@ -123,9 +123,9 @@ static const char
to = next_line->str + (pixel - 1)*OCTETS_PER_PIXEL + colorant; \
FS_assign() \
if (next_line->length < pixel*OCTETS_PER_PIXEL && *to > 0) \
- next_line->length = pixel*OCTETS_PER_PIXEL; \
+ next_line->length = pixel*OCTETS_PER_PIXEL; \
} \
- \
+ \
/* 5/16 of the error goes below */ \
correction = (5*error)/16; \
remaining_error -= correction; \
@@ -133,7 +133,7 @@ static const char
FS_assign() \
if (next_line->length <= pixel*OCTETS_PER_PIXEL && *to > 0) \
next_line->length = (pixel + 1)*OCTETS_PER_PIXEL; \
- \
+ \
/* The remainder (about 1/16 of the error) is added to the right and */ \
/* below. */ \
if (pixel < max_pixel) { \
@@ -141,7 +141,7 @@ static const char
new_value = *to + remaining_error; \
*to = fit_to_octet(new_value); \
if (next_line->length < (pixel + 2)*OCTETS_PER_PIXEL && *to > 0) \
- next_line->length = (pixel + 2)*OCTETS_PER_PIXEL; \
+ next_line->length = (pixel + 2)*OCTETS_PER_PIXEL; \
} \
}
@@ -188,7 +188,7 @@ static void split_Gray_2(eprn_OctetString *line, eprn_OctetString *next_line,
approx = *from >> 7; /* take the most significant bit */
error = *from - 255*approx;
/* The sign of 'error' is chosen such that 'error' is positive if
- colorant intensity has to be added to the picture. */
+ colorant intensity has to be added to the picture. */
/* Insert the approximation into the output plane */
*ptr = (*ptr << 1) | approx;
@@ -251,7 +251,7 @@ static void split_Gray(eprn_OctetString *line, eprn_OctetString *next_line,
approx = *from/divisor;
error = *from - (255*approx)/max_level;
/* The sign of 'error' is chosen such that 'error' is positive if
- colorant intensity has to be added to the picture. */
+ colorant intensity has to be added to the picture. */
/* Distribute the approximation over the bit planes */
for (plane = 0; plane < planes; plane++) {
@@ -330,7 +330,7 @@ static void split_colour_CMYK_2(eprn_OctetString *line,
approx = *from >> 7;
error = *from - 255*approx;
/* The sign of 'error' is chosen such that 'error' is positive if
- colorant intensity has to be added to the picture. */
+ colorant intensity has to be added to the picture. */
/* Insert the approximation in the bit plane */
plane = BLACK_INDEX - colorant;
@@ -365,11 +365,11 @@ static void split_colour_at_most_2(eprn_OctetString *line,
const int
last_colorant =
colour_model == eprn_DeviceCMY_plus_K || colour_model == eprn_DeviceCMYK?
- BLACK_INDEX: 2,
+ BLACK_INDEX: 2,
max_pixel = max_octets/OCTETS_PER_PIXEL - 1,
planes =
colour_model == eprn_DeviceCMY_plus_K || colour_model == eprn_DeviceCMYK?
- 4: 3;
+ 4: 3;
int
colorant,
correction,
@@ -405,21 +405,21 @@ static void split_colour_at_most_2(eprn_OctetString *line,
approx[colorant] = *from >> 7;
error = *from - 255*approx[colorant];
/* The sign of 'error' is chosen such that 'error' is positive if
- colorant intensity has to be added to the picture. */
+ colorant intensity has to be added to the picture. */
error_propagation_colour()
}
/* Determine the black component for CMY+K */
if (colour_model == eprn_DeviceCMY_plus_K &&
- approx[0] == approx[1] && approx[1] == approx[2] && approx[0] > 0) {
+ approx[0] == approx[1] && approx[1] == approx[2] && approx[0] > 0) {
approx[BLACK_INDEX] = approx[0];
approx[0] = approx[1] = approx[2] = 0;
}
/* Distribute the approximation over the bit planes */
for (colorant = last_colorant, plane = 0; colorant >= 0;
- colorant--, plane++) {
+ colorant--, plane++) {
*ptr[plane] = (*ptr[plane] << 1) | approx[colorant];
}
@@ -507,19 +507,19 @@ static void split_colour(eprn_OctetString *line, eprn_OctetString *next_line,
approx[colorant] = *from/divisor[colorant];
error = *from - (255*approx[colorant])/max_level[colorant];
/* The sign of 'error' is chosen such that 'error' is positive if
- colorant intensity has to be added to the picture. */
+ colorant intensity has to be added to the picture. */
error_propagation_colour()
}
/* Determine the black component for CMY+K */
if (colour_model == eprn_DeviceCMY_plus_K &&
- approx[0] == approx[1] && approx[1] == approx[2] && approx[0] > 0) {
+ approx[0] == approx[1] && approx[1] == approx[2] && approx[0] > 0) {
int value = approx[0]*(black_levels - 1);
if (value % (non_black_levels - 1) == 0) {
- /* Black does have a level at the same intensity as the CMY levels */
- approx[BLACK_INDEX] = value/(non_black_levels - 1);
- approx[0] = approx[1] = approx[2] = 0;
+ /* Black does have a level at the same intensity as the CMY levels */
+ approx[BLACK_INDEX] = value/(non_black_levels - 1);
+ approx[0] = approx[1] = approx[2] = 0;
}
}
@@ -527,9 +527,9 @@ static void split_colour(eprn_OctetString *line, eprn_OctetString *next_line,
plane = 0;
for (colorant = last_colorant; colorant >= 0; colorant--) {
while (plane < next_plane[colorant]) {
- *ptr[plane] = (*ptr[plane] << 1) | approx[colorant] & 0x01;
- approx[colorant] >>= 1;
- plane++;
+ *ptr[plane] = (*ptr[plane] << 1) | approx[colorant] & 0x01;
+ approx[colorant] >>= 1;
+ plane++;
}
}
@@ -582,10 +582,10 @@ void eprn_split_FS(eprn_OctetString *line, eprn_OctetString *next_line,
else {
if (black_levels <= 2 && non_black_levels == 2)
split_colour_at_most_2(line, next_line, max_octets, colour_model,
- bitplanes);
+ bitplanes);
else
split_colour(line, next_line, max_octets, colour_model, black_levels,
- non_black_levels, bitplanes);
+ non_black_levels, bitplanes);
}
return;
diff --git a/gs/contrib/pcl3/eprn/eprnparm.c b/gs/contrib/pcl3/eprn/eprnparm.c
index 940112816..0d1a5984a 100644
--- a/gs/contrib/pcl3/eprn/eprnparm.c
+++ b/gs/contrib/pcl3/eprn/eprnparm.c
@@ -361,7 +361,6 @@ static char *next_word(char *s)
#define cleanup() (free(list), fclose(f))
-
static int eprn_read_media_data(eprn_Eprn *eprn)
{
char buffer[BUFFER_SIZE];
diff --git a/gs/contrib/pcl3/eprn/eprnrend.c b/gs/contrib/pcl3/eprn/eprnrend.c
index 544829e7f..3a9b3a413 100644
--- a/gs/contrib/pcl3/eprn/eprnrend.c
+++ b/gs/contrib/pcl3/eprn/eprnrend.c
@@ -14,13 +14,13 @@
Preprocessor variables:
EPRN_TRACE
- Define this to enable tracing. Only useful for development.
+ Define this to enable tracing. Only useful for development.
EPRN_TRAILING_BIT_BUG_FIXED
- Define this to deactivate compensation for a bug in ghostscript which
- leads to the last pixel in an RGB line being black instead of white.
- This occurs at least in gs 6.01 and 6.50. The correction covers only
- the one-bit-per-colorant case and is equivalent to clipping the pixel.
+ Define this to deactivate compensation for a bug in ghostscript which
+ leads to the last pixel in an RGB line being black instead of white.
+ This occurs at least in gs 6.01 and 6.50. The correction covers only
+ the one-bit-per-colorant case and is equivalent to clipping the pixel.
*******************************************************************************
@@ -141,8 +141,8 @@ void eprn_number_of_octets(eprn_Device *dev, unsigned int lenghts[])
dev->color_info.depth;
/* This results in length >= ceiling((number of pixels per line)/8)
because:
- 8 * octets_per_line >= pixels_per_line * depth
- <==> octets_per_line/depth >= pixels_per_line/8
+ 8 * octets_per_line >= pixels_per_line * depth
+ <==> octets_per_line/depth >= pixels_per_line/8
where division is to be understood as exact.
*/
@@ -309,9 +309,9 @@ gx_color_index eprn_map_rgb_color_for_CMY_or_K_flex(gx_device *device,
return eprn_map_cmyk_color_flex(device, tmpcv);
}
- tmpcv[0] = gx_max_color_value - red;
- tmpcv[1] = gx_max_color_value - green;
- tmpcv[2] = gx_max_color_value - blue;
+ tmpcv[0] = gx_max_color_value - red;
+ tmpcv[1] = gx_max_color_value - green;
+ tmpcv[2] = gx_max_color_value - blue;
tmpcv[3] = 0;
return eprn_map_cmyk_color_flex(device, tmpcv);
}
@@ -377,9 +377,9 @@ gx_color_index eprn_map_rgb_color_for_CMY_or_K_max(gx_device *device,
}
/* Note that the conversion from composite black to true black for CMY+K can
only happen at the output pixel level, not here. */
- tmpcv[0] = gx_max_color_value - red;
- tmpcv[1] = gx_max_color_value - green;
- tmpcv[2] = gx_max_color_value - blue;
+ tmpcv[0] = gx_max_color_value - red;
+ tmpcv[1] = gx_max_color_value - green;
+ tmpcv[2] = gx_max_color_value - blue;
tmpcv[3] = 0;
return eprn_map_cmyk_color_max(device, tmpcv);
}
@@ -487,10 +487,10 @@ gx_color_index eprn_map_cmyk_color_flex(gx_device *device,
(a) multiply by the number of levels minus 1 and truncate,
(b) multiply by the number of levels minus 1 and round, and
(c) multiply by the number of levels and truncate, except for an
- intensity of 1 in which case one returns the number of levels minus 1.
+ intensity of 1 in which case one returns the number of levels minus 1.
For intensity values which can be represented exactly, i.e.,
- intensity = i/(levels-1) for some non-negative i < levels,
+ intensity = i/(levels-1) for some non-negative i < levels,
these three methods are identical. (a) is however inappropriate here
because for less than 32 levels ghostscript already provides intensity
@@ -624,7 +624,7 @@ void eprn_finalize(bool is_RGB, unsigned int non_black_levels,
if (is_RGB) {
/* White may be any intensity, but it's the same for all three colorants,
- and it's the highest. */
+ and it's the highest. */
eprn_Octet imax = non_black_levels - 1;
int c, rgb_planes = eprn_bits_for_levels(non_black_levels);
@@ -632,25 +632,25 @@ void eprn_finalize(bool is_RGB, unsigned int non_black_levels,
/* Loop over RGB */
for (c = 0; c < 3; c++) {
- eprn_Octet value = imax;
- int m;
+ eprn_Octet value = imax;
+ int m;
- /* Loop over all planes for this colorant */
- for (m = 0; m < rgb_planes; m++, j++) {
- eprn_Octet bit = value & 1;
- int p;
+ /* Loop over all planes for this colorant */
+ for (m = 0; m < rgb_planes; m++, j++) {
+ eprn_Octet bit = value & 1;
+ int p;
- value = value >> 1;
+ value = value >> 1;
- /* Put the bit into all remaining pixels for this plane */
- for (p = 0; p < shift; p++)
- *ptr[j] = (*ptr[j] << 1) | bit;
- }
+ /* Put the bit into all remaining pixels for this plane */
+ for (p = 0; p < shift; p++)
+ *ptr[j] = (*ptr[j] << 1) | bit;
+ }
}
}
else /* White is zero */
for (j = 0; j < planes; j++)
- *ptr[j] = *ptr[j] << shift;
+ *ptr[j] = *ptr[j] << shift;
/* Advance all plane pointers by 1 */
for (j = 0; j < planes; j++) ptr[j]++;
@@ -730,15 +730,15 @@ static void split_line_le8(eprn_Device *dev, const eprn_Octet *line,
*/
comp = pixel & comp_mask; /* black */
for (j = 0; j < black_planes; j++) {
- *ptr[j] = (*ptr[j] << 1) | comp & 1;
- comp >>= 1;
+ *ptr[j] = (*ptr[j] << 1) | comp & 1;
+ comp >>= 1;
}
if (non_black_planes > 0) for (l = 1; l < 4; l++) {
- comp = (pixel >> l*dev->eprn.bits_per_colorant) & comp_mask;
- for (m = 0; m < non_black_planes; m++, j++) {
- *ptr[j] = (*ptr[j] << 1) | comp & 1;
- comp >>= 1;
- }
+ comp = (pixel >> l*dev->eprn.bits_per_colorant) & comp_mask;
+ for (m = 0; m < non_black_planes; m++, j++) {
+ *ptr[j] = (*ptr[j] << 1) | comp & 1;
+ comp >>= 1;
+ }
}
pixels++;
@@ -825,8 +825,8 @@ static void split_line_ge8(eprn_Device *dev, const eprn_Octet *line,
for (l = 1; l < 4; l++) {
comp = (pixel >> l*dev->eprn.bits_per_colorant) & comp_mask;
for (m = 0; m < non_black_planes; m++, j++) {
- *ptr[j] = (*ptr[j] << 1) | comp & 1;
- comp >>= 1;
+ *ptr[j] = (*ptr[j] << 1) | comp & 1;
+ comp >>= 1;
}
}
@@ -898,12 +898,12 @@ static void split_line_3or4x1(eprn_Device *dev, const eprn_Octet *line,
if (l < 4) {
for (j = from; j < 4; j++) octet[j] <<= 8 - 2*l;
if (dev->eprn.colour_model == eprn_DeviceRGB) {
- /* Add white in the last 8 - 2*l pixels */
- for (j = 1; j < 4; j++) {
- int k;
- /* We add two pixels at a time */
- for (k = 3 - l; k >= 0; k--) octet[j] |= 0x03 << k;
- }
+ /* Add white in the last 8 - 2*l pixels */
+ for (j = 1; j < 4; j++) {
+ int k;
+ /* We add two pixels at a time */
+ for (k = 3 - l; k >= 0; k--) octet[j] |= 0x03 << k;
+ }
}
}
for (j = from; j < 4; j++) *(ptr[j]++) = octet[j];
@@ -955,7 +955,7 @@ static void split_line_4x2(eprn_Device *dev, const eprn_Octet *line,
/* Split and distribute over planes */
*ptr[0] = (*ptr[0] << 1) | pixel & 0x01;
#define assign_bit(index) \
- *ptr[index] = (*ptr[index] << 1) | (pixel >> index) & 0x01
+ *ptr[index] = (*ptr[index] << 1) | (pixel >> index) & 0x01
assign_bit(1);
assign_bit(2);
assign_bit(3);
@@ -1094,18 +1094,18 @@ int eprn_get_planes(eprn_Device *dev, eprn_OctetString bitplanes[])
}
else {
/* Here we split multi-bit pixels which are already adapted to the
- printer's capabilities.
+ printer's capabilities.
- All the functions called here have the following signature:
+ All the functions called here have the following signature:
- static void split_line...(eprn_Device *dev, const eprn_Octet *line,
- int length, eprn_OctetString plane[])
+ static void split_line...(eprn_Device *dev, const eprn_Octet *line,
+ int length, eprn_OctetString plane[])
- Such a "split_line implementation" must take the scan line of length
- 'length', pointed to by 'line', split it into bit planes according to
- the state of 'dev', and return these planes via 'plane'. The length
- fields of the planes must be set. Trailing zero octets should not be
- removed because it's done here afterwards anyway.
+ Such a "split_line implementation" must take the scan line of length
+ 'length', pointed to by 'line', split it into bit planes according to
+ the state of 'dev', and return these planes via 'plane'. The length
+ fields of the planes must be set. Trailing zero octets should not be
+ removed because it's done here afterwards anyway.
*/
if (dev->eprn.colour_model == eprn_DeviceGray)
@@ -1113,34 +1113,34 @@ int eprn_get_planes(eprn_Device *dev, eprn_OctetString bitplanes[])
else {
if (dev->eprn.bits_per_colorant == 1) {
#ifndef EPRN_TRAILING_BIT_BUG_FIXED
- if (dev->eprn.colour_model == eprn_DeviceRGB &&
- line->length == dev->eprn.octets_per_line) {
- /* At least gs 6.01 and 6.50 sometimes generate pixel lines where the
- last pixel is not white but black (last octet in 'line' is 0xE0
- instead of 0xEE; with pcl3 it shows up for A6 and A4, but not for
- A3, A5, US Letter, or US Legal).
- I'm overwriting it with white. */
+ if (dev->eprn.colour_model == eprn_DeviceRGB &&
+ line->length == dev->eprn.octets_per_line) {
+ /* At least gs 6.01 and 6.50 sometimes generate pixel lines where the
+ last pixel is not white but black (last octet in 'line' is 0xE0
+ instead of 0xEE; with pcl3 it shows up for A6 and A4, but not for
+ A3, A5, US Letter, or US Legal).
+ I'm overwriting it with white. */
#ifdef EPRN_TRACE
- if (gs_debug_c(EPRN_TRACE_CHAR)) {
- static bool already_noted = false;
- if (!already_noted && line->str[line->length - 1] != 0xEE) {
- dlprintf1("! eprn_get_planes(): "
- "Line-terminating octet is 0x%02X.\n",
- line->str[line->length - 1]);
- already_noted = true;
- }
- }
+ if (gs_debug_c(EPRN_TRACE_CHAR)) {
+ static bool already_noted = false;
+ if (!already_noted && line->str[line->length - 1] != 0xEE) {
+ dlprintf1("! eprn_get_planes(): "
+ "Line-terminating octet is 0x%02X.\n",
+ line->str[line->length - 1]);
+ already_noted = true;
+ }
+ }
#endif /* EPRN_TRACE */
- line->str[line->length - 1] |= RED_BIT | GREEN_BIT | BLUE_BIT;
- }
+ line->str[line->length - 1] |= RED_BIT | GREEN_BIT | BLUE_BIT;
+ }
#endif /* EPRN_TRAILING_BIT_BUG_FIXED */
- split_line_3or4x1(dev, line->str, line->length, bitplanes);
+ split_line_3or4x1(dev, line->str, line->length, bitplanes);
}
else if (dev->eprn.bits_per_colorant == 2 && dev->eprn.black_levels > 2 &&
- dev->eprn.non_black_levels > 2)
- split_line_4x2(dev, line->str, line->length, bitplanes);
+ dev->eprn.non_black_levels > 2)
+ split_line_4x2(dev, line->str, line->length, bitplanes);
else if (dev->color_info.depth < 8)
- split_line_le8(dev, line->str, line->length, bitplanes);
+ split_line_le8(dev, line->str, line->length, bitplanes);
else split_line_ge8(dev, line->str, line->length, bitplanes);
}
}
diff --git a/gs/contrib/pcl3/eprn/gdeveprn.h b/gs/contrib/pcl3/eprn/gdeveprn.h
index dcc88de6e..9a78ebd25 100644
--- a/gs/contrib/pcl3/eprn/gdeveprn.h
+++ b/gs/contrib/pcl3/eprn/gdeveprn.h
@@ -18,7 +18,6 @@
functionality offered by ghostscript's 'prn' device was insufficient and
should be extended, leading to this "extended prn device".
-
Functionality
=============
The "eprn" device offers the following services to derived devices:
@@ -35,7 +34,6 @@
- Counting of pages printed across gs invocations by means of page count
files
-
Rendering Model
===============
The "eprn" device parameterizes the printer's rendering capabilities as
@@ -54,7 +52,6 @@
The derived device can obtain the resulting pixels by successively calling
eprn_get_planes() from the page printing procedure.
-
Device Coordinates
==================
"Pixmap device space" is the coordinate system used by the "prn" device for
@@ -90,7 +87,6 @@
leading edge at the top. Units and directions are identical with pixmap
device space.
-
Page Descriptions
=================
When a PostScript document requests a particular page size by specifying its
@@ -157,11 +153,11 @@
- its media code will be made available to the derived device in the
eprn device's 'code' field,
- the hardware margins will be set from the page description (unless the
- user has explicitly specified a value for the ".HWMargins" page device
- parameter),
+ user has explicitly specified a value for the ".HWMargins" page device
+ parameter),
- default user space will be configured based on sheet orientation
- (transverse or not in device space) and page orientation (portrait or
- landscape in default user space).
+ (transverse or not in device space) and page orientation (portrait or
+ landscape in default user space).
Because the error message in step 6 has to report a mismatch on the flags
and because the interpretation of the flags is fixed by the derived device,
@@ -222,7 +218,6 @@ typedef struct {
/* Hardware margins (non-negative) in bp */
} eprn_PageDescription;
-
/* Custom page sizes */
typedef struct {
/* The first two lines have the same meaning as for 'eprn_PageDescription'.
@@ -241,9 +236,9 @@ typedef struct {
with 0.2 inches:
const eprn_PageDescription page_description[] = {
- {ms_A4, 5*BP_PER_MM, 5*BP_PER_MM, 5*BP_PER_MM, 5*BP_PER_MM},
- {ms_Letter, 0.2*BP_PER_IN, 0.2*BP_PER_IN, 0.2*BP_PER_IN, 0.2*BP_PER_IN},
- {ms_none, 0, 0, 0, 0}
+ {ms_A4, 5*BP_PER_MM, 5*BP_PER_MM, 5*BP_PER_MM, 5*BP_PER_MM},
+ {ms_Letter, 0.2*BP_PER_IN, 0.2*BP_PER_IN, 0.2*BP_PER_IN, 0.2*BP_PER_IN},
+ {ms_none, 0, 0, 0, 0}
};
The last entry is a sentinel value which will be required later.
@@ -324,8 +319,8 @@ typedef struct {
const eprn_IntensityLevels bilevel[] = { {2, 2}, {0, 0}};
const eprn_ResLev rl_600_2[] = { {sixhundred, bilevel}, {NULL, NULL}};
const eprn_ColourInfo mono_600_2[] = {
- {eprn_DeviceGray, {rl_600_2, NULL}},
- {eprn_DeviceGray, {NULL, NULL}}
+ {eprn_DeviceGray, {rl_600_2, NULL}},
+ {eprn_DeviceGray, {NULL, NULL}}
};
******************************************************************************/
@@ -368,7 +363,7 @@ typedef struct {
To continue our series of examples, here is a complete printer description:
const eprn_PrinterDescription description = {
- "Wrzlbrnf printer", page_description, NULL, 0, mono_600_2
+ "Wrzlbrnf printer", page_description, NULL, 0, mono_600_2
};
******************************************************************************/
@@ -397,7 +392,7 @@ struct s_eprn_Device;
/* The preceding statement is needed in order to establish a forward
declaration for "struct s_eprn_Device" at file scope. */
typedef void (*eprn_FlagMismatchReporter)(const struct s_eprn_Device *dev,
- bool no_match);
+ bool no_match);
/* A function of this kind will be called if the requested media flags cannot
be satisfied by the printer although the size itself is supported for some
(unspecified) set of flags. The parameter 'no_match' indicates whether the
@@ -457,10 +452,10 @@ typedef struct s_eprn_Device {
int default_orientation;
/* Direction of the positive y axis of default default user space (the
requested PageSize had width <= height) as seen from pixmap device space:
- 0 up
- 1 left
- 2 down
- 3 right
+ 0 up
+ 1 left
+ 2 down
+ 3 right
Hence the value is the number of +90 degrees rotations necessary to
obtain the "up" direction of default default user space (positive y axis)
from the "up" direction of pixmap device space (negative y axis).
@@ -477,22 +472,22 @@ typedef struct s_eprn_Device {
right_shift,
down_shift;
/* Seen from pixmap device space, the top left corner of the sheet is at
- (-right_shift, -down_shift). Both values are in bp and represent
- hardware margins, i.e., the origin of pixmap device space is a corner
- of the sheet's imageable area.
- These parameters are logically superfluous and could be derived from
- 'HWMargins[]' and possibly other data (like 'default_orientation'),
- provided one knows what the reference system for 'HWMargins[]' is.
- This is not documented but it seems to be default user space. In order
- to have values with a reliable interpretation and because the data are
- originally given in pixmap device space anyway I have introduced these
- variables. */
+ (-right_shift, -down_shift). Both values are in bp and represent
+ hardware margins, i.e., the origin of pixmap device space is a corner
+ of the sheet's imageable area.
+ These parameters are logically superfluous and could be derived from
+ 'HWMargins[]' and possibly other data (like 'default_orientation'),
+ provided one knows what the reference system for 'HWMargins[]' is.
+ This is not documented but it seems to be default user space. In order
+ to have values with a reliable interpretation and because the data are
+ originally given in pixmap device space anyway I have introduced these
+ variables. */
bool keep_margins;
/* True iff margin information should be taken from 'HWMargins[]' instead
- of from the printer description. */
+ of from the printer description. */
bool soft_tumble;
/* If this field is set, every second page will have its default user
- coordinate system rotated by 180 degrees. */
+ coordinate system rotated by 180 degrees. */
/* Colour */
eprn_ColourModel
@@ -506,11 +501,11 @@ typedef struct s_eprn_Device {
/* Page counting and other spooler support */
char
*pagecount_file; /* gs_malloc()-allocated name of page count file.
- May be NULL. */
+ May be NULL. */
bool
CUPS_accounting, /* Send CUPS page accounting messages. */
CUPS_messages; /* Add CUPS message prefixes to error messages and
- warnings. */
+ warnings. */
/* Support for the standard page device parameter "MediaPosition" */
bool media_position_set;
@@ -520,11 +515,11 @@ typedef struct s_eprn_Device {
call to eprn_open(). */
unsigned int
bits_per_colorant; /* Number of bits per colorant used in 'gx_color_index'
- values. Constant while the device is open. */
+ values. Constant while the device is open. */
eprn_OctetString
scan_line, /* 'str' is gs_malloc()-allocated */
next_scan_line; /* 'str' is gs_malloc()-allocated. Non-null only for
- Floyd-Steinberg error diffusion. */
+ Floyd-Steinberg error diffusion. */
unsigned int
octets_per_line, /* Constant while the device is open. */
output_planes; /* Constant while the device is open. */
@@ -535,7 +530,6 @@ typedef struct s_eprn_Device {
unless 'next_y' is zero in which case we have finished. */
} eprn_Eprn;
-
/* Macro for device structure type definitions. Note that in contrast to
gx_prn_device_common this macro does include the inherited attributes. */
#define gx_eprn_device_common \
@@ -548,7 +542,6 @@ typedef struct {
gx_eprn_device_common;
} eprn_Device;
-
/* Macro for initializing device structure instances (device prototypes)
This macro corresponds to the prn_device*() macros which are used when
@@ -557,28 +550,28 @@ typedef struct {
The parameters are:
dtype: identifier of the device structure type
procs: pointer to static device procedure table
- (const gx_device_procs *, not NULL)
+ (const gx_device_procs *, not NULL)
dname: name of the device (const char *, not NULL)
xdpi: horizontal resolution in ppi (float, positive)
ydpi: vertical resolution in ppi (float, positive)
print_page: page printing procedure to be called by
- gdev_prn_output_page(), not NULL
+ gdev_prn_output_page(), not NULL
cap: pointer to printer capability description
- (const eprn_PrinterDescription *, not NULL, the description may
- not change until immediately before the next call to
- eprn_init_device())
+ (const eprn_PrinterDescription *, not NULL, the description may
+ not change until immediately before the next call to
+ eprn_init_device())
flag_desc description of the non-standard flags the derived device
- accepts (const ms_Flag *, may be NULL, otherwise terminated
- with an entry having 'ms_none' for 'code')
+ accepts (const ms_Flag *, may be NULL, otherwise terminated
+ with an entry having 'ms_none' for 'code')
desired pattern of desired media flags (ms_MediaCode)
optional NULL or a list of optional media flags (const ms_MediaCode *)
- terminated with an 'ms_none' value
+ terminated with an 'ms_none' value
fmr NULL or pointer to a flag mismatch reporting function
- (eprn_FlagMismatchReporter)
+ (eprn_FlagMismatchReporter)
All storage referred to by pointers remains under the control of the
derived device and should not be modified during the lifetime of the
- device unless explicitly permitted.
+ device unless explicitly permitted.
This macro assumes that it is dealing with a printer supporting at least
DeviceGray with 2 intensity levels and the page size described by
@@ -629,7 +622,6 @@ typedef struct {
0 /* next_y */ \
}
-
/* For the calling conventions of the following functions consult the comments
preceding each function's implementation. */
@@ -667,7 +659,6 @@ extern dev_proc_map_cmyk_color(eprn_map_cmyk_color_flex);
extern dev_proc_map_cmyk_color(eprn_map_cmyk_color_max);
extern dev_proc_map_cmyk_color(eprn_map_cmyk_color_glob);
-
/* Macro for initializing device procedure tables
This macro corresponds to the macro prn_params_procs() which is used when
diff --git a/gs/contrib/pcl3/eprn/mediasize.c b/gs/contrib/pcl3/eprn/mediasize.c
index abc706c84..c625d7611 100644
--- a/gs/contrib/pcl3/eprn/mediasize.c
+++ b/gs/contrib/pcl3/eprn/mediasize.c
@@ -107,8 +107,8 @@ static const ms_SizeDescription list[] = {
{sn(A4), {210*BP_PER_MM, 297*BP_PER_MM}},
{sn(Folio), {210*BP_PER_MM, 330*BP_PER_MM}},
{sn(Quarto), {8.5*BP_PER_IN, 10.83*BP_PER_IN}}, /* 215.9 x 275.1 mm
- PPD 4.3 uses bp values for the definition, but this does not agree
- with the mm values it specifies. The inch specifications fit. */
+ PPD 4.3 uses bp values for the definition, but this does not agree
+ with the mm values it specifies. The inch specifications fit. */
{sn(Letter), {8.5*BP_PER_IN, 11.0*BP_PER_IN}}, /* 215.9 x 279.4 mm */
{sn(Legal), {8.5*BP_PER_IN, 14.0*BP_PER_IN}}, /* 215.9 x 355.6 mm */
{sn(EnvKaku3), {216*BP_PER_MM, 277*BP_PER_MM}},
@@ -172,7 +172,7 @@ static void check(void)
assert(strlen(list[j].name) < LONGER_THAN_NAMES);
assert(list[j].dimen[0] == 0.0 || list[j-1].dimen[0] < list[j].dimen[0] ||
list[j-1].dimen[0] == list[j].dimen[0] &&
- list[j-1].dimen[1] <= list[j].dimen[1]);
+ list[j-1].dimen[1] <= list[j].dimen[1]);
}
/* Check that the highest accepted value does not collide with the flags */
@@ -291,8 +291,8 @@ ms_MediaCode ms_find_code_from_name(const char *name,
if ((t = strchr(s, '.')) == NULL) t = strchr(s, '\0');
l = t - s;
#define set_if(keyword) \
- if (l == STRLEN(MS_##keyword##_STRING) && \
- strncmp(s, MS_##keyword##_STRING, l) == 0) flag = MS_##keyword##_FLAG
+ if (l == STRLEN(MS_##keyword##_STRING) && \
+ strncmp(s, MS_##keyword##_STRING, l) == 0) flag = MS_##keyword##_FLAG
set_if(TRANSVERSE);
else set_if(BIG);
else set_if(SMALL);
@@ -311,8 +311,8 @@ ms_MediaCode ms_find_code_from_name(const char *name,
ms_MediaCode flag;
if ((flag = find_flag(name, &l, substrings)) == 0 &&
- (user_flag_list == NULL ||
- (flag = find_flag(name, &l, user_flag_list)) == 0))
+ (user_flag_list == NULL ||
+ (flag = find_flag(name, &l, user_flag_list)) == 0))
break; /* loop exit */
if ((flag & flags) != 0) return ms_none; /* no duplicates */
@@ -366,8 +366,8 @@ static int add_substrings(char *buffer, size_t *length, ms_MediaCode *code,
if (flag_list[j].code & *code) {
l = strlen(flag_list[j].name);
if (*length < l) {
- errno = ERANGE;
- return -1;
+ errno = ERANGE;
+ return -1;
}
*code &= ~flag_list[j].code;
strcpy(buffer, flag_list[j].name);
diff --git a/gs/contrib/pcl3/eprn/mediasize.h b/gs/contrib/pcl3/eprn/mediasize.h
index 75fe0badd..fab1e6886 100644
--- a/gs/contrib/pcl3/eprn/mediasize.h
+++ b/gs/contrib/pcl3/eprn/mediasize.h
@@ -115,7 +115,7 @@ typedef enum {
ms_SuperB,
ms_EnvC3,
ms_HPSuperB, /* what Hewlett-Packard calls "SuperB" (13x19 in).
- Not a mediaOption keyword. */
+ Not a mediaOption keyword. */
ms_ISOB3,
ms_JISB3, /* PPD 4.3 calls this "B3" */
ms_A2,
@@ -140,7 +140,6 @@ typedef enum {
ms_MaxPage /* largest available size on a particular device */
} ms_Size;
-
typedef struct {
ms_Size size;
const char *name;
diff --git a/gs/contrib/pcl3/eprn/pagecount.c b/gs/contrib/pcl3/eprn/pagecount.c
index a36b90aa1..cde9f1c8f 100644
--- a/gs/contrib/pcl3/eprn/pagecount.c
+++ b/gs/contrib/pcl3/eprn/pagecount.c
@@ -2,7 +2,7 @@
File: $Id: pagecount.c,v 1.6 2000/10/07 17:48:49 Martin Rel $
Contents: Simple (page) count file facility on UNIX
Author: Martin Lottermoser, Greifswaldstrasse 28, 38124 Braunschweig,
- Germany. E-mail: Martin.Lottermoser@t-online.de.
+ Germany. E-mail: Martin.Lottermoser@t-online.de.
*******************************************************************************
* *
@@ -225,22 +225,22 @@ int pcf_inccount(const char *filename, unsigned long by)
FILE *f1 = fopen(filename, "w");
if (f1 == NULL) {
- fprintf(stderr, ERRPREFIX
- "Error opening page count file `%s' a second time: %s.\n",
- filename, strerror(errno));
+ fprintf(stderr, ERRPREFIX
+ "Error opening page count file `%s' a second time: %s.\n",
+ filename, strerror(errno));
rc = 1;
}
else {
if (fprintf(f1, "%lu\n", count + by) < 0) {
- fprintf(stderr, ERRPREFIX "Error writing to `%s': %s.\n",
- filename, strerror(errno));
- rc = -1;
+ fprintf(stderr, ERRPREFIX "Error writing to `%s': %s.\n",
+ filename, strerror(errno));
+ rc = -1;
}
if (fclose(f1) != 0) {
- fprintf(stderr,
- ERRPREFIX "Error closing `%s' after writing: %s.\n",
- filename, strerror(errno));
- rc = -1;
+ fprintf(stderr,
+ ERRPREFIX "Error closing `%s' after writing: %s.\n",
+ filename, strerror(errno));
+ rc = -1;
}
}
}
diff --git a/gs/contrib/pcl3/ps/calign.ps b/gs/contrib/pcl3/ps/calign.ps
index 37c566726..d256dc2a8 100644
--- a/gs/contrib/pcl3/ps/calign.ps
+++ b/gs/contrib/pcl3/ps/calign.ps
@@ -177,7 +177,7 @@ sehrgross setfont
40 runter
normal setfont
(The resolution is ) show
-currentpagedevice /HWResolution get
+currentpagedevice /HWResolution get
aload pop exch temp cvs show
( x ) show
temp cvs show
diff --git a/gs/contrib/pcl3/ps/levels-test.ps b/gs/contrib/pcl3/ps/levels-test.ps
index 9bdd35778..51c31ec30 100644
--- a/gs/contrib/pcl3/ps/levels-test.ps
+++ b/gs/contrib/pcl3/ps/levels-test.ps
@@ -129,15 +129,15 @@
% <HTD_1> <Name>
1 index 1 index known
{
- % <HTD_1> <Name>
- dup temp cvs show (: ) show
- 1 index exch get % <HTD_1> <HTD_2>
- dup
- (type ) show dup /HalftoneType get dup temp cvs show
- % <HTD_1> <HTD_2> <HTD_2> <Typ>
- HTDict2 zeigeHTTeile
- zeigeTF
- nz
+ % <HTD_1> <Name>
+ dup temp cvs show (: ) show
+ 1 index exch get % <HTD_1> <HTD_2>
+ dup
+ (type ) show dup /HalftoneType get dup temp cvs show
+ % <HTD_1> <HTD_2> <HTD_2> <Typ>
+ HTDict2 zeigeHTTeile
+ zeigeTF
+ nz
}
{pop}
ifelse
@@ -201,10 +201,10 @@
0 setlinewidth 0 setgray
currentpoint newpath moveto
maxLevel 1 add Breite mul
- dup 0 rlineto
- 0 Hoehe rlineto
- neg 0 rlineto
- closepath
+ dup 0 rlineto
+ 0 Hoehe rlineto
+ neg 0 rlineto
+ closepath
stroke
grestore
} if
@@ -245,9 +245,9 @@
Breite 2 div 0 rmoveto
0 1 schwarzeStufen 1 sub
{
- temp cvs
- gsave zeigeZentriert grestore
- Breite 0 rmoveto
+ temp cvs
+ gsave zeigeZentriert grestore
+ Breite 0 rmoveto
} for
grestore
3 runter
diff --git a/gs/contrib/pcl3/src/pcl3opts.c b/gs/contrib/pcl3/src/pcl3opts.c
index 394e232e1..c624c9990 100644
--- a/gs/contrib/pcl3/src/pcl3opts.c
+++ b/gs/contrib/pcl3/src/pcl3opts.c
@@ -1,8 +1,8 @@
/******************************************************************************
File: $Id: pcl3opts.c,v 1.17 2001/05/31 15:19:16 Martin Rel $
Contents: Program to convert information in PCL-3+ files into options to be
- used for the ghostscript device "pcl3" in order to produce a
- file using a similar configuration
+ used for the ghostscript device "pcl3" in order to produce a
+ file using a similar configuration
Author: Martin Lottermoser, Greifswaldstrasse 28, 38124 Braunschweig,
Germany; e-mail: Martin.Lottermoser@t-online.de.
@@ -178,15 +178,15 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
if (different_resolutions || different_non_black_levels) {
imessage(ip->out, 11,
"I've found a raster data section which uses a combination of "
- "resolutions\n"
+ "resolutions\n"
"and intensity levels which pcl3 cannot reproduce:\n");
for (j = 0; j < ip->fdata.number_of_colorants; j++)
imessage(ip->out, 12, " colorant %d: %4d x %4d ppi %2d levels\n",
- j + 1,
- ip->fdata.colorant_array[j].hres, ip->fdata.colorant_array[j].vres,
- ip->fdata.colorant_array[j].levels);
+ j + 1,
+ ip->fdata.colorant_array[j].hres, ip->fdata.colorant_array[j].vres,
+ ip->fdata.colorant_array[j].levels);
if (ip->fdata.palette == pcl_CMYK &&
- non_black_levels > 2 && black_levels < 4)
+ non_black_levels > 2 && black_levels < 4)
black_levels = 4;
}
@@ -269,19 +269,19 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
ll += fprintf(ip->out, " -sColourModel=");
switch (ip->fdata.palette) {
case pcl_black:
- ll += fprintf(ip->out, "Gray"); break;
+ ll += fprintf(ip->out, "Gray"); break;
case pcl_RGB:
- ll += fprintf(ip->out, "RGB"); break;
+ ll += fprintf(ip->out, "RGB"); break;
case pcl_CMY:
- ll += fprintf(ip->out, "CMY"); break;
+ ll += fprintf(ip->out, "CMY"); break;
case pcl_CMYK:
- if (ip->seen_new_quality || ip->seen_CRD) /* Guess */
- ll += fprintf(ip->out, "CMYK");
- else
- ll += fprintf(ip->out, "CMY+K");
- break;
+ if (ip->seen_new_quality || ip->seen_CRD) /* Guess */
+ ll += fprintf(ip->out, "CMYK");
+ else
+ ll += fprintf(ip->out, "CMY+K");
+ break;
default:
- assert(0); /* bug guard */
+ assert(0); /* bug guard */
}
}
@@ -309,13 +309,13 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
ll += fprintf(ip->out, " -sPrintQuality=");
switch (ip->fdata.print_quality) {
case -1:
- ll += fprintf(ip->out, "draft"); break;
+ ll += fprintf(ip->out, "draft"); break;
case 0:
- ll += fprintf(ip->out, "normal"); break;
+ ll += fprintf(ip->out, "normal"); break;
case 1:
- ll += fprintf(ip->out, "presentation"); break;
+ ll += fprintf(ip->out, "presentation"); break;
default:
- ll += fprintf(ip->out, "%d", ip->fdata.print_quality);
+ ll += fprintf(ip->out, "%d", ip->fdata.print_quality);
}
check_line_length(ip->out, &ll,
@@ -323,21 +323,21 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
ll += fprintf(ip->out, " -sMedium=");
switch (ip->fdata.media_type) {
case 0:
- ll += fprintf(ip->out, "plain"); break;
+ ll += fprintf(ip->out, "plain"); break;
case 1:
- ll += fprintf(ip->out, "bond"); break;
+ ll += fprintf(ip->out, "bond"); break;
case 2:
- ll += fprintf(ip->out, "Premium"); break;
+ ll += fprintf(ip->out, "Premium"); break;
case 3:
- ll += fprintf(ip->out, "glossy"); break;
+ ll += fprintf(ip->out, "glossy"); break;
case 4:
- ll += fprintf(ip->out, "transparency"); break;
+ ll += fprintf(ip->out, "transparency"); break;
case 5:
- ll += fprintf(ip->out, "'quick dry glossy'"); break;
+ ll += fprintf(ip->out, "'quick dry glossy'"); break;
case 6:
- ll += fprintf(ip->out, "'quick dry transparency'"); break;
+ ll += fprintf(ip->out, "'quick dry transparency'"); break;
default:
- ll += fprintf(ip->out, "%d", ip->fdata.media_type);
+ ll += fprintf(ip->out, "%d", ip->fdata.media_type);
}
}
else if (ip->seen_old_quality) {
@@ -351,9 +351,9 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
}
if (ip->fdata.raster_graphics_quality != -1) {
check_line_length(ip->out, &ll,
- sizeof("-dRasterGraphicsQuality=") + 2);
+ sizeof("-dRasterGraphicsQuality=") + 2);
ll += fprintf(ip->out, " -dRasterGraphicsQuality=%d",
- ip->fdata.raster_graphics_quality);
+ ip->fdata.raster_graphics_quality);
}
}
@@ -368,11 +368,11 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
if (ip->fdata.palette == pcl_CMYK && !ip->seen_first_colorant) {
imessage(ip->out, 70,
"Although the colour model in this file is declared as CMYK, "
- "the file does not\n"
+ "the file does not\n"
"use the black colorant. If you find that the printer does not accept "
- "a file\n"
+ "a file\n"
"generated with the command line above, "
- "try the CMY colour model instead.\n\n");
+ "try the CMY colour model instead.\n\n");
}
if (ip->fdata.size != 0) {
@@ -380,28 +380,28 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
const ms_SizeDescription *size = ms_find_size_from_code(media_code);
if (size == NULL)
imessage(ip->out, 14,
- "This file uses a PCL page size code (%d) which is unknown to pcl3.\n",
- (int)ip->fdata.size);
+ "This file uses a PCL page size code (%d) which is unknown to pcl3.\n",
+ (int)ip->fdata.size);
else {
imessage(ip->out, 15, "The page size is set to %s", size->name);
/* I'm using the size specification as an indication of the PCL Page Size
- code used, hence I'm adding the card flag if present. Note that
- adding "Big" is not useful. */
+ code used, hence I'm adding the card flag if present. Note that
+ adding "Big" is not useful. */
if (media_code & PCL_CARD_FLAG) fputs(PCL_CARD_STRING, ip->out);
if (size->dimen[0] > 0) {
- const char *unit = catgets(catd, 2, 16, "mm");
-
- fputs(" (", ip->out);
- if (strcmp(unit, "bp") == 0)
- fprintf(ip->out, "%.0f x %.0f bp", size->dimen[0],
- size->dimen[1]);
- else if (strcmp(unit, "in") == 0)
- fprintf(ip->out, "%.1f x %.1f in", size->dimen[0]/BP_PER_IN,
- size->dimen[1]/BP_PER_IN);
- else
- fprintf(ip->out, "%.0f x %.0f mm", size->dimen[0]/BP_PER_MM,
- size->dimen[1]/BP_PER_MM);
- fputc(')', ip->out);
+ const char *unit = catgets(catd, 2, 16, "mm");
+
+ fputs(" (", ip->out);
+ if (strcmp(unit, "bp") == 0)
+ fprintf(ip->out, "%.0f x %.0f bp", size->dimen[0],
+ size->dimen[1]);
+ else if (strcmp(unit, "in") == 0)
+ fprintf(ip->out, "%.1f x %.1f in", size->dimen[0]/BP_PER_IN,
+ size->dimen[1]/BP_PER_IN);
+ else
+ fprintf(ip->out, "%.0f x %.0f mm", size->dimen[0]/BP_PER_MM,
+ size->dimen[1]/BP_PER_MM);
+ fputc(')', ip->out);
}
fputs(".\n", ip->out);
}
@@ -417,7 +417,7 @@ static void print_result(CollectedInfo *ip) /* NLS: 10, 70 */
ip->fdata.media_destination != 0)
imessage(ip->out, 18,
"To be able to select a media position (input or output) you will have "
- "to\n"
+ "to\n"
"configure the `InputAttributes' or `OutputAttributes' dictionaries\n"
"appropriately. See the manual page gs-pcl3(1).\n");
@@ -505,7 +505,7 @@ static int action_duplex(FILE *in, const pcl_Command *cmd, void *i)
/******************************************************************************
Function to check "@PJL" prefix
-
+
Return codes:
0: starts correctly, prefix has been read,
1: starts wrong, read characters have been pushed back,
@@ -535,12 +535,12 @@ static int check_prefix(FILE *in)
while (j > 0) {
j--;
if (ungetc(prefix[j], in) == EOF) {
- emessage(80,
- "Error trying to push back characters while parsing PJL:\n %s.\n",
- strerror(errno));
- /* This should only happen for unprofessional PJL, i.e., without a
- terminating ENTER LANGUAGE. */
- return -1;
+ emessage(80,
+ "Error trying to push back characters while parsing PJL:\n %s.\n",
+ strerror(errno));
+ /* This should only happen for unprofessional PJL, i.e., without a
+ terminating ENTER LANGUAGE. */
+ return -1;
}
}
@@ -587,13 +587,13 @@ static int action_UEL(FILE *in, const pcl_Command *cmd, void *i)
/* Read up to EOL or EOF */
used = 0;
while ((c = fgetc(in)) != EOF && c != '\n') {
- if (used >= allocated - 1) {
- allocated += TILE_SIZE;
- buffer = (pcl_Octet *)realloc(buffer, allocated);
- check(buffer);
- }
- buffer[used] = c;
- used++;
+ if (used >= allocated - 1) {
+ allocated += TILE_SIZE;
+ buffer = (pcl_Octet *)realloc(buffer, allocated);
+ check(buffer);
+ }
+ buffer[used] = c;
+ used++;
}
/* Remove an optional trailing CR */
if (used > 0 && buffer[used-1] == 'r') used--;
@@ -604,59 +604,59 @@ static int action_UEL(FILE *in, const pcl_Command *cmd, void *i)
while (PJL_ws(*s)) s++;
if (PJL_letter(*s)) {
- pcl_Octet *t;
- int l;
-
- /* Isolate command and convert to upper case. Note that we're running
- in an internationalized environment, hence we can't use toupper(). */
- t = s;
- do {
- if ('a' <= *t && *t <= 'z') *t -= 'a' - 'A';
- t++;
- } while (*t != '\0' && !PJL_ws(*t));
-
- /* Identify command */
- l = t - s;
+ pcl_Octet *t;
+ int l;
+
+ /* Isolate command and convert to upper case. Note that we're running
+ in an internationalized environment, hence we can't use toupper(). */
+ t = s;
+ do {
+ if ('a' <= *t && *t <= 'z') *t -= 'a' - 'A';
+ t++;
+ } while (*t != '\0' && !PJL_ws(*t));
+
+ /* Identify command */
+ l = t - s;
#if 0
- fprintf(stderr, "Command (length %d): `", l);
- fwrite(s, 1, l, stderr);
- fprintf(stderr, "'.\n");
+ fprintf(stderr, "Command (length %d): `", l);
+ fwrite(s, 1, l, stderr);
+ fprintf(stderr, "'.\n");
#endif
- if (l == sizeof("ENTER") - 1 && strncmp(s, "ENTER", l) == 0 &&
- PJL_ws(*t)) {
- /* Check for "LANGUAGE" */
- s = t + 1;
- while (PJL_ws(*s)) s++;
- t = s;
- while (*t != '\0' && !PJL_ws(*t) && *t != '=') {
- if ('a' <= *t && *t <= 'z') *t -= 'a' - 'A';
- t++;
- }
- l = t - s;
- if (l == sizeof("LANGUAGE") - 1 && strncmp(s, "LANGUAGE", t - s) == 0
- && (PJL_ws(*t) || *t == '=')) {
- s = strchr(t, '='); /* again assuming legal PJL */
- if (s != NULL) {
- s++;
- while (PJL_ws(*s)) s++;
- if (PJL_letter(*s)){
- t = s + 1;
- while (*t != '\0' && !PJL_ws(*t)) t++;
- ip->fdata.PJL_language = (char *)malloc(t - s + 1);
- check(ip->fdata.PJL_language);
- strncpy(ip->fdata.PJL_language, s, t - s);
- ip->fdata.PJL_language[t - s] = '\0';
- }
- }
- c = EOF; /* exit PJL and this loop */
- }
- }
- else if (l == 3 && strncmp(s, "JOB", 3) == 0) {
- /* Don't bother to identify the job name; let the user create an
- unnamed job. */
- static char jobname[] = "";
- ip->fdata.PJL_job = jobname;
- }
+ if (l == sizeof("ENTER") - 1 && strncmp(s, "ENTER", l) == 0 &&
+ PJL_ws(*t)) {
+ /* Check for "LANGUAGE" */
+ s = t + 1;
+ while (PJL_ws(*s)) s++;
+ t = s;
+ while (*t != '\0' && !PJL_ws(*t) && *t != '=') {
+ if ('a' <= *t && *t <= 'z') *t -= 'a' - 'A';
+ t++;
+ }
+ l = t - s;
+ if (l == sizeof("LANGUAGE") - 1 && strncmp(s, "LANGUAGE", t - s) == 0
+ && (PJL_ws(*t) || *t == '=')) {
+ s = strchr(t, '='); /* again assuming legal PJL */
+ if (s != NULL) {
+ s++;
+ while (PJL_ws(*s)) s++;
+ if (PJL_letter(*s)){
+ t = s + 1;
+ while (*t != '\0' && !PJL_ws(*t)) t++;
+ ip->fdata.PJL_language = (char *)malloc(t - s + 1);
+ check(ip->fdata.PJL_language);
+ strncpy(ip->fdata.PJL_language, s, t - s);
+ ip->fdata.PJL_language[t - s] = '\0';
+ }
+ }
+ c = EOF; /* exit PJL and this loop */
+ }
+ }
+ else if (l == 3 && strncmp(s, "JOB", 3) == 0) {
+ /* Don't bother to identify the job name; let the user create an
+ unnamed job. */
+ static char jobname[] = "";
+ ip->fdata.PJL_job = jobname;
+ }
}
}
}
@@ -669,7 +669,7 @@ static int action_UEL(FILE *in, const pcl_Command *cmd, void *i)
/*****************************************************************************/
- /* NLS: 20 */
+ /* NLS: 20 */
static int action_compression(FILE *in, const pcl_Command *cmd, void *i)
{
CollectedInfo *ip = i;
@@ -678,8 +678,8 @@ static int action_compression(FILE *in, const pcl_Command *cmd, void *i)
cmd->i != pcl_cm_delta && cmd->i != pcl_cm_crdr) {
if (!ip->seen_unknown_compression)
imessage(ip->out, 20,
- "This file uses at least one compression method for raster data (%d)\n"
- "which pcl3 does not know.\n", cmd->i);
+ "This file uses at least one compression method for raster data (%d)\n"
+ "which pcl3 does not know.\n", cmd->i);
ip->seen_unknown_compression = TRUE;
}
else {
@@ -765,35 +765,35 @@ static int action_CRD(FILE *in, const pcl_Command *cmd, void *i) /* NLS: 30 */
ip->fdata.number_of_colorants = buffer[1];
switch (ip->fdata.number_of_colorants) {
- case 1:
- ip->fdata.palette = pcl_black; break;
- case 3:
- ip->fdata.palette = pcl_CMY; break;
- case 4:
- ip->fdata.palette = pcl_CMYK; break;
+ case 1:
+ ip->fdata.palette = pcl_black; break;
+ case 3:
+ ip->fdata.palette = pcl_CMY; break;
+ case 4:
+ ip->fdata.palette = pcl_CMYK; break;
}
for (j = 0; j < ip->fdata.number_of_colorants; j++) {
- ip->fdata.colorant_array[j].hres = two_octets(2 + 6*j);
- ip->fdata.colorant_array[j].vres = two_octets(4 + 6*j);
- ip->fdata.colorant_array[j].levels = two_octets(6 + 6*j);
+ ip->fdata.colorant_array[j].hres = two_octets(2 + 6*j);
+ ip->fdata.colorant_array[j].vres = two_octets(4 + 6*j);
+ ip->fdata.colorant_array[j].levels = two_octets(6 + 6*j);
}
{
- int power = 1;
- ip->first_colorant_planes = 0;
+ int power = 1;
+ ip->first_colorant_planes = 0;
- while (power < ip->fdata.colorant_array[0].levels) {
- power *= 2;
- ip->first_colorant_planes++;
- }
+ while (power < ip->fdata.colorant_array[0].levels) {
+ power *= 2;
+ ip->first_colorant_planes++;
+ }
}
}
else {
emessage(31,
- "This file contains a Configure Raster Data command with an\n"
- " illegal number of colorants (%d) and the following data:\n",
- buffer[1]);
+ "This file contains a Configure Raster Data command with an\n"
+ " illegal number of colorants (%d) and the following data:\n",
+ buffer[1]);
print_CRD(stderr, buffer);
errors++;
}
@@ -846,7 +846,7 @@ static int action_quality(FILE *in, const pcl_Command *cmd, void *i)
/*****************************************************************************/
- /* NLS: 40 */
+ /* NLS: 40 */
static int action_colour(FILE *in, const pcl_Command *cmd, void *i)
{
CollectedInfo *ip = i;
@@ -854,21 +854,21 @@ static int action_colour(FILE *in, const pcl_Command *cmd, void *i)
if (!ip->CRD_active) {
switch (cmd->i) {
case -4:
- ip->fdata.palette = pcl_CMYK; break;
+ ip->fdata.palette = pcl_CMYK; break;
case -3:
- ip->fdata.palette = pcl_CMY; break;
+ ip->fdata.palette = pcl_CMY; break;
case -1:
- /*FALLTHROUGH*/
+ /*FALLTHROUGH*/
case 0:
- /*FALLTHROUGH*/
+ /*FALLTHROUGH*/
case 1:
- ip->fdata.palette = pcl_black; break;
+ ip->fdata.palette = pcl_black; break;
case 3:
- ip->fdata.palette = pcl_RGB; break;
+ ip->fdata.palette = pcl_RGB; break;
default:
- emessage(41, "This file uses a palette (%d) not supported by pcl3.\n",
- cmd->i);
- return -1;
+ emessage(41, "This file uses a palette (%d) not supported by pcl3.\n",
+ cmd->i);
+ return -1;
}
ip->fdata.number_of_colorants = abs(cmd->i);
@@ -876,9 +876,9 @@ static int action_colour(FILE *in, const pcl_Command *cmd, void *i)
int j;
for (j = 0; j < ip->fdata.number_of_colorants; j++) {
- ip->fdata.colorant_array[j].hres = ip->fdata.colorant_array[j].vres =
- ip->fdata.colorant_array[0].hres;
- ip->fdata.colorant_array[j].levels = 2;
+ ip->fdata.colorant_array[j].hres = ip->fdata.colorant_array[j].vres =
+ ip->fdata.colorant_array[0].hres;
+ ip->fdata.colorant_array[j].levels = 2;
}
}
@@ -901,7 +901,7 @@ static int action_resolution(FILE *in, const pcl_Command *cmd, void *i)
for (j = 0; j < ip->fdata.number_of_colorants; j++) {
ip->fdata.colorant_array[j].hres =
- ip->fdata.colorant_array[j].vres = cmd->i;
+ ip->fdata.colorant_array[j].vres = cmd->i;
ip->fdata.colorant_array[j].levels = 2;
}
}
@@ -976,8 +976,8 @@ static int analyzer(FILE *in, const pcl_Command *cmd, void *i)
/* Control codes */
if (cmd->kind == 1) {
if (cmd->chars[0] == '\0' &&
- /* Guard against NULs somewhere else except initially */
- !ip->seen_RGR && !ip->seen_CRD)
+ /* Guard against NULs somewhere else except initially */
+ !ip->seen_RGR && !ip->seen_CRD)
ip->fdata.NULs_to_send = cmd->i;
return 0;
}
@@ -987,27 +987,27 @@ static int analyzer(FILE *in, const pcl_Command *cmd, void *i)
switch (cmd->chars[0]) {
case 'E': /* Printer Reset */
{
- /* Preserve some global data (mostly PJL state) across PCL Reset
- invocations */
- unsigned int NULs_to_send = ip->fdata.NULs_to_send;
- char *PJL_language = ip->fdata.PJL_language;
- char *PJL_job = ip->fdata.PJL_job;
-
- ip->CRD_active = FALSE;
- ip->seen_raster_data = FALSE;
- memset(&ip->fdata, 0, sizeof(pcl_FileData));
- ip->fdata.colorant_array[0].hres =
- ip->fdata.colorant_array[0].vres = 75;
- ip->fdata.colorant_array[0].levels = 2;
- ip->fdata.number_of_colorants = 1;
- ip->fdata.duplex = -1;
- ip->fdata.dry_time = -1;
- ip->fdata.raster_graphics_quality = -1;
- ip->fdata.shingling = -1;
-
- ip->fdata.NULs_to_send = NULs_to_send;
- ip->fdata.PJL_language = PJL_language;
- ip->fdata.PJL_job = PJL_job;
+ /* Preserve some global data (mostly PJL state) across PCL Reset
+ invocations */
+ unsigned int NULs_to_send = ip->fdata.NULs_to_send;
+ char *PJL_language = ip->fdata.PJL_language;
+ char *PJL_job = ip->fdata.PJL_job;
+
+ ip->CRD_active = FALSE;
+ ip->seen_raster_data = FALSE;
+ memset(&ip->fdata, 0, sizeof(pcl_FileData));
+ ip->fdata.colorant_array[0].hres =
+ ip->fdata.colorant_array[0].vres = 75;
+ ip->fdata.colorant_array[0].levels = 2;
+ ip->fdata.number_of_colorants = 1;
+ ip->fdata.duplex = -1;
+ ip->fdata.dry_time = -1;
+ ip->fdata.raster_graphics_quality = -1;
+ ip->fdata.shingling = -1;
+
+ ip->fdata.NULs_to_send = NULs_to_send;
+ ip->fdata.PJL_language = PJL_language;
+ ip->fdata.PJL_job = PJL_job;
}
break;
default:
@@ -1130,7 +1130,7 @@ int main(int argc, char **argv)
outfile = fopen(outfile_name, "w");
if (outfile == NULL) {
emessage(2, "The file `%s' could not be opened for writing:\n %s.\n",
- outfile_name, strerror(errno));
+ outfile_name, strerror(errno));
exit(EXIT_FAILURE);
}
}
@@ -1146,7 +1146,7 @@ int main(int argc, char **argv)
infile = fopen(infile_name, "rb");
if (infile == NULL) {
emessage(3, "Could not open the input file `%s':\n %s.\n",
- infile_name, strerror(errno));
+ infile_name, strerror(errno));
exit(EXIT_FAILURE);
}
@@ -1156,7 +1156,7 @@ int main(int argc, char **argv)
/* Close */
if (fclose(infile) != 0) {
emessage(4, "Error closing `%s':\n %s.\n",
- infile_name, strerror(errno));
+ infile_name, strerror(errno));
errors++;
}
optind++;
diff --git a/gs/contrib/pcl3/src/pclcap.c b/gs/contrib/pcl3/src/pclcap.c
index 327f0a480..92cf495e2 100644
--- a/gs/contrib/pcl3/src/pclcap.c
+++ b/gs/contrib/pcl3/src/pclcap.c
@@ -91,9 +91,9 @@ static const eprn_PageDescription
/* Order of margins: left, bottom, right, top. */
hpdj3xx_sizes[] = {
/* These are the page descriptions for the DeskJets Portable, 310, 320 and
- 340, taken from DJ3/4, pp. 1 and 20. When printing in colour, the
- bottom margin is larger by 50 d.
- Note that BPD05054 gives different margins.
+ 340, taken from DJ3/4, pp. 1 and 20. When printing in colour, the
+ bottom margin is larger by 50 d.
+ Note that BPD05054 gives different margins.
*/
{ms_Letter,
75*BP_PER_DOT, 120*BP_PER_DOT, 75*BP_PER_DOT, 30*BP_PER_DOT},
@@ -108,12 +108,12 @@ static const eprn_PageDescription
hpdj400_sizes[] = {
/* These are the page descriptions for the DeskJet 400 taken from DJ3/4,
pp. 1 and 21, and are stated to be valid valid for black and colour.
- Page 21 contains the following statement: "The mechanism will
- physically shift the page image downwards by a nominal 0.08 inch
- (2.0 mm)." I conclude this to mean that the real top margin is
- 0.08 inch instead of zero as specified and that the real bottom margin
- is smaller than specified by 0.08 inch.
- Note that BPD05054 gives different margins.
+ Page 21 contains the following statement: "The mechanism will
+ physically shift the page image downwards by a nominal 0.08 inch
+ (2.0 mm)." I conclude this to mean that the real top margin is
+ 0.08 inch instead of zero as specified and that the real bottom margin
+ is smaller than specified by 0.08 inch.
+ Note that BPD05054 gives different margins.
*/
{ms_Letter,
0.25*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.25*BP_PER_IN, 0.08*BP_PER_IN},
@@ -126,10 +126,10 @@ static const eprn_PageDescription
{ms_JISB5,
3.175*BP_PER_MM, (0.5-0.08)*BP_PER_IN, 3.25*BP_PER_MM, 0.08*BP_PER_IN},
/* DJ3/4 p. 21: "Envelopes are printed in the landscape mode". As the
- margins are given such that the largest value is designated as "bottom"
- and the bottom is designated on page 19 as a long edge, I conclude that
- the DJ 400 feeds envelopes long edge first. The list on p. 1 gives the
- dimensions for Env10 in portrait and EnvDL in landscape orientation.
+ margins are given such that the largest value is designated as "bottom"
+ and the bottom is designated on page 19 as a long edge, I conclude that
+ the DJ 400 feeds envelopes long edge first. The list on p. 1 gives the
+ dimensions for Env10 in portrait and EnvDL in landscape orientation.
*/
{ms_Env10 | MS_TRANSVERSE_FLAG,
0.125*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.08*BP_PER_IN, 0.08*BP_PER_IN},
@@ -139,10 +139,10 @@ static const eprn_PageDescription
},
hpdj500_sizes[] = {
/* These are taken from the TRG500 p. 1-18 except for No. 10 envelopes
- which are supported according to p. 3-2 and where I took the margins
- from BPD05054. The resulting collection agrees with BPD05054 which
- declares it to be valid for the HP DeskJet and the HP DeskJet Plus as
- well.
+ which are supported according to p. 3-2 and where I took the margins
+ from BPD05054. The resulting collection agrees with BPD05054 which
+ declares it to be valid for the HP DeskJet and the HP DeskJet Plus as
+ well.
Order of margins: left, bottom, right, top. */
{ms_Letter,
0.25*BP_PER_IN, 0.57*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN},
@@ -156,11 +156,11 @@ static const eprn_PageDescription
},
hpdj500c_sizes[] = {
/* The data are from the TRG500 pp. 1-18 and 1-19 except for No. 10
- envelopes which are supported according to p. 3-2 and which I took from
- BPD05054. The values listed in both documents agree.
- These are the values for the black cartridge; the CMY cartridge needs
- 0.17 inches more at the bottom.
- Order of margins: left, bottom, right, top. */
+ envelopes which are supported according to p. 3-2 and which I took from
+ BPD05054. The values listed in both documents agree.
+ These are the values for the black cartridge; the CMY cartridge needs
+ 0.17 inches more at the bottom.
+ Order of margins: left, bottom, right, top. */
{ms_Letter,
0.25*BP_PER_IN, 0.4*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN},
{ms_Legal,
@@ -169,17 +169,17 @@ static const eprn_PageDescription
3.1*BP_PER_MM, 0.4*BP_PER_IN, 3.6*BP_PER_MM, 0.1*BP_PER_IN},
{ms_Env10 | MS_TRANSVERSE_FLAG,
/* Margins from BPD05054, but I've chosen 0.4 in for the bottom margin
- instead of 0.57 in as listed there because it looks to me like the
- colour bottom. Compare with the DJ 500. */
+ instead of 0.57 in as listed there because it looks to me like the
+ colour bottom. Compare with the DJ 500. */
0.75*BP_PER_IN, 0.4*BP_PER_IN, 0.75*BP_PER_IN, 0.1*BP_PER_IN},
{ms_none}
},
common_sizes[] = { /* DJs 510, 520, 550C und 560C for printing in black */
/* The data are from the TRG500 p. 1-19 except for envelopes which are
- supported according to p. 3-2 and where I took the margins from
- BPD05054. The values listed in both documents agree.
- For colour, the bottom margin must be increased by 0.13 inches.
- Order of margins: left, bottom, right, top. */
+ supported according to p. 3-2 and where I took the margins from
+ BPD05054. The values listed in both documents agree.
+ For colour, the bottom margin must be increased by 0.13 inches.
+ Order of margins: left, bottom, right, top. */
{ms_Letter,
0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
{ms_Legal,
@@ -198,10 +198,10 @@ static const eprn_PageDescription
},
hpdj540_sizes[] = {
/* The data are from the TRG500 pp. 1-20 and 1-21 except that I have used
- a top margin of 0.04 inch from the DG instead of zero from the TRG500.
- Taking into account that the bottom margin is larger by 0.13 inches in
- colour, the resulting data agree with those in the DG, pp. 65-66.
- Order of margins: left, bottom, right, top. */
+ a top margin of 0.04 inch from the DG instead of zero from the TRG500.
+ Taking into account that the bottom margin is larger by 0.13 inches in
+ colour, the resulting data agree with those in the DG, pp. 65-66.
+ Order of margins: left, bottom, right, top. */
{ms_Executive,
0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
{ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
@@ -226,13 +226,13 @@ static const eprn_PageDescription
},
hpdj660c_sizes[] = {
/* These are taken from "HP DeskJet 660C Printer - Printable Regions",
- BPD02519, 1996 (obtained in March 1997), except that I've again
- increased the top margin from zero to 0.04 inches following BPD05054
- and DG pp. 69-70. These are the values for printing in black from DOS.
- Colour printing increases the bottom margin by 0.13 inch. Adding this
- value reproduces the data from BPD05054 and the DG. This is, however, a
- contradiction with DG because BPD02519 gives different values for
- printing from Windows.
+ BPD02519, 1996 (obtained in March 1997), except that I've again
+ increased the top margin from zero to 0.04 inches following BPD05054
+ and DG pp. 69-70. These are the values for printing in black from DOS.
+ Colour printing increases the bottom margin by 0.13 inch. Adding this
+ value reproduces the data from BPD05054 and the DG. This is, however, a
+ contradiction with DG because BPD02519 gives different values for
+ printing from Windows.
*/
{ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
{ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
@@ -242,10 +242,10 @@ static const eprn_PageDescription
{ms_A5, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN},
{ms_JISB5, 0.17*BP_PER_IN, 0.46*BP_PER_IN, 0.17*BP_PER_IN, 0.04*BP_PER_IN},
/* The bottom margin for JISB5 is given with large differences. BPD02519
- specifies it as 0.46 in for black from DOS, 0.59 in DOS/colour (agreeing
- with +0.13 in for 'bottom_increment') and the same for Windows black or
- colour. BPD05054 gives 0.84 in without distinguishing between black and
- colour, and the DG gives 0.59 in. */
+ specifies it as 0.46 in for black from DOS, 0.59 in DOS/colour (agreeing
+ with +0.13 in for 'bottom_increment') and the same for Windows black or
+ colour. BPD05054 gives 0.84 in without distinguishing between black and
+ colour, and the DG gives 0.59 in. */
{ms_Env10, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN},
/* given in landscape by HP */
{ms_EnvDL, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN},
@@ -263,7 +263,7 @@ static const eprn_PageDescription
{ms_EnvUS_A2,
0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN},
/* Supported (BPD02925, BPD05054, DG), margins from BPD05054 agreeing
- with DG p. 70 */
+ with DG p. 70 */
{ms_none}
},
hpdj680c_sizes[] = {
@@ -347,11 +347,11 @@ static const eprn_PageDescription
The manual agrees with "HP DeskJet 850C and 855C Printer -- Printable
Regions" (BPD02523), HP FIRST #: 2789, 1995-09-05, and the newer
"HP DeskJet 855C, 850C, 870C and 890C Series Printers -- Printable Areas"
- (BPD02523), effective date 1996-06-06.
+ (BPD02523), effective date 1996-06-06.
There are some minor deviations in the DG, pp. 81-82, which I have
partially adopted.
First some shorthand notation for margin types. The order is:
- left, bottom, right, top.
+ left, bottom, right, top.
*/
#define type1 6.4*BP_PER_MM, 11.7*BP_PER_MM, 6.4*BP_PER_MM, 1.0*BP_PER_MM
#define type2 3.4*BP_PER_MM, 11.7*BP_PER_MM, 3.4*BP_PER_MM, 1.0*BP_PER_MM
@@ -365,11 +365,11 @@ static const eprn_PageDescription
{ms_A5, type2}, /* also BPD05054. DG: type4 */
{ms_JISB5, type4}, /* from DG */
/* The German handbook as well as BPD02523 and BPD05054 state that this
- should be type3. This is however demonstrably wrong for the DJ 850C.
- Besides I can't see why the top margin should be so much larger for
- JIS B5 than for the other sizes. 'type4' agrees fairly well with what
- I've measured on a DJ 850C. In particular the right and bottom clipping
- margins are definitely close to 3 and 11.5 mm, respectively.
+ should be type3. This is however demonstrably wrong for the DJ 850C.
+ Besides I can't see why the top margin should be so much larger for
+ JIS B5 than for the other sizes. 'type4' agrees fairly well with what
+ I've measured on a DJ 850C. In particular the right and bottom clipping
+ margins are definitely close to 3 and 11.5 mm, respectively.
*/
{ms_Index4x6in, type4},
{ms_Index5x8in, type4},
@@ -379,11 +379,11 @@ static const eprn_PageDescription
{ms_EnvDL, type5},
{ms_EnvC6, type5},
/* BPD02926 claims that the series-800 DeskJets support also US A2 envelope
- size (ms_EnvUS_A2). I've experimented with a DeskJet 850C and I don't
- believe it: when sent this page size code, the printer establishes
- clipping regions which agree with those for US Letter size. This
- indicates that the PCL interpreter has not recognized the page size code
- and has therefore switched to the default size. */
+ size (ms_EnvUS_A2). I've experimented with a DeskJet 850C and I don't
+ believe it: when sent this page size code, the printer establishes
+ clipping regions which agree with those for US Letter size. This
+ indicates that the PCL interpreter has not recognized the page size code
+ and has therefore switched to the default size. */
{ms_none}
#undef type1
/* type2 will be needed in a moment */
@@ -395,64 +395,64 @@ static const eprn_PageDescription
/* These values are from DJ1120C, pp. 11-12, and from BPD05567. I don't
consider them particularly trustworthy. */
{ms_Executive, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
{ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
{ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
{ms_Tabloid, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
{ms_Statement, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN}, /* Not in BPD05567. */
+ 0.12*BP_PER_IN}, /* Not in BPD05567. */
{ms_HPSuperB, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
{ms_A6, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN}, /* Not in BPD05567. */
+ 0.12*BP_PER_IN}, /* Not in BPD05567. */
{ms_A5, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_A4, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.13 in, 0.46 in, 0.13 in, 0.12 in. */
{ms_A3, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN}, /* Only in BPD05567. */
+ 0.12*BP_PER_IN}, /* Only in BPD05567. */
{ms_JISB5, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_JISB4, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN}, /* Not in BPD05567. */
+ 0.12*BP_PER_IN}, /* Not in BPD05567. */
{ms_Postcard, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_A6 | PCL_CARD_FLAG, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_Index4x6in, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_Index5x8in, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_Env10, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvDL, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvC6, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvUS_A2, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvChou3, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvChou4, 0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN,
- 0.12*BP_PER_IN},
+ 0.12*BP_PER_IN},
/* BPD05567: 0.12 in, 0.46 in, 0.12 in, 0.12 in. */
{ms_EnvKaku2, 0.20*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN,
- 0.12*BP_PER_IN}, /* Not in BPD05567. */
+ 0.12*BP_PER_IN}, /* Not in BPD05567. */
/* Banners are listed only in BPD05567: */
{ms_Letter | MS_BIG_FLAG,
0.25*BP_PER_IN, 0, 0.25*BP_PER_IN, 0.04*BP_PER_IN},
@@ -507,14 +507,14 @@ static const eprn_CustomPageDescription
},
hpdj850c_custom_sizes[] = {
{ /*
- The following values have been taken from the German DeskJet 850C
- manual, "HP DeskJet 850C Handbuch", C2145-90248, 3/95.
- They agree with the values given in the newer version of BPD02523 for
- the DeskJets 850C, 855C, 870C and 890C except that the left and right
- margins are stated to be 3.44 mm instead of 3.4 mm. This is almost
- certainly a misprint because the accompanying value in inches is
- identical (0.13 in, i.e. 3.30 mm), and specifying the margins to a
- hundredth of a millimetre is ridiculous.
+ The following values have been taken from the German DeskJet 850C
+ manual, "HP DeskJet 850C Handbuch", C2145-90248, 3/95.
+ They agree with the values given in the newer version of BPD02523 for
+ the DeskJets 850C, 855C, 870C and 890C except that the left and right
+ margins are stated to be 3.44 mm instead of 3.4 mm. This is almost
+ certainly a misprint because the accompanying value in inches is
+ identical (0.13 in, i.e. 3.30 mm), and specifying the margins to a
+ hundredth of a millimetre is ridiculous.
*/
ms_CustomPageSize,
type2,
@@ -524,7 +524,7 @@ static const eprn_CustomPageDescription
},
hpdj1120c_custom_sizes[] = {
{ /* Taken from DJ1120C pp. 10 and 12. The minimum sizes are guessed
- (smallest supported discrete dimensions) */
+ (smallest supported discrete dimensions) */
ms_CustomPageSize,
0.125*BP_PER_IN, 0.46*BP_PER_IN, 0.125*BP_PER_IN, 0.12*BP_PER_IN,
90*BP_PER_MM, 13*BP_PER_IN, 146*BP_PER_MM, 19*BP_PER_IN,
@@ -562,8 +562,8 @@ static const eprn_Resolution
basic_resolutions[] = {
{ 75, 75 }, { 100, 100 }, { 150, 150 }, { 300, 300 }, { 0, 0 }
/* This is the list of resolutions supported by the series 300, 400 and
- 500 DeskJets (except the DJ 540) in black and colour and by the series
- 600 and 800 DeskJets (except the DJs 85xC) in colour. */
+ 500 DeskJets (except the DJ 540) in black and colour and by the series
+ 600 and 800 DeskJets (except the DJs 85xC) in colour. */
},
basic_without_100[] = {
{ 75, 75 }, { 150, 150 }, { 300, 300 }, { 0, 0 }
@@ -721,12 +721,12 @@ const pcl_PrinterDescription pcl3_printers[] = {
{ HPDJPortable, pcl_level_3plus_S5,
{ "HP DeskJet Portable", hpdj3xx_sizes, NULL, 0.0, ci_old_mono } },
/* DJ3/4 p. 2: This printer behaves as the 550C without the colour
- cartridge. */
+ cartridge. */
{ HPDJ310, pcl_level_3plus_S5,
{ "HP DeskJet 310", hpdj3xx_sizes, NULL, 50*BP_PER_DOT, ci_hpdj500c } },
/* DJ3/4 p. 3: The 3xx DeskJets with the black cartridge installed behave
- identically to the DJ Portable, with the colour cartridge they can be
- treated as the DJ 500C. */
+ identically to the DJ Portable, with the colour cartridge they can be
+ treated as the DJ 500C. */
{ HPDJ320, pcl_level_3plus_S5,
{ "HP DeskJet 320", hpdj3xx_sizes, NULL, 50*BP_PER_DOT, ci_hpdj500c } },
{ HPDJ340, pcl_level_3plus_S5,
@@ -850,15 +850,15 @@ void pcl3_fill_defaults(pcl_Printer printer, pcl_FileData *data)
/*FALLTHROUGH*/
case HPDJ500:
/* The DJ 500 does not support method 9 but it does support method 3
- (TRG500). I am guessing that the same is true for the HP DeskJet and
- the HP DeskJet Plus. */
+ (TRG500). I am guessing that the same is true for the HP DeskJet and
+ the HP DeskJet Plus. */
data->compression = pcl_cm_delta;
break;
case pcl3_generic_old:
/*FALLTHROUGH*/
case pcl3_generic_new:
/* All HP drivers I have seen use method 2 when writing a PCL file to
- disk. Presumably, this is the most portable compression method. */
+ disk. Presumably, this is the most portable compression method. */
data->compression = pcl_cm_tiff;
break;
default:
diff --git a/gs/contrib/pcl3/src/pclcomp.c b/gs/contrib/pcl3/src/pclcomp.c
index 263f70f31..f21527bf5 100644
--- a/gs/contrib/pcl3/src/pclcomp.c
+++ b/gs/contrib/pcl3/src/pclcomp.c
@@ -162,7 +162,6 @@ static int compress_tiff(const pcl_Octet *in, int incount, pcl_Octet *out,
last = *in; in++; /* Fetch one octet and remember it. */
/* to state2 */
-
state2:
/* One octet to be treated is in 'last', 'in' points to the next. */
if (*in != last) {
@@ -175,7 +174,6 @@ static int compress_tiff(const pcl_Octet *in, int incount, pcl_Octet *out,
repeated = 2;
/* to state3 */
-
state3:
/* We have read 'repeated' occurrences of 'last', 'in' is positioned on
the last octet read. It is true that 2 <= repeated < 128 and
@@ -198,7 +196,6 @@ static int compress_tiff(const pcl_Octet *in, int incount, pcl_Octet *out,
in++;
goto state1;
-
state4:
/* We have read 'stored'+2 octets, 0 <= stored <= 126. All except the
last two have already been stored before the current value of 'out',
@@ -209,9 +206,9 @@ static int compress_tiff(const pcl_Octet *in, int incount, pcl_Octet *out,
do {
*out = last; stored++; available--; out++;
if (in == end) {
- *out = *in; stored++; available--;
- out[-stored] = stored - 1; /* control byte */
- goto finished;
+ *out = *in; stored++; available--;
+ out[-stored] = stored - 1; /* control byte */
+ goto finished;
}
if (available < 2) return -1;
last = *in;
@@ -251,7 +248,6 @@ static int compress_tiff(const pcl_Octet *in, int incount, pcl_Octet *out,
if (available < 3) return -1;
*out = last; stored++; available--; out++; /* The first repeated octet */
goto state4;
-
finished:
return maxoutcount - available;
@@ -347,27 +343,26 @@ static int write_delta_replacement(pcl_Octet *out, int available, int reloffset,
if (invalue != prevvalue) { \
int reloffset = pos - absoffset; /* "left offset" */ \
absoffset = pos; /* first different octet */ \
- \
+ \
/* Collect different octets, at most 8 */ \
do pos++; \
while (pos < bound && pos < absoffset + 8 && invalue != prevvalue); \
/* All the octets with positions in [absoffset, pos) have to */ \
/* be replaced, and there are at most 8 of them. */ \
- \
+ \
/* Write the replacement string */ \
{ \
- int written; \
- written = write_delta_replacement(out + opos, maxoutcount - opos, \
- reloffset, repstart, pos - absoffset); \
- if (written < 0) return -1; \
- opos += written; \
+ int written; \
+ written = write_delta_replacement(out + opos, maxoutcount - opos, \
+ reloffset, repstart, pos - absoffset); \
+ if (written < 0) return -1; \
+ opos += written; \
} \
absoffset = pos; \
} \
else pos++; \
}
-
static int compress_delta(const pcl_Octet *in, int incount,
const pcl_Octet *prev, int prevcount, pcl_Octet *out, int maxoutcount)
{
@@ -383,7 +378,7 @@ static int compress_delta(const pcl_Octet *in, int incount,
if (incount == prevcount &&
(incount == 0 || memcmp(in, prev, incount) == 0)) return 0;
/* Can there be machines where memcmp() compares bits beyond those
- used for the 'pcl_Octet's? Unlikely. */
+ used for the 'pcl_Octet's? Unlikely. */
return -1;
}
@@ -391,7 +386,7 @@ static int compress_delta(const pcl_Octet *in, int incount,
mincount = (incount < prevcount? incount: prevcount);
pos = 0; opos = 0;
absoffset = 0; /* first untreated octet, i.e. position after the last
- unaltered octet. */
+ unaltered octet. */
/* Loop over parts common to this and the last row */
delta_loop(mincount, in[pos], prev[pos], in + absoffset);
@@ -568,7 +563,7 @@ static int write_crdr_replacement(pcl_Octet *out, int maxoutcount,
int incount = (bdup == final? repcount: bdup - in);
int rc;
rc = write_crdr_uncompressed(out + written, maxoutcount - written,
- reloffset, in, incount);
+ reloffset, in, incount);
if (rc < 0) return rc;
written += rc;
reloffset = 0;
@@ -586,7 +581,7 @@ static int write_crdr_replacement(pcl_Octet *out, int maxoutcount,
while (edup < final && *(edup + 1) == *bdup) edup++;
incount = edup - bdup + 1;
rc = write_crdr_compressed(out + written, maxoutcount - written,
- reloffset, *bdup, incount);
+ reloffset, *bdup, incount);
if (rc < 0) return rc;
written += rc;
reloffset = 0;
@@ -632,16 +627,15 @@ static int write_crdr_replacement(pcl_Octet *out, int maxoutcount,
int reloffset = pos - absoffset, written; \
absoffset = pos; \
do pos++; while (pos < bound && invalue != prevvalue); \
- \
+ \
written = write_crdr_replacement(out + opos, maxoutcount - opos, \
- reloffset, repstart, pos - absoffset); \
+ reloffset, repstart, pos - absoffset); \
if (written < 0) return written; \
absoffset = pos; \
opos += written; \
} \
}
-
static int compress_crdr(const pcl_Octet *in, int incount,
const pcl_Octet *prev, int prevcount, pcl_Octet *out, int maxoutcount)
{
@@ -704,7 +698,6 @@ static int compress_crdr(const pcl_Octet *in, int incount,
#define is_valid(s) \
(s != NULL && ((s)->length == 0 || (s)->length > 0 && (s)->str != NULL))
-
int pcl_compress(pcl_Compression method, const pcl_OctetString *in,
const pcl_OctetString *prev, pcl_OctetString *out)
{
diff --git a/gs/contrib/pcl3/src/pclgen.c b/gs/contrib/pcl3/src/pclgen.c
index 1f3dcdb16..9b6f9ea4a 100644
--- a/gs/contrib/pcl3/src/pclgen.c
+++ b/gs/contrib/pcl3/src/pclgen.c
@@ -173,180 +173,180 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
else {
/* Palette und colorants */
switch(data->palette) {
- case pcl_no_palette:
- /*FALLTHROUGH*/
- case pcl_black: invalid = data->number_of_colorants != 1; break;
- case pcl_CMY: invalid = data->number_of_colorants != 3; break;
- case pcl_RGB: invalid = data->number_of_colorants != 3; break;
- case pcl_CMYK: invalid = data->number_of_colorants != 4; break;
- default: invalid = data->number_of_colorants <= 0;
+ case pcl_no_palette:
+ /*FALLTHROUGH*/
+ case pcl_black: invalid = data->number_of_colorants != 1; break;
+ case pcl_CMY: invalid = data->number_of_colorants != 3; break;
+ case pcl_RGB: invalid = data->number_of_colorants != 3; break;
+ case pcl_CMYK: invalid = data->number_of_colorants != 4; break;
+ default: invalid = data->number_of_colorants <= 0;
}
if (invalid)
- fputs(ERRPREF
- "Palette specification and number of colorants are inconsistent.\n",
- stderr);
+ fputs(ERRPREF
+ "Palette specification and number of colorants are inconsistent.\n",
+ stderr);
else {
- if (data->colorant == NULL) colorant = data->colorant_array;
- else colorant = data->colorant;
-
- /* First pass over colorants: find minimal and maximal resolutions,
- check the number of intensity levels */
- data->minvres = colorant[0].vres;
- for (j = 0; j < data->number_of_colorants; j++) {
- if (colorant[j].hres <= 0 || colorant[j].vres <= 0) {
- invalid = TRUE;
- fprintf(stderr, ERRPREF
- "The resolution for colorant %d is not positive: %u x %u ppi.\n",
- j, colorant[j].hres, colorant[j].vres);
- }
- else {
- if (colorant[j].vres < data->minvres)
- data->minvres = colorant[j].vres;
- if (colorant[j].hres > maxhres) maxhres = colorant[j].hres;
- if (colorant[j].vres > maxvres) maxvres = colorant[j].vres;
- }
- if (colorant[j].levels < 2 || 0xFFFF < colorant[j].levels) {
- invalid = TRUE;
- fprintf(stderr, ERRPREF "The number of intensity levels for "
- "colorant %d is %u instead of at least 2 and at most 65535.\n",
- j, colorant[j].levels);
- /* Actually, DJ6/8 p. 68 requires the levels to be in the range
- 2-255, but as there are two octets available in the CRD format
- this seems unnecessarily strict. */
- }
- }
-
- /* Check for relations between resolutions and the need for CRD */
- if (!invalid) /* this implies that all resolutions are positive */
- for (j = 0; j < data->number_of_colorants; j++) {
- /* If there is more than one resolution or more than 2 levels we
- need CRD. Note that we compare with 'maxhres' in both lines: */
- if (maxhres != colorant[j].hres ||
- maxhres != colorant[j].vres || colorant[j].levels > 2)
- needs_CRD = TRUE;
-
- /* DJ6/8 states that the highest horizontal resolution must be a
- multiple of all lower horizontal resolutions and the same for
- the set of vertical resolutions. The reason is not given but
- these properties imply that it is possible to operate uniformly
- on a grid at the highest resolution.
- In contrast, the way in which raster data are transferred
- (strips with a height equal to the reciprocal of the lowest
- vertical resolution) logically requires that all vertical
- resolutions are multiples of the lowest vertical resolution.
- This condition is not stated in DJ6/8 but it is satisfied by
- all examples given in that document. This includes example 4 on
- page 72 which is meant to illustrate the maximum flexibility of
- format 2 and which describes a situation where the
- corresponding condition does not hold for the horizontal
- resolutions.
- */
- if (colorant[j].vres % data->minvres != 0) {
- invalid = TRUE;
- fprintf(stderr, ERRPREF
- "The vertical resolution for colorant %d (%u ppi) is not a "
- "multiple of the lowest vertical resolution (%u ppi).\n",
- j, colorant[j].vres, data->minvres);
- }
- if (maxhres % colorant[j].hres != 0) {
- invalid = TRUE;
- fprintf(stderr, ERRPREF
- "The highest horizontal resolution (%u ppi) is not a multiple "
- "of the horizontal resolution for colorant %d (%u ppi).\n",
- maxhres, j, colorant[j].hres);
- }
- if (maxvres % colorant[j].vres != 0) {
- invalid = TRUE;
- fprintf(stderr, ERRPREF
- "The highest vertical resolution (%u ppi) is not a multiple "
- "of the vertical resolution for colorant %d (%u ppi).\n",
- maxvres, j, colorant[j].vres);
- }
- }
+ if (data->colorant == NULL) colorant = data->colorant_array;
+ else colorant = data->colorant;
+
+ /* First pass over colorants: find minimal and maximal resolutions,
+ check the number of intensity levels */
+ data->minvres = colorant[0].vres;
+ for (j = 0; j < data->number_of_colorants; j++) {
+ if (colorant[j].hres <= 0 || colorant[j].vres <= 0) {
+ invalid = TRUE;
+ fprintf(stderr, ERRPREF
+ "The resolution for colorant %d is not positive: %u x %u ppi.\n",
+ j, colorant[j].hres, colorant[j].vres);
+ }
+ else {
+ if (colorant[j].vres < data->minvres)
+ data->minvres = colorant[j].vres;
+ if (colorant[j].hres > maxhres) maxhres = colorant[j].hres;
+ if (colorant[j].vres > maxvres) maxvres = colorant[j].vres;
+ }
+ if (colorant[j].levels < 2 || 0xFFFF < colorant[j].levels) {
+ invalid = TRUE;
+ fprintf(stderr, ERRPREF "The number of intensity levels for "
+ "colorant %d is %u instead of at least 2 and at most 65535.\n",
+ j, colorant[j].levels);
+ /* Actually, DJ6/8 p. 68 requires the levels to be in the range
+ 2-255, but as there are two octets available in the CRD format
+ this seems unnecessarily strict. */
+ }
+ }
+
+ /* Check for relations between resolutions and the need for CRD */
+ if (!invalid) /* this implies that all resolutions are positive */
+ for (j = 0; j < data->number_of_colorants; j++) {
+ /* If there is more than one resolution or more than 2 levels we
+ need CRD. Note that we compare with 'maxhres' in both lines: */
+ if (maxhres != colorant[j].hres ||
+ maxhres != colorant[j].vres || colorant[j].levels > 2)
+ needs_CRD = TRUE;
+
+ /* DJ6/8 states that the highest horizontal resolution must be a
+ multiple of all lower horizontal resolutions and the same for
+ the set of vertical resolutions. The reason is not given but
+ these properties imply that it is possible to operate uniformly
+ on a grid at the highest resolution.
+ In contrast, the way in which raster data are transferred
+ (strips with a height equal to the reciprocal of the lowest
+ vertical resolution) logically requires that all vertical
+ resolutions are multiples of the lowest vertical resolution.
+ This condition is not stated in DJ6/8 but it is satisfied by
+ all examples given in that document. This includes example 4 on
+ page 72 which is meant to illustrate the maximum flexibility of
+ format 2 and which describes a situation where the
+ corresponding condition does not hold for the horizontal
+ resolutions.
+ */
+ if (colorant[j].vres % data->minvres != 0) {
+ invalid = TRUE;
+ fprintf(stderr, ERRPREF
+ "The vertical resolution for colorant %d (%u ppi) is not a "
+ "multiple of the lowest vertical resolution (%u ppi).\n",
+ j, colorant[j].vres, data->minvres);
+ }
+ if (maxhres % colorant[j].hres != 0) {
+ invalid = TRUE;
+ fprintf(stderr, ERRPREF
+ "The highest horizontal resolution (%u ppi) is not a multiple "
+ "of the horizontal resolution for colorant %d (%u ppi).\n",
+ maxhres, j, colorant[j].hres);
+ }
+ if (maxvres % colorant[j].vres != 0) {
+ invalid = TRUE;
+ fprintf(stderr, ERRPREF
+ "The highest vertical resolution (%u ppi) is not a multiple "
+ "of the vertical resolution for colorant %d (%u ppi).\n",
+ maxvres, j, colorant[j].vres);
+ }
+ }
}
if (needs_CRD && data->palette == pcl_RGB) {
- invalid = TRUE;
- if (data->level == pcl_level_3plus_CRD_only)
- fputs(ERRPREF
- "You can't use an RGB palette at the requested PCL level.\n",
- stderr);
- else
- fputs(ERRPREF "The specified structure of resolutions and intensity "
- "levels is not possible with an RGB palette.\n",
- stderr);
+ invalid = TRUE;
+ if (data->level == pcl_level_3plus_CRD_only)
+ fputs(ERRPREF
+ "You can't use an RGB palette at the requested PCL level.\n",
+ stderr);
+ else
+ fputs(ERRPREF "The specified structure of resolutions and intensity "
+ "levels is not possible with an RGB palette.\n",
+ stderr);
}
if (needs_CRD && !pcl_has_CRD(data->level)) {
- invalid = TRUE;
- fputs(ERRPREF "The specified structure of resolutions and intensity "
- "levels is not possible at the requested PCL level.\n", stderr);
+ invalid = TRUE;
+ fputs(ERRPREF "The specified structure of resolutions and intensity "
+ "levels is not possible at the requested PCL level.\n", stderr);
}
if (data->palette == pcl_any_palette) {
- needs_CRD = TRUE;
- if (!pcl_has_CRD(data->level)) {
- invalid = TRUE;
- fputs(ERRPREF "The specified palette is not possible at the "
- "requested PCL level.\n", stderr);
- }
+ needs_CRD = TRUE;
+ if (!pcl_has_CRD(data->level)) {
+ invalid = TRUE;
+ fputs(ERRPREF "The specified palette is not possible at the "
+ "requested PCL level.\n", stderr);
+ }
}
if (needs_CRD && (maxhres > 0xFFFF || maxvres > 0xFFFF)) {
- fputs(ERRPREF "Resolutions may be at most 65535 ppi when more than one "
- "resolution or more than two intensity levels are requested.\n",
- stderr);
- invalid = TRUE;
+ fputs(ERRPREF "Resolutions may be at most 65535 ppi when more than one "
+ "resolution or more than two intensity levels are requested.\n",
+ stderr);
+ invalid = TRUE;
}
if (data->order_CMYK && data->palette != pcl_CMYK) {
- fputs(ERRPREF
- "Ordering bit planes as CMYK instead of KCMY is only meaningful\n"
- " for a CMYK palette.\n", stderr);
- invalid = TRUE;
+ fputs(ERRPREF
+ "Ordering bit planes as CMYK instead of KCMY is only meaningful\n"
+ " for a CMYK palette.\n", stderr);
+ invalid = TRUE;
}
/* Check PJL job name */
if (data->PJL_job != NULL) {
- const unsigned char *s = (const unsigned char *)data->PJL_job;
-
- /* Permissible characters are HT and the octets 32-255 with the
- exception of '"' (PJLTRM, with some corrections). */
- while (*s != '\0' && (*s == '\t' || 32 <= *s && *s != '"')) s++;
- if (*s != '\0') {
- fprintf(stderr,
- ERRPREF "Illegal character in PJL job name (code 0x%02X).\n", *s);
- invalid = TRUE;
- }
-
- /* There is a maximum of 80 "significant characters" (PJLTRM).
- According to PJLTRM, p. D-8, "String too long" is a parser warning
- and leads to a part of the command being ignored. I play it safe.
- There would also be a warning for an empty string but we treat that
- case differently anyway (see below). */
- if (strlen(data->PJL_job) > 80) {
- fputs(ERRPREF "PJL job name is too long (more than 80 characters).\n",
- stderr);
- invalid = TRUE;
- }
+ const unsigned char *s = (const unsigned char *)data->PJL_job;
+
+ /* Permissible characters are HT and the octets 32-255 with the
+ exception of '"' (PJLTRM, with some corrections). */
+ while (*s != '\0' && (*s == '\t' || 32 <= *s && *s != '"')) s++;
+ if (*s != '\0') {
+ fprintf(stderr,
+ ERRPREF "Illegal character in PJL job name (code 0x%02X).\n", *s);
+ invalid = TRUE;
+ }
+
+ /* There is a maximum of 80 "significant characters" (PJLTRM).
+ According to PJLTRM, p. D-8, "String too long" is a parser warning
+ and leads to a part of the command being ignored. I play it safe.
+ There would also be a warning for an empty string but we treat that
+ case differently anyway (see below). */
+ if (strlen(data->PJL_job) > 80) {
+ fputs(ERRPREF "PJL job name is too long (more than 80 characters).\n",
+ stderr);
+ invalid = TRUE;
+ }
}
/* Check PJL personality name */
if (data->PJL_language != NULL) {
- const char *s = data->PJL_language;
-
- /* PJLTRM does not give explicit lexical conventions for personality
- names but from general considerations it should be an "alphanumeric
- variable". The latter must start with a letter and may consist of
- letters and digits. */
- if (is_letter(*s)) do s++; while (is_letter(*s) || is_digit(*s));
-
- if (*data->PJL_language == '\0') {
- fputs(ERRPREF "Empty PJL language name.\n", stderr);
- invalid = TRUE;
- }
- else if (*s != '\0') {
- fprintf(stderr,
- ERRPREF "Illegal character in PJL language name (code 0x%02X).\n",
- *s);
- invalid = TRUE;
- }
+ const char *s = data->PJL_language;
+
+ /* PJLTRM does not give explicit lexical conventions for personality
+ names but from general considerations it should be an "alphanumeric
+ variable". The latter must start with a letter and may consist of
+ letters and digits. */
+ if (is_letter(*s)) do s++; while (is_letter(*s) || is_digit(*s));
+
+ if (*data->PJL_language == '\0') {
+ fputs(ERRPREF "Empty PJL language name.\n", stderr);
+ invalid = TRUE;
+ }
+ else if (*s != '\0') {
+ fprintf(stderr,
+ ERRPREF "Illegal character in PJL language name (code 0x%02X).\n",
+ *s);
+ invalid = TRUE;
+ }
}
}
@@ -394,7 +394,7 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
"\033&l%da" /* PCL: Page Size */
"0o" /* PCL: Page Orientation/Orientation: portrait */
"0L", /* PCL: Perforation Skip Mode: off. This also effectively sets
- the PCL top margin to zero. */
+ the PCL top margin to zero. */
(int) data->size
);
@@ -402,8 +402,8 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
if (data->media_source != 0)
fprintf(out, "\033&l%dH", data->media_source); /* PCL: Media Source */
/* Note that a value of zero for the Media Source command means
- "eject the current page". Hence we are losing no functionality by
- reserving 0 to mean "no Media Source request". */
+ "eject the current page". Hence we are losing no functionality by
+ reserving 0 to mean "no Media Source request". */
if (data->media_source != 2 && data->manual_feed) fputs("\033&l2H", out);
/* I am using two Media Source commands here in case the value 2 means
"manual feed from the last selected media source" on some printer. */
@@ -427,14 +427,14 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
/* PCL: Raster Graphics Quality */
if (data->level > pcl_level_3plus_DJ500)
fprintf(out, "\033*o%dQ", data->shingling);
- /* PCL: Set Raster Graphics Shingling/Mechanical Print Quality */
+ /* PCL: Set Raster Graphics Shingling/Mechanical Print Quality */
if (data->depletion != 0)
/* According to TRG500 p. 6-32, depletion makes no sense for monochrome
- data. Besides, not all printers react to this command. Hence I'm
- handing the decision to the caller. Note that permitted values are 1-5.
+ data. Besides, not all printers react to this command. Hence I'm
+ handing the decision to the caller. Note that permitted values are 1-5.
*/
fprintf(out, "\033*o%dD", data->depletion);
- /* PCL: Set Raster Graphics Depletion */
+ /* PCL: Set Raster Graphics Depletion */
}
else
fprintf(out,
@@ -469,9 +469,9 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
if (data->level >= pcl_level_3plus_S68)
fprintf(out, "\033&u%uD", maxhres < maxvres? maxvres: maxhres);
/* PCL: Unit of Measure. This is not documented but merely mentioned in
- DJ6/8. All HP drivers for newer printers I've looked at (admittedly not
- many) generate this command, including a driver for the DJ 540.
- Actually, as the routines here send a Move CAP Horizontal/Vertical
+ DJ6/8. All HP drivers for newer printers I've looked at (admittedly not
+ many) generate this command, including a driver for the DJ 540.
+ Actually, as the routines here send a Move CAP Horizontal/Vertical
(PCL Units) command only for position 0, the units should be irrelevant.
*/
@@ -479,7 +479,7 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
if (data->level != pcl_level_3plus_CRD_only &&
data->palette != pcl_no_palette && data->palette != pcl_any_palette)
fprintf(out, "\033*r%dU",
- /* PCL: Set Number of Planes per Row/Simple Color */
+ /* PCL: Set Number of Planes per Row/Simple Color */
data->palette == pcl_RGB? 3: /* RGB palette */
-data->number_of_colorants); /* (K)(CMY) palette */
@@ -491,11 +491,11 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
for (j = 0; j < data->number_of_colorants; j++)
fprintf(out, "%c%c%c%c%c%c",
- /* Note that %c expects an 'int' (and converts it to 'unsigned char').
- */
- colorant[j].hres/256, colorant[j].hres%256,
- colorant[j].vres/256, colorant[j].vres%256,
- colorant[j].levels/256, colorant[j].levels%256);
+ /* Note that %c expects an 'int' (and converts it to 'unsigned char').
+ */
+ colorant[j].hres/256, colorant[j].hres%256,
+ colorant[j].vres/256, colorant[j].vres%256,
+ colorant[j].levels/256, colorant[j].levels%256);
}
if (ferror(out)) {
@@ -517,7 +517,7 @@ int pcl3_init_file(FILE *out, pcl_FileData *data)
for (j = 0; j < data->number_of_colorants; j++)
data->number_of_bitplanes +=
pcl3_levels_to_planes(colorant[j].levels)*
- (colorant[j].vres/data->minvres);
+ (colorant[j].vres/data->minvres);
return 0;
}
@@ -572,27 +572,27 @@ int pcl3_begin_raster(FILE *out, pcl_RasterData *data)
global = data->global;
for (j = 0;
- j < global->number_of_bitplanes &&
- (data->next[j].length == 0 || data->next[j].str != NULL);
- j++);
+ j < global->number_of_bitplanes &&
+ (data->next[j].length == 0 || data->next[j].str != NULL);
+ j++);
invalid = j < global->number_of_bitplanes;
if (!invalid && pcl_cm_is_differential(global->compression)) {
- invalid = (data->previous == NULL ||
- global->compression == pcl_cm_delta &&
- data->workspace[1] == NULL);
- if (!invalid) {
- for (j = 0;
- j < global->number_of_bitplanes &&
- (data->previous[j].length == 0 || data->previous[j].str != NULL);
- j++);
- invalid = j < global->number_of_bitplanes;
- }
+ invalid = (data->previous == NULL ||
+ global->compression == pcl_cm_delta &&
+ data->workspace[1] == NULL);
+ if (!invalid) {
+ for (j = 0;
+ j < global->number_of_bitplanes &&
+ (data->previous[j].length == 0 || data->previous[j].str != NULL);
+ j++);
+ invalid = j < global->number_of_bitplanes;
+ }
}
}
if (invalid) {
fputs(ERRPREF "Invalid data structure passed to pcl3_begin_raster().\n",
- stderr);
+ stderr);
return +1;
}
}
@@ -611,25 +611,25 @@ int pcl3_begin_raster(FILE *out, pcl_RasterData *data)
/* Use the seed plane array for differential compression methods */
if (pcl_cm_is_differential(global->compression)) {
/* HP's documentation is a bit obscure concerning what the seed plane for
- a particular bit plane is. Most of the documentation talks only about
- seed rows (and "rows" consist of planes), but then one suddenly comes
- across a statement like "a separate seed row is maintained for each
- graphic plane" (DJ6/8 p. 57). I've also never found a statement what
- the seed row/plane/whatever for a bitplane in a strip group with
- multiple lines or multiple planes per colorant is, except that DJ6/8
- (p. 60) states explicitly that one cannot use Seed Row Source in that
- situation to select it.
-
- I therefore have to make a few assumptions. The following seem sensible:
- - The PCL interpreter maintains independent "seed lines" for each
- colorant. Each line consists of independent seed planes, one for each
- bit plane in a pixel line for that colorant (i.e., there are
- pcl3_levels_to_planes(levels) seed planes for a colorant accepting
- 'levels' intensity levels).
- - If the current compression method (this is a global property of the
- interpreter) is a differential one, a bit plane is interpreted as a
- delta plane with respect to the corresponding bit plane in the
- current colorant's preceding line.
+ a particular bit plane is. Most of the documentation talks only about
+ seed rows (and "rows" consist of planes), but then one suddenly comes
+ across a statement like "a separate seed row is maintained for each
+ graphic plane" (DJ6/8 p. 57). I've also never found a statement what
+ the seed row/plane/whatever for a bitplane in a strip group with
+ multiple lines or multiple planes per colorant is, except that DJ6/8
+ (p. 60) states explicitly that one cannot use Seed Row Source in that
+ situation to select it.
+
+ I therefore have to make a few assumptions. The following seem sensible:
+ - The PCL interpreter maintains independent "seed lines" for each
+ colorant. Each line consists of independent seed planes, one for each
+ bit plane in a pixel line for that colorant (i.e., there are
+ pcl3_levels_to_planes(levels) seed planes for a colorant accepting
+ 'levels' intensity levels).
+ - If the current compression method (this is a global property of the
+ interpreter) is a differential one, a bit plane is interpreted as a
+ delta plane with respect to the corresponding bit plane in the
+ current colorant's preceding line.
*/
int strip;
@@ -645,15 +645,15 @@ int pcl3_begin_raster(FILE *out, pcl_RasterData *data)
int l, p;
/* The first line of the colorant strip refers to the last line in the
- preceding strip. I'm assuming Seed Row Source == 0 here. */
+ preceding strip. I'm assuming Seed Row Source == 0 here. */
for (p = 0; p < planes; p++, plane++)
- data->seed_plane[plane] = data->previous + plane + (lines - 1)*planes;
+ data->seed_plane[plane] = data->previous + plane + (lines - 1)*planes;
/* Subsequent lines refer to the preceding line in the current strip
- group */
+ group */
for (l = 1; l < lines; l++)
- for (p = 0; p < planes; p++, plane++)
- data->seed_plane[plane] = data->next + plane - planes;
+ for (p = 0; p < planes; p++, plane++)
+ data->seed_plane[plane] = data->next + plane - planes;
}
}
@@ -665,8 +665,8 @@ int pcl3_begin_raster(FILE *out, pcl_RasterData *data)
This is reset by End Raster Graphics. */
}
fputs("\033*p0X" /* PCL: Horizontal Cursor Positioning by Dots */
- "\033*r1A", out);
- /* PCL: Start Raster Graphics: at current position */
+ "\033*r1A", out);
+ /* PCL: Start Raster Graphics: at current position */
/* After Start Raster Graphics the seed row consists of all zeroes
(DJ6/8 p. 50). */
@@ -778,11 +778,11 @@ static int send_plane(pcl_bool final,
method employed. */
if (method_demanded == pcl_cm_delta) {
/* Method 3 (delta row compression) has a widely varying effectiveness,
- depending on the structure of the input. Hence it is best combined
- with a non-delta method like method 2, as is done here on a per-plane
- basis, or method 1, as inherent in method 9.
- The procedure here is simple: try both methods, and then take the one
- giving the shortest output.
+ depending on the structure of the input. Hence it is best combined
+ with a non-delta method like method 2, as is done here on a per-plane
+ basis, or method 1, as inherent in method 9.
+ The procedure here is simple: try both methods, and then take the one
+ giving the shortest output.
*/
int c1, c2; /* cost in octets */
@@ -797,10 +797,10 @@ static int send_plane(pcl_bool final,
else {
int bound = in->length + (*method_used == pcl_cm_none? 0: 2);
if (c1 >= 0 && c1 < bound) {
- /* We're interested in TIFF compression only if it results in an octet
- string shorter than the one produced by delta row compression. */
- bound = c1;
- if (*method_used != pcl_cm_tiff && bound >= 2) bound -= 2;
+ /* We're interested in TIFF compression only if it results in an octet
+ string shorter than the one produced by delta row compression. */
+ bound = c1;
+ if (*method_used != pcl_cm_tiff && bound >= 2) bound -= 2;
}
out2.str = out_bf2; out2.length = bound;
rc = pcl_compress(pcl_cm_tiff, in, NULL, &out2);
@@ -828,7 +828,7 @@ static int send_plane(pcl_bool final,
}
else {
if (method_demanded != pcl_cm_none &&
- pcl_compress(method_demanded, in, prev, &out1) == 0) {
+ pcl_compress(method_demanded, in, prev, &out1) == 0) {
/* Send compressed data */
send = out1;
choice = method_demanded;
@@ -918,23 +918,23 @@ int pcl3_transfer_group(FILE *out, pcl_RasterData *data)
/* First CMY */
for (j = global->black_planes; j < global->number_of_bitplanes; j++) {
if (send_plane(FALSE,
- global->compression, &data->current_compression, data->next + j,
- data->seed_plane[j],
- out,
- data->workspace[0], data->workspace[1],
- data->workspace_allocated) != 0)
- return -1;
+ global->compression, &data->current_compression, data->next + j,
+ data->seed_plane[j],
+ out,
+ data->workspace[0], data->workspace[1],
+ data->workspace_allocated) != 0)
+ return -1;
}
/* Now black */
final = global->black_planes - 1;
for (j = 0; j < global->black_planes; j++) {
if (send_plane(j == final,
- global->compression, &data->current_compression, data->next + j,
- data->seed_plane[j],
- out,
- data->workspace[0], data->workspace[1],
- data->workspace_allocated) != 0)
- return -1;
+ global->compression, &data->current_compression, data->next + j,
+ data->seed_plane[j],
+ out,
+ data->workspace[0], data->workspace[1],
+ data->workspace_allocated) != 0)
+ return -1;
}
}
else {
@@ -942,12 +942,12 @@ int pcl3_transfer_group(FILE *out, pcl_RasterData *data)
final = global->number_of_bitplanes - 1;
for (j = 0; j < global->number_of_bitplanes; j++) {
if (send_plane(j == final,
- global->compression, &data->current_compression, data->next + j,
- data->seed_plane[j],
- out,
- data->workspace[0], data->workspace[1],
- data->workspace_allocated) != 0)
- return -1;
+ global->compression, &data->current_compression, data->next + j,
+ data->seed_plane[j],
+ out,
+ data->workspace[0], data->workspace[1],
+ data->workspace_allocated) != 0)
+ return -1;
}
}
@@ -975,8 +975,8 @@ int pcl3_end_raster(FILE *out, pcl_RasterData *data)
{
fputs("0Y", out);
/* PCL: Relative Vertical Pixel Movement/Y Offset. This is a simple way
- to terminate the combined escape sequence started at the beginning of
- raster mode. */
+ to terminate the combined escape sequence started at the beginning of
+ raster mode. */
/* End Raster Graphics */
send_ERG(out, data->global->level);
@@ -1040,15 +1040,15 @@ int pcl3_end_file(FILE *out, pcl_FileData *data)
if (data->PJL_job != NULL) {
/* PJL: End of Job. Some HP PCL-3 drivers using JOB omit this command.
- According to PJLTRM, it is required in that case. */
+ According to PJLTRM, it is required in that case. */
fputs("@PJL EOJ\n", out);
/* PJL: UEL. All output I've seen from HP's PCL-3 drivers using EOJ
- omits this final UEL. According to PJLTRM, it is required. In my
- opinion it doesn't make any difference because in both cases the
- printer expects PJL in preference to other data next and the rules
- for deciding whether it's PJL or not are also the same. Note that the
- command does not influence the printer's state. */
+ omits this final UEL. According to PJLTRM, it is required. In my
+ opinion it doesn't make any difference because in both cases the
+ printer expects PJL in preference to other data next and the rules
+ for deciding whether it's PJL or not are also the same. Note that the
+ command does not influence the printer's state. */
fputs("\033%-12345X", out);
}
}
@@ -1099,7 +1099,7 @@ int pcl3_set_oldquality(pcl_FileData *data)
else
data->depletion = 3; /* 50 % */
/* Actually, TRG500 recommends 5 (50 % with gamma correction), but we
- assume that gamma correction will be handled externally. */
+ assume that gamma correction will be handled externally. */
data->raster_graphics_quality = 2; /* high */
data->shingling = 2; /* 4 passes */
break;
@@ -1107,8 +1107,8 @@ int pcl3_set_oldquality(pcl_FileData *data)
data->depletion = 2; /* 25 % */
data->raster_graphics_quality = 0; /* use current control panel setting */
if (data->media_type == 3 ||
- data->media_type == 4 && data->palette != pcl_CMY &&
- data->palette != pcl_RGB)
+ data->media_type == 4 && data->palette != pcl_CMY &&
+ data->palette != pcl_RGB)
data->shingling = 2; /* 4 passes (25 % each pass) */
else data->shingling = 1; /* 2 passes (50 % each pass) */
}
diff --git a/gs/contrib/pcl3/src/pclgen.h b/gs/contrib/pcl3/src/pclgen.h
index 4c12e8ded..6e8bd5b4b 100644
--- a/gs/contrib/pcl3/src/pclgen.h
+++ b/gs/contrib/pcl3/src/pclgen.h
@@ -48,7 +48,6 @@ typedef enum {
Set Number of Planes per Row and Set Raster Graphics Resolution */
} pcl_Level;
-
/* Test macros */
#define pcl_use_oldERG(level) (level <= pcl_level_3plus_DJ500)
#define pcl_use_oldquality(level) (level <= pcl_level_3plus_S5)
@@ -74,36 +73,36 @@ typedef enum {
HP documentation but does agree with the actual behaviour of the DJ 850C.
(1) The Page Orientation command has no influence on the orientation of
- raster graphics data.
+ raster graphics data.
(2) Therefore it is possible to define, independent of the Page Orientation
- setting, a coordinate system on the medium by reference to the printing
- of raster lines ("rows"): the order of pixels within a row defines what
- is left and right, and the order in which successive rows are printed
- distinguishes between up and down. I call this the "raster space"
- coordinate system. (Its units are irrelevant, but we need the
- directions.)
+ setting, a coordinate system on the medium by reference to the printing
+ of raster lines ("rows"): the order of pixels within a row defines what
+ is left and right, and the order in which successive rows are printed
+ distinguishes between up and down. I call this the "raster space"
+ coordinate system. (Its units are irrelevant, but we need the
+ directions.)
(3) Because of the way DeskJet printers are constructed (limited memory!),
- raster space is fixed with respect to the feeding direction: the "up"
- edge of a sheet in raster space is the one entering the printer first
- (the leading edge).
+ raster space is fixed with respect to the feeding direction: the "up"
+ edge of a sheet in raster space is the one entering the printer first
+ (the leading edge).
(4) Hence the media orientation in raster space depends only on the
- input orientation: short edge first leads to portrait and long edge
- first to landscape orientation in raster space.
+ input orientation: short edge first leads to portrait and long edge
+ first to landscape orientation in raster space.
(5) Among other effects, the Page Size command sets in particular the
- printable region for the media size requested.
+ printable region for the media size requested.
(6) For raster graphics data, clipping occurs at the edge of the printable
- region. This happens at the right edge in raster space.
+ region. This happens at the right edge in raster space.
(7) It is not possible in PCL to specify the input orientation one has
- chosen. In particular, the sign of a Page Size code has no influence on
- the printable region as seen in raster space.
+ chosen. In particular, the sign of a Page Size code has no influence on
+ the printable region as seen in raster space.
(8) Some Page Size codes do modify the orientation for text printing on
- some printers, but this can be overridden with a subsequent Page
- Orientation command.
+ some printers, but this can be overridden with a subsequent Page
+ Orientation command.
(9) The Page Size command usually sets up the printable region under the
- assumption of portrait orientation in raster space (i.e., the input
- orientation is short edge first). Exceptions occur with envelope sizes
- (Env10 and EnvDL) on older DeskJet printers (500 and 500C, possibly
- also 400) where envelopes have to be fed long edge first.
+ assumption of portrait orientation in raster space (i.e., the input
+ orientation is short edge first). Exceptions occur with envelope sizes
+ (Env10 and EnvDL) on older DeskJet printers (500 and 500C, possibly
+ also 400) where envelopes have to be fed long edge first.
The key conclusion to be drawn from this is that the layer represented by
the functions in this interface does not have any information on the media
@@ -117,7 +116,6 @@ typedef enum {
made sufficiently precise, and for printing raster data as done here the
first concept is the one required.
-
Two Page Size codes are marked "PS3". These are from Adobe's "LanguageLevel
3 Specification and Adobe PostScript 3 Version 3010 Product Supplement"
(dated 1997-10-10), page 352, where eight PCL-5 page size codes are listed.
@@ -138,13 +136,13 @@ typedef enum {
pcl_ps_Letter = 2, /* US Letter (8.5 x 11 in) */
pcl_ps_Legal = 3, /* US Legal (8.5 x 14 in) */
pcl_ps_Tabloid = 6, /* US Tabloid (11 x 17 in) or Ledger (17 x 11 in)
- (DJ1120C). The designation as Tabloid versus Ledger
- is not always consistent. I'm following PPD 4.3. */
+ (DJ1120C). The designation as Tabloid versus Ledger
+ is not always consistent. I'm following PPD 4.3. */
pcl_ps_Statement = 15, /* US Statement (5.5 x 8.5 in) (DJ1120C) */
pcl_ps_HPSuperB = 16, /* Super B (13 x 19 in (330 x 483 mm) according to
- DJ1120C, while 305 x 487 mm according to PPD 4.3).
- Not supported in PCL 3 according to BPD07645
- (HP 2500C). */
+ DJ1120C, while 305 x 487 mm according to PPD 4.3).
+ Not supported in PCL 3 according to BPD07645
+ (HP 2500C). */
pcl_ps_A6 = 24, /* ISO/JIS A6 (105 x 148 mm) */
pcl_ps_A5 = 25, /* ISO/JIS A5 (148 x 210 mm) */
pcl_ps_A4 = 26, /* ISO/JIS A4 (210 x 297 mm) */
@@ -153,11 +151,11 @@ typedef enum {
pcl_ps_JISB4 = 46, /* JIS B4 (257 x 364 mm) (DJ1120C, BPL02327) */
pcl_ps_Postcard = 71, /* Japanese Hagaki postcard (100 x 148 mm) */
pcl_ps_DoublePostcard = 72, /* Japanese Oufuko-Hagaki postcard
- (148 x 200 mm) (DJ6/8) */
+ (148 x 200 mm) (DJ6/8) */
pcl_ps_A6Card = 73, /* "ISO and JIS A6 card" (DJ6/8, DJ1120C). This is the
- value given for most DeskJets supporting A6. I do
- not know what the difference between this value and
- pcl_ps_A6 (24) is. */
+ value given for most DeskJets supporting A6. I do
+ not know what the difference between this value and
+ pcl_ps_A6 (24) is. */
pcl_ps_Index4x6in = 74, /* US Index card (4 x 6 in) */
pcl_ps_Index5x8in = 75, /* US Index card (5 x 8 in) */
pcl_ps_Index3x5in = 78, /* US Index card (3 x 5 in) */
@@ -177,9 +175,9 @@ typedef enum {
pcl_ps_CustomPageSize = 101, /* Custom page size */
pcl_ps_EnvUS_A2 = 109, /* US A2 envelope (4.375 x 5.75 in) */
pcl_ps_EnvChou3 = 110, /* Japanese long Envelope #3 (120 mm x 235 mm)
- (DJ1120C) */
+ (DJ1120C) */
pcl_ps_EnvChou4 = 111, /* Japanese long envelope #4 (90 mm x 205 mm)
- (DJ1120C) */
+ (DJ1120C) */
pcl_ps_EnvKaku2 = 113 /* Kaku envelope (240 x 332 mm) (DJ1120C) */
} pcl_PageSize;
@@ -190,7 +188,7 @@ typedef enum {
pcl_cm_none = 0, /* Unencoded, non-compressed method */
pcl_cm_rl = 1, /* Run-Length Encoding */
pcl_cm_tiff = 2, /* Tagged Image File Format (TIFF) revision 4.0
- "packbits" encoding */
+ "packbits" encoding */
pcl_cm_delta = 3, /* Delta Row Compression */
pcl_cm_adaptive = 5, /* Adaptive Compression */
pcl_cm_crdr = 9 /* Compressed Replacement Delta Row Encoding */
@@ -219,7 +217,6 @@ typedef int pcl_bool;
#endif /* TRUE == 0 */
#endif /* TRUE */
-
/* Palette (process colour model) */
typedef enum {
pcl_no_palette, /* Don't send Number of Planes per Row */
@@ -228,10 +225,9 @@ typedef enum {
pcl_CMYK,
pcl_RGB, /* Using the RGB palette is discouraged by HP. */
pcl_any_palette /* Don't use this value unless you know what you are
- doing. */
+ doing. */
} pcl_Palette;
-
/* Information per colorant for raster images */
typedef struct {
unsigned int hres, vres; /* Resolution in ppi. The orientation refers to
@@ -281,14 +277,14 @@ typedef struct {
media_type,
media_source, /* 0: don't request a particular media source */
media_destination, /* 0: don't request a particular media destination.
- Not based on HP documentation. */
+ Not based on HP documentation. */
duplex; /* -1: don't request anything in this respect,
0: simplex, 1: duplex long-edge binding, 2: duplex short-edge binding
(BPL02705). I assume the correct interpretation of the duplex values to
be:
- 1: duplex, print back side with the same top edge in raster space
- 2: duplex, print back side with top and bottom edges exchanged in
- raster space
+ 1: duplex, print back side with the same top edge in raster space
+ 2: duplex, print back side with top and bottom edges exchanged in
+ raster space
*/
pcl_bool manual_feed;
@@ -338,37 +334,37 @@ typedef struct {
using an RGB palette unless you have reliable data on the clipping
boundary. The value should probably always be a multiple of 8. */
pcl_FileData *global; /* must point to the data used in the last call
- to pcl3_init_file() */
+ to pcl3_init_file() */
pcl_OctetString
*previous, *next;
/* These variables point to the sequences of bit planes for the old and
the new strip group. The total number of bit planes per group can be
- obtained in the 'number_of_bitplanes' parameter in '*global'.
-
- The order of bit planes within a strip group is as follows:
- - Each strip group consists of a number of "colorant strips", one for
- each colorant. All strips in such a group cover the same region on
- the page. Except for 'pcl_RGB', colorant strips are ordered in the
- sequence (K)(CMY), independent of 'order_CMYK'. For an RGB palette,
- the order is (of course) RGB.
- - Each colorant strip contains a number of pixel lines for this
+ obtained in the 'number_of_bitplanes' parameter in '*global'.
+
+ The order of bit planes within a strip group is as follows:
+ - Each strip group consists of a number of "colorant strips", one for
+ each colorant. All strips in such a group cover the same region on
+ the page. Except for 'pcl_RGB', colorant strips are ordered in the
+ sequence (K)(CMY), independent of 'order_CMYK'. For an RGB palette,
+ the order is (of course) RGB.
+ - Each colorant strip contains a number of pixel lines for this
colorant. If there is more than one line, the lines are ordered from
- top to bottom as seen from raster space. The number of lines is
- the ratio of that colorant's vertical resolution to the smallest
- vertical resolution.
- - Within each pixel line for a colorant, bit planes are ordered from
- least to most significant. The number of bit planes within a line is
- pcl3_levels_to_planes(levels) for this colorant.
- When bit planes are again combined into lines for a particular
- colorant, the resulting value per pixel denotes the intensity for
- that colorant. A value of zero denotes absence of that colorant.
- 'previous' will be ignored (and may then be NULL) unless a differential
- compression method is requested (pcl_cm_is_differential()).
-
- When using an RGB palette you should always send bit planes extending
- over the whole 'width' because shorter bit planes are implicitly
- extended with null octets and a pixel value of zero denotes black in an
- RGB palette which is not usually desired.
+ top to bottom as seen from raster space. The number of lines is
+ the ratio of that colorant's vertical resolution to the smallest
+ vertical resolution.
+ - Within each pixel line for a colorant, bit planes are ordered from
+ least to most significant. The number of bit planes within a line is
+ pcl3_levels_to_planes(levels) for this colorant.
+ When bit planes are again combined into lines for a particular
+ colorant, the resulting value per pixel denotes the intensity for
+ that colorant. A value of zero denotes absence of that colorant.
+ 'previous' will be ignored (and may then be NULL) unless a differential
+ compression method is requested (pcl_cm_is_differential()).
+
+ When using an RGB palette you should always send bit planes extending
+ over the whole 'width' because shorter bit planes are implicitly
+ extended with null octets and a pixel value of zero denotes black in an
+ RGB palette which is not usually desired.
*/
pcl_Octet *workspace[2];
/* Storage for the use of these routines. workspace[0] must be non-NULL,
@@ -416,7 +412,6 @@ extern int pcl3_set_oldquality(pcl_FileData *data);
extern int pcl_compress(pcl_Compression method, const pcl_OctetString *in,
const pcl_OctetString *prev, pcl_OctetString *out);
-
/* File and page functions */
extern int pcl3_init_file(FILE *out, pcl_FileData *global);
extern int pcl3_begin_page(FILE *out, pcl_FileData *global);
diff --git a/gs/contrib/pcl3/src/pclscan.c b/gs/contrib/pcl3/src/pclscan.c
index 55d7e5d0e..725c0e544 100644
--- a/gs/contrib/pcl3/src/pclscan.c
+++ b/gs/contrib/pcl3/src/pclscan.c
@@ -40,7 +40,6 @@ static const char
static nl_catd catd = (nl_catd)-1; /* NLS catalogue descriptor */
-
static void message(int id, const char *s)
{
if (catd != (nl_catd)-1) s = catgets(catd, 1, id, s);
@@ -90,7 +89,6 @@ static int cmp_strings(const void *a, const void *b)
return strncmp((const char *)a, (const char *)b, 3);
}
-
static int default_interpreter(FILE *in, const pcl_Command *cmd)
{
/* Skip over arguments for those commands which are known to have them */
@@ -100,37 +98,37 @@ static int default_interpreter(FILE *in, const pcl_Command *cmd)
int c;
do {
- c = fgetc(in);
- if (c != '@') break;
- do c = fgetc(in); while (c != EOF && c != '\n');
+ c = fgetc(in);
+ if (c != '@') break;
+ do c = fgetc(in); while (c != EOF && c != '\n');
} while (c != EOF);
if (c != EOF) ungetc(c, in);
}
else if (cmd->i > 0) {
static const char with_args[][4] = {
- /* Must be sorted with respect to cmp_strings() */
- "&bW",
- "&iW",
- "&pX", /* Transparent Print Mode */
- "(sW", /* Download Character */
- ")sW", /* Create Font */
- "*bV", /* Transfer Raster Graphics Data by Plane */
- "*bW", /* Transfer Raster Graphics Data by Row */
- "*dW", /* Palette Configuration */
- "*gW", /* Configure Raster Data */
- "*oW"};
+ /* Must be sorted with respect to cmp_strings() */
+ "&bW",
+ "&iW",
+ "&pX", /* Transparent Print Mode */
+ "(sW", /* Download Character */
+ ")sW", /* Create Font */
+ "*bV", /* Transfer Raster Graphics Data by Plane */
+ "*bW", /* Transfer Raster Graphics Data by Row */
+ "*dW", /* Palette Configuration */
+ "*gW", /* Configure Raster Data */
+ "*oW"};
if (bsearch(cmd->chars, with_args,
- sizeof(with_args)/sizeof(with_args[0]), sizeof(with_args[0]),
- &cmp_strings) != NULL) {
- int j;
-
- j = cmd->i;
- while (j > 0 && fgetc(in) != EOF) j--;
- if (j > 0) {
- message(1, "Premature EOF on input.");
- return -1;
- }
+ sizeof(with_args)/sizeof(with_args[0]), sizeof(with_args[0]),
+ &cmp_strings) != NULL) {
+ int j;
+
+ j = cmd->i;
+ while (j > 0 && fgetc(in) != EOF) j--;
+ if (j > 0) {
+ message(1, "Premature EOF on input.");
+ return -1;
+ }
}
}
}
@@ -199,7 +197,7 @@ int pcl_scan(FILE *in, pcl_CommandInterpreter interpreter, void *idata,
catd = catopen("pcltools", 0);
if (catd == (nl_catd)(-1) && errno != ENOENT)
/* A system returning ENOENT if no catalogue is available is for example
- Sun Solaris 2.5. */
+ Sun Solaris 2.5. */
fprintf(stderr,
"?-W pclscan: Error trying to open message catalogue: %s.\n",
strerror(errno));
@@ -210,97 +208,97 @@ int pcl_scan(FILE *in, pcl_CommandInterpreter interpreter, void *idata,
pcl_Command command;
if ((c = fgetc(in)) == EOF) {
- rc = -1;
- message(1, "Premature EOF on input.");
- break;
+ rc = -1;
+ message(1, "Premature EOF on input.");
+ break;
}
command.chars[0] = c;
if (48 <= c && c <= 126) {
- /* Two-character escape sequence */
- command.kind = 2;
- if (interpreter == NULL ||
- (rc = (*interpreter)(in, &command, idata)) > 0)
- rc = default_interpreter(in, &command);
+ /* Two-character escape sequence */
+ command.kind = 2;
+ if (interpreter == NULL ||
+ (rc = (*interpreter)(in, &command, idata)) > 0)
+ rc = default_interpreter(in, &command);
}
else {
- int continued;
-
- /* Parameterized escape sequence or garbage. The character we've just
- read is the "parameterized character" and it should be in the range
- 33-47. */
-
- /* Now the group character (should be in the range 96-126, but HP uses
- sometimes at least '-', which has the value 45) */
- if ((c = fgetc(in)) == EOF) {
- rc = -1;
- message(1, "Premature EOF on input.");
- break;
- }
- command.chars[1] = c;
-
- continued = 0;
- do {
- /* Now for the value */
- if ((c = fgetc(in)) == EOF) {
- rc = -1;
- message(1, "Premature EOF on input.");
- break;
- }
- if (c == '+' || c == '-' || '0' <= c && c <= '9') {
- if (c == '+' || c == '-') command.prefix = c;
- else command.prefix = ' ';
- ungetc(c, in);
- if (fscanf(in, "%d", &command.i) != 1) {
- rc = -1;
- message(2, "Syntax error in value field.");
- break;
- }
-
- /* Decimal point? */
- if ((c = fgetc(in)) == EOF) {
- rc = -1;
- message(1, "Premature EOF on input.");
- break;
- }
- command.scale = 0;
- command.fraction = 0;
- if (c == '.') {
- command.scale = 1;
- while ((c = fgetc(in)) != EOF && '0' <= c && c <= '9') {
- command.fraction = command.fraction*10 + (c - '0');
- command.scale *= 10;
- }
- if (c == EOF) {
- rc = -1;
- message(1, "Premature EOF on input.");
- break;
- }
- if (command.prefix == '-') command.fraction = -command.fraction;
- }
- }
- else {
- command.prefix = '\0'; /* no value given */
- command.i = 0;
- }
-
- /* Final character */
- if (96 <= c && c <= 126) {
- /* Parameter character */
- command.chars[2] = c - ('a' - 'A');
- command.kind = (continued? 6: 4);
- continued = 1;
- }
- else {
- /* Termination character (should be in the range 64-94) */
- command.chars[2] = c;
- command.kind = (continued? 5: 3);
- continued = 0;
- }
-
- if (interpreter == NULL ||
- (rc = (*interpreter)(in, &command, idata)) > 0)
- rc = default_interpreter(in, &command);
- } while (rc == 0 && continued);
+ int continued;
+
+ /* Parameterized escape sequence or garbage. The character we've just
+ read is the "parameterized character" and it should be in the range
+ 33-47. */
+
+ /* Now the group character (should be in the range 96-126, but HP uses
+ sometimes at least '-', which has the value 45) */
+ if ((c = fgetc(in)) == EOF) {
+ rc = -1;
+ message(1, "Premature EOF on input.");
+ break;
+ }
+ command.chars[1] = c;
+
+ continued = 0;
+ do {
+ /* Now for the value */
+ if ((c = fgetc(in)) == EOF) {
+ rc = -1;
+ message(1, "Premature EOF on input.");
+ break;
+ }
+ if (c == '+' || c == '-' || '0' <= c && c <= '9') {
+ if (c == '+' || c == '-') command.prefix = c;
+ else command.prefix = ' ';
+ ungetc(c, in);
+ if (fscanf(in, "%d", &command.i) != 1) {
+ rc = -1;
+ message(2, "Syntax error in value field.");
+ break;
+ }
+
+ /* Decimal point? */
+ if ((c = fgetc(in)) == EOF) {
+ rc = -1;
+ message(1, "Premature EOF on input.");
+ break;
+ }
+ command.scale = 0;
+ command.fraction = 0;
+ if (c == '.') {
+ command.scale = 1;
+ while ((c = fgetc(in)) != EOF && '0' <= c && c <= '9') {
+ command.fraction = command.fraction*10 + (c - '0');
+ command.scale *= 10;
+ }
+ if (c == EOF) {
+ rc = -1;
+ message(1, "Premature EOF on input.");
+ break;
+ }
+ if (command.prefix == '-') command.fraction = -command.fraction;
+ }
+ }
+ else {
+ command.prefix = '\0'; /* no value given */
+ command.i = 0;
+ }
+
+ /* Final character */
+ if (96 <= c && c <= 126) {
+ /* Parameter character */
+ command.chars[2] = c - ('a' - 'A');
+ command.kind = (continued? 6: 4);
+ continued = 1;
+ }
+ else {
+ /* Termination character (should be in the range 64-94) */
+ command.chars[2] = c;
+ command.kind = (continued? 5: 3);
+ continued = 0;
+ }
+
+ if (interpreter == NULL ||
+ (rc = (*interpreter)(in, &command, idata)) > 0)
+ rc = default_interpreter(in, &command);
+ } while (rc == 0 && continued);
}
}
else if (pcl_is_control_code(c)) {
@@ -314,13 +312,13 @@ int pcl_scan(FILE *in, pcl_CommandInterpreter interpreter, void *idata,
if (c != EOF) ungetc(c, in);
if (interpreter == NULL ||
- (rc = (*interpreter)(in, &command, idata)) > 0)
- rc = default_interpreter(in, &command);
+ (rc = (*interpreter)(in, &command, idata)) > 0)
+ rc = default_interpreter(in, &command);
}
else {
ungetc(c, in);
if (handler == NULL || (rc = (*handler)(in, hdata)) > 0)
- rc = default_handler(in);
+ rc = default_handler(in);
}
}
diff --git a/gs/contrib/pcl3/src/pclscan.h b/gs/contrib/pcl3/src/pclscan.h
index 1d3618236..a3232dad1 100644
--- a/gs/contrib/pcl3/src/pclscan.h
+++ b/gs/contrib/pcl3/src/pclscan.h
@@ -44,21 +44,21 @@ typedef struct {
unsigned short kind;
/* The value can be in the range 1-6:
1: control code. chars[0] is this code and 'i' gives the number of its
- occurrences (positive).
+ occurrences (positive).
2: two-character escape sequence. chars[0] is the second character, the
first was ESC.
3: parameterized escape sequence. chars[0] is the parameterized
- character, chars[1] is the group character, and chars[2] is the
- termination character.
+ character, chars[1] is the group character, and chars[2] is the
+ termination character.
4: same as 3, except that the sequence is not terminated. In this case
- chars[2] is the octet which would be used as the termination
- character, not the octet actually read from the input stream
- (parameter character). pcl_to_parameter_character() can be used to
- obtain the latter.
+ chars[2] is the octet which would be used as the termination
+ character, not the octet actually read from the input stream
+ (parameter character). pcl_to_parameter_character() can be used to
+ obtain the latter.
5: same as 3, except that this is a part of a combined escape sequence
- started earlier.
+ started earlier.
6: same as 4, except that this is a part of a combined escape sequence
- started earlier.
+ started earlier.
*/
pcl_Octet chars[3];
pcl_Octet prefix;
@@ -71,8 +71,8 @@ typedef struct {
int i; /* integer part of the value (including the sign) */
unsigned int scale;
/* This can be zero or any power of ten. A value of zero means that the
- value was given without a decimal point, a value of one that there were
- no digits after the point. */
+ value was given without a decimal point, a value of one that there were
+ no digits after the point. */
int fraction;
/* fractional part of the value (including the sign). The entire value is
i + ((float)fraction)/scale, provided 'scale' is non-zero. */
diff --git a/gs/contrib/pcl3/src/pclsize.c b/gs/contrib/pcl3/src/pclsize.c
index ec121a802..35f467216 100644
--- a/gs/contrib/pcl3/src/pclsize.c
+++ b/gs/contrib/pcl3/src/pclsize.c
@@ -175,10 +175,10 @@ ms_MediaCode pcl3_media_code(pcl_PageSize code)
if (result == NULL) {
key.ps = -code;
/* Actually, this is a generalization on my part: I am assuming that any
- two valid PCL Page Size codes with the same absolute value refer to the
- same media extension irrespective of sheet orientation in raster space.
+ two valid PCL Page Size codes with the same absolute value refer to the
+ same media extension irrespective of sheet orientation in raster space.
I have found negative Page Size codes in HP documentation only for
- Env10 and EnvDL. */
+ Env10 and EnvDL. */
result = (const CodeEntry *)bsearch(&key, inverse_map,
array_size(inverse_map), sizeof(CodeEntry), cmp_by_code);
}
diff --git a/gs/contrib/pcl3/src/pclsize.h b/gs/contrib/pcl3/src/pclsize.h
index 7c9840980..13a246e77 100644
--- a/gs/contrib/pcl3/src/pclsize.h
+++ b/gs/contrib/pcl3/src/pclsize.h
@@ -1,7 +1,7 @@
/******************************************************************************
File: $Id: pclsize.h,v 1.7 2000/11/19 07:05:17 Martin Rel $
Contents: Header file for maps between PCL Page Size codes and size
- information
+ information
Author: Martin Lottermoser, Greifswaldstrasse 28, 38124 Braunschweig,
Germany. E-mail: Martin.Lottermoser@t-online.de.
diff --git a/gs/contrib/pscolor/black.ps b/gs/contrib/pscolor/black.ps
index c22956d58..b56fe672b 100644
--- a/gs/contrib/pscolor/black.ps
+++ b/gs/contrib/pscolor/black.ps
@@ -20,7 +20,6 @@
%%BeginSetup
%ADOPrintSettings: L2 W1 vm op crd OS scsa T h ef bg ucr sf ef r b fa pr seps ttf hb Printer/PostScript Color Management 0
-
%%BeginResource: procset l2check 6.0 1
%%Copyright: Copyright 1993,2001 Adobe Systems Incorporated. All Rights Reserved.
systemdict /languagelevel known
@@ -2544,7 +2543,7 @@ PDFText begin
/Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla
/hungarumlaut/ogonek/caron
0 TE
-[1/dotlessi/caron 39/quotesingle 96/grave
+[1/dotlessi/caron 39/quotesingle 96/grave
127/bullet/Euro/bullet/quotesinglbase/florin/quotedblbase/ellipsis
/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE
/bullet/Zcaron/bullet/bullet/quoteleft/quoteright/quotedblleft
@@ -2800,7 +2799,6 @@ dup /BlackPoint [0 0 0] put
dup /WhitePoint [0.9642028809 1 0.8249053955] put]
/ColorSpace defineRes pop
-
[/NamespacePush PDFMark5
[/_objdef {Metadata_In_PS} /type /stream /OBJ PDFMark5
[{Metadata_In_PS} 1203 (% &end XMP packet& %) ReadByPDFMark5
@@ -2852,7 +2850,6 @@ This software comes with
) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with<?xpacket end='w'?>
-
% &end XMP packet& %
[{Metadata_In_PS} 2 dict begin /Type /Metadata def /Subtype /XML def currentdict end /PUT PDFMark5
diff --git a/gs/contrib/pscolor/color.ps b/gs/contrib/pscolor/color.ps
index bf2615e6d..c2e82ffac 100644
--- a/gs/contrib/pscolor/color.ps
+++ b/gs/contrib/pscolor/color.ps
@@ -20,7 +20,6 @@
%%BeginSetup
%ADOPrintSettings: L2 W1 vm op crd OS scsa T h ef bg ucr sf ef r b fa pr seps ttf hb Printer/PostScript Color Management 0
-
%%BeginResource: procset l2check 6.0 1
%%Copyright: Copyright 1993,2001 Adobe Systems Incorporated. All Rights Reserved.
systemdict /languagelevel known
@@ -2544,7 +2543,7 @@ PDFText begin
/Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla
/hungarumlaut/ogonek/caron
0 TE
-[1/dotlessi/caron 39/quotesingle 96/grave
+[1/dotlessi/caron 39/quotesingle 96/grave
127/bullet/Euro/bullet/quotesinglbase/florin/quotedblbase/ellipsis
/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE
/bullet/Zcaron/bullet/bullet/quoteleft/quoteright/quotedblleft
@@ -2800,7 +2799,6 @@ dup /BlackPoint [0 0 0] put
dup /WhitePoint [0.9642028809 1 0.8249053955] put]
/ColorSpace defineRes pop
-
[/NamespacePush PDFMark5
[/_objdef {Metadata_In_PS} /type /stream /OBJ PDFMark5
[{Metadata_In_PS} 1203 (% &end XMP packet& %) ReadByPDFMark5
@@ -2852,7 +2850,6 @@ This software comes with
) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with<?xpacket end='w'?>
-
% &end XMP packet& %
[{Metadata_In_PS} 2 dict begin /Type /Metadata def /Subtype /XML def currentdict end /PUT PDFMark5
diff --git a/gs/contrib/pscolor/input.ps b/gs/contrib/pscolor/input.ps
index 312e9bf0f..b35a07141 100644
--- a/gs/contrib/pscolor/input.ps
+++ b/gs/contrib/pscolor/input.ps
@@ -20,7 +20,6 @@
%%BeginSetup
%ADOPrintSettings: L2 W1 vm op crd OS scsa T h ef bg ucr sf ef r b fa pr seps ttf hb Printer/PostScript Color Management 0
-
%%BeginResource: procset l2check 6.0 1
%%Copyright: Copyright 1993,2001 Adobe Systems Incorporated. All Rights Reserved.
systemdict /languagelevel known
@@ -2544,7 +2543,7 @@ PDFText begin
/Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla
/hungarumlaut/ogonek/caron
0 TE
-[1/dotlessi/caron 39/quotesingle 96/grave
+[1/dotlessi/caron 39/quotesingle 96/grave
127/bullet/Euro/bullet/quotesinglbase/florin/quotedblbase/ellipsis
/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE
/bullet/Zcaron/bullet/bullet/quoteleft/quoteright/quotedblleft
@@ -2800,7 +2799,6 @@ dup /BlackPoint [0 0 0] put
dup /WhitePoint [0.9642028809 1 0.8249053955] put]
/ColorSpace defineRes pop
-
[/NamespacePush PDFMark5
[/_objdef {Metadata_In_PS} /type /stream /OBJ PDFMark5
[{Metadata_In_PS} 1203 (% &end XMP packet& %) ReadByPDFMark5
@@ -2814,24 +2812,8 @@ dup /WhitePoint [0.9642028809 1 0.8249053955] put]
<rdf:Description rdf:about='uuid:70bf7ecf-65cf-4042-9294-cd53b473d2a1' xmlns:dc='http://purl.org/dc/elements/1.1/' dc:format='application/pdf'><dc:creator><rdf:Seq><rdf:li>NT7493</rdf:li></rdf:Seq></dc:creator><dc:title><rdf:Alt><rdf:li xml:lang='x-default'>Microsoft Word - A.doc</rdf:li></rdf:Alt></dc:title></rdf:Description>
</rdf:RDF>
</x:xmpmeta>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<?xpacket end='w'?>
+<?xpacket end='w'?>
% &end XMP packet& %
diff --git a/gs/contrib/pscolor/test.c b/gs/contrib/pscolor/test.c
index bc06a7c18..182d08ce9 100644
--- a/gs/contrib/pscolor/test.c
+++ b/gs/contrib/pscolor/test.c
@@ -1,6 +1,6 @@
-/* using GS DLL as a ps colorpage separator.
- Carsten Hammer Océ-Deutschland GmbH
- Hammer.Carsten@oce.de */
+/* using GS DLL as a ps colorpage separator.
+ Carsten Hammer Océ-Deutschland GmbH
+ Hammer.Carsten@oce.de */
#ifdef _Windows
/* Compile with:
@@ -54,18 +54,18 @@ gsdll_stdin(void *instance, char *buf, int len)
return (strlen(buf));
} else if(eof==1000){
fprintf(temp_fd,"%s",buf);
- fflush(temp_fd);
- fclose(temp_fd);
- read_fd=fopen("temp.ps","rb");
+ fflush(temp_fd);
+ fclose(temp_fd);
+ read_fd=fopen("temp.ps","rb");
// fprintf(stderr, "Seitenende %d %d %s\n",hlen,strlen(buf),buf);
- while( (c=fgetc(read_fd)) != EOF)
- {
- fputc(c,choose);
- }
+ while( (c=fgetc(read_fd)) != EOF)
+ {
+ fputc(c,choose);
+ }
// fprintf(stderr, "Seitenende ende %d %d %s\n",hlen,strlen(buf),buf);
- fflush(choose);
- fclose(read_fd);
- temp_fd=fopen("temp.ps","wb");
+ fflush(choose);
+ fclose(read_fd);
+ temp_fd=fopen("temp.ps","wb");
return (strlen(buf));
} else if(eof!=0){
// fprintf(stderr, "Mittendrin %s\n",buf);
@@ -74,17 +74,17 @@ gsdll_stdin(void *instance, char *buf, int len)
return (strlen(buf));
} else {
fprintf(stderr, "Dateiende\n");
- read_fd=fopen("temp.ps","rb");
- while( (c=fgetc(read_fd)) != EOF)
- {
- fputc(c,choose);
- }
- fflush(choose);
- fclose(read_fd);
- fclose(temp_fd);
- temp_fd=fopen("temp.ps","wb");
+ read_fd=fopen("temp.ps","rb");
+ while( (c=fgetc(read_fd)) != EOF)
+ {
+ fputc(c,choose);
+ }
+ fflush(choose);
+ fclose(read_fd);
+ fclose(temp_fd);
+ temp_fd=fopen("temp.ps","wb");
return 0;
- }
+ }
}
#if 0
static int GSDLLCALL
@@ -92,28 +92,28 @@ gsdll_stdin(void *instance, char *buf, int len)
{
int ch;
int count = 0;
- size_t back;
+ size_t back;
char *init=buf;
while (count < len) {
- ch = fgetc(stdin);
- if (ch == EOF){
+ ch = fgetc(stdin);
+ if (ch == EOF){
#ifdef DISPLAY_DEBUG
fprintf(stderr, "lese %s\n",buf);
#endif
- fwrite(init,1,count,temp_fd);
- fflush(temp_fd);
- return 0;
- }
- *buf++ = ch;
- count++;
- if (ch == '\n')
- break;
+ fwrite(init,1,count,temp_fd);
+ fflush(temp_fd);
+ return 0;
+ }
+ *buf++ = ch;
+ count++;
+ if (ch == '\n')
+ break;
}
#ifdef DISPLAY_DEBUG
fprintf(stderr, "lese %s\n",buf);
#endif
- fwrite(init,1,count,temp_fd);
- fflush(temp_fd);
+ fwrite(init,1,count,temp_fd);
+ fflush(temp_fd);
return count;
}
#endif
@@ -134,7 +134,6 @@ gsdll_stderr(void *instance, const char *str, int len)
return len;
}
-
/* New device has been opened */
/* This is the first event from this device. */
static int display_open(void *handle, void *device)
@@ -174,39 +173,39 @@ static int display_close(void *handle, void *device)
/* Device is about to be resized. */
/* Resize will only occur if this function returns 0. */
-static int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+static int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
#ifdef DISPLAY_DEBUG
char buf[256];
sprintf(buf, "display_presize(0x%x, 0x%x, width=%d height=%d raster=%d\n\
- format=%d)\n",
+ format=%d)\n",
handle, device, width, height, raster, format);
fprintf(stderr, buf);
#endif
return 0;
}
-
+
/* Device has been resized. */
/* New pointer to raster returned in pimage */
-static int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+static int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
-
+
#ifdef DISPLAY_DEBUG
char buf[256];
sprintf(buf, "display_size(0x%x, 0x%x, width=%d height=%d raster=%d\n\
- format=%d image=0x%x)\n",
+ format=%d image=0x%x)\n",
handle, device, width, height, raster, format, pimage);
fprintf(stderr, buf);
#endif
- myimage=pimage;
- breite=width;
- hoehe=height;
- myraster=raster;
- return 0;
+ myimage=pimage;
+ breite=width;
+ hoehe=height;
+ myraster=raster;
+ return 0;
}
-
+
/* flushpage */
static int display_sync(void *handle, void *device)
{
@@ -224,54 +223,54 @@ static int display_sync(void *handle, void *device)
/* If you want to pause on showpage, then don't return immediately */
static int display_page(void *handle, void *device, int copies, int flush)
{
- int i,t,color=0;
+ int i,t,color=0;
#ifdef DISPLAY_DEBUG
char buf[256];
- sprintf(buf, "display_page(0x%x, 0x%x, copies=%d flush=%d)\n",
- handle, device, copies, flush);
+ sprintf(buf, "display_page(0x%x, 0x%x, copies=%d flush=%d)\n",
+ handle, device, copies, flush);
fprintf(stderr, buf);
#endif
- seite++;
- for(i=hoehe-1;i>=0;i=i-1){
- for(t=breite-1;t>=0;t=t-1){
- if((myimage[i*myraster+t*3+0]!=myimage[i*myraster+t*3+1])||(myimage[i*myraster+t*3+1]!=myimage[i*myraster+t*3+2])){
- color=1;
- fprintf(stderr,"Ungleich %d,%d %x,%x,%x\n",i,t,myimage[i*myraster+t*3+0],myimage[i*myraster+t*3+1],myimage[i*myraster+t*3+2]);
- goto out;
- }
- }
- }
+ seite++;
+ for(i=hoehe-1;i>=0;i=i-1){
+ for(t=breite-1;t>=0;t=t-1){
+ if((myimage[i*myraster+t*3+0]!=myimage[i*myraster+t*3+1])||(myimage[i*myraster+t*3+1]!=myimage[i*myraster+t*3+2])){
+ color=1;
+ fprintf(stderr,"Ungleich %d,%d %x,%x,%x\n",i,t,myimage[i*myraster+t*3+0],myimage[i*myraster+t*3+1],myimage[i*myraster+t*3+2]);
+ goto out;
+ }
+ }
+ }
out:
- if(color){
- fprintf(stderr,"[%d]Color\n",seite);
- choose=color_fd;
- } else {
- fprintf(stderr,"[%d]Grey\n",seite);
- choose=black_fd;
- }
+ if(color){
+ fprintf(stderr,"[%d]Color\n",seite);
+ choose=color_fd;
+ } else {
+ fprintf(stderr,"[%d]Grey\n",seite);
+ choose=black_fd;
+ }
/*
- read_fd=fopen("temp.ps","rb");
- while( (c=fgetc(read_fd)) != EOF)
- {
- fputc(c,choose);
- }
- fflush(choose);
- fclose(read_fd);
- fclose(temp_fd);
- temp_fd=fopen("temp.ps","wb");
+ read_fd=fopen("temp.ps","rb");
+ while( (c=fgetc(read_fd)) != EOF)
+ {
+ fputc(c,choose);
+ }
+ fflush(choose);
+ fclose(read_fd);
+ fclose(temp_fd);
+ temp_fd=fopen("temp.ps","wb");
*/
return 0;
}
/* Poll the caller for cooperative multitasking. */
/* If this function is NULL, polling is not needed */
-static int display_update(void *handle, void *device,
+static int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
return 0;
}
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -290,7 +289,6 @@ display_callback display = {
static gs_main_instance *minst;
const char start_string[] = "systemdict /start get exec\n";
-
int main(int argc, char *argv[])
{
int code;
@@ -314,29 +312,27 @@ int main(int argc, char *argv[])
gsargv[11] = "-";
gsargc=12;
-
-
code = gsapi_new_instance(&minst, NULL);
if (code < 0)
- return 1;
+ return 1;
gsapi_set_stdio(minst, gsdll_stdin, gsdll_stdout, gsdll_stderr);
gsapi_set_display_callback(minst, &display);
- color_fd=fopen("color.ps","wb");
- black_fd=fopen("black.ps","wb");
- temp_fd=fopen("temp.ps","wb");
- choose=black_fd;
+ color_fd=fopen("color.ps","wb");
+ black_fd=fopen("black.ps","wb");
+ temp_fd=fopen("temp.ps","wb");
+ choose=black_fd;
code = gsapi_init_with_args(minst, gsargc, gsargv);
gsapi_exit(minst);
gsapi_delete_instance(minst);
- fclose(color_fd);
- fclose(black_fd);
- fclose(temp_fd);
+ fclose(color_fd);
+ fclose(black_fd);
+ fclose(temp_fd);
if ((code == 0) || (code == e_Quit))
- return 0;
+ return 0;
return 1;
}
diff --git a/gs/icclib/icc.c b/gs/icclib/icc.c
index 5f0e6adc3..ce31db445 100644
--- a/gs/icclib/icc.c
+++ b/gs/icclib/icc.c
@@ -1,5 +1,4 @@
-
-/*
+/*
* International Color Consortium Format Library (icclib)
* For ICC profile version 3.4
*
@@ -18,7 +17,7 @@
* errors are ignored where possible, rather than generating
* a fatal error (see ICM_STRICT #define).
*
- * NameColor Dump doesn't handle device space correctly -
+ * NameColor Dump doesn't handle device space correctly -
* should use appropriate interpretation in case device is Lab etc.
*
* Should recognise & honour unicode 0xFFFE endian marker.
@@ -51,7 +50,7 @@
/*
* Change History:
- *
+ *
* 2.02
* Merged rename of [u]int64 to icm[Ui][I]nt64 (to work around
* AIX 5.1L portability bug) from Raph Levien.
@@ -96,13 +95,13 @@
* 1.31
* Added file I/O class to allow substitution of alternative ICC profile
* file access. Provide standard file class instance, and memory image
- * instance of file I/O class as default and example.
+ * instance of file I/O class as default and example.
* Added an optional new_icc_a() object creator, that takes a memory
* allocator class instance. This allows an alternate memory heap to
- * be used with the icc class.
+ * be used with the icc class.
* Renamed object free() methods to del() for more consistency with new().
*
- * 1.30
+ * 1.30
* Added workaround for reading some Adobe profiles with confused header DateTime.
* Enhanced tag allocate() methods so that they can resize allocations.
* Enhanced icmLut_set_tables() to access grid points in a cache friendly order.
@@ -110,15 +109,15 @@
* uneccessary static declarations in icc.h, and fixed a bug in
* icmTable_lookup_bwd() that effected both accuracy and speed. (Thanks to Andrei Frolov)
* Removed icmAbsoluteColorimetricXYZ intent, and replaced it with
- * a PCS overide capability. This adds a new parameter to get_luobj()
+ * a PCS overide capability. This adds a new parameter to get_luobj()
* Added Lab translations of some XYZ "dump" strings.
* Fix memory leak after failed tag read + rename_tag function
* + shared library support changes. (Thanks to Carles Llopis).
* Changed all the public 2str utility routines to a single function
* that can be used to interpret an enumeration or tag in a human
- * readable form.
+ * readable form.
*
- * 1.23
+ * 1.23
* Fixed important bug in Lut read/write. The matrix values had their
* rows and columns switched. Not many profiles exercise this code.
* Thanks to David Gillman for discovering this problem.
@@ -145,7 +144,7 @@
* for this correction of Lab encoding.
* Trying to create an 8 bit XYZ Lut will now fail if icclib helper
* functions are used to create it.
- *
+ *
* 1.20 99/2/7
* Added profile color lookup functon.
* Added set_tables() support.
@@ -186,9 +185,9 @@ static int icmFileStd_seek(
icmFile *pp,
long int offset
) {
- icmFileStd *p = (icmFileStd *)pp;
+ icmFileStd *p = (icmFileStd *)pp;
- return fseek(p->fp, offset, SEEK_SET);
+ return fseek(p->fp, offset, SEEK_SET);
}
/* Read count items of size length. Return number of items successfully read. */
@@ -198,9 +197,9 @@ void *buffer,
size_t size,
size_t count
) {
- icmFileStd *p = (icmFileStd *)pp;
+ icmFileStd *p = (icmFileStd *)pp;
- return fread(buffer, size, count, p->fp);
+ return fread(buffer, size, count, p->fp);
}
/* write count items of size length. Return number of items successfully written. */
@@ -210,53 +209,52 @@ void *buffer,
size_t size,
size_t count
) {
- icmFileStd *p = (icmFileStd *)pp;
+ icmFileStd *p = (icmFileStd *)pp;
- return fwrite(buffer, size, count, p->fp);
+ return fwrite(buffer, size, count, p->fp);
}
-
/* flush all write data out to secondary storage. Return nz on failure. */
static int icmFileStd_flush(
icmFile *pp
) {
- icmFileStd *p = (icmFileStd *)pp;
+ icmFileStd *p = (icmFileStd *)pp;
- return fflush(p->fp);
+ return fflush(p->fp);
}
/* we're done with the file object, return nz on failure */
static int icmFileStd_delete(
icmFile *pp
) {
- icmFileStd *p = (icmFileStd *)pp;
+ icmFileStd *p = (icmFileStd *)pp;
- if (p->doclose != 0) {
- if (fclose(p->fp) != 0)
- return 2;
- }
+ if (p->doclose != 0) {
+ if (fclose(p->fp) != 0)
+ return 2;
+ }
- free(p);
- return 0;
+ free(p);
+ return 0;
}
/* Create icmFile given a (binary) FILE* */
icmFile *new_icmFileStd_fp(
FILE *fp
) {
- icmFileStd *p;
- if ((p = (icmFileStd *) calloc(1,sizeof(icmFileStd))) == NULL)
- return NULL;
- p->seek = icmFileStd_seek;
- p->read = icmFileStd_read;
- p->write = icmFileStd_write;
- p->flush = icmFileStd_flush;
- p->del = icmFileStd_delete;
+ icmFileStd *p;
+ if ((p = (icmFileStd *) calloc(1,sizeof(icmFileStd))) == NULL)
+ return NULL;
+ p->seek = icmFileStd_seek;
+ p->read = icmFileStd_read;
+ p->write = icmFileStd_write;
+ p->flush = icmFileStd_flush;
+ p->del = icmFileStd_delete;
- p->fp = fp;
- p->doclose = 0;
+ p->fp = fp;
+ p->doclose = 0;
- return (icmFile *)p;
+ return (icmFile *)p;
}
/* Create icmFile given a file name */
@@ -264,29 +262,29 @@ icmFile *new_icmFileStd_name(
char *name,
char *mode
) {
- FILE *fp;
- icmFile *p;
+ FILE *fp;
+ icmFile *p;
#if defined(O_BINARY)
- char nmode[50];
+ char nmode[50];
#endif
- if ((fp = fopen(name,mode)) == NULL)
- return NULL;
+ if ((fp = fopen(name,mode)) == NULL)
+ return NULL;
#if defined(O_BINARY)
- strcpy(nmode, mode);
- strcat(nmode, "b");
- if ((fp = freopen(name, nmode, fp)) == NULL)
- return NULL;
+ strcpy(nmode, mode);
+ strcat(nmode, "b");
+ if ((fp = freopen(name, nmode, fp)) == NULL)
+ return NULL;
#endif
-
- p = new_icmFileStd_fp(fp);
- if (p != NULL) {
- icmFileStd *pp = (icmFileStd *)p;
- pp->doclose = 1;
- }
- return p;
+ p = new_icmFileStd_fp(fp);
+
+ if (p != NULL) {
+ icmFileStd *pp = (icmFileStd *)p;
+ pp->doclose = 1;
+ }
+ return p;
}
/* ------------------------------------------------- */
@@ -299,14 +297,14 @@ static int icmFileMem_seek(
icmFile *pp,
long int offset
) {
- icmFileMem *p = (icmFileMem *)pp;
- unsigned char *np;
+ icmFileMem *p = (icmFileMem *)pp;
+ unsigned char *np;
- np = p->start + offset;
- if (np < p->start || np >= p->end)
- return 1;
- p->cur = np;
- return 0;
+ np = p->start + offset;
+ if (np < p->start || np >= p->end)
+ return 1;
+ p->cur = np;
+ return 0;
}
/* Read count items of size length. Return number of items successfully read. */
@@ -316,24 +314,24 @@ void *buffer,
size_t size,
size_t count
) {
- icmFileMem *p = (icmFileMem *)pp;
- size_t len;
+ icmFileMem *p = (icmFileMem *)pp;
+ size_t len;
- if (count > 0 && size > SIZE_MAX / count)
- return 0;
+ if (count > 0 && size > SIZE_MAX / count)
+ return 0;
- len = size * count;
- if (len > (p->end - p->cur)) { /* Too much */
- if (size > 0)
- count = (p->end - p->cur)/size;
- else
- count = 0;
- }
- len = size * count;
- if (len > 0)
- memcpy (buffer, p->cur, len);
- p->cur += len;
- return count;
+ len = size * count;
+ if (len > (p->end - p->cur)) { /* Too much */
+ if (size > 0)
+ count = (p->end - p->cur)/size;
+ else
+ count = 0;
+ }
+ len = size * count;
+ if (len > 0)
+ memcpy (buffer, p->cur, len);
+ p->cur += len;
+ return count;
}
/* write count items of size length. Return number of items successfully written. */
@@ -343,39 +341,38 @@ void *buffer,
size_t size,
size_t count
) {
- icmFileMem *p = (icmFileMem *)pp;
- size_t len;
+ icmFileMem *p = (icmFileMem *)pp;
+ size_t len;
- len = size * count;
- if ((p->cur + len) >= p->end) { /* Too much */
- if (size > 0)
- count = (p->end - p->cur)/size;
- else
- count = 0;
- }
- len = size * count;
- if (len > 0)
- memcpy (p->cur, buffer, len);
- p->cur += len;
- return count;
+ len = size * count;
+ if ((p->cur + len) >= p->end) { /* Too much */
+ if (size > 0)
+ count = (p->end - p->cur)/size;
+ else
+ count = 0;
+ }
+ len = size * count;
+ if (len > 0)
+ memcpy (p->cur, buffer, len);
+ p->cur += len;
+ return count;
}
-
/* flush all write data out to secondary storage. Return nz on failure. */
static int icmFileMem_flush(
icmFile *pp
) {
- return 0;
+ return 0;
}
/* we're done with the file object, return nz on failure */
static int icmFileMem_delete(
icmFile *pp
) {
- icmFileMem *p = (icmFileMem *)pp;
+ icmFileMem *p = (icmFileMem *)pp;
- free(p);
- return 0;
+ free(p);
+ return 0;
}
/* Create a memory image file access class */
@@ -383,19 +380,19 @@ icmFile *new_icmFileMem(
void *base, /* Pointer to base of memory buffer */
size_t length /* Number of bytes in buffer */
) {
- icmFileMem *p;
- if ((p = (icmFileMem *) calloc(1,sizeof(icmFileMem))) == NULL)
- return NULL;
- p->seek = icmFileMem_seek;
- p->read = icmFileMem_read;
- p->write = icmFileMem_write;
- p->flush = icmFileMem_flush;
- p->del = icmFileMem_delete;
+ icmFileMem *p;
+ if ((p = (icmFileMem *) calloc(1,sizeof(icmFileMem))) == NULL)
+ return NULL;
+ p->seek = icmFileMem_seek;
+ p->read = icmFileMem_read;
+ p->write = icmFileMem_write;
+ p->flush = icmFileMem_flush;
+ p->del = icmFileMem_delete;
- p->cur = p->start = base;
- p->end = p->start + length;
+ p->cur = p->start = base;
+ p->end = p->start + length;
- return (icmFile *)p;
+ return (icmFile *)p;
}
/* ------------------------------------------------- */
@@ -406,7 +403,7 @@ static void *icmAllocStd_malloc(
struct _icmAlloc *pp,
size_t size
) {
- return malloc(size);
+ return malloc(size);
}
static void *icmAllocStd_calloc(
@@ -414,7 +411,7 @@ struct _icmAlloc *pp,
size_t num,
size_t size
) {
- return calloc(num, size);
+ return calloc(num, size);
}
static void *icmAllocStd_realloc(
@@ -422,38 +419,37 @@ struct _icmAlloc *pp,
void *ptr,
size_t size
) {
- return realloc(ptr, size);
+ return realloc(ptr, size);
}
-
static void icmAllocStd_free(
struct _icmAlloc *pp,
void *ptr
) {
- free(ptr);
+ free(ptr);
}
/* we're done with the AllocStd object */
static void icmAllocStd_delete(
icmAlloc *pp
) {
- icmAllocStd *p = (icmAllocStd *)pp;
+ icmAllocStd *p = (icmAllocStd *)pp;
- free(p);
+ free(p);
}
/* Create icmAllocStd */
icmAlloc *new_icmAllocStd() {
- icmAllocStd *p;
- if ((p = (icmAllocStd *) calloc(1,sizeof(icmAllocStd))) == NULL)
- return NULL;
- p->malloc = icmAllocStd_malloc;
- p->calloc = icmAllocStd_calloc;
- p->realloc = icmAllocStd_realloc;
- p->free = icmAllocStd_free;
- p->del = icmAllocStd_delete;
+ icmAllocStd *p;
+ if ((p = (icmAllocStd *) calloc(1,sizeof(icmAllocStd))) == NULL)
+ return NULL;
+ p->malloc = icmAllocStd_malloc;
+ p->calloc = icmAllocStd_calloc;
+ p->realloc = icmAllocStd_realloc;
+ p->free = icmAllocStd_free;
+ p->del = icmAllocStd_delete;
- return (icmAlloc *)p;
+ return (icmAlloc *)p;
}
/* ========================================================== */
@@ -463,368 +459,367 @@ icmAlloc *new_icmAllocStd() {
/* Unsigned */
static unsigned int read_UInt8Number(char *p) {
- unsigned int rv;
- rv = (unsigned int)((ORD8 *)p)[0];
- return rv;
+ unsigned int rv;
+ rv = (unsigned int)((ORD8 *)p)[0];
+ return rv;
}
static int write_UInt8Number(unsigned int d, char *p) {
- if (d > 255)
- return 1;
- ((ORD8 *)p)[0] = (ORD8)d;
- return 0;
+ if (d > 255)
+ return 1;
+ ((ORD8 *)p)[0] = (ORD8)d;
+ return 0;
}
static unsigned int read_UInt16Number(char *p) {
- unsigned int rv;
- rv = 256 * (unsigned int)((ORD8 *)p)[0]
- + (unsigned int)((ORD8 *)p)[1];
- return rv;
+ unsigned int rv;
+ rv = 256 * (unsigned int)((ORD8 *)p)[0]
+ + (unsigned int)((ORD8 *)p)[1];
+ return rv;
}
static int write_UInt16Number(unsigned int d, char *p) {
- if (d > 65535)
- return 1;
- ((ORD8 *)p)[0] = (ORD8)(d >> 8);
- ((ORD8 *)p)[1] = (ORD8)(d);
- return 0;
+ if (d > 65535)
+ return 1;
+ ((ORD8 *)p)[0] = (ORD8)(d >> 8);
+ ((ORD8 *)p)[1] = (ORD8)(d);
+ return 0;
}
static unsigned int read_UInt32Number(char *p) {
- unsigned int rv;
- rv = 16777216 * (unsigned int)((ORD8 *)p)[0]
- + 65536 * (unsigned int)((ORD8 *)p)[1]
- + 256 * (unsigned int)((ORD8 *)p)[2]
- + (unsigned int)((ORD8 *)p)[3];
- return rv;
+ unsigned int rv;
+ rv = 16777216 * (unsigned int)((ORD8 *)p)[0]
+ + 65536 * (unsigned int)((ORD8 *)p)[1]
+ + 256 * (unsigned int)((ORD8 *)p)[2]
+ + (unsigned int)((ORD8 *)p)[3];
+ return rv;
}
static int write_UInt32Number(unsigned int d, char *p) {
- ((ORD8 *)p)[0] = (ORD8)(d >> 24);
- ((ORD8 *)p)[1] = (ORD8)(d >> 16);
- ((ORD8 *)p)[2] = (ORD8)(d >> 8);
- ((ORD8 *)p)[3] = (ORD8)(d);
- return 0;
+ ((ORD8 *)p)[0] = (ORD8)(d >> 24);
+ ((ORD8 *)p)[1] = (ORD8)(d >> 16);
+ ((ORD8 *)p)[2] = (ORD8)(d >> 8);
+ ((ORD8 *)p)[3] = (ORD8)(d);
+ return 0;
}
static void read_UInt64Number(icmUint64 *d, char *p) {
- d->h = 16777216 * (unsigned int)((ORD8 *)p)[0]
- + 65536 * (unsigned int)((ORD8 *)p)[1]
- + 256 * (unsigned int)((ORD8 *)p)[2]
- + (unsigned int)((ORD8 *)p)[3];
- d->l = 16777216 * (unsigned int)((ORD8 *)p)[4]
- + 65536 * (unsigned int)((ORD8 *)p)[5]
- + 256 * (unsigned int)((ORD8 *)p)[6]
- + (unsigned int)((ORD8 *)p)[7];
+ d->h = 16777216 * (unsigned int)((ORD8 *)p)[0]
+ + 65536 * (unsigned int)((ORD8 *)p)[1]
+ + 256 * (unsigned int)((ORD8 *)p)[2]
+ + (unsigned int)((ORD8 *)p)[3];
+ d->l = 16777216 * (unsigned int)((ORD8 *)p)[4]
+ + 65536 * (unsigned int)((ORD8 *)p)[5]
+ + 256 * (unsigned int)((ORD8 *)p)[6]
+ + (unsigned int)((ORD8 *)p)[7];
}
static int write_UInt64Number(icmUint64 *d, char *p) {
- ((ORD8 *)p)[0] = (ORD8)(d->h >> 24);
- ((ORD8 *)p)[1] = (ORD8)(d->h >> 16);
- ((ORD8 *)p)[2] = (ORD8)(d->h >> 8);
- ((ORD8 *)p)[3] = (ORD8)(d->h);
- ((ORD8 *)p)[4] = (ORD8)(d->l >> 24);
- ((ORD8 *)p)[5] = (ORD8)(d->l >> 16);
- ((ORD8 *)p)[6] = (ORD8)(d->l >> 8);
- ((ORD8 *)p)[7] = (ORD8)(d->l);
- return 0;
+ ((ORD8 *)p)[0] = (ORD8)(d->h >> 24);
+ ((ORD8 *)p)[1] = (ORD8)(d->h >> 16);
+ ((ORD8 *)p)[2] = (ORD8)(d->h >> 8);
+ ((ORD8 *)p)[3] = (ORD8)(d->h);
+ ((ORD8 *)p)[4] = (ORD8)(d->l >> 24);
+ ((ORD8 *)p)[5] = (ORD8)(d->l >> 16);
+ ((ORD8 *)p)[6] = (ORD8)(d->l >> 8);
+ ((ORD8 *)p)[7] = (ORD8)(d->l);
+ return 0;
}
static double read_U8Fixed8Number(char *p) {
- ORD32 o32;
- o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ ORD32 o32;
+ o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ (ORD32)((ORD8 *)p)[1];
- return (double)o32/256.0;
+ return (double)o32/256.0;
}
static int write_U8Fixed8Number(double d, char *p) {
- ORD32 o32;
- d = d * 256.0 + 0.5;
- if (d >= 65536.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
- ((ORD8 *)p)[1] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = d * 256.0 + 0.5;
+ if (d >= 65536.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
+ ((ORD8 *)p)[1] = (ORD8)((o32));
+ return 0;
}
static double read_U16Fixed16Number(char *p) {
- ORD32 o32;
- o32 = 16777216 * (ORD32)((ORD8 *)p)[0] /* Read big endian 32 bit unsigned */
+ ORD32 o32;
+ o32 = 16777216 * (ORD32)((ORD8 *)p)[0] /* Read big endian 32 bit unsigned */
+ 65536 * (ORD32)((ORD8 *)p)[1]
- + 256 * (ORD32)((ORD8 *)p)[2]
- + (ORD32)((ORD8 *)p)[3];
- return (double)o32/65536.0;
+ + 256 * (ORD32)((ORD8 *)p)[2]
+ + (ORD32)((ORD8 *)p)[3];
+ return (double)o32/65536.0;
}
static int write_U16Fixed16Number(double d, char *p) {
- ORD32 o32;
- d = d * 65536.0 + 0.5;
- if (d >= 4294967296.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32) >> 24);
- ((ORD8 *)p)[1] = (ORD8)((o32) >> 16);
- ((ORD8 *)p)[2] = (ORD8)((o32) >> 8);
- ((ORD8 *)p)[3] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = d * 65536.0 + 0.5;
+ if (d >= 4294967296.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32) >> 24);
+ ((ORD8 *)p)[1] = (ORD8)((o32) >> 16);
+ ((ORD8 *)p)[2] = (ORD8)((o32) >> 8);
+ ((ORD8 *)p)[3] = (ORD8)((o32));
+ return 0;
}
-
#ifdef NEVER /* Not currently used anywhere */
/* Signed numbers */
static int read_SInt8Number(char *p) {
- int rv;
- rv = (int)((INR8 *)p)[0];
- return rv;
+ int rv;
+ rv = (int)((INR8 *)p)[0];
+ return rv;
}
static int write_SInt8Number(int d, char *p) {
- if (d > 127)
- return 1;
- else if (d < -128)
- return 1;
- ((INR8 *)p)[0] = (INR8)d;
- return 0;
+ if (d > 127)
+ return 1;
+ else if (d < -128)
+ return 1;
+ ((INR8 *)p)[0] = (INR8)d;
+ return 0;
}
static int read_SInt16Number(char *p) {
- int rv;
- rv = 256 * (int)((INR8 *)p)[0]
- + (int)((ORD8 *)p)[1];
- return rv;
+ int rv;
+ rv = 256 * (int)((INR8 *)p)[0]
+ + (int)((ORD8 *)p)[1];
+ return rv;
}
static int write_SInt16Number(int d, char *p) {
- if (d > 32767)
- return 1;
- else if (d < -32768)
- return 1;
- ((INR8 *)p)[0] = (INR8)(d >> 8);
- ((ORD8 *)p)[1] = (ORD8)(d);
- return 0;
+ if (d > 32767)
+ return 1;
+ else if (d < -32768)
+ return 1;
+ ((INR8 *)p)[0] = (INR8)(d >> 8);
+ ((ORD8 *)p)[1] = (ORD8)(d);
+ return 0;
}
#endif /* NEVER */
static int read_SInt32Number(char *p) {
- int rv;
- rv = 16777216 * (int)((INR8 *)p)[0]
- + 65536 * (int)((ORD8 *)p)[1]
- + 256 * (int)((ORD8 *)p)[2]
- + (int)((ORD8 *)p)[3];
- return rv;
+ int rv;
+ rv = 16777216 * (int)((INR8 *)p)[0]
+ + 65536 * (int)((ORD8 *)p)[1]
+ + 256 * (int)((ORD8 *)p)[2]
+ + (int)((ORD8 *)p)[3];
+ return rv;
}
static int write_SInt32Number(int d, char *p) {
- ((INR8 *)p)[0] = (INR8)(d >> 24);
- ((ORD8 *)p)[1] = (ORD8)(d >> 16);
- ((ORD8 *)p)[2] = (ORD8)(d >> 8);
- ((ORD8 *)p)[3] = (ORD8)(d);
- return 0;
+ ((INR8 *)p)[0] = (INR8)(d >> 24);
+ ((ORD8 *)p)[1] = (ORD8)(d >> 16);
+ ((ORD8 *)p)[2] = (ORD8)(d >> 8);
+ ((ORD8 *)p)[3] = (ORD8)(d);
+ return 0;
}
#ifdef NEVER /* Not currently used anywhere */
static void read_SInt64Number(icmInt64 *d, char *p) {
- d->h = 16777216 * (int)((INR8 *)p)[0]
- + 65536 * (int)((ORD8 *)p)[1]
- + 256 * (int)((ORD8 *)p)[2]
- + (int)((ORD8 *)p)[3];
- d->l = 16777216 * (unsigned int)((ORD8 *)p)[4]
- + 65536 * (unsigned int)((ORD8 *)p)[5]
- + 256 * (unsigned int)((ORD8 *)p)[6]
- + (unsigned int)((ORD8 *)p)[7];
+ d->h = 16777216 * (int)((INR8 *)p)[0]
+ + 65536 * (int)((ORD8 *)p)[1]
+ + 256 * (int)((ORD8 *)p)[2]
+ + (int)((ORD8 *)p)[3];
+ d->l = 16777216 * (unsigned int)((ORD8 *)p)[4]
+ + 65536 * (unsigned int)((ORD8 *)p)[5]
+ + 256 * (unsigned int)((ORD8 *)p)[6]
+ + (unsigned int)((ORD8 *)p)[7];
}
static int write_SInt64Number(icmInt64 *d, char *p) {
- ((INR8 *)p)[0] = (INR8)(d->h >> 24);
- ((ORD8 *)p)[1] = (ORD8)(d->h >> 16);
- ((ORD8 *)p)[2] = (ORD8)(d->h >> 8);
- ((ORD8 *)p)[3] = (ORD8)(d->h);
- ((ORD8 *)p)[4] = (ORD8)(d->l >> 24);
- ((ORD8 *)p)[5] = (ORD8)(d->l >> 16);
- ((ORD8 *)p)[6] = (ORD8)(d->l >> 8);
- ((ORD8 *)p)[7] = (ORD8)(d->l);
- return 0;
+ ((INR8 *)p)[0] = (INR8)(d->h >> 24);
+ ((ORD8 *)p)[1] = (ORD8)(d->h >> 16);
+ ((ORD8 *)p)[2] = (ORD8)(d->h >> 8);
+ ((ORD8 *)p)[3] = (ORD8)(d->h);
+ ((ORD8 *)p)[4] = (ORD8)(d->l >> 24);
+ ((ORD8 *)p)[5] = (ORD8)(d->l >> 16);
+ ((ORD8 *)p)[6] = (ORD8)(d->l >> 8);
+ ((ORD8 *)p)[7] = (ORD8)(d->l);
+ return 0;
}
#endif /* NEVER */
static double read_S15Fixed16Number(char *p) {
- INR32 i32;
- i32 = 16777216 * (INR32)((INR8 *)p)[0] /* Read big endian 32 bit signed */
+ INR32 i32;
+ i32 = 16777216 * (INR32)((INR8 *)p)[0] /* Read big endian 32 bit signed */
+ 65536 * (INR32)((ORD8 *)p)[1]
- + 256 * (INR32)((ORD8 *)p)[2]
- + (INR32)((ORD8 *)p)[3];
- return (double)i32/65536.0;
+ + 256 * (INR32)((ORD8 *)p)[2]
+ + (INR32)((ORD8 *)p)[3];
+ return (double)i32/65536.0;
}
static int write_S15Fixed16Number(double d, char *p) {
- INR32 i32;
- d = ceil(d * 65536.0); /* Beware! (int)(d + 0.5) doesn't work! */
- if (d >= 2147483648.0)
- return 1;
- if (d < -2147483648.0)
- return 1;
- i32 = (INR32)d;
- ((INR8 *)p)[0] = (INR8)((i32) >> 24); /* Write big endian 32 bit signed */
- ((ORD8 *)p)[1] = (ORD8)((i32) >> 16);
- ((ORD8 *)p)[2] = (ORD8)((i32) >> 8);
- ((ORD8 *)p)[3] = (ORD8)((i32));
- return 0;
+ INR32 i32;
+ d = ceil(d * 65536.0); /* Beware! (int)(d + 0.5) doesn't work! */
+ if (d >= 2147483648.0)
+ return 1;
+ if (d < -2147483648.0)
+ return 1;
+ i32 = (INR32)d;
+ ((INR8 *)p)[0] = (INR8)((i32) >> 24); /* Write big endian 32 bit signed */
+ ((ORD8 *)p)[1] = (ORD8)((i32) >> 16);
+ ((ORD8 *)p)[2] = (ORD8)((i32) >> 8);
+ ((ORD8 *)p)[3] = (ORD8)((i32));
+ return 0;
}
/* PCS encoded numbers */
/* 16 bit XYZ - value range 0.0 - 1.9997 */
static double read_PCSXYZ16Number(char *p) {
- ORD32 o32;
- o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ ORD32 o32;
+ o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ (ORD32)((ORD8 *)p)[1];
- return (double)o32/32768.0;
+ return (double)o32/32768.0;
}
static int write_PCSXYZ16Number(double d, char *p) {
- ORD32 o32;
- d = d * 32768.0 + 0.5;
- if (d >= 65536.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
- ((ORD8 *)p)[1] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = d * 32768.0 + 0.5;
+ if (d >= 65536.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
+ ((ORD8 *)p)[1] = (ORD8)((o32));
+ return 0;
}
#ifdef NEVER /* Not currently used */
/* L part of 8 bit Lab - value range 0.0 - 100.0 */
static double read_PCSL8Number(char *p) {
- ORD32 o32;
- o32 = (ORD32)((ORD8 *)p)[0]; /* Read big endian 8 bit unsigned */
- return (double)o32/2.550;
+ ORD32 o32;
+ o32 = (ORD32)((ORD8 *)p)[0]; /* Read big endian 8 bit unsigned */
+ return (double)o32/2.550;
}
static int write_PCSL8Number(double d, char *p) {
- ORD32 o32;
- d = d * 2.550 + 0.5;
- if (d >= 256.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = d * 2.550 + 0.5;
+ if (d >= 256.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32));
+ return 0;
}
/* ab part of 8 bit Lab - value range -128.0 - 127.0 */
static double read_PCSab8Number(char *p) {
- ORD32 o32;
- o32 = (ORD32)((ORD8 *)p)[0]; /* Read big endian 8 bit unsigned */
- return (double)o32-128.0;
+ ORD32 o32;
+ o32 = (ORD32)((ORD8 *)p)[0]; /* Read big endian 8 bit unsigned */
+ return (double)o32-128.0;
}
static int write_PCSab8Number(double d, char *p) {
- ORD32 o32;
- d = (d+128.0) + 0.5;
- if (d >= 256.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = (d+128.0) + 0.5;
+ if (d >= 256.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32));
+ return 0;
}
#endif /* NEVER */
/* L part of 16 bit Lab - value range 0.0 - 100.0 */
static double read_PCSL16Number(char *p) {
- ORD32 o32;
- o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ ORD32 o32;
+ o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ (ORD32)((ORD8 *)p)[1];
- return (double)o32/652.800; /* 0xff00/100.0 */
+ return (double)o32/652.800; /* 0xff00/100.0 */
}
static int write_PCSL16Number(double d, char *p) {
- ORD32 o32;
- d = d * 652.800 + 0.5;
- if (d >= 65536.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
- ((ORD8 *)p)[1] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = d * 652.800 + 0.5;
+ if (d >= 65536.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
+ ((ORD8 *)p)[1] = (ORD8)((o32));
+ return 0;
}
/* ab part of 16 bit Lab - value range -128.0 - 127.9961 */
static double read_PCSab16Number(char *p) {
- ORD32 o32;
- o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ ORD32 o32;
+ o32 = 256 * (ORD32)((ORD8 *)p)[0] /* Read big endian 16 bit unsigned */
+ (ORD32)((ORD8 *)p)[1];
- return ((double)o32/256.0)-128.0;
+ return ((double)o32/256.0)-128.0;
}
static int write_PCSab16Number(double d, char *p) {
- ORD32 o32;
- d = (d+128.0) * 256.0 + 0.5;
- if (d >= 65536.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
- ((ORD8 *)p)[1] = (ORD8)((o32));
- return 0;
+ ORD32 o32;
+ d = (d+128.0) * 256.0 + 0.5;
+ if (d >= 65536.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)((o32) >> 8);
+ ((ORD8 *)p)[1] = (ORD8)((o32));
+ return 0;
}
/* Device coordinate as 8 bit value range 0.0 - 1.0 */
static double read_DCS8Number(char *p) {
- unsigned int rv;
- rv = (unsigned int)((ORD8 *)p)[0];
- return (double)rv/255.0;
+ unsigned int rv;
+ rv = (unsigned int)((ORD8 *)p)[0];
+ return (double)rv/255.0;
}
static int write_DCS8Number(double d, char *p) {
- ORD32 o32;
- d = d * 255.0 + 0.5;
- if (d >= 256.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)(o32);
- return 0;
+ ORD32 o32;
+ d = d * 255.0 + 0.5;
+ if (d >= 256.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)(o32);
+ return 0;
}
/* Device coordinate as 16 bit value range 0.0 - 1.0 */
static double read_DCS16Number(char *p) {
- unsigned int rv;
- rv = 256 * (unsigned int)((ORD8 *)p)[0]
- + (unsigned int)((ORD8 *)p)[1];
- return (double)rv/65535.0;
+ unsigned int rv;
+ rv = 256 * (unsigned int)((ORD8 *)p)[0]
+ + (unsigned int)((ORD8 *)p)[1];
+ return (double)rv/65535.0;
}
static int write_DCS16Number(double d, char *p) {
- ORD32 o32;
- d = d * 65535.0 + 0.5;
- if (d >= 65536.0)
- return 1;
- if (d < 0.0)
- return 1;
- o32 = (ORD32)d;
- ((ORD8 *)p)[0] = (ORD8)(o32 >> 8);
- ((ORD8 *)p)[1] = (ORD8)(o32);
- return 0;
+ ORD32 o32;
+ d = d * 65535.0 + 0.5;
+ if (d >= 65536.0)
+ return 1;
+ if (d < 0.0)
+ return 1;
+ o32 = (ORD32)d;
+ ((ORD8 *)p)[0] = (ORD8)(o32 >> 8);
+ ((ORD8 *)p)[1] = (ORD8)(o32);
+ return 0;
}
/* ---------------------------------------------------------- */
@@ -832,56 +827,56 @@ static int write_DCS16Number(double d, char *p) {
/* Note - returned buffers are static, can only be used 5 */
/* times before buffers get reused. */
char *tag2str(
- int tag
-) {
- int i;
- static int si = 0; /* String buffer index */
- static char buf[5][20]; /* String buffers */
- char *bp;
- unsigned char c[4];
-
- bp = buf[si++];
- si %= 5; /* Rotate through buffers */
-
- c[0] = 0xff & (tag >> 24);
- c[1] = 0xff & (tag >> 16);
- c[2] = 0xff & (tag >> 8);
- c[3] = 0xff & (tag >> 0);
- for (i = 0; i < 4; i++) { /* Can we represent it as a string ? */
- if (!isprint(c[i]))
- break;
- }
- if (i < 4) { /* Not printable - use hex */
- sprintf(bp,"0x%x",tag);
- } else { /* Printable */
- sprintf(bp,"'%c%c%c%c'",c[0],c[1],c[2],c[3]);
- }
- return bp;
+ int tag
+) {
+ int i;
+ static int si = 0; /* String buffer index */
+ static char buf[5][20]; /* String buffers */
+ char *bp;
+ unsigned char c[4];
+
+ bp = buf[si++];
+ si %= 5; /* Rotate through buffers */
+
+ c[0] = 0xff & (tag >> 24);
+ c[1] = 0xff & (tag >> 16);
+ c[2] = 0xff & (tag >> 8);
+ c[3] = 0xff & (tag >> 0);
+ for (i = 0; i < 4; i++) { /* Can we represent it as a string ? */
+ if (!isprint(c[i]))
+ break;
+ }
+ if (i < 4) { /* Not printable - use hex */
+ sprintf(bp,"0x%x",tag);
+ } else { /* Printable */
+ sprintf(bp,"'%c%c%c%c'",c[0],c[1],c[2],c[3]);
+ }
+ return bp;
}
/* Auiliary function - return a tag created from a string */
int str2tag(
- const char *str
+ const char *str
) {
- unsigned long tag;
- tag = (((unsigned long)str[0]) << 24)
- + (((unsigned long)str[1]) << 16)
- + (((unsigned long)str[2]) << 8)
- + (((unsigned long)str[3]));
- return (int)tag;
+ unsigned long tag;
+ tag = (((unsigned long)str[0]) << 24)
+ + (((unsigned long)str[1]) << 16)
+ + (((unsigned long)str[2]) << 8)
+ + (((unsigned long)str[3]));
+ return (int)tag;
}
/* helper - return 1 if the string doesn't have a */
/* null terminator, return 0 if it does. */
/* Note: will return 1 if len == 0 */
static int check_null_string(char *cp, int len) {
- for (; len > 0; len--) {
- if (*cp++ == '\000')
- break;
- }
- if (len == 0)
- return 1;
- return 0;
+ for (; len > 0; len--) {
+ if (*cp++ == '\000')
+ break;
+ }
+ if (len == 0)
+ return 1;
+ return 0;
}
/* helper - return 1 if the string doesn't have a */
@@ -889,77 +884,77 @@ static int check_null_string(char *cp, int len) {
/* Note: will return 1 if len == 0 */
/* Unicode version */
static int check_null_string16(char *cp, int len) {
- for (; len > 0; len--) { /* Length is in characters */
- if (cp[0] == 0 && cp[1] == 0)
- break;
- cp += 2;
- }
- if (len == 0)
- return 1;
- return 0;
+ for (; len > 0; len--) { /* Length is in characters */
+ if (cp[0] == 0 && cp[1] == 0)
+ break;
+ cp += 2;
+ }
+ if (len == 0)
+ return 1;
+ return 0;
}
/* Color Space to number of component conversion */
/* Return 0 on error */
static unsigned int number_ColorSpaceSignature(icColorSpaceSignature sig) {
- switch(sig) {
- case icSigXYZData:
- return 3;
- case icSigLabData:
- return 3;
- case icSigLuvData:
- return 3;
- case icSigYCbCrData:
- return 3;
- case icSigYxyData:
- return 3;
- case icSigRgbData:
- return 3;
- case icSigGrayData:
- return 1;
- case icSigHsvData:
- return 3;
- case icSigHlsData:
- return 3;
- case icSigCmykData:
- return 4;
- case icSigCmyData:
- return 3;
- case icSig2colorData:
- return 2;
- case icSig3colorData:
- return 3;
- case icSig4colorData:
- return 4;
- case icSig5colorData:
- case icSigMch5Data:
- return 5;
- case icSig6colorData:
- case icSigMch6Data:
- return 6;
- case icSig7colorData:
- case icSigMch7Data:
- return 7;
- case icSig8colorData:
- case icSigMch8Data:
- return 8;
- case icSig9colorData:
- return 9;
- case icSig10colorData:
- return 10;
- case icSig11colorData:
- return 11;
- case icSig12colorData:
- return 12;
- case icSig13colorData:
- return 13;
- case icSig14colorData:
- return 14;
- case icSig15colorData:
- return 15;
- default:
- return 0;
- }
+ switch(sig) {
+ case icSigXYZData:
+ return 3;
+ case icSigLabData:
+ return 3;
+ case icSigLuvData:
+ return 3;
+ case icSigYCbCrData:
+ return 3;
+ case icSigYxyData:
+ return 3;
+ case icSigRgbData:
+ return 3;
+ case icSigGrayData:
+ return 1;
+ case icSigHsvData:
+ return 3;
+ case icSigHlsData:
+ return 3;
+ case icSigCmykData:
+ return 4;
+ case icSigCmyData:
+ return 3;
+ case icSig2colorData:
+ return 2;
+ case icSig3colorData:
+ return 3;
+ case icSig4colorData:
+ return 4;
+ case icSig5colorData:
+ case icSigMch5Data:
+ return 5;
+ case icSig6colorData:
+ case icSigMch6Data:
+ return 6;
+ case icSig7colorData:
+ case icSigMch7Data:
+ return 7;
+ case icSig8colorData:
+ case icSigMch8Data:
+ return 8;
+ case icSig9colorData:
+ return 9;
+ case icSig10colorData:
+ return 10;
+ case icSig11colorData:
+ return 11;
+ case icSig12colorData:
+ return 12;
+ case icSig13colorData:
+ return 13;
+ case icSig14colorData:
+ return 14;
+ case icSig15colorData:
+ return 15;
+ default:
+ return 0;
+ }
}
/* ------------------------------------------------------- */
@@ -969,96 +964,95 @@ static unsigned int number_ColorSpaceSignature(icColorSpaceSignature sig) {
/* Screening Encodings */
static char *string_ScreenEncodings(unsigned long flags) {
- static int si = 0; /* String buffer index */
- static char buf[5][80]; /* String buffers */
- char *bp, *cp;
+ static int si = 0; /* String buffer index */
+ static char buf[5][80]; /* String buffers */
+ char *bp, *cp;
- cp = bp = buf[si++];
- si %= 5; /* Rotate through buffers */
+ cp = bp = buf[si++];
+ si %= 5; /* Rotate through buffers */
- if (flags & icPrtrDefaultScreensTrue) {
- sprintf(cp,"Default Screen");
- } else {
- sprintf(cp,"No Default Screen");
- }
- cp = cp + strlen(cp);
- if (flags & icLinesPerInch) {
- sprintf(cp,", Lines Per Inch");
- } else {
- sprintf(cp,", Lines Per cm");
- }
- cp = cp + strlen(cp);
+ if (flags & icPrtrDefaultScreensTrue) {
+ sprintf(cp,"Default Screen");
+ } else {
+ sprintf(cp,"No Default Screen");
+ }
+ cp = cp + strlen(cp);
+ if (flags & icLinesPerInch) {
+ sprintf(cp,", Lines Per Inch");
+ } else {
+ sprintf(cp,", Lines Per cm");
+ }
+ cp = cp + strlen(cp);
- return bp;
+ return bp;
}
/* Device attributes */
static char *string_DeviceAttributes(unsigned long flags) {
- static int si = 0; /* String buffer index */
- static char buf[5][80]; /* String buffers */
- char *bp, *cp;
+ static int si = 0; /* String buffer index */
+ static char buf[5][80]; /* String buffers */
+ char *bp, *cp;
- cp = bp = buf[si++];
- si %= 5; /* Rotate through buffers */
+ cp = bp = buf[si++];
+ si %= 5; /* Rotate through buffers */
- if (flags & icTransparency) {
- sprintf(cp,"Transparency");
- } else {
- sprintf(cp,"Reflective");
- }
- cp = cp + strlen(cp);
- if (flags & icMatte) {
- sprintf(cp,", Matte");
- } else {
- sprintf(cp,", Glossy");
- }
- cp = cp + strlen(cp);
+ if (flags & icTransparency) {
+ sprintf(cp,"Transparency");
+ } else {
+ sprintf(cp,"Reflective");
+ }
+ cp = cp + strlen(cp);
+ if (flags & icMatte) {
+ sprintf(cp,", Matte");
+ } else {
+ sprintf(cp,", Glossy");
+ }
+ cp = cp + strlen(cp);
- return bp;
+ return bp;
}
/* Profile header flags */
static char *string_ProfileHeaderFlags(unsigned long flags) {
- static int si = 0; /* String buffer index */
- static char buf[5][80]; /* String buffers */
- char *bp, *cp;
+ static int si = 0; /* String buffer index */
+ static char buf[5][80]; /* String buffers */
+ char *bp, *cp;
- cp = bp = buf[si++];
- si %= 5; /* Rotate through buffers */
+ cp = bp = buf[si++];
+ si %= 5; /* Rotate through buffers */
- if (flags & icEmbeddedProfileTrue) {
- sprintf(cp,"Embedded Profile");
- } else {
- sprintf(cp,"Not Embedded Profile");
- }
- cp = cp + strlen(cp);
- if (flags & icUseWithEmbeddedDataOnly) {
- sprintf(cp,", Use with embedded data only");
- } else {
- sprintf(cp,", Use anywhere");
- }
- cp = cp + strlen(cp);
+ if (flags & icEmbeddedProfileTrue) {
+ sprintf(cp,"Embedded Profile");
+ } else {
+ sprintf(cp,"Not Embedded Profile");
+ }
+ cp = cp + strlen(cp);
+ if (flags & icUseWithEmbeddedDataOnly) {
+ sprintf(cp,", Use with embedded data only");
+ } else {
+ sprintf(cp,", Use anywhere");
+ }
+ cp = cp + strlen(cp);
- return bp;
+ return bp;
}
-
static char *string_AsciiOrBinaryData(unsigned long flags) {
- static int si = 0; /* String buffer index */
- static char buf[5][80]; /* String buffers */
- char *bp, *cp;
+ static int si = 0; /* String buffer index */
+ static char buf[5][80]; /* String buffers */
+ char *bp, *cp;
- cp = bp = buf[si++];
- si %= 5; /* Rotate through buffers */
+ cp = bp = buf[si++];
+ si %= 5; /* Rotate through buffers */
- if (flags & icBinaryData) {
- sprintf(cp,"Binary");
- } else {
- sprintf(cp,"Ascii");
- }
- cp = cp + strlen(cp);
+ if (flags & icBinaryData) {
+ sprintf(cp,"Binary");
+ } else {
+ sprintf(cp,"Ascii");
+ }
+ cp = cp + strlen(cp);
- return bp;
+ return bp;
}
/* ------------------------------------------------------------ */
@@ -1068,495 +1062,494 @@ static char *string_AsciiOrBinaryData(unsigned long flags) {
/* public tags and sizes */
static const char *string_TagSignature(icTagSignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigAToB0Tag:
- return "AToB0 Multidimentional Transform";
- case icSigAToB1Tag:
- return "AToB1 Multidimentional Transform";
- case icSigAToB2Tag:
- return "AToB2 Multidimentional Transform";
- case icSigBlueColorantTag:
- return "Blue Colorant";
- case icSigBlueTRCTag:
- return "Blue Tone Reproduction Curve";
- case icSigBToA0Tag:
- return "BToA0 Multidimentional Transform";
- case icSigBToA1Tag:
- return "BToA1 Multidimentional Transform";
- case icSigBToA2Tag:
- return "BToA2 Multidimentional Transform";
- case icSigCalibrationDateTimeTag:
- return "Calibration Date & Time";
- case icSigCharTargetTag:
- return "Characterization Target";
- case icSigCopyrightTag:
- return "Copyright";
- case icSigCrdInfoTag:
- return "CRD Info";
- case icSigDeviceMfgDescTag:
- return "Device Manufacturer Description";
- case icSigDeviceModelDescTag:
- return "Device Model Description";
- case icSigGamutTag:
- return "Gamut";
- case icSigGrayTRCTag:
- return "Gray Tone Reproduction Curve";
- case icSigGreenColorantTag:
- return "Green Colorant";
- case icSigGreenTRCTag:
- return "Green Tone Reproduction Curve";
- case icSigLuminanceTag:
- return "Luminance";
- case icSigMeasurementTag:
- return "Measurement";
- case icSigMediaBlackPointTag:
- return "Media Black Point";
- case icSigMediaWhitePointTag:
- return "Media White Point";
- case icSigNamedColorTag:
- return "Named Color";
- case icSigNamedColor2Tag:
- return "Named Color 2";
- case icSigPreview0Tag:
- return "Preview0";
- case icSigPreview1Tag:
- return "Preview1";
- case icSigPreview2Tag:
- return "Preview2";
- case icSigProfileDescriptionTag:
- return "Profile Description";
- case icSigProfileSequenceDescTag:
- return "Profile Sequence";
- case icSigPs2CRD0Tag:
- return "PS Level 2 CRD perceptual";
- case icSigPs2CRD1Tag:
- return "PS Level 2 CRD colorimetric";
- case icSigPs2CRD2Tag:
- return "PS Level 2 CRD saturation";
- case icSigPs2CRD3Tag:
- return "PS Level 2 CRD absolute";
- case icSigPs2CSATag:
- return "PS Level 2 color space array";
- case icSigPs2RenderingIntentTag:
- return "PS Level 2 Rendering Intent";
- case icSigRedColorantTag:
- return "Red Colorant";
- case icSigRedTRCTag:
- return "Red Tone Reproduction Curve";
- case icSigScreeningDescTag:
- return "Screening Description";
- case icSigScreeningTag:
- return "Screening Attributes";
- case icSigTechnologyTag:
- return "Device Technology";
- case icSigUcrBgTag:
- return "Under Color Removal & Black Generation";
- case icSigVideoCardGammaTag:
- return "Video Card Gamma Curve";
- case icSigViewingCondDescTag:
- return "Viewing Condition Description";
- case icSigViewingConditionsTag:
- return "Viewing Condition Paramaters";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigAToB0Tag:
+ return "AToB0 Multidimentional Transform";
+ case icSigAToB1Tag:
+ return "AToB1 Multidimentional Transform";
+ case icSigAToB2Tag:
+ return "AToB2 Multidimentional Transform";
+ case icSigBlueColorantTag:
+ return "Blue Colorant";
+ case icSigBlueTRCTag:
+ return "Blue Tone Reproduction Curve";
+ case icSigBToA0Tag:
+ return "BToA0 Multidimentional Transform";
+ case icSigBToA1Tag:
+ return "BToA1 Multidimentional Transform";
+ case icSigBToA2Tag:
+ return "BToA2 Multidimentional Transform";
+ case icSigCalibrationDateTimeTag:
+ return "Calibration Date & Time";
+ case icSigCharTargetTag:
+ return "Characterization Target";
+ case icSigCopyrightTag:
+ return "Copyright";
+ case icSigCrdInfoTag:
+ return "CRD Info";
+ case icSigDeviceMfgDescTag:
+ return "Device Manufacturer Description";
+ case icSigDeviceModelDescTag:
+ return "Device Model Description";
+ case icSigGamutTag:
+ return "Gamut";
+ case icSigGrayTRCTag:
+ return "Gray Tone Reproduction Curve";
+ case icSigGreenColorantTag:
+ return "Green Colorant";
+ case icSigGreenTRCTag:
+ return "Green Tone Reproduction Curve";
+ case icSigLuminanceTag:
+ return "Luminance";
+ case icSigMeasurementTag:
+ return "Measurement";
+ case icSigMediaBlackPointTag:
+ return "Media Black Point";
+ case icSigMediaWhitePointTag:
+ return "Media White Point";
+ case icSigNamedColorTag:
+ return "Named Color";
+ case icSigNamedColor2Tag:
+ return "Named Color 2";
+ case icSigPreview0Tag:
+ return "Preview0";
+ case icSigPreview1Tag:
+ return "Preview1";
+ case icSigPreview2Tag:
+ return "Preview2";
+ case icSigProfileDescriptionTag:
+ return "Profile Description";
+ case icSigProfileSequenceDescTag:
+ return "Profile Sequence";
+ case icSigPs2CRD0Tag:
+ return "PS Level 2 CRD perceptual";
+ case icSigPs2CRD1Tag:
+ return "PS Level 2 CRD colorimetric";
+ case icSigPs2CRD2Tag:
+ return "PS Level 2 CRD saturation";
+ case icSigPs2CRD3Tag:
+ return "PS Level 2 CRD absolute";
+ case icSigPs2CSATag:
+ return "PS Level 2 color space array";
+ case icSigPs2RenderingIntentTag:
+ return "PS Level 2 Rendering Intent";
+ case icSigRedColorantTag:
+ return "Red Colorant";
+ case icSigRedTRCTag:
+ return "Red Tone Reproduction Curve";
+ case icSigScreeningDescTag:
+ return "Screening Description";
+ case icSigScreeningTag:
+ return "Screening Attributes";
+ case icSigTechnologyTag:
+ return "Device Technology";
+ case icSigUcrBgTag:
+ return "Under Color Removal & Black Generation";
+ case icSigVideoCardGammaTag:
+ return "Video Card Gamma Curve";
+ case icSigViewingCondDescTag:
+ return "Viewing Condition Description";
+ case icSigViewingConditionsTag:
+ return "Viewing Condition Paramaters";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
/* technology signature descriptions */
static const char *string_TechnologySignature(icTechnologySignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigDigitalCamera:
- return "Digital Camera";
- case icSigFilmScanner:
- return "Film Scanner";
- case icSigReflectiveScanner:
- return "Reflective Scanner";
- case icSigInkJetPrinter:
- return "InkJet Printer";
- case icSigThermalWaxPrinter:
- return "Thermal WaxPrinter";
- case icSigElectrophotographicPrinter:
- return "Electrophotographic Printer";
- case icSigElectrostaticPrinter:
- return "Electrostatic Printer";
- case icSigDyeSublimationPrinter:
- return "DyeSublimation Printer";
- case icSigPhotographicPaperPrinter:
- return "Photographic Paper Printer";
- case icSigFilmWriter:
- return "Film Writer";
- case icSigVideoMonitor:
- return "Video Monitor";
- case icSigVideoCamera:
- return "Video Camera";
- case icSigProjectionTelevision:
- return "Projection Television";
- case icSigCRTDisplay:
- return "Cathode Ray Tube Display";
- case icSigPMDisplay:
- return "Passive Matrix Display";
- case icSigAMDisplay:
- return "Active Matrix Display";
- case icSigPhotoCD:
- return "Photo CD";
- case icSigPhotoImageSetter:
- return "Photo ImageSetter";
- case icSigGravure:
- return "Gravure";
- case icSigOffsetLithography:
- return "Offset Lithography";
- case icSigSilkscreen:
- return "Silkscreen";
- case icSigFlexography:
- return "Flexography";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigDigitalCamera:
+ return "Digital Camera";
+ case icSigFilmScanner:
+ return "Film Scanner";
+ case icSigReflectiveScanner:
+ return "Reflective Scanner";
+ case icSigInkJetPrinter:
+ return "InkJet Printer";
+ case icSigThermalWaxPrinter:
+ return "Thermal WaxPrinter";
+ case icSigElectrophotographicPrinter:
+ return "Electrophotographic Printer";
+ case icSigElectrostaticPrinter:
+ return "Electrostatic Printer";
+ case icSigDyeSublimationPrinter:
+ return "DyeSublimation Printer";
+ case icSigPhotographicPaperPrinter:
+ return "Photographic Paper Printer";
+ case icSigFilmWriter:
+ return "Film Writer";
+ case icSigVideoMonitor:
+ return "Video Monitor";
+ case icSigVideoCamera:
+ return "Video Camera";
+ case icSigProjectionTelevision:
+ return "Projection Television";
+ case icSigCRTDisplay:
+ return "Cathode Ray Tube Display";
+ case icSigPMDisplay:
+ return "Passive Matrix Display";
+ case icSigAMDisplay:
+ return "Active Matrix Display";
+ case icSigPhotoCD:
+ return "Photo CD";
+ case icSigPhotoImageSetter:
+ return "Photo ImageSetter";
+ case icSigGravure:
+ return "Gravure";
+ case icSigOffsetLithography:
+ return "Offset Lithography";
+ case icSigSilkscreen:
+ return "Silkscreen";
+ case icSigFlexography:
+ return "Flexography";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
/* type signatures */
static const char *string_TypeSignature(icTagTypeSignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigCurveType:
- return "Curve";
- case icSigDataType:
- return "Data";
- case icSigDateTimeType:
- return "DateTime";
- case icSigLut16Type:
- return "Lut16";
- case icSigLut8Type:
- return "Lut8";
- case icSigMeasurementType:
- return "Measurement";
- case icSigNamedColorType:
- return "Named Color";
- case icSigProfileSequenceDescType:
- return "Profile Sequence Desc";
- case icSigS15Fixed16ArrayType:
- return "S15Fixed16 Array";
- case icSigScreeningType:
- return "Screening";
- case icSigSignatureType:
- return "Signature";
- case icSigTextType:
- return "Text";
- case icSigTextDescriptionType:
- return "Text Description";
- case icSigU16Fixed16ArrayType:
- return "U16Fixed16 Array";
- case icSigUcrBgType:
- return "Under Color Removal & Black Generation";
- case icSigUInt16ArrayType:
- return "UInt16 Array";
- case icSigUInt32ArrayType:
- return "UInt32 Array";
- case icSigUInt64ArrayType:
- return "UInt64 Array";
- case icSigUInt8ArrayType:
- return "UInt8 Array";
- case icSigVideoCardGammaType:
- return "Video Card Gamma";
- case icSigViewingConditionsType:
- return "Viewing Conditions";
- case icSigXYZType:
- return "XYZ (Array?)";
- case icSigNamedColor2Type:
- return "Named Color 2";
- case icSigCrdInfoType:
- return "CRD Info";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigCurveType:
+ return "Curve";
+ case icSigDataType:
+ return "Data";
+ case icSigDateTimeType:
+ return "DateTime";
+ case icSigLut16Type:
+ return "Lut16";
+ case icSigLut8Type:
+ return "Lut8";
+ case icSigMeasurementType:
+ return "Measurement";
+ case icSigNamedColorType:
+ return "Named Color";
+ case icSigProfileSequenceDescType:
+ return "Profile Sequence Desc";
+ case icSigS15Fixed16ArrayType:
+ return "S15Fixed16 Array";
+ case icSigScreeningType:
+ return "Screening";
+ case icSigSignatureType:
+ return "Signature";
+ case icSigTextType:
+ return "Text";
+ case icSigTextDescriptionType:
+ return "Text Description";
+ case icSigU16Fixed16ArrayType:
+ return "U16Fixed16 Array";
+ case icSigUcrBgType:
+ return "Under Color Removal & Black Generation";
+ case icSigUInt16ArrayType:
+ return "UInt16 Array";
+ case icSigUInt32ArrayType:
+ return "UInt32 Array";
+ case icSigUInt64ArrayType:
+ return "UInt64 Array";
+ case icSigUInt8ArrayType:
+ return "UInt8 Array";
+ case icSigVideoCardGammaType:
+ return "Video Card Gamma";
+ case icSigViewingConditionsType:
+ return "Viewing Conditions";
+ case icSigXYZType:
+ return "XYZ (Array?)";
+ case icSigNamedColor2Type:
+ return "Named Color 2";
+ case icSigCrdInfoType:
+ return "CRD Info";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
/* Color Space Signatures */
static const char *string_ColorSpaceSignature(icColorSpaceSignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigXYZData:
- return "XYZ";
- case icSigLabData:
- return "Lab";
- case icSigLuvData:
- return "Luv";
- case icSigYCbCrData:
- return "YCbCr";
- case icSigYxyData:
- return "Yxy";
- case icSigRgbData:
- return "RGB";
- case icSigGrayData:
- return "Gray";
- case icSigHsvData:
- return "HSV";
- case icSigHlsData:
- return "HLS";
- case icSigCmykData:
- return "CMYK";
- case icSigCmyData:
- return "CMY";
- case icSig2colorData:
- return "2 Color";
- case icSig3colorData:
- return "3 Color";
- case icSig4colorData:
- return "4 Color";
- case icSig5colorData:
- case icSigMch5Data:
- return "5 Color";
- case icSig6colorData:
- case icSigMch6Data:
- return "6 Color";
- case icSig7colorData:
- case icSigMch7Data:
- return "7 Color";
- case icSig8colorData:
- case icSigMch8Data:
- return "8 Color";
- case icSig9colorData:
- return "9 Color";
- case icSig10colorData:
- return "10 Color";
- case icSig11colorData:
- return "11 Color";
- case icSig12colorData:
- return "12 Color";
- case icSig13colorData:
- return "13 Color";
- case icSig14colorData:
- return "14 Color";
- case icSig15colorData:
- return "15 Color";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigXYZData:
+ return "XYZ";
+ case icSigLabData:
+ return "Lab";
+ case icSigLuvData:
+ return "Luv";
+ case icSigYCbCrData:
+ return "YCbCr";
+ case icSigYxyData:
+ return "Yxy";
+ case icSigRgbData:
+ return "RGB";
+ case icSigGrayData:
+ return "Gray";
+ case icSigHsvData:
+ return "HSV";
+ case icSigHlsData:
+ return "HLS";
+ case icSigCmykData:
+ return "CMYK";
+ case icSigCmyData:
+ return "CMY";
+ case icSig2colorData:
+ return "2 Color";
+ case icSig3colorData:
+ return "3 Color";
+ case icSig4colorData:
+ return "4 Color";
+ case icSig5colorData:
+ case icSigMch5Data:
+ return "5 Color";
+ case icSig6colorData:
+ case icSigMch6Data:
+ return "6 Color";
+ case icSig7colorData:
+ case icSigMch7Data:
+ return "7 Color";
+ case icSig8colorData:
+ case icSigMch8Data:
+ return "8 Color";
+ case icSig9colorData:
+ return "9 Color";
+ case icSig10colorData:
+ return "10 Color";
+ case icSig11colorData:
+ return "11 Color";
+ case icSig12colorData:
+ return "12 Color";
+ case icSig13colorData:
+ return "13 Color";
+ case icSig14colorData:
+ return "14 Color";
+ case icSig15colorData:
+ return "15 Color";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
#ifdef NEVER
/* Public version of above */
char *ColorSpaceSignature2str(icColorSpaceSignature sig) {
- return string_ColorSpaceSignature(sig);
+ return string_ColorSpaceSignature(sig);
}
#endif
-
/* profileClass enumerations */
static const char *string_ProfileClassSignature(icProfileClassSignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigInputClass:
- return "Input";
- case icSigDisplayClass:
- return "Display";
- case icSigOutputClass:
- return "Output";
- case icSigLinkClass:
- return "Link";
- case icSigAbstractClass:
- return "Abstract";
- case icSigColorSpaceClass:
- return "Color Space";
- case icSigNamedColorClass:
- return "Named Color";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigInputClass:
+ return "Input";
+ case icSigDisplayClass:
+ return "Display";
+ case icSigOutputClass:
+ return "Output";
+ case icSigLinkClass:
+ return "Link";
+ case icSigAbstractClass:
+ return "Abstract";
+ case icSigColorSpaceClass:
+ return "Color Space";
+ case icSigNamedColorClass:
+ return "Named Color";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
/* Platform Signatures */
static const char *string_PlatformSignature(icPlatformSignature sig) {
- static char buf[80];
- switch(sig) {
- case icSigMacintosh:
- return "Macintosh";
- case icSigMicrosoft:
- return "Microsoft";
- case icSigSolaris:
- return "Solaris";
- case icSigSGI:
- return "SGI";
- case icSigTaligent:
- return "Taligent";
- default:
- sprintf(buf,"Unrecognized - %s",tag2str(sig));
- return buf;
- }
+ static char buf[80];
+ switch(sig) {
+ case icSigMacintosh:
+ return "Macintosh";
+ case icSigMicrosoft:
+ return "Microsoft";
+ case icSigSolaris:
+ return "Solaris";
+ case icSigSGI:
+ return "SGI";
+ case icSigTaligent:
+ return "Taligent";
+ default:
+ sprintf(buf,"Unrecognized - %s",tag2str(sig));
+ return buf;
+ }
}
/* Measurement Geometry, used in the measurmentType tag */
static const char *string_MeasurementGeometry(icMeasurementGeometry sig) {
- static char buf[30];
- switch(sig) {
- case icGeometryUnknown:
- return "Unknown";
- case icGeometry045or450:
- return "0/45 or 45/0";
- case icGeometry0dord0:
- return "0/d or d/0";
- default:
- sprintf(buf,"Unrecognized - 0x%x",sig);
- return buf;
- }
+ static char buf[30];
+ switch(sig) {
+ case icGeometryUnknown:
+ return "Unknown";
+ case icGeometry045or450:
+ return "0/45 or 45/0";
+ case icGeometry0dord0:
+ return "0/d or d/0";
+ default:
+ sprintf(buf,"Unrecognized - 0x%x",sig);
+ return buf;
+ }
}
/* Rendering Intents, used in the profile header */
static const char *string_RenderingIntent(icRenderingIntent sig) {
- static char buf[30];
- switch(sig) {
- case icPerceptual:
- return "Perceptual";
- case icRelativeColorimetric:
- return "Relative Colorimetric";
- case icSaturation:
- return "Saturation";
- case icAbsoluteColorimetric:
- return "Absolute Colorimetric";
- default:
- sprintf(buf,"Unrecognized - 0x%x",sig);
- return buf;
- }
+ static char buf[30];
+ switch(sig) {
+ case icPerceptual:
+ return "Perceptual";
+ case icRelativeColorimetric:
+ return "Relative Colorimetric";
+ case icSaturation:
+ return "Saturation";
+ case icAbsoluteColorimetric:
+ return "Absolute Colorimetric";
+ default:
+ sprintf(buf,"Unrecognized - 0x%x",sig);
+ return buf;
+ }
}
/* Different Spot Shapes currently defined, used for screeningType */
static const char *string_SpotShape(icSpotShape sig) {
- static char buf[30];
- switch(sig) {
- case icSpotShapeUnknown:
- return "Unknown";
- case icSpotShapePrinterDefault:
- return "Printer Default";
- case icSpotShapeRound:
- return "Round";
- case icSpotShapeDiamond:
- return "Diamond";
- case icSpotShapeEllipse:
- return "Ellipse";
- case icSpotShapeLine:
- return "Line";
- case icSpotShapeSquare:
- return "Square";
- case icSpotShapeCross:
- return "Cross";
- default:
- sprintf(buf,"Unrecognized - 0x%x",sig);
- return buf;
- }
+ static char buf[30];
+ switch(sig) {
+ case icSpotShapeUnknown:
+ return "Unknown";
+ case icSpotShapePrinterDefault:
+ return "Printer Default";
+ case icSpotShapeRound:
+ return "Round";
+ case icSpotShapeDiamond:
+ return "Diamond";
+ case icSpotShapeEllipse:
+ return "Ellipse";
+ case icSpotShapeLine:
+ return "Line";
+ case icSpotShapeSquare:
+ return "Square";
+ case icSpotShapeCross:
+ return "Cross";
+ default:
+ sprintf(buf,"Unrecognized - 0x%x",sig);
+ return buf;
+ }
}
/* Standard Observer, used in the measurmentType tag */
static const char *string_StandardObserver(icStandardObserver sig) {
- static char buf[30];
- switch(sig) {
- case icStdObsUnknown:
- return "Unknown";
- case icStdObs1931TwoDegrees:
- return "1931 Two Degrees";
- case icStdObs1964TenDegrees:
- return "1964 Ten Degrees";
- default:
- sprintf(buf,"Unrecognized - 0x%x",sig);
- return buf;
- }
+ static char buf[30];
+ switch(sig) {
+ case icStdObsUnknown:
+ return "Unknown";
+ case icStdObs1931TwoDegrees:
+ return "1931 Two Degrees";
+ case icStdObs1964TenDegrees:
+ return "1964 Ten Degrees";
+ default:
+ sprintf(buf,"Unrecognized - 0x%x",sig);
+ return buf;
+ }
}
/* Pre-defined illuminants, used in measurement and viewing conditions type */
static const char *string_Illuminant(icIlluminant sig) {
- static char buf[30];
- switch(sig) {
- case icIlluminantUnknown:
- return "Unknown";
- case icIlluminantD50:
- return "D50";
- case icIlluminantD65:
- return "D65";
- case icIlluminantD93:
- return "D93";
- case icIlluminantF2:
- return "F2";
- case icIlluminantD55:
- return "D55";
- case icIlluminantA:
- return "A";
- case icIlluminantEquiPowerE:
- return "Equi-Power(E)";
- case icIlluminantF8:
- return "F8";
- default:
- sprintf(buf,"Unrecognized - 0x%x",sig);
- return buf;
- }
+ static char buf[30];
+ switch(sig) {
+ case icIlluminantUnknown:
+ return "Unknown";
+ case icIlluminantD50:
+ return "D50";
+ case icIlluminantD65:
+ return "D65";
+ case icIlluminantD93:
+ return "D93";
+ case icIlluminantF2:
+ return "F2";
+ case icIlluminantD55:
+ return "D55";
+ case icIlluminantA:
+ return "A";
+ case icIlluminantEquiPowerE:
+ return "Equi-Power(E)";
+ case icIlluminantF8:
+ return "F8";
+ default:
+ sprintf(buf,"Unrecognized - 0x%x",sig);
+ return buf;
+ }
}
/* Return a text abreviation of a color lookup algorithm */
static const char *string_LuAlg(icmLuAlgType alg) {
- static char buf[80];
-
- switch(alg) {
- case icmMonoFwdType:
- return "MonoFwd";
- case icmMonoBwdType:
- return "MonoBwd";
- case icmMatrixFwdType:
- return "MatrixFwd";
- case icmMatrixBwdType:
- return "MatrixBwd";
- case icmLutType:
- return "Lut";
- default:
- sprintf(buf,"Unrecognized - %d",alg);
- return buf;
- }
+ static char buf[80];
+
+ switch(alg) {
+ case icmMonoFwdType:
+ return "MonoFwd";
+ case icmMonoBwdType:
+ return "MonoBwd";
+ case icmMatrixFwdType:
+ return "MatrixFwd";
+ case icmMatrixBwdType:
+ return "MatrixBwd";
+ case icmLutType:
+ return "Lut";
+ default:
+ sprintf(buf,"Unrecognized - %d",alg);
+ return buf;
+ }
}
/* Return a string description of the given enumeration value */
/* Public: */
const char *icm2str(icmEnumType etype, int enumval) {
- switch(etype) {
- case icmScreenEncodings:
- return string_ScreenEncodings((unsigned long) enumval);
- case icmDeviceAttributes:
- return string_DeviceAttributes((unsigned long) enumval);
- case icmProfileHeaderFlags:
- return string_ProfileHeaderFlags((unsigned long) enumval);
- case icmAsciiOrBinaryData:
- return string_AsciiOrBinaryData((unsigned long) enumval);
- case icmTagSignature:
- return string_TagSignature((icTagSignature) enumval);
- case icmTechnologySignature:
- return string_TechnologySignature((icTechnologySignature) enumval);
- case icmTypeSignature:
- return string_TypeSignature((icTagTypeSignature) enumval);
- case icmColorSpaceSignature:
- return string_ColorSpaceSignature((icColorSpaceSignature) enumval);
- case icmProfileClassSignaure:
- return string_ProfileClassSignature((icProfileClassSignature) enumval);
- case icmPlatformSignature:
- return string_PlatformSignature((icPlatformSignature) enumval);
- case icmMeasurementGeometry:
- return string_MeasurementGeometry((icMeasurementGeometry) enumval);
- case icmRenderingIntent:
- return string_RenderingIntent((icRenderingIntent) enumval);
- case icmSpotShape:
- return string_SpotShape((icSpotShape) enumval);
- case icmStandardObserver:
- return string_StandardObserver((icStandardObserver) enumval);
- case icmIlluminant:
- return string_Illuminant((icIlluminant) enumval);
- case icmLuAlg:
- return string_LuAlg((icmLuAlgType) enumval);
- default:
- return "enum2str got unknown type";
- }
+ switch(etype) {
+ case icmScreenEncodings:
+ return string_ScreenEncodings((unsigned long) enumval);
+ case icmDeviceAttributes:
+ return string_DeviceAttributes((unsigned long) enumval);
+ case icmProfileHeaderFlags:
+ return string_ProfileHeaderFlags((unsigned long) enumval);
+ case icmAsciiOrBinaryData:
+ return string_AsciiOrBinaryData((unsigned long) enumval);
+ case icmTagSignature:
+ return string_TagSignature((icTagSignature) enumval);
+ case icmTechnologySignature:
+ return string_TechnologySignature((icTechnologySignature) enumval);
+ case icmTypeSignature:
+ return string_TypeSignature((icTagTypeSignature) enumval);
+ case icmColorSpaceSignature:
+ return string_ColorSpaceSignature((icColorSpaceSignature) enumval);
+ case icmProfileClassSignaure:
+ return string_ProfileClassSignature((icProfileClassSignature) enumval);
+ case icmPlatformSignature:
+ return string_PlatformSignature((icPlatformSignature) enumval);
+ case icmMeasurementGeometry:
+ return string_MeasurementGeometry((icMeasurementGeometry) enumval);
+ case icmRenderingIntent:
+ return string_RenderingIntent((icRenderingIntent) enumval);
+ case icmSpotShape:
+ return string_SpotShape((icSpotShape) enumval);
+ case icmStandardObserver:
+ return string_StandardObserver((icStandardObserver) enumval);
+ case icmIlluminant:
+ return string_Illuminant((icIlluminant) enumval);
+ case icmLuAlg:
+ return string_LuAlg((icmLuAlgType) enumval);
+ default:
+ return "enum2str got unknown type";
+ }
}
/* ========================================================== */
@@ -1566,188 +1559,188 @@ const char *icm2str(icmEnumType etype, int enumval) {
/* Return the number of bytes needed to write this tag */
static unsigned int icmUInt8Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += p->size * 1; /* 1 byte for each UInt8 */
- return len;
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += p->size * 1; /* 1 byte for each UInt8 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmUInt8Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmUInt8Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt8Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmUInt8Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/1; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- icp->al->free(icp->al, buf);
- sprintf(icp->err,"icmUInt8Array_read: Wrong tag type for icmUInt8Array");
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 1) {
- p->data[i] = read_UInt8Number(bp);
- }
- icp->al->free(p->icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmUInt8Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt8Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmUInt8Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/1; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ icp->al->free(icp->al, buf);
+ sprintf(icp->err,"icmUInt8Array_read: Wrong tag type for icmUInt8Array");
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 1) {
+ p->data[i] = read_UInt8Number(bp);
+ }
+ icp->al->free(p->icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmUInt8Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt8Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmUInt8Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- bp += 8; /* Skip padding */
-
- /* Write all the data to the buffer */
- for (i = 0; i < p->size; i++, bp += 1) {
- if ((rv = write_UInt8Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmUInt8Array_write: write_UInt8umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmUInt8Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt8Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmUInt8Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ bp += 8; /* Skip padding */
+
+ /* Write all the data to the buffer */
+ for (i = 0; i < p->size; i++, bp += 1) {
+ if ((rv = write_UInt8Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmUInt8Array_write: write_UInt8umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmUInt8Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmUInt8Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- if (verb <= 0)
- return;
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"UInt8Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: %u\n",i,p->data[i]);
- }
+ fprintf(op,"UInt8Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: %u\n",i,p->data[i]);
+ }
}
/* Allocate variable sized data elements */
static int icmUInt8Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- icc *icp = p->icp;
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
- sprintf(icp->err,"icmUInt8Array_alloc: calloc() of icmUInt8Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
+ sprintf(icp->err,"icmUInt8Array_alloc: calloc() of icmUInt8Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmUInt8Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt8Array *p = (icmUInt8Array *)pp;
- icc *icp = p->icp;
+ icmUInt8Array *p = (icmUInt8Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmUInt8Array(
- icc *icp
+ icc *icp
) {
- icmUInt8Array *p;
- if ((p = (icmUInt8Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt8Array))) == NULL)
- return NULL;
- p->ttype = icSigUInt8ArrayType;
- p->refcount = 1;
- p->get_size = icmUInt8Array_get_size;
- p->read = icmUInt8Array_read;
- p->write = icmUInt8Array_write;
- p->dump = icmUInt8Array_dump;
- p->allocate = icmUInt8Array_allocate;
- p->del = icmUInt8Array_delete;
- p->icp = icp;
+ icmUInt8Array *p;
+ if ((p = (icmUInt8Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt8Array))) == NULL)
+ return NULL;
+ p->ttype = icSigUInt8ArrayType;
+ p->refcount = 1;
+ p->get_size = icmUInt8Array_get_size;
+ p->read = icmUInt8Array_read;
+ p->write = icmUInt8Array_write;
+ p->dump = icmUInt8Array_dump;
+ p->allocate = icmUInt8Array_allocate;
+ p->del = icmUInt8Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -1755,192 +1748,192 @@ static icmBase *new_icmUInt8Array(
/* Return the number of bytes needed to write this tag */
static unsigned int icmUInt16Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 2) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->size * 2; /* 2 bytes for each UInt16 */
- return len;
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 2) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->size * 2; /* 2 bytes for each UInt16 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmUInt16Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmUInt16Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt16Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmUInt16Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/2; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmUInt16Array_read: Wrong tag type for icmUInt16Array");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 2) {
- p->data[i] = read_UInt16Number(bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmUInt16Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt16Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmUInt16Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/2; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmUInt16Array_read: Wrong tag type for icmUInt16Array");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 2) {
+ p->data[i] = read_UInt16Number(bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmUInt16Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt16Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmUInt16Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 2) {
- if ((rv = write_UInt16Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmUInt16Array_write: write_UInt16umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmUInt16Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt16Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmUInt16Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 2) {
+ if ((rv = write_UInt16Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmUInt16Array_write: write_UInt16umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmUInt16Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmUInt16Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- if (verb <= 0)
- return;
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"UInt16Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: %u\n",i,p->data[i]);
- }
+ fprintf(op,"UInt16Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: %u\n",i,p->data[i]);
+ }
}
/* Allocate variable sized data elements */
static int icmUInt16Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- icc *icp = p->icp;
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
- sprintf(icp->err,"icmUInt16Array_alloc: calloc() of icmUInt16Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
+ sprintf(icp->err,"icmUInt16Array_alloc: calloc() of icmUInt16Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmUInt16Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt16Array *p = (icmUInt16Array *)pp;
- icc *icp = p->icp;
+ icmUInt16Array *p = (icmUInt16Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmUInt16Array(
- icc *icp
+ icc *icp
) {
- icmUInt16Array *p;
- if ((p = (icmUInt16Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt16Array))) == NULL)
- return NULL;
- p->ttype = icSigUInt16ArrayType;
- p->refcount = 1;
- p->get_size = icmUInt16Array_get_size;
- p->read = icmUInt16Array_read;
- p->write = icmUInt16Array_write;
- p->dump = icmUInt16Array_dump;
- p->allocate = icmUInt16Array_allocate;
- p->del = icmUInt16Array_delete;
- p->icp = icp;
+ icmUInt16Array *p;
+ if ((p = (icmUInt16Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt16Array))) == NULL)
+ return NULL;
+ p->ttype = icSigUInt16ArrayType;
+ p->refcount = 1;
+ p->get_size = icmUInt16Array_get_size;
+ p->read = icmUInt16Array_read;
+ p->write = icmUInt16Array_write;
+ p->dump = icmUInt16Array_dump;
+ p->allocate = icmUInt16Array_allocate;
+ p->del = icmUInt16Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -1948,192 +1941,192 @@ static icmBase *new_icmUInt16Array(
/* Return the number of bytes needed to write this tag */
static unsigned int icmUInt32Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 4) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->size * 4; /* 4 bytes for each UInt32 */
- return len;
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 4) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->size * 4; /* 4 bytes for each UInt32 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmUInt32Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmUInt32Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt32Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmUInt32Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/4; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmUInt32Array_read: Wrong tag type for icmUInt32Array");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 4) {
- p->data[i] = read_UInt32Number(bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmUInt32Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt32Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmUInt32Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/4; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmUInt32Array_read: Wrong tag type for icmUInt32Array");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 4) {
+ p->data[i] = read_UInt32Number(bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmUInt32Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt32Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmUInt32Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 4) {
- if ((rv = write_UInt32Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmUInt32Array_write: write_UInt32umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmUInt32Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt32Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmUInt32Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 4) {
+ if ((rv = write_UInt32Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmUInt32Array_write: write_UInt32umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmUInt32Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmUInt32Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- if (verb <= 0)
- return;
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"UInt32Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: %u\n",i,p->data[i]);
- }
+ fprintf(op,"UInt32Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: %u\n",i,p->data[i]);
+ }
}
/* Allocate variable sized data elements */
static int icmUInt32Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- icc *icp = p->icp;
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
- sprintf(icp->err,"icmUInt32Array_alloc: calloc() of icmUInt32Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (unsigned int *) icp->al->calloc(icp->al, p->size, sizeof(unsigned int))) == NULL) {
+ sprintf(icp->err,"icmUInt32Array_alloc: calloc() of icmUInt32Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmUInt32Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt32Array *p = (icmUInt32Array *)pp;
- icc *icp = p->icp;
+ icmUInt32Array *p = (icmUInt32Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmUInt32Array(
- icc *icp
+ icc *icp
) {
- icmUInt32Array *p;
- if ((p = (icmUInt32Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt32Array))) == NULL)
- return NULL;
- p->ttype = icSigUInt32ArrayType;
- p->refcount = 1;
- p->get_size = icmUInt32Array_get_size;
- p->read = icmUInt32Array_read;
- p->write = icmUInt32Array_write;
- p->dump = icmUInt32Array_dump;
- p->allocate = icmUInt32Array_allocate;
- p->del = icmUInt32Array_delete;
- p->icp = icp;
+ icmUInt32Array *p;
+ if ((p = (icmUInt32Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt32Array))) == NULL)
+ return NULL;
+ p->ttype = icSigUInt32ArrayType;
+ p->refcount = 1;
+ p->get_size = icmUInt32Array_get_size;
+ p->read = icmUInt32Array_read;
+ p->write = icmUInt32Array_write;
+ p->dump = icmUInt32Array_dump;
+ p->allocate = icmUInt32Array_allocate;
+ p->del = icmUInt32Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -2141,192 +2134,192 @@ static icmBase *new_icmUInt32Array(
/* Return the number of bytes needed to write this tag */
static unsigned int icmUInt64Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 8) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->size * 8; /* 8 bytes for each UInt64 */
- return len;
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 8) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->size * 8; /* 8 bytes for each UInt64 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmUInt64Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmUInt64Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt64Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmUInt64Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/8; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmUInt64Array_read: Wrong tag type for icmUInt64Array");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 8) {
- read_UInt64Number(&p->data[i], bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmUInt64Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt64Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmUInt64Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/8; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmUInt64Array_read: Wrong tag type for icmUInt64Array");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 8) {
+ read_UInt64Number(&p->data[i], bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmUInt64Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUInt64Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmUInt64Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 8) {
- if ((rv = write_UInt64Number(&p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmUInt64Array_write: write_UInt64umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmUInt64Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUInt64Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmUInt64Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 8) {
+ if ((rv = write_UInt64Number(&p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmUInt64Array_write: write_UInt64umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmUInt64Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmUInt64Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- if (verb <= 0)
- return;
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"UInt64Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: h=%lu, l=%lu\n",i,p->data[i].h,p->data[i].l);
- }
+ fprintf(op,"UInt64Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: h=%lu, l=%lu\n",i,p->data[i].h,p->data[i].l);
+ }
}
/* Allocate variable sized data elements */
static int icmUInt64Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- icc *icp = p->icp;
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (icmUint64 *) icp->al->calloc(icp->al, p->size, sizeof(icmUint64))) == NULL) {
- sprintf(icp->err,"icmUInt64Array_alloc: calloc() of icmUInt64Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (icmUint64 *) icp->al->calloc(icp->al, p->size, sizeof(icmUint64))) == NULL) {
+ sprintf(icp->err,"icmUInt64Array_alloc: calloc() of icmUInt64Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmUInt64Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmUInt64Array *p = (icmUInt64Array *)pp;
- icc *icp = p->icp;
+ icmUInt64Array *p = (icmUInt64Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmUInt64Array(
- icc *icp
+ icc *icp
) {
- icmUInt64Array *p;
- if ((p = (icmUInt64Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt64Array))) == NULL)
- return NULL;
- p->ttype = icSigUInt64ArrayType;
- p->refcount = 1;
- p->get_size = icmUInt64Array_get_size;
- p->read = icmUInt64Array_read;
- p->write = icmUInt64Array_write;
- p->dump = icmUInt64Array_dump;
- p->allocate = icmUInt64Array_allocate;
- p->del = icmUInt64Array_delete;
- p->icp = icp;
+ icmUInt64Array *p;
+ if ((p = (icmUInt64Array *) icp->al->calloc(icp->al,1,sizeof(icmUInt64Array))) == NULL)
+ return NULL;
+ p->ttype = icSigUInt64ArrayType;
+ p->refcount = 1;
+ p->get_size = icmUInt64Array_get_size;
+ p->read = icmUInt64Array_read;
+ p->write = icmUInt64Array_write;
+ p->dump = icmUInt64Array_dump;
+ p->allocate = icmUInt64Array_allocate;
+ p->del = icmUInt64Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -2334,192 +2327,192 @@ static icmBase *new_icmUInt64Array(
/* Return the number of bytes needed to write this tag */
static unsigned int icmU16Fixed16Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 4) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->size * 4; /* 4 byte for each U16Fixed16 */
- return len;
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 4) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->size * 4; /* 4 byte for each U16Fixed16 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmU16Fixed16Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmU16Fixed16Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmU16Fixed16Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmU16Fixed16Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/4; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmU16Fixed16Array_read: Wrong tag type for icmU16Fixed16Array");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 4) {
- p->data[i] = read_U16Fixed16Number(bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmU16Fixed16Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmU16Fixed16Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmU16Fixed16Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/4; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmU16Fixed16Array_read: Wrong tag type for icmU16Fixed16Array");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 4) {
+ p->data[i] = read_U16Fixed16Number(bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmU16Fixed16Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmU16Fixed16Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmU16Fixed16Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 4) {
- if ((rv = write_U16Fixed16Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmU16Fixed16Array_write: write_U16Fixed16umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmU16Fixed16Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmU16Fixed16Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmU16Fixed16Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 4) {
+ if ((rv = write_U16Fixed16Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmU16Fixed16Array_write: write_U16Fixed16umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmU16Fixed16Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmU16Fixed16Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- if (verb <= 0)
- return;
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"U16Fixed16Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: %f\n",i,p->data[i]);
- }
+ fprintf(op,"U16Fixed16Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: %f\n",i,p->data[i]);
+ }
}
/* Allocate variable sized data elements */
static int icmU16Fixed16Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- icc *icp = p->icp;
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
- sprintf(icp->err,"icmU16Fixed16Array_alloc: calloc() of icmU16Fixed16Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmU16Fixed16Array_alloc: calloc() of icmU16Fixed16Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmU16Fixed16Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
- icc *icp = p->icp;
+ icmU16Fixed16Array *p = (icmU16Fixed16Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmU16Fixed16Array(
- icc *icp
+ icc *icp
) {
- icmU16Fixed16Array *p;
- if ((p = (icmU16Fixed16Array *) icp->al->calloc(icp->al,1,sizeof(icmU16Fixed16Array))) == NULL)
- return NULL;
- p->ttype = icSigU16Fixed16ArrayType;
- p->refcount = 1;
- p->get_size = icmU16Fixed16Array_get_size;
- p->read = icmU16Fixed16Array_read;
- p->write = icmU16Fixed16Array_write;
- p->dump = icmU16Fixed16Array_dump;
- p->allocate = icmU16Fixed16Array_allocate;
- p->del = icmU16Fixed16Array_delete;
- p->icp = icp;
+ icmU16Fixed16Array *p;
+ if ((p = (icmU16Fixed16Array *) icp->al->calloc(icp->al,1,sizeof(icmU16Fixed16Array))) == NULL)
+ return NULL;
+ p->ttype = icSigU16Fixed16ArrayType;
+ p->refcount = 1;
+ p->get_size = icmU16Fixed16Array_get_size;
+ p->read = icmU16Fixed16Array_read;
+ p->write = icmU16Fixed16Array_write;
+ p->dump = icmU16Fixed16Array_dump;
+ p->allocate = icmU16Fixed16Array_allocate;
+ p->del = icmU16Fixed16Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -2527,430 +2520,428 @@ static icmBase *new_icmU16Fixed16Array(
/* Return the number of bytes needed to write this tag */
static unsigned int icmS15Fixed16Array_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 4) {
- p->icp->errc = 1;
- return (unsigned int) - 1;
- }
- len += p->size * 4; /* 4 byte for each S15Fixed16 */
- return len;
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 4) {
+ p->icp->errc = 1;
+ return (unsigned int) - 1;
+ }
+ len += p->size * 4; /* 4 byte for each S15Fixed16 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmS15Fixed16Array_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmS15Fixed16Array_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmS15Fixed16Array_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmS15Fixed16Array_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/4; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmS15Fixed16Array_read: Wrong tag type for icmS15Fixed16Array");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 4) {
- p->data[i] = read_S15Fixed16Number(bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmS15Fixed16Array_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmS15Fixed16Array_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmS15Fixed16Array_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/4; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmS15Fixed16Array_read: Wrong tag type for icmS15Fixed16Array");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 4) {
+ p->data[i] = read_S15Fixed16Number(bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmS15Fixed16Array_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmS15Fixed16Array_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmS15Fixed16Array_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 4) {
- if ((rv = write_S15Fixed16Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmS15Fixed16Array_write: write_S15Fixed16umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmS15Fixed16Array_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmS15Fixed16Array_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmS15Fixed16Array_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 4) {
+ if ((rv = write_S15Fixed16Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmS15Fixed16Array_write: write_S15Fixed16umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmS15Fixed16Array_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmS15Fixed16Array_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- if (verb <= 0)
- return;
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"S15Fixed16Array:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %lu: %f\n",i,p->data[i]);
- }
+ fprintf(op,"S15Fixed16Array:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %lu: %f\n",i,p->data[i]);
+ }
}
/* Allocate variable sized data elements */
static int icmS15Fixed16Array_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- icc *icp = p->icp;
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
- sprintf(icp->err,"icmS15Fixed16Array_alloc: calloc() of icmS15Fixed16Array data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmS15Fixed16Array_alloc: calloc() of icmS15Fixed16Array data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmS15Fixed16Array_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
- icc *icp = p->icp;
+ icmS15Fixed16Array *p = (icmS15Fixed16Array *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmS15Fixed16Array(
- icc *icp
+ icc *icp
) {
- icmS15Fixed16Array *p;
- if ((p = (icmS15Fixed16Array *) icp->al->calloc(icp->al,1,sizeof(icmS15Fixed16Array))) == NULL)
- return NULL;
- p->ttype = icSigS15Fixed16ArrayType;
- p->refcount = 1;
- p->get_size = icmS15Fixed16Array_get_size;
- p->read = icmS15Fixed16Array_read;
- p->write = icmS15Fixed16Array_write;
- p->dump = icmS15Fixed16Array_dump;
- p->allocate = icmS15Fixed16Array_allocate;
- p->del = icmS15Fixed16Array_delete;
- p->icp = icp;
+ icmS15Fixed16Array *p;
+ if ((p = (icmS15Fixed16Array *) icp->al->calloc(icp->al,1,sizeof(icmS15Fixed16Array))) == NULL)
+ return NULL;
+ p->ttype = icSigS15Fixed16ArrayType;
+ p->refcount = 1;
+ p->get_size = icmS15Fixed16Array_get_size;
+ p->read = icmS15Fixed16Array_read;
+ p->write = icmS15Fixed16Array_write;
+ p->dump = icmS15Fixed16Array_dump;
+ p->allocate = icmS15Fixed16Array_allocate;
+ p->del = icmS15Fixed16Array_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
/* Data conversion support functions */
static int write_XYZNumber(icmXYZNumber *p, char *d) {
- int rv;
- if ((rv = write_S15Fixed16Number(p->X, d + 0)) != 0)
- return rv;
- if ((rv = write_S15Fixed16Number(p->Y, d + 4)) != 0)
- return rv;
- if ((rv = write_S15Fixed16Number(p->Z, d + 8)) != 0)
- return rv;
- return 0;
+ int rv;
+ if ((rv = write_S15Fixed16Number(p->X, d + 0)) != 0)
+ return rv;
+ if ((rv = write_S15Fixed16Number(p->Y, d + 4)) != 0)
+ return rv;
+ if ((rv = write_S15Fixed16Number(p->Z, d + 8)) != 0)
+ return rv;
+ return 0;
}
static int read_XYZNumber(icmXYZNumber *p, char *d) {
- p->X = read_S15Fixed16Number(d + 0);
- p->Y = read_S15Fixed16Number(d + 4);
- p->Z = read_S15Fixed16Number(d + 8);
- return 0;
+ p->X = read_S15Fixed16Number(d + 0);
+ p->Y = read_S15Fixed16Number(d + 4);
+ p->Z = read_S15Fixed16Number(d + 8);
+ return 0;
}
-
/* Helper: Return a string that shows the XYZ number value */
static char *string_XYZNumber(icmXYZNumber *p) {
- static char buf[40];
+ static char buf[40];
- sprintf(buf,"%f, %f, %f", p->X, p->Y, p->Z);
- return buf;
+ sprintf(buf,"%f, %f, %f", p->X, p->Y, p->Z);
+ return buf;
}
/* Helper: Return a string that shows the XYZ number value, */
/* and the Lab D50 number in paren. */
static char *string_XYZNumber_and_Lab(icmXYZNumber *p) {
- static char buf[50];
- double lab[3];
- lab[0] = p->X;
- lab[1] = p->Y;
- lab[2] = p->Z;
- icmXYZ2Lab(&icmD50, lab, lab);
- sprintf(buf,"%f, %f, %f [Lab %f, %f, %f]", p->X, p->Y, p->Z, lab[0], lab[1], lab[2]);
- return buf;
-}
-
+ static char buf[50];
+ double lab[3];
+ lab[0] = p->X;
+ lab[1] = p->Y;
+ lab[2] = p->Z;
+ icmXYZ2Lab(&icmD50, lab, lab);
+ sprintf(buf,"%f, %f, %f [Lab %f, %f, %f]", p->X, p->Y, p->Z, lab[0], lab[1], lab[2]);
+ return buf;
+}
+
/* icmXYZArray object */
/* Return the number of bytes needed to write this tag */
static unsigned int icmXYZArray_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmXYZArray *p = (icmXYZArray *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->size > (UINT_MAX - len) / 12) {
- p->icp->errc = 1;
- return (unsigned int) - 1;
- }
- len += p->size * 12; /* 12 bytes for each XYZ */
- return len;
+ icmXYZArray *p = (icmXYZArray *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->size > (UINT_MAX - len) / 12) {
+ p->icp->errc = 1;
+ return (unsigned int) - 1;
+ }
+ len += p->size * 12; /* 12 bytes for each XYZ */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmXYZArray_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmXYZArray *p = (icmXYZArray *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, size;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmXYZArray_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmXYZArray_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmXYZArray_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 8)/12; /* Number of elements in the array */
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmXYZArray_read: Wrong tag type for icmXYZArray");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read all the data from the buffer */
- for (i = 0; i < size; i++, bp += 12) {
- read_XYZNumber(&p->data[i], bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmXYZArray *p = (icmXYZArray *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, size;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmXYZArray_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmXYZArray_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmXYZArray_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 8)/12; /* Number of elements in the array */
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmXYZArray_read: Wrong tag type for icmXYZArray");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < size; i++, bp += 12) {
+ read_XYZNumber(&p->data[i], bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmXYZArray_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmXYZArray *p = (icmXYZArray *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmXYZArray_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmXYZArray_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- for (i = 0; i < p->size; i++, bp += 12) {
- if ((rv = write_XYZNumber(&p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmXYZArray_write: write_XYZumber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmXYZArray_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmXYZArray *p = (icmXYZArray *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmXYZArray_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmXYZArray_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ for (i = 0; i < p->size; i++, bp += 12) {
+ if ((rv = write_XYZNumber(&p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmXYZArray_write: write_XYZumber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmXYZArray_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmXYZArray_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmXYZArray *p = (icmXYZArray *)pp;
- if (verb <= 0)
- return;
+ icmXYZArray *p = (icmXYZArray *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"XYZArray:\n");
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++) {
- fprintf(op," %lu: %s\n",i,string_XYZNumber_and_Lab(&p->data[i]));
-
- }
- }
-}
+ fprintf(op,"XYZArray:\n");
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++) {
+ fprintf(op," %lu: %s\n",i,string_XYZNumber_and_Lab(&p->data[i]));
+ }
+ }
+}
/* Allocate variable sized data elements */
static int icmXYZArray_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmXYZArray *p = (icmXYZArray *)pp;
- icc *icp = p->icp;
+ icmXYZArray *p = (icmXYZArray *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (icmXYZNumber *) icp->al->calloc(icp->al, p->size, sizeof(icmXYZNumber))) == NULL) {
- sprintf(icp->err,"icmXYZArray_alloc: calloc() of icmXYZArray data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (icmXYZNumber *) icp->al->calloc(icp->al, p->size, sizeof(icmXYZNumber))) == NULL) {
+ sprintf(icp->err,"icmXYZArray_alloc: calloc() of icmXYZArray data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmXYZArray_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmXYZArray *p = (icmXYZArray *)pp;
- icc *icp = p->icp;
+ icmXYZArray *p = (icmXYZArray *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmXYZArray(
- icc *icp
+ icc *icp
) {
- icmXYZArray *p;
- if ((p = (icmXYZArray *) icp->al->calloc(icp->al,1,sizeof(icmXYZArray))) == NULL)
- return NULL;
- p->ttype = icSigXYZArrayType;
- p->refcount = 1;
- p->get_size = icmXYZArray_get_size;
- p->read = icmXYZArray_read;
- p->write = icmXYZArray_write;
- p->dump = icmXYZArray_dump;
- p->allocate = icmXYZArray_allocate;
- p->del = icmXYZArray_delete;
- p->icp = icp;
+ icmXYZArray *p;
+ if ((p = (icmXYZArray *) icp->al->calloc(icp->al,1,sizeof(icmXYZArray))) == NULL)
+ return NULL;
+ p->ttype = icSigXYZArrayType;
+ p->refcount = 1;
+ p->get_size = icmXYZArray_get_size;
+ p->read = icmXYZArray_read;
+ p->write = icmXYZArray_write;
+ p->dump = icmXYZArray_dump;
+ p->allocate = icmXYZArray_allocate;
+ p->del = icmXYZArray_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -2959,40 +2950,40 @@ static icmBase *new_icmXYZArray(
/* Do a forward lookup through the curve */
/* Return 0 on success, 1 if clipping occured, 2 on other error */
static int icmCurve_lookup_fwd(
- icmCurve *p,
- double *out,
- double *in
-) {
- int rv = 0;
- if (p->flag == icmCurveLin) {
- *out = *in;
- } else if (p->flag == icmCurveGamma) {
- double val = *in;
- if (val <= 0.0)
- *out = 0.0;
- else
- *out = pow(val, p->data[0]);
- } else { /* Use linear interpolation */
- int ix;
- double val, w;
- double inputEnt_1 = (double)(p->size-1);
-
- val = *in * inputEnt_1;
- if (val < 0.0) {
- val = 0.0;
- rv |= 1;
- } else if (val > inputEnt_1) {
- val = inputEnt_1;
- rv |= 1;
- }
- ix = (int)floor(val); /* Coordinate */
- if (ix < 0 || ix > (p->size-2))
- ix = (p->size-2);
- w = val - (double)ix; /* weight */
- val = p->data[ix];
- *out = val + w * (p->data[ix+1] - val);
- }
- return rv;
+ icmCurve *p,
+ double *out,
+ double *in
+) {
+ int rv = 0;
+ if (p->flag == icmCurveLin) {
+ *out = *in;
+ } else if (p->flag == icmCurveGamma) {
+ double val = *in;
+ if (val <= 0.0)
+ *out = 0.0;
+ else
+ *out = pow(val, p->data[0]);
+ } else { /* Use linear interpolation */
+ int ix;
+ double val, w;
+ double inputEnt_1 = (double)(p->size-1);
+
+ val = *in * inputEnt_1;
+ if (val < 0.0) {
+ val = 0.0;
+ rv |= 1;
+ } else if (val > inputEnt_1) {
+ val = inputEnt_1;
+ rv |= 1;
+ }
+ ix = (int)floor(val); /* Coordinate */
+ if (ix < 0 || ix > (p->size-2))
+ ix = (p->size-2);
+ w = val - (double)ix; /* weight */
+ val = p->data[ix];
+ *out = val + w * (p->data[ix+1] - val);
+ }
+ return rv;
}
/* - - - - - - - - - - - - */
@@ -3001,468 +2992,467 @@ static int icmCurve_lookup_fwd(
/* Create a reverse curve lookup acceleration table */
/* return non-zero on error, 2 = malloc error. */
static int icmTable_setup_bwd(
- icc *icp, /* Base icc object */
- icmRevTable *rt, /* Reverse table data to setup */
- unsigned long size, /* Size of fwd table */
- double *data /* Table */
-) {
- int i;
-
- if (size > INT_MAX - 2)
- /* Although rt->size is unsigned long, the rt data
- * structure uses int data types to store indices. */
- return 2;
-
- rt->size = size; /* Stash pointers to these away */
- rt->data = data;
-
- /* Find range of output values */
- rt->rmin = 1e300;
- rt->rmax = -1e300;
- for (i = 0; i < rt->size; i++) {
- if (rt->data[i] > rt->rmax)
- rt->rmax = rt->data[i];
- if (rt->data[i] < rt->rmin)
- rt->rmin = rt->data[i];
- }
-
- /* Decide on reverse granularity */
- rt->rsize = (rt->size+2)/2;
- rt->qscale = (double)rt->rsize/(rt->rmax - rt->rmin); /* Scale factor to quantize to */
-
- /* Initialize the reverse lookup structures, and get overall min/max */
- if ((rt->rlists = (int **) icp->al->calloc(icp->al, rt->rsize, sizeof(int *))) == NULL) {
- return 2;
- }
-
- /* Assign each output value range bucket lists it intersects */
- for (i = 0; i < (rt->size-1); i++) {
- int s, e, j; /* Start and end indexes (inclusive) */
- s = (int)((rt->data[i] - rt->rmin) * rt->qscale);
- e = (int)((rt->data[i+1] - rt->rmin) * rt->qscale);
- if (s > e) { /* swap */
- int t;
- t = s; s = e; e = t;
- }
- /* s and e should both be in the range [0,rt->size]
- * now, but let's not rely on floating point
- * calculations -- clamp to [0,rt->size) */
- if (s < 0)
- s = 0;
- if (e < 0)
- e = 0;
- if (s >= rt->rsize)
- s = rt->rsize-1;
- if (e >= rt->rsize)
- e = rt->rsize-1;
-
- /* For all buckets that may contain this output range, add index of this output */
- for (j = s; j <= e; j++) {
- int as; /* Allocation size */
- int nf; /* Next free slot */
- if (rt->rlists[j] == NULL) { /* No allocation */
- as = 5; /* Start with space for 5 */
- if ((rt->rlists[j] = (int *) icp->al->calloc(icp->al, sizeof(int), as)) == NULL) {
- return 2;
- }
- rt->rlists[j][0] = as;
- nf = rt->rlists[j][1] = 2;
- } else {
- as = rt->rlists[j][0]; /* Allocate space for this list */
- nf = rt->rlists[j][1]; /* Next free location in list */
- if (nf >= as) { /* need to expand space */
- if (as > INT_MAX / 2 / sizeof(int))
- return 2;
- as *= 2;
- rt->rlists[j] = (int *) icp->al->realloc(icp->al,rt->rlists[j], sizeof(int) * as);
- if (rt->rlists[j] == NULL) {
- return 2;
- }
- rt->rlists[j][0] = as;
- }
- }
- rt->rlists[j][nf++] = i;
- rt->rlists[j][1] = nf;
- }
- }
- rt->inited = 1;
- return 0;
+ icc *icp, /* Base icc object */
+ icmRevTable *rt, /* Reverse table data to setup */
+ unsigned long size, /* Size of fwd table */
+ double *data /* Table */
+) {
+ int i;
+
+ if (size > INT_MAX - 2)
+ /* Although rt->size is unsigned long, the rt data
+ * structure uses int data types to store indices. */
+ return 2;
+
+ rt->size = size; /* Stash pointers to these away */
+ rt->data = data;
+
+ /* Find range of output values */
+ rt->rmin = 1e300;
+ rt->rmax = -1e300;
+ for (i = 0; i < rt->size; i++) {
+ if (rt->data[i] > rt->rmax)
+ rt->rmax = rt->data[i];
+ if (rt->data[i] < rt->rmin)
+ rt->rmin = rt->data[i];
+ }
+
+ /* Decide on reverse granularity */
+ rt->rsize = (rt->size+2)/2;
+ rt->qscale = (double)rt->rsize/(rt->rmax - rt->rmin); /* Scale factor to quantize to */
+
+ /* Initialize the reverse lookup structures, and get overall min/max */
+ if ((rt->rlists = (int **) icp->al->calloc(icp->al, rt->rsize, sizeof(int *))) == NULL) {
+ return 2;
+ }
+
+ /* Assign each output value range bucket lists it intersects */
+ for (i = 0; i < (rt->size-1); i++) {
+ int s, e, j; /* Start and end indexes (inclusive) */
+ s = (int)((rt->data[i] - rt->rmin) * rt->qscale);
+ e = (int)((rt->data[i+1] - rt->rmin) * rt->qscale);
+ if (s > e) { /* swap */
+ int t;
+ t = s; s = e; e = t;
+ }
+ /* s and e should both be in the range [0,rt->size]
+ * now, but let's not rely on floating point
+ * calculations -- clamp to [0,rt->size) */
+ if (s < 0)
+ s = 0;
+ if (e < 0)
+ e = 0;
+ if (s >= rt->rsize)
+ s = rt->rsize-1;
+ if (e >= rt->rsize)
+ e = rt->rsize-1;
+
+ /* For all buckets that may contain this output range, add index of this output */
+ for (j = s; j <= e; j++) {
+ int as; /* Allocation size */
+ int nf; /* Next free slot */
+ if (rt->rlists[j] == NULL) { /* No allocation */
+ as = 5; /* Start with space for 5 */
+ if ((rt->rlists[j] = (int *) icp->al->calloc(icp->al, sizeof(int), as)) == NULL) {
+ return 2;
+ }
+ rt->rlists[j][0] = as;
+ nf = rt->rlists[j][1] = 2;
+ } else {
+ as = rt->rlists[j][0]; /* Allocate space for this list */
+ nf = rt->rlists[j][1]; /* Next free location in list */
+ if (nf >= as) { /* need to expand space */
+ if (as > INT_MAX / 2 / sizeof(int))
+ return 2;
+ as *= 2;
+ rt->rlists[j] = (int *) icp->al->realloc(icp->al,rt->rlists[j], sizeof(int) * as);
+ if (rt->rlists[j] == NULL) {
+ return 2;
+ }
+ rt->rlists[j][0] = as;
+ }
+ }
+ rt->rlists[j][nf++] = i;
+ rt->rlists[j][1] = nf;
+ }
+ }
+ rt->inited = 1;
+ return 0;
}
/* Free up any data */
static void icmTable_delete_bwd(
- icc *icp, /* Base icc */
- icmRevTable *rt /* Reverse table data to setup */
+ icc *icp, /* Base icc */
+ icmRevTable *rt /* Reverse table data to setup */
) {
- if (rt->inited != 0) {
- while (rt->rsize > 0)
- icp->al->free(icp->al, rt->rlists[--rt->rsize]);
- icp->al->free(icp->al, rt->rlists);
- rt->size = 0; /* Don't keep these */
- rt->data = NULL;
- }
+ if (rt->inited != 0) {
+ while (rt->rsize > 0)
+ icp->al->free(icp->al, rt->rlists[--rt->rsize]);
+ icp->al->free(icp->al, rt->rlists);
+ rt->size = 0; /* Don't keep these */
+ rt->data = NULL;
+ }
}
/* Do a reverse lookup through the curve */
/* Return 0 on success, 1 if clipping occured, 2 on other error */
static int icmTable_lookup_bwd(
- icmRevTable *rt,
- double *out,
- double *in
-) {
- int rv = 0;
- int ix, i, k;
- double oval, ival = *in, val;
- double rsize_1;
-
- /* Find appropriate reverse list */
- rsize_1 = (double)(rt->rsize-1);
- val = ((ival - rt->rmin) * rt->qscale);
- if (val < 0.0)
- val = 0.0;
- else if (val > rsize_1)
- val = rsize_1;
- ix = (int)floor(val); /* Coordinate */
-
- if (ix < 0 || ix > (rt->size-2))
- ix = (rt->size-2);
- if (rt->rlists[ix] != NULL) { /* There is a list of fwd candidates */
- /* For each candidate forward range */
- for (i = 2; i < rt->rlists[ix][1]; i++) { /* For all fwd indexes */
- double lv,hv;
- k = rt->rlists[ix][i]; /* Base index */
- lv = rt->data[k];
- hv = rt->data[k+1];
- if ((ival >= lv && ival <= hv) /* If this slot contains output value */
- || (ival >= hv && ival <= lv)) {
- /* Reverse linear interpolation */
- if (hv == lv) { /* Technically non-monotonic - due to quantization ? */
- oval = (k + 0.5)/(rt->size-1.0);
- } else
- oval = (k + ((ival - lv)/(hv - lv)))/(rt->size-1.0);
- /* If we kept looking, we would find multiple */
- /* solution for non-monotonic curve */
- *out = oval;
- return rv;
- }
- }
- }
-
- /* We have failed to find an exact value, so return the nearest value */
- /* (This is slow !) */
- val = fabs(ival - rt->data[0]);
- /* rt->size is known to be < INT_MAX */
- for (k = 0, i = 1; i < rt->size; i++) {
- double er;
- er = fabs(ival - rt->data[i]);
- if (er < val) { /* new best */
- val = er;
- k = i;
- }
- }
- *out = k/(rt->size-1.0);
- rv |= 1;
- return rv;
+ icmRevTable *rt,
+ double *out,
+ double *in
+) {
+ int rv = 0;
+ int ix, i, k;
+ double oval, ival = *in, val;
+ double rsize_1;
+
+ /* Find appropriate reverse list */
+ rsize_1 = (double)(rt->rsize-1);
+ val = ((ival - rt->rmin) * rt->qscale);
+ if (val < 0.0)
+ val = 0.0;
+ else if (val > rsize_1)
+ val = rsize_1;
+ ix = (int)floor(val); /* Coordinate */
+
+ if (ix < 0 || ix > (rt->size-2))
+ ix = (rt->size-2);
+ if (rt->rlists[ix] != NULL) { /* There is a list of fwd candidates */
+ /* For each candidate forward range */
+ for (i = 2; i < rt->rlists[ix][1]; i++) { /* For all fwd indexes */
+ double lv,hv;
+ k = rt->rlists[ix][i]; /* Base index */
+ lv = rt->data[k];
+ hv = rt->data[k+1];
+ if ((ival >= lv && ival <= hv) /* If this slot contains output value */
+ || (ival >= hv && ival <= lv)) {
+ /* Reverse linear interpolation */
+ if (hv == lv) { /* Technically non-monotonic - due to quantization ? */
+ oval = (k + 0.5)/(rt->size-1.0);
+ } else
+ oval = (k + ((ival - lv)/(hv - lv)))/(rt->size-1.0);
+ /* If we kept looking, we would find multiple */
+ /* solution for non-monotonic curve */
+ *out = oval;
+ return rv;
+ }
+ }
+ }
+
+ /* We have failed to find an exact value, so return the nearest value */
+ /* (This is slow !) */
+ val = fabs(ival - rt->data[0]);
+ /* rt->size is known to be < INT_MAX */
+ for (k = 0, i = 1; i < rt->size; i++) {
+ double er;
+ er = fabs(ival - rt->data[i]);
+ if (er < val) { /* new best */
+ val = er;
+ k = i;
+ }
+ }
+ *out = k/(rt->size-1.0);
+ rv |= 1;
+ return rv;
}
-
/* - - - - - - - - - - - - */
/* Do a reverse lookup through the curve */
/* Return 0 on success, 1 if clipping occured, 2 on other error */
static int icmCurve_lookup_bwd(
- icmCurve *p,
- double *out,
- double *in
-) {
- icc *icp = p->icp;
- int rv = 0;
- if (p->flag == icmCurveLin) {
- *out = *in;
- } else if (p->flag == icmCurveGamma) {
- double val = *in;
- if (val <= 0.0)
- *out = 0.0;
- else
- *out = pow(val, 1.0/p->data[0]);
- } else { /* Use linear interpolation */
- if (p->rt.inited == 0) {
- rv = icmTable_setup_bwd(icp, &p->rt, p->size, p->data);
- if (rv != 0) {
- sprintf(icp->err,"icmCurve_lookup: Malloc failure in reverse lookup init.");
- return icp->errc = rv;
- }
- }
- rv = icmTable_lookup_bwd(&p->rt, out, in);
- }
- return rv;
+ icmCurve *p,
+ double *out,
+ double *in
+) {
+ icc *icp = p->icp;
+ int rv = 0;
+ if (p->flag == icmCurveLin) {
+ *out = *in;
+ } else if (p->flag == icmCurveGamma) {
+ double val = *in;
+ if (val <= 0.0)
+ *out = 0.0;
+ else
+ *out = pow(val, 1.0/p->data[0]);
+ } else { /* Use linear interpolation */
+ if (p->rt.inited == 0) {
+ rv = icmTable_setup_bwd(icp, &p->rt, p->size, p->data);
+ if (rv != 0) {
+ sprintf(icp->err,"icmCurve_lookup: Malloc failure in reverse lookup init.");
+ return icp->errc = rv;
+ }
+ }
+ rv = icmTable_lookup_bwd(&p->rt, out, in);
+ }
+ return rv;
}
/* Return the number of bytes needed to write this tag */
static unsigned int icmCurve_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmCurve *p = (icmCurve *)pp;
- unsigned int len = 0;
- len += 12; /* 12 bytes for tag, padding and count */
- if (p->size > (UINT_MAX - len) / 2) {
- p->icp->errc = 1;
- return (unsigned int) - 1;
- }
- len += p->size * 2; /* 2 bytes for each UInt16 */
- return len;
+ icmCurve *p = (icmCurve *)pp;
+ unsigned int len = 0;
+ len += 12; /* 12 bytes for tag, padding and count */
+ if (p->size > (UINT_MAX - len) / 2) {
+ p->icp->errc = 1;
+ return (unsigned int) - 1;
+ }
+ len += p->size * 2; /* 2 bytes for each UInt16 */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmCurve_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmCurve *p = (icmCurve *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i;
- char *bp, *buf, *end;
-
- if (len < 12) {
- sprintf(icp->err,"icmCurve_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmCurve_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmCurve_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmCurve_read: Wrong tag type for icmCurve");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- p->size = read_UInt32Number(bp+8);
- bp = bp + 12;
-
- /* Set flag up before allocating */
- if (p->size == 0) { /* Linear curve */
- p->flag = icmCurveLin;
- } else if (p->size == 1) { /* Gamma curve */
- p->flag = icmCurveGamma;
- } else {
- p->flag = icmCurveSpec;
- }
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- if (p->flag == icmCurveGamma) { /* Gamma curve */
- if ((bp + 1) > end) {
- sprintf(icp->err,"icmCurve_read: Data too short to curve gamma");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->data[0] = read_U8Fixed8Number(bp);
- } else if (p->flag == icmCurveSpec) {
- /* Read all the data from the buffer */
- for (i = 0; i < p->size; i++, bp += 2) {
- if ((bp + 2) > end) {
- sprintf(icp->err,"icmData_read: Data too short to curve value");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->data[i] = read_DCS16Number(bp);
- }
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmCurve *p = (icmCurve *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i;
+ char *bp, *buf, *end;
+
+ if (len < 12) {
+ sprintf(icp->err,"icmCurve_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmCurve_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmCurve_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmCurve_read: Wrong tag type for icmCurve");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ p->size = read_UInt32Number(bp+8);
+ bp = bp + 12;
+
+ /* Set flag up before allocating */
+ if (p->size == 0) { /* Linear curve */
+ p->flag = icmCurveLin;
+ } else if (p->size == 1) { /* Gamma curve */
+ p->flag = icmCurveGamma;
+ } else {
+ p->flag = icmCurveSpec;
+ }
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ if (p->flag == icmCurveGamma) { /* Gamma curve */
+ if ((bp + 1) > end) {
+ sprintf(icp->err,"icmCurve_read: Data too short to curve gamma");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->data[0] = read_U8Fixed8Number(bp);
+ } else if (p->flag == icmCurveSpec) {
+ /* Read all the data from the buffer */
+ for (i = 0; i < p->size; i++, bp += 2) {
+ if ((bp + 2) > end) {
+ sprintf(icp->err,"icmData_read: Data too short to curve value");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->data[i] = read_DCS16Number(bp);
+ }
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmCurve_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmCurve *p = (icmCurve *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmCurve_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmCurve_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- /* Write count */
- if ((rv = write_UInt32Number(p->size,bp+8)) != 0) {
- sprintf(icp->err,"icmCurve_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write all the data to the buffer */
- bp += 12; /* Skip padding */
- if (p->flag == icmCurveLin) {
- if (p->size != 0) {
- sprintf(icp->err,"icmCurve_write: Must be exactly 0 entry for Linear");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- } else if (p->flag == icmCurveGamma) {
- if (p->size != 1) {
- sprintf(icp->err,"icmCurve_write: Must be exactly 1 entry for Gamma");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if ((rv = write_U8Fixed8Number(p->data[0],bp)) != 0) {
- sprintf(icp->err,"icmCurve_write: write_U8Fixed8umber(%f) failed",p->data[0]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- } else if (p->flag == icmCurveSpec) {
- if (p->size < 2) {
- sprintf(icp->err,"icmCurve_write: Must be 2 or more entries for Specified curve");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- for (i = 0; i < p->size; i++, bp += 2) {
- if ((rv = write_DCS16Number(p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmCurve_write: write_UInt16umber(%f) failed",p->data[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmCurve_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmCurve *p = (icmCurve *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmCurve_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmCurve_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ /* Write count */
+ if ((rv = write_UInt32Number(p->size,bp+8)) != 0) {
+ sprintf(icp->err,"icmCurve_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write all the data to the buffer */
+ bp += 12; /* Skip padding */
+ if (p->flag == icmCurveLin) {
+ if (p->size != 0) {
+ sprintf(icp->err,"icmCurve_write: Must be exactly 0 entry for Linear");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ } else if (p->flag == icmCurveGamma) {
+ if (p->size != 1) {
+ sprintf(icp->err,"icmCurve_write: Must be exactly 1 entry for Gamma");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if ((rv = write_U8Fixed8Number(p->data[0],bp)) != 0) {
+ sprintf(icp->err,"icmCurve_write: write_U8Fixed8umber(%f) failed",p->data[0]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ } else if (p->flag == icmCurveSpec) {
+ if (p->size < 2) {
+ sprintf(icp->err,"icmCurve_write: Must be 2 or more entries for Specified curve");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ for (i = 0; i < p->size; i++, bp += 2) {
+ if ((rv = write_DCS16Number(p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmCurve_write: write_UInt16umber(%f) failed",p->data[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmCurve_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmCurve_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmCurve *p = (icmCurve *)pp;
- if (verb <= 0)
- return;
-
- fprintf(op,"Curve:\n");
-
- if (p->flag == icmCurveLin) {
- fprintf(op," Curve is linear\n");
- } else if (p->flag == icmCurveGamma) {
- fprintf(op," Curve is gamma of %f\n",p->data[0]);
- } else {
- fprintf(op," No. elements = %lu\n",p->size);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->size; i++)
- fprintf(op," %3lu: %f\n",i,p->data[i]);
- }
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmCurve *p = (icmCurve *)pp;
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Curve:\n");
+
+ if (p->flag == icmCurveLin) {
+ fprintf(op," Curve is linear\n");
+ } else if (p->flag == icmCurveGamma) {
+ fprintf(op," Curve is gamma of %f\n",p->data[0]);
+ } else {
+ fprintf(op," No. elements = %lu\n",p->size);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->size; i++)
+ fprintf(op," %3lu: %f\n",i,p->data[i]);
+ }
+ }
}
/* Allocate variable sized data elements */
static int icmCurve_allocate(
- icmBase *pp
-) {
- icmCurve *p = (icmCurve *)pp;
- icc *icp = p->icp;
-
- if (p->flag == icmCurveUndef) {
- sprintf(icp->err,"icmCurve_alloc: flag not set");
- return icp->errc = 1;
- } else if (p->flag == icmCurveLin) {
- p->size = 0;
- } else if (p->flag == icmCurveGamma) {
- p->size = 1;
- }
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
- sprintf(icp->err,"icmCurve_alloc: calloc() of icmCurve data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ icmBase *pp
+) {
+ icmCurve *p = (icmCurve *)pp;
+ icc *icp = p->icp;
+
+ if (p->flag == icmCurveUndef) {
+ sprintf(icp->err,"icmCurve_alloc: flag not set");
+ return icp->errc = 1;
+ } else if (p->flag == icmCurveLin) {
+ p->size = 0;
+ } else if (p->flag == icmCurveGamma) {
+ p->size = 1;
+ }
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (double *) icp->al->calloc(icp->al, p->size, sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmCurve_alloc: calloc() of icmCurve data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmCurve_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmCurve *p = (icmCurve *)pp;
- icc *icp = p->icp;
+ icmCurve *p = (icmCurve *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icmTable_delete_bwd(icp, &p->rt); /* Free reverse table info */
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icmTable_delete_bwd(icp, &p->rt); /* Free reverse table info */
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmCurve(
- icc *icp
+ icc *icp
) {
- icmCurve *p;
- if ((p = (icmCurve *) icp->al->calloc(icp->al,1,sizeof(icmCurve))) == NULL)
- return NULL;
- p->ttype = icSigCurveType;
- p->refcount = 1;
- p->get_size = icmCurve_get_size;
- p->read = icmCurve_read;
- p->write = icmCurve_write;
- p->dump = icmCurve_dump;
- p->allocate = icmCurve_allocate;
- p->del = icmCurve_delete;
- p->icp = icp;
+ icmCurve *p;
+ if ((p = (icmCurve *) icp->al->calloc(icp->al,1,sizeof(icmCurve))) == NULL)
+ return NULL;
+ p->ttype = icSigCurveType;
+ p->refcount = 1;
+ p->get_size = icmCurve_get_size;
+ p->read = icmCurve_read;
+ p->write = icmCurve_write;
+ p->dump = icmCurve_dump;
+ p->allocate = icmCurve_allocate;
+ p->del = icmCurve_delete;
+ p->icp = icp;
- p->lookup_fwd = icmCurve_lookup_fwd;
- p->lookup_bwd = icmCurve_lookup_bwd;
+ p->lookup_fwd = icmCurve_lookup_fwd;
+ p->lookup_bwd = icmCurve_lookup_bwd;
- p->rt.inited = 0;
+ p->rt.inited = 0;
- p->flag = icmCurveUndef;
- return (icmBase *)p;
+ p->flag = icmCurveUndef;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -3470,268 +3460,268 @@ static icmBase *new_icmCurve(
/* Return the number of bytes needed to write this tag */
static unsigned int icmData_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmData *p = (icmData *)pp;
- unsigned int len = 0;
- len += 12; /* 12 bytes for tag and padding */
- len += p->size * 1; /* 1 byte for each data element */
- return len;
+ icmData *p = (icmData *)pp;
+ unsigned int len = 0;
+ len += 12; /* 12 bytes for tag and padding */
+ len += p->size * 1; /* 1 byte for each data element */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmData_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmData *p = (icmData *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned size, f;
- char *bp, *buf;
-
- if (len < 12) {
- sprintf(icp->err,"icmData_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmData_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmData_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = size = (len - 12)/1; /* Number of elements in the array */
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmData_read: Wrong tag type for icmData");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- /* Read the data type flag */
- f = read_UInt32Number(bp+8);
- if (f == 0) {
- p->flag = icmDataASCII;
- } else if (f == 1) {
- p->flag = icmDataBin;
- } else {
- sprintf(icp->err,"icmData_read: Unknown flag value 0x%x",f);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 12; /* Skip padding and flag */
-
- if (p->size > 0) {
- if (p->flag == icmDataASCII) {
- if (check_null_string(bp,p->size) != 0) {
- sprintf(icp->err,"icmData_read: ACSII is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- memcpy((void *)p->data, (void *)bp, p->size);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmData *p = (icmData *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned size, f;
+ char *bp, *buf;
+
+ if (len < 12) {
+ sprintf(icp->err,"icmData_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmData_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmData_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = size = (len - 12)/1; /* Number of elements in the array */
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmData_read: Wrong tag type for icmData");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ /* Read the data type flag */
+ f = read_UInt32Number(bp+8);
+ if (f == 0) {
+ p->flag = icmDataASCII;
+ } else if (f == 1) {
+ p->flag = icmDataBin;
+ } else {
+ sprintf(icp->err,"icmData_read: Unknown flag value 0x%x",f);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 12; /* Skip padding and flag */
+
+ if (p->size > 0) {
+ if (p->flag == icmDataASCII) {
+ if (check_null_string(bp,p->size) != 0) {
+ sprintf(icp->err,"icmData_read: ACSII is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ memcpy((void *)p->data, (void *)bp, p->size);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmData_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmData *p = (icmData *)pp;
- icc *icp = p->icp;
- unsigned int len, f;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmData_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmData_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- switch(p->flag) {
- case icmDataASCII:
- f = 0;
- break;
- case icmDataBin:
- f = 1;
- break;
- default:
- sprintf(icp->err,"icmData_write: Unknown Data Flag value");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- /* Write data flag descriptor to the buffer */
- if ((rv = write_UInt32Number(f,bp+8)) != 0) {
- sprintf(icp->err,"icmData_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp += 12; /* Skip padding */
-
- if (p->data != NULL) {
- if (p->flag == icmDataASCII) {
- if ((rv = check_null_string((char *)p->data, p->size)) != 0) {
- sprintf(icp->err,"icmData_write: ASCII is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
- memcpy((void *)bp, (void *)p->data, p->size);
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmData_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmData *p = (icmData *)pp;
+ icc *icp = p->icp;
+ unsigned int len, f;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmData_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmData_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ switch(p->flag) {
+ case icmDataASCII:
+ f = 0;
+ break;
+ case icmDataBin:
+ f = 1;
+ break;
+ default:
+ sprintf(icp->err,"icmData_write: Unknown Data Flag value");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ /* Write data flag descriptor to the buffer */
+ if ((rv = write_UInt32Number(f,bp+8)) != 0) {
+ sprintf(icp->err,"icmData_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp += 12; /* Skip padding */
+
+ if (p->data != NULL) {
+ if (p->flag == icmDataASCII) {
+ if ((rv = check_null_string((char *)p->data, p->size)) != 0) {
+ sprintf(icp->err,"icmData_write: ASCII is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+ memcpy((void *)bp, (void *)p->data, p->size);
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmData_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmData_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmData *p = (icmData *)pp;
- unsigned long i, r, c, size = 0;
-
- if (verb <= 0)
- return;
-
- fprintf(op,"Data:\n");
- switch(p->flag) {
- case icmDataASCII:
- fprintf(op," ASCII data\n");
- size = p->size > 0 ? p->size-1 : 0;
- break;
- case icmDataBin:
- fprintf(op," Binary data\n");
- size = p->size;
- break;
- case icmDataUndef:
- fprintf(op," Undefined data\n");
- size = p->size;
- break;
- }
- fprintf(op," No. elements = %lu\n",p->size);
-
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 75) {
- if (p->flag == icmDataASCII) {
- if (isprint(p->data[i])) {
- fprintf(op,"%c",p->data[i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->data[i]);
- c += 4;
- }
- } else {
- fprintf(op,"%02x ",p->data[i]);
- c += 3;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmData *p = (icmData *)pp;
+ unsigned long i, r, c, size = 0;
+
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Data:\n");
+ switch(p->flag) {
+ case icmDataASCII:
+ fprintf(op," ASCII data\n");
+ size = p->size > 0 ? p->size-1 : 0;
+ break;
+ case icmDataBin:
+ fprintf(op," Binary data\n");
+ size = p->size;
+ break;
+ case icmDataUndef:
+ fprintf(op," Undefined data\n");
+ size = p->size;
+ break;
+ }
+ fprintf(op," No. elements = %lu\n",p->size);
+
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 75) {
+ if (p->flag == icmDataASCII) {
+ if (isprint(p->data[i])) {
+ fprintf(op,"%c",p->data[i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->data[i]);
+ c += 4;
+ }
+ } else {
+ fprintf(op,"%02x ",p->data[i]);
+ c += 3;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
}
/* Allocate variable sized data elements */
static int icmData_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmData *p = (icmData *)pp;
- icc *icp = p->icp;
+ icmData *p = (icmData *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (unsigned char *) icp->al->calloc(icp->al, p->size, sizeof(unsigned char))) == NULL) {
- sprintf(icp->err,"icmData_alloc: calloc() of icmData data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (unsigned char *) icp->al->calloc(icp->al, p->size, sizeof(unsigned char))) == NULL) {
+ sprintf(icp->err,"icmData_alloc: calloc() of icmData data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmData_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmData *p = (icmData *)pp;
- icc *icp = p->icp;
+ icmData *p = (icmData *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmData(
- icc *icp
+ icc *icp
) {
- icmData *p;
- if ((p = (icmData *) icp->al->calloc(icp->al,1,sizeof(icmData))) == NULL)
- return NULL;
- p->ttype = icSigDataType;
- p->refcount = 1;
- p->get_size = icmData_get_size;
- p->read = icmData_read;
- p->write = icmData_write;
- p->dump = icmData_dump;
- p->allocate = icmData_allocate;
- p->del = icmData_delete;
- p->icp = icp;
+ icmData *p;
+ if ((p = (icmData *) icp->al->calloc(icp->al,1,sizeof(icmData))) == NULL)
+ return NULL;
+ p->ttype = icSigDataType;
+ p->refcount = 1;
+ p->get_size = icmData_get_size;
+ p->read = icmData_read;
+ p->write = icmData_write;
+ p->dump = icmData_dump;
+ p->allocate = icmData_allocate;
+ p->del = icmData_delete;
+ p->icp = icp;
- p->flag = icmDataUndef;
- return (icmBase *)p;
+ p->flag = icmDataUndef;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -3739,465 +3729,465 @@ static icmBase *new_icmData(
/* Return the number of bytes needed to write this tag */
static unsigned int icmText_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmText *p = (icmText *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += p->size; /* 1 byte for each character element (inc. null) */
- return len;
+ icmText *p = (icmText *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += p->size; /* 1 byte for each character element (inc. null) */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmText_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmText *p = (icmText *)pp;
- icc *icp = p->icp;
- int rv = 0;
- char *bp, *buf;
-
- if (len < 8) {
- sprintf(icp->err,"icmText_read: Tag too short to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmText_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmText_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = (len - 8)/1; /* Number of elements in the array */
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmText_read: Wrong tag type for icmText");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp = bp + 8;
-
- if (p->size > 0) {
- if (check_null_string(bp,p->size) != 0) {
- sprintf(icp->err,"icmText_read: text is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- memcpy((void *)p->data, (void *)bp, p->size);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmText *p = (icmText *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ char *bp, *buf;
+
+ if (len < 8) {
+ sprintf(icp->err,"icmText_read: Tag too short to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmText_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmText_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = (len - 8)/1; /* Number of elements in the array */
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmText_read: Wrong tag type for icmText");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp = bp + 8;
+
+ if (p->size > 0) {
+ if (check_null_string(bp,p->size) != 0) {
+ sprintf(icp->err,"icmText_read: text is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ memcpy((void *)p->data, (void *)bp, p->size);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmText_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmText *p = (icmText *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmText_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmText_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- bp = bp + 8;
-
- if (p->data != NULL) {
- if ((rv = check_null_string(p->data, p->size)) != 0) {
- sprintf(icp->err,"icmText_write: text is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)bp, (void *)p->data, p->size);
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmText_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmText *p = (icmText *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmText_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmText_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ bp = bp + 8;
+
+ if (p->data != NULL) {
+ if ((rv = check_null_string(p->data, p->size)) != 0) {
+ sprintf(icp->err,"icmText_write: text is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)bp, (void *)p->data, p->size);
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmText_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmText_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmText *p = (icmText *)pp;
- unsigned long i, r, c, size;
-
- if (verb <= 0)
- return;
-
- fprintf(op,"Text:\n");
- fprintf(op," No. chars = %lu\n",p->size);
-
- size = p->size > 0 ? p->size-1 : 0;
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 75) {
- if (isprint(p->data[i])) {
- fprintf(op,"%c",p->data[i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->data[i]);
- c += 4;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmText *p = (icmText *)pp;
+ unsigned long i, r, c, size;
+
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Text:\n");
+ fprintf(op," No. chars = %lu\n",p->size);
+
+ size = p->size > 0 ? p->size-1 : 0;
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 75) {
+ if (isprint(p->data[i])) {
+ fprintf(op,"%c",p->data[i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->data[i]);
+ c += 4;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
}
/* Allocate variable sized data elements */
static int icmText_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmText *p = (icmText *)pp;
- icc *icp = p->icp;
+ icmText *p = (icmText *)pp;
+ icc *icp = p->icp;
- if (p->size != p->_size) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
- sprintf(icp->err,"icmText_alloc: calloc() of icmText data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ if (p->size != p->_size) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
+ sprintf(icp->err,"icmText_alloc: calloc() of icmText data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmText_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmText *p = (icmText *)pp;
- icc *icp = p->icp;
+ icmText *p = (icmText *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmText(
- icc *icp
+ icc *icp
) {
- icmText *p;
- if ((p = (icmText *) icp->al->calloc(icp->al,1,sizeof(icmText))) == NULL)
- return NULL;
- p->ttype = icSigTextType;
- p->refcount = 1;
- p->get_size = icmText_get_size;
- p->read = icmText_read;
- p->write = icmText_write;
- p->dump = icmText_dump;
- p->allocate = icmText_allocate;
- p->del = icmText_delete;
- p->icp = icp;
+ icmText *p;
+ if ((p = (icmText *) icp->al->calloc(icp->al,1,sizeof(icmText))) == NULL)
+ return NULL;
+ p->ttype = icSigTextType;
+ p->refcount = 1;
+ p->get_size = icmText_get_size;
+ p->read = icmText_read;
+ p->write = icmText_write;
+ p->dump = icmText_dump;
+ p->allocate = icmText_allocate;
+ p->del = icmText_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
/* Data conversion support functions */
static int write_DateTimeNumber(icmDateTimeNumber *p, char *d) {
- int rv;
- if (p->year < 1900 || p->year > 3000
- || p->month == 0 || p->month > 12
- || p->day == 0 || p->day > 31
- || p->hours > 23
- || p->minutes > 59
- || p->seconds > 59)
- return 1;
-
- if ((rv = write_UInt16Number(p->year, d + 0)) != 0)
- return rv;
- if ((rv = write_UInt16Number(p->month, d + 2)) != 0)
- return rv;
- if ((rv = write_UInt16Number(p->day, d + 4)) != 0)
- return rv;
- if ((rv = write_UInt16Number(p->hours, d + 6)) != 0)
- return rv;
- if ((rv = write_UInt16Number(p->minutes, d + 8)) != 0)
- return rv;
- if ((rv = write_UInt16Number(p->seconds, d + 10)) != 0)
- return rv;
- return 0;
+ int rv;
+ if (p->year < 1900 || p->year > 3000
+ || p->month == 0 || p->month > 12
+ || p->day == 0 || p->day > 31
+ || p->hours > 23
+ || p->minutes > 59
+ || p->seconds > 59)
+ return 1;
+
+ if ((rv = write_UInt16Number(p->year, d + 0)) != 0)
+ return rv;
+ if ((rv = write_UInt16Number(p->month, d + 2)) != 0)
+ return rv;
+ if ((rv = write_UInt16Number(p->day, d + 4)) != 0)
+ return rv;
+ if ((rv = write_UInt16Number(p->hours, d + 6)) != 0)
+ return rv;
+ if ((rv = write_UInt16Number(p->minutes, d + 8)) != 0)
+ return rv;
+ if ((rv = write_UInt16Number(p->seconds, d + 10)) != 0)
+ return rv;
+ return 0;
}
static int read_DateTimeNumber(icmDateTimeNumber *p, char *d) {
- p->year = read_UInt16Number(d + 0);
- p->month = read_UInt16Number(d + 2);
- p->day = read_UInt16Number(d + 4);
- p->hours = read_UInt16Number(d + 6);
- p->minutes = read_UInt16Number(d + 8);
- p->seconds = read_UInt16Number(d + 10);
-
- if (p->year < 1900 || p->year > 3000
- || p->month == 0 || p->month > 12
- || p->day == 0 || p->day > 31
- || p->hours > 23
- || p->minutes > 59
- || p->seconds > 59) {
- unsigned int tt;
-
- /* Check for Adobe problem */
- if (p->month < 1900 || p->month > 3000
- || p->year == 0 || p->year > 12
- || p->hours == 0 || p->hours > 31
- || p->day > 23
- || p->seconds > 59
- || p->minutes > 59)
- return 1; /* Nope */
-
- /* Correct Adobe's faulty profile */
- tt = p->month; p->month = p->year; p->year = tt;
- tt = p->hours; p->hours = p->day; p->day = tt;
- tt = p->seconds; p->seconds = p->minutes; p->minutes = tt;
- return 0;
- }
- return 0;
+ p->year = read_UInt16Number(d + 0);
+ p->month = read_UInt16Number(d + 2);
+ p->day = read_UInt16Number(d + 4);
+ p->hours = read_UInt16Number(d + 6);
+ p->minutes = read_UInt16Number(d + 8);
+ p->seconds = read_UInt16Number(d + 10);
+
+ if (p->year < 1900 || p->year > 3000
+ || p->month == 0 || p->month > 12
+ || p->day == 0 || p->day > 31
+ || p->hours > 23
+ || p->minutes > 59
+ || p->seconds > 59) {
+ unsigned int tt;
+
+ /* Check for Adobe problem */
+ if (p->month < 1900 || p->month > 3000
+ || p->year == 0 || p->year > 12
+ || p->hours == 0 || p->hours > 31
+ || p->day > 23
+ || p->seconds > 59
+ || p->minutes > 59)
+ return 1; /* Nope */
+
+ /* Correct Adobe's faulty profile */
+ tt = p->month; p->month = p->year; p->year = tt;
+ tt = p->hours; p->hours = p->day; p->day = tt;
+ tt = p->seconds; p->seconds = p->minutes; p->minutes = tt;
+ return 0;
+ }
+ return 0;
}
/* Return a string that shows the given date and time */
static char *string_DateTimeNumber(icmDateTimeNumber *p) {
- static const char *mstring[13] = {"Bad", "Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"};
- static char buf[80];
+ static const char *mstring[13] = {"Bad", "Jan","Feb","Mar","Apr","May","Jun",
+ "Jul","Aug","Sep","Oct","Nov","Dec"};
+ static char buf[80];
- sprintf(buf,"%d %s %4d, %d:%02d:%02d",
- p->day, mstring[p->month > 12 ? 0 : p->month], p->year,
- p->hours, p->minutes, p->seconds);
- return buf;
+ sprintf(buf,"%d %s %4d, %d:%02d:%02d",
+ p->day, mstring[p->month > 12 ? 0 : p->month], p->year,
+ p->hours, p->minutes, p->seconds);
+ return buf;
}
/* Set the DateTime structure to the current date and time */
static void setcur_DateTimeNumber(icmDateTimeNumber *p) {
- time_t cclk;
- struct tm *ctm;
-
- cclk = time(NULL);
- ctm = localtime(&cclk);
-
- p->year = ctm->tm_year + 1900;
- p->month = ctm->tm_mon + 1;
- p->day = ctm->tm_mday;
- p->hours = ctm->tm_hour;
- p->minutes = ctm->tm_min;
- p->seconds = ctm->tm_sec;
+ time_t cclk;
+ struct tm *ctm;
+
+ cclk = time(NULL);
+ ctm = localtime(&cclk);
+
+ p->year = ctm->tm_year + 1900;
+ p->month = ctm->tm_mon + 1;
+ p->day = ctm->tm_mday;
+ p->hours = ctm->tm_hour;
+ p->minutes = ctm->tm_min;
+ p->seconds = ctm->tm_sec;
}
/* Return the number of bytes needed to write this tag */
static unsigned int icmDateTimeNumber_get_size(
- icmBase *pp
+ icmBase *pp
) {
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += 12; /* 12 bytes for Date & Time */
- return len;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 12; /* 12 bytes for Date & Time */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmDateTimeNumber_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
- icc *icp = p->icp;
- int rv;
- char *bp, *buf;
-
- if (len < 20) {
- sprintf(icp->err,"icmDateTimeNumber_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmDateTimeNumber_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmDateTimeNumber_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmDateTimeNumber_read: Wrong tag type for icmDateTimeNumber");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- /* Read the time and date from buffer */
- if((rv = read_DateTimeNumber(p, bp)) != 0) {
- sprintf(icp->err,"icmDateTimeNumber_read: Corrupted DateTime");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
+ icc *icp = p->icp;
+ int rv;
+ char *bp, *buf;
+
+ if (len < 20) {
+ sprintf(icp->err,"icmDateTimeNumber_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmDateTimeNumber_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmDateTimeNumber_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmDateTimeNumber_read: Wrong tag type for icmDateTimeNumber");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ /* Read the time and date from buffer */
+ if((rv = read_DateTimeNumber(p, bp)) != 0) {
+ sprintf(icp->err,"icmDateTimeNumber_read: Corrupted DateTime");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmDateTimeNumber_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmDateTimeNumber_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmDateTimeNumber_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write all the data to the buffer */
- bp += 8; /* Skip padding */
- if ((rv = write_DateTimeNumber(p, bp)) != 0) {
- sprintf(icp->err,"icmDateTimeNumber_write: write_DateTimeNumber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmDateTimeNumber_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmDateTimeNumber_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmDateTimeNumber_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write all the data to the buffer */
+ bp += 8; /* Skip padding */
+ if ((rv = write_DateTimeNumber(p, bp)) != 0) {
+ sprintf(icp->err,"icmDateTimeNumber_write: write_DateTimeNumber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmDateTimeNumber_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmDateTimeNumber_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
- if (verb <= 0)
- return;
+ icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"DateTimeNumber:\n");
- fprintf(op," Date = %s\n", string_DateTimeNumber(p));
+ fprintf(op,"DateTimeNumber:\n");
+ fprintf(op," Date = %s\n", string_DateTimeNumber(p));
}
/* Allocate variable sized data elements */
static int icmDateTimeNumber_allocate(
- icmBase *pp
+ icmBase *pp
) {
- /* Nothing to do */
- return 0;
+ /* Nothing to do */
+ return 0;
}
/* Free all storage in the object */
static void icmDateTimeNumber_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
- icc *icp = p->icp;
+ icmDateTimeNumber *p = (icmDateTimeNumber *)pp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmDateTimeNumber(
- icc *icp
+ icc *icp
) {
- icmDateTimeNumber *p;
- if ((p = (icmDateTimeNumber *) icp->al->calloc(icp->al,1,sizeof(icmDateTimeNumber))) == NULL)
- return NULL;
- p->ttype = icSigDateTimeType;
- p->refcount = 1;
- p->get_size = icmDateTimeNumber_get_size;
- p->read = icmDateTimeNumber_read;
- p->write = icmDateTimeNumber_write;
- p->dump = icmDateTimeNumber_dump;
- p->allocate = icmDateTimeNumber_allocate;
- p->del = icmDateTimeNumber_delete;
- p->icp = icp;
+ icmDateTimeNumber *p;
+ if ((p = (icmDateTimeNumber *) icp->al->calloc(icp->al,1,sizeof(icmDateTimeNumber))) == NULL)
+ return NULL;
+ p->ttype = icSigDateTimeType;
+ p->refcount = 1;
+ p->get_size = icmDateTimeNumber_get_size;
+ p->read = icmDateTimeNumber_read;
+ p->write = icmDateTimeNumber_write;
+ p->dump = icmDateTimeNumber_dump;
+ p->allocate = icmDateTimeNumber_allocate;
+ p->del = icmDateTimeNumber_delete;
+ p->icp = icp;
- setcur_DateTimeNumber(p); /* Default to current date and time */
- return (icmBase *)p;
+ setcur_DateTimeNumber(p); /* Default to current date and time */
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -4205,80 +4195,80 @@ static icmBase *new_icmDateTimeNumber(
/* Utility function - raise one integer to an integer power */
static int uipow(unsigned int a, unsigned int b, unsigned int *ret) {
- unsigned int rv = 1;
- for (; b > 0; b--) {
- if (a > 0 && rv > UINT_MAX / a)
- return 1;
- rv *= a;
- }
- *ret = rv;
- return 0;
+ unsigned int rv = 1;
+ for (; b > 0; b--) {
+ if (a > 0 && rv > UINT_MAX / a)
+ return 1;
+ rv *= a;
+ }
+ *ret = rv;
+ return 0;
}
/* - - - - - - - - - - - - - - - - */
/* Check if the matrix is non-zero */
static int icmLut_nu_matrix(
- icmLut *p /* Pointer to Lut object */
+ icmLut *p /* Pointer to Lut object */
) {
- int i, j;
-
- for (j = 0; j < 3; j++) { /* Rows */
- for (i = 0; i < 3; i++) { /* Columns */
- if ( (i == j && p->e[j][i] != 1.0)
- || (i != j && p->e[j][i] != 0.0))
- return 1;
- }
- }
- return 0;
+ int i, j;
+
+ for (j = 0; j < 3; j++) { /* Rows */
+ for (i = 0; i < 3; i++) { /* Columns */
+ if ( (i == j && p->e[j][i] != 1.0)
+ || (i != j && p->e[j][i] != 0.0))
+ return 1;
+ }
+ }
+ return 0;
}
/* return the locations of the minimum and */
/* maximum values of the given channel, in the clut */
static void icmLut_min_max(
- icmLut *p, /* Pointer to Lut object */
- double *minp, /* Return position of min/max */
- double *maxp,
- int chan /* Channel, -1 for average of all */
-) {
- double *tp;
- double minv, maxv; /* Values */
- int e, ee, f;
- double gc[MAX_CHAN]; /* Grid coordinate */
-
- minv = 1e6;
- maxv = -1e6;
-
- for (e = 0; e < p->inputChan; e++)
- gc[e] = 0; /* init coords */
-
- /* Search the whole table */
- for (tp = p->clutTable, e = 0; e < p->inputChan; tp += p->outputChan) {
- double v;
- if (chan == -1) {
- for (v = 0.0, f = 0; f < p->outputChan; f++)
- v += tp[f];
- } else {
- v = tp[chan];
- }
- if (v < minv) {
- minv = v;
- for (ee = 0; ee < p->inputChan; ee++)
- minp[ee] = gc[ee]/(p->clutPoints-1.0);
- }
- if (v > maxv) {
- maxv = v;
- for (ee = 0; ee < p->inputChan; ee++)
- maxp[ee] = gc[ee]/(p->clutPoints-1.0);
- }
-
- /* Increment coord */
- for (e = 0; e < p->inputChan; e++) {
- gc[e]++;
- if (gc[e] < p->clutPoints)
- break; /* No carry */
- gc[e] = 0;
- }
- }
+ icmLut *p, /* Pointer to Lut object */
+ double *minp, /* Return position of min/max */
+ double *maxp,
+ int chan /* Channel, -1 for average of all */
+) {
+ double *tp;
+ double minv, maxv; /* Values */
+ int e, ee, f;
+ double gc[MAX_CHAN]; /* Grid coordinate */
+
+ minv = 1e6;
+ maxv = -1e6;
+
+ for (e = 0; e < p->inputChan; e++)
+ gc[e] = 0; /* init coords */
+
+ /* Search the whole table */
+ for (tp = p->clutTable, e = 0; e < p->inputChan; tp += p->outputChan) {
+ double v;
+ if (chan == -1) {
+ for (v = 0.0, f = 0; f < p->outputChan; f++)
+ v += tp[f];
+ } else {
+ v = tp[chan];
+ }
+ if (v < minv) {
+ minv = v;
+ for (ee = 0; ee < p->inputChan; ee++)
+ minp[ee] = gc[ee]/(p->clutPoints-1.0);
+ }
+ if (v > maxv) {
+ maxv = v;
+ for (ee = 0; ee < p->inputChan; ee++)
+ maxp[ee] = gc[ee]/(p->clutPoints-1.0);
+ }
+
+ /* Increment coord */
+ for (e = 0; e < p->inputChan; e++) {
+ gc[e]++;
+ if (gc[e] < p->clutPoints)
+ break; /* No carry */
+ gc[e] = 0;
+ }
+ }
}
/* Convert XYZ throught Luts matrix */
@@ -4288,14 +4278,14 @@ icmLut *p, /* Pointer to Lut object */
double *out, /* Output array[outputChan] in ICC order - see Table 39 in 6.5.5 */
double *in /* Input array[inputChan] */
) {
- double t0,t1; /* Take care if out == in */
- t0 = p->e[0][0] * in[0] + p->e[0][1] * in[1] + p->e[0][2] * in[2];
- t1 = p->e[1][0] * in[0] + p->e[1][1] * in[1] + p->e[1][2] * in[2];
- out[2] = p->e[2][0] * in[0] + p->e[2][1] * in[1] + p->e[2][2] * in[2];
- out[0] = t0;
- out[1] = t1;
+ double t0,t1; /* Take care if out == in */
+ t0 = p->e[0][0] * in[0] + p->e[0][1] * in[1] + p->e[0][2] * in[2];
+ t1 = p->e[1][0] * in[0] + p->e[1][1] * in[1] + p->e[1][2] * in[2];
+ out[2] = p->e[2][0] * in[0] + p->e[2][1] * in[1] + p->e[2][2] * in[2];
+ out[0] = t0;
+ out[1] = t1;
- return 0;
+ return 0;
}
/* Convert normalized numbers though this Luts input tables. */
@@ -4305,30 +4295,30 @@ icmLut *p, /* Pointer to Lut object */
double *out, /* Output array[inputChan] */
double *in /* Input array[inputChan] */
) {
- int rv = 0;
- int ix,n;
- double inputEnt_1 = (double)(p->inputEnt-1);
- double *table = p->inputTable;
-
- /* Use linear interpolation */
- for (n = 0; n < p->inputChan; n++, table += p->inputEnt) {
- double val, w;
- val = in[n] * inputEnt_1;
- if (val < 0.0) {
- val = 0.0;
- rv |= 1;
- } else if (val > inputEnt_1) {
- val = inputEnt_1;
- rv |= 1;
- }
- ix = (int)floor(val); /* Grid coordinate */
- if (ix < 0 || ix > (p->inputEnt-2))
- ix = (p->inputEnt-2);
- w = val - (double)ix; /* weight */
- val = table[ix];
- out[n] = val + w * (table[ix+1] - val);
- }
- return rv;
+ int rv = 0;
+ int ix,n;
+ double inputEnt_1 = (double)(p->inputEnt-1);
+ double *table = p->inputTable;
+
+ /* Use linear interpolation */
+ for (n = 0; n < p->inputChan; n++, table += p->inputEnt) {
+ double val, w;
+ val = in[n] * inputEnt_1;
+ if (val < 0.0) {
+ val = 0.0;
+ rv |= 1;
+ } else if (val > inputEnt_1) {
+ val = inputEnt_1;
+ rv |= 1;
+ }
+ ix = (int)floor(val); /* Grid coordinate */
+ if (ix < 0 || ix > (p->inputEnt-2))
+ ix = (p->inputEnt-2);
+ w = val - (double)ix; /* weight */
+ val = table[ix];
+ out[n] = val + w * (table[ix+1] - val);
+ }
+ return rv;
}
/* Convert normalized numbers though this Luts multi-dimensional table. */
@@ -4339,84 +4329,84 @@ icmLut *p, /* Pointer to Lut object */
double *out, /* Output array[inputChan] */
double *in /* Input array[outputChan] */
) {
- icc *icp = p->icp;
- int rv = 0;
- double *gp; /* Pointer to grid cube base */
- double co[MAX_CHAN]; /* Coordinate offset with the grid cell */
- double *gw, GW[1 << 8]; /* weight for each grid cube corner */
-
- if (p->inputChan <= 8) {
- gw = GW; /* Use stack allocation */
- } else {
- if ((gw = (double *) icp->al->calloc(icp->al, (1 << p->inputChan), sizeof(double))) == NULL) {
- sprintf(icp->err,"icmLut_lookup_clut: calloc() failed");
- return icp->errc = 2;
- }
- }
-
- /* We are using an n-linear (ie. Trilinear for 3D input) interpolation. */
- /* The implementation here uses more multiplies that some other schemes, */
- /* (for instance, see "Tri-Linear Interpolation" by Steve Hill, */
- /* Graphics Gems IV, page 521), but has less involved bookeeping, */
- /* needs less local storage for intermediate output values, does fewer */
- /* output and intermediate value reads, and fp multiplies are fast on */
- /* todays processors! */
-
- /* Compute base index into grid and coordinate offsets */
- {
- int e;
- double clutPoints_1 = (double)(p->clutPoints-1);
- int clutPoints_2 = p->clutPoints-2;
- gp = p->clutTable; /* Base of grid array */
-
- for (e = 0; e < p->inputChan; e++) {
- int x;
- double val;
- val = in[e] * clutPoints_1;
- if (val < 0.0) {
- val = 0.0;
- rv |= 1;
- } else if (val > clutPoints_1) {
- val = clutPoints_1;
- rv |= 1;
- }
- x = (int)floor(val); /* Grid coordinate */
- if (x < 0 || x > clutPoints_2)
- x = clutPoints_2;
- co[e] = val - (double)x; /* 1.0 - weight */
- gp += x * p->dinc[e]; /* Add index offset for base of cube */
- }
- }
- /* Compute corner weights needed for interpolation */
- {
- int e, i, g = 1;
- gw[0] = 1.0;
- for (e = 0; e < p->inputChan; e++) {
- for (i = 0; i < g; i++) {
- gw[g+i] = gw[i] * co[e];
- gw[i] *= (1.0 - co[e]);
- }
- g *= 2;
- }
- }
- /* Now compute the output values */
- {
- int i, f;
- double w = gw[0];
- double *d = gp + p->dcube[0];
- for (f = 0; f < p->outputChan; f++) /* Base of cube */
- out[f] = w * d[f];
- for (i = 1; i < (1 << p->inputChan); i++) { /* For all other corners of cube */
- w = gw[i]; /* Strength reduce */
- d = gp + p->dcube[i];
- for (f = 0; f < p->outputChan; f++) {
- out[f] += w * d[f];
- }
- }
- }
- if (gw != GW)
- icp->al->free(icp->al, (void *)gw);
- return rv;
+ icc *icp = p->icp;
+ int rv = 0;
+ double *gp; /* Pointer to grid cube base */
+ double co[MAX_CHAN]; /* Coordinate offset with the grid cell */
+ double *gw, GW[1 << 8]; /* weight for each grid cube corner */
+
+ if (p->inputChan <= 8) {
+ gw = GW; /* Use stack allocation */
+ } else {
+ if ((gw = (double *) icp->al->calloc(icp->al, (1 << p->inputChan), sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmLut_lookup_clut: calloc() failed");
+ return icp->errc = 2;
+ }
+ }
+
+ /* We are using an n-linear (ie. Trilinear for 3D input) interpolation. */
+ /* The implementation here uses more multiplies that some other schemes, */
+ /* (for instance, see "Tri-Linear Interpolation" by Steve Hill, */
+ /* Graphics Gems IV, page 521), but has less involved bookeeping, */
+ /* needs less local storage for intermediate output values, does fewer */
+ /* output and intermediate value reads, and fp multiplies are fast on */
+ /* todays processors! */
+
+ /* Compute base index into grid and coordinate offsets */
+ {
+ int e;
+ double clutPoints_1 = (double)(p->clutPoints-1);
+ int clutPoints_2 = p->clutPoints-2;
+ gp = p->clutTable; /* Base of grid array */
+
+ for (e = 0; e < p->inputChan; e++) {
+ int x;
+ double val;
+ val = in[e] * clutPoints_1;
+ if (val < 0.0) {
+ val = 0.0;
+ rv |= 1;
+ } else if (val > clutPoints_1) {
+ val = clutPoints_1;
+ rv |= 1;
+ }
+ x = (int)floor(val); /* Grid coordinate */
+ if (x < 0 || x > clutPoints_2)
+ x = clutPoints_2;
+ co[e] = val - (double)x; /* 1.0 - weight */
+ gp += x * p->dinc[e]; /* Add index offset for base of cube */
+ }
+ }
+ /* Compute corner weights needed for interpolation */
+ {
+ int e, i, g = 1;
+ gw[0] = 1.0;
+ for (e = 0; e < p->inputChan; e++) {
+ for (i = 0; i < g; i++) {
+ gw[g+i] = gw[i] * co[e];
+ gw[i] *= (1.0 - co[e]);
+ }
+ g *= 2;
+ }
+ }
+ /* Now compute the output values */
+ {
+ int i, f;
+ double w = gw[0];
+ double *d = gp + p->dcube[0];
+ for (f = 0; f < p->outputChan; f++) /* Base of cube */
+ out[f] = w * d[f];
+ for (i = 1; i < (1 << p->inputChan); i++) { /* For all other corners of cube */
+ w = gw[i]; /* Strength reduce */
+ d = gp + p->dcube[i];
+ for (f = 0; f < p->outputChan; f++) {
+ out[f] += w * d[f];
+ }
+ }
+ }
+ if (gw != GW)
+ icp->al->free(icp->al, (void *)gw);
+ return rv;
}
/* Convert normalized numbers though this Luts multi-dimensional table */
@@ -4427,80 +4417,80 @@ icmLut *p, /* Pointer to Lut object */
double *out, /* Output array[inputChan] */
double *in /* Input array[outputChan] */
) {
- int rv = 0;
- double *gp; /* Pointer to grid cube base */
- double co[MAX_CHAN]; /* Coordinate offset with the grid cell */
- int si[MAX_CHAN]; /* co[] Sort index, [0] = smalest */
-
- /* We are using a simplex (ie. tetrahedral for 3D input) interpolation. */
- /* This method is more appropriate for XYZ/RGB/CMYK input spaces, */
-
- /* Compute base index into grid and coordinate offsets */
- {
- int e;
- double clutPoints_1 = (double)(p->clutPoints-1);
- int clutPoints_2 = p->clutPoints-2;
- gp = p->clutTable; /* Base of grid array */
-
- for (e = 0; e < p->inputChan; e++) {
- int x;
- double val;
- val = in[e] * clutPoints_1;
- if (val < 0.0) {
- val = 0.0;
- rv |= 1;
- } else if (val > clutPoints_1) {
- val = clutPoints_1;
- rv |= 1;
- }
- x = (int)floor(val); /* Grid coordinate */
- if (x < 0 || x > clutPoints_2)
- x = clutPoints_2;
- co[e] = val - (double)x; /* 1.0 - weight */
- gp += x * p->dinc[e]; /* Add index offset for base of cube */
- }
- }
- /* Do selection sort on coordinates */
- {
- int e, f;
- for (e = 0; e < p->inputChan; e++)
- si[e] = e; /* Initial unsorted indexes */
- for (e = 0; e < (p->inputChan-1); e++) {
- double cosn;
- cosn = co[si[e]]; /* Current smallest value */
- for (f = e+1; f < p->inputChan; f++) { /* Check against rest */
- int tt;
- tt = si[f];
- if (cosn > co[tt]) {
- si[f] = si[e]; /* Exchange */
- si[e] = tt;
- cosn = co[tt];
- }
- }
- }
- }
- /* Now compute the weightings, simplex vertices and output values */
- {
- int e, f;
- double w; /* Current vertex weight */
-
- w = 1.0 - co[si[p->inputChan-1]]; /* Vertex at base of cell */
- for (f = 0; f < p->outputChan; f++)
- out[f] = w * gp[f];
-
- for (e = p->inputChan-1; e > 0; e--) { /* Middle verticies */
- w = co[si[e]] - co[si[e-1]];
- gp += p->dinc[si[e]]; /* Move to top of cell in next largest dimension */
- for (f = 0; f < p->outputChan; f++)
- out[f] += w * gp[f];
- }
-
- w = co[si[0]];
- gp += p->dinc[si[0]]; /* Far corner from base of cell */
- for (f = 0; f < p->outputChan; f++)
- out[f] += w * gp[f];
- }
- return rv;
+ int rv = 0;
+ double *gp; /* Pointer to grid cube base */
+ double co[MAX_CHAN]; /* Coordinate offset with the grid cell */
+ int si[MAX_CHAN]; /* co[] Sort index, [0] = smalest */
+
+ /* We are using a simplex (ie. tetrahedral for 3D input) interpolation. */
+ /* This method is more appropriate for XYZ/RGB/CMYK input spaces, */
+
+ /* Compute base index into grid and coordinate offsets */
+ {
+ int e;
+ double clutPoints_1 = (double)(p->clutPoints-1);
+ int clutPoints_2 = p->clutPoints-2;
+ gp = p->clutTable; /* Base of grid array */
+
+ for (e = 0; e < p->inputChan; e++) {
+ int x;
+ double val;
+ val = in[e] * clutPoints_1;
+ if (val < 0.0) {
+ val = 0.0;
+ rv |= 1;
+ } else if (val > clutPoints_1) {
+ val = clutPoints_1;
+ rv |= 1;
+ }
+ x = (int)floor(val); /* Grid coordinate */
+ if (x < 0 || x > clutPoints_2)
+ x = clutPoints_2;
+ co[e] = val - (double)x; /* 1.0 - weight */
+ gp += x * p->dinc[e]; /* Add index offset for base of cube */
+ }
+ }
+ /* Do selection sort on coordinates */
+ {
+ int e, f;
+ for (e = 0; e < p->inputChan; e++)
+ si[e] = e; /* Initial unsorted indexes */
+ for (e = 0; e < (p->inputChan-1); e++) {
+ double cosn;
+ cosn = co[si[e]]; /* Current smallest value */
+ for (f = e+1; f < p->inputChan; f++) { /* Check against rest */
+ int tt;
+ tt = si[f];
+ if (cosn > co[tt]) {
+ si[f] = si[e]; /* Exchange */
+ si[e] = tt;
+ cosn = co[tt];
+ }
+ }
+ }
+ }
+ /* Now compute the weightings, simplex vertices and output values */
+ {
+ int e, f;
+ double w; /* Current vertex weight */
+
+ w = 1.0 - co[si[p->inputChan-1]]; /* Vertex at base of cell */
+ for (f = 0; f < p->outputChan; f++)
+ out[f] = w * gp[f];
+
+ for (e = p->inputChan-1; e > 0; e--) { /* Middle verticies */
+ w = co[si[e]] - co[si[e-1]];
+ gp += p->dinc[si[e]]; /* Move to top of cell in next largest dimension */
+ for (f = 0; f < p->outputChan; f++)
+ out[f] += w * gp[f];
+ }
+
+ w = co[si[0]];
+ gp += p->dinc[si[0]]; /* Far corner from base of cell */
+ for (f = 0; f < p->outputChan; f++)
+ out[f] += w * gp[f];
+ }
+ return rv;
}
/* Convert normalized numbers though this Luts output tables. */
@@ -4510,30 +4500,30 @@ icmLut *p, /* Pointer to Lut object */
double *out, /* Output array[outputChan] */
double *in /* Input array[outputChan] */
) {
- int rv = 0;
- int ix,n;
- double outputEnt_1 = (double)(p->outputEnt-1);
- double *table = p->outputTable;
-
- /* Use linear interpolation */
- for (n = 0; n < p->outputChan; n++, table += p->outputEnt) {
- double val, w;
- val = in[n] * outputEnt_1;
- if (val < 0.0) {
- val = 0.0;
- rv |= 1;
- } else if (val > outputEnt_1) {
- val = outputEnt_1;
- rv |= 1;
- }
- ix = (int)floor(val); /* Grid coordinate */
- if (ix < 0 || ix > (p->outputEnt-2))
- ix = (p->outputEnt-2);
- w = val - (double)ix; /* weight */
- val = table[ix];
- out[n] = val + w * (table[ix+1] - val);
- }
- return rv;
+ int rv = 0;
+ int ix,n;
+ double outputEnt_1 = (double)(p->outputEnt-1);
+ double *table = p->outputTable;
+
+ /* Use linear interpolation */
+ for (n = 0; n < p->outputChan; n++, table += p->outputEnt) {
+ double val, w;
+ val = in[n] * outputEnt_1;
+ if (val < 0.0) {
+ val = 0.0;
+ rv |= 1;
+ } else if (val > outputEnt_1) {
+ val = outputEnt_1;
+ rv |= 1;
+ }
+ ix = (int)floor(val); /* Grid coordinate */
+ if (ix < 0 || ix > (p->outputEnt-2))
+ ix = (p->outputEnt-2);
+ w = val - (double)ix; /* weight */
+ val = table[ix];
+ out[n] = val + w * (table[ix+1] - val);
+ }
+ return rv;
}
/* ----------------------------------------------- */
@@ -4553,31 +4543,31 @@ int di, /* Dimensionality */
unsigned res, /* Size per coordinate */
int co[] /* Coordinates to initialise (May be NULL) */
) {
- int e;
+ int e;
- p->di = di;
- p->res = res;
+ p->di = di;
+ p->res = res;
- /* Compute bits */
- for (p->bits = 0; (1 << p->bits) < res; p->bits++)
- ;
+ /* Compute bits */
+ for (p->bits = 0; (1 << p->bits) < res; p->bits++)
+ ;
- /* Compute the total count mask */
- p->tmask = ((((unsigned)1) << (p->bits * di))-1);
+ /* Compute the total count mask */
+ p->tmask = ((((unsigned)1) << (p->bits * di))-1);
- /* Compute usable count */
- p->count = 1;
- for (e = 0; e < di; e++)
- p->count *= res;
+ /* Compute usable count */
+ p->count = 1;
+ for (e = 0; e < di; e++)
+ p->count *= res;
- p->ix = 0;
+ p->ix = 0;
- if (co != NULL) {
- for (e = 0; e < di; e++)
- co[e] = 0;
- }
+ if (co != NULL) {
+ for (e = 0; e < di; e++)
+ co[e] = 0;
+ }
- return p->count;
+ return p->count;
}
/* Reset the counter */
@@ -4585,7 +4575,7 @@ void
psh_reset(
psh *p /* Pointer to structure */
) {
- p->ix = 0;
+ p->ix = 0;
}
/* Increment pseudo-hilbert coordinates */
@@ -4595,54 +4585,54 @@ psh_inc(
psh *p, /* Pointer to structure */
int co[] /* Coordinates to return */
) {
- int di = p->di;
- int res = p->res;
- int bits = p->bits;
- int e;
-
- do {
- int b;
- int gix; /* Gray code index */
-
- p->ix = (p->ix + 1) & p->tmask;
-
- gix = p->ix ^ (p->ix >> 1); /* Convert to gray code index */
-
- for (e = 0; e < di; e++)
- co[e] = 0;
-
- for (b = 0; b < bits; b++) { /* Distribute bits */
- if (b & 1) {
- for (e = di-1; e >= 0; e--) { /* In reverse order */
- co[e] |= (gix & 1) << b;
- gix >>= 1;
- }
- } else {
- for (e = 0; e < di; e++) { /* In normal order */
- co[e] |= (gix & 1) << b;
- gix >>= 1;
- }
- }
- }
-
- /* Convert from Gray to binary coordinates */
- for (e = 0; e < di; e++) {
- unsigned sh, tv;
-
- for(sh = 1, tv = co[e];; sh <<= 1) {
- unsigned ptv = tv;
- tv ^= (tv >> sh);
- if (ptv <= 1 || sh == 16)
- break;
- }
- if (tv >= res) /* Dumbo filter - increment again if outside cube range */
- break;
- co[e] = tv;
- }
-
- } while (e < di);
-
- return (p->ix == 0);
+ int di = p->di;
+ int res = p->res;
+ int bits = p->bits;
+ int e;
+
+ do {
+ int b;
+ int gix; /* Gray code index */
+
+ p->ix = (p->ix + 1) & p->tmask;
+
+ gix = p->ix ^ (p->ix >> 1); /* Convert to gray code index */
+
+ for (e = 0; e < di; e++)
+ co[e] = 0;
+
+ for (b = 0; b < bits; b++) { /* Distribute bits */
+ if (b & 1) {
+ for (e = di-1; e >= 0; e--) { /* In reverse order */
+ co[e] |= (gix & 1) << b;
+ gix >>= 1;
+ }
+ } else {
+ for (e = 0; e < di; e++) { /* In normal order */
+ co[e] |= (gix & 1) << b;
+ gix >>= 1;
+ }
+ }
+ }
+
+ /* Convert from Gray to binary coordinates */
+ for (e = 0; e < di; e++) {
+ unsigned sh, tv;
+
+ for(sh = 1, tv = co[e];; sh <<= 1) {
+ unsigned ptv = tv;
+ tv ^= (tv >> sh);
+ if (ptv <= 1 || sh == 16)
+ break;
+ }
+ if (tv >= res) /* Dumbo filter - increment again if outside cube range */
+ break;
+ co[e] = tv;
+ }
+
+ } while (e < di);
+
+ return (p->ix == 0);
}
/* ------------------------------------------------------- */
@@ -4658,10 +4648,10 @@ typedef enum {
/* given the color space and Lut type */
/* Return 0 on success, 1 on match failure */
static int getNormFunc(
- icColorSpaceSignature csig,
- icTagTypeSignature tagSig,
- icmNormFlag flag,
- void (**nfunc)(double *out, double *in)
+ icColorSpaceSignature csig,
+ icTagTypeSignature tagSig,
+ icmNormFlag flag,
+ void (**nfunc)(double *out, double *in)
);
/* Helper function to initialize the three tables contents */
@@ -4673,855 +4663,855 @@ void *cbctx, /* Opaque callback context pointer value */
icColorSpaceSignature insig, /* Input color space */
icColorSpaceSignature outsig, /* Output color space */
void (*infunc)(void *cbcntx, double *out, double *in),
- /* Input transfer function, inspace->inspace' (NULL = default) */
+ /* Input transfer function, inspace->inspace' (NULL = default) */
double *inmin, double *inmax, /* Maximum range of inspace' values (NULL = default) */
void (*clutfunc)(void *cbctx, double *out, double *in),
- /* inspace' -> outspace' transfer function */
+ /* inspace' -> outspace' transfer function */
double *clutmin, double *clutmax, /* Maximum range of outspace' values (NULL = default) */
void (*outfunc)(void *cbctx, double *out, double *in)
- /* Output transfer function, outspace'->outspace (NULL = deflt) */
-) {
- icc *icp = p->icp;
- int n, e;
- int ii[MAX_CHAN]; /* Index value */
- psh counter; /* Pseudo-Hilbert counter */
- double _iv[2 * MAX_CHAN], *iv = &_iv[MAX_CHAN]; /* Real index value/table value */
- double imin[MAX_CHAN], imax[MAX_CHAN];
- double omin[MAX_CHAN], omax[MAX_CHAN];
- void (*ifromindex)(double *out, double *in); /* Index to input color space function */
- void (*itoentry)(double *out, double *in); /* Input color space to entry function */
- void (*ifromentry)(double *out, double *in); /* Entry to input color space function */
- void (*otoentry)(double *out, double *in); /* Output colorspace to table value function */
- void (*ofromentry)(double *out, double *in); /* Table value to output color space function */
-
- if (getNormFunc(insig, p->ttype, icmFromLuti, &ifromindex) != 0) {
- sprintf(icp->err,"icmLut_set_tables index to input colorspace function lookup failed");
- return icp->errc = 1;
- }
- if (getNormFunc(insig, p->ttype, icmToLutv, &itoentry) != 0) {
- sprintf(icp->err,"icmLut_set_tables input colorspace to table entry function lookup failed");
- return icp->errc = 1;
- }
- if (getNormFunc(insig, p->ttype, icmFromLutv, &ifromentry) != 0) {
- sprintf(icp->err,"icmLut_set_tables table entry to input colorspace function lookup failed");
- return icp->errc = 1;
- }
-
- if (getNormFunc(outsig, p->ttype, icmToLutv, &otoentry) != 0) {
- sprintf(icp->err,"icmLut_set_tables output colorspace to table entry function lookup failed");
- return icp->errc = 1;
- }
- if (getNormFunc(outsig, p->ttype, icmFromLutv, &ofromentry) != 0) {
- sprintf(icp->err,"icmLut_set_tables table entry to output colorspace function lookup failed");
- return icp->errc = 1;
- }
-
- /* Setup input table value min-max */
- if (inmin == NULL) {
+ /* Output transfer function, outspace'->outspace (NULL = deflt) */
+) {
+ icc *icp = p->icp;
+ int n, e;
+ int ii[MAX_CHAN]; /* Index value */
+ psh counter; /* Pseudo-Hilbert counter */
+ double _iv[2 * MAX_CHAN], *iv = &_iv[MAX_CHAN]; /* Real index value/table value */
+ double imin[MAX_CHAN], imax[MAX_CHAN];
+ double omin[MAX_CHAN], omax[MAX_CHAN];
+ void (*ifromindex)(double *out, double *in); /* Index to input color space function */
+ void (*itoentry)(double *out, double *in); /* Input color space to entry function */
+ void (*ifromentry)(double *out, double *in); /* Entry to input color space function */
+ void (*otoentry)(double *out, double *in); /* Output colorspace to table value function */
+ void (*ofromentry)(double *out, double *in); /* Table value to output color space function */
+
+ if (getNormFunc(insig, p->ttype, icmFromLuti, &ifromindex) != 0) {
+ sprintf(icp->err,"icmLut_set_tables index to input colorspace function lookup failed");
+ return icp->errc = 1;
+ }
+ if (getNormFunc(insig, p->ttype, icmToLutv, &itoentry) != 0) {
+ sprintf(icp->err,"icmLut_set_tables input colorspace to table entry function lookup failed");
+ return icp->errc = 1;
+ }
+ if (getNormFunc(insig, p->ttype, icmFromLutv, &ifromentry) != 0) {
+ sprintf(icp->err,"icmLut_set_tables table entry to input colorspace function lookup failed");
+ return icp->errc = 1;
+ }
+
+ if (getNormFunc(outsig, p->ttype, icmToLutv, &otoentry) != 0) {
+ sprintf(icp->err,"icmLut_set_tables output colorspace to table entry function lookup failed");
+ return icp->errc = 1;
+ }
+ if (getNormFunc(outsig, p->ttype, icmFromLutv, &ofromentry) != 0) {
+ sprintf(icp->err,"icmLut_set_tables table entry to output colorspace function lookup failed");
+ return icp->errc = 1;
+ }
+
+ /* Setup input table value min-max */
+ if (inmin == NULL) {
#ifdef SYMETRICAL_DEFAULT_LAB_RANGE /* Try symetrical range */
- if (insig == icSigLabData) { /* Special case Lab */
- double mn[3], mx[3];
- /* Because the symetric range will cause slight clipping, */
- /* only do it if the input table has sufficient resolution */
- /* to represent the clipping faithfuly. */
- if (p->inputEnt >= 64) {
- mn[0] = 0.0, mn[1] = -127.0, mn[2] = -127.0;
- mx[0] = 100.0, mx[1] = 127.0, mx[2] = 127.0;
- itoentry(imin, mn); /* Convert from input color space to table representation */
- itoentry(imax, mx);
- } else {
- for (e = 0; e < p->inputChan; e++) {
- imin[e] = 0.0;
- imax[e] = 1.0;
- }
- }
- } else
+ if (insig == icSigLabData) { /* Special case Lab */
+ double mn[3], mx[3];
+ /* Because the symetric range will cause slight clipping, */
+ /* only do it if the input table has sufficient resolution */
+ /* to represent the clipping faithfuly. */
+ if (p->inputEnt >= 64) {
+ mn[0] = 0.0, mn[1] = -127.0, mn[2] = -127.0;
+ mx[0] = 100.0, mx[1] = 127.0, mx[2] = 127.0;
+ itoentry(imin, mn); /* Convert from input color space to table representation */
+ itoentry(imax, mx);
+ } else {
+ for (e = 0; e < p->inputChan; e++) {
+ imin[e] = 0.0;
+ imax[e] = 1.0;
+ }
+ }
+ } else
#endif
- {
- for (e = 0; e < p->inputChan; e++) {
- imin[e] = 0.0; /* We are assuming this is true for all other color spaces. */
- imax[e] = 1.0;
- }
- }
- } else {
- itoentry(imin, inmin); /* Convert from input color space to table representation */
- itoentry(imax, inmax);
- }
-
- /* Setup output table value min-max */
- if (clutmin == NULL) {
+ {
+ for (e = 0; e < p->inputChan; e++) {
+ imin[e] = 0.0; /* We are assuming this is true for all other color spaces. */
+ imax[e] = 1.0;
+ }
+ }
+ } else {
+ itoentry(imin, inmin); /* Convert from input color space to table representation */
+ itoentry(imax, inmax);
+ }
+
+ /* Setup output table value min-max */
+ if (clutmin == NULL) {
#ifdef SYMETRICAL_DEFAULT_LAB_RANGE /* Try symetrical range */
- if (outsig == icSigLabData) { /* Special case Lab */
- double mn[3], mx[3];
- /* Because the symetric range will cause slight clipping, */
- /* only do it if the output table has sufficient resolution */
- /* to represent the clipping faithfuly. */
- if (p->outputEnt >= 64) {
- mn[0] = 0.0, mn[1] = -127.0, mn[2] = -127.0;
- mx[0] = 100.0, mx[1] = 127.0, mx[2] = 127.0;
- otoentry(omin, mn);/* Convert from output color space to table representation */
- otoentry(omax, mx);
- } else {
- for (e = 0; e < p->inputChan; e++) {
- omin[e] = 0.0;
- omax[e] = 1.0;
- }
- }
- } else
+ if (outsig == icSigLabData) { /* Special case Lab */
+ double mn[3], mx[3];
+ /* Because the symetric range will cause slight clipping, */
+ /* only do it if the output table has sufficient resolution */
+ /* to represent the clipping faithfuly. */
+ if (p->outputEnt >= 64) {
+ mn[0] = 0.0, mn[1] = -127.0, mn[2] = -127.0;
+ mx[0] = 100.0, mx[1] = 127.0, mx[2] = 127.0;
+ otoentry(omin, mn);/* Convert from output color space to table representation */
+ otoentry(omax, mx);
+ } else {
+ for (e = 0; e < p->inputChan; e++) {
+ omin[e] = 0.0;
+ omax[e] = 1.0;
+ }
+ }
+ } else
#endif
- {
- for (e = 0; e < p->outputChan; e++) {
- omin[e] = 0.0; /* We are assuming this is true for all other color spaces. */
- omax[e] = 1.0;
- }
- }
- } else {
- otoentry(omin, clutmin);/* Convert from output color space to table representation */
- otoentry(omax, clutmax);
- }
-
- /* Create the input table entry values */
- for (n = 0; n < p->inputEnt; n++) {
- double fv;
- fv = n/(p->inputEnt-1.0);
- for (e = 0; e < p->inputChan; e++)
- iv[e] = fv;
-
- ifromindex(iv,iv); /* Convert from index value to input color space value */
-
- if (infunc != NULL)
- infunc(cbctx, iv, iv); /* In colorspace -> input table -> In colorspace. */
-
- itoentry(iv,iv); /* Convert from input color space value to table value */
-
- /* Expand used range to 0.0 - 1.0, and clip to legal values */
- /* Note that if the range is reduced, and clipping occurs, */
- /* then there should be enough resolution within the input */
- /* table, to represent the sharp edges of the clipping. */
- for (e = 0; e < p->inputChan; e++) {
- double tt;
- tt = (iv[e] - imin[e])/(imax[e] - imin[e]);
- if (tt < 0.0)
- tt = 0.0;
- else if (tt > 1.0)
- tt = 1.0;
- iv[e] = tt;
- }
-
- for (e = 0; e < p->inputChan; e++) /* Input tables */
- p->inputTable[e * p->inputEnt + n] = iv[e];
- }
-
- /* Create the multi-dimensional lookup table values */
-
- /* To make this clut function cache friendly, we use the pseudo-hilbert */
- /* count sequence. This keeps each point close to the last in the */
- /* multi-dimensional space. */
-
- psh_init(&counter, p->inputChan, p->clutPoints, ii); /* Initialise counter */
-
- /* Itterate through all verticies in the grid */
- for (;;) {
- int ti; /* Table index */
-
- for (ti = e = 0; e < p->inputChan; e++) { /* Input tables */
- ti += ii[e] * p->dinc[e]; /* Clut index */
- iv[e] = ii[e]/(p->clutPoints-1.0); /* Vertex coordinates */
- iv[e] = iv[e] * (imax[e] - imin[e]) + imin[e]; /* Undo expansion to 0.0 - 1.0 */
- *((int *)&iv[-e-1]) = ii[e]; /* Trick to supply grid index in iv[] */
- }
-
- ifromentry(iv,iv); /* Convert from table value to input color space */
-
- /* Apply incolor -> outcolor function we want to represent */
- clutfunc(cbctx, iv, iv);
-
- otoentry(iv,iv); /* Convert from output color space value to table value */
-
- /* Expand used range to 0.0 - 1.0, and clip to legal values */
- for (e = 0; e < p->outputChan; e++) {
- double tt;
- tt = (iv[e] - omin[e])/(omax[e] - omin[e]);
- if (tt < 0.0)
- tt = 0.0;
- else if (tt > 1.0)
- tt = 1.0;
- iv[e] = tt;
- }
-
- for (e = 0; e < p->outputChan; e++) /* Output chans */
- p->clutTable[ti++] = iv[e];
-
- /* Increment index within block (Reverse index significancd) */
- if (psh_inc(&counter, ii))
- break;
- }
-
- /* Create the output table entry values */
- for (n = 0; n < p->outputEnt; n++) {
- double fv;
- fv = n/(p->outputEnt-1.0);
- for (e = 0; e < p->outputChan; e++)
- iv[e] = fv;
-
- /* Undo expansion to 0.0 - 1.0 */
- for (e = 0; e < p->outputChan; e++) /* Output tables */
- iv[e] = iv[e] * (omax[e] - omin[e]) + omin[e];
-
- ofromentry(iv,iv); /* Convert from table value to output color space value */
-
- if (outfunc != NULL)
- outfunc(cbctx, iv, iv); /* Out colorspace -> output table -> out colorspace. */
-
- otoentry(iv,iv); /* Convert from output color space value to table value */
-
- /* Clip to legal values */
- for (e = 0; e < p->outputChan; e++) {
- double tt;
- tt = iv[e];
- if (tt < 0.0)
- tt = 0.0;
- else if (tt > 1.0)
- tt = 1.0;
- iv[e] = tt;
- }
-
- for (e = 0; e < p->outputChan; e++) /* Input tables */
- p->outputTable[e * p->outputEnt + n] = iv[e];
- }
- return 0;
+ {
+ for (e = 0; e < p->outputChan; e++) {
+ omin[e] = 0.0; /* We are assuming this is true for all other color spaces. */
+ omax[e] = 1.0;
+ }
+ }
+ } else {
+ otoentry(omin, clutmin);/* Convert from output color space to table representation */
+ otoentry(omax, clutmax);
+ }
+
+ /* Create the input table entry values */
+ for (n = 0; n < p->inputEnt; n++) {
+ double fv;
+ fv = n/(p->inputEnt-1.0);
+ for (e = 0; e < p->inputChan; e++)
+ iv[e] = fv;
+
+ ifromindex(iv,iv); /* Convert from index value to input color space value */
+
+ if (infunc != NULL)
+ infunc(cbctx, iv, iv); /* In colorspace -> input table -> In colorspace. */
+
+ itoentry(iv,iv); /* Convert from input color space value to table value */
+
+ /* Expand used range to 0.0 - 1.0, and clip to legal values */
+ /* Note that if the range is reduced, and clipping occurs, */
+ /* then there should be enough resolution within the input */
+ /* table, to represent the sharp edges of the clipping. */
+ for (e = 0; e < p->inputChan; e++) {
+ double tt;
+ tt = (iv[e] - imin[e])/(imax[e] - imin[e]);
+ if (tt < 0.0)
+ tt = 0.0;
+ else if (tt > 1.0)
+ tt = 1.0;
+ iv[e] = tt;
+ }
+
+ for (e = 0; e < p->inputChan; e++) /* Input tables */
+ p->inputTable[e * p->inputEnt + n] = iv[e];
+ }
+
+ /* Create the multi-dimensional lookup table values */
+
+ /* To make this clut function cache friendly, we use the pseudo-hilbert */
+ /* count sequence. This keeps each point close to the last in the */
+ /* multi-dimensional space. */
+
+ psh_init(&counter, p->inputChan, p->clutPoints, ii); /* Initialise counter */
+
+ /* Itterate through all verticies in the grid */
+ for (;;) {
+ int ti; /* Table index */
+
+ for (ti = e = 0; e < p->inputChan; e++) { /* Input tables */
+ ti += ii[e] * p->dinc[e]; /* Clut index */
+ iv[e] = ii[e]/(p->clutPoints-1.0); /* Vertex coordinates */
+ iv[e] = iv[e] * (imax[e] - imin[e]) + imin[e]; /* Undo expansion to 0.0 - 1.0 */
+ *((int *)&iv[-e-1]) = ii[e]; /* Trick to supply grid index in iv[] */
+ }
+
+ ifromentry(iv,iv); /* Convert from table value to input color space */
+
+ /* Apply incolor -> outcolor function we want to represent */
+ clutfunc(cbctx, iv, iv);
+
+ otoentry(iv,iv); /* Convert from output color space value to table value */
+
+ /* Expand used range to 0.0 - 1.0, and clip to legal values */
+ for (e = 0; e < p->outputChan; e++) {
+ double tt;
+ tt = (iv[e] - omin[e])/(omax[e] - omin[e]);
+ if (tt < 0.0)
+ tt = 0.0;
+ else if (tt > 1.0)
+ tt = 1.0;
+ iv[e] = tt;
+ }
+
+ for (e = 0; e < p->outputChan; e++) /* Output chans */
+ p->clutTable[ti++] = iv[e];
+
+ /* Increment index within block (Reverse index significancd) */
+ if (psh_inc(&counter, ii))
+ break;
+ }
+
+ /* Create the output table entry values */
+ for (n = 0; n < p->outputEnt; n++) {
+ double fv;
+ fv = n/(p->outputEnt-1.0);
+ for (e = 0; e < p->outputChan; e++)
+ iv[e] = fv;
+
+ /* Undo expansion to 0.0 - 1.0 */
+ for (e = 0; e < p->outputChan; e++) /* Output tables */
+ iv[e] = iv[e] * (omax[e] - omin[e]) + omin[e];
+
+ ofromentry(iv,iv); /* Convert from table value to output color space value */
+
+ if (outfunc != NULL)
+ outfunc(cbctx, iv, iv); /* Out colorspace -> output table -> out colorspace. */
+
+ otoentry(iv,iv); /* Convert from output color space value to table value */
+
+ /* Clip to legal values */
+ for (e = 0; e < p->outputChan; e++) {
+ double tt;
+ tt = iv[e];
+ if (tt < 0.0)
+ tt = 0.0;
+ else if (tt > 1.0)
+ tt = 1.0;
+ iv[e] = tt;
+ }
+
+ for (e = 0; e < p->outputChan; e++) /* Input tables */
+ p->outputTable[e * p->outputEnt + n] = iv[e];
+ }
+ return 0;
}
/* - - - - - - - - - - - - - - - - */
/* Return the number of bytes needed to write this tag */
static unsigned int icmLut_get_size(
- icmBase *pp
-) {
- icmLut *p = (icmLut *)pp;
- unsigned int len = 0;
- unsigned int pw;
-
- if (p->ttype == icSigLut8Type) {
- len += 48; /* tag and header */
- if (p->inputChan > 0 &&
- p->inputEnt > (UINT_MAX - len) / p->inputChan / 1)
- goto overflow;
-
- len += 1 * (p->inputChan * p->inputEnt);
- if (uipow(p->clutPoints,p->inputChan, &pw) ||
- (p->outputChan > 0 &&
- pw > (UINT_MAX - len) / p->outputChan / 1))
- goto overflow;
-
- len += 1 * (p->outputChan * pw);
- if (p->outputChan > 0 &&
- p->outputEnt > (UINT_MAX - len) / p->outputChan / 1)
- goto overflow;
-
- len += 1 * (p->outputChan * p->outputEnt);
- } else {
- len += 52; /* tag and header */
- if (p->inputChan > 0 &&
- p->inputEnt > (UINT_MAX - len) / p->inputChan / 2)
- goto overflow;
-
- len += 2 * (p->inputChan * p->inputEnt);
- if (uipow(p->clutPoints,p->inputChan, &pw) ||
- (p->outputChan > 0 &&
- pw > (UINT_MAX - len) / p->outputChan / 2))
- goto overflow;
-
- len += 2 * (p->outputChan * pw);
- if (p->outputChan > 0 &&
- p->outputEnt > (UINT_MAX - len) / p->outputChan / 2)
- goto overflow;
-
- len += 2 * (p->outputChan * p->outputEnt);
- }
- return len;
+ icmBase *pp
+) {
+ icmLut *p = (icmLut *)pp;
+ unsigned int len = 0;
+ unsigned int pw;
+
+ if (p->ttype == icSigLut8Type) {
+ len += 48; /* tag and header */
+ if (p->inputChan > 0 &&
+ p->inputEnt > (UINT_MAX - len) / p->inputChan / 1)
+ goto overflow;
+
+ len += 1 * (p->inputChan * p->inputEnt);
+ if (uipow(p->clutPoints,p->inputChan, &pw) ||
+ (p->outputChan > 0 &&
+ pw > (UINT_MAX - len) / p->outputChan / 1))
+ goto overflow;
+
+ len += 1 * (p->outputChan * pw);
+ if (p->outputChan > 0 &&
+ p->outputEnt > (UINT_MAX - len) / p->outputChan / 1)
+ goto overflow;
+
+ len += 1 * (p->outputChan * p->outputEnt);
+ } else {
+ len += 52; /* tag and header */
+ if (p->inputChan > 0 &&
+ p->inputEnt > (UINT_MAX - len) / p->inputChan / 2)
+ goto overflow;
+
+ len += 2 * (p->inputChan * p->inputEnt);
+ if (uipow(p->clutPoints,p->inputChan, &pw) ||
+ (p->outputChan > 0 &&
+ pw > (UINT_MAX - len) / p->outputChan / 2))
+ goto overflow;
+
+ len += 2 * (p->outputChan * pw);
+ if (p->outputChan > 0 &&
+ p->outputEnt > (UINT_MAX - len) / p->outputChan / 2)
+ goto overflow;
+
+ len += 2 * (p->outputChan * p->outputEnt);
+ }
+ return len;
overflow:
- p->icp->errc = 1;
- return (unsigned int) -1;
+ p->icp->errc = 1;
+ return (unsigned int) -1;
}
/* read the object, return 0 on success, error code on fail */
static int icmLut_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmLut *p = (icmLut *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i, j, g, size;
- unsigned int pw;
- char *bp, *buf;
-
- if (len < 4) {
- sprintf(icp->err,"icmLut_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmLut_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmLut_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- p->ttype = (icTagTypeSignature)read_SInt32Number(bp);
- if (p->ttype != icSigLut8Type && p->ttype != icSigLut16Type) {
- sprintf(icp->err,"icmLut_read: Wrong tag type for icmLut");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- if (p->ttype == icSigLut8Type) {
- if (len < 48) {
- sprintf(icp->err,"icmLut_read: Tag too small to be legal");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- } else {
- if (len < 52) {
- sprintf(icp->err,"icmLut_read: Tag too small to be legal");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
-
- /* Read in the info common to 8 and 16 bit Lut */
- p->inputChan = read_UInt8Number(bp+8);
- p->outputChan = read_UInt8Number(bp+9);
- p->clutPoints = read_UInt8Number(bp+10);
-
- /* Sanity check */
- if (p->inputChan > MAX_CHAN) {
- sprintf(icp->err,"icmLut_read: Can't handle > %d input channels\n",MAX_CHAN);
- return icp->errc = 1;
- }
-
- if (p->outputChan > MAX_CHAN) {
- sprintf(icp->err,"icmLut_read: Can't handle > %d output channels\n",MAX_CHAN);
- return icp->errc = 1;
- }
-
- if (p->clutPoints > 255) {
- sprintf(icp->err,"icmLut_read: too many clutPoints");
- return icp->errc = 1;
- }
-
- /* Read 3x3 transform matrix */
- for (j = 0; j < 3; j++) { /* Rows */
- for (i = 0; i < 3; i++) { /* Columns */
- p->e[j][i] = read_S15Fixed16Number(bp + 12 + ((j * 3 + i) * 4));
- }
- }
- /* Read 16 bit specific stuff */
- if (p->ttype == icSigLut8Type) {
- p->inputEnt = 256; /* By definition */
- p->outputEnt = 256; /* By definition */
- bp = buf+48;
- } else {
- p->inputEnt = read_UInt16Number(bp+48);
- p->outputEnt = read_UInt16Number(bp+50);
- bp = buf+52;
- }
-
- if (len < icmLut_get_size((icmBase *)p) || icp->errc) {
- sprintf(icp->err,"icmLut_read: Tag too small for contents");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read the input tables */
- if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
- sprintf(icp->err,"icmLut_read: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->inputChan * p->inputEnt);
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1)
- p->inputTable[i] = read_DCS8Number(bp);
- } else {
- for (i = 0; i < size; i++, bp += 2)
- p->inputTable[i] = read_DCS16Number(bp);
- }
-
- /* Read the clut table */
- if (uipow(p->clutPoints,p->inputChan,&pw) ||
- (p->outputChan > 0 &&
- pw > UINT_MAX / p->outputChan)) {
- sprintf(icp->err,"icmLut_read: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->outputChan * pw);
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1)
- p->clutTable[i] = read_DCS8Number(bp);
- } else {
- for (i = 0; i < size; i++, bp += 2)
- p->clutTable[i] = read_DCS16Number(bp);
- }
-
- /* Read the output tables */
- if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
- sprintf(icp->err,"icmLut_read: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->outputChan * p->outputEnt);
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1)
- p->outputTable[i] = read_DCS8Number(bp);
- } else {
- for (i = 0; i < size; i++, bp += 2)
- p->outputTable[i] = read_DCS16Number(bp);
- }
-
- /* Private: compute dimensional increment though clut */
- /* Note that first channel varies least rapidly. */
- i = p->inputChan-1;
- p->dinc[i--] = p->outputChan;
- for (; i < p->inputChan; i--)
- p->dinc[i] = p->dinc[i+1] * p->clutPoints;
-
- /* Private: compute offsets from base of cube to other corners */
- for (p->dcube[0] = 0, g = 1, j = 0; j < p->inputChan; j++) {
- for (i = 0; i < g; i++)
- p->dcube[g+i] = p->dcube[i] + p->dinc[j];
- g *= 2;
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmLut *p = (icmLut *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i, j, g, size;
+ unsigned int pw;
+ char *bp, *buf;
+
+ if (len < 4) {
+ sprintf(icp->err,"icmLut_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmLut_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmLut_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ p->ttype = (icTagTypeSignature)read_SInt32Number(bp);
+ if (p->ttype != icSigLut8Type && p->ttype != icSigLut16Type) {
+ sprintf(icp->err,"icmLut_read: Wrong tag type for icmLut");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ if (p->ttype == icSigLut8Type) {
+ if (len < 48) {
+ sprintf(icp->err,"icmLut_read: Tag too small to be legal");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ } else {
+ if (len < 52) {
+ sprintf(icp->err,"icmLut_read: Tag too small to be legal");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+
+ /* Read in the info common to 8 and 16 bit Lut */
+ p->inputChan = read_UInt8Number(bp+8);
+ p->outputChan = read_UInt8Number(bp+9);
+ p->clutPoints = read_UInt8Number(bp+10);
+
+ /* Sanity check */
+ if (p->inputChan > MAX_CHAN) {
+ sprintf(icp->err,"icmLut_read: Can't handle > %d input channels\n",MAX_CHAN);
+ return icp->errc = 1;
+ }
+
+ if (p->outputChan > MAX_CHAN) {
+ sprintf(icp->err,"icmLut_read: Can't handle > %d output channels\n",MAX_CHAN);
+ return icp->errc = 1;
+ }
+
+ if (p->clutPoints > 255) {
+ sprintf(icp->err,"icmLut_read: too many clutPoints");
+ return icp->errc = 1;
+ }
+
+ /* Read 3x3 transform matrix */
+ for (j = 0; j < 3; j++) { /* Rows */
+ for (i = 0; i < 3; i++) { /* Columns */
+ p->e[j][i] = read_S15Fixed16Number(bp + 12 + ((j * 3 + i) * 4));
+ }
+ }
+ /* Read 16 bit specific stuff */
+ if (p->ttype == icSigLut8Type) {
+ p->inputEnt = 256; /* By definition */
+ p->outputEnt = 256; /* By definition */
+ bp = buf+48;
+ } else {
+ p->inputEnt = read_UInt16Number(bp+48);
+ p->outputEnt = read_UInt16Number(bp+50);
+ bp = buf+52;
+ }
+
+ if (len < icmLut_get_size((icmBase *)p) || icp->errc) {
+ sprintf(icp->err,"icmLut_read: Tag too small for contents");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read the input tables */
+ if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
+ sprintf(icp->err,"icmLut_read: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->inputChan * p->inputEnt);
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1)
+ p->inputTable[i] = read_DCS8Number(bp);
+ } else {
+ for (i = 0; i < size; i++, bp += 2)
+ p->inputTable[i] = read_DCS16Number(bp);
+ }
+
+ /* Read the clut table */
+ if (uipow(p->clutPoints,p->inputChan,&pw) ||
+ (p->outputChan > 0 &&
+ pw > UINT_MAX / p->outputChan)) {
+ sprintf(icp->err,"icmLut_read: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * pw);
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1)
+ p->clutTable[i] = read_DCS8Number(bp);
+ } else {
+ for (i = 0; i < size; i++, bp += 2)
+ p->clutTable[i] = read_DCS16Number(bp);
+ }
+
+ /* Read the output tables */
+ if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
+ sprintf(icp->err,"icmLut_read: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * p->outputEnt);
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1)
+ p->outputTable[i] = read_DCS8Number(bp);
+ } else {
+ for (i = 0; i < size; i++, bp += 2)
+ p->outputTable[i] = read_DCS16Number(bp);
+ }
+
+ /* Private: compute dimensional increment though clut */
+ /* Note that first channel varies least rapidly. */
+ i = p->inputChan-1;
+ p->dinc[i--] = p->outputChan;
+ for (; i < p->inputChan; i--)
+ p->dinc[i] = p->dinc[i+1] * p->clutPoints;
+
+ /* Private: compute offsets from base of cube to other corners */
+ for (p->dcube[0] = 0, g = 1, j = 0; j < p->inputChan; j++) {
+ for (i = 0; i < g; i++)
+ p->dcube[g+i] = p->dcube[i] + p->dinc[j];
+ g *= 2;
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmLut_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmLut *p = (icmLut *)pp;
- icc *icp = p->icp;
- unsigned long i,j;
- unsigned int len, size, pw;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmLut_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmLut_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write the info common to 8 and 16 bit Lut */
- if ((rv = write_UInt8Number(p->inputChan, bp+8)) != 0) {
- sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt8Number(p->outputChan, bp+9)) != 0) {
- sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt8Number(p->clutPoints, bp+10)) != 0) {
- sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write 3x3 transform matrix */
- for (j = 0; j < 3; j++) { /* Rows */
- for (i = 0; i < 3; i++) { /* Columns */
- if ((rv = write_S15Fixed16Number(p->e[j][i],bp + 12 + ((j * 3 + i) * 4))) != 0) {
- sprintf(icp->err,"icmLut_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write 16 bit specific stuff */
- if (p->ttype == icSigLut8Type) {
- if (p->inputEnt != 256 || p->outputEnt != 256) {
- sprintf(icp->err,"icmLut_write: 8 bit Input and Output tables must be 256 entries");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp = buf+48;
- } else {
- if ((rv = write_UInt16Number(p->inputEnt, bp+48)) != 0) {
- sprintf(icp->err,"icmLut_write: write_UInt16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt16Number(p->outputEnt, bp+50)) != 0) {
- sprintf(icp->err,"icmLut_write: write_UInt16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp = buf+52;
- }
-
- /* Write the input tables */
- if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
- sprintf(icp->err,"icmLut_write: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->inputChan * p->inputEnt);
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1) {
- if ((rv = write_DCS8Number(p->inputTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: inputTable write_DCS8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- } else {
- for (i = 0; i < size; i++, bp += 2) {
- if ((rv = write_DCS16Number(p->inputTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: inputTable write_DCS16Number(%f) failed",p->inputTable[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write the clut table */
- if (uipow(p->clutPoints,p->inputChan,&pw) ||
- (p->outputChan > 0 &&
- pw > UINT_MAX / p->outputChan)) {
- sprintf(icp->err,"icmLut_write: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->outputChan * pw);
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1) {
- if ((rv = write_DCS8Number(p->clutTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: clutTable write_DCS8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- } else {
- for (i = 0; i < size; i++, bp += 2) {
- if ((rv = write_DCS16Number(p->clutTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: clutTable write_DCS16Number(%f) failed",p->clutTable[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write the output tables */
- if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
- sprintf(icp->err,"icmLut_write: overflow");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- size = (p->outputChan * p->outputEnt);
- if (p->ttype == icSigLut8Type) {
- for (i = 0; i < size; i++, bp += 1) {
- if ((rv = write_DCS8Number(p->outputTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: outputTable write_DCS8Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- } else {
- for (i = 0; i < size; i++, bp += 2) {
- if ((rv = write_DCS16Number(p->outputTable[i], bp)) != 0) {
- sprintf(icp->err,"icmLut_write: outputTable write_DCS16Number(%f) failed",p->outputTable[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write buffer to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmLut_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmLut *p = (icmLut *)pp;
+ icc *icp = p->icp;
+ unsigned long i,j;
+ unsigned int len, size, pw;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmLut_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write the info common to 8 and 16 bit Lut */
+ if ((rv = write_UInt8Number(p->inputChan, bp+8)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt8Number(p->outputChan, bp+9)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt8Number(p->clutPoints, bp+10)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_UInt8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write 3x3 transform matrix */
+ for (j = 0; j < 3; j++) { /* Rows */
+ for (i = 0; i < 3; i++) { /* Columns */
+ if ((rv = write_S15Fixed16Number(p->e[j][i],bp + 12 + ((j * 3 + i) * 4))) != 0) {
+ sprintf(icp->err,"icmLut_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write 16 bit specific stuff */
+ if (p->ttype == icSigLut8Type) {
+ if (p->inputEnt != 256 || p->outputEnt != 256) {
+ sprintf(icp->err,"icmLut_write: 8 bit Input and Output tables must be 256 entries");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp = buf+48;
+ } else {
+ if ((rv = write_UInt16Number(p->inputEnt, bp+48)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_UInt16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt16Number(p->outputEnt, bp+50)) != 0) {
+ sprintf(icp->err,"icmLut_write: write_UInt16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp = buf+52;
+ }
+
+ /* Write the input tables */
+ if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
+ sprintf(icp->err,"icmLut_write: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->inputChan * p->inputEnt);
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1) {
+ if ((rv = write_DCS8Number(p->inputTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: inputTable write_DCS8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ } else {
+ for (i = 0; i < size; i++, bp += 2) {
+ if ((rv = write_DCS16Number(p->inputTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: inputTable write_DCS16Number(%f) failed",p->inputTable[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write the clut table */
+ if (uipow(p->clutPoints,p->inputChan,&pw) ||
+ (p->outputChan > 0 &&
+ pw > UINT_MAX / p->outputChan)) {
+ sprintf(icp->err,"icmLut_write: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * pw);
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1) {
+ if ((rv = write_DCS8Number(p->clutTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: clutTable write_DCS8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ } else {
+ for (i = 0; i < size; i++, bp += 2) {
+ if ((rv = write_DCS16Number(p->clutTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: clutTable write_DCS16Number(%f) failed",p->clutTable[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write the output tables */
+ if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
+ sprintf(icp->err,"icmLut_write: overflow");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * p->outputEnt);
+ if (p->ttype == icSigLut8Type) {
+ for (i = 0; i < size; i++, bp += 1) {
+ if ((rv = write_DCS8Number(p->outputTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: outputTable write_DCS8Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ } else {
+ for (i = 0; i < size; i++, bp += 2) {
+ if ((rv = write_DCS16Number(p->outputTable[i], bp)) != 0) {
+ sprintf(icp->err,"icmLut_write: outputTable write_DCS16Number(%f) failed",p->outputTable[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write buffer to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmLut_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmLut_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmLut *p = (icmLut *)pp;
- if (verb <= 0)
- return;
-
- if (p->ttype == icSigLut8Type) {
- fprintf(op,"Lut8:\n");
- } else {
- fprintf(op,"Lut16:\n");
- }
- fprintf(op," Input Channels = %u\n",p->inputChan);
- fprintf(op," Output Channels = %u\n",p->outputChan);
- fprintf(op," CLUT resolution = %u\n",p->clutPoints);
- fprintf(op," Input Table entries = %u\n",p->inputEnt);
- fprintf(op," Output Table entries = %u\n",p->outputEnt);
- fprintf(op," XYZ matrix = %f, %f, %f\n",p->e[0][0],p->e[0][1],p->e[0][2]);
- fprintf(op," %f, %f, %f\n",p->e[1][0],p->e[1][1],p->e[1][2]);
- fprintf(op," %f, %f, %f\n",p->e[2][0],p->e[2][1],p->e[2][2]);
-
- if (verb >= 2) {
- unsigned int i,size;
- int j;
- unsigned int ii[MAX_CHAN]; /* maximum no of input channels */
-
- fprintf(op," Input table:\n");
- for (i = 0; i < p->inputEnt; i++) {
- fprintf(op," %3u: ",i);
- for (j = 0; j < p->inputChan; j++)
- fprintf(op," %1.10f",p->inputTable[j * p->inputEnt + i]);
- fprintf(op,"\n");
- }
-
- fprintf(op,"\n CLUT table:\n");
- if (p->inputChan > MAX_CHAN) {
- fprintf(op," !!Can't dump > %d input channel CLUT table!!\n",MAX_CHAN);
- } else {
- unsigned int pw;
- if (uipow(p->clutPoints,p->inputChan,&pw) ||
- (p->outputChan > 0 &&
- pw > UINT_MAX / p->outputChan)) {
- fprintf(op,"Would overflow.\n");
- return;
- }
- size = (p->outputChan * pw);
- for (j = 0; j < p->inputChan; j++)
- ii[j] = 0;
- for (i = 0; i < size;) {
- int k;
- /* Print table entry index */
- fprintf(op," ");
- for (j = p->inputChan-1; j >= 0; j--)
- fprintf(op," %2u",ii[j]);
- fprintf(op,":");
- /* Print table entry contents */
- for (k = 0; k < p->outputChan; k++, i++)
- fprintf(op," %1.10f",p->clutTable[i]);
- fprintf(op,"\n");
-
- for (j = 0; j < p->inputChan; j++) { /* Increment index */
- ii[j]++;
- if (ii[j] < p->clutPoints)
- break; /* No carry */
- ii[j] = 0;
- }
- }
- }
-
- fprintf(op,"\n Output table:\n");
- for (i = 0; i < p->outputEnt; i++) {
- fprintf(op," %3u: ",i);
- for (j = 0; j < p->outputChan; j++)
- fprintf(op," %1.10f",p->outputTable[j * p->outputEnt + i]);
- fprintf(op,"\n");
- }
-
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmLut *p = (icmLut *)pp;
+ if (verb <= 0)
+ return;
+
+ if (p->ttype == icSigLut8Type) {
+ fprintf(op,"Lut8:\n");
+ } else {
+ fprintf(op,"Lut16:\n");
+ }
+ fprintf(op," Input Channels = %u\n",p->inputChan);
+ fprintf(op," Output Channels = %u\n",p->outputChan);
+ fprintf(op," CLUT resolution = %u\n",p->clutPoints);
+ fprintf(op," Input Table entries = %u\n",p->inputEnt);
+ fprintf(op," Output Table entries = %u\n",p->outputEnt);
+ fprintf(op," XYZ matrix = %f, %f, %f\n",p->e[0][0],p->e[0][1],p->e[0][2]);
+ fprintf(op," %f, %f, %f\n",p->e[1][0],p->e[1][1],p->e[1][2]);
+ fprintf(op," %f, %f, %f\n",p->e[2][0],p->e[2][1],p->e[2][2]);
+
+ if (verb >= 2) {
+ unsigned int i,size;
+ int j;
+ unsigned int ii[MAX_CHAN]; /* maximum no of input channels */
+
+ fprintf(op," Input table:\n");
+ for (i = 0; i < p->inputEnt; i++) {
+ fprintf(op," %3u: ",i);
+ for (j = 0; j < p->inputChan; j++)
+ fprintf(op," %1.10f",p->inputTable[j * p->inputEnt + i]);
+ fprintf(op,"\n");
+ }
+
+ fprintf(op,"\n CLUT table:\n");
+ if (p->inputChan > MAX_CHAN) {
+ fprintf(op," !!Can't dump > %d input channel CLUT table!!\n",MAX_CHAN);
+ } else {
+ unsigned int pw;
+ if (uipow(p->clutPoints,p->inputChan,&pw) ||
+ (p->outputChan > 0 &&
+ pw > UINT_MAX / p->outputChan)) {
+ fprintf(op,"Would overflow.\n");
+ return;
+ }
+ size = (p->outputChan * pw);
+ for (j = 0; j < p->inputChan; j++)
+ ii[j] = 0;
+ for (i = 0; i < size;) {
+ int k;
+ /* Print table entry index */
+ fprintf(op," ");
+ for (j = p->inputChan-1; j >= 0; j--)
+ fprintf(op," %2u",ii[j]);
+ fprintf(op,":");
+ /* Print table entry contents */
+ for (k = 0; k < p->outputChan; k++, i++)
+ fprintf(op," %1.10f",p->clutTable[i]);
+ fprintf(op,"\n");
+
+ for (j = 0; j < p->inputChan; j++) { /* Increment index */
+ ii[j]++;
+ if (ii[j] < p->clutPoints)
+ break; /* No carry */
+ ii[j] = 0;
+ }
+ }
+ }
+
+ fprintf(op,"\n Output table:\n");
+ for (i = 0; i < p->outputEnt; i++) {
+ fprintf(op," %3u: ",i);
+ for (j = 0; j < p->outputChan; j++)
+ fprintf(op," %1.10f",p->outputTable[j * p->outputEnt + i]);
+ fprintf(op,"\n");
+ }
+
+ }
}
/* Allocate variable sized data elements */
static int icmLut_allocate(
- icmBase *pp
-) {
- unsigned int i, j, g, size, pw;
- icmLut *p = (icmLut *)pp;
- icc *icp = p->icp;
-
- /* Sanity check */
- if (p->inputChan > MAX_CHAN) {
- sprintf(icp->err,"icmLut_alloc: Can't handle > %d input channels\n",MAX_CHAN);
- return icp->errc = 1;
- }
-
- if (p->outputChan > MAX_CHAN) {
- sprintf(icp->err,"icmLut_alloc: Can't handle > %d output channels\n",MAX_CHAN);
- return icp->errc = 1;
- }
-
- if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
- sprintf(icp->err,"icmLut_alloc: too many entries");
- return icp->errc = 1;
- }
- size = (p->inputChan * p->inputEnt);
- if (size != p->inputTable_size) {
- if (p->inputTable != NULL)
- icp->al->free(icp->al, p->inputTable);
- if ((p->inputTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
- sprintf(icp->err,"icmLut_alloc: calloc() of Lut inputTable data failed");
- return icp->errc = 2;
- }
- p->inputTable_size = size;
- }
- if (uipow(p->clutPoints,p->inputChan,&pw) ||
- (p->outputChan > 0 &&
- pw > UINT_MAX / p->outputChan)) {
- sprintf(icp->err,"icmLut_alloc: overflow");
- return icp->errc = 1;
- }
- size = (p->outputChan * pw);
- if (size != p->clutTable_size) {
- if (p->clutTable != NULL)
- icp->al->free(icp->al, p->clutTable);
- if ((p->clutTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
- sprintf(icp->err,"icmLut_alloc: calloc() of Lut clutTable data failed");
- return icp->errc = 2;
- }
- p->clutTable_size = size;
- }
- if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
- sprintf(icp->err,"icmLut_alloc: overflow");
- return icp->errc = 1;
- }
- size = (p->outputChan * p->outputEnt);
- if (size != p->outputTable_size) {
- if (p->outputTable != NULL)
- icp->al->free(icp->al, p->outputTable);
- if ((p->outputTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
- sprintf(icp->err,"icmLut_alloc: calloc() of Lut outputTable data failed");
- return icp->errc = 2;
- }
- p->outputTable_size = size;
- }
-
- /* Private: compute dimensional increment though clut */
- /* Note that first channel varies least rapidly. */
- i = p->inputChan-1;
- p->dinc[i--] = p->outputChan;
- for (; i < p->inputChan; i--)
- p->dinc[i] = p->dinc[i+1] * p->clutPoints;
-
- /* Private: compute offsets from base of cube to other corners */
- for (p->dcube[0] = 0, g = 1, j = 0; j < p->inputChan; j++) {
- for (i = 0; i < g; i++)
- p->dcube[g+i] = p->dcube[i] + p->dinc[j];
- g *= 2;
- }
-
- return 0;
+ icmBase *pp
+) {
+ unsigned int i, j, g, size, pw;
+ icmLut *p = (icmLut *)pp;
+ icc *icp = p->icp;
+
+ /* Sanity check */
+ if (p->inputChan > MAX_CHAN) {
+ sprintf(icp->err,"icmLut_alloc: Can't handle > %d input channels\n",MAX_CHAN);
+ return icp->errc = 1;
+ }
+
+ if (p->outputChan > MAX_CHAN) {
+ sprintf(icp->err,"icmLut_alloc: Can't handle > %d output channels\n",MAX_CHAN);
+ return icp->errc = 1;
+ }
+
+ if (p->inputEnt > 0 && p->inputChan > UINT_MAX / p->inputEnt) {
+ sprintf(icp->err,"icmLut_alloc: too many entries");
+ return icp->errc = 1;
+ }
+ size = (p->inputChan * p->inputEnt);
+ if (size != p->inputTable_size) {
+ if (p->inputTable != NULL)
+ icp->al->free(icp->al, p->inputTable);
+ if ((p->inputTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
+ sprintf(icp->err,"icmLut_alloc: calloc() of Lut inputTable data failed");
+ return icp->errc = 2;
+ }
+ p->inputTable_size = size;
+ }
+ if (uipow(p->clutPoints,p->inputChan,&pw) ||
+ (p->outputChan > 0 &&
+ pw > UINT_MAX / p->outputChan)) {
+ sprintf(icp->err,"icmLut_alloc: overflow");
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * pw);
+ if (size != p->clutTable_size) {
+ if (p->clutTable != NULL)
+ icp->al->free(icp->al, p->clutTable);
+ if ((p->clutTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
+ sprintf(icp->err,"icmLut_alloc: calloc() of Lut clutTable data failed");
+ return icp->errc = 2;
+ }
+ p->clutTable_size = size;
+ }
+ if (p->outputChan > 0 && p->outputEnt > UINT_MAX / p->outputChan) {
+ sprintf(icp->err,"icmLut_alloc: overflow");
+ return icp->errc = 1;
+ }
+ size = (p->outputChan * p->outputEnt);
+ if (size != p->outputTable_size) {
+ if (p->outputTable != NULL)
+ icp->al->free(icp->al, p->outputTable);
+ if ((p->outputTable = (double *) icp->al->calloc(icp->al,sizeof(double), size)) == NULL) {
+ sprintf(icp->err,"icmLut_alloc: calloc() of Lut outputTable data failed");
+ return icp->errc = 2;
+ }
+ p->outputTable_size = size;
+ }
+
+ /* Private: compute dimensional increment though clut */
+ /* Note that first channel varies least rapidly. */
+ i = p->inputChan-1;
+ p->dinc[i--] = p->outputChan;
+ for (; i < p->inputChan; i--)
+ p->dinc[i] = p->dinc[i+1] * p->clutPoints;
+
+ /* Private: compute offsets from base of cube to other corners */
+ for (p->dcube[0] = 0, g = 1, j = 0; j < p->inputChan; j++) {
+ for (i = 0; i < g; i++)
+ p->dcube[g+i] = p->dcube[i] + p->dinc[j];
+ g *= 2;
+ }
+
+ return 0;
}
/* Free all storage in the object */
static void icmLut_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmLut *p = (icmLut *)pp;
- icc *icp = p->icp;
+ icmLut *p = (icmLut *)pp;
+ icc *icp = p->icp;
- if (p->inputTable != NULL)
- icp->al->free(icp->al, p->inputTable);
- if (p->clutTable != NULL)
- icp->al->free(icp->al, p->clutTable);
- if (p->outputTable != NULL)
- icp->al->free(icp->al, p->outputTable);
- icmTable_delete_bwd(icp, &p->rit);
- icmTable_delete_bwd(icp, &p->rot);
- icp->al->free(icp->al, p);
+ if (p->inputTable != NULL)
+ icp->al->free(icp->al, p->inputTable);
+ if (p->clutTable != NULL)
+ icp->al->free(icp->al, p->clutTable);
+ if (p->outputTable != NULL)
+ icp->al->free(icp->al, p->outputTable);
+ icmTable_delete_bwd(icp, &p->rit);
+ icmTable_delete_bwd(icp, &p->rot);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmLut(
- icc *icp
-) {
- int i,j;
- icmLut *p;
- if ((p = (icmLut *) icp->al->calloc(icp->al,1,sizeof(icmLut))) == NULL)
- return NULL;
- p->ttype = icSigLut16Type;
- p->refcount = 1;
- p->get_size = icmLut_get_size;
- p->read = icmLut_read;
- p->write = icmLut_write;
- p->dump = icmLut_dump;
- p->allocate = icmLut_allocate;
- p->del = icmLut_delete;
-
- /* Lookup methods */
- p->nu_matrix = icmLut_nu_matrix;
- p->min_max = icmLut_min_max;
- p->lookup_matrix = icmLut_lookup_matrix;
- p->lookup_input = icmLut_lookup_input;
- p->lookup_clut_nl = icmLut_lookup_clut_nl;
- p->lookup_clut_sx = icmLut_lookup_clut_sx;
- p->lookup_output = icmLut_lookup_output;
-
- /* Set method */
- p->set_tables = icmLut_set_tables;
-
- p->icp = icp;
-
- /* Set matrix to reasonable default */
- for (i = 0; i < 3; i++)
- for (j = 0; j < 3; j++) {
- if (i == j)
- p->e[i][j] = 1.0;
- else
- p->e[i][j] = 0.0;
- }
-
- /* Init lookups to non-dangerous values */
- for (i = 0; i < MAX_CHAN; i++)
- p->dinc[i] = 0;
-
- for (i = 0; i < (1 << MAX_CHAN); i++)
- p->dcube[i] = 0;
-
- p->rit.inited = 0;
- p->rot.inited = 0;
-
- return (icmBase *)p;
+ icc *icp
+) {
+ int i,j;
+ icmLut *p;
+ if ((p = (icmLut *) icp->al->calloc(icp->al,1,sizeof(icmLut))) == NULL)
+ return NULL;
+ p->ttype = icSigLut16Type;
+ p->refcount = 1;
+ p->get_size = icmLut_get_size;
+ p->read = icmLut_read;
+ p->write = icmLut_write;
+ p->dump = icmLut_dump;
+ p->allocate = icmLut_allocate;
+ p->del = icmLut_delete;
+
+ /* Lookup methods */
+ p->nu_matrix = icmLut_nu_matrix;
+ p->min_max = icmLut_min_max;
+ p->lookup_matrix = icmLut_lookup_matrix;
+ p->lookup_input = icmLut_lookup_input;
+ p->lookup_clut_nl = icmLut_lookup_clut_nl;
+ p->lookup_clut_sx = icmLut_lookup_clut_sx;
+ p->lookup_output = icmLut_lookup_output;
+
+ /* Set method */
+ p->set_tables = icmLut_set_tables;
+
+ p->icp = icp;
+
+ /* Set matrix to reasonable default */
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++) {
+ if (i == j)
+ p->e[i][j] = 1.0;
+ else
+ p->e[i][j] = 0.0;
+ }
+
+ /* Init lookups to non-dangerous values */
+ for (i = 0; i < MAX_CHAN; i++)
+ p->dinc[i] = 0;
+
+ for (i = 0; i < (1 << MAX_CHAN); i++)
+ p->dcube[i] = 0;
+
+ p->rit.inited = 0;
+ p->rot.inited = 0;
+
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -5529,342 +5519,342 @@ static icmBase *new_icmLut(
/* Return the number of bytes needed to write this tag */
static unsigned int icmMeasurement_get_size(
- icmBase *pp
+ icmBase *pp
) {
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += 4; /* 4 for standard observer */
- len += 12; /* 12 for XYZ of measurement backing */
- len += 4; /* 4 for measurement geometry */
- len += 4; /* 4 for measurement flare */
- len += 4; /* 4 for standard illuminant */
- return len;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4; /* 4 for standard observer */
+ len += 12; /* 12 for XYZ of measurement backing */
+ len += 4; /* 4 for measurement geometry */
+ len += 4; /* 4 for measurement flare */
+ len += 4; /* 4 for standard illuminant */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmMeasurement_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmMeasurement *p = (icmMeasurement *)pp;
- icc *icp = p->icp;
- int rv;
- char *bp, *buf;
-
- if (len < 36) {
- sprintf(icp->err,"icmMeasurement_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmMeasurement_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmMeasurement_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmMeasurement_read: Wrong tag type for icmMeasurement");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read the encoded standard observer */
- p->observer = (icStandardObserver)read_SInt32Number(bp + 8);
-
- /* Read the XYZ values for measurement backing */
- if ((rv = read_XYZNumber(&p->backing, bp+12)) != 0) {
- sprintf(icp->err,"icmMeasurement: read_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Read the encoded measurement geometry */
- p->geometry = (icMeasurementGeometry)read_SInt32Number(bp + 24);
-
- /* Read the proportion of flare */
- p->flare = read_U16Fixed16Number(bp + 28);
-
- /* Read the encoded standard illuminant */
- p->illuminant = (icIlluminant)read_SInt32Number(bp + 32);
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmMeasurement *p = (icmMeasurement *)pp;
+ icc *icp = p->icp;
+ int rv;
+ char *bp, *buf;
+
+ if (len < 36) {
+ sprintf(icp->err,"icmMeasurement_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmMeasurement_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmMeasurement_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmMeasurement_read: Wrong tag type for icmMeasurement");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read the encoded standard observer */
+ p->observer = (icStandardObserver)read_SInt32Number(bp + 8);
+
+ /* Read the XYZ values for measurement backing */
+ if ((rv = read_XYZNumber(&p->backing, bp+12)) != 0) {
+ sprintf(icp->err,"icmMeasurement: read_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Read the encoded measurement geometry */
+ p->geometry = (icMeasurementGeometry)read_SInt32Number(bp + 24);
+
+ /* Read the proportion of flare */
+ p->flare = read_U16Fixed16Number(bp + 28);
+
+ /* Read the encoded standard illuminant */
+ p->illuminant = (icIlluminant)read_SInt32Number(bp + 32);
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmMeasurement_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmMeasurement *p = (icmMeasurement *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmMeasurement_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmMeasurement_write, type: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write the encoded standard observer */
- if ((rv = write_SInt32Number((int)p->observer, bp + 8)) != 0) {
- sprintf(icp->err,"icmMeasurementa_write, observer: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the XYZ values for measurement backing */
- if ((rv = write_XYZNumber(&p->backing, bp+12)) != 0) {
- sprintf(icp->err,"icmMeasurement, backing: write_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the encoded measurement geometry */
- if ((rv = write_SInt32Number((int)p->geometry, bp + 24)) != 0) {
- sprintf(icp->err,"icmMeasurementa_write, geometry: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the proportion of flare */
- if ((rv = write_U16Fixed16Number(p->flare, bp + 28)) != 0) {
- sprintf(icp->err,"icmMeasurementa_write, flare: write_U16Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the encoded standard illuminant */
- if ((rv = write_SInt32Number((int)p->illuminant, bp + 32)) != 0) {
- sprintf(icp->err,"icmMeasurementa_write, illuminant: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmMeasurement_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmMeasurement *p = (icmMeasurement *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmMeasurement_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmMeasurement_write, type: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write the encoded standard observer */
+ if ((rv = write_SInt32Number((int)p->observer, bp + 8)) != 0) {
+ sprintf(icp->err,"icmMeasurementa_write, observer: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the XYZ values for measurement backing */
+ if ((rv = write_XYZNumber(&p->backing, bp+12)) != 0) {
+ sprintf(icp->err,"icmMeasurement, backing: write_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the encoded measurement geometry */
+ if ((rv = write_SInt32Number((int)p->geometry, bp + 24)) != 0) {
+ sprintf(icp->err,"icmMeasurementa_write, geometry: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the proportion of flare */
+ if ((rv = write_U16Fixed16Number(p->flare, bp + 28)) != 0) {
+ sprintf(icp->err,"icmMeasurementa_write, flare: write_U16Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the encoded standard illuminant */
+ if ((rv = write_SInt32Number((int)p->illuminant, bp + 32)) != 0) {
+ sprintf(icp->err,"icmMeasurementa_write, illuminant: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmMeasurement_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmMeasurement_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmMeasurement *p = (icmMeasurement *)pp;
- if (verb <= 0)
- return;
+ icmMeasurement *p = (icmMeasurement *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"Measurement:\n");
- fprintf(op," Standard Observer = %s\n", string_StandardObserver(p->observer));
- fprintf(op," XYZ for Measurement Backing = %s\n", string_XYZNumber_and_Lab(&p->backing));
- fprintf(op," Measurement Geometry = %s\n", string_MeasurementGeometry(p->geometry));
- fprintf(op," Measurement Flare = %5.1f%%\n", p->flare * 100.0);
- fprintf(op," Standard Illuminant = %s\n", string_Illuminant(p->illuminant));
+ fprintf(op,"Measurement:\n");
+ fprintf(op," Standard Observer = %s\n", string_StandardObserver(p->observer));
+ fprintf(op," XYZ for Measurement Backing = %s\n", string_XYZNumber_and_Lab(&p->backing));
+ fprintf(op," Measurement Geometry = %s\n", string_MeasurementGeometry(p->geometry));
+ fprintf(op," Measurement Flare = %5.1f%%\n", p->flare * 100.0);
+ fprintf(op," Standard Illuminant = %s\n", string_Illuminant(p->illuminant));
}
/* Allocate variable sized data elements */
static int icmMeasurement_allocate(
- icmBase *pp
+ icmBase *pp
) {
- /* Nothing to do */
- return 0;
+ /* Nothing to do */
+ return 0;
}
/* Free all storage in the object */
static void icmMeasurement_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmMeasurement *p = (icmMeasurement *)pp;
- icc *icp = p->icp;
+ icmMeasurement *p = (icmMeasurement *)pp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmMeasurement(
- icc *icp
+ icc *icp
) {
- icmMeasurement *p;
- if ((p = (icmMeasurement *) icp->al->calloc(icp->al,1,sizeof(icmMeasurement))) == NULL)
- return NULL;
- p->ttype = icSigMeasurementType;
- p->refcount = 1;
- p->get_size = icmMeasurement_get_size;
- p->read = icmMeasurement_read;
- p->write = icmMeasurement_write;
- p->dump = icmMeasurement_dump;
- p->allocate = icmMeasurement_allocate;
- p->del = icmMeasurement_delete;
- p->icp = icp;
+ icmMeasurement *p;
+ if ((p = (icmMeasurement *) icp->al->calloc(icp->al,1,sizeof(icmMeasurement))) == NULL)
+ return NULL;
+ p->ttype = icSigMeasurementType;
+ p->refcount = 1;
+ p->get_size = icmMeasurement_get_size;
+ p->read = icmMeasurement_read;
+ p->write = icmMeasurement_write;
+ p->dump = icmMeasurement_dump;
+ p->allocate = icmMeasurement_allocate;
+ p->del = icmMeasurement_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
/* Named color structure read/write support */
static int read_NamedColorVal(
- icmNamedColorVal *p,
- char *bp,
- char *end,
- icColorSpaceSignature pcs, /* Header Profile Connection Space */
- unsigned int ndc /* Number of device corrds */
-) {
- icc *icp = p->icp;
- int i;
- unsigned int mxl; /* Max possible string length */
-
- mxl = (end - bp) < 32 ? (end - bp) : 32;
- if (check_null_string(bp,mxl)) {
- sprintf(icp->err,"icmNamedColorVal_read: Root name string not terminated");
- return icp->errc = 1;
- }
- strcpy((void *)p->root, (void *)bp);
- bp += strlen(p->root) + 1;
- if ((bp + ndc) > end) {
- sprintf(icp->err,"icmNamedColorVal_read: Data too short to read device coords");
- return icp->errc = 1;
- }
- for (i = 0; i < ndc; i++) {
- p->deviceCoords[i] = read_DCS8Number(bp);
- bp += 1;
- }
- return 0;
+ icmNamedColorVal *p,
+ char *bp,
+ char *end,
+ icColorSpaceSignature pcs, /* Header Profile Connection Space */
+ unsigned int ndc /* Number of device corrds */
+) {
+ icc *icp = p->icp;
+ int i;
+ unsigned int mxl; /* Max possible string length */
+
+ mxl = (end - bp) < 32 ? (end - bp) : 32;
+ if (check_null_string(bp,mxl)) {
+ sprintf(icp->err,"icmNamedColorVal_read: Root name string not terminated");
+ return icp->errc = 1;
+ }
+ strcpy((void *)p->root, (void *)bp);
+ bp += strlen(p->root) + 1;
+ if ((bp + ndc) > end) {
+ sprintf(icp->err,"icmNamedColorVal_read: Data too short to read device coords");
+ return icp->errc = 1;
+ }
+ for (i = 0; i < ndc; i++) {
+ p->deviceCoords[i] = read_DCS8Number(bp);
+ bp += 1;
+ }
+ return 0;
}
static int read_NamedColorVal2(
- icmNamedColorVal *p,
- char *bp,
- char *end,
- icColorSpaceSignature pcs, /* Header Profile Connection Space */
- unsigned int ndc /* Number of device corrds */
-) {
- icc *icp = p->icp;
- int i;
- if ((bp + 32 + 6 + ndc * 2) > end) {
- sprintf(icp->err,"icmNamedColorVal2_read: Data too short to read");
- return icp->errc = 1;
- }
- if (check_null_string(bp,32)) {
- sprintf(icp->err,"icmNamedColorVal2_read: Root name string not terminated");
- return icp->errc = 1;
- }
- memcpy((void *)p->root,(void *)(bp + 0),32);
- switch(pcs) {
- case icSigXYZData:
- p->pcsCoords[0] = read_PCSXYZ16Number(bp+32);
- p->pcsCoords[1] = read_PCSXYZ16Number(bp+34);
- p->pcsCoords[2] = read_PCSXYZ16Number(bp+36);
- break;
- case icSigLabData:
- p->pcsCoords[0] = read_PCSL16Number(bp+32);
- p->pcsCoords[1] = read_PCSab16Number(bp+34);
- p->pcsCoords[2] = read_PCSab16Number(bp+36);
- break;
- default:
- return 1; /* Unknown PCS */
- }
- for (i = 0; i < ndc; i++)
- p->deviceCoords[i] = read_DCS16Number(bp + 32 + 6 + 2 * i);
- return 0;
+ icmNamedColorVal *p,
+ char *bp,
+ char *end,
+ icColorSpaceSignature pcs, /* Header Profile Connection Space */
+ unsigned int ndc /* Number of device corrds */
+) {
+ icc *icp = p->icp;
+ int i;
+ if ((bp + 32 + 6 + ndc * 2) > end) {
+ sprintf(icp->err,"icmNamedColorVal2_read: Data too short to read");
+ return icp->errc = 1;
+ }
+ if (check_null_string(bp,32)) {
+ sprintf(icp->err,"icmNamedColorVal2_read: Root name string not terminated");
+ return icp->errc = 1;
+ }
+ memcpy((void *)p->root,(void *)(bp + 0),32);
+ switch(pcs) {
+ case icSigXYZData:
+ p->pcsCoords[0] = read_PCSXYZ16Number(bp+32);
+ p->pcsCoords[1] = read_PCSXYZ16Number(bp+34);
+ p->pcsCoords[2] = read_PCSXYZ16Number(bp+36);
+ break;
+ case icSigLabData:
+ p->pcsCoords[0] = read_PCSL16Number(bp+32);
+ p->pcsCoords[1] = read_PCSab16Number(bp+34);
+ p->pcsCoords[2] = read_PCSab16Number(bp+36);
+ break;
+ default:
+ return 1; /* Unknown PCS */
+ }
+ for (i = 0; i < ndc; i++)
+ p->deviceCoords[i] = read_DCS16Number(bp + 32 + 6 + 2 * i);
+ return 0;
}
static int write_NamedColorVal(
- icmNamedColorVal *p,
- char *d,
- icColorSpaceSignature pcs, /* Header Profile Connection Space */
- unsigned int ndc /* Number of device corrds */
-) {
- icc *icp = p->icp;
- int i, rv = 0;
- if (check_null_string(p->root,32) != 0) {
- sprintf(icp->err,"icmNamedColorVal_write: Root string names is unterminated");
- return icp->errc = 1;
- }
- strcpy((void *)d,(void *)p->root);
- d += strlen(p->root) + 1;
- for (i = 0; i < ndc; i++) {
- if ((rv = write_DCS8Number(p->deviceCoords[i], d)) != 0) {
- sprintf(icp->err,"icmNamedColorVal_write: write of device coord failed");
- return icp->errc = 1;
- }
- d += 1;
- }
- return 0;
+ icmNamedColorVal *p,
+ char *d,
+ icColorSpaceSignature pcs, /* Header Profile Connection Space */
+ unsigned int ndc /* Number of device corrds */
+) {
+ icc *icp = p->icp;
+ int i, rv = 0;
+ if (check_null_string(p->root,32) != 0) {
+ sprintf(icp->err,"icmNamedColorVal_write: Root string names is unterminated");
+ return icp->errc = 1;
+ }
+ strcpy((void *)d,(void *)p->root);
+ d += strlen(p->root) + 1;
+ for (i = 0; i < ndc; i++) {
+ if ((rv = write_DCS8Number(p->deviceCoords[i], d)) != 0) {
+ sprintf(icp->err,"icmNamedColorVal_write: write of device coord failed");
+ return icp->errc = 1;
+ }
+ d += 1;
+ }
+ return 0;
}
static int write_NamedColorVal2(
- icmNamedColorVal *p,
- char *bp,
- icColorSpaceSignature pcs, /* Header Profile Connection Space */
- unsigned int ndc /* Number of device corrds */
-) {
- icc *icp = p->icp;
- int i, rv = 0;
- if (check_null_string(p->root,32)) {
- sprintf(icp->err,"icmNamedColorVal2_write: Root string names is unterminated");
- return icp->errc = 1;
- }
- memcpy((void *)(bp + 0),(void *)p->root,32);
- switch(pcs) {
- case icSigXYZData:
- rv |= write_PCSXYZ16Number(p->pcsCoords[0], bp+32);
- rv |= write_PCSXYZ16Number(p->pcsCoords[1], bp+34);
- rv |= write_PCSXYZ16Number(p->pcsCoords[2], bp+36);
- break;
- case icSigLabData:
- rv |= write_PCSL16Number(p->pcsCoords[0], bp+32);
- rv |= write_PCSab16Number(p->pcsCoords[1], bp+34);
- rv |= write_PCSab16Number(p->pcsCoords[2], bp+36);
- break;
- default:
- sprintf(icp->err,"icmNamedColorVal2_write: Unknown PCS");
- return icp->errc = 1;
- }
- if (rv) {
- sprintf(icp->err,"icmNamedColorVal2_write: write of PCS coord failed");
- return icp->errc = 1;
- }
- for (i = 0; i < ndc; i++) {
- if ((rv = write_DCS16Number(p->deviceCoords[i], bp + 32 + 6 + 2 * i)) != 0) {
- sprintf(icp->err,"icmNamedColorVal2_write: write of device coord failed");
- return icp->errc = 1;
- }
- }
- return 0;
+ icmNamedColorVal *p,
+ char *bp,
+ icColorSpaceSignature pcs, /* Header Profile Connection Space */
+ unsigned int ndc /* Number of device corrds */
+) {
+ icc *icp = p->icp;
+ int i, rv = 0;
+ if (check_null_string(p->root,32)) {
+ sprintf(icp->err,"icmNamedColorVal2_write: Root string names is unterminated");
+ return icp->errc = 1;
+ }
+ memcpy((void *)(bp + 0),(void *)p->root,32);
+ switch(pcs) {
+ case icSigXYZData:
+ rv |= write_PCSXYZ16Number(p->pcsCoords[0], bp+32);
+ rv |= write_PCSXYZ16Number(p->pcsCoords[1], bp+34);
+ rv |= write_PCSXYZ16Number(p->pcsCoords[2], bp+36);
+ break;
+ case icSigLabData:
+ rv |= write_PCSL16Number(p->pcsCoords[0], bp+32);
+ rv |= write_PCSab16Number(p->pcsCoords[1], bp+34);
+ rv |= write_PCSab16Number(p->pcsCoords[2], bp+36);
+ break;
+ default:
+ sprintf(icp->err,"icmNamedColorVal2_write: Unknown PCS");
+ return icp->errc = 1;
+ }
+ if (rv) {
+ sprintf(icp->err,"icmNamedColorVal2_write: write of PCS coord failed");
+ return icp->errc = 1;
+ }
+ for (i = 0; i < ndc; i++) {
+ if ((rv = write_DCS16Number(p->deviceCoords[i], bp + 32 + 6 + 2 * i)) != 0) {
+ sprintf(icp->err,"icmNamedColorVal2_write: write of device coord failed");
+ return icp->errc = 1;
+ }
+ }
+ return 0;
}
/* - - - - - - - - - - - */
@@ -5872,417 +5862,417 @@ static int write_NamedColorVal2(
/* Return the number of bytes needed to write this tag */
static unsigned int icmNamedColor_get_size(
- icmBase *pp
-) {
- icmNamedColor *p = (icmNamedColor *)pp;
- unsigned int len = 0;
- if (p->ttype == icSigNamedColorType) {
- unsigned int i;
- len += 8; /* 8 bytes for tag and padding */
- len += 4; /* 4 for vendor specific flags */
- len += 4; /* 4 for count of named colors */
- len += strlen(p->prefix) + 1; /* prefix of color names */
- len += strlen(p->suffix) + 1; /* suffix of color names */
- for (i = 0; i < p->count; i++) {
- len += strlen(p->data[i].root) + 1; /* color names */
- len += p->nDeviceCoords * 1; /* bytes for each named color */
- }
- } else { /* Named Color 2 */
- unsigned int col;
- len += 8; /* 8 bytes for tag and padding */
- len += 4; /* 4 for vendor specific flags */
- len += 4; /* 4 for count of named colors */
- len += 4; /* 4 for number of device coords */
- len += 32; /* 32 for prefix of color names */
- len += 32; /* 32 for suffix of color names */
- col = 32 + 6 + p->nDeviceCoords * 2;
- if (p->nDeviceCoords > (UINT_MAX - (32 + 6)) / 2 ||
- (p->count > 0 && col > (UINT_MAX - len) / p->count)) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->count * col; /* bytes for each named color */
- }
- return len;
+ icmBase *pp
+) {
+ icmNamedColor *p = (icmNamedColor *)pp;
+ unsigned int len = 0;
+ if (p->ttype == icSigNamedColorType) {
+ unsigned int i;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4; /* 4 for vendor specific flags */
+ len += 4; /* 4 for count of named colors */
+ len += strlen(p->prefix) + 1; /* prefix of color names */
+ len += strlen(p->suffix) + 1; /* suffix of color names */
+ for (i = 0; i < p->count; i++) {
+ len += strlen(p->data[i].root) + 1; /* color names */
+ len += p->nDeviceCoords * 1; /* bytes for each named color */
+ }
+ } else { /* Named Color 2 */
+ unsigned int col;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4; /* 4 for vendor specific flags */
+ len += 4; /* 4 for count of named colors */
+ len += 4; /* 4 for number of device coords */
+ len += 32; /* 32 for prefix of color names */
+ len += 32; /* 32 for suffix of color names */
+ col = 32 + 6 + p->nDeviceCoords * 2;
+ if (p->nDeviceCoords > (UINT_MAX - (32 + 6)) / 2 ||
+ (p->count > 0 && col > (UINT_MAX - len) / p->count)) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->count * col; /* bytes for each named color */
+ }
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmNamedColor_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmNamedColor *p = (icmNamedColor *)pp;
- icc *icp = p->icp;
- unsigned long i;
- char *bp, *buf, *end;
- int rv = 0;
-
- if (len < 4) {
- sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmNamedColor_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmNamedColor_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- p->ttype = (icTagTypeSignature)read_SInt32Number(bp);
- if (p->ttype != icSigNamedColorType && p->ttype != icSigNamedColor2Type) {
- sprintf(icp->err,"icmNamedColor_read: Wrong tag type for icmNamedColor");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- if (p->ttype == icSigNamedColorType) {
- if (len < 16) {
- sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- /* Make sure that the number of device coords in known */
- p->nDeviceCoords = number_ColorSpaceSignature(icp->header->colorSpace);
- if (p->nDeviceCoords > MAX_CHAN) {
- sprintf(icp->err,"icmNamedColor_read: Can't handle more than %d device channels",MAX_CHAN);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- } else { /* icmNC2 */
- if (len < 84) {
- sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
-
- /* Read vendor specific flag */
- p->vendorFlag = read_UInt32Number(bp+8);
-
- /* Read count of named colors */
- p->count = read_UInt32Number(bp+12);
-
- if (p->ttype == icSigNamedColorType) {
- unsigned int mxl; /* Max possible string length */
- bp = bp + 16;
-
- /* Prefix for each color name */
- mxl = (end - bp) < 32 ? (end - bp) : 32;
- if (check_null_string(bp,mxl) != 0) {
- sprintf(icp->err,"icmNamedColor_read: Color prefix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- strcpy((void *)p->prefix, (void *)bp);
- bp += strlen(p->prefix) + 1;
-
- /* Suffix for each color name */
- mxl = (end - bp) < 32 ? (end - bp) : 32;
- if (check_null_string(bp,mxl) != 0) {
- sprintf(icp->err,"icmNamedColor_read: Color suffix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- strcpy((void *)p->suffix, (void *)bp);
- bp += strlen(p->suffix) + 1;
-
- if ((rv = p->allocate((void *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read all the data from the buffer */
- for (i = 0; i < p->count; i++) {
- if ((rv = read_NamedColorVal(p->data+i, bp, end, icp->header->pcs, p->nDeviceCoords)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- bp += strlen(p->data[i].root) + 1;
- bp += p->nDeviceCoords * 1;
- }
- } else { /* icmNC2 */
- /* Number of device coords per color */
- p->nDeviceCoords = read_UInt32Number(bp+16);
-
- /* Prefix for each color name */
- memcpy((void *)p->prefix, (void *)(bp + 20), 32);
- if (check_null_string(p->prefix,32) != 0) {
- sprintf(icp->err,"icmNamedColor_read: Color prefix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Suffix for each color name */
- memcpy((void *)p->suffix, (void *)(bp + 52), 32);
- if (check_null_string(p->suffix,32) != 0) {
- sprintf(icp->err,"icmNamedColor_read: Color suffix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read all the data from the buffer */
- bp = bp + 84;
- for (i = 0; i < p->count; i++, bp += (32 + 6 + p->nDeviceCoords * 2)) {
- if ((rv = read_NamedColorVal2(p->data+i, bp, end, icp->header->pcs, p->nDeviceCoords)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- }
- }
- icp->al->free(icp->al, buf);
- return rv;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmNamedColor *p = (icmNamedColor *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ char *bp, *buf, *end;
+ int rv = 0;
+
+ if (len < 4) {
+ sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmNamedColor_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmNamedColor_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ p->ttype = (icTagTypeSignature)read_SInt32Number(bp);
+ if (p->ttype != icSigNamedColorType && p->ttype != icSigNamedColor2Type) {
+ sprintf(icp->err,"icmNamedColor_read: Wrong tag type for icmNamedColor");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ if (p->ttype == icSigNamedColorType) {
+ if (len < 16) {
+ sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ /* Make sure that the number of device coords in known */
+ p->nDeviceCoords = number_ColorSpaceSignature(icp->header->colorSpace);
+ if (p->nDeviceCoords > MAX_CHAN) {
+ sprintf(icp->err,"icmNamedColor_read: Can't handle more than %d device channels",MAX_CHAN);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ } else { /* icmNC2 */
+ if (len < 84) {
+ sprintf(icp->err,"icmNamedColor_read: Tag too small to be legal");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+
+ /* Read vendor specific flag */
+ p->vendorFlag = read_UInt32Number(bp+8);
+
+ /* Read count of named colors */
+ p->count = read_UInt32Number(bp+12);
+
+ if (p->ttype == icSigNamedColorType) {
+ unsigned int mxl; /* Max possible string length */
+ bp = bp + 16;
+
+ /* Prefix for each color name */
+ mxl = (end - bp) < 32 ? (end - bp) : 32;
+ if (check_null_string(bp,mxl) != 0) {
+ sprintf(icp->err,"icmNamedColor_read: Color prefix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ strcpy((void *)p->prefix, (void *)bp);
+ bp += strlen(p->prefix) + 1;
+
+ /* Suffix for each color name */
+ mxl = (end - bp) < 32 ? (end - bp) : 32;
+ if (check_null_string(bp,mxl) != 0) {
+ sprintf(icp->err,"icmNamedColor_read: Color suffix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ strcpy((void *)p->suffix, (void *)bp);
+ bp += strlen(p->suffix) + 1;
+
+ if ((rv = p->allocate((void *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < p->count; i++) {
+ if ((rv = read_NamedColorVal(p->data+i, bp, end, icp->header->pcs, p->nDeviceCoords)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ bp += strlen(p->data[i].root) + 1;
+ bp += p->nDeviceCoords * 1;
+ }
+ } else { /* icmNC2 */
+ /* Number of device coords per color */
+ p->nDeviceCoords = read_UInt32Number(bp+16);
+
+ /* Prefix for each color name */
+ memcpy((void *)p->prefix, (void *)(bp + 20), 32);
+ if (check_null_string(p->prefix,32) != 0) {
+ sprintf(icp->err,"icmNamedColor_read: Color prefix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Suffix for each color name */
+ memcpy((void *)p->suffix, (void *)(bp + 52), 32);
+ if (check_null_string(p->suffix,32) != 0) {
+ sprintf(icp->err,"icmNamedColor_read: Color suffix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read all the data from the buffer */
+ bp = bp + 84;
+ for (i = 0; i < p->count; i++, bp += (32 + 6 + p->nDeviceCoords * 2)) {
+ if ((rv = read_NamedColorVal2(p->data+i, bp, end, icp->header->pcs, p->nDeviceCoords)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ }
+ }
+ icp->al->free(icp->al, buf);
+ return rv;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmNamedColor_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmNamedColor *p = (icmNamedColor *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmNamedColor_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write vendor specific flag */
- if ((rv = write_UInt32Number(p->vendorFlag, bp+8)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write count of named colors */
- if ((rv = write_UInt32Number(p->count, bp+12)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- if (p->ttype == icSigNamedColorType) {
- bp = bp + 16;
-
- /* Prefix for each color name */
- if ((rv = check_null_string(p->prefix,32)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: Color prefix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- strcpy((void *)bp, (void *)p->prefix);
- bp += strlen(p->prefix) + 1;
-
- /* Suffix for each color name */
- if (check_null_string(p->suffix,32)) {
- sprintf(icp->err,"icmNamedColor_write: Color sufix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- strcpy((void *)bp, (void *)p->suffix);
- bp += strlen(p->suffix) + 1;
-
- /* Write all the data to the buffer */
-
- for (i = 0; i < p->count; i++) {
- if ((rv = write_NamedColorVal(p->data+i, bp, icp->header->pcs, p->nDeviceCoords)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- bp += strlen(p->data[i].root) + 1;
- bp += p->nDeviceCoords * 1;
- }
- } else { /* icmNC2 */
- /* Number of device coords per color */
- if ((rv = write_UInt32Number(p->nDeviceCoords, bp+16)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Prefix for each color name */
- if ((rv = check_null_string(p->prefix,32)) != 0) {
- sprintf(icp->err,"icmNamedColor_write: Color prefix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)(bp + 20), (void *)p->prefix, 32);
-
- /* Suffix for each color name */
- if (check_null_string(p->suffix,32)) {
- sprintf(icp->err,"icmNamedColor_write: Color sufix is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)(bp + 52), (void *)p->suffix, 32);
-
- /* Write all the data to the buffer */
- bp = bp + 84;
- for (i = 0; i < p->count; i++, bp += (32 + 6 + p->nDeviceCoords * 2)) {
- if ((rv = write_NamedColorVal2(p->data+i, bp, icp->header->pcs, p->nDeviceCoords)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmNamedColor_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmNamedColor *p = (icmNamedColor *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmNamedColor_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write vendor specific flag */
+ if ((rv = write_UInt32Number(p->vendorFlag, bp+8)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write count of named colors */
+ if ((rv = write_UInt32Number(p->count, bp+12)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ if (p->ttype == icSigNamedColorType) {
+ bp = bp + 16;
+
+ /* Prefix for each color name */
+ if ((rv = check_null_string(p->prefix,32)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: Color prefix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ strcpy((void *)bp, (void *)p->prefix);
+ bp += strlen(p->prefix) + 1;
+
+ /* Suffix for each color name */
+ if (check_null_string(p->suffix,32)) {
+ sprintf(icp->err,"icmNamedColor_write: Color sufix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ strcpy((void *)bp, (void *)p->suffix);
+ bp += strlen(p->suffix) + 1;
+
+ /* Write all the data to the buffer */
+
+ for (i = 0; i < p->count; i++) {
+ if ((rv = write_NamedColorVal(p->data+i, bp, icp->header->pcs, p->nDeviceCoords)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ bp += strlen(p->data[i].root) + 1;
+ bp += p->nDeviceCoords * 1;
+ }
+ } else { /* icmNC2 */
+ /* Number of device coords per color */
+ if ((rv = write_UInt32Number(p->nDeviceCoords, bp+16)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Prefix for each color name */
+ if ((rv = check_null_string(p->prefix,32)) != 0) {
+ sprintf(icp->err,"icmNamedColor_write: Color prefix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)(bp + 20), (void *)p->prefix, 32);
+
+ /* Suffix for each color name */
+ if (check_null_string(p->suffix,32)) {
+ sprintf(icp->err,"icmNamedColor_write: Color sufix is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)(bp + 52), (void *)p->suffix, 32);
+
+ /* Write all the data to the buffer */
+ bp = bp + 84;
+ for (i = 0; i < p->count; i++, bp += (32 + 6 + p->nDeviceCoords * 2)) {
+ if ((rv = write_NamedColorVal2(p->data+i, bp, icp->header->pcs, p->nDeviceCoords)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmNamedColor_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmNamedColor_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmNamedColor *p = (icmNamedColor *)pp;
- icc *icp = p->icp;
- if (verb <= 0)
- return;
-
- if (p->ttype == icSigNamedColorType)
- fprintf(op,"NamedColor:\n");
- else
- fprintf(op,"NamedColor2:\n");
- fprintf(op," Vendor Flag = 0x%x\n",p->vendorFlag);
- fprintf(op," No. colors = %u\n",p->count);
- fprintf(op," No. dev. coords = %u\n",p->nDeviceCoords);
- fprintf(op," Name prefix = '%s'\n",p->prefix);
- fprintf(op," Name suffix = '%s'\n",p->suffix);
- if (verb >= 2) {
- unsigned long i, n;
- icmNamedColorVal *vp;
- for (i = 0; i < p->count; i++) {
- vp = p->data + i;
- fprintf(op," Color %lu:\n",i);
- fprintf(op," Name root = '%s'\n",vp->root);
-
- if (p->ttype == icSigNamedColor2Type) {
- switch(icp->header->pcs) {
- case icSigXYZData:
- fprintf(op," XYZ = %f, %f, %f'\n",
- vp->pcsCoords[0],vp->pcsCoords[1],vp->pcsCoords[2]);
- break;
- case icSigLabData:
- fprintf(op," Lab = %f, %f, %f'\n",
- vp->pcsCoords[0],vp->pcsCoords[1],vp->pcsCoords[2]);
- break;
- default:
- fprintf(op," Unexpected PCS\n");
- break;
- }
- }
- if (p->nDeviceCoords > 0) {
- fprintf(op," Device Coords = ");
- for (n = 0; n < p->nDeviceCoords; n++) {
- if (n > 0)
- printf(", ");
- printf("%f",vp->deviceCoords[n]);
- }
- printf("\n");
- }
- }
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmNamedColor *p = (icmNamedColor *)pp;
+ icc *icp = p->icp;
+ if (verb <= 0)
+ return;
+
+ if (p->ttype == icSigNamedColorType)
+ fprintf(op,"NamedColor:\n");
+ else
+ fprintf(op,"NamedColor2:\n");
+ fprintf(op," Vendor Flag = 0x%x\n",p->vendorFlag);
+ fprintf(op," No. colors = %u\n",p->count);
+ fprintf(op," No. dev. coords = %u\n",p->nDeviceCoords);
+ fprintf(op," Name prefix = '%s'\n",p->prefix);
+ fprintf(op," Name suffix = '%s'\n",p->suffix);
+ if (verb >= 2) {
+ unsigned long i, n;
+ icmNamedColorVal *vp;
+ for (i = 0; i < p->count; i++) {
+ vp = p->data + i;
+ fprintf(op," Color %lu:\n",i);
+ fprintf(op," Name root = '%s'\n",vp->root);
+
+ if (p->ttype == icSigNamedColor2Type) {
+ switch(icp->header->pcs) {
+ case icSigXYZData:
+ fprintf(op," XYZ = %f, %f, %f'\n",
+ vp->pcsCoords[0],vp->pcsCoords[1],vp->pcsCoords[2]);
+ break;
+ case icSigLabData:
+ fprintf(op," Lab = %f, %f, %f'\n",
+ vp->pcsCoords[0],vp->pcsCoords[1],vp->pcsCoords[2]);
+ break;
+ default:
+ fprintf(op," Unexpected PCS\n");
+ break;
+ }
+ }
+ if (p->nDeviceCoords > 0) {
+ fprintf(op," Device Coords = ");
+ for (n = 0; n < p->nDeviceCoords; n++) {
+ if (n > 0)
+ printf(", ");
+ printf("%f",vp->deviceCoords[n]);
+ }
+ printf("\n");
+ }
+ }
+ }
}
/* Allocate variable sized data elements */
static int icmNamedColor_allocate(
- icmBase *pp
-) {
- icmNamedColor *p = (icmNamedColor *)pp;
- icc *icp = p->icp;
-
- if (p->count != p->_count) {
- unsigned int i;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (icmNamedColorVal *) icp->al->calloc(icp->al,p->count, sizeof(icmNamedColorVal))) == NULL) {
- sprintf(icp->err,"icmNamedColor_alloc: calloc() of icmNamedColor data failed");
- return icp->errc = 2;
- }
- for (i = 0; i < p->count; i++) {
- p->data[i].icp = icp; /* Do init */
- }
- p->_count = p->count;
- }
- return 0;
+ icmBase *pp
+) {
+ icmNamedColor *p = (icmNamedColor *)pp;
+ icc *icp = p->icp;
+
+ if (p->count != p->_count) {
+ unsigned int i;
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (icmNamedColorVal *) icp->al->calloc(icp->al,p->count, sizeof(icmNamedColorVal))) == NULL) {
+ sprintf(icp->err,"icmNamedColor_alloc: calloc() of icmNamedColor data failed");
+ return icp->errc = 2;
+ }
+ for (i = 0; i < p->count; i++) {
+ p->data[i].icp = icp; /* Do init */
+ }
+ p->_count = p->count;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmNamedColor_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmNamedColor *p = (icmNamedColor *)pp;
- icc *icp = p->icp;
+ icmNamedColor *p = (icmNamedColor *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmNamedColor(
- icc *icp
+ icc *icp
) {
- icmNamedColor *p;
- if ((p = (icmNamedColor *) icp->al->calloc(icp->al,1,sizeof(icmNamedColor))) == NULL)
- return NULL;
- p->ttype = icSigNamedColor2Type;
- p->refcount = 1;
- p->get_size = icmNamedColor_get_size;
- p->read = icmNamedColor_read;
- p->write = icmNamedColor_write;
- p->dump = icmNamedColor_dump;
- p->allocate = icmNamedColor_allocate;
- p->del = icmNamedColor_delete;
- p->icp = icp;
+ icmNamedColor *p;
+ if ((p = (icmNamedColor *) icp->al->calloc(icp->al,1,sizeof(icmNamedColor))) == NULL)
+ return NULL;
+ p->ttype = icSigNamedColor2Type;
+ p->refcount = 1;
+ p->get_size = icmNamedColor_get_size;
+ p->read = icmNamedColor_read;
+ p->write = icmNamedColor_write;
+ p->dump = icmNamedColor_dump;
+ p->allocate = icmNamedColor_allocate;
+ p->del = icmNamedColor_delete;
+ p->icp = icp;
- /* Default the the number of device coords appropriately for NamedColorType */
- p->nDeviceCoords = number_ColorSpaceSignature(icp->header->colorSpace);
+ /* Default the the number of device coords appropriately for NamedColorType */
+ p->nDeviceCoords = number_ColorSpaceSignature(icp->header->colorSpace);
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -6290,523 +6280,523 @@ static icmBase *new_icmNamedColor(
/* Return the number of bytes needed to write this tag */
static unsigned int icmTextDescription_get_size(
- icmBase *pp
-) {
- icmTextDescription *p = (icmTextDescription *)pp;
- unsigned int len = 0;
- if (p->size > UINT_MAX - (8 + 4 + 8)) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += 8; /* 8 bytes for tag and padding */
- len += 4 + p->size; /* Ascii string length + ascii string */
- len += 8; /* Unicode language code + length */
- if (p->ucSize > (UINT_MAX - len) / 2) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += 2 * p->ucSize; /* Unicode string */
- if (len > (UINT_MAX - (3 + 67))) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += 3 + 67; /* ScriptCode code, length string */
- return len;
+ icmBase *pp
+) {
+ icmTextDescription *p = (icmTextDescription *)pp;
+ unsigned int len = 0;
+ if (p->size > UINT_MAX - (8 + 4 + 8)) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4 + p->size; /* Ascii string length + ascii string */
+ len += 8; /* Unicode language code + length */
+ if (p->ucSize > (UINT_MAX - len) / 2) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += 2 * p->ucSize; /* Unicode string */
+ if (len > (UINT_MAX - (3 + 67))) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += 3 + 67; /* ScriptCode code, length string */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmTextDescription_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
) {
- icmTextDescription *p = (icmTextDescription *)pp;
- icc *icp = p->icp;
- int rv;
- char *bp, *buf, *end;
+ icmTextDescription *p = (icmTextDescription *)pp;
+ icc *icp = p->icp;
+ int rv;
+ char *bp, *buf, *end;
#ifdef ICM_STRICT
- if (len < (8 + 4 + 8 + 3 /* + 67 */)) {
+ if (len < (8 + 4 + 8 + 3 /* + 67 */)) {
#else
- if (len < (8 + 4 + 8 + 3)) {
+ if (len < (8 + 4 + 8 + 3)) {
#endif
- sprintf(icp->err,"icmTextDescription_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmTextDescription_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmTextDescription_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read from the buffer into the structure */
- if ((rv = p->core_read(p, &bp, end)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ sprintf(icp->err,"icmTextDescription_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmTextDescription_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmTextDescription_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read from the buffer into the structure */
+ if ((rv = p->core_read(p, &bp, end)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* core read the object, return 0 on success, error code on fail */
static int icmTextDescription_core_read(
- icmTextDescription *p,
- char **bpp, /* Pointer to buffer pointer, returns next after read */
- char *end /* Pointer to past end of read buffer */
-) {
- icc *icp = p->icp;
- int rv = 0;
- char *bp = *bpp;
-
- if ((bp + 8) > end) {
- sprintf(icp->err,"icmTextDescription_read: Data too short to type descriptor");
- *bpp = bp;
- return icp->errc = 1;
- }
-
- p->size = read_UInt32Number(bp);
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Wrong tag type ('%s') for icmTextDescription",
- tag2str((icTagTypeSignature)read_SInt32Number(bp)));
- return icp->errc = 1;
- }
- bp = bp + 8;
-
- /* Read the Ascii string */
- if ((bp + 4) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data too short to read Ascii header");
- return icp->errc = 1;
- }
- p->size = read_UInt32Number(bp);
- bp += 4;
- if (p->size > 0) {
- if ((bp + p->size) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data to short to read Ascii string");
- return icp->errc = 1;
- }
- if (check_null_string(bp,p->size)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: ascii string is not terminated");
- return icp->errc = 1;
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- return rv;
- }
- strcpy((void *)p->desc, (void *)bp);
- bp += p->size;
- }
-
- /* Read the Unicode string */
- if ((bp + 8) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data too short to read Unicode string");
- return icp->errc = 1;
- }
- p->ucLangCode = read_UInt32Number(bp);
- bp += 4;
- p->ucSize = read_UInt32Number(bp);
- bp += 4;
- if (p->ucSize > 0) {
- ORD16 *up;
- if ((bp + 2 * p->ucSize) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data too short to read Unicode string");
- return icp->errc = 1;
- }
- if (check_null_string16(bp,p->ucSize)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Unicode string is not terminated");
- return icp->errc = 1;
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- return rv;
- }
- for(up = p->ucDesc; bp[0] != 0 || bp[1] != 0; up++, bp += 2)
- *up = read_UInt16Number(bp);
- *up = 0; /* Unicode null */
- bp += 2;
- }
-
- /* Read the ScriptCode string */
- if ((bp + 3) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data too short to read ScriptCode header");
- return icp->errc = 1;
- }
- p->scCode = read_UInt16Number(bp);
- bp += 2;
- p->scSize = read_UInt8Number(bp);
- bp += 1;
- if (p->scSize > 0) {
- if (p->scSize > 67) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: ScriptCode string too long");
- return icp->errc = 1;
- }
- if ((bp + p->scSize) > end) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: Data too short to read ScriptCode string");
- return icp->errc = 1;
- }
- if (check_null_string(bp,p->scSize)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_read: ScriptCode string is not terminated");
- return icp->errc = 1;
- }
- memcpy((void *)p->scDesc, (void *)bp, p->scSize);
- } else {
- memset((void *)p->scDesc, 0, 67);
- }
- bp += 67;
-
- *bpp = bp;
- return 0;
+ icmTextDescription *p,
+ char **bpp, /* Pointer to buffer pointer, returns next after read */
+ char *end /* Pointer to past end of read buffer */
+) {
+ icc *icp = p->icp;
+ int rv = 0;
+ char *bp = *bpp;
+
+ if ((bp + 8) > end) {
+ sprintf(icp->err,"icmTextDescription_read: Data too short to type descriptor");
+ *bpp = bp;
+ return icp->errc = 1;
+ }
+
+ p->size = read_UInt32Number(bp);
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Wrong tag type ('%s') for icmTextDescription",
+ tag2str((icTagTypeSignature)read_SInt32Number(bp)));
+ return icp->errc = 1;
+ }
+ bp = bp + 8;
+
+ /* Read the Ascii string */
+ if ((bp + 4) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data too short to read Ascii header");
+ return icp->errc = 1;
+ }
+ p->size = read_UInt32Number(bp);
+ bp += 4;
+ if (p->size > 0) {
+ if ((bp + p->size) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data to short to read Ascii string");
+ return icp->errc = 1;
+ }
+ if (check_null_string(bp,p->size)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: ascii string is not terminated");
+ return icp->errc = 1;
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ return rv;
+ }
+ strcpy((void *)p->desc, (void *)bp);
+ bp += p->size;
+ }
+
+ /* Read the Unicode string */
+ if ((bp + 8) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data too short to read Unicode string");
+ return icp->errc = 1;
+ }
+ p->ucLangCode = read_UInt32Number(bp);
+ bp += 4;
+ p->ucSize = read_UInt32Number(bp);
+ bp += 4;
+ if (p->ucSize > 0) {
+ ORD16 *up;
+ if ((bp + 2 * p->ucSize) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data too short to read Unicode string");
+ return icp->errc = 1;
+ }
+ if (check_null_string16(bp,p->ucSize)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Unicode string is not terminated");
+ return icp->errc = 1;
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ return rv;
+ }
+ for(up = p->ucDesc; bp[0] != 0 || bp[1] != 0; up++, bp += 2)
+ *up = read_UInt16Number(bp);
+ *up = 0; /* Unicode null */
+ bp += 2;
+ }
+
+ /* Read the ScriptCode string */
+ if ((bp + 3) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data too short to read ScriptCode header");
+ return icp->errc = 1;
+ }
+ p->scCode = read_UInt16Number(bp);
+ bp += 2;
+ p->scSize = read_UInt8Number(bp);
+ bp += 1;
+ if (p->scSize > 0) {
+ if (p->scSize > 67) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: ScriptCode string too long");
+ return icp->errc = 1;
+ }
+ if ((bp + p->scSize) > end) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: Data too short to read ScriptCode string");
+ return icp->errc = 1;
+ }
+ if (check_null_string(bp,p->scSize)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_read: ScriptCode string is not terminated");
+ return icp->errc = 1;
+ }
+ memcpy((void *)p->scDesc, (void *)bp, p->scSize);
+ } else {
+ memset((void *)p->scDesc, 0, 67);
+ }
+ bp += 67;
+
+ *bpp = bp;
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmTextDescription_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmTextDescription *p = (icmTextDescription *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmTextDescription_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write to the buffer from the structure */
- if ((rv = p->core_write(p, &bp)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmTextDescription_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmTextDescription *p = (icmTextDescription *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmTextDescription_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write to the buffer from the structure */
+ if ((rv = p->core_write(p, &bp)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmTextDescription_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Core write the contents of the object. Return 0 on sucess, error code on failure */
static int icmTextDescription_core_write(
- icmTextDescription *p,
- char **bpp /* Pointer to buffer pointer, returns next after read */
-) {
- icc *icp = p->icp;
- char *bp = *bpp;
- int rv = 0;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_SInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- bp = bp + 8;
-
- /* Write the Ascii string */
- if ((rv = write_UInt32Number(p->size,bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- bp += 4;
- if (p->size > 0) {
- if (check_null_string(p->desc,p->size)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_write: ascii string is not terminated");
- return icp->errc = 1;
- }
- strcpy((void *)bp, (void *)p->desc);
- bp += p->size;
- }
-
- /* Write the Unicode string */
- if ((rv = write_UInt32Number(p->ucLangCode, bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- bp += 4;
- if ((rv = write_UInt32Number(p->ucSize, bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- bp += 4;
- if (p->ucSize > 0) {
- ORD16 *up;
- if (check_null_string16((char *)p->ucDesc,p->ucSize)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_write: Unicode string is not terminated");
- return icp->errc = 1;
- }
- for(up = p->ucDesc; *up != 0; up++, bp += 2) {
- if ((rv = write_UInt16Number(((unsigned int)*up), bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt16Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- }
- bp[0] = 0; /* null */
- bp[1] = 0;
- bp += 2;
- }
-
- /* Write the ScriptCode string */
- if ((rv = write_UInt16Number(p->scCode, bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt16Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- bp += 2;
- if ((rv = write_UInt8Number(p->scSize, bp)) != 0) {
- sprintf(icp->err,"icmTextDescription_write: write_UInt8Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- bp += 1;
- if (p->scSize > 0) {
- if (p->scSize > 67) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_write: ScriptCode string too long");
- return icp->errc = 1;
- }
- if (check_null_string((char *)p->scDesc,p->scSize)) {
- *bpp = bp;
- sprintf(icp->err,"icmTextDescription_write: ScriptCode string is not terminated");
- return icp->errc = 1;
- }
- memcpy((void *)bp, (void *)p->scDesc, 67);
- } else {
- memset((void *)bp, 0, 67);
- }
- bp += 67;
-
- *bpp = bp;
- return 0;
+ icmTextDescription *p,
+ char **bpp /* Pointer to buffer pointer, returns next after read */
+) {
+ icc *icp = p->icp;
+ char *bp = *bpp;
+ int rv = 0;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_SInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ bp = bp + 8;
+
+ /* Write the Ascii string */
+ if ((rv = write_UInt32Number(p->size,bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ bp += 4;
+ if (p->size > 0) {
+ if (check_null_string(p->desc,p->size)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_write: ascii string is not terminated");
+ return icp->errc = 1;
+ }
+ strcpy((void *)bp, (void *)p->desc);
+ bp += p->size;
+ }
+
+ /* Write the Unicode string */
+ if ((rv = write_UInt32Number(p->ucLangCode, bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ bp += 4;
+ if ((rv = write_UInt32Number(p->ucSize, bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ bp += 4;
+ if (p->ucSize > 0) {
+ ORD16 *up;
+ if (check_null_string16((char *)p->ucDesc,p->ucSize)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_write: Unicode string is not terminated");
+ return icp->errc = 1;
+ }
+ for(up = p->ucDesc; *up != 0; up++, bp += 2) {
+ if ((rv = write_UInt16Number(((unsigned int)*up), bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt16Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ }
+ bp[0] = 0; /* null */
+ bp[1] = 0;
+ bp += 2;
+ }
+
+ /* Write the ScriptCode string */
+ if ((rv = write_UInt16Number(p->scCode, bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt16Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ bp += 2;
+ if ((rv = write_UInt8Number(p->scSize, bp)) != 0) {
+ sprintf(icp->err,"icmTextDescription_write: write_UInt8Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ bp += 1;
+ if (p->scSize > 0) {
+ if (p->scSize > 67) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_write: ScriptCode string too long");
+ return icp->errc = 1;
+ }
+ if (check_null_string((char *)p->scDesc,p->scSize)) {
+ *bpp = bp;
+ sprintf(icp->err,"icmTextDescription_write: ScriptCode string is not terminated");
+ return icp->errc = 1;
+ }
+ memcpy((void *)bp, (void *)p->scDesc, 67);
+ } else {
+ memset((void *)bp, 0, 67);
+ }
+ bp += 67;
+
+ *bpp = bp;
+ return 0;
}
/* Dump a text description of the object */
static void icmTextDescription_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmTextDescription *p = (icmTextDescription *)pp;
- unsigned long i, r, c;
-
- if (verb <= 0)
- return;
-
- fprintf(op,"TextDescription:\n");
-
- if (p->size > 0) {
- unsigned long size = p->size > 0 ? p->size-1 : 0;
- fprintf(op," ASCII data, length %lu chars:\n",p->size);
-
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 75) {
- if (isprint((unsigned char) p->desc[i])) {
- fprintf(op,"%c",p->desc[i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->desc[i]);
- c += 4;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
- } else {
- fprintf(op," No ASCII data\n");
- }
-
- /* Can't dump Unicode or ScriptCode as text with portable code */
- if (p->ucSize > 0) {
- unsigned long size = p->ucSize;
- fprintf(op," Unicode Data, Language code 0x%x, length %lu chars\n",
- p->ucLangCode, p->ucSize);
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 75) {
- fprintf(op,"%04x ",p->ucDesc[i]);
- c += 5;
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
- } else {
- fprintf(op," No Unicode data\n");
- }
- if (p->scSize > 0) {
- unsigned long size = p->scSize;
- fprintf(op," ScriptCode Data, Code 0x%x, length %lu chars\n",
- p->scCode, p->scSize);
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 75) {
- fprintf(op,"%02x ",p->scDesc[i]);
- c += 3;
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
- } else {
- fprintf(op," No ScriptCode data\n");
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmTextDescription *p = (icmTextDescription *)pp;
+ unsigned long i, r, c;
+
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"TextDescription:\n");
+
+ if (p->size > 0) {
+ unsigned long size = p->size > 0 ? p->size-1 : 0;
+ fprintf(op," ASCII data, length %lu chars:\n",p->size);
+
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 75) {
+ if (isprint((unsigned char) p->desc[i])) {
+ fprintf(op,"%c",p->desc[i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->desc[i]);
+ c += 4;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+ } else {
+ fprintf(op," No ASCII data\n");
+ }
+
+ /* Can't dump Unicode or ScriptCode as text with portable code */
+ if (p->ucSize > 0) {
+ unsigned long size = p->ucSize;
+ fprintf(op," Unicode Data, Language code 0x%x, length %lu chars\n",
+ p->ucLangCode, p->ucSize);
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 75) {
+ fprintf(op,"%04x ",p->ucDesc[i]);
+ c += 5;
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+ } else {
+ fprintf(op," No Unicode data\n");
+ }
+ if (p->scSize > 0) {
+ unsigned long size = p->scSize;
+ fprintf(op," ScriptCode Data, Code 0x%x, length %lu chars\n",
+ p->scCode, p->scSize);
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 75) {
+ fprintf(op,"%02x ",p->scDesc[i]);
+ c += 3;
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+ } else {
+ fprintf(op," No ScriptCode data\n");
+ }
}
/* Allocate variable sized data elements */
static int icmTextDescription_allocate(
- icmBase *pp
-) {
- icmTextDescription *p = (icmTextDescription *)pp;
- icc *icp = p->icp;
-
- if (p->size != p->_size) {
- if (p->desc != NULL)
- icp->al->free(icp->al, p->desc);
- if ((p->desc = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
- sprintf(icp->err,"icmTextDescription_alloc: calloc() of Ascii description failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- if (p->ucSize != p->uc_size) {
- if (p->ucDesc != NULL)
- icp->al->free(icp->al, p->ucDesc);
- if ((p->ucDesc = (ORD16 *) icp->al->calloc(icp->al, p->ucSize, sizeof(ORD16))) == NULL) {
- sprintf(icp->err,"icmTextDescription_alloc: calloc() of Unicode description failed");
- return icp->errc = 2;
- }
- p->uc_size = p->ucSize;
- }
- return 0;
+ icmBase *pp
+) {
+ icmTextDescription *p = (icmTextDescription *)pp;
+ icc *icp = p->icp;
+
+ if (p->size != p->_size) {
+ if (p->desc != NULL)
+ icp->al->free(icp->al, p->desc);
+ if ((p->desc = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
+ sprintf(icp->err,"icmTextDescription_alloc: calloc() of Ascii description failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ if (p->ucSize != p->uc_size) {
+ if (p->ucDesc != NULL)
+ icp->al->free(icp->al, p->ucDesc);
+ if ((p->ucDesc = (ORD16 *) icp->al->calloc(icp->al, p->ucSize, sizeof(ORD16))) == NULL) {
+ sprintf(icp->err,"icmTextDescription_alloc: calloc() of Unicode description failed");
+ return icp->errc = 2;
+ }
+ p->uc_size = p->ucSize;
+ }
+ return 0;
}
/* Free all variable sized elements */
static void icmTextDescription_unallocate(
- icmTextDescription *p
+ icmTextDescription *p
) {
- icc *icp = p->icp;
+ icc *icp = p->icp;
- if (p->desc != NULL)
- icp->al->free(icp->al, p->desc);
- if (p->ucDesc != NULL)
- icp->al->free(icp->al, p->ucDesc);
+ if (p->desc != NULL)
+ icp->al->free(icp->al, p->desc);
+ if (p->ucDesc != NULL)
+ icp->al->free(icp->al, p->ucDesc);
}
/* Free all storage in the object */
static void icmTextDescription_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmTextDescription *p = (icmTextDescription *)pp;
- icc *icp = p->icp;
+ icmTextDescription *p = (icmTextDescription *)pp;
+ icc *icp = p->icp;
- icmTextDescription_unallocate(p);
- icp->al->free(icp->al, p);
+ icmTextDescription_unallocate(p);
+ icp->al->free(icp->al, p);
}
/* Initialze a named object */
static void icmTextDescription_init(
- icmTextDescription *p,
- icc *icp
+ icmTextDescription *p,
+ icc *icp
) {
- memset((void *)p, 0, sizeof(icmTextDescription)); /* Imitate calloc */
+ memset((void *)p, 0, sizeof(icmTextDescription)); /* Imitate calloc */
- p->ttype = icSigTextDescriptionType;
- p->refcount = 1;
- p->get_size = icmTextDescription_get_size;
- p->read = icmTextDescription_read;
- p->write = icmTextDescription_write;
- p->dump = icmTextDescription_dump;
- p->allocate = icmTextDescription_allocate;
- p->del = icmTextDescription_delete;
- p->icp = icp;
+ p->ttype = icSigTextDescriptionType;
+ p->refcount = 1;
+ p->get_size = icmTextDescription_get_size;
+ p->read = icmTextDescription_read;
+ p->write = icmTextDescription_write;
+ p->dump = icmTextDescription_dump;
+ p->allocate = icmTextDescription_allocate;
+ p->del = icmTextDescription_delete;
+ p->icp = icp;
- p->core_read = icmTextDescription_core_read;
- p->core_write = icmTextDescription_core_write;
+ p->core_read = icmTextDescription_core_read;
+ p->core_write = icmTextDescription_core_write;
}
/* Create an empty object. Return null on error */
static icmBase *new_icmTextDescription(
- icc *icp
+ icc *icp
) {
- icmTextDescription *p;
- if ((p = (icmTextDescription *) icp->al->calloc(icp->al,1,sizeof(icmTextDescription))) == NULL)
- return NULL;
+ icmTextDescription *p;
+ if ((p = (icmTextDescription *) icp->al->calloc(icp->al,1,sizeof(icmTextDescription))) == NULL)
+ return NULL;
- icmTextDescription_init(p,icp);
- return (icmBase *)p;
+ icmTextDescription_init(p,icp);
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -6815,150 +6805,150 @@ static icmBase *new_icmTextDescription(
/* Return the number of bytes needed to write this tag */
static unsigned int icmDescStruct_get_size(
- icmDescStruct *p
+ icmDescStruct *p
) {
- unsigned int len = 0;
- len += 20; /* 20 bytes for header info */
- len += p->device.get_size((icmBase *)&p->device);
- len += p->model.get_size((icmBase *)&p->model);
- return len;
+ unsigned int len = 0;
+ len += 20; /* 20 bytes for header info */
+ len += p->device.get_size((icmBase *)&p->device);
+ len += p->model.get_size((icmBase *)&p->model);
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmDescStruct_read(
- icmDescStruct *p,
- char **bpp, /* Pointer to buffer pointer, returns next after read */
- char *end /* Pointer to past end of read buffer */
+ icmDescStruct *p,
+ char **bpp, /* Pointer to buffer pointer, returns next after read */
+ char *end /* Pointer to past end of read buffer */
) {
- icc *icp = p->icp;
- char *bp = *bpp;
- int rv = 0;
+ icc *icp = p->icp;
+ char *bp = *bpp;
+ int rv = 0;
- if ((bp + 20) > end) {
- sprintf(icp->err,"icmDescStruct_read: Data too short read header");
- *bpp = bp;
- return icp->errc = 1;
- }
+ if ((bp + 20) > end) {
+ sprintf(icp->err,"icmDescStruct_read: Data too short read header");
+ *bpp = bp;
+ return icp->errc = 1;
+ }
p->deviceMfg = read_SInt32Number(bp + 0);
p->deviceModel = read_UInt32Number(bp + 4);
read_UInt64Number(&p->attributes, bp + 8);
- p->technology = read_UInt32Number(bp + 16);
- *bpp = bp += 20;
+ p->technology = read_UInt32Number(bp + 16);
+ *bpp = bp += 20;
- /* Read the device text description */
- if ((rv = p->device.core_read(&p->device, bpp, end)) != 0) {
- return rv;
- }
+ /* Read the device text description */
+ if ((rv = p->device.core_read(&p->device, bpp, end)) != 0) {
+ return rv;
+ }
- /* Read the model text description */
- if ((rv = p->model.core_read(&p->model, bpp, end)) != 0) {
- return rv;
- }
-
- return 0;
+ /* Read the model text description */
+ if ((rv = p->model.core_read(&p->model, bpp, end)) != 0) {
+ return rv;
+ }
+
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmDescStruct_write(
- icmDescStruct *p,
- char **bpp /* Pointer to buffer pointer, returns next after read */
+ icmDescStruct *p,
+ char **bpp /* Pointer to buffer pointer, returns next after read */
) {
- icc *icp = p->icp;
- char *bp = *bpp;
- int rv = 0;
+ icc *icp = p->icp;
+ char *bp = *bpp;
+ int rv = 0;
if ((rv = write_SInt32Number(p->deviceMfg, bp + 0)) != 0) {
- sprintf(icp->err,"icmDescStruct_write: write_SInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmDescStruct_write: write_SInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
if ((rv = write_UInt32Number(p->deviceModel, bp + 4)) != 0) {
- sprintf(icp->err,"icmDescStruct_write: write_UInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmDescStruct_write: write_UInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
if ((rv = write_UInt64Number(&p->attributes, bp + 8)) != 0) {
- sprintf(icp->err,"icmDescStruct_write: write_UInt64Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- if ((rv = write_UInt32Number(p->technology, bp + 16)) != 0) {
- sprintf(icp->err,"icmDescStruct_write: write_UInt32Number() failed");
- *bpp = bp;
- return icp->errc = rv;
- }
- *bpp = bp += 20;
-
- /* Write the device text description */
- if ((rv = p->device.core_write(&p->device, bpp)) != 0) {
- return rv;
- }
-
- /* Write the model text description */
- if ((rv = p->model.core_write(&p->model, bpp)) != 0) {
- return rv;
- }
-
- return 0;
+ sprintf(icp->err,"icmDescStruct_write: write_UInt64Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt32Number(p->technology, bp + 16)) != 0) {
+ sprintf(icp->err,"icmDescStruct_write: write_UInt32Number() failed");
+ *bpp = bp;
+ return icp->errc = rv;
+ }
+ *bpp = bp += 20;
+
+ /* Write the device text description */
+ if ((rv = p->device.core_write(&p->device, bpp)) != 0) {
+ return rv;
+ }
+
+ /* Write the model text description */
+ if ((rv = p->model.core_write(&p->model, bpp)) != 0) {
+ return rv;
+ }
+
+ return 0;
}
/* Dump a text description of the object */
static void icmDescStruct_dump(
- icmDescStruct *p,
- FILE *op, /* Output to dump to */
- int verb, /* Verbosity level */
- int index /* Description index */
-) {
- if (verb <= 0)
- return;
-
- fprintf(op,"DescStruct %u:\n",index);
- if (verb >= 1) {
- fprintf(op," Dev. Mnfctr. = %s\n",tag2str(p->deviceMfg)); /* ~~~ */
- fprintf(op," Dev. Model = %s\n",tag2str(p->deviceModel)); /* ~~~ */
- fprintf(op," Dev. Attrbts = %s\n", string_DeviceAttributes(p->attributes.l));
- fprintf(op," Dev. Technology = %s\n", string_TechnologySignature(p->technology));
- p->device.dump((icmBase *)&p->device, op,verb);
- p->model.dump((icmBase *)&p->model, op,verb);
- fprintf(op,"\n");
- }
+ icmDescStruct *p,
+ FILE *op, /* Output to dump to */
+ int verb, /* Verbosity level */
+ int index /* Description index */
+) {
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"DescStruct %u:\n",index);
+ if (verb >= 1) {
+ fprintf(op," Dev. Mnfctr. = %s\n",tag2str(p->deviceMfg)); /* ~~~ */
+ fprintf(op," Dev. Model = %s\n",tag2str(p->deviceModel)); /* ~~~ */
+ fprintf(op," Dev. Attrbts = %s\n", string_DeviceAttributes(p->attributes.l));
+ fprintf(op," Dev. Technology = %s\n", string_TechnologySignature(p->technology));
+ p->device.dump((icmBase *)&p->device, op,verb);
+ p->model.dump((icmBase *)&p->model, op,verb);
+ fprintf(op,"\n");
+ }
}
/* Allocate variable sized data elements (ie. descriptions) */
static int icmDescStruct_allocate(
- icmDescStruct *p
+ icmDescStruct *p
) {
- int rv;
+ int rv;
- if ((rv = p->device.allocate((icmBase *)&p->device)) != 0) {
- return rv;
- }
- if ((rv = p->model.allocate((icmBase *)&p->model)) != 0) {
- return rv;
- }
- return 0;
+ if ((rv = p->device.allocate((icmBase *)&p->device)) != 0) {
+ return rv;
+ }
+ if ((rv = p->model.allocate((icmBase *)&p->model)) != 0) {
+ return rv;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmDescStruct_delete(
- icmDescStruct *p
+ icmDescStruct *p
) {
- icmTextDescription_unallocate(&p->device);
- icmTextDescription_unallocate(&p->model);
+ icmTextDescription_unallocate(&p->device);
+ icmTextDescription_unallocate(&p->model);
}
/* Init a DescStruct object */
static void icmDescStruct_init(
- icmDescStruct *p,
- icc *icp
+ icmDescStruct *p,
+ icc *icp
) {
- p->allocate = icmDescStruct_allocate;
- p->icp = icp;
+ p->allocate = icmDescStruct_allocate;
+ p->icp = icp;
- icmTextDescription_init(&p->device, icp);
- icmTextDescription_init(&p->model, icp);
+ icmTextDescription_init(&p->device, icp);
+ icmTextDescription_init(&p->model, icp);
}
/* - - - - - - - - - - - - - - - */
@@ -6966,223 +6956,223 @@ static void icmDescStruct_init(
/* Return the number of bytes needed to write this tag */
static unsigned int icmProfileSequenceDesc_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- unsigned int len = 0;
- unsigned int i;
- len += 12; /* 8 bytes for tag, padding and count */
- for (i = 0; i < p->count; i++) { /* All the description structures */
- len += icmDescStruct_get_size(&p->data[i]);
- }
- return len;
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ unsigned int len = 0;
+ unsigned int i;
+ len += 12; /* 8 bytes for tag, padding and count */
+ for (i = 0; i < p->count; i++) { /* All the description structures */
+ len += icmDescStruct_get_size(&p->data[i]);
+ }
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmProfileSequenceDesc_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- icc *icp = p->icp;
- unsigned long i;
- char *bp, *buf, *end;
- int rv = 0;
-
- if (len < 12) {
- sprintf(icp->err,"icmProfileSequenceDesc_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmProfileSequenceDesc_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmProfileSequenceDesc_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmProfileSequenceDesc_read: Wrong tag type for icmProfileSequenceDesc");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp += 8; /* Skip padding */
-
- p->count = read_UInt32Number(bp); /* Number of sequence descriptions */
- if (p->count > 1000) {
- /* This limit is arbitrary and simply intended to limit
- * resource use by corrupt profiles. The spec allows
- * 2^32 sequence descriptions, although fewer than that
- * can be literally encapsulated. A sequence description
- * table takes 20 bytes for the header plus at least
- * 20 bytes per entry. */
- sprintf(icp->err,"icmProfileSequenceDesc_read: too many sequence descriptions");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- bp += 4;
-
- /* Read all the sequence descriptions */
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- for (i = 0; i < p->count; i++) {
- if ((rv = icmDescStruct_read(&p->data[i], &bp, end)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ char *bp, *buf, *end;
+ int rv = 0;
+
+ if (len < 12) {
+ sprintf(icp->err,"icmProfileSequenceDesc_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmProfileSequenceDesc_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmProfileSequenceDesc_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmProfileSequenceDesc_read: Wrong tag type for icmProfileSequenceDesc");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp += 8; /* Skip padding */
+
+ p->count = read_UInt32Number(bp); /* Number of sequence descriptions */
+ if (p->count > 1000) {
+ /* This limit is arbitrary and simply intended to limit
+ * resource use by corrupt profiles. The spec allows
+ * 2^32 sequence descriptions, although fewer than that
+ * can be literally encapsulated. A sequence description
+ * table takes 20 bytes for the header plus at least
+ * 20 bytes per entry. */
+ sprintf(icp->err,"icmProfileSequenceDesc_read: too many sequence descriptions");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ bp += 4;
+
+ /* Read all the sequence descriptions */
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ for (i = 0; i < p->count; i++) {
+ if ((rv = icmDescStruct_read(&p->data[i], &bp, end)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmProfileSequenceDesc_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmProfileSequenceDesc_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmProfileSequenceDesc_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- if ((rv = write_UInt32Number(p->count,bp+8)) != 0) {
- sprintf(icp->err,"icmProfileSequenceDesc_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp = bp + 12;
-
- /* Write all the description structures */
- for (i = 0; i < p->count; i++) {
- if ((rv = icmDescStruct_write(&p->data[i], &bp)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmProfileSequenceDesc_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmProfileSequenceDesc_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmProfileSequenceDesc_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ if ((rv = write_UInt32Number(p->count,bp+8)) != 0) {
+ sprintf(icp->err,"icmProfileSequenceDesc_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp = bp + 12;
+
+ /* Write all the description structures */
+ for (i = 0; i < p->count; i++) {
+ if ((rv = icmDescStruct_write(&p->data[i], &bp)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmProfileSequenceDesc_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmProfileSequenceDesc_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- if (verb <= 0)
- return;
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"ProfileSequenceDesc:\n");
- fprintf(op," No. elements = %u\n",p->count);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->count; i++)
- icmDescStruct_dump(&p->data[i], op, verb-1, i);
- }
+ fprintf(op,"ProfileSequenceDesc:\n");
+ fprintf(op," No. elements = %u\n",p->count);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->count; i++)
+ icmDescStruct_dump(&p->data[i], op, verb-1, i);
+ }
}
/* Allocate variable sized data elements (ie. count of profile descriptions) */
static int icmProfileSequenceDesc_allocate(
- icmBase *pp
-) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- icc *icp = p->icp;
- unsigned int i;
-
- if (p->count != p->_count) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (icmDescStruct *) icp->al->calloc(icp->al, p->count, sizeof(icmDescStruct))) == NULL) {
- sprintf(icp->err,"icmProfileSequenceDesc_allocate Allocation of DescStruct array failed");
- return icp->errc = 2;
- }
- /* Now init the DescStructs */
- for (i = 0; i < p->count; i++) {
- icmDescStruct_init(&p->data[i], icp);
- }
- p->_count = p->count;
- }
- return 0;
+ icmBase *pp
+) {
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ icc *icp = p->icp;
+ unsigned int i;
+
+ if (p->count != p->_count) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (icmDescStruct *) icp->al->calloc(icp->al, p->count, sizeof(icmDescStruct))) == NULL) {
+ sprintf(icp->err,"icmProfileSequenceDesc_allocate Allocation of DescStruct array failed");
+ return icp->errc = 2;
+ }
+ /* Now init the DescStructs */
+ for (i = 0; i < p->count; i++) {
+ icmDescStruct_init(&p->data[i], icp);
+ }
+ p->_count = p->count;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmProfileSequenceDesc_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
- icc *icp = p->icp;
- unsigned int i;
+ icmProfileSequenceDesc *p = (icmProfileSequenceDesc *)pp;
+ icc *icp = p->icp;
+ unsigned int i;
- for (i = 0; i < p->count; i++) {
- icmDescStruct_delete(&p->data[i]); /* Free allocated contents */
- }
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ for (i = 0; i < p->count; i++) {
+ icmDescStruct_delete(&p->data[i]); /* Free allocated contents */
+ }
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmProfileSequenceDesc(
- icc *icp
+ icc *icp
) {
- icmProfileSequenceDesc *p;
- if ((p = (icmProfileSequenceDesc *) icp->al->calloc(icp->al,1,sizeof(icmProfileSequenceDesc))) == NULL)
- return NULL;
- p->ttype = icSigProfileSequenceDescType;
- p->refcount = 1;
- p->get_size = icmProfileSequenceDesc_get_size;
- p->read = icmProfileSequenceDesc_read;
- p->write = icmProfileSequenceDesc_write;
- p->dump = icmProfileSequenceDesc_dump;
- p->allocate = icmProfileSequenceDesc_allocate;
- p->del = icmProfileSequenceDesc_delete;
- p->icp = icp;
+ icmProfileSequenceDesc *p;
+ if ((p = (icmProfileSequenceDesc *) icp->al->calloc(icp->al,1,sizeof(icmProfileSequenceDesc))) == NULL)
+ return NULL;
+ p->ttype = icSigProfileSequenceDescType;
+ p->refcount = 1;
+ p->get_size = icmProfileSequenceDesc_get_size;
+ p->read = icmProfileSequenceDesc_read;
+ p->write = icmProfileSequenceDesc_write;
+ p->dump = icmProfileSequenceDesc_dump;
+ p->allocate = icmProfileSequenceDesc_allocate;
+ p->del = icmProfileSequenceDesc_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -7190,392 +7180,391 @@ static icmBase *new_icmProfileSequenceDesc(
/* Return the number of bytes needed to write this tag */
static unsigned int icmSignature_get_size(
- icmBase *pp
+ icmBase *pp
) {
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += 4; /* 4 for signature */
- return len;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4; /* 4 for signature */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmSignature_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmSignature *p = (icmSignature *)pp;
- icc *icp = p->icp;
- char *bp, *buf;
-
- if (len < 12) {
- sprintf(icp->err,"icmSignature_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmSignature_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmSignature_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmSignaturSignatureng tag type for icmSignature");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read the encoded measurement geometry */
- p->sig = (icTechnologySignature)read_SInt32Number(bp + 8);
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmSignature *p = (icmSignature *)pp;
+ icc *icp = p->icp;
+ char *bp, *buf;
+
+ if (len < 12) {
+ sprintf(icp->err,"icmSignature_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmSignature_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmSignature_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmSignaturSignatureng tag type for icmSignature");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read the encoded measurement geometry */
+ p->sig = (icTechnologySignature)read_SInt32Number(bp + 8);
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmSignature_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmSignature *p = (icmSignature *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmSignature_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmSignature_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write the signature */
- if ((rv = write_SInt32Number((int)p->sig, bp + 8)) != 0) {
- sprintf(icp->err,"icmSignaturea_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmSignature_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmSignature *p = (icmSignature *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmSignature_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmSignature_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write the signature */
+ if ((rv = write_SInt32Number((int)p->sig, bp + 8)) != 0) {
+ sprintf(icp->err,"icmSignaturea_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmSignature_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmSignature_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmSignature *p = (icmSignature *)pp;
- if (verb <= 0)
- return;
+ icmSignature *p = (icmSignature *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"Signature\n");
- fprintf(op," Technology = %s\n", string_TechnologySignature(p->sig));
+ fprintf(op,"Signature\n");
+ fprintf(op," Technology = %s\n", string_TechnologySignature(p->sig));
}
/* Allocate variable sized data elements */
static int icmSignature_allocate(
- icmBase *pp
+ icmBase *pp
) {
- /* Nothing to do */
- return 0;
+ /* Nothing to do */
+ return 0;
}
/* Free all storage in the object */
static void icmSignature_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmSignature *p = (icmSignature *)pp;
- icc *icp = p->icp;
+ icmSignature *p = (icmSignature *)pp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmSignature(
- icc *icp
+ icc *icp
) {
- icmSignature *p;
- if ((p = (icmSignature *) icp->al->calloc(icp->al,1,sizeof(icmSignature))) == NULL)
- return NULL;
- p->ttype = icSigSignatureType;
- p->refcount = 1;
- p->get_size = icmSignature_get_size;
- p->read = icmSignature_read;
- p->write = icmSignature_write;
- p->dump = icmSignature_dump;
- p->allocate = icmSignature_allocate;
- p->del = icmSignature_delete;
- p->icp = icp;
+ icmSignature *p;
+ if ((p = (icmSignature *) icp->al->calloc(icp->al,1,sizeof(icmSignature))) == NULL)
+ return NULL;
+ p->ttype = icSigSignatureType;
+ p->refcount = 1;
+ p->get_size = icmSignature_get_size;
+ p->read = icmSignature_read;
+ p->write = icmSignature_write;
+ p->dump = icmSignature_dump;
+ p->allocate = icmSignature_allocate;
+ p->del = icmSignature_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
/* Data conversion support functions */
static int read_ScreeningData(icmScreeningData *p, char *d) {
- p->frequency = read_S15Fixed16Number(d + 0);
- p->angle = read_S15Fixed16Number(d + 4);
- p->spotShape = (icSpotShape)read_SInt32Number(d + 8);
- return 0;
+ p->frequency = read_S15Fixed16Number(d + 0);
+ p->angle = read_S15Fixed16Number(d + 4);
+ p->spotShape = (icSpotShape)read_SInt32Number(d + 8);
+ return 0;
}
static int write_ScreeningData(icmScreeningData *p, char *d) {
- int rv;
- if ((rv = write_S15Fixed16Number(p->frequency, d + 0)) != 0)
- return rv;
- if ((rv = write_S15Fixed16Number(p->angle, d + 4)) != 0)
- return rv;
- if ((rv = write_SInt32Number((int)p->spotShape, d + 8)) != 0)
- return rv;
- return 0;
+ int rv;
+ if ((rv = write_S15Fixed16Number(p->frequency, d + 0)) != 0)
+ return rv;
+ if ((rv = write_S15Fixed16Number(p->angle, d + 4)) != 0)
+ return rv;
+ if ((rv = write_SInt32Number((int)p->spotShape, d + 8)) != 0)
+ return rv;
+ return 0;
}
-
/* icmScreening object */
/* Return the number of bytes needed to write this tag */
static unsigned int icmScreening_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmScreening *p = (icmScreening *)pp;
- unsigned int len = 0;
- len += 16; /* 16 bytes for tag, padding, flag & channeles */
- if (p->channels > (UINT_MAX - len) / 12) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += p->channels * 12; /* 12 bytes for each channel */
- return len;
+ icmScreening *p = (icmScreening *)pp;
+ unsigned int len = 0;
+ len += 16; /* 16 bytes for tag, padding, flag & channeles */
+ if (p->channels > (UINT_MAX - len) / 12) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += p->channels * 12; /* 12 bytes for each channel */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmScreening_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmScreening *p = (icmScreening *)pp;
- icc *icp = p->icp;
- int rv = 0;
- unsigned long i;
- char *bp, *buf, *end;
-
- if (len < 12) {
- sprintf(icp->err,"icmScreening_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmScreening_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmScreening_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmScreening_read: Wrong tag type for icmScreening");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->screeningFlag = read_UInt32Number(bp+8); /* Flags */
- p->channels = read_UInt32Number(bp+12); /* Number of channels */
- bp = bp + 16;
-
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
-
- /* Read all the data from the buffer */
- for (i = 0; i < p->channels; i++, bp += 12) {
- if ((bp + 12) > end) {
- sprintf(icp->err,"icmScreening_read: Data too short to read Screening Data");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- read_ScreeningData(&p->data[i], bp);
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmScreening *p = (icmScreening *)pp;
+ icc *icp = p->icp;
+ int rv = 0;
+ unsigned long i;
+ char *bp, *buf, *end;
+
+ if (len < 12) {
+ sprintf(icp->err,"icmScreening_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmScreening_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmScreening_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmScreening_read: Wrong tag type for icmScreening");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->screeningFlag = read_UInt32Number(bp+8); /* Flags */
+ p->channels = read_UInt32Number(bp+12); /* Number of channels */
+ bp = bp + 16;
+
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+
+ /* Read all the data from the buffer */
+ for (i = 0; i < p->channels; i++, bp += 12) {
+ if ((bp + 12) > end) {
+ sprintf(icp->err,"icmScreening_read: Data too short to read Screening Data");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ read_ScreeningData(&p->data[i], bp);
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmScreening_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmScreening *p = (icmScreening *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmScreening_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmScreening_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- if ((rv = write_UInt32Number(p->screeningFlag,bp+8)) != 0) {
- sprintf(icp->err,"icmScreening_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt32Number(p->channels,bp+12)) != 0) {
- sprintf(icp->err,"icmScreening_write: write_UInt32NumberXYZumber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp = bp + 16;
-
- /* Write all the data to the buffer */
- for (i = 0; i < p->channels; i++, bp += 12) {
- if ((rv = write_ScreeningData(&p->data[i],bp)) != 0) {
- sprintf(icp->err,"icmScreening_write: write_ScreeningData() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmScreening_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmScreening *p = (icmScreening *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmScreening_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmScreening_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ if ((rv = write_UInt32Number(p->screeningFlag,bp+8)) != 0) {
+ sprintf(icp->err,"icmScreening_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt32Number(p->channels,bp+12)) != 0) {
+ sprintf(icp->err,"icmScreening_write: write_UInt32NumberXYZumber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp = bp + 16;
+
+ /* Write all the data to the buffer */
+ for (i = 0; i < p->channels; i++, bp += 12) {
+ if ((rv = write_ScreeningData(&p->data[i],bp)) != 0) {
+ sprintf(icp->err,"icmScreening_write: write_ScreeningData() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmScreening_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmScreening_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmScreening *p = (icmScreening *)pp;
- if (verb <= 0)
- return;
-
- fprintf(op,"Screening:\n");
- fprintf(op," Flags = %s\n", string_ScreenEncodings(p->screeningFlag));
- fprintf(op," No. channels = %u\n",p->channels);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->channels; i++) {
- fprintf(op," %lu:\n",i);
- fprintf(op," Frequency: %f\n",p->data[i].frequency);
- fprintf(op," Angle: %f\n",p->data[i].angle);
- fprintf(op," Spot shape: %s\n", string_SpotShape(p->data[i].spotShape));
- }
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmScreening *p = (icmScreening *)pp;
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Screening:\n");
+ fprintf(op," Flags = %s\n", string_ScreenEncodings(p->screeningFlag));
+ fprintf(op," No. channels = %u\n",p->channels);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->channels; i++) {
+ fprintf(op," %lu:\n",i);
+ fprintf(op," Frequency: %f\n",p->data[i].frequency);
+ fprintf(op," Angle: %f\n",p->data[i].angle);
+ fprintf(op," Spot shape: %s\n", string_SpotShape(p->data[i].spotShape));
+ }
+ }
}
/* Allocate variable sized data elements */
static int icmScreening_allocate(
- icmBase *pp
+ icmBase *pp
) {
- icmScreening *p = (icmScreening *)pp;
- icc *icp = p->icp;
+ icmScreening *p = (icmScreening *)pp;
+ icc *icp = p->icp;
- if (p->channels != p->_channels) {
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- if ((p->data = (icmScreeningData *) icp->al->calloc(icp->al, p->channels, sizeof(icmScreeningData))) == NULL) {
- sprintf(icp->err,"icmScreening_alloc: calloc() of icmScreening data failed");
- return icp->errc = 2;
- }
- p->_channels = p->channels;
- }
- return 0;
+ if (p->channels != p->_channels) {
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ if ((p->data = (icmScreeningData *) icp->al->calloc(icp->al, p->channels, sizeof(icmScreeningData))) == NULL) {
+ sprintf(icp->err,"icmScreening_alloc: calloc() of icmScreening data failed");
+ return icp->errc = 2;
+ }
+ p->_channels = p->channels;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmScreening_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmScreening *p = (icmScreening *)pp;
- icc *icp = p->icp;
+ icmScreening *p = (icmScreening *)pp;
+ icc *icp = p->icp;
- if (p->data != NULL)
- icp->al->free(icp->al, p->data);
- icp->al->free(icp->al, p);
+ if (p->data != NULL)
+ icp->al->free(icp->al, p->data);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmScreening(
- icc *icp
+ icc *icp
) {
- icmScreening *p;
- if ((p = (icmScreening *) icp->al->calloc(icp->al,1,sizeof(icmScreening))) == NULL)
- return NULL;
- p->ttype = icSigScreeningType;
- p->refcount = 1;
- p->get_size = icmScreening_get_size;
- p->read = icmScreening_read;
- p->write = icmScreening_write;
- p->dump = icmScreening_dump;
- p->allocate = icmScreening_allocate;
- p->del = icmScreening_delete;
- p->icp = icp;
+ icmScreening *p;
+ if ((p = (icmScreening *) icp->al->calloc(icp->al,1,sizeof(icmScreening))) == NULL)
+ return NULL;
+ p->ttype = icSigScreeningType;
+ p->refcount = 1;
+ p->get_size = icmScreening_get_size;
+ p->read = icmScreening_read;
+ p->write = icmScreening_write;
+ p->dump = icmScreening_dump;
+ p->allocate = icmScreening_allocate;
+ p->del = icmScreening_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -7583,800 +7572,800 @@ static icmBase *new_icmScreening(
/* Return the number of bytes needed to write this tag */
static unsigned int icmUcrBg_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmUcrBg *p = (icmUcrBg *)pp;
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- if (p->UCRcount > (UINT_MAX - len - 4) / 2)
- goto overflow;
+ icmUcrBg *p = (icmUcrBg *)pp;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ if (p->UCRcount > (UINT_MAX - len - 4) / 2)
+ goto overflow;
- len += 4 + p->UCRcount * 2; /* Undercolor Removal */
- if (p->BGcount > (UINT_MAX - len - 4 - p->size) / 2)
- goto overflow;
+ len += 4 + p->UCRcount * 2; /* Undercolor Removal */
+ if (p->BGcount > (UINT_MAX - len - 4 - p->size) / 2)
+ goto overflow;
- len += 4 + p->BGcount * 2; /* Black Generation */
- len += p->size; /* Description string */
- return len;
+ len += 4 + p->BGcount * 2; /* Black Generation */
+ len += p->size; /* Description string */
+ return len;
overflow:
- p->icp->errc = 1;
- return (unsigned int) -1;
+ p->icp->errc = 1;
+ return (unsigned int) -1;
}
/* read the object, return 0 on success, error code on fail */
static int icmUcrBg_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmUcrBg *p = (icmUcrBg *)pp;
- icc *icp = p->icp;
- unsigned long i;
- int rv = 0;
- char *bp, *buf, *end;
-
- if (len < 16) {
- sprintf(icp->err,"icmUcrBg_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUcrBg_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmUcrBg_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmUcrBg_read: Wrong tag type for icmUcrBg");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->UCRcount = read_UInt32Number(bp+8); /* First curve count */
- bp = bp + 12;
-
- if (p->UCRcount > 0) {
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- for (i = 0; i < p->UCRcount; i++, bp += 2) {
- if ((bp + 2) > end) {
- sprintf(icp->err,"icmUcrBg_read: Data too short to read UCR Data");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if (p->UCRcount == 1) /* % */
- p->UCRcurve[i] = (double)read_UInt16Number(bp);
- else /* 0.0 - 1.0 */
- p->UCRcurve[i] = read_DCS16Number(bp);
- }
- } else {
- p->UCRcurve = NULL;
- }
-
- if ((bp + 4) > end) {
- sprintf(icp->err,"icmData_read: Data too short to read Black Gen count");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->BGcount = read_UInt32Number(bp); /* First curve count */
- bp += 4;
-
- if (p->BGcount > 0) {
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- for (i = 0; i < p->BGcount; i++, bp += 2) {
- if ((bp + 2) > end) {
- sprintf(icp->err,"icmUcrBg_read: Data too short to read BG Data");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if (p->BGcount == 1) /* % */
- p->BGcurve[i] = (double)read_UInt16Number(bp);
- else /* 0.0 - 1.0 */
- p->BGcurve[i] = read_DCS16Number(bp);
- }
- } else {
- p->BGcurve = NULL;
- }
-
- p->size = end - bp; /* Nominal string length */
- if (p->size > 0) {
- if (check_null_string(bp, p->size) != 0) {
- sprintf(icp->err,"icmUcrBg_read: string is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->size = strlen(bp) + 1;
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- memcpy((void *)p->string, (void *)bp, p->size);
- bp += p->size;
- } else {
- p->string = NULL;
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmUcrBg *p = (icmUcrBg *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ int rv = 0;
+ char *bp, *buf, *end;
+
+ if (len < 16) {
+ sprintf(icp->err,"icmUcrBg_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUcrBg_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmUcrBg_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmUcrBg_read: Wrong tag type for icmUcrBg");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->UCRcount = read_UInt32Number(bp+8); /* First curve count */
+ bp = bp + 12;
+
+ if (p->UCRcount > 0) {
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ for (i = 0; i < p->UCRcount; i++, bp += 2) {
+ if ((bp + 2) > end) {
+ sprintf(icp->err,"icmUcrBg_read: Data too short to read UCR Data");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if (p->UCRcount == 1) /* % */
+ p->UCRcurve[i] = (double)read_UInt16Number(bp);
+ else /* 0.0 - 1.0 */
+ p->UCRcurve[i] = read_DCS16Number(bp);
+ }
+ } else {
+ p->UCRcurve = NULL;
+ }
+
+ if ((bp + 4) > end) {
+ sprintf(icp->err,"icmData_read: Data too short to read Black Gen count");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->BGcount = read_UInt32Number(bp); /* First curve count */
+ bp += 4;
+
+ if (p->BGcount > 0) {
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ for (i = 0; i < p->BGcount; i++, bp += 2) {
+ if ((bp + 2) > end) {
+ sprintf(icp->err,"icmUcrBg_read: Data too short to read BG Data");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if (p->BGcount == 1) /* % */
+ p->BGcurve[i] = (double)read_UInt16Number(bp);
+ else /* 0.0 - 1.0 */
+ p->BGcurve[i] = read_DCS16Number(bp);
+ }
+ } else {
+ p->BGcurve = NULL;
+ }
+
+ p->size = end - bp; /* Nominal string length */
+ if (p->size > 0) {
+ if (check_null_string(bp, p->size) != 0) {
+ sprintf(icp->err,"icmUcrBg_read: string is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->size = strlen(bp) + 1;
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ memcpy((void *)p->string, (void *)bp, p->size);
+ bp += p->size;
+ } else {
+ p->string = NULL;
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmUcrBg_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmUcrBg *p = (icmUcrBg *)pp;
- icc *icp = p->icp;
- unsigned long i;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmUcrBg_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- bp = bp + 8;
-
- /* Write UCR curve */
- if ((rv = write_UInt32Number(p->UCRcount,bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp += 4;
-
- for (i = 0; i < p->UCRcount; i++, bp += 2) {
- if (p->UCRcount == 1) { /* % */
- if ((rv = write_UInt16Number((unsigned int)(p->UCRcurve[i]+0.5),bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_UInt16umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- } else {
- if ((rv = write_DCS16Number(p->UCRcurve[i],bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_DCS16umber(%f) failed",p->UCRcurve[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- /* Write BG curve */
- if ((rv = write_UInt32Number(p->BGcount,bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp += 4;
-
- for (i = 0; i < p->BGcount; i++, bp += 2) {
- if (p->BGcount == 1) { /* % */
- if ((rv = write_UInt16Number((unsigned int)(p->BGcurve[i]+0.5),bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_UInt16umber() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- } else {
- if ((rv = write_DCS16Number(p->BGcurve[i],bp)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: write_DCS16umber(%f) failed",p->BGcurve[i]);
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- }
- }
-
- if (p->string != NULL) {
- if ((rv = check_null_string(p->string,p->size)) != 0) {
- sprintf(icp->err,"icmUcrBg_write: text is not null terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)bp, (void *)p->string, p->size);
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmUcrBg_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmUcrBg *p = (icmUcrBg *)pp;
+ icc *icp = p->icp;
+ unsigned long i;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmUcrBg_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ bp = bp + 8;
+
+ /* Write UCR curve */
+ if ((rv = write_UInt32Number(p->UCRcount,bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp += 4;
+
+ for (i = 0; i < p->UCRcount; i++, bp += 2) {
+ if (p->UCRcount == 1) { /* % */
+ if ((rv = write_UInt16Number((unsigned int)(p->UCRcurve[i]+0.5),bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_UInt16umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ } else {
+ if ((rv = write_DCS16Number(p->UCRcurve[i],bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_DCS16umber(%f) failed",p->UCRcurve[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ /* Write BG curve */
+ if ((rv = write_UInt32Number(p->BGcount,bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp += 4;
+
+ for (i = 0; i < p->BGcount; i++, bp += 2) {
+ if (p->BGcount == 1) { /* % */
+ if ((rv = write_UInt16Number((unsigned int)(p->BGcurve[i]+0.5),bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_UInt16umber() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ } else {
+ if ((rv = write_DCS16Number(p->BGcurve[i],bp)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: write_DCS16umber(%f) failed",p->BGcurve[i]);
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ }
+ }
+
+ if (p->string != NULL) {
+ if ((rv = check_null_string(p->string,p->size)) != 0) {
+ sprintf(icp->err,"icmUcrBg_write: text is not null terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)bp, (void *)p->string, p->size);
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmUcrBg_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmUcrBg_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmUcrBg *p = (icmUcrBg *)pp;
- if (verb <= 0)
- return;
-
- fprintf(op,"Undercolor Removal Curve & Black Generation:\n");
-
- if (p->UCRcount == 0) {
- fprintf(op," UCR: Not specified\n");
- } else if (p->UCRcount == 1) {
- fprintf(op," UCR: %f%%\n",p->UCRcurve[0]);
- } else {
- fprintf(op," UCR curve no. elements = %u\n",p->UCRcount);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->UCRcount; i++)
- fprintf(op," %3lu: %f\n",i,p->UCRcurve[i]);
- }
- }
- if (p->BGcount == 0) {
- fprintf(op," BG: Not specified\n");
- } else if (p->BGcount == 1) {
- fprintf(op," BG: %f%%\n",p->BGcurve[0]);
- } else {
- fprintf(op," BG curve no. elements = %u\n",p->BGcount);
- if (verb >= 2) {
- unsigned long i;
- for (i = 0; i < p->BGcount; i++)
- fprintf(op," %3lu: %f\n",i,p->BGcurve[i]);
- }
- }
-
- {
- unsigned long i, r, c, size;
- fprintf(op," Description:\n");
- fprintf(op," No. chars = %lu\n",p->size);
-
- size = p->size > 0 ? p->size-1 : 0;
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 73) {
- if (isprint((unsigned char) p->string[i])) {
- fprintf(op,"%c",p->string[i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->string[i]);
- c += 4;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmUcrBg *p = (icmUcrBg *)pp;
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Undercolor Removal Curve & Black Generation:\n");
+
+ if (p->UCRcount == 0) {
+ fprintf(op," UCR: Not specified\n");
+ } else if (p->UCRcount == 1) {
+ fprintf(op," UCR: %f%%\n",p->UCRcurve[0]);
+ } else {
+ fprintf(op," UCR curve no. elements = %u\n",p->UCRcount);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->UCRcount; i++)
+ fprintf(op," %3lu: %f\n",i,p->UCRcurve[i]);
+ }
+ }
+ if (p->BGcount == 0) {
+ fprintf(op," BG: Not specified\n");
+ } else if (p->BGcount == 1) {
+ fprintf(op," BG: %f%%\n",p->BGcurve[0]);
+ } else {
+ fprintf(op," BG curve no. elements = %u\n",p->BGcount);
+ if (verb >= 2) {
+ unsigned long i;
+ for (i = 0; i < p->BGcount; i++)
+ fprintf(op," %3lu: %f\n",i,p->BGcurve[i]);
+ }
+ }
+
+ {
+ unsigned long i, r, c, size;
+ fprintf(op," Description:\n");
+ fprintf(op," No. chars = %lu\n",p->size);
+
+ size = p->size > 0 ? p->size-1 : 0;
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 73) {
+ if (isprint((unsigned char) p->string[i])) {
+ fprintf(op,"%c",p->string[i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->string[i]);
+ c += 4;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+ }
}
/* Allocate variable sized data elements */
static int icmUcrBg_allocate(
- icmBase *pp
-) {
- icmUcrBg *p = (icmUcrBg *)pp;
- icc *icp = p->icp;
-
- if (p->UCRcount != p->UCR_count) {
- if (p->UCRcurve != NULL)
- icp->al->free(icp->al, p->UCRcurve);
- if ((p->UCRcurve = (double *) icp->al->calloc(icp->al, p->UCRcount, sizeof(double))) == NULL) {
- sprintf(icp->err,"icmUcrBg_allocate: calloc() of UCR curve data failed");
- return icp->errc = 2;
- }
- p->UCR_count = p->UCRcount;
- }
- if (p->BGcount != p->BG_count) {
- if (p->BGcurve != NULL)
- icp->al->free(icp->al, p->BGcurve);
- if ((p->BGcurve = (double *) icp->al->calloc(icp->al, p->BGcount, sizeof(double))) == NULL) {
- sprintf(icp->err,"icmUcrBg_allocate: calloc() of BG curve data failed");
- return icp->errc = 2;
- }
- p->BG_count = p->BGcount;
- }
- if (p->size != p->_size) {
- if (p->string != NULL)
- icp->al->free(icp->al, p->string);
- if ((p->string = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
- sprintf(icp->err,"icmUcrBg_allocate: calloc() of string data failed");
- return icp->errc = 2;
- }
- p->_size = p->size;
- }
- return 0;
+ icmBase *pp
+) {
+ icmUcrBg *p = (icmUcrBg *)pp;
+ icc *icp = p->icp;
+
+ if (p->UCRcount != p->UCR_count) {
+ if (p->UCRcurve != NULL)
+ icp->al->free(icp->al, p->UCRcurve);
+ if ((p->UCRcurve = (double *) icp->al->calloc(icp->al, p->UCRcount, sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmUcrBg_allocate: calloc() of UCR curve data failed");
+ return icp->errc = 2;
+ }
+ p->UCR_count = p->UCRcount;
+ }
+ if (p->BGcount != p->BG_count) {
+ if (p->BGcurve != NULL)
+ icp->al->free(icp->al, p->BGcurve);
+ if ((p->BGcurve = (double *) icp->al->calloc(icp->al, p->BGcount, sizeof(double))) == NULL) {
+ sprintf(icp->err,"icmUcrBg_allocate: calloc() of BG curve data failed");
+ return icp->errc = 2;
+ }
+ p->BG_count = p->BGcount;
+ }
+ if (p->size != p->_size) {
+ if (p->string != NULL)
+ icp->al->free(icp->al, p->string);
+ if ((p->string = (char *) icp->al->calloc(icp->al, p->size, sizeof(char))) == NULL) {
+ sprintf(icp->err,"icmUcrBg_allocate: calloc() of string data failed");
+ return icp->errc = 2;
+ }
+ p->_size = p->size;
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmUcrBg_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmUcrBg *p = (icmUcrBg *)pp;
- icc *icp = p->icp;
+ icmUcrBg *p = (icmUcrBg *)pp;
+ icc *icp = p->icp;
- if (p->UCRcurve != NULL)
- icp->al->free(icp->al, p->UCRcurve);
- if (p->BGcurve != NULL)
- icp->al->free(icp->al, p->BGcurve);
- if (p->string != NULL)
- icp->al->free(icp->al, p->string);
- icp->al->free(icp->al, p);
+ if (p->UCRcurve != NULL)
+ icp->al->free(icp->al, p->UCRcurve);
+ if (p->BGcurve != NULL)
+ icp->al->free(icp->al, p->BGcurve);
+ if (p->string != NULL)
+ icp->al->free(icp->al, p->string);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmUcrBg(
- icc *icp
+ icc *icp
) {
- icmUcrBg *p;
- if ((p = (icmUcrBg *) icp->al->calloc(icp->al,1,sizeof(icmUcrBg))) == NULL)
- return NULL;
- p->ttype = icSigUcrBgType;
- p->refcount = 1;
- p->get_size = icmUcrBg_get_size;
- p->read = icmUcrBg_read;
- p->write = icmUcrBg_write;
- p->dump = icmUcrBg_dump;
- p->allocate = icmUcrBg_allocate;
- p->del = icmUcrBg_delete;
- p->icp = icp;
+ icmUcrBg *p;
+ if ((p = (icmUcrBg *) icp->al->calloc(icp->al,1,sizeof(icmUcrBg))) == NULL)
+ return NULL;
+ p->ttype = icSigUcrBgType;
+ p->refcount = 1;
+ p->get_size = icmUcrBg_get_size;
+ p->read = icmUcrBg_read;
+ p->write = icmUcrBg_write;
+ p->dump = icmUcrBg_dump;
+ p->allocate = icmUcrBg_allocate;
+ p->del = icmUcrBg_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
/* VideoCardGamma (ColorSync 2.5 specific - c/o Neil Okamoto) */
static unsigned int icmVideoCardGamma_get_size(
- icmBase *pp
-) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- unsigned int len = 0;
-
- len += 8; /* 8 bytes for tag and padding */
- len += 4; /* 4 for gamma type */
-
- /* compute size of remainder */
- if (p->tagType == icmVideoCardGammaTableType) {
- len += 2; /* 2 bytes for channels */
- len += 2; /* 2 for entry count */
- len += 2; /* 2 for entry size */
- if (p->u.table.entryCount > 0 &&
- p->u.table.entrySize > 0 &&
- p->u.table.channels >
- (UINT_MAX - len) /
- p->u.table.entryCount /
- p->u.table.entrySize) {
- p->icp->errc = 1;
- return (unsigned int) -1;
- }
- len += ( p->u.table.channels * /* compute table size */
- p->u.table.entryCount *
- p->u.table.entrySize );
- }
- else if (p->tagType == icmVideoCardGammaFormulaType) {
- len += 12; /* 4 bytes each for red gamma, min, & max */
- len += 12; /* 4 bytes each for green gamma, min & max */
- len += 12; /* 4 bytes each for blue gamma, min & max */
- }
- return len;
+ icmBase *pp
+) {
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ unsigned int len = 0;
+
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4; /* 4 for gamma type */
+
+ /* compute size of remainder */
+ if (p->tagType == icmVideoCardGammaTableType) {
+ len += 2; /* 2 bytes for channels */
+ len += 2; /* 2 for entry count */
+ len += 2; /* 2 for entry size */
+ if (p->u.table.entryCount > 0 &&
+ p->u.table.entrySize > 0 &&
+ p->u.table.channels >
+ (UINT_MAX - len) /
+ p->u.table.entryCount /
+ p->u.table.entrySize) {
+ p->icp->errc = 1;
+ return (unsigned int) -1;
+ }
+ len += ( p->u.table.channels * /* compute table size */
+ p->u.table.entryCount *
+ p->u.table.entrySize );
+ }
+ else if (p->tagType == icmVideoCardGammaFormulaType) {
+ len += 12; /* 4 bytes each for red gamma, min, & max */
+ len += 12; /* 4 bytes each for green gamma, min & max */
+ len += 12; /* 4 bytes each for blue gamma, min & max */
+ }
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmVideoCardGamma_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- icc *icp = p->icp;
- int rv;
- char *bp, *buf;
- unsigned char *pchar;
- unsigned short *pshort;
- unsigned long c;
-
- if (len < 18) {
- sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmVideoCardGamma_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmVideoCardGamma_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmVideoCardGamma_read: Wrong tag type for icmVideoCardGamma");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read gamma format (eg. table or formula) from the buffer */
- p->tagType = read_UInt32Number(bp+8);
-
- /* Read remaining gamma data based on format */
- switch ((int)p->tagType) {
- case icmVideoCardGammaTableType:
- p->u.table.channels = read_UInt16Number(bp+12);
- p->u.table.entryCount = read_UInt16Number(bp+14);
- p->u.table.entrySize = read_UInt16Number(bp+16);
- if (p->u.table.entrySize > 65530 || p->u.table.entrySize == 0) {
- sprintf(icp->err,"icmVideoCardGamma_read: Too many entries (or none)");
- return icp->errc = 1;
- }
- if (p->u.table.entryCount > 0 && p->u.table.entrySize > 0 &&
- p->u.table.channels >
- UINT_MAX / p->u.table.entryCount / p->u.table.entrySize) {
- sprintf(icp->err,"icmVideoCardGamma_read: Overflow reading tag");
- return icp->errc = 1;
- }
- if (len-18 < p->u.table.channels*p->u.table.entryCount*p->u.table.entrySize) {
- sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
- return icp->errc = 1;
- }
- if ((rv = pp->allocate(pp)) != 0) { /* make space for table */
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- pchar = (unsigned char*)p->u.table.data;
- pshort = (unsigned short*)p->u.table.data;
- for (c=0, bp=bp+18; c<p->u.table.channels*p->u.table.entryCount; c++) {
- switch (p->u.table.entrySize) {
- case 1:
- *pchar++ = read_UInt8Number(bp);
- bp++;
- break;
- case 2:
- *pshort++ = read_UInt16Number(bp);
- bp+=2;
- break;
- default:
- sprintf(icp->err,"icmVideoCardGamma_read: unsupported table entry size");
- pp->del(pp);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
- break;
- case icmVideoCardGammaFormulaType:
- if (len < 48) {
- sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
- return icp->errc = 1;
- }
- p->u.formula.redGamma = read_S15Fixed16Number(bp+12);
- p->u.formula.redMin = read_S15Fixed16Number(bp+16);
- p->u.formula.redMax = read_S15Fixed16Number(bp+20);
- p->u.formula.greenGamma = read_S15Fixed16Number(bp+24);
- p->u.formula.greenMin = read_S15Fixed16Number(bp+28);
- p->u.formula.greenMax = read_S15Fixed16Number(bp+32);
- p->u.formula.blueGamma = read_S15Fixed16Number(bp+36);
- p->u.formula.blueMin = read_S15Fixed16Number(bp+40);
- p->u.formula.blueMax = read_S15Fixed16Number(bp+44);
- break;
- default:
- sprintf(icp->err,"icmVideoCardGammaTable_read: Unknown gamma format for icmVideoCardGamma");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ icc *icp = p->icp;
+ int rv;
+ char *bp, *buf;
+ unsigned char *pchar;
+ unsigned short *pshort;
+ unsigned long c;
+
+ if (len < 18) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmVideoCardGamma_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmVideoCardGamma_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Wrong tag type for icmVideoCardGamma");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read gamma format (eg. table or formula) from the buffer */
+ p->tagType = read_UInt32Number(bp+8);
+
+ /* Read remaining gamma data based on format */
+ switch ((int)p->tagType) {
+ case icmVideoCardGammaTableType:
+ p->u.table.channels = read_UInt16Number(bp+12);
+ p->u.table.entryCount = read_UInt16Number(bp+14);
+ p->u.table.entrySize = read_UInt16Number(bp+16);
+ if (p->u.table.entrySize > 65530 || p->u.table.entrySize == 0) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Too many entries (or none)");
+ return icp->errc = 1;
+ }
+ if (p->u.table.entryCount > 0 && p->u.table.entrySize > 0 &&
+ p->u.table.channels >
+ UINT_MAX / p->u.table.entryCount / p->u.table.entrySize) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Overflow reading tag");
+ return icp->errc = 1;
+ }
+ if (len-18 < p->u.table.channels*p->u.table.entryCount*p->u.table.entrySize) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+ if ((rv = pp->allocate(pp)) != 0) { /* make space for table */
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ pchar = (unsigned char*)p->u.table.data;
+ pshort = (unsigned short*)p->u.table.data;
+ for (c=0, bp=bp+18; c<p->u.table.channels*p->u.table.entryCount; c++) {
+ switch (p->u.table.entrySize) {
+ case 1:
+ *pchar++ = read_UInt8Number(bp);
+ bp++;
+ break;
+ case 2:
+ *pshort++ = read_UInt16Number(bp);
+ bp+=2;
+ break;
+ default:
+ sprintf(icp->err,"icmVideoCardGamma_read: unsupported table entry size");
+ pp->del(pp);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+ break;
+ case icmVideoCardGammaFormulaType:
+ if (len < 48) {
+ sprintf(icp->err,"icmVideoCardGamma_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+ p->u.formula.redGamma = read_S15Fixed16Number(bp+12);
+ p->u.formula.redMin = read_S15Fixed16Number(bp+16);
+ p->u.formula.redMax = read_S15Fixed16Number(bp+20);
+ p->u.formula.greenGamma = read_S15Fixed16Number(bp+24);
+ p->u.formula.greenMin = read_S15Fixed16Number(bp+28);
+ p->u.formula.greenMax = read_S15Fixed16Number(bp+32);
+ p->u.formula.blueGamma = read_S15Fixed16Number(bp+36);
+ p->u.formula.blueMin = read_S15Fixed16Number(bp+40);
+ p->u.formula.blueMax = read_S15Fixed16Number(bp+44);
+ break;
+ default:
+ sprintf(icp->err,"icmVideoCardGammaTable_read: Unknown gamma format for icmVideoCardGamma");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmVideoCardGamma_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0, c;
- unsigned char *pchar;
- unsigned short *pshort;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmViewingConditions_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write gamma format (eg. table of formula) */
- if ((rv = write_UInt32Number(p->tagType,bp+8)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write remaining gamma data based on format */
- switch ((int)p->tagType) {
- case icmVideoCardGammaTableType:
- if ((rv = write_UInt16Number(p->u.table.channels,bp+12)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt16Number(p->u.table.entryCount,bp+14)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_UInt16Number(p->u.table.entrySize,bp+16)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- pchar = (unsigned char*)p->u.table.data;
- pshort = (unsigned short*)p->u.table.data;
- for (c=0, bp=bp+18; c<p->u.table.channels*p->u.table.entryCount; c++) {
- switch (p->u.table.entrySize) {
- case 1:
- write_UInt8Number(*pchar++,bp);
- bp++;
- break;
- case 2:
- write_UInt16Number(*pshort++,bp);
- bp+=2;
- break;
- default:
- sprintf(icp->err,"icmVideoCardGamma_write: unsupported table entry size");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- }
- break;
- case icmVideoCardGammaFormulaType:
- if ((rv = write_S15Fixed16Number(p->u.formula.redGamma,bp+12)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.redMin,bp+16)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.redMax,bp+20)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.greenGamma,bp+24)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.greenMin,bp+28)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.greenMax,bp+32)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.blueGamma,bp+36)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.blueMin,bp+40)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_S15Fixed16Number(p->u.formula.blueMax,bp+44)) != 0) {
- sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- break;
- default:
- sprintf(icp->err,"icmVideoCardGammaTable_write: Unknown gamma format for icmVideoCardGamma");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmViewingConditions_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0, c;
+ unsigned char *pchar;
+ unsigned short *pshort;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmViewingConditions_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write gamma format (eg. table of formula) */
+ if ((rv = write_UInt32Number(p->tagType,bp+8)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write remaining gamma data based on format */
+ switch ((int)p->tagType) {
+ case icmVideoCardGammaTableType:
+ if ((rv = write_UInt16Number(p->u.table.channels,bp+12)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt16Number(p->u.table.entryCount,bp+14)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_UInt16Number(p->u.table.entrySize,bp+16)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_UInt16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ pchar = (unsigned char*)p->u.table.data;
+ pshort = (unsigned short*)p->u.table.data;
+ for (c=0, bp=bp+18; c<p->u.table.channels*p->u.table.entryCount; c++) {
+ switch (p->u.table.entrySize) {
+ case 1:
+ write_UInt8Number(*pchar++,bp);
+ bp++;
+ break;
+ case 2:
+ write_UInt16Number(*pshort++,bp);
+ bp+=2;
+ break;
+ default:
+ sprintf(icp->err,"icmVideoCardGamma_write: unsupported table entry size");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ }
+ break;
+ case icmVideoCardGammaFormulaType:
+ if ((rv = write_S15Fixed16Number(p->u.formula.redGamma,bp+12)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.redMin,bp+16)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.redMax,bp+20)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.greenGamma,bp+24)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.greenMin,bp+28)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.greenMax,bp+32)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.blueGamma,bp+36)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.blueMin,bp+40)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_S15Fixed16Number(p->u.formula.blueMax,bp+44)) != 0) {
+ sprintf(icp->err,"icmVideoCardGamma_write: write_S15Fixed16Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ break;
+ default:
+ sprintf(icp->err,"icmVideoCardGammaTable_write: Unknown gamma format for icmVideoCardGamma");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmViewingConditions_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmVideoCardGamma_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- int c,i;
-
- if (verb <= 0)
- return;
-
- switch ((int)p->tagType) {
- case icmVideoCardGammaTableType:
- fprintf(op,"VideoCardGammaTable:\n");
- fprintf(op," channels = %d\n", p->u.table.channels);
- fprintf(op," entries = %d\n", p->u.table.entryCount);
- fprintf(op," entrysize = %d\n", p->u.table.entrySize);
- if (verb >= 2) {
- /* dump array contents also */
- for (c=0; c<p->u.table.channels; c++) {
- fprintf(op," channel #%d\n",c);
- for (i=0; i<p->u.table.entryCount; i++) {
- if (p->u.table.entrySize == 1) {
- fprintf(op," %d: %d\n",i,((unsigned char*)p->u.table.data)[c*p->u.table.entryCount+i]);
- }
- else if (p->u.table.entrySize == 2) {
- fprintf(op," %d: %d\n",i,((unsigned short*)p->u.table.data)[c*p->u.table.entryCount+i]);
- }
- }
- }
- }
- break;
- case icmVideoCardGammaFormulaType:
- fprintf(op,"VideoCardGammaFormula:\n");
- fprintf(op," red gamma = %f\n", p->u.formula.redGamma);
- fprintf(op," red min = %f\n", p->u.formula.redMin);
- fprintf(op," red max = %f\n", p->u.formula.redMax);
- fprintf(op," green gamma = %f\n", p->u.formula.greenGamma);
- fprintf(op," green min = %f\n", p->u.formula.greenMin);
- fprintf(op," green max = %f\n", p->u.formula.greenMax);
- fprintf(op," blue gamma = %f\n", p->u.formula.blueGamma);
- fprintf(op," blue min = %f\n", p->u.formula.blueMin);
- fprintf(op," blue max = %f\n", p->u.formula.blueMax);
- break;
- default:
- fprintf(op," Unknown tag format\n");
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ int c,i;
+
+ if (verb <= 0)
+ return;
+
+ switch ((int)p->tagType) {
+ case icmVideoCardGammaTableType:
+ fprintf(op,"VideoCardGammaTable:\n");
+ fprintf(op," channels = %d\n", p->u.table.channels);
+ fprintf(op," entries = %d\n", p->u.table.entryCount);
+ fprintf(op," entrysize = %d\n", p->u.table.entrySize);
+ if (verb >= 2) {
+ /* dump array contents also */
+ for (c=0; c<p->u.table.channels; c++) {
+ fprintf(op," channel #%d\n",c);
+ for (i=0; i<p->u.table.entryCount; i++) {
+ if (p->u.table.entrySize == 1) {
+ fprintf(op," %d: %d\n",i,((unsigned char*)p->u.table.data)[c*p->u.table.entryCount+i]);
+ }
+ else if (p->u.table.entrySize == 2) {
+ fprintf(op," %d: %d\n",i,((unsigned short*)p->u.table.data)[c*p->u.table.entryCount+i]);
+ }
+ }
+ }
+ }
+ break;
+ case icmVideoCardGammaFormulaType:
+ fprintf(op,"VideoCardGammaFormula:\n");
+ fprintf(op," red gamma = %f\n", p->u.formula.redGamma);
+ fprintf(op," red min = %f\n", p->u.formula.redMin);
+ fprintf(op," red max = %f\n", p->u.formula.redMax);
+ fprintf(op," green gamma = %f\n", p->u.formula.greenGamma);
+ fprintf(op," green min = %f\n", p->u.formula.greenMin);
+ fprintf(op," green max = %f\n", p->u.formula.greenMax);
+ fprintf(op," blue gamma = %f\n", p->u.formula.blueGamma);
+ fprintf(op," blue min = %f\n", p->u.formula.blueMin);
+ fprintf(op," blue max = %f\n", p->u.formula.blueMax);
+ break;
+ default:
+ fprintf(op," Unknown tag format\n");
+ }
}
/* Allocate variable sized data elements */
static int icmVideoCardGamma_allocate(
- icmBase *pp
-) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- icc *icp = p->icp;
- unsigned int size;
-
- /* note: allocation is only relevant for table type
- * and in that case the channels, entryCount, and entrySize
- * fields must all be set prior to getting here
- */
-
- if (p->tagType == icmVideoCardGammaTableType) {
- if (p->u.table.data != NULL)
- icp->al->free(icp->al, p->u.table.data);
- if (p->u.table.entryCount > 0 &&
- p->u.table.channels > UINT_MAX / p->u.table.entryCount) {
- sprintf(icp->err,"icmVideoCardGamma_alloc: table too large");
- return icp->errc = 1;
- }
- size = (p->u.table.channels *
- p->u.table.entryCount);
- switch (p->u.table.entrySize) {
- case 1:
- size *= sizeof(unsigned char);
- break;
- case 2:
- if (size > UINT_MAX / sizeof(unsigned short)) {
- sprintf(icp->err,"icmVideoCardGamma_alloc: table too large");
- return icp->errc = 1;
- }
- size *= sizeof(unsigned short);
- break;
- default:
- sprintf(icp->err,"icmVideoCardGamma_alloc: unsupported table entry size");
- return icp->errc = 1;
- }
- if ((p->u.table.data = (void*) icp->al->malloc(icp->al, size)) == NULL) {
- sprintf(icp->err,"icmVideoCardGamma_alloc: malloc() of table data failed");
- return icp->errc = 2;
- }
- }
-
- return 0;
+ icmBase *pp
+) {
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ icc *icp = p->icp;
+ unsigned int size;
+
+ /* note: allocation is only relevant for table type
+ * and in that case the channels, entryCount, and entrySize
+ * fields must all be set prior to getting here
+ */
+
+ if (p->tagType == icmVideoCardGammaTableType) {
+ if (p->u.table.data != NULL)
+ icp->al->free(icp->al, p->u.table.data);
+ if (p->u.table.entryCount > 0 &&
+ p->u.table.channels > UINT_MAX / p->u.table.entryCount) {
+ sprintf(icp->err,"icmVideoCardGamma_alloc: table too large");
+ return icp->errc = 1;
+ }
+ size = (p->u.table.channels *
+ p->u.table.entryCount);
+ switch (p->u.table.entrySize) {
+ case 1:
+ size *= sizeof(unsigned char);
+ break;
+ case 2:
+ if (size > UINT_MAX / sizeof(unsigned short)) {
+ sprintf(icp->err,"icmVideoCardGamma_alloc: table too large");
+ return icp->errc = 1;
+ }
+ size *= sizeof(unsigned short);
+ break;
+ default:
+ sprintf(icp->err,"icmVideoCardGamma_alloc: unsupported table entry size");
+ return icp->errc = 1;
+ }
+ if ((p->u.table.data = (void*) icp->al->malloc(icp->al, size)) == NULL) {
+ sprintf(icp->err,"icmVideoCardGamma_alloc: malloc() of table data failed");
+ return icp->errc = 2;
+ }
+ }
+
+ return 0;
}
/* Free all storage in the object */
static void icmVideoCardGamma_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
- icc *icp = p->icp;
+ icmVideoCardGamma *p = (icmVideoCardGamma *)pp;
+ icc *icp = p->icp;
- if (p->tagType == icmVideoCardGammaTableType && p->u.table.data != NULL)
- icp->al->free(icp->al, p->u.table.data);
+ if (p->tagType == icmVideoCardGammaTableType && p->u.table.data != NULL)
+ icp->al->free(icp->al, p->u.table.data);
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmVideoCardGamma(
- icc *icp
+ icc *icp
) {
- icmVideoCardGamma *p;
- if ((p = (icmVideoCardGamma *) icp->al->calloc(icp->al,1,sizeof(icmVideoCardGamma))) == NULL)
- return NULL;
- p->ttype = icSigVideoCardGammaType;
- p->refcount = 1;
- p->get_size = icmVideoCardGamma_get_size;
- p->read = icmVideoCardGamma_read;
- p->write = icmVideoCardGamma_write;
- p->dump = icmVideoCardGamma_dump;
- p->allocate = icmVideoCardGamma_allocate;
- p->del = icmVideoCardGamma_delete;
- p->icp = icp;
+ icmVideoCardGamma *p;
+ if ((p = (icmVideoCardGamma *) icp->al->calloc(icp->al,1,sizeof(icmVideoCardGamma))) == NULL)
+ return NULL;
+ p->ttype = icSigVideoCardGammaType;
+ p->refcount = 1;
+ p->get_size = icmVideoCardGamma_get_size;
+ p->read = icmVideoCardGamma_read;
+ p->write = icmVideoCardGamma_write;
+ p->dump = icmVideoCardGamma_dump;
+ p->allocate = icmVideoCardGamma_allocate;
+ p->del = icmVideoCardGamma_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -8384,188 +8373,188 @@ static icmBase *new_icmVideoCardGamma(
/* Return the number of bytes needed to write this tag */
static unsigned int icmViewingConditions_get_size(
- icmBase *pp
+ icmBase *pp
) {
- unsigned int len = 0;
- len += 8; /* 8 bytes for tag and padding */
- len += 12; /* 12 for XYZ of illuminant */
- len += 12; /* 12 for XYZ of surround */
- len += 4; /* 4 for illuminant type */
- return len;
+ unsigned int len = 0;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 12; /* 12 for XYZ of illuminant */
+ len += 12; /* 12 for XYZ of surround */
+ len += 4; /* 4 for illuminant type */
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmViewingConditions_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmViewingConditions *p = (icmViewingConditions *)pp;
- icc *icp = p->icp;
- int rv;
- char *bp, *buf;
-
- if (len < 36) {
- sprintf(icp->err,"icmViewingConditions_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmViewingConditions_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmViewingConditions_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmViewingConditions_read: Wrong tag type for icmViewingConditions");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read the XYZ values for the illuminant */
- if ((rv = read_XYZNumber(&p->illuminant, bp+8)) != 0) {
- sprintf(icp->err,"icmViewingConditions: read_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Read the XYZ values for the surround */
- if ((rv = read_XYZNumber(&p->surround, bp+20)) != 0) {
- sprintf(icp->err,"icmViewingConditions: read_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Read the encoded standard illuminant */
- p->stdIlluminant = (icIlluminant)read_SInt32Number(bp + 32);
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmViewingConditions *p = (icmViewingConditions *)pp;
+ icc *icp = p->icp;
+ int rv;
+ char *bp, *buf;
+
+ if (len < 36) {
+ sprintf(icp->err,"icmViewingConditions_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmViewingConditions_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmViewingConditions_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmViewingConditions_read: Wrong tag type for icmViewingConditions");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read the XYZ values for the illuminant */
+ if ((rv = read_XYZNumber(&p->illuminant, bp+8)) != 0) {
+ sprintf(icp->err,"icmViewingConditions: read_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Read the XYZ values for the surround */
+ if ((rv = read_XYZNumber(&p->surround, bp+20)) != 0) {
+ sprintf(icp->err,"icmViewingConditions: read_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Read the encoded standard illuminant */
+ p->stdIlluminant = (icIlluminant)read_SInt32Number(bp + 32);
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmViewingConditions_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmViewingConditions *p = (icmViewingConditions *)pp;
- icc *icp = p->icp;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmViewingConditions_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmViewingConditions_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
-
- /* Write the XYZ values for the illuminant */
- if ((rv = write_XYZNumber(&p->illuminant, bp+8)) != 0) {
- sprintf(icp->err,"icmViewingConditions: write_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the XYZ values for the surround */
- if ((rv = write_XYZNumber(&p->surround, bp+20)) != 0) {
- sprintf(icp->err,"icmViewingConditions: write_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write the encoded standard illuminant */
- if ((rv = write_SInt32Number((int)p->stdIlluminant, bp + 32)) != 0) {
- sprintf(icp->err,"icmViewingConditionsa_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmViewingConditions_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmViewingConditions *p = (icmViewingConditions *)pp;
+ icc *icp = p->icp;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmViewingConditions_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmViewingConditions_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+
+ /* Write the XYZ values for the illuminant */
+ if ((rv = write_XYZNumber(&p->illuminant, bp+8)) != 0) {
+ sprintf(icp->err,"icmViewingConditions: write_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the XYZ values for the surround */
+ if ((rv = write_XYZNumber(&p->surround, bp+20)) != 0) {
+ sprintf(icp->err,"icmViewingConditions: write_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write the encoded standard illuminant */
+ if ((rv = write_SInt32Number((int)p->stdIlluminant, bp + 32)) != 0) {
+ sprintf(icp->err,"icmViewingConditionsa_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmViewingConditions_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmViewingConditions_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
) {
- icmViewingConditions *p = (icmViewingConditions *)pp;
- if (verb <= 0)
- return;
+ icmViewingConditions *p = (icmViewingConditions *)pp;
+ if (verb <= 0)
+ return;
- fprintf(op,"Viewing Conditions:\n");
- fprintf(op," XYZ value of illuminant in cd/m^2 = %s\n", string_XYZNumber(&p->illuminant));
- fprintf(op," XYZ value of surround in cd/m^2 = %s\n", string_XYZNumber(&p->surround));
- fprintf(op," Illuminant type = %s\n", string_Illuminant(p->stdIlluminant));
+ fprintf(op,"Viewing Conditions:\n");
+ fprintf(op," XYZ value of illuminant in cd/m^2 = %s\n", string_XYZNumber(&p->illuminant));
+ fprintf(op," XYZ value of surround in cd/m^2 = %s\n", string_XYZNumber(&p->surround));
+ fprintf(op," Illuminant type = %s\n", string_Illuminant(p->stdIlluminant));
}
/* Allocate variable sized data elements */
static int icmViewingConditions_allocate(
- icmBase *pp
+ icmBase *pp
) {
- /* Nothing to do */
- return 0;
+ /* Nothing to do */
+ return 0;
}
/* Free all storage in the object */
static void icmViewingConditions_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmViewingConditions *p = (icmViewingConditions *)pp;
- icc *icp = p->icp;
+ icmViewingConditions *p = (icmViewingConditions *)pp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmViewingConditions(
- icc *icp
+ icc *icp
) {
- icmViewingConditions *p;
- if ((p = (icmViewingConditions *) icp->al->calloc(icp->al,1,sizeof(icmViewingConditions))) == NULL)
- return NULL;
- p->ttype = icSigViewingConditionsType;
- p->refcount = 1;
- p->get_size = icmViewingConditions_get_size;
- p->read = icmViewingConditions_read;
- p->write = icmViewingConditions_write;
- p->dump = icmViewingConditions_dump;
- p->allocate = icmViewingConditions_allocate;
- p->del = icmViewingConditions_delete;
- p->icp = icp;
+ icmViewingConditions *p;
+ if ((p = (icmViewingConditions *) icp->al->calloc(icp->al,1,sizeof(icmViewingConditions))) == NULL)
+ return NULL;
+ p->ttype = icSigViewingConditionsType;
+ p->refcount = 1;
+ p->get_size = icmViewingConditions_get_size;
+ p->read = icmViewingConditions_read;
+ p->write = icmViewingConditions_write;
+ p->dump = icmViewingConditions_dump;
+ p->allocate = icmViewingConditions_allocate;
+ p->del = icmViewingConditions_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ---------------------------------------------------------- */
@@ -8573,342 +8562,342 @@ static icmBase *new_icmViewingConditions(
/* Return the number of bytes needed to write this tag */
static unsigned int icmCrdInfo_get_size(
- icmBase *pp
+ icmBase *pp
) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- unsigned int len = 0, t;
- len += 8; /* 8 bytes for tag and padding */
- len += 4 + p->ppsize; /* Postscript product name */
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- len += 4 + p->crdsize[t]; /* crd names */
- }
- return len;
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ unsigned int len = 0, t;
+ len += 8; /* 8 bytes for tag and padding */
+ len += 4 + p->ppsize; /* Postscript product name */
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ len += 4 + p->crdsize[t]; /* crd names */
+ }
+ return len;
}
/* read the object, return 0 on success, error code on fail */
static int icmCrdInfo_read(
- icmBase *pp,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- icc *icp = p->icp;
- unsigned long t;
- int rv = 0;
- char *bp, *buf, *end;
-
- if (len < 28) {
- sprintf(icp->err,"icmCrdInfo_read: Tag too small to be legal");
- return icp->errc = 1;
- }
-
- /* Allocate a file read buffer */
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmCrdInfo_read: malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
- end = buf + len;
-
- /* Read portion of file into buffer */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, bp, 1, len) != len) {
- sprintf(icp->err,"icmCrdInfo_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Read type descriptor from the buffer */
- if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
- sprintf(icp->err,"icmCrdInfo_read: Wrong tag type for icmCrdInfo");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- bp = bp + 8;
-
- /* Postscript product name */
- if ((bp + 4) > end) {
- sprintf(icp->err,"icmCrdInfo_read: Data too short to read Postscript product name");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->ppsize = read_UInt32Number(bp);
- bp += 4;
- if (p->ppsize > 0) {
- if ((bp + p->ppsize) > end) {
- sprintf(icp->err,"icmCrdInfo_read: Data to short to read Postscript product string");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if (check_null_string(bp,p->ppsize)) {
- sprintf(icp->err,"icmCrdInfo_read: Postscript product name is not terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- memcpy((void *)p->ppname, (void *)bp, p->ppsize);
- bp += p->ppsize;
- }
-
- /* CRD names for the four rendering intents */
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- if ((bp + 4) > end) {
- sprintf(icp->err,"icmCrdInfo_read: Data too short to read CRD%ld name",t);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- p->crdsize[t] = read_UInt32Number(bp);
- bp += 4;
- if (p->crdsize[t] > 0) {
- if ((bp + p->crdsize[t]) > end) {
- sprintf(icp->err,"icmCrdInfo_read: Data to short to read CRD%ld string",t);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if (check_null_string(bp,p->crdsize[t])) {
- sprintf(icp->err,"icmCrdInfo_read: CRD%ld name is not terminated",t);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- if ((rv = p->allocate((icmBase *)p)) != 0) {
- icp->al->free(icp->al, buf);
- return rv;
- }
- memcpy((void *)p->crdname[t], (void *)bp, p->crdsize[t]);
- bp += p->crdsize[t];
- }
- }
-
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ icc *icp = p->icp;
+ unsigned long t;
+ int rv = 0;
+ char *bp, *buf, *end;
+
+ if (len < 28) {
+ sprintf(icp->err,"icmCrdInfo_read: Tag too small to be legal");
+ return icp->errc = 1;
+ }
+
+ /* Allocate a file read buffer */
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmCrdInfo_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+ end = buf + len;
+
+ /* Read portion of file into buffer */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, bp, 1, len) != len) {
+ sprintf(icp->err,"icmCrdInfo_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Read type descriptor from the buffer */
+ if (((icTagTypeSignature)read_SInt32Number(bp)) != p->ttype) {
+ sprintf(icp->err,"icmCrdInfo_read: Wrong tag type for icmCrdInfo");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ bp = bp + 8;
+
+ /* Postscript product name */
+ if ((bp + 4) > end) {
+ sprintf(icp->err,"icmCrdInfo_read: Data too short to read Postscript product name");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->ppsize = read_UInt32Number(bp);
+ bp += 4;
+ if (p->ppsize > 0) {
+ if ((bp + p->ppsize) > end) {
+ sprintf(icp->err,"icmCrdInfo_read: Data to short to read Postscript product string");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if (check_null_string(bp,p->ppsize)) {
+ sprintf(icp->err,"icmCrdInfo_read: Postscript product name is not terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ memcpy((void *)p->ppname, (void *)bp, p->ppsize);
+ bp += p->ppsize;
+ }
+
+ /* CRD names for the four rendering intents */
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ if ((bp + 4) > end) {
+ sprintf(icp->err,"icmCrdInfo_read: Data too short to read CRD%ld name",t);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ p->crdsize[t] = read_UInt32Number(bp);
+ bp += 4;
+ if (p->crdsize[t] > 0) {
+ if ((bp + p->crdsize[t]) > end) {
+ sprintf(icp->err,"icmCrdInfo_read: Data to short to read CRD%ld string",t);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if (check_null_string(bp,p->crdsize[t])) {
+ sprintf(icp->err,"icmCrdInfo_read: CRD%ld name is not terminated",t);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ if ((rv = p->allocate((icmBase *)p)) != 0) {
+ icp->al->free(icp->al, buf);
+ return rv;
+ }
+ memcpy((void *)p->crdname[t], (void *)bp, p->crdsize[t]);
+ bp += p->crdsize[t];
+ }
+ }
+
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmCrdInfo_write(
- icmBase *pp,
- unsigned long of /* File offset to write from */
-) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- icc *icp = p->icp;
- unsigned long t;
- unsigned int len;
- char *bp, *buf; /* Buffer to write from */
- int rv = 0;
-
- /* Allocate a file write buffer */
- len = p->get_size((icmBase *)p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmCrdInfo_write malloc() failed");
- return icp->errc = 2;
- }
- bp = buf;
-
- /* Write type descriptor to the buffer */
- if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
- sprintf(icp->err,"icmCrdInfo_write: write_SInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- write_SInt32Number(0,bp+4); /* Set padding to 0 */
- bp = bp + 8;
-
- /* Postscript product name */
- if ((rv = write_UInt32Number(p->ppsize,bp)) != 0) {
- sprintf(icp->err,"icmCrdInfo_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp += 4;
- if (p->ppsize > 0) {
- if ((rv = check_null_string(p->ppname,p->ppsize)) != 0) {
- sprintf(icp->err,"icmCrdInfo_write: Postscript product name is not terminated");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)bp, (void *)p->ppname, p->ppsize);
- bp += p->ppsize;
- }
-
- /* CRD names for the four rendering intents */
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- if ((rv = write_UInt32Number(p->crdsize[t],bp)) != 0) {
- sprintf(icp->err,"icmCrdInfo_write: write_UInt32Number() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- bp += 4;
- if (p->ppsize > 0) {
- if ((rv = check_null_string(p->crdname[t],p->crdsize[t])) != 0) {
- sprintf(icp->err,"icmCrdInfo_write: CRD%ld name is not terminated",t);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- memcpy((void *)bp, (void *)p->crdname[t], p->crdsize[t]);
- bp += p->crdsize[t];
- }
- }
-
- /* Write to the file */
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmCrdInfo_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
- icp->al->free(icp->al, buf);
- return 0;
+ icmBase *pp,
+ unsigned long of /* File offset to write from */
+) {
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ icc *icp = p->icp;
+ unsigned long t;
+ unsigned int len;
+ char *bp, *buf; /* Buffer to write from */
+ int rv = 0;
+
+ /* Allocate a file write buffer */
+ len = p->get_size((icmBase *)p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmCrdInfo_write malloc() failed");
+ return icp->errc = 2;
+ }
+ bp = buf;
+
+ /* Write type descriptor to the buffer */
+ if ((rv = write_SInt32Number((int)p->ttype,bp)) != 0) {
+ sprintf(icp->err,"icmCrdInfo_write: write_SInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ write_SInt32Number(0,bp+4); /* Set padding to 0 */
+ bp = bp + 8;
+
+ /* Postscript product name */
+ if ((rv = write_UInt32Number(p->ppsize,bp)) != 0) {
+ sprintf(icp->err,"icmCrdInfo_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp += 4;
+ if (p->ppsize > 0) {
+ if ((rv = check_null_string(p->ppname,p->ppsize)) != 0) {
+ sprintf(icp->err,"icmCrdInfo_write: Postscript product name is not terminated");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)bp, (void *)p->ppname, p->ppsize);
+ bp += p->ppsize;
+ }
+
+ /* CRD names for the four rendering intents */
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ if ((rv = write_UInt32Number(p->crdsize[t],bp)) != 0) {
+ sprintf(icp->err,"icmCrdInfo_write: write_UInt32Number() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ bp += 4;
+ if (p->ppsize > 0) {
+ if ((rv = check_null_string(p->crdname[t],p->crdsize[t])) != 0) {
+ sprintf(icp->err,"icmCrdInfo_write: CRD%ld name is not terminated",t);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ memcpy((void *)bp, (void *)p->crdname[t], p->crdsize[t]);
+ bp += p->crdsize[t];
+ }
+ }
+
+ /* Write to the file */
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmCrdInfo_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Dump a text description of the object */
static void icmCrdInfo_dump(
- icmBase *pp,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- unsigned long i, r, c, size, t;
-
- if (verb <= 0)
- return;
-
- fprintf(op,"PostScript Product name and CRD names:\n");
-
- fprintf(op," Product name:\n");
- fprintf(op," No. chars = %lu\n",p->ppsize);
-
- size = p->ppsize > 0 ? p->ppsize-1 : 0;
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 73) {
- if (isprint((unsigned char) p->ppname[i])) {
- fprintf(op,"%c",p->ppname[i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->ppname[i]);
- c += 4;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
-
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- fprintf(op," CRD%ld name:\n",t);
- fprintf(op," No. chars = %lu\n",p->crdsize[t]);
-
- size = p->crdsize[t] > 0 ? p->crdsize[t]-1 : 0;
- i = 0;
- for (r = 1;; r++) { /* count rows */
- if (i >= size) {
- fprintf(op,"\n");
- break;
- }
- if (r > 1 && verb < 2) {
- fprintf(op,"...\n");
- break; /* Print 1 row if not verbose */
- }
- c = 1;
- fprintf(op," 0x%04lx: ",i);
- c += 10;
- while (i < size && c < 73) {
- if (isprint((unsigned char) p->crdname[t][i])) {
- fprintf(op,"%c",p->crdname[t][i]);
- c++;
- } else {
- fprintf(op,"\\%03o",p->crdname[t][i]);
- c += 4;
- }
- i++;
- }
- if (i < size)
- fprintf(op,"\n");
- }
- }
+ icmBase *pp,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ unsigned long i, r, c, size, t;
+
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"PostScript Product name and CRD names:\n");
+
+ fprintf(op," Product name:\n");
+ fprintf(op," No. chars = %lu\n",p->ppsize);
+
+ size = p->ppsize > 0 ? p->ppsize-1 : 0;
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 73) {
+ if (isprint((unsigned char) p->ppname[i])) {
+ fprintf(op,"%c",p->ppname[i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->ppname[i]);
+ c += 4;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ fprintf(op," CRD%ld name:\n",t);
+ fprintf(op," No. chars = %lu\n",p->crdsize[t]);
+
+ size = p->crdsize[t] > 0 ? p->crdsize[t]-1 : 0;
+ i = 0;
+ for (r = 1;; r++) { /* count rows */
+ if (i >= size) {
+ fprintf(op,"\n");
+ break;
+ }
+ if (r > 1 && verb < 2) {
+ fprintf(op,"...\n");
+ break; /* Print 1 row if not verbose */
+ }
+ c = 1;
+ fprintf(op," 0x%04lx: ",i);
+ c += 10;
+ while (i < size && c < 73) {
+ if (isprint((unsigned char) p->crdname[t][i])) {
+ fprintf(op,"%c",p->crdname[t][i]);
+ c++;
+ } else {
+ fprintf(op,"\\%03o",p->crdname[t][i]);
+ c += 4;
+ }
+ i++;
+ }
+ if (i < size)
+ fprintf(op,"\n");
+ }
+ }
}
/* Allocate variable sized data elements */
static int icmCrdInfo_allocate(
- icmBase *pp
-) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- icc *icp = p->icp;
- unsigned int t;
-
- if (p->ppsize != p->_ppsize) {
- if (p->ppname != NULL)
- icp->al->free(icp->al, p->ppname);
- if ((p->ppname = (char *) icp->al->calloc(icp->al, p->ppsize, sizeof(char))) == NULL) {
- sprintf(icp->err,"icmCrdInfo_alloc: calloc() of string data failed");
- return icp->errc = 2;
- }
- p->_ppsize = p->ppsize;
- }
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- if (p->crdsize[t] != p->_crdsize[t]) {
- if (p->crdname[t] != NULL)
- icp->al->free(icp->al, p->crdname[t]);
- if ((p->crdname[t] = (char *) icp->al->calloc(icp->al, p->crdsize[t], sizeof(char))) == NULL) {
- sprintf(icp->err,"icmCrdInfo_alloc: calloc() of CRD%d name string failed",t);
- return icp->errc = 2;
- }
- p->_crdsize[t] = p->crdsize[t];
- }
- }
- return 0;
+ icmBase *pp
+) {
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ icc *icp = p->icp;
+ unsigned int t;
+
+ if (p->ppsize != p->_ppsize) {
+ if (p->ppname != NULL)
+ icp->al->free(icp->al, p->ppname);
+ if ((p->ppname = (char *) icp->al->calloc(icp->al, p->ppsize, sizeof(char))) == NULL) {
+ sprintf(icp->err,"icmCrdInfo_alloc: calloc() of string data failed");
+ return icp->errc = 2;
+ }
+ p->_ppsize = p->ppsize;
+ }
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ if (p->crdsize[t] != p->_crdsize[t]) {
+ if (p->crdname[t] != NULL)
+ icp->al->free(icp->al, p->crdname[t]);
+ if ((p->crdname[t] = (char *) icp->al->calloc(icp->al, p->crdsize[t], sizeof(char))) == NULL) {
+ sprintf(icp->err,"icmCrdInfo_alloc: calloc() of CRD%d name string failed",t);
+ return icp->errc = 2;
+ }
+ p->_crdsize[t] = p->crdsize[t];
+ }
+ }
+ return 0;
}
/* Free all storage in the object */
static void icmCrdInfo_delete(
- icmBase *pp
+ icmBase *pp
) {
- icmCrdInfo *p = (icmCrdInfo *)pp;
- icc *icp = p->icp;
- unsigned int t;
+ icmCrdInfo *p = (icmCrdInfo *)pp;
+ icc *icp = p->icp;
+ unsigned int t;
- if (p->ppname != NULL)
- icp->al->free(icp->al, p->ppname);
- for (t = 0; t < 4; t++) { /* For all 4 intents */
- if (p->crdname[t] != NULL)
- icp->al->free(icp->al, p->crdname[t]);
- }
- icp->al->free(icp->al, p);
+ if (p->ppname != NULL)
+ icp->al->free(icp->al, p->ppname);
+ for (t = 0; t < 4; t++) { /* For all 4 intents */
+ if (p->crdname[t] != NULL)
+ icp->al->free(icp->al, p->crdname[t]);
+ }
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmBase *new_icmCrdInfo(
- icc *icp
+ icc *icp
) {
- icmCrdInfo *p;
- if ((p = (icmCrdInfo *) icp->al->calloc(icp->al,1,sizeof(icmCrdInfo))) == NULL)
- return NULL;
- p->ttype = icSigCrdInfoType;
- p->refcount = 1;
- p->get_size = icmCrdInfo_get_size;
- p->read = icmCrdInfo_read;
- p->write = icmCrdInfo_write;
- p->dump = icmCrdInfo_dump;
- p->allocate = icmCrdInfo_allocate;
- p->del = icmCrdInfo_delete;
- p->icp = icp;
+ icmCrdInfo *p;
+ if ((p = (icmCrdInfo *) icp->al->calloc(icp->al,1,sizeof(icmCrdInfo))) == NULL)
+ return NULL;
+ p->ttype = icSigCrdInfoType;
+ p->refcount = 1;
+ p->get_size = icmCrdInfo_get_size;
+ p->read = icmCrdInfo_read;
+ p->write = icmCrdInfo_write;
+ p->dump = icmCrdInfo_dump;
+ p->allocate = icmCrdInfo_allocate;
+ p->del = icmCrdInfo_delete;
+ p->icp = icp;
- return (icmBase *)p;
+ return (icmBase *)p;
}
/* ========================================================== */
@@ -8917,679 +8906,678 @@ static icmBase *new_icmCrdInfo(
/* Return the number of bytes needed to write this tag */
static unsigned int icmHeader_get_size(
- icmHeader *p
+ icmHeader *p
) {
- return 128; /* By definition */
+ return 128; /* By definition */
}
/* read the object, return 0 on success, error code on fail */
static int icmHeader_read(
- icmHeader *p,
- unsigned long len, /* tag length */
- unsigned long of /* start offset within file */
-) {
- icc *icp = p->icp;
- char *buf;
- unsigned int tt;
- int rv = 0;
-
- if (len != 128) {
- sprintf(icp->err,"icmHeader_read: Length expected to be 128");
- return icp->errc = 1;
- }
-
- if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
- sprintf(icp->err,"icmHeader_read: malloc() failed");
- return icp->errc = 2;
- }
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->read(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmHeader_read: fseek() or fread() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
-
- /* Fill in the in-memory structure */
- p->size = read_UInt32Number(buf + 0); /* Profile size in bytes */
+ icmHeader *p,
+ unsigned long len, /* tag length */
+ unsigned long of /* start offset within file */
+) {
+ icc *icp = p->icp;
+ char *buf;
+ unsigned int tt;
+ int rv = 0;
+
+ if (len != 128) {
+ sprintf(icp->err,"icmHeader_read: Length expected to be 128");
+ return icp->errc = 1;
+ }
+
+ if ((buf = (char *) icp->al->malloc(icp->al, len)) == NULL) {
+ sprintf(icp->err,"icmHeader_read: malloc() failed");
+ return icp->errc = 2;
+ }
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->read(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmHeader_read: fseek() or fread() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+
+ /* Fill in the in-memory structure */
+ p->size = read_UInt32Number(buf + 0); /* Profile size in bytes */
p->cmmId = read_SInt32Number(buf + 4); /* CMM for profile */
- tt = read_UInt8Number(buf + 8); /* Raw major version number */
+ tt = read_UInt8Number(buf + 8); /* Raw major version number */
p->majv = (tt >> 4) * 10 + (tt & 0xf); /* Integer major version number */
- tt = read_UInt8Number(buf + 9); /* Raw minor/bug fix version numbers */
+ tt = read_UInt8Number(buf + 9); /* Raw minor/bug fix version numbers */
p->minv = (tt >> 4); /* Integer minor version number */
p->bfv = (tt & 0xf); /* Integer bug fix version number */
- p->deviceClass = (icProfileClassSignature)
- read_SInt32Number(buf + 12); /* Type of profile */
+ p->deviceClass = (icProfileClassSignature)
+ read_SInt32Number(buf + 12); /* Type of profile */
p->colorSpace = (icColorSpaceSignature)
- read_SInt32Number(buf + 16); /* Color space of data */
+ read_SInt32Number(buf + 16); /* Color space of data */
p->pcs = (icColorSpaceSignature)
- read_SInt32Number(buf + 20); /* PCS: XYZ or Lab */
- if ((rv = read_DateTimeNumber(&p->date, buf + 24)) != 0) { /* Creation Date */
- sprintf(icp->err,"icmHeader_read: read_DateTimeNumber corrupted");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- tt = read_SInt32Number(buf+36);
- if (tt != icMagicNumber) { /* Check magic number */
- sprintf(icp->err,"icmHeader_read: wrong magic number 0x%x",tt);
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
+ read_SInt32Number(buf + 20); /* PCS: XYZ or Lab */
+ if ((rv = read_DateTimeNumber(&p->date, buf + 24)) != 0) { /* Creation Date */
+ sprintf(icp->err,"icmHeader_read: read_DateTimeNumber corrupted");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ tt = read_SInt32Number(buf+36);
+ if (tt != icMagicNumber) { /* Check magic number */
+ sprintf(icp->err,"icmHeader_read: wrong magic number 0x%x",tt);
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
p->platform = (icPlatformSignature)
- read_SInt32Number(buf + 40); /* Primary platform */
+ read_SInt32Number(buf + 40); /* Primary platform */
p->flags = read_UInt32Number(buf + 44); /* Various bits */
p->manufacturer = read_SInt32Number(buf + 48); /* Dev manufacturer */
p->model = read_SInt32Number(buf + 52); /* Dev model */
read_UInt64Number(&p->attributes, buf + 56); /* Device attributes */
- p->renderingIntent = (icRenderingIntent)
- read_SInt32Number(buf + 64); /* Rendering intent */
- if ((rv = read_XYZNumber(&p->illuminant, buf + 68)) != 0) { /* Profile illuminant */
- sprintf(icp->err,"icmHeader_read: read_XYZNumber error");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ p->renderingIntent = (icRenderingIntent)
+ read_SInt32Number(buf + 64); /* Rendering intent */
+ if ((rv = read_XYZNumber(&p->illuminant, buf + 68)) != 0) { /* Profile illuminant */
+ sprintf(icp->err,"icmHeader_read: read_XYZNumber error");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
p->creator = read_SInt32Number(buf + 80); /* Profile creator */
- icp->al->free(icp->al, buf);
- return 0;
+ icp->al->free(icp->al, buf);
+ return 0;
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icmHeader_write(
- icmHeader *p,
- unsigned long of /* File offset to write from */
-) {
- icc *icp = p->icp;
- char *buf; /* Buffer to write from */
- unsigned int len;
- unsigned int tt;
- int rv = 0;
-
- len = p->get_size(p);
- if (icp->errc)
- return icp->errc;
- if ((buf = (char *) icp->al->calloc(icp->al,1,len)) == NULL) { /* Zero it - some CMS are fussy */
- sprintf(icp->err,"icmHeader_write calloc() failed");
- return icp->errc = 2;
- }
-
- /* Fill in the write buffer */
- if ((rv = write_UInt32Number(p->size, buf + 0)) != 0) { /* Profile size in bytes */
- sprintf(icp->err,"icmHeader_write: profile size");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ icmHeader *p,
+ unsigned long of /* File offset to write from */
+) {
+ icc *icp = p->icp;
+ char *buf; /* Buffer to write from */
+ unsigned int len;
+ unsigned int tt;
+ int rv = 0;
+
+ len = p->get_size(p);
+ if (icp->errc)
+ return icp->errc;
+ if ((buf = (char *) icp->al->calloc(icp->al,1,len)) == NULL) { /* Zero it - some CMS are fussy */
+ sprintf(icp->err,"icmHeader_write calloc() failed");
+ return icp->errc = 2;
+ }
+
+ /* Fill in the write buffer */
+ if ((rv = write_UInt32Number(p->size, buf + 0)) != 0) { /* Profile size in bytes */
+ sprintf(icp->err,"icmHeader_write: profile size");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((rv = write_SInt32Number(p->cmmId, buf + 4)) != 0) { /* CMM for profile */
- sprintf(icp->err,"icmHeader_write: cmmId");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if (p->majv < 0 || p->majv > 99 /* Sanity check version numbers */
- || p->minv < 0 || p->minv > 9
- || p->bfv < 0 || p->bfv > 9) {
- sprintf(icp->err,"icmHeader_write: version number");
- icp->al->free(icp->al, buf);
- return icp->errc = 1;
- }
- tt = ((p->majv/10) << 4) + (p->majv % 10);
- if ((rv = write_UInt8Number(tt, buf + 8)) != 0) { /* Raw major version number */
- sprintf(icp->err,"icmHeader_write: Uint8Number major version");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: cmmId");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if (p->majv < 0 || p->majv > 99 /* Sanity check version numbers */
+ || p->minv < 0 || p->minv > 9
+ || p->bfv < 0 || p->bfv > 9) {
+ sprintf(icp->err,"icmHeader_write: version number");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 1;
+ }
+ tt = ((p->majv/10) << 4) + (p->majv % 10);
+ if ((rv = write_UInt8Number(tt, buf + 8)) != 0) { /* Raw major version number */
+ sprintf(icp->err,"icmHeader_write: Uint8Number major version");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
tt = (p->minv << 4) + p->bfv;
- if ((rv = write_UInt8Number(tt, buf + 9)) != 0) { /* Raw minor/bug fix version numbers */
- sprintf(icp->err,"icmHeader_write: Uint8Number minor/bug fix");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number((int)p->deviceClass, buf + 12)) != 0) { /* Type of profile */
- sprintf(icp->err,"icmHeader_write: SInt32Number deviceClass");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number((int)p->colorSpace, buf + 16)) != 0) { /* Color space of data */
- sprintf(icp->err,"icmHeader_write: SInt32Number data color space");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number((int)p->pcs, buf + 20)) != 0) { /* PCS: XYZ or Lab */
- sprintf(icp->err,"icmHeader_write: SInt32Number PCS");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_DateTimeNumber(&p->date, buf + 24)) != 0) { /* Creation Date */
- sprintf(icp->err,"icmHeader_write: DateTimeNumber creation");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number(icMagicNumber, buf+36)) != 0) { /* Magic number */
- sprintf(icp->err,"icmHeader_write: SInt32Number magic");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number((int)p->platform, buf + 40)) != 0) { /* Primary platform */
- sprintf(icp->err,"icmHeader_write: SInt32Number platform");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ if ((rv = write_UInt8Number(tt, buf + 9)) != 0) { /* Raw minor/bug fix version numbers */
+ sprintf(icp->err,"icmHeader_write: Uint8Number minor/bug fix");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number((int)p->deviceClass, buf + 12)) != 0) { /* Type of profile */
+ sprintf(icp->err,"icmHeader_write: SInt32Number deviceClass");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number((int)p->colorSpace, buf + 16)) != 0) { /* Color space of data */
+ sprintf(icp->err,"icmHeader_write: SInt32Number data color space");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number((int)p->pcs, buf + 20)) != 0) { /* PCS: XYZ or Lab */
+ sprintf(icp->err,"icmHeader_write: SInt32Number PCS");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_DateTimeNumber(&p->date, buf + 24)) != 0) { /* Creation Date */
+ sprintf(icp->err,"icmHeader_write: DateTimeNumber creation");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number(icMagicNumber, buf+36)) != 0) { /* Magic number */
+ sprintf(icp->err,"icmHeader_write: SInt32Number magic");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number((int)p->platform, buf + 40)) != 0) { /* Primary platform */
+ sprintf(icp->err,"icmHeader_write: SInt32Number platform");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((rv = write_UInt32Number(p->flags, buf + 44)) != 0) { /* Various bits */
- sprintf(icp->err,"icmHeader_write: UInt32Number flags");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: UInt32Number flags");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((rv = write_SInt32Number(p->manufacturer, buf + 48)) != 0) { /* Dev manufacturer */
- sprintf(icp->err,"icmHeader_write: SInt32Number manufaturer");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: SInt32Number manufaturer");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((write_SInt32Number(p->model, buf + 52)) != 0) { /* Dev model */
- sprintf(icp->err,"icmHeader_write: SInt32Number model");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: SInt32Number model");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((rv = write_UInt64Number(&p->attributes, buf + 56)) != 0) { /* Device attributes */
- sprintf(icp->err,"icmHeader_write: UInt64Number attributes");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_SInt32Number((int)p->renderingIntent, buf + 64)) != 0) { /* Rendering intent */
- sprintf(icp->err,"icmHeader_write: SInt32Number rendering intent");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
- if ((rv = write_XYZNumber(&p->illuminant, buf + 68)) != 0) { /* Profile illuminant */
- sprintf(icp->err,"icmHeader_write: XYZNumber illuminant");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: UInt64Number attributes");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_SInt32Number((int)p->renderingIntent, buf + 64)) != 0) { /* Rendering intent */
+ sprintf(icp->err,"icmHeader_write: SInt32Number rendering intent");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
+ if ((rv = write_XYZNumber(&p->illuminant, buf + 68)) != 0) { /* Profile illuminant */
+ sprintf(icp->err,"icmHeader_write: XYZNumber illuminant");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
if ((rv = write_SInt32Number(p->creator, buf + 80)) != 0) { /* Profile creator */
- sprintf(icp->err,"icmHeader_write: SInt32Number creator");
- icp->al->free(icp->al, buf);
- return icp->errc = rv;
- }
+ sprintf(icp->err,"icmHeader_write: SInt32Number creator");
+ icp->al->free(icp->al, buf);
+ return icp->errc = rv;
+ }
- if ( icp->fp->seek(icp->fp, of) != 0
- || icp->fp->write(icp->fp, buf, 1, len) != len) {
- sprintf(icp->err,"icmHeader_write fseek() or fwrite() failed");
- icp->al->free(icp->al, buf);
- return icp->errc = 2;
- }
+ if ( icp->fp->seek(icp->fp, of) != 0
+ || icp->fp->write(icp->fp, buf, 1, len) != len) {
+ sprintf(icp->err,"icmHeader_write fseek() or fwrite() failed");
+ icp->al->free(icp->al, buf);
+ return icp->errc = 2;
+ }
- icp->al->free(icp->al, buf);
- return rv;
+ icp->al->free(icp->al, buf);
+ return rv;
}
static void icmHeader_dump(
- icmHeader *p,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- if (verb <= 0)
- return;
-
- fprintf(op,"Header:\n");
- fprintf(op," size = %d bytes\n",p->size);
- fprintf(op," CMM = %s\n",tag2str(p->cmmId));
- fprintf(op," Version = %d.%d.%d\n",p->majv, p->minv, p->bfv);
- fprintf(op," Device Class = %s\n", string_ProfileClassSignature(p->deviceClass));
- fprintf(op," Color Space = %s\n", string_ColorSpaceSignature(p->colorSpace));
- fprintf(op," Conn. Space = %s\n", string_ColorSpaceSignature(p->pcs));
- fprintf(op," Date, Time = %s\n", string_DateTimeNumber(&p->date));
- fprintf(op," Platform = %s\n", string_PlatformSignature(p->platform));
- fprintf(op," Flags = %s\n", string_ProfileHeaderFlags(p->flags));
- fprintf(op," Dev. Mnfctr. = %s\n",tag2str(p->manufacturer)); /* ~~~ */
- fprintf(op," Dev. Model = %s\n",tag2str(p->model)); /* ~~~ */
- fprintf(op," Dev. Attrbts = %s\n", string_DeviceAttributes(p->attributes.l));
- fprintf(op," Rndrng Intnt = %s\n", string_RenderingIntent(p->renderingIntent));
- fprintf(op," Illuminant = %s\n", string_XYZNumber_and_Lab(&p->illuminant));
- fprintf(op," Creator = %s\n",tag2str(p->creator)); /* ~~~ */
- fprintf(op,"\n");
+ icmHeader *p,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"Header:\n");
+ fprintf(op," size = %d bytes\n",p->size);
+ fprintf(op," CMM = %s\n",tag2str(p->cmmId));
+ fprintf(op," Version = %d.%d.%d\n",p->majv, p->minv, p->bfv);
+ fprintf(op," Device Class = %s\n", string_ProfileClassSignature(p->deviceClass));
+ fprintf(op," Color Space = %s\n", string_ColorSpaceSignature(p->colorSpace));
+ fprintf(op," Conn. Space = %s\n", string_ColorSpaceSignature(p->pcs));
+ fprintf(op," Date, Time = %s\n", string_DateTimeNumber(&p->date));
+ fprintf(op," Platform = %s\n", string_PlatformSignature(p->platform));
+ fprintf(op," Flags = %s\n", string_ProfileHeaderFlags(p->flags));
+ fprintf(op," Dev. Mnfctr. = %s\n",tag2str(p->manufacturer)); /* ~~~ */
+ fprintf(op," Dev. Model = %s\n",tag2str(p->model)); /* ~~~ */
+ fprintf(op," Dev. Attrbts = %s\n", string_DeviceAttributes(p->attributes.l));
+ fprintf(op," Rndrng Intnt = %s\n", string_RenderingIntent(p->renderingIntent));
+ fprintf(op," Illuminant = %s\n", string_XYZNumber_and_Lab(&p->illuminant));
+ fprintf(op," Creator = %s\n",tag2str(p->creator)); /* ~~~ */
+ fprintf(op,"\n");
}
static void icmHeader_delete(
- icmHeader *p
+ icmHeader *p
) {
- icc *icp = p->icp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* Create an empty object. Return null on error */
static icmHeader *new_icmHeader(
- icc *icp
+ icc *icp
) {
- icmHeader *p;
- if ((p = (icmHeader *) icp->al->calloc(icp->al,1,sizeof(icmHeader))) == NULL)
- return NULL;
- p->icp = icp;
- p->get_size = icmHeader_get_size;
- p->read = icmHeader_read;
- p->write = icmHeader_write;
- p->dump = icmHeader_dump;
- p->del = icmHeader_delete;
+ icmHeader *p;
+ if ((p = (icmHeader *) icp->al->calloc(icp->al,1,sizeof(icmHeader))) == NULL)
+ return NULL;
+ p->icp = icp;
+ p->get_size = icmHeader_get_size;
+ p->read = icmHeader_read;
+ p->write = icmHeader_write;
+ p->dump = icmHeader_dump;
+ p->del = icmHeader_delete;
- return p;
+ return p;
}
/* ---------------------------------------------------------- */
/* Type vector table. Match the Tag type against the object creator */
static struct {
- icTagTypeSignature ttype; /* The tag type signature */
- icmBase * (*new_obj)(icc *icp);
+ icTagTypeSignature ttype; /* The tag type signature */
+ icmBase * (*new_obj)(icc *icp);
} typetable[] = {
- {icSigCrdInfoType, new_icmCrdInfo},
- {icSigCurveType, new_icmCurve},
- {icSigDataType, new_icmData},
- {icSigDateTimeType, new_icmDateTimeNumber},
- {icSigLut16Type, new_icmLut},
- {icSigLut8Type, new_icmLut},
- {icSigMeasurementType, new_icmMeasurement},
- {icSigNamedColorType, new_icmNamedColor},
- {icSigNamedColor2Type, new_icmNamedColor},
- {icSigProfileSequenceDescType, new_icmProfileSequenceDesc},
- {icSigS15Fixed16ArrayType, new_icmS15Fixed16Array},
- {icSigScreeningType, new_icmScreening},
- {icSigSignatureType, new_icmSignature},
- {icSigTextDescriptionType, new_icmTextDescription},
- {icSigTextType, new_icmText},
- {icSigU16Fixed16ArrayType, new_icmU16Fixed16Array},
- {icSigUcrBgType, new_icmUcrBg},
- {icSigVideoCardGammaType, new_icmVideoCardGamma},
- {icSigUInt16ArrayType, new_icmUInt16Array},
- {icSigUInt32ArrayType, new_icmUInt32Array},
- {icSigUInt64ArrayType, new_icmUInt64Array},
- {icSigUInt8ArrayType, new_icmUInt8Array},
- {icSigViewingConditionsType, new_icmViewingConditions},
- {icSigXYZArrayType, new_icmXYZArray},
- {icMaxEnumType, NULL}
-};
+ {icSigCrdInfoType, new_icmCrdInfo},
+ {icSigCurveType, new_icmCurve},
+ {icSigDataType, new_icmData},
+ {icSigDateTimeType, new_icmDateTimeNumber},
+ {icSigLut16Type, new_icmLut},
+ {icSigLut8Type, new_icmLut},
+ {icSigMeasurementType, new_icmMeasurement},
+ {icSigNamedColorType, new_icmNamedColor},
+ {icSigNamedColor2Type, new_icmNamedColor},
+ {icSigProfileSequenceDescType, new_icmProfileSequenceDesc},
+ {icSigS15Fixed16ArrayType, new_icmS15Fixed16Array},
+ {icSigScreeningType, new_icmScreening},
+ {icSigSignatureType, new_icmSignature},
+ {icSigTextDescriptionType, new_icmTextDescription},
+ {icSigTextType, new_icmText},
+ {icSigU16Fixed16ArrayType, new_icmU16Fixed16Array},
+ {icSigUcrBgType, new_icmUcrBg},
+ {icSigVideoCardGammaType, new_icmVideoCardGamma},
+ {icSigUInt16ArrayType, new_icmUInt16Array},
+ {icSigUInt32ArrayType, new_icmUInt32Array},
+ {icSigUInt64ArrayType, new_icmUInt64Array},
+ {icSigUInt8ArrayType, new_icmUInt8Array},
+ {icSigViewingConditionsType, new_icmViewingConditions},
+ {icSigXYZArrayType, new_icmXYZArray},
+ {icMaxEnumType, NULL}
+};
/* Table that lists the legal Types for each Tag Signature */
static struct {
- icTagSignature sig;
- icTagTypeSignature ttypes[4]; /* Arbitrary max of 4 */
+ icTagSignature sig;
+ icTagTypeSignature ttypes[4]; /* Arbitrary max of 4 */
} sigtypetable[] = {
- {icSigAToB0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigAToB1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigAToB2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigBlueColorantTag, {icSigXYZType,icMaxEnumType}},
- {icSigBlueTRCTag, {icSigCurveType,icMaxEnumType}},
- {icSigBToA0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigBToA1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigBToA2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigCalibrationDateTimeTag, {icSigDateTimeType,icMaxEnumType}},
- {icSigCharTargetTag, {icSigTextType,icMaxEnumType}},
- {icSigCopyrightTag, {icSigTextType,icMaxEnumType}},
- {icSigCrdInfoTag, {icSigCrdInfoType,icMaxEnumType}},
- {icSigDeviceMfgDescTag, {icSigTextDescriptionType,icMaxEnumType}},
- {icSigDeviceModelDescTag, {icSigTextDescriptionType,icMaxEnumType}},
- {icSigGamutTag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigGrayTRCTag, {icSigCurveType,icMaxEnumType}},
- {icSigGreenColorantTag, {icSigXYZType,icMaxEnumType}},
- {icSigGreenTRCTag, {icSigCurveType,icMaxEnumType}},
- {icSigLuminanceTag, {icSigXYZType,icMaxEnumType}},
- {icSigMeasurementTag, {icSigMeasurementType,icMaxEnumType}},
- {icSigMediaBlackPointTag, {icSigXYZType,icMaxEnumType}},
- {icSigMediaWhitePointTag, {icSigXYZType,icMaxEnumType}},
- {icSigNamedColorTag, {icSigNamedColorType,icMaxEnumType}},
- {icSigNamedColor2Tag, {icSigNamedColor2Type,icMaxEnumType}},
- {icSigPreview0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigPreview1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigPreview2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
- {icSigProfileDescriptionTag, {icSigTextDescriptionType,icMaxEnumType}},
- {icSigProfileSequenceDescTag, {icSigProfileSequenceDescType,icMaxEnumType}},
- {icSigPs2CRD0Tag, {icSigDataType,icMaxEnumType}},
- {icSigPs2CRD1Tag, {icSigDataType,icMaxEnumType}},
- {icSigPs2CRD2Tag, {icSigDataType,icMaxEnumType}},
- {icSigPs2CRD3Tag, {icSigDataType,icMaxEnumType}},
- {icSigPs2CSATag, {icSigDataType,icMaxEnumType}},
- {icSigPs2RenderingIntentTag, {icSigDataType,icMaxEnumType}},
- {icSigRedColorantTag, {icSigXYZType,icMaxEnumType}},
- {icSigRedTRCTag, {icSigCurveType,icMaxEnumType}},
- {icSigScreeningDescTag, {icSigTextDescriptionType,icMaxEnumType}},
- {icSigScreeningTag, {icSigScreeningType,icMaxEnumType}},
- {icSigTechnologyTag, {icSigSignatureType,icMaxEnumType}},
- {icSigUcrBgTag, {icSigUcrBgType,icMaxEnumType}},
- {icSigVideoCardGammaTag, {icSigVideoCardGammaType,icMaxEnumType}},
- {icSigViewingCondDescTag, {icSigTextDescriptionType,icMaxEnumType}},
- {icSigViewingConditionsTag, {icSigViewingConditionsType,icMaxEnumType}},
- {icMaxEnumType, {icMaxEnumType}}
-};
+ {icSigAToB0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigAToB1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigAToB2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigBlueColorantTag, {icSigXYZType,icMaxEnumType}},
+ {icSigBlueTRCTag, {icSigCurveType,icMaxEnumType}},
+ {icSigBToA0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigBToA1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigBToA2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigCalibrationDateTimeTag, {icSigDateTimeType,icMaxEnumType}},
+ {icSigCharTargetTag, {icSigTextType,icMaxEnumType}},
+ {icSigCopyrightTag, {icSigTextType,icMaxEnumType}},
+ {icSigCrdInfoTag, {icSigCrdInfoType,icMaxEnumType}},
+ {icSigDeviceMfgDescTag, {icSigTextDescriptionType,icMaxEnumType}},
+ {icSigDeviceModelDescTag, {icSigTextDescriptionType,icMaxEnumType}},
+ {icSigGamutTag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigGrayTRCTag, {icSigCurveType,icMaxEnumType}},
+ {icSigGreenColorantTag, {icSigXYZType,icMaxEnumType}},
+ {icSigGreenTRCTag, {icSigCurveType,icMaxEnumType}},
+ {icSigLuminanceTag, {icSigXYZType,icMaxEnumType}},
+ {icSigMeasurementTag, {icSigMeasurementType,icMaxEnumType}},
+ {icSigMediaBlackPointTag, {icSigXYZType,icMaxEnumType}},
+ {icSigMediaWhitePointTag, {icSigXYZType,icMaxEnumType}},
+ {icSigNamedColorTag, {icSigNamedColorType,icMaxEnumType}},
+ {icSigNamedColor2Tag, {icSigNamedColor2Type,icMaxEnumType}},
+ {icSigPreview0Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigPreview1Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigPreview2Tag, {icSigLut8Type,icSigLut16Type,icMaxEnumType}},
+ {icSigProfileDescriptionTag, {icSigTextDescriptionType,icMaxEnumType}},
+ {icSigProfileSequenceDescTag, {icSigProfileSequenceDescType,icMaxEnumType}},
+ {icSigPs2CRD0Tag, {icSigDataType,icMaxEnumType}},
+ {icSigPs2CRD1Tag, {icSigDataType,icMaxEnumType}},
+ {icSigPs2CRD2Tag, {icSigDataType,icMaxEnumType}},
+ {icSigPs2CRD3Tag, {icSigDataType,icMaxEnumType}},
+ {icSigPs2CSATag, {icSigDataType,icMaxEnumType}},
+ {icSigPs2RenderingIntentTag, {icSigDataType,icMaxEnumType}},
+ {icSigRedColorantTag, {icSigXYZType,icMaxEnumType}},
+ {icSigRedTRCTag, {icSigCurveType,icMaxEnumType}},
+ {icSigScreeningDescTag, {icSigTextDescriptionType,icMaxEnumType}},
+ {icSigScreeningTag, {icSigScreeningType,icMaxEnumType}},
+ {icSigTechnologyTag, {icSigSignatureType,icMaxEnumType}},
+ {icSigUcrBgTag, {icSigUcrBgType,icMaxEnumType}},
+ {icSigVideoCardGammaTag, {icSigVideoCardGammaType,icMaxEnumType}},
+ {icSigViewingCondDescTag, {icSigTextDescriptionType,icMaxEnumType}},
+ {icSigViewingConditionsTag, {icSigViewingConditionsType,icMaxEnumType}},
+ {icMaxEnumType, {icMaxEnumType}}
+};
/* Fake color tag for specifying PCS */
#define icSigPCSData ((icColorSpaceSignature) 0x50435320L)
/* Table that lists the required tags for various profiles */
static struct {
- icProfileClassSignature sig; /* Profile signature */
- int chans; /* Data Color channels, -ve for match but try next, */
- /* -100 for ignore, -200 for ignore and try next */
- icColorSpaceSignature colsig; /* Data Color space signature, icMaxEnumData for ignore, */
- /* icSigPCSData for XYZ of Lab */
- icColorSpaceSignature pcssig; /* PCS Color space signature, icMaxEnumData for ignore, */
- /* icSigPCSData for XYZ or Lab */
- icTagSignature tags[12]; /* Arbitrary max of 12 */
+ icProfileClassSignature sig; /* Profile signature */
+ int chans; /* Data Color channels, -ve for match but try next, */
+ /* -100 for ignore, -200 for ignore and try next */
+ icColorSpaceSignature colsig; /* Data Color space signature, icMaxEnumData for ignore, */
+ /* icSigPCSData for XYZ of Lab */
+ icColorSpaceSignature pcssig; /* PCS Color space signature, icMaxEnumData for ignore, */
+ /* icSigPCSData for XYZ or Lab */
+ icTagSignature tags[12]; /* Arbitrary max of 12 */
} tagchecktable[] = {
{icSigInputClass, -1, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigGrayTRCTag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigGrayTRCTag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigInputClass, -3, icMaxEnumData, icSigXYZData,
- {icSigProfileDescriptionTag,
- icSigRedColorantTag,
- icSigGreenColorantTag,
- icSigBlueColorantTag,
- icSigRedTRCTag,
- icSigGreenTRCTag,
- icSigBlueTRCTag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigRedColorantTag,
+ icSigGreenColorantTag,
+ icSigBlueColorantTag,
+ icSigRedTRCTag,
+ icSigGreenTRCTag,
+ icSigBlueTRCTag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigInputClass, -100, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigDisplayClass, -1, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigGrayTRCTag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigGrayTRCTag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigDisplayClass, -3, icSigRgbData, icSigXYZData, /* Rgb or any 3 component space ?? */
- {icSigProfileDescriptionTag,
- icSigRedColorantTag,
- icSigGreenColorantTag,
- icSigBlueColorantTag,
- icSigRedTRCTag,
- icSigGreenTRCTag,
- icSigBlueTRCTag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
-
- /* Non-3 component Display device */
+ {icSigProfileDescriptionTag,
+ icSigRedColorantTag,
+ icSigGreenColorantTag,
+ icSigBlueColorantTag,
+ icSigRedTRCTag,
+ icSigGreenTRCTag,
+ icSigBlueTRCTag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
+
+ /* Non-3 component Display device */
{icSigDisplayClass, -100, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag, /* BToA doesn't seem to be required, which is strange... */
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag, /* BToA doesn't seem to be required, which is strange... */
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -1, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigGrayTRCTag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigGrayTRCTag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -1, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigBToA0Tag,
- icSigGamutTag,
- icSigAToB1Tag,
- icSigBToA1Tag,
- icSigAToB2Tag,
- icSigBToA2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigBToA0Tag,
+ icSigGamutTag,
+ icSigAToB1Tag,
+ icSigBToA1Tag,
+ icSigAToB2Tag,
+ icSigBToA2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -2, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigBToA0Tag,
- icSigGamutTag,
- icSigAToB1Tag,
- icSigBToA1Tag,
- icSigAToB2Tag,
- icSigBToA2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigBToA0Tag,
+ icSigGamutTag,
+ icSigAToB1Tag,
+ icSigBToA1Tag,
+ icSigAToB2Tag,
+ icSigBToA2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -3, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigBToA0Tag,
- icSigGamutTag,
- icSigAToB1Tag,
- icSigBToA1Tag,
- icSigAToB2Tag,
- icSigBToA2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigBToA0Tag,
+ icSigGamutTag,
+ icSigAToB1Tag,
+ icSigBToA1Tag,
+ icSigAToB2Tag,
+ icSigBToA2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -4, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigBToA0Tag,
- icSigGamutTag,
- icSigAToB1Tag,
- icSigBToA1Tag,
- icSigAToB2Tag,
- icSigBToA2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigBToA0Tag,
+ icSigGamutTag,
+ icSigAToB1Tag,
+ icSigBToA1Tag,
+ icSigAToB2Tag,
+ icSigBToA2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigOutputClass, -100, icMaxEnumData, icSigPCSData, /* Assumed from Hexachrome examples */
- {icSigProfileDescriptionTag,
- icSigBToA0Tag,
- icSigBToA1Tag,
- icSigBToA2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigBToA0Tag,
+ icSigBToA1Tag,
+ icSigBToA2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigLinkClass, -100, icMaxEnumData, icMaxEnumData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigProfileSequenceDescTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigProfileSequenceDescTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigColorSpaceClass, -100, icMaxEnumData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigBToA0Tag,
- icSigAToB0Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigBToA0Tag,
+ icSigAToB0Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigAbstractClass, -100, icSigPCSData, icSigPCSData,
- {icSigProfileDescriptionTag,
- icSigAToB0Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigAToB0Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigNamedColorClass, -200, icMaxEnumData, icMaxEnumData,
- {icSigProfileDescriptionTag,
- icSigNamedColor2Tag,
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigNamedColor2Tag,
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
{icSigNamedColorClass, -100, icMaxEnumData, icMaxEnumData,
- {icSigProfileDescriptionTag,
- icSigNamedColorTag, /* Not strictly V3.4 */
- icSigMediaWhitePointTag,
- icSigCopyrightTag, icMaxEnumType}},
+ {icSigProfileDescriptionTag,
+ icSigNamedColorTag, /* Not strictly V3.4 */
+ icSigMediaWhitePointTag,
+ icSigCopyrightTag, icMaxEnumType}},
- {icMaxEnumType,-1,icMaxEnumData, icMaxEnumData, {icMaxEnumType}}
-};
+ {icMaxEnumType,-1,icMaxEnumData, icMaxEnumData, {icMaxEnumType}}
+};
/* ------------------------------------------------------------- */
/* Check that the ICC profile looks like it will be legal. */
/* Return non-zero and set error string if not */
static int check_icc_legal(
- icc *p
-) {
- int i, j;
- icProfileClassSignature sig;
- icColorSpaceSignature colsig;
- icColorSpaceSignature pcssig;
- int dchans;
-
- if (p->header == NULL) {
- sprintf(p->err,"icc_check_legal: Header is missing");
- return p->errc = 1;
- }
-
- sig = p->header->deviceClass;
- colsig = p->header->colorSpace;
- dchans = number_ColorSpaceSignature(colsig);
- pcssig = p->header->pcs;
-
- /* Find a matching table entry */
- for (i = 0; tagchecktable[i].sig != icMaxEnumType; i++) {
- if ( tagchecktable[i].sig == sig
- && ( tagchecktable[i].chans == dchans /* Exactly matches */
- || tagchecktable[i].chans == -dchans /* Exactly matches, but can try next table */
- || tagchecktable[i].chans < -99) /* Doesn't have to match or try next table */
- && ( tagchecktable[i].colsig == colsig
- || (tagchecktable[i].colsig == icSigPCSData
- && (colsig == icSigXYZData || colsig == icSigLabData))
- || tagchecktable[i].colsig == icMaxEnumData)
- && ( tagchecktable[i].pcssig == pcssig
- || (tagchecktable[i].pcssig == icSigPCSData
- && (pcssig == icSigXYZData || pcssig == icSigLabData))
- || tagchecktable[i].pcssig == icMaxEnumData)) {
-
- /* Found entry, so now check that all the required tags are present. */
- for (j = 0; tagchecktable[i].tags[j] != icMaxEnumType; j++) {
- if (p->find_tag(p, tagchecktable[i].tags[j]) != 0) { /* Not present! */
- if (tagchecktable[i].chans == -200
- || tagchecktable[i].chans == -dchans) { /* But can try next table */
- break;
- }
- sprintf(p->err,"icc_check_legal: deviceClass %s is missing required tag %s",
- tag2str(sig), tag2str(tagchecktable[i].tags[j]));
- return p->errc = 1;
- }
- }
- if (tagchecktable[i].tags[j] == icMaxEnumType) {
- break; /* Fount all required tags */
- }
- }
- }
-
- /* According to the spec. if the deviceClass is:
- an Abstract Class: both in and out color spaces should be PCS
- an Link Class: both in and out color spaces can be any, and should
- be the input space of the first profile in the link, and the
- input space of the last profile in the link respectively.
- a Named Class: in and out color spaces are not defined in the spec.
- Input, Display, Output and ColorSpace Classes, input color
- space can be any, and the output space must be PCS.
- ~~ should check this here ???
- */
-
- return 0; /* Assume anything is ok */
+ icc *p
+) {
+ int i, j;
+ icProfileClassSignature sig;
+ icColorSpaceSignature colsig;
+ icColorSpaceSignature pcssig;
+ int dchans;
+
+ if (p->header == NULL) {
+ sprintf(p->err,"icc_check_legal: Header is missing");
+ return p->errc = 1;
+ }
+
+ sig = p->header->deviceClass;
+ colsig = p->header->colorSpace;
+ dchans = number_ColorSpaceSignature(colsig);
+ pcssig = p->header->pcs;
+
+ /* Find a matching table entry */
+ for (i = 0; tagchecktable[i].sig != icMaxEnumType; i++) {
+ if ( tagchecktable[i].sig == sig
+ && ( tagchecktable[i].chans == dchans /* Exactly matches */
+ || tagchecktable[i].chans == -dchans /* Exactly matches, but can try next table */
+ || tagchecktable[i].chans < -99) /* Doesn't have to match or try next table */
+ && ( tagchecktable[i].colsig == colsig
+ || (tagchecktable[i].colsig == icSigPCSData
+ && (colsig == icSigXYZData || colsig == icSigLabData))
+ || tagchecktable[i].colsig == icMaxEnumData)
+ && ( tagchecktable[i].pcssig == pcssig
+ || (tagchecktable[i].pcssig == icSigPCSData
+ && (pcssig == icSigXYZData || pcssig == icSigLabData))
+ || tagchecktable[i].pcssig == icMaxEnumData)) {
+
+ /* Found entry, so now check that all the required tags are present. */
+ for (j = 0; tagchecktable[i].tags[j] != icMaxEnumType; j++) {
+ if (p->find_tag(p, tagchecktable[i].tags[j]) != 0) { /* Not present! */
+ if (tagchecktable[i].chans == -200
+ || tagchecktable[i].chans == -dchans) { /* But can try next table */
+ break;
+ }
+ sprintf(p->err,"icc_check_legal: deviceClass %s is missing required tag %s",
+ tag2str(sig), tag2str(tagchecktable[i].tags[j]));
+ return p->errc = 1;
+ }
+ }
+ if (tagchecktable[i].tags[j] == icMaxEnumType) {
+ break; /* Fount all required tags */
+ }
+ }
+ }
+
+ /* According to the spec. if the deviceClass is:
+ an Abstract Class: both in and out color spaces should be PCS
+ an Link Class: both in and out color spaces can be any, and should
+ be the input space of the first profile in the link, and the
+ input space of the last profile in the link respectively.
+ a Named Class: in and out color spaces are not defined in the spec.
+ Input, Display, Output and ColorSpace Classes, input color
+ space can be any, and the output space must be PCS.
+ ~~ should check this here ???
+ */
+
+ return 0; /* Assume anything is ok */
}
-
/* read the object, return 0 on success, error code on fail */
/* NOTE: this doesn't read the tag types, they should be read on demand. */
static int icc_read(
- icc *p,
- icmFile *fp, /* File to read from */
- unsigned long of /* File offset to read from */
-) {
- char tcbuf[4]; /* Tag count read buffer */
- int i;
- unsigned int len;
- int er = 0; /* Error code */
-
- p->fp = fp;
- p->of = of;
- if (p->header == NULL) {
- sprintf(p->err,"icc_read: No header defined");
- return p->errc = 1;
- }
-
- /* Read the header */
- if (p->header->read(p->header, 128, of)) {
- return 1;
- }
-
- /* Read the tag count */
- if ( p->fp->seek(p->fp, of + 128) != 0
- || p->fp->read(p->fp, tcbuf, 1, 4) != 4) {
- sprintf(p->err,"icc_read: fseek() or fread() failed on tag count");
- return p->errc = 1;
- }
-
- p->count = read_UInt32Number(tcbuf); /* Tag count */
- if (p->count > 100) {
- /* This is an arbitrary check designed to limit
- * resource use by corrupt profiles. A safer
- * check would be to compare against the maximum
- * number of tags which could fit in the declared
- * length. */
- sprintf(p->err,"icc_read: too many table tags");
- return p->errc = 1;
- }
- if (p->count > 0) {
- char *bp, *buf;
- if ((p->data = (icmTag *) p->al->calloc(p->al, p->count, sizeof(icmTag))) == NULL) {
- sprintf(p->err,"icc_read: Tag table calloc() failed");
- return p->errc = 2;
- }
-
- if (p->count > (UINT_MAX - 4) / 12) {
- sprintf(p->err,"icc_read: overflow");
- p->al->free(p->al, p->data);
- p->data = NULL;
- return p->errc = 1;
- }
- len = 4 + p->count * 12;
- if ((buf = (char *) p->al->malloc(p->al, len)) == NULL) {
- sprintf(p->err,"icc_read: Tag table read buffer malloc() failed");
- p->al->free(p->al, p->data);
- p->data = NULL;
- return p->errc = 2;
- }
- if ( p->fp->seek(p->fp, of + 128) != 0
- || p->fp->read(p->fp, buf, 1, len) != len) {
- sprintf(p->err,"icc_read: fseek() or fread() failed on tag table");
- p->al->free(p->al, p->data);
- p->data = NULL;
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
-
- /* Fill in the tag table structure */
- bp = buf+4;
- for (i = 0; i < p->count; i++, bp += 12) {
- p->data[i].sig = (icTagSignature)read_SInt32Number(bp + 0);
- p->data[i].offset = read_UInt32Number(bp + 4);
- if (p->data[i].offset < 128) { /* to catch 0 offset */
- sprintf(p->err, "icc_read: Impossible offset %u in tag %d", p->data[i].offset, i);
- p->al->free(p->al, p->data);
- p->data = NULL;
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
- p->data[i].size = read_UInt32Number(bp + 8);
- if (p->data[i].offset + p->data[i].size >
- p->header->size) {
- sprintf(p->err,"icc_read: tag out of bounds");
- p->al->free(p->al, p->data);
- p->data = NULL;
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
- if ( p->fp->seek(p->fp, of + p->data[i].offset) != 0
- || p->fp->read(p->fp, tcbuf, 1, 4) != 4) {
- sprintf(p->err,"icc_read: fseek() or fread() failed on tag headers");
- p->al->free(p->al, p->data);
- p->data = NULL;
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
- p->data[i].ttype = read_SInt32Number(tcbuf); /* Tag type */
- p->data[i].objp = NULL; /* Read on demand */
- }
- p->al->free(p->al, buf);
- } /* p->count > 0 */
-
- return er;
+ icc *p,
+ icmFile *fp, /* File to read from */
+ unsigned long of /* File offset to read from */
+) {
+ char tcbuf[4]; /* Tag count read buffer */
+ int i;
+ unsigned int len;
+ int er = 0; /* Error code */
+
+ p->fp = fp;
+ p->of = of;
+ if (p->header == NULL) {
+ sprintf(p->err,"icc_read: No header defined");
+ return p->errc = 1;
+ }
+
+ /* Read the header */
+ if (p->header->read(p->header, 128, of)) {
+ return 1;
+ }
+
+ /* Read the tag count */
+ if ( p->fp->seek(p->fp, of + 128) != 0
+ || p->fp->read(p->fp, tcbuf, 1, 4) != 4) {
+ sprintf(p->err,"icc_read: fseek() or fread() failed on tag count");
+ return p->errc = 1;
+ }
+
+ p->count = read_UInt32Number(tcbuf); /* Tag count */
+ if (p->count > 100) {
+ /* This is an arbitrary check designed to limit
+ * resource use by corrupt profiles. A safer
+ * check would be to compare against the maximum
+ * number of tags which could fit in the declared
+ * length. */
+ sprintf(p->err,"icc_read: too many table tags");
+ return p->errc = 1;
+ }
+ if (p->count > 0) {
+ char *bp, *buf;
+ if ((p->data = (icmTag *) p->al->calloc(p->al, p->count, sizeof(icmTag))) == NULL) {
+ sprintf(p->err,"icc_read: Tag table calloc() failed");
+ return p->errc = 2;
+ }
+
+ if (p->count > (UINT_MAX - 4) / 12) {
+ sprintf(p->err,"icc_read: overflow");
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ return p->errc = 1;
+ }
+ len = 4 + p->count * 12;
+ if ((buf = (char *) p->al->malloc(p->al, len)) == NULL) {
+ sprintf(p->err,"icc_read: Tag table read buffer malloc() failed");
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ return p->errc = 2;
+ }
+ if ( p->fp->seek(p->fp, of + 128) != 0
+ || p->fp->read(p->fp, buf, 1, len) != len) {
+ sprintf(p->err,"icc_read: fseek() or fread() failed on tag table");
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+
+ /* Fill in the tag table structure */
+ bp = buf+4;
+ for (i = 0; i < p->count; i++, bp += 12) {
+ p->data[i].sig = (icTagSignature)read_SInt32Number(bp + 0);
+ p->data[i].offset = read_UInt32Number(bp + 4);
+ if (p->data[i].offset < 128) { /* to catch 0 offset */
+ sprintf(p->err, "icc_read: Impossible offset %u in tag %d", p->data[i].offset, i);
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+ p->data[i].size = read_UInt32Number(bp + 8);
+ if (p->data[i].offset + p->data[i].size >
+ p->header->size) {
+ sprintf(p->err,"icc_read: tag out of bounds");
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+ if ( p->fp->seek(p->fp, of + p->data[i].offset) != 0
+ || p->fp->read(p->fp, tcbuf, 1, 4) != 4) {
+ sprintf(p->err,"icc_read: fseek() or fread() failed on tag headers");
+ p->al->free(p->al, p->data);
+ p->data = NULL;
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+ p->data[i].ttype = read_SInt32Number(tcbuf); /* Tag type */
+ p->data[i].objp = NULL; /* Read on demand */
+ }
+ p->al->free(p->al, buf);
+ } /* p->count > 0 */
+
+ return er;
}
#define DO_ALIGN(val) (((val) + 3) & ~3)
@@ -9597,202 +9585,202 @@ static int icc_read(
/* Return the total size needed for the profile */
/* Return 0 on error. */
static unsigned int icc_get_size(
- icc *p
-) {
- unsigned int size = 0;
- int i;
-
- /* Check that the right tags etc. are present for a legal ICC profile */
- if (check_icc_legal(p) != 0) {
- return 0;
- }
-
- /* Compute the total size and tag element data offsets */
- if (p->header == NULL) {
- sprintf(p->err,"icc_get_size: No header defined");
- p->errc = 1;
- return 0;
- }
-
- size += p->header->get_size(p->header);
- if (p->errc)
- return (unsigned int) -1;
-
- size = DO_ALIGN(size);
- if (size == 0 || p->count > (UINT_MAX - 4 - size) / 12) {
- p->errc = 1;
- return (unsigned int) -1;
- }
- size += 4 + p->count * 12; /* Tag table length */
-
- /* Reset touched flag for each tag type */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].objp == NULL) {
- sprintf(p->err,"icc_get_size: Internal error - NULL tag element");
- p->errc = 1;
- return 0;
- }
- p->data[i].objp->touched = 0;
- }
- /* Get size for each tag type, skipping links */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].objp->touched == 0) { /* Not alllowed for previously */
- unsigned int obj_size;
- size = DO_ALIGN(size);
- obj_size = p->data[i].objp->get_size(p->data[i].objp);
- if (size == 0 || p->errc ||
- obj_size > UINT_MAX - size)
- return (unsigned int) -1;
- size += obj_size;
- p->data[i].objp->touched = 1; /* Don't account for this again */
- }
- }
-
- return size; /* Total size needed */
+ icc *p
+) {
+ unsigned int size = 0;
+ int i;
+
+ /* Check that the right tags etc. are present for a legal ICC profile */
+ if (check_icc_legal(p) != 0) {
+ return 0;
+ }
+
+ /* Compute the total size and tag element data offsets */
+ if (p->header == NULL) {
+ sprintf(p->err,"icc_get_size: No header defined");
+ p->errc = 1;
+ return 0;
+ }
+
+ size += p->header->get_size(p->header);
+ if (p->errc)
+ return (unsigned int) -1;
+
+ size = DO_ALIGN(size);
+ if (size == 0 || p->count > (UINT_MAX - 4 - size) / 12) {
+ p->errc = 1;
+ return (unsigned int) -1;
+ }
+ size += 4 + p->count * 12; /* Tag table length */
+
+ /* Reset touched flag for each tag type */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].objp == NULL) {
+ sprintf(p->err,"icc_get_size: Internal error - NULL tag element");
+ p->errc = 1;
+ return 0;
+ }
+ p->data[i].objp->touched = 0;
+ }
+ /* Get size for each tag type, skipping links */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].objp->touched == 0) { /* Not alllowed for previously */
+ unsigned int obj_size;
+ size = DO_ALIGN(size);
+ obj_size = p->data[i].objp->get_size(p->data[i].objp);
+ if (size == 0 || p->errc ||
+ obj_size > UINT_MAX - size)
+ return (unsigned int) -1;
+ size += obj_size;
+ p->data[i].objp->touched = 1; /* Don't account for this again */
+ }
+ }
+
+ return size; /* Total size needed */
}
/* Write the contents of the object. Return 0 on sucess, error code on failure */
static int icc_write(
- icc *p,
- icmFile *fp, /* File to write to */
- unsigned long of /* File offset to write to */
-) {
- char *bp, *buf; /* Buffer to write to */
- unsigned int len = 0;
- int rv = 0;
- int i;
- unsigned int size = 0;
-
- /* Check that the right tags etc. are present for a legal ICC profile */
- if ((rv = check_icc_legal(p)) != 0) {
- return rv;
- }
-
- p->fp = fp; /* Open file pointer */
- p->of = of; /* Offset of ICC profile */
-
- /* Compute the total size and tag element data offsets */
- if (p->header == NULL) {
- sprintf(p->err,"icc_write: No header defined");
- return p->errc = 1;
- }
-
- size += p->header->get_size(p->header);
- if (p->errc)
- return p->errc;
-
- if (p->count > (UINT_MAX - 4 - len) / 12) {
- sprintf(p->err,"icc_write: too many tags");
- return p->errc = 1;
- }
- len = 4 + p->count * 12; /* Tag table length */
- size = DO_ALIGN(size);
- if (size == 0 || size > UINT_MAX - len) {
- sprintf(p->err,"icc_write: overflow writing tag table");
- return p->errc = 1;
- }
- size += len;
-
- /* Allocate memory buffer for tag table */
- if ((buf = (char *) p->al->malloc(p->al, len)) == NULL) {
- sprintf(p->err,"icc_write malloc() failed");
- return p->errc = 2;
- }
- bp = buf;
+ icc *p,
+ icmFile *fp, /* File to write to */
+ unsigned long of /* File offset to write to */
+) {
+ char *bp, *buf; /* Buffer to write to */
+ unsigned int len = 0;
+ int rv = 0;
+ int i;
+ unsigned int size = 0;
+
+ /* Check that the right tags etc. are present for a legal ICC profile */
+ if ((rv = check_icc_legal(p)) != 0) {
+ return rv;
+ }
+
+ p->fp = fp; /* Open file pointer */
+ p->of = of; /* Offset of ICC profile */
+
+ /* Compute the total size and tag element data offsets */
+ if (p->header == NULL) {
+ sprintf(p->err,"icc_write: No header defined");
+ return p->errc = 1;
+ }
+
+ size += p->header->get_size(p->header);
+ if (p->errc)
+ return p->errc;
+
+ if (p->count > (UINT_MAX - 4 - len) / 12) {
+ sprintf(p->err,"icc_write: too many tags");
+ return p->errc = 1;
+ }
+ len = 4 + p->count * 12; /* Tag table length */
+ size = DO_ALIGN(size);
+ if (size == 0 || size > UINT_MAX - len) {
+ sprintf(p->err,"icc_write: overflow writing tag table");
+ return p->errc = 1;
+ }
+ size += len;
+
+ /* Allocate memory buffer for tag table */
+ if ((buf = (char *) p->al->malloc(p->al, len)) == NULL) {
+ sprintf(p->err,"icc_write malloc() failed");
+ return p->errc = 2;
+ }
+ bp = buf;
if ((rv = write_UInt32Number(p->count, bp)) != 0) { /* Tag count */
- sprintf(p->err,"icc_write: write_UInt32Number() failed on tag count");
- p->al->free(p->al, buf);
- return p->errc = rv;
- }
- bp += 4;
- /* Reset touched flag for each tag type */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].objp == NULL) {
- sprintf(p->err,"icc_write: Internal error - NULL tag element");
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
- p->data[i].objp->touched = 0;
- }
- /* Set the offset and size for each tag type */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].objp->touched == 0) { /* Allocate space for tag type */
- size = DO_ALIGN(size);
- p->data[i].offset = size; /* Profile relative target */
- p->data[i].size = p->data[i].objp->get_size(p->data[i].objp);
- if (size == 0 ||
- p->errc || p->data[i].size > UINT_MAX - size) {
- sprintf(p->err,"icc_write: internal error - overflow?");
- p->al->free(p->al, buf);
- return p->errc;
- }
- size += p->data[i].size;
- p->data[i].objp->touched = 1; /* Allocated space for it */
- } else { /* must be linked - copy allocation */
- int k;
- for (k = 0; k < p->count; k++) { /* Find linked tag */
- if (p->data[k].objp == p->data[i].objp)
- break;
- }
- if (k == p->count) {
- sprintf(p->err,"icc_write: corrupted link");
- return p->errc = 2;
- }
- p->data[i].offset = p->data[k].offset;
- p->data[i].size = p->data[k].size;
- }
- /* Write tag table entry for this tag */
- if ((rv = write_SInt32Number((int)p->data[i].sig,bp + 0)) != 0) {
- sprintf(p->err,"icc_write: write_SInt32Number() failed on tag signature");
- p->al->free(p->al, buf);
- return p->errc = rv;
- }
- if ((rv = write_UInt32Number(p->data[i].offset, bp + 4)) != 0) {
- sprintf(p->err,"icc_write: write_UInt32Number() failed on tag offset");
- p->al->free(p->al, buf);
- return p->errc = rv;
- }
- if ((rv = write_UInt32Number(p->data[i].size, bp + 8)) != 0) {
- sprintf(p->err,"icc_write: write_UInt32Number() failed on tag size");
- p->al->free(p->al, buf);
- return p->errc = rv;
- }
- bp += 12;
- }
- p->header->size = size; /* Record total icc size */
-
- /* Write the header */
- if ((rv = p->header->write(p->header, of)) != 0) {
- p->al->free(p->al, buf);
- return rv;
- }
-
- /* Write the tag table */
- if ( p->fp->seek(p->fp, of + 128) != 0
- || p->fp->write(p->fp, buf, 1, len) != len) {
- sprintf(p->err,"icc_write: fseek() or fwrite() failed");
- p->al->free(p->al, buf);
- return p->errc = 1;
- }
- p->al->free(p->al, buf);
-
- /* Write all the tag element data */
- for (i = 0; i < p->count; i++) { /* For all the tag element data */
- if (p->data[i].objp->touched == 0)
- continue; /* Must be linked, and we've already written it */
- if ((rv = p->data[i].objp->write(p->data[i].objp, of + p->data[i].offset)) != 0) {
- return rv;
- }
- p->data[i].objp->touched = 0; /* Written it */
- }
-
- if (p->fp->flush(p->fp) != 0) {
- sprintf(p->err,"icc_write flush() failed");
- p->al->free(p->al, buf);
- return p->errc = 2;
- }
- return rv;
+ sprintf(p->err,"icc_write: write_UInt32Number() failed on tag count");
+ p->al->free(p->al, buf);
+ return p->errc = rv;
+ }
+ bp += 4;
+ /* Reset touched flag for each tag type */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].objp == NULL) {
+ sprintf(p->err,"icc_write: Internal error - NULL tag element");
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+ p->data[i].objp->touched = 0;
+ }
+ /* Set the offset and size for each tag type */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].objp->touched == 0) { /* Allocate space for tag type */
+ size = DO_ALIGN(size);
+ p->data[i].offset = size; /* Profile relative target */
+ p->data[i].size = p->data[i].objp->get_size(p->data[i].objp);
+ if (size == 0 ||
+ p->errc || p->data[i].size > UINT_MAX - size) {
+ sprintf(p->err,"icc_write: internal error - overflow?");
+ p->al->free(p->al, buf);
+ return p->errc;
+ }
+ size += p->data[i].size;
+ p->data[i].objp->touched = 1; /* Allocated space for it */
+ } else { /* must be linked - copy allocation */
+ int k;
+ for (k = 0; k < p->count; k++) { /* Find linked tag */
+ if (p->data[k].objp == p->data[i].objp)
+ break;
+ }
+ if (k == p->count) {
+ sprintf(p->err,"icc_write: corrupted link");
+ return p->errc = 2;
+ }
+ p->data[i].offset = p->data[k].offset;
+ p->data[i].size = p->data[k].size;
+ }
+ /* Write tag table entry for this tag */
+ if ((rv = write_SInt32Number((int)p->data[i].sig,bp + 0)) != 0) {
+ sprintf(p->err,"icc_write: write_SInt32Number() failed on tag signature");
+ p->al->free(p->al, buf);
+ return p->errc = rv;
+ }
+ if ((rv = write_UInt32Number(p->data[i].offset, bp + 4)) != 0) {
+ sprintf(p->err,"icc_write: write_UInt32Number() failed on tag offset");
+ p->al->free(p->al, buf);
+ return p->errc = rv;
+ }
+ if ((rv = write_UInt32Number(p->data[i].size, bp + 8)) != 0) {
+ sprintf(p->err,"icc_write: write_UInt32Number() failed on tag size");
+ p->al->free(p->al, buf);
+ return p->errc = rv;
+ }
+ bp += 12;
+ }
+ p->header->size = size; /* Record total icc size */
+
+ /* Write the header */
+ if ((rv = p->header->write(p->header, of)) != 0) {
+ p->al->free(p->al, buf);
+ return rv;
+ }
+
+ /* Write the tag table */
+ if ( p->fp->seek(p->fp, of + 128) != 0
+ || p->fp->write(p->fp, buf, 1, len) != len) {
+ sprintf(p->err,"icc_write: fseek() or fwrite() failed");
+ p->al->free(p->al, buf);
+ return p->errc = 1;
+ }
+ p->al->free(p->al, buf);
+
+ /* Write all the tag element data */
+ for (i = 0; i < p->count; i++) { /* For all the tag element data */
+ if (p->data[i].objp->touched == 0)
+ continue; /* Must be linked, and we've already written it */
+ if ((rv = p->data[i].objp->write(p->data[i].objp, of + p->data[i].offset)) != 0) {
+ return rv;
+ }
+ p->data[i].objp->touched = 0; /* Written it */
+ }
+
+ if (p->fp->flush(p->fp) != 0) {
+ sprintf(p->err,"icc_write flush() failed");
+ p->al->free(p->al, buf);
+ return p->errc = 2;
+ }
+ return rv;
}
#undef DO_ALIGN
@@ -9803,82 +9791,82 @@ static int icc_write(
/* 3 if unknown tag */
/* NOTE: that we prevent tag duplication */
static icmBase *icc_add_tag(
- icc *p,
+ icc *p,
icTagSignature sig, /* Tag signature - may be unknown */
- icTagTypeSignature ttype /* Tag type */
-) {
- icmBase *tp;
- icmBase *nob;
- int i, j, ok = 1;
-
- /* Check that a known signature has an acceptable type */
- for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
- if (sigtypetable[i].sig == sig) { /* recognized signature */
- ok = 0;
- for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
- if (sigtypetable[i].ttypes[j] == ttype) /* recognized type */
- ok = 1;
- }
- break;
- }
- }
- if (!ok) {
- sprintf(p->err,"icc_add_tag: wrong tag type for signature");
- p->errc = 1;
- return NULL;
- }
-
- /* Check that we know how to handle this type */
- for (i = 0; typetable[i].ttype != icMaxEnumType; i++) {
- if (typetable[i].ttype == ttype)
- break;
- }
- if (typetable[i].ttype == icMaxEnumType) {
- sprintf(p->err,"icc_add_tag: unsupported tag type");
- p->errc = 1;
- return NULL;
- }
-
- /* Check that this tag doesn't already exits */
- /* (Perhaps we should simply replace it, rather than erroring ?) */
- for (j = 0; j < p->count; j++) {
- if (p->data[j].sig == sig) {
- sprintf(p->err,"icc_add_tag: Already have tag '%s' in profile",tag2str(p->data[j].sig));
- p->errc = 1;
- return NULL;
- }
- }
-
- /* Make space in tag table for new tag item */
- if (p->count > (UINT_MAX / sizeof(icmTag)) - 1) {
- sprintf(p->err,"icc_add_tag: overflow");
- p->errc = 1;
- return NULL;
- }
- if (p->data == NULL)
- tp = p->al->malloc(p->al, (p->count+1) * sizeof(icmTag));
- else
- tp = p->al->realloc(p->al, (void *)p->data, (p->count+1) * sizeof(icmTag));
- if (tp == NULL) {
- sprintf(p->err,"icc_add_tag: Tag table realloc() failed");
- p->errc = 2;
- return NULL;
- }
- p->data = (icmTag *)tp;
-
- /* Allocate the empty object */
- if ((nob = typetable[i].new_obj(p)) == NULL)
- return NULL;
-
- /* Fill out our tag table entry */
+ icTagTypeSignature ttype /* Tag type */
+) {
+ icmBase *tp;
+ icmBase *nob;
+ int i, j, ok = 1;
+
+ /* Check that a known signature has an acceptable type */
+ for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
+ if (sigtypetable[i].sig == sig) { /* recognized signature */
+ ok = 0;
+ for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
+ if (sigtypetable[i].ttypes[j] == ttype) /* recognized type */
+ ok = 1;
+ }
+ break;
+ }
+ }
+ if (!ok) {
+ sprintf(p->err,"icc_add_tag: wrong tag type for signature");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Check that we know how to handle this type */
+ for (i = 0; typetable[i].ttype != icMaxEnumType; i++) {
+ if (typetable[i].ttype == ttype)
+ break;
+ }
+ if (typetable[i].ttype == icMaxEnumType) {
+ sprintf(p->err,"icc_add_tag: unsupported tag type");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Check that this tag doesn't already exits */
+ /* (Perhaps we should simply replace it, rather than erroring ?) */
+ for (j = 0; j < p->count; j++) {
+ if (p->data[j].sig == sig) {
+ sprintf(p->err,"icc_add_tag: Already have tag '%s' in profile",tag2str(p->data[j].sig));
+ p->errc = 1;
+ return NULL;
+ }
+ }
+
+ /* Make space in tag table for new tag item */
+ if (p->count > (UINT_MAX / sizeof(icmTag)) - 1) {
+ sprintf(p->err,"icc_add_tag: overflow");
+ p->errc = 1;
+ return NULL;
+ }
+ if (p->data == NULL)
+ tp = p->al->malloc(p->al, (p->count+1) * sizeof(icmTag));
+ else
+ tp = p->al->realloc(p->al, (void *)p->data, (p->count+1) * sizeof(icmTag));
+ if (tp == NULL) {
+ sprintf(p->err,"icc_add_tag: Tag table realloc() failed");
+ p->errc = 2;
+ return NULL;
+ }
+ p->data = (icmTag *)tp;
+
+ /* Allocate the empty object */
+ if ((nob = typetable[i].new_obj(p)) == NULL)
+ return NULL;
+
+ /* Fill out our tag table entry */
p->data[p->count].sig = sig; /* The tag signature */
- p->data[p->count].ttype = nob->ttype = ttype; /* The tag type signature */
+ p->data[p->count].ttype = nob->ttype = ttype; /* The tag type signature */
p->data[p->count].offset = 0; /* Unknown offset yet */
p->data[p->count].size = 0; /* Unknown size yet */
p->data[p->count].objp = nob; /* Empty object */
- p->count++;
+ p->count++;
- return nob;
+ return nob;
}
/* Create and add a tag which is a link to an existing tag. */
@@ -9887,83 +9875,83 @@ static icmBase *icc_add_tag(
/* 3 if incompatible tag */
/* NOTE: that we prevent tag duplication */
static icmBase *icc_link_tag(
- icc *p,
+ icc *p,
icTagSignature sig, /* Tag signature - may be unknown */
icTagSignature ex_sig /* Tag signature of tag to link to */
) {
- icmBase *tp;
- int i, j, exi, ok = 1;
+ icmBase *tp;
+ int i, j, exi, ok = 1;
- /* Search for existing signature */
- for (exi = 0; exi < p->count; exi++) {
- if (p->data[exi].sig == ex_sig) /* Found it */
- break;
- }
- if (exi == p->count) {
- sprintf(p->err,"icc_link_tag: Can't find existing tag '%s'",tag2str(ex_sig));
- p->errc = 1;
- return NULL;
- }
+ /* Search for existing signature */
+ for (exi = 0; exi < p->count; exi++) {
+ if (p->data[exi].sig == ex_sig) /* Found it */
+ break;
+ }
+ if (exi == p->count) {
+ sprintf(p->err,"icc_link_tag: Can't find existing tag '%s'",tag2str(ex_sig));
+ p->errc = 1;
+ return NULL;
+ }
if (p->data[exi].objp == NULL) {
- sprintf(p->err,"icc_link_tag: Existing tag '%s' isn't loaded",tag2str(ex_sig));
- p->errc = 1;
- return NULL;
- }
-
- /* Check that a known signature has an acceptable type */
- for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
- if (sigtypetable[i].sig == sig) { /* recognized signature */
- ok = 0;
- for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
- if (sigtypetable[i].ttypes[j] == p->data[exi].ttype) /* recognized type */
- ok = 1;
- }
- break;
- }
- }
- if (!ok) {
- sprintf(p->err,"icc_link_tag: wrong tag type for signature");
- p->errc = 1;
- return NULL;
- }
-
- /* Check that this tag doesn't already exits */
- for (j = 0; j < p->count; j++) {
- if (p->data[j].sig == sig) {
- sprintf(p->err,"icc_link_tag: Already have tag '%s' in profile",tag2str(p->data[j].sig));
- p->errc = 1;
- return NULL;
- }
- }
-
- /* Make space in tag table for new tag item */
- if (p->count > (UINT_MAX / sizeof(icmTag)) - 1) {
- sprintf(p->err,"icc_link_tag: overflow");
- p->errc = 1;
- return NULL;
- }
- if (p->data == NULL)
- tp = p->al->malloc(p->al, (p->count+1) * sizeof(icmTag));
- else
- tp = p->al->realloc(p->al, (void *)p->data, (p->count+1) * sizeof(icmTag));
- if (tp == NULL) {
- sprintf(p->err,"icc_link_tag: Tag table realloc() failed");
- p->errc = 2;
- return NULL;
- }
- p->data = (icmTag *)tp;
-
- /* Fill out our tag table entry */
+ sprintf(p->err,"icc_link_tag: Existing tag '%s' isn't loaded",tag2str(ex_sig));
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Check that a known signature has an acceptable type */
+ for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
+ if (sigtypetable[i].sig == sig) { /* recognized signature */
+ ok = 0;
+ for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
+ if (sigtypetable[i].ttypes[j] == p->data[exi].ttype) /* recognized type */
+ ok = 1;
+ }
+ break;
+ }
+ }
+ if (!ok) {
+ sprintf(p->err,"icc_link_tag: wrong tag type for signature");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Check that this tag doesn't already exits */
+ for (j = 0; j < p->count; j++) {
+ if (p->data[j].sig == sig) {
+ sprintf(p->err,"icc_link_tag: Already have tag '%s' in profile",tag2str(p->data[j].sig));
+ p->errc = 1;
+ return NULL;
+ }
+ }
+
+ /* Make space in tag table for new tag item */
+ if (p->count > (UINT_MAX / sizeof(icmTag)) - 1) {
+ sprintf(p->err,"icc_link_tag: overflow");
+ p->errc = 1;
+ return NULL;
+ }
+ if (p->data == NULL)
+ tp = p->al->malloc(p->al, (p->count+1) * sizeof(icmTag));
+ else
+ tp = p->al->realloc(p->al, (void *)p->data, (p->count+1) * sizeof(icmTag));
+ if (tp == NULL) {
+ sprintf(p->err,"icc_link_tag: Tag table realloc() failed");
+ p->errc = 2;
+ return NULL;
+ }
+ p->data = (icmTag *)tp;
+
+ /* Fill out our tag table entry */
p->data[p->count].sig = sig; /* The tag signature */
- p->data[p->count].ttype = p->data[exi].ttype; /* The tag type signature */
+ p->data[p->count].ttype = p->data[exi].ttype; /* The tag type signature */
p->data[p->count].offset = p->data[exi].offset; /* Same offset (may not be allocated yet) */
p->data[p->count].size = p->data[exi].size; /* Same size (may not be allocated yet) */
p->data[p->count].objp = p->data[exi].objp; /* Shared object */
- p->data[exi].objp->refcount++; /* Bump reference count on tag type */
- p->count++;
+ p->data[exi].objp->refcount++; /* Bump reference count on tag type */
+ p->count++;
- return p->data[exi].objp;
+ return p->data[exi].objp;
}
/* Search for tag signature */
@@ -9974,28 +9962,28 @@ static icmBase *icc_link_tag(
/* NOTE: doesn't set icc->errc or icc->err[] */
/* NOTE: we don't handle tag duplication - you'll always get the first in the file. */
static int icc_find_tag(
- icc *p,
+ icc *p,
icTagSignature sig /* Tag signature - may be unknown */
) {
- int i,j;
+ int i,j;
- /* Search for signature */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].sig == sig) /* Found it */
- break;
- }
- if (i == p->count)
- return 2;
+ /* Search for signature */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].sig == sig) /* Found it */
+ break;
+ }
+ if (i == p->count)
+ return 2;
- /* See if we can handle this type */
- for (j = 0; typetable[j].ttype != icMaxEnumType; j++) {
- if (typetable[j].ttype == p->data[i].ttype)
- break;
- }
- if (typetable[j].ttype == icMaxEnumType)
- return 1;
+ /* See if we can handle this type */
+ for (j = 0; typetable[j].ttype != icMaxEnumType; j++) {
+ if (typetable[j].ttype == p->data[i].ttype)
+ break;
+ }
+ if (typetable[j].ttype == icMaxEnumType)
+ return 1;
- return 0;
+ return 0;
}
/* Read the tag element data, and return a pointer to the object */
@@ -10006,106 +9994,106 @@ static int icc_find_tag(
**/
/* NOTE: we don't handle tag duplication - you'll always get the first in the file */
static icmBase *icc_read_tag(
- icc *p,
+ icc *p,
icTagSignature sig /* Tag signature - may be unknown */
) {
- icmBase *nob;
- int i,j,k;
-
- /* Search for signature */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].sig == sig) /* Found it */
- break;
- }
- if (i >= p->count) {
- sprintf(p->err,"icc_read_tag: Tag '%s' not found",string_TagSignature(sig));
- p->errc = 2;
- return NULL;
- }
-
- /* See if it's already been read */
+ icmBase *nob;
+ int i,j,k;
+
+ /* Search for signature */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].sig == sig) /* Found it */
+ break;
+ }
+ if (i >= p->count) {
+ sprintf(p->err,"icc_read_tag: Tag '%s' not found",string_TagSignature(sig));
+ p->errc = 2;
+ return NULL;
+ }
+
+ /* See if it's already been read */
if (p->data[i].objp != NULL) {
- return p->data[i].objp; /* Just return it */
- }
-
- /* See if this should be a link */
- for (k = 0; k < p->count; k++) {
- if (i == k)
- continue;
- if (p->data[i].ttype == p->data[k].ttype /* Exact match and already read */
- && p->data[i].offset == p->data[k].offset
- && p->data[i].size == p->data[k].size
- && p->data[k].objp != NULL)
- break;
- }
- if (k < p->count) { /* Make this a link */
- p->data[i].objp = p->data[k].objp;
- p->data[k].objp->refcount++; /* Bump reference count */
- return p->data[k].objp; /* Done */
- }
-
- /* See if we can handle this type */
- for (j = 0; typetable[j].ttype != icMaxEnumType; j++) {
- if (typetable[j].ttype == p->data[i].ttype)
- break;
- }
- if (typetable[j].ttype == icMaxEnumType) {
- sprintf(p->err,"icc_read_tag: Unhandled tag type '%s'",string_TypeSignature(p->data[i].ttype));
- p->errc = 1;
- return NULL;
- }
-
- /* Creat and read in the object */
- if ((nob = typetable[j].new_obj(p)) == NULL)
- return NULL;
- if ((nob->read(nob, p->data[i].size, p->of + p->data[i].offset)) != 0) {
- nob->del(nob); /* Failed, so destroy it */
- return NULL;
- }
+ return p->data[i].objp; /* Just return it */
+ }
+
+ /* See if this should be a link */
+ for (k = 0; k < p->count; k++) {
+ if (i == k)
+ continue;
+ if (p->data[i].ttype == p->data[k].ttype /* Exact match and already read */
+ && p->data[i].offset == p->data[k].offset
+ && p->data[i].size == p->data[k].size
+ && p->data[k].objp != NULL)
+ break;
+ }
+ if (k < p->count) { /* Make this a link */
+ p->data[i].objp = p->data[k].objp;
+ p->data[k].objp->refcount++; /* Bump reference count */
+ return p->data[k].objp; /* Done */
+ }
+
+ /* See if we can handle this type */
+ for (j = 0; typetable[j].ttype != icMaxEnumType; j++) {
+ if (typetable[j].ttype == p->data[i].ttype)
+ break;
+ }
+ if (typetable[j].ttype == icMaxEnumType) {
+ sprintf(p->err,"icc_read_tag: Unhandled tag type '%s'",string_TypeSignature(p->data[i].ttype));
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Creat and read in the object */
+ if ((nob = typetable[j].new_obj(p)) == NULL)
+ return NULL;
+ if ((nob->read(nob, p->data[i].size, p->of + p->data[i].offset)) != 0) {
+ nob->del(nob); /* Failed, so destroy it */
+ return NULL;
+ }
p->data[i].objp = nob;
- return nob;
+ return nob;
}
/* Rename a tag signature */
static int icc_rename_tag(
- icc *p,
+ icc *p,
icTagSignature sig, /* Existing Tag signature - may be unknown */
icTagSignature sigNew /* New Tag signature - may be unknown */
) {
- int i, j, k, ok = 1;
-
- /* Search for signature */
- for (k = 0; k < p->count; k++) {
- if (p->data[k].sig == sig) /* Found it */
- break;
- }
- if (k >= p->count) {
- sprintf(p->err,"icc_rename_tag: Tag '%s' not found",string_TagSignature(sig));
- return p->errc = 2;
- }
-
- /* Check that a known new signature has an acceptable type */
- for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
- if (sigtypetable[i].sig == sigNew) { /* recognized signature */
- ok = 0;
- for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
- if (sigtypetable[i].ttypes[j] == p->data[k].ttype) /* recognized type */
- ok = 1;
- }
- break;
- }
- }
-
- if (!ok) {
- sprintf(p->err,"icc_rename_tag: wrong signature for tag type");
- p->errc = 1;
- return p->errc;
- }
-
- /* change its signature */
- p->data[k].sig = sigNew;
-
- return 0;
+ int i, j, k, ok = 1;
+
+ /* Search for signature */
+ for (k = 0; k < p->count; k++) {
+ if (p->data[k].sig == sig) /* Found it */
+ break;
+ }
+ if (k >= p->count) {
+ sprintf(p->err,"icc_rename_tag: Tag '%s' not found",string_TagSignature(sig));
+ return p->errc = 2;
+ }
+
+ /* Check that a known new signature has an acceptable type */
+ for (i = 0; sigtypetable[i].sig != icMaxEnumType; i++) {
+ if (sigtypetable[i].sig == sigNew) { /* recognized signature */
+ ok = 0;
+ for (j = 0; sigtypetable[i].ttypes[j] != icMaxEnumType; j++) {
+ if (sigtypetable[i].ttypes[j] == p->data[k].ttype) /* recognized type */
+ ok = 1;
+ }
+ break;
+ }
+ }
+
+ if (!ok) {
+ sprintf(p->err,"icc_rename_tag: wrong signature for tag type");
+ p->errc = 1;
+ return p->errc;
+ }
+
+ /* change its signature */
+ p->data[k].sig = sigNew;
+
+ return 0;
}
/* Unread the tag, and free the underlying tag type */
@@ -10114,32 +10102,32 @@ static int icc_rename_tag(
/* tag not found - icc->errc will contain 2 */
/* tag not read - icc->errc will contain 2 */
static int icc_unread_tag(
- icc *p,
+ icc *p,
icTagSignature sig /* Tag signature - may be unknown */
) {
- int i;
+ int i;
- /* Search for signature */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].sig == sig) /* Found it */
- break;
- }
- if (i >= p->count) {
- sprintf(p->err,"icc_unread_tag: Tag '%s' not found",string_TagSignature(sig));
- return p->errc = 2;
- }
+ /* Search for signature */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].sig == sig) /* Found it */
+ break;
+ }
+ if (i >= p->count) {
+ sprintf(p->err,"icc_unread_tag: Tag '%s' not found",string_TagSignature(sig));
+ return p->errc = 2;
+ }
- /* See if it's been read */
+ /* See if it's been read */
if (p->data[i].objp == NULL) {
- sprintf(p->err,"icc_unread_tag: Tag '%s' not currently loaded",string_TagSignature(sig));
- return p->errc = 2;
- }
-
- if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
- (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
- p->data[i].objp = NULL;
+ sprintf(p->err,"icc_unread_tag: Tag '%s' not currently loaded",string_TagSignature(sig));
+ return p->errc = 2;
+ }
+
+ if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
+ (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
+ p->data[i].objp = NULL;
- return 0;
+ return 0;
}
/* Delete the tag, and free the underlying tag type */
@@ -10147,131 +10135,129 @@ static int icc_unread_tag(
/* Returns non-zero on error: */
/* tag not found - icc->errc will contain 2 */
static int icc_delete_tag(
- icc *p,
+ icc *p,
icTagSignature sig /* Tag signature - may be unknown */
) {
- int i;
+ int i;
- /* Search for signature */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].sig == sig) /* Found it */
- break;
- }
- if (i >= p->count) {
- sprintf(p->err,"icc_delete_tag: Tag '%s' not found",string_TagSignature(sig));
- return p->errc = 2;
- }
+ /* Search for signature */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].sig == sig) /* Found it */
+ break;
+ }
+ if (i >= p->count) {
+ sprintf(p->err,"icc_delete_tag: Tag '%s' not found",string_TagSignature(sig));
+ return p->errc = 2;
+ }
- /* If it's been read into memory, decrement the reference count */
+ /* If it's been read into memory, decrement the reference count */
if (p->data[i].objp != NULL) {
- if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
- (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
- p->data[i].objp = NULL;
- }
-
- /* Now remove it from the tag list */
- for (; i < (p->count-1); i++)
- p->data[i] = p->data[i+1]; /* Copy the structure down */
+ if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
+ (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
+ p->data[i].objp = NULL;
+ }
- p->count--; /* One less tag in list */
+ /* Now remove it from the tag list */
+ for (; i < (p->count-1); i++)
+ p->data[i] = p->data[i+1]; /* Copy the structure down */
- return 0;
-}
+ p->count--; /* One less tag in list */
+ return 0;
+}
/* Read all the tags into memory. */
/* Returns non-zero on error. */
static int icc_read_all_tags(
- icc *p
+ icc *p
) {
- int i;
+ int i;
- for (i = 0; i < p->count; i++) { /* For all the tag element data */
- icmBase *ob;
- if ((ob = p->read_tag(p, p->data[i].sig)) == NULL) {
- return p->errc;
- }
- }
- return 0;
+ for (i = 0; i < p->count; i++) { /* For all the tag element data */
+ icmBase *ob;
+ if ((ob = p->read_tag(p, p->data[i].sig)) == NULL) {
+ return p->errc;
+ }
+ }
+ return 0;
}
-
static void icc_dump(
- icc *p,
- FILE *op, /* Output to dump to */
- int verb /* Verbosity level */
-) {
- int i;
- if (verb <= 0)
- return;
-
- fprintf(op,"icc:\n");
-
- /* Dump the header */
- if (p->header != NULL)
- p->header->dump(p->header,op,verb);
-
- /* Dump all the tag elements */
- for (i = 0; i < p->count; i++) { /* For all the tag element data */
- icmBase *ob;
- int tr;
- fprintf(op,"tag %d:\n",i);
- fprintf(op," sig %s\n",tag2str(p->data[i].sig));
- fprintf(op," type %s\n",tag2str(p->data[i].ttype));
- fprintf(op," offset %d\n", p->data[i].offset);
- fprintf(op," size %d\n", p->data[i].size);
- tr = 0;
- if ((ob = p->data[i].objp) == NULL) {
- /* The object is not loaded, so load it then free it */
- if ((ob = p->read_tag(p, p->data[i].sig)) == NULL) {
- fprintf(op,"Unable to read: %d, %s\n",p->errc,p->err);
- }
- tr = 1;
- }
- if (ob != NULL) {
- /* fprintf(op," refcount %d\n", ob->refcount); */
- ob->dump(ob,op,verb-1);
-
- if (tr != 0) { /* Cleanup if temporary */
- ob->refcount--;
- (ob->del)(ob);
- p->data[i].objp = NULL;
- }
- }
- fprintf(op,"\n");
- }
+ icc *p,
+ FILE *op, /* Output to dump to */
+ int verb /* Verbosity level */
+) {
+ int i;
+ if (verb <= 0)
+ return;
+
+ fprintf(op,"icc:\n");
+
+ /* Dump the header */
+ if (p->header != NULL)
+ p->header->dump(p->header,op,verb);
+
+ /* Dump all the tag elements */
+ for (i = 0; i < p->count; i++) { /* For all the tag element data */
+ icmBase *ob;
+ int tr;
+ fprintf(op,"tag %d:\n",i);
+ fprintf(op," sig %s\n",tag2str(p->data[i].sig));
+ fprintf(op," type %s\n",tag2str(p->data[i].ttype));
+ fprintf(op," offset %d\n", p->data[i].offset);
+ fprintf(op," size %d\n", p->data[i].size);
+ tr = 0;
+ if ((ob = p->data[i].objp) == NULL) {
+ /* The object is not loaded, so load it then free it */
+ if ((ob = p->read_tag(p, p->data[i].sig)) == NULL) {
+ fprintf(op,"Unable to read: %d, %s\n",p->errc,p->err);
+ }
+ tr = 1;
+ }
+ if (ob != NULL) {
+ /* fprintf(op," refcount %d\n", ob->refcount); */
+ ob->dump(ob,op,verb-1);
+
+ if (tr != 0) { /* Cleanup if temporary */
+ ob->refcount--;
+ (ob->del)(ob);
+ p->data[i].objp = NULL;
+ }
+ }
+ fprintf(op,"\n");
+ }
}
static void icc_delete(
- icc *p
+ icc *p
) {
- int i;
- icmAlloc *al = p->al;
- int del_al = p->del_al;
+ int i;
+ icmAlloc *al = p->al;
+ int del_al = p->del_al;
- /* Free up the header */
- if (p->header != NULL)
- (p->header->del)(p->header);
+ /* Free up the header */
+ if (p->header != NULL)
+ (p->header->del)(p->header);
- if (p->data != NULL) {
- /* Free up the tag data objects */
- for (i = 0; i < p->count; i++) {
- if (p->data[i].objp != NULL) {
- if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
- (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
- p->data[i].objp = NULL;
- }
- }
+ if (p->data != NULL) {
+ /* Free up the tag data objects */
+ for (i = 0; i < p->count; i++) {
+ if (p->data[i].objp != NULL) {
+ if (--(p->data[i].objp->refcount) == 0) /* decrement reference count */
+ (p->data[i].objp->del)(p->data[i].objp); /* Last reference */
+ p->data[i].objp = NULL;
+ }
+ }
- /* Free tag table */
- al->free(al, p->data);
- }
+ /* Free tag table */
+ al->free(al, p->data);
+ }
- /* This object */
- al->free(al, p);
+ /* This object */
+ al->free(al, p);
- if (del_al) /* We are responsible for deleting allocator */
- al->del(al);
+ if (del_al) /* We are responsible for deleting allocator */
+ al->del(al);
}
/* ================================================== */
@@ -10295,7 +10281,7 @@ static void icc_delete(
/* as processing the output luts values into normalized form ready */
/* for writing. */
-/* These functions should be accessed by calling icc.getNormFuncs() */
+/* These functions should be accessed by calling icc.getNormFuncs() */
/* - - - - - - - - - - - - - - - - */
/* According to 6.5.5 and 6.5.6 of the spec., */
@@ -10303,18 +10289,18 @@ static void icc_delete(
/* values, ie. as a u1.15 representation, with a value */
/* range from 0.0 -> 1.999969482422 */
-/* Convert Lut index/value to XYZ coord. */
+/* Convert Lut index/value to XYZ coord. */
static void Lut_Lut2XYZ(double *out, double *in) {
- out[0] = in[0] * (1.0 + 32767.0/32768); /* X */
- out[1] = in[1] * (1.0 + 32767.0/32768); /* Y */
- out[2] = in[2] * (1.0 + 32767.0/32768); /* Z */
+ out[0] = in[0] * (1.0 + 32767.0/32768); /* X */
+ out[1] = in[1] * (1.0 + 32767.0/32768); /* Y */
+ out[2] = in[2] * (1.0 + 32767.0/32768); /* Z */
}
-/* Convert XYZ coord to Lut index/value. */
+/* Convert XYZ coord to Lut index/value. */
static void Lut_XYZ2Lut(double *out, double *in) {
- out[0] = in[0] * (1.0/(1.0 + 32767.0/32768));
- out[1] = in[1] * (1.0/(1.0 + 32767.0/32768));
- out[2] = in[2] * (1.0/(1.0 + 32767.0/32768));
+ out[0] = in[0] * (1.0/(1.0 + 32767.0/32768));
+ out[1] = in[1] * (1.0/(1.0 + 32767.0/32768));
+ out[2] = in[2] * (1.0/(1.0 + 32767.0/32768));
}
/* - - - - - - - - - - - - - - - - */
@@ -10327,30 +10313,30 @@ static void Lut_XYZ2Lut(double *out, double *in) {
/* Convert Lut16 table index/value to Lab */
static void Lut_Lut2Lab16(double *out, double *in) {
- out[0] = in[0] * (100.0 * 65535.0)/65280.0; /* L */
- out[1] = (in[1] * (255.0 * 65535.0)/65280) - 128.0; /* a */
- out[2] = (in[2] * (255.0 * 65535.0)/65280) - 128.0; /* b */
+ out[0] = in[0] * (100.0 * 65535.0)/65280.0; /* L */
+ out[1] = (in[1] * (255.0 * 65535.0)/65280) - 128.0; /* a */
+ out[2] = (in[2] * (255.0 * 65535.0)/65280) - 128.0; /* b */
}
/* Convert Lab to Lut16 table index/value */
static void Lut_Lab2Lut16(double *out, double *in) {
- out[0] = in[0] * 65280.0/(100.0 * 65535.0); /* L */
- out[1] = (in[1] + 128.0) * 65280.0/(255.0 * 65535.0); /* a */
- out[2] = (in[2] + 128.0) * 65280.0/(255.0 * 65535.0); /* b */
+ out[0] = in[0] * 65280.0/(100.0 * 65535.0); /* L */
+ out[1] = (in[1] + 128.0) * 65280.0/(255.0 * 65535.0); /* a */
+ out[2] = (in[2] + 128.0) * 65280.0/(255.0 * 65535.0); /* b */
}
/* Convert Lut8 table index/value to Lab */
static void Lut_Lut2Lab8(double *out, double *in) {
- out[0] = in[0] * 100.0; /* L */
- out[1] = (in[1] * 255.0) - 128.0; /* a */
- out[2] = (in[2] * 255.0) - 128.0; /* b */
+ out[0] = in[0] * 100.0; /* L */
+ out[1] = (in[1] * 255.0) - 128.0; /* a */
+ out[2] = (in[2] * 255.0) - 128.0; /* b */
}
/* Convert Lab to Lut8 table index/value */
static void Lut_Lab2Lut8(double *out, double *in) {
- out[0] = in[0] * 1.0/100.0; /* L */
- out[1] = (in[1] + 128.0) * 1.0/255.0; /* a */
- out[2] = (in[2] + 128.0) * 1.0/255.0; /* b */
+ out[0] = in[0] * 1.0/100.0; /* L */
+ out[1] = (in[1] + 128.0) * 1.0/255.0; /* a */
+ out[2] = (in[2] + 128.0) * 1.0/255.0; /* b */
}
/* - - - - - - - - - - - - - - - - */
@@ -10362,200 +10348,200 @@ static void Lut_Lab2Lut8(double *out, double *in) {
/* Convert Lut table index/value to Luv */
static void Lut_Lut2Luv(double *out, double *in) {
- out[0] = in[0] * 100.0; /* L */
- out[1] = (in[1] * 65535.0/256.0) - 128.0; /* u */
- out[2] = (in[2] * 65535.0/256.0) - 128.0; /* v */
+ out[0] = in[0] * 100.0; /* L */
+ out[1] = (in[1] * 65535.0/256.0) - 128.0; /* u */
+ out[2] = (in[2] * 65535.0/256.0) - 128.0; /* v */
}
/* Convert Luv to Lut table index/value */
static void Lut_Luv2Lut(double *out, double *in) {
- out[0] = in[0] * 1.0/100.0; /* L */
- out[1] = (in[1] + 128.0) * 256.0/65535.0; /* u */
- out[2] = (in[2] + 128.0) * 256.0/65535.0; /* v */
+ out[0] = in[0] * 1.0/100.0; /* L */
+ out[1] = (in[1] + 128.0) * 256.0/65535.0; /* u */
+ out[2] = (in[2] + 128.0) * 256.0/65535.0; /* v */
}
/* - - - - - - - - - - - - - - - - */
/* Default N component conversions */
static void Lut_N(double *out, double *in, int nc) {
- for (--nc; nc >= 0; nc--)
- out[nc] = in[nc];
+ for (--nc; nc >= 0; nc--)
+ out[nc] = in[nc];
}
/* 1 */
static void Lut_1(double *out, double *in) {
- out[0] = in[0];
+ out[0] = in[0];
}
/* 2 */
static void Lut_2(double *out, double *in) {
- out[0] = in[0];
- out[1] = in[1];
+ out[0] = in[0];
+ out[1] = in[1];
}
/* 3 */
static void Lut_3(double *out, double *in) {
- out[0] = in[0];
- out[1] = in[1];
- out[2] = in[2];
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
}
/* 4 */
static void Lut_4(double *out, double *in) {
- out[0] = in[0];
- out[1] = in[1];
- out[2] = in[2];
- out[3] = in[3];
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
}
/* 5 */
static void Lut_5(double *out, double *in) {
- out[0] = in[0];
- out[1] = in[1];
- out[2] = in[2];
- out[3] = in[3];
- out[4] = in[4];
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out[4] = in[4];
}
/* 6 */
static void Lut_6(double *out, double *in) {
- out[0] = in[0];
- out[1] = in[1];
- out[2] = in[2];
- out[3] = in[3];
- out[4] = in[4];
- out[5] = in[5];
+ out[0] = in[0];
+ out[1] = in[1];
+ out[2] = in[2];
+ out[3] = in[3];
+ out[4] = in[4];
+ out[5] = in[5];
}
/* 7 */
static void Lut_7(double *out, double *in) {
- Lut_N(out, in, 7);
+ Lut_N(out, in, 7);
}
/* 8 */
static void Lut_8(double *out, double *in) {
- Lut_N(out, in, 8);
+ Lut_N(out, in, 8);
}
/* 9 */
static void Lut_9(double *out, double *in) {
- Lut_N(out, in, 9);
+ Lut_N(out, in, 9);
}
/* 10 */
static void Lut_10(double *out, double *in) {
- Lut_N(out, in, 10);
+ Lut_N(out, in, 10);
}
/* 11 */
static void Lut_11(double *out, double *in) {
- Lut_N(out, in, 11);
+ Lut_N(out, in, 11);
}
/* 12 */
static void Lut_12(double *out, double *in) {
- Lut_N(out, in, 12);
+ Lut_N(out, in, 12);
}
/* 13 */
static void Lut_13(double *out, double *in) {
- Lut_N(out, in, 13);
+ Lut_N(out, in, 13);
}
/* 14 */
static void Lut_14(double *out, double *in) {
- Lut_N(out, in, 14);
+ Lut_N(out, in, 14);
}
/* 15 */
static void Lut_15(double *out, double *in) {
- Lut_N(out, in, 15);
+ Lut_N(out, in, 15);
}
/* Function table - match conversions to color spaces. */
/* Anything not here, we don't know how to convert. */
/* (ie. YCbCr) */
static struct {
- icColorSpaceSignature csig;
- void (*fromLut8)(double *out, double *in); /* 8 bit from Lut index/entry */
- void (*fromLut16)(double *out, double *in); /* 16 bit from Lut index/entry */
- void (*toLut8)(double *out, double *in); /* 8 bit to Lut index/entry */
- void (*toLut16)(double *out, double *in); /* 16 bit to Lut index/entry */
+ icColorSpaceSignature csig;
+ void (*fromLut8)(double *out, double *in); /* 8 bit from Lut index/entry */
+ void (*fromLut16)(double *out, double *in); /* 16 bit from Lut index/entry */
+ void (*toLut8)(double *out, double *in); /* 8 bit to Lut index/entry */
+ void (*toLut16)(double *out, double *in); /* 16 bit to Lut index/entry */
} colnormtable[] = {
- {icSigXYZData, NULL, Lut_Lut2XYZ, NULL, Lut_XYZ2Lut },
- {icSigLabData, Lut_Lut2Lab8, Lut_Lut2Lab16, Lut_Lab2Lut8, Lut_Lab2Lut16 },
- {icSigLuvData, Lut_Lut2Luv, Lut_Lut2Luv, Lut_Luv2Lut, Lut_Luv2Lut },
- {icSigYxyData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSigRgbData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSigGrayData, Lut_1, Lut_1, Lut_1, Lut_1 },
- {icSigHsvData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSigHlsData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSigCmykData, Lut_4, Lut_4, Lut_4, Lut_4 },
- {icSigCmyData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSigMch6Data, Lut_6, Lut_6, Lut_6, Lut_6 },
- {icSig2colorData, Lut_2, Lut_2, Lut_2, Lut_2 },
- {icSig3colorData, Lut_3, Lut_3, Lut_3, Lut_3 },
- {icSig4colorData, Lut_4, Lut_4, Lut_4, Lut_4 },
- {icSig5colorData, Lut_5, Lut_5, Lut_5, Lut_5 },
- {icSig6colorData, Lut_6, Lut_6, Lut_6, Lut_6 },
- {icSig7colorData, Lut_7, Lut_7, Lut_7, Lut_7 },
- {icSig8colorData, Lut_8, Lut_8, Lut_8, Lut_8 },
- {icSig9colorData, Lut_9, Lut_9, Lut_9, Lut_9 },
- {icSig10colorData, Lut_10, Lut_10, Lut_10, Lut_10 },
- {icSig11colorData, Lut_11, Lut_11, Lut_11, Lut_11 },
- {icSig12colorData, Lut_12, Lut_12, Lut_12, Lut_12 },
- {icSig13colorData, Lut_13, Lut_13, Lut_13, Lut_13 },
- {icSig14colorData, Lut_14, Lut_14, Lut_14, Lut_14 },
- {icSig15colorData, Lut_15, Lut_15, Lut_15, Lut_15 },
- {icMaxEnumData, NULL, NULL, NULL, NULL }
+ {icSigXYZData, NULL, Lut_Lut2XYZ, NULL, Lut_XYZ2Lut },
+ {icSigLabData, Lut_Lut2Lab8, Lut_Lut2Lab16, Lut_Lab2Lut8, Lut_Lab2Lut16 },
+ {icSigLuvData, Lut_Lut2Luv, Lut_Lut2Luv, Lut_Luv2Lut, Lut_Luv2Lut },
+ {icSigYxyData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSigRgbData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSigGrayData, Lut_1, Lut_1, Lut_1, Lut_1 },
+ {icSigHsvData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSigHlsData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSigCmykData, Lut_4, Lut_4, Lut_4, Lut_4 },
+ {icSigCmyData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSigMch6Data, Lut_6, Lut_6, Lut_6, Lut_6 },
+ {icSig2colorData, Lut_2, Lut_2, Lut_2, Lut_2 },
+ {icSig3colorData, Lut_3, Lut_3, Lut_3, Lut_3 },
+ {icSig4colorData, Lut_4, Lut_4, Lut_4, Lut_4 },
+ {icSig5colorData, Lut_5, Lut_5, Lut_5, Lut_5 },
+ {icSig6colorData, Lut_6, Lut_6, Lut_6, Lut_6 },
+ {icSig7colorData, Lut_7, Lut_7, Lut_7, Lut_7 },
+ {icSig8colorData, Lut_8, Lut_8, Lut_8, Lut_8 },
+ {icSig9colorData, Lut_9, Lut_9, Lut_9, Lut_9 },
+ {icSig10colorData, Lut_10, Lut_10, Lut_10, Lut_10 },
+ {icSig11colorData, Lut_11, Lut_11, Lut_11, Lut_11 },
+ {icSig12colorData, Lut_12, Lut_12, Lut_12, Lut_12 },
+ {icSig13colorData, Lut_13, Lut_13, Lut_13, Lut_13 },
+ {icSig14colorData, Lut_14, Lut_14, Lut_14, Lut_14 },
+ {icSig15colorData, Lut_15, Lut_15, Lut_15, Lut_15 },
+ {icMaxEnumData, NULL, NULL, NULL, NULL }
};
-
+
/* Find appropriate conversion functions */
/* given the color space and Lut type */
/* Return 0 on success, 1 on match failure */
/* NOTE: doesn't set error value, message etc.! */
static int getNormFunc(
- icColorSpaceSignature csig,
- icTagTypeSignature tagSig,
- icmNormFlag flag,
- void (**nfunc)(double *out, double *in)
-) {
- int i;
- for (i = 0; colnormtable[i].csig != icMaxEnumData; i++) {
- if (colnormtable[i].csig == csig)
- break; /* Found it */
- }
- if (colnormtable[i].csig == icMaxEnumData) { /* Oops */
- *nfunc = NULL;
- return 1;
- }
-
- if (flag == icmFromLuti || flag == icmFromLutv) { /* Table index/value decoding functions */
- if (tagSig == icSigLut8Type) {
- *nfunc = colnormtable[i].fromLut8;
- return 0;
- } else if (tagSig == icSigLut16Type) {
- *nfunc = colnormtable[i].fromLut16;
- return 0;
- } else {
- *nfunc = NULL;
- return 1;
- }
- } else if (flag == icmToLuti || flag == icmToLutv) { /* Table index/value encoding functions */
- if (tagSig == icSigLut8Type) {
- *nfunc = colnormtable[i].toLut8;
- return 0;
- } else if (tagSig == icSigLut16Type) {
- *nfunc = colnormtable[i].toLut16;
- return 0;
- } else {
- *nfunc = NULL;
- return 1;
- }
- } else {
- *nfunc = NULL;
- return 1;
- }
- return 0;
+ icColorSpaceSignature csig,
+ icTagTypeSignature tagSig,
+ icmNormFlag flag,
+ void (**nfunc)(double *out, double *in)
+) {
+ int i;
+ for (i = 0; colnormtable[i].csig != icMaxEnumData; i++) {
+ if (colnormtable[i].csig == csig)
+ break; /* Found it */
+ }
+ if (colnormtable[i].csig == icMaxEnumData) { /* Oops */
+ *nfunc = NULL;
+ return 1;
+ }
+
+ if (flag == icmFromLuti || flag == icmFromLutv) { /* Table index/value decoding functions */
+ if (tagSig == icSigLut8Type) {
+ *nfunc = colnormtable[i].fromLut8;
+ return 0;
+ } else if (tagSig == icSigLut16Type) {
+ *nfunc = colnormtable[i].fromLut16;
+ return 0;
+ } else {
+ *nfunc = NULL;
+ return 1;
+ }
+ } else if (flag == icmToLuti || flag == icmToLutv) { /* Table index/value encoding functions */
+ if (tagSig == icSigLut8Type) {
+ *nfunc = colnormtable[i].toLut8;
+ return 0;
+ } else if (tagSig == icSigLut16Type) {
+ *nfunc = colnormtable[i].toLut16;
+ return 0;
+ } else {
+ *nfunc = NULL;
+ return 1;
+ }
+ } else {
+ *nfunc = NULL;
+ return 1;
+ }
+ return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -10565,87 +10551,87 @@ static int getNormFunc(
/* Anything not here, we don't know how to convert. */
/* (ie. YCbCr) */
static struct {
- icColorSpaceSignature csig;
- int same; /* Non zero if first entry applies to all channels */
- double min[15]; /* Minimum value for this colorspace */
- double max[15]; /* Maximum value for this colorspace */
+ icColorSpaceSignature csig;
+ int same; /* Non zero if first entry applies to all channels */
+ double min[15]; /* Minimum value for this colorspace */
+ double max[15]; /* Maximum value for this colorspace */
} colorrangetable[] = {
- {icSigXYZData, 1, { 0.0 } , { 1.0 + 32767.0/32768.0 } },
- {icSigLabData, 0, { 0.0, -128.0, -128.0 },
- { 100.0 + 25500.0/65280.0, 127.0 + 255.0/256.0, 127.0 + 255.0/256.0 } },
- {icSigLuvData, 0, { 0.0, -128.0, -128.0 },
- { 100.0, 127.0 + 255.0/256.0, 127.0 + 255.0/256.0 } },
- {icSigYxyData, 1, { 0.0 }, { 1.0 } },
- {icSigRgbData, 1, { 0.0 }, { 1.0 } },
- {icSigGrayData, 1, { 0.0 }, { 1.0 } },
- {icSigHsvData, 1, { 0.0 }, { 1.0 } },
- {icSigHlsData, 1, { 0.0 }, { 1.0 } },
- {icSigCmykData, 1, { 0.0 }, { 1.0 } },
- {icSigCmyData, 1, { 0.0 }, { 1.0 } },
- {icSigMch6Data, 1, { 0.0 }, { 1.0 } },
- {icSig2colorData, 1, { 0.0 }, { 1.0 } },
- {icSig3colorData, 1, { 0.0 }, { 1.0 } },
- {icSig4colorData, 1, { 0.0 }, { 1.0 } },
- {icSig5colorData, 1, { 0.0 }, { 1.0 } },
- {icSig6colorData, 1, { 0.0 }, { 1.0 } },
- {icSig7colorData, 1, { 0.0 }, { 1.0 } },
- {icSig8colorData, 1, { 0.0 }, { 1.0 } },
- {icSig9colorData, 1, { 0.0 }, { 1.0 } },
- {icSig10colorData, 1, { 0.0 }, { 1.0 } },
- {icSig11colorData, 1, { 0.0 }, { 1.0 } },
- {icSig12colorData, 1, { 0.0 }, { 1.0 } },
- {icSig13colorData, 1, { 0.0 }, { 1.0 } },
- {icSig14colorData, 1, { 0.0 }, { 1.0 } },
- {icSig15colorData, 1, { 0.0 }, { 1.0 } },
- {icMaxEnumData }
+ {icSigXYZData, 1, { 0.0 } , { 1.0 + 32767.0/32768.0 } },
+ {icSigLabData, 0, { 0.0, -128.0, -128.0 },
+ { 100.0 + 25500.0/65280.0, 127.0 + 255.0/256.0, 127.0 + 255.0/256.0 } },
+ {icSigLuvData, 0, { 0.0, -128.0, -128.0 },
+ { 100.0, 127.0 + 255.0/256.0, 127.0 + 255.0/256.0 } },
+ {icSigYxyData, 1, { 0.0 }, { 1.0 } },
+ {icSigRgbData, 1, { 0.0 }, { 1.0 } },
+ {icSigGrayData, 1, { 0.0 }, { 1.0 } },
+ {icSigHsvData, 1, { 0.0 }, { 1.0 } },
+ {icSigHlsData, 1, { 0.0 }, { 1.0 } },
+ {icSigCmykData, 1, { 0.0 }, { 1.0 } },
+ {icSigCmyData, 1, { 0.0 }, { 1.0 } },
+ {icSigMch6Data, 1, { 0.0 }, { 1.0 } },
+ {icSig2colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig3colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig4colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig5colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig6colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig7colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig8colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig9colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig10colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig11colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig12colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig13colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig14colorData, 1, { 0.0 }, { 1.0 } },
+ {icSig15colorData, 1, { 0.0 }, { 1.0 } },
+ {icMaxEnumData }
};
-
+
/* Find appropriate typical encoding ranges for a */
/* colorspace given the color space. */
/* Return 0 on success, 1 on match failure */
static int getRange(
- icColorSpaceSignature csig,
- double *min, double *max
-) {
- int i, e, ee;
- for (i = 0; colorrangetable[i].csig != icMaxEnumData; i++) {
- if (colorrangetable[i].csig == csig)
- break; /* Found it */
- }
- if (colorrangetable[i].csig == icMaxEnumData) { /* Oops */
- return 1;
- }
- ee = number_ColorSpaceSignature(csig); /* Get number of components */
-
- if (colorrangetable[i].same) { /* All channels are the same */
- for (e = 0; e < ee; e++) {
- if (min != NULL)
- min[e] = colorrangetable[i].min[0];
- if (max != NULL)
- max[e] = colorrangetable[i].max[0];
- }
- } else {
- for (e = 0; e < ee; e++) {
- if (min != NULL)
- min[e] = colorrangetable[i].min[e];
- if (max != NULL)
- max[e] = colorrangetable[i].max[e];
- }
- }
- return 0;
+ icColorSpaceSignature csig,
+ double *min, double *max
+) {
+ int i, e, ee;
+ for (i = 0; colorrangetable[i].csig != icMaxEnumData; i++) {
+ if (colorrangetable[i].csig == csig)
+ break; /* Found it */
+ }
+ if (colorrangetable[i].csig == icMaxEnumData) { /* Oops */
+ return 1;
+ }
+ ee = number_ColorSpaceSignature(csig); /* Get number of components */
+
+ if (colorrangetable[i].same) { /* All channels are the same */
+ for (e = 0; e < ee; e++) {
+ if (min != NULL)
+ min[e] = colorrangetable[i].min[0];
+ if (max != NULL)
+ max[e] = colorrangetable[i].max[0];
+ }
+ } else {
+ for (e = 0; e < ee; e++) {
+ if (min != NULL)
+ min[e] = colorrangetable[i].min[e];
+ if (max != NULL)
+ max[e] = colorrangetable[i].max[e];
+ }
+ }
+ return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
-/*
- Matrix Inversion
- by Richard Carling
- from "Graphics Gems", Academic Press, 1990
+/*
+ Matrix Inversion
+ by Richard Carling
+ from "Graphics Gems", Academic Press, 1990
*/
-/*
+/*
* adjoint( original_matrix, inverse_matrix )
- *
+ *
* calculate the adjoint of a 3x3 matrix
*
* Let a denote the minor determinant of matrix A obtained by
@@ -10672,20 +10658,20 @@ double in[3][3]
/* assign to individual variable names to aid */
/* selecting correct values */
- a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
- a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
- a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];
+ a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
+ a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
+ a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];
/* row column labeling reversed since we transpose rows & columns */
out[0][0] = det2x2(b2, b3, c2, c3);
out[1][0] = - det2x2(a2, a3, c2, c3);
out[2][0] = det2x2(a2, a3, b2, b3);
-
+
out[0][1] = - det2x2(b1, b3, c1, c3);
out[1][1] = det2x2(a1, a3, c1, c3);
out[2][1] = - det2x2(a1, a3, b1, b3);
-
+
out[0][2] = det2x2(b1, b2, c1, c2);
out[1][2] = - det2x2(a1, a2, c1, c2);
out[2][2] = det2x2(a1, a2, b1, b2);
@@ -10693,7 +10679,7 @@ double in[3][3]
/*
* double = det3x3( a1, a2, a3, b1, b2, b3, c1, c2, c3 )
- *
+ *
* calculate the determinant of a 3x3 matrix
* in the form
*
@@ -10706,9 +10692,9 @@ static double det3x3(double in[3][3]) {
double a1, a2, a3, b1, b2, b3, c1, c2, c3;
double ans;
- a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
- a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
- a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];
+ a1 = in[0][0]; b1 = in[0][1]; c1 = in[0][2];
+ a2 = in[1][0]; b2 = in[1][1]; c2 = in[1][2];
+ a3 = in[2][0]; b3 = in[2][1]; c3 = in[2][2];
ans = a1 * det2x2(b2, b3, c2, c3)
- b1 * det2x2(a2, a3, c2, c3)
@@ -10717,12 +10703,12 @@ static double det3x3(double in[3][3]) {
}
#define SMALL_NUMBER 1.e-8
-/*
+/*
* inverse( original_matrix, inverse_matrix )
- *
+ *
* calculate the inverse of a 4x4 matrix
*
- * -1
+ * -1
* A = ___1__ adjoint A
* det A
*/
@@ -10736,7 +10722,7 @@ double in[3][3]
double det;
/* calculate the 3x3 determinant
- * if the determinant is zero,
+ * if the determinant is zero,
* then the inverse matrix is not unique.
*/
det = det3x3(in);
@@ -10750,88 +10736,88 @@ double in[3][3]
/* scale the adjoint matrix to get the inverse */
for (i = 0; i < 3; i++)
for(j = 0; j < 3; j++)
- out[i][j] /= det;
- return 0;
+ out[i][j] /= det;
+ return 0;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
/* Multuply XYZ array by 3x3 transform matrix */
static void icmMulBy3x3(double out[3], double mat[3][3], double in[3]) {
- double tt[3];
+ double tt[3];
- tt[0] = mat[0][0] * in[0] + mat[0][1] * in[1] + mat[0][2] * in[2];
- tt[1] = mat[1][0] * in[0] + mat[1][1] * in[1] + mat[1][2] * in[2];
- tt[2] = mat[2][0] * in[0] + mat[2][1] * in[1] + mat[2][2] * in[2];
+ tt[0] = mat[0][0] * in[0] + mat[0][1] * in[1] + mat[0][2] * in[2];
+ tt[1] = mat[1][0] * in[0] + mat[1][1] * in[1] + mat[1][2] * in[2];
+ tt[2] = mat[2][0] * in[0] + mat[2][1] * in[1] + mat[2][2] * in[2];
- out[0] = tt[0];
- out[1] = tt[1];
- out[2] = tt[2];
+ out[0] = tt[0];
+ out[1] = tt[1];
+ out[2] = tt[2];
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
/* CIE XYZ to perceptual Lab */
void
icmXYZ2Lab(icmXYZNumber *w, double *out, double *in) {
- double X = in[0], Y = in[1], Z = in[2];
- double x,y,z,fx,fy,fz;
- double L;
-
- x = X/w->X;
- if (x > 0.008856451586)
- fx = pow(x,1.0/3.0);
- else
- fx = 7.787036979 * x + 16.0/116.0;
-
- y = Y/w->Y;
- if (y > 0.008856451586) {
- fy = pow(y,1.0/3.0);
- L = 116.0 * fy - 16.0;
- } else {
- fy = 7.787036979 * y + 16.0/116.0;
- L = 903.2963058 * y;
- }
-
- z = Z/w->Z;
- if (z > 0.008856451586)
- fz = pow(z,1.0/3.0);
- else
- fz = 7.787036979 * z + 16.0/116.0;
-
- out[0] = L;
- out[1] = 500.0 * (fx - fy);
- out[2] = 200.0 * (fy - fz);
+ double X = in[0], Y = in[1], Z = in[2];
+ double x,y,z,fx,fy,fz;
+ double L;
+
+ x = X/w->X;
+ if (x > 0.008856451586)
+ fx = pow(x,1.0/3.0);
+ else
+ fx = 7.787036979 * x + 16.0/116.0;
+
+ y = Y/w->Y;
+ if (y > 0.008856451586) {
+ fy = pow(y,1.0/3.0);
+ L = 116.0 * fy - 16.0;
+ } else {
+ fy = 7.787036979 * y + 16.0/116.0;
+ L = 903.2963058 * y;
+ }
+
+ z = Z/w->Z;
+ if (z > 0.008856451586)
+ fz = pow(z,1.0/3.0);
+ else
+ fz = 7.787036979 * z + 16.0/116.0;
+
+ out[0] = L;
+ out[1] = 500.0 * (fx - fy);
+ out[2] = 200.0 * (fy - fz);
}
/* Perceptual Lab to CIE XYZ */
void
icmLab2XYZ(icmXYZNumber *w, double *out, double *in) {
- double L = in[0], a = in[1], b = in[2];
- double x,y,z,fx,fy,fz;
-
- if (L > 8.0) {
- fy = (L + 16.0)/116.0;
- y = pow(fy,3.0);
- } else {
- y = L/903.2963058;
- fy = 7.787036979 * y + 16.0/116.0;
- }
-
- fx = a/500.0 + fy;
- if (fx > 24.0/116.0)
- x = pow(fx,3.0);
- else
- x = (fx - 16.0/116.0)/7.787036979;
-
- fz = fy - b/200.0;
- if (fz > 24.0/116.0)
- z = pow(fz,3.0);
- else
- z = (fz - 16.0/116.0)/7.787036979;
-
- out[0] = x * w->X;
- out[1] = y * w->Y;
- out[2] = z * w->Z;
+ double L = in[0], a = in[1], b = in[2];
+ double x,y,z,fx,fy,fz;
+
+ if (L > 8.0) {
+ fy = (L + 16.0)/116.0;
+ y = pow(fy,3.0);
+ } else {
+ y = L/903.2963058;
+ fy = 7.787036979 * y + 16.0/116.0;
+ }
+
+ fx = a/500.0 + fy;
+ if (fx > 24.0/116.0)
+ x = pow(fx,3.0);
+ else
+ x = (fx - 16.0/116.0)/7.787036979;
+
+ fz = fy - b/200.0;
+ if (fz > 24.0/116.0)
+ z = pow(fz,3.0);
+ else
+ z = (fz - 16.0/116.0)/7.787036979;
+
+ out[0] = x * w->X;
+ out[1] = y * w->Y;
+ out[2] = z * w->Z;
}
/* available D50 Illuminant */
@@ -10841,7 +10827,7 @@ icmXYZNumber icmD50 = { /* Profile illuminant - D50 */
/* available D65 Illuminant */
icmXYZNumber icmD65 = { /* Profile illuminant - D65 */
- 0.9505, 1.0000, 1.0890
+ 0.9505, 1.0000, 1.0890
};
/* Default black point */
@@ -10851,200 +10837,200 @@ icmXYZNumber icmBlack = {
/* Return the normal Delta E given two Lab values */
double icmLabDE(double *Lab1, double *Lab2) {
- double rv = 0.0, tt;
+ double rv = 0.0, tt;
- tt = Lab1[0] - Lab2[0];
- rv += tt * tt;
- tt = Lab1[1] - Lab2[1];
- rv += tt * tt;
- tt = Lab1[2] - Lab2[2];
- rv += tt * tt;
-
- return sqrt(rv);
+ tt = Lab1[0] - Lab2[0];
+ rv += tt * tt;
+ tt = Lab1[1] - Lab2[1];
+ rv += tt * tt;
+ tt = Lab1[2] - Lab2[2];
+ rv += tt * tt;
+
+ return sqrt(rv);
}
/* Return the normal Delta E squared, given two Lab values */
double icmLabDEsq(double *Lab1, double *Lab2) {
- double rv = 0.0, tt;
+ double rv = 0.0, tt;
+
+ tt = Lab1[0] - Lab2[0];
+ rv += tt * tt;
+ tt = Lab1[1] - Lab2[1];
+ rv += tt * tt;
+ tt = Lab1[2] - Lab2[2];
+ rv += tt * tt;
- tt = Lab1[0] - Lab2[0];
- rv += tt * tt;
- tt = Lab1[1] - Lab2[1];
- rv += tt * tt;
- tt = Lab1[2] - Lab2[2];
- rv += tt * tt;
-
- return rv;
+ return rv;
}
/* Return the CIE94 Delta E color difference measure */
double icmCIE94(double Lab1[3], double Lab2[3]) {
- double desq, dhsq;
- double dlsq, dcsq;
- double c12;
+ double desq, dhsq;
+ double dlsq, dcsq;
+ double c12;
- {
- double dl, da, db;
- dl = Lab1[0] - Lab2[0];
- dlsq = dl * dl; /* dl squared */
- da = Lab1[1] - Lab2[1];
- db = Lab1[2] - Lab2[2];
+ {
+ double dl, da, db;
+ dl = Lab1[0] - Lab2[0];
+ dlsq = dl * dl; /* dl squared */
+ da = Lab1[1] - Lab2[1];
+ db = Lab1[2] - Lab2[2];
- /* Compute normal Lab delta E squared */
- desq = dlsq + da * da + db * db;
- }
+ /* Compute normal Lab delta E squared */
+ desq = dlsq + da * da + db * db;
+ }
- {
- double c1, c2, dc;
+ {
+ double c1, c2, dc;
- /* Compute chromanance for the two colors */
- c1 = sqrt(Lab1[1] * Lab1[1] + Lab1[2] * Lab1[2]);
- c2 = sqrt(Lab2[1] * Lab2[1] + Lab2[2] * Lab2[2]);
- c12 = sqrt(c1 * c2); /* Symetric chromanance */
+ /* Compute chromanance for the two colors */
+ c1 = sqrt(Lab1[1] * Lab1[1] + Lab1[2] * Lab1[2]);
+ c2 = sqrt(Lab2[1] * Lab2[1] + Lab2[2] * Lab2[2]);
+ c12 = sqrt(c1 * c2); /* Symetric chromanance */
- /* delta chromanance squared */
- dc = c2 - c1;
- dcsq = dc * dc;
- }
+ /* delta chromanance squared */
+ dc = c2 - c1;
+ dcsq = dc * dc;
+ }
- /* Compute delta hue squared */
- if ((dhsq = desq - dlsq - dcsq) < 0.0)
- dhsq = 0.0;
+ /* Compute delta hue squared */
+ if ((dhsq = desq - dlsq - dcsq) < 0.0)
+ dhsq = 0.0;
- {
- double sc, sh;
+ {
+ double sc, sh;
- /* Weighting factors for delta chromanance & delta hue */
- sc = 1.0 + 0.048 * c12;
- sh = 1.0 + 0.014 * c12;
-
- return sqrt(dlsq + dcsq/(sc * sc) + dhsq/(sh * sh));
- }
+ /* Weighting factors for delta chromanance & delta hue */
+ sc = 1.0 + 0.048 * c12;
+ sh = 1.0 + 0.014 * c12;
+
+ return sqrt(dlsq + dcsq/(sc * sc) + dhsq/(sh * sh));
+ }
}
/* Return the CIE94 Delta E color difference measure, squared */
double icmCIE94sq(double Lab1[3], double Lab2[3]) {
- double desq, dhsq;
- double dlsq, dcsq;
- double c12;
+ double desq, dhsq;
+ double dlsq, dcsq;
+ double c12;
+
+ {
+ double dl, da, db;
+ dl = Lab1[0] - Lab2[0];
+ dlsq = dl * dl; /* dl squared */
+ da = Lab1[1] - Lab2[1];
+ db = Lab1[2] - Lab2[2];
- {
- double dl, da, db;
- dl = Lab1[0] - Lab2[0];
- dlsq = dl * dl; /* dl squared */
- da = Lab1[1] - Lab2[1];
- db = Lab1[2] - Lab2[2];
+ /* Compute normal Lab delta E squared */
+ desq = dlsq + da * da + db * db;
+ }
- /* Compute normal Lab delta E squared */
- desq = dlsq + da * da + db * db;
- }
+ {
+ double c1, c2, dc;
- {
- double c1, c2, dc;
+ /* Compute chromanance for the two colors */
+ c1 = sqrt(Lab1[1] * Lab1[1] + Lab1[2] * Lab1[2]);
+ c2 = sqrt(Lab2[1] * Lab2[1] + Lab2[2] * Lab2[2]);
+ c12 = sqrt(c1 * c2); /* Symetric chromanance */
- /* Compute chromanance for the two colors */
- c1 = sqrt(Lab1[1] * Lab1[1] + Lab1[2] * Lab1[2]);
- c2 = sqrt(Lab2[1] * Lab2[1] + Lab2[2] * Lab2[2]);
- c12 = sqrt(c1 * c2); /* Symetric chromanance */
+ /* delta chromanance squared */
+ dc = c2 - c1;
+ dcsq = dc * dc;
+ }
- /* delta chromanance squared */
- dc = c2 - c1;
- dcsq = dc * dc;
- }
+ /* Compute delta hue squared */
+ if ((dhsq = desq - dlsq - dcsq) < 0.0)
+ dhsq = 0.0;
- /* Compute delta hue squared */
- if ((dhsq = desq - dlsq - dcsq) < 0.0)
- dhsq = 0.0;
+ {
+ double sc, sh;
- {
- double sc, sh;
+ /* Weighting factors for delta chromanance & delta hue */
+ sc = 1.0 + 0.048 * c12;
+ sh = 1.0 + 0.014 * c12;
- /* Weighting factors for delta chromanance & delta hue */
- sc = 1.0 + 0.048 * c12;
- sh = 1.0 + 0.014 * c12;
-
- return dlsq + dcsq/(sc * sc) + dhsq/(sh * sh);
- }
+ return dlsq + dcsq/(sc * sc) + dhsq/(sh * sh);
+ }
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
/* Multiply one 3x3 with another */
static void mul3x3(double dst[3][3], double src[3][3]) {
- int i, j, k;
- double td[3][3]; /* Temporary dest */
+ int i, j, k;
+ double td[3][3]; /* Temporary dest */
- for (j = 0; j < 3; j++) {
- for (i = 0; i < 3; i++) {
- double tt = 0.0;
- for (k = 0; k < 3; k++)
- tt += src[j][k] * dst[k][i];
- td[j][i] = tt;
- }
- }
+ for (j = 0; j < 3; j++) {
+ for (i = 0; i < 3; i++) {
+ double tt = 0.0;
+ for (k = 0; k < 3; k++)
+ tt += src[j][k] * dst[k][i];
+ td[j][i] = tt;
+ }
+ }
- /* Copy result out */
- for (j = 0; j < 3; j++)
- for (i = 0; i < 3; i++)
- dst[j][i] = td[j][i];
+ /* Copy result out */
+ for (j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ dst[j][i] = td[j][i];
}
/* Chrmatic Adaption transform utility */
/* Return a 3x3 chromatic adaption matrix */
void icmChromAdaptMatrix(
- int flags,
- icmXYZNumber d_wp, /* Destination white point */
- icmXYZNumber s_wp, /* Source white point */
- double mat[3][3] /* Destination matrix */
-) {
- double dst[3], src[3]; /* Source & destination white points */
- double vkmat[3][3]; /* Von Kries matrix */
- double bradford[3][3] = { /* Bradford cone space matrix */
- { 0.8951, 0.2664, -0.1614 },
- { -0.7502, 1.7135, 0.0367 },
- { 0.0389, -0.0685, 1.0296 }
- };
- double ibradford[3][3]; /* Inverse Bradford */
-
- /* Set initial matrix to unity */
- if (!(flags & ICM_CAM_MULMATRIX)) {
- mat[0][0] = mat[1][1] = mat[2][2] = 1.0;
- mat[0][1] = mat[0][2] = 0.0;
- mat[1][0] = mat[1][2] = 0.0;
- mat[2][0] = mat[2][1] = 0.0;
- }
-
- icmXYZ2Ary(src, s_wp);
- icmXYZ2Ary(dst, d_wp);
-
- if (flags & ICM_CAM_BRADFORD) {
- icmMulBy3x3(src, bradford, src);
- icmMulBy3x3(dst, bradford, dst);
- }
-
- /* Setup the Von Kries white point adaption matrix */
- vkmat[0][0] = dst[0]/src[0];
- vkmat[1][1] = dst[1]/src[1];
- vkmat[2][2] = dst[2]/src[2];
- vkmat[0][1] = vkmat[0][2] = 0.0;
- vkmat[1][0] = vkmat[1][2] = 0.0;
- vkmat[2][0] = vkmat[2][1] = 0.0;
-
- /* Transform to Bradford space if requested */
- if (flags & ICM_CAM_BRADFORD) {
- mul3x3(mat, bradford);
- }
-
- /* Apply chromatic adaption */
- mul3x3(mat, vkmat);
-
- /* Transform from Bradford space */
- if (flags & ICM_CAM_BRADFORD) {
- inverse3x3(ibradford, bradford);
- mul3x3(mat, ibradford);
- }
-
- /* We're done */
+ int flags,
+ icmXYZNumber d_wp, /* Destination white point */
+ icmXYZNumber s_wp, /* Source white point */
+ double mat[3][3] /* Destination matrix */
+) {
+ double dst[3], src[3]; /* Source & destination white points */
+ double vkmat[3][3]; /* Von Kries matrix */
+ double bradford[3][3] = { /* Bradford cone space matrix */
+ { 0.8951, 0.2664, -0.1614 },
+ { -0.7502, 1.7135, 0.0367 },
+ { 0.0389, -0.0685, 1.0296 }
+ };
+ double ibradford[3][3]; /* Inverse Bradford */
+
+ /* Set initial matrix to unity */
+ if (!(flags & ICM_CAM_MULMATRIX)) {
+ mat[0][0] = mat[1][1] = mat[2][2] = 1.0;
+ mat[0][1] = mat[0][2] = 0.0;
+ mat[1][0] = mat[1][2] = 0.0;
+ mat[2][0] = mat[2][1] = 0.0;
+ }
+
+ icmXYZ2Ary(src, s_wp);
+ icmXYZ2Ary(dst, d_wp);
+
+ if (flags & ICM_CAM_BRADFORD) {
+ icmMulBy3x3(src, bradford, src);
+ icmMulBy3x3(dst, bradford, dst);
+ }
+
+ /* Setup the Von Kries white point adaption matrix */
+ vkmat[0][0] = dst[0]/src[0];
+ vkmat[1][1] = dst[1]/src[1];
+ vkmat[2][2] = dst[2]/src[2];
+ vkmat[0][1] = vkmat[0][2] = 0.0;
+ vkmat[1][0] = vkmat[1][2] = 0.0;
+ vkmat[2][0] = vkmat[2][1] = 0.0;
+
+ /* Transform to Bradford space if requested */
+ if (flags & ICM_CAM_BRADFORD) {
+ mul3x3(mat, bradford);
+ }
+
+ /* Apply chromatic adaption */
+ mul3x3(mat, vkmat);
+
+ /* Transform from Bradford space */
+ if (flags & ICM_CAM_BRADFORD) {
+ inverse3x3(ibradford, bradford);
+ mul3x3(mat, ibradford);
+ }
+
+ /* We're done */
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -11053,21 +11039,21 @@ void icmChromAdaptMatrix(
/* Any pointer may be NULL if value is not to be returned */
static void
icmLutSpaces(
- struct _icmLuBase *p, /* This */
- icColorSpaceSignature *ins, /* Return Native input color space */
- int *inn, /* Return number of input components */
- icColorSpaceSignature *outs, /* Return Native output color space */
- int *outn /* Return number of output components */
+ struct _icmLuBase *p, /* This */
+ icColorSpaceSignature *ins, /* Return Native input color space */
+ int *inn, /* Return number of input components */
+ icColorSpaceSignature *outs, /* Return Native output color space */
+ int *outn /* Return number of output components */
) {
- if (ins != NULL)
- *ins = p->inSpace;
- if (inn != NULL)
- *inn = (int)number_ColorSpaceSignature(p->inSpace);
+ if (ins != NULL)
+ *ins = p->inSpace;
+ if (inn != NULL)
+ *inn = (int)number_ColorSpaceSignature(p->inSpace);
- if (outs != NULL)
- *outs = p->outSpace;
- if (outn != NULL)
- *outn = (int)number_ColorSpaceSignature(p->outSpace);
+ if (outs != NULL)
+ *outs = p->outSpace;
+ if (outn != NULL)
+ *outn = (int)number_ColorSpaceSignature(p->outSpace);
}
/* Return information about the effective lookup in/out colorspaces, */
@@ -11075,37 +11061,37 @@ icmLutSpaces(
/* Any pointer may be NULL if value is not to be returned */
static void
icmLuSpaces(
- struct _icmLuBase *p, /* This */
- icColorSpaceSignature *ins, /* Return effective input color space */
- int *inn, /* Return number of input components */
- icColorSpaceSignature *outs, /* Return effective output color space */
- int *outn, /* Return number of output components */
- icmLuAlgType *alg, /* Return type of lookup algorithm used */
+ struct _icmLuBase *p, /* This */
+ icColorSpaceSignature *ins, /* Return effective input color space */
+ int *inn, /* Return number of input components */
+ icColorSpaceSignature *outs, /* Return effective output color space */
+ int *outn, /* Return number of output components */
+ icmLuAlgType *alg, /* Return type of lookup algorithm used */
icRenderingIntent *intt, /* Return the intent being implented */
icmLookupFunc *fnc, /* Return the profile function being implemented */
- icColorSpaceSignature *pcs /* Return the profile effective PCS */
+ icColorSpaceSignature *pcs /* Return the profile effective PCS */
) {
- if (ins != NULL)
- *ins = p->e_inSpace;
- if (inn != NULL)
- *inn = (int)number_ColorSpaceSignature(p->e_inSpace);
+ if (ins != NULL)
+ *ins = p->e_inSpace;
+ if (inn != NULL)
+ *inn = (int)number_ColorSpaceSignature(p->e_inSpace);
- if (outs != NULL)
- *outs = p->e_outSpace;
- if (outn != NULL)
- *outn = (int)number_ColorSpaceSignature(p->e_outSpace);
+ if (outs != NULL)
+ *outs = p->e_outSpace;
+ if (outn != NULL)
+ *outn = (int)number_ColorSpaceSignature(p->e_outSpace);
- if (alg != NULL)
- *alg = p->ttype;
+ if (alg != NULL)
+ *alg = p->ttype;
if (intt != NULL)
- *intt = p->intent;
+ *intt = p->intent;
- if (fnc != NULL)
- *fnc = p->function;
+ if (fnc != NULL)
+ *fnc = p->function;
- if (pcs != NULL)
- *pcs = p->e_pcs;
+ if (pcs != NULL)
+ *pcs = p->e_pcs;
}
/* Return the media white and black points in XYZ space. */
@@ -11116,26 +11102,26 @@ struct _icmLuBase *p,
icmXYZNumber *wht,
icmXYZNumber *blk
) {
- if (wht != NULL)
- *wht = p->whitePoint; /* Structure copy */
+ if (wht != NULL)
+ *wht = p->whitePoint; /* Structure copy */
- if (blk != NULL)
- *blk = p->blackPoint; /* Structure copy */
+ if (blk != NULL)
+ *blk = p->blackPoint; /* Structure copy */
}
/* Get the effective (externally visible) ranges for the Monochrome or Matrix profile */
/* Arguments may be NULL */
static void
icmLu_get_ranges (
- struct _icmLuBase *p,
- double *inmin, double *inmax, /* Return maximum range of inspace values */
- double *outmin, double *outmax /* Return maximum range of outspace values */
+ struct _icmLuBase *p,
+ double *inmin, double *inmax, /* Return maximum range of inspace values */
+ double *outmin, double *outmax /* Return maximum range of outspace values */
) {
- /* Hmm. we have no way of handlin an error from getRange. */
- /* It shouldn't ever return one unless there is a mismatch between */
- /* getRange and Lu creation... */
- getRange(p->e_inSpace, inmin, inmax);
- getRange(p->e_outSpace, outmin, outmax);
+ /* Hmm. we have no way of handlin an error from getRange. */
+ /* It shouldn't ever return one unless there is a mismatch between */
+ /* getRange and Lu creation... */
+ getRange(p->e_inSpace, inmin, inmax);
+ getRange(p->e_outSpace, outmin, outmax);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -11151,17 +11137,17 @@ icmLuMono *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- icc *icp = p->icp;
- int rv = 0;
+ icc *icp = p->icp;
+ int rv = 0;
- /* Translate from device to PCS scale */
- if ((rv |= p->grayCurve->lookup_fwd(p->grayCurve,&out[0],&in[0])) > 1) {
- sprintf(icp->err,"icc_lookup: Curve->lookup_fwd() failed");
- icp->errc = rv;
- return 2;
- }
+ /* Translate from device to PCS scale */
+ if ((rv |= p->grayCurve->lookup_fwd(p->grayCurve,&out[0],&in[0])) > 1) {
+ sprintf(icp->err,"icc_lookup: Curve->lookup_fwd() failed");
+ icp->errc = rv;
+ return 2;
+ }
- return rv;
+ return rv;
}
/* Linearised device to relative PCS */
@@ -11171,21 +11157,21 @@ icmLuMono *p, /* This */
double *out, /* Vector of output values (native space) */
double *in /* Vector of input values (native space) */
) {
- int rv = 0;
- double Y = in[0]; /* In case out == in */
+ int rv = 0;
+ double Y = in[0]; /* In case out == in */
- out[0] = p->pcswht.X;
- out[1] = p->pcswht.Y;
- out[2] = p->pcswht.Z;
- if (p->pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out); /* in Lab */
+ out[0] = p->pcswht.X;
+ out[1] = p->pcswht.Y;
+ out[2] = p->pcswht.Z;
+ if (p->pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out); /* in Lab */
- /* Scale linearized device level to PCS white */
- out[0] *= Y;
- out[1] *= Y;
- out[2] *= Y;
+ /* Scale linearized device level to PCS white */
+ out[0] *= Y;
+ out[1] *= Y;
+ out[2] *= Y;
- return rv;
+ return rv;
}
/* relative PCS to absolute PCS (if required) */
@@ -11195,38 +11181,37 @@ icmLuMono *p, /* This */
double *out, /* Vector of output values in Effective PCS */
double *in /* Vector of input values in Native PCS */
) {
- int rv = 0;
+ int rv = 0;
- if (out != in) {
- int i;
- for (i = 0; i < 3; i++) /* Don't alter input values */
- out[i] = in[i];
- }
+ if (out != in) {
+ int i;
+ for (i = 0; i < 3; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
- /* Do absolute conversion */
- if (p->intent == icAbsoluteColorimetric) {
+ /* Do absolute conversion */
+ if (p->intent == icAbsoluteColorimetric) {
- if (p->pcs == icSigLabData) /* Convert L to Y */
- icmLab2XYZ(&p->pcswht, out, out);
-
- /* Convert from Relative to Absolute colorometric */
- icmMulBy3x3(out, p->toAbs, out);
-
- if (p->e_pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
+ if (p->pcs == icSigLabData) /* Convert L to Y */
+ icmLab2XYZ(&p->pcswht, out, out);
- } else {
+ /* Convert from Relative to Absolute colorometric */
+ icmMulBy3x3(out, p->toAbs, out);
- /* Convert from Native to Effective output space */
- if (p->pcs == icSigLabData && p->e_pcs == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->pcs == icSigXYZData && p->e_pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
+ if (p->e_pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
- return rv;
-}
+ } else {
+ /* Convert from Native to Effective output space */
+ if (p->pcs == icSigLabData && p->e_pcs == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->pcs == icSigXYZData && p->e_pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+
+ return rv;
+}
/* Overall Fwd conversion routine */
static int
@@ -11235,15 +11220,14 @@ icmLuBase *pp, /* This */
double *out, /* Vector of output values */
double *in /* Input value */
) {
- int rv = 0;
- icmLuMono *p = (icmLuMono *)pp;
- rv |= icmLuMonoFwd_curve(p, out, in);
- rv |= icmLuMonoFwd_map(p, out, out);
- rv |= icmLuMonoFwd_abs(p, out, out);
- return rv;
+ int rv = 0;
+ icmLuMono *p = (icmLuMono *)pp;
+ rv |= icmLuMonoFwd_curve(p, out, in);
+ rv |= icmLuMonoFwd_map(p, out, out);
+ rv |= icmLuMonoFwd_abs(p, out, out);
+ return rv;
}
-
/* Individual components of Bwd conversion: */
/* Convert from relative PCS to absolute PCS (if required) */
@@ -11253,63 +11237,63 @@ icmLuMono *p, /* This */
double *out, /* Vector of output values in Native PCS */
double *in /* Vector of input values in Effective PCS */
) {
- int rv = 0;
-
- if (out != in) {
- int i;
- for (i = 0; i < 3; i++) /* Don't alter input values */
- out[i] = in[i];
- }
-
- /* Force to monochrome locus in correct space */
- if (p->e_pcs == icSigLabData) {
- double wp[3];
-
- if (p->intent == icAbsoluteColorimetric) {
- wp[0] = p->whitePoint.X;
- wp[1] = p->whitePoint.Y;
- wp[2] = p->whitePoint.Z;
- } else {
- wp[0] = p->pcswht.X;
- wp[1] = p->pcswht.Y;
- wp[2] = p->pcswht.Z;
- }
- icmXYZ2Lab(&p->pcswht, wp, wp); /* Convert to Lab white point */
- out[1] = out[0]/wp[0] * wp[1];
- out[2] = out[0]/wp[0] * wp[2];
-
- } else {
- if (p->intent == icAbsoluteColorimetric) {
- out[0] = out[1]/p->whitePoint.Y * p->whitePoint.X;
- out[2] = out[1]/p->whitePoint.Y * p->whitePoint.Z;
- } else {
- out[0] = out[1]/p->pcswht.Y * p->pcswht.X;
- out[2] = out[1]/p->pcswht.Y * p->pcswht.Z;
- }
- }
-
- /* Do absolute conversion to */
- if (p->intent == icAbsoluteColorimetric) {
-
- if (p->e_pcs == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
-
- icmMulBy3x3(out, p->fromAbs, out);
-
- /* Convert from Effective to Native input space */
- if (p->pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
-
- } else {
-
- /* Convert from Effective to Native input space */
- if (p->e_pcs == icSigLabData && p->pcs == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->e_pcs == icSigXYZData && p->pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
-
- return rv;
+ int rv = 0;
+
+ if (out != in) {
+ int i;
+ for (i = 0; i < 3; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
+
+ /* Force to monochrome locus in correct space */
+ if (p->e_pcs == icSigLabData) {
+ double wp[3];
+
+ if (p->intent == icAbsoluteColorimetric) {
+ wp[0] = p->whitePoint.X;
+ wp[1] = p->whitePoint.Y;
+ wp[2] = p->whitePoint.Z;
+ } else {
+ wp[0] = p->pcswht.X;
+ wp[1] = p->pcswht.Y;
+ wp[2] = p->pcswht.Z;
+ }
+ icmXYZ2Lab(&p->pcswht, wp, wp); /* Convert to Lab white point */
+ out[1] = out[0]/wp[0] * wp[1];
+ out[2] = out[0]/wp[0] * wp[2];
+
+ } else {
+ if (p->intent == icAbsoluteColorimetric) {
+ out[0] = out[1]/p->whitePoint.Y * p->whitePoint.X;
+ out[2] = out[1]/p->whitePoint.Y * p->whitePoint.Z;
+ } else {
+ out[0] = out[1]/p->pcswht.Y * p->pcswht.X;
+ out[2] = out[1]/p->pcswht.Y * p->pcswht.Z;
+ }
+ }
+
+ /* Do absolute conversion to */
+ if (p->intent == icAbsoluteColorimetric) {
+
+ if (p->e_pcs == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
+
+ icmMulBy3x3(out, p->fromAbs, out);
+
+ /* Convert from Effective to Native input space */
+ if (p->pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+
+ } else {
+
+ /* Convert from Effective to Native input space */
+ if (p->e_pcs == icSigLabData && p->pcs == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->e_pcs == icSigXYZData && p->pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+
+ return rv;
}
/* Map from relative PCS to linearised device */
@@ -11319,22 +11303,22 @@ icmLuMono *p, /* This */
double *out, /* Output value */
double *in /* Vector of input values (native space) */
) {
- int rv = 0;
- double pcsw[3];
+ int rv = 0;
+ double pcsw[3];
- pcsw[0] = p->pcswht.X;
- pcsw[1] = p->pcswht.Y;
- pcsw[2] = p->pcswht.Z;
- if (p->pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, pcsw, pcsw); /* in Lab (should be 100.0!) */
+ pcsw[0] = p->pcswht.X;
+ pcsw[1] = p->pcswht.Y;
+ pcsw[2] = p->pcswht.Z;
+ if (p->pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, pcsw, pcsw); /* in Lab (should be 100.0!) */
- /* Divide linearized device level into PCS white luminence */
- if (p->pcs == icSigLabData)
- out[0] = in[0]/pcsw[0];
- else
- out[0] = in[1]/pcsw[1];
+ /* Divide linearized device level into PCS white luminence */
+ if (p->pcs == icSigLabData)
+ out[0] = in[0]/pcsw[0];
+ else
+ out[0] = in[1]/pcsw[1];
- return rv;
+ return rv;
}
/* Map from linearised device to actual device */
@@ -11344,17 +11328,17 @@ icmLuMono *p, /* This */
double *out, /* Output value */
double *in /* Input value */
) {
- icc *icp = p->icp;
- int rv = 0;
+ icc *icp = p->icp;
+ int rv = 0;
- /* Convert to device value through curve */
- if ((rv = p->grayCurve->lookup_bwd(p->grayCurve,&out[0],&in[0])) > 1) {
- sprintf(icp->err,"icc_lookup: Curve->lookup_bwd() failed");
- icp->errc = rv;
- return 2;
- }
+ /* Convert to device value through curve */
+ if ((rv = p->grayCurve->lookup_bwd(p->grayCurve,&out[0],&in[0])) > 1) {
+ sprintf(icp->err,"icc_lookup: Curve->lookup_bwd() failed");
+ icp->errc = rv;
+ return 2;
+ }
- return rv;
+ return rv;
}
/* Overall Bwd conversion routine */
@@ -11364,133 +11348,132 @@ icmLuBase *pp, /* This */
double *out, /* Output value */
double *in /* Vector of input values */
) {
- double temp[3];
- int rv = 0;
- icmLuMono *p = (icmLuMono *)pp;
- rv |= icmLuMonoBwd_abs(p, temp, in);
- rv |= icmLuMonoBwd_map(p, out, temp);
- rv |= icmLuMonoBwd_curve(p, out, out);
- return rv;
+ double temp[3];
+ int rv = 0;
+ icmLuMono *p = (icmLuMono *)pp;
+ rv |= icmLuMonoBwd_abs(p, temp, in);
+ rv |= icmLuMonoBwd_map(p, out, temp);
+ rv |= icmLuMonoBwd_curve(p, out, out);
+ return rv;
}
static void
icmLuMono_delete(
icmLuBase *p
) {
- icc *icp = p->icp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
static icmLuBase *
new_icmLuMono(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func, /* Functionality requested */
- int dir /* 0 = fwd, 1 = bwd */
-) {
- icmLuMono *p;
-
- if ((p = (icmLuMono *) icp->al->calloc(icp->al,1,sizeof(icmLuMono))) == NULL)
- return NULL;
- p->icp = icp;
- p->del = icmLuMono_delete;
- p->lutspaces= icmLutSpaces;
- p->spaces = icmLuSpaces;
- p->get_ranges = icmLu_get_ranges;
- p->wh_bk_points = icmLuWh_bk_points;
- p->fwd_lookup = icmLuMonoFwd_lookup;
- p->fwd_curve = icmLuMonoFwd_curve;
- p->fwd_map = icmLuMonoFwd_map;
- p->fwd_abs = icmLuMonoFwd_abs;
- p->bwd_lookup = icmLuMonoBwd_lookup;
- p->bwd_abs = icmLuMonoFwd_abs;
- p->bwd_map = icmLuMonoFwd_map;
- p->bwd_curve = icmLuMonoFwd_curve;
- if (dir) {
- p->ttype = icmMonoBwdType;
- p->lookup = icmLuMonoBwd_lookup;
- } else {
- p->ttype = icmMonoFwdType;
- p->lookup = icmLuMonoFwd_lookup;
- }
-
- /* See if the color spaces are appropriate for the mono type */
- if (number_ColorSpaceSignature(icp->header->colorSpace) != 1
- || ( icp->header->pcs != icSigXYZData && icp->header->pcs != icSigLabData)) {
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Find the appropriate tags */
- if ((p->grayCurve = (icmCurve *)icp->read_tag(icp, icSigGrayTRCTag)) == NULL
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func, /* Functionality requested */
+ int dir /* 0 = fwd, 1 = bwd */
+) {
+ icmLuMono *p;
+
+ if ((p = (icmLuMono *) icp->al->calloc(icp->al,1,sizeof(icmLuMono))) == NULL)
+ return NULL;
+ p->icp = icp;
+ p->del = icmLuMono_delete;
+ p->lutspaces= icmLutSpaces;
+ p->spaces = icmLuSpaces;
+ p->get_ranges = icmLu_get_ranges;
+ p->wh_bk_points = icmLuWh_bk_points;
+ p->fwd_lookup = icmLuMonoFwd_lookup;
+ p->fwd_curve = icmLuMonoFwd_curve;
+ p->fwd_map = icmLuMonoFwd_map;
+ p->fwd_abs = icmLuMonoFwd_abs;
+ p->bwd_lookup = icmLuMonoBwd_lookup;
+ p->bwd_abs = icmLuMonoFwd_abs;
+ p->bwd_map = icmLuMonoFwd_map;
+ p->bwd_curve = icmLuMonoFwd_curve;
+ if (dir) {
+ p->ttype = icmMonoBwdType;
+ p->lookup = icmLuMonoBwd_lookup;
+ } else {
+ p->ttype = icmMonoFwdType;
+ p->lookup = icmLuMonoFwd_lookup;
+ }
+
+ /* See if the color spaces are appropriate for the mono type */
+ if (number_ColorSpaceSignature(icp->header->colorSpace) != 1
+ || ( icp->header->pcs != icSigXYZData && icp->header->pcs != icSigLabData)) {
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Find the appropriate tags */
+ if ((p->grayCurve = (icmCurve *)icp->read_tag(icp, icSigGrayTRCTag)) == NULL
|| p->grayCurve->ttype != icSigCurveType) {
- p->del((icmLuBase *)p);
- return NULL;
- }
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
- p->pcswht = icp->header->illuminant;
- p->whitePoint = whitePoint;
- p->blackPoint = blackPoint;
- p->intent = intent;
- p->function = func;
- p->inSpace = inSpace;
- p->outSpace = outSpace;
- p->pcs = pcs;
- p->e_inSpace = e_inSpace;
- p->e_outSpace = e_outSpace;
- p->e_pcs = e_pcs;
+ p->pcswht = icp->header->illuminant;
+ p->whitePoint = whitePoint;
+ p->blackPoint = blackPoint;
+ p->intent = intent;
+ p->function = func;
+ p->inSpace = inSpace;
+ p->outSpace = outSpace;
+ p->pcs = pcs;
+ p->e_inSpace = e_inSpace;
+ p->e_outSpace = e_outSpace;
+ p->e_pcs = e_pcs;
- /* Create absolute <-> relative conversion matricies */
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
+ /* Create absolute <-> relative conversion matricies */
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
- return (icmLuBase *)p;
+ return (icmLuBase *)p;
}
static icmLuBase *
new_icmLuMonoFwd(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func /* Functionality requested */
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func /* Functionality requested */
) {
- return new_icmLuMono(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
- whitePoint, blackPoint, intent, func, 0);
+ return new_icmLuMono(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
+ whitePoint, blackPoint, intent, func, 0);
}
-
static icmLuBase *
new_icmLuMonoBwd(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func /* Functionality requested */
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func /* Functionality requested */
) {
- return new_icmLuMono(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
- whitePoint, blackPoint, intent, func, 1);
+ return new_icmLuMono(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
+ whitePoint, blackPoint, intent, func, 1);
}
/* - - - - - - - - - - - - - - - - - - - - - - - */
@@ -11504,19 +11487,19 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- icc *icp = p->icp;
- int rv = 0;
+ icc *icp = p->icp;
+ int rv = 0;
- /* Curve lookups */
- if ((rv |= p->redCurve->lookup_fwd( p->redCurve, &out[0],&in[0])) > 1
- || (rv |= p->greenCurve->lookup_fwd(p->greenCurve,&out[1],&in[1])) > 1
- || (rv |= p->blueCurve->lookup_fwd( p->blueCurve, &out[2],&in[2])) > 1) {
- sprintf(icp->err,"icc_lookup: Curve->lookup_fwd() failed");
- icp->errc = rv;
- return 2;
- }
+ /* Curve lookups */
+ if ((rv |= p->redCurve->lookup_fwd( p->redCurve, &out[0],&in[0])) > 1
+ || (rv |= p->greenCurve->lookup_fwd(p->greenCurve,&out[1],&in[1])) > 1
+ || (rv |= p->blueCurve->lookup_fwd( p->blueCurve, &out[2],&in[2])) > 1) {
+ sprintf(icp->err,"icc_lookup: Curve->lookup_fwd() failed");
+ icp->errc = rv;
+ return 2;
+ }
- return rv;
+ return rv;
}
static int
@@ -11525,19 +11508,19 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
- double tt[3];
+ int rv = 0;
+ double tt[3];
- /* Matrix */
- tt[0] = p->mx[0][0] * in[0] + p->mx[0][1] * in[1] + p->mx[0][2] * in[2];
- tt[1] = p->mx[1][0] * in[0] + p->mx[1][1] * in[1] + p->mx[1][2] * in[2];
- tt[2] = p->mx[2][0] * in[0] + p->mx[2][1] * in[1] + p->mx[2][2] * in[2];
+ /* Matrix */
+ tt[0] = p->mx[0][0] * in[0] + p->mx[0][1] * in[1] + p->mx[0][2] * in[2];
+ tt[1] = p->mx[1][0] * in[0] + p->mx[1][1] * in[1] + p->mx[1][2] * in[2];
+ tt[2] = p->mx[2][0] * in[0] + p->mx[2][1] * in[1] + p->mx[2][2] * in[2];
- out[0] = tt[0];
- out[1] = tt[1];
- out[2] = tt[2];
+ out[0] = tt[0];
+ out[1] = tt[1];
+ out[2] = tt[2];
- return rv;
+ return rv;
}
static int
@@ -11546,27 +11529,26 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
+ int rv = 0;
- if (out != in) {
- int i;
- for (i = 0; i < 3; i++) /* Don't alter input values */
- out[i] = in[i];
- }
+ if (out != in) {
+ int i;
+ for (i = 0; i < 3; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
- /* If required, convert from Relative to Absolute colorometric */
- if (p->intent == icAbsoluteColorimetric) {
- icmMulBy3x3(out, p->toAbs, out);
- }
+ /* If required, convert from Relative to Absolute colorometric */
+ if (p->intent == icAbsoluteColorimetric) {
+ icmMulBy3x3(out, p->toAbs, out);
+ }
- /* If e_pcs is Lab, then convert XYZ to Lab */
- if (p->e_pcs == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
+ /* If e_pcs is Lab, then convert XYZ to Lab */
+ if (p->e_pcs == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
- return rv;
+ return rv;
}
-
/* Overall Fwd conversion */
static int
icmLuMatrixFwd_lookup (
@@ -11574,12 +11556,12 @@ icmLuBase *pp, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
- icmLuMatrix *p = (icmLuMatrix *)pp;
- rv |= icmLuMatrixFwd_curve(p, out, in);
- rv |= icmLuMatrixFwd_matrix(p, out, out);
- rv |= icmLuMatrixFwd_abs(p, out, out);
- return rv;
+ int rv = 0;
+ icmLuMatrix *p = (icmLuMatrix *)pp;
+ rv |= icmLuMatrixFwd_curve(p, out, in);
+ rv |= icmLuMatrixFwd_matrix(p, out, out);
+ rv |= icmLuMatrixFwd_abs(p, out, out);
+ return rv;
}
/* Individual components of Bwd conversion: */
@@ -11590,24 +11572,24 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
+ int rv = 0;
- if (out != in) {
- int i;
- for (i = 0; i < 3; i++) /* Don't alter input values */
- out[i] = in[i];
- }
+ if (out != in) {
+ int i;
+ for (i = 0; i < 3; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
- /* If e_pcs is Lab, then convert Lab to XYZ */
- if (p->e_pcs == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
+ /* If e_pcs is Lab, then convert Lab to XYZ */
+ if (p->e_pcs == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
- /* If required, convert from Absolute to Relative colorometric */
- if (p->intent == icAbsoluteColorimetric) {
- icmMulBy3x3(out, p->fromAbs, out);
- }
+ /* If required, convert from Absolute to Relative colorometric */
+ if (p->intent == icAbsoluteColorimetric) {
+ icmMulBy3x3(out, p->fromAbs, out);
+ }
- return rv;
+ return rv;
}
static int
@@ -11616,19 +11598,19 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
- double tt[3];
+ int rv = 0;
+ double tt[3];
- /* Matrix */
- tt[0] = p->bmx[0][0] * in[0] + p->bmx[0][1] * in[1] + p->bmx[0][2] * in[2];
- tt[1] = p->bmx[1][0] * in[0] + p->bmx[1][1] * in[1] + p->bmx[1][2] * in[2];
- tt[2] = p->bmx[2][0] * in[0] + p->bmx[2][1] * in[1] + p->bmx[2][2] * in[2];
+ /* Matrix */
+ tt[0] = p->bmx[0][0] * in[0] + p->bmx[0][1] * in[1] + p->bmx[0][2] * in[2];
+ tt[1] = p->bmx[1][0] * in[0] + p->bmx[1][1] * in[1] + p->bmx[1][2] * in[2];
+ tt[2] = p->bmx[2][0] * in[0] + p->bmx[2][1] * in[1] + p->bmx[2][2] * in[2];
- out[0] = tt[0];
- out[1] = tt[1];
- out[2] = tt[2];
+ out[0] = tt[0];
+ out[1] = tt[1];
+ out[2] = tt[2];
- return rv;
+ return rv;
}
static int
@@ -11637,18 +11619,18 @@ icmLuMatrix *p, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- icc *icp = p->icp;
- int rv = 0;
+ icc *icp = p->icp;
+ int rv = 0;
- /* Curves */
- if ((rv |= p->redCurve->lookup_bwd(p->redCurve,&out[0],&out[0])) > 1
- || (rv |= p->greenCurve->lookup_bwd(p->greenCurve,&out[1],&out[1])) > 1
- || (rv |= p->blueCurve->lookup_bwd(p->blueCurve,&out[2],&out[2])) > 1) {
- sprintf(icp->err,"icc_lookup: Curve->lookup_bwd() failed");
- icp->errc = rv;
- return 2;
- }
- return rv;
+ /* Curves */
+ if ((rv |= p->redCurve->lookup_bwd(p->redCurve,&out[0],&out[0])) > 1
+ || (rv |= p->greenCurve->lookup_bwd(p->greenCurve,&out[1],&out[1])) > 1
+ || (rv |= p->blueCurve->lookup_bwd(p->blueCurve,&out[2],&out[2])) > 1) {
+ sprintf(icp->err,"icc_lookup: Curve->lookup_bwd() failed");
+ icp->errc = rv;
+ return 2;
+ }
+ return rv;
}
/* Overall Bwd conversion */
@@ -11658,158 +11640,157 @@ icmLuBase *pp, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
- icmLuMatrix *p = (icmLuMatrix *)pp;
- rv |= icmLuMatrixBwd_abs(p, out, in);
- rv |= icmLuMatrixBwd_matrix(p, out, out);
- rv |= icmLuMatrixBwd_curve(p, out, out);
- return rv;
+ int rv = 0;
+ icmLuMatrix *p = (icmLuMatrix *)pp;
+ rv |= icmLuMatrixBwd_abs(p, out, in);
+ rv |= icmLuMatrixBwd_matrix(p, out, out);
+ rv |= icmLuMatrixBwd_curve(p, out, out);
+ return rv;
}
static void
icmLuMatrix_delete(
icmLuBase *p
) {
- icc *icp = p->icp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
/* We setup valid fwd and bwd component conversions, */
/* but setup only the asked for overal conversion. */
static icmLuBase *
new_icmLuMatrix(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func, /* Functionality requested */
- int dir /* 0 = fwd, 1 = bwd */
-) {
- icmLuMatrix *p;
-
- if ((p = (icmLuMatrix *) icp->al->calloc(icp->al,1,sizeof(icmLuMatrix))) == NULL)
- return NULL;
- p->icp = icp;
- p->del = icmLuMatrix_delete;
- p->lutspaces= icmLutSpaces;
- p->spaces = icmLuSpaces;
- p->get_ranges = icmLu_get_ranges;
- p->wh_bk_points = icmLuWh_bk_points;
- p->fwd_lookup = icmLuMatrixFwd_lookup;
- p->fwd_curve = icmLuMatrixFwd_curve;
- p->fwd_matrix = icmLuMatrixFwd_matrix;
- p->fwd_abs = icmLuMatrixFwd_abs;
- p->bwd_lookup = icmLuMatrixBwd_lookup;
- p->bwd_abs = icmLuMatrixBwd_abs;
- p->bwd_matrix = icmLuMatrixBwd_matrix;
- p->bwd_curve = icmLuMatrixBwd_curve;
- if (dir) {
- p->ttype = icmMatrixBwdType;
- p->lookup = icmLuMatrixBwd_lookup;
- } else {
- p->ttype = icmMatrixFwdType;
- p->lookup = icmLuMatrixFwd_lookup;
- }
-
- /* Note that we can use matrix type even if PCS is Lab, */
- /* by simply converting it. */
-
- /* Find the appropriate tags */
- if ((p->redCurve = (icmCurve *)icp->read_tag(icp, icSigRedTRCTag)) == NULL
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func, /* Functionality requested */
+ int dir /* 0 = fwd, 1 = bwd */
+) {
+ icmLuMatrix *p;
+
+ if ((p = (icmLuMatrix *) icp->al->calloc(icp->al,1,sizeof(icmLuMatrix))) == NULL)
+ return NULL;
+ p->icp = icp;
+ p->del = icmLuMatrix_delete;
+ p->lutspaces= icmLutSpaces;
+ p->spaces = icmLuSpaces;
+ p->get_ranges = icmLu_get_ranges;
+ p->wh_bk_points = icmLuWh_bk_points;
+ p->fwd_lookup = icmLuMatrixFwd_lookup;
+ p->fwd_curve = icmLuMatrixFwd_curve;
+ p->fwd_matrix = icmLuMatrixFwd_matrix;
+ p->fwd_abs = icmLuMatrixFwd_abs;
+ p->bwd_lookup = icmLuMatrixBwd_lookup;
+ p->bwd_abs = icmLuMatrixBwd_abs;
+ p->bwd_matrix = icmLuMatrixBwd_matrix;
+ p->bwd_curve = icmLuMatrixBwd_curve;
+ if (dir) {
+ p->ttype = icmMatrixBwdType;
+ p->lookup = icmLuMatrixBwd_lookup;
+ } else {
+ p->ttype = icmMatrixFwdType;
+ p->lookup = icmLuMatrixFwd_lookup;
+ }
+
+ /* Note that we can use matrix type even if PCS is Lab, */
+ /* by simply converting it. */
+
+ /* Find the appropriate tags */
+ if ((p->redCurve = (icmCurve *)icp->read_tag(icp, icSigRedTRCTag)) == NULL
|| p->redCurve->ttype != icSigCurveType
- || (p->greenCurve = (icmCurve *)icp->read_tag(icp, icSigGreenTRCTag)) == NULL
+ || (p->greenCurve = (icmCurve *)icp->read_tag(icp, icSigGreenTRCTag)) == NULL
|| p->greenCurve->ttype != icSigCurveType
- || (p->blueCurve = (icmCurve *)icp->read_tag(icp, icSigBlueTRCTag)) == NULL
+ || (p->blueCurve = (icmCurve *)icp->read_tag(icp, icSigBlueTRCTag)) == NULL
|| p->blueCurve->ttype != icSigCurveType
- || (p->redColrnt = (icmXYZArray *)icp->read_tag(icp, icSigRedColorantTag)) == NULL
+ || (p->redColrnt = (icmXYZArray *)icp->read_tag(icp, icSigRedColorantTag)) == NULL
|| p->redColrnt->ttype != icSigXYZType || p->redColrnt->size < 1
- || (p->greenColrnt = (icmXYZArray *)icp->read_tag(icp, icSigGreenColorantTag)) == NULL
+ || (p->greenColrnt = (icmXYZArray *)icp->read_tag(icp, icSigGreenColorantTag)) == NULL
|| p->greenColrnt->ttype != icSigXYZType || p->greenColrnt->size < 1
- || (p->blueColrnt = (icmXYZArray *)icp->read_tag(icp, icSigBlueColorantTag)) == NULL
+ || (p->blueColrnt = (icmXYZArray *)icp->read_tag(icp, icSigBlueColorantTag)) == NULL
|| p->blueColrnt->ttype != icSigXYZType || p->blueColrnt->size < 1) {
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Setup the matrix */
- p->mx[0][0] = p->redColrnt->data[0].X;
- p->mx[0][1] = p->greenColrnt->data[0].X;
- p->mx[0][2] = p->blueColrnt->data[0].X;
- p->mx[1][1] = p->greenColrnt->data[0].Y;
- p->mx[1][0] = p->redColrnt->data[0].Y;
- p->mx[1][2] = p->blueColrnt->data[0].Y;
- p->mx[2][1] = p->greenColrnt->data[0].Z;
- p->mx[2][0] = p->redColrnt->data[0].Z;
- p->mx[2][2] = p->blueColrnt->data[0].Z;
-
- if (inverse3x3(p->bmx, p->mx) != 0) { /* Compute inverse */
- sprintf(icp->err,"icc_new_iccLuMatrix: Matrix wasn't invertable");
- icp->errc = 2;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- p->pcswht = icp->header->illuminant;
- p->whitePoint = whitePoint;
- p->blackPoint = blackPoint;
- p->intent = intent;
- p->function = func;
- p->inSpace = inSpace;
- p->outSpace = outSpace;
- p->pcs = pcs;
- p->e_inSpace = e_inSpace;
- p->e_outSpace = e_outSpace;
- p->e_pcs = e_pcs;
-
- /* Create absolute <-> relative conversion matricies */
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
-
- return (icmLuBase *)p;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Setup the matrix */
+ p->mx[0][0] = p->redColrnt->data[0].X;
+ p->mx[0][1] = p->greenColrnt->data[0].X;
+ p->mx[0][2] = p->blueColrnt->data[0].X;
+ p->mx[1][1] = p->greenColrnt->data[0].Y;
+ p->mx[1][0] = p->redColrnt->data[0].Y;
+ p->mx[1][2] = p->blueColrnt->data[0].Y;
+ p->mx[2][1] = p->greenColrnt->data[0].Z;
+ p->mx[2][0] = p->redColrnt->data[0].Z;
+ p->mx[2][2] = p->blueColrnt->data[0].Z;
+
+ if (inverse3x3(p->bmx, p->mx) != 0) { /* Compute inverse */
+ sprintf(icp->err,"icc_new_iccLuMatrix: Matrix wasn't invertable");
+ icp->errc = 2;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ p->pcswht = icp->header->illuminant;
+ p->whitePoint = whitePoint;
+ p->blackPoint = blackPoint;
+ p->intent = intent;
+ p->function = func;
+ p->inSpace = inSpace;
+ p->outSpace = outSpace;
+ p->pcs = pcs;
+ p->e_inSpace = e_inSpace;
+ p->e_outSpace = e_outSpace;
+ p->e_pcs = e_pcs;
+
+ /* Create absolute <-> relative conversion matricies */
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
+
+ return (icmLuBase *)p;
}
static icmLuBase *
new_icmLuMatrixFwd(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func /* Functionality requested */
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func /* Functionality requested */
) {
- return new_icmLuMatrix(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
- whitePoint, blackPoint, intent, func, 0);
+ return new_icmLuMatrix(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
+ whitePoint, blackPoint, intent, func, 0);
}
-
static icmLuBase *
new_icmLuMatrixBwd(
- struct _icc *icp,
+ struct _icc *icp,
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func /* Functionality requested */
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func /* Functionality requested */
) {
- return new_icmLuMatrix(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
- whitePoint, blackPoint, intent, func, 1);
+ return new_icmLuMatrix(icp, inSpace, outSpace, pcs, e_inSpace, e_outSpace, e_pcs,
+ whitePoint, blackPoint, intent, func, 1);
}
/* - - - - - - - - - - - - - - - - - - - - - - - */
@@ -11818,123 +11799,122 @@ new_icmLuMatrixBwd(
/* Components of overall lookup, in order */
static int icmLuLut_in_abs(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
+ icmLut *lut = p->lut;
+ int rv = 0;
+
+ if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
- if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
- out[i] = in[i];
- }
+ /* If Bwd Lut, take care of Absolute color space and effective input space */
+ if ((p->function == icmBwd || p->function == icmGamut || p->function == icmPreview)
+ && p->intent == icAbsoluteColorimetric) {
- /* If Bwd Lut, take care of Absolute color space and effective input space */
- if ((p->function == icmBwd || p->function == icmGamut || p->function == icmPreview)
- && p->intent == icAbsoluteColorimetric) {
-
- if (p->e_inSpace == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
+ if (p->e_inSpace == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
- /* Convert from Absolute to Relative colorometric */
- icmMulBy3x3(out, p->fromAbs, out);
-
- if (p->inSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
+ /* Convert from Absolute to Relative colorometric */
+ icmMulBy3x3(out, p->fromAbs, out);
- } else {
+ if (p->inSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
- /* Convert from Effective to Native input space */
- if (p->e_inSpace == icSigLabData && p->inSpace == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->e_inSpace == icSigXYZData && p->inSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
+ } else {
- return rv;
+ /* Convert from Effective to Native input space */
+ if (p->e_inSpace == icSigLabData && p->inSpace == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->e_inSpace == icSigXYZData && p->inSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+
+ return rv;
}
/* Possible matrix lookup */
static int icmLuLut_matrix(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
+ icmLut *lut = p->lut;
+ int rv = 0;
- if (p->usematrix)
- rv |= lut->lookup_matrix(lut,out,in);
- else if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++)
- out[i] = in[i];
- }
- return rv;
+ if (p->usematrix)
+ rv |= lut->lookup_matrix(lut,out,in);
+ else if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++)
+ out[i] = in[i];
+ }
+ return rv;
}
/* Do input -> input' lookup */
static int icmLuLut_input(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
+ icmLut *lut = p->lut;
+ int rv = 0;
- p->in_normf(out, in); /* Normalize from input color space */
- rv |= lut->lookup_input(lut,out,out); /* Lookup though input tables */
- p->in_denormf(out,out); /* De-normalize to input color space */
- return rv;
+ p->in_normf(out, in); /* Normalize from input color space */
+ rv |= lut->lookup_input(lut,out,out); /* Lookup though input tables */
+ p->in_denormf(out,out); /* De-normalize to input color space */
+ return rv;
}
/* Do input'->output' lookup */
static int icmLuLut_clut(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- double temp[MAX_CHAN];
- int rv = 0;
+ icmLut *lut = p->lut;
+ double temp[MAX_CHAN];
+ int rv = 0;
- p->in_normf(temp, in); /* Normalize from input color space */
- rv |= p->lookup_clut(lut,out,temp); /* Lookup though clut tables */
- p->out_denormf(out,out); /* De-normalize to output color space */
- return rv;
+ p->in_normf(temp, in); /* Normalize from input color space */
+ rv |= p->lookup_clut(lut,out,temp); /* Lookup though clut tables */
+ p->out_denormf(out,out); /* De-normalize to output color space */
+ return rv;
}
/* Do output'->output lookup */
static int icmLuLut_output(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
+ icmLut *lut = p->lut;
+ int rv = 0;
- p->out_normf(out,in); /* Normalize from output color space */
- rv |= lut->lookup_output(lut,out,out); /* Lookup though output tables */
- p->out_denormf(out, out); /* De-normalize to output color space */
- return rv;
+ p->out_normf(out,in); /* Normalize from output color space */
+ rv |= lut->lookup_output(lut,out,out); /* Lookup though output tables */
+ p->out_denormf(out, out); /* De-normalize to output color space */
+ return rv;
}
static int icmLuLut_out_abs(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
+ icmLut *lut = p->lut;
+ int rv = 0;
- if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
- out[i] = in[i];
- }
+ if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
- /* If Fwd Lut, take care of Absolute color space */
- /* and convert from native to effective out PCS */
- if ((p->function == icmFwd || p->function == icmPreview)
- && p->intent == icAbsoluteColorimetric) {
+ /* If Fwd Lut, take care of Absolute color space */
+ /* and convert from native to effective out PCS */
+ if ((p->function == icmFwd || p->function == icmPreview)
+ && p->intent == icAbsoluteColorimetric) {
- if (p->outSpace == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
-
- /* Convert from Relative to Absolute colorometric XYZ */
- icmMulBy3x3(out, p->toAbs, out);
+ if (p->outSpace == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
- if (p->e_outSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- } else {
+ /* Convert from Relative to Absolute colorometric XYZ */
+ icmMulBy3x3(out, p->toAbs, out);
- /* Convert from Native to Effective output space */
- if (p->outSpace == icSigLabData && p->e_outSpace == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->outSpace == icSigXYZData && p->e_outSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
- return rv;
-}
+ if (p->e_outSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ } else {
+ /* Convert from Native to Effective output space */
+ if (p->outSpace == icSigLabData && p->e_outSpace == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->outSpace == icSigXYZData && p->e_outSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+ return rv;
+}
/* Overall lookup */
static int
@@ -11943,22 +11923,22 @@ icmLuBase *pp, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int rv = 0;
- icmLuLut *p = (icmLuLut *)pp;
- icmLut *lut = p->lut;
- double temp[MAX_CHAN];
+ int rv = 0;
+ icmLuLut *p = (icmLuLut *)pp;
+ icmLut *lut = p->lut;
+ double temp[MAX_CHAN];
- rv |= p->in_abs(p,temp,in); /* Possible absolute conversion */
- if (p->usematrix)
- rv |= lut->lookup_matrix(lut,temp,temp);/* If XYZ, multiply by non-unity matrix */
- p->in_normf(temp, temp); /* Normalize for input color space */
- rv |= lut->lookup_input(lut,temp,temp); /* Lookup though input tables */
- rv |= p->lookup_clut(lut,out,temp); /* Lookup though clut tables */
- rv |= lut->lookup_output(lut,out,out); /* Lookup though output tables */
- p->out_denormf(out,out); /* Normalize for output color space */
- rv |= p->out_abs(p,out,out); /* Possible absolute conversion */
+ rv |= p->in_abs(p,temp,in); /* Possible absolute conversion */
+ if (p->usematrix)
+ rv |= lut->lookup_matrix(lut,temp,temp);/* If XYZ, multiply by non-unity matrix */
+ p->in_normf(temp, temp); /* Normalize for input color space */
+ rv |= lut->lookup_input(lut,temp,temp); /* Lookup though input tables */
+ rv |= p->lookup_clut(lut,out,temp); /* Lookup though clut tables */
+ rv |= lut->lookup_output(lut,out,out); /* Lookup though output tables */
+ p->out_denormf(out,out); /* Normalize for output color space */
+ rv |= p->out_abs(p,out,out); /* Possible absolute conversion */
- return rv;
+ return rv;
}
#ifdef NEVER /* The following should be identical in effect to the above. */
@@ -11970,19 +11950,19 @@ icmLuBase *pp, /* This */
double *out, /* Vector of output values */
double *in /* Vector of input values */
) {
- int i, rv = 0;
- icmLuLut *p = (icmLuLut *)pp;
- icmLut *lut = p->lut;
- double temp[MAX_CHAN];
+ int i, rv = 0;
+ icmLuLut *p = (icmLuLut *)pp;
+ icmLut *lut = p->lut;
+ double temp[MAX_CHAN];
- rv |= p->in_abs(p,temp,in);
- rv |= p->matrix(p,temp,temp);
- rv |= p->input(p,temp,temp);
- rv |= p->clut(p,out,temp);
- rv |= p->output(p,out,out);
- rv |= p->out_abs(p,out,out);
+ rv |= p->in_abs(p,temp,in);
+ rv |= p->matrix(p,temp,temp);
+ rv |= p->input(p,temp,temp);
+ rv |= p->clut(p,out,temp);
+ rv |= p->output(p,out,out);
+ rv |= p->out_abs(p,out,out);
- return rv;
+ return rv;
}
#endif /* NEVER */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -11990,59 +11970,59 @@ double *in /* Vector of input values */
/* ~~ should these be in icmLut (like all the fwd transforms)? */
static int icmLuLut_inv_out_abs(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
-
- if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
- out[i] = in[i];
- }
-
- /* If Fwd Lut, take care of Absolute color space */
- /* and convert from effective to native inverse output PCS */
- /* OutSpace must be PCS: XYZ or Lab */
- if ((p->function == icmFwd || p->function == icmPreview)
- && p->intent == icAbsoluteColorimetric) {
-
- if (p->e_outSpace == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
-
- /* Convert from Absolute to Relative colorometric */
- icmMulBy3x3(out, p->fromAbs, out);
-
- if (p->outSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
-
- } else {
-
- /* Convert from Effective to Native output space */
- if (p->e_outSpace == icSigLabData && p->outSpace == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->e_outSpace == icSigXYZData && p->outSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
- return rv;
+ icmLut *lut = p->lut;
+ int rv = 0;
+
+ if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
+
+ /* If Fwd Lut, take care of Absolute color space */
+ /* and convert from effective to native inverse output PCS */
+ /* OutSpace must be PCS: XYZ or Lab */
+ if ((p->function == icmFwd || p->function == icmPreview)
+ && p->intent == icAbsoluteColorimetric) {
+
+ if (p->e_outSpace == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
+
+ /* Convert from Absolute to Relative colorometric */
+ icmMulBy3x3(out, p->fromAbs, out);
+
+ if (p->outSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+
+ } else {
+
+ /* Convert from Effective to Native output space */
+ if (p->e_outSpace == icSigLabData && p->outSpace == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->e_outSpace == icSigXYZData && p->outSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+ return rv;
}
/* Do output->output' inverse lookup */
static int icmLuLut_inv_output(icmLuLut *p, double *out, double *in) {
- icc *icp = p->icp;
- icmLut *lut = p->lut;
- int rv = 0;
+ icc *icp = p->icp;
+ icmLut *lut = p->lut;
+ int rv = 0;
- if (lut->rot.inited == 0) {
- rv = icmTable_setup_bwd(icp, &lut->rot, lut->outputEnt, lut->outputTable);
- if (rv != 0) {
- sprintf(icp->err,"icc_Lut_inv_input: Malloc failure in inverse lookup init.");
- return icp->errc = rv;
- }
- }
+ if (lut->rot.inited == 0) {
+ rv = icmTable_setup_bwd(icp, &lut->rot, lut->outputEnt, lut->outputTable);
+ if (rv != 0) {
+ sprintf(icp->err,"icc_Lut_inv_input: Malloc failure in inverse lookup init.");
+ return icp->errc = rv;
+ }
+ }
- p->out_normf(out,in); /* Normalize from output color space */
- rv |= icmTable_lookup_bwd(&lut->rot, out, out); /* Reverse lookup though output tables */
- p->out_denormf(out, out); /* De-normalize to output color space */
- return rv;
+ p->out_normf(out,in); /* Normalize from output color space */
+ rv |= icmTable_lookup_bwd(&lut->rot, out, out); /* Reverse lookup though output tables */
+ p->out_denormf(out, out); /* De-normalize to output color space */
+ return rv;
}
/* No output' -> input inverse lookup. */
@@ -12050,488 +12030,487 @@ static int icmLuLut_inv_output(icmLuLut *p, double *out, double *in) {
/* Do input' -> input inverse lookup */
static int icmLuLut_inv_input(icmLuLut *p, double *out, double *in) {
- icc *icp = p->icp;
- icmLut *lut = p->lut;
- int rv = 0;
+ icc *icp = p->icp;
+ icmLut *lut = p->lut;
+ int rv = 0;
- if (lut->rit.inited == 0) {
- rv = icmTable_setup_bwd(icp, &lut->rit, lut->inputEnt, lut->inputTable);
- if (rv != 0) {
- sprintf(icp->err,"icc_Lut_inv_input: Malloc failure in inverse lookup init.");
- return icp->errc = rv;
- }
- }
+ if (lut->rit.inited == 0) {
+ rv = icmTable_setup_bwd(icp, &lut->rit, lut->inputEnt, lut->inputTable);
+ if (rv != 0) {
+ sprintf(icp->err,"icc_Lut_inv_input: Malloc failure in inverse lookup init.");
+ return icp->errc = rv;
+ }
+ }
- p->in_normf(out, in); /* Normalize from input color space */
- rv |= icmTable_lookup_bwd(&lut->rit, out, out); /* Reverse lookup though input tables */
- p->in_denormf(out,out); /* De-normalize to input color space */
- return rv;
+ p->in_normf(out, in); /* Normalize from input color space */
+ rv |= icmTable_lookup_bwd(&lut->rit, out, out); /* Reverse lookup though input tables */
+ p->in_denormf(out,out); /* De-normalize to input color space */
+ return rv;
}
/* Possible inverse matrix lookup */
static int icmLuLut_inv_matrix(icmLuLut *p, double *out, double *in) {
- icc *icp = p->icp;
- icmLut *lut = p->lut;
- int rv = 0;
-
- if (p->usematrix) {
- double tt[3];
- if (p->imx_valid == 0) {
- if (inverse3x3(p->imx, lut->e) != 0) { /* Compute inverse */
- sprintf(icp->err,"icc_new_iccLuMatrix: Matrix wasn't invertable");
- icp->errc = 2;
- return 2;
- }
- p->imx_valid = 1;
- }
- /* Matrix multiply */
- tt[0] = p->imx[0][0] * in[0] + p->imx[0][1] * in[1] + p->imx[0][2] * in[2];
- tt[1] = p->imx[1][0] * in[0] + p->imx[1][1] * in[1] + p->imx[1][2] * in[2];
- tt[2] = p->imx[2][0] * in[0] + p->imx[2][1] * in[1] + p->imx[2][2] * in[2];
- out[0] = tt[0], out[1] = tt[1], out[2] = tt[2];
- } else if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++)
- out[i] = in[i];
- }
- return rv;
+ icc *icp = p->icp;
+ icmLut *lut = p->lut;
+ int rv = 0;
+
+ if (p->usematrix) {
+ double tt[3];
+ if (p->imx_valid == 0) {
+ if (inverse3x3(p->imx, lut->e) != 0) { /* Compute inverse */
+ sprintf(icp->err,"icc_new_iccLuMatrix: Matrix wasn't invertable");
+ icp->errc = 2;
+ return 2;
+ }
+ p->imx_valid = 1;
+ }
+ /* Matrix multiply */
+ tt[0] = p->imx[0][0] * in[0] + p->imx[0][1] * in[1] + p->imx[0][2] * in[2];
+ tt[1] = p->imx[1][0] * in[0] + p->imx[1][1] * in[1] + p->imx[1][2] * in[2];
+ tt[2] = p->imx[2][0] * in[0] + p->imx[2][1] * in[1] + p->imx[2][2] * in[2];
+ out[0] = tt[0], out[1] = tt[1], out[2] = tt[2];
+ } else if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++)
+ out[i] = in[i];
+ }
+ return rv;
}
static int icmLuLut_inv_in_abs(icmLuLut *p, double *out, double *in) {
- icmLut *lut = p->lut;
- int rv = 0;
-
- if (out != in) {
- int i;
- for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
- out[i] = in[i];
- }
-
- /* If Bwd Lut, take care of Absolute color space, and */
- /* convert from native to effective input space */
- if ((p->function == icmBwd || p->function == icmGamut || p->function == icmPreview)
- && p->intent == icAbsoluteColorimetric) {
-
- if (p->inSpace == icSigLabData)
- icmLab2XYZ(&p->pcswht, out, out);
-
- /* Convert from Relative to Absolute colorometric XYZ */
- icmMulBy3x3(out, p->toAbs, out);
-
- if (p->e_inSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- } else {
-
- /* Convert from Native to Effective input space */
- if (p->inSpace == icSigLabData && p->e_inSpace == icSigXYZData)
- icmLab2XYZ(&p->pcswht, out, out);
- else if (p->inSpace == icSigXYZData && p->e_inSpace == icSigLabData)
- icmXYZ2Lab(&p->pcswht, out, out);
- }
- return rv;
+ icmLut *lut = p->lut;
+ int rv = 0;
+
+ if (out != in) {
+ int i;
+ for (i = 0; i < lut->inputChan; i++) /* Don't alter input values */
+ out[i] = in[i];
+ }
+
+ /* If Bwd Lut, take care of Absolute color space, and */
+ /* convert from native to effective input space */
+ if ((p->function == icmBwd || p->function == icmGamut || p->function == icmPreview)
+ && p->intent == icAbsoluteColorimetric) {
+
+ if (p->inSpace == icSigLabData)
+ icmLab2XYZ(&p->pcswht, out, out);
+
+ /* Convert from Relative to Absolute colorometric XYZ */
+ icmMulBy3x3(out, p->toAbs, out);
+
+ if (p->e_inSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ } else {
+
+ /* Convert from Native to Effective input space */
+ if (p->inSpace == icSigLabData && p->e_inSpace == icSigXYZData)
+ icmLab2XYZ(&p->pcswht, out, out);
+ else if (p->inSpace == icSigXYZData && p->e_inSpace == icSigLabData)
+ icmXYZ2Lab(&p->pcswht, out, out);
+ }
+ return rv;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Return LuLut information */
static void icmLuLut_get_info(
- icmLuLut *p, /* this */
- icmLut **lutp, /* Pointer to icc lut type */
- icmXYZNumber *pcswhtp, /* Pointer to profile PCS white point */
- icmXYZNumber *whitep, /* Pointer to profile absolute white point */
- icmXYZNumber *blackp /* Pointer to profile absolute black point */
-) {
- if (lutp != NULL)
- *lutp = p->lut;
- if (pcswhtp != NULL)
- *pcswhtp = p->pcswht;
- if (whitep != NULL)
- *whitep = p->whitePoint;
- if (blackp != NULL)
- *blackp = p->blackPoint;
+ icmLuLut *p, /* this */
+ icmLut **lutp, /* Pointer to icc lut type */
+ icmXYZNumber *pcswhtp, /* Pointer to profile PCS white point */
+ icmXYZNumber *whitep, /* Pointer to profile absolute white point */
+ icmXYZNumber *blackp /* Pointer to profile absolute black point */
+) {
+ if (lutp != NULL)
+ *lutp = p->lut;
+ if (pcswhtp != NULL)
+ *pcswhtp = p->pcswht;
+ if (whitep != NULL)
+ *whitep = p->whitePoint;
+ if (blackp != NULL)
+ *blackp = p->blackPoint;
}
/* Get the native ranges for the LuLut */
static void
icmLuLut_get_lutranges (
- struct _icmLuLut *p,
- double *inmin, double *inmax, /* Return maximum range of inspace values */
- double *outmin, double *outmax /* Return maximum range of outspace values */
-) {
- int i;
-
- for (i = 0; i < p->lut->inputChan; i++) {
- inmin[i] = 0.0; /* Normalized range of input space values */
- inmax[i] = 1.0;
- }
- p->in_denormf(inmin,inmin); /* Convert to real colorspace range */
- p->in_denormf(inmax,inmax);
-
- /* Make sure min and max are so. */
- for (i = 0; i < p->lut->inputChan; i++) {
- if (inmin[i] > inmax[i]) {
- double tt;
- tt = inmin[i];
- inmin[i] = inmax[i];
- inmax[i] = tt;
- }
- }
-
- for (i = 0; i < p->lut->outputChan; i++) {
- outmin[i] = 0.0; /* Normalized range of output space values */
- outmax[i] = 1.0;
- }
- p->out_denormf(outmin,outmin); /* Convert to real colorspace range */
- p->out_denormf(outmax,outmax);
-
- /* Make sure min and max are so. */
- for (i = 0; i < p->lut->outputChan; i++) {
- if (outmin[i] > outmax[i]) {
- double tt;
- tt = outmin[i];
- outmin[i] = outmax[i];
- outmax[i] = tt;
- }
- }
+ struct _icmLuLut *p,
+ double *inmin, double *inmax, /* Return maximum range of inspace values */
+ double *outmin, double *outmax /* Return maximum range of outspace values */
+) {
+ int i;
+
+ for (i = 0; i < p->lut->inputChan; i++) {
+ inmin[i] = 0.0; /* Normalized range of input space values */
+ inmax[i] = 1.0;
+ }
+ p->in_denormf(inmin,inmin); /* Convert to real colorspace range */
+ p->in_denormf(inmax,inmax);
+
+ /* Make sure min and max are so. */
+ for (i = 0; i < p->lut->inputChan; i++) {
+ if (inmin[i] > inmax[i]) {
+ double tt;
+ tt = inmin[i];
+ inmin[i] = inmax[i];
+ inmax[i] = tt;
+ }
+ }
+
+ for (i = 0; i < p->lut->outputChan; i++) {
+ outmin[i] = 0.0; /* Normalized range of output space values */
+ outmax[i] = 1.0;
+ }
+ p->out_denormf(outmin,outmin); /* Convert to real colorspace range */
+ p->out_denormf(outmax,outmax);
+
+ /* Make sure min and max are so. */
+ for (i = 0; i < p->lut->outputChan; i++) {
+ if (outmin[i] > outmax[i]) {
+ double tt;
+ tt = outmin[i];
+ outmin[i] = outmax[i];
+ outmax[i] = tt;
+ }
+ }
}
/* Get the effective (externally visible) ranges for the LuLut */
/* Arguments may be NULL */
static void
icmLuLut_get_ranges (
- struct _icmLuBase *pp,
- double *inmin, double *inmax, /* Return maximum range of inspace values */
- double *outmin, double *outmax /* Return maximum range of outspace values */
-) {
- icmLuLut *p = (icmLuLut *)pp;
- double tinmin[MAX_CHAN], tinmax[MAX_CHAN], toutmin[MAX_CHAN], toutmax[MAX_CHAN];
- int i;
-
- /* fudge NULL arguments so that they don't bomb */
- if (inmin == NULL)
- inmin = tinmin;
- if (inmax == NULL)
- inmax = tinmax;
- if (outmin == NULL)
- outmin = toutmin;
- if (outmax == NULL)
- outmax = toutmax;
-
- for (i = 0; i < p->lut->inputChan; i++) {
- inmin[i] = 0.0; /* Normalized range of input space values */
- inmax[i] = 1.0;
- }
- p->e_in_denormf(inmin,inmin); /* Convert to real colorspace range */
- p->e_in_denormf(inmax,inmax);
-
- /* Make sure min and max are so. */
- for (i = 0; i < p->lut->inputChan; i++) {
- if (inmin[i] > inmax[i]) {
- double tt;
- tt = inmin[i];
- inmin[i] = inmax[i];
- inmax[i] = tt;
- }
- }
-
- for (i = 0; i < p->lut->outputChan; i++) {
- outmin[i] = 0.0; /* Normalized range of output space values */
- outmax[i] = 1.0;
- }
- p->e_out_denormf(outmin,outmin); /* Convert to real colorspace range */
- p->e_out_denormf(outmax,outmax);
-
- /* Make sure min and max are so. */
- for (i = 0; i < p->lut->outputChan; i++) {
- if (outmin[i] > outmax[i]) {
- double tt;
- tt = outmin[i];
- outmin[i] = outmax[i];
- outmax[i] = tt;
- }
- }
+ struct _icmLuBase *pp,
+ double *inmin, double *inmax, /* Return maximum range of inspace values */
+ double *outmin, double *outmax /* Return maximum range of outspace values */
+) {
+ icmLuLut *p = (icmLuLut *)pp;
+ double tinmin[MAX_CHAN], tinmax[MAX_CHAN], toutmin[MAX_CHAN], toutmax[MAX_CHAN];
+ int i;
+
+ /* fudge NULL arguments so that they don't bomb */
+ if (inmin == NULL)
+ inmin = tinmin;
+ if (inmax == NULL)
+ inmax = tinmax;
+ if (outmin == NULL)
+ outmin = toutmin;
+ if (outmax == NULL)
+ outmax = toutmax;
+
+ for (i = 0; i < p->lut->inputChan; i++) {
+ inmin[i] = 0.0; /* Normalized range of input space values */
+ inmax[i] = 1.0;
+ }
+ p->e_in_denormf(inmin,inmin); /* Convert to real colorspace range */
+ p->e_in_denormf(inmax,inmax);
+
+ /* Make sure min and max are so. */
+ for (i = 0; i < p->lut->inputChan; i++) {
+ if (inmin[i] > inmax[i]) {
+ double tt;
+ tt = inmin[i];
+ inmin[i] = inmax[i];
+ inmax[i] = tt;
+ }
+ }
+
+ for (i = 0; i < p->lut->outputChan; i++) {
+ outmin[i] = 0.0; /* Normalized range of output space values */
+ outmax[i] = 1.0;
+ }
+ p->e_out_denormf(outmin,outmin); /* Convert to real colorspace range */
+ p->e_out_denormf(outmax,outmax);
+
+ /* Make sure min and max are so. */
+ for (i = 0; i < p->lut->outputChan; i++) {
+ if (outmin[i] > outmax[i]) {
+ double tt;
+ tt = outmin[i];
+ outmin[i] = outmax[i];
+ outmax[i] = tt;
+ }
+ }
}
/* Return the underlying Lut matrix */
static void
icmLuLut_get_matrix (
- struct _icmLuLut *p,
- double m[3][3]
+ struct _icmLuLut *p,
+ double m[3][3]
) {
- int i, j;
- icmLut *lut = p->lut;
+ int i, j;
+ icmLut *lut = p->lut;
- if (p->usematrix) {
- for (i = 0; i < 3; i++)
- for (j = 0; j < 3; j++)
- m[i][j] = lut->e[i][j]; /* Copy from Lut */
+ if (p->usematrix) {
+ for (i = 0; i < 3; i++)
+ for (j = 0; j < 3; j++)
+ m[i][j] = lut->e[i][j]; /* Copy from Lut */
- } else { /* return unity matrix */
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 3; j++) {
- if (i == j)
- m[i][j] = 1.0;
- else
- m[i][j] = 0.0;
- }
- }
- }
+ } else { /* return unity matrix */
+ for (i = 0; i < 3; i++) {
+ for (j = 0; j < 3; j++) {
+ if (i == j)
+ m[i][j] = 1.0;
+ else
+ m[i][j] = 0.0;
+ }
+ }
+ }
}
-
static void
icmLuLut_delete(
icmLuBase *p
) {
- icc *icp = p->icp;
+ icc *icp = p->icp;
- icp->al->free(icp->al, p);
+ icp->al->free(icp->al, p);
}
static icmLuBase *
new_icmLuLut(
- icc *icp,
- icTagSignature ttag, /* Target Lut tag */
+ icc *icp,
+ icTagSignature ttag, /* Target Lut tag */
icColorSpaceSignature inSpace, /* Native Input color space */
icColorSpaceSignature outSpace, /* Native Output color space */
icColorSpaceSignature pcs, /* Native PCS */
icColorSpaceSignature e_inSpace, /* Effective Input color space */
icColorSpaceSignature e_outSpace, /* Effective Output color space */
icColorSpaceSignature e_pcs, /* Effective PCS */
- icmXYZNumber whitePoint, /* Profile absolute white point */
- icmXYZNumber blackPoint, /* Profile absolute black point */
- icRenderingIntent intent, /* Rendering intent */
- icmLookupFunc func /* Functionality requested */
-) {
- icmLuLut *p;
-
- if ((p = (icmLuLut *) icp->al->calloc(icp->al,1,sizeof(icmLuLut))) == NULL)
- return NULL;
- p->ttype = icmLutType;
- p->icp = icp;
- p->del = icmLuLut_delete;
- p->lutspaces= icmLutSpaces;
- p->spaces = icmLuSpaces;
- p->wh_bk_points = icmLuWh_bk_points;
-
- p->lookup = icmLuLut_lookup;
- p->in_abs = icmLuLut_in_abs;
- p->matrix = icmLuLut_matrix;
- p->input = icmLuLut_input;
- p->clut = icmLuLut_clut;
- p->output = icmLuLut_output;
- p->out_abs = icmLuLut_out_abs;
-
- p->inv_in_abs = icmLuLut_inv_in_abs;
- p->inv_matrix = icmLuLut_inv_matrix;
- p->inv_input = icmLuLut_inv_input;
- p->inv_output = icmLuLut_inv_output;
- p->inv_out_abs = icmLuLut_inv_out_abs;
-
- p->pcswht = icp->header->illuminant;
- p->whitePoint = whitePoint;
- p->blackPoint = blackPoint;
- p->intent = intent;
- p->function = func;
- p->inSpace = inSpace;
- p->outSpace = outSpace;
- p->pcs = pcs;
- p->e_inSpace = e_inSpace;
- p->e_outSpace = e_outSpace;
- p->e_pcs = e_pcs;
- p->get_info = icmLuLut_get_info;
- p->get_lutranges = icmLuLut_get_lutranges;
- p->get_ranges = icmLuLut_get_ranges;
- p->get_matrix = icmLuLut_get_matrix;
-
- /* Create absolute <-> relative conversion matricies */
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
- icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
-
- /* Get the Lut tag, & check that it is expected type */
- if ((p->lut = (icmLut *)icp->read_tag(icp, ttag)) == NULL
- || (p->lut->ttype != icSigLut8Type && p->lut->ttype != icSigLut16Type)) {
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Check if matrix should be used */
- if (inSpace == icSigXYZData && p->lut->nu_matrix(p->lut))
- p->usematrix = 1;
- else
- p->usematrix = 0;
-
- /* Lookup input color space to normalized index function */
- if (getNormFunc(inSpace, p->lut->ttype, icmToLuti, &p->in_normf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Lookup normalized index to input color space function */
- if (getNormFunc(inSpace, p->lut->ttype, icmFromLuti, &p->in_denormf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Lookup output color space to normalized Lut entry value function */
- if (getNormFunc(outSpace, p->lut->ttype, icmToLutv, &p->out_normf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Lookup normalized Lut entry value to output color space function */
- if (getNormFunc(outSpace, p->lut->ttype, icmFromLutv, &p->out_denormf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Lookup normalized index to effective input color space function */
- if (getNormFunc(e_inSpace, p->lut->ttype, icmFromLuti, &p->e_in_denormf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown effective colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Lookup normalized Lut entry value to effective output color space function */
- if (getNormFunc(e_outSpace, p->lut->ttype, icmFromLutv, &p->e_out_denormf)) {
- sprintf(icp->err,"icc_get_luobj: Unknown effective colorspace");
- icp->errc = 1;
- p->del((icmLuBase *)p);
- return NULL;
- }
-
- /* Determine appropriate clut lookup algorithm */
- {
- int use_sx; /* -1 = undecided, 0 = N-linear, 1 = Simplex lookup */
- icColorSpaceSignature ins, outs; /* In and out Lut color spaces */
- int inn, outn; /* in and out number of Lut components */
-
- p->lutspaces((icmLuBase *)p, &ins, &inn, &outs, &outn);
-
- /* Determine if the input space is "Device" like, */
- /* ie. luminance will be expected to vary most strongly */
- /* with the diagonal change in input coordinates. */
- switch(ins) {
-
- /* Luminence is carried by the sum of all the output channels, */
- /* so output luminence will dominantly be in diagonal direction. */
- case icSigRgbData:
- case icSigGrayData:
- case icSigCmykData:
- case icSigCmyData:
- case icSigMch6Data:
- use_sx = 1; /* Simplex interpolation is appropriate */
- break;
-
- /* A single channel carries the luminence information */
- case icSigLabData:
- case icSigLuvData:
- case icSigYCbCrData:
- case icSigYxyData:
- case icSigXYZData:
- case icSigHlsData:
- case icSigHsvData:
- use_sx = 0; /* N-linear interpolation is appropriate */
- break;
- default:
- use_sx = -1; /* undecided */
- break;
- }
-
- /* If we couldn't figure it out from the input space, */
- /* check output luminance variation with a diagonal input */
- /* change. */
- if (use_sx == -1) {
- int lc; /* Luminance channel */
-
- /* Determine where the luminence is carried in the output */
- switch(outs) {
-
- /* Luminence is carried by the sum of all the output channels */
- case icSigRgbData:
- case icSigGrayData:
- case icSigCmykData:
- case icSigCmyData:
- case icSigMch6Data:
- lc = -1; /* Average all channels */
- break;
-
- /* A single channel carries the luminence information */
- case icSigLabData:
- case icSigLuvData:
- case icSigYCbCrData:
- case icSigYxyData:
- lc = 0;
- break;
-
- case icSigXYZData:
- case icSigHlsData:
- lc = 1;
- break;
-
- case icSigHsvData:
- lc = 2;
- break;
-
- /* default means give up and use N-linear type lookup */
- default:
- lc = -2;
- break;
- }
-
- /* If we know how luminance is represented in output space */
- if (lc != -2) {
- double tout1[MAX_CHAN]; /* Test output values */
- double tout2[MAX_CHAN];
- double tt, diag;
- int n;
-
- /* Determine input space location of min and max of */
- /* given output channel (chan = -1 means average of all) */
- p->lut->min_max(p->lut, tout1, tout2, lc);
-
- /* Convert to vector and then calculate normalized */
- /* dot product with diagonal vector (1,1,1...) */
- for (tt = 0.0, n = 0; n < inn; n++) {
- tout1[n] = tout2[n] - tout1[n];
- tt += tout1[n] * tout1[n];
- }
- if (tt > 0.0)
- tt = sqrt(tt); /* normalizing factor for maximum delta */
- else
- tt = 1.0; /* Hmm. */
- tt *= sqrt((double)inn); /* Normalizing factor for diagonal vector */
- for (diag = 0.0, n = 0; n < outn; n++)
- diag += tout1[n] / tt;
- diag = fabs(diag);
-
- /* I'm not really convinced that this is a reliable */
- /* indicator of whether simplex interpolation should be used ... */
- /* It does seem to do the right thing with YCC space though. */
- if (diag > 0.8) /* Diagonal is dominant ? */
- use_sx = 1;
-
- /* If we couldn't figure it out, use N-linear interpolation */
- if (use_sx == -1)
- use_sx = 0;
- }
- }
-
- if (use_sx) {
- p->lookup_clut = p->lut->lookup_clut_sx;
- } else
- p->lookup_clut = p->lut->lookup_clut_nl;
- }
- return (icmLuBase *)p;
+ icmXYZNumber whitePoint, /* Profile absolute white point */
+ icmXYZNumber blackPoint, /* Profile absolute black point */
+ icRenderingIntent intent, /* Rendering intent */
+ icmLookupFunc func /* Functionality requested */
+) {
+ icmLuLut *p;
+
+ if ((p = (icmLuLut *) icp->al->calloc(icp->al,1,sizeof(icmLuLut))) == NULL)
+ return NULL;
+ p->ttype = icmLutType;
+ p->icp = icp;
+ p->del = icmLuLut_delete;
+ p->lutspaces= icmLutSpaces;
+ p->spaces = icmLuSpaces;
+ p->wh_bk_points = icmLuWh_bk_points;
+
+ p->lookup = icmLuLut_lookup;
+ p->in_abs = icmLuLut_in_abs;
+ p->matrix = icmLuLut_matrix;
+ p->input = icmLuLut_input;
+ p->clut = icmLuLut_clut;
+ p->output = icmLuLut_output;
+ p->out_abs = icmLuLut_out_abs;
+
+ p->inv_in_abs = icmLuLut_inv_in_abs;
+ p->inv_matrix = icmLuLut_inv_matrix;
+ p->inv_input = icmLuLut_inv_input;
+ p->inv_output = icmLuLut_inv_output;
+ p->inv_out_abs = icmLuLut_inv_out_abs;
+
+ p->pcswht = icp->header->illuminant;
+ p->whitePoint = whitePoint;
+ p->blackPoint = blackPoint;
+ p->intent = intent;
+ p->function = func;
+ p->inSpace = inSpace;
+ p->outSpace = outSpace;
+ p->pcs = pcs;
+ p->e_inSpace = e_inSpace;
+ p->e_outSpace = e_outSpace;
+ p->e_pcs = e_pcs;
+ p->get_info = icmLuLut_get_info;
+ p->get_lutranges = icmLuLut_get_lutranges;
+ p->get_ranges = icmLuLut_get_ranges;
+ p->get_matrix = icmLuLut_get_matrix;
+
+ /* Create absolute <-> relative conversion matricies */
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, whitePoint, icmD50, p->toAbs);
+ icmChromAdaptMatrix(ICM_CAM_BRADFORD, icmD50, whitePoint, p->fromAbs);
+
+ /* Get the Lut tag, & check that it is expected type */
+ if ((p->lut = (icmLut *)icp->read_tag(icp, ttag)) == NULL
+ || (p->lut->ttype != icSigLut8Type && p->lut->ttype != icSigLut16Type)) {
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Check if matrix should be used */
+ if (inSpace == icSigXYZData && p->lut->nu_matrix(p->lut))
+ p->usematrix = 1;
+ else
+ p->usematrix = 0;
+
+ /* Lookup input color space to normalized index function */
+ if (getNormFunc(inSpace, p->lut->ttype, icmToLuti, &p->in_normf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Lookup normalized index to input color space function */
+ if (getNormFunc(inSpace, p->lut->ttype, icmFromLuti, &p->in_denormf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Lookup output color space to normalized Lut entry value function */
+ if (getNormFunc(outSpace, p->lut->ttype, icmToLutv, &p->out_normf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Lookup normalized Lut entry value to output color space function */
+ if (getNormFunc(outSpace, p->lut->ttype, icmFromLutv, &p->out_denormf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Lookup normalized index to effective input color space function */
+ if (getNormFunc(e_inSpace, p->lut->ttype, icmFromLuti, &p->e_in_denormf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown effective colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Lookup normalized Lut entry value to effective output color space function */
+ if (getNormFunc(e_outSpace, p->lut->ttype, icmFromLutv, &p->e_out_denormf)) {
+ sprintf(icp->err,"icc_get_luobj: Unknown effective colorspace");
+ icp->errc = 1;
+ p->del((icmLuBase *)p);
+ return NULL;
+ }
+
+ /* Determine appropriate clut lookup algorithm */
+ {
+ int use_sx; /* -1 = undecided, 0 = N-linear, 1 = Simplex lookup */
+ icColorSpaceSignature ins, outs; /* In and out Lut color spaces */
+ int inn, outn; /* in and out number of Lut components */
+
+ p->lutspaces((icmLuBase *)p, &ins, &inn, &outs, &outn);
+
+ /* Determine if the input space is "Device" like, */
+ /* ie. luminance will be expected to vary most strongly */
+ /* with the diagonal change in input coordinates. */
+ switch(ins) {
+
+ /* Luminence is carried by the sum of all the output channels, */
+ /* so output luminence will dominantly be in diagonal direction. */
+ case icSigRgbData:
+ case icSigGrayData:
+ case icSigCmykData:
+ case icSigCmyData:
+ case icSigMch6Data:
+ use_sx = 1; /* Simplex interpolation is appropriate */
+ break;
+
+ /* A single channel carries the luminence information */
+ case icSigLabData:
+ case icSigLuvData:
+ case icSigYCbCrData:
+ case icSigYxyData:
+ case icSigXYZData:
+ case icSigHlsData:
+ case icSigHsvData:
+ use_sx = 0; /* N-linear interpolation is appropriate */
+ break;
+ default:
+ use_sx = -1; /* undecided */
+ break;
+ }
+
+ /* If we couldn't figure it out from the input space, */
+ /* check output luminance variation with a diagonal input */
+ /* change. */
+ if (use_sx == -1) {
+ int lc; /* Luminance channel */
+
+ /* Determine where the luminence is carried in the output */
+ switch(outs) {
+
+ /* Luminence is carried by the sum of all the output channels */
+ case icSigRgbData:
+ case icSigGrayData:
+ case icSigCmykData:
+ case icSigCmyData:
+ case icSigMch6Data:
+ lc = -1; /* Average all channels */
+ break;
+
+ /* A single channel carries the luminence information */
+ case icSigLabData:
+ case icSigLuvData:
+ case icSigYCbCrData:
+ case icSigYxyData:
+ lc = 0;
+ break;
+
+ case icSigXYZData:
+ case icSigHlsData:
+ lc = 1;
+ break;
+
+ case icSigHsvData:
+ lc = 2;
+ break;
+
+ /* default means give up and use N-linear type lookup */
+ default:
+ lc = -2;
+ break;
+ }
+
+ /* If we know how luminance is represented in output space */
+ if (lc != -2) {
+ double tout1[MAX_CHAN]; /* Test output values */
+ double tout2[MAX_CHAN];
+ double tt, diag;
+ int n;
+
+ /* Determine input space location of min and max of */
+ /* given output channel (chan = -1 means average of all) */
+ p->lut->min_max(p->lut, tout1, tout2, lc);
+
+ /* Convert to vector and then calculate normalized */
+ /* dot product with diagonal vector (1,1,1...) */
+ for (tt = 0.0, n = 0; n < inn; n++) {
+ tout1[n] = tout2[n] - tout1[n];
+ tt += tout1[n] * tout1[n];
+ }
+ if (tt > 0.0)
+ tt = sqrt(tt); /* normalizing factor for maximum delta */
+ else
+ tt = 1.0; /* Hmm. */
+ tt *= sqrt((double)inn); /* Normalizing factor for diagonal vector */
+ for (diag = 0.0, n = 0; n < outn; n++)
+ diag += tout1[n] / tt;
+ diag = fabs(diag);
+
+ /* I'm not really convinced that this is a reliable */
+ /* indicator of whether simplex interpolation should be used ... */
+ /* It does seem to do the right thing with YCC space though. */
+ if (diag > 0.8) /* Diagonal is dominant ? */
+ use_sx = 1;
+
+ /* If we couldn't figure it out, use N-linear interpolation */
+ if (use_sx == -1)
+ use_sx = 0;
+ }
+ }
+
+ if (use_sx) {
+ p->lookup_clut = p->lut->lookup_clut_sx;
+ } else
+ p->lookup_clut = p->lut->lookup_clut_nl;
+ }
+ return (icmLuBase *)p;
}
/* - - - - - - - - - - - - - - - - - - - - - - - */
@@ -12539,496 +12518,496 @@ new_icmLuLut(
/* Return an appropriate lookup object */
/* Return NULL on error, and detailed error in icc */
static icmLuBase* icc_get_luobj (
- icc *p, /* ICC */
- icmLookupFunc func, /* Conversion functionality */
- icRenderingIntent intent, /* Rendering intent, including icmAbsoluteColorimetricXYZ */
- icColorSpaceSignature pcsor,/* PCS overide (0 = def) */
- icmLookupOrder order /* Conversion representation search Order */
-) {
- int rv;
- icmLuBase *luobj = NULL; /* Lookup object to return */
- icmXYZNumber whitePoint, blackPoint;
- icColorSpaceSignature pcs, e_pcs; /* PCS and effective PCS */
-
- /* Check that the profile is legal, since we depend on it */
- if ((rv = check_icc_legal(p)) != 0)
- return NULL;
-
- /* Figure out the native and effective PCS */
- e_pcs = pcs = p->header->pcs;
- if (pcsor != icmSigDefaultData)
- e_pcs = pcsor; /* Overide */
-
- /* Get White and Black points from the profile */
- {
- icmXYZArray *whitePointTag, *blackPointTag;
-
- if ((whitePointTag = (icmXYZArray *)p->read_tag(p, icSigMediaWhitePointTag)) == NULL
+ icc *p, /* ICC */
+ icmLookupFunc func, /* Conversion functionality */
+ icRenderingIntent intent, /* Rendering intent, including icmAbsoluteColorimetricXYZ */
+ icColorSpaceSignature pcsor,/* PCS overide (0 = def) */
+ icmLookupOrder order /* Conversion representation search Order */
+) {
+ int rv;
+ icmLuBase *luobj = NULL; /* Lookup object to return */
+ icmXYZNumber whitePoint, blackPoint;
+ icColorSpaceSignature pcs, e_pcs; /* PCS and effective PCS */
+
+ /* Check that the profile is legal, since we depend on it */
+ if ((rv = check_icc_legal(p)) != 0)
+ return NULL;
+
+ /* Figure out the native and effective PCS */
+ e_pcs = pcs = p->header->pcs;
+ if (pcsor != icmSigDefaultData)
+ e_pcs = pcsor; /* Overide */
+
+ /* Get White and Black points from the profile */
+ {
+ icmXYZArray *whitePointTag, *blackPointTag;
+
+ if ((whitePointTag = (icmXYZArray *)p->read_tag(p, icSigMediaWhitePointTag)) == NULL
|| whitePointTag->ttype != icSigXYZType || whitePointTag->size < 1) {
- if (intent == icAbsoluteColorimetric) {
- sprintf(p->err,"icc_lookup: Profile is missing Media White Point Tag");
- p->errc = 1;
- return NULL;
- }
- whitePoint = icmD50; /* safe value */
- } else
- whitePoint = whitePointTag->data[0]; /* Copy structure */
-
- if ((blackPointTag = (icmXYZArray *)p->read_tag(p, icSigMediaBlackPointTag)) == NULL
+ if (intent == icAbsoluteColorimetric) {
+ sprintf(p->err,"icc_lookup: Profile is missing Media White Point Tag");
+ p->errc = 1;
+ return NULL;
+ }
+ whitePoint = icmD50; /* safe value */
+ } else
+ whitePoint = whitePointTag->data[0]; /* Copy structure */
+
+ if ((blackPointTag = (icmXYZArray *)p->read_tag(p, icSigMediaBlackPointTag)) == NULL
|| blackPointTag->ttype != icSigXYZType || blackPointTag->size < 1) {
- blackPoint = icmBlack; /* default */
- p->errc = 0; /* reset the error code. black point is NOT required */
- } else
- blackPoint = blackPointTag->data[0]; /* Copy structure */
- }
-
- /* How we expect to execute the request depends firstly on the type of profile */
- switch (p->header->deviceClass) {
- case icSigInputClass:
- case icSigDisplayClass:
- /* Look for AToB0 based profile + optional BToA0 reverse */
- /* or three component matrix profile (reversable) */
- /* or momochrome table profile (reversable) */
- /* No intent */
- /* Device <-> PCS */
- /* Determine the algorithm and set its parameters */
-
- if (intent != icmDefaultIntent
- && intent != icAbsoluteColorimetric) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Input/Display profile");
- p->errc = 1;
- return NULL;
- }
-
- switch (func) {
- case icmFwd: /* Device to PCS */
- if (order != icmLuOrdRev) {
- /* Try Lut type lookup first */
- if ((luobj = new_icmLuLut(p, icSigAToB0Tag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- } else {
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* Try Lut type lookup last */
- if ((luobj = new_icmLuLut(p, icSigAToB0Tag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- }
- break;
-
- case icmBwd: /* PCS to Device */
- if (order != icmLuOrdRev) {
- /* Try Lut type lookup first */
- if ((luobj = new_icmLuLut(p, icSigBToA0Tag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- } else {
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* Try Lut type lookup last */
- if ((luobj = new_icmLuLut(p, icSigBToA0Tag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- }
- break;
-
- default:
- sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
- p->errc = 1;
- return NULL;
- }
- break;
-
- case icSigOutputClass:
- /* Expect BToA Lut and optional AToB Lut, All intents, expect gamut */
- /* or momochrome table profile (reversable) */
- /* Device <-> PCS */
- /* Gamut Lut - no intent */
- /* Optional preview links PCS <-> PCS */
-
- /* Determine the algorithm and set its parameters */
- switch (func) {
- icTagSignature ttag;
-
- case icmFwd: /* Device to PCS */
-
- if (intent == icmDefaultIntent)
- intent = icRelativeColorimetric; /* Make this the default */
-
- switch (intent) {
- case icRelativeColorimetric:
- case icAbsoluteColorimetric:
- ttag = icSigAToB1Tag;
- break;
- case icPerceptual:
- ttag = icSigAToB0Tag;
- break;
- case icSaturation:
- ttag = icSigAToB2Tag;
- break;
- default:
- sprintf(p->err,"icc_get_luobj: Unknown intent");
- p->errc = 1;
- return NULL;
- }
-
- if (order != icmLuOrdRev) {
- /* Try Lut type lookup first */
- if ((luobj = new_icmLuLut(p, ttag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- } else {
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixFwd(p,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* Try Lut type lookup last */
- if ((luobj = new_icmLuLut(p, ttag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- }
- break;
-
- case icmBwd: /* PCS to Device */
-
- if (intent == icmDefaultIntent)
- intent = icRelativeColorimetric; /* Make this the default */
-
- switch (intent) {
- case icRelativeColorimetric:
- case icAbsoluteColorimetric:
- ttag = icSigBToA1Tag;
- break;
- case icPerceptual:
- ttag = icSigBToA0Tag;
- break;
- case icSaturation:
- ttag = icSigBToA2Tag;
- break;
- default:
- sprintf(p->err,"icc_get_luobj: Unknown intent");
- p->errc = 1;
- return NULL;
- }
-
- if (order != icmLuOrdRev) {
- /* Try Lut type lookup first */
- if ((luobj = new_icmLuLut(p, ttag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- } else {
- /* See if it could be a monochrome lookup */
- if ((luobj = new_icmLuMonoBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* See if it could be a matrix lookup */
- if ((luobj = new_icmLuMatrixBwd(p,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
-
- /* Try Lut type lookup last */
- if ((luobj = new_icmLuLut(p, ttag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func)) != NULL)
- break;
- }
- break;
-
- case icmGamut: /* PCS to 1D */
-
- if (intent != icmDefaultIntent) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for type of function");
- p->errc = 1;
- return NULL;
- }
-
- /* If the target tag exists, and it is a Lut */
- luobj = new_icmLuLut(p, icSigGamutTag,
- pcs, icSigGrayData, pcs,
- e_pcs, icSigGrayData, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- case icmPreview: /* PCS to PCS */
-
- switch (intent) {
- case icRelativeColorimetric:
- ttag = icSigPreview1Tag;
- break;
- case icPerceptual:
- ttag = icSigPreview0Tag;
- break;
- case icSaturation:
- ttag = icSigPreview2Tag;
- break;
- case icAbsoluteColorimetric:
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for type of function");
- p->errc = 1;
- return NULL;
- default:
- sprintf(p->err,"icc_get_luobj: Unknown intent");
- p->errc = 1;
- return NULL;
- }
-
- /* If the target tag exists, and it is a Lut */
- luobj = new_icmLuLut(p, ttag,
- pcs, pcs, pcs,
- e_pcs, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- default:
- sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
- p->errc = 1;
- return NULL;
- }
- break;
-
- case icSigLinkClass:
- /* Expect AToB0 Lut and optional BToA0 Lut, One intent in header */
- /* Device <-> Device */
-
- if (intent != p->header->renderingIntent
- && intent != icmDefaultIntent) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Link profile");
- p->errc = 1;
- return NULL;
- }
- intent = p->header->renderingIntent;
-
- /* Determine the algorithm and set its parameters */
- switch (func) {
- case icmFwd: /* Device to PCS (== Device) */
-
- luobj = new_icmLuLut(p, icSigAToB0Tag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, pcs, pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- case icmBwd: /* PCS (== Device) to Device */
-
- luobj = new_icmLuLut(p, icSigBToA0Tag,
- pcs, p->header->colorSpace, pcs,
- pcs, p->header->colorSpace, pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- default:
- sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
- p->errc = 1;
- return NULL;
- }
- break;
-
- case icSigAbstractClass:
- /* Expect AToB0 Lut and BToA Lut, no intents */
- /* PCS <-> PCS */
- /* Determine the algorithm and set its parameters */
-
- if (intent != icmDefaultIntent) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Abstract profile");
- p->errc = 1;
- return NULL;
- }
-
- switch (func) {
- case icmFwd: /* PCS (== Device) to PCS */
-
- luobj = new_icmLuLut(p, icSigAToB0Tag,
- p->header->colorSpace, pcs, pcs,
- e_pcs, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- case icmBwd: /* PCS to PCS (== Device) */
-
- luobj = new_icmLuLut(p, icSigBToA0Tag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- default:
- sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
- p->errc = 1;
- return NULL;
- }
- break;
-
- case icSigColorSpaceClass:
- /* Expect AToB0 Lut and BToA0 Lut, no intents, */
- /* Device <-> PCS */
-
- if (intent != icmDefaultIntent) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Colorspace profile");
- p->errc = 1;
- return NULL;
- }
-
- /* Determine the algorithm and set its parameters */
- switch (func) {
- case icmFwd: /* Device to PCS */
-
- luobj = new_icmLuLut(p, icSigAToB0Tag,
- p->header->colorSpace, pcs, pcs,
- p->header->colorSpace, e_pcs, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- case icmBwd: /* PCS to Device */
-
- luobj = new_icmLuLut(p, icSigBToA0Tag,
- pcs, p->header->colorSpace, pcs,
- e_pcs, p->header->colorSpace, e_pcs,
- whitePoint, blackPoint, intent, func);
- break;
-
- default:
- sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
- p->errc = 1;
- return NULL;
- }
- break;
-
- case icSigNamedColorClass:
- /* Expect Name -> Device, Optional PCS */
- /* and a reverse lookup would be useful */
- /* (ie. PCS or Device coords to closest named color) */
- /* ~~ to be implemented ~~ */
-
- /* ~~ Absolute intent is valid for processing of */
- /* PCS from named Colors. Also allow for e_pcs */
- if (intent != icmDefaultIntent) {
- sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Named Color profile");
- p->errc = 1;
- return NULL;
- }
-
- sprintf(p->err,"icc_get_luobj: Named Colors not handled yet");
- p->errc = 1;
- return NULL;
-
- default:
- sprintf(p->err,"icc_get_luobj: Unknown profile class");
- p->errc = 1;
- return NULL;
- }
-
- return luobj;
+ blackPoint = icmBlack; /* default */
+ p->errc = 0; /* reset the error code. black point is NOT required */
+ } else
+ blackPoint = blackPointTag->data[0]; /* Copy structure */
+ }
+
+ /* How we expect to execute the request depends firstly on the type of profile */
+ switch (p->header->deviceClass) {
+ case icSigInputClass:
+ case icSigDisplayClass:
+ /* Look for AToB0 based profile + optional BToA0 reverse */
+ /* or three component matrix profile (reversable) */
+ /* or momochrome table profile (reversable) */
+ /* No intent */
+ /* Device <-> PCS */
+ /* Determine the algorithm and set its parameters */
+
+ if (intent != icmDefaultIntent
+ && intent != icAbsoluteColorimetric) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Input/Display profile");
+ p->errc = 1;
+ return NULL;
+ }
+
+ switch (func) {
+ case icmFwd: /* Device to PCS */
+ if (order != icmLuOrdRev) {
+ /* Try Lut type lookup first */
+ if ((luobj = new_icmLuLut(p, icSigAToB0Tag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ } else {
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* Try Lut type lookup last */
+ if ((luobj = new_icmLuLut(p, icSigAToB0Tag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ }
+ break;
+
+ case icmBwd: /* PCS to Device */
+ if (order != icmLuOrdRev) {
+ /* Try Lut type lookup first */
+ if ((luobj = new_icmLuLut(p, icSigBToA0Tag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ } else {
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* Try Lut type lookup last */
+ if ((luobj = new_icmLuLut(p, icSigBToA0Tag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ }
+ break;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
+ p->errc = 1;
+ return NULL;
+ }
+ break;
+
+ case icSigOutputClass:
+ /* Expect BToA Lut and optional AToB Lut, All intents, expect gamut */
+ /* or momochrome table profile (reversable) */
+ /* Device <-> PCS */
+ /* Gamut Lut - no intent */
+ /* Optional preview links PCS <-> PCS */
+
+ /* Determine the algorithm and set its parameters */
+ switch (func) {
+ icTagSignature ttag;
+
+ case icmFwd: /* Device to PCS */
+
+ if (intent == icmDefaultIntent)
+ intent = icRelativeColorimetric; /* Make this the default */
+
+ switch (intent) {
+ case icRelativeColorimetric:
+ case icAbsoluteColorimetric:
+ ttag = icSigAToB1Tag;
+ break;
+ case icPerceptual:
+ ttag = icSigAToB0Tag;
+ break;
+ case icSaturation:
+ ttag = icSigAToB2Tag;
+ break;
+ default:
+ sprintf(p->err,"icc_get_luobj: Unknown intent");
+ p->errc = 1;
+ return NULL;
+ }
+
+ if (order != icmLuOrdRev) {
+ /* Try Lut type lookup first */
+ if ((luobj = new_icmLuLut(p, ttag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ } else {
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixFwd(p,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* Try Lut type lookup last */
+ if ((luobj = new_icmLuLut(p, ttag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ }
+ break;
+
+ case icmBwd: /* PCS to Device */
+
+ if (intent == icmDefaultIntent)
+ intent = icRelativeColorimetric; /* Make this the default */
+
+ switch (intent) {
+ case icRelativeColorimetric:
+ case icAbsoluteColorimetric:
+ ttag = icSigBToA1Tag;
+ break;
+ case icPerceptual:
+ ttag = icSigBToA0Tag;
+ break;
+ case icSaturation:
+ ttag = icSigBToA2Tag;
+ break;
+ default:
+ sprintf(p->err,"icc_get_luobj: Unknown intent");
+ p->errc = 1;
+ return NULL;
+ }
+
+ if (order != icmLuOrdRev) {
+ /* Try Lut type lookup first */
+ if ((luobj = new_icmLuLut(p, ttag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ } else {
+ /* See if it could be a monochrome lookup */
+ if ((luobj = new_icmLuMonoBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* See if it could be a matrix lookup */
+ if ((luobj = new_icmLuMatrixBwd(p,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+
+ /* Try Lut type lookup last */
+ if ((luobj = new_icmLuLut(p, ttag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func)) != NULL)
+ break;
+ }
+ break;
+
+ case icmGamut: /* PCS to 1D */
+
+ if (intent != icmDefaultIntent) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for type of function");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* If the target tag exists, and it is a Lut */
+ luobj = new_icmLuLut(p, icSigGamutTag,
+ pcs, icSigGrayData, pcs,
+ e_pcs, icSigGrayData, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ case icmPreview: /* PCS to PCS */
+
+ switch (intent) {
+ case icRelativeColorimetric:
+ ttag = icSigPreview1Tag;
+ break;
+ case icPerceptual:
+ ttag = icSigPreview0Tag;
+ break;
+ case icSaturation:
+ ttag = icSigPreview2Tag;
+ break;
+ case icAbsoluteColorimetric:
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for type of function");
+ p->errc = 1;
+ return NULL;
+ default:
+ sprintf(p->err,"icc_get_luobj: Unknown intent");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* If the target tag exists, and it is a Lut */
+ luobj = new_icmLuLut(p, ttag,
+ pcs, pcs, pcs,
+ e_pcs, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
+ p->errc = 1;
+ return NULL;
+ }
+ break;
+
+ case icSigLinkClass:
+ /* Expect AToB0 Lut and optional BToA0 Lut, One intent in header */
+ /* Device <-> Device */
+
+ if (intent != p->header->renderingIntent
+ && intent != icmDefaultIntent) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Link profile");
+ p->errc = 1;
+ return NULL;
+ }
+ intent = p->header->renderingIntent;
+
+ /* Determine the algorithm and set its parameters */
+ switch (func) {
+ case icmFwd: /* Device to PCS (== Device) */
+
+ luobj = new_icmLuLut(p, icSigAToB0Tag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, pcs, pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ case icmBwd: /* PCS (== Device) to Device */
+
+ luobj = new_icmLuLut(p, icSigBToA0Tag,
+ pcs, p->header->colorSpace, pcs,
+ pcs, p->header->colorSpace, pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
+ p->errc = 1;
+ return NULL;
+ }
+ break;
+
+ case icSigAbstractClass:
+ /* Expect AToB0 Lut and BToA Lut, no intents */
+ /* PCS <-> PCS */
+ /* Determine the algorithm and set its parameters */
+
+ if (intent != icmDefaultIntent) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Abstract profile");
+ p->errc = 1;
+ return NULL;
+ }
+
+ switch (func) {
+ case icmFwd: /* PCS (== Device) to PCS */
+
+ luobj = new_icmLuLut(p, icSigAToB0Tag,
+ p->header->colorSpace, pcs, pcs,
+ e_pcs, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ case icmBwd: /* PCS to PCS (== Device) */
+
+ luobj = new_icmLuLut(p, icSigBToA0Tag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
+ p->errc = 1;
+ return NULL;
+ }
+ break;
+
+ case icSigColorSpaceClass:
+ /* Expect AToB0 Lut and BToA0 Lut, no intents, */
+ /* Device <-> PCS */
+
+ if (intent != icmDefaultIntent) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Colorspace profile");
+ p->errc = 1;
+ return NULL;
+ }
+
+ /* Determine the algorithm and set its parameters */
+ switch (func) {
+ case icmFwd: /* Device to PCS */
+
+ luobj = new_icmLuLut(p, icSigAToB0Tag,
+ p->header->colorSpace, pcs, pcs,
+ p->header->colorSpace, e_pcs, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ case icmBwd: /* PCS to Device */
+
+ luobj = new_icmLuLut(p, icSigBToA0Tag,
+ pcs, p->header->colorSpace, pcs,
+ e_pcs, p->header->colorSpace, e_pcs,
+ whitePoint, blackPoint, intent, func);
+ break;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Inaproptiate function requested");
+ p->errc = 1;
+ return NULL;
+ }
+ break;
+
+ case icSigNamedColorClass:
+ /* Expect Name -> Device, Optional PCS */
+ /* and a reverse lookup would be useful */
+ /* (ie. PCS or Device coords to closest named color) */
+ /* ~~ to be implemented ~~ */
+
+ /* ~~ Absolute intent is valid for processing of */
+ /* PCS from named Colors. Also allow for e_pcs */
+ if (intent != icmDefaultIntent) {
+ sprintf(p->err,"icc_get_luobj: Intent is inappropriate for Named Color profile");
+ p->errc = 1;
+ return NULL;
+ }
+
+ sprintf(p->err,"icc_get_luobj: Named Colors not handled yet");
+ p->errc = 1;
+ return NULL;
+
+ default:
+ sprintf(p->err,"icc_get_luobj: Unknown profile class");
+ p->errc = 1;
+ return NULL;
+ }
+
+ return luobj;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - */
@@ -13037,81 +13016,79 @@ static icmLuBase* icc_get_luobj (
icc *new_icc_a(
icmAlloc *al /* Optional memory allocator. NULL for default */
) {
- icc *p;
- int del_al = 0;
-
- if (al == NULL) { /* None provided, create default */
- if ((al = new_icmAllocStd()) == NULL)
- return NULL;
- del_al = 1; /* We need to delete it */
- }
-
- if ((p = (icc *) al->calloc(al, 1,sizeof(icc))) == NULL)
- return NULL;
- p->al = al; /* Heap allocator */
- p->del_al = del_al; /* Flag noting whether we delete it */
-
- p->get_size = icc_get_size;
- p->read = icc_read;
- p->write = icc_write;
- p->dump = icc_dump;
- p->del = icc_delete;
- p->add_tag = icc_add_tag;
- p->link_tag = icc_link_tag;
- p->find_tag = icc_find_tag;
- p->read_tag = icc_read_tag;
- p->rename_tag = icc_rename_tag;
- p->unread_tag = icc_unread_tag;
- p->read_all_tags = icc_read_all_tags;
- p->delete_tag = icc_delete_tag;
-
- p->get_luobj = icc_get_luobj;
+ icc *p;
+ int del_al = 0;
+
+ if (al == NULL) { /* None provided, create default */
+ if ((al = new_icmAllocStd()) == NULL)
+ return NULL;
+ del_al = 1; /* We need to delete it */
+ }
+
+ if ((p = (icc *) al->calloc(al, 1,sizeof(icc))) == NULL)
+ return NULL;
+ p->al = al; /* Heap allocator */
+ p->del_al = del_al; /* Flag noting whether we delete it */
+
+ p->get_size = icc_get_size;
+ p->read = icc_read;
+ p->write = icc_write;
+ p->dump = icc_dump;
+ p->del = icc_delete;
+ p->add_tag = icc_add_tag;
+ p->link_tag = icc_link_tag;
+ p->find_tag = icc_find_tag;
+ p->read_tag = icc_read_tag;
+ p->rename_tag = icc_rename_tag;
+ p->unread_tag = icc_unread_tag;
+ p->read_all_tags = icc_read_all_tags;
+ p->delete_tag = icc_delete_tag;
+
+ p->get_luobj = icc_get_luobj;
#if defined(__IBMC__) && defined(_M_IX86)
- _control87(EM_UNDERFLOW, EM_UNDERFLOW);
+ _control87(EM_UNDERFLOW, EM_UNDERFLOW);
#endif
- /* Allocate a header object */
- if ((p->header = new_icmHeader(p)) == NULL) {
- al->free(al, p);
- if (del_al)
- al->del(al);
- return NULL;
- }
+ /* Allocate a header object */
+ if ((p->header = new_icmHeader(p)) == NULL) {
+ al->free(al, p);
+ if (del_al)
+ al->del(al);
+ return NULL;
+ }
- /* Values that must be set before writing */
- p->header->deviceClass = icMaxEnumClass;/* Type of profile - must be set! */
+ /* Values that must be set before writing */
+ p->header->deviceClass = icMaxEnumClass;/* Type of profile - must be set! */
p->header->colorSpace = icMaxEnumData; /* Clr space of data - must be set! */
p->header->pcs = icMaxEnumData; /* PCS: XYZ or Lab - must be set! */
p->header->renderingIntent = icMaxEnumIntent; /* Rendering intent - must be set ! */
- /* Values that should be set before writing */
- p->header->manufacturer = -1; /* Dev manufacturer - should be set ! */
+ /* Values that should be set before writing */
+ p->header->manufacturer = -1; /* Dev manufacturer - should be set ! */
p->header->model = -1; /* Dev model number - should be set ! */
p->header->attributes.l = 0; /* ICC Device attributes - should set ! */
p->header->flags = 0; /* Embedding flags - should be set ! */
-
- /* Values that may be set before writing */
+
+ /* Values that may be set before writing */
p->header->attributes.h = 0; /* Dev Device attributes - may be set ! */
p->header->creator = str2tag("argl"); /* Profile creator - Argyll - may be set ! */
- /* Init default values in header */
- p->header->cmmId = str2tag("argl"); /* CMM for profile - Argyll CMM */
+ /* Init default values in header */
+ p->header->cmmId = str2tag("argl"); /* CMM for profile - Argyll CMM */
p->header->majv = 2; /* Current version 2.1.0 */
- p->header->minv = 1;
- p->header->bfv = 0;
- setcur_DateTimeNumber(&p->header->date);/* Creation Date */
+ p->header->minv = 1;
+ p->header->bfv = 0;
+ setcur_DateTimeNumber(&p->header->date);/* Creation Date */
p->header->platform = icSigMicrosoft; /* Primary Platform */
p->header->illuminant = icmD50; /* Profile illuminant - D50 */
- return p;
+ return p;
}
-
/* For backwards compatibility - a NULL allocator version */
icc *new_icc(void) {
- return new_icc_a(NULL);
+ return new_icc_a(NULL);
}
-
/* ---------------------------------------------------------- */
diff --git a/gs/icclib/icc.h b/gs/icclib/icc.h
index c2928129e..7631022b1 100644
--- a/gs/icclib/icc.h
+++ b/gs/icclib/icc.h
@@ -1,6 +1,6 @@
#ifndef ICC_H
#define ICC_H
-/*
+/*
* International Color Consortium Format Library (icclib)
*
* Author: Graeme W. Gill
@@ -11,7 +11,6 @@
* Please refer to Licence.txt file for details.
*/
-
/* We can get some subtle errors if certain headers aren't included */
#include <stdio.h>
#include <stdlib.h>
@@ -25,7 +24,6 @@
* Note XYZ scaling to 1.0, not 100.0
*/
-
/* Make allowance for shared library use */
#ifdef ICCLIB_SHARED /* Compiling or Using shared library version */
# ifdef ICCLIB_EXPORTS /* Compiling shared library */
@@ -46,12 +44,10 @@
# define ICCLIB_API /* empty */
#endif
-
#ifdef __cplusplus
- extern "C" {
+ extern "C" {
#endif
-
/* ---------------------------------------------- */
/* Platform specific defines */
/* It is assumed that the native machine size is 32 bits */
@@ -74,7 +70,7 @@
#define ORD32 unsigned long /* 32 bit unsigned */
#endif
-#include "icc9809.h" /* Standard ICC definitions, version ICC.1:1998-09 with mods noted. */
+#include "icc9809.h" /* Standard ICC definitions, version ICC.1:1998-09 with mods noted. */
/* Note that the prefix icm is used for the native Machine */
/* equivalents of the file structures defined in icc34.h */
@@ -85,39 +81,37 @@
/* File access class interface definition */
#define ICM_FILE_BASE \
- /* Public: */ \
- \
- /* Set current position to offset. Return 0 on success, nz on failure. */ \
- int (*seek) (struct _icmFile *p, long int offset); \
- \
- /* Read count items of size length. Return number of items successfully read. */ \
- size_t (*read) (struct _icmFile *p, void *buffer, size_t size, size_t count); \
- \
- /* write count items of size length. Return number of items successfully written. */ \
- size_t (*write)(struct _icmFile *p, void *buffer, size_t size, size_t count); \
- \
- /* flush all write data out to secondary storage. Return nz on failure. */ \
- int (*flush)(struct _icmFile *p); \
- \
- /* we're done with the file object, return nz on failure */ \
- int (*del)(struct _icmFile *p); \
-
+ /* Public: */ \
+ \
+ /* Set current position to offset. Return 0 on success, nz on failure. */ \
+ int (*seek) (struct _icmFile *p, long int offset); \
+ \
+ /* Read count items of size length. Return number of items successfully read. */ \
+ size_t (*read) (struct _icmFile *p, void *buffer, size_t size, size_t count); \
+ \
+ /* write count items of size length. Return number of items successfully written. */ \
+ size_t (*write)(struct _icmFile *p, void *buffer, size_t size, size_t count); \
+ \
+ /* flush all write data out to secondary storage. Return nz on failure. */ \
+ int (*flush)(struct _icmFile *p); \
+ \
+ /* we're done with the file object, return nz on failure */ \
+ int (*del)(struct _icmFile *p); \
/* Common file interface class */
struct _icmFile {
- ICM_FILE_BASE
+ ICM_FILE_BASE
}; typedef struct _icmFile icmFile;
-
/* - - - - - - - - - - - - - - - - - - - - - */
/* Implementation of file access class based on standard file I/O */
struct _icmFileStd {
- ICM_FILE_BASE
+ ICM_FILE_BASE
- /* Private: */
- FILE *fp;
- int doclose; /* nz if free should close */
+ /* Private: */
+ FILE *fp;
+ int doclose; /* nz if free should close */
}; typedef struct _icmFileStd icmFileStd;
/* Create given a file name */
@@ -126,51 +120,47 @@ icmFile *new_icmFileStd_name(char *name, char *mode);
/* Create given a (binary) FILE* */
icmFile *new_icmFileStd_fp(FILE *fp);
-
-
/* - - - - - - - - - - - - - - - - - - - - - */
/* Implementation of file access class based on a memory image */
struct _icmFileMem {
- ICM_FILE_BASE
+ ICM_FILE_BASE
- /* Private: */
- unsigned char *start, *cur, *end;
+ /* Private: */
+ unsigned char *start, *cur, *end;
}; typedef struct _icmFileMem icmFileMem;
/* Create a memory image file access class */
icmFile *new_icmFileMem(void *base, size_t length);
-
/* - - - - - - - - - - - - - - - - - - - - - */
/* Heap allocator class interface definition */
#define ICM_ALLOC_BASE \
- /* Public: */ \
- \
- void *(*malloc) (struct _icmAlloc *p, size_t size); \
- void *(*calloc) (struct _icmAlloc *p, size_t num, size_t size); \
- void *(*realloc)(struct _icmAlloc *p, void *ptr, size_t size); \
- void (*free) (struct _icmAlloc *p, void *ptr); \
- \
- /* we're done with the allocator object */ \
- void (*del)(struct _icmAlloc *p); \
+ /* Public: */ \
+ \
+ void *(*malloc) (struct _icmAlloc *p, size_t size); \
+ void *(*calloc) (struct _icmAlloc *p, size_t num, size_t size); \
+ void *(*realloc)(struct _icmAlloc *p, void *ptr, size_t size); \
+ void (*free) (struct _icmAlloc *p, void *ptr); \
+ \
+ /* we're done with the allocator object */ \
+ void (*del)(struct _icmAlloc *p); \
/* Common heap allocator interface class */
struct _icmAlloc {
- ICM_ALLOC_BASE
+ ICM_ALLOC_BASE
}; typedef struct _icmAlloc icmAlloc;
/* - - - - - - - - - - - - - - - - - - - - - */
/* Implementation of heap class based on standard system malloc */
struct _icmAllocStd {
- ICM_ALLOC_BASE
+ ICM_ALLOC_BASE
}; typedef struct _icmAllocStd icmAllocStd;
/* Create a standard alloc object */
icmAlloc *new_icmAllocStd(void);
-
/* --------------------------------- */
/* Assumed constants */
@@ -182,12 +172,12 @@ icmAlloc *new_icmAllocStd(void);
typedef int icmSig; /* Otherwise un-enumerated 4 byte signature */
typedef struct {
- ORD32 l; /* High and low components of signed 64 bit */
- INR32 h;
+ ORD32 l; /* High and low components of signed 64 bit */
+ INR32 h;
} icmInt64;
typedef struct {
- ORD32 l,h; /* High and low components of unsigned 64 bit */
+ ORD32 l,h; /* High and low components of unsigned 64 bit */
} icmUint64;
/* XYZ Number */
@@ -199,8 +189,8 @@ typedef struct {
/* Response 16 number */
typedef struct {
- double deviceValue; /* The device value in range 0.0 - 1.0 */
- double measurement; /* The reading value */
+ double deviceValue; /* The device value in range 0.0 - 1.0 */
+ double measurement; /* The reading value */
} icmResponse16Number;
/*
@@ -211,107 +201,107 @@ typedef struct {
*/
#define ICM_BASE_MEMBERS \
- /* Private: */ \
- icTagTypeSignature ttype; /* The tag type signature */ \
- struct _icc *icp; /* Pointer to ICC we're a part of */ \
- int touched; /* Flag for write bookeeping */ \
+ /* Private: */ \
+ icTagTypeSignature ttype; /* The tag type signature */ \
+ struct _icc *icp; /* Pointer to ICC we're a part of */ \
+ int touched; /* Flag for write bookeeping */ \
int refcount; /* Reference count for sharing */ \
- unsigned int (*get_size)(struct _icmBase *p); \
- int (*read)(struct _icmBase *p, unsigned long len, unsigned long of); \
- int (*write)(struct _icmBase *p, unsigned long of); \
- void (*del)(struct _icmBase *p); \
- \
- /* Public: */ \
- void (*dump)(struct _icmBase *p, FILE *op, int verb); \
- int (*allocate)(struct _icmBase *p);
+ unsigned int (*get_size)(struct _icmBase *p); \
+ int (*read)(struct _icmBase *p, unsigned long len, unsigned long of); \
+ int (*write)(struct _icmBase *p, unsigned long of); \
+ void (*del)(struct _icmBase *p); \
+ \
+ /* Public: */ \
+ void (*dump)(struct _icmBase *p, FILE *op, int verb); \
+ int (*allocate)(struct _icmBase *p);
/* Base tag element data object */
struct _icmBase {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
}; typedef struct _icmBase icmBase;
/* UInt8 Array */
struct _icmUInt8Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- unsigned int *data; /* Pointer to array of data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ unsigned int *data; /* Pointer to array of data */
}; typedef struct _icmUInt8Array icmUInt8Array;
/* uInt16 Array */
struct _icmUInt16Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- unsigned int *data; /* Pointer to array of data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ unsigned int *data; /* Pointer to array of data */
}; typedef struct _icmUInt16Array icmUInt16Array;
/* uInt32 Array */
struct _icmUInt32Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- unsigned int *data; /* Pointer to array of data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ unsigned int *data; /* Pointer to array of data */
}; typedef struct _icmUInt32Array icmUInt32Array;
/* UInt64 Array */
struct _icmUInt64Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- icmUint64 *data; /* Pointer to array of hight data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ icmUint64 *data; /* Pointer to array of hight data */
}; typedef struct _icmUInt64Array icmUInt64Array;
/* u16Fixed16 Array */
struct _icmU16Fixed16Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- double *data; /* Pointer to array of hight data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ double *data; /* Pointer to array of hight data */
}; typedef struct _icmU16Fixed16Array icmU16Fixed16Array;
/* s15Fixed16 Array */
struct _icmS15Fixed16Array {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- double *data; /* Pointer to array of hight data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ double *data; /* Pointer to array of hight data */
}; typedef struct _icmS15Fixed16Array icmS15Fixed16Array;
/* XYZ Array */
struct _icmXYZArray {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of the array */
- icmXYZNumber *data; /* Pointer to array of data */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of the array */
+ icmXYZNumber *data; /* Pointer to array of data */
}; typedef struct _icmXYZArray icmXYZArray;
/* Curve */
@@ -324,33 +314,33 @@ typedef enum {
/* Curve reverse lookup information */
typedef struct {
- int inited; /* Flag */
- double rmin, rmax; /* Range of reverse grid */
- double qscale; /* Quantising scale factor */
- long rsize; /* Number of reverse lists */
- int **rlists; /* Array of list of fwd values that may contain output value */
- /* Offset 0 = allocated size */
- /* Offset 1 = next free index */
- /* Offset 2 = first fwd index */
- unsigned long size; /* Copy of forward table size */
- double *data; /* Copy of forward table data */
+ int inited; /* Flag */
+ double rmin, rmax; /* Range of reverse grid */
+ double qscale; /* Quantising scale factor */
+ long rsize; /* Number of reverse lists */
+ int **rlists; /* Array of list of fwd values that may contain output value */
+ /* Offset 0 = allocated size */
+ /* Offset 1 = next free index */
+ /* Offset 2 = first fwd index */
+ unsigned long size; /* Copy of forward table size */
+ double *data; /* Copy of forward table data */
} icmRevTable;
struct _icmCurve {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
- icmRevTable rt; /* Reverse table information */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
+ icmRevTable rt; /* Reverse table information */
- /* Public: */
+ /* Public: */
icmCurveStyle flag; /* Style of curve */
- unsigned long size; /* Allocated and used size of the array */
+ unsigned long size; /* Allocated and used size of the array */
double *data; /* Curve data scaled to range 0.0 - 1.0 */
- /* or data[0] = gamma value */
- /* Translate a value through the curve, return warning flags */
- int (*lookup_fwd) (struct _icmCurve *p, double *out, double *in); /* Forwards */
- int (*lookup_bwd) (struct _icmCurve *p, double *out, double *in); /* Backwards */
+ /* or data[0] = gamma value */
+ /* Translate a value through the curve, return warning flags */
+ int (*lookup_fwd) (struct _icmCurve *p, double *out, double *in); /* Forwards */
+ int (*lookup_bwd) (struct _icmCurve *p, double *out, double *in); /* Backwards */
}; typedef struct _icmCurve icmCurve;
@@ -362,34 +352,34 @@ typedef enum {
} icmDataStyle;
struct _icmData {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
+ /* Public: */
icmDataStyle flag; /* Style of data */
- unsigned long size; /* Allocated and used size of the array (inc ascii null) */
+ unsigned long size; /* Allocated and used size of the array (inc ascii null) */
unsigned char *data; /* data or string, NULL if size == 0 */
}; typedef struct _icmData icmData;
/* text */
struct _icmText {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _size; /* Size currently allocated */
+ /* Private: */
+ unsigned int _size; /* Size currently allocated */
- /* Public: */
- unsigned long size; /* Allocated and used size of desc, inc null */
- char *data; /* ascii string (null terminated), NULL if size==0 */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of desc, inc null */
+ char *data; /* ascii string (null terminated), NULL if size==0 */
}; typedef struct _icmText icmText;
/* The base date time number */
struct _icmDateTimeNumber {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Public: */
+ /* Public: */
unsigned int year;
unsigned int month;
unsigned int day;
@@ -410,105 +400,105 @@ Valid setting = ( (platform == platform1 and platform1.valid)
)
where
- platformN.valid = ( platformN.combination1.valid
- or platformN.combination2.valid
- or ...
- )
+ platformN.valid = ( platformN.combination1.valid
+ or platformN.combination2.valid
+ or ...
+ )
where
- platformN.combinationM.valid = ( platformN.combinationM.settingstruct1.valid
- and platformN.combinationM.settingstruct2.valid
- and ...
- )
+ platformN.combinationM.valid = ( platformN.combinationM.settingstruct1.valid
+ and platformN.combinationM.settingstruct2.valid
+ and ...
+ )
where
- platformN.combinationM.settingstructP.valid = ( platformN.combinationM.settingstructP.setting1.valid
- or platformN.combinationM.settingstructP.setting2.valid
- or ...
- )
+ platformN.combinationM.settingstructP.valid = ( platformN.combinationM.settingstructP.setting1.valid
+ or platformN.combinationM.settingstructP.setting2.valid
+ or ...
+ )
*/
/* The Settings Structure holds an array of settings of a particular type */
struct _icmSettingStruct {
- ICM_BASE_MEMBERS
-
- /* Private: */
- unsigned int _num; /* Size currently allocated */
-
- /* Public: */
- icSettingsSig settingSig; /* Setting identification */
- unsigned long numSettings; /* number of setting values */
- union { /* Setting values - type depends on Sig */
- icUInt64Number *resolution;
- icDeviceMedia *media;
- icDeviceDither *halftone;
- }
+ ICM_BASE_MEMBERS
+
+ /* Private: */
+ unsigned int _num; /* Size currently allocated */
+
+ /* Public: */
+ icSettingsSig settingSig; /* Setting identification */
+ unsigned long numSettings; /* number of setting values */
+ union { /* Setting values - type depends on Sig */
+ icUInt64Number *resolution;
+ icDeviceMedia *media;
+ icDeviceDither *halftone;
+ }
}; typedef struct _icmSettingStruct icmSettingStruct;
/* A Setting Combination holds all arrays of different setting types */
struct _icmSettingComb {
- /* Private: */
- unsigned int _num; /* number currently allocated */
+ /* Private: */
+ unsigned int _num; /* number currently allocated */
- /* Public: */
- unsigned long numStructs; /* num of setting structures */
- icmSettingStruct *data;
+ /* Public: */
+ unsigned long numStructs; /* num of setting structures */
+ icmSettingStruct *data;
}; typedef struct _icmSettingComb icmSettingComb;
/* A Platform Entry holds all setting combinations */
struct _icmPlatformEntry {
- /* Private: */
- unsigned int _num; /* number currently allocated */
+ /* Private: */
+ unsigned int _num; /* number currently allocated */
- /* Public: */
- icPlatformSignature platform;
- unsigned long numCombinations; /* num of settings and allocated array size */
- icmSettingComb *data;
+ /* Public: */
+ icPlatformSignature platform;
+ unsigned long numCombinations; /* num of settings and allocated array size */
+ icmSettingComb *data;
}; typedef struct _icmPlatformEntry icmPlatformEntry;
/* The Device Settings holds all platform settings */
struct _icmDeviceSettings {
- /* Private: */
- unsigned int _num; /* number currently allocated */
+ /* Private: */
+ unsigned int _num; /* number currently allocated */
- /* Public: */
- unsigned long numPlatforms; /* num of platforms and allocated array size */
- icmPlatformEntry *data; /* Array of pointers to platform entry data */
+ /* Public: */
+ unsigned long numPlatforms; /* num of platforms and allocated array size */
+ icmPlatformEntry *data; /* Array of pointers to platform entry data */
}; typedef struct _icmDeviceSettings icmDeviceSettings;
#endif /* NEW */
/* lut */
struct _icmLut {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- /* Cache appropriate normalization routines */
- int dinc[MAX_CHAN]; /* Dimensional increment through clut */
- int dcube[1 << MAX_CHAN]; /* Hyper cube offsets */
- icmRevTable rit; /* Reverse input table information */
- icmRevTable rot; /* Reverse output table information */
+ /* Private: */
+ /* Cache appropriate normalization routines */
+ int dinc[MAX_CHAN]; /* Dimensional increment through clut */
+ int dcube[1 << MAX_CHAN]; /* Hyper cube offsets */
+ icmRevTable rit; /* Reverse input table information */
+ icmRevTable rot; /* Reverse output table information */
- unsigned int inputTable_size; /* size allocated to input table */
- unsigned int clutTable_size; /* size allocated to clut table */
- unsigned int outputTable_size; /* size allocated to output table */
+ unsigned int inputTable_size; /* size allocated to input table */
+ unsigned int clutTable_size; /* size allocated to clut table */
+ unsigned int outputTable_size; /* size allocated to output table */
- /* return the minimum and maximum values of the given channel in the clut */
- void (*min_max) (struct _icmLut *pp, double *minv, double *maxv, int chan);
+ /* return the minimum and maximum values of the given channel in the clut */
+ void (*min_max) (struct _icmLut *pp, double *minv, double *maxv, int chan);
- /* Translate color values through 3x3 matrix, input tables only, multi-dimensional lut, */
- /* or output tables, */
- int (*lookup_matrix) (struct _icmLut *pp, double *out, double *in);
- int (*lookup_input) (struct _icmLut *pp, double *out, double *in);
- int (*lookup_clut_nl) (struct _icmLut *pp, double *out, double *in);
- int (*lookup_clut_sx) (struct _icmLut *pp, double *out, double *in);
- int (*lookup_output) (struct _icmLut *pp, double *out, double *in);
+ /* Translate color values through 3x3 matrix, input tables only, multi-dimensional lut, */
+ /* or output tables, */
+ int (*lookup_matrix) (struct _icmLut *pp, double *out, double *in);
+ int (*lookup_input) (struct _icmLut *pp, double *out, double *in);
+ int (*lookup_clut_nl) (struct _icmLut *pp, double *out, double *in);
+ int (*lookup_clut_sx) (struct _icmLut *pp, double *out, double *in);
+ int (*lookup_output) (struct _icmLut *pp, double *out, double *in);
- /* Public: */
+ /* Public: */
- /* return non zero if matrix is non-unity */
- int (*nu_matrix) (struct _icmLut *pp);
+ /* return non zero if matrix is non-unity */
+ int (*nu_matrix) (struct _icmLut *pp);
unsigned int inputChan; /* Num of input channels */
unsigned int outputChan; /* Num of output channels */
@@ -516,38 +506,38 @@ struct _icmLut {
unsigned int inputEnt; /* Num of in-table entries (must be 256 for Lut8) */
unsigned int outputEnt; /* Num of out-table entries (must be 256 for Lut8) */
double e[3][3]; /* 3 * 3 array */
- double *inputTable; /* The in-table: [inputChan * inputEnt] */
- double *clutTable; /* The clut: [(clutPoints ^ inputChan) * outputChan] */
- double *outputTable; /* The out-table: [outputChan * outputEnt] */
- /* inputTable is organized [inputChan 0..ic-1][inputEnt 0..ie-1] */
- /* clutTable is organized [inputChan 0, 0..cp-1]..[inputChan ic-1, 0..cp-1]
- [outputChan 0..oc-1] */
- /* outputTable is organized [outputChan 0..oc-1][outputEnt 0..oe-1] */
-
- /* Helper function to setup the three tables contents */
- int (*set_tables) (
- struct _icmLut *p, /* Pointer to Lut object */
- void *cbctx, /* Opaque callback context pointer value */
- icColorSpaceSignature insig, /* Input color space */
- icColorSpaceSignature outsig, /* Output color space */
- void (*infunc)(void *cbctx, double *out, double *in),
- /* Input transfer function, inspace->inspace' (NULL = default) */
- double *inmin, double *inmax, /* Maximum range of inspace' values */
- /* (NULL = default) */
- void (*clutfunc)(void *cbntx, double *out, double *in),
- /* inspace' -> outspace' transfer function */
- double *clutmin, double *clutmax, /* Maximum range of outspace' values */
- /* (NULL = default) */
- void (*outfunc)(void *cbntx, double *out, double *in));
- /* Output transfer function, outspace'->outspace (NULL = deflt) */
-
+ double *inputTable; /* The in-table: [inputChan * inputEnt] */
+ double *clutTable; /* The clut: [(clutPoints ^ inputChan) * outputChan] */
+ double *outputTable; /* The out-table: [outputChan * outputEnt] */
+ /* inputTable is organized [inputChan 0..ic-1][inputEnt 0..ie-1] */
+ /* clutTable is organized [inputChan 0, 0..cp-1]..[inputChan ic-1, 0..cp-1]
+ [outputChan 0..oc-1] */
+ /* outputTable is organized [outputChan 0..oc-1][outputEnt 0..oe-1] */
+
+ /* Helper function to setup the three tables contents */
+ int (*set_tables) (
+ struct _icmLut *p, /* Pointer to Lut object */
+ void *cbctx, /* Opaque callback context pointer value */
+ icColorSpaceSignature insig, /* Input color space */
+ icColorSpaceSignature outsig, /* Output color space */
+ void (*infunc)(void *cbctx, double *out, double *in),
+ /* Input transfer function, inspace->inspace' (NULL = default) */
+ double *inmin, double *inmax, /* Maximum range of inspace' values */
+ /* (NULL = default) */
+ void (*clutfunc)(void *cbntx, double *out, double *in),
+ /* inspace' -> outspace' transfer function */
+ double *clutmin, double *clutmax, /* Maximum range of outspace' values */
+ /* (NULL = default) */
+ void (*outfunc)(void *cbntx, double *out, double *in));
+ /* Output transfer function, outspace'->outspace (NULL = deflt) */
+
}; typedef struct _icmLut icmLut;
/* Measurement Data */
struct _icmMeasurement {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Public: */
+ /* Public: */
icStandardObserver observer; /* Standard observer */
icmXYZNumber backing; /* XYZ for backing */
icMeasurementGeometry geometry; /* Meas. geometry */
@@ -559,19 +549,19 @@ struct _icmMeasurement {
/* Structure that holds each named color data */
typedef struct {
- struct _icc *icp; /* Pointer to ICC we're a part of */
- char root[32]; /* Root name for color */
- double pcsCoords[3]; /* icmNC2: PCS coords of color */
- double deviceCoords[MAX_CHAN]; /* Dev coords of color */
+ struct _icc *icp; /* Pointer to ICC we're a part of */
+ char root[32]; /* Root name for color */
+ double pcsCoords[3]; /* icmNC2: PCS coords of color */
+ double deviceCoords[MAX_CHAN]; /* Dev coords of color */
} icmNamedColorVal;
struct _icmNamedColor {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _count; /* Count currently allocated */
+ /* Private: */
+ unsigned int _count; /* Count currently allocated */
- /* Public: */
+ /* Public: */
unsigned int vendorFlag; /* Bottom 16 bits for IC use */
unsigned int count; /* Count of named colors */
unsigned int nDeviceCoords; /* Num of device coordinates */
@@ -582,77 +572,77 @@ struct _icmNamedColor {
/* textDescription */
struct _icmTextDescription {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned long _size; /* Size currently allocated */
- unsigned long uc_size; /* uc Size currently allocated */
- int (*core_read)(struct _icmTextDescription *p, char **bpp, char *end);
- int (*core_write)(struct _icmTextDescription *p, char **bpp);
+ /* Private: */
+ unsigned long _size; /* Size currently allocated */
+ unsigned long uc_size; /* uc Size currently allocated */
+ int (*core_read)(struct _icmTextDescription *p, char **bpp, char *end);
+ int (*core_write)(struct _icmTextDescription *p, char **bpp);
- /* Public: */
- unsigned long size; /* Allocated and used size of desc, inc null */
- char *desc; /* ascii string (null terminated) */
+ /* Public: */
+ unsigned long size; /* Allocated and used size of desc, inc null */
+ char *desc; /* ascii string (null terminated) */
- unsigned int ucLangCode; /* UniCode language code */
- unsigned long ucSize; /* Allocated and used size of ucDesc in wchars, inc null */
- ORD16 *ucDesc; /* The UniCode description (null terminated) */
+ unsigned int ucLangCode; /* UniCode language code */
+ unsigned long ucSize; /* Allocated and used size of ucDesc in wchars, inc null */
+ ORD16 *ucDesc; /* The UniCode description (null terminated) */
- ORD16 scCode; /* ScriptCode code */
- unsigned long scSize; /* Used size of scDesc in bytes, inc null */
- ORD8 scDesc[67]; /* ScriptCode Description (null terminated, max 67) */
+ ORD16 scCode; /* ScriptCode code */
+ unsigned long scSize; /* Used size of scDesc in bytes, inc null */
+ ORD8 scDesc[67]; /* ScriptCode Description (null terminated, max 67) */
}; typedef struct _icmTextDescription icmTextDescription;
/* Profile sequence structure */
struct _icmDescStruct {
- /* Private: */
- struct _icc *icp; /* Pointer to ICC we're a part of */
+ /* Private: */
+ struct _icc *icp; /* Pointer to ICC we're a part of */
- /* Public: */
- int (*allocate)(struct _icmDescStruct *p); /* Allocate method */
+ /* Public: */
+ int (*allocate)(struct _icmDescStruct *p); /* Allocate method */
icmSig deviceMfg; /* Dev Manufacturer */
unsigned int deviceModel; /* Dev Model */
icmUint64 attributes; /* Dev attributes */
icTechnologySignature technology; /* Technology sig */
- icmTextDescription device; /* Manufacturer text (sub structure) */
- icmTextDescription model; /* Model text (sub structure) */
+ icmTextDescription device; /* Manufacturer text (sub structure) */
+ icmTextDescription model; /* Model text (sub structure) */
}; typedef struct _icmDescStruct icmDescStruct;
/* Profile sequence description */
struct _icmProfileSequenceDesc {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _count; /* number currently allocated */
+ /* Private: */
+ unsigned int _count; /* number currently allocated */
- /* Public: */
+ /* Public: */
unsigned int count; /* Number of descriptions */
- icmDescStruct *data; /* array of [count] descriptions */
+ icmDescStruct *data; /* array of [count] descriptions */
}; typedef struct _icmProfileSequenceDesc icmProfileSequenceDesc;
/* signature (only ever used for technology ??) */
struct _icmSignature {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Public: */
+ /* Public: */
icTechnologySignature sig; /* Signature */
}; typedef struct _icmSignature icmSignature;
/* Per channel Screening Data */
typedef struct {
- /* Public: */
+ /* Public: */
double frequency; /* Frequency */
double angle; /* Screen angle */
icSpotShape spotShape; /* Spot Shape encodings below */
} icmScreeningData;
struct _icmScreening {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
- unsigned int _channels; /* number currently allocated */
+ /* Private: */
+ unsigned int _channels; /* number currently allocated */
- /* Public: */
+ /* Public: */
unsigned int screeningFlag; /* Screening flag */
unsigned int channels; /* Number of channels */
icmScreeningData *data; /* Array of screening data */
@@ -660,29 +650,29 @@ struct _icmScreening {
/* Under color removal, black generation */
struct _icmUcrBg {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Private: */
+ /* Private: */
unsigned int UCR_count; /* Currently allocated UCR count */
unsigned int BG_count; /* Currently allocated BG count */
- unsigned long _size; /* Currently allocated string size */
+ unsigned long _size; /* Currently allocated string size */
- /* Public: */
+ /* Public: */
unsigned int UCRcount; /* Undercolor Removal Curve length */
double *UCRcurve; /* The array of UCR curve values, 0.0 - 1.0 */
- /* or 0.0 - 100 % if count = 1 */
+ /* or 0.0 - 100 % if count = 1 */
unsigned int BGcount; /* Black generation Curve length */
double *BGcurve; /* The array of BG curve values, 0.0 - 1.0 */
- /* or 0.0 - 100 % if count = 1 */
- unsigned long size; /* Allocated and used size of desc, inc null */
- char *string; /* UcrBg description (null terminated) */
+ /* or 0.0 - 100 % if count = 1 */
+ unsigned long size; /* Allocated and used size of desc, inc null */
+ char *string; /* UcrBg description (null terminated) */
}; typedef struct _icmUcrBg icmUcrBg;
/* viewingConditionsType */
struct _icmViewingConditions {
- ICM_BASE_MEMBERS
+ ICM_BASE_MEMBERS
- /* Public: */
+ /* Public: */
icmXYZNumber illuminant; /* In candelas per sq. meter */
icmXYZNumber surround; /* In candelas per sq. meter */
icIlluminant stdIlluminant; /* See icIlluminant defines */
@@ -690,84 +680,83 @@ struct _icmViewingConditions {
/* Postscript Color Rendering Dictionary names type */
struct _icmCrdInfo {
- ICM_BASE_MEMBERS
- /* Private: */
+ ICM_BASE_MEMBERS
+ /* Private: */
unsigned long _ppsize; /* Currently allocated size */
- unsigned long _crdsize[4]; /* Currently allocated sizes */
+ unsigned long _crdsize[4]; /* Currently allocated sizes */
- /* Public: */
+ /* Public: */
unsigned long ppsize; /* Postscript product name size (including null) */
char *ppname; /* Postscript product name (null terminated) */
- unsigned long crdsize[4]; /* Rendering intent 0-3 CRD names sizes (icluding null) */
- char *crdname[4]; /* Rendering intent 0-3 CRD names (null terminated) */
+ unsigned long crdsize[4]; /* Rendering intent 0-3 CRD names sizes (icluding null) */
+ char *crdname[4]; /* Rendering intent 0-3 CRD names (null terminated) */
}; typedef struct _icmCrdInfo icmCrdInfo;
-
/* Apple ColorSync 2.5 video card gamma type */
struct _icmVideoCardGammaTable {
- unsigned short channels; /* # of gamma channels (1 or 3) */
- unsigned short entryCount; /* 1-based number of entries per channel */
- unsigned short entrySize; /* size in bytes of each entry */
- void *data; /* variable size data */
+ unsigned short channels; /* # of gamma channels (1 or 3) */
+ unsigned short entryCount; /* 1-based number of entries per channel */
+ unsigned short entrySize; /* size in bytes of each entry */
+ void *data; /* variable size data */
}; typedef struct _icmVideoCardGammaTable icmVideoCardGammaTable;
struct _icmVideoCardGammaFormula {
- double redGamma; /* must be > 0.0 */
- double redMin; /* must be > 0.0 and < 1.0 */
- double redMax; /* must be > 0.0 and < 1.0 */
- double greenGamma; /* must be > 0.0 */
- double greenMin; /* must be > 0.0 and < 1.0 */
- double greenMax; /* must be > 0.0 and < 1.0 */
- double blueGamma; /* must be > 0.0 */
- double blueMin; /* must be > 0.0 and < 1.0 */
- double blueMax; /* must be > 0.0 and < 1.0 */
+ double redGamma; /* must be > 0.0 */
+ double redMin; /* must be > 0.0 and < 1.0 */
+ double redMax; /* must be > 0.0 and < 1.0 */
+ double greenGamma; /* must be > 0.0 */
+ double greenMin; /* must be > 0.0 and < 1.0 */
+ double greenMax; /* must be > 0.0 and < 1.0 */
+ double blueGamma; /* must be > 0.0 */
+ double blueMin; /* must be > 0.0 and < 1.0 */
+ double blueMax; /* must be > 0.0 and < 1.0 */
}; typedef struct _icmVideoCardGammaFormula icmVideoCardGammaFormula;
enum {
- icmVideoCardGammaTableType = 0,
- icmVideoCardGammaFormulaType = 1
+ icmVideoCardGammaTableType = 0,
+ icmVideoCardGammaFormulaType = 1
};
struct _icmVideoCardGamma {
- ICM_BASE_MEMBERS
- unsigned long tagType; /* eg. table or formula, use above enum */
- union {
- icmVideoCardGammaTable table;
- icmVideoCardGammaFormula formula;
- } u;
+ ICM_BASE_MEMBERS
+ unsigned long tagType; /* eg. table or formula, use above enum */
+ union {
+ icmVideoCardGammaTable table;
+ icmVideoCardGammaFormula formula;
+ } u;
}; typedef struct _icmVideoCardGamma icmVideoCardGamma;
/* ------------------------------------------------- */
/* The Profile header */
struct _icmHeader {
- /* Private: */
- unsigned int (*get_size)(struct _icmHeader *p);
- int (*read)(struct _icmHeader *p, unsigned long len, unsigned long of);
- int (*write)(struct _icmHeader *p, unsigned long of);
- void (*del)(struct _icmHeader *p);
- struct _icc *icp; /* Pointer to ICC we're a part of */
+ /* Private: */
+ unsigned int (*get_size)(struct _icmHeader *p);
+ int (*read)(struct _icmHeader *p, unsigned long len, unsigned long of);
+ int (*write)(struct _icmHeader *p, unsigned long of);
+ void (*del)(struct _icmHeader *p);
+ struct _icc *icp; /* Pointer to ICC we're a part of */
unsigned int size; /* Profile size in bytes */
- /* public: */
- void (*dump)(struct _icmHeader *p, FILE *op, int verb);
+ /* public: */
+ void (*dump)(struct _icmHeader *p, FILE *op, int verb);
- /* Values that must be set before writing */
+ /* Values that must be set before writing */
icProfileClassSignature deviceClass; /* Type of profile */
icColorSpaceSignature colorSpace; /* Clr space of data */
icColorSpaceSignature pcs; /* PCS: XYZ or Lab */
icRenderingIntent renderingIntent;/* Rendering intent */
- /* Values that should be set before writing */
+ /* Values that should be set before writing */
icmSig manufacturer; /* Dev manufacturer */
icmSig model; /* Dev model */
icmUint64 attributes; /* Device attributes.l */
unsigned int flags; /* Various bits */
- /* Values that may optionally be set before writing */
+ /* Values that may optionally be set before writing */
/* icmUint64 attributes; Device attributes.h (see above) */
icmSig creator; /* Profile creator */
- /* Values that are not normally set, since they have defaults */
+ /* Values that are not normally set, since they have defaults */
icmSig cmmId; /* CMM for profile */
int majv, minv, bfv;/* Format version - major, minor, bug fix */
icmDateTimeNumber date; /* Creation Date */
@@ -803,141 +792,141 @@ typedef enum {
} icmLuAlgType;
#define LU_ICM_BASE_MEMBERS \
- /* Private: */ \
- icmLuAlgType ttype; /* The object tag */ \
- struct _icc *icp; /* Pointer to ICC we're a part of */ \
- icRenderingIntent intent; /* Effective intent */ \
- icmLookupFunc function; /* Functionality being used */ \
- icmXYZNumber pcswht, whitePoint, blackPoint; /* White and black point info */ \
- double toAbs[3][3]; /* Matrix to convert from relative to absolute */ \
- double fromAbs[3][3]; /* Matrix to convert from absolute to relative */ \
+ /* Private: */ \
+ icmLuAlgType ttype; /* The object tag */ \
+ struct _icc *icp; /* Pointer to ICC we're a part of */ \
+ icRenderingIntent intent; /* Effective intent */ \
+ icmLookupFunc function; /* Functionality being used */ \
+ icmXYZNumber pcswht, whitePoint, blackPoint; /* White and black point info */ \
+ double toAbs[3][3]; /* Matrix to convert from relative to absolute */ \
+ double fromAbs[3][3]; /* Matrix to convert from absolute to relative */ \
icColorSpaceSignature inSpace; /* Native Clr space of input */ \
icColorSpaceSignature outSpace; /* Native Clr space of output */ \
- icColorSpaceSignature pcs; /* Native PCS */ \
+ icColorSpaceSignature pcs; /* Native PCS */ \
icColorSpaceSignature e_inSpace; /* Effective Clr space of input */ \
icColorSpaceSignature e_outSpace; /* Effective Clr space of output */ \
- icColorSpaceSignature e_pcs; /* Effective PCS */ \
- \
- /* Public: */ \
- void (*del)(struct _icmLuBase *p); \
- /* Internal native colorspaces */ \
- void (*lutspaces) (struct _icmLuBase *p, icColorSpaceSignature *ins, int *inn, \
- icColorSpaceSignature *outs, int *outn); \
- \
- /* External effecive colorspaces */ \
- void (*spaces) (struct _icmLuBase *p, icColorSpaceSignature *ins, int *inn, \
- icColorSpaceSignature *outs, int *outn, \
- icmLuAlgType *alg, icRenderingIntent *intt, \
- icmLookupFunc *fnc, icColorSpaceSignature *pcs); \
- \
- /* Get the effective input space and output space ranges */ \
- void (*get_ranges) (struct _icmLuBase *p, \
- double *inmin, double *inmax, /* Maximum range of inspace values */ \
- double *outmin, double *outmax); /* Maximum range of outspace values */ \
- \
- void (*wh_bk_points)(struct _icmLuBase *p, icmXYZNumber *wht, icmXYZNumber *blk); \
- int (*lookup) (struct _icmLuBase *p, double *out, double *in);
-
- /* Translate color values through profile */
- /* 0 = success */
- /* 1 = warning: clipping occured */
- /* 2 = fatal: other error */
+ icColorSpaceSignature e_pcs; /* Effective PCS */ \
+ \
+ /* Public: */ \
+ void (*del)(struct _icmLuBase *p); \
+ /* Internal native colorspaces */ \
+ void (*lutspaces) (struct _icmLuBase *p, icColorSpaceSignature *ins, int *inn, \
+ icColorSpaceSignature *outs, int *outn); \
+ \
+ /* External effecive colorspaces */ \
+ void (*spaces) (struct _icmLuBase *p, icColorSpaceSignature *ins, int *inn, \
+ icColorSpaceSignature *outs, int *outn, \
+ icmLuAlgType *alg, icRenderingIntent *intt, \
+ icmLookupFunc *fnc, icColorSpaceSignature *pcs); \
+ \
+ /* Get the effective input space and output space ranges */ \
+ void (*get_ranges) (struct _icmLuBase *p, \
+ double *inmin, double *inmax, /* Maximum range of inspace values */ \
+ double *outmin, double *outmax); /* Maximum range of outspace values */ \
+ \
+ void (*wh_bk_points)(struct _icmLuBase *p, icmXYZNumber *wht, icmXYZNumber *blk); \
+ int (*lookup) (struct _icmLuBase *p, double *out, double *in);
+
+ /* Translate color values through profile */
+ /* 0 = success */
+ /* 1 = warning: clipping occured */
+ /* 2 = fatal: other error */
/* Base lookup object */
struct _icmLuBase {
- LU_ICM_BASE_MEMBERS
+ LU_ICM_BASE_MEMBERS
}; typedef struct _icmLuBase icmLuBase;
/* Monochrome Fwd & Bwd type object */
struct _icmLuMono {
- LU_ICM_BASE_MEMBERS
- icmCurve *grayCurve;
+ LU_ICM_BASE_MEMBERS
+ icmCurve *grayCurve;
- /* Overall lookups */
- int (*fwd_lookup) (struct _icmLuBase *p, double *out, double *in);
- int (*bwd_lookup) (struct _icmLuBase *p, double *out, double *in);
+ /* Overall lookups */
+ int (*fwd_lookup) (struct _icmLuBase *p, double *out, double *in);
+ int (*bwd_lookup) (struct _icmLuBase *p, double *out, double *in);
- /* Components of lookup */
- int (*fwd_curve) (struct _icmLuMono *p, double *out, double *in);
- int (*fwd_map) (struct _icmLuMono *p, double *out, double *in);
- int (*fwd_abs) (struct _icmLuMono *p, double *out, double *in);
- int (*bwd_abs) (struct _icmLuMono *p, double *out, double *in);
- int (*bwd_map) (struct _icmLuMono *p, double *out, double *in);
- int (*bwd_curve) (struct _icmLuMono *p, double *out, double *in);
+ /* Components of lookup */
+ int (*fwd_curve) (struct _icmLuMono *p, double *out, double *in);
+ int (*fwd_map) (struct _icmLuMono *p, double *out, double *in);
+ int (*fwd_abs) (struct _icmLuMono *p, double *out, double *in);
+ int (*bwd_abs) (struct _icmLuMono *p, double *out, double *in);
+ int (*bwd_map) (struct _icmLuMono *p, double *out, double *in);
+ int (*bwd_curve) (struct _icmLuMono *p, double *out, double *in);
}; typedef struct _icmLuMono icmLuMono;
/* 3D Matrix Fwd & Bwd type object */
struct _icmLuMatrix {
- LU_ICM_BASE_MEMBERS
- icmCurve *redCurve, *greenCurve, *blueCurve;
- icmXYZArray *redColrnt, *greenColrnt, *blueColrnt;
+ LU_ICM_BASE_MEMBERS
+ icmCurve *redCurve, *greenCurve, *blueCurve;
+ icmXYZArray *redColrnt, *greenColrnt, *blueColrnt;
double mx[3][3]; /* 3 * 3 conversion matrix */
double bmx[3][3]; /* 3 * 3 backwards conversion matrix */
- /* Overall lookups */
- int (*fwd_lookup) (struct _icmLuBase *p, double *out, double *in);
- int (*bwd_lookup) (struct _icmLuBase *p, double *out, double *in);
+ /* Overall lookups */
+ int (*fwd_lookup) (struct _icmLuBase *p, double *out, double *in);
+ int (*bwd_lookup) (struct _icmLuBase *p, double *out, double *in);
- /* Components of lookup */
- int (*fwd_curve) (struct _icmLuMatrix *p, double *out, double *in);
- int (*fwd_matrix) (struct _icmLuMatrix *p, double *out, double *in);
- int (*fwd_abs) (struct _icmLuMatrix *p, double *out, double *in);
- int (*bwd_abs) (struct _icmLuMatrix *p, double *out, double *in);
- int (*bwd_matrix) (struct _icmLuMatrix *p, double *out, double *in);
- int (*bwd_curve) (struct _icmLuMatrix *p, double *out, double *in);
+ /* Components of lookup */
+ int (*fwd_curve) (struct _icmLuMatrix *p, double *out, double *in);
+ int (*fwd_matrix) (struct _icmLuMatrix *p, double *out, double *in);
+ int (*fwd_abs) (struct _icmLuMatrix *p, double *out, double *in);
+ int (*bwd_abs) (struct _icmLuMatrix *p, double *out, double *in);
+ int (*bwd_matrix) (struct _icmLuMatrix *p, double *out, double *in);
+ int (*bwd_curve) (struct _icmLuMatrix *p, double *out, double *in);
}; typedef struct _icmLuMatrix icmLuMatrix;
/* Multi-D. Lut type object */
struct _icmLuLut {
- LU_ICM_BASE_MEMBERS
+ LU_ICM_BASE_MEMBERS
- /* private: */
- icmLut *lut; /* Lut to use */
- int usematrix; /* non-zero if matrix should be used */
+ /* private: */
+ icmLut *lut; /* Lut to use */
+ int usematrix; /* non-zero if matrix should be used */
double imx[3][3]; /* 3 * 3 inverse conversion matrix */
- int imx_valid; /* Inverse matrix is valid */
- void (*in_normf)(double *out, double *in); /* Lut input data normalizing function */
- void (*in_denormf)(double *out, double *in);/* Lut input data de-normalizing function */
- void (*out_normf)(double *out, double *in); /* Lut output data normalizing function */
- void (*out_denormf)(double *out, double *in);/* Lut output de-normalizing function */
- void (*e_in_denormf)(double *out, double *in);/* Effective input de-normalizing function */
- void (*e_out_denormf)(double *out, double *in);/* Effecive output de-normalizing function */
- /* function chosen out of lut->lookup_clut_sx and lut->lookup_clut_nl to imp. clut() */
- int (*lookup_clut) (struct _icmLut *pp, double *out, double *in); /* clut function */
-
- /* public: */
-
- /* Components of lookup */
- int (*in_abs) (struct _icmLuLut *p, double *out, double *in); /* Should be in icmLut ? */
- int (*matrix) (struct _icmLuLut *p, double *out, double *in);
- int (*input) (struct _icmLuLut *p, double *out, double *in);
- int (*clut) (struct _icmLuLut *p, double *out, double *in);
- int (*output) (struct _icmLuLut *p, double *out, double *in);
- int (*out_abs) (struct _icmLuLut *p, double *out, double *in); /* Should be in icmLut ? */
-
- /* Some inverse components */
- /* Should be in icmLut ??? */
- int (*inv_out_abs) (struct _icmLuLut *p, double *out, double *in);
- int (*inv_output) (struct _icmLuLut *p, double *out, double *in);
- /* inv_clut is beyond scope of icclib. See argyll for solution! */
- int (*inv_input) (struct _icmLuLut *p, double *out, double *in);
- int (*inv_matrix) (struct _icmLuLut *p, double *out, double *in);
- int (*inv_in_abs) (struct _icmLuLut *p, double *out, double *in);
-
- /* Get various types of information about the LuLut */
- void (*get_info) (struct _icmLuLut *p, icmLut **lutp,
- icmXYZNumber *pcswhtp, icmXYZNumber *whitep,
- icmXYZNumber *blackp);
-
- /* Get the native input space and output space ranges */
- void (*get_lutranges) (struct _icmLuLut *p,
- double *inmin, double *inmax, /* Maximum range of inspace values */
- double *outmin, double *outmax); /* Maximum range of outspace values */
-
- /* Get the matrix contents */
- void (*get_matrix) (struct _icmLuLut *p, double m[3][3]);
+ int imx_valid; /* Inverse matrix is valid */
+ void (*in_normf)(double *out, double *in); /* Lut input data normalizing function */
+ void (*in_denormf)(double *out, double *in);/* Lut input data de-normalizing function */
+ void (*out_normf)(double *out, double *in); /* Lut output data normalizing function */
+ void (*out_denormf)(double *out, double *in);/* Lut output de-normalizing function */
+ void (*e_in_denormf)(double *out, double *in);/* Effective input de-normalizing function */
+ void (*e_out_denormf)(double *out, double *in);/* Effecive output de-normalizing function */
+ /* function chosen out of lut->lookup_clut_sx and lut->lookup_clut_nl to imp. clut() */
+ int (*lookup_clut) (struct _icmLut *pp, double *out, double *in); /* clut function */
+
+ /* public: */
+
+ /* Components of lookup */
+ int (*in_abs) (struct _icmLuLut *p, double *out, double *in); /* Should be in icmLut ? */
+ int (*matrix) (struct _icmLuLut *p, double *out, double *in);
+ int (*input) (struct _icmLuLut *p, double *out, double *in);
+ int (*clut) (struct _icmLuLut *p, double *out, double *in);
+ int (*output) (struct _icmLuLut *p, double *out, double *in);
+ int (*out_abs) (struct _icmLuLut *p, double *out, double *in); /* Should be in icmLut ? */
+
+ /* Some inverse components */
+ /* Should be in icmLut ??? */
+ int (*inv_out_abs) (struct _icmLuLut *p, double *out, double *in);
+ int (*inv_output) (struct _icmLuLut *p, double *out, double *in);
+ /* inv_clut is beyond scope of icclib. See argyll for solution! */
+ int (*inv_input) (struct _icmLuLut *p, double *out, double *in);
+ int (*inv_matrix) (struct _icmLuLut *p, double *out, double *in);
+ int (*inv_in_abs) (struct _icmLuLut *p, double *out, double *in);
+
+ /* Get various types of information about the LuLut */
+ void (*get_info) (struct _icmLuLut *p, icmLut **lutp,
+ icmXYZNumber *pcswhtp, icmXYZNumber *whitep,
+ icmXYZNumber *blackp);
+
+ /* Get the native input space and output space ranges */
+ void (*get_lutranges) (struct _icmLuLut *p,
+ double *inmin, double *inmax, /* Maximum range of inspace values */
+ double *outmin, double *outmax); /* Maximum range of outspace values */
+
+ /* Get the matrix contents */
+ void (*get_matrix) (struct _icmLuLut *p, double m[3][3]);
}; typedef struct _icmLuLut icmLuLut;
@@ -945,10 +934,10 @@ struct _icmLuLut {
/* A tag */
typedef struct {
icTagSignature sig; /* The tag signature */
- icTagTypeSignature ttype; /* The tag type signature */
+ icTagTypeSignature ttype; /* The tag type signature */
unsigned int offset; /* File offset to start header */
unsigned int size; /* Size in bytes */
- icmBase *objp; /* In memory data structure */
+ icmBase *objp; /* In memory data structure */
} icmTag;
/* Pseudo enumerations valid as parameter to get_luobj(): */
@@ -959,86 +948,84 @@ typedef struct {
/* Pseudo PCS colospace used to indicate the native PCS */
#define icmSigDefaultData ((icColorSpaceSignature) 0x0)
-
/* The ICC object */
struct _icc {
- /* Public: */
- unsigned int (*get_size)(struct _icc *p); /* Return total size needed, 0 = err. */
- int (*read)(struct _icc *p, icmFile *fp, unsigned long of); /* Returns error code */
- int (*write)(struct _icc *p, icmFile *fp, unsigned long of);/* Returns error code */
- void (*dump)(struct _icc *p, FILE *op, int verb); /* Dump whole icc */
- void (*del)(struct _icc *p); /* Free whole icc */
- int (*find_tag)(struct _icc *p, icTagSignature sig);
- /* Returns 1 if found, 2 readable */
- icmBase * (*read_tag)(struct _icc *p, icTagSignature sig);
- /* Returns pointer to object */
- icmBase * (*add_tag)(struct _icc *p, icTagSignature sig, icTagTypeSignature ttype);
- /* Returns pointer to object */
- int (*rename_tag)(struct _icc *p, icTagSignature sig, icTagSignature sigNew);
- /* Rename and existing tag */
- icmBase * (*link_tag)(struct _icc *p, icTagSignature sig, icTagSignature ex_sig);
- /* Returns pointer to object */
- int (*unread_tag)(struct _icc *p, icTagSignature sig);
- /* Unread a tag (free on refcount == 0 */
- int (*read_all_tags)(struct _icc *p); /* Read all the tags, non-zero on error. */
-
- int (*delete_tag)(struct _icc *p, icTagSignature sig);
- /* Returns 0 if deleted OK */
- icmLuBase * (*get_luobj) (struct _icc *p,
+ /* Public: */
+ unsigned int (*get_size)(struct _icc *p); /* Return total size needed, 0 = err. */
+ int (*read)(struct _icc *p, icmFile *fp, unsigned long of); /* Returns error code */
+ int (*write)(struct _icc *p, icmFile *fp, unsigned long of);/* Returns error code */
+ void (*dump)(struct _icc *p, FILE *op, int verb); /* Dump whole icc */
+ void (*del)(struct _icc *p); /* Free whole icc */
+ int (*find_tag)(struct _icc *p, icTagSignature sig);
+ /* Returns 1 if found, 2 readable */
+ icmBase * (*read_tag)(struct _icc *p, icTagSignature sig);
+ /* Returns pointer to object */
+ icmBase * (*add_tag)(struct _icc *p, icTagSignature sig, icTagTypeSignature ttype);
+ /* Returns pointer to object */
+ int (*rename_tag)(struct _icc *p, icTagSignature sig, icTagSignature sigNew);
+ /* Rename and existing tag */
+ icmBase * (*link_tag)(struct _icc *p, icTagSignature sig, icTagSignature ex_sig);
+ /* Returns pointer to object */
+ int (*unread_tag)(struct _icc *p, icTagSignature sig);
+ /* Unread a tag (free on refcount == 0 */
+ int (*read_all_tags)(struct _icc *p); /* Read all the tags, non-zero on error. */
+
+ int (*delete_tag)(struct _icc *p, icTagSignature sig);
+ /* Returns 0 if deleted OK */
+ icmLuBase * (*get_luobj) (struct _icc *p,
icmLookupFunc func, /* Functionality */
- icRenderingIntent intent, /* Intent */
- icColorSpaceSignature pcsor, /* PCS overide (0 = def) */
- icmLookupOrder order); /* Search Order */
- /* Return appropriate lookup object */
- /* NULL on error, check errc+err for reason */
+ icRenderingIntent intent, /* Intent */
+ icColorSpaceSignature pcsor, /* PCS overide (0 = def) */
+ icmLookupOrder order); /* Search Order */
+ /* Return appropriate lookup object */
+ /* NULL on error, check errc+err for reason */
-
icmHeader *header; /* The header */
- char err[512]; /* Error message */
- int errc; /* Error code */
-
- /* Private: ? */
- icmAlloc *al; /* Heap allocator */
- int del_al; /* NZ if heap allocator should be deleted */
- icmFile *fp; /* File associated with object */
- unsigned long of; /* Offset of the profile within the file */
+ char err[512]; /* Error message */
+ int errc; /* Error code */
+
+ /* Private: ? */
+ icmAlloc *al; /* Heap allocator */
+ int del_al; /* NZ if heap allocator should be deleted */
+ icmFile *fp; /* File associated with object */
+ unsigned long of; /* Offset of the profile within the file */
unsigned int count; /* Num tags in the profile */
icmTag *data; /* The tagTable and tagData */
- }; typedef struct _icc icc;
+ }; typedef struct _icc icc;
/* ========================================================== */
/* Utility structures and declarations */
/* Structure to hold pseudo-hilbert counter info */
struct _psh {
- int di; /* Dimensionality */
- unsigned res; /* Resolution per coordinate */
- unsigned bits; /* Bits per coordinate */
- unsigned ix; /* Current binary index */
- unsigned tmask; /* Total 2^n count mask */
- unsigned count; /* Usable count */
+ int di; /* Dimensionality */
+ unsigned res; /* Resolution per coordinate */
+ unsigned bits; /* Bits per coordinate */
+ unsigned ix; /* Current binary index */
+ unsigned tmask; /* Total 2^n count mask */
+ unsigned count; /* Usable count */
}; typedef struct _psh psh;
/* Type of encoding to be returned as a string */
typedef enum {
icmScreenEncodings,
icmDeviceAttributes,
- icmProfileHeaderFlags,
- icmAsciiOrBinaryData,
- icmTagSignature,
- icmTechnologySignature,
- icmTypeSignature,
- icmColorSpaceSignature,
- icmProfileClassSignaure,
- icmPlatformSignature,
- icmMeasurementFlare,
- icmMeasurementGeometry,
- icmRenderingIntent,
- icmSpotShape,
- icmStandardObserver,
- icmIlluminant,
- icmLuAlg
+ icmProfileHeaderFlags,
+ icmAsciiOrBinaryData,
+ icmTagSignature,
+ icmTechnologySignature,
+ icmTypeSignature,
+ icmColorSpaceSignature,
+ icmProfileClassSignaure,
+ icmPlatformSignature,
+ icmMeasurementFlare,
+ icmMeasurementGeometry,
+ icmRenderingIntent,
+ icmSpotShape,
+ icmStandardObserver,
+ icmIlluminant,
+ icmLuAlg
} icmEnumType;
/* ========================================================== */
@@ -1087,10 +1074,10 @@ extern ICCLIB_API int psh_inc(psh *p, int co[]);
/* Chromatic Adaption transform utility */
/* Return a 3x3 chromatic adaption matrix */
void icmChromAdaptMatrix(
- int flags, /* Flags as defined below */
- icmXYZNumber d_wp, /* Destination white point */
- icmXYZNumber s_wp, /* Source white point */
- double mat[3][3] /* Destination matrix */
+ int flags, /* Flags as defined below */
+ icmXYZNumber d_wp, /* Destination white point */
+ icmXYZNumber s_wp, /* Source white point */
+ double mat[3][3] /* Destination matrix */
);
#define ICM_CAM_BRADFORD 0x0001 /* Use Bradford sharpened response space */
@@ -1117,8 +1104,7 @@ extern ICCLIB_API double icmCIE94sq(double *in1, double *in2);
/* ---------------------------------------------------------- */
#ifdef __cplusplus
- }
+ }
#endif
#endif /* ICC_H */
-
diff --git a/gs/icclib/icc9809.h b/gs/icclib/icc9809.h
index 105ccca9e..a2be3ff89 100644
--- a/gs/icclib/icc9809.h
+++ b/gs/icclib/icc9809.h
@@ -1,4 +1,3 @@
-
/*
* Note: Modified for use by icclib V2.00:
*
@@ -29,55 +28,55 @@
#ifndef ICC9809_H
#define ICC9809_H
-/*****************************************************************
+/*****************************************************************
Copyright (c) 1994-1998 SunSoft, Inc.
Rights Reserved
-Permission is hereby granted, free of charge, to any person
+Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without restrict-
-ion, including without limitation the rights to use, copy, modify,
-merge, publish distribute, sublicense, and/or sell copies of the
-Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+files (the "Software"), to deal in the Software without restrict-
+ion, including without limitation the rights to use, copy, modify,
+merge, publish distribute, sublicense, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
-INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
-COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of SunSoft, Inc.
-shall not be used in advertising or otherwise to promote the
-sale, use or other dealings in this Software without written
-authorization from SunSoft Inc.
+INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
+COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of SunSoft, Inc.
+shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without written
+authorization from SunSoft Inc.
******************************************************************/
/*
* This version of the header file corresponds to the profile
* Specification ICC.1:1998-09.
*
- * All header file entries are pre-fixed with "ic" to help
+ * All header file entries are pre-fixed with "ic" to help
* avoid name space collisions. Signatures are pre-fixed with
* icSig.
*
* The structures defined in this header file were created to
* represent a description of an ICC profile on disk. Rather
- * than use pointers a technique is used where a single byte array
+ * than use pointers a technique is used where a single byte array
* was placed at the end of each structure. This allows us in "C"
* to extend the structure by allocating more data than is needed
* to account for variable length structures.
*
* This also ensures that data following is allocated
* contiguously and makes it easier to write and read data from
- * the file.
+ * the file.
*
* For example to allocate space for a 256 count length UCR
* and BG array, and fill the allocated data. Note strlen + 1
@@ -89,20 +88,20 @@ authorization from SunSoft Inc.
char ucr_string[100], *ucr_char;
strcpy(ucr_string, "Example ucrBG curves");
- ucr_nbytes = sizeof(icUInt32Number) +
+ ucr_nbytes = sizeof(icUInt32Number) +
(UCR_CURVE_SIZE * sizeof(icUInt16Number));
- bg_nbytes = sizeof(icUInt32Number) +
+ bg_nbytes = sizeof(icUInt32Number) +
(BG_CURVE_SIZE * sizeof(icUInt16Number));
string_bytes = strlen(ucr_string) + 1;
ucrBgWrite = (icUcrBg *)malloc(
(ucr_nbytes + bg_nbytes + string_bytes));
-
+
ucrCurve = (icUcrBgCurve *)ucrBgWrite->data;
ucrCurve->count = UCR_CURVE_SIZE;
for (i=0; i<ucrCurve->count; i++)
ucrCurve->curve[i] = (icUInt16Number)i;
-
+
bgCurve = (icUcrBgCurve *)((char *)ucrCurve + ucr_nbytes);
bgCurve->count = BG_CURVE_SIZE;
for (i=0; i<bgCurve->count; i++)
@@ -138,7 +137,7 @@ authorization from SunSoft Inc.
#define icLinesPerInch 0x00000002L /* Bit pos 1 */
#define icLinesPerCm 0x00000000L /* Bit pos 1 */
-/*
+/*
* Device attributes, currently defined values correspond
* to the least-significant 4 bytes of the 8 byte attribute
* quantity, see the header for their location.
@@ -162,7 +161,7 @@ authorization from SunSoft Inc.
#define icUseWithEmbeddedDataOnly 0x00000002L /* Bit pos 1 */
/* Ascii or Binary data */
-#define icAsciiData 0x00000000L
+#define icAsciiData 0x00000000L
#define icBinaryData 0x00000001L
/* Phosphor or Colorant sets */
@@ -176,12 +175,11 @@ authorization from SunSoft Inc.
#define icVideoCardGammaTable 0x00000000
#define icVideoCardGammaFormula 0x00000001
-/*
+/*
* Define used to indicate that this is a variable length array
*/
#define icAny 1
-
/*------------------------------------------------------------------------*/
/*
* Use this area to translate platform definitions of long
@@ -264,17 +262,17 @@ typedef unsigned long icU16Fixed16Number;
/*------------------------------------------------------------------------*/
/* public tags and sizes */
typedef enum {
- icSigAToB0Tag = 0x41324230L, /* 'A2B0' */
+ icSigAToB0Tag = 0x41324230L, /* 'A2B0' */
icSigAToB1Tag = 0x41324231L, /* 'A2B1' */
- icSigAToB2Tag = 0x41324232L, /* 'A2B2' */
+ icSigAToB2Tag = 0x41324232L, /* 'A2B2' */
icSigBlueColorantTag = 0x6258595AL, /* 'bXYZ' */
icSigBlueTRCTag = 0x62545243L, /* 'bTRC' */
icSigBToA0Tag = 0x42324130L, /* 'B2A0' */
icSigBToA1Tag = 0x42324131L, /* 'B2A1' */
icSigBToA2Tag = 0x42324132L, /* 'B2A2' */
icSigCalibrationDateTimeTag = 0x63616C74L, /* 'calt' */
- icSigCharTargetTag = 0x74617267L, /* 'targ' */
- icSigChromaticityTag = 0x6368726DL, /* 'chrm' */
+ icSigCharTargetTag = 0x74617267L, /* 'targ' */
+ icSigChromaticityTag = 0x6368726DL, /* 'chrm' */
icSigCopyrightTag = 0x63707274L, /* 'cprt' */
icSigCrdInfoTag = 0x63726469L, /* 'crdi' */
icSigDeviceMfgDescTag = 0x646D6E64L, /* 'dmnd' */
@@ -288,7 +286,7 @@ typedef enum {
icSigMeasurementTag = 0x6D656173L, /* 'meas' */
icSigMediaBlackPointTag = 0x626B7074L, /* 'bkpt' */
icSigMediaWhitePointTag = 0x77747074L, /* 'wtpt' */
- icSigNamedColorTag = 0x6E636f6CL, /* 'ncol'
+ icSigNamedColorTag = 0x6E636f6CL, /* 'ncol'
* OBSOLETE, use ncl2 */
icSigNamedColor2Tag = 0x6E636C32L, /* 'ncl2' */
icSigOutputResponseTag = 0x72657370L, /* 'resp' */
@@ -309,10 +307,10 @@ typedef enum {
icSigScreeningTag = 0x7363726EL, /* 'scrn' */
icSigTechnologyTag = 0x74656368L, /* 'tech' */
icSigUcrBgTag = 0x62666420L, /* 'bfd ' */
- icSigVideoCardGammaTag = 0x76636774L, /* 'vcgt' ColorSync 2.5 */
+ icSigVideoCardGammaTag = 0x76636774L, /* 'vcgt' ColorSync 2.5 */
icSigViewingCondDescTag = 0x76756564L, /* 'vued' */
icSigViewingConditionsTag = 0x76696577L, /* 'view' */
- icMaxEnumTag = icMaxTagVal
+ icMaxEnumTag = icMaxTagVal
} icTagSignature;
/* technology signature descriptions */
@@ -320,7 +318,7 @@ typedef enum {
icSigDigitalCamera = 0x6463616DL, /* 'dcam' */
icSigFilmScanner = 0x6673636EL, /* 'fscn' */
icSigReflectiveScanner = 0x7273636EL, /* 'rscn' */
- icSigInkJetPrinter = 0x696A6574L, /* 'ijet' */
+ icSigInkJetPrinter = 0x696A6574L, /* 'ijet' */
icSigThermalWaxPrinter = 0x74776178L, /* 'twax' */
icSigElectrophotographicPrinter = 0x6570686FL, /* 'epho' */
icSigElectrostaticPrinter = 0x65737461L, /* 'esta' */
@@ -339,20 +337,20 @@ typedef enum {
icSigOffsetLithography = 0x6F666673L, /* 'offs' */
icSigSilkscreen = 0x73696C6BL, /* 'silk' */
icSigFlexography = 0x666C6578L, /* 'flex' */
- icMaxEnumTechnology = icMaxTagVal
+ icMaxEnumTechnology = icMaxTagVal
} icTechnologySignature;
/* type signatures */
typedef enum {
icSigCurveType = 0x63757276L, /* 'curv' */
- icSigChromaticityType = 0x6368726DL, /* 'chrm' */
+ icSigChromaticityType = 0x6368726DL, /* 'chrm' */
icSigDataType = 0x64617461L, /* 'data' */
icSigDateTimeType = 0x6474696DL, /* 'dtim' */
icSigDeviceSettingsType = 0x64657673L, /* 'devs' */
icSigLut16Type = 0x6d667432L, /* 'mft2' */
icSigLut8Type = 0x6d667431L, /* 'mft1' */
icSigMeasurementType = 0x6D656173L, /* 'meas' */
- icSigNamedColorType = 0x6E636f6CL, /* 'ncol'
+ icSigNamedColorType = 0x6E636f6CL, /* 'ncol'
* OBSOLETE, use ncl2 */
icSigProfileSequenceDescType = 0x70736571L, /* 'pseq' */
icSigResponseCurveSet16Type = 0x72637332L, /* 'rcs2' */
@@ -367,20 +365,20 @@ typedef enum {
icSigUInt32ArrayType = 0x75693332L, /* 'ui32' */
icSigUInt64ArrayType = 0x75693634L, /* 'ui64' */
icSigUInt8ArrayType = 0x75693038L, /* 'ui08' */
- icSigVideoCardGammaType = 0x76636774L, /* 'vcgt' ColorSync 2.5 */
+ icSigVideoCardGammaType = 0x76636774L, /* 'vcgt' ColorSync 2.5 */
icSigViewingConditionsType = 0x76696577L, /* 'view' */
icSigXYZType = 0x58595A20L, /* 'XYZ ' */
icSigXYZArrayType = 0x58595A20L, /* 'XYZ ' */
icSigNamedColor2Type = 0x6E636C32L, /* 'ncl2' */
icSigCrdInfoType = 0x63726469L, /* 'crdi' */
- icMaxEnumType = icMaxTagVal
+ icMaxEnumType = icMaxTagVal
} icTagTypeSignature;
-/*
+/*
* Color Space Signatures
* Note that only icSigXYZData and icSigLabData are valid
* Profile Connection Spaces (PCSs)
- */
+ */
typedef enum {
icSigXYZData = 0x58595A20L, /* 'XYZ ' */
icSigLabData = 0x4C616220L, /* 'Lab ' */
@@ -411,7 +409,7 @@ typedef enum {
icSig13colorData = 0x44434C52L, /* 'DCLR' */
icSig14colorData = 0x45434C52L, /* 'ECLR' */
icSig15colorData = 0x46434C52L, /* 'FCLR' */
- icMaxEnumData = icMaxTagVal
+ icMaxEnumData = icMaxTagVal
} icColorSpaceSignature;
/* profileClass enumerations */
@@ -423,7 +421,7 @@ typedef enum {
icSigAbstractClass = 0x61627374L, /* 'abst' */
icSigColorSpaceClass = 0x73706163L, /* 'spac' */
icSigNamedColorClass = 0x6e6d636cL, /* 'nmcl' */
- icMaxEnumClass = icMaxTagVal
+ icMaxEnumClass = icMaxTagVal
} icProfileClassSignature;
/* Platform Signatures */
@@ -433,7 +431,7 @@ typedef enum {
icSigSolaris = 0x53554E57L, /* 'SUNW' */
icSigSGI = 0x53474920L, /* 'SGI ' */
icSigTaligent = 0x54474E54L, /* 'TGNT' */
- icMaxEnumPlatform = icMaxTagVal
+ icMaxEnumPlatform = icMaxTagVal
} icPlatformSignature;
/*------------------------------------------------------------------------*/
@@ -445,7 +443,7 @@ typedef enum {
typedef enum {
icFlare0 = 0x00000000L, /* 0% flare */
icFlare100 = 0x00000001L, /* 100% flare */
- icMaxFlare = icMaxTagVal
+ icMaxFlare = icMaxTagVal
} icMeasurementFlare;
/* Measurement Geometry, used in the measurmentType tag */
@@ -453,7 +451,7 @@ typedef enum {
icGeometryUnknown = 0x00000000L, /* Unknown */
icGeometry045or450 = 0x00000001L, /* 0/45, 45/0 */
icGeometry0dord0 = 0x00000002L, /* 0/d or d/0 */
- icMaxGeometry = icMaxTagVal
+ icMaxGeometry = icMaxTagVal
} icMeasurementGeometry;
/* Rendering Intents, used in the profile header */
@@ -462,7 +460,7 @@ typedef enum {
icRelativeColorimetric = 1,
icSaturation = 2,
icAbsoluteColorimetric = 3,
- icMaxEnumIntent = icMaxTagVal
+ icMaxEnumIntent = icMaxTagVal
} icRenderingIntent;
/* Different Spot Shapes currently defined, used for screeningType */
@@ -475,7 +473,7 @@ typedef enum {
icSpotShapeLine = 5,
icSpotShapeSquare = 6,
icSpotShapeCross = 7,
- icMaxEnumSpot = icMaxTagVal
+ icMaxEnumSpot = icMaxTagVal
} icSpotShape;
/* Standard Observer, used in the measurmentType tag */
@@ -483,7 +481,7 @@ typedef enum {
icStdObsUnknown = 0x00000000L, /* Unknown */
icStdObs1931TwoDegrees = 0x00000001L, /* 2 deg */
icStdObs1964TenDegrees = 0x00000002L, /* 10 deg */
- icMaxStdObs = icMaxTagVal
+ icMaxStdObs = icMaxTagVal
} icStandardObserver;
/* Pre-defined illuminants, used in measurement and viewing conditions type */
@@ -495,9 +493,9 @@ typedef enum {
icIlluminantF2 = 0x00000004L,
icIlluminantD55 = 0x00000005L,
icIlluminantA = 0x00000006L,
- icIlluminantEquiPowerE = 0x00000007L,
- icIlluminantF8 = 0x00000008L,
- icMaxEnumIluminant = icMaxTagVal
+ icIlluminantEquiPowerE = 0x00000007L,
+ icIlluminantF8 = 0x00000008L,
+ icMaxEnumIluminant = icMaxTagVal
} icIlluminant;
/* media type for icSigDeviceSettingsTag */
@@ -549,7 +547,7 @@ typedef enum {
/*------------------------------------------------------------------------*/
/*
- * Arrays of numbers
+ * Arrays of numbers
*/
/* Int8 Array */
@@ -591,7 +589,7 @@ typedef struct {
typedef struct {
icInt64Number data[icAny]; /* Variable array of values */
} icInt64Array;
-
+
/* u16Fixed16 Array */
typedef struct {
icU16Fixed16Number data[icAny]; /* Variable array of values */
@@ -647,13 +645,13 @@ typedef struct {
icUInt8Number clutPoints; /* Number of grid points */
icInt8Number pad; /* Padding for byte alignment */
icS15Fixed16Number e00; /* e00 in the 3 * 3 */
- icS15Fixed16Number e01; /* e01 in the 3 * 3 */
+ icS15Fixed16Number e01; /* e01 in the 3 * 3 */
icS15Fixed16Number e02; /* e02 in the 3 * 3 */
icS15Fixed16Number e10; /* e10 in the 3 * 3 */
- icS15Fixed16Number e11; /* e11 in the 3 * 3 */
- icS15Fixed16Number e12; /* e12 in the 3 * 3 */
+ icS15Fixed16Number e11; /* e11 in the 3 * 3 */
+ icS15Fixed16Number e12; /* e12 in the 3 * 3 */
icS15Fixed16Number e20; /* e20 in the 3 * 3 */
- icS15Fixed16Number e21; /* e21 in the 3 * 3 */
+ icS15Fixed16Number e21; /* e21 in the 3 * 3 */
icS15Fixed16Number e22; /* e22 in the 3 * 3 */
icUInt16Number inputEnt; /* Num of in-table entries */
icUInt16Number outputEnt; /* Num of out-table entries */
@@ -662,7 +660,7 @@ typedef struct {
* Data that follows is of this form
*
* icUInt16Number inputTable[inputChan][icAny]; * The in-table
- * icUInt16Number clutTable[icAny]; * The clut
+ * icUInt16Number clutTable[icAny]; * The clut
* icUInt16Number outputTable[outputChan][icAny]; * The out-table
*/
} icLut16;
@@ -674,20 +672,20 @@ typedef struct {
icUInt8Number clutPoints; /* Num of grid points */
icInt8Number pad;
icS15Fixed16Number e00; /* e00 in the 3 * 3 */
- icS15Fixed16Number e01; /* e01 in the 3 * 3 */
+ icS15Fixed16Number e01; /* e01 in the 3 * 3 */
icS15Fixed16Number e02; /* e02 in the 3 * 3 */
icS15Fixed16Number e10; /* e10 in the 3 * 3 */
- icS15Fixed16Number e11; /* e11 in the 3 * 3 */
- icS15Fixed16Number e12; /* e12 in the 3 * 3 */
+ icS15Fixed16Number e11; /* e11 in the 3 * 3 */
+ icS15Fixed16Number e12; /* e12 in the 3 * 3 */
icS15Fixed16Number e20; /* e20 in the 3 * 3 */
- icS15Fixed16Number e21; /* e21 in the 3 * 3 */
+ icS15Fixed16Number e21; /* e21 in the 3 * 3 */
icS15Fixed16Number e22; /* e22 in the 3 * 3 */
icUInt8Number data[icAny]; /* Data follows see spec */
/*
* Data that follows is of this form
*
* icUInt8Number inputTable[inputChan][256]; * The in-table
- * icUInt8Number clutTable[icAny]; * The clut
+ * icUInt8Number clutTable[icAny]; * The clut
* icUInt8Number outputTable[outputChan][256]; * The out-table
*/
} icLut8;
@@ -704,7 +702,7 @@ typedef struct {
/* Named color */
/*
- * icNamedColor2 takes the place of icNamedColor
+ * icNamedColor2 takes the place of icNamedColor
*/
typedef struct {
icUInt32Number vendorFlag; /* Bottom 16 bits for IC use */
@@ -725,16 +723,16 @@ typedef struct {
* :
* :
* Repeat for name and PCS and device color coordinates up to (count-1)
- *
- * NOTES:
+ *
+ * NOTES:
* PCS and device space can be determined from the header.
*
- * PCS coordinates are icUInt16 numbers and are described in Annex A of
- * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of
+ * PCS coordinates are icUInt16 numbers and are described in Annex A of
+ * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of
* coordinates is consistent with the headers PCS.
*
* Device coordinates are icUInt16 numbers where 0x0000 represents
- * the minimum value and 0xFFFF represents the maximum value.
+ * the minimum value and 0xFFFF represents the maximum value.
* If the nDeviceCoords value is 0 this field is not given.
*/
} icNamedColor2;
@@ -748,7 +746,7 @@ typedef struct {
icInt8Number data[icAny]; /* Desc text follows */
/*
* Data that follows is of this form, this is an icInt8Number
- * to avoid problems with a compiler generating bad code as
+ * to avoid problems with a compiler generating bad code as
* these arrays are variable in length.
*
* icTextDescription deviceMfgDesc; * Manufacturer text
@@ -808,7 +806,7 @@ typedef struct {
icInt8Number data[icAny]; /* The Ucr BG data */
/*
* Data that follows is of this form, this is a icInt8Number
- * to avoid problems with a compiler generating bad code as
+ * to avoid problems with a compiler generating bad code as
* these arrays are variable in length.
*
* icUcrBgCurve ucr; * Ucr curve
@@ -1015,7 +1013,7 @@ typedef struct {
icTagBase base; /* Signature, "ui64" */
icUInt64Array data; /* Variable array of values */
} icUInt64ArrayType;
-
+
/* uInt8Type */
typedef struct {
icTagBase base; /* Signature, "ui08" */
@@ -1042,11 +1040,10 @@ typedef struct {
icCrdInfo info; /* 5 sets of counts & strings */
}icCrdInfoType;
/* icCrdInfo productName; PS product count/string */
- /* icCrdInfo CRDName0; CRD name for intent 0 */
- /* icCrdInfo CRDName1; CRD name for intent 1 */
- /* icCrdInfo CRDName2; CRD name for intent 2 */
+ /* icCrdInfo CRDName0; CRD name for intent 0 */
+ /* icCrdInfo CRDName1; CRD name for intent 1 */
+ /* icCrdInfo CRDName2; CRD name for intent 2 */
/* icCrdInfo CRDName3; CRD name for intent 3 */
-
typedef struct {
icTagBase base; /* Signature, 'devs' */
@@ -1083,8 +1080,8 @@ typedef struct {
/* A tag */
typedef struct {
icTagSignature sig; /* The tag signature */
- icUInt32Number offset; /* Start of tag relative to
- * start of header, Spec
+ icUInt32Number offset; /* Start of tag relative to
+ * start of header, Spec
* Clause 5 */
icUInt32Number size; /* Size in bytes */
} icTag;
@@ -1116,8 +1113,8 @@ typedef struct {
icInt8Number reserved[44]; /* Reserved */
} icHeader;
-/*
- * A profile,
+/*
+ * A profile,
* we can't use icTagList here because its not at the end of the structure
*/
typedef struct {
@@ -1127,10 +1124,10 @@ typedef struct {
/*
* Data that follows is of the form
*
- * icTag tagTable[icAny]; * The tag table
- * icInt8Number tagData[icAny]; * The tag data
+ * icTag tagTable[icAny]; * The tag table
+ * icInt8Number tagData[icAny]; * The tag data
*/
-} icProfile;
+} icProfile;
/*------------------------------------------------------------------------*/
/* Obsolete entries */
@@ -1143,12 +1140,12 @@ typedef struct {
/*
* Data that follows is of this form
*
- * icInt8Number prefix[icAny]; * Prefix
- * icInt8Number suffix[icAny]; * Suffix
- * icInt8Number root1[icAny]; * Root name
- * icInt8Number coords1[icAny]; * Color coordinates
- * icInt8Number root2[icAny]; * Root name
- * icInt8Number coords2[icAny]; * Color coordinates
+ * icInt8Number prefix[icAny]; * Prefix
+ * icInt8Number suffix[icAny]; * Suffix
+ * icInt8Number root1[icAny]; * Root name
+ * icInt8Number coords1[icAny]; * Color coordinates
+ * icInt8Number root2[icAny]; * Root name
+ * icInt8Number coords2[icAny]; * Color coordinates
* :
* :
* Repeat for root name and color coordinates up to (count-1)
diff --git a/gs/ijs/ijs.c b/gs/ijs/ijs.c
index ae69556f6..8f235c95d 100644
--- a/gs/ijs/ijs.c
+++ b/gs/ijs/ijs.c
@@ -109,11 +109,11 @@ ijs_recv_read (IjsRecvChan *ch, char *buf, int size)
{
nbytes = read (ch->fd, buf + ix, size - ix);
if (nbytes < 0)
- return nbytes;
+ return nbytes;
else if (nbytes == 0)
- return ix;
+ return ix;
else
- ix += nbytes;
+ ix += nbytes;
}
while (ix < size);
return ix;
@@ -136,7 +136,7 @@ ijs_recv_buf (IjsRecvChan *ch)
{
nbytes = ijs_recv_read (ch, ch->buf + 8, data_size);
if (nbytes != data_size)
- return IJS_EIO;
+ return IJS_EIO;
}
ch->buf_idx = 8;
return 0;
@@ -164,12 +164,12 @@ ijs_recv_ack (IjsRecvChan *ch)
int cmd = ijs_get_int (ch->buf);
if (cmd == IJS_CMD_NAK)
- {
- if (ch->buf_size != 12)
- status = IJS_EPROTO;
- else
- status = ijs_get_int (ch->buf + 8);
- }
+ {
+ if (ch->buf_size != 12)
+ status = IJS_EPROTO;
+ else
+ status = ijs_get_int (ch->buf + 8);
+ }
}
return status;
}
diff --git a/gs/ijs/ijs_client.c b/gs/ijs/ijs_client.c
index 43e9a42b7..1bc1e99b2 100644
--- a/gs/ijs/ijs_client.c
+++ b/gs/ijs/ijs_client.c
@@ -68,8 +68,8 @@ ijs_invoke_server (const char *server_cmd)
{
nbytes = read (ctx->recv_chan.fd, resp_buf, sizeof(resp_buf));
if (nbytes != sizeof(resp_buf) ||
- memcmp (resp_buf, exp_resp_buf, sizeof(resp_buf)))
- ok = FALSE;
+ memcmp (resp_buf, exp_resp_buf, sizeof(resp_buf)))
+ ok = FALSE;
}
/* exchange version information with server */
@@ -84,7 +84,7 @@ ijs_invoke_server (const char *server_cmd)
if (ok)
{
if (version > IJS_VERSION)
- version = IJS_VERSION;
+ version = IJS_VERSION;
ctx->version = version;
}
@@ -141,7 +141,7 @@ ijs_client_send_cmd_wait (IjsClientCtx *ctx)
/* This is the blocking version; it's not likely to be efficient */
int
ijs_client_send_data_wait (IjsClientCtx *ctx, IjsJobId job_id,
- const char *buf, int size)
+ const char *buf, int size)
{
int status;
@@ -194,7 +194,7 @@ ijs_client_end_job (IjsClientCtx *ctx, IjsJobId job_id)
**/
int
ijs_client_list_params (IjsClientCtx *ctx, IjsJobId job_id,
- char *value, int value_size)
+ char *value, int value_size)
{
int status;
@@ -216,8 +216,8 @@ ijs_client_list_params (IjsClientCtx *ctx, IjsJobId job_id,
**/
int
ijs_client_enum_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key,
- char *value, int value_size)
+ const char *key,
+ char *value, int value_size)
{
int key_size = strlen (key);
int status;
@@ -239,8 +239,8 @@ ijs_client_enum_param (IjsClientCtx *ctx, IjsJobId job_id,
int
ijs_client_set_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key,
- const char *value, int value_size)
+ const char *key,
+ const char *value, int value_size)
{
int key_size = strlen (key);
int status;
@@ -267,8 +267,8 @@ ijs_client_set_param (IjsClientCtx *ctx, IjsJobId job_id,
**/
int
ijs_client_get_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key,
- char *value, int value_size)
+ const char *key,
+ char *value, int value_size)
{
int key_size = strlen (key);
int status;
diff --git a/gs/ijs/ijs_client.h b/gs/ijs/ijs_client.h
index 717da656b..b4e03b34f 100644
--- a/gs/ijs/ijs_client.h
+++ b/gs/ijs/ijs_client.h
@@ -31,8 +31,8 @@ typedef struct _IjsClientCtx IjsClientCtx;
IjsClientCtx *
ijs_invoke_server (const char *server_cmd);
-int
-ijs_exec_server (const char *server_cmd, int *pfd_to, int *pfd_from,
+int
+ijs_exec_server (const char *server_cmd, int *pfd_to, int *pfd_from,
int *pchild_pid);
int
@@ -49,7 +49,7 @@ ijs_client_send_cmd_wait (IjsClientCtx *ctx);
int
ijs_client_send_data_wait (IjsClientCtx *ctx, IjsJobId job_id,
- const char *buf, int size);
+ const char *buf, int size);
int
ijs_client_open (IjsClientCtx *ctx);
@@ -65,22 +65,22 @@ ijs_client_end_job (IjsClientCtx *ctx, IjsJobId job_id);
int
ijs_client_list_params (IjsClientCtx *ctx, IjsJobId job_id,
- char *value, int value_size);
+ char *value, int value_size);
int
ijs_client_enum_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key, char *value,
- int value_size);
+ const char *key, char *value,
+ int value_size);
int
ijs_client_set_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key, const char *value,
- int value_size);
+ const char *key, const char *value,
+ int value_size);
int
ijs_client_get_param (IjsClientCtx *ctx, IjsJobId job_id,
- const char *key, char *value,
- int value_size);
+ const char *key, char *value,
+ int value_size);
int
ijs_client_begin_page (IjsClientCtx *ctx, IjsJobId job_id);
diff --git a/gs/ijs/ijs_client_example.c b/gs/ijs/ijs_client_example.c
index a805a6ace..d6428f3d1 100644
--- a/gs/ijs/ijs_client_example.c
+++ b/gs/ijs/ijs_client_example.c
@@ -42,18 +42,18 @@ example_list_params (IjsClientCtx *ctx)
fprintf (stderr, "settable params: %s\n", buf);
p = strtok(buf, ",");
while (p)
- {
- status = ijs_client_enum_param (ctx, 0, p, ebuf, sizeof(ebuf) - 1);
- if (status >= 0)
- {
- ebuf[status] = 0;
- fprintf (stderr, " %s: %s\n", p, ebuf);
- }
- else
- {
- fprintf (stderr, "Error %d getting param %s\n", status, p);
- }
- p = strtok(NULL, ",");
+ {
+ status = ijs_client_enum_param (ctx, 0, p, ebuf, sizeof(ebuf) - 1);
+ if (status >= 0)
+ {
+ ebuf[status] = 0;
+ fprintf (stderr, " %s: %s\n", p, ebuf);
+ }
+ else
+ {
+ fprintf (stderr, "Error %d getting param %s\n", status, p);
+ }
+ p = strtok(NULL, ",");
}
}
else
@@ -99,9 +99,9 @@ send_pnm_file (IjsClientCtx *ctx, FILE *f, int xres, int yres)
{
/* skip depth */
do
- {
- lp = fgets (buf, sizeof(buf), f);
- }
+ {
+ lp = fgets (buf, sizeof(buf), f);
+ }
while (lp != NULL && lp[0] == '#');
}
@@ -131,18 +131,18 @@ send_pnm_file (IjsClientCtx *ctx, FILE *f, int xres, int yres)
{
int n_bytes = bytes_left;
if (n_bytes > sizeof(buf))
- n_bytes = sizeof(buf);
+ n_bytes = sizeof(buf);
fread (buf, 1, n_bytes, f); /* todo: check error */
if (type == '4')
- {
- /* invert pbm so black is 0, as per DeviceGray color space */
- int i;
- for (i = 0; i < n_bytes; i++)
- buf[i] ^= 0xff;
- }
+ {
+ /* invert pbm so black is 0, as per DeviceGray color space */
+ int i;
+ for (i = 0; i < n_bytes; i++)
+ buf[i] ^= 0xff;
+ }
status = ijs_client_send_data_wait (ctx, 0, buf, n_bytes);
if (status)
- break;
+ break;
bytes_left -= n_bytes;
}
@@ -161,7 +161,6 @@ verify_context (IjsClientCtx *ctx)
}
}
-
static void
param_usage (void)
{
@@ -185,56 +184,56 @@ example_set_params (IjsClientCtx *ctx, const char *arg)
for (ibeg = i; arg[ibeg] == ' '; ibeg++);
for (ieq = ibeg; arg[ieq] != 0; ieq++)
- {
- if (arg[ieq] == '=')
- break;
- }
+ {
+ if (arg[ieq] == '=')
+ break;
+ }
if (arg[ieq] == 0)
- {
- param_usage ();
- return;
- }
+ {
+ param_usage ();
+ return;
+ }
for (iend = ieq; iend >= ibeg; iend--)
- if (arg[iend - 1] != ' ')
- break;
+ if (arg[iend - 1] != ' ')
+ break;
if (iend == ibeg)
- {
- param_usage ();
- return;
- }
+ {
+ param_usage ();
+ return;
+ }
key_size = iend - ibeg;
if (key_size + 1 > sizeof(key))
- {
- fprintf (stderr, "Key exceeds %d bytes\n", sizeof(key));
- return;
- }
+ {
+ fprintf (stderr, "Key exceeds %d bytes\n", sizeof(key));
+ return;
+ }
memcpy (key, arg + ibeg, key_size);
key[key_size] = 0;
buf_ix = 0;
for (i = ieq + 1; arg[i] == ' '; i++);
for (; arg[i] != 0; i++)
- {
- if (arg[i] == ',')
- break;
- if (buf_ix == sizeof(buf))
- {
- fprintf (stderr, "Value for %s exceeds %d bytes\n",
- key, sizeof(buf));
- return;
- }
- if (arg[i] == '\\' && arg[i + 1] != 0)
- buf[buf_ix++] = arg[++i];
- else
- buf[buf_ix++] = arg[i];
- }
+ {
+ if (arg[i] == ',')
+ break;
+ if (buf_ix == sizeof(buf))
+ {
+ fprintf (stderr, "Value for %s exceeds %d bytes\n",
+ key, sizeof(buf));
+ return;
+ }
+ if (arg[i] == '\\' && arg[i + 1] != 0)
+ buf[buf_ix++] = arg[++i];
+ else
+ buf[buf_ix++] = arg[i];
+ }
if (arg[i] == ',')
- inext = i + 1;
+ inext = i + 1;
else
- inext = i;
+ inext = i;
code = ijs_client_set_param (ctx, 0, key, buf, buf_ix);
if (code < 0)
- fprintf (stderr, "Warning: error %d setting parameter %s\n",
- code, key);
+ fprintf (stderr, "Warning: error %d setting parameter %s\n",
+ code, key);
}
}
@@ -283,9 +282,9 @@ get_arg (int argc, char **argv, int *pi, const char *arg)
{
(*pi)++;
if (*pi == argc)
- return NULL;
+ return NULL;
else
- return argv[*pi];
+ return argv[*pi];
}
}
@@ -303,69 +302,69 @@ main (int argc, char **argv)
const char *arg = argv[i];
if (arg[0] == '-')
- {
- switch (arg[1])
- {
- case 'r':
- {
- char *tail;
-
- arg = get_arg (argc, argv, &i, arg + 2);
- xres = strtol (arg, &tail, 10);
- if (tail[0] == 0)
- yres = xres;
- else if (tail[0] == 'x')
- yres = strtol (tail + 1, &tail, 10);
- }
- break;
- case 's':
- arg = get_arg (argc, argv, &i, arg + 2);
- ctx = ijs_invoke_server (arg);
- if (!ctx) {
- fprintf (stderr, "ijs_invoke_server %s failed\n", arg);
- return 1;
- }
- ijs_client_open (ctx);
- ijs_client_begin_job (ctx, 0);
- break;
- case 'p':
- arg = get_arg (argc, argv, &i, arg + 2);
- verify_context (ctx);
- example_set_params (ctx, arg);
- break;
- case 'g':
- arg = get_arg (argc, argv, &i, arg + 2);
- verify_context (ctx);
- example_get_param (ctx, arg);
- break;
- case 'e':
- arg = get_arg (argc, argv, &i, arg + 2);
- verify_context (ctx);
- example_enum_param (ctx, arg);
- break;
- case 'l':
- verify_context (ctx);
- example_list_params (ctx);
- break;
- case 0:
- verify_context (ctx);
- send_pnm_file (ctx, stdin, xres, yres);
- break;
- }
- }
+ {
+ switch (arg[1])
+ {
+ case 'r':
+ {
+ char *tail;
+
+ arg = get_arg (argc, argv, &i, arg + 2);
+ xres = strtol (arg, &tail, 10);
+ if (tail[0] == 0)
+ yres = xres;
+ else if (tail[0] == 'x')
+ yres = strtol (tail + 1, &tail, 10);
+ }
+ break;
+ case 's':
+ arg = get_arg (argc, argv, &i, arg + 2);
+ ctx = ijs_invoke_server (arg);
+ if (!ctx) {
+ fprintf (stderr, "ijs_invoke_server %s failed\n", arg);
+ return 1;
+ }
+ ijs_client_open (ctx);
+ ijs_client_begin_job (ctx, 0);
+ break;
+ case 'p':
+ arg = get_arg (argc, argv, &i, arg + 2);
+ verify_context (ctx);
+ example_set_params (ctx, arg);
+ break;
+ case 'g':
+ arg = get_arg (argc, argv, &i, arg + 2);
+ verify_context (ctx);
+ example_get_param (ctx, arg);
+ break;
+ case 'e':
+ arg = get_arg (argc, argv, &i, arg + 2);
+ verify_context (ctx);
+ example_enum_param (ctx, arg);
+ break;
+ case 'l':
+ verify_context (ctx);
+ example_list_params (ctx);
+ break;
+ case 0:
+ verify_context (ctx);
+ send_pnm_file (ctx, stdin, xres, yres);
+ break;
+ }
+ }
else
- {
- FILE *f = fopen (arg, "rb");
-
- if (f == NULL)
- {
- fprintf (stderr, "error opening %s\n", arg);
- return 1;
- }
- verify_context (ctx);
- send_pnm_file (ctx, f, xres, yres);
- fclose (f);
- }
+ {
+ FILE *f = fopen (arg, "rb");
+
+ if (f == NULL)
+ {
+ fprintf (stderr, "error opening %s\n", arg);
+ return 1;
+ }
+ verify_context (ctx);
+ send_pnm_file (ctx, f, xres, yres);
+ fclose (f);
+ }
}
verify_context (ctx);
diff --git a/gs/ijs/ijs_exec_unix.c b/gs/ijs/ijs_exec_unix.c
index c5be20b0f..86963338d 100644
--- a/gs/ijs/ijs_exec_unix.c
+++ b/gs/ijs/ijs_exec_unix.c
@@ -29,8 +29,8 @@
#include "ijs.h"
#include "ijs_client.h"
-int
-ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
+int
+ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
int *pchild_pid)
{
int fds_to[2], fds_from[2];
@@ -77,7 +77,7 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
argv[i++] = NULL;
status = execvp (argv[0], argv);
if (status < 0)
- exit (1);
+ exit (1);
}
/* Ignore SIGPIPE signals. This is the behaviour you'll want most of
@@ -90,7 +90,7 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
#ifdef VERBOSE
fprintf (stderr, "child_pid = %d; %d %d\n",
- child_pid, fds_to[0], fds_from[1]);
+ child_pid, fds_to[0], fds_from[1]);
#endif
close (fds_to[0]);
close (fds_from[1]);
@@ -101,4 +101,3 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
return 0;
}
-
diff --git a/gs/ijs/ijs_exec_win.c b/gs/ijs/ijs_exec_win.c
index b6fb01568..bea9cf711 100644
--- a/gs/ijs/ijs_exec_win.c
+++ b/gs/ijs/ijs_exec_win.c
@@ -31,8 +31,8 @@
#include "ijs_client.h"
/* Start child program with redirected standard input and output */
-int
-ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
+int
+ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
int *pchild_pid)
{
SECURITY_ATTRIBUTES saAttr;
@@ -64,10 +64,10 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
GetCurrentProcess(), &hChildStdinWr, 0,
FALSE, /* not inherited */
DUPLICATE_SAME_ACCESS);
- CloseHandle(hPipeTemp);
+ CloseHandle(hPipeTemp);
}
if (flag)
- flag = CreatePipe(&hPipeTemp, &hChildStdoutWr, &saAttr, 0);
+ flag = CreatePipe(&hPipeTemp, &hChildStdoutWr, &saAttr, 0);
if (flag) {
flag = DuplicateHandle(GetCurrentProcess(), hPipeTemp,
GetCurrentProcess(), &hChildStdoutRd, 0,
@@ -76,77 +76,75 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
CloseHandle(hPipeTemp);
}
if (flag)
- flag = (fd_stdin_wr = _open_osfhandle((LONG)hChildStdinWr, _O_BINARY)) != -1;
+ flag = (fd_stdin_wr = _open_osfhandle((LONG)hChildStdinWr, _O_BINARY)) != -1;
if (flag)
- flag = (fd_stdout_rd = _open_osfhandle((LONG)hChildStdoutRd, _O_BINARY)) != -1;
+ flag = (fd_stdout_rd = _open_osfhandle((LONG)hChildStdoutRd, _O_BINARY)) != -1;
/* Now create the child process. */
if (flag) {
- /* Set up members of STARTUPINFO structure. */
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.lpReserved = NULL;
- siStartInfo.lpDesktop = NULL;
- siStartInfo.lpTitle = NULL; /* use executable name as title */
- siStartInfo.dwX = siStartInfo.dwY = CW_USEDEFAULT; /* ignored */
- siStartInfo.dwXSize = siStartInfo.dwYSize = CW_USEDEFAULT;/* ignored */
- siStartInfo.dwXCountChars = 80;
- siStartInfo.dwYCountChars = 25;
- siStartInfo.dwFillAttribute = 0; /* ignored */
- siStartInfo.dwFlags = STARTF_USESTDHANDLES;
+ /* Set up members of STARTUPINFO structure. */
+ siStartInfo.cb = sizeof(STARTUPINFO);
+ siStartInfo.lpReserved = NULL;
+ siStartInfo.lpDesktop = NULL;
+ siStartInfo.lpTitle = NULL; /* use executable name as title */
+ siStartInfo.dwX = siStartInfo.dwY = CW_USEDEFAULT; /* ignored */
+ siStartInfo.dwXSize = siStartInfo.dwYSize = CW_USEDEFAULT;/* ignored */
+ siStartInfo.dwXCountChars = 80;
+ siStartInfo.dwYCountChars = 25;
+ siStartInfo.dwFillAttribute = 0; /* ignored */
+ siStartInfo.dwFlags = STARTF_USESTDHANDLES;
#ifdef VERBOSE
- siStartInfo.wShowWindow = SW_SHOWNORMAL;
- siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;
+ siStartInfo.wShowWindow = SW_SHOWNORMAL;
+ siStartInfo.dwFlags |= STARTF_USESHOWWINDOW;
#else
- siStartInfo.wShowWindow = SW_HIDE;
+ siStartInfo.wShowWindow = SW_HIDE;
#endif
- siStartInfo.cbReserved2 = 0;
- siStartInfo.lpReserved2 = NULL;
- siStartInfo.hStdInput = hChildStdinRd;
- siStartInfo.hStdOutput = hChildStdoutWr;
- siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
+ siStartInfo.cbReserved2 = 0;
+ siStartInfo.lpReserved2 = NULL;
+ siStartInfo.hStdInput = hChildStdinRd;
+ siStartInfo.hStdOutput = hChildStdoutWr;
+ siStartInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
- env = NULL;
+ env = NULL;
- /* Create the child process. */
+ /* Create the child process. */
- flag = CreateProcess(server_cmd,
- NULL, /* command line */
- NULL, /* process security attributes */
- NULL, /* primary thread security attributes */
- TRUE, /* handles are inherited */
- 0, /* creation flags */
- env, /* environment */
- NULL, /* use parent's current directory */
- &siStartInfo, /* STARTUPINFO pointer */
- &piProcInfo); /* receives PROCESS_INFORMATION */
- if (flag) {
- CloseHandle(piProcInfo.hProcess);
- CloseHandle(piProcInfo.hThread);
- }
+ flag = CreateProcess(server_cmd,
+ NULL, /* command line */
+ NULL, /* process security attributes */
+ NULL, /* primary thread security attributes */
+ TRUE, /* handles are inherited */
+ 0, /* creation flags */
+ env, /* environment */
+ NULL, /* use parent's current directory */
+ &siStartInfo, /* STARTUPINFO pointer */
+ &piProcInfo); /* receives PROCESS_INFORMATION */
+ if (flag) {
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(piProcInfo.hThread);
+ }
}
if (hChildStdinRd != INVALID_HANDLE_VALUE)
CloseHandle(hChildStdinRd);
if (hChildStdoutWr != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdoutWr);
+ CloseHandle(hChildStdoutWr);
if (flag) {
- *pfd_to = fd_stdin_wr;
- *pfd_from = fd_stdout_rd;
- *pchild_pid = (int)piProcInfo.dwProcessId;
+ *pfd_to = fd_stdin_wr;
+ *pfd_from = fd_stdout_rd;
+ *pchild_pid = (int)piProcInfo.dwProcessId;
}
else {
- if (fd_stdin_wr != -1)
- close(fd_stdin_wr);
- else if (hChildStdinWr != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdinWr);
- if (fd_stdout_rd != -1)
- close(fd_stdout_rd);
- else if (hChildStdoutRd != INVALID_HANDLE_VALUE)
- CloseHandle(hChildStdoutRd);
- return -1;
+ if (fd_stdin_wr != -1)
+ close(fd_stdin_wr);
+ else if (hChildStdinWr != INVALID_HANDLE_VALUE)
+ CloseHandle(hChildStdinWr);
+ if (fd_stdout_rd != -1)
+ close(fd_stdout_rd);
+ else if (hChildStdoutRd != INVALID_HANDLE_VALUE)
+ CloseHandle(hChildStdoutRd);
+ return -1;
}
return flag ? 0 : -1;
}
-
-
diff --git a/gs/ijs/ijs_server.c b/gs/ijs/ijs_server.c
index bcab40383..f9d6243b2 100644
--- a/gs/ijs/ijs_server.c
+++ b/gs/ijs/ijs_server.c
@@ -87,16 +87,16 @@ struct _IjsServerCtx {
static int
ijs_server_dummy_begin_cb (void *begin_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id)
+ IjsServerCtx *ctx,
+ IjsJobId job_id)
{
return 0;
}
static int
ijs_server_dummy_end_cb (void *end_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id)
+ IjsServerCtx *ctx,
+ IjsJobId job_id)
{
return 0;
}
@@ -168,7 +168,7 @@ ijs_server_init (void)
int
ijs_server_install_begin_cb (IjsServerCtx *ctx,
- IjsBeginJobCb *begin_cb, void *begin_cb_data)
+ IjsBeginJobCb *begin_cb, void *begin_cb_data)
{
ctx->begin_cb = begin_cb;
ctx->begin_cb_data = begin_cb_data;
@@ -177,7 +177,7 @@ ijs_server_install_begin_cb (IjsServerCtx *ctx,
int
ijs_server_install_end_cb (IjsServerCtx *ctx,
- IjsEndJobCb *end_cb, void *end_cb_data)
+ IjsEndJobCb *end_cb, void *end_cb_data)
{
ctx->end_cb = end_cb;
ctx->end_cb_data = end_cb_data;
@@ -186,8 +186,8 @@ ijs_server_install_end_cb (IjsServerCtx *ctx,
int
ijs_server_install_status_cb (IjsServerCtx *ctx,
- IjsQueryStatusCb *status_cb,
- void *status_cb_data)
+ IjsQueryStatusCb *status_cb,
+ void *status_cb_data)
{
ctx->status_cb = status_cb;
ctx->status_cb_data = status_cb_data;
@@ -196,7 +196,7 @@ ijs_server_install_status_cb (IjsServerCtx *ctx,
int
ijs_server_install_list_cb (IjsServerCtx *ctx,
- IjsListParamsCb *list_cb, void *list_cb_data)
+ IjsListParamsCb *list_cb, void *list_cb_data)
{
ctx->list_cb = list_cb;
ctx->list_cb_data = list_cb_data;
@@ -205,7 +205,7 @@ ijs_server_install_list_cb (IjsServerCtx *ctx,
int
ijs_server_install_enum_cb (IjsServerCtx *ctx,
- IjsEnumParamCb *enum_cb, void *enum_cb_data)
+ IjsEnumParamCb *enum_cb, void *enum_cb_data)
{
ctx->enum_cb = enum_cb;
ctx->enum_cb_data = enum_cb_data;
@@ -214,7 +214,7 @@ ijs_server_install_enum_cb (IjsServerCtx *ctx,
int
ijs_server_install_set_cb (IjsServerCtx *ctx,
- IjsSetParamCb *set_cb, void *set_cb_data)
+ IjsSetParamCb *set_cb, void *set_cb_data)
{
ctx->set_cb = set_cb;
ctx->set_cb_data = set_cb_data;
@@ -223,7 +223,7 @@ ijs_server_install_set_cb (IjsServerCtx *ctx,
int
ijs_server_install_get_cb (IjsServerCtx *ctx,
- IjsGetParamCb *get_cb, void *get_cb_data)
+ IjsGetParamCb *get_cb, void *get_cb_data)
{
ctx->get_cb = get_cb;
ctx->get_cb_data = get_cb_data;
@@ -399,10 +399,10 @@ ijs_server_proc_query_status (IjsServerCtx *ctx)
status = ijs_send_begin (&ctx->send_chan, IJS_CMD_ACK);
if (status < 0)
- return status;
+ return status;
status = ijs_send_int (&ctx->send_chan, code);
if (status < 0)
- return status;
+ return status;
return ijs_send_buf (&ctx->send_chan);
}
}
@@ -430,10 +430,10 @@ ijs_server_proc_list_params (IjsServerCtx *ctx)
status = ijs_send_begin (&ctx->send_chan, IJS_CMD_ACK);
if (status < 0)
- return status;
+ return status;
status = ijs_send_block (&ctx->send_chan, buf, code);
if (status < 0)
- return status;
+ return status;
return ijs_send_buf (&ctx->send_chan);
}
}
@@ -471,10 +471,10 @@ ijs_server_proc_enum_param (IjsServerCtx *ctx)
status = ijs_send_begin (&ctx->send_chan, IJS_CMD_ACK);
if (status < 0)
- return status;
+ return status;
status = ijs_send_block (&ctx->send_chan, buf, code);
if (status < 0)
- return status;
+ return status;
return ijs_send_buf (&ctx->send_chan);
}
}
@@ -513,7 +513,7 @@ ijs_server_parse_int (const char *value, int size, int *result)
{
char c = value[i];
if (c < '0' || c > '9')
- return IJS_ESYNTAX;
+ return IJS_ESYNTAX;
num = (num * 10) + (c - '0');
}
*result = num;
@@ -538,7 +538,7 @@ ijs_server_parse_float (const char *value, int size, double *result)
static int
ijs_server_set_param (IjsServerCtx *ctx, IjsJobId job_id, const char *key,
- const char *value, int value_size)
+ const char *value, int value_size)
{
int code;
@@ -551,14 +551,14 @@ ijs_server_set_param (IjsServerCtx *ctx, IjsJobId job_id, const char *key,
{
code = ijs_server_parse_int (value, value_size, &ctx->ph->n_chan);
if (code == 0)
- ctx->fields_set |= IJS_N_CHAN_SET;
+ ctx->fields_set |= IJS_N_CHAN_SET;
return code;
}
else if (!strcmp (key, "BitsPerSample"))
{
code = ijs_server_parse_int (value, value_size, &ctx->ph->bps);
if (code == 0)
- ctx->fields_set |= IJS_BPS_SET;
+ ctx->fields_set |= IJS_BPS_SET;
return code;
}
else if (!strcmp (key, "ColorSpace"))
@@ -566,24 +566,24 @@ ijs_server_set_param (IjsServerCtx *ctx, IjsJobId job_id, const char *key,
int size = value_size;
if (size > (int)sizeof(ctx->ph->cs) - 1)
- size = sizeof(ctx->ph->cs) - 1;
+ size = sizeof(ctx->ph->cs) - 1;
memcpy (ctx->ph->cs, value, size);
ctx->ph->cs[size] = 0;
- ctx->fields_set |= IJS_CS_SET;
+ ctx->fields_set |= IJS_CS_SET;
return 0;
}
else if (!strcmp (key, "Width"))
{
code = ijs_server_parse_int (value, value_size, &ctx->ph->width);
if (code == 0)
- ctx->fields_set |= IJS_WIDTH_SET;
+ ctx->fields_set |= IJS_WIDTH_SET;
return code;
}
else if (!strcmp (key, "Height"))
{
code = ijs_server_parse_int (value, value_size, &ctx->ph->height);
if (code == 0)
- ctx->fields_set |= IJS_HEIGHT_SET;
+ ctx->fields_set |= IJS_HEIGHT_SET;
return code;
}
else if (!strcmp (key, "Dpi"))
@@ -591,17 +591,17 @@ ijs_server_set_param (IjsServerCtx *ctx, IjsJobId job_id, const char *key,
int x_ix;
for (x_ix = 0; x_ix < value_size; x_ix++)
- if (value[x_ix] == 'x')
- break;
+ if (value[x_ix] == 'x')
+ break;
if (x_ix == value_size)
- return IJS_ESYNTAX;
+ return IJS_ESYNTAX;
code = ijs_server_parse_float (value, x_ix, &ctx->ph->xres);
if (code < 0)
- return code;
+ return code;
code = ijs_server_parse_float (value + x_ix + 1, value_size - (x_ix + 1),
- &ctx->ph->yres);
+ &ctx->ph->yres);
if (code < 0)
- return code;
+ return code;
ctx->fields_set |= IJS_DPI_SET;
return 0;
}
@@ -647,13 +647,13 @@ ijs_server_proc_set_param (IjsServerCtx *ctx)
static int
ijs_server_get_param (IjsServerCtx *ctx, IjsJobId job_id, const char *key,
- char *value, int value_size)
+ char *value, int value_size)
{
#ifdef VERBOSE
fprintf (stderr, "ijs_server_get_param %s\n", key);
#endif
return ctx->get_cb (ctx->get_cb_data, ctx, job_id, key,
- value, value_size);
+ value, value_size);
}
static int
@@ -689,10 +689,10 @@ ijs_server_proc_get_param (IjsServerCtx *ctx)
status = ijs_send_begin (&ctx->send_chan, IJS_CMD_ACK);
if (status < 0)
- return status;
+ return status;
status = ijs_send_block (&ctx->send_chan, buf, code);
if (status < 0)
- return status;
+ return status;
return ijs_send_buf (&ctx->send_chan);
}
}
@@ -709,7 +709,7 @@ ijs_server_proc_begin_page (IjsServerCtx *ctx)
status = IJS_EPROTO;
#ifdef VERBOSE
fprintf (stderr, "begin page %d %d %s %d %d\n",
- ph->n_chan, ph->bps, ph->cs, ph->width, ph->height);
+ ph->n_chan, ph->bps, ph->cs, ph->width, ph->height);
#endif
if (!status)
{
@@ -748,7 +748,7 @@ ijs_server_proc_send_data_block (IjsServerCtx *ctx)
#ifdef VERBOSE
fprintf (stderr, "status=%d, send data block id=%d, size=%d\n",
- status, job_id, size);
+ status, job_id, size);
#endif
if (status)
return ijs_server_nak (ctx, status);
@@ -764,13 +764,13 @@ ijs_server_proc_send_data_block (IjsServerCtx *ctx)
ctx->overflow_buf = (char *)malloc (ctx->overflow_buf_size);
ctx->overflow_buf_ix = 0;
status = ijs_server_read_data (ctx, ctx->buf + ctx->buf_ix,
- ctx->buf_size - ctx->buf_ix);
+ ctx->buf_size - ctx->buf_ix);
ctx->buf_ix = ctx->buf_size;
if (!status)
- {
- status = ijs_server_read_data (ctx, ctx->overflow_buf,
- ctx->overflow_buf_size);
- }
+ {
+ status = ijs_server_read_data (ctx, ctx->overflow_buf,
+ ctx->overflow_buf_size);
+ }
}
return ijs_server_ack (ctx);
}
@@ -847,7 +847,7 @@ ijs_server_get_page_header (IjsServerCtx *ctx, IjsPageHeader *ph)
ctx->ph = ph;
ctx->in_page = FALSE;
- do
+ do
{
status = ijs_server_iter (ctx);
}
@@ -862,7 +862,7 @@ ijs_server_get_page_header (IjsServerCtx *ctx, IjsPageHeader *ph)
* @ctx: The server context.
* @buf: Buffer for data being read.
* @size: Size of buf.
- *
+ *
* Gets data from client. Data is stored in @buf or the
* overflow_buf.
*
@@ -883,17 +883,17 @@ ijs_server_get_data (IjsServerCtx *ctx, char *buf, int size)
{
int n_bytes = ctx->overflow_buf_size - ctx->overflow_buf_ix;
if (n_bytes > size)
- n_bytes = size;
+ n_bytes = size;
memcpy (buf, ctx->overflow_buf + ctx->overflow_buf_ix, n_bytes);
ctx->overflow_buf_ix += n_bytes;
buf_ix = n_bytes;
if (ctx->overflow_buf_ix == ctx->overflow_buf_size)
- {
- free (ctx->overflow_buf);
- ctx->overflow_buf = NULL;
- ctx->overflow_buf_size = 0;
- ctx->overflow_buf_ix = 0;
- }
+ {
+ free (ctx->overflow_buf);
+ ctx->overflow_buf = NULL;
+ ctx->overflow_buf_size = 0;
+ ctx->overflow_buf_ix = 0;
+ }
}
ctx->buf = buf;
ctx->buf_size = size;
diff --git a/gs/ijs/ijs_server.h b/gs/ijs/ijs_server.h
index 53e92b1ae..74bc8a4b7 100644
--- a/gs/ijs/ijs_server.h
+++ b/gs/ijs/ijs_server.h
@@ -41,75 +41,75 @@ typedef struct {
/* callbacks, lots of callbacks */
typedef int IjsBeginJobCb (void *begin_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id);
+ IjsServerCtx *ctx,
+ IjsJobId job_id);
typedef int IjsEndJobCb (void *end_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id);
+ IjsServerCtx *ctx,
+ IjsJobId job_id);
typedef int IjsQueryStatusCb (void *status_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id);
+ IjsServerCtx *ctx,
+ IjsJobId job_id);
typedef int IjsListParamsCb (void *list_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- char *val_buf,
- int val_size);
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ char *val_buf,
+ int val_size);
typedef int IjsEnumParamCb (void *enum_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- const char *key,
- char *val_buf,
- int val_size);
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ const char *key,
+ char *val_buf,
+ int val_size);
typedef int IjsSetParamCb (void *set_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- const char *key,
- const char *value,
- int value_size);
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ const char *key,
+ const char *value,
+ int value_size);
typedef int IjsGetParamCb (void *get_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- const char *key,
- char *val_buf,
- int val_size);
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ const char *key,
+ char *val_buf,
+ int val_size);
IjsServerCtx *
ijs_server_init (void);
int
ijs_server_install_begin_cb (IjsServerCtx *ctx,
- IjsBeginJobCb *begin_cb, void *begin_cb_data);
+ IjsBeginJobCb *begin_cb, void *begin_cb_data);
int
ijs_server_install_end_cb (IjsServerCtx *ctx,
- IjsEndJobCb *end_cb, void *end_cb_data);
+ IjsEndJobCb *end_cb, void *end_cb_data);
int
ijs_server_install_status_cb (IjsServerCtx *ctx,
- IjsQueryStatusCb *status_cb,
- void *status_cb_data);
+ IjsQueryStatusCb *status_cb,
+ void *status_cb_data);
int
ijs_server_install_list_cb (IjsServerCtx *ctx,
- IjsListParamsCb *list_cb, void *list_cb_data);
+ IjsListParamsCb *list_cb, void *list_cb_data);
int
ijs_server_install_enum_cb (IjsServerCtx *ctx,
- IjsEnumParamCb *enum_cb, void *enum_cb_data);
+ IjsEnumParamCb *enum_cb, void *enum_cb_data);
int
ijs_server_install_set_cb (IjsServerCtx *ctx,
- IjsSetParamCb *set_cb, void *set_cb_data);
+ IjsSetParamCb *set_cb, void *set_cb_data);
int
ijs_server_install_get_cb (IjsServerCtx *ctx,
- IjsGetParamCb *get_cb, void *get_cb_data);
+ IjsGetParamCb *get_cb, void *get_cb_data);
void
ijs_server_done (IjsServerCtx *ctx);
diff --git a/gs/ijs/ijs_server_example.c b/gs/ijs/ijs_server_example.c
index 169cdec1e..1f0dba01c 100644
--- a/gs/ijs/ijs_server_example.c
+++ b/gs/ijs/ijs_server_example.c
@@ -41,18 +41,18 @@ struct _ExampleParamList {
static int
example_status_cb (void *status_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id)
+ IjsServerCtx *ctx,
+ IjsJobId job_id)
{
return 0;
}
static int
example_list_cb (void *list_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- char *val_buf,
- int val_size)
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ char *val_buf,
+ int val_size)
{
const char *param_list = "OutputFile,DeviceManufacturer,DeviceModel,PageImageFormat,Dpi,Width,Height,BitsPerSample,ColorSpace,NumChan,PaperSize,PrintableArea,PrintableTopLeft,TopLeft";
int size = strlen (param_list);
@@ -68,11 +68,11 @@ example_list_cb (void *list_cb_data,
static int
example_enum_cb (void *enum_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- const char *key,
- char *val_buf,
- int val_size)
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ const char *key,
+ char *val_buf,
+ int val_size)
{
const char *val = NULL;
if (!strcmp (key, "ColorSpace"))
@@ -91,7 +91,7 @@ example_enum_cb (void *enum_cb_data,
int size = strlen (val);
if (size > val_size)
- return IJS_EBUF;
+ return IJS_EBUF;
memcpy (val_buf, val, size);
return size;
}
@@ -100,7 +100,7 @@ example_enum_cb (void *enum_cb_data,
/* A C implementation of /^(\d\.+\-eE)+x(\d\.+\-eE)+$/ */
static int
example_parse_wxh (const char *val, int size,
- double *pw, double *ph)
+ double *pw, double *ph)
{
char buf[256];
char *tail;
@@ -149,7 +149,7 @@ example_find_key (ExampleParamList *pl, const char *key)
for (curs = pl; curs != NULL; curs = curs->next)
{
if (!strcmp (curs->key, key))
- return curs;
+ return curs;
}
return NULL;
}
@@ -185,7 +185,7 @@ example_compute_printable (ExampleParamList *pl, double printable[4])
static int
example_compute_offset (ExampleParamList *pl, IjsPageHeader *ph,
- double *px0, double *py0)
+ double *px0, double *py0)
{
ExampleParamList *curs;
double width, height;
@@ -205,21 +205,21 @@ example_compute_offset (ExampleParamList *pl, IjsPageHeader *ph,
{
curs = example_find_key (pl, "TopLeft");
if (curs != NULL)
- {
- code = example_parse_wxh (curs->value, curs->value_size,
- &top, &left);
- }
+ {
+ code = example_parse_wxh (curs->value, curs->value_size,
+ &top, &left);
+ }
else
- {
- double printable[4];
-
- code = example_compute_printable (pl, printable);
- if (code == 0)
- {
- top = printable[2];
- left = printable[3];
- }
- }
+ {
+ double printable[4];
+
+ code = example_compute_printable (pl, printable);
+ if (code == 0)
+ {
+ top = printable[2];
+ left = printable[3];
+ }
+ }
}
if (code == 0)
@@ -233,11 +233,11 @@ example_compute_offset (ExampleParamList *pl, IjsPageHeader *ph,
static int
example_get_cb (void *get_cb_data,
- IjsServerCtx *ctx,
- IjsJobId job_id,
- const char *key,
- char *val_buf,
- int val_size)
+ IjsServerCtx *ctx,
+ IjsJobId job_id,
+ const char *key,
+ char *val_buf,
+ int val_size)
{
ExampleParamList *pl = *(ExampleParamList **)get_cb_data;
ExampleParamList *curs;
@@ -250,7 +250,7 @@ example_get_cb (void *get_cb_data,
if (curs != NULL)
{
if (curs->value_size > val_size)
- return IJS_EBUF;
+ return IJS_EBUF;
memcpy (val_buf, curs->value, curs->value_size);
return curs->value_size;
}
@@ -262,10 +262,10 @@ example_get_cb (void *get_cb_data,
code = example_compute_printable (pl, printable);
if (code == 0)
- {
- sprintf (buf, "%gx%g", printable[off + 0], printable[off + 1]);
- val = buf;
- }
+ {
+ sprintf (buf, "%gx%g", printable[off + 0], printable[off + 1]);
+ val = buf;
+ }
}
if (!strcmp (key, "DeviceManufacturer"))
@@ -282,7 +282,7 @@ example_get_cb (void *get_cb_data,
int size = strlen (val);
if (size > val_size)
- return IJS_EBUF;
+ return IJS_EBUF;
memcpy (val_buf, val, size);
return size;
}
@@ -290,7 +290,7 @@ example_get_cb (void *get_cb_data,
static int
example_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId job_id,
- const char *key, const char *value, int value_size)
+ const char *key, const char *value, int value_size)
{
ExampleParamList **ppl = (ExampleParamList **)set_cb_data;
ExampleParamList *pl;
@@ -305,7 +305,7 @@ example_set_cb (void *set_cb_data, IjsServerCtx *ctx, IjsJobId job_id,
code = example_parse_wxh (value, value_size, &width, &height);
if (code < 0)
- return code;
+ return code;
}
fwrite (value, 1, value_size, stderr);
@@ -389,7 +389,7 @@ main (int argc, char **argv)
ijs_server_install_set_cb (ctx, example_set_cb, &pl);
ijs_server_install_get_cb (ctx, example_get_cb, &pl);
- do
+ do
{
int total_bytes, bytes_left;
ExampleParamList *curs;
@@ -397,35 +397,35 @@ main (int argc, char **argv)
status = ijs_server_get_page_header (ctx, &ph);
if (status) break;
fprintf (stderr, "got page header, %d x %d\n",
- ph.width, ph.height);
+ ph.width, ph.height);
if (f == NULL)
- {
- fn = find_param (pl, "OutputFile");
- /* todo: check error! */
-
- if (fn == NULL)
- {
- fn = find_param (pl, "OutputFD");
- if (fn != NULL)
- {
- f = fdopen (atoi (fn), "wb");
- }
- }
- else
- {
- f = fopen (fn, "wb");
- }
- if (f == NULL)
- {
- fprintf (stderr, "can't open output file %s\n", fn);
- fclose (stdin);
- fclose (stdout);
- break;
- }
- if (fn != NULL)
- free (fn);
- }
+ {
+ fn = find_param (pl, "OutputFile");
+ /* todo: check error! */
+
+ if (fn == NULL)
+ {
+ fn = find_param (pl, "OutputFD");
+ if (fn != NULL)
+ {
+ f = fdopen (atoi (fn), "wb");
+ }
+ }
+ else
+ {
+ f = fopen (fn, "wb");
+ }
+ if (f == NULL)
+ {
+ fprintf (stderr, "can't open output file %s\n", fn);
+ fclose (stdin);
+ fclose (stdout);
+ break;
+ }
+ if (fn != NULL)
+ free (fn);
+ }
fprintf (f, "%%!PS-Adobe-2.0\n");
@@ -435,71 +435,71 @@ main (int argc, char **argv)
yscale = 72.0 / ph.yres;
fprintf (f, "%%%%BoundingBox: %d %d %d %d\n",
- (int)(x0 * 72), (int)(y0 * 72),
- (int)(x0 * 72 + xscale * ph.width + 0.999),
- (int)(y0 * 72 + yscale * ph.height + 0.999));
+ (int)(x0 * 72), (int)(y0 * 72),
+ (int)(x0 * 72 + xscale * ph.width + 0.999),
+ (int)(y0 * 72 + yscale * ph.height + 0.999));
fprintf (f, "/rhex { currentfile exch readhexstring pop } bind def\n");
fprintf (f, "/picstr %d string def\n", ph.width);
for (curs = pl; curs != NULL; curs = curs->next)
- {
- fprintf (f, "%% IJS parameter: %s = ", curs->key);
- fwrite (curs->value, 1, curs->value_size, f);
- fputs ("\n", f);
- }
+ {
+ fprintf (f, "%% IJS parameter: %s = ", curs->key);
+ fwrite (curs->value, 1, curs->value_size, f);
+ fputs ("\n", f);
+ }
fprintf (f,
- "gsave\n"
- "%f %f translate\n"
- "%f %f scale\n"
- "%d %d %d\n"
- "[ %d 0 0 %d 0 %d ]\n",
- x0 * 72, y0 * 72,
- xscale * ph.width, yscale * ph.height,
- ph.width, ph.height, ph.bps,
- ph.width, -ph.height, ph.height);
+ "gsave\n"
+ "%f %f translate\n"
+ "%f %f scale\n"
+ "%d %d %d\n"
+ "[ %d 0 0 %d 0 %d ]\n",
+ x0 * 72, y0 * 72,
+ xscale * ph.width, yscale * ph.height,
+ ph.width, ph.height, ph.bps,
+ ph.width, -ph.height, ph.height);
if (ph.n_chan == 1)
- fprintf (f, "{ picstr rhex } image\n");
+ fprintf (f, "{ picstr rhex } image\n");
else
- {
- fprintf (f, "{ picstr rhex }\n"
- "false %d colorimage\n", ph.n_chan);
- }
+ {
+ fprintf (f, "{ picstr rhex }\n"
+ "false %d colorimage\n", ph.n_chan);
+ }
total_bytes = ((ph.n_chan * ph.bps * ph.width + 7) >> 3) * ph.height;
bytes_left = total_bytes;
while (bytes_left)
- {
- int n_bytes = bytes_left;
- int i, j;
+ {
+ int n_bytes = bytes_left;
+ int i, j;
- if (n_bytes > sizeof(buf))
- n_bytes = sizeof(buf);
+ if (n_bytes > sizeof(buf))
+ n_bytes = sizeof(buf);
#ifdef VERBOSE
- fprintf (stderr, "%d bytes left, reading %d\n", bytes_left, n_bytes);
+ fprintf (stderr, "%d bytes left, reading %d\n", bytes_left, n_bytes);
#endif
- status = ijs_server_get_data (ctx, buf, n_bytes);
- if (status)
- {
- fprintf (stderr, "page aborted!\n");
- break;
- }
- j = 0;
- for (i = 0; i < n_bytes; i++)
- {
- const char hex[16] = "0123456789AbCdEf";
- unsigned char c = ((unsigned char *)buf)[i];
-
- hexbuf[j++] = hex[c >> 4];
- hexbuf[j++] = hex[c & 0xf];
- if ((i & 31) == 31)
- hexbuf[j++] = '\n';
- }
- if ((n_bytes & 31) != 0)
- hexbuf[j++] = '\n';
- fwrite (hexbuf, 1, j, f);
- bytes_left -= n_bytes;
- }
+ status = ijs_server_get_data (ctx, buf, n_bytes);
+ if (status)
+ {
+ fprintf (stderr, "page aborted!\n");
+ break;
+ }
+ j = 0;
+ for (i = 0; i < n_bytes; i++)
+ {
+ const char hex[16] = "0123456789AbCdEf";
+ unsigned char c = ((unsigned char *)buf)[i];
+
+ hexbuf[j++] = hex[c >> 4];
+ hexbuf[j++] = hex[c & 0xf];
+ if ((i & 31) == 31)
+ hexbuf[j++] = '\n';
+ }
+ if ((n_bytes & 31) != 0)
+ hexbuf[j++] = '\n';
+ fwrite (hexbuf, 1, j, f);
+ bytes_left -= n_bytes;
+ }
fprintf (f, "grestore\nshowpage\n");
}
while (status == 0);
diff --git a/gs/ijs/ijs_spec.ps b/gs/ijs/ijs_spec.ps
index 018da9e95..c464a9cb5 100644
--- a/gs/ijs/ijs_spec.ps
+++ b/gs/ijs/ijs_spec.ps
@@ -78,13 +78,13 @@ rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
% docstring = "Encoding for TrueType or Type 1 fonts
% to be used with TeX."
% @}
-%
+%
% Idea is to have all the characters normally included in Type 1 fonts
% available for typesetting. This is effectively the characters in Adobe
% Standard Encoding + ISO Latin 1 + extra characters from Lucida.
-%
+%
% Character code assignments were made as follows:
-%
+%
% (1) the Windows ANSI characters are almost all in their Windows ANSI
% positions, because some Windows users cannot easily reencode the
% fonts, and it makes no difference on other systems. The only Windows
@@ -92,39 +92,39 @@ rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
% typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen
% (173). quotesingle and grave are moved just because it's such an
% irritation not having them in TeX positions.
-%
+%
% (2) Remaining characters are assigned arbitrarily to the lower part
% of the range, avoiding 0, 10 and 13 in case we meet dumb software.
-%
+%
% (3) Y&Y Lucida Bright includes some extra text characters; in the
% hopes that other PostScript fonts, perhaps created for public
% consumption, will include them, they are included starting at 0x12.
-%
+%
% (4) Remaining positions left undefined are for use in (hopefully)
% upward-compatible revisions, if someday more characters are generally
% available.
-%
-% (5) hyphen appears twice for compatibility with both
+%
+% (5) hyphen appears twice for compatibility with both
% ASCII and Windows.
-%
+%
/TeXBase1Encoding [
% 0x00 (encoded characters from Adobe Standard not in Windows 3.1)
/.notdef /dotaccent /fi /fl
/fraction /hungarumlaut /Lslash /lslash
/ogonek /ring /.notdef
- /breve /minus /.notdef
+ /breve /minus /.notdef
% These are the only two remaining unencoded characters, so may as
% well include them.
- /Zcaron /zcaron
+ /Zcaron /zcaron
% 0x10
- /caron /dotlessi
+ /caron /dotlessi
% (unusual TeX characters available in, e.g., Lucida Bright)
- /dotlessj /ff /ffi /ffl
+ /dotlessj /ff /ffi /ffl
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
% very contentious; it's so painful not having quoteleft and quoteright
% at 96 and 145 that we move the things normally found there to here.
- /grave /quotesingle
+ /grave /quotesingle
% 0x20 (ASCII begins)
/space /exclam /quotedbl /numbersign
/dollar /percent /ampersand /quoteright
@@ -611,17 +611,17 @@ newpath 0 257 moveto 0 0 lineto 912 0 lineto 912 257 lineto closepath clip newpa
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
4 -2 roll mul srgb} bind def
/DrawEllipse {
- /endangle exch def
- /startangle exch def
- /yrad exch def
- /xrad exch def
- /y exch def
- /x exch def
- /savematrix mtrx currentmatrix def
- x y tr xrad yrad sc 0 0 1 startangle endangle arc
- closepath
- savematrix setmatrix
- } def
+ /endangle exch def
+ /startangle exch def
+ /yrad exch def
+ /xrad exch def
+ /y exch def
+ /x exch def
+ /savematrix mtrx currentmatrix def
+ x y tr xrad yrad sc 0 0 1 startangle endangle arc
+ closepath
+ savematrix setmatrix
+ } def
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
/$F2psEnd {$F2psEnteredState restore end} def
diff --git a/gs/imdi/arch.h b/gs/imdi/arch.h
index 654fcfab6..37cec0cbb 100644
--- a/gs/imdi/arch.h
+++ b/gs/imdi/arch.h
@@ -23,35 +23,33 @@
#endif /* ALLOW64 */
-
-
/* Machine/Language architectural specifications */
typedef struct {
- int bits; /* Bits in this data type */
- char *name; /* Name used to specify this type */
- int align; /* Non-zero if this type should be accessed aligned */
+ int bits; /* Bits in this data type */
+ char *name; /* Name used to specify this type */
+ int align; /* Non-zero if this type should be accessed aligned */
} dtypes;
#define MXDTYPES 6
typedef struct {
- int bigend; /* Non-zero if this is a bigendian architecture */
- int uwa; /* Use wide memory access */
+ int bigend; /* Non-zero if this is a bigendian architecture */
+ int uwa; /* Use wide memory access */
- int pbits; /* Number of bits in a pointer */
+ int pbits; /* Number of bits in a pointer */
- int nords; /* Number of ord types */
- dtypes ords[MXDTYPES]; /* Ordinal types, in size order */
- int natord; /* Index of natural machine ordinal */
+ int nords; /* Number of ord types */
+ dtypes ords[MXDTYPES]; /* Ordinal types, in size order */
+ int natord; /* Index of natural machine ordinal */
- int nints; /* Number of int types */
- dtypes ints[MXDTYPES]; /* Integer types, in size order */
- int natint; /* Index of natural machine integer */
+ int nints; /* Number of int types */
+ dtypes ints[MXDTYPES]; /* Integer types, in size order */
+ int natint; /* Index of natural machine integer */
- /* Optimisation settings */
- int shfm; /* Non-zero to use shifts for masking */
- int oscale; /* Maximum power of 2 scaled indexing mode, 0 for none. */
- int smmul; /* Has fast small multiply for index scaling */
+ /* Optimisation settings */
+ int shfm; /* Non-zero to use shifts for masking */
+ int oscale; /* Maximum power of 2 scaled indexing mode, 0 for none. */
+ int smmul; /* Has fast small multiply for index scaling */
} mach_arch;
diff --git a/gs/imdi/cctiff.c b/gs/imdi/cctiff.c
index ee940de39..22a772158 100644
--- a/gs/imdi/cctiff.c
+++ b/gs/imdi/cctiff.c
@@ -1,5 +1,4 @@
-
-/*
+/*
* Color Correct a TIFF file, using an ICC Device link profile.
*
* Author: Graeme W. Gill
@@ -21,8 +20,8 @@
*/
/*
- This program is a framework that exercises the
- IMDI code, as well as a demonstration of simple
+ This program is a framework that exercises the
+ IMDI code, as well as a demonstration of simple
profile linking. It can also do the conversion using the
floating point code in ICCLIB as a reference.
@@ -45,20 +44,20 @@
void error(char *fmt, ...), warning(char *fmt, ...);
void usage(void) {
- fprintf(stderr,"Color Correct a TIFF file using an ICC device link profile, V%s\n",ARGYLL_VERSION_STR);
- fprintf(stderr,"Author: Graeme W. Gill, licensed under the GPL\n");
- fprintf(stderr,"usage: cctiff [-options] devlinkprofile.icm infile.tif outfile.tif\n");
- fprintf(stderr,"usage: cctiff [-options] -l inprofile.icm outprofile.icm infile.tif outfile.tif\n");
- fprintf(stderr," -v Verbose\n");
- fprintf(stderr," -c Combine linearisation curves into one transform\n");
- fprintf(stderr," -p Use slow precise correction\n");
- fprintf(stderr," -k Check fast result against precise, and report\n");
- fprintf(stderr," -l Link input and output profiles\n");
- fprintf(stderr," -i in_intent p = perceptual, r = relative colorimetric,\n");
- fprintf(stderr," s = saturation, a = absolute colorimetric\n");
- fprintf(stderr," -o out_intent p = perceptual, r = relative colorimetric,\n");
- fprintf(stderr," s = saturation, a = absolute colorimetric\n");
- exit(1);
+ fprintf(stderr,"Color Correct a TIFF file using an ICC device link profile, V%s\n",ARGYLL_VERSION_STR);
+ fprintf(stderr,"Author: Graeme W. Gill, licensed under the GPL\n");
+ fprintf(stderr,"usage: cctiff [-options] devlinkprofile.icm infile.tif outfile.tif\n");
+ fprintf(stderr,"usage: cctiff [-options] -l inprofile.icm outprofile.icm infile.tif outfile.tif\n");
+ fprintf(stderr," -v Verbose\n");
+ fprintf(stderr," -c Combine linearisation curves into one transform\n");
+ fprintf(stderr," -p Use slow precise correction\n");
+ fprintf(stderr," -k Check fast result against precise, and report\n");
+ fprintf(stderr," -l Link input and output profiles\n");
+ fprintf(stderr," -i in_intent p = perceptual, r = relative colorimetric,\n");
+ fprintf(stderr," s = saturation, a = absolute colorimetric\n");
+ fprintf(stderr," -o out_intent p = perceptual, r = relative colorimetric,\n");
+ fprintf(stderr," s = saturation, a = absolute colorimetric\n");
+ exit(1);
}
/* Convert an ICC colorspace to the corresponding possible TIFF Photometric tags. */
@@ -68,130 +67,129 @@ ColorSpaceSignature2TiffPhotometric(
uint16 tags[10], /* Pointer to return array, up to 10 */
icColorSpaceSignature cspace /* Input ICC colorspace */
) {
- switch(cspace) {
- case icSigGrayData:
- tags[0] = PHOTOMETRIC_MINISBLACK;
- return 1;
- case icSigRgbData:
+ switch(cspace) {
+ case icSigGrayData:
+ tags[0] = PHOTOMETRIC_MINISBLACK;
+ return 1;
+ case icSigRgbData:
#ifdef TREAT_CMY_AS_RGB
- case icSigCmyData:
+ case icSigCmyData:
#endif
- tags[0] = PHOTOMETRIC_RGB;
- return 1;
+ tags[0] = PHOTOMETRIC_RGB;
+ return 1;
#ifndef TREAT_CMY_AS_RGB
- case icSigCmyData:
+ case icSigCmyData:
#endif
- case icSigCmykData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- return 1;
- case icSigYCbCrData:
- tags[0] = PHOTOMETRIC_YCBCR;
- return 1;
- case icSigLabData:
- tags[0] = PHOTOMETRIC_CIELAB;
+ case icSigCmykData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ return 1;
+ case icSigYCbCrData:
+ tags[0] = PHOTOMETRIC_YCBCR;
+ return 1;
+ case icSigLabData:
+ tags[0] = PHOTOMETRIC_CIELAB;
#ifdef PHOTOMETRIC_ICCLAB
- tags[1] = PHOTOMETRIC_ICCLAB;
- tags[2] = PHOTOMETRIC_ITULAB;
+ tags[1] = PHOTOMETRIC_ICCLAB;
+ tags[2] = PHOTOMETRIC_ITULAB;
#endif
- return 3;
-
- case icSigXYZData:
- case icSigLuvData:
- case icSigYxyData:
- case icSigHsvData:
- case icSigHlsData:
- return 0;
-
- case icSig2colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 2; /* Cheat */
- return 1;
-
- case icSig3colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 3; /* Cheat */
- return 1;
-
- case icSig4colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 4; /* Cheat */
- return 1;
-
- case icSig5colorData:
- case icSigMch5Data:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 5; /* Cheat */
- return 1;
-
- case icSig6colorData:
- case icSigMch6Data:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 6; /* Cheat */
- return 1;
-
- case icSig7colorData:
- case icSigMch7Data:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 7; /* Cheat */
- return 1;
-
- case icSig8colorData:
- case icSigMch8Data:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 8; /* Cheat */
- return 1;
-
- case icSig9colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 9; /* Cheat */
- return 1;
-
- case icSig10colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 10; /* Cheat */
- return 1;
-
- case icSig11colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 11; /* Cheat */
- return 1;
-
- case icSig12colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 12; /* Cheat */
- return 1;
-
- case icSig13colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 13; /* Cheat */
- return 1;
-
- case icSig14colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 14; /* Cheat */
- return 1;
-
- case icSig15colorData:
- tags[0] = PHOTOMETRIC_SEPARATED;
- tags[1] = 15; /* Cheat */
- return 1;
-
- default:
- return 0;
- }
- return 0;
+ return 3;
+
+ case icSigXYZData:
+ case icSigLuvData:
+ case icSigYxyData:
+ case icSigHsvData:
+ case icSigHlsData:
+ return 0;
+
+ case icSig2colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 2; /* Cheat */
+ return 1;
+
+ case icSig3colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 3; /* Cheat */
+ return 1;
+
+ case icSig4colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 4; /* Cheat */
+ return 1;
+
+ case icSig5colorData:
+ case icSigMch5Data:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 5; /* Cheat */
+ return 1;
+
+ case icSig6colorData:
+ case icSigMch6Data:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 6; /* Cheat */
+ return 1;
+
+ case icSig7colorData:
+ case icSigMch7Data:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 7; /* Cheat */
+ return 1;
+
+ case icSig8colorData:
+ case icSigMch8Data:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 8; /* Cheat */
+ return 1;
+
+ case icSig9colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 9; /* Cheat */
+ return 1;
+
+ case icSig10colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 10; /* Cheat */
+ return 1;
+
+ case icSig11colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 11; /* Cheat */
+ return 1;
+
+ case icSig12colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 12; /* Cheat */
+ return 1;
+
+ case icSig13colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 13; /* Cheat */
+ return 1;
+
+ case icSig14colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 14; /* Cheat */
+ return 1;
+
+ case icSig15colorData:
+ tags[0] = PHOTOMETRIC_SEPARATED;
+ tags[1] = 15; /* Cheat */
+ return 1;
+
+ default:
+ return 0;
+ }
+ return 0;
}
-
/* Compute the length of a double nul terminated string, including */
/* the nuls. */
static int zzstrlen(char *s) {
- int i;
- for (i = 0;; i++) {
- if (s[i] == '\000' && s[i+1] == '\000')
- return i+2;
- }
- return 0;
+ int i;
+ for (i = 0;; i++) {
+ if (s[i] == '\000' && s[i+1] == '\000')
+ return i+2;
+ }
+ return 0;
}
/* Convert an ICC colorspace to the corresponding TIFF Inkset tag */
@@ -203,196 +201,196 @@ icColorSpaceSignature cspace,
int *len, /* Return length of ASCII inknames */
char **inknames /* Return ASCII inknames if non NULL */
) {
- switch(cspace) {
- case icSigCmyData:
- return 0xffff; /* ~~9999 */
- if (inknames != NULL) {
- *inknames = "cyan\000magenta\000yellow\000\000";
- *len = zzstrlen(*inknames);
- }
- return 0; /* Not CMYK */
- case icSigCmykData:
- if (inknames != NULL) {
- *inknames = NULL; /* No inknames */
- *len = 0;
- }
- return INKSET_CMYK;
-
- case icSigGrayData:
- case icSigRgbData:
- case icSigYCbCrData:
- case icSigLabData:
- case icSigXYZData:
- case icSigLuvData:
- case icSigYxyData:
- case icSigHsvData:
- case icSigHlsData:
- case icSig2colorData:
- case icSig3colorData:
- case icSig4colorData:
- case icSig5colorData:
- case icSigMch5Data:
- return 0xffff;
-
- case icSig6colorData:
- case icSigMch6Data:
- /* This is a cheat and a hack. Should really make sure that icclink */
- /* transfers the right information from the destination */
- /* profile, and then copies it to the device profile, */
- /* allowing cctiff to read it. */
- if (inknames != NULL) {
- *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000\000";
- *len = zzstrlen(*inknames);
- }
- return 0; /* Not CMYK */
-
- case icSig7colorData:
- case icSigMch7Data:
- return 0xffff;
-
- case icSig8colorData:
- case icSigMch8Data:
- /* This is a cheat and a hack. Should really make sure that icclink */
- /* transfers the right information from the destination */
- /* profile, and then copies it to the device profile, */
- /* allowing cctiff to read it. */
- if (inknames != NULL) {
- *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000lightcyan\000lightmagenta\000\000";
- *len = zzstrlen(*inknames);
- }
- return 0; /* Not CMYK */
- case icSig9colorData:
- case icSig10colorData:
- case icSig11colorData:
- case icSig12colorData:
- case icSig13colorData:
- case icSig14colorData:
- case icSig15colorData:
- default:
- return 0xffff;
- }
- return 0xffff;
+ switch(cspace) {
+ case icSigCmyData:
+ return 0xffff; /* ~~9999 */
+ if (inknames != NULL) {
+ *inknames = "cyan\000magenta\000yellow\000\000";
+ *len = zzstrlen(*inknames);
+ }
+ return 0; /* Not CMYK */
+ case icSigCmykData:
+ if (inknames != NULL) {
+ *inknames = NULL; /* No inknames */
+ *len = 0;
+ }
+ return INKSET_CMYK;
+
+ case icSigGrayData:
+ case icSigRgbData:
+ case icSigYCbCrData:
+ case icSigLabData:
+ case icSigXYZData:
+ case icSigLuvData:
+ case icSigYxyData:
+ case icSigHsvData:
+ case icSigHlsData:
+ case icSig2colorData:
+ case icSig3colorData:
+ case icSig4colorData:
+ case icSig5colorData:
+ case icSigMch5Data:
+ return 0xffff;
+
+ case icSig6colorData:
+ case icSigMch6Data:
+ /* This is a cheat and a hack. Should really make sure that icclink */
+ /* transfers the right information from the destination */
+ /* profile, and then copies it to the device profile, */
+ /* allowing cctiff to read it. */
+ if (inknames != NULL) {
+ *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000\000";
+ *len = zzstrlen(*inknames);
+ }
+ return 0; /* Not CMYK */
+
+ case icSig7colorData:
+ case icSigMch7Data:
+ return 0xffff;
+
+ case icSig8colorData:
+ case icSigMch8Data:
+ /* This is a cheat and a hack. Should really make sure that icclink */
+ /* transfers the right information from the destination */
+ /* profile, and then copies it to the device profile, */
+ /* allowing cctiff to read it. */
+ if (inknames != NULL) {
+ *inknames = "cyan\000magenta\000yellow\000black\000orange\000green\000lightcyan\000lightmagenta\000\000";
+ *len = zzstrlen(*inknames);
+ }
+ return 0; /* Not CMYK */
+ case icSig9colorData:
+ case icSig10colorData:
+ case icSig11colorData:
+ case icSig12colorData:
+ case icSig13colorData:
+ case icSig14colorData:
+ case icSig15colorData:
+ default:
+ return 0xffff;
+ }
+ return 0xffff;
}
char *
Photometric2str(
int pmtc
) {
- static char buf[80];
- switch (pmtc) {
- case PHOTOMETRIC_MINISWHITE:
- return "Subtractive Gray";
- case PHOTOMETRIC_MINISBLACK:
- return "Additive Gray";
- case PHOTOMETRIC_RGB:
- return "RGB";
- case PHOTOMETRIC_PALETTE:
- return "Indexed";
- case PHOTOMETRIC_MASK:
- return "Transparency Mask";
- case PHOTOMETRIC_SEPARATED:
- return "Separated";
- case PHOTOMETRIC_YCBCR:
- return "YCbCr";
- case PHOTOMETRIC_CIELAB:
- return "CIELab";
+ static char buf[80];
+ switch (pmtc) {
+ case PHOTOMETRIC_MINISWHITE:
+ return "Subtractive Gray";
+ case PHOTOMETRIC_MINISBLACK:
+ return "Additive Gray";
+ case PHOTOMETRIC_RGB:
+ return "RGB";
+ case PHOTOMETRIC_PALETTE:
+ return "Indexed";
+ case PHOTOMETRIC_MASK:
+ return "Transparency Mask";
+ case PHOTOMETRIC_SEPARATED:
+ return "Separated";
+ case PHOTOMETRIC_YCBCR:
+ return "YCbCr";
+ case PHOTOMETRIC_CIELAB:
+ return "CIELab";
#ifdef PHOTOMETRIC_ICCLAB
- case PHOTOMETRIC_ICCLAB:
- return "ICCLab";
- case PHOTOMETRIC_ITULAB:
- return "ITULab";
+ case PHOTOMETRIC_ICCLAB:
+ return "ICCLab";
+ case PHOTOMETRIC_ITULAB:
+ return "ITULab";
#endif
- case PHOTOMETRIC_LOGL:
- return "CIELog2L";
- case PHOTOMETRIC_LOGLUV:
- return "CIELog2Luv";
- }
- sprintf(buf,"Unknonw Tag %d",pmtc);
- return buf;
+ case PHOTOMETRIC_LOGL:
+ return "CIELog2L";
+ case PHOTOMETRIC_LOGLUV:
+ return "CIELog2Luv";
+ }
+ sprintf(buf,"Unknonw Tag %d",pmtc);
+ return buf;
}
/* Callbacks used to initialise imdi */
/* Information needed from a profile */
struct _profinfo {
- char name[100];
- icmFile *fp;
- icc *c;
- icmHeader *h;
- icRenderingIntent intent;
- icmLuBase *luo; /* Base Lookup type object */
- icmLuAlgType alg; /* Type of lookup algorithm */
- int chan; /* Device channels */
+ char name[100];
+ icmFile *fp;
+ icc *c;
+ icmHeader *h;
+ icRenderingIntent intent;
+ icmLuBase *luo; /* Base Lookup type object */
+ icmLuAlgType alg; /* Type of lookup algorithm */
+ int chan; /* Device channels */
}; typedef struct _profinfo profinfo;
/* Context for imdi setup callbacks */
typedef struct {
- /* Overall parameters */
- int verb; /* Non-zero if verbose */
- icColorSpaceSignature ins, outs; /* Input/Output spaces */
- int id, od; /* Input/Output dimensions */
- int icombine; /* Non-zero if input curves are to be combined */
- int ocombine; /* Non-zero if output curves are to be combined */
- int link; /* Non-zero if input and output profiles are to be linked */
-
- profinfo dev; /* Device link profile */
- profinfo in; /* Device to PCS profile */
- profinfo out; /* PCS to Device profile */
+ /* Overall parameters */
+ int verb; /* Non-zero if verbose */
+ icColorSpaceSignature ins, outs; /* Input/Output spaces */
+ int id, od; /* Input/Output dimensions */
+ int icombine; /* Non-zero if input curves are to be combined */
+ int ocombine; /* Non-zero if output curves are to be combined */
+ int link; /* Non-zero if input and output profiles are to be linked */
+
+ profinfo dev; /* Device link profile */
+ profinfo in; /* Device to PCS profile */
+ profinfo out; /* PCS to Device profile */
} sucntx;
/* Input curve function */
double input_curve(
- void *cntx,
- int ch,
- double in_val
+ void *cntx,
+ int ch,
+ double in_val
) {
- sucntx *rx = (sucntx *)cntx;
- int i;
- double vals[MAX_CHAN];
-
- if (rx->icombine)
- return in_val;
-
- if (rx->link) {
-
- for (i = 0; i < rx->id; i++)
- vals[i] = 0.0;
- vals[ch] = in_val;
-
- switch(rx->in.alg) {
- case icmMonoFwdType: {
- icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */
- lu->fwd_curve(lu, vals, vals);
- break;
- }
- case icmMatrixFwdType: {
- icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */
- lu->fwd_curve(lu, vals, vals);
- break;
- }
- case icmLutType: {
- icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */
- /* Since not PCS, in_abs and matrix cannot be valid, */
- /* so input curve on own is ok to use. */
- lu->input(lu, vals, vals);
- break;
- }
- default:
- error("Unexpected algorithm type in input curve");
- }
- } else {
- icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
-
- for (i = 0; i < rx->id; i++)
- vals[i] = 0.0;
- vals[ch] = in_val;
-
- /* Since input not PCS, in_abs and matrix cannot be valid, */
- /* so input curve on own is ok to use. */
- lu->input(lu, vals, vals);
-
- }
- return vals[ch];
+ sucntx *rx = (sucntx *)cntx;
+ int i;
+ double vals[MAX_CHAN];
+
+ if (rx->icombine)
+ return in_val;
+
+ if (rx->link) {
+
+ for (i = 0; i < rx->id; i++)
+ vals[i] = 0.0;
+ vals[ch] = in_val;
+
+ switch(rx->in.alg) {
+ case icmMonoFwdType: {
+ icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */
+ lu->fwd_curve(lu, vals, vals);
+ break;
+ }
+ case icmMatrixFwdType: {
+ icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */
+ lu->fwd_curve(lu, vals, vals);
+ break;
+ }
+ case icmLutType: {
+ icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */
+ /* Since not PCS, in_abs and matrix cannot be valid, */
+ /* so input curve on own is ok to use. */
+ lu->input(lu, vals, vals);
+ break;
+ }
+ default:
+ error("Unexpected algorithm type in input curve");
+ }
+ } else {
+ icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
+
+ for (i = 0; i < rx->id; i++)
+ vals[i] = 0.0;
+ vals[ch] = in_val;
+
+ /* Since input not PCS, in_abs and matrix cannot be valid, */
+ /* so input curve on own is ok to use. */
+ lu->input(lu, vals, vals);
+
+ }
+ return vals[ch];
}
/* Multi-dim table function */
@@ -401,98 +399,98 @@ void *cntx,
double *out_vals,
double *in_vals
) {
- sucntx *rx = (sucntx *)cntx;
- double pcsv[3];
- int i;
-
- if (rx->link) {
- double vals[MAX_CHAN];
-
- switch(rx->in.alg) {
- case icmMonoFwdType: {
- icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */
- if (rx->icombine) {
- lu->fwd_curve(lu, vals, in_vals);
- lu->fwd_map(lu, pcsv, vals);
- } else {
- lu->fwd_map(lu, pcsv, in_vals);
- }
- lu->fwd_abs(lu, pcsv, pcsv);
- break;
- }
- case icmMatrixFwdType: {
- icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */
- if (rx->icombine) {
- lu->fwd_curve(lu, vals, in_vals);
- lu->fwd_matrix(lu, pcsv, vals);
- } else {
- lu->fwd_matrix(lu, pcsv, in_vals);
- }
- lu->fwd_abs(lu, pcsv, pcsv);
- break;
- }
- case icmLutType: {
- icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */
- if (rx->icombine) {
- /* Since not PCS, in_abs and matrix cannot be valid, */
- /* so input curve on own is ok to use. */
- lu->input(lu, vals, in_vals);
- lu->clut(lu, pcsv, vals);
- } else {
- lu->clut(lu, pcsv, in_vals);
- }
- lu->output(lu, pcsv, pcsv);
- lu->out_abs(lu, pcsv, pcsv);
- break;
- }
- default:
- error("Unexpected algorithm type in clut lookup");
- }
-
- switch(rx->out.alg) {
- case icmMonoBwdType: {
- icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */
- lu->bwd_abs(lu, pcsv, pcsv);
- lu->bwd_map(lu, out_vals, pcsv);
- if (rx->ocombine) {
- lu->bwd_curve(lu, out_vals, out_vals);
- }
- break;
- }
- case icmMatrixBwdType: {
- icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */
- lu->bwd_abs(lu, pcsv, pcsv);
- lu->bwd_matrix(lu, out_vals, pcsv);
- if (rx->ocombine) {
- lu->bwd_curve(lu, out_vals, out_vals);
- }
- break;
- }
- case icmLutType: {
- icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */
- lu->in_abs(lu, pcsv, pcsv);
- lu->matrix(lu, pcsv, pcsv);
- lu->input(lu, pcsv, pcsv);
- lu->clut(lu, out_vals, pcsv);
- if (rx->ocombine) {
- lu->output(lu, out_vals, out_vals);
- /* Since not PCS, out_abs is never used */
- }
- break;
- }
-
- default:
- error("Unexpected algorithm type in clut lookup");
- }
- } else {
- icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
-
- if (rx->icombine && rx->ocombine) {
- lu->lookup((icmLuBase *)lu, out_vals, in_vals); /* Do everything here */
- } else {
- lu->clut(lu, out_vals, in_vals);
- }
- }
+ sucntx *rx = (sucntx *)cntx;
+ double pcsv[3];
+ int i;
+
+ if (rx->link) {
+ double vals[MAX_CHAN];
+
+ switch(rx->in.alg) {
+ case icmMonoFwdType: {
+ icmLuMono *lu = (icmLuMono *)rx->in.luo; /* Safe to coerce */
+ if (rx->icombine) {
+ lu->fwd_curve(lu, vals, in_vals);
+ lu->fwd_map(lu, pcsv, vals);
+ } else {
+ lu->fwd_map(lu, pcsv, in_vals);
+ }
+ lu->fwd_abs(lu, pcsv, pcsv);
+ break;
+ }
+ case icmMatrixFwdType: {
+ icmLuMatrix *lu = (icmLuMatrix *)rx->in.luo; /* Safe to coerce */
+ if (rx->icombine) {
+ lu->fwd_curve(lu, vals, in_vals);
+ lu->fwd_matrix(lu, pcsv, vals);
+ } else {
+ lu->fwd_matrix(lu, pcsv, in_vals);
+ }
+ lu->fwd_abs(lu, pcsv, pcsv);
+ break;
+ }
+ case icmLutType: {
+ icmLuLut *lu = (icmLuLut *)rx->in.luo; /* Safe to coerce */
+ if (rx->icombine) {
+ /* Since not PCS, in_abs and matrix cannot be valid, */
+ /* so input curve on own is ok to use. */
+ lu->input(lu, vals, in_vals);
+ lu->clut(lu, pcsv, vals);
+ } else {
+ lu->clut(lu, pcsv, in_vals);
+ }
+ lu->output(lu, pcsv, pcsv);
+ lu->out_abs(lu, pcsv, pcsv);
+ break;
+ }
+ default:
+ error("Unexpected algorithm type in clut lookup");
+ }
+
+ switch(rx->out.alg) {
+ case icmMonoBwdType: {
+ icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */
+ lu->bwd_abs(lu, pcsv, pcsv);
+ lu->bwd_map(lu, out_vals, pcsv);
+ if (rx->ocombine) {
+ lu->bwd_curve(lu, out_vals, out_vals);
+ }
+ break;
+ }
+ case icmMatrixBwdType: {
+ icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */
+ lu->bwd_abs(lu, pcsv, pcsv);
+ lu->bwd_matrix(lu, out_vals, pcsv);
+ if (rx->ocombine) {
+ lu->bwd_curve(lu, out_vals, out_vals);
+ }
+ break;
+ }
+ case icmLutType: {
+ icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */
+ lu->in_abs(lu, pcsv, pcsv);
+ lu->matrix(lu, pcsv, pcsv);
+ lu->input(lu, pcsv, pcsv);
+ lu->clut(lu, out_vals, pcsv);
+ if (rx->ocombine) {
+ lu->output(lu, out_vals, out_vals);
+ /* Since not PCS, out_abs is never used */
+ }
+ break;
+ }
+
+ default:
+ error("Unexpected algorithm type in clut lookup");
+ }
+ } else {
+ icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
+
+ if (rx->icombine && rx->ocombine) {
+ lu->lookup((icmLuBase *)lu, out_vals, in_vals); /* Do everything here */
+ } else {
+ lu->clut(lu, out_vals, in_vals);
+ }
+ }
}
/* Output curve function */
@@ -501,690 +499,688 @@ void *cntx,
int ch,
double in_val
) {
- sucntx *rx = (sucntx *)cntx;
- int i;
- double vals[MAX_CHAN];
-
- if (rx->ocombine)
- return in_val;
-
- if (rx->link) {
- for (i = 0; i < rx->od; i++)
- vals[i] = 0.0;
- vals[ch] = in_val;
-
- switch(rx->out.alg) {
- case icmMonoBwdType: {
- icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */
- lu->bwd_curve(lu, vals, vals);
- break;
- }
- case icmMatrixBwdType: {
- icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */
- lu->bwd_curve(lu, vals, vals);
- break;
- }
- case icmLutType: {
- icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */
- lu->output(lu, vals, vals);
- /* Since not PCS, out_abs is never used */
- break;
- }
- default:
- error("Unexpected algorithm type in devop_devo()");
- }
-
- } else {
- icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
-
- for (i = 0; i < rx->od; i++)
- vals[i] = 0.0;
- vals[ch] = in_val;
-
- /* Since output not PCS, out_abs cannot be valid, */
- lu->output(lu, vals, vals);
-
- }
- return vals[ch];
+ sucntx *rx = (sucntx *)cntx;
+ int i;
+ double vals[MAX_CHAN];
+
+ if (rx->ocombine)
+ return in_val;
+
+ if (rx->link) {
+ for (i = 0; i < rx->od; i++)
+ vals[i] = 0.0;
+ vals[ch] = in_val;
+
+ switch(rx->out.alg) {
+ case icmMonoBwdType: {
+ icmLuMono *lu = (icmLuMono *)rx->out.luo; /* Safe to coerce */
+ lu->bwd_curve(lu, vals, vals);
+ break;
+ }
+ case icmMatrixBwdType: {
+ icmLuMatrix *lu = (icmLuMatrix *)rx->out.luo; /* Safe to coerce */
+ lu->bwd_curve(lu, vals, vals);
+ break;
+ }
+ case icmLutType: {
+ icmLuLut *lu = (icmLuLut *)rx->out.luo; /* Safe to coerce */
+ lu->output(lu, vals, vals);
+ /* Since not PCS, out_abs is never used */
+ break;
+ }
+ default:
+ error("Unexpected algorithm type in devop_devo()");
+ }
+
+ } else {
+ icmLuLut *lu = (icmLuLut *)rx->dev.luo; /* Safe to coerce */
+
+ for (i = 0; i < rx->od; i++)
+ vals[i] = 0.0;
+ vals[ch] = in_val;
+
+ /* Since output not PCS, out_abs cannot be valid, */
+ lu->output(lu, vals, vals);
+
+ }
+ return vals[ch];
}
-
int
main(int argc, char *argv[]) {
- int fa,nfa; /* argument we're looking at */
- char in_name[100]; /* Raster file name */
- char out_name[100]; /* Raster file name */
- int slow = 0;
- int check = 0;
- int i, rv = 0;
-
- TIFF *rh = NULL, *wh = NULL;
- int x, y, width, height; /* Size of image */
- uint16 samplesperpixel, bitspersample;
- int no_pmtc; /* Number of input photometrics */
- uint16 photometric, pmtc[10]; /* Photometrics of input file, and input profile */
- uint16 pconfig; /* Planar configuration */
- uint16 resunits;
- float resx, resy;
- tdata_t *inbuf, *outbuf, *checkbuf;
-
- /* IMDI */
- imdi *s = NULL;
- sucntx su; /* Setup context */
- unsigned char *inp[MAX_CHAN];
- unsigned char *outp[MAX_CHAN];
- int clutres = 33;
-
- /* Error check */
- int mxerr = 0;
- double avgerr = 0.0;
- double avgcount = 0.0;
-
- if (argc < 2)
- usage();
-
- su.verb = 0;
- su.icombine = 0;
- su.ocombine = 0;
- su.link = 0;
- su.in.intent = icmDefaultIntent;
- su.out.intent = icmDefaultIntent;
-
- /* Process the arguments */
- for(fa = 1;fa < argc;fa++) {
- nfa = fa; /* skip to nfa if next argument is used */
- if (argv[fa][0] == '-') { /* Look for any flags */
- char *na = NULL; /* next argument after flag, null if none */
-
- if (argv[fa][2] != '\000')
- na = &argv[fa][2]; /* next is directly after flag */
- else {
- if ((fa+1) < argc) {
- if (argv[fa+1][0] != '-') {
- nfa = fa + 1;
- na = argv[nfa]; /* next is seperate non-flag argument */
- }
- }
- }
-
- if (argv[fa][1] == '?')
- usage();
-
- /* Slow, Precise */
- else if (argv[fa][1] == 'p' || argv[fa][1] == 'P') {
- slow = 1;
- }
-
- /* Combine per channel curves */
- else if (argv[fa][1] == 'c' || argv[fa][1] == 'C') {
- su.icombine = 1;
- su.ocombine = 1;
- }
-
- /* Check curves */
- else if (argv[fa][1] == 'k' || argv[fa][1] == 'K') {
- check = 1;
- }
-
- /* Link profiles */
- else if (argv[fa][1] == 'l' || argv[fa][1] == 'L') {
- su.link = 1;
- }
-
- /* Input profile Intent */
- else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') {
- fa = nfa;
- if (na == NULL) usage();
- switch (na[0]) {
- case 'p':
- case 'P':
- su.in.intent = icPerceptual;
- break;
- case 'r':
- case 'R':
- su.in.intent = icRelativeColorimetric;
- break;
- case 's':
- case 'S':
- su.in.intent = icSaturation;
- break;
- case 'a':
- case 'A':
- su.in.intent = icAbsoluteColorimetric;
- break;
- default:
- usage();
- }
- }
-
- /* Output profile Intent */
- else if (argv[fa][1] == 'o' || argv[fa][1] == 'O') {
- fa = nfa;
- if (na == NULL) usage();
- switch (na[0]) {
- case 'p':
- case 'P':
- su.out.intent = icPerceptual;
- break;
- case 'r':
- case 'R':
- su.out.intent = icRelativeColorimetric;
- break;
- case 's':
- case 'S':
- su.out.intent = icSaturation;
- break;
- case 'a':
- case 'A':
- su.out.intent = icAbsoluteColorimetric;
- break;
- default:
- usage();
- }
- }
-
- /* Verbosity */
- else if (argv[fa][1] == 'v' || argv[fa][1] == 'V') {
- su.verb = 1;
- }
-
- else
- usage();
- } else
- break;
- }
-
- if (su.link) {
- if (fa >= argc || argv[fa][0] == '-') usage();
- strcpy(su.in.name,argv[fa++]);
-
- if (fa >= argc || argv[fa][0] == '-') usage();
- strcpy(su.out.name,argv[fa++]);
- } else {
- if (fa >= argc || argv[fa][0] == '-') usage();
- strcpy(su.dev.name,argv[fa++]);
- }
-
- if (fa >= argc || argv[fa][0] == '-') usage();
- strcpy(in_name,argv[fa++]);
-
- if (fa >= argc || argv[fa][0] == '-') usage();
- strcpy(out_name,argv[fa++]);
-
- /* - - - - - - - - - - - - - - - - */
-
- if (su.link) {
- icColorSpaceSignature natpcs;
-
- /* Open up the input device profile for reading */
- if ((su.in.fp = new_icmFileStd_name(su.in.name,"r")) == NULL)
- error ("Can't open file '%s'",su.in.name);
-
- if ((su.in.c = new_icc()) == NULL)
- error ("Creation of Input profile ICC object failed");
-
- /* Read header etc. */
- if ((rv = su.in.c->read(su.in.c,su.in.fp,0)) != 0)
- error ("%d, %s on file '%s'",rv,su.in.c->err,su.in.name);
- su.in.h = su.in.c->header;
-
- /* Check that it is a suitable device input icc */
- if (su.in.h->deviceClass != icSigInputClass
- && su.in.h->deviceClass != icSigDisplayClass
- && su.in.h->deviceClass != icSigOutputClass
- && su.in.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */
- error("Input profile isn't a device profile");
-
- /* Get a conversion object */
- if ((su.in.luo = su.in.c->get_luobj(su.in.c, icmFwd, su.in.intent,
- icSigLabData, icmLuOrdNorm)) == NULL)
- error ("%d, %s for profile '%s'",su.in.c->errc, su.in.c->err, su.in.name);
-
- /* Get details of conversion (Arguments may be NULL if info not needed) */
- su.in.luo->spaces(su.in.luo, &su.ins, &su.id, NULL, NULL, &su.in.alg, NULL, NULL, NULL);
-
- /* Get native PCS space */
- su.in.luo->lutspaces(su.in.luo, NULL, NULL, NULL, NULL, &natpcs);
-
- if (natpcs == icSigXYZData) {
- su.icombine = 1; /* XYZ is to non-linear to be a benefit */
- }
-
- /* Open up the output device profile for reading */
- if ((su.out.fp = new_icmFileStd_name(su.out.name,"r")) == NULL)
- error ("Can't open file '%s'",su.out.name);
-
- if ((su.out.c = new_icc()) == NULL)
- error ("Creation of Output profile ICC object failed");
-
- /* Read header etc. */
- if ((rv = su.out.c->read(su.out.c,su.out.fp,0)) != 0)
- error ("%d, %s on file '%s'",rv,su.out.c->err,su.out.name);
- su.out.h = su.out.c->header;
-
- /* Check that it is a suitable device output icc */
- if (su.out.h->deviceClass != icSigInputClass
- && su.out.h->deviceClass != icSigDisplayClass
- && su.out.h->deviceClass != icSigOutputClass
- && su.out.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */
- error("Output profile isn't a device profile");
-
- /* Get a conversion object */
- if ((su.out.luo = su.out.c->get_luobj(su.out.c, icmBwd, su.out.intent,
- icSigLabData, icmLuOrdNorm)) == NULL)
- error ("%d, %s for profile '%s'",su.out.c->errc, su.out.c->err, su.out.name);
-
- /* Get details of conversion (Arguments may be NULL if info not needed) */
- su.out.luo->spaces(su.out.luo, NULL, NULL, &su.outs, &su.od, &su.out.alg, NULL, NULL, NULL);
-
- /* Get native PCS space */
- su.out.luo->lutspaces(su.out.luo, NULL, NULL, NULL, NULL, &natpcs);
-
- if (natpcs == icSigXYZData) {
- su.ocombine = 1; /* XYZ is to non-linear to be a benefit */
- }
-
- /* See discussion in imdi/imdi_gen.c for ideal numbers */
- /* Use "high quality" resolution numbers */
- switch (su.id) {
- case 0:
- error ("Illegal number of input chanels");
- case 1:
- clutres = 256;
- break;
- case 2:
- clutres = 256;
- break;
- case 3:
- clutres = 33;
- break;
- case 4:
- clutres = 18;
- break;
- case 5:
- clutres = 16;
- break;
- case 6:
- clutres = 9;
- break;
- case 7:
- clutres = 7;
- break;
- case 8:
- clutres = 6;
- break;
- deault: /* > 8 chan */
- clutres = 3;
- break;
- }
-
- } else {
- icmLut *lut; /* ICC LUT table */
- icmLuLut *luluo; /* LUT lookup object */
-
- /* Open up the device link profile for reading */
- if ((su.dev.fp = new_icmFileStd_name(su.dev.name,"r")) == NULL)
- error ("Can't open file '%s'",su.dev.name);
-
- if ((su.dev.c = new_icc()) == NULL)
- error ("Creation of ICC object failed");
-
- if ((rv = su.dev.c->read(su.dev.c, su.dev.fp, 0)) != 0)
- error ("%d, %s",rv,su.dev.c->err);
- su.dev.h = su.dev.c->header;
-
- if (su.verb) {
- icmFile *op;
- if ((op = new_icmFileStd_fp(stdout)) == NULL)
- error ("Can't open stdout");
- su.dev.h->dump(su.dev.h, op, 1);
- op->del(op);
- }
-
- /* Check that the profile is appropriate */
- if (su.dev.h->deviceClass != icSigLinkClass)
- error("Profile isn't a device link profile");
-
- /* Get a conversion object */
- if ((su.dev.luo = su.dev.c->get_luobj(su.dev.c, icmFwd, icmDefaultIntent,
- icmSigDefaultData, icmLuOrdNorm)) == NULL)
- error ("%d, %s",su.dev.c->errc, su.dev.c->err);
-
- /* Get details of conversion (Arguments may be NULL if info not needed) */
- su.dev.luo->spaces(su.dev.luo, &su.ins, &su.id, &su.outs, &su.od, &su.dev.alg, NULL, NULL, NULL);
-
- if (su.dev.alg != icmLutType)
- error ("DeviceLink profile doesn't have Lut !");
-
- luluo = (icmLuLut *)su.dev.luo; /* Safe to coerce */
- luluo->get_info(luluo, &lut, NULL, NULL, NULL); /* Get some details */
- clutres = lut->clutPoints; /* Desired table resolution */
- }
-
- /* - - - - - - - - - - - - - - - */
- /* Open up input tiff file ready for reading */
- /* Got arguments, so setup to process the file */
- if ((rh = TIFFOpen(in_name, "r")) == NULL)
- error("error opening read file '%s'",in_name);
-
- TIFFGetField(rh, TIFFTAG_IMAGEWIDTH, &width);
- TIFFGetField(rh, TIFFTAG_IMAGELENGTH, &height);
-
- TIFFGetField(rh, TIFFTAG_BITSPERSAMPLE, &bitspersample);
- if (bitspersample != 8 && bitspersample != 16) {
- error("TIFF Input file must be 8 or 16 bit/channel");
- }
-
- TIFFGetField(rh, TIFFTAG_PHOTOMETRIC, &photometric);
- if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.ins)) == 0)
- error("ICC input colorspace '%s' can't be handled by a TIFF file!",
- icm2str(icmColorSpaceSignature, su.ins));
- for (i = 0; i < no_pmtc; i++) {
- if (pmtc[i] == photometric)
- break; /* Matches */
- }
- if (i >= no_pmtc) {
- switch (no_pmtc) {
- case 1:
- error("ICC input colorspace '%s' doesn't match TIFF photometric '%s'!",
- icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]));
- case 2:
- error("ICC input colorspace '%s' doesn't match TIFF photometric '%s' or '%s'!",
- icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]),
- Photometric2str(pmtc[1]));
- default:
- error("ICC input colorspace '%s' doesn't match TIFF photometric '%s', '%s' or '%s'!",
- icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]),
- Photometric2str(pmtc[1]), Photometric2str(pmtc[2]));
- }
- }
-
- TIFFGetField(rh, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
- if (su.id != samplesperpixel)
- error ("TIFF Input file has %d input channels mismatched to colorspace '%s'",
- samplesperpixel, icm2str(icmColorSpaceSignature, su.ins));
-
- TIFFGetField(rh, TIFFTAG_PLANARCONFIG, &pconfig);
- if (pconfig != PLANARCONFIG_CONTIG)
- error ("TIFF Input file must be planar");
-
- TIFFGetField(rh, TIFFTAG_RESOLUTIONUNIT, &resunits);
- TIFFGetField(rh, TIFFTAG_XRESOLUTION, &resx);
- TIFFGetField(rh, TIFFTAG_YRESOLUTION, &resy);
-
- /* - - - - - - - - - - - - - - - */
- if ((wh = TIFFOpen(out_name, "w")) == NULL)
- error("Can\'t create TIFF file '%s'!",out_name);
-
- TIFFSetField(wh, TIFFTAG_IMAGEWIDTH, width);
- TIFFSetField(wh, TIFFTAG_IMAGELENGTH, height);
- TIFFSetField(wh, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
- TIFFSetField(wh, TIFFTAG_SAMPLESPERPIXEL, su.od);
- TIFFSetField(wh, TIFFTAG_BITSPERSAMPLE, bitspersample);
- TIFFSetField(wh, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
- if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.outs)) == 0)
- error("TIFF file can't handle output colorspace '%s'!",
- icm2str(icmColorSpaceSignature, su.outs));
- TIFFSetField(wh, TIFFTAG_PHOTOMETRIC, pmtc[0]); /* Use first returned */
- if (pmtc[0] == PHOTOMETRIC_SEPARATED) {
- int iset;
- int inlen;
- char *inames;
- iset = ColorSpaceSignature2TiffInkset(su.outs, &inlen, &inames);
- if (iset != 0xffff && inlen > 0 && inames != NULL) {
- TIFFSetField(wh, TIFFTAG_INKSET, iset);
- if (inames != NULL) {
- TIFFSetField(wh, TIFFTAG_INKNAMES, inlen, inames);
- }
- }
- }
- TIFFSetField(wh, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
- if (resunits) {
- TIFFSetField(wh, TIFFTAG_RESOLUTIONUNIT, resunits);
- TIFFSetField(wh, TIFFTAG_XRESOLUTION, resx);
- TIFFSetField(wh, TIFFTAG_YRESOLUTION, resy);
- }
- TIFFSetField(wh, TIFFTAG_IMAGEDESCRIPTION, "Color corrected by Argyll");
-
- /* - - - - - - - - - - - - - - - */
- /* Setup the imdi */
-
- if (!slow) {
- s = new_imdi(
- su.id, /* Number of input dimensions */
- su.od, /* Number of output dimensions */
- /* Input pixel representation */
- bitspersample == 8 ? pixint8 : pixint16,
- /* Output pixel representation */
- 0x0, /* Treat every channel as unsigned */
- bitspersample == 8 ? pixint8 : pixint16,
- 0x0, /* Treat every channel as unsigned */
- clutres, /* Desired table resolution */
- input_curve, /* Callback functions */
- md_table,
- output_curve,
- (void *)&su /* Context to callbacks */
- );
-
- if (s == NULL)
- error("new_imdi failed");
- }
-
- /* - - - - - - - - - - - - - - - */
- /* Process colors to translate */
- /* (Should fix this to process a group of lines at a time ?) */
-
- inbuf = _TIFFmalloc(TIFFScanlineSize(rh));
- outbuf = _TIFFmalloc(TIFFScanlineSize(wh));
- if (check)
- checkbuf = _TIFFmalloc(TIFFScanlineSize(wh));
-
- inp[0] = (unsigned char *)inbuf;
- outp[0] = (unsigned char *)outbuf;
-
- if (!slow) { /* Fast */
- for (y = 0; y < height; y++) {
-
- /* Read in the next line */
- if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
- error ("Failed to read TIFF line %d",y);
-
- /* Do fast conversion */
- s->interp(s, (void **)outp, (void **)inp, width);
-
- if (check) {
- /* Do floating point conversion */
- for (x = 0; x < width; x++) {
- int i;
- double in[MAX_CHAN], out[MAX_CHAN];
-
- if (bitspersample == 8)
- for (i = 0; i < su.id; i++)
- in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0;
- else
- for (i = 0; i < su.id; i++)
- in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0;
-
- if (su.link) {
- if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- } else {
- if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- }
-
- if (bitspersample == 8)
- for (i = 0; i < su.od; i++)
- ((unsigned char *)checkbuf)[x * su.od + i] = (int)(out[i] * 255.0 + 0.5);
- else
- for (i = 0; i < su.od; i++)
- ((unsigned short *)checkbuf)[x * su.od + i] = (int)(out[i] * 65535.0 + 0.5);
- }
- /* Compute the errors */
- for (x = 0; x < (width * su.od); x++) {
- int err;
- if (bitspersample == 8)
- err = ((unsigned char *)outbuf)[x] - ((unsigned char *)checkbuf)[x];
- else
- err = ((unsigned short *)outbuf)[x] - ((unsigned short *)checkbuf)[x];
- if (err < 0)
- err = -err;
- if (err > mxerr)
- mxerr = err;
- avgerr += (double)err;
- avgcount++;
- }
- }
-
- if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
- error ("Failed to write TIFF line %d",y);
-
- }
-
- } else { /* Slow but precise */
- if (bitspersample == 8) {
- for (y = 0; y < height; y++) {
-
- /* Read in the next line */
- if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
- error ("Failed to read TIFF line %d",y);
-
- /* Do floating point conversion */
- for (x = 0; x < width; x++) {
- int i;
- double in[MAX_CHAN], out[MAX_CHAN];
-
- for (i = 0; i < su.id; i++) {
- in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0;
- }
-
- if (su.link) {
- if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- } else {
- if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- }
-
- for (i = 0; i < su.od; i++) {
- double outi = out[i];
- if (outi < 0.0) /* Protect against sillies */
- outi = 0.0;
- else if (outi > 1.0)
- outi = 1.0;
- ((unsigned char *)outbuf)[x * su.od + i] = (int)(outi * 255.0 + 0.5);
- }
- }
- if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
- error ("Failed to write TIFF line %d",y);
- }
- } else if (bitspersample == 16) {
- for (y = 0; y < height; y++) {
-
- /* Read in the next line */
- if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
- error ("Failed to read TIFF line %d",y);
-
- /* Do floating point conversion */
- for (x = 0; x < width; x++) {
- int i;
- double in[MAX_CHAN], out[MAX_CHAN];
-
- for (i = 0; i < su.id; i++) {
- in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0;
- }
-
- if (su.link) {
- if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- } else {
- if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
- error ("%d, %s",su.dev.c->errc,su.dev.c->err);
- }
-
- for (i = 0; i < su.od; i++) {
- double outi = out[i];
- if (outi < 0.0) /* Protect against sillies */
- outi = 0.0;
- else if (outi > 1.0)
- outi = 1.0;
- ((unsigned short *)outbuf)[x * su.od + i] = (int)(outi * 65535.0 + 0.5);
- }
- }
- if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
- error ("Failed to write TIFF line %d",y);
- }
- }
- }
-
- if (check) {
- printf("Worst error = %d bits, average error = %f bits\n", mxerr, avgerr/avgcount);
- if (bitspersample == 8)
- printf("Worst error = %f%%, average error = %f%%\n",
- mxerr/2.55, avgerr/(2.55 * avgcount));
- else
- printf("Worst error = %f%%, average error = %f%%\n",
- mxerr/655.35, avgerr/(655.35 * avgcount));
- }
-
- /* Done with lookup object */
- if (s != NULL)
- s->done(s);
-
- if (su.link) {
- su.in.luo->del(su.in.luo);
- su.in.c->del(su.in.c);
- su.in.fp->del(su.in.fp);
- su.out.luo->del(su.out.luo);
- su.out.c->del(su.out.c);
- su.out.fp->del(su.out.fp);
- } else {
- su.dev.luo->del(su.dev.luo);
- su.dev.c->del(su.dev.c);
- su.dev.fp->del(su.dev.fp);
- }
-
- _TIFFfree(inbuf);
- _TIFFfree(outbuf);
- if (check)
- _TIFFfree(checkbuf);
-
- TIFFClose(rh); /* Close Input file */
- TIFFClose(wh); /* Close Output file */
-
- return 0;
+ int fa,nfa; /* argument we're looking at */
+ char in_name[100]; /* Raster file name */
+ char out_name[100]; /* Raster file name */
+ int slow = 0;
+ int check = 0;
+ int i, rv = 0;
+
+ TIFF *rh = NULL, *wh = NULL;
+ int x, y, width, height; /* Size of image */
+ uint16 samplesperpixel, bitspersample;
+ int no_pmtc; /* Number of input photometrics */
+ uint16 photometric, pmtc[10]; /* Photometrics of input file, and input profile */
+ uint16 pconfig; /* Planar configuration */
+ uint16 resunits;
+ float resx, resy;
+ tdata_t *inbuf, *outbuf, *checkbuf;
+
+ /* IMDI */
+ imdi *s = NULL;
+ sucntx su; /* Setup context */
+ unsigned char *inp[MAX_CHAN];
+ unsigned char *outp[MAX_CHAN];
+ int clutres = 33;
+
+ /* Error check */
+ int mxerr = 0;
+ double avgerr = 0.0;
+ double avgcount = 0.0;
+
+ if (argc < 2)
+ usage();
+
+ su.verb = 0;
+ su.icombine = 0;
+ su.ocombine = 0;
+ su.link = 0;
+ su.in.intent = icmDefaultIntent;
+ su.out.intent = icmDefaultIntent;
+
+ /* Process the arguments */
+ for(fa = 1;fa < argc;fa++) {
+ nfa = fa; /* skip to nfa if next argument is used */
+ if (argv[fa][0] == '-') { /* Look for any flags */
+ char *na = NULL; /* next argument after flag, null if none */
+
+ if (argv[fa][2] != '\000')
+ na = &argv[fa][2]; /* next is directly after flag */
+ else {
+ if ((fa+1) < argc) {
+ if (argv[fa+1][0] != '-') {
+ nfa = fa + 1;
+ na = argv[nfa]; /* next is seperate non-flag argument */
+ }
+ }
+ }
+
+ if (argv[fa][1] == '?')
+ usage();
+
+ /* Slow, Precise */
+ else if (argv[fa][1] == 'p' || argv[fa][1] == 'P') {
+ slow = 1;
+ }
+
+ /* Combine per channel curves */
+ else if (argv[fa][1] == 'c' || argv[fa][1] == 'C') {
+ su.icombine = 1;
+ su.ocombine = 1;
+ }
+
+ /* Check curves */
+ else if (argv[fa][1] == 'k' || argv[fa][1] == 'K') {
+ check = 1;
+ }
+
+ /* Link profiles */
+ else if (argv[fa][1] == 'l' || argv[fa][1] == 'L') {
+ su.link = 1;
+ }
+
+ /* Input profile Intent */
+ else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') {
+ fa = nfa;
+ if (na == NULL) usage();
+ switch (na[0]) {
+ case 'p':
+ case 'P':
+ su.in.intent = icPerceptual;
+ break;
+ case 'r':
+ case 'R':
+ su.in.intent = icRelativeColorimetric;
+ break;
+ case 's':
+ case 'S':
+ su.in.intent = icSaturation;
+ break;
+ case 'a':
+ case 'A':
+ su.in.intent = icAbsoluteColorimetric;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ /* Output profile Intent */
+ else if (argv[fa][1] == 'o' || argv[fa][1] == 'O') {
+ fa = nfa;
+ if (na == NULL) usage();
+ switch (na[0]) {
+ case 'p':
+ case 'P':
+ su.out.intent = icPerceptual;
+ break;
+ case 'r':
+ case 'R':
+ su.out.intent = icRelativeColorimetric;
+ break;
+ case 's':
+ case 'S':
+ su.out.intent = icSaturation;
+ break;
+ case 'a':
+ case 'A':
+ su.out.intent = icAbsoluteColorimetric;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ /* Verbosity */
+ else if (argv[fa][1] == 'v' || argv[fa][1] == 'V') {
+ su.verb = 1;
+ }
+
+ else
+ usage();
+ } else
+ break;
+ }
+
+ if (su.link) {
+ if (fa >= argc || argv[fa][0] == '-') usage();
+ strcpy(su.in.name,argv[fa++]);
+
+ if (fa >= argc || argv[fa][0] == '-') usage();
+ strcpy(su.out.name,argv[fa++]);
+ } else {
+ if (fa >= argc || argv[fa][0] == '-') usage();
+ strcpy(su.dev.name,argv[fa++]);
+ }
+
+ if (fa >= argc || argv[fa][0] == '-') usage();
+ strcpy(in_name,argv[fa++]);
+
+ if (fa >= argc || argv[fa][0] == '-') usage();
+ strcpy(out_name,argv[fa++]);
+
+ /* - - - - - - - - - - - - - - - - */
+
+ if (su.link) {
+ icColorSpaceSignature natpcs;
+
+ /* Open up the input device profile for reading */
+ if ((su.in.fp = new_icmFileStd_name(su.in.name,"r")) == NULL)
+ error ("Can't open file '%s'",su.in.name);
+
+ if ((su.in.c = new_icc()) == NULL)
+ error ("Creation of Input profile ICC object failed");
+
+ /* Read header etc. */
+ if ((rv = su.in.c->read(su.in.c,su.in.fp,0)) != 0)
+ error ("%d, %s on file '%s'",rv,su.in.c->err,su.in.name);
+ su.in.h = su.in.c->header;
+
+ /* Check that it is a suitable device input icc */
+ if (su.in.h->deviceClass != icSigInputClass
+ && su.in.h->deviceClass != icSigDisplayClass
+ && su.in.h->deviceClass != icSigOutputClass
+ && su.in.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */
+ error("Input profile isn't a device profile");
+
+ /* Get a conversion object */
+ if ((su.in.luo = su.in.c->get_luobj(su.in.c, icmFwd, su.in.intent,
+ icSigLabData, icmLuOrdNorm)) == NULL)
+ error ("%d, %s for profile '%s'",su.in.c->errc, su.in.c->err, su.in.name);
+
+ /* Get details of conversion (Arguments may be NULL if info not needed) */
+ su.in.luo->spaces(su.in.luo, &su.ins, &su.id, NULL, NULL, &su.in.alg, NULL, NULL, NULL);
+
+ /* Get native PCS space */
+ su.in.luo->lutspaces(su.in.luo, NULL, NULL, NULL, NULL, &natpcs);
+
+ if (natpcs == icSigXYZData) {
+ su.icombine = 1; /* XYZ is to non-linear to be a benefit */
+ }
+
+ /* Open up the output device profile for reading */
+ if ((su.out.fp = new_icmFileStd_name(su.out.name,"r")) == NULL)
+ error ("Can't open file '%s'",su.out.name);
+
+ if ((su.out.c = new_icc()) == NULL)
+ error ("Creation of Output profile ICC object failed");
+
+ /* Read header etc. */
+ if ((rv = su.out.c->read(su.out.c,su.out.fp,0)) != 0)
+ error ("%d, %s on file '%s'",rv,su.out.c->err,su.out.name);
+ su.out.h = su.out.c->header;
+
+ /* Check that it is a suitable device output icc */
+ if (su.out.h->deviceClass != icSigInputClass
+ && su.out.h->deviceClass != icSigDisplayClass
+ && su.out.h->deviceClass != icSigOutputClass
+ && su.out.h->deviceClass != icSigColorSpaceClass) /* For sRGB etc. */
+ error("Output profile isn't a device profile");
+
+ /* Get a conversion object */
+ if ((su.out.luo = su.out.c->get_luobj(su.out.c, icmBwd, su.out.intent,
+ icSigLabData, icmLuOrdNorm)) == NULL)
+ error ("%d, %s for profile '%s'",su.out.c->errc, su.out.c->err, su.out.name);
+
+ /* Get details of conversion (Arguments may be NULL if info not needed) */
+ su.out.luo->spaces(su.out.luo, NULL, NULL, &su.outs, &su.od, &su.out.alg, NULL, NULL, NULL);
+
+ /* Get native PCS space */
+ su.out.luo->lutspaces(su.out.luo, NULL, NULL, NULL, NULL, &natpcs);
+
+ if (natpcs == icSigXYZData) {
+ su.ocombine = 1; /* XYZ is to non-linear to be a benefit */
+ }
+
+ /* See discussion in imdi/imdi_gen.c for ideal numbers */
+ /* Use "high quality" resolution numbers */
+ switch (su.id) {
+ case 0:
+ error ("Illegal number of input chanels");
+ case 1:
+ clutres = 256;
+ break;
+ case 2:
+ clutres = 256;
+ break;
+ case 3:
+ clutres = 33;
+ break;
+ case 4:
+ clutres = 18;
+ break;
+ case 5:
+ clutres = 16;
+ break;
+ case 6:
+ clutres = 9;
+ break;
+ case 7:
+ clutres = 7;
+ break;
+ case 8:
+ clutres = 6;
+ break;
+ deault: /* > 8 chan */
+ clutres = 3;
+ break;
+ }
+
+ } else {
+ icmLut *lut; /* ICC LUT table */
+ icmLuLut *luluo; /* LUT lookup object */
+
+ /* Open up the device link profile for reading */
+ if ((su.dev.fp = new_icmFileStd_name(su.dev.name,"r")) == NULL)
+ error ("Can't open file '%s'",su.dev.name);
+
+ if ((su.dev.c = new_icc()) == NULL)
+ error ("Creation of ICC object failed");
+
+ if ((rv = su.dev.c->read(su.dev.c, su.dev.fp, 0)) != 0)
+ error ("%d, %s",rv,su.dev.c->err);
+ su.dev.h = su.dev.c->header;
+
+ if (su.verb) {
+ icmFile *op;
+ if ((op = new_icmFileStd_fp(stdout)) == NULL)
+ error ("Can't open stdout");
+ su.dev.h->dump(su.dev.h, op, 1);
+ op->del(op);
+ }
+
+ /* Check that the profile is appropriate */
+ if (su.dev.h->deviceClass != icSigLinkClass)
+ error("Profile isn't a device link profile");
+
+ /* Get a conversion object */
+ if ((su.dev.luo = su.dev.c->get_luobj(su.dev.c, icmFwd, icmDefaultIntent,
+ icmSigDefaultData, icmLuOrdNorm)) == NULL)
+ error ("%d, %s",su.dev.c->errc, su.dev.c->err);
+
+ /* Get details of conversion (Arguments may be NULL if info not needed) */
+ su.dev.luo->spaces(su.dev.luo, &su.ins, &su.id, &su.outs, &su.od, &su.dev.alg, NULL, NULL, NULL);
+
+ if (su.dev.alg != icmLutType)
+ error ("DeviceLink profile doesn't have Lut !");
+
+ luluo = (icmLuLut *)su.dev.luo; /* Safe to coerce */
+ luluo->get_info(luluo, &lut, NULL, NULL, NULL); /* Get some details */
+ clutres = lut->clutPoints; /* Desired table resolution */
+ }
+
+ /* - - - - - - - - - - - - - - - */
+ /* Open up input tiff file ready for reading */
+ /* Got arguments, so setup to process the file */
+ if ((rh = TIFFOpen(in_name, "r")) == NULL)
+ error("error opening read file '%s'",in_name);
+
+ TIFFGetField(rh, TIFFTAG_IMAGEWIDTH, &width);
+ TIFFGetField(rh, TIFFTAG_IMAGELENGTH, &height);
+
+ TIFFGetField(rh, TIFFTAG_BITSPERSAMPLE, &bitspersample);
+ if (bitspersample != 8 && bitspersample != 16) {
+ error("TIFF Input file must be 8 or 16 bit/channel");
+ }
+
+ TIFFGetField(rh, TIFFTAG_PHOTOMETRIC, &photometric);
+ if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.ins)) == 0)
+ error("ICC input colorspace '%s' can't be handled by a TIFF file!",
+ icm2str(icmColorSpaceSignature, su.ins));
+ for (i = 0; i < no_pmtc; i++) {
+ if (pmtc[i] == photometric)
+ break; /* Matches */
+ }
+ if (i >= no_pmtc) {
+ switch (no_pmtc) {
+ case 1:
+ error("ICC input colorspace '%s' doesn't match TIFF photometric '%s'!",
+ icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]));
+ case 2:
+ error("ICC input colorspace '%s' doesn't match TIFF photometric '%s' or '%s'!",
+ icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]),
+ Photometric2str(pmtc[1]));
+ default:
+ error("ICC input colorspace '%s' doesn't match TIFF photometric '%s', '%s' or '%s'!",
+ icm2str(icmColorSpaceSignature, su.ins), Photometric2str(pmtc[0]),
+ Photometric2str(pmtc[1]), Photometric2str(pmtc[2]));
+ }
+ }
+
+ TIFFGetField(rh, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
+ if (su.id != samplesperpixel)
+ error ("TIFF Input file has %d input channels mismatched to colorspace '%s'",
+ samplesperpixel, icm2str(icmColorSpaceSignature, su.ins));
+
+ TIFFGetField(rh, TIFFTAG_PLANARCONFIG, &pconfig);
+ if (pconfig != PLANARCONFIG_CONTIG)
+ error ("TIFF Input file must be planar");
+
+ TIFFGetField(rh, TIFFTAG_RESOLUTIONUNIT, &resunits);
+ TIFFGetField(rh, TIFFTAG_XRESOLUTION, &resx);
+ TIFFGetField(rh, TIFFTAG_YRESOLUTION, &resy);
+
+ /* - - - - - - - - - - - - - - - */
+ if ((wh = TIFFOpen(out_name, "w")) == NULL)
+ error("Can\'t create TIFF file '%s'!",out_name);
+
+ TIFFSetField(wh, TIFFTAG_IMAGEWIDTH, width);
+ TIFFSetField(wh, TIFFTAG_IMAGELENGTH, height);
+ TIFFSetField(wh, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+ TIFFSetField(wh, TIFFTAG_SAMPLESPERPIXEL, su.od);
+ TIFFSetField(wh, TIFFTAG_BITSPERSAMPLE, bitspersample);
+ TIFFSetField(wh, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ if ((no_pmtc = ColorSpaceSignature2TiffPhotometric(pmtc, su.outs)) == 0)
+ error("TIFF file can't handle output colorspace '%s'!",
+ icm2str(icmColorSpaceSignature, su.outs));
+ TIFFSetField(wh, TIFFTAG_PHOTOMETRIC, pmtc[0]); /* Use first returned */
+ if (pmtc[0] == PHOTOMETRIC_SEPARATED) {
+ int iset;
+ int inlen;
+ char *inames;
+ iset = ColorSpaceSignature2TiffInkset(su.outs, &inlen, &inames);
+ if (iset != 0xffff && inlen > 0 && inames != NULL) {
+ TIFFSetField(wh, TIFFTAG_INKSET, iset);
+ if (inames != NULL) {
+ TIFFSetField(wh, TIFFTAG_INKNAMES, inlen, inames);
+ }
+ }
+ }
+ TIFFSetField(wh, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+ if (resunits) {
+ TIFFSetField(wh, TIFFTAG_RESOLUTIONUNIT, resunits);
+ TIFFSetField(wh, TIFFTAG_XRESOLUTION, resx);
+ TIFFSetField(wh, TIFFTAG_YRESOLUTION, resy);
+ }
+ TIFFSetField(wh, TIFFTAG_IMAGEDESCRIPTION, "Color corrected by Argyll");
+
+ /* - - - - - - - - - - - - - - - */
+ /* Setup the imdi */
+
+ if (!slow) {
+ s = new_imdi(
+ su.id, /* Number of input dimensions */
+ su.od, /* Number of output dimensions */
+ /* Input pixel representation */
+ bitspersample == 8 ? pixint8 : pixint16,
+ /* Output pixel representation */
+ 0x0, /* Treat every channel as unsigned */
+ bitspersample == 8 ? pixint8 : pixint16,
+ 0x0, /* Treat every channel as unsigned */
+ clutres, /* Desired table resolution */
+ input_curve, /* Callback functions */
+ md_table,
+ output_curve,
+ (void *)&su /* Context to callbacks */
+ );
+
+ if (s == NULL)
+ error("new_imdi failed");
+ }
+
+ /* - - - - - - - - - - - - - - - */
+ /* Process colors to translate */
+ /* (Should fix this to process a group of lines at a time ?) */
+
+ inbuf = _TIFFmalloc(TIFFScanlineSize(rh));
+ outbuf = _TIFFmalloc(TIFFScanlineSize(wh));
+ if (check)
+ checkbuf = _TIFFmalloc(TIFFScanlineSize(wh));
+
+ inp[0] = (unsigned char *)inbuf;
+ outp[0] = (unsigned char *)outbuf;
+
+ if (!slow) { /* Fast */
+ for (y = 0; y < height; y++) {
+
+ /* Read in the next line */
+ if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
+ error ("Failed to read TIFF line %d",y);
+
+ /* Do fast conversion */
+ s->interp(s, (void **)outp, (void **)inp, width);
+
+ if (check) {
+ /* Do floating point conversion */
+ for (x = 0; x < width; x++) {
+ int i;
+ double in[MAX_CHAN], out[MAX_CHAN];
+
+ if (bitspersample == 8)
+ for (i = 0; i < su.id; i++)
+ in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0;
+ else
+ for (i = 0; i < su.id; i++)
+ in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0;
+
+ if (su.link) {
+ if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ } else {
+ if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ }
+
+ if (bitspersample == 8)
+ for (i = 0; i < su.od; i++)
+ ((unsigned char *)checkbuf)[x * su.od + i] = (int)(out[i] * 255.0 + 0.5);
+ else
+ for (i = 0; i < su.od; i++)
+ ((unsigned short *)checkbuf)[x * su.od + i] = (int)(out[i] * 65535.0 + 0.5);
+ }
+ /* Compute the errors */
+ for (x = 0; x < (width * su.od); x++) {
+ int err;
+ if (bitspersample == 8)
+ err = ((unsigned char *)outbuf)[x] - ((unsigned char *)checkbuf)[x];
+ else
+ err = ((unsigned short *)outbuf)[x] - ((unsigned short *)checkbuf)[x];
+ if (err < 0)
+ err = -err;
+ if (err > mxerr)
+ mxerr = err;
+ avgerr += (double)err;
+ avgcount++;
+ }
+ }
+
+ if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
+ error ("Failed to write TIFF line %d",y);
+
+ }
+
+ } else { /* Slow but precise */
+ if (bitspersample == 8) {
+ for (y = 0; y < height; y++) {
+
+ /* Read in the next line */
+ if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
+ error ("Failed to read TIFF line %d",y);
+
+ /* Do floating point conversion */
+ for (x = 0; x < width; x++) {
+ int i;
+ double in[MAX_CHAN], out[MAX_CHAN];
+
+ for (i = 0; i < su.id; i++) {
+ in[i] = ((unsigned char *)inbuf)[x * su.id + i]/255.0;
+ }
+
+ if (su.link) {
+ if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ } else {
+ if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ }
+
+ for (i = 0; i < su.od; i++) {
+ double outi = out[i];
+ if (outi < 0.0) /* Protect against sillies */
+ outi = 0.0;
+ else if (outi > 1.0)
+ outi = 1.0;
+ ((unsigned char *)outbuf)[x * su.od + i] = (int)(outi * 255.0 + 0.5);
+ }
+ }
+ if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
+ error ("Failed to write TIFF line %d",y);
+ }
+ } else if (bitspersample == 16) {
+ for (y = 0; y < height; y++) {
+
+ /* Read in the next line */
+ if (TIFFReadScanline(rh, inbuf, y, 0) < 0)
+ error ("Failed to read TIFF line %d",y);
+
+ /* Do floating point conversion */
+ for (x = 0; x < width; x++) {
+ int i;
+ double in[MAX_CHAN], out[MAX_CHAN];
+
+ for (i = 0; i < su.id; i++) {
+ in[i] = ((unsigned short *)inbuf)[x * su.id + i]/65535.0;
+ }
+
+ if (su.link) {
+ if ((rv = su.in.luo->lookup(su.in.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ if ((rv = su.out.luo->lookup(su.out.luo, out, out)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ } else {
+ if ((rv = su.dev.luo->lookup(su.dev.luo, out, in)) > 1)
+ error ("%d, %s",su.dev.c->errc,su.dev.c->err);
+ }
+
+ for (i = 0; i < su.od; i++) {
+ double outi = out[i];
+ if (outi < 0.0) /* Protect against sillies */
+ outi = 0.0;
+ else if (outi > 1.0)
+ outi = 1.0;
+ ((unsigned short *)outbuf)[x * su.od + i] = (int)(outi * 65535.0 + 0.5);
+ }
+ }
+ if (TIFFWriteScanline(wh, outbuf, y, 0) < 0)
+ error ("Failed to write TIFF line %d",y);
+ }
+ }
+ }
+
+ if (check) {
+ printf("Worst error = %d bits, average error = %f bits\n", mxerr, avgerr/avgcount);
+ if (bitspersample == 8)
+ printf("Worst error = %f%%, average error = %f%%\n",
+ mxerr/2.55, avgerr/(2.55 * avgcount));
+ else
+ printf("Worst error = %f%%, average error = %f%%\n",
+ mxerr/655.35, avgerr/(655.35 * avgcount));
+ }
+
+ /* Done with lookup object */
+ if (s != NULL)
+ s->done(s);
+
+ if (su.link) {
+ su.in.luo->del(su.in.luo);
+ su.in.c->del(su.in.c);
+ su.in.fp->del(su.in.fp);
+ su.out.luo->del(su.out.luo);
+ su.out.c->del(su.out.c);
+ su.out.fp->del(su.out.fp);
+ } else {
+ su.dev.luo->del(su.dev.luo);
+ su.dev.c->del(su.dev.c);
+ su.dev.fp->del(su.dev.fp);
+ }
+
+ _TIFFfree(inbuf);
+ _TIFFfree(outbuf);
+ if (check)
+ _TIFFfree(checkbuf);
+
+ TIFFClose(rh); /* Close Input file */
+ TIFFClose(wh); /* Close Output file */
+
+ return 0;
}
-
/* Basic printf type error() and warning() routines */
void
error(char *fmt, ...)
{
- va_list args;
-
- fprintf(stderr,"cctiff: Error - ");
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fprintf(stderr, "\n");
- exit (-1);
+ va_list args;
+
+ fprintf(stderr,"cctiff: Error - ");
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ exit (-1);
}
void
warning(char *fmt, ...)
{
- va_list args;
+ va_list args;
- fprintf(stderr,"cctiff: Warning - ");
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fprintf(stderr, "\n");
+ fprintf(stderr,"cctiff: Warning - ");
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
}
diff --git a/gs/imdi/cgen.c b/gs/imdi/cgen.c
index 7333aa6dd..cb1bf0732 100644
--- a/gs/imdi/cgen.c
+++ b/gs/imdi/cgen.c
@@ -1,4 +1,3 @@
-
/* Integer Multi-Dimensional Interpolation */
/*
@@ -43,72 +42,72 @@
/* ------------------------------------ */
/* Context */
typedef struct {
- FILE *of; /* Output file */
- int indt; /* Indent */
-
- /* Other info */
- genspec *g; /* Generation specifications */
- tabspec *t; /* Table setup data */
- mach_arch *a; /* Machine architecture and tuning data */
-
- /* Code generation information */
- /* if() conditions are for entry usage */
-
- /* Pixel read information */
- int ipt[IXDI]; /* Input pointer types */
- int nip; /* Actual number of input pointers, accounting for pint */
- int chv_bits; /* Bits in chv temp variable ?? */
-
- /* Input table entry */
- int itet; /* Input table entry type */
- int itvt; /* Input table variable type */
- int itmnb; /* Input table minimum bits (actual is it_ab) */
-
- /* Interpolation index */
- int ixet; /* Interpolation index entry type */
- int ixvt; /* Interpolation index variable type */
- int ixmnb; /* Interpolation index minimum bits (actual is ix_ab) */
- int ixmxres; /* Interpolation table maximum resolution */
-
- /* Simplex index: if(!sort && it_xs) */
- int sxet; /* Simplex index entry type */
- int sxvt; /* Simplex index variable type */
- int sxmnb; /* Simplex index bits minimum (actual is sx_ab) */
- int sxmxres; /* Simplex table maximum resolution (0 if sort) */
-
- /* Combination Weighting + Vertex offset values: if(it_xs && !wo_xs) */
- int woet; /* Weighting+offset entry type */
- int wovt; /* Weighting+offset variable type */
- int womnb; /* Weighting+offset index bits minimum (actual is wo_ab) */
-
- /* Weighting value: if(it_xs && wo_xs) */
- int weet; /* Weighting entry type */
- int wevt; /* Weighting variable type */
- int wemnb; /* Weighting index bits minimum (actual is we_ab) */
-
- /* Vertex offset value: if(it_xs && wo_xs) */
- int voet; /* Vertex offset entry type */
- int vovt; /* Vertex offset variable type */
- int vomnb; /* Vertex offset index bits minimum (actual is vo_ab) */
-
- /* Interpolation table entry: */
- int imovb; /* Interpolation output value bits per channel required */
- int imfvt; /* Interpolation full entry & variable type */
- int impvt; /* Interpolation partial entry variable type */
-
- /* Interpolation accumulators: */
- int iaovb; /* Interpolation output value bits per channel required */
- int iafvt; /* Interpolation full entry & variable type */
- int iapvt; /* Interpolation partial entry variable type */
- int ian; /* Total number of accumulators */
-
- /* Output table lookup */
- int otit; /* Output table index type */
- int otvt; /* Output table value type (size is ot_ts bytes) */
-
- /* Write information */
- int opt[IXDO]; /* Output pointer types */
- int nop; /* Actual number of output pointers, accounting for pint */
+ FILE *of; /* Output file */
+ int indt; /* Indent */
+
+ /* Other info */
+ genspec *g; /* Generation specifications */
+ tabspec *t; /* Table setup data */
+ mach_arch *a; /* Machine architecture and tuning data */
+
+ /* Code generation information */
+ /* if() conditions are for entry usage */
+
+ /* Pixel read information */
+ int ipt[IXDI]; /* Input pointer types */
+ int nip; /* Actual number of input pointers, accounting for pint */
+ int chv_bits; /* Bits in chv temp variable ?? */
+
+ /* Input table entry */
+ int itet; /* Input table entry type */
+ int itvt; /* Input table variable type */
+ int itmnb; /* Input table minimum bits (actual is it_ab) */
+
+ /* Interpolation index */
+ int ixet; /* Interpolation index entry type */
+ int ixvt; /* Interpolation index variable type */
+ int ixmnb; /* Interpolation index minimum bits (actual is ix_ab) */
+ int ixmxres; /* Interpolation table maximum resolution */
+
+ /* Simplex index: if(!sort && it_xs) */
+ int sxet; /* Simplex index entry type */
+ int sxvt; /* Simplex index variable type */
+ int sxmnb; /* Simplex index bits minimum (actual is sx_ab) */
+ int sxmxres; /* Simplex table maximum resolution (0 if sort) */
+
+ /* Combination Weighting + Vertex offset values: if(it_xs && !wo_xs) */
+ int woet; /* Weighting+offset entry type */
+ int wovt; /* Weighting+offset variable type */
+ int womnb; /* Weighting+offset index bits minimum (actual is wo_ab) */
+
+ /* Weighting value: if(it_xs && wo_xs) */
+ int weet; /* Weighting entry type */
+ int wevt; /* Weighting variable type */
+ int wemnb; /* Weighting index bits minimum (actual is we_ab) */
+
+ /* Vertex offset value: if(it_xs && wo_xs) */
+ int voet; /* Vertex offset entry type */
+ int vovt; /* Vertex offset variable type */
+ int vomnb; /* Vertex offset index bits minimum (actual is vo_ab) */
+
+ /* Interpolation table entry: */
+ int imovb; /* Interpolation output value bits per channel required */
+ int imfvt; /* Interpolation full entry & variable type */
+ int impvt; /* Interpolation partial entry variable type */
+
+ /* Interpolation accumulators: */
+ int iaovb; /* Interpolation output value bits per channel required */
+ int iafvt; /* Interpolation full entry & variable type */
+ int iapvt; /* Interpolation partial entry variable type */
+ int ian; /* Total number of accumulators */
+
+ /* Output table lookup */
+ int otit; /* Output table index type */
+ int otvt; /* Output table value type (size is ot_ts bytes) */
+
+ /* Write information */
+ int opt[IXDO]; /* Output pointer types */
+ int nop; /* Actual number of output pointers, accounting for pint */
} fileo;
@@ -134,1407 +133,1404 @@ static int calc_res(int dim, int bits);
static int calc_obits(int dim, int res, int esize);
static int calc_ores(int dim, int bits, int esize);
-
/* return a hexadecimal mask string */
/* take care of the case when bits >= 32 */
char *hmask(int bits) {
- static char buf[20];
-
- if (bits < 32) {
- sprintf(buf, "0x%x",(1 << bits)-1);
- } else if (bits == 32) {
- return "0xffffffff";
- } else if (bits == 64) {
- return "0xffffffffffffffff";
- } else { /* Bits > 32 */
- sprintf(buf, "0x%xffffffff",(1 << (bits-32))-1);
- }
- return buf;
+ static char buf[20];
+
+ if (bits < 32) {
+ sprintf(buf, "0x%x",(1 << bits)-1);
+ } else if (bits == 32) {
+ return "0xffffffff";
+ } else if (bits == 64) {
+ return "0xffffffffffffffff";
+ } else { /* Bits > 32 */
+ sprintf(buf, "0x%xffffffff",(1 << (bits-32))-1);
+ }
+ return buf;
}
/* Generate a source file to implement the specified */
/* interpolation kernel. Fill in return values and return 0 if OK. */
/* Return non-zero on error. */
int gen_c_kernel(
- genspec *g, /* Specification of what to generate */
- mach_arch *a,
- FILE *fp, /* File to write to */
- int index /* Identification index, 1 = first */
+ genspec *g, /* Specification of what to generate */
+ mach_arch *a,
+ FILE *fp, /* File to write to */
+ int index /* Identification index, 1 = first */
) {
- unsigned char kk[] = { 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6D, 0x65, 0x20, 0x57, 0x2E,
- 0x20, 0x47, 0x69, 0x6C, 0x6C, 0x00 };
- fileo f[1];
- int e, i;
- tabspec tabsp, *t = &tabsp;
- int timp = 0; /* Flag to use temporary imp pointer. */
- /* Seem to make x86 MSVC++ slower */
- /* Has no effect on x86 IBMCC */
-
- sprintf(g->kname, "imdi_k%d",index); /* Kernel routine base name */
- strcpy(g->kkeys, kk); /* Kernel keys for this session */
-
- /* Setup the file output context */
- f->of = fp;
- f->indt = 0; /* Start with no indentation */
- f->g = g;
- f->t = t;
- f->a = a;
-
- if (g->prec == 8) {
- if (g->id <= 4)
- t->sort = 0; /* Implicit sort using simplex table lookup */
- else
- t->sort = 1; /* Explicit sort */
-
- } else if (g->prec == 16) {
- t->sort = 1; /* Explit sort, no simplex table */
-
- } else {
- fprintf(stderr,"Can't cope with requested precision of %d bits\n",g->prec);
- exit(-1);
- }
+ unsigned char kk[] = { 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6D, 0x65, 0x20, 0x57, 0x2E,
+ 0x20, 0x47, 0x69, 0x6C, 0x6C, 0x00 };
+ fileo f[1];
+ int e, i;
+ tabspec tabsp, *t = &tabsp;
+ int timp = 0; /* Flag to use temporary imp pointer. */
+ /* Seem to make x86 MSVC++ slower */
+ /* Has no effect on x86 IBMCC */
+
+ sprintf(g->kname, "imdi_k%d",index); /* Kernel routine base name */
+ strcpy(g->kkeys, kk); /* Kernel keys for this session */
+
+ /* Setup the file output context */
+ f->of = fp;
+ f->indt = 0; /* Start with no indentation */
+ f->g = g;
+ f->t = t;
+ f->a = a;
+
+ if (g->prec == 8) {
+ if (g->id <= 4)
+ t->sort = 0; /* Implicit sort using simplex table lookup */
+ else
+ t->sort = 1; /* Explicit sort */
+
+ } else if (g->prec == 16) {
+ t->sort = 1; /* Explit sort, no simplex table */
+
+ } else {
+ fprintf(stderr,"Can't cope with requested precision of %d bits\n",g->prec);
+ exit(-1);
+ }
#ifdef FORCESORT
- t->sort = 1;
+ t->sort = 1;
#endif
- /* Compute input read and input table lookup stuff */
-
- /* Compute number of input pointers */
- if (g->in.pint != 0) /* Pixel interleaved */
- f->nip = 1;
- else
- f->nip = g->id;
-
- /* Figure out the input pointer types */
- for (e = 0; e < f->nip; e++) {
- if ((f->ipt[e] = findord(f, g->in.bpch[e])) < 0) {
- fprintf(stderr,"Input channel size can't be handled\n");
- exit(-1);
- }
- }
-
- /* Set a default input channel mapping */
- for (e = 0; e < g->id; e++)
- t->it_map[e] = e;
-
- /* Do the rest of the input table size calculations after figuring */
- /* out simplex and interpolation table sizes. */
-
-
- /* Figure out the interpolation multi-dimentional table structure */
- /* and output accumulation variable sizes. */
-
- if (g->prec == 8
- || g->prec == 16 && a->ords[a->nords-1].bits >= (g->prec * 4)) {
- int tiby; /* Total interpolation bytes needed */
-
- /* We assume that we can normally compute more than one */
- /* output value at a time, so we need to hold the interpolation */
- /* output data in the expanded fixed point format in both the */
- /* table and accumulator. */
- t->im_cd = 1;
- f->imovb = g->prec * 2; /* 16 bits needed for 8 bit precision, */
- f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision */
- f->imfvt = a->nords-1; /* Full variable entry type is biggest available */
- f->iafvt = a->nords-1; /* Full variable accum. type is same */
-
- if (a->ords[f->imfvt].bits < f->imovb) {
- fprintf(stderr,"Interpolation table entry size can't be handled\n");
- exit(-1);
- }
-
- /* Compute details of table entry sizes, number */
- tiby = (f->imovb * g->od)/8; /* Total table bytes needed */
- t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */
- t->im_fv = (t->im_fs * 8)/f->imovb; /* output values per full entry . */
- t->im_fn = tiby/t->im_fs; /* Number of full entries (may be 0) */
- t->im_ts = t->im_fn * t->im_fs; /* Structure size so far */
- tiby -= t->im_fn * t->im_fs; /* Remaining bytes */
-
- if (tiby <= 0) {
- t->im_pn = 0; /* No partials */
- t->im_ps = 0;
- t->im_pv = 0;
- f->impvt = 0;
- f->iapvt = 0;
-
- } else {
- t->im_pn = 1; /* Must be just 1 partial */
- t->im_pv = (tiby * 8)/f->imovb; /* Partial holds remaining entries */
-
- if ((f->impvt = findnord(f, tiby * 8)) < 0) {
- fprintf(stderr,"Can't find partial interp table entry variable size\n");
- exit(-1);
- }
- f->iapvt = f->impvt;
- t->im_ps = a->ords[f->impvt].bits/8;/* Partial entry bytes */
-
- if (a->ords[f->imfvt].align) /* If full entry's need to be aligned */
- t->im_ts += t->im_fs; /* Round out struct size by full entry */
- else
- t->im_ts += t->im_ps; /* Round out to natural size */
- }
-
- } else {
- /* One 16 bit output value per entry + 32 bit accumulator. */
- /* We can conserve table space by not holding the table data in expanded */
- /* fixed point format, but expanding it when it is read. */
- /* Without resorting to compicated code, this restricts us */
- /* to only computing one output value per accumulator. */
- t->im_cd = 0;
- f->imovb = g->prec; /* Table holds 16 bit entries with no fractions */
- f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision in comp. */
-
- if ((f->imfvt = findord(f, f->imovb)) < 0) {
- fprintf(stderr,"Interpolation table entry size can't be handled\n");
- exit(-1);
- }
- if ((f->iafvt = findord(f, f->iaovb)) < 0) {
- fprintf(stderr,"Interpolation accumulator size can't be handled\n");
- exit(-1);
- }
-
- /* Compute details of table entry sizes, number */
- t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */
- t->im_fv = 1; /* output values per full entry . */
- t->im_fn = g->od; /* Number of full entries */
- t->im_ts = t->im_fn * t->im_fs; /* Total structure size */
-
- t->im_pn = 0; /* No partials */
- t->im_ps = 0;
- t->im_pv = 0;
- f->impvt = 0;
- f->iapvt = 0;
- }
- f->ian = t->im_fn + t->im_pn; /* Total number of output accumulators */
-
- /* Figure out how much of the interpolation entry offset to put in the */
- /* vertex offset value, and how much to make explicit in accessing the */
- /* interpolation table enty. */
- if (a->oscale > 0) { /* We have a scaled index mode */
- /* Use as much of the scaled index mode as possible */
- /* and then do the balance by scaling the simplex index entry. */
- for (t->im_oc = a->oscale; ; t->im_oc >>= 1) {
- t->vo_om = t->im_ts/t->im_oc; /* Simplex index multiplier */
- if ((t->vo_om * t->im_oc) == t->im_ts)
- break; /* Got appropriate offset scale */
- }
- } else if (a->smmul) { /* Architecure supports fast small multiply */
- t->im_oc = t->im_ts; /* Do scale by structure size explicitly */
- t->vo_om = 1; /* Do none in the Simplex index */
- } else { /* We have no fast tricks */
- t->im_oc = 1; /* Do none explicitly */
- t->vo_om = t->im_ts; /* Do all in Simplex index */
- }
-
- /* Compute the number of bits needed to hold an index into */
- /* the interpolation table (index is in terms of table entry size). */
- /* This value is used to figure out the room needed in the input */
- /* table to accumulate the interpolation cube base offset value. (IM_O macro) */
- f->ixmnb = calc_bits(g->id, g->itres);
-
- /* Set a default output channel mapping */
- for (e = 0; e < g->od; e++)
- t->im_map[e] = e;
+ /* Compute input read and input table lookup stuff */
+
+ /* Compute number of input pointers */
+ if (g->in.pint != 0) /* Pixel interleaved */
+ f->nip = 1;
+ else
+ f->nip = g->id;
+
+ /* Figure out the input pointer types */
+ for (e = 0; e < f->nip; e++) {
+ if ((f->ipt[e] = findord(f, g->in.bpch[e])) < 0) {
+ fprintf(stderr,"Input channel size can't be handled\n");
+ exit(-1);
+ }
+ }
+
+ /* Set a default input channel mapping */
+ for (e = 0; e < g->id; e++)
+ t->it_map[e] = e;
+
+ /* Do the rest of the input table size calculations after figuring */
+ /* out simplex and interpolation table sizes. */
+
+ /* Figure out the interpolation multi-dimentional table structure */
+ /* and output accumulation variable sizes. */
+
+ if (g->prec == 8
+ || g->prec == 16 && a->ords[a->nords-1].bits >= (g->prec * 4)) {
+ int tiby; /* Total interpolation bytes needed */
+
+ /* We assume that we can normally compute more than one */
+ /* output value at a time, so we need to hold the interpolation */
+ /* output data in the expanded fixed point format in both the */
+ /* table and accumulator. */
+ t->im_cd = 1;
+ f->imovb = g->prec * 2; /* 16 bits needed for 8 bit precision, */
+ f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision */
+ f->imfvt = a->nords-1; /* Full variable entry type is biggest available */
+ f->iafvt = a->nords-1; /* Full variable accum. type is same */
+
+ if (a->ords[f->imfvt].bits < f->imovb) {
+ fprintf(stderr,"Interpolation table entry size can't be handled\n");
+ exit(-1);
+ }
+
+ /* Compute details of table entry sizes, number */
+ tiby = (f->imovb * g->od)/8; /* Total table bytes needed */
+ t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */
+ t->im_fv = (t->im_fs * 8)/f->imovb; /* output values per full entry . */
+ t->im_fn = tiby/t->im_fs; /* Number of full entries (may be 0) */
+ t->im_ts = t->im_fn * t->im_fs; /* Structure size so far */
+ tiby -= t->im_fn * t->im_fs; /* Remaining bytes */
+
+ if (tiby <= 0) {
+ t->im_pn = 0; /* No partials */
+ t->im_ps = 0;
+ t->im_pv = 0;
+ f->impvt = 0;
+ f->iapvt = 0;
+
+ } else {
+ t->im_pn = 1; /* Must be just 1 partial */
+ t->im_pv = (tiby * 8)/f->imovb; /* Partial holds remaining entries */
+
+ if ((f->impvt = findnord(f, tiby * 8)) < 0) {
+ fprintf(stderr,"Can't find partial interp table entry variable size\n");
+ exit(-1);
+ }
+ f->iapvt = f->impvt;
+ t->im_ps = a->ords[f->impvt].bits/8;/* Partial entry bytes */
+
+ if (a->ords[f->imfvt].align) /* If full entry's need to be aligned */
+ t->im_ts += t->im_fs; /* Round out struct size by full entry */
+ else
+ t->im_ts += t->im_ps; /* Round out to natural size */
+ }
+
+ } else {
+ /* One 16 bit output value per entry + 32 bit accumulator. */
+ /* We can conserve table space by not holding the table data in expanded */
+ /* fixed point format, but expanding it when it is read. */
+ /* Without resorting to compicated code, this restricts us */
+ /* to only computing one output value per accumulator. */
+ t->im_cd = 0;
+ f->imovb = g->prec; /* Table holds 16 bit entries with no fractions */
+ f->iaovb = g->prec * 2; /* 32 bits needed for 16 bit precision in comp. */
+
+ if ((f->imfvt = findord(f, f->imovb)) < 0) {
+ fprintf(stderr,"Interpolation table entry size can't be handled\n");
+ exit(-1);
+ }
+ if ((f->iafvt = findord(f, f->iaovb)) < 0) {
+ fprintf(stderr,"Interpolation accumulator size can't be handled\n");
+ exit(-1);
+ }
+
+ /* Compute details of table entry sizes, number */
+ t->im_fs = a->ords[f->imfvt].bits/8; /* Full entry bytes */
+ t->im_fv = 1; /* output values per full entry . */
+ t->im_fn = g->od; /* Number of full entries */
+ t->im_ts = t->im_fn * t->im_fs; /* Total structure size */
+
+ t->im_pn = 0; /* No partials */
+ t->im_ps = 0;
+ t->im_pv = 0;
+ f->impvt = 0;
+ f->iapvt = 0;
+ }
+ f->ian = t->im_fn + t->im_pn; /* Total number of output accumulators */
+
+ /* Figure out how much of the interpolation entry offset to put in the */
+ /* vertex offset value, and how much to make explicit in accessing the */
+ /* interpolation table enty. */
+ if (a->oscale > 0) { /* We have a scaled index mode */
+ /* Use as much of the scaled index mode as possible */
+ /* and then do the balance by scaling the simplex index entry. */
+ for (t->im_oc = a->oscale; ; t->im_oc >>= 1) {
+ t->vo_om = t->im_ts/t->im_oc; /* Simplex index multiplier */
+ if ((t->vo_om * t->im_oc) == t->im_ts)
+ break; /* Got appropriate offset scale */
+ }
+ } else if (a->smmul) { /* Architecure supports fast small multiply */
+ t->im_oc = t->im_ts; /* Do scale by structure size explicitly */
+ t->vo_om = 1; /* Do none in the Simplex index */
+ } else { /* We have no fast tricks */
+ t->im_oc = 1; /* Do none explicitly */
+ t->vo_om = t->im_ts; /* Do all in Simplex index */
+ }
+
+ /* Compute the number of bits needed to hold an index into */
+ /* the interpolation table (index is in terms of table entry size). */
+ /* This value is used to figure out the room needed in the input */
+ /* table to accumulate the interpolation cube base offset value. (IM_O macro) */
+ f->ixmnb = calc_bits(g->id, g->itres);
+
+ /* Set a default output channel mapping */
+ for (e = 0; e < g->od; e++)
+ t->im_map[e] = e;
#ifdef VERBOSE
- /* Summarise the interpolation table arrangements */
- printf("\n");
- printf("Interpolation table structure:\n");
- printf(" Minimum bits needed to index table %d\n", f->ixmnb);
- printf(" Entry total size %d bytes\n", t->im_ts);
- printf(" Simplex entry offset scale %d\n", t->vo_om);
- printf(" Explicit entry offset scale %d\n", t->im_oc);
- printf(" %d full entries, size %d bytes\n", t->im_fn, t->im_fs);
- printf(" %d partial entries, size %d bytes\n", t->im_pn, t->im_ps);
- printf(" to hold %d output values of %d bits\n", g->od, f->imovb);
+ /* Summarise the interpolation table arrangements */
+ printf("\n");
+ printf("Interpolation table structure:\n");
+ printf(" Minimum bits needed to index table %d\n", f->ixmnb);
+ printf(" Entry total size %d bytes\n", t->im_ts);
+ printf(" Simplex entry offset scale %d\n", t->vo_om);
+ printf(" Explicit entry offset scale %d\n", t->im_oc);
+ printf(" %d full entries, size %d bytes\n", t->im_fn, t->im_fs);
+ printf(" %d partial entries, size %d bytes\n", t->im_pn, t->im_ps);
+ printf(" to hold %d output values of %d bits\n", g->od, f->imovb);
#endif /* VERBOSE */
- /* Number of bits needed for the weighting value */
- f->wemnb = g->prec+1; /* Need to hold a weighting factor of 0 - 256 for 8 bits */
- /* Need to hold a weighting factor of 0 - 65536 for 16 bits */
-
- /* Variable that would be used to hold it */
- if ((f->wevt = findnord(f, f->wemnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold weighting variable\n");
- exit(-1);
- }
-
- /* Number of bits needed for vertex offset value */
- f->vomnb = calc_obits(g->id, g->itres, t->vo_om);
-
- /* Variable that would be used to hold it */
- if ((f->vovt = findnord(f, f->vomnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold vertex offset variable\n");
- exit(-1);
- }
-
- if (t->sort) {
- /* If we are using an explicit sort, we need to figure how many */
- /* separate entries we need to use to hold the interpolation index, */
- /* weighting factor and vertex offset values in the input table. */
-
- /* First try all three in one entry */
- if ((f->itet = findord(f, f->ixmnb + f->wemnb + f->vomnb)) >= 0) {/* size to read */
- int rem; /* Remainder bits */
-
- t->it_xs = 0; /* Combined interp+weight+offset */
- t->wo_xs = 0;
- t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */
- rem = t->it_ab - f->ixmnb - f->wemnb - f->vomnb; /* Spair bits */
- t->we_ab = f->wemnb; /* Get minimum weight bits */
- t->vo_ab = f->vomnb + rem/2; /* vertex offset index bits actually available */
- t->ix_ab = t->it_ab - t->vo_ab - t->we_ab; /* interp index bits actually available */
- t->wo_ab = t->we_ab + t->vo_ab; /* Weight & offset total bits */
- t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */
- f->itvt = nord(f, f->itet); /* Variable type */
-
- if ((f->wovt = findnord(f, t->we_ab + t->vo_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold weight/offset\n");
- exit(-1);
- }
- if ((f->wevt = findnord(f, t->we_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold weighting factor\n");
- exit(-1);
- }
- if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
- exit(-1);
- }
- if ((f->ixvt = findnord(f, t->ix_ab)) < 0) {
- fprintf(stderr,"Interp index variable size can't be handled\n");
- exit(-1);
- }
- } else { /* Interp index will be a separate entry */
- int wit, oft, bigt; /* weighting type, offset type, biggest type */
- int combt; /* Combined type */
- int sepbits, combits; /* Total separate, combined bits */
-
- t->it_xs = 1; /* Separate interp index and weighting+offset */
- if ((f->ixet = findord(f, f->ixmnb)) < 0) {
- fprintf(stderr,"Interp index entry size can't be handled\n");
- exit(-1);
- }
- f->ixvt = nord(f, f->ixet); /* Variable type */
- t->ix_ab = a->ords[f->ixet].bits;
- t->ix_es = t->ix_ab/8;
- t->ix_eo = 0;
- t->it_ts = t->ix_es; /* Input table size so far */
-
- /* Now figure weighting and vertex offset */
-
- /* See if we can fit them into separately readable entries, or whether */
- /* they should be combined to minimise overall table size. */
-
- if ((wit = findord(f, f->wemnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold weighting factor\n");
- exit(-1);
- }
- if ((oft = findord(f, f->vomnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold vertex offset index\n");
- exit(-1);
- }
- bigt = wit > oft ? wit : oft; /* Bigest separate type */
-
- if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */
- sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
- combits = sepbits; /* Force separate entries */
- } else {
- sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
- combits = a->ords[combt].bits; /* Total combined bits */
- }
-
- if (sepbits <= combits) { /* We will use separate entries */
- t->wo_xs = 1;
- t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */
- t->we_ab = a->ords[bigt].bits; /* bits available for weighting */
- t->we_eo = t->ix_es; /* Entry offset in input table */
- t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */
- t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */
- t->vo_eo = t->ix_es + t->we_es; /* Entry offset in input table */
- t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */
- t->it_ts += t->we_es + t->vo_es; /* Total input entry size in bytes */
-
- f->weet = bigt; /* Variable type for accessing weighting entry */
- f->voet = bigt; /* Variable type for accessing vertex offset entry */
- f->wevt = nord(f, wit); /* Variable type for holding weight value */
- f->vovt = nord(f, oft); /* Variable type for holding offset value */
-
- } else { /* We will combine the two entries */
- t->wo_xs = 0;
- t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */
- t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */
- t->we_ab = f->wemnb; /* bits available for weighting */
- t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */
- t->wo_eo = t->ix_es; /* entry offset in input table */
- t->it_ts += t->wo_es; /* Final input table size */
-
- f->woet = combt; /* Variable type for accessing combined entry */
- f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */
-
- if ((f->wevt = findnord(f, t->we_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold weighting factor\n");
- exit(-1);
- }
- if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
- exit(-1);
- }
- }
- }
+ /* Number of bits needed for the weighting value */
+ f->wemnb = g->prec+1; /* Need to hold a weighting factor of 0 - 256 for 8 bits */
+ /* Need to hold a weighting factor of 0 - 65536 for 16 bits */
+
+ /* Variable that would be used to hold it */
+ if ((f->wevt = findnord(f, f->wemnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold weighting variable\n");
+ exit(-1);
+ }
+
+ /* Number of bits needed for vertex offset value */
+ f->vomnb = calc_obits(g->id, g->itres, t->vo_om);
+
+ /* Variable that would be used to hold it */
+ if ((f->vovt = findnord(f, f->vomnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold vertex offset variable\n");
+ exit(-1);
+ }
+
+ if (t->sort) {
+ /* If we are using an explicit sort, we need to figure how many */
+ /* separate entries we need to use to hold the interpolation index, */
+ /* weighting factor and vertex offset values in the input table. */
+
+ /* First try all three in one entry */
+ if ((f->itet = findord(f, f->ixmnb + f->wemnb + f->vomnb)) >= 0) {/* size to read */
+ int rem; /* Remainder bits */
+
+ t->it_xs = 0; /* Combined interp+weight+offset */
+ t->wo_xs = 0;
+ t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */
+ rem = t->it_ab - f->ixmnb - f->wemnb - f->vomnb; /* Spair bits */
+ t->we_ab = f->wemnb; /* Get minimum weight bits */
+ t->vo_ab = f->vomnb + rem/2; /* vertex offset index bits actually available */
+ t->ix_ab = t->it_ab - t->vo_ab - t->we_ab; /* interp index bits actually available */
+ t->wo_ab = t->we_ab + t->vo_ab; /* Weight & offset total bits */
+ t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */
+ f->itvt = nord(f, f->itet); /* Variable type */
+
+ if ((f->wovt = findnord(f, t->we_ab + t->vo_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold weight/offset\n");
+ exit(-1);
+ }
+ if ((f->wevt = findnord(f, t->we_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold weighting factor\n");
+ exit(-1);
+ }
+ if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
+ exit(-1);
+ }
+ if ((f->ixvt = findnord(f, t->ix_ab)) < 0) {
+ fprintf(stderr,"Interp index variable size can't be handled\n");
+ exit(-1);
+ }
+ } else { /* Interp index will be a separate entry */
+ int wit, oft, bigt; /* weighting type, offset type, biggest type */
+ int combt; /* Combined type */
+ int sepbits, combits; /* Total separate, combined bits */
+
+ t->it_xs = 1; /* Separate interp index and weighting+offset */
+ if ((f->ixet = findord(f, f->ixmnb)) < 0) {
+ fprintf(stderr,"Interp index entry size can't be handled\n");
+ exit(-1);
+ }
+ f->ixvt = nord(f, f->ixet); /* Variable type */
+ t->ix_ab = a->ords[f->ixet].bits;
+ t->ix_es = t->ix_ab/8;
+ t->ix_eo = 0;
+ t->it_ts = t->ix_es; /* Input table size so far */
+
+ /* Now figure weighting and vertex offset */
+
+ /* See if we can fit them into separately readable entries, or whether */
+ /* they should be combined to minimise overall table size. */
+
+ if ((wit = findord(f, f->wemnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold weighting factor\n");
+ exit(-1);
+ }
+ if ((oft = findord(f, f->vomnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold vertex offset index\n");
+ exit(-1);
+ }
+ bigt = wit > oft ? wit : oft; /* Bigest separate type */
+
+ if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */
+ sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
+ combits = sepbits; /* Force separate entries */
+ } else {
+ sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
+ combits = a->ords[combt].bits; /* Total combined bits */
+ }
+
+ if (sepbits <= combits) { /* We will use separate entries */
+ t->wo_xs = 1;
+ t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */
+ t->we_ab = a->ords[bigt].bits; /* bits available for weighting */
+ t->we_eo = t->ix_es; /* Entry offset in input table */
+ t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */
+ t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */
+ t->vo_eo = t->ix_es + t->we_es; /* Entry offset in input table */
+ t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */
+ t->it_ts += t->we_es + t->vo_es; /* Total input entry size in bytes */
+
+ f->weet = bigt; /* Variable type for accessing weighting entry */
+ f->voet = bigt; /* Variable type for accessing vertex offset entry */
+ f->wevt = nord(f, wit); /* Variable type for holding weight value */
+ f->vovt = nord(f, oft); /* Variable type for holding offset value */
+
+ } else { /* We will combine the two entries */
+ t->wo_xs = 0;
+ t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */
+ t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */
+ t->we_ab = f->wemnb; /* bits available for weighting */
+ t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */
+ t->wo_eo = t->ix_es; /* entry offset in input table */
+ t->it_ts += t->wo_es; /* Final input table size */
+
+ f->woet = combt; /* Variable type for accessing combined entry */
+ f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */
+
+ if ((f->wevt = findnord(f, t->we_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold weighting factor\n");
+ exit(-1);
+ }
+ if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
+ exit(-1);
+ }
+ }
+ }
#ifdef VERBOSE
- /* Summarise the input table arrangements */
- printf("\n");
- printf("Input table structure:\n");
- printf(" Input value re-ordering is [");
- for (e = 0; e < g->id; e++)
- printf("%s%d",e > 0 ? " " : "", t->it_map[e]);
- printf("]\n");
- printf(" Input table entry size = %d bytes\n",t->it_ts);
- if (t->it_ix) {
- printf(" Input table extracts value from read values\n");
- if (t->wo_xs) {
- printf(" Separate Interp., Weighting and Offset values\n");
- printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
- printf(" Weighting is at offset %d, size %d bytes\n",t->we_eo, t->we_es);
- printf(" Vertex offset is at offset %d, size %d bytes\n",t->vo_eo, t->vo_es);
- } else {
- printf(" Separate Interp. index and Weightint+Offset value\n");
- printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
- printf(" Weighting+Offset is at offset %d, size %d bytes\n",t->wo_eo, t->wo_es);
- printf(" Weighting = %d bits\n",t->we_ab);
- printf(" Vertex offset = %d bits\n",t->vo_ab);
- }
- } else {
- printf(" Combined InterpIndex+Weighting+Voffset values\n");
- printf(" Values are stored in size %d bytes\n",t->it_ts);
- printf(" Interp. index = %d bits\n",t->ix_ab);
- printf(" Weighting = %d bits\n",t->we_ab);
- printf(" Vertex offset = %d bits\n",t->vo_ab);
- }
+ /* Summarise the input table arrangements */
+ printf("\n");
+ printf("Input table structure:\n");
+ printf(" Input value re-ordering is [");
+ for (e = 0; e < g->id; e++)
+ printf("%s%d",e > 0 ? " " : "", t->it_map[e]);
+ printf("]\n");
+ printf(" Input table entry size = %d bytes\n",t->it_ts);
+ if (t->it_ix) {
+ printf(" Input table extracts value from read values\n");
+ if (t->wo_xs) {
+ printf(" Separate Interp., Weighting and Offset values\n");
+ printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
+ printf(" Weighting is at offset %d, size %d bytes\n",t->we_eo, t->we_es);
+ printf(" Vertex offset is at offset %d, size %d bytes\n",t->vo_eo, t->vo_es);
+ } else {
+ printf(" Separate Interp. index and Weightint+Offset value\n");
+ printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
+ printf(" Weighting+Offset is at offset %d, size %d bytes\n",t->wo_eo, t->wo_es);
+ printf(" Weighting = %d bits\n",t->we_ab);
+ printf(" Vertex offset = %d bits\n",t->vo_ab);
+ }
+ } else {
+ printf(" Combined InterpIndex+Weighting+Voffset values\n");
+ printf(" Values are stored in size %d bytes\n",t->it_ts);
+ printf(" Interp. index = %d bits\n",t->ix_ab);
+ printf(" Weighting = %d bits\n",t->we_ab);
+ printf(" Vertex offset = %d bits\n",t->vo_ab);
+ }
#endif /* VERBOSE */
- } else { /* Simplex table */
- /* If we are going to use a simplex table, figure out how we */
- /* will store the weighting value and vertex offset values in it, */
- /* as well as the size of index we'll need to address it. */
- int wit, oft, bigt; /* weighting type, offset type, biggest type */
- int combt; /* Combined type */
- int sepbits, combits; /* Total separate, combined bits */
-
- /* See if we can fit them into separately readable entries, or whether */
- /* they should be combined to minimise overall table size. */
-
- if ((wit = findord(f, f->wemnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold weighting factor\n");
- exit(-1);
- }
- if ((oft = findord(f, f->vomnb)) < 0) {
- fprintf(stderr,"Can't find entry size to hold vertex offset index\n");
- exit(-1);
- }
- bigt = wit > oft ? wit : oft; /* Bigest separate type */
-
- if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */
- sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
- combits = sepbits; /* Force separate entries */
- } else {
- sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
- combits = a->ords[combt].bits; /* Total combined bits */
- }
-
- if (sepbits <= combits) { /* We will use separate entries */
- t->wo_xs = 1;
- t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */
- t->we_ab = a->ords[bigt].bits; /* bits available for weighting */
- t->we_eo = 0; /* Entry offset in simplex table */
- t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */
- t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */
- t->vo_eo = t->we_es; /* Entry offset in simplex table */
- t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */
- t->sm_ts = (g->id + 1) * (t->we_es + t->vo_es) ; /* Total size in bytes */
-
- f->weet = bigt; /* Variable type for accessing weighting entry */
- f->voet = bigt; /* Variable type for accessing vertex offset entry */
- f->wevt = nord(f, wit); /* Variable type for holding weight value */
- f->vovt = nord(f, oft); /* Variable type for holding offset value */
-
- } else { /* We will combine the two entries */
- t->wo_xs = 0;
- t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */
- t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */
- t->we_ab = f->wemnb; /* bits available for weighting */
- t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */
- t->wo_eo = 0; /* entry offset in simplex table */
- t->sm_ts = (g->id + 1) * t->wo_es; /* Total size in bytes */
-
- f->woet = combt; /* Variable type for accessing combined entry */
- f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */
-
- if ((f->wevt = findnord(f, t->we_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold weighting factor\n");
- exit(-1);
- }
- if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
- fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
- exit(-1);
- }
- }
-
- /* Compute the number of bits needed to hold an index into */
- /* the simplex table (index is in terms of table entry size). */
- /* This value is used to figure out the room needed in the input */
- /* table to accumulate the simplex cube base offset value. (SW_O macro) */
- f->sxmnb = calc_bits(g->id, g->stres);
+ } else { /* Simplex table */
+ /* If we are going to use a simplex table, figure out how we */
+ /* will store the weighting value and vertex offset values in it, */
+ /* as well as the size of index we'll need to address it. */
+ int wit, oft, bigt; /* weighting type, offset type, biggest type */
+ int combt; /* Combined type */
+ int sepbits, combits; /* Total separate, combined bits */
+
+ /* See if we can fit them into separately readable entries, or whether */
+ /* they should be combined to minimise overall table size. */
+
+ if ((wit = findord(f, f->wemnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold weighting factor\n");
+ exit(-1);
+ }
+ if ((oft = findord(f, f->vomnb)) < 0) {
+ fprintf(stderr,"Can't find entry size to hold vertex offset index\n");
+ exit(-1);
+ }
+ bigt = wit > oft ? wit : oft; /* Bigest separate type */
+
+ if ((combt = findord(f, f->wemnb + f->vomnb)) < 0) {/* Combined isn't possible */
+ sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
+ combits = sepbits; /* Force separate entries */
+ } else {
+ sepbits = 2 * a->ords[bigt].bits; /* Total separate bits */
+ combits = a->ords[combt].bits; /* Total combined bits */
+ }
+
+ if (sepbits <= combits) { /* We will use separate entries */
+ t->wo_xs = 1;
+ t->we_es = a->ords[bigt].bits/8; /* size in bytes for weighting entry */
+ t->we_ab = a->ords[bigt].bits; /* bits available for weighting */
+ t->we_eo = 0; /* Entry offset in simplex table */
+ t->vo_es = a->ords[bigt].bits/8; /* size in bytes for vertex offset entry */
+ t->vo_ab = a->ords[bigt].bits; /* bits available for vertex offset */
+ t->vo_eo = t->we_es; /* Entry offset in simplex table */
+ t->wo_es = t->we_es + t->vo_es; /* Total entry size for each vertex */
+ t->sm_ts = (g->id + 1) * (t->we_es + t->vo_es) ; /* Total size in bytes */
+
+ f->weet = bigt; /* Variable type for accessing weighting entry */
+ f->voet = bigt; /* Variable type for accessing vertex offset entry */
+ f->wevt = nord(f, wit); /* Variable type for holding weight value */
+ f->vovt = nord(f, oft); /* Variable type for holding offset value */
+
+ } else { /* We will combine the two entries */
+ t->wo_xs = 0;
+ t->wo_es = a->ords[combt].bits/8; /* entry size in bytes for each entry */
+ t->wo_ab = a->ords[combt].bits; /* bits in weightig + offset */
+ t->we_ab = f->wemnb; /* bits available for weighting */
+ t->vo_ab = t->wo_ab - t->we_ab; /* Allow all spare bits to vertex offset */
+ t->wo_eo = 0; /* entry offset in simplex table */
+ t->sm_ts = (g->id + 1) * t->wo_es; /* Total size in bytes */
+
+ f->woet = combt; /* Variable type for accessing combined entry */
+ f->wovt = nord(f, combt); /* Variable type holding weight/offset read value */
+
+ if ((f->wevt = findnord(f, t->we_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold weighting factor\n");
+ exit(-1);
+ }
+ if ((f->vovt = findnord(f, t->vo_ab)) < 0) {
+ fprintf(stderr,"Can't find variable size to hold vertex offset index\n");
+ exit(-1);
+ }
+ }
+
+ /* Compute the number of bits needed to hold an index into */
+ /* the simplex table (index is in terms of table entry size). */
+ /* This value is used to figure out the room needed in the input */
+ /* table to accumulate the simplex cube base offset value. (SW_O macro) */
+ f->sxmnb = calc_bits(g->id, g->stres);
#ifdef VERBOSE
- /* Summarise the simplex table arrangements */
- printf("\n");
- printf("Simplex table structure:\n");
- printf(" Minimum bits needed to index table %d\n", f->sxmnb);
- printf(" Total simplex entry size %d bytes to hold %d entries\n",t->sm_ts, g->id+1);
- if (t->wo_xs) {
- printf(" Separate entries for offset and weight\n");
- printf(" Weighting entry size %d bytes\n",t->we_es);
- printf(" Offset entry size %d bytes\n",t->vo_es);
- } else {
- printf(" Combined offset and weight entries in %d bytes\n",t->wo_es);
- printf(" Weighting entry size %d bits\n",t->we_ab);
- printf(" Offset entry size %d bits\n",t->vo_ab);
- }
- printf(" Vertex offset scale factor %d\n", t->vo_om);
+ /* Summarise the simplex table arrangements */
+ printf("\n");
+ printf("Simplex table structure:\n");
+ printf(" Minimum bits needed to index table %d\n", f->sxmnb);
+ printf(" Total simplex entry size %d bytes to hold %d entries\n",t->sm_ts, g->id+1);
+ if (t->wo_xs) {
+ printf(" Separate entries for offset and weight\n");
+ printf(" Weighting entry size %d bytes\n",t->we_es);
+ printf(" Offset entry size %d bytes\n",t->vo_es);
+ } else {
+ printf(" Combined offset and weight entries in %d bytes\n",t->wo_es);
+ printf(" Weighting entry size %d bits\n",t->we_ab);
+ printf(" Offset entry size %d bits\n",t->vo_ab);
+ }
+ printf(" Vertex offset scale factor %d\n", t->vo_om);
#endif /* VERBOSE */
- /* We known how big the interpolation and simplex */
- /* tables indexes are going to be, so complete figuring out */
- /* how big the input table entries have to be. */
- if ((f->itet = findord(f, f->sxmnb + f->ixmnb)) >= 0) {/* size to read */
- int rem; /* Remainder bits */
-
- t->it_xs = 0; /* Combined simplex+interp index */
-
- t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */
- rem = t->it_ab - f->sxmnb - f->ixmnb;
- t->sx_ab = f->sxmnb + rem/2; /* simplex index bits actually available */
- t->ix_ab = t->it_ab - t->sx_ab; /* interp index bits actually available */
- t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */
- f->itvt = nord(f, f->itet); /* Variable type */
-
- if ((f->sxvt = findnord(f, t->sx_ab)) < 0) {
- fprintf(stderr,"Simplex index variable size can't be handled\n");
- exit(-1);
- }
- if ((f->ixvt = findnord(f, t->ix_ab)) < 0) {
- fprintf(stderr,"Interp index variable size can't be handled\n");
- exit(-1);
- }
- } else { /* Separate entries */
- int bbits; /* Largest number of bits needed */
-
- t->it_xs = 1; /* Separate simplex+interp indexes */
- bbits = f->sxmnb > f->ixmnb ? f->sxmnb : f->ixmnb;
-
- /* Allocate same size for both so that total structure size is power of 2 */
- if ((f->sxet = f->ixet = findord(f, bbits)) < 0) {
- fprintf(stderr,"Interp/Simplex index entry size can't be handled\n");
- exit(-1);
- }
-
- t->sx_ab = a->ords[f->sxet].bits; /* Actual bits available */
- t->sx_es = t->sx_ab/8; /* Entry size in bytes */
- t->ix_ab = a->ords[f->ixet].bits;
- t->ix_es = t->sx_ab/8;
- t->it_ts = t->sx_es + t->ix_es; /* total size in bytes */
- t->sx_eo = 0; /* simplex index offset in bytes */
- t->ix_eo = t->sx_es; /* interp. index offset in bytes */
- f->sxvt = nord(f, f->sxet); /* Variable type */
- f->ixvt = nord(f, f->ixet); /* Variable type */
- }
+ /* We known how big the interpolation and simplex */
+ /* tables indexes are going to be, so complete figuring out */
+ /* how big the input table entries have to be. */
+ if ((f->itet = findord(f, f->sxmnb + f->ixmnb)) >= 0) {/* size to read */
+ int rem; /* Remainder bits */
+
+ t->it_xs = 0; /* Combined simplex+interp index */
+
+ t->it_ab = a->ords[f->itet].bits; /* Bits in combined input entry */
+ rem = t->it_ab - f->sxmnb - f->ixmnb;
+ t->sx_ab = f->sxmnb + rem/2; /* simplex index bits actually available */
+ t->ix_ab = t->it_ab - t->sx_ab; /* interp index bits actually available */
+ t->it_ts = a->ords[f->itet].bits/8; /* total size in bytes */
+ f->itvt = nord(f, f->itet); /* Variable type */
+
+ if ((f->sxvt = findnord(f, t->sx_ab)) < 0) {
+ fprintf(stderr,"Simplex index variable size can't be handled\n");
+ exit(-1);
+ }
+ if ((f->ixvt = findnord(f, t->ix_ab)) < 0) {
+ fprintf(stderr,"Interp index variable size can't be handled\n");
+ exit(-1);
+ }
+ } else { /* Separate entries */
+ int bbits; /* Largest number of bits needed */
+
+ t->it_xs = 1; /* Separate simplex+interp indexes */
+ bbits = f->sxmnb > f->ixmnb ? f->sxmnb : f->ixmnb;
+
+ /* Allocate same size for both so that total structure size is power of 2 */
+ if ((f->sxet = f->ixet = findord(f, bbits)) < 0) {
+ fprintf(stderr,"Interp/Simplex index entry size can't be handled\n");
+ exit(-1);
+ }
+
+ t->sx_ab = a->ords[f->sxet].bits; /* Actual bits available */
+ t->sx_es = t->sx_ab/8; /* Entry size in bytes */
+ t->ix_ab = a->ords[f->ixet].bits;
+ t->ix_es = t->sx_ab/8;
+ t->it_ts = t->sx_es + t->ix_es; /* total size in bytes */
+ t->sx_eo = 0; /* simplex index offset in bytes */
+ t->ix_eo = t->sx_es; /* interp. index offset in bytes */
+ f->sxvt = nord(f, f->sxet); /* Variable type */
+ f->ixvt = nord(f, f->ixet); /* Variable type */
+ }
#ifdef VERBOSE
- /* Summarise the input table arrangements */
- printf("\n");
- printf("Input table structure:\n");
- if (t->it_ix) {
- printf(" Input table extracts value from read values\n");
- } else {
- printf(" Value extraction read values is explicit\n");
- }
- printf(" Input value re-ordering is [");
- for (e = 0; e < g->id; e++)
- printf("%s%d",e > 0 ? " " : "", t->it_map[e]);
- printf("]\n");
- printf(" Input table entry size = %d bytes\n",t->it_ts);
- if (t->it_xs) {
- printf(" Separate Interp. and Simplex index values\n");
- printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
- printf(" Simplex index is at offset %d, size %d bytes\n",t->sx_eo, t->sx_es);
- } else {
- printf(" Combined Interp. and Simplex index values\n");
- printf(" Values are size %d bytes\n",t->it_ts);
- printf(" Interp. index = %d bits\n",t->ix_ab);
- printf(" Simplex index = %d bits\n",t->sx_ab);
- }
+ /* Summarise the input table arrangements */
+ printf("\n");
+ printf("Input table structure:\n");
+ if (t->it_ix) {
+ printf(" Input table extracts value from read values\n");
+ } else {
+ printf(" Value extraction read values is explicit\n");
+ }
+ printf(" Input value re-ordering is [");
+ for (e = 0; e < g->id; e++)
+ printf("%s%d",e > 0 ? " " : "", t->it_map[e]);
+ printf("]\n");
+ printf(" Input table entry size = %d bytes\n",t->it_ts);
+ if (t->it_xs) {
+ printf(" Separate Interp. and Simplex index values\n");
+ printf(" Interp. index is at offset %d, size %d bytes\n",t->ix_eo, t->ix_es);
+ printf(" Simplex index is at offset %d, size %d bytes\n",t->sx_eo, t->sx_es);
+ } else {
+ printf(" Combined Interp. and Simplex index values\n");
+ printf(" Values are size %d bytes\n",t->it_ts);
+ printf(" Interp. index = %d bits\n",t->ix_ab);
+ printf(" Simplex index = %d bits\n",t->sx_ab);
+ }
#endif /* VERBOSE */
- }
-
- /* Figure out output table stuff */
- {
- /* A variable to hold the index into an output table */
- if ((f->otit = findord(f, g->prec)) < 0) {
- fprintf(stderr,"Can't find output table index size\n");
- exit(-1);
- }
- f->otit = nord(f,f->otit); /* Make temp variable natural size */
-
- if (g->out.pint != 0) /* Pixel interleaved */
- f->nop = 1;
- else
- f->nop = g->od;
-
- /* Figure out the output pointer types */
- f->otvt = 0; /* Output table value type */
- for (e = 0; e < f->nop; e++) {
- if ((f->opt[e] = findord(f, g->out.bpch[e])) < 0) {
- fprintf(stderr,"Output channel size can't be handled\n");
- exit(-1);
- }
- if (f->opt[e] > f->otvt)
- f->otvt = f->opt[e]; /* Make value type big enough for any channel size */
- }
- t->ot_ts = a->ords[f->otvt].bits/8; /* Output table entry size in bytes */
-
- /* Setup information on data placement in output table enries */
- for (e = 0; e < g->od; e++) {
- t->ot_off[e] = g->out.bov[e]; /* Transfer info from generation spec. */
- t->ot_bits[e] = g->out.bpv[e];
- }
- }
+ }
+
+ /* Figure out output table stuff */
+ {
+ /* A variable to hold the index into an output table */
+ if ((f->otit = findord(f, g->prec)) < 0) {
+ fprintf(stderr,"Can't find output table index size\n");
+ exit(-1);
+ }
+ f->otit = nord(f,f->otit); /* Make temp variable natural size */
+
+ if (g->out.pint != 0) /* Pixel interleaved */
+ f->nop = 1;
+ else
+ f->nop = g->od;
+
+ /* Figure out the output pointer types */
+ f->otvt = 0; /* Output table value type */
+ for (e = 0; e < f->nop; e++) {
+ if ((f->opt[e] = findord(f, g->out.bpch[e])) < 0) {
+ fprintf(stderr,"Output channel size can't be handled\n");
+ exit(-1);
+ }
+ if (f->opt[e] > f->otvt)
+ f->otvt = f->opt[e]; /* Make value type big enough for any channel size */
+ }
+ t->ot_ts = a->ords[f->otvt].bits/8; /* Output table entry size in bytes */
+
+ /* Setup information on data placement in output table enries */
+ for (e = 0; e < g->od; e++) {
+ t->ot_off[e] = g->out.bov[e]; /* Transfer info from generation spec. */
+ t->ot_bits[e] = g->out.bpv[e];
+ }
+ }
#ifdef VERBOSE
- /* Summarise the output table arrangements */
- printf(" Output value re-ordering is [");
- for (e = 0; e < g->od; e++)
- printf("%s%d",e > 0 ? " " : "", t->im_map[e]);
- printf("]\n");
- printf("\n");
-
- printf("Output table structure:\n");
- printf(" Entry size = %d bytes\n",t->ot_ts);
- printf(" Output value placement within each enry is:\n");
- for (e = 0; e < f->nop; e++) {
- printf(" %d: Offset %d bits, size %d bits\n", e, t->ot_off[e], t->ot_bits[e]);
- }
+ /* Summarise the output table arrangements */
+ printf(" Output value re-ordering is [");
+ for (e = 0; e < g->od; e++)
+ printf("%s%d",e > 0 ? " " : "", t->im_map[e]);
+ printf("]\n");
+ printf("\n");
+
+ printf("Output table structure:\n");
+ printf(" Entry size = %d bytes\n",t->ot_ts);
+ printf(" Output value placement within each enry is:\n");
+ for (e = 0; e < f->nop; e++) {
+ printf(" %d: Offset %d bits, size %d bits\n", e, t->ot_off[e], t->ot_bits[e]);
+ }
#endif /* VERBOSE */
- /* Compute the maximum interpolation table resolution we will be able to handle */
- {
- int res, ores;
+ /* Compute the maximum interpolation table resolution we will be able to handle */
+ {
+ int res, ores;
- res = calc_res(g->id, t->ix_ab);
- ores = calc_ores(g->id, t->vo_ab, t->vo_om);
- f->ixmxres = res < ores ? res : ores;
- }
+ res = calc_res(g->id, t->ix_ab);
+ ores = calc_ores(g->id, t->vo_ab, t->vo_om);
+ f->ixmxres = res < ores ? res : ores;
+ }
- /* Compute the maximum simplex table resolution we will be able to handle */
- if (t->sort) {
- f->sxmxres = 0;
- } else {
- f->sxmxres = calc_res(g->id, t->sx_ab);
- }
+ /* Compute the maximum simplex table resolution we will be able to handle */
+ if (t->sort) {
+ f->sxmxres = 0;
+ } else {
+ f->sxmxres = calc_res(g->id, t->sx_ab);
+ }
#ifdef VERBOSE
- printf("Emitting introductory code\n"); fflush(stdout);
+ printf("Emitting introductory code\n"); fflush(stdout);
#endif /* VERBOSE */
- /* Start of code generation */
- doheader(f); /* Output the header comments */
+ /* Start of code generation */
+ doheader(f); /* Output the header comments */
- /* We need an include file */
- line(f,"#ifndef IMDI_INCLUDED");
- line(f,"#include <memory.h>");
- line(f,"#include \"imdi_imp.h\"");
- line(f,"#define IMDI_INCLUDED");
- line(f,"#endif /* IMDI_INCLUDED */");
- cr(f);
+ /* We need an include file */
+ line(f,"#ifndef IMDI_INCLUDED");
+ line(f,"#include <memory.h>");
+ line(f,"#include \"imdi_imp.h\"");
+ line(f,"#define IMDI_INCLUDED");
+ line(f,"#endif /* IMDI_INCLUDED */");
+ cr(f);
- /* Declare our explicit pointer type */
- line(f,"#ifndef DEFINED_pointer");
- line(f,"#define DEFINED_pointer");
- line(f,"typedef unsigned char * pointer;");
- line(f,"#endif");
- cr(f);
+ /* Declare our explicit pointer type */
+ line(f,"#ifndef DEFINED_pointer");
+ line(f,"#define DEFINED_pointer");
+ line(f,"typedef unsigned char * pointer;");
+ line(f,"#endif");
+ cr(f);
- /* Declare our explicit structure access macros */
+ /* Declare our explicit structure access macros */
#ifdef VERBOSE
- printf("Declaring macros\n"); fflush(stdout);
+ printf("Declaring macros\n"); fflush(stdout);
#endif /* VERBOSE */
- /* Macros for accessing input table entries */
- if (t->sort) {
- if (t->it_xs) {
- line(f,"/* Input table interp. index */");
- line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->ixet].name, t->ix_eo, t->it_ts);
- cr(f);
- if (t->wo_xs) {
- line(f,"/* Input table input weighting enty */");
- line(f,"#define IT_WE(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->weet].name, t->we_eo, t->it_ts);
- cr(f);
- line(f,"/* Input table input offset value enty */");
- line(f,"#define IT_VO(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->voet].name, t->vo_eo, t->it_ts);
- cr(f);
- } else {
- line(f,"/* Input table input weighting/offset value enty */");
- line(f,"#define IT_WO(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->woet].name, t->wo_eo, t->it_ts);
- cr(f);
- }
- } else {
- line(f,"/* Input table interp index, weighting and vertex offset */");
- line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->itet].name, 0, t->it_ts);
- cr(f);
- }
-
- /* Macro to conditionally exchange two varibles */
- /* Doing this in place using an xor seems to be fastest */
- /* on most architectures. */
- line(f,"/* Conditional exchange for sorting */");
- if (t->wo_xs) {
- line(f,"#define CEX(A, AA, B, BB) if (A < B) { \\");
- line(f," A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; }");
- } else
- line(f,"#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; }");
- cr(f);
-
- } else { /* Simplex table */
- if (t->it_xs) {
- line(f,"/* Input table interp. index */");
- line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->ixet].name, t->ix_eo, t->it_ts);
- cr(f);
- line(f,"/* Input table simplex index enty */");
- line(f,"#define IT_SX(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->sxet].name, t->sx_eo, t->it_ts);
- cr(f);
- } else {
- line(f,"/* Input table inter & simplex indexes */");
- line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))",
- a->ords[f->itet].name, 0, t->it_ts);
- cr(f);
- }
- }
-
- if (!t->sort) {
- /* Macro for computing a simplex table entry */
- line(f,"/* Simplex weighting table access */");
- line(f,"#define SW_O(off) ((off) * %d)", t->sm_ts);
- cr(f);
-
- /* Macros for accessing the contents of the simplex table */
- if (t->wo_xs) { /* If separate */
- line(f,"/* Simplex table - get weighting value */");
- line(f,"#define SX_WE(p, v) *((%s *)((p) + (v) * %d + %d))",
- a->ords[f->weet].name, t->wo_es, t->we_eo);
- cr(f);
-
- line(f,"/* Simplex table - get offset value */");
- line(f,"#define SX_VO(p, v) *((%s *)((p) + (v) * %d + %d))",
- a->ords[f->voet].name, t->wo_es, t->vo_eo);
- cr(f);
-
- } else { /* Combined */
- line(f,"/* Simplex table - get weighting/offset value */");
- line(f,"#define SX_WO(p, v) *((%s *)((p) + (v) * %d))",
- a->ords[f->woet].name, t->wo_es);
- cr(f);
- }
- }
-
- /* Macro for computing an interpolation table entry */
- line(f,"/* Interpolation multi-dim. table access */");
- line(f,"#define IM_O(off) ((off) * %d)", t->im_ts);
- cr(f);
-
- /* Macro for accessing an entry in the interpolation table */
- line(f,"/* Interpolation table - get vertex values */");
-
- if (t->im_fn > 0) {
- /* Arguments to macro are cell base address, vertex offset, data offset */
-
- if (f->imfvt == f->iafvt) { /* Table and accumulator are the same size */
- if (!timp || t->im_fn == 1)
- line(f,"#define IM_FE(p, v, c) *((%s *)((p) + (v) * %d + (c) * %d))",
- a->ords[f->imfvt].name, t->im_oc, t->im_fs);
- else {
- line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc);
- line(f,"#define IM_FE(p, c) *((%s *)((p) + (c) * %d))",
- a->ords[f->imfvt].name, t->im_fs);
- }
- } else { /* Expand single table entry to accumulator size */
- if (!timp || t->im_fn == 1)
- line(f,"#define IM_FE(p, v, c) ((%s)*((%s *)((p) + (v) * %d + (c) * %d)))",
- a->ords[f->iafvt].name,
- a->ords[f->imfvt].name, t->im_oc, t->im_fs);
- else {
- line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc);
- line(f,"#define IM_FE(p, c) ((%s)*((%s *)((p) + (c) * %d)))",
- a->ords[f->iafvt].name,
- a->ords[f->imfvt].name, t->im_fs);
- }
- }
- }
- if (t->im_pn > 0) {
- /* Arguments to macro are cell base address, vertex offset */
- /* There is no data offset since there can be only be one partial entry */
-
- if (f->imfvt == f->iafvt) /* Table and accumulator are the same size */
- line(f,"#define IM_PE(p, v) *((%s *)((p) + %d + (v) * %d))",
- a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc);
- else /* Expand single table entry to accumulator size */
- line(f,"#define IM_PE(p, v) ((%s)*((%s *)((p) + %d + (v) * %d)))",
- a->ords[f->iafvt].name,
- a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc);
- }
- cr(f);
-
- /* Macro for accessing an output table entry */
- line(f,"/* Output table indexes */");
- line(f,"#define OT_E(p, off) *((%s *)((p) + (off) * %d))",
- a->ords[f->otvt].name, t->ot_ts);
- cr(f);
-
- /* =============================================== */
+ /* Macros for accessing input table entries */
+ if (t->sort) {
+ if (t->it_xs) {
+ line(f,"/* Input table interp. index */");
+ line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->ixet].name, t->ix_eo, t->it_ts);
+ cr(f);
+ if (t->wo_xs) {
+ line(f,"/* Input table input weighting enty */");
+ line(f,"#define IT_WE(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->weet].name, t->we_eo, t->it_ts);
+ cr(f);
+ line(f,"/* Input table input offset value enty */");
+ line(f,"#define IT_VO(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->voet].name, t->vo_eo, t->it_ts);
+ cr(f);
+ } else {
+ line(f,"/* Input table input weighting/offset value enty */");
+ line(f,"#define IT_WO(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->woet].name, t->wo_eo, t->it_ts);
+ cr(f);
+ }
+ } else {
+ line(f,"/* Input table interp index, weighting and vertex offset */");
+ line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->itet].name, 0, t->it_ts);
+ cr(f);
+ }
+
+ /* Macro to conditionally exchange two varibles */
+ /* Doing this in place using an xor seems to be fastest */
+ /* on most architectures. */
+ line(f,"/* Conditional exchange for sorting */");
+ if (t->wo_xs) {
+ line(f,"#define CEX(A, AA, B, BB) if (A < B) { \\");
+ line(f," A ^= B; B ^= A; A ^= B; AA ^= BB; BB ^= AA; AA ^= BB; }");
+ } else
+ line(f,"#define CEX(A, B) if (A < B) { A ^= B; B ^= A; A ^= B; }");
+ cr(f);
+
+ } else { /* Simplex table */
+ if (t->it_xs) {
+ line(f,"/* Input table interp. index */");
+ line(f,"#define IT_IX(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->ixet].name, t->ix_eo, t->it_ts);
+ cr(f);
+ line(f,"/* Input table simplex index enty */");
+ line(f,"#define IT_SX(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->sxet].name, t->sx_eo, t->it_ts);
+ cr(f);
+ } else {
+ line(f,"/* Input table inter & simplex indexes */");
+ line(f,"#define IT_IT(p, off) *((%s *)((p) + %d + (off) * %d))",
+ a->ords[f->itet].name, 0, t->it_ts);
+ cr(f);
+ }
+ }
+
+ if (!t->sort) {
+ /* Macro for computing a simplex table entry */
+ line(f,"/* Simplex weighting table access */");
+ line(f,"#define SW_O(off) ((off) * %d)", t->sm_ts);
+ cr(f);
+
+ /* Macros for accessing the contents of the simplex table */
+ if (t->wo_xs) { /* If separate */
+ line(f,"/* Simplex table - get weighting value */");
+ line(f,"#define SX_WE(p, v) *((%s *)((p) + (v) * %d + %d))",
+ a->ords[f->weet].name, t->wo_es, t->we_eo);
+ cr(f);
+
+ line(f,"/* Simplex table - get offset value */");
+ line(f,"#define SX_VO(p, v) *((%s *)((p) + (v) * %d + %d))",
+ a->ords[f->voet].name, t->wo_es, t->vo_eo);
+ cr(f);
+
+ } else { /* Combined */
+ line(f,"/* Simplex table - get weighting/offset value */");
+ line(f,"#define SX_WO(p, v) *((%s *)((p) + (v) * %d))",
+ a->ords[f->woet].name, t->wo_es);
+ cr(f);
+ }
+ }
+
+ /* Macro for computing an interpolation table entry */
+ line(f,"/* Interpolation multi-dim. table access */");
+ line(f,"#define IM_O(off) ((off) * %d)", t->im_ts);
+ cr(f);
+
+ /* Macro for accessing an entry in the interpolation table */
+ line(f,"/* Interpolation table - get vertex values */");
+
+ if (t->im_fn > 0) {
+ /* Arguments to macro are cell base address, vertex offset, data offset */
+
+ if (f->imfvt == f->iafvt) { /* Table and accumulator are the same size */
+ if (!timp || t->im_fn == 1)
+ line(f,"#define IM_FE(p, v, c) *((%s *)((p) + (v) * %d + (c) * %d))",
+ a->ords[f->imfvt].name, t->im_oc, t->im_fs);
+ else {
+ line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc);
+ line(f,"#define IM_FE(p, c) *((%s *)((p) + (c) * %d))",
+ a->ords[f->imfvt].name, t->im_fs);
+ }
+ } else { /* Expand single table entry to accumulator size */
+ if (!timp || t->im_fn == 1)
+ line(f,"#define IM_FE(p, v, c) ((%s)*((%s *)((p) + (v) * %d + (c) * %d)))",
+ a->ords[f->iafvt].name,
+ a->ords[f->imfvt].name, t->im_oc, t->im_fs);
+ else {
+ line(f,"#define IM_TP(p, v) ((p) + (v) * %d)", t->im_oc);
+ line(f,"#define IM_FE(p, c) ((%s)*((%s *)((p) + (c) * %d)))",
+ a->ords[f->iafvt].name,
+ a->ords[f->imfvt].name, t->im_fs);
+ }
+ }
+ }
+ if (t->im_pn > 0) {
+ /* Arguments to macro are cell base address, vertex offset */
+ /* There is no data offset since there can be only be one partial entry */
+
+ if (f->imfvt == f->iafvt) /* Table and accumulator are the same size */
+ line(f,"#define IM_PE(p, v) *((%s *)((p) + %d + (v) * %d))",
+ a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc);
+ else /* Expand single table entry to accumulator size */
+ line(f,"#define IM_PE(p, v) ((%s)*((%s *)((p) + %d + (v) * %d)))",
+ a->ords[f->iafvt].name,
+ a->ords[f->impvt].name, t->im_fn * t->im_fs, t->im_oc);
+ }
+ cr(f);
+
+ /* Macro for accessing an output table entry */
+ line(f,"/* Output table indexes */");
+ line(f,"#define OT_E(p, off) *((%s *)((p) + (off) * %d))",
+ a->ords[f->otvt].name, t->ot_ts);
+ cr(f);
+
+ /* =============================================== */
#ifdef VERBOSE
- printf("Starting interpolation function\n"); fflush(stdout);
+ printf("Starting interpolation function\n"); fflush(stdout);
#endif /* VERBOSE */
- /* Declare the function */
- line(f,"static void");
- line(f, "imdi_k%d(",index);
- line(f, "imdi *s, /* imdi context */");
- line(f, "void **outp, /* pointer to output pointers */");
- line(f, "void **inp, /* pointer to input pointers */");
- line(f, "unsigned int npix /* Number of pixels to process */");
- line(f, ") {");
- inc(f);
-
- /* We need access to the imdi_imp */
- line(f, "imdi_imp *p = (imdi_imp *)(s->impl);");
-
- /* Declare the input pointers and init them */
- for (e = 0; e < f->nip; e++) {
- line(f, "%s *ip%d = (%s *)inp[%d];",
- a->ords[f->ipt[e]].name, e, a->ords[f->ipt[e]].name, e);
- }
-
- /* Declare the output pointers and init them */
- for (e = 0; e < f->nop; e++) {
- line(f, "%s *op%d = (%s *)outp[%d];",
- a->ords[f->opt[e]].name, e, a->ords[f->opt[e]].name, e);
- }
-
- /* Declare and intialise the end pointer */
- line(f, "%s *ep = ip0 + npix * %d ;",
- a->ords[f->ipt[0]].name, g->in.chi[0]);
-
- /* Declare and initialise the input table pointers */
- for (e = 0; e < g->id; e++)
- line(f,"pointer it%d = (pointer)p->in_tables[%d];",e,e);
-
- /* Declare and initialise the output table pointers */
- for (e = 0; e < g->od; e++)
- line(f,"pointer ot%d = (pointer)p->out_tables[%d];",e,e);
-
- if (!t->sort) {
- /* Declare and initialise the Simplex weighting base pointer */
- line(f,"pointer sw_base = (pointer)p->sw_table;");
- }
-
- /* Declare and initialise the Interpolation multidim base pointer */
- line(f,"pointer im_base = (pointer)p->im_table;");
-
- /* Figure out whether input channel reads can be used directly as table offsets */
- t->it_ix = 1; /* Default use input table lookup to extract value */
-
- if (g->in.packed != 0)
- t->it_ix = 0; /* Extract will be done explicitly */
-
- for (e = 0; e < g->id; e++) {
- int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */
-
- if ((g->in.bov[e] + g->in.bpv[e]) <= 12)
- continue; /* Table can do extract */
-
- if (g->in.bov[e] != 0 || g->in.bpv[e] != g->in.bpch[ee]) {
- t->it_ix = 0; /* Extract will be done explicitly */
- break;
- }
- }
-
- /* ------------------------------- */
+ /* Declare the function */
+ line(f,"static void");
+ line(f, "imdi_k%d(",index);
+ line(f, "imdi *s, /* imdi context */");
+ line(f, "void **outp, /* pointer to output pointers */");
+ line(f, "void **inp, /* pointer to input pointers */");
+ line(f, "unsigned int npix /* Number of pixels to process */");
+ line(f, ") {");
+ inc(f);
+
+ /* We need access to the imdi_imp */
+ line(f, "imdi_imp *p = (imdi_imp *)(s->impl);");
+
+ /* Declare the input pointers and init them */
+ for (e = 0; e < f->nip; e++) {
+ line(f, "%s *ip%d = (%s *)inp[%d];",
+ a->ords[f->ipt[e]].name, e, a->ords[f->ipt[e]].name, e);
+ }
+
+ /* Declare the output pointers and init them */
+ for (e = 0; e < f->nop; e++) {
+ line(f, "%s *op%d = (%s *)outp[%d];",
+ a->ords[f->opt[e]].name, e, a->ords[f->opt[e]].name, e);
+ }
+
+ /* Declare and intialise the end pointer */
+ line(f, "%s *ep = ip0 + npix * %d ;",
+ a->ords[f->ipt[0]].name, g->in.chi[0]);
+
+ /* Declare and initialise the input table pointers */
+ for (e = 0; e < g->id; e++)
+ line(f,"pointer it%d = (pointer)p->in_tables[%d];",e,e);
+
+ /* Declare and initialise the output table pointers */
+ for (e = 0; e < g->od; e++)
+ line(f,"pointer ot%d = (pointer)p->out_tables[%d];",e,e);
+
+ if (!t->sort) {
+ /* Declare and initialise the Simplex weighting base pointer */
+ line(f,"pointer sw_base = (pointer)p->sw_table;");
+ }
+
+ /* Declare and initialise the Interpolation multidim base pointer */
+ line(f,"pointer im_base = (pointer)p->im_table;");
+
+ /* Figure out whether input channel reads can be used directly as table offsets */
+ t->it_ix = 1; /* Default use input table lookup to extract value */
+
+ if (g->in.packed != 0)
+ t->it_ix = 0; /* Extract will be done explicitly */
+
+ for (e = 0; e < g->id; e++) {
+ int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */
+
+ if ((g->in.bov[e] + g->in.bpv[e]) <= 12)
+ continue; /* Table can do extract */
+
+ if (g->in.bov[e] != 0 || g->in.bpv[e] != g->in.bpch[ee]) {
+ t->it_ix = 0; /* Extract will be done explicitly */
+ break;
+ }
+ }
+
+ /* ------------------------------- */
#ifdef VERBOSE
- printf("Starting pixel processing loop\n"); fflush(stdout);
+ printf("Starting pixel processing loop\n"); fflush(stdout);
#endif /* VERBOSE */
- /* Start the pixel processing loop */
- cr(f);
- sline(f, "for(;ip0 < ep;");
- for (e = 0; e < f->nip; e++)
- mline(f, " ip%d += %d,", e, g->in.chi[e]);
- for (e = 0; e < f->nop; e++)
- mline(f, " op%d += %d%s", e, g->out.chi[e], ((e+1) < f->nop) ? "," : "");
- eline(f, ") {");
- inc(f);
-
- /* Declare output value accumulator(s) */
- for (i = 0; i < t->im_fn; i++) {
- line(f,"%s ova%d; /* Output value accumulator */",a->ords[f->iafvt].name,i);
- }
- for (; i < f->ian; i++) {
- line(f,"%s ova%d; /* Output value partial accumulator */",a->ords[f->iapvt].name,i);
- }
-
- /* Context around interp/Simplex table lookup */
- line(f, "{");
- inc(f);
-
- if (!t->sort)
- line(f,"pointer swp;"); /* Declare Simplex weighting pointer */
- line(f,"pointer imp;"); /* Declare Interpolation multidim pointer */
-
- /* Declare the input weighting/vertex offset variables */
- if (t->sort) {
- for (e = 0; e < g->id; e++) {
- if (t->wo_xs) {
- line(f,"%s we%d; /* Weighting value variable */",
- a->ords[f->wevt].name, e);
- line(f,"%s vo%d; /* Vertex offset variable */",
- a->ords[f->vovt].name, e);
- } else {
- line(f,"%s wo%d; /* Weighting value and vertex offset variable */",
- a->ords[f->wovt].name, e);
- }
- }
- }
-
- /* Context around input table processing */
- line(f, "{");
- inc(f);
-
- /* Declare the table index variables/input weighting/vertex offset variables */
- if (t->sort) {
- if (!t->it_xs)
- line(f,"%s ti; /* Input table entry variable */",a->ords[f->itvt].name);
- line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name);
- } else {
- if (t->it_xs) {
- line(f,"%s ti_s; /* Simplex index variable */",a->ords[f->sxvt].name);
- line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name);
- } else {
- line(f,"%s ti; /* Simplex+Interpolation index variable */",a->ords[f->itvt].name);
- }
- }
-
- if (g->in.packed != 0) /* We need to unpack from a single read */
- line(f,"%s rdv; /* Read value */",a->ords[f->ipt[0]].name);
-
- if (t->it_ix == 0) {
- int bv = 0;
- for (e = 0; e < f->nip; e++) { /* Find largest input type */
- if (f->ipt[e] > bv)
- bv = f->ipt[e];
- }
- bv = nord(f, bv);
- line(f,"%s chv; /* Channel value */",a->ords[bv].name);
- f->chv_bits = a->ords[bv].bits;
- }
- cr(f);
+ /* Start the pixel processing loop */
+ cr(f);
+ sline(f, "for(;ip0 < ep;");
+ for (e = 0; e < f->nip; e++)
+ mline(f, " ip%d += %d,", e, g->in.chi[e]);
+ for (e = 0; e < f->nop; e++)
+ mline(f, " op%d += %d%s", e, g->out.chi[e], ((e+1) < f->nop) ? "," : "");
+ eline(f, ") {");
+ inc(f);
+
+ /* Declare output value accumulator(s) */
+ for (i = 0; i < t->im_fn; i++) {
+ line(f,"%s ova%d; /* Output value accumulator */",a->ords[f->iafvt].name,i);
+ }
+ for (; i < f->ian; i++) {
+ line(f,"%s ova%d; /* Output value partial accumulator */",a->ords[f->iapvt].name,i);
+ }
+
+ /* Context around interp/Simplex table lookup */
+ line(f, "{");
+ inc(f);
+
+ if (!t->sort)
+ line(f,"pointer swp;"); /* Declare Simplex weighting pointer */
+ line(f,"pointer imp;"); /* Declare Interpolation multidim pointer */
+
+ /* Declare the input weighting/vertex offset variables */
+ if (t->sort) {
+ for (e = 0; e < g->id; e++) {
+ if (t->wo_xs) {
+ line(f,"%s we%d; /* Weighting value variable */",
+ a->ords[f->wevt].name, e);
+ line(f,"%s vo%d; /* Vertex offset variable */",
+ a->ords[f->vovt].name, e);
+ } else {
+ line(f,"%s wo%d; /* Weighting value and vertex offset variable */",
+ a->ords[f->wovt].name, e);
+ }
+ }
+ }
+
+ /* Context around input table processing */
+ line(f, "{");
+ inc(f);
+
+ /* Declare the table index variables/input weighting/vertex offset variables */
+ if (t->sort) {
+ if (!t->it_xs)
+ line(f,"%s ti; /* Input table entry variable */",a->ords[f->itvt].name);
+ line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name);
+ } else {
+ if (t->it_xs) {
+ line(f,"%s ti_s; /* Simplex index variable */",a->ords[f->sxvt].name);
+ line(f,"%s ti_i; /* Interpolation index variable */",a->ords[f->ixvt].name);
+ } else {
+ line(f,"%s ti; /* Simplex+Interpolation index variable */",a->ords[f->itvt].name);
+ }
+ }
+
+ if (g->in.packed != 0) /* We need to unpack from a single read */
+ line(f,"%s rdv; /* Read value */",a->ords[f->ipt[0]].name);
+
+ if (t->it_ix == 0) {
+ int bv = 0;
+ for (e = 0; e < f->nip; e++) { /* Find largest input type */
+ if (f->ipt[e] > bv)
+ bv = f->ipt[e];
+ }
+ bv = nord(f, bv);
+ line(f,"%s chv; /* Channel value */",a->ords[bv].name);
+ f->chv_bits = a->ords[bv].bits;
+ }
+ cr(f);
#ifdef VERBOSE
- printf("Read code\n"); fflush(stdout);
+ printf("Read code\n"); fflush(stdout);
#endif /* VERBOSE */
- /* For all the input channels */
- for (e = 0; e < g->id; e++) {
- char rde[50]; /* Read expression */
- char toff[50]; /* Table offset expression */
- int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */
-
- if (g->in.pint != 0) /* Pixel interleaved */
- sprintf(rde,"ip0[%d]",e); /* Offset from single pointer */
- else
- sprintf(rde,"*ip%d",e); /* Pointer per channel */
-
- if (g->in.packed != 0) {
- if (e == 0)
- line(f,"rdv = %s;",rde); /* Do single read */
- sprintf(rde,"rdv"); /* Use read value for extraction */
- }
-
- if (t->it_ix == 0) {
- if (g->in.bov[e] == 0 ) { /* No offset */
- if (g->in.bpv[e] == g->in.bpch[ee]) /* No mask */
- line(f,"chv = %s;",rde);
- else /* Just mask */
- line(f,"chv = (%s & %s);",rde, hmask(g->in.bpv[e]));
- } else { /* Offset */
- if ((g->in.bov[e] + g->in.bpv[e]) == g->in.bpch[ee])
- line(f,"chv = (%s >> %d);",rde, g->in.bov[e]);
- else { /* Offset and mask */
- if (a->shfm || g->in.bpv[e] > 32) {
- /* Extract using just shifts */
- line(f,"chv = ((%s << %d) >> %d);", rde,
- f->chv_bits - g->in.bpv[e] - g->in.bov[e],
- f->chv_bits - g->in.bpv[e]);
- } else {
- /* Extract using shift and mask */
- line(f,"chv = ((%s >> %d) & %s);",
- rde, g->in.bov[e], hmask(g->in.bpv[e]));
- }
- }
- }
- sprintf(toff,"chv");
- } else { /* No extraction */
- sprintf(toff,"%s",rde);
- }
-
- if (t->sort) {
- if (t->it_xs) {
- line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff);
- if (t->wo_xs) {
- line(f,"we%d = IT_WE(it%d, %s);", e, e, toff);
- line(f,"vo%d = IT_VO(it%d, %s);", e, e, toff);
- } else {
- line(f,"wo%d = IT_WO(it%d, %s);", e, e, toff);
- }
- } else { /* All three combined */
- line(f,"ti = IT_IT(it%d, %s);", e, toff);
- if (a->shfm || t->wo_ab > 32) {
- /* Extract using just shifts */
- line(f,"wo%d = ((ti << %d) >> %d); "
- "/* Extract weighting/vertex offset value */",
- e, a->ords[f->wovt].bits - t->wo_ab, a->ords[f->wovt].bits - t->wo_ab);
- line(f,"ti_i %s= (ti >> %d); "
- "/* Extract interpolation table value */",
- e ? "+" : " ", t->wo_ab);
- } else {
- /* Extract using shift and mask */
- line(f,"wo%d = (ti & %s); "
- "/* Extract weighting/vertex offset value */",
- e, hmask(t->wo_ab));
- line(f,"ti_i %s= (ti >> %d); "
- "/* Extract interpolation table value */",
- e ? "+" : " ", t->wo_ab);
- }
- }
-
- } else { /* Simplex */
- if (t->it_xs) {
- /* ~~~~ should toff be forced to be a temp variable ?? */
- /* (ie. force use of rde (above) if t->it_xs is nonz) */
- line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff);
- line(f,"ti_s %s= IT_SX(it%d, %s);", e ? "+" : " ", e, toff);
- } else {
- line(f,"ti %s= IT_IT(it%d, %s);", e ? "+" : " ", e, toff);
- }
- }
- }
+ /* For all the input channels */
+ for (e = 0; e < g->id; e++) {
+ char rde[50]; /* Read expression */
+ char toff[50]; /* Table offset expression */
+ int ee = (g->in.pint != 0) ? 0 : e; /* bpch index */
+
+ if (g->in.pint != 0) /* Pixel interleaved */
+ sprintf(rde,"ip0[%d]",e); /* Offset from single pointer */
+ else
+ sprintf(rde,"*ip%d",e); /* Pointer per channel */
+
+ if (g->in.packed != 0) {
+ if (e == 0)
+ line(f,"rdv = %s;",rde); /* Do single read */
+ sprintf(rde,"rdv"); /* Use read value for extraction */
+ }
+
+ if (t->it_ix == 0) {
+ if (g->in.bov[e] == 0 ) { /* No offset */
+ if (g->in.bpv[e] == g->in.bpch[ee]) /* No mask */
+ line(f,"chv = %s;",rde);
+ else /* Just mask */
+ line(f,"chv = (%s & %s);",rde, hmask(g->in.bpv[e]));
+ } else { /* Offset */
+ if ((g->in.bov[e] + g->in.bpv[e]) == g->in.bpch[ee])
+ line(f,"chv = (%s >> %d);",rde, g->in.bov[e]);
+ else { /* Offset and mask */
+ if (a->shfm || g->in.bpv[e] > 32) {
+ /* Extract using just shifts */
+ line(f,"chv = ((%s << %d) >> %d);", rde,
+ f->chv_bits - g->in.bpv[e] - g->in.bov[e],
+ f->chv_bits - g->in.bpv[e]);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"chv = ((%s >> %d) & %s);",
+ rde, g->in.bov[e], hmask(g->in.bpv[e]));
+ }
+ }
+ }
+ sprintf(toff,"chv");
+ } else { /* No extraction */
+ sprintf(toff,"%s",rde);
+ }
+
+ if (t->sort) {
+ if (t->it_xs) {
+ line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff);
+ if (t->wo_xs) {
+ line(f,"we%d = IT_WE(it%d, %s);", e, e, toff);
+ line(f,"vo%d = IT_VO(it%d, %s);", e, e, toff);
+ } else {
+ line(f,"wo%d = IT_WO(it%d, %s);", e, e, toff);
+ }
+ } else { /* All three combined */
+ line(f,"ti = IT_IT(it%d, %s);", e, toff);
+ if (a->shfm || t->wo_ab > 32) {
+ /* Extract using just shifts */
+ line(f,"wo%d = ((ti << %d) >> %d); "
+ "/* Extract weighting/vertex offset value */",
+ e, a->ords[f->wovt].bits - t->wo_ab, a->ords[f->wovt].bits - t->wo_ab);
+ line(f,"ti_i %s= (ti >> %d); "
+ "/* Extract interpolation table value */",
+ e ? "+" : " ", t->wo_ab);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"wo%d = (ti & %s); "
+ "/* Extract weighting/vertex offset value */",
+ e, hmask(t->wo_ab));
+ line(f,"ti_i %s= (ti >> %d); "
+ "/* Extract interpolation table value */",
+ e ? "+" : " ", t->wo_ab);
+ }
+ }
+
+ } else { /* Simplex */
+ if (t->it_xs) {
+ /* ~~~~ should toff be forced to be a temp variable ?? */
+ /* (ie. force use of rde (above) if t->it_xs is nonz) */
+ line(f,"ti_i %s= IT_IX(it%d, %s);", e ? "+" : " ", e, toff);
+ line(f,"ti_s %s= IT_SX(it%d, %s);", e ? "+" : " ", e, toff);
+ } else {
+ line(f,"ti %s= IT_IT(it%d, %s);", e ? "+" : " ", e, toff);
+ }
+ }
+ }
#ifdef VERBOSE
- printf("Index extraction code\n"); fflush(stdout);
+ printf("Index extraction code\n"); fflush(stdout);
#endif /* VERBOSE */
- cr(f);
-
- if (t->sort) {
- /* Extract Simplex and Interpolation indexes from accumulator */
- line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */");
- } else {
- if (t->it_xs) { /* Extract Simplex and Interpolation indexes from accumulator */
- line(f,"swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */");
- line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */");
- } else {
- line(f,"imp = im_base + IM_O(ti >> %d); "
- "/* Extract interp. index and comp. entry */",
- t->sx_ab);
- if (a->shfm || t->sx_ab > 32) {
- /* Extract using just shifts */
- line(f,"swp = sw_base + SW_O((ti << %d) >> %d); "
- "/* Extract simplex index & comp. entry */",
- a->ords[f->itvt].bits - t->sx_ab, a->ords[f->itvt].bits - t->sx_ab);
- } else {
- /* Extract using shift and mask */
- line(f,"swp = sw_base + SW_O(ti & %s); "
- "/* Extract simplex index and comp. entry */",
- hmask(t->sx_ab));
- }
- }
- }
-
- /* Do the explicit sort now */
- if (t->sort) {
- cr(f);
- /* Sort from largest to smallest using a selection sort */
- /* Use simple sequence for the moment. More elaborate sequence */
- /* may allow other optimisations. */
- line(f,"/* Sort weighting values and vertex offset values */");
- for (i = 0; i < (g->id-1); i++) {
- for (e = i+1; e < g->id; e++) {
- if (t->wo_xs)
- line(f,"CEX(we%d, vo%d, we%d, vo%d);",i,i,e,e);
- else
- line(f,"CEX(wo%d, wo%d);",i,e);
- }
- }
- }
-
- /* End of input table processing context */
- dec(f);
- line(f,"}");
-
- line(f,"{"); /* Context around vertex lookup and accumulation */
- inc(f);
-
- /* Declare vertex offset and weight variables */
- if (t->sort && t->wo_xs == 0) {
- line(f,"%s nvof; /* Next vertex offset value */",a->ords[f->vovt].name);
- } else {
- if (!t->wo_xs) /* If combined in table */
- line(f,"%s vowr; /* Vertex offset/weight value */",a->ords[f->wovt].name);
- }
- line(f,"%s vof; /* Vertex offset value */",a->ords[f->vovt].name);
- line(f,"%s vwe; /* Vertex weighting */",a->ords[f->wevt].name);
- if (timp && t->im_fn > 1)
- line(f,"pointer timp; /* Temporary interpolation table pointer */");
- cr(f);
+ cr(f);
+
+ if (t->sort) {
+ /* Extract Simplex and Interpolation indexes from accumulator */
+ line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */");
+ } else {
+ if (t->it_xs) { /* Extract Simplex and Interpolation indexes from accumulator */
+ line(f,"swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */");
+ line(f,"imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */");
+ } else {
+ line(f,"imp = im_base + IM_O(ti >> %d); "
+ "/* Extract interp. index and comp. entry */",
+ t->sx_ab);
+ if (a->shfm || t->sx_ab > 32) {
+ /* Extract using just shifts */
+ line(f,"swp = sw_base + SW_O((ti << %d) >> %d); "
+ "/* Extract simplex index & comp. entry */",
+ a->ords[f->itvt].bits - t->sx_ab, a->ords[f->itvt].bits - t->sx_ab);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"swp = sw_base + SW_O(ti & %s); "
+ "/* Extract simplex index and comp. entry */",
+ hmask(t->sx_ab));
+ }
+ }
+ }
+
+ /* Do the explicit sort now */
+ if (t->sort) {
+ cr(f);
+ /* Sort from largest to smallest using a selection sort */
+ /* Use simple sequence for the moment. More elaborate sequence */
+ /* may allow other optimisations. */
+ line(f,"/* Sort weighting values and vertex offset values */");
+ for (i = 0; i < (g->id-1); i++) {
+ for (e = i+1; e < g->id; e++) {
+ if (t->wo_xs)
+ line(f,"CEX(we%d, vo%d, we%d, vo%d);",i,i,e,e);
+ else
+ line(f,"CEX(wo%d, wo%d);",i,e);
+ }
+ }
+ }
+
+ /* End of input table processing context */
+ dec(f);
+ line(f,"}");
+
+ line(f,"{"); /* Context around vertex lookup and accumulation */
+ inc(f);
+
+ /* Declare vertex offset and weight variables */
+ if (t->sort && t->wo_xs == 0) {
+ line(f,"%s nvof; /* Next vertex offset value */",a->ords[f->vovt].name);
+ } else {
+ if (!t->wo_xs) /* If combined in table */
+ line(f,"%s vowr; /* Vertex offset/weight value */",a->ords[f->wovt].name);
+ }
+ line(f,"%s vof; /* Vertex offset value */",a->ords[f->vovt].name);
+ line(f,"%s vwe; /* Vertex weighting */",a->ords[f->wevt].name);
+ if (timp && t->im_fn > 1)
+ line(f,"pointer timp; /* Temporary interpolation table pointer */");
+ cr(f);
#ifdef VERBOSE
- printf("Vertex offset and weight code\n"); fflush(stdout);
+ printf("Vertex offset and weight code\n"); fflush(stdout);
#endif /* VERBOSE */
- /* For each vertex in the simplex */
- for (e = 0; e < (g->id +1); e++) {
-
- if (t->sort) {
-
- if (e == 0) {
- line(f,"vof = 0; /* First vertex offset is 0 */");
- } else {
- if (t->wo_xs)
- line(f,"vof += vo%d; /* Move to next vertex */",e-1);
- else
- line(f,"vof += nvof; /* Move to next vertex */");
- }
-
- /* Extract the vertex offset and weight values from the sorted input values */
- if (e < g->id && !t->wo_xs) {
- if (a->shfm || t->vo_ab > 32) {
- /* Extract using just shifts */
- line(f,"nvof = ((wo%d << %d) >> %d); "
- "/* Extract offset value */",
- e, a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab);
- line(f,"wo%d = (wo%d >> %d); "
- " /* Extract weighting value */",
- e, e, t->vo_ab);
- } else {
- /* Extract using shift and mask */
- line(f,"nvof = (wo%d & %s); "
- "/* Extract offset value */",
- e, hmask(t->vo_ab));
- line(f,"wo%d = (wo%d >> %d); "
- " /* Extract weighting value */",
- e, e, t->vo_ab);
- }
- }
- /* Compute the weighting value */
- if (!t->wo_xs) {
- if (e == 0) {
- line(f,"vwe = %d - wo%d; /* Baricentric weighting */", 1 << g->prec, e);
- } else if (e < g->id) {
- line(f,"vwe = wo%d - wo%d; /* Baricentric weighting */", e-1, e);
- } else {
- line(f,"vwe = wo%d; /* Baricentric weighting */", e-1);
- }
- } else {
- if (e == 0) {
- line(f,"vwe = %d - we%d; /* Baricentric weighting */", 1 << g->prec, e);
- } else if (e < g->id) {
- line(f,"vwe = we%d - we%d; /* Baricentric weighting */", e-1, e);
- } else {
- line(f,"vwe = we%d; /* Baricentric weighting */", e-1);
- }
- }
-
- } else { /* Not sort */
- /* Read the vertex offset and weight values from the simplex table */
- if (t->wo_xs) { /* If separate */
- line(f,"vof = SX_VO(swp, %d); /* Read vertex offset value */", e);
- line(f,"vwe = SX_WE(swp, %d); /* Read vertex weighting value */", e);
- } else { /* If combined in table */
- line(f,"vowr = SX_WO(swp, %d); /* Read vertex offset+weighting values */", e);
- if (a->shfm || t->vo_ab > 32) {
- /* Extract using just shifts */
- line(f,"vof = ((vowr << %d) >> %d); "
- "/* Extract offset value */",
- a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab);
- line(f,"vwe = (vowr >> %d); "
- "/* Extract weighting value */",
- t->vo_ab);
- } else {
- /* Extract using shift and mask */
- line(f,"vof = (vowr & %s); "
- "/* Extract offset value */",
- hmask(t->vo_ab));
- line(f,"vwe = (vowr >> %d); "
- "/* Extract weighting value */",
- t->vo_ab);
- }
- }
- }
-
- /* Lookup the vertex value, weight it, and accumulate it into output value */
- if (timp && t->im_fn > 1)
- line(f,"timp = IM_TP(imp, vof); /* Vertex address */");
- for (i = 0; i < f->ian; i++) { /* For each output accumulation chunk */
- if (i < t->im_fn) { /* Full entry */
- if (!timp || t->im_fn == 1)
- line(f,"ova%d %s= IM_FE(imp, vof, %d) * vwe; "
- "/* Accumulate weighted output values */",
- i, e ? "+" : " ", i);
- else
- line(f,"ova%d %s= IM_FE(timp, %d) * vwe; "
- "/* Accumulate weighted output values */",
- i, e ? "+" : " ", i);
- } else /* One partial entry */
- line(f,"ova%d %s= IM_PE(imp, vof) * vwe; "
- "/* Accumulate last weighted output values */",
- i, e ? "+" : " ");
- }
- }
-
- dec(f);
- line(f, "}"); /* End of output value lookup context */
-
- dec(f);
- line(f, "}"); /* End of output value accumulation context */
-
- /* Start of output lookup and write */
- line(f,"{");
- inc(f);
+ /* For each vertex in the simplex */
+ for (e = 0; e < (g->id +1); e++) {
+
+ if (t->sort) {
+
+ if (e == 0) {
+ line(f,"vof = 0; /* First vertex offset is 0 */");
+ } else {
+ if (t->wo_xs)
+ line(f,"vof += vo%d; /* Move to next vertex */",e-1);
+ else
+ line(f,"vof += nvof; /* Move to next vertex */");
+ }
+
+ /* Extract the vertex offset and weight values from the sorted input values */
+ if (e < g->id && !t->wo_xs) {
+ if (a->shfm || t->vo_ab > 32) {
+ /* Extract using just shifts */
+ line(f,"nvof = ((wo%d << %d) >> %d); "
+ "/* Extract offset value */",
+ e, a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab);
+ line(f,"wo%d = (wo%d >> %d); "
+ " /* Extract weighting value */",
+ e, e, t->vo_ab);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"nvof = (wo%d & %s); "
+ "/* Extract offset value */",
+ e, hmask(t->vo_ab));
+ line(f,"wo%d = (wo%d >> %d); "
+ " /* Extract weighting value */",
+ e, e, t->vo_ab);
+ }
+ }
+ /* Compute the weighting value */
+ if (!t->wo_xs) {
+ if (e == 0) {
+ line(f,"vwe = %d - wo%d; /* Baricentric weighting */", 1 << g->prec, e);
+ } else if (e < g->id) {
+ line(f,"vwe = wo%d - wo%d; /* Baricentric weighting */", e-1, e);
+ } else {
+ line(f,"vwe = wo%d; /* Baricentric weighting */", e-1);
+ }
+ } else {
+ if (e == 0) {
+ line(f,"vwe = %d - we%d; /* Baricentric weighting */", 1 << g->prec, e);
+ } else if (e < g->id) {
+ line(f,"vwe = we%d - we%d; /* Baricentric weighting */", e-1, e);
+ } else {
+ line(f,"vwe = we%d; /* Baricentric weighting */", e-1);
+ }
+ }
+
+ } else { /* Not sort */
+ /* Read the vertex offset and weight values from the simplex table */
+ if (t->wo_xs) { /* If separate */
+ line(f,"vof = SX_VO(swp, %d); /* Read vertex offset value */", e);
+ line(f,"vwe = SX_WE(swp, %d); /* Read vertex weighting value */", e);
+ } else { /* If combined in table */
+ line(f,"vowr = SX_WO(swp, %d); /* Read vertex offset+weighting values */", e);
+ if (a->shfm || t->vo_ab > 32) {
+ /* Extract using just shifts */
+ line(f,"vof = ((vowr << %d) >> %d); "
+ "/* Extract offset value */",
+ a->ords[f->vovt].bits - t->vo_ab, a->ords[f->vovt].bits - t->vo_ab);
+ line(f,"vwe = (vowr >> %d); "
+ "/* Extract weighting value */",
+ t->vo_ab);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"vof = (vowr & %s); "
+ "/* Extract offset value */",
+ hmask(t->vo_ab));
+ line(f,"vwe = (vowr >> %d); "
+ "/* Extract weighting value */",
+ t->vo_ab);
+ }
+ }
+ }
+
+ /* Lookup the vertex value, weight it, and accumulate it into output value */
+ if (timp && t->im_fn > 1)
+ line(f,"timp = IM_TP(imp, vof); /* Vertex address */");
+ for (i = 0; i < f->ian; i++) { /* For each output accumulation chunk */
+ if (i < t->im_fn) { /* Full entry */
+ if (!timp || t->im_fn == 1)
+ line(f,"ova%d %s= IM_FE(imp, vof, %d) * vwe; "
+ "/* Accumulate weighted output values */",
+ i, e ? "+" : " ", i);
+ else
+ line(f,"ova%d %s= IM_FE(timp, %d) * vwe; "
+ "/* Accumulate weighted output values */",
+ i, e ? "+" : " ", i);
+ } else /* One partial entry */
+ line(f,"ova%d %s= IM_PE(imp, vof) * vwe; "
+ "/* Accumulate last weighted output values */",
+ i, e ? "+" : " ");
+ }
+ }
+
+ dec(f);
+ line(f, "}"); /* End of output value lookup context */
+
+ dec(f);
+ line(f, "}"); /* End of output value accumulation context */
+
+ /* Start of output lookup and write */
+ line(f,"{");
+ inc(f);
#ifdef VERBOSE
- printf("Output table code\n"); fflush(stdout);
+ printf("Output table code\n"); fflush(stdout);
#endif /* VERBOSE */
- {
- char wre[50]; /* Write destination expression */
-
- if (g->out.packed != 0) /* We need to pack results into a single write */
- line(f,"%s wrv; /* Write value */",a->ords[f->ipt[0]].name);
-
- /* Declare temporary to hold index into output lookup table */
- line(f,"%s oti; /* Vertex offset value */",a->ords[f->otit].name);
-
- /* For each accumulator value */
- /* (Assume they are in output order for the moment ?) */
- for (e = i = 0; i < f->ian; i++) { /* For each output accumulation chunk */
- int vpa = i < t->im_fn ? t->im_fv : t->im_pv; /* Chanel values per accumulator */
- int oat = i < t->im_fn ? f->iafvt : f->iapvt; /* Output accumulator type */
- int ee; /* Relative e to this accumulator */
-
- /* For each output value in this accumulator */
- for (ee = 0; ee < vpa && e < g->od; ee++, e++) {
- int off, size; /* Bits to be extracted */
-
- /* Extract wanted 8 bits from the 8.8 bit result in accumulator */
- off = ee * f->iaovb + (f->iaovb - g->prec);
- size = g->prec;
-
- if (e == 0 || g->out.packed == 0) {
- if (g->out.pint != 0) /* Pixel interleaved */
- sprintf(wre,"op0[%d]",e); /* Offset from single pointer */
- else
- sprintf(wre,"*op%d",e); /* Pointer per channel */
- }
-
- if (a->shfm || size > 32) {
- /* Extract using just shifts */
- line(f,"oti = ((ova%d << %d) >> %d); "
- "/* Extract integer part of result */",
- i, a->ords[oat].bits - off - size, a->ords[oat].bits - size);
- } else {
- /* Extract using shift and mask */
- line(f,"oti = ((ova%d >> %d) & %s); "
- "/* Extract integer part of result */",
- i, off, hmask(size));
- }
-
- /* Lookup in output table and write to destination */
- if (g->out.packed != 0) {
- line(f,"wrv %s= OT_E(ot%d, oti);", e ? "+" : "", e);
- } else {
- line(f,"%s = OT_E(ot%d, oti); /* Write result */", wre, e);
- }
- }
- }
-
- if (g->out.packed != 0) { /* Write out the accumulated value */
- line(f,"%s = wrv; /* Write result */", wre);
- }
- }
-
- /* The end of the output lookup and write */
- dec(f);
- line(f, "}");
-
- /* The end of the pixel processing loop */
- dec(f);
- line(f, "}");
-
- /* The end of the function */
- dec(f);
- line(f, "}");
-
- /* Undefine all the macros */
- if (t->sort) {
- if (t->it_xs) {
- if (t->wo_xs) {
- line(f,"#undef IT_WE");
- line(f,"#undef IT_VO");
- } else
- line(f,"#undef IT_WO");
- line(f,"#undef IT_IX");
- } else {
- line(f,"#undef IT_IT");
- }
- line(f,"#undef CEX");
- } else {
- if (t->it_xs) {
- line(f,"#undef IT_IX");
- line(f,"#undef IT_SX");
- } else {
- line(f,"#undef IT_IT");
- }
-
- line(f,"#undef SW_O");
- if (t->wo_xs) {
- line(f,"#undef SX_WE");
- line(f,"#undef SX_VO");
- } else {
- line(f,"#undef SX_WO");
- }
- }
- line(f,"#undef IM_O");
- if (t->im_fn > 0) {
- if (timp && t->im_fn > 1)
- line(f,"#undef IM_TP");
- line(f,"#undef IM_FE");
- }
- if (t->im_pn > 0) {
- line(f,"#undef IM_PE");
- }
- line(f,"#undef OT_E");
-
- /* =============================================== */
+ {
+ char wre[50]; /* Write destination expression */
+
+ if (g->out.packed != 0) /* We need to pack results into a single write */
+ line(f,"%s wrv; /* Write value */",a->ords[f->ipt[0]].name);
+
+ /* Declare temporary to hold index into output lookup table */
+ line(f,"%s oti; /* Vertex offset value */",a->ords[f->otit].name);
+
+ /* For each accumulator value */
+ /* (Assume they are in output order for the moment ?) */
+ for (e = i = 0; i < f->ian; i++) { /* For each output accumulation chunk */
+ int vpa = i < t->im_fn ? t->im_fv : t->im_pv; /* Chanel values per accumulator */
+ int oat = i < t->im_fn ? f->iafvt : f->iapvt; /* Output accumulator type */
+ int ee; /* Relative e to this accumulator */
+
+ /* For each output value in this accumulator */
+ for (ee = 0; ee < vpa && e < g->od; ee++, e++) {
+ int off, size; /* Bits to be extracted */
+
+ /* Extract wanted 8 bits from the 8.8 bit result in accumulator */
+ off = ee * f->iaovb + (f->iaovb - g->prec);
+ size = g->prec;
+
+ if (e == 0 || g->out.packed == 0) {
+ if (g->out.pint != 0) /* Pixel interleaved */
+ sprintf(wre,"op0[%d]",e); /* Offset from single pointer */
+ else
+ sprintf(wre,"*op%d",e); /* Pointer per channel */
+ }
+
+ if (a->shfm || size > 32) {
+ /* Extract using just shifts */
+ line(f,"oti = ((ova%d << %d) >> %d); "
+ "/* Extract integer part of result */",
+ i, a->ords[oat].bits - off - size, a->ords[oat].bits - size);
+ } else {
+ /* Extract using shift and mask */
+ line(f,"oti = ((ova%d >> %d) & %s); "
+ "/* Extract integer part of result */",
+ i, off, hmask(size));
+ }
+
+ /* Lookup in output table and write to destination */
+ if (g->out.packed != 0) {
+ line(f,"wrv %s= OT_E(ot%d, oti);", e ? "+" : "", e);
+ } else {
+ line(f,"%s = OT_E(ot%d, oti); /* Write result */", wre, e);
+ }
+ }
+ }
+
+ if (g->out.packed != 0) { /* Write out the accumulated value */
+ line(f,"%s = wrv; /* Write result */", wre);
+ }
+ }
+
+ /* The end of the output lookup and write */
+ dec(f);
+ line(f, "}");
+
+ /* The end of the pixel processing loop */
+ dec(f);
+ line(f, "}");
+
+ /* The end of the function */
+ dec(f);
+ line(f, "}");
+
+ /* Undefine all the macros */
+ if (t->sort) {
+ if (t->it_xs) {
+ if (t->wo_xs) {
+ line(f,"#undef IT_WE");
+ line(f,"#undef IT_VO");
+ } else
+ line(f,"#undef IT_WO");
+ line(f,"#undef IT_IX");
+ } else {
+ line(f,"#undef IT_IT");
+ }
+ line(f,"#undef CEX");
+ } else {
+ if (t->it_xs) {
+ line(f,"#undef IT_IX");
+ line(f,"#undef IT_SX");
+ } else {
+ line(f,"#undef IT_IT");
+ }
+
+ line(f,"#undef SW_O");
+ if (t->wo_xs) {
+ line(f,"#undef SX_WE");
+ line(f,"#undef SX_VO");
+ } else {
+ line(f,"#undef SX_WO");
+ }
+ }
+ line(f,"#undef IM_O");
+ if (t->im_fn > 0) {
+ if (timp && t->im_fn > 1)
+ line(f,"#undef IM_TP");
+ line(f,"#undef IM_FE");
+ }
+ if (t->im_pn > 0) {
+ line(f,"#undef IM_PE");
+ }
+ line(f,"#undef OT_E");
+
+ /* =============================================== */
#ifdef VERBOSE
- printf("Done interpolation code\n"); fflush(stdout);
+ printf("Done interpolation code\n"); fflush(stdout);
#endif /* VERBOSE */
- /* =============================================== */
-
- {
- int sog = sizeof(genspec); /* Size of genspec structure */
- unsigned char *dp = (unsigned char *)g;
-
- int s_stres, s_itres; /* Save values */
-
- s_stres = g->stres;
- s_itres = g->itres;
- g->stres = f->sxmxres; /* Set maximum values */
- g->itres = f->ixmxres;
-
- /* Declare the generation structure data function */
- cr(f);
- line(f,"static void");
- line(f, "imdi_k%d_gen(",index);
- line(f, "genspec *g /* structure to be initialised */");
- line(f, ") {");
- inc(f);
-
- /* Declare the genspec initialisation data */
- line(f, "static unsigned char data[] = {");
- inc(f);
- for (i = 0; i < sog; i++) {
- if ((i & 7) == 0)
- sline(f,"");
- mline(f, "0x%02x%s ", dp[i], (i+1) < sog ? "," : "", dp[i]);
- if ((i & 7) == 7 || (i+1) == sog)
- eline(f,"");
- }
- dec(f);
- line(f, "}; /* Structure image */");
-
- cr(f);
- line(f, "memcpy(g, data, sizeof(data)); /* Initialise the structure */");
- /* The end of the function */
- dec(f);
- line(f, "}");
-
- g->stres = s_stres; /* Restore entry values */
- g->itres = s_itres;
- }
-
- /* =============================================== */
-
- {
- int sot = sizeof(tabspec); /* Size of tabspec structure */
- unsigned char *dp = (unsigned char *)t;
-
- /* Declare the generation structure data function */
- cr(f);
- line(f,"static void");
- line(f, "imdi_k%d_tab(",index);
- line(f, "tabspec *t /* structure to be initialised */");
- line(f, ") {");
- inc(f);
-
- /* Declare the genspec initialisation data */
- line(f, "static unsigned char data[] = {");
- inc(f);
- for (i = 0; i < sot; i++) {
- if ((i & 7) == 0)
- sline(f,"");
- mline(f, "0x%02x%s ", dp[i], (i+1) < sot ? "," : "", dp[i]);
- if ((i & 7) == 7 || (i+1) == sot)
- eline(f,"");
- }
- dec(f);
- line(f, "}; /* Structure image */");
-
- cr(f);
- line(f, "memcpy(t, data, sizeof(data)); /* Initialise the structure */");
- /* The end of the function */
- dec(f);
- line(f, "}");
- }
-
- /* =============================================== */
-
- cr(f); cr(f); cr(f); cr(f); cr(f); cr(f);
-
- return 0;
+ /* =============================================== */
+
+ {
+ int sog = sizeof(genspec); /* Size of genspec structure */
+ unsigned char *dp = (unsigned char *)g;
+
+ int s_stres, s_itres; /* Save values */
+
+ s_stres = g->stres;
+ s_itres = g->itres;
+ g->stres = f->sxmxres; /* Set maximum values */
+ g->itres = f->ixmxres;
+
+ /* Declare the generation structure data function */
+ cr(f);
+ line(f,"static void");
+ line(f, "imdi_k%d_gen(",index);
+ line(f, "genspec *g /* structure to be initialised */");
+ line(f, ") {");
+ inc(f);
+
+ /* Declare the genspec initialisation data */
+ line(f, "static unsigned char data[] = {");
+ inc(f);
+ for (i = 0; i < sog; i++) {
+ if ((i & 7) == 0)
+ sline(f,"");
+ mline(f, "0x%02x%s ", dp[i], (i+1) < sog ? "," : "", dp[i]);
+ if ((i & 7) == 7 || (i+1) == sog)
+ eline(f,"");
+ }
+ dec(f);
+ line(f, "}; /* Structure image */");
+
+ cr(f);
+ line(f, "memcpy(g, data, sizeof(data)); /* Initialise the structure */");
+ /* The end of the function */
+ dec(f);
+ line(f, "}");
+
+ g->stres = s_stres; /* Restore entry values */
+ g->itres = s_itres;
+ }
+
+ /* =============================================== */
+
+ {
+ int sot = sizeof(tabspec); /* Size of tabspec structure */
+ unsigned char *dp = (unsigned char *)t;
+
+ /* Declare the generation structure data function */
+ cr(f);
+ line(f,"static void");
+ line(f, "imdi_k%d_tab(",index);
+ line(f, "tabspec *t /* structure to be initialised */");
+ line(f, ") {");
+ inc(f);
+
+ /* Declare the genspec initialisation data */
+ line(f, "static unsigned char data[] = {");
+ inc(f);
+ for (i = 0; i < sot; i++) {
+ if ((i & 7) == 0)
+ sline(f,"");
+ mline(f, "0x%02x%s ", dp[i], (i+1) < sot ? "," : "", dp[i]);
+ if ((i & 7) == 7 || (i+1) == sot)
+ eline(f,"");
+ }
+ dec(f);
+ line(f, "}; /* Structure image */");
+
+ cr(f);
+ line(f, "memcpy(t, data, sizeof(data)); /* Initialise the structure */");
+ /* The end of the function */
+ dec(f);
+ line(f, "}");
+ }
+
+ /* =============================================== */
+
+ cr(f); cr(f); cr(f); cr(f); cr(f); cr(f);
+
+ return 0;
}
-
/* Return bits needed to store index into table of */
/* given resolution and dimensionality. */
static int
@@ -1542,7 +1538,7 @@ calc_bits(
int dim,
int res) {
- return ceil(log((double)res) * (double)dim/log(2.0) - 1e-14);
+ return ceil(log((double)res) * (double)dim/log(2.0) - 1e-14);
}
/* Return maximum resolution possible given dimensionality */
@@ -1551,12 +1547,12 @@ static int
calc_res(
int dim,
int bits) {
- double fres;
+ double fres;
- fres = log(2.0) * (double)bits/(double)dim;
- if (fres > 12 || (fres = exp(fres)) > 65536.0)
- fres = 65536.0; /* Limit to a sane value */
- return (int)(fres + 1e-14);
+ fres = log(2.0) * (double)bits/(double)dim;
+ if (fres > 12 || (fres = exp(fres)) > 65536.0)
+ fres = 65536.0; /* Limit to a sane value */
+ return (int)(fres + 1e-14);
}
/* Return bits needed to store a relative offset of 1, */
@@ -1567,19 +1563,19 @@ calc_obits(
int dim,
int res,
int esize) {
- double off; /* Maximum diagonal offset value */
- int bits;
-
- if (res == 0 || res == 1)
- return 0;
- if (dim == 1)
- off = esize;
- else {
- off = (double)esize * floor(exp(log((double)res) * dim - log(res-1.0)));
- }
-
- bits = ceil(log(off)/log(2.0) - 1e-14);
- return bits;
+ double off; /* Maximum diagonal offset value */
+ int bits;
+
+ if (res == 0 || res == 1)
+ return 0;
+ if (dim == 1)
+ off = esize;
+ else {
+ off = (double)esize * floor(exp(log((double)res) * dim - log(res-1.0)));
+ }
+
+ bits = ceil(log(off)/log(2.0) - 1e-14);
+ return bits;
}
/* Return maximum resolution possible given dimensionality */
@@ -1589,128 +1585,124 @@ calc_ores(
int dim,
int bits,
int esize) {
- int res;
-
- /* Find resolution. Stop at arbitrary 65536 */
- for (res = 1; res < 65537; res++) {
- int bn;
- bn = calc_obits(dim, res, esize);
- if (bn > bits) {
- return res-1;
- }
- }
- return res-1;
+ int res;
+
+ /* Find resolution. Stop at arbitrary 65536 */
+ for (res = 1; res < 65537; res++) {
+ int bn;
+ bn = calc_obits(dim, res, esize);
+ if (bn > bits) {
+ return res-1;
+ }
+ }
+ return res-1;
}
-
-
/* Output the introductory comments */
static void
doheader(
- fileo *f
+ fileo *f
) {
- genspec *g = f->g;
- tabspec *t = f->t;
- mach_arch *a = f->a;
- int e;
-
- /* - - - - - - - - - - - - */
- /* Output file title block */
- line(f,"/* Integer Multi-Dimensional Interpolation */");
- line(f,"/* Interpolation Kernel Code */");
- line(f,"/* Generated by cgen */");
- line(f,"/* Copyright 2000 - 2002 Graeme W. Gill */");
- line(f,"/* This material is licenced under the GNU GENERAL PUBLIC LICENCE :- */\n");
- line(f,"/* see the Licence.txt file for licencing details.*/\n");
- cr(f);
-
- /* - - - - - - - - - - - - */
- /* Output the specification */
- line(f,"/*");
- line(f," Interpolation kernel specs:");
- cr(f);
- line(f," Input channels per pixel = %d",g->id);
- for (e = 0; e < g->id; e++) {
- line(f," Input channel %d bits = %d",e, g->in.bpch[e]);
- line(f," Input channel %d increment = %d",e, g->in.chi[e]);
- }
- if (g->in.pint != 0)
- line(f," Input is channel interleaved");
- else
- line(f," Input is plane interleaved");
-
- if (g->in.packed != 0)
- line(f," Input channels are packed into one word");
- else
- line(f," Input channels are separate words");
-
- if (t->it_ix)
- line(f," Input value extraction is done in input table lookup");
- cr(f);
-
- line(f," Output channels per pixel = %d",g->od);
- for (e = 0; e < g->od; e++) {
- line(f," Output channel %d bits = %d",e, g->out.bpch[e]);
- line(f," Output channel %d increment = %d",e, g->out.chi[e]);
- }
- if (g->out.pint != 0)
- line(f," Output is channel interleaved");
- else
- line(f," Output is plane interleaved");
- cr(f);
- if (g->out.packed != 0)
- line(f," Output channels are packed into one word");
- else
- line(f," Output channels are separate words");
-
-
- if (t->sort)
- line(f," Weight+voffset bits = %d",t->sx_ab);
- else
- line(f," Simplex table index bits = %d",t->sx_ab);
- line(f," Interpolation table index bits = %d",t->ix_ab);
- if (!t->sort)
- line(f," Simplex table max resolution = %d",f->sxmxres);
- line(f," Interpolation table max resolution = %d",f->ixmxres);
- line(f," */");
- cr(f);
-
- /* - - - - - - - - - - - - */
- line(f,"/*");
- line(f," Machine architecture specs:");
- cr(f);
- if (a->bigend != 0)
- line(f," Big Endian");
- else
- line(f," Little endian");
-
- if (a->uwa != 0)
- line(f," Using maximum sized memory accesses where possible");
- else
- line(f," Reading and writing pixel values separately");
-
- line(f," Pointer size = %d bits",a->pbits);
- cr(f);
-
- for (e = 0; e < a->nords; e++) {
- line(f," Ordinal size %2d bits is known as '%s'",
- a->ords[e].bits,a->ords[e].name);
- }
- line(f," Natural ordinal is '%s'", a->ords[a->natord].name);
- cr(f);
-
- for (e = 0; e < a->nints; e++) {
- line(f," Integer size %2d bits is known as '%s'",
- a->ints[e].bits,a->ints[e].name);
- }
- line(f," Natural integer is '%s'", a->ints[a->natint].name);
- cr(f);
-
- line(f," */");
- cr(f);
+ genspec *g = f->g;
+ tabspec *t = f->t;
+ mach_arch *a = f->a;
+ int e;
+
+ /* - - - - - - - - - - - - */
+ /* Output file title block */
+ line(f,"/* Integer Multi-Dimensional Interpolation */");
+ line(f,"/* Interpolation Kernel Code */");
+ line(f,"/* Generated by cgen */");
+ line(f,"/* Copyright 2000 - 2002 Graeme W. Gill */");
+ line(f,"/* This material is licenced under the GNU GENERAL PUBLIC LICENCE :- */\n");
+ line(f,"/* see the Licence.txt file for licencing details.*/\n");
+ cr(f);
+
+ /* - - - - - - - - - - - - */
+ /* Output the specification */
+ line(f,"/*");
+ line(f," Interpolation kernel specs:");
+ cr(f);
+ line(f," Input channels per pixel = %d",g->id);
+ for (e = 0; e < g->id; e++) {
+ line(f," Input channel %d bits = %d",e, g->in.bpch[e]);
+ line(f," Input channel %d increment = %d",e, g->in.chi[e]);
+ }
+ if (g->in.pint != 0)
+ line(f," Input is channel interleaved");
+ else
+ line(f," Input is plane interleaved");
+
+ if (g->in.packed != 0)
+ line(f," Input channels are packed into one word");
+ else
+ line(f," Input channels are separate words");
+
+ if (t->it_ix)
+ line(f," Input value extraction is done in input table lookup");
+ cr(f);
+
+ line(f," Output channels per pixel = %d",g->od);
+ for (e = 0; e < g->od; e++) {
+ line(f," Output channel %d bits = %d",e, g->out.bpch[e]);
+ line(f," Output channel %d increment = %d",e, g->out.chi[e]);
+ }
+ if (g->out.pint != 0)
+ line(f," Output is channel interleaved");
+ else
+ line(f," Output is plane interleaved");
+ cr(f);
+ if (g->out.packed != 0)
+ line(f," Output channels are packed into one word");
+ else
+ line(f," Output channels are separate words");
+
+ if (t->sort)
+ line(f," Weight+voffset bits = %d",t->sx_ab);
+ else
+ line(f," Simplex table index bits = %d",t->sx_ab);
+ line(f," Interpolation table index bits = %d",t->ix_ab);
+ if (!t->sort)
+ line(f," Simplex table max resolution = %d",f->sxmxres);
+ line(f," Interpolation table max resolution = %d",f->ixmxres);
+ line(f," */");
+ cr(f);
+
+ /* - - - - - - - - - - - - */
+ line(f,"/*");
+ line(f," Machine architecture specs:");
+ cr(f);
+ if (a->bigend != 0)
+ line(f," Big Endian");
+ else
+ line(f," Little endian");
+
+ if (a->uwa != 0)
+ line(f," Using maximum sized memory accesses where possible");
+ else
+ line(f," Reading and writing pixel values separately");
+
+ line(f," Pointer size = %d bits",a->pbits);
+ cr(f);
+
+ for (e = 0; e < a->nords; e++) {
+ line(f," Ordinal size %2d bits is known as '%s'",
+ a->ords[e].bits,a->ords[e].name);
+ }
+ line(f," Natural ordinal is '%s'", a->ords[a->natord].name);
+ cr(f);
+
+ for (e = 0; e < a->nints; e++) {
+ line(f," Integer size %2d bits is known as '%s'",
+ a->ints[e].bits,a->ints[e].name);
+ }
+ line(f," Natural integer is '%s'", a->ints[a->natint].name);
+ cr(f);
+
+ line(f," */");
+ cr(f);
}
-
/* ---------------------------------------- */
/* Architecture support */
/* Find an ordinal with at least bits size */
@@ -1719,81 +1711,80 @@ int findord(
fileo *f,
int bits
) {
- mach_arch *a = f->a;
- int i;
-
- for (i = 0; i < a->nords; i++) {
- if (a->ords[i].bits >= bits)
- return i;
- }
- return -1;
+ mach_arch *a = f->a;
+ int i;
+
+ for (i = 0; i < a->nords; i++) {
+ if (a->ords[i].bits >= bits)
+ return i;
+ }
+ return -1;
}
/* Round ordinal type up to natural size */
int nord(
- fileo *f,
- int ov
+ fileo *f,
+ int ov
) {
- if (ov >= 0 && ov < f->a->natord)
- ov = f->a->natord;
- return ov;
+ if (ov >= 0 && ov < f->a->natord)
+ ov = f->a->natord;
+ return ov;
}
/* Find an ordinal with at least bits size, */
/* or natural size, whichever is greater. */
/* Return -1 if failed */
int findnord(
- fileo *f,
- int bits
+ fileo *f,
+ int bits
) {
- int ov;
+ int ov;
- ov = findord(f, bits);
- ov = nord(f, ov);
- return ov;
+ ov = findord(f, bits);
+ ov = nord(f, ov);
+ return ov;
}
/* Find an integer with at least bits size */
/* Return -1 if failed */
int findint(
- fileo *f,
- int bits
+ fileo *f,
+ int bits
) {
- mach_arch *a = f->a;
- int i;
-
- for (i = 0; i < a->nints; i++) {
- if (a->ints[i].bits >= bits)
- return i;
- }
- return -1;
+ mach_arch *a = f->a;
+ int i;
+
+ for (i = 0; i < a->nints; i++) {
+ if (a->ints[i].bits >= bits)
+ return i;
+ }
+ return -1;
}
/* Round integer type up to natural size */
int nint(
- fileo *f,
- int iv
+ fileo *f,
+ int iv
) {
- if (iv >= 0 && iv < f->a->natint)
- iv = f->a->natint;
- return iv;
+ if (iv >= 0 && iv < f->a->natint)
+ iv = f->a->natint;
+ return iv;
}
/* Find an interger with at least bits size, */
/* or natural size, whichever is greater. */
/* Return -1 if failed */
int findnint(
- fileo *f,
- int bits
+ fileo *f,
+ int bits
) {
- int iv;
+ int iv;
- iv = findint(f, bits);
- iv = nint(f, iv);
- return iv;
+ iv = findint(f, bits);
+ iv = nint(f, iv);
+ return iv;
}
-
/* ------------------------------------ */
/* File output support */
@@ -1801,61 +1792,57 @@ int findnint(
void
line(fileo *f, char *fmt, ...)
{
- int i;
- va_list args;
-
- /* Indent to the correct level */
- for (i = 0; i < f->indt; i++)
- fprintf(f->of," ");
-
- va_start(args, fmt);
- vfprintf(f->of, fmt, args);
- va_end(args);
- fprintf(f->of, "\n");
+ int i;
+ va_list args;
+
+ /* Indent to the correct level */
+ for (i = 0; i < f->indt; i++)
+ fprintf(f->of," ");
+
+ va_start(args, fmt);
+ vfprintf(f->of, fmt, args);
+ va_end(args);
+ fprintf(f->of, "\n");
}
/* Output the start of a line to the file) */
void
sline(fileo *f, char *fmt, ...)
{
- int i;
- va_list args;
-
- /* Indent to the correct level */
- for (i = 0; i < f->indt; i++)
- fprintf(f->of," ");
-
- va_start(args, fmt);
- vfprintf(f->of, fmt, args);
- va_end(args);
+ int i;
+ va_list args;
+
+ /* Indent to the correct level */
+ for (i = 0; i < f->indt; i++)
+ fprintf(f->of," ");
+
+ va_start(args, fmt);
+ vfprintf(f->of, fmt, args);
+ va_end(args);
}
/* Output the middle of a line to the file) */
void
mline(fileo *f, char *fmt, ...)
{
- int i;
- va_list args;
+ int i;
+ va_list args;
- va_start(args, fmt);
- vfprintf(f->of, fmt, args);
- va_end(args);
+ va_start(args, fmt);
+ vfprintf(f->of, fmt, args);
+ va_end(args);
}
/* Output the end of a line to the file (including trailing \n) */
void
eline(fileo *f, char *fmt, ...)
{
- int i;
- va_list args;
+ int i;
+ va_list args;
- va_start(args, fmt);
- vfprintf(f->of, fmt, args);
- va_end(args);
- fprintf(f->of, "\n");
+ va_start(args, fmt);
+ vfprintf(f->of, fmt, args);
+ va_end(args);
+ fprintf(f->of, "\n");
}
/* ------------------------------------ */
-
-
-
-
diff --git a/gs/imdi/config.h b/gs/imdi/config.h
index b23c6da05..7da9b2db5 100644
--- a/gs/imdi/config.h
+++ b/gs/imdi/config.h
@@ -1,10 +1,8 @@
-
#ifndef __CONFIG_H__
#define __CONFIG_H__
/* General project wide configuration */
-
/* Version of Argyll release */
#define ARGYLL_VERSION 0x000503
diff --git a/gs/imdi/copyright.h b/gs/imdi/copyright.h
index 8d3e921db..38c2fb132 100644
--- a/gs/imdi/copyright.h
+++ b/gs/imdi/copyright.h
@@ -1,5 +1,2 @@
-
/* Embed a copyright string */
static char __copyright__[] = "Copyright 2005 Graeme W. Gill";
-
-
diff --git a/gs/imdi/imdi.c b/gs/imdi/imdi.c
index dd58d14bf..126f90e75 100644
--- a/gs/imdi/imdi.c
+++ b/gs/imdi/imdi.c
@@ -7,12 +7,10 @@
* see the Licence.txt file for licencing details.
*/
-
/*
This is the implementation of the run time code.
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -31,202 +29,183 @@ static void imdi_free(imdi *im);
/* Create a new imdi */
/* Return NULL if request is not supported */
imdi *new_imdi(
- int id, /* Number of input dimensions */
- int od, /* Number of output dimensions */
- imdi_pixrep in, /* Input pixel representation */
- int in_signed, /* Bit flag per channel, NZ if treat as signed */
- imdi_pixrep out,/* Output pixel representation */
- int out_signed, /* Bit flag per channel, NZ if treat as signed */
- int res, /* Desired table resolution */
-
- /* Callbacks to lookup the mdi table values */
- double (*input_curve) (void *cntx, int ch, double in_val),
- void (*md_table) (void *cntx, double *out_vals, double *in_vals),
- double (*output_curve)(void *cntx, int ch, double in_val),
- void *cntx /* Context to callbacks */
+ int id, /* Number of input dimensions */
+ int od, /* Number of output dimensions */
+ imdi_pixrep in, /* Input pixel representation */
+ int in_signed, /* Bit flag per channel, NZ if treat as signed */
+ imdi_pixrep out,/* Output pixel representation */
+ int out_signed, /* Bit flag per channel, NZ if treat as signed */
+ int res, /* Desired table resolution */
+
+ /* Callbacks to lookup the mdi table values */
+ double (*input_curve) (void *cntx, int ch, double in_val),
+ void (*md_table) (void *cntx, double *out_vals, double *in_vals),
+ double (*output_curve)(void *cntx, int ch, double in_val),
+ void *cntx /* Context to callbacks */
) {
- int i;
- int bk = -1; /* Best table */
- int bfig = 0x7fffffff; /* Best tables figure of merit */
- int bstres; /* Best tables target stres */
- genspec bgs; /* Best gen spec */
-
- tabspec ts; /* Table specifications */
- imdi *im;
+ int i;
+ int bk = -1; /* Best table */
+ int bfig = 0x7fffffff; /* Best tables figure of merit */
+ int bstres; /* Best tables target stres */
+ genspec bgs; /* Best gen spec */
+
+ tabspec ts; /* Table specifications */
+ imdi *im;
#ifdef VERBOSE
- printf("new_imdi called with id %d, od %d, res %d\n", id, od, res);
- printf("about to checking %d kernels\n", no_kfuncs);
+ printf("new_imdi called with id %d, od %d, res %d\n", id, od, res);
+ printf("about to checking %d kernels\n", no_kfuncs);
#endif
- /* The first thing to do is see if there is an available kernel function */
- for (i = 0; i < no_kfuncs; i++) {
- genspec gs;
- int stres; /* Computed stres needed */
- int fig;
- ktable[i].gen(&gs); /* Get the kernel functions genspec */
+ /* The first thing to do is see if there is an available kernel function */
+ for (i = 0; i < no_kfuncs; i++) {
+ genspec gs;
+ int stres; /* Computed stres needed */
+ int fig;
+ ktable[i].gen(&gs); /* Get the kernel functions genspec */
#ifdef VERBOSE
- printf("\n");
- printf("kernel %d has id %d, od %d, irep %d orep %d\n", i, gs.id, gs.od, gs.irep, gs.orep);
- printf("Input req is id %d, od %d, irep %d orep %d\n", id, od, in, out);
+ printf("\n");
+ printf("kernel %d has id %d, od %d, irep %d orep %d\n", i, gs.id, gs.od, gs.irep, gs.orep);
+ printf("Input req is id %d, od %d, irep %d orep %d\n", id, od, in, out);
#endif
- /* First check mandatory things */
- if (id != gs.id /* Input dimension */
- || od != gs.od /* Output dimension */
- || in != gs.irep /* Input dimension */
- || out != gs.orep) { /* Output dimension */
- continue;
- }
+ /* First check mandatory things */
+ if (id != gs.id /* Input dimension */
+ || od != gs.od /* Output dimension */
+ || in != gs.irep /* Input dimension */
+ || out != gs.orep) { /* Output dimension */
+ continue;
+ }
#ifdef VERBOSE
- printf(" found match\n");
+ printf(" found match\n");
#endif
- ktable[i].tab(&ts); /* Get the kernel functions tabspec */
+ ktable[i].tab(&ts); /* Get the kernel functions tabspec */
- if (ts.sort) {
- stres = 0;
+ if (ts.sort) {
+ stres = 0;
#ifdef VERBOSE
- printf("gres = %d\n",res);
+ printf("gres = %d\n",res);
#endif
- /* We want one that is equals or exceeds the desired */
- /* resolution, but doesn't exceed it too much, or the code */
- /* will be inefficient. */
- /* If there are no routines that can meet the desired precision, */
- /* then it is ok to use the one closest to the desired precision. */
- if (gs.itres >= res) {
- fig = 10 * (gs.itres - res);
- } {
- fig = 0;
- if (gs.itres < res) {
- fig += 10000 * (res - gs.itres);
- }
- }
- } else {
- /* compute the needed stres (Assumint not sort) */
- stres = ((1 << gs.prec)-1 + res-2)/(res-1);
+ /* We want one that is equals or exceeds the desired */
+ /* resolution, but doesn't exceed it too much, or the code */
+ /* will be inefficient. */
+ /* If there are no routines that can meet the desired precision, */
+ /* then it is ok to use the one closest to the desired precision. */
+ if (gs.itres >= res) {
+ fig = 10 * (gs.itres - res);
+ } {
+ fig = 0;
+ if (gs.itres < res) {
+ fig += 10000 * (res - gs.itres);
+ }
+ }
+ } else {
+ /* compute the needed stres (Assumint not sort) */
+ stres = ((1 << gs.prec)-1 + res-2)/(res-1);
/* stres = ((1024)-1 + res-2)/(res-1); */
#ifdef VERBOSE
- printf("gres = %d, sres = %d\n",res,stres);
+ printf("gres = %d, sres = %d\n",res,stres);
#endif
- /* We want one that is equals or exceeds the desired */
- /* resolution, but doesn't exceed it too much, or the code */
- /* will be inefficient. */
- /* If there are no routines that can meet the desired precision, */
- /* then it is ok to use the one closest to the desired precision. */
- if (gs.itres >= res && gs.stres >= stres) {
- fig = 10 * (gs.itres - res) + (gs.stres - stres);
- } {
- fig = 0;
- if (gs.itres < res) {
- fig += 10000 * (res - gs.itres);
- }
- if (gs.stres < stres) {
- fig += 1000 * (stres - gs.stres);
- }
- }
- }
+ /* We want one that is equals or exceeds the desired */
+ /* resolution, but doesn't exceed it too much, or the code */
+ /* will be inefficient. */
+ /* If there are no routines that can meet the desired precision, */
+ /* then it is ok to use the one closest to the desired precision. */
+ if (gs.itres >= res && gs.stres >= stres) {
+ fig = 10 * (gs.itres - res) + (gs.stres - stres);
+ } {
+ fig = 0;
+ if (gs.itres < res) {
+ fig += 10000 * (res - gs.itres);
+ }
+ if (gs.stres < stres) {
+ fig += 1000 * (stres - gs.stres);
+ }
+ }
+ }
#ifdef VERBOSE
- printf(" figure of merit %d\n",fig);
+ printf(" figure of merit %d\n",fig);
#endif
- /* Is this the best one so far ? */
- if (fig < bfig) {
- bfig = fig;
- bk = i;
- bstres = stres;
- bgs = gs; /* Structure copy */
+ /* Is this the best one so far ? */
+ if (fig < bfig) {
+ bfig = fig;
+ bk = i;
+ bstres = stres;
+ bgs = gs; /* Structure copy */
#ifdef VERBOSE
- printf(" best so far\n");
+ printf(" best so far\n");
#endif
- }
- }
+ }
+ }
- if (bk < 0) {
+ if (bk < 0) {
#ifdef VERBOSE
- printf("new_imdi failed - dimensionality or representations couldn't be matched\n");
+ printf("new_imdi failed - dimensionality or representations couldn't be matched\n");
#endif
- return NULL; /* Nothing matches */
- }
+ return NULL; /* Nothing matches */
+ }
- if ((im = (imdi *)malloc(sizeof(imdi))) == NULL) {
+ if ((im = (imdi *)malloc(sizeof(imdi))) == NULL) {
#ifdef VERBOSE
- printf("new_imdi malloc imdi failed\n");
+ printf("new_imdi malloc imdi failed\n");
#endif
- /* Should we return an error somehow ? */
- return NULL;
- }
-
- /* We've decided kernel function bk is going to be the best, */
- /* so now setup the appropriate tables to use with it. */
- ktable[bk].tab(&ts); /* Get the kernel functions tabspec */
-
- if (bgs.itres > res)
- bgs.itres = res; /* Tell table create what the res is */
- if (bgs.stres > bstres)
- bgs.stres = bstres;
-
- /* Tel table setup how to treat integer input in per channel lookups */
- bgs.in_signed = in_signed;
- bgs.out_signed = out_signed;
+ /* Should we return an error somehow ? */
+ return NULL;
+ }
+
+ /* We've decided kernel function bk is going to be the best, */
+ /* so now setup the appropriate tables to use with it. */
+ ktable[bk].tab(&ts); /* Get the kernel functions tabspec */
+
+ if (bgs.itres > res)
+ bgs.itres = res; /* Tell table create what the res is */
+ if (bgs.stres > bstres)
+ bgs.stres = bstres;
+
+ /* Tel table setup how to treat integer input in per channel lookups */
+ bgs.in_signed = in_signed;
+ bgs.out_signed = out_signed;
#ifdef VERBOSE
- if (!ts.sort) {
- if ((bgs.stres * (bgs.itres-1)) < ((1 << bgs.prec)-1)) {
- printf("Warning: table chosen doesn't reach desired precision!\n");
- printf("Wanted %d, got %d\n", ((1 << bgs.prec)-1), (bgs.stres * (bgs.itres-1)));
- }
- }
+ if (!ts.sort) {
+ if ((bgs.stres * (bgs.itres-1)) < ((1 << bgs.prec)-1)) {
+ printf("Warning: table chosen doesn't reach desired precision!\n");
+ printf("Wanted %d, got %d\n", ((1 << bgs.prec)-1), (bgs.stres * (bgs.itres-1)));
+ }
+ }
#endif
- /* Allocate and initialise the appropriate tables */
- im->impl = (void *)imdi_tab(&bgs, &ts, input_curve, md_table, output_curve, cntx);
+ /* Allocate and initialise the appropriate tables */
+ im->impl = (void *)imdi_tab(&bgs, &ts, input_curve, md_table, output_curve, cntx);
- if (im->impl == NULL) {
+ if (im->impl == NULL) {
#ifdef VERBOSE
- printf("imdi_tab failed\n");
+ printf("imdi_tab failed\n");
#endif
- imdi_free(im);
- return NULL;
- }
+ imdi_free(im);
+ return NULL;
+ }
- im->interp = ktable[bk].interp;
- im->done = imdi_free;
+ im->interp = ktable[bk].interp;
+ im->done = imdi_free;
#ifdef VERBOSE
- printf("new_imdi returning 0x%x\n", im);
+ printf("new_imdi returning 0x%x\n", im);
#endif
- return im;
+ return im;
}
-
/* Free up the structure */
static void imdi_free(
imdi *im
) {
- /* Free all the allocated tables */
- if (im->impl != NULL)
- imdi_tab_free((imdi_imp *)im->impl);
+ /* Free all the allocated tables */
+ if (im->impl != NULL)
+ imdi_tab_free((imdi_imp *)im->impl);
- /* Free this structure */
- free(im);
+ /* Free this structure */
+ free(im);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gs/imdi/imdi.h b/gs/imdi/imdi.h
index a61313345..7bbf24bed 100644
--- a/gs/imdi/imdi.h
+++ b/gs/imdi/imdi.h
@@ -12,7 +12,7 @@
/*
* This software provides support for high speed integer
- * multimensional interpolation.
+ * multimensional interpolation.
*/
/*
@@ -29,45 +29,39 @@
/* into the exact pixlayout structure details. */
typedef enum {
- invalid_rep = 0,
- pixint8 = 1, /* 8 Bits per value, pixel interleaved, no padding */
- planeint8 = 2, /* 8 bits per value, plane interleaved */
- pixint16 = 3, /* 16 Bits per value, pixel interleaved, no padding */
- planeint16 = 4 /* 16 bits per value, plane interleaved */
+ invalid_rep = 0,
+ pixint8 = 1, /* 8 Bits per value, pixel interleaved, no padding */
+ planeint8 = 2, /* 8 bits per value, plane interleaved */
+ pixint16 = 3, /* 16 Bits per value, pixel interleaved, no padding */
+ planeint16 = 4 /* 16 bits per value, plane interleaved */
} imdi_pixrep;
/* IMDI Object */
struct _imdi {
- void *impl; /* Pointer to implementation information */
+ void *impl; /* Pointer to implementation information */
- /* Do the interpolation */
- void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npixels);
- void (*done)(struct _imdi *s); /* Done with it */
+ /* Do the interpolation */
+ void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npixels);
+ void (*done)(struct _imdi *s); /* Done with it */
}; typedef struct _imdi imdi;
/* Create a new imdi */
/* Return NULL if request is not supported */
imdi *new_imdi(
- int id, /* Number of input dimensions */
- int od, /* Number of output dimensions */
- imdi_pixrep in, /* Input pixel representation */
- int in_signed, /* Bit flag per channel, NZ if treat as signed */
- imdi_pixrep out,/* Output pixel representation */
- int out_signed, /* Bit flag per channel, NZ if treat as signed */
- int res, /* Desired table resolution */
-
- /* Callbacks to lookup the mdi table values */
- double (*input_curve) (void *cntx, int ch, double in_val),
- void (*md_table) (void *cntx, double *out_vals, double *in_vals),
- double (*output_curve)(void *cntx, int ch, double in_val),
- void *cntx /* Context to callbacks */
+ int id, /* Number of input dimensions */
+ int od, /* Number of output dimensions */
+ imdi_pixrep in, /* Input pixel representation */
+ int in_signed, /* Bit flag per channel, NZ if treat as signed */
+ imdi_pixrep out,/* Output pixel representation */
+ int out_signed, /* Bit flag per channel, NZ if treat as signed */
+ int res, /* Desired table resolution */
+
+ /* Callbacks to lookup the mdi table values */
+ double (*input_curve) (void *cntx, int ch, double in_val),
+ void (*md_table) (void *cntx, double *out_vals, double *in_vals),
+ double (*output_curve)(void *cntx, int ch, double in_val),
+ void *cntx /* Context to callbacks */
);
#endif /* IMDI_H */
-
-
-
-
-
-
diff --git a/gs/imdi/imdi_gen.c b/gs/imdi/imdi_gen.c
index a03da4fb4..cf5104e99 100644
--- a/gs/imdi/imdi_gen.c
+++ b/gs/imdi/imdi_gen.c
@@ -11,7 +11,7 @@
/*
* This module is invoked from the make system,
- * and generates all the versions and configurations of
+ * and generates all the versions and configurations of
* the IMDI kernel code. It includes all the generated
* files in imdi_k.h, which also contains a table
* so that the run time code knows what kernels
@@ -19,76 +19,75 @@
*/
/*
- Ideal grid resolutions for 8/16 bit precision calculations:
-
- There are a limited number of grid resolution and grid cells
- sub resolution values that work perfectly, and allow every possible
- input value to map to a precise interpolation value. For any
- system that deals with Lab data, it is also better if there is
- a grid point near a,b == 0, meaning that an odd grid size is
- preferable for 3 dimensional conversions. Reasonable memory
- usage is usuall somewhere between 100K and 1M entries for
- the grid table, limiting the maximum grid resolution.
- The following lists the some of the possible grid and sub grid
- resolutions in order of best to worst. (Fewer jumps is better).
-
-
- Grid Sub8 Round8 Sub16 Round16 Jumps
- 4 85 85 21845 21845 0
- 6 51 51 13107 13107 0
- 16 17 17 4369 4369 0
- 18 15 15 3855 3855 0
- 52 5 5 1285 1285 0
- 86 3 3 771 771 0
- 256 1 1 257 257 0
- 258 255 255 0
- 772 85 85 0
- 1286 51 51 0
- 3856 17 17 0
- 4370 15 15 0
- 13108 5 5 0
- 21846 3 3 0
- 65536 1 1 0
- 3 127.5 128 1
- 5 63.75 64 1
- 9 31.875 32 1
- 17 15.937 16 1
- 33 7.968 8 1
- 65 3.984 4 1
- 128 2.007 2 1
- 129 1.992 2 1
- 255 1.003 1 1
- 12 23.188 23 2
- 24 11.086 11 2
- 254 1.007 1 2
- 7 42.5 43 3
- 8 36.428 36 3
- 10 28.333 28 3
- 13 21.25 21 3
- 15 18.214 18 3
- 19 14.166 14 3
- 22 12.142 12 3
- 29 9.107 9 3
- 37 7.083 7 3
- 43 6.071 6 3
- 44 5.930 6 3
- 64 4.047 4 3
- 85 3.035 3 3
- 87 2.965 3 3
- 127 2.023 2 3
- 130 1.976 2 3
- 253 1.011 1 3
-
- [8 bit: sub = 255/(grid-1), jumps = abs((grid-1)*round(sub)-255)]
- [16 bit: sub = 65535/(grid-1), jumps = abs((grid-1)*round(sub)-65535)]
-
- The above takes into consideration the mapping of the sub-cell or
- simplex table resolution, but doesn't take into account the quantizing
- of the sub-cell weighting values into the range 0..256 or 0..65536.
-
- This will be best when round(sub) divides evenly into 256 or 65536,
- so grid resolutions of 3, 5, 9, 17, 33, 65, 128, 129, 255 may be the
- best choice for sort algorithm grid resolutions.
+ Ideal grid resolutions for 8/16 bit precision calculations:
+
+ There are a limited number of grid resolution and grid cells
+ sub resolution values that work perfectly, and allow every possible
+ input value to map to a precise interpolation value. For any
+ system that deals with Lab data, it is also better if there is
+ a grid point near a,b == 0, meaning that an odd grid size is
+ preferable for 3 dimensional conversions. Reasonable memory
+ usage is usuall somewhere between 100K and 1M entries for
+ the grid table, limiting the maximum grid resolution.
+ The following lists the some of the possible grid and sub grid
+ resolutions in order of best to worst. (Fewer jumps is better).
+
+ Grid Sub8 Round8 Sub16 Round16 Jumps
+ 4 85 85 21845 21845 0
+ 6 51 51 13107 13107 0
+ 16 17 17 4369 4369 0
+ 18 15 15 3855 3855 0
+ 52 5 5 1285 1285 0
+ 86 3 3 771 771 0
+ 256 1 1 257 257 0
+ 258 255 255 0
+ 772 85 85 0
+ 1286 51 51 0
+ 3856 17 17 0
+ 4370 15 15 0
+ 13108 5 5 0
+ 21846 3 3 0
+ 65536 1 1 0
+ 3 127.5 128 1
+ 5 63.75 64 1
+ 9 31.875 32 1
+ 17 15.937 16 1
+ 33 7.968 8 1
+ 65 3.984 4 1
+ 128 2.007 2 1
+ 129 1.992 2 1
+ 255 1.003 1 1
+ 12 23.188 23 2
+ 24 11.086 11 2
+ 254 1.007 1 2
+ 7 42.5 43 3
+ 8 36.428 36 3
+ 10 28.333 28 3
+ 13 21.25 21 3
+ 15 18.214 18 3
+ 19 14.166 14 3
+ 22 12.142 12 3
+ 29 9.107 9 3
+ 37 7.083 7 3
+ 43 6.071 6 3
+ 44 5.930 6 3
+ 64 4.047 4 3
+ 85 3.035 3 3
+ 87 2.965 3 3
+ 127 2.023 2 3
+ 130 1.976 2 3
+ 253 1.011 1 3
+
+ [8 bit: sub = 255/(grid-1), jumps = abs((grid-1)*round(sub)-255)]
+ [16 bit: sub = 65535/(grid-1), jumps = abs((grid-1)*round(sub)-65535)]
+
+ The above takes into consideration the mapping of the sub-cell or
+ simplex table resolution, but doesn't take into account the quantizing
+ of the sub-cell weighting values into the range 0..256 or 0..65536.
+
+ This will be best when round(sub) divides evenly into 256 or 65536,
+ so grid resolutions of 3, 5, 9, 17, 33, 65, 128, 129, 255 may be the
+ best choice for sort algorithm grid resolutions.
*/
@@ -112,46 +111,46 @@
static
gendesc descs[] = {
#ifdef TEST1
- {
- { 1, 0 }, /* Input dimension combinations */
- { 256, 0 }, /* Interpolation table resolutions */
- { 1, 0 }, /* Simplex table resolutions */
- { 1, 0 }, /* Output dimension combinations */
- {pixint16, 0 }, /* Input pixel representation */
- {pixint16, 0}, /* Output pixel representation */
- {forward, 0} /* Direction (not implemented) */
- }
+ {
+ { 1, 0 }, /* Input dimension combinations */
+ { 256, 0 }, /* Interpolation table resolutions */
+ { 1, 0 }, /* Simplex table resolutions */
+ { 1, 0 }, /* Output dimension combinations */
+ {pixint16, 0 }, /* Input pixel representation */
+ {pixint16, 0}, /* Output pixel representation */
+ {forward, 0} /* Direction (not implemented) */
+ }
#else
#ifndef FULL
- /* Normal */
- /* * means multiplies combination */
- /* + means lockstep with previous line */
- {
- { 1, 3, 4, 8, 0 }, /* Input dimension combinations */
- { 256, 33, 18, 5, 0 }, /* + Interpolation table resolutions */
- { 1, 8, 17, 1, 0 }, /* + Simplex table resolutions */
- { 1, 3, 4, 8, 0 }, /* * Output dimension combinations */
- {pixint8, pixint8, pixint16, 0 },
- /* Input pixel representation (determines precision) */
- {pixint8, pixint16, pixint16, 0 },
- /* + Output pixel representation */
- {forward, 0} /* * Direction (not implemented) */
- }
+ /* Normal */
+ /* * means multiplies combination */
+ /* + means lockstep with previous line */
+ {
+ { 1, 3, 4, 8, 0 }, /* Input dimension combinations */
+ { 256, 33, 18, 5, 0 }, /* + Interpolation table resolutions */
+ { 1, 8, 17, 1, 0 }, /* + Simplex table resolutions */
+ { 1, 3, 4, 8, 0 }, /* * Output dimension combinations */
+ {pixint8, pixint8, pixint16, 0 },
+ /* Input pixel representation (determines precision) */
+ {pixint8, pixint16, pixint16, 0 },
+ /* + Output pixel representation */
+ {forward, 0} /* * Direction (not implemented) */
+ }
#else
- /* Full set of combinations */
- /* * means multiplies combination */
- /* + means lockstep with previous line */
- {
- { 1, 3, 4, 5, 6, 7, 8, 0 }, /* Input dimension combinations */
- { 256, 33, 18, 16, 12, 8, 7, 0 }, /* + Min Interpolation table resolutions */
- { 1, 8, 17, 1, 1, 1, 1, 0 }, /* + Min Simplex table resolutions */
- { 1, 3, 4, 5, 6, 7, 8, 0 }, /* * Output dimension combinations */
- {pixint8, pixint8, pixint16, 0 },
- /* Input pixel representation (determines precision) */
- {pixint8, pixint16, pixint16, 0 },
- /* + Output pixel representation */
- {forward, 0} /* * Direction (not implemented) */
- }
+ /* Full set of combinations */
+ /* * means multiplies combination */
+ /* + means lockstep with previous line */
+ {
+ { 1, 3, 4, 5, 6, 7, 8, 0 }, /* Input dimension combinations */
+ { 256, 33, 18, 16, 12, 8, 7, 0 }, /* + Min Interpolation table resolutions */
+ { 1, 8, 17, 1, 1, 1, 1, 0 }, /* + Min Simplex table resolutions */
+ { 1, 3, 4, 5, 6, 7, 8, 0 }, /* * Output dimension combinations */
+ {pixint8, pixint8, pixint16, 0 },
+ /* Input pixel representation (determines precision) */
+ {pixint8, pixint16, pixint16, 0 },
+ /* + Output pixel representation */
+ {forward, 0} /* * Direction (not implemented) */
+ }
#endif
#endif /* TEST1 */
};
@@ -160,191 +159,191 @@ int set_genspec(genspec *gs, gendesc *gd, int comb, mach_arch *a);
void set_architecture(mach_arch *ar);
struct _knamestr {
- char name[100];
- char desc[100];
- struct _knamestr *next;
+ char name[100];
+ char desc[100];
+ struct _knamestr *next;
}; typedef struct _knamestr knamestr;
knamestr *
new_knamestr(char *name, char *desc) {
- knamestr *kn;
-
- if ((kn = (knamestr *)malloc(sizeof(knamestr))) == NULL) {
- fprintf(stderr,"new_knamestr malloc failed\n");
- exit(-1);
- }
- strcpy(kn->name, name);
- strcpy(kn->desc, desc);
- kn->next = NULL;
- return kn;
+ knamestr *kn;
+
+ if ((kn = (knamestr *)malloc(sizeof(knamestr))) == NULL) {
+ fprintf(stderr,"new_knamestr malloc failed\n");
+ exit(-1);
+ }
+ strcpy(kn->name, name);
+ strcpy(kn->desc, desc);
+ kn->next = NULL;
+ return kn;
}
void usage(void) {
- fprintf(stderr,"Generate imdi kernel code Version %s\n",ARGYLL_VERSION_STR);
- fprintf(stderr,"usage: imdi_gen [-i]\n");
- fprintf(stderr," -i Individial Files\n");
- exit(1);
+ fprintf(stderr,"Generate imdi kernel code Version %s\n",ARGYLL_VERSION_STR);
+ fprintf(stderr,"usage: imdi_gen [-i]\n");
+ fprintf(stderr," -i Individial Files\n");
+ exit(1);
}
int
main(int argc, char *argv[]) {
- int fa,nfa; /* argument we're looking at */
- int indiv = 0; /* Individual files */
- int rv;
- int dn, tnd;
- genspec gs;
- mach_arch ar;
- int ix = 1;
- knamestr *list = NULL, *lp;
- FILE *kcode; /* Kernel routine code file */
- FILE *kheader; /* Kernel routine header file */
-
- /* Process the arguments */
- for(fa = 1;fa < argc;fa++) {
- nfa = fa; /* skip to nfa if next argument is used */
- if (argv[fa][0] == '-') { /* Look for any flags */
- char *na = NULL; /* next argument after flag, null if none */
-
- if (argv[fa][2] != '\000')
- na = &argv[fa][2]; /* next is directly after flag */
- else {
- if ((fa+1) < argc) {
- if (argv[fa+1][0] != '-') {
- nfa = fa + 1;
- na = argv[nfa]; /* next is seperate non-flag argument */
- }
- }
- }
-
- if (argv[fa][1] == '?')
- usage();
-
- /* Individual files */
- else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') {
- indiv = 1;
- }
- else
- usage();
- } else
- break;
- }
-
- set_architecture(&ar);
-
- /* Open the file for kernel routine declaration header */
- if ((kheader = fopen("imdi_k.h", "w")) == NULL) {
- fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.h'\n");
- exit(-1);
- }
-
- if (!indiv) {
- if ((kcode = fopen("imdi_k.c", "w")) == NULL) {
- fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.c'\n");
- exit(-1);
- }
- }
-
- tnd = sizeof(descs)/sizeof(gendesc); /* Total number of descriptions */
+ int fa,nfa; /* argument we're looking at */
+ int indiv = 0; /* Individual files */
+ int rv;
+ int dn, tnd;
+ genspec gs;
+ mach_arch ar;
+ int ix = 1;
+ knamestr *list = NULL, *lp;
+ FILE *kcode; /* Kernel routine code file */
+ FILE *kheader; /* Kernel routine header file */
+
+ /* Process the arguments */
+ for(fa = 1;fa < argc;fa++) {
+ nfa = fa; /* skip to nfa if next argument is used */
+ if (argv[fa][0] == '-') { /* Look for any flags */
+ char *na = NULL; /* next argument after flag, null if none */
+
+ if (argv[fa][2] != '\000')
+ na = &argv[fa][2]; /* next is directly after flag */
+ else {
+ if ((fa+1) < argc) {
+ if (argv[fa+1][0] != '-') {
+ nfa = fa + 1;
+ na = argv[nfa]; /* next is seperate non-flag argument */
+ }
+ }
+ }
+
+ if (argv[fa][1] == '?')
+ usage();
+
+ /* Individual files */
+ else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') {
+ indiv = 1;
+ }
+ else
+ usage();
+ } else
+ break;
+ }
+
+ set_architecture(&ar);
+
+ /* Open the file for kernel routine declaration header */
+ if ((kheader = fopen("imdi_k.h", "w")) == NULL) {
+ fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.h'\n");
+ exit(-1);
+ }
+
+ if (!indiv) {
+ if ((kcode = fopen("imdi_k.c", "w")) == NULL) {
+ fprintf(stderr,"imdi_gen: unable to open file 'imdi_k.c'\n");
+ exit(-1);
+ }
+ }
+
+ tnd = sizeof(descs)/sizeof(gendesc); /* Total number of descriptions */
#ifdef VERBOSE
- printf("Number of descriptions = %d\n",tnd);
+ printf("Number of descriptions = %d\n",tnd);
#endif /* VERBOSE */
- fprintf(kheader,"/* Declarations for all the generated kernel functions */\n");
- fprintf(kheader,"/* This file is generated by imdi_gen */\n");
- fprintf(kheader,"\n");
+ fprintf(kheader,"/* Declarations for all the generated kernel functions */\n");
+ fprintf(kheader,"/* This file is generated by imdi_gen */\n");
+ fprintf(kheader,"\n");
- /* For all the descriptions */
- for (dn = 0; dn < tnd; dn++) {
- int cb, ncb;
+ /* For all the descriptions */
+ for (dn = 0; dn < tnd; dn++) {
+ int cb, ncb;
- for (cb = 0, ncb = 1; cb < ncb; cb++) {
- char ofname[100];
+ for (cb = 0, ncb = 1; cb < ncb; cb++) {
+ char ofname[100];
- /* Compute generate spec */
- ncb = set_genspec(&gs, &descs[dn], cb, &ar);
+ /* Compute generate spec */
+ ncb = set_genspec(&gs, &descs[dn], cb, &ar);
- if (indiv) {
- if ((kcode = fopen(ofname, "w")) == NULL) {
- fprintf(stderr,"imdi_gen: unable to open file '%s'\n",ofname);
- exit(-1);
- }
- }
+ if (indiv) {
+ if ((kcode = fopen(ofname, "w")) == NULL) {
+ fprintf(stderr,"imdi_gen: unable to open file '%s'\n",ofname);
+ exit(-1);
+ }
+ }
- /* Generate it */
+ /* Generate it */
#ifdef TEST1
- rv = gen_c_kernel(&gs, &ar, kcode, 99); ix++;
+ rv = gen_c_kernel(&gs, &ar, kcode, 99); ix++;
#else
- rv = gen_c_kernel(&gs, &ar, kcode, ix++);
+ rv = gen_c_kernel(&gs, &ar, kcode, ix++);
#endif
- if (rv != 0) {
- fprintf(stderr,"gen_c_kernel failed with %d\n",rv);
- exit(-1);
- }
-
- /* Add the name to the list */
- if (list == NULL)
- lp = list = new_knamestr(gs.kname, gs.kdesc);
- else {
- lp->next = new_knamestr(gs.kname, gs.kdesc);
- lp = lp->next;
- }
- if (indiv) {
- if (fclose(kcode) != 0) {
- fprintf(stderr,"imdi_gen: unable to close file '%s'\n",ofname);
- exit(-1);
- }
- }
- }
- }
-
- /* Include the kernel functions in the header file */
- if (indiv) {
- for(lp = list; lp != NULL; lp = lp->next) {
- fprintf(kheader,"#include \"%s_%s.c\"\n",lp->name,lp->desc);
- }
- } else {
- fprintf(kheader,"#include \"imdi_k.c\" /* All the kernel code */\n");
- }
- fprintf(kheader,"\n");
-
- /* Output function table */
-
- fprintf(kheader,
- "struct {\n"
- " void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix);\n"
- " void (*gen)(genspec *g);\n"
- " void (*tab)(tabspec *t);\n"
- "} ktable[%d] = {\n",ix-1);
-
- for(lp = list; lp != NULL; lp = lp->next) {
- fprintf(kheader,"\t{ %s, %s_gen, %s_tab }%s\n", lp->name, lp->name, lp->name,
- lp->next != NULL ? "," : "");
- }
- fprintf(kheader,"};\n");
- fprintf(kheader,"\n");
- fprintf(kheader,"int no_kfuncs = %d;\n",ix-1);
- fprintf(kheader,"\n");
-
- if (!indiv) {
- if (fclose(kcode) != 0) {
- fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.c'\n");
- exit(-1);
- }
- }
-
- if (fclose(kheader) != 0) {
- fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.h'\n");
- exit(-1);
- }
-
- /* Free the kname list */
- for(lp = list; lp != NULL;) {
- char *p = (char *)lp;
- lp = lp->next;
- free(p);
- }
-
- return 0;
+ if (rv != 0) {
+ fprintf(stderr,"gen_c_kernel failed with %d\n",rv);
+ exit(-1);
+ }
+
+ /* Add the name to the list */
+ if (list == NULL)
+ lp = list = new_knamestr(gs.kname, gs.kdesc);
+ else {
+ lp->next = new_knamestr(gs.kname, gs.kdesc);
+ lp = lp->next;
+ }
+ if (indiv) {
+ if (fclose(kcode) != 0) {
+ fprintf(stderr,"imdi_gen: unable to close file '%s'\n",ofname);
+ exit(-1);
+ }
+ }
+ }
+ }
+
+ /* Include the kernel functions in the header file */
+ if (indiv) {
+ for(lp = list; lp != NULL; lp = lp->next) {
+ fprintf(kheader,"#include \"%s_%s.c\"\n",lp->name,lp->desc);
+ }
+ } else {
+ fprintf(kheader,"#include \"imdi_k.c\" /* All the kernel code */\n");
+ }
+ fprintf(kheader,"\n");
+
+ /* Output function table */
+
+ fprintf(kheader,
+ "struct {\n"
+ " void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix);\n"
+ " void (*gen)(genspec *g);\n"
+ " void (*tab)(tabspec *t);\n"
+ "} ktable[%d] = {\n",ix-1);
+
+ for(lp = list; lp != NULL; lp = lp->next) {
+ fprintf(kheader,"\t{ %s, %s_gen, %s_tab }%s\n", lp->name, lp->name, lp->name,
+ lp->next != NULL ? "," : "");
+ }
+ fprintf(kheader,"};\n");
+ fprintf(kheader,"\n");
+ fprintf(kheader,"int no_kfuncs = %d;\n",ix-1);
+ fprintf(kheader,"\n");
+
+ if (!indiv) {
+ if (fclose(kcode) != 0) {
+ fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.c'\n");
+ exit(-1);
+ }
+ }
+
+ if (fclose(kheader) != 0) {
+ fprintf(stderr,"imdi_gen: unable to close file 'imdi_k.h'\n");
+ exit(-1);
+ }
+
+ /* Free the kname list */
+ for(lp = list; lp != NULL;) {
+ char *p = (char *)lp;
+ lp = lp->next;
+ free(p);
+ }
+
+ return 0;
}
void translate_pixrep(pixlayout *pl, char **desc, int *prec, imdi_pixrep rep, int dim, mach_arch *a);
@@ -358,92 +357,92 @@ gendesc *gd, /* Input description */
int comb, /* Combination index */
mach_arch *a /* Machine architecture */
) {
- int nc = 1; /* Number of combinations */
- int nidc, id; /* Number of input dimension combinations, current index */
- int nodc, od; /* Number of output dimension combinations, current index */
- int nirc, ir; /* Number of input representation combinations, current index */
- int norc, or; /* Number of output representation combinations, current index */
- int ndc, dir; /* Number of direction combinations, current index */
-
- /* Figure out how many combinations there are */
- for (nidc = 0; gd->idcombs[nidc] != 0; nidc++) /* Input dimension */
- ;
- nc *= nidc;
- for (nodc = 0; gd->odcombs[nodc] != 0; nodc++) /* Output dimension */
- ;
- nc *= nodc;
- for (nirc = 0; gd->incombs[nirc] != 0; nirc++) /* Input representation */
- ;
- nc *= nirc;
- for (norc = 0; gd->outcombs[norc] != 0; norc++) /* Output representation */
- ;
- if (nirc != norc) {
- fprintf(stderr,"imdi_gen: Must be equal numberof input and output representations\n");
- exit(-1);
- }
-
- for (ndc = 0; gd->dircombs[ndc] != 0; ndc++) /* Direction */
- ;
- nc *= ndc;
-
- if (comb < nc) { /* If we are within a legal combination */
- int iprec, oprec;
- char *idesc, *odesc; /* Representation descriptions */
- char *ddesc; /* Direction description */
-
- id = comb % nidc;
- comb /= nidc;
- od = comb % nodc;
- comb /= nodc;
- ir = comb % nirc;
- comb /= nirc;
- or = ir; /* In and out combs track together */
- dir = comb % ndc;
- comb /= ndc;
+ int nc = 1; /* Number of combinations */
+ int nidc, id; /* Number of input dimension combinations, current index */
+ int nodc, od; /* Number of output dimension combinations, current index */
+ int nirc, ir; /* Number of input representation combinations, current index */
+ int norc, or; /* Number of output representation combinations, current index */
+ int ndc, dir; /* Number of direction combinations, current index */
+
+ /* Figure out how many combinations there are */
+ for (nidc = 0; gd->idcombs[nidc] != 0; nidc++) /* Input dimension */
+ ;
+ nc *= nidc;
+ for (nodc = 0; gd->odcombs[nodc] != 0; nodc++) /* Output dimension */
+ ;
+ nc *= nodc;
+ for (nirc = 0; gd->incombs[nirc] != 0; nirc++) /* Input representation */
+ ;
+ nc *= nirc;
+ for (norc = 0; gd->outcombs[norc] != 0; norc++) /* Output representation */
+ ;
+ if (nirc != norc) {
+ fprintf(stderr,"imdi_gen: Must be equal numberof input and output representations\n");
+ exit(-1);
+ }
+
+ for (ndc = 0; gd->dircombs[ndc] != 0; ndc++) /* Direction */
+ ;
+ nc *= ndc;
+
+ if (comb < nc) { /* If we are within a legal combination */
+ int iprec, oprec;
+ char *idesc, *odesc; /* Representation descriptions */
+ char *ddesc; /* Direction description */
+
+ id = comb % nidc;
+ comb /= nidc;
+ od = comb % nodc;
+ comb /= nodc;
+ ir = comb % nirc;
+ comb /= nirc;
+ or = ir; /* In and out combs track together */
+ dir = comb % ndc;
+ comb /= ndc;
#ifdef VERBOSE
- printf("Combination id = %d, od = %d, ir = %d, or = %d, dir = %d\n",
- id,od,ir,or,dir);
+ printf("Combination id = %d, od = %d, ir = %d, or = %d, dir = %d\n",
+ id,od,ir,or,dir);
#endif /* VERBOSE */
- gs->id = gd->idcombs[id]; /* Input dimensions */
- gs->itres = gd->itres[id]; /* Interpolation table resolution */
- gs->stres = gd->stres[id]; /* Simplex table resolution */
- gs->od = gd->odcombs[od]; /* Output dimensions */
+ gs->id = gd->idcombs[id]; /* Input dimensions */
+ gs->itres = gd->itres[id]; /* Interpolation table resolution */
+ gs->stres = gd->stres[id]; /* Simplex table resolution */
+ gs->od = gd->odcombs[od]; /* Output dimensions */
- if (gs->id > IXDI) {
- fprintf(stderr,"imdi_gen: Input dimension %d exceeds limit %d\n",gs->id,IXDI);
- exit(-1);
- }
- if (gs->od > IXDO) {
- fprintf(stderr,"imdi_gen: Output dimension %d exceeds limit %d\n",gs->od,IXDO);
- exit(-1);
- }
- /* Input representation */
- gs->irep = gd->incombs[ir]; /* Keep a copy of this */
- translate_pixrep(&gs->in, &idesc, &iprec, gd->incombs[ir], gs->id, a);
- gs->in_signed = 0x0; /* Not used during generation, used at runtime setup */
+ if (gs->id > IXDI) {
+ fprintf(stderr,"imdi_gen: Input dimension %d exceeds limit %d\n",gs->id,IXDI);
+ exit(-1);
+ }
+ if (gs->od > IXDO) {
+ fprintf(stderr,"imdi_gen: Output dimension %d exceeds limit %d\n",gs->od,IXDO);
+ exit(-1);
+ }
+ /* Input representation */
+ gs->irep = gd->incombs[ir]; /* Keep a copy of this */
+ translate_pixrep(&gs->in, &idesc, &iprec, gd->incombs[ir], gs->id, a);
+ gs->in_signed = 0x0; /* Not used during generation, used at runtime setup */
- /* Output representation */
- gs->orep = gd->outcombs[or]; /* Keep a copy of this */
- translate_pixrep(&gs->out, &odesc, &oprec, gd->outcombs[or], gs->od, a);
- gs->out_signed = 0x0; /* Not used during generation, used at runtime setup */
+ /* Output representation */
+ gs->orep = gd->outcombs[or]; /* Keep a copy of this */
+ translate_pixrep(&gs->out, &odesc, &oprec, gd->outcombs[or], gs->od, a);
+ gs->out_signed = 0x0; /* Not used during generation, used at runtime setup */
- /* Make native precision the smaller of input and output representation */
- gs->prec = iprec < oprec ? iprec : oprec;
+ /* Make native precision the smaller of input and output representation */
+ gs->prec = iprec < oprec ? iprec : oprec;
- gs->dir = gd->dircombs[dir]; /* Direction */
+ gs->dir = gd->dircombs[dir]; /* Direction */
- ddesc = gs->dir == backward ? "b" : "f"; /* Direction description */
+ ddesc = gs->dir == backward ? "b" : "f"; /* Direction description */
#ifdef VERBOSE
- printf("translates to prec = %d, id = %d, od = %d, itres %d, stdres %d\n",
- gs->prec,gs->id,gs->od,gs->itres,gs->stres);
+ printf("translates to prec = %d, id = %d, od = %d, itres %d, stdres %d\n",
+ gs->prec,gs->id,gs->od,gs->itres,gs->stres);
#endif /* VERBOSE */
- /* Create a concise description string */
- sprintf(gs->kdesc,"%d_%d_%s_%s_%s", gs->id, gs->od, idesc, odesc, ddesc);
- }
- return nc;
+ /* Create a concise description string */
+ sprintf(gs->kdesc,"%d_%d_%s_%s_%s", gs->id, gs->od, idesc, odesc, ddesc);
+ }
+ return nc;
}
void
@@ -455,94 +454,94 @@ imdi_pixrep rep, /* Representation to be translated */
int dim, /* Number of dimensions (values/pixel) */
mach_arch *a /* Machine architecture */
) {
- switch (rep) {
-
- case pixint8: { /* 8 Bits per value, pixel interleaved, no padding */
- int i;
-
- /* Could optimise this to packed for dim == 4 ~~~~ */
-
- pl->pint = 1; /* pixel interleaved */
- pl->packed = 0; /* Not packed */
-
- for (i = 0; i < dim; i++) {
- pl->bpch[i] = 8; /* Bits per channel */
- pl->chi[i] = dim; /* Channel increment */
- pl->bov[i] = 0; /* Bit offset to value within channel */
- pl->bpv[i] = 8; /* Bits per value within channel */
- }
-
- if (prec != NULL)
- *prec = 8; /* Basic 8 bit precision */
- if (desc != NULL)
- *desc = "i8"; /* Interleaved 8 bit */
- } break;
-
- case planeint8: { /* 8 bits per value, plane interleaved */
- int i;
-
- pl->pint = 0; /* Not pixel interleaved */
- pl->packed = 0; /* Not packed */
-
- for (i = 0; i < dim; i++) {
- pl->bpch[i] = 8; /* Bits per channel */
- pl->chi[i] = 1; /* Channel increment */
- pl->bov[i] = 0; /* Bit offset to value within channel */
- pl->bpv[i] = 8; /* Bits per value within channel */
- }
-
- if (prec != NULL)
- *prec = 8; /* Basic 8 bit precision */
- if (desc != NULL)
- *desc = "p8"; /* Planar 8 bit */
-
- } break;
-
- case pixint16: { /* 16 Bits per value, pixel interleaved, no padding */
- int i;
-
- /* Could optimise this to packed for dim == 4 ~~~~ */
-
- pl->pint = 1; /* pixel interleaved */
- pl->packed = 0; /* Not packed */
-
- for (i = 0; i < dim; i++) {
- pl->bpch[i] = 16; /* Bits per channel */
- pl->chi[i] = dim; /* Channel increment */
- pl->bov[i] = 0; /* Bit offset to value within channel */
- pl->bpv[i] = 16; /* Bits per value within channel */
- }
-
- if (prec != NULL)
- *prec = 16; /* Basic 8 bit precision */
- if (desc != NULL)
- *desc = "i16"; /* Interleaved 16 bit */
- } break;
-
- case planeint16: { /* 16 bits per value, plane interleaved */
- int i;
-
- pl->pint = 0; /* Not pixel interleaved */
- pl->packed = 0; /* Not packed */
-
- for (i = 0; i < dim; i++) {
- pl->bpch[i] = 16; /* Bits per channel */
- pl->chi[i] = 1; /* Channel increment */
- pl->bov[i] = 0; /* Bit offset to value within channel */
- pl->bpv[i] = 16; /* Bits per value within channel */
- }
-
- if (prec != NULL)
- *prec = 16; /* Basic 8 bit precision */
-
- if (desc != NULL)
- *desc = "p16"; /* Planar 8 bit */
- } break;
-
- default: {
- fprintf(stderr,"Warning: Unknown pixel representation %d\n",rep);
- } break;
- }
+ switch (rep) {
+
+ case pixint8: { /* 8 Bits per value, pixel interleaved, no padding */
+ int i;
+
+ /* Could optimise this to packed for dim == 4 ~~~~ */
+
+ pl->pint = 1; /* pixel interleaved */
+ pl->packed = 0; /* Not packed */
+
+ for (i = 0; i < dim; i++) {
+ pl->bpch[i] = 8; /* Bits per channel */
+ pl->chi[i] = dim; /* Channel increment */
+ pl->bov[i] = 0; /* Bit offset to value within channel */
+ pl->bpv[i] = 8; /* Bits per value within channel */
+ }
+
+ if (prec != NULL)
+ *prec = 8; /* Basic 8 bit precision */
+ if (desc != NULL)
+ *desc = "i8"; /* Interleaved 8 bit */
+ } break;
+
+ case planeint8: { /* 8 bits per value, plane interleaved */
+ int i;
+
+ pl->pint = 0; /* Not pixel interleaved */
+ pl->packed = 0; /* Not packed */
+
+ for (i = 0; i < dim; i++) {
+ pl->bpch[i] = 8; /* Bits per channel */
+ pl->chi[i] = 1; /* Channel increment */
+ pl->bov[i] = 0; /* Bit offset to value within channel */
+ pl->bpv[i] = 8; /* Bits per value within channel */
+ }
+
+ if (prec != NULL)
+ *prec = 8; /* Basic 8 bit precision */
+ if (desc != NULL)
+ *desc = "p8"; /* Planar 8 bit */
+
+ } break;
+
+ case pixint16: { /* 16 Bits per value, pixel interleaved, no padding */
+ int i;
+
+ /* Could optimise this to packed for dim == 4 ~~~~ */
+
+ pl->pint = 1; /* pixel interleaved */
+ pl->packed = 0; /* Not packed */
+
+ for (i = 0; i < dim; i++) {
+ pl->bpch[i] = 16; /* Bits per channel */
+ pl->chi[i] = dim; /* Channel increment */
+ pl->bov[i] = 0; /* Bit offset to value within channel */
+ pl->bpv[i] = 16; /* Bits per value within channel */
+ }
+
+ if (prec != NULL)
+ *prec = 16; /* Basic 8 bit precision */
+ if (desc != NULL)
+ *desc = "i16"; /* Interleaved 16 bit */
+ } break;
+
+ case planeint16: { /* 16 bits per value, plane interleaved */
+ int i;
+
+ pl->pint = 0; /* Not pixel interleaved */
+ pl->packed = 0; /* Not packed */
+
+ for (i = 0; i < dim; i++) {
+ pl->bpch[i] = 16; /* Bits per channel */
+ pl->chi[i] = 1; /* Channel increment */
+ pl->bov[i] = 0; /* Bit offset to value within channel */
+ pl->bpv[i] = 16; /* Bits per value within channel */
+ }
+
+ if (prec != NULL)
+ *prec = 16; /* Basic 8 bit precision */
+
+ if (desc != NULL)
+ *desc = "p16"; /* Planar 8 bit */
+ } break;
+
+ default: {
+ fprintf(stderr,"Warning: Unknown pixel representation %d\n",rep);
+ } break;
+ }
}
/* Initialse the aritecture structure properly */
@@ -550,112 +549,111 @@ void
set_architecture(
mach_arch *ar
) {
- unsigned long etest = 0xff;
+ unsigned long etest = 0xff;
- if (*((unsigned char *)&etest) == 0xff) {
- ar->bigend = 0; /* Little endian */
- } else {
- ar->bigend = 1; /* Big endian endian */
- }
+ if (*((unsigned char *)&etest) == 0xff) {
+ ar->bigend = 0; /* Little endian */
+ } else {
+ ar->bigend = 1; /* Big endian endian */
+ }
#ifdef __ppc__ /* Section tunable for PowerPC */
- ar->uwa = 0; /* Use wide memory access */
- ar->shfm = 0; /* Use shifts to mask values */
- ar->oscale = 8; /* Has scaled indexing up to * 8 */
- ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */
- ar->nords = 3; /* Number of ord types */
- ar->natord = 2; /* Most natural type (assume unsigned int) */
- ar->nints = 3; /* Number of int types */
- ar->natint = 2; /* Most natural type (assume int) */
+ ar->uwa = 0; /* Use wide memory access */
+ ar->shfm = 0; /* Use shifts to mask values */
+ ar->oscale = 8; /* Has scaled indexing up to * 8 */
+ ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */
+ ar->nords = 3; /* Number of ord types */
+ ar->natord = 2; /* Most natural type (assume unsigned int) */
+ ar->nints = 3; /* Number of int types */
+ ar->natint = 2; /* Most natural type (assume int) */
- ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */
+ ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */
- ar->ords[0].bits = 8 * sizeof(unsigned char);
- ar->ords[0].name = "unsigned char";
- ar->ords[0].align = 1;
+ ar->ords[0].bits = 8 * sizeof(unsigned char);
+ ar->ords[0].name = "unsigned char";
+ ar->ords[0].align = 1;
- ar->ords[1].bits = 8 * sizeof(unsigned short);
- ar->ords[1].name = "unsigned short";
- ar->ords[1].align = 1;
+ ar->ords[1].bits = 8 * sizeof(unsigned short);
+ ar->ords[1].name = "unsigned short";
+ ar->ords[1].align = 1;
- ar->ords[2].bits = 8 * sizeof(unsigned int);
- ar->ords[2].name = "unsigned int";
- ar->ords[2].align = 1;
+ ar->ords[2].bits = 8 * sizeof(unsigned int);
+ ar->ords[2].name = "unsigned int";
+ ar->ords[2].align = 1;
#ifdef ALLOW64
- ar->ords[3].bits = 8 * sizeof(unsigned longlong);
- ar->ords[3].name = "unsigned " str_longlong ;
- ar->ords[3].align = 0;
+ ar->ords[3].bits = 8 * sizeof(unsigned longlong);
+ ar->ords[3].name = "unsigned " str_longlong ;
+ ar->ords[3].align = 0;
#endif /* ALLOW64 */
- ar->ints[0].bits = 8 * sizeof(signed char);
- ar->ints[0].name = "signed char";
- ar->ints[0].align = 1;
+ ar->ints[0].bits = 8 * sizeof(signed char);
+ ar->ints[0].name = "signed char";
+ ar->ints[0].align = 1;
- ar->ints[1].bits = 8 * sizeof(short);
- ar->ints[1].name = "short";
- ar->ints[1].align = 1;
+ ar->ints[1].bits = 8 * sizeof(short);
+ ar->ints[1].name = "short";
+ ar->ints[1].align = 1;
- ar->ints[2].bits = 8 * sizeof(int);
- ar->ints[2].name = "int";
- ar->ints[2].align = 1;
+ ar->ints[2].bits = 8 * sizeof(int);
+ ar->ints[2].name = "int";
+ ar->ints[2].align = 1;
#ifdef ALLOW64
- ar->ints[3].bits = 8 * sizeof(longlong);
- ar->ints[3].name = str_longlong ;
- ar->ints[3].align = 0;
+ ar->ints[3].bits = 8 * sizeof(longlong);
+ ar->ints[3].name = str_longlong ;
+ ar->ints[3].align = 0;
#endif /* ALLOW64 */
-
#else /* Currently assume x86 type */
- ar->uwa = 0; /* Use wide memory access */
- ar->shfm = 0; /* Use shifts to mask values */
- ar->oscale = 8; /* Has scaled indexing up to * 8 */
- ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */
+ ar->uwa = 0; /* Use wide memory access */
+ ar->shfm = 0; /* Use shifts to mask values */
+ ar->oscale = 8; /* Has scaled indexing up to * 8 */
+ ar->smmul = 0; /* Doesn't have fast small multiply for index scaling */
/* ~~99 */
- ar->nords = 3; /* Number of ord types */
- ar->natord = 2; /* Most natural type (assume unsigned int) */
- ar->nints = 3; /* Number of int types */
- ar->natint = 2; /* Most natural type (assume int) */
+ ar->nords = 3; /* Number of ord types */
+ ar->natord = 2; /* Most natural type (assume unsigned int) */
+ ar->nints = 3; /* Number of int types */
+ ar->natint = 2; /* Most natural type (assume int) */
- ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */
+ ar->pbits = sizeof(void *) * 8; /* Number of bits in a pointer */
- ar->ords[0].bits = 8 * sizeof(unsigned char);
- ar->ords[0].name = "unsigned char";
- ar->ords[0].align = 1;
+ ar->ords[0].bits = 8 * sizeof(unsigned char);
+ ar->ords[0].name = "unsigned char";
+ ar->ords[0].align = 1;
- ar->ords[1].bits = 8 * sizeof(unsigned short);
- ar->ords[1].name = "unsigned short";
- ar->ords[1].align = 1;
+ ar->ords[1].bits = 8 * sizeof(unsigned short);
+ ar->ords[1].name = "unsigned short";
+ ar->ords[1].align = 1;
- ar->ords[2].bits = 8 * sizeof(unsigned int);
- ar->ords[2].name = "unsigned int";
- ar->ords[2].align = 1;
+ ar->ords[2].bits = 8 * sizeof(unsigned int);
+ ar->ords[2].name = "unsigned int";
+ ar->ords[2].align = 1;
#ifdef ALLOW64
- ar->ords[3].bits = 8 * sizeof(unsigned longlong);
- ar->ords[3].name = "unsigned " str_longlong ;
- ar->ords[3].align = 0;
+ ar->ords[3].bits = 8 * sizeof(unsigned longlong);
+ ar->ords[3].name = "unsigned " str_longlong ;
+ ar->ords[3].align = 0;
#endif /* ALLOW64 */
- ar->ints[0].bits = 8 * sizeof(signed char);
- ar->ints[0].name = "signed char";
- ar->ints[0].align = 1;
+ ar->ints[0].bits = 8 * sizeof(signed char);
+ ar->ints[0].name = "signed char";
+ ar->ints[0].align = 1;
- ar->ints[1].bits = 8 * sizeof(short);
- ar->ints[1].name = "short";
- ar->ints[1].align = 1;
+ ar->ints[1].bits = 8 * sizeof(short);
+ ar->ints[1].name = "short";
+ ar->ints[1].align = 1;
- ar->ints[2].bits = 8 * sizeof(int);
- ar->ints[2].name = "int";
- ar->ints[2].align = 1;
+ ar->ints[2].bits = 8 * sizeof(int);
+ ar->ints[2].name = "int";
+ ar->ints[2].align = 1;
#ifdef ALLOW64
- ar->ints[3].bits = 8 * sizeof(longlong);
- ar->ints[3].name = str_longlong ;
- ar->ints[3].align = 0;
+ ar->ints[3].bits = 8 * sizeof(longlong);
+ ar->ints[3].name = str_longlong ;
+ ar->ints[3].align = 0;
#endif /* ALLOW64 */
#endif /* Processor Architecture */
diff --git a/gs/imdi/imdi_gen.h b/gs/imdi/imdi_gen.h
index cc9951b6e..ee0fde214 100644
--- a/gs/imdi/imdi_gen.h
+++ b/gs/imdi/imdi_gen.h
@@ -16,9 +16,9 @@
#include "arch.h"
typedef enum {
- invalid_dir = 0,
- forward = 1, /* 8 Bits per value, pixel interleaved, no padding */
- backward = 2 /* 8 bits per value, plane interleaved */
+ invalid_dir = 0,
+ forward = 1, /* 8 Bits per value, pixel interleaved, no padding */
+ backward = 2 /* 8 bits per value, plane interleaved */
} imdi_dir;
/* -------------------------------------------------- */
@@ -27,13 +27,13 @@ typedef enum {
/* This sructure allows a series of related kernels to be generated, */
/* the only variation being the number of input and output dimensions. */
typedef struct {
- int idcombs[10]; /* Input dimension combinations (0 at end) */
- int itres[10]; /* Interpolation table resolutions for each input dimension */
- int stres[10]; /* Simplex table resolutions for each input dimension */
- int odcombs[10]; /* Output dimensions combinations (0 at end) */
- imdi_pixrep incombs[10];/* Input pixel representation combinations */
- imdi_pixrep outcombs[10]; /* Output pixel representation combinations */
- imdi_dir dircombs[10]; /* Direction combinations (not implemented) */
+ int idcombs[10]; /* Input dimension combinations (0 at end) */
+ int itres[10]; /* Interpolation table resolutions for each input dimension */
+ int stres[10]; /* Simplex table resolutions for each input dimension */
+ int odcombs[10]; /* Output dimensions combinations (0 at end) */
+ imdi_pixrep incombs[10];/* Input pixel representation combinations */
+ imdi_pixrep outcombs[10]; /* Output pixel representation combinations */
+ imdi_dir dircombs[10]; /* Direction combinations (not implemented) */
} gendesc;
/* -------------------------------------------------- */
@@ -58,34 +58,34 @@ typedef struct {
/* will be obeyed for each input value. */
typedef struct {
- int bpch[IXDIDO]; /* Bits per channel read (must be divisible by 8) */
- int chi[IXDIDO]; /* channel increment in multiples of bpch[] (0 == dimensionality) */
- int bov[IXDIDO]; /* Bit offset to value within channel */
- int bpv[IXDIDO]; /* Bits per value within channel */
- int pint; /* Flag - nonz if pixel interleaved (ie. reads from successice locations) */
- int packed; /* Flag - nonz if all channels are packed into a single read */
+ int bpch[IXDIDO]; /* Bits per channel read (must be divisible by 8) */
+ int chi[IXDIDO]; /* channel increment in multiples of bpch[] (0 == dimensionality) */
+ int bov[IXDIDO]; /* Bit offset to value within channel */
+ int bpv[IXDIDO]; /* Bits per value within channel */
+ int pint; /* Flag - nonz if pixel interleaved (ie. reads from successice locations) */
+ int packed; /* Flag - nonz if all channels are packed into a single read */
} pixlayout;
/* Structure that specifies the configuration of a generated interpolation kernel. */
typedef struct {
- /* Input to code generator */
- int prec; /* Basic precision:- either 8 or 16 bits, determined by irep */
- int id; /* Number of input dimensions */
- int od; /* Number of output dimensions */
- imdi_pixrep irep;/* Input pixel representation */
- imdi_pixrep orep;/* Output pixel representation */
- int in_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */
- int out_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */
- pixlayout in; /* Input pixel layout */
- pixlayout out; /* Output pixel layout */
- int dir; /* forward or backward (not implemented */
- int itres; /* Interpolation table resolution */
- int stres; /* Simplex table resolution */
-
- /* Returned value */
- char kkeys[100]; /* Kernel keys */
- char kdesc[100]; /* At genspec time */
- char kname[100]; /* At generation time */
+ /* Input to code generator */
+ int prec; /* Basic precision:- either 8 or 16 bits, determined by irep */
+ int id; /* Number of input dimensions */
+ int od; /* Number of output dimensions */
+ imdi_pixrep irep;/* Input pixel representation */
+ imdi_pixrep orep;/* Output pixel representation */
+ int in_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */
+ int out_signed; /* Bit flag per channel, NZ if treat as signed (runtime setup) */
+ pixlayout in; /* Input pixel layout */
+ pixlayout out; /* Output pixel layout */
+ int dir; /* forward or backward (not implemented */
+ int itres; /* Interpolation table resolution */
+ int stres; /* Simplex table resolution */
+
+ /* Returned value */
+ char kkeys[100]; /* Kernel keys */
+ char kdesc[100]; /* At genspec time */
+ char kname[100]; /* At generation time */
} genspec;
/* Supported code generators */
@@ -95,14 +95,3 @@ int gen_c_kernel(genspec *g, mach_arch *a, FILE *fp, int index); /* The 'C' code
/* asm, MMX, etc. generators declarations go here ! */
#endif /* IMDI_GEN_H */
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gs/imdi/imdi_imp.h b/gs/imdi/imdi_imp.h
index 05cd11010..cc0b73267 100644
--- a/gs/imdi/imdi_imp.h
+++ b/gs/imdi/imdi_imp.h
@@ -22,75 +22,73 @@
#endif
#define ALLOW64 /* Allow declarations but not use of 64 bit types */
- /* Enabling must be done in architecture setup */
+ /* Enabling must be done in architecture setup */
#undef USE64 /* Use 64 bit, even on architectures where it's */
- /* not a native size. ALLOW64 must be defined */
+ /* not a native size. ALLOW64 must be defined */
/* Private run time implementation definitions */
typedef struct {
- /* Table data */
- void *in_tables[IXDI]; /* Input dimension input lookup tables */
+ /* Table data */
+ void *in_tables[IXDI]; /* Input dimension input lookup tables */
void *sw_table; /* Simplex weighting lookup table */
void *im_table; /* Interpolation Multi-dimensional lookup table */
- void *out_tables[IXDO]; /* Output dimension output lookup tables */
- int nintabs; /* Number of input tables */
- int nouttabs; /* Number of output tables */
+ void *out_tables[IXDO]; /* Output dimension output lookup tables */
+ int nintabs; /* Number of input tables */
+ int nouttabs; /* Number of output tables */
} imdi_imp;
-
/* ------------------------------------------------------- */
/* Macros combination counter */
/* Declare the counter name nn, combinations out of total */
/* Maximum combinations is DI+2 */
#define COMBO(nn, comb, total) \
- int nn[IXDI+2]; /* counter value */ \
- int nn##_cmb = (comb); /* number of combinations*/ \
- int nn##_tot = (total); /* out of total possible */ \
- int nn##_e /* dimension index */
+ int nn[IXDI+2]; /* counter value */ \
+ int nn##_cmb = (comb); /* number of combinations*/ \
+ int nn##_tot = (total); /* out of total possible */ \
+ int nn##_e /* dimension index */
/* Set total to new setting */
#define CB_SETT(nn, total) \
- nn##_tot = (total) /* total possible */
+ nn##_tot = (total) /* total possible */
/* Set combinations to new setting */
#define CB_SETC(nn, comb) \
- nn##_cmb = (comb) /* number of combinations*/
+ nn##_cmb = (comb) /* number of combinations*/
/* Set the counter to its initial value */
#define CB_INIT(nn) \
{ \
- for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \
- nn[nn##_e] = nn##_cmb-nn##_e-1; \
- nn##_e = 0; \
+ for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \
+ nn[nn##_e] = nn##_cmb-nn##_e-1; \
+ nn##_e = 0; \
}
/* Increment the counter value */
#define CB_INC(nn) \
{ \
- for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \
- nn[nn##_e]++; \
- if (nn[nn##_e] < (nn##_tot-nn##_e)) { \
- int nn##_ee; /* No carry */ \
- for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \
- nn[nn##_ee] = nn[nn##_ee+1] + 1; \
- break; \
- } \
- } \
+ for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \
+ nn[nn##_e]++; \
+ if (nn[nn##_e] < (nn##_tot-nn##_e)) { \
+ int nn##_ee; /* No carry */ \
+ for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \
+ nn[nn##_ee] = nn[nn##_ee+1] + 1; \
+ break; \
+ } \
+ } \
}
/* After increment, expression is TRUE if counter is done */
#define CB_DONE(nn) \
- (nn##_e >= nn##_cmb)
-
+ (nn##_e >= nn##_cmb)
/* ------------------------------------------------------- */
/* Macros simplex combination counter. */
/* Based on COMBO, but skips invalid simplex combinations */
#define XCOMBO(nn, comb, total) \
- COMBO(nn, comb, total)
+ COMBO(nn, comb, total)
/* Set total to new setting */
#define XCB_SETT(nn, total) \
@@ -100,54 +98,53 @@ typedef struct {
#define XCB_SETC(nn, comb) \
CB_SETC(nn, comb)
-
/* Set the counter to its initial value */
#define XCB_INIT(nn) \
{ \
- int nn##_ii; \
- \
- for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \
- nn[nn##_e] = nn##_cmb-nn##_e-1; \
- for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \
- if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii])\
- break; /* Went from 0 to 1 */ \
- } \
- if (nn##_ii < nn##_cmb) { /* Fix invalid combination */ \
- XCB_INC(nn); \
- } \
- nn##_e = 0; \
+ int nn##_ii; \
+ \
+ for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) \
+ nn[nn##_e] = nn##_cmb-nn##_e-1; \
+ for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \
+ if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii])\
+ break; /* Went from 0 to 1 */ \
+ } \
+ if (nn##_ii < nn##_cmb) { /* Fix invalid combination */ \
+ XCB_INC(nn); \
+ } \
+ nn##_e = 0; \
}
/* Increment the counter value */
#define XCB_INC(nn) \
{ \
- int nn##_ii = 0; \
- \
- while (nn##_ii < nn##_cmb) { \
- for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \
- nn[nn##_e]++; \
- if (nn[nn##_e] < (nn##_tot-nn##_e)) { \
- int nn##_ee; /* No carry */ \
- for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \
- nn[nn##_ee] = nn[nn##_ee+1] + 1; \
- break; \
- } \
- } \
- if (nn##_e >= nn##_cmb) \
- break; /* Done */ \
- \
- /* Reject invalid combinations */ \
- for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \
- if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii]) \
- break; /* Went from 0 to 1 */ \
- } \
- } \
+ int nn##_ii = 0; \
+ \
+ while (nn##_ii < nn##_cmb) { \
+ for (nn##_e = 0; nn##_e < nn##_cmb; nn##_e++) { \
+ nn[nn##_e]++; \
+ if (nn[nn##_e] < (nn##_tot-nn##_e)) { \
+ int nn##_ee; /* No carry */ \
+ for (nn##_ee = nn##_e-1; nn##_ee >= 0; nn##_ee--) \
+ nn[nn##_ee] = nn[nn##_ee+1] + 1; \
+ break; \
+ } \
+ } \
+ if (nn##_e >= nn##_cmb) \
+ break; /* Done */ \
+ \
+ /* Reject invalid combinations */ \
+ for (nn##_ii = 1; nn##_ii < nn##_cmb; nn##_ii++) { \
+ if ((nn[nn##_ii-1] ^ nn[nn##_ii]) & nn[nn##_ii]) \
+ break; /* Went from 0 to 1 */ \
+ } \
+ } \
}
/* After increment, expression is TRUE if counter is done */
#define XCB_DONE(nn) \
CB_DONE(nn)
-
+
/* ------------------------------------------------------- */
/* Macro pseudo-hilbert counter */
/* This multi-dimensional count sequence is a distributed */
@@ -157,105 +154,94 @@ typedef struct {
/* regular sampling. It approximates the Hilbert curve sequence. */
#define PHILBERT(nn) \
- int nn[IXDIDO];/* counter value */ \
- int nn##di; /* Dimensionality */ \
- unsigned nn##res; /* Resolution per coordinate */ \
- unsigned nn##bits; /* Bits per coordinate */ \
- unsigned nn##ix; /* Current binary index */ \
- unsigned nn##tmask; /* Total 2^n count mask */ \
- unsigned nn##count; /* Usable count */
+ int nn[IXDIDO];/* counter value */ \
+ int nn##di; /* Dimensionality */ \
+ unsigned nn##res; /* Resolution per coordinate */ \
+ unsigned nn##bits; /* Bits per coordinate */ \
+ unsigned nn##ix; /* Current binary index */ \
+ unsigned nn##tmask; /* Total 2^n count mask */ \
+ unsigned nn##count; /* Usable count */
/* Init counter for dimenion di, resolution res */
#define PH_INIT(nn, pdi, pres) \
{ \
- int nn##e; \
- \
- nn##di = pdi; \
- nn##res = (unsigned)pres; \
- \
- /* Compute bits */ \
- for (nn##bits = 0; (1 << nn##bits) < nn##res; nn##bits++) \
- ; \
- \
- /* Compute the total count mask */ \
- nn##tmask = ((((unsigned)1) << (nn##bits * nn##di))-1); \
- \
- /* Compute usable count */ \
- nn##count = 1; \
- for (nn##e = 0; nn##e < nn##di; nn##e++) \
- nn##count *= nn##res; \
- \
- nn##ix = 0; \
- for (nn##e = 0; nn##e < nn##di; nn##e++) \
- nn[nn##e] = 0; \
+ int nn##e; \
+ \
+ nn##di = pdi; \
+ nn##res = (unsigned)pres; \
+ \
+ /* Compute bits */ \
+ for (nn##bits = 0; (1 << nn##bits) < nn##res; nn##bits++) \
+ ; \
+ \
+ /* Compute the total count mask */ \
+ nn##tmask = ((((unsigned)1) << (nn##bits * nn##di))-1); \
+ \
+ /* Compute usable count */ \
+ nn##count = 1; \
+ for (nn##e = 0; nn##e < nn##di; nn##e++) \
+ nn##count *= nn##res; \
+ \
+ nn##ix = 0; \
+ for (nn##e = 0; nn##e < nn##di; nn##e++) \
+ nn[nn##e] = 0; \
}
/* Increment the counter value */
#define PH_INC(nn) \
{ \
- int nn##e; \
- do { \
- int nn##b; \
- int nn##gix; /* Gray code index */ \
- \
- nn##ix = (nn##ix + 1) & nn##tmask; \
- \
- /* Convert to gray code index */ \
- nn##gix = nn##ix ^ (nn##ix >> 1); \
- \
- for (nn##e = 0; nn##e < nn##di; nn##e++) \
- nn[nn##e] = 0; \
- \
- /* Distribute bits */ \
- for (nn##b = 0; nn##b < nn##bits; nn##b++) { \
- if (nn##b & 1) { /* In reverse order */ \
- for (nn##e = nn##di-1; nn##e >= 0; nn##e--) { \
- nn[nn##e] |= (nn##gix & 1) << nn##b; \
- nn##gix >>= 1; \
- } \
- } else { /* In normal order */ \
- for (nn##e = 0; nn##e < nn##di; nn##e++) { \
- nn[nn##e] |= (nn##gix & 1) << nn##b; \
- nn##gix >>= 1; \
- } \
- } \
- } \
- \
- /* Convert from Gray to binary coordinates */ \
- for (nn##e = 0; nn##e < nn##di; nn##e++) { \
- unsigned nn##sh, nn##tv; \
- \
- for(nn##sh = 1, nn##tv = nn[nn##e];; nn##sh <<= 1) { \
- unsigned nn##ptv = nn##tv; \
- nn##tv ^= (nn##tv >> nn##sh); \
- if (nn##ptv <= 1 || nn##sh == 16) \
- break; \
- } \
- /* Filter - increment again if outside cube range */ \
- if (nn##tv >= nn##res) \
- break; \
- nn[nn##e] = nn##tv; \
- } \
- \
- } while (nn##e < nn##di); \
- \
+ int nn##e; \
+ do { \
+ int nn##b; \
+ int nn##gix; /* Gray code index */ \
+ \
+ nn##ix = (nn##ix + 1) & nn##tmask; \
+ \
+ /* Convert to gray code index */ \
+ nn##gix = nn##ix ^ (nn##ix >> 1); \
+ \
+ for (nn##e = 0; nn##e < nn##di; nn##e++) \
+ nn[nn##e] = 0; \
+ \
+ /* Distribute bits */ \
+ for (nn##b = 0; nn##b < nn##bits; nn##b++) { \
+ if (nn##b & 1) { /* In reverse order */ \
+ for (nn##e = nn##di-1; nn##e >= 0; nn##e--) { \
+ nn[nn##e] |= (nn##gix & 1) << nn##b; \
+ nn##gix >>= 1; \
+ } \
+ } else { /* In normal order */ \
+ for (nn##e = 0; nn##e < nn##di; nn##e++) { \
+ nn[nn##e] |= (nn##gix & 1) << nn##b; \
+ nn##gix >>= 1; \
+ } \
+ } \
+ } \
+ \
+ /* Convert from Gray to binary coordinates */ \
+ for (nn##e = 0; nn##e < nn##di; nn##e++) { \
+ unsigned nn##sh, nn##tv; \
+ \
+ for(nn##sh = 1, nn##tv = nn[nn##e];; nn##sh <<= 1) { \
+ unsigned nn##ptv = nn##tv; \
+ nn##tv ^= (nn##tv >> nn##sh); \
+ if (nn##ptv <= 1 || nn##sh == 16) \
+ break; \
+ } \
+ /* Filter - increment again if outside cube range */ \
+ if (nn##tv >= nn##res) \
+ break; \
+ nn[nn##e] = nn##tv; \
+ } \
+ \
+ } while (nn##e < nn##di); \
+ \
}
/* After increment, expression is TRUE if counter has looped back to start. */
#define PH_LOOPED(nn) \
- (nn##ix == 0) \
-
+ (nn##ix == 0) \
+
/* ------------------------------------------------------- */
#endif /* IMDI_IMP_H */
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gs/imdi/imdi_k.c b/gs/imdi/imdi_k.c
index a288b2948..aef567b65 100644
--- a/gs/imdi/imdi_k.c
+++ b/gs/imdi/imdi_k.c
@@ -6,7 +6,6 @@
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -84,49 +83,49 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -139,137 +138,132 @@ static void
imdi_k1_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xc0, 0xa6, 0xdc, 0xb7,
- 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7,
- 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x4b, 0xa5, 0xf3, 0xb7, 0x34, 0x80, 0x04, 0x08,
- 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
- 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xc0, 0xa6, 0xdc, 0xb7,
+ 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7,
+ 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x4b, 0xa5, 0xf3, 0xb7, 0x34, 0x80, 0x04, 0x08,
+ 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
+ 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k1_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x2c, 0xf3, 0xdc, 0xb7,
- 0x08, 0xad, 0xf2, 0xb7, 0xf8, 0xac, 0xf2, 0xb7,
- 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
- 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7,
- 0xa4, 0xd5, 0x83, 0xbf, 0x00, 0x00, 0x00, 0x00,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x08, 0x06, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0x07, 0x00, 0x00, 0x00,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x2c, 0xf3, 0xdc, 0xb7,
+ 0x08, 0xad, 0xf2, 0xb7, 0xf8, 0xac, 0xf2, 0xb7,
+ 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
+ 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7,
+ 0xa4, 0xd5, 0x83, 0xbf, 0x00, 0x00, 0x00, 0x00,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x08, 0x06, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0x07, 0x00, 0x00, 0x00,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -278,7 +272,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -363,56 +356,56 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -426,137 +419,132 @@ static void
imdi_k2_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7,
- 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
- 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x0f, 0x00, 0x51, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x8d, 0xb7, 0xf3, 0xb7, 0xc3, 0xd1, 0xf2, 0xb7,
+ 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
+ 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k2_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
- 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
- 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7,
- 0xa4, 0xd5, 0x83, 0xbf, 0x0c, 0x00, 0x00, 0x00,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
+ 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
+ 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0xac, 0x53, 0xdd, 0xb7,
+ 0xa4, 0xd5, 0x83, 0xbf, 0x0c, 0x00, 0x00, 0x00,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -565,7 +553,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -655,66 +642,66 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -729,137 +716,132 @@ static void
imdi_k3_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc3, 0xd1, 0xf2, 0xb7,
- 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
- 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc3, 0xd1, 0xf2, 0xb7,
+ 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x28, 0xd9, 0x83, 0xbf,
+ 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k3_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
- 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x46, 0x83, 0x04, 0x08, 0x50, 0xd5, 0x83, 0xbf,
+ 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0xf8, 0xac, 0xf2, 0xb7,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -868,7 +850,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -953,96 +934,96 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -1055,137 +1036,132 @@ static void
imdi_k4_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x38, 0x18, 0xf4, 0xb7, 0xc4, 0x1f, 0xf4, 0xb7,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k4_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x50, 0xd5, 0x83, 0xbf,
- 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x50, 0xd5, 0x83, 0xbf,
+ 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -1194,7 +1170,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -1281,110 +1256,110 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -1397,137 +1372,132 @@ static void
imdi_k5_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xc4, 0x1f, 0xf4, 0xb7,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x80, 0xdb, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc4, 0x1f, 0xf4, 0xb7,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xae, 0xd9, 0x83, 0xbf,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k5_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x60, 0x80, 0xf3, 0xb7, 0x46, 0x83, 0x04, 0x08,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -1536,7 +1506,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -1625,125 +1594,125 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -1756,137 +1725,132 @@ static void
imdi_k6_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xdc, 0x83, 0xbf, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0xe4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k6_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x46, 0x83, 0x04, 0x08,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x46, 0x83, 0x04, 0x08,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -1895,7 +1859,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -1986,141 +1949,141 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -2133,137 +2096,132 @@ static void
imdi_k7_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x34, 0x80, 0x04, 0x08,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k7_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -2272,7 +2230,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -2355,58 +2312,58 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -2420,137 +2377,132 @@ static void
imdi_k8_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k8_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -2559,7 +2511,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -2649,67 +2600,67 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -2724,137 +2675,132 @@ static void
imdi_k9_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k9_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -2863,7 +2809,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -2958,78 +2903,78 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -3045,137 +2990,132 @@ static void
imdi_k10_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k10_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -3184,7 +3124,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -3274,109 +3213,109 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -3390,137 +3329,132 @@ static void
imdi_k11_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k11_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -3529,7 +3463,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -3621,124 +3554,124 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -3752,137 +3685,132 @@ static void
imdi_k12_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k12_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -3891,7 +3819,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -3985,140 +3912,140 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -4132,137 +4059,132 @@ static void
imdi_k13_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k13_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -4271,7 +4193,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -4367,157 +4288,157 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -4531,137 +4452,132 @@ static void
imdi_k14_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xd0, 0x85, 0x04, 0x08, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k14_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -4670,7 +4586,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -4754,61 +4669,61 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -4821,137 +4736,132 @@ static void
imdi_k15_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k15_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -4960,7 +4870,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -5051,70 +4960,70 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -5128,137 +5037,132 @@ static void
imdi_k16_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k16_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -5267,7 +5171,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -5363,81 +5266,81 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -5452,137 +5355,132 @@ static void
imdi_k17_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k17_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -5591,7 +5489,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -5682,112 +5579,112 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -5800,137 +5697,132 @@ static void
imdi_k18_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k18_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -5939,7 +5831,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -6032,127 +5923,127 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -6165,137 +6056,132 @@ static void
imdi_k19_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k19_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -6304,7 +6190,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -6399,143 +6284,143 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -6548,137 +6433,132 @@ static void
imdi_k20_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k20_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -6687,7 +6567,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -6784,160 +6663,160 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -6950,137 +6829,132 @@ static void
imdi_k21_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x4c, 0x69, 0x6e, 0x75,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x79, 0x72,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k21_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -7089,7 +6963,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -7176,67 +7049,67 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -7250,137 +7123,132 @@ static void
imdi_k22_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k22_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -7389,7 +7257,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -7483,78 +7350,78 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -7569,137 +7436,132 @@ static void
imdi_k23_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k23_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -7708,7 +7570,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -7807,90 +7668,90 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -7906,137 +7767,132 @@ static void
imdi_k24_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k24_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -8045,7 +7901,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -8139,122 +7994,122 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -8268,137 +8123,132 @@ static void
imdi_k25_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k25_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -8407,7 +8257,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -8503,138 +8352,138 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -8648,137 +8497,132 @@ static void
imdi_k26_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k26_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -8787,7 +8631,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -8885,155 +8728,155 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -9047,137 +8890,132 @@ static void
imdi_k27_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k27_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -9186,7 +9024,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -9286,173 +9123,173 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -9466,137 +9303,132 @@ static void
imdi_k28_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x74, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k28_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -9605,7 +9437,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -9693,70 +9524,70 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -9769,137 +9600,132 @@ static void
imdi_k29_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x32, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k29_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -9908,7 +9734,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -10003,81 +9828,81 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -10091,137 +9916,132 @@ static void
imdi_k30_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k30_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -10230,7 +10050,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -10330,93 +10149,93 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -10431,137 +10250,132 @@ static void
imdi_k31_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k31_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -10570,7 +10384,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -10665,125 +10478,125 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -10796,137 +10609,132 @@ static void
imdi_k32_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k32_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -10935,7 +10743,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -11032,141 +10839,141 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -11179,137 +10986,132 @@ static void
imdi_k33_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k33_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -11318,7 +11120,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -11417,158 +11218,158 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -11581,137 +11382,132 @@ static void
imdi_k34_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k34_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -11720,7 +11516,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -11821,176 +11616,176 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -12003,137 +11798,132 @@ static void
imdi_k35_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k35_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -12142,7 +11932,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -12233,76 +12022,76 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -12316,137 +12105,132 @@ static void
imdi_k36_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k36_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -12455,7 +12239,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -12553,89 +12336,89 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -12650,137 +12433,132 @@ static void
imdi_k37_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k37_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -12789,7 +12567,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -12892,102 +12669,102 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -13003,137 +12780,132 @@ static void
imdi_k38_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k38_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -13142,7 +12914,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -13240,135 +13011,135 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -13382,137 +13153,132 @@ static void
imdi_k39_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x33, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k39_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -13521,7 +13287,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -13621,152 +13386,152 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -13780,137 +13545,132 @@ static void
imdi_k40_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k40_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -13919,7 +13679,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -14021,170 +13780,170 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -14198,137 +13957,132 @@ static void
imdi_k41_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k41_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -14337,7 +14091,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -14441,189 +14194,189 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -14637,137 +14390,132 @@ static void
imdi_k42_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k42_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -14776,7 +14524,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -14868,79 +14615,79 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -14953,137 +14700,132 @@ static void
imdi_k43_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k43_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -15092,7 +14834,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -15191,92 +14932,92 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -15290,137 +15031,132 @@ static void
imdi_k44_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k44_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -15429,7 +15165,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -15533,105 +15268,105 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -15646,137 +15381,132 @@ static void
imdi_k45_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k45_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -15785,7 +15515,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -15884,138 +15613,138 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -16028,137 +15757,132 @@ static void
imdi_k46_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k46_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -16167,7 +15891,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -16268,155 +15991,155 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -16429,137 +16152,132 @@ static void
imdi_k47_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k47_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -16568,7 +16286,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -16671,173 +16388,173 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -16850,137 +16567,132 @@ static void
imdi_k48_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k48_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -16989,7 +16701,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -17094,192 +16805,192 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned char *op0 = (unsigned char *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned char *op0 = (unsigned char *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -17292,137 +17003,132 @@ static void
imdi_k49_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
- 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x38, 0x5f, 0x66, 0x00,
+ 0x8e, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x34, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k49_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -17431,7 +17137,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -17509,49 +17214,49 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -17564,137 +17269,132 @@ static void
imdi_k50_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k50_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -17703,7 +17403,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -17788,56 +17487,56 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -17851,137 +17550,132 @@ static void
imdi_k51_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k51_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -17990,7 +17684,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -18080,66 +17773,66 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -18154,137 +17847,132 @@ static void
imdi_k52_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k52_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -18293,7 +17981,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -18378,96 +18065,96 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -18480,137 +18167,132 @@ static void
imdi_k53_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k53_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -18619,7 +18301,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -18706,110 +18387,110 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -18822,137 +18503,132 @@ static void
imdi_k54_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k54_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -18961,7 +18637,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -19050,125 +18725,125 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -19181,137 +18856,132 @@ static void
imdi_k55_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k55_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -19320,7 +18990,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -19411,141 +19080,141 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 1) {
- unsigned int ova0; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 1) {
+ unsigned int ova0; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -19558,137 +19227,132 @@ static void
imdi_k56_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k56_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -19697,7 +19361,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -19780,58 +19443,58 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -19845,137 +19508,132 @@ static void
imdi_k57_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k57_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -19984,7 +19642,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -20074,67 +19731,67 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -20149,137 +19806,132 @@ static void
imdi_k58_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k58_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -20288,7 +19940,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -20383,78 +20034,78 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -20470,137 +20121,132 @@ static void
imdi_k59_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x35, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k59_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -20609,7 +20255,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -20699,109 +20344,109 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -20815,137 +20460,132 @@ static void
imdi_k60_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k60_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -20954,7 +20594,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -21046,124 +20685,124 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -21177,137 +20816,132 @@ static void
imdi_k61_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k61_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -21316,7 +20950,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -21410,140 +21043,140 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -21557,137 +21190,132 @@ static void
imdi_k62_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k62_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -21696,7 +21324,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -21792,157 +21419,157 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -21956,137 +21583,132 @@ static void
imdi_k63_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k63_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -22095,7 +21717,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -22179,61 +21800,61 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -22246,137 +21867,132 @@ static void
imdi_k64_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k64_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -22385,7 +22001,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -22476,70 +22091,70 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -22553,137 +22168,132 @@ static void
imdi_k65_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k65_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -22692,7 +22302,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -22788,81 +22397,81 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -22877,137 +22486,132 @@ static void
imdi_k66_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x27, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k66_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -23016,7 +22620,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -23107,112 +22710,112 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -23225,137 +22828,132 @@ static void
imdi_k67_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k67_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -23364,7 +22962,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -23457,127 +23054,127 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -23590,137 +23187,132 @@ static void
imdi_k68_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k68_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -23729,7 +23321,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -23824,143 +23415,143 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -23973,137 +23564,132 @@ static void
imdi_k69_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x36, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k69_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -24112,7 +23698,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -24209,160 +23794,160 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -24375,137 +23960,132 @@ static void
imdi_k70_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k70_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -24514,7 +24094,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -24601,67 +24180,67 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -24675,137 +24254,132 @@ static void
imdi_k71_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k71_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -24814,7 +24388,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -24908,78 +24481,78 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -24994,137 +24567,132 @@ static void
imdi_k72_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k72_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -25133,7 +24701,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -25232,90 +24799,90 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -25331,137 +24898,132 @@ static void
imdi_k73_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k73_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -25470,7 +25032,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -25564,122 +25125,122 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -25693,137 +25254,132 @@ static void
imdi_k74_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k74_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -25832,7 +25388,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -25928,138 +25483,138 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -26073,137 +25628,132 @@ static void
imdi_k75_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k75_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -26212,7 +25762,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -26310,155 +25859,155 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -26472,137 +26021,132 @@ static void
imdi_k76_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k76_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -26611,7 +26155,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -26711,173 +26254,173 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -26891,137 +26434,132 @@ static void
imdi_k77_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k77_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x21, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -27030,7 +26568,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -27118,70 +26655,70 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -27194,137 +26731,132 @@ static void
imdi_k78_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k78_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -27333,7 +26865,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -27428,81 +26959,81 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -27516,137 +27047,132 @@ static void
imdi_k79_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x37, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k79_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -27655,7 +27181,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -27755,93 +27280,93 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -27856,137 +27381,132 @@ static void
imdi_k80_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k80_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -27995,7 +27515,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -28090,125 +27609,125 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -28221,137 +27740,132 @@ static void
imdi_k81_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k81_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -28360,7 +27874,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -28457,141 +27970,141 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -28604,137 +28117,132 @@ static void
imdi_k82_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k82_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -28743,7 +28251,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -28842,158 +28349,158 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -29006,137 +28513,132 @@ static void
imdi_k83_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k83_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -29145,7 +28647,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -29246,176 +28747,176 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -29428,137 +28929,132 @@ static void
imdi_k84_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k84_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -29567,7 +29063,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -29658,76 +29153,76 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -29741,137 +29236,132 @@ static void
imdi_k85_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k85_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -29880,7 +29370,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -29978,89 +29467,89 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -30075,137 +29564,132 @@ static void
imdi_k86_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k86_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -30214,7 +29698,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -30317,102 +29800,102 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -30428,137 +29911,132 @@ static void
imdi_k87_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k87_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -30567,7 +30045,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -30665,135 +30142,135 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -30807,137 +30284,132 @@ static void
imdi_k88_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k88_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -30946,7 +30418,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -31046,152 +30517,152 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -31205,137 +30676,132 @@ static void
imdi_k89_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x38, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k89_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -31344,7 +30810,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -31446,170 +30911,170 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -31623,137 +31088,132 @@ static void
imdi_k90_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x30,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x30,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k90_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -31762,7 +31222,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -31866,189 +31325,189 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value partial accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value partial accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_PE(imp, vof) * vwe; /* Accumulate last weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -32062,137 +31521,132 @@ static void
imdi_k91_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k91_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -32201,7 +31655,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -32293,79 +31746,79 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
-
- imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vowr; /* Vertex offset/weight value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
- vof = (vowr & 0x7f); /* Extract offset value */
- vwe = (vowr >> 7); /* Extract weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+
+ imp = im_base + IM_O(ti >> 0); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0x0); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vowr; /* Vertex offset/weight value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vowr = SX_WO(swp, 0); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vowr = SX_WO(swp, 1); /* Read vertex offset+weighting values */
+ vof = (vowr & 0x7f); /* Extract offset value */
+ vwe = (vowr >> 7); /* Extract weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -32378,137 +31831,132 @@ static void
imdi_k92_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x32,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k92_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -32517,7 +31965,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -32616,92 +32063,92 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti; /* Simplex+Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- ti += IT_IT(it1, ip0[1]);
- ti += IT_IT(it2, ip0[2]);
-
- imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
- swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti; /* Simplex+Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ ti += IT_IT(it1, ip0[1]);
+ ti += IT_IT(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti >> 12); /* Extract interp. index and comp. entry */
+ swp = sw_base + SW_O(ti & 0xfff); /* Extract simplex index and comp. entry */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef SW_O
@@ -32715,137 +32162,132 @@ static void
imdi_k93_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x33,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x33,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k93_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -32854,7 +32296,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -32958,105 +32399,105 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer sw_base = (pointer)p->sw_table;
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer swp;
- pointer imp;
- {
- unsigned int ti_s; /* Simplex index variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- ti_s = IT_SX(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- ti_s += IT_SX(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- ti_s += IT_SX(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- ti_s += IT_SX(it3, ip0[3]);
-
- swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = SX_VO(swp, 0); /* Read vertex offset value */
- vwe = SX_WE(swp, 0); /* Read vertex weighting value */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 1); /* Read vertex offset value */
- vwe = SX_WE(swp, 1); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 2); /* Read vertex offset value */
- vwe = SX_WE(swp, 2); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 3); /* Read vertex offset value */
- vwe = SX_WE(swp, 3); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof = SX_VO(swp, 4); /* Read vertex offset value */
- vwe = SX_WE(swp, 4); /* Read vertex weighting value */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer sw_base = (pointer)p->sw_table;
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer swp;
+ pointer imp;
+ {
+ unsigned int ti_s; /* Simplex index variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ ti_s = IT_SX(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ ti_s += IT_SX(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ ti_s += IT_SX(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ ti_s += IT_SX(it3, ip0[3]);
+
+ swp = sw_base + SW_O(ti_s); /* Compute simplex table entry pointer */
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = SX_VO(swp, 0); /* Read vertex offset value */
+ vwe = SX_WE(swp, 0); /* Read vertex weighting value */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 1); /* Read vertex offset value */
+ vwe = SX_WE(swp, 1); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 2); /* Read vertex offset value */
+ vwe = SX_WE(swp, 2); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 3); /* Read vertex offset value */
+ vwe = SX_WE(swp, 3); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof = SX_VO(swp, 4); /* Read vertex offset value */
+ vwe = SX_WE(swp, 4); /* Read vertex weighting value */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IX
#undef IT_SX
@@ -33071,137 +32512,132 @@ static void
imdi_k94_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x34,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k94_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -33210,7 +32646,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -33309,138 +32744,138 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo3, wo4);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo3, wo4);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -33453,137 +32888,132 @@ static void
imdi_k95_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x35,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x35,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k95_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -33592,7 +33022,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -33693,155 +33122,155 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo4, wo5);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo4, wo5);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -33854,137 +33283,132 @@ static void
imdi_k96_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x36,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x36,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k96_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -33993,7 +33417,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -34096,173 +33519,173 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo5, wo6);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo5, wo6);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -34275,137 +33698,132 @@ static void
imdi_k97_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x37,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x37,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k97_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -34414,7 +33832,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -34519,192 +33936,192 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned char *ip0 = (unsigned char *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned char *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- unsigned int wo4; /* Weighting value and vertex offset variable */
- unsigned int wo5; /* Weighting value and vertex offset variable */
- unsigned int wo6; /* Weighting value and vertex offset variable */
- unsigned int wo7; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- wo4 = IT_WO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- wo5 = IT_WO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- wo6 = IT_WO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- wo7 = IT_WO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo0, wo4);
- CEX(wo0, wo5);
- CEX(wo0, wo6);
- CEX(wo0, wo7);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo1, wo4);
- CEX(wo1, wo5);
- CEX(wo1, wo6);
- CEX(wo1, wo7);
- CEX(wo2, wo3);
- CEX(wo2, wo4);
- CEX(wo2, wo5);
- CEX(wo2, wo6);
- CEX(wo2, wo7);
- CEX(wo3, wo4);
- CEX(wo3, wo5);
- CEX(wo3, wo6);
- CEX(wo3, wo7);
- CEX(wo4, wo5);
- CEX(wo4, wo6);
- CEX(wo4, wo7);
- CEX(wo5, wo6);
- CEX(wo5, wo7);
- CEX(wo6, wo7);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fffff); /* Extract offset value */
- wo0 = (wo0 >> 23); /* Extract weighting value */
- vwe = 256 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fffff); /* Extract offset value */
- wo1 = (wo1 >> 23); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fffff); /* Extract offset value */
- wo2 = (wo2 >> 23); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fffff); /* Extract offset value */
- wo3 = (wo3 >> 23); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo4 & 0x7fffff); /* Extract offset value */
- wo4 = (wo4 >> 23); /* Extract weighting value */
- vwe = wo3 - wo4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo5 & 0x7fffff); /* Extract offset value */
- wo5 = (wo5 >> 23); /* Extract weighting value */
- vwe = wo4 - wo5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo6 & 0x7fffff); /* Extract offset value */
- wo6 = (wo6 >> 23); /* Extract weighting value */
- vwe = wo5 - wo6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo7 & 0x7fffff); /* Extract offset value */
- wo7 = (wo7 >> 23); /* Extract weighting value */
- vwe = wo6 - wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned char *ip0 = (unsigned char *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned char *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ unsigned int wo4; /* Weighting value and vertex offset variable */
+ unsigned int wo5; /* Weighting value and vertex offset variable */
+ unsigned int wo6; /* Weighting value and vertex offset variable */
+ unsigned int wo7; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ wo4 = IT_WO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ wo5 = IT_WO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ wo6 = IT_WO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ wo7 = IT_WO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo0, wo4);
+ CEX(wo0, wo5);
+ CEX(wo0, wo6);
+ CEX(wo0, wo7);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo1, wo4);
+ CEX(wo1, wo5);
+ CEX(wo1, wo6);
+ CEX(wo1, wo7);
+ CEX(wo2, wo3);
+ CEX(wo2, wo4);
+ CEX(wo2, wo5);
+ CEX(wo2, wo6);
+ CEX(wo2, wo7);
+ CEX(wo3, wo4);
+ CEX(wo3, wo5);
+ CEX(wo3, wo6);
+ CEX(wo3, wo7);
+ CEX(wo4, wo5);
+ CEX(wo4, wo6);
+ CEX(wo4, wo7);
+ CEX(wo5, wo6);
+ CEX(wo5, wo7);
+ CEX(wo6, wo7);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fffff); /* Extract offset value */
+ wo0 = (wo0 >> 23); /* Extract weighting value */
+ vwe = 256 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fffff); /* Extract offset value */
+ wo1 = (wo1 >> 23); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fffff); /* Extract offset value */
+ wo2 = (wo2 >> 23); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fffff); /* Extract offset value */
+ wo3 = (wo3 >> 23); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo4 & 0x7fffff); /* Extract offset value */
+ wo4 = (wo4 >> 23); /* Extract weighting value */
+ vwe = wo3 - wo4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo5 & 0x7fffff); /* Extract offset value */
+ wo5 = (wo5 >> 23); /* Extract weighting value */
+ vwe = wo4 - wo5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo6 & 0x7fffff); /* Extract offset value */
+ wo6 = (wo6 >> 23); /* Extract weighting value */
+ vwe = wo5 - wo6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo7 & 0x7fffff); /* Extract offset value */
+ wo7 = (wo7 >> 23); /* Extract weighting value */
+ vwe = wo6 - wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 8) & 0xff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova0 >> 24) & 0xff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova1 >> 8) & 0xff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova1 >> 24) & 0xff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova2 >> 8) & 0xff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova2 >> 24) & 0xff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova3 >> 8) & 0xff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova3 >> 24) & 0xff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -34717,137 +34134,132 @@ static void
imdi_k98_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
- 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
- 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x38,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
+ 0x69, 0x38, 0x5f, 0x69, 0x31, 0x36, 0x5f, 0x66,
+ 0x00, 0xff, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x38,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k98_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -34856,7 +34268,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -34930,52 +34341,52 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 20); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7); /* Extract offset value */
- wo0 = (wo0 >> 3); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 20); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7); /* Extract offset value */
+ wo0 = (wo0 >> 3); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -34987,137 +34398,132 @@ static void
imdi_k99_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x39,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x39, 0x39,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k99_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -35126,7 +34532,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -35207,71 +34612,71 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -35284,137 +34689,132 @@ static void
imdi_k100_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k100_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -35423,7 +34823,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -35506,83 +34905,83 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -35595,137 +34994,132 @@ static void
imdi_k101_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k101_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -35734,7 +35128,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -35823,95 +35216,95 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -35925,137 +35318,132 @@ static void
imdi_k102_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k102_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -36064,7 +35452,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -36155,109 +35542,109 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -36271,137 +35658,132 @@ static void
imdi_k103_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k103_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -36410,7 +35792,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -36503,124 +35884,124 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -36634,137 +36015,132 @@ static void
imdi_k104_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k104_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -36773,7 +36149,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -36868,140 +36243,140 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 1) {
- unsigned int ova0; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 1) {
+ unsigned int ova0; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -37015,137 +36390,132 @@ static void
imdi_k105_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x31, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k105_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xa1, 0xd4, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x31, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xa0, 0xd6, 0x83, 0xbf, 0x8b, 0x22, 0xe2, 0xb7,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -37154,7 +36524,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -37232,64 +36601,64 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 21); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0xf); /* Extract offset value */
- wo0 = (wo0 >> 4); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 21); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0xf); /* Extract offset value */
+ wo0 = (wo0 >> 4); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -37301,137 +36670,132 @@ static void
imdi_k106_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k106_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -37440,7 +36804,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -37525,87 +36888,87 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -37618,137 +36981,132 @@ static void
imdi_k107_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k107_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -37757,7 +37115,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -37844,101 +37201,101 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -37951,137 +37308,132 @@ static void
imdi_k108_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k108_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -38090,7 +37442,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -38183,115 +37534,115 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -38305,137 +37656,132 @@ static void
imdi_k109_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
- 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x30,
+ 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k109_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -38444,7 +37790,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -38539,131 +37884,131 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -38677,137 +38022,132 @@ static void
imdi_k110_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k110_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -38816,7 +38156,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -38913,148 +38252,148 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -39068,137 +38407,132 @@ static void
imdi_k111_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k111_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -39207,7 +38541,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -39306,166 +38639,166 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 3) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 3) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -39479,137 +38812,132 @@ static void
imdi_k112_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x33, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k112_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xf4, 0xd5, 0x83, 0xbf, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -39618,7 +38946,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -39698,70 +39025,70 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 20); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7); /* Extract offset value */
- wo0 = (wo0 >> 3); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0xfffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 20); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7); /* Extract offset value */
+ wo0 = (wo0 >> 3); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -39773,137 +39100,132 @@ static void
imdi_k113_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k113_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -39912,7 +39234,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -39999,95 +39320,95 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -40100,137 +39421,132 @@ static void
imdi_k114_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k114_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -40239,7 +39555,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -40328,110 +39643,110 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -40444,137 +39759,132 @@ static void
imdi_k115_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k115_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -40583,7 +39893,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -40678,125 +39987,125 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -40810,137 +40119,132 @@ static void
imdi_k116_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k116_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -40949,7 +40253,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -41046,142 +40349,142 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -41195,137 +40498,132 @@ static void
imdi_k117_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k117_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -41334,7 +40632,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -41433,160 +40730,160 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -41600,137 +40897,132 @@ static void
imdi_k118_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k118_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -41739,7 +41031,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -41840,179 +41131,179 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 4) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 4) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -42026,137 +41317,132 @@ static void
imdi_k119_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
- 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x34, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x31,
+ 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k119_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0x34, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x52, 0xca, 0x04, 0x08,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -42165,7 +41451,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -42247,76 +41532,76 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 22); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x1f); /* Extract offset value */
- wo0 = (wo0 >> 5); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 22); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x1f); /* Extract offset value */
+ wo0 = (wo0 >> 5); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -42328,137 +41613,132 @@ static void
imdi_k120_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k120_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -42467,7 +41747,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -42556,103 +41835,103 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -42665,137 +41944,132 @@ static void
imdi_k121_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k121_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -42804,7 +42078,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -42895,119 +42168,119 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -43020,137 +42293,132 @@ static void
imdi_k122_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k122_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -43159,7 +42427,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -43256,135 +42523,135 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -43398,137 +42665,132 @@ static void
imdi_k123_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k123_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -43537,7 +42799,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -43636,153 +42897,153 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -43796,137 +43057,132 @@ static void
imdi_k124_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k124_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -43935,7 +43191,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -44036,172 +43291,172 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -44215,137 +43470,132 @@ static void
imdi_k125_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k125_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -44354,7 +43604,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -44457,192 +43706,192 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 5) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 5) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -44656,137 +43905,132 @@ static void
imdi_k126_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x35, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k126_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xdc, 0xd6, 0x83, 0xbf, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x22, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -44795,7 +44039,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -44879,82 +44122,82 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 21); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0xf); /* Extract offset value */
- wo0 = (wo0 >> 4); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 21); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0xf); /* Extract offset value */
+ wo0 = (wo0 >> 4); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -44966,137 +44209,132 @@ static void
imdi_k127_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k127_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -45105,7 +44343,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -45196,111 +44433,111 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -45313,137 +44550,132 @@ static void
imdi_k128_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k128_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -45452,7 +44684,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -45545,128 +44776,128 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -45679,137 +44910,132 @@ static void
imdi_k129_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
- 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x32,
+ 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k129_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -45818,7 +45044,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -45917,145 +45142,145 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -46069,137 +45294,132 @@ static void
imdi_k130_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k130_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -46208,7 +45428,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -46309,164 +45528,164 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -46480,137 +45699,132 @@ static void
imdi_k131_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k131_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -46619,7 +45833,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -46722,184 +45935,184 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -46913,137 +46126,132 @@ static void
imdi_k132_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k132_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -47052,7 +46260,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -47157,205 +46364,205 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 6) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 6) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -47369,137 +46576,132 @@ static void
imdi_k133_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x36, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k133_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0xda, 0x83, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -47508,7 +46710,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -47594,88 +46795,88 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 22); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x1f); /* Extract offset value */
- wo0 = (wo0 >> 5); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0x3fffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 22); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x1f); /* Extract offset value */
+ wo0 = (wo0 >> 5); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -47687,137 +46888,132 @@ static void
imdi_k134_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k134_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -47826,7 +47022,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -47919,119 +47114,119 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -48044,137 +47239,132 @@ static void
imdi_k135_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k135_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -48183,7 +47373,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -48282,136 +47471,136 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we2, vo2, we3, vo3);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we2, vo2, we3, vo3);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -48425,137 +47614,132 @@ static void
imdi_k136_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k136_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -48564,7 +47748,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -48665,155 +47848,155 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -48827,137 +48010,132 @@ static void
imdi_k137_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k137_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -48966,7 +48144,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -49069,175 +48246,175 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -49251,137 +48428,132 @@ static void
imdi_k138_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k138_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -49390,7 +48562,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -49495,196 +48666,196 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -49698,137 +48869,132 @@ static void
imdi_k139_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
- 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x33,
+ 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k139_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -49837,7 +49003,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -49944,218 +49109,218 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 7) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 7) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -50169,137 +49334,132 @@ static void
imdi_k140_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x37, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k140_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0xdc, 0x60, 0xef, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x14, 0xda, 0x83, 0xbf, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -50308,7 +49468,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -50396,94 +49555,94 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 1 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 1, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- {
- unsigned int ti; /* Input table entry variable */
- unsigned int ti_i; /* Interpolation index variable */
-
- ti = IT_IT(it0, ip0[0]);
- wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
- ti_i = (ti >> 21); /* Extract interpolation table value */
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0xf); /* Extract offset value */
- wo0 = (wo0 >> 4); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo0; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 1 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 1, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti; /* Input table entry variable */
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti = IT_IT(it0, ip0[0]);
+ wo0 = (ti & 0x1fffff); /* Extract weighting/vertex offset value */
+ ti_i = (ti >> 21); /* Extract interpolation table value */
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0xf); /* Extract offset value */
+ wo0 = (wo0 >> 4); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo0; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_IT
#undef CEX
@@ -50495,137 +49654,132 @@ static void
imdi_k141_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x31, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k141_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -50634,7 +49788,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -50729,127 +49882,127 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 3 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 3, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo1, wo2);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 3 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 3, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo1, wo2);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -50862,137 +50015,132 @@ static void
imdi_k142_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x33, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k142_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -51001,7 +50149,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -51098,146 +50245,146 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 4 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 4, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int wo0; /* Weighting value and vertex offset variable */
- unsigned int wo1; /* Weighting value and vertex offset variable */
- unsigned int wo2; /* Weighting value and vertex offset variable */
- unsigned int wo3; /* Weighting value and vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- wo0 = IT_WO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- wo1 = IT_WO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- wo2 = IT_WO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- wo3 = IT_WO(it3, ip0[3]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(wo0, wo1);
- CEX(wo0, wo2);
- CEX(wo0, wo3);
- CEX(wo1, wo2);
- CEX(wo1, wo3);
- CEX(wo2, wo3);
- }
- {
- unsigned int nvof; /* Next vertex offset value */
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- nvof = (wo0 & 0x7fff); /* Extract offset value */
- wo0 = (wo0 >> 15); /* Extract weighting value */
- vwe = 65536 - wo0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo1 & 0x7fff); /* Extract offset value */
- wo1 = (wo1 >> 15); /* Extract weighting value */
- vwe = wo0 - wo1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo2 & 0x7fff); /* Extract offset value */
- wo2 = (wo2 >> 15); /* Extract weighting value */
- vwe = wo1 - wo2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- nvof = (wo3 & 0x7fff); /* Extract offset value */
- wo3 = (wo3 >> 15); /* Extract weighting value */
- vwe = wo2 - wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += nvof; /* Move to next vertex */
- vwe = wo3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 4 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 4, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int wo0; /* Weighting value and vertex offset variable */
+ unsigned int wo1; /* Weighting value and vertex offset variable */
+ unsigned int wo2; /* Weighting value and vertex offset variable */
+ unsigned int wo3; /* Weighting value and vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ wo0 = IT_WO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ wo1 = IT_WO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ wo2 = IT_WO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ wo3 = IT_WO(it3, ip0[3]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(wo0, wo1);
+ CEX(wo0, wo2);
+ CEX(wo0, wo3);
+ CEX(wo1, wo2);
+ CEX(wo1, wo3);
+ CEX(wo2, wo3);
+ }
+ {
+ unsigned int nvof; /* Next vertex offset value */
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ nvof = (wo0 & 0x7fff); /* Extract offset value */
+ wo0 = (wo0 >> 15); /* Extract weighting value */
+ vwe = 65536 - wo0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo1 & 0x7fff); /* Extract offset value */
+ wo1 = (wo1 >> 15); /* Extract weighting value */
+ vwe = wo0 - wo1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo2 & 0x7fff); /* Extract offset value */
+ wo2 = (wo2 >> 15); /* Extract weighting value */
+ vwe = wo1 - wo2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ nvof = (wo3 & 0x7fff); /* Extract offset value */
+ wo3 = (wo3 >> 15); /* Extract weighting value */
+ vwe = wo2 - wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += nvof; /* Move to next vertex */
+ vwe = wo3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WO
#undef IT_IX
@@ -51250,137 +50397,132 @@ static void
imdi_k143_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x34, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k143_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -51389,7 +50531,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -51492,165 +50633,165 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 5 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 5, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we3, vo3, we4, vo4);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 5 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 5, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we3, vo3, we4, vo4);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -51664,137 +50805,132 @@ static void
imdi_k144_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x35, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k144_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -51803,7 +50939,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -51908,186 +51043,186 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 6 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 6, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we4, vo4, we5, vo5);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 6 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 6, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we4, vo4, we5, vo5);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -52101,137 +51236,132 @@ static void
imdi_k145_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x36, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k145_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -52240,7 +51370,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -52347,208 +51476,208 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 7 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 7, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we5, vo5, we6, vo6);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 7 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 7, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we5, vo5, we6, vo6);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -52562,137 +51691,132 @@ static void
imdi_k146_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x37, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k146_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
/* Integer Multi-Dimensional Interpolation */
/* Interpolation Kernel Code */
/* Generated by cgen */
@@ -52701,7 +51825,6 @@ tabspec *t /* structure to be initialised */
/* see the Licence.txt file for licencing details.*/
-
/*
Interpolation kernel specs:
@@ -52810,231 +51933,231 @@ void **outp, /* pointer to output pointers */
void **inp, /* pointer to input pointers */
unsigned int npix /* Number of pixels to process */
) {
- imdi_imp *p = (imdi_imp *)(s->impl);
- unsigned short *ip0 = (unsigned short *)inp[0];
- unsigned short *op0 = (unsigned short *)outp[0];
- unsigned short *ep = ip0 + npix * 8 ;
- pointer it0 = (pointer)p->in_tables[0];
- pointer it1 = (pointer)p->in_tables[1];
- pointer it2 = (pointer)p->in_tables[2];
- pointer it3 = (pointer)p->in_tables[3];
- pointer it4 = (pointer)p->in_tables[4];
- pointer it5 = (pointer)p->in_tables[5];
- pointer it6 = (pointer)p->in_tables[6];
- pointer it7 = (pointer)p->in_tables[7];
- pointer ot0 = (pointer)p->out_tables[0];
- pointer ot1 = (pointer)p->out_tables[1];
- pointer ot2 = (pointer)p->out_tables[2];
- pointer ot3 = (pointer)p->out_tables[3];
- pointer ot4 = (pointer)p->out_tables[4];
- pointer ot5 = (pointer)p->out_tables[5];
- pointer ot6 = (pointer)p->out_tables[6];
- pointer ot7 = (pointer)p->out_tables[7];
- pointer im_base = (pointer)p->im_table;
-
- for(;ip0 < ep; ip0 += 8, op0 += 8) {
- unsigned int ova0; /* Output value accumulator */
- unsigned int ova1; /* Output value accumulator */
- unsigned int ova2; /* Output value accumulator */
- unsigned int ova3; /* Output value accumulator */
- unsigned int ova4; /* Output value accumulator */
- unsigned int ova5; /* Output value accumulator */
- unsigned int ova6; /* Output value accumulator */
- unsigned int ova7; /* Output value accumulator */
- {
- pointer imp;
- unsigned int we0; /* Weighting value variable */
- unsigned int vo0; /* Vertex offset variable */
- unsigned int we1; /* Weighting value variable */
- unsigned int vo1; /* Vertex offset variable */
- unsigned int we2; /* Weighting value variable */
- unsigned int vo2; /* Vertex offset variable */
- unsigned int we3; /* Weighting value variable */
- unsigned int vo3; /* Vertex offset variable */
- unsigned int we4; /* Weighting value variable */
- unsigned int vo4; /* Vertex offset variable */
- unsigned int we5; /* Weighting value variable */
- unsigned int vo5; /* Vertex offset variable */
- unsigned int we6; /* Weighting value variable */
- unsigned int vo6; /* Vertex offset variable */
- unsigned int we7; /* Weighting value variable */
- unsigned int vo7; /* Vertex offset variable */
- {
- unsigned int ti_i; /* Interpolation index variable */
-
- ti_i = IT_IX(it0, ip0[0]);
- we0 = IT_WE(it0, ip0[0]);
- vo0 = IT_VO(it0, ip0[0]);
- ti_i += IT_IX(it1, ip0[1]);
- we1 = IT_WE(it1, ip0[1]);
- vo1 = IT_VO(it1, ip0[1]);
- ti_i += IT_IX(it2, ip0[2]);
- we2 = IT_WE(it2, ip0[2]);
- vo2 = IT_VO(it2, ip0[2]);
- ti_i += IT_IX(it3, ip0[3]);
- we3 = IT_WE(it3, ip0[3]);
- vo3 = IT_VO(it3, ip0[3]);
- ti_i += IT_IX(it4, ip0[4]);
- we4 = IT_WE(it4, ip0[4]);
- vo4 = IT_VO(it4, ip0[4]);
- ti_i += IT_IX(it5, ip0[5]);
- we5 = IT_WE(it5, ip0[5]);
- vo5 = IT_VO(it5, ip0[5]);
- ti_i += IT_IX(it6, ip0[6]);
- we6 = IT_WE(it6, ip0[6]);
- vo6 = IT_VO(it6, ip0[6]);
- ti_i += IT_IX(it7, ip0[7]);
- we7 = IT_WE(it7, ip0[7]);
- vo7 = IT_VO(it7, ip0[7]);
-
- imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
-
- /* Sort weighting values and vertex offset values */
- CEX(we0, vo0, we1, vo1);
- CEX(we0, vo0, we2, vo2);
- CEX(we0, vo0, we3, vo3);
- CEX(we0, vo0, we4, vo4);
- CEX(we0, vo0, we5, vo5);
- CEX(we0, vo0, we6, vo6);
- CEX(we0, vo0, we7, vo7);
- CEX(we1, vo1, we2, vo2);
- CEX(we1, vo1, we3, vo3);
- CEX(we1, vo1, we4, vo4);
- CEX(we1, vo1, we5, vo5);
- CEX(we1, vo1, we6, vo6);
- CEX(we1, vo1, we7, vo7);
- CEX(we2, vo2, we3, vo3);
- CEX(we2, vo2, we4, vo4);
- CEX(we2, vo2, we5, vo5);
- CEX(we2, vo2, we6, vo6);
- CEX(we2, vo2, we7, vo7);
- CEX(we3, vo3, we4, vo4);
- CEX(we3, vo3, we5, vo5);
- CEX(we3, vo3, we6, vo6);
- CEX(we3, vo3, we7, vo7);
- CEX(we4, vo4, we5, vo5);
- CEX(we4, vo4, we6, vo6);
- CEX(we4, vo4, we7, vo7);
- CEX(we5, vo5, we6, vo6);
- CEX(we5, vo5, we7, vo7);
- CEX(we6, vo6, we7, vo7);
- }
- {
- unsigned int vof; /* Vertex offset value */
- unsigned int vwe; /* Vertex weighting */
-
- vof = 0; /* First vertex offset is 0 */
- vwe = 65536 - we0; /* Baricentric weighting */
- ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo0; /* Move to next vertex */
- vwe = we0 - we1; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo1; /* Move to next vertex */
- vwe = we1 - we2; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo2; /* Move to next vertex */
- vwe = we2 - we3; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo3; /* Move to next vertex */
- vwe = we3 - we4; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo4; /* Move to next vertex */
- vwe = we4 - we5; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo5; /* Move to next vertex */
- vwe = we5 - we6; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo6; /* Move to next vertex */
- vwe = we6 - we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- vof += vo7; /* Move to next vertex */
- vwe = we7; /* Baricentric weighting */
- ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
- ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
- ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
- ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
- ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
- ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
- ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
- ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
- }
- }
- {
- unsigned int oti; /* Vertex offset value */
- oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
- op0[0] = OT_E(ot0, oti); /* Write result */
- oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
- op0[1] = OT_E(ot1, oti); /* Write result */
- oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
- op0[2] = OT_E(ot2, oti); /* Write result */
- oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
- op0[3] = OT_E(ot3, oti); /* Write result */
- oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
- op0[4] = OT_E(ot4, oti); /* Write result */
- oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
- op0[5] = OT_E(ot5, oti); /* Write result */
- oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
- op0[6] = OT_E(ot6, oti); /* Write result */
- oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
- op0[7] = OT_E(ot7, oti); /* Write result */
- }
- }
+ imdi_imp *p = (imdi_imp *)(s->impl);
+ unsigned short *ip0 = (unsigned short *)inp[0];
+ unsigned short *op0 = (unsigned short *)outp[0];
+ unsigned short *ep = ip0 + npix * 8 ;
+ pointer it0 = (pointer)p->in_tables[0];
+ pointer it1 = (pointer)p->in_tables[1];
+ pointer it2 = (pointer)p->in_tables[2];
+ pointer it3 = (pointer)p->in_tables[3];
+ pointer it4 = (pointer)p->in_tables[4];
+ pointer it5 = (pointer)p->in_tables[5];
+ pointer it6 = (pointer)p->in_tables[6];
+ pointer it7 = (pointer)p->in_tables[7];
+ pointer ot0 = (pointer)p->out_tables[0];
+ pointer ot1 = (pointer)p->out_tables[1];
+ pointer ot2 = (pointer)p->out_tables[2];
+ pointer ot3 = (pointer)p->out_tables[3];
+ pointer ot4 = (pointer)p->out_tables[4];
+ pointer ot5 = (pointer)p->out_tables[5];
+ pointer ot6 = (pointer)p->out_tables[6];
+ pointer ot7 = (pointer)p->out_tables[7];
+ pointer im_base = (pointer)p->im_table;
+
+ for(;ip0 < ep; ip0 += 8, op0 += 8) {
+ unsigned int ova0; /* Output value accumulator */
+ unsigned int ova1; /* Output value accumulator */
+ unsigned int ova2; /* Output value accumulator */
+ unsigned int ova3; /* Output value accumulator */
+ unsigned int ova4; /* Output value accumulator */
+ unsigned int ova5; /* Output value accumulator */
+ unsigned int ova6; /* Output value accumulator */
+ unsigned int ova7; /* Output value accumulator */
+ {
+ pointer imp;
+ unsigned int we0; /* Weighting value variable */
+ unsigned int vo0; /* Vertex offset variable */
+ unsigned int we1; /* Weighting value variable */
+ unsigned int vo1; /* Vertex offset variable */
+ unsigned int we2; /* Weighting value variable */
+ unsigned int vo2; /* Vertex offset variable */
+ unsigned int we3; /* Weighting value variable */
+ unsigned int vo3; /* Vertex offset variable */
+ unsigned int we4; /* Weighting value variable */
+ unsigned int vo4; /* Vertex offset variable */
+ unsigned int we5; /* Weighting value variable */
+ unsigned int vo5; /* Vertex offset variable */
+ unsigned int we6; /* Weighting value variable */
+ unsigned int vo6; /* Vertex offset variable */
+ unsigned int we7; /* Weighting value variable */
+ unsigned int vo7; /* Vertex offset variable */
+ {
+ unsigned int ti_i; /* Interpolation index variable */
+
+ ti_i = IT_IX(it0, ip0[0]);
+ we0 = IT_WE(it0, ip0[0]);
+ vo0 = IT_VO(it0, ip0[0]);
+ ti_i += IT_IX(it1, ip0[1]);
+ we1 = IT_WE(it1, ip0[1]);
+ vo1 = IT_VO(it1, ip0[1]);
+ ti_i += IT_IX(it2, ip0[2]);
+ we2 = IT_WE(it2, ip0[2]);
+ vo2 = IT_VO(it2, ip0[2]);
+ ti_i += IT_IX(it3, ip0[3]);
+ we3 = IT_WE(it3, ip0[3]);
+ vo3 = IT_VO(it3, ip0[3]);
+ ti_i += IT_IX(it4, ip0[4]);
+ we4 = IT_WE(it4, ip0[4]);
+ vo4 = IT_VO(it4, ip0[4]);
+ ti_i += IT_IX(it5, ip0[5]);
+ we5 = IT_WE(it5, ip0[5]);
+ vo5 = IT_VO(it5, ip0[5]);
+ ti_i += IT_IX(it6, ip0[6]);
+ we6 = IT_WE(it6, ip0[6]);
+ vo6 = IT_VO(it6, ip0[6]);
+ ti_i += IT_IX(it7, ip0[7]);
+ we7 = IT_WE(it7, ip0[7]);
+ vo7 = IT_VO(it7, ip0[7]);
+
+ imp = im_base + IM_O(ti_i); /* Compute interp. table entry pointer */
+
+ /* Sort weighting values and vertex offset values */
+ CEX(we0, vo0, we1, vo1);
+ CEX(we0, vo0, we2, vo2);
+ CEX(we0, vo0, we3, vo3);
+ CEX(we0, vo0, we4, vo4);
+ CEX(we0, vo0, we5, vo5);
+ CEX(we0, vo0, we6, vo6);
+ CEX(we0, vo0, we7, vo7);
+ CEX(we1, vo1, we2, vo2);
+ CEX(we1, vo1, we3, vo3);
+ CEX(we1, vo1, we4, vo4);
+ CEX(we1, vo1, we5, vo5);
+ CEX(we1, vo1, we6, vo6);
+ CEX(we1, vo1, we7, vo7);
+ CEX(we2, vo2, we3, vo3);
+ CEX(we2, vo2, we4, vo4);
+ CEX(we2, vo2, we5, vo5);
+ CEX(we2, vo2, we6, vo6);
+ CEX(we2, vo2, we7, vo7);
+ CEX(we3, vo3, we4, vo4);
+ CEX(we3, vo3, we5, vo5);
+ CEX(we3, vo3, we6, vo6);
+ CEX(we3, vo3, we7, vo7);
+ CEX(we4, vo4, we5, vo5);
+ CEX(we4, vo4, we6, vo6);
+ CEX(we4, vo4, we7, vo7);
+ CEX(we5, vo5, we6, vo6);
+ CEX(we5, vo5, we7, vo7);
+ CEX(we6, vo6, we7, vo7);
+ }
+ {
+ unsigned int vof; /* Vertex offset value */
+ unsigned int vwe; /* Vertex weighting */
+
+ vof = 0; /* First vertex offset is 0 */
+ vwe = 65536 - we0; /* Baricentric weighting */
+ ova0 = IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 = IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 = IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 = IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 = IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 = IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 = IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 = IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo0; /* Move to next vertex */
+ vwe = we0 - we1; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo1; /* Move to next vertex */
+ vwe = we1 - we2; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo2; /* Move to next vertex */
+ vwe = we2 - we3; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo3; /* Move to next vertex */
+ vwe = we3 - we4; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo4; /* Move to next vertex */
+ vwe = we4 - we5; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo5; /* Move to next vertex */
+ vwe = we5 - we6; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo6; /* Move to next vertex */
+ vwe = we6 - we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ vof += vo7; /* Move to next vertex */
+ vwe = we7; /* Baricentric weighting */
+ ova0 += IM_FE(imp, vof, 0) * vwe; /* Accumulate weighted output values */
+ ova1 += IM_FE(imp, vof, 1) * vwe; /* Accumulate weighted output values */
+ ova2 += IM_FE(imp, vof, 2) * vwe; /* Accumulate weighted output values */
+ ova3 += IM_FE(imp, vof, 3) * vwe; /* Accumulate weighted output values */
+ ova4 += IM_FE(imp, vof, 4) * vwe; /* Accumulate weighted output values */
+ ova5 += IM_FE(imp, vof, 5) * vwe; /* Accumulate weighted output values */
+ ova6 += IM_FE(imp, vof, 6) * vwe; /* Accumulate weighted output values */
+ ova7 += IM_FE(imp, vof, 7) * vwe; /* Accumulate weighted output values */
+ }
+ }
+ {
+ unsigned int oti; /* Vertex offset value */
+ oti = ((ova0 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[0] = OT_E(ot0, oti); /* Write result */
+ oti = ((ova1 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[1] = OT_E(ot1, oti); /* Write result */
+ oti = ((ova2 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[2] = OT_E(ot2, oti); /* Write result */
+ oti = ((ova3 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[3] = OT_E(ot3, oti); /* Write result */
+ oti = ((ova4 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[4] = OT_E(ot4, oti); /* Write result */
+ oti = ((ova5 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[5] = OT_E(ot5, oti); /* Write result */
+ oti = ((ova6 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[6] = OT_E(ot6, oti); /* Write result */
+ oti = ((ova7 >> 16) & 0xffff); /* Extract integer part of result */
+ op0[7] = OT_E(ot7, oti); /* Write result */
+ }
+ }
}
#undef IT_WE
#undef IT_VO
@@ -53048,134 +52171,128 @@ static void
imdi_k147_gen(
genspec *g /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
- 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
- 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
- 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
- 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
- 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
- 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
- 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
- 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
- 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
- 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
- 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
- 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
- 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
- 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
- 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
- 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
- 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
- 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
- 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
- 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
- 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
- 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
- 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
- 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
- 0x00, 0xf0, 0x04, 0x08
- }; /* Structure image */
-
- memcpy(g, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
+ 0x74, 0x20, 0x32, 0x30, 0x30, 0x34, 0x20, 0x47,
+ 0x72, 0x61, 0x65, 0x6d, 0x65, 0x20, 0x57, 0x2e,
+ 0x20, 0x47, 0x69, 0x6c, 0x6c, 0x00, 0x04, 0x08,
+ 0x04, 0xad, 0xf2, 0xb7, 0xc5, 0x83, 0x04, 0x08,
+ 0x50, 0xad, 0xf2, 0xb7, 0x6c, 0x6c, 0xdd, 0xb7,
+ 0x34, 0xda, 0x83, 0xbf, 0xf6, 0x35, 0xf3, 0xb7,
+ 0x8b, 0xca, 0xdd, 0xb7, 0xbb, 0x83, 0x04, 0x08,
+ 0x31, 0x20, 0x4d, 0x6f, 0x6e, 0x20, 0x46, 0x65,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00,
+ 0x4e, 0xcb, 0xdd, 0xb7, 0xfc, 0x79, 0xdd, 0xb7,
+ 0x2c, 0xf3, 0xdc, 0xb7, 0x38, 0x5f, 0x38, 0x5f,
+ 0x69, 0x31, 0x36, 0x5f, 0x69, 0x31, 0x36, 0x5f,
+ 0x66, 0x00, 0x77, 0x01, 0x9b, 0x83, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0x00, 0x00, 0x00, 0x00,
+ 0xac, 0xb1, 0xf2, 0xb7, 0xf8, 0xda, 0x83, 0xbf,
+ 0xc9, 0x37, 0xf3, 0xb7, 0x40, 0x82, 0x04, 0x08,
+ 0xb4, 0xda, 0x83, 0xbf, 0x58, 0xb1, 0xf2, 0xb7,
+ 0x02, 0x00, 0x00, 0x00, 0x80, 0xb0, 0xdc, 0xb7,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x28, 0x6e, 0x6f, 0xb4, 0xda, 0x83, 0xbf,
+ 0x69, 0x6d, 0x64, 0x69, 0x5f, 0x6b, 0x31, 0x34,
+ 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x8e, 0xff, 0x77, 0x01,
+ 0x20, 0xdb, 0x83, 0xbf, 0x00, 0xb0, 0xf2, 0xb7,
+ 0x9b, 0x83, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x1b, 0xfa, 0x83, 0xbf, 0xee, 0xb1, 0xec, 0xb7,
+ 0x98, 0xc8, 0x04, 0x08, 0xe8, 0xf0, 0x04, 0x08,
+ 0xc8, 0xda, 0x83, 0xbf, 0xdd, 0x84, 0x04, 0x08,
+ 0xdc, 0x60, 0xef, 0xb7, 0x80, 0xdb, 0x83, 0xbf,
+ 0xe8, 0xda, 0x83, 0xbf, 0xb3, 0xc8, 0x04, 0x08,
+ 0x38, 0x18, 0xf4, 0xb7, 0xdc, 0x60, 0xef, 0xb7,
+ 0x00, 0xf0, 0x04, 0x08
+ }; /* Structure image */
+
+ memcpy(g, data, sizeof(data)); /* Initialise the structure */
}
static void
imdi_k147_tab(
tabspec *t /* structure to be initialised */
) {
- static unsigned char data[] = {
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
- }; /* Structure image */
-
- memcpy(t, data, sizeof(data)); /* Initialise the structure */
+ static unsigned char data[] = {
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+ }; /* Structure image */
+
+ memcpy(t, data, sizeof(data)); /* Initialise the structure */
}
-
-
-
-
-
-
diff --git a/gs/imdi/imdi_k.h b/gs/imdi/imdi_k.h
index 29214d678..c71f60455 100644
--- a/gs/imdi/imdi_k.h
+++ b/gs/imdi/imdi_k.h
@@ -4,158 +4,157 @@
#include "imdi_k.c" /* All the kernel code */
struct {
- void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix);
- void (*gen)(genspec *g);
- void (*tab)(tabspec *t);
+ void (*interp)(imdi *s, void **outp, void **inp, unsigned int npix);
+ void (*gen)(genspec *g);
+ void (*tab)(tabspec *t);
} ktable[147] = {
- { imdi_k1, imdi_k1_gen, imdi_k1_tab },
- { imdi_k2, imdi_k2_gen, imdi_k2_tab },
- { imdi_k3, imdi_k3_gen, imdi_k3_tab },
- { imdi_k4, imdi_k4_gen, imdi_k4_tab },
- { imdi_k5, imdi_k5_gen, imdi_k5_tab },
- { imdi_k6, imdi_k6_gen, imdi_k6_tab },
- { imdi_k7, imdi_k7_gen, imdi_k7_tab },
- { imdi_k8, imdi_k8_gen, imdi_k8_tab },
- { imdi_k9, imdi_k9_gen, imdi_k9_tab },
- { imdi_k10, imdi_k10_gen, imdi_k10_tab },
- { imdi_k11, imdi_k11_gen, imdi_k11_tab },
- { imdi_k12, imdi_k12_gen, imdi_k12_tab },
- { imdi_k13, imdi_k13_gen, imdi_k13_tab },
- { imdi_k14, imdi_k14_gen, imdi_k14_tab },
- { imdi_k15, imdi_k15_gen, imdi_k15_tab },
- { imdi_k16, imdi_k16_gen, imdi_k16_tab },
- { imdi_k17, imdi_k17_gen, imdi_k17_tab },
- { imdi_k18, imdi_k18_gen, imdi_k18_tab },
- { imdi_k19, imdi_k19_gen, imdi_k19_tab },
- { imdi_k20, imdi_k20_gen, imdi_k20_tab },
- { imdi_k21, imdi_k21_gen, imdi_k21_tab },
- { imdi_k22, imdi_k22_gen, imdi_k22_tab },
- { imdi_k23, imdi_k23_gen, imdi_k23_tab },
- { imdi_k24, imdi_k24_gen, imdi_k24_tab },
- { imdi_k25, imdi_k25_gen, imdi_k25_tab },
- { imdi_k26, imdi_k26_gen, imdi_k26_tab },
- { imdi_k27, imdi_k27_gen, imdi_k27_tab },
- { imdi_k28, imdi_k28_gen, imdi_k28_tab },
- { imdi_k29, imdi_k29_gen, imdi_k29_tab },
- { imdi_k30, imdi_k30_gen, imdi_k30_tab },
- { imdi_k31, imdi_k31_gen, imdi_k31_tab },
- { imdi_k32, imdi_k32_gen, imdi_k32_tab },
- { imdi_k33, imdi_k33_gen, imdi_k33_tab },
- { imdi_k34, imdi_k34_gen, imdi_k34_tab },
- { imdi_k35, imdi_k35_gen, imdi_k35_tab },
- { imdi_k36, imdi_k36_gen, imdi_k36_tab },
- { imdi_k37, imdi_k37_gen, imdi_k37_tab },
- { imdi_k38, imdi_k38_gen, imdi_k38_tab },
- { imdi_k39, imdi_k39_gen, imdi_k39_tab },
- { imdi_k40, imdi_k40_gen, imdi_k40_tab },
- { imdi_k41, imdi_k41_gen, imdi_k41_tab },
- { imdi_k42, imdi_k42_gen, imdi_k42_tab },
- { imdi_k43, imdi_k43_gen, imdi_k43_tab },
- { imdi_k44, imdi_k44_gen, imdi_k44_tab },
- { imdi_k45, imdi_k45_gen, imdi_k45_tab },
- { imdi_k46, imdi_k46_gen, imdi_k46_tab },
- { imdi_k47, imdi_k47_gen, imdi_k47_tab },
- { imdi_k48, imdi_k48_gen, imdi_k48_tab },
- { imdi_k49, imdi_k49_gen, imdi_k49_tab },
- { imdi_k50, imdi_k50_gen, imdi_k50_tab },
- { imdi_k51, imdi_k51_gen, imdi_k51_tab },
- { imdi_k52, imdi_k52_gen, imdi_k52_tab },
- { imdi_k53, imdi_k53_gen, imdi_k53_tab },
- { imdi_k54, imdi_k54_gen, imdi_k54_tab },
- { imdi_k55, imdi_k55_gen, imdi_k55_tab },
- { imdi_k56, imdi_k56_gen, imdi_k56_tab },
- { imdi_k57, imdi_k57_gen, imdi_k57_tab },
- { imdi_k58, imdi_k58_gen, imdi_k58_tab },
- { imdi_k59, imdi_k59_gen, imdi_k59_tab },
- { imdi_k60, imdi_k60_gen, imdi_k60_tab },
- { imdi_k61, imdi_k61_gen, imdi_k61_tab },
- { imdi_k62, imdi_k62_gen, imdi_k62_tab },
- { imdi_k63, imdi_k63_gen, imdi_k63_tab },
- { imdi_k64, imdi_k64_gen, imdi_k64_tab },
- { imdi_k65, imdi_k65_gen, imdi_k65_tab },
- { imdi_k66, imdi_k66_gen, imdi_k66_tab },
- { imdi_k67, imdi_k67_gen, imdi_k67_tab },
- { imdi_k68, imdi_k68_gen, imdi_k68_tab },
- { imdi_k69, imdi_k69_gen, imdi_k69_tab },
- { imdi_k70, imdi_k70_gen, imdi_k70_tab },
- { imdi_k71, imdi_k71_gen, imdi_k71_tab },
- { imdi_k72, imdi_k72_gen, imdi_k72_tab },
- { imdi_k73, imdi_k73_gen, imdi_k73_tab },
- { imdi_k74, imdi_k74_gen, imdi_k74_tab },
- { imdi_k75, imdi_k75_gen, imdi_k75_tab },
- { imdi_k76, imdi_k76_gen, imdi_k76_tab },
- { imdi_k77, imdi_k77_gen, imdi_k77_tab },
- { imdi_k78, imdi_k78_gen, imdi_k78_tab },
- { imdi_k79, imdi_k79_gen, imdi_k79_tab },
- { imdi_k80, imdi_k80_gen, imdi_k80_tab },
- { imdi_k81, imdi_k81_gen, imdi_k81_tab },
- { imdi_k82, imdi_k82_gen, imdi_k82_tab },
- { imdi_k83, imdi_k83_gen, imdi_k83_tab },
- { imdi_k84, imdi_k84_gen, imdi_k84_tab },
- { imdi_k85, imdi_k85_gen, imdi_k85_tab },
- { imdi_k86, imdi_k86_gen, imdi_k86_tab },
- { imdi_k87, imdi_k87_gen, imdi_k87_tab },
- { imdi_k88, imdi_k88_gen, imdi_k88_tab },
- { imdi_k89, imdi_k89_gen, imdi_k89_tab },
- { imdi_k90, imdi_k90_gen, imdi_k90_tab },
- { imdi_k91, imdi_k91_gen, imdi_k91_tab },
- { imdi_k92, imdi_k92_gen, imdi_k92_tab },
- { imdi_k93, imdi_k93_gen, imdi_k93_tab },
- { imdi_k94, imdi_k94_gen, imdi_k94_tab },
- { imdi_k95, imdi_k95_gen, imdi_k95_tab },
- { imdi_k96, imdi_k96_gen, imdi_k96_tab },
- { imdi_k97, imdi_k97_gen, imdi_k97_tab },
- { imdi_k98, imdi_k98_gen, imdi_k98_tab },
- { imdi_k99, imdi_k99_gen, imdi_k99_tab },
- { imdi_k100, imdi_k100_gen, imdi_k100_tab },
- { imdi_k101, imdi_k101_gen, imdi_k101_tab },
- { imdi_k102, imdi_k102_gen, imdi_k102_tab },
- { imdi_k103, imdi_k103_gen, imdi_k103_tab },
- { imdi_k104, imdi_k104_gen, imdi_k104_tab },
- { imdi_k105, imdi_k105_gen, imdi_k105_tab },
- { imdi_k106, imdi_k106_gen, imdi_k106_tab },
- { imdi_k107, imdi_k107_gen, imdi_k107_tab },
- { imdi_k108, imdi_k108_gen, imdi_k108_tab },
- { imdi_k109, imdi_k109_gen, imdi_k109_tab },
- { imdi_k110, imdi_k110_gen, imdi_k110_tab },
- { imdi_k111, imdi_k111_gen, imdi_k111_tab },
- { imdi_k112, imdi_k112_gen, imdi_k112_tab },
- { imdi_k113, imdi_k113_gen, imdi_k113_tab },
- { imdi_k114, imdi_k114_gen, imdi_k114_tab },
- { imdi_k115, imdi_k115_gen, imdi_k115_tab },
- { imdi_k116, imdi_k116_gen, imdi_k116_tab },
- { imdi_k117, imdi_k117_gen, imdi_k117_tab },
- { imdi_k118, imdi_k118_gen, imdi_k118_tab },
- { imdi_k119, imdi_k119_gen, imdi_k119_tab },
- { imdi_k120, imdi_k120_gen, imdi_k120_tab },
- { imdi_k121, imdi_k121_gen, imdi_k121_tab },
- { imdi_k122, imdi_k122_gen, imdi_k122_tab },
- { imdi_k123, imdi_k123_gen, imdi_k123_tab },
- { imdi_k124, imdi_k124_gen, imdi_k124_tab },
- { imdi_k125, imdi_k125_gen, imdi_k125_tab },
- { imdi_k126, imdi_k126_gen, imdi_k126_tab },
- { imdi_k127, imdi_k127_gen, imdi_k127_tab },
- { imdi_k128, imdi_k128_gen, imdi_k128_tab },
- { imdi_k129, imdi_k129_gen, imdi_k129_tab },
- { imdi_k130, imdi_k130_gen, imdi_k130_tab },
- { imdi_k131, imdi_k131_gen, imdi_k131_tab },
- { imdi_k132, imdi_k132_gen, imdi_k132_tab },
- { imdi_k133, imdi_k133_gen, imdi_k133_tab },
- { imdi_k134, imdi_k134_gen, imdi_k134_tab },
- { imdi_k135, imdi_k135_gen, imdi_k135_tab },
- { imdi_k136, imdi_k136_gen, imdi_k136_tab },
- { imdi_k137, imdi_k137_gen, imdi_k137_tab },
- { imdi_k138, imdi_k138_gen, imdi_k138_tab },
- { imdi_k139, imdi_k139_gen, imdi_k139_tab },
- { imdi_k140, imdi_k140_gen, imdi_k140_tab },
- { imdi_k141, imdi_k141_gen, imdi_k141_tab },
- { imdi_k142, imdi_k142_gen, imdi_k142_tab },
- { imdi_k143, imdi_k143_gen, imdi_k143_tab },
- { imdi_k144, imdi_k144_gen, imdi_k144_tab },
- { imdi_k145, imdi_k145_gen, imdi_k145_tab },
- { imdi_k146, imdi_k146_gen, imdi_k146_tab },
- { imdi_k147, imdi_k147_gen, imdi_k147_tab }
+ { imdi_k1, imdi_k1_gen, imdi_k1_tab },
+ { imdi_k2, imdi_k2_gen, imdi_k2_tab },
+ { imdi_k3, imdi_k3_gen, imdi_k3_tab },
+ { imdi_k4, imdi_k4_gen, imdi_k4_tab },
+ { imdi_k5, imdi_k5_gen, imdi_k5_tab },
+ { imdi_k6, imdi_k6_gen, imdi_k6_tab },
+ { imdi_k7, imdi_k7_gen, imdi_k7_tab },
+ { imdi_k8, imdi_k8_gen, imdi_k8_tab },
+ { imdi_k9, imdi_k9_gen, imdi_k9_tab },
+ { imdi_k10, imdi_k10_gen, imdi_k10_tab },
+ { imdi_k11, imdi_k11_gen, imdi_k11_tab },
+ { imdi_k12, imdi_k12_gen, imdi_k12_tab },
+ { imdi_k13, imdi_k13_gen, imdi_k13_tab },
+ { imdi_k14, imdi_k14_gen, imdi_k14_tab },
+ { imdi_k15, imdi_k15_gen, imdi_k15_tab },
+ { imdi_k16, imdi_k16_gen, imdi_k16_tab },
+ { imdi_k17, imdi_k17_gen, imdi_k17_tab },
+ { imdi_k18, imdi_k18_gen, imdi_k18_tab },
+ { imdi_k19, imdi_k19_gen, imdi_k19_tab },
+ { imdi_k20, imdi_k20_gen, imdi_k20_tab },
+ { imdi_k21, imdi_k21_gen, imdi_k21_tab },
+ { imdi_k22, imdi_k22_gen, imdi_k22_tab },
+ { imdi_k23, imdi_k23_gen, imdi_k23_tab },
+ { imdi_k24, imdi_k24_gen, imdi_k24_tab },
+ { imdi_k25, imdi_k25_gen, imdi_k25_tab },
+ { imdi_k26, imdi_k26_gen, imdi_k26_tab },
+ { imdi_k27, imdi_k27_gen, imdi_k27_tab },
+ { imdi_k28, imdi_k28_gen, imdi_k28_tab },
+ { imdi_k29, imdi_k29_gen, imdi_k29_tab },
+ { imdi_k30, imdi_k30_gen, imdi_k30_tab },
+ { imdi_k31, imdi_k31_gen, imdi_k31_tab },
+ { imdi_k32, imdi_k32_gen, imdi_k32_tab },
+ { imdi_k33, imdi_k33_gen, imdi_k33_tab },
+ { imdi_k34, imdi_k34_gen, imdi_k34_tab },
+ { imdi_k35, imdi_k35_gen, imdi_k35_tab },
+ { imdi_k36, imdi_k36_gen, imdi_k36_tab },
+ { imdi_k37, imdi_k37_gen, imdi_k37_tab },
+ { imdi_k38, imdi_k38_gen, imdi_k38_tab },
+ { imdi_k39, imdi_k39_gen, imdi_k39_tab },
+ { imdi_k40, imdi_k40_gen, imdi_k40_tab },
+ { imdi_k41, imdi_k41_gen, imdi_k41_tab },
+ { imdi_k42, imdi_k42_gen, imdi_k42_tab },
+ { imdi_k43, imdi_k43_gen, imdi_k43_tab },
+ { imdi_k44, imdi_k44_gen, imdi_k44_tab },
+ { imdi_k45, imdi_k45_gen, imdi_k45_tab },
+ { imdi_k46, imdi_k46_gen, imdi_k46_tab },
+ { imdi_k47, imdi_k47_gen, imdi_k47_tab },
+ { imdi_k48, imdi_k48_gen, imdi_k48_tab },
+ { imdi_k49, imdi_k49_gen, imdi_k49_tab },
+ { imdi_k50, imdi_k50_gen, imdi_k50_tab },
+ { imdi_k51, imdi_k51_gen, imdi_k51_tab },
+ { imdi_k52, imdi_k52_gen, imdi_k52_tab },
+ { imdi_k53, imdi_k53_gen, imdi_k53_tab },
+ { imdi_k54, imdi_k54_gen, imdi_k54_tab },
+ { imdi_k55, imdi_k55_gen, imdi_k55_tab },
+ { imdi_k56, imdi_k56_gen, imdi_k56_tab },
+ { imdi_k57, imdi_k57_gen, imdi_k57_tab },
+ { imdi_k58, imdi_k58_gen, imdi_k58_tab },
+ { imdi_k59, imdi_k59_gen, imdi_k59_tab },
+ { imdi_k60, imdi_k60_gen, imdi_k60_tab },
+ { imdi_k61, imdi_k61_gen, imdi_k61_tab },
+ { imdi_k62, imdi_k62_gen, imdi_k62_tab },
+ { imdi_k63, imdi_k63_gen, imdi_k63_tab },
+ { imdi_k64, imdi_k64_gen, imdi_k64_tab },
+ { imdi_k65, imdi_k65_gen, imdi_k65_tab },
+ { imdi_k66, imdi_k66_gen, imdi_k66_tab },
+ { imdi_k67, imdi_k67_gen, imdi_k67_tab },
+ { imdi_k68, imdi_k68_gen, imdi_k68_tab },
+ { imdi_k69, imdi_k69_gen, imdi_k69_tab },
+ { imdi_k70, imdi_k70_gen, imdi_k70_tab },
+ { imdi_k71, imdi_k71_gen, imdi_k71_tab },
+ { imdi_k72, imdi_k72_gen, imdi_k72_tab },
+ { imdi_k73, imdi_k73_gen, imdi_k73_tab },
+ { imdi_k74, imdi_k74_gen, imdi_k74_tab },
+ { imdi_k75, imdi_k75_gen, imdi_k75_tab },
+ { imdi_k76, imdi_k76_gen, imdi_k76_tab },
+ { imdi_k77, imdi_k77_gen, imdi_k77_tab },
+ { imdi_k78, imdi_k78_gen, imdi_k78_tab },
+ { imdi_k79, imdi_k79_gen, imdi_k79_tab },
+ { imdi_k80, imdi_k80_gen, imdi_k80_tab },
+ { imdi_k81, imdi_k81_gen, imdi_k81_tab },
+ { imdi_k82, imdi_k82_gen, imdi_k82_tab },
+ { imdi_k83, imdi_k83_gen, imdi_k83_tab },
+ { imdi_k84, imdi_k84_gen, imdi_k84_tab },
+ { imdi_k85, imdi_k85_gen, imdi_k85_tab },
+ { imdi_k86, imdi_k86_gen, imdi_k86_tab },
+ { imdi_k87, imdi_k87_gen, imdi_k87_tab },
+ { imdi_k88, imdi_k88_gen, imdi_k88_tab },
+ { imdi_k89, imdi_k89_gen, imdi_k89_tab },
+ { imdi_k90, imdi_k90_gen, imdi_k90_tab },
+ { imdi_k91, imdi_k91_gen, imdi_k91_tab },
+ { imdi_k92, imdi_k92_gen, imdi_k92_tab },
+ { imdi_k93, imdi_k93_gen, imdi_k93_tab },
+ { imdi_k94, imdi_k94_gen, imdi_k94_tab },
+ { imdi_k95, imdi_k95_gen, imdi_k95_tab },
+ { imdi_k96, imdi_k96_gen, imdi_k96_tab },
+ { imdi_k97, imdi_k97_gen, imdi_k97_tab },
+ { imdi_k98, imdi_k98_gen, imdi_k98_tab },
+ { imdi_k99, imdi_k99_gen, imdi_k99_tab },
+ { imdi_k100, imdi_k100_gen, imdi_k100_tab },
+ { imdi_k101, imdi_k101_gen, imdi_k101_tab },
+ { imdi_k102, imdi_k102_gen, imdi_k102_tab },
+ { imdi_k103, imdi_k103_gen, imdi_k103_tab },
+ { imdi_k104, imdi_k104_gen, imdi_k104_tab },
+ { imdi_k105, imdi_k105_gen, imdi_k105_tab },
+ { imdi_k106, imdi_k106_gen, imdi_k106_tab },
+ { imdi_k107, imdi_k107_gen, imdi_k107_tab },
+ { imdi_k108, imdi_k108_gen, imdi_k108_tab },
+ { imdi_k109, imdi_k109_gen, imdi_k109_tab },
+ { imdi_k110, imdi_k110_gen, imdi_k110_tab },
+ { imdi_k111, imdi_k111_gen, imdi_k111_tab },
+ { imdi_k112, imdi_k112_gen, imdi_k112_tab },
+ { imdi_k113, imdi_k113_gen, imdi_k113_tab },
+ { imdi_k114, imdi_k114_gen, imdi_k114_tab },
+ { imdi_k115, imdi_k115_gen, imdi_k115_tab },
+ { imdi_k116, imdi_k116_gen, imdi_k116_tab },
+ { imdi_k117, imdi_k117_gen, imdi_k117_tab },
+ { imdi_k118, imdi_k118_gen, imdi_k118_tab },
+ { imdi_k119, imdi_k119_gen, imdi_k119_tab },
+ { imdi_k120, imdi_k120_gen, imdi_k120_tab },
+ { imdi_k121, imdi_k121_gen, imdi_k121_tab },
+ { imdi_k122, imdi_k122_gen, imdi_k122_tab },
+ { imdi_k123, imdi_k123_gen, imdi_k123_tab },
+ { imdi_k124, imdi_k124_gen, imdi_k124_tab },
+ { imdi_k125, imdi_k125_gen, imdi_k125_tab },
+ { imdi_k126, imdi_k126_gen, imdi_k126_tab },
+ { imdi_k127, imdi_k127_gen, imdi_k127_tab },
+ { imdi_k128, imdi_k128_gen, imdi_k128_tab },
+ { imdi_k129, imdi_k129_gen, imdi_k129_tab },
+ { imdi_k130, imdi_k130_gen, imdi_k130_tab },
+ { imdi_k131, imdi_k131_gen, imdi_k131_tab },
+ { imdi_k132, imdi_k132_gen, imdi_k132_tab },
+ { imdi_k133, imdi_k133_gen, imdi_k133_tab },
+ { imdi_k134, imdi_k134_gen, imdi_k134_tab },
+ { imdi_k135, imdi_k135_gen, imdi_k135_tab },
+ { imdi_k136, imdi_k136_gen, imdi_k136_tab },
+ { imdi_k137, imdi_k137_gen, imdi_k137_tab },
+ { imdi_k138, imdi_k138_gen, imdi_k138_tab },
+ { imdi_k139, imdi_k139_gen, imdi_k139_tab },
+ { imdi_k140, imdi_k140_gen, imdi_k140_tab },
+ { imdi_k141, imdi_k141_gen, imdi_k141_tab },
+ { imdi_k142, imdi_k142_gen, imdi_k142_tab },
+ { imdi_k143, imdi_k143_gen, imdi_k143_tab },
+ { imdi_k144, imdi_k144_gen, imdi_k144_tab },
+ { imdi_k145, imdi_k145_gen, imdi_k145_tab },
+ { imdi_k146, imdi_k146_gen, imdi_k146_tab },
+ { imdi_k147, imdi_k147_gen, imdi_k147_tab }
};
int no_kfuncs = 147;
-
diff --git a/gs/imdi/imdi_tab.c b/gs/imdi/imdi_tab.c
index 6829a5cb8..4a389f5f1 100644
--- a/gs/imdi/imdi_tab.c
+++ b/gs/imdi/imdi_tab.c
@@ -1,4 +1,3 @@
-
/* Integer Multi-Dimensional Interpolation */
/*
* Copyright 2000 - 2002 Graeme W. Gill
@@ -35,7 +34,6 @@
typedef unsigned char byte;
-
/* Left shift, handles >= 32 properly */
#define LSHIFT(aa, bb) ((bb) <= 31 ? ((aa) << (bb)) : (((aa) << 31) << ((bb)-31)))
@@ -49,7 +47,7 @@ unsigned longlong v
unsigned long v
#endif
) {
- *((unsigned char *)p) = (unsigned char)v;
+ *((unsigned char *)p) = (unsigned char)v;
}
void write_ushort(
@@ -60,7 +58,7 @@ unsigned longlong v
unsigned long v
#endif
) {
- *((unsigned short *)p) = (unsigned short)v;
+ *((unsigned short *)p) = (unsigned short)v;
}
void write_uint(
@@ -71,7 +69,7 @@ unsigned longlong v
unsigned long v
#endif
) {
- *((unsigned int *)p) = (unsigned int)v;
+ *((unsigned int *)p) = (unsigned int)v;
}
void write_ulong(
@@ -82,7 +80,7 @@ unsigned longlong v
unsigned long v
#endif
) {
- *((unsigned long *)p) = (unsigned long)v;
+ *((unsigned long *)p) = (unsigned long)v;
}
#ifdef ALLOW64
@@ -90,7 +88,7 @@ void write_ulonglong(
byte *p,
unsigned longlong v
) {
- *((unsigned longlong *)p) = (unsigned longlong)v;
+ *((unsigned longlong *)p) = (unsigned longlong)v;
}
#endif /* ALLOW64 */
@@ -102,9 +100,9 @@ unsigned longlong v
unsigned long v
#endif
) {
- fprintf(stderr,"imdi_tabl: internal failure - unexpected write size!\n");
+ fprintf(stderr,"imdi_tabl: internal failure - unexpected write size!\n");
*((char *)NULL) = 0; /* ~~999 */
- exit(-1);
+ exit(-1);
}
/* Array of write routines */
@@ -116,556 +114,556 @@ void (*write_entry[16])(byte *p, unsigned long v);
void
init_write_tab(void) {
- int i;
+ int i;
- for (i = 0; i < 16; i++)
- write_entry[i] = write_default; /* Make sure any un-inited access bombs */
+ for (i = 0; i < 16; i++)
+ write_entry[i] = write_default; /* Make sure any un-inited access bombs */
- write_entry[sizeof(unsigned char)] = write_uchar;
- write_entry[sizeof(unsigned short)] = write_ushort;
- write_entry[sizeof(unsigned int)] = write_uint;
- write_entry[sizeof(unsigned long)] = write_ulong;
+ write_entry[sizeof(unsigned char)] = write_uchar;
+ write_entry[sizeof(unsigned short)] = write_ushort;
+ write_entry[sizeof(unsigned int)] = write_uint;
+ write_entry[sizeof(unsigned long)] = write_ulong;
#ifdef ALLOW64
- write_entry[sizeof(unsigned longlong)] = write_ulonglong;
+ write_entry[sizeof(unsigned longlong)] = write_ulonglong;
#endif /* ALLOW64 */
}
imdi_imp *
imdi_tab(
- genspec *gs, /* Pointer to gen spec */
- tabspec *ts, /* Pointer to table spec */
-
- /* Callbacks to lookup the mdi table values */
- double (*input_curve) (void *cntx, int ch, double in_val),
- void (*md_table) (void *cntx, double *out_vals, double *in_vals),
- double (*output_curve)(void *cntx, int ch, double in_val),
- void *cntx /* Context to callbacks */
+ genspec *gs, /* Pointer to gen spec */
+ tabspec *ts, /* Pointer to table spec */
+
+ /* Callbacks to lookup the mdi table values */
+ double (*input_curve) (void *cntx, int ch, double in_val),
+ void (*md_table) (void *cntx, double *out_vals, double *in_vals),
+ double (*output_curve)(void *cntx, int ch, double in_val),
+ void *cntx /* Context to callbacks */
) {
- static inited = 0;
- static bigend = 0;
- int e;
- imdi_imp *it;
- unsigned long etest = 0xff;
- int idinc[IXDI+1]; /* Increment for each dimension of interp table. */
- int ibdinc[IXDI+1]; /* idinc[] in bytes */
- int sdinc[IXDI+1]; /* Increment for each dimension of simplex table. */
- int sbdinc[IXDI+1]; /* sdinc[] in bytes */
+ static inited = 0;
+ static bigend = 0;
+ int e;
+ imdi_imp *it;
+ unsigned long etest = 0xff;
+ int idinc[IXDI+1]; /* Increment for each dimension of interp table. */
+ int ibdinc[IXDI+1]; /* idinc[] in bytes */
+ int sdinc[IXDI+1]; /* Increment for each dimension of simplex table. */
+ int sbdinc[IXDI+1]; /* sdinc[] in bytes */
#ifdef VERBOSE
- printf("imdi_tab called\n");
+ printf("imdi_tab called\n");
#endif
- if (inited == 0) {
- init_write_tab();
- if (*((unsigned char *)&etest) == 0xff)
- bigend = 0; /* Little endian */
- else
- bigend = 1; /* Big endian */
- inited = 1;
- }
+ if (inited == 0) {
+ init_write_tab();
+ if (*((unsigned char *)&etest) == 0xff)
+ bigend = 0; /* Little endian */
+ else
+ bigend = 1; /* Big endian */
+ inited = 1;
+ }
- if ((it = (imdi_imp *)malloc(sizeof(imdi_imp))) == NULL) {
+ if ((it = (imdi_imp *)malloc(sizeof(imdi_imp))) == NULL) {
#ifdef VERBOSE
- printf("malloc imdi_imp size %d failed\n",sizeof(imdi_imp));
+ printf("malloc imdi_imp size %d failed\n",sizeof(imdi_imp));
#endif
- return NULL; /* Should we signal error ? How ? */
- }
-
- /* Compute interp and simplex table dimension increments & total sizes */
- idinc[0] = 1;
- ibdinc[0] = ts->im_ts;
- for (e = 1; e <= gs->id; e++) {
- idinc[e] = idinc[e-1] * gs->itres;
- ibdinc[e] = ibdinc[e-1] * gs->itres;
- }
-
- if (!ts->sort) {
- sdinc[0] = 1;
- sbdinc[0] = ts->sm_ts;
- for (e = 1; e <= gs->id; e++) {
- sdinc[e] = sdinc[e-1] * gs->stres;
- sbdinc[e] = sbdinc[e-1] * gs->stres;
- }
- }
-
- /* First we setup the input tables */
- for (e = 0; e < gs->id; e++) {
- byte *t, *p; /* Pointer to input table, entry pointer */
- int ne; /* Number of entries */
- int ex; /* Entry index */
- int ix = 0; /* Extract flag */
-
- /* Compute number of entries */
- if (ts->it_ix && !gs->in.packed) { /* Input is the whole bpch[] size */
- ix = 1; /* Need to do extraction in lookup */
- if (gs->in.pint) {
- ne = (1 << (gs->in.bpch[0])); /* Same size used for all input tables */
- } else {
- ne = (1 << (gs->in.bpch[e])); /* This input channels size */
- }
- } else { /* Input is the value size */
- ne = (1 << (gs->in.bpv[e])); /* This input values size */
- }
-
- /* Allocate the table */
- if ((t = (byte *)malloc(ts->it_ts * ne)) == NULL) {
+ return NULL; /* Should we signal error ? How ? */
+ }
+
+ /* Compute interp and simplex table dimension increments & total sizes */
+ idinc[0] = 1;
+ ibdinc[0] = ts->im_ts;
+ for (e = 1; e <= gs->id; e++) {
+ idinc[e] = idinc[e-1] * gs->itres;
+ ibdinc[e] = ibdinc[e-1] * gs->itres;
+ }
+
+ if (!ts->sort) {
+ sdinc[0] = 1;
+ sbdinc[0] = ts->sm_ts;
+ for (e = 1; e <= gs->id; e++) {
+ sdinc[e] = sdinc[e-1] * gs->stres;
+ sbdinc[e] = sbdinc[e-1] * gs->stres;
+ }
+ }
+
+ /* First we setup the input tables */
+ for (e = 0; e < gs->id; e++) {
+ byte *t, *p; /* Pointer to input table, entry pointer */
+ int ne; /* Number of entries */
+ int ex; /* Entry index */
+ int ix = 0; /* Extract flag */
+
+ /* Compute number of entries */
+ if (ts->it_ix && !gs->in.packed) { /* Input is the whole bpch[] size */
+ ix = 1; /* Need to do extraction in lookup */
+ if (gs->in.pint) {
+ ne = (1 << (gs->in.bpch[0])); /* Same size used for all input tables */
+ } else {
+ ne = (1 << (gs->in.bpch[e])); /* This input channels size */
+ }
+ } else { /* Input is the value size */
+ ne = (1 << (gs->in.bpv[e])); /* This input values size */
+ }
+
+ /* Allocate the table */
+ if ((t = (byte *)malloc(ts->it_ts * ne)) == NULL) {
#ifdef VERBOSE
- printf("malloc imdi input table size %d failed\n",ts->it_ts * ne);
+ printf("malloc imdi input table size %d failed\n",ts->it_ts * ne);
#endif
- return NULL; /* Should we signal error ? How ? */
- }
-
- /* For each possible input value, compute the entry value */
- for (ex = 0, p = t; ex < ne; ex++, p += ts->it_ts) {
- int ee;
- int iiv; /* Integer input value */
- int ivr; /* Input value range */
- int isb; /* Input sign bit/signed to offset displacement */
- double riv; /* Real input value, 0.0 - 1.0 */
- double rtv; /* Real transformed value, 0.0 - 1.0 */
- double rmi; /* Real interpolation table index */
- double rsi; /* Real simplex index */
- int imi; /* Interpiolation table index */
- int isi; /* Integer simplex index */
- int iwe; /* Integer weighting value */
- int vo; /* Vertex offset value */
-
- if (ix) { /* Extract value from index */
- ivr = ((1 << (gs->in.bpv[e])) -1);
- iiv = (ex >> gs->in.bov[e]) & ((1 << (gs->in.bpv[e])) -1);
- } else {
- ivr = (ne - 1); /* (Should be bpv[e], but take no chances!) */
- iiv = ex; /* Input value is simply index */
- }
- isb = ivr & ~(((unsigned int)ivr) >> 1); /* Top bit */
- if (gs->in_signed & (1 << e)) /* Treat input as signed */
- iiv = (iiv & isb) ? iiv - isb : iiv + isb; /* Convert to offset from signed */
- riv = (double) iiv / (double)ivr; /* Compute floating point */
- rtv = input_curve(cntx, e, riv); /* Lookup the input table transform */
- if (rtv < 0.0) /* Guard against sillies */
- rtv = 0.0;
- else if (rtv > 1.0)
- rtv = 1.0;
-
- /* divide into interp base and cube sub index */
- rmi = rtv * (gs->itres - 1);
- imi = (int)floor(rmi); /* Interp. entry coordinate */
- if (imi >= (gs->itres-1)) /* Keep cube base one row back from far edge */
- imi = gs->itres-2;
- rsi = rmi - (double)imi; /* offset into entry cube */
- if (ts->sort) {
- iwe = (int)((rsi * (1 << gs->prec)) + 0.5); /* Weighting scale */
- vo = idinc[e] * ts->vo_om; /* Vertex offset */
- } else {
- isi = (int)((rsi * gs->stres) + 0.5);
- if (isi == gs->stres) { /* Keep simplex index within table */
- isi = 0;
- imi++; /* Move to next interp. lattice */
- }
- isi *= sdinc[e]; /* Convert the raw indexes into offset in this dim */
- }
- imi *= idinc[e]; /* Convert the raw indexes into offset in this dim */
+ return NULL; /* Should we signal error ? How ? */
+ }
+
+ /* For each possible input value, compute the entry value */
+ for (ex = 0, p = t; ex < ne; ex++, p += ts->it_ts) {
+ int ee;
+ int iiv; /* Integer input value */
+ int ivr; /* Input value range */
+ int isb; /* Input sign bit/signed to offset displacement */
+ double riv; /* Real input value, 0.0 - 1.0 */
+ double rtv; /* Real transformed value, 0.0 - 1.0 */
+ double rmi; /* Real interpolation table index */
+ double rsi; /* Real simplex index */
+ int imi; /* Interpiolation table index */
+ int isi; /* Integer simplex index */
+ int iwe; /* Integer weighting value */
+ int vo; /* Vertex offset value */
+
+ if (ix) { /* Extract value from index */
+ ivr = ((1 << (gs->in.bpv[e])) -1);
+ iiv = (ex >> gs->in.bov[e]) & ((1 << (gs->in.bpv[e])) -1);
+ } else {
+ ivr = (ne - 1); /* (Should be bpv[e], but take no chances!) */
+ iiv = ex; /* Input value is simply index */
+ }
+ isb = ivr & ~(((unsigned int)ivr) >> 1); /* Top bit */
+ if (gs->in_signed & (1 << e)) /* Treat input as signed */
+ iiv = (iiv & isb) ? iiv - isb : iiv + isb; /* Convert to offset from signed */
+ riv = (double) iiv / (double)ivr; /* Compute floating point */
+ rtv = input_curve(cntx, e, riv); /* Lookup the input table transform */
+ if (rtv < 0.0) /* Guard against sillies */
+ rtv = 0.0;
+ else if (rtv > 1.0)
+ rtv = 1.0;
+
+ /* divide into interp base and cube sub index */
+ rmi = rtv * (gs->itres - 1);
+ imi = (int)floor(rmi); /* Interp. entry coordinate */
+ if (imi >= (gs->itres-1)) /* Keep cube base one row back from far edge */
+ imi = gs->itres-2;
+ rsi = rmi - (double)imi; /* offset into entry cube */
+ if (ts->sort) {
+ iwe = (int)((rsi * (1 << gs->prec)) + 0.5); /* Weighting scale */
+ vo = idinc[e] * ts->vo_om; /* Vertex offset */
+ } else {
+ isi = (int)((rsi * gs->stres) + 0.5);
+ if (isi == gs->stres) { /* Keep simplex index within table */
+ isi = 0;
+ imi++; /* Move to next interp. lattice */
+ }
+ isi *= sdinc[e]; /* Convert the raw indexes into offset in this dim */
+ }
+ imi *= idinc[e]; /* Convert the raw indexes into offset in this dim */
#ifdef ASSERTS
- /* ~~~ needs fixing for sort ~~~~ */
- if ((imi & (LSHIFT(1,ts->it_ab)-1)) != imi)
- error("imdi_tab assert: (imi & ((1 << ts->it_ab)-1)) != imi, imi = 0x%x, it_ab = 0x%x\n",imi,ts->it_ab);
- if (imi >= idinc[gs->id])
- error("imdi_tab assert: imi >= idinc[gs->id]\n");
- if ((isi & (LSHIFT(1,ts->sx_ab)-1)) != isi)
- error("imdi_tab assert: (isi & ((1 << ts->sx_ab)-1)) != isi, isi = 0x%x, sx_ab = 0x%x\n",isi,ts->sx_ab);
- if (!ts->sort && isi >= sdinc[gs->id])
- error("imdi_tab assert: isi >= sdinc[gs->id]\n");
+ /* ~~~ needs fixing for sort ~~~~ */
+ if ((imi & (LSHIFT(1,ts->it_ab)-1)) != imi)
+ error("imdi_tab assert: (imi & ((1 << ts->it_ab)-1)) != imi, imi = 0x%x, it_ab = 0x%x\n",imi,ts->it_ab);
+ if (imi >= idinc[gs->id])
+ error("imdi_tab assert: imi >= idinc[gs->id]\n");
+ if ((isi & (LSHIFT(1,ts->sx_ab)-1)) != isi)
+ error("imdi_tab assert: (isi & ((1 << ts->sx_ab)-1)) != isi, isi = 0x%x, sx_ab = 0x%x\n",isi,ts->sx_ab);
+ if (!ts->sort && isi >= sdinc[gs->id])
+ error("imdi_tab assert: isi >= sdinc[gs->id]\n");
#endif
- /* Now stuff them into the table entry */
- if (ts->sort) {
- if (ts->it_xs) { /* Separate interp index and weight/offset*/
- if (ts->wo_xs) { /* All 3 are separate */
- write_entry[ts->ix_es](p + ts->ix_eo, imi);
- write_entry[ts->we_es](p + ts->we_eo, iwe);
- write_entry[ts->vo_es](p + ts->vo_eo, vo);
- } else {
+ /* Now stuff them into the table entry */
+ if (ts->sort) {
+ if (ts->it_xs) { /* Separate interp index and weight/offset*/
+ if (ts->wo_xs) { /* All 3 are separate */
+ write_entry[ts->ix_es](p + ts->ix_eo, imi);
+ write_entry[ts->we_es](p + ts->we_eo, iwe);
+ write_entry[ts->vo_es](p + ts->vo_eo, vo);
+ } else {
#ifdef ALLOW64
- unsigned longlong iwo;
+ unsigned longlong iwo;
#else
- unsigned long iwo;
+ unsigned long iwo;
#endif
-
- iwo = (iwe << ts->vo_ab) | vo; /* Combined weight+vertex offset */
- write_entry[ts->ix_es](p + ts->ix_eo, imi);
- write_entry[ts->wo_es](p + ts->wo_eo, iwo);
- }
- } else { /* All 3 are combined */
+
+ iwo = (iwe << ts->vo_ab) | vo; /* Combined weight+vertex offset */
+ write_entry[ts->ix_es](p + ts->ix_eo, imi);
+ write_entry[ts->wo_es](p + ts->wo_eo, iwo);
+ }
+ } else { /* All 3 are combined */
#ifdef ALLOW64
- unsigned longlong iit;
+ unsigned longlong iit;
#else
- unsigned long iit;
+ unsigned long iit;
#endif
- iit = (((imi << ts->we_ab) | iwe) << ts->vo_ab) | vo;
- write_entry[ts->it_ts](p, iit);
- }
- } else {
- if (ts->it_xs) { /* Separate interp index and weight/offset*/
- write_entry[ts->ix_es](p + ts->ix_eo, imi);
- write_entry[ts->sx_es](p + ts->sx_eo, isi);
- } else {
+ iit = (((imi << ts->we_ab) | iwe) << ts->vo_ab) | vo;
+ write_entry[ts->it_ts](p, iit);
+ }
+ } else {
+ if (ts->it_xs) { /* Separate interp index and weight/offset*/
+ write_entry[ts->ix_es](p + ts->ix_eo, imi);
+ write_entry[ts->sx_es](p + ts->sx_eo, isi);
+ } else {
#ifdef ALLOW64
- unsigned longlong iit;
+ unsigned longlong iit;
#else
- unsigned long iit;
+ unsigned long iit;
#endif
- iit = (imi << ts->sx_ab) | isi; /* Combine interp and simplex indexes */
- write_entry[ts->it_ts](p, iit);
- }
- }
- }
-
- /* Put table into place */
- it->in_tables[e] = (void *)t;
- }
- it->nintabs = e;
-
- /* Setup the interpolation table */
- {
- byte *t, *p; /* Pointer to interp table, pointer to total entry */
- PHILBERT(phc) /* Pseudo Hilbert counter */
- double vscale; /* Value scale for fixed point */
- int vsize; /* Fixed point storage size */
-
- if (ts->im_cd)
- vsize = (gs->prec * 2)/8; /* Fixed point entry & computation size */
- else
- vsize = gs->prec/8; /* Fixed point entry size */
- vscale = (1 << gs->prec) -1.0; /* Value scale for fixed point padding */
- /* -1.0 is to prevent carry after accumulation */
- /* Allocate the table */
- if ((t = (byte *)malloc(ibdinc[gs->id])) == NULL) {
+ iit = (imi << ts->sx_ab) | isi; /* Combine interp and simplex indexes */
+ write_entry[ts->it_ts](p, iit);
+ }
+ }
+ }
+
+ /* Put table into place */
+ it->in_tables[e] = (void *)t;
+ }
+ it->nintabs = e;
+
+ /* Setup the interpolation table */
+ {
+ byte *t, *p; /* Pointer to interp table, pointer to total entry */
+ PHILBERT(phc) /* Pseudo Hilbert counter */
+ double vscale; /* Value scale for fixed point */
+ int vsize; /* Fixed point storage size */
+
+ if (ts->im_cd)
+ vsize = (gs->prec * 2)/8; /* Fixed point entry & computation size */
+ else
+ vsize = gs->prec/8; /* Fixed point entry size */
+ vscale = (1 << gs->prec) -1.0; /* Value scale for fixed point padding */
+ /* -1.0 is to prevent carry after accumulation */
+ /* Allocate the table */
+ if ((t = (byte *)malloc(ibdinc[gs->id])) == NULL) {
#ifdef VERBOSE
- printf("malloc imdi interpolation table size %d failed\n",ibdinc[gs->id]);
+ printf("malloc imdi interpolation table size %d failed\n",ibdinc[gs->id]);
#endif
- return NULL; /* Should we signal error ? How ? */
- }
+ return NULL; /* Should we signal error ? How ? */
+ }
#ifdef VERBOSE
- printf("Allocated grid table = %d bytes\n",ibdinc[gs->id]);
+ printf("Allocated grid table = %d bytes\n",ibdinc[gs->id]);
#endif
- /* Get ready to access all the entries in the table */
- p = t;
- PH_INIT(phc, gs->id, gs->itres)
-
- /* Create all the interpolation table entry values */
- do {
- int ee, f;
- double riv[IXDI]; /* Real input values */
- double rev[IXDO]; /* Real entry values */
- unsigned long iev;
- byte *pp; /* Pointer to sub-entry */
-
- for (e = 0, p = t; e < gs->id; e++) {
- riv[e] = ((double)phc[e]) / (gs->itres - 1.0);
- p += phc[e] * ibdinc[e]; /* Compute pointer to entry value */
- }
-
- /* Lookup this verticies value */
- md_table(cntx, rev, riv);
-
- /* Create all the output values */
-
- /* I'm trying to avoid having to declare the actual entry sized */
- /* variables, since it is difficult dynamically. */
-
- /* For all the full entries */
- f = 0;
- pp = p;
- for (e = 0; e < ts->im_fn; e++, pp += ts->im_fs) {
- /* For all channels within full entry */
- for (ee = 0; ee < ts->im_fv; ee++, f++) {
- double revf = rev[f];
- if (revf < 0.0) /* Guard against sillies */
- revf = 0.0;
- else if (revf > 1.0)
- revf = 1.0;
- iev = (unsigned long)(revf * vscale + 0.5);
-
- if (bigend) {
- write_entry[vsize](pp + (ts->im_fs - (ee+1) * vsize), iev);
- } else {
- write_entry[vsize](pp + ee * vsize, iev);
- }
- }
- }
-
- /* For all the 0 or 1 partial entry */
- for (e = 0; e < ts->im_pn; e++) {
- /* For all channels within partial entry */
- for (ee = 0; ee < ts->im_pv; ee++, f++) {
- double revf = rev[f];
- if (revf < 0.0) /* Guard against sillies */
- revf = 0.0;
- else if (revf > 1.0)
- revf = 1.0;
- iev = (unsigned long)(revf * vscale + 0.5);
-
- if (bigend) {
- write_entry[vsize](pp + (ts->im_ps - (ee+1) * vsize), iev);
- } else {
- write_entry[vsize](pp + ee * vsize, iev);
- }
- }
- }
+ /* Get ready to access all the entries in the table */
+ p = t;
+ PH_INIT(phc, gs->id, gs->itres)
+
+ /* Create all the interpolation table entry values */
+ do {
+ int ee, f;
+ double riv[IXDI]; /* Real input values */
+ double rev[IXDO]; /* Real entry values */
+ unsigned long iev;
+ byte *pp; /* Pointer to sub-entry */
+
+ for (e = 0, p = t; e < gs->id; e++) {
+ riv[e] = ((double)phc[e]) / (gs->itres - 1.0);
+ p += phc[e] * ibdinc[e]; /* Compute pointer to entry value */
+ }
+
+ /* Lookup this verticies value */
+ md_table(cntx, rev, riv);
+
+ /* Create all the output values */
+
+ /* I'm trying to avoid having to declare the actual entry sized */
+ /* variables, since it is difficult dynamically. */
+
+ /* For all the full entries */
+ f = 0;
+ pp = p;
+ for (e = 0; e < ts->im_fn; e++, pp += ts->im_fs) {
+ /* For all channels within full entry */
+ for (ee = 0; ee < ts->im_fv; ee++, f++) {
+ double revf = rev[f];
+ if (revf < 0.0) /* Guard against sillies */
+ revf = 0.0;
+ else if (revf > 1.0)
+ revf = 1.0;
+ iev = (unsigned long)(revf * vscale + 0.5);
+
+ if (bigend) {
+ write_entry[vsize](pp + (ts->im_fs - (ee+1) * vsize), iev);
+ } else {
+ write_entry[vsize](pp + ee * vsize, iev);
+ }
+ }
+ }
+
+ /* For all the 0 or 1 partial entry */
+ for (e = 0; e < ts->im_pn; e++) {
+ /* For all channels within partial entry */
+ for (ee = 0; ee < ts->im_pv; ee++, f++) {
+ double revf = rev[f];
+ if (revf < 0.0) /* Guard against sillies */
+ revf = 0.0;
+ else if (revf > 1.0)
+ revf = 1.0;
+ iev = (unsigned long)(revf * vscale + 0.5);
+
+ if (bigend) {
+ write_entry[vsize](pp + (ts->im_ps - (ee+1) * vsize), iev);
+ } else {
+ write_entry[vsize](pp + ee * vsize, iev);
+ }
+ }
+ }
#ifdef ASSERTS
- if (f != gs->od)
- fprintf(stderr,"imdi_tab assert: f == gs->od\n");
+ if (f != gs->od)
+ fprintf(stderr,"imdi_tab assert: f == gs->od\n");
#endif
- PH_INC(phc)
- } while (!PH_LOOPED(phc));
-
- /* Put table into place */
- it->im_table = (void *)t;
- }
-
- /* Setup the simplex table */
- if (ts->sort) {
- it->sw_table = (void *)NULL;
-
- } else {
- byte *t, *p; /* Pointer to input table, pointer to total entry */
- int nsplx; /* Total number of simplexes */
- XCOMBO(vcmb, gs->id+1, 1 << gs->id);/* Simplex dimension id out of cube dimention id */
- int comb[24][IXDI]; /* Parameter[id]->Absolute[id] coordinate index */
- int ps[IXDI+1]; /* Base simplex parameter space counter */
- int pse; /* Base simplex parameter space counter index */
- int idioff; /* Interpolation table diagonal offset value */
-
- if (gs->id > 4) {
- fprintf(stderr,"imdi_tabl: internal failure - trying to create simplex table with di > 4!\n");
- exit(-1);
- }
-
- /* Allocate the table */
- if ((t = (byte *)malloc(sbdinc[gs->id])) == NULL) {
+ PH_INC(phc)
+ } while (!PH_LOOPED(phc));
+
+ /* Put table into place */
+ it->im_table = (void *)t;
+ }
+
+ /* Setup the simplex table */
+ if (ts->sort) {
+ it->sw_table = (void *)NULL;
+
+ } else {
+ byte *t, *p; /* Pointer to input table, pointer to total entry */
+ int nsplx; /* Total number of simplexes */
+ XCOMBO(vcmb, gs->id+1, 1 << gs->id);/* Simplex dimension id out of cube dimention id */
+ int comb[24][IXDI]; /* Parameter[id]->Absolute[id] coordinate index */
+ int ps[IXDI+1]; /* Base simplex parameter space counter */
+ int pse; /* Base simplex parameter space counter index */
+ int idioff; /* Interpolation table diagonal offset value */
+
+ if (gs->id > 4) {
+ fprintf(stderr,"imdi_tabl: internal failure - trying to create simplex table with di > 4!\n");
+ exit(-1);
+ }
+
+ /* Allocate the table */
+ if ((t = (byte *)malloc(sbdinc[gs->id])) == NULL) {
#ifdef VERBOSE
- printf("malloc imdi simplex table size %d failed\n",sbdinc[gs->id]);
+ printf("malloc imdi simplex table size %d failed\n",sbdinc[gs->id]);
#endif
- return NULL; /* Should we signal error ? How ? */
- }
+ return NULL; /* Should we signal error ? How ? */
+ }
#ifdef VERBOSE
- printf("Allocated simplex table = %d bytes\n",sbdinc[gs->id]);
+ printf("Allocated simplex table = %d bytes\n",sbdinc[gs->id]);
#endif
- /* Compute the interp table offset to the diagonal vertex */
- for (idioff = 0, e = 0; e < gs->id; e++)
- idioff += idinc[e]; /* Sum one offset in each dimension */
-
- /* Figure out how many simplexes fit into this dimension cube, */
- /* and how to map from the base simplex to each actual simplex. */
- XCB_INIT(vcmb);
- for (nsplx = 0; ;) {
- int i;
-
- /* XCOMB generates verticies in order from max to min offest */
-
- /* Compute Absolute -> Parameter mapping */
- for (e = 0; e < gs->id; e++) { /* For each absolute axis */
- for (i = 0; i < gs->id; i++) { /* For each verticy, order large to small */
- if ((vcmb[i] & (1<<e)) != 0 &&
- (vcmb[i+1] & (1<<e)) == 0) {/* Transition from offset 1 to 0 */
- comb[nsplx][i] = e;
- break;
- }
- }
- }
-
-/*
+ /* Compute the interp table offset to the diagonal vertex */
+ for (idioff = 0, e = 0; e < gs->id; e++)
+ idioff += idinc[e]; /* Sum one offset in each dimension */
+
+ /* Figure out how many simplexes fit into this dimension cube, */
+ /* and how to map from the base simplex to each actual simplex. */
+ XCB_INIT(vcmb);
+ for (nsplx = 0; ;) {
+ int i;
+
+ /* XCOMB generates verticies in order from max to min offest */
+
+ /* Compute Absolute -> Parameter mapping */
+ for (e = 0; e < gs->id; e++) { /* For each absolute axis */
+ for (i = 0; i < gs->id; i++) { /* For each verticy, order large to small */
+ if ((vcmb[i] & (1<<e)) != 0 &&
+ (vcmb[i+1] & (1<<e)) == 0) {/* Transition from offset 1 to 0 */
+ comb[nsplx][i] = e;
+ break;
+ }
+ }
+ }
+
+/*
printf("~~Verticies = ");
for (i = 0; i <= gs->id; i++)
- printf("%d ",vcmb[i]);
+ printf("%d ",vcmb[i]);
printf("\n");
printf("~~Parm -> Abs = ");
for (e = 0; e < gs->id; e++)
- printf("%d ",comb[nsplx][e]);
+ printf("%d ",comb[nsplx][e]);
printf("\n");
*/
- /* Increment the counter value */
- XCB_INC(vcmb);
- nsplx++;
- if (XCB_DONE(vcmb))
- break;
- }
-
- /* Now generate the contents of the base simplex, */
- /* and map it to all the symetrical simplexes */
-
- /* Init parameter space counter. */
- /* Note that ps[id-1] >= ps[id-2] >= ... >= ps[1] >= ps[0] */
- for (pse = 0; pse < gs->id; pse++)
- ps[pse] = 0;
- ps[pse] = gs->stres-1;
-
- /* Itterate through the simplex parameter space */
- for (pse = 0; pse < gs->id;) {
- double qps[IXDI]; /* Quantized parameter values */
- int we[IXDI+1]; /* Baricentric coords/vertex weighting */
- double wvscale = (1 << gs->prec); /* Weighting value scale */
- int sx; /* Simplex */
+ /* Increment the counter value */
+ XCB_INC(vcmb);
+ nsplx++;
+ if (XCB_DONE(vcmb))
+ break;
+ }
+
+ /* Now generate the contents of the base simplex, */
+ /* and map it to all the symetrical simplexes */
+
+ /* Init parameter space counter. */
+ /* Note that ps[id-1] >= ps[id-2] >= ... >= ps[1] >= ps[0] */
+ for (pse = 0; pse < gs->id; pse++)
+ ps[pse] = 0;
+ ps[pse] = gs->stres-1;
+
+ /* Itterate through the simplex parameter space */
+ for (pse = 0; pse < gs->id;) {
+ double qps[IXDI]; /* Quantized parameter values */
+ int we[IXDI+1]; /* Baricentric coords/vertex weighting */
+ double wvscale = (1 << gs->prec); /* Weighting value scale */
+ int sx; /* Simplex */
/*
printf("Param coord =");
for (e = gs->id-1; e >= 0; e--) {
- printf(" %d",ps[e]);
+ printf(" %d",ps[e]);
}
printf("\n");
*/
- for (e = 0; e < gs->id; e++) {
- /* (Should try wvscale + 0.49999999, or something ?) */
- double tt = (wvscale * (double)ps[e])/((double)gs->stres);
- qps[e] = (int)(tt + 0.5);
- }
-
- /* Convert quantized parameter values into weighting values */
- we[gs->id] = (1 << gs->prec) - qps[gs->id-1];
- for (e = gs->id-1; e > 0; e--)
- we[e] = qps[e] - qps[e-1];
- we[0] = qps[0];
+ for (e = 0; e < gs->id; e++) {
+ /* (Should try wvscale + 0.49999999, or something ?) */
+ double tt = (wvscale * (double)ps[e])/((double)gs->stres);
+ qps[e] = (int)(tt + 0.5);
+ }
+
+ /* Convert quantized parameter values into weighting values */
+ we[gs->id] = (1 << gs->prec) - qps[gs->id-1];
+ for (e = gs->id-1; e > 0; e--)
+ we[e] = qps[e] - qps[e-1];
+ we[0] = qps[0];
#ifdef ASSERTS
- {
- int sow = 0;
- for (e = gs->id; e >= 0; e--)
- sow += we[e];
-
- if (sow != (1 << gs->prec))
- fprintf(stderr,"imdi_tab assert: sum weights == (1 << gs->prec)\n");
- }
+ {
+ int sow = 0;
+ for (e = gs->id; e >= 0; e--)
+ sow += we[e];
+
+ if (sow != (1 << gs->prec))
+ fprintf(stderr,"imdi_tab assert: sum weights == (1 << gs->prec)\n");
+ }
#endif
/*
printf("Baricentric coord =");
for (e = gs->id; e >= 0; e--) {
- printf(" %d",we[e]);
+ printf(" %d",we[e]);
}
printf("\n");
*/
- /* For each simplex, compute the interp. and */
- /* and entry offsets, and write the entry. */
- for (sx = 0; sx < nsplx; sx++ ) {
- int v; /* Vertex index */
- byte *pp; /* Pointer to sub-entry */
- unsigned long vofb; /* Vertex offset, base */
- unsigned long vwe; /* Vertex weight */
-
- for (e = 0, p = t; e < gs->id; e++) {
- int ee = comb[sx][e]; /* Absolute coord index */
- p += ps[e] * sbdinc[ee]; /* Pointer to entry */
- }
-
- /* For each vertex entry */
- for (v = 0, pp = p; v <= gs->id; v++) {
- unsigned long vof;
- if (v == 0) {
- vofb = idioff; /* Start at diagonal offset */
- } else {
- vofb -= idinc[comb[sx][v-1]];/* Move to next vertex */
- }
- vwe = we[v]; /* Weight for this vertex */
-
- if (vwe == 0)
- vof = 0; /* Use zero offset if weight is zero */
- else
- vof = vofb * ts->vo_om; /* Strength reduce kernel scaling */
-
- /* Write vwe and vof to entry */
- if (ts->wo_xs) { /* Separate entries */
- write_entry[ts->we_es](pp + ts->we_eo, vwe);
- write_entry[ts->vo_es](pp + ts->vo_eo, vof);
- pp += ts->wo_es;
- } else { /* Combined entries */
+ /* For each simplex, compute the interp. and */
+ /* and entry offsets, and write the entry. */
+ for (sx = 0; sx < nsplx; sx++ ) {
+ int v; /* Vertex index */
+ byte *pp; /* Pointer to sub-entry */
+ unsigned long vofb; /* Vertex offset, base */
+ unsigned long vwe; /* Vertex weight */
+
+ for (e = 0, p = t; e < gs->id; e++) {
+ int ee = comb[sx][e]; /* Absolute coord index */
+ p += ps[e] * sbdinc[ee]; /* Pointer to entry */
+ }
+
+ /* For each vertex entry */
+ for (v = 0, pp = p; v <= gs->id; v++) {
+ unsigned long vof;
+ if (v == 0) {
+ vofb = idioff; /* Start at diagonal offset */
+ } else {
+ vofb -= idinc[comb[sx][v-1]];/* Move to next vertex */
+ }
+ vwe = we[v]; /* Weight for this vertex */
+
+ if (vwe == 0)
+ vof = 0; /* Use zero offset if weight is zero */
+ else
+ vof = vofb * ts->vo_om; /* Strength reduce kernel scaling */
+
+ /* Write vwe and vof to entry */
+ if (ts->wo_xs) { /* Separate entries */
+ write_entry[ts->we_es](pp + ts->we_eo, vwe);
+ write_entry[ts->vo_es](pp + ts->vo_eo, vof);
+ pp += ts->wo_es;
+ } else { /* Combined entries */
#ifdef ALLOW64
- unsigned longlong iwo;
+ unsigned longlong iwo;
#else
- unsigned long iwo;
+ unsigned long iwo;
#endif
- iwo = (vwe << ts->vo_ab) | vof; /* Combined weight+vertex offset */
- write_entry[ts->wo_es](pp + ts->wo_eo, iwo);
- pp += ts->wo_es;
- }
- }
+ iwo = (vwe << ts->vo_ab) | vof; /* Combined weight+vertex offset */
+ write_entry[ts->wo_es](pp + ts->wo_eo, iwo);
+ pp += ts->wo_es;
+ }
+ }
- /* Assert vofb == 0 */
+ /* Assert vofb == 0 */
#ifdef ASSERTS
- if (vofb != 0)
- fprintf(stderr,"imdi_tab assert: vofb == 0\n");
+ if (vofb != 0)
+ fprintf(stderr,"imdi_tab assert: vofb == 0\n");
#endif
- } /* Next simplex */
-
- /* Increment the parameter coords */
- for (pse = 0; pse < gs->id; pse++) {
- ps[pse]++;
- if (ps[pse] <= ps[pse+1])
- break; /* No carry */
- ps[pse] = 0;
- }
- }
-
- /* Put table into place */
- it->sw_table = (void *)t;
- }
-
- /* Last, setup the output tables */
- for (e = 0; e < gs->od; e++) {
- byte *t, *p; /* Pointer to output table, entry pointer */
- int ne; /* Number of entries */
- int iiv; /* Integer input value */
- double ivr = (double)((1 << gs->prec)-1); /* Input value range */
- double ovr = (double)((1 << ts->ot_bits[e])-1); /* Output value range */
- int osb = (1 << (ts->ot_bits[e]-1)); /* Output offset to signed displacement */
- int ooff = ts->ot_off[e]; /* Output value bit offset */
-
- ne = (1 << gs->prec); /* Output of clut is prec bits */
-
- /* Allocate the table */
- if ((t = (byte *)malloc(ts->ot_ts * ne)) == NULL) {
+ } /* Next simplex */
+
+ /* Increment the parameter coords */
+ for (pse = 0; pse < gs->id; pse++) {
+ ps[pse]++;
+ if (ps[pse] <= ps[pse+1])
+ break; /* No carry */
+ ps[pse] = 0;
+ }
+ }
+
+ /* Put table into place */
+ it->sw_table = (void *)t;
+ }
+
+ /* Last, setup the output tables */
+ for (e = 0; e < gs->od; e++) {
+ byte *t, *p; /* Pointer to output table, entry pointer */
+ int ne; /* Number of entries */
+ int iiv; /* Integer input value */
+ double ivr = (double)((1 << gs->prec)-1); /* Input value range */
+ double ovr = (double)((1 << ts->ot_bits[e])-1); /* Output value range */
+ int osb = (1 << (ts->ot_bits[e]-1)); /* Output offset to signed displacement */
+ int ooff = ts->ot_off[e]; /* Output value bit offset */
+
+ ne = (1 << gs->prec); /* Output of clut is prec bits */
+
+ /* Allocate the table */
+ if ((t = (byte *)malloc(ts->ot_ts * ne)) == NULL) {
#ifdef VERBOSE
- printf("malloc imdi output table size %d failed\n",ts->ot_ts * ne);
+ printf("malloc imdi output table size %d failed\n",ts->ot_ts * ne);
#endif
- return NULL; /* Should we signal error ? How ? */
- }
-
- /* For each possible output value, compute the entry value */
- for (iiv = 0, p = t; iiv < ne; iiv++, p += ts->ot_ts) {
- int ee;
- double riv; /* Real input value, 0.0 - 1.0 */
- double rtv; /* Real transformed value, 0.0 - 1.0 */
- unsigned long iov; /* Integer output value */
-
- riv = (double) iiv / ivr; /* Compute floating point */
- rtv = output_curve(cntx, e, riv); /* Lookup the output table transform */
- if (rtv < 0.0) /* Guard against sillies */
- rtv = 0.0;
- else if (rtv > 1.0)
- rtv = 1.0;
- iov = (unsigned long)(rtv * ovr + 0.5); /* output value */
- if (gs->out_signed & (1 << e)) /* Treat output as signed */
- iov = (iov >= osb) ? iov - osb : iov + osb; /* Convert to signed from offset */
- iov <<= ooff; /* Aligned for output */
-
- write_entry[ts->ot_ts](p, iov); /* Write entry */
- }
-
- /* Put table into place */
- it->out_tables[e] = (void *)t;
- }
- it->nouttabs = e;
+ return NULL; /* Should we signal error ? How ? */
+ }
+
+ /* For each possible output value, compute the entry value */
+ for (iiv = 0, p = t; iiv < ne; iiv++, p += ts->ot_ts) {
+ int ee;
+ double riv; /* Real input value, 0.0 - 1.0 */
+ double rtv; /* Real transformed value, 0.0 - 1.0 */
+ unsigned long iov; /* Integer output value */
+
+ riv = (double) iiv / ivr; /* Compute floating point */
+ rtv = output_curve(cntx, e, riv); /* Lookup the output table transform */
+ if (rtv < 0.0) /* Guard against sillies */
+ rtv = 0.0;
+ else if (rtv > 1.0)
+ rtv = 1.0;
+ iov = (unsigned long)(rtv * ovr + 0.5); /* output value */
+ if (gs->out_signed & (1 << e)) /* Treat output as signed */
+ iov = (iov >= osb) ? iov - osb : iov + osb; /* Convert to signed from offset */
+ iov <<= ooff; /* Aligned for output */
+
+ write_entry[ts->ot_ts](p, iov); /* Write entry */
+ }
+
+ /* Put table into place */
+ it->out_tables[e] = (void *)t;
+ }
+ it->nouttabs = e;
#ifdef VERBOSE
- printf("imdi_tabl returning OK\n");
+ printf("imdi_tabl returning OK\n");
#endif
- return it;
+ return it;
}
/* Free up the data allocated */
@@ -673,32 +671,17 @@ void
imdi_tab_free(
imdi_imp *it
) {
- int e;
+ int e;
- for (e = 0; e < it->nintabs; e++)
- free(it->in_tables[e]);
+ for (e = 0; e < it->nintabs; e++)
+ free(it->in_tables[e]);
- free(it->sw_table);
- free(it->im_table);
+ free(it->sw_table);
+ free(it->im_table);
- for (e = 0; e < it->nouttabs; e++)
- free(it->out_tables[e]);
+ for (e = 0; e < it->nouttabs; e++)
+ free(it->out_tables[e]);
- free(it);
+ free(it);
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gs/imdi/imdi_tab.h b/gs/imdi/imdi_tab.h
index 765f58dae..f5e531c61 100644
--- a/gs/imdi/imdi_tab.h
+++ b/gs/imdi/imdi_tab.h
@@ -14,66 +14,66 @@
typedef struct {
- int sort; /* NZ for explicit sort rather than simplex table lookup */
- int it_xs; /* NZ if separate interp index and simplex index/Weighting+Offset values */
- int wo_xs; /* NZ if separate weighting and vertex offset entries are to be used */
-
- int it_ix; /* Non-zero if input value extraction should be done in input table */
- int it_map[IXDI]; /* Mapping from input channels to table indexes needed */
- int it_ab; /* Input table entry size in bits */
- int it_ts; /* Input table :- total input table entry size in bytes */
- /* Bit packing order is (ms to ls) :
- sort: ix, we, vo
- sort: ix, wo
- !sort: ix, sx
- */
-
- /* Interpolation index is always in the input table */
- int ix_ab; /* Interpolation index entry size in bits */
- int ix_es; /* Interpolation index entry size in bytes */
- int ix_eo; /* Interpolation index entry offset in bytes */
-
- /* Simplex Index is always in the input table */
- int sx_ab; /* Simplex Index entry size in bits */
- int sx_es; /* Simplex Index entry size in bytes */
- int sx_eo; /* Simplex Index entry offset in bytes */
-
- int sm_ts; /* Simplex table entry total size in bytes */
- /* Bit packing order is (ms to ls) : we, vo */
-
- /* Combined Weighting + Offset may be in input table or Simplex entry */
- int wo_ab; /* Combined Weighting + Offset entry size in bits */
- int wo_es; /* Combined Weighting + Offset entry size in bytes */
- int wo_eo; /* Combined Weighting + Offset entry offset in bytes */
-
- /* Weighting may be in input table or Simplex entry */
- int we_ab; /* Weighting entry size in bits */
- int we_es; /* Weighting entry size in bytes */
- int we_eo; /* Weighting entry offset in bytes */
-
- /* Vertex offset may be in input table or Simplex entry */
- int vo_ab; /* Vertex Offset entry size in bits */
- int vo_es; /* Vertex Offset entry size in bytes */
- int vo_eo; /* Vertex Offset entry offset in bytes */
- int vo_om; /* Vertex Offset scaling multiplier */
-
- int im_cd; /* Non-zero if interpolation table entries are padded with fraction */
- int im_ts; /* Interp. multidim :- total interp table entry size in bytes */
- int im_oc; /* Interp. multidim :- offset scale to apply to index into interp entry */
- int im_fs; /* Interp. multidim :- full table entry size in bytes */
- int im_fn; /* Interp. multidim :- number of full entries */
- int im_fv; /* Interp. multidim :- output values per full entry . */
- int im_ps; /* Interp. multidim :- partial table entry size in bytes, used & unsused */
- int im_pn; /* Interp. multidim :- number of partial entries - must be 0 or 1 */
- int im_pv; /* Interp. multidim :- used output values per partial entry . */
- int im_map[IXDO]; /* Mapping from output table values to output positions needed */
-
- int ot_ts; /* Output table :- total entry size in bytes of every table */
- int ot_off[IXDO]; /* Offset for each output value within the output word needed */
- int ot_bits[IXDO]; /* Number of bits for value within the output word needed */
-
- /* Associated interpolation function */
- void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npix); /* At run time */
+ int sort; /* NZ for explicit sort rather than simplex table lookup */
+ int it_xs; /* NZ if separate interp index and simplex index/Weighting+Offset values */
+ int wo_xs; /* NZ if separate weighting and vertex offset entries are to be used */
+
+ int it_ix; /* Non-zero if input value extraction should be done in input table */
+ int it_map[IXDI]; /* Mapping from input channels to table indexes needed */
+ int it_ab; /* Input table entry size in bits */
+ int it_ts; /* Input table :- total input table entry size in bytes */
+ /* Bit packing order is (ms to ls) :
+ sort: ix, we, vo
+ sort: ix, wo
+ !sort: ix, sx
+ */
+
+ /* Interpolation index is always in the input table */
+ int ix_ab; /* Interpolation index entry size in bits */
+ int ix_es; /* Interpolation index entry size in bytes */
+ int ix_eo; /* Interpolation index entry offset in bytes */
+
+ /* Simplex Index is always in the input table */
+ int sx_ab; /* Simplex Index entry size in bits */
+ int sx_es; /* Simplex Index entry size in bytes */
+ int sx_eo; /* Simplex Index entry offset in bytes */
+
+ int sm_ts; /* Simplex table entry total size in bytes */
+ /* Bit packing order is (ms to ls) : we, vo */
+
+ /* Combined Weighting + Offset may be in input table or Simplex entry */
+ int wo_ab; /* Combined Weighting + Offset entry size in bits */
+ int wo_es; /* Combined Weighting + Offset entry size in bytes */
+ int wo_eo; /* Combined Weighting + Offset entry offset in bytes */
+
+ /* Weighting may be in input table or Simplex entry */
+ int we_ab; /* Weighting entry size in bits */
+ int we_es; /* Weighting entry size in bytes */
+ int we_eo; /* Weighting entry offset in bytes */
+
+ /* Vertex offset may be in input table or Simplex entry */
+ int vo_ab; /* Vertex Offset entry size in bits */
+ int vo_es; /* Vertex Offset entry size in bytes */
+ int vo_eo; /* Vertex Offset entry offset in bytes */
+ int vo_om; /* Vertex Offset scaling multiplier */
+
+ int im_cd; /* Non-zero if interpolation table entries are padded with fraction */
+ int im_ts; /* Interp. multidim :- total interp table entry size in bytes */
+ int im_oc; /* Interp. multidim :- offset scale to apply to index into interp entry */
+ int im_fs; /* Interp. multidim :- full table entry size in bytes */
+ int im_fn; /* Interp. multidim :- number of full entries */
+ int im_fv; /* Interp. multidim :- output values per full entry . */
+ int im_ps; /* Interp. multidim :- partial table entry size in bytes, used & unsused */
+ int im_pn; /* Interp. multidim :- number of partial entries - must be 0 or 1 */
+ int im_pv; /* Interp. multidim :- used output values per partial entry . */
+ int im_map[IXDO]; /* Mapping from output table values to output positions needed */
+
+ int ot_ts; /* Output table :- total entry size in bytes of every table */
+ int ot_off[IXDO]; /* Offset for each output value within the output word needed */
+ int ot_bits[IXDO]; /* Number of bits for value within the output word needed */
+
+ /* Associated interpolation function */
+ void (*interp)(struct _imdi *s, void **inp, void **outp, unsigned int npix); /* At run time */
} tabspec;
/*
@@ -84,14 +84,14 @@ typedef struct {
imdi_imp *
imdi_tab(
- genspec *gs, /* Pointer to gen spec */
- tabspec *ts, /* Pointer to tabl spec */
-
- /* Callbacks to lookup the mdi table values */
- double (*input_curve) (void *cntx, int ch, double in_val),
- void (*md_table) (void *cntx, double *out_vals, double *in_vals),
- double (*output_curve)(void *cntx, int ch, double in_val),
- void *cntx /* Context to callbacks */
+ genspec *gs, /* Pointer to gen spec */
+ tabspec *ts, /* Pointer to tabl spec */
+
+ /* Callbacks to lookup the mdi table values */
+ double (*input_curve) (void *cntx, int ch, double in_val),
+ void (*md_table) (void *cntx, double *out_vals, double *in_vals),
+ double (*output_curve)(void *cntx, int ch, double in_val),
+ void *cntx /* Context to callbacks */
);
void imdi_tab_free(imdi_imp *it);
diff --git a/gs/lib/EndOfTask.ps b/gs/lib/EndOfTask.ps
index 45a8ca02b..ce9a8a9d5 100644
--- a/gs/lib/EndOfTask.ps
+++ b/gs/lib/EndOfTask.ps
@@ -1 +1 @@
- \ No newline at end of file
+
diff --git a/gs/lib/PDFA_def.ps b/gs/lib/PDFA_def.ps
index 39aa8d2fd..7fe787137 100644
--- a/gs/lib/PDFA_def.ps
+++ b/gs/lib/PDFA_def.ps
@@ -6,17 +6,15 @@
% This assumes an ICC profile to reside in the file (ISO Coated sb.icc),
% unless the user modifies the corresponding line below.
-
systemdict /ProcessColorModel known {
systemdict /ProcessColorModel get dup /DeviceGray ne exch /DeviceCMYK ne and
} {
true
-} ifelse
+} ifelse
{ (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)=
/ProcessColorModel cvx /rangecheck signalerror
} if
-
% Define entries to the document Info dictionary :
/ICCProfile (ISO Coated sb.icc) % Customize.
diff --git a/gs/lib/PDFX_def.ps b/gs/lib/PDFX_def.ps
index b645386f2..60c6d15ae 100644
--- a/gs/lib/PDFX_def.ps
+++ b/gs/lib/PDFX_def.ps
@@ -6,17 +6,15 @@
% This assumes an ICC profile to reside in the file (ISO Coated sb.icc),
% unless the user modifies the corresponding line below.
-
systemdict /ProcessColorModel known {
systemdict /ProcessColorModel get dup /DeviceGray ne exch /DeviceCMYK ne and
} {
true
-} ifelse
+} ifelse
{ (ERROR: ProcessColorModel must be /DeviceGray or DeviceCMYK.)=
/ProcessColorModel cvx /rangecheck signalerror
} if
-
% Define entries to the document Info dictionary :
/ICCProfile (ISO Coated sb.icc) def % Customize or remove.
diff --git a/gs/lib/acctest.ps b/gs/lib/acctest.ps
index 908a9807f..6c8adf795 100644
--- a/gs/lib/acctest.ps
+++ b/gs/lib/acctest.ps
@@ -17,7 +17,7 @@ def
0 0 moveto % So the show commands don't bomb because of nocurrentpoint.
-{ [1 2] executeonly aload } dotest
+{ [1 2] executeonly aload } dotest
{ (string) executeonly (seek) anchorsearch } dotest
{ (string) (seek) executeonly anchorsearch } dotest
{ 100 101 (string) noaccess ashow} dotest
@@ -36,7 +36,7 @@ def
{ 1 10 1 string readonly cvrs } dotest
{ true 5 string readonly cvs } dotest
{ 1 dict readonly begin /foo true def } dotest
-{ 10 array readonly dictstack } dotest
+{ 10 array readonly dictstack } dotest
{ 1 string executeonly 1 string eq } dotest
{ 1 string 1 string executeonly eq } dotest
{ 10 array readonly execstack } dotest
@@ -67,7 +67,7 @@ def
{ 1 dict noaccess maxlength } dotest
{ 1 string executeonly 1 string ne } dotest
{ 1 string 1 string executeonly ne } dotest
-%{ newpath 0 0 moveto (a) false charpath
+%{ newpath 0 0 moveto (a) false charpath
% {} {} {} {} pathforall closepath } dotest
{ 1 array executeonly 0 put } dotest
{ 1 dict noaccess /key put } dotest
diff --git a/gs/lib/addxchar.ps b/gs/lib/addxchar.ps
index 43f62a907..2895bd739 100644
--- a/gs/lib/addxchar.ps
+++ b/gs/lib/addxchar.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -26,7 +26,7 @@
addce_dict begin
% Define the added copyright notice.
-/addednotice (. Portions Copyright (C) 1999 Aladdin Enterprises.) def
+/addednotice (. Portions Copyright (C) 1999 Aladdin Enterprises.) def
% Open a font for modification by removing the FID and changing the
% FontName. Removing UniqueID and XUID is not necessary, since we
@@ -46,7 +46,7 @@ addce_dict begin
% Do the equivalent of charpath + pathbbox for a glyph.
/glyphbbox { % <glyph> glyphbbox <llx> <lly> <urx> <ury>
- % We cache this value, because it's expensive to compute.
+ % We cache this value, because it's expensive to compute.
BBoxes 1 index .knownget {
exch pop
} {
@@ -57,7 +57,7 @@ addce_dict begin
% Get the side bearing and width for a glyph.
/glyphsbw { % <glyph> glyphsbw <lsbx> <wx>
- % We cache this value, because it's expensive to compute.
+ % We cache this value, because it's expensive to compute.
SBW 1 index .knownget {
exch pop
} {
@@ -77,9 +77,9 @@ addce_dict begin
% Find an occurrence of a value in an array.
/asearch { % <array> <value> asearch <index> true
- % <array> <value> asearch false
+ % <array> <value> asearch false
false 0 4 2 roll exch {
- % Stack: false index value element
+ % Stack: false index value element
2 copy eq { pop pop exch not exch dup exit } if
exch 1 add exch
} forall pop pop
@@ -103,7 +103,7 @@ addce_dict begin
% Defines accent, base, abox, bbox.
% The initial dx lines up the origins of the base and the accent.
/beginseac { % <bchar> <achar> beginseac
- % -mark- <lsbx> <wx> /hsbw <asb> <dx>
+ % -mark- <lsbx> <wx> /hsbw <asb> <dx>
/accent exch def /base exch def
/abox [accent glyphbbox] def
/bbox [base glyphbbox] def
@@ -212,14 +212,14 @@ addce_dict begin
0
} ifelse def
- % Invert the Encoding (needed for seac).
+ % Invert the Encoding (needed for seac).
/charindex 256 dict def
0 1 255 {
charindex exch Encoding 1 index get exch put
} for
- % Add the commaaccent character, by moving the comma downward.
+ % Add the commaaccent character, by moving the comma downward.
/comma glyphbbox /commatop exch def pop pop pop
/comma glyphcs
@@ -227,24 +227,24 @@ addce_dict begin
[ exch { caedit 1 index .knownget { exec } if } forall ]
/commaaccent exch csdef
- % Add the accented characters that can be made with seac.
+ % Add the accented characters that can be made with seac.
seacchars {
splitaccented beginseac
centeraccent
- % If the accent would collide with the base character,
- % raise it a little.
+ % If the accent would collide with the base character,
+ % raise it a little.
abox 1 get bbox 3 get sub dup 0 le {
- % ... but not if the accent is in the low position.
- abox 1 get 0 gt {
- neg 60 add
- % Adjust the X position if italic.
- dup italfactor mul 3 -1 roll add exch
- } {
- pop 0
- } ifelse
+ % ... but not if the accent is in the low position.
+ abox 1 get 0 gt {
+ neg 60 add
+ % Adjust the X position if italic.
+ dup italfactor mul 3 -1 roll add exch
+ } {
+ pop 0
+ } ifelse
} {
- pop 0
+ pop 0
} ifelse
finishseac
} forall
@@ -269,9 +269,9 @@ addce_dict begin
seaccaronchars {
dup =string cvs 0 1 getinterval cvn /quoteright beginseac
- % Move the quote to the right of the character.
+ % Move the quote to the right of the character.
bbox 2 get abox 0 get sub 50 add add
- % Adjust the character width as well.
+ % Adjust the character width as well.
4 -1 roll abox 2 get abox 0 get sub 50 add add cvi 4 1 roll
0 finishseac
} forall
@@ -280,26 +280,26 @@ addce_dict begin
dup =string cvs 0 1 getinterval cvn /comma beginseac
centeraccent
commatop neg
- % Lower the accent if the character extends below
- % the baseline
+ % Lower the accent if the character extends below
+ % the baseline
bbox 1 get 0 .min add
finishseac
} forall
- % Add the characters from the Symbol font.
- % We should scale them to match the FontBBox, but we don't.
+ % Add the characters from the Symbol font.
+ % We should scale them to match the FontBBox, but we don't.
symbolchars {
symbolfont /CharStrings get 1 index get
CharStrings 3 1 roll put
} forall
- % Add the one remaining character.
+ % Add the one remaining character.
CharStrings /Dcroat CharStrings /Eth get put
- % Recompute the FontBBox, since some of the accented characters
- % may have enlarged it.
+ % Recompute the FontBBox, since some of the accented characters
+ % may have enlarged it.
/llx 1000 def /lly 1000 def /urx 0 def /ury 0 def
CharStrings {
@@ -309,7 +309,7 @@ addce_dict begin
} forall
/FontBBox llx cvi lly cvi urx ceiling cvi ury ceiling cvi 4 packedarray def
- % Restore the Encoding and wrap up.
+ % Restore the Encoding and wrap up.
[/Copyright /Notice] {
FontInfo 1 index .knownget {
diff --git a/gs/lib/align.ps b/gs/lib/align.ps
index c1920ba42..eb67a3e45 100644
--- a/gs/lib/align.ps
+++ b/gs/lib/align.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/bdftops.ps b/gs/lib/bdftops.ps
index 7e746c081..e10e2f01f 100644
--- a/gs/lib/bdftops.ps
+++ b/gs/lib/bdftops.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990, 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -134,7 +134,7 @@ envBDF begin
]
{ dup =string cvs
[ exch dup 0 1 getinterval cvn
- exch dup length 1 sub 1 exch getinterval cvn
+ exch dup length 1 sub 1 exch getinterval cvn
]
} forall
/cent [/c /slash]
@@ -163,8 +163,8 @@ envBDF begin
% (If commentword is equal to a space, never skip.)
/nextline
{ { bdfile buffer readline not
- { (Premature EOF\n) print stop } if
- dup length 0 ne { exit } if pop
+ { (Premature EOF\n) print stop } if
+ dup length 0 ne { exit } if pop
}
loop
( ) search
@@ -240,24 +240,24 @@ envBDF begin
{ mark exch lenIV
{ % stack: mark ... string dropcount
dup 2 index length exch sub getinterval
- dup 0 get dup 32 lt { pop exit } if
- dup 246 le
- { 139 sub exch 1 }
- { dup 250 le
- { 247 sub 8 bitshift 108 add 1 index 1 get add exch 2 }
- { dup 254 le
- { 251 sub 8 bitshift 108 add 1 index 1 get add neg exch 2 }
- { pop dup 1 get 128 xor 128 sub
- 8 bitshift 1 index 2 get add
- 8 bitshift 1 index 3 get add
- 8 bitshift 1 index 4 get add exch 5
- } ifelse
- } ifelse
- } ifelse
+ dup 0 get dup 32 lt { pop exit } if
+ dup 246 le
+ { 139 sub exch 1 }
+ { dup 250 le
+ { 247 sub 8 bitshift 108 add 1 index 1 get add exch 2 }
+ { dup 254 le
+ { 251 sub 8 bitshift 108 add 1 index 1 get add neg exch 2 }
+ { pop dup 1 get 128 xor 128 sub
+ 8 bitshift 1 index 2 get add
+ 8 bitshift 1 index 3 get add
+ 8 bitshift 1 index 4 get add exch 5
+ } ifelse
+ } ifelse
+ } ifelse
} loop
counttomark 3 eq { 0 3 1 roll 0 exch } if
6 -1 roll pop
- } bind def
+ } bind def
% Find the side bearing and width information that begins a CharString.
% Arguments: charstring. Result: charstring sizethroughsbw.
@@ -276,17 +276,17 @@ envBDF begin
{ 139 add 1 string dup 0 3 index put }
{ dup dup -1131 ge exch 1131 le and
{ dup 0 ge { 16#f694 } { neg 16#fa94 } ifelse add
- 2 string dup 0 3 index -8 bitshift put
- dup 1 3 index 255 and put
- }
- { 5 string dup 0 255 put exch
- 2 copy 1 exch -24 bitshift 255 and put
- 2 copy 2 exch -16 bitshift 255 and put
- 2 copy 3 exch -8 bitshift 255 and put
- 2 copy 4 exch 255 and put
- exch
- }
- ifelse
+ 2 string dup 0 3 index -8 bitshift put
+ dup 1 3 index 255 and put
+ }
+ { 5 string dup 0 255 put exch
+ 2 copy 1 exch -24 bitshift 255 and put
+ 2 copy 2 exch -16 bitshift 255 and put
+ 2 copy 3 exch -8 bitshift 255 and put
+ 2 copy 4 exch 255 and put
+ exch
+ }
+ ifelse
}
ifelse exch pop concatstrings
} bind def
@@ -302,11 +302,11 @@ envBDF begin
% ------ The main program ------ %
/readBDF % <infilename> <outfilename> <fontname>
- % <encodingname> <uniqueID> <xuid> readBDF -> <font>
+ % <encodingname> <uniqueID> <xuid> readBDF -> <font>
{ /xuid exch def % may be null
/uniqueID exch def % may be -1
/encodingname exch def
- /encoding encodingname cvx exec def
+ /encoding encodingname cvx exec def
/fontname exch def
/psname exch def
/bdfname exch def
@@ -360,7 +360,7 @@ envBDF begin
% Put out a header compatible with the Adobe "standard".
(%!FontType1-1.0: ) ws fontname wt (000.000) wl
(% This is a font description converted from ) ws
- bdfname wl
+ bdfname wl
(% by bdftops running on ) ws
statusdict /product get ws ( revision ) ws
revision =string cvs ws (.) wl
@@ -368,10 +368,10 @@ envBDF begin
% Copy the initial comments, up to FONT.
true
{ nextline
- keyword (COMMENT) ne {exit} if
- { (% Here are the initial comments from the BDF file:\n%) wl
- } if false
- (%) ws remarg wl
+ keyword (COMMENT) ne {exit} if
+ { (% Here are the initial comments from the BDF file:\n%) wl
+ } if false
+ (%) ws remarg wl
} loop pop
() wl
/commentword (COMMENT) def % do skip comments from now on
@@ -383,7 +383,7 @@ envBDF begin
% The FONTBOUNDINGBOX may not be reliable, so we discard it too.
(FONT) checkline
(SIZE) getline
- /pointsize iarg def /xres iarg def /yres iarg def
+ /pointsize iarg def /xres iarg def /yres iarg def
(FONTBOUNDINGBOX) getline
nextline
@@ -397,12 +397,12 @@ envBDF begin
keyword (STARTPROPERTIES) eq
{ iarg
{ nextline
- properties keyword known
- { FontInfo properties keyword get sarg readonly put
- } if
- } repeat
+ properties keyword known
+ { FontInfo properties keyword get sarg readonly put
+ } if
+ } repeat
(ENDPROPERTIES) getline
- nextline
+ nextline
} if
% Compute and set the FontMatrix.
@@ -412,14 +412,14 @@ envBDF begin
% Read and process the header for the bitmaps.
(CHARS) checkline
- /ccount iarg def
+ /ccount iarg def
% Initialize the CharStrings dictionary.
/charstrings ccount
- composites length add
- aliases length add
- accentedchars length add
- 1 add dict def % 1 add for .notdef
+ composites length add
+ aliases length add
+ accentedchars length add
+ 1 add dict def % 1 add for .notdef
/isfixedwidth true def
/fixedwidth null def
/subrcount 0 def
@@ -432,56 +432,56 @@ envBDF begin
ccount -1 1
{ (STARTCHAR) getline
/charname remarg def
- (ENCODING) getline
- /eindex iarg def
- eindex dup 0 ge exch 255 le and
- { charname /charname StandardEncoding eindex get def
- charname /.notdef eq eindex 0 gt and
- { /charname (A) eindex =string cvs concatstrings cvn def
- }
- if
- (/) print charname =string cvs print (,) print print
- }
- { (/) print charname print
- }
- ifelse
- 10 mod 1 eq { (\n) print flush } if
- (SWIDTH) getline
- /swx iarg pointsize mul 1000 div xres mul 72 div def
- /swy iarg pointsize mul 1000 div xres mul 72 div def
- (DWIDTH) getline % Ignore, use SWIDTH instead
- (BBX) getline
- /bbw iarg def /bbh iarg def /bbox iarg def /bboy iarg def
- nextline
- keyword (ATTRIBUTES) eq
- { nextline
- } if
- (BITMAP) checkline
+ (ENCODING) getline
+ /eindex iarg def
+ eindex dup 0 ge exch 255 le and
+ { charname /charname StandardEncoding eindex get def
+ charname /.notdef eq eindex 0 gt and
+ { /charname (A) eindex =string cvs concatstrings cvn def
+ }
+ if
+ (/) print charname =string cvs print (,) print print
+ }
+ { (/) print charname print
+ }
+ ifelse
+ 10 mod 1 eq { (\n) print flush } if
+ (SWIDTH) getline
+ /swx iarg pointsize mul 1000 div xres mul 72 div def
+ /swy iarg pointsize mul 1000 div xres mul 72 div def
+ (DWIDTH) getline % Ignore, use SWIDTH instead
+ (BBX) getline
+ /bbw iarg def /bbh iarg def /bbox iarg def /bboy iarg def
+ nextline
+ keyword (ATTRIBUTES) eq
+ { nextline
+ } if
+ (BITMAP) checkline
% Update the font bounding box.
- /fbbxo fbbxo bbox .min def
- /fbbyo fbbyo bboy .min def
- /fbbxe fbbxe bbox bbw add .max def
- /fbbye fbbye bboy bbh add .max def
+ /fbbxo fbbxo bbox .min def
+ /fbbyo fbbyo bboy .min def
+ /fbbxe fbbxe bbox bbw add .max def
+ /fbbye fbbye bboy bbh add .max def
% Read the bits for this character.
- /raster bbw 7 add 8 idiv def
- /cbits raster bbh mul string def
- cbits length 0 gt
- { 0 raster cbits length raster sub
- { cbits exch raster getinterval
- bdfile buffer readline not
- { (EOF in bitmap\n) print stop } if
- % stack has <cbits.interval> <buffer.interval>
- 0 () /SubFileDecode filter
- exch 2 copy readhexstring pop pop pop closefile
- } for
- } if
+ /raster bbw 7 add 8 idiv def
+ /cbits raster bbh mul string def
+ cbits length 0 gt
+ { 0 raster cbits length raster sub
+ { cbits exch raster getinterval
+ bdfile buffer readline not
+ { (EOF in bitmap\n) print stop } if
+ % stack has <cbits.interval> <buffer.interval>
+ 0 () /SubFileDecode filter
+ exch 2 copy readhexstring pop pop pop closefile
+ } for
+ } if
(ENDCHAR) getline
% Save the character data.
- chardata charname [swx swy bbw bbh bbox bboy cbits] put
+ chardata charname [swx swy bbw bbh bbox bboy cbits] put
} for
(ENDFONT) getline
@@ -497,52 +497,52 @@ envBDF begin
% Process the characters.
chardata
{ exch /charname exch def aload pop
- /cbits exch def
- /bboy exch def /bbox exch def
- /bbh exch def /bbw exch def
- /swy exch def /swx exch def
+ /cbits exch def
+ /bboy exch def /bbox exch def
+ /bbh exch def /bbw exch def
+ /swy exch def /swx exch def
% The bitmap handed to type1imagepath must have the correct height,
% because type1imagepath uses this to compute the scale factor,
% so we have to clear the unused parts of it.
- /raster bbw 7 add 8 idiv def
- bits dup 0 1 raster fbbh mul 1 sub
- { 0 put dup } for
- pop pop
- bits raster fbbh bbh sub mul cbits putinterval
+ /raster bbw 7 add 8 idiv def
+ bits dup 0 1 raster fbbh mul 1 sub
+ { 0 put dup } for
+ pop pop
+ bits raster fbbh bbh sub mul cbits putinterval
% Compute the font entry, converting the bitmap to an outline.
- bits 0 raster fbbh mul getinterval % the bitmap image
- bbw fbbh % bitmap width & height
- swx swy % width x & y
- bbox neg bboy neg % origin x & y
- % Account for lenIV when converting the outline.
- outline lenIV outline length lenIV sub getinterval
+ bits 0 raster fbbh mul getinterval % the bitmap image
+ bbw fbbh % bitmap width & height
+ swx swy % width x & y
+ bbox neg bboy neg % origin x & y
+ % Account for lenIV when converting the outline.
+ outline lenIV outline length lenIV sub getinterval
type1imagepath
length lenIV add
- outline exch 0 exch getinterval
+ outline exch 0 exch getinterval
% Check for a fixed width font.
- isfixedwidth
- { fixedwidth null eq
- { /fixedwidth swx def }
- { fixedwidth swx ne { /isfixedwidth false def } if }
- ifelse
- } if
+ isfixedwidth
+ { fixedwidth null eq
+ { /fixedwidth swx def }
+ { fixedwidth swx ne { /isfixedwidth false def } if }
+ ifelse
+ } if
% Finish up the character.
- copystring
- charname exch charstrings 3 1 roll put
+ copystring
+ charname exch charstrings 3 1 roll put
} forall
% Add CharStrings entries for aliases.
aliases
{ charstrings 2 index known not charstrings 2 index known and
{ charstrings exch get charstrings 3 1 roll put
- }
- { pop pop
- }
- ifelse
+ }
+ { pop pop
+ }
+ ifelse
}
forall
@@ -550,27 +550,27 @@ envBDF begin
% out of available ones.
isfixedwidth not
{ false composites
- { 1 index charstrings exch known not
- 1 index { decoding exch known and } forall
- { ( /) print 1 index bits cvs print
- /combine exch def
- 0 1 combine length 1 sub
- { dup combine exch get decoding exch get
- bits 3 1 roll put
- } for
- bits 0 combine length getinterval copystring
- [ exch /compose_proc load aload pop ] cvx
- charstrings 3 1 roll put
- pop true
- }
- { pop pop }
- ifelse
- }
- forall flush
- { Private /composematrix matrix put
- Private /compose /compose load put
- }
- if
+ { 1 index charstrings exch known not
+ 1 index { decoding exch known and } forall
+ { ( /) print 1 index bits cvs print
+ /combine exch def
+ 0 1 combine length 1 sub
+ { dup combine exch get decoding exch get
+ bits 3 1 roll put
+ } for
+ bits 0 combine length getinterval copystring
+ [ exch /compose_proc load aload pop ] cvx
+ charstrings 3 1 roll put
+ pop true
+ }
+ { pop pop }
+ ifelse
+ }
+ forall flush
+ { Private /composematrix matrix put
+ Private /compose /compose load put
+ }
+ if
}
if
@@ -578,25 +578,25 @@ envBDF begin
accentedchars
{ aload pop /accent exch def /base exch def
buffer cvs /accented exch def
- charstrings accented known not
- charstrings base known and
- charstrings accent known and
- StandardDecoding base known and
- StandardDecoding accent known and
- encoding StandardDecoding base get get base eq and
- encoding StandardDecoding accent get get accent eq and
- { ( /) print accented print
- charstrings base get findsbw 0 exch getinterval
- /acstring exch def % start with sbw of base
- charstrings accent get parsesbw
- 4 { pop } repeat % just leave sbx
- acstring exch concatnum
- 0 concatnum 0 concatnum % adx ady
- decoding base get concatnum % bchar
- decoding accent get concatnum % achar
- s_seac concatstrings
- charstrings exch accented copystring exch put
- } if
+ charstrings accented known not
+ charstrings base known and
+ charstrings accent known and
+ StandardDecoding base known and
+ StandardDecoding accent known and
+ encoding StandardDecoding base get get base eq and
+ encoding StandardDecoding accent get get accent eq and
+ { ( /) print accented print
+ charstrings base get findsbw 0 exch getinterval
+ /acstring exch def % start with sbw of base
+ charstrings accent get parsesbw
+ 4 { pop } repeat % just leave sbx
+ acstring exch concatnum
+ 0 concatnum 0 concatnum % adx ady
+ decoding base get concatnum % bchar
+ decoding accent get concatnum % achar
+ s_seac concatstrings
+ charstrings exch accented copystring exch put
+ } if
} forall
% Make a CharStrings entry for .notdef.
@@ -606,29 +606,29 @@ envBDF begin
% Encrypt the CharStrings and Subrs (in place).
charstrings
{ % Be careful not to encrypt aliased characters twice,
- % since they share their CharString.
- aliases 2 index known
- { charstrings aliases 3 index get .knownget
- { 1 index ne }
- { true }
- ifelse
- }
- { true
- }
- ifelse
- 1 index type /stringtype eq and
+ % since they share their CharString.
+ aliases 2 index known
+ { charstrings aliases 3 index get .knownget
+ { 1 index ne }
+ { true }
+ ifelse
+ }
+ { true
+ }
+ ifelse
+ 1 index type /stringtype eq and
{ 4330 exch dup .type1encrypt exch pop
- readonly charstrings 3 1 roll put
- }
- { pop pop
- }
- ifelse
+ readonly charstrings 3 1 roll put
+ }
+ { pop pop
+ }
+ ifelse
}
forall
0 1 subrcount 1 sub
{ dup subrs exch get
- 4330 exch dup .type1encrypt exch pop
- subrs 3 1 roll put
+ 4330 exch dup .type1encrypt exch pop
+ subrs 3 1 roll put
}
for
@@ -640,9 +640,9 @@ envBDF begin
/fontscale 1000 fbbh div yres mul xres div def
Font /FontBBox
[ fbbxo fontscale mul
- fbbyo fontscale mul
- fbbxe fontscale mul
- fbbye fontscale mul
+ fbbyo fontscale mul
+ fbbxe fontscale mul
+ fbbye fontscale mul
] cvx readonly put
Font /CharStrings charstrings readonly put
FontInfo /FullName known not
@@ -665,10 +665,10 @@ envBDF begin
0 9999 0 5 85
{ dup rotate
newpath 0 0 moveto (I) false charpath
- dup neg rotate
+ dup neg rotate
pathbbox pop exch pop exch sub
- dup 3 index lt { 4 -2 roll } if
- pop pop
+ dup 3 index lt { 4 -2 roll } if
+ pop pop
}
for pop
% The underline position is halfway between the bottom of the 'A'
@@ -718,31 +718,31 @@ envBDF begin
/metrics 0 dict def
{ nextline
keyword (EndFontMetrics) eq { exit } if
- keyword (StartCharMetrics) eq
- { iarg dup dict /metrics exch def
- { /c -1 def /n null def /w null def
- nextline buffer
- { token not { exit } if
- dup cmdict exch known
- { exch /args exch def cmdict exch get exec args }
- { pop }
- ifelse
- } loop
- c 0 ge n null ne or w null ne and
- { n null eq { /n Font /Encoding get c get def } if
- metrics n w put
- }
- if
- }
- repeat
- (EndCharMetrics) getline
- } if
+ keyword (StartCharMetrics) eq
+ { iarg dup dict /metrics exch def
+ { /c -1 def /n null def /w null def
+ nextline buffer
+ { token not { exit } if
+ dup cmdict exch known
+ { exch /args exch def cmdict exch get exec args }
+ { pop }
+ ifelse
+ } loop
+ c 0 ge n null ne or w null ne and
+ { n null eq { /n Font /Encoding get c get def } if
+ metrics n w put
+ }
+ if
+ }
+ repeat
+ (EndCharMetrics) getline
+ } if
} loop
% Insert the metrics in the font.
metrics length 0 ne
- { Font /Metrics metrics readonly put
- } if
+ { Font /Metrics metrics readonly put
+ } if
Font
} bind def
@@ -750,7 +750,7 @@ end % envBDF
% Enter the main program in the current dictionary.
/bdfafmtops % infilename afmfilename* outfilename fontname
- % encodingname uniqueID xuid
+ % encodingname uniqueID xuid
{ envBDF begin
7 -2 roll exch 7 2 roll % afm* in out fontname encodingname uniqueID xuid
readBDF % afm* font
@@ -775,8 +775,8 @@ end % envBDF
exch (.) search % next-to-last arg has . in it?
{ mark 4 1 roll % have xuid
{ cvi exch pop exch (.) search not { exit } if }
- loop cvi ]
- 3 -1 roll cvi exch
+ loop cvi ]
+ 3 -1 roll cvi exch
}
{ cvi null % no xuid
}
diff --git a/gs/lib/caption.ps b/gs/lib/caption.ps
index 144dd28d3..6f08ab7b3 100644
--- a/gs/lib/caption.ps
+++ b/gs/lib/caption.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -31,13 +31,13 @@ gsave
initgraphics
clippath pathbbox
pop exch 36 add /by exch def
- % We can't use stringwidth, so we have to show and measure.
+ % We can't use stringwidth, so we have to show and measure.
gsave
0 0 0 0 rectclip
0 0 moveto caption currentpoint pop /bw exch def
grestore
add bw sub 2 div /bx exch def
- % We don't have the font bbox available, so we guess.
+ % We don't have the font bbox available, so we guess.
/bh captionsize 1.05 mul def
grestore
/showcaption
diff --git a/gs/lib/cat.ps b/gs/lib/cat.ps
index 7192949f5..bed048f00 100644
--- a/gs/lib/cat.ps
+++ b/gs/lib/cat.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996-2003 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -15,7 +15,7 @@
%
% $Id: cat.ps 8331 2008-02-05 11:07:00Z kens $
%
-% Appends one file to another. Primarily used to overcome the
+% Appends one file to another. Primarily used to overcome the
% 'copy' limitation of Windows command shell for ps2epsi
%
% the files to be appended are given by the environament
@@ -26,49 +26,49 @@
/datastring 1024 string def
{
- (outfile) getenv
- {
- /outfilename exch def
- (infile) getenv
- {
- /infilename exch def
-
- infilename status
- {
- pop pop pop pop outfilename status
- {
- pop pop pop pop
- infilename (r) file /infile exch def
- outfilename (a+) file /outfile exch def
- {
- infile datastring readstring
- {
- outfile exch writestring
- }
- {
- dup length 0 gt
- {outfile exch writestring} {pop} ifelse
- exit
- } ifelse
- } loop
- infile closefile
- outfile closefile
- }
- {
- (Failed to find file ) print outfilename ==
- } ifelse
- }
- {
- (Failed to find file ) print infilename ==
- } ifelse
- }
- {
- (Couldn't find %infile% environment variable) ==
- } ifelse
- }
- {
- (Couldn't find %outfile% environment variable) ==
- }
- ifelse
-} bind
+ (outfile) getenv
+ {
+ /outfilename exch def
+ (infile) getenv
+ {
+ /infilename exch def
+
+ infilename status
+ {
+ pop pop pop pop outfilename status
+ {
+ pop pop pop pop
+ infilename (r) file /infile exch def
+ outfilename (a+) file /outfile exch def
+ {
+ infile datastring readstring
+ {
+ outfile exch writestring
+ }
+ {
+ dup length 0 gt
+ {outfile exch writestring} {pop} ifelse
+ exit
+ } ifelse
+ } loop
+ infile closefile
+ outfile closefile
+ }
+ {
+ (Failed to find file ) print outfilename ==
+ } ifelse
+ }
+ {
+ (Failed to find file ) print infilename ==
+ } ifelse
+ }
+ {
+ (Couldn't find %infile% environment variable) ==
+ } ifelse
+ }
+ {
+ (Couldn't find %outfile% environment variable) ==
+ }
+ ifelse
+} bind
exec
diff --git a/gs/lib/cid2code.ps b/gs/lib/cid2code.ps
index 6e609553f..7d26ccf55 100644
--- a/gs/lib/cid2code.ps
+++ b/gs/lib/cid2code.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1998, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,33 +30,33 @@
mark
} def
/endcmap {
- % Stack: mark code_lo1 code_hi1 cid1 ...
+ % Stack: mark code_lo1 code_hi1 cid1 ...
20 dict begin
/depth counttomark 3 sub def
- % Do a first pass to determine the maximum CID.
+ % Do a first pass to determine the maximum CID.
0 0 3 depth {
1 add /d exch def
d index d 2 add index 1 get add d 3 add index 1 get sub .max
} for
1 add /ncid exch def
/map ncid 2 mul string def
- % Now fill in the map.
+ % Now fill in the map.
0 3 depth {
/d exch def
d index 2 mul /cid2 exch def
d 1 add index /hi exch def
d 2 add index 2 string copy /lo exch def
lo 1 get 1 hi 1 get {
- map cid2 lo 0 get put
- map cid2 1 add 3 -1 roll put
- /cid2 cid2 2 add def
+ map cid2 lo 0 get put
+ map cid2 1 add 3 -1 roll put
+ /cid2 cid2 2 add def
} for
} for
- % Print the map.
+ % Print the map.
(%stdout) (w) file
dup (<) print
dup /ASCIIHexEncode filter
- dup map writestring
+ dup map writestring
closefile
() = flush
closefile
@@ -105,18 +105,18 @@ currentdict end readonly def
(r) file /f exch def
(%!) =
(/CIDInit /ProcSet findresource begin 12 dict begin begincmap) =
- % Print the information from the template.
+ % Print the information from the template.
{
exch ==only ( ) print
dup type /dicttype eq {
dup length =only ( dict dup begin) = {
- ( ) print exch ===only ( ) print ===only ( def) =
+ ( ) print exch ===only ( ) print ===only ( def) =
} forall (end def) =
} {
===only
} ifelse ( def) =
} forall
- % Read the data from the cid2code.txt file.
+ % Read the data from the cid2code.txt file.
{
f =string readline pop (CID\t) anchorsearch { pop pop exit } if pop
} loop
@@ -129,7 +129,7 @@ currentdict end readonly def
dup (*) eq { pop (0000) } if
(16#) exch concatstrings cvi
} loop ] def
- % Print the code space range(s).
+ % Print the code space range(s).
/maxcid map length 1 sub def
mark maxcid
dup 255 and 255 eq {
@@ -140,7 +140,7 @@ currentdict end readonly def
counttomark 2 idiv dup =only ( begincodespacerange) = {
exch .printhex2 .printhex2 () =
} repeat (endcodespacerange) =
- % Print the map data.
+ % Print the map data.
0 1 100 maxcid {
/lo exch def
/hi lo 99 add maxcid .min def
@@ -149,11 +149,11 @@ currentdict end readonly def
pop
} {
=only ( begincidchar) = lo 1 hi {
- map 1 index get dup 0 eq { pop pop } { exch .printhex2 = } ifelse
+ map 1 index get dup 0 eq { pop pop } { exch .printhex2 = } ifelse
} for (endcidchar) =
} ifelse
} for
- % Wrap up.
+ % Wrap up.
(endcmap CMapName currentdict /CMap defineresource pop end end) =
f closefile
end
diff --git a/gs/lib/docie.ps b/gs/lib/docie.ps
index d842e8fa6..1b5dc7d58 100644
--- a/gs/lib/docie.ps
+++ b/gs/lib/docie.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -49,19 +49,19 @@
} bind def
/mmult3 % <u> <v> <w> [<uu> <uv> ... <wv> <ww>] mmult3
- % <u'> <v'> <w'>
+ % <u'> <v'> <w'>
{ 4 -1 roll dup dup 6 -1 roll dup dup 8 -1 roll dup dup
10 -1 roll { 10 -1 roll mul } forall
- % Stack: u1 v1 w1 u2 v2 w2 u3 v3 w3
+ % Stack: u1 v1 w1 u2 v2 w2 u3 v3 w3
4 -1 roll add 6 -1 roll add
- % Stack: u1 v1 u2 v2 u3 v3 w'
+ % Stack: u1 v1 u2 v2 u3 v3 w'
7 1 roll 3 -1 roll add 4 -1 roll add
- % Stack: w' u1 u2 u3 v'
+ % Stack: w' u1 u2 u3 v'
5 1 roll add add 3 1 roll
} bind def
/minvert3 % [<uu> <uv> ... <wv> <ww>] minvert3
- % [<uu'> <uv'> ... <wv'> <ww'>]
+ % [<uu'> <uv'> ... <wv'> <ww'>]
{ 16 dict begin
aload pop { I H G F E D C B A } { exch def } forall
/coa E I mul F H mul sub def
@@ -126,20 +126,20 @@ DOCIEDEBUG { (After MatrixABC Decode: ) print3 } if
% ---------------- Rendering from XYZ ---------------- %
/lookup3 % <rtable> <a[0..1]> <b[0..1]> <c[0..1]> lookup3
- % <rtable> <bytes>
+ % <rtable> <bytes>
{ 3 -1 roll 3 index 0 get 1 sub mul
3 -1 roll 3 index 1 get 1 sub mul
3 -1 roll 3 index 2 get 1 sub mul
- % Stack: rtable ia ib ic
+ % Stack: rtable ia ib ic
DOCIEDEBUG { (RenderTable indices: ) print3 mark 5 1 roll } if
3 -1 roll round cvi 3 index 3 get exch get
- % Stack: rtable ib ic string
+ % Stack: rtable ib ic string
3 -1 roll round cvi 3 index 2 get mul
- % Stack: rtable ic string ib*nc
+ % Stack: rtable ic string ib*nc
3 -1 roll round cvi add 2 index 4 get mul
- % Stack: rtable string index
+ % Stack: rtable string index
2 index 4 get getinterval
- % Stack: rtable bytes
+ % Stack: rtable bytes
DOCIEDEBUG { (RenderTable values: ) print (<) print (%stdout) (w) file 1 index writehexstring (>) = } if
} bind def
@@ -156,11 +156,11 @@ DOCIEDEBUG { (After MatrixPQR: ) print3 } if
6 index /BlackPoint .knownget not { bpdefault } if
4
{ 4 -1 roll aload pop
- % Stack: csdict crdict x y z pt pt pt px py pz
+ % Stack: csdict crdict x y z pt pt pt px py pz
3 copy 12 index /MatrixPQR .knownget { mmult3 } if 6 array astore
}
repeat
- % Stack: csdict crdict x y z wps+ bps+ wpd+ bpd+
+ % Stack: csdict crdict x y z wps+ bps+ wpd+ bpd+
9 -1 roll pop % get rid of csdict
7 4 roll
7 index /TransformPQR get
@@ -188,14 +188,14 @@ DOCIEDEBUG { (After EncodeABC Encode: ) print3 } if
{ % Stack: u v w ranges rtable
5 1 roll rescale3
DOCIEDEBUG { (Rescaled ABC: ) print3 } if
- % Stack: rtable a b c
+ % Stack: rtable a b c
lookup3
- % Stack: rtable bytes
+ % Stack: rtable bytes
0 1 3 index 4 get 1 sub
{ % Stack: values rtable bytes c
- 2 copy get 255 div
- % Stack: values rtable bytes c v
- 3 index 3 -1 roll 5 add get exec 3 1 roll
+ 2 copy get 255 div
+ % Stack: values rtable bytes c v
+ 3 index 3 -1 roll 5 add get exec 3 1 roll
}
for pop pop
DOCIEDEBUG { (After RenderTableT: ) print ] dup == aload pop } if
@@ -215,6 +215,6 @@ DOCIEDEBUG { (After RangeABC Encode: ) print3 } if
/DeviceRGB { pop /DefaultRGB /ColorSpace findresource 1 get 4 1 roll cscieabc currentcolorrendering 4 1 roll crmap } bind
.dicttomark def
/mapcie % <a> mapcie <v1> ...
- % <a> <b> <c> mapcie <v1> ...
+ % <a> <b> <c> mapcie <v1> ...
{ currentcolorspace dup 0 get //mapdict exch get exec
} bind def
diff --git a/gs/lib/dumphint.ps b/gs/lib/dumphint.ps
index 801c18f71..444692a0c 100644
--- a/gs/lib/dumphint.ps
+++ b/gs/lib/dumphint.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000, 2001 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -29,7 +29,7 @@
% All array entries start from the new byte boundary.
%
-/table_width 79 def
+/table_width 79 def
/col1_width 66 def
% Skip bits to the next byte boundary
@@ -49,13 +49,13 @@
/bitread { % <bstream> <width> bitwrite <value>
exch begin
0 % bit val
- {
+ {
1 index N .min % bit val m
- dup 3 1 roll % bit m val m
+ dup 3 1 roll % bit m val m
bitshift % bit m val<<m
B 2 index N sub % bit m val<<m B m-N
bitshift add % bit m val<<m+B>>(N-m)
- 3 -1 roll % m val' bit
+ 3 -1 roll % m val' bit
2 index sub % m val' bit'
3 -1 roll % val' bit' m
N exch sub dup % val' bit' N' N'
@@ -97,7 +97,7 @@
getinterval % (s) (v)
} {
dup % (s) (s)
- } ifelse
+ } ifelse
(\n) search {
4 1 roll % (pre) (s) (post) (match)
pop pop % (pre) (s)
@@ -121,9 +121,9 @@
exch print % () n len
exch =string cvs % () len (n)
dup length % () len (n) len2
- 3 -1 roll add % () (n) len+len2
+ 3 -1 roll add % () (n) len+len2
//table_width % () (n) len+len2 78
- exch sub % () (n) 78-len+len2
+ exch sub % () (n) 78-len+len2
( ) multiprint % () (n)
= % ()
{ dup length 0 eq { exit } if
@@ -196,7 +196,7 @@
% Analyze the page offset hint table.
/dump_page_offset_table { % - dump_page_offset_table -
hint_stream
-
+
dup 32 bitread
dup /hint_minnop exch def
(1. The least number of objects in a page.) two_column
@@ -219,7 +219,7 @@
dup 32 bitread
dup /hint_minsco exch def
- (6. Least start of Contents offset. )
+ (6. Least start of Contents offset. )
1 index 0 ne { (\n*** Acrobat expects 0 ***) concatstrings } if
two_column
@@ -251,7 +251,7 @@
dup /hint_denf exch def
(13. Denominator of fraction.) two_column
- pop
+ pop
LinearizationParams /N get
@@ -353,9 +353,9 @@
} bind def
% Analyze tha shared object hint table
-/dump_shared_object_table {
+/dump_shared_object_table {
hint_stream
-
+
dup 32 bitread
dup /shint_1st_obj_id exch def
(1. Object number of the first object in the shared objects section) two_column
@@ -399,7 +399,7 @@
(2. MD5 signature flag) array_header
hint_stream bytealign
/shint_md5_flags
- [ shint_all_shared
+ [ shint_all_shared
{ hint_stream 1 bitread
} repeat
] readonly def
@@ -407,7 +407,7 @@
shint_md5_flags dump_array
(3. MD5 signature string) array_header
- false shint_md5_flags { 0 ne or } forall {
+ false shint_md5_flags { 0 ne or } forall {
shint_md5_flags {
0 eq {
(<>)=
@@ -419,7 +419,7 @@
} { pop (Error reading nd5 string.) ==
} ifelse
} ifelse
- } forall
+ } forall
} {
() = (none) =
} ifelse
@@ -526,8 +526,8 @@
} bind def
% Analyze the generic hint table.
-% The hint field names are re-used.
-/dump_generic_table {
+% The hint field names are re-used.
+/dump_generic_table {
hint_stream
dup 32 bitread
@@ -578,7 +578,7 @@
dup /ihint_shared_obj_bits exch def
(6. Bits for the max shared object id used by the interactive form or the logical structure hierarchy.)
1 index hint_sobits ne {
- (\n*** This fiels is not equal to max shared object ID bits ***) concatstrings
+ (\n*** This fiels is not equal to max shared object ID bits ***) concatstrings
} if
pop
@@ -612,7 +612,7 @@
(T, Thumbnail hint table) table_header
hint_stream exch set_align
dump_thumbnail_table
- } if
+ } if
dup /O .knownget {
(O, Outline hint table) table_header
@@ -621,7 +621,7 @@
} if
dup /A .knownget {
- (A, Thread information hint table) table_header
+ (A, Thread information hint table) table_header
hint_stream exch set_align
dump_generic_table
} if
@@ -659,11 +659,10 @@
pop
} bind def
-
% Load PDF file and extract the hint stream.
/pdf_dump_hints { % <infile> pdf_dump_hints -
dup (r) file % fname
- false exch % fname F file
+ false exch % fname F file
{
dup 7 string readstring pop % fname F file ()
(%PDF-1.) ne { pop exit } if % fname F file
@@ -696,10 +695,10 @@
LinearizationParams /H get
dup length 2 eq {
0 get PDFoffset add PDFfile exch setfileposition
- PDFfile token pop
+ PDFfile token pop
PDFfile token pop
resolveR dup true resolvestream
- /ReusableStreamDecode filter
+ /ReusableStreamDecode filter
bitstream dup bytealign
/hint_stream exch def
@@ -730,7 +729,7 @@
exch pop
save exch
3000000 setvmthreshold
- pdfoptdict begin
+ pdfoptdict begin
pdf_dump_hints
end
restore
diff --git a/gs/lib/font2c.ps b/gs/lib/font2c.ps
index 07c888bac..9624f4147 100644
--- a/gs/lib/font2c.ps
+++ b/gs/lib/font2c.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1993, 1994, 1995, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -53,9 +53,9 @@
{ pop a_all }
{ % Check for executeonly or noaccess objects in protected.
dup protected exch known
- { protected exch get }
- { pop a_readonly }
- ifelse
+ { protected exch get }
+ { pop a_readonly }
+ ifelse
}
ifelse
} bind def
@@ -65,10 +65,10 @@
{ a_noaccess exch
{ exch pop
dup type dup /stringtype eq 1 index /arraytype eq or
- exch /packedarraytype eq or
- { getpa a_readonly and or }
- { pop pop a_all exit }
- ifelse
+ exch /packedarraytype eq or
+ { getpa a_readonly and or }
+ { pop pop a_all exit }
+ ifelse
}
forall
} bind def
@@ -147,12 +147,12 @@ end
/wca % <string> <prefix> <suffix> wca -
{ 0 4 -2 roll exch
{ % Stack: suffix n prefix char
- exch ws
- exch dup 19 ge { () wl pop 0 } if 1 add
- exch dup 32 ge 1 index 126 le and
- { 39 wb dup 39 eq 1 index 92 eq or { 92 wb } if wb 39 wb }
- { wt }
- ifelse (,)
+ exch ws
+ exch dup 19 ge { () wl pop 0 } if 1 add
+ exch dup 32 ge 1 index 126 le and
+ { 39 wb dup 39 eq 1 index 92 eq or { 92 wb } if wb 39 wb }
+ { wt }
+ ifelse (,)
} forall
pop pop ws
} bind def
@@ -180,12 +180,12 @@ end
% Convert an object to a string to be scanned at a later time.
/cvos % <obj> cvos <string>
{ % We'd like to use == and write directly to a string,
- % but we can't do the former because of operators,
- % and we can't do the latter because we can't predict
- % how long the string would have to be....
- wtempname (w) file dup 3 -1 roll wproc closefile
- wtempname status pop pop pop exch pop string
- wtempname (r) file dup 3 -1 roll readstring pop exch closefile
+ % but we can't do the former because of operators,
+ % and we can't do the latter because we can't predict
+ % how long the string would have to be....
+ wtempname (w) file dup 3 -1 roll wproc closefile
+ wtempname status pop pop pop exch pop string
+ wtempname (r) file dup 3 -1 roll readstring pop exch closefile
} bind def
% Write a string/name or null as an element of a string/name/null array.
@@ -195,10 +195,10 @@ end
{ pop (\t255,255,) wl
}
{ dup type /nametype eq { wnstring cvs } if
- dup type /stringtype ne { cvos (255,) ws } if
- dup length 256 idiv wt (,) ws
- dup length 256 mod wt
- (,) (,\n) wca
+ dup type /stringtype ne { cvos (255,) ws } if
+ dup length 256 idiv wt (,) ws
+ dup length 256 mod wt
+ (,) (,\n) wca
}
ifelse
} bind def
@@ -268,11 +268,11 @@ end def
/arraytype
{ woatt
{ aload pop 2 index 2 index exec
- { exch pop exec exit }
- { pop pop }
- ifelse
- }
- forall
+ { exch pop exec exit }
+ { pop pop }
+ ifelse
+ }
+ forall
} bind def
/booleantype
{ { (\tmake_true\(&) } { (\tmake_false\(&) } ifelse ws
@@ -285,12 +285,12 @@ end def
/nametype
{ (\tcode = (*pprocs->name_create)\(i_ctx_p, &) ws exch wt
(, ) ws wnstring cvs wcs % OK, names are short
- (\);) wl
- (\tif ( code < 0 ) return code;) wl
- true
+ (\);) wl
+ (\tif ( code < 0 ) return code;) wl
+ true
} bind def
/packedarraytype
- /arraytype load def
+ /arraytype load def
/realtype
{ (\tmake_real\(&) ws exch wt (, (float)) ws
wt (\);) wl true
@@ -298,10 +298,10 @@ end def
/stringtype
{ ({\tstatic const unsigned char s_[] = ) ws
dup dup can_wcs { wcs } { wcca } ifelse
- (;) wl
- (\tmake_const_string\(&) ws exch wt
- (, a_readonly, ) ws length wt (, (const byte *)s_\);) wl
- (}) wl true
+ (;) wl
+ (\tmake_const_string\(&) ws exch wt
+ (, a_readonly, ) ws length wt (, (const byte *)s_\);) wl
+ (}) wl true
} bind def
end def
% Write some other kind of object, if known.
@@ -325,70 +325,70 @@ end def
} bind def
/wnuma { % <name> <array> <element_C_type> <<type>_v> wnuma -
({\tstatic const ref_\() ws exch ws (\) a_[] = {) wl exch
- % Stack: name type_v array
+ % Stack: name type_v array
dup length 0 eq {
- (\t) ws 1 index ws (\(0\)) wl
+ (\t) ws 1 index ws (\(0\)) wl
} {
- dup {
- (\t) ws 2 index ws (\() ws wt (\),) wl
- } forall
+ dup {
+ (\t) ws 2 index ws (\() ws wt (\),) wl
+ } forall
} ifelse exch pop
- % Stack: name array
+ % Stack: name array
(\t};) wl
dup wcheck {
- (\tcode = (*pprocs->scalar_array_create)\(i_ctx_p, &) ws exch wt
- (, (const ref *)a_, ) ws dup length wt
- (, ) ws wpa (\);) wl
- (\tif ( code < 0 ) return code;) wl
+ (\tcode = (*pprocs->scalar_array_create)\(i_ctx_p, &) ws exch wt
+ (, (const ref *)a_, ) ws dup length wt
+ (, ) ws wpa (\);) wl
+ (\tif ( code < 0 ) return code;) wl
} {
- (\tmake_const_array\(&) ws exch wt
- (, avm_foreign|) ws dup wpa (, ) ws length wt
- (, (const ref *)a_\);) wl
+ (\tmake_const_array\(&) ws exch wt
+ (, avm_foreign|) ws dup wpa (, ) ws length wt
+ (, (const ref *)a_\);) wl
} ifelse
(}) wl
} bind def
/woatt [
- % Integers
+ % Integers
{ { { type /integertype eq } isall }
{ (long) (integer_v) wnuma true }
}
- % Integers + reals
+ % Integers + reals
{ { { type dup /integertype eq exch /realtype eq or } isall }
{ (float) (real_v) wnuma true }
}
- % Strings + nulls
+ % Strings + nulls
{ { { type dup /nulltype eq exch /stringtype eq or } isall }
{ ({) ws dup (sa_) exch wsna
- (\tcode = (*pprocs->string_array_create)\(i_ctx_p, &) ws exch wt
- (, \(const char *\)sa_, ) ws dup length wt (, ) ws wpa (\);) wl
- (\tif ( code < 0 ) return code;) wl
- (}) wl true
+ (\tcode = (*pprocs->string_array_create)\(i_ctx_p, &) ws exch wt
+ (, \(const char *\)sa_, ) ws dup length wt (, ) ws wpa (\);) wl
+ (\tif ( code < 0 ) return code;) wl
+ (}) wl true
}
}
- % Names
+ % Names
{ { { type /nametype eq } isall }
{ ({) ws dup (na_) exch wsna
- (\tcode = (*pprocs->name_array_create)\(i_ctx_p, &) ws 1 index wt
- (, \(const char *\)na_, ) ws dup length wt (\);) wl
- (\tif ( code < 0 ) return code;) wl
- wap (}) wl true
+ (\tcode = (*pprocs->name_array_create)\(i_ctx_p, &) ws 1 index wt
+ (, \(const char *\)na_, ) ws dup length wt (\);) wl
+ (\tif ( code < 0 ) return code;) wl
+ wap (}) wl true
}
}
- % Procedure
+ % Procedure
{ { iswproc }
{ dup cvos
- % Stack: name proc string
- ({\tstatic const unsigned char s_[] = ) ws
+ % Stack: name proc string
+ ({\tstatic const unsigned char s_[] = ) ws
dup dup can_wcs { wcs } { wcca } ifelse
- (;) wl
- (\tcode = (*pprocs->ref_from_string)\(i_ctx_p, &) ws 2 index wt
- (, \(const char *\)s_, ) ws length wt (\);) wl
- (\tif ( code < 0 ) return code;) wl
- wap (}) wl true
- wtempname deletefile
+ (;) wl
+ (\tcode = (*pprocs->ref_from_string)\(i_ctx_p, &) ws 2 index wt
+ (, \(const char *\)s_, ) ws length wt (\);) wl
+ (\tif ( code < 0 ) return code;) wl
+ wap (}) wl true
+ wtempname deletefile
}
}
- % Default
+ % Default
{ { pop true }
{ wother }
}
@@ -403,10 +403,10 @@ end def
{ counttomark 2 sub wtstring cvs
(v_[) exch concatstrings (]) concatstrings exch wo not
{ (Skipping ) print ==only (....\n) print }
- if
+ if
} forall
]
- % Stack: array of keys (names)
+ % Stack: array of keys (names)
({) ws dup (str_keys_) exch wsna
(\tstatic const cfont_dict_keys keys_ =) wl
(\t { 0, 0, ) ws length wt (, ) ws 3 -1 roll wt (, ) ws
@@ -424,13 +424,13 @@ end def
% Writes code to declare and initialize enc_keys_, str_keys, and keys_.
/wcdkeys % <dict> wcdkeys -
{ % Write keys present in StandardEncoding or ISOLatin1Encoding,
- % pushing other keys on the o-stack.
+ % pushing other keys on the o-stack.
(static const charindex enc_keys_[] = {) wl
dup [ exch 0 exch
{ pop decoding 1 index known
{ decoding exch get ({) ws dup -8 bitshift wt
- (,) ws 255 and wt (}, ) ws
- 1 add dup 5 mod 0 eq { (\n) ws } if
+ (,) ws 255 and wt (}, ) ws
+ 1 add dup 5 mod 0 eq { (\n) ws } if
}
{ exch }
ifelse
@@ -438,9 +438,9 @@ end def
forall pop
]
({0,0}\n};) wl
- % Write other keys.
+ % Write other keys.
(str_keys_) exch wsna
- % Write the declaration for keys_.
+ % Write the declaration for keys_.
(static const cfont_dict_keys keys_ = {) wl
(\tenc_keys_, countof\(enc_keys_\) - 1,) wl
(\t) ws dup length wt ( - \(countof\(enc_keys_\) - 1\), 0, ) ws
@@ -499,9 +499,9 @@ end def
(\t0\n};) wl
(static const unsigned char lengths_[] = {) wl
{ (\t) ws dup isnumber
- { pop 0 }
- { length 1 add }
- ifelse wt (,) wl
+ { pop 0 }
+ { length 1 add }
+ ifelse wt (,) wl
} cdforall
(\t0\n};) wl
(\tcode = \(*pprocs->num_dict_create\)\(i_ctx_p, &) ws wt
@@ -639,7 +639,7 @@ readonly def
{ % Stack: string index
2 copy 2 copy get //makefontprocnamemap exch get put pop
}
- for
+ for
} def
/writefont { font2cdict begin writefont end } def
@@ -649,11 +649,11 @@ readonly def
{ counttomark dup 2 eq exch 3 eq or
{ counttomark -1 roll cvn
(Converting ) print dup =only ( font.\n) print flush
- % Ensure that we get a clean copy of the font from the
- % file system.
+ % Ensure that we get a clean copy of the font from the
+ % file system.
2 { % do both local and global
- currentglobal not setglobal
- dup undefinefont
+ currentglobal not setglobal
+ dup undefinefont
} repeat
findfont setfont
(FontName is ) print currentfont /FontName get ==only (.\n) print flush
diff --git a/gs/lib/font2pcl.ps b/gs/lib/font2pcl.ps
index 63e9e1d33..3cf04771a 100644
--- a/gs/lib/font2pcl.ps
+++ b/gs/lib/font2pcl.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993, 1994, 1995, 1997 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -23,10 +23,10 @@
% The current transformation matrix defines the font size and orientation.
/WriteResolution? false def % true=use "resolution bound font" format,
- % false=use older format
+ % false=use older format
/LJ4 false def % true=use LJ4 Typeface code
- % false=use LJIIP/IID/IIIx Typeface code
+ % false=use LJIIP/IID/IIIx Typeface code
pcldict begin % internal procedures
@@ -34,8 +34,8 @@ pcldict begin % internal procedures
{ search { pop pop pop true } { pop false } ifelse
} def
- % Determine which set of keywords is present in a string.
- % The last keyword set must be empty.
+ % Determine which set of keywords is present in a string.
+ % The last keyword set must be empty.
/keysearch % <string> <array of arrays of keywords> keysearch <index>
{ 0 1 2 index length 1 sub
@@ -52,7 +52,7 @@ pcldict begin % internal procedures
exch pop length % invalid index if missing
} def
- % Determine the device height of a string in quarter-dots.
+ % Determine the device height of a string in quarter-dots.
/charheight % <string> charheight <int>
{ gsave newpath 0 0 moveto false charpath
@@ -60,7 +60,7 @@ pcldict begin % internal procedures
dtransform add abs 4 mul cvi
} def
- % Compute an integer version of the transformed FontBBox.
+ % Compute an integer version of the transformed FontBBox.
/inflate % <num> inflate <num>
{ dup 0 gt { ceiling } { floor } ifelse
@@ -71,12 +71,12 @@ pcldict begin % internal procedures
4 2 roll transform exch inflate cvi exch inflate cvi
} def
- % Determine the original font of a possibly transformed font.
- % Since some badly behaved PostScript files construct transformed
- % fonts "by hand", we can't just rely on the OrigFont pointers.
- % Instead, if a font with the given name exists, and if its
- % entries for FontType and UniqueID match those of the font we
- % obtain by following the OrigFont chain, we use that font.
+ % Determine the original font of a possibly transformed font.
+ % Since some badly behaved PostScript files construct transformed
+ % fonts "by hand", we can't just rely on the OrigFont pointers.
+ % Instead, if a font with the given name exists, and if its
+ % entries for FontType and UniqueID match those of the font we
+ % obtain by following the OrigFont chain, we use that font.
/origfont
{ { dup /OrigFont known not { exit } if /OrigFont get } loop
@@ -84,21 +84,20 @@ pcldict begin % internal procedures
{ % Stack: origfont namedfont
1 index /FontType get 1 index /FontType get eq
{ 1 index /UniqueID .knownget
- { 1 index /UniqueID .knownget
- { eq { exch } if }
- { pop }
+ { 1 index /UniqueID .knownget
+ { eq { exch } if }
+ { pop }
ifelse
- }
- if
+ }
+ if
}
if pop
}
if
} def
-
- % Determine the bounding box of the current device's image.
- % Free variables: row, zerow.
+ % Determine the bounding box of the current device's image.
+ % Free variables: row, zerow.
/devbbox % <rw> <rh> devbbox <ymin> <ymax1> <xmin> <xmax1>
{ % Find top and bottom whitespace.
@@ -116,21 +115,21 @@ pcldict begin % internal procedures
}
loop % ymin
exch
- % Find left and right whitespace.
+ % Find left and right whitespace.
3 index 0
- % Stack: rw rh ymin ymax1 xmin xmax1
+ % Stack: rw rh ymin ymax1 xmin xmax1
3 index 1 4 index 1 sub
{ currentdevice exch row copyscanlines .findzeros
exch 4 1 roll .max 3 1 roll .min exch
}
for % xmin xmax1
- % Special check: xmin > xmax1 if height = 0
+ % Special check: xmin > xmax1 if height = 0
2 copy gt { exch pop dup } if
6 -2 roll pop pop
} def
- % Write values on outfile.
+ % Write values on outfile.
/w1 { 255 and outfile exch write } def
/w2 { dup -8 bitshift w1 w1 } def
@@ -211,7 +210,6 @@ pcldict begin % internal procedures
currentdict readonly end pop % pcldict
-
% Convert and write a PCL font for the current font and transformation.
% Write the font header. We split this off only to avoid overflowing
@@ -240,7 +238,7 @@ currentdict readonly end pop % pcldict
orientation (Orientation) wbyte
FontInfo /isFixedPitch .knownget not { false } if
{ 0 } { 1 } ifelse (Spacing) wbyte
- % Use loop/exit to fake a multiple-exit block.
+ % Use loop/exit to fake a multiple-exit block.
{ Encoding StandardEncoding eq { 10 (J) exit } if
Encoding ISOLatin1Encoding eq { 11 (J) exit } if
Encoding SymbolEncoding eq { 19 (M) exit } if
@@ -264,7 +262,7 @@ currentdict readonly end pop % pcldict
dup vendor.initials exch get 0 eq
{ % No vendor in FullName, try Notice
pop Copyright vendor.keys keysearch
- dup vendor.initials exch get 0 eq { pop vendor.default.index } if
+ dup vendor.initials exch get 0 eq { pop vendor.default.index } if
}
if
/vendor.index exch def
@@ -326,7 +324,7 @@ currentdict readonly end pop % pcldict
/outfile exch def
matrix currentmatrix dup 4 0 put dup 5 0 put setmatrix
- % Supply some default values so we don't have to check later.
+ % Supply some default values so we don't have to check later.
currentfont /FontInfo known not { /FontInfo 1 dict def } if
currentfont /FontName known not { /FontName () def } if
@@ -336,7 +334,7 @@ currentdict readonly end pop % pcldict
{ FontName dup length string cvs }
if def
- % Determine the original font, and its relationship to this one.
+ % Determine the original font, and its relationship to this one.
/OrigFont currentfont origfont def
/OrigMatrix OrigFont /FontMatrix get def
@@ -356,7 +354,7 @@ currentdict readonly end pop % pcldict
def
/negY flipY { {neg} } { {} } ifelse def
- % Print debugging information.
+ % Print debugging information.
/CDEBUG where { pop } { /CDEBUG false def } ifelse
/VDEBUG where { pop } { /VDEBUG false def } ifelse
@@ -374,13 +372,13 @@ currentdict readonly end pop % pcldict
} if
currentfont /ScaleMatrix .knownget { (ScaleMatrix: ) print == } if
gsave
- FontMatrix concat
- (combined matrix: ) print matrix currentmatrix ==
+ FontMatrix concat
+ (combined matrix: ) print matrix currentmatrix ==
grestore
flush
} if
- % Determine the orientation.
+ % Determine the orientation.
ScaleMatrix matrix currentmatrix dup concatmatrix
0 1 3
@@ -408,8 +406,8 @@ currentdict readonly end pop % pcldict
}
if pop
- % Determine the font metrics, in the PCL character coordinate system,
- % which has +Y going towards the top of the page.
+ % Determine the font metrics, in the PCL character coordinate system,
+ % which has +Y going towards the top of the page.
gsave
FontMatrix concat
@@ -433,7 +431,7 @@ currentdict readonly end pop % pcldict
/uw uurx ullx sub def
/uh uury ully sub def
grestore
- DEBUG
+ DEBUG
{ (rmatrix: ) print matrix currentmatrix ==
(rFontBBox: ) print [rllx rlly rurx rury] ==
(uFontBBox: ) print [ullx ully uurx uury] ==
@@ -441,29 +439,29 @@ currentdict readonly end pop % pcldict
} if
grestore
- % Disable the character cache, to avoid excessive allocation
- % and memory sandbars.
+ % Disable the character cache, to avoid excessive allocation
+ % and memory sandbars.
mark cachestatus /upper exch def
cleartomark 0 setcachelimit
-
- % Write the font header.
+
+ % Write the font header.
writefontheader
- % Establish an image device for rasterizing characters.
+ % Establish an image device for rasterizing characters.
matrix currentmatrix
dup 4 rminx neg put
dup 5 rminy neg put
- % Round the width up to a multiple of 8
- % so we don't get garbage bits in the last byte of each row.
+ % Round the width up to a multiple of 8
+ % so we don't get garbage bits in the last byte of each row.
rw 7 add -8 and rh <ff 00> makeimagedevice
/cdevice exch def
nulldevice % prevent page device switching
cdevice setdevice
- % Rasterize each character in turn.
+ % Rasterize each character in turn.
/raster rw 7 add 8 idiv def
/row raster string def
@@ -473,88 +471,88 @@ currentdict readonly end pop % pcldict
Encoding cindex get /.notdef ne
{ VDEBUG { Encoding cindex get == flush } if
erasepage initgraphics
- 0 0 moveto currentpoint transform add
- ( ) dup 0 cindex put show
- currentpoint transform add exch sub round cvi
- /cwidth exch abs def
- rw rh devbbox
- VDEBUG
- { (image bbox: ) print 4 copy 4 2 roll 4 array astore == flush
- } if
- % Save the device bounding box.
- % Note that this is in current device coordinates,
- % not PCL (right-handed) coordinates.
- /bqx exch def /bpx exch def /bqy exch def /bpy exch def
- % Re-render with the character justified to (0,0).
- % This may be either the lower left or the upper left corner.
- bpx neg bpy neg idtransform moveto
- erasepage
- VDEBUG { (show point: ) print [ currentpoint transform ] == flush } if
- ( ) dup 0 cindex put show
- % Find the bounding box. Note that xmin and ymin are now 0,
- % xmax1 = xw, and ymax1 = yh.
- rw rh devbbox
- /xw exch def
- % xmin or ymin can be non-zero only if the character is blank.
- xw 0 eq
- { pop }
- { dup 0 ne { (Non-zero xmin! ) print = } { pop } ifelse }
- ifelse
- /yh exch def
- yh 0 eq
- { pop }
- { dup 0 ne { (Non-zero ymin! ) print = } { pop } ifelse }
- ifelse
-
- /xbw xw 7 add 8 idiv def
- /xright raster 8 mul xw sub def
- % Write the Character Code command.
- outfile (\033*c) writestring
- outfile cindex write==only
- outfile (E) writestring
- % Write the Character Definition command.
- outfile (\033\(s) writestring
- yh xbw mul 16 add
- outfile exch write=only
- % Record the character position for the .PCM file.
- /cfpos outfile fileposition 1 add def
- outfile (W\004\000\016\001) writestring
- orientation (Orientation) wbyte 0 (Reserved) wbyte
- rminx bpx add r0x sub (Left Offset) wword
- flipY { rminy bpy add neg } { rminy bqy add } ifelse r0y sub
- (Top Offset) wword
- xw (Character Width) wword
- yh (Character Height) wword
- cwidth orientation 2 ge { neg } if 4 mul (Delta X) wword
- % Write the character data.
- flipY { 0 1 yh 1 sub } { yh 1 sub -1 0 } ifelse
- { cdevice exch row copyscanlines
- 0 xbw getinterval
- CDEBUG
- { dup
- { 8
- { dup 128 ge { (+) } { (.) } ifelse print
- 127 and 1 bitshift
- }
- repeat pop
- }
- forall (\n) print
- }
- if
- outfile exch writestring
- }
- for
+ 0 0 moveto currentpoint transform add
+ ( ) dup 0 cindex put show
+ currentpoint transform add exch sub round cvi
+ /cwidth exch abs def
+ rw rh devbbox
+ VDEBUG
+ { (image bbox: ) print 4 copy 4 2 roll 4 array astore == flush
+ } if
+ % Save the device bounding box.
+ % Note that this is in current device coordinates,
+ % not PCL (right-handed) coordinates.
+ /bqx exch def /bpx exch def /bqy exch def /bpy exch def
+ % Re-render with the character justified to (0,0).
+ % This may be either the lower left or the upper left corner.
+ bpx neg bpy neg idtransform moveto
+ erasepage
+ VDEBUG { (show point: ) print [ currentpoint transform ] == flush } if
+ ( ) dup 0 cindex put show
+ % Find the bounding box. Note that xmin and ymin are now 0,
+ % xmax1 = xw, and ymax1 = yh.
+ rw rh devbbox
+ /xw exch def
+ % xmin or ymin can be non-zero only if the character is blank.
+ xw 0 eq
+ { pop }
+ { dup 0 ne { (Non-zero xmin! ) print = } { pop } ifelse }
+ ifelse
+ /yh exch def
+ yh 0 eq
+ { pop }
+ { dup 0 ne { (Non-zero ymin! ) print = } { pop } ifelse }
+ ifelse
+
+ /xbw xw 7 add 8 idiv def
+ /xright raster 8 mul xw sub def
+ % Write the Character Code command.
+ outfile (\033*c) writestring
+ outfile cindex write==only
+ outfile (E) writestring
+ % Write the Character Definition command.
+ outfile (\033\(s) writestring
+ yh xbw mul 16 add
+ outfile exch write=only
+ % Record the character position for the .PCM file.
+ /cfpos outfile fileposition 1 add def
+ outfile (W\004\000\016\001) writestring
+ orientation (Orientation) wbyte 0 (Reserved) wbyte
+ rminx bpx add r0x sub (Left Offset) wword
+ flipY { rminy bpy add neg } { rminy bqy add } ifelse r0y sub
+ (Top Offset) wword
+ xw (Character Width) wword
+ yh (Character Height) wword
+ cwidth orientation 2 ge { neg } if 4 mul (Delta X) wword
+ % Write the character data.
+ flipY { 0 1 yh 1 sub } { yh 1 sub -1 0 } ifelse
+ { cdevice exch row copyscanlines
+ 0 xbw getinterval
+ CDEBUG
+ { dup
+ { 8
+ { dup 128 ge { (+) } { (.) } ifelse print
+ 127 and 1 bitshift
+ }
+ repeat pop
+ }
+ forall (\n) print
+ }
+ if
+ outfile exch writestring
+ }
+ for
}
{ /bpx 0 def /bpy 0 def /bqx 0 def /bqy 0 def
- /cwidth 0 def
- /cfpos 0 def
+ /cwidth 0 def
+ /cfpos 0 def
}
ifelse
}
for
- % Wrap up.
+ % Wrap up.
upper setcachelimit
outfile closefile
diff --git a/gs/lib/gs_ce_e.ps b/gs/lib/gs_ce_e.ps
index 1ebb08336..04b573f81 100644
--- a/gs/lib/gs_ce_e.ps
+++ b/gs/lib/gs_ce_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_cmdl.ps b/gs/lib/gs_cmdl.ps
index 2b83b5f8d..848b5c73a 100644
--- a/gs/lib/gs_cmdl.ps
+++ b/gs/lib/gs_cmdl.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1996, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -24,7 +24,7 @@ cmddict begin
% Get the next argument from the parsed argument list.
/nextarg % - nextarg <arg> true
- % - nextarg false
+ % - nextarg false
{ argv length 0 eq
{ false }
{ argv dup 0 get exch dup length 1 sub 1 exch getinterval /argv exch def }
@@ -51,12 +51,12 @@ cmddict begin
{ pop /expand@ false def
}
{ expand@ { (@) anchorsearch } { false } ifelse
- { pop findlibfile
- { exch pop }
- { (r) file } % let the error happen
- expandargfile
- }
- if
+ { pop findlibfile
+ { exch pop }
+ { (r) file } % let the error happen
+ expandargfile
+ }
+ if
}
ifelse
}
@@ -91,7 +91,7 @@ cmddict begin
argv 0 get (-) anchorsearch { pop pop exit } if
pop nextarg token
{ exch pop % Probably should check for empty.
- end exec //cmddict begin
+ end exec //cmddict begin
}
if
}
@@ -146,29 +146,29 @@ cmddict begin
{ //cmddict begin
/expand@ true def
[
- % Process the GS_OPTIONS environment variable.
+ % Process the GS_OPTIONS environment variable.
(GS_OPTIONS) getenv { 0 () /SubFileDecode filter expandargfile } if
- % Process the actual command line.
+ % Process the actual command line.
.getargv { expandarg } forall
] readonly /argv exch def
- % Now interpret the commands.
+ % Now interpret the commands.
{ nextarg not { exit } if
dup 0 get (-) 0 get eq
{ dup length 1 eq
- { pop (%stdin) (r) file runjob
- }
- { dup length 2 gt
- { dup dup length 2 sub 2 exch getinterval exch 1 1 getinterval }
- if currentdict .knownget
- { exec
- }
- { (Ignoring unknown switch ) print
- dup length 1 eq { (-) print print } if print
- () = flush
- }
- ifelse
- }
- ifelse
+ { pop (%stdin) (r) file runjob
+ }
+ { dup length 2 gt
+ { dup dup length 2 sub 2 exch getinterval exch 1 1 getinterval }
+ if currentdict .knownget
+ { exec
+ }
+ { (Ignoring unknown switch ) print
+ dup length 1 eq { (-) print print } if print
+ () = flush
+ }
+ ifelse
+ }
+ ifelse
}
{ runfilejob
}
diff --git a/gs/lib/gs_fform.ps b/gs/lib/gs_fform.ps
index 58a87893e..49aac44c5 100644
--- a/gs/lib/gs_fform.ps
+++ b/gs/lib/gs_fform.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -38,32 +38,32 @@ true setglobal
/.execform1 {
dup /Implementation known not {
dup /FormType get 1 ne { /rangecheck signalerror } if
- % The Implementation is a Pattern that will draw the form.
+ % The Implementation is a Pattern that will draw the form.
currentglobal 1 index gcheck setglobal
- % Stack: form global
+ % Stack: form global
10 dict begin
/PatternType 1 def
/PaintType 1 def % colored
/TilingType 1 def % irrelevant
- % Copy the BBox to the correct VM.
+ % Copy the BBox to the correct VM.
/BBox 2 index /BBox get 4 array copy exch 1 index def
- % Set XStep and YStep to very large numbers,
- % so we won't get multiple copies of the form.
+ % Set XStep and YStep to very large numbers,
+ % so we won't get multiple copies of the form.
/XStep 1 index dup 2 get exch 0 get sub 100 mul def
/YStep exch dup 3 get exch 1 get sub 100 mul def
/PaintProc 2 index /PaintProc get def
currentdict end readonly
- % Stack: form global impl
+ % Stack: form global impl
exch setglobal
1 index /Implementation 3 -1 roll .forceput
} if
.formcachedict 1 index .knownget {
- % Check whether we can use the cached value.
- % Stack: form cachevalue
+ % Check whether we can use the cached value.
+ % Stack: form cachevalue
matrix currentmatrix true 0 1 3 {
- % Stack: form cachevalue curmat true index
+ % Stack: form cachevalue curmat true index
3 index 0 get 1 index get exch 3 index exch get ne {
- pop pop false exit
+ pop pop false exit
} if
} for exch pop
} {
@@ -72,14 +72,14 @@ true setglobal
{ % Make a new cache entry.
gsave
matrix currentmatrix dup 4 0 put dup 5 0 put dup setmatrix
- % Stack: form mat
+ % Stack: form mat
1 index /Implementation get
2 index /Matrix get
makepattern 2 array astore
.formcachedict 2 index 2 index put
grestore
} if
- % Stack: form cachevalue
+ % Stack: form cachevalue
-1 0 0 transform
2 { exch round cvi } repeat .setscreenphase
1 get setpattern
diff --git a/gs/lib/gs_il2_e.ps b/gs/lib/gs_il2_e.ps
index 8ca328c07..cbfb1d74d 100644
--- a/gs/lib/gs_il2_e.ps
+++ b/gs/lib/gs_il2_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_kanji.ps b/gs/lib/gs_kanji.ps
index 768760b79..5d025e614 100644
--- a/gs/lib/gs_kanji.ps
+++ b/gs/lib/gs_kanji.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -27,45 +27,45 @@ ifelse
/KanjiEncoding
% \x00
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
% \x20
- 0 1 2 3 4 5 6 7
- 8 0 0 0 0 0 0 0
- 9 10 11 12 13 14 15 16
- 17 18 19 20 21 22 23 24
+ 0 1 2 3 4 5 6 7
+ 8 0 0 0 0 0 0 0
+ 9 10 11 12 13 14 15 16
+ 17 18 19 20 21 22 23 24
% \x40
- 25 26 27 28 29 30 31 32
- 33 34 35 36 37 38 39 40
- 41 42 43 44 45 46 47 48
- 49 50 51 52 53 54 55 56
+ 25 26 27 28 29 30 31 32
+ 33 34 35 36 37 38 39 40
+ 41 42 43 44 45 46 47 48
+ 49 50 51 52 53 54 55 56
% \x60
- 57 58 59 60 61 62 63 64
- 65 66 67 68 69 70 71 72
- 73 74 75 76 77 0 0 0
- 0 0 0 0 0 0 0 0
+ 57 58 59 60 61 62 63 64
+ 65 66 67 68 69 70 71 72
+ 73 74 75 76 77 0 0 0
+ 0 0 0 0 0 0 0 0
% \x80
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
% \xA0
- 0 1 2 3 4 5 6 7
- 8 0 0 0 0 0 0 0
- 9 10 11 12 13 14 15 16
- 17 18 19 20 21 22 23 24
+ 0 1 2 3 4 5 6 7
+ 8 0 0 0 0 0 0 0
+ 9 10 11 12 13 14 15 16
+ 17 18 19 20 21 22 23 24
% \xC0
- 25 26 27 28 29 30 31 32
- 33 34 35 36 37 38 39 40
- 41 42 43 44 45 46 47 48
- 49 50 51 52 53 54 55 56
+ 25 26 27 28 29 30 31 32
+ 33 34 35 36 37 38 39 40
+ 41 42 43 44 45 46 47 48
+ 49 50 51 52 53 54 55 56
% \xE0
- 57 58 59 60 61 62 63 64
- 65 66 67 68 69 70 71 72
- 73 74 75 76 77 0 0 0
- 0 0 0 0 0 0 0 0
+ 57 58 59 60 61 62 63 64
+ 65 66 67 68 69 70 71 72
+ 73 74 75 76 77 0 0 0
+ 0 0 0 0 0 0 0 0
256 packedarray def
% Define a stub for the base font encoding.
@@ -127,7 +127,7 @@ FontName currentdict end definefont
/newname1 exch def
newname1 dup length string cvs /str exch def
str length /len exch def
-/fdepvector 78 array def
+/fdepvector 78 array def
/j 1 def
16#21 1 16#74 {
/i exch def
diff --git a/gs/lib/gs_ksb_e.ps b/gs/lib/gs_ksb_e.ps
index 95886b971..15c02e18e 100644
--- a/gs/lib/gs_ksb_e.ps
+++ b/gs/lib/gs_ksb_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_lgo_e.ps b/gs/lib/gs_lgo_e.ps
index 6c6ba6051..5b405a452 100644
--- a/gs/lib/gs_lgo_e.ps
+++ b/gs/lib/gs_lgo_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_lgx_e.ps b/gs/lib/gs_lgx_e.ps
index a6cff8127..7b2899914 100644
--- a/gs/lib/gs_lgx_e.ps
+++ b/gs/lib/gs_lgx_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_pfile.ps b/gs/lib/gs_pfile.ps
index f20a94fc2..264fa2beb 100644
--- a/gs/lib/gs_pfile.ps
+++ b/gs/lib/gs_pfile.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1995 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,29 +30,29 @@
% the starting address and length of the outer compressed file,
% and the starting address and length of the inner file.
/.packedfilefilter % <file> <ostart> <olength> <istart> <ilength>
- % .packedfilefilter <filter>
+ % .packedfilefilter <filter>
{ 4 index systemdict begin token pop end 6 1 roll
- % Stack: fproc file ostart olength istart ilength
+ % Stack: fproc file ostart olength istart ilength
4 index 5 -1 roll setfileposition
- % Stack: fproc file olength istart ilength
+ % Stack: fproc file olength istart ilength
4 -2 roll () /SubFileDecode filter
- % Stack: fproc istart ilength ofilter
+ % Stack: fproc istart ilength ofilter
4 -1 roll exec
- % Filters don't support setfileposition, so we must skip data
- % by reading it into a buffer. We rely on the fact that
- % save/restore don't affect file positions.
- % Stack: istart ilength dfilter
+ % Filters don't support setfileposition, so we must skip data
+ % by reading it into a buffer. We rely on the fact that
+ % save/restore don't affect file positions.
+ % Stack: istart ilength dfilter
save exch 64000 string
- % Stack: istart ilength save dfilter scratch
+ % Stack: istart ilength save dfilter scratch
4 index 1 index length idiv { 2 copy readstring pop pop } repeat
2 copy 0 8 -1 roll 2 index length mod getinterval readstring pop pop pop
- % Stack: ilength save dfilter
+ % Stack: ilength save dfilter
exch restore exch () /SubFileDecode filter
} bind def
% Run a packed library file.
/.runpackedlibfile % <filename> <ostart> <olength> <istart> <ilength>
- % .runpackedlibfile
+ % .runpackedlibfile
{ 5 -1 roll findlibfile
{ exch pop dup 6 2 roll .packedfilefilter
currentobjectformat exch 1 setobjectformat run
@@ -69,18 +69,18 @@
% specifications of the procedures and data in this section.
/.compactfontdefault mark
- /PaintType 0
- /FontMatrix [0.001 0 0 0.001 0 0] readonly
- /FontType 1
- /Encoding StandardEncoding
+ /PaintType 0
+ /FontMatrix [0.001 0 0 0.001 0 0] readonly
+ /FontType 1
+ /Encoding StandardEncoding
.dicttomark readonly def
/.checkexistingfont % <fontname> <uid> <privatesize> <fontsize>
- % .checkexistingfont
- % {} (<font> on d-stack)
- % <fontname> <uid> <privatesize> <fontsize>
- % .checkexistingfont
- % -save- --restore-- (<font> on d-stack)
+ % .checkexistingfont
+ % {} (<font> on d-stack)
+ % <fontname> <uid> <privatesize> <fontsize>
+ % .checkexistingfont
+ % -save- --restore-- (<font> on d-stack)
{ FontDirectory 4 index .knownget
{ dup /UniqueID .knownget
{ 4 index eq exch /FontType get 1 eq and }
@@ -118,8 +118,8 @@
{ 2 index exch get
}
{ % Stack: encrypt dict dict key value
- 4 index { 4330 exch dup .type1encrypt exch pop } if
- readonly
+ 4 index { 4330 exch dup .type1encrypt exch pop } if
+ readonly
}
ifelse put dup
}
diff --git a/gs/lib/gs_rdlin.ps b/gs/lib/gs_rdlin.ps
index 6f8d0388b..204d9f65d 100644
--- a/gs/lib/gs_rdlin.ps
+++ b/gs/lib/gs_rdlin.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/gs_wl1_e.ps b/gs/lib/gs_wl1_e.ps
index 41df666eb..9e8c60494 100644
--- a/gs/lib/gs_wl1_e.ps
+++ b/gs/lib/gs_wl1_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop
/graybox
% \20x
/.notdef /.notdef /quotesinglbase /florin
- /quotedblbase /ellipsis /dagger /daggerdbl
+ /quotedblbase /ellipsis /dagger /daggerdbl
/circumflex /perthousand /Scaron /guilsinglleft
- /OE /.notdef /.notdef /.notdef
+ /OE /.notdef /.notdef /.notdef
/.notdef /quoteleft /quoteright /quotedblleft
- /quotedblright /bullet /endash /emdash
+ /quotedblright /bullet /endash /emdash
/tilde /trademark /scaron /guilsinglright
- /oe /.notdef /.notdef /Ydieresis
+ /oe /.notdef /.notdef /Ydieresis
/.notdef /exclamdown /cent /sterling
- /currency /yen /brokenbar /section
+ /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft
- /logicalnot /softhyphen /registered /overscore
+ /logicalnot /softhyphen /registered /overscore
/degree /plusminus /twosuperior /threesuperior
- /acute /mu /paragraph /periodcentered
+ /acute /mu /paragraph /periodcentered
/cedilla /onesuperior /ordmasculine /guillemotright
- /onequarter /onehalf /threequarters /questiondown
+ /onequarter /onehalf /threequarters /questiondown
% \30x
/Agrave /Aacute /Acircumflex /Atilde
- /Adieresis /Aring /AE /Ccedilla
+ /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis
- /Igrave /Iacute /Icircumflex /Idieresis
+ /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute
- /Ocircumflex /Otilde /Odieresis /multiply
+ /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex
- /Udieresis /Yacute /Thorn /germandbls
+ /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde
- /adieresis /aring /ae /ccedilla
+ /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis
- /igrave /iacute /icircumflex /idieresis
+ /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute
- /ocircumflex /otilde /odieresis /divide
+ /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex
- /udieresis /yacute /thorn /ydieresis
+ /udieresis /yacute /thorn /ydieresis
256 packedarray .defineencoding
exec
diff --git a/gs/lib/gs_wl2_e.ps b/gs/lib/gs_wl2_e.ps
index b26f83a47..5cf476fd0 100644
--- a/gs/lib/gs_wl2_e.ps
+++ b/gs/lib/gs_wl2_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop
/graybox
% \20x
/.notdef /.notdef /quotesinglbase /.notdef
- /quotedblbase /ellipsis /dagger /daggerdbl
+ /quotedblbase /ellipsis /dagger /daggerdbl
/.notdef /perthousand /Scaron /guilsinglleft
- /Sacute /Tcaron /Zcaron /Zacute
+ /Sacute /Tcaron /Zcaron /Zacute
/.notdef /quoteleft /quoteright /quotedblleft
- /quotedblright /bullet /endash /emdash
+ /quotedblright /bullet /endash /emdash
/.notdef /trademark /scaron /guilsinglright
- /sacute /tcaron /zcaron /zacute
+ /sacute /tcaron /zcaron /zacute
/.notdef /caron /breve /Lslash
- /currency /Aogonek /brokenbar /section
+ /currency /Aogonek /brokenbar /section
/dieresis /copyright /Scedilla /guillemotleft
- /logicalnot /softhyphen /registered /Zdotaccent
+ /logicalnot /softhyphen /registered /Zdotaccent
/degree /plusminus /ogonek /lslash
- /acute /mu /paragraph /periodcentered
+ /acute /mu /paragraph /periodcentered
/cedilla /aogonek /scedilla /guillemotright
- /Lcaron /hungarumlaut /lcaron /zdotaccent
+ /Lcaron /hungarumlaut /lcaron /zdotaccent
% \30x
/Racute /Aacute /Acircumflex /Abreve
- /Adieresis /Lacute /Cacute /Ccedilla
+ /Adieresis /Lacute /Cacute /Ccedilla
/Ccaron /Eacute /Eogonek /Edieresis
- /Ecaron /Iacute /Icircumflex /Dcaron
+ /Ecaron /Iacute /Icircumflex /Dcaron
/Dcroat /Nacute /Ncaron /Oacute
- /Ocircumflex /Ohungarumlaut /Odieresis /multiply
+ /Ocircumflex /Ohungarumlaut /Odieresis /multiply
/Rcaron /Uring /Uacute /Uhungarumlaut
- /Udieresis /Yacute /Tcommaaccent /germandbls
+ /Udieresis /Yacute /Tcommaaccent /germandbls
/racute /aacute /acircumflex /abreve
- /adieresis /lacute /cacute /ccedilla
+ /adieresis /lacute /cacute /ccedilla
/ccaron /eacute /eogonek /edieresis
- /ecaron /iacute /icircumflex /dcaron
+ /ecaron /iacute /icircumflex /dcaron
/dcroat /nacute /ncaron /oacute
- /ocircumflex /ohungarumlaut /odieresis /divide
+ /ocircumflex /ohungarumlaut /odieresis /divide
/rcaron /uring /uacute /uhungarumlaut
- /udieresis /yacute /tcommaaccent /dotaccent
+ /udieresis /yacute /tcommaaccent /dotaccent
256 packedarray .defineencoding
exec
diff --git a/gs/lib/gs_wl5_e.ps b/gs/lib/gs_wl5_e.ps
index 8721071f4..d5daa6aa4 100644
--- a/gs/lib/gs_wl5_e.ps
+++ b/gs/lib/gs_wl5_e.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -30,37 +30,37 @@ ISOLatin1Encoding 97 30 getinterval aload pop
/graybox
% \20x
/.notdef /.notdef /quotesinglbase /florin
- /quotedblbase /ellipsis /dagger /daggerdbl
+ /quotedblbase /ellipsis /dagger /daggerdbl
/circumflex /perthousand /Scaron /guilsinglleft
- /OE /.notdef /.notdef /.notdef
+ /OE /.notdef /.notdef /.notdef
/.notdef /quoteleft /quoteright /quotedblleft
- /quotedblright /bullet /endash /emdash
+ /quotedblright /bullet /endash /emdash
/tilde /trademark /scaron /guilsinglright
- /oe /.notdef /.notdef /Ydieresis
+ /oe /.notdef /.notdef /Ydieresis
/.notdef /exclamdown /cent /sterling
- /currency /yen /brokenbar /section
+ /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft
- /logicalnot /softhyphen /registered /overscore
+ /logicalnot /softhyphen /registered /overscore
/degree /plusminus /twosuperior /threesuperior
- /acute /mu /paragraph /periodcentered
+ /acute /mu /paragraph /periodcentered
/cedilla /onesuperior /ordmasculine /guillemotright
- /onequarter /onehalf /threequarters /questiondown
+ /onequarter /onehalf /threequarters /questiondown
% \30x
/Agrave /Aacute /Acircumflex /Atilde
- /Adieresis /Aring /AE /Ccedilla
+ /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis
- /Igrave /Iacute /Icircumflex /Idieresis
+ /Igrave /Iacute /Icircumflex /Idieresis
/Gbreve /Ntilde /Ograve /Oacute
- /Ocircumflex /Otilde /Odieresis /multiply
+ /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex
- /Udieresis /Idotaccent /Scedilla /germandbls
+ /Udieresis /Idotaccent /Scedilla /germandbls
/agrave /aacute /acircumflex /atilde
- /adieresis /aring /ae /ccedilla
+ /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis
- /igrave /iacute /icircumflex /idieresis
+ /igrave /iacute /icircumflex /idieresis
/gbreve /ntilde /ograve /oacute
- /ocircumflex /otilde /odieresis /divide
+ /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex
- /udieresis /dotlessi /scedilla /ydieresis
+ /udieresis /dotlessi /scedilla /ydieresis
256 packedarray .defineencoding
exec
diff --git a/gs/lib/gslp.ps b/gs/lib/gslp.ps
index d514321b0..27fcf63e0 100644
--- a/gs/lib/gslp.ps
+++ b/gs/lib/gslp.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1991, 1995, 1996, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -63,7 +63,7 @@ lpdict begin
%% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1
dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall
/Encoding ISOLatin1Encoding def currentdict end
- dup /FontName get 80 string cvs (-ISOLatin1) concatstrings cvn
+ dup /FontName get 80 string cvs (-ISOLatin1) concatstrings cvn
exch definefont
} def
@@ -136,7 +136,7 @@ lpdict begin
} def
/lpmoveto { % <x> <y> lpmoveto -
- % Round the coordinates for smaller output.
+ % Round the coordinates for smaller output.
2 {
exch 100 mul round 100 div
dup dup cvi eq { cvi } if
@@ -146,23 +146,23 @@ lpdict begin
/lpshow { % <string> lpshow -
dup length 0 ne {
addspace 0 ne {
- addspace 0 32
+ addspace 0 32
addwidth 0 ne {
- addwidth 0 6 -1 roll /awidthshow 6 true lpexec
+ addwidth 0 6 -1 roll /awidthshow 6 true lpexec
} {
- 4 -1 roll /widthshow 4 true lpexec
+ 4 -1 roll /widthshow 4 true lpexec
} ifelse
} {
addwidth 0 ne {
- addwidth 0 3 -1 roll /ashow 3 true lpexec
+ addwidth 0 3 -1 roll /ashow 3 true lpexec
} {
- OutFile null ne {
- dup dup length =string length gt {
- /show 1 false lpexec
- } {
- (S ) ws ws (\n) ws
- } ifelse
- } if show
+ OutFile null ne {
+ dup dup length =string length gt {
+ /show 1 false lpexec
+ } {
+ (S ) ws ws (\n) ws
+ } ifelse
+ } if show
} ifelse
} ifelse
} {
@@ -183,9 +183,9 @@ lpdict begin
3 -1 roll bannerstring pop 0 4 index pwidth showline2 pop
exch bannerstring pwidth exch sub 2 div 3 index pwidth showline2 pop
bannerstring
- % Prevent the last character of the heading from grazing
- % the right margin.
- % ****** WHY DOES IT REQUIRE SO MUCH PADDING? ******
+ % Prevent the last character of the heading from grazing
+ % the right margin.
+ % ****** WHY DOES IT REQUIRE SO MUCH PADDING? ******
( ) stringwidth pop 2 mul add
pwidth exch sub
3 -1 roll pwidth showline2 pop
@@ -258,7 +258,7 @@ lpdict begin
/outfont { % <name> <font> outfont -
OutFile null ne {
exch wo
- dup /FontName get
+ dup /FontName get
dup wosp (-ISOLatin1) ws wosp ( RE) ws
/FontMatrix get 0 get 1000 mul round cvi wosp
( scalefont def\n) ws
@@ -296,7 +296,7 @@ lpdict begin
/showline2 { % string x y xlimit -> leftover_string (handles tabs)
2 index exch 5 2 roll setxy {
- % Stack: xinit xlimit string
+ % Stack: xinit xlimit string
showline3 dup length 0 eq { exit } if
dup 0 get CharTAB ne { exit } if
tx 3 index sub tabwx div
@@ -307,11 +307,11 @@ lpdict begin
} def
/showline3 { % xlimit string -> xlimit leftover_string
- % (finds line break / tab / formfeed)
+ % (finds line break / tab / formfeed)
1 index tx sub
cwx div 0.1 add cvi 0 .max 1 index length .min
1 index 0 3 -1 roll getinterval
- % look for \f or \t
+ % look for \f or \t
StringFF search { exch pop exch pop } if
StringTAB search { exch pop exch pop } if
dup length 0 ne {
@@ -367,15 +367,15 @@ lpdict begin
{ mfile =string readline pop
(EndFontMetrics) anchorsearch { pop pop exit } if
(KPX ) anchorsearch {
- pop token pop cvlit /char1 exch def
- token pop cvlit /char2 exch def
- token pop /kern exch def pop
- kdict char1 .knownget not {
- 5 dict kdict char1 2 index .growput
- } if
- char2 kern .growput
+ pop token pop cvlit /char1 exch def
+ token pop cvlit /char2 exch def
+ token pop /kern exch def pop
+ kdict char1 .knownget not {
+ 5 dict kdict char1 2 index .growput
+ } if
+ char2 kern .growput
} {
- pop
+ pop
} ifelse
} loop kdict
} {
@@ -402,7 +402,7 @@ lpdict begin
/S {currentfile =string readline pop show} lpdef
/RE { % <isoname> <fontname> RE <font>
findfont
- %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1
+ %% reencode for iso latin1; from the 2nd edition red book, sec 5.6.1
dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall
/Encoding ISOLatin1Encoding def currentdict end
definefont
@@ -448,8 +448,8 @@ lpdict begin
Footers { hheight lheight add } { 0 } ifelse
/botskip exch def
/pskip topskip botskip add def
- % Translate the page so that (0,0) corresponds to
- % the top of the topmost body line.
+ % Translate the page so that (0,0) corresponds to
+ % the top of the topmost body line.
pathbbox
2 index sub MarginBottom MarginTop add sub /plength exch def
2 index sub MarginLeft MarginRight add sub /pwidth exch def
@@ -493,12 +493,12 @@ lpdict begin
}
{ % Reached CR and/or EOF first.
exch length pos add lbuf exch 0 exch getinterval
- 1 index { showline } if % omit final empty line
- { dup length 0 eq Truncate or { pop () exit } if
- showline
- }
- loop
- exch not { exit } if
+ 1 index { showline } if % omit final empty line
+ { dup length 0 eq Truncate or { pop () exit } if
+ showline
+ }
+ loop
+ exch not { exit } if
}
ifelse
pindex PageLast gt { exit } if
@@ -626,10 +626,10 @@ lpdict begin
/lp1 % filename ->
{ break not { dup /HeadingLeft exch def } if
Noisy
- { (Printing ) eprint dup eprint (\n) eprint
+ { (Printing ) eprint dup eprint (\n) eprint
} if
(r) file
- % If requested, check for a PostScript file.
+ % If requested, check for a PostScript file.
DetectFileType
{ dup 2 string readstring pop dup (%!) eq
{ % Yes, it's a PostScript file.
@@ -659,11 +659,11 @@ end
dup length 2 ge { dup 0 get (-) 0 get eq } { false } ifelse
{ dup 0 2 getinterval
exch dup length 2 sub 2 exch getinterval
- doswitch
+ doswitch
}
{ dup /matched false def
{ /matched true def /any true def lp1 } lpcstring filenameforall
- matched { pop } { lp1 } ifelse % let the error happen
+ matched { pop } { lp1 } ifelse % let the error happen
}
ifelse
} loop
@@ -679,14 +679,14 @@ end
{ ] dup length 0 ne { lpcommand } { false } ifelse not
{ (%stderr) (w) file
[ (Usage: )
- /PROGNAME where { pop PROGNAME } { (gslp) } ifelse
- ( [-12BclqRr] [-b<header>] [-f<font>] [-F<hfont>]\n)
- ( [-L<lines>] [-p<outfile>] [-T<tabwidth>]\n)
- ( [--add-to-(space|width) <units>] [--columns <n>]\n)
- ( [--detect] [--first-page <page#>] [--last-page <page#>]\n)
- ( [--(heading|footing)-(left|right|center) <string>]\n)
- ( [--kern <afmfile>] [--margin-(top|bottom|left|right) <inches>]\n)
- ( [--no-eject-(file|formfeed)] [--spacing <n>] file1 ... filen\n)
+ /PROGNAME where { pop PROGNAME } { (gslp) } ifelse
+ ( [-12BclqRr] [-b<header>] [-f<font>] [-F<hfont>]\n)
+ ( [-L<lines>] [-p<outfile>] [-T<tabwidth>]\n)
+ ( [--add-to-(space|width) <units>] [--columns <n>]\n)
+ ( [--detect] [--first-page <page#>] [--last-page <page#>]\n)
+ ( [--(heading|footing)-(left|right|center) <string>]\n)
+ ( [--kern <afmfile>] [--margin-(top|bottom|left|right) <inches>]\n)
+ ( [--no-eject-(file|formfeed)] [--spacing <n>] file1 ... filen\n)
] { 2 copy writestring pop } forall dup flushfile closefile
}
if
diff --git a/gs/lib/gsnup.ps b/gs/lib/gsnup.ps
index 15ef067a0..b990dd097 100644
--- a/gs/lib/gsnup.ps
+++ b/gs/lib/gsnup.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -59,23 +59,23 @@ false setglobal
grestore
2 copy exch .Nx div exch .Ny div
.Pn dup .Nx mod exch .Nx idiv .Ny 1 sub exch sub
- % Stack: nmax pw ph pw/nx ph/ny ix iy
+ % Stack: nmax pw ph pw/nx ph/ny ix iy
exch 3 index mul exch 2 index mul
translate
- % Stack: nmax pw ph pw/nx ph/ny
+ % Stack: nmax pw ph pw/nx ph/ny
4 -1 roll 4 index div 4 -1 roll 4 index div
- % Stack: nmax pw/nx ph/ny pw/nmax ph/nmax
+ % Stack: nmax pw/nx ph/ny pw/nmax ph/nmax
exch 4 -1 roll exch sub 2 div
3 1 roll sub 2 div
translate
- % Stack: nmax
+ % Stack: nmax
1 exch div dup scale
.BP
}
/EndPage {
dup 2 lt {
.ELevel 0 vmstatus pop pop put
- .Ps 0 .Pn 1 add .Nx .Ny mul mod put
+ .Ps 0 .Pn 1 add .Nx .Ny mul mod put
.Pn 0 eq {
.EP
} {
diff --git a/gs/lib/image-qa.ps b/gs/lib/image-qa.ps
index 3c84d8ba2..fe56600c9 100644
--- a/gs/lib/image-qa.ps
+++ b/gs/lib/image-qa.ps
@@ -1,13 +1,13 @@
%!PS
% Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -18,7 +18,7 @@
% Tests for the image operators
% Specifications for Image operator testing.
-%
+%
% 1. All 8 standard orientations (0, 90, 180, 270 degree rotations with
% and without reflection); ditto those orientations perturbed by +/-
% 10 degrees, and by 45 degrees.
@@ -26,35 +26,35 @@
% Enough space is provided around images on a test page to allow
% these permutations to use the same page layout. This will make
% test page construction easier and simplify page checking.
-%
+%
% 2. All 9 image types (ImageType 1 mask, ImageType 1 opaque,
% ImageType 3 with all 3 InterleaveTypes and with unequal scaling
% for InterleaveType 2 and 3, ImageType 4 with both range and
% single-point matching).
-%
+%
% 3. DeviceGray, DeviceRGB, and DeviceN color, both direct and Indexed.
% Indexed color will use the common pallete size of 256 colors.
-%
+%
% 4. For simple masks, both colored and uncolored Patterns.
-%
+%
% 5. CombineWithColor true and false; several different colors for the
% true case (including black, white, other solid colors, halftones,
% and patterns).
-%
+%
% 6. Source transparency true and false.
-%
+%
% 7. Texture transparency true and false.
-%
+%
% 8. Different RasterOp values.
-%
+%
% 9. For ImageType 4, different color keys (out-of-range, specific
% color other than white, range without white).
-%
+%
% 10. String, file, and procedure data sources; for multi-component
% color spaces, MultipleDataSources = true. This is tested by
% constructing string data sources that are used as input to
% SubFileDecode filter to create a filetype data source. These
-% filters are read into scratch strings for the procedure data
+% filters are read into scratch strings for the procedure data
% source case. The procedure data source scratch string length
% does not match the raster width, and the width x height is
% not an integer multiple of the string length.
@@ -75,7 +75,7 @@
/WidthRGB 83 def
/HeightRGB 89 def
-%
+%
% 11. Banded and non-banded rendering. This can be tested by running
% test files throuch with different page device parameters to
% force banding vs. page mode.
@@ -84,23 +84,23 @@
%
% Testing the RasterOp-related functions (5/6/7/8) is not necessary at this
% time. They are well isolated logically.
-%
+%
% Testing orientation (1) and color masking (9) would be a good idea at some
% point, because this code has broken many times in the past and has had a
% long bug tail.
-%
+%
% The really important things to test are 2 (image type), 3/4 (color space --
% but only with regard to number of components, plus DeviceN and simple masks
% with a Pattern, which exercise special control paths), 10 (data source),
% and 11 (banding modes).
-%
+%
% ==========================================================================
%
% Procedure to generate test mask data
%
% WM and HM must be defined prior to invocation
-% MaskGen -
+% MaskGen -
%
% The mask data is stored into a string named /MaskData
%
@@ -118,23 +118,23 @@
/Y exch def
0 1 WB 1 sub {
/B exch def % byte within the row
- /C B Y WB mul add def
+ /C B Y WB mul add def
/P 0 def
0 1 7 {
- /b exch def % bit within the character
- /X b B 8 mul add def
- X WM lt
- { X Y eq
- X HM 1 sub Y sub eq or
- Y Y0 gt X X0 sub abs 2 le and or
- X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or
- }
- { true } % pad bits are always set
- ifelse
- % stack: true if pixel is set
- {
- MB b get P or /P exch def
- } if
+ /b exch def % bit within the character
+ /X b B 8 mul add def
+ X WM lt
+ { X Y eq
+ X HM 1 sub Y sub eq or
+ Y Y0 gt X X0 sub abs 2 le and or
+ X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or
+ }
+ { true } % pad bits are always set
+ ifelse
+ % stack: true if pixel is set
+ {
+ MB b get P or /P exch def
+ } if
} for % Bits within a byte
MaskData C P put
} for % Bytes within the row
@@ -143,7 +143,7 @@
%
% WM and HM must be defined prior to invocation
-% BPC MaskGenBPC -
+% BPC MaskGenBPC -
%
% The mask data is stored into a string named /MaskData
%
@@ -168,9 +168,9 @@
X BPC mul 8 div Y WB mul add exch
[
{ } % BPC = 0
- { { 1 } { 0 } ifelse put4bit } % BPC = 4
- { { 255 } { 0 } ifelse exch cvi exch put } % BPC = 8
- { { 1 } { 0 } ifelse put12bit } % BPC = 12
+ { { 1 } { 0 } ifelse put4bit } % BPC = 4
+ { { 255 } { 0 } ifelse exch cvi exch put } % BPC = 8
+ { { 1 } { 0 } ifelse put12bit } % BPC = 12
] BPC 4 div cvi get exec
} for
} for % Rows in the mask
@@ -221,7 +221,6 @@
grestore
} bind def
-
% -----------------------------------------------------------------------
%
% Procedures for ImageMatrix creation
@@ -292,7 +291,6 @@
grestore
} bind def
-
% YY, SX, SY, WD and HD should be defined prior to invocation
% X Y BPC matrix source multi decode MaskColor DoImage4 -
%
@@ -338,7 +336,7 @@
/DM exch def
/MS exch def
/S exch def % May be an array of sources - For InterleaveType 3
- % S[0] is the Mask DataSource
+ % S[0] is the Mask DataSource
/M exch def
/BPC exch def
/XX 1 index def
@@ -365,11 +363,11 @@
/Width WM
/Height HM
/ImageMatrix % construct the mask matrix using signs from the DataImage matrix
- /M0 M 0 get WD abs div cvi def
- /M3 M 3 get HD abs div cvi def
- /M4 M 4 get WD abs div cvi def
- /M5 M 5 get HD abs div cvi def
- [ WM M0 mul 0 0 HM M3 mul WM M4 mul HM M5 mul ]
+ /M0 M 0 get WD abs div cvi def
+ /M3 M 3 get HD abs div cvi def
+ /M4 M 4 get WD abs div cvi def
+ /M5 M 5 get HD abs div cvi def
+ [ WM M0 mul 0 0 HM M3 mul WM M4 mul HM M5 mul ]
IT 3 eq {
/DataSource S 0 get exec % DataSource only allowed for InterleaveType 3
} if
@@ -387,7 +385,6 @@
grestore
} bind def
-
% -----------------------------------------------------------------------
%
/Helvetica-Bold findfont 20 scalefont /TitleFont exch def
@@ -447,7 +444,7 @@
% 0 to 4095 (12 bit)
/put4bit {
- 15 mul cvi
+ 15 mul cvi
exch dup cvi dup 3 1 roll eq 3 -1 roll exch
{ % integer index means high nibble.
16 mul put
@@ -461,7 +458,7 @@
/put12bit {
1 index cvi /I exch def
2 index /S exch def
- 4095 mul cvi
+ 4095 mul cvi
exch dup dup cvi eq
{ % integer index means high byte is aligned
cvi exch 3 copy 16 div cvi put
@@ -483,7 +480,7 @@
/sM WidthRGB 2 mul 1 sub string def % long enough to hold more than one mask line
/sD WidthRGB 7 mul 1 sub string def % long enough to hold more than one 12 bit RGB line
- % worst case is 12bit ImageType3 InterleaveType 1 == 48 bits
+ % worst case is 12bit ImageType3 InterleaveType 1 == 48 bits
/MaskDProc {
/FM MaskData dup length () /SubFileDecode filter def
@@ -500,7 +497,7 @@
} bind def
/MaskDFile {
- MaskData dup length () /SubFileDecode filter
+ MaskData dup length () /SubFileDecode filter
/MDF 1 index def
} bind def
@@ -510,7 +507,7 @@
} bind def
/RGBDFile {
- RGBData dup length () /SubFileDecode filter
+ RGBData dup length () /SubFileDecode filter
/RGBDF 1 index def
} bind def
@@ -534,29 +531,29 @@
} bind def
/RDFile {
- RData dup length () /SubFileDecode filter
+ RData dup length () /SubFileDecode filter
/RDF 1 index def
} bind def
/GDFile {
- GData dup length () /SubFileDecode filter
+ GData dup length () /SubFileDecode filter
/GDF 1 index def
} bind def
/BDFile {
- BData dup length () /SubFileDecode filter
+ BData dup length () /SubFileDecode filter
/BDF 1 index def
} bind def
% -----------------------------------------------------------------------
-%
+%
% Procedure to handle fileposition. Ghostscript has a private
% operator .fileposition that works when fileposition does not
-%
+%
% <file> tryfilepos
% Returns: fileposition true if successful
% 0 false if not
-/tryfilepos {
+/tryfilepos {
/.fileposition where
{ pop /.fileposition load } % most likely to succeed
{ /fileposition load }
@@ -568,7 +565,7 @@
} bind def
% -----------------------------------------------------------------------
-%
+%
% Procedure to provide =only operator if not present. Suggested
% by Alex Cherepanov to use =print operator present on some Adobe
% implementations.
@@ -580,12 +577,12 @@
ifelse
% -----------------------------------------------------------------------
-%
+%
% Procedure to make sure that the file is at the EOF.
% added above (string == FileTailString.
%
% If not, it will mark the image area with a red "F"
-%
+%
% <string> <title> <file> CheckFileTail - XX is the horizontal position
% YY is the vertical position
% SX,SY determine size of "F" if fail
@@ -635,10 +632,10 @@ ifelse
200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
170 720 moveto (Colorspace = ) show CSpaceName show
LegendFont setfont
-
+
.4 .1 .7 setrgbcolor % contrasting color for stencil masking
/SX SX 2 mul def /SY SY 2 mul def
- /YY 780 SY sub def
+ /YY 780 SY sub def
MaskGen
TX IMLRTB MaskData [1 0] DoImageMask
@@ -648,8 +645,8 @@ ifelse
dup 2 index 1 add G 255 mul cvi put
exch 2 add B 255 mul cvi put
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
/SX SX 2 div def /SY SY 2 div def
@@ -661,8 +658,8 @@ ifelse
% Type 1 and Type 4 Tests
% /CSpace and /IR are defined in order to generate various pages
-/T1T4Tests { %
-
+/T1T4Tests { %
+
% Use an unusual (unpleasant?) underlying color
.6 .95 .4 setrgbcolor clippath fill
0 0 0 setrgbcolor
@@ -683,13 +680,13 @@ ifelse
XH BY moveto ( Multi\nDS=string) blockshow
XI BY moveto ( Multi\nDS=proc) blockshow
XJ BY moveto ( Multi\nDS=file) blockshow
-
+
.4 .1 .7 setrgbcolor % contrasting color for stencil masking
-
+
/WM WD def
/HM HD def
/SX SX 2 mul def /SY SY 2 mul def
- /YY 780 SY sub def
+ /YY 780 SY sub def
MaskGen
TX IMLRTB MaskData [1 0] DoImageMask
@@ -699,20 +696,20 @@ ifelse
dup 2 index 1 add G 255 mul cvi put
exch 2 add B 255 mul cvi put
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
/SX SX 2 div def /SY SY 2 div def
-
+
% ----------------------------------------------------------------------
% Type 1 Stencil Mask Images
-
+
/YY YA def
TX YA SY add moveto (\nType 1\nStencil\nMask) blockshow
-
+
MaskGen
- % X matrix source decode
+ % X matrix source decode
XA IMLRTB MaskData [0 1] DoImageMask
XB IMLRTB MaskData [1 0] DoImageMask
XC IMLRBT MaskData [1 0] DoImageMask
@@ -721,21 +718,21 @@ ifelse
XF IMLRTB MaskDProc [1 0] DoImageMask
XG IMLRTB MaskDFile [1 0] DoImageMask
MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Single Data Sources, BPC==8
-
+
/YY YB def
TX YY SY add moveto (\nType 1\nRGB\nBPC=8) blockshow
-
+
/RGBData WD HD mul 3 mul string def
{ X Y WD mul add 3 mul RGBData
dup 2 index R 255 mul cvi put
dup 2 index 1 add G 255 mul cvi put
exch 2 add B 255 mul cvi put
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XA 8 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
XB 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
XC 8 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
@@ -744,35 +741,34 @@ ifelse
XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Multiple Data Sources, BPC==8
-
+
WD HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- { X Y WD mul add
+ /BData exch string def
+ { X Y WD mul add
RData 1 index R 255 mul cvi put
GData 1 index G 255 mul cvi put
BData exch B 255 mul cvi put
} ImageGen
-
- % X BPC matrix source multi decode
+ % X BPC matrix source multi decode
XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==8, mask black
-
+
/YY YE def
TX YY SY add moveto (\nType 4\nBPC=8\nmask=black) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 000 000 000 ] DoImage4
XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
@@ -781,25 +777,25 @@ ifelse
XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==8, mask black
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==8, mask white
-
+
/YY YF def
TX YY SY add moveto (\nType 4\nBPC=8\nmask=white) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 255 255 255 ] DoImage4
gsave .5 .2 .2 setrgbcolor XB YY SX 13 mul SY rectfill grestore
XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
@@ -809,25 +805,25 @@ ifelse
XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==8, mask white
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==8, mask gray
-
+
/YY YG def
TX YY SY add moveto (\nType 4\nBPC=8\nmask=gray) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 147 147 147 ] DoImage4
XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
@@ -836,25 +832,25 @@ ifelse
XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==8, mask gray
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==8, mask range
-
+
/YY YH def
TX YY SY add moveto (\nType 4\nBPC=8\nmask range) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 020 200 020 200 020 200 ] DoImage4
XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
@@ -863,33 +859,33 @@ ifelse
XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==8, mask range
-
- % X Y SX SY BPC matrix source multi decode MaskColor
+
+ % X Y SX SY BPC matrix source multi decode MaskColor
XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Single Data Sources, BPC==12
-
+
/YY YC def
TX YY SY add moveto (\nType 1\nRGB\nBPC=12) blockshow
-
+
/RGBData WD 36 mul 7 add 8 div cvi HD mul string def
- {
+ {
X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add
RGBData 1 index R put12bit
RGBData 1 index 1.5 add G put12bit
RGBData exch 3 add B put12bit
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XA 12 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
XB 12 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
XC 12 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
@@ -898,35 +894,35 @@ ifelse
XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Multiple Data Sources, BPC==12
-
+
WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
RData 1 index R put12bit
GData 1 index G put12bit
BData exch B put12bit
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==12, mask range
-
+
/YY YI def
TX YY SY add moveto (\nType 4\nBPC=12\nmask range) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 12 IMLRTB RGBData false [1 0 1 0 1 0] [ 300 3000 300 3000 300 3000 ] DoImage4
XB 12 IMLRTB RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
XC 12 IMLRBT RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
@@ -935,33 +931,33 @@ ifelse
XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==12, mask range
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Single Data Sources, BPC==4
-
+
/YY YD def
TX YY SY add moveto (\nType 1\nRGB\nBPC=4) blockshow
-
+
/RGBData WD 12 mul 7 add 8 div cvi HD mul string def
- {
+ {
X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add
RGBData 1 index R put4bit
RGBData 1 index 0.5 add G put4bit
RGBData exch 1.0 add B put4bit
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XA 4 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
XB 4 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
XC 4 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
@@ -970,35 +966,35 @@ ifelse
XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 1 RGB Multiple Data Sources, BPC==4
-
+
WD 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 2 div Y WD 1 add 2 div cvi mul add
RData 1 index R put4bit
GData 1 index G put4bit
BData exch B put4bit
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Single Data Sources, BPC==4, mask range
-
+
/YY YJ def
TX YY SY add moveto (\nType 4\nBPC=4\nmask range) blockshow
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XA 4 IMLRTB RGBData false [1 0 1 0 1 0] [ 1 10 1 10 1 10 ] DoImage4
XB 4 IMLRTB RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
XC 4 IMLRBT RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
@@ -1007,20 +1003,20 @@ ifelse
XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% Type 4 RGB Multiple Data Sources, BPC==4, mask range
-
- % X BPC matrix source multi decode MaskColor
+
+ % X BPC matrix source multi decode MaskColor
XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
showpage
-
+
} bind def % T1T4Tests
% -----------------------------------------------------------------------
@@ -1037,13 +1033,13 @@ ifelse
200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
170 720 moveto (Colorspace = ) show CSpaceName show
LegendFont setfont
-
+
.4 .1 .7 setrgbcolor % contrasting color for stencil masking
/WM WD def
/HM HD def
/SX SX 2 mul def /SY SY 2 mul def
- /YY 780 SY sub def
+ /YY 780 SY sub def
MaskGen
XA IMLRTB MaskData [1 0] DoImageMask
@@ -1053,17 +1049,17 @@ ifelse
dup 2 index 1 add G 255 mul cvi put
exch 2 add B 255 mul cvi put
} ImageGen
-
- % X BPC matrix source multi decode
+
+ % X BPC matrix source multi decode
XH 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
/SX SX 2 div def /SY SY 2 div def
-
+
% ----------------------------------------------------------------------
% InterleaveType 1, BPC==8, WM=WD, HM=HD
% IT 1 is what GS calls "chunky pixel"
/YY YA def
TX YY SY add moveto (\nIntType 1\nBPC=8) blockshow
-
+
% Generate the MaskData first
8 MaskGenBPC
@@ -1089,13 +1085,13 @@ ifelse
XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 1, BPC==12, WM=WD, HM=HD
% IT 1 is what GS calls "chunky pixel"
/YY YB def
TX YY SY add moveto (\nIntType 1\nBPC=12) blockshow
-
+
% Generate the MaskData first
12 MaskGenBPC
@@ -1103,11 +1099,11 @@ ifelse
/RGBData WD HD mul 6 mul string def
{ X Y WD mul add 6 mul % 6 bytes Mask,Red,Green,Blue
RGBData
- dup 2 index
- MaskData X 1.5 mul .5 add cvi
- Y WB mul add get % get the aligned mask byte (hi or lo)
- 0 eq { 0 } { 1 } ifelse
- put12bit
+ dup 2 index
+ MaskData X 1.5 mul .5 add cvi
+ Y WB mul add get % get the aligned mask byte (hi or lo)
+ 0 eq { 0 } { 1 } ifelse
+ put12bit
dup 2 index 1.5 add R put12bit
dup 2 index 3.0 add G put12bit
exch 4.5 add B put12bit
@@ -1125,13 +1121,13 @@ ifelse
XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 1, BPC==4, WM=WD, HM=HD
% IT 1 is what GS calls "chunky pixel"
/YY YC def
TX YY SY add moveto (\nIntType 1\nBPC=4) blockshow
-
+
% Generate the MaskData first
4 MaskGenBPC
@@ -1140,8 +1136,8 @@ ifelse
{ X Y WD mul add 2 mul % 2 bytes Mask,Red,Green,Blue
RGBData
dup 2 index MaskData X 2 div cvi Y WB mul add get
- X 1 and 0 eq { 128 div cvi } { 1 and } ifelse
- put4bit
+ X 1 and 0 eq { 128 div cvi } { 1 and } ifelse
+ put4bit
dup 2 index 0.5 add R put4bit
dup 2 index 1.0 add G put4bit
exch 1.5 add B put4bit
@@ -1159,14 +1155,14 @@ ifelse
XH 4 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
XI 4 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 2, BPC==8, WM=WD, HM=HD
% IT 2 is line interleave -- Mask line follwoed by Data line
% RGB Image Data must be chunky (MultipleDatasources==false).
/YY YD def
TX YY SY add moveto (\nIntType 2\nBPC=8) blockshow
-
+
% Generate the MaskData first
MaskGen
@@ -1197,12 +1193,12 @@ ifelse
XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 2, BPC==12, WM=WD, HM=HD
/YY YE def
TX YY SY add moveto (\nIntType 2\nBPC=12) blockshow
-
+
% Generate the Data Image (uses the MaskData)
/BPL WD 36 mul 7 add 8 div cvi WB add def % BytesPerLine
/RGBData BPL HD mul string def
@@ -1230,12 +1226,12 @@ ifelse
XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 2, BPC==4, WM=WD, HM=HD
/YY YF def
TX YY SY add moveto (\nIntType 2\nBPC=4) blockshow
-
+
% Generate the Data Image (uses the MaskData)
/BPL WD 12 mul 7 add 8 div cvi WB add def % BytesPerLine
/RGBData BPL HD mul string def
@@ -1270,7 +1266,7 @@ ifelse
% RGB Image Data must be chunky (MultipleDatasources==false).
/YY YG def
TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=.6*WD\nHM=HD/2) blockshow
-
+
% Generate the MaskData first
/WM WD .6 mul cvi def
/HM HD 2 div cvi def
@@ -1297,7 +1293,7 @@ ifelse
%DEBUG /xx (xx) (w) file def
%DEBUG 0 1 HM 1 sub { MaskData exch WB mul WB getinterval xx exch writehexstring xx (\n) writestring } for
%DEBUG xx (----------------------------------------------------------------\n) writestring
-%DEBUG 0 2 HD 1 sub {
+%DEBUG 0 2 HD 1 sub {
%DEBUG RGBData 1 index BPL mul 2 index 2 div cvi WB mul add
%DEBUG WB getinterval xx exch writehexstring xx (\n) writestring
%DEBUG RGBData 1 index BPL mul 2 index 2 div cvi 1 add WB mul add
@@ -1328,7 +1324,7 @@ ifelse
% RGB Image Data must be chunky (MultipleDatasources==false).
/YY YH def
TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=1.3*WD\nHM=2*HD) blockshow
-
+
% Generate the MaskData first
/WM WD 1.3 mul cvi def
/HM HD 2 mul def
@@ -1366,7 +1362,7 @@ ifelse
% InterleaveType 2, BPC==12, WM=1.3*WD, HM=2*HD
/YY YI def
TX YY SY add moveto (\nIntType 2\nBPC=12\nWM=1.3*WD\nHM=2*HD) blockshow
-
+
% Generate the Data Image (uses the MaskData)
/HR HM HD div cvi def
/BPL WD 36 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine
@@ -1395,12 +1391,12 @@ ifelse
XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 2, BPC==4, WM=1.3*WD, HM=2*HD
/YY YJ def
TX YY SY add moveto (\nIntType 2\nBPC=4\nWM=1.3*WD\nHM=2*HD) blockshow
-
+
% Generate the Data Image (uses the MaskData)
/HR HM HD div cvi def
/BPL WD 12 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine
@@ -1452,7 +1448,7 @@ ifelse
% RGB Image Data chunky (MultipleDatasources==false).
/YY YA def
TX YY SY add moveto (BPC=8\nMulti\nfalse) blockshow
-
+
% Generate the MaskData first
/WM WD def
/HM HD def
@@ -1478,20 +1474,20 @@ ifelse
XI 8 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==12, WM=WD, HM=HD
/YY YB def
TX YY SY add moveto (BPC=12\nMulti\nfalse) blockshow
-
+
/RGBData WD 36 mul 7 add 8 div cvi HD mul string def
- {
+ {
X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add
RGBData 1 index R put12bit
RGBData 1 index 1.5 add G put12bit
RGBData exch 3 add B put12bit
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 12 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 12 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1504,20 +1500,20 @@ ifelse
XI 12 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==4, WM=WD, HM=HD
/YY YC def
TX YY SY add moveto (BPC=4\nMulti\nfalse) blockshow
-
+
/RGBData WD 12 mul 7 add 8 div cvi HD mul string def
- {
+ {
X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add
RGBData 1 index R put4bit
RGBData 1 index 0.5 add G put4bit
RGBData exch 1.0 add B put4bit
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 4 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 4 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1530,27 +1526,27 @@ ifelse
XI 4 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==8, WM=WD, HM=HD
% IT 3 is line interleave -- Mask and Data in separate sources
% RGB Image Data seprate (MultipleDatasources==true).
/YY YA def
TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
-
+
% Generate the MaskData first
MaskGen
% Generate the Data Image
WD HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- { X Y WD mul add
+ /BData exch string def
+ { X Y WD mul add
RData 1 index R 255 mul cvi put
GData 1 index G 255 mul cvi put
BData exch B 255 mul cvi put
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1565,7 +1561,6 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==8, WM=WD, HM=HD
@@ -1573,20 +1568,20 @@ ifelse
% RGB Image Data seprate (MultipleDatasources==true).
/YY YD def
TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
-
+
% Generate the MaskData first
MaskGen
% Generate the Data Image
WD HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- { X Y WD mul add
+ /BData exch string def
+ { X Y WD mul add
RData 1 index R 255 mul cvi put
GData 1 index G 255 mul cvi put
BData exch B 255 mul cvi put
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1601,22 +1596,22 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==12, WM=WD, HM=HD
/YY YE def
TX YY SY add moveto (BPC=12\nMulti\ntrue) blockshow
-
+
WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
RData 1 index R put12bit
GData 1 index G put12bit
BData exch B put12bit
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1631,23 +1626,22 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==4, WM=WD, HM=HD
/YY YF def
TX YY SY add moveto (BPC=4\nMulti\ntrue) blockshow
-
+
WD 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 2 div Y WD 1 add 2 div cvi mul add
RData 1 index R put4bit
GData 1 index G put4bit
BData exch B put4bit
} ImageGen
-
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1662,7 +1656,7 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==8, WM=.9*WD, HM=1.1*HD
% IT 3 is line interleave -- Mask and Data in separate sources
@@ -1678,13 +1672,13 @@ ifelse
% Generate the Data Image
WD HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- { X Y WD mul add
+ /BData exch string def
+ { X Y WD mul add
RData 1 index R 255 mul cvi put
GData 1 index G 255 mul cvi put
BData exch B 255 mul cvi put
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1699,22 +1693,22 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==12, WM=WD, HM=HD
/YY YI def
TX YY SY add moveto (BPC=12\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
-
+
WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
RData 1 index R put12bit
GData 1 index G put12bit
BData exch B put12bit
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1729,23 +1723,22 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==4, WM=WD, HM=HD
/YY YJ def
TX YY SY add moveto (BPC=4\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
-
+
WD 1 add 2 div cvi HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- {
+ /BData exch string def
+ {
X 2 div Y WD 1 add 2 div cvi mul add
RData 1 index R put4bit
GData 1 index G put4bit
BData exch B put4bit
} ImageGen
-
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1760,7 +1753,7 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
% ----------------------------------------------------------------------
% InterleaveType 3, BPC==8, WM=1.1*WD, HM=.9*HD
% IT 3 is line interleave -- Mask and Data in separate sources
@@ -1776,13 +1769,13 @@ ifelse
% Generate the Data Image
WD HD mul /RData 1 index string def
/GData 1 index string def
- /BData exch string def
- { X Y WD mul add
+ /BData exch string def
+ { X Y WD mul add
RData 1 index R 255 mul cvi put
GData 1 index G 255 mul cvi put
BData exch B 255 mul cvi put
} ImageGen
-
+
% X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
@@ -1797,11 +1790,10 @@ ifelse
RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
-
+
showpage
} bind def % T3Tests
-
% ----------------------------------------------------------------------
% Do the various rotations
%
diff --git a/gs/lib/impath.ps b/gs/lib/impath.ps
index 3e11a790f..5ecf0ab9b 100644
--- a/gs/lib/impath.ps
+++ b/gs/lib/impath.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -92,8 +92,8 @@ begin
{ % Convert curve to relative form
x y 3
{ exch neg 7 index add rc
- exch neg 6 index add rc
- 8 -2 roll
+ exch neg 6 index add rc
+ 8 -2 roll
}
repeat /y exch def /x exch def
1 index 0 eq 5 index 0 eq and % dy1=dx3=0, hv
@@ -101,10 +101,10 @@ begin
}
{ dup 0 eq 6 index 0 eq and % dx1=dy3=0, vh
{ 6 -1 roll pop pop /vhcurveto
- }
- { /rrcurveto % none of the above
- }
- ifelse
+ }
+ { /rrcurveto % none of the above
+ }
+ ifelse
}
ifelse
}
@@ -117,7 +117,7 @@ end % type1imagepath_dict
% The main program
/type1imagepath % image width height wx wy ox oy string ->
- % substring
+ % substring
{ type1imagepath_dict begin
/tsave save def
/ostring exch def
diff --git a/gs/lib/jispaper.ps b/gs/lib/jispaper.ps
index 19c14a716..e524d8c8e 100644
--- a/gs/lib/jispaper.ps
+++ b/gs/lib/jispaper.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/landscap.ps b/gs/lib/landscap.ps
index b6d61d5fd..6d8aff8dc 100644
--- a/gs/lib/landscap.ps
+++ b/gs/lib/landscap.ps
@@ -1,17 +1,17 @@
%!
% landscap.ps
%
-% This file can be prepended to most PostScript pages to force
+% This file can be prepended to most PostScript pages to force
% rotation to "landscape" mode.
%
% There are (at least) four possible ways to reasonably position a
% page after rotation. Any of the four old corners (llx,lly e.g.)
% can be moved to match the corresonding new corner.
-% By uncommmenting the appropriate line below (i.e., remove the
+% By uncommmenting the appropriate line below (i.e., remove the
% leading '%'), any such positioning can be chosen for positive or
% negative rotation. The comments at the end of each "rotate" line
% indicate the ORIGINAL corner to be aligned. For example, as given
-% below, the lower left hand corner is aligned. When viewed, this
+% below, the lower left hand corner is aligned. When viewed, this
% corner will have moved to the urx,lly corner.
%
% originally by James E. Burns, 3/8/93, burns@nova.bellcore.com
diff --git a/gs/lib/lines.ps b/gs/lib/lines.ps
index 8cd53d150..bf05136f3 100644
--- a/gs/lib/lines.ps
+++ b/gs/lib/lines.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1989, 1990, 1992, 1994, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -55,14 +55,14 @@ gsave
{0 1 2} % line join
{ setlinejoin gsave
{ {currentpoint lineto}
- {3 7 lineto}
- {3 7 lineto 5 1 lineto}
- {3 7 lineto 6 3 lineto closepath}
+ {3 7 lineto}
+ {3 7 lineto 5 1 lineto}
+ {3 7 lineto 6 3 lineto closepath}
}
{ gsave 0 0 moveto exec
gsave stroke grestore
- 0.5 setlinewidth 1 0 0 setrgbcolor stroke
- grestore 8 0 translate
+ 0.5 setlinewidth 1 0 0 setrgbcolor stroke
+ grestore 8 0 translate
} forall
grestore 35 0 translate
} forall
@@ -141,7 +141,7 @@ gsave
{ newpath gsave
gsave 0.5 setgray 0 0 rad 0 360 arc stroke grestore
0 90 359
- { rotate
+ { rotate
0 3 14 { ray } for
15 15 89 { ray } for
} for
diff --git a/gs/lib/markhint.ps b/gs/lib/markhint.ps
index 1dc286306..f764c93e9 100644
--- a/gs/lib/markhint.ps
+++ b/gs/lib/markhint.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -83,9 +83,9 @@
/callothersubr
{ 3 eq
{ pop
- mhprint { (replace) = } if
- % We're replacing hints; lighten the color.
- currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
+ mhprint { (replace) = } if
+ % We're replacing hints; lighten the color.
+ currentrgbcolor 3 { 2 mul 3 div 3 1 roll } repeat setrgbcolor
}
{ { pop } repeat
} ifelse
diff --git a/gs/lib/markpath.ps b/gs/lib/markpath.ps
index cb34b2b6b..a218211a4 100644
--- a/gs/lib/markpath.ps
+++ b/gs/lib/markpath.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -50,7 +50,7 @@
} def
/markpath % <matrix> markpath -
- { /mpmx exch def
+ { /mpmx exch def
gsave initgraphics 9 dup dtransform grestore
/epsy exch def /epsx exch def
gsave 0 setlinewidth
diff --git a/gs/lib/mkcidfm.ps b/gs/lib/mkcidfm.ps
index 59a2c7d0a..2a54a4620 100644
--- a/gs/lib/mkcidfm.ps
+++ b/gs/lib/mkcidfm.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2004 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -15,9 +15,9 @@
% $Id$
-% Generate a cidfmap file for substituting CID fonts with TrueType
+% Generate a cidfmap file for substituting CID fonts with TrueType
% fonts, based on fonts found in the directory FONTDIR.
-%
+%
% The directory FONTDIR is searched for fonts whose filename
% matches a Path in the cidsubs dictionary.
% Any matches are written out as a CID font substitution.
@@ -26,20 +26,19 @@
% write out each alias that matches a substituted font.
% Where multiple aliases are possible, use the first match.
%
-% Note that the substitutions and aliases in this file were created
-% by someone who doesn't understand Chinese, Japanese or Korean.
+% Note that the substitutions and aliases in this file were created
+% by someone who doesn't understand Chinese, Japanese or Korean.
% The initial list contains only font files found in Windows XP.
% Please submit corrections and additions.
%
% See the end of file for references and further information.
%
-% Font filenames must match case.
+% Font filenames must match case.
% All font filenames are currently lower case.
%
% Usage: gswin32c -q -dBATCH -sFONTDIR=c:/windows/fonts
% -sCIDFMAP=c:/gs/cidfmap mkcidfm.ps
-
systemdict /FONTDIR known not { /FONTDIR (c:/windows/fonts) def } if
systemdict /CIDFMAP known { CIDFMAP } { (%stdout) } ifelse
@@ -93,10 +92,9 @@ systemdict /CIDFMAP known { CIDFMAP } { (%stdout) } ifelse
>>
def
-
% This dictionary contains a list of CID substitutions
% Many ttc's have an older ttf version - be sure to put the ttf entries later.
-/cidsubs
+/cidsubs
<<
% Simplified Chinese
/SimHei
@@ -539,7 +537,6 @@ def
>>
def
-
% A dictionary for storing the names and paths of found fonts
/foundfonts 50 dict def
@@ -570,7 +567,7 @@ def
} for
} def
-% Check if a font basename matches one of the possible cid substitutions.
+% Check if a font basename matches one of the possible cid substitutions.
% If it does, add the font and full path to the foundfonts dictionary
/checkfont {
dup basename
@@ -600,19 +597,18 @@ def
/checkfont load 256 string filenameforall
} def
-
% Write out a cid substition, using the full font path
% name is the font name, e.g. /MS-Mincho
% path is the full path to the font file, e.g. (c:\windows\fonts\msmincho.ttc)
% subs is the dictionary for CID font substition, from cidsubs
-/emitsubs { % name path subs --
+/emitsubs { % name path subs --
3 -1 roll cidfmap exch write==only % name
cidfmap ( << ) writestring
% path subs
{
1 index /Path eq {pop 1 index} if % use full path, not basename
- exch cidfmap exch write==only cidfmap ( ) writestring
- cidfmap exch write==only cidfmap ( ) writestring
+ exch cidfmap exch write==only cidfmap ( ) writestring
+ cidfmap exch write==only cidfmap ( ) writestring
} forall
cidfmap (>> ;\n) writestring
pop
@@ -639,19 +635,19 @@ def
% Write out aliases for which the cid substituted font exists.
/writealiases { % --
cidfmap (\n% Aliases\n) writestring
- fontaliases
+ fontaliases
{
% name aliasarray
{
% name alias
foundfonts 1 index known
{
- 1 index cidfmap exch write==only cidfmap ( ) writestring
- cidfmap exch write==only cidfmap ( ;\n) writestring
- exit % after first match
+ 1 index cidfmap exch write==only cidfmap ( ) writestring
+ cidfmap exch write==only cidfmap ( ;\n) writestring
+ exit % after first match
}
{
- pop % didn't find this name
+ pop % didn't find this name
}
ifelse
} forall
@@ -661,7 +657,6 @@ def
forall
} def
-
% Write out a new cidfmap file to stdout
/writecidfmap { % path --
cidfmap (%!\n% cidfmap generated automatically by mkcidfm.ps from fonts found in\n) writestring
@@ -672,7 +667,6 @@ def
writealiases
} def
-
FONTDIR writecidfmap
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/gs/lib/opdfread.ps b/gs/lib/opdfread.ps
index 2e0b0ec7b..8d4797a08 100644
--- a/gs/lib/opdfread.ps
+++ b/gs/lib/opdfread.ps
@@ -1,14 +1,14 @@
%!PS-Adobe-2.0
%
% Copyright (C) 2002 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -19,8 +19,8 @@
% pdfread.ps - A procset for interpreting an ordered PDF 1.3 file.
% This module defines routines for interpreting a PDF file with
-% a Postscript interpreter. To convert a PDF file into Postscript
-% just pre-contcatenate this file. The PDF file must satisfy
+% a Postscript interpreter. To convert a PDF file into Postscript
+% just pre-contcatenate this file. The PDF file must satisfy
% few constraints :
%
% 1. It must contain only Postscript level 2 objects encoded with
@@ -33,9 +33,9 @@
% 3. The PDF file must not include other PDF files.
% Consequently we have a single instance of the PDF reader.
% We use this fact to simplify binding of the routines.
-%
+%
% 4. The PDF root object must always have the object id 1.
-%
+%
% 5. Generations besides 0 are not allowed.
%
% 6. xref must appear after all objects.
@@ -49,7 +49,7 @@
%
% See if our notification from ps2write is present. If it is
% then pick it up. Otherwise define it as false. Used to prevent
-% use of setmatrix at start of each page. The DSC-compliant
+% use of setmatrix at start of each page. The DSC-compliant
% output from ps2write wraps pages in a save/restore, so we don't
% need the setmatrix, and it breaks use of psnup with the output.
%
@@ -98,7 +98,7 @@ errordict /handleerror
{ //this /ehsave known
{ clear //this /ehsave get restore 2 vmreclaim
} if
- vmstatus exch pop exch pop
+ vmstatus exch pop exch pop
}
/Courier 12 selectfont
{
@@ -113,7 +113,7 @@ errordict /handleerror
dup mark eq {
(-mark-) dup = show
} {
- dup type /nametype eq {
+ dup type /nametype eq {
dup xcheck not {
(/) show
(/) print
@@ -134,7 +134,6 @@ errordict /handleerror
end % A dictionary for local binding
-
50 dict begin
% ===================== Debugging =========================================
@@ -180,7 +179,7 @@ end % A dictionary for local binding
} for
() =
cleartomark
- % Assuming ....Undefined is never defined.
+ % Assuming ....Undefined is never defined.
% Use it to emit an error.
....Undefined
} bind def
@@ -189,7 +188,7 @@ end % A dictionary for local binding
//RotatePages //FitPages or //CenterPages or{
mark (/RotatePages, /FitPages and CenterPages are not allowed with /SetPageSize) //error exec
} if
-}
+}
{
//FitPages //CenterPages and {
mark (CenterPages is not allowed with /FitPages) //error exec
@@ -218,12 +217,12 @@ ifelse
/cpa2g { % <packedarray|array> cpa2g <packedarray|array>
dup length array % <src> <dest>
0 1 2 index length 1 sub {
- % <src> <dest> index
+ % <src> <dest> index
dup 3 index exch get cp2g
- % <src> <dest> index <globalelement>
+ % <src> <dest> index <globalelement>
3 copy put pop pop
} for
- exch pop
+ exch pop
} bind def
% Copy (recursive) dict to to global VM
@@ -238,15 +237,15 @@ ifelse
dup length string copy
} bind def
-/cp2gprocs
+/cp2gprocs
<< /arraytype //cpa2g /dicttype //cpd2g /packedarraytype //cpa2g /stringtype //cps2g >>
def
/cp2g { % <any> cp2g <any>
- % where <any> is array | dict | string | packedarray
- % NOTE: The object must be readable (not executeonly or noaccess)
+ % where <any> is array | dict | string | packedarray
+ % NOTE: The object must be readable (not executeonly or noaccess)
dup gcheck not {
- dup //cp2gprocs 1 index type
+ dup //cp2gprocs 1 index type
2 copy known {
get currentglobal 3 1 roll true setglobal exec exch setglobal
% set the attributes appropriately (we must have 'read' access to get this far)
@@ -308,7 +307,7 @@ currentdict end readonly def
/SimpleColorSpaceNames 15 dict begin
/DeviceGray true def
/DeviceRGB true def
- /DeviceCMYK true def
+ /DeviceCMYK true def
currentdict end readonly def
/1_24_bitshift_1_sub 1 24 bitshift 1 sub def
@@ -367,21 +366,21 @@ currentdict end readonly def
//PDFReader /ObjectRegistry get % id r
dup length % id r l
2 index le { % id r
- exch mark exch (Object ) exch ( isn't defined before needed (1).) //error exec
+ exch mark exch (Object ) exch ( isn't defined before needed (1).) //error exec
} if
1 index get % id e
dup xcheck {
- exch mark exch (Object ) exch ( isn't defined before needed (2).) //error exec
- } {
+ exch mark exch (Object ) exch ( isn't defined before needed (2).) //error exec
+ } {
dup null eq {
- exch mark exch (Object ) exch ( isn't defined before needed (3).) //error exec
+ exch mark exch (Object ) exch ( isn't defined before needed (3).) //error exec
} if
exch pop % e
} ifelse
} bind def
/StandardFontNames <<
- /Times-Roman true
+ /Times-Roman true
/Helvetica true
/Courier true
/Symbol true
@@ -423,8 +422,8 @@ currentdict end readonly def
} for
pop
FontDirectory length dict begin
- FontDirectory {
- pop
+ FontDirectory {
+ pop
dup //StandardFontNames exch known not {
dup null def
} if
@@ -460,13 +459,13 @@ currentdict end readonly def
exch mark exch (A referred object generation ) exch ( isn't 0.) //error exec
} if % id
[ % <id> proc <obj>
- exch //GetRegistered /exec load
+ exch //GetRegistered /exec load
] cvx
//PrintReference exec
} bind def
/IsObjRef % <any> IsObjRef <bool>
-{
+{
dup type /arraytype eq {
dup length 3 eq {
dup xcheck exch
@@ -481,7 +480,7 @@ currentdict end readonly def
} ifelse
} bind def
-/DoNothing
+/DoNothing
{
} def
@@ -610,15 +609,15 @@ currentdict end readonly def
1 dict dup /c 0 put exch % d f
1024 string % d f s
{ readstring pop % d s
- (StreamDumper ) print 1 index /c get =string cvs print ( ) print
+ (StreamDumper ) print 1 index /c get =string cvs print ( ) print
dup length =string cvs print ( <) print dup print (>\n) print
dup length % d s l
3 2 roll % s l d
dup /c get % s l d c
3 2 roll % s d c l
add /c exch put % s
- } /exec load
- ]
+ } /exec load
+ ]
cvx 0 () /SubFileDecode filter
exch setglobal
//PDFR_DEBUG {
@@ -689,11 +688,11 @@ currentdict end readonly def
//PDFR_DEBUG {
(ExecuteStream id = ) print 2 index =only ( Length = ) print dup =
} if
- //PDFReader /InitialGraphicState get
+ //PDFReader /InitialGraphicState get
//PDFReader /GraphicState get copy pop
//PDFReader /Operators get begin
% currentfile exch () /SubFileDecode filter % id obj file
- % We would like to use the code above,
+ % We would like to use the code above,
% but HP LaserJet 1320 continues parsing after the byte count exceeds.
pop currentfile 0 (endstream) /SubFileDecode filter % id obj file
1 index //AppendFilters exec
@@ -719,14 +718,14 @@ currentdict end readonly def
} bind def
/stream % <id> <obj> stream <id> <obj>
-{
+{
//PDFR_DEBUG {
1 index =only ( stream) =
} if % id obj
% Run the object definition daemon, if exists :
//PDFReader /ObjectRegistry get dup length 3 index % id obj r l id
gt { % id obj r
- 2 index get
+ 2 index get
dup xcheck {
exec
% Disable the daemon :
@@ -757,7 +756,7 @@ currentdict end readonly def
} bind def
/HookFont % <id> <obj> <font_descriptor> HookFont <id> <obj>
-{
+{
//PDFR_DEBUG {
(Loaded the font ) print dup /FontName get =
} if
@@ -766,15 +765,15 @@ currentdict end readonly def
% We assume that the Type 1 font has same name with no prefix
% due to pdfwrite specifics.
% We use it to find the font after it is defined.
- % We could redefine 'definefont' for hooking the font,
- % but we don't think that it could be guaranteedly portable :
- % a 3d party PS interpreter may set a special context
+ % We could redefine 'definefont' for hooking the font,
+ % but we don't think that it could be guaranteedly portable :
+ % a 3d party PS interpreter may set a special context
% when running the font file.
% Note that this mechanizm does not depend on the
% font name uniquity, because the last 'definefont'
% is only important.
dup /FontName get % id obj fd fn
- //PDFReader /RemoveFontNamePrefix get exec
+ //PDFReader /RemoveFontNamePrefix get exec
findfont % id obj fd g f
exit
} if
@@ -805,11 +804,11 @@ currentdict end readonly def
} bind def
/endstream % <id> <obj> endstream <id> <obj>
-{
+{
} bind def
/xref % - xref -
-{
+{
//PDFR_DEBUG {
(xref) =
//PDFR_DUMP {
@@ -886,7 +885,7 @@ currentdict end readonly def
} if
90 rotate
0 5 index neg translate
- 5 index 1 index exch sub 2 div
+ 5 index 1 index exch sub 2 div
2 index 6 index sub 2 div neg % bw bh px0 py0 pw ph lm bm
translate
} {
@@ -905,7 +904,7 @@ currentdict end readonly def
//PDFR_DEBUG {
(Ccentering page) ==
} if
- 1 index 6 index sub 2 div
+ 1 index 6 index sub 2 div
1 index 6 index sub 2 div % bw bh px0 py0 pw ph lm bm
translate
} {
@@ -917,7 +916,7 @@ currentdict end readonly def
pop dup scale % bw bh px0 py0 pw ph
} if
} ifelse
- } ifelse
+ } ifelse
pop pop % bw bh px0 py0
translate % bw bh
pop pop %
@@ -988,7 +987,7 @@ currentdict end readonly def
3 copy exch put % ... (..st\0t) 0 LEN_OF_(po..st)-2
getinterval % ... (..st), stored at begining of old (po..st)
(#) search not {
- pop exit % /namepdf (nameps\0..)
+ pop exit % /namepdf (nameps\0..)
} if
} loop
% we have a '\0' marker (not allowed in PDF names) after all usefull characters
@@ -1001,7 +1000,7 @@ currentdict end readonly def
} bind def
/TypeDaemons << % <id> <obj> proc <id> <obj>
- /Page
+ /Page
{ //PDFR_DEBUG {
(Recognized a page.) =
} if
@@ -1020,9 +1019,9 @@ currentdict end readonly def
(Recognized a font descriptor.) =
} if
dup /FontName //knownget exec {
- 1 index /FontName 3 -1 roll //UnPDFEscape exec put
+ 1 index /FontName 3 -1 roll //UnPDFEscape exec put
} if
- dup dup /FontFile known {/FontFile} {/FontFile2} ifelse
+ dup dup /FontFile known {/FontFile} {/FontFile2} ifelse
//knownget exec { % id obj ff
0 get //DoNothing exch % id obj dn id1
[ % <id> <obj> proc <id> <obj>
@@ -1073,7 +1072,7 @@ currentdict end readonly def
/MakeStreamReader % <obj> MakeStreamReader <file>
{ dup
- [
+ [
exch
//PDFR_DEBUG {
(Stream proc )
@@ -1085,19 +1084,19 @@ currentdict end readonly def
} if
1 dict dup /i -1 put
/dup load
- /i
+ /i
/get load
1
/add load
/dup load
- 3
- 1
+ 3
+ 1
/roll load
/i
/exch load
/put load
//knownget
- /exec load
+ /exec load
/not load
{ () }
/if load
@@ -1171,17 +1170,17 @@ end
% for the glyf table, on glyph boundaries.
%
/.opdloadttfontdict 50 dict def
-.opdloadttfontdict begin
+.opdloadttfontdict begin
/maxstring 65400 def % less than the maximum length of a PostScript string,
% must be a multiple of 4 (for hmtx / loca / vmtx)
end
% Uses an insertion sort to sort the contents of an array,
-% the sorted array is returned. Takes the array to sort and a
+% the sorted array is returned. Takes the array to sort and a
% comparison procedure. The comparison procedure must take two
% arguments, and return a boolean. The return value should be
-% false if arguments incorrectly ordered, true if they are
+% false if arguments incorrectly ordered, true if they are
% already in the correct order.
%
% [Array to sort] {comparisaon proc} InsertionSort [Sorted array]
@@ -1204,7 +1203,7 @@ end
Value1 Value2 CompareProc {
exit
} if
-
+
Array Jx 1 add Value2 put
/Jx Jx 1 sub def
} loop
@@ -1229,7 +1228,7 @@ end
%
% Utility routines to read TrueType table data, returning
-% either a string or an array of strings depending on the
+% either a string or an array of strings depending on the
% table length.
%
@@ -1266,13 +1265,13 @@ end
% ReadTTF reads the tables and so on from a TreuType font into memory
% so that they are available for later processing.
%
-% <filename> ReadTTF -
+% <filename> ReadTTF -
%
/ReadTTF
{
.opdloadttfontdict begin
/TTFontFile exch def
-
+
% Table directory:
% version - fixed (4 bytes)
% numTables - USHORT (2 bytes)
@@ -1280,7 +1279,7 @@ end
% entrySelector - USHORT (2 bytes)
% Read Table
/TableDir TTFontFile 12 string readstring pop def
-
+
% There are numTables table directory entries:
% tag - ULONG (4 bytes)
% checkSum - ULONG (4 bytes)
@@ -1288,10 +1287,10 @@ end
% length - ULONG (4 bytes)
% Read entries
/tables TTFontFile TableDir 4 getu16 16 mul string readstring pop def
-
+
% Create dictionary to store directory entries.
/tabarray tables length 16 idiv array def
-
+
% Check version for TrueType collection
TableDir 0 4 getinterval (ttcf) eq {
QUIET not { (Can't handle TrueType font Collections.) = } if
@@ -1305,15 +1304,15 @@ end
tables exch 16 getinterval % index (string)
exch 16 div cvi exch % index/16 (string)
tabarray 3 1 roll put
- } for
+ } for
} ifelse
-
+
% We need the tables in the order they occur in the file, so sort
% by 'offset'.
tabarray { exch 8 getu32 exch 8 getu32 gt} .InsertionSort pop
% Now we read the content of each table in turn. If the table is < 64K
- % then we store it in a single string. If its more, we store it in an
+ % then we store it in a single string. If its more, we store it in an
% array of strings. The table contents are stored in 'tabs' in the same
% order as they are read from the file, as per the sorted array 'tabarray'.
/Read TableDir length tables length add def
@@ -1321,11 +1320,11 @@ end
tabarray {
% Get offset (from start of file) of next table
dup 8 getu32 % () offset
- % Subtract amount read so far
+ % Subtract amount read so far
Read sub % () offset-Read
dup 0 gt {
% Read and discard any extra padding bytes % () offset-Read
- dup string TTFontFile exch readstring pop pop % () offset-Read
+ dup string TTFontFile exch readstring pop pop % () offset-Read
% Update bytes read
Read add /Read exch def % ()
} {
@@ -1335,10 +1334,10 @@ end
12 getu32 % () tablelength
dup Read add % () tablelength tablelength+Read
/Read exch def % () tablelength
- TTFontFile exch .readbigtable
+ TTFontFile exch .readbigtable
} forall
] def
- end % .opdloadttfontdict
+ end % .opdloadttfontdict
} bind def
% GetLocaType finds the head table in tabarray, which gives
@@ -1355,7 +1354,7 @@ end
0 4 getinterval (head) eq{ % control-variable bool
tabs exch get % ()
50 gets16
- /LocaType exch def
+ /LocaType exch def
exit
} {
pop % control variable % -
@@ -1375,7 +1374,7 @@ end
% control-variable
dup tabarray exch get % control-variable ()
0 4 getinterval (maxp) eq{ % control-variable bool
- % Get the maxp string
+ % Get the maxp string
% from the tabs array
tabs exch get % ()
4 getu16 % int
@@ -1388,7 +1387,7 @@ end
} bind def
% StringtoLoca takes a string, and an index in to an array
-% where the loca results should be stored from. It reads
+% where the loca results should be stored from. It reads
% along the string getting either 2-byte or 4-byte values
% (depends on loca type) and stores them in the array at
% successive locations. Leaves the next unused location
@@ -1397,11 +1396,11 @@ end
% string ArrayIndex StringToLoca ArrayIndex
%
/StringToLoca
-{
+{
/LocaIndex exch def % ()
/StringOffset 0 def % ()
- {
- dup length StringOffset gt { % ()
+ {
+ dup length StringOffset gt { % ()
dup % ()
LocaType 1 eq{
StringOffset getu32 % () loca
@@ -1413,7 +1412,7 @@ end
dup % () loca
StringOffset getu16 % ()
LocaArray LocaIndex 3 -1 roll put % ()
- /LocaIndex LocaIndex 1 add def % ()
+ /LocaIndex LocaIndex 1 add def % ()
/StringOffset StringOffset 4 add % ()
def
} ifelse
@@ -1434,13 +1433,13 @@ end
/GetSortedLoca
{
NumGlyphs 1 add array /LocaArray exch def
-
+
% Get the loca table
0 1 tabarray length 1 sub{
% control-variable
dup tabarray exch get % control-variable ()
0 4 getinterval (loca) eq{ % control-variable bool
- % Get the loca string
+ % Get the loca string
% from the tabs array
tabs exch get % ()
exit
@@ -1461,7 +1460,7 @@ end
pop % final LocaArray index
}ifelse
- % Now we've read all the locations, sort them so
+ % Now we've read all the locations, sort them so
% we can figure out where to break the strings
LocaArray {gt} .InsertionSort pop
} bind def
@@ -1506,7 +1505,7 @@ end
/GetGlyfBytes
{
/ToRead exch def
-
+
% If we have no available data, get soem from the array of
% glyf strings
WorkBytes 0 eq {
@@ -1521,17 +1520,17 @@ end
ToRead string
% Get remaining stored bytes, and put at the start
% of the string
- dup
+ dup
% Start of string
- 0
+ 0
% Get remaining bytes
- WorkString 0 WorkBytes getinterval
+ WorkString 0 WorkBytes getinterval
% store at start of output string
putinterval
-
+
dup
- % Location in output to store data from next string
- WorkBytes
+ % Location in output to store data from next string
+ WorkBytes
% amout of data required to read from next string
ToRead WorkBytes sub
% Get the next string from the array of strings
@@ -1539,7 +1538,7 @@ end
% Get a string containing the required data, updating
% the internal data storage
GetWorkingBytes
- % put the data at the end of the stored data in the
+ % put the data at the end of the stored data in the
% output string
putinterval
} ifelse
@@ -1559,18 +1558,18 @@ end
/LastLoca 0 def
/NextLocaIndex 0 def
/LastLocaIndex 0 def
-
+
/GlyfStringIndex 0 def
/WorkString maxstring string def
/WorkBytes 0 def
-
+
% Find appropriate next loca
{
% Get location of next glyph
LocaArray NextLocaIndex get % int
% subtract location of last point to get
% the actual bytes between
- LastLoca sub maxstring gt % int bool
+ LastLoca sub maxstring gt % int bool
{
LocaArray LastLocaIndex get LastLoca sub
GetGlyfBytes % ()
@@ -1605,7 +1604,7 @@ end
} ifelse
} loop
DestArray
-
+
} bind def
% ProcessTTData looks at the data stored in the 'tabs' array and does several things:
@@ -1641,7 +1640,7 @@ end
} ifelse
}{
% table size > 64K, so this is an array of strings, not a string
- % We still need to make sure that the tables end on 4-byte
+ % We still need to make sure that the tables end on 4-byte
% boundaries.
dup 4 mod 0 ne {
% First we need to work out how many strings of size maxstring
@@ -1694,14 +1693,14 @@ end
} for
end % .opdloadttfontdict
} bind def
-
+
% Makesfnts uses the accumulated data to create an array of strings
% containing only the required data.
%
% - Makesfnts array
-%
+%
/Makesfnts
-{
+{
.opdloadttfontdict begin
% Determine size of sfnts array
% length of tabarray + header
@@ -1719,7 +1718,7 @@ end
} ifelse
} forall
- 1 add % add header and table directory
+ 1 add % add header and table directory
% to determine total # strings
% Need to recalculate the lengths of the TT
% tables, just in case any have changed. If required we
@@ -1730,7 +1729,7 @@ end
TableDir length % initial table offset is header length
tabarray length 16 mul add % + (NumTables * 16) bytes
def
-
+
0
tabarray { % index ()
exch dup 1 add % () index index+1
@@ -1740,7 +1739,7 @@ end
dup type /stringtype eq { % index+1 () index ()/[] bool
length % index+1 () index int
2 index exch % index+1 () index () int
- TTOffset
+ TTOffset
dup 3 1 roll add % add the running total of offsets
/TTOffset exch def % update running total of offsets
8 exch putu32 % index+1 () index
@@ -1756,7 +1755,7 @@ end
} ifelse
} forall %
2 index exch % index+1 () index () int
- TTOffset
+ TTOffset
dup 3 1 roll add % add the running total of offsets
/TTOffset exch def % update running total of offsets
8 exch putu32 % index+1 () index
@@ -1765,10 +1764,10 @@ end
} ifelse
} forall
pop % index+1
-
+
array % []
dup 0 % [] [] 0
- TableDir length
+ TableDir length
tables length add % [] [] 0 header_length
string % [] [] 0 ()
dup 0 TableDir putinterval % [] [] 0 ()
@@ -1812,13 +1811,13 @@ end
/Encoding get % fo fd e
} {
pop null
- } ifelse
+ } ifelse
/PDFEncoding exch def % fo fd
/CharStrings 2 index //PDFReader /MakeTTCharStrings get exec def
- /sfnts 2 index //MakeStreamReader exec
+ /sfnts 2 index //MakeStreamReader exec
ReadTTF
ProcessTTData
- Makesfnts
+ Makesfnts
def
/Encoding StandardEncoding def % A stub - will be replaced by font resource.
/PaintType 0 def
@@ -1829,7 +1828,7 @@ end
} bind def
/GetInstalledFont % <name> GetInstalledFont <font>
-{
+{
dup //InstalledFonts exch knownget { % n f
exch pop % f
} { % n
@@ -1924,7 +1923,7 @@ end
7 index exch get % fr E M s mw c0 W w n
dup null ne {
6 index 3 1 roll exch % fr E M s mw c0 W M n w
- 6 index div
+ 6 index div
3 copy pop //knownget exec {
0 eq
} {
@@ -2057,7 +2056,7 @@ end
} ifelse
exch % s f fr
dup /Encoding known not {
- 1 index /Encoding get 1 index exch /Encoding exch put
+ 1 index /Encoding get 1 index exch /Encoding exch put
} if
//ObtainEncoding exec
//ObtainMetrics exec
@@ -2070,25 +2069,25 @@ end
1 index /FontMatrix get 0 get
dup 0 eq {
% FontMatrix[0] == 0, so cannot downscale by it
- % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy
- pop
- 1 index /FontMatrix get 1 get
- dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics
+ % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy
+ pop
+ 1 index /FontMatrix get 1 get
+ dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics
} if
0.001 div
//ScaleMetrics exec
}{
- % Check if we got a /sfnts key in the dict
+ % Check if we got a /sfnts key in the dict
% If we did then we are probably OK (TT font from GS)
1 index /sfnts known not {
% otherwise we need to check the FontMatrix
1 index /FontMatrix get 0 get
dup 0 eq {
% FontMatrix[0] == 0, so cannot downscale by it
- % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy
- pop
- 1 index /FontMatrix get 1 get
- dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics
+ % HACK: downscale by FontMatrix[1], and will get the target value of wx as wy
+ pop
+ 1 index /FontMatrix get 1 get
+ dup 0 eq { pop 1 } if % sorry, FontMatrix is singular so cannot enforce the PDF metrics
} if
//ScaleMetrics exec
} if
@@ -2111,11 +2110,11 @@ end
dup /FontType 3 put
dup /BuildChar //BuildChar put
dup dup /Font exch put
- % Ignore Metrics because pdfwrite duplicates it
+ % Ignore Metrics because pdfwrite duplicates it
% from setcharwidth/setcachedevice.
dup 3 1 roll % s fr rn fr
definefont % s fr f
- 2 copy ne {
+ 2 copy ne {
% The interpreter copied the font dictionary while 'definefont'
% Need to update the font pointer in the resource.
2 copy /Font exch put % s fr f
@@ -2136,14 +2135,14 @@ end
} bind def
/ResolveAndSetFont % <resource_name> <size> ResolveAndSetFont -
-{
+{
//ResolveAndSetFontAux exec
} bind def
%%beg TrueType
% ================= Auxiliary procedures for True Type cmap Decoder =============
-/.knownget
+/.knownget
{ 2 copy known {
get true
} {
@@ -2151,14 +2150,14 @@ end
} ifelse
} bind def
-/.min
+/.min
{ 2 copy lt {
exch
} if
pop
} bind def
-/.max
+/.max
{ 2 copy gt {
exch
} if
@@ -2389,12 +2388,12 @@ end
/Gdot /Gdotaccent
/Ldot /Ldotaccent
/Zdot /Zdotaccent
- /cdot /cdotaccent
- /edot /edotaccent
+ /cdot /cdotaccent
+ /edot /edotaccent
/eoverdot /edotaccent
- /gdot /gdotaccent
+ /gdot /gdotaccent
/ldot /ldotaccent
- /zdot /zdotaccent
+ /zdot /zdotaccent
.dicttomark readonly def
/get_from_stringarray % <array|string> <offset> get_from_stringarray <int>
@@ -2443,7 +2442,7 @@ end
/string_array_size % <array|string> string_array_size <int>
{ dup type /stringtype eq {
length
- } {
+ } {
0 exch { length add } forall
} ifelse
} bind def
@@ -2482,7 +2481,7 @@ end
} for
/postnames exch def
numglyphs array 0 1 numglyphs 1 sub {
- dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec
+ dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec
dup 0 get 8 bitshift exch 1 get add dup 258 lt {
MacGlyphEncoding exch get
} {
@@ -2680,7 +2679,7 @@ end
NumEncodings {
16#7FFFFFF null % f o om null|[]
% Choosing a table with minimal offset greater than 'o' :
- currentdict {
+ currentdict {
1 index type /integertype eq { % f o om null|[] id []
exch pop dup 0 get % f o om null|[] [] oi
dup 5 index gt {
@@ -2688,7 +2687,7 @@ end
4 1 roll % f o oi om null|[] []
exch pop exch pop % f o oi []
} {
- pop pop
+ pop pop
} ifelse
} {
pop pop
@@ -2712,7 +2711,7 @@ end
2 exch put % f o'
} repeat
pop pop %
- currentdict end
+ currentdict end
//PDFR_DEBUG {
(ParseTTcmap end) =
} if
@@ -2755,7 +2754,7 @@ end
} bind def
/GetMacRomanEncodingInverse
-{ //PDFReader /MacRomanEncodingInverse get
+{ //PDFReader /MacRomanEncodingInverse get
dup null eq {
pop
MacRomanEncoding //InverseEncoding exec
@@ -2793,7 +2792,7 @@ end
} bind def
/ComposeCharStrings % <cmaparray> <dict> ComposeCharStrings <dict>
-{
+{
//PDFR_DEBUG {
(ComposeCharStrings beg) =
} if
@@ -2807,7 +2806,7 @@ end
1 index length 1 sub -1 0 { % d [] cmap code
dup 3 index exch get exch % d [] cmap name code
dup 0 eq 2 index /.notdef eq or { % do not re-encode GID 0, or the
- % /.notdef glyph name
+ % /.notdef glyph name
pop pop
} {
def
@@ -2826,7 +2825,7 @@ end
} bind def
/ParseTTpost % <file> <TableDirectory> ParseTTpost -
-{ % Defines TTparser.post - an array,
+{ % Defines TTparser.post - an array,
% which maps glyph indices to glyph names.
//PDFR_DEBUG {
(ParseTTpost beg) =
@@ -2856,7 +2855,7 @@ end
16384 string readstring not {
mark (Insufficient data in the stream for ParseTTpost.) //error exec
} if
- } for
+ } for
% [ f remainder () ()...
counttomark -2 roll % [ () ()... f remainder
string readstring not{
@@ -2909,7 +2908,7 @@ end
//PDFR_DEBUG {
(Using the TT cmap encoding for Macintosh Roman.) =
} if
- 16#00010000 //GetTTEncoding exec
+ 16#00010000 //GetTTEncoding exec
PDFEncoding dup null eq {
pop //GetMacRomanEncodingInverse exec
} {
@@ -2938,8 +2937,8 @@ end
(CharStrings <<) =
dup {
exch
- dup type /nametype eq {
- //=only exec
+ dup type /nametype eq {
+ //=only exec
} {
==
} ifelse
@@ -2980,7 +2979,6 @@ end
pop % a1' ... an'
} bind def
-
/ComputeFunction_10 % <scaled_arg> <sample_array> ComputeFunction_10 <result>
{ % Assuming a 1-argument 1-result function type 0.
//PDFR_DEBUG {
@@ -3013,7 +3011,7 @@ end
} if
dup 0 eq { % v 0
pop % v
- } {
+ } {
dup 2 add -1 roll % a2 .... an [] n a1
dup 3 index length 1 sub ge {
pop 1 sub % a2 .... an [] n-1
@@ -3025,7 +3023,7 @@ end
3 index dup % a2 .... an [] n a1 i [i] n n
5 add copy % a2 .... an [] n a1 i [i] n a2 .... an [] n a1 i [i] n
6 2 roll % a2 .... an [] n a1 i [i] n a2 .... an [i] n [] n a1 i
- pop pop pop pop % a2 .... an [] n a1 i [i] n a2 .... an [i] n
+ pop pop pop pop % a2 .... an [] n a1 i [i] n a2 .... an [i] n
1 sub % a2 .... an [] n a1 i [i] n a2 .... an [i] n-1
//PDFReader /ComputeFunction_n0 get exec % a2 .... an [] n a1 i [i] n v0
3 2 roll pop % a2 .... an [] n a1 i n v0
@@ -3050,7 +3048,7 @@ end
% The stream is already converted to the array /Data.
dup /Domain get exch
dup /Data get 0 get exch
- /Size get length
+ /Size get length
[ 4 1 roll
//PDFR_DEBUG {
{ (function beg, stack =) print count //=only exec (\n) print } /exec load
@@ -3187,7 +3185,7 @@ end
/StoreSample % <value> <table> <dimensions> StoreSample -
{ % The reader is on the dictionary stack.
- 1 sub
+ 1 sub
dup 0 eq {
pop % v []
} {
@@ -3217,7 +3215,7 @@ end
{ 2 copy ge {
exit
} if
- 3 1 roll
+ 3 1 roll
8 add 3 1 roll
256 mul File read not {
mark (Insufficient data for function.) //error exec
@@ -3250,7 +3248,7 @@ end
0 1 Size 0 get 1 sub {
I exch 0 exch put
0 1 M 1 sub {
- dup Range exch 2 mul 2 getinterval % m r
+ dup Range exch 2 mul 2 getinterval % m r
//PDFR_DEBUG {
(Will read a sample ... ) print
} if
@@ -3264,7 +3262,7 @@ end
} for
} for
} {
- 1 sub
+ 1 sub
dup Size exch get 0 exch 1 exch 1 sub { % d-1 i
I exch 2 index exch put % d-1
dup //ReadSamplesRec exec % d-1
@@ -3303,7 +3301,7 @@ end
PDFR_DEBUG {
(Table = ) print Table ==
} if
- /Data Table put %
+ /Data Table put %
end
//PDFR_DEBUG {
(StreamToArray end ) print count =
@@ -3352,8 +3350,8 @@ end
excp mul add % y
} aload pop
] cvx
- } {
- [
+ } {
+ [
0 1 C0 length 1 sub {
N % [ ... i n
C0 2 index get % [ ... i n c0
@@ -3362,12 +3360,12 @@ end
1 index sub % [ ... n c0 c1-c0
[ /dup load % [ ... n c0 c1-c0 [ dup
5 2 roll % [ ... [ dup n c0 c1-c0
- { % x x n c0 c1-c0
+ { % x x n c0 c1-c0
4 2 roll % x c0 c1-c0 x n
exp mul add % x y
exch % y x
} aload pop
- ] cvx
+ ] cvx
/exec load
} for
/pop load
@@ -3375,15 +3373,14 @@ end
} ifelse
end
//PDFR_DEBUG {
- (FunctionType2Proc : ) print dup ==
+ (FunctionType2Proc : ) print dup ==
} if
} bind def
-
/FunctionToProc14 % <function_dict> FunctionToProc14 <proc>
{ //MakeStreamReader exec cvx exec
//PDFR_DEBUG {
- (FunctionType4Proc : ) print dup ==
+ (FunctionType4Proc : ) print dup ==
} if
} bind def
@@ -3444,10 +3441,10 @@ end
} if
} bind def
-/spotfunctions mark % Copied from pdf_draw.ps
+/spotfunctions mark % Copied from pdf_draw.ps
/Round {
abs exch abs 2 copy add 1 le {
- dup mul exch dup mul add 1 exch sub
+ dup mul exch dup mul add 1 exch sub
} {
1 sub dup mul exch 1 sub dup mul add 1 sub
} ifelse
@@ -3512,8 +3509,8 @@ end
} bind def
/SubstitutePDFColorSpace % <array> SubstitutePDFColorSpace <array>
-{
- {
+{
+ {
dup 0 get /Pattern eq {
dup length 1 gt {
dup dup 1 //CheckColorSpace //ResolveA exec
@@ -3540,13 +3537,13 @@ end
dup /Gamma //knownget exec {
[ exch /exp load ] cvx
1 index exch /DecodeLMN exch put
- } if
+ } if
[ exch /CIEBasedA exch ] % []
exit
} if
dup 0 get /CalRGB eq {
1 get % dict
- dup /Matrix //knownget exec {
+ dup /Matrix //knownget exec {
1 index exch /MatrixLMN exch put
} if
dup /Gamma //knownget exec {
@@ -3559,7 +3556,7 @@ end
3 1 roll
3 array astore
1 index exch /DecodeLMN exch put
- } if
+ } if
[ exch /CIEBasedABC exch ] % []
exit
} if
@@ -3567,7 +3564,7 @@ end
1 get % dict
begin
currentdict /Range //knownget exec { aload pop } { -100 100 -100 100 } ifelse
- 0 100 6 2 roll 6 array astore
+ 0 100 6 2 roll 6 array astore
/RangeABC exch def
/DecodeABC [{16 add 116 div} bind {500 div} bind {200 div} bind] def
/MatrixABC [1 1 1 1 0 0 0 0 -1] def
@@ -3588,7 +3585,7 @@ end
exit
pop
} if
- % Check if this is an already substituted space
+ % Check if this is an already substituted space
dup 0 get /CIEBasedA eq {exit} if
dup 0 get /CIEBasedABC eq {exit} if
mark exch (Unimplemented color space ) exch //error exec
@@ -3598,13 +3595,13 @@ end
//SubstitutePDFColorSpaceRec 0 //SubstitutePDFColorSpace put
/ResolveArrayElement % <array> <index> ResolveArrayElement <array>
-{ 2 copy get
+{ 2 copy get
dup type dup /arraytype eq exch
/packedarraytype eq or { % make sure its a procedure/executable array
xcheck {
- 2 copy get % Get executable array
- dup 0 get type /integertype eq % ensure first element is an integer
- 1 index 1 get type dup /arraytype
+ 2 copy get % Get executable array
+ dup 0 get type /integertype eq % ensure first element is an integer
+ 1 index 1 get type dup /arraytype
eq exch
/packedarraytype eq or % ensure second element is executable array
and {
@@ -3630,10 +3627,10 @@ end
{
% This works against applying a pattern over a pattern space,
% which may happen due to duplication of stroking and non-stroking colors.
- % gs3.70 fails when setting a pattern space and
+ % gs3.70 fails when setting a pattern space and
% the (old) current color space is a pattern space.
%
- % If the new color space is an array and it appears equal to the old one,
+ % If the new color space is an array and it appears equal to the old one,
% do nothing. Otherwise set the new color space.
PDFR_DEBUG {
(SetColorSpaceSafe beg) =
@@ -3651,7 +3648,7 @@ end
} if
} for % cs b cs'
pop % cs b
- {
+ {
setcolorspace
} {
pop
@@ -3677,9 +3674,9 @@ end
} if
dup 0 get /Indexed eq {
1 //ResolveArrayElement exec
- dup dup 1 get
+ dup dup 1 get
dup type /arraytype eq {
- //SubstitutePDFColorSpace exec
+ //SubstitutePDFColorSpace exec
//ResolveColorSpaceArrayRec exec
1 exch put
} {
@@ -3704,7 +3701,7 @@ end
//ResolveColorSpaceArrayRec 0 //ResolveColorSpaceArray put
/ResolveColorSpace % <name> ResolveColorSpace <color_space>
-{
+{
//PDFR_DEBUG {
(ResolveColorSpace beg ) print dup =
} if
@@ -3716,7 +3713,7 @@ end
} if
} {
dup % n n
- //PDFReader /CurrentObject get /Context get /Resources get
+ //PDFReader /CurrentObject get /Context get /Resources get
/ColorSpace //DoNothing //ResolveD exec
exch //CheckColorSpace //ResolveD exec % n cs
dup type /arraytype eq {
@@ -3746,7 +3743,7 @@ end
} if
} bind def
-/PaintProc %
+/PaintProc %
{ /Context get % pattern_object
//RunDelayedStream exec
} bind def
@@ -3762,7 +3759,7 @@ end
exch pop % p
} { % n
dup % n n
- //PDFReader /CurrentObject get /Context get /Resources get
+ //PDFReader /CurrentObject get /Context get /Resources get
/Pattern //DoNothing //ResolveD exec
exch //CheckPattern //ResolveD exec % n o
dup dup /Context exch put
@@ -3785,7 +3782,7 @@ end
(SetColor beg) =
} if
currentcolorspace dup type /nametype eq {
- pop setcolor
+ pop setcolor
} {
0 get /Pattern eq {
//ResolvePattern exec setpattern
@@ -3816,7 +3813,7 @@ currentdict end readonly def
/ImageValues 15 dict begin
/G /DeviceGray def
/RGB /DeviceRGB def
- /CMYK /DeviceCMYK def
+ /CMYK /DeviceCMYK def
/I /Indexed def
/AHx /ASCIIHexDecode def
/A85 /ASCII85Decode def
@@ -3840,9 +3837,9 @@ currentdict end readonly def
/DecodeArrays 15 dict begin
/DeviceGray { [0 1] } def
/DeviceRGB { [0 1 0 1 0 1] } def
- /DeviceCMYK { [0 1 0 1 0 1 0 1] } def
- /Indexed {
- dup /BitsPerComponent get 1 exch bitshift 1 sub [exch 0 exch]
+ /DeviceCMYK { [0 1 0 1 0 1 0 1] } def
+ /Indexed {
+ dup /BitsPerComponent get 1 exch bitshift 1 sub [exch 0 exch]
} def
/Separation { [0 1] } def
/CIEBasedA { [0 1] /RangeA //GetColorSpaceRange exec } def
@@ -3859,7 +3856,7 @@ currentdict end readonly def
{
//PDFR_DEBUG {
(Image :) =
- dup { exch //=only exec ( ) print ==
+ dup { exch //=only exec ( ) print ==
} forall
} if
} bind def
@@ -3870,17 +3867,17 @@ currentdict end readonly def
dup /ColorSpace //CheckColorSpace //ResolveD exec pop
} if
dup /Decode known not {
- dup /ColorSpace //knownget exec {
+ dup /ColorSpace //knownget exec {
dup type /arraytype eq {
0 get
} if
- //DecodeArrays exch get exec
+ //DecodeArrays exch get exec
} {
[0 1]
} ifelse
1 index exch /Decode exch put
} if
- dup /ImageMatrix [2 index /Width get 0 0 5 index /Height get neg
+ dup /ImageMatrix [2 index /Width get 0 0 5 index /Height get neg
0 7 index /Height get] put % Not sure why upside down ?
//DebugImagePrinting exec
} bind def
@@ -3899,7 +3896,7 @@ currentdict end readonly def
exch //ImageValues //Substitute exec exch
} if
dup /ColorSpace eq {
- exch
+ exch
dup //ImageValues exch //knownget exec {
exch pop
} {
@@ -3919,7 +3916,7 @@ currentdict end readonly def
} bind def
/CompleteOutlineImage % <dict> CompleteOutlineImage <image_dict>
-{
+{
currentglobal exch dup gcheck setglobal
//PDFR_DEBUG {
(CompleteOutlineImage beg) =
@@ -3954,7 +3951,7 @@ currentdict end readonly def
gsave
dup /ColorSpace //knownget exec { setcolorspace } if
dup /ImageMask //knownget exec not { false } if
- { imagemask } { image } ifelse
+ { imagemask } { image } ifelse
grestore
//PDFR_DEBUG {
(DoImage end) =
@@ -3968,7 +3965,7 @@ currentdict end readonly def
gsave
//PDFReader /GraphicStateStackPointer get
dup //GraphicStateStack exch get null eq {
- dup //GraphicStateStack exch //InitialGraphicState length dict put
+ dup //GraphicStateStack exch //InitialGraphicState length dict put
} if
dup //GraphicStateStack exch get
//GraphicState exch copy pop
@@ -3985,7 +3982,6 @@ currentdict end readonly def
//GraphicState copy pop
} bind def
-
% ===================== Interpret Data Streams ===============
/SetFont % <resource_name> <size> SetFont -
@@ -4109,7 +4105,7 @@ currentdict end readonly def
{
//PDFR_DEBUG { (SetTransfer beg ) print count = } if
dup type /arraytype eq 1 index xcheck not and {
- 0 4 getinterval aload pop
+ 0 4 getinterval aload pop
setcolortransfer
} {
settransfer
@@ -4188,7 +4184,7 @@ currentdict end readonly def
dup /HalftoneType get dup 3 eq exch 6 eq or {
dup dup //MakeStreamReader exec
//BlockBuffer readstring pop
- dup length
+ dup length
dup 0 eq {
mark (Could not read Thresholds) //error exec
} if
@@ -4198,10 +4194,9 @@ currentdict end readonly def
} if
} bind def
-
/SetExtGState % <name> SetExtGState -
{
- //PDFReader /CurrentObject get /Context get /Resources get
+ //PDFReader /CurrentObject get /Context get /Resources get
/ExtGState //DoNothing //ResolveD exec
exch //CheckExtGState //ResolveD exec % s gs
dup /LW //knownget exec {
@@ -4294,7 +4289,7 @@ currentdict end readonly def
/TransferFunction //ResolveFunctionSafe exec
//CreateHalftoneThresholds exec
dup /HalftoneType get 5 gt { % null h n v
- 4 3 roll pop
+ 4 3 roll pop
dup 4 1 roll
} if
} if
@@ -4303,8 +4298,8 @@ currentdict end readonly def
} if
//CreateHalftoneThresholds exec
//PDFR_DEBUG {
- (HT:)=
- dup {
+ (HT:)=
+ dup {
1 index /Default eq {
(Default <<)=
exch pop
@@ -4313,7 +4308,7 @@ currentdict end readonly def
} {
exch = ==
} ifelse
- } forall
+ } forall
(HT end)= flush
} if
exch dup null ne {
@@ -4375,7 +4370,7 @@ currentdict end readonly def
/DoXObject % <name> DoXObject -
{
- //PDFReader /CurrentObject get /Context get /Resources get
+ //PDFReader /CurrentObject get /Context get /Resources get
/XObject //DoNothing //ResolveD exec
exch //CheckXObject //ResolveD exec
dup /Subtype get
@@ -4458,7 +4453,7 @@ currentdict end readonly def
/W /clip load def
/W* /eoclip load def
/sh { % Reserved for ps3write.
- ResolveShading
+ ResolveShading
dup /Background known {
gsave
dup /ColorSpace get setcolorspace
@@ -4468,22 +4463,22 @@ currentdict end readonly def
rectfill
grestore
} if
- shfill
+ shfill
} bind def
/Do { //DoXObject exec } bind def
/BI { currentglobal false setglobal << } bind def
/ID { >>
- dup /DataSource currentfile
+ dup /DataSource currentfile
% HACK BEG
% This hack provides a compatibility to HP LaserJet 1320,
- % which sometimes closes the underlying stream when EOD
+ % which sometimes closes the underlying stream when EOD
% is reached in the ASCII85Decode filter.
% This portion is not required by the Postscript language definition.
2 index /F //knownget exec {
/A85 eq {
- 0 (~>) /SubFileDecode filter
+ 0 (~>) /SubFileDecode filter
} if
} if
% HACK END
@@ -4563,7 +4558,6 @@ currentdict end def
{ load
} bind def
-
-% Leaving the procset on the dictionary stack to provide
+% Leaving the procset on the dictionary stack to provide
% definitions of obj, endobj, stream, endstream, R, xref.
%%EndPrologue
diff --git a/gs/lib/packfile.ps b/gs/lib/packfile.ps
index 70e8aaf79..021de4ae5 100644
--- a/gs/lib/packfile.ps
+++ b/gs/lib/packfile.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -42,21 +42,21 @@
/addstats % <file> addstats -
{ 0
{ 1 index //statbuf readstring 3 1 roll
- % Stack: file eof numzeros data
+ % Stack: file eof numzeros data
{ dup 0 eq
- { pop 1 add
- }
- { 1 index 0 ne
- { exch 255 .min
- //zruns exch 2 copy get 1 add put
- 0 exch //zfreq
- }
- { //nzfreq
- }
- ifelse
- exch 2 copy get 1 add put
- }
- ifelse
+ { pop 1 add
+ }
+ { 1 index 0 ne
+ { exch 255 .min
+ //zruns exch 2 copy get 1 add put
+ 0 exch //zfreq
+ }
+ { //nzfreq
+ }
+ ifelse
+ exch 2 copy get 1 add put
+ }
+ ifelse
} forall
exch not { exit } if (.) print flush
} loop
@@ -67,7 +67,7 @@
/statcodes % - statcodes <array>
{ maxcode 1 add 256 add maxzrun 2 sub add 1 add array % full array
dup maxcode 1 add dup 2 index length exch sub getinterval % data
- % Put statistics into array
+ % Put statistics into array
dup 0 1 255
{ zfreq 1 index get nzfreq 2 index get add put dup
} for
@@ -143,9 +143,9 @@
tempname (w) file
dup /MoveToFrontEncode filter
dup <<
- /BlockSize 1000000
+ /BlockSize 1000000
>> /BWBlockSortEncode filter
- % Stack: filenames outfile tempfile mtfe bwe
+ % Stack: filenames outfile tempfile mtfe bwe
5 -1 roll dup length dict 0 6 2 roll
{ % Stack: outfile posdict pos tempfile mtfe bwe infilename
dup ==only dup (r) file 2 index copyfile exch pop
@@ -153,23 +153,23 @@
5 -1 roll add 4 1 roll
} forall
closefile closefile closefile pop exch
- % Stack: posdict outfile
- % Compute an optimal Huffman code.
+ % Stack: posdict outfile
+ % Compute an optimal Huffman code.
initstats
tempname (r) file addstats
- % Actually compress the file.
- % Write the decompression information on the output first.
+ % Actually compress the file.
+ % Write the decompression information on the output first.
dup tempname filelength write==
dup maxcode write==
- % Write the code table as a homogenous number array.
+ % Write the code table as a homogenous number array.
statcodes exch
dup 149 write dup 32 write dup 2 index length write16
exch { 2 copy write16 pop } forall
dup <<
- /MaxCodeLength maxcode
- /EndOfData true
- /EncodeZeroRuns 256
- /Tables statcodes
+ /MaxCodeLength maxcode
+ /EndOfData true
+ /EncodeZeroRuns 256
+ /Tables statcodes
>> /BoundedHuffmanEncode filter
tempname (r) file exch copyfile pop closefile
exch
@@ -183,26 +183,26 @@
Fontmap exch get
}
loop
- % Stack: fontname filename
+ % Stack: fontname filename
dup dup
{ (.) search not { exit } if
exch pop exch 3 -1 roll pop
}
loop
- % Stack: fontname filename noextname extension
+ % Stack: fontname filename noextname extension
exch
{ (/) search not { (\\) search not { exit } if } if
pop pop
}
loop
- % If the font extension is anything other than
- % .pfa or .pfb, we assume it can't be rewritten
- % using compressfont.
- % Stack: fontname filename extension basename
+ % If the font extension is anything other than
+ % .pfa or .pfb, we assume it can't be rewritten
+ % using compressfont.
+ % Stack: fontname filename extension basename
(.cpf) concatstrings dup 5 1 roll (w) file
- % Stack: outfilename fontname filename extension outfile
+ % Stack: outfilename fontname filename extension outfile
exch dup (pfa) eq exch (pfb) eq or
- % Stack: outfilename fontname filename outfile bool
+ % Stack: outfilename fontname filename outfile bool
{ exch pop compressfont
}
{ 3 -1 roll pop
@@ -245,7 +245,7 @@ false .setglobal
% Fewer larger groups compress better, but make decompression slower.
/Lists [
[ % The oblique and narrow fonts are synthetic,
- % and take very little space.
+ % and take very little space.
/AvantGarde-BookOblique /AvantGarde-DemiOblique
/Courier-Oblique /Courier-BoldOblique
/Helvetica-Oblique /Helvetica-BoldOblique
@@ -272,7 +272,7 @@ false .setglobal
/Lists Lists mark exch
{ mark exch
{ { Fontmap 1 index get dup type /nametype ne { pop exit } if
- exch pop
+ exch pop
}
loop
}
diff --git a/gs/lib/pcharstr.ps b/gs/lib/pcharstr.ps
index 5860446c2..eba70e7cf 100644
--- a/gs/lib/pcharstr.ps
+++ b/gs/lib/pcharstr.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1990, 1992, 1997, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -87,7 +87,7 @@
begin
currentfont begin Private begin 10 dict begin
- % Print the CharStrings and Subrs
+ % Print the CharStrings and Subrs
beginchars
CharStrings { exch charbegin printcs } forall
@@ -102,7 +102,7 @@
endsubrs
} if
- % Print the bounding boxes
+ % Print the bounding boxes
gsave nulldevice FontMatrix matrix invertmatrix concat
beginboxes
@@ -113,8 +113,8 @@
{ 1 index boxbegin charname ,
( ) dup 0 4 -1 roll put
newpath 0 0 moveto false charpath
- pathbbox ({) print 4 -1 roll =only ,
- 3 -1 roll =only , exch =only , =only (}) print
+ pathbbox ({) print 4 -1 roll =only ,
+ 3 -1 roll =only , exch =only , =only (}) print
boxend
}
ifelse
diff --git a/gs/lib/pdf2dsc.ps b/gs/lib/pdf2dsc.ps
index a4db89da0..c38f2b95d 100644
--- a/gs/lib/pdf2dsc.ps
+++ b/gs/lib/pdf2dsc.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -63,9 +63,9 @@ systemdict /.setsafe known { .setsafe } if
% scan through for media sizes, keep them in the dictionary
FirstPage 1 LastPage {
pdfgetpage /MediaBox pget pop % MediaBox is a required attribute
- aload pop
+ aload pop
3 -1 roll sub 3 1 roll exch sub exch
- 2 array astore
+ 2 array astore
aload 3 1 roll 10 string cvs exch 10 string cvs
(x) 3 -1 roll concatstrings concatstrings cvn
MediaTypes 3 1 roll exch put
@@ -91,13 +91,13 @@ systemdict /.setsafe known { .setsafe } if
if
% This is really supposed to be sorted by frequency of usage...
(%%DocumentMedia: )
- MediaTypes {
+ MediaTypes {
exch pop
1 index puts
(y) puts dup 1 get DSCstring cvs puts
- (x) puts dup 0 get DSCstring cvs puts
+ (x) puts dup 0 get DSCstring cvs puts
( ) puts dup 0 get DSCstring cvs puts
- ( ) puts 1 get DSCstring cvs puts
+ ( ) puts 1 get DSCstring cvs puts
( 70 white ()\n) puts
pop (%%+ )
} forall
@@ -222,9 +222,9 @@ systemdict /.setsafe known { .setsafe } if
dup pdfgetpage
dup /MediaBox pget pop
(%%PageMedia: y) puts
- aload pop 3 -1 roll sub DSCstring cvs puts
- (x) puts exch sub DSCstring cvs puts
- (\n) puts
+ aload pop 3 -1 roll sub DSCstring cvs puts
+ (x) puts exch sub DSCstring cvs puts
+ (\n) puts
dup /CropBox pget {
(%%PageBoundingBox: ) puts
{DSCfile exch write=only ( ) puts} forall
diff --git a/gs/lib/pdfopt.ps b/gs/lib/pdfopt.ps
index f6205e2b7..74cb91994 100644
--- a/gs/lib/pdfopt.ps
+++ b/gs/lib/pdfopt.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2000, 2001 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -56,7 +56,7 @@ pdfoptdict begin
/dacontstring { % <darray> dacontstring <string>
0 1 index { exch pop length add } forall string
dup /NullEncode filter
- % Stack: darray str filter
+ % Stack: darray str filter
3 -1 roll { 1 index exch writestring } daforall
closefile
} bind def
@@ -127,7 +127,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/clostream { % <data> <proc> <endproc> clostream <stream>
2 index 3 -1 roll /exec load 3 packedarray cvx
/NullEncode filter
- % Stack: data endproc stream
+ % Stack: data endproc stream
clostreams 1 index 5 -2 roll 2 array astore put
} bind def
% Close a closure-based stream.
@@ -174,7 +174,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/N exch def N bitshift B add
} {
2 copy bitshift B add S exch write
- % Stack: value -left
+ % Stack: value -left
{ 8 add dup 0 ge { exit } if
2 copy bitshift 255 and S exch write
} loop
@@ -214,7 +214,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/copyrange { % <start> <end> copybytes -
TFile 2 index setfileposition
exch sub 1024 string exch {
- % Stack: buf left
+ % Stack: buf left
2 copy 1 index length .min 0 exch getinterval
TFile exch readstring pop OFile exch writestring
1 index length sub dup 0 le { exit } if
@@ -239,7 +239,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
{ touch touch } forall
} {
dup xcheck {
- % Executable array, must be an indirect object.
+ % Executable array, must be an indirect object.
dup 0 get resolved? { pop pop } { oforce touch } ifelse
} {
{ touch } forall
@@ -275,7 +275,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/replaceReferences { % - replaceReferences -
Objects { replacerefs pop } lforall
- % Delete replaced objects.
+ % Delete replaced objects.
0 1 Objects llength 1 sub {
Objects 1 index lget replaceable? {
PDFOPTDEBUG { (Deleting ) print dup = } if
@@ -289,7 +289,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/createObjects { % [<obj>...] createObjects <firstobj#>
Objects llength dup
dup 3 index length add growPDFobjects
- % Stack: objects objn objn
+ % Stack: objects objn objn
3 1 roll exch {
Objects 2 index 3 -1 roll lput
Generations 1 index 1 lput
@@ -300,39 +300,39 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% ---------------- Propagate attributes ---------------- %
/nopropattrs <<
- % Never propagate these.
+ % Never propagate these.
/Type dup /Kids dup /Count dup /Parent dup
- % Handle Resources specially.
+ % Handle Resources specially.
/Resources dup
>> def
% Merge Resources.
/mergeres { % <fromdict> <todict> mergeres -
- % Values in todict take priority over fromdict.
+ % Values in todict take priority over fromdict.
1 index /Resources .knownget {
1 index /Resources .knownget {
- % Stack: fromdict todict fromres tores
+ % Stack: fromdict todict fromres tores
exch oforce exch oforce
- % todict's Resources may be shared, so make a copy.
+ % todict's Resources may be shared, so make a copy.
dup length dict .copydict
exch {
- % Stack: fromdict todict tores' fromkey fromvalue
- 2 index 2 index knownoget {
- % Stack: fromdict todict tores' fromkey fromvalue tovalue
- exch oforce exch
- % ProcSet is an array, other types are dictionaries.
- dup type /dicttype eq {
- % Dictionary, not ProcSet.
- exch dup length 2 index length add dict .copydict .copydict
- } {
- % Array or packed array, ProcSet.
- % Use dictionaries to do the merge.
- dup length 2 index length add dict begin
- exch { dup def } forall { dup def } forall
- mark currentdict end { pop } forall .packtomark
- } ifelse
- } if
- 2 index 3 1 roll put
+ % Stack: fromdict todict tores' fromkey fromvalue
+ 2 index 2 index knownoget {
+ % Stack: fromdict todict tores' fromkey fromvalue tovalue
+ exch oforce exch
+ % ProcSet is an array, other types are dictionaries.
+ dup type /dicttype eq {
+ % Dictionary, not ProcSet.
+ exch dup length 2 index length add dict .copydict .copydict
+ } {
+ % Array or packed array, ProcSet.
+ % Use dictionaries to do the merge.
+ dup length 2 index length add dict begin
+ exch { dup def } forall { dup def } forall
+ mark currentdict end { pop } forall .packtomark
+ } ifelse
+ } if
+ 2 index 3 1 roll put
} forall
} if /Resources exch put pop
} {
@@ -342,9 +342,9 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% Merge attributes other than Resources.
/mergeattrs { % <fromdict> <todict> mergeattrs <fromdict> <todict>
- % Values in todict take priority over fromdict.
+ % Values in todict take priority over fromdict.
1 index {
- % Stack: fromdict todict fromkey fromvalue
+ % Stack: fromdict todict fromkey fromvalue
//nopropattrs 2 index known {
pop pop
} {
@@ -355,19 +355,19 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% Propagate attributes to a subtree.
/proppage { % <attrs> <subtree> proppage -
- % We should be able to tell when we reach a leaf
- % by finding a Type unequal to /Pages. Unfortunately,
- % some files distributed by Adobe lack the Type key
- % in some of the Pages nodes! Instead, we check for Kids.
+ % We should be able to tell when we reach a leaf
+ % by finding a Type unequal to /Pages. Unfortunately,
+ % some files distributed by Adobe lack the Type key
+ % in some of the Pages nodes! Instead, we check for Kids.
dup /Kids knownoget {
- % Accumulate inherited values.
+ % Accumulate inherited values.
3 1 roll
- % Stack: kids attrs pagesnode
+ % Stack: kids attrs pagesnode
dup length dict .copydict mergeattrs
dup 3 1 roll mergeres
exch { oforce 1 index exch proppage } forall pop
} {
- % Merge inherited values into the leaf.
+ % Merge inherited values into the leaf.
mergeattrs mergeres
} ifelse
} bind def
@@ -383,7 +383,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
{
Trailer /Root omget
dup /PageMode .knownget { omvisit } if
- % Don't allow omvisit to trace references to Page objects.
+ % Don't allow omvisit to trace references to Page objects.
dup /OpenAction .knownget { omvisitnopage } if
Trailer /Encrypt .knownget { omvisit } if
dup /Threads .knownget {
@@ -401,12 +401,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
exch /FontDescriptor eq {
omforce dup /Flags .knownget { 32 and 0 ne } { false } ifelse
exch {
- exch dup dup /FontFile eq exch /FontFile2 eq or
- exch /FontFile3 eq or 2 index and {
- fontfiles exch dadd
- } {
- omvisit
- } ifelse
+ exch dup dup /FontFile eq exch /FontFile2 eq or
+ exch /FontFile3 eq or 2 index and {
+ fontfiles exch dadd
+ } {
+ omvisit
+ } ifelse
} forall pop
} {
omvisit
@@ -428,28 +428,28 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/fontfiles 10 darray def
{
omforce
- % Stack: pageobj# extra page
- % Visit any extra objects if applicable.
+ % Stack: pageobj# extra page
+ % Visit any extra objects if applicable.
exch omvisitnopage
- % Visit Annots, if any.
- % We don't try to defer the drawing information.
+ % Visit Annots, if any.
+ % We don't try to defer the drawing information.
dup /Annots .knownget { omvisitnopage } if
- % Visit beads.
+ % Visit beads.
dup /B .knownget { omvisitnopage } if
- % Visit resources dictionaries.
+ % Visit resources dictionaries.
dup /Resources .knownget {
omforce dup {
- % Visit the first-level Resource dictionaries.
- omforce pop pop
+ % Visit the first-level Resource dictionaries.
+ omforce pop pop
} forall {
- % Visit the resources themselves.
- % Skip Image XObjects, and FontFile streams if the
- % FontDescriptor Flags have bit 6 set.
- % We don't try to visit the resources in the order in which
- % the Contents stream(s) reference(s) them.
- exch dup /XObject eq {
- pop oforce {
- dup oforce /Subtype get /Image eq {
+ % Visit the resources themselves.
+ % Skip Image XObjects, and FontFile streams if the
+ % FontDescriptor Flags have bit 6 set.
+ % We don't try to visit the resources in the order in which
+ % the Contents stream(s) reference(s) them.
+ exch dup /XObject eq {
+ pop oforce {
+ dup oforce /Subtype get /Image eq {
dup oforce /DecodeParms .knownget {
oforce {
exch /JBIG2Globals eq {
@@ -459,32 +459,32 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
} ifelse
} forall
} if
- images exch dadd
- } {
- omvisit
- } ifelse pop
- } forall
- } {
- /Font eq {
- oforce { identifyfont pop } forall
- } {
- oforce omvisit
- } ifelse
- } ifelse
+ images exch dadd
+ } {
+ omvisit
+ } ifelse pop
+ } forall
+ } {
+ /Font eq {
+ oforce { identifyfont pop } forall
+ } {
+ oforce omvisit
+ } ifelse
+ } ifelse
} forall
} if
- % Visit the Contents stream(s).
+ % Visit the Contents stream(s).
dup /Contents .knownget { omvisit } if
- % Visit Image XObjects. We don't try to visit them in
- % reference order.
+ % Visit Image XObjects. We don't try to visit them in
+ % reference order.
filter_params { omvisit } daforall
images { omvisit } daforall
- % Visit FontFile streams. We don't try to visit them in
- % reference order.
+ % Visit FontFile streams. We don't try to visit them in
+ % reference order.
fontfiles { omvisit } daforall
pop
} visited end
- % Stack: pageobj# obj#s_larray
+ % Stack: pageobj# obj#s_larray
[ 3 1 roll {
2 copy eq { pop } { exch } ifelse
} lforall counttomark 1 roll ]
@@ -510,22 +510,22 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% non-shared. Note also that some objects referenced on the first page may
% also be referenced from other pages.
/identifyOtherPageObjects { % - identifyOtherPageObjects [<pageobj#s> ...]
- % <sharedobj#s>
+ % <sharedobj#s>
4 dict begin
/marks lstring Objects llength lgrowto def
- % Collect objects of other pages and identify sharing.
+ % Collect objects of other pages and identify sharing.
[ 2 1 pdfpagecount { null exch identifyPageObjects } for ]
dup {
{ marks exch 2 copy lget 1 add 254 .min lput } forall
} forall
- % Mark document-level and first page objects.
+ % Mark document-level and first page objects.
CatalogNs { marks exch 255 lput } lforall
FirstPageNs { marks exch 255 lput } forall
- % Mark the page objects themselves as non-shared.
+ % Mark the page objects themselves as non-shared.
dup {
0 get marks exch 1 lput
} forall
- % Collect the non-shared objects of each page.
+ % Collect the non-shared objects of each page.
dup
[ exch {
[ exch {
@@ -560,7 +560,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
SharedNs { marks exch 1 lput } forall
OtherPageNs { { marks exch 1 lput } forall } forall
- %****** PUT THESE IN A REASONABLE ORDER ******
+ %****** PUT THESE IN A REASONABLE ORDER ******
/npobj larray
0
1 1 Objects llength 1 sub {
@@ -569,7 +569,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
} {
pop
} ifelse
- } for
+ } for
lgrowto def
0
@@ -587,7 +587,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
} {
pop
} ifelse
- } for
+ } for
pop
npobj
@@ -602,7 +602,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
OtherPageNs { { omap pop } forall } forall
SharedNs { omap pop } forall
NonPageNs { omap pop } lforall
- % Assign object numbers for the First Page xref table last.
+ % Assign object numbers for the First Page xref table last.
LPDictN omap % don't pop, this is the return value
CatalogNs { omap pop } lforall
FirstPageNs { omap pop } forall
@@ -613,7 +613,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% Create the contents of the LPDict.
/createLPDict { % <phsstart> <phsend> <firstpageend>
- % <xref0start> <filelength> createLPDict -
+ % <xref0start> <filelength> createLPDict -
LPDict
dup /Linearized 1 put
dup /L 4 -1 roll put % filelength
@@ -627,11 +627,11 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% ---------------- Adjust object positions ---------------- %
/adjustObjectPositions { % <boundary> <deltabelow> <deltaabove>
- % adjustObjectPositions -
- % Objects fall into 4 categories: LPDict, PHS, Catalog, and others.
- % We handle the first two as special cases.
+ % adjustObjectPositions -
+ % Objects fall into 4 categories: LPDict, PHS, Catalog, and others.
+ % We handle the first two as special cases.
XRef {
- % Stack: bdy below above key loc
+ % Stack: bdy below above key loc
dup 5 index ge { 2 } { 3 } ifelse index add
XRef 3 1 roll ld_put
} ld_forall pop pop pop
@@ -771,15 +771,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
PDFOPTDEBUG { (\) = ) print dup = } if
} bind def
/omend { % <obj#> omend <pos>
- % The end of an object is the start of the next object.
- % The caller must be sure that this object is not the last one
- % in part 9.
+ % The end of an object is the start of the next object.
+ % The caller must be sure that this object is not the last one
+ % in part 9.
PDFOPTDEBUG { (end\() print dup =only } if
omap
PDFOPTDEBUG { (=>) print dup =only } if
1 add
- % Check that the requested object wasn't the last one in part 6:
- % the next object in the output file is the first in part 7.
+ % Check that the requested object wasn't the last one in part 6:
+ % the next object in the output file is the first in part 7.
PHSN omap 1 index eq { pop 1 } if
XRef exch ld_get
PDFOPTDEBUG { (\) = ) print dup = } if
@@ -790,7 +790,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% Find the Contents of a page.
/contentsobjects { % <pagedict> contentsobjects <firstobj#> <lastobj#> true
- % <pagedict> contentsobjects false
+ % <pagedict> contentsobjects false
/Contents .knownget {
dup oforce % ref []
dup type /dicttype eq {
@@ -799,8 +799,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
exch pop % []
dup length 0 ne {
dup 0 get 0 get % [] 1st
- exch dup % 1st [] []
- length 1 sub get 0 get % 1st last
+ exch dup % 1st [] []
+ length 1 sub get 0 get % 1st last
true
} {
pop false
@@ -812,7 +812,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
} bind def
/contentsstart { % <pagedict> contentsstart <pos> true
- % <pagedict> contentsstart false
+ % <pagedict> contentsstart false
contentsobjects { pop omstart true } { false } ifelse
} bind def
@@ -820,13 +820,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
contentsobjects { omend exch omstart sub } { 0 } ifelse
} bind def
-
/writePageOffsetHints {
PDFOPTDEBUG { /writePageOffsetHints == } if
20 dict begin
/bits OFile bitstream def
- % Calculate least length of a page.
+ % Calculate least length of a page.
FirstPageLength OtherPageLengths { .min } forall
/minpl exch def
@@ -835,20 +834,20 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
OtherPageNs { 0 get Objects exch lget contentslength .min } forall
/mincl exch def
- % The Adobe documentation says that all versions of Acrobat
- % require item 8 (mincl) to be zero. Patch this here.
+ % The Adobe documentation says that all versions of Acrobat
+ % require item 8 (mincl) to be zero. Patch this here.
/mincl 0 def
- % Calculate bits needed to represent greatest page length.
+ % Calculate bits needed to represent greatest page length.
FirstPageLength OtherPageLengths { .max } forall
minpl sub bitsneeded /maxplbits exch def
- % Calculate bits needed to represent the greatest Contents length.
+ % Calculate bits needed to represent the greatest Contents length.
FirstPageNs 0 get Objects exch lget contentslength
OtherPageNs { 0 get Objects exch lget contentslength .max } forall
mincl sub bitsneeded /maxclbits exch def
- % Per Adobe documentation, Acrobat requires that item 5 (maxplbits)
- % be equal to item 9 (maxclbits). Set both to the max of the two.
+ % Per Adobe documentation, Acrobat requires that item 5 (maxplbits)
+ % be equal to item 9 (maxclbits). Set both to the max of the two.
maxplbits maxclbits .max /maxplbits 1 index def /maxclbits exch def
% Mapping from object number to shared object reference
@@ -856,44 +855,44 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
0 FirstPageNs { 1 index def 1 add } forall
SharedNs { 1 index def 1 add } forall
pop
- currentdict end def
+ currentdict end def
% Table F.3 Page offset hint table, header section
% 1: Least number of objects in a page:
FirstPageNs length OtherPageNs { length .min } forall
/minnop 1 index def 32 bwn
- % 2: Location of first page's Page object:
+ % 2: Location of first page's Page object:
FirstPageNs 0 get omap XRef exch ld_get 32 bwn
- % 3: Bits needed to represent greatest # of objects in a page:
+ % 3: Bits needed to represent greatest # of objects in a page:
FirstPageNs length OtherPageNs { length .max } forall
minnop sub bitsneeded /maxnopbits 1 index def 16 bwn
- % 4: Least length of a page:
+ % 4: Least length of a page:
minpl 32 bwn
- % 5: Bits needed to represent the greatest page length:
+ % 5: Bits needed to represent the greatest page length:
maxplbits 16 bwn
- % 6: Least start of Contents offset:
+ % 6: Least start of Contents offset:
0 % (Acrobat requires that this be 0.)
/minsco 1 index def 32 bwn
- % 7: Bits needed to represent the greatest start of Contents
- % offset:
+ % 7: Bits needed to represent the greatest start of Contents
+ % offset:
0 % (Acrobat ignores this.)
/maxscobits 1 index def 16 bwn
- % 8: Least contents length:
+ % 8: Least contents length:
mincl 32 bwn
- % 9: Bits needed to represent the greatest Contents length:
+ % 9: Bits needed to represent the greatest Contents length:
maxclbits 16 bwn
- % 10: Bits needed to represent the greatest number of Shared
- % Object references:
+ % 10: Bits needed to represent the greatest number of Shared
+ % Object references:
FirstPageNs length SharedPageNs { length .max } forall bitsneeded
/maxsorbits 1 index def 16 bwn
- % 11: Bits needed to identify a Shared Object:
+ % 11: Bits needed to identify a Shared Object:
FirstPageNs length SharedNs length add bitsneeded
/sobits 1 index def 16 bwn
- % 12: Bits needed to represent numerator of fraction:
+ % 12: Bits needed to represent numerator of fraction:
2
/numfbits 1 index def 16 bwn
- % 13: Denominator of fraction:
+ % 13: Denominator of fraction:
1
/denf 1 index def 16 bwn
@@ -906,15 +905,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
} forall
bits bitflush
- % 2: Total length of pages in bytes;
+ % 2: Total length of pages in bytes;
FirstPageLength minpl sub maxplbits bwn
OtherPageLengths {
minpl sub maxplbits bwn
} forall
bits bitflush
- % 3: Number of shared objects referenced from page:
- FirstPageNs length maxsorbits bwn
+ % 3: Number of shared objects referenced from page:
+ FirstPageNs length maxsorbits bwn
SharedPageNs { length maxsorbits bwn } forall
bits bitflush
% 4: A shared object identifier:
@@ -928,12 +927,12 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
% 5: Numerator of fractional position for each shared object:
FirstPageNs { pop 0 numfbits bwn } forall
SharedPageNs {
- { pop 0 numfbits bwn
+ { pop 0 numfbits bwn
} forall
} forall
bits bitflush
- % 6: Contents offsets:
+ % 6: Contents offsets:
% Following Implementation Note 133 section 6 is empty.
maxscobits 0 gt {
[FirstPageNs OtherPageNs aload pop] {
@@ -959,30 +958,30 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/bits OFile bitstream def
/obj_count SharedNs length FirstPageNs length add def
- % Table F.5 Shared object hint table, header section
+ % Table F.5 Shared object hint table, header section
- % 1: Object number of first object in Shared Objects section
+ % 1: Object number of first object in Shared Objects section
0 32 bwn
- % 2: Location of first object in Shared Objects section:
- % If there are no shared objects,
- % Acrobat sets this to the location of linearization
- % parameters object (the very first object).
+ % 2: Location of first object in Shared Objects section:
+ % If there are no shared objects,
+ % Acrobat sets this to the location of linearization
+ % parameters object (the very first object).
{ pdfwriteheader } tomemory length 32 bwn
- % 3: Number of Shared Object entries for first page:
+ % 3: Number of Shared Object entries for first page:
FirstPageNs length 32 bwn
- % 4: Number of Shared Object entries for Shared Objects
- % section
+ % 4: Number of Shared Object entries for Shared Objects
+ % section
obj_count 32 bwn
- % 5: Bits needed to represent the greatest number of objects
- % in a shared object group (always 0, because all groups
- % have only 1 object):
+ % 5: Bits needed to represent the greatest number of objects
+ % in a shared object group (always 0, because all groups
+ % have only 1 object):
0 16 bwn
- % 6: Least length of a Shared Object Group in bytes:
+ % 6: Least length of a Shared Object Group in bytes:
16#7fffffff FirstPageNs { omlength .min } forall
SharedNs { omlength .min } forall
/minsol 1 index def 32 bwn
- % 7: Bits needed to represent the greatest length of a
- % Shared Object Group:
+ % 7: Bits needed to represent the greatest length of a
+ % Shared Object Group:
0 FirstPageNs { omlength .max } forall
SharedNs { omlength .max } forall
minsol sub bitsneeded
@@ -994,7 +993,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
FirstPageNs { omlength minsol sub maxsolbits bwn } forall
SharedNs { omlength minsol sub maxsolbits bwn } forall
bits bitflush
- % 2: MD5 flag:
+ % 2: MD5 flag:
obj_count { 0 1 bwn } repeat
bits bitflush
% 3: No MD5 shared object signatures.
@@ -1017,15 +1016,15 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
QUIET { pop } { print (, t = ) print realtime starttime sub = flush } ifelse
} def
omapinit
-
- % Create and open a temporary file.
- % Because of .setsafe, we have to open it as read-write, rather than
- % opening for writing, then closing it and reopening it for reading.
+
+ % Create and open a temporary file.
+ % Because of .setsafe, we have to open it as read-write, rather than
+ % opening for writing, then closing it and reopening it for reading.
null (w+) .tempfile /TFile exch def /TFileName exch def
.setsafe
- % Read all objects into memory.
+ % Read all objects into memory.
Trailer touch
(Read objects) now
@@ -1036,14 +1035,14 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/pdfOptimize cvx /limitcheck signalerror
} if
- % Replace indirect references to numbers. This is needed
- % for the Length of streams, and doesn't hurt anything else.
+ % Replace indirect references to numbers. This is needed
+ % for the Length of streams, and doesn't hurt anything else.
replaceReferences
(Replaced references) now
- % Create the two new objects: the linearization parameter
- % dictionary, and the Primary Hint Stream.
+ % Create the two new objects: the linearization parameter
+ % dictionary, and the Primary Hint Stream.
/LPDict 10 dict def
/PHS 10 dict cvx def % executable = stream
@@ -1052,7 +1051,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/PHSN exch def
PDFOPTDEBUG { << /LPDictN LPDictN /PHSN PHSN >> === } if
- % Count the number of objects in the output.
+ % Count the number of objects in the output.
0 0 1 Objects llength 1 sub {
Generations exch lget 0 ne { 1 add } if
@@ -1060,27 +1059,27 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/NObjects exch def
QUIET not { NObjects =only ( objects total) = flush } if
- % Propagate inherited attributes down the page tree.
+ % Propagate inherited attributes down the page tree.
propagateAttributes
(Propagated attributes) now
- % Identify the document-level objects (part 4).
+ % Identify the document-level objects (part 4).
identifyDocumentObjects /CatalogNs exch def
QUIET not { CatalogNs === flush } if
(Identified Catalog) now
- % Identify the first page's objects (part 6),
- % including the Outlines tree if appropriate.
+ % Identify the first page's objects (part 6),
+ % including the Outlines tree if appropriate.
pdfopencache
/FirstPageNs identifyFirstPageObjects def
QUIET not { FirstPageNs === flush } if
(Identified first page) now
- % Identify shared vs. non-shared objects for remaining pages
- % (parts 7 and 8).
+ % Identify shared vs. non-shared objects for remaining pages
+ % (parts 7 and 8).
identifyOtherPageObjects
/SharedNs exch def
@@ -1089,49 +1088,49 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
QUIET not { OtherPageNs === flush SharedNs === flush } if
(Identified other pages) now
- % Identify objects not associated with any page (part 9).
+ % Identify objects not associated with any page (part 9).
/NonPageNs identifyNonPageObjects def
QUIET not { NonPageNs { === } forall flush } if
(Identified non-pages) now
- % Assign final object numbers to all the objects.
- % (The omap is currently empty.)
+ % Assign final object numbers to all the objects.
+ % (The omap is currently empty.)
/FirstPageXN assignObjectNumbers def
(Assigned objects #s) now
- % Write the document-level objects (part 4).
+ % Write the document-level objects (part 4).
{ writePart4 } totemp
/CatalogTempEnd exch def /CatalogTempStart exch def
(Wrote Catalog) now
- % Write the first page's objects (part 6).
+ % Write the first page's objects (part 6).
{ writePart6 } totemp
/FirstPageTempEnd exch def /FirstPageTempStart exch def
(Wrote first page) now
- % Write the non-shared objects for other pages (part 7).
+ % Write the non-shared objects for other pages (part 7).
{ writePart7 /OtherPageLengths exch def } totemp
/OtherPageTempEnd exch def /OtherPageTempStart exch def
(Wrote other pages) now
- % Write the shared objects for other pages (part 8).
+ % Write the shared objects for other pages (part 8).
{ writePart8 } totemp
/SharedTempEnd exch def /SharedTempStart exch def
(Wrote shared objects) now
- % Write the objects not associated with pages (part 9).
+ % Write the objects not associated with pages (part 9).
{ writePart9 } totemp
/NonPageTempEnd exch def /NonPageTempStart exch def
- % Compute conservative lengths of parts 2,3,5,11 of the output.
- % It's OK for these to be too large, but not too small.
+ % Compute conservative lengths of parts 2,3,5,11 of the output.
+ % It's OK for these to be too large, but not too small.
% Make dummy XRef entres for LPDict and PHS.
XRef LPDictN omap 0 ld_put
@@ -1149,8 +1148,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/ObjectsLength % this is exact
CatalogLength FirstPageLength add OtherObjectsLength add def
/XrefLength { % part 11
- % The LPDict must end within the first 1024 bytes,
- % so the start of the FirstPage xref table can't exceed 1024.
+ % The LPDict must end within the first 1024 bytes,
+ % so the start of the FirstPage xref table can't exceed 1024.
writePart11xref 1024 writePart11rest
} tolength def
/NominalFileLength % Make a generous allowance for parts 2,3,5.
@@ -1162,7 +1161,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
NominalFileLength dup 2 mul 2 copy add 1 index dup createLPDict writePart2
} tolength def
- % Compute a few additional values from the above.
+ % Compute a few additional values from the above.
/XrefBeginLength {
(xref\n0 ) ows
@@ -1175,8 +1174,8 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
CatalogLength add % phsstart
/PHSStart exch def
- % Adjust the object positions ignoring PHS.
- % (Writing the PHS needs these.)
+ % Adjust the object positions ignoring PHS.
+ % (Writing the PHS needs these.)
0 0 CatalogStart CatalogTempStart sub adjustObjectPositions
% Make a temporary XRef entry for the PHS, for the benefit of omend.
@@ -1203,7 +1202,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
pop
/PHSLength { writePart5 } tolength def
- % Construct the linearization parameter dictionary (part 2).
+ % Construct the linearization parameter dictionary (part 2).
PHSStart
dup PHSLength add % phsend
@@ -1213,19 +1212,19 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
/XrefStart 1 index def
XrefBeginLength add % xref0start
dup XrefBeginLength sub XrefLength add % fileend
- % Because of a bug, Acrobat Reader doesn't recognize any file
- % shorter than 1K as linearized. Patch this here.
+ % Because of a bug, Acrobat Reader doesn't recognize any file
+ % shorter than 1K as linearized. Patch this here.
% Acrobat 9 insists on 4KB
4096 .max
/FileLength 1 index def
createLPDict
- % Adjust the object positions again, taking the PHS into account.
+ % Adjust the object positions again, taking the PHS into account.
PHSStart 0 PHSLength adjustObjectPositions
(Readjusted positions) now
- % Finally, write the output file.
+ % Finally, write the output file.
writePart1
writePart2
@@ -1243,7 +1242,7 @@ userdict /clostreams 20 dict put % stream -> [data endproc]
FileLength 1 index length sub padto ows
(Wrote output file) now
- % Wrap up.
+ % Wrap up.
TFile closefile TFileName deletefile
end % temporary dict
@@ -1256,7 +1255,7 @@ end % pdfoptdict
% Check for command line arguments.
[ shellarguments {
] dup length 2 eq {
- % Load the pdfwrite utilities if necessary.
+ % Load the pdfwrite utilities if necessary.
/omapinit where { pop } { (pdfwrite.ps) runlibfile } ifelse
save exch
aload pop exch (r) file exch (w) file
diff --git a/gs/lib/pdfwrite.ps b/gs/lib/pdfwrite.ps
index 99e36005a..33751f2da 100644
--- a/gs/lib/pdfwrite.ps
+++ b/gs/lib/pdfwrite.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999, 2000, 2001 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -58,7 +58,7 @@
put put
} ifelse % -
} bind def
-
+
/ld_known { % <ldict> <key> ld_known <bool>
dup 3 1 roll -15 bitshift % key <<>> key<<15
2 copy known {
@@ -67,7 +67,7 @@
pop pop pop //false
} ifelse
} bind def
-
+
/ld_knownget { % <ldict> <key> ld_known false | <any> true
dup 3 1 roll -15 bitshift % key <<>> key<<15
2 copy known {
@@ -175,8 +175,8 @@ readonly def
dup xcheck {
aload pop //pdfwriteprocs exch get exec
} {
- % Because of a bug in Acrobat's parser for linearization parameters,
- % we have to include some whitespace after the opening [ (!).
+ % Because of a bug in Acrobat's parser for linearization parameters,
+ % we have to include some whitespace after the opening [ (!).
([ ) ows { pdfwritevalue (\n) ows } forall (]) ows
} ifelse
} bind def
@@ -208,10 +208,10 @@ readonly def
/pdfcopystring 200 string def
/pdfwritestream { % <streamdict> pdfwritestream -
- % Remove File, FilePosition, and StreamKey;
- % optimize by replacing an indirect Length.
+ % Remove File, FilePosition, and StreamKey;
+ % optimize by replacing an indirect Length.
dup dup length dict copy
- % Stack: origdict dict
+ % Stack: origdict dict
dup /File undef dup /FilePosition undef dup /StreamKey undef
dup /Length known {
dup /Length get dup oforce ne {
@@ -240,7 +240,7 @@ readonly def
} loop pop pop pop
} bind def
/pdfcopystream { % <newstreamdict> <file> pdfcopystream -
- % (file has been positioned)
+ % (file has been positioned)
1 index pdfwritevalue (stream\n) ows
exch /Length get OFile exch pdfcopybytes
(endstream) ows
@@ -249,7 +249,7 @@ readonly def
% ---------------- General values/objects ---------------- %
/pdfwritetypes mark
- % Scalars
+ % Scalars
/nulltype { pop (null) ows } bind
/integertype { =string cvs ows } bind
/booleantype 1 index
@@ -286,7 +286,7 @@ readonly def
} bind
/stringtype { OFile exch write===only } bind
/nametype { pdfwritename } bind
- % Composite/reference objects
+ % Composite/reference objects
/arraytype { pdfwritearray } bind
/packedarraytype 1 index
/dicttype { pdfwritedict } bind
@@ -338,7 +338,7 @@ readonly def
(trailer\n) ows
% Since we always write a complete "classic" xref, the Trailer may need to be adjusted:
% - remove keys that pertain to xref-streams and hybrid-xref PDFs;
- % - if it's a PDF stream, turn it into a PDF dict by removing keys used for
+ % - if it's a PDF stream, turn it into a PDF dict by removing keys used for
% PDF streams (both standard and GS-specific), and the executable attribute
dup /XRefStm known 1 index xcheck or {
dup length dict copy
@@ -364,11 +364,11 @@ readonly def
/ToWrite 100 dict def
omapinit
- % Write the PDF file header.
+ % Write the PDF file header.
pdfwriteheader
- % Write the objects.
+ % Write the objects.
trailer {
exch pop dup xcheck { % The only executable objects are references.
@@ -377,13 +377,13 @@ readonly def
pop
} ifelse
} forall
- % Walk the object graph.
+ % Walk the object graph.
{
ToWrite dup length dup 0 eq { pop pop exit } if
1 sub 2 copy get 3 1 roll undef aload pop pdfwriteobj
} loop
- % Write the xref table and trailer.
+ % Write the xref table and trailer.
/xref OFile fileposition def
0 XRef ld_length 1 add pdfwritexref
diff --git a/gs/lib/pf2afm.ps b/gs/lib/pf2afm.ps
index 70d1631d2..1977aff43 100644
--- a/gs/lib/pf2afm.ps
+++ b/gs/lib/pf2afm.ps
@@ -448,7 +448,6 @@
} ifelse
} bind def
-
% pf[ba]filename makeafm -
/makeafm {
count 0 eq {(Missing font file name\n) printquit} if
@@ -518,7 +517,6 @@
.locksafe
} if
-
pfmn
isPFB {pfbn}{pfan} ifelse
printafm
@@ -536,4 +534,3 @@
}
{pop}
ifelse
-
diff --git a/gs/lib/pfbtopfa.ps b/gs/lib/pfbtopfa.ps
index 51176554e..5ebe9e8f8 100644
--- a/gs/lib/pfbtopfa.ps
+++ b/gs/lib/pfbtopfa.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/ppath.ps b/gs/lib/ppath.ps
index 1d6f56280..b1dd3aac3 100644
--- a/gs/lib/ppath.ps
+++ b/gs/lib/ppath.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989, 1995, 1997 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/pphs.ps b/gs/lib/pphs.ps
index 673687a5a..6d1854c8d 100644
--- a/gs/lib/pphs.ps
+++ b/gs/lib/pphs.ps
@@ -1,12 +1,12 @@
% Copyright (C) 2001 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -39,9 +39,9 @@
dup type /nametype eq 1 index xcheck and {
dup dup (<<) cvn eq exch ([) eq or {
exec exch {
- dup pdftoken dup dup (>>) cvn eq exch (]) eq or {
- exch pop exec exit
- } if exch
+ dup pdftoken dup dup (>>) cvn eq exch (]) eq or {
+ exch pop exec exit
+ } if exch
} loop
} {
exch pop
@@ -87,7 +87,7 @@
/plpdict { % <dict> plpdict -
(<<) = plpkeys {
2 index 2 index .knownget {
- % Stack: dict key label value
+ % Stack: dict key label value
( ) print 3 -1 roll ===only ( ) print ===only
( % ) print =
} {
@@ -170,7 +170,7 @@
/pphs { % <file> pphs -
/pdf exch def
- % Read the linearization parameter dictionary.
+ % Read the linearization parameter dictionary.
{ pdf pdftoken /obj eq { exit } if } loop
pdf pdftoken /lpdict exch def
/lpdict type /dicttype eq { lpdict /Linearized known } { false } ifelse {
@@ -179,13 +179,13 @@
lpdict plpdict flush
- % Read the primary hint stream.
+ % Read the primary hint stream.
null {
pdf pdftoken dup /stream eq { pop exit } if
exch pop
} loop
/phsdict exch def
- % Remove Length if indirect reference.
+ % Remove Length if indirect reference.
phsdict 0 known {
phsdict 0 undef phsdict /Length undef
} if
@@ -194,14 +194,14 @@
dup 64000 string readstring pop exch closefile
sread /phsdata exch def
- % Decode the hint stream data if necessary.
+ % Decode the hint stream data if necessary.
phsdict /Filter .knownget {
phsdata exch filter
dup 5000 string readstring pop exch closefile
sread /phsdata exch def
} if
- % Adobe says we can assume /P = 0.
+ % Adobe says we can assume /P = 0.
(Page Offset Hint Table:) =
lpdict /N get
phsdata phsdict /S get string readstring pop sread
diff --git a/gs/lib/prfont.ps b/gs/lib/prfont.ps
index abd8f717e..7d8f86f1b 100644
--- a/gs/lib/prfont.ps
+++ b/gs/lib/prfont.ps
@@ -37,8 +37,8 @@
% Sort an array. Code used by permission of the author, Aladdin Enterprises.
/sort { % <array> <lt-proc> sort <array>
- % Heapsort (algorithm 5.2.3H, Knuth vol. 2, p. 146),
- % modified for 0-origin indexing. */
+ % Heapsort (algorithm 5.2.3H, Knuth vol. 2, p. 146),
+ % modified for 0-origin indexing. */
10 dict begin
/LT exch def
/recs exch def
@@ -47,23 +47,23 @@
/l N 2 idiv def
/r N 1 sub def {
l 0 gt {
- /l l 1 sub def
- /R recs l get def
+ /l l 1 sub def
+ /R recs l get def
} {
- /R recs r get def
- recs r recs 0 get put
- /r r 1 sub def
- r 0 eq { recs 0 R put exit } if
+ /R recs r get def
+ recs r recs 0 get put
+ /r r 1 sub def
+ r 0 eq { recs 0 R put exit } if
} ifelse
/j l def {
- /i j def
- /j j dup add 1 add def
- j r lt {
- recs j get recs j 1 add get LT { /j j 1 add def } if
- } if
- j r gt { recs i R put exit } if
- R recs j get LT not { recs i R put exit } if
- recs i recs j get put
+ /i j def
+ /j j dup add 1 add def
+ j r lt {
+ recs j get recs j 1 add get LT { /j j 1 add def } if
+ } if
+ j r gt { recs i R put exit } if
+ R recs j get LT not { recs i R put exit } if
+ recs i recs j get put
} loop
} loop
} if recs end
@@ -151,7 +151,7 @@
/Unencoded exch def
/Count Unencoded length def
- % Print the unencoded characters in blocks of 128.
+ % Print the unencoded characters in blocks of 128.
0 128 Unencoded length 1 sub
{ /BlockStart 1 index def
@@ -162,7 +162,7 @@
save
F /Encoding known {
F length dict F
- { 1 index /FID eq { pop pop } { 2 index 3 1 roll put } ifelse }
+ { 1 index /FID eq { pop pop } { 2 index 3 1 roll put } ifelse }
forall dup /Encoding TempEncoding put
/* exch definefont
/F exch def
@@ -192,7 +192,7 @@
/DoCode {DoChar} def
/DoLine {DoCharLine} def
- % Display the first 128 encoded characters.
+ % Display the first 128 encoded characters.
DoTitle (, characters 0-127) show
0 127 DoBlock
@@ -203,7 +203,7 @@
36 0.8 Inch moveto 96 127 DoLine
showpage
- % Display the second 128 encoded characters.
+ % Display the second 128 encoded characters.
DoTitle (, characters 128-255) show
128 255 DoBlock
@@ -216,15 +216,15 @@
F /CharStrings known
{
- % Find and display the unencoded characters.
-
- /Encoded F /Encoding get length dict def
- F /Encoding get { true Encoded 3 1 roll put } forall
- [ F /CharStrings get
- { pop dup Encoded exch known { pop } if }
- forall ] {
- exch Namestring1 cvs exch Namestring2 cvs lt
- } sort DoUnencoded
+ % Find and display the unencoded characters.
+
+ /Encoded F /Encoding get length dict def
+ F /Encoding get { true Encoded 3 1 roll put } forall
+ [ F /CharStrings get
+ { pop dup Encoded exch known { pop } if }
+ forall ] {
+ exch Namestring1 cvs exch Namestring2 cvs lt
+ } sort DoUnencoded
}
if
diff --git a/gs/lib/printafm.ps b/gs/lib/printafm.ps
index f034673e3..9fb6c0dd7 100644
--- a/gs/lib/printafm.ps
+++ b/gs/lib/printafm.ps
@@ -25,142 +25,142 @@
% c toupper - c
/toupper {
- dup dup 8#141 ge exch 8#172 le and {
- 8#40 sub
- } if
+ dup dup 8#141 ge exch 8#172 le and {
+ 8#40 sub
+ } if
} bind def
% print unencoded character metric data lines for glyphs in `v' array
% and reset `v' -
/printv {
- % define a new font with v as its encoding vector
- currentfont maxlength dict /f exch def
- currentfont {
- exch dup dup /FID ne exch /Encoding ne and {
- exch f 3 1 roll put
- } {
- pop pop
- } ifelse
- } forall
- f /Encoding v put
- f /FontName /temp put
- % make this new font the current font
- /temp f definefont setfont
- % print a entry for each character not in old vector
- /e currentfont /Encoding get def
- 0 1 255 {
- dup e exch get
- dup dup /.notdef ne exch s exch known not and {
- exch -1 printmetric
- } {
- pop pop
- } ifelse
- } for
- 0 1 255 {
- v exch /.notdef put
- } for
+ % define a new font with v as its encoding vector
+ currentfont maxlength dict /f exch def
+ currentfont {
+ exch dup dup /FID ne exch /Encoding ne and {
+ exch f 3 1 roll put
+ } {
+ pop pop
+ } ifelse
+ } forall
+ f /Encoding v put
+ f /FontName /temp put
+ % make this new font the current font
+ /temp f definefont setfont
+ % print a entry for each character not in old vector
+ /e currentfont /Encoding get def
+ 0 1 255 {
+ dup e exch get
+ dup dup /.notdef ne exch s exch known not and {
+ exch -1 printmetric
+ } {
+ pop pop
+ } ifelse
+ } for
+ 0 1 255 {
+ v exch /.notdef put
+ } for
} bind def
% printcharmetrics -
/printcharmetrics {
- (StartCharMetrics ) print
- currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if =
- currentfont 1000 scalefont setfont 0 0 moveto
- /e currentfont /Encoding get def
- 0 1 255 {
- dup e exch get
- dup /.notdef ne {
- exch dup printmetric
- } {
- pop pop
- } ifelse
- } for
- % s contains an entry for each name in the original encoding vector
- /s 256 dict def
- e {
- s exch true put
- } forall
- % v is the new encoding vector
- /v 256 array def
- 0 1 255 {
- v exch /.notdef put
- } for
- % fill up v with names in CharStrings
- /i 0 def
- currentfont /CharStrings get {
- pop
- i 255 le {
- v i 3 -1 roll put
- /i i 1 add def
- } {
- printv
- v 0 3 -1 roll put
- /i 1 def
- } ifelse
- } forall
- printv
- (EndCharMetrics) =
+ (StartCharMetrics ) print
+ currentfont /CharStrings get dup length exch /.notdef known { 1 sub } if =
+ currentfont 1000 scalefont setfont 0 0 moveto
+ /e currentfont /Encoding get def
+ 0 1 255 {
+ dup e exch get
+ dup /.notdef ne {
+ exch dup printmetric
+ } {
+ pop pop
+ } ifelse
+ } for
+ % s contains an entry for each name in the original encoding vector
+ /s 256 dict def
+ e {
+ s exch true put
+ } forall
+ % v is the new encoding vector
+ /v 256 array def
+ 0 1 255 {
+ v exch /.notdef put
+ } for
+ % fill up v with names in CharStrings
+ /i 0 def
+ currentfont /CharStrings get {
+ pop
+ i 255 le {
+ v i 3 -1 roll put
+ /i i 1 add def
+ } {
+ printv
+ v 0 3 -1 roll put
+ /i 1 def
+ } ifelse
+ } forall
+ printv
+ (EndCharMetrics) =
} bind def
% name actual_code normal_code printmetric -
/printmetric {
- /saved save def
- (C ) print =only
- ( ; WX ) print
- onechar 0 3 -1 roll put
- onechar stringwidth pop round cvi =only
- ( ; N ) print =only
- ( ; B ) print
- onechar false charpath flattenpath mark pathbbox counttomark {
- counttomark -1 roll
- round cvi =only
- ( ) print
- } repeat pop
- (;) =
- saved restore
+ /saved save def
+ (C ) print =only
+ ( ; WX ) print
+ onechar 0 3 -1 roll put
+ onechar stringwidth pop round cvi =only
+ ( ; N ) print =only
+ ( ; B ) print
+ onechar false charpath flattenpath mark pathbbox counttomark {
+ counttomark -1 roll
+ round cvi =only
+ ( ) print
+ } repeat pop
+ (;) =
+ saved restore
} bind def
% fontname printafm -
/printafm {
- findfont gsave setfont
- (StartFontMetrics 2.0) =
-
- % Print the UniqueID
-
- currentfont /UniqueID known {
- (Comment UniqueID ) print
- currentfont /UniqueID get =only
- (\n) print
- } if
-
- (FontName ) print currentfont /FontName get =
-
- % Print the FontInfo
-
- currentfont /FontInfo get {
- exch
- dup /FSType ne {
- =string cvs dup dup 0 get 0 exch toupper put print
- ( ) print =
- } {
- pop pop
- } ifelse
- } forall
-
- % Print the FontBBox
-
- (FontBBox) print
- currentfont /FontBBox get {
- ( ) print round cvi =only
- } forall
- (\n) print
-
- printcharmetrics
- (EndFontMetrics) =
- grestore
+ findfont gsave setfont
+ (StartFontMetrics 2.0) =
+
+ % Print the UniqueID
+
+ currentfont /UniqueID known {
+ (Comment UniqueID ) print
+ currentfont /UniqueID get =only
+ (\n) print
+ } if
+
+ (FontName ) print currentfont /FontName get =
+
+ % Print the FontInfo
+
+ currentfont /FontInfo get {
+ exch
+ dup /FSType ne {
+ =string cvs dup dup 0 get 0 exch toupper put print
+ ( ) print =
+ } {
+ pop pop
+ } ifelse
+ } forall
+
+ % Print the FontBBox
+
+ (FontBBox) print
+ currentfont /FontBBox get {
+ ( ) print round cvi =only
+ } forall
+ (\n) print
+
+ printcharmetrics
+ (EndFontMetrics) =
+ grestore
} bind def
% Check for command line arguments.
diff --git a/gs/lib/ps2ai.ps b/gs/lib/ps2ai.ps
index 42ba1e995..4720145c4 100644
--- a/gs/lib/ps2ai.ps
+++ b/gs/lib/ps2ai.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1994 , 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -21,10 +21,10 @@
%
/vers {2.14} def % January 31, 1999
-% conditional def ( if the key is already defined before, don't
+% conditional def ( if the key is already defined before, don't
% redefine it. This can be used by other programs to overwrite
% some settings from externally
-%
+%
/cdef { 1 index where { pop pop pop } { def } ifelse } bind def
%
%xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -101,7 +101,7 @@
% 1.72 fixed problem with restore/clip info - (not enough Qs problem)
% 1.71 filter font names to remove previous encoding (|,_,etc)
% 1.7 change text format to AI3, works better with PS & CD
-% 1.67 deal with weird makefonts
+% 1.67 deal with weird makefonts
% 1.66 handle to many bad stroke/fills (s s s w/o paths)
% 1.65 more useable with non-gs interpreters (defaultmatrix fix)
% 1.64 fixed "smart grestore" repeat bug
@@ -133,7 +133,7 @@
matrix identmatrix setmatrix % make ctm [1 0 0 1 0 0]
/bdef {bind def} bind def
/oldgsave {} def /oldgrestore {} def
-/initgraphics {} def /initmatrix {} def
+/initgraphics {} def /initmatrix {} def
% undefine PPD PageSizes to be more printer independant
/letter {} def /legal {} def /a4 {} def /b5 {} def /lettersmall {} def
/setpagedevice { pop } bdef % for level 2 PPD PageSizes
@@ -183,8 +183,8 @@ matrix identmatrix setmatrix % make ctm [1 0 0 1 0 0]
cyan mag yel blk
} bdef
} ifelse
-% If using Mac Ghostscript
-jMacGS {
+% If using Mac Ghostscript
+jMacGS {
% /jeol {(\r) jp} def
/jout true def
(%%Note: Loading ps2ai.ps\n) print
@@ -224,7 +224,7 @@ jout {/jp { joutput exch writestring } bdef }{/jp {print} bdef} ifelse
/ppforall {
cntpaths % find out how many paths are on the stack
jnump 1 gt { (*u\n) jp } if
- {jpm}{jpl}{jpc}{jpp} pathforall
+ {jpm}{jpl}{jpc}{jpp} pathforall
ckpnt
jnump 1 gt { (*U\n) jp } if
/jnump 0 def /clstate false def /dpth false def /fclp false def
@@ -234,23 +234,23 @@ jout {/jp { joutput exch writestring } bdef }{/jp {print} bdef} ifelse
% Painting Operators
%
/oldnewpath [/newpath load] cbdef
-/newpath { (\n) jp /spth 0 def ppforall} bdef
-/stroke { (\n) jp /spth 1 def ppforall } bdef
-/fill {(\n) jp /spth 2 def ppforall } bdef
+/newpath { (\n) jp /spth 0 def ppforall} bdef
+/stroke { (\n) jp /spth 1 def ppforall } bdef
+/fill {(\n) jp /spth 2 def ppforall } bdef
/eofill {(1 D\n) jp fill (0 D\n) jp} bdef
-/clip {clarry gcnt get {(Q\nq\n) jp}{(q\n) jp} ifelse
+/clip {clarry gcnt get {(Q\nq\n) jp}{(q\n) jp} ifelse
/fclp true def clarry gcnt true put} bdef
/eoclip {(1 D\n) jp clip (0 D\n) jp} bdef
%
% Text Operators
%
/oldshow [/show load] cbdef
-/curpt {stringwidth pop jx add jy} bdef
+/curpt {stringwidth pop jx add jy} bdef
/jNN {dup 0 eq {pop oldgsave currentfont /FontMatrix get setmatrix kscl
oldgrestore} if
} bdef
/curftmatrix {
- currentfont /FontMatrix get dup 0 get jNN abs /norm exch def
+ currentfont /FontMatrix get dup 0 get jNN abs /norm exch def
dup 0 get norm div exch dup
1 get norm div exch dup 2 get norm div exch dup 3 get norm div exch dup
4 get exch 5 get 6 array astore matrix currentmatrix matrix concatmatrix
@@ -291,17 +291,17 @@ jstr cvs
jtxt3 {
/j3txt { j3ftxt {(0 Ts 100 Tz 0 Tt 0 TA 0 0 5 TC 100 100 200 TW 0 0 0 Ti\n) jp
(0 Ta 0 Tq 0 0 TI 0 Tc 0 Tw\n) jp} if } bdef
-/show {oldgsave (0 To\n) jp
- currentpoint 2 copy /jy exch def /jx exch def translate
+/show {oldgsave (0 To\n) jp
+ currentpoint 2 copy /jy exch def /jx exch def translate
curftmatrix /jitm exch def
0 1 5 {jitm exch get jpnum} for ( 0 Tp\n) jp (TP\n) jp
(0 Tr\n) jp (\/_) jp curftname curftsize jpnum ( Tf\n) jp
(0) jp j_ax curftsize div 100 mul jpnum ( 100 TC\n) jp % percent(?)
dup curpt moveto mark exch handft ( Tx\n) jp (TO\n) jp /j3ftxt false def
cleartomark currentpoint oldgrestore moveto
-} bdef
+} bdef
/ashow {exch pop exch /j_ax exch def show /j_ax {0} def } bdef
-}
+}
{
/show {oldgsave (u\n) jp currentpoint 2 copy /jy exch def /jx exch def translate
(\/) jp curftname jstr cvs jp
@@ -318,14 +318,14 @@ jtxt3 {
/awidthshow {ashow pop pop pop} bdef
/kshow {show pop} bdef
%/show {true charpath fill} bdef % get outline of charactor
-joutln {/show { true charpath currentpoint
+joutln {/show { true charpath currentpoint
/jy exch def /jx exch def fill jx jy moveto} bdef} if
%/show {oldshow} bdef % do nothing different
%
% Color Operators
%
/oldsetcmykcolor [/setcmykcolor load] cbdef
-/setcmykcolor {oldsetcmykcolor
+/setcmykcolor {oldsetcmykcolor
currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( k\n) jp
currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp
} bdef
@@ -376,7 +376,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp
/currentstate {currentcmykcolor setcmykcolor
currentflat jpnum ( i) jp currentlinecap jpnum ( J) jp
currentlinejoin jpnum ( j) jp currentlinewidth jpnum ( w) jp
- currentmiterlimit jpnum ( M ) jp currentdash exch jpmat jpnum ( d\n) jp
+ currentmiterlimit jpnum ( M ) jp currentdash exch jpmat jpnum ( d\n) jp
} bdef
/jdifG {
currentcmykcolor /jok xdef /joy xdef /jom xdef /joc xdef
@@ -390,7 +390,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp
currentdash /jnod xdef /jnad xdef
% compare old gstate to new gstate
joc jnc ne jom jnm ne joy jny ne jok jnk ne
- jof jnf ne jolc jnlc ne jolj jnlj ne jolw jnlw ne joml jnml ne
+ jof jnf ne jolc jnlc ne jolj jnlj ne jolw jnlw ne joml jnml ne
false joad {true exit} forall {pop pop true}{false} ifelse
false jnad {true exit} forall {pop pop true}{false} ifelse ne
jood jnod ne 10 {or} repeat {currentstate} if
@@ -399,7 +399,7 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp
/gsave {oldgsave /gcnt gcnt 1 add def } bdef % clarry gcnt false put} bdef
% (%%Note:gsave ) jp gcnt jpnum (\n) jp} bdef
/oldgrestore [/grestore load] cbdef
-/grestore {dpth {newpath} if clarry gcnt get {(Q\n) jp clarry gcnt false put} if
+/grestore {dpth {newpath} if clarry gcnt get {(Q\n) jp clarry gcnt false put} if
jdifG /gcnt gcnt 1 sub def } bdef
% oldgrestore currentstate } bdef
% (%%Note:grestore ) jp gcnt 1 add jpnum (\n) jp} bdef
@@ -421,10 +421,10 @@ currentcmykcolor 4 -1 roll jpnum 3 -1 roll jpnum 2 -1 roll jpnum jpnum ( K\n) jp
(Adobe_customcolor /terminate get exec\n) jp
(Adobe_cshow /terminate get exec\n) jp
(Adobe_cmykcolor /terminate get exec\n) jp
- (Adobe_packedarray /terminate get exec\n) jp
+ (Adobe_packedarray /terminate get exec\n) jp
} ifelse
( showpage\n%EOF\n%%EndDocument\n) jp
- jout {joutput closefile} if jMacGS not {quit} if /j3ftxt true def } bdef
+ jout {joutput closefile} if jMacGS not {quit} if /j3ftxt true def } bdef
%
% Error handling
%
diff --git a/gs/lib/ps2ascii.ps b/gs/lib/ps2ascii.ps
index 960ed858e..7547fd77f 100644
--- a/gs/lib/ps2ascii.ps
+++ b/gs/lib/ps2ascii.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1991, 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -27,7 +27,7 @@
%
% P
% Indicate the end of the page.
-%
+%
% S <x> <y> (<string>) <width>
% Display a string.
%
@@ -67,11 +67,11 @@
%% Additional modifications by David M. Jones
%% (dmjones@theory.lcs.mit.edu), December 23, 1997
-%%
+%%
%% (a) Rewrote forall loop at the end of .show.write. This fixes a
%% stack leakage problem, but the changes are more significant
-%% than that.
-%%
+%% than that.
+%%
%% .char.map includes the names of all characters in the
%% StandardEncoding, ISOLatin1Encoding, OT1Encoding and
%% T1Encoding vectors. Thus, if the Encoding vector for the
@@ -89,25 +89,25 @@
%% fix (a) under my 1996 changes) completely obsolete, since
%% there's additional useful information I can extract in that
%% case.]
-%%
+%%
%% Overall, this should provide better support for some documents
%% (e.g, DVILASER documents will no longer be translated into a
%% series of *'s) without breaking any other documents any worse
%% than they already were broken.
-%%
+%%
%% (b) Fixed two bugs in dvips.df-tail: (1) changed "dup 127" to "dup
%% 128" to fix fencepost error, and (2) gave each font it's own
%% FontName rather than having all fonts share the same name.
-%%
+%%
%% (c) Added one further refinement to the heuristic for detecting
%% paragraph breaks: do not ever start a new paragraph after a
%% line ending in a hyphen.
-%%
+%%
%% (d) Added a bunch of missing letters from the T1Encoding,
%% OT1Encoding and ISOLatin1Encoding vectors to .letter.chars to
%% improve hyphen-elimination algorithm. This still won't help
%% if there's no useful Encoding vector.
-%%
+%%
%% NOTE: A better solution to the problem of missing Encoding vectors
%% might be to redefine definefont to check whether the Encoding
%% vector is sensible and, if not, replace it by a default. This
@@ -121,7 +121,7 @@
%%* (dmjones@theory.lcs.mit.edu), June 25-July 8, 1996
%%* Modifications:
-%%*
+%%*
%%* (a) added code to give better support for dvips files by providing
%%* FontBBox's, FontName's and Encoding vectors for downloaded
%%* bitmap fonts. This is done by using dvips's start-hook to
@@ -129,7 +129,7 @@
%%* define its Type 3 bitmap fonts. Thus, this change should
%%* provide better support for dvips-generated PS files without
%%* affecting the handling of other documents.
-%%*
+%%*
%%* (b) Fixed two bugs that could potentially affect any PS file, not
%%* just those created by dvips: (1) added missing "get" operator
%%* in .show.write and (2) fixed bug that caused a hyphen at the
@@ -137,9 +137,9 @@
%%* deleted. Note that the first bug was a source of stack
%%* leakage, causing ps2ascii to run out of operand stack space
%%* occasionally.
-%%*
+%%*
%%* Search for "%%* BF" to find these modifications.
-%%*
+%%*
%%* (c) Improved the heuristic for determining whether a line break
%%* has occurred and whether a line break represents a paragraph
%%* break. Previously, any change in the vertical position caused
@@ -152,16 +152,16 @@
%%* comparing the vertical distance between the new line and the
%%* previous line to the vertical distance between the previous
%%* line and its predecessor.
-%%*
+%%*
%%* (d) Added a hook for renaming the files where stdout and stderr
%%* go.
-%%*
+%%*
%%* In general, my additions or changes to the code are described in
%%* comments beginning with "%%*". However, there are numerous other
%%* places where I have either re-formatted code or added comments to
%%* the code while I was trying to understand it. These are usually
%%* not specially marked.
-%%*
+%%*
/QUIET true def
systemdict wcheck { systemdict } { userdict } ifelse begin
@@ -200,11 +200,11 @@ ifelse
} odef
/.fillcomplex
{ % Do a first pass to see if the path is all rectangles in
- % the output coordinate system. We don't worry about overlapping
- % rectangles that might be partially not filled.
- % Stack: mark llx0 lly0 urx0 ury0 ... true mark x0 y0 ...
+ % the output coordinate system. We don't worry about overlapping
+ % rectangles that might be partially not filled.
+ % Stack: mark llx0 lly0 urx0 ury0 ... true mark x0 y0 ...
mark true mark
- % Add a final moveto so we pick up any trailing unclosed subpath.
+ % Add a final moveto so we pick up any trailing unclosed subpath.
0 0 itransform moveto
{ .coord counttomark 2 gt
{ counttomark 4 gt { .fillcheckrect } { 4 2 roll pop pop } ifelse }
@@ -216,7 +216,7 @@ ifelse
pathforall cleartomark
{ .showcolor counttomark 4 idiv
{ counttomark -4 roll .orderrect
- (R ) //print .show==4
+ (R ) //print .show==4
}
repeat pop
}
@@ -226,16 +226,16 @@ ifelse
} odef
/.fillcheckrect
{ % Check whether the current subpath is a rectangle.
- % If it is, add it to the list of rectangles being accumulated;
- % if not exit the .fillcomplex loop.
- % The subpath has not been closed.
- % Stack: as in .fillcomplex, + newx newy
+ % If it is, add it to the list of rectangles being accumulated;
+ % if not exit the .fillcomplex loop.
+ % The subpath has not been closed.
+ % Stack: as in .fillcomplex, + newx newy
counttomark 10 eq { 9 index 9 index 4 2 roll } if
counttomark 12 ne { cleartomark not mark exit } if
12 2 roll
- % Check for the two possible forms of rectangles:
- % x0 y0 x0 y1 x1 y1 x1 y0 x0 y0
- % x0 y0 x1 y0 x1 y1 x0 y1 x0 y0
+ % Check for the two possible forms of rectangles:
+ % x0 y0 x0 y1 x1 y1 x1 y0 x0 y0
+ % x0 y0 x1 y0 x1 y1 x0 y1 x0 y0
9 index 2 index eq 9 index 2 index eq and
10 index 9 index eq
{ % Check for first form.
@@ -246,7 +246,7 @@ ifelse
8 index 7 index eq and 5 index 4 index eq and 4 index 3 index eq and
}
ifelse not { cleartomark not mark exit } if
- % We have a rectangle.
+ % We have a rectangle.
pop pop pop pop 4 2 roll pop pop 8 4 roll
} odef
/eofill { COMPLEX { .fillcomplex } if newpath } codef
@@ -265,10 +265,10 @@ ifelse
ifelse stroke grestore
} codef
/.strokeline % <fromx> <fromy> <tox> <toy> .strokeline <tox> <toy>
- % Note: fromx and fromy are in output coordinates;
- % tox and toy are in user coordinates.
+ % Note: fromx and fromy are in output coordinates;
+ % tox and toy are in user coordinates.
{ .coord 2 copy 6 2 roll .orderrect
- % Add in the line width. Assume square or round caps.
+ % Add in the line width. Assume square or round caps.
currentlinewidth 2 div dup .dcoord add abs 1 .max 5 1 roll
4 index add 4 1 roll 4 index add 4 1 roll
4 index sub 4 1 roll 5 -1 roll sub 4 1 roll
@@ -276,8 +276,8 @@ ifelse
} odef
/.strokecomplex
{ % Do a first pass to see if the path is all horizontal and vertical
- % lines in the output coordinate system.
- % Stack: true mark origx origy curx cury
+ % lines in the output coordinate system.
+ % Stack: true mark origx origy curx cury
true mark null null null null
{ .coord 6 2 roll pop pop pop pop 2 copy }
{ .coord 1 index 4 index eq 1 index 4 index eq or
@@ -294,8 +294,8 @@ ifelse
}
pathforall cleartomark
0 currentlinewidth .dcoord 0 eq exch 0 eq or and
- % Do the second pass to write out the rectangles.
- % Stack: origx origy curx cury
+ % Do the second pass to write out the rectangles.
+ % Stack: origx origy curx cury
{ .showcolor null null null null
{ 6 2 roll pop pop pop pop 2 copy .coord }
{ .strokeline }
@@ -354,17 +354,17 @@ ifelse
1000 mul round cvi
3 1 roll 1000 mul round cvi
exch 1000 mul round cvi
- % Stack: b g r
+ % Stack: b g r
dup //.color.r .iget eq
2 index //.color.g .iget eq and
3 index //.color.b .iget eq and
{ pop pop pop
}
{ (C ) //print
- dup //.color.r exch .iput .show==only
+ dup //.color.r exch .iput .show==only
( ) //print dup //.color.g exch .iput .show==only
( ) //print dup //.color.b exch .iput .show==only
- (\n) //print
+ (\n) //print
}
ifelse
}
@@ -383,10 +383,10 @@ ifelse
% 0.1 0 2 index dtransform abs exch abs .max /.show.scale exch def
% 0.1 dup 3 -1 roll scale
gsave initmatrix
- % Assume the original transformation is well-behaved...
+ % Assume the original transformation is well-behaved...
0.1 0 dtransform abs exch abs .max
0.1 dup scale .show.ident.matrix currentmatrix
- % ... but undo any rotation into landscape orientation.
+ % ... but undo any rotation into landscape orientation.
dup 0 get 0 eq {
1 get dup abs div 90 mul rotate
.show.ident.matrix currentmatrix
@@ -400,8 +400,8 @@ ifelse
} odef
/.dcoord { % <dx> <dy> .coord <dx'> <dy'>
- % Transforming distances is trickier, because
- % the coordinate system might be rotated.
+ % Transforming distances is trickier, because
+ % the coordinate system might be rotated.
.show.ident pop 3 1 roll
exch 0 dtransform
dup mul exch dup mul add sqrt
@@ -458,7 +458,7 @@ ifelse
} odef
/.showwidth % Same as stringwidth, but disable COMPLEX so that
- % we don't try to detect rectangles during BuildChar.
+ % we don't try to detect rectangles during BuildChar.
{ COMPLEX
{ /COMPLEX false def stringwidth /COMPLEX true def }
{ stringwidth }
@@ -467,7 +467,7 @@ ifelse
/.showfont % <string> .showfont <string>
{ gsave
- % Try getting the height and width of the font from the FontBBox.
+ % Try getting the height and width of the font from the FontBBox.
currentfont /FontBBox .knownget not { {0 0 0 0} } if
aload pop % llx lly urx ury
exch 4 -1 roll % lly ury urx llx
@@ -478,24 +478,24 @@ ifelse
{ currentfont /FontMatrix get dtransform
}
{ pop pop
- % Fonts produced by dvips, among other applications, have
- % BuildChar procedures that bomb out when given unexpected
- % characters, and there is no way to determine whether a given
- % character will do this. So for Type 1 fonts, we measure a
- % typical character ('X'); for others, we punt.
- currentfont /FontType get 1 eq
- { (X) .showwidth pop dup 1.3 mul
- }
- { % No safe way to get the character size. Punt.
- 0 0
- }
- ifelse
+ % Fonts produced by dvips, among other applications, have
+ % BuildChar procedures that bomb out when given unexpected
+ % characters, and there is no way to determine whether a given
+ % character will do this. So for Type 1 fonts, we measure a
+ % typical character ('X'); for others, we punt.
+ currentfont /FontType get 1 eq
+ { (X) .showwidth pop dup 1.3 mul
+ }
+ { % No safe way to get the character size. Punt.
+ 0 0
+ }
+ ifelse
}
ifelse .dcoord exch
currentfont /FontName .knownget not { () } if
dup type /stringtype ne { //.show.string cvs } if
grestore
- % Stack: height width fontname
+ % Stack: height width fontname
SIMPLE
{ pop pop //.show.height exch .iput }
{ 2 index //.font.height .iget eq
@@ -504,9 +504,9 @@ ifelse
{ pop pop pop
}
{ (F ) //print
- 3 -1 roll dup //.font.height exch .iput .show==only ( ) //print
+ 3 -1 roll dup //.font.height exch .iput .show==only ( ) //print
exch dup //.font.width exch .iput .show==only ( ) //print
- dup length //.font.name.length exch .iput
+ dup length //.font.name.length exch .iput
//.font.name cvs .show==only (\n) //print
}
ifelse
@@ -550,7 +550,7 @@ mark
/Eogonek
/Eth
/Gbreve
- /Germandbls
+ /Germandbls
/IJ
/Iacute
/Icircumflex
@@ -776,7 +776,7 @@ mark
%%* just provide support for the two most popular text encodings, the
%%* OT1 and T1 encodings, and just accept the fact that any font not
%%* using one of those encodings will be rendered as gibberish.
-%%*
+%%*
%%* OT1 is Knuth's 7-bit encoding for the CMR text fonts, while T1
%%* (aka the Cork encoding) is the 8-bit encoding used by the DC
%%* fonts, a preliminary version of the proposed Extended Computer
@@ -784,7 +784,7 @@ mark
%%* they differ in positions 8#000 through 8#040, 8#074, 8#076, 8#134,
%%* 8#137, 8#173, 8#174, 8#175 and 8#177, so we can't use the same
%%* vector for both.
-%%*
+%%*
%%* Of course, we also can't reliably tell the difference between an
%%* OT1-encoded font and a T1-encoded font based on the information in
%%* a dvips-created PostScript file. As a best-guess solution, we'll
@@ -955,7 +955,7 @@ mark
8#334 /Udieresis
8#335 /Yacute
8#336 /Thorn
- 8#337 /Germandbls
+ 8#337 /Germandbls
8#340 /agrave
8#341 /aacute
@@ -1144,9 +1144,9 @@ mark
{
/nn 9 dict N
nn begin
- %%
+ %%
%% Choose an encoding based on the highest position occupied.
- %%
+ %%
dup 128 gt { T1Encoding } { OT1Encoding } ifelse
/Encoding X
/FontType 3 N
@@ -1154,18 +1154,18 @@ mark
%% It's ok for all the fonts to share a FontMatrix, but they
%% need to have separate FontBBoxes
%%
- /FontMatrix fntrx N
- /FontBBox [0 0 0 0] N
+ /FontMatrix fntrx N
+ /FontBBox [0 0 0 0] N
string /base X
array /BitMaps X
%%
%% And let's throw in a FontName for good measure
%%
dup ( ) cvs
- %%
+ %%
%% Make sure each font gets it own private FontName. -- dmj,
%% 12/23/97
- %%
+ %%
dup length string copy
/FontName X
/BuildChar {CharBuilder} N
@@ -1206,7 +1206,7 @@ mark
} if
put % puts char-data into BitMaps at index ctr
/ctr ctr 1 add N
-%%
+%%
%% Make sure the Font Bounding Box encloses the Bounding Box of the
%% current character
%%
@@ -1227,12 +1227,12 @@ mark
dup % calculate new urx
dup 2 get
ch-dx ch-width add
- .max
+ .max
2 exch put
dup 3 get % calculate new ury
ch-yoff
- .max
+ .max
3 exch put
} def
@@ -1308,7 +1308,7 @@ userdict /start-hook {
}
{ pop
}
- ifelse
+ ifelse
.show.stdout exch writestring
}
ifelse
@@ -1324,11 +1324,11 @@ userdict /start-hook {
{ % x y string width
2 index % x y string width y
//.show.y .iget % x y string width y old.y
- %%*
+ %%*
%%* Replaced test "has y changed" by "has y changed by more
%%* than the current font height" so that subscripts and
%%* superscripts won't cause line/paragraph breaks
- %%*
+ %%*
sub abs dup % x y string width dy dy
//.show.height .iget
gt
@@ -1398,7 +1398,7 @@ userdict /start-hook {
% newpar?
{ (\n\n) } % Paragraph
{ % Line
- %%*
+ %%*
%%* BF2: If last character on a line is
%%* a hyphen, we omit the hyphen and
%%* run the lines together. Of
@@ -1429,12 +1429,12 @@ userdict /start-hook {
//.show.last 0 get .hyphen eq { (-) //print } if
}
ifelse
- %%*
+ %%*
%%* If have moved more than 1 point to
%%* the right, interpret it as a
%%* space? This need to be looked at
%%* more closely.
- %%*
+ %%*
3 index % x y string width x
//.show.x .iget 10 add gt % x y string width bool
{ ( ) //print }
@@ -1488,8 +1488,8 @@ userdict /start-hook {
} codef
/kshow
{ .showfont .showcolor
- %**************** Should construct a closure, in case the procedure
- %**************** affects the o-stack.
+ %**************** Should construct a closure, in case the procedure
+ %**************** affects the o-stack.
{ .show1 dup exec } forall pop
} codef
diff --git a/gs/lib/ps2epsi.ps b/gs/lib/ps2epsi.ps
index f8ef77198..f985c4f7d 100644
--- a/gs/lib/ps2epsi.ps
+++ b/gs/lib/ps2epsi.ps
@@ -1,13 +1,12 @@
-
% Copyright (C) 1990, 2000 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -52,24 +51,24 @@
/ps2edict where { pop } { /ps2edict 25 dict def } ifelse
ps2edict begin
- % The main procedure
+ % The main procedure
/ps2epsi
- {
- % bbox written to outfile by bbox device from ps2epsi command file
- outfile (r) file /epsifile exch def
- /BBoxString epsifile 256 string readline pop def
- /HiresBBoxString epsifile 256 string readline pop def
- epsifile closefile
- % Open the file
+ {
+ % bbox written to outfile by bbox device from ps2epsi command file
+ outfile (r) file /epsifile exch def
+ /BBoxString epsifile 256 string readline pop def
+ /HiresBBoxString epsifile 256 string readline pop def
+ epsifile closefile
+ % Open the file
outfile (w) file /epsifile exch def
- % Get the device parameters
- currentdevice getdeviceprops .dicttomark
+ % Get the device parameters
+ currentdevice getdeviceprops .dicttomark
/HWSize get aload pop
/devheight exch def
/devwidth exch def
matrix defaultmatrix
/devmatrix exch def
- % Make a corresponding 8-bit deep memory device
+ % Make a corresponding 8-bit deep memory device
devmatrix devwidth devheight
256 string 0 1 255 { 1 index exch dup 255 exch sub put } for
makeimagedevice
@@ -82,7 +81,7 @@ ps2edict begin
/rowwidth devwidth def
/row rowwidth string def
/zerorow rowwidth string def % all zero
- % Replace the definition of showpage
+ % Replace the definition of showpage
userdict /showpage { ps2edict begin epsipage end } bind put
userdict /setfont { ps2edict begin epsisetfont end } bind put
userdict /setpagedevice /pop load put
@@ -116,85 +115,84 @@ ps2edict begin
} bind def
/margintest { % <y-start> <step> <y-limit> margintest <y-non-blank>
- % <y-start> <step> <y-limit> margintest -
+ % <y-start> <step> <y-limit> margintest -
{ dup arraydevice exch row getscanline
zerorow ne { exit } if pop
} for
} bind def
-
/epsiNameStr 200 string def
/epsiNpages 0 def
/epsiNpageStr 20 string def
/epsipage
- {
+ {
/epsiNpages epsiNpages 1 add def
/loopcount devheight 1 sub def
% Find top margin -- minimum Y of non-blank scan line.
-1 0 1 loopcount margintest
- dup -1 eq { (blank page!!\n) print quit }{ exch pop } ifelse
+ dup -1 eq { (blank page!!\n) print quit }{ exch pop } ifelse
/tm exch def
% Find bottom margin -- maximum Y of non-blank scan line.
loopcount -1 0 margintest
/bm exch def
-
+
% Initialise limit variables
/loopcount rowwidth 1 sub def
- /lm loopcount def
- /rm 0 def
+ /lm loopcount def
+ /rm 0 def
% Find left and right boundaries of image
tm 1 bm
{ % Get more data
- arraydevice exch row getscanline pop
- % Scan from left to find first non-zero element
- % We save first the element, then the index
- -1 0 1 loopcount
- { dup row exch get 0 ne { exch pop exit }{ pop } ifelse
- } for
- % If we found -1, row is blank ..
- dup -1 ne
- { % Find the leftmost index
+ arraydevice exch row getscanline pop
+ % Scan from left to find first non-zero element
+ % We save first the element, then the index
+ -1 0 1 loopcount
+ { dup row exch get 0 ne { exch pop exit }{ pop } ifelse
+ } for
+ % If we found -1, row is blank ..
+ dup -1 ne
+ { % Find the leftmost index
dup lm lt
% If the new index is less, we save index and element
{ /lm exch def } { pop } ifelse
- % Now find the rightmost index
- loopcount -1 0
+ % Now find the rightmost index
+ loopcount -1 0
{ dup row exch get 0 ne { exit }{ pop } ifelse
} for
- dup rm gt
+ dup rm gt
% If the new index is greater, we save index and element
{ /rm exch def } { pop } ifelse
- } if
+ } if
} for
% Write out the magic string and bounding box information
epsifile (%!PS-Adobe-2.0 EPSF-1.2\n) writestring
- /epsititle where { pop epsifile epsititle writestring } if
- /epsicreator where { pop epsifile epsicreator writestring } if
- /epsicrdt where { pop epsifile epsicrdt writestring } if
- /epsifor where { pop epsifile epsifor writestring } if
+ /epsititle where { pop epsifile epsititle writestring } if
+ /epsicreator where { pop epsifile epsicreator writestring } if
+ /epsicrdt where { pop epsifile epsicrdt writestring } if
+ /epsifor where { pop epsifile epsifor writestring } if
epsifile flushfile
- % Write out the page count:
- epsifile (%%Pages: ) writestring
- epsifile epsiNpages epsiNpageStr cvs writestring
- epsifile (\n) writestring
+ % Write out the page count:
+ epsifile (%%Pages: ) writestring
+ epsifile epsiNpages epsiNpageStr cvs writestring
+ epsifile (\n) writestring
epsifile flushfile
- % Write out the list of used fonts:
- epsifile (%%DocumentFonts:) writestring
- epsifontdict {
- epsifile ( ) writestring
- pop epsiNameStr cvs epsifile exch writestring
- } forall
- epsifile (\n) writestring
+ % Write out the list of used fonts:
+ epsifile (%%DocumentFonts:) writestring
+ epsifontdict {
+ epsifile ( ) writestring
+ pop epsiNameStr cvs epsifile exch writestring
+ } forall
+ epsifile (\n) writestring
epsifile flushfile
- epsifile BBoxString writestring epsifile (\r) writestring
- epsifile HiresBBoxString writestring epsifile (\r) writestring
+ epsifile BBoxString writestring epsifile (\r) writestring
+ epsifile HiresBBoxString writestring epsifile (\r) writestring
% Define character and bit widths for the output line buffer:
/cwidth rm lm sub 1 add def
@@ -213,14 +211,14 @@ ps2edict begin
tm 1 bm
{ % Get a scan line interval from the array device
- arraydevice exch row copyscanlines lm cwidth getinterval
- % Write out the hex data as 40 bytes per line (82 chars)
- 0 40 cwidth
- { epsifile (% ) writestring
- epsifile exch 2 index exch
- dup cwidth exch sub 40 .min getinterval writehexstring
- epsifile (\n) writestring
- } for
+ arraydevice exch row copyscanlines lm cwidth getinterval
+ % Write out the hex data as 40 bytes per line (82 chars)
+ 0 40 cwidth
+ { epsifile (% ) writestring
+ epsifile exch 2 index exch
+ dup cwidth exch sub 40 .min getinterval writehexstring
+ epsifile (\n) writestring
+ } for
pop
} for
@@ -233,9 +231,8 @@ ps2edict begin
DonePage 0 1 put
} bind def
-
(outfile) getenv
- { /outfile exch def
+ { /outfile exch def
ps2epsi
/DonePage 1 string def
diff --git a/gs/lib/rollconv.ps b/gs/lib/rollconv.ps
index 90b8c1522..f399be76b 100644
--- a/gs/lib/rollconv.ps
+++ b/gs/lib/rollconv.ps
@@ -57,13 +57,12 @@
% or
% /HGGothicBPRO-83pv-RKSJ-H 36 selectfont
-
/macrfile % <filename> macrfile <file>
{ (r) file
fromMac
{ % Get rid of the initial Mac garbage (128 characters).
- % The garbage at the end is unpredictable,
- % so we'll just have to hope that it's all nulls.
+ % The garbage at the end is unpredictable,
+ % so we'll just have to hope that it's all nulls.
dup =string 0 128 getinterval readstring pop pop
}
if
@@ -79,7 +78,7 @@
/inprefix InDir (/) concatstrings FName concatstrings (-) concatstrings def
/inh inprefix (H) concatstrings def
- % Open the output file.
+ % Open the output file.
/OutDot OutDir (/) concatstrings OutBase concatstrings (.) concatstrings def
/outname OutDot (ps) concatstrings def
@@ -89,7 +88,7 @@ QUIET not { (Writing ) print outname = flush } if
/out outname (w) file def
/buffer 65000 string def
- % Copy the initial comments from the input file.
+ % Copy the initial comments from the input file.
inh macrfile
{ dup =string readline pop
@@ -98,7 +97,7 @@ inh macrfile
}
loop
- % Write out our preamble.
+ % Write out our preamble.
out (
currentpacking true setpacking
@@ -142,13 +141,13 @@ userdict /AltsysCFD3 25 dict dup begin
{ privates exch get 3 1 roll pop pop
}
{ 7 dict begin
- /MinFeature{16 16}executeonly def
- /BlueValues BlueValues def
- /StdVW 3 -1 roll 1 array astore def
- /StdHW 3 -1 roll 1 array astore def
- /password 5839 def
- /LanguageGroup 1 def
- /Subrs Subrs def
+ /MinFeature{16 16}executeonly def
+ /BlueValues BlueValues def
+ /StdVW 3 -1 roll 1 array astore def
+ /StdHW 3 -1 roll 1 array astore def
+ /password 5839 def
+ /LanguageGroup 1 def
+ /Subrs Subrs def
currentdict readonly end
privates 2 index 2 index put exch pop
}
@@ -178,7 +177,7 @@ end put
%END
) writestring
- % Locate and copy the definition of NotDefFont.
+ % Locate and copy the definition of NotDefFont.
out (
FontDirectory /NotDefFont known { (%END) .skipeof } if
@@ -195,9 +194,9 @@ loop out (definefont pop
%END
) writestring
- % Copy the definitions of the subfonts, moving the
- % CharStrings of the Roman supplement to an external file.
- % Stack for pattern procedures: infile line
+ % Copy the definitions of the subfonts, moving the
+ % CharStrings of the Roman supplement to an external file.
+ % Stack for pattern procedures: infile line
/CSRName OutDot (CSR) concatstrings def
/csr CSRName (w) file def
@@ -206,8 +205,8 @@ QUIET not { (Writing ) print CSRName = flush } if
/encoding 256 array def
/patterns [
- % Patterns specific to the Roman supplement, in which
- % the outlines are in an eexec section.
+ % Patterns specific to the Roman supplement, in which
+ % the outlines are in an eexec section.
{ (/Encoding 256 array) {
pop out (/Encoding ) writestring
{ dup buffer readline pop
@@ -216,8 +215,8 @@ QUIET not { (Writing ) print CSRName = flush } if
loop
{ % Stack: infile dupline postdup (dup) predup
pop pop exch pop
- % The top element of the stack is a string beginning with
- % an index and value to put into the Encoding.
+ % The top element of the stack is a string beginning with
+ % an index and value to put into the Encoding.
token pop exch token pop exch pop encoding 3 1 roll put
dup buffer readline pop
dup (dup) search not { pop exit } if
@@ -238,8 +237,8 @@ QUIET not { (Writing ) print CSRName = flush } if
dup //.eexec_param_dict /eexecDecode filter
} }
{ (dup/CharStrings ) {
- % Copy the individual CharStrings to the CSR file,
- % recording the lengths and offsets.
+ % Copy the individual CharStrings to the CSR file,
+ % recording the lengths and offsets.
pop out (dup/CharStrings AltsysCFD3 /CharStrings get put\n) writestring
/offsets 256 dict def
{ dup token pop % char name
@@ -252,7 +251,7 @@ QUIET not { (Writing ) print CSRName = flush } if
dup buffer readline pop pop % skip ND
}
loop
- % We skipped the 'end'; skip the 'readonly put' as well.
+ % We skipped the 'end'; skip the 'readonly put' as well.
2 { dup token pop pop } repeat
out (dup/PGOffsets ) writestring
out csr fileposition write=only
@@ -279,7 +278,7 @@ QUIET not { (Writing ) print CSRName = flush } if
pop out (end % systemdict\n) writestring
closefile
} }
- % Patterns for other supplements.
+ % Patterns for other supplements.
{ (pgfonts/) {
{ cdfromstr search not { exit } if
out exch writestring pop out cdstr writestring
@@ -305,7 +304,7 @@ QUIET not { (Writing ) print CSRName = flush } if
(end def) search { pop pop pop exit } if
(/Std) search
{ pop pop dup length 3 sub 3 exch getinterval
- (]) search pop out ( ) writestring out exch writestring pop
+ (]) search pop out ( ) writestring out exch writestring pop
}
if pop
}
@@ -329,7 +328,7 @@ QUIET not { (Writing ) print CSRName = flush } if
forall
csr closefile
- % Copy the definition of the root font.
+ % Copy the definition of the root font.
dup buffer readstring pop out exch writestring closefile
out (
@@ -337,7 +336,7 @@ setpacking
) writestring
out closefile
- % Remove the Mac garbage from the outline files.
+ % Remove the Mac garbage from the outline files.
[ (COD) (CSA) ]
{ CDir (/) concatstrings (JIS83-1_) concatstrings
@@ -345,9 +344,9 @@ out closefile
exch OutDot exch concatstrings
QUIET not { (Writing ) print dup = flush } if
(w) file
- % Stack: infile outfile
+ % Stack: infile outfile
{ 1 index buffer readstring exch
- % Stack: infile outfile noteof substring
+ % Stack: infile outfile noteof substring
2 index exch writestring not { exit } if
}
loop closefile closefile
diff --git a/gs/lib/showchar.ps b/gs/lib/showchar.ps
index 87ab608fe..3172449f5 100644
--- a/gs/lib/showchar.ps
+++ b/gs/lib/showchar.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993, 1994, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -37,7 +37,7 @@
} def
/bitselectfont % <fontname> <scale> bitselectfont -
{ exch findfont exch scalefont setfont
- % Compute the bounding box in device coordinates.
+ % Compute the bounding box in device coordinates.
gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
currentfont /FontMatrix get concat
currentfont /FontBBox get aload pop
@@ -70,7 +70,7 @@
0 setlinewidth
gsave 0.5 1 0.5 setrgbcolor hpath exec mmx markpath grestore
0 0.5 1 setrgbcolor hpath exec stroke
- % Show the hints for Type 1 fonts also.
+ % Show the hints for Type 1 fonts also.
currentfont /FontType get 1 eq
{ gsave 1 0 0 setrgbcolor
0 lly M idtransform translate
diff --git a/gs/lib/stcinfo.ps b/gs/lib/stcinfo.ps
index 192101348..13a051016 100644
--- a/gs/lib/stcinfo.ps
+++ b/gs/lib/stcinfo.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995 Aladdin Enterprises. All rights reserved
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -17,13 +17,13 @@
% stcinfo.ps
% Epson Stylus-Color Printer-Driver
-% The purpose of this file is to print & show Parameters of the
-% stcolor-driver. If not run on ghostscript/stcolor, it prints
+% The purpose of this file is to print & show Parameters of the
+% stcolor-driver. If not run on ghostscript/stcolor, it prints
% something like a color-chart.
% use either existing STCinfo-dictionary, retrieve new one or create dummy
-statusdict begin product end
+statusdict begin product end
dup (Ghostscript) eq 1 index (Aladdin Ghostscript) eq or
exch (AFPL Ghostscript) eq or{
@@ -65,12 +65,10 @@ exch (AFPL Ghostscript) eq or{
/colortri_bg {pop pop 0.85 dup dup} bind def
-
% +---------------------------------------------------------------------+
% | Besides from fixing bugs, nothing should be changed below this line |
% +---------------------------------------------------------------------+
-
% Arbitrary operation on a pair of vectors, *CHANGES* 1st.
% invoke: Vaccu Vop op vop
/vop {
@@ -85,7 +83,6 @@ exch (AFPL Ghostscript) eq or{
% Compute sum of vectors elements
/vsum {0.0 exch{add}forall} bind def
-
% Sum up products of elements
/veqn { [ 3 -1 roll {} forall ] exch vmul vsum } bind def
@@ -105,7 +102,7 @@ exch (AFPL Ghostscript) eq or{
% Procedure to *CHANGE* transform rgb->xy
/rgb2xy {
- rgb2xyz
+ rgb2xyz
dup 0 get 1 index 1 get 2 index vsum % XYZ X Y sum
dup 0 ne {
exch 1 index div 3 1 roll div % XYZ y x
@@ -125,7 +122,6 @@ exch (AFPL Ghostscript) eq or{
/colortri_scale exch def
/colortri_box exch def
-
% Prepare some useful constants for xy -> RGB conversion
/colsum [ % Array with column-sums
@@ -136,7 +132,7 @@ exch (AFPL Ghostscript) eq or{
/Yrow colortri_mat 3 3 getinterval def
% Avoid allocating new arrays
- /xcoeff 3 array def
+ /xcoeff 3 array def
/ycoeff 3 array def
% Procedure to derive RGB-Values form X,Y
@@ -151,13 +147,13 @@ exch (AFPL Ghostscript) eq or{
1e-6 lt { % No Pivot ?
pop colortri_bg xcoeff astore pop
}{ % Have a Pivot
- dup ycoeff exch get neg
+ dup ycoeff exch get neg
0 1 2 { dup ycoeff exch get 2 index div ycoeff 3 1 roll put} for
pop ycoeff 1 index 0 put
- xcoeff 1 index get
- 0 1 2 {
- ycoeff 1 index get 2 index mul xcoeff 2 index get add
+ xcoeff 1 index get
+ 0 1 2 {
+ ycoeff 1 index get 2 index mul xcoeff 2 index get add
xcoeff 3 1 roll put
} for
pop xcoeff 1 index 0 put
@@ -165,23 +161,23 @@ exch (AFPL Ghostscript) eq or{
pop pop colortri_bg xcoeff astore pop
}{
dup 2 index or 3 exch sub
- xcoeff 1 index get xcoeff 3 index get div neg
+ xcoeff 1 index get xcoeff 3 index get div neg
xcoeff exch 3 index exch put
xcoeff 1 index 1 put
ycoeff exch get ycoeff 2 index get xcoeff 4 -1 roll get mul add
xcoeff 3 1 roll put
- 0 1 2 {
+ 0 1 2 {
xcoeff exch get dup -0.0015 lt exch 1.0015 gt or {
colortri_bg xcoeff astore dup exit
} if
} for
- pop pop xcoeff
+ pop pop xcoeff
} ifelse
} ifelse
} bind def
% Compute the displayed range
- [ 1 1 1 ] rgb2xy
+ [ 1 1 1 ] rgb2xy
dup 0 get /colortri_x0 exch def /colortri_dx colortri_x0 def
1 get /colortri_y0 exch def /colortri_dy colortri_y0 def
[[0 0 1][0 1 0][0 1 1][1 0 0][1 0 1][1 1 0]] {
@@ -208,10 +204,10 @@ exch (AFPL Ghostscript) eq or{
colortri_box 2 get colortri_box 0 get sub
dup colortri_dy mul colortri_dx div
} ifelse
- dtransform abs colortri_scale div cvi /colortri_ny exch def
+ dtransform abs colortri_scale div cvi /colortri_ny exch def
abs colortri_scale div cvi /colortri_nx exch def
- colortri_nx colortri_scale mul colortri_ny colortri_scale mul
- idtransform abs exch abs exch
+ colortri_nx colortri_scale mul colortri_ny colortri_scale mul
+ idtransform abs exch abs exch
colortri_box 0 get colortri_box 2 get 1 index sub 3 index sub 2 div add
colortri_box 1 get colortri_box 3 get 1 index sub 3 index sub 2 div add
transform .5 add cvi exch .5 add cvi exch itransform
@@ -225,7 +221,7 @@ exch (AFPL Ghostscript) eq or{
/colortri_ie colortri_tmp length 3 sub def
colortri_nx colortri_ny 8 [ colortri_nx 0 0 colortri_ny 0 0 ]
- {
+ {
colortri_xy 0 colortri_x0 put
0 3 colortri_ie {
colortri_tmp exch % buf ir
@@ -256,7 +252,7 @@ exch (AFPL Ghostscript) eq or{
% action upon ProcessColorModel
/STCimode {
- /ProcessColorModel STCiget dup
+ /ProcessColorModel STCiget dup
/DeviceCMYK eq{pop 2}{/DeviceRGB eq{1}{0}ifelse}ifelse get exec
} bind def
@@ -266,7 +262,7 @@ exch (AFPL Ghostscript) eq or{
} bind def
% print right or left-justified text
-/STCiprint {
+/STCiprint {
dup 0 gt { dup 2 index length sub STCipspace } if
1 index print
dup 0 lt { neg dup 2 index length sub STCipspace } if
@@ -279,7 +275,7 @@ exch (AFPL Ghostscript) eq or{
% Prepare the result
8 string dup 0 ( ) putinterval
- exch
+ exch
% Make it unsigned
dup 0 lt {neg(-)}{( )}ifelse 0 get exch
@@ -310,7 +306,7 @@ exch (AFPL Ghostscript) eq or{
dup 0 eq { pop pop dup cvi sub % String fraction
dup 0.0 ne { % Fraction present
- 0.0005 add 1 index 4 (.) putinterval
+ 0.0005 add 1 index 4 (.) putinterval
5 1 7 { % string frac ind
exch 10 mul dup cvi exch 1 index sub % string ind ic nfrac
exch (0123456789) exch get 3 -1 roll % string nfrac chr ind
@@ -329,7 +325,7 @@ exch (AFPL Ghostscript) eq or{
} for
pop
} ifelse
-
+
} bind def
% compute colorvalue-steps from transfer & coding
@@ -366,7 +362,7 @@ exch (AFPL Ghostscript) eq or{
2 copy exch dup 0 eq {
10 index exch 0.0 put pop
}{
- dup 10 index exch 1 sub get 3 -1 roll add 2 div
+ dup 10 index exch 1 sub get 3 -1 roll add 2 div
10 index 3 1 roll put
}ifelse
7 index 3 1 roll put
@@ -399,7 +395,7 @@ exch (AFPL Ghostscript) eq or{
dup 2 index add 2 div 3 index exec % Color to average
4 index 2 get 5 index 0 get sub exch 1 index mul 5 index 0 get add 3 1 roll
mul 4 index 0 get add 4 index 3 get 5 index 1 get
- newpath
+ newpath
2 index 1 index moveto
3 index 1 index lineto
3 index 2 index lineto
@@ -407,7 +403,7 @@ exch (AFPL Ghostscript) eq or{
closepath fill
pop pop pop pop
} for
- pop pop
+ pop pop
0 setgray
newpath
dup 0 get 1 index 1 get moveto
@@ -440,15 +436,15 @@ exch (AFPL Ghostscript) eq or{
/STCi_l2 0 def
/STCi_text [
% Driver-Name & Version
- (Parameters of)
+ (Parameters of)
/Name STCiget length /Version STCiget length add 1 add string
dup 0 /Name STCiget putinterval dup /Name STCiget length (-)putinterval
dup /Name STCiget length 1 add /Version STCiget putinterval
% Dithering-Algorithm
- (Dithering)
- /Dithering STCiget
+ (Dithering)
+ /Dithering STCiget
[{( \(Monochrome\))}{( \(RGB\))}{( \(CMYK\))}] STCimode
- dup length 2 index length add string exch 1 index exch
+ dup length 2 index length add string exch 1 index exch
3 index length exch putinterval dup 3 1 roll exch 0 exch putinterval
% Flags for the algorithm
(Flag4-0) 5 string
@@ -458,7 +454,7 @@ exch (AFPL Ghostscript) eq or{
dup 3 /Flag1 STCiget {(T)}{(f)} ifelse putinterval
dup 4 /Flag0 STCiget {(T)}{(f)} ifelse putinterval
-% Bits Per Pixel & Bits Per Component
+% Bits Per Pixel & Bits Per Component
(BitsPerPixel) 10 string % (nn -> nxnn)
/BitsPerPixel STCiget 1 index cvs length % string used
dup 2 index exch ( -> ) putinterval 4 add dup 2 add exch 2 index exch
@@ -470,19 +466,19 @@ exch (AFPL Ghostscript) eq or{
% ColorAdjustMatrix
(ColorAdjustMatrix)
/ColorAdjustMatrix STCiget dup null eq {
- pop (default)
+ pop (default)
}{
{ STCicvs } forall
[{ % Monochrome
- 26 string
+ 26 string
dup 0 6 -1 roll putinterval dup 8 ( ) putinterval
dup 9 5 -1 roll putinterval dup 17 ( ) putinterval
- dup 18 4 -1 roll putinterval
+ dup 18 4 -1 roll putinterval
}{ % RGB
- 26 string
+ 26 string
dup 0 12 -1 roll putinterval dup 8 ( ) putinterval
dup 9 11 -1 roll putinterval dup 17 ( ) putinterval
- dup 18 10 -1 roll putinterval
+ dup 18 10 -1 roll putinterval
() 26 string
dup 0 11 -1 roll putinterval dup 8 ( ) putinterval
@@ -494,7 +490,7 @@ exch (AFPL Ghostscript) eq or{
dup 9 9 -1 roll putinterval dup 17 ( ) putinterval
dup 18 8 -1 roll putinterval
}{
- 35 string
+ 35 string
dup 0 19 -1 roll putinterval dup 8 ( ) putinterval
dup 9 18 -1 roll putinterval dup 17 ( ) putinterval
dup 18 17 -1 roll putinterval dup 26 ( ) putinterval
@@ -528,7 +524,7 @@ exch (AFPL Ghostscript) eq or{
% Resolution
(Resolution) 15 string % (nnnnnxnnnnn DpI)
- /HWResolution STCiget 0 get cvi 1 index cvs length
+ /HWResolution STCiget 0 get cvi 1 index cvs length
dup 2 index exch (x) putinterval 1 add dup 2 index exch 5 getinterval
/HWResolution STCiget 1 get cvi exch cvs length add dup 2 index
exch ( DpI) putinterval 4 add 0 exch getinterval
@@ -536,10 +532,10 @@ exch (AFPL Ghostscript) eq or{
% HWsize holds entire Page in Pixels,
% .HWMargins is [left,bottom,right,top] in Points
(Printed Area) 18 string % (nnnnnxnnnnn Pixel)
- /HWSize STCiget 0 get /.HWMargins STCiget dup 0 get exch 2 get add
+ /HWSize STCiget 0 get /.HWMargins STCiget dup 0 get exch 2 get add
/HWResolution STCiget 0 get mul 72.0 div sub cvi 1 index cvs length
dup 2 index exch (x) putinterval 1 add dup 2 index exch 5 getinterval
- /HWSize STCiget 1 get /.HWMargins STCiget dup 1 get exch 3 get add
+ /HWSize STCiget 1 get /.HWMargins STCiget dup 1 get exch 3 get add
/HWResolution STCiget 1 get mul 72.0 div sub cvi exch cvs length add
dup 2 index exch ( Pixel) putinterval 6 add 0 exch getinterval
@@ -572,7 +568,7 @@ exch (AFPL Ghostscript) eq or{
/STCi_xv [ 3 -1 roll ] def
/STCi_col [[0 0 0]] def
/STCi_set [{1.0 exch sub setgray}] def
- }{ % RGB
+ }{ % RGB
/Rtransfer STCiget /Rcoding STCiget STCisteps
/Gtransfer STCiget /Gcoding STCiget STCisteps
/Btransfer STCiget /Bcoding STCiget STCisteps
@@ -602,9 +598,9 @@ exch (AFPL Ghostscript) eq or{
}
]STCimode
-} stopped
+} stopped
-{ {/STCi_stopped eq {exit}if}loop true}
+{ {/STCi_stopped eq {exit}if}loop true}
{ {/STCi_stopped eq {exit}if}loop false} ifelse
% End: stcinfo_preparation
@@ -625,9 +621,9 @@ exch (AFPL Ghostscript) eq or{
STCi_text exch get length dup STCi_l2 gt{/STCi_l2 exch def}{pop}ifelse
} for
/STCi_l2 STCi_l2 neg def
- 0 2 STCi_text length 2 sub {
+ 0 2 STCi_text length 2 sub {
dup 1 add STCi_text exch get exch STCi_text exch get
- 1 index length 0 gt {
+ 1 index length 0 gt {
dup STCi_l1 STCiprint length 0 gt {(: )}{( )}ifelse print print
}{
pop pop
@@ -718,8 +714,8 @@ exch (AFPL Ghostscript) eq or{
% The Graphs
gsave
- STCi_win 0 get 14 add STCi_win 1 get 14 add
- STCi_win 2 get 2 index sub STCi_win 3 get 2 index sub
+ STCi_win 0 get 14 add STCi_win 1 get 14 add
+ STCi_win 2 get 2 index sub STCi_win 3 get 2 index sub
4 2 roll translate
STCi_col 0 1 2 index length 1 sub {
1 index 1 index get aload pop setrgbcolor
@@ -749,7 +745,7 @@ exch (AFPL Ghostscript) eq or{
% compute the upper bar-window
%
/STCi_win [
- STCi_clip 0 get 4 -1 roll 36 sub STCi_clip 2 get 1 index 36 add
+ STCi_clip 0 get 4 -1 roll 36 sub STCi_clip 2 get 1 index 36 add
] def
%
diff --git a/gs/lib/stcolor.ps b/gs/lib/stcolor.ps
index 47587b5eb..4ba9678bf 100644
--- a/gs/lib/stcolor.ps
+++ b/gs/lib/stcolor.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995 Aladdin Enterprises. All rights reserved
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -69,11 +69,10 @@ exch (AFPL Ghostscript) eq or{
% pick the colormodel
STCold /ProcessColorModel get /STCcolor exch def
-
- mark % prepare stack for "putdeviceprops"
+ mark % prepare stack for "putdeviceprops"
% warn for BitsPerPixel=30 with fsrgb
- STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and
+ STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and
{
(%%[ stcolor.ps: inefficient RGB-setup, recommend BitsPerPixel=24 ]%%\n)
print
@@ -84,15 +83,15 @@ exch (AFPL Ghostscript) eq or{
% if the selected algorithm uses another ProcessColorModel, it is necessary
% to change the Value of STCcolor according to the new algorithm.
- STCold /Dithering get (gscmyk) eq
- {
+ STCold /Dithering get (gscmyk) eq
+ {
/Dithering (hscmyk) % preferred dithering-method
} if % might be necessary to change STCcolor too
%
% select the array according to the resolution
%
- STCdpi 359.0 lt
+ STCdpi 359.0 lt
{ STCdeftransfer }
{ STCdpi 361.0 lt
{ STCKtransfer360 }
@@ -101,12 +100,12 @@ exch (AFPL Ghostscript) eq or{
{
STCKtransfer360 length STCKtransfer720 length eq
{
- 0 1 STCKtransfer360 length 1 sub
+ 0 1 STCKtransfer360 length 1 sub
{
- dup dup
- STCKtransfer360 exch get
- exch STCKtransfer720 exch get
- add 2.0 div
+ dup dup
+ STCKtransfer360 exch get
+ exch STCKtransfer720 exch get
+ add 2.0 div
STCKtransfer360 3 1 roll put
} for
}if
@@ -117,19 +116,19 @@ exch (AFPL Ghostscript) eq or{
/STCtransfer exch def
%
-% Add the arrays. With Version 1.17 and above, it seems to be
+% Add the arrays. With Version 1.17 and above, it seems to be
% a good idea, to use the transfer-arrays as coding-arrays too.
%
%
% RGB-Model requires inversion of the transfer-arrays
%
- STCcolor /DeviceRGB eq
+ STCcolor /DeviceRGB eq
{
/RGBtransfer STCtransfer length array def
0 1 STCtransfer length 1 sub
{
- dup RGBtransfer length 1 sub exch sub exch
+ dup RGBtransfer length 1 sub exch sub exch
STCtransfer exch get 1.0 exch sub
RGBtransfer 3 1 roll put
} for
@@ -156,7 +155,7 @@ exch (AFPL Ghostscript) eq or{
} ifelse
- counttomark 0 ne
+ counttomark 0 ne
{currentdevice putdeviceprops pop}{cleartomark}ifelse
% decativate predefined correction
diff --git a/gs/lib/stocht.ps b/gs/lib/stocht.ps
index 6d36b98eb..6c440f10d 100644
--- a/gs/lib/stocht.ps
+++ b/gs/lib/stocht.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1999, 2000 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/traceimg.ps b/gs/lib/traceimg.ps
index c67424df6..e6c6e9d5a 100644
--- a/gs/lib/traceimg.ps
+++ b/gs/lib/traceimg.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/traceop.ps b/gs/lib/traceop.ps
index 2d3d9081c..c4031ac4e 100644
--- a/gs/lib/traceop.ps
+++ b/gs/lib/traceop.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1993, 1994, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -63,7 +63,7 @@ currentpacking true setpacking
.tdict .tname get /.tdef 1 index cvlit def
dup xcheck {
dup type dup /arraytype eq exch /packedarraytype eq or {
- /exec cvx
+ /exec cvx
} if
} if
/.tpost load /traceprint cvx () /= cvx /traceend cvx
diff --git a/gs/lib/type1enc.ps b/gs/lib/type1enc.ps
index 346f730dd..e0d678c7b 100644
--- a/gs/lib/type1enc.ps
+++ b/gs/lib/type1enc.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1993 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -22,7 +22,7 @@
% "Adobe Type 1 Font Format," ISBN 0-201-57044-0, published by Addison-Wesley.
/.type1crypt % <R> <from> <to> <proc> .type1crypt <R'> <to>
- % (auxiliary procedure)
+ % (auxiliary procedure)
{ 4 1 roll
0 2 index length getinterval
0 1 2 index length 1 sub
diff --git a/gs/lib/type1ops.ps b/gs/lib/type1ops.ps
index 489938a85..041c38c56 100644
--- a/gs/lib/type1ops.ps
+++ b/gs/lib/type1ops.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -26,7 +26,7 @@
/Type1encode 70 dict
- % Data types
+ % Data types
dup /nulltype {
pop ()
@@ -46,14 +46,14 @@ dup /integertype {
1 4 -1 roll 255 and put
} {
(\377xxxx) 1 1 4 {
- dup 8 mul 32 sub 3 index exch bitshift 255 and
- 2 index 3 1 roll put
+ dup 8 mul 32 sub 3 index exch bitshift 255 and
+ 2 index 3 1 roll put
} for exch pop
} ifelse
} ifelse
} put
- % Operators
+ % Operators
% Identical or similar in Type 1 and Type 2.
/c_hstem 1 def dup /hstem <01> put
@@ -130,7 +130,7 @@ readonly def
Type1encode {
dup type /stringtype eq {
dup length 1 eq { 0 get } { 1 get 256 add } ifelse
- % stack: array key code
+ % stack: array key code
exch 2 index 3 1 roll put
} {
pop pop
diff --git a/gs/lib/uninfo.ps b/gs/lib/uninfo.ps
index 4b6d35438..e7876458a 100644
--- a/gs/lib/uninfo.ps
+++ b/gs/lib/uninfo.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1997 Aladdin Enterprises. All rights reserved
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -77,7 +77,7 @@
} if
2 index exch 2 index exch put
1 add
- } ifelse
+ } ifelse
} forall
1 index exch (\)) putinterval
}{ exch pop
@@ -116,7 +116,7 @@
exch
}{
( ) print
- 2 index add 1 add
+ 2 index add 1 add
3 -1 roll pop
exch
} ifelse
@@ -140,7 +140,7 @@
[ 1 index {
pop dup type /nametype eq {
dup length string cvs
- }{
+ }{
pop
} ifelse
} forall
@@ -151,7 +151,7 @@
1 index 1 add 1 4 index length 1 sub { % stack: dic nam I nam[I] J
3 index 1 index get % dic nam I S[I] J S[J]
2 index 1 index gt { % swap them
- 4 index 2 index 4 index put
+ 4 index 2 index 4 index put
4 index 4 index 2 index put
3 1 roll
} if
@@ -170,22 +170,22 @@
length 2 copy lt { exch } if pop
} forall
% Print out all the items, stack: pre dic nam maxlen
- (\n) print
+ (\n) print
exch { % pre dic maxlen nam[I]
% no prefix yet, -> flush right
3 index length 0 eq {
dup length 2 index exch sub HSpindent
}{
3 index print (/) print
- } ifelse
+ } ifelse
% print the name
dup print
-% prefix: fill up with blanks
+% prefix: fill up with blanks
3 index length 0 ne {
dup length 2 index exch sub HSpindent
} if
% now print the item itself, stack: pre dic maxlen nam[I]
- 2 index 1 index cvn get dup type % stack: pre dic maxlen nam[i] item typ
+ 2 index 1 index cvn get dup type % stack: pre dic maxlen nam[i] item typ
% Dict-Syntax
dup /dicttype eq { pop % stack: pre dic maxlen nam[i] item
( ) print dup HScvs print
@@ -203,7 +203,7 @@
3 -1 roll pop % tack: pre dic maxlen item typ
% Array-Syntax
dup /arraytype eq { pop % stack: pre dic maxlen item
- 3 index length dup 0 ne { 1 add } if 2 index add
+ 3 index length dup 0 ne { 1 add } if 2 index add
exch HSaprint
}{ pop
( ) print
diff --git a/gs/lib/unprot.ps b/gs/lib/unprot.ps
index 6c099d258..4c5ee8add 100644
--- a/gs/lib/unprot.ps
+++ b/gs/lib/unprot.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1991, 1992, 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/viewcmyk.ps b/gs/lib/viewcmyk.ps
index b3556438c..864f6e134 100644
--- a/gs/lib/viewcmyk.ps
+++ b/gs/lib/viewcmyk.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -31,14 +31,14 @@
mark fname status pop pop pop /flen exch def cleartomark
/h flen w bpc 4 mul mul 7 add 8 idiv idiv def
(Dimensions: ) print [w h] == flush
- % Set up scaling.
+ % Set up scaling.
/SCALE where {
pop
- % Map pixels SCALE-for-1. Assume orthogonal transformation.
+ % Map pixels SCALE-for-1. Assume orthogonal transformation.
SCALE 1 0 dtransform add abs div
SCALE 0 1 dtransform add abs div
} {
- % Scale the image (uniformly) to fit the page.
+ % Scale the image (uniformly) to fit the page.
clippath pathbbox pop pop translate
pathbbox 3 -1 roll sub h div
3 1 roll exch sub w div .min dup
diff --git a/gs/lib/viewgif.ps b/gs/lib/viewgif.ps
index 7106ccfea..78c45bdb2 100644
--- a/gs/lib/viewgif.ps
+++ b/gs/lib/viewgif.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1989, 1992, 1993, 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -48,7 +48,7 @@
} bind def
/readGIFimageHeader % <file> readGIFimageHeader <dict>
- % Note: GIF header must be on dict stack
+ % Note: GIF header must be on dict stack
{ 10 dict begin
{ dup read1
dup (!) 0 get ne { exit } if pop % extension
@@ -80,21 +80,21 @@
/imageGIF % <imagedict> imageGIF
{ /ImageOut where
{ pop
- % We know BitsPerComponent = 8, Decode = [0 255].
- % and there is only a single data source which is
- % either a filter or a string whose size is exactly
- % the width of the row.
+ % We know BitsPerComponent = 8, Decode = [0 255].
+ % and there is only a single data source which is
+ % either a filter or a string whose size is exactly
+ % the width of the row.
dup /DataSource get dup type /stringtype eq
{ ImageOut exch writestring
}
{ pop dup /Width get string
- 1 index /Height get
- { 1 index /DataSource get 1 index readstring pop
- ImageOut exch writestring
- }
- repeat pop pop
+ 1 index /Height get
+ { 1 index /DataSource get 1 index readstring pop
+ ImageOut exch writestring
+ }
+ repeat pop pop
}
- ifelse
+ ifelse
}
{ image
}
@@ -115,9 +115,9 @@
VGIFDEBUG { ImageHeader { exch == == } forall (----------------\n) print flush } if
/D F
<< /InitialCodeLength F read1
- /FirstBitLowOrder true
- /BlockData true
- /EarlyChange 0
+ /FirstBitLowOrder true
+ /BlockData true
+ /EarlyChange 0
>> /LZWDecode filter def
[/Indexed /DeviceRGB 1 BitsPerPixel bitshift 1 sub Palette] setcolorspace
@@ -125,25 +125,25 @@
0 1 3 { 2 copy get dup 0 ne { dup abs div } if 3 copy put pop pop } for
setmatrix
<< /ImageType 1
- /ImageMatrix [1 0 0 -1 0 Height]
- /BitsPerComponent 8
- /Decode [0 255]
+ /ImageMatrix [1 0 0 -1 0 Height]
+ /BitsPerComponent 8
+ /Decode [0 255]
Interlaced
{ /Width Width /Height 1
- /row Width string def
- /DataSource row
+ /row Width string def
+ /DataSource row
>> /I exch def
/inter % <num> <denom> inter -
{ /denom exch def /num exch def
gsave
- /lines Height denom 1 sub add num sub denom idiv def
- 0 1 lines 1 sub {
- Height exch denom mul num add sub
- I /ImageMatrix get 5 3 -1 roll put
- D row readstring pop pop
- I imageGIF
- } for
- grestore
+ /lines Height denom 1 sub add num sub denom idiv def
+ 0 1 lines 1 sub {
+ Height exch denom mul num add sub
+ I /ImageMatrix get 5 3 -1 roll put
+ D row readstring pop pop
+ I imageGIF
+ } for
+ grestore
}
bind def
0 8 inter
@@ -152,9 +152,9 @@
1 2 inter
}
{ /Width Width /Height Height
- /DataSource D
+ /DataSource D
>> imageGIF
}
ifelse
saved end end end restore
- } bind def
+ } bind def
diff --git a/gs/lib/viewjpeg.ps b/gs/lib/viewjpeg.ps
index 24cdcb45d..7de234015 100644
--- a/gs/lib/viewjpeg.ps
+++ b/gs/lib/viewjpeg.ps
@@ -2,11 +2,11 @@
%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -58,7 +58,7 @@ JPEGdict begin
% read one byte from file F
% - ==> int --or-- stop context
-/NextByte {
+/NextByte {
F read not { (Read error in ViewJPEG!\n) print flush stop } if
} bind def
@@ -72,38 +72,38 @@ JPEGdict begin
5 dict begin
{ % loop: read JPEG marker segments until we find SOFn marker or EOF
- NextByte
- 16#FF eq { % found marker
- /markertype NextByte def
- % Is it S0F0=baseline, SOF1=extended sequential, SOF2=progressive ?
- markertype dup 16#C0 ge exch 16#C2 le and {
- NextByte pop NextByte pop % segment length
- % Ghostscript and Adobe PS accept only data precision 8
- NextByte 8 ne {
- (Error: not 8 bits per component!\n) print flush stop
- } if
-
- % Read crucial image parameters
- /height NextByte 8 bitshift NextByte add def
- /width NextByte 8 bitshift NextByte add def
- /colors NextByte def
-
- VJPGDEBUG { currentdict { exch == == } forall flush } if
- exit
- } if
-
- % detect several segment types which are not compatible with PS
- NotSupportedMarkers {
- markertype eq {
- (Marker ) print markertype ==
- (not supported!\n) print flush stop
- } if
- } forall
-
- % Skip segment if marker has parameters associated with it
- true NoParamMarkers { markertype eq {pop false exit} if } forall
- { SkipSegment } if
- } if
+ NextByte
+ 16#FF eq { % found marker
+ /markertype NextByte def
+ % Is it S0F0=baseline, SOF1=extended sequential, SOF2=progressive ?
+ markertype dup 16#C0 ge exch 16#C2 le and {
+ NextByte pop NextByte pop % segment length
+ % Ghostscript and Adobe PS accept only data precision 8
+ NextByte 8 ne {
+ (Error: not 8 bits per component!\n) print flush stop
+ } if
+
+ % Read crucial image parameters
+ /height NextByte 8 bitshift NextByte add def
+ /width NextByte 8 bitshift NextByte add def
+ /colors NextByte def
+
+ VJPGDEBUG { currentdict { exch == == } forall flush } if
+ exit
+ } if
+
+ % detect several segment types which are not compatible with PS
+ NotSupportedMarkers {
+ markertype eq {
+ (Marker ) print markertype ==
+ (not supported!\n) print flush stop
+ } if
+ } forall
+
+ % Skip segment if marker has parameters associated with it
+ true NoParamMarkers { markertype eq {pop false exit} if } forall
+ { SkipSegment } if
+ } if
} loop
currentdict dup /markertype undef
@@ -114,7 +114,7 @@ end % JPEGdict
% read image parameters from JPEG file and display the image
/viewJPEG { % <file|string> ==> -
- save
+ save
JPEGdict begin
/saved exch def
/scratch 1 string def
diff --git a/gs/lib/viewmiff.ps b/gs/lib/viewmiff.ps
index 8ca6316f0..ede829b2c 100644
--- a/gs/lib/viewmiff.ps
+++ b/gs/lib/viewmiff.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1998 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -39,27 +39,27 @@
}
/PseudoClass {
[ /Indexed
- % The MIFF documentation lies about the size of pixels
- % for this case: the pixel size is determined only by
- % the number of colors, and is not affected by the image
- % depth. Specifically, if there are 256 or fewer colors
- % but the depth (of color map entries) is 16, each pixel
- % is still only 1 byte, not 2.
+ % The MIFF documentation lies about the size of pixels
+ % for this case: the pixel size is determined only by
+ % the number of colors, and is not affected by the image
+ % depth. Specifically, if there are 256 or fewer colors
+ % but the depth (of color map entries) is 16, each pixel
+ % is still only 1 byte, not 2.
currentdict /colors known {
- /DeviceRGB colors 1 sub
- /BitsPerComponent colors 256 le { 8 } { 16 } ifelse def
- colors 3 mul string depth 8 eq {
- f exch readstring pop
- } {
- % 16-bit color map entries: take only the high-order byte.
- 0 1 2 index length 1 sub {
- f read pop 2 index 3 1 roll put f read pop pop
- } for
- } ifelse
+ /DeviceRGB colors 1 sub
+ /BitsPerComponent colors 256 le { 8 } { 16 } ifelse def
+ colors 3 mul string depth 8 eq {
+ f exch readstring pop
+ } {
+ % 16-bit color map entries: take only the high-order byte.
+ 0 1 2 index length 1 sub {
+ f read pop 2 index 3 1 roll put f read pop pop
+ } for
+ } ifelse
} {
- /colors 256 def
- /DeviceGray 255
- 256 string 0 1 255 { 1 index exch dup put } for
+ /colors 256 def
+ /DeviceGray 255
+ 256 string 0 1 255 { 1 index exch dup put } for
} ifelse
] setcolorspace
/Decode [ 0 1 BitsPerComponent bitshift 1 sub ] def
@@ -69,7 +69,7 @@
% Recognize MIFF compression methods.
/rlstring 768 string def
/rlread {
- % packets is not reliable -- disregard it.
+ % packets is not reliable -- disregard it.
dup rlstring 0 3 getinterval readstring {
pop read pop 3 mul 3 3 2 index {
rlstring exch rlstring 0 3 getinterval putinterval
@@ -90,26 +90,26 @@
50 dict begin
/fname 1 index def
/f exch (r) file def
- % Set defaults.
+ % Set defaults.
/ImageType 1 def
/class /DirectClass def
/compression /Uncompressed def
/depth 8 def
/packets 16#7fffffff def
- % Read and parse the header.
+ % Read and parse the header.
{ f token pop
dup (:) eq { pop exit } if
dup type /nametype eq {
.namestring (=) search {
- exch pop miffwords exch .knownget { exec } { pop } ifelse
+ exch pop miffwords exch .knownget { exec } { pop } ifelse
} {
- pop % who knows?
+ pop % who knows?
} ifelse
} {
pop % probably a comment in braces
} ifelse
} loop
- % Read and display the image.
+ % Read and display the image.
miffclasses class get exec
/DataSource miffcompress compression get exec def
/ImageMatrix [Width 0 0 Height neg 0 Height] def
@@ -118,7 +118,7 @@
gsave 0.8 setgray 0 0 1 1 rectfill grestore % provide background
currentdict image
showpage
- % Clean up.
+ % Clean up.
f closefile
end
} bind def
diff --git a/gs/lib/viewpbm.ps b/gs/lib/viewpbm.ps
index 7930d45a4..c2dbc5701 100644
--- a/gs/lib/viewpbm.ps
+++ b/gs/lib/viewpbm.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1995, 1996, 1998, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -58,37 +58,37 @@
/wrem w 8 mod def
/ncomp 1 def /invert true def /DeviceGray setcolorspace
readwh
- { readrow01 }
+ { readrow01 }
} bind
/P2 { % ASCII 8-bit gray
readwh
/bpc 8 def 2 index readmaxv /rsize 2 index def
/ncomp 1 def /invert false def /DeviceGray setcolorspace
- { readrow }
+ { readrow }
} bind
/P3 { % ASCII 8-bit RGB
readwh
/bpc 8 def 2 index readmaxv /rsize 2 index 3 mul def
/ncomp 3 def /invert false def /DeviceRGB setcolorspace
- { readrow }
+ { readrow }
} bind
/P4 { % Binary 1-bit white/black
readwh
/bpc 1 def /maxv 1 def /rsize 2 index 7 add 8 idiv def
/ncomp 1 def /invert true def /DeviceGray setcolorspace
- { readstring pop }
+ { readstring pop }
} bind
/P5 { % Binary 8-bit gray
readwh
/bpc 8 def 2 index readmaxv /rsize 2 index def
/ncomp 1 def /invert false def /DeviceGray setcolorspace
- { readstring pop }
+ { readstring pop }
} bind
/P6 { % Binary 8-bit RGB
readwh
/bpc 8 def 2 index readmaxv /rsize 2 index 3 mul def
/ncomp 3 def /invert false def /DeviceRGB setcolorspace
- { readstring pop }
+ { readstring pop }
} bind
.dicttomark readonly def
/pbmsetup { % <file> <w> <h> <readproc> runpbm -
@@ -110,17 +110,17 @@
begin
/SCALE where {
pop
- % Map pixels SCALE-for-1. Assume orthogonal transformation.
+ % Map pixels SCALE-for-1. Assume orthogonal transformation.
Width 1 0 dtransform add abs div SCALE mul
Height 0 1 dtransform add abs div SCALE mul
} {
- % Scale the image (uniformly) to fit the page.
+ % Scale the image (uniformly) to fit the page.
clippath pathbbox pop pop translate
pathbbox .min exch pop exch pop ceiling
dup Height Width gt {
- Width mul Height div exch
+ Width mul Height div exch
} {
- Height mul Width div
+ Height mul Width div
} ifelse
}
ifelse scale
@@ -143,15 +143,15 @@
20 dict begin
/fname exch def
/sources [ 0 1 3 {
- /plane exch def
+ /plane exch def
/pf fname (r) file def
pf pbmtypes pf token pop get exec
- % Stack: pf w h readproc
+ % Stack: pf w h readproc
plane {
- /readproc exch def /h exch def /w exch def pop
- /row rsize string def
- h { pf row readproc pop } repeat
- pf pbmtypes pf token pop get exec
+ /readproc exch def /h exch def /w exch def pop
+ /row rsize string def
+ h { pf row readproc pop } repeat
+ pf pbmtypes pf token pop get exec
} repeat
pbmsetup
} for ] def
diff --git a/gs/lib/viewpcx.ps b/gs/lib/viewpcx.ps
index 36e85d71b..17d180f5b 100644
--- a/gs/lib/viewpcx.ps
+++ b/gs/lib/viewpcx.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1996, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -51,7 +51,7 @@
{ 100 dict begin
/fname 1 index def
/f exch (r) file def
- % Read and unpack the header.
+ % Read and unpack the header.
/header f 128 string readstring pop def
/version header 1 get def
/bpp header 3 get def
@@ -64,32 +64,32 @@
version 5 eq
{ nbits 8 le
{ /cspace
- [/Indexed /DeviceRGB 1 bpp bitshift 1 sub
- f fileposition
- 1 nbits bitshift 3 mul string
- fname status pop pop pop exch pop
- 1 index length sub f exch setfileposition
- f exch readstring pop
- exch f exch setfileposition
- ] def
- /decode [0 cspace 2 get] def
+ [/Indexed /DeviceRGB 1 bpp bitshift 1 sub
+ f fileposition
+ 1 nbits bitshift 3 mul string
+ fname status pop pop pop exch pop
+ 1 index length sub f exch setfileposition
+ f exch readstring pop
+ exch f exch setfileposition
+ ] def
+ /decode [0 cspace 2 get] def
}
{ /cspace /DeviceRGB def
- /decode [0 1 0 1 0 1] def
+ /decode [0 1 0 1 0 1] def
}
ifelse
}
{ /cspace
- [/Indexed /DeviceRGB 1 bpp bitshift 1 sub
- header 16 1 nbits bitshift 16 .min 3 mul getinterval
- ] def
+ [/Indexed /DeviceRGB 1 bpp bitshift 1 sub
+ header 16 1 nbits bitshift 16 .min 3 mul getinterval
+ ] def
/decode [0 cspace 2 get] def
}
ifelse
- % Set up scaling.
+ % Set up scaling.
/SCALE where
{ pop
- % Map pixels SCALE-for-1. Assume orthogonal transformation.
+ % Map pixels SCALE-for-1. Assume orthogonal transformation.
w 1 0 dtransform add abs div SCALE mul
h 0 1 dtransform add abs div SCALE mul
}
@@ -99,10 +99,10 @@
dup h w gt { w mul h div exch } { h mul w div } ifelse
}
ifelse scale
- % Since the number of bytes per line is always even,
- % it may not match the width specification.
+ % Since the number of bytes per line is always even,
+ % it may not match the width specification.
/wbpl w bpp mul 7 add 8 idiv def
- % Define the data source procedure.
+ % Define the data source procedure.
/s1 bpl wbpl sub string def
/df /readpcx load copyarray dup 0 f put cvx bind readonly
0 () /SubFileDecode filter def
@@ -112,7 +112,7 @@
cvx bind readonly
}
repeat ] def
- % Construct the image dictionary.
+ % Construct the image dictionary.
20 dict begin % image dictionary
/ImageType 1 def
/Width w def
@@ -125,7 +125,7 @@
{ 0 get }
ifelse def
currentdict end
- % Finally, display the image.
+ % Finally, display the image.
cspace setcolorspace
image
showpage
diff --git a/gs/lib/viewps2a.ps b/gs/lib/viewps2a.ps
index ef61a750c..6d8d5d70f 100644
--- a/gs/lib/viewps2a.ps
+++ b/gs/lib/viewps2a.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/lib/viewrgb.ps b/gs/lib/viewrgb.ps
index 6d9fd4d48..603ef6710 100755..100644
--- a/gs/lib/viewrgb.ps
+++ b/gs/lib/viewrgb.ps
@@ -1,8 +1,8 @@
% Copyright (C) 2009 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied, modified
% or distributed except as expressly authorized under the terms of that
% license. Refer to licensing information at http://www.artifex.com/
@@ -34,46 +34,46 @@
} if
mul 7 add 8 idiv idiv def
QUIET not { (Dimensions: ) print [w h] == flush } if
- % Set up scaling.
+ % Set up scaling.
/SCALE where {
pop
- % Map pixels SCALE-for-1. Assume orthogonal transformation.
+ % Map pixels SCALE-for-1. Assume orthogonal transformation.
SCALE 1 0 dtransform add abs div
SCALE 0 1 dtransform add abs div
} {
- % Scale the image (uniformly) to fit the page.
+ % Scale the image (uniformly) to fit the page.
clippath pathbbox pop pop translate
pathbbox 3 -1 roll sub h div
3 1 roll exch sub w div .min dup
} ifelse scale
bpc 1 eq {
[ /Indexed /DeviceRGB 15 <
- 000000
- 0000FF
- 00FF00
- 00FFFF
- FF0000
- FF00FF
- FFFF00
- FFFFFF
- 000000
- 0000FF
- 00FF00
- 00FFFF
- FF0000
- FF00FF
- FFFF00
- FFFFFF
+ 000000
+ 0000FF
+ 00FF00
+ 00FFFF
+ FF0000
+ FF00FF
+ FFFF00
+ FFFFFF
+ 000000
+ 0000FF
+ 00FF00
+ 00FFFF
+ FF0000
+ FF00FF
+ FFFF00
+ FFFFFF
>
] setcolorspace
/BPC 4 def % change to 4 bit indexed
} {
bpc 2 eq {
[ /Indexed /DeviceRGB 255 <
- 000000 000055 0000AA 0000FF
- 005500 005555 0055AA 0055FF
- 00AA00 00AA55 00AAAA 00AAFF
- 00FF00 00FF55 00FFAA 00FFFF
+ 000000 000055 0000AA 0000FF
+ 005500 005555 0055AA 0055FF
+ 00AA00 00AA55 00AAAA 00AAFF
+ 00FF00 00FF55 00FFAA 00FFFF
550000 550055 5500AA 5500FF
555500 555555 5555AA 5555FF
55AA00 55AA55 55AAAA 55AAFF
@@ -87,25 +87,25 @@
FFAA00 FFAA55 FFAAAA FFAAFF
FFFF00 FFFF55 FFFFAA FFFFFF
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
- 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
+ 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000
>
] setcolorspace
/BPC 8 def % change to 4 bit indexed
@@ -117,13 +117,13 @@
}
ifelse
<< /ImageType 1
- /Width w
- /Height h
- /BitsPerComponent BPC
- /ImageMatrix [1 0 0 -1 0 h]
- /DataSource f
- /MultipleDataSources false
- bpc 4 lt { /Decode [ 0 [ 0 15 255 ] bpc get ] } { /Decode [ 0 1 0 1 0 1 ] } ifelse
+ /Width w
+ /Height h
+ /BitsPerComponent BPC
+ /ImageMatrix [1 0 0 -1 0 h]
+ /DataSource f
+ /MultipleDataSources false
+ bpc 4 lt { /Decode [ 0 [ 0 15 255 ] bpc get ] } { /Decode [ 0 1 0 1 0 1 ] } ifelse
>> image
showpage
f closefile
diff --git a/gs/lib/wftopfa.ps b/gs/lib/wftopfa.ps
index 258935557..72227f723 100644
--- a/gs/lib/wftopfa.ps
+++ b/gs/lib/wftopfa.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -47,13 +47,13 @@ wftopfa_dict begin
{ dup rdstring readline not { pop exit } if
dup length 15 ge
{ dup dup length 7 sub 7 getinterval (> CompD) eq
- { token pop exch token pop exch pop
- dup 0 get /highcode exch def
- exch chars 3 1 roll put
- }
- { pop
- }
- ifelse
+ { token pop exch token pop exch pop
+ dup 0 get /highcode exch def
+ exch chars 3 1 roll put
+ }
+ { pop
+ }
+ ifelse
}
{ pop
}
@@ -77,7 +77,7 @@ wftopfa_dict begin
/FontInfo 20 dict def
FontInfo begin
- % Write the clear text part.
+ % Write the clear text part.
/CreationDate (%Calendar%) currentdevparams
dup /Weekday get {(Sun )(Mon )(Tue )(Wed )(Thu )(Fri )(Sat )} exch get
@@ -269,7 +269,7 @@ ifelse
/fontname exch def
[ templates
{ wfdir (/) concatstrings exch concatstrings { copystring }
- 8192 string filenameforall
+ 8192 string filenameforall
}
forall
wfdir (/wadalab-sym/*.ps) concatstrings { copystring }
diff --git a/gs/lib/winmaps.ps b/gs/lib/winmaps.ps
index 3054d2709..245c67ce7 100644
--- a/gs/lib/winmaps.ps
+++ b/gs/lib/winmaps.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -73,7 +73,7 @@ def
/decodeStd StandardEncoding invertencoding def
/decodeISO ISOLatin1Encoding
- % Remove the redundant characters
+ % Remove the redundant characters
dup length array copy
[8#222 8#225 8#230 8#233 8#240] { 2 copy /.notdef put pop } forall
invertencoding def
diff --git a/gs/lib/wrfont.ps b/gs/lib/wrfont.ps
index 0cb48becc..63edf36d9 100644
--- a/gs/lib/wrfont.ps
+++ b/gs/lib/wrfont.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1991, 1995, 1996, 2002 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -90,13 +90,13 @@ ifelse
{end} wol
} bind def
/wld % Write a large dictionary more efficiently.
- % Ignore the readonly attributes.
+ % Ignore the readonly attributes.
{ dup length wo {dict dup begin} wol
0 exch
{ exch wo wo () wl
- 1 add dup 200 eq
- { wo ({def} repeat) wl 0 }
- if
+ 1 add dup 200 eq
+ { wo ({def} repeat) wl 0 }
+ if
}
forall
dup 0 ne
@@ -112,32 +112,32 @@ ifelse
{ dup type /stringtype eq
{ 4330 exch changelenIV 0 ge
{ % Add some leading garbage bytes.
- wtstring changelenIV 2 index length getinterval
- .type1decrypt exch pop
- wtstring exch 0 exch length changelenIV add getinterval
- }
- { % Drop some leading garbage bytes.
- wtstring .type1decrypt exch pop
- changelenIV neg 1 index length 1 index sub getinterval
- }
- ifelse
+ wtstring changelenIV 2 index length getinterval
+ .type1decrypt exch pop
+ wtstring exch 0 exch length changelenIV add getinterval
+ }
+ { % Drop some leading garbage bytes.
+ wtstring .type1decrypt exch pop
+ changelenIV neg 1 index length 1 index sub getinterval
+ }
+ ifelse
binary_tokens encrypt_CharStrings and
- { % Suppress recognizing the readonly status of the string.
- 4330 exch dup .type1encrypt exch pop wo
- }
- { encrypt_CharStrings
- { 4330 exch dup .type1encrypt exch pop
- } if
- smallest_output
- { wo
- }
- { readonly dup length wo
- binary_tokens not { ( ) ws } if
- readproc ws wx
- }
- ifelse
- }
- ifelse
+ { % Suppress recognizing the readonly status of the string.
+ 4330 exch dup .type1encrypt exch pop wo
+ }
+ { encrypt_CharStrings
+ { 4330 exch dup .type1encrypt exch pop
+ } if
+ smallest_output
+ { wo
+ }
+ { readonly dup length wo
+ binary_tokens not { ( ) ws } if
+ readproc ws wx
+ }
+ ifelse
+ }
+ ifelse
}
{ wo % PostScript procedure
}
@@ -150,10 +150,10 @@ ifelse
0 1 255 {
(\221 ) dup 1 3 index put
{ token } stopped {
- pop pop
+ pop pop
} {
- % Stack: char () token true
- pop exch pop exch snit 3 1 roll put
+ % Stack: char () token true
+ pop exch pop exch snit 3 1 roll put
} ifelse
} for
} {
@@ -165,7 +165,7 @@ ifelse
{ psfile exch write==only
} bind def
- % Lookup table for ASCII output.
+ % Lookup table for ASCII output.
/intbytes % int nbytes -> byte*
{ { dup 255 and exch -8 bitshift } repeat pop
@@ -174,7 +174,7 @@ ifelse
{ /booleantype /integertype }
{ { ( ) ws woa } def }
forall
- % Iterate over arrays so we can print operators.
+ % Iterate over arrays so we can print operators.
/arraytype
{ dup xcheck {(}) ({)} {(]) ([)} ifelse ws exch dup wol exch ws wop
} bind def
@@ -183,77 +183,77 @@ ifelse
/nametype
{ dup xcheck { ( ) ws } if woa
} bind def
- % Map back operators to their names,
- % so we can write procedures.
+ % Map back operators to their names,
+ % so we can write procedures.
/nulltype
{ pop ( null) ws
} bind def
/operatortype
{ wtstring cvs cvn cvx wo
} bind def
- % Convert reals to integers if possible.
+ % Convert reals to integers if possible.
/realtype
{ dup cvi 1 index eq { cvi wo } { ( ) ws woa } ifelse
} bind def
- % == truncates strings longer than 200 characters!
+ % == truncates strings longer than 200 characters!
/stringtype
{ (\() ws dup
- { dup dup 32 lt exch 127 ge or
- { (\\) ws dup -6 bitshift 48 add w1
- dup -3 bitshift 7 and 48 add w1
- 7 and 48 add
- }
- { dup dup -2 and 40 eq exch 92 eq or {(\\) ws} if
- }
- ifelse w1
- }
- forall
- (\)) ws wop
+ { dup dup 32 lt exch 127 ge or
+ { (\\) ws dup -6 bitshift 48 add w1
+ dup -3 bitshift 7 and 48 add w1
+ 7 and 48 add
+ }
+ { dup dup -2 and 40 eq exch 92 eq or {(\\) ws} if
+ }
+ ifelse w1
+ }
+ forall
+ (\)) ws wop
} bind def
/packedarraytype
{ ([) ws dup { wo } forall
- encodingnames 1 index known
- % This is an encoding, but not one of the standard ones.
- % Use the built-in encoding only if it is available.
- { encodingnames exch get wo
- ({findencoding}stopped{pop) ws
- (}{counttomark 1 add 1 roll cleartomark}ifelse)
- }
- { pop ()
- }
- ifelse
- (/packedarray where{pop counttomark packedarray exch pop}{]readonly}ifelse) ws
- wl
+ encodingnames 1 index known
+ % This is an encoding, but not one of the standard ones.
+ % Use the built-in encoding only if it is available.
+ { encodingnames exch get wo
+ ({findencoding}stopped{pop) ws
+ (}{counttomark 1 add 1 roll cleartomark}ifelse)
+ }
+ { pop ()
+ }
+ ifelse
+ (/packedarray where{pop counttomark packedarray exch pop}{]readonly}ifelse) ws
+ wl
}
def
end def
- % Lookup table for binary output.
+ % Lookup table for binary output.
/wottb 8 dict dup begin
wotta currentdict copy pop
/integertype
{ dup dup 127 le exch -128 ge and
{ 136 wb 255 and wb }
- { dup dup 32767 le exch -32768 ge and
- { 134 wb 2 intbytes wb wb }
- { 132 wb 4 intbytes wb wb wb wb }
- ifelse
- }
- ifelse
+ { dup dup 32767 le exch -32768 ge and
+ { 134 wb 2 intbytes wb wb }
+ { 132 wb 4 intbytes wb wb wb wb }
+ ifelse
+ }
+ ifelse
} bind def
/nametype
{ dup snit exch known
{ dup xcheck { 146 } { 145 } ifelse wb
- snit exch get wb
- }
- { wotta /nametype get exec
- }
- ifelse
+ snit exch get wb
+ }
+ { wotta /nametype get exec
+ }
+ ifelse
} bind def
/stringtype
{ dup dup length dup 255 le { 142 2 } { 2 intbytes 143 3 } ifelse wnb
- ws wop
+ ws wop
} bind def
end def
@@ -274,12 +274,12 @@ ifelse
{ ws
}
{ % Some systems choke on very long lines, so
- % we break up the hexstring into chunks of 50 characters.
- { dup length 25 le {exit} if
- dup 0 25 getinterval psfile exch writehexstring (\n) ws
- dup length 25 sub 25 exch getinterval
- } loop
- psfile exch writehexstring
+ % we break up the hexstring into chunks of 50 characters.
+ { dup length 25 le {exit} if
+ dup 0 25 getinterval psfile exch writehexstring (\n) ws
+ dup length 25 sub 25 exch getinterval
+ } loop
+ psfile exch writehexstring
} ifelse
} bind def
@@ -304,23 +304,23 @@ enc_dict { 1 index where { pop pop pop } { def } ifelse } forall
{ 2 copy eq
{ pop pop true }
{ % Special hack for comparing FontMatrix values
- dup type /arraytype eq 2 index type /arraytype eq and
- { dup length 2 index length eq
- { true 0 1 3 index length 1 sub
- { % Stack: arr1 arr2 true index
- 3 index 1 index get 3 index 3 -1 roll get eq not
- { pop false exit }
- if
- }
- for 3 1 roll pop pop
- }
- { pop pop false
- }
- ifelse
- }
- { pop pop false
- }
- ifelse
+ dup type /arraytype eq 2 index type /arraytype eq and
+ { dup length 2 index length eq
+ { true 0 1 3 index length 1 sub
+ { % Stack: arr1 arr2 true index
+ 3 index 1 index get 3 index 3 -1 roll get eq not
+ { pop false exit }
+ if
+ }
+ for 3 1 roll pop pop
+ }
+ { pop pop false
+ }
+ ifelse
+ }
+ { pop pop false
+ }
+ ifelse
}
ifelse
} bind def
@@ -389,7 +389,7 @@ currentdict end /unencrypted_procs exch def
.knownEncodings length 256 mul dict begin
0 .knownEncodings
{ { currentdict 1 index known { pop } { 1 index def } ifelse
- 1 add
+ 1 add
}
forall
}
@@ -433,12 +433,12 @@ currentdict end /inverseencodings exch def
eexec_encrypt
{ /eexecfilter psfile binary_CharStrings not
{ pop /bxstring 35 string def
- { pop dup length 0 ne
- { realpsfile exch writehexstring realpsfile (\n) writestring }
- { pop }
- ifelse bxstring
- }
- /NullEncode filter dup /hexfilter exch def
+ { pop dup length 0 ne
+ { realpsfile exch writehexstring realpsfile (\n) writestring }
+ { pop }
+ ifelse bxstring
+ }
+ /NullEncode filter dup /hexfilter exch def
}
if 55665 /eexecEncode filter def
}
@@ -457,11 +457,11 @@ currentdict end /inverseencodings exch def
}
{ Font /UniqueID known
{ ({} FontDirectory) ws Font /FontName get dup wo ( known) wl
- ( {) ws wo ( findfont dup /UniqueID known) wl
- ( { dup /UniqueID get) ws Font /UniqueID get wo ( eq exch /FontType get 1 eq and }) wl
- ( { pop false } ifelse) wl
- ( { pop save /restore load } if) wl
- ( } if) wl
+ ( {) ws wo ( findfont dup /UniqueID known) wl
+ ( { dup /UniqueID get) ws Font /UniqueID get wo ( eq exch /FontType get 1 eq and }) wl
+ ( { pop false } ifelse) wl
+ ( { pop save /restore load } if) wl
+ ( } if) wl
}
if
}
@@ -490,14 +490,14 @@ currentdict end /inverseencodings exch def
Font
{ minimize
{ .minfontskipkeys 2 index known
- { pop pop
- }
- { //.compactfontdefault 2 index .knownget
- { 1 index valueeq { pop pop } { we } ifelse }
- { we }
- ifelse
- }
- ifelse
+ { pop pop
+ }
+ { //.compactfontdefault 2 index .knownget
+ { 1 index valueeq { pop pop } { we } ifelse }
+ { we }
+ ifelse
+ }
+ ifelse
}
{ .fontskipkeys 2 index known { pop pop } { we } ifelse
}
@@ -571,9 +571,9 @@ if
{ (/Subrs[) wl
Subrs
{ dup null ne
- { wcs minimize not { () wl } if }
- { pop /null cvx wo }
- ifelse
+ { wcs minimize not { () wl } if }
+ { pop /null cvx wo }
+ ifelse
} forall
{] dup {readonly pop} forall readonly def} wol () wl
}
@@ -599,20 +599,20 @@ if
CharStrings length dict
CharStrings
{ exch inverseencodings 1 index .knownget not { dup } if wo
- % Stack: vdict value key
- 3 copy pop .knownget { wo pop pop } { 3 copy put pop wcs } ifelse
+ % Stack: vdict value key
+ 3 copy pop .knownget { wo pop pop } { 3 copy put pop wcs } ifelse
} forall
}
{ {dict dup Private begin begin} wol () wl
CharStrings length dict
CharStrings
{ 2 index 1 index known
- { exch wo 1 index exch get wo {load def} wol () wl
- }
- { 2 index 1 index 3 index put
- exch wo wcs ( |-) wl
- }
- ifelse
+ { exch wo 1 index exch get wo {load def} wol () wl
+ }
+ { 2 index 1 index 3 index put
+ exch wo wcs ( |-) wl
+ }
+ ifelse
} forall
{end end} wol
}
diff --git a/gs/lib/zeroline.ps b/gs/lib/zeroline.ps
index c9e800006..6aaee0ac0 100644
--- a/gs/lib/zeroline.ps
+++ b/gs/lib/zeroline.ps
@@ -1,13 +1,13 @@
%!
% Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
diff --git a/gs/psi/bfont.h b/gs/psi/bfont.h
index 8063e6613..5077f0b35 100644
--- a/gs/psi/bfont.h
+++ b/gs/psi/bfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@
/* In zfont.c */
int add_FID(i_ctx_t *i_ctx_p, ref *pfdict, gs_font *pfont,
- gs_ref_memory_t *imem);
+ gs_ref_memory_t *imem);
font_proc_make_font(zdefault_make_font);
font_proc_make_font(zbase_make_font);
@@ -48,32 +48,32 @@ typedef enum {
} build_font_options_t;
/* In zbfont.c */
-int build_proc_name_refs(const gs_memory_t *mem,
- build_proc_refs * pbuild,
- const char *bcstr, const char *bgstr);
+int build_proc_name_refs(const gs_memory_t *mem,
+ build_proc_refs * pbuild,
+ const char *bcstr, const char *bgstr);
int build_gs_font_procs(os_ptr, build_proc_refs *);
#define BUILD_BASE_FONT_PROC(proc)\
int proc(i_ctx_t *, os_ptr, gs_font_base **, font_type,\
- gs_memory_type_ptr_t, const build_proc_refs *,\
- build_font_options_t)
+ gs_memory_type_ptr_t, const build_proc_refs *,\
+ build_font_options_t)
typedef BUILD_BASE_FONT_PROC((*build_base_font_proc_t));
BUILD_BASE_FONT_PROC(build_gs_primitive_font);
int build_gs_FDArray_font(i_ctx_t *, /*const*/ ref *, gs_font_base **,
- font_type, gs_memory_type_ptr_t,
- const build_proc_refs *);
+ font_type, gs_memory_type_ptr_t,
+ const build_proc_refs *);
int build_gs_outline_font(i_ctx_t *, os_ptr, gs_font_base **, font_type,
- gs_memory_type_ptr_t, const build_proc_refs *,
- build_font_options_t, build_base_font_proc_t);
+ gs_memory_type_ptr_t, const build_proc_refs *,
+ build_font_options_t, build_base_font_proc_t);
BUILD_BASE_FONT_PROC(build_gs_simple_font);
void init_gs_simple_font(gs_font_base *pfont, const double bbox[4],
- const gs_uid *puid);
+ const gs_uid *puid);
void lookup_gs_simple_font_encoding(gs_font_base *);
int build_gs_font(i_ctx_t *, os_ptr, gs_font **, font_type,
- gs_memory_type_ptr_t, const build_proc_refs *,
- build_font_options_t);
+ gs_memory_type_ptr_t, const build_proc_refs *,
+ build_font_options_t);
int build_gs_sub_font(i_ctx_t *, const ref *, gs_font **,
- font_type, gs_memory_type_ptr_t,
- const build_proc_refs *, const ref *, ref *);
+ font_type, gs_memory_type_ptr_t,
+ const build_proc_refs *, const ref *, ref *);
int define_gs_font(i_ctx_t *, gs_font *);
void get_font_name(const gs_memory_t *mem, ref *pfname, const ref *op);
void copy_font_name(gs_font_name * pfstr, const ref * pfname);
diff --git a/gs/psi/btoken.h b/gs/psi/btoken.h
index 53d48a445..af704918e 100644
--- a/gs/psi/btoken.h
+++ b/gs/psi/btoken.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,11 +27,11 @@
/* Create a system or user name table (in the stable memory of mem). */
int create_names_array(ref **ppnames, gs_memory_t *mem,
- client_name_t cname); /* in zbseq.c */
+ client_name_t cname); /* in zbseq.c */
/* Convert an object to its representation in a binary object sequence. */
int encode_binary_token(i_ctx_t *i_ctx_p, const ref *obj, int *ref_offset,
- int *char_offset, byte *str); /* in iscanbin.c */
+ int *char_offset, byte *str); /* in iscanbin.c */
/* Define the current binary object format for operators. */
/* This is a ref so that it can be managed properly by save/restore. */
diff --git a/gs/psi/dmmain.c b/gs/psi/dmmain.c
index 445c5a049..206db9135 100644
--- a/gs/psi/dmmain.c
+++ b/gs/psi/dmmain.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,13 +81,13 @@ static int GSDLLCALL gsdll_poll(void *handle);
static int display_open(void *handle, void *device);
static int display_preclose(void *handle, void *device);
static int display_close(void *handle, void *device);
-static int display_presize(void *handle, void *device, int width, int height,
+static int display_presize(void *handle, void *device, int width, int height,
int raster, unsigned int format);
-static int display_size(void *handle, void *device, int width, int height,
+static int display_size(void *handle, void *device, int width, int height,
int raster, unsigned int format, unsigned char *pimage);
static int display_sync(void *handle, void *device);
static int display_page(void *handle, void *device, int copies, int flush);
-static int display_update(void *handle, void *device,
+static int display_update(void *handle, void *device,
int x, int y, int w, int h);
static size_t get_input(void *ptr, size_t size);
@@ -212,7 +212,7 @@ static int display_close(void *handle, void *device)
/* Device is about to be resized. */
/* Resize will only occur if this function returns 0. */
-static int display_presize(void *handle, void *device, int width, int height,
+static int display_presize(void *handle, void *device, int width, int height,
int raster, unsigned int format)
{
/* Check for correct format (32-bit RGB), fatal error if not */
@@ -225,10 +225,10 @@ static int display_presize(void *handle, void *device, int width, int height,
return 0;
}
-
+
/* Device has been resized. */
/* New pointer to raster returned in pimage */
-static int display_size(void *handle, void *device, int width, int height,
+static int display_size(void *handle, void *device, int width, int height,
int raster, unsigned int format, unsigned char *pimage)
{
PixMapPtr pixmap;
@@ -270,7 +270,7 @@ static int display_size(void *handle, void *device, int width, int height,
window_invalidate(img->windowRef);
return gsdll_poll(handle);
}
-
+
/* flushpage */
static int display_sync(void *handle, void *device)
{
@@ -293,7 +293,7 @@ static int display_page(void *handle, void *device, int copies, int flush)
/* Poll the caller for cooperative multitasking. */
/* If this function is NULL, polling is not needed */
-static int display_update(void *handle, void *device,
+static int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
UInt64 t1;
@@ -329,7 +329,7 @@ static int display_update(void *handle, void *device,
return gsdll_poll(handle);
}
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -420,7 +420,7 @@ static size_t get_input(void *ptr, size_t size)
stdin_bufsize = charswaiting;
memcpy(stdin_buf, text, stdin_bufsize);
SIOUXselstart += charswaiting;
-
+
text = stdin_buf;
while (text = memchr(text, '\r', charswaiting - (text - stdin_buf)))
*text = '\n';
@@ -604,7 +604,7 @@ void main(void)
0L,false) != noErr)
ExitToShell();
- gActionFunctionScrollUPP = NewControlActionUPP(&actionFunctionScroll);
+ gActionFunctionScrollUPP = NewControlActionUPP(&actionFunctionScroll);
Gestalt(gestaltMenuMgrAttr,&response);
if(response & gestaltMenuMgrAquaLayoutMask)
@@ -642,7 +642,7 @@ void main(void)
argv[1] = ddevice;
argv[2] = dformat;
- sprintf(ddevice, "-sDEVICE=display");
+ sprintf(ddevice, "-sDEVICE=display");
sprintf(dformat, "-dDisplayFormat=%d", display_format);
/* Run Ghostscript */
@@ -664,13 +664,13 @@ void main(void)
code = gsapi_init_with_args(instance, argc, argv);
if (code == 0)
code = gsapi_run_string(instance, start_string, 0, &exit_code);
- else
+ else
{
printf("Failed to initialize. Error %d.\n", code);
fflush(stdout);
}
code = gsapi_exit(instance);
- if (code != 0)
+ if (code != 0)
{
printf("Failed to terminate. Error %d.\n", code);
fflush(stdout);
@@ -708,7 +708,7 @@ void main(void)
void doEvents(EventRecord *eventStrucPtr)
{
WindowRef windowRef;
-
+
if (eventStrucPtr->what == mouseDown &&
FindWindow(eventStrucPtr->where,&windowRef) == inMenuBar)
SelectWindow(SIOUXTextWindow->window);
@@ -817,7 +817,7 @@ void doUpdate(EventRecord *eventStrucPtr)
WindowRef windowRef;
windowRef = (WindowRef) eventStrucPtr->message;
-
+
window_adjust_scrollbars(windowRef);
BeginUpdate(windowRef);
@@ -836,7 +836,7 @@ void doUpdateWindow(EventRecord *eventStrucPtr)
PixMapHandle srcPixmapHdl, destPixmapHdl;
RGBColor grayColour = { 0xC000,0xC000,0xC000 };
SInt32 hScroll, vScroll;
-
+
windowRef = (WindowRef) eventStrucPtr->message;
img = (IMAGE*)GetWRefCon(windowRef);
srcPixmapHdl = img->pixmapHdl;
@@ -873,13 +873,13 @@ void doUpdateWindow(EventRecord *eventStrucPtr)
destRect.bottom = pixmap->bounds.bottom;
}
DisposePixPat(hdlPixPat);
-
+
srcRect = destRect;
srcRect.left += hScroll;
srcRect.right += hScroll;
srcRect.top += vScroll;
srcRect.bottom += vScroll;
-
+
CopyBits((BitMap*)*srcPixmapHdl, (BitMap*)*destPixmapHdl,
&srcRect, &destRect, srcCopy, NULL);
}
@@ -961,7 +961,7 @@ pascal void actionFunctionScroll(ControlRef controlRef,ControlPartCode controlPa
oldControlValue = controlValue;
controlMax = GetControl32BitMaximum(controlRef);
controlValue = oldControlValue - scrollDistance;
-
+
if(controlValue < 0)
controlValue = 0;
else if(controlValue > controlMax)
@@ -994,4 +994,3 @@ OSErr quitAppEventHandler(AppleEvent *appEvent,AppleEvent *reply,SInt32 handlerR
}
/*********************************************************************/
-
diff --git a/gs/psi/dpmain.c b/gs/psi/dpmain.c
index 8d9da7b36..7ab607efc 100644
--- a/gs/psi/dpmain.c
+++ b/gs/psi/dpmain.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,6 @@ const char *szDllName = "GSDLL2.DLL";
char start_string[] = "systemdict /start get exec\n";
int debug = TRUE /* FALSE */;
-
#define MIN_COMMIT 4096 /* memory is committed in these size chunks */
#define ID_NAME "GSPMDRV_%u_%u"
#define SHARED_NAME "\\SHAREMEM\\%s"
@@ -60,16 +59,16 @@ ULONG os_version;
/* main structure with info about the GS DLL */
typedef struct tagGSDLL {
- HMODULE hmodule; /* DLL module handle */
- PFN_gsapi_revision revision;
- PFN_gsapi_new_instance new_instance;
- PFN_gsapi_delete_instance delete_instance;
- PFN_gsapi_set_stdio set_stdio;
- PFN_gsapi_set_poll set_poll;
- PFN_gsapi_set_display_callback set_display_callback;
- PFN_gsapi_init_with_args init_with_args;
- PFN_gsapi_run_string run_string;
- PFN_gsapi_exit exit;
+ HMODULE hmodule; /* DLL module handle */
+ PFN_gsapi_revision revision;
+ PFN_gsapi_new_instance new_instance;
+ PFN_gsapi_delete_instance delete_instance;
+ PFN_gsapi_set_stdio set_stdio;
+ PFN_gsapi_set_poll set_poll;
+ PFN_gsapi_set_display_callback set_display_callback;
+ PFN_gsapi_init_with_args init_with_args;
+ PFN_gsapi_run_string run_string;
+ PFN_gsapi_exit exit;
} GSDLL;
GSDLL gsdll;
@@ -96,13 +95,13 @@ gs_free_dll(void)
APIRET rc;
if (gsdll.hmodule == (HMODULE) NULL)
- return TRUE;
+ return TRUE;
rc = DosFreeModule(gsdll.hmodule);
if (rc) {
- sprintf(buf, "DosFreeModule returns %d\n", rc);
- gs_addmess(buf);
- sprintf(buf, "Unloaded GSDLL\n\n");
- gs_addmess(buf);
+ sprintf(buf, "DosFreeModule returns %d\n", rc);
+ gs_addmess(buf);
+ sprintf(buf, "Unloaded GSDLL\n\n");
+ gs_addmess(buf);
}
return !rc;
}
@@ -133,167 +132,166 @@ gs_load_dll(void)
gsapi_revision_t rv;
if ((rc = DosGetInfoBlocks(&pptib, &pppib)) != 0) {
- fprintf(stdout, "Couldn't get pid, rc = \n", rc);
- return FALSE;
+ fprintf(stdout, "Couldn't get pid, rc = \n", rc);
+ return FALSE;
}
/* get path to EXE */
- if ((rc = DosQueryModuleName(pppib->pib_hmte, sizeof(szExePath),
- szExePath)) != 0) {
- fprintf(stdout, "Couldn't get module name, rc = %d\n", rc);
- return FALSE;
+ if ((rc = DosQueryModuleName(pppib->pib_hmte, sizeof(szExePath),
+ szExePath)) != 0) {
+ fprintf(stdout, "Couldn't get module name, rc = %d\n", rc);
+ return FALSE;
}
if ((p = strrchr(szExePath, '\\')) != (char *)NULL) {
- p++;
- *p = '\0';
+ p++;
+ *p = '\0';
}
dllname = szDllName;
#ifdef DEBUG
if (debug) {
- sprintf(buf, "Trying to load %s\n", dllname);
- gs_addmess(buf);
+ sprintf(buf, "Trying to load %s\n", dllname);
+ gs_addmess(buf);
}
#endif
memset(buf, 0, sizeof(buf));
rc = DosLoadModule(buf, sizeof(buf), dllname, &gsdll.hmodule);
if (rc) {
- /* failed */
- /* try again, with path of EXE */
- if ((shortname = strrchr((char *)szDllName, '\\'))
- == (const char *)NULL)
- shortname = szDllName;
- strcpy(fullname, szExePath);
- if ((p = strrchr(fullname, '\\')) != (char *)NULL)
- p++;
- else
- p = fullname;
- *p = '\0';
- strcat(fullname, shortname);
- dllname = fullname;
+ /* failed */
+ /* try again, with path of EXE */
+ if ((shortname = strrchr((char *)szDllName, '\\'))
+ == (const char *)NULL)
+ shortname = szDllName;
+ strcpy(fullname, szExePath);
+ if ((p = strrchr(fullname, '\\')) != (char *)NULL)
+ p++;
+ else
+ p = fullname;
+ *p = '\0';
+ strcat(fullname, shortname);
+ dllname = fullname;
#ifdef DEBUG
- if (debug) {
- sprintf(buf, "Trying to load %s\n", dllname);
- gs_addmess(buf);
- }
+ if (debug) {
+ sprintf(buf, "Trying to load %s\n", dllname);
+ gs_addmess(buf);
+ }
#endif
- rc = DosLoadModule(buf, sizeof(buf), dllname, &gsdll.hmodule);
- if (rc) {
- /* failed again */
- /* try once more, this time on system search path */
- dllname = shortname;
+ rc = DosLoadModule(buf, sizeof(buf), dllname, &gsdll.hmodule);
+ if (rc) {
+ /* failed again */
+ /* try once more, this time on system search path */
+ dllname = shortname;
#ifdef DEBUG
- if (debug) {
- sprintf(buf, "Trying to load %s\n", dllname);
- gs_addmess(buf);
- }
+ if (debug) {
+ sprintf(buf, "Trying to load %s\n", dllname);
+ gs_addmess(buf);
+ }
#endif
- rc = DosLoadModule(buf, sizeof(buf), dllname, &gsdll.hmodule);
- }
+ rc = DosLoadModule(buf, sizeof(buf), dllname, &gsdll.hmodule);
+ }
}
if (rc == 0) {
#ifdef DEBUG
- if (debug)
- gs_addmess("Loaded Ghostscript DLL\n");
+ if (debug)
+ gs_addmess("Loaded Ghostscript DLL\n");
#endif
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_REVISION",
- (PFN *) (&gsdll.revision))) != 0) {
- sprintf(buf, "Can't find GSAPI_REVISION, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- /* check DLL version */
- if (gsdll.revision(&rv, sizeof(rv)) != 0) {
- sprintf(buf, "Unable to identify Ghostscript DLL revision - it must be newer than needed.\n");
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
-
- if (rv.revision != GS_REVISION) {
- sprintf(buf, "Wrong version of DLL found.\n Found version %ld\n Need version %ld\n", rv.revision, (long)GS_REVISION);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
-
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_NEW_INSTANCE",
- (PFN *) (&gsdll.new_instance))) != 0) {
- sprintf(buf, "Can't find GSAPI_NEW_INSTANCE, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_DELETE_INSTANCE",
- (PFN *) (&gsdll.delete_instance))) != 0) {
- sprintf(buf, "Can't find GSAPI_DELETE_INSTANCE, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_STDIO",
- (PFN *) (&gsdll.set_stdio))) != 0) {
- sprintf(buf, "Can't find GSAPI_SET_STDIO, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_DISPLAY_CALLBACK",
- (PFN *) (&gsdll.set_display_callback))) != 0) {
- sprintf(buf, "Can't find GSAPI_SET_DISPLAY_CALLBACK, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_POLL",
- (PFN *) (&gsdll.set_poll))) != 0) {
- sprintf(buf, "Can't find GSAPI_SET_POLL, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0,
- "GSAPI_INIT_WITH_ARGS",
- (PFN *) (&gsdll.init_with_args))) != 0) {
- sprintf(buf, "Can't find GSAPI_INIT_WITH_ARGS, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_RUN_STRING",
- (PFN *) (&gsdll.run_string))) != 0) {
- sprintf(buf, "Can't find GSAPI_RUN_STRING, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
- if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_EXIT",
- (PFN *) (&gsdll.exit))) != 0) {
- sprintf(buf, "Can't find GSAPI_EXIT, rc = %d\n", rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
- }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_REVISION",
+ (PFN *) (&gsdll.revision))) != 0) {
+ sprintf(buf, "Can't find GSAPI_REVISION, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ /* check DLL version */
+ if (gsdll.revision(&rv, sizeof(rv)) != 0) {
+ sprintf(buf, "Unable to identify Ghostscript DLL revision - it must be newer than needed.\n");
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+
+ if (rv.revision != GS_REVISION) {
+ sprintf(buf, "Wrong version of DLL found.\n Found version %ld\n Need version %ld\n", rv.revision, (long)GS_REVISION);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_NEW_INSTANCE",
+ (PFN *) (&gsdll.new_instance))) != 0) {
+ sprintf(buf, "Can't find GSAPI_NEW_INSTANCE, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_DELETE_INSTANCE",
+ (PFN *) (&gsdll.delete_instance))) != 0) {
+ sprintf(buf, "Can't find GSAPI_DELETE_INSTANCE, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_STDIO",
+ (PFN *) (&gsdll.set_stdio))) != 0) {
+ sprintf(buf, "Can't find GSAPI_SET_STDIO, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_DISPLAY_CALLBACK",
+ (PFN *) (&gsdll.set_display_callback))) != 0) {
+ sprintf(buf, "Can't find GSAPI_SET_DISPLAY_CALLBACK, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_SET_POLL",
+ (PFN *) (&gsdll.set_poll))) != 0) {
+ sprintf(buf, "Can't find GSAPI_SET_POLL, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0,
+ "GSAPI_INIT_WITH_ARGS",
+ (PFN *) (&gsdll.init_with_args))) != 0) {
+ sprintf(buf, "Can't find GSAPI_INIT_WITH_ARGS, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_RUN_STRING",
+ (PFN *) (&gsdll.run_string))) != 0) {
+ sprintf(buf, "Can't find GSAPI_RUN_STRING, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
+ if ((rc = DosQueryProcAddr(gsdll.hmodule, 0, "GSAPI_EXIT",
+ (PFN *) (&gsdll.exit))) != 0) {
+ sprintf(buf, "Can't find GSAPI_EXIT, rc = %d\n", rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
+ }
} else {
- sprintf(buf, "Can't load Ghostscript DLL %s \nDosLoadModule rc = %d\n",
- szDllName, rc);
- gs_addmess(buf);
- gs_load_dll_cleanup();
- return FALSE;
+ sprintf(buf, "Can't load Ghostscript DLL %s \nDosLoadModule rc = %d\n",
+ szDllName, rc);
+ gs_addmess(buf);
+ gs_load_dll_cleanup();
+ return FALSE;
}
return TRUE;
}
-
/*********************************************************************/
/* stdio functions */
-static int
+static int
gsdll_stdin(void *instance, char *buf, int len)
{
return read(fileno(stdin), buf, len);
}
-static int
+static int
gsdll_stdout(void *instance, const char *str, int len)
{
fwrite(str, 1, len, stdout);
@@ -301,7 +299,7 @@ gsdll_stdout(void *instance, const char *str, int len)
return len;
}
-static int
+static int
gsdll_stderr(void *instance, const char *str, int len)
{
fwrite(str, 1, len, stderr);
@@ -347,13 +345,12 @@ image_find(void *handle, void *device)
{
IMAGE *img;
for (img = first_image; img!=0; img=img->next) {
- if ((img->handle == handle) && (img->device == device))
- return img;
+ if ((img->handle == handle) && (img->device == device))
+ return img;
}
return NULL;
}
-
/* start gspmdrv.exe */
static int run_gspmdrv(IMAGE *img)
{
@@ -372,33 +369,33 @@ static int run_gspmdrv(IMAGE *img)
#ifdef DEBUG
if (debug)
- fprintf(stdout, "run_gspmdrv: starting\n");
+ fprintf(stdout, "run_gspmdrv: starting\n");
#endif
sprintf(id, ID_NAME, img->pid, (ULONG)img->device);
/* Create termination queue - used to find out when gspmdrv terminates */
sprintf(term_queue_name, "\\QUEUES\\TERMQ_%s", id);
if (DosCreateQueue(&(img->term_queue), QUE_FIFO, term_queue_name)) {
- fprintf(stdout, "run_gspmdrv: failed to create termination queue\n");
- return e_limitcheck;
+ fprintf(stdout, "run_gspmdrv: failed to create termination queue\n");
+ return e_limitcheck;
}
/* get full path to gsos2.exe and hence path to gspmdrv.exe */
if ((rc = DosGetInfoBlocks(&pptib, &pppib)) != 0) {
- fprintf(stdout, "run_gspmdrv: Couldn't get module handle, rc = %d\n",
- rc);
- return e_limitcheck;
+ fprintf(stdout, "run_gspmdrv: Couldn't get module handle, rc = %d\n",
+ rc);
+ return e_limitcheck;
}
- if ((rc = DosQueryModuleName(pppib->pib_hmte, sizeof(progname) - 1,
- progname)) != 0) {
- fprintf(stdout, "run_gspmdrv: Couldn't get module name, rc = %d\n",
- rc);
- return e_limitcheck;
+ if ((rc = DosQueryModuleName(pppib->pib_hmte, sizeof(progname) - 1,
+ progname)) != 0) {
+ fprintf(stdout, "run_gspmdrv: Couldn't get module name, rc = %d\n",
+ rc);
+ return e_limitcheck;
}
if ((tail = strrchr(progname, '\\')) != (PCHAR) NULL) {
- tail++;
- *tail = '\0';
+ tail++;
+ *tail = '\0';
} else
- tail = progname;
+ tail = progname;
strcat(progname, pdrvname);
/* Open the PM driver session gspmdrv.exe */
@@ -407,7 +404,7 @@ static int run_gspmdrv(IMAGE *img)
/* (2) id string */
sprintf(arg, "-d %s", id);
- /* because gspmdrv.exe is a different EXE type to gs.exe,
+ /* because gspmdrv.exe is a different EXE type to gs.exe,
* we must use start session not DosExecPgm() */
sdata.Length = sizeof(sdata);
sdata.Related = SSF_RELATED_CHILD; /* to be a child */
@@ -419,7 +416,7 @@ static int run_gspmdrv(IMAGE *img)
sdata.TermQ = term_queue_name;
sdata.Environment = pppib->pib_pchenv; /* use Parent's environment */
sdata.InheritOpt = 0; /* Can't inherit from parent because */
- /* different sesison type */
+ /* different sesison type */
sdata.SessionType = SSF_TYPE_DEFAULT; /* default is PM */
sdata.IconFile = NULL;
sdata.PgmHandle = 0;
@@ -433,14 +430,14 @@ static int run_gspmdrv(IMAGE *img)
rc = DosStartSession(&sdata, &img->session_id, &img->process_id);
if (rc == ERROR_FILE_NOT_FOUND) {
- sdata.PgmName = pdrvname;
- rc = DosStartSession(&sdata, &img->session_id, &img->process_id);
+ sdata.PgmName = pdrvname;
+ rc = DosStartSession(&sdata, &img->session_id, &img->process_id);
}
if (rc) {
- fprintf(stdout, "run_gspmdrv: failed to run %s, rc = %d\n",
- sdata.PgmName, rc);
- fprintf(stdout, "run_gspmdrv: error_message: %s\n", error_message);
- return e_limitcheck;
+ fprintf(stdout, "run_gspmdrv: failed to run %s, rc = %d\n",
+ sdata.PgmName, rc);
+ fprintf(stdout, "run_gspmdrv: error_message: %s\n", error_message);
+ return e_limitcheck;
}
#ifdef DEBUG
if (debug)
@@ -450,90 +447,89 @@ static int run_gspmdrv(IMAGE *img)
}
void
-image_color(unsigned int format, int index,
+image_color(unsigned int format, int index,
unsigned char *r, unsigned char *g, unsigned char *b)
{
switch (format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 0 : 255);
- break;
- case DISPLAY_DEPTH_4:
- if (index == 7)
- *r = *g = *b = 170;
- else if (index == 8)
- *r = *g = *b = 85;
- else {
- int one = index & 8 ? 255 : 128;
- *r = (index & 4 ? one : 0);
- *g = (index & 2 ? one : 0);
- *b = (index & 1 ? one : 0);
- }
- break;
- case DISPLAY_DEPTH_8:
- /* palette of 96 colors */
- /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
- if (index < 64) {
- int one = 255 / 3;
- *r = ((index & 0x30) >> 4) * one;
- *g = ((index & 0x0c) >> 2) * one;
- *b = (index & 0x03) * one;
- }
- else {
- int val = index & 0x1f;
- *r = *g = *b = (val << 3) + (val >> 2);
- }
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 255 : 0);
- break;
- case DISPLAY_DEPTH_4:
- *r = *g = *b = (unsigned char)((index<<4) + index);
- break;
- case DISPLAY_DEPTH_8:
- *r = *g = *b = (unsigned char)index;
- break;
- }
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 0 : 255);
+ break;
+ case DISPLAY_DEPTH_4:
+ if (index == 7)
+ *r = *g = *b = 170;
+ else if (index == 8)
+ *r = *g = *b = 85;
+ else {
+ int one = index & 8 ? 255 : 128;
+ *r = (index & 4 ? one : 0);
+ *g = (index & 2 ? one : 0);
+ *b = (index & 1 ? one : 0);
+ }
+ break;
+ case DISPLAY_DEPTH_8:
+ /* palette of 96 colors */
+ /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
+ if (index < 64) {
+ int one = 255 / 3;
+ *r = ((index & 0x30) >> 4) * one;
+ *g = ((index & 0x0c) >> 2) * one;
+ *b = (index & 0x03) * one;
+ }
+ else {
+ int val = index & 0x1f;
+ *r = *g = *b = (val << 3) + (val >> 2);
+ }
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 255 : 0);
+ break;
+ case DISPLAY_DEPTH_4:
+ *r = *g = *b = (unsigned char)((index<<4) + index);
+ break;
+ case DISPLAY_DEPTH_8:
+ *r = *g = *b = (unsigned char)index;
+ break;
+ }
+ break;
}
}
-
static int image_palette_size(int format)
{
int palsize = 0;
switch (format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- palsize = 2;
- break;
- case DISPLAY_DEPTH_4:
- palsize = 16;
- break;
- case DISPLAY_DEPTH_8:
- palsize = 96;
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- palsize = 2;
- break;
- case DISPLAY_DEPTH_4:
- palsize = 16;
- break;
- case DISPLAY_DEPTH_8:
- palsize = 256;
- break;
- }
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ palsize = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ palsize = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ palsize = 96;
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ palsize = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ palsize = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ palsize = 256;
+ break;
+ }
+ break;
}
return palsize;
}
@@ -552,32 +548,32 @@ int display_open(void *handle, void *device)
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('o', stdout);
+ fputc('o', stdout);
fprintf(stdout, "display_open(0x%x, 0x%x)\n", handle, device);
#endif
if (first_image) {
- /* gsos2.exe is a console application, and displays using
- * gspmdrv.exe which is a PM application. To start
- * gspmdrv.exe, DosStartSession is used with SSF_RELATED_CHILD.
- * A process can have only one child session marked SSF_RELATED_CHILD.
- * When we call DosStopSession for the second session, it will
- * close, but it will not write to the termination queue.
- * When we wait for the session to end by reading the
- * termination queue, we wait forever.
- * For this reason, multiple image windows are disabled
- * for OS/2.
- * To get around this, we would need to replace the current
- * method of one gspmdrv.exe session per window, to having
- * a new PM application which can display multiple windows
- * within a single session.
- */
- return e_limitcheck;
+ /* gsos2.exe is a console application, and displays using
+ * gspmdrv.exe which is a PM application. To start
+ * gspmdrv.exe, DosStartSession is used with SSF_RELATED_CHILD.
+ * A process can have only one child session marked SSF_RELATED_CHILD.
+ * When we call DosStopSession for the second session, it will
+ * close, but it will not write to the termination queue.
+ * When we wait for the session to end by reading the
+ * termination queue, we wait forever.
+ * For this reason, multiple image windows are disabled
+ * for OS/2.
+ * To get around this, we would need to replace the current
+ * method of one gspmdrv.exe session per window, to having
+ * a new PM application which can display multiple windows
+ * within a single session.
+ */
+ return e_limitcheck;
}
img = (IMAGE *)malloc(sizeof(IMAGE));
if (img == NULL)
- return e_limitcheck;
+ return e_limitcheck;
memset(img, 0, sizeof(IMAGE));
/* add to list */
@@ -590,8 +586,8 @@ int display_open(void *handle, void *device)
/* Derive ID from process ID */
if (DosGetInfoBlocks(&pptib, &pppib)) {
- fprintf(stdout, "\ndisplay_open: Couldn't get pid\n");
- return e_limitcheck;
+ fprintf(stdout, "\ndisplay_open: Couldn't get pid\n");
+ return e_limitcheck;
}
img->pid = pppib->pib_ulppid; /* use parent (CMD.EXE) pid */
sprintf(id, ID_NAME, img->pid, (ULONG) img->device);
@@ -599,34 +595,34 @@ int display_open(void *handle, void *device)
/* Create update event semaphore */
sprintf(name, SYNC_NAME, id);
if (DosCreateEventSem(name, &(img->sync_event), 0, FALSE)) {
- fprintf(stdout, "display_open: failed to create event semaphore %s\n", name);
- return e_limitcheck;
+ fprintf(stdout, "display_open: failed to create event semaphore %s\n", name);
+ return e_limitcheck;
}
/* Create mutex - used for preventing gspmdrv from accessing */
/* bitmap while we are changing the bitmap size. Initially unowned. */
sprintf(name, MUTEX_NAME, id);
if (DosCreateMutexSem(name, &(img->bmp_mutex), 0, FALSE)) {
- DosCloseEventSem(img->sync_event);
- fprintf(stdout, "display_open: failed to create mutex semaphore %s\n", name);
- return e_limitcheck;
+ DosCloseEventSem(img->sync_event);
+ fprintf(stdout, "display_open: failed to create mutex semaphore %s\n", name);
+ return e_limitcheck;
}
- /* Shared memory is common to all processes so we don't want to
+ /* Shared memory is common to all processes so we don't want to
* allocate too much.
*/
sprintf(name, SHARED_NAME, id);
if (DosAllocSharedMem((PPVOID) & img->bitmap, name,
- 13 * 1024 * 1024, PAG_READ | PAG_WRITE)) {
- fprintf(stdout, "display_open: failed allocating shared BMP memory %s\n", name);
- return e_limitcheck;
+ 13 * 1024 * 1024, PAG_READ | PAG_WRITE)) {
+ fprintf(stdout, "display_open: failed allocating shared BMP memory %s\n", name);
+ return e_limitcheck;
}
/* commit one page so there is enough storage for a */
/* bitmap header and palette */
if (DosSetMem(img->bitmap, MIN_COMMIT, PAG_COMMIT | PAG_DEFAULT)) {
- DosFreeMem(img->bitmap);
- fprintf(stdout, "display: failed committing BMP memory\n");
- return e_limitcheck;
+ DosFreeMem(img->bitmap);
+ fprintf(stdout, "display: failed committing BMP memory\n");
+ return e_limitcheck;
}
img->committed = MIN_COMMIT;
@@ -648,7 +644,7 @@ int display_open(void *handle, void *device)
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('O', stdout);
+ fputc('O', stdout);
#endif
return 0;
}
@@ -663,32 +659,32 @@ int display_preclose(void *handle, void *device)
BYTE ElemPriority;
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('l', stdout);
+ fputc('l', stdout);
fprintf(stdout, "display_preclose(0x%x, 0x%x)\n", handle, device);
#endif
img = image_find(handle, device);
if (img) {
- if (img->session_id) {
- /* Close gspmdrv driver */
- DosStopSession(STOP_SESSION_SPECIFIED, img->session_id);
- Request.pid = img->pid;
- Request.ulData = 0;
- /* wait for termination queue, queue is then closed */
- /* by session manager */
- DosReadQueue(img->term_queue, &Request, &DataLength,
- &DataAddress, 0, DCWW_WAIT, &ElemPriority, (HEV) NULL);
- /* queue needs to be closed by us */
- DosCloseQueue(img->term_queue);
- }
- img->session_id = 0;
- img->term_queue = 0;
-
- DosCloseEventSem(img->sync_event);
- DosCloseMutexSem(img->bmp_mutex);
+ if (img->session_id) {
+ /* Close gspmdrv driver */
+ DosStopSession(STOP_SESSION_SPECIFIED, img->session_id);
+ Request.pid = img->pid;
+ Request.ulData = 0;
+ /* wait for termination queue, queue is then closed */
+ /* by session manager */
+ DosReadQueue(img->term_queue, &Request, &DataLength,
+ &DataAddress, 0, DCWW_WAIT, &ElemPriority, (HEV) NULL);
+ /* queue needs to be closed by us */
+ DosCloseQueue(img->term_queue);
+ }
+ img->session_id = 0;
+ img->term_queue = 0;
+
+ DosCloseEventSem(img->sync_event);
+ DosCloseMutexSem(img->bmp_mutex);
}
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('L', stdout);
+ fputc('L', stdout);
#endif
return 0;
}
@@ -698,71 +694,71 @@ int display_close(void *handle, void *device)
IMAGE *img;
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('c', stdout);
+ fputc('c', stdout);
fprintf(stdout, "display_close(0x%x, 0x%x)\n", handle, device);
#endif
img = image_find(handle, device);
if (img) {
- /* gspmdrv was closed by display_preclose */
- /* release memory */
- DosFreeMem(img->bitmap);
- img->bitmap = (unsigned char *)NULL;
- img->committed = 0;
+ /* gspmdrv was closed by display_preclose */
+ /* release memory */
+ DosFreeMem(img->bitmap);
+ img->bitmap = (unsigned char *)NULL;
+ img->committed = 0;
}
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('C', stdout);
+ fputc('C', stdout);
#endif
return 0;
}
-int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('r', stdout);
+ fputc('r', stdout);
fprintf(stdout, "display_presize(0x%x 0x%x, %d, %d, %d, %d)\n",
- handle, device, width, height, raster, format);
+ handle, device, width, height, raster, format);
#endif
img = image_find(handle, device);
if (img) {
- int color = format & DISPLAY_COLORS_MASK;
- int depth = format & DISPLAY_DEPTH_MASK;
- int alpha = format & DISPLAY_ALPHA_MASK;
- img->format_known = FALSE;
- if ( ((color == DISPLAY_COLORS_NATIVE) ||
- (color == DISPLAY_COLORS_GRAY))
- &&
- ((depth == DISPLAY_DEPTH_1) ||
- (depth == DISPLAY_DEPTH_4) ||
- (depth == DISPLAY_DEPTH_8)) )
- img->format_known = TRUE;
- if ((color == DISPLAY_COLORS_RGB) && (depth == DISPLAY_DEPTH_8) &&
- (alpha == DISPLAY_ALPHA_NONE))
- img->format_known = TRUE;
- if (!img->format_known) {
- fprintf(stdout, "display_presize: format %d = 0x%x is unsupported\n", format, format);
- return e_limitcheck;
- }
- /* grab mutex to stop other thread using bitmap */
- DosRequestMutexSem(img->bmp_mutex, 120000);
- /* remember parameters so we can figure out where to allocate bitmap */
- img->width = width;
- img->height = height;
- img->raster = raster;
- img->format = format;
+ int color = format & DISPLAY_COLORS_MASK;
+ int depth = format & DISPLAY_DEPTH_MASK;
+ int alpha = format & DISPLAY_ALPHA_MASK;
+ img->format_known = FALSE;
+ if ( ((color == DISPLAY_COLORS_NATIVE) ||
+ (color == DISPLAY_COLORS_GRAY))
+ &&
+ ((depth == DISPLAY_DEPTH_1) ||
+ (depth == DISPLAY_DEPTH_4) ||
+ (depth == DISPLAY_DEPTH_8)) )
+ img->format_known = TRUE;
+ if ((color == DISPLAY_COLORS_RGB) && (depth == DISPLAY_DEPTH_8) &&
+ (alpha == DISPLAY_ALPHA_NONE))
+ img->format_known = TRUE;
+ if (!img->format_known) {
+ fprintf(stdout, "display_presize: format %d = 0x%x is unsupported\n", format, format);
+ return e_limitcheck;
+ }
+ /* grab mutex to stop other thread using bitmap */
+ DosRequestMutexSem(img->bmp_mutex, 120000);
+ /* remember parameters so we can figure out where to allocate bitmap */
+ img->width = width;
+ img->height = height;
+ img->raster = raster;
+ img->format = format;
}
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('R', stdout);
+ fputc('R', stdout);
#endif
return 0;
}
-
-int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+
+int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
IMAGE *img;
PBITMAPINFO2 bmi;
@@ -770,107 +766,107 @@ int display_size(void *handle, void *device, int width, int height,
int i;
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('z', stdout);
+ fputc('z', stdout);
fprintf(stdout, "display_size(0x%x 0x%x, %d, %d, %d, %d, %d, 0x%x)\n",
- handle, device, width, height, raster, format, pimage);
+ handle, device, width, height, raster, format, pimage);
#endif
img = image_find(handle, device);
if (img) {
- if (!img->format_known)
- return e_limitcheck;
-
- img->width = width;
- img->height = height;
- img->raster = raster;
- img->format = format;
- /* write BMP header including palette */
- bmi = (PBITMAPINFO2) img->bitmap;
- bmi->cbFix = BITMAPINFO2_SIZE;
- bmi->cx = img->width;
- bmi->cy = img->height;
- bmi->cPlanes = 1;
- bmi->cBitCount = 24;
- bmi->ulCompression = BCA_UNCOMP;
- bmi->cbImage = 0;
- bmi->cxResolution = 0;
- bmi->cyResolution = 0;
- bmi->cclrUsed = bmi->cclrImportant = image_palette_size(format);
-
- switch (img->format & DISPLAY_DEPTH_MASK) {
- default:
- case DISPLAY_DEPTH_1:
- bmi->cBitCount = 1;
- break;
- case DISPLAY_DEPTH_4:
- bmi->cBitCount = 4;
- break;
- case DISPLAY_DEPTH_8:
- if ((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_NATIVE)
- bmi->cBitCount = 8;
- else if ((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_GRAY)
- bmi->cBitCount = 8;
- else
- bmi->cBitCount = 24;
- break;
- }
-
- /* add palette if needed */
- nColors = bmi->cclrUsed;
- if (nColors) {
- unsigned char *p;
- p = img->bitmap + BITMAPINFO2_SIZE;
- for (i = 0; i < nColors; i++) {
- image_color(img->format, i, p+2, p+1, p);
- *(p+3) = 0;
- p += 4;
- }
- }
-
- /* release mutex to allow other thread to use bitmap */
- DosReleaseMutexSem(img->bmp_mutex);
+ if (!img->format_known)
+ return e_limitcheck;
+
+ img->width = width;
+ img->height = height;
+ img->raster = raster;
+ img->format = format;
+ /* write BMP header including palette */
+ bmi = (PBITMAPINFO2) img->bitmap;
+ bmi->cbFix = BITMAPINFO2_SIZE;
+ bmi->cx = img->width;
+ bmi->cy = img->height;
+ bmi->cPlanes = 1;
+ bmi->cBitCount = 24;
+ bmi->ulCompression = BCA_UNCOMP;
+ bmi->cbImage = 0;
+ bmi->cxResolution = 0;
+ bmi->cyResolution = 0;
+ bmi->cclrUsed = bmi->cclrImportant = image_palette_size(format);
+
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ default:
+ case DISPLAY_DEPTH_1:
+ bmi->cBitCount = 1;
+ break;
+ case DISPLAY_DEPTH_4:
+ bmi->cBitCount = 4;
+ break;
+ case DISPLAY_DEPTH_8:
+ if ((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_NATIVE)
+ bmi->cBitCount = 8;
+ else if ((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_GRAY)
+ bmi->cBitCount = 8;
+ else
+ bmi->cBitCount = 24;
+ break;
+ }
+
+ /* add palette if needed */
+ nColors = bmi->cclrUsed;
+ if (nColors) {
+ unsigned char *p;
+ p = img->bitmap + BITMAPINFO2_SIZE;
+ for (i = 0; i < nColors; i++) {
+ image_color(img->format, i, p+2, p+1, p);
+ *(p+3) = 0;
+ p += 4;
+ }
+ }
+
+ /* release mutex to allow other thread to use bitmap */
+ DosReleaseMutexSem(img->bmp_mutex);
}
#ifdef DISPLAY_DEBUG
if (debug) {
- fprintf(stdout, "\nBMP dump\n");
- fprintf(stdout, " bitmap=%lx\n", img->bitmap);
- fprintf(stdout, " committed=%lx\n", img->committed);
- fprintf(stdout, " cx=%d\n", bmi->cx);
- fprintf(stdout, " cy=%d\n", bmi->cy);
- fprintf(stdout, " cPlanes=%d\n", bmi->cPlanes);
- fprintf(stdout, " cBitCount=%d\n", bmi->cBitCount);
- fprintf(stdout, " ulCompression=%d\n", bmi->ulCompression);
- fprintf(stdout, " cbImage=%d\n", bmi->cbImage);
- fprintf(stdout, " cxResolution=%d\n", bmi->cxResolution);
- fprintf(stdout, " cyResolution=%d\n", bmi->cyResolution);
- fprintf(stdout, " cclrUsed=%d\n", bmi->cclrUsed);
- fprintf(stdout, " cclrImportant=%d\n", bmi->cclrImportant);
+ fprintf(stdout, "\nBMP dump\n");
+ fprintf(stdout, " bitmap=%lx\n", img->bitmap);
+ fprintf(stdout, " committed=%lx\n", img->committed);
+ fprintf(stdout, " cx=%d\n", bmi->cx);
+ fprintf(stdout, " cy=%d\n", bmi->cy);
+ fprintf(stdout, " cPlanes=%d\n", bmi->cPlanes);
+ fprintf(stdout, " cBitCount=%d\n", bmi->cBitCount);
+ fprintf(stdout, " ulCompression=%d\n", bmi->ulCompression);
+ fprintf(stdout, " cbImage=%d\n", bmi->cbImage);
+ fprintf(stdout, " cxResolution=%d\n", bmi->cxResolution);
+ fprintf(stdout, " cyResolution=%d\n", bmi->cyResolution);
+ fprintf(stdout, " cclrUsed=%d\n", bmi->cclrUsed);
+ fprintf(stdout, " cclrImportant=%d\n", bmi->cclrImportant);
}
if (debug)
- fputc('Z', stdout);
+ fputc('Z', stdout);
#endif
return 0;
}
-
+
int display_sync(void *handle, void *device)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('s', stdout);
+ fputc('s', stdout);
fprintf(stdout, "display_sync(0x%x, 0x%x)\n", handle, device);
#endif
img = image_find(handle, device);
if (img) {
- if (!img->format_known)
- return e_limitcheck;
- /* delay starting gspmdrv until display_size has been called */
- if (!img->session_id && (img->width != 0) && (img->height != 0))
- run_gspmdrv(img);
- DosPostEventSem(img->sync_event);
+ if (!img->format_known)
+ return e_limitcheck;
+ /* delay starting gspmdrv until display_size has been called */
+ if (!img->session_id && (img->width != 0) && (img->height != 0))
+ run_gspmdrv(img);
+ DosPostEventSem(img->sync_event);
}
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('S', stdout);
+ fputc('S', stdout);
#endif
return 0;
}
@@ -879,14 +875,14 @@ int display_page(void *handle, void *device, int copies, int flush)
{
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('p', stdout);
- fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
- handle, device, copies, flush);
+ fputc('p', stdout);
+ fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
+ handle, device, copies, flush);
#endif
display_sync(handle, device);
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('P', stdout);
+ fputc('P', stdout);
#endif
return 0;
}
@@ -901,41 +897,41 @@ void *display_memalloc(void *handle, void *device, unsigned long size)
#ifdef DISPLAY_DEBUG
if (debug)
- fputc('m', stdout);
- fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
- handle, device, size);
+ fputc('m', stdout);
+ fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
+ handle, device, size);
#endif
img = image_find(handle, device);
if (img) {
- /* we don't actually allocate memory here, we only commit
- * preallocated shared memory.
- * First work out size of header + palette.
- * We allocate space for the header and tell Ghostscript
- * that the memory starts just after the header.
- * We rely on the Ghostscript memory device placing the
- * raster at the start of this memory and having a
- * raster length the same as the length of a BMP row.
+ /* we don't actually allocate memory here, we only commit
+ * preallocated shared memory.
+ * First work out size of header + palette.
+ * We allocate space for the header and tell Ghostscript
+ * that the memory starts just after the header.
+ * We rely on the Ghostscript memory device placing the
+ * raster at the start of this memory and having a
+ * raster length the same as the length of a BMP row.
*/
- header = BITMAPINFO2_SIZE + image_palette_size(img->format) * 4;
-
- /* Work out if we need to commit more */
- needed = (size + header + MIN_COMMIT - 1) & (~(MIN_COMMIT - 1));
- if (needed > img->committed) {
- /* commit more memory */
- if (rc = DosSetMem(img->bitmap + img->committed,
- needed - img->committed,
- PAG_COMMIT | PAG_DEFAULT)) {
- fprintf(stdout, "No memory in display_memalloc rc = %d\n", rc);
- return NULL;
- }
- img->committed = needed;
- }
+ header = BITMAPINFO2_SIZE + image_palette_size(img->format) * 4;
+
+ /* Work out if we need to commit more */
+ needed = (size + header + MIN_COMMIT - 1) & (~(MIN_COMMIT - 1));
+ if (needed > img->committed) {
+ /* commit more memory */
+ if (rc = DosSetMem(img->bitmap + img->committed,
+ needed - img->committed,
+ PAG_COMMIT | PAG_DEFAULT)) {
+ fprintf(stdout, "No memory in display_memalloc rc = %d\n", rc);
+ return NULL;
+ }
+ img->committed = needed;
+ }
mem = img->bitmap + header;
}
#ifdef DISPLAY_DEBUG
fprintf(stdout, " returning 0x%x\n", (int)mem);
if (debug)
- fputc('M', stdout);
+ fputc('M', stdout);
#endif
return mem;
}
@@ -945,20 +941,19 @@ int display_memfree(void *handle, void *device, void *mem)
/* we can't uncommit shared memory, so do nothing */
/* memory will be released when device is closed */
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
- handle, device, mem);
+ fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
+ handle, device, mem);
#endif
}
-int display_update(void *handle, void *device,
+int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
/* unneeded - we are running image window in a separate process */
return 0;
}
-
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -974,10 +969,8 @@ display_callback display = {
display_memfree
};
-
/*********************************************************************/
-
int
main(int argc, char *argv[])
{
@@ -990,49 +983,48 @@ main(int argc, char *argv[])
ULONG version[3];
void *instance;
- if (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_REVISION,
- &version, sizeof(version)))
- os_version = 201000; /* a guess */
+ if (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_REVISION,
+ &version, sizeof(version)))
+ os_version = 201000; /* a guess */
else
- os_version = version[0] * 10000 + version[1] * 100 + version[2];
+ os_version = version[0] * 10000 + version[1] * 100 + version[2];
if (!gs_load_dll()) {
- fprintf(stdout, "Can't load %s\n", szDllName);
- return -1;
+ fprintf(stdout, "Can't load %s\n", szDllName);
+ return -1;
}
/* insert -dDisplayFormat=XXXXX as first argument */
- { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- int depth;
- HPS ps = WinGetPS(HWND_DESKTOP);
- HDC hdc = GpiQueryDevice(ps);
- DevQueryCaps(hdc, CAPS_COLOR_PLANES, 1, &display_planes);
- DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &display_bitcount);
- DevQueryCaps(hdc, CAPS_ADDITIONAL_GRAPHICS, 1, &display_hasPalMan);
- display_hasPalMan &= CAPS_PALETTE_MANAGER;
- depth = display_planes * display_bitcount;
- if ((depth <= 8) && !display_hasPalMan)
- depth = 24; /* disaster: limited colours and no palette */
- WinReleasePS(ps);
-
- if (depth > 8)
- format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 8)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 4)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ int depth;
+ HPS ps = WinGetPS(HWND_DESKTOP);
+ HDC hdc = GpiQueryDevice(ps);
+ DevQueryCaps(hdc, CAPS_COLOR_PLANES, 1, &display_planes);
+ DevQueryCaps(hdc, CAPS_COLOR_BITCOUNT, 1, &display_bitcount);
+ DevQueryCaps(hdc, CAPS_ADDITIONAL_GRAPHICS, 1, &display_hasPalMan);
+ display_hasPalMan &= CAPS_PALETTE_MANAGER;
+ depth = display_planes * display_bitcount;
+ if ((depth <= 8) && !display_hasPalMan)
+ depth = 24; /* disaster: limited colours and no palette */
+ WinReleasePS(ps);
+
+ if (depth > 8)
+ format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 8)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 4)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
sprintf(dformat, "-dDisplayFormat=%d", format);
}
nargc = argc + 1;
-
#ifdef DEBUG
- if (debug)
- fprintf(stdout, "%s\n", dformat);
+ if (debug)
+ fprintf(stdout, "%s\n", dformat);
#endif
nargc = argc + 1;
nargv = (char **)malloc((nargc + 1) * sizeof(char *));
@@ -1041,17 +1033,17 @@ main(int argc, char *argv[])
memcpy(&nargv[2], &argv[1], argc * sizeof(char *));
if ( (code = gsdll.new_instance(&instance, NULL)) == 0) {
- gsdll.set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
- gsdll.set_display_callback(instance, &display);
+ gsdll.set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
+ gsdll.set_display_callback(instance, &display);
- code = gsdll.init_with_args(instance, nargc, nargv);
- if (code == 0)
- code = gsdll.run_string(instance, start_string, 0, &exit_code);
- code1 = gsdll.exit(instance);
- if (code == 0 || (code == e_Quit && code1 != 0))
- code = code1;
+ code = gsdll.init_with_args(instance, nargc, nargv);
+ if (code == 0)
+ code = gsdll.run_string(instance, start_string, 0, &exit_code);
+ code1 = gsdll.exit(instance);
+ if (code == 0 || (code == e_Quit && code1 != 0))
+ code = code1;
- gsdll.delete_instance(instance);
+ gsdll.delete_instance(instance);
}
gs_free_dll();
@@ -1060,15 +1052,15 @@ main(int argc, char *argv[])
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
return exit_status;
diff --git a/gs/psi/dscparse.c b/gs/psi/dscparse.c
index f727d295a..977072978 100644
--- a/gs/psi/dscparse.c
+++ b/gs/psi/dscparse.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -14,22 +14,22 @@
/* $Id$ */
/*
- * This is a DSC parser, based on the DSC 3.0 spec,
+ * This is a DSC parser, based on the DSC 3.0 spec,
* with a few DSC 2.1 additions for page size.
*
* Current limitations:
- * %%+ may be used after any comment in the comment or trailer,
+ * %%+ may be used after any comment in the comment or trailer,
* but is currently only supported by
* %%DocumentMedia
*
* DSC 2.1 additions (discontinued in DSC 3.0):
- * %%DocumentPaperColors:
- * %%DocumentPaperForms:
- * %%DocumentPaperSizes:
- * %%DocumentPaperWeights:
+ * %%DocumentPaperColors:
+ * %%DocumentPaperForms:
+ * %%DocumentPaperSizes:
+ * %%DocumentPaperWeights:
* %%PaperColor: (ignored)
* %%PaperForm: (ignored)
- * %%PaperSize:
+ * %%PaperSize:
* %%PaperWeight: (ignored)
*
* Other additions for defaults or page section
@@ -64,8 +64,8 @@
#define DSC_START(dsc) ((dsc)->data_offset + (dsc)->data_index - (dsc)->line_length)
#define DSC_END(dsc) ((dsc)->data_offset + (dsc)->data_index)
-/* dsc_scan_SECTION() functions return one of
- * CDSC_ERROR, CDSC_OK, CDSC_NOTDSC
+/* dsc_scan_SECTION() functions return one of
+ * CDSC_ERROR, CDSC_OK, CDSC_NOTDSC
* or one of the following
*/
/* The line should be passed on to the next section parser. */
@@ -86,21 +86,21 @@ static int dsc_read_macbin(CDSC *dsc);
static int dsc_read_applesingle(CDSC *dsc);
static char * dsc_alloc_string(CDSC *dsc, const char *str, int len);
static char * dsc_add_line(CDSC *dsc, const char *line, unsigned int len);
-static char * dsc_copy_string(char *str, unsigned int slen,
+static char * dsc_copy_string(char *str, unsigned int slen,
char *line, unsigned int len, unsigned int *offset);
static GSDWORD dsc_get_dword(const unsigned char *buf);
static GSWORD dsc_get_word(const unsigned char *buf);
static GSDWORD dsc_get_bigendian_dword(const unsigned char *buf);
static GSWORD dsc_get_bigendian_word(const unsigned char *buf);
static int dsc_get_int(const char *line, unsigned int len, unsigned int *offset);
-static float dsc_get_real(const char *line, unsigned int len,
+static float dsc_get_real(const char *line, unsigned int len,
unsigned int *offset);
-static void dsc_unknown(CDSC *dsc);
+static void dsc_unknown(CDSC *dsc);
static GSBOOL dsc_is_section(char *line);
static int dsc_parse_pages(CDSC *dsc);
static int dsc_parse_bounding_box(CDSC *dsc, CDSCBBOX** pbbox, int offset);
static int dsc_parse_float_bounding_box(CDSC *dsc, CDSCFBBOX** pfbbox, int offset);
-static int dsc_parse_orientation(CDSC *dsc, unsigned int *porientation,
+static int dsc_parse_orientation(CDSC *dsc, unsigned int *porientation,
int offset);
static int dsc_parse_order(CDSC *dsc);
static int dsc_parse_media(CDSC *dsc, const CDSCMEDIA **page_media);
@@ -116,7 +116,7 @@ static int dsc_scan_prolog(CDSC *dsc);
static int dsc_scan_setup(CDSC *dsc);
static int dsc_scan_page(CDSC *dsc);
static int dsc_scan_trailer(CDSC *dsc);
-static int dsc_error(CDSC *dsc, unsigned int explanation,
+static int dsc_error(CDSC *dsc, unsigned int explanation,
char *line, unsigned int line_len);
static int dsc_dcs2_fixup(CDSC *dsc);
static int dsc_parse_platefile(CDSC *dsc);
@@ -185,7 +185,7 @@ enum CDSC_SCAN_SECTION {
};
static const char * const dsc_scan_section_name[15] = {
- "Type", "Comments",
+ "Type", "Comments",
"pre-Preview", "Preview",
"pre-Defaults", "Defaults",
"pre-Prolog", "Prolog",
@@ -195,7 +195,6 @@ static const char * const dsc_scan_section_name[15] = {
"EOF"
};
-
/******************************************************************/
/* Public functions */
/******************************************************************/
@@ -206,7 +205,7 @@ dsc_init(void *caller_data)
{
CDSC *dsc = (CDSC *)malloc(sizeof(CDSC));
if (dsc == NULL)
- return NULL;
+ return NULL;
memset(dsc, 0, sizeof(CDSC));
dsc->caller_data = caller_data;
dsc->ref_count = 0;
@@ -225,7 +224,7 @@ dsc_init_with_alloc(
{
CDSC *dsc = (CDSC *)memalloc(sizeof(CDSC), closure_data);
if (dsc == NULL)
- return NULL;
+ return NULL;
memset(dsc, 0, sizeof(CDSC));
dsc->caller_data = caller_data;
@@ -234,23 +233,20 @@ dsc_init_with_alloc(
dsc->mem_closure_data = closure_data;
dsc->ref_count = 0;
dsc_ref(dsc);
-
+
return dsc_init2(dsc);
}
-
-
/* destructor */
-void
+void
dsc_free(CDSC *dsc)
{
if (dsc == NULL)
- return;
+ return;
dsc_reset(dsc);
dsc_memfree(dsc, dsc);
}
-
CDSC *
dsc_new(void *caller_data)
{
@@ -263,24 +259,23 @@ dsc_ref(CDSC *dsc)
return ++(dsc->ref_count);
}
-int
+int
dsc_unref(CDSC *dsc)
{
if (dsc->ref_count <= 0)
- return -1;
+ return -1;
dsc->ref_count--;
if (dsc->ref_count == 0) {
- dsc_free(dsc);
- return 0;
+ dsc_free(dsc);
+ return 0;
}
return dsc->ref_count;
}
-
/* Tell DSC parser how long document will be, to allow ignoring
* of early %%Trailer and %%EOF. This is optional.
*/
-void
+void
dsc_set_length(CDSC *dsc, DSC_OFFSET len)
{
dsc->file_length = len;
@@ -292,7 +287,7 @@ dsc_set_length(CDSC *dsc, DSC_OFFSET len)
* CDSC_OK
* CDSC_NOTDSC (DSC will be ignored)
* other values indicate the last DSC comment read
- */
+ */
int
dsc_scan_data(CDSC *dsc, const char *data, int length)
{
@@ -300,142 +295,142 @@ dsc_scan_data(CDSC *dsc, const char *data, int length)
int code = 0;
if (dsc == NULL)
- return CDSC_ERROR;
+ return CDSC_ERROR;
if (dsc->id == CDSC_NOTDSC)
- return CDSC_NOTDSC;
+ return CDSC_NOTDSC;
dsc->id = CDSC_OK;
if (dsc->eof)
- return CDSC_OK; /* ignore */
+ return CDSC_OK; /* ignore */
if (length == 0) {
- /* EOF, so process what remains */
- dsc->eof = TRUE;
+ /* EOF, so process what remains */
+ dsc->eof = TRUE;
}
do {
- if (dsc->id == CDSC_NOTDSC)
- break;
-
- if (length != 0) {
- /* move existing data if needed */
- if (dsc->data_length > CDSC_DATA_LENGTH/2) {
- memmove(dsc->data, dsc->data + dsc->data_index,
- dsc->data_length - dsc->data_index);
- dsc->data_offset += dsc->data_index;
- dsc->data_length -= dsc->data_index;
- dsc->data_index = 0;
- }
- /* append to buffer */
- bytes_read = min(length, (int)(CDSC_DATA_LENGTH - dsc->data_length));
- memcpy(dsc->data + dsc->data_length, data, bytes_read);
- dsc->data_length += bytes_read;
- data += bytes_read;
- length -= bytes_read;
- }
- if (dsc->scan_section == scan_none) {
- code = dsc_scan_type(dsc);
- if (code == CDSC_NEEDMORE) {
- /* need more characters before we can identify type */
- code = CDSC_OK;
- break;
- }
- dsc->id = code;
- }
+ if (dsc->id == CDSC_NOTDSC)
+ break;
+
+ if (length != 0) {
+ /* move existing data if needed */
+ if (dsc->data_length > CDSC_DATA_LENGTH/2) {
+ memmove(dsc->data, dsc->data + dsc->data_index,
+ dsc->data_length - dsc->data_index);
+ dsc->data_offset += dsc->data_index;
+ dsc->data_length -= dsc->data_index;
+ dsc->data_index = 0;
+ }
+ /* append to buffer */
+ bytes_read = min(length, (int)(CDSC_DATA_LENGTH - dsc->data_length));
+ memcpy(dsc->data + dsc->data_length, data, bytes_read);
+ dsc->data_length += bytes_read;
+ data += bytes_read;
+ length -= bytes_read;
+ }
+ if (dsc->scan_section == scan_none) {
+ code = dsc_scan_type(dsc);
+ if (code == CDSC_NEEDMORE) {
+ /* need more characters before we can identify type */
+ code = CDSC_OK;
+ break;
+ }
+ dsc->id = code;
+ }
if (code == CDSC_NOTDSC) {
- dsc->id = CDSC_NOTDSC;
- break;
- }
-
- while ((code = dsc_read_line(dsc)) > 0) {
- if (dsc->id == CDSC_NOTDSC)
- break;
- if (dsc->file_length &&
- (dsc->data_offset + dsc->data_index > dsc->file_length)) {
- /* have read past end of where we need to parse. */
- return CDSC_OK; /* ignore */
- }
- if (dsc->doseps_end &&
- (dsc->data_offset + dsc->data_index > dsc->doseps_end)) {
- /* have read past end of DOS EPS or Mac Binary
- * PostScript section
- */
- return CDSC_OK; /* ignore */
- }
- if (dsc->eof)
- return CDSC_OK;
- if (dsc->skip_document)
- continue; /* embedded document */
- if (dsc->skip_lines)
- continue; /* embedded lines */
- if (IS_DSC(dsc->line, "%%BeginData:"))
- continue;
- if (IS_DSC(dsc->line, "%%BeginBinary:"))
- continue;
- if (IS_DSC(dsc->line, "%%EndDocument"))
- continue;
- if (IS_DSC(dsc->line, "%%EndData"))
- continue;
- if (IS_DSC(dsc->line, "%%EndBinary"))
- continue;
-
- do {
- switch (dsc->scan_section) {
- case scan_comments:
- code = dsc_scan_comments(dsc);
- break;
- case scan_pre_preview:
- case scan_preview:
- code = dsc_scan_preview(dsc);
- break;
- case scan_pre_defaults:
- case scan_defaults:
- code = dsc_scan_defaults(dsc);
- break;
- case scan_pre_prolog:
- case scan_prolog:
- code = dsc_scan_prolog(dsc);
- break;
- case scan_pre_setup:
- case scan_setup:
- code = dsc_scan_setup(dsc);
- break;
- case scan_pre_pages:
- case scan_pages:
- code = dsc_scan_page(dsc);
- break;
- case scan_pre_trailer:
- case scan_trailer:
- code = dsc_scan_trailer(dsc);
- break;
- case scan_eof:
- code = CDSC_OK;
- break;
- default:
- /* invalid state */
- code = CDSC_ERROR;
- }
- /* repeat if line is start of next section */
- } while (code == CDSC_PROPAGATE);
-
- /* if DOS EPS header not complete, ask for more */
- if (code == CDSC_NEEDMORE) {
- code = CDSC_OK;
- break;
- }
- if (code == CDSC_NOTDSC) {
- dsc->id = CDSC_NOTDSC;
- break;
- }
- }
+ dsc->id = CDSC_NOTDSC;
+ break;
+ }
+
+ while ((code = dsc_read_line(dsc)) > 0) {
+ if (dsc->id == CDSC_NOTDSC)
+ break;
+ if (dsc->file_length &&
+ (dsc->data_offset + dsc->data_index > dsc->file_length)) {
+ /* have read past end of where we need to parse. */
+ return CDSC_OK; /* ignore */
+ }
+ if (dsc->doseps_end &&
+ (dsc->data_offset + dsc->data_index > dsc->doseps_end)) {
+ /* have read past end of DOS EPS or Mac Binary
+ * PostScript section
+ */
+ return CDSC_OK; /* ignore */
+ }
+ if (dsc->eof)
+ return CDSC_OK;
+ if (dsc->skip_document)
+ continue; /* embedded document */
+ if (dsc->skip_lines)
+ continue; /* embedded lines */
+ if (IS_DSC(dsc->line, "%%BeginData:"))
+ continue;
+ if (IS_DSC(dsc->line, "%%BeginBinary:"))
+ continue;
+ if (IS_DSC(dsc->line, "%%EndDocument"))
+ continue;
+ if (IS_DSC(dsc->line, "%%EndData"))
+ continue;
+ if (IS_DSC(dsc->line, "%%EndBinary"))
+ continue;
+
+ do {
+ switch (dsc->scan_section) {
+ case scan_comments:
+ code = dsc_scan_comments(dsc);
+ break;
+ case scan_pre_preview:
+ case scan_preview:
+ code = dsc_scan_preview(dsc);
+ break;
+ case scan_pre_defaults:
+ case scan_defaults:
+ code = dsc_scan_defaults(dsc);
+ break;
+ case scan_pre_prolog:
+ case scan_prolog:
+ code = dsc_scan_prolog(dsc);
+ break;
+ case scan_pre_setup:
+ case scan_setup:
+ code = dsc_scan_setup(dsc);
+ break;
+ case scan_pre_pages:
+ case scan_pages:
+ code = dsc_scan_page(dsc);
+ break;
+ case scan_pre_trailer:
+ case scan_trailer:
+ code = dsc_scan_trailer(dsc);
+ break;
+ case scan_eof:
+ code = CDSC_OK;
+ break;
+ default:
+ /* invalid state */
+ code = CDSC_ERROR;
+ }
+ /* repeat if line is start of next section */
+ } while (code == CDSC_PROPAGATE);
+
+ /* if DOS EPS header not complete, ask for more */
+ if (code == CDSC_NEEDMORE) {
+ code = CDSC_OK;
+ break;
+ }
+ if (code == CDSC_NOTDSC) {
+ dsc->id = CDSC_NOTDSC;
+ break;
+ }
+ }
} while (length != 0);
return (code < 0) ? code : dsc->id;
}
/* Tidy up from incorrect DSC comments */
-int
+int
dsc_fixup(CDSC *dsc)
{
unsigned int i;
@@ -443,59 +438,58 @@ dsc_fixup(CDSC *dsc)
DSC_OFFSET *last;
if (dsc->id == CDSC_NOTDSC)
- return 0;
+ return 0;
/* flush last partial line */
dsc_scan_data(dsc, NULL, 0);
-
/* Fix DSC error: EOF before end of %%BeginData */
- if (dsc->eof &&
- (dsc->skip_lines || dsc->skip_bytes || dsc->skip_document)) {
- switch (dsc->scan_section) {
- case scan_comments:
- dsc->endcomments = DSC_END(dsc);
- break;
- case scan_preview:
- dsc->endpreview = DSC_END(dsc);
- break;
- case scan_defaults:
- dsc->enddefaults = DSC_END(dsc);
- break;
- case scan_prolog:
- dsc->endprolog = DSC_END(dsc);
- break;
- case scan_setup:
- dsc->endsetup = DSC_END(dsc);
- break;
- case scan_pages:
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].end = DSC_END(dsc);
- break;
- case scan_trailer:
- case scan_eof:
- dsc->endtrailer = DSC_END(dsc);
- break;
- }
- }
-
+ if (dsc->eof &&
+ (dsc->skip_lines || dsc->skip_bytes || dsc->skip_document)) {
+ switch (dsc->scan_section) {
+ case scan_comments:
+ dsc->endcomments = DSC_END(dsc);
+ break;
+ case scan_preview:
+ dsc->endpreview = DSC_END(dsc);
+ break;
+ case scan_defaults:
+ dsc->enddefaults = DSC_END(dsc);
+ break;
+ case scan_prolog:
+ dsc->endprolog = DSC_END(dsc);
+ break;
+ case scan_setup:
+ dsc->endsetup = DSC_END(dsc);
+ break;
+ case scan_pages:
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].end = DSC_END(dsc);
+ break;
+ case scan_trailer:
+ case scan_eof:
+ dsc->endtrailer = DSC_END(dsc);
+ break;
+ }
+ }
+
/* Fix DSC error: code between %%EndSetup and %%Page */
if (dsc->page_count && (dsc->page[0].begin != dsc->endsetup)
- && (dsc->endsetup != dsc->beginsetup)) {
- dsc->endsetup = dsc->page[0].begin;
- dsc_debug_print(dsc, "Warning: code included between setup and first page\n");
+ && (dsc->endsetup != dsc->beginsetup)) {
+ dsc->endsetup = dsc->page[0].begin;
+ dsc_debug_print(dsc, "Warning: code included between setup and first page\n");
}
/* Last page contained a false trailer, */
/* so extend last page to start of trailer */
if (dsc->page_count && (dsc->begintrailer != 0) &&
- (dsc->page[dsc->page_count-1].end != dsc->begintrailer)) {
- dsc_debug_print(dsc, "Ignoring earlier misplaced trailer\n");
- dsc_debug_print(dsc, "and extending last page to start of trailer\n");
- dsc->page[dsc->page_count-1].end = dsc->begintrailer;
+ (dsc->page[dsc->page_count-1].end != dsc->begintrailer)) {
+ dsc_debug_print(dsc, "Ignoring earlier misplaced trailer\n");
+ dsc_debug_print(dsc, "and extending last page to start of trailer\n");
+ dsc->page[dsc->page_count-1].end = dsc->begintrailer;
}
- /*
+ /*
* Join up all sections.
* There might be extra code between them, or we might have
* missed including the \n which followed \r.
@@ -506,127 +500,126 @@ dsc_fixup(CDSC *dsc)
dsc_section_join(dsc->beginprolog, &dsc->endprolog, &last);
dsc_section_join(dsc->beginsetup, &dsc->endsetup, &last);
for (i=0; i<dsc->page_count; i++)
- dsc_section_join(dsc->page[i].begin, &dsc->page[i].end, &last);
+ dsc_section_join(dsc->page[i].begin, &dsc->page[i].end, &last);
if (dsc->begintrailer)
- *last = dsc->begintrailer;
-
+ *last = dsc->begintrailer;
+
if ((dsc->page_pages == 0) && (dsc->page_count == 1)) {
- /* don't flag an error if %%Pages absent but one %%Page found */
- /* adjust incorrect page count */
- dsc->page_pages = dsc->page_count;
+ /* don't flag an error if %%Pages absent but one %%Page found */
+ /* adjust incorrect page count */
+ dsc->page_pages = dsc->page_count;
}
/* Warnings and Errors that we can now identify */
if ((dsc->page_count != dsc->page_pages)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_PAGES_WRONG, NULL, 0);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* adjust incorrect page count */
- dsc->page_pages = dsc->page_count;
- break;
- case CDSC_RESPONSE_CANCEL:
- break;;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_PAGES_WRONG, NULL, 0);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* adjust incorrect page count */
+ dsc->page_pages = dsc->page_count;
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ break;;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if (dsc->epsf && (dsc->bbox == (CDSCBBOX *)NULL)) {
- /* EPS files MUST include a BoundingBox */
- int rc = dsc_error(dsc, CDSC_MESSAGE_EPS_NO_BBOX, NULL, 0);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* Assume that it is EPS */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* Is NOT an EPS file */
- dsc->epsf = FALSE;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ /* EPS files MUST include a BoundingBox */
+ int rc = dsc_error(dsc, CDSC_MESSAGE_EPS_NO_BBOX, NULL, 0);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* Assume that it is EPS */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* Is NOT an EPS file */
+ dsc->epsf = FALSE;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if (dsc->epsf && ((dsc->page_count > 1) || (dsc->page_pages > 1))) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_EPS_PAGES, NULL, 0);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* Is an EPS file */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* Is NOT an EPS file */
- dsc->epsf = FALSE;
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_EPS_PAGES, NULL, 0);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* Is an EPS file */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* Is NOT an EPS file */
+ dsc->epsf = FALSE;
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
/* convert single file DSC 2.0 into multiple pages */
dsc_dcs2_fixup(dsc);
if ((dsc->media_count == 1) && (dsc->page_media == NULL)) {
- /* if one only media was specified, and default page media */
- /* was not specified, assume that default is the only media. */
- dsc->page_media = dsc->media[0];
+ /* if one only media was specified, and default page media */
+ /* was not specified, assume that default is the only media. */
+ dsc->page_media = dsc->media[0];
}
if ((dsc->media_count != 0) && (dsc->page_media == NULL)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_NO_MEDIA, NULL, 0);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* default media is first listed */
- dsc->page_media = dsc->media[0];
- break;
- case CDSC_RESPONSE_CANCEL:
- /* No default media */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_NO_MEDIA, NULL, 0);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* default media is first listed */
+ dsc->page_media = dsc->media[0];
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* No default media */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
/* make sure all pages have a label */
for (i=0; i<dsc->page_count; i++) {
- if (strlen(dsc->page[i].label) == 0) {
- sprintf(buf, "%d", i+1);
- if ((dsc->page[i].label = dsc_alloc_string(dsc, buf, (int)strlen(buf)))
- == (char *)NULL)
- return CDSC_ERROR; /* no memory */
- }
+ if (strlen(dsc->page[i].label) == 0) {
+ sprintf(buf, "%d", i+1);
+ if ((dsc->page[i].label = dsc_alloc_string(dsc, buf, (int)strlen(buf)))
+ == (char *)NULL)
+ return CDSC_ERROR; /* no memory */
+ }
}
return CDSC_OK;
}
-/* Install a function to be used for displaying messages about
+/* Install a function to be used for displaying messages about
* DSC errors and warnings, and to request advice from user.
* Installing an error function is optional.
*/
-void
-dsc_set_error_function(CDSC *dsc,
- int (*fn)(void *caller_data, CDSC *dsc,
- unsigned int explanation, const char *line, unsigned int line_len))
+void
+dsc_set_error_function(CDSC *dsc,
+ int (*fn)(void *caller_data, CDSC *dsc,
+ unsigned int explanation, const char *line, unsigned int line_len))
{
dsc->dsc_error_fn = fn;
}
-
/* Install a function for printing debug messages */
/* This is optional */
-void
-dsc_set_debug_function(CDSC *dsc,
- void (*debug_fn)(void *caller_data, const char *str))
+void
+dsc_set_debug_function(CDSC *dsc,
+ void (*debug_fn)(void *caller_data, const char *str))
{
dsc->debug_print_fn = debug_fn;
}
/* Doesn't need to be public for PostScript documents */
/* Made public so GSview can add pages when processing PDF files */
-int
+int
dsc_add_page(CDSC *dsc, int ordinal, char *label)
{
dsc->page[dsc->page_count].ordinal = ordinal;
- dsc->page[dsc->page_count].label =
- dsc_alloc_string(dsc, label, (int)strlen(label)+1);
+ dsc->page[dsc->page_count].label =
+ dsc_alloc_string(dsc, label, (int)strlen(label)+1);
dsc->page[dsc->page_count].begin = 0;
dsc->page[dsc->page_count].end = 0;
dsc->page[dsc->page_count].orientation = CDSC_ORIENT_UNKNOWN;
@@ -637,15 +630,15 @@ dsc_add_page(CDSC *dsc, int ordinal, char *label)
dsc->page_count++;
if (dsc->page_count >= dsc->page_chunk_length) {
- CDSCPAGE *new_page = (CDSCPAGE *)dsc_memalloc(dsc,
- (CDSC_PAGE_CHUNK+dsc->page_count) * sizeof(CDSCPAGE));
- if (new_page == NULL)
- return CDSC_ERROR; /* out of memory */
- memcpy(new_page, dsc->page,
- dsc->page_count * sizeof(CDSCPAGE));
- dsc_memfree(dsc, dsc->page);
- dsc->page= new_page;
- dsc->page_chunk_length = CDSC_PAGE_CHUNK+dsc->page_count;
+ CDSCPAGE *new_page = (CDSCPAGE *)dsc_memalloc(dsc,
+ (CDSC_PAGE_CHUNK+dsc->page_count) * sizeof(CDSCPAGE));
+ if (new_page == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memcpy(new_page, dsc->page,
+ dsc->page_count * sizeof(CDSCPAGE));
+ dsc_memfree(dsc, dsc->page);
+ dsc->page= new_page;
+ dsc->page_chunk_length = CDSC_PAGE_CHUNK+dsc->page_count;
}
return CDSC_OK;
}
@@ -659,22 +652,22 @@ dsc_add_media(CDSC *dsc, CDSCMEDIA *media)
CDSCMEDIA *newmedia;
/* extend media array */
- newmedia_array = (CDSCMEDIA **)dsc_memalloc(dsc,
- (dsc->media_count + 1) * sizeof(CDSCMEDIA *));
+ newmedia_array = (CDSCMEDIA **)dsc_memalloc(dsc,
+ (dsc->media_count + 1) * sizeof(CDSCMEDIA *));
if (newmedia_array == NULL)
- return CDSC_ERROR; /* out of memory */
+ return CDSC_ERROR; /* out of memory */
if (dsc->media != NULL) {
- memcpy(newmedia_array, dsc->media,
- dsc->media_count * sizeof(CDSCMEDIA *));
- dsc_memfree(dsc, dsc->media);
+ memcpy(newmedia_array, dsc->media,
+ dsc->media_count * sizeof(CDSCMEDIA *));
+ dsc_memfree(dsc, dsc->media);
}
dsc->media = newmedia_array;
/* allocate new media */
newmedia = dsc->media[dsc->media_count] =
- (CDSCMEDIA *)dsc_memalloc(dsc, sizeof(CDSCMEDIA));
+ (CDSCMEDIA *)dsc_memalloc(dsc, sizeof(CDSCMEDIA));
if (newmedia == NULL)
- return CDSC_ERROR; /* out of memory */
+ return CDSC_ERROR; /* out of memory */
newmedia->name = NULL;
newmedia->width = 595.0;
newmedia->height = 842.0;
@@ -686,33 +679,33 @@ dsc_add_media(CDSC *dsc, CDSCMEDIA *media)
dsc->media_count++;
if (media->name) {
- newmedia->name = dsc_alloc_string(dsc, media->name,
- (int)strlen(media->name));
- if (newmedia->name == NULL)
- return CDSC_ERROR; /* no memory */
+ newmedia->name = dsc_alloc_string(dsc, media->name,
+ (int)strlen(media->name));
+ if (newmedia->name == NULL)
+ return CDSC_ERROR; /* no memory */
}
newmedia->width = media->width;
newmedia->height = media->height;
newmedia->weight = media->weight;
if (media->colour) {
- newmedia->colour = dsc_alloc_string(dsc, media->colour,
- (int)strlen(media->colour));
+ newmedia->colour = dsc_alloc_string(dsc, media->colour,
+ (int)strlen(media->colour));
if (newmedia->colour == NULL)
- return CDSC_ERROR; /* no memory */
+ return CDSC_ERROR; /* no memory */
}
if (media->type) {
- newmedia->type = dsc_alloc_string(dsc, media->type,
- (int)strlen(media->type));
- if (newmedia->type == NULL)
- return CDSC_ERROR; /* no memory */
+ newmedia->type = dsc_alloc_string(dsc, media->type,
+ (int)strlen(media->type));
+ if (newmedia->type == NULL)
+ return CDSC_ERROR; /* no memory */
}
newmedia->mediabox = NULL;
if (media->mediabox) {
- newmedia->mediabox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
- if (newmedia->mediabox == NULL)
- return CDSC_ERROR; /* no memory */
- *newmedia->mediabox = *media->mediabox;
+ newmedia->mediabox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
+ if (newmedia->mediabox == NULL)
+ return CDSC_ERROR; /* no memory */
+ *newmedia->mediabox = *media->mediabox;
}
return CDSC_OK;
}
@@ -720,18 +713,18 @@ dsc_add_media(CDSC *dsc, CDSCMEDIA *media)
/* Doesn't need to be public for PostScript documents */
/* Made public so GSview can store PDF CropBox */
int
-dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
+dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
int llx, int lly, int urx, int ury)
{
CDSCBBOX *bbox;
if (page_number >= dsc->page_count)
- return CDSC_ERROR;
+ return CDSC_ERROR;
bbox = dsc->page[page_number].bbox;
if (bbox == NULL)
- dsc->page[page_number].bbox = bbox =
- (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
+ dsc->page[page_number].bbox = bbox =
+ (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
if (bbox == NULL)
- return CDSC_ERROR;
+ return CDSC_ERROR;
bbox->llx = llx;
bbox->lly = lly;
bbox->urx = urx;
@@ -739,7 +732,6 @@ dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
return CDSC_OK;
}
-
/******************************************************************/
/* Private functions below here. */
/******************************************************************/
@@ -748,17 +740,17 @@ static void *
dsc_memalloc(CDSC *dsc, size_t size)
{
if (dsc->memalloc)
- return dsc->memalloc(size, dsc->mem_closure_data);
+ return dsc->memalloc(size, dsc->mem_closure_data);
return malloc(size);
}
static void
dsc_memfree(CDSC*dsc, void *ptr)
{
- if (dsc->memfree)
- dsc->memfree(ptr, dsc->mem_closure_data);
+ if (dsc->memfree)
+ dsc->memfree(ptr, dsc->mem_closure_data);
else
- free(ptr);
+ free(ptr);
}
/* private constructor */
@@ -769,27 +761,27 @@ dsc_init2(CDSC *dsc)
dsc->string_head = (CDSCSTRING *)dsc_memalloc(dsc, sizeof(CDSCSTRING));
if (dsc->string_head == NULL) {
- dsc_free(dsc);
- return NULL; /* no memory */
+ dsc_free(dsc);
+ return NULL; /* no memory */
}
dsc->string = dsc->string_head;
dsc->string->next = NULL;
dsc->string->data = (char *)dsc_memalloc(dsc, CDSC_STRING_CHUNK);
if (dsc->string->data == NULL) {
- dsc_free(dsc);
- return NULL; /* no memory */
+ dsc_free(dsc);
+ return NULL; /* no memory */
}
dsc->string->index = 0;
dsc->string->length = CDSC_STRING_CHUNK;
-
+
dsc->page = (CDSCPAGE *)dsc_memalloc(dsc, CDSC_PAGE_CHUNK * sizeof(CDSCPAGE));
if (dsc->page == NULL) {
- dsc_free(dsc);
- return NULL; /* no memory */
+ dsc_free(dsc);
+ return NULL; /* no memory */
}
dsc->page_chunk_length = CDSC_PAGE_CHUNK;
dsc->page_count = 0;
-
+
dsc->line = NULL;
dsc->data_length = 0;
dsc->data_index = dsc->data_length;
@@ -797,8 +789,7 @@ dsc_init2(CDSC *dsc)
return dsc;
}
-
-static void
+static void
dsc_reset(CDSC *dsc)
{
unsigned int i;
@@ -825,39 +816,39 @@ dsc_reset(CDSC *dsc)
dsc->endsetup = 0;
dsc->begintrailer = 0;
dsc->endtrailer = 0;
-
+
for (i=0; i<dsc->page_count; i++) {
- /* page media is pointer to an element of media or dsc_known_media */
- /* do not free it. */
+ /* page media is pointer to an element of media or dsc_known_media */
+ /* do not free it. */
- if (dsc->page[i].bbox)
- dsc_memfree(dsc, dsc->page[i].bbox);
- if (dsc->page[i].viewing_orientation)
- dsc_memfree(dsc, dsc->page[i].viewing_orientation);
- if (dsc->page[i].crop_box)
- dsc_memfree(dsc, dsc->page[i].crop_box);
+ if (dsc->page[i].bbox)
+ dsc_memfree(dsc, dsc->page[i].bbox);
+ if (dsc->page[i].viewing_orientation)
+ dsc_memfree(dsc, dsc->page[i].viewing_orientation);
+ if (dsc->page[i].crop_box)
+ dsc_memfree(dsc, dsc->page[i].crop_box);
}
if (dsc->page)
- dsc_memfree(dsc, dsc->page);
+ dsc_memfree(dsc, dsc->page);
dsc->page = NULL;
-
+
dsc->page_count = 0;
dsc->page_pages = 0;
dsc->page_order = CDSC_ORDER_UNKNOWN;
dsc->page_orientation = CDSC_ORIENT_UNKNOWN;
if (dsc->viewing_orientation)
- dsc_memfree(dsc, dsc->viewing_orientation);
+ dsc_memfree(dsc, dsc->viewing_orientation);
dsc->viewing_orientation = NULL;
-
+
if (dsc->media) {
- for (i=0; i<dsc->media_count; i++) {
- if (dsc->media[i]) {
- if (dsc->media[i]->mediabox)
- dsc_memfree(dsc, dsc->media[i]->mediabox);
- dsc_memfree(dsc, dsc->media[i]);
- }
- }
- dsc_memfree(dsc, dsc->media);
+ for (i=0; i<dsc->media_count; i++) {
+ if (dsc->media[i]) {
+ if (dsc->media[i]->mediabox)
+ dsc_memfree(dsc, dsc->media[i]->mediabox);
+ dsc_memfree(dsc, dsc->media[i]);
+ }
+ }
+ dsc_memfree(dsc, dsc->media);
}
dsc->media_count = 0;
dsc->media = NULL;
@@ -867,20 +858,19 @@ dsc_reset(CDSC *dsc)
dsc->page_media = NULL;
if (dsc->bbox)
- dsc_memfree(dsc, dsc->bbox);
+ dsc_memfree(dsc, dsc->bbox);
dsc->bbox = NULL;
if (dsc->page_bbox)
- dsc_memfree(dsc, dsc->page_bbox);
+ dsc_memfree(dsc, dsc->page_bbox);
dsc->page_bbox = NULL;
if (dsc->doseps)
- dsc_memfree(dsc, dsc->doseps);
+ dsc_memfree(dsc, dsc->doseps);
dsc->doseps = NULL;
-
+
dsc->dsc_title = NULL;
dsc->dsc_creator = NULL;
dsc->dsc_date = NULL;
dsc->dsc_for = NULL;
-
dsc->max_error = DSC_MAX_ERROR;
dsc->severity = dsc_severity;
@@ -906,7 +896,7 @@ dsc_reset(CDSC *dsc)
dsc->data_offset = 0;
dsc->eof = 0;
-
+
dsc->line = 0;
dsc->line_length = 0;
dsc->eol = 0;
@@ -917,11 +907,11 @@ dsc_reset(CDSC *dsc)
dsc->string = dsc->string_head;
while (dsc->string != (CDSCSTRING *)NULL) {
- if (dsc->string->data)
- dsc_memfree(dsc, dsc->string->data);
- dsc->string_head = dsc->string;
- dsc->string = dsc->string->next;
- dsc_memfree(dsc, dsc->string_head);
+ if (dsc->string->data)
+ dsc_memfree(dsc, dsc->string->data);
+ dsc->string_head = dsc->string;
+ dsc->string = dsc->string->next;
+ dsc_memfree(dsc, dsc->string_head);
}
dsc->string_head = NULL;
dsc->string = NULL;
@@ -930,41 +920,41 @@ dsc_reset(CDSC *dsc)
/* public data */
if (dsc->hires_bbox)
- dsc_memfree(dsc, dsc->hires_bbox);
+ dsc_memfree(dsc, dsc->hires_bbox);
dsc->hires_bbox = NULL;
if (dsc->crop_box)
- dsc_memfree(dsc, dsc->crop_box);
+ dsc_memfree(dsc, dsc->crop_box);
dsc->crop_box = NULL;
if (dsc->dcs2) {
- CDCS2 *this_dcs, *next_dcs;
- this_dcs = dsc->dcs2;
- while (this_dcs) {
- next_dcs = this_dcs->next;
- /* strings have already been freed */
- dsc_memfree(dsc, this_dcs);
- this_dcs = next_dcs;
- }
- dsc->dcs2 = NULL;
+ CDCS2 *this_dcs, *next_dcs;
+ this_dcs = dsc->dcs2;
+ while (this_dcs) {
+ next_dcs = this_dcs->next;
+ /* strings have already been freed */
+ dsc_memfree(dsc, this_dcs);
+ this_dcs = next_dcs;
+ }
+ dsc->dcs2 = NULL;
}
if (dsc->colours) {
- CDSCCOLOUR *this_colour, *next_colour;
- this_colour = dsc->colours;
- while (this_colour) {
- next_colour = this_colour->next;
- /* strings have already been freed */
- dsc_memfree(dsc, this_colour);
- this_colour = next_colour;
- }
- dsc->colours = NULL;
+ CDSCCOLOUR *this_colour, *next_colour;
+ this_colour = dsc->colours;
+ while (this_colour) {
+ next_colour = this_colour->next;
+ /* strings have already been freed */
+ dsc_memfree(dsc, this_colour);
+ this_colour = next_colour;
+ }
+ dsc->colours = NULL;
}
if (dsc->macbin)
- dsc_memfree(dsc, dsc->macbin);
+ dsc_memfree(dsc, dsc->macbin);
dsc->macbin = NULL;
}
-/*
+/*
* Join up all sections.
* There might be extra code between them, or we might have
* missed including the \n which followed \r.
@@ -972,16 +962,15 @@ dsc_reset(CDSC *dsc)
* pend is a pointer to the end of this section
* pplast is a pointer to a pointer of the end of the previous section
*/
-static void
+static void
dsc_section_join(DSC_OFFSET begin, DSC_OFFSET *pend, DSC_OFFSET **pplast)
{
if (begin)
- **pplast = begin;
+ **pplast = begin;
if (*pend > begin)
- *pplast = pend;
+ *pplast = pend;
}
-
/* return value is 0 if no line available, or length of line */
static int
dsc_read_line(CDSC *dsc)
@@ -990,191 +979,190 @@ dsc_read_line(CDSC *dsc)
dsc->line = NULL;
if (dsc->eof) {
- /* return all that remains, even if line incomplete */
- dsc->line = dsc->data + dsc->data_index;
- dsc->line_length = dsc->data_length - dsc->data_index;
- dsc->data_index = dsc->data_length;
- return dsc->line_length;
+ /* return all that remains, even if line incomplete */
+ dsc->line = dsc->data + dsc->data_index;
+ dsc->line_length = dsc->data_length - dsc->data_index;
+ dsc->data_index = dsc->data_length;
+ return dsc->line_length;
}
- if (dsc->file_length &&
- (dsc->data_offset + dsc->data_index >= dsc->file_length)) {
- /* Have read past where we need to parse. */
- /* Ignore all that remains. */
- dsc->line = dsc->data + dsc->data_index;
- dsc->line_length = dsc->data_length - dsc->data_index;
- dsc->data_index = dsc->data_length;
- return dsc->line_length;
+ if (dsc->file_length &&
+ (dsc->data_offset + dsc->data_index >= dsc->file_length)) {
+ /* Have read past where we need to parse. */
+ /* Ignore all that remains. */
+ dsc->line = dsc->data + dsc->data_index;
+ dsc->line_length = dsc->data_length - dsc->data_index;
+ dsc->data_index = dsc->data_length;
+ return dsc->line_length;
}
- if (dsc->doseps_end &&
- (dsc->data_offset + dsc->data_index >= dsc->doseps_end)) {
- /* Have read past end of DOS EPS PostScript section. */
- /* Ignore all that remains. */
- dsc->line = dsc->data + dsc->data_index;
- dsc->line_length = dsc->data_length - dsc->data_index;
- dsc->data_index = dsc->data_length;
- return dsc->line_length;
+ if (dsc->doseps_end &&
+ (dsc->data_offset + dsc->data_index >= dsc->doseps_end)) {
+ /* Have read past end of DOS EPS PostScript section. */
+ /* Ignore all that remains. */
+ dsc->line = dsc->data + dsc->data_index;
+ dsc->line_length = dsc->data_length - dsc->data_index;
+ dsc->data_index = dsc->data_length;
+ return dsc->line_length;
}
/* ignore embedded bytes */
if (dsc->skip_bytes) {
- int cnt = min(dsc->skip_bytes,
- (int)(dsc->data_length - dsc->data_index));
- dsc->skip_bytes -= cnt;
- dsc->data_index += cnt;
- if (dsc->skip_bytes != 0)
- return 0;
+ int cnt = min(dsc->skip_bytes,
+ (int)(dsc->data_length - dsc->data_index));
+ dsc->skip_bytes -= cnt;
+ dsc->data_index += cnt;
+ if (dsc->skip_bytes != 0)
+ return 0;
}
do {
- dsc->line = dsc->data + dsc->data_index;
- last = dsc->data + dsc->data_length;
- if (dsc->data_index == dsc->data_length) {
- dsc->line_length = 0;
- return 0;
- }
- if (dsc->eol) {
- /* if previous line was complete, increment line count */
- dsc->line_count++;
- if (dsc->skip_lines)
- dsc->skip_lines--;
- }
-
- /* skip over \n which followed \r */
- if (dsc->last_cr && dsc->line[0] == '\n') {
- dsc->data_index++;
- dsc->line++;
- }
- dsc->last_cr = FALSE;
-
- /* look for EOL */
- dsc->eol = FALSE;
- for (p = dsc->line; p < last; p++) {
- if (*p == '\r') {
- p++;
- if ((p<last) && (*p == '\n'))
- p++; /* include line feed also */
- else
- dsc->last_cr = TRUE; /* we might need to skip \n */
- dsc->eol = TRUE; /* dsc->line is a complete line */
- break;
- }
- if (*p == '\n') {
- p++;
- dsc->eol = TRUE; /* dsc->line is a complete line */
- break;
- }
- if (*p == '\032') { /* MS-DOS Ctrl+Z */
- dsc->eol = TRUE;
- }
- }
- if (dsc->eol == FALSE) {
- /* we haven't got a complete line yet */
- if (dsc->data_length - dsc->data_index < sizeof(dsc->data)/2) {
- /* buffer is less than half full, ask for some more */
- dsc->line_length = 0;
- return 0;
- }
- }
- dsc->data_index += dsc->line_length = (int)(p - dsc->line);
+ dsc->line = dsc->data + dsc->data_index;
+ last = dsc->data + dsc->data_length;
+ if (dsc->data_index == dsc->data_length) {
+ dsc->line_length = 0;
+ return 0;
+ }
+ if (dsc->eol) {
+ /* if previous line was complete, increment line count */
+ dsc->line_count++;
+ if (dsc->skip_lines)
+ dsc->skip_lines--;
+ }
+
+ /* skip over \n which followed \r */
+ if (dsc->last_cr && dsc->line[0] == '\n') {
+ dsc->data_index++;
+ dsc->line++;
+ }
+ dsc->last_cr = FALSE;
+
+ /* look for EOL */
+ dsc->eol = FALSE;
+ for (p = dsc->line; p < last; p++) {
+ if (*p == '\r') {
+ p++;
+ if ((p<last) && (*p == '\n'))
+ p++; /* include line feed also */
+ else
+ dsc->last_cr = TRUE; /* we might need to skip \n */
+ dsc->eol = TRUE; /* dsc->line is a complete line */
+ break;
+ }
+ if (*p == '\n') {
+ p++;
+ dsc->eol = TRUE; /* dsc->line is a complete line */
+ break;
+ }
+ if (*p == '\032') { /* MS-DOS Ctrl+Z */
+ dsc->eol = TRUE;
+ }
+ }
+ if (dsc->eol == FALSE) {
+ /* we haven't got a complete line yet */
+ if (dsc->data_length - dsc->data_index < sizeof(dsc->data)/2) {
+ /* buffer is less than half full, ask for some more */
+ dsc->line_length = 0;
+ return 0;
+ }
+ }
+ dsc->data_index += dsc->line_length = (int)(p - dsc->line);
} while (dsc->skip_lines && dsc->line_length);
if (dsc->line_length == 0)
- return 0;
-
+ return 0;
+
if ((dsc->line[0]=='%') && (dsc->line[1]=='%')) {
- /* handle recursive %%BeginDocument */
- if ((dsc->skip_document) && dsc->line_length &&
- COMPARE(dsc->line, "%%EndDocument")) {
- dsc->skip_document--;
- }
-
- /* handle embedded lines or binary data */
- if (COMPARE(dsc->line, "%%BeginData:")) {
- /* %%BeginData: <numberof>[ <type> [ <bytesorlines> ] ]
- * <numberof> ::= <uint> (Lines or physical bytes)
- * <type> ::= Hex | Binary | ASCII (Type of data)
- * <bytesorlines> ::= Bytes | Lines (Read in bytes or lines)
- */
- char begindata[MAXSTR+1];
- int cnt;
- const char *numberof, *bytesorlines;
- cnt = dsc->line_length;
- if (dsc->line_length > sizeof(begindata)-1)
- cnt = sizeof(begindata)-1;
- memcpy(begindata, dsc->line, cnt);
- begindata[cnt] = '\0';
- numberof = strtok(begindata+12, " \r\n");
- strtok(NULL, " \r\n"); /* dump type */
- bytesorlines = strtok(NULL, " \r\n");
- if (bytesorlines == NULL)
- bytesorlines = "Bytes";
-
- if ( (numberof == NULL) || (bytesorlines == NULL) ) {
- /* invalid usage of %%BeginData */
- /* ignore that we ever saw it */
- int rc = dsc_error(dsc, CDSC_MESSAGE_INCORRECT_USAGE,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return 0;
- }
- }
- else {
- cnt = atoi(numberof);
- if (cnt) {
- if (bytesorlines && (dsc_stricmp(bytesorlines, "Lines")==0)) {
- /* skip cnt lines */
- if (dsc->skip_lines == 0) {
- /* we are not already skipping lines */
- dsc->skip_lines = cnt+1;
- }
- }
- else {
- /* byte count doesn't includes \n or \r\n */
- /* or \r of %%BeginData: */
- /* skip cnt bytes */
- if (dsc->skip_bytes == 0) {
- /* we are not already skipping lines */
- dsc->skip_bytes = cnt;
- }
-
- }
- }
- }
- }
- else if (COMPARE(dsc->line, "%%BeginBinary:")) {
- /* byte count doesn't includes \n or \r\n or \r of %%BeginBinary:*/
- int cnt = dsc_get_int(dsc->line + 14,
- dsc->line_length - 14, NULL);
- if (dsc->skip_bytes == 0) {
- /* we are not already skipping lines */
- dsc->skip_bytes = cnt;
- }
- }
- }
-
+ /* handle recursive %%BeginDocument */
+ if ((dsc->skip_document) && dsc->line_length &&
+ COMPARE(dsc->line, "%%EndDocument")) {
+ dsc->skip_document--;
+ }
+
+ /* handle embedded lines or binary data */
+ if (COMPARE(dsc->line, "%%BeginData:")) {
+ /* %%BeginData: <numberof>[ <type> [ <bytesorlines> ] ]
+ * <numberof> ::= <uint> (Lines or physical bytes)
+ * <type> ::= Hex | Binary | ASCII (Type of data)
+ * <bytesorlines> ::= Bytes | Lines (Read in bytes or lines)
+ */
+ char begindata[MAXSTR+1];
+ int cnt;
+ const char *numberof, *bytesorlines;
+ cnt = dsc->line_length;
+ if (dsc->line_length > sizeof(begindata)-1)
+ cnt = sizeof(begindata)-1;
+ memcpy(begindata, dsc->line, cnt);
+ begindata[cnt] = '\0';
+ numberof = strtok(begindata+12, " \r\n");
+ strtok(NULL, " \r\n"); /* dump type */
+ bytesorlines = strtok(NULL, " \r\n");
+ if (bytesorlines == NULL)
+ bytesorlines = "Bytes";
+
+ if ( (numberof == NULL) || (bytesorlines == NULL) ) {
+ /* invalid usage of %%BeginData */
+ /* ignore that we ever saw it */
+ int rc = dsc_error(dsc, CDSC_MESSAGE_INCORRECT_USAGE,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return 0;
+ }
+ }
+ else {
+ cnt = atoi(numberof);
+ if (cnt) {
+ if (bytesorlines && (dsc_stricmp(bytesorlines, "Lines")==0)) {
+ /* skip cnt lines */
+ if (dsc->skip_lines == 0) {
+ /* we are not already skipping lines */
+ dsc->skip_lines = cnt+1;
+ }
+ }
+ else {
+ /* byte count doesn't includes \n or \r\n */
+ /* or \r of %%BeginData: */
+ /* skip cnt bytes */
+ if (dsc->skip_bytes == 0) {
+ /* we are not already skipping lines */
+ dsc->skip_bytes = cnt;
+ }
+
+ }
+ }
+ }
+ }
+ else if (COMPARE(dsc->line, "%%BeginBinary:")) {
+ /* byte count doesn't includes \n or \r\n or \r of %%BeginBinary:*/
+ int cnt = dsc_get_int(dsc->line + 14,
+ dsc->line_length - 14, NULL);
+ if (dsc->skip_bytes == 0) {
+ /* we are not already skipping lines */
+ dsc->skip_bytes = cnt;
+ }
+ }
+ }
+
if ((dsc->line[0]=='%') && (dsc->line[1]=='%') &&
- COMPARE(dsc->line, "%%BeginDocument:") ) {
- /* Skip over embedded document, recursively */
- dsc->skip_document++;
+ COMPARE(dsc->line, "%%BeginDocument:") ) {
+ /* Skip over embedded document, recursively */
+ dsc->skip_document++;
}
if (!dsc->long_line && (dsc->line_length > DSC_LINE_LENGTH)) {
- dsc_error(dsc, CDSC_MESSAGE_LONG_LINE, dsc->line, dsc->line_length);
+ dsc_error(dsc, CDSC_MESSAGE_LONG_LINE, dsc->line, dsc->line_length);
dsc->long_line = TRUE;
}
-
+
return dsc->line_length;
}
-
/* Save last DSC line, for use with %%+ */
-static void
+static void
dsc_save_line(CDSC *dsc)
{
int len = min(sizeof(dsc->last_line), dsc->line_length);
@@ -1182,42 +1170,41 @@ dsc_save_line(CDSC *dsc)
}
/* display unknown DSC line */
-static void
+static void
dsc_unknown(CDSC *dsc)
{
if (dsc->debug_print_fn) {
- char line[DSC_LINE_LENGTH];
- unsigned int length = min(DSC_LINE_LENGTH-1, dsc->line_length);
- sprintf(line, "Unknown in %s section at line %d:\n ",
- dsc_scan_section_name[dsc->scan_section], dsc->line_count);
- dsc_debug_print(dsc, line);
- strncpy(line, dsc->line, length);
- line[length] = '\0';
- dsc_debug_print(dsc, line);
- dsc_debug_print(dsc, "\n");
+ char line[DSC_LINE_LENGTH];
+ unsigned int length = min(DSC_LINE_LENGTH-1, dsc->line_length);
+ sprintf(line, "Unknown in %s section at line %d:\n ",
+ dsc_scan_section_name[dsc->scan_section], dsc->line_count);
+ dsc_debug_print(dsc, line);
+ strncpy(line, dsc->line, length);
+ line[length] = '\0';
+ dsc_debug_print(dsc, line);
+ dsc_debug_print(dsc, "\n");
}
}
-
static GSBOOL
dsc_is_section(char *line)
{
if ( !((line[0]=='%') && (line[1]=='%')) )
- return FALSE;
+ return FALSE;
if (IS_DSC(line, "%%BeginPreview"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%BeginDefaults"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%BeginProlog"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%BeginSetup"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%Page:"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%Trailer"))
- return TRUE;
+ return TRUE;
if (IS_DSC(line, "%%EOF"))
- return TRUE;
+ return TRUE;
return FALSE;
}
@@ -1268,8 +1255,8 @@ dsc_read_doseps(CDSC *dsc)
{
unsigned char *line = (unsigned char *)dsc->line;
if ((dsc->doseps = (CDSCDOSEPS *)dsc_memalloc(dsc, sizeof(CDSCDOSEPS))) == NULL)
- return CDSC_ERROR; /* no memory */
-
+ return CDSC_ERROR; /* no memory */
+
dsc->doseps->ps_begin = dsc_get_dword(line+4);
dsc->doseps->ps_length = dsc_get_dword(line+8);
dsc->doseps->wmf_begin = dsc_get_dword(line+12);
@@ -1278,15 +1265,15 @@ dsc_read_doseps(CDSC *dsc)
dsc->doseps->tiff_length = dsc_get_dword(line+24);
dsc->doseps->checksum = dsc_get_word(line+28);
- if (dsc->file_length &&
- (dsc->doseps->ps_begin + dsc->doseps->ps_length > dsc->file_length)) {
- /* Error in DOS EPS header.
- * Some files have been seen with a fixed large value as
- * the length of the PostScript section.
- * Correct for these erroneous files.
- */
- dsc->doseps->ps_length =
- (GSDWORD)(dsc->file_length - dsc->doseps->ps_begin);
+ if (dsc->file_length &&
+ (dsc->doseps->ps_begin + dsc->doseps->ps_length > dsc->file_length)) {
+ /* Error in DOS EPS header.
+ * Some files have been seen with a fixed large value as
+ * the length of the PostScript section.
+ * Correct for these erroneous files.
+ */
+ dsc->doseps->ps_length =
+ (GSDWORD)(dsc->file_length - dsc->doseps->ps_begin);
}
dsc->doseps_end = dsc->doseps->ps_begin + dsc->doseps->ps_length;
@@ -1299,32 +1286,31 @@ dsc_read_doseps(CDSC *dsc)
dsc->skip_bytes = dsc->doseps->ps_begin - 30;
if (dsc->doseps->tiff_begin)
- dsc->preview = CDSC_TIFF;
+ dsc->preview = CDSC_TIFF;
if (dsc->doseps->wmf_begin)
- dsc->preview = CDSC_WMF;
+ dsc->preview = CDSC_WMF;
return CDSC_OK;
}
-
static int
dsc_read_macbin(CDSC *dsc)
{
unsigned char *line = (unsigned char *)dsc->line;
- if ((dsc->macbin =
- (CDSCMACBIN *)dsc_memalloc(dsc, sizeof(CDSCMACBIN))) == NULL)
- return CDSC_ERROR; /* no memory */
-
+ if ((dsc->macbin =
+ (CDSCMACBIN *)dsc_memalloc(dsc, sizeof(CDSCMACBIN))) == NULL)
+ return CDSC_ERROR; /* no memory */
+
dsc->macbin->data_begin = 128;
dsc->macbin->data_length = dsc_get_bigendian_dword(line+83);
- dsc->macbin->resource_begin =
- (dsc->macbin->data_begin + dsc->macbin->data_length + 127 ) & ~127;
+ dsc->macbin->resource_begin =
+ (dsc->macbin->data_begin + dsc->macbin->data_length + 127 ) & ~127;
dsc->macbin->resource_length = dsc_get_bigendian_dword(line+87);
- if (dsc->file_length &&
- (((dsc->macbin->resource_begin + dsc->macbin->resource_length
- + 127) & ~127) > dsc->file_length)) {
- return CDSC_ERROR;
+ if (dsc->file_length &&
+ (((dsc->macbin->resource_begin + dsc->macbin->resource_length
+ + 127) & ~127) > dsc->file_length)) {
+ return CDSC_ERROR;
}
dsc->doseps_end = dsc->macbin->data_begin + dsc->macbin->data_length;
@@ -1339,7 +1325,6 @@ dsc_read_macbin(CDSC *dsc)
return CDSC_OK;
}
-
static int
dsc_read_applesingle(CDSC *dsc)
{
@@ -1352,36 +1337,36 @@ dsc_read_applesingle(CDSC *dsc)
int i;
unsigned char *line = (unsigned char *)dsc->line;
- if ((dsc->macbin =
- (CDSCMACBIN *)dsc_memalloc(dsc, sizeof(CDSCMACBIN))) == NULL)
- return CDSC_ERROR; /* no memory */
+ if ((dsc->macbin =
+ (CDSCMACBIN *)dsc_memalloc(dsc, sizeof(CDSCMACBIN))) == NULL)
+ return CDSC_ERROR; /* no memory */
entries = dsc_get_bigendian_word(line+24);
for (i=0; i<(int)entries; i++) {
- index = 26 + i * 12;
- EntryID = dsc_get_bigendian_dword(line+index);
- Offset = dsc_get_bigendian_dword(line+index+4);
- Length = dsc_get_bigendian_dword(line+index+8);
- if (EntryID == 1) {
- /* data fork */
- dsc->macbin->data_begin = Offset;
- dsc->macbin->data_length = Length;
- }
- else if (EntryID == 2) {
- /* resource fork */
- dsc->macbin->resource_begin = Offset;
- dsc->macbin->resource_length = Length;
- }
- }
-
- if (dsc->file_length &&
- (dsc->macbin->resource_begin + dsc->macbin->resource_length
- > dsc->file_length)) {
- return CDSC_ERROR;
- }
- if (dsc->file_length &&
- (dsc->macbin->data_begin + dsc->macbin->data_length
- > dsc->file_length)) {
- return CDSC_ERROR;
+ index = 26 + i * 12;
+ EntryID = dsc_get_bigendian_dword(line+index);
+ Offset = dsc_get_bigendian_dword(line+index+4);
+ Length = dsc_get_bigendian_dword(line+index+8);
+ if (EntryID == 1) {
+ /* data fork */
+ dsc->macbin->data_begin = Offset;
+ dsc->macbin->data_length = Length;
+ }
+ else if (EntryID == 2) {
+ /* resource fork */
+ dsc->macbin->resource_begin = Offset;
+ dsc->macbin->resource_length = Length;
+ }
+ }
+
+ if (dsc->file_length &&
+ (dsc->macbin->resource_begin + dsc->macbin->resource_length
+ > dsc->file_length)) {
+ return CDSC_ERROR;
+ }
+ if (dsc->file_length &&
+ (dsc->macbin->data_begin + dsc->macbin->data_length
+ > dsc->file_length)) {
+ return CDSC_ERROR;
}
dsc->doseps_end = dsc->macbin->data_begin + dsc->macbin->data_length;
@@ -1399,105 +1384,105 @@ dsc_read_applesingle(CDSC *dsc)
return CDSC_OK;
}
-static int
+static int
dsc_parse_pages(CDSC *dsc)
{
- int ip, io;
+ int ip, io;
unsigned int i;
char *p;
int n;
if ((dsc->page_pages != 0) && (dsc->scan_section == scan_comments)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if ((dsc->page_pages != 0) && (dsc->scan_section == scan_trailer)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break; /* use duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break; /* use duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
n = IS_DSC(dsc->line, "%%+") ? 3 : 8;
while (IS_WHITE(dsc->line[n]))
- n++;
+ n++;
p = dsc->line + n;
if (COMPARE(p, "atend")) {
- if (dsc->scan_section != scan_comments)
- dsc_unknown(dsc);
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* assume (atend) */
- /* we should mark it as deferred */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ if (dsc->scan_section != scan_comments)
+ dsc_unknown(dsc);
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* assume (atend) */
+ /* we should mark it as deferred */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
else if (COMPARE(p, "(atend)")) {
- if (dsc->scan_section != scan_comments)
- dsc_unknown(dsc);
- /* do nothing */
- /* we should mark it as deferred */
+ if (dsc->scan_section != scan_comments)
+ dsc_unknown(dsc);
+ /* do nothing */
+ /* we should mark it as deferred */
}
else {
- ip = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ ip = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
if (i) {
- n+=i;
- dsc->page_pages = ip;
- io = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- /* DSC 2 uses extra integer to indicate page order */
- /* DSC 3 uses %%PageOrder: */
- if (dsc->page_order == CDSC_ORDER_UNKNOWN)
- switch (io) {
- case -1:
- dsc->page_order = CDSC_DESCEND;
- break;
- case 0:
- dsc->page_order = CDSC_SPECIAL;
- break;
- case 1:
- dsc->page_order = CDSC_ASCEND;
- break;
- }
- }
- }
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_INCORRECT_USAGE, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ n+=i;
+ dsc->page_pages = ip;
+ io = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ /* DSC 2 uses extra integer to indicate page order */
+ /* DSC 3 uses %%PageOrder: */
+ if (dsc->page_order == CDSC_ORDER_UNKNOWN)
+ switch (io) {
+ case -1:
+ dsc->page_order = CDSC_DESCEND;
+ break;
+ case 0:
+ dsc->page_order = CDSC_SPECIAL;
+ break;
+ case 1:
+ dsc->page_order = CDSC_ASCEND;
+ break;
+ }
+ }
+ }
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_INCORRECT_USAGE, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
return CDSC_OK;
}
-static int
+static int
dsc_parse_bounding_box(CDSC *dsc, CDSCBBOX** pbbox, int offset)
{
unsigned int i, n;
@@ -1506,403 +1491,401 @@ dsc_parse_bounding_box(CDSC *dsc, CDSCBBOX** pbbox, int offset)
char *p;
/* Process first %%BoundingBox: in comments, and last in trailer */
if ((*pbbox != NULL) && (dsc->scan_section == scan_comments)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if ((*pbbox != NULL) && (dsc->scan_section == scan_pages)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if ((*pbbox != NULL) && (dsc->scan_section == scan_trailer)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break; /* use duplicate comments in trailer */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break; /* use duplicate comments in trailer */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if (*pbbox != NULL) {
- dsc_memfree(dsc, *pbbox);
- *pbbox = NULL;
+ dsc_memfree(dsc, *pbbox);
+ *pbbox = NULL;
}
/* should only process first %%BoundingBox: */
while (IS_WHITE(dsc->line[offset]))
- offset++;
+ offset++;
p = dsc->line + offset;
-
+
if (COMPARE(p, "atend")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* assume (atend) */
- /* we should mark it as deferred */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* assume (atend) */
+ /* we should mark it as deferred */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
else if (COMPARE(p, "(atend)")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- /* do nothing */
- /* we should mark it as deferred */
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ /* do nothing */
+ /* we should mark it as deferred */
}
else {
/* llx = */ lly = urx = ury = 0;
- n = offset;
- llx = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- lly = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- urx = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- ury = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- *pbbox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
- if (*pbbox == NULL)
- return CDSC_ERROR; /* no memory */
- (*pbbox)->llx = llx;
- (*pbbox)->lly = lly;
- (*pbbox)->urx = urx;
- (*pbbox)->ury = ury;
- }
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_BBOX, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* fllx = */ flly = furx = fury = 0.0;
- n = offset;
- n += i;
- fllx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- flly = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- furx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- fury = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- *pbbox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
- if (*pbbox == NULL)
- return CDSC_ERROR; /* no memory */
- (*pbbox)->llx = (int)fllx;
- (*pbbox)->lly = (int)flly;
- (*pbbox)->urx = (int)(furx+0.999);
- (*pbbox)->ury = (int)(fury+0.999);
- }
- return CDSC_OK;
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ n = offset;
+ llx = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ lly = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ urx = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ ury = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ *pbbox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
+ if (*pbbox == NULL)
+ return CDSC_ERROR; /* no memory */
+ (*pbbox)->llx = llx;
+ (*pbbox)->lly = lly;
+ (*pbbox)->urx = urx;
+ (*pbbox)->ury = ury;
+ }
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_BBOX, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* fllx = */ flly = furx = fury = 0.0;
+ n = offset;
+ n += i;
+ fllx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ flly = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ furx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ fury = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ *pbbox = (CDSCBBOX *)dsc_memalloc(dsc, sizeof(CDSCBBOX));
+ if (*pbbox == NULL)
+ return CDSC_ERROR; /* no memory */
+ (*pbbox)->llx = (int)fllx;
+ (*pbbox)->lly = (int)flly;
+ (*pbbox)->urx = (int)(furx+0.999);
+ (*pbbox)->ury = (int)(fury+0.999);
+ }
+ return CDSC_OK;
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
return CDSC_OK;
}
-static int
+static int
dsc_parse_float_bounding_box(CDSC *dsc, CDSCFBBOX** pbbox, int offset)
{
unsigned int i, n;
float fllx, flly, furx, fury;
char *p;
- /* Process first %%HiResBoundingBox: or %%CropBox: in comments,
+ /* Process first %%HiResBoundingBox: or %%CropBox: in comments,
* and last in trailer.
*/
if ((*pbbox != NULL) && (dsc->scan_section == scan_comments)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if ((*pbbox != NULL) && (dsc->scan_section == scan_pages)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if ((*pbbox != NULL) && (dsc->scan_section == scan_trailer)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break; /* use duplicate comments in trailer */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break; /* use duplicate comments in trailer */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
if (*pbbox != NULL) {
- dsc_memfree(dsc, *pbbox);
- *pbbox = NULL;
+ dsc_memfree(dsc, *pbbox);
+ *pbbox = NULL;
}
/* should only process first %%BoundingBox: */
while (IS_WHITE(dsc->line[offset]))
- offset++;
+ offset++;
p = dsc->line + offset;
-
+
if (COMPARE(p, "atend")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* assume (atend) */
- /* we should mark it as deferred */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* assume (atend) */
+ /* we should mark it as deferred */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
else if (COMPARE(p, "(atend)")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- /* do nothing */
- /* we should mark it as deferred */
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ /* do nothing */
+ /* we should mark it as deferred */
}
else {
- /* fllx = */ flly = furx = fury = 0.0;
- n = offset;
- fllx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- flly = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- furx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- fury = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- *pbbox = (CDSCFBBOX *)dsc_memalloc(dsc, sizeof(CDSCFBBOX));
- if (*pbbox == NULL)
- return CDSC_ERROR; /* no memory */
- (*pbbox)->fllx = fllx;
- (*pbbox)->flly = flly;
- (*pbbox)->furx = furx;
- (*pbbox)->fury = fury;
- }
+ /* fllx = */ flly = furx = fury = 0.0;
+ n = offset;
+ fllx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ flly = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ furx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ fury = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ *pbbox = (CDSCFBBOX *)dsc_memalloc(dsc, sizeof(CDSCFBBOX));
+ if (*pbbox == NULL)
+ return CDSC_ERROR; /* no memory */
+ (*pbbox)->fllx = fllx;
+ (*pbbox)->flly = flly;
+ (*pbbox)->furx = furx;
+ (*pbbox)->fury = fury;
+ }
}
return CDSC_OK;
}
-static int
+static int
dsc_parse_orientation(CDSC *dsc, unsigned int *porientation, int offset)
{
char *p;
- if ((dsc->page_orientation != CDSC_ORIENT_UNKNOWN) &&
- (dsc->scan_section == scan_comments)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
- if ((dsc->page_orientation != CDSC_ORIENT_UNKNOWN) &&
- (dsc->scan_section == scan_trailer)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break; /* use duplicate comments in header; */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ if ((dsc->page_orientation != CDSC_ORIENT_UNKNOWN) &&
+ (dsc->scan_section == scan_comments)) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
+ if ((dsc->page_orientation != CDSC_ORIENT_UNKNOWN) &&
+ (dsc->scan_section == scan_trailer)) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break; /* use duplicate comments in header; */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
p = dsc->line + offset;
while (IS_WHITE(*p))
- p++;
+ p++;
if (COMPARE(p, "atend")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* assume (atend) */
- /* we should mark it as deferred */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* assume (atend) */
+ /* we should mark it as deferred */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
else if (COMPARE(p, "(atend)")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- /* do nothing */
- /* we should mark it as deferred */
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ /* do nothing */
+ /* we should mark it as deferred */
}
else if (COMPARE(p, "Portrait")) {
- *porientation = CDSC_PORTRAIT;
+ *porientation = CDSC_PORTRAIT;
}
else if (COMPARE(p, "Landscape")) {
- *porientation = CDSC_LANDSCAPE;
+ *porientation = CDSC_LANDSCAPE;
}
else {
- dsc_unknown(dsc);
+ dsc_unknown(dsc);
}
return CDSC_OK;
}
-static int
+static int
dsc_parse_order(CDSC *dsc)
{
char *p;
- if ((dsc->page_order != CDSC_ORDER_UNKNOWN) &&
- (dsc->scan_section == scan_comments)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- return CDSC_OK; /* ignore duplicate comments in header */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
- if ((dsc->page_order != CDSC_ORDER_UNKNOWN) &&
- (dsc->scan_section == scan_trailer)) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- case CDSC_RESPONSE_CANCEL:
- break; /* use duplicate comments in trailer */
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ if ((dsc->page_order != CDSC_ORDER_UNKNOWN) &&
+ (dsc->scan_section == scan_comments)) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_COMMENT, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ return CDSC_OK; /* ignore duplicate comments in header */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
+ if ((dsc->page_order != CDSC_ORDER_UNKNOWN) &&
+ (dsc->scan_section == scan_trailer)) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_DUP_TRAILER, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ case CDSC_RESPONSE_CANCEL:
+ break; /* use duplicate comments in trailer */
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
p = dsc->line + (IS_DSC(dsc->line, "%%+") ? 3 : 13);
while (IS_WHITE(*p))
- p++;
+ p++;
if (COMPARE(p, "atend")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- else {
- int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* assume (atend) */
- /* we should mark it as deferred */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* ignore it */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ else {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_ATEND, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* assume (atend) */
+ /* we should mark it as deferred */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore it */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
}
else if (COMPARE(p, "(atend)")) {
- if (dsc->scan_section == scan_trailer)
- dsc_unknown(dsc);
- /* do nothing */
- /* we should mark it as deferred */
+ if (dsc->scan_section == scan_trailer)
+ dsc_unknown(dsc);
+ /* do nothing */
+ /* we should mark it as deferred */
}
else if (COMPARE(p, "Ascend")) {
- dsc->page_order = CDSC_ASCEND;
+ dsc->page_order = CDSC_ASCEND;
}
else if (COMPARE(p, "Descend")) {
- dsc->page_order = CDSC_DESCEND;
+ dsc->page_order = CDSC_DESCEND;
}
else if (COMPARE(p, "Special")) {
- dsc->page_order = CDSC_SPECIAL;
+ dsc->page_order = CDSC_SPECIAL;
}
else {
- dsc_unknown(dsc);
+ dsc_unknown(dsc);
}
return CDSC_OK;
}
-
-static int
+static int
dsc_parse_media(CDSC *dsc, const CDSCMEDIA **page_media)
{
char media_name[MAXSTR];
int n = IS_DSC(dsc->line, "%%+") ? 3 : 12; /* %%PageMedia: */
unsigned int i;
- if (dsc_copy_string(media_name, sizeof(media_name)-1,
- dsc->line+n, dsc->line_length-n, NULL)) {
- for (i=0; i<dsc->media_count; i++) {
- if (dsc->media[i]->name &&
- (dsc_stricmp(media_name, dsc->media[i]->name) == 0)) {
- *page_media = dsc->media[i];
- return CDSC_OK;
- }
- }
+ if (dsc_copy_string(media_name, sizeof(media_name)-1,
+ dsc->line+n, dsc->line_length-n, NULL)) {
+ for (i=0; i<dsc->media_count; i++) {
+ if (dsc->media[i]->name &&
+ (dsc_stricmp(media_name, dsc->media[i]->name) == 0)) {
+ *page_media = dsc->media[i];
+ return CDSC_OK;
+ }
+ }
}
dsc_unknown(dsc);
-
+
return CDSC_OK;
}
-
-static int
+static int
dsc_parse_document_media(CDSC *dsc)
{
unsigned int i, n;
@@ -1910,54 +1893,54 @@ dsc_parse_document_media(CDSC *dsc)
GSBOOL blank_line;
if (IS_DSC(dsc->line, "%%DocumentMedia:"))
- n = 16;
+ n = 16;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
/* check for blank remainder of line */
blank_line = TRUE;
for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
}
if (!blank_line) {
- char name[MAXSTR];
- char colour[MAXSTR];
- char type[MAXSTR];
- lmedia.name = lmedia.colour = lmedia.type = (char *)NULL;
- lmedia.width = lmedia.height = lmedia.weight = 0;
- lmedia.mediabox = (CDSCBBOX *)NULL;
- lmedia.name = dsc_copy_string(name, sizeof(name),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- lmedia.width = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- lmedia.height = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- lmedia.weight = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- lmedia.colour = dsc_copy_string(colour, sizeof(colour),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- lmedia.type = dsc_copy_string(type, sizeof(type),
- dsc->line+n, dsc->line_length-n, &i);
-
- if (i==0)
- dsc_unknown(dsc); /* we didn't get all fields */
- else {
- if (dsc_add_media(dsc, &lmedia))
- return CDSC_ERROR; /* out of memory */
- }
+ char name[MAXSTR];
+ char colour[MAXSTR];
+ char type[MAXSTR];
+ lmedia.name = lmedia.colour = lmedia.type = (char *)NULL;
+ lmedia.width = lmedia.height = lmedia.weight = 0;
+ lmedia.mediabox = (CDSCBBOX *)NULL;
+ lmedia.name = dsc_copy_string(name, sizeof(name),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ lmedia.width = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ lmedia.height = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ lmedia.weight = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ lmedia.colour = dsc_copy_string(colour, sizeof(colour),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ lmedia.type = dsc_copy_string(type, sizeof(type),
+ dsc->line+n, dsc->line_length-n, &i);
+
+ if (i==0)
+ dsc_unknown(dsc); /* we didn't get all fields */
+ else {
+ if (dsc_add_media(dsc, &lmedia))
+ return CDSC_ERROR; /* out of memory */
+ }
}
return CDSC_OK;
}
@@ -1965,20 +1948,20 @@ dsc_parse_document_media(CDSC *dsc)
/* viewing orientation is believed to be the first four elements of
* a CTM matrix
*/
-static int
+static int
dsc_parse_viewing_orientation(CDSC *dsc, CDSCCTM **pctm)
{
CDSCCTM ctm;
unsigned int i, n;
if (*pctm != NULL) {
- dsc_memfree(dsc, *pctm);
- *pctm = NULL;
+ dsc_memfree(dsc, *pctm);
+ *pctm = NULL;
}
n = IS_DSC(dsc->line, "%%+") ? 3 : 21; /* %%ViewingOrientation: */
while (IS_WHITE(dsc->line[n]))
- n++;
+ n++;
/* ctm.xx = */ ctm.xy = ctm.yx = ctm.yy = 0.0;
ctm.xx = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
@@ -1992,23 +1975,22 @@ dsc_parse_viewing_orientation(CDSC *dsc, CDSCCTM **pctm)
if (i)
ctm.yy = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
if (i==0) {
- dsc_unknown(dsc); /* we didn't get all fields */
+ dsc_unknown(dsc); /* we didn't get all fields */
}
else {
- *pctm = (CDSCCTM *)dsc_memalloc(dsc, sizeof(CDSCCTM));
- if (*pctm == NULL)
- return CDSC_ERROR; /* no memory */
- **pctm = ctm;
+ *pctm = (CDSCCTM *)dsc_memalloc(dsc, sizeof(CDSCCTM));
+ if (*pctm == NULL)
+ return CDSC_ERROR; /* no memory */
+ **pctm = ctm;
}
return CDSC_OK;
}
-
/* This is called before dsc_read_line(), since we may
* need to skip a binary header which contains a new line
* character
*/
-static int
+static int
dsc_scan_type(CDSC *dsc)
{
unsigned char *p;
@@ -2029,169 +2011,167 @@ dsc_scan_type(CDSC *dsc)
/* At this stage we do not have a complete line */
if (length == 0)
- return CDSC_NEEDMORE;
+ return CDSC_NEEDMORE;
/* If we have already found a DOS EPS header, */
/* ignore all until the PostScript section */
if (dsc->skip_bytes) {
- int cnt = min(dsc->skip_bytes,
- (int)(dsc->data_length - dsc->data_index));
- dsc->skip_bytes -= cnt;
- dsc->data_index += cnt;
- length -= cnt;
- line += cnt;
- if (dsc->skip_bytes != 0)
- return CDSC_NEEDMORE;
+ int cnt = min(dsc->skip_bytes,
+ (int)(dsc->data_length - dsc->data_index));
+ dsc->skip_bytes -= cnt;
+ dsc->data_index += cnt;
+ length -= cnt;
+ line += cnt;
+ if (dsc->skip_bytes != 0)
+ return CDSC_NEEDMORE;
}
if (dsc->skip_pjl) {
- /* skip until first PostScript comment */
- while (length >= 2) {
- while (length && !IS_EOL(line[0])) {
- /* skip until EOL character */
- line++;
- dsc->data_index++;
- length--;
- }
- while ((length >= 2) && IS_EOL(line[0]) && IS_EOL(line[1])) {
- /* skip until EOL followed by non-EOL */
- line++;
- dsc->data_index++;
- length--;
- }
- if (length < 2)
- return CDSC_NEEDMORE;
-
- if (IS_EOL(line[0]) && line[1]=='%') {
- line++;
- dsc->data_index++;
- length--;
- dsc->skip_pjl = FALSE;
- break;
- }
- else {
- line++;
- dsc->data_index++;
- length--;
- }
- }
- if (dsc->skip_pjl)
- return CDSC_NEEDMORE;
+ /* skip until first PostScript comment */
+ while (length >= 2) {
+ while (length && !IS_EOL(line[0])) {
+ /* skip until EOL character */
+ line++;
+ dsc->data_index++;
+ length--;
+ }
+ while ((length >= 2) && IS_EOL(line[0]) && IS_EOL(line[1])) {
+ /* skip until EOL followed by non-EOL */
+ line++;
+ dsc->data_index++;
+ length--;
+ }
+ if (length < 2)
+ return CDSC_NEEDMORE;
+
+ if (IS_EOL(line[0]) && line[1]=='%') {
+ line++;
+ dsc->data_index++;
+ length--;
+ dsc->skip_pjl = FALSE;
+ break;
+ }
+ else {
+ line++;
+ dsc->data_index++;
+ length--;
+ }
+ }
+ if (dsc->skip_pjl)
+ return CDSC_NEEDMORE;
}
if (length == 0)
- return CDSC_NEEDMORE;
+ return CDSC_NEEDMORE;
if (line[0] == '\004') {
- line++;
- dsc->data_index++;
- length--;
- dsc->ctrld = TRUE;
+ line++;
+ dsc->data_index++;
+ length--;
+ dsc->ctrld = TRUE;
}
if (line[0] == '\033') {
- /* possibly PJL */
- if (length < 9)
- return CDSC_NEEDMORE;
- if (COMPARE(line, "\033%-12345X")) {
- dsc->skip_pjl = TRUE; /* skip until first PostScript comment */
- dsc->pjl = TRUE;
- dsc->data_index += 9;
- return dsc_scan_type(dsc);
- }
+ /* possibly PJL */
+ if (length < 9)
+ return CDSC_NEEDMORE;
+ if (COMPARE(line, "\033%-12345X")) {
+ dsc->skip_pjl = TRUE; /* skip until first PostScript comment */
+ dsc->pjl = TRUE;
+ dsc->data_index += 9;
+ return dsc_scan_type(dsc);
+ }
}
if ((line[0]==0x0) && (length < 2))
- return CDSC_NEEDMORE; /* Could be Mac Binary EPSF */
+ return CDSC_NEEDMORE; /* Could be Mac Binary EPSF */
if ((line[0]==0x0) && (line[1] >= 1) && (line[1] <= 63) && (length < 128))
- return CDSC_NEEDMORE; /* Could be Mac Binary EPSF */
+ return CDSC_NEEDMORE; /* Could be Mac Binary EPSF */
if ((line[0]==0x0) && (line[1] == 0x5) && (length < 4))
- return CDSC_NEEDMORE; /* Could be Mac AppleSingle/AppleDouble */
+ return CDSC_NEEDMORE; /* Could be Mac AppleSingle/AppleDouble */
if ((line[0]==0xc5) && (length < 4))
- return CDSC_NEEDMORE; /* Could be DOS EPS */
-
- if ((line[0]==0xc5) && (line[1]==0xd0) &&
- (line[2]==0xd3) && (line[3]==0xc6) ) {
- /* id is "EPSF" with bit 7 set */
- /* read DOS EPS header, then ignore all bytes until the PS section */
- if (length < 30)
- return CDSC_NEEDMORE;
- dsc->line = (char *)line;
- if (dsc_read_doseps(dsc))
- return CDSC_ERROR;
- }
- else if ((line[0]==0x0) && (line[1]==0x05) &&
- (line[2]==0x16) && ((line[3]==0x0) || (line[3] == 0x07))) {
- /* Mac AppleSingle or AppleDouble */
- GSDWORD version;
- GSWORD entries;
- if (length < 26)
- return CDSC_NEEDMORE;
- version = dsc_get_bigendian_dword(line+4);
- entries = dsc_get_bigendian_word(line+24);
- if ((version == 0x00010000) || (version == 0x00020000)) {
- if (length < (int)(26 + entries * 12))
- return CDSC_NEEDMORE;
- dsc->line = (char *)line;
- if (dsc_read_applesingle(dsc))
- return CDSC_ERROR;
- }
- }
- else if ((line[0]==0x0) &&
- (line[1] >= 1) && (line[1] <= 63) &&
- (line[74]==0x0) &&
- (line[65]=='E') && (line[66]=='P') &&
+ return CDSC_NEEDMORE; /* Could be DOS EPS */
+
+ if ((line[0]==0xc5) && (line[1]==0xd0) &&
+ (line[2]==0xd3) && (line[3]==0xc6) ) {
+ /* id is "EPSF" with bit 7 set */
+ /* read DOS EPS header, then ignore all bytes until the PS section */
+ if (length < 30)
+ return CDSC_NEEDMORE;
+ dsc->line = (char *)line;
+ if (dsc_read_doseps(dsc))
+ return CDSC_ERROR;
+ }
+ else if ((line[0]==0x0) && (line[1]==0x05) &&
+ (line[2]==0x16) && ((line[3]==0x0) || (line[3] == 0x07))) {
+ /* Mac AppleSingle or AppleDouble */
+ GSDWORD version;
+ GSWORD entries;
+ if (length < 26)
+ return CDSC_NEEDMORE;
+ version = dsc_get_bigendian_dword(line+4);
+ entries = dsc_get_bigendian_word(line+24);
+ if ((version == 0x00010000) || (version == 0x00020000)) {
+ if (length < (int)(26 + entries * 12))
+ return CDSC_NEEDMORE;
+ dsc->line = (char *)line;
+ if (dsc_read_applesingle(dsc))
+ return CDSC_ERROR;
+ }
+ }
+ else if ((line[0]==0x0) &&
+ (line[1] >= 1) && (line[1] <= 63) &&
+ (line[74]==0x0) &&
+ (line[65]=='E') && (line[66]=='P') &&
(line[67]=='S') && (line[68]=='F')) {
- /* Mac Binary EPSF */
- dsc->line = (char *)line;
- if (dsc_read_macbin(dsc))
- return CDSC_ERROR;
+ /* Mac Binary EPSF */
+ dsc->line = (char *)line;
+ if (dsc_read_macbin(dsc))
+ return CDSC_ERROR;
}
else {
- if (length < 2)
- return CDSC_NEEDMORE;
- if ((line[0] == '%') && (line[1] == 'P')) {
- if (length < 5)
- return CDSC_NEEDMORE;
- if (COMPARE(line, "%PDF-")) {
- dsc->pdf = TRUE;
- dsc->scan_section = scan_comments;
- return CDSC_OK;
- }
- }
+ if (length < 2)
+ return CDSC_NEEDMORE;
+ if ((line[0] == '%') && (line[1] == 'P')) {
+ if (length < 5)
+ return CDSC_NEEDMORE;
+ if (COMPARE(line, "%PDF-")) {
+ dsc->pdf = TRUE;
+ dsc->scan_section = scan_comments;
+ return CDSC_OK;
+ }
+ }
}
/* Finally process PostScript headers */
if (dsc_read_line(dsc) <= 0)
- return CDSC_NEEDMORE;
-
+ return CDSC_NEEDMORE;
+
dsc->dsc_version = dsc_add_line(dsc, dsc->line, dsc->line_length);
if (COMPARE(dsc->line, "%!PS-Adobe")) {
- dsc->dsc = TRUE;
- dsc->begincomments = DSC_START(dsc);
- if (dsc->dsc_version == NULL)
- return CDSC_ERROR; /* no memory */
- p = (unsigned char *)dsc->line + 14;
- while (IS_WHITE(*p))
- p++;
- if (COMPARE(p, "EPSF-"))
- dsc->epsf = TRUE;
- dsc->scan_section = scan_comments;
- return CDSC_PSADOBE;
+ dsc->dsc = TRUE;
+ dsc->begincomments = DSC_START(dsc);
+ if (dsc->dsc_version == NULL)
+ return CDSC_ERROR; /* no memory */
+ p = (unsigned char *)dsc->line + 14;
+ while (IS_WHITE(*p))
+ p++;
+ if (COMPARE(p, "EPSF-"))
+ dsc->epsf = TRUE;
+ dsc->scan_section = scan_comments;
+ return CDSC_PSADOBE;
}
if (COMPARE(dsc->line, "%!")) {
- dsc->scan_section = scan_comments;
- return CDSC_NOTDSC;
+ dsc->scan_section = scan_comments;
+ return CDSC_NOTDSC;
}
dsc->scan_section = scan_comments;
return CDSC_NOTDSC; /* unrecognised */
}
-
-
-static int
+static int
dsc_scan_comments(CDSC *dsc)
{
/* Comments section ends at */
@@ -2204,344 +2184,343 @@ dsc_scan_comments(CDSC *dsc)
GSBOOL continued = FALSE;
dsc->id = CDSC_OK;
if (IS_DSC(line, "%%EndComments")) {
- dsc->id = CDSC_ENDCOMMENTS;
- dsc->endcomments = DSC_END(dsc);
- dsc->scan_section = scan_pre_preview;
- return CDSC_OK;
+ dsc->id = CDSC_ENDCOMMENTS;
+ dsc->endcomments = DSC_END(dsc);
+ dsc->scan_section = scan_pre_preview;
+ return CDSC_OK;
}
else if (IS_DSC(line, "%%BeginComments")) {
- /* ignore because we are in this section */
- dsc->id = CDSC_BEGINCOMMENTS;
+ /* ignore because we are in this section */
+ dsc->id = CDSC_BEGINCOMMENTS;
}
else if (dsc_is_section(line)) {
- dsc->endcomments = DSC_START(dsc);
- dsc->scan_section = scan_pre_preview;
- return CDSC_PROPAGATE;
+ dsc->endcomments = DSC_START(dsc);
+ dsc->scan_section = scan_pre_preview;
+ return CDSC_PROPAGATE;
}
else if (line[0] == '%' && IS_WHITE_OR_EOL(line[1])) {
- dsc->endcomments = DSC_START(dsc);
- dsc->scan_section = scan_pre_preview;
- return CDSC_PROPAGATE;
+ dsc->endcomments = DSC_START(dsc);
+ dsc->scan_section = scan_pre_preview;
+ return CDSC_PROPAGATE;
}
else if (line[0] != '%') {
- dsc->id = CDSC_OK;
- dsc->endcomments = DSC_START(dsc);
- dsc->scan_section = scan_pre_preview;
- return CDSC_PROPAGATE;
+ dsc->id = CDSC_OK;
+ dsc->endcomments = DSC_START(dsc);
+ dsc->scan_section = scan_pre_preview;
+ return CDSC_PROPAGATE;
}
else if (IS_DSC(line, "%%Begin")) {
- dsc->endcomments = DSC_START(dsc);
- dsc->scan_section = scan_pre_preview;
- return CDSC_PROPAGATE;
+ dsc->endcomments = DSC_START(dsc);
+ dsc->scan_section = scan_pre_preview;
+ return CDSC_PROPAGATE;
}
/* Handle continuation lines.
- * To simply processing, we assume that contination lines
- * will only occur if repeat parameters are allowed and that
- * a complete set of these parameters appears on each line.
+ * To simply processing, we assume that contination lines
+ * will only occur if repeat parameters are allowed and that
+ * a complete set of these parameters appears on each line.
* This is more restrictive than the DSC specification, but
* is valid for the DSC comments understood by this parser
* for all documents that we have seen.
*/
if (IS_DSC(line, "%%+")) {
- line = dsc->last_line;
- continued = TRUE;
+ line = dsc->last_line;
+ continued = TRUE;
}
else
- dsc_save_line(dsc);
+ dsc_save_line(dsc);
if (IS_DSC(line, "%%Pages:")) {
- dsc->id = CDSC_PAGES;
- if (dsc_parse_pages(dsc) != 0)
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGES;
+ if (dsc_parse_pages(dsc) != 0)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%Creator:")) {
- dsc->id = CDSC_CREATOR;
- dsc->dsc_creator = dsc_add_line(dsc, dsc->line+10, dsc->line_length-10);
- if (dsc->dsc_creator==NULL)
- return CDSC_ERROR;
+ dsc->id = CDSC_CREATOR;
+ dsc->dsc_creator = dsc_add_line(dsc, dsc->line+10, dsc->line_length-10);
+ if (dsc->dsc_creator==NULL)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%CreationDate:")) {
- dsc->id = CDSC_CREATIONDATE;
- dsc->dsc_date = dsc_add_line(dsc, dsc->line+15, dsc->line_length-15);
- if (dsc->dsc_date==NULL)
- return CDSC_ERROR;
+ dsc->id = CDSC_CREATIONDATE;
+ dsc->dsc_date = dsc_add_line(dsc, dsc->line+15, dsc->line_length-15);
+ if (dsc->dsc_date==NULL)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%Title:")) {
- dsc->id = CDSC_TITLE;
- dsc->dsc_title = dsc_add_line(dsc, dsc->line+8, dsc->line_length-8);
- if (dsc->dsc_title==NULL)
- return CDSC_ERROR;
+ dsc->id = CDSC_TITLE;
+ dsc->dsc_title = dsc_add_line(dsc, dsc->line+8, dsc->line_length-8);
+ if (dsc->dsc_title==NULL)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%For:")) {
- dsc->id = CDSC_FOR;
- dsc->dsc_for = dsc_add_line(dsc, dsc->line+6, dsc->line_length-6);
- if (dsc->dsc_for==NULL)
- return CDSC_ERROR;
+ dsc->id = CDSC_FOR;
+ dsc->dsc_for = dsc_add_line(dsc, dsc->line+6, dsc->line_length-6);
+ if (dsc->dsc_for==NULL)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%LanguageLevel:")) {
- unsigned int n = continued ? 3 : 16;
- unsigned int i;
- int ll;
- dsc->id = CDSC_LANGUAGELEVEL;
- ll = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- if ( (ll==1) || (ll==2) || (ll==3) )
- dsc->language_level = ll;
- else {
- dsc_unknown(dsc);
- }
- }
- else
- dsc_unknown(dsc);
+ unsigned int n = continued ? 3 : 16;
+ unsigned int i;
+ int ll;
+ dsc->id = CDSC_LANGUAGELEVEL;
+ ll = dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ if ( (ll==1) || (ll==2) || (ll==3) )
+ dsc->language_level = ll;
+ else {
+ dsc_unknown(dsc);
+ }
+ }
+ else
+ dsc_unknown(dsc);
}
else if (IS_DSC(line, "%%BoundingBox:")) {
- dsc->id = CDSC_BOUNDINGBOX;
- if (dsc_parse_bounding_box(dsc, &(dsc->bbox), continued ? 3 : 14))
- return CDSC_ERROR;
+ dsc->id = CDSC_BOUNDINGBOX;
+ if (dsc_parse_bounding_box(dsc, &(dsc->bbox), continued ? 3 : 14))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%HiResBoundingBox:")) {
- dsc->id = CDSC_HIRESBOUNDINGBOX;
- if (dsc_parse_float_bounding_box(dsc, &(dsc->hires_bbox),
- continued ? 3 : 19))
- return CDSC_ERROR;
+ dsc->id = CDSC_HIRESBOUNDINGBOX;
+ if (dsc_parse_float_bounding_box(dsc, &(dsc->hires_bbox),
+ continued ? 3 : 19))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%CropBox:")) {
- dsc->id = CDSC_CROPBOX;
- if (dsc_parse_float_bounding_box(dsc, &(dsc->crop_box),
- continued ? 3 : 10))
- return CDSC_ERROR;
+ dsc->id = CDSC_CROPBOX;
+ if (dsc_parse_float_bounding_box(dsc, &(dsc->crop_box),
+ continued ? 3 : 10))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%Orientation:")) {
- dsc->id = CDSC_ORIENTATION;
- if (dsc_parse_orientation(dsc, &(dsc->page_orientation),
- continued ? 3 : 14))
- return CDSC_ERROR;
+ dsc->id = CDSC_ORIENTATION;
+ if (dsc_parse_orientation(dsc, &(dsc->page_orientation),
+ continued ? 3 : 14))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%PageOrder:")) {
- dsc->id = CDSC_PAGEORDER;
- if (dsc_parse_order(dsc))
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGEORDER;
+ if (dsc_parse_order(dsc))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%DocumentMedia:")) {
- dsc->id = CDSC_DOCUMENTMEDIA;
- if (dsc_parse_document_media(dsc))
- return CDSC_ERROR;
+ dsc->id = CDSC_DOCUMENTMEDIA;
+ if (dsc_parse_document_media(dsc))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%DocumentPaperSizes:")) {
- /* DSC 2.1 */
- unsigned int n = continued ? 3 : 21;
- unsigned int count = 0;
- unsigned int i = 1;
- char name[MAXSTR];
- char *p;
- dsc->id = CDSC_DOCUMENTPAPERSIZES;
- while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
- p = dsc_copy_string(name, sizeof(name)-1,
- dsc->line+n, dsc->line_length-n, &i);
- if (i && p) {
- const CDSCMEDIA *m = dsc_known_media;
- if (count >= dsc->media_count) {
- /* set some default values */
- CDSCMEDIA lmedia;
- lmedia.name = p;
- lmedia.width = 595.0;
- lmedia.height = 842.0;
- lmedia.weight = 80.0;
- lmedia.colour = NULL;
- lmedia.type = NULL;
- lmedia.mediabox = NULL;
- if (dsc_add_media(dsc, &lmedia))
- return CDSC_ERROR;
- }
- else
- dsc->media[count]->name =
- dsc_alloc_string(dsc, p, (int)strlen(p));
- /* find in list of known media */
- while (m && m->name) {
- if (dsc_stricmp(p, m->name)==0) {
- dsc->media[count]->width = m->width;
- dsc->media[count]->height = m->height;
- break;
- }
- m++;
- }
- }
- n+=i;
- count++;
- }
+ /* DSC 2.1 */
+ unsigned int n = continued ? 3 : 21;
+ unsigned int count = 0;
+ unsigned int i = 1;
+ char name[MAXSTR];
+ char *p;
+ dsc->id = CDSC_DOCUMENTPAPERSIZES;
+ while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
+ p = dsc_copy_string(name, sizeof(name)-1,
+ dsc->line+n, dsc->line_length-n, &i);
+ if (i && p) {
+ const CDSCMEDIA *m = dsc_known_media;
+ if (count >= dsc->media_count) {
+ /* set some default values */
+ CDSCMEDIA lmedia;
+ lmedia.name = p;
+ lmedia.width = 595.0;
+ lmedia.height = 842.0;
+ lmedia.weight = 80.0;
+ lmedia.colour = NULL;
+ lmedia.type = NULL;
+ lmedia.mediabox = NULL;
+ if (dsc_add_media(dsc, &lmedia))
+ return CDSC_ERROR;
+ }
+ else
+ dsc->media[count]->name =
+ dsc_alloc_string(dsc, p, (int)strlen(p));
+ /* find in list of known media */
+ while (m && m->name) {
+ if (dsc_stricmp(p, m->name)==0) {
+ dsc->media[count]->width = m->width;
+ dsc->media[count]->height = m->height;
+ break;
+ }
+ m++;
+ }
+ }
+ n+=i;
+ count++;
+ }
}
else if (IS_DSC(line, "%%DocumentPaperForms:")) {
- /* DSC 2.1 */
- unsigned int n = continued ? 3 : 21;
- unsigned int count = 0;
- unsigned int i = 1;
- char type[MAXSTR];
- char *p;
- dsc->id = CDSC_DOCUMENTPAPERFORMS;
- while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
- p = dsc_copy_string(type, sizeof(type)-1,
- dsc->line+n, dsc->line_length-n, &i);
- if (i && p) {
- if (count >= dsc->media_count) {
- /* set some default values */
- CDSCMEDIA lmedia;
- lmedia.name = NULL;
- lmedia.width = 595.0;
- lmedia.height = 842.0;
- lmedia.weight = 80.0;
- lmedia.colour = NULL;
- lmedia.type = p;
- lmedia.mediabox = NULL;
- if (dsc_add_media(dsc, &lmedia))
- return CDSC_ERROR;
- }
- else
- dsc->media[count]->type =
- dsc_alloc_string(dsc, p, (int)strlen(p));
- }
- n+=i;
- count++;
- }
+ /* DSC 2.1 */
+ unsigned int n = continued ? 3 : 21;
+ unsigned int count = 0;
+ unsigned int i = 1;
+ char type[MAXSTR];
+ char *p;
+ dsc->id = CDSC_DOCUMENTPAPERFORMS;
+ while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
+ p = dsc_copy_string(type, sizeof(type)-1,
+ dsc->line+n, dsc->line_length-n, &i);
+ if (i && p) {
+ if (count >= dsc->media_count) {
+ /* set some default values */
+ CDSCMEDIA lmedia;
+ lmedia.name = NULL;
+ lmedia.width = 595.0;
+ lmedia.height = 842.0;
+ lmedia.weight = 80.0;
+ lmedia.colour = NULL;
+ lmedia.type = p;
+ lmedia.mediabox = NULL;
+ if (dsc_add_media(dsc, &lmedia))
+ return CDSC_ERROR;
+ }
+ else
+ dsc->media[count]->type =
+ dsc_alloc_string(dsc, p, (int)strlen(p));
+ }
+ n+=i;
+ count++;
+ }
}
else if (IS_DSC(line, "%%DocumentPaperColors:")) {
- /* DSC 2.1 */
- unsigned int n = continued ? 3 : 22;
- unsigned int count = 0;
- unsigned int i = 1;
- char colour[MAXSTR];
- char *p;
- dsc->id = CDSC_DOCUMENTPAPERCOLORS;
- while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
- p = dsc_copy_string(colour, sizeof(colour)-1,
- dsc->line+n, dsc->line_length-n, &i);
- if (i && p) {
- if (count >= dsc->media_count) {
- /* set some default values */
- CDSCMEDIA lmedia;
- lmedia.name = NULL;
- lmedia.width = 595.0;
- lmedia.height = 842.0;
- lmedia.weight = 80.0;
- lmedia.colour = p;
- lmedia.type = NULL;
- lmedia.mediabox = NULL;
- if (dsc_add_media(dsc, &lmedia))
- return CDSC_ERROR;
- }
- else
- dsc->media[count]->colour =
- dsc_alloc_string(dsc, p, (int)strlen(p));
- }
- n+=i;
- count++;
- }
+ /* DSC 2.1 */
+ unsigned int n = continued ? 3 : 22;
+ unsigned int count = 0;
+ unsigned int i = 1;
+ char colour[MAXSTR];
+ char *p;
+ dsc->id = CDSC_DOCUMENTPAPERCOLORS;
+ while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
+ p = dsc_copy_string(colour, sizeof(colour)-1,
+ dsc->line+n, dsc->line_length-n, &i);
+ if (i && p) {
+ if (count >= dsc->media_count) {
+ /* set some default values */
+ CDSCMEDIA lmedia;
+ lmedia.name = NULL;
+ lmedia.width = 595.0;
+ lmedia.height = 842.0;
+ lmedia.weight = 80.0;
+ lmedia.colour = p;
+ lmedia.type = NULL;
+ lmedia.mediabox = NULL;
+ if (dsc_add_media(dsc, &lmedia))
+ return CDSC_ERROR;
+ }
+ else
+ dsc->media[count]->colour =
+ dsc_alloc_string(dsc, p, (int)strlen(p));
+ }
+ n+=i;
+ count++;
+ }
}
else if (IS_DSC(line, "%%DocumentPaperWeights:")) {
- /* DSC 2.1 */
- unsigned int n = continued ? 3 : 23;
- unsigned int count = 0;
- unsigned int i = 1;
- float w;
- dsc->id = CDSC_DOCUMENTPAPERWEIGHTS;
- while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
- w = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- if (i) {
- if (count >= dsc->media_count) {
- /* set some default values */
- CDSCMEDIA lmedia;
- lmedia.name = NULL;
- lmedia.width = 595.0;
- lmedia.height = 842.0;
- lmedia.weight = w;
- lmedia.colour = NULL;
- lmedia.type = NULL;
- lmedia.mediabox = NULL;
- if (dsc_add_media(dsc, &lmedia))
- return CDSC_ERROR;
- }
- else
- dsc->media[count]->weight = w;
- }
- n+=i;
- count++;
- }
+ /* DSC 2.1 */
+ unsigned int n = continued ? 3 : 23;
+ unsigned int count = 0;
+ unsigned int i = 1;
+ float w;
+ dsc->id = CDSC_DOCUMENTPAPERWEIGHTS;
+ while (i && (dsc->line[n]!='\r') && (dsc->line[n]!='\n')) {
+ w = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ if (i) {
+ if (count >= dsc->media_count) {
+ /* set some default values */
+ CDSCMEDIA lmedia;
+ lmedia.name = NULL;
+ lmedia.width = 595.0;
+ lmedia.height = 842.0;
+ lmedia.weight = w;
+ lmedia.colour = NULL;
+ lmedia.type = NULL;
+ lmedia.mediabox = NULL;
+ if (dsc_add_media(dsc, &lmedia))
+ return CDSC_ERROR;
+ }
+ else
+ dsc->media[count]->weight = w;
+ }
+ n+=i;
+ count++;
+ }
}
else if (IS_DSC(line, "%%DocumentData:")) {
- unsigned int n = continued ? 3 : 15;
- char *p = dsc->line + n;
+ unsigned int n = continued ? 3 : 15;
+ char *p = dsc->line + n;
while (IS_WHITE(*p))
- p++;
- dsc->id = CDSC_DOCUMENTDATA;
- if (COMPARE(p, "Clean7Bit"))
- dsc->document_data = CDSC_CLEAN7BIT;
- else if (COMPARE(p, "Clean8Bit"))
- dsc->document_data = CDSC_CLEAN8BIT;
- else if (COMPARE(p, "Binary"))
- dsc->document_data = CDSC_BINARY;
- else
- dsc_unknown(dsc);
+ p++;
+ dsc->id = CDSC_DOCUMENTDATA;
+ if (COMPARE(p, "Clean7Bit"))
+ dsc->document_data = CDSC_CLEAN7BIT;
+ else if (COMPARE(p, "Clean8Bit"))
+ dsc->document_data = CDSC_CLEAN8BIT;
+ else if (COMPARE(p, "Binary"))
+ dsc->document_data = CDSC_BINARY;
+ else
+ dsc_unknown(dsc);
}
else if (IS_DSC(line, "%%Requirements:")) {
- dsc->id = CDSC_REQUIREMENTS;
- /* ignore */
+ dsc->id = CDSC_REQUIREMENTS;
+ /* ignore */
}
else if (IS_DSC(line, "%%DocumentNeededFonts:")) {
- dsc->id = CDSC_DOCUMENTNEEDEDFONTS;
- /* ignore */
+ dsc->id = CDSC_DOCUMENTNEEDEDFONTS;
+ /* ignore */
}
else if (IS_DSC(line, "%%DocumentSuppliedFonts:")) {
- dsc->id = CDSC_DOCUMENTSUPPLIEDFONTS;
- /* ignore */
+ dsc->id = CDSC_DOCUMENTSUPPLIEDFONTS;
+ /* ignore */
}
else if (IS_DSC(line, "%%PlateFile:")) {
- dsc->id = CDSC_PLATEFILE;
- if (dsc_parse_platefile(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
- }
- else if (IS_DSC(line, "%%CyanPlate:") ||
- IS_DSC(line, "%%MagentaPlate:") ||
- IS_DSC(line, "%%YellowPlate:") ||
- IS_DSC(line, "%%BlackPlate:")) {
- dsc->id = CDSC_PLATEFILE;
- if (dsc_parse_dcs1plate(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_PLATEFILE;
+ if (dsc_parse_platefile(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
+ }
+ else if (IS_DSC(line, "%%CyanPlate:") ||
+ IS_DSC(line, "%%MagentaPlate:") ||
+ IS_DSC(line, "%%YellowPlate:") ||
+ IS_DSC(line, "%%BlackPlate:")) {
+ dsc->id = CDSC_PLATEFILE;
+ if (dsc_parse_dcs1plate(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (IS_DSC(line, "%%DocumentProcessColors:")) {
- dsc->id = CDSC_DOCUMENTPROCESSCOLORS;
- if (dsc_parse_process_colours(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_DOCUMENTPROCESSCOLORS;
+ if (dsc_parse_process_colours(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (IS_DSC(line, "%%DocumentCustomColors:")) {
- dsc->id = CDSC_DOCUMENTCUSTOMCOLORS;
- if (dsc_parse_custom_colours(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_DOCUMENTCUSTOMCOLORS;
+ if (dsc_parse_custom_colours(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (IS_DSC(line, "%%CMYKCustomColor:")) {
- dsc->id = CDSC_CMYKCUSTOMCOLOR;
- if (dsc_parse_cmyk_custom_colour(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_CMYKCUSTOMCOLOR;
+ if (dsc_parse_cmyk_custom_colour(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (IS_DSC(line, "%%RGBCustomColor:")) {
- dsc->id = CDSC_RGBCUSTOMCOLOR;
- if (dsc_parse_rgb_custom_colour(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_RGBCUSTOMCOLOR;
+ if (dsc_parse_rgb_custom_colour(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (dsc->line[0] == '%' && IS_WHITE_OR_EOL(dsc->line[1])) {
- dsc->id = CDSC_OK;
- /* ignore */
+ dsc->id = CDSC_OK;
+ /* ignore */
}
else {
- dsc->id = CDSC_UNKNOWNDSC;
- dsc_unknown(dsc);
+ dsc->id = CDSC_UNKNOWNDSC;
+ dsc_unknown(dsc);
}
dsc->endcomments = DSC_END(dsc);
return CDSC_OK;
}
-
-static int
+static int
dsc_scan_preview(CDSC *dsc)
{
/* Preview section ends at */
@@ -2552,45 +2531,45 @@ dsc_scan_preview(CDSC *dsc)
dsc->id = CDSC_OK;
if (dsc->scan_section == scan_pre_preview) {
- if (IS_BLANK(line))
- return CDSC_OK; /* ignore blank lines before preview */
- else if (IS_DSC(line, "%%BeginPreview")) {
- dsc->id = CDSC_BEGINPREVIEW;
- dsc->beginpreview = DSC_START(dsc);
- dsc->endpreview = DSC_END(dsc);
- dsc->scan_section = scan_preview;
- /* Don't mark the preview as EPSI if a DOS EPS header is present */
- if (dsc->preview == CDSC_NOPREVIEW)
- dsc->preview = CDSC_EPSI;
- return CDSC_OK;
- }
- else {
- dsc->scan_section = scan_pre_defaults;
- return CDSC_PROPAGATE;
- }
+ if (IS_BLANK(line))
+ return CDSC_OK; /* ignore blank lines before preview */
+ else if (IS_DSC(line, "%%BeginPreview")) {
+ dsc->id = CDSC_BEGINPREVIEW;
+ dsc->beginpreview = DSC_START(dsc);
+ dsc->endpreview = DSC_END(dsc);
+ dsc->scan_section = scan_preview;
+ /* Don't mark the preview as EPSI if a DOS EPS header is present */
+ if (dsc->preview == CDSC_NOPREVIEW)
+ dsc->preview = CDSC_EPSI;
+ return CDSC_OK;
+ }
+ else {
+ dsc->scan_section = scan_pre_defaults;
+ return CDSC_PROPAGATE;
+ }
}
if (IS_DSC(line, "%%BeginPreview")) {
- /* ignore because we are in this section */
+ /* ignore because we are in this section */
}
else if (dsc_is_section(line)) {
- dsc->endpreview = DSC_START(dsc);
- dsc->scan_section = scan_pre_defaults;
- return CDSC_PROPAGATE;
+ dsc->endpreview = DSC_START(dsc);
+ dsc->scan_section = scan_pre_defaults;
+ return CDSC_PROPAGATE;
}
else if (IS_DSC(line, "%%EndPreview")) {
- dsc->id = CDSC_ENDPREVIEW;
- dsc->endpreview = DSC_END(dsc);
- dsc->scan_section = scan_pre_defaults;
- return CDSC_OK;
+ dsc->id = CDSC_ENDPREVIEW;
+ dsc->endpreview = DSC_END(dsc);
+ dsc->scan_section = scan_pre_defaults;
+ return CDSC_OK;
}
else if (line[0] == '%' && line[1] != '%') {
- /* Ordinary comments are OK */
+ /* Ordinary comments are OK */
}
else {
- dsc->id = CDSC_UNKNOWNDSC;
- /* DSC comments should not occur in preview */
- dsc_unknown(dsc);
+ dsc->id = CDSC_UNKNOWNDSC;
+ /* DSC comments should not occur in preview */
+ dsc_unknown(dsc);
}
dsc->endpreview = DSC_END(dsc);
@@ -2608,88 +2587,88 @@ dsc_scan_defaults(CDSC *dsc)
dsc->id = CDSC_OK;
if (dsc->scan_section == scan_pre_defaults) {
- if (IS_BLANK(line))
- return CDSC_OK; /* ignore blank lines before defaults */
- else if (IS_DSC(line, "%%BeginDefaults")) {
- dsc->id = CDSC_BEGINDEFAULTS;
- dsc->begindefaults = DSC_START(dsc);
- dsc->enddefaults = DSC_END(dsc);
- dsc->scan_section = scan_defaults;
- return CDSC_OK;
- }
- else {
- dsc->scan_section = scan_pre_prolog;
- return CDSC_PROPAGATE;
- }
+ if (IS_BLANK(line))
+ return CDSC_OK; /* ignore blank lines before defaults */
+ else if (IS_DSC(line, "%%BeginDefaults")) {
+ dsc->id = CDSC_BEGINDEFAULTS;
+ dsc->begindefaults = DSC_START(dsc);
+ dsc->enddefaults = DSC_END(dsc);
+ dsc->scan_section = scan_defaults;
+ return CDSC_OK;
+ }
+ else {
+ dsc->scan_section = scan_pre_prolog;
+ return CDSC_PROPAGATE;
+ }
}
if (NOT_DSC_LINE(line)) {
- /* ignore */
+ /* ignore */
}
else if (IS_DSC(line, "%%BeginPreview")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginDefaults")) {
- /* ignore because we are in this section */
+ /* ignore because we are in this section */
}
else if (dsc_is_section(line)) {
- dsc->enddefaults = DSC_START(dsc);
- dsc->scan_section = scan_pre_prolog;
- return CDSC_PROPAGATE;
+ dsc->enddefaults = DSC_START(dsc);
+ dsc->scan_section = scan_pre_prolog;
+ return CDSC_PROPAGATE;
}
else if (IS_DSC(line, "%%EndDefaults")) {
- dsc->id = CDSC_ENDDEFAULTS;
- dsc->enddefaults = DSC_END(dsc);
- dsc->scan_section = scan_pre_prolog;
- return CDSC_OK;
+ dsc->id = CDSC_ENDDEFAULTS;
+ dsc->enddefaults = DSC_END(dsc);
+ dsc->scan_section = scan_pre_prolog;
+ return CDSC_OK;
}
else if (IS_DSC(line, "%%PageMedia:")) {
- dsc->id = CDSC_PAGEMEDIA;
- dsc_parse_media(dsc, &dsc->page_media);
+ dsc->id = CDSC_PAGEMEDIA;
+ dsc_parse_media(dsc, &dsc->page_media);
}
else if (IS_DSC(line, "%%PageOrientation:")) {
- dsc->id = CDSC_PAGEORIENTATION;
- /* This can override %%Orientation: */
- if (dsc_parse_orientation(dsc, &(dsc->page_orientation), 18))
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGEORIENTATION;
+ /* This can override %%Orientation: */
+ if (dsc_parse_orientation(dsc, &(dsc->page_orientation), 18))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%PageBoundingBox:")) {
- dsc->id = CDSC_PAGEBOUNDINGBOX;
- if (dsc_parse_bounding_box(dsc, &(dsc->page_bbox), 18))
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGEBOUNDINGBOX;
+ if (dsc_parse_bounding_box(dsc, &(dsc->page_bbox), 18))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%ViewingOrientation:")) {
- dsc->id = CDSC_VIEWINGORIENTATION;
- if (dsc_parse_viewing_orientation(dsc, &dsc->viewing_orientation))
- return CDSC_ERROR;
+ dsc->id = CDSC_VIEWINGORIENTATION;
+ if (dsc_parse_viewing_orientation(dsc, &dsc->viewing_orientation))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%PageCropBox:")) {
- dsc->id = CDSC_PAGECROPBOX;
- if (dsc_parse_float_bounding_box(dsc, &dsc->crop_box, 14))
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGECROPBOX;
+ if (dsc_parse_float_bounding_box(dsc, &dsc->crop_box, 14))
+ return CDSC_ERROR;
}
else {
- dsc->id = CDSC_UNKNOWNDSC;
- /* All other DSC comments are unknown, but not an error */
- dsc_unknown(dsc);
+ dsc->id = CDSC_UNKNOWNDSC;
+ /* All other DSC comments are unknown, but not an error */
+ dsc_unknown(dsc);
}
dsc->enddefaults = DSC_END(dsc);
return CDSC_OK;
}
-/* CDSC_RESPONSE_OK and CDSC_RESPONSE_CANCEL mean ignore the
+/* CDSC_RESPONSE_OK and CDSC_RESPONSE_CANCEL mean ignore the
* mismatch (default) */
static int
dsc_check_match_prompt(CDSC *dsc, const char *str, int count)
{
if (count != 0) {
- char buf[MAXSTR+MAXSTR];
- if (dsc->line_length < (unsigned int)(sizeof(buf)/2-1)) {
- strncpy(buf, dsc->line, dsc->line_length);
- buf[dsc->line_length] = '\0';
- }
- sprintf(buf+strlen(buf), "\n%%%%Begin%.40s: / %%%%End%.40s\n", str, str);
- return dsc_error(dsc, CDSC_MESSAGE_BEGIN_END, buf, (int)strlen(buf));
+ char buf[MAXSTR+MAXSTR];
+ if (dsc->line_length < (unsigned int)(sizeof(buf)/2-1)) {
+ strncpy(buf, dsc->line, dsc->line_length);
+ buf[dsc->line_length] = '\0';
+ }
+ sprintf(buf+strlen(buf), "\n%%%%Begin%.40s: / %%%%End%.40s\n", str, str);
+ return dsc_error(dsc, CDSC_MESSAGE_BEGIN_END, buf, (int)strlen(buf));
}
return CDSC_RESPONSE_CANCEL;
}
@@ -2698,7 +2677,7 @@ static int
dsc_check_match_type(CDSC *dsc, const char *str, int count)
{
if (dsc_check_match_prompt(dsc, str, count) == CDSC_RESPONSE_IGNORE_ALL)
- return CDSC_NOTDSC;
+ return CDSC_NOTDSC;
return CDSC_OK;
}
@@ -2714,13 +2693,13 @@ dsc_check_match(CDSC *dsc)
const char *procset = "ProcSet";
if (!rc)
- rc = dsc_check_match_type(dsc, font, dsc->begin_font_count);
+ rc = dsc_check_match_type(dsc, font, dsc->begin_font_count);
if (!rc)
- rc = dsc_check_match_type(dsc, feature, dsc->begin_feature_count);
+ rc = dsc_check_match_type(dsc, feature, dsc->begin_feature_count);
if (!rc)
- rc = dsc_check_match_type(dsc, resource, dsc->begin_resource_count);
+ rc = dsc_check_match_type(dsc, resource, dsc->begin_resource_count);
if (!rc)
- rc = dsc_check_match_type(dsc, procset, dsc->begin_procset_count);
+ rc = dsc_check_match_type(dsc, procset, dsc->begin_procset_count);
dsc->begin_font_count = 0;
dsc->begin_feature_count = 0;
@@ -2729,8 +2708,7 @@ dsc_check_match(CDSC *dsc)
return rc;
}
-
-static int
+static int
dsc_scan_prolog(CDSC *dsc)
{
/* Prolog section ends at */
@@ -2742,88 +2720,88 @@ dsc_scan_prolog(CDSC *dsc)
if (dsc->scan_section == scan_pre_prolog) {
if (dsc_is_section(line) && (!IS_DSC(line, "%%BeginProlog"))) {
- dsc->scan_section = scan_pre_setup;
- return CDSC_PROPAGATE;
- }
- dsc->id = CDSC_BEGINPROLOG;
- dsc->beginprolog = DSC_START(dsc);
- dsc->endprolog = DSC_END(dsc);
- dsc->scan_section = scan_prolog;
- if (IS_DSC(line, "%%BeginProlog"))
- return CDSC_OK;
- }
-
+ dsc->scan_section = scan_pre_setup;
+ return CDSC_PROPAGATE;
+ }
+ dsc->id = CDSC_BEGINPROLOG;
+ dsc->beginprolog = DSC_START(dsc);
+ dsc->endprolog = DSC_END(dsc);
+ dsc->scan_section = scan_prolog;
+ if (IS_DSC(line, "%%BeginProlog"))
+ return CDSC_OK;
+ }
+
if (NOT_DSC_LINE(line)) {
- /* ignore */
+ /* ignore */
}
else if (IS_DSC(line, "%%BeginPreview")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginDefaults")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginProlog")) {
- /* ignore because we are in this section */
+ /* ignore because we are in this section */
}
else if (dsc_is_section(line)) {
- dsc->endprolog = DSC_START(dsc);
- dsc->scan_section = scan_pre_setup;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
+ dsc->endprolog = DSC_START(dsc);
+ dsc->scan_section = scan_pre_setup;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
}
else if (IS_DSC(line, "%%EndProlog")) {
- dsc->id = CDSC_ENDPROLOG;
- dsc->endprolog = DSC_END(dsc);
- dsc->scan_section = scan_pre_setup;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_OK;
+ dsc->id = CDSC_ENDPROLOG;
+ dsc->endprolog = DSC_END(dsc);
+ dsc->scan_section = scan_pre_setup;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_OK;
}
else if (IS_DSC(line, "%%BeginFont:")) {
- dsc->id = CDSC_BEGINFONT;
- /* ignore Begin/EndFont, apart form making sure */
- /* that they are matched. */
- dsc->begin_font_count++;
+ dsc->id = CDSC_BEGINFONT;
+ /* ignore Begin/EndFont, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_font_count++;
}
else if (IS_DSC(line, "%%EndFont")) {
- dsc->id = CDSC_ENDFONT;
- dsc->begin_font_count--;
+ dsc->id = CDSC_ENDFONT;
+ dsc->begin_font_count--;
}
else if (IS_DSC(line, "%%BeginFeature:")) {
- dsc->id = CDSC_BEGINFEATURE;
- /* ignore Begin/EndFeature, apart form making sure */
- /* that they are matched. */
- dsc->begin_feature_count++;
+ dsc->id = CDSC_BEGINFEATURE;
+ /* ignore Begin/EndFeature, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_feature_count++;
}
else if (IS_DSC(line, "%%EndFeature")) {
- dsc->id = CDSC_ENDFEATURE;
- dsc->begin_feature_count--;
+ dsc->id = CDSC_ENDFEATURE;
+ dsc->begin_feature_count--;
}
else if (IS_DSC(line, "%%BeginResource:")) {
- dsc->id = CDSC_BEGINRESOURCE;
- /* ignore Begin/EndResource, apart form making sure */
- /* that they are matched. */
- dsc->begin_resource_count++;
+ dsc->id = CDSC_BEGINRESOURCE;
+ /* ignore Begin/EndResource, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_resource_count++;
}
else if (IS_DSC(line, "%%EndResource")) {
- dsc->id = CDSC_ENDRESOURCE;
- dsc->begin_resource_count--;
+ dsc->id = CDSC_ENDRESOURCE;
+ dsc->begin_resource_count--;
}
else if (IS_DSC(line, "%%BeginProcSet:")) {
- dsc->id = CDSC_BEGINPROCSET;
- /* ignore Begin/EndProcSet, apart form making sure */
- /* that they are matched. */
- dsc->begin_procset_count++;
+ dsc->id = CDSC_BEGINPROCSET;
+ /* ignore Begin/EndProcSet, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_procset_count++;
}
else if (IS_DSC(line, "%%EndProcSet")) {
- dsc->id = CDSC_ENDPROCSET;
- dsc->begin_procset_count--;
+ dsc->id = CDSC_ENDPROCSET;
+ dsc->begin_procset_count--;
}
else {
- /* All other DSC comments are unknown, but not an error */
- dsc->id = CDSC_UNKNOWNDSC;
- dsc_unknown(dsc);
+ /* All other DSC comments are unknown, but not an error */
+ dsc->id = CDSC_UNKNOWNDSC;
+ dsc_unknown(dsc);
}
dsc->endprolog = DSC_END(dsc);
@@ -2842,131 +2820,131 @@ dsc_scan_setup(CDSC *dsc)
dsc->id = CDSC_OK;
if (dsc->scan_section == scan_pre_setup) {
- if (IS_BLANK(line))
- return CDSC_OK; /* ignore blank lines before setup */
- else if (IS_DSC(line, "%%BeginSetup")) {
- dsc->id = CDSC_BEGINSETUP;
- dsc->beginsetup = DSC_START(dsc);
- dsc->endsetup = DSC_END(dsc);
- dsc->scan_section = scan_setup;
- return CDSC_OK;
- }
- else {
- dsc->scan_section = scan_pre_pages;
- return CDSC_PROPAGATE;
- }
+ if (IS_BLANK(line))
+ return CDSC_OK; /* ignore blank lines before setup */
+ else if (IS_DSC(line, "%%BeginSetup")) {
+ dsc->id = CDSC_BEGINSETUP;
+ dsc->beginsetup = DSC_START(dsc);
+ dsc->endsetup = DSC_END(dsc);
+ dsc->scan_section = scan_setup;
+ return CDSC_OK;
+ }
+ else {
+ dsc->scan_section = scan_pre_pages;
+ return CDSC_PROPAGATE;
+ }
}
if (NOT_DSC_LINE(line)) {
- /* ignore */
+ /* ignore */
}
else if (IS_DSC(line, "%%BeginPreview")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginDefaults")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginProlog")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginSetup")) {
- /* ignore because we are in this section */
+ /* ignore because we are in this section */
}
else if (dsc_is_section(line)) {
- dsc->endsetup = DSC_START(dsc);
- dsc->scan_section = scan_pre_pages;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
+ dsc->endsetup = DSC_START(dsc);
+ dsc->scan_section = scan_pre_pages;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
}
else if (IS_DSC(line, "%%EndSetup")) {
- dsc->id = CDSC_ENDSETUP;
- dsc->endsetup = DSC_END(dsc);
- dsc->scan_section = scan_pre_pages;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_OK;
+ dsc->id = CDSC_ENDSETUP;
+ dsc->endsetup = DSC_END(dsc);
+ dsc->scan_section = scan_pre_pages;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_OK;
}
else if (IS_DSC(line, "%%BeginFeature:")) {
- dsc->id = CDSC_BEGINFEATURE;
- /* ignore Begin/EndFeature, apart form making sure */
- /* that they are matched. */
- dsc->begin_feature_count++;
+ dsc->id = CDSC_BEGINFEATURE;
+ /* ignore Begin/EndFeature, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_feature_count++;
}
else if (IS_DSC(line, "%%EndFeature")) {
- dsc->id = CDSC_ENDFEATURE;
- dsc->begin_feature_count--;
+ dsc->id = CDSC_ENDFEATURE;
+ dsc->begin_feature_count--;
}
else if (IS_DSC(line, "%%Feature:")) {
- dsc->id = CDSC_FEATURE;
- /* ignore */
+ dsc->id = CDSC_FEATURE;
+ /* ignore */
}
else if (IS_DSC(line, "%%BeginResource:")) {
- dsc->id = CDSC_BEGINRESOURCE;
- /* ignore Begin/EndResource, apart form making sure */
- /* that they are matched. */
- dsc->begin_resource_count++;
+ dsc->id = CDSC_BEGINRESOURCE;
+ /* ignore Begin/EndResource, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_resource_count++;
}
else if (IS_DSC(line, "%%EndResource")) {
- dsc->id = CDSC_ENDRESOURCE;
- dsc->begin_resource_count--;
+ dsc->id = CDSC_ENDRESOURCE;
+ dsc->begin_resource_count--;
}
else if (IS_DSC(line, "%%PaperColor:")) {
- dsc->id = CDSC_PAPERCOLOR;
- /* ignore */
+ dsc->id = CDSC_PAPERCOLOR;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperForm:")) {
- dsc->id = CDSC_PAPERFORM;
- /* ignore */
+ dsc->id = CDSC_PAPERFORM;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperWeight:")) {
- dsc->id = CDSC_PAPERWEIGHT;
- /* ignore */
+ dsc->id = CDSC_PAPERWEIGHT;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperSize:")) {
- /* DSC 2.1 */
+ /* DSC 2.1 */
GSBOOL found_media = FALSE;
- int i;
- int n = 12;
- char buf[MAXSTR];
- buf[0] = '\0';
- dsc->id = CDSC_PAPERSIZE;
- dsc_copy_string(buf, sizeof(buf)-1, dsc->line+n, dsc->line_length-n,
- NULL);
- for (i=0; i<(int)dsc->media_count; i++) {
- if (dsc->media[i] && dsc->media[i]->name &&
- (dsc_stricmp(buf, dsc->media[i]->name)==0)) {
- dsc->page_media = dsc->media[i];
- found_media = TRUE;
- break;
- }
- }
- if (!found_media) {
- /* It didn't match %%DocumentPaperSizes: */
- /* Try our known media */
- const CDSCMEDIA *m = dsc_known_media;
- while (m->name) {
- if (dsc_stricmp(buf, m->name)==0) {
- dsc->page_media = m;
- break;
- }
- m++;
- }
- if (m->name == NULL)
- dsc_unknown(dsc);
- }
+ int i;
+ int n = 12;
+ char buf[MAXSTR];
+ buf[0] = '\0';
+ dsc->id = CDSC_PAPERSIZE;
+ dsc_copy_string(buf, sizeof(buf)-1, dsc->line+n, dsc->line_length-n,
+ NULL);
+ for (i=0; i<(int)dsc->media_count; i++) {
+ if (dsc->media[i] && dsc->media[i]->name &&
+ (dsc_stricmp(buf, dsc->media[i]->name)==0)) {
+ dsc->page_media = dsc->media[i];
+ found_media = TRUE;
+ break;
+ }
+ }
+ if (!found_media) {
+ /* It didn't match %%DocumentPaperSizes: */
+ /* Try our known media */
+ const CDSCMEDIA *m = dsc_known_media;
+ while (m->name) {
+ if (dsc_stricmp(buf, m->name)==0) {
+ dsc->page_media = m;
+ break;
+ }
+ m++;
+ }
+ if (m->name == NULL)
+ dsc_unknown(dsc);
+ }
}
else {
- /* All other DSC comments are unknown, but not an error */
- dsc->id = CDSC_UNKNOWNDSC;
- dsc_unknown(dsc);
+ /* All other DSC comments are unknown, but not an error */
+ dsc->id = CDSC_UNKNOWNDSC;
+ dsc_unknown(dsc);
}
dsc->endsetup = DSC_END(dsc);
return CDSC_OK;
}
-static int
+static int
dsc_scan_page(CDSC *dsc)
{
/* Page section ends at */
@@ -2977,295 +2955,295 @@ dsc_scan_page(CDSC *dsc)
dsc->id = CDSC_OK;
if (dsc->scan_section == scan_pre_pages) {
- if (IS_DSC(line, "%%Page:")) {
- dsc->scan_section = scan_pages;
- /* fall through */
- }
- else {
- /* %%Page: didn't follow %%EndSetup
- * Keep reading until reach %%Page or %%Trailer
- * and add it to previous section.
- */
- DSC_OFFSET *last;
- if (dsc->endsetup != 0)
- last = &dsc->endsetup;
- else if (dsc->endprolog != 0)
- last = &dsc->endprolog;
- else if (dsc->enddefaults != 0)
- last = &dsc->enddefaults;
- else if (dsc->endpreview != 0)
- last = &dsc->endpreview;
- else if (dsc->endcomments != 0)
- last = &dsc->endcomments;
- else
- last = &dsc->begincomments;
- *last = DSC_START(dsc);
- if (IS_DSC(line, "%%Trailer") || IS_DSC(line, "%%EOF")) {
- dsc->scan_section = scan_pre_trailer;
- return CDSC_PROPAGATE;
- }
- *last = DSC_END(dsc);
- return CDSC_OK;
- }
+ if (IS_DSC(line, "%%Page:")) {
+ dsc->scan_section = scan_pages;
+ /* fall through */
+ }
+ else {
+ /* %%Page: didn't follow %%EndSetup
+ * Keep reading until reach %%Page or %%Trailer
+ * and add it to previous section.
+ */
+ DSC_OFFSET *last;
+ if (dsc->endsetup != 0)
+ last = &dsc->endsetup;
+ else if (dsc->endprolog != 0)
+ last = &dsc->endprolog;
+ else if (dsc->enddefaults != 0)
+ last = &dsc->enddefaults;
+ else if (dsc->endpreview != 0)
+ last = &dsc->endpreview;
+ else if (dsc->endcomments != 0)
+ last = &dsc->endcomments;
+ else
+ last = &dsc->begincomments;
+ *last = DSC_START(dsc);
+ if (IS_DSC(line, "%%Trailer") || IS_DSC(line, "%%EOF")) {
+ dsc->scan_section = scan_pre_trailer;
+ return CDSC_PROPAGATE;
+ }
+ *last = DSC_END(dsc);
+ return CDSC_OK;
+ }
}
if (NOT_DSC_LINE(line)) {
- /* ignore */
+ /* ignore */
}
else if (IS_DSC(line, "%%Page:")) {
- int code;
- dsc->id = CDSC_PAGE;
- if (dsc->page_count) {
- dsc->page[dsc->page_count-1].end = DSC_START(dsc);
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- }
-
- if ( (code = dsc_parse_page(dsc)) != CDSC_OK)
- return code;
+ int code;
+ dsc->id = CDSC_PAGE;
+ if (dsc->page_count) {
+ dsc->page[dsc->page_count-1].end = DSC_START(dsc);
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ }
+
+ if ( (code = dsc_parse_page(dsc)) != CDSC_OK)
+ return code;
if (dsc->page_count == 0)
- dsc->scan_section = scan_pre_pages;
+ dsc->scan_section = scan_pre_pages;
}
else if (IS_DSC(line, "%%BeginPreview")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginDefaults")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginProlog")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (IS_DSC(line, "%%BeginSetup")) {
- /* ignore because we have already processed this section */
+ /* ignore because we have already processed this section */
}
else if (dsc_is_section(line)) {
- if (IS_DSC(line, "%%Trailer")) {
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].end = DSC_START(dsc);
- if (dsc->file_length) {
- if ((!dsc->doseps_end &&
- ((DSC_END(dsc) + 32768) < dsc->file_length)) ||
- ((dsc->doseps_end) &&
- ((DSC_END(dsc) + 32768) < dsc->doseps_end))) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_EARLY_TRAILER,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* ignore early trailer */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* this is the trailer */
- dsc->scan_section = scan_pre_trailer;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
- else {
- dsc->scan_section = scan_pre_trailer;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
- }
- }
- else {
- dsc->scan_section = scan_pre_trailer;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
- }
- }
- else if (IS_DSC(line, "%%EOF")) {
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].end = DSC_START(dsc);
- if (dsc->file_length) {
- if ((!dsc->doseps_end &&
- ((DSC_END(dsc) + 100) < dsc->file_length)) ||
- ((dsc->doseps_end) &&
- ((DSC_END(dsc) + 100) < dsc->doseps_end))) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_EARLY_EOF,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* %%EOF is wrong, ignore it */
- break;
- case CDSC_RESPONSE_CANCEL:
- /* %%EOF is correct */
- dsc->scan_section = scan_eof;
- dsc->eof = TRUE;
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_PROPAGATE;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
- }
- }
- else {
- /* ignore it */
- if (dsc_check_match(dsc))
- return CDSC_NOTDSC;
- return CDSC_OK;
- }
- }
- else {
- /* Section comment, probably from a badly */
- /* encapsulated EPS file. */
- int rc = dsc_error(dsc, CDSC_MESSAGE_BAD_SECTION,
- dsc->line, dsc->line_length);
- if (rc == CDSC_RESPONSE_IGNORE_ALL)
- return CDSC_NOTDSC;
- }
+ if (IS_DSC(line, "%%Trailer")) {
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].end = DSC_START(dsc);
+ if (dsc->file_length) {
+ if ((!dsc->doseps_end &&
+ ((DSC_END(dsc) + 32768) < dsc->file_length)) ||
+ ((dsc->doseps_end) &&
+ ((DSC_END(dsc) + 32768) < dsc->doseps_end))) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_EARLY_TRAILER,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* ignore early trailer */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* this is the trailer */
+ dsc->scan_section = scan_pre_trailer;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
+ else {
+ dsc->scan_section = scan_pre_trailer;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
+ }
+ }
+ else {
+ dsc->scan_section = scan_pre_trailer;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
+ }
+ }
+ else if (IS_DSC(line, "%%EOF")) {
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].end = DSC_START(dsc);
+ if (dsc->file_length) {
+ if ((!dsc->doseps_end &&
+ ((DSC_END(dsc) + 100) < dsc->file_length)) ||
+ ((dsc->doseps_end) &&
+ ((DSC_END(dsc) + 100) < dsc->doseps_end))) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_EARLY_EOF,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* %%EOF is wrong, ignore it */
+ break;
+ case CDSC_RESPONSE_CANCEL:
+ /* %%EOF is correct */
+ dsc->scan_section = scan_eof;
+ dsc->eof = TRUE;
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_PROPAGATE;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
+ }
+ }
+ else {
+ /* ignore it */
+ if (dsc_check_match(dsc))
+ return CDSC_NOTDSC;
+ return CDSC_OK;
+ }
+ }
+ else {
+ /* Section comment, probably from a badly */
+ /* encapsulated EPS file. */
+ int rc = dsc_error(dsc, CDSC_MESSAGE_BAD_SECTION,
+ dsc->line, dsc->line_length);
+ if (rc == CDSC_RESPONSE_IGNORE_ALL)
+ return CDSC_NOTDSC;
+ }
}
else if (IS_DSC(line, "%%PageTrailer")) {
- dsc->id = CDSC_PAGETRAILER;
- /* ignore */
+ dsc->id = CDSC_PAGETRAILER;
+ /* ignore */
}
else if (IS_DSC(line, "%%BeginPageSetup")) {
- dsc->id = CDSC_BEGINPAGESETUP;
- /* ignore */
+ dsc->id = CDSC_BEGINPAGESETUP;
+ /* ignore */
}
else if (IS_DSC(line, "%%EndPageSetup")) {
- dsc->id = CDSC_ENDPAGESETUP;
- /* ignore */
+ dsc->id = CDSC_ENDPAGESETUP;
+ /* ignore */
}
else if (IS_DSC(line, "%%PageMedia:")) {
- dsc->id = CDSC_PAGEMEDIA;
- if (dsc->page_count)
- dsc_parse_media(dsc, &(dsc->page[dsc->page_count-1].media));
+ dsc->id = CDSC_PAGEMEDIA;
+ if (dsc->page_count)
+ dsc_parse_media(dsc, &(dsc->page[dsc->page_count-1].media));
}
else if (IS_DSC(line, "%%PaperColor:")) {
- dsc->id = CDSC_PAPERCOLOR;
- /* ignore */
+ dsc->id = CDSC_PAPERCOLOR;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperForm:")) {
- dsc->id = CDSC_PAPERFORM;
- /* ignore */
+ dsc->id = CDSC_PAPERFORM;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperWeight:")) {
- dsc->id = CDSC_PAPERWEIGHT;
- /* ignore */
+ dsc->id = CDSC_PAPERWEIGHT;
+ /* ignore */
}
else if (IS_DSC(line, "%%PaperSize:")) {
- /* DSC 2.1 */
+ /* DSC 2.1 */
GSBOOL found_media = FALSE;
- int i;
- int n = 12;
- char buf[MAXSTR];
- buf[0] = '\0';
- dsc_copy_string(buf, sizeof(buf)-1, dsc->line+n,
- dsc->line_length-n, NULL);
- for (i=0; i<(int)dsc->media_count; i++) {
- if (dsc->media[i] && dsc->media[i]->name &&
- (dsc_stricmp(buf, dsc->media[i]->name)==0)) {
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].media = dsc->media[i];
- found_media = TRUE;
- break;
- }
- }
- if (!found_media) {
- /* It didn't match %%DocumentPaperSizes: */
- /* Try our known media */
- const CDSCMEDIA *m = dsc_known_media;
- while (m->name) {
- if (dsc_stricmp(buf, m->name)==0) {
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].media = m;
- break;
- }
- m++;
- }
- if (m->name == NULL)
- dsc_unknown(dsc);
- }
+ int i;
+ int n = 12;
+ char buf[MAXSTR];
+ buf[0] = '\0';
+ dsc_copy_string(buf, sizeof(buf)-1, dsc->line+n,
+ dsc->line_length-n, NULL);
+ for (i=0; i<(int)dsc->media_count; i++) {
+ if (dsc->media[i] && dsc->media[i]->name &&
+ (dsc_stricmp(buf, dsc->media[i]->name)==0)) {
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].media = dsc->media[i];
+ found_media = TRUE;
+ break;
+ }
+ }
+ if (!found_media) {
+ /* It didn't match %%DocumentPaperSizes: */
+ /* Try our known media */
+ const CDSCMEDIA *m = dsc_known_media;
+ while (m->name) {
+ if (dsc_stricmp(buf, m->name)==0) {
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].media = m;
+ break;
+ }
+ m++;
+ }
+ if (m->name == NULL)
+ dsc_unknown(dsc);
+ }
}
else if (IS_DSC(line, "%%PageOrientation:")) {
- if (dsc->page_count) {
- dsc->id = CDSC_PAGEORIENTATION;
- if (dsc_parse_orientation(dsc,
- &(dsc->page[dsc->page_count-1].orientation) ,18))
- return CDSC_NOTDSC;
- }
+ if (dsc->page_count) {
+ dsc->id = CDSC_PAGEORIENTATION;
+ if (dsc_parse_orientation(dsc,
+ &(dsc->page[dsc->page_count-1].orientation) ,18))
+ return CDSC_NOTDSC;
+ }
}
else if (IS_DSC(line, "%%PageBoundingBox:")) {
- if (dsc->page_count) {
- dsc->id = CDSC_PAGEBOUNDINGBOX;
- if (dsc_parse_bounding_box(dsc,
- &dsc->page[dsc->page_count-1].bbox, 18))
- return CDSC_NOTDSC;
- }
+ if (dsc->page_count) {
+ dsc->id = CDSC_PAGEBOUNDINGBOX;
+ if (dsc_parse_bounding_box(dsc,
+ &dsc->page[dsc->page_count-1].bbox, 18))
+ return CDSC_NOTDSC;
+ }
}
else if (IS_DSC(line, "%%ViewingOrientation:")) {
- if (dsc->page_count) {
- dsc->id = CDSC_VIEWINGORIENTATION;
- if (dsc_parse_viewing_orientation(dsc,
- &dsc->page[dsc->page_count-1].viewing_orientation))
- return CDSC_ERROR;
- }
+ if (dsc->page_count) {
+ dsc->id = CDSC_VIEWINGORIENTATION;
+ if (dsc_parse_viewing_orientation(dsc,
+ &dsc->page[dsc->page_count-1].viewing_orientation))
+ return CDSC_ERROR;
+ }
}
else if (IS_DSC(line, "%%PageCropBox:")) {
- if (dsc->page_count) {
- dsc->id = CDSC_PAGECROPBOX;
- if (dsc_parse_float_bounding_box(dsc,
- &(dsc->page[dsc->page_count-1].crop_box), 14))
- return CDSC_ERROR;
- }
+ if (dsc->page_count) {
+ dsc->id = CDSC_PAGECROPBOX;
+ if (dsc_parse_float_bounding_box(dsc,
+ &(dsc->page[dsc->page_count-1].crop_box), 14))
+ return CDSC_ERROR;
+ }
}
else if (IS_DSC(line, "%%BeginFont:")) {
- dsc->id = CDSC_BEGINFONT;
- /* ignore Begin/EndFont, apart form making sure */
- /* that they are matched. */
- dsc->begin_font_count++;
+ dsc->id = CDSC_BEGINFONT;
+ /* ignore Begin/EndFont, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_font_count++;
}
else if (IS_DSC(line, "%%EndFont")) {
- dsc->id = CDSC_BEGINFONT;
- dsc->begin_font_count--;
+ dsc->id = CDSC_BEGINFONT;
+ dsc->begin_font_count--;
}
else if (IS_DSC(line, "%%BeginFeature:")) {
- dsc->id = CDSC_BEGINFEATURE;
- /* ignore Begin/EndFeature, apart form making sure */
- /* that they are matched. */
- dsc->begin_feature_count++;
+ dsc->id = CDSC_BEGINFEATURE;
+ /* ignore Begin/EndFeature, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_feature_count++;
}
else if (IS_DSC(line, "%%EndFeature")) {
- dsc->id = CDSC_ENDFEATURE;
- dsc->begin_feature_count--;
+ dsc->id = CDSC_ENDFEATURE;
+ dsc->begin_feature_count--;
}
else if (IS_DSC(line, "%%BeginResource:")) {
- dsc->id = CDSC_BEGINRESOURCE;
- /* ignore Begin/EndResource, apart form making sure */
- /* that they are matched. */
- dsc->begin_resource_count++;
+ dsc->id = CDSC_BEGINRESOURCE;
+ /* ignore Begin/EndResource, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_resource_count++;
}
else if (IS_DSC(line, "%%EndResource")) {
- dsc->id = CDSC_ENDRESOURCE;
- dsc->begin_resource_count--;
+ dsc->id = CDSC_ENDRESOURCE;
+ dsc->begin_resource_count--;
}
else if (IS_DSC(line, "%%BeginProcSet:")) {
- dsc->id = CDSC_BEGINPROCSET;
- /* ignore Begin/EndProcSet, apart form making sure */
- /* that they are matched. */
- dsc->begin_procset_count++;
+ dsc->id = CDSC_BEGINPROCSET;
+ /* ignore Begin/EndProcSet, apart form making sure */
+ /* that they are matched. */
+ dsc->begin_procset_count++;
}
else if (IS_DSC(line, "%%EndProcSet")) {
- dsc->id = CDSC_ENDPROCSET;
- dsc->begin_procset_count--;
+ dsc->id = CDSC_ENDPROCSET;
+ dsc->begin_procset_count--;
}
else if (IS_DSC(line, "%%IncludeFont:")) {
- dsc->id = CDSC_INCLUDEFONT;
- /* ignore */
+ dsc->id = CDSC_INCLUDEFONT;
+ /* ignore */
}
else {
- /* All other DSC comments are unknown, but not an error */
- dsc->id = CDSC_UNKNOWNDSC;
- dsc_unknown(dsc);
+ /* All other DSC comments are unknown, but not an error */
+ dsc->id = CDSC_UNKNOWNDSC;
+ dsc_unknown(dsc);
}
if (dsc->page_count)
- dsc->page[dsc->page_count-1].end = DSC_END(dsc);
+ dsc->page[dsc->page_count-1].end = DSC_END(dsc);
return CDSC_OK;
}
@@ -3285,11 +3263,11 @@ dsc_scan_page(CDSC *dsc)
* %%DocumentProcessColors:
* %%DocumentSuppliedFiles:
* %%DocumentSuppliedFonts:
- * %%DocumentSuppliedProcSets:
- * %%DocumentSuppliedResources:
- * %%Orientation:
- * %%Pages:
- * %%PageOrder:
+ * %%DocumentSuppliedProcSets:
+ * %%DocumentSuppliedResources:
+ * %%Orientation:
+ * %%Pages:
+ * %%PageOrder:
*
* Our supported subset is
* %%Trailer
@@ -3299,20 +3277,20 @@ dsc_scan_page(CDSC *dsc)
* %%HiResBoundingBox:
* %%DocumentCustomColors:
* %%DocumentProcessColors:
- * %%Orientation:
- * %%Pages:
- * %%PageOrder:
+ * %%Orientation:
+ * %%Pages:
+ * %%PageOrder:
* In addition to these, we support
* %%DocumentMedia:
- *
+ *
* A %%PageTrailer can have the following:
- * %%PageBoundingBox:
- * %%PageCustomColors:
- * %%PageFiles:
- * %%PageFonts:
- * %%PageOrientation:
- * %%PageProcessColors:
- * %%PageResources:
+ * %%PageBoundingBox:
+ * %%PageCustomColors:
+ * %%PageFiles:
+ * %%PageFonts:
+ * %%PageOrientation:
+ * %%PageProcessColors:
+ * %%PageResources:
*/
static int
@@ -3327,189 +3305,188 @@ dsc_scan_trailer(CDSC *dsc)
dsc->id = CDSC_OK;
if (dsc->scan_section == scan_pre_trailer) {
- if (IS_DSC(line, "%%Trailer")) {
- dsc->id = CDSC_TRAILER;
- dsc->begintrailer = DSC_START(dsc);
- dsc->endtrailer = DSC_END(dsc);
- dsc->scan_section = scan_trailer;
- return CDSC_OK;
- }
- else if (IS_DSC(line, "%%EOF")) {
- dsc->id = CDSC_EOF;
- dsc->begintrailer = DSC_START(dsc);
- dsc->endtrailer = DSC_END(dsc);
- dsc->scan_section = scan_trailer;
- /* Continue, in case we found %%EOF in an embedded document */
- return CDSC_OK;
- }
- else {
- /* %%Page: didn't follow %%EndSetup
- * Keep reading until reach %%Page or %%Trailer
- * and add it to setup section
- */
- /* append to previous section */
- if (dsc->beginsetup)
- dsc->endsetup = DSC_END(dsc);
- else if (dsc->beginprolog)
- dsc->endprolog = DSC_END(dsc);
- else {
- /* horribly confused */
- }
- return CDSC_OK;
- }
+ if (IS_DSC(line, "%%Trailer")) {
+ dsc->id = CDSC_TRAILER;
+ dsc->begintrailer = DSC_START(dsc);
+ dsc->endtrailer = DSC_END(dsc);
+ dsc->scan_section = scan_trailer;
+ return CDSC_OK;
+ }
+ else if (IS_DSC(line, "%%EOF")) {
+ dsc->id = CDSC_EOF;
+ dsc->begintrailer = DSC_START(dsc);
+ dsc->endtrailer = DSC_END(dsc);
+ dsc->scan_section = scan_trailer;
+ /* Continue, in case we found %%EOF in an embedded document */
+ return CDSC_OK;
+ }
+ else {
+ /* %%Page: didn't follow %%EndSetup
+ * Keep reading until reach %%Page or %%Trailer
+ * and add it to setup section
+ */
+ /* append to previous section */
+ if (dsc->beginsetup)
+ dsc->endsetup = DSC_END(dsc);
+ else if (dsc->beginprolog)
+ dsc->endprolog = DSC_END(dsc);
+ else {
+ /* horribly confused */
+ }
+ return CDSC_OK;
+ }
}
/* Handle continuation lines.
- * See comment above about our restrictive processing of
+ * See comment above about our restrictive processing of
* continuation lines
*/
if (IS_DSC(line, "%%+")) {
- line = dsc->last_line;
- continued = TRUE;
+ line = dsc->last_line;
+ continued = TRUE;
}
else
- dsc_save_line(dsc);
+ dsc_save_line(dsc);
if (NOT_DSC_LINE(line)) {
- /* ignore */
+ /* ignore */
}
else if (IS_DSC(dsc->line, "%%EOF")) {
- /* Keep scanning, in case we have a false trailer */
- dsc->id = CDSC_EOF;
+ /* Keep scanning, in case we have a false trailer */
+ dsc->id = CDSC_EOF;
}
else if (IS_DSC(dsc->line, "%%Trailer")) {
- /* Cope with no pages with code after setup and before trailer. */
- /* Last trailer is the correct one. */
- dsc->id = CDSC_TRAILER;
- dsc->begintrailer = DSC_START(dsc);
+ /* Cope with no pages with code after setup and before trailer. */
+ /* Last trailer is the correct one. */
+ dsc->id = CDSC_TRAILER;
+ dsc->begintrailer = DSC_START(dsc);
}
else if (IS_DSC(line, "%%Pages:")) {
- dsc->id = CDSC_PAGES;
- if (dsc_parse_pages(dsc) != 0)
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGES;
+ if (dsc_parse_pages(dsc) != 0)
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%BoundingBox:")) {
- dsc->id = CDSC_BOUNDINGBOX;
- if (dsc_parse_bounding_box(dsc, &(dsc->bbox), continued ? 3 : 14))
- return CDSC_ERROR;
+ dsc->id = CDSC_BOUNDINGBOX;
+ if (dsc_parse_bounding_box(dsc, &(dsc->bbox), continued ? 3 : 14))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%HiResBoundingBox:")) {
- dsc->id = CDSC_HIRESBOUNDINGBOX;
- if (dsc_parse_float_bounding_box(dsc, &(dsc->hires_bbox),
- continued ? 3 : 19))
- return CDSC_ERROR;
+ dsc->id = CDSC_HIRESBOUNDINGBOX;
+ if (dsc_parse_float_bounding_box(dsc, &(dsc->hires_bbox),
+ continued ? 3 : 19))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%CropBox:")) {
- dsc->id = CDSC_CROPBOX;
- if (dsc_parse_float_bounding_box(dsc, &(dsc->crop_box),
- continued ? 3 : 10))
- return CDSC_ERROR;
+ dsc->id = CDSC_CROPBOX;
+ if (dsc_parse_float_bounding_box(dsc, &(dsc->crop_box),
+ continued ? 3 : 10))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%Orientation:")) {
- dsc->id = CDSC_ORIENTATION;
- if (dsc_parse_orientation(dsc, &(dsc->page_orientation), continued ? 3 : 14))
- return CDSC_ERROR;
+ dsc->id = CDSC_ORIENTATION;
+ if (dsc_parse_orientation(dsc, &(dsc->page_orientation), continued ? 3 : 14))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%PageOrder:")) {
- dsc->id = CDSC_PAGEORDER;
- if (dsc_parse_order(dsc))
- return CDSC_ERROR;
+ dsc->id = CDSC_PAGEORDER;
+ if (dsc_parse_order(dsc))
+ return CDSC_ERROR;
}
else if (IS_DSC(line, "%%DocumentMedia:")) {
- dsc->id = CDSC_DOCUMENTMEDIA;
- if (dsc_parse_document_media(dsc))
- return CDSC_ERROR;
+ dsc->id = CDSC_DOCUMENTMEDIA;
+ if (dsc_parse_document_media(dsc))
+ return CDSC_ERROR;
}
else if (IS_DSC(dsc->line, "%%Page:")) {
- /* This should not occur in the trailer, but we might see
- * this if a document has been incorrectly embedded.
- */
- int rc = dsc_error(dsc, CDSC_MESSAGE_PAGE_IN_TRAILER,
- dsc->line, dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* Assume that we are really in the previous */
- /* page, not the trailer */
- dsc->scan_section = scan_pre_pages;
- if (dsc->page_count)
- dsc->page[dsc->page_count-1].end = DSC_START(dsc);
- return CDSC_PROPAGATE; /* try again */
- case CDSC_RESPONSE_CANCEL:
- /* ignore pages in trailer */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ /* This should not occur in the trailer, but we might see
+ * this if a document has been incorrectly embedded.
+ */
+ int rc = dsc_error(dsc, CDSC_MESSAGE_PAGE_IN_TRAILER,
+ dsc->line, dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* Assume that we are really in the previous */
+ /* page, not the trailer */
+ dsc->scan_section = scan_pre_pages;
+ if (dsc->page_count)
+ dsc->page[dsc->page_count-1].end = DSC_START(dsc);
+ return CDSC_PROPAGATE; /* try again */
+ case CDSC_RESPONSE_CANCEL:
+ /* ignore pages in trailer */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
else if (IS_DSC(line, "%%DocumentNeededFonts:")) {
- dsc->id = CDSC_DOCUMENTNEEDEDFONTS;
- /* ignore */
+ dsc->id = CDSC_DOCUMENTNEEDEDFONTS;
+ /* ignore */
}
else if (IS_DSC(line, "%%DocumentSuppliedFonts:")) {
- dsc->id = CDSC_DOCUMENTSUPPLIEDFONTS;
- /* ignore */
+ dsc->id = CDSC_DOCUMENTSUPPLIEDFONTS;
+ /* ignore */
}
else if (IS_DSC(line, "%%DocumentProcessColors:")) {
- dsc->id = CDSC_DOCUMENTPROCESSCOLORS;
- if (dsc_parse_process_colours(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_DOCUMENTPROCESSCOLORS;
+ if (dsc_parse_process_colours(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else if (IS_DSC(line, "%%DocumentCustomColors:")) {
- dsc->id = CDSC_DOCUMENTCUSTOMCOLORS;
- if (dsc_parse_custom_colours(dsc) != CDSC_OK)
- dsc->id = CDSC_UNKNOWNDSC;
+ dsc->id = CDSC_DOCUMENTCUSTOMCOLORS;
+ if (dsc_parse_custom_colours(dsc) != CDSC_OK)
+ dsc->id = CDSC_UNKNOWNDSC;
}
else {
- /* All other DSC comments are unknown, but not an error */
- dsc->id = CDSC_UNKNOWNDSC;
- dsc_unknown(dsc);
+ /* All other DSC comments are unknown, but not an error */
+ dsc->id = CDSC_UNKNOWNDSC;
+ dsc_unknown(dsc);
}
dsc->endtrailer = DSC_END(dsc);
return CDSC_OK;
}
-
static char *
dsc_alloc_string(CDSC *dsc, const char *str, int len)
{
char *p;
if (dsc->string_head == NULL) {
- dsc->string_head = (CDSCSTRING *)dsc_memalloc(dsc, sizeof(CDSCSTRING));
- if (dsc->string_head == NULL)
- return NULL; /* no memory */
- dsc->string = dsc->string_head;
- dsc->string->next = NULL;
- dsc->string->data = (char *)dsc_memalloc(dsc, CDSC_STRING_CHUNK);
- if (dsc->string->data == NULL) {
- dsc_reset(dsc);
- return NULL; /* no memory */
- }
- dsc->string->index = 0;
- dsc->string->length = CDSC_STRING_CHUNK;
+ dsc->string_head = (CDSCSTRING *)dsc_memalloc(dsc, sizeof(CDSCSTRING));
+ if (dsc->string_head == NULL)
+ return NULL; /* no memory */
+ dsc->string = dsc->string_head;
+ dsc->string->next = NULL;
+ dsc->string->data = (char *)dsc_memalloc(dsc, CDSC_STRING_CHUNK);
+ if (dsc->string->data == NULL) {
+ dsc_reset(dsc);
+ return NULL; /* no memory */
+ }
+ dsc->string->index = 0;
+ dsc->string->length = CDSC_STRING_CHUNK;
}
if ( dsc->string->index + len + 1 > dsc->string->length) {
- /* allocate another string block */
- CDSCSTRING *newstring = (CDSCSTRING *)dsc_memalloc(dsc, sizeof(CDSCSTRING));
- if (newstring == NULL) {
- dsc_debug_print(dsc, "Out of memory\n");
- return NULL;
- }
+ /* allocate another string block */
+ CDSCSTRING *newstring = (CDSCSTRING *)dsc_memalloc(dsc, sizeof(CDSCSTRING));
+ if (newstring == NULL) {
+ dsc_debug_print(dsc, "Out of memory\n");
+ return NULL;
+ }
newstring->next = NULL;
- newstring->length = 0;
- newstring->index = 0;
- newstring->data = (char *)dsc_memalloc(dsc, CDSC_STRING_CHUNK);
- if (newstring->data == NULL) {
- dsc_memfree(dsc, newstring);
- dsc_debug_print(dsc, "Out of memory\n");
- return NULL; /* no memory */
- }
- newstring->length = CDSC_STRING_CHUNK;
- dsc->string->next = newstring;
- dsc->string = newstring;
+ newstring->length = 0;
+ newstring->index = 0;
+ newstring->data = (char *)dsc_memalloc(dsc, CDSC_STRING_CHUNK);
+ if (newstring->data == NULL) {
+ dsc_memfree(dsc, newstring);
+ dsc_debug_print(dsc, "Out of memory\n");
+ return NULL; /* no memory */
+ }
+ newstring->length = CDSC_STRING_CHUNK;
+ dsc->string->next = newstring;
+ dsc->string = newstring;
}
if ( dsc->string->index + len + 1 > dsc->string->length)
- return NULL; /* failed */
+ return NULL; /* failed */
p = dsc->string->data + dsc->string->index;
memcpy(p, str, len);
*(p+len) = '\0';
@@ -3524,27 +3501,26 @@ dsc_add_line(CDSC *dsc, const char *line, unsigned int len)
char *newline;
unsigned int i;
while (len && (IS_WHITE(*line))) {
- len--;
- line++;
+ len--;
+ line++;
}
newline = dsc_alloc_string(dsc, line, len);
if (newline == NULL)
- return NULL;
+ return NULL;
for (i=0; i<len; i++) {
- if (newline[i] == '\r') {
- newline[i]='\0';
- break;
- }
- if (newline[i] == '\n') {
- newline[i]='\0';
- break;
- }
+ if (newline[i] == '\r') {
+ newline[i]='\0';
+ break;
+ }
+ if (newline[i] == '\n') {
+ newline[i]='\0';
+ break;
+ }
}
return newline;
}
-
/* Copy string on line to new allocated string str */
/* String is always null terminated */
/* String is no longer than len */
@@ -3552,8 +3528,8 @@ dsc_add_line(CDSC *dsc, const char *line, unsigned int len)
/* Store number of used characters from line */
/* Don't copy enclosing () */
static char *
-dsc_copy_string(char *str, unsigned int slen, char *line,
- unsigned int len, unsigned int *offset)
+dsc_copy_string(char *str, unsigned int slen, char *line,
+ unsigned int len, unsigned int *offset)
{
int quoted = FALSE;
int instring=0;
@@ -3561,79 +3537,79 @@ dsc_copy_string(char *str, unsigned int slen, char *line,
unsigned int i = 0;
unsigned char ch;
if (len > slen)
- len = slen-1;
+ len = slen-1;
while ( (i<len) && IS_WHITE(line[i]))
- i++; /* skip leading spaces */
+ i++; /* skip leading spaces */
if ((i < len) && (line[i]=='(')) {
- quoted = TRUE;
- instring++;
- i++; /* don't copy outside () */
+ quoted = TRUE;
+ instring++;
+ i++; /* don't copy outside () */
}
while (i < len) {
- str[newlength] = ch = line[i];
- i++;
- if (quoted) {
- if (ch == '(')
- instring++;
- if (ch == ')')
- instring--;
- if (instring==0)
- break;
- }
- else if (ch == ' ')
- break;
-
- if (ch == '\r')
- break;
- if (ch == '\n')
- break;
- else if ( (ch == '\\') && (i+1 < len) ) {
- ch = line[i];
- if ((ch >= '0') && (ch <= '9')) {
- /* octal coded character */
- int j = 3;
- ch = 0;
- while (j && (i < len) && line[i]>='0' && line[i]<='7') {
- ch = (unsigned char)((ch<<3) + (line[i]-'0'));
- i++;
- j--;
- }
- str[newlength] = ch;
- }
- else if (ch == '(') {
- str[newlength] = ch;
- i++;
- }
- else if (ch == ')') {
- str[newlength] = ch;
- i++;
- }
- else if (ch == 'b') {
- str[newlength] = '\b';
- i++;
- }
- else if (ch == 'f') {
- str[newlength] = '\b';
- i++;
- }
- else if (ch == 'n') {
- str[newlength] = '\n';
- i++;
- }
- else if (ch == 'r') {
- str[newlength] = '\r';
- i++;
- }
- else if (ch == 't') {
- str[newlength] = '\t';
- i++;
- }
- else if (ch == '\\') {
- str[newlength] = '\\';
- i++;
- }
- }
- newlength++;
+ str[newlength] = ch = line[i];
+ i++;
+ if (quoted) {
+ if (ch == '(')
+ instring++;
+ if (ch == ')')
+ instring--;
+ if (instring==0)
+ break;
+ }
+ else if (ch == ' ')
+ break;
+
+ if (ch == '\r')
+ break;
+ if (ch == '\n')
+ break;
+ else if ( (ch == '\\') && (i+1 < len) ) {
+ ch = line[i];
+ if ((ch >= '0') && (ch <= '9')) {
+ /* octal coded character */
+ int j = 3;
+ ch = 0;
+ while (j && (i < len) && line[i]>='0' && line[i]<='7') {
+ ch = (unsigned char)((ch<<3) + (line[i]-'0'));
+ i++;
+ j--;
+ }
+ str[newlength] = ch;
+ }
+ else if (ch == '(') {
+ str[newlength] = ch;
+ i++;
+ }
+ else if (ch == ')') {
+ str[newlength] = ch;
+ i++;
+ }
+ else if (ch == 'b') {
+ str[newlength] = '\b';
+ i++;
+ }
+ else if (ch == 'f') {
+ str[newlength] = '\b';
+ i++;
+ }
+ else if (ch == 'n') {
+ str[newlength] = '\n';
+ i++;
+ }
+ else if (ch == 'r') {
+ str[newlength] = '\r';
+ i++;
+ }
+ else if (ch == 't') {
+ str[newlength] = '\t';
+ i++;
+ }
+ else if (ch == '\\') {
+ str[newlength] = '\\';
+ i++;
+ }
+ }
+ newlength++;
}
str[newlength] = '\0';
if (offset != (unsigned int *)NULL)
@@ -3641,7 +3617,7 @@ dsc_copy_string(char *str, unsigned int slen, char *line,
return str;
}
-static int
+static int
dsc_get_int(const char *line, unsigned int len, unsigned int *offset)
{
char newline[MAXSTR];
@@ -3651,23 +3627,23 @@ dsc_get_int(const char *line, unsigned int len, unsigned int *offset)
len = min(len, sizeof(newline)-1);
while ((i<len) && IS_WHITE(line[i]))
- i++; /* skip leading spaces */
+ i++; /* skip leading spaces */
while (i < len) {
- newline[newlength] = ch = line[i];
- if (!(isdigit(ch) || (ch=='-') || (ch=='+')))
- break; /* not part of an integer number */
- i++;
- newlength++;
+ newline[newlength] = ch = line[i];
+ if (!(isdigit(ch) || (ch=='-') || (ch=='+')))
+ break; /* not part of an integer number */
+ i++;
+ newlength++;
}
while ((i<len) && IS_WHITE(line[i]))
- i++; /* skip trailing spaces */
+ i++; /* skip trailing spaces */
newline[newlength] = '\0';
if (offset != (unsigned int *)NULL)
*offset = i;
return atoi(newline);
}
-static float
+static float
dsc_get_real(const char *line, unsigned int len, unsigned int *offset)
{
char newline[MAXSTR];
@@ -3677,17 +3653,17 @@ dsc_get_real(const char *line, unsigned int len, unsigned int *offset)
len = min(len, sizeof(newline)-1);
while ((i<len) && IS_WHITE(line[i]))
- i++; /* skip leading spaces */
+ i++; /* skip leading spaces */
while (i < len) {
- newline[newlength] = ch = line[i];
- if (!(isdigit(ch) || (ch=='.') || (ch=='-') || (ch=='+')
- || (ch=='e') || (ch=='E')))
- break; /* not part of a real number */
- i++;
- newlength++;
+ newline[newlength] = ch = line[i];
+ if (!(isdigit(ch) || (ch=='.') || (ch=='-') || (ch=='+')
+ || (ch=='e') || (ch=='E')))
+ break; /* not part of a real number */
+ i++;
+ newlength++;
}
while ((i<len) && IS_WHITE(line[i]))
- i++; /* skip trailing spaces */
+ i++; /* skip trailing spaces */
newline[newlength] = '\0';
@@ -3700,15 +3676,14 @@ int
dsc_stricmp(const char *s, const char *t)
{
while (toupper((unsigned char)*s) == toupper((unsigned char)*t)) {
- if (*s == '\0')
- return 0;
- s++;
- t++;
+ if (*s == '\0')
+ return 0;
+ s++;
+ t++;
}
return (toupper((unsigned char)*s) - toupper((unsigned char)*t));
}
-
static int
dsc_parse_page(CDSC *dsc)
{
@@ -3722,41 +3697,41 @@ dsc_parse_page(CDSC *dsc)
p = dsc->line + 7;
pl = dsc_copy_string(page_label, sizeof(page_label), p, dsc->line_length-7, &i);
if (pl == NULL)
- return CDSC_ERROR;
+ return CDSC_ERROR;
p += i;
if (dsc->line_length - 7 - i == 0) {
- /* Ordinal missing, or parentheses not matched in label */
- /* Try to find ordinal at end of line */
- while (i > 0) {
- if (!IS_WHITE_OR_EOL(p[-1]))
- break;
- p--;
- i--;
- }
- while (i > 0) {
- if (!isdigit((int)p[-1]))
- break;
- p--;
- i--;
- }
+ /* Ordinal missing, or parentheses not matched in label */
+ /* Try to find ordinal at end of line */
+ while (i > 0) {
+ if (!IS_WHITE_OR_EOL(p[-1]))
+ break;
+ p--;
+ i--;
+ }
+ while (i > 0) {
+ if (!isdigit((int)p[-1]))
+ break;
+ p--;
+ i--;
+ }
}
page_ordinal = dsc_get_int(p, dsc->line_length - 7 - i, NULL);
if ( (page_ordinal == 0) || (strlen(page_label) == 0) ||
- (dsc->page_count &&
- (page_ordinal != dsc->page[dsc->page_count-1].ordinal+1)) ) {
- int rc = dsc_error(dsc, CDSC_MESSAGE_PAGE_ORDINAL, dsc->line,
- dsc->line_length);
- switch (rc) {
- case CDSC_RESPONSE_OK:
- /* ignore this page */
- return CDSC_OK;
- case CDSC_RESPONSE_CANCEL:
- /* accept the page */
- break;
- case CDSC_RESPONSE_IGNORE_ALL:
- return CDSC_NOTDSC;
- }
+ (dsc->page_count &&
+ (page_ordinal != dsc->page[dsc->page_count-1].ordinal+1)) ) {
+ int rc = dsc_error(dsc, CDSC_MESSAGE_PAGE_ORDINAL, dsc->line,
+ dsc->line_length);
+ switch (rc) {
+ case CDSC_RESPONSE_OK:
+ /* ignore this page */
+ return CDSC_OK;
+ case CDSC_RESPONSE_CANCEL:
+ /* accept the page */
+ break;
+ case CDSC_RESPONSE_IGNORE_ALL:
+ return CDSC_NOTDSC;
+ }
}
page_number = dsc->page_count;
@@ -3765,49 +3740,45 @@ dsc_parse_page(CDSC *dsc)
dsc->page[page_number].end = DSC_START(dsc);
if (dsc->page[page_number].label == NULL)
- return CDSC_ERROR; /* no memory */
-
+ return CDSC_ERROR; /* no memory */
+
return CDSC_OK;
}
-
-
/* DSC error reporting */
-void
+void
dsc_debug_print(CDSC *dsc, const char *str)
{
if (dsc->debug_print_fn)
- dsc->debug_print_fn(dsc->caller_data, str);
+ dsc->debug_print_fn(dsc->caller_data, str);
}
-
/* Display a message about a problem with the DSC comments.
- *
+ *
* explanation = an index to to a multiline explanation in dsc_message[]
* line = pointer to the offending DSC line (if any)
- * return code =
- * CDSC_RESPONSE_OK DSC was wrong, make a guess about what
+ * return code =
+ * CDSC_RESPONSE_OK DSC was wrong, make a guess about what
* was really meant.
- * CDSC_RESPONSE_CANCEL Assume DSC was correct, ignore if it
+ * CDSC_RESPONSE_CANCEL Assume DSC was correct, ignore if it
* is misplaced.
* CDSC_RESPONSE_IGNORE_ALL Ignore all DSC.
*/
/* Silent operation. Don't display errors. */
-static int
-dsc_error(CDSC *dsc, unsigned int explanation,
- char *line, unsigned int line_len)
+static int
+dsc_error(CDSC *dsc, unsigned int explanation,
+ char *line, unsigned int line_len)
{
/* if error function provided, use it */
if (dsc->dsc_error_fn)
- return dsc->dsc_error_fn(dsc->caller_data, dsc,
- explanation, line, line_len);
+ return dsc->dsc_error_fn(dsc->caller_data, dsc,
+ explanation, line, line_len);
/* treat DSC as being correct */
return CDSC_RESPONSE_CANCEL;
}
-
/* Fixup if DCS 2.0 was used */
static int
dsc_dcs2_fixup(CDSC *dsc)
@@ -3818,127 +3789,126 @@ dsc_dcs2_fixup(CDSC *dsc)
* page without comments, prolog or trailer.
*/
if (dsc->dcs2) {
- int code = CDSC_OK;
- int page_number;
- DSC_OFFSET *pbegin;
- DSC_OFFSET *pend;
+ int code = CDSC_OK;
+ int page_number;
+ DSC_OFFSET *pbegin;
+ DSC_OFFSET *pend;
DSC_OFFSET end;
- CDCS2 *pdcs = dsc->dcs2;
- /* Now treat the initial EPS file as a single page without
- * headers or trailer, so page extraction will fetch the
- * the correct separation. */
- if (dsc->page_count == 0)
- code = dsc_add_page(dsc, 1, composite);
- else if (dsc->page_count == 1)
- dsc->page[0].label =
- dsc_alloc_string(dsc, composite, (int)strlen(composite)+1);
- if (code != CDSC_OK)
- return code;
- page_number = dsc->page_count - 1;
- pbegin = &dsc->page[page_number].begin;
- pend = &dsc->page[page_number].end;
- if (*pbegin == *pend) {
- /* no page, so force it to conform to the following sections */
- *pbegin = 999999999;
- *pend = 0;
- }
-
- if (dsc->begincomments != dsc->endcomments) {
- *pbegin = min(dsc->begincomments, *pbegin);
- dsc->begincomments = 0;
- *pend = max(dsc->endcomments, *pend);
- dsc->endcomments = 0;
- }
-
- if (dsc->beginpreview != dsc->endpreview) {
- *pbegin = min(dsc->beginpreview, *pbegin);
- dsc->beginpreview = 0;
- *pend = max(dsc->endpreview, *pend);
- dsc->endpreview = 0;
- }
-
- if (dsc->begindefaults != dsc->enddefaults) {
- *pbegin = min(dsc->begindefaults, *pbegin);
- dsc->begindefaults = 0;
- *pend = max(dsc->enddefaults, *pend);
- dsc->enddefaults = 0;
- }
-
- if (dsc->beginprolog != dsc->endprolog) {
- *pbegin = min(dsc->beginprolog, *pbegin);
- dsc->beginprolog = 0;
- *pend = max(dsc->endprolog, *pend);
- dsc->endprolog = 0;
- }
-
- if (dsc->beginsetup != dsc->endsetup) {
- *pbegin = min(dsc->beginsetup, *pbegin);
- dsc->beginsetup = 0;
- *pend = max(dsc->endsetup, *pend);
- dsc->endsetup = 0;
- }
-
- if (dsc->begintrailer != dsc->endtrailer) {
- *pbegin = min(dsc->begintrailer, *pbegin);
- dsc->begintrailer = 0;
- *pend = max(dsc->endtrailer, *pend);
- dsc->endtrailer = 0;
- }
-
- if (*pbegin == 999999999)
- *pbegin = *pend;
- end = 0; /* end of composite is start of first separation */
-
- while (pdcs) {
- page_number = dsc->page_count;
- if ((pdcs->begin) && (pdcs->colourname != NULL)) {
- /* Single file DCS 2.0 */
- code = dsc_add_page(dsc, page_number+1, pdcs->colourname);
- if (code)
- return code;
- dsc->page[page_number].begin = pdcs->begin;
- dsc->page[page_number].end = pdcs->end;
- if (end != 0)
- end = min(end, pdcs->begin);
- else
- end = pdcs->begin; /* first separation */
- }
- else {
- /* Multiple file DCS 2.0 */
- if ((pdcs->location != NULL) &&
- (pdcs->filetype != NULL) &&
- (pdcs->colourname != NULL) &&
- (dsc_stricmp(pdcs->location, "Local") == 0) &&
- ((dsc_stricmp(pdcs->filetype, "EPS") == 0) ||
- (dsc_stricmp(pdcs->filetype, "EPSF") == 0))) {
- code = dsc_add_page(dsc, page_number+1, pdcs->colourname);
- if (code)
- return code;
- dsc->page[page_number].begin = 0;
- dsc->page[page_number].end = 0;
- }
- }
- pdcs = pdcs->next;
- }
- /* end of composite is start of first separation */
- if (end != 0)
- *pend = end;
- /* According to the DCS2 specification, the size of the composite
- * section can be determined by the smallest #offset.
- * Some incorrect DCS2 files don't put the separations inside
- * the DOS EPS PostScript section, and have a TIFF separation
- * between the composite and the first separation. This
- * contravenes the DCS2 specification. If we see one of these
- * files, bring the end of the composite back to the end of
- * the DOS EPS PostScript section.
- */
- if (dsc->doseps_end && (*pend > dsc->doseps_end))
- *pend = dsc->doseps_end;
+ CDCS2 *pdcs = dsc->dcs2;
+ /* Now treat the initial EPS file as a single page without
+ * headers or trailer, so page extraction will fetch the
+ * the correct separation. */
+ if (dsc->page_count == 0)
+ code = dsc_add_page(dsc, 1, composite);
+ else if (dsc->page_count == 1)
+ dsc->page[0].label =
+ dsc_alloc_string(dsc, composite, (int)strlen(composite)+1);
+ if (code != CDSC_OK)
+ return code;
+ page_number = dsc->page_count - 1;
+ pbegin = &dsc->page[page_number].begin;
+ pend = &dsc->page[page_number].end;
+ if (*pbegin == *pend) {
+ /* no page, so force it to conform to the following sections */
+ *pbegin = 999999999;
+ *pend = 0;
+ }
+
+ if (dsc->begincomments != dsc->endcomments) {
+ *pbegin = min(dsc->begincomments, *pbegin);
+ dsc->begincomments = 0;
+ *pend = max(dsc->endcomments, *pend);
+ dsc->endcomments = 0;
+ }
+
+ if (dsc->beginpreview != dsc->endpreview) {
+ *pbegin = min(dsc->beginpreview, *pbegin);
+ dsc->beginpreview = 0;
+ *pend = max(dsc->endpreview, *pend);
+ dsc->endpreview = 0;
+ }
+
+ if (dsc->begindefaults != dsc->enddefaults) {
+ *pbegin = min(dsc->begindefaults, *pbegin);
+ dsc->begindefaults = 0;
+ *pend = max(dsc->enddefaults, *pend);
+ dsc->enddefaults = 0;
+ }
+
+ if (dsc->beginprolog != dsc->endprolog) {
+ *pbegin = min(dsc->beginprolog, *pbegin);
+ dsc->beginprolog = 0;
+ *pend = max(dsc->endprolog, *pend);
+ dsc->endprolog = 0;
+ }
+
+ if (dsc->beginsetup != dsc->endsetup) {
+ *pbegin = min(dsc->beginsetup, *pbegin);
+ dsc->beginsetup = 0;
+ *pend = max(dsc->endsetup, *pend);
+ dsc->endsetup = 0;
+ }
+
+ if (dsc->begintrailer != dsc->endtrailer) {
+ *pbegin = min(dsc->begintrailer, *pbegin);
+ dsc->begintrailer = 0;
+ *pend = max(dsc->endtrailer, *pend);
+ dsc->endtrailer = 0;
+ }
+
+ if (*pbegin == 999999999)
+ *pbegin = *pend;
+ end = 0; /* end of composite is start of first separation */
+
+ while (pdcs) {
+ page_number = dsc->page_count;
+ if ((pdcs->begin) && (pdcs->colourname != NULL)) {
+ /* Single file DCS 2.0 */
+ code = dsc_add_page(dsc, page_number+1, pdcs->colourname);
+ if (code)
+ return code;
+ dsc->page[page_number].begin = pdcs->begin;
+ dsc->page[page_number].end = pdcs->end;
+ if (end != 0)
+ end = min(end, pdcs->begin);
+ else
+ end = pdcs->begin; /* first separation */
+ }
+ else {
+ /* Multiple file DCS 2.0 */
+ if ((pdcs->location != NULL) &&
+ (pdcs->filetype != NULL) &&
+ (pdcs->colourname != NULL) &&
+ (dsc_stricmp(pdcs->location, "Local") == 0) &&
+ ((dsc_stricmp(pdcs->filetype, "EPS") == 0) ||
+ (dsc_stricmp(pdcs->filetype, "EPSF") == 0))) {
+ code = dsc_add_page(dsc, page_number+1, pdcs->colourname);
+ if (code)
+ return code;
+ dsc->page[page_number].begin = 0;
+ dsc->page[page_number].end = 0;
+ }
+ }
+ pdcs = pdcs->next;
+ }
+ /* end of composite is start of first separation */
+ if (end != 0)
+ *pend = end;
+ /* According to the DCS2 specification, the size of the composite
+ * section can be determined by the smallest #offset.
+ * Some incorrect DCS2 files don't put the separations inside
+ * the DOS EPS PostScript section, and have a TIFF separation
+ * between the composite and the first separation. This
+ * contravenes the DCS2 specification. If we see one of these
+ * files, bring the end of the composite back to the end of
+ * the DOS EPS PostScript section.
+ */
+ if (dsc->doseps_end && (*pend > dsc->doseps_end))
+ *pend = dsc->doseps_end;
}
return 0;
}
-
static int
dsc_parse_platefile(CDSC *dsc)
{
@@ -3953,11 +3923,11 @@ dsc_parse_platefile(CDSC *dsc)
GSBOOL blank_line;
GSBOOL single = FALSE;
if (IS_DSC(dsc->line, "%%PlateFile:"))
- n = 12;
+ n = 12;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
memset(&dcs2, 0, sizeof(dcs2));
memset(&colourname, 0, sizeof(colourname));
@@ -3968,78 +3938,78 @@ dsc_parse_platefile(CDSC *dsc)
/* check for blank remainder of line */
blank_line = TRUE;
for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
}
if (!blank_line) {
- dsc_copy_string(colourname, sizeof(colourname),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- dsc_copy_string(filetype, sizeof(filetype),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- while (IS_WHITE_OR_EOL(dsc->line[n]))
- n++;
- if (dsc->line[n] == '#') {
- /* single file DCS 2.0 */
- single = TRUE;
- n++;
- if (i)
- dcs2.begin= dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i)
- dcs2.end= dcs2.begin +
- dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
- }
- else {
- /* multiple file DCS 2.0 */
- if (i)
- dsc_copy_string(location, sizeof(location),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i) {
- filename = dsc->line+n;
- filename_length = dsc->line_length-n;
- }
- }
- if (i==0)
- dsc_unknown(dsc); /* we didn't get all fields */
- else {
- /* Allocate strings */
- if (strlen(colourname))
- dcs2.colourname = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- if (strlen(filetype))
- dcs2.filetype = dsc_alloc_string(dsc,
- filetype, (int)strlen(filetype));
- if (strlen(location))
- dcs2.location = dsc_alloc_string(dsc,
- location, (int)strlen(location));
- if (filename)
- dcs2.filename = dsc_add_line(dsc, filename, filename_length);
-
- /* Prevent parser from reading separations */
- if (single)
- dsc->file_length = min(dsc->file_length, dcs2.begin);
- /* Allocate it */
- pdcs2 = (CDCS2 *)dsc_memalloc(dsc, sizeof(CDCS2));
- if (pdcs2 == NULL)
- return CDSC_ERROR; /* out of memory */
- memcpy(pdcs2, &dcs2, sizeof(CDCS2));
- /* Then add to list of separations */
- if (dsc->dcs2 == NULL)
- dsc->dcs2 = pdcs2;
- else {
- CDCS2 *this_dcs2 = dsc->dcs2;
- while (this_dcs2->next)
- this_dcs2 = this_dcs2->next;
- this_dcs2->next = pdcs2;
- }
- }
+ dsc_copy_string(colourname, sizeof(colourname),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ dsc_copy_string(filetype, sizeof(filetype),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ while (IS_WHITE_OR_EOL(dsc->line[n]))
+ n++;
+ if (dsc->line[n] == '#') {
+ /* single file DCS 2.0 */
+ single = TRUE;
+ n++;
+ if (i)
+ dcs2.begin= dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i)
+ dcs2.end= dcs2.begin +
+ dsc_get_int(dsc->line+n, dsc->line_length-n, &i);
+ }
+ else {
+ /* multiple file DCS 2.0 */
+ if (i)
+ dsc_copy_string(location, sizeof(location),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i) {
+ filename = dsc->line+n;
+ filename_length = dsc->line_length-n;
+ }
+ }
+ if (i==0)
+ dsc_unknown(dsc); /* we didn't get all fields */
+ else {
+ /* Allocate strings */
+ if (strlen(colourname))
+ dcs2.colourname = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ if (strlen(filetype))
+ dcs2.filetype = dsc_alloc_string(dsc,
+ filetype, (int)strlen(filetype));
+ if (strlen(location))
+ dcs2.location = dsc_alloc_string(dsc,
+ location, (int)strlen(location));
+ if (filename)
+ dcs2.filename = dsc_add_line(dsc, filename, filename_length);
+
+ /* Prevent parser from reading separations */
+ if (single)
+ dsc->file_length = min(dsc->file_length, dcs2.begin);
+ /* Allocate it */
+ pdcs2 = (CDCS2 *)dsc_memalloc(dsc, sizeof(CDCS2));
+ if (pdcs2 == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memcpy(pdcs2, &dcs2, sizeof(CDCS2));
+ /* Then add to list of separations */
+ if (dsc->dcs2 == NULL)
+ dsc->dcs2 = pdcs2;
+ else {
+ CDCS2 *this_dcs2 = dsc->dcs2;
+ while (this_dcs2->next)
+ this_dcs2 = this_dcs2->next;
+ this_dcs2->next = pdcs2;
+ }
+ }
}
return CDSC_OK;
}
@@ -4061,77 +4031,76 @@ dsc_parse_dcs1plate(CDSC *dsc)
memset(&filename, 0, sizeof(filename));
if (IS_DSC(line, "%%+")) {
- n = 3;
- line = dsc->last_line;
- continued = TRUE;
+ n = 3;
+ line = dsc->last_line;
+ continued = TRUE;
}
if (IS_DSC(line, "%%CyanPlate:")) {
- colourname = "Cyan";
- if (!continued)
- n = 12;
+ colourname = "Cyan";
+ if (!continued)
+ n = 12;
}
else if (IS_DSC(line, "%%MagentaPlate:")) {
- colourname = "Magenta";
- if (!continued)
- n = 15;
+ colourname = "Magenta";
+ if (!continued)
+ n = 15;
}
else if (IS_DSC(line, "%%YellowPlate:")) {
- colourname = "Yellow";
- if (!continued)
- n = 14;
+ colourname = "Yellow";
+ if (!continued)
+ n = 14;
}
else if (IS_DSC(line, "%%BlackPlate:")) {
- colourname = "Black";
- if (!continued)
- n = 13;
+ colourname = "Black";
+ if (!continued)
+ n = 13;
}
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
/* check for blank remainder of line */
blank_line = TRUE;
for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
}
if (!blank_line) {
- dsc_copy_string(filename, sizeof(filename),
- dsc->line+n, dsc->line_length-n, &i);
- if (i==0)
- dsc_unknown(dsc); /* we didn't get all fields */
- else {
- /* Allocate strings */
- dcs2.colourname = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- dcs2.filetype = dsc_alloc_string(dsc, "EPS", 3);
- dcs2.location = dsc_alloc_string(dsc, "Local", 5);
- if (strlen(filename))
- dcs2.filename = dsc_alloc_string(dsc,
- filename, (int)strlen(filename));
- /* Allocate it */
- pdcs2 = (CDCS2 *)dsc_memalloc(dsc, sizeof(CDCS2));
- if (pdcs2 == NULL)
- return CDSC_ERROR; /* out of memory */
- memcpy(pdcs2, &dcs2, sizeof(CDCS2));
- /* Then add to list of separations */
- if (dsc->dcs2 == NULL)
- dsc->dcs2 = pdcs2;
- else {
- CDCS2 *this_dcs2 = dsc->dcs2;
- while (this_dcs2->next)
- this_dcs2 = this_dcs2->next;
- this_dcs2->next = pdcs2;
- }
- }
+ dsc_copy_string(filename, sizeof(filename),
+ dsc->line+n, dsc->line_length-n, &i);
+ if (i==0)
+ dsc_unknown(dsc); /* we didn't get all fields */
+ else {
+ /* Allocate strings */
+ dcs2.colourname = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ dcs2.filetype = dsc_alloc_string(dsc, "EPS", 3);
+ dcs2.location = dsc_alloc_string(dsc, "Local", 5);
+ if (strlen(filename))
+ dcs2.filename = dsc_alloc_string(dsc,
+ filename, (int)strlen(filename));
+ /* Allocate it */
+ pdcs2 = (CDCS2 *)dsc_memalloc(dsc, sizeof(CDCS2));
+ if (pdcs2 == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memcpy(pdcs2, &dcs2, sizeof(CDCS2));
+ /* Then add to list of separations */
+ if (dsc->dcs2 == NULL)
+ dsc->dcs2 = pdcs2;
+ else {
+ CDCS2 *this_dcs2 = dsc->dcs2;
+ while (this_dcs2->next)
+ this_dcs2 = this_dcs2->next;
+ this_dcs2->next = pdcs2;
+ }
+ }
}
return CDSC_OK;
}
-
/* Find the filename which corresponds to this separation.
* Used with multiple file DCS 2.0.
* Returns NULL if there is no filename, or not DCS 2.0,
@@ -4144,30 +4113,29 @@ dsc_find_platefile(CDSC *dsc, int page)
CDCS2 *pdcs = dsc->dcs2;
int i = 1;
while (pdcs) {
- if (pdcs->begin != pdcs->end)
- return NULL; /* Single file DCS 2.0 */
- if (pdcs->location && pdcs->filetype && pdcs->colourname
- && (dsc_stricmp(pdcs->location, "Local") == 0)
- && ((dsc_stricmp(pdcs->filetype, "EPS") == 0) ||
- (dsc_stricmp(pdcs->filetype, "EPSF") == 0))) {
- if (i == page)
- return pdcs->filename;
- i++;
- }
- pdcs = pdcs->next;
+ if (pdcs->begin != pdcs->end)
+ return NULL; /* Single file DCS 2.0 */
+ if (pdcs->location && pdcs->filetype && pdcs->colourname
+ && (dsc_stricmp(pdcs->location, "Local") == 0)
+ && ((dsc_stricmp(pdcs->filetype, "EPS") == 0) ||
+ (dsc_stricmp(pdcs->filetype, "EPSF") == 0))) {
+ if (i == page)
+ return pdcs->filename;
+ i++;
+ }
+ pdcs = pdcs->next;
}
return NULL;
}
-
static CDSCCOLOUR *
dsc_find_colour(CDSC *dsc, const char *colourname)
{
CDSCCOLOUR *colour = dsc->colours;
while (colour) {
- if (colour->name && (dsc_stricmp(colour->name, colourname)==0))
- return colour;
- colour = colour->next;
+ if (colour->name && (dsc_stricmp(colour->name, colourname)==0))
+ return colour;
+ colour = colour->next;
}
return 0;
}
@@ -4180,95 +4148,95 @@ dsc_parse_process_colours(CDSC *dsc)
char colourname[MAXSTR];
GSBOOL blank_line;
if (IS_DSC(dsc->line, "%%DocumentProcessColors:"))
- n = 24;
+ n = 24;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
memset(&colourname, 0, sizeof(colourname));
/* check for blank remainder of line */
blank_line = TRUE;
for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
}
while (IS_WHITE(dsc->line[n]))
- n++;
+ n++;
if (COMPARE(dsc->line+n, "(atend)")) {
- if (dsc->scan_section == scan_comments)
- blank_line = TRUE;
- else {
- dsc_unknown(dsc);
- return CDSC_NOTDSC;
- }
+ if (dsc->scan_section == scan_comments)
+ blank_line = TRUE;
+ else {
+ dsc_unknown(dsc);
+ return CDSC_NOTDSC;
+ }
}
if (!blank_line) {
- do {
- dsc_copy_string(colourname, sizeof(colourname),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i && strlen(colourname)) {
- if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
- pcolour = (CDSCCOLOUR *)
- dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
- if (pcolour == NULL)
- return CDSC_ERROR; /* out of memory */
- memset(pcolour, 0, sizeof(CDSCCOLOUR));
- pcolour->custom = CDSC_CUSTOM_COLOUR_UNKNOWN;
- pcolour->name = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- if (dsc->colours == NULL)
- dsc->colours = pcolour;
- else {
- CDSCCOLOUR *this_colour = dsc->colours;
- while (this_colour->next)
- this_colour = this_colour->next;
- this_colour->next = pcolour;
- }
- }
- pcolour->type = CDSC_COLOUR_PROCESS;
- if (dsc_stricmp(colourname, "Cyan")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
- pcolour->cyan = 1.0;
- pcolour->magenta = pcolour->yellow = pcolour->black = 0.0;
- }
- else if (dsc_stricmp(colourname, "Magenta")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
- pcolour->magenta = 1.0;
- pcolour->cyan = pcolour->yellow = pcolour->black = 0.0;
- }
- else if (dsc_stricmp(colourname, "Yellow")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
- pcolour->yellow = 1.0;
- pcolour->cyan = pcolour->magenta = pcolour->black = 0.0;
- }
- else if (dsc_stricmp(colourname, "Black")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
- pcolour->black = 1.0;
- pcolour->cyan = pcolour->magenta = pcolour->yellow = 0.0;
- }
- else if (dsc_stricmp(colourname, "Red")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
- pcolour->red = 1.0;
- pcolour->green = pcolour->blue = 0.0;
- }
- else if (dsc_stricmp(colourname, "Green")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
- pcolour->green = 1.0;
- pcolour->red = pcolour->blue = 0.0;
- }
- else if (dsc_stricmp(colourname, "Blue")==0) {
- pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
- pcolour->blue = 1.0;
- pcolour->red = pcolour->green = 0.0;
- }
- }
- } while (i != 0);
+ do {
+ dsc_copy_string(colourname, sizeof(colourname),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i && strlen(colourname)) {
+ if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
+ pcolour = (CDSCCOLOUR *)
+ dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
+ if (pcolour == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memset(pcolour, 0, sizeof(CDSCCOLOUR));
+ pcolour->custom = CDSC_CUSTOM_COLOUR_UNKNOWN;
+ pcolour->name = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ if (dsc->colours == NULL)
+ dsc->colours = pcolour;
+ else {
+ CDSCCOLOUR *this_colour = dsc->colours;
+ while (this_colour->next)
+ this_colour = this_colour->next;
+ this_colour->next = pcolour;
+ }
+ }
+ pcolour->type = CDSC_COLOUR_PROCESS;
+ if (dsc_stricmp(colourname, "Cyan")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
+ pcolour->cyan = 1.0;
+ pcolour->magenta = pcolour->yellow = pcolour->black = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Magenta")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
+ pcolour->magenta = 1.0;
+ pcolour->cyan = pcolour->yellow = pcolour->black = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Yellow")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
+ pcolour->yellow = 1.0;
+ pcolour->cyan = pcolour->magenta = pcolour->black = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Black")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
+ pcolour->black = 1.0;
+ pcolour->cyan = pcolour->magenta = pcolour->yellow = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Red")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
+ pcolour->red = 1.0;
+ pcolour->green = pcolour->blue = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Green")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
+ pcolour->green = 1.0;
+ pcolour->red = pcolour->blue = 0.0;
+ }
+ else if (dsc_stricmp(colourname, "Blue")==0) {
+ pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
+ pcolour->blue = 1.0;
+ pcolour->red = pcolour->green = 0.0;
+ }
+ }
+ } while (i != 0);
}
return CDSC_OK;
}
@@ -4281,65 +4249,64 @@ dsc_parse_custom_colours(CDSC *dsc)
char colourname[MAXSTR];
GSBOOL blank_line;
if (IS_DSC(dsc->line, "%%DocumentCustomColors:"))
- n = 23;
+ n = 23;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
memset(&colourname, 0, sizeof(colourname));
/* check for blank remainder of line */
blank_line = TRUE;
for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
}
while (IS_WHITE(dsc->line[n]))
- n++;
+ n++;
if (COMPARE(dsc->line+n, "(atend)")) {
- if (dsc->scan_section == scan_comments)
- blank_line = TRUE;
- else {
- dsc_unknown(dsc);
- return CDSC_NOTDSC;
- }
+ if (dsc->scan_section == scan_comments)
+ blank_line = TRUE;
+ else {
+ dsc_unknown(dsc);
+ return CDSC_NOTDSC;
+ }
}
if (!blank_line) {
- do {
- dsc_copy_string(colourname, sizeof(colourname),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i && strlen(colourname)) {
- if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
- pcolour = (CDSCCOLOUR *)
- dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
- if (pcolour == NULL)
- return CDSC_ERROR; /* out of memory */
- memset(pcolour, 0, sizeof(CDSCCOLOUR));
- pcolour->name = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- pcolour->custom = CDSC_CUSTOM_COLOUR_UNKNOWN;
- if (dsc->colours == NULL)
- dsc->colours = pcolour;
- else {
- CDSCCOLOUR *this_colour = dsc->colours;
- while (this_colour->next)
- this_colour = this_colour->next;
- this_colour->next = pcolour;
- }
- }
+ do {
+ dsc_copy_string(colourname, sizeof(colourname),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i && strlen(colourname)) {
+ if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
+ pcolour = (CDSCCOLOUR *)
+ dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
+ if (pcolour == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memset(pcolour, 0, sizeof(CDSCCOLOUR));
+ pcolour->name = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ pcolour->custom = CDSC_CUSTOM_COLOUR_UNKNOWN;
+ if (dsc->colours == NULL)
+ dsc->colours = pcolour;
+ else {
+ CDSCCOLOUR *this_colour = dsc->colours;
+ while (this_colour->next)
+ this_colour = this_colour->next;
+ this_colour->next = pcolour;
+ }
+ }
pcolour->type = CDSC_COLOUR_CUSTOM;
- }
- } while (i != 0);
+ }
+ } while (i != 0);
}
return CDSC_OK;
}
-
static int
dsc_parse_cmyk_custom_colour(CDSC *dsc)
{
@@ -4349,69 +4316,69 @@ dsc_parse_cmyk_custom_colour(CDSC *dsc)
float cyan, magenta, yellow, black;
GSBOOL blank_line;
if (IS_DSC(dsc->line, "%%CMYKCustomColor:"))
- n = 18;
+ n = 18;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
memset(&colourname, 0, sizeof(colourname));
/* check for blank remainder of line */
do {
- blank_line = TRUE;
- for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
- }
- if (blank_line)
- break;
- else {
- cyan = magenta = yellow = black = 0.0;
- cyan = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- magenta = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- yellow = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- black = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- dsc_copy_string(colourname, sizeof(colourname),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i && strlen(colourname)) {
- if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
- pcolour = (CDSCCOLOUR *)
- dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
- if (pcolour == NULL)
- return CDSC_ERROR; /* out of memory */
- memset(pcolour, 0, sizeof(CDSCCOLOUR));
- pcolour->name = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- pcolour->type = CDSC_COLOUR_UNKNOWN;
- if (dsc->colours == NULL)
- dsc->colours = pcolour;
- else {
- CDSCCOLOUR *this_colour = dsc->colours;
- while (this_colour->next)
- this_colour = this_colour->next;
- this_colour->next = pcolour;
- }
- }
- pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
- pcolour->cyan = cyan;
- pcolour->magenta = magenta;
- pcolour->yellow = yellow;
- pcolour->black = black;
- }
- }
+ blank_line = TRUE;
+ for (i=n; i<dsc->line_length; i++) {
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
+ }
+ if (blank_line)
+ break;
+ else {
+ cyan = magenta = yellow = black = 0.0;
+ cyan = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ magenta = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ yellow = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ black = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ dsc_copy_string(colourname, sizeof(colourname),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i && strlen(colourname)) {
+ if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
+ pcolour = (CDSCCOLOUR *)
+ dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
+ if (pcolour == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memset(pcolour, 0, sizeof(CDSCCOLOUR));
+ pcolour->name = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ pcolour->type = CDSC_COLOUR_UNKNOWN;
+ if (dsc->colours == NULL)
+ dsc->colours = pcolour;
+ else {
+ CDSCCOLOUR *this_colour = dsc->colours;
+ while (this_colour->next)
+ this_colour = this_colour->next;
+ this_colour->next = pcolour;
+ }
+ }
+ pcolour->custom = CDSC_CUSTOM_COLOUR_CMYK;
+ pcolour->cyan = cyan;
+ pcolour->magenta = magenta;
+ pcolour->yellow = yellow;
+ pcolour->black = black;
+ }
+ }
} while (i != 0);
return CDSC_OK;
}
@@ -4425,65 +4392,65 @@ dsc_parse_rgb_custom_colour(CDSC *dsc)
float red, green, blue;
GSBOOL blank_line;
if (IS_DSC(dsc->line, "%%RGBCustomColor:"))
- n = 17;
+ n = 17;
else if (IS_DSC(dsc->line, "%%+"))
- n = 3;
+ n = 3;
else
- return CDSC_ERROR; /* error */
+ return CDSC_ERROR; /* error */
memset(&colourname, 0, sizeof(colourname));
/* check for blank remainder of line */
do {
- blank_line = TRUE;
- for (i=n; i<dsc->line_length; i++) {
- if (!IS_WHITE_OR_EOL(dsc->line[i])) {
- blank_line = FALSE;
- break;
- }
- }
- if (blank_line)
- break;
- else {
- red = green = blue = 0.0;
- red = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- green = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- blue = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
- n += i;
- if (i)
- dsc_copy_string(colourname, sizeof(colourname),
- dsc->line+n, dsc->line_length-n, &i);
- n+=i;
- if (i && strlen(colourname)) {
- if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
- pcolour = (CDSCCOLOUR *)
- dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
- if (pcolour == NULL)
- return CDSC_ERROR; /* out of memory */
- memset(pcolour, 0, sizeof(CDSCCOLOUR));
- pcolour->name = dsc_alloc_string(dsc,
- colourname, (int)strlen(colourname));
- pcolour->type = CDSC_COLOUR_UNKNOWN;
- if (dsc->colours == NULL)
- dsc->colours = pcolour;
- else {
- CDSCCOLOUR *this_colour = dsc->colours;
- while (this_colour->next)
- this_colour = this_colour->next;
- this_colour->next = pcolour;
- }
- }
- pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
- pcolour->red = red;
- pcolour->green = green;
- pcolour->blue = blue;
- }
- }
+ blank_line = TRUE;
+ for (i=n; i<dsc->line_length; i++) {
+ if (!IS_WHITE_OR_EOL(dsc->line[i])) {
+ blank_line = FALSE;
+ break;
+ }
+ }
+ if (blank_line)
+ break;
+ else {
+ red = green = blue = 0.0;
+ red = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ green = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ blue = dsc_get_real(dsc->line+n, dsc->line_length-n, &i);
+ n += i;
+ if (i)
+ dsc_copy_string(colourname, sizeof(colourname),
+ dsc->line+n, dsc->line_length-n, &i);
+ n+=i;
+ if (i && strlen(colourname)) {
+ if ((pcolour = dsc_find_colour(dsc, colourname)) == NULL) {
+ pcolour = (CDSCCOLOUR *)
+ dsc_memalloc(dsc, sizeof(CDSCCOLOUR));
+ if (pcolour == NULL)
+ return CDSC_ERROR; /* out of memory */
+ memset(pcolour, 0, sizeof(CDSCCOLOUR));
+ pcolour->name = dsc_alloc_string(dsc,
+ colourname, (int)strlen(colourname));
+ pcolour->type = CDSC_COLOUR_UNKNOWN;
+ if (dsc->colours == NULL)
+ dsc->colours = pcolour;
+ else {
+ CDSCCOLOUR *this_colour = dsc->colours;
+ while (this_colour->next)
+ this_colour = this_colour->next;
+ this_colour->next = pcolour;
+ }
+ }
+ pcolour->custom = CDSC_CUSTOM_COLOUR_RGB;
+ pcolour->red = red;
+ pcolour->green = green;
+ pcolour->blue = blue;
+ }
+ }
} while (i != 0);
return CDSC_OK;
}
diff --git a/gs/psi/dscparse.h b/gs/psi/dscparse.h
index 9e7c6298e..2afc7b31c 100644
--- a/gs/psi/dscparse.h
+++ b/gs/psi/dscparse.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@ typedef unsigned int GSWORD; /* must be at least 16 bits */
/* DSC_OFFSET is an unsigned integer which holds the offset
* from the start of a file to a particular DSC comment,
* or the length of a file.
- * Normally it is "unsigned long" which is commonly 32 bits.
+ * Normally it is "unsigned long" which is commonly 32 bits.
* Change it if you need to handle larger files.
*/
#ifndef DSC_OFFSET
@@ -54,7 +54,7 @@ typedef unsigned int GSWORD; /* must be at least 16 bits */
#define CDSC_STRING_CHUNK 4096
/* page array is allocated in chunks of this many pages */
-#define CDSC_PAGE_CHUNK 128
+#define CDSC_PAGE_CHUNK 128
/* buffer length for storing lines passed to dsc_scan_data() */
/* must be at least 2 * DSC_LINE_LENGTH */
@@ -158,7 +158,7 @@ typedef enum CDSC_RETURN_CODE_e {
/* Trailer section */
CDSC_TRAILER = 800, /* %%Trailer */
-/* also %%Pages, %%BoundingBox, %%Orientation, %%PageOrder, %%DocumentMedia */
+/* also %%Pages, %%BoundingBox, %%Orientation, %%PageOrder, %%DocumentMedia */
/* %%Page is recognised as an error */
/* also %%DocumentNeededFonts, %%DocumentSuppliedFonts */
@@ -166,8 +166,7 @@ typedef enum CDSC_RETURN_CODE_e {
CDSC_EOF = 900 /* %%EOF */
} CDSC_RETURN_CODE;
-
-/* stored in dsc->preview */
+/* stored in dsc->preview */
typedef enum CDSC_PREVIEW_TYPE_e {
CDSC_NOPREVIEW = 0,
CDSC_EPSI = 1,
@@ -176,7 +175,7 @@ typedef enum CDSC_PREVIEW_TYPE_e {
CDSC_PICT = 4
} CDSC_PREVIEW_TYPE;
-/* stored in dsc->page_order */
+/* stored in dsc->page_order */
typedef enum CDSC_PAGE_ORDER_e {
CDSC_ORDER_UNKNOWN = 0,
CDSC_ASCEND = 1,
@@ -184,7 +183,7 @@ typedef enum CDSC_PAGE_ORDER_e {
CDSC_SPECIAL = 3
} CDSC_PAGE_ORDER;
-/* stored in dsc->page_orientation and dsc->page[pagenum-1].orientation */
+/* stored in dsc->page_orientation and dsc->page[pagenum-1].orientation */
typedef enum CDSC_ORIENTATION_ENUM_e {
CDSC_ORIENT_UNKNOWN = 0,
CDSC_PORTRAIT = 1,
@@ -380,7 +379,7 @@ char dummy[1024];
char *dsc_version; /* first line of file */
unsigned int language_level;
unsigned int document_data; /* Clean7Bit, Clean8Bit, Binary */
- /* enum CDSC_DOCUMENT_DATA */
+ /* enum CDSC_DOCUMENT_DATA */
/* DSC sections */
DSC_OFFSET begincomments;
DSC_OFFSET endcomments;
@@ -399,7 +398,7 @@ char dummy[1024];
unsigned int page_pages; /* number of pages in document from %%Pages: */
unsigned int page_order; /* enum CDSC_PAGE_ORDER */
unsigned int page_orientation; /* the default page orientation */
- /* enum CDSC_ORIENTATION */
+ /* enum CDSC_ORIENTATION */
CDSCCTM *viewing_orientation;
unsigned int media_count; /* number of media items */
CDSCMEDIA **media; /* the array of media */
@@ -415,26 +414,25 @@ char dummy[1024];
unsigned int max_error; /* highest error number that will be reported */
const int *severity; /* array of severity values, one per error */
-
/* private data */
void *caller_data; /* pointer to be provided when calling */
- /* error and debug callbacks */
+ /* error and debug callbacks */
int id; /* last DSC comment found */
int scan_section; /* section currently being scanned */
- /* enum CDSC_SECTION */
+ /* enum CDSC_SECTION */
DSC_OFFSET doseps_end; /* ps_begin+ps_length, otherwise 0 */
unsigned int page_chunk_length; /* number of pages allocated */
DSC_OFFSET file_length; /* length of document */
- /* If provided we try to recognise %%Trailer and %%EOF */
- /* incorrectly embedded inside document. */
- /* We will not parse DSC comments beyond this point. */
- /* Can be left set to default value of 0 */
+ /* If provided we try to recognise %%Trailer and %%EOF */
+ /* incorrectly embedded inside document. */
+ /* We will not parse DSC comments beyond this point. */
+ /* Can be left set to default value of 0 */
int skip_document; /* recursion level of %%BeginDocument: */
int skip_bytes; /* #bytes to ignore from BeginData: */
- /* or DOSEPS preview section */
+ /* or DOSEPS preview section */
int skip_lines; /* #lines to ignore from BeginData: */
- GSBOOL skip_pjl; /* TRUE if skip PJL until first PS comment */
+ GSBOOL skip_pjl; /* TRUE if skip PJL until first PS comment */
int begin_font_count; /* recursion level of %%BeginFont */
int begin_feature_count; /* recursion level of %%BeginFeature */
int begin_resource_count; /* recursion level of %%BeginResource */
@@ -445,16 +443,16 @@ char dummy[1024];
unsigned int data_length; /* length of data in buffer */
unsigned int data_index; /* offset to next char in buffer */
DSC_OFFSET data_offset; /* offset from start of document */
- /* to byte in data[0] */
+ /* to byte in data[0] */
GSBOOL eof; /* TRUE if there is no more data */
/* information about DSC line */
char *line; /* pointer to last read DSC line */
- /* not null terminated */
+ /* not null terminated */
unsigned int line_length; /* number of characters in line */
GSBOOL eol; /* TRUE if dsc_line contains EOL */
GSBOOL last_cr; /* TRUE if last line ended in \r */
- /* check next time for \n */
+ /* check next time for \n */
unsigned int line_count; /* line number */
GSBOOL long_line; /* TRUE if found a line longer than 255 characters */
char last_line[256]; /* previous DSC line, used for %%+ */
@@ -472,8 +470,8 @@ char dummy[1024];
void (*debug_print_fn)(void *caller_data, const char *str);
/* function for reporting errors in DSC comments */
- int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
- unsigned int explanation, const char *line, unsigned int line_len);
+ int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
+ unsigned int explanation, const char *line, unsigned int line_len);
/* public data */
/* Added 2001-10-01 */
@@ -491,7 +489,6 @@ char dummy[1024];
CDSCMACBIN *macbin; /* Mac Binary header */
};
-
/* Public functions */
/* Create and initialise DSC parser */
@@ -526,13 +523,13 @@ int dsc_scan_data(CDSC *dsc, const char *data, int len);
int dsc_fixup(CDSC *dsc);
/* Install error query function */
-void dsc_set_error_function(CDSC *dsc,
- int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
- unsigned int explanation, const char *line, unsigned int line_len));
+void dsc_set_error_function(CDSC *dsc,
+ int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
+ unsigned int explanation, const char *line, unsigned int line_len));
/* Install print function for debug messages */
-void dsc_set_debug_function(CDSC *dsc,
- void (*debug_fn)(void *caller_data, const char *str));
+void dsc_set_debug_function(CDSC *dsc,
+ void (*debug_fn)(void *caller_data, const char *str));
/* Print a message to debug output, if provided */
void dsc_debug_print(CDSC *dsc, const char *str);
@@ -543,12 +540,12 @@ const char * dsc_find_platefile(CDSC *dsc, int page);
/* Compare two strings, case insensitive */
int dsc_stricmp(const char *s, const char *t);
-/* should be internal only functions, but made available to
+/* should be internal only functions, but made available to
* GSview for handling PDF
*/
int dsc_add_page(CDSC *dsc, int ordinal, char *label);
int dsc_add_media(CDSC *dsc, CDSCMEDIA *media);
-int dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
+int dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
int llx, int lly, int urx, int ury);
/* in dscutil.c */
diff --git a/gs/psi/dstack.h b/gs/psi/dstack.h
index 3e5b9136b..ae95c4db4 100644
--- a/gs/psi/dstack.h
+++ b/gs/psi/dstack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -77,35 +77,35 @@ We mark heavily used operations with a * below; moderately heavily used
operations with a +.
The following operations look up keys on the dictionary stack:
- *(interpreter name lookup)
- load
- where
+ *(interpreter name lookup)
+ load
+ where
The following operations change the contents of dictionaries:
- *def, +put
- undef
- restore
- (grow)
+ *def, +put
+ undef
+ restore
+ (grow)
We implement store in PostScript, and copy as a series of puts. Many
other operators also do puts (e.g., ScaleMatrix in makefont,
Implementation in makepattern, ...). Note that put can do an implicit
.setmaxlength (if it has to grow the dictionary).
The following operations change the dictionary stack:
- +begin, +end
- +?(context switch)
- readonly (on a dictionary that is on the stack)
- noaccess (on a dictionary that is on the stack)
+ +begin, +end
+ +?(context switch)
+ readonly (on a dictionary that is on the stack)
+ noaccess (on a dictionary that is on the stack)
We implement cleardictstack as a series of ends.
Current design
==============
Each name N has a pointer N.V that has one of 3 states:
- - This name has no definitions.
- - This name has exactly one definition, in systemdict or userdict.
- In this case, N.V points to the value slot.
- - This name has some other status.
+ - This name has no definitions.
+ - This name has exactly one definition, in systemdict or userdict.
+ In this case, N.V points to the value slot.
+ - This name has some other status.
We cache some pointers to the top dictionary on the stack if it is a
readable dictionary with packed keys, which allows us to do fast,
@@ -124,21 +124,21 @@ associate:
* A name lookup cache, C. Each entry C[i] in the cache consists of:
- A key, K (a name index).
+ A key, K (a name index).
- A dictionary stack level (depth), L. C[i] is valid iff the
- current dictionary stack depth, |dstack|, is equal to L.
- (L is always less than or equal to |dstack|.)
+ A dictionary stack level (depth), L. C[i] is valid iff the
+ current dictionary stack depth, |dstack|, is equal to L.
+ (L is always less than or equal to |dstack|.)
- A value pointer, V, which points to some value slot of some
- dictionary on the stack.
+ A value pointer, V, which points to some value slot of some
+ dictionary on the stack.
* A lookup cache restoration stack, R. Each entry R[j] on this stack
consists of:
- An index i in C.
+ An index i in C.
- The previous (K,D,V) of C[i].
+ The previous (K,D,V) of C[i].
C needs to be large enough to satisfy the overwhelming majority of name
lookups with only 1-3 probes. In a single-context system, C can be large
@@ -146,12 +146,12 @@ lookups with only 1-3 probes. In a single-context system, C can be large
in a typical run with no reprobes). In a multiple-context system, one can
choose a variety of different strategies for managing C, such as:
- A single cache that is cleared on every context switch;
+ A single cache that is cleared on every context switch;
- A small cache (e.g., .5K entries) for each context;
+ A small cache (e.g., .5K entries) for each context;
- A cache that starts out small and grows adaptively if the hit rate
- is too low.
+ A cache that starts out small and grows adaptively if the hit rate
+ is too low.
R needs to be able to grow dynamically; in the worst case, it may have |C|
entries per level of the dictionary stack. We assume that R will always be
@@ -187,15 +187,15 @@ Now we describe the implementation of each of the above operations.
To look up a name with index N, compute a hash index 0 <= i < |C|. There
are three cases:
- 1. C[i].K == N and C[i].L == |dstack|. Nothing more is needed:
- C[i].V points to the N's value.
+ 1. C[i].K == N and C[i].L == |dstack|. Nothing more is needed:
+ C[i].V points to the N's value.
- 2. C[i].K == N but C[i].L < |dstack|. Look up N in the top |dstack|
- - L entries on the dictionary stack; push i and C[i] onto R; set
- C[i].V to point to the value if found, and in any case set C[i].L =
- |dstack|.
+ 2. C[i].K == N but C[i].L < |dstack|. Look up N in the top |dstack|
+ - L entries on the dictionary stack; push i and C[i] onto R; set
+ C[i].V to point to the value if found, and in any case set C[i].L =
+ |dstack|.
- 3. C[i].K != N. Reprobe some small number of times.
+ 3. C[i].K != N. Reprobe some small number of times.
If all reprobes fail, look up N on the (full) dictionary stack. Pick an
index i (one of the probed entries) in C to replace. If C[i].L != |dstack|,
diff --git a/gs/psi/dwdll.c b/gs/psi/dwdll.c
index c7e28cd66..6eea33eba 100644
--- a/gs/psi/dwdll.c
+++ b/gs/psi/dwdll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,23 +46,23 @@ gsapi_revision_t rv;
/* Don't load if already loaded */
if (gsdll->hmodule)
- return 0;
+ return 0;
/* First try to load DLL from the same directory as EXE */
GetModuleFileName(GetModuleHandle(NULL), fullname, sizeof(fullname));
if ((p = strrchr(fullname,'\\')) != (char *)NULL)
- p++;
+ p++;
else
- p = fullname;
+ p = fullname;
*p = '\0';
strcat(fullname, name);
gsdll->hmodule = LoadLibrary(fullname);
/* Next try to load DLL with name in registry or environment variable */
if (gsdll->hmodule < (HINSTANCE)HINSTANCE_ERROR) {
- length = sizeof(fullname);
- if (gp_getenv("GS_DLL", fullname, &length) == 0)
- gsdll->hmodule = LoadLibrary(fullname);
+ length = sizeof(fullname);
+ if (gp_getenv("GS_DLL", fullname, &length) == 0)
+ gsdll->hmodule = LoadLibrary(fullname);
}
/* Finally try the system search path */
@@ -70,108 +70,108 @@ gsapi_revision_t rv;
gsdll->hmodule = LoadLibrary(name);
if (gsdll->hmodule < (HINSTANCE)HINSTANCE_ERROR) {
- /* Failed */
- DWORD err = GetLastError();
- sprintf(fullname, "Can't load DLL, LoadLibrary error code %ld", err);
- strncpy(last_error, fullname, len-1);
- gsdll->hmodule = (HINSTANCE)0;
- return 1;
+ /* Failed */
+ DWORD err = GetLastError();
+ sprintf(fullname, "Can't load DLL, LoadLibrary error code %ld", err);
+ strncpy(last_error, fullname, len-1);
+ gsdll->hmodule = (HINSTANCE)0;
+ return 1;
}
/* DLL is now loaded */
/* Get pointers to functions */
- gsdll->revision = (PFN_gsapi_revision) GetProcAddress(gsdll->hmodule,
- "gsapi_revision");
+ gsdll->revision = (PFN_gsapi_revision) GetProcAddress(gsdll->hmodule,
+ "gsapi_revision");
if (gsdll->revision == NULL) {
- strncpy(last_error, "Can't find gsapi_revision\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_revision\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
/* check DLL version */
if (gsdll->revision(&rv, sizeof(rv)) != 0) {
- sprintf(fullname, "Unable to identify Ghostscript DLL revision - it must be newer than needed.\n");
- strncpy(last_error, fullname, len-1);
- unload_dll(gsdll);
- return 1;
+ sprintf(fullname, "Unable to identify Ghostscript DLL revision - it must be newer than needed.\n");
+ strncpy(last_error, fullname, len-1);
+ unload_dll(gsdll);
+ return 1;
}
if (rv.revision != GSREVISION) {
- sprintf(fullname, "Wrong version of DLL found.\n Found version %ld\n Need version %ld\n", rv.revision, GSREVISION);
- strncpy(last_error, fullname, len-1);
- unload_dll(gsdll);
- return 1;
+ sprintf(fullname, "Wrong version of DLL found.\n Found version %ld\n Need version %ld\n", rv.revision, GSREVISION);
+ strncpy(last_error, fullname, len-1);
+ unload_dll(gsdll);
+ return 1;
}
/* continue loading other functions */
- gsdll->new_instance = (PFN_gsapi_new_instance) GetProcAddress(gsdll->hmodule,
- "gsapi_new_instance");
+ gsdll->new_instance = (PFN_gsapi_new_instance) GetProcAddress(gsdll->hmodule,
+ "gsapi_new_instance");
if (gsdll->new_instance == NULL) {
- strncpy(last_error, "Can't find gsapi_new_instance\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_new_instance\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->delete_instance = (PFN_gsapi_delete_instance) GetProcAddress(gsdll->hmodule,
- "gsapi_delete_instance");
+ gsdll->delete_instance = (PFN_gsapi_delete_instance) GetProcAddress(gsdll->hmodule,
+ "gsapi_delete_instance");
if (gsdll->delete_instance == NULL) {
- strncpy(last_error, "Can't find gsapi_delete_instance\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_delete_instance\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->set_stdio = (PFN_gsapi_set_stdio) GetProcAddress(gsdll->hmodule,
- "gsapi_set_stdio");
+ gsdll->set_stdio = (PFN_gsapi_set_stdio) GetProcAddress(gsdll->hmodule,
+ "gsapi_set_stdio");
if (gsdll->set_stdio == NULL) {
- strncpy(last_error, "Can't find gsapi_set_stdio\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_set_stdio\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->set_poll = (PFN_gsapi_set_poll) GetProcAddress(gsdll->hmodule,
- "gsapi_set_poll");
+ gsdll->set_poll = (PFN_gsapi_set_poll) GetProcAddress(gsdll->hmodule,
+ "gsapi_set_poll");
if (gsdll->set_poll == NULL) {
- strncpy(last_error, "Can't find gsapi_set_poll\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_set_poll\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->set_display_callback = (PFN_gsapi_set_display_callback)
- GetProcAddress(gsdll->hmodule, "gsapi_set_display_callback");
+ gsdll->set_display_callback = (PFN_gsapi_set_display_callback)
+ GetProcAddress(gsdll->hmodule, "gsapi_set_display_callback");
if (gsdll->set_display_callback == NULL) {
- strncpy(last_error, "Can't find gsapi_set_display_callback\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_set_display_callback\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->init_with_args = (PFN_gsapi_init_with_args)
- GetProcAddress(gsdll->hmodule, "gsapi_init_with_args");
+ gsdll->init_with_args = (PFN_gsapi_init_with_args)
+ GetProcAddress(gsdll->hmodule, "gsapi_init_with_args");
if (gsdll->init_with_args == NULL) {
- strncpy(last_error, "Can't find gsapi_init_with_args\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_init_with_args\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->run_string = (PFN_gsapi_run_string) GetProcAddress(gsdll->hmodule,
- "gsapi_run_string");
+ gsdll->run_string = (PFN_gsapi_run_string) GetProcAddress(gsdll->hmodule,
+ "gsapi_run_string");
if (gsdll->run_string == NULL) {
- strncpy(last_error, "Can't find gsapi_run_string\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_run_string\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->exit = (PFN_gsapi_exit) GetProcAddress(gsdll->hmodule,
- "gsapi_exit");
+ gsdll->exit = (PFN_gsapi_exit) GetProcAddress(gsdll->hmodule,
+ "gsapi_exit");
if (gsdll->exit == NULL) {
- strncpy(last_error, "Can't find gsapi_exit\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_exit\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
- gsdll->set_visual_tracer = (PFN_gsapi_set_visual_tracer)
+ gsdll->set_visual_tracer = (PFN_gsapi_set_visual_tracer)
GetProcAddress(gsdll->hmodule, "gsapi_set_visual_tracer");
if (gsdll->set_visual_tracer == NULL) {
- strncpy(last_error, "Can't find gsapi_set_visual_tracer\n", len-1);
- unload_dll(gsdll);
- return 1;
+ strncpy(last_error, "Can't find gsapi_set_visual_tracer\n", len-1);
+ unload_dll(gsdll);
+ return 1;
}
return 0;
@@ -192,8 +192,6 @@ void unload_dll(GSDLL *gsdll)
gsdll->set_visual_tracer = NULL;
if (gsdll->hmodule != (HINSTANCE)NULL)
- FreeLibrary(gsdll->hmodule);
+ FreeLibrary(gsdll->hmodule);
gsdll->hmodule = NULL;
}
-
-
diff --git a/gs/psi/dwdll.h b/gs/psi/dwdll.h
index c2058a81d..1b49b8cdb 100644
--- a/gs/psi/dwdll.h
+++ b/gs/psi/dwdll.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,22 +25,22 @@
#include "iapi.h"
typedef struct GSDLL_S {
- HINSTANCE hmodule; /* DLL module handle */
- PFN_gsapi_revision revision;
- PFN_gsapi_new_instance new_instance;
- PFN_gsapi_delete_instance delete_instance;
- PFN_gsapi_set_stdio set_stdio;
- PFN_gsapi_set_poll set_poll;
- PFN_gsapi_set_display_callback set_display_callback;
- PFN_gsapi_init_with_args init_with_args;
- PFN_gsapi_run_string run_string;
- PFN_gsapi_exit exit;
+ HINSTANCE hmodule; /* DLL module handle */
+ PFN_gsapi_revision revision;
+ PFN_gsapi_new_instance new_instance;
+ PFN_gsapi_delete_instance delete_instance;
+ PFN_gsapi_set_stdio set_stdio;
+ PFN_gsapi_set_poll set_poll;
+ PFN_gsapi_set_display_callback set_display_callback;
+ PFN_gsapi_init_with_args init_with_args;
+ PFN_gsapi_run_string run_string;
+ PFN_gsapi_exit exit;
PFN_gsapi_set_visual_tracer set_visual_tracer;
} GSDLL;
/* Load the Ghostscript DLL.
* Return 0 on success.
- * Return non-zero on error and store error message
+ * Return non-zero on error and store error message
* to last_error of length len
*/
int load_dll(GSDLL *gsdll, char *last_error, int len);
diff --git a/gs/psi/dwimg.c b/gs/psi/dwimg.c
index 1705c6c64..608625c9b 100644
--- a/gs/psi/dwimg.c
+++ b/gs/psi/dwimg.c
@@ -41,7 +41,6 @@
#include "dwreg.h"
#include "gdevdsp.h"
-
static const char szImgName2[] = "Ghostscript Image";
static const char szTrcName2[] = "Ghostscript Graphical Trace";
@@ -70,7 +69,6 @@ static void create_window(IMAGE *img);
# define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
-
/* GUI thread only */
void image_color(unsigned int format, int index,
unsigned char *r, unsigned char *g, unsigned char *b);
@@ -90,14 +88,13 @@ void image_32CMYK_to_24BGR(int width, unsigned char *dest,
void image_devicen_to_24BGR(int width, unsigned char *dest,
unsigned char *source, IMAGE_DEVICEN *devicen, int devicen_gray);
-
/****************************************************************/
/* These functions are only accessed by the main thread */
IMAGE *first_image = NULL;
static HWND img_hwndtext = (HWND)0;
-void
+void
image_textwindow(HWND hwnd)
{
/* Save the handle to the text window in a global variable
@@ -115,8 +112,8 @@ image_find(void *handle, void *device)
{
IMAGE *img;
for (img = first_image; img!=0; img=img->next) {
- if ((img->handle == handle) && (img->device == device))
- return img;
+ if ((img->handle == handle) && (img->device == device))
+ return img;
}
return NULL;
}
@@ -129,20 +126,20 @@ image_new(void *handle, void *device)
IMAGE *img = (IMAGE *)malloc(sizeof(IMAGE));
if (img) {
memset(img, 0, sizeof(IMAGE));
- /* remember device and handle */
- img->handle = handle;
- img->device = device;
- img->hwndtext = img_hwndtext;
+ /* remember device and handle */
+ img->handle = handle;
+ img->device = device;
+ img->hwndtext = img_hwndtext;
- img->update_tick = 100; /* milliseconds */
- img->update_interval = 1; /* 1 tick */
- img->update_count = 0;
+ img->update_tick = 100; /* milliseconds */
+ img->update_interval = 1; /* 1 tick */
+ img->update_count = 0;
img->hmutex = INVALID_HANDLE_VALUE;
- /* add to list */
- img->next = first_image;
- first_image = img;
+ /* add to list */
+ img->next = first_image;
+ first_image = img;
}
return img;
}
@@ -154,19 +151,18 @@ image_delete(IMAGE *img)
{
/* remove from list */
if (img == first_image) {
- first_image = img->next;
+ first_image = img->next;
}
else {
- IMAGE *tmp;
- for (tmp = first_image; tmp!=0; tmp=tmp->next) {
- if (img == tmp->next)
- tmp->next = img->next;
- }
+ IMAGE *tmp;
+ for (tmp = first_image; tmp!=0; tmp=tmp->next) {
+ if (img == tmp->next)
+ tmp->next = img->next;
+ }
}
/* Note: img is freed by image_close, not image_delete */
}
-
/* resize image */
/* valid for main thread */
int
@@ -186,134 +182,134 @@ image_size(IMAGE *img, int new_width, int new_height, int new_raster,
/* Reset separations */
for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- img->devicen[i].used = 0;
- img->devicen[i].visible = 1;
- memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
- img->devicen[i].cyan = 0;
- img->devicen[i].magenta = 0;
- img->devicen[i].yellow = 0;
- img->devicen[i].black = 0;
+ img->devicen[i].used = 0;
+ img->devicen[i].visible = 1;
+ memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
+ img->devicen[i].cyan = 0;
+ img->devicen[i].magenta = 0;
+ img->devicen[i].yellow = 0;
+ img->devicen[i].black = 0;
}
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- img->bmih.biBitCount = 1;
- img->bmih.biClrUsed = 2;
- img->bmih.biClrImportant = 2;
- break;
- case DISPLAY_DEPTH_4:
- /* Fixed color palette */
- img->bmih.biBitCount = 4;
- img->bmih.biClrUsed = 16;
- img->bmih.biClrImportant = 16;
- break;
- case DISPLAY_DEPTH_8:
- /* Fixed color palette */
- img->bmih.biBitCount = 8;
- img->bmih.biClrUsed = 96;
- img->bmih.biClrImportant = 96;
- break;
- case DISPLAY_DEPTH_16:
- /* RGB bitfields */
- /* Bit fields */
- if ((img->format & DISPLAY_ENDIAN_MASK)
- == DISPLAY_BIGENDIAN) {
- /* convert to 24BGR */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- else {
- img->bmih.biBitCount = 16;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- break;
- default:
- return DISPLAY_ERROR;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- img->bmih.biBitCount = 1;
- img->bmih.biClrUsed = 2;
- img->bmih.biClrImportant = 2;
- break;
- case DISPLAY_DEPTH_4:
- /* Fixed gray palette */
- img->bmih.biBitCount = 4;
- img->bmih.biClrUsed = 16;
- img->bmih.biClrImportant = 16;
- break;
- case DISPLAY_DEPTH_8:
- /* Fixed gray palette */
- img->bmih.biBitCount = 8;
- img->bmih.biClrUsed = 256;
- img->bmih.biClrImportant = 256;
- break;
- default:
- return DISPLAY_ERROR;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return DISPLAY_ERROR;
- if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN)) {
- /* use bitfields to display this */
- img->bmih.biBitCount = 32;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- else {
- /* either native BGR, or we need to convert it */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- break;
- case DISPLAY_COLORS_CMYK:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_8:
- /* we can convert these formats */
- break;
- default:
- return DISPLAY_ERROR;
- }
- /* we can't display this natively */
- /* we will convert it just before displaying */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- img->devicen[0].used = 1;
- img->devicen[0].cyan = 65535;
- /* We already know about the CMYK components */
- strncpy(img->devicen[0].name, "Cyan",
- sizeof(img->devicen[0].name));
- img->devicen[1].used = 1;
- img->devicen[1].magenta = 65535;
- strncpy(img->devicen[1].name, "Magenta",
- sizeof(img->devicen[1].name));
- img->devicen[2].used = 1;
- img->devicen[2].yellow = 65535;
- strncpy(img->devicen[2].name, "Yellow",
- sizeof(img->devicen[2].name));
- img->devicen[3].used = 1;
- img->devicen[3].black = 65535;
- strncpy(img->devicen[3].name, "Black",
- sizeof(img->devicen[3].name));
- break;
- case DISPLAY_COLORS_SEPARATION:
- /* we can't display this natively */
- /* we will convert it just before displaying */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ img->bmih.biBitCount = 1;
+ img->bmih.biClrUsed = 2;
+ img->bmih.biClrImportant = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ /* Fixed color palette */
+ img->bmih.biBitCount = 4;
+ img->bmih.biClrUsed = 16;
+ img->bmih.biClrImportant = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ /* Fixed color palette */
+ img->bmih.biBitCount = 8;
+ img->bmih.biClrUsed = 96;
+ img->bmih.biClrImportant = 96;
+ break;
+ case DISPLAY_DEPTH_16:
+ /* RGB bitfields */
+ /* Bit fields */
+ if ((img->format & DISPLAY_ENDIAN_MASK)
+ == DISPLAY_BIGENDIAN) {
+ /* convert to 24BGR */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ else {
+ img->bmih.biBitCount = 16;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ img->bmih.biBitCount = 1;
+ img->bmih.biClrUsed = 2;
+ img->bmih.biClrImportant = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ /* Fixed gray palette */
+ img->bmih.biBitCount = 4;
+ img->bmih.biClrUsed = 16;
+ img->bmih.biClrImportant = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ /* Fixed gray palette */
+ img->bmih.biBitCount = 8;
+ img->bmih.biClrUsed = 256;
+ img->bmih.biClrImportant = 256;
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return DISPLAY_ERROR;
+ if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN)) {
+ /* use bitfields to display this */
+ img->bmih.biBitCount = 32;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ else {
+ /* either native BGR, or we need to convert it */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ break;
+ case DISPLAY_COLORS_CMYK:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_8:
+ /* we can convert these formats */
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ /* we can't display this natively */
+ /* we will convert it just before displaying */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ img->devicen[0].used = 1;
+ img->devicen[0].cyan = 65535;
+ /* We already know about the CMYK components */
+ strncpy(img->devicen[0].name, "Cyan",
+ sizeof(img->devicen[0].name));
+ img->devicen[1].used = 1;
+ img->devicen[1].magenta = 65535;
+ strncpy(img->devicen[1].name, "Magenta",
+ sizeof(img->devicen[1].name));
+ img->devicen[2].used = 1;
+ img->devicen[2].yellow = 65535;
+ strncpy(img->devicen[2].name, "Yellow",
+ sizeof(img->devicen[2].name));
+ img->devicen[3].used = 1;
+ img->devicen[3].black = 65535;
+ strncpy(img->devicen[3].name, "Black",
+ sizeof(img->devicen[3].name));
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ /* we can't display this natively */
+ /* we will convert it just before displaying */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ break;
}
img->bmih.biCompression = 0;
@@ -323,7 +319,7 @@ image_size(IMAGE *img, int new_width, int new_height, int new_raster,
img->bytewidth = ((img->bmih.biWidth * img->bmih.biBitCount + 31 ) & ~31) >> 3;
if (img->palette)
- DeleteObject(img->palette);
+ DeleteObject(img->palette);
img->palette = create_palette(img);
return 0;
@@ -336,10 +332,10 @@ image_separation(IMAGE *img,
unsigned short y, unsigned short k)
{
if ((comp_num < 0) || (comp_num > IMAGE_DEVICEN_MAX))
- return DISPLAY_ERROR;
+ return DISPLAY_ERROR;
img->devicen[comp_num].used = 1;
strncpy(img->devicen[comp_num].name, name,
- sizeof(img->devicen[comp_num].name)-1);
+ sizeof(img->devicen[comp_num].name)-1);
img->devicen[comp_num].cyan = c;
img->devicen[comp_num].magenta = m;
img->devicen[comp_num].yellow = y;
@@ -347,7 +343,6 @@ image_separation(IMAGE *img,
return 0;
}
-
/****************************************************************/
/* These functions are only accessed by the GUI thread */
@@ -370,17 +365,16 @@ image_close(IMAGE *img)
img->hwnd = NULL;
if (img->palette)
- DeleteObject(img->palette);
+ DeleteObject(img->palette);
img->palette = NULL;
if (img->hBrush)
- DeleteObject(img->hBrush);
+ DeleteObject(img->hBrush);
img->hBrush = NULL;
free(img);
}
-
void
register_class(void)
{
@@ -410,36 +404,36 @@ void image_separations(IMAGE *img)
HMENU sysmenu = GetSystemMenu(img->hwnd, FALSE);
if (((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_CMYK) ||
((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION)) {
- /* Add menus if needed */
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- exist = 0;
- if (img->devicen[i].menu)
- exist = GetMenuString(sysmenu, M_SEPARATION+i,
- buf, sizeof(buf)-1, MF_BYCOMMAND) != 0;
- if (exist && (strcmp(img->devicen[i].name, buf) != 0)) {
- /* remove it because name changed */
- RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
- img->devicen[i].menu = 0;
- }
- if (img->devicen[i].name[0] && !img->devicen[i].menu) {
- AppendMenu(sysmenu, MF_STRING | MF_CHECKED,
- M_SEPARATION+i, img->devicen[i].name);
- img->devicen[i].menu = 1;
- }
- if (img->devicen[i].used && img->devicen[i].visible)
- num_visible++;
- }
- EnableMenuItem(sysmenu, M_DEVICEN_GRAY,
- MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
+ /* Add menus if needed */
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ exist = 0;
+ if (img->devicen[i].menu)
+ exist = GetMenuString(sysmenu, M_SEPARATION+i,
+ buf, sizeof(buf)-1, MF_BYCOMMAND) != 0;
+ if (exist && (strcmp(img->devicen[i].name, buf) != 0)) {
+ /* remove it because name changed */
+ RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
+ img->devicen[i].menu = 0;
+ }
+ if (img->devicen[i].name[0] && !img->devicen[i].menu) {
+ AppendMenu(sysmenu, MF_STRING | MF_CHECKED,
+ M_SEPARATION+i, img->devicen[i].name);
+ img->devicen[i].menu = 1;
+ }
+ if (img->devicen[i].used && img->devicen[i].visible)
+ num_visible++;
+ }
+ EnableMenuItem(sysmenu, M_DEVICEN_GRAY,
+ MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
}
else {
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- if (img->devicen[i].menu) {
- RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
- img->devicen[i].menu = 0;
- }
- }
- EnableMenuItem(sysmenu, M_DEVICEN_GRAY, MF_BYCOMMAND | MF_GRAYED);
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ if (img->devicen[i].menu) {
+ RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
+ img->devicen[i].menu = 0;
+ }
+ }
+ EnableMenuItem(sysmenu, M_DEVICEN_GRAY, MF_BYCOMMAND | MF_GRAYED);
}
}
@@ -449,18 +443,17 @@ void sep_menu(IMAGE *img, int component)
int num_visible = 0;
img->devicen[component].visible = !img->devicen[component].visible;
CheckMenuItem(GetSystemMenu(img->hwnd, FALSE),
- M_SEPARATION+component,
- (img->devicen[component].visible ? MF_CHECKED : MF_UNCHECKED));
+ M_SEPARATION+component,
+ (img->devicen[component].visible ? MF_CHECKED : MF_UNCHECKED));
for (i=0; i<IMAGE_DEVICEN_MAX; i++)
if (img->devicen[i].used && img->devicen[i].visible)
- num_visible++;
+ num_visible++;
EnableMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
- MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
+ MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
InvalidateRect(img->hwnd, NULL, 0);
UpdateWindow(img->hwnd);
}
-
static void
create_window(IMAGE *img)
{
@@ -475,11 +468,11 @@ create_window(IMAGE *img)
lb.lbHatch = 0;
lb.lbColor = GetSysColor(COLOR_WINDOW);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = GetSysColor(COLOR_MENU);
+ lb.lbColor = GetSysColor(COLOR_MENU);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = GetSysColor(COLOR_APPWORKSPACE);
+ lb.lbColor = GetSysColor(COLOR_APPWORKSPACE);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = RGB(192,192,192);
+ lb.lbColor = RGB(192,192,192);
img->hBrush = CreateBrushIndirect(&lb);
img->cxClient = img->cyClient = 0;
@@ -487,55 +480,55 @@ create_window(IMAGE *img)
img->nHscrollPos = img->nHscrollMax = 0;
img->x = img->y = img->cx = img->cy = CW_USEDEFAULT;
if (win_get_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf, &len) == 0) {
- int x, y, cx, cy;
-
- if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4) {
- img->x = x;
- img->y = y;
- img->cx = cx;
- img->cy = cy;
- }
+ int x, y, cx, cy;
+
+ if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4) {
+ img->x = x;
+ img->y = y;
+ img->cx = cx;
+ img->cy = cy;
+ }
}
strcpy(window_title, (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2));
{ /*
* This section is for debug purpose only.
- * It allows to replace window title so that user can identify window
- * when multiple instances of the application run in same time.
- * Create gs\bin\gswin32.ini or gs\bin\gswin32c.ini and
- * (for 64-bit: gs\bin\gswin64.ini or gs\bin\gswin64c.ini)
- * put an identifier to there like this :
- *
- * [Window]
- * Title=Current Revision
- *
- * It is useful to compare images generated with different revisions.
- */
+ * It allows to replace window title so that user can identify window
+ * when multiple instances of the application run in same time.
+ * Create gs\bin\gswin32.ini or gs\bin\gswin32c.ini and
+ * (for 64-bit: gs\bin\gswin64.ini or gs\bin\gswin64c.ini)
+ * put an identifier to there like this :
+ *
+ * [Window]
+ * Title=Current Revision
+ *
+ * It is useful to compare images generated with different revisions.
+ */
char ini_path[MAX_PATH];
- DWORD ini_path_length;
-
- ini_path_length = GetModuleFileName(NULL, ini_path, sizeof(ini_path));
- if (ini_path_length > 0) {
- int i = ini_path_length - 1;
- for (; i>=0; i--)
- if(ini_path[i] == '.')
- break;
- if (i < sizeof(ini_path) - 4) {
- strcpy(ini_path + i, ".ini");
- GetPrivateProfileString("Window", "Title",
- (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2),
- window_title, sizeof(window_title), ini_path);
- }
- }
+ DWORD ini_path_length;
+
+ ini_path_length = GetModuleFileName(NULL, ini_path, sizeof(ini_path));
+ if (ini_path_length > 0) {
+ int i = ini_path_length - 1;
+ for (; i>=0; i--)
+ if(ini_path[i] == '.')
+ break;
+ if (i < sizeof(ini_path) - 4) {
+ strcpy(ini_path + i, ".ini");
+ GetPrivateProfileString("Window", "Title",
+ (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2),
+ window_title, sizeof(window_title), ini_path);
+ }
+ }
}
/* create window */
img->hwnd = CreateWindow(szImgName2, window_title,
- WS_OVERLAPPEDWINDOW,
- img->x, img->y, img->cx, img->cy,
- NULL, NULL, GetModuleHandle(NULL), (void *)img);
+ WS_OVERLAPPEDWINDOW,
+ img->x, img->y, img->cx, img->cy,
+ NULL, NULL, GetModuleHandle(NULL), (void *)img);
if (img->device == NULL && img->x != CW_USEDEFAULT &&
- img->y != CW_USEDEFAULT &&
- img->cx != CW_USEDEFAULT &&
- img->cy != CW_USEDEFAULT)
+ img->y != CW_USEDEFAULT &&
+ img->cx != CW_USEDEFAULT &&
+ img->cy != CW_USEDEFAULT)
MoveWindow(img->hwnd, img->x, img->y, img->cx, img->cy, FALSE);
ShowWindow(img->hwnd, (img->device != NULL ? SW_SHOWMINNOACTIVE : SW_SHOW));
@@ -549,17 +542,16 @@ create_window(IMAGE *img)
image_separations(img);
}
-
void
image_poll(IMAGE *img)
{
if ((img->bmih.biWidth == 0) || (img->bmih.biHeight == 0))
- return;
+ return;
img->pending_update = 1;
if (img->update_timer == 0) {
- img->update_timer = 1;
- img->update_count = 0;
- SetTimer(img->hwnd, img->update_timer, img->update_tick, NULL);
+ img->update_timer = 1;
+ img->update_count = 0;
+ SetTimer(img->hwnd, img->update_timer, img->update_tick, NULL);
}
}
@@ -571,37 +563,36 @@ image_update_now(IMAGE *img)
SYSTEMTIME t2;
int delta;
if ( !IsWindow(img->hwnd) ) /* some clod closed the window */
- create_window(img);
+ create_window(img);
if ( !IsIconic(img->hwnd) ) { /* redraw window */
- GetSystemTime(&t1);
- InvalidateRect(img->hwnd, NULL, 1);
- UpdateWindow(img->hwnd);
- GetSystemTime(&t2);
- /* Make sure the update interval is at least 10 times
- * what it takes to paint the window
- */
- delta = (t2.wSecond - t1.wSecond)*1000 +
- (t2.wMilliseconds - t1.wMilliseconds);
- if (delta < 0)
- delta += 60000;
- delta = 10 * delta / img->update_tick + 1;
- if (delta > img->update_interval)
- img->update_interval = delta;
- else if ((delta >= 2) &&
- (delta < img->update_interval / 4))
- img->update_interval = delta/2;
+ GetSystemTime(&t1);
+ InvalidateRect(img->hwnd, NULL, 1);
+ UpdateWindow(img->hwnd);
+ GetSystemTime(&t2);
+ /* Make sure the update interval is at least 10 times
+ * what it takes to paint the window
+ */
+ delta = (t2.wSecond - t1.wSecond)*1000 +
+ (t2.wMilliseconds - t1.wMilliseconds);
+ if (delta < 0)
+ delta += 60000;
+ delta = 10 * delta / img->update_tick + 1;
+ if (delta > img->update_interval)
+ img->update_interval = delta;
+ else if ((delta >= 2) &&
+ (delta < img->update_interval / 4))
+ img->update_interval = delta/2;
}
img->update_count = 0;
}
-
void
image_sync(IMAGE *img)
{
if (img->update_timer) {
- /* stop timer when nothing is happening */
- KillTimer(img->hwnd, img->update_timer);
+ /* stop timer when nothing is happening */
+ KillTimer(img->hwnd, img->update_timer);
img->update_timer = 0;
}
img->pending_sync = 0;
@@ -610,18 +601,16 @@ image_sync(IMAGE *img)
img->pending_update = 0;
}
-
void
image_page(IMAGE *img)
{
if (IsIconic(img->hwnd)) /* useless as an Icon so fix it */
- ShowWindow(img->hwnd, SW_SHOWNORMAL);
+ ShowWindow(img->hwnd, SW_SHOWNORMAL);
BringWindowToTop(img->hwnd);
image_sync(img);
}
-
/* GUI thread */
void
image_updatesize(IMAGE *img)
@@ -631,13 +620,13 @@ image_updatesize(IMAGE *img)
image_separations(img);
/* update scroll bars */
if (!IsIconic(img->hwnd)) {
- if (IsZoomed(img->hwnd))
- nSizeType = SIZE_MAXIMIZED;
- else
- nSizeType = SIZE_RESTORED;
- GetClientRect(img->hwnd, &rect);
- SendMessage(img->hwnd, WM_SIZE, nSizeType,
- MAKELONG(rect.right, rect.bottom));
+ if (IsZoomed(img->hwnd))
+ nSizeType = SIZE_MAXIMIZED;
+ else
+ nSizeType = SIZE_RESTORED;
+ GetClientRect(img->hwnd, &rect);
+ SendMessage(img->hwnd, WM_SIZE, nSizeType,
+ MAKELONG(rect.right, rect.bottom));
}
}
@@ -646,56 +635,55 @@ image_color(unsigned int format, int index,
unsigned char *r, unsigned char *g, unsigned char *b)
{
switch (format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 0 : 255);
- break;
- case DISPLAY_DEPTH_4:
- if (index == 7)
- *r = *g = *b = 170;
- else if (index == 8)
- *r = *g = *b = 85;
- else {
- int one = index & 8 ? 255 : 128;
- *r = (index & 4 ? one : 0);
- *g = (index & 2 ? one : 0);
- *b = (index & 1 ? one : 0);
- }
- break;
- case DISPLAY_DEPTH_8:
- /* palette of 96 colors */
- /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
- if (index < 64) {
- int one = 255 / 3;
- *r = ((index & 0x30) >> 4) * one;
- *g = ((index & 0x0c) >> 2) * one;
- *b = (index & 0x03) * one;
- }
- else {
- int val = index & 0x1f;
- *r = *g = *b = (val << 3) + (val >> 2);
- }
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 255 : 0);
- break;
- case DISPLAY_DEPTH_4:
- *r = *g = *b = (unsigned char)((index<<4) + index);
- break;
- case DISPLAY_DEPTH_8:
- *r = *g = *b = (unsigned char)index;
- break;
- }
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 0 : 255);
+ break;
+ case DISPLAY_DEPTH_4:
+ if (index == 7)
+ *r = *g = *b = 170;
+ else if (index == 8)
+ *r = *g = *b = 85;
+ else {
+ int one = index & 8 ? 255 : 128;
+ *r = (index & 4 ? one : 0);
+ *g = (index & 2 ? one : 0);
+ *b = (index & 1 ? one : 0);
+ }
+ break;
+ case DISPLAY_DEPTH_8:
+ /* palette of 96 colors */
+ /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
+ if (index < 64) {
+ int one = 255 / 3;
+ *r = ((index & 0x30) >> 4) * one;
+ *g = ((index & 0x0c) >> 2) * one;
+ *b = (index & 0x03) * one;
+ }
+ else {
+ int val = index & 0x1f;
+ *r = *g = *b = (val << 3) + (val >> 2);
+ }
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 255 : 0);
+ break;
+ case DISPLAY_DEPTH_4:
+ *r = *g = *b = (unsigned char)((index<<4) + index);
+ break;
+ case DISPLAY_DEPTH_8:
+ *r = *g = *b = (unsigned char)index;
+ break;
+ }
+ break;
}
}
-
/* convert one line of 16BGR555 to 24BGR */
/* byte0=GGGBBBBB byte1=0RRRRRGG */
void
@@ -705,14 +693,14 @@ image_16BGR555_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = source[0] + (source[1] << 8);
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 10) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = source[0] + (source[1] << 8);
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 10) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -725,14 +713,14 @@ image_16BGR565_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = source[0] + (source[1] << 8);
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *dest++ = (value << 2) + (value >> 4);
- value = (w >> 11) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = source[0] + (source[1] << 8);
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *dest++ = (value << 2) + (value >> 4);
+ value = (w >> 11) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -745,14 +733,14 @@ image_16RGB555_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = (source[0] << 8) + source[1];
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 10) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = (source[0] << 8) + source[1];
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 10) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -765,14 +753,14 @@ image_16RGB565_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = (source[0] << 8) + source[1];
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *dest++ = (value << 2) + (value >> 4);
- value = (w >> 11) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = (source[0] << 8) + source[1];
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *dest++ = (value << 2) + (value >> 4);
+ value = (w >> 11) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -791,29 +779,29 @@ image_4CMYK_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int value;
for (i=0; i<width; i++) {
value = source[i/2];
- if (i & 0)
- value >>= 4;
- cyan = ((value >> 3) & 1) * 255;
- magenta = ((value >> 2) & 1) * 255;
- yellow = ((value >> 1) & 1) * 255;
- black = (value & 1) * 255;
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ if (i & 0)
+ value >>= 4;
+ cyan = ((value >> 3) & 1) * 255;
+ magenta = ((value >> 2) & 1) * 255;
+ yellow = ((value >> 1) & 1) * 255;
+ black = (value & 1) * 255;
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
}
}
@@ -831,28 +819,28 @@ image_32CMYK_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int vall = vc && vm && vy && vk;
int show_gray = (vc + vm + vy + vk == 1) && devicen_gray;
for (i=0; i<width; i++) {
- cyan = source[0];
- magenta = source[1];
- yellow = source[2];
- black = source[3];
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
- source += 4;
+ cyan = source[0];
+ magenta = source[1];
+ yellow = source[2];
+ black = source[3];
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ source += 4;
}
}
@@ -867,42 +855,42 @@ image_devicen_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int num_visible = 0;
int show_gray = 0;
for (j=0; j<IMAGE_DEVICEN_MAX; j++) {
- if (devicen[j].used) {
- num_comp = j+1;
- if (devicen[j].visible)
- num_visible++;
- }
+ if (devicen[j].used) {
+ num_comp = j+1;
+ if (devicen[j].visible)
+ num_visible++;
+ }
}
if ((num_visible == 1) && devicen_gray)
- show_gray = 1;
+ show_gray = 1;
for (i=0; i<width; i++) {
- cyan = magenta = yellow = black = 0;
- for (j=0; j<num_comp; j++) {
- if (devicen[j].visible && devicen[j].used) {
- value = source[j];
- if (show_gray)
- black += value;
- else {
- cyan += value * devicen[j].cyan / 65535;
- magenta += value * devicen[j].magenta / 65535;
- yellow += value * devicen[j].yellow / 65535;
- black += value * devicen[j].black / 65535;
- }
- }
- }
- if (cyan > 255)
- cyan = 255;
- if (magenta > 255)
- magenta = 255;
- if (yellow > 255)
- yellow = 255;
- if (black > 255)
- black = 255;
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
- source += 8;
+ cyan = magenta = yellow = black = 0;
+ for (j=0; j<num_comp; j++) {
+ if (devicen[j].visible && devicen[j].used) {
+ value = source[j];
+ if (show_gray)
+ black += value;
+ else {
+ cyan += value * devicen[j].cyan / 65535;
+ magenta += value * devicen[j].magenta / 65535;
+ yellow += value * devicen[j].yellow / 65535;
+ black += value * devicen[j].black / 65535;
+ }
+ }
+ }
+ if (cyan > 255)
+ cyan = 255;
+ if (magenta > 255)
+ magenta = 255;
+ if (yellow > 255)
+ yellow = 255;
+ if (black > 255)
+ black = 255;
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ source += 8;
}
}
@@ -917,73 +905,73 @@ image_convert_line(IMAGE *img, unsigned char *dest, unsigned char *source)
int i;
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_16) {
- if (bigendian) {
- if ((img->format & DISPLAY_555_MASK)
- == DISPLAY_NATIVE_555)
- image_16RGB555_to_24BGR(img->bmih.biWidth,
- dest, source);
- else
- image_16RGB565_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- else {
- if ((img->format & DISPLAY_555_MASK)
- == DISPLAY_NATIVE_555) {
- image_16BGR555_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- else
- image_16BGR565_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- }
- break;
- case DISPLAY_COLORS_RGB:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return;
- for (i=0; i<width; i++) {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST))
- s++;
- if (bigendian) {
- *d++ = s[2];
- *d++ = s[1];
- *d++ = s[0];
- s+=3;
- }
- else {
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- }
- if ((alpha == DISPLAY_ALPHA_LAST) ||
- (alpha == DISPLAY_UNUSED_LAST))
- s++;
- }
+ case DISPLAY_COLORS_NATIVE:
+ if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_16) {
+ if (bigendian) {
+ if ((img->format & DISPLAY_555_MASK)
+ == DISPLAY_NATIVE_555)
+ image_16RGB555_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ else
+ image_16RGB565_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ else {
+ if ((img->format & DISPLAY_555_MASK)
+ == DISPLAY_NATIVE_555) {
+ image_16BGR555_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ else
+ image_16BGR565_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return;
+ for (i=0; i<width; i++) {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST))
+ s++;
+ if (bigendian) {
+ *d++ = s[2];
+ *d++ = s[1];
+ *d++ = s[0];
+ s+=3;
+ }
+ else {
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ }
+ if ((alpha == DISPLAY_ALPHA_LAST) ||
+ (alpha == DISPLAY_UNUSED_LAST))
+ s++;
+ }
/*
printf("rgb, width=%d alpha=%d d=0x%x s=0x%x\n", width, alpha, (int)d, (int)s);
printf(" d=0x%x s=0x%x\n", (int)d, (int)s);
*/
- break;
- case DISPLAY_COLORS_CMYK:
- if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
- image_32CMYK_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- else if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1) {
- image_4CMYK_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- }
- else
- return;
- break;
- case DISPLAY_COLORS_SEPARATION:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return;
- image_devicen_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- break;
+ break;
+ case DISPLAY_COLORS_CMYK:
+ if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
+ image_32CMYK_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ else if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1) {
+ image_4CMYK_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ }
+ else
+ return;
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return;
+ image_devicen_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ break;
}
}
@@ -1008,28 +996,27 @@ copy_dib(IMAGE *img)
/* Allocates memory for the clipboard bitmap */
if (img->bmih.biBitCount <= 1)
- bitsperpixel = 1;
+ bitsperpixel = 1;
else if (img->bmih.biBitCount <= 4)
- bitsperpixel = 4;
+ bitsperpixel = 4;
else if (img->bmih.biBitCount <= 8)
- bitsperpixel = 8;
+ bitsperpixel = 8;
else
- bitsperpixel = 24;
+ bitsperpixel = 24;
bytewidth = ((img->bmih.biWidth * bitsperpixel + 31 ) & ~31) >> 3;
bitmapsize = bytewidth * img->bmih.biHeight;
if (bitsperpixel > 8)
- palcount = 0; /* 24-bit BGR */
+ palcount = 0; /* 24-bit BGR */
else
- palcount = img->bmih.biClrUsed;
+ palcount = img->bmih.biClrUsed;
hglobal = GlobalAlloc(GHND | GMEM_SHARE, sizeof(BITMAPINFOHEADER)
- + sizeof(RGBQUAD) * palcount + bitmapsize);
+ + sizeof(RGBQUAD) * palcount + bitmapsize);
if (hglobal == (HGLOBAL) NULL)
- return (HGLOBAL) NULL;
+ return (HGLOBAL) NULL;
pDIB = (BYTE *) GlobalLock(hglobal);
if (pDIB == (BYTE *) NULL)
- return (HGLOBAL) NULL;
-
+ return (HGLOBAL) NULL;
/* initialize the clipboard bitmap */
pbmih = (BITMAPINFOHEADER *) (pDIB);
@@ -1048,49 +1035,49 @@ copy_dib(IMAGE *img)
pbmih->biClrImportant = palcount;
for (i = 0; i < palcount; i++) {
- image_color(img->format, i, &pColors[i].rgbRed,
- &pColors[i].rgbGreen, &pColors[i].rgbBlue);
- pColors[i].rgbReserved = 0;
+ image_color(img->format, i, &pColors[i].rgbRed,
+ &pColors[i].rgbGreen, &pColors[i].rgbBlue);
+ pColors[i].rgbReserved = 0;
}
/* find out if the format needs to be converted */
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN))
- directcopy = TRUE;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN))
+ directcopy = TRUE;
}
pLine = pBits;
if (directcopy) {
- for (i = 0; i < img->bmih.biHeight; i++) {
- memcpy(pLine, img->image + i * img->raster, bytewidth);
- pLine += bytewidth;
- }
+ for (i = 0; i < img->bmih.biHeight; i++) {
+ memcpy(pLine, img->image + i * img->raster, bytewidth);
+ pLine += bytewidth;
+ }
}
else {
- /* we need to convert the format to 24BGR */
- for (i = 0; i < img->bmih.biHeight; i++) {
- image_convert_line(img, pLine, img->image + i * img->raster);
- pLine += bytewidth;
- }
+ /* we need to convert the format to 24BGR */
+ for (i = 0; i < img->bmih.biHeight; i++) {
+ image_convert_line(img, pLine, img->image + i * img->raster);
+ pLine += bytewidth;
+ }
}
GlobalUnlock(hglobal);
@@ -1107,22 +1094,22 @@ create_palette(IMAGE *img)
nColors = img->bmih.biClrUsed;
if (nColors) {
- LPLOGPALETTE logpalette;
- logpalette = (LPLOGPALETTE) malloc(sizeof(LOGPALETTE) +
- nColors * sizeof(PALETTEENTRY));
- if (logpalette == (LPLOGPALETTE) NULL)
- return (HPALETTE)0;
- logpalette->palVersion = 0x300;
- logpalette->palNumEntries = img->bmih.biClrUsed;
- for (i = 0; i < nColors; i++) {
- logpalette->palPalEntry[i].peFlags = 0;
- image_color(img->format, i,
- &logpalette->palPalEntry[i].peRed,
- &logpalette->palPalEntry[i].peGreen,
- &logpalette->palPalEntry[i].peBlue);
- }
- palette = CreatePalette(logpalette);
- free(logpalette);
+ LPLOGPALETTE logpalette;
+ logpalette = (LPLOGPALETTE) malloc(sizeof(LOGPALETTE) +
+ nColors * sizeof(PALETTEENTRY));
+ if (logpalette == (LPLOGPALETTE) NULL)
+ return (HPALETTE)0;
+ logpalette->palVersion = 0x300;
+ logpalette->palNumEntries = img->bmih.biClrUsed;
+ for (i = 0; i < nColors; i++) {
+ logpalette->palPalEntry[i].peFlags = 0;
+ image_color(img->format, i,
+ &logpalette->palPalEntry[i].peRed,
+ &logpalette->palPalEntry[i].peGreen,
+ &logpalette->palPalEntry[i].peBlue);
+ }
+ palette = CreatePalette(logpalette);
+ free(logpalette);
}
return palette;
}
@@ -1139,361 +1126,359 @@ WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
IMAGE *img;
if (message == WM_CREATE) {
- /* Object is stored in window extra data.
- * Nothing must try to use the object before WM_CREATE
- * initializes it here.
- */
- img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams);
- SetWindowLong(hwnd, 0, (LONG)img);
+ /* Object is stored in window extra data.
+ * Nothing must try to use the object before WM_CREATE
+ * initializes it here.
+ */
+ img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams);
+ SetWindowLong(hwnd, 0, (LONG)img);
}
img = (IMAGE *)GetWindowLong(hwnd, 0);
-
switch(message) {
- case WM_SYSCOMMAND:
- /* copy to clipboard */
- if (LOWORD(wParam) == M_COPY_CLIP) {
- HGLOBAL hglobal;
- HPALETTE hpalette;
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- hglobal = copy_dib(img);
- if (hglobal == (HGLOBAL)NULL) {
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- MessageBox(hwnd, "Not enough memory to Copy to Clipboard",
- szImgName2, MB_OK | MB_ICONEXCLAMATION);
- return 0;
- }
- OpenClipboard(hwnd);
- EmptyClipboard();
- SetClipboardData(CF_DIB, hglobal);
- hpalette = create_palette(img);
- if (hpalette)
- SetClipboardData(CF_PALETTE, hpalette);
- CloseClipboard();
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- return 0;
- }
- else if ((LOWORD(wParam) >= M_SEPARATION) &&
- (LOWORD(wParam) < M_SEPARATION+IMAGE_DEVICEN_MAX)) {
- sep_menu(img, LOWORD(wParam) - M_SEPARATION);
- }
- else if (LOWORD(wParam) == M_DEVICEN_GRAY) {
- img->devicen_gray = !img->devicen_gray;
- CheckMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
- (img->devicen_gray ? MF_CHECKED : MF_UNCHECKED));
- InvalidateRect(img->hwnd, NULL, 0);
- UpdateWindow(img->hwnd);
- }
- break;
- case WM_CREATE:
- /* enable drag-drop */
- DragAcceptFiles(hwnd, TRUE);
- break;
- case WM_MOVE:
- if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
- GetWindowRect(hwnd, &rect);
- img->x = rect.left;
- img->y = rect.top;
- }
- break;
- case WM_SIZE:
- if (wParam == SIZE_MINIMIZED)
- return(0);
-
- /* remember current window size */
- if (wParam != SIZE_MAXIMIZED) {
- GetWindowRect(hwnd, &rect);
- img->cx = rect.right - rect.left;
- img->cy = rect.bottom - rect.top;
- img->x = rect.left;
- img->y = rect.top;
- }
-
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- img->cyClient = HIWORD(lParam);
- img->cxClient = LOWORD(lParam);
-
- img->cyAdjust = min(img->bmih.biHeight, img->cyClient) - img->cyClient;
- img->cyClient += img->cyAdjust;
-
- img->nVscrollMax = max(0, img->bmih.biHeight - img->cyClient);
- img->nVscrollPos = min(img->nVscrollPos, img->nVscrollMax);
-
- SetScrollRange(hwnd, SB_VERT, 0, img->nVscrollMax, FALSE);
- SetScrollPos(hwnd, SB_VERT, img->nVscrollPos, TRUE);
-
- img->cxAdjust = min(img->bmih.biWidth, img->cxClient) - img->cxClient;
- img->cxClient += img->cxAdjust;
-
- img->nHscrollMax = max(0, img->bmih.biWidth - img->cxClient);
- img->nHscrollPos = min(img->nHscrollPos, img->nHscrollMax);
-
- SetScrollRange(hwnd, SB_HORZ, 0, img->nHscrollMax, FALSE);
- SetScrollPos(hwnd, SB_HORZ, img->nHscrollPos, TRUE);
-
- if ((wParam==SIZENORMAL)
- && (img->cxAdjust!=0 || img->cyAdjust!=0)) {
- GetWindowRect(GetParent(hwnd),&rect);
- MoveWindow(GetParent(hwnd),rect.left,rect.top,
- rect.right-rect.left+img->cxAdjust,
- rect.bottom-rect.top+img->cyAdjust, TRUE);
- img->cxAdjust = img->cyAdjust = 0;
- }
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- return(0);
- case WM_VSCROLL:
- switch(LOWORD(wParam)) {
- case SB_TOP:
- nVscrollInc = -img->nVscrollPos;
- break;
- case SB_BOTTOM:
- nVscrollInc = img->nVscrollMax - img->nVscrollPos;
- break;
- case SB_LINEUP:
- nVscrollInc = -img->cyClient/16;
- break;
- case SB_LINEDOWN:
- nVscrollInc = img->cyClient/16;
- break;
- case SB_PAGEUP:
- nVscrollInc = min(-1,-img->cyClient);
- break;
- case SB_PAGEDOWN:
- nVscrollInc = max(1,img->cyClient);
- break;
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- nVscrollInc = HIWORD(wParam) - img->nVscrollPos;
- break;
- default:
- nVscrollInc = 0;
- }
- if ((nVscrollInc = max(-img->nVscrollPos,
- min(nVscrollInc, img->nVscrollMax - img->nVscrollPos)))!=0) {
- img->nVscrollPos += nVscrollInc;
- ScrollWindow(hwnd,0,-nVscrollInc,NULL,NULL);
- SetScrollPos(hwnd,SB_VERT,img->nVscrollPos,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_HSCROLL:
- switch(LOWORD(wParam)) {
- case SB_LINEUP:
- nHscrollInc = -img->cxClient/16;
- break;
- case SB_LINEDOWN:
- nHscrollInc = img->cyClient/16;
- break;
- case SB_PAGEUP:
- nHscrollInc = min(-1,-img->cxClient);
- break;
- case SB_PAGEDOWN:
- nHscrollInc = max(1,img->cxClient);
- break;
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- nHscrollInc = HIWORD(wParam) - img->nHscrollPos;
- break;
- default:
- nHscrollInc = 0;
- }
- if ((nHscrollInc = max(-img->nHscrollPos,
- min(nHscrollInc, img->nHscrollMax - img->nHscrollPos)))!=0) {
- img->nHscrollPos += nHscrollInc;
- ScrollWindow(hwnd,-nHscrollInc,0,NULL,NULL);
- SetScrollPos(hwnd,SB_HORZ,img->nHscrollPos,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_KEYDOWN:
- switch(LOWORD(wParam)) {
- case VK_HOME:
- SendMessage(hwnd,WM_VSCROLL,SB_TOP,0L);
- break;
- case VK_END:
- SendMessage(hwnd,WM_VSCROLL,SB_BOTTOM,0L);
- break;
- case VK_PRIOR:
- SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP,0L);
- break;
- case VK_NEXT:
- SendMessage(hwnd,WM_VSCROLL,SB_PAGEDOWN,0L);
- break;
- case VK_UP:
- SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L);
- break;
- case VK_DOWN:
- SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0L);
- break;
- case VK_LEFT:
- SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L);
- break;
- case VK_RIGHT:
- SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L);
- break;
- case VK_RETURN:
- if (img->hwndtext)
- BringWindowToTop(img->hwndtext);
- break;
- }
- return(0);
- case WM_CHAR:
- /* send on all characters to text window */
- if (img->hwndtext)
- SendMessage(img->hwndtext, message, wParam, lParam);
- else {
- /* assume we have a console */
- INPUT_RECORD ir;
- HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
- DWORD dwWritten = 0;
- DWORD cks = 0;
- ir.EventType = KEY_EVENT;
- ir.Event.KeyEvent.bKeyDown = TRUE;
- ir.Event.KeyEvent.wRepeatCount = lParam & 0xffff;
- ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan((TCHAR)wParam) & 0xff;
- ir.Event.KeyEvent.wVirtualScanCode =
- (lParam >> 16) & 0xff;
- ir.Event.KeyEvent.uChar.AsciiChar = wParam;
- if (GetKeyState(VK_CAPITAL))
- cks |= CAPSLOCK_ON;
- /* ENHANCED_KEY unimplemented */
- if (GetKeyState(VK_LMENU))
- cks |= LEFT_ALT_PRESSED;
- if (GetKeyState(VK_LCONTROL))
- cks |= LEFT_CTRL_PRESSED;
- if (GetKeyState(VK_NUMLOCK))
- cks |= NUMLOCK_ON;
- if (GetKeyState(VK_RMENU))
- cks |= RIGHT_ALT_PRESSED;
- if (GetKeyState(VK_RCONTROL))
- cks |= RIGHT_CTRL_PRESSED;
- if (GetKeyState(VK_SCROLL))
- cks |= SCROLLLOCK_ON;
- if (GetKeyState(VK_SHIFT))
- cks |= SHIFT_PRESSED;
- ir.Event.KeyEvent.dwControlKeyState = cks;
- if (ir.Event.KeyEvent.uChar.AsciiChar == 3)
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0L);
- else if (hStdin != INVALID_HANDLE_VALUE)
- WriteConsoleInput(hStdin, &ir, 1, &dwWritten);
- }
- return 0;
- case WM_TIMER:
- img->update_count++;
- if (img->update_count >= img->update_interval)
- image_update_now(img);
- return 0;
- case WM_PAINT:
- {
- int sx,sy,wx,wy,dx,dy;
- RECT fillrect;
- hdc = BeginPaint(hwnd, &ps);
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- SetMapMode(hdc, MM_TEXT);
- SetBkMode(hdc,OPAQUE);
- rect = ps.rcPaint;
- dx = rect.left; /* destination */
- dy = rect.top;
- wx = rect.right-rect.left; /* width */
- wy = rect.bottom-rect.top;
- sx = rect.left; /* source */
- sy = rect.top;
- sx += img->nHscrollPos; /* scrollbars */
- sy += img->nVscrollPos;
- if (sx+wx > img->bmih.biWidth)
- wx = img->bmih.biWidth - sx;
- if (sy+wy > img->bmih.biHeight)
- wy = img->bmih.biHeight - sy;
-
- draw(img, hdc, dx, dy, wx, wy, sx, sy);
-
- /* fill areas around page */
- if (rect.right > img->bmih.biWidth) {
- fillrect.top = rect.top;
- fillrect.left = img->bmih.biWidth;
- fillrect.bottom = rect.bottom;
- fillrect.right = rect.right;
- FillRect(hdc, &fillrect, img->hBrush);
- }
- if (rect.bottom > img->bmih.biHeight) {
- fillrect.top = img->bmih.biHeight;
- fillrect.left = rect.left;
- fillrect.bottom = rect.bottom;
- fillrect.right = rect.right;
- FillRect(hdc, &fillrect, img->hBrush);
- }
-
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- EndPaint(hwnd, &ps);
- return 0;
- }
- case WM_DROPFILES:
- if (img->hwndtext)
- SendMessage(img->hwndtext, message, wParam, lParam);
- else {
- char *szFile;
- int i, cFiles;
- unsigned int Len, error;
- const char *p;
- const char *szDragPre = "\r(";
- const char *szDragPost = ") run\r";
- HDROP hdrop = (HDROP)wParam;
- cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
- for (i=0; i<cFiles; i++) {
- Len = DragQueryFile(hdrop, i, NULL, 0);
- szFile = malloc(Len+1);
- if (szFile != 0) {
- error = DragQueryFile(hdrop, i, szFile, Len+1);
- if (error != 0) {
- for (p=szDragPre; *p; p++)
- SendMessage(hwnd,WM_CHAR,*p,1L);
- for (p=szFile; *p; p++) {
- if (*p == '\\')
- SendMessage(hwnd,WM_CHAR,'/',1L);
- else
- SendMessage(hwnd,WM_CHAR,*p,1L);
- }
- for (p=szDragPost; *p; p++)
- SendMessage(hwnd,WM_CHAR,*p,1L);
- }
- free(szFile);
- }
- }
- DragFinish(hdrop);
- }
- break;
- case WM_DESTROY:
- { /* Save the text window size */
- char winposbuf[64];
- sprintf(winposbuf, "%d %d %d %d", img->x, img->y,
- img->cx, img->cy);
- win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf);
- }
- DragAcceptFiles(hwnd, FALSE);
- break;
+ case WM_SYSCOMMAND:
+ /* copy to clipboard */
+ if (LOWORD(wParam) == M_COPY_CLIP) {
+ HGLOBAL hglobal;
+ HPALETTE hpalette;
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ hglobal = copy_dib(img);
+ if (hglobal == (HGLOBAL)NULL) {
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ MessageBox(hwnd, "Not enough memory to Copy to Clipboard",
+ szImgName2, MB_OK | MB_ICONEXCLAMATION);
+ return 0;
+ }
+ OpenClipboard(hwnd);
+ EmptyClipboard();
+ SetClipboardData(CF_DIB, hglobal);
+ hpalette = create_palette(img);
+ if (hpalette)
+ SetClipboardData(CF_PALETTE, hpalette);
+ CloseClipboard();
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ return 0;
+ }
+ else if ((LOWORD(wParam) >= M_SEPARATION) &&
+ (LOWORD(wParam) < M_SEPARATION+IMAGE_DEVICEN_MAX)) {
+ sep_menu(img, LOWORD(wParam) - M_SEPARATION);
+ }
+ else if (LOWORD(wParam) == M_DEVICEN_GRAY) {
+ img->devicen_gray = !img->devicen_gray;
+ CheckMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
+ (img->devicen_gray ? MF_CHECKED : MF_UNCHECKED));
+ InvalidateRect(img->hwnd, NULL, 0);
+ UpdateWindow(img->hwnd);
+ }
+ break;
+ case WM_CREATE:
+ /* enable drag-drop */
+ DragAcceptFiles(hwnd, TRUE);
+ break;
+ case WM_MOVE:
+ if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
+ GetWindowRect(hwnd, &rect);
+ img->x = rect.left;
+ img->y = rect.top;
+ }
+ break;
+ case WM_SIZE:
+ if (wParam == SIZE_MINIMIZED)
+ return(0);
+
+ /* remember current window size */
+ if (wParam != SIZE_MAXIMIZED) {
+ GetWindowRect(hwnd, &rect);
+ img->cx = rect.right - rect.left;
+ img->cy = rect.bottom - rect.top;
+ img->x = rect.left;
+ img->y = rect.top;
+ }
+
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ img->cyClient = HIWORD(lParam);
+ img->cxClient = LOWORD(lParam);
+
+ img->cyAdjust = min(img->bmih.biHeight, img->cyClient) - img->cyClient;
+ img->cyClient += img->cyAdjust;
+
+ img->nVscrollMax = max(0, img->bmih.biHeight - img->cyClient);
+ img->nVscrollPos = min(img->nVscrollPos, img->nVscrollMax);
+
+ SetScrollRange(hwnd, SB_VERT, 0, img->nVscrollMax, FALSE);
+ SetScrollPos(hwnd, SB_VERT, img->nVscrollPos, TRUE);
+
+ img->cxAdjust = min(img->bmih.biWidth, img->cxClient) - img->cxClient;
+ img->cxClient += img->cxAdjust;
+
+ img->nHscrollMax = max(0, img->bmih.biWidth - img->cxClient);
+ img->nHscrollPos = min(img->nHscrollPos, img->nHscrollMax);
+
+ SetScrollRange(hwnd, SB_HORZ, 0, img->nHscrollMax, FALSE);
+ SetScrollPos(hwnd, SB_HORZ, img->nHscrollPos, TRUE);
+
+ if ((wParam==SIZENORMAL)
+ && (img->cxAdjust!=0 || img->cyAdjust!=0)) {
+ GetWindowRect(GetParent(hwnd),&rect);
+ MoveWindow(GetParent(hwnd),rect.left,rect.top,
+ rect.right-rect.left+img->cxAdjust,
+ rect.bottom-rect.top+img->cyAdjust, TRUE);
+ img->cxAdjust = img->cyAdjust = 0;
+ }
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ return(0);
+ case WM_VSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_TOP:
+ nVscrollInc = -img->nVscrollPos;
+ break;
+ case SB_BOTTOM:
+ nVscrollInc = img->nVscrollMax - img->nVscrollPos;
+ break;
+ case SB_LINEUP:
+ nVscrollInc = -img->cyClient/16;
+ break;
+ case SB_LINEDOWN:
+ nVscrollInc = img->cyClient/16;
+ break;
+ case SB_PAGEUP:
+ nVscrollInc = min(-1,-img->cyClient);
+ break;
+ case SB_PAGEDOWN:
+ nVscrollInc = max(1,img->cyClient);
+ break;
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ nVscrollInc = HIWORD(wParam) - img->nVscrollPos;
+ break;
+ default:
+ nVscrollInc = 0;
+ }
+ if ((nVscrollInc = max(-img->nVscrollPos,
+ min(nVscrollInc, img->nVscrollMax - img->nVscrollPos)))!=0) {
+ img->nVscrollPos += nVscrollInc;
+ ScrollWindow(hwnd,0,-nVscrollInc,NULL,NULL);
+ SetScrollPos(hwnd,SB_VERT,img->nVscrollPos,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_HSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_LINEUP:
+ nHscrollInc = -img->cxClient/16;
+ break;
+ case SB_LINEDOWN:
+ nHscrollInc = img->cyClient/16;
+ break;
+ case SB_PAGEUP:
+ nHscrollInc = min(-1,-img->cxClient);
+ break;
+ case SB_PAGEDOWN:
+ nHscrollInc = max(1,img->cxClient);
+ break;
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ nHscrollInc = HIWORD(wParam) - img->nHscrollPos;
+ break;
+ default:
+ nHscrollInc = 0;
+ }
+ if ((nHscrollInc = max(-img->nHscrollPos,
+ min(nHscrollInc, img->nHscrollMax - img->nHscrollPos)))!=0) {
+ img->nHscrollPos += nHscrollInc;
+ ScrollWindow(hwnd,-nHscrollInc,0,NULL,NULL);
+ SetScrollPos(hwnd,SB_HORZ,img->nHscrollPos,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_KEYDOWN:
+ switch(LOWORD(wParam)) {
+ case VK_HOME:
+ SendMessage(hwnd,WM_VSCROLL,SB_TOP,0L);
+ break;
+ case VK_END:
+ SendMessage(hwnd,WM_VSCROLL,SB_BOTTOM,0L);
+ break;
+ case VK_PRIOR:
+ SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP,0L);
+ break;
+ case VK_NEXT:
+ SendMessage(hwnd,WM_VSCROLL,SB_PAGEDOWN,0L);
+ break;
+ case VK_UP:
+ SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L);
+ break;
+ case VK_DOWN:
+ SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0L);
+ break;
+ case VK_LEFT:
+ SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L);
+ break;
+ case VK_RIGHT:
+ SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L);
+ break;
+ case VK_RETURN:
+ if (img->hwndtext)
+ BringWindowToTop(img->hwndtext);
+ break;
+ }
+ return(0);
+ case WM_CHAR:
+ /* send on all characters to text window */
+ if (img->hwndtext)
+ SendMessage(img->hwndtext, message, wParam, lParam);
+ else {
+ /* assume we have a console */
+ INPUT_RECORD ir;
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
+ DWORD dwWritten = 0;
+ DWORD cks = 0;
+ ir.EventType = KEY_EVENT;
+ ir.Event.KeyEvent.bKeyDown = TRUE;
+ ir.Event.KeyEvent.wRepeatCount = lParam & 0xffff;
+ ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan((TCHAR)wParam) & 0xff;
+ ir.Event.KeyEvent.wVirtualScanCode =
+ (lParam >> 16) & 0xff;
+ ir.Event.KeyEvent.uChar.AsciiChar = wParam;
+ if (GetKeyState(VK_CAPITAL))
+ cks |= CAPSLOCK_ON;
+ /* ENHANCED_KEY unimplemented */
+ if (GetKeyState(VK_LMENU))
+ cks |= LEFT_ALT_PRESSED;
+ if (GetKeyState(VK_LCONTROL))
+ cks |= LEFT_CTRL_PRESSED;
+ if (GetKeyState(VK_NUMLOCK))
+ cks |= NUMLOCK_ON;
+ if (GetKeyState(VK_RMENU))
+ cks |= RIGHT_ALT_PRESSED;
+ if (GetKeyState(VK_RCONTROL))
+ cks |= RIGHT_CTRL_PRESSED;
+ if (GetKeyState(VK_SCROLL))
+ cks |= SCROLLLOCK_ON;
+ if (GetKeyState(VK_SHIFT))
+ cks |= SHIFT_PRESSED;
+ ir.Event.KeyEvent.dwControlKeyState = cks;
+ if (ir.Event.KeyEvent.uChar.AsciiChar == 3)
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0L);
+ else if (hStdin != INVALID_HANDLE_VALUE)
+ WriteConsoleInput(hStdin, &ir, 1, &dwWritten);
+ }
+ return 0;
+ case WM_TIMER:
+ img->update_count++;
+ if (img->update_count >= img->update_interval)
+ image_update_now(img);
+ return 0;
+ case WM_PAINT:
+ {
+ int sx,sy,wx,wy,dx,dy;
+ RECT fillrect;
+ hdc = BeginPaint(hwnd, &ps);
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ SetMapMode(hdc, MM_TEXT);
+ SetBkMode(hdc,OPAQUE);
+ rect = ps.rcPaint;
+ dx = rect.left; /* destination */
+ dy = rect.top;
+ wx = rect.right-rect.left; /* width */
+ wy = rect.bottom-rect.top;
+ sx = rect.left; /* source */
+ sy = rect.top;
+ sx += img->nHscrollPos; /* scrollbars */
+ sy += img->nVscrollPos;
+ if (sx+wx > img->bmih.biWidth)
+ wx = img->bmih.biWidth - sx;
+ if (sy+wy > img->bmih.biHeight)
+ wy = img->bmih.biHeight - sy;
+
+ draw(img, hdc, dx, dy, wx, wy, sx, sy);
+
+ /* fill areas around page */
+ if (rect.right > img->bmih.biWidth) {
+ fillrect.top = rect.top;
+ fillrect.left = img->bmih.biWidth;
+ fillrect.bottom = rect.bottom;
+ fillrect.right = rect.right;
+ FillRect(hdc, &fillrect, img->hBrush);
+ }
+ if (rect.bottom > img->bmih.biHeight) {
+ fillrect.top = img->bmih.biHeight;
+ fillrect.left = rect.left;
+ fillrect.bottom = rect.bottom;
+ fillrect.right = rect.right;
+ FillRect(hdc, &fillrect, img->hBrush);
+ }
+
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ case WM_DROPFILES:
+ if (img->hwndtext)
+ SendMessage(img->hwndtext, message, wParam, lParam);
+ else {
+ char *szFile;
+ int i, cFiles;
+ unsigned int Len, error;
+ const char *p;
+ const char *szDragPre = "\r(";
+ const char *szDragPost = ") run\r";
+ HDROP hdrop = (HDROP)wParam;
+ cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
+ for (i=0; i<cFiles; i++) {
+ Len = DragQueryFile(hdrop, i, NULL, 0);
+ szFile = malloc(Len+1);
+ if (szFile != 0) {
+ error = DragQueryFile(hdrop, i, szFile, Len+1);
+ if (error != 0) {
+ for (p=szDragPre; *p; p++)
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ for (p=szFile; *p; p++) {
+ if (*p == '\\')
+ SendMessage(hwnd,WM_CHAR,'/',1L);
+ else
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ }
+ for (p=szDragPost; *p; p++)
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ }
+ free(szFile);
+ }
+ }
+ DragFinish(hdrop);
+ }
+ break;
+ case WM_DESTROY:
+ { /* Save the text window size */
+ char winposbuf[64];
+ sprintf(winposbuf, "%d %d %d %d", img->x, img->y,
+ img->cx, img->cy);
+ win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf);
+ }
+ DragAcceptFiles(hwnd, FALSE);
+ break;
}
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
-
/* Repaint a section of the window. */
static void
draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
- int sx, int sy)
+ int sx, int sy)
{
HPALETTE oldpalette;
struct bmi_s {
- BITMAPINFOHEADER h;
- unsigned short pal_index[256];
+ BITMAPINFOHEADER h;
+ unsigned short pal_index[256];
} bmi;
int i;
UINT which_colors;
@@ -1520,117 +1505,115 @@ draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
bmi.h.biClrImportant = img->bmih.biClrImportant;
if (img->bmih.biClrUsed) {
- /* palette colors */
- for (i = 0; i < img->bmih.biClrUsed; i++)
- bmi.pal_index[i] = i;
- which_colors = DIB_PAL_COLORS;
+ /* palette colors */
+ for (i = 0; i < img->bmih.biClrUsed; i++)
+ bmi.pal_index[i] = i;
+ which_colors = DIB_PAL_COLORS;
}
else if (bmi.h.biBitCount == 16) {
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- which_colors = DIB_RGB_COLORS;
- if ((img->format & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
- /* 5-5-5 RGB mode */
- bmi_colors[0] = 0x7c00;
- bmi_colors[1] = 0x03e0;
- bmi_colors[2] = 0x001f;
- }
- else {
- /* 5-6-5 RGB mode */
- bmi_colors[0] = 0xf800;
- bmi_colors[1] = 0x07e0;
- bmi_colors[2] = 0x001f;
- }
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ which_colors = DIB_RGB_COLORS;
+ if ((img->format & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
+ /* 5-5-5 RGB mode */
+ bmi_colors[0] = 0x7c00;
+ bmi_colors[1] = 0x03e0;
+ bmi_colors[2] = 0x001f;
+ }
+ else {
+ /* 5-6-5 RGB mode */
+ bmi_colors[0] = 0xf800;
+ bmi_colors[1] = 0x07e0;
+ bmi_colors[2] = 0x001f;
+ }
}
else if (bmi.h.biBitCount == 32) {
- unsigned int alpha = img->format & DISPLAY_ALPHA_MASK;
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- which_colors = DIB_RGB_COLORS;
- if ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST)) {
- /* Mac mode */
- bmi_colors[0] = 0x0000ff00;
- bmi_colors[1] = 0x00ff0000;
- bmi_colors[2] = 0xff000000;
- }
- else {
- bmi_colors[0] = 0x000000ff;
- bmi_colors[1] = 0x0000ff00;
- bmi_colors[2] = 0x00ff0000;
- }
- }
- else {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST)) {
- /* ignore alpha */
- bmi_colors[0] = 0xff000000;
- bmi_colors[1] = 0x00ff0000;
- bmi_colors[2] = 0x0000ff00;
- }
- else {
- /* Windows mode */
- /* ignore alpha */
- bmi_colors[0] = 0x00ff0000;
- bmi_colors[1] = 0x0000ff00;
- bmi_colors[2] = 0x000000ff;
- }
- }
+ unsigned int alpha = img->format & DISPLAY_ALPHA_MASK;
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ which_colors = DIB_RGB_COLORS;
+ if ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST)) {
+ /* Mac mode */
+ bmi_colors[0] = 0x0000ff00;
+ bmi_colors[1] = 0x00ff0000;
+ bmi_colors[2] = 0xff000000;
+ }
+ else {
+ bmi_colors[0] = 0x000000ff;
+ bmi_colors[1] = 0x0000ff00;
+ bmi_colors[2] = 0x00ff0000;
+ }
+ }
+ else {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST)) {
+ /* ignore alpha */
+ bmi_colors[0] = 0xff000000;
+ bmi_colors[1] = 0x00ff0000;
+ bmi_colors[2] = 0x0000ff00;
+ }
+ else {
+ /* Windows mode */
+ /* ignore alpha */
+ bmi_colors[0] = 0x00ff0000;
+ bmi_colors[1] = 0x0000ff00;
+ bmi_colors[2] = 0x000000ff;
+ }
+ }
} else {
- bmi.h.biClrUsed = 0;
- bmi.h.biClrImportant = 0;
- which_colors = DIB_RGB_COLORS;
+ bmi.h.biClrUsed = 0;
+ bmi.h.biClrImportant = 0;
+ which_colors = DIB_RGB_COLORS;
}
if (img->raster <= 0)
- return;
+ return;
if (img->bytewidth <= 0)
- return;
+ return;
/* Determine if the format is native and we can do a direct copy */
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- break;
- case DISPLAY_DEPTH_16:
- if ((img->format & DISPLAY_ENDIAN_MASK)
- == DISPLAY_LITTLEENDIAN)
- directcopy = TRUE;
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE))
- directcopy = TRUE; /* BGR24 */
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST))
- directcopy = TRUE; /* 32-bit */
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ break;
+ case DISPLAY_DEPTH_16:
+ if ((img->format & DISPLAY_ENDIAN_MASK)
+ == DISPLAY_LITTLEENDIAN)
+ directcopy = TRUE;
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE))
+ directcopy = TRUE; /* BGR24 */
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST))
+ directcopy = TRUE; /* 32-bit */
+ break;
}
-
if (which_colors == DIB_PAL_COLORS) {
- oldpalette = SelectPalette(hdc, img->palette, FALSE);
- RealizePalette(hdc);
+ oldpalette = SelectPalette(hdc, img->palette, FALSE);
+ RealizePalette(hdc);
}
-
/*
* Windows apparently limits the size of a single transfer
* to 2 Mb, which can be exceeded on 24-bit displays.
@@ -1638,35 +1621,34 @@ draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
ny = 2000000 / img->raster;
if (img->raster != img->bytewidth) /* not 32-bit architecture */
- ny = 1;
+ ny = 1;
/* If color format not native, convert it line by line */
/* This is slow, but these formats aren't normally used */
if (!directcopy) {
- ny = 1;
- line = (unsigned char *)malloc(img->bytewidth);
- if (line == NULL)
- return;
+ ny = 1;
+ line = (unsigned char *)malloc(img->bytewidth);
+ if (line == NULL)
+ return;
}
for (; wy; dy += ny, wy -= ny, sy += ny) {
- ny = min(ny, wy);
- if (directcopy) {
- bits = img->image + img->raster * (img->bmih.biHeight - (sy + ny));
- }
- else {
- image_convert_line(img, line,
- img->image + img->raster * (img->bmih.biHeight - (sy + ny)));
- bits = line;
- }
- SetDIBitsToDevice(hdc, dx, dy, wx, ny, sx, 0, 0, ny, bits,
- (BITMAPINFO *) & bmi, which_colors);
+ ny = min(ny, wy);
+ if (directcopy) {
+ bits = img->image + img->raster * (img->bmih.biHeight - (sy + ny));
+ }
+ else {
+ image_convert_line(img, line,
+ img->image + img->raster * (img->bmih.biHeight - (sy + ny)));
+ bits = line;
+ }
+ SetDIBitsToDevice(hdc, dx, dy, wx, ny, sx, 0, 0, ny, bits,
+ (BITMAPINFO *) & bmi, which_colors);
}
if (which_colors == DIB_PAL_COLORS)
- SelectPalette(hdc, oldpalette, FALSE);
+ SelectPalette(hdc, oldpalette, FALSE);
if (line)
- free(line);
+ free(line);
}
-
diff --git a/gs/psi/dwimg.h b/gs/psi/dwimg.h
index 69c5a4c04..4add635e6 100644
--- a/gs/psi/dwimg.h
+++ b/gs/psi/dwimg.h
@@ -15,7 +15,6 @@
#ifndef dwimg_INCLUDED
# define dwimg_INCLUDED
-
/* Windows Image Window structure */
typedef struct IMAGE_DEVICEN_S IMAGE_DEVICEN;
@@ -94,5 +93,4 @@ void image_updatesize(IMAGE *img);
/* To be called during initialization after the text window has been created */
void image_textwindow(HWND hwnd);
-
#endif /* dwimg_INCLUDED */
diff --git a/gs/psi/dwinst.h b/gs/psi/dwinst.h
index fce283c2f..6b4c90aaf 100644
--- a/gs/psi/dwinst.h
+++ b/gs/psi/dwinst.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,91 +26,89 @@
#endif
#endif
-class CInstall
+class CInstall
{
public:
- CInstall();
- virtual ~CInstall();
- void SetMessageFunction(void(*fn)(const char *));
- void AddMessage(const char *message);
- const char *GetMainDir();
- const char *GetUninstallName();
- BOOL GetPrograms(BOOL bUseCommon, char *buf, int buflen);
- BOOL Init(const char *szSourceDir, const char *szFileList);
- BOOL InstallFiles(BOOL bNoCopy, BOOL *pbQuit);
- BOOL InstallFile(char *filename, BOOL bNoCopy);
- BOOL MakeDir(const char *dirname);
- FILE * MakeTemp(char *name);
-
- BOOL SetAllUsers(BOOL bUseCommon);
- void SetTargetDir(const char *szTargetDir);
- void SetTargetGroup(const char *szTargetGroup);
-
- BOOL StartMenuBegin();
- BOOL StartMenuEnd();
- BOOL StartMenuAdd(const char *szDescription, const char *szProgram, const char *szArguments);
-
- BOOL UpdateRegistryBegin();
- BOOL UpdateRegistryKey(const char *product, const char *version);
- BOOL UpdateRegistryValue(const char *product, const char *version, const char *name, const char *value);
- BOOL UpdateRegistryEnd();
-
- BOOL WriteUninstall(const char *prog, BOOL bNoCopy);
- BOOL MakeLog(void);
-
- void CleanUp(void);
+ CInstall();
+ virtual ~CInstall();
+ void SetMessageFunction(void(*fn)(const char *));
+ void AddMessage(const char *message);
+ const char *GetMainDir();
+ const char *GetUninstallName();
+ BOOL GetPrograms(BOOL bUseCommon, char *buf, int buflen);
+ BOOL Init(const char *szSourceDir, const char *szFileList);
+ BOOL InstallFiles(BOOL bNoCopy, BOOL *pbQuit);
+ BOOL InstallFile(char *filename, BOOL bNoCopy);
+ BOOL MakeDir(const char *dirname);
+ FILE * MakeTemp(char *name);
+
+ BOOL SetAllUsers(BOOL bUseCommon);
+ void SetTargetDir(const char *szTargetDir);
+ void SetTargetGroup(const char *szTargetGroup);
+
+ BOOL StartMenuBegin();
+ BOOL StartMenuEnd();
+ BOOL StartMenuAdd(const char *szDescription, const char *szProgram, const char *szArguments);
+
+ BOOL UpdateRegistryBegin();
+ BOOL UpdateRegistryKey(const char *product, const char *version);
+ BOOL UpdateRegistryValue(const char *product, const char *version, const char *name, const char *value);
+ BOOL UpdateRegistryEnd();
+
+ BOOL WriteUninstall(const char *prog, BOOL bNoCopy);
+ BOOL MakeLog(void);
+
+ void CleanUp(void);
void AppendFileNew(const char *filename);
private:
- BOOL m_bNoCopy;
- BOOL m_bUseCommon;
- BOOL m_bQuit;
-
- // Source directory
- char m_szSourceDir[MAXSTR];
+ BOOL m_bNoCopy;
+ BOOL m_bUseCommon;
+ BOOL m_bQuit;
- // File containing list of files to install
- char m_szFileList[MAXSTR];
+ // Source directory
+ char m_szSourceDir[MAXSTR];
- // Target directory for program and fonts.
- char m_szTargetDir[MAXSTR];
+ // File containing list of files to install
+ char m_szFileList[MAXSTR];
- // Target Group for shortcut
- char m_szTargetGroup[MAXSTR];
+ // Target directory for program and fonts.
+ char m_szTargetDir[MAXSTR];
- // Directory where the Start Menu is located.
- char m_szPrograms[MAXSTR];
+ // Target Group for shortcut
+ char m_szTargetGroup[MAXSTR];
- // Name used for uninstall
- char m_szUninstallName[MAXSTR];
+ // Directory where the Start Menu is located.
+ char m_szPrograms[MAXSTR];
- // Main directory prefix, where log files should be written
- char m_szMainDir[MAXSTR];
+ // Name used for uninstall
+ char m_szUninstallName[MAXSTR];
- // Full directory where log files should be written
- char m_szLogDir[MAXSTR];
+ // Main directory prefix, where log files should be written
+ char m_szMainDir[MAXSTR];
- // Temporary log files for uninstall
- char m_szFileNew[MAXSTR];
- char m_szRegistryNew[MAXSTR];
- char m_szRegistryOld[MAXSTR];
- char m_szShellNew[MAXSTR];
- char m_szShellOld[MAXSTR];
+ // Full directory where log files should be written
+ char m_szLogDir[MAXSTR];
- // Log files
- FILE * m_fLogNew;
- FILE * m_fLogOld;
+ // Temporary log files for uninstall
+ char m_szFileNew[MAXSTR];
+ char m_szRegistryNew[MAXSTR];
+ char m_szRegistryOld[MAXSTR];
+ char m_szShellNew[MAXSTR];
+ char m_szShellOld[MAXSTR];
+ // Log files
+ FILE * m_fLogNew;
+ FILE * m_fLogOld;
- BOOL SetRegistryValue(HKEY hkey, const char *value_name, const char *value);
- BOOL CreateShellLink(LPCSTR description, LPCSTR program, LPCSTR arguments, LPCSTR icon = NULL, int nIconIndex = 0);
- void CopyFileContents(FILE *df, FILE *sf);
- void ResetReadonly(const char *filename);
+ BOOL SetRegistryValue(HKEY hkey, const char *value_name, const char *value);
+ BOOL CreateShellLink(LPCSTR description, LPCSTR program, LPCSTR arguments, LPCSTR icon = NULL, int nIconIndex = 0);
+ void CopyFileContents(FILE *df, FILE *sf);
+ void ResetReadonly(const char *filename);
- void(*AddMessageFn)(const char *);
+ void(*AddMessageFn)(const char *);
};
-
#endif /* dwinst_INCLUDED */
diff --git a/gs/psi/dwmain.c b/gs/psi/dwmain.c
index 1bf222e18..c12a779a1 100644
--- a/gs/psi/dwmain.c
+++ b/gs/psi/dwmain.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,7 +49,6 @@ const char *szDllName = "gsdll32.dll";
#endif
const LPSTR szIniSection = "Text";
-
GSDLL gsdll;
void *instance;
HWND hwndtext;
@@ -60,12 +59,12 @@ static int poll(void)
{
MSG msg;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
}
/* If text window closing then abort Ghostscript */
if (tw->quitnow)
- return e_Fatal;
+ return e_Fatal;
return 0;
}
@@ -100,7 +99,7 @@ static int GSDLLCALL gsdll_poll(void *handle)
/*********************************************************************/
/* new dll display device */
-/*
+/*
#define DISPLAY_DEBUG
*/
@@ -145,37 +144,37 @@ static int display_close(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img) {
- image_delete(img); /* remove from list but don't free */
- image_close(img);
+ image_delete(img); /* remove from list but don't free */
+ image_close(img);
}
return 0;
}
/* Device is about to be resized. */
/* Resize will only occur if this function returns 0. */
-static int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+static int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
#ifdef DISPLAY_DEBUG
char buf[256];
sprintf(buf, "display_presize(0x%x, 0x%x, width=%d height=%d raster=%d\n\
- format=%d)\n",
+ format=%d)\n",
handle, device, width, height, raster, format);
text_puts(tw, buf);
#endif
return 0;
}
-
+
/* Device has been resized. */
/* New pointer to raster returned in pimage */
-static int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+static int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
char buf[256];
sprintf(buf, "display_size(0x%x, 0x%x, width=%d height=%d raster=%d\n\
- format=%d image=0x%x)\n",
+ format=%d image=0x%x)\n",
handle, device, width, height, raster, format, pimage);
text_puts(tw, buf);
#endif
@@ -184,7 +183,7 @@ static int display_size(void *handle, void *device, int width, int height,
image_updatesize(img);
return 0;
}
-
+
/* flushpage */
static int display_sync(void *handle, void *device)
{
@@ -206,8 +205,8 @@ static int display_page(void *handle, void *device, int copies, int flush)
IMAGE *img;
#ifdef DISPLAY_DEBUG
char buf[256];
- sprintf(buf, "display_page(0x%x, 0x%x, copies=%d flush=%d)\n",
- handle, device, copies, flush);
+ sprintf(buf, "display_page(0x%x, 0x%x, copies=%d flush=%d)\n",
+ handle, device, copies, flush);
text_puts(tw, buf);
#endif
img = image_find(handle, device);
@@ -217,7 +216,7 @@ static int display_page(void *handle, void *device, int copies, int flush)
/* Poll the caller for cooperative multitasking. */
/* If this function is NULL, polling is not needed */
-static int display_update(void *handle, void *device,
+static int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
IMAGE *img;
@@ -226,15 +225,15 @@ static int display_update(void *handle, void *device,
return poll();
}
-int display_separation(void *handle, void *device,
+int display_separation(void *handle, void *device,
int comp_num, const char *name,
unsigned short c, unsigned short m,
unsigned short y, unsigned short k)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
- handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
+ fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
+ handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
#endif
img = image_find(handle, device);
if (img)
@@ -242,7 +241,7 @@ int display_separation(void *handle, void *device,
return 0;
}
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -259,7 +258,6 @@ display_callback display = {
display_separation
};
-
/*********************************************************************/
/* program really starts at WinMain */
@@ -276,15 +274,15 @@ int new_main(int argc, char *argv[])
memset(buf, 0, sizeof(buf));
if (load_dll(&gsdll, buf, sizeof(buf))) {
- text_puts(tw, "Can't load Ghostscript DLL\n");
- text_puts(tw, buf);
- text_puts(tw, "\n");
- return 1;
+ text_puts(tw, "Can't load Ghostscript DLL\n");
+ text_puts(tw, buf);
+ text_puts(tw, "\n");
+ return 1;
}
if (gsdll.new_instance(&instance, NULL) < 0) {
- text_puts(tw, "Can't create Ghostscript instance\n");
- return 1;
+ text_puts(tw, "Can't create Ghostscript instance\n");
+ return 1;
}
#ifdef DEBUG
@@ -297,28 +295,28 @@ int new_main(int argc, char *argv[])
gsdll.set_display_callback(instance, &display);
/* insert display device defaults as first arguments */
- { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- HDC hdc = GetDC(NULL); /* get hdc for desktop */
- int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
- sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
+ { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ HDC hdc = GetDC(NULL); /* get hdc for desktop */
+ int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
+ sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
ReleaseDC(NULL, hdc);
- if (depth == 32)
- format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth == 16)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_16 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST |
- DISPLAY_NATIVE_555;
- else if (depth > 8)
- format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 8)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 4)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ if (depth == 32)
+ format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth == 16)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_16 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST |
+ DISPLAY_NATIVE_555;
+ else if (depth > 8)
+ format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 8)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 4)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
sprintf(dformat, "-dDisplayFormat=%d", format);
}
nargc = argc + 2;
@@ -333,10 +331,10 @@ int new_main(int argc, char *argv[])
#endif
code = gsdll.init_with_args(instance, nargc, nargv);
if (code == 0)
- code = gsdll.run_string(instance, start_string, 0, &exit_code);
+ code = gsdll.run_string(instance, start_string, 0, &exit_code);
code1 = gsdll.exit(instance);
if (code == 0 || (code == e_Quit && code1 != 0))
- code = code1;
+ code = code1;
#if defined(_MSC_VER) || defined(__BORLANDC__)
} __except(exception_code() == EXCEPTION_STACK_OVERFLOW) {
code = e_Fatal;
@@ -356,22 +354,20 @@ int new_main(int argc, char *argv[])
exit_status = 0;
switch (code) {
- case 0:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- case e_Info:
- default:
- exit_status = 255;
+ case 0:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ case e_Info:
+ default:
+ exit_status = 255;
}
-
+
return exit_status;
}
-
-
void
set_font(void)
{
@@ -384,7 +380,7 @@ set_font(void)
fontsize = GetPrivateProfileInt(szIniSection, "FontSize", 10, szIniName);
/* set font */
- text_font(tw, fontname, fontsize);
+ text_font(tw, fontname, fontsize);
/* write ini file */
WritePrivateProfileString(szIniSection, "FontName", fontname, szIniName);
@@ -392,7 +388,7 @@ set_font(void)
WritePrivateProfileString(szIniSection, "FontSize", buf, szIniName);
}
-int PASCAL
+int PASCAL
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmdShow)
{
int dll_exit_status;
@@ -409,14 +405,14 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmd
char winposbuf[256];
int len = sizeof(winposbuf);
int x, y, cx, cy;
-
+
/* copy the hInstance into a variable so it can be used */
ghInstance = hInstance;
if (hPrevInstance) {
- MessageBox((HWND)NULL,"Can't run twice", szAppName,
- MB_ICONHAND | MB_OK);
- return FALSE;
+ MessageBox((HWND)NULL,"Can't run twice", szAppName,
+ MB_ICONHAND | MB_OK);
+ return FALSE;
}
/* If called with "gswin32c.exe arg1 arg2"
@@ -424,105 +420,104 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmd
* "arg1 arg2" if called with CreateProcess(NULL, command, ...)
* "arg2" if called with CreateProcess(command, args, ...)
* GetCommandLine() returns
- * ""gswin32c.exe" arg1 arg2"
+ * ""gswin32c.exe" arg1 arg2"
* if called with CreateProcess(NULL, command, ...)
- * " arg1 arg2"
+ * " arg1 arg2"
* if called with CreateProcess(command, args, ...)
- * Consequently we must use GetCommandLine()
+ * Consequently we must use GetCommandLine()
*/
p = GetCommandLine();
argc = 0;
args = (char *)malloc(lstrlen(p)+1);
if (args == (char *)NULL) {
- fprintf(stdout, "Insufficient memory in WinMain()\n");
- return 1;
+ fprintf(stdout, "Insufficient memory in WinMain()\n");
+ return 1;
}
-
+
/* Parse command line handling quotes. */
d = args;
while (*p) {
- /* for each argument */
+ /* for each argument */
- if (argc >= MAXCMDTOKENS - 1)
- break;
+ if (argc >= MAXCMDTOKENS - 1)
+ break;
e = d;
while ((*p) && (*p != ' ')) {
- if (*p == '\042') {
- /* Remove quotes, skipping over embedded spaces. */
- /* Doesn't handle embedded quotes. */
- p++;
- while ((*p) && (*p != '\042'))
- *d++ =*p++;
- }
- else
- *d++ = *p;
- if (*p)
- p++;
+ if (*p == '\042') {
+ /* Remove quotes, skipping over embedded spaces. */
+ /* Doesn't handle embedded quotes. */
+ p++;
+ while ((*p) && (*p != '\042'))
+ *d++ =*p++;
+ }
+ else
+ *d++ = *p;
+ if (*p)
+ p++;
}
- *d++ = '\0';
- argv[argc++] = e;
+ *d++ = '\0';
+ argv[argc++] = e;
- while ((*p) && (*p == ' '))
- p++; /* Skip over trailing spaces */
+ while ((*p) && (*p == ' '))
+ p++; /* Skip over trailing spaces */
}
argv[argc] = NULL;
if (strlen(argv[0]) == 0) {
- GetModuleFileName(hInstance, command, sizeof(command)-1);
- argv[0] = command;
+ GetModuleFileName(hInstance, command, sizeof(command)-1);
+ argv[0] = command;
}
-
tw = text_new();
if (tw == NULL) {
- MessageBox((HWND)NULL, "Can't create text window",
- szAppName, MB_OK | MB_ICONSTOP);
- return 1;
+ MessageBox((HWND)NULL, "Can't create text window",
+ szAppName, MB_OK | MB_ICONSTOP);
+ return 1;
}
/* start up the text window */
if (!hPrevInstance) {
- HICON hicon = LoadIcon(hInstance, (LPSTR)MAKEINTRESOURCE(GSTEXT_ICON));
- text_register_class(tw, hicon);
+ HICON hicon = LoadIcon(hInstance, (LPSTR)MAKEINTRESOURCE(GSTEXT_ICON));
+ text_register_class(tw, hicon);
}
set_font();
text_size(tw, 80, 80);
text_drag(tw, "(", ") run\r");
if (win_get_reg_value("Text", winposbuf, &len) == 0) {
- if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4)
- text_setpos(tw, x, y, cx, cy);
+ if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4)
+ text_setpos(tw, x, y, cx, cy);
}
/* create the text window */
if (text_create(tw, szAppName, cmdShow))
- exit(1);
+ exit(1);
hwndtext = text_get_handle(tw);
image_textwindow(hwndtext);
dll_exit_status = new_main(argc, argv);
-
+
if (dll_exit_status && !tw->quitnow) {
- /* display error message in text window */
- MSG msg;
- text_puts(tw, "\nClose this window with the close button on the title bar or the system menu.\n");
- if (IsIconic(text_get_handle(tw)))
- ShowWindow(text_get_handle(tw), SW_SHOWNORMAL);
- BringWindowToTop(text_get_handle(tw)); /* make text window visible */
- FlashWindow(text_get_handle(tw), TRUE);
- /* Wait until error message is read */
- while (!tw->quitnow && GetMessage(&msg, (HWND)NULL, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ /* display error message in text window */
+ MSG msg;
+ text_puts(tw, "\nClose this window with the close button on the title bar or the system menu.\n");
+ if (IsIconic(text_get_handle(tw)))
+ ShowWindow(text_get_handle(tw), SW_SHOWNORMAL);
+ BringWindowToTop(text_get_handle(tw)); /* make text window visible */
+ FlashWindow(text_get_handle(tw), TRUE);
+ /* Wait until error message is read */
+ while (!tw->quitnow && GetMessage(&msg, (HWND)NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
/* Save the text window size */
if (text_getpos(tw, &x, &y, &cx, &cy) == 0) {
- sprintf(winposbuf, "%d %d %d %d", x, y, cx, cy);
- win_set_reg_value("Text", winposbuf);
+ sprintf(winposbuf, "%d %d %d %d", x, y, cx, cy);
+ win_set_reg_value("Text", winposbuf);
}
text_destroy(tw);
@@ -530,6 +525,3 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmd
return dll_exit_status;
}
-
-
-
diff --git a/gs/psi/dwmainc.c b/gs/psi/dwmainc.c
index a8ac02eca..b454ef78d 100644
--- a/gs/psi/dwmainc.c
+++ b/gs/psi/dwmainc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -100,38 +100,37 @@ static void winthread(void *arg)
hthread = GetCurrentThread();
while (!quitnow && GetMessage(&msg, (HWND)NULL, 0, 0)) {
- switch (msg.message) {
- case DISPLAY_OPEN:
- image_open((IMAGE *)msg.lParam);
- break;
- case DISPLAY_CLOSE:
- {
- IMAGE *img = (IMAGE *)msg.lParam;
- HANDLE hmutex = img->hmutex;
- image_close(img);
- CloseHandle(hmutex);
- }
- break;
- case DISPLAY_SIZE:
- image_updatesize((IMAGE *)msg.lParam);
- break;
- case DISPLAY_SYNC:
- image_sync((IMAGE *)msg.lParam);
- break;
- case DISPLAY_PAGE:
- image_page((IMAGE *)msg.lParam);
- break;
- case DISPLAY_UPDATE:
- image_poll((IMAGE *)msg.lParam);
- break;
- default:
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ switch (msg.message) {
+ case DISPLAY_OPEN:
+ image_open((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_CLOSE:
+ {
+ IMAGE *img = (IMAGE *)msg.lParam;
+ HANDLE hmutex = img->hmutex;
+ image_close(img);
+ CloseHandle(hmutex);
+ }
+ break;
+ case DISPLAY_SIZE:
+ image_updatesize((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_SYNC:
+ image_sync((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_PAGE:
+ image_page((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_UPDATE:
+ image_poll((IMAGE *)msg.lParam);
+ break;
+ default:
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
}
-
/* New device has been opened */
/* Tell user to use another device */
int display_open(void *handle, void *device)
@@ -143,7 +142,7 @@ int display_open(void *handle, void *device)
img = image_new(handle, device); /* create and add to list */
img->hmutex = CreateMutex(NULL, FALSE, NULL);
if (img)
- PostThreadMessage(thread_id, DISPLAY_OPEN, 0, (LPARAM)img);
+ PostThreadMessage(thread_id, DISPLAY_OPEN, 0, (LPARAM)img);
return 0;
}
@@ -155,8 +154,8 @@ int display_preclose(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img) {
- /* grab mutex to stop other thread using bitmap */
- WaitForSingleObject(img->hmutex, 120000);
+ /* grab mutex to stop other thread using bitmap */
+ WaitForSingleObject(img->hmutex, 120000);
}
return 0;
}
@@ -169,50 +168,50 @@ int display_close(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img) {
- /* This is a hack to pass focus from image window to console */
- if (GetForegroundWindow() == img->hwnd)
- SetForegroundWindow(hwndforeground);
+ /* This is a hack to pass focus from image window to console */
+ if (GetForegroundWindow() == img->hwnd)
+ SetForegroundWindow(hwndforeground);
- image_delete(img); /* remove from list, but don't free */
- PostThreadMessage(thread_id, DISPLAY_CLOSE, 0, (LPARAM)img);
+ image_delete(img); /* remove from list, but don't free */
+ PostThreadMessage(thread_id, DISPLAY_CLOSE, 0, (LPARAM)img);
}
return 0;
}
-int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
fprintf(stdout, "display_presize(0x%x 0x%x, %d, %d, %d, %d, %ld)\n",
- handle, device, width, height, raster, format);
+ handle, device, width, height, raster, format);
#endif
img = image_find(handle, device);
if (img) {
- /* grab mutex to stop other thread using bitmap */
- WaitForSingleObject(img->hmutex, 120000);
+ /* grab mutex to stop other thread using bitmap */
+ WaitForSingleObject(img->hmutex, 120000);
}
return 0;
}
-
-int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+
+int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
fprintf(stdout, "display_size(0x%x 0x%x, %d, %d, %d, %d, %ld, 0x%x)\n",
- handle, device, width, height, raster, format, pimage);
+ handle, device, width, height, raster, format, pimage);
#endif
img = image_find(handle, device);
if (img) {
- image_size(img, width, height, raster, format, pimage);
- /* release mutex to allow other thread to use bitmap */
- ReleaseMutex(img->hmutex);
- PostThreadMessage(thread_id, DISPLAY_SIZE, 0, (LPARAM)img);
+ image_size(img, width, height, raster, format, pimage);
+ /* release mutex to allow other thread to use bitmap */
+ ReleaseMutex(img->hmutex);
+ PostThreadMessage(thread_id, DISPLAY_SIZE, 0, (LPARAM)img);
}
return 0;
}
-
+
int display_sync(void *handle, void *device)
{
IMAGE *img;
@@ -221,8 +220,8 @@ int display_sync(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img && !img->pending_sync) {
- img->pending_sync = 1;
- PostThreadMessage(thread_id, DISPLAY_SYNC, 0, (LPARAM)img);
+ img->pending_sync = 1;
+ PostThreadMessage(thread_id, DISPLAY_SYNC, 0, (LPARAM)img);
}
return 0;
}
@@ -231,23 +230,23 @@ int display_page(void *handle, void *device, int copies, int flush)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
- handle, device, copies, flush);
+ fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
+ handle, device, copies, flush);
#endif
img = image_find(handle, device);
if (img)
- PostThreadMessage(thread_id, DISPLAY_PAGE, 0, (LPARAM)img);
+ PostThreadMessage(thread_id, DISPLAY_PAGE, 0, (LPARAM)img);
return 0;
}
-int display_update(void *handle, void *device,
+int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
IMAGE *img;
img = image_find(handle, device);
if (img && !img->pending_update && !img->pending_sync) {
- img->pending_update = 1;
- PostThreadMessage(thread_id, DISPLAY_UPDATE, 0, (LPARAM)img);
+ img->pending_update = 1;
+ PostThreadMessage(thread_id, DISPLAY_UPDATE, 0, (LPARAM)img);
}
return 0;
}
@@ -261,8 +260,8 @@ void *display_memalloc(void *handle, void *device, unsigned long size)
{
void *mem;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
- handle, device, size);
+ fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
+ handle, device, size);
#endif
mem = malloc(size);
#ifdef DISPLAY_DEBUG
@@ -274,23 +273,23 @@ void *display_memalloc(void *handle, void *device, unsigned long size)
int display_memfree(void *handle, void *device, void *mem)
{
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
- handle, device, mem);
+ fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
+ handle, device, mem);
#endif
free(mem);
return 0;
}
#endif
-int display_separation(void *handle, void *device,
+int display_separation(void *handle, void *device,
int comp_num, const char *name,
unsigned short c, unsigned short m,
unsigned short y, unsigned short k)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
- handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
+ fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
+ handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
#endif
img = image_find(handle, device);
if (img)
@@ -298,8 +297,7 @@ int display_separation(void *handle, void *device,
return 0;
}
-
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -321,7 +319,6 @@ display_callback display = {
display_separation
};
-
/*********************************************************************/
int main(int argc, char *argv[])
@@ -343,14 +340,14 @@ int main(int argc, char *argv[])
hwndforeground = GetForegroundWindow(); /* assume this is ours */
memset(buf, 0, sizeof(buf));
if (load_dll(&gsdll, buf, sizeof(buf))) {
- fprintf(stderr, "Can't load Ghostscript DLL\n");
- fprintf(stderr, "%s\n", buf);
- return 1;
+ fprintf(stderr, "Can't load Ghostscript DLL\n");
+ fprintf(stderr, "%s\n", buf);
+ return 1;
}
if (gsdll.new_instance(&instance, NULL) < 0) {
- fprintf(stderr, "Can't create Ghostscript instance\n");
- return 1;
+ fprintf(stderr, "Can't create Ghostscript instance\n");
+ return 1;
}
#ifdef DEBUG
@@ -359,49 +356,49 @@ int main(int argc, char *argv[])
#endif
if (_beginthread(winthread, 65535, NULL) == -1) {
- fprintf(stderr, "GUI thread creation failed\n");
+ fprintf(stderr, "GUI thread creation failed\n");
}
else {
- int n = 30;
- /* wait for thread to start */
- Sleep(0);
- while (n && (hthread == INVALID_HANDLE_VALUE)) {
- n--;
- Sleep(100);
+ int n = 30;
+ /* wait for thread to start */
+ Sleep(0);
+ while (n && (hthread == INVALID_HANDLE_VALUE)) {
+ n--;
+ Sleep(100);
+ }
+ while (n && (PostThreadMessage(thread_id, WM_USER, 0, 0) == 0)) {
+ n--;
+ Sleep(100);
}
- while (n && (PostThreadMessage(thread_id, WM_USER, 0, 0) == 0)) {
- n--;
- Sleep(100);
- }
- if (n == 0)
- fprintf(stderr, "Can't post message to GUI thread\n");
+ if (n == 0)
+ fprintf(stderr, "Can't post message to GUI thread\n");
}
gsdll.set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
gsdll.set_display_callback(instance, &display);
- { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- HDC hdc = GetDC(NULL); /* get hdc for desktop */
- int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
- sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
+ { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ HDC hdc = GetDC(NULL); /* get hdc for desktop */
+ int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
+ sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
ReleaseDC(NULL, hdc);
- if (depth == 32)
- format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth == 16)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_16 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST |
- DISPLAY_NATIVE_555;
- else if (depth > 8)
- format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 8)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 4)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ if (depth == 32)
+ format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth == 16)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_16 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST |
+ DISPLAY_NATIVE_555;
+ else if (depth > 8)
+ format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 8)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 4)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
sprintf(dformat, "-dDisplayFormat=%d", format);
}
nargc = argc + 2;
@@ -416,10 +413,10 @@ int main(int argc, char *argv[])
#endif
code = gsdll.init_with_args(instance, nargc, nargv);
if (code == 0)
- code = gsdll.run_string(instance, start_string, 0, &exit_code);
+ code = gsdll.run_string(instance, start_string, 0, &exit_code);
code1 = gsdll.exit(instance);
if (code == 0 || (code == e_Quit && code1 != 0))
- code = code1;
+ code = code1;
#if defined(_MSC_VER) || defined(__BORLANDC__)
} __except(exception_code() == EXCEPTION_STACK_OVERFLOW) {
code = e_Fatal;
@@ -438,24 +435,22 @@ int main(int argc, char *argv[])
free(nargv);
/* close other thread */
- quitnow = TRUE;
+ quitnow = TRUE;
PostThreadMessage(thread_id, WM_QUIT, 0, (LPARAM)0);
Sleep(0);
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
-
return exit_status;
}
-
diff --git a/gs/psi/dwnodll.c b/gs/psi/dwnodll.c
index 53480cbb4..015359d24 100644
--- a/gs/psi/dwnodll.c
+++ b/gs/psi/dwnodll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/dwreg.c b/gs/psi/dwreg.c
index a7e52fdb1..27f4a3363 100644
--- a/gs/psi/dwreg.c
+++ b/gs/psi/dwreg.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
#include <string.h>
#include "gscdefs.h" /* for gs_productfamily and gs_revision */
-/* We store registry named values under the key
+/* We store registry named values under the key
* "Software\\GPL Ghostscript"
* where "GPL Ghostscript" is actually gs_productfamily.
* Either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER will be used.
@@ -30,7 +30,7 @@ win_registry_key(char *buf, int len)
{
const char *software = "Software";
if (strlen(software) + 1 + strlen(gs_productfamily) >= len)
- return -1;
+ return -1;
strcpy(buf, software);
strcat(buf, "\\");
@@ -42,7 +42,7 @@ win_registry_key(char *buf, int len)
* Get a named registry value from HKCU.
* name, ptr, plen and return values are the same as in gp_getenv();
*/
-int
+int
win_get_reg_value(const char *name, char *ptr, int *plen)
{
HKEY hkey;
@@ -54,22 +54,22 @@ win_get_reg_value(const char *name, char *ptr, int *plen)
win_registry_key(key, sizeof(key));
if (RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_READ, &hkey)
- == ERROR_SUCCESS) {
- keytype = REG_SZ;
- cbData = *plen;
- if (bptr == (char *)NULL)
- bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
- /* if ptr is NULL */
- rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
- RegCloseKey(hkey);
- if (rc == ERROR_SUCCESS) {
- *plen = cbData;
- return 0; /* found environment variable and copied it */
- } else if (rc == ERROR_MORE_DATA) {
- /* buffer wasn't large enough */
- *plen = cbData;
- return -1;
- }
+ == ERROR_SUCCESS) {
+ keytype = REG_SZ;
+ cbData = *plen;
+ if (bptr == (char *)NULL)
+ bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
+ /* if ptr is NULL */
+ rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
+ RegCloseKey(hkey);
+ if (rc == ERROR_SUCCESS) {
+ *plen = cbData;
+ return 0; /* found environment variable and copied it */
+ } else if (rc == ERROR_MORE_DATA) {
+ /* buffer wasn't large enough */
+ *plen = cbData;
+ return -1;
+ }
}
return 1; /* not found */
}
@@ -80,7 +80,7 @@ win_get_reg_value(const char *name, char *ptr, int *plen)
* str = value of named value
* Returns 0 on success.
*/
-int
+int
win_set_reg_value(const char *name, const char *value)
{
HKEY hkey;
@@ -91,14 +91,13 @@ win_set_reg_value(const char *name, const char *value)
win_registry_key(key, sizeof(key));
rc = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_WRITE, &hkey);
if (rc != ERROR_SUCCESS)
- rc = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, "", 0,
- KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition);
+ rc = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, "", 0,
+ KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition);
if (rc == ERROR_SUCCESS) {
- rc = RegSetValueEx(hkey, name, 0, REG_SZ,
- (CONST BYTE *)value, strlen(value)+1);
- RegCloseKey(hkey);
+ rc = RegSetValueEx(hkey, name, 0, REG_SZ,
+ (CONST BYTE *)value, strlen(value)+1);
+ RegCloseKey(hkey);
}
return rc == ERROR_SUCCESS ? 0 : -1;
}
-
diff --git a/gs/psi/dwreg.h b/gs/psi/dwreg.h
index af1e4bacb..0d1111840 100644
--- a/gs/psi/dwreg.h
+++ b/gs/psi/dwreg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/dwres.h b/gs/psi/dwres.h
index 4b5e83a55..30df0c2b3 100644
--- a/gs/psi/dwres.h
+++ b/gs/psi/dwres.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/dwsetup.h b/gs/psi/dwsetup.h
index a5cc0872e..16e99353e 100644
--- a/gs/psi/dwsetup.h
+++ b/gs/psi/dwsetup.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,7 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
// $Id$
#ifndef dwsetup_INCLUDED
@@ -46,6 +45,4 @@
#define IDC_COPYRIGHT 1010
#define IDC_CJK_FONTS 1011
-
#endif /* dwsetup_INCLUDED */
-
diff --git a/gs/psi/dwtext.c b/gs/psi/dwtext.c
index 5572a3592..c8aa0c99f 100644
--- a/gs/psi/dwtext.c
+++ b/gs/psi/dwtext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -69,48 +69,48 @@ int nXinc=0;
int nYinc=0;
int cxCursor;
int cyCursor;
- cyCursor = tw->CursorPos.y * tw->CharSize.y;
- if ( (cyCursor + tw->CharSize.y > tw->ScrollPos.y + tw->ClientSize.y)
+ cyCursor = tw->CursorPos.y * tw->CharSize.y;
+ if ( (cyCursor + tw->CharSize.y > tw->ScrollPos.y + tw->ClientSize.y)
/* || (cyCursor < tw->ScrollPos.y) ) { */
/* change to scroll to end of window instead of just making visible */
/* so that ALL of error message can be seen */
- || (cyCursor < tw->ScrollPos.y+tw->ClientSize.y) ) {
- nYinc = max(0, cyCursor + tw->CharSize.y
- - tw->ClientSize.y) - tw->ScrollPos.y;
- nYinc = min(nYinc, tw->ScrollMax.y - tw->ScrollPos.y);
- }
- cxCursor = tw->CursorPos.x * tw->CharSize.x;
- if ( (cxCursor + tw->CharSize.x > tw->ScrollPos.x + tw->ClientSize.x)
- || (cxCursor < tw->ScrollPos.x) ) {
- nXinc = max(0, cxCursor + tw->CharSize.x
- - tw->ClientSize.x/2) - tw->ScrollPos.x;
- nXinc = min(nXinc, tw->ScrollMax.x - tw->ScrollPos.x);
- }
- if (nYinc || nXinc) {
- tw->ScrollPos.y += nYinc;
- tw->ScrollPos.x += nXinc;
- ScrollWindow(tw->hwnd,-nXinc,-nYinc,NULL,NULL);
- SetScrollPos(tw->hwnd,SB_VERT,tw->ScrollPos.y,TRUE);
- SetScrollPos(tw->hwnd,SB_HORZ,tw->ScrollPos.x,TRUE);
- UpdateWindow(tw->hwnd);
- }
+ || (cyCursor < tw->ScrollPos.y+tw->ClientSize.y) ) {
+ nYinc = max(0, cyCursor + tw->CharSize.y
+ - tw->ClientSize.y) - tw->ScrollPos.y;
+ nYinc = min(nYinc, tw->ScrollMax.y - tw->ScrollPos.y);
+ }
+ cxCursor = tw->CursorPos.x * tw->CharSize.x;
+ if ( (cxCursor + tw->CharSize.x > tw->ScrollPos.x + tw->ClientSize.x)
+ || (cxCursor < tw->ScrollPos.x) ) {
+ nXinc = max(0, cxCursor + tw->CharSize.x
+ - tw->ClientSize.x/2) - tw->ScrollPos.x;
+ nXinc = min(nXinc, tw->ScrollMax.x - tw->ScrollPos.x);
+ }
+ if (nYinc || nXinc) {
+ tw->ScrollPos.y += nYinc;
+ tw->ScrollPos.x += nXinc;
+ ScrollWindow(tw->hwnd,-nXinc,-nYinc,NULL,NULL);
+ SetScrollPos(tw->hwnd,SB_VERT,tw->ScrollPos.y,TRUE);
+ SetScrollPos(tw->hwnd,SB_HORZ,tw->ScrollPos.x,TRUE);
+ UpdateWindow(tw->hwnd);
+ }
}
static void
text_new_line(TW *tw)
{
- tw->CursorPos.x = 0;
- tw->CursorPos.y++;
- if (tw->CursorPos.y >= tw->ScreenSize.y) {
- int i = tw->ScreenSize.x * (tw->ScreenSize.y - 1);
- memmove(tw->ScreenBuffer, tw->ScreenBuffer+tw->ScreenSize.x, i);
- memset(tw->ScreenBuffer + i, ' ', tw->ScreenSize.x);
- tw->CursorPos.y--;
- ScrollWindow(tw->hwnd,0,-tw->CharSize.y,NULL,NULL);
- UpdateWindow(tw->hwnd);
- }
- if (tw->CursorFlag)
- text_to_cursor(tw);
+ tw->CursorPos.x = 0;
+ tw->CursorPos.y++;
+ if (tw->CursorPos.y >= tw->ScreenSize.y) {
+ int i = tw->ScreenSize.x * (tw->ScreenSize.y - 1);
+ memmove(tw->ScreenBuffer, tw->ScreenBuffer+tw->ScreenSize.x, i);
+ memset(tw->ScreenBuffer + i, ' ', tw->ScreenSize.x);
+ tw->CursorPos.y--;
+ ScrollWindow(tw->hwnd,0,-tw->CharSize.y,NULL,NULL);
+ UpdateWindow(tw->hwnd);
+ }
+ if (tw->CursorFlag)
+ text_to_cursor(tw);
/* TextMessage(); */
}
@@ -122,20 +122,19 @@ text_update_text(TW *tw, int count)
{
HDC hdc;
int xpos, ypos;
- xpos = tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x;
- ypos = tw->CursorPos.y*tw->CharSize.y - tw->ScrollPos.y;
- hdc = GetDC(tw->hwnd);
- SelectFont(hdc, tw->hfont);
- TextOut(hdc,xpos,ypos,
- (LPSTR)(tw->ScreenBuffer + tw->CursorPos.y*tw->ScreenSize.x
- + tw->CursorPos.x), count);
- (void)ReleaseDC(tw->hwnd,hdc);
- tw->CursorPos.x += count;
- if (tw->CursorPos.x >= tw->ScreenSize.x)
- text_new_line(tw);
+ xpos = tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x;
+ ypos = tw->CursorPos.y*tw->CharSize.y - tw->ScrollPos.y;
+ hdc = GetDC(tw->hwnd);
+ SelectFont(hdc, tw->hfont);
+ TextOut(hdc,xpos,ypos,
+ (LPSTR)(tw->ScreenBuffer + tw->CursorPos.y*tw->ScreenSize.x
+ + tw->CursorPos.x), count);
+ (void)ReleaseDC(tw->hwnd,hdc);
+ tw->CursorPos.x += count;
+ if (tw->CursorPos.x >= tw->ScreenSize.x)
+ text_new_line(tw);
}
-
void
text_size(TW *tw, int width, int height)
{
@@ -151,19 +150,19 @@ text_font(TW *tw, const char *name, int size)
TEXTMETRIC tm;
LPSTR p;
HDC hdc;
-
+
/* reject inappropriate arguments */
if (name == NULL)
- return;
+ return;
if (size < 4)
- return;
+ return;
/* set new name and size */
if (tw->fontname)
- free(tw->fontname);
+ free(tw->fontname);
tw->fontname = (char *)malloc(strlen(name)+1);
if (tw->fontname == NULL)
- return;
+ return;
strcpy(tw->fontname, name);
tw->fontsize = size;
@@ -175,15 +174,15 @@ text_font(TW *tw, const char *name, int size)
lf.lfPitchAndFamily = FIXED_PITCH;
lf.lfCharSet = DEFAULT_CHARSET;
if ( (p = strstr(tw->fontname," Italic")) != (LPSTR)NULL ) {
- lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0';
- lf.lfItalic = TRUE;
+ lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0';
+ lf.lfItalic = TRUE;
}
if ( (p = strstr(tw->fontname," Bold")) != (LPSTR)NULL ) {
- lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0';
- lf.lfWeight = FW_BOLD;
+ lf.lfFaceName[ (unsigned int)(p-tw->fontname) ] = '\0';
+ lf.lfWeight = FW_BOLD;
}
if (tw->hfont)
- DeleteFont(tw->hfont);
+ DeleteFont(tw->hfont);
tw->hfont = CreateFontIndirect((LOGFONT FAR *)&lf);
@@ -194,40 +193,38 @@ text_font(TW *tw, const char *name, int size)
tw->CharSize.x = tm.tmAveCharWidth;
tw->CharAscent = tm.tmAscent;
if (tw->bFocus)
- CreateCaret(tw->hwnd, 0, tw->CharSize.x, 2+tw->CaretHeight);
+ CreateCaret(tw->hwnd, 0, tw->CharSize.x, 2+tw->CaretHeight);
ReleaseDC(tw->hwnd, hdc);
/* redraw window if necessary */
if (tw->hwnd != HWND_DESKTOP) {
- /* INCOMPLETE */
+ /* INCOMPLETE */
}
}
-
-
/* Set drag strings */
void
text_drag(TW *tw, const char *pre, const char *post)
{
/* remove old strings */
if (tw->DragPre)
- free((char *)tw->DragPre);
+ free((char *)tw->DragPre);
tw->DragPre = NULL;
if (tw->DragPost)
- free((char *)tw->DragPost);
+ free((char *)tw->DragPost);
tw->DragPost = NULL;
/* add new strings */
tw->DragPre = malloc(strlen(pre)+1);
if (tw->DragPre)
- strcpy(tw->DragPre, pre);
+ strcpy(tw->DragPre, pre);
tw->DragPost = malloc(strlen(post)+1);
if (tw->DragPost)
- strcpy(tw->DragPost, post);
+ strcpy(tw->DragPost, post);
}
/* Set the window position and size */
-void
+void
text_setpos(TW *tw, int x, int y, int cx, int cy)
{
tw->x = x;
@@ -253,7 +250,7 @@ text_new(void)
TW *tw;
tw = (TW *)malloc(sizeof(TW));
if (tw == NULL)
- return NULL;
+ return NULL;
/* make sure everything is null */
memset(tw, 0, sizeof(TW));
@@ -285,31 +282,30 @@ text_destroy(TW *tw)
tw->hwnd = HWND_DESKTOP;
if (tw->hfont)
- DeleteFont(tw->hfont);
+ DeleteFont(tw->hfont);
tw->hfont = NULL;
if (tw->KeyBuf)
- free((char *)tw->KeyBuf);
+ free((char *)tw->KeyBuf);
tw->KeyBuf = NULL;
if (tw->ScreenBuffer)
- free((char *)tw->ScreenBuffer);
+ free((char *)tw->ScreenBuffer);
tw->ScreenBuffer = NULL;
if (tw->DragPre)
- free((char *)tw->DragPre);
+ free((char *)tw->DragPre);
tw->DragPre = NULL;
if (tw->DragPost)
- free((char *)tw->DragPost);
+ free((char *)tw->DragPost);
tw->DragPost = NULL;
if (tw->fontname)
- free((char *)tw->fontname);
+ free((char *)tw->fontname);
tw->fontname = NULL;
}
-
/* register the window class */
int
text_register_class(TW *tw, HICON hicon)
@@ -345,35 +341,34 @@ text_create(TW *tw, const char *app_name, int show_cmd)
/* make sure we have some sensible defaults */
if (tw->KeyBufSize < 256)
- tw->KeyBufSize = 256;
+ tw->KeyBufSize = 256;
tw->CursorPos.x = tw->CursorPos.y = 0;
tw->bFocus = FALSE;
tw->bGetCh = FALSE;
tw->CaretHeight = 0;
-
/* allocate buffers */
tw->KeyBufIn = tw->KeyBufOut = tw->KeyBuf = malloc(tw->KeyBufSize);
if (tw->KeyBuf == NULL) {
- text_error("Out of memory");
- return 1;
+ text_error("Out of memory");
+ return 1;
}
tw->ScreenBuffer = malloc(tw->ScreenSize.x * tw->ScreenSize.y);
if (tw->ScreenBuffer == NULL) {
- text_error("Out of memory");
- return 1;
+ text_error("Out of memory");
+ return 1;
}
memset(tw->ScreenBuffer, ' ', tw->ScreenSize.x * tw->ScreenSize.y);
tw->hwnd = CreateWindow(TextWinClassName, tw->Title,
- WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
- tw->x, tw->y, tw->cx, tw->cy,
- NULL, NULL, hInstance, tw);
+ WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
+ tw->x, tw->y, tw->cx, tw->cy,
+ NULL, NULL, hInstance, tw);
if (tw->hwnd == NULL) {
- MessageBox((HWND)NULL,"Couldn't open text window",(LPSTR)NULL, MB_ICONHAND | MB_SYSTEMMODAL);
- return 1;
+ MessageBox((HWND)NULL,"Couldn't open text window",(LPSTR)NULL, MB_ICONHAND | MB_SYSTEMMODAL);
+ return 1;
}
ShowWindow(tw->hwnd, tw->nCmdShow);
@@ -385,90 +380,89 @@ text_create(TW *tw, const char *app_name, int show_cmd)
return 0;
}
-
int
text_putch(TW *tw, int ch)
{
int pos;
int n;
if (tw->quitnow)
- return ch; /* don't write error message as we shut down */
+ return ch; /* don't write error message as we shut down */
switch(ch) {
- case '\r':
- tw->CursorPos.x = 0;
- if (tw->CursorFlag)
- text_to_cursor(tw);
- break;
- case '\n':
- text_new_line(tw);
- break;
- case 7:
- MessageBeep(-1);
- if (tw->CursorFlag)
- text_to_cursor(tw);
- break;
- case '\t':
- {
- for (n = 8 - (tw->CursorPos.x % 8); n>0; n-- )
- text_putch(tw, ' ');
- }
- break;
- case 0x08:
- case 0x7f:
- tw->CursorPos.x--;
- if (tw->CursorPos.x < 0) {
- tw->CursorPos.x = tw->ScreenSize.x - 1;
- tw->CursorPos.y--;
- }
- if (tw->CursorPos.y < 0)
- tw->CursorPos.y = 0;
- break;
- default:
- pos = tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
- tw->ScreenBuffer[pos] = ch;
- text_update_text(tw, 1);
+ case '\r':
+ tw->CursorPos.x = 0;
+ if (tw->CursorFlag)
+ text_to_cursor(tw);
+ break;
+ case '\n':
+ text_new_line(tw);
+ break;
+ case 7:
+ MessageBeep(-1);
+ if (tw->CursorFlag)
+ text_to_cursor(tw);
+ break;
+ case '\t':
+ {
+ for (n = 8 - (tw->CursorPos.x % 8); n>0; n-- )
+ text_putch(tw, ' ');
+ }
+ break;
+ case 0x08:
+ case 0x7f:
+ tw->CursorPos.x--;
+ if (tw->CursorPos.x < 0) {
+ tw->CursorPos.x = tw->ScreenSize.x - 1;
+ tw->CursorPos.y--;
+ }
+ if (tw->CursorPos.y < 0)
+ tw->CursorPos.y = 0;
+ break;
+ default:
+ pos = tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
+ tw->ScreenBuffer[pos] = ch;
+ text_update_text(tw, 1);
}
return ch;
}
-void
+void
text_write_buf(TW *tw, const char *str, int cnt)
{
BYTE *p;
int count, limit;
int n;
if (tw->quitnow)
- return; /* don't write error message as we shut down */
+ return; /* don't write error message as we shut down */
while (cnt>0) {
- p = tw->ScreenBuffer + tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
- limit = tw->ScreenSize.x - tw->CursorPos.x;
- for (count=0; (count < limit) && (cnt>0) &&
- (isprint((unsigned char)(*str)) || *str=='\t'); count++) {
- if (*str=='\t') {
- for (n = 8 - ((tw->CursorPos.x+count) % 8); (count < limit) & (n>0); n--, count++ )
- *p++ = ' ';
- str++;
- count--;
- }
- else {
- *p++ = *str++;
- }
- cnt--;
- }
- if (count>0) {
- text_update_text(tw, count);
- }
- if (cnt > 0) {
- if (*str=='\n') {
- text_new_line(tw);
- str++;
- cnt--;
- }
- else if (!isprint((unsigned char)(*str)) && *str!='\t') {
- text_putch(tw, *str++);
- cnt--;
- }
- }
+ p = tw->ScreenBuffer + tw->CursorPos.y*tw->ScreenSize.x + tw->CursorPos.x;
+ limit = tw->ScreenSize.x - tw->CursorPos.x;
+ for (count=0; (count < limit) && (cnt>0) &&
+ (isprint((unsigned char)(*str)) || *str=='\t'); count++) {
+ if (*str=='\t') {
+ for (n = 8 - ((tw->CursorPos.x+count) % 8); (count < limit) & (n>0); n--, count++ )
+ *p++ = ' ';
+ str++;
+ count--;
+ }
+ else {
+ *p++ = *str++;
+ }
+ cnt--;
+ }
+ if (count>0) {
+ text_update_text(tw, count);
+ }
+ if (cnt > 0) {
+ if (*str=='\n') {
+ text_new_line(tw);
+ str++;
+ cnt--;
+ }
+ else if (!isprint((unsigned char)(*str)) && *str!='\t') {
+ text_putch(tw, *str++);
+ cnt--;
+ }
+ }
}
}
@@ -479,7 +473,6 @@ text_puts(TW *tw, const char *str)
text_write_buf(tw, str, strlen(str));
}
-
/* TRUE if key hit, FALSE if no key */
int
text_kbhit(TW *tw)
@@ -497,39 +490,39 @@ text_getch(TW *tw)
text_to_cursor(tw);
tw->bGetCh = TRUE;
if (tw->bFocus) {
- SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
- tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
- - tw->CaretHeight - tw->ScrollPos.y);
- ShowCaret(tw->hwnd);
+ SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
+ tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
+ - tw->CaretHeight - tw->ScrollPos.y);
+ ShowCaret(tw->hwnd);
}
while (PeekMessage(&msg, (HWND)NULL, 0, 0, PM_NOREMOVE)) {
- if (GetMessage(&msg, (HWND)NULL, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ if (GetMessage(&msg, (HWND)NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
if (tw->quitnow)
return EOF; /* window closed */
while (!text_kbhit(tw)) {
if (!tw->quitnow) {
- if (GetMessage(&msg, (HWND)NULL, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- else
- return EOF; /* window closed */
+ if (GetMessage(&msg, (HWND)NULL, 0, 0)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ else
+ return EOF; /* window closed */
}
ch = *tw->KeyBufOut++;
if (ch=='\r')
- ch = '\n';
+ ch = '\n';
if (tw->KeyBufOut - tw->KeyBuf >= tw->KeyBufSize)
- tw->KeyBufOut = tw->KeyBuf; /* wrap around */
+ tw->KeyBufOut = tw->KeyBuf; /* wrap around */
if (tw->bFocus)
- HideCaret(tw->hwnd);
+ HideCaret(tw->hwnd);
tw->bGetCh = FALSE;
return ch;
}
@@ -542,63 +535,63 @@ text_getch(TW *tw)
*/
int
text_read_line(TW *tw, char *line, int len)
-{
+{
int ch;
if (tw->line_eof)
- return 0;
+ return 0;
while (!tw->line_complete) {
- /* we have not yet collected a full line */
+ /* we have not yet collected a full line */
ch = text_getch(tw);
- switch(ch) {
- case EOF:
- case 26: /* ^Z == EOF */
- tw->line_eof = TRUE;
- tw->line_complete = TRUE;
- break;
- case '\b': /* ^H */
- case 0x7f: /* DEL */
- if (tw->line_end) {
- text_putch(tw, '\b');
- text_putch(tw, ' ');
- text_putch(tw, '\b');
- --(tw->line_end);
- }
- break;
- case 21: /* ^U */
- while (tw->line_end) {
- text_putch(tw, '\b');
- text_putch(tw, ' ');
- text_putch(tw, '\b');
- --(tw->line_end);
- }
- break;
- case '\r':
- case '\n':
- tw->line_complete = TRUE;
- /* fall through */
- default:
- tw->line_buf[tw->line_end++] = ch;
- text_putch(tw, ch);
- break;
- }
- if (tw->line_end >= sizeof(tw->line_buf))
- tw->line_complete = TRUE;
+ switch(ch) {
+ case EOF:
+ case 26: /* ^Z == EOF */
+ tw->line_eof = TRUE;
+ tw->line_complete = TRUE;
+ break;
+ case '\b': /* ^H */
+ case 0x7f: /* DEL */
+ if (tw->line_end) {
+ text_putch(tw, '\b');
+ text_putch(tw, ' ');
+ text_putch(tw, '\b');
+ --(tw->line_end);
+ }
+ break;
+ case 21: /* ^U */
+ while (tw->line_end) {
+ text_putch(tw, '\b');
+ text_putch(tw, ' ');
+ text_putch(tw, '\b');
+ --(tw->line_end);
+ }
+ break;
+ case '\r':
+ case '\n':
+ tw->line_complete = TRUE;
+ /* fall through */
+ default:
+ tw->line_buf[tw->line_end++] = ch;
+ text_putch(tw, ch);
+ break;
+ }
+ if (tw->line_end >= sizeof(tw->line_buf))
+ tw->line_complete = TRUE;
}
if (tw->quitnow)
- return -1;
+ return -1;
if (tw->line_complete) {
- /* We either filled the buffer or got CR, LF or EOF */
- int count = min(len, tw->line_end - tw->line_start);
- memcpy(line, tw->line_buf + tw->line_start, count);
- tw->line_start += count;
- if (tw->line_start == tw->line_end) {
- tw->line_start = tw->line_end = 0;
- tw->line_complete = FALSE;
- }
- return count;
+ /* We either filled the buffer or got CR, LF or EOF */
+ int count = min(len, tw->line_end - tw->line_start);
+ memcpy(line, tw->line_buf + tw->line_start, count);
+ tw->line_start += count;
+ if (tw->line_start == tw->line_end) {
+ tw->line_start = tw->line_end = 0;
+ tw->line_complete = FALSE;
+ }
+ return count;
}
return 0;
@@ -613,41 +606,40 @@ LPSTR dest = line;
LPSTR limit = dest + len; /* don't leave room for '\0' */
int ch;
do {
- if (dest >= limit)
- break;
- ch = text_getch(tw);
- switch(ch) {
- case 26: /* ^Z == EOF */
- return 0;
- case '\b': /* ^H */
- case 0x7f: /* DEL */
- if (dest > line) {
- text_putch(tw, '\b');
- text_putch(tw, ' ');
- text_putch(tw, '\b');
- --dest;
- }
- break;
- case 21: /* ^U */
- while (dest > line) {
- text_putch(tw, '\b');
- text_putch(tw, ' ');
- text_putch(tw, '\b');
- --dest;
- }
- break;
- default:
- *dest++ = ch;
- text_putch(tw, ch);
- break;
- }
+ if (dest >= limit)
+ break;
+ ch = text_getch(tw);
+ switch(ch) {
+ case 26: /* ^Z == EOF */
+ return 0;
+ case '\b': /* ^H */
+ case 0x7f: /* DEL */
+ if (dest > line) {
+ text_putch(tw, '\b');
+ text_putch(tw, ' ');
+ text_putch(tw, '\b');
+ --dest;
+ }
+ break;
+ case 21: /* ^U */
+ while (dest > line) {
+ text_putch(tw, '\b');
+ text_putch(tw, ' ');
+ text_putch(tw, '\b');
+ --dest;
+ }
+ break;
+ default:
+ *dest++ = ch;
+ text_putch(tw, ch);
+ break;
+ }
} while (ch != '\n');
*dest = '\0';
return (dest-line);
}
-
/* Windows 3.1 drag-drop feature */
void
text_drag_drop(TW *tw, HDROP hdrop)
@@ -657,33 +649,32 @@ text_drag_drop(TW *tw, HDROP hdrop)
unsigned int Len, error;
const char *p;
if ( (tw->DragPre==NULL) || (tw->DragPost==NULL) )
- return;
+ return;
cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
for (i=0; i<cFiles; i++) {
- Len = DragQueryFile(hdrop, i, NULL, 0);
- szFile = (char *)malloc(Len+1);
- if (szFile != 0) {
- error = DragQueryFile(hdrop, i, szFile, Len+1);
- if (error != 0) {
- for (p=tw->DragPre; *p; p++)
- SendMessage(tw->hwnd,WM_CHAR,*p,1L);
- for (p=szFile; *p; p++) {
- if (*p == '\\')
- SendMessage(tw->hwnd,WM_CHAR,'/',1L);
- else
- SendMessage(tw->hwnd,WM_CHAR,*p,1L);
- }
- for (p=tw->DragPost; *p; p++)
- SendMessage(tw->hwnd,WM_CHAR,*p,1L);
- }
- free(szFile);
- }
+ Len = DragQueryFile(hdrop, i, NULL, 0);
+ szFile = (char *)malloc(Len+1);
+ if (szFile != 0) {
+ error = DragQueryFile(hdrop, i, szFile, Len+1);
+ if (error != 0) {
+ for (p=tw->DragPre; *p; p++)
+ SendMessage(tw->hwnd,WM_CHAR,*p,1L);
+ for (p=szFile; *p; p++) {
+ if (*p == '\\')
+ SendMessage(tw->hwnd,WM_CHAR,'/',1L);
+ else
+ SendMessage(tw->hwnd,WM_CHAR,*p,1L);
+ }
+ for (p=tw->DragPost; *p; p++)
+ SendMessage(tw->hwnd,WM_CHAR,*p,1L);
+ }
+ free(szFile);
+ }
}
DragFinish(hdrop);
}
-
void
text_copy_to_clipboard(TW *tw)
{
@@ -699,21 +690,21 @@ text_copy_to_clipboard(TW *tw)
hGMem = GlobalAlloc(GHND | GMEM_SHARE, (DWORD)size);
cbuf = cp = (LPSTR)GlobalLock(hGMem);
if (cp == (LPSTR)NULL)
- return;
-
+ return;
+
for (i=0; i<tw->ScreenSize.y; i++) {
- count = tw->ScreenSize.x;
- memcpy(cp, tw->ScreenBuffer + tw->ScreenSize.x*i, count);
- /* remove trailing spaces */
- for (count=count-1; count>=0; count--) {
- if (cp[count]!=' ')
- break;
- cp[count] = '\0';
- }
- cp[++count] = '\r';
- cp[++count] = '\n';
- cp[++count] = '\0';
- cp += count;
+ count = tw->ScreenSize.x;
+ memcpy(cp, tw->ScreenBuffer + tw->ScreenSize.x*i, count);
+ /* remove trailing spaces */
+ for (count=count-1; count>=0; count--) {
+ if (cp[count]!=' ')
+ break;
+ cp[count] = '\0';
+ }
+ cp[++count] = '\r';
+ cp[++count] = '\n';
+ cp[++count] = '\0';
+ cp += count;
}
size = strlen(cbuf) + 1;
GlobalUnlock(hGMem);
@@ -723,9 +714,9 @@ text_copy_to_clipboard(TW *tw)
SelectFont(hdc, tw->hfont);
GetTextMetrics(hdc,(TEXTMETRIC FAR *)&tm);
if (tm.tmCharSet == OEM_CHARSET)
- type = CF_OEMTEXT;
+ type = CF_OEMTEXT;
else
- type = CF_TEXT;
+ type = CF_TEXT;
ReleaseDC(tw->hwnd, hdc);
/* give buffer to clipboard */
OpenClipboard(tw->hwnd);
@@ -742,21 +733,21 @@ text_paste_from_clipboard(TW *tw)
long count;
OpenClipboard(tw->hwnd);
if (IsClipboardFormatAvailable(CF_TEXT)) {
- hClipMemory = GetClipboardData(CF_TEXT);
- p = GlobalLock(hClipMemory);
- while (*p) {
- /* transfer to keyboard circular buffer */
- count = tw->KeyBufIn - tw->KeyBufOut;
- if (count < 0)
- count += tw->KeyBufSize;
- if (count < tw->KeyBufSize-1) {
- *tw->KeyBufIn++ = *p;
- if (tw->KeyBufIn - tw->KeyBuf >= tw->KeyBufSize)
- tw->KeyBufIn = tw->KeyBuf; /* wrap around */
- }
- p++;
- }
- GlobalUnlock(hClipMemory);
+ hClipMemory = GetClipboardData(CF_TEXT);
+ p = GlobalLock(hClipMemory);
+ while (*p) {
+ /* transfer to keyboard circular buffer */
+ count = tw->KeyBufIn - tw->KeyBufOut;
+ if (count < 0)
+ count += tw->KeyBufSize;
+ if (count < tw->KeyBufSize-1) {
+ *tw->KeyBufIn++ = *p;
+ if (tw->KeyBufIn - tw->KeyBuf >= tw->KeyBufSize)
+ tw->KeyBufIn = tw->KeyBuf; /* wrap around */
+ }
+ p++;
+ }
+ GlobalUnlock(hClipMemory);
}
CloseClipboard();
}
@@ -771,319 +762,317 @@ WndTextProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int nYinc, nXinc;
TW *tw;
if (message == WM_CREATE) {
- /* Object is stored in window extra data.
- * Nothing must try to use the object before WM_CREATE
- * initializes it here.
- */
- tw = (TW *)(((CREATESTRUCT FAR *)lParam)->lpCreateParams);
- SetWindowLong(hwnd, 0, (LONG)tw);
+ /* Object is stored in window extra data.
+ * Nothing must try to use the object before WM_CREATE
+ * initializes it here.
+ */
+ tw = (TW *)(((CREATESTRUCT FAR *)lParam)->lpCreateParams);
+ SetWindowLong(hwnd, 0, (LONG)tw);
}
tw = (TW *)GetWindowLong(hwnd, 0);
switch(message) {
- case WM_SYSCOMMAND:
- switch(LOWORD(wParam)) {
- case M_COPY_CLIP:
- text_copy_to_clipboard(tw);
- return 0;
- case M_PASTE_CLIP:
- text_paste_from_clipboard(tw);
- return 0;
- }
- break;
- case WM_SETFOCUS:
- tw->bFocus = TRUE;
- CreateCaret(hwnd, 0, tw->CharSize.x, 2+tw->CaretHeight);
- SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
- tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
- - tw->CaretHeight - tw->ScrollPos.y);
- if (tw->bGetCh)
- ShowCaret(hwnd);
- break;
- case WM_KILLFOCUS:
- DestroyCaret();
- tw->bFocus = FALSE;
- break;
- case WM_MOVE:
- if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
- GetWindowRect(hwnd, &rect);
- tw->x = rect.left;
- tw->y = rect.top;
- }
- break;
- case WM_SIZE:
- if (wParam == SIZE_MINIMIZED)
- return(0);
-
- /* remember current window size */
- if (wParam != SIZE_MAXIMIZED) {
- GetWindowRect(hwnd, &rect);
- tw->cx = rect.right - rect.left;
- tw->cy = rect.bottom - rect.top;
- tw->x = rect.left;
- tw->y = rect.top;
- }
-
- tw->ClientSize.y = HIWORD(lParam);
- tw->ClientSize.x = LOWORD(lParam);
-
- tw->ScrollMax.y = max(0, tw->CharSize.y*tw->ScreenSize.y - tw->ClientSize.y);
- tw->ScrollPos.y = min(tw->ScrollPos.y, tw->ScrollMax.y);
-
- SetScrollRange(hwnd, SB_VERT, 0, tw->ScrollMax.y, FALSE);
- SetScrollPos(hwnd, SB_VERT, tw->ScrollPos.y, TRUE);
-
- tw->ScrollMax.x = max(0, tw->CharSize.x*tw->ScreenSize.x - tw->ClientSize.x);
- tw->ScrollPos.x = min(tw->ScrollPos.x, tw->ScrollMax.x);
-
- SetScrollRange(hwnd, SB_HORZ, 0, tw->ScrollMax.x, FALSE);
- SetScrollPos(hwnd, SB_HORZ, tw->ScrollPos.x, TRUE);
-
- if (tw->bFocus && tw->bGetCh) {
- SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
- tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
- - tw->CaretHeight - tw->ScrollPos.y);
- ShowCaret(hwnd);
- }
- return(0);
- case WM_VSCROLL:
- switch(LOWORD(wParam)) {
- case SB_TOP:
- nYinc = -tw->ScrollPos.y;
- break;
- case SB_BOTTOM:
- nYinc = tw->ScrollMax.y - tw->ScrollPos.y;
- break;
- case SB_LINEUP:
- nYinc = -tw->CharSize.y;
- break;
- case SB_LINEDOWN:
- nYinc = tw->CharSize.y;
- break;
- case SB_PAGEUP:
- nYinc = min(-1,-tw->ClientSize.y);
- break;
- case SB_PAGEDOWN:
- nYinc = max(1,tw->ClientSize.y);
- break;
- case SB_THUMBPOSITION:
- nYinc = HIWORD(wParam) - tw->ScrollPos.y;
- break;
- default:
- nYinc = 0;
- }
- if ( (nYinc = max(-tw->ScrollPos.y,
- min(nYinc, tw->ScrollMax.y - tw->ScrollPos.y)))
- != 0 ) {
- tw->ScrollPos.y += nYinc;
- ScrollWindow(hwnd,0,-nYinc,NULL,NULL);
- SetScrollPos(hwnd,SB_VERT,tw->ScrollPos.y,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_HSCROLL:
- switch(LOWORD(wParam)) {
- case SB_LINEUP:
- nXinc = -tw->CharSize.x;
- break;
- case SB_LINEDOWN:
- nXinc = tw->CharSize.x;
- break;
- case SB_PAGEUP:
- nXinc = min(-1,-tw->ClientSize.x);
- break;
- case SB_PAGEDOWN:
- nXinc = max(1,tw->ClientSize.x);
- break;
- case SB_THUMBPOSITION:
- nXinc = HIWORD(wParam) - tw->ScrollPos.x;
- break;
- default:
- nXinc = 0;
- }
- if ( (nXinc = max(-tw->ScrollPos.x,
- min(nXinc, tw->ScrollMax.x - tw->ScrollPos.x)))
- != 0 ) {
- tw->ScrollPos.x += nXinc;
- ScrollWindow(hwnd,-nXinc,0,NULL,NULL);
- SetScrollPos(hwnd,SB_HORZ,tw->ScrollPos.x,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_KEYDOWN:
- switch(wParam) {
- case VK_HOME:
- SendMessage(hwnd, WM_VSCROLL, SB_TOP, (LPARAM)0);
- break;
- case VK_END:
- SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, (LPARAM)0);
- break;
- case VK_PRIOR:
- SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, (LPARAM)0);
- break;
- case VK_NEXT:
- SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, (LPARAM)0);
- break;
- case VK_UP:
- SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, (LPARAM)0);
- break;
- case VK_DOWN:
- SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, (LPARAM)0);
- break;
- case VK_LEFT:
- SendMessage(hwnd, WM_HSCROLL, SB_LINEUP, (LPARAM)0);
- break;
- case VK_RIGHT:
- SendMessage(hwnd, WM_HSCROLL, SB_LINEDOWN, (LPARAM)0);
- break;
- }
- break;
- case WM_CHAR:
- { /* store key in circular buffer */
- long count = tw->KeyBufIn - tw->KeyBufOut;
- if (count < 0) count += tw->KeyBufSize;
- if (count < tw->KeyBufSize-1) {
- *tw->KeyBufIn++ = wParam;
- if (tw->KeyBufIn - tw->KeyBuf >= tw->KeyBufSize)
- tw->KeyBufIn = tw->KeyBuf; /* wrap around */
- }
- }
- return(0);
- case WM_PAINT:
- {
- POINT source, width, dest;
- hdc = BeginPaint(hwnd, &ps);
- SelectFont(hdc, tw->hfont);
- SetMapMode(hdc, MM_TEXT);
- SetBkMode(hdc,OPAQUE);
- GetClientRect(hwnd, &rect);
- source.x = (rect.left + tw->ScrollPos.x) / tw->CharSize.x; /* source */
- source.y = (rect.top + tw->ScrollPos.y) / tw->CharSize.y;
- dest.x = source.x * tw->CharSize.x - tw->ScrollPos.x; /* destination */
- dest.y = source.y * tw->CharSize.y - tw->ScrollPos.y;
- width.x = ((rect.right + tw->ScrollPos.x + tw->CharSize.x - 1) / tw->CharSize.x) - source.x; /* width */
- width.y = ((rect.bottom + tw->ScrollPos.y + tw->CharSize.y - 1) / tw->CharSize.y) - source.y;
- if (source.x < 0)
- source.x = 0;
- if (source.y < 0)
- source.y = 0;
- if (source.x+width.x > tw->ScreenSize.x)
- width.x = tw->ScreenSize.x - source.x;
- if (source.y+width.y > tw->ScreenSize.y)
- width.y = tw->ScreenSize.y - source.y;
- /* for each line */
- while (width.y>0) {
- TextOut(hdc,dest.x,dest.y,
- (LPSTR)(tw->ScreenBuffer + source.y*tw->ScreenSize.x + source.x),
- width.x);
- dest.y += tw->CharSize.y;
- source.y++;
- width.y--;
- }
- EndPaint(hwnd, &ps);
- return 0;
- }
- case WM_DROPFILES:
- text_drag_drop(tw, (HDROP)wParam);
- break;
- case WM_CREATE:
- {
- RECT crect, wrect;
- int cx, cy;
-
- tw->hwnd = hwnd;
-
- /* make window no larger than screen buffer */
- GetWindowRect(hwnd, &wrect);
- GetClientRect(hwnd, &crect);
- cx = min(tw->CharSize.x*tw->ScreenSize.x, crect.right);
- cy = min(tw->CharSize.y*tw->ScreenSize.y, crect.bottom);
- MoveWindow(hwnd, wrect.left, wrect.top,
- wrect.right-wrect.left + (cx - crect.right),
- wrect.bottom-wrect.top + (cy - crect.bottom),
- TRUE);
-
- if ( (tw->DragPre!=(LPSTR)NULL) && (tw->DragPost!=(LPSTR)NULL) )
- DragAcceptFiles(hwnd, TRUE);
- }
- break;
- case WM_CLOSE:
- /* Tell user that we heard them */
- if (!tw->quitnow) {
- char title[256];
- int count = GetWindowText(hwnd, title, sizeof(title)-11);
- strcpy(title+count, " - closing");
- SetWindowText(hwnd, title);
- }
- tw->quitnow = TRUE;
- /* wait until Ghostscript exits before destroying window */
- return 0;
- case WM_DESTROY:
- DragAcceptFiles(hwnd, FALSE);
- if (tw->hfont)
- DeleteFont(tw->hfont);
- tw->hfont = (HFONT)0;
- tw->quitnow = TRUE;
- PostQuitMessage(0);
- break;
+ case WM_SYSCOMMAND:
+ switch(LOWORD(wParam)) {
+ case M_COPY_CLIP:
+ text_copy_to_clipboard(tw);
+ return 0;
+ case M_PASTE_CLIP:
+ text_paste_from_clipboard(tw);
+ return 0;
+ }
+ break;
+ case WM_SETFOCUS:
+ tw->bFocus = TRUE;
+ CreateCaret(hwnd, 0, tw->CharSize.x, 2+tw->CaretHeight);
+ SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
+ tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
+ - tw->CaretHeight - tw->ScrollPos.y);
+ if (tw->bGetCh)
+ ShowCaret(hwnd);
+ break;
+ case WM_KILLFOCUS:
+ DestroyCaret();
+ tw->bFocus = FALSE;
+ break;
+ case WM_MOVE:
+ if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
+ GetWindowRect(hwnd, &rect);
+ tw->x = rect.left;
+ tw->y = rect.top;
+ }
+ break;
+ case WM_SIZE:
+ if (wParam == SIZE_MINIMIZED)
+ return(0);
+
+ /* remember current window size */
+ if (wParam != SIZE_MAXIMIZED) {
+ GetWindowRect(hwnd, &rect);
+ tw->cx = rect.right - rect.left;
+ tw->cy = rect.bottom - rect.top;
+ tw->x = rect.left;
+ tw->y = rect.top;
+ }
+
+ tw->ClientSize.y = HIWORD(lParam);
+ tw->ClientSize.x = LOWORD(lParam);
+
+ tw->ScrollMax.y = max(0, tw->CharSize.y*tw->ScreenSize.y - tw->ClientSize.y);
+ tw->ScrollPos.y = min(tw->ScrollPos.y, tw->ScrollMax.y);
+
+ SetScrollRange(hwnd, SB_VERT, 0, tw->ScrollMax.y, FALSE);
+ SetScrollPos(hwnd, SB_VERT, tw->ScrollPos.y, TRUE);
+
+ tw->ScrollMax.x = max(0, tw->CharSize.x*tw->ScreenSize.x - tw->ClientSize.x);
+ tw->ScrollPos.x = min(tw->ScrollPos.x, tw->ScrollMax.x);
+
+ SetScrollRange(hwnd, SB_HORZ, 0, tw->ScrollMax.x, FALSE);
+ SetScrollPos(hwnd, SB_HORZ, tw->ScrollPos.x, TRUE);
+
+ if (tw->bFocus && tw->bGetCh) {
+ SetCaretPos(tw->CursorPos.x*tw->CharSize.x - tw->ScrollPos.x,
+ tw->CursorPos.y*tw->CharSize.y + tw->CharAscent
+ - tw->CaretHeight - tw->ScrollPos.y);
+ ShowCaret(hwnd);
+ }
+ return(0);
+ case WM_VSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_TOP:
+ nYinc = -tw->ScrollPos.y;
+ break;
+ case SB_BOTTOM:
+ nYinc = tw->ScrollMax.y - tw->ScrollPos.y;
+ break;
+ case SB_LINEUP:
+ nYinc = -tw->CharSize.y;
+ break;
+ case SB_LINEDOWN:
+ nYinc = tw->CharSize.y;
+ break;
+ case SB_PAGEUP:
+ nYinc = min(-1,-tw->ClientSize.y);
+ break;
+ case SB_PAGEDOWN:
+ nYinc = max(1,tw->ClientSize.y);
+ break;
+ case SB_THUMBPOSITION:
+ nYinc = HIWORD(wParam) - tw->ScrollPos.y;
+ break;
+ default:
+ nYinc = 0;
+ }
+ if ( (nYinc = max(-tw->ScrollPos.y,
+ min(nYinc, tw->ScrollMax.y - tw->ScrollPos.y)))
+ != 0 ) {
+ tw->ScrollPos.y += nYinc;
+ ScrollWindow(hwnd,0,-nYinc,NULL,NULL);
+ SetScrollPos(hwnd,SB_VERT,tw->ScrollPos.y,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_HSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_LINEUP:
+ nXinc = -tw->CharSize.x;
+ break;
+ case SB_LINEDOWN:
+ nXinc = tw->CharSize.x;
+ break;
+ case SB_PAGEUP:
+ nXinc = min(-1,-tw->ClientSize.x);
+ break;
+ case SB_PAGEDOWN:
+ nXinc = max(1,tw->ClientSize.x);
+ break;
+ case SB_THUMBPOSITION:
+ nXinc = HIWORD(wParam) - tw->ScrollPos.x;
+ break;
+ default:
+ nXinc = 0;
+ }
+ if ( (nXinc = max(-tw->ScrollPos.x,
+ min(nXinc, tw->ScrollMax.x - tw->ScrollPos.x)))
+ != 0 ) {
+ tw->ScrollPos.x += nXinc;
+ ScrollWindow(hwnd,-nXinc,0,NULL,NULL);
+ SetScrollPos(hwnd,SB_HORZ,tw->ScrollPos.x,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_KEYDOWN:
+ switch(wParam) {
+ case VK_HOME:
+ SendMessage(hwnd, WM_VSCROLL, SB_TOP, (LPARAM)0);
+ break;
+ case VK_END:
+ SendMessage(hwnd, WM_VSCROLL, SB_BOTTOM, (LPARAM)0);
+ break;
+ case VK_PRIOR:
+ SendMessage(hwnd, WM_VSCROLL, SB_PAGEUP, (LPARAM)0);
+ break;
+ case VK_NEXT:
+ SendMessage(hwnd, WM_VSCROLL, SB_PAGEDOWN, (LPARAM)0);
+ break;
+ case VK_UP:
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEUP, (LPARAM)0);
+ break;
+ case VK_DOWN:
+ SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, (LPARAM)0);
+ break;
+ case VK_LEFT:
+ SendMessage(hwnd, WM_HSCROLL, SB_LINEUP, (LPARAM)0);
+ break;
+ case VK_RIGHT:
+ SendMessage(hwnd, WM_HSCROLL, SB_LINEDOWN, (LPARAM)0);
+ break;
+ }
+ break;
+ case WM_CHAR:
+ { /* store key in circular buffer */
+ long count = tw->KeyBufIn - tw->KeyBufOut;
+ if (count < 0) count += tw->KeyBufSize;
+ if (count < tw->KeyBufSize-1) {
+ *tw->KeyBufIn++ = wParam;
+ if (tw->KeyBufIn - tw->KeyBuf >= tw->KeyBufSize)
+ tw->KeyBufIn = tw->KeyBuf; /* wrap around */
+ }
+ }
+ return(0);
+ case WM_PAINT:
+ {
+ POINT source, width, dest;
+ hdc = BeginPaint(hwnd, &ps);
+ SelectFont(hdc, tw->hfont);
+ SetMapMode(hdc, MM_TEXT);
+ SetBkMode(hdc,OPAQUE);
+ GetClientRect(hwnd, &rect);
+ source.x = (rect.left + tw->ScrollPos.x) / tw->CharSize.x; /* source */
+ source.y = (rect.top + tw->ScrollPos.y) / tw->CharSize.y;
+ dest.x = source.x * tw->CharSize.x - tw->ScrollPos.x; /* destination */
+ dest.y = source.y * tw->CharSize.y - tw->ScrollPos.y;
+ width.x = ((rect.right + tw->ScrollPos.x + tw->CharSize.x - 1) / tw->CharSize.x) - source.x; /* width */
+ width.y = ((rect.bottom + tw->ScrollPos.y + tw->CharSize.y - 1) / tw->CharSize.y) - source.y;
+ if (source.x < 0)
+ source.x = 0;
+ if (source.y < 0)
+ source.y = 0;
+ if (source.x+width.x > tw->ScreenSize.x)
+ width.x = tw->ScreenSize.x - source.x;
+ if (source.y+width.y > tw->ScreenSize.y)
+ width.y = tw->ScreenSize.y - source.y;
+ /* for each line */
+ while (width.y>0) {
+ TextOut(hdc,dest.x,dest.y,
+ (LPSTR)(tw->ScreenBuffer + source.y*tw->ScreenSize.x + source.x),
+ width.x);
+ dest.y += tw->CharSize.y;
+ source.y++;
+ width.y--;
+ }
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ case WM_DROPFILES:
+ text_drag_drop(tw, (HDROP)wParam);
+ break;
+ case WM_CREATE:
+ {
+ RECT crect, wrect;
+ int cx, cy;
+
+ tw->hwnd = hwnd;
+
+ /* make window no larger than screen buffer */
+ GetWindowRect(hwnd, &wrect);
+ GetClientRect(hwnd, &crect);
+ cx = min(tw->CharSize.x*tw->ScreenSize.x, crect.right);
+ cy = min(tw->CharSize.y*tw->ScreenSize.y, crect.bottom);
+ MoveWindow(hwnd, wrect.left, wrect.top,
+ wrect.right-wrect.left + (cx - crect.right),
+ wrect.bottom-wrect.top + (cy - crect.bottom),
+ TRUE);
+
+ if ( (tw->DragPre!=(LPSTR)NULL) && (tw->DragPost!=(LPSTR)NULL) )
+ DragAcceptFiles(hwnd, TRUE);
+ }
+ break;
+ case WM_CLOSE:
+ /* Tell user that we heard them */
+ if (!tw->quitnow) {
+ char title[256];
+ int count = GetWindowText(hwnd, title, sizeof(title)-11);
+ strcpy(title+count, " - closing");
+ SetWindowText(hwnd, title);
+ }
+ tw->quitnow = TRUE;
+ /* wait until Ghostscript exits before destroying window */
+ return 0;
+ case WM_DESTROY:
+ DragAcceptFiles(hwnd, FALSE);
+ if (tw->hfont)
+ DeleteFont(tw->hfont);
+ tw->hfont = (HFONT)0;
+ tw->quitnow = TRUE;
+ PostQuitMessage(0);
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
-
HWND text_get_handle(TW *tw)
{
return tw->hwnd;
}
-
#ifdef NOTUSED
/* test program */
#pragma argsused
-int PASCAL
+int PASCAL
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
- /* make a test window */
- tw = text_new();
-
- if (!hPrevInstance) {
- HICON hicon = LoadIcon(NULL, IDI_APPLICATION);
- text_register_class(hicon);
- }
- text_font(tw, "Courier New", 10);
- text_size(tw, 80, 80);
- text_drag(tw, "(", ") run\r");
-
- /* show the text window */
- if (!text_create(tw, "Application Name", nCmdShow)) {
- /* do the real work here */
- /* TESTING */
- int ch;
- int len;
- char *line = new char[256];
- while ( (len = text_read_line(tw, line, 256-1)) != 0 ) {
- text_write_buf(tw, line, len);
- }
+ /* make a test window */
+ tw = text_new();
+
+ if (!hPrevInstance) {
+ HICON hicon = LoadIcon(NULL, IDI_APPLICATION);
+ text_register_class(hicon);
+ }
+ text_font(tw, "Courier New", 10);
+ text_size(tw, 80, 80);
+ text_drag(tw, "(", ") run\r");
+
+ /* show the text window */
+ if (!text_create(tw, "Application Name", nCmdShow)) {
+ /* do the real work here */
+ /* TESTING */
+ int ch;
+ int len;
+ char *line = new char[256];
+ while ( (len = text_read_line(tw, line, 256-1)) != 0 ) {
+ text_write_buf(tw, line, len);
+ }
/*
- while ( text_gets(tw, line, 256-1) ) {
- text_puts(tw, line);
- }
+ while ( text_gets(tw, line, 256-1) ) {
+ text_puts(tw, line);
+ }
*/
/*
- while ( (ch = text_getch(tw, )) != 4 )
- text_putch(tw, ch);
+ while ( (ch = text_getch(tw, )) != 4 )
+ text_putch(tw, ch);
*/
- }
- else {
-
- }
-
- /* clean up */
- text_destroy(tw);
-
- /* end program */
- return 0;
+ }
+ else {
+
+ }
+
+ /* clean up */
+ text_destroy(tw);
+
+ /* end program */
+ return 0;
}
#endif
diff --git a/gs/psi/dwtext.h b/gs/psi/dwtext.h
index af09aee62..a7e381f57 100644
--- a/gs/psi/dwtext.h
+++ b/gs/psi/dwtext.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,12 +17,10 @@
#ifndef dwtext_INCLUDED
# define dwtext_INCLUDED
-
#ifdef _WINDOWS
#define _Windows
#endif
-
typedef struct TEXTWINDOW_S {
const char *Title; /* required */
HICON hIcon; /* optional */
@@ -66,7 +64,6 @@ typedef struct TEXTWINDOW_S {
int x, y, cx, cy; /* window position */
} TW;
-
/* Create new TW structure */
TW *text_new(void);
@@ -128,7 +125,7 @@ int text_getpos(TW *tw, int *px, int *py, int *pcx, int *pcy);
/* Set pre drag and post drag strings
* If a file is dropped on the window, the following will
- * be poked into the keyboard buffer:
+ * be poked into the keyboard buffer:
* the pre_drag string
* the file name
* the post_drag string
@@ -140,5 +137,4 @@ HWND text_get_handle(TW *tw);
/* ================================== */
-
#endif /* dwtext_INCLUDED */
diff --git a/gs/psi/dwtrace.c b/gs/psi/dwtrace.c
index 1885339e7..dd764e27d 100644
--- a/gs/psi/dwtrace.c
+++ b/gs/psi/dwtrace.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,12 +64,12 @@ static void get_window()
image_open(host.tw);
UpdateWindow(host.tw->hwnd);
}
- host.hdc = NULL;
- host.count_GetDC = 0;
- host.window_height = 100;
- host.line_width = 1;
- host.color = 0;
- host.inited = true;
+ host.hdc = NULL;
+ host.count_GetDC = 0;
+ host.window_height = 100;
+ host.line_width = 1;
+ host.color = 0;
+ host.inited = true;
}
}
@@ -88,10 +88,10 @@ static inline void delete_pen_brush(vd_trace_interface *I)
{ SelectObject(I->host->hdc, I->host->pen0);
SelectObject(I->host->hdc, I->host->brush0);
if(I->host->pen != NULL)
- DeleteObject(I->host->pen);
+ DeleteObject(I->host->pen);
I->host->pen = NULL;
if(I->host->brush != NULL)
- DeleteObject(I->host->brush);
+ DeleteObject(I->host->brush);
I->host->brush = NULL;
}
@@ -105,8 +105,8 @@ static inline void new_pen_brush(vd_trace_interface *I)
static double dw_gt_get_size_x(vd_trace_interface *I)
{ RECT r;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return(100);
GetClientRect(I->host->tw->hwnd,&r);
return r.right - r.left;
@@ -114,46 +114,46 @@ static double dw_gt_get_size_x(vd_trace_interface *I)
static double dw_gt_get_size_y(vd_trace_interface *I)
{ RECT r;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return(100);
GetClientRect(I->host->tw->hwnd,&r);
return r.bottom - r.top;
}
static void dw_gt_get_dc(vd_trace_interface *I, vd_trace_interface **I1)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
if (I->host->hdc == NULL) {
- RECT r;
- I->host->hdc = GetDC(I->host->tw->hwnd);
- SetMapMode(I->host->hdc,MM_TEXT);
- GetClientRect(I->host->tw->hwnd, &r);
- I->host->window_height = r.bottom;
- SetBkMode(I->host->hdc,TRANSPARENT);
- I->host->pen0 = (HPEN)SelectObject(I->host->hdc, GetStockObject(BLACK_PEN));
- I->host->brush0 = (HBRUSH)SelectObject(I->host->hdc, GetStockObject(BLACK_BRUSH));
- I->host->color = 0;
- I->host->count_GetDC = 1;
+ RECT r;
+ I->host->hdc = GetDC(I->host->tw->hwnd);
+ SetMapMode(I->host->hdc,MM_TEXT);
+ GetClientRect(I->host->tw->hwnd, &r);
+ I->host->window_height = r.bottom;
+ SetBkMode(I->host->hdc,TRANSPARENT);
+ I->host->pen0 = (HPEN)SelectObject(I->host->hdc, GetStockObject(BLACK_PEN));
+ I->host->brush0 = (HBRUSH)SelectObject(I->host->hdc, GetStockObject(BLACK_BRUSH));
+ I->host->color = 0;
+ I->host->count_GetDC = 1;
*I1 = I;
} else
- ++I->host->count_GetDC;
+ ++I->host->count_GetDC;
}
static void dw_gt_release_dc(vd_trace_interface *I, vd_trace_interface **I1)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
--I->host->count_GetDC;
if(I->host->count_GetDC == 0) {
- ReleaseDC(I->host->tw->hwnd, I->host->hdc);
- I->host->hdc = NULL;
- delete_pen_brush(I);
+ ReleaseDC(I->host->tw->hwnd, I->host->hdc);
+ I->host->hdc = NULL;
+ delete_pen_brush(I);
*I1 = NULL;
} else if(I->host->count_GetDC < 0) {
/* safety : */
- I->host->count_GetDC = 0;
+ I->host->count_GetDC = 0;
*I1 = NULL;
}
}
@@ -162,8 +162,8 @@ static void dw_gt_erase(vd_trace_interface *I, unsigned long rgbcolor)
{ HWND hwnd;
RECT r;
HBRUSH hbr;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return;
hwnd = I->host->tw->hwnd;
GetClientRect(hwnd, &r);
@@ -173,23 +173,23 @@ static void dw_gt_erase(vd_trace_interface *I, unsigned long rgbcolor)
}
static void dw_gt_beg_path(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
BeginPath(I->host->hdc);
}
static void dw_gt_end_path(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
EndPath(I->host->hdc);
}
static void dw_gt_moveto(vd_trace_interface *I, double x, double y)
{ POINT p;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return;
#ifdef __WIN32__
MoveToEx(I->host->hdc, SX(x), SY(y), &p);
@@ -200,16 +200,16 @@ static void dw_gt_moveto(vd_trace_interface *I, double x, double y)
}
static void dw_gt_lineto(vd_trace_interface *I, double x, double y)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
LineTo(I->host->hdc, SX(x), SY(y));
}
static void dw_gt_curveto(vd_trace_interface *I, double x0, double y0, double x1, double y1, double x2, double y2)
{ POINT p[3];
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return;
p[0].x = SX(x0), p[0].y = SY(y0);
p[1].x = SX(x1), p[1].y = SY(y1);
@@ -218,8 +218,8 @@ static void dw_gt_curveto(vd_trace_interface *I, double x0, double y0, double x1
}
static void dw_gt_closepath(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
LineTo(I->host->hdc, SX(I->host->bx), SY(I->host->by));
CloseFigure(I->host->hdc);
@@ -227,8 +227,8 @@ static void dw_gt_closepath(vd_trace_interface *I)
static void dw_gt_circle(vd_trace_interface *I, double x, double y, int r)
{ HBRUSH h;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return;
h = (HBRUSH)SelectObject(I->host->hdc, GetStockObject(NULL_BRUSH));
Ellipse(I->host->hdc, SX(x)-r, SY(y)-r, SX(x)+r, SY(y)+r);
@@ -237,8 +237,8 @@ static void dw_gt_circle(vd_trace_interface *I, double x, double y, int r)
static void dw_gt_round(vd_trace_interface *I, double x, double y, int r)
{ HPEN h;
- get_window();
- if (host.tw == NULL)
+ get_window();
+ if (host.tw == NULL)
return;
h = (HPEN)SelectObject(I->host->hdc, GetStockObject(NULL_PEN));
Ellipse(I->host->hdc, SX(x)-r, SY(y)-r, SX(x)+r, SY(y)+r);
@@ -246,80 +246,80 @@ static void dw_gt_round(vd_trace_interface *I, double x, double y, int r)
}
static void dw_gt_pixel(vd_trace_interface *I, double x, double y, unsigned long rgbcolor)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
SetPixel(I->host->hdc, SX(x), SY(y), rgbcolor);
}
static void dw_gt_fill(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
FillPath(I->host->hdc);
}
static void dw_gt_stroke(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
StrokePath(I->host->hdc);
}
static void dw_gt_setcolor(vd_trace_interface *I, unsigned long rgbcolor)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
if (I->host->color != rgbcolor) {
- I->host->color = rgbcolor;
- new_pen_brush(I);
- SetTextColor(I->host->hdc, rgbcolor);
+ I->host->color = rgbcolor;
+ new_pen_brush(I);
+ SetTextColor(I->host->hdc, rgbcolor);
}
}
static void dw_gt_setlinewidth(vd_trace_interface *I, unsigned int width)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
if (I->host->line_width != width) {
- I->host->line_width = width;
- new_pen_brush(I);
+ I->host->line_width = width;
+ new_pen_brush(I);
}
}
static void dw_gt_text(vd_trace_interface *I, double x, double y, char *ASCIIZ)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
TextOut(I->host->hdc, SX(x), SY(y), ASCIIZ, strlen(ASCIIZ));
}
static void dw_gt_wait(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
/* fixme : not implemented yet. */
}
static void dw_gt_set_scale(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
I->scale_x *= GetPrivateProfileInt("VDTRACE", "ScaleX", 1000, vdtrace_ini) / 1000.0;
I->scale_y *= GetPrivateProfileInt("VDTRACE", "ScaleY", 1000, vdtrace_ini) / 1000.0;
}
static void dw_gt_set_shift(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
I->shift_x += (int)GetPrivateProfileInt("VDTRACE", "ShiftX", 0, vdtrace_ini);
I->shift_y += (int)GetPrivateProfileInt("VDTRACE", "ShiftY", 0, vdtrace_ini);
}
static void dw_gt_set_origin(vd_trace_interface *I)
-{ get_window();
- if (host.tw == NULL)
+{ get_window();
+ if (host.tw == NULL)
return;
I->orig_x += (int)GetPrivateProfileInt("VDTRACE", "OrigX", 0, vdtrace_ini);
I->orig_y += (int)GetPrivateProfileInt("VDTRACE", "OrigY", 0, vdtrace_ini);
@@ -358,15 +358,10 @@ vd_trace_interface *visual_tracer_init(void)
SET_CALLBACK(visual_tracer, set_origin);
return &visual_tracer;
}
-
+
void visual_tracer_close(void)
{ if (host.tw != NULL) {
image_delete(host.tw);
image_close(host.tw);
}
}
-
-
-
-
-
diff --git a/gs/psi/dwtrace.h b/gs/psi/dwtrace.h
index 689e3bfd9..cb6a1f3bb 100644
--- a/gs/psi/dwtrace.h
+++ b/gs/psi/dwtrace.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/dwuninst.h b/gs/psi/dwuninst.h
index bf66f6945..25bc9c94c 100644
--- a/gs/psi/dwuninst.h
+++ b/gs/psi/dwuninst.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,7 +16,6 @@
#ifndef dwuninst_INCLUDED
# define dwuninst_INCLUDED
-
// Definitions for Ghostscript installer
#define ID_UNINSTGS 1
@@ -29,5 +28,4 @@
#define IDC_T1 111
#define IDC_T2 112
-
#endif /* dwuninst_INCLUDED */
diff --git a/gs/psi/dxmain.c b/gs/psi/dxmain.c
index 2afd746d6..2df19e023 100644
--- a/gs/psi/dxmain.c
+++ b/gs/psi/dxmain.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -13,9 +13,9 @@
/* $Id$ */
/* dxmain.c */
-/*
- * Ghostscript frontend which provides a graphical window
- * using Gtk+. Load time linking to libgs.so
+/*
+ * Ghostscript frontend which provides a graphical window
+ * using Gtk+. Load time linking to libgs.so
* Compile using
* gcc `gtk-config --cflags` -o gs dxmain.c -lgs `gtk-config --libs`
*
@@ -37,22 +37,22 @@
const char start_string[] = "systemdict /start get exec\n";
-static void read_stdin_handler(gpointer data, gint fd,
- GdkInputCondition condition);
+static void read_stdin_handler(gpointer data, gint fd,
+ GdkInputCondition condition);
static int gsdll_stdin(void *instance, char *buf, int len);
static int gsdll_stdout(void *instance, const char *str, int len);
static int gsdll_stdout(void *instance, const char *str, int len);
static int display_open(void *handle, void *device);
static int display_preclose(void *handle, void *device);
static int display_close(void *handle, void *device);
-static int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format);
-static int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage);
+static int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format);
+static int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage);
static int display_sync(void *handle, void *device);
static int display_page(void *handle, void *device, int copies, int flush);
-static int display_update(void *handle, void *device, int x, int y,
- int w, int h);
+static int display_update(void *handle, void *device, int x, int y,
+ int w, int h);
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
@@ -68,29 +68,29 @@ struct stdin_buf {
};
/* handler for reading non-blocking stdin */
-static void
+static void
read_stdin_handler(gpointer data, gint fd, GdkInputCondition condition)
{
struct stdin_buf *input = (struct stdin_buf *)data;
if (condition & GDK_INPUT_EXCEPTION) {
- g_print("input exception");
- input->count = 0; /* EOF */
+ g_print("input exception");
+ input->count = 0; /* EOF */
}
else if (condition & GDK_INPUT_READ) {
- /* read returns -1 for error, 0 for EOF and +ve for OK */
- input->count = read(fd, input->buf, input->len);
- if (input->count < 0)
- input->count = 0;
+ /* read returns -1 for error, 0 for EOF and +ve for OK */
+ input->count = read(fd, input->buf, input->len);
+ if (input->count < 0)
+ input->count = 0;
}
else {
- g_print("input condition unknown");
- input->count = 0; /* EOF */
+ g_print("input condition unknown");
+ input->count = 0; /* EOF */
}
}
/* callback for reading stdin */
-static int
+static int
gsdll_stdin(void *instance, char *buf, int len)
{
struct stdin_buf input;
@@ -100,17 +100,17 @@ gsdll_stdin(void *instance, char *buf, int len)
input.buf = buf;
input.count = -1;
- input_tag = gdk_input_add(fileno(stdin),
- (GdkInputCondition)(GDK_INPUT_READ | GDK_INPUT_EXCEPTION),
- read_stdin_handler, &input);
+ input_tag = gdk_input_add(fileno(stdin),
+ (GdkInputCondition)(GDK_INPUT_READ | GDK_INPUT_EXCEPTION),
+ read_stdin_handler, &input);
while (input.count < 0)
- gtk_main_iteration_do(TRUE);
+ gtk_main_iteration_do(TRUE);
gdk_input_remove(input_tag);
return input.count;
}
-static int
+static int
gsdll_stdout(void *instance, const char *str, int len)
{
gtk_main_iteration_do(FALSE);
@@ -119,7 +119,7 @@ gsdll_stdout(void *instance, const char *str, int len)
return len;
}
-static int
+static int
gsdll_stderr(void *instance, const char *str, int len)
{
gtk_main_iteration_do(FALSE);
@@ -179,111 +179,109 @@ image_find(void *handle, void *device)
{
IMAGE *img;
for (img = first_image; img!=0; img=img->next) {
- if ((img->handle == handle) && (img->device == device))
- return img;
+ if ((img->handle == handle) && (img->device == device))
+ return img;
}
return NULL;
}
-
-
static gboolean
window_draw(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
{
IMAGE *img = (IMAGE *)user_data;
if (img && img->window && img->buf) {
int color = img->format & DISPLAY_COLORS_MASK;
- int depth = img->format & DISPLAY_DEPTH_MASK;
- int x, y, width, height;
- if (event->area.x + event->area.width > img->width) {
- x = img->width;
- width = (event->area.x + event->area.width) - x;
- y = event->area.y;
+ int depth = img->format & DISPLAY_DEPTH_MASK;
+ int x, y, width, height;
+ if (event->area.x + event->area.width > img->width) {
+ x = img->width;
+ width = (event->area.x + event->area.width) - x;
+ y = event->area.y;
height = min(img->height, event->area.y + event->area.height) - y;
- gdk_window_clear_area(widget->window, x, y, width, height);
- }
- if (event->area.y + event->area.height > img->height) {
- x = event->area.x;
- width = event->area.width;
- y = img->height;
- height = (event->area.y + event->area.height) - y;
- gdk_window_clear_area(widget->window, x, y, width, height);
- }
- x = event->area.x;
- y = event->area.y;
- width = event->area.width;
- height = event->area.height;
- if ((x>=0) && (y>=0) && (x < img->width) && (y < img->height)) {
- /* drawing area intersects bitmap */
- if (x + width > img->width)
- width = img->width - x;
- if (y + height > img->height)
- height = img->height - y;
- switch (color) {
- case DISPLAY_COLORS_NATIVE:
- if (depth == DISPLAY_DEPTH_8)
- gdk_draw_indexed_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->buf + x + y*img->rowstride,
- img->rowstride, img->cmap);
- else if ((depth == DISPLAY_DEPTH_16) && img->rgbbuf)
- gdk_draw_rgb_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->rgbbuf + x*3 + y*img->width*3,
- img->width * 3);
- break;
- case DISPLAY_COLORS_GRAY:
- if (depth == DISPLAY_DEPTH_8)
- gdk_draw_gray_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->buf + x + y*img->rowstride,
- img->rowstride);
- break;
- case DISPLAY_COLORS_RGB:
- if (depth == DISPLAY_DEPTH_8) {
- if (img->rgbbuf)
- gdk_draw_rgb_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->rgbbuf + x*3 + y*img->width*3,
- img->width * 3);
- else
- gdk_draw_rgb_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->buf + x*3 + y*img->rowstride,
- img->rowstride);
- }
- break;
- case DISPLAY_COLORS_CMYK:
- if (((depth == DISPLAY_DEPTH_1) ||
- (depth == DISPLAY_DEPTH_8)) && img->rgbbuf)
- gdk_draw_rgb_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->rgbbuf + x*3 + y*img->width*3,
- img->width * 3);
- break;
- case DISPLAY_COLORS_SEPARATION:
- if ((depth == DISPLAY_DEPTH_8) && img->rgbbuf)
- gdk_draw_rgb_image(widget->window,
- widget->style->fg_gc[GTK_STATE_NORMAL],
- x, y, width, height,
- GDK_RGB_DITHER_MAX,
- img->rgbbuf + x*3 + y*img->width*3,
- img->width * 3);
- break;
- }
- }
+ gdk_window_clear_area(widget->window, x, y, width, height);
+ }
+ if (event->area.y + event->area.height > img->height) {
+ x = event->area.x;
+ width = event->area.width;
+ y = img->height;
+ height = (event->area.y + event->area.height) - y;
+ gdk_window_clear_area(widget->window, x, y, width, height);
+ }
+ x = event->area.x;
+ y = event->area.y;
+ width = event->area.width;
+ height = event->area.height;
+ if ((x>=0) && (y>=0) && (x < img->width) && (y < img->height)) {
+ /* drawing area intersects bitmap */
+ if (x + width > img->width)
+ width = img->width - x;
+ if (y + height > img->height)
+ height = img->height - y;
+ switch (color) {
+ case DISPLAY_COLORS_NATIVE:
+ if (depth == DISPLAY_DEPTH_8)
+ gdk_draw_indexed_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->buf + x + y*img->rowstride,
+ img->rowstride, img->cmap);
+ else if ((depth == DISPLAY_DEPTH_16) && img->rgbbuf)
+ gdk_draw_rgb_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->rgbbuf + x*3 + y*img->width*3,
+ img->width * 3);
+ break;
+ case DISPLAY_COLORS_GRAY:
+ if (depth == DISPLAY_DEPTH_8)
+ gdk_draw_gray_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->buf + x + y*img->rowstride,
+ img->rowstride);
+ break;
+ case DISPLAY_COLORS_RGB:
+ if (depth == DISPLAY_DEPTH_8) {
+ if (img->rgbbuf)
+ gdk_draw_rgb_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->rgbbuf + x*3 + y*img->width*3,
+ img->width * 3);
+ else
+ gdk_draw_rgb_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->buf + x*3 + y*img->rowstride,
+ img->rowstride);
+ }
+ break;
+ case DISPLAY_COLORS_CMYK:
+ if (((depth == DISPLAY_DEPTH_1) ||
+ (depth == DISPLAY_DEPTH_8)) && img->rgbbuf)
+ gdk_draw_rgb_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->rgbbuf + x*3 + y*img->width*3,
+ img->width * 3);
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ if ((depth == DISPLAY_DEPTH_8) && img->rgbbuf)
+ gdk_draw_rgb_image(widget->window,
+ widget->style->fg_gc[GTK_STATE_NORMAL],
+ x, y, width, height,
+ GDK_RGB_DITHER_MAX,
+ img->rgbbuf + x*3 + y*img->width*3,
+ img->width * 3);
+ break;
+ }
+ }
}
return TRUE;
}
@@ -310,30 +308,30 @@ static void window_create(IMAGE *img)
img->scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(img->scroll);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(img->scroll),
- GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
+ GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(img->scroll),
- img->darea);
+ img->darea);
gtk_box_pack_start(GTK_BOX(img->vbox), img->scroll, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (img->darea), "expose-event",
GTK_SIGNAL_FUNC (window_draw), img);
- gtk_signal_connect(GTK_OBJECT (img->window), "destroy",
- GTK_SIGNAL_FUNC (window_destroy), img);
+ gtk_signal_connect(GTK_OBJECT (img->window), "destroy",
+ GTK_SIGNAL_FUNC (window_destroy), img);
/* do not show img->window until we know the image size */
}
static void window_resize(IMAGE *img)
{
- gtk_drawing_area_size(GTK_DRAWING_AREA (img->darea),
- img->width, img->height);
+ gtk_drawing_area_size(GTK_DRAWING_AREA (img->darea),
+ img->width, img->height);
if (!(GTK_WIDGET_FLAGS(img->window) & GTK_VISIBLE)) {
- /* We haven't yet shown the window, so set a default size
- * which is smaller than the desktop to allow room for
- * desktop toolbars, and if possible a little larger than
- * the image to allow room for the scroll bars.
- * We don't know the width of the scroll bars, so just guess. */
- gtk_window_set_default_size(GTK_WINDOW(img->window),
- min(gdk_screen_width()-96, img->width+24),
- min(gdk_screen_height()-96, img->height+24));
+ /* We haven't yet shown the window, so set a default size
+ * which is smaller than the desktop to allow room for
+ * desktop toolbars, and if possible a little larger than
+ * the image to allow room for the scroll bars.
+ * We don't know the width of the scroll bars, so just guess. */
+ gtk_window_set_default_size(GTK_WINDOW(img->window),
+ min(gdk_screen_width()-96, img->width+24),
+ min(gdk_screen_height()-96, img->height+24));
}
}
@@ -384,13 +382,13 @@ static void signal_sep7(GtkWidget *w, gpointer data)
}
GtkSignalFunc signal_separation[IMAGE_DEVICEN_MAX] = {
- signal_sep0,
- signal_sep1,
- signal_sep2,
- signal_sep3,
- signal_sep4,
- signal_sep5,
- signal_sep6,
+ signal_sep0,
+ signal_sep1,
+ signal_sep2,
+ signal_sep3,
+ signal_sep4,
+ signal_sep5,
+ signal_sep6,
signal_sep7
};
@@ -413,25 +411,24 @@ static void signal_show_as_gray(GtkWidget *w, gpointer data)
display_sync(img->handle, img->device);
}
-
/* New device has been opened */
static int display_open(void *handle, void *device)
{
IMAGE *img = (IMAGE *)malloc(sizeof(IMAGE));
if (img == NULL)
- return -1;
+ return -1;
memset(img, 0, sizeof(IMAGE));
if (first_image == NULL) {
- gdk_rgb_init();
- gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
- gtk_widget_set_default_visual(gdk_rgb_get_visual());
+ gdk_rgb_init();
+ gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
+ gtk_widget_set_default_visual(gdk_rgb_get_visual());
}
/* add to list */
if (first_image)
- img->next = first_image;
+ img->next = first_image;
first_image = img;
/* remember device and handle */
@@ -449,7 +446,7 @@ static int display_preclose(void *handle, void *device)
{
IMAGE *img = image_find(handle, device);
if (img == NULL)
- return -1;
+ return -1;
gtk_main_iteration_do(FALSE);
@@ -464,10 +461,10 @@ static int display_preclose(void *handle, void *device)
img->scroll = NULL;
img->darea = NULL;
if (img->cmap)
- gdk_rgb_cmap_free(img->cmap);
+ gdk_rgb_cmap_free(img->cmap);
img->cmap = NULL;
if (img->rgbbuf)
- free(img->rgbbuf);
+ free(img->rgbbuf);
img->rgbbuf = NULL;
gtk_main_iteration_do(FALSE);
@@ -479,48 +476,48 @@ static int display_close(void *handle, void *device)
{
IMAGE *img = image_find(handle, device);
if (img == NULL)
- return -1;
+ return -1;
/* remove from list */
if (img == first_image) {
- first_image = img->next;
+ first_image = img->next;
}
else {
- IMAGE *tmp;
- for (tmp = first_image; tmp!=0; tmp=tmp->next) {
- if (img == tmp->next)
- tmp->next = img->next;
- }
+ IMAGE *tmp;
+ for (tmp = first_image; tmp!=0; tmp=tmp->next) {
+ if (img == tmp->next)
+ tmp->next = img->next;
+ }
}
return 0;
}
-static int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+static int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
/* Assume everything is OK.
- * It would be better to return e_rangecheck if we can't
+ * It would be better to return e_rangecheck if we can't
* support the format.
*/
return 0;
}
-
-static int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+
+static int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
IMAGE *img = image_find(handle, device);
int color;
int depth;
int i;
if (img == NULL)
- return -1;
+ return -1;
if (img->cmap)
- gdk_rgb_cmap_free(img->cmap);
+ gdk_rgb_cmap_free(img->cmap);
img->cmap = NULL;
if (img->rgbbuf)
- free(img->rgbbuf);
+ free(img->rgbbuf);
img->rgbbuf = NULL;
img->width = width;
@@ -531,145 +528,144 @@ static int display_size(void *handle, void *device, int width, int height,
/* Reset separations */
for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- img->devicen[i].used = 0;
- img->devicen[i].visible = 1;
- memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
- img->devicen[i].cyan = 0;
- img->devicen[i].magenta = 0;
- img->devicen[i].yellow = 0;
- img->devicen[i].black = 0;
+ img->devicen[i].used = 0;
+ img->devicen[i].visible = 1;
+ memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
+ img->devicen[i].cyan = 0;
+ img->devicen[i].magenta = 0;
+ img->devicen[i].yellow = 0;
+ img->devicen[i].black = 0;
}
color = img->format & DISPLAY_COLORS_MASK;
depth = img->format & DISPLAY_DEPTH_MASK;
switch (color) {
- case DISPLAY_COLORS_NATIVE:
- if (depth == DISPLAY_DEPTH_8) {
- /* palette of 96 colors */
- guint32 color[96];
- int i;
- int one = 255 / 3;
- for (i=0; i<96; i++) {
- /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
- if (i < 64) {
- color[i] =
- (((i & 0x30) >> 4) * one << 16) + /* r */
- (((i & 0x0c) >> 2) * one << 8) + /* g */
- (i & 0x03) * one; /* b */
- }
- else {
- int val = i & 0x1f;
- val = (val << 3) + (val >> 2);
- color[i] = (val << 16) + (val << 8) + val;
- }
- }
- img->cmap = gdk_rgb_cmap_new(color, 96);
- break;
- }
- else if (depth == DISPLAY_DEPTH_16) {
- /* need to convert to 24RGB */
- img->rgbbuf = (guchar *)malloc(width * height * 3);
- if (img->rgbbuf == NULL)
- return -1;
- }
- else
- return e_rangecheck; /* not supported */
- case DISPLAY_COLORS_GRAY:
- if (depth == DISPLAY_DEPTH_8)
- break;
- else
- return -1; /* not supported */
- case DISPLAY_COLORS_RGB:
- if (depth == DISPLAY_DEPTH_8) {
- if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)
- && ((img->format & DISPLAY_ENDIAN_MASK)
- == DISPLAY_BIGENDIAN))
- break;
- else {
- /* need to convert to 24RGB */
- img->rgbbuf = (guchar *)malloc(width * height * 3);
- if (img->rgbbuf == NULL)
- return -1;
- }
- }
- else
- return -1; /* not supported */
- break;
- case DISPLAY_COLORS_CMYK:
- if ((depth == DISPLAY_DEPTH_1) || (depth == DISPLAY_DEPTH_8)) {
- /* need to convert to 24RGB */
- img->rgbbuf = (guchar *)malloc(width * height * 3);
- if (img->rgbbuf == NULL)
- return -1;
- /* We already know about the CMYK components */
- img->devicen[0].used = 1;
- img->devicen[0].cyan = 65535;
- strncpy(img->devicen[0].name, "Cyan",
- sizeof(img->devicen[0].name));
- img->devicen[1].used = 1;
- img->devicen[1].magenta = 65535;
- strncpy(img->devicen[1].name, "Magenta",
- sizeof(img->devicen[1].name));
- img->devicen[2].used = 1;
- img->devicen[2].yellow = 65535;
- strncpy(img->devicen[2].name, "Yellow",
- sizeof(img->devicen[2].name));
- img->devicen[3].used = 1;
- img->devicen[3].black = 65535;
- strncpy(img->devicen[3].name, "Black",
- sizeof(img->devicen[3].name));
- }
- else
- return -1; /* not supported */
- break;
- case DISPLAY_COLORS_SEPARATION:
- /* we can't display this natively */
- /* we will convert it just before displaying */
- if (depth != DISPLAY_DEPTH_8)
- return -1; /* not supported */
- img->rgbbuf = (guchar *)malloc(width * height * 3);
- if (img->rgbbuf == NULL)
- return -1;
- break;
+ case DISPLAY_COLORS_NATIVE:
+ if (depth == DISPLAY_DEPTH_8) {
+ /* palette of 96 colors */
+ guint32 color[96];
+ int i;
+ int one = 255 / 3;
+ for (i=0; i<96; i++) {
+ /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
+ if (i < 64) {
+ color[i] =
+ (((i & 0x30) >> 4) * one << 16) + /* r */
+ (((i & 0x0c) >> 2) * one << 8) + /* g */
+ (i & 0x03) * one; /* b */
+ }
+ else {
+ int val = i & 0x1f;
+ val = (val << 3) + (val >> 2);
+ color[i] = (val << 16) + (val << 8) + val;
+ }
+ }
+ img->cmap = gdk_rgb_cmap_new(color, 96);
+ break;
+ }
+ else if (depth == DISPLAY_DEPTH_16) {
+ /* need to convert to 24RGB */
+ img->rgbbuf = (guchar *)malloc(width * height * 3);
+ if (img->rgbbuf == NULL)
+ return -1;
+ }
+ else
+ return e_rangecheck; /* not supported */
+ case DISPLAY_COLORS_GRAY:
+ if (depth == DISPLAY_DEPTH_8)
+ break;
+ else
+ return -1; /* not supported */
+ case DISPLAY_COLORS_RGB:
+ if (depth == DISPLAY_DEPTH_8) {
+ if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE)
+ && ((img->format & DISPLAY_ENDIAN_MASK)
+ == DISPLAY_BIGENDIAN))
+ break;
+ else {
+ /* need to convert to 24RGB */
+ img->rgbbuf = (guchar *)malloc(width * height * 3);
+ if (img->rgbbuf == NULL)
+ return -1;
+ }
+ }
+ else
+ return -1; /* not supported */
+ break;
+ case DISPLAY_COLORS_CMYK:
+ if ((depth == DISPLAY_DEPTH_1) || (depth == DISPLAY_DEPTH_8)) {
+ /* need to convert to 24RGB */
+ img->rgbbuf = (guchar *)malloc(width * height * 3);
+ if (img->rgbbuf == NULL)
+ return -1;
+ /* We already know about the CMYK components */
+ img->devicen[0].used = 1;
+ img->devicen[0].cyan = 65535;
+ strncpy(img->devicen[0].name, "Cyan",
+ sizeof(img->devicen[0].name));
+ img->devicen[1].used = 1;
+ img->devicen[1].magenta = 65535;
+ strncpy(img->devicen[1].name, "Magenta",
+ sizeof(img->devicen[1].name));
+ img->devicen[2].used = 1;
+ img->devicen[2].yellow = 65535;
+ strncpy(img->devicen[2].name, "Yellow",
+ sizeof(img->devicen[2].name));
+ img->devicen[3].used = 1;
+ img->devicen[3].black = 65535;
+ strncpy(img->devicen[3].name, "Black",
+ sizeof(img->devicen[3].name));
+ }
+ else
+ return -1; /* not supported */
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ /* we can't display this natively */
+ /* we will convert it just before displaying */
+ if (depth != DISPLAY_DEPTH_8)
+ return -1; /* not supported */
+ img->rgbbuf = (guchar *)malloc(width * height * 3);
+ if (img->rgbbuf == NULL)
+ return -1;
+ break;
}
-
- if ((color == DISPLAY_COLORS_CMYK) ||
- (color == DISPLAY_COLORS_SEPARATION)) {
- if (!img->cmyk_bar) {
- /* add bar to select separation */
- img->cmyk_bar = gtk_hbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(img->vbox), img->cmyk_bar,
- FALSE, FALSE, 0);
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- img->separation[i] =
- window_add_button(img, img->devicen[i].name,
- signal_separation[i]);
- }
- img->show_as_gray = gtk_check_button_new_with_label("Show as Gray");
- gtk_box_pack_end(GTK_BOX(img->cmyk_bar), img->show_as_gray,
- FALSE, FALSE, 5);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(img->show_as_gray),
- FALSE);
- gtk_signal_connect(GTK_OBJECT(img->show_as_gray), "clicked",
- signal_show_as_gray, img);
- gtk_widget_show(img->show_as_gray);
- }
- gtk_widget_show(img->cmyk_bar);
+ if ((color == DISPLAY_COLORS_CMYK) ||
+ (color == DISPLAY_COLORS_SEPARATION)) {
+ if (!img->cmyk_bar) {
+ /* add bar to select separation */
+ img->cmyk_bar = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(img->vbox), img->cmyk_bar,
+ FALSE, FALSE, 0);
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ img->separation[i] =
+ window_add_button(img, img->devicen[i].name,
+ signal_separation[i]);
+ }
+ img->show_as_gray = gtk_check_button_new_with_label("Show as Gray");
+ gtk_box_pack_end(GTK_BOX(img->cmyk_bar), img->show_as_gray,
+ FALSE, FALSE, 5);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(img->show_as_gray),
+ FALSE);
+ gtk_signal_connect(GTK_OBJECT(img->show_as_gray), "clicked",
+ signal_show_as_gray, img);
+ gtk_widget_show(img->show_as_gray);
+ }
+ gtk_widget_show(img->cmyk_bar);
}
else {
- if (img->cmyk_bar)
- gtk_widget_hide(img->cmyk_bar);
+ if (img->cmyk_bar)
+ gtk_widget_hide(img->cmyk_bar);
}
window_resize(img);
if (!(GTK_WIDGET_FLAGS(img->window) & GTK_VISIBLE))
- gtk_widget_show(img->window);
+ gtk_widget_show(img->window);
gtk_main_iteration_do(FALSE);
return 0;
}
-
+
static int display_sync(void *handle, void *device)
{
IMAGE *img = image_find(handle, device);
@@ -679,7 +675,7 @@ static int display_sync(void *handle, void *device)
int native555;
int alpha;
if (img == NULL)
- return -1;
+ return -1;
color = img->format & DISPLAY_COLORS_MASK;
depth = img->format & DISPLAY_DEPTH_MASK;
@@ -688,342 +684,342 @@ static int display_sync(void *handle, void *device)
alpha = img->format & DISPLAY_ALPHA_MASK;
if ((color == DISPLAY_COLORS_CMYK) ||
- (color == DISPLAY_COLORS_SEPARATION)) {
- /* check if separations have changed */
- int i;
- gchar *str;
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- gtk_label_get(
- GTK_LABEL(GTK_BIN(img->separation[i])->child), &str);
- if (!img->devicen[i].used)
- gtk_widget_hide(img->separation[i]);
- else if (strcmp(img->devicen[i].name, str) != 0) {
- /* text has changed, update it */
- gtk_label_set_text(
- GTK_LABEL(GTK_BIN(img->separation[i])->child),
- img->devicen[i].name);
- gtk_widget_show(img->separation[i]);
- }
- }
+ (color == DISPLAY_COLORS_SEPARATION)) {
+ /* check if separations have changed */
+ int i;
+ gchar *str;
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ gtk_label_get(
+ GTK_LABEL(GTK_BIN(img->separation[i])->child), &str);
+ if (!img->devicen[i].used)
+ gtk_widget_hide(img->separation[i]);
+ else if (strcmp(img->devicen[i].name, str) != 0) {
+ /* text has changed, update it */
+ gtk_label_set_text(
+ GTK_LABEL(GTK_BIN(img->separation[i])->child),
+ img->devicen[i].name);
+ gtk_widget_show(img->separation[i]);
+ }
+ }
}
-
+
/* some formats need to be converted for use by GdkRgb */
switch (color) {
- case DISPLAY_COLORS_NATIVE:
- if (depth == DISPLAY_DEPTH_16) {
- if (endian == DISPLAY_LITTLEENDIAN) {
- if (native555 == DISPLAY_NATIVE_555) {
- /* BGR555 */
- int x, y;
- unsigned short w;
- unsigned char value;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- w = s[0] + (s[1] << 8);
- value = (w >> 10) & 0x1f; /* red */
- *d++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *d++ = (value << 3) + (value >> 2);
- value = w & 0x1f; /* blue */
- *d++ = (value << 3) + (value >> 2);
- s += 2;
- }
- }
- }
- else {
- /* BGR565 */
- int x, y;
- unsigned short w;
- unsigned char value;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- w = s[0] + (s[1] << 8);
- value = (w >> 11) & 0x1f; /* red */
- *d++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *d++ = (value << 2) + (value >> 4);
- value = w & 0x1f; /* blue */
- *d++ = (value << 3) + (value >> 2);
- s += 2;
- }
- }
- }
- }
- else {
- if (native555 == DISPLAY_NATIVE_555) {
- /* RGB555 */
- int x, y;
- unsigned short w;
- unsigned char value;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- w = s[1] + (s[0] << 8);
- value = (w >> 10) & 0x1f; /* red */
- *d++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *d++ = (value << 3) + (value >> 2);
- value = w & 0x1f; /* blue */
- *d++ = (value << 3) + (value >> 2);
- s += 2;
- }
- }
- }
- else {
- /* RGB565 */
- int x, y;
- unsigned short w;
- unsigned char value;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- w = s[1] + (s[0] << 8);
- value = (w >> 11) & 0x1f; /* red */
- *d++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *d++ = (value << 2) + (value >> 4);
- value = w & 0x1f; /* blue */
- *d++ = (value << 3) + (value >> 2);
- s += 2;
- }
- }
- }
- }
- }
- break;
- case DISPLAY_COLORS_RGB:
- if ( (depth == DISPLAY_DEPTH_8) &&
- ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST)) &&
- (endian == DISPLAY_BIGENDIAN) ) {
- /* Mac format */
- int x, y;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- s++; /* x = filler */
- *d++ = *s++; /* r */
- *d++ = *s++; /* g */
- *d++ = *s++; /* b */
- }
- }
- }
- else if ( (depth == DISPLAY_DEPTH_8) &&
- (endian == DISPLAY_LITTLEENDIAN) ) {
- if ((alpha == DISPLAY_UNUSED_LAST) ||
- (alpha == DISPLAY_ALPHA_LAST)) {
- /* Windows format + alpha = BGRx */
- int x, y;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- *d++ = s[2]; /* r */
- *d++ = s[1]; /* g */
- *d++ = s[0]; /* b */
- s += 4;
- }
- }
- }
- else if ((alpha == DISPLAY_UNUSED_FIRST) ||
- (alpha == DISPLAY_ALPHA_FIRST)) {
- /* xBGR */
- int x, y;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- *d++ = s[3]; /* r */
- *d++ = s[2]; /* g */
- *d++ = s[1]; /* b */
- s += 4;
- }
- }
- }
- else {
- /* Windows BGR24 */
- int x, y;
- unsigned char *s, *d;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- *d++ = s[2]; /* r */
- *d++ = s[1]; /* g */
- *d++ = s[0]; /* b */
- s += 3;
- }
- }
- }
- }
- break;
- case DISPLAY_COLORS_CMYK:
- if (depth == DISPLAY_DEPTH_8) {
- /* Separations */
- int x, y;
- int cyan, magenta, yellow, black;
- unsigned char *s, *d;
- int vc = img->devicen[0].visible;
- int vm = img->devicen[1].visible;
- int vy = img->devicen[2].visible;
- int vk = img->devicen[3].visible;
- int vall = vc && vm && vy && vk;
- int show_gray = (vc + vm + vy + vk == 1) && img->devicen_gray;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- cyan = *s++;
- magenta = *s++;
- yellow = *s++;
- black = *s++;
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *d++ = (255-cyan) * (255-black) / 255; /* r */
- *d++ = (255-magenta) * (255-black) / 255; /* g */
- *d++ = (255-yellow) * (255-black) / 255; /* b */
- }
- }
- }
- else if (depth == DISPLAY_DEPTH_1) {
- /* Separations */
- int x, y;
- int cyan, magenta, yellow, black;
- unsigned char *s, *d;
- int vc = img->devicen[0].visible;
- int vm = img->devicen[1].visible;
- int vy = img->devicen[2].visible;
- int vk = img->devicen[3].visible;
- int vall = vc && vm && vy && vk;
- int show_gray = (vc + vm + vy + vk == 1) && img->devicen_gray;
- int value;
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- value = s[x/2];
- if (x & 0)
- value >>= 4;
- cyan = ((value >> 3) & 1) * 255;
- magenta = ((value >> 2) & 1) * 255;
- yellow = ((value >> 1) & 1) * 255;
- black = (value & 1) * 255;
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *d++ = (255-cyan) * (255-black) / 255; /* r */
- *d++ = (255-magenta) * (255-black) / 255; /* g */
- *d++ = (255-yellow) * (255-black) / 255; /* b */
- }
- }
- }
- break;
- case DISPLAY_COLORS_SEPARATION:
- if (depth == DISPLAY_DEPTH_8) {
- int j;
- int x, y;
- unsigned char *s, *d;
- int cyan, magenta, yellow, black;
- int num_comp = 0;
- int value;
- int num_visible = 0;
- int show_gray = 0;
- IMAGE_DEVICEN *devicen = img->devicen;
- for (j=0; j<IMAGE_DEVICEN_MAX; j++) {
- if (img->devicen[j].used) {
- num_comp = j+1;
- if (img->devicen[j].visible)
- num_visible++;
- }
- }
- if ((num_visible == 1) && img->devicen_gray)
- show_gray = 1;
-
- for (y = 0; y<img->height; y++) {
- s = img->buf + y * img->rowstride;
- d = img->rgbbuf + y * img->width * 3;
- for (x=0; x<img->width; x++) {
- cyan = magenta = yellow = black = 0;
- if (show_gray) {
- for (j=0; j<num_comp; j++) {
- devicen = &img->devicen[j];
- if (devicen->visible && devicen->used)
- black += s[j];
- }
- }
- else {
- for (j=0; j<num_comp; j++) {
- devicen = &img->devicen[j];
- if (devicen->visible && devicen->used) {
- value = s[j];
- cyan += value*devicen->cyan /65535;
- magenta += value*devicen->magenta/65535;
- yellow += value*devicen->yellow /65535;
- black += value*devicen->black /65535;
- }
- }
- }
- if (cyan > 255)
- cyan = 255;
- if (magenta > 255)
- magenta = 255;
- if (yellow > 255)
- yellow = 255;
- if (black > 255)
- black = 255;
- *d++ = (255-cyan) * (255-black) / 255; /* r */
- *d++ = (255-magenta) * (255-black) / 255; /* g */
- *d++ = (255-yellow) * (255-black) / 255; /* b */
- s += 8;
- }
- }
- }
- break;
+ case DISPLAY_COLORS_NATIVE:
+ if (depth == DISPLAY_DEPTH_16) {
+ if (endian == DISPLAY_LITTLEENDIAN) {
+ if (native555 == DISPLAY_NATIVE_555) {
+ /* BGR555 */
+ int x, y;
+ unsigned short w;
+ unsigned char value;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ w = s[0] + (s[1] << 8);
+ value = (w >> 10) & 0x1f; /* red */
+ *d++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *d++ = (value << 3) + (value >> 2);
+ value = w & 0x1f; /* blue */
+ *d++ = (value << 3) + (value >> 2);
+ s += 2;
+ }
+ }
+ }
+ else {
+ /* BGR565 */
+ int x, y;
+ unsigned short w;
+ unsigned char value;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ w = s[0] + (s[1] << 8);
+ value = (w >> 11) & 0x1f; /* red */
+ *d++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *d++ = (value << 2) + (value >> 4);
+ value = w & 0x1f; /* blue */
+ *d++ = (value << 3) + (value >> 2);
+ s += 2;
+ }
+ }
+ }
+ }
+ else {
+ if (native555 == DISPLAY_NATIVE_555) {
+ /* RGB555 */
+ int x, y;
+ unsigned short w;
+ unsigned char value;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ w = s[1] + (s[0] << 8);
+ value = (w >> 10) & 0x1f; /* red */
+ *d++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *d++ = (value << 3) + (value >> 2);
+ value = w & 0x1f; /* blue */
+ *d++ = (value << 3) + (value >> 2);
+ s += 2;
+ }
+ }
+ }
+ else {
+ /* RGB565 */
+ int x, y;
+ unsigned short w;
+ unsigned char value;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ w = s[1] + (s[0] << 8);
+ value = (w >> 11) & 0x1f; /* red */
+ *d++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *d++ = (value << 2) + (value >> 4);
+ value = w & 0x1f; /* blue */
+ *d++ = (value << 3) + (value >> 2);
+ s += 2;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ( (depth == DISPLAY_DEPTH_8) &&
+ ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST)) &&
+ (endian == DISPLAY_BIGENDIAN) ) {
+ /* Mac format */
+ int x, y;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ s++; /* x = filler */
+ *d++ = *s++; /* r */
+ *d++ = *s++; /* g */
+ *d++ = *s++; /* b */
+ }
+ }
+ }
+ else if ( (depth == DISPLAY_DEPTH_8) &&
+ (endian == DISPLAY_LITTLEENDIAN) ) {
+ if ((alpha == DISPLAY_UNUSED_LAST) ||
+ (alpha == DISPLAY_ALPHA_LAST)) {
+ /* Windows format + alpha = BGRx */
+ int x, y;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ *d++ = s[2]; /* r */
+ *d++ = s[1]; /* g */
+ *d++ = s[0]; /* b */
+ s += 4;
+ }
+ }
+ }
+ else if ((alpha == DISPLAY_UNUSED_FIRST) ||
+ (alpha == DISPLAY_ALPHA_FIRST)) {
+ /* xBGR */
+ int x, y;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ *d++ = s[3]; /* r */
+ *d++ = s[2]; /* g */
+ *d++ = s[1]; /* b */
+ s += 4;
+ }
+ }
+ }
+ else {
+ /* Windows BGR24 */
+ int x, y;
+ unsigned char *s, *d;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ *d++ = s[2]; /* r */
+ *d++ = s[1]; /* g */
+ *d++ = s[0]; /* b */
+ s += 3;
+ }
+ }
+ }
+ }
+ break;
+ case DISPLAY_COLORS_CMYK:
+ if (depth == DISPLAY_DEPTH_8) {
+ /* Separations */
+ int x, y;
+ int cyan, magenta, yellow, black;
+ unsigned char *s, *d;
+ int vc = img->devicen[0].visible;
+ int vm = img->devicen[1].visible;
+ int vy = img->devicen[2].visible;
+ int vk = img->devicen[3].visible;
+ int vall = vc && vm && vy && vk;
+ int show_gray = (vc + vm + vy + vk == 1) && img->devicen_gray;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ cyan = *s++;
+ magenta = *s++;
+ yellow = *s++;
+ black = *s++;
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *d++ = (255-cyan) * (255-black) / 255; /* r */
+ *d++ = (255-magenta) * (255-black) / 255; /* g */
+ *d++ = (255-yellow) * (255-black) / 255; /* b */
+ }
+ }
+ }
+ else if (depth == DISPLAY_DEPTH_1) {
+ /* Separations */
+ int x, y;
+ int cyan, magenta, yellow, black;
+ unsigned char *s, *d;
+ int vc = img->devicen[0].visible;
+ int vm = img->devicen[1].visible;
+ int vy = img->devicen[2].visible;
+ int vk = img->devicen[3].visible;
+ int vall = vc && vm && vy && vk;
+ int show_gray = (vc + vm + vy + vk == 1) && img->devicen_gray;
+ int value;
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ value = s[x/2];
+ if (x & 0)
+ value >>= 4;
+ cyan = ((value >> 3) & 1) * 255;
+ magenta = ((value >> 2) & 1) * 255;
+ yellow = ((value >> 1) & 1) * 255;
+ black = (value & 1) * 255;
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *d++ = (255-cyan) * (255-black) / 255; /* r */
+ *d++ = (255-magenta) * (255-black) / 255; /* g */
+ *d++ = (255-yellow) * (255-black) / 255; /* b */
+ }
+ }
+ }
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ if (depth == DISPLAY_DEPTH_8) {
+ int j;
+ int x, y;
+ unsigned char *s, *d;
+ int cyan, magenta, yellow, black;
+ int num_comp = 0;
+ int value;
+ int num_visible = 0;
+ int show_gray = 0;
+ IMAGE_DEVICEN *devicen = img->devicen;
+ for (j=0; j<IMAGE_DEVICEN_MAX; j++) {
+ if (img->devicen[j].used) {
+ num_comp = j+1;
+ if (img->devicen[j].visible)
+ num_visible++;
+ }
+ }
+ if ((num_visible == 1) && img->devicen_gray)
+ show_gray = 1;
+
+ for (y = 0; y<img->height; y++) {
+ s = img->buf + y * img->rowstride;
+ d = img->rgbbuf + y * img->width * 3;
+ for (x=0; x<img->width; x++) {
+ cyan = magenta = yellow = black = 0;
+ if (show_gray) {
+ for (j=0; j<num_comp; j++) {
+ devicen = &img->devicen[j];
+ if (devicen->visible && devicen->used)
+ black += s[j];
+ }
+ }
+ else {
+ for (j=0; j<num_comp; j++) {
+ devicen = &img->devicen[j];
+ if (devicen->visible && devicen->used) {
+ value = s[j];
+ cyan += value*devicen->cyan /65535;
+ magenta += value*devicen->magenta/65535;
+ yellow += value*devicen->yellow /65535;
+ black += value*devicen->black /65535;
+ }
+ }
+ }
+ if (cyan > 255)
+ cyan = 255;
+ if (magenta > 255)
+ magenta = 255;
+ if (yellow > 255)
+ yellow = 255;
+ if (black > 255)
+ black = 255;
+ *d++ = (255-cyan) * (255-black) / 255; /* r */
+ *d++ = (255-magenta) * (255-black) / 255; /* g */
+ *d++ = (255-yellow) * (255-black) / 255; /* b */
+ s += 8;
+ }
+ }
+ }
+ break;
}
if (img->window == NULL) {
- window_create(img);
- window_resize(img);
+ window_create(img);
+ window_resize(img);
}
if (!(GTK_WIDGET_FLAGS(img->window) & GTK_VISIBLE))
- gtk_widget_show_all(img->window);
+ gtk_widget_show_all(img->window);
gtk_widget_draw(img->darea, NULL);
gtk_main_iteration_do(FALSE);
@@ -1036,15 +1032,14 @@ static int display_page(void *handle, void *device, int copies, int flush)
return 0;
}
-static int display_update(void *handle, void *device,
+static int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
/* not implemented - eventually this will be used for progressive update */
return 0;
}
-
-static int
+static int
display_separation(void *handle, void *device,
int comp_num, const char *name,
unsigned short c, unsigned short m,
@@ -1052,12 +1047,12 @@ display_separation(void *handle, void *device,
{
IMAGE *img = image_find(handle, device);
if (img == NULL)
- return -1;
+ return -1;
if ((comp_num < 0) || (comp_num > IMAGE_DEVICEN_MAX))
- return -1;
+ return -1;
img->devicen[comp_num].used = 1;
strncpy(img->devicen[comp_num].name, name,
- sizeof(img->devicen[comp_num].name)-1);
+ sizeof(img->devicen[comp_num].name)-1);
img->devicen[comp_num].cyan = c;
img->devicen[comp_num].magenta = m;
img->devicen[comp_num].yellow = y;
@@ -1065,9 +1060,8 @@ display_separation(void *handle, void *device,
return 0;
}
-
/* callback structure for "display" device */
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -1102,9 +1096,9 @@ int main(int argc, char *argv[])
use_gui = gtk_init_check(&argc, &argv);
/* insert display device parameters as first arguments */
- sprintf(dformat, "-dDisplayFormat=%d",
- DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
- DISPLAY_BIGENDIAN | DISPLAY_TOPFIRST);
+ sprintf(dformat, "-dDisplayFormat=%d",
+ DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | DISPLAY_DEPTH_8 |
+ DISPLAY_BIGENDIAN | DISPLAY_TOPFIRST);
nargc = argc + 1;
nargv = (char **)malloc((nargc + 1) * sizeof(char *));
nargv[0] = argv[0];
@@ -1114,34 +1108,33 @@ int main(int argc, char *argv[])
/* run Ghostscript */
if ((code = gsapi_new_instance(&instance, NULL)) == 0) {
gsapi_set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
- if (use_gui)
+ if (use_gui)
gsapi_set_display_callback(instance, &display);
- code = gsapi_init_with_args(instance, nargc, nargv);
+ code = gsapi_init_with_args(instance, nargc, nargv);
- if (code == 0)
- code = gsapi_run_string(instance, start_string, 0, &exit_code);
+ if (code == 0)
+ code = gsapi_run_string(instance, start_string, 0, &exit_code);
code1 = gsapi_exit(instance);
- if (code == 0 || code == e_Quit)
- code = code1;
- if (code == e_Quit)
- code = 0; /* user executed 'quit' */
+ if (code == 0 || code == e_Quit)
+ code = code1;
+ if (code == e_Quit)
+ code = 0; /* user executed 'quit' */
- gsapi_delete_instance(instance);
+ gsapi_delete_instance(instance);
}
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
return exit_status;
}
-
diff --git a/gs/psi/dxmainc.c b/gs/psi/dxmainc.c
index 3d8a761b9..410ae2db6 100644
--- a/gs/psi/dxmainc.c
+++ b/gs/psi/dxmainc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -13,9 +13,9 @@
/* $Id$ */
/* dxmainc.c */
-/*
+/*
* Ghostscript frontend which provides a console to the Ghostscript
- * shared library. Load time linking to libgs.so
+ * shared library. Load time linking to libgs.so
* This does not support the display device. Use dxmain.c/gsx for that,
* or modify this program to use bare Xlib calls.
* Compile using
@@ -47,13 +47,13 @@ static int gsdll_stdout(void *instance, const char *str, int len);
/* callback for reading stdin */
/* Use async input */
-static int
+static int
gsdll_stdin(void *instance, char *buf, int len)
{
return read(fileno(stdin), buf, len);
}
-static int
+static int
gsdll_stdout(void *instance, const char *str, int len)
{
fwrite(str, 1, len, stdout);
@@ -61,7 +61,7 @@ gsdll_stdout(void *instance, const char *str, int len)
return len;
}
-static int
+static int
gsdll_stderr(void *instance, const char *str, int len)
{
fwrite(str, 1, len, stderr);
@@ -81,32 +81,31 @@ int main(int argc, char *argv[])
/* run Ghostscript */
if ((code = gsapi_new_instance(&instance, NULL)) == 0) {
gsapi_set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
- code = gsapi_init_with_args(instance, argc, argv);
+ code = gsapi_init_with_args(instance, argc, argv);
- if (code == 0)
- code = gsapi_run_string(instance, start_string, 0, &exit_code);
+ if (code == 0)
+ code = gsapi_run_string(instance, start_string, 0, &exit_code);
code1 = gsapi_exit(instance);
- if (code == 0 || code == e_Quit)
- code = code1;
- if (code == e_Quit)
- code = 0; /* user executed 'quit' */
+ if (code == 0 || code == e_Quit)
+ code = code1;
+ if (code == e_Quit)
+ code = 0; /* user executed 'quit' */
- gsapi_delete_instance(instance);
+ gsapi_delete_instance(instance);
}
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
return exit_status;
}
-
diff --git a/gs/psi/estack.h b/gs/psi/estack.h
index 9cc93aafa..bafd89479 100644
--- a/gs/psi/estack.h
+++ b/gs/psi/estack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/fapi_ft.c b/gs/psi/fapi_ft.c
index a302d439f..a420a8436 100644
--- a/gs/psi/fapi_ft.c
+++ b/gs/psi/fapi_ft.c
@@ -66,7 +66,7 @@ typedef struct FF_face_s
FT_F26Dot6 width, height;
FT_UInt horz_res;
FT_UInt vert_res;
-
+
/* If non-null, the incremental interface object passed to FreeType. */
FT_Incremental_InterfaceRec *ft_inc_int;
@@ -76,7 +76,7 @@ typedef struct FF_face_s
/* Here we define the struct FT_Incremental that is used as an opaque type
* inside FreeType. This structure has to have the tag FT_IncrementalRec_
- * to be compatible with the functions defined in FT_Incremental_FuncsRec.
+ * to be compatible with the functions defined in FT_Incremental_FuncsRec.
*/
typedef struct FT_IncrementalRec_
{
@@ -92,12 +92,11 @@ typedef struct FT_IncrementalRec_
FAPI_metrics_type metrics_type; /* determines whether metrics are replaced, added, etc. */
} FT_IncrementalRec;
-
FT_CALLBACK_DEF( void* )
FF_alloc( FT_Memory memory, long size)
{
gs_memory_t *mem = (gs_memory_t *)memory->user;
-
+
return(gs_malloc (mem, size, 1, "FF_alloc"));
}
@@ -106,20 +105,19 @@ FF_realloc(FT_Memory memory, long cur_size, long new_size, void* block)
{
gs_memory_t *mem = (gs_memory_t *)memory->user;
void *tmp;
-
+
if (cur_size == new_size) {
return (block);
}
-
+
tmp = gs_malloc (mem, new_size, 1, "FF_realloc");
-
-
+
if (tmp && block) {
memcpy (tmp, block, min(cur_size, new_size));
gs_free (mem, block, 0, 0, "FF_realloc");
}
-
+
return(tmp);
}
@@ -130,7 +128,6 @@ FF_free(FT_Memory memory, void* block)
gs_free (mem, block, 0, 0, "FF_free");
}
-
static FF_face *
new_face(FAPI_server *a_server, FT_Face a_ft_face, FT_Incremental_InterfaceRec *a_ft_inc_int, unsigned char *a_font_data)
{
@@ -152,7 +149,7 @@ delete_face(FAPI_server *a_server, FF_face *a_face)
if (a_face)
{
FF_server *s = (FF_server*)a_server;
-
+
FT_Done_Face(a_face->ft_face);
FF_free(s->ftmemory, a_face->ft_inc_int);
FF_free(s->ftmemory, a_face->font_data);
@@ -194,7 +191,7 @@ get_fapi_glyph_data(FT_Incremental a_info, FT_UInt a_index, FT_Data *a_data)
{
FAPI_font *ff = a_info->fapi_font;
int length = 0;
-
+
/* Tell the FAPI interface that we need to decrypt the glyph data. */
ff->need_decrypt = true;
@@ -210,7 +207,7 @@ get_fapi_glyph_data(FT_Incremental a_info, FT_UInt a_index, FT_Data *a_data)
buffer = gs_malloc ((gs_memory_t *)a_info->fapi_font->memory, length, 1, "get_fapi_glyph_data");
if (!buffer)
return FT_Err_Out_Of_Memory;
-
+
length = ff->get_glyph(ff, a_index, buffer, length);
if (length == 65535) {
gs_free ((gs_memory_t *)a_info->fapi_font->memory, buffer, 0, 0, "get_fapi_glyph_data");
@@ -238,9 +235,9 @@ get_fapi_glyph_data(FT_Incremental a_info, FT_UInt a_index, FT_Data *a_data)
if (a_info->glyph_data) {
gs_free ((gs_memory_t *)a_info->fapi_font->memory, a_info->glyph_data, 0, 0, "get_fapi_glyph_data");
}
-
+
a_info->glyph_data = gs_malloc ((gs_memory_t *)a_info->fapi_font->memory, length, 1, "get_fapi_glyph_data");
-
+
if (!a_info->glyph_data) {
a_info->glyph_data_length = 0;
return FT_Err_Out_Of_Memory;
@@ -375,7 +372,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
FT_Long w;
FT_Long h;
FT_Long fflags;
-
+
/* Save a_fapi_font->char_data, which is set to null by FAPI_FF_get_glyph as part of a hack to
* make the deprecated Type 2 endchar ('seac') work, so that it can be restored
* after the first call to FT_Load_Glyph.
@@ -438,7 +435,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
else {
/* Current FreeType hinting for type 1 fonts is so poor we are actually better off without it (fewer files render incorrectly) (FT_LOAD_NO_HINTING) */
ft_error = FT_Load_Glyph(ft_face, index, FT_LOAD_MONOCHROME | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_LINEAR_DESIGN);
- if (ft_error == FT_Err_Invalid_File_Format)
+ if (ft_error == FT_Err_Invalid_File_Format)
return index+1;
}
}
@@ -452,7 +449,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
ft_face->face_flags = fflags;
}
-
+
if (ft_error == FT_Err_Out_Of_Memory || ft_error == FT_Err_Array_Too_Large) {
return(e_VMerror);
}
@@ -461,15 +458,15 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_error) {
a_fapi_font->char_data = (void *)".notdef";
a_fapi_font->char_data_len = 7;
-
+
/* We want to prevent hinting, even for a "tricky" font - it shouldn't matter for the notdef */
fflags = ft_face->face_flags;
ft_face->face_flags &= ~FT_FACE_FLAG_TRICKY;
-
+
ft_error_fb = FT_Load_Glyph(ft_face, 0, FT_LOAD_MONOCHROME | FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_LINEAR_DESIGN);
-
+
ft_face->face_flags = fflags;
-
+
a_fapi_font->char_data = saved_char_data;
a_fapi_font->char_data_len = saved_char_data_len;
}
@@ -492,7 +489,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
w = (FT_Long)((((double)ft_face->glyph->metrics.width * ft_face->units_per_EM / face->width) / face->horz_res) * 72);
h = (FT_Long)((((double)ft_face->glyph->metrics.height * ft_face->units_per_EM / face->height) / face->vert_res) * 72);
- /* Ugly. FreeType creates verticla metrics for TT fonts, normally we override them in the
+ /* Ugly. FreeType creates verticla metrics for TT fonts, normally we override them in the
* metrics callbacks, but those only work for incremental interface fonts, and TrueType fonts
* loaded as CIDFont replacements are not incrementally handled. So here, if its a CIDFont, and
* its not type 1 outlines, and its not a vertical mode fotn, ignore the advance.
@@ -501,7 +498,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
vadv = 0;
else
vadv = ft_face->glyph->linearVertAdvance;
-
+
a_metrics->bbox_x0 = hx;
a_metrics->bbox_y0 = hy - h;
a_metrics->bbox_x1 = a_metrics->bbox_x0 + w;
@@ -513,12 +510,12 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
}
if ((!ft_error || !ft_error_fb) && a_bitmap == true) {
-
+
FT_BBox cbox;
/* compute the control box, and grid fit it - lifted from ft_raster1_render() */
FT_Outline_Get_CBox(&ft_face->glyph->outline,&cbox);
- /* These round operations are only to preserve behaviour compared to the 9.00 release
+ /* These round operations are only to preserve behaviour compared to the 9.00 release
which used the bitmap dimensions as calculated by Freetype.
But FT_PIX_FLOOR/FT_PIX_CEIL aren't public.
*/
@@ -533,8 +530,8 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (ft_face->glyph->format != FT_GLYPH_FORMAT_BITMAP && ft_face->glyph->format != FT_GLYPH_FORMAT_COMPOSITE) {
if ((bitmap_raster(w) * h) < max_bitmap) {
FT_Render_Mode mode = FT_RENDER_MODE_MONO;
-
- ft_error = FT_Render_Glyph(ft_face->glyph, mode);
+
+ ft_error = FT_Render_Glyph(ft_face->glyph, mode);
}
else {
(*a_glyph) = NULL;
@@ -553,7 +550,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
emprintf1(a_fapi_font->memory,
"TrueType glyph %d uses more instructions than the declared maximum in the font.",
a_char_ref->char_code);
-
+
if (!ft_error_fb) {
emprintf(a_fapi_font->memory, " Continuing, falling back to notdef\n\n");
}
@@ -567,7 +564,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
emprintf1(a_fapi_font->memory,
"TrueType parsing error in glyph %d in the font.",
a_char_ref->char_code);
-
+
if (!ft_error_fb) {
emprintf(a_fapi_font->memory, " Continuing, falling back to notdef\n\n");
}
@@ -581,7 +578,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
emprintf1(a_fapi_font->memory,
"TrueType instruction error in glyph %d in the font.",
a_char_ref->char_code);
-
+
if (!ft_error_fb) {
emprintf(a_fapi_font->memory, " Continuing, falling back to notdef\n\n");
}
@@ -595,7 +592,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
emprintf1(a_fapi_font->memory,
"FreeType is unable to find the glyph %d in the font.",
a_char_ref->char_code);
-
+
if (!ft_error_fb) {
emprintf(a_fapi_font->memory, " Continuing, falling back to notdef\n\n");
}
@@ -604,7 +601,7 @@ load_glyph(FAPI_font *a_fapi_font, const FAPI_char_ref *a_char_ref,
if (!ft_error_fb) ft_error = 0;
}
return ft_to_gs_error(ft_error);
-}
+}
/*
* Ensure that the rasterizer is open.
@@ -618,7 +615,7 @@ ensure_open(FAPI_server *a_server, const byte *server_param, int server_param_si
if (!s->freetype_library)
{
FT_Error ft_error;
-
+
/* As we want FT to use our memory management, we cannot use the convenience of
* FT_Init_FreeType(), we have to do each stage "manually"
*/
@@ -626,12 +623,12 @@ ensure_open(FAPI_server *a_server, const byte *server_param, int server_param_si
if (!s->ftmemory) {
return(-1);
}
-
+
s->ftmemory->user = s->mem;
s->ftmemory->alloc = FF_alloc;
s->ftmemory->free = FF_free;
s->ftmemory->realloc = FF_realloc;
-
+
ft_error = FT_New_Library(s->ftmemory, &s->freetype_library);
if (ft_error) {
gs_free (s->mem, s->ftmemory, 0, 0, "ensure_open");
@@ -687,10 +684,10 @@ transform_decompose(FT_Matrix *a_transform, FT_UInt *xresp, FT_UInt *yresp, FT_F
FT_UInt xres;
FT_UInt yres;
FT_Vector vectx, vecty;
-
+
scalex = hypot ((double)a_transform->xx, (double)a_transform->xy);
scaley = hypot ((double)a_transform->yx, (double)a_transform->yy);
-
+
if (*xresp != *yresp) {
/* We need to give the resolution in "glyph space", taking account of rotation and
* shearing, so that makes life a little complicated when non-square resolutions
@@ -699,15 +696,15 @@ transform_decompose(FT_Matrix *a_transform, FT_UInt *xresp, FT_UInt *yresp, FT_F
ftscale_mat.xx = scalex;
ftscale_mat.xy = ftscale_mat.yx = 0;
ftscale_mat.yy = scaley;
-
+
FT_Matrix_Invert(&ftscale_mat);
-
+
FT_Matrix_Multiply (a_transform, &ftscale_mat);
-
+
vectx.x = *xresp << 16;
vecty.y = *yresp << 16;
vectx.y = vecty.x = 0;
-
+
FT_Vector_Transform (&vectx, &ftscale_mat);
FT_Vector_Transform (&vecty, &ftscale_mat);
xres = (FT_UInt)((hypot ((double)vectx.x, (double)vecty.x) / 65536.0) + 0.5);
@@ -718,7 +715,7 @@ transform_decompose(FT_Matrix *a_transform, FT_UInt *xresp, FT_UInt *yresp, FT_F
xres = *xresp;
yres = *yresp;
}
-
+
scalex /= 65536.0;
scaley /= 65536.0;
/* FT clamps the width and height to a lower limit of 1.0 units
@@ -747,23 +744,23 @@ transform_decompose(FT_Matrix *a_transform, FT_UInt *xresp, FT_UInt *yresp, FT_F
scaley = scaley * fact;
scalex = scalex * fact;
}
-
+
/* These seemingly arbitrary numbers are derived from a) using 64ths of a unit
and b) the calculations done in FT_Request_Metrics() to derive the ppem.
This is necessary due to FT's need for them ppem to be an in larger than 1
- see tt_size_reset().
-
+
The calculation has been rearranged to reduce (in particular) the number of
floating point divisions.
*/
if ((scaley * 64 * yres) < 2268.0)
{
fact = 2400.0 / (64 * yres) / scaley;
-
+
scaley *= fact;
scalex *= fact;
}
-
+
/* We also have to watch for variable overflow in Freetype.
* I've opted to fiddle with the resolution here, as it is
* almost always a larger value than the text size, and therefore
@@ -784,34 +781,34 @@ transform_decompose(FT_Matrix *a_transform, FT_UInt *xresp, FT_UInt *yresp, FT_F
scalex = scalex * fact;
scaley = scaley * fact;
}
-
+
/* see above */
if ((scalex * 64 * xres) < 2268.0)
{
fact = 2400.0 / (64 * xres) / scalex;
-
+
scaley *= fact;
scalex *= fact;
}
-
+
/* see above */
fact = 1;
while (((scaley * yres) / 72) > 256.0 && xres > 0 && yres > 0) {
xres /= 2;
yres /= 2;
-
+
fact *= 2;
}
}
-
+
ftscale_mat.xx = (FT_Fixed)(((1.0 / scalex)) * 65536.0) * fact;
ftscale_mat.xy = 0;
ftscale_mat.yx = 0;
ftscale_mat.yy = (FT_Fixed)(((1.0 / scaley)) * 65536.0) * fact;
-
+
FT_Matrix_Multiply (a_transform, &ftscale_mat);
memcpy(a_transform, &ftscale_mat, sizeof(FT_Matrix));
-
+
*xresp = xres;
*yresp = yres;
/* Return values ready scaled for FT */
@@ -831,7 +828,7 @@ get_scaled_font(FAPI_server *a_server, FAPI_font *a_font,
FF_server *s = (FF_server*)a_server;
FF_face *face = (FF_face*)a_font->server_font_data;
FT_Error ft_error = 0;
-
+
if (s->bitmap_glyph) {
FT_Bitmap_Done (s->freetype_library, &s->bitmap_glyph->bitmap);
s->bitmap_glyph = NULL;
@@ -840,7 +837,6 @@ get_scaled_font(FAPI_server *a_server, FAPI_font *a_font,
FT_Outline_Done (s->freetype_library, &s->outline_glyph->outline);
s->outline_glyph = NULL;
}
-
/* dpf("get_scaled_font enter: is_type1=%d is_cid=%d font_file_path='%s' a_descendant_code=%d\n",
a_font->is_type1, a_font->is_cid, a_font->font_file_path ? a_font->font_file_path : "", a_descendant_code); */
@@ -915,7 +911,7 @@ get_scaled_font(FAPI_server *a_server, FAPI_font *a_font,
}
/* It must be type 42 (see code in FAPI_FF_get_glyph in zfapi.c). */
- else
+ else
{
/* Get the length of the TrueType data. */
open_args.memory_size = a_font->get_long(a_font, FAPI_FONT_FEATURE_TT_size, 0);
@@ -962,7 +958,7 @@ get_scaled_font(FAPI_server *a_server, FAPI_font *a_font,
a_font->server_font_data = face;
}
else
- a_font->server_font_data = NULL;
+ a_font->server_font_data = NULL;
}
/* Set the point size and transformation.
@@ -979,18 +975,18 @@ get_scaled_font(FAPI_server *a_server, FAPI_font *a_font,
face->ft_transform.xy = a_font_scale->matrix[2];
face->ft_transform.yx = a_font_scale->matrix[1];
face->ft_transform.yy = a_font_scale->matrix[3];
-
+
face->horz_res = a_font_scale->HWResolution[0] >> 16;
face->vert_res = a_font_scale->HWResolution[1] >> 16;
-
+
/* Split the transform into scale factors and a rotation-and-shear
* transform.
*/
transform_decompose(&face->ft_transform, &face->horz_res, &face->vert_res, &face->width, &face->height);
-
+
ft_error = FT_Set_Char_Size(face->ft_face, face->width, face->height,
face->horz_res, face->vert_res);
-
+
if (ft_error)
{
/* The code originally cleaned up the face data here, but the "top level"
@@ -1168,7 +1164,7 @@ static int move_to(const FT_Vector *aTo, void *aObject)
FF_path_info *p = (FF_path_info*)aObject;
/* FAPI expects that co-ordinates will be as implied by frac_shift
- * in our case 16.16 fixed precision. True for 'low level' FT
+ * in our case 16.16 fixed precision. True for 'low level' FT
* routines (apparently), it isn't true for these routines where
* FT returns a 26.6 format. Rescale to 16.16 so that FAPI will
* be able to convert to GS co-ordinates properly.
@@ -1197,7 +1193,7 @@ static int conic_to(const FT_Vector *aControl, const FT_Vector *aTo, void *aObje
floatp x, y, Controlx, Controly;
int64_t Control1x, Control1y, Control2x, Control2y;
floatp sx, sy;
-
+
/* More complivated than above, we need to do arithmetic on the
* co-ordinates, so we want them as floats and we will convert the
* result into 16.16 fixed precision for FAPI
@@ -1287,11 +1283,11 @@ get_char_outline(FAPI_server *a_server, FAPI_path *a_path)
static FAPI_retcode release_char_data(FAPI_server *a_server)
{
FF_server *s = (FF_server*)a_server;
-
+
if (s->outline_glyph) {
FT_Outline_Done (s->freetype_library, &s->outline_glyph->outline);
}
-
+
if (s->bitmap_glyph) {
FT_Bitmap_Done (s->freetype_library, &s->bitmap_glyph->bitmap);
}
@@ -1372,10 +1368,10 @@ int gs_fapi_ft_instantiate( i_plugin_client_memory *a_memory, i_plugin_instance
static void gs_freetype_destroy(i_plugin_instance *a_plugin_instance, i_plugin_client_memory *a_memory)
{
FF_server *server = (FF_server *)a_plugin_instance;
-
+
FT_Done_Glyph(&server->outline_glyph->root);
FT_Done_Glyph(&server->bitmap_glyph->root);
-
+
/* As with initialization: since we're supplying memory management to
* FT, we cannot just to use FT_Done_FreeType (), we have to use
* FT_Done_Library () and then discard the memory ourselves
diff --git a/gs/psi/fapibstm.c b/gs/psi/fapibstm.c
index 39e6e00d1..efc4aad38 100644
--- a/gs/psi/fapibstm.c
+++ b/gs/psi/fapibstm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,54 +66,54 @@ static int InitFont(Bitstream_server *server, FAPI_font *ff)
{
if (ff->is_type1)
{
- type = ff->get_word(ff, FAPI_FONT_FEATURE_FontType, 0);
-
- /* Tell the FAPI interface that we need to *not* decrypt the /Subrs data. */
- ff->need_decrypt = false;
-
- /*
- Serialise a type 1 font in PostScript source form, or
- a Type 2 font in binary form, so that FreeType can read it.
- */
- if (type == 1)
- length = FF_serialize_type1_font_complete(ff, NULL, 0);
- else
- length = FF_serialize_type2_font(ff, NULL, 0);
- own_font_data = gs_malloc(mem, 1, length, "Type 1 font copy");
- if (type == 1)
- written = FF_serialize_type1_font_complete(ff, own_font_data, length);
- else
- written = FF_serialize_type2_font(ff, own_font_data, length);
- if (written != length)
- return(e_unregistered); /* Must not happen. */
+ type = ff->get_word(ff, FAPI_FONT_FEATURE_FontType, 0);
+
+ /* Tell the FAPI interface that we need to *not* decrypt the /Subrs data. */
+ ff->need_decrypt = false;
+
+ /*
+ Serialise a type 1 font in PostScript source form, or
+ a Type 2 font in binary form, so that FreeType can read it.
+ */
+ if (type == 1)
+ length = FF_serialize_type1_font_complete(ff, NULL, 0);
+ else
+ length = FF_serialize_type2_font(ff, NULL, 0);
+ own_font_data = gs_malloc(mem, 1, length, "Type 1 font copy");
+ if (type == 1)
+ written = FF_serialize_type1_font_complete(ff, own_font_data, length);
+ else
+ written = FF_serialize_type2_font(ff, own_font_data, length);
+ if (written != length)
+ return(e_unregistered); /* Must not happen. */
+ }
+ /* It must be type 42 (see code in FAPI_FF_get_glyph in zfapi.c). */
+ else
+ {
+ /* Get the length of the TrueType data. */
+ long length = ff->get_long(ff, FAPI_FONT_FEATURE_TT_size, 0);
+ if (length == 0)
+ return e_invalidfont;
+
+ /* Load the TrueType data into a single buffer. */
+ own_font_data = gs_malloc(mem, 1, length, "Type 42 fotn copy");
+ if (!own_font_data)
+ return e_VMerror;
+ if (ff->serialize_tt_font(ff, own_font_data, length))
+ return e_invalidfont;
}
- /* It must be type 42 (see code in FAPI_FF_get_glyph in zfapi.c). */
- else
- {
- /* Get the length of the TrueType data. */
- long length = ff->get_long(ff, FAPI_FONT_FEATURE_TT_size, 0);
- if (length == 0)
- return e_invalidfont;
-
- /* Load the TrueType data into a single buffer. */
- own_font_data = gs_malloc(mem, 1, length, "Type 42 fotn copy");
- if (!own_font_data)
- return e_VMerror;
- if (ff->serialize_tt_font(ff, own_font_data, length))
- return e_invalidfont;
- }
}
face->font_data = own_font_data;
face->Input = New_InputStream3(face->MemObject, own_font_data, length, &error);
if (ff->is_type1) {
- if (type == 1)
- face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_1, 1, face->Input, NULL, NULL, &error);
- else
- face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_2, 1, face->Input, NULL, NULL, &error);
- }
- else
+ if (type == 1)
+ face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_1, 1, face->Input, NULL, NULL, &error);
+ else
+ face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_2, 1, face->Input, NULL, NULL, &error);
+ }
+ else
{
- face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_TT_OR_T2K, 1, face->Input, NULL, NULL, &error);
+ face->sfnt = FF_New_sfntClass(face->MemObject, FONT_TYPE_TT_OR_T2K, 1, face->Input, NULL, NULL, &error);
}
face->T2K = NewT2K(face->MemObject, face->sfnt, &error);
face->Initialised = 1;
@@ -125,23 +125,23 @@ static FAPI_retcode ensure_open(FAPI_server *server, const byte *server_param, i
return 0;
}
-static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
+static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
const FAPI_font_scale *font_scale, const char *xlatmap, FAPI_descendant_code dc)
{
Bitstream_server *Bserver = (Bitstream_server *)server;
Bitstream_face *face = (Bitstream_face*)ff->server_font_data;
if(face == NULL) {
- gs_memory_t *mem = (gs_memory_t *)Bserver->client_mem.client_data;
- int error;
-
- face = (Bitstream_face *)gs_malloc(mem, 1, sizeof(Bitstream_face), "Bitstream_face alloc");
- face->MemObject = tsi_NewMemhandler(&error);
- if (error)
- return -1;
- face->Initialised = 0;
- ff->server_font_data = face;
- Bserver->ff = ff;
+ gs_memory_t *mem = (gs_memory_t *)Bserver->client_mem.client_data;
+ int error;
+
+ face = (Bitstream_face *)gs_malloc(mem, 1, sizeof(Bitstream_face), "Bitstream_face alloc");
+ face->MemObject = tsi_NewMemhandler(&error);
+ if (error)
+ return -1;
+ face->Initialised = 0;
+ ff->server_font_data = face;
+ Bserver->ff = ff;
}
face->HRes = font_scale->HWResolution[0] >> 16;
face->VRes = font_scale->HWResolution[1] >> 16;
@@ -202,11 +202,11 @@ static FAPI_retcode get_char_raster_metrics(FAPI_server *server, FAPI_font *ff,
int error;
if(!face->Initialised)
- InitFont((Bitstream_server *)server, ff);
+ InitFont((Bitstream_server *)server, ff);
T2K_NewTransformation(face->T2K, 1, face->HRes, face->VRes, &face->trans, false, &error);
- T2K_RenderGlyph(face->T2K, c->char_code, 0, 0, BLACK_AND_WHITE_BITMAP,
- T2K_NAT_GRID_FIT | T2K_RETURN_OUTLINES | T2K_SCAN_CONVERT, &error);
+ T2K_RenderGlyph(face->T2K, c->char_code, 0, 0, BLACK_AND_WHITE_BITMAP,
+ T2K_NAT_GRID_FIT | T2K_RETURN_OUTLINES | T2K_SCAN_CONVERT, &error);
metrics->bbox_x0 = face->T2K->fLeft26Dot6 >> 6;
metrics->bbox_y0 = 0;
@@ -262,11 +262,11 @@ static FAPI_retcode release_typeface(FAPI_server *server, void *font_data)
gs_memory_t *mem = (gs_memory_t *)Bserver->client_mem.client_data;
if(face->Initialised) {
- DeleteT2K(face->T2K, &error);
- FF_Delete_sfntClass(face->sfnt, &error);
- Delete_InputStream(face->Input, &error);
- gs_free(mem, face->font_data, 0, 0, "free font copy");
- tsi_DeleteMemhandler(face->MemObject);
+ DeleteT2K(face->T2K, &error);
+ FF_Delete_sfntClass(face->sfnt, &error);
+ Delete_InputStream(face->Input, &error);
+ gs_free(mem, face->font_data, 0, 0, "free font copy");
+ tsi_DeleteMemhandler(face->MemObject);
}
return 0;
}
@@ -284,7 +284,6 @@ static const i_plugin_descriptor bitstream_descriptor = {
gs_fapibstm_finit
};
-
static const FAPI_server If0 = {
{ &bitstream_descriptor
},
@@ -315,24 +314,24 @@ static const FAPI_server If0 = {
plugin_instantiation_proc(gs_fapibstm_instantiate); /* check prototype */
int gs_fapibstm_instantiate(i_plugin_client_memory *client_mem, i_plugin_instance **p_instance)
-{
+{
int error;
tsiMemObject *mem = NULL;
fapi_bitstream_server *r;
-
+
r = (fapi_bitstream_server *)client_mem->alloc(client_mem, sizeof(fapi_bitstream_server), "fapi_bitstream_server");
if (r == 0)
return e_VMerror;
memset(r, 0, sizeof(*r));
r->If = If0;
r->client_mem = *client_mem;
- *p_instance = &r->If.ig;
+ *p_instance = &r->If.ig;
return 0;
}
static void gs_fapibstm_finit(i_plugin_instance *this, i_plugin_client_memory *mem)
-{
+{
fapi_bitstream_server *r = (fapi_bitstream_server *)this;
if (r->If.ig.d != &bitstream_descriptor)
diff --git a/gs/psi/fapiufst.c b/gs/psi/fapiufst.c
index 4cc691806..2f87c4adf 100644
--- a/gs/psi/fapiufst.c
+++ b/gs/psi/fapiufst.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -162,7 +162,7 @@ typedef struct {
char decodingID[40];
} ufst_common_font_data;
-typedef struct {
+typedef struct {
PCLETTO_CHR_HDR h;
UW16 add_data;
UW16 charDataSize;
@@ -201,7 +201,6 @@ static inline fapi_ufst_server *IFS_to_I(IF_STATE *pIFS)
{ return (fapi_ufst_server *)((char *)pIFS - offset_of(fapi_ufst_server, IFS));
}
-
/*------------------ FAPI_server members ------------------------------------*/
static inline void release_char_data_inline(fapi_ufst_server *r)
@@ -217,7 +216,7 @@ static inline void release_char_data_inline(fapi_ufst_server *r)
This function provides it.
*/
if (r->char_data != NULL) {
- FSA_FROM_SERVER;
+ FSA_FROM_SERVER;
CHARfree(FSA (MEM_HANDLE)r->char_data);
r->char_data = 0;
@@ -258,52 +257,52 @@ static FAPI_retcode open_UFST(fapi_ufst_server *r, const byte *server_param, int
}
for (; p < e ; p = q + 1) {
- for (q = p; q < e && *q != sep; q++)
- /* DO_NOTHING */;
- l = q - p;
- if (l > keySSdir_length && !memcmp(p, keySSdir, keySSdir_length)) {
- l = q - p - keySSdir_length;
- if (l > sizeof(ufst_root_dir) - 1)
- l = sizeof(ufst_root_dir) - 1;
- memcpy(ufst_root_dir, p + keySSdir_length, l);
- ufst_root_dir[l] = 0;
- bSSdir = TRUE;
- } else if (l > keyPlugIn_length && !memcmp(p, keyPlugIn, keyPlugIn_length)) {
- l = q - p - keyPlugIn_length;
- if (l > sizeof(sPlugIn) - 1)
- l = sizeof(sPlugIn) - 1;
- memcpy(sPlugIn, p + keyPlugIn_length, l);
- sPlugIn[l] = 0;
- bPlugIn = TRUE;
- } else
- emprintf(r->client_mem.client_data,
+ for (q = p; q < e && *q != sep; q++)
+ /* DO_NOTHING */;
+ l = q - p;
+ if (l > keySSdir_length && !memcmp(p, keySSdir, keySSdir_length)) {
+ l = q - p - keySSdir_length;
+ if (l > sizeof(ufst_root_dir) - 1)
+ l = sizeof(ufst_root_dir) - 1;
+ memcpy(ufst_root_dir, p + keySSdir_length, l);
+ ufst_root_dir[l] = 0;
+ bSSdir = TRUE;
+ } else if (l > keyPlugIn_length && !memcmp(p, keyPlugIn, keyPlugIn_length)) {
+ l = q - p - keyPlugIn_length;
+ if (l > sizeof(sPlugIn) - 1)
+ l = sizeof(sPlugIn) - 1;
+ memcpy(sPlugIn, p + keyPlugIn_length, l);
+ sPlugIn[l] = 0;
+ bPlugIn = TRUE;
+ } else
+ emprintf(r->client_mem.client_data,
"Warning: Unknown UFST parameter ignored.\n");
}
#if !NO_SYMSET_MAPPING
if (!bSSdir) {
- strcpy(ufst_root_dir, ".");
- emprintf(r->client_mem.client_data,
+ strcpy(ufst_root_dir, ".");
+ emprintf(r->client_mem.client_data,
"Warning: UFST_SSdir is not specified, will search *.ss files in the curent directory.\n");
}
#endif
code = gx_UFST_init(r->client_mem.client_data, (const UB8 *)ufst_root_dir);
if (code < 0)
- return code;
+ return code;
r->ufst_is_singleton = (code == 1);
CGIFfont_access (FSA DISK_ACCESS);
if (bPlugIn) {
- if ((code = gx_UFST_open_static_fco(sPlugIn, &fcHandle)) != 0)
- return code;
- if ((code = CGIFfco_Plugin(FSA fcHandle)) != 0)
- return code;
+ if ((code = gx_UFST_open_static_fco(sPlugIn, &fcHandle)) != 0)
+ return code;
+ if ((code = CGIFfco_Plugin(FSA fcHandle)) != 0)
+ return code;
} else {
#ifdef FCO_RDR
- emprintf(r->client_mem.client_data,
+ emprintf(r->client_mem.client_data,
"Warning: UFST_PlugIn is not specified, some characters may be missing.\n");
#endif
}
return 0;
-}
+}
static LPUB8 impl_PCLchId2ptr(FSP UW16 chId);
@@ -315,11 +314,11 @@ static FAPI_retcode ensure_open(FAPI_server *server, const byte *server_param, i
return 0;
r->bInitialized = 1;
{
- code = open_UFST(r, server_param, server_param_size);
- if (code < 0) {
- emprintf(r->client_mem.client_data, "Error opening the UFST font server.\n");
- return code;
- }
+ code = open_UFST(r, server_param, server_param_size);
+ if (code < 0) {
+ emprintf(r->client_mem.client_data, "Error opening the UFST font server.\n");
+ return code;
+ }
}
gx_set_UFST_Callbacks(NULL, impl_PCLchId2ptr, impl_PCLchId2ptr);
return 0;
@@ -343,17 +342,16 @@ static UW16 get_font_type(stream *f)
return 0; /* fixme : unknown type - actually an error. */
}
-
static int choose_decoding_general(fapi_ufst_server *r, ufst_common_font_data *d, const char *cmapId)
-{
+{
if (!d->decodingID[0])
- strncpy(d->decodingID, "Unicode", sizeof(d->decodingID));
+ strncpy(d->decodingID, "Unicode", sizeof(d->decodingID));
/* fixme : must depend on charset used in the font. */
return 1;
}
static int choose_decoding_TT(fapi_ufst_server *r, ufst_common_font_data *d, const char *cmapId)
-{
+{
#if TT_ROM || TT_DISK
int platId, specId, i;
CMAP_QUERY q;
@@ -379,12 +377,12 @@ static int choose_decoding_TT(fapi_ufst_server *r, ufst_common_font_data *d, con
return 0;
#else
if (!d->decodingID[0])
- strncpy(d->decodingID, "Unicode", sizeof(d->decodingID));
+ strncpy(d->decodingID, "Unicode", sizeof(d->decodingID));
return 1;
#endif
}
-static void scan_xlatmap(fapi_ufst_server *r, ufst_common_font_data *d, const char *xlatmap, const char *font_kind,
+static void scan_xlatmap(fapi_ufst_server *r, ufst_common_font_data *d, const char *xlatmap, const char *font_kind,
int (*choose_proc)(fapi_ufst_server *r, ufst_common_font_data *d, const char *cmapId))
{ const char *p = xlatmap;
@@ -412,13 +410,13 @@ static void choose_decoding(fapi_ufst_server *r, ufst_common_font_data *d, const
case FC_PST1_TYPE: scan_xlatmap(r, d, xlatmap, "PostScript", choose_decoding_general); break;
case FC_TT_TYPE: scan_xlatmap(r, d, xlatmap, "TrueType", choose_decoding_TT); break;
case FC_FCO_TYPE: scan_xlatmap(r, d, xlatmap, "Microtype", choose_decoding_general); break;
- }
+ }
}
static inline void store_word(byte **p, ushort w)
{ *((*p)++) = w / 256;
*((*p)++) = w % 256;
-
+
}
static LPUB8 get_TT_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
@@ -442,10 +440,10 @@ static LPUB8 get_TT_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
r->callback_error = e_invalidfont;
return 0;
}
- g = (pcleo_glyph_list_elem *)r->client_mem.alloc(&r->client_mem,
- sizeof(pcleo_glyph_list_elem) +
- (use_XL_format ? 12 : sizeof(PCLETTO_CHDR)) + glyph_length + 2,
- "PCLETTO char");
+ g = (pcleo_glyph_list_elem *)r->client_mem.alloc(&r->client_mem,
+ sizeof(pcleo_glyph_list_elem) +
+ (use_XL_format ? 12 : sizeof(PCLETTO_CHDR)) + glyph_length + 2,
+ "PCLETTO char");
if (g == 0) {
r->callback_error = e_VMerror;
return 0;
@@ -456,21 +454,21 @@ static LPUB8 get_TT_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
h = (PCLETTO_CHDR *)(g + 1);
h->h.format = 15;
if (use_XL_format) {
- h->h.continuation = 2;
- q = (LPUB8)h + 2;
- store_word(&q, (ushort)(glyph_length + 10));
- store_word(&q, (ushort)(r->sb_x >> r->If.frac_shift)); /* see can_replace_metrics */
- store_word(&q, (ushort)(r->aw_x >> r->If.frac_shift));
- store_word(&q, 0);
- store_word(&q, chId);
+ h->h.continuation = 2;
+ q = (LPUB8)h + 2;
+ store_word(&q, (ushort)(glyph_length + 10));
+ store_word(&q, (ushort)(r->sb_x >> r->If.frac_shift)); /* see can_replace_metrics */
+ store_word(&q, (ushort)(r->aw_x >> r->If.frac_shift));
+ store_word(&q, 0);
+ store_word(&q, chId);
} else {
- h->h.continuation = 0;
- h->h.descriptorsize = 4;
- h->h.ch_class = 15;
- h->add_data = 0;
- q = (LPUB8)&h->charDataSize;
- store_word(&q, (ushort)(glyph_length + 4));
- store_word(&q, chId);
+ h->h.continuation = 0;
+ h->h.descriptorsize = 4;
+ h->h.ch_class = 15;
+ h->add_data = 0;
+ q = (LPUB8)&h->charDataSize;
+ store_word(&q, (ushort)(glyph_length + 4));
+ store_word(&q, chId);
}
if (ff->get_glyph(ff, chId, (LPUB8)q, glyph_length) == (ushort)-1) {
r->callback_error = e_invalidfont;
@@ -491,7 +489,7 @@ static LPUB8 get_TT_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
}
static LPUB8 get_T1_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
-{
+{
#if PST1_SFNTI
#if UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2
ushort glyph_length = ff->get_glyph(ff, chId, 0, 0);
@@ -503,7 +501,7 @@ static LPUB8 get_T1_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
FSA_FROM_SERVER;
d->glyphs = NULL;
-
+
charstring.len = glyph_length;
charstring.hdata = BUFalloc(charstring.len);
if (!charstring.hdata)
@@ -511,7 +509,7 @@ static LPUB8 get_T1_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
r->callback_error = e_VMerror;
return (NULL);
}
-
+
cstring = MEMptr(charstring.hdata);
if (ff->get_glyph(ff, chId, cstring, glyph_length) != glyph_length)
@@ -539,8 +537,8 @@ static LPUB8 get_T1_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
#else
ushort glyph_length = ff->get_glyph(ff, chId, 0, 0);
LPUB8 q;
- pcleo_glyph_list_elem *g = (pcleo_glyph_list_elem *)r->client_mem.alloc(&r->client_mem,
- sizeof(pcleo_glyph_list_elem) + sizeof(PS_CHAR_HDR) + 2 + 2 + glyph_length + 1, "PSEO char");
+ pcleo_glyph_list_elem *g = (pcleo_glyph_list_elem *)r->client_mem.alloc(&r->client_mem,
+ sizeof(pcleo_glyph_list_elem) + sizeof(PS_CHAR_HDR) + 2 + 2 + glyph_length + 1, "PSEO char");
PS_CHAR_HDR *h;
ufst_common_font_data *d = (ufst_common_font_data *)r->fc.font_hdr - 1;
FSA_FROM_SERVER;
@@ -559,7 +557,7 @@ static LPUB8 get_T1_glyph(fapi_ufst_server *r, FAPI_font *ff, UW16 chId)
h->ch_class = 11; /* contour=3, compound=4, tt=10, ps=11 */
h->len = 0; /* # of bytes to follow (not including csum) */
q = (byte *)h + sizeof(*h);
- /* A workaround for UFST4.6 bug in t1idecod.c (UNPACK_WORD uses pIFS->ph instead ph) :
+ /* A workaround for UFST4.6 bug in t1idecod.c (UNPACK_WORD uses pIFS->ph instead ph) :
setting Namelen=4, rather normally it must be 0. */
q[0] = 0; /* Namelen */
q[1] = 4; /* Namelen */
@@ -589,7 +587,7 @@ static pcleo_glyph_list_elem * find_glyph(ufst_common_font_data *d, UW16 chId)
/* UFST callback : */
static LPUB8 impl_PCLchId2ptr(FSP UW16 chId)
-{
+{
#if UFST_REENTRANT
fapi_ufst_server *r = IFS_to_I(pIFS);
#else
@@ -645,8 +643,8 @@ static inline void pack_float(LPUB8 *p, float v)
#define PACK_WORD(p, i, var) pack_word(&p, ff->get_word(ff, var, i))
#define PACK_LONG(p, i, var) pack_long(&p, ff->get_long(ff, var, i))
-static void pack_pseo_word_array(fapi_ufst_server *r, FAPI_font *ff, UB8 **p,
- UW16 max_count, fapi_font_feature count_id, fapi_font_feature array_id)
+static void pack_pseo_word_array(fapi_ufst_server *r, FAPI_font *ff, UB8 **p,
+ UW16 max_count, fapi_font_feature count_id, fapi_font_feature array_id)
{ UW16 k = min(ff->get_word(ff, count_id, 0), max_count), j;
pack_word(p, k);
@@ -660,12 +658,12 @@ static void pack_pseo_fhdr(fapi_ufst_server *r, FAPI_font *ff, UB8 *p)
{ ushort j, n, skip = 0;
while ((UL32)p & 0x03) /* align to QUADWORD */
- PACK_ZERO(p);
+ PACK_ZERO(p);
pack_long(&p, 1); /* format = 1 */
for (j = 0; j < 6; j++)
pack_float(&p, ff->get_float(ff, FAPI_FONT_FEATURE_FontMatrix, j));
while ((UL32)p & 0x03) /* align to QUADWORD */
- PACK_ZERO(p);
+ PACK_ZERO(p);
/* UFST has no definition for PSEO structure, so implement serialization : */
PACK_LONG(p, 0, FAPI_FONT_FEATURE_UniqueID);
PACK_LONG(p, 0, FAPI_FONT_FEATURE_BlueScale);
@@ -740,21 +738,21 @@ static char *my_strdup(fapi_ufst_server *r, const char *s, const char *cname)
static FAPI_retcode fco_open(fapi_ufst_server *r, const char *font_file_path, fco_list_elem **result)
{ int code;
fco_list_elem *e = gx_UFST_find_static_fco(font_file_path);
-
- if (e != NULL) {
- *result = e;
- return 0;
- }
+
+ if (e != NULL) {
+ *result = e;
+ return 0;
+ }
for (e = r->fco_list; e != 0; e = e->next) {
if (!strcmp(e->file_path, font_file_path))
break;
}
if (e == 0) {
SW16 fcHandle;
- FSA_FROM_SERVER;
+ FSA_FROM_SERVER;
- if ((code = CGIFfco_Open(FSA (UB8 *)font_file_path, &fcHandle)) != 0)
- return code;
+ if ((code = CGIFfco_Open(FSA (UB8 *)font_file_path, &fcHandle)) != 0)
+ return code;
e = (fco_list_elem *)r->client_mem.alloc(&r->client_mem, sizeof(*e), "fco_list_elem");
if (e == 0) {
CGIFfco_Close(FSA fcHandle);
@@ -797,11 +795,11 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
int subrs_length = ff->get_long(ff, FAPI_FONT_FEATURE_Subrs_total_size, 0);
int subrs_area_size;
int gsubrs_count = ff->get_word(ff, FAPI_FONT_FEATURE_GlobalSubrs_count, 0);
-
+
/* get_word() doesn't have an error return value, so I've used an unlikely value */
if (gsubrs_count != 65535)
subrs_count += gsubrs_count;
-
+
subrs_area_size = subrs_count * 5 + subrs_length + 2;
area_length += 360 + subrs_area_size; /* some inprecise - see pack_pseo_fhdr */
} else {
@@ -814,8 +812,7 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
} else {
#if UFST_VERSION_MAJOR < 6
int sind = strlen(font_file_path) - 1;
-
-
+
if ((font_file_path[sind] != 'o' || font_file_path[sind] != 'O') &&
(font_file_path[sind - 1] != 'c' || font_file_path[sind - 1] != 'C') &&
(font_file_path[sind - 2] != 'f' || font_file_path[sind - 2] != 'F') &&
@@ -828,9 +825,9 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
buf = r->client_mem.alloc(&r->client_mem, area_length, "ufst font data");
if (buf == 0)
return e_VMerror;
-
+
memset(buf, 0x00, area_length);
-
+
d = (ufst_common_font_data *)buf;
d->tt_font_body_offset = 0;
d->platformId = 0;
@@ -839,33 +836,33 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
d->glyphs = 0;
d->is_disk_font = (ff->font_file_path != NULL);
if (d->is_disk_font) {
- fco_list_elem *e = gx_UFST_find_static_fco(font_file_path);
-
- if (e != NULL) {
- memcpy(d + 1, font_file_path, strlen(font_file_path) + 1);
- d->font_id = (e->fcHandle << 16) | ff->subfont;
- d->font_type = FC_FCO_TYPE;
- } else {
- stream *f = sfopen(font_file_path, "rb", (gs_memory_t *)(r->client_mem.client_data));
- if (f == NULL) {
- emprintf1((gs_memory_t *)(r->client_mem.client_data),
+ fco_list_elem *e = gx_UFST_find_static_fco(font_file_path);
+
+ if (e != NULL) {
+ memcpy(d + 1, font_file_path, strlen(font_file_path) + 1);
+ d->font_id = (e->fcHandle << 16) | ff->subfont;
+ d->font_type = FC_FCO_TYPE;
+ } else {
+ stream *f = sfopen(font_file_path, "rb", (gs_memory_t *)(r->client_mem.client_data));
+ if (f == NULL) {
+ emprintf1((gs_memory_t *)(r->client_mem.client_data),
"fapiufst: Can't open %s\n",
font_file_path);
- return e_undefinedfilename;
- }
- memcpy(d + 1, font_file_path, strlen(font_file_path) + 1);
- d->font_type = get_font_type(f);
- sfclose(f);
- if (d->font_type == FC_FCO_TYPE) {
- fco_list_elem *e;
- if ((code = fco_open(r, font_file_path, &e)) != 0)
- return code;
- d->font_id = (e->fcHandle << 16) | ff->subfont;
- }
- }
+ return e_undefinedfilename;
+ }
+ memcpy(d + 1, font_file_path, strlen(font_file_path) + 1);
+ d->font_type = get_font_type(f);
+ sfclose(f);
+ if (d->font_type == FC_FCO_TYPE) {
+ fco_list_elem *e;
+ if ((code = fco_open(r, font_file_path, &e)) != 0)
+ return code;
+ d->font_id = (e->fcHandle << 16) | ff->subfont;
+ }
+ }
} else {
d->font_type = (ff->is_type1 ? FC_PST1_TYPE : FC_TT_TYPE);
- d->font_id = ff->get_long(ff, FAPI_FONT_FEATURE_UniqueID, 0);
+ d->font_id = ff->get_long(ff, FAPI_FONT_FEATURE_UniqueID, 0);
if (d->font_id < 0) {
d->font_id = ++font_ids;
}
@@ -926,15 +923,15 @@ static FAPI_retcode make_font_data(fapi_ufst_server *r, const char *font_file_pa
return e_unregistered; /* Must not happen because we skept 'glyp', 'loca' and 'cmap'. */
pseg[0] = 'G';
pseg[1] = 'T';
- if (use_XL_format) {
- pseg[2] = tt_size >> 24;
- pseg[3] = (tt_size >> 16) % 256;
- pseg[4] = (tt_size >> 8) % 256;
- pseg[5] = tt_size % 256;
- } else {
- pseg[2] = tt_size / 256;
- pseg[3] = tt_size % 256;
- }
+ if (use_XL_format) {
+ pseg[2] = tt_size >> 24;
+ pseg[3] = (tt_size >> 16) % 256;
+ pseg[4] = (tt_size >> 8) % 256;
+ pseg[5] = tt_size % 256;
+ } else {
+ pseg[2] = tt_size / 256;
+ pseg[3] = tt_size % 256;
+ }
d->tt_font_body_offset = (LPUB8)fontdata - (LPUB8)d;
if (ff->serialize_tt_font(ff, fontdata, tt_size))
return e_invalidfont;
@@ -958,7 +955,7 @@ static void prepare_typeface(fapi_ufst_server *r, ufst_common_font_data *d)
r->fc.format |= FC_EXTERN_TYPE;
}
-static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
+static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
const FAPI_font_scale *font_scale, const char *xlatmap, FAPI_descendant_code dc)
{ fapi_ufst_server *r = If_to_I(server);
FONTCONTEXT *fc = &r->fc;
@@ -975,19 +972,19 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
int world_scale = 0;
FSA_FROM_SERVER;
- if (ff->is_cid && ff->is_type1 && ff->font_file_path == NULL &&
+ if (ff->is_cid && ff->is_type1 && ff->font_file_path == NULL &&
(dc == FAPI_TOPLEVEL_BEGIN || dc == FAPI_TOPLEVEL_COMPLETE)) {
- /* Don't need any processing for the top level font of a non-disk CIDFontType 0.
- See comment in FAPI_prepare_font.
- Will do with its subfonts individually.
- */
- return 0;
+ /* Don't need any processing for the top level font of a non-disk CIDFontType 0.
+ See comment in FAPI_prepare_font.
+ Will do with its subfonts individually.
+ */
+ return 0;
}
-
+
ff->need_decrypt = 1;
if (d == 0) {
if ((code = make_font_data(r, ff->font_file_path, ff, &d)) != 0)
- return code;
+ return code;
ff->server_font_data = d;
prepare_typeface(r, d);
if (ff->font_file_path != NULL || ff->is_type1) /* such fonts don't use RAW_GLYPH */
@@ -1001,20 +998,20 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
fc->xspot = F_ONE;
fc->yspot = F_ONE;
fc->fc_type = FC_MAT2_TYPE;
-
- fc->s.m2.m[0] = (int)((double)font_scale->matrix[0] / hx + 0.5);
+
+ fc->s.m2.m[0] = (int)((double)font_scale->matrix[0] / hx + 0.5);
fc->s.m2.m[1] = (int)((double)font_scale->matrix[1] / hx + 0.5);
fc->s.m2.m[2] = (int)((double)font_scale->matrix[2] / hy + 0.5);
fc->s.m2.m[3] = (int)((double)font_scale->matrix[3] / hy + 0.5);
fc->s.m2.matrix_scale = 16;
fc->s.m2.xworld_res = font_scale->HWResolution[0] >> 16;
fc->s.m2.yworld_res = font_scale->HWResolution[1] >> 16;
-
+
if ((hx > 0 && hy > 0) && (hx < 1.5 || hy < 1.5)) {
world_scale = 8;
hx *= 256;
hy *= 256;
-
+
while (hx < 1.5 || hy < 1.5) {
world_scale += 8;
hx *= 256;
@@ -1029,13 +1026,13 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
fc->alignment = (font_scale->align_to_pixels ? GAGG : GAPP);
fc->ExtndFlags = 0;
if (d->font_type == FC_TT_TYPE)
- fc->ssnum = USER_CMAP;
+ fc->ssnum = USER_CMAP;
else if (d->font_type == FC_FCO_TYPE) {
- fc->ssnum = UNICODE;
+ fc->ssnum = UNICODE;
} else if (d->font_type == FC_PST1_TYPE) {
fc->ssnum = T1ENCODING;
}
-
+
if (d->font_type != FC_TT_TYPE && d->font_type != FC_FCO_TYPE) {
fc->ExtndFlags = EF_NOSYMSETMAP;
}
@@ -1045,7 +1042,7 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
fc->user_platID = d->platformId;
fc->user_specID = d->specificId;
if (use_XL_format)
- fc->ExtndFlags |= EF_XLFONT_TYPE;
+ fc->ExtndFlags |= EF_XLFONT_TYPE;
if (ff->is_vertical)
fc->ExtndFlags |= EF_UFSTVERT_TYPE;
fc->dl_ssnum = (d->specificId << 4) | d->platformId;
@@ -1054,7 +1051,7 @@ static FAPI_retcode get_scaled_font(FAPI_server *server, FAPI_font *ff,
code = CGIFfont(FSA fc);
if (r->callback_error != 0)
- return r->callback_error;
+ return r->callback_error;
return code;
}
@@ -1074,7 +1071,7 @@ static FAPI_retcode get_font_bbox(FAPI_server *server, FAPI_font *ff, int BBox[4
FSA_FROM_SERVER;
if ((code = CGIFbound_box(FSA BBox, &VLCPower)) < 0)
- return code;
+ return code;
/* UFST expands bbox for internal needs, and retrives the expanded bbox.
We believe it's bug in UFST.
Now we collapse it back to the correct size :
@@ -1098,9 +1095,9 @@ static FAPI_retcode get_font_proportional_feature(FAPI_server *server, FAPI_font
if (ff->font_file_path == NULL || ff->is_type1)
return 0;
#if TT_ROM || TT_DISK
- {
- UB8 buf[74];
- UL32 length = sizeof(buf);
+ {
+ UB8 buf[74];
+ UL32 length = sizeof(buf);
if (CGIFtt_query(FSA (UB8 *)ff->font_file_path, *(UL32 *)"OS/2", (UW16)ff->subfont, &length, buf) != 0)
return 0; /* No OS/2 table - no chance to get the info. Use default == FALSE. */
@@ -1126,10 +1123,10 @@ static FAPI_retcode can_retrieve_char_by_name(FAPI_server *server, FAPI_font *ff
*result = 0;
switch (r->fc.format & FC_FONTTYPE_MASK) {
- case FC_PST1_TYPE :
- *result = 1;
+ case FC_PST1_TYPE :
+ *result = 1;
break;
- case FC_TT_TYPE :
+ case FC_TT_TYPE :
break;
}
@@ -1138,7 +1135,7 @@ static FAPI_retcode can_retrieve_char_by_name(FAPI_server *server, FAPI_font *ff
static FAPI_retcode can_replace_metrics(FAPI_server *server, FAPI_font *ff, FAPI_char_ref *c, int *result)
{ *result = (!ff->is_type1 && ff->font_file_path == NULL &&
- c->metrics_scale == 0 && c->metrics_type == FAPI_METRICS_REPLACE);
+ c->metrics_scale == 0 && c->metrics_type == FAPI_METRICS_REPLACE);
return 0;
}
@@ -1193,7 +1190,7 @@ static FAPI_retcode get_char_width(FAPI_server *server, FAPI_font *ff, FAPI_char
CGIFchIdptr(FSA &cc, PSchar_name);
li[0]. CharType.IF_cgnum = cc;
if ((code = CGIFwidth(FSA li, 1, 4, buffer)) != 0)
- return code;
+ return code;
r->ff = 0;
/* CGIFhdr_font_purge (&r->fc);
release_glyphs(r, (ufst_common_font_data *)ff->server_font_data); */
@@ -1215,27 +1212,27 @@ static int export_outline(fapi_ufst_server *r, PIFOUTLINE pol, FAPI_path *p)
outchar = &pol->ol;
num_contrs = outchar->num_loops;
for(i = 0; i<num_contrs; i++) {
- num_segmts = outchar->loop[i].num_segmts;
+ num_segmts = outchar->loop[i].num_segmts;
segment = (LPSB8)((LPSB8)(outchar->loop) + outchar->loop[i].segmt_offset);
points = (PINTRVECTOR)((LPSB8)(outchar->loop) + outchar->loop[i].coord_offset);
for(j=0; j<num_segmts; j++) {
if(*segment == 0x00) {
- if ((p->gs_error = p->moveto(p, ((int64_t)points->x) << 16, ((int64_t)points->y) << 16)) != 0)
- return p->gs_error;
+ if ((p->gs_error = p->moveto(p, ((int64_t)points->x) << 16, ((int64_t)points->y) << 16)) != 0)
+ return p->gs_error;
points++;
} else if (*segment == 0x01) {
- if ((p->gs_error = p->lineto(p, ((int64_t)points->x) << 16, ((int64_t)points->y) << 16)) != 0)
- return p->gs_error;
+ if ((p->gs_error = p->lineto(p, ((int64_t)points->x) << 16, ((int64_t)points->y) << 16)) != 0)
+ return p->gs_error;
points++;
} else if (*segment == 0x02) {
points+=2;
return e_invalidfont; /* This must not happen */
} else if (*segment == 0x03) {
- if ((p->gs_error = p->curveto(p, ((int64_t)points[0].x) << 16, ((int64_t)points[0].y) << 16,
- ((int64_t)points[1].x) << 16, ((int64_t)points[1].y) << 16,
- ((int64_t)points[2].x) << 16, ((int64_t)points[2].y)<< 16) < 0))
- return p->gs_error;
+ if ((p->gs_error = p->curveto(p, ((int64_t)points[0].x) << 16, ((int64_t)points[0].y) << 16,
+ ((int64_t)points[1].x) << 16, ((int64_t)points[1].y) << 16,
+ ((int64_t)points[2].x) << 16, ((int64_t)points[2].y)<< 16) < 0))
+ return p->gs_error;
points+=3;
} else
return e_invalidfont; /* This must not happen */
@@ -1246,7 +1243,7 @@ static int export_outline(fapi_ufst_server *r, PIFOUTLINE pol, FAPI_path *p)
}
static inline void set_metrics(fapi_ufst_server *r, FAPI_metrics *metrics, SL32 design_bbox[4], SW16 design_escapement[2], SW16 du_emx, SW16 du_emy)
-{
+{
metrics->escapement = design_escapement[0];
metrics->v_escapement = design_escapement[1];
@@ -1274,9 +1271,9 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
bool need_decrypt = ff->need_decrypt;
int length;
FSA_FROM_SERVER;
-
+
design_escapement[0] = design_escapement[1] = 0;
-
+
if (ff->is_type1) {
/* If a charstring in a Type 1 has been replaced with a PS procedure
* get_glyph will return -1. We can then return char_code + 1 which
@@ -1293,7 +1290,7 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
memset(metrics, 0, sizeof(*metrics));
metrics->bbox_x1 = -1;
-
+
if (ff->is_type1 && !ff->is_cid) {
int len = min(ff->char_data_len, sizeof(PSchar_name) - 1);
memcpy (PSchar_name, ff->char_data, len);
@@ -1303,8 +1300,8 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
}
CGIFchIdptr(FSA &cc, PSchar_name); /* fixme : Likely only FC_PST1_TYPE needs it. */
- { /* hack : Changing UFST internal data. Change to r->fc doesn't help,
- because UFST thinks that the "outline/raster" is a property of current font. */
+ { /* hack : Changing UFST internal data. Change to r->fc doesn't help,
+ because UFST thinks that the "outline/raster" is a property of current font. */
pIFS->fcCur.format &= ~FC_OUTPUT_MASK;
pIFS->fcCur.format |= format;
}
@@ -1315,14 +1312,14 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
r->aw_x = c->aw_x;
r->metrics_type = c->metrics_type;
if (d->font_type == FC_FCO_TYPE && r->fc.ExtndFlags & EF_SUBSTHOLLOWBOX_TYPE) {
- if (c->char_name != NULL && c->char_name_length == 7 &&
- !memcmp(c->char_name, ".notdef", 7)) {
- /* With EF_SUBSTHOLLOWBOX_TYPE and FCO,
- UFST paints a hollow box insted .notdef .
- For Adobe compatibility we substitute a space,
- because Adobe Type 1 fonts define .notdef as a space . */
- cc = 32;
- }
+ if (c->char_name != NULL && c->char_name_length == 7 &&
+ !memcmp(c->char_name, ".notdef", 7)) {
+ /* With EF_SUBSTHOLLOWBOX_TYPE and FCO,
+ UFST paints a hollow box insted .notdef .
+ For Adobe compatibility we substitute a space,
+ because Adobe Type 1 fonts define .notdef as a space . */
+ cc = 32;
+ }
}
#if !UFST_REENTRANT
static_server_ptr_for_ufst_callback = r;
@@ -1332,27 +1329,27 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
/* There is no such char in the font, try the glyph 0 (notdef) : */
UW16 c1 = 0, ssnum = pIFS->fcCur.ssnum;
- if (d->font_type == FC_FCO_TYPE) {
- /* EF_SUBSTHOLLOWBOX_TYPE must work against it.
- Ensure the plugin plug__xi.fco is loaded. */
- /* fixme : Due to unknown reason EF_SUBSTHOLLOWBOX_TYPE
- doesn't work for Symbol, Dingbats, Wingdings.
- hack : render the space character. */
- c1 = 32;
- } else {
- /* hack : Changing UFST internal data - see above. */
- pIFS->fcCur.ssnum = RAW_GLYPH;
- }
+ if (d->font_type == FC_FCO_TYPE) {
+ /* EF_SUBSTHOLLOWBOX_TYPE must work against it.
+ Ensure the plugin plug__xi.fco is loaded. */
+ /* fixme : Due to unknown reason EF_SUBSTHOLLOWBOX_TYPE
+ doesn't work for Symbol, Dingbats, Wingdings.
+ hack : render the space character. */
+ c1 = 32;
+ } else {
+ /* hack : Changing UFST internal data - see above. */
+ pIFS->fcCur.ssnum = RAW_GLYPH;
+ }
r->callback_error = 0;
ff->char_data = (void *)notdef;
ff->char_data_len = strlen(notdef);
CGIFchIdptr(FSA &c1, notdef);
- code2 = CGIFchar_handle(FSA c1, &result, (SW16)0);
+ code2 = CGIFchar_handle(FSA c1, &result, (SW16)0);
if (code2 && code2 != ERR_fixed_space && code2 != ERR_bm_buff && code2 != ERR_bm_too_big) {
ff->char_data = "space";
ff->char_data_len = strlen("space");
CGIFchIdptr(FSA &c1, "space");
- code2 = CGIFchar_handle(FSA c1, &result, (SW16)0);
+ code2 = CGIFchar_handle(FSA c1, &result, (SW16)0);
}
if (!code2 || code2 == ERR_fixed_space) {
code = code2;
@@ -1361,25 +1358,25 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
}
ff->char_data = client_char_data;
ff->char_data_len = client_char_data_len;
-
+
#if !UFST_REENTRANT
static_server_ptr_for_ufst_callback = 0;
#endif
r->ff = 0;
release_glyphs(r, (ufst_common_font_data *)ff->server_font_data);
if (code != ERR_fixed_space && code != 0)
- return code;
+ return code;
if (r->callback_error != 0)
- return r->callback_error;
+ return r->callback_error;
if (format == FC_BITMAP_TYPE) {
IFBITMAP *pbm = (IFBITMAP *)result;
- du_emx = pbm->du_emx;
- du_emy = pbm->du_emy;
+ du_emx = pbm->du_emx;
+ du_emy = pbm->du_emy;
r->char_data = pbm;
r->bRaster = TRUE;
-
- design_escapement[0] = pbm->escapement;
+
+ design_escapement[0] = pbm->escapement;
#if UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2
@@ -1391,87 +1388,87 @@ static FAPI_retcode get_char(fapi_ufst_server *r, FAPI_font *ff, FAPI_char_ref *
design_escapement[0] = pIFS->glyphMetricsDU.aw.x;
design_escapement[1] = pIFS->glyphMetricsDU.aw.y;
}
-#endif
-
+#endif
+
} else {
IFOUTLINE *pol = (IFOUTLINE *)result;
design_escapement[0] = pol->escapement;
- du_emx = pol->du_emx;
- du_emy = pol->du_emy;
+ du_emx = pol->du_emx;
+ du_emy = pol->du_emy;
r->char_data = (IFOUTLINE *)result;
}
#if 1 /* UFST 5.0 */
if (USBOUNDBOX && d->font_type == FC_FCO_TYPE) {
- if (pIFS->USBBOXorigScaleFactor /* fixme : Must we check this ? */
- && pIFS->USBBOXorigScaleFactor != pIFS->USBBOXscaleFactor) {
- /* See fco_make_gaso_and_stats in fc_if.c . Debugged with hollow box in Helvetica. */
- /* Fixme : this looses a precision, an UFST bug has been reported. */
- int w = pIFS->USBBOXorigScaleFactor / 2;
-
- design_bbox[0] = pIFS->USBBOXxmin * pIFS->USBBOXscaleFactor / pIFS->USBBOXorigScaleFactor;
- design_bbox[1] = pIFS->USBBOXymin * pIFS->USBBOXscaleFactor / pIFS->USBBOXorigScaleFactor;
- design_bbox[2] = (pIFS->USBBOXxmax * pIFS->USBBOXscaleFactor + w) / pIFS->USBBOXorigScaleFactor;
- design_bbox[3] = (pIFS->USBBOXymax * pIFS->USBBOXscaleFactor + w) / pIFS->USBBOXorigScaleFactor;
- } else {
- design_bbox[0] = pIFS->USBBOXxmin;
- design_bbox[1] = pIFS->USBBOXymin;
- design_bbox[2] = pIFS->USBBOXxmax;
- design_bbox[3] = pIFS->USBBOXymax;
- }
+ if (pIFS->USBBOXorigScaleFactor /* fixme : Must we check this ? */
+ && pIFS->USBBOXorigScaleFactor != pIFS->USBBOXscaleFactor) {
+ /* See fco_make_gaso_and_stats in fc_if.c . Debugged with hollow box in Helvetica. */
+ /* Fixme : this looses a precision, an UFST bug has been reported. */
+ int w = pIFS->USBBOXorigScaleFactor / 2;
+
+ design_bbox[0] = pIFS->USBBOXxmin * pIFS->USBBOXscaleFactor / pIFS->USBBOXorigScaleFactor;
+ design_bbox[1] = pIFS->USBBOXymin * pIFS->USBBOXscaleFactor / pIFS->USBBOXorigScaleFactor;
+ design_bbox[2] = (pIFS->USBBOXxmax * pIFS->USBBOXscaleFactor + w) / pIFS->USBBOXorigScaleFactor;
+ design_bbox[3] = (pIFS->USBBOXymax * pIFS->USBBOXscaleFactor + w) / pIFS->USBBOXorigScaleFactor;
+ } else {
+ design_bbox[0] = pIFS->USBBOXxmin;
+ design_bbox[1] = pIFS->USBBOXymin;
+ design_bbox[2] = pIFS->USBBOXxmax;
+ design_bbox[3] = pIFS->USBBOXymax;
+ }
} else {
#if UFST_VERSION_MAJOR >= 6 && UFST_VERSION_MINOR >= 2
#else
- /* fixme: UFST 5.0 doesn't provide this data.
- Stubbing with Em box.
- Non-FCO fonts may be cropped if a glyph goes outside Em box
- (or occupy negative coordinates, such as 'y'.).
- Non-FCO fonts may be uncached if Em box is much bigger than the glyph.
- */
- design_bbox[0] = 0;
- design_bbox[1] = 0;
- design_bbox[2] = du_emx;
- design_bbox[3] = du_emy;
+ /* fixme: UFST 5.0 doesn't provide this data.
+ Stubbing with Em box.
+ Non-FCO fonts may be cropped if a glyph goes outside Em box
+ (or occupy negative coordinates, such as 'y'.).
+ Non-FCO fonts may be uncached if Em box is much bigger than the glyph.
+ */
+ design_bbox[0] = 0;
+ design_bbox[1] = 0;
+ design_bbox[2] = du_emx;
+ design_bbox[3] = du_emy;
#endif
}
#endif
{ /* UFST performs a dual rounding of the glyph origin : first
- the scaled glyph design origin is rounded to pixels with floor(x + 0.5),
- second the glyph position is rounded to pixels with floor(x + 0.5).
- Ghostscript rounds with floor(x) due to the pixel-center-inside rule.
-
- A right way would be to specify the half pixel offset to the glyph
- origin for the rendering glyph, but UFST has no interface for doing that.
- Instead that, to prevent a possible cropping while copying a glyph to cache cell,
- we expand the design bbox in a value of a pixel size.
- We could not determine the necessary expansion theoretically,
- and choosen expansion coefficients empirically,
- which appears equal to 2 pixels.
-
- fixme: Actually the expansion is the FONTCONTEXT property,
- so it could be computed at once when the scaled font is created.
- */
- const double expansion_x = 2, expansion_y = 2; /* pixels */ /* adesso5.pdf */
- const double XX = r->tran_xx * (r->fc.s.m2.xworld_res >> 16) / 72 / du_emx;
- const double XY = r->tran_xy * (r->fc.s.m2.yworld_res >> 16) / 72 / du_emy;
- const double YX = r->tran_yx * (r->fc.s.m2.xworld_res >> 16) / 72 / du_emx;
- const double YY = r->tran_yy * (r->fc.s.m2.yworld_res >> 16) / 72 / du_emy;
- const double det = XX * YY - XY * YX;
- const double deta = det < 0 ? -det : det;
-
- if (deta > 0.0000000001) {
- const double xx = YY / det, xy = -XY / det;
- const double yx = -YX / det, yy = XX / det;
- const double dx = -(expansion_x * xx + expansion_y * xy);
- const double dy = -(expansion_x * yx + expansion_y * yy);
- const SL32 dxa = (SL32)((dx < 0 ? -dx : dx) + 0.5);
- const SL32 dya = (SL32)((dy < 0 ? -dy : dy) + 0.5);
-
- design_bbox[0] -= dxa;
- design_bbox[1] -= dya;
- design_bbox[2] += dxa;
- design_bbox[3] += dya;
- }
+ the scaled glyph design origin is rounded to pixels with floor(x + 0.5),
+ second the glyph position is rounded to pixels with floor(x + 0.5).
+ Ghostscript rounds with floor(x) due to the pixel-center-inside rule.
+
+ A right way would be to specify the half pixel offset to the glyph
+ origin for the rendering glyph, but UFST has no interface for doing that.
+ Instead that, to prevent a possible cropping while copying a glyph to cache cell,
+ we expand the design bbox in a value of a pixel size.
+ We could not determine the necessary expansion theoretically,
+ and choosen expansion coefficients empirically,
+ which appears equal to 2 pixels.
+
+ fixme: Actually the expansion is the FONTCONTEXT property,
+ so it could be computed at once when the scaled font is created.
+ */
+ const double expansion_x = 2, expansion_y = 2; /* pixels */ /* adesso5.pdf */
+ const double XX = r->tran_xx * (r->fc.s.m2.xworld_res >> 16) / 72 / du_emx;
+ const double XY = r->tran_xy * (r->fc.s.m2.yworld_res >> 16) / 72 / du_emy;
+ const double YX = r->tran_yx * (r->fc.s.m2.xworld_res >> 16) / 72 / du_emx;
+ const double YY = r->tran_yy * (r->fc.s.m2.yworld_res >> 16) / 72 / du_emy;
+ const double det = XX * YY - XY * YX;
+ const double deta = det < 0 ? -det : det;
+
+ if (deta > 0.0000000001) {
+ const double xx = YY / det, xy = -XY / det;
+ const double yx = -YX / det, yy = XX / det;
+ const double dx = -(expansion_x * xx + expansion_y * xy);
+ const double dy = -(expansion_x * yx + expansion_y * yy);
+ const SL32 dxa = (SL32)((dx < 0 ? -dx : dx) + 0.5);
+ const SL32 dya = (SL32)((dy < 0 ? -dy : dy) + 0.5);
+
+ design_bbox[0] -= dxa;
+ design_bbox[1] -= dya;
+ design_bbox[2] += dxa;
+ design_bbox[3] += dya;
+ }
}
set_metrics(r, metrics, design_bbox, design_escapement, du_emx, du_emy);
if (code == ERR_fixed_space)
@@ -1484,8 +1481,8 @@ static FAPI_retcode get_char_outline_metrics(FAPI_server *server, FAPI_font *ff,
release_char_data_inline(r);
return get_char(r, ff, c, NULL, metrics, FC_CUBIC_TYPE);
- /* UFST cannot render enough metrics information without generating raster or outline.
- r->char_data keeps an outline after calling this function.
+ /* UFST cannot render enough metrics information without generating raster or outline.
+ r->char_data keeps an outline after calling this function.
*/
}
@@ -1504,8 +1501,8 @@ static FAPI_retcode get_char_raster_metrics(FAPI_server *server, FAPI_font *ff,
if (code == ERR_bm_buff || code == ERR_bm_too_big) /* Too big character ? */
return e_limitcheck;
return code;
- /* UFST cannot render enough metrics information without generating raster or outline.
- r->char_data keeps a raster after calling this function.
+ /* UFST cannot render enough metrics information without generating raster or outline.
+ r->char_data keeps a raster after calling this function.
*/
}
@@ -1515,18 +1512,18 @@ static FAPI_retcode get_char_raster(FAPI_server *server, FAPI_raster *rast)
if (!r->bRaster)
return e_limitcheck;
else if (r->char_data == NULL) {
- rast->height = rast->width = rast->line_step = 0;
- rast->p = 0;
+ rast->height = rast->width = rast->line_step = 0;
+ rast->p = 0;
} else {
IFBITMAP *pbm = (IFBITMAP *)r->char_data;
rast->p = pbm->bm;
rast->height = pbm->top_indent + pbm->black_depth;
rast->width = pbm->left_indent + pbm->black_width;
rast->line_step = pbm->width;
- rast->left_indent = pbm->left_indent;
- rast->top_indent = pbm->top_indent;
- rast->black_width = pbm->black_width;
- rast->black_height = pbm->black_depth;
+ rast->left_indent = pbm->left_indent;
+ rast->top_indent = pbm->top_indent;
+ rast->black_width = pbm->black_width;
+ rast->black_height = pbm->black_depth;
if (rast->width != 0) {
rast->orig_x = pbm->xorigin;
rast->orig_y = pbm->yorigin;
@@ -1544,15 +1541,15 @@ static FAPI_retcode release_char_data(FAPI_server *server)
}
static void release_fco(fapi_ufst_server *r, SW16 fcHandle)
-{
+{
fco_list_elem **e;
if(gx_UFST_find_static_fco_handle(fcHandle) != NULL)
- return;
+ return;
for (e = &r->fco_list; *e != 0; )
if ((*e)->fcHandle == fcHandle && (--(*e)->open_count) == 0) {
fco_list_elem *ee = *e;
- FSA_FROM_SERVER;
+ FSA_FROM_SERVER;
*e = ee->next;
CGIFfco_Close(FSA ee->fcHandle);
@@ -1578,7 +1575,7 @@ static FAPI_retcode FAPIU_release_typeface(FAPI_server *server, void *font_data)
code = CGIFhdr_font_purge(FSA &r->fc);
else
code = CGIFfont_purge(FSA &r->fc);
-#endif
+#endif
release_glyphs(r, d);
release_fco(r, (SW16)(d->font_id >> 16));
@@ -1593,7 +1590,6 @@ static FAPI_retcode check_cmap_for_GID(FAPI_server *server, uint index)
/* --------------------- The plugin definition : ------------------------- */
-
static void gs_fapiufst_finit(i_plugin_instance *instance, i_plugin_client_memory *mem);
static const i_plugin_descriptor ufst_descriptor = {
@@ -1602,7 +1598,6 @@ static const i_plugin_descriptor ufst_descriptor = {
gs_fapiufst_finit
};
-
static const FAPI_server If0 = {
{ &ufst_descriptor
},
@@ -1634,7 +1629,7 @@ static int fapiu_make_string (i_ctx_t *i_ctx_p, const char *str, ref *obj)
{
int len = strlen(str);
byte *sbody;
-
+
sbody = ialloc_string(len, "fapiu_make_string");
if (!sbody) {
return(e_VMerror);
@@ -1642,7 +1637,7 @@ static int fapiu_make_string (i_ctx_t *i_ctx_p, const char *str, ref *obj)
memcpy (sbody, str, len);
make_string(obj, a_all | icurrent_space, len, sbody);
-
+
return(0);
}
@@ -1655,41 +1650,41 @@ int gs_fapiufst_instantiate(i_plugin_client_memory *client_mem, i_plugin_instanc
gs_main_instance *inst;
ref entry;
char tmppath[512];
-
+
if (r == 0)
return e_Fatal;
memset(r, 0, sizeof(*r));
r->If = If0;
r->client_mem = *client_mem;
*p_instance = &r->If.ig;
-
+
inst = get_minst_from_memory((const gs_memory_t *)(client_mem->client_data));
i_ctx_p = inst->i_ctx_p;
-
+
/* The following entries will get overwritten if the user specifies alternative settings
* on the command line.
*/
strncpy(tmppath, UFSTFONTDIR, sizeof(tmppath));
strncat(tmppath, UFST_PlugIn_Path, sizeof(tmppath));
-
+
fapiu_make_string (i_ctx_p, (const char *)tmppath, &entry);
(void)dict_put_string(systemdict, UFST_PlugIn_Str, &entry, NULL);
strncpy(tmppath, UFSTFONTDIR, sizeof(tmppath));
strncat(tmppath, FCOfontfilePath, sizeof(tmppath));
-
+
fapiu_make_string (i_ctx_p, (const char *)tmppath, &entry);
(void)dict_put_string(systemdict, FCOfontfileStr, &entry, NULL);
strncpy(tmppath, UFSTFONTDIR, sizeof(tmppath));
strncat(tmppath, FCOfontfile2Path, sizeof(tmppath));
-
+
fapiu_make_string (i_ctx_p, (const char *)tmppath, &entry);
(void)dict_put_string(systemdict, FCOfontfile2Str, &entry, NULL);
fapiu_make_string (i_ctx_p, FAPIfontmap, &entry);
(void)dict_put_string(systemdict, FAPIfontmapStr, &entry, NULL);
-
+
return 0;
}
@@ -1704,20 +1699,20 @@ extern unsigned long maxmem;
static void gs_fapiufst_finit(i_plugin_instance *this, i_plugin_client_memory *mem)
{ fapi_ufst_server *r = (fapi_ufst_server *)this;
FSA_FROM_SERVER;
-
+
#if UFST_MEMORY_CHECKING
dprintf1("UFST used %Lf kb\n", ((long double)maxmem) / 1024);
#endif
-
+
if (r->If.ig.d != &ufst_descriptor)
return; /* safety */
-#if 0 /* Disabled against a reentrancy problem
- in a single language build for host-based applications. */
+#if 0 /* Disabled against a reentrancy problem
+ in a single language build for host-based applications. */
gx_set_UFST_Callbacks(NULL, NULL, NULL);
#endif
release_char_data_inline(r);
if (r->bInitialized && !r->ufst_is_singleton)
- gx_UFST_fini();
+ gx_UFST_fini();
if (r->param) {
mem->free (mem, r->param, "server_params");
}
diff --git a/gs/psi/files.h b/gs/psi/files.h
index 3d664630f..c3040fb89 100644
--- a/gs/psi/files.h
+++ b/gs/psi/files.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -64,14 +64,14 @@ int file_switch_to_read(const ref *);
BEGIN\
svar = fptr(op);\
if (svar->read_id != r_size(op)) {\
- if (svar->read_id == 0 && svar->write_id == r_size(op)) {\
- int fcode = file_switch_to_read(op);\
+ if (svar->read_id == 0 && svar->write_id == r_size(op)) {\
+ int fcode = file_switch_to_read(op);\
\
- if (fcode < 0)\
- error_return(fcode);\
- } else {\
- invalid_action; /* closed or reopened file */\
- }\
+ if (fcode < 0)\
+ error_return(fcode);\
+ } else {\
+ invalid_action; /* closed or reopened file */\
+ }\
}\
END
int file_switch_to_write(const ref *);
@@ -85,13 +85,13 @@ int file_switch_to_write(const ref *);
BEGIN\
svar = fptr(op);\
if ( svar->write_id != r_size(op) )\
- { int fcode = file_switch_to_write(op);\
- if ( fcode < 0 ) error_return(fcode);\
- }\
+ { int fcode = file_switch_to_write(op);\
+ if ( fcode < 0 ) error_return(fcode);\
+ }\
END
/* Data exported by zfile.c. */
- /* for zfilter.c and ziodev.c */
+ /* for zfilter.c and ziodev.c */
extern const uint file_default_buffer_size;
#ifndef gs_file_path_ptr_DEFINED
@@ -100,51 +100,51 @@ typedef struct gs_file_path_s *gs_file_path_ptr;
#endif
/* Procedures exported by zfile.c. */
- /* for imainarg.c */
+ /* for imainarg.c */
FILE *lib_fopen(const gs_file_path_ptr pfpath, const gs_memory_t *mem, const char *);
- /* for imain.c */
+ /* for imain.c */
int
-lib_file_open(gs_file_path_ptr, const gs_memory_t *, i_ctx_t *,
- const char *, uint, char *, int, uint *, ref *pfile);
+lib_file_open(gs_file_path_ptr, const gs_memory_t *, i_ctx_t *,
+ const char *, uint, char *, int, uint *, ref *pfile);
- /* for imain.c */
+ /* for imain.c */
#ifndef gs_ref_memory_DEFINED
# define gs_ref_memory_DEFINED
typedef struct gs_ref_memory_s gs_ref_memory_t;
#endif
int file_read_string(const byte *, uint, ref *, gs_ref_memory_t *);
- /* for os_open in ziodev.c */
+ /* for os_open in ziodev.c */
#ifdef iodev_proc_fopen /* in gxiodev.h */
int file_open_stream(const char *, uint, const char *, uint, stream **,
- gx_io_device *, iodev_proc_fopen_t, gs_memory_t *);
+ gx_io_device *, iodev_proc_fopen_t, gs_memory_t *);
#endif
- /* for zfilter.c */
+ /* for zfilter.c */
int filter_open(const char *, uint, ref *, const stream_procs *,
- const stream_template *, const stream_state *,
- gs_memory_t *);
+ const stream_template *, const stream_state *,
+ gs_memory_t *);
- /* for zfileio.c */
+ /* for zfileio.c */
void make_stream_file(ref *, stream *, const char *);
- /* for ziodev.c */
+ /* for ziodev.c */
int file_close_file(stream *);
- /* for gsmain.c, interp.c */
+ /* for gsmain.c, interp.c */
int file_close(ref *);
- /* for zfproc.c, ziodev.c */
+ /* for zfproc.c, ziodev.c */
stream *file_alloc_stream(gs_memory_t *, client_name_t);
/* Procedures exported by zfileio.c. */
- /* for ziodev.c */
+ /* for ziodev.c */
int zreadline_from(stream *s, gs_string *buf, gs_memory_t *bufmem,
- uint *pcount, bool *pin_eol);
+ uint *pcount, bool *pin_eol);
/* Procedures exported by zfileio.c. */
- /* for zfile.c */
+ /* for zfile.c */
int zfilelineedit(i_ctx_t *i_ctx_p);
#endif /* files_INCLUDED */
diff --git a/gs/psi/ghost.h b/gs/psi/ghost.h
index 9d4e7b9ae..fb37fada2 100644
--- a/gs/psi/ghost.h
+++ b/gs/psi/ghost.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/gs.c b/gs/psi/gs.c
index 3c0a3f36d..f97bfd898 100644
--- a/gs/psi/gs.c
+++ b/gs/psi/gs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,7 +28,6 @@
# endif
#endif
-
/* Define an optional array of strings for testing. */
/*#define RUN_STRINGS */
#ifdef RUN_STRINGS
@@ -44,14 +43,14 @@ static const char *run_strings[] =
#endif
#ifdef NEED_COMMIT_STACK
-/*
+/*
* It is well known that GCC 2.96 for x86 sometimes forgets to adjust $esp
* and leaves automatic variables at small distance below the stack pointer.
* Apparently, when the access to the automatic variable causes a page fault
* Linux sends a SEGV signal if the access happens below the stack pointer.
* Pre-loading the stack pages resolves the problem.
*/
-static void
+static void
commit_stack_pages( void )
{
char buf[65536]; /* In most cases GS lives in 64K stack */
@@ -61,7 +60,6 @@ commit_stack_pages( void )
}
#endif
-
int
main(int argc, char *argv[])
{
@@ -94,57 +92,57 @@ main(int argc, char *argv[])
code = (minst == NULL ? e_Fatal : 0);
if (code >= 0)
code = gs_main_init_with_args(minst, argc, argv);
-
+
#ifdef RUN_STRINGS
{ /* Run a list of strings (for testing). */
- const char **pstr = run_strings;
-
- for (; *pstr; ++pstr) {
- int exit_code;
- ref error_object;
- int code;
-
- fprintf(stdout, "{%s} =>\n", *pstr);
- fflush(stdout);
- code = gs_main_run_string(minst, *pstr, 0,
- &exit_code, &error_object);
- zflush(osp);
- fprintf(stdout, " => code = %d\n", code);
- fflush(stdout);
- if (code < 0) {
- gs_to_exit(1);
- return 1;
- }
- }
+ const char **pstr = run_strings;
+
+ for (; *pstr; ++pstr) {
+ int exit_code;
+ ref error_object;
+ int code;
+
+ fprintf(stdout, "{%s} =>\n", *pstr);
+ fflush(stdout);
+ code = gs_main_run_string(minst, *pstr, 0,
+ &exit_code, &error_object);
+ zflush(osp);
+ fprintf(stdout, " => code = %d\n", code);
+ fflush(stdout);
+ if (code < 0) {
+ gs_to_exit(1);
+ return 1;
+ }
+ }
}
#endif
if (code >= 0)
- code = gs_main_run_start(minst);
+ code = gs_main_run_start(minst);
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
gs_to_exit_with_code(minst->heap, exit_status, code);
gs_malloc_release(mem);
switch (exit_status) {
- case 0:
- exit_status = exit_OK;
- break;
- case 1:
- exit_status = exit_FAILED;
- break;
+ case 0:
+ exit_status = exit_OK;
+ break;
+ case 1:
+ exit_status = exit_FAILED;
+ break;
}
return exit_status;
}
diff --git a/gs/psi/gsdll.c b/gs/psi/gsdll.c
index ad9820326..bb32a5f17 100644
--- a/gs/psi/gsdll.c
+++ b/gs/psi/gsdll.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -12,14 +12,12 @@
*/
/* Portions Copyright (C) 1994-2000 Ghostgum Software Pty Ltd. All rights reserved. */
-
/* $Id$ */
/* Dynamic Link Library interface for OS/2 and MS-Windows Ghostscript */
/* front end to gs.c */
/* This has been reimplemented to call the new DLL interface in iapi.h */
-
#ifdef _Windows
#include <windows.h>
#endif
@@ -55,21 +53,18 @@ GSDLL_CALLBACK pgsdll_callback = NULL; /* callback for messages and stdio to cal
static gs_main_instance *pgs_minst = NULL;
-
/****** SINGLE-INSTANCE HACK ******/
-
/* local functions */
static int GSDLLCALL gsdll_old_stdin(void *caller_handle, char *buf, int len);
static int GSDLLCALL gsdll_old_stdout(void *caller_handle, const char *str, int len);
static int GSDLLCALL gsdll_old_stderr(void *caller_handle, const char *str, int len);
static int GSDLLCALL gsdll_old_poll(void *caller_handle);
-
/* ---------- DLL exported functions ---------- */
/* arguments are:
- * 1. callback function for stdio and for notification of
+ * 1. callback function for stdio and for notification of
* sync_output, output_page and resize events
* 2. window handle, used as parent. Use NULL if you have no window.
* 3. argc
@@ -81,16 +76,16 @@ gsdll_init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char * argv[])
int code;
if ((code = gsapi_new_instance(&pgs_minst, (void *)1)) < 0)
- return -1;
+ return -1;
- gsapi_set_stdio(pgs_minst,
- gsdll_old_stdin, gsdll_old_stdout, gsdll_old_stderr);
+ gsapi_set_stdio(pgs_minst,
+ gsdll_old_stdin, gsdll_old_stdout, gsdll_old_stderr);
gsapi_set_poll(pgs_minst, gsdll_old_poll);
/* ignore hwnd */
/* rest of MacGSView compatibilty hack */
#ifdef __MACOS__
- hwndtext=hwnd;
+ hwndtext=hwnd;
#endif
/****** SINGLE-INSTANCE HACK ******/
@@ -99,8 +94,8 @@ gsdll_init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char * argv[])
code = gsapi_init_with_args(pgs_minst, argc, argv);
if (code == e_Quit) {
- gsapi_exit(pgs_minst);
- return GSDLL_INIT_QUIT;
+ gsapi_exit(pgs_minst);
+ return GSDLL_INIT_QUIT;
}
return code;
}
@@ -120,10 +115,10 @@ int GSDLLEXPORT GSDLLAPI
gsdll_execute_cont(const char * str, int len)
{
int exit_code;
- int code = gsapi_run_string_continue(pgs_minst, str, len,
- 0, &exit_code);
+ int code = gsapi_run_string_continue(pgs_minst, str, len,
+ 0, &exit_code);
if (code == e_NeedInput)
- code = 0; /* this is not an error */
+ code = 0; /* this is not an error */
return code;
}
@@ -150,20 +145,19 @@ gsdll_exit(void)
/* This may be called before any other function. */
int GSDLLEXPORT GSDLLAPI
gsdll_revision(const char ** product, const char ** copyright,
- long * revision, long * revisiondate)
+ long * revision, long * revisiondate)
{
if (product)
- *product = gs_product;
+ *product = gs_product;
if (copyright)
- *copyright = gs_copyright;
+ *copyright = gs_copyright;
if (revision)
- *revision = gs_revision;
+ *revision = gs_revision;
if (revisiondate)
- *revisiondate = gs_revisiondate;
+ *revisiondate = gs_revisiondate;
return 0;
}
-
static int GSDLLCALL
gsdll_old_stdin(void *caller_handle, char *buf, int len)
{
diff --git a/gs/psi/gserver.c b/gs/psi/gserver.c
index 47a543a59..a50638829 100644
--- a/gs/psi/gserver.c
+++ b/gs/psi/gserver.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,7 +52,7 @@
*/
int gs_server_initialize(int fno_stdin, int fno_stdout, int fno_stderr,
- const char *init_str);
+ const char *init_str);
/*
* Execute a string containing PostScript code. The effects of this code
@@ -74,8 +74,8 @@ int gs_server_initialize(int fno_stdin, int fno_stdout, int fno_stderr,
*/
int gs_server_run_string(const char *str, int *exit_code_ptr,
- char *errstr, int errstr_max_len,
- int *errstr_len_ptr);
+ char *errstr, int errstr_max_len,
+ int *errstr_len_ptr);
/*
* Run a sequence of files containing PostScript code. If permanent is 0,
@@ -88,8 +88,8 @@ int gs_server_run_string(const char *str, int *exit_code_ptr,
*/
int gs_server_run_files(const char **file_names, int permanent,
- int *exit_code_ptr, char *errstr,
- int errstr_max_len, int *errstr_len_ptr);
+ int *exit_code_ptr, char *errstr,
+ int errstr_max_len, int *errstr_len_ptr);
/*
* Terminate Ghostscript. Ghostscript will release all memory and close
@@ -125,33 +125,33 @@ main(int argc, char *argv[])
{"golfer.eps", 0};
FILE *cin = fopen("stdin.tmp", "w+");
int sout = open("stdout.tmp", O_WRONLY | O_CREAT | O_TRUNC,
- S_IREAD | S_IWRITE);
+ S_IREAD | S_IWRITE);
int serr = open("stderr.tmp", O_WRONLY | O_CREAT | O_TRUNC,
- S_IREAD | S_IWRITE);
+ S_IREAD | S_IWRITE);
code = gs_server_initialize(fileno(cin), sout, serr,
- "/fubar 42 def");
+ "/fubar 42 def");
fprintf(stdout, "init: code %d\n", code);
if (code < 0)
- goto x;
+ goto x;
code = gs_server_run_string("fubar == flush", &exit_code,
- errstr, emax, &errlen);
+ errstr, emax, &errlen);
fprintf(stdout, "print: code %d\n", code);
if (code < 0)
- goto x;
+ goto x;
code = gs_server_run_files(fnames, 0, &exit_code,
- errstr, emax, &errlen);
+ errstr, emax, &errlen);
fprintf(stdout, "golfer: code %d\n", code);
if (code < 0)
- goto x;
+ goto x;
errlen = 0;
code = gs_server_run_string("fubar 0 div", &exit_code,
- errstr, emax, &errlen);
+ errstr, emax, &errlen);
errstr[errlen] = 0;
fprintf(stdout, "0 div: code %d object %s\n", code, errstr);
errlen = 0;
code = gs_server_run_string("xxx", &exit_code,
- errstr, emax, &errlen);
+ errstr, emax, &errlen);
errstr[errlen] = 0;
fprintf(stdout, "undef: code %d object %s\n", code, errstr);
x:code = gs_server_terminate();
@@ -178,7 +178,7 @@ static void errstr_report(ref *, char *, int, int *);
int
gs_server_initialize(int fno_stdin, int fno_stdout, int fno_stderr,
- const char *init_str)
+ const char *init_str)
{
int code, exit_code; /* discard exit_code for now */
int errstr_len; /* discard */
@@ -187,34 +187,34 @@ gs_server_initialize(int fno_stdin, int fno_stdout, int fno_stderr,
/* Establish C-compatible files for stdout and stderr. */
c_stdin = fdopen(fno_stdin, "r");
if (c_stdin == NULL)
- return -1;
+ return -1;
c_stdout = fdopen(fno_stdout, "w");
if (c_stdout == NULL)
- return -1;
+ return -1;
c_stderr = fdopen(fno_stderr, "w");
if (c_stderr == NULL)
- return -1;
+ return -1;
/* Initialize the Ghostscript interpreter. */
if ((code = gs_init0(c_stdin, c_stdout, c_stderr, 0)) < 0 ||
- (code = gs_init1()) < 0 ||
- (code = gs_init2()) < 0
- )
- return code;
+ (code = gs_init1()) < 0 ||
+ (code = gs_init2()) < 0
+ )
+ return code;
code = gs_server_run_string("/QUIET true def /NOPAUSE true def",
- &exit_code,
- (char *)0, 0, &errstr_len);
+ &exit_code,
+ (char *)0, 0, &errstr_len);
if (code < 0)
- return code;
+ return code;
return (init_str == NULL ? 0 :
- gs_server_run_string(init_str, &exit_code,
- (char *)0, 0, &errstr_len));
+ gs_server_run_string(init_str, &exit_code,
+ (char *)0, 0, &errstr_len));
}
/* Run a string. */
int
gs_server_run_string(const char *str, int *exit_code_ptr,
- char *errstr, int errstr_max_len, int *errstr_len_ptr)
+ char *errstr, int errstr_max_len, int *errstr_len_ptr)
{
ref error_object;
int code;
@@ -222,8 +222,8 @@ gs_server_run_string(const char *str, int *exit_code_ptr,
make_tasv(&error_object, t_string, 0, 0, bytes, 0);
code = gs_run_string(str, 0, exit_code_ptr, &error_object);
if (code < 0)
- errstr_report(&error_object, errstr, errstr_max_len,
- errstr_len_ptr);
+ errstr_report(&error_object, errstr, errstr_max_len,
+ errstr_len_ptr);
return code;
}
@@ -238,15 +238,15 @@ gs_server_run_files(const char **file_names, int permanent,
const char **pfn;
if (!permanent)
- job_begin();
+ job_begin();
make_tasv(&error_object, t_string, 0, 0, bytes, 0);
for (pfn = file_names; *pfn != NULL && code == 0; pfn++)
- code = gs_run_file(*pfn, 0, exit_code_ptr, &error_object);
+ code = gs_run_file(*pfn, 0, exit_code_ptr, &error_object);
if (!permanent)
- job_end();
+ job_end();
if (code < 0)
- errstr_report(&error_object, errstr, errstr_max_len,
- errstr_len_ptr);
+ errstr_report(&error_object, errstr, errstr_max_len,
+ errstr_len_ptr);
return code;
}
@@ -277,10 +277,10 @@ job_begin()
extern gs_state *igs;
if ((code = gs_erasepage(igs)) < 0)
- return code;
+ return code;
code = zsave(osp);
if (code == 0)
- job_save = *osp--;
+ job_save = *osp--;
return code;
}
@@ -298,17 +298,17 @@ job_end()
static void
errstr_report(ref * perror_object, char *errstr, int errstr_max_len,
- int *errstr_len_ptr)
+ int *errstr_len_ptr)
{
int code = obj_cvs(perror_object, (byte *) errstr,
- (uint) errstr_max_len, (uint *) errstr_len_ptr,
- false);
+ (uint) errstr_max_len, (uint *) errstr_len_ptr,
+ false);
if (code < 0) {
- const char *ustr = "[unprintable]";
- int len = min(strlen(ustr), errstr_max_len);
+ const char *ustr = "[unprintable]";
+ int len = min(strlen(ustr), errstr_max_len);
- memcpy(errstr, ustr, len);
- *errstr_len_ptr = len;
+ memcpy(errstr, ustr, len);
+ *errstr_len_ptr = len;
}
}
diff --git a/gs/psi/ialloc.c b/gs/psi/ialloc.c
index 58ee0d91a..5de84e4df 100644
--- a/gs/psi/ialloc.c
+++ b/gs/psi/ialloc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ public_st_gs_dual_memory();
/* Initialize the allocator */
int
ialloc_init(gs_dual_memory_t *dmem, gs_memory_t * rmem, uint chunk_size,
- bool level2)
+ bool level2)
{
gs_ref_memory_t *ilmem = ialloc_alloc_state(rmem, chunk_size);
gs_ref_memory_t *ilmem_stable = ialloc_alloc_state(rmem, chunk_size);
@@ -43,18 +43,18 @@ ialloc_init(gs_dual_memory_t *dmem, gs_memory_t * rmem, uint chunk_size,
int i;
if (ilmem == 0 || ilmem_stable == 0 || ismem == 0)
- goto fail;
+ goto fail;
ilmem->stable_memory = (gs_memory_t *)ilmem_stable;
if (level2) {
- igmem = ialloc_alloc_state(rmem, chunk_size);
- igmem_stable = ialloc_alloc_state(rmem, chunk_size);
- if (igmem == 0 || igmem_stable == 0)
- goto fail;
- igmem->stable_memory = (gs_memory_t *)igmem_stable;
+ igmem = ialloc_alloc_state(rmem, chunk_size);
+ igmem_stable = ialloc_alloc_state(rmem, chunk_size);
+ if (igmem == 0 || igmem_stable == 0)
+ goto fail;
+ igmem->stable_memory = (gs_memory_t *)igmem_stable;
} else
- igmem = ilmem, igmem_stable = ilmem_stable;
+ igmem = ilmem, igmem_stable = ilmem_stable;
for (i = 0; i < countof(dmem->spaces_indexed); i++)
- dmem->spaces_indexed[i] = 0;
+ dmem->spaces_indexed[i] = 0;
dmem->space_local = ilmem;
dmem->space_global = igmem;
dmem->space_system = ismem;
@@ -140,7 +140,7 @@ ialloc_trace_space(const gs_ref_memory_t *imem)
/* Register a ref root. */
int
gs_register_ref_root(gs_memory_t *mem, gs_gc_root_t *root,
- void **pp, client_name_t cname)
+ void **pp, client_name_t cname)
{
return gs_register_root(mem, root, ptr_ref_type, pp, cname);
}
@@ -155,69 +155,69 @@ gs_register_ref_root(gs_memory_t *mem, gs_gc_root_t *root,
/* Allocate an array of refs. */
int
gs_alloc_ref_array(gs_ref_memory_t * mem, ref * parr, uint attrs,
- uint num_refs, client_name_t cname)
+ uint num_refs, client_name_t cname)
{
ref *obj;
/* If we're allocating a run of refs already, */
/* and we aren't about to overflow the maximum run length, use it. */
if (mem->cc.rtop == mem->cc.cbot &&
- num_refs < (mem->cc.ctop - mem->cc.cbot) / sizeof(ref) &&
- mem->cc.rtop - (byte *) mem->cc.rcur + num_refs * sizeof(ref) <
- max_size_st_refs
- ) {
- ref *end;
-
- obj = (ref *) mem->cc.rtop - 1; /* back up over last ref */
- if_debug4('A', "[a%d:+$ ]%s(%u) = 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname),
- num_refs, (ulong) obj);
- mem->cc.rcur[-1].o_size += num_refs * sizeof(ref);
- end = (ref *) (mem->cc.rtop = mem->cc.cbot +=
- num_refs * sizeof(ref));
- make_mark(end - 1);
+ num_refs < (mem->cc.ctop - mem->cc.cbot) / sizeof(ref) &&
+ mem->cc.rtop - (byte *) mem->cc.rcur + num_refs * sizeof(ref) <
+ max_size_st_refs
+ ) {
+ ref *end;
+
+ obj = (ref *) mem->cc.rtop - 1; /* back up over last ref */
+ if_debug4('A', "[a%d:+$ ]%s(%u) = 0x%lx\n",
+ ialloc_trace_space(mem), client_name_string(cname),
+ num_refs, (ulong) obj);
+ mem->cc.rcur[-1].o_size += num_refs * sizeof(ref);
+ end = (ref *) (mem->cc.rtop = mem->cc.cbot +=
+ num_refs * sizeof(ref));
+ make_mark(end - 1);
} else {
- /*
- * Allocate a new run. We have to distinguish 3 cases:
- * - Same chunk: pcc unchanged, end == cc.cbot.
- * - Large chunk: pcc unchanged, end != cc.cbot.
- * - New chunk: pcc changed.
- */
- chunk_t *pcc = mem->pcc;
- ref *end;
- alloc_change_t *cp = 0;
+ /*
+ * Allocate a new run. We have to distinguish 3 cases:
+ * - Same chunk: pcc unchanged, end == cc.cbot.
+ * - Large chunk: pcc unchanged, end != cc.cbot.
+ * - New chunk: pcc changed.
+ */
+ chunk_t *pcc = mem->pcc;
+ ref *end;
+ alloc_change_t *cp = 0;
int code = 0;
- if ((gs_memory_t *)mem != mem->stable_memory) {
- code = alloc_save_change_alloc(mem, "gs_alloc_ref_array", &cp);
- if (code < 0)
- return code;
- }
- obj = gs_alloc_struct_array((gs_memory_t *) mem, num_refs + 1,
- ref, &st_refs, cname);
- if (obj == 0)
- return_error(e_VMerror);
- /* Set the terminating ref now. */
- end = (ref *) obj + num_refs;
- make_mark(end);
- /* Set has_refs in the chunk. */
- if (mem->pcc != pcc || mem->cc.cbot == (byte *) (end + 1)) {
- /* Ordinary chunk. */
- mem->cc.rcur = (obj_header_t *) obj;
- mem->cc.rtop = (byte *) (end + 1);
- mem->cc.has_refs = true;
- } else {
- /* Large chunk. */
- /* This happens only for very large arrays, */
- /* so it doesn't need to be cheap. */
- chunk_locator_t cl;
-
- cl.memory = mem;
- cl.cp = mem->clast;
- chunk_locate_ptr(obj, &cl);
- cl.cp->has_refs = true;
- }
- if (cp) {
+ if ((gs_memory_t *)mem != mem->stable_memory) {
+ code = alloc_save_change_alloc(mem, "gs_alloc_ref_array", &cp);
+ if (code < 0)
+ return code;
+ }
+ obj = gs_alloc_struct_array((gs_memory_t *) mem, num_refs + 1,
+ ref, &st_refs, cname);
+ if (obj == 0)
+ return_error(e_VMerror);
+ /* Set the terminating ref now. */
+ end = (ref *) obj + num_refs;
+ make_mark(end);
+ /* Set has_refs in the chunk. */
+ if (mem->pcc != pcc || mem->cc.cbot == (byte *) (end + 1)) {
+ /* Ordinary chunk. */
+ mem->cc.rcur = (obj_header_t *) obj;
+ mem->cc.rtop = (byte *) (end + 1);
+ mem->cc.has_refs = true;
+ } else {
+ /* Large chunk. */
+ /* This happens only for very large arrays, */
+ /* so it doesn't need to be cheap. */
+ chunk_locator_t cl;
+
+ cl.memory = mem;
+ cl.cp = mem->clast;
+ chunk_locate_ptr(obj, &cl);
+ cl.cp->has_refs = true;
+ }
+ if (cp) {
mem->changes = cp;
cp->where = (ref_packed *)obj;
}
@@ -230,34 +230,34 @@ gs_alloc_ref_array(gs_ref_memory_t * mem, ref * parr, uint attrs,
/* for shrinking, not for growing. */
int
gs_resize_ref_array(gs_ref_memory_t * mem, ref * parr,
- uint new_num_refs, client_name_t cname)
+ uint new_num_refs, client_name_t cname)
{
uint old_num_refs = r_size(parr);
uint diff;
ref *obj = parr->value.refs;
if (new_num_refs > old_num_refs || !r_has_type(parr, t_array))
- return_error(e_Fatal);
+ return_error(e_Fatal);
diff = old_num_refs - new_num_refs;
/* Check for LIFO. See gs_free_ref_array for more details. */
if (mem->cc.rtop == mem->cc.cbot &&
- (byte *) (obj + (old_num_refs + 1)) == mem->cc.rtop
- ) {
- /* Shorten the refs object. */
- ref *end = (ref *) (mem->cc.cbot = mem->cc.rtop -=
- diff * sizeof(ref));
-
- if_debug4('A', "[a%d:<$ ]%s(%u) 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname), diff,
- (ulong) obj);
- mem->cc.rcur[-1].o_size -= diff * sizeof(ref);
- make_mark(end - 1);
+ (byte *) (obj + (old_num_refs + 1)) == mem->cc.rtop
+ ) {
+ /* Shorten the refs object. */
+ ref *end = (ref *) (mem->cc.cbot = mem->cc.rtop -=
+ diff * sizeof(ref));
+
+ if_debug4('A', "[a%d:<$ ]%s(%u) 0x%lx\n",
+ ialloc_trace_space(mem), client_name_string(cname), diff,
+ (ulong) obj);
+ mem->cc.rcur[-1].o_size -= diff * sizeof(ref);
+ make_mark(end - 1);
} else {
- /* Punt. */
- if_debug4('A', "[a%d:<$#]%s(%u) 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname), diff,
- (ulong) obj);
- mem->lost.refs += diff * sizeof(ref);
+ /* Punt. */
+ if_debug4('A', "[a%d:<$#]%s(%u) 0x%lx\n",
+ ialloc_trace_space(mem), client_name_string(cname), diff,
+ (ulong) obj);
+ mem->lost.refs += diff * sizeof(ref);
}
r_set_size(parr, new_num_refs);
return 0;
@@ -278,97 +278,97 @@ gs_free_ref_array(gs_ref_memory_t * mem, ref * parr, client_name_t cname)
* The +1s are for the extra ref for the GC.
*/
if (!r_has_type(parr, t_array))
- DO_NOTHING; /* don't look for special cases */
+ DO_NOTHING; /* don't look for special cases */
else if (mem->cc.rtop == mem->cc.cbot &&
- (byte *) (obj + (num_refs + 1)) == mem->cc.rtop
- ) {
- if ((obj_header_t *) obj == mem->cc.rcur) {
- /* Deallocate the entire refs object. */
- if ((gs_memory_t *)mem != mem->stable_memory)
- alloc_save_remove(mem, (ref_packed *)obj, "gs_free_ref_array");
- gs_free_object((gs_memory_t *) mem, obj, cname);
- mem->cc.rcur = 0;
- mem->cc.rtop = 0;
- } else {
- /* Deallocate it at the end of the refs object. */
- if_debug4('A', "[a%d:-$ ]%s(%u) 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname),
- num_refs, (ulong) obj);
- mem->cc.rcur[-1].o_size -= num_refs * sizeof(ref);
- mem->cc.rtop = mem->cc.cbot = (byte *) (obj + 1);
- make_mark(obj);
- }
- return;
+ (byte *) (obj + (num_refs + 1)) == mem->cc.rtop
+ ) {
+ if ((obj_header_t *) obj == mem->cc.rcur) {
+ /* Deallocate the entire refs object. */
+ if ((gs_memory_t *)mem != mem->stable_memory)
+ alloc_save_remove(mem, (ref_packed *)obj, "gs_free_ref_array");
+ gs_free_object((gs_memory_t *) mem, obj, cname);
+ mem->cc.rcur = 0;
+ mem->cc.rtop = 0;
+ } else {
+ /* Deallocate it at the end of the refs object. */
+ if_debug4('A', "[a%d:-$ ]%s(%u) 0x%lx\n",
+ ialloc_trace_space(mem), client_name_string(cname),
+ num_refs, (ulong) obj);
+ mem->cc.rcur[-1].o_size -= num_refs * sizeof(ref);
+ mem->cc.rtop = mem->cc.cbot = (byte *) (obj + 1);
+ make_mark(obj);
+ }
+ return;
} else if (num_refs >= (mem->large_size / arch_sizeof_ref - 1)) {
- /* See if this array has a chunk all to itself. */
- /* We only make this check when freeing very large objects, */
- /* so it doesn't need to be cheap. */
- chunk_locator_t cl;
-
- cl.memory = mem;
- cl.cp = mem->clast;
- if (chunk_locate_ptr(obj, &cl) &&
- obj == (ref *) ((obj_header_t *) (cl.cp->cbase) + 1) &&
- (byte *) (obj + (num_refs + 1)) == cl.cp->cend
- ) {
- /* Free the chunk. */
- if_debug4('a', "[a%d:-$L]%s(%u) 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname),
- num_refs, (ulong) obj);
- if ((gs_memory_t *)mem != mem->stable_memory)
- alloc_save_remove(mem, (ref_packed *)obj, "gs_free_ref_array");
- alloc_free_chunk(cl.cp, mem);
- return;
- }
+ /* See if this array has a chunk all to itself. */
+ /* We only make this check when freeing very large objects, */
+ /* so it doesn't need to be cheap. */
+ chunk_locator_t cl;
+
+ cl.memory = mem;
+ cl.cp = mem->clast;
+ if (chunk_locate_ptr(obj, &cl) &&
+ obj == (ref *) ((obj_header_t *) (cl.cp->cbase) + 1) &&
+ (byte *) (obj + (num_refs + 1)) == cl.cp->cend
+ ) {
+ /* Free the chunk. */
+ if_debug4('a', "[a%d:-$L]%s(%u) 0x%lx\n",
+ ialloc_trace_space(mem), client_name_string(cname),
+ num_refs, (ulong) obj);
+ if ((gs_memory_t *)mem != mem->stable_memory)
+ alloc_save_remove(mem, (ref_packed *)obj, "gs_free_ref_array");
+ alloc_free_chunk(cl.cp, mem);
+ return;
+ }
}
/* Punt, but fill the array with nulls so that there won't be */
/* dangling references to confuse the garbage collector. */
if_debug4('A', "[a%d:-$#]%s(%u) 0x%lx\n",
- ialloc_trace_space(mem), client_name_string(cname), num_refs,
- (ulong) obj);
+ ialloc_trace_space(mem), client_name_string(cname), num_refs,
+ (ulong) obj);
{
- uint size;
-
- switch (r_type(parr)) {
- case t_shortarray:
- size = num_refs * sizeof(ref_packed);
- break;
- case t_mixedarray:{
- /* We have to parse the array to compute the storage size. */
- uint i = 0;
- const ref_packed *p = parr->value.packed;
-
- for (; i < num_refs; ++i)
- p = packed_next(p);
- size = (const byte *)p - (const byte *)parr->value.packed;
- break;
- }
- case t_array:
- size = num_refs * sizeof(ref);
- break;
- default:
- lprintf3("Unknown type 0x%x in free_ref_array(%u,0x%lx)!",
- r_type(parr), num_refs, (ulong) obj);
- return;
- }
- /*
- * If there are any leftover packed elements, we don't
- * worry about them, since they can't be dangling references.
- */
- refset_null_new(obj, size / sizeof(ref), 0);
- mem->lost.refs += size;
+ uint size;
+
+ switch (r_type(parr)) {
+ case t_shortarray:
+ size = num_refs * sizeof(ref_packed);
+ break;
+ case t_mixedarray:{
+ /* We have to parse the array to compute the storage size. */
+ uint i = 0;
+ const ref_packed *p = parr->value.packed;
+
+ for (; i < num_refs; ++i)
+ p = packed_next(p);
+ size = (const byte *)p - (const byte *)parr->value.packed;
+ break;
+ }
+ case t_array:
+ size = num_refs * sizeof(ref);
+ break;
+ default:
+ lprintf3("Unknown type 0x%x in free_ref_array(%u,0x%lx)!",
+ r_type(parr), num_refs, (ulong) obj);
+ return;
+ }
+ /*
+ * If there are any leftover packed elements, we don't
+ * worry about them, since they can't be dangling references.
+ */
+ refset_null_new(obj, size / sizeof(ref), 0);
+ mem->lost.refs += size;
}
}
/* Allocate a string ref. */
int
gs_alloc_string_ref(gs_ref_memory_t * mem, ref * psref,
- uint attrs, uint nbytes, client_name_t cname)
+ uint attrs, uint nbytes, client_name_t cname)
{
byte *str = gs_alloc_string((gs_memory_t *) mem, nbytes, cname);
if (str == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_string(psref, attrs | mem->space, nbytes, str);
return 0;
}
diff --git a/gs/psi/ialloc.h b/gs/psi/ialloc.h
index 87b7f1ef1..1f0788722 100644
--- a/gs/psi/ialloc.h
+++ b/gs/psi/ialloc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iapi.c b/gs/psi/iapi.c
index 540dd5933..568482438 100644
--- a/gs/psi/iapi.c
+++ b/gs/psi/iapi.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,7 +29,7 @@
#include "gslibctx.h"
/* number of threads to allow per process
- * currently more than 1 is guarenteed to fail
+ * currently more than 1 is guarenteed to fail
*/
static int gsapi_instance_counter = 0;
static const int gsapi_instance_max = 1;
@@ -41,7 +41,7 @@ GSDLLEXPORT int GSDLLAPI
gsapi_revision(gsapi_revision_t *pr, int rvsize)
{
if (rvsize < sizeof(gsapi_revision_t))
- return sizeof(gsapi_revision_t);
+ return sizeof(gsapi_revision_t);
pr->product = gs_product;
pr->copyright = gs_copyright;
pr->revision = gs_revision;
@@ -49,34 +49,34 @@ gsapi_revision(gsapi_revision_t *pr, int rvsize)
return 0;
}
-/* Create a new instance of Ghostscript.
+/* Create a new instance of Ghostscript.
* First instance per process call with *pinstance == NULL
* next instance in a proces call with *pinstance == copy of valid_instance pointer
* *pinstance is set to a new instance pointer.
*/
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_new_instance(void **pinstance, void *caller_handle)
{
gs_memory_t *mem = NULL;
gs_main_instance *minst = NULL;
if (pinstance == NULL)
- return e_Fatal;
+ return e_Fatal;
/* limited to 1 instance, till it works :) */
- if ( gsapi_instance_counter >= gsapi_instance_max )
- return e_Fatal;
+ if ( gsapi_instance_counter >= gsapi_instance_max )
+ return e_Fatal;
++gsapi_instance_counter;
if (*pinstance == NULL)
- /* first instance in this process */
- mem = gs_malloc_init();
+ /* first instance in this process */
+ mem = gs_malloc_init();
else {
- /* nothing different for second thread initialization
- * seperate memory, ids, only stdio is process shared.
- */
- mem = gs_malloc_init();
-
+ /* nothing different for second thread initialization
+ * seperate memory, ids, only stdio is process shared.
+ */
+ mem = gs_malloc_init();
+
}
if (mem == NULL)
return e_Fatal;
@@ -101,29 +101,29 @@ gsapi_new_instance(void **pinstance, void *caller_handle)
/* We do not support multiple instances, so make sure
* we use the default instance only once.
*/
-GSDLLEXPORT void GSDLLAPI
+GSDLLEXPORT void GSDLLAPI
gsapi_delete_instance(void *lib)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if ((ctx != NULL)) {
- gs_main_instance *minst = get_minst_from_memory(ctx->memory);
-
- ctx->caller_handle = NULL;
- ctx->stdin_fn = NULL;
- ctx->stdout_fn = NULL;
- ctx->stderr_fn = NULL;
- ctx->poll_fn = NULL;
- minst->display = NULL;
-
- /* Release the memory (frees up everything) */
+ gs_main_instance *minst = get_minst_from_memory(ctx->memory);
+
+ ctx->caller_handle = NULL;
+ ctx->stdin_fn = NULL;
+ ctx->stdout_fn = NULL;
+ ctx->stderr_fn = NULL;
+ ctx->poll_fn = NULL;
+ minst->display = NULL;
+
+ /* Release the memory (frees up everything) */
gs_malloc_release(minst->heap);
-
- --gsapi_instance_counter;
+
+ --gsapi_instance_counter;
}
}
/* Set the callback functions for stdio */
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_set_stdio(void *lib,
int(GSDLLCALL *stdin_fn)(void *caller_handle, char *buf, int len),
int(GSDLLCALL *stdout_fn)(void *caller_handle, const char *str, int len),
@@ -131,7 +131,7 @@ gsapi_set_stdio(void *lib,
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
ctx->stdin_fn = stdin_fn;
ctx->stdout_fn = stdout_fn;
ctx->stderr_fn = stderr_fn;
@@ -139,131 +139,126 @@ gsapi_set_stdio(void *lib,
}
/* Set the callback function for polling */
-GSDLLEXPORT int GSDLLAPI
-gsapi_set_poll(void *lib,
+GSDLLEXPORT int GSDLLAPI
+gsapi_set_poll(void *lib,
int(GSDLLCALL *poll_fn)(void *caller_handle))
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
ctx->poll_fn = poll_fn;
return 0;
}
/* Set the display callback structure */
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_set_display_callback(void *lib, display_callback *callback)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
get_minst_from_memory(ctx->memory)->display = callback;
/* not in a language switched build */
return 0;
}
-
/* Initialise the interpreter */
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_init_with_args(void *lib, int argc, char **argv)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
return gs_main_init_with_args(get_minst_from_memory(ctx->memory), argc, argv);
}
-
-
/* The gsapi_run_* functions are like gs_main_run_* except
* that the error_object is omitted.
* An error object in minst is used instead.
*/
/* Setup up a suspendable run_string */
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_begin(void *lib, int user_errors,
- int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_begin(void *lib, int user_errors,
+ int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
- return gs_main_run_string_begin(get_minst_from_memory(ctx->memory),
- user_errors, pexit_code,
- &(get_minst_from_memory(ctx->memory)->error_object));
+ return gs_main_run_string_begin(get_minst_from_memory(ctx->memory),
+ user_errors, pexit_code,
+ &(get_minst_from_memory(ctx->memory)->error_object));
}
-
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_continue(void *lib,
- const char *str, uint length, int user_errors, int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_continue(void *lib,
+ const char *str, uint length, int user_errors, int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
return gs_main_run_string_continue(get_minst_from_memory(ctx->memory),
- str, length, user_errors, pexit_code,
- &(get_minst_from_memory(ctx->memory)->error_object));
+ str, length, user_errors, pexit_code,
+ &(get_minst_from_memory(ctx->memory)->error_object));
}
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_end(void *lib,
- int user_errors, int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_end(void *lib,
+ int user_errors, int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
return gs_main_run_string_end(get_minst_from_memory(ctx->memory),
- user_errors, pexit_code,
- &(get_minst_from_memory(ctx->memory)->error_object));
+ user_errors, pexit_code,
+ &(get_minst_from_memory(ctx->memory)->error_object));
}
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_with_length(void *lib,
- const char *str, uint length, int user_errors, int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_with_length(void *lib,
+ const char *str, uint length, int user_errors, int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
return gs_main_run_string_with_length(get_minst_from_memory(ctx->memory),
- str, length, user_errors, pexit_code,
- &(get_minst_from_memory(ctx->memory)->error_object));
+ str, length, user_errors, pexit_code,
+ &(get_minst_from_memory(ctx->memory)->error_object));
}
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string(void *lib,
- const char *str, int user_errors, int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string(void *lib,
+ const char *str, int user_errors, int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
return gsapi_run_string_with_length(get_minst_from_memory(ctx->memory),
- str, (uint)strlen(str), user_errors, pexit_code);
+ str, (uint)strlen(str), user_errors, pexit_code);
}
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_file(void *lib, const char *file_name,
- int user_errors, int *pexit_code)
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_file(void *lib, const char *file_name,
+ int user_errors, int *pexit_code)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
return gs_main_run_file(get_minst_from_memory(ctx->memory),
- file_name, user_errors, pexit_code,
- &(get_minst_from_memory(ctx->memory)->error_object));
+ file_name, user_errors, pexit_code,
+ &(get_minst_from_memory(ctx->memory)->error_object));
}
-
/* Exit the interpreter */
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_exit(void *lib)
{
gs_lib_ctx_t *ctx = (gs_lib_ctx_t *)lib;
if (lib == NULL)
- return e_Fatal;
+ return e_Fatal;
gs_to_exit(ctx->memory, 0);
return 0;
diff --git a/gs/psi/iapi.h b/gs/psi/iapi.h
index a82aad3aa..277505b92 100644
--- a/gs/psi/iapi.h
+++ b/gs/psi/iapi.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -16,7 +16,7 @@
/*
* Public API for Ghostscript interpreter
* for use both as DLL and for static linking.
- *
+ *
* Should work for Windows, OS/2, Linux, Mac.
*
* DLL exported functions should be as similar as possible to imain.c
@@ -24,19 +24,19 @@
*
* Current problems:
* 1. Ghostscript does not support multiple instances.
- * 2. Global variables in gs_main_instance_default()
+ * 2. Global variables in gs_main_instance_default()
* and gsapi_instance_counter
*/
/* Exported functions may need different prefix
* GSDLLEXPORT marks functions as exported
- * GSDLLAPI is the calling convention used on functions exported
+ * GSDLLAPI is the calling convention used on functions exported
* by Ghostscript
* GSDLLCALL is used on callback functions called by Ghostscript
* When you include this header file in the caller, you may
* need to change the definitions by defining these
* before including this header file.
- * Make sure you get the calling convention correct, otherwise your
+ * Make sure you get the calling convention correct, otherwise your
* program will crash either during callbacks or soon after returning
* due to stack corruption.
*/
@@ -94,7 +94,7 @@ extern "C" {
# define GSDLLCALLPTR * GSDLLCALL
#else
# define GSDLLAPIPTR GSDLLAPI *
-# define GSDLLCALLPTR GSDLLCALL *
+# define GSDLLCALLPTR GSDLLCALL *
#endif
#ifndef display_callback_DEFINED
@@ -109,7 +109,6 @@ typedef struct gsapi_revision_s {
long revisiondate;
} gsapi_revision_t;
-
/* Get version numbers and strings.
* This is safe to call at any time.
* You should call this first to make sure that the correct version
@@ -120,13 +119,13 @@ typedef struct gsapi_revision_s {
* have been added to the structure) it will return the required
* size of the structure.
*/
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_revision(gsapi_revision_t *pr, int len);
/*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
* Ghostscript supports only one instance.
- * The current implementation uses a global static instance
+ * The current implementation uses a global static instance
* counter to make sure that only a single instance is used.
* If you try to create two instances, the second attempt
* will return < 0 and set pinstance to NULL.
@@ -136,14 +135,14 @@ gsapi_revision(gsapi_revision_t *pr, int len);
* This instance is passed to most other API functions.
* The caller_handle will be provided to callback functions.
*/
-
-GSDLLEXPORT int GSDLLAPI
+
+GSDLLEXPORT int GSDLLAPI
gsapi_new_instance(void **pinstance, void *caller_handle);
/*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
* Ghostscript supports only one instance.
- * The current implementation uses a global static instance
+ * The current implementation uses a global static instance
* counter to make sure that only a single instance is used.
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*/
@@ -152,7 +151,7 @@ gsapi_new_instance(void **pinstance, void *caller_handle);
* If Ghostscript has been initialised, you must call gsapi_exit()
* before gsapi_delete_instance.
*/
-GSDLLEXPORT void GSDLLAPI
+GSDLLEXPORT void GSDLLAPI
gsapi_delete_instance(void *instance);
/* Set the callback functions for stdio
@@ -162,7 +161,7 @@ gsapi_delete_instance(void *instance);
* the number of characters written.
* If a callback address is NULL, the real stdio will be used.
*/
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_set_stdio(void *instance,
int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
@@ -188,23 +187,22 @@ GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance,
GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback(
void *instance, display_callback *callback);
-
/* Initialise the interpreter.
* This calls gs_main_init_with_args() in imainarg.c
- * 1. If quit or EOF occur during gsapi_init_with_args(),
- * the return value will be e_Quit. This is not an error.
+ * 1. If quit or EOF occur during gsapi_init_with_args(),
+ * the return value will be e_Quit. This is not an error.
* You must call gsapi_exit() and must not call any other
* gsapi_XXX functions.
* 2. If usage info should be displayed, the return value will be e_Info
* which is not an error. Do not call gsapi_exit().
- * 3. Under normal conditions this returns 0. You would then
+ * 3. Under normal conditions this returns 0. You would then
* call one or more gsapi_run_*() functions and then finish
* with gsapi_exit().
*/
-GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
+GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
int argc, char **argv);
-/*
+/*
* The gsapi_run_* functions are like gs_main_run_* except
* that the error_object is omitted.
* If these functions return <= -100, either quit or a fatal
@@ -213,45 +211,43 @@ GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
* which will return e_NeedInput if all is well.
*/
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_begin(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_begin(void *instance,
int user_errors, int *pexit_code);
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_continue(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_continue(void *instance,
const char *str, unsigned int length, int user_errors, int *pexit_code);
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_end(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_end(void *instance,
int user_errors, int *pexit_code);
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string_with_length(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string_with_length(void *instance,
const char *str, unsigned int length, int user_errors, int *pexit_code);
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_string(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_string(void *instance,
const char *str, int user_errors, int *pexit_code);
-GSDLLEXPORT int GSDLLAPI
-gsapi_run_file(void *instance,
+GSDLLEXPORT int GSDLLAPI
+gsapi_run_file(void *instance,
const char *file_name, int user_errors, int *pexit_code);
-
/* Exit the interpreter.
* This must be called on shutdown if gsapi_init_with_args()
* has been called, and just before gsapi_delete_instance().
*/
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
gsapi_exit(void *instance);
/* Visual Tracer */
/* This function is only for debug purpose clients */
struct vd_trace_interface_s;
-GSDLLEXPORT void GSDLLAPI
+GSDLLEXPORT void GSDLLAPI
gsapi_set_visual_tracer(struct vd_trace_interface_s *I);
-
/* function prototypes */
typedef int (GSDLLAPIPTR PFN_gsapi_revision)(
gsapi_revision_t *pr, int len);
@@ -280,15 +276,14 @@ typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)(
void *instance, const char *str, unsigned int length,
int user_errors, int *pexit_code);
typedef int (GSDLLAPIPTR PFN_gsapi_run_string)(
- void *instance, const char *str,
+ void *instance, const char *str,
int user_errors, int *pexit_code);
-typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance,
+typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance,
const char *file_name, int user_errors, int *pexit_code);
typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance);
-typedef void (GSDLLAPIPTR PFN_gsapi_set_visual_tracer)
+typedef void (GSDLLAPIPTR PFN_gsapi_set_visual_tracer)
(struct vd_trace_interface_s *I);
-
#ifdef __MACOS__
#pragma export off
#endif
diff --git a/gs/psi/iastate.h b/gs/psi/iastate.h
index 2270b6dde..7ac290cc9 100644
--- a/gs/psi/iastate.h
+++ b/gs/psi/iastate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iastruct.h b/gs/psi/iastruct.h
index 1f0dde041..85a8cb4e2 100644
--- a/gs/psi/iastruct.h
+++ b/gs/psi/iastruct.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ibnum.c b/gs/psi/ibnum.c
index f80b1d2cd..bef5ad611 100644
--- a/gs/psi/ibnum.c
+++ b/gs/psi/ibnum.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,28 +38,28 @@ num_array_format(const ref * op)
int format;
switch (r_type(op)) {
- case t_string:
- {
- /* Check that this is a legitimate encoded number string. */
- const byte *bp = op->value.bytes;
+ case t_string:
+ {
+ /* Check that this is a legitimate encoded number string. */
+ const byte *bp = op->value.bytes;
- if (r_size(op) < 4 || bp[0] != bt_num_array_value)
- return_error(e_typecheck);
- format = bp[1];
- if (!num_is_valid(format) ||
- sdecodeshort(bp + 2, format) !=
- (r_size(op) - 4) / encoded_number_bytes(format)
- )
- return_error(e_rangecheck);
- }
- break;
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- format = num_array;
- break;
- default:
- return_error(e_typecheck);
+ if (r_size(op) < 4 || bp[0] != bt_num_array_value)
+ return_error(e_typecheck);
+ format = bp[1];
+ if (!num_is_valid(format) ||
+ sdecodeshort(bp + 2, format) !=
+ (r_size(op) - 4) / encoded_number_bytes(format)
+ )
+ return_error(e_rangecheck);
+ }
+ break;
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ format = num_array;
+ break;
+ default:
+ return_error(e_typecheck);
}
check_read(*op);
return format;
@@ -70,7 +70,7 @@ uint
num_array_size(const ref * op, int format)
{
return (format == num_array ? r_size(op) :
- (r_size(op) - 4) / encoded_number_bytes(format));
+ (r_size(op) - 4) / encoded_number_bytes(format));
}
/* Get an encoded number from an array/string according to the given format. */
@@ -81,25 +81,25 @@ int
num_array_get(const gs_memory_t *mem, const ref * op, int format, uint index, ref * np)
{
if (format == num_array) {
- int code = array_get(mem, op, (long)index, np);
+ int code = array_get(mem, op, (long)index, np);
- if (code < 0)
- return t_null;
- switch (r_type(np)) {
- case t_integer:
- return t_integer;
- case t_real:
- return t_real;
- default:
- return_error(e_typecheck);
- }
+ if (code < 0)
+ return t_null;
+ switch (r_type(np)) {
+ case t_integer:
+ return t_integer;
+ case t_real:
+ return t_real;
+ default:
+ return_error(e_typecheck);
+ }
} else {
- uint nbytes = encoded_number_bytes(format);
+ uint nbytes = encoded_number_bytes(format);
- if (index >= (r_size(op) - 4) / nbytes)
- return t_null;
- return sdecode_number(op->value.bytes + 4 + index * nbytes,
- format, np);
+ if (index >= (r_size(op) - 4) / nbytes)
+ return t_null;
+ return sdecode_number(op->value.bytes + 4 + index * nbytes,
+ format, np);
}
}
@@ -121,39 +121,39 @@ int
sdecode_number(const byte * str, int format, ref * np)
{
switch (format & 0x170) {
- case num_int32:
- case num_int32 + 16:
- if ((format & 31) == 0) {
- np->value.intval = sdecodeint32(str, format);
- return t_integer;
- } else {
- np->value.realval =
- (double)sdecodeint32(str, format) *
- binary_scale[format & 31];
- return t_real;
- }
- case num_int16:
- if ((format & 15) == 0) {
- np->value.intval = sdecodeshort(str, format);
- return t_integer;
- } else {
- np->value.realval =
- sdecodeshort(str, format) *
- binary_scale[format & 15];
- return t_real;
- }
- case num_float:
- {
- float fval;
- int code = sdecode_float(str, format, &fval);
+ case num_int32:
+ case num_int32 + 16:
+ if ((format & 31) == 0) {
+ np->value.intval = sdecodeint32(str, format);
+ return t_integer;
+ } else {
+ np->value.realval =
+ (double)sdecodeint32(str, format) *
+ binary_scale[format & 31];
+ return t_real;
+ }
+ case num_int16:
+ if ((format & 15) == 0) {
+ np->value.intval = sdecodeshort(str, format);
+ return t_integer;
+ } else {
+ np->value.realval =
+ sdecodeshort(str, format) *
+ binary_scale[format & 15];
+ return t_real;
+ }
+ case num_float:
+ {
+ float fval;
+ int code = sdecode_float(str, format, &fval);
- if (code < 0)
- return code;
- np->value.realval = fval;
- return t_real;
- }
- default:
- return_error(e_syntaxerror); /* invalid format?? */
+ if (code < 0)
+ return code;
+ np->value.realval = fval;
+ return t_real;
+ }
+ default:
+ return_error(e_syntaxerror); /* invalid format?? */
}
}
@@ -183,12 +183,11 @@ sdecodeint32(const byte * p, int format)
{
int a = p[0], b = p[1], c = p[2], d = p[3];
int v = (num_is_lsb(format) ?
- ((int)d << 24) + ((int)c << 16) + (b << 8) + a :
- ((int)a << 24) + ((int)b << 16) + (c << 8) + d);
+ ((int)d << 24) + ((int)c << 16) + (b << 8) + a :
+ ((int)a << 24) + ((int)b << 16) + (c << 8) + d);
return v;
}
-
/* Decode a 32-bit number. Return the resukt through a pointer */
/* to work around a gcc 4.2.1 bug on PowerPC, bug 689586 */
static void
@@ -196,12 +195,11 @@ sdecodebits32(const byte * p, int format, bits32 *v)
{
int a = p[0], b = p[1], c = p[2], d = p[3];
*v = (num_is_lsb(format) ?
- ((long)d << 24) + ((long)c << 16) + (b << 8) + a :
- ((long)a << 24) + ((long)b << 16) + (c << 8) + d);
+ ((long)d << 24) + ((long)c << 16) + (b << 8) + a :
+ ((long)a << 24) + ((long)b << 16) + (c << 8) + d);
}
-
/* Decode a float. We assume that native floats occupy 32 bits. */
/* If the float is an IEEE NaN or Inf, return e_undefinedresult. */
int
@@ -210,42 +208,42 @@ sdecode_float(const byte * p, int format, float *pfnum)
bits32 lnum;
if ((format & ~(num_msb | num_lsb)) == num_float_native) {
- /*
- * Just read 4 bytes and interpret them as a float, ignoring
- * any indication of byte ordering.
- */
- memcpy(pfnum, p, 4);
+ /*
+ * Just read 4 bytes and interpret them as a float, ignoring
+ * any indication of byte ordering.
+ */
+ memcpy(pfnum, p, 4);
#if !ARCH_FLOATS_ARE_IEEE
- return 0; /* no way to check for anomalies */
+ return 0; /* no way to check for anomalies */
#endif
- lnum = *(bits32 *)pfnum;
+ lnum = *(bits32 *)pfnum;
} else {
- sdecodebits32(p, format, &lnum);
+ sdecodebits32(p, format, &lnum);
#if !ARCH_FLOATS_ARE_IEEE
- {
- /* We know IEEE floats take 32 bits. */
- /* Convert IEEE float to native float. */
- int sign_expt = lnum >> 23;
- int expt = sign_expt & 0xff;
- long mant = lnum & 0x7fffff;
- float fnum;
+ {
+ /* We know IEEE floats take 32 bits. */
+ /* Convert IEEE float to native float. */
+ int sign_expt = lnum >> 23;
+ int expt = sign_expt & 0xff;
+ long mant = lnum & 0x7fffff;
+ float fnum;
- if (expt == 0 && mant == 0)
- fnum = 0;
- else if (expt == 0xff)
- return_error(e_undefinedresult); /* Inf or NaN */
- else {
- mant += 0x800000;
- fnum = (float)ldexp((float)mant, expt - 127 - 23);
- }
- if (sign_expt & 0x100)
- fnum = -fnum;
- *pfnum = fnum;
- return 0; /* checked for Infs and NaNs above */
- }
+ if (expt == 0 && mant == 0)
+ fnum = 0;
+ else if (expt == 0xff)
+ return_error(e_undefinedresult); /* Inf or NaN */
+ else {
+ mant += 0x800000;
+ fnum = (float)ldexp((float)mant, expt - 127 - 23);
+ }
+ if (sign_expt & 0x100)
+ fnum = -fnum;
+ *pfnum = fnum;
+ return 0; /* checked for Infs and NaNs above */
+ }
#else
- *pfnum = *(float *)&lnum;
+ *pfnum = *(float *)&lnum;
#endif
}
/*
@@ -254,6 +252,6 @@ sdecode_float(const byte * p, int format, float *pfnum)
* IEEE (which is the case if control arrives here).
*/
if (!(~lnum & 0x7f800000)) /* i.e. exponent all 1's */
- return_error(e_undefinedresult); /* Inf or NaN */
+ return_error(e_undefinedresult); /* Inf or NaN */
return 0;
}
diff --git a/gs/psi/ibnum.h b/gs/psi/ibnum.h
index 78223c33e..e174290a1 100644
--- a/gs/psi/ibnum.h
+++ b/gs/psi/ibnum.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ichar.h b/gs/psi/ichar.h
index 247af2884..996cdd6cd 100644
--- a/gs/psi/ichar.h
+++ b/gs/psi/ichar.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ichar1.h b/gs/psi/ichar1.h
index e05804e90..2dc2482ae 100644
--- a/gs/psi/ichar1.h
+++ b/gs/psi/ichar1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,18 +41,18 @@ font_proc_glyph_outline(zchar1_glyph_outline);
* for CIDFontType 0 fonts uses this.
*/
int zcharstring_outline(gs_font_type1 *pfont, int WMode, const ref *pgref,
- const gs_glyph_data_t *pgd,
- const gs_matrix *pmat, gx_path *ppath, double sbw[4]);
+ const gs_glyph_data_t *pgd,
+ const gs_matrix *pmat, gx_path *ppath, double sbw[4]);
int
z1_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info);
+ int members, gs_glyph_info_t *info);
int z1_glyph_info_generic(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info, font_proc_glyph_info((*proc)),
- int wmode);
+ int members, gs_glyph_info_t *info, font_proc_glyph_info((*proc)),
+ int wmode);
-int z1_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
- gs_glyph glyph, op_proc_t cont, op_proc_t *exec_cont);
+int z1_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
+ gs_glyph glyph, op_proc_t cont, op_proc_t *exec_cont);
#endif /* ichar1_INCLUDED */
diff --git a/gs/psi/icharout.h b/gs/psi/icharout.h
index 72a33d6c7..0e7784097 100644
--- a/gs/psi/icharout.h
+++ b/gs/psi/icharout.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,12 +32,12 @@ typedef enum {
} metrics_present;
int /*metrics_present*/
zchar_get_metrics(const gs_font_base * pbfont, const ref * pcnref,
- double psbw[4]);
+ double psbw[4]);
/* Get the vertical metrics for a character from Metrics2, if present. */
int /*metrics_present*/
zchar_get_metrics2(const gs_font_base * pbfont, const ref * pcnref,
- double pwv[4]);
+ double pwv[4]);
/* Get CDevProc. */
bool zchar_get_CDevProc(const gs_font_base * pbfont, ref **ppcdevproc);
@@ -47,17 +47,17 @@ bool zchar_get_CDevProc(const gs_font_base * pbfont, ref **ppcdevproc);
* rendering process (only getting the metrics).
*/
int zchar_set_cache(i_ctx_t *i_ctx_p, const gs_font_base * pbfont,
- const ref * pcnref, const double psb[2],
- const double pwidth[2], const gs_rect * pbbox,
- op_proc_t cont, op_proc_t *exec_cont,
- const double Metrics2_sbw_default[4]);
+ const ref * pcnref, const double psb[2],
+ const double pwidth[2], const gs_rect * pbbox,
+ op_proc_t cont, op_proc_t *exec_cont,
+ const double Metrics2_sbw_default[4]);
/*
* Get the CharString data corresponding to a glyph. Return typecheck
* if it isn't a string.
*/
int zchar_charstring_data(gs_font *font, const ref *pgref,
- gs_glyph_data_t *pgd);
+ gs_glyph_data_t *pgd);
/*
* Enumerate the next glyph from a directory. This is essentially a
diff --git a/gs/psi/icid.h b/gs/psi/icid.h
index 4bdf5ff0b..82d3b2da1 100644
--- a/gs/psi/icid.h
+++ b/gs/psi/icid.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,13 +27,13 @@ int cid_system_info_param(gs_cid_system_info_t *, const ref *);
/* Convert a CID into TT char code or to TT glyph index, using SubstNWP. */
/* Returns 1 if a glyph presents, 0 if not, <0 if error. */
-int cid_to_TT_charcode(const gs_memory_t *mem,
- const ref *Decoding, const ref *TT_cmap,
- const ref *SubstNWP,
+int cid_to_TT_charcode(const gs_memory_t *mem,
+ const ref *Decoding, const ref *TT_cmap,
+ const ref *SubstNWP,
uint nCID, uint *c, ref *src_type, ref *dst_type);
/* Create a CIDMap from a True Type cmap, Decoding and SubstNWP. */
-int cid_fill_CIDMap(const gs_memory_t *mem, const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP,
+int cid_fill_CIDMap(const gs_memory_t *mem, const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP,
int GDBytes, ref *CIDMap);
/* Create an identity CIDMap. */
int cid_fill_Identity_CIDMap(const gs_memory_t *mem, ref *CIDMap);
diff --git a/gs/psi/icie.h b/gs/psi/icie.h
index f08da424b..4cf791915 100644
--- a/gs/psi/icie.h
+++ b/gs/psi/icie.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,68 +27,68 @@
/* Get a range array parameter from a dictionary. */
/* We know that count <= 4. */
int dict_ranges_param(const gs_memory_t *mem,
- const ref * pdref, const char *kstr, int count,
- gs_range * prange);
+ const ref * pdref, const char *kstr, int count,
+ gs_range * prange);
/* Get 3 ranges from a dictionary. */
int dict_range3_param(const gs_memory_t *mem,
- const ref *pdref, const char *kstr,
- gs_range3 *prange3);
+ const ref *pdref, const char *kstr,
+ gs_range3 *prange3);
/* Get a 3x3 matrix parameter from a dictionary. */
-int dict_matrix3_param(const gs_memory_t *mem, const ref *pdref,
- const char *kstr,
- gs_matrix3 *pmat3);
+int dict_matrix3_param(const gs_memory_t *mem, const ref *pdref,
+ const char *kstr,
+ gs_matrix3 *pmat3);
/* Get an array of procedures from a dictionary. */
/* We know count <= countof(empty_procs). */
-int dict_proc_array_param(const gs_memory_t *mem, const ref *pdict,
- const char *kstr,
- uint count, ref * pparray);
+int dict_proc_array_param(const gs_memory_t *mem, const ref *pdict,
+ const char *kstr,
+ uint count, ref * pparray);
/* Get 3 procedures from a dictionary. */
-int dict_proc3_param(const gs_memory_t *mem, const ref *pdref,
- const char *kstr, ref proc3[3]);
+int dict_proc3_param(const gs_memory_t *mem, const ref *pdref,
+ const char *kstr, ref proc3[3]);
/* Get WhitePoint and BlackPoint values. */
-int cie_points_param(const gs_memory_t *mem,
- const ref * pdref, gs_cie_wb * pwb);
+int cie_points_param(const gs_memory_t *mem,
+ const ref * pdref, gs_cie_wb * pwb);
/* Process a 3- or 4-dimensional lookup table from a dictionary. */
/* The caller has set pclt->n and pclt->m. */
/* ptref is known to be a readable array of size at least n+1. */
int cie_table_param(const ref * ptable, gx_color_lookup_table * pclt,
- const gs_memory_t * mem);
+ const gs_memory_t * mem);
/* ------ Internal routines ------ */
int cie_set_finish(i_ctx_t *, gs_color_space *,
- const ref_cie_procs *, int, int);
+ const ref_cie_procs *, int, int);
int cie_cache_push_finish(i_ctx_t *i_ctx_p, op_proc_t finish_proc,
- gs_ref_memory_t * imem, void *data);
+ gs_ref_memory_t * imem, void *data);
int cie_prepare_cache(i_ctx_t *i_ctx_p, const gs_range * domain,
- const ref * proc, cie_cache_floats * pcache,
- void *container, gs_ref_memory_t * imem,
- client_name_t cname);
+ const ref * proc, cie_cache_floats * pcache,
+ void *container, gs_ref_memory_t * imem,
+ client_name_t cname);
int cie_prepare_caches_4(i_ctx_t *i_ctx_p, const gs_range * domains,
- const ref * procs,
- cie_cache_floats * pc0,
- cie_cache_floats * pc1,
- cie_cache_floats * pc2,
- cie_cache_floats * pc3 /* may be 0 */,
- void *container,
- gs_ref_memory_t * imem, client_name_t cname);
+ const ref * procs,
+ cie_cache_floats * pc0,
+ cie_cache_floats * pc1,
+ cie_cache_floats * pc2,
+ cie_cache_floats * pc3 /* may be 0 */,
+ void *container,
+ gs_ref_memory_t * imem, client_name_t cname);
#define cie_prepare_cache3(p,d3,p3,c3,pcie,imem,cname)\
cie_prepare_caches_4(p, (d3)->ranges, p3,\
- &(c3)->floats, &(c3)[1].floats, &(c3)[2].floats,\
- NULL, pcie, imem, cname)
+ &(c3)->floats, &(c3)[1].floats, &(c3)[2].floats,\
+ NULL, pcie, imem, cname)
#define cie_prepare_cache4(p,d4,p4,c4,pcie,imem,cname)\
cie_prepare_caches_4(p, (d4)->ranges, p4,\
- &(c4)->floats, &(c4)[1].floats, &(c4)[2].floats,\
- &(c4)[3].floats, pcie, imem, cname)
+ &(c4)->floats, &(c4)[1].floats, &(c4)[2].floats,\
+ &(c4)[3].floats, pcie, imem, cname)
int cie_cache_joint(i_ctx_t *, const ref_cie_render_procs *,
- const gs_cie_common *, gs_state *);
+ const gs_cie_common *, gs_state *);
#endif /* icie_INCLUDED */
diff --git a/gs/psi/icolor.h b/gs/psi/icolor.h
index b922e7548..a41985515 100644
--- a/gs/psi/icolor.h
+++ b/gs/psi/icolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ extern const int zcolor_remap_one_estack;
* a change as of release 5.95; formerly, it returned 0 in this case.)
*/
int zcolor_remap_one(i_ctx_t *, const ref *, gx_transfer_map *,
- const gs_state *, op_proc_t);
+ const gs_state *, op_proc_t);
/* Reload a cache with entries in [0..1] after sampling. */
int zcolor_remap_one_finish(i_ctx_t *);
diff --git a/gs/psi/iconf.c b/gs/psi/iconf.c
index d3f464c09..9771363af 100644
--- a/gs/psi/iconf.c
+++ b/gs/psi/iconf.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,19 +63,19 @@ const uint build_function_type_table_count =
countof(build_function_type_table) - 1;
/* Initialize the operators. */
- /* Declare the externs. */
+ /* Declare the externs. */
#define oper_(xx_op_defs) extern const op_def xx_op_defs[];
oper_(interp1_op_defs) /* Interpreter operators */
oper_(interp2_op_defs) /* ibid. */
#include "gconf.h"
#undef oper_
-
+
const op_def *const op_defs_all[] = {
#define oper_(defs) defs,
oper_(interp1_op_defs) /* Interpreter operators */
oper_(interp2_op_defs) /* ibid. */
#include "gconf.h"
-#undef oper_
+#undef oper_
0
};
const uint op_def_count = (countof(op_defs_all) - 1) * OP_DEFS_MAX_SIZE;
diff --git a/gs/psi/iconf.h b/gs/psi/iconf.h
index 9bbaa2df1..c832ed297 100644
--- a/gs/psi/iconf.h
+++ b/gs/psi/iconf.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/icontext.c b/gs/psi/icontext.c
index f504875ab..dc8bc5791 100644
--- a/gs/psi/icontext.c
+++ b/gs/psi/icontext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ extern_st(st_exec_stack);
extern_st(st_op_stack);
/* GC descriptors */
-static
+static
CLEAR_MARKS_PROC(context_state_clear_marks)
{
gs_context_state_t *const pcst = vptr;
@@ -49,23 +49,23 @@ CLEAR_MARKS_PROC(context_state_clear_marks)
r_clear_attrs(&pcst->op_array_table_global.table, l_mark);
r_clear_attrs(&pcst->op_array_table_local.table, l_mark);
}
-static
+static
ENUM_PTRS_WITH(context_state_enum_ptrs, gs_context_state_t *pcst) {
index -= 10;
if (index < st_gs_dual_memory_num_ptrs)
- return ENUM_USING(st_gs_dual_memory, &pcst->memory,
- sizeof(pcst->memory), index);
+ return ENUM_USING(st_gs_dual_memory, &pcst->memory,
+ sizeof(pcst->memory), index);
index -= st_gs_dual_memory_num_ptrs;
if (index < st_dict_stack_num_ptrs)
- return ENUM_USING(st_dict_stack, &pcst->dict_stack,
- sizeof(pcst->dict_stack), index);
+ return ENUM_USING(st_dict_stack, &pcst->dict_stack,
+ sizeof(pcst->dict_stack), index);
index -= st_dict_stack_num_ptrs;
if (index < st_exec_stack_num_ptrs)
- return ENUM_USING(st_exec_stack, &pcst->exec_stack,
- sizeof(pcst->exec_stack), index);
+ return ENUM_USING(st_exec_stack, &pcst->exec_stack,
+ sizeof(pcst->exec_stack), index);
index -= st_exec_stack_num_ptrs;
return ENUM_USING(st_op_stack, &pcst->op_stack,
- sizeof(pcst->op_stack), index);
+ sizeof(pcst->op_stack), index);
}
ENUM_PTR(0, gs_context_state_t, pgs);
case 1: ENUM_RETURN_REF(&pcst->stdio[0]);
@@ -104,8 +104,8 @@ public_st_context_state();
/* Allocate the state of a context. */
int
context_state_alloc(gs_context_state_t ** ppcst,
- const ref *psystem_dict,
- const gs_dual_memory_t * dmem)
+ const ref *psystem_dict,
+ const gs_dual_memory_t * dmem)
{
gs_ref_memory_t *mem = dmem->space_local;
gs_context_state_t *pcst = *ppcst;
@@ -113,14 +113,14 @@ context_state_alloc(gs_context_state_t ** ppcst,
int i;
if (pcst == 0) {
- pcst = gs_alloc_struct((gs_memory_t *) mem, gs_context_state_t,
- &st_context_state, "context_state_alloc");
- if (pcst == 0)
- return_error(e_VMerror);
+ pcst = gs_alloc_struct((gs_memory_t *) mem, gs_context_state_t,
+ &st_context_state, "context_state_alloc");
+ if (pcst == 0)
+ return_error(e_VMerror);
}
code = gs_interp_alloc_stacks(mem, pcst);
if (code < 0)
- goto x0;
+ goto x0;
/*
* We have to initialize the dictionary stack early,
* for far-off references to systemdict.
@@ -130,8 +130,8 @@ context_state_alloc(gs_context_state_t ** ppcst,
pcst->dict_stack.userdict_index = 0;
pcst->pgs = int_gstate_alloc(dmem);
if (pcst->pgs == 0) {
- code = gs_note_error(e_VMerror);
- goto x1;
+ code = gs_note_error(e_VMerror);
+ goto x1;
}
pcst->memory = *dmem;
pcst->language_level = 1;
@@ -144,21 +144,21 @@ context_state_alloc(gs_context_state_t ** ppcst,
pcst->plugin_list = 0;
make_t(&pcst->error_object, t__invalid);
{ /*
- * Create an empty userparams dictionary of the right size.
- * If we can't determine the size, pick an arbitrary one.
- */
- ref *puserparams;
- uint size;
- ref *system_dict = &pcst->dict_stack.system_dict;
+ * Create an empty userparams dictionary of the right size.
+ * If we can't determine the size, pick an arbitrary one.
+ */
+ ref *puserparams;
+ uint size;
+ ref *system_dict = &pcst->dict_stack.system_dict;
- if (dict_find_string(system_dict, "userparams", &puserparams) >= 0)
- size = dict_length(puserparams);
- else
- size = 300;
- code = dict_alloc(pcst->memory.space_local, size, &pcst->userparams);
- if (code < 0)
- goto x2;
- /* PostScript code initializes the user parameters. */
+ if (dict_find_string(system_dict, "userparams", &puserparams) >= 0)
+ size = dict_length(puserparams);
+ else
+ size = 300;
+ code = dict_alloc(pcst->memory.space_local, size, &pcst->userparams);
+ if (code < 0)
+ goto x2;
+ /* PostScript code initializes the user parameters. */
}
pcst->scanner_options = 0;
pcst->LockFilePermissions = false;
@@ -169,9 +169,9 @@ context_state_alloc(gs_context_state_t ** ppcst,
/* and so it can act as an empty input stream. */
{
stream *s;
-
- s = (stream*)gs_alloc_bytes_immovable(mem->non_gc_memory->stable_memory,
- sizeof(*s),
+
+ s = (stream*)gs_alloc_bytes_immovable(mem->non_gc_memory->stable_memory,
+ sizeof(*s),
"context_state_alloc");
if (s == NULL)
goto x3;
@@ -184,14 +184,14 @@ context_state_alloc(gs_context_state_t ** ppcst,
}
/* The initial stdio values are bogus.... */
make_file(&pcst->stdio[0], a_readonly | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
make_file(&pcst->stdio[1], a_all | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
make_file(&pcst->stdio[2], a_all | avm_invalid_file_entry, 1,
- pcst->invalid_file_stream);
+ pcst->invalid_file_stream);
for (i = countof(pcst->memory.spaces_indexed); --i >= 0;)
- if (dmem->spaces_indexed[i] != 0)
- ++(dmem->spaces_indexed[i]->num_contexts);
+ if (dmem->spaces_indexed[i] != 0)
+ ++(dmem->spaces_indexed[i]->num_contexts);
/* The number of interpreter "ticks" between calls on the time_slice_proc.
* Currently, the clock ticks before each operator, and at each
* procedure return. */
@@ -202,7 +202,7 @@ context_state_alloc(gs_context_state_t ** ppcst,
x2:gs_state_free(pcst->pgs);
x1:gs_interp_free_stacks(mem, pcst);
x0:if (*ppcst == 0)
- gs_free_object((gs_memory_t *) mem, pcst, "context_state_alloc");
+ gs_free_object((gs_memory_t *) mem, pcst, "context_state_alloc");
return code;
}
@@ -230,17 +230,17 @@ context_state_load(gs_context_state_t * i_ctx_p)
* things that we don't bother.
*/
{
- ref_stack_t *rdstack = &dstack->stack;
- const ref *puserdict =
- ref_stack_index(rdstack, ref_stack_count(rdstack) - 1 -
- dstack->userdict_index);
- ref *plocaldicts;
+ ref_stack_t *rdstack = &dstack->stack;
+ const ref *puserdict =
+ ref_stack_index(rdstack, ref_stack_count(rdstack) - 1 -
+ dstack->userdict_index);
+ ref *plocaldicts;
- if (dict_find_string(puserdict, "localdicts", &plocaldicts) > 0 &&
- r_has_type(plocaldicts, t_dictionary)
- ) {
- dict_copy(plocaldicts, system_dict, dstack);
- }
+ if (dict_find_string(puserdict, "localdicts", &plocaldicts) > 0 &&
+ r_has_type(plocaldicts, t_dictionary)
+ ) {
+ dict_copy(plocaldicts, system_dict, dstack);
+ }
}
/*
* Set systemdict.userparams to the saved copy, and then
@@ -250,12 +250,12 @@ context_state_load(gs_context_state_t * i_ctx_p)
* userparams also appears in localdicts.
*/
code = dict_put_string(system_dict, "userparams", &i_ctx_p->userparams,
- dstack);
+ dstack);
if (code >= 0)
- code = set_user_params(i_ctx_p, &i_ctx_p->userparams);
+ code = set_user_params(i_ctx_p, &i_ctx_p->userparams);
r_set_space(system_dict, space);
if (lmem->save_level > 0)
- alloc_set_in_save(idmemory);
+ alloc_set_in_save(idmemory);
estack_clear_cache(&iexec_stack);
dstack_set_top(&idict_stack);
return code;
@@ -274,13 +274,13 @@ context_state_store(gs_context_state_t * pcst)
* systemdict.userparams to get the correct l_new flag.
*/
{
- ref *puserparams;
- /* We need i_ctx_p for access to the d_stack. */
- i_ctx_t *i_ctx_p = pcst;
+ ref *puserparams;
+ /* We need i_ctx_p for access to the d_stack. */
+ i_ctx_t *i_ctx_p = pcst;
- if (dict_find_string(systemdict, "userparams", &puserparams) < 0)
- return_error(e_Fatal);
- pcst->userparams = *puserparams;
+ if (dict_find_string(systemdict, "userparams", &puserparams) < 0)
+ return_error(e_Fatal);
+ pcst->userparams = *puserparams;
}
return 0;
}
@@ -303,12 +303,12 @@ context_state_free(gs_context_state_t * pcst)
* otherwise, just free the context-related structures.
*/
for (i = countof(pcst->memory.spaces_indexed); --i >= 0;) {
- if (pcst->memory.spaces_indexed[i] != 0 &&
- !--(pcst->memory.spaces_indexed[i]->num_contexts)
- ) {
+ if (pcst->memory.spaces_indexed[i] != 0 &&
+ !--(pcst->memory.spaces_indexed[i]->num_contexts)
+ ) {
/****** FREE THE ENTIRE SPACE ******/
- freed |= 1 << i;
- }
+ freed |= 1 << i;
+ }
}
/*
* If we freed any spaces at all, we must have freed the local
@@ -316,20 +316,20 @@ context_state_free(gs_context_state_t * pcst)
* allocated.
*/
if (freed)
- return freed;
+ return freed;
{
- gs_state *pgs = pcst->pgs;
+ gs_state *pgs = pcst->pgs;
- gs_grestoreall(pgs);
- /* Patch the saved pointer so we can do the last grestore. */
- {
- gs_state *saved = gs_state_saved(pgs);
+ gs_grestoreall(pgs);
+ /* Patch the saved pointer so we can do the last grestore. */
+ {
+ gs_state *saved = gs_state_saved(pgs);
- gs_state_swap_saved(saved, saved);
- }
- gs_grestore(pgs);
- gs_state_swap_saved(pgs, (gs_state *) 0);
- gs_state_free(pgs);
+ gs_state_swap_saved(saved, saved);
+ }
+ gs_grestore(pgs);
+ gs_state_swap_saved(pgs, (gs_state *) 0);
+ gs_state_free(pgs);
}
/****** FREE USERPARAMS ******/
gs_interp_free_stacks(mem, pcst);
diff --git a/gs/psi/icontext.h b/gs/psi/icontext.h
index 1cd24ec49..72986e699 100644
--- a/gs/psi/icontext.h
+++ b/gs/psi/icontext.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,8 +33,8 @@ extern int set_user_params(i_ctx_t *i_ctx_p, const ref * paramdict);
/* Allocate the state of a context, always in local VM. */
/* If *ppcst == 0, allocate the state object as well. */
int context_state_alloc(gs_context_state_t ** ppcst,
- const ref *psystem_dict,
- const gs_dual_memory_t * dmem);
+ const ref *psystem_dict,
+ const gs_dual_memory_t * dmem);
/* Load the state of the interpreter from a context. */
/* The argument is not const because caches may be updated. */
diff --git a/gs/psi/icremap.h b/gs/psi/icremap.h
index e4dda2029..c6284576e 100644
--- a/gs/psi/icremap.h
+++ b/gs/psi/icremap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/icsmap.h b/gs/psi/icsmap.h
index 3a6f99b5a..70437c3d8 100644
--- a/gs/psi/icsmap.h
+++ b/gs/psi/icsmap.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,8 +34,8 @@
* a Separation or DeviceN space.
*/
int zcs_begin_map(i_ctx_t *i_ctx_p, gs_indexed_map ** pmap,
- const ref * pproc, int num_entries,
- const gs_color_space * base_space,
- op_proc_t map1);
+ const ref * pproc, int num_entries,
+ const gs_color_space * base_space,
+ op_proc_t map1);
#endif /* icsmap_INCLUDED */
diff --git a/gs/psi/icstate.h b/gs/psi/icstate.h
index d8a245a3a..cdccab998 100644
--- a/gs/psi/icstate.h
+++ b/gs/psi/icstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,6 @@ typedef struct gs_context_state_s gs_context_state_t;
typedef struct gs_file_path_s *gs_file_path_ptr;
#endif
-
struct gs_context_state_s {
gs_state *pgs;
gs_dual_memory_t memory;
@@ -49,7 +48,7 @@ struct gs_context_state_s {
ref binary_object_format; /* t_integer */
long rand_state; /* (not in Red Book) */
long usertime_total; /* total accumulated usertime, */
- /* not counting current time if running */
+ /* not counting current time if running */
bool keep_usertime; /* true if context ever executed usertime */
int in_superexec; /* # of levels of superexec */
/* View clipping is handled in the graphics state. */
diff --git a/gs/psi/iddict.h b/gs/psi/iddict.h
index f30e59ff4..847b52536 100644
--- a/gs/psi/iddict.h
+++ b/gs/psi/iddict.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iddstack.h b/gs/psi/iddstack.h
index 9e6d2da55..9374615ed 100644
--- a/gs/psi/iddstack.h
+++ b/gs/psi/iddstack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/idebug.c b/gs/psi/idebug.c
index 749948904..3d0fba481 100644
--- a/gs/psi/idebug.c
+++ b/gs/psi/idebug.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,88 +63,88 @@ debug_print_full_ref(const gs_memory_t *mem, const ref * pref)
dprintf1("(%x)", r_type_attrs(pref));
switch (r_type(pref)) {
- case t_array:
- dprintf2("array(%u)0x%lx", size, (ulong) pref->value.refs);
- break;
- case t_astruct:
- goto strct;
- case t_boolean:
- dprintf1("boolean %x", pref->value.boolval);
- break;
- case t_device:
- dprintf1("device 0x%lx", (ulong) pref->value.pdevice);
- break;
- case t_dictionary:
- dprintf3("dict(%u/%u)0x%lx",
- dict_length(pref), dict_maxlength(pref),
- (ulong) pref->value.pdict);
- break;
- case t_file:
- dprintf1("file 0x%lx", (ulong) pref->value.pfile);
- break;
- case t_fontID:
- goto strct;
- case t_integer:
- dprintf1("int %d", pref->value.intval);
- break;
- case t_mark:
- dprintf("mark");
- break;
- case t_mixedarray:
- dprintf2("mixed packedarray(%u)0x%lx", size,
- (ulong) pref->value.packed);
- break;
- case t_name:
- dprintf2("name(0x%lx#%u)", (ulong) pref->value.pname,
- name_index(mem, pref));
- debug_print_name(mem, pref);
- break;
- case t_null:
- dprintf("null");
- break;
- case t_oparray:
- dprintf2("op_array(%u)0x%lx:", size, (ulong) pref->value.const_refs);
- {
- const op_array_table *opt = get_op_array(mem, size);
+ case t_array:
+ dprintf2("array(%u)0x%lx", size, (ulong) pref->value.refs);
+ break;
+ case t_astruct:
+ goto strct;
+ case t_boolean:
+ dprintf1("boolean %x", pref->value.boolval);
+ break;
+ case t_device:
+ dprintf1("device 0x%lx", (ulong) pref->value.pdevice);
+ break;
+ case t_dictionary:
+ dprintf3("dict(%u/%u)0x%lx",
+ dict_length(pref), dict_maxlength(pref),
+ (ulong) pref->value.pdict);
+ break;
+ case t_file:
+ dprintf1("file 0x%lx", (ulong) pref->value.pfile);
+ break;
+ case t_fontID:
+ goto strct;
+ case t_integer:
+ dprintf1("int %d", pref->value.intval);
+ break;
+ case t_mark:
+ dprintf("mark");
+ break;
+ case t_mixedarray:
+ dprintf2("mixed packedarray(%u)0x%lx", size,
+ (ulong) pref->value.packed);
+ break;
+ case t_name:
+ dprintf2("name(0x%lx#%u)", (ulong) pref->value.pname,
+ name_index(mem, pref));
+ debug_print_name(mem, pref);
+ break;
+ case t_null:
+ dprintf("null");
+ break;
+ case t_oparray:
+ dprintf2("op_array(%u)0x%lx:", size, (ulong) pref->value.const_refs);
+ {
+ const op_array_table *opt = get_op_array(mem, size);
- name_index_ref(mem, opt->nx_table[size - opt->base_index], &nref);
- }
- debug_print_name(mem, &nref);
- break;
- case t_operator:
- dprintf1("op(%u", size);
- if (size > 0 && size < op_def_count) /* just in case */
- dprintf1(":%s", (const char *)(op_index_def(size)->oname + 1));
- dprintf1(")0x%lx", (ulong) pref->value.opproc);
- break;
- case t_real:
- dprintf1("real %f", pref->value.realval);
- break;
- case t_save:
- dprintf1("save %lu", pref->value.saveid);
- break;
- case t_shortarray:
- dprintf2("short packedarray(%u)0x%lx", size,
- (ulong) pref->value.packed);
- break;
- case t_string:
- dprintf2("string(%u)0x%lx", size, (ulong) pref->value.bytes);
- break;
- case t_struct:
- strct:{
- obj_header_t *obj = (obj_header_t *) pref->value.pstruct;
- /* HACK: We know this object was allocated with gsalloc.c. */
- gs_memory_type_ptr_t otype =
- gs_ref_memory_procs.object_type(NULL, obj);
+ name_index_ref(mem, opt->nx_table[size - opt->base_index], &nref);
+ }
+ debug_print_name(mem, &nref);
+ break;
+ case t_operator:
+ dprintf1("op(%u", size);
+ if (size > 0 && size < op_def_count) /* just in case */
+ dprintf1(":%s", (const char *)(op_index_def(size)->oname + 1));
+ dprintf1(")0x%lx", (ulong) pref->value.opproc);
+ break;
+ case t_real:
+ dprintf1("real %f", pref->value.realval);
+ break;
+ case t_save:
+ dprintf1("save %lu", pref->value.saveid);
+ break;
+ case t_shortarray:
+ dprintf2("short packedarray(%u)0x%lx", size,
+ (ulong) pref->value.packed);
+ break;
+ case t_string:
+ dprintf2("string(%u)0x%lx", size, (ulong) pref->value.bytes);
+ break;
+ case t_struct:
+ strct:{
+ obj_header_t *obj = (obj_header_t *) pref->value.pstruct;
+ /* HACK: We know this object was allocated with gsalloc.c. */
+ gs_memory_type_ptr_t otype =
+ gs_ref_memory_procs.object_type(NULL, obj);
- dprintf2("struct %s 0x%lx",
- (r_is_foreign(pref) ? "-foreign-" :
- gs_struct_type_name_string(otype)),
- (ulong) obj);
- }
- break;
- default:
- dprintf1("type 0x%x", r_type(pref));
+ dprintf2("struct %s 0x%lx",
+ (r_is_foreign(pref) ? "-foreign-" :
+ gs_struct_type_name_string(otype)),
+ (ulong) obj);
+ }
+ break;
+ default:
+ dprintf1("type 0x%x", r_type(pref));
}
}
static void
@@ -154,34 +154,34 @@ debug_print_packed_ref(const gs_memory_t *mem, const ref_packed *pref)
ref nref;
switch (*pref >> r_packed_type_shift) {
- case pt_executable_operator:
- dprintf("<op_name>");
- op_index_ref(mem, elt, &nref);
- debug_print_ref(mem, &nref);
- break;
- case pt_integer:
- dprintf1("<int> %d", (int)elt + packed_min_intval);
- break;
- case pt_literal_name:
- dprintf("<lit_name>");
- goto ptn;
- case pt_executable_name:
- dprintf("<exec_name>");
+ case pt_executable_operator:
+ dprintf("<op_name>");
+ op_index_ref(mem, elt, &nref);
+ debug_print_ref(mem, &nref);
+ break;
+ case pt_integer:
+ dprintf1("<int> %d", (int)elt + packed_min_intval);
+ break;
+ case pt_literal_name:
+ dprintf("<lit_name>");
+ goto ptn;
+ case pt_executable_name:
+ dprintf("<exec_name>");
ptn: name_index_ref(mem, elt, &nref);
- dprintf2("(0x%lx#%u)", (ulong) nref.value.pname, elt);
- debug_print_name(mem, &nref);
- break;
- default:
- dprintf2("<packed_%d?>0x%x", *pref >> r_packed_type_shift, elt);
+ dprintf2("(0x%lx#%u)", (ulong) nref.value.pname, elt);
+ debug_print_name(mem, &nref);
+ break;
+ default:
+ dprintf2("<packed_%d?>0x%x", *pref >> r_packed_type_shift, elt);
}
}
void
debug_print_ref_packed(const gs_memory_t *mem, const ref_packed *rpp)
{
if (r_is_packed(rpp))
- debug_print_packed_ref(mem, rpp);
+ debug_print_packed_ref(mem, rpp);
else
- debug_print_full_ref(mem, (const ref *)rpp);
+ debug_print_full_ref(mem, (const ref *)rpp);
dflush();
}
void
@@ -198,20 +198,20 @@ debug_dump_one_ref(const gs_memory_t *mem, const ref * p)
uint attrs = r_type_attrs(p);
uint type = r_type(p);
static const ref_attr_print_mask_t apm[] = {
- REF_ATTR_PRINT_MASKS,
- {0, 0, 0}
+ REF_ATTR_PRINT_MASKS,
+ {0, 0, 0}
};
const ref_attr_print_mask_t *ap = apm;
if (type >= tx_next_index)
- dprintf1("0x%02x?? ", type);
+ dprintf1("0x%02x?? ", type);
else if (type >= t_next_index)
- dprintf("opr* ");
+ dprintf("opr* ");
else
- dprintf1("%s ", type_strings[type]);
+ dprintf1("%s ", type_strings[type]);
for (; ap->mask; ++ap)
- if ((attrs & ap->mask) == ap->value)
- dputc(ap->print);
+ if ((attrs & ap->mask) == ap->value)
+ dputc(ap->print);
dprintf2(" 0x%04x 0x%08lx", r_size(p), *(const ulong *)&p->value);
print_ref_data(mem, p);
dflush();
@@ -225,49 +225,49 @@ print_ref_data(const gs_memory_t *mem, const ref *p)
uint plen;
if (obj_cvs(mem, p, buf, countof(buf) - 1, &plen, &pchars) >= 0 &&
- pchars == buf &&
- ((buf[plen] = 0), strcmp((char *)buf, "--nostringval--"))
- )
- dprintf1(" = %s", (char *)buf);
+ pchars == buf &&
+ ((buf[plen] = 0), strcmp((char *)buf, "--nostringval--"))
+ )
+ dprintf1(" = %s", (char *)buf);
#undef BUF_SIZE
}
/* Dump a region of memory containing refs. */
void
-debug_dump_refs(const gs_memory_t *mem, const ref * from,
- uint size, const char *msg)
+debug_dump_refs(const gs_memory_t *mem, const ref * from,
+ uint size, const char *msg)
{
const ref *p = from;
uint count = size;
if (size && msg)
- dprintf2("%s at 0x%lx:\n", msg, (ulong) from);
+ dprintf2("%s at 0x%lx:\n", msg, (ulong) from);
while (count--) {
- dprintf2("0x%lx: 0x%04x ", (ulong)p, r_type_attrs(p));
- debug_dump_one_ref(mem, p);
- dputc('\n');
- p++;
+ dprintf2("0x%lx: 0x%04x ", (ulong)p, r_type_attrs(p));
+ debug_dump_one_ref(mem, p);
+ dputc('\n');
+ p++;
}
}
/* Dump a stack. */
void
-debug_dump_stack(const gs_memory_t *mem,
- const ref_stack_t * pstack, const char *msg)
+debug_dump_stack(const gs_memory_t *mem,
+ const ref_stack_t * pstack, const char *msg)
{
uint i;
const char *m = msg;
for (i = ref_stack_count(pstack); i != 0;) {
- const ref *p = ref_stack_index(pstack, --i);
+ const ref *p = ref_stack_index(pstack, --i);
- if (m) {
- dprintf2("%s at 0x%lx:\n", m, (ulong) pstack);
- m = NULL;
- }
- dprintf2("0x%lx: 0x%02x ", (ulong)p, r_type(p));
- debug_dump_one_ref(mem, p);
- dputc('\n');
+ if (m) {
+ dprintf2("%s at 0x%lx:\n", m, (ulong) pstack);
+ m = NULL;
+ }
+ dprintf2("0x%lx: 0x%02x ", (ulong)p, r_type(p));
+ debug_dump_one_ref(mem, p);
+ dputc('\n');
}
}
@@ -280,37 +280,37 @@ debug_dump_array(const gs_memory_t *mem, const ref * array)
uint len;
switch (type) {
- default:
- dprintf2("%s at 0x%lx isn't an array.\n",
- (type < countof(type_strings) ?
- type_strings[type] : "????"),
- (ulong) array);
- return;
- case t_oparray:
- /* This isn't really an array, but we'd like to see */
- /* its contents anyway. */
- debug_dump_array(mem, array->value.const_refs);
- return;
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- ;
+ default:
+ dprintf2("%s at 0x%lx isn't an array.\n",
+ (type < countof(type_strings) ?
+ type_strings[type] : "????"),
+ (ulong) array);
+ return;
+ case t_oparray:
+ /* This isn't really an array, but we'd like to see */
+ /* its contents anyway. */
+ debug_dump_array(mem, array->value.const_refs);
+ return;
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ ;
}
/* This "packed" loop works for all array-types. */
for (len = r_size(array), pp = array->value.packed;
- len > 0;
- len--, pp = packed_next(pp)) {
- ref temp;
+ len > 0;
+ len--, pp = packed_next(pp)) {
+ ref temp;
- packed_get(mem, pp, &temp);
- if (r_is_packed(pp)) {
- dprintf2("0x%lx* 0x%04x ", (ulong)pp, (uint)*pp);
- print_ref_data(mem, &temp);
- } else {
- dprintf2("0x%lx: 0x%02x ", (ulong)pp, r_type(&temp));
- debug_dump_one_ref(mem, &temp);
- }
- dputc('\n');
+ packed_get(mem, pp, &temp);
+ if (r_is_packed(pp)) {
+ dprintf2("0x%lx* 0x%04x ", (ulong)pp, (uint)*pp);
+ print_ref_data(mem, &temp);
+ } else {
+ dprintf2("0x%lx: 0x%02x ", (ulong)pp, r_type(&temp));
+ debug_dump_one_ref(mem, &temp);
+ }
+ dputc('\n');
}
}
diff --git a/gs/psi/idebug.h b/gs/psi/idebug.h
index 340769f23..d0938e451 100644
--- a/gs/psi/idebug.h
+++ b/gs/psi/idebug.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,8 +25,8 @@ void debug_print_ref_packed(const gs_memory_t *mem, const ref_packed *);
/* Dump regions of memory. */
void debug_dump_one_ref(const gs_memory_t *mem, const ref *);
-void debug_dump_refs(const gs_memory_t *mem,
- const ref * from, uint size, const char *msg);
+void debug_dump_refs(const gs_memory_t *mem,
+ const ref * from, uint size, const char *msg);
void debug_dump_array(const gs_memory_t *mem, const ref * array);
/* Dump a stack. Using this requires istack.h. */
@@ -34,7 +34,7 @@ void debug_dump_array(const gs_memory_t *mem, const ref * array);
typedef struct ref_stack_s ref_stack_t; /* also defined in isdata.h */
# define ref_stack_DEFINED
#endif
-void debug_dump_stack(const gs_memory_t *mem,
- const ref_stack_t * pstack, const char *msg);
+void debug_dump_stack(const gs_memory_t *mem,
+ const ref_stack_t * pstack, const char *msg);
#endif /* idebug_INCLUDED */
diff --git a/gs/psi/idict.c b/gs/psi/idict.c
index 85605cce1..fb1014f5a 100644
--- a/gs/psi/idict.c
+++ b/gs/psi/idict.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -90,23 +90,23 @@ dict_find(const ref * pdref, const ref * pkey, ref ** ppvalue)
stats_dict.lookups++;
if (r_has_type(pkey, t_name) && dict_is_packed(pdict)) {
- uint nidx = name_index(dict_mem(pdict), pkey);
- uint hash =
- dict_hash_mod(dict_name_index_hash(nidx), npairs(pdict)) + 1;
-
- if (pdict->keys.value.packed[hash] ==
- pt_tag(pt_literal_name) + nidx
- )
- stats_dict.probe1++;
- else if (pdict->keys.value.packed[hash - 1] ==
- pt_tag(pt_literal_name) + nidx
- )
- stats_dict.probe2++;
+ uint nidx = name_index(dict_mem(pdict), pkey);
+ uint hash =
+ dict_hash_mod(dict_name_index_hash(nidx), npairs(pdict)) + 1;
+
+ if (pdict->keys.value.packed[hash] ==
+ pt_tag(pt_literal_name) + nidx
+ )
+ stats_dict.probe1++;
+ else if (pdict->keys.value.packed[hash - 1] ==
+ pt_tag(pt_literal_name) + nidx
+ )
+ stats_dict.probe2++;
}
/* Do the cheap flag test before the expensive remainder test. */
if (gs_debug_c('d') && !(stats_dict.lookups % 1000))
- dlprintf3("[d]lookups=%ld probe1=%ld probe2=%ld\n",
- stats_dict.lookups, stats_dict.probe1, stats_dict.probe2);
+ dlprintf3("[d]lookups=%ld probe1=%ld probe2=%ld\n",
+ stats_dict.lookups, stats_dict.probe1, stats_dict.probe2);
return code;
}
#define dict_find real_dict_find
@@ -124,9 +124,9 @@ dict_round_size_large(uint rsize)
/* If the addition overflows, the new rsize will be zero, */
/* which will (correctly) be interpreted as a limitcheck. */
if (rsize > dict_max_non_huge)
- return (rsize > dict_max_size ? 0 : rsize);
+ return (rsize > dict_max_size ? 0 : rsize);
while (rsize & (rsize - 1))
- rsize = (rsize | (rsize - 1)) + 1;
+ rsize = (rsize | (rsize - 1)) + 1;
return (rsize <= dict_max_size ? rsize : dict_max_non_huge);
}
@@ -136,22 +136,22 @@ dict_alloc(gs_ref_memory_t * mem, uint size, ref * pdref)
{
ref arr;
int code =
- gs_alloc_ref_array(mem, &arr, a_all, sizeof(dict) / sizeof(ref),
- "dict_alloc");
+ gs_alloc_ref_array(mem, &arr, a_all, sizeof(dict) / sizeof(ref),
+ "dict_alloc");
dict *pdict;
ref dref;
if (code < 0)
- return code;
+ return code;
pdict = (dict *) arr.value.refs;
make_tav(&dref, t_dictionary,
- r_space(&arr) | imemory_new_mask(mem) | a_all,
- pdict, pdict);
+ r_space(&arr) | imemory_new_mask(mem) | a_all,
+ pdict, pdict);
make_struct(&pdict->memory, avm_foreign, mem);
code = dict_create_contents(size, &dref, dict_default_pack);
if (code < 0) {
- gs_free_ref_array(mem, &arr, "dict_alloc");
- return code;
+ gs_free_ref_array(mem, &arr, "dict_alloc");
+ return code;
}
*pdref = dref;
return 0;
@@ -166,14 +166,14 @@ dict_create_unpacked_keys(uint asize, const ref * pdref)
int code;
code = gs_alloc_ref_array(mem, &pdict->keys, a_all, asize,
- "dict_create_unpacked_keys");
+ "dict_create_unpacked_keys");
if (code >= 0) {
- uint new_mask = imemory_new_mask(mem);
- ref *kp = pdict->keys.value.refs;
+ uint new_mask = imemory_new_mask(mem);
+ ref *kp = pdict->keys.value.refs;
- r_set_attrs(&pdict->keys, new_mask);
- refset_null_new(kp, asize, new_mask);
- r_set_attrs(kp, a_executable); /* wraparound entry */
+ r_set_attrs(&pdict->keys, new_mask);
+ refset_null_new(kp, asize, new_mask);
+ r_set_attrs(kp, a_executable); /* wraparound entry */
}
return code;
}
@@ -191,36 +191,36 @@ dict_create_contents(uint size, const ref * pdref, bool pack)
register uint i;
if (asize == 0 || asize > max_array_size - 1) /* too large */
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
asize++; /* allow room for wraparound entry */
code = gs_alloc_ref_array(mem, &pdict->values, a_all, asize,
- "dict_create_contents(values)");
+ "dict_create_contents(values)");
if (code < 0)
- return code;
+ return code;
r_set_attrs(&pdict->values, new_mask);
refset_null_new(pdict->values.value.refs, asize, new_mask);
if (pack) {
- uint ksize = (asize + packed_per_ref - 1) / packed_per_ref;
- ref arr;
- ref_packed *pkp;
- ref_packed *pzp;
-
- code = gs_alloc_ref_array(mem, &arr, a_all, ksize,
- "dict_create_contents(packed keys)");
- if (code < 0)
- return code;
- pkp = (ref_packed *) arr.value.refs;
- make_tasv(&pdict->keys, t_shortarray,
- r_space(&arr) | a_all | new_mask,
- asize, packed, pkp);
- for (pzp = pkp, i = 0; i < asize || i % packed_per_ref; pzp++, i++)
- *pzp = packed_key_empty;
- *pkp = packed_key_deleted; /* wraparound entry */
+ uint ksize = (asize + packed_per_ref - 1) / packed_per_ref;
+ ref arr;
+ ref_packed *pkp;
+ ref_packed *pzp;
+
+ code = gs_alloc_ref_array(mem, &arr, a_all, ksize,
+ "dict_create_contents(packed keys)");
+ if (code < 0)
+ return code;
+ pkp = (ref_packed *) arr.value.refs;
+ make_tasv(&pdict->keys, t_shortarray,
+ r_space(&arr) | a_all | new_mask,
+ asize, packed, pkp);
+ for (pzp = pkp, i = 0; i < asize || i % packed_per_ref; pzp++, i++)
+ *pzp = packed_key_empty;
+ *pkp = packed_key_deleted; /* wraparound entry */
} else { /* not packed */
- int code = dict_create_unpacked_keys(asize, pdref);
+ int code = dict_create_unpacked_keys(asize, pdref);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
make_tav(&pdict->count, t_integer, new_mask, intval, 0);
make_tav(&pdict->maxlength, t_integer, new_mask, intval, size);
@@ -237,31 +237,31 @@ dict_unpack(ref * pdref, dict_stack_t *pds)
dict *pdict = pdref->value.pdict;
if (!dict_is_packed(pdict))
- return 0; /* nothing to do */
+ return 0; /* nothing to do */
{
- gs_ref_memory_t *mem = dict_memory(pdict);
- uint count = nslots(pdict);
- const ref_packed *okp = pdict->keys.value.packed;
- ref old_keys;
- int code;
- ref *nkp;
-
- old_keys = pdict->keys;
- if (ref_must_save_in(mem, &old_keys))
- ref_do_save_in(mem, pdref, &pdict->keys, "dict_unpack(keys)");
- code = dict_create_unpacked_keys(count, pdref);
- if (code < 0)
- return code;
- for (nkp = pdict->keys.value.refs; count--; okp++, nkp++)
- if (r_packed_is_name(okp)) {
- packed_get((const gs_memory_t *)mem, okp, nkp);
- ref_mark_new_in(mem, nkp);
- } else if (*okp == packed_key_deleted)
- r_set_attrs(nkp, a_executable);
- if (!ref_must_save_in(mem, &old_keys))
- gs_free_ref_array(mem, &old_keys, "dict_unpack(old keys)");
- if (pds)
- dstack_set_top(pds); /* just in case */
+ gs_ref_memory_t *mem = dict_memory(pdict);
+ uint count = nslots(pdict);
+ const ref_packed *okp = pdict->keys.value.packed;
+ ref old_keys;
+ int code;
+ ref *nkp;
+
+ old_keys = pdict->keys;
+ if (ref_must_save_in(mem, &old_keys))
+ ref_do_save_in(mem, pdref, &pdict->keys, "dict_unpack(keys)");
+ code = dict_create_unpacked_keys(count, pdref);
+ if (code < 0)
+ return code;
+ for (nkp = pdict->keys.value.refs; count--; okp++, nkp++)
+ if (r_packed_is_name(okp)) {
+ packed_get((const gs_memory_t *)mem, okp, nkp);
+ ref_mark_new_in(mem, nkp);
+ } else if (*okp == packed_key_deleted)
+ r_set_attrs(nkp, a_executable);
+ if (!ref_must_save_in(mem, &old_keys))
+ gs_free_ref_array(mem, &old_keys, "dict_unpack(old keys)");
+ if (pds)
+ dstack_set_top(pds); /* just in case */
}
return 0;
}
@@ -273,7 +273,7 @@ dict_unpack(ref * pdref, dict_stack_t *pds)
*/
int
dict_find(const ref * pdref, const ref * pkey,
- ref ** ppvalue /* result is stored here */ )
+ ref ** ppvalue /* result is stored here */ )
{
dict *pdict = pdref->value.pdict;
uint size = npairs(pdict);
@@ -288,62 +288,62 @@ dict_find(const ref * pdref, const ref * pkey,
/* names, and (unlikely, but worth checking for) integers. */
switch (r_type(pkey)) {
case t_name:
- nidx = name_index(mem, pkey);
+ nidx = name_index(mem, pkey);
nh:
- hash = dict_name_index_hash(nidx);
- kpack = packed_name_key(nidx);
- ktype = t_name;
- break;
+ hash = dict_name_index_hash(nidx);
+ kpack = packed_name_key(nidx);
+ ktype = t_name;
+ break;
case t_string: /* convert to a name first */
- {
- ref nref;
- int code;
-
- if (!r_has_attr(pkey, a_read))
- return_error(e_invalidaccess);
- code = name_ref(mem, pkey->value.bytes, r_size(pkey), &nref, 1);
- if (code < 0)
- return code;
- nidx = name_index(mem, &nref);
- }
- goto nh;
+ {
+ ref nref;
+ int code;
+
+ if (!r_has_attr(pkey, a_read))
+ return_error(e_invalidaccess);
+ code = name_ref(mem, pkey->value.bytes, r_size(pkey), &nref, 1);
+ if (code < 0)
+ return code;
+ nidx = name_index(mem, &nref);
+ }
+ goto nh;
case t_real:
- /*
- * Make sure that equal reals and integers hash the same.
- */
- {
- int expt, i;
- double mant = frexp(pkey->value.realval, &expt);
- /*
- * The value is mant * 2^expt, where 0.5 <= mant < 1,
- * or else expt == mant == 0.
- */
-
- if (expt < sizeof(long) * 8 || pkey->value.realval == min_long)
- i = (int)pkey->value.realval;
- else
- i = (int)(mant * min_long); /* MSVC 6.00.8168.0 cannot compile this */
- hash = (uint)i * 30503; /* with -O2 as a single expression */
- }
- goto ih;
+ /*
+ * Make sure that equal reals and integers hash the same.
+ */
+ {
+ int expt, i;
+ double mant = frexp(pkey->value.realval, &expt);
+ /*
+ * The value is mant * 2^expt, where 0.5 <= mant < 1,
+ * or else expt == mant == 0.
+ */
+
+ if (expt < sizeof(long) * 8 || pkey->value.realval == min_long)
+ i = (int)pkey->value.realval;
+ else
+ i = (int)(mant * min_long); /* MSVC 6.00.8168.0 cannot compile this */
+ hash = (uint)i * 30503; /* with -O2 as a single expression */
+ }
+ goto ih;
case t_integer:
- hash = (uint)pkey->value.intval * 30503;
+ hash = (uint)pkey->value.intval * 30503;
ih:
- kpack = packed_key_impossible;
- ktype = -1;
- nidx = 0; /* only to pacify gcc */
- break;
+ kpack = packed_key_impossible;
+ ktype = -1;
+ nidx = 0; /* only to pacify gcc */
+ break;
case t_null: /* not allowed as a key */
- return_error(e_typecheck);
+ return_error(e_typecheck);
default:
- hash = r_btype(pkey) * 99; /* yech */
- kpack = packed_key_impossible;
- ktype = -1;
- nidx = 0; /* only to pacify gcc */
+ hash = r_btype(pkey) * 99; /* yech */
+ kpack = packed_key_impossible;
+ ktype = -1;
+ nidx = 0; /* only to pacify gcc */
}
/* Search the dictionary */
if (dict_is_packed(pdict)) {
- const ref_packed *pslot = 0;
+ const ref_packed *pslot = 0;
# define found *ppvalue = packed_search_value_pointer; return 1
# define deleted if (pslot == 0) pslot = kp
@@ -352,61 +352,61 @@ dict_find(const ref * pdref, const ref * pkey,
# undef missing
# undef deleted
# undef found
- /*
- * Double wraparound, dict is full.
- * Note that even if there was an empty slot (pslot != 0),
- * we must return dictfull if length = maxlength.
- */
- if (pslot == 0 || d_length(pdict) == d_maxlength(pdict))
- return_error(e_dictfull);
- *ppvalue = pdict->values.value.refs + (pslot - kbot);
- return 0;
+ /*
+ * Double wraparound, dict is full.
+ * Note that even if there was an empty slot (pslot != 0),
+ * we must return dictfull if length = maxlength.
+ */
+ if (pslot == 0 || d_length(pdict) == d_maxlength(pdict))
+ return_error(e_dictfull);
+ *ppvalue = pdict->values.value.refs + (pslot - kbot);
+ return 0;
miss: /* Key is missing, not double wrap. See above re dictfull. */
- if (d_length(pdict) == d_maxlength(pdict))
- return_error(e_dictfull);
- if (pslot == 0)
- pslot = kp;
- *ppvalue = pdict->values.value.refs + (pslot - kbot);
- return 0;
+ if (d_length(pdict) == d_maxlength(pdict))
+ return_error(e_dictfull);
+ if (pslot == 0)
+ pslot = kp;
+ *ppvalue = pdict->values.value.refs + (pslot - kbot);
+ return 0;
} else {
- ref *kbot = pdict->keys.value.refs;
- register ref *kp;
- ref *pslot = 0;
- int wrap = 0;
-
- for (kp = kbot + dict_hash_mod(hash, size) + 2;;) {
- --kp;
- if ((etype = r_type(kp)) == ktype) { /* Fast comparison if both keys are names */
- if (name_index(mem, kp) == nidx) {
- *ppvalue = pdict->values.value.refs + (kp - kbot);
- return 1;
- }
- } else if (etype == t_null) { /* Empty, deleted, or wraparound. */
- /* Figure out which. */
- if (kp == kbot) { /* wrap */
- if (wrap++) { /* wrapped twice */
- if (pslot == 0)
- return_error(e_dictfull);
- break;
- }
- kp += size + 1;
- } else if (r_has_attr(kp, a_executable)) { /* Deleted entry, save the slot. */
- if (pslot == 0)
- pslot = kp;
- } else /* key not found */
- break;
- } else {
- if (obj_eq(mem, kp, pkey)) {
- *ppvalue = pdict->values.value.refs + (kp - kbot);
- return 1;
- }
- }
- }
- if (d_length(pdict) == d_maxlength(pdict))
- return_error(e_dictfull);
- *ppvalue = pdict->values.value.refs +
- ((pslot != 0 ? pslot : kp) - kbot);
- return 0;
+ ref *kbot = pdict->keys.value.refs;
+ register ref *kp;
+ ref *pslot = 0;
+ int wrap = 0;
+
+ for (kp = kbot + dict_hash_mod(hash, size) + 2;;) {
+ --kp;
+ if ((etype = r_type(kp)) == ktype) { /* Fast comparison if both keys are names */
+ if (name_index(mem, kp) == nidx) {
+ *ppvalue = pdict->values.value.refs + (kp - kbot);
+ return 1;
+ }
+ } else if (etype == t_null) { /* Empty, deleted, or wraparound. */
+ /* Figure out which. */
+ if (kp == kbot) { /* wrap */
+ if (wrap++) { /* wrapped twice */
+ if (pslot == 0)
+ return_error(e_dictfull);
+ break;
+ }
+ kp += size + 1;
+ } else if (r_has_attr(kp, a_executable)) { /* Deleted entry, save the slot. */
+ if (pslot == 0)
+ pslot = kp;
+ } else /* key not found */
+ break;
+ } else {
+ if (obj_eq(mem, kp, pkey)) {
+ *ppvalue = pdict->values.value.refs + (kp - kbot);
+ return 1;
+ }
+ }
+ }
+ if (d_length(pdict) == d_maxlength(pdict))
+ return_error(e_dictfull);
+ *ppvalue = pdict->values.value.refs +
+ ((pslot != 0 ? pslot : kp) - kbot);
+ return 0;
}
}
@@ -420,12 +420,12 @@ dict_find_string(const ref * pdref, const char *kstr, ref ** ppvalue)
int code;
ref kname;
if ( pdref != 0 ) {
- dict *pdict = pdref->value.pdict;
+ dict *pdict = pdref->value.pdict;
- if ((code = name_ref(dict_mem(pdict),
- (const byte *)kstr, strlen(kstr), &kname, -1)) < 0)
- return code;
- code = dict_find(pdref, &kname, ppvalue);
+ if ((code = name_ref(dict_mem(pdict),
+ (const byte *)kstr, strlen(kstr), &kname, -1)) < 0)
+ return code;
+ code = dict_find(pdref, &kname, ppvalue);
if (code == e_dictfull)
return_error(e_undefined);
return code;
@@ -439,7 +439,7 @@ dict_find_string(const ref * pdref, const char *kstr, ref ** ppvalue)
*/
int
dict_put(ref * pdref /* t_dictionary */ , const ref * pkey, const ref * pvalue,
- dict_stack_t *pds)
+ dict_stack_t *pds)
{
dict *pdict = pdref->value.pdict;
gs_ref_memory_t *mem = dict_memory(pdict);
@@ -451,87 +451,87 @@ dict_put(ref * pdref /* t_dictionary */ , const ref * pkey, const ref * pvalue,
/* Check the value. */
store_check_dest(pdref, pvalue);
top:if ((code = dict_find(pdref, pkey, &pvslot)) <= 0) { /* not found *//* Check for overflow */
- uint index;
-
- switch (code) {
- case 0:
- break;
- case e_dictfull:
- if (!pmem->gs_lib_ctx->dict_auto_expand)
- return_error(e_dictfull);
- code = dict_grow(pdref, pds);
- if (code < 0)
- return code;
- goto top; /* keep things simple */
- default: /* e_typecheck */
- return code;
- }
- index = pvslot - pdict->values.value.refs;
- /* If the key is a string, convert it to a name. */
- if (r_has_type(pkey, t_string)) {
- int code;
-
- if (!r_has_attr(pkey, a_read))
- return_error(e_invalidaccess);
- code = name_from_string(pmem, pkey, &kname);
- if (code < 0)
- return code;
- pkey = &kname;
- }
- if (dict_is_packed(pdict)) {
- ref_packed *kp;
-
- if (!r_has_type(pkey, t_name) ||
- name_index(pmem, pkey) > packed_name_max_index
- ) { /* Change to unpacked representation. */
- int code = dict_unpack(pdref, pds);
-
- if (code < 0)
- return code;
- goto top;
- }
- kp = pdict->keys.value.writable_packed + index;
- if (ref_must_save_in(mem, &pdict->keys)) { /* See initial comment for why it is safe */
- /* not to save the change if the keys */
- /* array itself is new. */
- ref_do_save_in(mem, &pdict->keys, kp, "dict_put(key)");
- }
- *kp = pt_tag(pt_literal_name) + name_index(pmem, pkey);
- } else {
- ref *kp = pdict->keys.value.refs + index;
-
- if_debug2('d', "[d]0x%lx: fill key at 0x%lx\n",
- (ulong) pdict, (ulong) kp);
- store_check_dest(pdref, pkey);
- ref_assign_old_in(mem, &pdict->keys, kp, pkey,
- "dict_put(key)"); /* set key of pair */
- }
- ref_save_in(mem, pdref, &pdict->count, "dict_put(count)");
- pdict->count.value.intval++;
- /* If the key is a name, update its 1-element cache. */
- if (r_has_type(pkey, t_name)) {
- name *pname = pkey->value.pname;
-
- if (pname->pvalue == pv_no_defn &&
- CAN_SET_PVALUE_CACHE(pds, pdref, mem)
- ) { /* Set the cache. */
- if_debug0('d', "[d]set cache\n");
- pname->pvalue = pvslot;
- } else { /* The cache can't be used. */
- if_debug0('d', "[d]no cache\n");
- pname->pvalue = pv_other;
- }
- }
- rcode = 1;
+ uint index;
+
+ switch (code) {
+ case 0:
+ break;
+ case e_dictfull:
+ if (!pmem->gs_lib_ctx->dict_auto_expand)
+ return_error(e_dictfull);
+ code = dict_grow(pdref, pds);
+ if (code < 0)
+ return code;
+ goto top; /* keep things simple */
+ default: /* e_typecheck */
+ return code;
+ }
+ index = pvslot - pdict->values.value.refs;
+ /* If the key is a string, convert it to a name. */
+ if (r_has_type(pkey, t_string)) {
+ int code;
+
+ if (!r_has_attr(pkey, a_read))
+ return_error(e_invalidaccess);
+ code = name_from_string(pmem, pkey, &kname);
+ if (code < 0)
+ return code;
+ pkey = &kname;
+ }
+ if (dict_is_packed(pdict)) {
+ ref_packed *kp;
+
+ if (!r_has_type(pkey, t_name) ||
+ name_index(pmem, pkey) > packed_name_max_index
+ ) { /* Change to unpacked representation. */
+ int code = dict_unpack(pdref, pds);
+
+ if (code < 0)
+ return code;
+ goto top;
+ }
+ kp = pdict->keys.value.writable_packed + index;
+ if (ref_must_save_in(mem, &pdict->keys)) { /* See initial comment for why it is safe */
+ /* not to save the change if the keys */
+ /* array itself is new. */
+ ref_do_save_in(mem, &pdict->keys, kp, "dict_put(key)");
+ }
+ *kp = pt_tag(pt_literal_name) + name_index(pmem, pkey);
+ } else {
+ ref *kp = pdict->keys.value.refs + index;
+
+ if_debug2('d', "[d]0x%lx: fill key at 0x%lx\n",
+ (ulong) pdict, (ulong) kp);
+ store_check_dest(pdref, pkey);
+ ref_assign_old_in(mem, &pdict->keys, kp, pkey,
+ "dict_put(key)"); /* set key of pair */
+ }
+ ref_save_in(mem, pdref, &pdict->count, "dict_put(count)");
+ pdict->count.value.intval++;
+ /* If the key is a name, update its 1-element cache. */
+ if (r_has_type(pkey, t_name)) {
+ name *pname = pkey->value.pname;
+
+ if (pname->pvalue == pv_no_defn &&
+ CAN_SET_PVALUE_CACHE(pds, pdref, mem)
+ ) { /* Set the cache. */
+ if_debug0('d', "[d]set cache\n");
+ pname->pvalue = pvslot;
+ } else { /* The cache can't be used. */
+ if_debug0('d', "[d]no cache\n");
+ pname->pvalue = pv_other;
+ }
+ }
+ rcode = 1;
}
if_debug8('d', "[d]0x%lx: put key 0x%lx 0x%lx\n value at 0x%lx: old 0x%lx 0x%lx, new 0x%lx 0x%lx\n",
- (ulong) pdref->value.pdict,
- ((const ulong *)pkey)[0], ((const ulong *)pkey)[1],
- (ulong) pvslot,
- ((const ulong *)pvslot)[0], ((const ulong *)pvslot)[1],
- ((const ulong *)pvalue)[0], ((const ulong *)pvalue)[1]);
+ (ulong) pdref->value.pdict,
+ ((const ulong *)pkey)[0], ((const ulong *)pkey)[1],
+ (ulong) pvslot,
+ ((const ulong *)pvslot)[0], ((const ulong *)pvslot)[1],
+ ((const ulong *)pvalue)[0], ((const ulong *)pvalue)[1]);
ref_assign_old_in(mem, &pdref->value.pdict->values, pvslot, pvalue,
- "dict_put(value)");
+ "dict_put(value)");
return rcode;
}
@@ -540,15 +540,15 @@ dict_put(ref * pdref /* t_dictionary */ , const ref * pkey, const ref * pvalue,
*/
int
dict_put_string(ref * pdref, const char *kstr, const ref * pvalue,
- dict_stack_t *pds)
+ dict_stack_t *pds)
{
int code;
ref kname;
dict *pdict = pdref->value.pdict;
if ((code = name_ref(dict_mem(pdict),
- (const byte *)kstr, strlen(kstr), &kname, 0)) < 0)
- return code;
+ (const byte *)kstr, strlen(kstr), &kname, 0)) < 0)
+ return code;
return dict_put(pdref, &kname, pvalue, pds);
}
@@ -565,84 +565,84 @@ dict_undef(ref * pdref, const ref * pkey, dict_stack_t *pds)
switch (code) {
case 0:
case e_dictfull:
- return_error(e_undefined);
+ return_error(e_undefined);
case 1:
- break;
+ break;
default: /* other error */
- return code;
+ return code;
}
/* Remove the entry from the dictionary. */
pdict = pdref->value.pdict;
index = pvslot - pdict->values.value.refs;
mem = dict_memory(pdict);
if (dict_is_packed(pdict)) {
- ref_packed *pkp = pdict->keys.value.writable_packed + index;
- bool must_save = ref_must_save_in(mem, &pdict->keys);
-
- if_debug3('d', "[d]0x%lx: removing key at 0%lx: 0x%x\n",
- (ulong)pdict, (ulong)pkp, (uint)*pkp);
- /* See the initial comment for why it is safe not to save */
- /* the change if the keys array itself is new. */
- if (must_save)
- ref_do_save_in(mem, &pdict->keys, pkp, "dict_undef(key)");
- /*
- * Accumulating deleted entries slows down lookup.
- * Detect the easy case where we can use an empty entry
- * rather than a deleted one, namely, when the next entry
- * in the probe order is empty.
- */
- if (pkp[-1] == packed_key_empty) {
- /*
- * In this case we can replace any preceding deleted keys with
- * empty ones as well.
- */
- uint end = nslots(pdict);
-
- *pkp = packed_key_empty;
- if (must_save) {
- while (++index < end && *++pkp == packed_key_deleted) {
- ref_do_save_in(mem, &pdict->keys, pkp, "dict_undef(key)");
- *pkp = packed_key_empty;
- }
- } else {
- while (++index < end && *++pkp == packed_key_deleted)
- *pkp = packed_key_empty;
- }
- } else
- *pkp = packed_key_deleted;
+ ref_packed *pkp = pdict->keys.value.writable_packed + index;
+ bool must_save = ref_must_save_in(mem, &pdict->keys);
+
+ if_debug3('d', "[d]0x%lx: removing key at 0%lx: 0x%x\n",
+ (ulong)pdict, (ulong)pkp, (uint)*pkp);
+ /* See the initial comment for why it is safe not to save */
+ /* the change if the keys array itself is new. */
+ if (must_save)
+ ref_do_save_in(mem, &pdict->keys, pkp, "dict_undef(key)");
+ /*
+ * Accumulating deleted entries slows down lookup.
+ * Detect the easy case where we can use an empty entry
+ * rather than a deleted one, namely, when the next entry
+ * in the probe order is empty.
+ */
+ if (pkp[-1] == packed_key_empty) {
+ /*
+ * In this case we can replace any preceding deleted keys with
+ * empty ones as well.
+ */
+ uint end = nslots(pdict);
+
+ *pkp = packed_key_empty;
+ if (must_save) {
+ while (++index < end && *++pkp == packed_key_deleted) {
+ ref_do_save_in(mem, &pdict->keys, pkp, "dict_undef(key)");
+ *pkp = packed_key_empty;
+ }
+ } else {
+ while (++index < end && *++pkp == packed_key_deleted)
+ *pkp = packed_key_empty;
+ }
+ } else
+ *pkp = packed_key_deleted;
} else { /* not packed */
- ref *kp = pdict->keys.value.refs + index;
-
- if_debug4('d', "[d]0x%lx: removing key at 0%lx: 0x%lx 0x%lx\n",
- (ulong)pdict, (ulong)kp, ((ulong *)kp)[0], ((ulong *)kp)[1]);
- make_null_old_in(mem, &pdict->keys, kp, "dict_undef(key)");
- /*
- * Accumulating deleted entries slows down lookup.
- * Detect the easy case where we can use an empty entry
- * rather than a deleted one, namely, when the next entry
- * in the probe order is empty.
- */
- if (!r_has_type(kp - 1, t_null) || /* full entry */
- r_has_attr(kp - 1, a_executable) /* deleted or wraparound */
- )
- r_set_attrs(kp, a_executable); /* mark as deleted */
+ ref *kp = pdict->keys.value.refs + index;
+
+ if_debug4('d', "[d]0x%lx: removing key at 0%lx: 0x%lx 0x%lx\n",
+ (ulong)pdict, (ulong)kp, ((ulong *)kp)[0], ((ulong *)kp)[1]);
+ make_null_old_in(mem, &pdict->keys, kp, "dict_undef(key)");
+ /*
+ * Accumulating deleted entries slows down lookup.
+ * Detect the easy case where we can use an empty entry
+ * rather than a deleted one, namely, when the next entry
+ * in the probe order is empty.
+ */
+ if (!r_has_type(kp - 1, t_null) || /* full entry */
+ r_has_attr(kp - 1, a_executable) /* deleted or wraparound */
+ )
+ r_set_attrs(kp, a_executable); /* mark as deleted */
}
ref_save_in(mem, pdref, &pdict->count, "dict_undef(count)");
pdict->count.value.intval--;
/* If the key is a name, update its 1-element cache. */
if (r_has_type(pkey, t_name)) {
- name *pname = pkey->value.pname;
+ name *pname = pkey->value.pname;
- if (pv_valid(pname->pvalue)) {
+ if (pv_valid(pname->pvalue)) {
#ifdef DEBUG
- /* Check the the cache is correct. */
- if (!(pds && dstack_dict_is_permanent(pds, pdref)))
- lprintf1("dict_undef: cached name value pointer 0x%lx is incorrect!\n",
- (ulong) pname->pvalue);
+ /* Check the the cache is correct. */
+ if (!(pds && dstack_dict_is_permanent(pds, pdref)))
+ lprintf1("dict_undef: cached name value pointer 0x%lx is incorrect!\n",
+ (ulong) pname->pvalue);
#endif
- /* Clear the cache */
- pname->pvalue = pv_no_defn;
- }
+ /* Clear the cache */
+ pname->pvalue = pv_no_defn;
+ }
}
make_null_old_in(mem, &pdict->values, pvslot, "dict_undef(value)");
return 0;
@@ -680,8 +680,8 @@ dict_max_index(const ref * pdref /* t_dictionary */ )
#define COPY_FOR_RESIZE 2
static int
dict_copy_elements(const ref * pdrfrom /* t_dictionary */ ,
- ref * pdrto /* t_dictionary */ , int options,
- dict_stack_t *pds)
+ ref * pdrto /* t_dictionary */ , int options,
+ dict_stack_t *pds)
{
int space = r_space(pdrto);
int index;
@@ -690,48 +690,48 @@ dict_copy_elements(const ref * pdrfrom /* t_dictionary */ ,
int code;
if (space != avm_max) {
- /* Do the store check before starting the copy. */
- index = dict_first(pdrfrom);
- while ((index = dict_next(pdrfrom, index, elt)) >= 0)
- if (!(options & COPY_NEW_ONLY) ||
- dict_find(pdrto, &elt[0], &pvslot) <= 0
- ) {
- store_check_space(space, &elt[0]);
- store_check_space(space, &elt[1]);
- }
+ /* Do the store check before starting the copy. */
+ index = dict_first(pdrfrom);
+ while ((index = dict_next(pdrfrom, index, elt)) >= 0)
+ if (!(options & COPY_NEW_ONLY) ||
+ dict_find(pdrto, &elt[0], &pvslot) <= 0
+ ) {
+ store_check_space(space, &elt[0]);
+ store_check_space(space, &elt[1]);
+ }
}
/* Now copy the contents. */
index = dict_first(pdrfrom);
while ((index = dict_next(pdrfrom, index, elt)) >= 0) {
- ref *pvalue = pv_no_defn;
-
- if ((options & COPY_NEW_ONLY) &&
- dict_find(pdrto, &elt[0], &pvslot) > 0
- )
- continue;
- if ((options & COPY_FOR_RESIZE) &&
- r_has_type(&elt[0], t_name) &&
- (pvalue = elt[0].value.pname->pvalue, pv_valid(pvalue))
- )
- elt[0].value.pname->pvalue = pv_no_defn;
- if ((code = dict_put(pdrto, &elt[0], &elt[1], pds)) < 0) {
- /*
- * If COPY_FOR_RESIZE is set, the dict_put isn't supposed to
- * be able to fail, but we don't want to depend on this.
- */
- if (pvalue != pv_no_defn)
- elt[0].value.pname->pvalue = pvalue;
- return code;
- }
+ ref *pvalue = pv_no_defn;
+
+ if ((options & COPY_NEW_ONLY) &&
+ dict_find(pdrto, &elt[0], &pvslot) > 0
+ )
+ continue;
+ if ((options & COPY_FOR_RESIZE) &&
+ r_has_type(&elt[0], t_name) &&
+ (pvalue = elt[0].value.pname->pvalue, pv_valid(pvalue))
+ )
+ elt[0].value.pname->pvalue = pv_no_defn;
+ if ((code = dict_put(pdrto, &elt[0], &elt[1], pds)) < 0) {
+ /*
+ * If COPY_FOR_RESIZE is set, the dict_put isn't supposed to
+ * be able to fail, but we don't want to depend on this.
+ */
+ if (pvalue != pv_no_defn)
+ elt[0].value.pname->pvalue = pvalue;
+ return code;
+ }
}
return 0;
}
int
dict_copy_entries(const ref *pdrfrom, ref *pdrto, bool new_only,
- dict_stack_t *pds)
+ dict_stack_t *pds)
{
return dict_copy_elements(pdrfrom, pdrto, (new_only ? COPY_NEW_ONLY : 0),
- pds);
+ pds);
}
/* Resize a dictionary. */
@@ -747,15 +747,15 @@ dict_resize(ref * pdref, uint new_size, dict_stack_t *pds)
int code;
if (new_size < d_length(pdict)) {
- if (!mem->gs_lib_ctx->dict_auto_expand)
- return_error(e_dictfull);
- new_size = d_length(pdict);
+ if (!mem->gs_lib_ctx->dict_auto_expand)
+ return_error(e_dictfull);
+ new_size = d_length(pdict);
}
make_tav(&drto, t_dictionary, r_space(pdref) | a_all | new_mask,
- pdict, &dnew);
+ pdict, &dnew);
dnew.memory = pdict->memory;
if ((code = dict_create_contents(new_size, &drto, dict_is_packed(pdict))) < 0)
- return code;
+ return code;
/*
* We must suppress the store check, in case we are expanding
* systemdict or another global dictionary that is allowed
@@ -771,32 +771,32 @@ dict_resize(ref * pdref, uint new_size, dict_stack_t *pds)
* setting *pdref = drto.
*/
if (CAN_SET_PVALUE_CACHE(pds, pdref, mem)) {
- ref drfrom;
+ ref drfrom;
- drfrom = *pdref;
- *pdref = drto;
- dict_copy_elements(&drfrom, pdref, COPY_FOR_RESIZE, pds);
- *pdref = drfrom;
+ drfrom = *pdref;
+ *pdref = drto;
+ dict_copy_elements(&drfrom, pdref, COPY_FOR_RESIZE, pds);
+ *pdref = drfrom;
} else {
- dict_copy_elements(pdref, &drto, 0, pds);
+ dict_copy_elements(pdref, &drto, 0, pds);
}
/* Save or free the old dictionary. */
if (ref_must_save_in(mem, &pdict->values))
- ref_do_save_in(mem, pdref, &pdict->values, "dict_resize(values)");
+ ref_do_save_in(mem, pdref, &pdict->values, "dict_resize(values)");
else
- gs_free_ref_array(mem, &pdict->values, "dict_resize(old values)");
+ gs_free_ref_array(mem, &pdict->values, "dict_resize(old values)");
if (ref_must_save_in(mem, &pdict->keys))
- ref_do_save_in(mem, pdref, &pdict->keys, "dict_resize(keys)");
+ ref_do_save_in(mem, pdref, &pdict->keys, "dict_resize(keys)");
else
- gs_free_ref_array(mem, &pdict->keys, "dict_resize(old keys)");
+ gs_free_ref_array(mem, &pdict->keys, "dict_resize(old keys)");
ref_assign(&pdict->keys, &dnew.keys);
ref_assign(&pdict->values, &dnew.values);
r_store_attrs(&pdict->values, a_all | a_executable, orig_attrs);
ref_save_in(dict_memory(pdict), pdref, &pdict->maxlength,
- "dict_resize(maxlength)");
+ "dict_resize(maxlength)");
d_set_maxlength(pdict, new_size);
if (pds)
- dstack_set_top(pds); /* just in case this is the top dict */
+ dstack_set_top(pds); /* just in case this is the top dict */
return 0;
}
@@ -809,7 +809,7 @@ dict_grow(ref * pdref, dict_stack_t *pds)
/* dict_round_size increased the size. */
ulong new_size = (ulong) d_maxlength(pdict);
/* Adobe does this */
- if (new_size < 20)
+ if (new_size < 20)
new_size += 10;
else if (new_size < 200)
new_size *= 2;
@@ -817,28 +817,28 @@ dict_grow(ref * pdref, dict_stack_t *pds)
new_size += new_size / 2;
#if arch_sizeof_int < arch_sizeof_long
if (new_size > max_uint)
- new_size = max_uint;
+ new_size = max_uint;
#endif
if (new_size > npairs(pdict)) {
- int code = dict_resize(pdref, (uint) new_size, pds);
-
- if (code >= 0)
- return code;
- /* new_size was too big. */
- if (npairs(pdict) < dict_max_size) {
- code = dict_resize(pdref, dict_max_size, pds);
- if (code >= 0)
- return code;
- }
- if (npairs(pdict) == d_maxlength(pdict)) { /* Can't do it. */
- return code;
- }
- /* We can't grow to new_size, but we can grow to npairs. */
- new_size = npairs(pdict);
+ int code = dict_resize(pdref, (uint) new_size, pds);
+
+ if (code >= 0)
+ return code;
+ /* new_size was too big. */
+ if (npairs(pdict) < dict_max_size) {
+ code = dict_resize(pdref, dict_max_size, pds);
+ if (code >= 0)
+ return code;
+ }
+ if (npairs(pdict) == d_maxlength(pdict)) { /* Can't do it. */
+ return code;
+ }
+ /* We can't grow to new_size, but we can grow to npairs. */
+ new_size = npairs(pdict);
}
/* maxlength < npairs, we can grow in place */
ref_save_in(dict_memory(pdict), pdref, &pdict->maxlength,
- "dict_put(maxlength)");
+ "dict_put(maxlength)");
d_set_maxlength(pdict, new_size);
return 0;
}
@@ -858,18 +858,18 @@ dict_next(const ref * pdref, int index, ref * eltp /* ref eltp[2] */ )
ref *vp = pdict->values.value.refs + index;
while (vp--, --index >= 0) {
- array_get(dict_mem(pdict), &pdict->keys, (long)index, eltp);
- /* Make sure this is a valid entry. */
- if (r_has_type(eltp, t_name) ||
- (!dict_is_packed(pdict) && !r_has_type(eltp, t_null))
- ) {
- eltp[1] = *vp;
- if_debug6('d', "[d]0x%lx: index %d: %lx %lx, %lx %lx\n",
- (ulong) pdict, index,
- ((ulong *) eltp)[0], ((ulong *) eltp)[1],
- ((ulong *) vp)[0], ((ulong *) vp)[1]);
- return index;
- }
+ array_get(dict_mem(pdict), &pdict->keys, (long)index, eltp);
+ /* Make sure this is a valid entry. */
+ if (r_has_type(eltp, t_name) ||
+ (!dict_is_packed(pdict) && !r_has_type(eltp, t_null))
+ ) {
+ eltp[1] = *vp;
+ if_debug6('d', "[d]0x%lx: index %d: %lx %lx, %lx %lx\n",
+ (ulong) pdict, index,
+ ((ulong *) eltp)[0], ((ulong *) eltp)[1],
+ ((ulong *) vp)[0], ((ulong *) vp)[1]);
+ return index;
+ }
}
return -1; /* no more elements */
}
@@ -890,10 +890,10 @@ dict_index_entry(const ref * pdref, int index, ref * eltp /* ref eltp[2] */ )
array_get(dict_mem(pdict), &pdict->keys, (long)(index + 1), eltp);
if (r_has_type(eltp, t_name) ||
- (!dict_is_packed(pdict) && !r_has_type(eltp, t_null))
- ) {
- eltp[1] = pdict->values.value.refs[index + 1];
- return 0;
+ (!dict_is_packed(pdict) && !r_has_type(eltp, t_null))
+ ) {
+ eltp[1] = pdict->values.value.refs[index + 1];
+ return 0;
}
return e_undefined;
}
diff --git a/gs/psi/idict.h b/gs/psi/idict.h
index 21a403750..a98c0fddf 100644
--- a/gs/psi/idict.h
+++ b/gs/psi/idict.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -114,13 +114,13 @@ int dict_find_string(const ref * pdref, const char *kstr, ref ** ppvalue);
* THIS ERROR CHECK IS NOT IMPLEMENTED YET.
*/
int dict_put(ref * pdref, const ref * key, const ref * pvalue,
- dict_stack_t *pds);
+ dict_stack_t *pds);
/*
* Enter a key-value pair where the key is a (constant) C string.
*/
int dict_put_string(ref * pdref, const char *kstr, const ref * pvalue,
- dict_stack_t *pds);
+ dict_stack_t *pds);
/*
* Remove a key-value pair from a dictionary.
@@ -152,7 +152,7 @@ uint dict_max_index(const ref * pdref);
* aren't already present in the destination.
*/
int dict_copy_entries(const ref * dfrom, ref * dto, bool new_only,
- dict_stack_t *pds);
+ dict_stack_t *pds);
#define dict_copy(dfrom, dto, pds) dict_copy_entries(dfrom, dto, false, pds)
#define dict_copy_new(dfrom, dto, pds) dict_copy_entries(dfrom, dto, true, pds)
@@ -253,13 +253,13 @@ uint dict_round_size_large(uint rsize);
# ifdef DEBUG
# define dict_hash_mod(h, s)\
(gs_debug_c('.') ? dict_hash_mod_small(h, s) :\
- dict_hash_mod_large(h, s))
+ dict_hash_mod_large(h, s))
# define dict_hash_mod_inline(h, s)\
(gs_debug_c('.') ? dict_hash_mod_inline_small(h, s) :\
- dict_hash_mod_inline_large(h, s))
+ dict_hash_mod_inline_large(h, s))
# define dict_round_size(s)\
(gs_debug_c('.') ? dict_round_size_small(s) :\
- dict_round_size_large(s))
+ dict_round_size_large(s))
# else
# define dict_hash_mod(h, s) dict_hash_mod_large(h, s)
# define dict_hash_mod_inline(h, s) dict_hash_mod_inline_large(h, s)
diff --git a/gs/psi/idictdef.h b/gs/psi/idictdef.h
index 5f78e26a3..1abfb42a7 100644
--- a/gs/psi/idictdef.h
+++ b/gs/psi/idictdef.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -79,7 +79,7 @@
#define npairs(dct) (nslots(dct) - 1)
#define d_length(dct) ((uint)((dct)->count.value.intval))
-/* packed_search_value_pointer simplifies the access to
+/* packed_search_value_pointer simplifies the access to
packed dictionary search template data - see idicttpl.h . */
#define packed_search_value_pointer (pdict->values.value.refs + (kp - kbot))
diff --git a/gs/psi/idicttpl.h b/gs/psi/idicttpl.h
index 3526ed46a..5e63fc26a 100644
--- a/gs/psi/idicttpl.h
+++ b/gs/psi/idicttpl.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,7 +15,7 @@
/* A template for packed dictionary search method */
/*
- * Define template for searching a packed dictionary.
+ * Define template for searching a packed dictionary.
*
* Free variables:
* ref_packed kpack - holds the packed key.
@@ -39,23 +39,23 @@
again:
for (; ; kp-- ) {
- if_debug2('D', "[D]probe 0x%lx: 0x%x\n", (ulong)kp, *kp);
- if ( *kp == kpack ) {
- found;
- } else if ( !r_packed_is_name(kp) ) {
- /* Empty, deleted, or wraparound. Figure out which. */
- if ( *kp == packed_key_empty )
- missing;
- if ( kp == kbot ) {
- if (wrap)
- break;
- else {
- wrap++;
- kp += size; /* wrap */
- goto again; /* skip "kp--". */
- }
- } else {
- deleted;
- }
- }
+ if_debug2('D', "[D]probe 0x%lx: 0x%x\n", (ulong)kp, *kp);
+ if ( *kp == kpack ) {
+ found;
+ } else if ( !r_packed_is_name(kp) ) {
+ /* Empty, deleted, or wraparound. Figure out which. */
+ if ( *kp == packed_key_empty )
+ missing;
+ if ( kp == kbot ) {
+ if (wrap)
+ break;
+ else {
+ wrap++;
+ kp += size; /* wrap */
+ goto again; /* skip "kp--". */
+ }
+ } else {
+ deleted;
+ }
+ }
}
diff --git a/gs/psi/idisp.c b/gs/psi/idisp.c
index e26ec19a2..b8003110a 100644
--- a/gs/psi/idisp.c
+++ b/gs/psi/idisp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -15,8 +15,8 @@
/* $Id$ */
/*
- * This allows the interpreter to set the callback structure
- * of the "display" device. This must set at the end of
+ * This allows the interpreter to set the callback structure
+ * of the "display" device. This must set at the end of
* initialization and before the device is used.
* This is harmless if the 'display' device is not included.
* If gsapi_set_display_callback() is not called, this code
@@ -62,45 +62,43 @@ display_set_callback(gs_main_instance *minst, display_callback *callback)
* If it doesn't exist, return
* false
*/
- const char getdisplay[] =
+ const char getdisplay[] =
"devicedict /display known dup { /display finddevice exch } if";
- code = gs_main_run_string(minst, getdisplay, 0, &exit_code,
- &minst->error_object);
+ code = gs_main_run_string(minst, getdisplay, 0, &exit_code,
+ &minst->error_object);
if (code < 0)
return code;
op = osp;
check_type(*op, t_boolean);
if (op->value.boolval) {
- /* display device was included in Ghostscript so we need
- * to set the callback structure pointer within it.
- * If the device is already open, close it before
- * setting callback, then reopen it.
- */
- check_read_type(op[-1], t_device);
- dev = op[-1].value.pdevice;
-
- was_open = dev->is_open;
- if (was_open) {
- code = gs_closedevice(dev);
- if (code < 0)
- return_error(code);
- }
+ /* display device was included in Ghostscript so we need
+ * to set the callback structure pointer within it.
+ * If the device is already open, close it before
+ * setting callback, then reopen it.
+ */
+ check_read_type(op[-1], t_device);
+ dev = op[-1].value.pdevice;
+
+ was_open = dev->is_open;
+ if (was_open) {
+ code = gs_closedevice(dev);
+ if (code < 0)
+ return_error(code);
+ }
- ddev = (gx_device_display *) dev;
- ddev->callback = callback;
+ ddev = (gx_device_display *) dev;
+ ddev->callback = callback;
- if (was_open) {
- code = gs_opendevice(dev);
- if (code < 0) {
- dprintf("**** Unable to open the display device, quitting.\n");
- return_error(code);
- }
- }
- pop(1); /* device */
+ if (was_open) {
+ code = gs_opendevice(dev);
+ if (code < 0) {
+ dprintf("**** Unable to open the display device, quitting.\n");
+ return_error(code);
+ }
+ }
+ pop(1); /* device */
}
pop(1); /* boolean */
return 0;
}
-
-
diff --git a/gs/psi/idisp.h b/gs/psi/idisp.h
index 88b352fd4..78ab36064 100644
--- a/gs/psi/idisp.h
+++ b/gs/psi/idisp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,5 +24,4 @@ typedef struct display_callback_s display_callback;
/* Called from imain.c to set the display callback in the device instance. */
int display_set_callback(gs_main_instance *minst, display_callback *callback);
-
#endif /* idisp_INCLUDED */
diff --git a/gs/psi/idosave.h b/gs/psi/idosave.h
index dffa01077..c2b21ff13 100644
--- a/gs/psi/idosave.h
+++ b/gs/psi/idosave.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,9 +47,9 @@ struct alloc_change_s {
*/
int alloc_save_change(gs_dual_memory_t *dmem, const ref *pcont,
- ref_packed *ptr, client_name_t cname);
+ ref_packed *ptr, client_name_t cname);
int alloc_save_change_in(gs_ref_memory_t *mem, const ref *pcont,
- ref_packed *ptr, client_name_t cname);
+ ref_packed *ptr, client_name_t cname);
/* Remove an AC_OFFSET_ALLOCATED element. */
void alloc_save_remove(gs_ref_memory_t *mem, ref_packed *obj, client_name_t cname);
/* Allocate a structure for recording an allocation event. */
diff --git a/gs/psi/idparam.c b/gs/psi/idparam.c
index 5ad44dfa1..e9e9dde66 100644
--- a/gs/psi/idparam.c
+++ b/gs/psi/idparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,16 +34,16 @@
/* Return 0 if found, 1 if defaulted, <0 if wrong type. */
int
dict_bool_param(const ref * pdict, const char *kstr,
- bool defaultval, bool * pvalue)
+ bool defaultval, bool * pvalue)
{
ref *pdval;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- *pvalue = defaultval;
- return 1;
+ *pvalue = defaultval;
+ return 1;
}
if (!r_has_type(pdval, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
*pvalue = pdval->value.boolval;
return 0;
}
@@ -55,39 +55,39 @@ dict_bool_param(const ref * pdict, const char *kstr,
/* a missing value will return e_undefined rather than 1. */
int
dict_int_null_param(const ref * pdict, const char *kstr, int minval,
- int maxval, int defaultval, int *pvalue)
+ int maxval, int defaultval, int *pvalue)
{
ref *pdval;
int code, ival;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- ival = defaultval;
- code = 1;
+ ival = defaultval;
+ code = 1;
} else {
- switch (r_type(pdval)) {
- case t_integer:
- ival = pdval->value.intval;
- break;
- case t_real:
- /* Allow an integral real, because Fontographer */
- /* (which violates the Adobe specs in other ways */
- /* as well) sometimes generates output that */
- /* needs this. */
- if (pdval->value.realval < minval || pdval->value.realval > maxval)
- return_error(e_rangecheck);
- ival = (long)pdval->value.realval;
- if (ival != pdval->value.realval)
- return_error(e_rangecheck);
- break;
- case t_null:
- return 2;
- default:
- return_error(e_typecheck);
- }
- code = 0;
+ switch (r_type(pdval)) {
+ case t_integer:
+ ival = pdval->value.intval;
+ break;
+ case t_real:
+ /* Allow an integral real, because Fontographer */
+ /* (which violates the Adobe specs in other ways */
+ /* as well) sometimes generates output that */
+ /* needs this. */
+ if (pdval->value.realval < minval || pdval->value.realval > maxval)
+ return_error(e_rangecheck);
+ ival = (long)pdval->value.realval;
+ if (ival != pdval->value.realval)
+ return_error(e_rangecheck);
+ break;
+ case t_null:
+ return 2;
+ default:
+ return_error(e_typecheck);
+ }
+ code = 0;
}
if (ival < minval || ival > maxval) {
- if (code == 1)
+ if (code == 1)
return_error(e_undefined);
else
return_error(e_rangecheck);
@@ -99,10 +99,10 @@ dict_int_null_param(const ref * pdict, const char *kstr, int minval,
/* Return like dict_int_null_param, but return e_typecheck for null. */
int
dict_int_param(const ref * pdict, const char *kstr, int minval, int maxval,
- int defaultval, int *pvalue)
+ int defaultval, int *pvalue)
{
int code = dict_int_null_param(pdict, kstr, minval, maxval,
- defaultval, pvalue);
+ defaultval, pvalue);
return (code == 2 ? gs_note_error(e_typecheck) : code);
}
@@ -113,24 +113,24 @@ dict_int_param(const ref * pdict, const char *kstr, int minval, int maxval,
/* a missing value will return e_undefined rather than 1. */
int
dict_uint_param(const ref * pdict, const char *kstr,
- uint minval, uint maxval, uint defaultval, uint * pvalue)
+ uint minval, uint maxval, uint defaultval, uint * pvalue)
{
ref *pdval;
int code;
uint ival;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- ival = defaultval;
- code = 1;
+ ival = defaultval;
+ code = 1;
} else {
- check_type_only(*pdval, t_integer);
- if (pdval->value.intval != (uint) pdval->value.intval)
- return_error(e_rangecheck);
- ival = (uint) pdval->value.intval;
- code = 0;
+ check_type_only(*pdval, t_integer);
+ if (pdval->value.intval != (uint) pdval->value.intval)
+ return_error(e_rangecheck);
+ ival = (uint) pdval->value.intval;
+ code = 0;
}
if (ival < minval || ival > maxval) {
- if (code == 1)
+ if (code == 1)
return_error(e_undefined);
else
return_error(e_rangecheck);
@@ -143,21 +143,21 @@ dict_uint_param(const ref * pdict, const char *kstr,
/* Return 0 if found, 1 if defaulted, <0 if wrong type. */
int
dict_float_param(const ref * pdict, const char *kstr,
- floatp defaultval, float *pvalue)
+ floatp defaultval, float *pvalue)
{
ref *pdval;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- *pvalue = defaultval;
- return 1;
+ *pvalue = defaultval;
+ return 1;
}
switch (r_type(pdval)) {
- case t_integer:
- *pvalue = (float)pdval->value.intval;
- return 0;
- case t_real:
- *pvalue = pdval->value.realval;
- return 0;
+ case t_integer:
+ *pvalue = (float)pdval->value.intval;
+ return 0;
+ case t_real:
+ *pvalue = pdval->value.realval;
+ return 0;
}
return_error(e_typecheck);
}
@@ -173,51 +173,51 @@ dict_int_array_check_param(const gs_memory_t *mem, const ref * pdict,
int i, code;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0)
- return 0;
+ return 0;
if (!r_is_array(pdval))
- return_error(e_typecheck);
+ return_error(e_typecheck);
size = r_size(pdval);
if (size > len)
- return_error(over_error);
+ return_error(over_error);
for (i = 0; i < size; i++) {
- code = array_get(mem, pdval, i, &pa);
+ code = array_get(mem, pdval, i, &pa);
if (code < 0)
return code;
/* See dict_int_param above for why we allow reals here. */
- switch (r_type(&pa)) {
- case t_integer:
- if (pa.value.intval != (int)pa.value.intval)
- return_error(e_rangecheck);
- ivec[i] = (int)pa.value.intval;
- break;
- case t_real:
- if (pa.value.realval < min_int ||
- pa.value.realval > max_int ||
- pa.value.realval != (int)pa.value.realval
- )
- return_error(e_rangecheck);
- ivec[i] = (int)pa.value.realval;
- break;
- default:
- return_error(e_typecheck);
- }
+ switch (r_type(&pa)) {
+ case t_integer:
+ if (pa.value.intval != (int)pa.value.intval)
+ return_error(e_rangecheck);
+ ivec[i] = (int)pa.value.intval;
+ break;
+ case t_real:
+ if (pa.value.realval < min_int ||
+ pa.value.realval > max_int ||
+ pa.value.realval != (int)pa.value.realval
+ )
+ return_error(e_rangecheck);
+ ivec[i] = (int)pa.value.realval;
+ break;
+ default:
+ return_error(e_typecheck);
+ }
}
return (size == len || under_error >= 0 ? size :
- gs_note_error(under_error));
+ gs_note_error(under_error));
}
int
dict_int_array_param(const gs_memory_t *mem, const ref * pdict,
const char *kstr, uint maxlen, int *ivec)
{
return dict_int_array_check_param(mem, pdict, kstr, maxlen, ivec,
- 0, e_limitcheck);
+ 0, e_limitcheck);
}
int
dict_ints_param(const gs_memory_t *mem, const ref * pdict,
const char *kstr, uint len, int *ivec)
{
return dict_int_array_check_param(mem, pdict, kstr, len, ivec,
- e_rangecheck, e_rangecheck);
+ e_rangecheck, e_rangecheck);
}
/* Get a float array from a dictionary. */
@@ -226,62 +226,61 @@ dict_ints_param(const gs_memory_t *mem, const ref * pdict,
/* if defaultvec is not NULL, copy it into fvec (maxlen elements) */
/* and return maxlen. */
int
-dict_float_array_check_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint len, float *fvec, const float *defaultvec,
- int under_error, int over_error)
+dict_float_array_check_param(const gs_memory_t *mem,
+ const ref * pdict, const char *kstr,
+ uint len, float *fvec, const float *defaultvec,
+ int under_error, int over_error)
{
ref *pdval;
uint size;
int code;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- if (defaultvec == NULL)
- return 0;
- memcpy(fvec, defaultvec, len * sizeof(float));
+ if (defaultvec == NULL)
+ return 0;
+ memcpy(fvec, defaultvec, len * sizeof(float));
- return len;
+ return len;
}
if (!r_is_array(pdval))
- return_error(e_typecheck);
+ return_error(e_typecheck);
size = r_size(pdval);
if (size > len)
- return_error(over_error);
+ return_error(over_error);
code = process_float_array(mem, pdval, size, fvec);
return (code < 0 ? code :
- size == len || under_error >= 0 ? size :
- gs_note_error(under_error));
+ size == len || under_error >= 0 ? size :
+ gs_note_error(under_error));
}
int
dict_float_array_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint maxlen, float *fvec, const float *defaultvec)
+ const ref * pdict, const char *kstr,
+ uint maxlen, float *fvec, const float *defaultvec)
{
return dict_float_array_check_param(mem ,pdict, kstr, maxlen, fvec,
- defaultvec, 0, e_limitcheck);
+ defaultvec, 0, e_limitcheck);
}
int
dict_floats_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint maxlen, float *fvec, const float *defaultvec)
+ const ref * pdict, const char *kstr,
+ uint maxlen, float *fvec, const float *defaultvec)
{
- return dict_float_array_check_param(mem, pdict, kstr, maxlen,
- fvec, defaultvec,
- e_rangecheck, e_rangecheck);
+ return dict_float_array_check_param(mem, pdict, kstr, maxlen,
+ fvec, defaultvec,
+ e_rangecheck, e_rangecheck);
}
-
/* Do dict_floats_param() and store [/key any] array in $error.errorinfo
* on failure. The key must be a permanently allocated C string.
*/
int
dict_floats_param_errorinfo(i_ctx_t *i_ctx_p,
- const ref * pdict, const char *kstr,
- uint maxlen, float *fvec, const float *defaultvec)
+ const ref * pdict, const char *kstr,
+ uint maxlen, float *fvec, const float *defaultvec)
{
ref *val;
- int code = dict_float_array_check_param(imemory, pdict, kstr, maxlen,
- fvec, defaultvec, e_rangecheck, e_rangecheck);
+ int code = dict_float_array_check_param(imemory, pdict, kstr, maxlen,
+ fvec, defaultvec, e_rangecheck, e_rangecheck);
if (code < 0) {
if (dict_find_string(pdict, kstr, &val) > 0)
gs_errorinfo_put_pair(i_ctx_p, kstr, strlen(kstr), val);
@@ -289,7 +288,6 @@ dict_floats_param_errorinfo(i_ctx_t *i_ctx_p,
return code;
}
-
/*
* Get a procedure from a dictionary. If the key is missing,
* defaultval = false means substitute t__invalid;
@@ -298,16 +296,16 @@ dict_floats_param_errorinfo(i_ctx_t *i_ctx_p,
*/
int
dict_proc_param(const ref * pdict, const char *kstr, ref * pproc,
- bool defaultval)
+ bool defaultval)
{
ref *pdval;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0) {
- if (defaultval)
- make_empty_const_array(pproc, a_readonly + a_executable);
- else
- make_t(pproc, t__invalid);
- return 1;
+ if (defaultval)
+ make_empty_const_array(pproc, a_readonly + a_executable);
+ else
+ make_t(pproc, t__invalid);
+ return 1;
}
check_proc(*pdval);
*pproc = *pdval;
@@ -321,7 +319,7 @@ dict_matrix_param(const gs_memory_t *mem, const ref * pdict, const char *kstr, g
ref *pdval;
if (pdict == 0 || dict_find_string(pdict, kstr, &pdval) <= 0)
- return_error(e_typecheck);
+ return_error(e_typecheck);
return read_matrix(mem, pdval, pmat);
}
@@ -330,63 +328,63 @@ dict_matrix_param(const gs_memory_t *mem, const ref * pdict, const char *kstr, g
/* If there is no uid, return default. */
int
dict_uid_param(const ref * pdict, gs_uid * puid, int defaultval,
- gs_memory_t * mem, const i_ctx_t *i_ctx_p)
+ gs_memory_t * mem, const i_ctx_t *i_ctx_p)
{
ref *puniqueid;
if (pdict == 0) {
- uid_set_invalid(puid);
- return defaultval;
+ uid_set_invalid(puid);
+ return defaultval;
}
/* In a Level 2 environment, check for XUID first. */
if (level2_enabled &&
- dict_find_string(pdict, "XUID", &puniqueid) > 0
- ) {
- long *xvalues;
- uint size, i;
-
- if (!r_has_type(puniqueid, t_array))
- return_error(e_typecheck);
- size = r_size(puniqueid);
- if (size == 0)
- return_error(e_rangecheck);
- xvalues = (long *)gs_alloc_byte_array(mem, size, sizeof(long),
- "get XUID");
-
- if (xvalues == 0)
- return_error(e_VMerror);
- /* Get the values from the XUID array. */
- for (i = 0; i < size; i++) {
- const ref *pvalue = puniqueid->value.const_refs + i;
-
- if (!r_has_type(pvalue, t_integer)) {
- gs_free_object(mem, xvalues, "get XUID");
- return_error(e_typecheck);
- }
- xvalues[i] = pvalue->value.intval;
- }
- uid_set_XUID(puid, xvalues, size);
- return 1;
+ dict_find_string(pdict, "XUID", &puniqueid) > 0
+ ) {
+ long *xvalues;
+ uint size, i;
+
+ if (!r_has_type(puniqueid, t_array))
+ return_error(e_typecheck);
+ size = r_size(puniqueid);
+ if (size == 0)
+ return_error(e_rangecheck);
+ xvalues = (long *)gs_alloc_byte_array(mem, size, sizeof(long),
+ "get XUID");
+
+ if (xvalues == 0)
+ return_error(e_VMerror);
+ /* Get the values from the XUID array. */
+ for (i = 0; i < size; i++) {
+ const ref *pvalue = puniqueid->value.const_refs + i;
+
+ if (!r_has_type(pvalue, t_integer)) {
+ gs_free_object(mem, xvalues, "get XUID");
+ return_error(e_typecheck);
+ }
+ xvalues[i] = pvalue->value.intval;
+ }
+ uid_set_XUID(puid, xvalues, size);
+ return 1;
}
/* If no UniqueID entry, set the UID to invalid, */
/* because UniqueID need not be present in all fonts, */
/* and if it is, the legal range is 0 to 2^24-1. */
if (dict_find_string(pdict, "UniqueID", &puniqueid) <= 0) {
- uid_set_invalid(puid);
- return defaultval;
+ uid_set_invalid(puid);
+ return defaultval;
} else {
- if (!r_has_type(puniqueid, t_integer))
- return_error(e_typecheck);
- if (puniqueid->value.intval < 0 || puniqueid->value.intval > 0xffffff)
- return_error(e_rangecheck);
- /* Apparently fonts created by Fontographer often have */
- /* a UniqueID of 0, contrary to Adobe's specifications. */
- /* Treat 0 as equivalent to -1 (no UniqueID). */
- if (puniqueid->value.intval == 0) {
- uid_set_invalid(puid);
- return defaultval;
- } else
- uid_set_UniqueID(puid, puniqueid->value.intval);
+ if (!r_has_type(puniqueid, t_integer))
+ return_error(e_typecheck);
+ if (puniqueid->value.intval < 0 || puniqueid->value.intval > 0xffffff)
+ return_error(e_rangecheck);
+ /* Apparently fonts created by Fontographer often have */
+ /* a UniqueID of 0, contrary to Adobe's specifications. */
+ /* Treat 0 as equivalent to -1 (no UniqueID). */
+ if (puniqueid->value.intval == 0) {
+ uid_set_invalid(puid);
+ return defaultval;
+ } else
+ uid_set_UniqueID(puid, puniqueid->value.intval);
}
return 0;
}
@@ -398,29 +396,29 @@ dict_check_uid_param(const ref * pdict, const gs_uid * puid)
ref *puniqueid;
if (uid_is_XUID(puid)) {
- uint size = uid_XUID_size(puid);
- uint i;
-
- if (dict_find_string(pdict, "XUID", &puniqueid) <= 0)
- return false;
- if (!r_has_type(puniqueid, t_array) ||
- r_size(puniqueid) != size
- )
- return false;
- for (i = 0; i < size; i++) {
- const ref *pvalue = puniqueid->value.const_refs + i;
-
- if (!r_has_type(pvalue, t_integer))
- return false;
- if (pvalue->value.intval != uid_XUID_values(puid)[i])
- return false;
- }
- return true;
+ uint size = uid_XUID_size(puid);
+ uint i;
+
+ if (dict_find_string(pdict, "XUID", &puniqueid) <= 0)
+ return false;
+ if (!r_has_type(puniqueid, t_array) ||
+ r_size(puniqueid) != size
+ )
+ return false;
+ for (i = 0; i < size; i++) {
+ const ref *pvalue = puniqueid->value.const_refs + i;
+
+ if (!r_has_type(pvalue, t_integer))
+ return false;
+ if (pvalue->value.intval != uid_XUID_values(puid)[i])
+ return false;
+ }
+ return true;
} else {
- if (dict_find_string(pdict, "UniqueID", &puniqueid) <= 0)
- return false;
- return (r_has_type(puniqueid, t_integer) &&
- puniqueid->value.intval == puid->id);
+ if (dict_find_string(pdict, "UniqueID", &puniqueid) <= 0)
+ return false;
+ return (r_has_type(puniqueid, t_integer) &&
+ puniqueid->value.intval == puid->id);
}
}
@@ -444,10 +442,10 @@ gs_errorinfo_put_pair(i_ctx_t *i_ctx_p, const char *key, int len, const ref *any
ref_assign_new(aptr, &key_name);
ref_assign_new(aptr+1, any);
if (dict_find_string(systemdict, "$error", &pderror) <= 0 ||
- !r_has_type(pderror, t_dictionary) ||
- idict_put_string(pderror, "errorinfo", &pair) < 0
- )
- return_error(e_Fatal);
+ !r_has_type(pderror, t_dictionary) ||
+ idict_put_string(pderror, "errorinfo", &pair) < 0
+ )
+ return_error(e_Fatal);
return 0;
}
diff --git a/gs/psi/idparam.h b/gs/psi/idparam.h
index d95f10ca3..61a036288 100644
--- a/gs/psi/idparam.h
+++ b/gs/psi/idparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,17 +41,17 @@ typedef struct gs_uid_s gs_uid;
* name return 2 if the parameter is null, without setting *pvalue.
*/
int dict_bool_param(const ref * pdict, const char *kstr,
- bool defaultval, bool * pvalue);
+ bool defaultval, bool * pvalue);
int dict_int_param(const ref * pdict, const char *kstr,
- int minval, int maxval, int defaultval, int *pvalue);
+ int minval, int maxval, int defaultval, int *pvalue);
int dict_int_null_param(const ref * pdict, const char *kstr,
- int minval, int maxval, int defaultval,
- int *pvalue);
+ int minval, int maxval, int defaultval,
+ int *pvalue);
int dict_uint_param(const ref * pdict, const char *kstr,
- uint minval, uint maxval, uint defaultval,
- uint * pvalue);
+ uint minval, uint maxval, uint defaultval,
+ uint * pvalue);
int dict_float_param(const ref * pdict, const char *kstr,
- floatp defaultval, float *pvalue);
+ floatp defaultval, float *pvalue);
/*
* There are 3 variants of the procedures for getting array parameters.
* All return the element count if the parameter is present and of the
@@ -77,26 +77,25 @@ int dict_ints_param(const gs_memory_t *mem, const ref * pdict,
* (max)len.
*/
int dict_float_array_check_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint len, float *fvec,
- const float *defaultvec,
- int under_error, int over_error);
+ const ref * pdict, const char *kstr,
+ uint len, float *fvec,
+ const float *defaultvec,
+ int under_error, int over_error);
int dict_float_array_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint maxlen, float *fvec,
- const float *defaultvec);
+ const ref * pdict, const char *kstr,
+ uint maxlen, float *fvec,
+ const float *defaultvec);
int dict_floats_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- uint len, float *fvec,
- const float *defaultvec);
+ const ref * pdict, const char *kstr,
+ uint len, float *fvec,
+ const float *defaultvec);
/* Do dict_floats_param() and store [/key any] array in $error.errorinfo
* on failure. The key must be a permanently allocated C string.
*/
int
dict_floats_param_errorinfo(i_ctx_t *i_ctx_p,
- const ref * pdict, const char *kstr,
- uint maxlen, float *fvec, const float *defaultvec);
-
+ const ref * pdict, const char *kstr,
+ uint maxlen, float *fvec, const float *defaultvec);
/*
* For dict_proc_param,
@@ -105,17 +104,16 @@ dict_floats_param_errorinfo(i_ctx_t *i_ctx_p,
* In either case, return 1.
*/
int dict_proc_param(const ref * pdict, const char *kstr, ref * pproc,
- bool defaultval);
-int dict_matrix_param(const gs_memory_t *mem,
- const ref * pdict, const char *kstr,
- gs_matrix * pmat);
+ bool defaultval);
+int dict_matrix_param(const gs_memory_t *mem,
+ const ref * pdict, const char *kstr,
+ gs_matrix * pmat);
int dict_uid_param(const ref * pdict, gs_uid * puid, int defaultval,
- gs_memory_t * mem, const i_ctx_t *i_ctx_p);
+ gs_memory_t * mem, const i_ctx_t *i_ctx_p);
/* Check that a UID in a dictionary is equal to an existing, valid UID. */
bool dict_check_uid_param(const ref * pdict, const gs_uid * puid);
-
/* Create and store [/key any] array in $error.errorinfo.
* The key must be a permanently allocated C string.
*/
diff --git a/gs/psi/idsdata.h b/gs/psi/idsdata.h
index 96f256684..f9648a8e0 100644
--- a/gs/psi/idsdata.h
+++ b/gs/psi/idsdata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/idstack.c b/gs/psi/idstack.c
index c340ea77d..a35cc2ff3 100644
--- a/gs/psi/idstack.c
+++ b/gs/psi/idstack.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,22 +52,22 @@ dstack_find_name_by_index(dict_stack_t * pds, uint nidx)
INCR(lookups);
if (dict_is_packed(pdict)) {
- uint hash =
- dict_hash_mod(dict_name_index_hash(nidx), npairs(pdict)) + 1;
+ uint hash =
+ dict_hash_mod(dict_name_index_hash(nidx), npairs(pdict)) + 1;
- if (pdict->keys.value.packed[hash] ==
- pt_tag(pt_literal_name) + nidx
- )
- INCR(probes[0]);
- else if (pdict->keys.value.packed[hash - 1] ==
- pt_tag(pt_literal_name) + nidx
- )
- INCR(probes[1]);
+ if (pdict->keys.value.packed[hash] ==
+ pt_tag(pt_literal_name) + nidx
+ )
+ INCR(probes[0]);
+ else if (pdict->keys.value.packed[hash - 1] ==
+ pt_tag(pt_literal_name) + nidx
+ )
+ INCR(probes[1]);
}
if (gs_debug_c('d') && !(stats_dstack.lookups % 1000))
- dlprintf3("[d]lookups=%ld probe1=%ld probe2=%ld\n",
- stats_dstack.lookups, stats_dstack.probes[0],
- stats_dstack.probes[1]);
+ dlprintf3("[d]lookups=%ld probe1=%ld probe2=%ld\n",
+ stats_dstack.lookups, stats_dstack.probes[0],
+ stats_dstack.probes[1]);
return pvalue;
}
#define dstack_find_name_by_index real_dstack_find_name_by_index
@@ -81,15 +81,15 @@ dstack_dict_is_permanent(const dict_stack_t * pds, const ref * pdref)
int i;
if (pds->stack.extension_size == 0) { /* Only one block of d-stack. */
- for (i = 0; i < pds->min_size; ++i)
- if (pds->stack.bot[i].value.pdict == pdict)
- return true;
+ for (i = 0; i < pds->min_size; ++i)
+ if (pds->stack.bot[i].value.pdict == pdict)
+ return true;
} else { /* More than one block of d-stack. */
- uint count = ref_stack_count(&pds->stack);
+ uint count = ref_stack_count(&pds->stack);
- for (i = count - pds->min_size; i < count; ++i)
- if (ref_stack_index(&pds->stack, i)->value.pdict == pdict)
- return true;
+ for (i = count - pds->min_size; i < count; ++i)
+ if (ref_stack_index(&pds->stack, i)->value.pdict == pdict)
+ return true;
}
return false;
}
@@ -109,88 +109,88 @@ dstack_find_name_by_index(dict_stack_t * pds, uint nidx)
ref_packed kpack = packed_name_key(nidx);
do {
- dict *pdict = pdref->value.pdict;
- uint size = npairs(pdict);
+ dict *pdict = pdref->value.pdict;
+ uint size = npairs(pdict);
#ifdef DEBUG
- if (gs_debug_c('D')) {
- const gs_memory_t *mem = dict_mem(pdict);
- ref dnref;
+ if (gs_debug_c('D')) {
+ const gs_memory_t *mem = dict_mem(pdict);
+ ref dnref;
- name_index_ref(mem, nidx, &dnref);
- dlputs("[D]lookup ");
- debug_print_name(mem, &dnref);
- dprintf3(" in 0x%lx(%u/%u)\n",
- (ulong) pdict, dict_length(pdref),
- dict_maxlength(pdref));
- }
+ name_index_ref(mem, nidx, &dnref);
+ dlputs("[D]lookup ");
+ debug_print_name(mem, &dnref);
+ dprintf3(" in 0x%lx(%u/%u)\n",
+ (ulong) pdict, dict_length(pdref),
+ dict_maxlength(pdref));
+ }
#endif
#define INCR_DEPTH(pdref)\
INCR(depth[min(MAX_STATS_DEPTH, pds->stack.p - pdref)])
- if (dict_is_packed(pdict)) {
+ if (dict_is_packed(pdict)) {
# define found INCR_DEPTH(pdref); return packed_search_value_pointer
-# define deleted
+# define deleted
# define missing break;
# include "idicttpl.h"
# undef missing
# undef deleted
# undef found
- } else {
- /*
- * The name_index macro takes mem as its first argument, but
- * does not actually use it. The following is a little ugly,
- * but it avoids a compiler warning.
- */
- /*const gs_memory_t *_mem_not_used = dict_mem(pdict);*/
- ref *kbot = pdict->keys.value.refs;
- register ref *kp;
- int wrap = 0;
+ } else {
+ /*
+ * The name_index macro takes mem as its first argument, but
+ * does not actually use it. The following is a little ugly,
+ * but it avoids a compiler warning.
+ */
+ /*const gs_memory_t *_mem_not_used = dict_mem(pdict);*/
+ ref *kbot = pdict->keys.value.refs;
+ register ref *kp;
+ int wrap = 0;
- /* Search the dictionary */
- for (kp = kbot + dict_hash_mod(hash, size) + 2;;) {
- --kp;
- if (r_has_type(kp, t_name)) {
- if (name_index(_mem_not_used, kp) == nidx) {
- INCR_DEPTH(pdref);
- return pdict->values.value.refs + (kp - kbot);
- }
- } else if (r_has_type(kp, t_null)) { /* Empty, deleted, or wraparound. */
- /* Figure out which. */
- if (!r_has_attr(kp, a_executable))
- break;
- if (kp == kbot) { /* wrap */
- if (wrap++)
- break; /* 2 wraps */
- kp += size + 1;
- }
- }
- }
- }
+ /* Search the dictionary */
+ for (kp = kbot + dict_hash_mod(hash, size) + 2;;) {
+ --kp;
+ if (r_has_type(kp, t_name)) {
+ if (name_index(_mem_not_used, kp) == nidx) {
+ INCR_DEPTH(pdref);
+ return pdict->values.value.refs + (kp - kbot);
+ }
+ } else if (r_has_type(kp, t_null)) { /* Empty, deleted, or wraparound. */
+ /* Figure out which. */
+ if (!r_has_attr(kp, a_executable))
+ break;
+ if (kp == kbot) { /* wrap */
+ if (wrap++)
+ break; /* 2 wraps */
+ kp += size + 1;
+ }
+ }
+ }
+ }
#undef INCR_DEPTH
}
while (pdref-- > pds->stack.bot);
/* The name isn't in the top dictionary block. */
/* If there are other blocks, search them now (more slowly). */
if (!pds->stack.extension_size) /* no more blocks */
- return (ref *) 0;
+ return (ref *) 0;
{ /* We could use the STACK_LOOP macros, but for now, */
- /* we'll do things the simplest way. */
- ref key;
- uint i = pds->stack.p + 1 - pds->stack.bot;
- uint size = ref_stack_count(&pds->stack);
- ref *pvalue;
-
- dict *pdict = pds->stack.p->value.pdict;
- const gs_memory_t *mem = dict_mem(pdict);
+ /* we'll do things the simplest way. */
+ ref key;
+ uint i = pds->stack.p + 1 - pds->stack.bot;
+ uint size = ref_stack_count(&pds->stack);
+ ref *pvalue;
+
+ dict *pdict = pds->stack.p->value.pdict;
+ const gs_memory_t *mem = dict_mem(pdict);
- name_index_ref(mem, nidx, &key);
- for (; i < size; i++) {
- if (dict_find(ref_stack_index(&pds->stack, i),
- &key, &pvalue) > 0
- ) {
- INCR(depth[min(MAX_STATS_DEPTH, i)]);
- return pvalue;
- }
- }
+ name_index_ref(mem, nidx, &key);
+ for (; i < size; i++) {
+ if (dict_find(ref_stack_index(&pds->stack, i),
+ &key, &pvalue) > 0
+ ) {
+ INCR(depth[min(MAX_STATS_DEPTH, i)]);
+ return pvalue;
+ }
+ }
}
return (ref *) 0;
#undef hash
@@ -207,21 +207,21 @@ dstack_set_top(dict_stack_t * pds)
dict *pdict = dsp->value.pdict;
if_debug3('d', "[d]dsp = 0x%lx -> 0x%lx, key array type = %d\n",
- (ulong) dsp, (ulong) pdict, r_type(&pdict->keys));
+ (ulong) dsp, (ulong) pdict, r_type(&pdict->keys));
if (dict_is_packed(pdict) &&
- r_has_attr(dict_access_ref(dsp), a_read)
- ) {
- pds->top_keys = pdict->keys.value.packed;
- pds->top_npairs = npairs(pdict);
- pds->top_values = pdict->values.value.refs;
+ r_has_attr(dict_access_ref(dsp), a_read)
+ ) {
+ pds->top_keys = pdict->keys.value.packed;
+ pds->top_npairs = npairs(pdict);
+ pds->top_values = pdict->values.value.refs;
} else {
- pds->top_keys = no_packed_keys;
- pds->top_npairs = 1;
+ pds->top_keys = no_packed_keys;
+ pds->top_npairs = 1;
}
if (!r_has_attr(dict_access_ref(dsp), a_write))
- pds->def_space = -1;
+ pds->def_space = -1;
else
- pds->def_space = r_space(dsp);
+ pds->def_space = r_space(dsp);
}
/* After a garbage collection, scan the permanent dictionaries and */
@@ -233,33 +233,33 @@ dstack_gc_cleanup(dict_stack_t * pds)
uint dsi;
for (dsi = pds->min_size; dsi > 0; --dsi) {
- const dict *pdict =
- ref_stack_index(&pds->stack, count - dsi)->value.pdict;
- uint size = nslots(pdict);
- ref *pvalue = pdict->values.value.refs;
- uint i;
+ const dict *pdict =
+ ref_stack_index(&pds->stack, count - dsi)->value.pdict;
+ uint size = nslots(pdict);
+ ref *pvalue = pdict->values.value.refs;
+ uint i;
- for (i = 0; i < size; ++i, ++pvalue) {
- ref key;
- ref *old_pvalue;
+ for (i = 0; i < size; ++i, ++pvalue) {
+ ref key;
+ ref *old_pvalue;
- array_get(dict_mem(pdict), &pdict->keys, (long)i, &key);
- if (r_has_type(&key, t_name) &&
- pv_valid(old_pvalue = key.value.pname->pvalue)
- ) { /*
- * The name only has a single definition,
- * so it must be this one. Check to see if
- * no relocation is actually needed; if so,
- * we can skip the entire dictionary.
- */
- if (old_pvalue == pvalue) {
- if_debug1('d', "[d]skipping dstack entry %d\n",
- dsi - 1);
- break;
- }
- /* Update the value pointer. */
- key.value.pname->pvalue = pvalue;
- }
- }
+ array_get(dict_mem(pdict), &pdict->keys, (long)i, &key);
+ if (r_has_type(&key, t_name) &&
+ pv_valid(old_pvalue = key.value.pname->pvalue)
+ ) { /*
+ * The name only has a single definition,
+ * so it must be this one. Check to see if
+ * no relocation is actually needed; if so,
+ * we can skip the entire dictionary.
+ */
+ if (old_pvalue == pvalue) {
+ if_debug1('d', "[d]skipping dstack entry %d\n",
+ dsi - 1);
+ break;
+ }
+ /* Update the value pointer. */
+ key.value.pname->pvalue = pvalue;
+ }
+ }
}
}
diff --git a/gs/psi/idstack.h b/gs/psi/idstack.h
index fe1005c7f..796732c5a 100644
--- a/gs/psi/idstack.h
+++ b/gs/psi/idstack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,9 +52,9 @@ ref *dstack_find_name_by_index(dict_stack_t *, uint);
*/
#define if_dstack_find_name_by_index_top(pds,nidx,htemp,pvslot)\
if ( (((pds)->top_keys[htemp = dict_hash_mod_inline(dict_name_index_hash(nidx),\
- (pds)->top_npairs) + 1] == pt_tag(pt_literal_name) + (nidx)) ?\
- ((pvslot) = (pds)->top_values + (htemp), 1) :\
- 0)\
+ (pds)->top_npairs) + 1] == pt_tag(pt_literal_name) + (nidx)) ?\
+ ((pvslot) = (pds)->top_values + (htemp), 1) :\
+ 0)\
)
#endif /* idstack_INCLUDED */
diff --git a/gs/psi/ierrors.h b/gs/psi/ierrors.h
index 083028b8d..cd2ca9a9b 100644
--- a/gs/psi/ierrors.h
+++ b/gs/psi/ierrors.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@
/* Define the error name table */
extern const char *const gs_error_names[];
- /* ------ PostScript Level 1 errors ------ */
+ /* ------ PostScript Level 1 errors ------ */
#define e_unknownerror (-1) /* unknown error */
#define e_dictfull (-2)
@@ -69,7 +69,7 @@ extern const char *const gs_error_names[];
"stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\
"undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror"
- /* ------ Additional Level 2 errors (also in DPS) ------ */
+ /* ------ Additional Level 2 errors (also in DPS) ------ */
#define e_configurationerror (-26)
#define e_undefinedresource (-27)
@@ -78,7 +78,7 @@ extern const char *const gs_error_names[];
#define LEVEL2_ERROR_NAMES\
"configurationerror", "undefinedresource", "unregistered"
- /* ------ Additional DPS errors ------ */
+ /* ------ Additional DPS errors ------ */
#define e_invalidcontext (-29)
/* invalidid is for the NeXT DPS extension. */
@@ -90,7 +90,7 @@ extern const char *const gs_error_names[];
#define ERROR_NAMES\
LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_ERROR_NAMES
- /* ------ Pseudo-errors used internally ------ */
+ /* ------ Pseudo-errors used internally ------ */
/*
* Internal code for a fatal error.
diff --git a/gs/psi/iesdata.h b/gs/psi/iesdata.h
index 1e3d87646..e92bb93f8 100644
--- a/gs/psi/iesdata.h
+++ b/gs/psi/iesdata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iestack.h b/gs/psi/iestack.h
index d8d38c84a..55dd1c1d1 100644
--- a/gs/psi/iestack.h
+++ b/gs/psi/iestack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ifapi.h b/gs/psi/ifapi.h
index d9fd3c903..346d2ee76 100644
--- a/gs/psi/ifapi.h
+++ b/gs/psi/ifapi.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@
#include "memory_.h"
#include "gp.h"
-typedef int FracInt; /* A fractional integer with statically unknown number of fraction bits.
+typedef int FracInt; /* A fractional integer with statically unknown number of fraction bits.
The number of bits depends on plugin and is being specified in
FAPI_server::frac_shift.
*/
@@ -40,21 +40,21 @@ typedef enum {
FAPI_FONT_FEATURE_UnderlineThickness,
FAPI_FONT_FEATURE_FontType,
FAPI_FONT_FEATURE_FontBBox,
- FAPI_FONT_FEATURE_BlueValues_count,
+ FAPI_FONT_FEATURE_BlueValues_count,
FAPI_FONT_FEATURE_BlueValues,
- FAPI_FONT_FEATURE_OtherBlues_count,
+ FAPI_FONT_FEATURE_OtherBlues_count,
FAPI_FONT_FEATURE_OtherBlues,
- FAPI_FONT_FEATURE_FamilyBlues_count,
+ FAPI_FONT_FEATURE_FamilyBlues_count,
FAPI_FONT_FEATURE_FamilyBlues,
- FAPI_FONT_FEATURE_FamilyOtherBlues_count,
+ FAPI_FONT_FEATURE_FamilyOtherBlues_count,
FAPI_FONT_FEATURE_FamilyOtherBlues,
FAPI_FONT_FEATURE_BlueShift,
FAPI_FONT_FEATURE_BlueFuzz,
FAPI_FONT_FEATURE_StdHW,
FAPI_FONT_FEATURE_StdVW,
- FAPI_FONT_FEATURE_StemSnapH_count,
+ FAPI_FONT_FEATURE_StemSnapH_count,
FAPI_FONT_FEATURE_StemSnapH,
- FAPI_FONT_FEATURE_StemSnapV_count,
+ FAPI_FONT_FEATURE_StemSnapV_count,
FAPI_FONT_FEATURE_StemSnapV,
FAPI_FONT_FEATURE_ForceBold,
FAPI_FONT_FEATURE_LanguageGroup,
@@ -100,8 +100,8 @@ typedef struct {
unsigned int char_name_length;
FAPI_metrics_type metrics_type;
FracInt sb_x, sb_y, aw_x, aw_y; /* replaced PS metrics. */
- int metrics_scale; /* Scale for replaced PS metrics.
- Zero means "em box size". */
+ int metrics_scale; /* Scale for replaced PS metrics.
+ Zero means "em box size". */
} FAPI_char_ref;
typedef struct FAPI_font_s FAPI_font;
@@ -142,7 +142,7 @@ struct FAPI_face_s {
gs_id font_id;
gs_matrix ctm;
gs_log2_scale_point log2_scale;
- bool align_to_pixels;
+ bool align_to_pixels;
float HWResolution[2];
};
@@ -158,10 +158,10 @@ struct FAPI_path_s {
};
typedef struct FAPI_font_scale_s {
- FracInt matrix[6];
- FracInt HWResolution[2];
+ FracInt matrix[6];
+ FracInt HWResolution[2];
int subpixels[2];
- bool align_to_pixels;
+ bool align_to_pixels;
} FAPI_font_scale;
typedef struct FAPI_metrics_s {
@@ -199,9 +199,9 @@ struct FAPI_server_s {
int max_bitmap;
bool use_outline;
gs_matrix initial_FontMatrix; /* Font Matrix at the time the font is defined */
- /* Used to use the stored 'OrigFont' entry but */
- /* this did not change f a font was defined */
- /* using an existing base font */
+ /* Used to use the stored 'OrigFont' entry but */
+ /* this did not change f a font was defined */
+ /* using an existing base font */
FAPI_retcode (*ensure_open)(FAPI_server *server, const byte * param, int param_size);
FAPI_retcode (*get_scaled_font)(FAPI_server *server, FAPI_font *ff, const FAPI_font_scale *scale, const char *xlatmap, FAPI_descendant_code dc);
FAPI_retcode (*get_decodingID)(FAPI_server *server, FAPI_font *ff, const char **decodingID);
@@ -238,11 +238,10 @@ struct FAPI_server_s {
*/
/* Due to the interpreter fallback with CDevProc,
get_char_raster_metrics leaves some data kept by the server,
- so taht get_char_raster uses them and release_char_data releases them.
- Therefore calls from GS to these functions must not
+ so taht get_char_raster uses them and release_char_data releases them.
+ Therefore calls from GS to these functions must not
interfer with different characters.
*/
};
-
#endif /* ifapi_INCLUDED */
diff --git a/gs/psi/ifcid.h b/gs/psi/ifcid.h
index 35b15bfaa..9a67efd3c 100644
--- a/gs/psi/ifcid.h
+++ b/gs/psi/ifcid.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,10 +19,10 @@
/* Get the CIDSystemInfo of a CIDFont. */
int cid_font_system_info_param(gs_cid_system_info_t *pcidsi,
- const ref *prfont);
+ const ref *prfont);
/* Get the additional information for a CIDFontType 0 or 2 CIDFont. */
int cid_font_data_param(os_ptr op, gs_font_cid_data *pdata,
- ref *pGlyphDirectory);
+ ref *pGlyphDirectory);
#endif /* ifcid_INCLUDED */
diff --git a/gs/psi/ifilter.h b/gs/psi/ifilter.h
index 2b56cfe54..b41c19423 100644
--- a/gs/psi/ifilter.h
+++ b/gs/psi/ifilter.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,32 +27,32 @@
* and all relevant parameters (if any) are in global VM.
*/
int filter_read(
- /* Operator arguments that were passed to zfxxx operator */
- i_ctx_t *i_ctx_p,
- /* # of parameters to pop off o-stack, */
- /* not counting the source/target and also not counting any */
- /* top dictionary operand (both of which will always be popped) */
- int npop,
- /* Template for stream */
- const stream_template * template,
- /* Initialized s_xxx_state, 0 if no separate state */
- stream_state * st,
- /* Max of space attributes of all parameters referenced by */
- /* the state, 0 if no such parameters */
- uint space
- );
+ /* Operator arguments that were passed to zfxxx operator */
+ i_ctx_t *i_ctx_p,
+ /* # of parameters to pop off o-stack, */
+ /* not counting the source/target and also not counting any */
+ /* top dictionary operand (both of which will always be popped) */
+ int npop,
+ /* Template for stream */
+ const stream_template * template,
+ /* Initialized s_xxx_state, 0 if no separate state */
+ stream_state * st,
+ /* Max of space attributes of all parameters referenced by */
+ /* the state, 0 if no such parameters */
+ uint space
+ );
int filter_write(i_ctx_t *i_ctx_p, int npop,
- const stream_template * template,
- stream_state * st, uint space);
+ const stream_template * template,
+ stream_state * st, uint space);
/*
* Define a simplified interface for streams with no parameters (except
* an optional dictionary) or state.
*/
int filter_read_simple(i_ctx_t *i_ctx_p,
- const stream_template * template);
+ const stream_template * template);
int filter_write_simple(i_ctx_t *i_ctx_p,
- const stream_template * template);
+ const stream_template * template);
/* Mark a filter stream as temporary. */
/* See stream.h for the meaning of is_temp. */
diff --git a/gs/psi/ifilter2.h b/gs/psi/ifilter2.h
index 4729c1ff8..882b42caa 100644
--- a/gs/psi/ifilter2.h
+++ b/gs/psi/ifilter2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ifont.h b/gs/psi/ifont.h
index 63acb4436..7a1be43e2 100644
--- a/gs/psi/ifont.h
+++ b/gs/psi/ifont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,25 +38,25 @@ typedef struct font_data_s {
ref CharStrings;
ref GlyphNames2Unicode;
union _fs {
- struct _f1 {
- ref OtherSubrs; /* from Private dictionary */
- ref Subrs; /* from Private dictionary */
- ref GlobalSubrs; /* from Private dictionary, */
- /* for Type 2 charstrings */
- } type1;
- struct _f42 {
- ref sfnts;
- ref CIDMap; /* for CIDFontType 2 fonts */
- ref GlyphDirectory;
- /* the following are used to optimize lookups into sfnts */
- uint mru_sfnts_index; /* index of most recently used sfnts string */
- ulong mru_sfnts_pos; /* data bytes before sfnts string at index mru_sfnts_index */
- } type42;
- struct _fc0 {
- ref GlyphDirectory;
- ref GlyphData; /* (if preloaded) string or array of strings */
- ref DataSource; /* (if not preloaded) reusable stream */
- } cid0;
+ struct _f1 {
+ ref OtherSubrs; /* from Private dictionary */
+ ref Subrs; /* from Private dictionary */
+ ref GlobalSubrs; /* from Private dictionary, */
+ /* for Type 2 charstrings */
+ } type1;
+ struct _f42 {
+ ref sfnts;
+ ref CIDMap; /* for CIDFontType 2 fonts */
+ ref GlyphDirectory;
+ /* the following are used to optimize lookups into sfnts */
+ uint mru_sfnts_index; /* index of most recently used sfnts string */
+ ulong mru_sfnts_pos; /* data bytes before sfnts string at index mru_sfnts_index */
+ } type42;
+ struct _fc0 {
+ ref GlyphDirectory;
+ ref GlyphData; /* (if preloaded) string or array of strings */
+ ref DataSource; /* (if not preloaded) reusable stream */
+ } cid0;
} u;
} font_data;
diff --git a/gs/psi/ifont1.h b/gs/psi/ifont1.h
index a300e6011..ecc8c3ba1 100644
--- a/gs/psi/ifont1.h
+++ b/gs/psi/ifont1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,25 +42,25 @@ int charstring_font_get_refs(const_os_ptr op, charstring_font_refs_t *pfr);
* CIDFontType 0 font. The client has filled in pdata1->interpret,
* subroutineNumberBias, lenIV, and (if applicable) the Type 2 elements.
*/
-int charstring_font_params(const gs_memory_t *mem,
- const_os_ptr op, charstring_font_refs_t *pfr,
- gs_type1_data *pdata1);
+int charstring_font_params(const gs_memory_t *mem,
+ const_os_ptr op, charstring_font_refs_t *pfr,
+ gs_type1_data *pdata1);
/*
* Fill in a newly built CharString-based font or FDArray entry.
*/
int charstring_font_init(gs_font_type1 *pfont,
- const charstring_font_refs_t *pfr,
- const gs_type1_data *pdata1);
+ const charstring_font_refs_t *pfr,
+ const gs_type1_data *pdata1);
/*
* Finish building a CharString-based font. The client has filled in the
* same elements as for charstring_font_params.
*/
int build_charstring_font(i_ctx_t *i_ctx_p, os_ptr op,
- build_proc_refs * pbuild, font_type ftype,
- charstring_font_refs_t *pfr,
- gs_type1_data *pdata1,
- build_font_options_t options);
+ build_proc_refs * pbuild, font_type ftype,
+ charstring_font_refs_t *pfr,
+ gs_type1_data *pdata1,
+ build_font_options_t options);
#endif /* ifont1_INCLUDED */
diff --git a/gs/psi/ifont2.h b/gs/psi/ifont2.h
index a49b02e7f..df955ae1f 100644
--- a/gs/psi/ifont2.h
+++ b/gs/psi/ifont2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,6 +26,6 @@
* fonts.
*/
int type2_font_params(const_os_ptr op, charstring_font_refs_t *pfr,
- gs_type1_data *pdata1);
+ gs_type1_data *pdata1);
#endif /* ifont2_INCLUDED */
diff --git a/gs/psi/ifont42.h b/gs/psi/ifont42.h
index 879fe66cf..427a40159 100644
--- a/gs/psi/ifont42.h
+++ b/gs/psi/ifont42.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,8 +19,8 @@
/* Build a type 11 (TrueType CID-keyed) or 42 (TrueType) font. */
int build_gs_TrueType_font(i_ctx_t *, os_ptr, gs_font_type42 **, font_type,
- gs_memory_type_ptr_t, const char *, const char *,
- build_font_options_t);
+ gs_memory_type_ptr_t, const char *, const char *,
+ build_font_options_t);
/*
* Check a parameter for being an array of strings. Return the parameter
@@ -44,11 +44,11 @@ int font_gdir_get_outline(const gs_memory_t *mem, const ref *, long, gs_glyph_da
* Access a given byte offset and length in an array of strings.
* This is used for sfnts and for CIDMap. The int argument is 2 for sfnts
* (because of the strange behavior of odd-length strings), 1 for CIDMap.
- * Return code : 0 - success, <0 - error,
+ * Return code : 0 - success, <0 - error,
* >0 - number of accessible bytes (client must cycle).
* - mru_index/pos are used as a hint where to start searching; NULLs for no hint.
*/
int string_array_access_proc(const gs_memory_t *mem, const ref *, int, ulong, uint,
- uint *mru_index, ulong *mru_pos, const byte **);
+ uint *mru_index, ulong *mru_pos, const byte **);
#endif /* ifont42_INCLUDED */
diff --git a/gs/psi/ifrpred.h b/gs/psi/ifrpred.h
index f1f460a19..05012e167 100644
--- a/gs/psi/ifrpred.h
+++ b/gs/psi/ifrpred.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
/* Exported by zfdecode.c for zfzlib.c */
int filter_read_predictor(i_ctx_t *i_ctx_p, int npop,
- const stream_template * template,
- stream_state * st);
+ const stream_template * template,
+ stream_state * st);
#endif /* ifrpred_INCLUDED */
diff --git a/gs/psi/ifunc.h b/gs/psi/ifunc.h
index 171b302f9..3e0ac6ee1 100644
--- a/gs/psi/ifunc.h
+++ b/gs/psi/ifunc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,7 +22,7 @@
/* Define build procedures for the various function types. */
#define build_function_proc(proc)\
int proc(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t *params, int depth,\
- gs_function_t **ppfn, gs_memory_t *mem)
+ gs_function_t **ppfn, gs_memory_t *mem)
typedef build_function_proc((*build_function_proc_t));
/* Define the table of build procedures, indexed by FunctionType. */
@@ -52,8 +52,8 @@ int buildfunction(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, int type);
* returned is 0, the caller must check whether *pparray == 0.
*/
int fn_build_float_array(const ref * op, const char *kstr, bool required,
- bool even, const float **pparray,
- gs_memory_t *mem);
+ bool even, const float **pparray,
+ gs_memory_t *mem);
/*
* Similar to fn_build_float_array() except
@@ -62,8 +62,7 @@ int fn_build_float_array(const ref * op, const char *kstr, bool required,
*/
int
fn_build_float_array_forced(const ref * op, const char *kstr, bool required,
- const float **pparray, gs_memory_t *mem);
-
+ const float **pparray, gs_memory_t *mem);
/*
* If a PostScript object is a Function procedure, return the function
diff --git a/gs/psi/ifwpred.h b/gs/psi/ifwpred.h
index e2e3f73b9..4060e67dd 100644
--- a/gs/psi/ifwpred.h
+++ b/gs/psi/ifwpred.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,7 +19,7 @@
/* Exported by zfilter2.c for zfzlib.c */
int filter_write_predictor(i_ctx_t *i_ctx_p, int npop,
- const stream_template * template,
- stream_state * st);
+ const stream_template * template,
+ stream_state * st);
#endif /* ifwpred_INCLUDED */
diff --git a/gs/psi/igc.c b/gs/psi/igc.c
index 924e632da..275d75504 100644
--- a/gs/psi/igc.c
+++ b/gs/psi/igc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -118,9 +118,9 @@ static void
end_phase(const char *str)
{
if (gs_debug_c('6')) {
- dlprintf1("[6]---------------- end %s ----------------\n",
- (const char *)str);
- dflush();
+ dlprintf1("[6]---------------- end %s ----------------\n",
+ (const char *)str);
+ dflush();
}
}
static const char *const depth_dots_string = "..........";
@@ -131,7 +131,7 @@ depth_dots(const ms_entry * sp, const gc_mark_stack * pms)
const gc_mark_stack *pss = pms;
while ((pss = pss->prev) != 0)
- depth += pss->count - 1;
+ depth += pss->count - 1;
return depth_dots_string + (depth >= 10 ? 0 : 10 - depth);
}
static void
@@ -141,8 +141,8 @@ gc_validate_spaces(gs_ref_memory_t **spaces, int max_space, gc_state_t *gcst)
gs_ref_memory_t *mem;
for (i = 1; i <= max_space; ++i)
- if ((mem = spaces[i]) != 0)
- ialloc_validate_memory(mem, gcst);
+ if ((mem = spaces[i]) != 0)
+ ialloc_validate_memory(mem, gcst);
}
#else /* !DEBUG */
# define end_phase(str) DO_NOTHING
@@ -165,8 +165,8 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
gs_gc_root_t *rp;
gc_state_t state;
struct _msd {
- gc_mark_stack stack;
- ms_entry body[ms_size_default];
+ gc_mark_stack stack;
+ ms_entry body[ms_size_default];
} ms_default;
gc_mark_stack *mark_stack = &ms_default.stack;
const gs_memory_t *cmem;
@@ -174,7 +174,7 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Optionally force global GC for debugging. */
if (I_FORCE_GLOBAL_GC)
- global = true;
+ global = true;
/* Determine which spaces we are tracing and collecting. */
@@ -185,18 +185,18 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
min_collect = max_trace = 2;
min_collect_vm_space = i_vm_global;
if (space_global->stable_memory != (gs_memory_t *)space_global)
- space_memories[++max_trace] =
- (gs_ref_memory_t *)space_global->stable_memory;
+ space_memories[++max_trace] =
+ (gs_ref_memory_t *)space_global->stable_memory;
if (space_global != space_local) {
- space_memories[++max_trace] = space_local;
- min_collect = max_trace;
- min_collect_vm_space = i_vm_local;
- if (space_local->stable_memory != (gs_memory_t *)space_local)
- space_memories[++max_trace] =
- (gs_ref_memory_t *)space_local->stable_memory;
+ space_memories[++max_trace] = space_local;
+ min_collect = max_trace;
+ min_collect_vm_space = i_vm_local;
+ if (space_local->stable_memory != (gs_memory_t *)space_local)
+ space_memories[++max_trace] =
+ (gs_ref_memory_t *)space_local->stable_memory;
}
if (global)
- min_collect = min_collect_vm_space = 1;
+ min_collect = min_collect_vm_space = 1;
#define for_spaces(i, n)\
for (i = 1; i <= n; ++i)
@@ -232,10 +232,10 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* so we mark and relocate the change and save lists properly. */
for_spaces(ispace, max_trace)
- gs_register_struct_root((gs_memory_t *)space_memories[ispace],
- &space_roots[ispace],
- (void **)&space_memories[ispace],
- "gc_top_level");
+ gs_register_struct_root((gs_memory_t *)space_memories[ispace],
+ &space_roots[ispace],
+ (void **)&space_memories[ispace],
+ "gc_top_level");
end_phase("register space roots");
@@ -250,15 +250,15 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
#endif
if (I_BYPASS_GC) { /* Don't collect at all. */
- goto no_collect;
+ goto no_collect;
}
/* Clear marks in spaces to be collected. */
for_collected_spaces(ispace)
- for_space_chunks(ispace, mem, cp) {
+ for_space_chunks(ispace, mem, cp) {
gc_objects_clear_marks((const gs_memory_t *)mem, cp);
- gc_strings_set_marks(cp, false);
+ gc_strings_set_marks(cp, false);
}
end_phase("clear chunk marks");
@@ -267,11 +267,11 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* since some roots are not in any chunk. */
for_roots(max_trace, mem, rp) {
- enum_ptr_t eptr;
+ enum_ptr_t eptr;
- eptr.ptr = *rp->p;
- if_debug_root('6', "[6]unmarking root", rp);
- (*rp->ptype->unmark)(&eptr, &state);
+ eptr.ptr = *rp->p;
+ if_debug_root('6', "[6]unmarking root", rp);
+ (*rp->ptype->unmark)(&eptr, &state);
}
end_phase("clear root marks");
@@ -279,7 +279,7 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
if (global) {
op_array_table *global_ops = get_global_op_array(cmem);
op_array_table *local_ops = get_local_op_array(cmem);
- gc_unmark_names(state.ntable, global_ops, local_ops);
+ gc_unmark_names(state.ntable, global_ops, local_ops);
}
/* Initialize the (default) mark stack. */
@@ -292,99 +292,99 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Also initialize the rescan pointers. */
{
- gc_mark_stack *end = mark_stack;
-
- for_chunks(max_trace, mem, cp) {
- uint avail = cp->ctop - cp->cbot;
-
- if (avail >= sizeof(gc_mark_stack) + sizeof(ms_entry) *
- ms_size_min &&
- !cp->inner_count
- ) {
- gc_mark_stack *pms = (gc_mark_stack *) cp->cbot;
-
- gc_init_mark_stack(pms, (avail - sizeof(gc_mark_stack)) /
- sizeof(ms_entry));
- end->next = pms;
- pms->prev = end;
- pms->on_heap = false;
- if_debug2('6', "[6]adding free 0x%lx(%u) to mark stack\n",
- (ulong) pms, pms->count);
- }
- cp->rescan_bot = cp->cend;
- cp->rescan_top = cp->cbase;
- }
+ gc_mark_stack *end = mark_stack;
+
+ for_chunks(max_trace, mem, cp) {
+ uint avail = cp->ctop - cp->cbot;
+
+ if (avail >= sizeof(gc_mark_stack) + sizeof(ms_entry) *
+ ms_size_min &&
+ !cp->inner_count
+ ) {
+ gc_mark_stack *pms = (gc_mark_stack *) cp->cbot;
+
+ gc_init_mark_stack(pms, (avail - sizeof(gc_mark_stack)) /
+ sizeof(ms_entry));
+ end->next = pms;
+ pms->prev = end;
+ pms->on_heap = false;
+ if_debug2('6', "[6]adding free 0x%lx(%u) to mark stack\n",
+ (ulong) pms, pms->count);
+ }
+ cp->rescan_bot = cp->cend;
+ cp->rescan_top = cp->cbase;
+ }
}
/* Mark reachable objects. */
{
- int more = 0;
+ int more = 0;
- /* Mark from roots. */
+ /* Mark from roots. */
- for_roots(max_trace, mem, rp) {
- if_debug_root('6', "[6]marking root", rp);
- more |= gc_trace(rp, &state, mark_stack);
- }
+ for_roots(max_trace, mem, rp) {
+ if_debug_root('6', "[6]marking root", rp);
+ more |= gc_trace(rp, &state, mark_stack);
+ }
- end_phase("mark");
+ end_phase("mark");
- /* If this is a local GC, mark from non-local chunks. */
+ /* If this is a local GC, mark from non-local chunks. */
- if (!global)
- for_chunks(min_collect - 1, mem, cp)
- more |= gc_trace_chunk((const gs_memory_t *)mem, cp, &state, mark_stack);
+ if (!global)
+ for_chunks(min_collect - 1, mem, cp)
+ more |= gc_trace_chunk((const gs_memory_t *)mem, cp, &state, mark_stack);
- /* Handle mark stack overflow. */
+ /* Handle mark stack overflow. */
- while (more < 0) { /* stack overflowed */
- more = 0;
- for_chunks(max_trace, mem, cp)
- more |= gc_rescan_chunk(cp, &state, mark_stack);
- }
+ while (more < 0) { /* stack overflowed */
+ more = 0;
+ for_chunks(max_trace, mem, cp)
+ more |= gc_rescan_chunk(cp, &state, mark_stack);
+ }
- end_phase("mark overflow");
+ end_phase("mark overflow");
}
/* Free the mark stack. */
{
- gc_mark_stack *pms = mark_stack;
-
- while (pms->next)
- pms = pms->next;
- while (pms) {
- gc_mark_stack *prev = pms->prev;
-
- if (pms->on_heap)
- gs_free_object(state.heap, pms, "gc mark stack");
- else
- gs_alloc_fill(pms, gs_alloc_fill_free,
- sizeof(*pms) + sizeof(ms_entry) * pms->count);
- pms = prev;
- }
+ gc_mark_stack *pms = mark_stack;
+
+ while (pms->next)
+ pms = pms->next;
+ while (pms) {
+ gc_mark_stack *prev = pms->prev;
+
+ if (pms->on_heap)
+ gs_free_object(state.heap, pms, "gc mark stack");
+ else
+ gs_alloc_fill(pms, gs_alloc_fill_free,
+ sizeof(*pms) + sizeof(ms_entry) * pms->count);
+ pms = prev;
+ }
}
end_phase("free mark stack");
if (global) {
- gc_trace_finish(&state);
- names_trace_finish(state.ntable, &state);
+ gc_trace_finish(&state);
+ names_trace_finish(state.ntable, &state);
- end_phase("finish trace");
+ end_phase("finish trace");
}
/* Filter save change lists with removing elements,
which point to unmarked blocks of refs. */
{
- int i;
+ int i;
- for_collected_spaces(i) {
- gs_ref_memory_t *mem = space_memories[i];
+ for_collected_spaces(i) {
+ gs_ref_memory_t *mem = space_memories[i];
- alloc_save__filter_changes(mem);
- }
+ alloc_save__filter_changes(mem);
+ }
}
/* Clear marks and relocation in spaces that are only being traced. */
/* We have to clear the marks first, because we want the */
@@ -396,7 +396,7 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
end_phase("post-clear marks");
for_chunks(min_collect - 1, mem, cp)
- gc_clear_reloc(cp);
+ gc_clear_reloc(cp);
end_phase("clear reloc");
@@ -407,26 +407,26 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Disable freeing in the allocators of the spaces we are */
/* collecting, so finalization procedures won't cause problems. */
{
- int i;
+ int i;
- for_collected_spaces(i)
- gs_enable_free((gs_memory_t *)space_memories[i], false);
+ for_collected_spaces(i)
+ gs_enable_free((gs_memory_t *)space_memories[i], false);
}
/* Compute relocation based on marks, in the spaces */
/* we are going to compact. Also finalize freed objects. */
for_collected_chunks(mem, cp) {
- gc_objects_set_reloc(&state, cp);
- gc_strings_set_reloc(cp);
+ gc_objects_set_reloc(&state, cp);
+ gc_strings_set_reloc(cp);
}
/* Re-enable freeing. */
{
- int i;
+ int i;
- for_collected_spaces(i)
- gs_enable_free((gs_memory_t *)space_memories[i], true);
+ for_collected_spaces(i)
+ gs_enable_free((gs_memory_t *)space_memories[i], true);
}
end_phase("set reloc");
@@ -435,26 +435,26 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
state.relocating_untraced = true;
for_chunks(min_collect - 1, mem, cp)
- gc_do_reloc(cp, mem, &state);
+ gc_do_reloc(cp, mem, &state);
state.relocating_untraced = false;
for_collected_chunks(mem, cp)
- gc_do_reloc(cp, mem, &state);
+ gc_do_reloc(cp, mem, &state);
end_phase("relocate chunks");
for_roots(max_trace, mem, rp) {
- if_debug3('6', "[6]relocating root 0x%lx: 0x%lx -> 0x%lx\n",
- (ulong) rp, (ulong) rp->p, (ulong) * rp->p);
- if (rp->ptype == ptr_ref_type) {
- ref *pref = (ref *) * rp->p;
-
- igc_reloc_refs((ref_packed *) pref,
- (ref_packed *) (pref + 1),
- &state);
- } else
- *rp->p = (*rp->ptype->reloc) (*rp->p, &state);
- if_debug3('6', "[6]relocated root 0x%lx: 0x%lx -> 0x%lx\n",
- (ulong) rp, (ulong) rp->p, (ulong) * rp->p);
+ if_debug3('6', "[6]relocating root 0x%lx: 0x%lx -> 0x%lx\n",
+ (ulong) rp, (ulong) rp->p, (ulong) * rp->p);
+ if (rp->ptype == ptr_ref_type) {
+ ref *pref = (ref *) * rp->p;
+
+ igc_reloc_refs((ref_packed *) pref,
+ (ref_packed *) (pref + 1),
+ &state);
+ } else
+ *rp->p = (*rp->ptype->reloc) (*rp->p, &state);
+ if_debug3('6', "[6]relocated root 0x%lx: 0x%lx -> 0x%lx\n",
+ (ulong) rp, (ulong) rp->p, (ulong) * rp->p);
}
end_phase("relocate roots");
@@ -462,18 +462,18 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Compact data. We only do this for spaces we are collecting. */
for_collected_spaces(ispace) {
- for_space_mems(ispace, mem) {
- for_mem_chunks(mem, cp) {
- if_debug_chunk('6', "[6]compacting chunk", cp);
- gc_objects_compact(cp, &state);
- gc_strings_compact(cp);
- if_debug_chunk('6', "[6]after compaction:", cp);
- if (mem->pcc == cp)
- mem->cc = *cp;
- }
- mem->saved = mem->reloc_saved;
- ialloc_reset_free(mem);
- }
+ for_space_mems(ispace, mem) {
+ for_mem_chunks(mem, cp) {
+ if_debug_chunk('6', "[6]compacting chunk", cp);
+ gc_objects_compact(cp, &state);
+ gc_strings_compact(cp);
+ if_debug_chunk('6', "[6]after compaction:", cp);
+ if (mem->pcc == cp)
+ mem->cc = *cp;
+ }
+ mem->saved = mem->reloc_saved;
+ ialloc_reset_free(mem);
+ }
}
end_phase("compact");
@@ -481,8 +481,8 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Free empty chunks. */
for_collected_spaces(ispace) {
- for_space_mems(ispace, mem) {
- gc_free_empty_chunks(mem);
+ for_space_mems(ispace, mem) {
+ gc_free_empty_chunks(mem);
}
}
@@ -498,37 +498,37 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
*/
for_collected_spaces(ispace) { /* Reverse the pointers. */
- alloc_save_t *curr;
- alloc_save_t *prev = 0;
- alloc_save_t *next;
- gs_memory_status_t total;
-
- for (curr = space_memories[ispace]->saved; curr != 0;
- prev = curr, curr = next
- ) {
- next = curr->state.saved;
- curr->state.saved = prev;
- }
- /* Now work the other way, accumulating the values. */
- total.allocated = 0, total.used = 0;
- for (curr = prev, prev = 0; curr != 0;
- prev = curr, curr = next
- ) {
- mem = &curr->state;
- next = mem->saved;
- mem->saved = prev;
- mem->previous_status = total;
- if_debug3('6',
- "[6]0x%lx previous allocated=%lu, used=%lu\n",
- (ulong) mem, total.allocated, total.used);
- gs_memory_status((gs_memory_t *) mem, &total);
- mem->gc_allocated = mem->allocated + total.allocated;
- }
- mem = space_memories[ispace];
- mem->previous_status = total;
- mem->gc_allocated = mem->allocated + total.allocated;
- if_debug3('6', "[6]0x%lx previous allocated=%lu, used=%lu\n",
- (ulong) mem, total.allocated, total.used);
+ alloc_save_t *curr;
+ alloc_save_t *prev = 0;
+ alloc_save_t *next;
+ gs_memory_status_t total;
+
+ for (curr = space_memories[ispace]->saved; curr != 0;
+ prev = curr, curr = next
+ ) {
+ next = curr->state.saved;
+ curr->state.saved = prev;
+ }
+ /* Now work the other way, accumulating the values. */
+ total.allocated = 0, total.used = 0;
+ for (curr = prev, prev = 0; curr != 0;
+ prev = curr, curr = next
+ ) {
+ mem = &curr->state;
+ next = mem->saved;
+ mem->saved = prev;
+ mem->previous_status = total;
+ if_debug3('6',
+ "[6]0x%lx previous allocated=%lu, used=%lu\n",
+ (ulong) mem, total.allocated, total.used);
+ gs_memory_status((gs_memory_t *) mem, &total);
+ mem->gc_allocated = mem->allocated + total.allocated;
+ }
+ mem = space_memories[ispace];
+ mem->previous_status = total;
+ mem->gc_allocated = mem->allocated + total.allocated;
+ if_debug3('6', "[6]0x%lx previous allocated=%lu, used=%lu\n",
+ (ulong) mem, total.allocated, total.used);
}
end_phase("update stats");
@@ -538,8 +538,8 @@ gs_gc_reclaim(vm_spaces * pspaces, bool global)
/* Unregister the allocator roots. */
for_spaces(ispace, max_trace)
- gs_unregister_root((gs_memory_t *)space_memories[ispace],
- &space_roots[ispace], "gc_top_level");
+ gs_unregister_root((gs_memory_t *)space_memories[ispace],
+ &space_roots[ispace], "gc_top_level");
end_phase("unregister space roots");
@@ -573,7 +573,7 @@ ptr_struct_unmark(enum_ptr_t *pep, gc_state_t * ignored)
void *const vptr = (void *)pep->ptr; /* break const */
if (vptr != 0)
- o_set_unmarked(((obj_header_t *) vptr - 1));
+ o_set_unmarked(((obj_header_t *) vptr - 1));
}
/* Unmark a single string. */
@@ -589,16 +589,16 @@ gc_objects_clear_marks(const gs_memory_t *mem, chunk_t * cp)
{
if_debug_chunk('6', "[6]unmarking chunk", cp);
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- struct_proc_clear_marks((*proc)) =
- pre->o_type->clear_marks;
+ DO_ALL
+ struct_proc_clear_marks((*proc)) =
+ pre->o_type->clear_marks;
#ifdef DEBUG
if (pre->o_type != &st_free)
- debug_check_object(pre, cp, NULL);
+ debug_check_object(pre, cp, NULL);
#endif
if_debug3('7', " [7](un)marking %s(%lu) 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) size, (ulong) pre);
+ struct_type_name_string(pre->o_type),
+ (ulong) size, (ulong) pre);
o_set_unmarked(pre);
if (proc != 0)
(*proc) (mem, pre + 1, size, pre->o_type);
@@ -615,14 +615,14 @@ gc_unmark_names(name_table * nt, op_array_table *op_array_table_global,
names_unmark_all(nt);
for (i = 0; i < op_array_table_global->count; i++) {
- name_index_t nidx = op_array_table_global->nx_table[i];
+ name_index_t nidx = op_array_table_global->nx_table[i];
- names_mark_index(nt, nidx);
+ names_mark_index(nt, nidx);
}
for (i = 0; i < op_array_table_local->count; i++) {
- name_index_t nidx = op_array_table_local->nx_table[i];
+ name_index_t nidx = op_array_table_local->nx_table[i];
- names_mark_index(nt, nidx);
+ names_mark_index(nt, nidx);
}
}
@@ -652,57 +652,57 @@ gc_rescan_chunk(chunk_t * cp, gc_state_t * pstate, gc_mark_stack * pmstack)
const gs_memory_t *mem = gcst_get_memory_ptr( pstate );
if (sbot > stop)
- return 0;
+ return 0;
root.p = &comp;
if_debug_chunk('6', "[6]rescanning chunk", cp);
cp->rescan_bot = cp->cend;
cp->rescan_top = cp->cbase;
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- if ((byte *) (pre + 1) + size < sbot);
+ DO_ALL
+ if ((byte *) (pre + 1) + size < sbot);
else if ((byte *) (pre + 1) > stop)
- return more; /* 'break' won't work here */
+ return more; /* 'break' won't work here */
else {
- if_debug2('7', " [7]scanning/marking 0x%lx(%lu)\n",
- (ulong) pre, (ulong) size);
- if (pre->o_type == &st_refs) {
- ref_packed *rp = (ref_packed *) (pre + 1);
- char *end = (char *)rp + size;
-
- root.ptype = ptr_ref_type;
- while ((char *)rp < end) {
- comp = rp;
- if (r_is_packed(rp)) {
- if (r_has_pmark(rp)) {
- r_clear_pmark(rp);
- more |= gc_trace(&root, pstate,
- pmstack);
- }
- rp++;
- } else {
- ref *const pref = (ref *)rp;
-
- if (r_has_attr(pref, l_mark)) {
- r_clear_attrs(pref, l_mark);
- more |= gc_trace(&root, pstate, pmstack);
- }
- rp += packed_per_ref;
- }
- }
- } else if (!o_is_unmarked(pre)) {
- struct_proc_clear_marks((*proc)) =
- pre->o_type->clear_marks;
- root.ptype = ptr_struct_type;
- comp = pre + 1;
- if (!o_is_untraced(pre))
- o_set_unmarked(pre);
- if (proc != 0)
- (*proc) (mem, comp, size, pre->o_type);
- more |= gc_trace(&root, pstate, pmstack);
- }
+ if_debug2('7', " [7]scanning/marking 0x%lx(%lu)\n",
+ (ulong) pre, (ulong) size);
+ if (pre->o_type == &st_refs) {
+ ref_packed *rp = (ref_packed *) (pre + 1);
+ char *end = (char *)rp + size;
+
+ root.ptype = ptr_ref_type;
+ while ((char *)rp < end) {
+ comp = rp;
+ if (r_is_packed(rp)) {
+ if (r_has_pmark(rp)) {
+ r_clear_pmark(rp);
+ more |= gc_trace(&root, pstate,
+ pmstack);
+ }
+ rp++;
+ } else {
+ ref *const pref = (ref *)rp;
+
+ if (r_has_attr(pref, l_mark)) {
+ r_clear_attrs(pref, l_mark);
+ more |= gc_trace(&root, pstate, pmstack);
+ }
+ rp += packed_per_ref;
+ }
+ }
+ } else if (!o_is_unmarked(pre)) {
+ struct_proc_clear_marks((*proc)) =
+ pre->o_type->clear_marks;
+ root.ptype = ptr_struct_type;
+ comp = pre + 1;
+ if (!o_is_untraced(pre))
+ o_set_unmarked(pre);
+ if (proc != 0)
+ (*proc) (mem, comp, size, pre->o_type);
+ more |= gc_trace(&root, pstate, pmstack);
+ }
}
END_OBJECTS_SCAN
- return more;
+ return more;
}
/* Mark starting from all the objects in a chunk. */
@@ -719,46 +719,46 @@ gc_trace_chunk(const gs_memory_t *mem, chunk_t * cp, gc_state_t * pstate, gc_mar
root.p = &comp;
if_debug_chunk('6', "[6]marking from chunk", cp);
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
+ DO_ALL
{
- if_debug2('7', " [7]scanning/marking 0x%lx(%lu)\n",
- (ulong) pre, (ulong) size);
- if (pre->o_type == &st_refs) {
- ref_packed *rp = (ref_packed *) (pre + 1);
- char *end = (char *)rp + size;
-
- root.ptype = ptr_ref_type;
- while ((char *)rp < end) {
- comp = rp;
- if (r_is_packed(rp)) { /* No packed refs need tracing. */
- rp++;
- } else {
- ref *const pref = (ref *)rp;
-
- if (r_space(pref) >= min_trace) {
- r_clear_attrs(pref, l_mark);
- more |= gc_trace(&root, pstate, pmstack);
- }
- rp += packed_per_ref;
- }
- }
- } else if (!o_is_unmarked(pre)) {
- if (!o_is_untraced(pre))
- o_set_unmarked(pre);
- if (pre->o_type != &st_free) {
- struct_proc_clear_marks((*proc)) =
- pre->o_type->clear_marks;
-
- root.ptype = ptr_struct_type;
- comp = pre + 1;
- if (proc != 0)
- (*proc) (mem, comp, size, pre->o_type);
- more |= gc_trace(&root, pstate, pmstack);
- }
- }
+ if_debug2('7', " [7]scanning/marking 0x%lx(%lu)\n",
+ (ulong) pre, (ulong) size);
+ if (pre->o_type == &st_refs) {
+ ref_packed *rp = (ref_packed *) (pre + 1);
+ char *end = (char *)rp + size;
+
+ root.ptype = ptr_ref_type;
+ while ((char *)rp < end) {
+ comp = rp;
+ if (r_is_packed(rp)) { /* No packed refs need tracing. */
+ rp++;
+ } else {
+ ref *const pref = (ref *)rp;
+
+ if (r_space(pref) >= min_trace) {
+ r_clear_attrs(pref, l_mark);
+ more |= gc_trace(&root, pstate, pmstack);
+ }
+ rp += packed_per_ref;
+ }
+ }
+ } else if (!o_is_unmarked(pre)) {
+ if (!o_is_untraced(pre))
+ o_set_unmarked(pre);
+ if (pre->o_type != &st_free) {
+ struct_proc_clear_marks((*proc)) =
+ pre->o_type->clear_marks;
+
+ root.ptype = ptr_struct_type;
+ comp = pre + 1;
+ if (proc != 0)
+ (*proc) (mem, comp, size, pre->o_type);
+ more |= gc_trace(&root, pstate, pmstack);
+ }
+ }
}
END_OBJECTS_SCAN
- return more;
+ return more;
}
/* Recursively mark from a (root) pointer. */
@@ -784,235 +784,235 @@ gc_trace(gs_gc_root_t * rp, gc_state_t * pstate, gc_mark_stack * pmstack)
#define mark_name(nidx)\
BEGIN\
if (names_mark_index(nt, nidx)) {\
- new |= 1;\
- if_debug2('8', " [8]marked name 0x%lx(%u)\n",\
- (ulong)names_index_ptr(nt, nidx), nidx);\
+ new |= 1;\
+ if_debug2('8', " [8]marked name 0x%lx(%u)\n",\
+ (ulong)names_index_ptr(nt, nidx), nidx);\
}\
END
nptr = *rp->p;
if (nptr == 0)
- return 0;
+ return 0;
/* Initialize the stack */
sp->ptr = nptr;
if (rp->ptype == ptr_ref_type)
- sp->index = 1, sp->is_refs = true;
+ sp->index = 1, sp->is_refs = true;
else {
- sp->index = 0, sp->is_refs = false;
- nep.ptr = nptr;
- if ((*rp->ptype->mark) (&nep, pstate))
- new |= 1;
+ sp->index = 0, sp->is_refs = false;
+ nep.ptr = nptr;
+ if ((*rp->ptype->mark) (&nep, pstate))
+ new |= 1;
}
for (;;) {
- gs_ptr_type_t ptp;
+ gs_ptr_type_t ptp;
- /*
- * The following should really be an if..else, but that
- * would force unnecessary is_refs tests.
- */
- if (sp->is_refs)
- goto do_refs;
+ /*
+ * The following should really be an if..else, but that
+ * would force unnecessary is_refs tests.
+ */
+ if (sp->is_refs)
+ goto do_refs;
- /* ---------------- Structure ---------------- */
+ /* ---------------- Structure ---------------- */
do_struct:
- {
- obj_header_t *ptr = sp->ptr;
-
- struct_proc_enum_ptrs((*mproc));
-
- if (ptr == 0) { /* We've reached the bottom of a stack segment. */
- pms = pms->prev;
- if (pms == 0)
- break; /* all done */
- stop = pms->entries + pms->count - 1;
- sp = stop;
- continue;
- }
- debug_check_object(ptr - 1, NULL, NULL);
- ts:if_debug4('7', " [7]%smarking %s 0x%lx[%u]",
- depth_dots(sp, pms),
- struct_type_name_string(ptr[-1].o_type),
- (ulong) ptr, sp->index);
- mproc = ptr[-1].o_type->enum_ptrs;
- if (mproc == gs_no_struct_enum_ptrs ||
- (ptp = (*mproc)
- (gcst_get_memory_ptr(pstate), ptr, pre_obj_contents_size(ptr - 1),
- sp->index, &nep, ptr[-1].o_type, pstate)) == 0
- ) {
- if_debug0('7', " - done\n");
- sp--;
- continue;
- }
- /* The cast in the following statement is the one */
- /* place we need to break 'const' to make the */
- /* template for pointer enumeration work. */
- nptr = (void *)nep.ptr;
- sp->index++;
- if_debug1('7', " = 0x%lx\n", (ulong) nptr);
- /* Descend into nep.ptr, whose pointer type is ptp. */
- if (ptp == ptr_struct_type) {
- sp[1].index = 0;
- sp[1].is_refs = false;
- if (sp == stop)
- goto push;
- if (!ptr_struct_mark(&nep, pstate))
- goto ts;
- new |= 1;
- (++sp)->ptr = nptr;
- goto do_struct;
- } else if (ptp == ptr_ref_type) {
- sp[1].index = 1;
- sp[1].is_refs = true;
- if (sp == stop)
- goto push;
- new |= 1;
- (++sp)->ptr = nptr;
- goto do_refs;
- } else { /* We assume this is some non-pointer- */
- /* containing type. */
- if ((*ptp->mark) (&nep, pstate))
- new |= 1;
- goto ts;
- }
- }
-
- /* ---------------- Refs ---------------- */
+ {
+ obj_header_t *ptr = sp->ptr;
+
+ struct_proc_enum_ptrs((*mproc));
+
+ if (ptr == 0) { /* We've reached the bottom of a stack segment. */
+ pms = pms->prev;
+ if (pms == 0)
+ break; /* all done */
+ stop = pms->entries + pms->count - 1;
+ sp = stop;
+ continue;
+ }
+ debug_check_object(ptr - 1, NULL, NULL);
+ ts:if_debug4('7', " [7]%smarking %s 0x%lx[%u]",
+ depth_dots(sp, pms),
+ struct_type_name_string(ptr[-1].o_type),
+ (ulong) ptr, sp->index);
+ mproc = ptr[-1].o_type->enum_ptrs;
+ if (mproc == gs_no_struct_enum_ptrs ||
+ (ptp = (*mproc)
+ (gcst_get_memory_ptr(pstate), ptr, pre_obj_contents_size(ptr - 1),
+ sp->index, &nep, ptr[-1].o_type, pstate)) == 0
+ ) {
+ if_debug0('7', " - done\n");
+ sp--;
+ continue;
+ }
+ /* The cast in the following statement is the one */
+ /* place we need to break 'const' to make the */
+ /* template for pointer enumeration work. */
+ nptr = (void *)nep.ptr;
+ sp->index++;
+ if_debug1('7', " = 0x%lx\n", (ulong) nptr);
+ /* Descend into nep.ptr, whose pointer type is ptp. */
+ if (ptp == ptr_struct_type) {
+ sp[1].index = 0;
+ sp[1].is_refs = false;
+ if (sp == stop)
+ goto push;
+ if (!ptr_struct_mark(&nep, pstate))
+ goto ts;
+ new |= 1;
+ (++sp)->ptr = nptr;
+ goto do_struct;
+ } else if (ptp == ptr_ref_type) {
+ sp[1].index = 1;
+ sp[1].is_refs = true;
+ if (sp == stop)
+ goto push;
+ new |= 1;
+ (++sp)->ptr = nptr;
+ goto do_refs;
+ } else { /* We assume this is some non-pointer- */
+ /* containing type. */
+ if ((*ptp->mark) (&nep, pstate))
+ new |= 1;
+ goto ts;
+ }
+ }
+
+ /* ---------------- Refs ---------------- */
do_refs:
- {
- ref_packed *pptr = sp->ptr;
- ref *rptr;
-
- tr:if (!sp->index) {
- --sp;
- continue;
- }
- --(sp->index);
- if_debug3('8', " [8]%smarking refs 0x%lx[%u]\n",
- depth_dots(sp, pms), (ulong) pptr, sp->index);
- if (r_is_packed(pptr)) {
- if (!r_has_pmark(pptr)) {
- r_set_pmark(pptr);
- new |= 1;
- if (r_packed_is_name(pptr)) {
- name_index_t nidx = packed_name_index(pptr);
-
- mark_name(nidx);
- }
- }
- ++pptr;
- goto tr;
- }
- rptr = (ref *) pptr; /* * const beyond here */
- if (r_has_attr(rptr, l_mark)) {
- pptr = (ref_packed *)(rptr + 1);
- goto tr;
- }
- r_set_attrs(rptr, l_mark);
- new |= 1;
- if (r_space(rptr) < min_trace) { /* Note that this always picks up all scalars. */
- pptr = (ref_packed *) (rptr + 1);
- goto tr;
- }
- sp->ptr = rptr + 1;
- switch (r_type(rptr)) {
- /* Struct cases */
- case t_file:
- nptr = rptr->value.pfile;
- rs:sp[1].is_refs = false;
- sp[1].index = 0;
- if (sp == stop) {
- ptp = ptr_struct_type;
- break;
- }
- nep.ptr = nptr;
- if (!ptr_struct_mark(&nep, pstate))
- goto nr;
- new |= 1;
- (++sp)->ptr = nptr;
- goto do_struct;
- case t_device:
- nptr = rptr->value.pdevice;
- goto rs;
- case t_fontID:
- case t_struct:
- case t_astruct:
- nptr = rptr->value.pstruct;
- goto rs;
- /* Non-trivial non-struct cases */
- case t_dictionary:
- nptr = rptr->value.pdict;
- sp[1].index = sizeof(dict) / sizeof(ref);
- goto rrp;
- case t_array:
- nptr = rptr->value.refs;
- rr:if ((sp[1].index = r_size(rptr)) == 0) { /* Set the base pointer to 0, */
- /* so we never try to relocate it. */
- rptr->value.refs = 0;
- goto nr;
- }
- rrp:
- rrc:sp[1].is_refs = true;
- if (sp == stop) {
- /*
- * The following initialization is unnecessary:
- * ptp will not be used if sp[1].is_refs = true.
- * We put this here solely to get rid of bogus
- * "possibly uninitialized variable" warnings
- * from certain compilers.
- */
- ptp = ptr_ref_type;
- break;
- }
- new |= 1;
- (++sp)->ptr = nptr;
- goto do_refs;
- case t_mixedarray:
- case t_shortarray:
- nptr = rptr->value.writable_packed;
- goto rr;
- case t_name:
- mark_name(names_index(nt, rptr));
- nr:pptr = (ref_packed *) (rptr + 1);
- goto tr;
- case t_string:
- if (gc_string_mark(rptr->value.bytes, r_size(rptr), true, pstate))
- new |= 1;
- goto nr;
- case t_oparray:
- nptr = rptr->value.refs; /* discard const */
- sp[1].index = 1;
- goto rrc;
- default:
- goto nr;
- }
- }
-
- /* ---------------- Recursion ---------------- */
+ {
+ ref_packed *pptr = sp->ptr;
+ ref *rptr;
+
+ tr:if (!sp->index) {
+ --sp;
+ continue;
+ }
+ --(sp->index);
+ if_debug3('8', " [8]%smarking refs 0x%lx[%u]\n",
+ depth_dots(sp, pms), (ulong) pptr, sp->index);
+ if (r_is_packed(pptr)) {
+ if (!r_has_pmark(pptr)) {
+ r_set_pmark(pptr);
+ new |= 1;
+ if (r_packed_is_name(pptr)) {
+ name_index_t nidx = packed_name_index(pptr);
+
+ mark_name(nidx);
+ }
+ }
+ ++pptr;
+ goto tr;
+ }
+ rptr = (ref *) pptr; /* * const beyond here */
+ if (r_has_attr(rptr, l_mark)) {
+ pptr = (ref_packed *)(rptr + 1);
+ goto tr;
+ }
+ r_set_attrs(rptr, l_mark);
+ new |= 1;
+ if (r_space(rptr) < min_trace) { /* Note that this always picks up all scalars. */
+ pptr = (ref_packed *) (rptr + 1);
+ goto tr;
+ }
+ sp->ptr = rptr + 1;
+ switch (r_type(rptr)) {
+ /* Struct cases */
+ case t_file:
+ nptr = rptr->value.pfile;
+ rs:sp[1].is_refs = false;
+ sp[1].index = 0;
+ if (sp == stop) {
+ ptp = ptr_struct_type;
+ break;
+ }
+ nep.ptr = nptr;
+ if (!ptr_struct_mark(&nep, pstate))
+ goto nr;
+ new |= 1;
+ (++sp)->ptr = nptr;
+ goto do_struct;
+ case t_device:
+ nptr = rptr->value.pdevice;
+ goto rs;
+ case t_fontID:
+ case t_struct:
+ case t_astruct:
+ nptr = rptr->value.pstruct;
+ goto rs;
+ /* Non-trivial non-struct cases */
+ case t_dictionary:
+ nptr = rptr->value.pdict;
+ sp[1].index = sizeof(dict) / sizeof(ref);
+ goto rrp;
+ case t_array:
+ nptr = rptr->value.refs;
+ rr:if ((sp[1].index = r_size(rptr)) == 0) { /* Set the base pointer to 0, */
+ /* so we never try to relocate it. */
+ rptr->value.refs = 0;
+ goto nr;
+ }
+ rrp:
+ rrc:sp[1].is_refs = true;
+ if (sp == stop) {
+ /*
+ * The following initialization is unnecessary:
+ * ptp will not be used if sp[1].is_refs = true.
+ * We put this here solely to get rid of bogus
+ * "possibly uninitialized variable" warnings
+ * from certain compilers.
+ */
+ ptp = ptr_ref_type;
+ break;
+ }
+ new |= 1;
+ (++sp)->ptr = nptr;
+ goto do_refs;
+ case t_mixedarray:
+ case t_shortarray:
+ nptr = rptr->value.writable_packed;
+ goto rr;
+ case t_name:
+ mark_name(names_index(nt, rptr));
+ nr:pptr = (ref_packed *) (rptr + 1);
+ goto tr;
+ case t_string:
+ if (gc_string_mark(rptr->value.bytes, r_size(rptr), true, pstate))
+ new |= 1;
+ goto nr;
+ case t_oparray:
+ nptr = rptr->value.refs; /* discard const */
+ sp[1].index = 1;
+ goto rrc;
+ default:
+ goto nr;
+ }
+ }
+
+ /* ---------------- Recursion ---------------- */
push:
- if (sp == stop) { /* The current segment is full. */
- int new_added = gc_extend_stack(pms, pstate);
-
- if (new_added) {
- new |= new_added;
- continue;
- }
- pms = pms->next;
- stop = pms->entries + pms->count - 1;
- pms->entries[1] = sp[1];
- sp = pms->entries;
- }
- /* index and is_refs are already set */
- if (!sp[1].is_refs) {
- nep.ptr = nptr;
- if (!(*ptp->mark) (&nep, pstate))
- continue;
- new |= 1;
- }
- (++sp)->ptr = nptr;
+ if (sp == stop) { /* The current segment is full. */
+ int new_added = gc_extend_stack(pms, pstate);
+
+ if (new_added) {
+ new |= new_added;
+ continue;
+ }
+ pms = pms->next;
+ stop = pms->entries + pms->count - 1;
+ pms->entries[1] = sp[1];
+ sp = pms->entries;
+ }
+ /* index and is_refs are already set */
+ if (!sp[1].is_refs) {
+ nep.ptr = nptr;
+ if (!(*ptp->mark) (&nep, pstate))
+ continue;
+ new |= 1;
+ }
+ (++sp)->ptr = nptr;
}
return new;
}
@@ -1022,38 +1022,38 @@ static int
gc_extend_stack(gc_mark_stack * pms, gc_state_t * pstate)
{
if (pms->next == 0) { /* Try to allocate another segment. */
- uint count;
-
- for (count = ms_size_desired; count >= ms_size_min; count >>= 1) {
- pms->next = (gc_mark_stack *)
- gs_alloc_bytes_immovable(pstate->heap,
- sizeof(gc_mark_stack) +
- sizeof(ms_entry) * count,
- "gc mark stack");
- if (pms->next != 0)
- break;
- }
- if (pms->next == 0) { /* The mark stack overflowed. */
- ms_entry *sp = pms->entries + pms->count - 1;
- byte *cptr = sp->ptr; /* container */
- chunk_t *cp = gc_locate(cptr, pstate);
- int new = 1;
-
- if (cp == 0) { /* We were tracing outside collectible */
- /* storage. This can't happen. */
- lprintf1("mark stack overflowed while outside collectible space at 0x%lx!\n",
- (ulong) cptr);
- gs_abort(pstate->heap);
- }
- if (cptr < cp->rescan_bot)
- cp->rescan_bot = cptr, new = -1;
- if (cptr > cp->rescan_top)
- cp->rescan_top = cptr, new = -1;
- return new;
- }
- gc_init_mark_stack(pms->next, count);
- pms->next->prev = pms;
- pms->next->on_heap = true;
+ uint count;
+
+ for (count = ms_size_desired; count >= ms_size_min; count >>= 1) {
+ pms->next = (gc_mark_stack *)
+ gs_alloc_bytes_immovable(pstate->heap,
+ sizeof(gc_mark_stack) +
+ sizeof(ms_entry) * count,
+ "gc mark stack");
+ if (pms->next != 0)
+ break;
+ }
+ if (pms->next == 0) { /* The mark stack overflowed. */
+ ms_entry *sp = pms->entries + pms->count - 1;
+ byte *cptr = sp->ptr; /* container */
+ chunk_t *cp = gc_locate(cptr, pstate);
+ int new = 1;
+
+ if (cp == 0) { /* We were tracing outside collectible */
+ /* storage. This can't happen. */
+ lprintf1("mark stack overflowed while outside collectible space at 0x%lx!\n",
+ (ulong) cptr);
+ gs_abort(pstate->heap);
+ }
+ if (cptr < cp->rescan_bot)
+ cp->rescan_bot = cptr, new = -1;
+ if (cptr > cp->rescan_top)
+ cp->rescan_top = cptr, new = -1;
+ return new;
+ }
+ gc_init_mark_stack(pms->next, count);
+ pms->next->prev = pms;
+ pms->next->on_heap = true;
}
return 0;
}
@@ -1065,10 +1065,10 @@ ptr_struct_mark(enum_ptr_t *pep, gc_state_t * ignored)
obj_header_t *ptr = (obj_header_t *)pep->ptr;
if (ptr == 0)
- return false;
+ return false;
ptr--; /* point to header */
if (!o_is_unmarked(ptr))
- return false;
+ return false;
o_mark(ptr);
return true;
}
@@ -1089,22 +1089,22 @@ gc_trace_finish(gc_state_t * pstate)
bool marked = false;
while ((nidx = names_next_valid_index(nt, nidx)) != 0) {
- name_string_t *pnstr = names_index_string_inline(nt, nidx);
-
- if (pnstr->mark) {
- enum_ptr_t enst, ensst;
-
- if (!pnstr->foreign_string &&
- gc_string_mark(pnstr->string_bytes, pnstr->string_size,
- true, pstate)
- )
- marked = true;
- enst.ptr = names_index_sub_table(nt, nidx);
- ensst.ptr = names_index_string_sub_table(nt, nidx);
- marked |=
- ptr_struct_mark(&enst, pstate) |
- ptr_struct_mark(&ensst, pstate);
- }
+ name_string_t *pnstr = names_index_string_inline(nt, nidx);
+
+ if (pnstr->mark) {
+ enum_ptr_t enst, ensst;
+
+ if (!pnstr->foreign_string &&
+ gc_string_mark(pnstr->string_bytes, pnstr->string_size,
+ true, pstate)
+ )
+ marked = true;
+ enst.ptr = names_index_sub_table(nt, nidx);
+ ensst.ptr = names_index_string_sub_table(nt, nidx);
+ marked |=
+ ptr_struct_mark(&enst, pstate) |
+ ptr_struct_mark(&ensst, pstate);
+ }
}
return marked;
}
@@ -1119,7 +1119,7 @@ gc_init_reloc(chunk_t * cp)
chead->dest = cp->cbase;
chead->free.o_back =
- offset_of(chunk_head_t, free) >> obj_back_shift;
+ offset_of(chunk_head_t, free) >> obj_back_shift;
chead->free.o_size = sizeof(obj_header_t);
chead->free.o_nreloc = 0;
}
@@ -1132,16 +1132,16 @@ gc_clear_reloc(chunk_t * cp)
gc_init_reloc(cp);
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- const struct_shared_procs_t *procs =
+ DO_ALL
+ const struct_shared_procs_t *procs =
pre->o_type->shared;
if (procs != 0)
- (*procs->clear_reloc) (pre, size);
+ (*procs->clear_reloc) (pre, size);
o_set_untraced(pre);
pre->o_back = ((byte *) pre - pfree) >> obj_back_shift;
END_OBJECTS_SCAN
- gc_strings_set_marks(cp, true);
+ gc_strings_set_marks(cp, true);
gc_strings_clear_reloc(cp);
}
@@ -1157,35 +1157,35 @@ gc_objects_set_reloc(gc_state_t * gcst, chunk_t * cp)
if_debug_chunk('6', "[6]setting reloc for chunk", cp);
gc_init_reloc(cp);
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- struct_proc_finalize((*finalize));
+ DO_ALL
+ struct_proc_finalize((*finalize));
const struct_shared_procs_t *procs =
pre->o_type->shared;
if ((procs == 0 ? o_is_unmarked(pre) :
- !(*procs->set_reloc) (pre, reloc, size))
- ) { /* Free object */
- reloc += sizeof(obj_header_t) + obj_align_round(size);
- if ((finalize = pre->o_type->finalize) != 0) {
- if_debug2('u', "[u]GC finalizing %s 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) (pre + 1));
- (*finalize) (pre + 1);
- }
- pfree = (byte *) pre;
- pre->o_back = (pfree - (byte *) chead) >> obj_back_shift;
- pre->o_nreloc = reloc;
- if_debug3('7', " [7]at 0x%lx, unmarked %lu, new reloc = %u\n",
- (ulong) pre, (ulong) size, reloc);
+ !(*procs->set_reloc) (pre, reloc, size))
+ ) { /* Free object */
+ reloc += sizeof(obj_header_t) + obj_align_round(size);
+ if ((finalize = pre->o_type->finalize) != 0) {
+ if_debug2('u', "[u]GC finalizing %s 0x%lx\n",
+ struct_type_name_string(pre->o_type),
+ (ulong) (pre + 1));
+ (*finalize) (pre + 1);
+ }
+ pfree = (byte *) pre;
+ pre->o_back = (pfree - (byte *) chead) >> obj_back_shift;
+ pre->o_nreloc = reloc;
+ if_debug3('7', " [7]at 0x%lx, unmarked %lu, new reloc = %u\n",
+ (ulong) pre, (ulong) size, reloc);
} else { /* Useful object */
- debug_check_object(pre, cp, gcst);
- pre->o_back = ((byte *) pre - pfree) >> obj_back_shift;
+ debug_check_object(pre, cp, gcst);
+ pre->o_back = ((byte *) pre - pfree) >> obj_back_shift;
}
END_OBJECTS_SCAN
#ifdef DEBUG
- if (reloc != 0) {
- if_debug1('6', "[6]freed %u", reloc);
- if_debug_chunk('6', " in", cp);
+ if (reloc != 0) {
+ if_debug1('6', "[6]freed %u", reloc);
+ if_debug_chunk('6', " in", cp);
}
#endif
}
@@ -1200,29 +1200,29 @@ gc_do_reloc(chunk_t * cp, gs_ref_memory_t * mem, gc_state_t * pstate)
if_debug_chunk('6', "[6]relocating in chunk", cp);
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
+ DO_ALL
#ifdef DEBUG
- pstate->container = cp;
+ pstate->container = cp;
#endif
/* We need to relocate the pointers in an object iff */
/* it is o_untraced, or it is a useful object. */
/* An object is free iff its back pointer points to */
/* the chunk_head structure. */
- if (o_is_untraced(pre) ||
- pre->o_back << obj_back_shift != (byte *) pre - (byte *) chead
- ) {
- struct_proc_reloc_ptrs((*proc)) =
- pre->o_type->reloc_ptrs;
-
- if_debug3('7',
- " [7]relocating ptrs in %s(%lu) 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) size, (ulong) pre);
- if (proc != 0)
- (*proc) (pre + 1, size, pre->o_type, pstate);
- }
+ if (o_is_untraced(pre) ||
+ pre->o_back << obj_back_shift != (byte *) pre - (byte *) chead
+ ) {
+ struct_proc_reloc_ptrs((*proc)) =
+ pre->o_type->reloc_ptrs;
+
+ if_debug3('7',
+ " [7]relocating ptrs in %s(%lu) 0x%lx\n",
+ struct_type_name_string(pre->o_type),
+ (ulong) size, (ulong) pre);
+ if (proc != 0)
+ (*proc) (pre + 1, size, pre->o_type, pstate);
+ }
#ifdef DEBUG
- pstate->container = 0;
+ pstate->container = 0;
#endif
END_OBJECTS_SCAN
}
@@ -1234,7 +1234,7 @@ const void *
print_reloc_proc(const void *obj, const char *cname, const void *robj)
{
if_debug3('9', " [9]relocate %s * 0x%lx to 0x%lx\n",
- cname, (ulong)obj, (ulong)robj);
+ cname, (ulong)obj, (ulong)robj);
return robj;
}
@@ -1247,50 +1247,50 @@ igc_reloc_struct_ptr(const void /*obj_header_t */ *obj, gc_state_t * gcst)
const void *robj;
if (obj == 0) {
- discard(print_reloc(obj, "NULL", 0));
- return 0;
+ discard(print_reloc(obj, "NULL", 0));
+ return 0;
}
debug_check_object(optr - 1, NULL, gcst);
{
- uint back = optr[-1].o_back;
+ uint back = optr[-1].o_back;
- if (back == o_untraced)
- robj = obj;
- else {
+ if (back == o_untraced)
+ robj = obj;
+ else {
#ifdef DEBUG
- /* Do some sanity checking. */
- chunk_t *cp = gcst->container;
-
- if (cp != 0 && cp->cbase <= (byte *)obj && (byte *)obj <cp->ctop) {
- if (back > (cp->ctop - cp->cbase) >> obj_back_shift) {
- lprintf2("Invalid back pointer %u at 0x%lx!\n",
- back, (ulong) obj);
- gs_abort(NULL);
- }
- } else {
- /* Pointed to unknown chunk. Can't check it, sorry. */
- }
+ /* Do some sanity checking. */
+ chunk_t *cp = gcst->container;
+
+ if (cp != 0 && cp->cbase <= (byte *)obj && (byte *)obj <cp->ctop) {
+ if (back > (cp->ctop - cp->cbase) >> obj_back_shift) {
+ lprintf2("Invalid back pointer %u at 0x%lx!\n",
+ back, (ulong) obj);
+ gs_abort(NULL);
+ }
+ } else {
+ /* Pointed to unknown chunk. Can't check it, sorry. */
+ }
#endif
- {
- const obj_header_t *pfree = (const obj_header_t *)
- ((const char *)(optr - 1) -
- (back << obj_back_shift));
- const chunk_head_t *chead = (const chunk_head_t *)
- ((const char *)pfree -
- (pfree->o_back << obj_back_shift));
-
- robj = chead->dest +
- ((const char *)obj - (const char *)(chead + 1) -
- pfree->o_nreloc);
- }
- }
+ {
+ const obj_header_t *pfree = (const obj_header_t *)
+ ((const char *)(optr - 1) -
+ (back << obj_back_shift));
+ const chunk_head_t *chead = (const chunk_head_t *)
+ ((const char *)pfree -
+ (pfree->o_back << obj_back_shift));
+
+ robj = chead->dest +
+ ((const char *)obj - (const char *)(chead + 1) -
+ pfree->o_nreloc);
+ }
+ }
}
/* Use a severely deprecated pun to remove the const property. */
{
- union { const void *r; void *w; } u;
+ union { const void *r; void *w; } u;
- u.r = print_reloc(obj, struct_type_name_string(optr[-1].o_type), robj);
- return u.w;
+ u.r = print_reloc(obj, struct_type_name_string(optr[-1].o_type), robj);
+ return u.w;
}
}
@@ -1306,29 +1306,29 @@ gc_objects_compact(chunk_t * cp, gc_state_t * gcst)
const gs_memory_t *cmem = gcst->spaces.memories.named.system->stable_memory;
SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
+ DO_ALL
/* An object is free iff its back pointer points to */
/* the chunk_head structure. */
- if (pre->o_back << obj_back_shift != (byte *) pre - (byte *) chead) {
- const struct_shared_procs_t *procs = pre->o_type->shared;
-
- debug_check_object(pre, cp, gcst);
- if_debug4('7',
- " [7]compacting %s 0x%lx(%lu) to 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) pre, (ulong) size, (ulong) dpre);
- if (procs == 0) {
- if (dpre != pre)
- memmove(dpre, pre,
- sizeof(obj_header_t) + size);
- } else
- (*procs->compact) (cmem, pre, dpre, size);
- dpre = (obj_header_t *)
- ((byte *) dpre + obj_size_round(size));
+ if (pre->o_back << obj_back_shift != (byte *) pre - (byte *) chead) {
+ const struct_shared_procs_t *procs = pre->o_type->shared;
+
+ debug_check_object(pre, cp, gcst);
+ if_debug4('7',
+ " [7]compacting %s 0x%lx(%lu) to 0x%lx\n",
+ struct_type_name_string(pre->o_type),
+ (ulong) pre, (ulong) size, (ulong) dpre);
+ if (procs == 0) {
+ if (dpre != pre)
+ memmove(dpre, pre,
+ sizeof(obj_header_t) + size);
+ } else
+ (*procs->compact) (cmem, pre, dpre, size);
+ dpre = (obj_header_t *)
+ ((byte *) dpre + obj_size_round(size));
}
END_OBJECTS_SCAN
- if (cp->outer == 0 && chead->dest != cp->cbase)
- dpre = (obj_header_t *) cp->cbase; /* compacted this chunk into another */
+ if (cp->outer == 0 && chead->dest != cp->cbase)
+ dpre = (obj_header_t *) cp->cbase; /* compacted this chunk into another */
gs_alloc_fill(dpre, gs_alloc_fill_collected, cp->cbot - (byte *) dpre);
cp->cbot = (byte *) dpre;
cp->rcur = 0;
@@ -1347,22 +1347,21 @@ gc_free_empty_chunks(gs_ref_memory_t * mem)
/* Free the chunks in reverse order, */
/* to encourage LIFO behavior. */
for (cp = mem->clast; cp != 0; cp = csucc) { /* Make sure this isn't an inner chunk, */
- /* or a chunk that has inner chunks. */
- csucc = cp->cprev; /* save before freeing */
- if (cp->cbot == cp->cbase && cp->ctop == cp->climit &&
- cp->outer == 0 && cp->inner_count == 0
- ) {
- alloc_free_chunk(cp, mem);
- if (mem->pcc == cp)
- mem->pcc = 0;
- }
+ /* or a chunk that has inner chunks. */
+ csucc = cp->cprev; /* save before freeing */
+ if (cp->cbot == cp->cbase && cp->ctop == cp->climit &&
+ cp->outer == 0 && cp->inner_count == 0
+ ) {
+ alloc_free_chunk(cp, mem);
+ if (mem->pcc == cp)
+ mem->pcc = 0;
+ }
}
}
-
const gs_memory_t * gcst_get_memory_ptr(gc_state_t *gcst)
{
vm_spaces spaces = gcst->spaces;
- const gs_memory_t *cmem = space_system->stable_memory;
+ const gs_memory_t *cmem = space_system->stable_memory;
return cmem;
}
diff --git a/gs/psi/igc.h b/gs/psi/igc.h
index 728495aa0..e3a526f40 100644
--- a/gs/psi/igc.h
+++ b/gs/psi/igc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,17 +78,17 @@ ptr_proc_mark(ptr_ref_mark);
void ialloc_validate_memory(const gs_ref_memory_t *, gc_state_t *);
void ialloc_validate_chunk(const chunk_t *, gc_state_t *);
void ialloc_validate_object(const obj_header_t *, const chunk_t *,
- gc_state_t *);
+ gc_state_t *);
/* Exported by igc.c for ilocate.c */
const gs_memory_t * gcst_get_memory_ptr(gc_state_t *gcst);
/* Macro for returning a relocated pointer */
const void *print_reloc_proc(const void *obj, const char *cname,
- const void *robj);
+ const void *robj);
#ifdef DEBUG
# define print_reloc(obj, cname, nobj)\
- (gs_debug_c('9') ? print_reloc_proc(obj, cname, nobj) : nobj)
+ (gs_debug_c('9') ? print_reloc_proc(obj, cname, nobj) : nobj)
#else
# define print_reloc(obj, cname, nobj) (nobj)
#endif
diff --git a/gs/psi/igcref.c b/gs/psi/igcref.c
index 63267fd8b..e0a205cae 100644
--- a/gs/psi/igcref.c
+++ b/gs/psi/igcref.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -65,12 +65,12 @@ CLEAR_MARKS_PROC(ref_struct_clear_marks)
ref *end = (ref *) ((char *)vptr + size);
for (; pref < end; pref++)
- r_clear_attrs(pref, l_mark);
+ r_clear_attrs(pref, l_mark);
}
ENUM_PTRS_BEGIN_PROC(ref_struct_enum_ptrs)
{
if (index >= size / sizeof(ref))
- return 0;
+ return 0;
pep->ptr = (const ref *)vptr + index;
return ptr_ref_type;
ENUM_PTRS_END_PROC
@@ -96,16 +96,16 @@ ptr_ref_unmark(enum_ptr_t *pep, gc_state_t * ignored)
ref_packed *rpp = (ref_packed *)pep->ptr;
if (r_is_packed(rpp))
- r_clear_pmark(rpp);
+ r_clear_pmark(rpp);
else
- r_clear_attrs((ref *)rpp, l_mark);
+ r_clear_attrs((ref *)rpp, l_mark);
}
/* Unmarking routine for ref objects. */
static void
-refs_clear_marks(const gs_memory_t *cmem,
- void /*obj_header_t */ *vptr, uint size,
- const gs_memory_struct_type_t * pstype)
+refs_clear_marks(const gs_memory_t *cmem,
+ void /*obj_header_t */ *vptr, uint size,
+ const gs_memory_struct_type_t * pstype)
{
ref_packed *rp = (ref_packed *) vptr;
ref_packed *end = (ref_packed *) ((byte *) vptr + size);
@@ -113,31 +113,31 @@ refs_clear_marks(const gs_memory_t *cmem,
/* Since the last ref is full-size, we only need to check for */
/* the end of the block when we see one of those. */
for (;;) {
- if (r_is_packed(rp)) {
+ if (r_is_packed(rp)) {
#ifdef DEBUG
- if (gs_debug_c('8')) {
- dlprintf1(" [8]unmark packed 0x%lx ", (ulong) rp);
- debug_print_ref(cmem, (const ref *)rp);
- dputs("\n");
- }
+ if (gs_debug_c('8')) {
+ dlprintf1(" [8]unmark packed 0x%lx ", (ulong) rp);
+ debug_print_ref(cmem, (const ref *)rp);
+ dputs("\n");
+ }
#endif
- r_clear_pmark(rp);
- rp++;
- } else { /* full-size ref */
- ref *const pref = (ref *)rp;
+ r_clear_pmark(rp);
+ rp++;
+ } else { /* full-size ref */
+ ref *const pref = (ref *)rp;
#ifdef DEBUG
- if (gs_debug_c('8')) {
- dlprintf1(" [8]unmark ref 0x%lx ", (ulong) rp);
- debug_print_ref(cmem, pref);
- dputs("\n");
- }
+ if (gs_debug_c('8')) {
+ dlprintf1(" [8]unmark ref 0x%lx ", (ulong) rp);
+ debug_print_ref(cmem, pref);
+ dputs("\n");
+ }
#endif
- r_clear_attrs(pref, l_mark);
- rp += packed_per_ref;
- if (rp >= (ref_packed *) end)
- break;
- }
+ r_clear_attrs(pref, l_mark);
+ rp += packed_per_ref;
+ if (rp >= (ref_packed *) end)
+ break;
+ }
}
}
@@ -150,15 +150,15 @@ ptr_ref_mark(enum_ptr_t *pep, gc_state_t * ignored)
ref_packed *rpp = (void *)pep->ptr;
if (r_is_packed(rpp)) {
- if (r_has_pmark(rpp))
- return false;
- r_set_pmark(rpp);
+ if (r_has_pmark(rpp))
+ return false;
+ r_set_pmark(rpp);
} else {
- ref *const pref = (ref *)rpp;
+ ref *const pref = (ref *)rpp;
- if (r_has_attr(pref, l_mark))
- return false;
- r_set_attrs(pref, l_mark);
+ if (r_has_attr(pref, l_mark))
+ return false;
+ r_set_attrs(pref, l_mark);
}
return true;
}
@@ -181,18 +181,18 @@ refs_clear_reloc(obj_header_t *hdr, uint size)
ref_packed *end = (ref_packed *) ((byte *) rp + size);
while (rp < end) {
- if (r_is_packed(rp))
- rp++;
- else {
- /* Full-size ref. Store the relocation here if possible. */
- ref *const pref = (ref *)rp;
-
- if (!ref_type_uses_size_or_null(r_type(pref))) {
- if_debug1('8', " [8]clearing reloc at 0x%lx\n", (ulong) rp);
- r_set_size(pref, 0);
- }
- rp += packed_per_ref;
- }
+ if (r_is_packed(rp))
+ rp++;
+ else {
+ /* Full-size ref. Store the relocation here if possible. */
+ ref *const pref = (ref *)rp;
+
+ if (!ref_type_uses_size_or_null(r_type(pref))) {
+ if_debug1('8', " [8]clearing reloc at 0x%lx\n", (ulong) rp);
+ r_set_size(pref, 0);
+ }
+ rp += packed_per_ref;
+ }
}
}
@@ -213,21 +213,21 @@ refs_set_reloc(obj_header_t * hdr, uint reloc, uint size)
* of align_packed_per_ref, so this makes things relatively easy.
*/
while (rp < end) {
- if (r_is_packed(rp)) {
+ if (r_is_packed(rp)) {
#if align_packed_per_ref == 1
- if (r_has_pmark(rp)) {
- if_debug1('8',
- " [8]packed ref 0x%lx is marked\n",
- (ulong) rp);
- rp++;
- } else {
+ if (r_has_pmark(rp)) {
+ if_debug1('8',
+ " [8]packed ref 0x%lx is marked\n",
+ (ulong) rp);
+ rp++;
+ } else {
#else
- int i;
+ int i;
- /*
- * Note: align_packed_per_ref is typically
- * 2 or 4 for 32-bit processors.
- */
+ /*
+ * Note: align_packed_per_ref is typically
+ * 2 or 4 for 32-bit processors.
+ */
#define all_marked (align_packed_per_ref * lp_mark)
# if align_packed_per_ref == 2
# if arch_sizeof_int == arch_sizeof_short * 2
@@ -240,90 +240,90 @@ refs_set_reloc(obj_header_t * hdr, uint reloc, uint size)
# else
# if align_packed_per_ref == 4
# define marked ((*rp & lp_mark) + (rp[1] & lp_mark) +\
- (rp[2] & lp_mark) + (rp[3] & lp_mark))
+ (rp[2] & lp_mark) + (rp[3] & lp_mark))
# else
- /*
- * The value of marked is logically a uint, not an int:
- * we declare it as int only to avoid a compiler warning
- * message about using a non-int value in a switch statement.
- */
- int marked = *rp & lp_mark;
-
- for (i = 1; i < align_packed_per_ref; i++)
- marked += rp[i] & lp_mark;
+ /*
+ * The value of marked is logically a uint, not an int:
+ * we declare it as int only to avoid a compiler warning
+ * message about using a non-int value in a switch statement.
+ */
+ int marked = *rp & lp_mark;
+
+ for (i = 1; i < align_packed_per_ref; i++)
+ marked += rp[i] & lp_mark;
# endif
# endif
- /*
- * Now marked is lp_mark * the number of marked
- * packed refs in the aligned block, except for
- * a couple of special cases above.
- */
- switch (marked) {
- case all_marked:
- if_debug2('8',
- " [8]packed refs 0x%lx..0x%lx are marked\n",
- (ulong) rp,
- (ulong) (rp + (align_packed_per_ref - 1)));
- rp += align_packed_per_ref;
- break;
- default:
- /* At least one packed ref in the block */
- /* is marked: Keep the whole block. */
- for (i = align_packed_per_ref; i--; rp++) {
- r_set_pmark(rp);
- if_debug1('8',
- " [8]packed ref 0x%lx is marked\n",
- (ulong) rp);
- }
- break;
- case 0:
+ /*
+ * Now marked is lp_mark * the number of marked
+ * packed refs in the aligned block, except for
+ * a couple of special cases above.
+ */
+ switch (marked) {
+ case all_marked:
+ if_debug2('8',
+ " [8]packed refs 0x%lx..0x%lx are marked\n",
+ (ulong) rp,
+ (ulong) (rp + (align_packed_per_ref - 1)));
+ rp += align_packed_per_ref;
+ break;
+ default:
+ /* At least one packed ref in the block */
+ /* is marked: Keep the whole block. */
+ for (i = align_packed_per_ref; i--; rp++) {
+ r_set_pmark(rp);
+ if_debug1('8',
+ " [8]packed ref 0x%lx is marked\n",
+ (ulong) rp);
+ }
+ break;
+ case 0:
#endif
- if_debug2('8', " [8]%d packed ref(s) at 0x%lx are unmarked\n",
- align_packed_per_ref, (ulong) rp);
- {
- uint rel = reloc + freed;
-
- /* Change this to an integer so we can */
- /* store the relocation here. */
- *rp = pt_tag(pt_integer) +
- min(rel, packed_max_value);
- }
- rp += align_packed_per_ref;
- freed += sizeof(ref_packed) * align_packed_per_ref;
- }
- } else { /* full-size ref */
- uint rel = reloc + freed;
-
- /* The following assignment is logically */
- /* unnecessary; we do it only for convenience */
- /* in debugging. */
- ref *pref = (ref *) rp;
-
- if (!r_has_attr(pref, l_mark)) {
- if_debug1('8', " [8]ref 0x%lx is unmarked\n",
- (ulong) pref);
- /* Change this to a mark so we can */
- /* store the relocation. */
- r_set_type(pref, t_mark);
- r_set_size(pref, rel);
- freed += sizeof(ref);
- } else {
- if_debug1('8', " [8]ref 0x%lx is marked\n",
- (ulong) pref);
- /* Store the relocation here if possible. */
- if (!ref_type_uses_size_or_null(r_type(pref))) {
- if_debug2('8', " [8]storing reloc %u at 0x%lx\n",
- rel, (ulong) pref);
- r_set_size(pref, rel);
- }
- }
- rp += packed_per_ref;
- }
+ if_debug2('8', " [8]%d packed ref(s) at 0x%lx are unmarked\n",
+ align_packed_per_ref, (ulong) rp);
+ {
+ uint rel = reloc + freed;
+
+ /* Change this to an integer so we can */
+ /* store the relocation here. */
+ *rp = pt_tag(pt_integer) +
+ min(rel, packed_max_value);
+ }
+ rp += align_packed_per_ref;
+ freed += sizeof(ref_packed) * align_packed_per_ref;
+ }
+ } else { /* full-size ref */
+ uint rel = reloc + freed;
+
+ /* The following assignment is logically */
+ /* unnecessary; we do it only for convenience */
+ /* in debugging. */
+ ref *pref = (ref *) rp;
+
+ if (!r_has_attr(pref, l_mark)) {
+ if_debug1('8', " [8]ref 0x%lx is unmarked\n",
+ (ulong) pref);
+ /* Change this to a mark so we can */
+ /* store the relocation. */
+ r_set_type(pref, t_mark);
+ r_set_size(pref, rel);
+ freed += sizeof(ref);
+ } else {
+ if_debug1('8', " [8]ref 0x%lx is marked\n",
+ (ulong) pref);
+ /* Store the relocation here if possible. */
+ if (!ref_type_uses_size_or_null(r_type(pref))) {
+ if_debug2('8', " [8]storing reloc %u at 0x%lx\n",
+ rel, (ulong) pref);
+ r_set_size(pref, rel);
+ }
+ }
+ rp += packed_per_ref;
+ }
}
if_debug3('7', " [7]at end of refs 0x%lx, size = %u, freed = %u\n",
- (ulong) (hdr + 1), size, freed);
+ (ulong) (hdr + 1), size, freed);
if (freed == size)
- return false;
+ return false;
#if arch_sizeof_int > arch_sizeof_short
/*
* If the final relocation can't fit in the r_size field
@@ -333,7 +333,7 @@ refs_set_reloc(obj_header_t * hdr, uint reloc, uint size)
* references to any ref in it.
*/
if (freed <= max_ushort)
- return true;
+ return true;
/*
* We have to mark all surviving refs, but we also must
* overwrite any non-surviving refs with something that
@@ -341,24 +341,24 @@ refs_set_reloc(obj_header_t * hdr, uint reloc, uint size)
*/
rp = (ref_packed *) (hdr + 1);
while (rp < end) {
- if (r_is_packed(rp)) {
- if (!r_has_pmark(rp))
- *rp = pt_tag(pt_integer) | lp_mark;
- ++rp;
- } else { /* The following assignment is logically */
- /* unnecessary; we do it only for convenience */
- /* in debugging. */
- ref *pref = (ref *) rp;
-
- if (!r_has_attr(pref, l_mark)) {
- r_set_type_attrs(pref, t_mark, l_mark);
- r_set_size(pref, reloc);
- } else {
- if (!ref_type_uses_size_or_null(r_type(pref)))
- r_set_size(pref, reloc);
- }
- rp += packed_per_ref;
- }
+ if (r_is_packed(rp)) {
+ if (!r_has_pmark(rp))
+ *rp = pt_tag(pt_integer) | lp_mark;
+ ++rp;
+ } else { /* The following assignment is logically */
+ /* unnecessary; we do it only for convenience */
+ /* in debugging. */
+ ref *pref = (ref *) rp;
+
+ if (!r_has_attr(pref, l_mark)) {
+ r_set_type_attrs(pref, t_mark, l_mark);
+ r_set_size(pref, reloc);
+ } else {
+ if (!ref_type_uses_size_or_null(r_type(pref)))
+ r_set_size(pref, reloc);
+ }
+ rp += packed_per_ref;
+ }
}
/* The last ref has to remain unmarked. */
r_clear_attrs((ref *) rp - 1, l_mark);
@@ -371,11 +371,11 @@ refs_set_reloc(obj_header_t * hdr, uint reloc, uint size)
/* Relocate all the pointers in a block of refs. */
static void
refs_do_reloc(void /*obj_header_t */ *vptr, uint size,
- const gs_memory_struct_type_t * pstype, gc_state_t * gcst)
+ const gs_memory_struct_type_t * pstype, gc_state_t * gcst)
{
igc_reloc_refs((ref_packed *) vptr,
- (ref_packed *) ((char *)vptr + size),
- gcst);
+ (ref_packed *) ((char *)vptr + size),
+ gcst);
}
/* Relocate the contents of a block of refs. */
/* If gcst->relocating_untraced is true, we are relocating pointers from an */
@@ -385,16 +385,16 @@ igc_reloc_refs(ref_packed * from, ref_packed * to, gc_state_t * gcst)
{
int min_trace = gcst->min_collect;
ref_packed *rp = from;
- bool do_all = gcst->relocating_untraced;
+ bool do_all = gcst->relocating_untraced;
vm_spaces spaces = gcst->spaces;
const gs_memory_t *cmem = space_system->stable_memory;
while (rp < to) {
- ref *pref;
+ ref *pref;
#ifdef DEBUG
- const void *before = 0;
- const void *after = 0;
+ const void *before = 0;
+ const void *after = 0;
# define DO_RELOC(var, stat)\
BEGIN before = (var); stat; after = (var); END
# define SET_RELOC(var, expr)\
@@ -404,146 +404,146 @@ igc_reloc_refs(ref_packed * from, ref_packed * to, gc_state_t * gcst)
# define SET_RELOC(var, expr) var = expr
#endif
- if (r_is_packed(rp)) {
- rp++;
- continue;
- }
- /* The following assignment is logically unnecessary; */
- /* we do it only for convenience in debugging. */
- pref = (ref *) rp;
- if_debug3('8', " [8]relocating %s %d ref at 0x%lx\n",
- (r_has_attr(pref, l_mark) ? "marked" : "unmarked"),
- r_btype(pref), (ulong) pref);
- if ((r_has_attr(pref, l_mark) || do_all) &&
- r_space(pref) >= min_trace
- ) {
- switch (r_type(pref)) {
- /* Struct cases */
- case t_file:
- DO_RELOC(pref->value.pfile, RELOC_VAR(pref->value.pfile));
- break;
- case t_device:
- DO_RELOC(pref->value.pdevice,
- RELOC_VAR(pref->value.pdevice));
- break;
- case t_fontID:
- case t_struct:
- case t_astruct:
- DO_RELOC(pref->value.pstruct,
- RELOC_VAR(pref->value.pstruct));
- break;
- /* Non-trivial non-struct cases */
- case t_dictionary:
- rputc('d');
- SET_RELOC(pref->value.pdict,
- (dict *)igc_reloc_ref_ptr((ref_packed *)pref->value.pdict, gcst));
- break;
- case t_array:
- {
- uint size = r_size(pref);
-
- if (size != 0) { /* value.refs might be NULL */
-
- /*
- * If the array is large, we allocated it in its
- * own object (at least originally -- this might
- * be a pointer to a subarray.) In this case,
- * we know it is the only object in its
- * containing st_refs object, so we know that
- * the mark containing the relocation appears
- * just after it.
- */
- if (size < max_size_st_refs / sizeof(ref)) {
- rputc('a');
- SET_RELOC(pref->value.refs,
- (ref *) igc_reloc_ref_ptr(
- (ref_packed *) pref->value.refs, gcst));
- } else {
- rputc('A');
- /*
- * See the t_shortarray case below for why we
- * decrement size.
- */
- --size;
- SET_RELOC(pref->value.refs,
- (ref *) igc_reloc_ref_ptr(
- (ref_packed *) (pref->value.refs + size),
- gcst) - size);
- }
- }
- }
- break;
- case t_mixedarray:
- if (r_size(pref) != 0) { /* value.refs might be NULL */
- rputc('m');
- SET_RELOC(pref->value.packed,
- igc_reloc_ref_ptr(pref->value.packed, gcst));
- }
- break;
- case t_shortarray:
- {
- uint size = r_size(pref);
-
- /*
- * Since we know that igc_reloc_ref_ptr works by
- * scanning forward, and we know that all the
- * elements of this array itself are marked, we can
- * save some scanning time by relocating the pointer
- * to the end of the array rather than the
- * beginning.
- */
- if (size != 0) { /* value.refs might be NULL */
- rputc('s');
- /*
- * igc_reloc_ref_ptr has to be able to determine
- * whether the pointer points into a space that
- * isn't being collected. It does this by
- * checking whether the referent of the pointer
- * is marked. For this reason, we have to pass
- * a pointer to the last real element of the
- * array, rather than just beyond it.
- */
- --size;
- SET_RELOC(pref->value.packed,
- igc_reloc_ref_ptr(pref->value.packed + size,
- gcst) - size);
- }
- }
- break;
- case t_name:
- {
- void *psub = name_ref_sub_table(cmem, pref);
- void *rsub = RELOC_OBJ(psub); /* gcst implicit */
-
- SET_RELOC(pref->value.pname,
- (name *)
- ((char *)rsub + ((char *)pref->value.pname -
- (char *)psub)));
- } break;
- case t_string:
- {
- gs_string str;
-
- str.data = pref->value.bytes;
- str.size = r_size(pref);
-
- DO_RELOC(str.data, RELOC_STRING_VAR(str));
- pref->value.bytes = str.data;
- }
- break;
- case t_oparray:
- rputc('o');
- SET_RELOC(pref->value.const_refs,
- (const ref *)igc_reloc_ref_ptr((const ref_packed *)pref->value.const_refs, gcst));
- break;
- default:
- goto no_reloc; /* don't print trace message */
- }
- if_debug2('8', " [8]relocated 0x%lx => 0x%lx\n",
- (ulong)before, (ulong)after);
- }
+ if (r_is_packed(rp)) {
+ rp++;
+ continue;
+ }
+ /* The following assignment is logically unnecessary; */
+ /* we do it only for convenience in debugging. */
+ pref = (ref *) rp;
+ if_debug3('8', " [8]relocating %s %d ref at 0x%lx\n",
+ (r_has_attr(pref, l_mark) ? "marked" : "unmarked"),
+ r_btype(pref), (ulong) pref);
+ if ((r_has_attr(pref, l_mark) || do_all) &&
+ r_space(pref) >= min_trace
+ ) {
+ switch (r_type(pref)) {
+ /* Struct cases */
+ case t_file:
+ DO_RELOC(pref->value.pfile, RELOC_VAR(pref->value.pfile));
+ break;
+ case t_device:
+ DO_RELOC(pref->value.pdevice,
+ RELOC_VAR(pref->value.pdevice));
+ break;
+ case t_fontID:
+ case t_struct:
+ case t_astruct:
+ DO_RELOC(pref->value.pstruct,
+ RELOC_VAR(pref->value.pstruct));
+ break;
+ /* Non-trivial non-struct cases */
+ case t_dictionary:
+ rputc('d');
+ SET_RELOC(pref->value.pdict,
+ (dict *)igc_reloc_ref_ptr((ref_packed *)pref->value.pdict, gcst));
+ break;
+ case t_array:
+ {
+ uint size = r_size(pref);
+
+ if (size != 0) { /* value.refs might be NULL */
+
+ /*
+ * If the array is large, we allocated it in its
+ * own object (at least originally -- this might
+ * be a pointer to a subarray.) In this case,
+ * we know it is the only object in its
+ * containing st_refs object, so we know that
+ * the mark containing the relocation appears
+ * just after it.
+ */
+ if (size < max_size_st_refs / sizeof(ref)) {
+ rputc('a');
+ SET_RELOC(pref->value.refs,
+ (ref *) igc_reloc_ref_ptr(
+ (ref_packed *) pref->value.refs, gcst));
+ } else {
+ rputc('A');
+ /*
+ * See the t_shortarray case below for why we
+ * decrement size.
+ */
+ --size;
+ SET_RELOC(pref->value.refs,
+ (ref *) igc_reloc_ref_ptr(
+ (ref_packed *) (pref->value.refs + size),
+ gcst) - size);
+ }
+ }
+ }
+ break;
+ case t_mixedarray:
+ if (r_size(pref) != 0) { /* value.refs might be NULL */
+ rputc('m');
+ SET_RELOC(pref->value.packed,
+ igc_reloc_ref_ptr(pref->value.packed, gcst));
+ }
+ break;
+ case t_shortarray:
+ {
+ uint size = r_size(pref);
+
+ /*
+ * Since we know that igc_reloc_ref_ptr works by
+ * scanning forward, and we know that all the
+ * elements of this array itself are marked, we can
+ * save some scanning time by relocating the pointer
+ * to the end of the array rather than the
+ * beginning.
+ */
+ if (size != 0) { /* value.refs might be NULL */
+ rputc('s');
+ /*
+ * igc_reloc_ref_ptr has to be able to determine
+ * whether the pointer points into a space that
+ * isn't being collected. It does this by
+ * checking whether the referent of the pointer
+ * is marked. For this reason, we have to pass
+ * a pointer to the last real element of the
+ * array, rather than just beyond it.
+ */
+ --size;
+ SET_RELOC(pref->value.packed,
+ igc_reloc_ref_ptr(pref->value.packed + size,
+ gcst) - size);
+ }
+ }
+ break;
+ case t_name:
+ {
+ void *psub = name_ref_sub_table(cmem, pref);
+ void *rsub = RELOC_OBJ(psub); /* gcst implicit */
+
+ SET_RELOC(pref->value.pname,
+ (name *)
+ ((char *)rsub + ((char *)pref->value.pname -
+ (char *)psub)));
+ } break;
+ case t_string:
+ {
+ gs_string str;
+
+ str.data = pref->value.bytes;
+ str.size = r_size(pref);
+
+ DO_RELOC(str.data, RELOC_STRING_VAR(str));
+ pref->value.bytes = str.data;
+ }
+ break;
+ case t_oparray:
+ rputc('o');
+ SET_RELOC(pref->value.const_refs,
+ (const ref *)igc_reloc_ref_ptr((const ref_packed *)pref->value.const_refs, gcst));
+ break;
+ default:
+ goto no_reloc; /* don't print trace message */
+ }
+ if_debug2('8', " [8]relocated 0x%lx => 0x%lx\n",
+ (ulong)before, (ulong)after);
+ }
no_reloc:
- rp += packed_per_ref;
+ rp += packed_per_ref;
}
}
@@ -566,56 +566,56 @@ igc_reloc_ref_ptr_nocheck(const ref_packed * prp, gc_state_t *gcst)
#endif
for (;;) {
- if (r_is_packed(rp)) {
- /*
- * Normally, an unmarked packed ref will be an
- * integer whose value is the amount of relocation.
- * However, the relocation value might have been
- * too large to fit. If this is the case, for
- * each such unmarked packed ref we pass over,
- * we have to decrement the final relocation.
- */
- rputc((*rp & lp_mark ? '1' : '0'));
- if (!(*rp & lp_mark)) {
- if (*rp != pt_tag(pt_integer) + packed_max_value) {
- /* This is a stored relocation value. */
- rputc('\n');
- rp = print_reloc(prp, "ref",
- (const ref_packed *)
- ((const char *)prp -
- (*rp & packed_value_mask) + dec));
- break;
- }
- /*
- * We know this is the first of an aligned block
- * of packed refs. Skip over the entire block,
- * decrementing the final relocation.
- */
- dec += sizeof(ref_packed) * align_packed_per_ref;
- rp += align_packed_per_ref;
- } else
- rp++;
- continue;
- }
- if (!ref_type_uses_size_or_null(r_type(RP_REF(rp)))) {
- /* reloc is in r_size */
- rputc('\n');
- rp = print_reloc(prp, "ref",
- (const ref_packed *)
- (r_size(RP_REF(rp)) == 0 ? prp :
- (const ref_packed *)((const char *)prp -
- r_size(RP_REF(rp)) + dec)));
- break;
- }
- rputc('u');
- rp += packed_per_ref;
+ if (r_is_packed(rp)) {
+ /*
+ * Normally, an unmarked packed ref will be an
+ * integer whose value is the amount of relocation.
+ * However, the relocation value might have been
+ * too large to fit. If this is the case, for
+ * each such unmarked packed ref we pass over,
+ * we have to decrement the final relocation.
+ */
+ rputc((*rp & lp_mark ? '1' : '0'));
+ if (!(*rp & lp_mark)) {
+ if (*rp != pt_tag(pt_integer) + packed_max_value) {
+ /* This is a stored relocation value. */
+ rputc('\n');
+ rp = print_reloc(prp, "ref",
+ (const ref_packed *)
+ ((const char *)prp -
+ (*rp & packed_value_mask) + dec));
+ break;
+ }
+ /*
+ * We know this is the first of an aligned block
+ * of packed refs. Skip over the entire block,
+ * decrementing the final relocation.
+ */
+ dec += sizeof(ref_packed) * align_packed_per_ref;
+ rp += align_packed_per_ref;
+ } else
+ rp++;
+ continue;
+ }
+ if (!ref_type_uses_size_or_null(r_type(RP_REF(rp)))) {
+ /* reloc is in r_size */
+ rputc('\n');
+ rp = print_reloc(prp, "ref",
+ (const ref_packed *)
+ (r_size(RP_REF(rp)) == 0 ? prp :
+ (const ref_packed *)((const char *)prp -
+ r_size(RP_REF(rp)) + dec)));
+ break;
+ }
+ rputc('u');
+ rp += packed_per_ref;
}
/* Use a severely deprecated pun to remove the const property. */
{
- union { const ref_packed *r; ref_packed *w; } u;
+ union { const ref_packed *r; ref_packed *w; } u;
- u.r = rp;
- return u.w;
+ u.r = rp;
+ return u.w;
}
#undef RP_REF
}
@@ -639,20 +639,20 @@ igc_reloc_ref_ptr(const ref_packed * prp, gc_state_t *gcst)
* do any relocation. Check for this first.
*/
if (r_is_packed(rp)) {
- if (!r_has_pmark(rp))
- goto ret_rp;
+ if (!r_has_pmark(rp))
+ goto ret_rp;
} else {
- if (!r_has_attr(RP_REF(rp), l_mark))
- goto ret_rp;
+ if (!r_has_attr(RP_REF(rp), l_mark))
+ goto ret_rp;
}
return igc_reloc_ref_ptr_nocheck(prp, gcst);
ret_rp:
/* Use a severely deprecated pun to remove the const property. */
{
- union { const ref_packed *r; ref_packed *w; } u;
+ union { const ref_packed *r; ref_packed *w; } u;
- u.r = rp;
- return u.w;
+ u.r = rp;
+ return u.w;
}
}
@@ -668,7 +668,7 @@ refs_compact(const gs_memory_t *mem, obj_header_t * pre, obj_header_t * dpre, ui
ref_packed *end;
uint new_size;
- /* The next switch controls an optimization
+ /* The next switch controls an optimization
for the loop termination condition.
It was useful during the development,
when some assumptions were temporary wrong.
@@ -682,82 +682,82 @@ refs_compact(const gs_memory_t *mem, obj_header_t * pre, obj_header_t * dpre, ui
* of the block when we see one of those.
*/
if (dpre == pre) /* Loop while we don't need to copy. */
- for (;;) {
- if (r_is_packed(src)) {
- if (!r_has_pmark(src))
- break;
- if_debug1('8', " [8]packed ref 0x%lx \"copied\"\n",
- (ulong) src);
- *src &= ~lp_mark;
- src++;
- } else { /* full-size ref */
- ref *const pref = (ref *)src;
-
- if (!r_has_attr(pref, l_mark))
- break;
- if_debug1('8', " [8]ref 0x%lx \"copied\"\n", (ulong) src);
- r_clear_attrs(pref, l_mark);
- src += packed_per_ref;
- }
+ for (;;) {
+ if (r_is_packed(src)) {
+ if (!r_has_pmark(src))
+ break;
+ if_debug1('8', " [8]packed ref 0x%lx \"copied\"\n",
+ (ulong) src);
+ *src &= ~lp_mark;
+ src++;
+ } else { /* full-size ref */
+ ref *const pref = (ref *)src;
+
+ if (!r_has_attr(pref, l_mark))
+ break;
+ if_debug1('8', " [8]ref 0x%lx \"copied\"\n", (ulong) src);
+ r_clear_attrs(pref, l_mark);
+ src += packed_per_ref;
+ }
} else
- *dpre = *pre;
+ *dpre = *pre;
dest = (ref_packed *) ((char *)dpre + ((char *)src - (char *)pre));
for (;;) {
- if (r_is_packed(src)) {
- if (r_has_pmark(src)) {
- if_debug2('8', " [8]packed ref 0x%lx copied to 0x%lx\n",
- (ulong) src, (ulong) dest);
- *dest++ = *src & ~lp_mark;
- }
- src++;
- } else { /* full-size ref */
- if (r_has_attr((ref *) src, l_mark)) {
- ref rtemp;
-
- if_debug2('8', " [8]ref 0x%lx copied to 0x%lx\n",
- (ulong) src, (ulong) dest);
- /* We can't just use ref_assign_inline, */
- /* because the source and destination */
- /* might overlap! */
- ref_assign_inline(&rtemp, (ref *) src);
- r_clear_attrs(&rtemp, l_mark);
- ref_assign_inline((ref *) dest, &rtemp);
- src += packed_per_ref;
- dest += packed_per_ref;
- } else { /* check for end of block */
- src += packed_per_ref;
- if (src >= end)
- break;
- }
- }
+ if (r_is_packed(src)) {
+ if (r_has_pmark(src)) {
+ if_debug2('8', " [8]packed ref 0x%lx copied to 0x%lx\n",
+ (ulong) src, (ulong) dest);
+ *dest++ = *src & ~lp_mark;
+ }
+ src++;
+ } else { /* full-size ref */
+ if (r_has_attr((ref *) src, l_mark)) {
+ ref rtemp;
+
+ if_debug2('8', " [8]ref 0x%lx copied to 0x%lx\n",
+ (ulong) src, (ulong) dest);
+ /* We can't just use ref_assign_inline, */
+ /* because the source and destination */
+ /* might overlap! */
+ ref_assign_inline(&rtemp, (ref *) src);
+ r_clear_attrs(&rtemp, l_mark);
+ ref_assign_inline((ref *) dest, &rtemp);
+ src += packed_per_ref;
+ dest += packed_per_ref;
+ } else { /* check for end of block */
+ src += packed_per_ref;
+ if (src >= end)
+ break;
+ }
+ }
}
new_size = (byte *) dest - (byte *) (dpre + 1) + sizeof(ref);
#ifdef DEBUG
/* Check that the relocation came out OK. */
/* NOTE: this check only works within a single chunk. */
if ((byte *) src - (byte *) dest != r_size((ref *) src - 1) + sizeof(ref)) {
- lprintf3("Reloc error for refs 0x%lx: reloc = %lu, stored = %u\n",
- (ulong) dpre, (ulong) ((byte *) src - (byte *) dest),
- (uint) r_size((ref *) src - 1));
- gs_abort(mem);
+ lprintf3("Reloc error for refs 0x%lx: reloc = %lu, stored = %u\n",
+ (ulong) dpre, (ulong) ((byte *) src - (byte *) dest),
+ (uint) r_size((ref *) src - 1));
+ gs_abort(mem);
}
#endif
/* Pad to a multiple of sizeof(ref). */
while (new_size & (sizeof(ref) - 1))
- *dest++ = pt_tag(pt_integer),
- new_size += sizeof(ref_packed);
+ *dest++ = pt_tag(pt_integer),
+ new_size += sizeof(ref_packed);
/* We want to make the newly freed space into a free block, */
/* but we can only do this if we have enough room. */
if (size - new_size < sizeof(obj_header_t)) { /* Not enough room. Pad to original size. */
- while (new_size < size)
- *dest++ = pt_tag(pt_integer),
- new_size += sizeof(ref_packed);
+ while (new_size < size)
+ *dest++ = pt_tag(pt_integer),
+ new_size += sizeof(ref_packed);
} else {
- obj_header_t *pfree = (obj_header_t *) ((ref *) dest + 1);
+ obj_header_t *pfree = (obj_header_t *) ((ref *) dest + 1);
- pfree->o_alone = 0;
- pfree->o_size = size - new_size - sizeof(obj_header_t);
- pfree->o_type = &st_bytes;
+ pfree->o_alone = 0;
+ pfree->o_size = size - new_size - sizeof(obj_header_t);
+ pfree->o_type = &st_bytes;
}
/* Re-create the final ref. */
r_set_type((ref *) dest, t_integer);
diff --git a/gs/psi/igcstr.c b/gs/psi/igcstr.c
index ed94dec85..023218653 100644
--- a/gs/psi/igcstr.c
+++ b/gs/psi/igcstr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,11 +28,11 @@ void
gc_strings_set_marks(chunk_t * cp, bool mark)
{
if (cp->smark != 0) {
- if_debug3('6', "[6]clearing string marks 0x%lx[%u] to %d\n",
- (ulong) cp->smark, cp->smark_size, (int)mark);
- memset(cp->smark, 0, cp->smark_size);
- if (mark)
- gc_mark_string(cp->sbase, cp->climit - cp->sbase, true, cp);
+ if_debug3('6', "[6]clearing string marks 0x%lx[%u] to %d\n",
+ (ulong) cp->smark, cp->smark_size, (int)mark);
+ memset(cp->smark, 0, cp->smark_size);
+ if (mark)
+ gc_mark_string(cp->sbase, cp->climit - cp->sbase, true, cp);
}
}
@@ -50,7 +50,7 @@ typedef string_mark_unit bword;
# define bword_swap_bytes(m) m = (m << 8) | (m >> 8)
# else /* bword_bytes == 4 */
# define bword_swap_bytes(m)\
- m = (m << 24) | ((m & 0xff00) << 8) | ((m >> 8) & 0xff00) | (m >> 24)
+ m = (m << 24) | ((m & 0xff00) << 8) | ((m >> 8) & 0xff00) | (m >> 24)
# endif
#else
# define bword_swap_bytes(m) DO_NOTHING
@@ -69,43 +69,43 @@ gc_mark_string(const byte * ptr, uint size, bool set, const chunk_t * cp)
bword_swap_bytes(m);
if (set) {
- if (left + bn >= bword_bits) {
- marks |= ~*bp & m;
- *bp |= m;
- m = bword_1s, left -= bword_bits - bn, bp++;
- while (left >= bword_bits) {
- marks |= ~*bp;
- *bp = bword_1s;
- left -= bword_bits, bp++;
- }
- }
- if (left) {
- bword_swap_bytes(m);
- m -= m << left;
- bword_swap_bytes(m);
- marks |= ~*bp & m;
- *bp |= m;
- }
+ if (left + bn >= bword_bits) {
+ marks |= ~*bp & m;
+ *bp |= m;
+ m = bword_1s, left -= bword_bits - bn, bp++;
+ while (left >= bword_bits) {
+ marks |= ~*bp;
+ *bp = bword_1s;
+ left -= bword_bits, bp++;
+ }
+ }
+ if (left) {
+ bword_swap_bytes(m);
+ m -= m << left;
+ bword_swap_bytes(m);
+ marks |= ~*bp & m;
+ *bp |= m;
+ }
} else {
- if (left + bn >= bword_bits) {
- *bp &= ~m;
- m = bword_1s, left -= bword_bits - bn, bp++;
- if (left >= bword_bits * 5) {
- memset(bp, 0, (left & -bword_bits) >> 3);
- bp += left >> bword_log2_bits;
- left &= bword_bits - 1;
- } else
- while (left >= bword_bits) {
- *bp = 0;
- left -= bword_bits, bp++;
- }
- }
- if (left) {
- bword_swap_bytes(m);
- m -= m << left;
- bword_swap_bytes(m);
- *bp &= ~m;
- }
+ if (left + bn >= bword_bits) {
+ *bp &= ~m;
+ m = bword_1s, left -= bword_bits - bn, bp++;
+ if (left >= bword_bits * 5) {
+ memset(bp, 0, (left & -bword_bits) >> 3);
+ bp += left >> bword_log2_bits;
+ left &= bword_bits - 1;
+ } else
+ while (left >= bword_bits) {
+ *bp = 0;
+ left -= bword_bits, bp++;
+ }
+ }
+ if (left) {
+ bword_swap_bytes(m);
+ m -= m << left;
+ bword_swap_bytes(m);
+ *bp &= ~m;
+ }
}
return marks != 0;
}
@@ -119,7 +119,7 @@ dfwrite(const byte *ptr, uint count)
{
uint i;
for (i = 0; i < count; ++i)
- dputc(ptr[i]);
+ dputc(ptr[i]);
}
#endif
@@ -131,58 +131,58 @@ gc_string_mark(const byte * ptr, uint size, bool set, gc_state_t * gcst)
bool marks;
if (size == 0)
- return false;
+ return false;
#define dprintstr()\
dputc('('); dfwrite(ptr, min(size, 20));\
dputs((size <= 20 ? ")" : "...)"))
if (!(cp = gc_locate(ptr, gcst))) { /* not in a chunk */
#ifdef DEBUG
- if (gs_debug_c('5')) {
- dlprintf2("[5]0x%lx[%u]", (ulong) ptr, size);
- dprintstr();
- dputs(" not in a chunk\n");
- }
+ if (gs_debug_c('5')) {
+ dlprintf2("[5]0x%lx[%u]", (ulong) ptr, size);
+ dprintstr();
+ dputs(" not in a chunk\n");
+ }
#endif
- return false;
+ return false;
}
if (cp->smark == 0) /* not marking strings */
- return false;
+ return false;
#ifdef DEBUG
if (ptr < cp->ctop) {
- lprintf4("String pointer 0x%lx[%u] outside [0x%lx..0x%lx)\n",
- (ulong) ptr, size, (ulong) cp->ctop, (ulong) cp->climit);
- return false;
+ lprintf4("String pointer 0x%lx[%u] outside [0x%lx..0x%lx)\n",
+ (ulong) ptr, size, (ulong) cp->ctop, (ulong) cp->climit);
+ return false;
} else if (ptr + size > cp->climit) { /*
- * If this is the bottommost string in a chunk that has
- * an inner chunk, the string's starting address is both
- * cp->ctop of the outer chunk and cp->climit of the inner;
- * gc_locate may incorrectly attribute the string to the
- * inner chunk because of this. This doesn't affect
- * marking or relocation, since the machinery for these
- * is all associated with the outermost chunk,
- * but it can cause the validity check to fail.
- * Check for this case now.
- */
- const chunk_t *scp = cp;
+ * If this is the bottommost string in a chunk that has
+ * an inner chunk, the string's starting address is both
+ * cp->ctop of the outer chunk and cp->climit of the inner;
+ * gc_locate may incorrectly attribute the string to the
+ * inner chunk because of this. This doesn't affect
+ * marking or relocation, since the machinery for these
+ * is all associated with the outermost chunk,
+ * but it can cause the validity check to fail.
+ * Check for this case now.
+ */
+ const chunk_t *scp = cp;
- while (ptr == scp->climit && scp->outer != 0)
- scp = scp->outer;
- if (ptr + size > scp->climit) {
- lprintf4("String pointer 0x%lx[%u] outside [0x%lx..0x%lx)\n",
- (ulong) ptr, size,
- (ulong) scp->ctop, (ulong) scp->climit);
- return false;
- }
+ while (ptr == scp->climit && scp->outer != 0)
+ scp = scp->outer;
+ if (ptr + size > scp->climit) {
+ lprintf4("String pointer 0x%lx[%u] outside [0x%lx..0x%lx)\n",
+ (ulong) ptr, size,
+ (ulong) scp->ctop, (ulong) scp->climit);
+ return false;
+ }
}
#endif
marks = gc_mark_string(ptr, size, set, cp);
#ifdef DEBUG
if (gs_debug_c('5')) {
- dlprintf4("[5]%s%smarked 0x%lx[%u]",
- (marks ? "" : "already "), (set ? "" : "un"),
- (ulong) ptr, size);
- dprintstr();
- dputc('\n');
+ dlprintf4("[5]%s%smarked 0x%lx[%u]",
+ (marks ? "" : "already "), (set ? "" : "un"),
+ (ulong) ptr, size);
+ dprintstr();
+ dputc('\n');
}
#endif
return marks;
@@ -194,10 +194,10 @@ void
gc_strings_clear_reloc(chunk_t * cp)
{
if (cp->sreloc != 0) {
- gc_strings_set_marks(cp, true);
- if_debug1('6', "[6]clearing string reloc 0x%lx\n",
- (ulong) cp->sreloc);
- gc_strings_set_reloc(cp);
+ gc_strings_set_marks(cp, true);
+ if_debug1('6', "[6]clearing string reloc 0x%lx\n",
+ (ulong) cp->sreloc);
+ gc_strings_set_reloc(cp);
}
}
@@ -222,52 +222,52 @@ void
gc_strings_set_reloc(chunk_t * cp)
{
if (cp->sreloc != 0 && cp->smark != 0) {
- byte *bot = cp->ctop;
- byte *top = cp->climit;
- uint count =
- (top - bot + (string_data_quantum - 1)) >>
- log2_string_data_quantum;
- string_reloc_offset *relp =
- cp->sreloc +
- (cp->smark_size >> (log2_string_data_quantum - 3));
- register const byte *bitp = cp->smark + cp->smark_size;
- register string_reloc_offset reloc = 0;
+ byte *bot = cp->ctop;
+ byte *top = cp->climit;
+ uint count =
+ (top - bot + (string_data_quantum - 1)) >>
+ log2_string_data_quantum;
+ string_reloc_offset *relp =
+ cp->sreloc +
+ (cp->smark_size >> (log2_string_data_quantum - 3));
+ register const byte *bitp = cp->smark + cp->smark_size;
+ register string_reloc_offset reloc = 0;
- /* Skip initial unrelocated strings quickly. */
+ /* Skip initial unrelocated strings quickly. */
#if string_data_quantum == bword_bits || string_data_quantum == bword_bits * 2
- {
- /* Work around the alignment aliasing bug. */
- const bword *wp = (const bword *)bitp;
+ {
+ /* Work around the alignment aliasing bug. */
+ const bword *wp = (const bword *)bitp;
#if string_data_quantum == bword_bits
# define RELOC_TEST_1S(wp) (wp[-1])
#else /* string_data_quantum == bword_bits * 2 */
# define RELOC_TEST_1S(wp) (wp[-1] & wp[-2])
#endif
- while (count && RELOC_TEST_1S(wp) == bword_1s) {
- wp -= string_data_quantum / bword_bits;
- *--relp = reloc += string_data_quantum;
- --count;
- }
+ while (count && RELOC_TEST_1S(wp) == bword_1s) {
+ wp -= string_data_quantum / bword_bits;
+ *--relp = reloc += string_data_quantum;
+ --count;
+ }
#undef RELOC_TEST_1S
- bitp = (const byte *)wp;
- }
+ bitp = (const byte *)wp;
+ }
#endif
- while (count--) {
- bitp -= string_data_quantum / 8;
- reloc += string_data_quantum -
- byte_count_zero_bits(bitp[0]);
- reloc -= byte_count_zero_bits(bitp[1]);
- reloc -= byte_count_zero_bits(bitp[2]);
- reloc -= byte_count_zero_bits(bitp[3]);
+ while (count--) {
+ bitp -= string_data_quantum / 8;
+ reloc += string_data_quantum -
+ byte_count_zero_bits(bitp[0]);
+ reloc -= byte_count_zero_bits(bitp[1]);
+ reloc -= byte_count_zero_bits(bitp[2]);
+ reloc -= byte_count_zero_bits(bitp[3]);
#if log2_string_data_quantum > 5
- reloc -= byte_count_zero_bits(bitp[4]);
- reloc -= byte_count_zero_bits(bitp[5]);
- reloc -= byte_count_zero_bits(bitp[6]);
- reloc -= byte_count_zero_bits(bitp[7]);
+ reloc -= byte_count_zero_bits(bitp[4]);
+ reloc -= byte_count_zero_bits(bitp[5]);
+ reloc -= byte_count_zero_bits(bitp[6]);
+ reloc -= byte_count_zero_bits(bitp[7]);
#endif
- *--relp = reloc;
- }
+ *--relp = reloc;
+ }
}
cp->sdest = cp->climit;
}
@@ -284,39 +284,39 @@ igc_reloc_string(gs_string * sptr, gc_state_t * gcst)
byte byt;
if (sptr->size == 0) {
- sptr->data = 0;
- return;
+ sptr->data = 0;
+ return;
}
ptr = sptr->data;
if (!(cp = gc_locate(ptr, gcst))) /* not in a chunk */
- return;
+ return;
if (cp->sreloc == 0 || cp->smark == 0) /* not marking strings */
- return;
+ return;
offset = ptr - cp->sbase;
reloc = cp->sreloc[offset >> log2_string_data_quantum];
bitp = &cp->smark[offset >> 3];
switch (offset & (string_data_quantum - 8)) {
#if log2_string_data_quantum > 5
- case 56:
- reloc -= byte_count_one_bits(bitp[-7]);
- case 48:
- reloc -= byte_count_one_bits(bitp[-6]);
- case 40:
- reloc -= byte_count_one_bits(bitp[-5]);
- case 32:
- reloc -= byte_count_one_bits(bitp[-4]);
+ case 56:
+ reloc -= byte_count_one_bits(bitp[-7]);
+ case 48:
+ reloc -= byte_count_one_bits(bitp[-6]);
+ case 40:
+ reloc -= byte_count_one_bits(bitp[-5]);
+ case 32:
+ reloc -= byte_count_one_bits(bitp[-4]);
#endif
- case 24:
- reloc -= byte_count_one_bits(bitp[-3]);
- case 16:
- reloc -= byte_count_one_bits(bitp[-2]);
- case 8:
- reloc -= byte_count_one_bits(bitp[-1]);
+ case 24:
+ reloc -= byte_count_one_bits(bitp[-3]);
+ case 16:
+ reloc -= byte_count_one_bits(bitp[-2]);
+ case 8:
+ reloc -= byte_count_one_bits(bitp[-1]);
}
byt = *bitp & (0xff >> (8 - (offset & 7)));
reloc -= byte_count_one_bits(byt);
if_debug2('5', "[5]relocate string 0x%lx to 0x%lx\n",
- (ulong) ptr, (ulong) (cp->sdest - reloc));
+ (ulong) ptr, (ulong) (cp->sdest - reloc));
sptr->data = cp->sdest - reloc;
}
void
@@ -327,10 +327,10 @@ igc_reloc_const_string(gs_const_string * sptr, gc_state_t * gcst)
}
void
igc_reloc_param_string(gs_param_string * sptr, gc_state_t * gcst)
-{
+{
if (!sptr->persistent) {
- /* We assume that gs_param_string is a subclass of gs_string. */
- igc_reloc_string((gs_string *)sptr, gcst);
+ /* We assume that gs_param_string is a subclass of gs_string. */
+ igc_reloc_string((gs_string *)sptr, gcst);
}
}
@@ -339,102 +339,102 @@ void
gc_strings_compact(chunk_t * cp)
{
if (cp->smark != 0) {
- byte *hi = cp->climit;
- byte *lo = cp->ctop;
- const byte *from = hi;
- byte *to = hi;
- const byte *bp = cp->smark + cp->smark_size;
+ byte *hi = cp->climit;
+ byte *lo = cp->ctop;
+ const byte *from = hi;
+ byte *to = hi;
+ const byte *bp = cp->smark + cp->smark_size;
#ifdef DEBUG
- if (gs_debug_c('4') || gs_debug_c('5')) {
- byte *base = cp->sbase;
- uint i = (lo - base) & -string_data_quantum;
- uint n = ROUND_UP(hi - base, string_data_quantum);
+ if (gs_debug_c('4') || gs_debug_c('5')) {
+ byte *base = cp->sbase;
+ uint i = (lo - base) & -string_data_quantum;
+ uint n = ROUND_UP(hi - base, string_data_quantum);
#define R 16
- for (; i < n; i += R) {
- uint j;
+ for (; i < n; i += R) {
+ uint j;
- dlprintf1("[4]0x%lx: ", (ulong) (base + i));
- for (j = i; j < i + R; j++) {
- byte ch = base[j];
+ dlprintf1("[4]0x%lx: ", (ulong) (base + i));
+ for (j = i; j < i + R; j++) {
+ byte ch = base[j];
- if (ch <= 31) {
- dputc('^');
- dputc(ch + 0100);
- } else
- dputc(ch);
- }
- dputc(' ');
- for (j = i; j < i + R; j++)
- dputc((cp->smark[j >> 3] & (1 << (j & 7)) ?
- '+' : '.'));
+ if (ch <= 31) {
+ dputc('^');
+ dputc(ch + 0100);
+ } else
+ dputc(ch);
+ }
+ dputc(' ');
+ for (j = i; j < i + R; j++)
+ dputc((cp->smark[j >> 3] & (1 << (j & 7)) ?
+ '+' : '.'));
#undef R
- if (!(i & (string_data_quantum - 1)))
- dprintf1(" %u", cp->sreloc[i >> log2_string_data_quantum]);
- dputc('\n');
- }
- }
+ if (!(i & (string_data_quantum - 1)))
+ dprintf1(" %u", cp->sreloc[i >> log2_string_data_quantum]);
+ dputc('\n');
+ }
+ }
#endif
- /*
- * Skip unmodified strings quickly. We know that cp->smark is
- * aligned to a string_mark_unit.
- */
- {
- /* Work around the alignment aliasing bug. */
- const bword *wp = (const bword *)bp;
+ /*
+ * Skip unmodified strings quickly. We know that cp->smark is
+ * aligned to a string_mark_unit.
+ */
+ {
+ /* Work around the alignment aliasing bug. */
+ const bword *wp = (const bword *)bp;
- while (to > lo && wp[-1] == bword_1s)
- to -= bword_bits, --wp;
- bp = (const byte *)wp;
- while (to > lo && bp[-1] == 0xff)
- to -= 8, --bp;
- }
- from = to;
- while (from > lo) {
- byte b = *--bp;
+ while (to > lo && wp[-1] == bword_1s)
+ to -= bword_bits, --wp;
+ bp = (const byte *)wp;
+ while (to > lo && bp[-1] == 0xff)
+ to -= 8, --bp;
+ }
+ from = to;
+ while (from > lo) {
+ byte b = *--bp;
- from -= 8;
- switch (b) {
- case 0xff:
- to -= 8;
- /*
- * Since we've seen a byte other than 0xff, we know
- * to != from at this point.
- */
- to[7] = from[7];
- to[6] = from[6];
- to[5] = from[5];
- to[4] = from[4];
- to[3] = from[3];
- to[2] = from[2];
- to[1] = from[1];
- to[0] = from[0];
- break;
- default:
- if (b & 0x80)
- *--to = from[7];
- if (b & 0x40)
- *--to = from[6];
- if (b & 0x20)
- *--to = from[5];
- if (b & 0x10)
- *--to = from[4];
- if (b & 8)
- *--to = from[3];
- if (b & 4)
- *--to = from[2];
- if (b & 2)
- *--to = from[1];
- if (b & 1)
- *--to = from[0];
- /* falls through */
- case 0:
- ;
- }
- }
- gs_alloc_fill(cp->ctop, gs_alloc_fill_collected,
- to - cp->ctop);
- cp->ctop = to;
+ from -= 8;
+ switch (b) {
+ case 0xff:
+ to -= 8;
+ /*
+ * Since we've seen a byte other than 0xff, we know
+ * to != from at this point.
+ */
+ to[7] = from[7];
+ to[6] = from[6];
+ to[5] = from[5];
+ to[4] = from[4];
+ to[3] = from[3];
+ to[2] = from[2];
+ to[1] = from[1];
+ to[0] = from[0];
+ break;
+ default:
+ if (b & 0x80)
+ *--to = from[7];
+ if (b & 0x40)
+ *--to = from[6];
+ if (b & 0x20)
+ *--to = from[5];
+ if (b & 0x10)
+ *--to = from[4];
+ if (b & 8)
+ *--to = from[3];
+ if (b & 4)
+ *--to = from[2];
+ if (b & 2)
+ *--to = from[1];
+ if (b & 1)
+ *--to = from[0];
+ /* falls through */
+ case 0:
+ ;
+ }
+ }
+ gs_alloc_fill(cp->ctop, gs_alloc_fill_collected,
+ to - cp->ctop);
+ cp->ctop = to;
}
}
diff --git a/gs/psi/igcstr.h b/gs/psi/igcstr.h
index d2f6514b6..b8258a501 100644
--- a/gs/psi/igcstr.h
+++ b/gs/psi/igcstr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/igstate.h b/gs/psi/igstate.h
index 82eb608ce..9f09dcb41 100644
--- a/gs/psi/igstate.h
+++ b/gs/psi/igstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,12 +63,12 @@ typedef struct ref_device_n_params_s {
/* CIE transformation procedures */
typedef struct ref_cie_procs_s {
union {
- ref DEFG;
- ref DEF;
+ ref DEFG;
+ ref DEF;
} PreDecode;
union {
- ref ABC;
- ref A;
+ ref ABC;
+ ref A;
} Decode;
ref DecodeLMN;
} ref_cie_procs;
@@ -90,20 +90,20 @@ typedef struct ref_separation_params_s {
typedef struct ref_color_procs_s {
ref_cie_procs cie;
union {
- ref_device_n_params device_n;
- ref_separation_params separation;
- ref index_proc;
+ ref_device_n_params device_n;
+ ref_separation_params separation;
+ ref index_proc;
} special;
} ref_color_procs;
typedef struct ref_colorspace_s {
ref array; /* color space (array), only relevant if */
- /* the current color space has parameters */
- /* associated with it. */
+ /* the current color space has parameters */
+ /* associated with it. */
ref_color_procs procs; /* associated procedures/parameters, */
- /* only relevant for DeviceN, CIE, */
- /* Separation, Indexed/CIE, */
- /* Indexed with procedure, or a Pattern */
- /* with one of these. */
+ /* only relevant for DeviceN, CIE, */
+ /* Separation, Indexed/CIE, */
+ /* Indexed with procedure, or a Pattern */
+ /* with one of these. */
} ref_colorspace;
#ifndef int_remap_color_info_DEFINED
@@ -117,7 +117,7 @@ typedef struct int_gstate_s {
/* executed more recently than sethalftone */
/* (for this graphics context). */
struct {
- ref red, green, blue, gray;
+ ref red, green, blue, gray;
} screen_procs, /* halftone screen procedures */
transfer_procs; /* transfer procedures */
ref black_generation; /* (procedure) */
@@ -129,8 +129,8 @@ typedef struct int_gstate_s {
*/
ref pattern[2]; /* pattern (dictionary) */
struct {
- ref dict; /* CIE color rendering dictionary */
- ref_cie_render_procs procs; /* (see above) */
+ ref dict; /* CIE color rendering dictionary */
+ ref_cie_render_procs procs; /* (see above) */
} colorrendering;
/*
* Use_cie_color tracks the UseCIEColor parameter of the page
diff --git a/gs/psi/iht.h b/gs/psi/iht.h
index dfac294e5..5d54e2040 100644
--- a/gs/psi/iht.h
+++ b/gs/psi/iht.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
int zscreen_params(os_ptr op, gs_screen_halftone * phs);
int zscreen_enum_init(i_ctx_t *i_ctx_p, const gx_ht_order * porder,
- gs_screen_halftone * phs, ref * pproc, int npop,
- op_proc_t finish_proc, int space_index);
+ gs_screen_halftone * phs, ref * pproc, int npop,
+ op_proc_t finish_proc, int space_index);
#endif /* iht_INCLUDED */
diff --git a/gs/psi/iimage.h b/gs/psi/iimage.h
index 063e07f83..d419ab67c 100644
--- a/gs/psi/iimage.h
+++ b/gs/psi/iimage.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,8 +31,8 @@ typedef struct image_params_s {
} image_params;
/* Extract and check parameters for an image. */
-int data_image_params(const gs_memory_t *mem,
- const ref *op, gs_data_image_t *pim,
+int data_image_params(const gs_memory_t *mem,
+ const ref *op, gs_data_image_t *pim,
image_params *pip, bool require_DataSource,
int num_components, int max_bits_per_component,
bool has_alpha, bool islab);
diff --git a/gs/psi/iimage2.h b/gs/psi/iimage2.h
index 5f8376553..f3e89716c 100644
--- a/gs/psi/iimage2.h
+++ b/gs/psi/iimage2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iinit.c b/gs/psi/iinit.c
index c342f8d4a..bbe7b630d 100644
--- a/gs/psi/iinit.c
+++ b/gs/psi/iinit.c
@@ -151,7 +151,6 @@ const char *const initial_dstack[] =
#define MIN_DSTACK_SIZE (countof(initial_dstack) + 1) /* +1 for systemdict */
-
/*
* Detect whether we have any Level 2 or LanguageLevel 3 operators.
* We export this for gs_init1 in imain.c.
diff --git a/gs/psi/iinit.h b/gs/psi/iinit.h
index 3e15d582b..0456be238 100644
--- a/gs/psi/iinit.h
+++ b/gs/psi/iinit.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ilevel.h b/gs/psi/ilevel.h
index 33bcfafee..d2ea4ffa5 100644
--- a/gs/psi/ilevel.h
+++ b/gs/psi/ilevel.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ilocate.c b/gs/psi/ilocate.c
index c9c2f907b..5025d81bd 100644
--- a/gs/psi/ilocate.c
+++ b/gs/psi/ilocate.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@ gc_locate(const void *ptr, gc_state_t * gcst)
const gs_ref_memory_t *other;
if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
+ return gcst->loc.cp;
mem = gcst->loc.memory;
/*
@@ -49,12 +49,12 @@ gc_locate(const void *ptr, gc_state_t * gcst)
*/
if ((other = (const gs_ref_memory_t *)mem->stable_memory) != mem ||
- (other = gcst->spaces_indexed[mem->space >> r_space_shift]) != mem
- ) {
- gcst->loc.memory = other;
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
+ (other = gcst->spaces_indexed[mem->space >> r_space_shift]) != mem
+ ) {
+ gcst->loc.memory = other;
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
}
/*
@@ -64,26 +64,26 @@ gc_locate(const void *ptr, gc_state_t * gcst)
*/
if (gcst->space_local != gcst->space_global) {
- gcst->loc.memory = other =
- (mem->space == avm_local ? gcst->space_global : gcst->space_local);
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
- /* Try its stable allocator. */
- if (other->stable_memory != (const gs_memory_t *)other) {
- gcst->loc.memory = (gs_ref_memory_t *)other->stable_memory;
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
- gcst->loc.memory = other;
- }
- /* Try other save levels of this space. */
- while (gcst->loc.memory->saved != 0) {
- gcst->loc.memory = &gcst->loc.memory->saved->state;
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
- }
+ gcst->loc.memory = other =
+ (mem->space == avm_local ? gcst->space_global : gcst->space_local);
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
+ /* Try its stable allocator. */
+ if (other->stable_memory != (const gs_memory_t *)other) {
+ gcst->loc.memory = (gs_ref_memory_t *)other->stable_memory;
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
+ gcst->loc.memory = other;
+ }
+ /* Try other save levels of this space. */
+ while (gcst->loc.memory->saved != 0) {
+ gcst->loc.memory = &gcst->loc.memory->saved->state;
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
+ }
}
/*
@@ -92,10 +92,10 @@ gc_locate(const void *ptr, gc_state_t * gcst)
*/
if (mem != gcst->space_system) {
- gcst->loc.memory = gcst->space_system;
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
+ gcst->loc.memory = gcst->space_system;
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
}
/*
@@ -106,31 +106,31 @@ gc_locate(const void *ptr, gc_state_t * gcst)
switch (mem->space) {
default: /* system */
- other = gcst->space_global;
- if (other->stable_memory != (const gs_memory_t *)other) {
- gcst->loc.memory = (gs_ref_memory_t *)other->stable_memory;
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
- }
- gcst->loc.memory = other;
- break;
+ other = gcst->space_global;
+ if (other->stable_memory != (const gs_memory_t *)other) {
+ gcst->loc.memory = (gs_ref_memory_t *)other->stable_memory;
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
+ }
+ gcst->loc.memory = other;
+ break;
case avm_global:
- gcst->loc.memory = gcst->space_global;
- break;
+ gcst->loc.memory = gcst->space_global;
+ break;
case avm_local:
- gcst->loc.memory = gcst->space_local;
- break;
+ gcst->loc.memory = gcst->space_local;
+ break;
}
for (;;) {
- if (gcst->loc.memory != mem) { /* don't do twice */
- gcst->loc.cp = 0;
- if (chunk_locate(ptr, &gcst->loc))
- return gcst->loc.cp;
- }
- if (gcst->loc.memory->saved == 0)
- break;
- gcst->loc.memory = &gcst->loc.memory->saved->state;
+ if (gcst->loc.memory != mem) { /* don't do twice */
+ gcst->loc.cp = 0;
+ if (chunk_locate(ptr, &gcst->loc))
+ return gcst->loc.cp;
+ }
+ if (gcst->loc.memory->saved == 0)
+ break;
+ gcst->loc.memory = &gcst->loc.memory->saved->state;
}
/* Restore locator to a legal state and report failure. */
@@ -146,9 +146,9 @@ gc_locate(const void *ptr, gc_state_t * gcst)
/* Define the structure for temporarily saving allocator state. */
typedef struct alloc_temp_save_s {
- chunk_t cc;
- uint rsize;
- ref rlast;
+ chunk_t cc;
+ uint rsize;
+ ref rlast;
} alloc_temp_save_t;
/* Temporarily save the state of an allocator. */
static void
@@ -158,15 +158,15 @@ alloc_temp_save(alloc_temp_save_t *pats, gs_ref_memory_t *mem)
obj_header_t *rcur = mem->cc.rcur;
if (pcc != 0) {
- pats->cc = *pcc;
- *pcc = mem->cc;
+ pats->cc = *pcc;
+ *pcc = mem->cc;
}
if (rcur != 0) {
- pats->rsize = rcur[-1].o_size;
- rcur[-1].o_size = mem->cc.rtop - (byte *) rcur;
- /* Create the final ref, reserved for the GC. */
- pats->rlast = ((ref *) mem->cc.rtop)[-1];
- make_mark((ref *) mem->cc.rtop - 1);
+ pats->rsize = rcur[-1].o_size;
+ rcur[-1].o_size = mem->cc.rtop - (byte *) rcur;
+ /* Create the final ref, reserved for the GC. */
+ pats->rlast = ((ref *) mem->cc.rtop)[-1];
+ make_mark((ref *) mem->cc.rtop - 1);
}
}
/* Restore the temporarily saved state. */
@@ -177,11 +177,11 @@ alloc_temp_restore(alloc_temp_save_t *pats, gs_ref_memory_t *mem)
obj_header_t *rcur = mem->cc.rcur;
if (rcur != 0) {
- rcur[-1].o_size = pats->rsize;
- ((ref *) mem->cc.rtop)[-1] = pats->rlast;
+ rcur[-1].o_size = pats->rsize;
+ ((ref *) mem->cc.rtop)[-1] = pats->rlast;
}
if (pcc != 0)
- *pcc = pats->cc;
+ *pcc = pats->cc;
}
/* Validate the contents of an allocator. */
@@ -191,8 +191,8 @@ ialloc_validate_spaces(const gs_dual_memory_t * dmem)
int i;
gc_state_t state;
alloc_temp_save_t
- save[countof(dmem->spaces_indexed)],
- save_stable[countof(dmem->spaces_indexed)];
+ save[countof(dmem->spaces_indexed)],
+ save_stable[countof(dmem->spaces_indexed)];
gs_ref_memory_t *mem;
state.spaces = dmem->spaces;
@@ -202,32 +202,32 @@ ialloc_validate_spaces(const gs_dual_memory_t * dmem)
/* Save everything we need to reset temporarily. */
for (i = 0; i < countof(save); i++)
- if ((mem = dmem->spaces_indexed[i]) != 0) {
- alloc_temp_save(&save[i], mem);
- if (mem->stable_memory != (gs_memory_t *)mem)
- alloc_temp_save(&save_stable[i],
- (gs_ref_memory_t *)mem->stable_memory);
- }
+ if ((mem = dmem->spaces_indexed[i]) != 0) {
+ alloc_temp_save(&save[i], mem);
+ if (mem->stable_memory != (gs_memory_t *)mem)
+ alloc_temp_save(&save_stable[i],
+ (gs_ref_memory_t *)mem->stable_memory);
+ }
/* Validate memory. */
for (i = 0; i < countof(save); i++)
- if ((mem = dmem->spaces_indexed[i]) != 0) {
- ialloc_validate_memory(mem, &state);
- if (mem->stable_memory != (gs_memory_t *)mem)
- ialloc_validate_memory((gs_ref_memory_t *)mem->stable_memory,
- &state);
- }
+ if ((mem = dmem->spaces_indexed[i]) != 0) {
+ ialloc_validate_memory(mem, &state);
+ if (mem->stable_memory != (gs_memory_t *)mem)
+ ialloc_validate_memory((gs_ref_memory_t *)mem->stable_memory,
+ &state);
+ }
/* Undo temporary changes. */
for (i = 0; i < countof(save); i++)
- if ((mem = dmem->spaces_indexed[i]) != 0) {
- if (mem->stable_memory != (gs_memory_t *)mem)
- alloc_temp_restore(&save_stable[i],
- (gs_ref_memory_t *)mem->stable_memory);
- alloc_temp_restore(&save[i], mem);
- }
+ if ((mem = dmem->spaces_indexed[i]) != 0) {
+ if (mem->stable_memory != (gs_memory_t *)mem)
+ alloc_temp_restore(&save_stable[i],
+ (gs_ref_memory_t *)mem->stable_memory);
+ alloc_temp_restore(&save[i], mem);
+ }
}
void
ialloc_validate_memory(const gs_ref_memory_t * mem, gc_state_t * gcst)
@@ -236,40 +236,40 @@ ialloc_validate_memory(const gs_ref_memory_t * mem, gc_state_t * gcst)
int level;
for (smem = mem, level = 0; smem != 0;
- smem = &smem->saved->state, --level
- ) {
- const chunk_t *cp;
- int i;
-
- if_debug3('6', "[6]validating memory 0x%lx, space %d, level %d\n",
- (ulong) mem, mem->space, level);
- /* Validate chunks. */
- for (cp = smem->cfirst; cp != 0; cp = cp->cnext)
- ialloc_validate_chunk(cp, gcst);
- /* Validate freelists. */
- for (i = 0; i < num_freelists; ++i) {
- uint free_size = i << log2_obj_align_mod;
- const obj_header_t *pfree;
-
- for (pfree = mem->freelists[i]; pfree != 0;
- pfree = *(const obj_header_t * const *)pfree
- ) {
- uint size = pfree[-1].o_size;
-
- if (pfree[-1].o_type != &st_free) {
- lprintf3("Non-free object 0x%lx(%u) on freelist %i!\n",
- (ulong) pfree, size, i);
- break;
- }
- if ((i == LARGE_FREELIST_INDEX && size < max_freelist_size) ||
- (i != LARGE_FREELIST_INDEX &&
- (size < free_size - obj_align_mask || size > free_size))) {
- lprintf3("Object 0x%lx(%u) size wrong on freelist %i!\n",
- (ulong) pfree, size, i);
- break;
- }
- }
- }
+ smem = &smem->saved->state, --level
+ ) {
+ const chunk_t *cp;
+ int i;
+
+ if_debug3('6', "[6]validating memory 0x%lx, space %d, level %d\n",
+ (ulong) mem, mem->space, level);
+ /* Validate chunks. */
+ for (cp = smem->cfirst; cp != 0; cp = cp->cnext)
+ ialloc_validate_chunk(cp, gcst);
+ /* Validate freelists. */
+ for (i = 0; i < num_freelists; ++i) {
+ uint free_size = i << log2_obj_align_mod;
+ const obj_header_t *pfree;
+
+ for (pfree = mem->freelists[i]; pfree != 0;
+ pfree = *(const obj_header_t * const *)pfree
+ ) {
+ uint size = pfree[-1].o_size;
+
+ if (pfree[-1].o_type != &st_free) {
+ lprintf3("Non-free object 0x%lx(%u) on freelist %i!\n",
+ (ulong) pfree, size, i);
+ break;
+ }
+ if ((i == LARGE_FREELIST_INDEX && size < max_freelist_size) ||
+ (i != LARGE_FREELIST_INDEX &&
+ (size < free_size - obj_align_mask || size > free_size))) {
+ lprintf3("Object 0x%lx(%u) size wrong on freelist %i!\n",
+ (ulong) pfree, size, i);
+ break;
+ }
+ }
+ }
};
}
@@ -278,13 +278,13 @@ static inline bool
object_size_valid(const obj_header_t * pre, uint size, const chunk_t * cp)
{
return (pre->o_alone ? (const byte *)pre == cp->cbase :
- size <= cp->ctop - (const byte *)(pre + 1));
+ size <= cp->ctop - (const byte *)(pre + 1));
}
/* Validate all the objects in a chunk. */
#if IGC_PTR_STABILITY_CHECK
-void ialloc_validate_pointer_stability(const obj_header_t * ptr_from,
- const obj_header_t * ptr_to);
+void ialloc_validate_pointer_stability(const obj_header_t * ptr_from,
+ const obj_header_t * ptr_to);
static void ialloc_validate_ref(const ref *, gc_state_t *, const obj_header_t *pre_fr);
static void ialloc_validate_ref_packed(const ref_packed *, gc_state_t *, const obj_header_t *pre_fr);
#else
@@ -297,53 +297,53 @@ ialloc_validate_chunk(const chunk_t * cp, gc_state_t * gcst)
if_debug_chunk('6', "[6]validating chunk", cp);
SCAN_CHUNK_OBJECTS(cp);
DO_ALL
- if (pre->o_type == &st_free) {
- if (!object_size_valid(pre, size, cp))
- lprintf3("Bad free object 0x%lx(%lu), in chunk 0x%lx!\n",
- (ulong) (pre + 1), (ulong) size, (ulong) cp);
- } else
- ialloc_validate_object(pre + 1, cp, gcst);
+ if (pre->o_type == &st_free) {
+ if (!object_size_valid(pre, size, cp))
+ lprintf3("Bad free object 0x%lx(%lu), in chunk 0x%lx!\n",
+ (ulong) (pre + 1), (ulong) size, (ulong) cp);
+ } else
+ ialloc_validate_object(pre + 1, cp, gcst);
if_debug3('7', " [7]validating %s(%lu) 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) size, (ulong) pre);
+ struct_type_name_string(pre->o_type),
+ (ulong) size, (ulong) pre);
if (pre->o_type == &st_refs) {
- const ref_packed *rp = (const ref_packed *)(pre + 1);
- const char *end = (const char *)rp + size;
+ const ref_packed *rp = (const ref_packed *)(pre + 1);
+ const char *end = (const char *)rp + size;
- while ((const char *)rp < end) {
+ while ((const char *)rp < end) {
# if IGC_PTR_STABILITY_CHECK
- ialloc_validate_ref_packed(rp, gcst, pre);
+ ialloc_validate_ref_packed(rp, gcst, pre);
# else
- ialloc_validate_ref_packed(rp, gcst);
+ ialloc_validate_ref_packed(rp, gcst);
# endif
- rp = packed_next(rp);
- }
+ rp = packed_next(rp);
+ }
} else {
- struct_proc_enum_ptrs((*proc)) = pre->o_type->enum_ptrs;
- uint index = 0;
- enum_ptr_t eptr;
- gs_ptr_type_t ptype;
-
- if (proc != gs_no_struct_enum_ptrs)
- for (; (ptype = (*proc) (gcst_get_memory_ptr(gcst),
- pre + 1, size, index, &eptr,
- pre->o_type, gcst)) != 0; ++index) {
- if (eptr.ptr == 0)
- DO_NOTHING;
+ struct_proc_enum_ptrs((*proc)) = pre->o_type->enum_ptrs;
+ uint index = 0;
+ enum_ptr_t eptr;
+ gs_ptr_type_t ptype;
+
+ if (proc != gs_no_struct_enum_ptrs)
+ for (; (ptype = (*proc) (gcst_get_memory_ptr(gcst),
+ pre + 1, size, index, &eptr,
+ pre->o_type, gcst)) != 0; ++index) {
+ if (eptr.ptr == 0)
+ DO_NOTHING;
/* NB check other types ptr_string_type, etc. */
- else if (ptype == ptr_struct_type) {
- ialloc_validate_object(eptr.ptr, NULL, gcst);
+ else if (ptype == ptr_struct_type) {
+ ialloc_validate_object(eptr.ptr, NULL, gcst);
# if IGC_PTR_STABILITY_CHECK
- ialloc_validate_pointer_stability(pre,
- (const obj_header_t *)eptr.ptr - 1);
+ ialloc_validate_pointer_stability(pre,
+ (const obj_header_t *)eptr.ptr - 1);
# endif
- } else if (ptype == ptr_ref_type)
+ } else if (ptype == ptr_ref_type)
# if IGC_PTR_STABILITY_CHECK
- ialloc_validate_ref_packed(eptr.ptr, gcst, pre);
+ ialloc_validate_ref_packed(eptr.ptr, gcst, pre);
# else
- ialloc_validate_ref_packed(eptr.ptr, gcst);
+ ialloc_validate_ref_packed(eptr.ptr, gcst);
# endif
- }
+ }
}
END_OBJECTS_SCAN
}
@@ -355,12 +355,12 @@ ialloc_validate_ref_packed(const ref_packed * rp, gc_state_t * gcst, const obj_h
const gs_memory_t *cmem = gcst->spaces.memories.named.system->stable_memory;
if (r_is_packed(rp)) {
- ref unpacked;
+ ref unpacked;
- packed_get(cmem, rp, &unpacked);
- ialloc_validate_ref(&unpacked, gcst, pre_fr);
+ packed_get(cmem, rp, &unpacked);
+ ialloc_validate_ref(&unpacked, gcst, pre_fr);
} else {
- ialloc_validate_ref((const ref *)rp, gcst, pre_fr);
+ ialloc_validate_ref((const ref *)rp, gcst, pre_fr);
}
}
#else
@@ -370,21 +370,21 @@ ialloc_validate_ref_packed(const ref_packed * rp, gc_state_t * gcst)
const gs_memory_t *cmem = gcst->spaces.memories.named.system->stable_memory;
if (r_is_packed(rp)) {
- ref unpacked;
+ ref unpacked;
- packed_get(cmem, rp, &unpacked);
- ialloc_validate_ref(&unpacked, gcst);
+ packed_get(cmem, rp, &unpacked);
+ ialloc_validate_ref(&unpacked, gcst);
} else {
- ialloc_validate_ref((const ref *)rp, gcst);
+ ialloc_validate_ref((const ref *)rp, gcst);
}
}
#endif
static void
ialloc_validate_ref(const ref * pref, gc_state_t * gcst
# if IGC_PTR_STABILITY_CHECK
- , const obj_header_t *pre_fr
+ , const obj_header_t *pre_fr
# endif
- )
+ )
{
const void *optr;
const ref *rptr;
@@ -393,123 +393,123 @@ ialloc_validate_ref(const ref * pref, gc_state_t * gcst
const gs_memory_t *cmem = gcst->spaces.memories.named.system->stable_memory;
if (!gs_debug_c('?'))
- return; /* no check */
+ return; /* no check */
if (r_space(pref) == avm_foreign)
- return;
+ return;
switch (r_type(pref)) {
- case t_file:
- optr = pref->value.pfile;
- goto cks;
- case t_device:
- optr = pref->value.pdevice;
- goto cks;
- case t_fontID:
- case t_struct:
- case t_astruct:
- optr = pref->value.pstruct;
+ case t_file:
+ optr = pref->value.pfile;
+ goto cks;
+ case t_device:
+ optr = pref->value.pdevice;
+ goto cks;
+ case t_fontID:
+ case t_struct:
+ case t_astruct:
+ optr = pref->value.pstruct;
cks: if (optr != 0) {
- ialloc_validate_object(optr, NULL, gcst);
+ ialloc_validate_object(optr, NULL, gcst);
# if IGC_PTR_STABILITY_CHECK
- ialloc_validate_pointer_stability(pre_fr,
- (const obj_header_t *)optr - 1);
+ ialloc_validate_pointer_stability(pre_fr,
+ (const obj_header_t *)optr - 1);
# endif
- }
- break;
- case t_name:
- if (name_index_ptr(cmem, name_index(cmem, pref)) != pref->value.pname) {
- lprintf3("At 0x%lx, bad name %u, pname = 0x%lx\n",
- (ulong) pref, (uint)name_index(cmem, pref),
- (ulong) pref->value.pname);
- break;
- } {
- ref sref;
-
- name_string_ref(cmem, pref, &sref);
- if (r_space(&sref) != avm_foreign &&
- !gc_locate(sref.value.const_bytes, gcst)
- ) {
- lprintf4("At 0x%lx, bad name %u, pname = 0x%lx, string 0x%lx not in any chunk\n",
- (ulong) pref, (uint) r_size(pref),
- (ulong) pref->value.pname,
- (ulong) sref.value.const_bytes);
- }
- }
- break;
- case t_string:
- if (r_size(pref) != 0 && !gc_locate(pref->value.bytes, gcst))
- lprintf3("At 0x%lx, string ptr 0x%lx[%u] not in any chunk\n",
- (ulong) pref, (ulong) pref->value.bytes,
- (uint) r_size(pref));
- break;
- case t_array:
- if (r_size(pref) == 0)
- break;
- rptr = pref->value.refs;
- size = r_size(pref);
- tname = "array";
+ }
+ break;
+ case t_name:
+ if (name_index_ptr(cmem, name_index(cmem, pref)) != pref->value.pname) {
+ lprintf3("At 0x%lx, bad name %u, pname = 0x%lx\n",
+ (ulong) pref, (uint)name_index(cmem, pref),
+ (ulong) pref->value.pname);
+ break;
+ } {
+ ref sref;
+
+ name_string_ref(cmem, pref, &sref);
+ if (r_space(&sref) != avm_foreign &&
+ !gc_locate(sref.value.const_bytes, gcst)
+ ) {
+ lprintf4("At 0x%lx, bad name %u, pname = 0x%lx, string 0x%lx not in any chunk\n",
+ (ulong) pref, (uint) r_size(pref),
+ (ulong) pref->value.pname,
+ (ulong) sref.value.const_bytes);
+ }
+ }
+ break;
+ case t_string:
+ if (r_size(pref) != 0 && !gc_locate(pref->value.bytes, gcst))
+ lprintf3("At 0x%lx, string ptr 0x%lx[%u] not in any chunk\n",
+ (ulong) pref, (ulong) pref->value.bytes,
+ (uint) r_size(pref));
+ break;
+ case t_array:
+ if (r_size(pref) == 0)
+ break;
+ rptr = pref->value.refs;
+ size = r_size(pref);
+ tname = "array";
cka: if (!gc_locate(rptr, gcst)) {
- lprintf3("At 0x%lx, %s 0x%lx not in any chunk\n",
- (ulong) pref, tname, (ulong) rptr);
- break;
- } {
- uint i;
-
- for (i = 0; i < size; ++i) {
- const ref *elt = rptr + i;
-
- if (r_is_packed(elt))
- lprintf5("At 0x%lx, %s 0x%lx[%u] element %u is not a ref\n",
- (ulong) pref, tname, (ulong) rptr, size, i);
- }
- }
- break;
- case t_shortarray:
- case t_mixedarray:
- if (r_size(pref) == 0)
- break;
- optr = pref->value.packed;
- if (!gc_locate(optr, gcst))
- lprintf2("At 0x%lx, packed array 0x%lx not in any chunk\n",
- (ulong) pref, (ulong) optr);
- break;
- case t_dictionary:
- {
- const dict *pdict = pref->value.pdict;
-
- if (!r_has_type(&pdict->values, t_array) ||
- !r_is_array(&pdict->keys) ||
- !r_has_type(&pdict->count, t_integer) ||
- !r_has_type(&pdict->maxlength, t_integer)
- )
- lprintf2("At 0x%lx, invalid dict 0x%lx\n",
- (ulong) pref, (ulong) pdict);
- rptr = (const ref *)pdict;
- }
- size = sizeof(dict) / sizeof(ref);
- tname = "dict";
- goto cka;
+ lprintf3("At 0x%lx, %s 0x%lx not in any chunk\n",
+ (ulong) pref, tname, (ulong) rptr);
+ break;
+ } {
+ uint i;
+
+ for (i = 0; i < size; ++i) {
+ const ref *elt = rptr + i;
+
+ if (r_is_packed(elt))
+ lprintf5("At 0x%lx, %s 0x%lx[%u] element %u is not a ref\n",
+ (ulong) pref, tname, (ulong) rptr, size, i);
+ }
+ }
+ break;
+ case t_shortarray:
+ case t_mixedarray:
+ if (r_size(pref) == 0)
+ break;
+ optr = pref->value.packed;
+ if (!gc_locate(optr, gcst))
+ lprintf2("At 0x%lx, packed array 0x%lx not in any chunk\n",
+ (ulong) pref, (ulong) optr);
+ break;
+ case t_dictionary:
+ {
+ const dict *pdict = pref->value.pdict;
+
+ if (!r_has_type(&pdict->values, t_array) ||
+ !r_is_array(&pdict->keys) ||
+ !r_has_type(&pdict->count, t_integer) ||
+ !r_has_type(&pdict->maxlength, t_integer)
+ )
+ lprintf2("At 0x%lx, invalid dict 0x%lx\n",
+ (ulong) pref, (ulong) pdict);
+ rptr = (const ref *)pdict;
+ }
+ size = sizeof(dict) / sizeof(ref);
+ tname = "dict";
+ goto cka;
}
}
#if IGC_PTR_STABILITY_CHECK
/* Validate an pointer stability. */
void
-ialloc_validate_pointer_stability(const obj_header_t * ptr_fr,
- const obj_header_t * ptr_to)
+ialloc_validate_pointer_stability(const obj_header_t * ptr_fr,
+ const obj_header_t * ptr_to)
{
- static const char *sn[] = {"undef", "undef", "system", "undef",
- "global_stable", "global", "local_stable", "local"};
+ static const char *sn[] = {"undef", "undef", "system", "undef",
+ "global_stable", "global", "local_stable", "local"};
if (ptr_fr->d.o.space_id < ptr_to->d.o.space_id) {
- const char *sn_fr = (ptr_fr->d.o.space_id < count_of(sn)
- ? sn[ptr_fr->d.o.space_id] : "unknown");
- const char *sn_to = (ptr_to->d.o.space_id < count_of(sn)
- ? sn[ptr_to->d.o.space_id] : "unknown");
-
- lprintf6("Reference to a less stable object 0x%lx<%s> "
- "in the space \'%s\' from 0x%lx<%s> in the space \'%s\' !\n",
- (ulong) ptr_to, ptr_to->d.o.t.type->sname, sn_to,
- (ulong) ptr_fr, ptr_fr->d.o.t.type->sname, sn_fr);
+ const char *sn_fr = (ptr_fr->d.o.space_id < count_of(sn)
+ ? sn[ptr_fr->d.o.space_id] : "unknown");
+ const char *sn_to = (ptr_to->d.o.space_id < count_of(sn)
+ ? sn[ptr_to->d.o.space_id] : "unknown");
+
+ lprintf6("Reference to a less stable object 0x%lx<%s> "
+ "in the space \'%s\' from 0x%lx<%s> in the space \'%s\' !\n",
+ (ulong) ptr_to, ptr_to->d.o.t.type->sname, sn_to,
+ (ulong) ptr_fr, ptr_fr->d.o.t.type->sname, sn_fr);
}
}
#endif
@@ -517,7 +517,7 @@ ialloc_validate_pointer_stability(const obj_header_t * ptr_fr,
/* Validate an object. */
void
ialloc_validate_object(const obj_header_t * ptr, const chunk_t * cp,
- gc_state_t * gcst)
+ gc_state_t * gcst)
{
const obj_header_t *pre = ptr - 1;
ulong size = pre_obj_contents_size(pre);
@@ -525,33 +525,33 @@ ialloc_validate_object(const obj_header_t * ptr, const chunk_t * cp,
const char *oname;
if (!gs_debug_c('?'))
- return; /* no check */
+ return; /* no check */
if (cp == 0 && gcst != 0) {
- gc_state_t st;
-
- st = *gcst; /* no side effects! */
- if (!(cp = gc_locate(pre, &st))) {
- lprintf1("Object 0x%lx not in any chunk!\n",
- (ulong) ptr);
- return; /*gs_abort(); */
- }
+ gc_state_t st;
+
+ st = *gcst; /* no side effects! */
+ if (!(cp = gc_locate(pre, &st))) {
+ lprintf1("Object 0x%lx not in any chunk!\n",
+ (ulong) ptr);
+ return; /*gs_abort(); */
+ }
}
if (otype == &st_free) {
- lprintf3("Reference to free object 0x%lx(%lu), in chunk 0x%lx!\n",
- (ulong) ptr, (ulong) size, (ulong) cp);
- gs_abort(gcst->heap);
+ lprintf3("Reference to free object 0x%lx(%lu), in chunk 0x%lx!\n",
+ (ulong) ptr, (ulong) size, (ulong) cp);
+ gs_abort(gcst->heap);
}
if ((cp != 0 && !object_size_valid(pre, size, cp)) ||
- otype->ssize == 0 ||
- size % otype->ssize != 0 ||
- (oname = struct_type_name_string(otype),
- *oname < 33 || *oname > 126)
- ) {
- lprintf2("Bad object 0x%lx(%lu),\n",
- (ulong) ptr, (ulong) size);
- dprintf2(" ssize = %u, in chunk 0x%lx!\n",
- otype->ssize, (ulong) cp);
- gs_abort(gcst->heap);
+ otype->ssize == 0 ||
+ size % otype->ssize != 0 ||
+ (oname = struct_type_name_string(otype),
+ *oname < 33 || *oname > 126)
+ ) {
+ lprintf2("Bad object 0x%lx(%lu),\n",
+ (ulong) ptr, (ulong) size);
+ dprintf2(" ssize = %u, in chunk 0x%lx!\n",
+ otype->ssize, (ulong) cp);
+ gs_abort(gcst->heap);
}
}
@@ -574,7 +574,7 @@ ialloc_validate_chunk(const chunk_t * cp, gc_state_t * gcst)
void
ialloc_validate_object(const obj_header_t * ptr, const chunk_t * cp,
- gc_state_t * gcst)
+ gc_state_t * gcst)
{
}
diff --git a/gs/psi/imain.c b/gs/psi/imain.c
index 80a496c63..376730dc7 100644
--- a/gs/psi/imain.c
+++ b/gs/psi/imain.c
@@ -111,7 +111,6 @@ get_local_op_array(const gs_memory_t *mem)
return &minst->i_ctx_p->op_array_table_local;
}
-
/* ------ Forward references ------ */
static int gs_run_init_file(gs_main_instance *, int *, ref *);
@@ -935,4 +934,3 @@ gs_main_dump_stack(gs_main_instance *minst, int code, ref * perror_object)
debug_dump_stack(minst->heap, &e_stack, "Execution stack");
debug_dump_stack(minst->heap, &d_stack, "Dictionary stack");
}
-
diff --git a/gs/psi/imain.h b/gs/psi/imain.h
index 6257b58f8..1f631ed00 100644
--- a/gs/psi/imain.h
+++ b/gs/psi/imain.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,7 @@ typedef struct gs_main_instance_s gs_main_instance;
/* ================ Exported procedures from imain.c ================ */
-/* get minst from memory is a hack to allow parts of the system
+/* get minst from memory is a hack to allow parts of the system
* to reach minst, slightly better than a global
*/
gs_main_instance* get_minst_from_memory(const gs_memory_t *mem);
@@ -51,10 +51,10 @@ gs_main_instance* get_minst_from_memory(const gs_memory_t *mem);
/*
* NB: multiple instances are not supported yet
- *
+ *
* // add usage documentation
*/
-gs_main_instance *gs_main_alloc_instance(gs_memory_t *);
+gs_main_instance *gs_main_alloc_instance(gs_memory_t *);
/* ---------------- Initialization ---------------- */
@@ -69,7 +69,7 @@ gs_main_instance *gs_main_alloc_instance(gs_memory_t *);
* graphics library, the file search paths, and other instance data.
*/
int gs_main_init0(gs_main_instance *minst, FILE *in, FILE *out, FILE *err,
- int max_lib_paths);
+ int max_lib_paths);
/*
* init1 initializes the memory manager and other internal data
@@ -107,7 +107,7 @@ int gs_main_set_lib_paths(gs_main_instance * minst);
* file itself, and eventually the procedure may be removed.
*/
int gs_main_lib_open(gs_main_instance * minst, const char *fname,
- ref * pfile);
+ ref * pfile);
/*
* Here we summarize the C API calls that correspond to some of the
@@ -157,22 +157,22 @@ int gs_main_lib_open(gs_main_instance * minst, const char *fname,
* or statically).
*/
int gs_main_run_file(gs_main_instance * minst, const char *fname,
- int user_errors, int *pexit_code,
- ref * perror_object);
+ int user_errors, int *pexit_code,
+ ref * perror_object);
int gs_main_run_string(gs_main_instance * minst, const char *str,
- int user_errors, int *pexit_code,
- ref * perror_object);
+ int user_errors, int *pexit_code,
+ ref * perror_object);
int gs_main_run_string_with_length(gs_main_instance * minst,
- const char *str, uint length,
- int user_errors, int *pexit_code,
- ref * perror_object);
+ const char *str, uint length,
+ int user_errors, int *pexit_code,
+ ref * perror_object);
/*
* Open the file for gs_main_run_file. This is an internal routine
* that is only exported for some special clients.
*/
int gs_main_run_file_open(gs_main_instance * minst,
- const char *file_name, ref * pfref);
+ const char *file_name, ref * pfref);
/*
* The next 3 procedures provide for feeding input to the interpreter
@@ -188,13 +188,13 @@ int gs_main_run_file_open(gs_main_instance * minst,
* run_string_with_length.
*/
int gs_main_run_string_begin(gs_main_instance * minst, int user_errors,
- int *pexit_code, ref * perror_object);
+ int *pexit_code, ref * perror_object);
int gs_main_run_string_continue(gs_main_instance * minst,
- const char *str, uint length,
- int user_errors, int *pexit_code,
- ref * perror_object);
+ const char *str, uint length,
+ int user_errors, int *pexit_code,
+ ref * perror_object);
int gs_main_run_string_end(gs_main_instance * minst, int user_errors,
- int *pexit_code, ref * perror_object);
+ int *pexit_code, ref * perror_object);
/* ---------------- Operand stack access ---------------- */
@@ -211,7 +211,7 @@ int gs_push_boolean(gs_main_instance * minst, bool value);
int gs_push_integer(gs_main_instance * minst, long value);
int gs_push_real(gs_main_instance * minst, floatp value);
int gs_push_string(gs_main_instance * minst, byte * chars, uint length,
- bool read_only);
+ bool read_only);
/*
* Procedures to pop values from the operand stack:
@@ -231,13 +231,10 @@ int gs_pop_string(gs_main_instance * minst, gs_string * result);
* never call this.
*/
void gs_main_dump_stack(gs_main_instance *minst, int code,
- ref * perror_object);
+ ref * perror_object);
/* ---------------- Console output ---------------- */
-
-
-
/* ---------------- Termination ---------------- */
/*
diff --git a/gs/psi/imainarg.h b/gs/psi/imainarg.h
index f2021e2b4..cb0120ab2 100644
--- a/gs/psi/imainarg.h
+++ b/gs/psi/imainarg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/imemory.h b/gs/psi/imemory.h
index b5fcd1a69..d1ff1401a 100644
--- a/gs/psi/imemory.h
+++ b/gs/psi/imemory.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,34 +33,33 @@
typedef struct gs_ref_memory_s gs_ref_memory_t;
#endif
- /* Allocate a ref array. */
+ /* Allocate a ref array. */
int gs_alloc_ref_array(gs_ref_memory_t * mem, ref * paref,
- uint attrs, uint num_refs, client_name_t cname);
+ uint attrs, uint num_refs, client_name_t cname);
- /* Resize a ref array. */
- /* Currently this is only implemented for shrinking, */
- /* not growing. */
+ /* Resize a ref array. */
+ /* Currently this is only implemented for shrinking, */
+ /* not growing. */
int gs_resize_ref_array(gs_ref_memory_t * mem, ref * paref,
- uint new_num_refs, client_name_t cname);
+ uint new_num_refs, client_name_t cname);
- /* Free a ref array. */
+ /* Free a ref array. */
void gs_free_ref_array(gs_ref_memory_t * mem, ref * paref,
- client_name_t cname);
+ client_name_t cname);
- /* Allocate a string ref. */
+ /* Allocate a string ref. */
int gs_alloc_string_ref(gs_ref_memory_t * mem, ref * psref,
- uint attrs, uint nbytes, client_name_t cname);
+ uint attrs, uint nbytes, client_name_t cname);
/* Register a ref root. This just calls gs_register_root. */
/* Note that ref roots are a little peculiar: they assume that */
/* the ref * that they point to points to a *statically* allocated ref. */
int gs_register_ref_root(gs_memory_t *mem, gs_gc_root_t *root,
- void **pp, client_name_t cname);
-
+ void **pp, client_name_t cname);
/*
* The interpreter allocator can allocate in either local or global VM,
diff --git a/gs/psi/iminst.h b/gs/psi/iminst.h
index 6dd45cc78..b6d03e737 100644
--- a/gs/psi/iminst.h
+++ b/gs/psi/iminst.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,7 +63,7 @@ struct gs_main_instance_s {
int user_errors; /* define what to do with errors */
bool search_here_first; /* if true, make '.' first lib dir */
bool run_start; /* if true, run 'start' after */
- /* processing command line */
+ /* processing command line */
gs_file_path lib_path; /* library search list (GS_LIB) */
long base_time[2]; /* starting usertime */
void *readline_data; /* data for gp_readline */
diff --git a/gs/psi/iname.c b/gs/psi/iname.c
index a258e004a..96a6e8d8a 100644
--- a/gs/psi/iname.c
+++ b/gs/psi/iname.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,10 +40,10 @@ static const byte nt_1char_names[NT_1CHAR_SIZE] = {
/* Structure descriptors */
gs_private_st_simple(st_name_sub_table, name_sub_table, "name_sub_table");
gs_private_st_composite(st_name_string_sub_table, name_string_sub_table_t,
- "name_string_sub_table_t",
- name_string_sub_enum_ptrs, name_string_sub_reloc_ptrs);
+ "name_string_sub_table_t",
+ name_string_sub_enum_ptrs, name_string_sub_reloc_ptrs);
gs_private_st_composite(st_name_table, name_table, "name_table",
- name_table_enum_ptrs, name_table_reloc_ptrs);
+ name_table_enum_ptrs, name_table_reloc_ptrs);
/* Forward references */
static int name_alloc_sub(name_table *);
@@ -61,7 +61,7 @@ name_print(const char *msg, const name_table *nt, uint nidx, const int *pflag)
dlprintf1("[n]%s", msg);
if (pflag)
- dprintf1("(%d)", *pflag);
+ dprintf1("(%d)", *pflag);
dprintf2(" (0x%lx#%u)", (ulong)pname, nidx);
debug_print_string(str, pnstr->string_size);
dprintf2("(0x%lx,%u)\n", (ulong)str, pnstr->string_size);
@@ -81,44 +81,44 @@ names_init(ulong count, gs_ref_memory_t *imem)
int i;
if (count == 0)
- count = max_name_count + 1L;
+ count = max_name_count + 1L;
else if (count - 1 > max_name_count)
- return 0;
+ return 0;
nt = gs_alloc_struct(mem, name_table, &st_name_table, "name_init(nt)");
if (nt == 0)
- return 0;
+ return 0;
memset(nt, 0, sizeof(name_table));
nt->max_sub_count =
- ((count - 1) | nt_sub_index_mask) >> nt_log2_sub_size;
+ ((count - 1) | nt_sub_index_mask) >> nt_log2_sub_size;
nt->name_string_attrs = imemory_space(imem) | a_readonly;
nt->memory = mem;
/* Initialize the one-character names. */
/* Start by creating the necessary sub-tables. */
for (i = 0; i < NT_1CHAR_FIRST + NT_1CHAR_SIZE; i += nt_sub_size) {
- int code = name_alloc_sub(nt);
-
- if (code < 0) {
- while (nt->sub_next > 0)
- name_free_sub(nt, --(nt->sub_next), false);
- gs_free_object(mem, nt, "name_init(nt)");
- return 0;
- }
+ int code = name_alloc_sub(nt);
+
+ if (code < 0) {
+ while (nt->sub_next > 0)
+ name_free_sub(nt, --(nt->sub_next), false);
+ gs_free_object(mem, nt, "name_init(nt)");
+ return 0;
+ }
}
for (i = -1; i < NT_1CHAR_SIZE; i++) {
- uint ncnt = NT_1CHAR_FIRST + i;
- uint nidx = name_count_to_index(ncnt);
- name *pname = names_index_ptr_inline(nt, nidx);
- name_string_t *pnstr = names_index_string_inline(nt, nidx);
-
- if (i < 0)
- pnstr->string_bytes = nt_1char_names,
- pnstr->string_size = 0;
- else
- pnstr->string_bytes = nt_1char_names + i,
- pnstr->string_size = 1;
- pnstr->foreign_string = 1;
- pnstr->mark = 1;
- pname->pvalue = pv_no_defn;
+ uint ncnt = NT_1CHAR_FIRST + i;
+ uint nidx = name_count_to_index(ncnt);
+ name *pname = names_index_ptr_inline(nt, nidx);
+ name_string_t *pnstr = names_index_string_inline(nt, nidx);
+
+ if (i < 0)
+ pnstr->string_bytes = nt_1char_names,
+ pnstr->string_size = 0;
+ else
+ pnstr->string_bytes = nt_1char_names + i,
+ pnstr->string_size = 1;
+ pnstr->foreign_string = 1;
+ pnstr->mark = 1;
+ pname->pvalue = pv_no_defn;
}
nt->perm_count = NT_1CHAR_FIRST + NT_1CHAR_SIZE;
/* Reconstruct the free list. */
@@ -150,63 +150,63 @@ names_ref(name_table *nt, const byte *ptr, uint size, ref *pref, int enterflag)
/* Make a special check for 1-character names. */
switch (size) {
case 0:
- nidx = name_count_to_index(1);
- pname = names_index_ptr_inline(nt, nidx);
- goto mkn;
+ nidx = name_count_to_index(1);
+ pname = names_index_ptr_inline(nt, nidx);
+ goto mkn;
case 1:
- if (*ptr < NT_1CHAR_SIZE) {
- uint hash = *ptr + NT_1CHAR_FIRST;
-
- nidx = name_count_to_index(hash);
- pname = names_index_ptr_inline(nt, nidx);
- goto mkn;
- }
- /* falls through */
+ if (*ptr < NT_1CHAR_SIZE) {
+ uint hash = *ptr + NT_1CHAR_FIRST;
+
+ nidx = name_count_to_index(hash);
+ pname = names_index_ptr_inline(nt, nidx);
+ goto mkn;
+ }
+ /* falls through */
default: {
- uint hash;
+ uint hash;
- NAME_HASH(hash, hash_permutation, ptr, size);
- phash = nt->hash + (hash & (NT_HASH_SIZE - 1));
+ NAME_HASH(hash, hash_permutation, ptr, size);
+ phash = nt->hash + (hash & (NT_HASH_SIZE - 1));
}
}
for (nidx = *phash; nidx != 0;
- nidx = name_next_index(nidx, pnstr)
- ) {
- pnstr = names_index_string_inline(nt, nidx);
- if (pnstr->string_size == size &&
- !memcmp_inline(ptr, pnstr->string_bytes, size)
- ) {
- pname = name_index_ptr_inline(nt, nidx);
- goto mkn;
- }
+ nidx = name_next_index(nidx, pnstr)
+ ) {
+ pnstr = names_index_string_inline(nt, nidx);
+ if (pnstr->string_size == size &&
+ !memcmp_inline(ptr, pnstr->string_bytes, size)
+ ) {
+ pname = name_index_ptr_inline(nt, nidx);
+ goto mkn;
+ }
}
/* Name was not in the table. Make a new entry. */
if (enterflag < 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (size > max_name_string)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
nidx = nt->free;
if (nidx == 0) {
- int code = name_alloc_sub(nt);
+ int code = name_alloc_sub(nt);
- if (code < 0)
- return code;
- nidx = nt->free;
+ if (code < 0)
+ return code;
+ nidx = nt->free;
}
pnstr = names_index_string_inline(nt, nidx);
if (enterflag == 1) {
- byte *cptr = (byte *)gs_alloc_string(nt->memory, size,
- "names_ref(string)");
-
- if (cptr == 0)
- return_error(e_VMerror);
- memcpy(cptr, ptr, size);
- pnstr->string_bytes = cptr;
- pnstr->foreign_string = 0;
+ byte *cptr = (byte *)gs_alloc_string(nt->memory, size,
+ "names_ref(string)");
+
+ if (cptr == 0)
+ return_error(e_VMerror);
+ memcpy(cptr, ptr, size);
+ pnstr->string_bytes = cptr;
+ pnstr->foreign_string = 0;
} else {
- pnstr->string_bytes = ptr;
- pnstr->foreign_string = (enterflag == 0 ? 1 : 0);
+ pnstr->string_bytes = ptr;
+ pnstr->foreign_string = (enterflag == 0 ? 1 : 0);
}
pnstr->string_size = size;
pname = name_index_ptr_inline(nt, nidx);
@@ -223,15 +223,15 @@ names_ref(name_table *nt, const byte *ptr, uint size, ref *pref, int enterflag)
/* Get the string for a name. */
void
names_string_ref(const name_table * nt, const ref * pnref /* t_name */ ,
- ref * psref /* result, t_string */ )
+ ref * psref /* result, t_string */ )
{
const name_string_t *pnstr = names_string_inline(nt, pnref);
make_const_string(psref,
- (pnstr->foreign_string ? avm_foreign | a_readonly :
- nt->name_string_attrs),
- pnstr->string_size,
- (const byte *)pnstr->string_bytes);
+ (pnstr->foreign_string ? avm_foreign | a_readonly :
+ nt->name_string_attrs),
+ pnstr->string_size,
+ (const byte *)pnstr->string_bytes);
}
/* Convert a t_string object to a name. */
@@ -243,9 +243,9 @@ names_from_string(name_table * nt, const ref * psref, ref * pnref)
int code = names_ref(nt, psref->value.bytes, r_size(psref), pnref, 1);
if (code < 0)
- return code;
+ return code;
if (exec)
- r_set_attrs(pnref, a_executable);
+ r_set_attrs(pnref, a_executable);
return code;
}
@@ -288,20 +288,20 @@ name_index_t
names_next_valid_index(name_table * nt, name_index_t nidx)
{
const name_string_sub_table_t *ssub =
- nt->sub[nidx >> nt_log2_sub_size].strings;
+ nt->sub[nidx >> nt_log2_sub_size].strings;
const name_string_t *pnstr;
do {
- ++nidx;
- if ((nidx & nt_sub_index_mask) == 0)
- for (;; nidx += nt_sub_size) {
- if ((nidx >> nt_log2_sub_size) >= nt->sub_count)
- return 0;
- ssub = nt->sub[nidx >> nt_log2_sub_size].strings;
- if (ssub != 0)
- break;
- }
- pnstr = &ssub->strings[nidx & nt_sub_index_mask];
+ ++nidx;
+ if ((nidx & nt_sub_index_mask) == 0)
+ for (;; nidx += nt_sub_size) {
+ if ((nidx >> nt_log2_sub_size) >= nt->sub_count)
+ return 0;
+ ssub = nt->sub[nidx >> nt_log2_sub_size].strings;
+ if (ssub != 0)
+ break;
+ }
+ pnstr = &ssub->strings[nidx & nt_sub_index_mask];
}
while (pnstr->string_bytes == 0);
return nidx;
@@ -317,15 +317,15 @@ names_unmark_all(name_table * nt)
name_string_sub_table_t *ssub;
for (si = 0; si < nt->sub_count; ++si)
- if ((ssub = nt->sub[si].strings) != 0) {
- uint i;
-
- /* We can make the test much more efficient if we want.... */
- for (i = 0; i < nt_sub_size; ++i)
- if (name_index_to_count((si << nt_log2_sub_size) + i) >=
- nt->perm_count)
- ssub->strings[i].mark = 0;
- }
+ if ((ssub = nt->sub[si].strings) != 0) {
+ uint i;
+
+ /* We can make the test much more efficient if we want.... */
+ for (i = 0; i < nt_sub_size; ++i)
+ if (name_index_to_count((si << nt_log2_sub_size) + i) >=
+ nt->perm_count)
+ ssub->strings[i].mark = 0;
+ }
}
/* Mark a name. Return true if new mark. We export this so we can mark */
@@ -336,7 +336,7 @@ names_mark_index(name_table * nt, name_index_t nidx)
name_string_t *pnstr = names_index_string_inline(nt, nidx);
if (pnstr->mark)
- return false;
+ return false;
pnstr->mark = 1;
return true;
}
@@ -375,43 +375,43 @@ names_trace_finish(name_table * nt, gc_state_t * gcst)
int i;
for (i = 0; i < NT_HASH_SIZE; phash++, i++) {
- name_index_t prev = 0;
- /*
- * The following initialization is only to pacify compilers:
- * pnprev is only referenced if prev has been set in the loop,
- * in which case pnprev is also set.
- */
- name_string_t *pnprev = 0;
- name_index_t nidx = *phash;
-
- while (nidx != 0) {
- name_string_t *pnstr = names_index_string_inline(nt, nidx);
- name_index_t next = name_next_index(nidx, pnstr);
-
- if (pnstr->mark) {
- prev = nidx;
- pnprev = pnstr;
- } else {
- if_debug_name("GC remove name", nt, nidx, NULL);
- /* Zero out the string data for the GC. */
- pnstr->string_bytes = 0;
- pnstr->string_size = 0;
- if (prev == 0)
- *phash = next;
- else
- set_name_next_index(prev, pnprev, next);
- }
- nidx = next;
- }
+ name_index_t prev = 0;
+ /*
+ * The following initialization is only to pacify compilers:
+ * pnprev is only referenced if prev has been set in the loop,
+ * in which case pnprev is also set.
+ */
+ name_string_t *pnprev = 0;
+ name_index_t nidx = *phash;
+
+ while (nidx != 0) {
+ name_string_t *pnstr = names_index_string_inline(nt, nidx);
+ name_index_t next = name_next_index(nidx, pnstr);
+
+ if (pnstr->mark) {
+ prev = nidx;
+ pnprev = pnstr;
+ } else {
+ if_debug_name("GC remove name", nt, nidx, NULL);
+ /* Zero out the string data for the GC. */
+ pnstr->string_bytes = 0;
+ pnstr->string_size = 0;
+ if (prev == 0)
+ *phash = next;
+ else
+ set_name_next_index(prev, pnprev, next);
+ }
+ nidx = next;
+ }
}
/* Reconstruct the free list. */
nt->free = 0;
for (i = nt->sub_count; --i >= 0;) {
- name_sub_table *sub = nt->sub[i].names;
+ name_sub_table *sub = nt->sub[i].names;
- if (sub != 0) {
- name_scan_sub(nt, i, true, true && (gcst != 0));
- }
+ if (sub != 0) {
+ name_scan_sub(nt, i, true, true && (gcst != 0));
+ }
}
nt->sub_next = 0;
}
@@ -432,24 +432,24 @@ names_restore(name_table * nt, alloc_save_t * save)
uint si;
for (si = 0; si < nt->sub_count; ++si)
- if (nt->sub[si].strings != 0) {
- uint i;
-
- for (i = 0; i < nt_sub_size; ++i) {
- name_string_t *pnstr =
- names_index_string_inline(nt, (si << nt_log2_sub_size) + i);
-
- if (pnstr->string_bytes == 0)
- pnstr->mark = 0;
- else if (pnstr->foreign_string) {
- /* Avoid storing into a read-only name string. */
- if (!pnstr->mark)
- pnstr->mark = 1;
- } else
- pnstr->mark =
- !alloc_is_since_save(pnstr->string_bytes, save);
- }
- }
+ if (nt->sub[si].strings != 0) {
+ uint i;
+
+ for (i = 0; i < nt_sub_size; ++i) {
+ name_string_t *pnstr =
+ names_index_string_inline(nt, (si << nt_log2_sub_size) + i);
+
+ if (pnstr->string_bytes == 0)
+ pnstr->mark = 0;
+ else if (pnstr->foreign_string) {
+ /* Avoid storing into a read-only name string. */
+ if (!pnstr->mark)
+ pnstr->mark = 1;
+ } else
+ pnstr->mark =
+ !alloc_is_since_save(pnstr->string_bytes, save);
+ }
+ }
names_trace_finish(nt, NULL);
}
@@ -465,23 +465,23 @@ name_alloc_sub(name_table * nt)
name_string_sub_table_t *ssub;
for (;; ++sub_index) {
- if (sub_index > nt->max_sub_count)
- return_error(e_limitcheck);
- if (nt->sub[sub_index].names == 0)
- break;
+ if (sub_index > nt->max_sub_count)
+ return_error(e_limitcheck);
+ if (nt->sub[sub_index].names == 0)
+ break;
}
nt->sub_next = sub_index + 1;
if (nt->sub_next > nt->sub_count)
- nt->sub_count = nt->sub_next;
+ nt->sub_count = nt->sub_next;
sub = gs_alloc_struct(mem, name_sub_table, &st_name_sub_table,
- "name_alloc_sub(sub-table)");
+ "name_alloc_sub(sub-table)");
ssub = gs_alloc_struct(mem, name_string_sub_table_t,
- &st_name_string_sub_table,
- "name_alloc_sub(string sub-table)");
+ &st_name_string_sub_table,
+ "name_alloc_sub(string sub-table)");
if (sub == 0 || ssub == 0) {
- gs_free_object(mem, ssub, "name_alloc_sub(string sub-table)");
- gs_free_object(mem, sub, "name_alloc_sub(sub-table)");
- return_error(e_VMerror);
+ gs_free_object(mem, ssub, "name_alloc_sub(string sub-table)");
+ gs_free_object(mem, sub, "name_alloc_sub(sub-table)");
+ return_error(e_VMerror);
}
memset(sub, 0, sizeof(name_sub_table));
memset(ssub, 0, sizeof(name_string_sub_table_t));
@@ -497,25 +497,25 @@ name_alloc_sub(name_table * nt)
name_scan_sub(nt, sub_index, false, false);
#ifdef DEBUG
if (gs_debug_c('n')) { /* Print the lengths of the hash chains. */
- int i0;
-
- for (i0 = 0; i0 < NT_HASH_SIZE; i0 += 16) {
- int i;
-
- dlprintf1("[n]chain %d:", i0);
- for (i = i0; i < i0 + 16; i++) {
- int n = 0;
- uint nidx;
-
- for (nidx = nt->hash[i]; nidx != 0;
- nidx = name_next_index(nidx,
- names_index_string_inline(nt, nidx))
- )
- n++;
- dprintf1(" %d", n);
- }
- dputc('\n');
- }
+ int i0;
+
+ for (i0 = 0; i0 < NT_HASH_SIZE; i0 += 16) {
+ int i;
+
+ dlprintf1("[n]chain %d:", i0);
+ for (i = i0; i < i0 + 16; i++) {
+ int n = 0;
+ uint nidx;
+
+ for (nidx = nt->hash[i]; nidx != 0;
+ nidx = name_next_index(nidx,
+ names_index_string_inline(nt, nidx))
+ )
+ n++;
+ dprintf1(" %d", n);
+ }
+ dputc('\n');
+ }
}
#endif
return 0;
@@ -532,15 +532,15 @@ name_free_sub(name_table * nt, uint sub_index, bool unmark)
if (unmark) {
name_sub_table *sub = nt->sub[sub_index].names;
name_string_sub_table_t *ssub = nt->sub[sub_index].strings;
-
- o_set_unmarked((obj_header_t *)sub - 1);
- o_set_unmarked((obj_header_t *)ssub - 1);
+
+ o_set_unmarked((obj_header_t *)sub - 1);
+ o_set_unmarked((obj_header_t *)ssub - 1);
}
-
+
gs_free_object(nt->memory, nt->sub[sub_index].strings,
- "name_free_sub(string sub-table)");
+ "name_free_sub(string sub-table)");
gs_free_object(nt->memory, nt->sub[sub_index].names,
- "name_free_sub(sub-table)");
+ "name_free_sub(sub-table)");
nt->sub[sub_index].names = 0;
nt->sub[sub_index].strings = 0;
}
@@ -559,53 +559,53 @@ name_scan_sub(name_table * nt, uint sub_index, bool free_empty, bool unmark)
bool keep = !free_empty;
if (ssub == 0)
- return;
+ return;
if (nbase == 0)
- nbase = 1, keep = true; /* don't free name 0 */
+ nbase = 1, keep = true; /* don't free name 0 */
for (;; --ncnt) {
- uint nidx = name_count_to_index(ncnt);
- name_string_t *pnstr = &ssub->strings[nidx & nt_sub_index_mask];
-
- if (pnstr->mark)
- keep = true;
- else {
- set_name_next_index(nidx, pnstr, free);
- free = nidx;
- }
- if (ncnt == nbase)
- break;
+ uint nidx = name_count_to_index(ncnt);
+ name_string_t *pnstr = &ssub->strings[nidx & nt_sub_index_mask];
+
+ if (pnstr->mark)
+ keep = true;
+ else {
+ set_name_next_index(nidx, pnstr, free);
+ free = nidx;
+ }
+ if (ncnt == nbase)
+ break;
}
if (keep)
- nt->free = free;
+ nt->free = free;
else {
- /* No marked entries, free the sub-table. */
- name_free_sub(nt, sub_index, unmark);
- if (sub_index == nt->sub_count - 1) {
- /* Back up over a final run of deleted sub-tables. */
- do {
- --sub_index;
- } while (nt->sub[sub_index].names == 0);
- nt->sub_count = sub_index + 1;
- if (nt->sub_next > sub_index)
- nt->sub_next = sub_index;
- } else if (nt->sub_next == sub_index)
- nt->sub_next--;
+ /* No marked entries, free the sub-table. */
+ name_free_sub(nt, sub_index, unmark);
+ if (sub_index == nt->sub_count - 1) {
+ /* Back up over a final run of deleted sub-tables. */
+ do {
+ --sub_index;
+ } while (nt->sub[sub_index].names == 0);
+ nt->sub_count = sub_index + 1;
+ if (nt->sub_next > sub_index)
+ nt->sub_next = sub_index;
+ } else if (nt->sub_next == sub_index)
+ nt->sub_next--;
}
}
/* Garbage collector enumeration and relocation procedures. */
-static
+static
ENUM_PTRS_BEGIN_PROC(name_table_enum_ptrs)
{
EV_CONST name_table *const nt = vptr;
uint i = index >> 1;
if (i >= nt->sub_count)
- return 0;
+ return 0;
if (index & 1)
- ENUM_RETURN(nt->sub[i].strings);
+ ENUM_RETURN(nt->sub[i].strings);
else
- ENUM_RETURN(nt->sub[i].names);
+ ENUM_RETURN(nt->sub[i].names);
}
ENUM_PTRS_END_PROC
static RELOC_PTRS_WITH(name_table_reloc_ptrs, name_table *nt)
@@ -615,8 +615,8 @@ static RELOC_PTRS_WITH(name_table_reloc_ptrs, name_table *nt)
/* Now we can relocate the sub-table pointers. */
for (i = 0; i < sub_count; i++) {
- RELOC_VAR(nt->sub[i].names);
- RELOC_VAR(nt->sub[i].strings);
+ RELOC_VAR(nt->sub[i].names);
+ RELOC_VAR(nt->sub[i].strings);
}
/*
* We also need to relocate the cached value pointers.
@@ -637,14 +637,14 @@ static RELOC_PTRS_BEGIN(name_string_sub_reloc_ptrs)
uint i;
for (i = 0; i < nt_sub_size; ++pnstr, ++i) {
- if (pnstr->string_bytes != 0 && !pnstr->foreign_string) {
- gs_const_string nstr;
-
- nstr.data = pnstr->string_bytes;
- nstr.size = pnstr->string_size;
- RELOC_CONST_STRING_VAR(nstr);
- pnstr->string_bytes = nstr.data;
- }
+ if (pnstr->string_bytes != 0 && !pnstr->foreign_string) {
+ gs_const_string nstr;
+
+ nstr.data = pnstr->string_bytes;
+ nstr.size = pnstr->string_size;
+ RELOC_CONST_STRING_VAR(nstr);
+ pnstr->string_bytes = nstr.data;
+ }
}
}
RELOC_PTRS_END
diff --git a/gs/psi/iname.h b/gs/psi/iname.h
index a6e2449e4..c13046107 100644
--- a/gs/psi/iname.h
+++ b/gs/psi/iname.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,7 +27,6 @@
/* ---------------- Procedural interface ---------------- */
-
/* Get the allocator for the name table. */
#define name_memory(mem)\
names_memory(mem->gs_lib_ctx->gs_name_table)
diff --git a/gs/psi/inamedef.h b/gs/psi/inamedef.h
index e06a4fa13..96f2bc7ff 100644
--- a/gs/psi/inamedef.h
+++ b/gs/psi/inamedef.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@
# undef EXTEND_NAMES
# define EXTEND_NAMES max_name_extension_bits
#endif
-/*
+/*
* We capture the small algorithmic differences between these two
* configurations entirely in this header file;
* the implementation doesn't need any conditionals on EXTEND_NAMES.
@@ -61,7 +61,7 @@ struct name_s {
/* pvalue != pv_no_defn, pvalue != pv_other: pvalue is valid */
#define pv_valid(pvalue) ((unsigned long)(pvalue) > 1)
ref *pvalue; /* if only defined in systemdict or */
- /* userdict, this points to the value */
+ /* userdict, this points to the value */
};
/*typedef struct name_s name; *//* in iref.h */
@@ -93,9 +93,9 @@ typedef struct name_sub_table_s {
*/
struct name_table_s {
uint free; /* head of free list, which is sorted in */
- /* increasing count (not index) order */
+ /* increasing count (not index) order */
uint sub_next; /* index of next sub-table to allocate */
- /* if not already allocated */
+ /* if not already allocated */
uint perm_count; /* # of permanent (read-only) strings */
uint sub_count; /* index of highest allocated sub-table +1 */
uint max_sub_count; /* max allowable value of sub_count */
@@ -103,8 +103,8 @@ struct name_table_s {
gs_memory_t *memory;
uint hash[NT_HASH_SIZE];
struct sub_ { /* both ptrs are 0 or both are non-0 */
- name_sub_table *names;
- name_string_sub_table_t *strings;
+ name_sub_table *names;
+ name_string_sub_table_t *strings;
} sub[max_name_index / nt_sub_size + 1];
};
/*typedef struct name_table_s name_table; *//* in inames.h */
@@ -115,27 +115,27 @@ struct name_table_s {
* Convert between names, indices, and strings. Note that the inline
* versions, but not the procedure versions, take a name_table argument.
*/
- /* index => string */
+ /* index => string */
#define names_index_string_inline(nt, nidx)\
((nt)->sub[(nidx) >> nt_log2_sub_size].strings->strings +\
((nidx) & nt_sub_index_mask))
- /* ref => string */
+ /* ref => string */
#define names_string_inline(nt, pnref)\
names_index_string_inline(nt, names_index_inline(nt, pnref))
- /* ref => index */
+ /* ref => index */
#if EXTEND_NAMES
# define names_index_inline(nt_ignored, pnref)\
( ((const name_sub_table *)\
- ((pnref)->value.pname - (r_size(pnref) & nt_sub_index_mask)))->high_index + r_size(pnref) )
+ ((pnref)->value.pname - (r_size(pnref) & nt_sub_index_mask)))->high_index + r_size(pnref) )
#else
# define names_index_inline(nt_ignored, pnref) r_size(pnref)
#endif
#define names_index(nt_ignored, pnref) names_index_inline(nt_ignored, pnref)
- /* index => name */
+ /* index => name */
#define names_index_ptr_inline(nt, nidx)\
((nt)->sub[(nidx) >> nt_log2_sub_size].names->names +\
((nidx) & nt_sub_index_mask))
- /* index => ref */
+ /* index => ref */
#define names_index_ref_inline(nt, nidx, pnref)\
make_name(pnref, nidx, names_index_ptr_inline(nt, nidx));
/* Backward compatibility */
@@ -143,7 +143,7 @@ struct name_table_s {
#define name_index_ptr_inline(nt, pnref) names_index_ptr_inline(nt, pnref)
#define name_index_ref_inline(nt, nidx, pnref)\
names_index_ref_inline(nt, nidx, pnref)
- /* name => ref */
+ /* name => ref */
/* We have to set the space to system so that the garbage collector */
/* won't think names are foreign and therefore untraceable. */
#define make_name(pnref, nidx, pnm)\
diff --git a/gs/psi/inameidx.h b/gs/psi/inameidx.h
index 782f78de5..dc645d0d9 100644
--- a/gs/psi/inameidx.h
+++ b/gs/psi/inameidx.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@
/* Define the size of a name sub-table. */
/* With NT_LOG2_SUB_SIZE >= 10 the subtable goes into a large chunk, */
/* which names_trace_finish() cannot handle. */
-# define NT_LOG2_SUB_SIZE (8 + (EXTEND_NAMES >= 2))
+# define NT_LOG2_SUB_SIZE (8 + (EXTEND_NAMES >= 2))
# define NT_SUB_SIZE (1 << NT_LOG2_SUB_SIZE)
# define NT_SUB_INDEX_MASK (NT_SUB_SIZE - 1)
diff --git a/gs/psi/inames.h b/gs/psi/inames.h
index 209b08c47..85ff5c888 100644
--- a/gs/psi/inames.h
+++ b/gs/psi/inames.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -62,7 +62,7 @@ gs_memory_t *names_memory(const name_table * nt);
* we have assigned all possible name indices).
*/
int names_ref(name_table * nt, const byte * ptr, uint size, ref * pnref,
- int enterflag);
+ int enterflag);
void names_string_ref(const name_table * nt, const ref * pnref, ref * psref);
/*
diff --git a/gs/psi/inamestr.h b/gs/psi/inamestr.h
index 11bbbcd91..b8f7f7cbf 100644
--- a/gs/psi/inamestr.h
+++ b/gs/psi/inamestr.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -55,7 +55,7 @@
\
hash = hperm[*p++];\
while (--n > 0)\
- hash = (hash << 8) | hperm[(byte)hash ^ *p++];\
+ hash = (hash << 8) | hperm[(byte)hash ^ *p++];\
END
/*
diff --git a/gs/psi/inobtokn.c b/gs/psi/inobtokn.c
index a326bc8ab..5e816c37c 100644
--- a/gs/psi/inobtokn.c
+++ b/gs/psi/inobtokn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/inouparm.c b/gs/psi/inouparm.c
index deee5d699..21ac1592c 100644
--- a/gs/psi/inouparm.c
+++ b/gs/psi/inouparm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/interp.h b/gs/psi/interp.h
index 94cb42b21..6267e1dde 100644
--- a/gs/psi/interp.h
+++ b/gs/psi/interp.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -63,7 +63,7 @@ int gs_errorinfo_put_string(i_ctx_t *, const char *);
/* Initialize the interpreter. */
int gs_interp_init(i_ctx_t **pi_ctx_p, const ref *psystem_dict,
- gs_dual_memory_t *dmem);
+ gs_dual_memory_t *dmem);
#ifndef gs_context_state_t_DEFINED
# define gs_context_state_t_DEFINED
@@ -75,20 +75,20 @@ typedef struct gs_context_state_s gs_context_state_t;
* We export this for creating new contexts.
*/
int gs_interp_alloc_stacks(gs_ref_memory_t * smem,
- gs_context_state_t * pcst);
+ gs_context_state_t * pcst);
/*
* Free the stacks when destroying a context. This is the inverse of
* create_stacks.
*/
void gs_interp_free_stacks(gs_ref_memory_t * smem,
- gs_context_state_t * pcst);
+ gs_context_state_t * pcst);
/* Reset the interpreter. */
void gs_interp_reset(i_ctx_t *i_ctx_p);
/* Define the top-level interface to the interpreter. */
int gs_interpret(i_ctx_t **pi_ctx_p, ref * pref, int user_errors,
- int *pexit_code, ref * perror_object);
+ int *pexit_code, ref * perror_object);
#endif /* interp_INCLUDED */
diff --git a/gs/psi/iosdata.h b/gs/psi/iosdata.h
index fec846471..447dec8b0 100644
--- a/gs/psi/iosdata.h
+++ b/gs/psi/iosdata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iostack.h b/gs/psi/iostack.h
index 9b1defafb..74af7066c 100644
--- a/gs/psi/iostack.h
+++ b/gs/psi/iostack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ipacked.h b/gs/psi/ipacked.h
index aade6228e..47a26ecc2 100644
--- a/gs/psi/ipacked.h
+++ b/gs/psi/ipacked.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iparam.c b/gs/psi/iparam.c
index a1f20dc20..bf19ac437 100644
--- a/gs/psi/iparam.c
+++ b/gs/psi/iparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,12 +37,12 @@ static int
ref_param_key(const iparam_list * plist, gs_param_name pkey, ref * pkref)
{
if (plist->int_keys) {
- long key;
+ long key;
- if (sscanf(pkey, "%ld", &key) != 1)
- return_error(e_rangecheck);
- make_int(pkref, key);
- return 0;
+ if (sscanf(pkey, "%ld", &key) != 1)
+ return_error(e_rangecheck);
+ make_int(pkref, key);
+ return 0;
} else
return name_ref(plist->memory, (const byte *)pkey, strlen(pkey), pkref, 0);
}
@@ -52,28 +52,28 @@ static int
ref_to_key(const ref * pref, gs_param_key_t * key, iparam_list *plist)
{
if (r_has_type(pref, t_name)) {
- ref nref;
+ ref nref;
- name_string_ref(plist->memory, pref, &nref);
- key->data = nref.value.const_bytes;
- key->size = r_size(&nref);
- key->persistent = false; /* names may be freed */
+ name_string_ref(plist->memory, pref, &nref);
+ key->data = nref.value.const_bytes;
+ key->size = r_size(&nref);
+ key->persistent = false; /* names may be freed */
} else if (r_has_type(pref, t_integer)) {
- char istr[sizeof(long) * 8 / 3 + 2];
- int len;
- byte *buf;
-
- sprintf(istr, "%d", pref->value.intval);
- len = strlen(istr);
- /* GC will take care of freeing this: */
- buf = gs_alloc_string(plist->memory, len, "ref_to_key");
- if (!buf)
- return_error(e_VMerror);
- key->data = buf;
- key->size = len;
- key->persistent = true;
+ char istr[sizeof(long) * 8 / 3 + 2];
+ int len;
+ byte *buf;
+
+ sprintf(istr, "%d", pref->value.intval);
+ len = strlen(istr);
+ /* GC will take care of freeing this: */
+ buf = gs_alloc_string(plist->memory, len, "ref_to_key");
+ if (!buf)
+ return_error(e_VMerror);
+ key->data = buf;
+ key->size = len;
+ key->persistent = true;
} else
- return_error(e_typecheck);
+ return_error(e_typecheck);
return 0;
}
@@ -81,8 +81,8 @@ ref_to_key(const ref * pref, gs_param_key_t * key, iparam_list *plist)
/* Forward references */
static int array_new_indexed_plist_write(dict_param_list *plist,
- ref *parray, const ref *pwanted,
- gs_ref_memory_t *imem);
+ ref *parray, const ref *pwanted,
+ gs_ref_memory_t *imem);
/* ---------------- Generic writing procedures ---------------- */
@@ -101,43 +101,43 @@ static const gs_param_list_procs ref_write_procs =
ref_param_requested
};
static int ref_array_param_requested(const iparam_list *, gs_param_name,
- ref *, uint, client_name_t);
+ ref *, uint, client_name_t);
static int ref_param_write(iparam_list *, gs_param_name, const ref *);
static int ref_param_write_string_value(ref *, const gs_param_string *,
- gs_ref_memory_t *);
+ gs_ref_memory_t *);
static int ref_param_write_name_value(const gs_memory_t *mem, ref *, const gs_param_string *);
static int
ref_param_make_int(ref *pe, const void *pvalue, uint i, gs_ref_memory_t *imem)
{
make_tav(pe, t_integer, imemory_new_mask(imem), intval,
- ((const gs_param_int_array *)pvalue)->data[i]);
+ ((const gs_param_int_array *)pvalue)->data[i]);
return 0;
}
static int
ref_param_make_float(ref *pe, const void *pvalue, uint i, gs_ref_memory_t *imem)
{
make_tav(pe, t_real, imemory_new_mask(imem), realval,
- ((const gs_param_float_array *)pvalue)->data[i]);
+ ((const gs_param_float_array *)pvalue)->data[i]);
return 0;
}
static int
ref_param_make_string(ref *pe, const void *pvalue, uint i, gs_ref_memory_t *imem)
{
return ref_param_write_string_value(pe,
- &((const gs_param_string_array *)pvalue)->data[i],
- imem);
+ &((const gs_param_string_array *)pvalue)->data[i],
+ imem);
}
static int
ref_param_make_name(ref * pe, const void *pvalue, uint i, gs_ref_memory_t *imem)
{
return ref_param_write_name_value((const gs_memory_t *)imem, pe,
- &((const gs_param_string_array *)pvalue)->data[i]);
+ &((const gs_param_string_array *)pvalue)->data[i]);
}
static int
ref_param_write_typed_array(gs_param_list * plist, gs_param_name pkey,
- void *pvalue, uint count,
- int (*make)(ref *, const void *, uint,
- gs_ref_memory_t *))
+ void *pvalue, uint count,
+ int (*make)(ref *, const void *, uint,
+ gs_ref_memory_t *))
{
iparam_list *const iplist = (iparam_list *) plist;
ref value;
@@ -146,122 +146,122 @@ ref_param_write_typed_array(gs_param_list * plist, gs_param_name pkey,
int code;
if ((code = ref_array_param_requested(iplist, pkey, &value, count,
- "ref_param_write_typed_array")) <= 0)
- return code;
+ "ref_param_write_typed_array")) <= 0)
+ return code;
for (i = 0, pe = value.value.refs; i < count; ++i, ++pe)
- if ((code = (*make) (pe, pvalue, i, iplist->ref_memory)) < 0)
- return code;
+ if ((code = (*make) (pe, pvalue, i, iplist->ref_memory)) < 0)
+ return code;
return ref_param_write(iplist, pkey, &value);
}
static int
ref_param_begin_write_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue,
- gs_param_collection_type_t coll_type)
+ gs_param_dict * pvalue,
+ gs_param_collection_type_t coll_type)
{
iparam_list *const iplist = (iparam_list *) plist;
gs_ref_memory_t *imem = iplist->ref_memory;
dict_param_list *dlist = (dict_param_list *)
- gs_alloc_bytes(plist->memory, size_of(dict_param_list),
- "ref_param_begin_write_collection");
+ gs_alloc_bytes(plist->memory, size_of(dict_param_list),
+ "ref_param_begin_write_collection");
int code;
if (dlist == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (coll_type != gs_param_collection_array) {
- ref dref;
+ ref dref;
- code = dict_alloc(imem, pvalue->size, &dref);
- if (code >= 0) {
- code = dict_param_list_write(dlist, &dref, NULL, imem);
- dlist->int_keys = coll_type == gs_param_collection_dict_int_keys;
- }
+ code = dict_alloc(imem, pvalue->size, &dref);
+ if (code >= 0) {
+ code = dict_param_list_write(dlist, &dref, NULL, imem);
+ dlist->int_keys = coll_type == gs_param_collection_dict_int_keys;
+ }
} else {
- ref aref;
+ ref aref;
- code = gs_alloc_ref_array(imem, &aref, a_all, pvalue->size,
- "ref_param_begin_write_collection");
- if (code >= 0)
- code = array_new_indexed_plist_write(dlist, &aref, NULL, imem);
+ code = gs_alloc_ref_array(imem, &aref, a_all, pvalue->size,
+ "ref_param_begin_write_collection");
+ if (code >= 0)
+ code = array_new_indexed_plist_write(dlist, &aref, NULL, imem);
}
if (code < 0)
- gs_free_object(plist->memory, dlist, "ref_param_begin_write_collection");
+ gs_free_object(plist->memory, dlist, "ref_param_begin_write_collection");
else
- pvalue->list = (gs_param_list *) dlist;
+ pvalue->list = (gs_param_list *) dlist;
return code;
}
static int
ref_param_end_write_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue)
+ gs_param_dict * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
int code = ref_param_write(iplist, pkey,
- &((dict_param_list *) pvalue->list)->dict);
+ &((dict_param_list *) pvalue->list)->dict);
gs_free_object(plist->memory, pvalue->list, "ref_param_end_write_collection");
return code;
}
static int
ref_param_write_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
ref value;
int code = 0;
switch (pvalue->type) {
- case gs_param_type_null:
- make_null(&value);
- break;
- case gs_param_type_bool:
- make_bool(&value, pvalue->value.b);
- break;
- case gs_param_type_int:
- make_int(&value, pvalue->value.i);
- break;
- case gs_param_type_long:
- make_int(&value, pvalue->value.l);
- break;
- case gs_param_type_float:
- make_real(&value, pvalue->value.f);
- break;
- case gs_param_type_string:
- if (!ref_param_requested(plist, pkey))
- return 0;
- code = ref_param_write_string_value(&value, &pvalue->value.s,
- iplist->ref_memory);
- break;
- case gs_param_type_name:
- if (!ref_param_requested(plist, pkey))
- return 0;
- code = ref_param_write_name_value(iplist->memory, &value, &pvalue->value.n);
- break;
- case gs_param_type_int_array:
- return ref_param_write_typed_array(plist, pkey, &pvalue->value.ia,
- pvalue->value.ia.size,
- ref_param_make_int);
- case gs_param_type_float_array:
- return ref_param_write_typed_array(plist, pkey, &pvalue->value.fa,
- pvalue->value.fa.size,
- ref_param_make_float);
- case gs_param_type_string_array:
- return ref_param_write_typed_array(plist, pkey, &pvalue->value.sa,
- pvalue->value.sa.size,
- ref_param_make_string);
- case gs_param_type_name_array:
- return ref_param_write_typed_array(plist, pkey, &pvalue->value.na,
- pvalue->value.na.size,
- ref_param_make_name);
- case gs_param_type_dict:
- case gs_param_type_dict_int_keys:
- case gs_param_type_array:
- return ref_param_begin_write_collection(plist, pkey,
- &pvalue->value.d,
- (gs_param_collection_type_t)(pvalue->type - gs_param_type_dict));
- default:
- return_error(e_typecheck);
+ case gs_param_type_null:
+ make_null(&value);
+ break;
+ case gs_param_type_bool:
+ make_bool(&value, pvalue->value.b);
+ break;
+ case gs_param_type_int:
+ make_int(&value, pvalue->value.i);
+ break;
+ case gs_param_type_long:
+ make_int(&value, pvalue->value.l);
+ break;
+ case gs_param_type_float:
+ make_real(&value, pvalue->value.f);
+ break;
+ case gs_param_type_string:
+ if (!ref_param_requested(plist, pkey))
+ return 0;
+ code = ref_param_write_string_value(&value, &pvalue->value.s,
+ iplist->ref_memory);
+ break;
+ case gs_param_type_name:
+ if (!ref_param_requested(plist, pkey))
+ return 0;
+ code = ref_param_write_name_value(iplist->memory, &value, &pvalue->value.n);
+ break;
+ case gs_param_type_int_array:
+ return ref_param_write_typed_array(plist, pkey, &pvalue->value.ia,
+ pvalue->value.ia.size,
+ ref_param_make_int);
+ case gs_param_type_float_array:
+ return ref_param_write_typed_array(plist, pkey, &pvalue->value.fa,
+ pvalue->value.fa.size,
+ ref_param_make_float);
+ case gs_param_type_string_array:
+ return ref_param_write_typed_array(plist, pkey, &pvalue->value.sa,
+ pvalue->value.sa.size,
+ ref_param_make_string);
+ case gs_param_type_name_array:
+ return ref_param_write_typed_array(plist, pkey, &pvalue->value.na,
+ pvalue->value.na.size,
+ ref_param_make_name);
+ case gs_param_type_dict:
+ case gs_param_type_dict_int_keys:
+ case gs_param_type_array:
+ return ref_param_begin_write_collection(plist, pkey,
+ &pvalue->value.d,
+ (gs_param_collection_type_t)(pvalue->type - gs_param_type_dict));
+ default:
+ return_error(e_typecheck);
}
if (code < 0)
- return code;
+ return code;
return ref_param_write(iplist, pkey, &value);
}
@@ -274,9 +274,9 @@ ref_param_requested(const gs_param_list * plist, gs_param_name pkey)
ref *ignore_value;
if (!r_has_type(&ciplist->u.w.wanted, t_dictionary))
- return -1;
+ return -1;
if (ref_param_key(ciplist, pkey, &kref) < 0)
- return -1; /* catch it later */
+ return -1; /* catch it later */
return (dict_find(&ciplist->u.w.wanted, &kref, &ignore_value) > 0);
}
@@ -284,12 +284,12 @@ ref_param_requested(const gs_param_list * plist, gs_param_name pkey)
/* Return <0 on error, 0 if not wanted, 1 if wanted. */
static int
ref_array_param_requested(const iparam_list *iplist, gs_param_name pkey,
- ref *pvalue, uint size, client_name_t cname)
+ ref *pvalue, uint size, client_name_t cname)
{
int code;
if (!ref_param_requested((const gs_param_list *)iplist, pkey))
- return 0;
+ return 0;
code = gs_alloc_ref_array(iplist->ref_memory, pvalue, a_all, size, cname);
return (code < 0 ? code : 1);
}
@@ -299,21 +299,21 @@ ref_array_param_requested(const iparam_list *iplist, gs_param_name pkey,
/* Prepare to write a string value. */
static int
ref_param_write_string_value(ref * pref, const gs_param_string * pvalue,
- gs_ref_memory_t *imem)
+ gs_ref_memory_t *imem)
{
const byte *pdata = pvalue->data;
uint n = pvalue->size;
if (pvalue->persistent)
- make_const_string(pref, a_readonly | avm_foreign, n, pdata);
+ make_const_string(pref, a_readonly | avm_foreign, n, pdata);
else {
- byte *pstr = gs_alloc_string((gs_memory_t *)imem, n,
- "ref_param_write_string");
+ byte *pstr = gs_alloc_string((gs_memory_t *)imem, n,
+ "ref_param_write_string");
- if (pstr == 0)
- return_error(e_VMerror);
- memcpy(pstr, pdata, n);
- make_string(pref, a_readonly | imemory_space(imem), n, pstr);
+ if (pstr == 0)
+ return_error(e_VMerror);
+ memcpy(pstr, pdata, n);
+ make_string(pref, a_readonly | imemory_space(imem), n, pstr);
}
return 0;
}
@@ -323,7 +323,7 @@ static int
ref_param_write_name_value(const gs_memory_t *mem, ref * pref, const gs_param_string * pvalue)
{
return name_ref(mem, pvalue->data, pvalue->size, pref,
- (pvalue->persistent ? 0 : 1));
+ (pvalue->persistent ? 0 : 1));
}
/* Generic routine for writing a ref parameter. */
@@ -334,10 +334,10 @@ ref_param_write(iparam_list * plist, gs_param_name pkey, const ref * pvalue)
int code;
if (!ref_param_requested((gs_param_list *) plist, pkey))
- return 0;
+ return 0;
code = ref_param_key(plist, pkey, &kref);
if (code < 0)
- return code;
+ return code;
return (*plist->u.w.write) (plist, &kref, pvalue);
}
@@ -346,15 +346,15 @@ ref_param_write(iparam_list * plist, gs_param_name pkey, const ref * pvalue)
/* Initialize for writing parameters. */
static void
ref_param_write_init(iparam_list * plist, const ref * pwanted,
- gs_ref_memory_t *imem)
+ gs_ref_memory_t *imem)
{
gs_param_list_init((gs_param_list *)plist, &ref_write_procs,
- (gs_memory_t *)imem);
+ (gs_memory_t *)imem);
plist->ref_memory = imem;
if (pwanted == 0)
- make_null(&plist->u.w.wanted);
+ make_null(&plist->u.w.wanted);
else
- plist->u.w.wanted = *pwanted;
+ plist->u.w.wanted = *pwanted;
plist->results = 0;
plist->int_keys = false;
}
@@ -368,15 +368,15 @@ stack_param_write(iparam_list * plist, const ref * pkey, const ref * pvalue)
s_ptr p = pstack->p;
if (pstack->top - p < 2) {
- int code = ref_stack_push(pstack, 2);
+ int code = ref_stack_push(pstack, 2);
- if (code < 0)
- return code;
- *ref_stack_index(pstack, 1) = *pkey;
- p = pstack->p;
+ if (code < 0)
+ return code;
+ *ref_stack_index(pstack, 1) = *pkey;
+ p = pstack->p;
} else {
- pstack->p = p += 2;
- p[-1] = *pkey;
+ pstack->p = p += 2;
+ p[-1] = *pkey;
}
*p = *pvalue;
splist->count++;
@@ -386,7 +386,7 @@ stack_param_write(iparam_list * plist, const ref * pkey, const ref * pvalue)
/* Implementation for enumerating parameters on a stack */
static int /* ret 0 ok, 1 if EOF, or -ve err */
stack_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
- gs_param_key_t * key, ref_type * type)
+ gs_param_key_t * key, ref_type * type)
{
int code;
stack_param_list *const splist = (stack_param_list *) plist;
@@ -394,10 +394,10 @@ stack_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
ref *stack_element;
do {
- stack_element =
- ref_stack_index(splist->pstack, index + 1 + splist->skip);
- if (!stack_element)
- return 1;
+ stack_element =
+ ref_stack_index(splist->pstack, index + 1 + splist->skip);
+ if (!stack_element)
+ return 1;
} while (index += 2, !r_has_type(stack_element, t_name));
*type = r_type(stack_element);
code = ref_to_key(stack_element, key, plist);
@@ -407,7 +407,7 @@ stack_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
int
stack_param_list_write(stack_param_list * plist, ref_stack_t * pstack,
- const ref * pwanted, gs_ref_memory_t *imem)
+ const ref * pwanted, gs_ref_memory_t *imem)
{
plist->u.w.write = stack_param_write;
ref_param_write_init((iparam_list *) plist, pwanted, imem);
@@ -423,7 +423,7 @@ static int
dict_param_write(iparam_list * plist, const ref * pkey, const ref * pvalue)
{
int code =
- dict_put(&((dict_param_list *) plist)->dict, pkey, pvalue, NULL);
+ dict_put(&((dict_param_list *) plist)->dict, pkey, pvalue, NULL);
return min(code, 0);
}
@@ -431,7 +431,7 @@ dict_param_write(iparam_list * plist, const ref * pkey, const ref * pvalue)
/* Implementation for enumerating parameters in a dictionary */
static int /* ret 0 ok, 1 if EOF, or -ve err */
dict_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
- gs_param_key_t * key, ref_type * type)
+ gs_param_key_t * key, ref_type * type)
{
ref elt[2];
int code;
@@ -441,7 +441,7 @@ dict_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
index = dict_next(&pdlist->dict, index, elt);
if (index < 0)
- return 1;
+ return 1;
*type = r_type(&elt[1]);
code = ref_to_key(&elt[0], key, plist);
penum->intval = index;
@@ -450,7 +450,7 @@ dict_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
int
dict_param_list_write(dict_param_list *plist, ref *pdict, const ref *pwanted,
- gs_ref_memory_t *imem)
+ gs_ref_memory_t *imem)
{
check_dict_write(*pdict);
plist->u.w.write = dict_param_write;
@@ -464,13 +464,13 @@ dict_param_list_write(dict_param_list *plist, ref *pdict, const ref *pwanted,
/* Note that this is now internal, since it only handles "new" arrays. */
static int
array_new_indexed_param_write(iparam_list * iplist, const ref * pkey,
- const ref * pvalue)
+ const ref * pvalue)
{
const ref *const arr = &((dict_param_list *)iplist)->dict;
ref *eltp;
if (!r_has_type(pkey, t_integer))
- return_error(e_typecheck);
+ return_error(e_typecheck);
check_int_ltu(*pkey, r_size(arr));
store_check_dest(arr, pvalue);
eltp = arr->value.refs + pkey->value.intval;
@@ -481,7 +481,7 @@ array_new_indexed_param_write(iparam_list * iplist, const ref * pkey,
}
static int
array_new_indexed_plist_write(dict_param_list * plist, ref * parray,
- const ref * pwanted, gs_ref_memory_t *imem)
+ const ref * pwanted, gs_ref_memory_t *imem)
{
check_array(*parray);
check_write(*parray);
@@ -517,12 +517,12 @@ static const gs_param_list_procs ref_read_procs =
ref_param_read_commit
};
static int ref_param_read(iparam_list *, gs_param_name,
- iparam_loc *, int);
+ iparam_loc *, int);
static int ref_param_read_string_value(gs_memory_t *mem,
- const iparam_loc *,
- gs_param_string *);
+ const iparam_loc *,
+ gs_param_string *);
static int ref_param_read_array(iparam_list *, gs_param_name,
- iparam_loc *);
+ iparam_loc *);
#define iparam_note_error(loc, code)\
gs_note_error(*(loc).presult = code)
@@ -535,7 +535,7 @@ static int ref_param_read_array(iparam_list *, gs_param_name,
static int
ref_param_read_int_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_int_array * pvalue)
+ gs_param_int_array * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
iparam_loc loc;
@@ -545,26 +545,26 @@ ref_param_read_int_array(gs_param_list * plist, gs_param_name pkey,
long i;
if (code != 0)
- return code;
+ return code;
size = r_size(loc.pvalue);
piv = (int *)gs_alloc_byte_array(plist->memory, size, sizeof(int),
- "ref_param_read_int_array");
+ "ref_param_read_int_array");
if (piv == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
for (i = 0; i < size; i++) {
- ref elt;
-
- array_get(plist->memory, loc.pvalue, i, &elt);
- if (!r_has_type(&elt, t_integer)) {
- code = gs_note_error(e_typecheck);
- break;
- }
- piv[i] = (int)elt.value.intval;
+ ref elt;
+
+ array_get(plist->memory, loc.pvalue, i, &elt);
+ if (!r_has_type(&elt, t_integer)) {
+ code = gs_note_error(e_typecheck);
+ break;
+ }
+ piv[i] = (int)elt.value.intval;
}
if (code < 0) {
- gs_free_object(plist->memory, piv, "ref_param_read_int_array");
- return (*loc.presult = code);
+ gs_free_object(plist->memory, piv, "ref_param_read_int_array");
+ return (*loc.presult = code);
}
pvalue->data = piv;
pvalue->size = size;
@@ -573,7 +573,7 @@ ref_param_read_int_array(gs_param_list * plist, gs_param_name pkey,
}
static int
ref_param_read_float_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_float_array * pvalue)
+ gs_param_float_array * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
iparam_loc loc;
@@ -584,22 +584,22 @@ ref_param_read_float_array(gs_param_list * plist, gs_param_name pkey,
long i;
if (code != 0)
- return code;
+ return code;
size = r_size(loc.pvalue);
pfv = (float *)gs_alloc_byte_array(plist->memory, size, sizeof(float),
- "ref_param_read_float_array");
+ "ref_param_read_float_array");
if (pfv == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
aref = *loc.pvalue;
loc.pvalue = &elt;
for (i = 0; code >= 0 && i < size; i++) {
array_get(plist->memory, &aref, i, &elt);
- code = float_param(&elt, pfv + i);
+ code = float_param(&elt, pfv + i);
}
if (code < 0) {
- gs_free_object(plist->memory, pfv, "ref_read_float_array_param");
- return (*loc.presult = code);
+ gs_free_object(plist->memory, pfv, "ref_read_float_array_param");
+ return (*loc.presult = code);
}
pvalue->data = pfv;
pvalue->size = size;
@@ -608,7 +608,7 @@ ref_param_read_float_array(gs_param_list * plist, gs_param_name pkey,
}
static int
ref_param_read_string_array(gs_param_list * plist, gs_param_name pkey,
- gs_param_string_array * pvalue)
+ gs_param_string_array * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
iparam_loc loc;
@@ -619,31 +619,31 @@ ref_param_read_string_array(gs_param_list * plist, gs_param_name pkey,
long i;
if (code != 0)
- return code;
+ return code;
size = r_size(loc.pvalue);
psv = (gs_param_string *)
- gs_alloc_byte_array(plist->memory, size, sizeof(gs_param_string),
- "ref_param_read_string_array");
+ gs_alloc_byte_array(plist->memory, size, sizeof(gs_param_string),
+ "ref_param_read_string_array");
if (psv == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
aref = *loc.pvalue;
if (r_has_type(&aref, t_array)) {
- for (i = 0; code >= 0 && i < size; i++) {
- loc.pvalue = aref.value.refs + i;
- code = ref_param_read_string_value(plist->memory, &loc, psv + i);
- }
+ for (i = 0; code >= 0 && i < size; i++) {
+ loc.pvalue = aref.value.refs + i;
+ code = ref_param_read_string_value(plist->memory, &loc, psv + i);
+ }
} else {
- ref elt;
+ ref elt;
- loc.pvalue = &elt;
- for (i = 0; code >= 0 && i < size; i++) {
- array_get(plist->memory, &aref, i, &elt);
- code = ref_param_read_string_value(plist->memory, &loc, psv + i);
- }
+ loc.pvalue = &elt;
+ for (i = 0; code >= 0 && i < size; i++) {
+ array_get(plist->memory, &aref, i, &elt);
+ code = ref_param_read_string_value(plist->memory, &loc, psv + i);
+ }
}
if (code < 0) {
- gs_free_object(plist->memory, psv, "ref_param_read_string_array");
- return (*loc.presult = code);
+ gs_free_object(plist->memory, psv, "ref_param_read_string_array");
+ return (*loc.presult = code);
}
pvalue->data = psv;
pvalue->size = size;
@@ -652,8 +652,8 @@ ref_param_read_string_array(gs_param_list * plist, gs_param_name pkey,
}
static int
ref_param_begin_read_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue,
- gs_param_collection_type_t coll_type)
+ gs_param_dict * pvalue,
+ gs_param_collection_type_t coll_type)
{
iparam_list *const iplist = (iparam_list *) plist;
iparam_loc loc;
@@ -662,44 +662,44 @@ ref_param_begin_read_collection(gs_param_list * plist, gs_param_name pkey,
dict_param_list *dlist;
if (code != 0)
- return code;
+ return code;
dlist = (dict_param_list *)
- gs_alloc_bytes(plist->memory, size_of(dict_param_list),
- "ref_param_begin_read_collection");
+ gs_alloc_bytes(plist->memory, size_of(dict_param_list),
+ "ref_param_begin_read_collection");
if (dlist == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (r_has_type(loc.pvalue, t_dictionary)) {
- code = dict_param_list_read(dlist, loc.pvalue, NULL, false,
- iplist->ref_memory);
- dlist->int_keys = int_keys;
- if (code >= 0)
- pvalue->size = dict_length(loc.pvalue);
+ code = dict_param_list_read(dlist, loc.pvalue, NULL, false,
+ iplist->ref_memory);
+ dlist->int_keys = int_keys;
+ if (code >= 0)
+ pvalue->size = dict_length(loc.pvalue);
} else if (int_keys && r_is_array(loc.pvalue)) {
- code = array_indexed_param_list_read(dlist, loc.pvalue, NULL, false,
- iplist->ref_memory);
- if (code >= 0)
- pvalue->size = r_size(loc.pvalue);
+ code = array_indexed_param_list_read(dlist, loc.pvalue, NULL, false,
+ iplist->ref_memory);
+ if (code >= 0)
+ pvalue->size = r_size(loc.pvalue);
} else
- code = gs_note_error(e_typecheck);
+ code = gs_note_error(e_typecheck);
if (code < 0) {
- gs_free_object(plist->memory, dlist, "ref_param_begin_write_collection");
- return iparam_note_error(loc, code);
+ gs_free_object(plist->memory, dlist, "ref_param_begin_write_collection");
+ return iparam_note_error(loc, code);
}
pvalue->list = (gs_param_list *) dlist;
return 0;
}
static int
ref_param_end_read_collection(gs_param_list * plist, gs_param_name pkey,
- gs_param_dict * pvalue)
+ gs_param_dict * pvalue)
{
iparam_list_release((dict_param_list *) pvalue->list);
gs_free_object(plist->memory, pvalue->list,
- "ref_param_end_read_collection");
+ "ref_param_end_read_collection");
return 0;
}
static int
ref_param_read_typed(gs_param_list * plist, gs_param_name pkey,
- gs_param_typed_value * pvalue)
+ gs_param_typed_value * pvalue)
{
iparam_list *const iplist = (iparam_list *) plist;
iparam_loc loc;
@@ -707,96 +707,96 @@ ref_param_read_typed(gs_param_list * plist, gs_param_name pkey,
int code = ref_param_read(iplist, pkey, &loc, -1);
if (code != 0)
- return code;
+ return code;
switch (r_type(loc.pvalue)) {
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- iparam_check_read(loc);
- if (r_size(loc.pvalue) <= 0) {
- /* 0-length array; can't get type info */
- pvalue->type = gs_param_type_array;
- pvalue->value.d.list = 0;
- pvalue->value.d.size = 0;
- return 0;
- }
- /*
- * We have to guess at the array type. First we guess based
- * on the type of the first element of the array. If that
- * fails, we try again with more general types.
- */
- array_get(plist->memory, loc.pvalue, 0, &elt);
- switch (r_type(&elt)) {
- case t_integer:
- pvalue->type = gs_param_type_int_array;
- code = ref_param_read_int_array(plist, pkey,
- &pvalue->value.ia);
- if (code != e_typecheck)
- return code;
- /* This might be a float array. Fall through. */
- *loc.presult = 0; /* reset error */
- case t_real:
- pvalue->type = gs_param_type_float_array;
- return ref_param_read_float_array(plist, pkey,
- &pvalue->value.fa);
- case t_string:
- pvalue->type = gs_param_type_string_array;
- return ref_param_read_string_array(plist, pkey,
- &pvalue->value.sa);
- case t_name:
- pvalue->type = gs_param_type_name_array;
- return ref_param_read_string_array(plist, pkey,
- &pvalue->value.na);
- default:
- break;
- }
- return gs_note_error(e_typecheck);
- case t_boolean:
- pvalue->type = gs_param_type_bool;
- pvalue->value.b = loc.pvalue->value.boolval;
- return 0;
- case t_dictionary:
- code = ref_param_begin_read_collection(plist, pkey,
- &pvalue->value.d, gs_param_collection_dict_any);
- if (code < 0)
- return code;
- pvalue->type = gs_param_type_dict;
-
- /* fixup new dict's type & int_keys field if contents have int keys */
- {
- gs_param_enumerator_t enumr;
- gs_param_key_t key;
- ref_type keytype;
-
- param_init_enumerator(&enumr);
- if (!(*((iparam_list *) plist)->enumerate)
- ((iparam_list *) pvalue->value.d.list, &enumr, &key, &keytype)
- && keytype == t_integer) {
- ((dict_param_list *) pvalue->value.d.list)->int_keys = 1;
- pvalue->type = gs_param_type_dict_int_keys;
- }
- }
- return 0;
- case t_integer:
- pvalue->type = gs_param_type_long;
- pvalue->value.l = loc.pvalue->value.intval;
- return 0;
- case t_name:
- pvalue->type = gs_param_type_name;
- return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.n);
- case t_null:
- pvalue->type = gs_param_type_null;
- return 0;
- case t_real:
- pvalue->value.f = loc.pvalue->value.realval;
- pvalue->type = gs_param_type_float;
- return 0;
- case t_string:
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ iparam_check_read(loc);
+ if (r_size(loc.pvalue) <= 0) {
+ /* 0-length array; can't get type info */
+ pvalue->type = gs_param_type_array;
+ pvalue->value.d.list = 0;
+ pvalue->value.d.size = 0;
+ return 0;
+ }
+ /*
+ * We have to guess at the array type. First we guess based
+ * on the type of the first element of the array. If that
+ * fails, we try again with more general types.
+ */
+ array_get(plist->memory, loc.pvalue, 0, &elt);
+ switch (r_type(&elt)) {
+ case t_integer:
+ pvalue->type = gs_param_type_int_array;
+ code = ref_param_read_int_array(plist, pkey,
+ &pvalue->value.ia);
+ if (code != e_typecheck)
+ return code;
+ /* This might be a float array. Fall through. */
+ *loc.presult = 0; /* reset error */
+ case t_real:
+ pvalue->type = gs_param_type_float_array;
+ return ref_param_read_float_array(plist, pkey,
+ &pvalue->value.fa);
+ case t_string:
+ pvalue->type = gs_param_type_string_array;
+ return ref_param_read_string_array(plist, pkey,
+ &pvalue->value.sa);
+ case t_name:
+ pvalue->type = gs_param_type_name_array;
+ return ref_param_read_string_array(plist, pkey,
+ &pvalue->value.na);
+ default:
+ break;
+ }
+ return gs_note_error(e_typecheck);
+ case t_boolean:
+ pvalue->type = gs_param_type_bool;
+ pvalue->value.b = loc.pvalue->value.boolval;
+ return 0;
+ case t_dictionary:
+ code = ref_param_begin_read_collection(plist, pkey,
+ &pvalue->value.d, gs_param_collection_dict_any);
+ if (code < 0)
+ return code;
+ pvalue->type = gs_param_type_dict;
+
+ /* fixup new dict's type & int_keys field if contents have int keys */
+ {
+ gs_param_enumerator_t enumr;
+ gs_param_key_t key;
+ ref_type keytype;
+
+ param_init_enumerator(&enumr);
+ if (!(*((iparam_list *) plist)->enumerate)
+ ((iparam_list *) pvalue->value.d.list, &enumr, &key, &keytype)
+ && keytype == t_integer) {
+ ((dict_param_list *) pvalue->value.d.list)->int_keys = 1;
+ pvalue->type = gs_param_type_dict_int_keys;
+ }
+ }
+ return 0;
+ case t_integer:
+ pvalue->type = gs_param_type_long;
+ pvalue->value.l = loc.pvalue->value.intval;
+ return 0;
+ case t_name:
+ pvalue->type = gs_param_type_name;
+ return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.n);
+ case t_null:
+ pvalue->type = gs_param_type_null;
+ return 0;
+ case t_real:
+ pvalue->value.f = loc.pvalue->value.realval;
+ pvalue->type = gs_param_type_float;
+ return 0;
+ case t_string:
case t_astruct:
- pvalue->type = gs_param_type_string;
- return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.s);
- default:
- break;
+ pvalue->type = gs_param_type_string;
+ return ref_param_read_string_value(plist->memory, &loc, &pvalue->value.s);
+ default:
+ break;
}
return gs_note_error(e_typecheck);
}
@@ -808,10 +808,10 @@ ref_param_read_get_policy(gs_param_list * plist, gs_param_name pkey)
ref *pvalue;
if (!(r_has_type(&iplist->u.r.policies, t_dictionary) &&
- dict_find_string(&iplist->u.r.policies, pkey, &pvalue) > 0 &&
- r_has_type(pvalue, t_integer))
- )
- return gs_param_policy_ignore;
+ dict_find_string(&iplist->u.r.policies, pkey, &pvalue) > 0 &&
+ r_has_type(pvalue, t_integer))
+ )
+ return gs_param_policy_ignore;
return (int)pvalue->value.intval;
}
static int
@@ -823,12 +823,12 @@ ref_param_read_signal_error(gs_param_list * plist, gs_param_name pkey, int code)
ref_param_read(iplist, pkey, &loc, -1); /* can't fail */
*loc.presult = code;
switch (ref_param_read_get_policy(plist, pkey)) {
- case gs_param_policy_ignore:
- return 0;
- case gs_param_policy_consult_user:
- return_error(e_configurationerror);
- default:
- return code;
+ case gs_param_policy_ignore:
+ return 0;
+ case gs_param_policy_consult_user:
+ return_error(e_configurationerror);
+ default:
+ return code;
}
}
static int
@@ -839,16 +839,16 @@ ref_param_read_commit(gs_param_list * plist)
int ecode = 0;
if (!iplist->u.r.require_all)
- return 0;
+ return 0;
/* Check to make sure that all parameters were actually read. */
for (i = 0; i < iplist->count; ++i)
- if (iplist->results[i] == 0)
- iplist->results[i] = ecode = gs_note_error(e_undefined);
+ if (iplist->results[i] == 0)
+ iplist->results[i] = ecode = gs_note_error(e_undefined);
return ecode;
}
static int
ref_param_get_next_key(gs_param_list * plist, gs_param_enumerator_t * penum,
- gs_param_key_t * key)
+ gs_param_key_t * key)
{
ref_type keytype; /* result not needed here */
iparam_list *const pilist = (iparam_list *) plist;
@@ -865,34 +865,34 @@ ref_param_read_string_value(gs_memory_t *mem, const iparam_loc * ploc, gs_param_
const ref *pref = ploc->pvalue;
switch (r_type(pref)) {
- case t_name: {
- ref nref;
-
- name_string_ref(mem, pref, &nref);
- pvalue->data = nref.value.const_bytes;
- pvalue->size = r_size(&nref);
- pvalue->persistent = true;
- }
- break;
- case t_string:
- iparam_check_read(*ploc);
- pvalue->data = pref->value.const_bytes;
- pvalue->size = r_size(pref);
- pvalue->persistent = false;
- break;
- case t_astruct:
- /* Note: technically, instead of the "mem" argument, we
- should be using the plists's ref_memory. However, in a
- simple call to .putdeviceparams, they are identical. */
- iparam_check_read(*ploc);
- if (gs_object_type(mem, pref->value.pstruct) != &st_bytes)
- return iparam_note_error(*ploc, e_typecheck);
- pvalue->data = r_ptr(pref, byte);
- pvalue->size = gs_object_size(mem, pref->value.pstruct);
- pvalue->persistent = false;
- break;
- default:
- return iparam_note_error(*ploc, e_typecheck);
+ case t_name: {
+ ref nref;
+
+ name_string_ref(mem, pref, &nref);
+ pvalue->data = nref.value.const_bytes;
+ pvalue->size = r_size(&nref);
+ pvalue->persistent = true;
+ }
+ break;
+ case t_string:
+ iparam_check_read(*ploc);
+ pvalue->data = pref->value.const_bytes;
+ pvalue->size = r_size(pref);
+ pvalue->persistent = false;
+ break;
+ case t_astruct:
+ /* Note: technically, instead of the "mem" argument, we
+ should be using the plists's ref_memory. However, in a
+ simple call to .putdeviceparams, they are identical. */
+ iparam_check_read(*ploc);
+ if (gs_object_type(mem, pref->value.pstruct) != &st_bytes)
+ return iparam_note_error(*ploc, e_typecheck);
+ pvalue->data = r_ptr(pref, byte);
+ pvalue->size = gs_object_size(mem, pref->value.pstruct);
+ pvalue->persistent = false;
+ break;
+ default:
+ return iparam_note_error(*ploc, e_typecheck);
}
return 0;
}
@@ -904,9 +904,9 @@ ref_param_read_array(iparam_list * plist, gs_param_name pkey, iparam_loc * ploc)
int code = ref_param_read(plist, pkey, ploc, -1);
if (code != 0)
- return code;
+ return code;
if (!r_is_array(ploc->pvalue))
- return iparam_note_error(*ploc, e_typecheck);
+ return iparam_note_error(*ploc, e_typecheck);
iparam_check_read(*ploc);
return 0;
}
@@ -914,19 +914,19 @@ ref_param_read_array(iparam_list * plist, gs_param_name pkey, iparam_loc * ploc)
/* Generic routine for reading a ref parameter. */
static int
ref_param_read(iparam_list * plist, gs_param_name pkey, iparam_loc * ploc,
- int type)
+ int type)
{
iparam_list *const iplist = (iparam_list *) plist;
ref kref;
int code = ref_param_key(plist, pkey, &kref);
if (code < 0)
- return code;
+ return code;
code = (*plist->u.r.read) (iplist, &kref, ploc);
if (code != 0)
- return code;
+ return code;
if (type >= 0)
- iparam_check_type(*ploc, type);
+ iparam_check_type(*ploc, type);
return 0;
}
@@ -942,23 +942,23 @@ empty_param_read(iparam_list * plist, const ref * pkey, iparam_loc * ploc)
/* Initialize for reading parameters. */
static int
ref_param_read_init(iparam_list * plist, uint count, const ref * ppolicies,
- bool require_all, gs_ref_memory_t *imem)
+ bool require_all, gs_ref_memory_t *imem)
{
gs_param_list_init((gs_param_list *)plist, &ref_read_procs,
- (gs_memory_t *)imem);
+ (gs_memory_t *)imem);
plist->ref_memory = imem;
if (ppolicies == 0)
- make_null(&plist->u.r.policies);
+ make_null(&plist->u.r.policies);
else
- plist->u.r.policies = *ppolicies;
+ plist->u.r.policies = *ppolicies;
plist->u.r.require_all = require_all;
plist->count = count;
plist->results = (int *)
- gs_alloc_byte_array(plist->memory, count, sizeof(int),
- "ref_param_read_init");
+ gs_alloc_byte_array(plist->memory, count, sizeof(int),
+ "ref_param_read_init");
if (plist->results == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
memset(plist->results, 0, count * sizeof(int));
plist->int_keys = false;
@@ -973,7 +973,7 @@ array_indexed_param_read(iparam_list * plist, const ref * pkey, iparam_loc * plo
check_type(*pkey, t_integer);
if (pkey->value.intval < 0 || pkey->value.intval >= r_size(arr))
- return 1;
+ return 1;
ploc->pvalue = arr->value.refs + pkey->value.intval;
ploc->presult = &plist->results[pkey->value.intval];
*ploc->presult = 1;
@@ -981,8 +981,8 @@ array_indexed_param_read(iparam_list * plist, const ref * pkey, iparam_loc * plo
}
int
array_indexed_param_list_read(dict_param_list * plist, const ref * parray,
- const ref * ppolicies, bool require_all,
- gs_ref_memory_t *ref_memory)
+ const ref * ppolicies, bool require_all,
+ gs_ref_memory_t *ref_memory)
{
iparam_list *const iplist = (iparam_list *) plist;
int code;
@@ -991,7 +991,7 @@ array_indexed_param_list_read(dict_param_list * plist, const ref * parray,
plist->u.r.read = array_indexed_param_read;
plist->dict = *parray;
code = ref_param_read_init(iplist, r_size(parray), ppolicies,
- require_all, ref_memory);
+ require_all, ref_memory);
plist->int_keys = true;
return code;
}
@@ -1005,12 +1005,12 @@ array_param_read(iparam_list * plist, const ref * pkey, iparam_loc * ploc)
ref *top = ((array_param_list *) plist)->top;
for (; ptr < top; ptr += 2) {
- if (r_has_type(ptr, t_name) && name_eq(ptr, pkey)) {
- ploc->pvalue = ptr + 1;
- ploc->presult = &plist->results[ptr - bot];
- *ploc->presult = 1;
- return 0;
- }
+ if (r_has_type(ptr, t_name) && name_eq(ptr, pkey)) {
+ ploc->pvalue = ptr + 1;
+ ploc->presult = &plist->results[ptr - bot];
+ *ploc->presult = 1;
+ return 0;
+ }
}
return 1;
}
@@ -1018,7 +1018,7 @@ array_param_read(iparam_list * plist, const ref * pkey, iparam_loc * ploc)
/* Implementation for enumerating parameters in an array */
static int /* ret 0 ok, 1 if EOF, or -ve err */
array_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
- gs_param_key_t * key, ref_type * type)
+ gs_param_key_t * key, ref_type * type)
{
int index = penum->intval;
ref *bot = ((array_param_list *) plist)->bot;
@@ -1026,28 +1026,28 @@ array_param_enumerate(iparam_list * plist, gs_param_enumerator_t * penum,
ref *top = ((array_param_list *) plist)->top;
for (; ptr < top; ptr += 2) {
- index += 2;
+ index += 2;
- if (r_has_type(ptr, t_name)) {
- int code = ref_to_key(ptr, key, plist);
+ if (r_has_type(ptr, t_name)) {
+ int code = ref_to_key(ptr, key, plist);
- *type = r_type(ptr);
- penum->intval = index;
- return code;
- }
+ *type = r_type(ptr);
+ penum->intval = index;
+ return code;
+ }
}
return 1;
}
int
array_param_list_read(array_param_list * plist, ref * bot, uint count,
- const ref * ppolicies, bool require_all,
- gs_ref_memory_t *imem)
+ const ref * ppolicies, bool require_all,
+ gs_ref_memory_t *imem)
{
iparam_list *const iplist = (iparam_list *) plist;
if (count & 1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
plist->u.r.read = array_param_read;
plist->enumerate = array_param_enumerate;
plist->bot = bot;
@@ -1067,30 +1067,30 @@ stack_param_read(iparam_list * plist, const ref * pkey, iparam_loc * ploc)
uint count = splist->count;
for (; count; count--, index += 2) {
- const ref *p = ref_stack_index(pstack, index);
-
- if (r_has_type(p, t_name) && name_eq(p, pkey)) {
- ploc->pvalue = ref_stack_index(pstack, index - 1);
- ploc->presult = &plist->results[count - 1];
- *ploc->presult = 1;
- return 0;
- }
+ const ref *p = ref_stack_index(pstack, index);
+
+ if (r_has_type(p, t_name) && name_eq(p, pkey)) {
+ ploc->pvalue = ref_stack_index(pstack, index - 1);
+ ploc->presult = &plist->results[count - 1];
+ *ploc->presult = 1;
+ return 0;
+ }
}
return 1;
}
int
stack_param_list_read(stack_param_list * plist, ref_stack_t * pstack,
- uint skip, const ref * ppolicies, bool require_all,
- gs_ref_memory_t *imem)
+ uint skip, const ref * ppolicies, bool require_all,
+ gs_ref_memory_t *imem)
{
iparam_list *const iplist = (iparam_list *) plist;
uint count = ref_stack_counttomark(pstack);
if (count == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
count -= skip + 1;
if (count & 1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
plist->u.r.read = stack_param_read;
plist->enumerate = stack_param_enumerate;
plist->pstack = pstack;
@@ -1106,28 +1106,28 @@ dict_param_read(iparam_list * plist, const ref * pkey, iparam_loc * ploc)
int code = dict_find(spdict, pkey, &ploc->pvalue);
if (code != 1)
- return 1;
+ return 1;
ploc->presult =
- &plist->results[dict_value_index(spdict, ploc->pvalue)];
+ &plist->results[dict_value_index(spdict, ploc->pvalue)];
*ploc->presult = 1;
return 0;
}
int
dict_param_list_read(dict_param_list * plist, const ref * pdict,
- const ref * ppolicies, bool require_all,
- gs_ref_memory_t *imem)
+ const ref * ppolicies, bool require_all,
+ gs_ref_memory_t *imem)
{
iparam_list *const iplist = (iparam_list *) plist;
uint count;
if (pdict == 0) {
- plist->u.r.read = empty_param_read;
- count = 0;
+ plist->u.r.read = empty_param_read;
+ count = 0;
} else {
- check_dict_read(*pdict);
- plist->u.r.read = dict_param_read;
- plist->dict = *pdict;
- count = dict_max_index(pdict) + 1;
+ check_dict_read(*pdict);
+ plist->u.r.read = dict_param_read;
+ plist->dict = *pdict;
+ count = dict_max_index(pdict) + 1;
}
plist->enumerate = dict_param_enumerate;
return ref_param_read_init(iplist, count, ppolicies, require_all, imem);
diff --git a/gs/psi/iparam.h b/gs/psi/iparam.h
index eb38f9744..615bca245 100644
--- a/gs/psi/iparam.h
+++ b/gs/psi/iparam.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,13 +44,13 @@ typedef struct iparam_loc_s {
gs_ref_memory_t *ref_memory; /* a properly typed copy of memory */\
union {\
struct { /* reading */\
- int (*read)(iparam_list *, const ref *, iparam_loc *);\
- ref policies; /* policy dictionary or null */\
- bool require_all; /* if true, require all params to be known */\
+ int (*read)(iparam_list *, const ref *, iparam_loc *);\
+ ref policies; /* policy dictionary or null */\
+ bool require_all; /* if true, require all params to be known */\
} r;\
struct { /* writing */\
- int (*write)(iparam_list *, const ref *, const ref *);\
- ref wanted; /* desired keys or null */\
+ int (*write)(iparam_list *, const ref *, const ref *);\
+ ref wanted; /* desired keys or null */\
} w;\
} u;\
int (*enumerate)(iparam_list *, gs_param_enumerator_t *, gs_param_key_t *, ref_type *);\
@@ -89,19 +89,19 @@ typedef struct stack_param_list_s {
* the commit procedure will return an e_undefined error.
*/
int dict_param_list_read(dict_param_list *, const ref * /*t_dictionary */ ,
- const ref *, bool, gs_ref_memory_t *);
+ const ref *, bool, gs_ref_memory_t *);
int dict_param_list_write(dict_param_list *, ref * /*t_dictionary */ ,
- const ref *, gs_ref_memory_t *);
+ const ref *, gs_ref_memory_t *);
int array_indexed_param_list_read(dict_param_list *, const ref * /*t_*array */ ,
- const ref *, bool, gs_ref_memory_t *);
+ const ref *, bool, gs_ref_memory_t *);
int array_indexed_param_list_write(dict_param_list *, ref * /*t_*array */ ,
- const ref *, gs_ref_memory_t *);
+ const ref *, gs_ref_memory_t *);
int array_param_list_read(array_param_list *, ref *, uint,
- const ref *, bool, gs_ref_memory_t *);
+ const ref *, bool, gs_ref_memory_t *);
int stack_param_list_read(stack_param_list *, ref_stack_t *, uint,
- const ref *, bool, gs_ref_memory_t *);
+ const ref *, bool, gs_ref_memory_t *);
int stack_param_list_write(stack_param_list *, ref_stack_t *,
- const ref *, gs_ref_memory_t *);
+ const ref *, gs_ref_memory_t *);
#define iparam_list_release(plist)\
gs_free_object((plist)->memory, (plist)->results, "iparam_list_release")
diff --git a/gs/psi/iparray.h b/gs/psi/iparray.h
index 97fe9b64e..7a9af2ef3 100644
--- a/gs/psi/iparray.h
+++ b/gs/psi/iparray.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,6 +28,6 @@
/* Make a packed array from the top N elements of a stack. */
int make_packed_array(ref *, ref_stack_t *, uint, gs_dual_memory_t *,
- client_name_t);
+ client_name_t);
#endif /* iparray_INCLUDED */
diff --git a/gs/psi/ipcolor.h b/gs/psi/ipcolor.h
index 8410e3b94..e1fee26b9 100644
--- a/gs/psi/ipcolor.h
+++ b/gs/psi/ipcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,6 +32,6 @@ typedef struct int_pattern_s {
/* Create an interpreter pattern structure. */
int int_pattern_alloc(int_pattern **ppdata, const ref *op,
- gs_memory_t *mem);
+ gs_memory_t *mem);
#endif /* ipcolor_INCLUDED */
diff --git a/gs/psi/iplugin.c b/gs/psi/iplugin.c
index f65e9aa52..54b962205 100644
--- a/gs/psi/iplugin.c
+++ b/gs/psi/iplugin.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iplugin.h b/gs/psi/iplugin.h
index 71621119d..999dcc426 100644
--- a/gs/psi/iplugin.h
+++ b/gs/psi/iplugin.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ireclaim.c b/gs/psi/ireclaim.c
index 25c701cb9..43bcee244 100644
--- a/gs/psi/ireclaim.c
+++ b/gs/psi/ireclaim.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,45 +51,45 @@ ireclaim(gs_dual_memory_t * dmem, int space)
gs_ref_memory_t *mem;
if (space < 0) {
- /* Determine which allocator exceeded the limit. */
- int i;
-
- mem = dmem->space_global; /* just in case */
- for (i = 0; i < countof(dmem->spaces_indexed); ++i) {
- mem = dmem->spaces_indexed[i];
- if (mem == 0)
- continue;
- if (mem->gc_status.requested > 0 ||
- ((gs_ref_memory_t *)mem->stable_memory)->gc_status.requested > 0
- )
- break;
- }
+ /* Determine which allocator exceeded the limit. */
+ int i;
+
+ mem = dmem->space_global; /* just in case */
+ for (i = 0; i < countof(dmem->spaces_indexed); ++i) {
+ mem = dmem->spaces_indexed[i];
+ if (mem == 0)
+ continue;
+ if (mem->gc_status.requested > 0 ||
+ ((gs_ref_memory_t *)mem->stable_memory)->gc_status.requested > 0
+ )
+ break;
+ }
} else {
- mem = dmem->spaces_indexed[space >> r_space_shift];
+ mem = dmem->spaces_indexed[space >> r_space_shift];
}
if_debug3('0', "[0]GC called, space=%d, requestor=%d, requested=%ld\n",
- space, mem->space, (long)mem->gc_status.requested);
+ space, mem->space, (long)mem->gc_status.requested);
global = mem->space != avm_local;
/* Since dmem may move, reset the request now. */
ialloc_reset_requested(dmem);
gs_vmreclaim(dmem, global);
ialloc_set_limit(mem);
if (space < 0) {
- gs_memory_status_t stats;
- ulong allocated;
-
- /* If the ammount still allocated after the GC is complete */
- /* exceeds the max_vm setting, then return a VMerror */
- gs_memory_status((gs_memory_t *) mem, &stats);
- allocated = stats.allocated;
- if (mem->stable_memory != (gs_memory_t *)mem) {
- gs_memory_status(mem->stable_memory, &stats);
- allocated += stats.allocated;
- }
- if (allocated >= mem->gc_status.max_vm) {
- /* We can't satisfy this request within max_vm. */
- return_error(e_VMerror);
- }
+ gs_memory_status_t stats;
+ ulong allocated;
+
+ /* If the ammount still allocated after the GC is complete */
+ /* exceeds the max_vm setting, then return a VMerror */
+ gs_memory_status((gs_memory_t *) mem, &stats);
+ allocated = stats.allocated;
+ if (mem->stable_memory != (gs_memory_t *)mem) {
+ gs_memory_status(mem->stable_memory, &stats);
+ allocated += stats.allocated;
+ }
+ if (allocated >= mem->gc_status.max_vm) {
+ /* We can't satisfy this request within max_vm. */
+ return_error(e_VMerror);
+ }
}
return 0;
}
@@ -100,7 +100,7 @@ gs_vmreclaim(gs_dual_memory_t *dmem, bool global)
{
/* HACK: we know the gs_dual_memory_t is embedded in a context state. */
i_ctx_t *i_ctx_p =
- (i_ctx_t *)((char *)dmem - offset_of(i_ctx_t, memory));
+ (i_ctx_t *)((char *)dmem - offset_of(i_ctx_t, memory));
gs_ref_memory_t *lmem = dmem->space_local;
int code = context_state_store(i_ctx_p);
gs_ref_memory_t *memories[5];
@@ -111,49 +111,49 @@ gs_vmreclaim(gs_dual_memory_t *dmem, bool global)
memories[1] = mem = dmem->space_global;
nmem = 2;
if (lmem != dmem->space_global)
- memories[nmem++] = lmem;
+ memories[nmem++] = lmem;
for (i = nmem; --i >= 0;) {
- mem = memories[i];
- if (mem->stable_memory != (gs_memory_t *)mem)
- memories[nmem++] = (gs_ref_memory_t *)mem->stable_memory;
+ mem = memories[i];
+ if (mem->stable_memory != (gs_memory_t *)mem)
+ memories[nmem++] = (gs_ref_memory_t *)mem->stable_memory;
}
/****** ABORT IF code < 0 ******/
for (i = nmem; --i >= 0; )
- alloc_close_chunk(memories[i]);
+ alloc_close_chunk(memories[i]);
/* Prune the file list so it won't retain potentially collectible */
/* files. */
for (i = (global ? i_vm_system : i_vm_local);
- i < countof(dmem->spaces_indexed);
- ++i
- ) {
- gs_ref_memory_t *mem = dmem->spaces_indexed[i];
-
- if (mem == 0 || (i > 0 && mem == dmem->spaces_indexed[i - 1]))
- continue;
- if (mem->stable_memory != (gs_memory_t *)mem)
- ialloc_gc_prepare((gs_ref_memory_t *)mem->stable_memory);
- for (;; mem = &mem->saved->state) {
- ialloc_gc_prepare(mem);
- if (mem->saved == 0)
- break;
- }
+ i < countof(dmem->spaces_indexed);
+ ++i
+ ) {
+ gs_ref_memory_t *mem = dmem->spaces_indexed[i];
+
+ if (mem == 0 || (i > 0 && mem == dmem->spaces_indexed[i - 1]))
+ continue;
+ if (mem->stable_memory != (gs_memory_t *)mem)
+ ialloc_gc_prepare((gs_ref_memory_t *)mem->stable_memory);
+ for (;; mem = &mem->saved->state) {
+ ialloc_gc_prepare(mem);
+ if (mem->saved == 0)
+ break;
+ }
}
/* Do the actual collection. */
{
- void *ctxp = i_ctx_p;
- gs_gc_root_t context_root;
-
- gs_register_struct_root((gs_memory_t *)lmem, &context_root,
- &ctxp, "i_ctx_p root");
- GS_RECLAIM(&dmem->spaces, global);
- gs_unregister_root((gs_memory_t *)lmem, &context_root, "i_ctx_p root");
- i_ctx_p = ctxp;
- dmem = &i_ctx_p->memory;
+ void *ctxp = i_ctx_p;
+ gs_gc_root_t context_root;
+
+ gs_register_struct_root((gs_memory_t *)lmem, &context_root,
+ &ctxp, "i_ctx_p root");
+ GS_RECLAIM(&dmem->spaces, global);
+ gs_unregister_root((gs_memory_t *)lmem, &context_root, "i_ctx_p root");
+ i_ctx_p = ctxp;
+ dmem = &i_ctx_p->memory;
}
/* Update caches not handled by context_state_load. */
@@ -167,12 +167,12 @@ gs_vmreclaim(gs_dual_memory_t *dmem, bool global)
/* Reopen the active chunks. */
for (i = 0; i < nmem; ++i)
- alloc_open_chunk(memories[i]);
+ alloc_open_chunk(memories[i]);
/* Reload the context state. Note this should be done
AFTER the chunks are reopened, since the context state
- load could do allocations that must remain.
- If it were done while the chunks were still closed,
+ load could do allocations that must remain.
+ If it were done while the chunks were still closed,
we would lose those allocations when the chunks were opened */
code = context_state_load(i_ctx_p);
diff --git a/gs/psi/iref.h b/gs/psi/iref.h
index a381eb162..c1b146ba8 100644
--- a/gs/psi/iref.h
+++ b/gs/psi/iref.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -126,7 +126,7 @@ typedef enum {
*/
t_name, /* @! # value.pname, uses size for index */
t_null, /* ! # (value.opproc, uses size for mark */
- /* type, on e-stack only) */
+ /* type, on e-stack only) */
/*
* Operator objects use the a_space field because they may actually be
* disguised procedures. (Real operators always have a_space = 0.)
@@ -134,7 +134,7 @@ typedef enum {
t_operator, /* @! # value.opproc, uses size for index */
t_real, /* value.realval */
t_save, /* value.saveid, see isave.h for why */
- /* this isn't a t_struct */
+ /* this isn't a t_struct */
t_string, /* @!+# value.bytes */
/*
* The following are extensions to the PostScript type set.
@@ -148,7 +148,7 @@ typedef enum {
*/
t_device, /* @ + value.pdevice */
t_oparray, /* @! # value.const_refs, uses size */
- /* for index */
+ /* for index */
t_next_index /*** first available index ***/
} ref_type;
@@ -380,29 +380,29 @@ struct ref_s {
struct tas_s tas;
union v { /* name the union to keep gdb happy */
- int intval;
- ushort boolval;
- float realval;
- ulong saveid;
- byte *bytes;
- const byte *const_bytes;
- ref *refs;
- const ref *const_refs;
- name *pname;
- const name *const_pname;
- dict *pdict;
- const dict *const_pdict;
- /*
- * packed is the normal variant for referring to packed arrays,
- * but we need a writable variant for memory management and for
- * storing into packed dictionary key arrays.
- */
- const ref_packed *packed;
- ref_packed *writable_packed;
- op_proc_t opproc;
- struct stream_s *pfile;
- struct gx_device_s *pdevice;
- obj_header_t *pstruct;
+ int intval;
+ ushort boolval;
+ float realval;
+ ulong saveid;
+ byte *bytes;
+ const byte *const_bytes;
+ ref *refs;
+ const ref *const_refs;
+ name *pname;
+ const name *const_pname;
+ dict *pdict;
+ const dict *const_pdict;
+ /*
+ * packed is the normal variant for referring to packed arrays,
+ * but we need a writable variant for memory management and for
+ * storing into packed dictionary key arrays.
+ */
+ const ref_packed *packed;
+ ref_packed *writable_packed;
+ op_proc_t opproc;
+ struct stream_s *pfile;
+ struct gx_device_s *pdevice;
+ obj_header_t *pstruct;
} value;
};
@@ -546,7 +546,7 @@ struct ref_s {
/* Define data for initializing an empty array or string. */
#define empty_ref_data(type, attrs)\
{ /*tas*/ { /*type_attrs*/ ((type) << r_type_shift) | (attrs),\
- /*rsize*/ 0 } }
+ /*rsize*/ 0 } }
/* Define the size of a ref. */
#define arch_sizeof_ref sizeof(ref)
diff --git a/gs/psi/isave.c b/gs/psi/isave.c
index deb680b75..f4d737572 100644
--- a/gs/psi/isave.c
+++ b/gs/psi/isave.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -150,37 +150,37 @@ static void
print_save(const char *str, uint spacen, const alloc_save_t *sav)
{
if_debug5('u', "[u]%s space %u 0x%lx: cdata = 0x%lx, id = %lu\n",\
- str, spacen, (ulong)sav, (ulong)sav->client_data, (ulong)sav->id);
+ str, spacen, (ulong)sav, (ulong)sav->client_data, (ulong)sav->id);
}
/* A link to igcref.c . */
ptr_proc_reloc(igc_reloc_ref_ptr_nocheck, ref_packed);
-static
+static
CLEAR_MARKS_PROC(change_clear_marks)
{
alloc_change_t *const ptr = (alloc_change_t *)vptr;
if (r_is_packed(&ptr->contents))
- r_clear_pmark((ref_packed *) & ptr->contents);
+ r_clear_pmark((ref_packed *) & ptr->contents);
else
- r_clear_attrs(&ptr->contents, l_mark);
+ r_clear_attrs(&ptr->contents, l_mark);
}
-static
+static
ENUM_PTRS_WITH(change_enum_ptrs, alloc_change_t *ptr) return 0;
ENUM_PTR(0, alloc_change_t, next);
case 1:
if (ptr->offset >= 0)
- ENUM_RETURN((byte *) ptr->where - ptr->offset);
+ ENUM_RETURN((byte *) ptr->where - ptr->offset);
else
- if (ptr->offset != AC_OFFSET_ALLOCATED)
- ENUM_RETURN_REF(ptr->where);
- else {
- /* Don't enumerate ptr->where, because it
- needs a special processing with
- alloc_save__filter_changes. */
- ENUM_RETURN(0);
- }
+ if (ptr->offset != AC_OFFSET_ALLOCATED)
+ ENUM_RETURN_REF(ptr->where);
+ else {
+ /* Don't enumerate ptr->where, because it
+ needs a special processing with
+ alloc_save__filter_changes. */
+ ENUM_RETURN(0);
+ }
case 2:
ENUM_RETURN_REF(&ptr->contents);
ENUM_PTRS_END
@@ -188,48 +188,48 @@ static RELOC_PTRS_WITH(change_reloc_ptrs, alloc_change_t *ptr)
{
RELOC_VAR(ptr->next);
switch (ptr->offset) {
- case AC_OFFSET_STATIC:
- break;
- case AC_OFFSET_REF:
- RELOC_REF_PTR_VAR(ptr->where);
- break;
- case AC_OFFSET_ALLOCATED:
- /* We know that ptr->where may point to an unmarked object
- because change_enum_ptrs skipped it,
- and we know it always points to same space
- because we took a special care when calling alloc_save_change_alloc.
- Therefore we must skip the check for the mark,
- which would happen if we call the regular relocation function
- igc_reloc_ref_ptr from RELOC_REF_PTR_VAR.
- Calling igc_reloc_ref_ptr_nocheck instead. */
- { /* A sanity check. */
- obj_header_t *pre = (obj_header_t *)ptr->where - 1, *pre1 = 0;
-
- if (pre->o_type != &st_refs)
- pre1->o_type = 0; /* issue a segfault. */
- }
- if (ptr->where != 0 && !gcst->relocating_untraced)
- ptr->where = igc_reloc_ref_ptr_nocheck(ptr->where, gcst);
- break;
- default:
- {
- byte *obj = (byte *) ptr->where - ptr->offset;
-
- RELOC_VAR(obj);
- ptr->where = (ref_packed *) (obj + ptr->offset);
- }
- break;
+ case AC_OFFSET_STATIC:
+ break;
+ case AC_OFFSET_REF:
+ RELOC_REF_PTR_VAR(ptr->where);
+ break;
+ case AC_OFFSET_ALLOCATED:
+ /* We know that ptr->where may point to an unmarked object
+ because change_enum_ptrs skipped it,
+ and we know it always points to same space
+ because we took a special care when calling alloc_save_change_alloc.
+ Therefore we must skip the check for the mark,
+ which would happen if we call the regular relocation function
+ igc_reloc_ref_ptr from RELOC_REF_PTR_VAR.
+ Calling igc_reloc_ref_ptr_nocheck instead. */
+ { /* A sanity check. */
+ obj_header_t *pre = (obj_header_t *)ptr->where - 1, *pre1 = 0;
+
+ if (pre->o_type != &st_refs)
+ pre1->o_type = 0; /* issue a segfault. */
+ }
+ if (ptr->where != 0 && !gcst->relocating_untraced)
+ ptr->where = igc_reloc_ref_ptr_nocheck(ptr->where, gcst);
+ break;
+ default:
+ {
+ byte *obj = (byte *) ptr->where - ptr->offset;
+
+ RELOC_VAR(obj);
+ ptr->where = (ref_packed *) (obj + ptr->offset);
+ }
+ break;
}
if (r_is_packed(&ptr->contents))
- r_clear_pmark((ref_packed *) & ptr->contents);
+ r_clear_pmark((ref_packed *) & ptr->contents);
else {
- RELOC_REF_VAR(ptr->contents);
- r_clear_attrs(&ptr->contents, l_mark);
+ RELOC_REF_VAR(ptr->contents);
+ r_clear_attrs(&ptr->contents, l_mark);
}
}
RELOC_PTRS_END
gs_private_st_complex_only(st_alloc_change, alloc_change_t, "alloc_change",
- change_clear_marks, change_enum_ptrs, change_reloc_ptrs, 0);
+ change_clear_marks, change_enum_ptrs, change_reloc_ptrs, 0);
/* Debugging printout */
#ifdef DEBUG
@@ -238,23 +238,23 @@ alloc_save_print(alloc_change_t * cp, bool print_current)
{
dprintf2(" 0x%lx: 0x%lx: ", (ulong) cp, (ulong) cp->where);
if (r_is_packed(&cp->contents)) {
- if (print_current)
- dprintf2("saved=%x cur=%x\n", *(ref_packed *) & cp->contents,
- *cp->where);
- else
- dprintf1("%x\n", *(ref_packed *) & cp->contents);
+ if (print_current)
+ dprintf2("saved=%x cur=%x\n", *(ref_packed *) & cp->contents,
+ *cp->where);
+ else
+ dprintf1("%x\n", *(ref_packed *) & cp->contents);
} else {
- if (print_current)
- dprintf6("saved=%x %x %lx cur=%x %x %lx\n",
- r_type_attrs(&cp->contents), r_size(&cp->contents),
- (ulong) cp->contents.value.intval,
- r_type_attrs((ref *) cp->where),
- r_size((ref *) cp->where),
- (ulong) ((ref *) cp->where)->value.intval);
- else
- dprintf3("%x %x %lx\n",
- r_type_attrs(&cp->contents), r_size(&cp->contents),
- (ulong) cp->contents.value.intval);
+ if (print_current)
+ dprintf6("saved=%x %x %lx cur=%x %x %lx\n",
+ r_type_attrs(&cp->contents), r_size(&cp->contents),
+ (ulong) cp->contents.value.intval,
+ r_type_attrs((ref *) cp->where),
+ r_size((ref *) cp->where),
+ (ulong) ((ref *) cp->where)->value.intval);
+ else
+ dprintf3("%x %x %lx\n",
+ r_type_attrs(&cp->contents), r_size(&cp->contents),
+ (ulong) cp->contents.value.intval);
}
}
#endif
@@ -283,13 +283,13 @@ alloc_set_masks(gs_dual_memory_t *dmem, uint new_mask, uint test_mask)
dmem->new_mask = new_mask;
dmem->test_mask = test_mask;
for (i = 0; i < countof(dmem->spaces.memories.indexed); ++i)
- if ((mem = dmem->spaces.memories.indexed[i]) != 0) {
- mem->new_mask = new_mask, mem->test_mask = test_mask;
- if (mem->stable_memory != (gs_memory_t *)mem) {
- mem = (gs_ref_memory_t *)mem->stable_memory;
- mem->new_mask = new_mask, mem->test_mask = test_mask;
- }
- }
+ if ((mem = dmem->spaces.memories.indexed[i]) != 0) {
+ mem->new_mask = new_mask, mem->test_mask = test_mask;
+ if (mem->stable_memory != (gs_memory_t *)mem) {
+ mem = (gs_ref_memory_t *)mem->stable_memory;
+ mem->new_mask = new_mask, mem->test_mask = test_mask;
+ }
+ }
}
void
alloc_set_in_save(gs_dual_memory_t *dmem)
@@ -306,8 +306,8 @@ alloc_set_not_in_save(gs_dual_memory_t *dmem)
/* Save the state. */
static alloc_save_t *alloc_save_space(gs_ref_memory_t *mem,
- gs_dual_memory_t *dmem,
- ulong sid);
+ gs_dual_memory_t *dmem,
+ ulong sid);
static void
alloc_free_save(gs_ref_memory_t *mem, alloc_save_t *save, const char *scn)
{
@@ -322,25 +322,25 @@ alloc_save_state(gs_dual_memory_t * dmem, void *cdata, ulong *psid)
gs_ref_memory_t *gmem = dmem->space_global;
ulong sid = gs_next_ids((const gs_memory_t *)lmem->stable_memory, 2);
bool global =
- lmem->save_level == 0 && gmem != lmem &&
- gmem->num_contexts == 1;
+ lmem->save_level == 0 && gmem != lmem &&
+ gmem->num_contexts == 1;
alloc_save_t *gsave =
- (global ? alloc_save_space(gmem, dmem, sid + 1) : (alloc_save_t *) 0);
+ (global ? alloc_save_space(gmem, dmem, sid + 1) : (alloc_save_t *) 0);
alloc_save_t *lsave = alloc_save_space(lmem, dmem, sid);
if (lsave == 0 || (global && gsave == 0)) {
- if (lsave != 0)
- alloc_free_save(lmem, lsave, "alloc_save_state(local save)");
- if (gsave != 0)
- alloc_free_save(gmem, gsave, "alloc_save_state(global save)");
- return 0;
+ if (lsave != 0)
+ alloc_free_save(lmem, lsave, "alloc_save_state(local save)");
+ if (gsave != 0)
+ alloc_free_save(gmem, gsave, "alloc_save_state(global save)");
+ return 0;
}
if (gsave != 0) {
- gsave->client_data = 0;
- print_save("save", gmem->space, gsave);
- /* Restore names when we do the local restore. */
- lsave->restore_names = gsave->restore_names;
- gsave->restore_names = false;
+ gsave->client_data = 0;
+ print_save("save", gmem->space, gsave);
+ /* Restore names when we do the local restore. */
+ lsave->restore_names = gsave->restore_names;
+ gsave->restore_names = false;
}
lsave->id = sid;
lsave->client_data = cdata;
@@ -349,36 +349,36 @@ alloc_save_state(gs_dual_memory_t * dmem, void *cdata, ulong *psid)
/* can have the attribute set are the ones on the changes chain, */
/* and ones in objects allocated since the last save. */
if (lmem->save_level > 1) {
- ulong scanned;
- int code = save_set_new(&lsave->state, false, true, &scanned);
+ ulong scanned;
+ int code = save_set_new(&lsave->state, false, true, &scanned);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
#if 0 /* Disable invisible save levels. */
- if ((lsave->state.total_scanned += scanned) > max_repeated_scan) {
- /* Do a second, invisible save. */
- alloc_save_t *rsave;
+ if ((lsave->state.total_scanned += scanned) > max_repeated_scan) {
+ /* Do a second, invisible save. */
+ alloc_save_t *rsave;
- rsave = alloc_save_space(lmem, dmem, 0L);
- if (rsave != 0) {
- rsave->client_data = cdata;
+ rsave = alloc_save_space(lmem, dmem, 0L);
+ if (rsave != 0) {
+ rsave->client_data = cdata;
#if 0 /* Bug 688153 */
- rsave->id = lsave->id;
- print_save("save", lmem->space, rsave);
- lsave->id = 0; /* mark as invisible */
- rsave->state.save_level--; /* ditto */
- lsave->client_data = 0;
+ rsave->id = lsave->id;
+ print_save("save", lmem->space, rsave);
+ lsave->id = 0; /* mark as invisible */
+ rsave->state.save_level--; /* ditto */
+ lsave->client_data = 0;
#else
- rsave->id = 0; /* mark as invisible */
- print_save("save", lmem->space, rsave);
- rsave->state.save_level--; /* ditto */
- rsave->client_data = 0;
+ rsave->id = 0; /* mark as invisible */
+ print_save("save", lmem->space, rsave);
+ rsave->state.save_level--; /* ditto */
+ rsave->client_data = 0;
#endif
- /* Inherit the allocated space count -- */
- /* we need this for triggering a GC. */
- print_save("save", lmem->space, lsave);
- }
- }
+ /* Inherit the allocated space count -- */
+ /* we need this for triggering a GC. */
+ print_save("save", lmem->space, lsave);
+ }
+ }
#endif
}
alloc_set_in_save(dmem);
@@ -403,34 +403,34 @@ alloc_save_space(gs_ref_memory_t * mem, gs_dual_memory_t * dmem, ulong sid)
/* Create inner chunks wherever it's worthwhile. */
for (cp = save_mem.cfirst; cp != 0; cp = cp->cnext) {
- if (cp->ctop - cp->cbot > min_inner_chunk_space) {
- /* Create an inner chunk to cover only the unallocated part. */
- chunk_t *inner =
- gs_raw_alloc_struct_immovable(mem->non_gc_memory, &st_chunk,
- "alloc_save_space(inner)");
-
- if (inner == 0)
- break; /* maybe should fail */
- alloc_init_chunk(inner, cp->cbot, cp->ctop, cp->sreloc != 0, cp);
- alloc_link_chunk(inner, mem);
- if_debug2('u', "[u]inner chunk: cbot=0x%lx ctop=0x%lx\n",
- (ulong) inner->cbot, (ulong) inner->ctop);
- if (cp == save_mem.pcc)
- new_pcc = inner;
- }
+ if (cp->ctop - cp->cbot > min_inner_chunk_space) {
+ /* Create an inner chunk to cover only the unallocated part. */
+ chunk_t *inner =
+ gs_raw_alloc_struct_immovable(mem->non_gc_memory, &st_chunk,
+ "alloc_save_space(inner)");
+
+ if (inner == 0)
+ break; /* maybe should fail */
+ alloc_init_chunk(inner, cp->cbot, cp->ctop, cp->sreloc != 0, cp);
+ alloc_link_chunk(inner, mem);
+ if_debug2('u', "[u]inner chunk: cbot=0x%lx ctop=0x%lx\n",
+ (ulong) inner->cbot, (ulong) inner->ctop);
+ if (cp == save_mem.pcc)
+ new_pcc = inner;
+ }
}
mem->pcc = new_pcc;
alloc_open_chunk(mem);
save = gs_alloc_struct((gs_memory_t *) mem, alloc_save_t,
- &st_alloc_save, "alloc_save_space(save)");
+ &st_alloc_save, "alloc_save_space(save)");
if_debug2('u', "[u]save space %u at 0x%lx\n",
- mem->space, (ulong) save);
+ mem->space, (ulong) save);
if (save == 0) {
- /* Free the inner chunk structures. This is the easiest way. */
- restore_free(mem);
- *mem = save_mem;
- return 0;
+ /* Free the inner chunk structures. This is the easiest way. */
+ restore_free(mem);
+ *mem = save_mem;
+ return 0;
}
save->state = save_mem;
save->spaces = dmem->spaces;
@@ -439,12 +439,12 @@ alloc_save_space(gs_ref_memory_t * mem, gs_dual_memory_t * dmem, ulong sid)
save->id = sid;
mem->saved = save;
if_debug2('u', "[u%u]file_save 0x%lx\n",
- mem->space, (ulong) mem->streams);
+ mem->space, (ulong) mem->streams);
mem->streams = 0;
mem->total_scanned = 0;
mem->total_scanned_after_compacting = 0;
if (sid)
- mem->save_level++;
+ mem->save_level++;
return save;
}
@@ -452,51 +452,51 @@ alloc_save_space(gs_ref_memory_t * mem, gs_dual_memory_t * dmem, ulong sid)
/* and mark it as having been saved. */
int
alloc_save_change_in(gs_ref_memory_t *mem, const ref * pcont,
- ref_packed * where, client_name_t cname)
+ ref_packed * where, client_name_t cname)
{
register alloc_change_t *cp;
if (mem->new_mask == 0)
- return 0; /* no saving */
+ return 0; /* no saving */
cp = gs_alloc_struct((gs_memory_t *)mem, alloc_change_t,
- &st_alloc_change, "alloc_save_change");
+ &st_alloc_change, "alloc_save_change");
if (cp == 0)
- return -1;
+ return -1;
cp->next = mem->changes;
cp->where = where;
if (pcont == NULL)
- cp->offset = AC_OFFSET_STATIC;
+ cp->offset = AC_OFFSET_STATIC;
else if (r_is_array(pcont) || r_has_type(pcont, t_dictionary))
- cp->offset = AC_OFFSET_REF;
+ cp->offset = AC_OFFSET_REF;
else if (r_is_struct(pcont))
- cp->offset = (byte *) where - (byte *) pcont->value.pstruct;
+ cp->offset = (byte *) where - (byte *) pcont->value.pstruct;
else {
- lprintf3("Bad type %u for save! pcont = 0x%lx, where = 0x%lx\n",
- r_type(pcont), (ulong) pcont, (ulong) where);
- gs_abort((const gs_memory_t *)mem);
+ lprintf3("Bad type %u for save! pcont = 0x%lx, where = 0x%lx\n",
+ r_type(pcont), (ulong) pcont, (ulong) where);
+ gs_abort((const gs_memory_t *)mem);
}
if (r_is_packed(where))
- *(ref_packed *)&cp->contents = *where;
+ *(ref_packed *)&cp->contents = *where;
else {
- ref_assign_inline(&cp->contents, (ref *) where);
- r_set_attrs((ref *) where, l_new);
+ ref_assign_inline(&cp->contents, (ref *) where);
+ r_set_attrs((ref *) where, l_new);
}
mem->changes = cp;
#ifdef DEBUG
if (gs_debug_c('U')) {
- dlprintf1("[U]save(%s)", client_name_string(cname));
- alloc_save_print(cp, false);
+ dlprintf1("[U]save(%s)", client_name_string(cname));
+ alloc_save_print(cp, false);
}
#endif
return 0;
}
int
alloc_save_change(gs_dual_memory_t * dmem, const ref * pcont,
- ref_packed * where, client_name_t cname)
+ ref_packed * where, client_name_t cname)
{
gs_ref_memory_t *mem =
- (pcont == NULL ? dmem->space_local :
- dmem->spaces_indexed[r_space(pcont) >> r_space_shift]);
+ (pcont == NULL ? dmem->space_local :
+ dmem->spaces_indexed[r_space(pcont) >> r_space_shift]);
return alloc_save_change_in(mem, pcont, where, cname);
}
@@ -508,11 +508,11 @@ alloc_save_change_alloc(gs_ref_memory_t *mem, client_name_t cname, alloc_change_
register alloc_change_t *cp;
if (mem->new_mask == 0)
- return 0; /* no saving */
+ return 0; /* no saving */
cp = gs_alloc_struct((gs_memory_t *)mem, alloc_change_t,
- &st_alloc_change, "alloc_save_change");
+ &st_alloc_change, "alloc_save_change");
if (cp == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
cp->next = mem->changes;
cp->where = 0;
cp->offset = AC_OFFSET_ALLOCATED;
@@ -526,17 +526,17 @@ void
alloc_save_remove(gs_ref_memory_t *mem, ref_packed *obj, client_name_t cname)
{
alloc_change_t **cpp = &mem->changes;
-
+
for (; *cpp != NULL;) {
- alloc_change_t *cp = *cpp;
-
- if (cp->offset == AC_OFFSET_ALLOCATED && cp->where == obj) {
- if (mem->scan_limit == cp)
- mem->scan_limit = cp->next;
- *cpp = cp->next;
- gs_free_object((gs_memory_t *)mem, cp, "alloc_save_remove");
- } else
- cpp = &(*cpp)->next;
+ alloc_change_t *cp = *cpp;
+
+ if (cp->offset == AC_OFFSET_ALLOCATED && cp->where == obj) {
+ if (mem->scan_limit == cp)
+ mem->scan_limit = cp->next;
+ *cpp = cp->next;
+ gs_free_object((gs_memory_t *)mem, cp, "alloc_save_remove");
+ } else
+ cpp = &(*cpp)->next;
}
}
@@ -549,20 +549,20 @@ alloc_save__filter_changes_in_space(gs_ref_memory_t *mem)
unused space. Therefore it just resets marks for
elements being released instead releasing them really. */
alloc_change_t **cpp = &mem->changes;
-
+
for (; *cpp != NULL; ) {
- alloc_change_t *cp = *cpp;
-
- if (cp->offset == AC_OFFSET_ALLOCATED && !check_l_mark(cp->where)) {
- obj_header_t *pre = (obj_header_t *)cp - 1;
-
- *cpp = cp->next;
- cp->where = 0;
- if (mem->scan_limit == cp)
- mem->scan_limit = cp->next;
- o_set_unmarked(pre);
- } else
- cpp = &(*cpp)->next;
+ alloc_change_t *cp = *cpp;
+
+ if (cp->offset == AC_OFFSET_ALLOCATED && !check_l_mark(cp->where)) {
+ obj_header_t *pre = (obj_header_t *)cp - 1;
+
+ *cpp = cp->next;
+ cp->where = 0;
+ if (mem->scan_limit == cp)
+ mem->scan_limit = cp->next;
+ o_set_unmarked(pre);
+ } else
+ cpp = &(*cpp)->next;
}
}
@@ -573,7 +573,7 @@ alloc_save__filter_changes(gs_ref_memory_t *memory)
gs_ref_memory_t *mem = memory;
for (; mem; mem = &mem->saved->state)
- alloc_save__filter_changes_in_space(mem);
+ alloc_save__filter_changes_in_space(mem);
}
/* Return (the id of) the innermost externally visible save object, */
@@ -584,7 +584,7 @@ alloc_save_current_id(const gs_dual_memory_t * dmem)
const alloc_save_t *save = dmem->space_local->saved;
while (save != 0 && save->id == 0)
- save = save->state.saved;
+ save = save->state.saved;
return save->id;
}
alloc_save_t *
@@ -604,30 +604,30 @@ alloc_is_since_save(const void *vptr, const alloc_save_t * save)
register const gs_ref_memory_t *mem = save->space_local;
if_debug2('U', "[U]is_since_save 0x%lx, 0x%lx:\n",
- (ulong) ptr, (ulong) save);
+ (ulong) ptr, (ulong) save);
if (mem->saved == 0) { /* This is a special case, the final 'restore' from */
- /* alloc_restore_all. */
- return true;
+ /* alloc_restore_all. */
+ return true;
}
/* Check against chunks allocated since the save. */
/* (There may have been intermediate saves as well.) */
for (;; mem = &mem->saved->state) {
- const chunk_t *cp;
-
- if_debug1('U', "[U]checking mem=0x%lx\n", (ulong) mem);
- for (cp = mem->cfirst; cp != 0; cp = cp->cnext) {
- if (ptr_is_within_chunk(ptr, cp)) {
- if_debug3('U', "[U+]in new chunk 0x%lx: 0x%lx, 0x%lx\n",
- (ulong) cp,
- (ulong) cp->cbase, (ulong) cp->cend);
- return true;
- }
- if_debug1('U', "[U-]not in 0x%lx\n", (ulong) cp);
- }
- if (mem->saved == save) { /* We've checked all the more recent saves, */
- /* must be OK. */
- break;
- }
+ const chunk_t *cp;
+
+ if_debug1('U', "[U]checking mem=0x%lx\n", (ulong) mem);
+ for (cp = mem->cfirst; cp != 0; cp = cp->cnext) {
+ if (ptr_is_within_chunk(ptr, cp)) {
+ if_debug3('U', "[U+]in new chunk 0x%lx: 0x%lx, 0x%lx\n",
+ (ulong) cp,
+ (ulong) cp->cbase, (ulong) cp->cend);
+ return true;
+ }
+ if_debug1('U', "[U-]not in 0x%lx\n", (ulong) cp);
+ }
+ if (mem->saved == save) { /* We've checked all the more recent saves, */
+ /* must be OK. */
+ break;
+ }
}
/*
@@ -638,18 +638,18 @@ alloc_is_since_save(const void *vptr, const alloc_save_t * save)
* Global saves can't be nested, which makes things easy.
*/
if (save->state.save_level == 0 /* Restoring to save level 0 - see bug 688157, 688161 */ &&
- (mem = save->space_global) != save->space_local &&
- save->space_global->num_contexts == 1
- ) {
- const chunk_t *cp;
-
- if_debug1('U', "[U]checking global mem=0x%lx\n", (ulong) mem);
- for (cp = mem->cfirst; cp != 0; cp = cp->cnext)
- if (ptr_is_within_chunk(ptr, cp)) {
- if_debug3('U', "[U+] new chunk 0x%lx: 0x%lx, 0x%lx\n",
- (ulong) cp, (ulong) cp->cbase, (ulong) cp->cend);
- return true;
- }
+ (mem = save->space_global) != save->space_local &&
+ save->space_global->num_contexts == 1
+ ) {
+ const chunk_t *cp;
+
+ if_debug1('U', "[U]checking global mem=0x%lx\n", (ulong) mem);
+ for (cp = mem->cfirst; cp != 0; cp = cp->cnext)
+ if (ptr_is_within_chunk(ptr, cp)) {
+ if_debug3('U', "[U+] new chunk 0x%lx: 0x%lx, 0x%lx\n",
+ (ulong) cp, (ulong) cp->cbase, (ulong) cp->cend);
+ return true;
+ }
}
return false;
@@ -659,28 +659,28 @@ alloc_is_since_save(const void *vptr, const alloc_save_t * save)
/* Test whether a name would be invalidated by a restore. */
bool
alloc_name_is_since_save(const gs_memory_t *mem,
- const ref * pnref, const alloc_save_t * save)
+ const ref * pnref, const alloc_save_t * save)
{
const name_string_t *pnstr;
if (!save->restore_names)
- return false;
+ return false;
pnstr = names_string_inline(mem->gs_lib_ctx->gs_name_table, pnref);
if (pnstr->foreign_string)
- return false;
+ return false;
return alloc_is_since_save(pnstr->string_bytes, save);
}
bool
alloc_name_index_is_since_save(const gs_memory_t *mem,
- uint nidx, const alloc_save_t *save)
+ uint nidx, const alloc_save_t *save)
{
const name_string_t *pnstr;
if (!save->restore_names)
- return false;
+ return false;
pnstr = names_index_string_inline(mem->gs_lib_ctx->gs_name_table, nidx);
if (pnstr->foreign_string)
- return false;
+ return false;
return alloc_is_since_save(pnstr->string_bytes, save);
}
@@ -699,11 +699,11 @@ alloc_find_save(const gs_dual_memory_t * dmem, ulong sid)
alloc_save_t *sprev = dmem->space_local->saved;
if (sid == 0)
- return 0; /* invalid id */
+ return 0; /* invalid id */
while (sprev != 0) {
- if (sprev->id == sid)
- return sprev;
- sprev = sprev->state.saved;
+ if (sprev->id == sid)
+ return sprev;
+ sprev = sprev->state.saved;
}
return 0;
}
@@ -740,57 +740,57 @@ alloc_restore_step_in(gs_dual_memory_t *dmem, alloc_save_t * save)
/* Finalize all objects before releasing resources or undoing changes. */
do {
- ulong sid;
-
- sprev = mem->saved;
- sid = sprev->id;
- restore_finalize(mem); /* finalize objects */
- mem = &sprev->state;
- if (sid != 0)
- break;
+ ulong sid;
+
+ sprev = mem->saved;
+ sid = sprev->id;
+ restore_finalize(mem); /* finalize objects */
+ mem = &sprev->state;
+ if (sid != 0)
+ break;
}
while (sprev != save);
if (mem->save_level == 0) {
- /* This is the outermost save, which might also */
- /* need to restore global VM. */
- mem = gmem;
- if (mem != lmem && mem->saved != 0)
- restore_finalize(mem);
+ /* This is the outermost save, which might also */
+ /* need to restore global VM. */
+ mem = gmem;
+ if (mem != lmem && mem->saved != 0)
+ restore_finalize(mem);
}
/* Do one (externally visible) step of restoring the state. */
mem = lmem;
do {
- ulong sid;
-
- sprev = mem->saved;
- sid = sprev->id;
- code = restore_resources(sprev, mem); /* release other resources */
- if (code < 0)
- return code;
- restore_space(mem, dmem); /* release memory */
- if (sid != 0)
- break;
+ ulong sid;
+
+ sprev = mem->saved;
+ sid = sprev->id;
+ code = restore_resources(sprev, mem); /* release other resources */
+ if (code < 0)
+ return code;
+ restore_space(mem, dmem); /* release memory */
+ if (sid != 0)
+ break;
}
while (sprev != save);
if (mem->save_level == 0) {
- /* This is the outermost save, which might also */
- /* need to restore global VM. */
- mem = gmem;
- if (mem != lmem && mem->saved != 0) {
- code = restore_resources(mem->saved, mem);
- if (code < 0)
- return code;
- restore_space(mem, dmem);
- }
- alloc_set_not_in_save(dmem);
+ /* This is the outermost save, which might also */
+ /* need to restore global VM. */
+ mem = gmem;
+ if (mem != lmem && mem->saved != 0) {
+ code = restore_resources(mem->saved, mem);
+ if (code < 0)
+ return code;
+ restore_space(mem, dmem);
+ }
+ alloc_set_not_in_save(dmem);
} else { /* Set the l_new attribute in all slots that are now new. */
- ulong scanned;
+ ulong scanned;
- code = save_set_new(mem, true, false, &scanned);
- if (code < 0)
- return code;
+ code = save_set_new(mem, true, false, &scanned);
+ if (code < 0)
+ return code;
}
return sprev == save;
@@ -807,24 +807,24 @@ restore_space(gs_ref_memory_t * mem, gs_dual_memory_t *dmem)
/* Undo changes since the save. */
{
- register alloc_change_t *cp = mem->changes;
+ register alloc_change_t *cp = mem->changes;
- while (cp) {
+ while (cp) {
#ifdef DEBUG
- if (gs_debug_c('U')) {
- dlputs("[U]restore");
- alloc_save_print(cp, true);
- }
+ if (gs_debug_c('U')) {
+ dlputs("[U]restore");
+ alloc_save_print(cp, true);
+ }
#endif
- if (cp->offset == AC_OFFSET_ALLOCATED)
- DO_NOTHING;
- else
- if (r_is_packed(&cp->contents))
- *cp->where = *(ref_packed *) & cp->contents;
- else
- ref_assign_inline((ref *) cp->where, &cp->contents);
- cp = cp->next;
- }
+ if (cp->offset == AC_OFFSET_ALLOCATED)
+ DO_NOTHING;
+ else
+ if (r_is_packed(&cp->contents))
+ *cp->where = *(ref_packed *) & cp->contents;
+ else
+ ref_assign_inline((ref *) cp->where, &cp->contents);
+ cp = cp->next;
+ }
}
/* Free memory allocated since the save. */
@@ -835,17 +835,17 @@ restore_space(gs_ref_memory_t * mem, gs_dual_memory_t *dmem)
/* Restore the allocator state. */
{
- int num_contexts = mem->num_contexts; /* don't restore */
+ int num_contexts = mem->num_contexts; /* don't restore */
- *mem = saved.state;
- mem->num_contexts = num_contexts;
+ *mem = saved.state;
+ mem->num_contexts = num_contexts;
}
alloc_open_chunk(mem);
/* Make the allocator current if it was current before the save. */
if (saved.is_current) {
- dmem->current = mem;
- dmem->current_space = mem->space;
+ dmem->current = mem;
+ dmem->current_space = mem->space;
}
}
@@ -866,44 +866,44 @@ alloc_restore_all(gs_dual_memory_t * dmem)
/* Restore to a state outside any saves. */
while (lmem->save_level != 0) {
- code = alloc_restore_step_in(dmem, lmem->saved);
- if (code < 0)
- return code;
+ code = alloc_restore_step_in(dmem, lmem->saved);
+ if (code < 0)
+ return code;
}
/* Finalize memory. */
restore_finalize(lmem);
if ((mem = (gs_ref_memory_t *)lmem->stable_memory) != lmem)
- restore_finalize(mem);
+ restore_finalize(mem);
if (gmem != lmem && gmem->num_contexts == 1) {
- restore_finalize(gmem);
- if ((mem = (gs_ref_memory_t *)gmem->stable_memory) != gmem)
- restore_finalize(mem);
+ restore_finalize(gmem);
+ if ((mem = (gs_ref_memory_t *)gmem->stable_memory) != gmem)
+ restore_finalize(mem);
}
restore_finalize(smem);
/* Release resources other than memory, using fake */
/* save and memory objects. */
{
- alloc_save_t empty_save;
+ alloc_save_t empty_save;
- empty_save.spaces = dmem->spaces;
- empty_save.restore_names = false; /* don't bother to release */
- code = restore_resources(&empty_save, NULL);
- if (code < 0)
- return code;
+ empty_save.spaces = dmem->spaces;
+ empty_save.restore_names = false; /* don't bother to release */
+ code = restore_resources(&empty_save, NULL);
+ if (code < 0)
+ return code;
}
/* Finally, release memory. */
restore_free(lmem);
if ((mem = (gs_ref_memory_t *)lmem->stable_memory) != lmem)
- restore_free(mem);
+ restore_free(mem);
if (gmem != lmem) {
- if (!--(gmem->num_contexts)) {
- restore_free(gmem);
- if ((mem = (gs_ref_memory_t *)gmem->stable_memory) != gmem)
- restore_free(mem);
- }
+ if (!--(gmem->num_contexts)) {
+ restore_free(gmem);
+ if ((mem = (gs_ref_memory_t *)gmem->stable_memory) != gmem)
+ restore_free(mem);
+ }
}
restore_free(smem);
return 0;
@@ -922,17 +922,17 @@ restore_finalize(gs_ref_memory_t * mem)
alloc_close_chunk(mem);
gs_enable_free((gs_memory_t *) mem, false);
for (cp = mem->clast; cp != 0; cp = cp->cprev) {
- SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- struct_proc_finalize((*finalize)) =
- pre->o_type->finalize;
- if (finalize != 0) {
- if_debug2('u', "[u]restore finalizing %s 0x%lx\n",
- struct_type_name_string(pre->o_type),
- (ulong) (pre + 1));
- (*finalize) (pre + 1);
- }
- END_OBJECTS_SCAN
+ SCAN_CHUNK_OBJECTS(cp)
+ DO_ALL
+ struct_proc_finalize((*finalize)) =
+ pre->o_type->finalize;
+ if (finalize != 0) {
+ if_debug2('u', "[u]restore finalizing %s 0x%lx\n",
+ struct_type_name_string(pre->o_type),
+ (ulong) (pre + 1));
+ (*finalize) (pre + 1);
+ }
+ END_OBJECTS_SCAN
}
gs_enable_free((gs_memory_t *) mem, true);
}
@@ -944,21 +944,21 @@ restore_resources(alloc_save_t * sprev, gs_ref_memory_t * mem)
int code;
#ifdef DEBUG
if (mem) {
- /* Note restoring of the file list. */
- if_debug4('u', "[u%u]file_restore 0x%lx => 0x%lx for 0x%lx\n",
- mem->space, (ulong)mem->streams,
- (ulong)sprev->state.streams, (ulong) sprev);
+ /* Note restoring of the file list. */
+ if_debug4('u', "[u%u]file_restore 0x%lx => 0x%lx for 0x%lx\n",
+ mem->space, (ulong)mem->streams,
+ (ulong)sprev->state.streams, (ulong) sprev);
}
#endif
/* Remove entries from font and character caches. */
code = font_restore(sprev);
if (code < 0)
- return code;
+ return code;
/* Adjust the name table. */
if (sprev->restore_names)
- names_restore(mem->gs_lib_ctx->gs_name_table, sprev);
+ names_restore(mem->gs_lib_ctx->gs_name_table, sprev);
return 0;
}
@@ -986,46 +986,46 @@ alloc_forget_save_in(gs_dual_memory_t *dmem, alloc_save_t * save)
/* Iteratively combine the current level with the previous one. */
do {
- sprev = mem->saved;
- if (sprev->id != 0)
- mem->save_level--;
- if (mem->save_level != 0) {
- alloc_change_t *chp = mem->changes;
-
- code = save_set_new(&sprev->state, true, false, &scanned);
- if (code < 0)
- return code;
- /* Concatenate the changes chains. */
- if (chp == 0)
- mem->changes = sprev->state.changes;
- else {
- while (chp->next != 0)
- chp = chp->next;
- chp->next = sprev->state.changes;
- }
- file_forget_save(mem);
- combine_space(mem); /* combine memory */
- } else {
- forget_changes(mem);
- code = save_set_new(mem, false, false, &scanned);
- if (code < 0)
- return code;
- file_forget_save(mem);
- combine_space(mem); /* combine memory */
- /* This is the outermost save, which might also */
- /* need to combine global VM. */
- mem = save->space_global;
- if (mem != save->space_local && mem->saved != 0) {
- forget_changes(mem);
- code = save_set_new(mem, false, false, &scanned);
- if (code < 0)
- return code;
- file_forget_save(mem);
- combine_space(mem);
- }
- alloc_set_not_in_save(dmem);
- break; /* must be outermost */
- }
+ sprev = mem->saved;
+ if (sprev->id != 0)
+ mem->save_level--;
+ if (mem->save_level != 0) {
+ alloc_change_t *chp = mem->changes;
+
+ code = save_set_new(&sprev->state, true, false, &scanned);
+ if (code < 0)
+ return code;
+ /* Concatenate the changes chains. */
+ if (chp == 0)
+ mem->changes = sprev->state.changes;
+ else {
+ while (chp->next != 0)
+ chp = chp->next;
+ chp->next = sprev->state.changes;
+ }
+ file_forget_save(mem);
+ combine_space(mem); /* combine memory */
+ } else {
+ forget_changes(mem);
+ code = save_set_new(mem, false, false, &scanned);
+ if (code < 0)
+ return code;
+ file_forget_save(mem);
+ combine_space(mem); /* combine memory */
+ /* This is the outermost save, which might also */
+ /* need to combine global VM. */
+ mem = save->space_global;
+ if (mem != save->space_local && mem->saved != 0) {
+ forget_changes(mem);
+ code = save_set_new(mem, false, false, &scanned);
+ if (code < 0)
+ return code;
+ file_forget_save(mem);
+ combine_space(mem);
+ }
+ alloc_set_not_in_save(dmem);
+ break; /* must be outermost */
+ }
}
while (sprev != save);
return 0;
@@ -1042,42 +1042,42 @@ combine_space(gs_ref_memory_t * mem)
alloc_close_chunk(mem);
for (cp = mem->cfirst; cp != 0; cp = csucc) {
- csucc = cp->cnext; /* save before relinking */
- if (cp->outer == 0)
- alloc_link_chunk(cp, omem);
- else {
- chunk_t *outer = cp->outer;
-
- outer->inner_count--;
- if (mem->pcc == cp)
- mem->pcc = outer;
- if (mem->cfreed.cp == cp)
- mem->cfreed.cp = outer;
- /* "Free" the header of the inner chunk, */
- /* and any immediately preceding gap left by */
- /* the GC having compacted the outer chunk. */
- {
- obj_header_t *hp = (obj_header_t *) outer->cbot;
-
- hp->o_alone = 0;
- hp->o_size = (char *)(cp->chead + 1)
- - (char *)(hp + 1);
- hp->o_type = &st_bytes;
- /* The following call is probably not safe. */
+ csucc = cp->cnext; /* save before relinking */
+ if (cp->outer == 0)
+ alloc_link_chunk(cp, omem);
+ else {
+ chunk_t *outer = cp->outer;
+
+ outer->inner_count--;
+ if (mem->pcc == cp)
+ mem->pcc = outer;
+ if (mem->cfreed.cp == cp)
+ mem->cfreed.cp = outer;
+ /* "Free" the header of the inner chunk, */
+ /* and any immediately preceding gap left by */
+ /* the GC having compacted the outer chunk. */
+ {
+ obj_header_t *hp = (obj_header_t *) outer->cbot;
+
+ hp->o_alone = 0;
+ hp->o_size = (char *)(cp->chead + 1)
+ - (char *)(hp + 1);
+ hp->o_type = &st_bytes;
+ /* The following call is probably not safe. */
#if 0 /* **************** */
- gs_free_object((gs_memory_t *) mem,
- hp + 1, "combine_space(header)");
+ gs_free_object((gs_memory_t *) mem,
+ hp + 1, "combine_space(header)");
#endif /* **************** */
- }
- /* Update the outer chunk's allocation pointers. */
- outer->cbot = cp->cbot;
- outer->rcur = cp->rcur;
- outer->rtop = cp->rtop;
- outer->ctop = cp->ctop;
- outer->has_refs |= cp->has_refs;
- gs_free_object(mem->non_gc_memory, cp,
- "combine_space(inner)");
- }
+ }
+ /* Update the outer chunk's allocation pointers. */
+ outer->cbot = cp->cbot;
+ outer->rcur = cp->rcur;
+ outer->rtop = cp->rtop;
+ outer->ctop = cp->ctop;
+ outer->has_refs |= cp->has_refs;
+ gs_free_object(mem->non_gc_memory, cp,
+ "combine_space(inner)");
+ }
}
/* Update relevant parts of allocator state. */
mem->cfirst = omem->cfirst;
@@ -1090,23 +1090,23 @@ combine_space(gs_ref_memory_t * mem)
mem->saved = omem->saved;
mem->previous_status = omem->previous_status;
{ /* Concatenate free lists. */
- int i;
-
- for (i = 0; i < num_freelists; i++) {
- obj_header_t *olist = omem->freelists[i];
- obj_header_t *list = mem->freelists[i];
-
- if (olist == 0);
- else if (list == 0)
- mem->freelists[i] = olist;
- else {
- while (*(obj_header_t **) list != 0)
- list = *(obj_header_t **) list;
- *(obj_header_t **) list = olist;
- }
- }
- if (omem->largest_free_size > mem->largest_free_size)
- mem->largest_free_size = omem->largest_free_size;
+ int i;
+
+ for (i = 0; i < num_freelists; i++) {
+ obj_header_t *olist = omem->freelists[i];
+ obj_header_t *list = mem->freelists[i];
+
+ if (olist == 0);
+ else if (list == 0)
+ mem->freelists[i] = olist;
+ else {
+ while (*(obj_header_t **) list != 0)
+ list = *(obj_header_t **) list;
+ *(obj_header_t **) list = olist;
+ }
+ }
+ if (omem->largest_free_size > mem->largest_free_size)
+ mem->largest_free_size = omem->largest_free_size;
}
gs_free_object((gs_memory_t *) mem, saved, "combine_space(saved)");
alloc_open_chunk(mem);
@@ -1120,16 +1120,16 @@ forget_changes(gs_ref_memory_t * mem)
alloc_change_t *next;
for (; chp; chp = next) {
- ref_packed *prp = chp->where;
-
- if_debug1('U', "[U]forgetting change 0x%lx\n", (ulong) chp);
- if (chp->offset == AC_OFFSET_ALLOCATED)
- DO_NOTHING;
- else
- if (!r_is_packed(prp))
- r_clear_attrs((ref *) prp, l_new);
- next = chp->next;
- gs_free_object((gs_memory_t *) mem, chp, "forget_changes");
+ ref_packed *prp = chp->where;
+
+ if_debug1('U', "[U]forgetting change 0x%lx\n", (ulong) chp);
+ if (chp->offset == AC_OFFSET_ALLOCATED)
+ DO_NOTHING;
+ else
+ if (!r_is_packed(prp))
+ r_clear_attrs((ref *) prp, l_new);
+ next = chp->next;
+ gs_free_object((gs_memory_t *) mem, chp, "forget_changes");
}
mem->changes = 0;
}
@@ -1142,61 +1142,61 @@ file_forget_save(gs_ref_memory_t * mem)
stream *saved_streams = save->state.streams;
if_debug4('u', "[u%d]file_forget_save 0x%lx + 0x%lx for 0x%lx\n",
- mem->space, (ulong) streams, (ulong) saved_streams,
- (ulong) save);
+ mem->space, (ulong) streams, (ulong) saved_streams,
+ (ulong) save);
if (streams == 0)
- mem->streams = saved_streams;
+ mem->streams = saved_streams;
else if (saved_streams != 0) {
- while (streams->next != 0)
- streams = streams->next;
- streams->next = saved_streams;
- saved_streams->prev = streams;
+ while (streams->next != 0)
+ streams = streams->next;
+ streams->next = saved_streams;
+ saved_streams->prev = streams;
}
}
static inline int
mark_allocated(void *obj, bool to_new, uint *psize)
-{
+{
obj_header_t *pre = (obj_header_t *)obj - 1;
uint size = pre_obj_contents_size(pre);
ref_packed *prp = (ref_packed *) (pre + 1);
ref_packed *next = (ref_packed *) ((char *)prp + size);
#ifdef ALIGNMENT_ALIASING_BUG
- ref *rpref;
+ ref *rpref;
# define RP_REF(rp) (rpref = (ref *)rp, rpref)
#else
# define RP_REF(rp) ((ref *)rp)
#endif
if (pre->o_type != &st_refs) {
- /* Must not happen. */
- if_debug0('u', "Wrong object type when expected a ref.\n");
- return_error(e_Fatal);
+ /* Must not happen. */
+ if_debug0('u', "Wrong object type when expected a ref.\n");
+ return_error(e_Fatal);
}
/* We know that every block of refs ends with */
/* a full-size ref, so we only need the end check */
/* when we encounter one of those. */
if (to_new)
- while (1) {
- if (r_is_packed(prp))
- prp++;
- else {
- RP_REF(prp)->tas.type_attrs |= l_new;
- prp += packed_per_ref;
- if (prp >= next)
- break;
- }
+ while (1) {
+ if (r_is_packed(prp))
+ prp++;
+ else {
+ RP_REF(prp)->tas.type_attrs |= l_new;
+ prp += packed_per_ref;
+ if (prp >= next)
+ break;
+ }
} else
- while (1) {
- if (r_is_packed(prp))
- prp++;
- else {
- RP_REF(prp)->tas.type_attrs &= ~l_new;
- prp += packed_per_ref;
- if (prp >= next)
- break;
- }
- }
+ while (1) {
+ if (r_is_packed(prp))
+ prp++;
+ else {
+ RP_REF(prp)->tas.type_attrs &= ~l_new;
+ prp += packed_per_ref;
+ if (prp >= next)
+ break;
+ }
+ }
#undef RP_REF
*psize = size;
return 0;
@@ -1205,13 +1205,13 @@ mark_allocated(void *obj, bool to_new, uint *psize)
/* Check if a block contains refs marked by garbager. */
static bool
check_l_mark(void *obj)
-{
+{
obj_header_t *pre = (obj_header_t *)obj - 1;
uint size = pre_obj_contents_size(pre);
ref_packed *prp = (ref_packed *) (pre + 1);
ref_packed *next = (ref_packed *) ((char *)prp + size);
#ifdef ALIGNMENT_ALIASING_BUG
- ref *rpref;
+ ref *rpref;
# define RP_REF(rp) (rpref = (ref *)rp, rpref)
#else
# define RP_REF(rp) ((ref *)rp)
@@ -1221,17 +1221,17 @@ check_l_mark(void *obj)
/* a full-size ref, so we only need the end check */
/* when we encounter one of those. */
while (1) {
- if (r_is_packed(prp)) {
- if (r_has_pmark(prp))
- return true;
- prp++;
- } else {
- if (r_has_attr(RP_REF(prp), l_mark))
- return true;
- prp += packed_per_ref;
- if (prp >= next)
- return false;
- }
+ if (r_is_packed(prp)) {
+ if (r_has_pmark(prp))
+ return true;
+ prp++;
+ } else {
+ if (r_has_attr(RP_REF(prp), l_mark))
+ return true;
+ prp += packed_per_ref;
+ if (prp >= next)
+ return false;
+ }
}
#undef RP_REF
}
@@ -1249,35 +1249,35 @@ save_set_new(gs_ref_memory_t * mem, bool to_new, bool set_limit, ulong *pscanned
/* Handle the change chain. */
code = save_set_new_changes(mem, to_new, set_limit);
if (code < 0)
- return code;
+ return code;
/* Handle newly allocated ref objects. */
SCAN_MEM_CHUNKS(mem, cp) {
- if (cp->has_refs) {
- bool has_refs = false;
-
- SCAN_CHUNK_OBJECTS(cp)
- DO_ALL
- if_debug3('U', "[U]set_new scan(0x%lx(%u), %d)\n",
- (ulong) pre, size, to_new);
- if (pre->o_type == &st_refs) {
- /* These are refs, scan them. */
- ref_packed *prp = (ref_packed *) (pre + 1);
- uint size;
-
- code = mark_allocated(prp, to_new, &size);
- if (code < 0)
- return code;
- scanned += size;
- } else
- scanned += sizeof(obj_header_t);
- END_OBJECTS_SCAN
- cp->has_refs = has_refs;
- }
+ if (cp->has_refs) {
+ bool has_refs = false;
+
+ SCAN_CHUNK_OBJECTS(cp)
+ DO_ALL
+ if_debug3('U', "[U]set_new scan(0x%lx(%u), %d)\n",
+ (ulong) pre, size, to_new);
+ if (pre->o_type == &st_refs) {
+ /* These are refs, scan them. */
+ ref_packed *prp = (ref_packed *) (pre + 1);
+ uint size;
+
+ code = mark_allocated(prp, to_new, &size);
+ if (code < 0)
+ return code;
+ scanned += size;
+ } else
+ scanned += sizeof(obj_header_t);
+ END_OBJECTS_SCAN
+ cp->has_refs = has_refs;
+ }
}
END_CHUNKS_SCAN
- if_debug2('u', "[u]set_new (%s) scanned %ld\n",
- (to_new ? "restore" : "save"), scanned);
+ if_debug2('u', "[u]set_new (%s) scanned %ld\n",
+ (to_new ? "restore" : "save"), scanned);
*pscanned = scanned;
return 0;
}
@@ -1290,48 +1290,47 @@ drop_redundant_changes(gs_ref_memory_t * mem)
/* First reverse the list and set all. */
for (; chp; chp = chp_forth) {
- chp_forth = chp->next;
- if (chp->offset != AC_OFFSET_ALLOCATED) {
- ref_packed *prp = chp->where;
-
- if (!r_is_packed(prp)) {
- ref *const rp = (ref *)prp;
-
- rp->tas.type_attrs |= l_new;
- }
- }
- chp->next = chp_back;
- chp_back = chp;
+ chp_forth = chp->next;
+ if (chp->offset != AC_OFFSET_ALLOCATED) {
+ ref_packed *prp = chp->where;
+
+ if (!r_is_packed(prp)) {
+ ref *const rp = (ref *)prp;
+
+ rp->tas.type_attrs |= l_new;
+ }
+ }
+ chp->next = chp_back;
+ chp_back = chp;
}
mem->changes = chp_back;
chp_back = NULL;
/* Then filter, reset and reverse again. */
for (chp = mem->changes; chp; chp = chp_forth) {
- chp_forth = chp->next;
- if (chp->offset != AC_OFFSET_ALLOCATED) {
- ref_packed *prp = chp->where;
-
- if (!r_is_packed(prp)) {
- ref *const rp = (ref *)prp;
-
- if ((rp->tas.type_attrs & l_new) == 0) {
- if (mem->scan_limit == chp)
- mem->scan_limit = chp_back;
- if (mem->changes == chp)
- mem->changes = chp_back;
- gs_free_object((gs_memory_t *)mem, chp, "alloc_save_remove");
- continue;
- } else
- rp->tas.type_attrs &= ~l_new;
- }
- }
- chp->next = chp_back;
- chp_back = chp;
+ chp_forth = chp->next;
+ if (chp->offset != AC_OFFSET_ALLOCATED) {
+ ref_packed *prp = chp->where;
+
+ if (!r_is_packed(prp)) {
+ ref *const rp = (ref *)prp;
+
+ if ((rp->tas.type_attrs & l_new) == 0) {
+ if (mem->scan_limit == chp)
+ mem->scan_limit = chp_back;
+ if (mem->changes == chp)
+ mem->changes = chp_back;
+ gs_free_object((gs_memory_t *)mem, chp, "alloc_save_remove");
+ continue;
+ } else
+ rp->tas.type_attrs &= ~l_new;
+ }
+ }
+ chp->next = chp_back;
+ chp_back = chp;
}
mem->changes = chp_back;
}
-
/* Set or reset the l_new attribute on the changes chain. */
static int
save_set_new_changes(gs_ref_memory_t * mem, bool to_new, bool set_limit)
@@ -1341,41 +1340,41 @@ save_set_new_changes(gs_ref_memory_t * mem, bool to_new, bool set_limit)
ulong scanned = 0;
if (!to_new && mem->total_scanned_after_compacting > max_repeated_scan * 16) {
- mem->total_scanned_after_compacting = 0;
- drop_redundant_changes(mem);
- }
+ mem->total_scanned_after_compacting = 0;
+ drop_redundant_changes(mem);
+ }
for (chp = mem->changes; chp; chp = chp->next) {
- if (chp->offset == AC_OFFSET_ALLOCATED) {
- if (chp->where != 0) {
- uint size;
- int code = mark_allocated((void *)chp->where, to_new, &size);
-
- if (code < 0)
- return code;
- scanned += size;
- }
- } else {
- ref_packed *prp = chp->where;
-
- if_debug3('U', "[U]set_new 0x%lx: (0x%lx, %d)\n",
- (ulong)chp, (ulong)prp, new);
- if (!r_is_packed(prp)) {
- ref *const rp = (ref *) prp;
-
- rp->tas.type_attrs =
- (rp->tas.type_attrs & ~l_new) + new;
- }
- }
- if (mem->scan_limit == chp)
- break;
+ if (chp->offset == AC_OFFSET_ALLOCATED) {
+ if (chp->where != 0) {
+ uint size;
+ int code = mark_allocated((void *)chp->where, to_new, &size);
+
+ if (code < 0)
+ return code;
+ scanned += size;
+ }
+ } else {
+ ref_packed *prp = chp->where;
+
+ if_debug3('U', "[U]set_new 0x%lx: (0x%lx, %d)\n",
+ (ulong)chp, (ulong)prp, new);
+ if (!r_is_packed(prp)) {
+ ref *const rp = (ref *) prp;
+
+ rp->tas.type_attrs =
+ (rp->tas.type_attrs & ~l_new) + new;
+ }
+ }
+ if (mem->scan_limit == chp)
+ break;
}
if (set_limit) {
mem->total_scanned_after_compacting += scanned;
- if (scanned + mem->total_scanned >= max_repeated_scan) {
- mem->scan_limit = mem->changes;
- mem->total_scanned = 0;
- } else
- mem->total_scanned += scanned;
+ if (scanned + mem->total_scanned >= max_repeated_scan) {
+ mem->scan_limit = mem->changes;
+ mem->total_scanned = 0;
+ } else
+ mem->total_scanned += scanned;
}
return 0;
}
diff --git a/gs/psi/isave.h b/gs/psi/isave.h
index 1007f238f..a889cd129 100644
--- a/gs/psi/isave.h
+++ b/gs/psi/isave.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -120,5 +120,4 @@ int font_restore(const alloc_save_t * save);
express purpose of getting the library context. */
gs_memory_t *gs_save_any_memory(const alloc_save_t *save);
-
#endif /* isave_INCLUDED */
diff --git a/gs/psi/iscanbin.c b/gs/psi/iscanbin.c
index 132781edb..ab71f21bb 100644
--- a/gs/psi/iscanbin.c
+++ b/gs/psi/iscanbin.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -159,21 +159,21 @@ scan_binary_token(i_ctx_t *i_ctx_p, ref *pref, scanner_state *pstate)
pbs->token_type = btype = *p;
wanted = bin_token_bytes[btype - MIN_BIN_TOKEN_TYPE] - 1;
if (rlimit - p < wanted) {
- s_end_inline(s, p - 1, rlimit);
- pstate->s_scan_type = scanning_none;
- code = scan_Refill;
+ s_end_inline(s, p - 1, rlimit);
+ pstate->s_scan_type = scanning_none;
+ code = scan_Refill;
} else {
- pbs->num_format = bin_token_num_formats[btype - MIN_BIN_TOKEN_TYPE];
- if (BT_IS_SEQ(btype))
- code = scan_bos(i_ctx_p, pref, pstate);
- else
- code = scan_bin_scalar(i_ctx_p, pref, pstate);
+ pbs->num_format = bin_token_num_formats[btype - MIN_BIN_TOKEN_TYPE];
+ if (BT_IS_SEQ(btype))
+ code = scan_bos(i_ctx_p, pref, pstate);
+ else
+ code = scan_bin_scalar(i_ctx_p, pref, pstate);
}
if (code == scan_Refill && s->end_status == EOFC)
- code = gs_note_error(e_syntaxerror);
+ code = gs_note_error(e_syntaxerror);
if (code < 0 && pstate->s_error.string[0] == 0)
- snprintf(pstate->s_error.string, sizeof(pstate->s_error.string),
- "binary token, type=%d", btype);
+ snprintf(pstate->s_error.string, sizeof(pstate->s_error.string),
+ "binary token, type=%d", btype);
return code;
}
@@ -189,86 +189,86 @@ scan_bos(i_ctx_t *i_ctx_p, ref *pref, scanner_state *pstate)
s_begin_inline(s, p, rlimit);
{
- uint rcnt = rlimit - p;
- uint top_size = p[1];
- uint hsize, size;
-
- if (top_size == 0) {
- /* Extended header (2-byte array size, 4-byte length) */
- uint lsize;
-
- if (rcnt < 7) {
- s_end_inline(s, p - 1, rlimit);
- pstate->s_scan_type = scanning_none;
- return scan_Refill;
- }
- pbs->top_size = top_size = sdecodeushort(p + 2, num_format);
- pbs->lsize = lsize = sdecodeint32(p + 4, num_format);
- if ((size = lsize) != lsize) {
- scan_bos_error(pstate, "bin obj seq length too large");
- return_error(e_limitcheck);
- }
- hsize = 8;
- } else {
- /* Normal header (1-byte array size, 2-byte length). */
- /* We already checked rcnt >= 3. */
- pbs->top_size = top_size;
- pbs->lsize = size = sdecodeushort(p + 2, num_format);
- hsize = 4;
- }
- if (size < hsize || (size - hsize) >> 3 < top_size) {
- scan_bos_error(pstate, "sequence too short");
- return_error(e_syntaxerror); /* size too small */
- }
+ uint rcnt = rlimit - p;
+ uint top_size = p[1];
+ uint hsize, size;
+
+ if (top_size == 0) {
+ /* Extended header (2-byte array size, 4-byte length) */
+ uint lsize;
+
+ if (rcnt < 7) {
+ s_end_inline(s, p - 1, rlimit);
+ pstate->s_scan_type = scanning_none;
+ return scan_Refill;
+ }
+ pbs->top_size = top_size = sdecodeushort(p + 2, num_format);
+ pbs->lsize = lsize = sdecodeint32(p + 4, num_format);
+ if ((size = lsize) != lsize) {
+ scan_bos_error(pstate, "bin obj seq length too large");
+ return_error(e_limitcheck);
+ }
+ hsize = 8;
+ } else {
+ /* Normal header (1-byte array size, 2-byte length). */
+ /* We already checked rcnt >= 3. */
+ pbs->top_size = top_size;
+ pbs->lsize = size = sdecodeushort(p + 2, num_format);
+ hsize = 4;
+ }
+ if (size < hsize || (size - hsize) >> 3 < top_size) {
+ scan_bos_error(pstate, "sequence too short");
+ return_error(e_syntaxerror); /* size too small */
+ }
{ /* Preliminary syntax check to avoid potentialy large
* memory allocation on junk data. Bug 688833
*/
const unsigned char *q, *rend = p + hsize + top_size*8;
if (rend > rlimit)
- rend = rlimit;
+ rend = rlimit;
for (q = p + hsize + 1; q < rend; q += 8) {
int c = q[-1] & 0x7f;
if (c > 10 && c != BS_TYPE_DICTIONARY) {
- scan_bos_error(pstate, "invalid object type");
- return_error(e_syntaxerror);
+ scan_bos_error(pstate, "invalid object type");
+ return_error(e_syntaxerror);
}
if (*q != 0) {
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
}
}
}
- /*
- * Preallocate an array large enough for the worst case,
- * namely, all objects and no strings. Note that we must
- * divide size by 8, not sizeof(ref), since array elements
- * in binary tokens always occupy 8 bytes regardless of the
- * size of a ref.
- */
- code = ialloc_ref_array(&pbs->bin_array,
- a_all + a_executable, size / 8,
- "binary object sequence(objects)");
- if (code < 0)
- return code;
- p += hsize - 1;
- size -= hsize;
- s_end_inline(s, p, rlimit);
- pbs->max_array_index = pbs->top_size = top_size;
- pbs->min_string_index = pbs->size = size;
- pbs->index = 0;
- pstate->s_da.is_dynamic = false;
- pstate->s_da.base = pstate->s_da.next =
- pstate->s_da.limit = pstate->s_da.buf;
- code = scan_bos_continue(i_ctx_p, pref, pstate);
- if (code == scan_Refill || code < 0) {
- /* Clean up array for GC. */
- uint index = pbs->index;
-
- refset_null(pbs->bin_array.value.refs + index,
- r_size(&pbs->bin_array) - index);
- }
- return code;
+ /*
+ * Preallocate an array large enough for the worst case,
+ * namely, all objects and no strings. Note that we must
+ * divide size by 8, not sizeof(ref), since array elements
+ * in binary tokens always occupy 8 bytes regardless of the
+ * size of a ref.
+ */
+ code = ialloc_ref_array(&pbs->bin_array,
+ a_all + a_executable, size / 8,
+ "binary object sequence(objects)");
+ if (code < 0)
+ return code;
+ p += hsize - 1;
+ size -= hsize;
+ s_end_inline(s, p, rlimit);
+ pbs->max_array_index = pbs->top_size = top_size;
+ pbs->min_string_index = pbs->size = size;
+ pbs->index = 0;
+ pstate->s_da.is_dynamic = false;
+ pstate->s_da.base = pstate->s_da.next =
+ pstate->s_da.limit = pstate->s_da.buf;
+ code = scan_bos_continue(i_ctx_p, pref, pstate);
+ if (code == scan_Refill || code < 0) {
+ /* Clean up array for GC. */
+ uint index = pbs->index;
+
+ refset_null(pbs->bin_array.value.refs + index,
+ r_size(&pbs->bin_array) - index);
+ }
+ return code;
}
}
@@ -277,10 +277,10 @@ static void
scan_bos_error(scanner_state *pstate, const char *msg)
{
snprintf(pstate->s_error.string, sizeof(pstate->s_error.string),
- "bin obj seq, type=%d, elements=%u, size=%lu, %s",
- pstate->s_ss.binary.token_type,
- pstate->s_ss.binary.top_size,
- pstate->s_ss.binary.lsize, msg);
+ "bin obj seq, type=%d, elements=%u, size=%lu, %s",
+ pstate->s_ss.binary.token_type,
+ pstate->s_ss.binary.top_size,
+ pstate->s_ss.binary.lsize, msg);
}
/* Scan a non-sequence binary token. */
@@ -296,131 +296,131 @@ scan_bin_scalar(i_ctx_t *i_ctx_p, ref *pref, scanner_state *pstate)
s_begin_inline(s, p, rlimit);
wanted = bin_token_bytes[*p - MIN_BIN_TOKEN_TYPE] - 1;
switch (*p) {
- case BT_INT8:
- make_int(pref, (p[1] ^ 128) - 128);
- s_end_inline(s, p + 1, rlimit);
- return 0;
- case BT_FIXED:
- num_format = p[1];
- if (!num_is_valid(num_format))
- return_error(e_syntaxerror);
- wanted = 1 + encoded_number_bytes(num_format);
- if (rlimit - p < wanted) {
- s_end_inline(s, p - 1, rlimit);
- pstate->s_scan_type = scanning_none;
- return scan_Refill;
- }
- code = sdecode_number(p + 2, num_format, pref);
- goto rnum;
- case BT_INT32_MSB:
- case BT_INT32_LSB:
- case BT_INT16_MSB:
- case BT_INT16_LSB:
- case BT_FLOAT_IEEE_MSB:
- case BT_FLOAT_IEEE_LSB:
- case BT_FLOAT_NATIVE:
- code = sdecode_number(p + 1, num_format, pref);
- rnum:
- switch (code) {
- case t_integer:
- case t_real:
- r_set_type(pref, code);
- break;
- case t_null:
- return_error(e_syntaxerror);
- default:
- return code;
- }
- s_end_inline(s, p + wanted, rlimit);
- return 0;
- case BT_BOOLEAN:
- arg = p[1];
- if (arg & ~1)
- return_error(e_syntaxerror);
- make_bool(pref, arg);
- s_end_inline(s, p + 1, rlimit);
- return 0;
- case BT_STRING_256:
- arg = *++p;
- goto str;
- case BT_STRING_64K_MSB:
- case BT_STRING_64K_LSB:
- arg = sdecodeushort(p + 1, num_format);
- p += 2;
- str:
- if (s->foreign && rlimit - p >= arg) {
- /*
- * Reference the string directly in the buffer. It is
- * marked writable for consistency with the non-direct
- * case, but since the "buffer" may be data compiled into
- * the executable, it is probably actually read-only.
- */
- s_end_inline(s, p, rlimit);
- make_const_string(pref, a_all | avm_foreign, arg, sbufptr(s));
- sbufskip(s, arg);
- return 0;
- } else {
- byte *str = ialloc_string(arg, "string token");
-
- if (str == 0)
- return_error(e_VMerror);
- s_end_inline(s, p, rlimit);
- pstate->s_da.base = pstate->s_da.next = str;
- pstate->s_da.limit = str + arg;
- code = scan_bin_string_continue(i_ctx_p, pref, pstate);
- if (code == scan_Refill || code < 0) {
- pstate->s_da.is_dynamic = true;
- make_null(&pbs->bin_array); /* clean up for GC */
- pbs->cont = scan_bin_string_continue;
- }
- return code;
- }
- case BT_LITNAME_SYSTEM:
- code = scan_bin_get_name(pstate, imemory, system_names_p, p[1],
- pref, "system");
- goto lname;
- case BT_EXECNAME_SYSTEM:
- code = scan_bin_get_name(pstate, imemory, system_names_p, p[1],
- pref, "system");
- goto xname;
- case BT_LITNAME_USER:
- code = scan_bin_get_name(pstate, imemory, user_names_p, p[1],
- pref, "user");
- lname:
- if (code < 0)
- return code;
- s_end_inline(s, p + 1, rlimit);
- return 0;
- case BT_EXECNAME_USER:
- code = scan_bin_get_name(pstate, imemory, user_names_p, p[1],
- pref, "user");
- xname:
- if (code < 0)
- return code;
- r_set_attrs(pref, a_executable);
- s_end_inline(s, p + 1, rlimit);
- return 0;
- case BT_NUM_ARRAY:
- num_format = p[1];
- if (!num_is_valid(num_format))
- return_error(e_syntaxerror);
- arg = sdecodeushort(p + 2, num_format);
- code = ialloc_ref_array(&pbs->bin_array, a_all, arg,
- "number array token");
- if (code < 0)
- return code;
- pbs->num_format = num_format;
- pbs->index = 0;
- p += 3;
- s_end_inline(s, p, rlimit);
- code = scan_bin_num_array_continue(i_ctx_p, pref, pstate);
- if (code == scan_Refill || code < 0) {
- /* Make sure the array is clean for the GC. */
- refset_null(pbs->bin_array.value.refs + pbs->index,
- arg - pbs->index);
- pbs->cont = scan_bin_num_array_continue;
- }
- return code;
+ case BT_INT8:
+ make_int(pref, (p[1] ^ 128) - 128);
+ s_end_inline(s, p + 1, rlimit);
+ return 0;
+ case BT_FIXED:
+ num_format = p[1];
+ if (!num_is_valid(num_format))
+ return_error(e_syntaxerror);
+ wanted = 1 + encoded_number_bytes(num_format);
+ if (rlimit - p < wanted) {
+ s_end_inline(s, p - 1, rlimit);
+ pstate->s_scan_type = scanning_none;
+ return scan_Refill;
+ }
+ code = sdecode_number(p + 2, num_format, pref);
+ goto rnum;
+ case BT_INT32_MSB:
+ case BT_INT32_LSB:
+ case BT_INT16_MSB:
+ case BT_INT16_LSB:
+ case BT_FLOAT_IEEE_MSB:
+ case BT_FLOAT_IEEE_LSB:
+ case BT_FLOAT_NATIVE:
+ code = sdecode_number(p + 1, num_format, pref);
+ rnum:
+ switch (code) {
+ case t_integer:
+ case t_real:
+ r_set_type(pref, code);
+ break;
+ case t_null:
+ return_error(e_syntaxerror);
+ default:
+ return code;
+ }
+ s_end_inline(s, p + wanted, rlimit);
+ return 0;
+ case BT_BOOLEAN:
+ arg = p[1];
+ if (arg & ~1)
+ return_error(e_syntaxerror);
+ make_bool(pref, arg);
+ s_end_inline(s, p + 1, rlimit);
+ return 0;
+ case BT_STRING_256:
+ arg = *++p;
+ goto str;
+ case BT_STRING_64K_MSB:
+ case BT_STRING_64K_LSB:
+ arg = sdecodeushort(p + 1, num_format);
+ p += 2;
+ str:
+ if (s->foreign && rlimit - p >= arg) {
+ /*
+ * Reference the string directly in the buffer. It is
+ * marked writable for consistency with the non-direct
+ * case, but since the "buffer" may be data compiled into
+ * the executable, it is probably actually read-only.
+ */
+ s_end_inline(s, p, rlimit);
+ make_const_string(pref, a_all | avm_foreign, arg, sbufptr(s));
+ sbufskip(s, arg);
+ return 0;
+ } else {
+ byte *str = ialloc_string(arg, "string token");
+
+ if (str == 0)
+ return_error(e_VMerror);
+ s_end_inline(s, p, rlimit);
+ pstate->s_da.base = pstate->s_da.next = str;
+ pstate->s_da.limit = str + arg;
+ code = scan_bin_string_continue(i_ctx_p, pref, pstate);
+ if (code == scan_Refill || code < 0) {
+ pstate->s_da.is_dynamic = true;
+ make_null(&pbs->bin_array); /* clean up for GC */
+ pbs->cont = scan_bin_string_continue;
+ }
+ return code;
+ }
+ case BT_LITNAME_SYSTEM:
+ code = scan_bin_get_name(pstate, imemory, system_names_p, p[1],
+ pref, "system");
+ goto lname;
+ case BT_EXECNAME_SYSTEM:
+ code = scan_bin_get_name(pstate, imemory, system_names_p, p[1],
+ pref, "system");
+ goto xname;
+ case BT_LITNAME_USER:
+ code = scan_bin_get_name(pstate, imemory, user_names_p, p[1],
+ pref, "user");
+ lname:
+ if (code < 0)
+ return code;
+ s_end_inline(s, p + 1, rlimit);
+ return 0;
+ case BT_EXECNAME_USER:
+ code = scan_bin_get_name(pstate, imemory, user_names_p, p[1],
+ pref, "user");
+ xname:
+ if (code < 0)
+ return code;
+ r_set_attrs(pref, a_executable);
+ s_end_inline(s, p + 1, rlimit);
+ return 0;
+ case BT_NUM_ARRAY:
+ num_format = p[1];
+ if (!num_is_valid(num_format))
+ return_error(e_syntaxerror);
+ arg = sdecodeushort(p + 2, num_format);
+ code = ialloc_ref_array(&pbs->bin_array, a_all, arg,
+ "number array token");
+ if (code < 0)
+ return code;
+ pbs->num_format = num_format;
+ pbs->index = 0;
+ p += 3;
+ s_end_inline(s, p, rlimit);
+ code = scan_bin_num_array_continue(i_ctx_p, pref, pstate);
+ if (code == scan_Refill || code < 0) {
+ /* Make sure the array is clean for the GC. */
+ refset_null(pbs->bin_array.value.refs + pbs->index,
+ arg - pbs->index);
+ pbs->cont = scan_bin_num_array_continue;
+ }
+ return code;
}
return_error(e_syntaxerror);
}
@@ -428,17 +428,17 @@ scan_bin_scalar(i_ctx_t *i_ctx_p, ref *pref, scanner_state *pstate)
/* Get a system or user name. */
static int
scan_bin_get_name(scanner_state *pstate, const gs_memory_t *mem,
- const ref *pnames /*t_array*/, int index, ref *pref,
- const char *usstring)
+ const ref *pnames /*t_array*/, int index, ref *pref,
+ const char *usstring)
{
/* Convert all errors to e_undefined to match Adobe. */
if (pnames == 0 || array_get(mem, pnames, (long)index, pref) < 0 ||
- !r_has_type(pref, t_name)) {
- snprintf(pstate->s_error.string,
- sizeof(pstate->s_error.string),
- "%s%d", usstring, index);
- pstate->s_error.is_name = true;
- return_error(e_undefined);
+ !r_has_type(pref, t_name)) {
+ snprintf(pstate->s_error.string,
+ sizeof(pstate->s_error.string),
+ "%s%d", usstring, index);
+ pstate->s_error.is_name = true;
+ return_error(e_undefined);
}
return 0;
}
@@ -458,11 +458,11 @@ scan_bin_string_continue(i_ctx_t *i_ctx_p, ref * pref, scanner_state * pstate)
*/
sgets(s, q, wanted, &rcnt);
if (rcnt == wanted) {
- /* Finished collecting the string. */
- make_string(pref, a_all | icurrent_space,
- pstate->s_da.limit - pstate->s_da.base,
- pstate->s_da.base);
- return 0;
+ /* Finished collecting the string. */
+ make_string(pref, a_all | icurrent_space,
+ pstate->s_da.limit - pstate->s_da.base,
+ pstate->s_da.base);
+ return 0;
}
pstate->s_da.next = q + rcnt;
pstate->s_scan_type = scanning_binary;
@@ -472,7 +472,7 @@ scan_bin_string_continue(i_ctx_t *i_ctx_p, ref * pref, scanner_state * pstate)
/* Continue scanning a binary number array. */
static int
scan_bin_num_array_continue(i_ctx_t *i_ctx_p, ref * pref,
- scanner_state * pstate)
+ scanner_state * pstate)
{
stream *const s = pstate->s_file.value.pfile;
scan_binary_state *const pbs = &pstate->s_ss.binary;
@@ -481,26 +481,26 @@ scan_bin_num_array_continue(i_ctx_t *i_ctx_p, ref * pref,
uint wanted = encoded_number_bytes(pbs->num_format);
for (; index < r_size(&pbs->bin_array); index++, np++) {
- int code;
-
- if (sbufavailable(s) < wanted) {
- pbs->index = index;
- pstate->s_scan_type = scanning_binary;
- return scan_Refill;
- }
- code = sdecode_number(sbufptr(s), pbs->num_format, np);
- switch (code) {
- case t_integer:
- case t_real:
- r_set_type(np, code);
- sbufskip(s, wanted);
- break;
- case t_null:
- scan_bos_error(pstate, "bad number format");
- return_error(e_syntaxerror);
- default:
- return code;
- }
+ int code;
+
+ if (sbufavailable(s) < wanted) {
+ pbs->index = index;
+ pstate->s_scan_type = scanning_binary;
+ return scan_Refill;
+ }
+ code = sdecode_number(sbufptr(s), pbs->num_format, np);
+ switch (code) {
+ case t_integer:
+ case t_real:
+ r_set_type(np, code);
+ sbufskip(s, wanted);
+ break;
+ case t_null:
+ scan_bos_error(pstate, "bad number format");
+ return_error(e_syntaxerror);
+ default:
+ return code;
+ }
}
*pref = pbs->bin_array;
return 0;
@@ -532,176 +532,176 @@ scan_bos_continue(i_ctx_t *i_ctx_p, ref * pref, scanner_state * pstate)
pbs->cont = scan_bos_continue; /* in case of premature return */
s_begin_inline(s, p, rlimit);
for (; index < max_array_index; p += SIZEOF_BIN_SEQ_OBJ, index++) {
- ref *op = abase + index;
- uint osize;
- int value, atype, attrs;
-
- s_end_inline(s, p, rlimit); /* in case of error */
- if (rlimit - p < SIZEOF_BIN_SEQ_OBJ) {
- pbs->index = index;
- pbs->max_array_index = max_array_index;
- pbs->min_string_index = min_string_index;
- pstate->s_scan_type = scanning_binary;
- return scan_Refill;
- }
- if (p[2] != 0) { /* reserved, must be 0 */
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
- }
- attrs = (p[1] & 128 ? a_executable : 0);
- /*
- * We always decode all 8 bytes of the object, so we can signal
- * syntaxerror if any unused field is non-zero (per PLRM).
- */
- osize = sdecodeushort(p + 3, num_format);
- value = sdecodeint32(p + 5, num_format);
- switch (p[1] & 0x7f) {
- case BS_TYPE_NULL:
- if (osize | value) { /* unused */
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
- }
- make_null(op);
- break;
- case BS_TYPE_INTEGER:
- if (osize) { /* unused */
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
- }
- make_int(op, value);
- break;
- case BS_TYPE_REAL:{
- float vreal;
-
- if (osize != 0) { /* fixed-point number */
- if (osize > 31) {
- scan_bos_error(pstate, "invalid number format");
- return_error(e_syntaxerror);
- }
- /* ldexp requires a signed 2nd argument.... */
- vreal = (float)ldexp((double)value, -(int)osize);
- } else {
- code = sdecode_float(p + 5, num_format, &vreal);
- if (code < 0) {
- scan_bos_error(pstate, "invalid real number");
- return code;
- }
- }
- make_real(op, vreal);
- break;
- }
- case BS_TYPE_BOOLEAN:
- if (osize) { /* unused */
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
- }
- make_bool(op, value != 0);
- break;
- case BS_TYPE_STRING:
- attrs |= a_all;
- str:
- if (osize == 0) {
- /* For zero-length strings, the offset */
- /* doesn't matter, and may be zero. */
- make_empty_string(op, attrs);
- break;
- }
- if (value < max_array_index * SIZEOF_BIN_SEQ_OBJ ||
- value + osize > size
- ) {
- scan_bos_error(pstate, "invalid string offset");
- return_error(e_syntaxerror);
- }
- if (value < min_string_index) {
- /* We have to (re)allocate the strings. */
- uint str_size = size - value;
- byte *sbase;
-
- if (pstate->s_da.is_dynamic)
- sbase = scan_bos_resize(i_ctx_p, pstate, str_size,
- index);
- else
- sbase = ialloc_string(str_size,
- "bos strings");
- if (sbase == 0)
- return_error(e_VMerror);
- pstate->s_da.is_dynamic = true;
- pstate->s_da.base = pstate->s_da.next = sbase;
- pstate->s_da.limit = sbase + str_size;
- min_string_index = value;
- }
- make_string(op, attrs | icurrent_space, osize,
- pstate->s_da.base +
- (value - min_string_index));
- break;
- case BS_TYPE_EVAL_NAME:
- attrs |= a_readonly; /* mark as executable for later */
- /* falls through */
- case BS_TYPE_NAME:
- switch (osize) {
- case 0:
- code = scan_bin_get_name(pstate, imemory,
- user_names_p, value, op,
- "user");
- goto usn;
- case 0xffff:
- code = scan_bin_get_name(pstate, imemory,
- system_names_p, value, op,
- "system");
- usn:
- if (code < 0)
- return code;
- r_set_attrs(op, attrs);
- break;
- default:
- goto str;
- }
- break;
- case BS_TYPE_ARRAY:
- atype = t_array;
- arr:
- if (value + osize > min_string_index ||
- value & (SIZEOF_BIN_SEQ_OBJ - 1)
- ) {
- scan_bos_error(pstate, "bad array offset");
- return_error(e_syntaxerror);
- }
- {
- uint aindex = value / SIZEOF_BIN_SEQ_OBJ;
-
- max_array_index =
- max(max_array_index, aindex + osize);
- make_tasv_new(op, atype,
- attrs | a_all | icurrent_space,
- osize, refs, abase + aindex);
- }
- break;
- case BS_TYPE_DICTIONARY: /* EXTENSION */
- if ((osize & 1) != 0 && osize != 1)
- return_error(e_syntaxerror);
- atype = t_mixedarray; /* mark as dictionary */
- goto arr;
- case BS_TYPE_MARK:
- if (osize | value) { /* unused */
- scan_bos_error(pstate, "non-zero unused field");
- return_error(e_syntaxerror);
- }
- make_mark(op);
- break;
- default:
- scan_bos_error(pstate, "invalid object type");
- return_error(e_syntaxerror);
- }
+ ref *op = abase + index;
+ uint osize;
+ int value, atype, attrs;
+
+ s_end_inline(s, p, rlimit); /* in case of error */
+ if (rlimit - p < SIZEOF_BIN_SEQ_OBJ) {
+ pbs->index = index;
+ pbs->max_array_index = max_array_index;
+ pbs->min_string_index = min_string_index;
+ pstate->s_scan_type = scanning_binary;
+ return scan_Refill;
+ }
+ if (p[2] != 0) { /* reserved, must be 0 */
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
+ }
+ attrs = (p[1] & 128 ? a_executable : 0);
+ /*
+ * We always decode all 8 bytes of the object, so we can signal
+ * syntaxerror if any unused field is non-zero (per PLRM).
+ */
+ osize = sdecodeushort(p + 3, num_format);
+ value = sdecodeint32(p + 5, num_format);
+ switch (p[1] & 0x7f) {
+ case BS_TYPE_NULL:
+ if (osize | value) { /* unused */
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
+ }
+ make_null(op);
+ break;
+ case BS_TYPE_INTEGER:
+ if (osize) { /* unused */
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
+ }
+ make_int(op, value);
+ break;
+ case BS_TYPE_REAL:{
+ float vreal;
+
+ if (osize != 0) { /* fixed-point number */
+ if (osize > 31) {
+ scan_bos_error(pstate, "invalid number format");
+ return_error(e_syntaxerror);
+ }
+ /* ldexp requires a signed 2nd argument.... */
+ vreal = (float)ldexp((double)value, -(int)osize);
+ } else {
+ code = sdecode_float(p + 5, num_format, &vreal);
+ if (code < 0) {
+ scan_bos_error(pstate, "invalid real number");
+ return code;
+ }
+ }
+ make_real(op, vreal);
+ break;
+ }
+ case BS_TYPE_BOOLEAN:
+ if (osize) { /* unused */
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
+ }
+ make_bool(op, value != 0);
+ break;
+ case BS_TYPE_STRING:
+ attrs |= a_all;
+ str:
+ if (osize == 0) {
+ /* For zero-length strings, the offset */
+ /* doesn't matter, and may be zero. */
+ make_empty_string(op, attrs);
+ break;
+ }
+ if (value < max_array_index * SIZEOF_BIN_SEQ_OBJ ||
+ value + osize > size
+ ) {
+ scan_bos_error(pstate, "invalid string offset");
+ return_error(e_syntaxerror);
+ }
+ if (value < min_string_index) {
+ /* We have to (re)allocate the strings. */
+ uint str_size = size - value;
+ byte *sbase;
+
+ if (pstate->s_da.is_dynamic)
+ sbase = scan_bos_resize(i_ctx_p, pstate, str_size,
+ index);
+ else
+ sbase = ialloc_string(str_size,
+ "bos strings");
+ if (sbase == 0)
+ return_error(e_VMerror);
+ pstate->s_da.is_dynamic = true;
+ pstate->s_da.base = pstate->s_da.next = sbase;
+ pstate->s_da.limit = sbase + str_size;
+ min_string_index = value;
+ }
+ make_string(op, attrs | icurrent_space, osize,
+ pstate->s_da.base +
+ (value - min_string_index));
+ break;
+ case BS_TYPE_EVAL_NAME:
+ attrs |= a_readonly; /* mark as executable for later */
+ /* falls through */
+ case BS_TYPE_NAME:
+ switch (osize) {
+ case 0:
+ code = scan_bin_get_name(pstate, imemory,
+ user_names_p, value, op,
+ "user");
+ goto usn;
+ case 0xffff:
+ code = scan_bin_get_name(pstate, imemory,
+ system_names_p, value, op,
+ "system");
+ usn:
+ if (code < 0)
+ return code;
+ r_set_attrs(op, attrs);
+ break;
+ default:
+ goto str;
+ }
+ break;
+ case BS_TYPE_ARRAY:
+ atype = t_array;
+ arr:
+ if (value + osize > min_string_index ||
+ value & (SIZEOF_BIN_SEQ_OBJ - 1)
+ ) {
+ scan_bos_error(pstate, "bad array offset");
+ return_error(e_syntaxerror);
+ }
+ {
+ uint aindex = value / SIZEOF_BIN_SEQ_OBJ;
+
+ max_array_index =
+ max(max_array_index, aindex + osize);
+ make_tasv_new(op, atype,
+ attrs | a_all | icurrent_space,
+ osize, refs, abase + aindex);
+ }
+ break;
+ case BS_TYPE_DICTIONARY: /* EXTENSION */
+ if ((osize & 1) != 0 && osize != 1)
+ return_error(e_syntaxerror);
+ atype = t_mixedarray; /* mark as dictionary */
+ goto arr;
+ case BS_TYPE_MARK:
+ if (osize | value) { /* unused */
+ scan_bos_error(pstate, "non-zero unused field");
+ return_error(e_syntaxerror);
+ }
+ make_mark(op);
+ break;
+ default:
+ scan_bos_error(pstate, "invalid object type");
+ return_error(e_syntaxerror);
+ }
}
s_end_inline(s, p, rlimit);
/* Shorten the objects to remove the space that turned out */
/* to be used for strings. */
pbs->index = max_array_index;
iresize_ref_array(&pbs->bin_array, max_array_index,
- "binary object sequence(objects)");
+ "binary object sequence(objects)");
code = scan_bos_string_continue(i_ctx_p, pref, pstate);
if (code == scan_Refill)
- pbs->cont = scan_bos_string_continue;
+ pbs->cont = scan_bos_string_continue;
return code;
}
@@ -709,33 +709,33 @@ scan_bos_continue(i_ctx_t *i_ctx_p, ref * pref, scanner_state * pstate)
/* adjusting all the pointers to them from objects. */
static byte *
scan_bos_resize(i_ctx_t *i_ctx_p, scanner_state * pstate, uint new_size,
- uint index)
+ uint index)
{
scan_binary_state *const pbs = &pstate->s_ss.binary;
uint old_size = da_size(&pstate->s_da);
byte *old_base = pstate->s_da.base;
byte *new_base = iresize_string(old_base, old_size, new_size,
- "scan_bos_resize");
+ "scan_bos_resize");
byte *relocated_base = new_base + (new_size - old_size);
uint i;
ref *aptr = pbs->bin_array.value.refs;
if (new_base == 0)
- return 0;
+ return 0;
/* Since the allocator normally extends strings downward, */
/* it's quite possible that new and old addresses are the same. */
if (relocated_base != old_base)
- for (i = index; i != 0; i--, aptr++)
- if (r_has_type(aptr, t_string) && r_size(aptr) != 0)
- aptr->value.bytes =
- aptr->value.bytes - old_base + relocated_base;
+ for (i = index; i != 0; i--, aptr++)
+ if (r_has_type(aptr, t_string) && r_size(aptr) != 0)
+ aptr->value.bytes =
+ aptr->value.bytes - old_base + relocated_base;
return new_base;
}
/* Continue reading the strings for a binary object sequence. */
static int
scan_bos_string_continue(i_ctx_t *i_ctx_p, ref * pref,
- scanner_state * pstate)
+ scanner_state * pstate)
{
scan_binary_state *const pbs = &pstate->s_ss.binary;
ref rstr;
@@ -746,99 +746,99 @@ scan_bos_string_continue(i_ctx_t *i_ctx_p, ref * pref,
uint i;
if (code != 0)
- return code;
+ return code;
/* Fix up names. We must do this before creating dictionaries. */
for (op = pbs->bin_array.value.refs, i = r_size(&pbs->bin_array);
- i != 0; i--, op++
- )
- switch (r_type(op)) {
- case t_string:
- if (r_has_attr(op, a_write)) /* a real string */
- break;
- /* This is actually a name; look it up now. */
- {
- uint attrs = r_type_attrs(op) & (a_read | a_executable);
-
- code = name_ref(imemory, op->value.bytes, r_size(op), op, 1);
- if (code < 0)
- return code;
- r_set_attrs(op, attrs);
- }
- /* falls through */
- case t_name:
- if (r_has_attr(op, a_read)) { /* BS_TYPE_EVAL_NAME */
- ref *defp = dict_find_name(op);
-
- if (defp == 0)
- return_error(e_undefined);
- store_check_space(space, defp);
- ref_assign(op, defp);
- }
- break;
- case t_mixedarray: /* actually a dictionary */
- rescan = true;
- }
+ i != 0; i--, op++
+ )
+ switch (r_type(op)) {
+ case t_string:
+ if (r_has_attr(op, a_write)) /* a real string */
+ break;
+ /* This is actually a name; look it up now. */
+ {
+ uint attrs = r_type_attrs(op) & (a_read | a_executable);
+
+ code = name_ref(imemory, op->value.bytes, r_size(op), op, 1);
+ if (code < 0)
+ return code;
+ r_set_attrs(op, attrs);
+ }
+ /* falls through */
+ case t_name:
+ if (r_has_attr(op, a_read)) { /* BS_TYPE_EVAL_NAME */
+ ref *defp = dict_find_name(op);
+
+ if (defp == 0)
+ return_error(e_undefined);
+ store_check_space(space, defp);
+ ref_assign(op, defp);
+ }
+ break;
+ case t_mixedarray: /* actually a dictionary */
+ rescan = true;
+ }
/* Create dictionaries, if any. */
if (rescan) {
- rescan = false;
- for (op = pbs->bin_array.value.refs, i = r_size(&pbs->bin_array);
- i != 0; i--, op++
- )
- switch (r_type(op)) {
- case t_mixedarray: /* actually a dictionary */
- {
- uint count = r_size(op);
- ref rdict;
-
- if (count == 1) {
- /* Indirect reference. */
- if (op->value.refs < op)
- ref_assign(&rdict, op->value.refs);
- else {
- rescan = true;
- continue;
- }
- } else {
- code = dict_create(count >> 1, &rdict);
- if (code < 0)
- return code;
- while (count) {
- count -= 2;
- code = idict_put(&rdict,
- &op->value.refs[count],
- &op->value.refs[count + 1]);
- if (code < 0)
- return code;
- }
- }
- r_set_attrs(&rdict, a_all);
- r_copy_attrs(&rdict, a_executable, op);
- ref_assign(op, &rdict);
- }
- break;
- }
+ rescan = false;
+ for (op = pbs->bin_array.value.refs, i = r_size(&pbs->bin_array);
+ i != 0; i--, op++
+ )
+ switch (r_type(op)) {
+ case t_mixedarray: /* actually a dictionary */
+ {
+ uint count = r_size(op);
+ ref rdict;
+
+ if (count == 1) {
+ /* Indirect reference. */
+ if (op->value.refs < op)
+ ref_assign(&rdict, op->value.refs);
+ else {
+ rescan = true;
+ continue;
+ }
+ } else {
+ code = dict_create(count >> 1, &rdict);
+ if (code < 0)
+ return code;
+ while (count) {
+ count -= 2;
+ code = idict_put(&rdict,
+ &op->value.refs[count],
+ &op->value.refs[count + 1]);
+ if (code < 0)
+ return code;
+ }
+ }
+ r_set_attrs(&rdict, a_all);
+ r_copy_attrs(&rdict, a_executable, op);
+ ref_assign(op, &rdict);
+ }
+ break;
+ }
}
/* If there were any forward indirect references, fix them up now. */
if (rescan)
- for (op = pbs->bin_array.value.refs, i = r_size(&pbs->bin_array);
- i != 0; i--, op++
- )
- if (r_has_type(op, t_mixedarray)) {
- const ref *piref = op->value.const_refs;
- ref rdict;
-
- if (r_has_type(piref, t_mixedarray)) /* ref to indirect */
- return_error(e_syntaxerror);
- ref_assign(&rdict, piref);
- r_copy_attrs(&rdict, a_executable, op);
- ref_assign(op, &rdict);
- }
+ for (op = pbs->bin_array.value.refs, i = r_size(&pbs->bin_array);
+ i != 0; i--, op++
+ )
+ if (r_has_type(op, t_mixedarray)) {
+ const ref *piref = op->value.const_refs;
+ ref rdict;
+
+ if (r_has_type(piref, t_mixedarray)) /* ref to indirect */
+ return_error(e_syntaxerror);
+ ref_assign(&rdict, piref);
+ r_copy_attrs(&rdict, a_executable, op);
+ ref_assign(op, &rdict);
+ }
ref_assign(pref, &pbs->bin_array);
r_set_size(pref, pbs->top_size);
@@ -854,7 +854,7 @@ scan_bos_string_continue(i_ctx_t *i_ctx_p, ref * pref,
*/
int
encode_binary_token(i_ctx_t *i_ctx_p, const ref *obj, int *ref_offset,
- int *char_offset, byte *str)
+ int *char_offset, byte *str)
{
bin_seq_type_t type;
uint size = 0;
@@ -863,77 +863,77 @@ encode_binary_token(i_ctx_t *i_ctx_p, const ref *obj, int *ref_offset,
ref nstr;
switch (r_type(obj)) {
- case t_null:
- type = BS_TYPE_NULL;
- break; /* always set all fields */
- case t_mark:
- type = BS_TYPE_MARK;
- break; /* always set all fields */
- case t_integer:
- type = BS_TYPE_INTEGER;
- value = obj->value.intval;
- break;
- case t_real:
- type = BS_TYPE_REAL;
- if (sizeof(obj->value.realval) != sizeof(int)) {
- /* The PLRM allocates exactly 4 bytes for reals. */
- return_error(e_rangecheck);
- }
- value = *(const int *)&obj->value.realval;
+ case t_null:
+ type = BS_TYPE_NULL;
+ break; /* always set all fields */
+ case t_mark:
+ type = BS_TYPE_MARK;
+ break; /* always set all fields */
+ case t_integer:
+ type = BS_TYPE_INTEGER;
+ value = obj->value.intval;
+ break;
+ case t_real:
+ type = BS_TYPE_REAL;
+ if (sizeof(obj->value.realval) != sizeof(int)) {
+ /* The PLRM allocates exactly 4 bytes for reals. */
+ return_error(e_rangecheck);
+ }
+ value = *(const int *)&obj->value.realval;
#if !(ARCH_FLOATS_ARE_IEEE && BYTE_SWAP_IEEE_NATIVE_REALS)
- if (format >= 3) {
- /* Never byte-swap native reals -- use native byte order. */
- format = 4 - ARCH_IS_BIG_ENDIAN;
- }
+ if (format >= 3) {
+ /* Never byte-swap native reals -- use native byte order. */
+ format = 4 - ARCH_IS_BIG_ENDIAN;
+ }
#endif
- break;
- case t_boolean:
- type = BS_TYPE_BOOLEAN;
- value = obj->value.boolval;
- break;
- case t_array:
- type = BS_TYPE_ARRAY;
- size = r_size(obj);
- goto aod;
- case t_dictionary: /* EXTENSION */
- type = BS_TYPE_DICTIONARY;
- size = dict_length(obj) << 1;
- aod:value = *ref_offset;
- *ref_offset += size * SIZEOF_BIN_SEQ_OBJ;
- break;
- case t_string:
- type = BS_TYPE_STRING;
+ break;
+ case t_boolean:
+ type = BS_TYPE_BOOLEAN;
+ value = obj->value.boolval;
+ break;
+ case t_array:
+ type = BS_TYPE_ARRAY;
+ size = r_size(obj);
+ goto aod;
+ case t_dictionary: /* EXTENSION */
+ type = BS_TYPE_DICTIONARY;
+ size = dict_length(obj) << 1;
+ aod:value = *ref_offset;
+ *ref_offset += size * SIZEOF_BIN_SEQ_OBJ;
+ break;
+ case t_string:
+ type = BS_TYPE_STRING;
nos:
- size = r_size(obj);
- value = *char_offset;
- *char_offset += size;
- break;
- case t_name:
- type = BS_TYPE_NAME;
- name_string_ref(imemory, obj, &nstr);
- r_copy_attrs(&nstr, a_executable, obj);
- obj = &nstr;
- goto nos;
- default:
- return_error(e_rangecheck);
+ size = r_size(obj);
+ value = *char_offset;
+ *char_offset += size;
+ break;
+ case t_name:
+ type = BS_TYPE_NAME;
+ name_string_ref(imemory, obj, &nstr);
+ r_copy_attrs(&nstr, a_executable, obj);
+ obj = &nstr;
+ goto nos;
+ default:
+ return_error(e_rangecheck);
}
{
- byte s0 = (byte) size, s1 = (byte) (size >> 8);
- byte v0 = (byte) value, v1 = (byte) (value >> 8),
- v2 = (byte) (value >> 16), v3 = (byte) (value >> 24);
-
- if (format & 1) {
- /* Store big-endian */
- str[2] = s1, str[3] = s0;
- str[4] = v3, str[5] = v2, str[6] = v1, str[7] = v0;
- } else {
- /* Store little-endian */
- str[2] = s0, str[3] = s1;
- str[4] = v0, str[5] = v1, str[6] = v2, str[7] = v3;
- }
+ byte s0 = (byte) size, s1 = (byte) (size >> 8);
+ byte v0 = (byte) value, v1 = (byte) (value >> 8),
+ v2 = (byte) (value >> 16), v3 = (byte) (value >> 24);
+
+ if (format & 1) {
+ /* Store big-endian */
+ str[2] = s1, str[3] = s0;
+ str[4] = v3, str[5] = v2, str[6] = v1, str[7] = v0;
+ } else {
+ /* Store little-endian */
+ str[2] = s0, str[3] = s1;
+ str[4] = v0, str[5] = v1, str[6] = v2, str[7] = v3;
+ }
}
if (r_has_attr(obj, a_executable))
- type += BS_EXECUTABLE;
+ type += BS_EXECUTABLE;
str[0] = (byte) type;
return 0;
}
diff --git a/gs/psi/iscanbin.h b/gs/psi/iscanbin.h
index 75297ace8..cd1641085 100644
--- a/gs/psi/iscanbin.h
+++ b/gs/psi/iscanbin.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iscannum.c b/gs/psi/iscannum.c
index 711cbdb96..b905a0c74 100644
--- a/gs/psi/iscannum.c
+++ b/gs/psi/iscannum.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@
*/
int
scan_number(const byte * str, const byte * end, int sign,
- ref * pref, const byte ** psp, int scanner_options)
+ ref * pref, const byte ** psp, int scanner_options)
{
const byte *sp = str;
#define GET_NEXT(cvar, sp, end_action)\
@@ -46,10 +46,10 @@ scan_number(const byte * str, const byte * end, int sign,
*/
#define NUM_POWERS_10 6
static const float powers_10[NUM_POWERS_10 + 1] = {
- 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6
+ 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6
};
static const double neg_powers_10[NUM_POWERS_10 + 1] = {
- 1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6
+ 1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6
};
int ival;
@@ -66,14 +66,14 @@ scan_number(const byte * str, const byte * end, int sign,
GET_NEXT(c, sp, return_error(e_syntaxerror));
if (!IS_DIGIT(d, c)) {
- if (c != '.')
- return_error(e_syntaxerror);
- /* Might be a number starting with '.'. */
- GET_NEXT(c, sp, return_error(e_syntaxerror));
- if (!IS_DIGIT(d, c))
- return_error(e_syntaxerror);
- ival = 0;
- goto i2r;
+ if (c != '.')
+ return_error(e_syntaxerror);
+ /* Might be a number starting with '.'. */
+ GET_NEXT(c, sp, return_error(e_syntaxerror));
+ if (!IS_DIGIT(d, c))
+ return_error(e_syntaxerror);
+ ival = 0;
+ goto i2r;
}
/* Accumulate an integer in ival. */
/* Do up to 4 digits without a loop, */
@@ -81,126 +81,126 @@ scan_number(const byte * str, const byte * end, int sign,
/* most numbers have 4 (integer) digits or fewer. */
ival = d;
if (end - sp >= 3) { /* just check once */
- if (!IS_DIGIT(d, (c = *sp))) {
- sp++;
- goto ind;
- }
- ival = ival * 10 + d;
- if (!IS_DIGIT(d, (c = sp[1]))) {
- sp += 2;
- goto ind;
- }
- ival = ival * 10 + d;
- sp += 3;
- if (!IS_DIGIT(d, (c = sp[-1])))
- goto ind;
- ival = ival * 10 + d;
+ if (!IS_DIGIT(d, (c = *sp))) {
+ sp++;
+ goto ind;
+ }
+ ival = ival * 10 + d;
+ if (!IS_DIGIT(d, (c = sp[1]))) {
+ sp += 2;
+ goto ind;
+ }
+ ival = ival * 10 + d;
+ sp += 3;
+ if (!IS_DIGIT(d, (c = sp[-1])))
+ goto ind;
+ ival = ival * 10 + d;
}
max_scan = scanner_options & SCAN_PDF_UNSIGNED && sign >= 0 ? ~0 : max_int;
for (;; ival = ival * 10 + d) {
- GET_NEXT(c, sp, goto iret);
- if (!IS_DIGIT(d, c))
- break;
+ GET_NEXT(c, sp, goto iret);
+ if (!IS_DIGIT(d, c))
+ break;
if (WOULD_OVERFLOW(((unsigned)ival), d, max_scan)) {
- if (ival == max_int / 10 && d == (max_int % 10) + 1 && sign < 0) {
- GET_NEXT(c, sp, c = EOFC);
- dval = -(double)min_int;
- if (c == 'e' || c == 'E') {
- exp10 = 0;
- goto fs;
- } else if (c == '.') {
+ if (ival == max_int / 10 && d == (max_int % 10) + 1 && sign < 0) {
+ GET_NEXT(c, sp, c = EOFC);
+ dval = -(double)min_int;
+ if (c == 'e' || c == 'E') {
+ exp10 = 0;
+ goto fs;
+ } else if (c == '.') {
GET_NEXT(c, sp, c = EOFC);
- exp10 = 0;
- goto fd;
+ exp10 = 0;
+ goto fd;
} else if (!IS_DIGIT(d, c)) {
- ival = min_int;
- break;
- }
- } else
- dval = ival;
- goto l2d;
+ ival = min_int;
+ break;
+ }
+ } else
+ dval = ival;
+ goto l2d;
}
}
ind: /* We saw a non-digit while accumulating an integer in ival. */
switch (c) {
- case '.':
- GET_NEXT(c, sp, c = EOFC);
- goto i2r;
- default:
- *psp = sp;
- code = 1;
+ case '.':
+ GET_NEXT(c, sp, c = EOFC);
+ goto i2r;
+ default:
+ *psp = sp;
+ code = 1;
break;
case EOFC:
- break;
- case 'e':
- case 'E':
- if (sign < 0)
- ival = -ival;
- dval = ival;
- exp10 = 0;
- goto fe;
- case '#':
- {
- const int radix = ival;
- uint uval = 0, imax;
+ break;
+ case 'e':
+ case 'E':
+ if (sign < 0)
+ ival = -ival;
+ dval = ival;
+ exp10 = 0;
+ goto fe;
+ case '#':
+ {
+ const int radix = ival;
+ uint uval = 0, imax;
- if (sign || radix < min_radix || radix > max_radix)
- return_error(e_syntaxerror);
- /* Avoid multiplies for power-of-2 radix. */
- if (!(radix & (radix - 1))) {
- int shift;
+ if (sign || radix < min_radix || radix > max_radix)
+ return_error(e_syntaxerror);
+ /* Avoid multiplies for power-of-2 radix. */
+ if (!(radix & (radix - 1))) {
+ int shift;
- switch (radix) {
- case 2:
- shift = 1, imax = max_uint >> 1;
- break;
- case 4:
- shift = 2, imax = max_uint >> 2;
- break;
- case 8:
- shift = 3, imax = max_uint >> 3;
- break;
- case 16:
- shift = 4, imax = max_uint >> 4;
- break;
- case 32:
- shift = 5, imax = max_uint >> 5;
- break;
- default: /* can't happen */
- return_error(e_rangecheck);
- }
- for (;; uval = (uval << shift) + d) {
- GET_NEXT(c, sp, break);
- d = decoder[c];
- if (d >= radix) {
- *psp = sp;
- code = 1;
- break;
- }
- if (uval > imax)
- return_error(e_limitcheck);
- }
- } else {
- int irem = max_uint % radix;
+ switch (radix) {
+ case 2:
+ shift = 1, imax = max_uint >> 1;
+ break;
+ case 4:
+ shift = 2, imax = max_uint >> 2;
+ break;
+ case 8:
+ shift = 3, imax = max_uint >> 3;
+ break;
+ case 16:
+ shift = 4, imax = max_uint >> 4;
+ break;
+ case 32:
+ shift = 5, imax = max_uint >> 5;
+ break;
+ default: /* can't happen */
+ return_error(e_rangecheck);
+ }
+ for (;; uval = (uval << shift) + d) {
+ GET_NEXT(c, sp, break);
+ d = decoder[c];
+ if (d >= radix) {
+ *psp = sp;
+ code = 1;
+ break;
+ }
+ if (uval > imax)
+ return_error(e_limitcheck);
+ }
+ } else {
+ int irem = max_uint % radix;
- imax = max_uint / radix;
- for (;; uval = uval * radix + d) {
- GET_NEXT(c, sp, break);
- d = decoder[c];
- if (d >= radix) {
- *psp = sp;
- code = 1;
- break;
- }
- if (uval >= imax &&
- (uval > imax || d > irem)
- )
- return_error(e_limitcheck);
- }
- }
- make_int(pref, uval);
- return code;
- }
+ imax = max_uint / radix;
+ for (;; uval = uval * radix + d) {
+ GET_NEXT(c, sp, break);
+ d = decoder[c];
+ if (d >= radix) {
+ *psp = sp;
+ code = 1;
+ break;
+ }
+ if (uval >= imax &&
+ (uval > imax || d > irem)
+ )
+ return_error(e_limitcheck);
+ }
+ }
+ make_int(pref, uval);
+ return code;
+ }
}
iret:
make_int(pref, (sign < 0 ? -ival : ival));
@@ -210,67 +210,67 @@ iret:
l2d:
exp10 = 0;
for (;;) {
- dval = dval * 10 + d;
- GET_NEXT(c, sp, c = EOFC);
- if (!IS_DIGIT(d, c))
- break;
+ dval = dval * 10 + d;
+ GET_NEXT(c, sp, c = EOFC);
+ if (!IS_DIGIT(d, c))
+ break;
}
switch (c) {
- case '.':
- GET_NEXT(c, sp, c = EOFC);
- exp10 = 0;
- goto fd;
- default:
- *psp = sp;
- code = 1;
- /* falls through */
- case EOFC:
- if (sign < 0)
- dval = -dval;
- goto rret;
- case 'e':
- case 'E':
- exp10 = 0;
- goto fs;
- case '#':
- return_error(e_syntaxerror);
+ case '.':
+ GET_NEXT(c, sp, c = EOFC);
+ exp10 = 0;
+ goto fd;
+ default:
+ *psp = sp;
+ code = 1;
+ /* falls through */
+ case EOFC:
+ if (sign < 0)
+ dval = -dval;
+ goto rret;
+ case 'e':
+ case 'E':
+ exp10 = 0;
+ goto fs;
+ case '#':
+ return_error(e_syntaxerror);
}
/* We saw a '.' while accumulating an integer in ival. */
i2r:
exp10 = 0;
while (IS_DIGIT(d, c) || c == '-') {
- /*
- * PostScript gives an error on numbers with a '-' following a '.'
- * Adobe Acrobat Reader (PDF) apparently doesn't treat this as an
- * error. Experiments show that the numbers following the '-' are
- * ignored, so we swallow the fractional part. SCAN_PDF_INV_NUM
- * enables this compatibility kloodge.
- */
- if (c == '-') {
- if ((SCAN_PDF_INV_NUM & scanner_options) == 0)
- break;
- do {
- GET_NEXT(c, sp, c = EOFC);
- } while (IS_DIGIT(d, c));
- break;
- }
- if (WOULD_OVERFLOW(ival, d, max_int)) {
- dval = ival;
- goto fd;
- }
- ival = ival * 10 + d;
- exp10--;
- GET_NEXT(c, sp, c = EOFC);
+ /*
+ * PostScript gives an error on numbers with a '-' following a '.'
+ * Adobe Acrobat Reader (PDF) apparently doesn't treat this as an
+ * error. Experiments show that the numbers following the '-' are
+ * ignored, so we swallow the fractional part. SCAN_PDF_INV_NUM
+ * enables this compatibility kloodge.
+ */
+ if (c == '-') {
+ if ((SCAN_PDF_INV_NUM & scanner_options) == 0)
+ break;
+ do {
+ GET_NEXT(c, sp, c = EOFC);
+ } while (IS_DIGIT(d, c));
+ break;
+ }
+ if (WOULD_OVERFLOW(ival, d, max_int)) {
+ dval = ival;
+ goto fd;
+ }
+ ival = ival * 10 + d;
+ exp10--;
+ GET_NEXT(c, sp, c = EOFC);
}
if (sign < 0)
- ival = -ival;
+ ival = -ival;
/* Take a shortcut for the common case */
if (!(c == 'e' || c == 'E' || exp10 < -NUM_POWERS_10)) { /* Check for trailing garbage */
- if (c != EOFC)
- *psp = sp, code = 1;
- make_real(pref, ival * neg_powers_10[-exp10]);
- return code;
+ if (c != EOFC)
+ *psp = sp, code = 1;
+ make_real(pref, ival * neg_powers_10[-exp10]);
+ return code;
}
dval = ival;
goto fe;
@@ -278,68 +278,68 @@ i2r:
/* Now we are accumulating a double in dval. */
fd:
while (IS_DIGIT(d, c)) {
- dval = dval * 10 + d;
- exp10--;
- GET_NEXT(c, sp, c = EOFC);
+ dval = dval * 10 + d;
+ exp10--;
+ GET_NEXT(c, sp, c = EOFC);
}
fs:
if (sign < 0)
- dval = -dval;
+ dval = -dval;
fe:
/* Now dval contains the value, negated if necessary. */
switch (c) {
- case 'e':
- case 'E':
- { /* Check for a following exponent. */
- int esign = 0;
- int iexp;
+ case 'e':
+ case 'E':
+ { /* Check for a following exponent. */
+ int esign = 0;
+ int iexp;
- GET_NEXT(c, sp, return_error(e_syntaxerror));
- switch (c) {
- case '-':
- esign = 1;
- case '+':
- GET_NEXT(c, sp, return_error(e_syntaxerror));
- }
- /* Scan the exponent. We limit it arbitrarily to 999. */
- if (!IS_DIGIT(d, c))
- return_error(e_syntaxerror);
- iexp = d;
- for (;; iexp = iexp * 10 + d) {
- GET_NEXT(c, sp, break);
- if (!IS_DIGIT(d, c)) {
- *psp = sp;
- code = 1;
- break;
- }
- if (iexp > 99)
- return_error(e_limitcheck);
- }
- if (esign)
- exp10 -= iexp;
- else
- exp10 += iexp;
- break;
- }
- default:
- *psp = sp;
- code = 1;
- case EOFC:
- ;
+ GET_NEXT(c, sp, return_error(e_syntaxerror));
+ switch (c) {
+ case '-':
+ esign = 1;
+ case '+':
+ GET_NEXT(c, sp, return_error(e_syntaxerror));
+ }
+ /* Scan the exponent. We limit it arbitrarily to 999. */
+ if (!IS_DIGIT(d, c))
+ return_error(e_syntaxerror);
+ iexp = d;
+ for (;; iexp = iexp * 10 + d) {
+ GET_NEXT(c, sp, break);
+ if (!IS_DIGIT(d, c)) {
+ *psp = sp;
+ code = 1;
+ break;
+ }
+ if (iexp > 99)
+ return_error(e_limitcheck);
+ }
+ if (esign)
+ exp10 -= iexp;
+ else
+ exp10 += iexp;
+ break;
+ }
+ default:
+ *psp = sp;
+ code = 1;
+ case EOFC:
+ ;
}
/* Compute dval * 10^exp10. */
if (exp10 > 0) {
- while (exp10 > NUM_POWERS_10)
- dval *= powers_10[NUM_POWERS_10],
- exp10 -= NUM_POWERS_10;
- if (exp10 > 0)
- dval *= powers_10[exp10];
+ while (exp10 > NUM_POWERS_10)
+ dval *= powers_10[NUM_POWERS_10],
+ exp10 -= NUM_POWERS_10;
+ if (exp10 > 0)
+ dval *= powers_10[exp10];
} else if (exp10 < 0) {
- while (exp10 < -NUM_POWERS_10)
- dval /= powers_10[NUM_POWERS_10],
- exp10 += NUM_POWERS_10;
- if (exp10 < 0)
- dval /= powers_10[-exp10];
+ while (exp10 < -NUM_POWERS_10)
+ dval /= powers_10[NUM_POWERS_10],
+ exp10 += NUM_POWERS_10;
+ if (exp10 < 0)
+ dval /= powers_10[-exp10];
}
/*
* Check for an out-of-range result. Currently we don't check for
@@ -347,11 +347,11 @@ fe:
* but we should.
*/
if (dval >= 0) {
- if (dval > MAX_FLOAT)
- return_error(e_limitcheck);
+ if (dval > MAX_FLOAT)
+ return_error(e_limitcheck);
} else {
- if (dval < -MAX_FLOAT)
- return_error(e_limitcheck);
+ if (dval < -MAX_FLOAT)
+ return_error(e_limitcheck);
}
rret:
make_real(pref, dval);
diff --git a/gs/psi/iscannum.h b/gs/psi/iscannum.h
index 70b605eb3..99d0d323a 100644
--- a/gs/psi/iscannum.h
+++ b/gs/psi/iscannum.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,6 +23,6 @@
* Note that scan_number does not mark the result ref as "new".
*/
int scan_number(const byte * sp, const byte * end, int sign, ref * pref,
- const byte ** psp, int scanner_options);
+ const byte ** psp, int scanner_options);
#endif /* iscannum_INCLUDED */
diff --git a/gs/psi/isdata.h b/gs/psi/isdata.h
index 81e59c4dd..a0f689081 100644
--- a/gs/psi/isdata.h
+++ b/gs/psi/isdata.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -74,16 +74,16 @@ struct ref_stack_s {
/* Following are updated when adding or deleting blocks. */
s_ptr bot; /* bottommost valid element */
s_ptr top; /* topmost valid element = */
- /* bot + data_size */
+ /* bot + data_size */
ref current; /* t_array for current top block */
uint extension_size; /* total sizes of extn. blocks */
uint extension_used; /* total used sizes of extn. blocks */
/* Following are updated rarely. */
ref max_stack; /* t_integer, Max...Stack user param */
uint requested; /* amount of last failing */
- /* push or pop request */
+ /* push or pop request */
uint margin; /* # of slots to leave between limit */
- /* and top */
+ /* and top */
uint body_size; /* data_size - margin */
/* Following are set only at initialization. */
ref_stack_params_t *params;
diff --git a/gs/psi/isstate.h b/gs/psi/isstate.h
index 09f7af9d3..3cc05935e 100644
--- a/gs/psi/isstate.h
+++ b/gs/psi/isstate.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/istack.c b/gs/psi/istack.c
index 03ada954c..4276551ec 100644
--- a/gs/psi/istack.c
+++ b/gs/psi/istack.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,19 +28,19 @@
/* Forward references */
static void init_block(ref_stack_t *pstack, const ref *pblock_array,
- uint used);
+ uint used);
static int ref_stack_push_block(ref_stack_t *pstack, uint keep, uint add);
/* GC descriptors and procedures */
private_st_ref_stack_params();
-static
+static
CLEAR_MARKS_PROC(ref_stack_clear_marks)
{
ref_stack_t *const sptr = vptr;
r_clear_attrs(&sptr->current, l_mark);
}
-static
+static
ENUM_PTRS_WITH(ref_stack_enum_ptrs, ref_stack_t *sptr) return 0;
case 0: ENUM_RETURN_REF(&sptr->current);
case 1: return ENUM_OBJ(sptr->params);
@@ -71,8 +71,8 @@ public_st_ref_stack();
/* Initialize a stack. */
int
ref_stack_init(ref_stack_t *pstack, const ref *pblock_array,
- uint bot_guard, uint top_guard, const ref *pguard_value,
- gs_ref_memory_t *mem, ref_stack_params_t *params)
+ uint bot_guard, uint top_guard, const ref *pguard_value,
+ gs_ref_memory_t *mem, ref_stack_params_t *params)
{
uint size = r_size(pblock_array);
uint avail = size - (stack_block_refs + bot_guard + top_guard);
@@ -80,11 +80,11 @@ ref_stack_init(ref_stack_t *pstack, const ref *pblock_array,
s_ptr body = (s_ptr)(pblock + 1);
if (params == 0) {
- params = gs_alloc_struct((gs_memory_t *)mem, ref_stack_params_t,
- &st_ref_stack_params,
- "ref_stack_alloc(stack.params)");
- if (params == 0)
- return_error(-1); /* avoid binding in any error codes */
+ params = gs_alloc_struct((gs_memory_t *)mem, ref_stack_params_t,
+ &st_ref_stack_params,
+ "ref_stack_alloc(stack.params)");
+ if (params == 0)
+ return_error(-1); /* avoid binding in any error codes */
}
pstack->bot = body + bot_guard;
@@ -107,9 +107,9 @@ ref_stack_init(ref_stack_t *pstack, const ref *pblock_array,
params->block_size = size;
params->data_size = avail;
if (pguard_value != 0)
- params->guard_value = *pguard_value;
+ params->guard_value = *pguard_value;
else
- make_tav(&params->guard_value, t__invalid, 0, intval, 0);
+ make_tav(&params->guard_value, t__invalid, 0, intval, 0);
params->underflow_error = -1;
params->overflow_error = -1;
params->allow_expansion = true;
@@ -129,7 +129,7 @@ ref_stack_allow_expansion(ref_stack_t *pstack, bool expand)
/* Set the error codes for under- and overflow. The initial values are -1. */
void
ref_stack_set_error_codes(ref_stack_t *pstack, int underflow_error,
- int overflow_error)
+ int overflow_error)
{
pstack->params->underflow_error = underflow_error;
pstack->params->overflow_error = overflow_error;
@@ -142,14 +142,14 @@ ref_stack_set_max_count(ref_stack_t *pstack, long nmax)
uint nmin = ref_stack_count_inline(pstack);
if (nmax < nmin)
- nmax = nmin;
+ nmax = nmin;
if (nmax > max_uint / sizeof(ref))
- nmax = max_uint / sizeof(ref);
+ nmax = max_uint / sizeof(ref);
if (!pstack->params->allow_expansion) {
- uint ncur = pstack->body_size;
+ uint ncur = pstack->body_size;
- if (nmax > ncur)
- nmax = ncur;
+ if (nmax > ncur)
+ nmax = ncur;
}
pstack->max_stack.value.intval = nmax;
return 0;
@@ -166,18 +166,18 @@ ref_stack_set_margin(ref_stack_t *pstack, uint margin)
uint data_size = params->data_size;
if (margin <= pstack->margin) {
- refset_null_new(pstack->top + 1, pstack->margin - margin, 0);
+ refset_null_new(pstack->top + 1, pstack->margin - margin, 0);
} else {
- if (margin > data_size >> 1)
- return_error(e_rangecheck);
- if (pstack->top - pstack->p < margin) {
- uint used = pstack->p + 1 - pstack->bot;
- uint keep = data_size - margin;
- int code = ref_stack_push_block(pstack, keep, used - keep);
-
- if (code < 0)
- return code;
- }
+ if (margin > data_size >> 1)
+ return_error(e_rangecheck);
+ if (pstack->top - pstack->p < margin) {
+ uint used = pstack->p + 1 - pstack->bot;
+ uint keep = data_size - margin;
+ int code = ref_stack_push_block(pstack, keep, used - keep);
+
+ if (code < 0)
+ return code;
+ }
}
pstack->margin = margin;
pstack->body_size = data_size - margin;
@@ -203,16 +203,16 @@ ref_stack_index(const ref_stack_t *pstack, long idx)
uint used = pstack->p + 1 - pstack->bot;
if (idx < 0)
- return NULL;
+ return NULL;
if (idx < used) /* common case */
- return pstack->p - (uint) idx;
+ return pstack->p - (uint) idx;
pblock = (ref_stack_block *) pstack->current.value.refs;
do {
- pblock = (ref_stack_block *) pblock->next.value.refs;
- if (pblock == 0)
- return NULL;
- idx -= used;
- used = r_size(&pblock->used);
+ pblock = (ref_stack_block *) pblock->next.value.refs;
+ if (pblock == 0)
+ return NULL;
+ idx -= used;
+ used = r_size(&pblock->used);
} while (idx >= used);
return pblock->used.value.refs + (used - 1 - (uint) idx);
}
@@ -229,13 +229,13 @@ ref_stack_counttomark(const ref_stack_t *pstack)
ref_stack_enum_begin(&rsenum, pstack);
do {
- uint count = rsenum.size;
- const ref *p = rsenum.ptr + count - 1;
+ uint count = rsenum.size;
+ const ref *p = rsenum.ptr + count - 1;
- for (; count; count--, p--)
- if (r_has_type(p, t_mark))
- return scanned + (rsenum.size - count + 1);
- scanned += rsenum.size;
+ for (; count; count--, p--)
+ if (r_has_type(p, t_mark))
+ return scanned + (rsenum.size - count + 1);
+ scanned += rsenum.size;
} while (ref_stack_enum_next(&rsenum));
return 0;
}
@@ -246,37 +246,37 @@ ref_stack_counttomark(const ref_stack_t *pstack)
*/
int
ref_stack_store_check(const ref_stack_t *pstack, ref *parray, uint count,
- uint skip)
+ uint skip)
{
uint space = r_space(parray);
if (space != avm_local) {
- uint left = count, pass = skip;
- ref_stack_enum_t rsenum;
-
- ref_stack_enum_begin(&rsenum, pstack);
- do {
- ref *ptr = rsenum.ptr;
- uint size = rsenum.size;
-
- if (size <= pass)
- pass -= size;
- else {
- int code;
-
- if (pass != 0)
- size -= pass, pass = 0;
- ptr += size;
- if (size > left)
- size = left;
- left -= size;
- code = refs_check_space(ptr - size, size, space);
- if (code < 0)
- return code;
- if (left == 0)
- break;
- }
- } while (ref_stack_enum_next(&rsenum));
+ uint left = count, pass = skip;
+ ref_stack_enum_t rsenum;
+
+ ref_stack_enum_begin(&rsenum, pstack);
+ do {
+ ref *ptr = rsenum.ptr;
+ uint size = rsenum.size;
+
+ if (size <= pass)
+ pass -= size;
+ else {
+ int code;
+
+ if (pass != 0)
+ size -= pass, pass = 0;
+ ptr += size;
+ if (size > left)
+ size = left;
+ left -= size;
+ code = refs_check_space(ptr - size, size, space);
+ if (code < 0)
+ return code;
+ if (left == 0)
+ break;
+ }
+ } while (ref_stack_enum_next(&rsenum));
}
return 0;
}
@@ -290,60 +290,60 @@ ref_stack_store_check(const ref_stack_t *pstack, ref *parray, uint count,
#undef idmemory /****** NOTA BENE ******/
int
ref_stack_store(const ref_stack_t *pstack, ref *parray, uint count,
- uint skip, int age, bool check, gs_dual_memory_t *idmemory,
- client_name_t cname)
+ uint skip, int age, bool check, gs_dual_memory_t *idmemory,
+ client_name_t cname)
{
uint left, pass;
ref *to;
ref_stack_enum_t rsenum;
if (count > ref_stack_count(pstack) || count > r_size(parray))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (check) {
- int code = ref_stack_store_check(pstack, parray, count, skip);
+ int code = ref_stack_store_check(pstack, parray, count, skip);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
to = parray->value.refs + count;
left = count, pass = skip;
ref_stack_enum_begin(&rsenum, pstack);
do {
- ref *from = rsenum.ptr;
- uint size = rsenum.size;
-
- if (size <= pass)
- pass -= size;
- else {
- if (pass != 0)
- size -= pass, pass = 0;
- from += size;
- if (size > left)
- size = left;
- left -= size;
- switch (age) {
- case -1: /* not an array */
- while (size--) {
- from--, to--;
- ref_assign(to, from);
- }
- break;
- case 0: /* old array */
- while (size--) {
- from--, to--;
- ref_assign_old(parray, to, from, cname);
- }
- break;
- case 1: /* new array */
- while (size--) {
- from--, to--;
- ref_assign_new(to, from);
- }
- break;
- }
- if (left == 0)
- break;
- }
+ ref *from = rsenum.ptr;
+ uint size = rsenum.size;
+
+ if (size <= pass)
+ pass -= size;
+ else {
+ if (pass != 0)
+ size -= pass, pass = 0;
+ from += size;
+ if (size > left)
+ size = left;
+ left -= size;
+ switch (age) {
+ case -1: /* not an array */
+ while (size--) {
+ from--, to--;
+ ref_assign(to, from);
+ }
+ break;
+ case 0: /* old array */
+ while (size--) {
+ from--, to--;
+ ref_assign_old(parray, to, from, cname);
+ }
+ break;
+ case 1: /* new array */
+ while (size--) {
+ from--, to--;
+ ref_assign_new(to, from);
+ }
+ break;
+ }
+ if (left == 0)
+ break;
+ }
} while (ref_stack_enum_next(&rsenum));
r_set_size(parray, count);
return 0;
@@ -359,9 +359,9 @@ ref_stack_pop(ref_stack_t *pstack, uint count)
uint used;
while ((used = pstack->p + 1 - pstack->bot) < count) {
- count -= used;
- pstack->p = pstack->bot - 1;
- ref_stack_pop_block(pstack);
+ count -= used;
+ pstack->p = pstack->bot - 1;
+ ref_stack_pop_block(pstack);
}
pstack->p -= count;
}
@@ -381,7 +381,7 @@ ref_stack_pop_block(ref_stack_t *pstack)
ref next;
if (pnext == 0)
- return_error(pstack->params->underflow_error);
+ return_error(pstack->params->underflow_error);
used = r_size(&pnext->used);
body = (ref *) (pnext + 1) + pstack->params->bot_guard;
next = pcur->next;
@@ -394,41 +394,41 @@ ref_stack_pop_block(ref_stack_t *pstack)
* top block.
*/
if (used + count > pstack->body_size) {
- /*
- * The contents of the two blocks won't fit into a single block.
- * On the assumption that we're recovering from a local stack
- * underflow and need to increase the number of contiguous
- * elements available, move up the used part of the top block, and
- * copy up as much of the contents of the next block under it as
- * will fit.
- */
- uint moved = pstack->body_size - count;
- uint left;
-
- if (moved == 0)
- return_error(e_Fatal);
- memmove(bot + moved, bot, count * sizeof(ref));
- left = used - moved;
- memcpy(bot, body + left, moved * sizeof(ref));
- refset_null_new(body + left, moved, 0);
- r_dec_size(&pnext->used, moved);
- pstack->p = pstack->top;
- pstack->extension_used -= moved;
+ /*
+ * The contents of the two blocks won't fit into a single block.
+ * On the assumption that we're recovering from a local stack
+ * underflow and need to increase the number of contiguous
+ * elements available, move up the used part of the top block, and
+ * copy up as much of the contents of the next block under it as
+ * will fit.
+ */
+ uint moved = pstack->body_size - count;
+ uint left;
+
+ if (moved == 0)
+ return_error(e_Fatal);
+ memmove(bot + moved, bot, count * sizeof(ref));
+ left = used - moved;
+ memcpy(bot, body + left, moved * sizeof(ref));
+ refset_null_new(body + left, moved, 0);
+ r_dec_size(&pnext->used, moved);
+ pstack->p = pstack->top;
+ pstack->extension_used -= moved;
} else {
- /*
- * The contents of the two blocks will fit into a single block.
- * Copy the used part of the top block to the top of the next
- * block, and free the top block.
- */
- memcpy(body + used, bot, count * sizeof(ref));
- pstack->bot = bot = body;
- pstack->top = bot + pstack->body_size - 1;
- gs_free_ref_array(pstack->memory, &pstack->current,
- "ref_stack_pop_block");
- pstack->current = next;
- pstack->p = bot + (used + count - 1);
- pstack->extension_size -= pstack->body_size;
- pstack->extension_used -= used;
+ /*
+ * The contents of the two blocks will fit into a single block.
+ * Copy the used part of the top block to the top of the next
+ * block, and free the top block.
+ */
+ memcpy(body + used, bot, count * sizeof(ref));
+ pstack->bot = bot = body;
+ pstack->top = bot + pstack->body_size - 1;
+ gs_free_ref_array(pstack->memory, &pstack->current,
+ "ref_stack_pop_block");
+ pstack->current = next;
+ pstack->p = bot + (used + count - 1);
+ pstack->extension_size -= pstack->body_size;
+ pstack->extension_used -= used;
}
return 0;
}
@@ -445,11 +445,11 @@ ref_stack_extend(ref_stack_t *pstack, uint request)
const ref_stack_params_t *params = pstack->params;
if (request > params->data_size)
- return_error(params->overflow_error);
+ return_error(params->overflow_error);
if (keep + request > pstack->body_size)
- keep = pstack->body_size - request;
+ keep = pstack->body_size - request;
if (keep > count)
- keep = count; /* required by ref_stack_push_block */
+ keep = count; /* required by ref_stack_push_block */
return ref_stack_push_block(pstack, keep, request);
}
@@ -469,18 +469,18 @@ ref_stack_push(ref_stack_t *pstack, uint count)
uint added;
for (; (added = pstack->top - pstack->p) < needed; needed -= added) {
- int code;
-
- pstack->p = pstack->top;
- code = ref_stack_push_block(pstack,
- (pstack->top - pstack->bot + 1) / 3,
- added);
- if (code < 0) {
- /* Back out. */
- ref_stack_pop(pstack, count - needed + added);
- pstack->requested = count;
- return code;
- }
+ int code;
+
+ pstack->p = pstack->top;
+ code = ref_stack_push_block(pstack,
+ (pstack->top - pstack->bot + 1) / 3,
+ added);
+ if (code < 0) {
+ /* Back out. */
+ ref_stack_pop(pstack, count - needed + added);
+ pstack->requested = count;
+ return code;
+ }
}
pstack->p += needed;
return 0;
@@ -505,18 +505,18 @@ ref_stack_push_block(ref_stack_t *pstack, uint keep, uint add)
int code;
if (keep > count)
- return_error(e_Fatal);
+ return_error(e_Fatal);
/* Check for overflowing the maximum size, */
/* or expansion not allowed. */
if (pstack->extension_used + (pstack->top - pstack->bot) + add >=
- pstack->max_stack.value.intval ||
- !params->allow_expansion
- )
- return_error(params->overflow_error);
+ pstack->max_stack.value.intval ||
+ !params->allow_expansion
+ )
+ return_error(params->overflow_error);
code = gs_alloc_ref_array(pstack->memory, &next, 0,
- params->block_size, "ref_stack_push_block");
+ params->block_size, "ref_stack_push_block");
if (code < 0)
- return code;
+ return code;
pnext = (ref_stack_block *) next.value.refs;
body = (ref *) (pnext + 1);
/* Copy the top keep elements into the new block, */
@@ -553,10 +553,10 @@ bool
ref_stack_enum_next(ref_stack_enum_t *prse)
{
ref_stack_block *block =
- prse->block = (ref_stack_block *)prse->block->next.value.refs;
+ prse->block = (ref_stack_block *)prse->block->next.value.refs;
if (block == 0)
- return false;
+ return false;
prse->ptr = block->used.value.refs;
prse->size = r_size(&block->used);
return true;
@@ -567,7 +567,7 @@ void
ref_stack_cleanup(ref_stack_t *pstack)
{
ref_stack_block *pblock =
- (ref_stack_block *) pstack->current.value.refs;
+ (ref_stack_block *) pstack->current.value.refs;
refset_null_new(pstack->p + 1, pstack->top - pstack->p, 0);
pblock->used = pstack->current; /* set attrs */
@@ -588,7 +588,7 @@ ref_stack_release(ref_stack_t *pstack)
ref_stack_clear(pstack);
/* Free the parameter structure. */
gs_free_object((gs_memory_t *)mem, pstack->params,
- "ref_stack_release(stack.params)");
+ "ref_stack_release(stack.params)");
/* Free the original (bottom) block. */
gs_free_ref_array(mem, &pstack->current, "ref_stack_release");
}
@@ -617,24 +617,24 @@ init_block(ref_stack_t *pstack, const ref *psb, uint used)
ref *p;
for (i = params->bot_guard, p = brefs + stack_block_refs;
- i != 0; i--, p++
- )
- ref_assign(p, &params->guard_value);
+ i != 0; i--, p++
+ )
+ ref_assign(p, &params->guard_value);
/* The top guard elements will never be read, */
/* but we need to initialize them for the sake of the GC. */
/* We can use refset_null for this, because even though it uses */
/* make_null_new and stack elements must not be marked new, */
/* these slots will never actually be read or written. */
if (params->top_guard) {
- ref *top = brefs + r_size(psb);
- int top_guard = params->top_guard;
+ ref *top = brefs + r_size(psb);
+ int top_guard = params->top_guard;
- refset_null_new(top - top_guard, top_guard, 0);
+ refset_null_new(top - top_guard, top_guard, 0);
} {
- ref_stack_block *const pblock = (ref_stack_block *) brefs;
+ ref_stack_block *const pblock = (ref_stack_block *) brefs;
- pblock->used = *psb;
- pblock->used.value.refs = brefs + stack_block_refs + params->bot_guard;
- r_set_size(&pblock->used, 0);
+ pblock->used = *psb;
+ pblock->used.value.refs = brefs + stack_block_refs + params->bot_guard;
+ r_set_size(&pblock->used, 0);
}
}
diff --git a/gs/psi/istack.h b/gs/psi/istack.h
index c5a39f94d..a315ba6bf 100644
--- a/gs/psi/istack.h
+++ b/gs/psi/istack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -61,16 +61,16 @@ typedef struct ref_stack_block_s {
* structure iff params is not NULL.
*/
int ref_stack_init(ref_stack_t *pstack, const ref *pblock_array,
- uint bot_guard, uint top_guard,
- const ref *pguard_value, gs_ref_memory_t *mem,
- ref_stack_params_t *params);
+ uint bot_guard, uint top_guard,
+ const ref *pguard_value, gs_ref_memory_t *mem,
+ ref_stack_params_t *params);
/* Set whether a stack is allowed to expand. The initial value is true. */
void ref_stack_allow_expansion(ref_stack_t *pstack, bool expand);
/* Set the error codes for under- and overflow. The initial values are -1. */
void ref_stack_set_error_codes(ref_stack_t *pstack, int underflow_error,
- int overflow_error);
+ int overflow_error);
/*
* Set the maximum number of elements allowed on a stack.
@@ -111,7 +111,7 @@ uint ref_stack_counttomark(const ref_stack_t *pstack);
* 'skip' elements below the top, into an array. Return 0 or e_invalidaccess.
*/
int ref_stack_store_check(const ref_stack_t *pstack, ref *parray,
- uint count, uint skip);
+ uint count, uint skip);
/*
* Store the top 'count' elements of a stack, starting 'skip' elements below
@@ -124,8 +124,8 @@ int ref_stack_store_check(const ref_stack_t *pstack, ref *parray,
typedef struct gs_dual_memory_s gs_dual_memory_t;
#endif
int ref_stack_store(const ref_stack_t *pstack, ref *parray, uint count,
- uint skip, int age, bool check,
- gs_dual_memory_t *idmem, client_name_t cname);
+ uint skip, int age, bool check,
+ gs_dual_memory_t *idmem, client_name_t cname);
/*
* Pop the top N elements off a stack.
diff --git a/gs/psi/istkparm.h b/gs/psi/istkparm.h
index de19da625..48f108433 100644
--- a/gs/psi/istkparm.h
+++ b/gs/psi/istkparm.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,7 +27,7 @@ struct ref_stack_params_s {
uint block_size; /* size of each block */
uint data_size; /* # of data slots in each block */
ref guard_value; /* t__invalid or t_operator, */
- /* bottom guard value */
+ /* bottom guard value */
int underflow_error; /* error code for underflow */
int overflow_error; /* error code for overflow */
bool allow_expansion; /* if false, don't expand */
diff --git a/gs/psi/istream.h b/gs/psi/istream.h
index 9ff97a1d9..6ff278802 100644
--- a/gs/psi/istream.h
+++ b/gs/psi/istream.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,15 +20,15 @@
/* Procedures exported by zfproc.c */
- /* for zfilter.c - procedure stream initialization */
+ /* for zfilter.c - procedure stream initialization */
int sread_proc(ref *, stream **, gs_ref_memory_t *);
int swrite_proc(ref *, stream **, gs_ref_memory_t *);
- /* for interp.c, zfileio.c, zpaint.c - handle a procedure */
- /* callback or an interrupt */
+ /* for interp.c, zfileio.c, zpaint.c - handle a procedure */
+ /* callback or an interrupt */
int s_handle_read_exception(i_ctx_t *, int, const ref *, const ref *,
- int, op_proc_t);
+ int, op_proc_t);
int s_handle_write_exception(i_ctx_t *, int, const ref *, const ref *,
- int, op_proc_t);
+ int, op_proc_t);
#endif /* istream_INCLUDED */
diff --git a/gs/psi/istruct.h b/gs/psi/istruct.h
index 41f9db78e..6036e399e 100644
--- a/gs/psi/istruct.h
+++ b/gs/psi/istruct.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/iutil.c b/gs/psi/iutil.c
index de344994b..ca9ce300b 100644
--- a/gs/psi/iutil.c
+++ b/gs/psi/iutil.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,28 +51,28 @@ const byte ref_type_properties[] = {
/* Copy refs from one place to another. */
int
refcpy_to_old(ref * aref, uint index, const ref * from,
- uint size, gs_dual_memory_t *idmemory, client_name_t cname)
+ uint size, gs_dual_memory_t *idmemory, client_name_t cname)
{
ref *to = aref->value.refs + index;
int code = refs_check_space(from, size, r_space(aref));
if (code < 0)
- return code;
+ return code;
/* We have to worry about aliasing.... */
if (to <= from || from + size <= to)
- while (size--)
- ref_assign_old(aref, to, from, cname), to++, from++;
+ while (size--)
+ ref_assign_old(aref, to, from, cname), to++, from++;
else
- for (from += size, to += size; size--;)
- from--, to--, ref_assign_old(aref, to, from, cname);
+ for (from += size, to += size; size--;)
+ from--, to--, ref_assign_old(aref, to, from, cname);
return 0;
}
void
refcpy_to_new(ref * to, const ref * from, uint size,
- gs_dual_memory_t *idmemory)
+ gs_dual_memory_t *idmemory)
{
while (size--)
- ref_assign_new(to, from), to++, from++;
+ ref_assign_new(to, from), to++, from++;
}
/* Fill a new object with nulls. */
@@ -80,107 +80,107 @@ void
refset_null_new(ref * to, uint size, uint new_mask)
{
for (; size--; ++to)
- make_ta(to, t_null, new_mask);
+ make_ta(to, t_null, new_mask);
}
/* Compare two objects for equality. */
static bool fid_eq(const gs_memory_t *mem, const gs_font *pfont1,
- const gs_font *pfont2);
+ const gs_font *pfont2);
bool
obj_eq(const gs_memory_t *mem, const ref * pref1, const ref * pref2)
{
ref nref;
if (r_type(pref1) != r_type(pref2)) {
- /*
- * Only a few cases need be considered here:
- * integer/real (and vice versa), name/string (and vice versa),
- * arrays, and extended operators.
- */
- switch (r_type(pref1)) {
- case t_integer:
- return (r_has_type(pref2, t_real) &&
- pref2->value.realval == pref1->value.intval);
- case t_real:
- return (r_has_type(pref2, t_integer) &&
- pref2->value.intval == pref1->value.realval);
- case t_name:
- if (!r_has_type(pref2, t_string))
- return false;
- name_string_ref(mem, pref1, &nref);
- pref1 = &nref;
- break;
- case t_string:
- if (!r_has_type(pref2, t_name))
- return false;
- name_string_ref(mem, pref2, &nref);
- pref2 = &nref;
- break;
- /*
- * Differing implementations of packedarray can be eq,
- * if the length is zero, but an array is never eq to a
- * packedarray.
- */
- case t_mixedarray:
- case t_shortarray:
- /*
- * Since r_type(pref1) is one of the above, this is a
- * clever fast check for r_type(pref2) being the other.
- */
- return ((int)r_type(pref1) + (int)r_type(pref2) ==
- t_mixedarray + t_shortarray) &&
- r_size(pref1) == 0 && r_size(pref2) == 0;
- default:
- if (r_btype(pref1) != r_btype(pref2))
- return false;
- }
+ /*
+ * Only a few cases need be considered here:
+ * integer/real (and vice versa), name/string (and vice versa),
+ * arrays, and extended operators.
+ */
+ switch (r_type(pref1)) {
+ case t_integer:
+ return (r_has_type(pref2, t_real) &&
+ pref2->value.realval == pref1->value.intval);
+ case t_real:
+ return (r_has_type(pref2, t_integer) &&
+ pref2->value.intval == pref1->value.realval);
+ case t_name:
+ if (!r_has_type(pref2, t_string))
+ return false;
+ name_string_ref(mem, pref1, &nref);
+ pref1 = &nref;
+ break;
+ case t_string:
+ if (!r_has_type(pref2, t_name))
+ return false;
+ name_string_ref(mem, pref2, &nref);
+ pref2 = &nref;
+ break;
+ /*
+ * Differing implementations of packedarray can be eq,
+ * if the length is zero, but an array is never eq to a
+ * packedarray.
+ */
+ case t_mixedarray:
+ case t_shortarray:
+ /*
+ * Since r_type(pref1) is one of the above, this is a
+ * clever fast check for r_type(pref2) being the other.
+ */
+ return ((int)r_type(pref1) + (int)r_type(pref2) ==
+ t_mixedarray + t_shortarray) &&
+ r_size(pref1) == 0 && r_size(pref2) == 0;
+ default:
+ if (r_btype(pref1) != r_btype(pref2))
+ return false;
+ }
}
/*
* Now do a type-dependent comparison. This would be very simple if we
* always filled in all the bytes of a ref, but we currently don't.
*/
switch (r_btype(pref1)) {
- case t_array:
- return ((pref1->value.refs == pref2->value.refs ||
- r_size(pref1) == 0) &&
- r_size(pref1) == r_size(pref2));
- case t_mixedarray:
- case t_shortarray:
- return ((pref1->value.packed == pref2->value.packed ||
- r_size(pref1) == 0) &&
- r_size(pref1) == r_size(pref2));
- case t_boolean:
- return (pref1->value.boolval == pref2->value.boolval);
- case t_dictionary:
- return (pref1->value.pdict == pref2->value.pdict);
- case t_file:
- return (pref1->value.pfile == pref2->value.pfile &&
- r_size(pref1) == r_size(pref2));
- case t_integer:
- return (pref1->value.intval == pref2->value.intval);
- case t_mark:
- case t_null:
- return true;
- case t_name:
- return (pref1->value.pname == pref2->value.pname);
- case t_oparray:
- case t_operator:
- return (op_index(pref1) == op_index(pref2));
- case t_real:
- return (pref1->value.realval == pref2->value.realval);
- case t_save:
- return (pref2->value.saveid == pref1->value.saveid);
- case t_string:
- return (!bytes_compare(pref1->value.bytes, r_size(pref1),
- pref2->value.bytes, r_size(pref2)));
- case t_device:
- return (pref1->value.pdevice == pref2->value.pdevice);
- case t_struct:
- case t_astruct:
- return (pref1->value.pstruct == pref2->value.pstruct);
- case t_fontID:
- /* This is complicated enough to deserve a separate procedure. */
- return fid_eq(mem, r_ptr(pref1, gs_font), r_ptr(pref2, gs_font));
+ case t_array:
+ return ((pref1->value.refs == pref2->value.refs ||
+ r_size(pref1) == 0) &&
+ r_size(pref1) == r_size(pref2));
+ case t_mixedarray:
+ case t_shortarray:
+ return ((pref1->value.packed == pref2->value.packed ||
+ r_size(pref1) == 0) &&
+ r_size(pref1) == r_size(pref2));
+ case t_boolean:
+ return (pref1->value.boolval == pref2->value.boolval);
+ case t_dictionary:
+ return (pref1->value.pdict == pref2->value.pdict);
+ case t_file:
+ return (pref1->value.pfile == pref2->value.pfile &&
+ r_size(pref1) == r_size(pref2));
+ case t_integer:
+ return (pref1->value.intval == pref2->value.intval);
+ case t_mark:
+ case t_null:
+ return true;
+ case t_name:
+ return (pref1->value.pname == pref2->value.pname);
+ case t_oparray:
+ case t_operator:
+ return (op_index(pref1) == op_index(pref2));
+ case t_real:
+ return (pref1->value.realval == pref2->value.realval);
+ case t_save:
+ return (pref2->value.saveid == pref1->value.saveid);
+ case t_string:
+ return (!bytes_compare(pref1->value.bytes, r_size(pref1),
+ pref2->value.bytes, r_size(pref2)));
+ case t_device:
+ return (pref1->value.pdevice == pref2->value.pdevice);
+ case t_struct:
+ case t_astruct:
+ return (pref1->value.pstruct == pref2->value.pstruct);
+ case t_fontID:
+ /* This is complicated enough to deserve a separate procedure. */
+ return fid_eq(mem, r_ptr(pref1, gs_font), r_ptr(pref2, gs_font));
}
return false; /* shouldn't happen! */
}
@@ -199,46 +199,46 @@ static bool
fid_eq(const gs_memory_t *mem, const gs_font *pfont1, const gs_font *pfont2)
{
while (pfont1->base != pfont1)
- pfont1 = pfont1->base;
+ pfont1 = pfont1->base;
while (pfont2->base != pfont2)
- pfont2 = pfont2->base;
+ pfont2 = pfont2->base;
if (pfont1 == pfont2)
- return true;
+ return true;
switch (pfont1->FontType) {
case 1: case 3:
- if (pfont1->FontType == pfont2->FontType)
- break;
+ if (pfont1->FontType == pfont2->FontType)
+ break;
default:
- return false;
+ return false;
}
/* The following, while peculiar, appears to match CPSI. */
{
- const gs_uid *puid1 = &((const gs_font_base *)pfont1)->UID;
- const gs_uid *puid2 = &((const gs_font_base *)pfont2)->UID;
+ const gs_uid *puid1 = &((const gs_font_base *)pfont1)->UID;
+ const gs_uid *puid2 = &((const gs_font_base *)pfont2)->UID;
if (uid_is_UniqueID(puid1) || uid_is_UniqueID(puid2) ||
- ((uid_is_XUID(puid1) || uid_is_XUID(puid2)) &&
- !uid_equal(puid1, puid2)))
- return false;
+ ((uid_is_XUID(puid1) || uid_is_XUID(puid2)) &&
+ !uid_equal(puid1, puid2)))
+ return false;
}
{
- const font_data *pfd1 = (const font_data *)pfont1->client_data;
- const font_data *pfd2 = (const font_data *)pfont2->client_data;
-
- if (!(obj_eq(mem, &pfd1->BuildChar, &pfd2->BuildChar) &&
- obj_eq(mem, &pfd1->BuildGlyph, &pfd2->BuildGlyph) &&
- obj_eq(mem, &pfd1->Encoding, &pfd2->Encoding) &&
- obj_eq(mem, &pfd1->CharStrings, &pfd2->CharStrings)))
- return false;
- if (pfont1->FontType == 1) {
- ref *ppd1, *ppd2;
-
- if (dict_find_string(&pfd1->dict, "Private", &ppd1) > 0 &&
- dict_find_string(&pfd2->dict, "Private", &ppd2) > 0 &&
- !obj_eq(mem, ppd1, ppd2))
- return false;
- }
+ const font_data *pfd1 = (const font_data *)pfont1->client_data;
+ const font_data *pfd2 = (const font_data *)pfont2->client_data;
+
+ if (!(obj_eq(mem, &pfd1->BuildChar, &pfd2->BuildChar) &&
+ obj_eq(mem, &pfd1->BuildGlyph, &pfd2->BuildGlyph) &&
+ obj_eq(mem, &pfd1->Encoding, &pfd2->Encoding) &&
+ obj_eq(mem, &pfd1->CharStrings, &pfd2->CharStrings)))
+ return false;
+ if (pfont1->FontType == 1) {
+ ref *ppd1, *ppd2;
+
+ if (dict_find_string(&pfd1->dict, "Private", &ppd1) > 0 &&
+ dict_find_string(&pfd2->dict, "Private", &ppd2) > 0 &&
+ !obj_eq(mem, ppd1, ppd2))
+ return false;
+ }
}
- return true;
+ return true;
}
/* Compare two objects for identity. */
@@ -246,10 +246,10 @@ bool
obj_ident_eq(const gs_memory_t *mem, const ref * pref1, const ref * pref2)
{
if (r_type(pref1) != r_type(pref2))
- return false;
+ return false;
if (r_has_type(pref1, t_string))
- return (pref1->value.bytes == pref2->value.bytes &&
- r_size(pref1) == r_size(pref2));
+ return (pref1->value.bytes == pref2->value.bytes &&
+ r_size(pref1) == r_size(pref2));
return obj_eq(mem, pref1, pref2);
}
@@ -263,20 +263,20 @@ obj_string_data(const gs_memory_t *mem, const ref *op, const byte **pchars, uint
{
switch (r_type(op)) {
case t_name: {
- ref nref;
+ ref nref;
- name_string_ref(mem, op, &nref);
- *pchars = nref.value.bytes;
- *plen = r_size(&nref);
- return 0;
+ name_string_ref(mem, op, &nref);
+ *pchars = nref.value.bytes;
+ *plen = r_size(&nref);
+ return 0;
}
case t_string:
- check_read(*op);
- *pchars = op->value.bytes;
- *plen = r_size(op);
- return 0;
+ check_read(*op);
+ *pchars = op->value.bytes;
+ *plen = r_size(op);
+ return 0;
default:
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
}
@@ -289,7 +289,7 @@ obj_string_data(const gs_memory_t *mem, const ref *op, const byte **pchars, uint
* output position -- the first start_pos bytes of output are discarded.
*
* When (restart = false) return e_rangecheck the when destination wasn't
- * large enough without modifying the destination. This is needed for
+ * large enough without modifying the destination. This is needed for
* compatibility with Adobe implementation of cvs and cvrs, which don't
* change the destination string on failure.
*
@@ -304,7 +304,7 @@ obj_string_data(const gs_memory_t *mem, const ref *op, const byte **pchars, uint
static void ensure_dot(char *);
int
obj_cvp(const ref * op, byte * str, uint len, uint * prlen,
- int full_print, uint start_pos, const gs_memory_t *mem, bool restart)
+ int full_print, uint start_pos, const gs_memory_t *mem, bool restart)
{
char buf[50]; /* big enough for any float, double, or struct name */
const byte *data = (const byte *)buf;
@@ -313,245 +313,245 @@ obj_cvp(const ref * op, byte * str, uint len, uint * prlen,
ref nref;
if (full_print) {
- static const char * const type_strings[] = { REF_TYPE_PRINT_STRINGS };
-
- switch (r_btype(op)) {
- case t_boolean:
- case t_integer:
- break;
- case t_real: {
- /*
- * To get fully accurate output results for IEEE
- * single-precision floats (24 bits of mantissa), the ANSI %g
- * default of 6 digits is not enough; 9 are needed.
- * Unfortunately, using %.9g for floats (as opposed to doubles)
- * produces unfortunate artifacts such as 0.01 5 mul printing as
- * 0.049999997. Therefore, we print using %g, and if the result
- * isn't accurate enough, print again using %.9g.
- * Unfortunately, a few PostScript programs 'know' that the
- * printed representation of floats fits into 6 digits (e.g.,
- * with cvs). We resolve this by letting cvs, cvrs, and = do
- * what the Adobe interpreters appear to do (use %g), and only
- * produce accurate output for ==, for which there is no
- * analogue of cvs. What a hack!
- */
- float value = op->value.realval;
- float scanned;
-
- sprintf(buf, "%g", value);
- sscanf(buf, "%f", &scanned);
- if (scanned != value)
- sprintf(buf, "%.9g", value);
- ensure_dot(buf);
- goto rs;
- }
- case t_operator:
- case t_oparray:
- code = obj_cvp(op, (byte *)buf + 2, sizeof(buf) - 4, &size, 0, 0, mem, restart);
- if (code < 0)
- return code;
- buf[0] = buf[1] = buf[size + 2] = buf[size + 3] = '-';
- size += 4;
- goto nl;
- case t_name:
- if (r_has_attr(op, a_executable)) {
- code = obj_string_data(mem, op, &data, &size);
- if (code < 0)
- return code;
- goto nl;
- }
- if (start_pos > 0)
- return obj_cvp(op, str, len, prlen, 0, start_pos - 1, mem, restart);
- if (len < 1)
- return_error(e_rangecheck);
- code = obj_cvp(op, str + 1, len - 1, prlen, 0, 0, mem, restart);
- if (code < 0)
- return code;
- str[0] = '/';
- ++*prlen;
- return code;
- case t_null:
- data = (const byte *)"null";
- goto rs;
- case t_string:
- if (!r_has_attr(op, a_read))
- goto other;
- size = r_size(op);
- {
- bool truncate = (full_print == 1 && size > CVP_MAX_STRING);
- stream_cursor_read r;
- stream_cursor_write w;
- uint skip;
- byte *wstr;
- uint len1;
- int status = 1;
-
- if (start_pos == 0) {
- if (len < 1)
- return_error(e_rangecheck);
- str[0] = '(';
- skip = 0;
- wstr = str + 1;
- } else {
- skip = start_pos - 1;
- wstr = str;
- }
- len1 = len + (str - wstr);
- r.ptr = op->value.const_bytes - 1;
- r.limit = r.ptr + (truncate ? CVP_MAX_STRING : size);
- while (skip && status == 1) {
- uint written;
-
- w.ptr = (byte *)buf - 1;
- w.limit = w.ptr + min(skip + len1, sizeof(buf));
- status = s_PSSE_template.process(NULL, &r, &w, false);
- written = w.ptr - ((byte *)buf - 1);
- if (written > skip) {
- written -= skip;
- memcpy(wstr, buf + skip, written);
- wstr += written;
- skip = 0;
- break;
- }
- skip -= written;
- }
- /*
- * We can reach here with status == 0 (and skip != 0) if
- * start_pos lies within the trailing ")" or "...)".
- */
- if (status == 0) {
+ static const char * const type_strings[] = { REF_TYPE_PRINT_STRINGS };
+
+ switch (r_btype(op)) {
+ case t_boolean:
+ case t_integer:
+ break;
+ case t_real: {
+ /*
+ * To get fully accurate output results for IEEE
+ * single-precision floats (24 bits of mantissa), the ANSI %g
+ * default of 6 digits is not enough; 9 are needed.
+ * Unfortunately, using %.9g for floats (as opposed to doubles)
+ * produces unfortunate artifacts such as 0.01 5 mul printing as
+ * 0.049999997. Therefore, we print using %g, and if the result
+ * isn't accurate enough, print again using %.9g.
+ * Unfortunately, a few PostScript programs 'know' that the
+ * printed representation of floats fits into 6 digits (e.g.,
+ * with cvs). We resolve this by letting cvs, cvrs, and = do
+ * what the Adobe interpreters appear to do (use %g), and only
+ * produce accurate output for ==, for which there is no
+ * analogue of cvs. What a hack!
+ */
+ float value = op->value.realval;
+ float scanned;
+
+ sprintf(buf, "%g", value);
+ sscanf(buf, "%f", &scanned);
+ if (scanned != value)
+ sprintf(buf, "%.9g", value);
+ ensure_dot(buf);
+ goto rs;
+ }
+ case t_operator:
+ case t_oparray:
+ code = obj_cvp(op, (byte *)buf + 2, sizeof(buf) - 4, &size, 0, 0, mem, restart);
+ if (code < 0)
+ return code;
+ buf[0] = buf[1] = buf[size + 2] = buf[size + 3] = '-';
+ size += 4;
+ goto nl;
+ case t_name:
+ if (r_has_attr(op, a_executable)) {
+ code = obj_string_data(mem, op, &data, &size);
+ if (code < 0)
+ return code;
+ goto nl;
+ }
+ if (start_pos > 0)
+ return obj_cvp(op, str, len, prlen, 0, start_pos - 1, mem, restart);
+ if (len < 1)
+ return_error(e_rangecheck);
+ code = obj_cvp(op, str + 1, len - 1, prlen, 0, 0, mem, restart);
+ if (code < 0)
+ return code;
+ str[0] = '/';
+ ++*prlen;
+ return code;
+ case t_null:
+ data = (const byte *)"null";
+ goto rs;
+ case t_string:
+ if (!r_has_attr(op, a_read))
+ goto other;
+ size = r_size(op);
+ {
+ bool truncate = (full_print == 1 && size > CVP_MAX_STRING);
+ stream_cursor_read r;
+ stream_cursor_write w;
+ uint skip;
+ byte *wstr;
+ uint len1;
+ int status = 1;
+
+ if (start_pos == 0) {
+ if (len < 1)
+ return_error(e_rangecheck);
+ str[0] = '(';
+ skip = 0;
+ wstr = str + 1;
+ } else {
+ skip = start_pos - 1;
+ wstr = str;
+ }
+ len1 = len + (str - wstr);
+ r.ptr = op->value.const_bytes - 1;
+ r.limit = r.ptr + (truncate ? CVP_MAX_STRING : size);
+ while (skip && status == 1) {
+ uint written;
+
+ w.ptr = (byte *)buf - 1;
+ w.limit = w.ptr + min(skip + len1, sizeof(buf));
+ status = s_PSSE_template.process(NULL, &r, &w, false);
+ written = w.ptr - ((byte *)buf - 1);
+ if (written > skip) {
+ written -= skip;
+ memcpy(wstr, buf + skip, written);
+ wstr += written;
+ skip = 0;
+ break;
+ }
+ skip -= written;
+ }
+ /*
+ * We can reach here with status == 0 (and skip != 0) if
+ * start_pos lies within the trailing ")" or "...)".
+ */
+ if (status == 0) {
#ifdef DEBUG
- if (skip > (truncate ? 4 : 1)) {
- return_error(e_Fatal);
- }
+ if (skip > (truncate ? 4 : 1)) {
+ return_error(e_Fatal);
+ }
#endif
- }
- w.ptr = wstr - 1;
- w.limit = str - 1 + len;
- if (status == 1)
- status = s_PSSE_template.process(NULL, &r, &w, false);
- *prlen = w.ptr - (str - 1);
- if (status != 0)
- return 1;
- if (truncate) {
- if (len - *prlen < 4 - skip)
- return 1;
- memcpy(w.ptr + 1, "...)" + skip, 4 - skip);
- *prlen += 4 - skip;
- } else {
- if (len - *prlen < 1 - skip)
- return 1;
- memcpy(w.ptr + 1, ")" + skip, 1 - skip);
- *prlen += 1 - skip;
- }
- }
- return 0;
- case t_astruct:
- case t_struct:
- if (r_is_foreign(op)) {
- /* gs_object_type may not work. */
- data = (const byte *)"-foreign-struct-";
- goto rs;
- }
- if (!mem) {
- data = (const byte *)"-(struct)-";
- goto rs;
- }
- data = (const byte *)
- gs_struct_type_name_string(
- gs_object_type(mem,
- (const obj_header_t *)op->value.pstruct));
- size = strlen((const char *)data);
- if (size > 4 && !memcmp(data + size - 4, "type", 4))
- size -= 4;
- if (size > sizeof(buf) - 2)
- return_error(e_rangecheck);
- buf[0] = '-';
- memcpy(buf + 1, data, size);
- buf[size + 1] = '-';
- size += 2;
- data = (const byte *)buf;
- goto nl;
- default:
+ }
+ w.ptr = wstr - 1;
+ w.limit = str - 1 + len;
+ if (status == 1)
+ status = s_PSSE_template.process(NULL, &r, &w, false);
+ *prlen = w.ptr - (str - 1);
+ if (status != 0)
+ return 1;
+ if (truncate) {
+ if (len - *prlen < 4 - skip)
+ return 1;
+ memcpy(w.ptr + 1, "...)" + skip, 4 - skip);
+ *prlen += 4 - skip;
+ } else {
+ if (len - *prlen < 1 - skip)
+ return 1;
+ memcpy(w.ptr + 1, ")" + skip, 1 - skip);
+ *prlen += 1 - skip;
+ }
+ }
+ return 0;
+ case t_astruct:
+ case t_struct:
+ if (r_is_foreign(op)) {
+ /* gs_object_type may not work. */
+ data = (const byte *)"-foreign-struct-";
+ goto rs;
+ }
+ if (!mem) {
+ data = (const byte *)"-(struct)-";
+ goto rs;
+ }
+ data = (const byte *)
+ gs_struct_type_name_string(
+ gs_object_type(mem,
+ (const obj_header_t *)op->value.pstruct));
+ size = strlen((const char *)data);
+ if (size > 4 && !memcmp(data + size - 4, "type", 4))
+ size -= 4;
+ if (size > sizeof(buf) - 2)
+ return_error(e_rangecheck);
+ buf[0] = '-';
+ memcpy(buf + 1, data, size);
+ buf[size + 1] = '-';
+ size += 2;
+ data = (const byte *)buf;
+ goto nl;
+ default:
other:
- {
- int rtype = r_btype(op);
-
- if (rtype >= countof(type_strings))
- return_error(e_rangecheck);
- data = (const byte *)type_strings[rtype];
- if (data == 0)
- return_error(e_rangecheck);
- }
- goto rs;
- }
- }
+ {
+ int rtype = r_btype(op);
+
+ if (rtype >= countof(type_strings))
+ return_error(e_rangecheck);
+ data = (const byte *)type_strings[rtype];
+ if (data == 0)
+ return_error(e_rangecheck);
+ }
+ goto rs;
+ }
+ }
/* full_print = 0 */
switch (r_btype(op)) {
case t_boolean:
- data = (const byte *)(op->value.boolval ? "true" : "false");
- break;
+ data = (const byte *)(op->value.boolval ? "true" : "false");
+ break;
case t_integer:
- sprintf(buf, "%d", op->value.intval);
- break;
+ sprintf(buf, "%d", op->value.intval);
+ break;
case t_string:
- check_read(*op);
- /* falls through */
+ check_read(*op);
+ /* falls through */
case t_name:
- code = obj_string_data(mem, op, &data, &size);
- if (code < 0)
- return code;
- goto nl;
+ code = obj_string_data(mem, op, &data, &size);
+ if (code < 0)
+ return code;
+ goto nl;
case t_oparray: {
- uint index = op_index(op);
- const op_array_table *opt = get_op_array(mem, index);
-
- name_index_ref(mem, opt->nx_table[index - opt->base_index], &nref);
- name_string_ref(mem, &nref, &nref);
- code = obj_string_data(mem, &nref, &data, &size);
- if (code < 0)
- return code;
- goto nl;
+ uint index = op_index(op);
+ const op_array_table *opt = get_op_array(mem, index);
+
+ name_index_ref(mem, opt->nx_table[index - opt->base_index], &nref);
+ name_string_ref(mem, &nref, &nref);
+ code = obj_string_data(mem, &nref, &data, &size);
+ if (code < 0)
+ return code;
+ goto nl;
}
case t_operator: {
- /* Recover the name from the initialization table. */
- uint index = op_index(op);
-
- /*
- * Check the validity of the index. (An out-of-bounds index
- * is only possible when examining an invalid object using
- * the debugger.)
- */
- if (index > 0 && index < op_def_count) {
- data = (const byte *)(op_index_def(index)->oname + 1);
- break;
- }
- /* Internal operator, no name. */
- sprintf(buf, "@0x%lx", (ulong) op->value.opproc);
- break;
+ /* Recover the name from the initialization table. */
+ uint index = op_index(op);
+
+ /*
+ * Check the validity of the index. (An out-of-bounds index
+ * is only possible when examining an invalid object using
+ * the debugger.)
+ */
+ if (index > 0 && index < op_def_count) {
+ data = (const byte *)(op_index_def(index)->oname + 1);
+ break;
+ }
+ /* Internal operator, no name. */
+ sprintf(buf, "@0x%lx", (ulong) op->value.opproc);
+ break;
}
case t_real:
- /*
- * The value 0.0001 is a boundary case that the Adobe interpreters
- * print in f-format but at least some gs versions print in
- * e-format, presumably because of differences in the underlying C
- * library implementation. Work around this here.
- */
- if (op->value.realval == (float)0.0001) {
- strcpy(buf, "0.0001");
- } else {
- sprintf(buf, "%g", op->value.realval);
- }
- ensure_dot(buf);
- break;
+ /*
+ * The value 0.0001 is a boundary case that the Adobe interpreters
+ * print in f-format but at least some gs versions print in
+ * e-format, presumably because of differences in the underlying C
+ * library implementation. Work around this here.
+ */
+ if (op->value.realval == (float)0.0001) {
+ strcpy(buf, "0.0001");
+ } else {
+ sprintf(buf, "%g", op->value.realval);
+ }
+ ensure_dot(buf);
+ break;
default:
- data = (const byte *)"--nostringval--";
+ data = (const byte *)"--nostringval--";
}
rs: size = strlen((const char *)data);
nl: if (size < start_pos)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (!restart && size > len)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
size -= start_pos;
*prlen = min(size, len);
memmove(str, data + start_pos, *prlen);
@@ -575,7 +575,7 @@ ensure_dot(char *buf)
else
sprintf(pe + 1, "-%02d", -i);
} else if (strchr(buf, '.') == NULL) {
- strcat(buf, ".0");
+ strcat(buf, ".0");
}
}
@@ -589,7 +589,7 @@ ensure_dot(char *buf)
*/
int
obj_cvs(const gs_memory_t *mem, const ref * op, byte * str, uint len, uint * prlen,
- const byte ** pchars)
+ const byte ** pchars)
{
int code = obj_cvp(op, str, len, prlen, 0, 0, mem, false); /* NB: NULL memptr */
@@ -598,9 +598,9 @@ obj_cvs(const gs_memory_t *mem, const ref * op, byte * str, uint len, uint * prl
obj_string_data(mem, op, pchars, prlen);
return gs_note_error(e_rangecheck);
} else {
- if (pchars)
+ if (pchars)
*pchars = str;
- return code;
+ return code;
}
}
@@ -613,11 +613,11 @@ op_find_index(const ref * pref /* t_operator */ )
const op_def *const *opend = opp + (op_def_count / OP_DEFS_MAX_SIZE);
for (; opp < opend; ++opp) {
- const op_def *def = *opp;
+ const op_def *def = *opp;
- for (; def->oname != 0; ++def)
- if (def->proc == proc)
- return (opp - op_defs_all) * OP_DEFS_MAX_SIZE + (def - *opp);
+ for (; def->oname != 0; ++def)
+ if (def->proc == proc)
+ return (opp - op_defs_all) * OP_DEFS_MAX_SIZE + (def - *opp);
}
/* Lookup failed! This isn't possible.... */
return 0;
@@ -634,13 +634,13 @@ op_index_ref(const gs_memory_t *mem, uint index, ref * pref)
const op_array_table *opt;
if (op_index_is_operator(index)) {
- make_oper(pref, index, op_index_proc(index));
- return;
+ make_oper(pref, index, op_index_proc(index));
+ return;
}
opt = get_op_array(mem, index);
make_tasv(pref, t_oparray, opt->attrs, index,
- const_refs, (opt->table.value.const_refs
- + index - opt->base_index));
+ const_refs, (opt->table.value.const_refs
+ + index - opt->base_index));
}
/* Get an element from an array of some kind. */
@@ -650,34 +650,34 @@ int
array_get(const gs_memory_t *mem, const ref * aref, long index_long, ref * pref)
{
if ((ulong)index_long >= r_size(aref))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
switch (r_type(aref)) {
- case t_array:
- {
- const ref *pvalue = aref->value.refs + index_long;
-
- ref_assign(pref, pvalue);
- }
- break;
- case t_mixedarray:
- {
- const ref_packed *packed = aref->value.packed;
- uint index = (uint)index_long;
-
- for (; index--;)
- packed = packed_next(packed);
- packed_get(mem, packed, pref);
- }
- break;
- case t_shortarray:
- {
- const ref_packed *packed = aref->value.packed + index_long;
-
- packed_get(mem, packed, pref);
- }
- break;
- default:
- return_error(e_typecheck);
+ case t_array:
+ {
+ const ref *pvalue = aref->value.refs + index_long;
+
+ ref_assign(pref, pvalue);
+ }
+ break;
+ case t_mixedarray:
+ {
+ const ref_packed *packed = aref->value.packed;
+ uint index = (uint)index_long;
+
+ for (; index--;)
+ packed = packed_next(packed);
+ packed_get(mem, packed, pref);
+ }
+ break;
+ case t_shortarray:
+ {
+ const ref_packed *packed = aref->value.packed + index_long;
+
+ packed_get(mem, packed, pref);
+ }
+ break;
+ default:
+ return_error(e_typecheck);
}
return 0;
}
@@ -693,25 +693,25 @@ packed_get(const gs_memory_t *mem, const ref_packed * packed, ref * pref)
uint value = elt & packed_value_mask;
switch (elt >> r_packed_type_shift) {
- default: /* (shouldn't happen) */
- make_null(pref);
- break;
- case pt_executable_operator:
- op_index_ref(mem, value, pref);
- break;
- case pt_integer:
- make_int(pref, (int)value + packed_min_intval);
- break;
- case pt_literal_name:
- name_index_ref(mem, value, pref);
- break;
- case pt_executable_name:
- name_index_ref(mem, value, pref);
- r_set_attrs(pref, a_executable);
- break;
- case pt_full_ref:
- case pt_full_ref + 1:
- ref_assign(pref, (const ref *)packed);
+ default: /* (shouldn't happen) */
+ make_null(pref);
+ break;
+ case pt_executable_operator:
+ op_index_ref(mem, value, pref);
+ break;
+ case pt_integer:
+ make_int(pref, (int)value + packed_min_intval);
+ break;
+ case pt_literal_name:
+ name_index_ref(mem, value, pref);
+ break;
+ case pt_executable_name:
+ name_index_ref(mem, value, pref);
+ r_set_attrs(pref, a_executable);
+ break;
+ case pt_full_ref:
+ case pt_full_ref + 1:
+ ref_assign(pref, (const ref *)packed);
}
}
@@ -722,7 +722,7 @@ int
refs_check_space(const ref * bot, uint size, uint space)
{
for (; size--; bot++)
- store_check_space(space, bot);
+ store_check_space(space, bot);
return 0;
}
@@ -731,13 +731,13 @@ refs_check_space(const ref * bot, uint size, uint space)
/* Convert a C string to a Ghostscript string */
int
string_to_ref(const char *cstr, ref * pref, gs_ref_memory_t * mem,
- client_name_t cname)
+ client_name_t cname)
{
uint size = strlen(cstr);
int code = gs_alloc_string_ref(mem, pref, a_all, size, cname);
if (code < 0)
- return code;
+ return code;
memcpy(pref->value.bytes, cstr, size);
return 0;
}
@@ -751,7 +751,7 @@ ref_to_string(const ref * pref, gs_memory_t * mem, client_name_t cname)
char *str = (char *)gs_alloc_string(mem, size + 1, cname);
if (str == 0)
- return 0;
+ return 0;
memcpy(str, (const char *)pref->value.bytes, size);
str[size] = 0;
return str;
@@ -773,21 +773,21 @@ num_params(const ref * op, int count, double *pval)
pval += count;
while (--count >= 0) {
- mask <<= 1;
- switch (r_type(op)) {
- case t_real:
- *--pval = op->value.realval;
- break;
- case t_integer:
- *--pval = op->value.intval;
- mask++;
- break;
- case t__invalid:
- return_error(e_stackunderflow);
- default:
- return_error(e_typecheck);
- }
- op--;
+ mask <<= 1;
+ switch (r_type(op)) {
+ case t_real:
+ *--pval = op->value.realval;
+ break;
+ case t_integer:
+ *--pval = op->value.intval;
+ mask++;
+ break;
+ case t__invalid:
+ return_error(e_stackunderflow);
+ default:
+ return_error(e_typecheck);
+ }
+ op--;
}
/* If count is very large, mask might overflow. */
/* In this case we clearly don't care about the value of mask. */
@@ -798,18 +798,18 @@ int
float_params(const ref * op, int count, float *pval)
{
for (pval += count; --count >= 0; --op)
- switch (r_type(op)) {
- case t_real:
- *--pval = op->value.realval;
- break;
- case t_integer:
- *--pval = (float)op->value.intval;
- break;
- case t__invalid:
- return_error(e_stackunderflow);
- default:
- return_error(e_typecheck);
- }
+ switch (r_type(op)) {
+ case t_real:
+ *--pval = op->value.realval;
+ break;
+ case t_integer:
+ *--pval = (float)op->value.intval;
+ break;
+ case t__invalid:
+ return_error(e_stackunderflow);
+ default:
+ return_error(e_typecheck);
+ }
return 0;
}
@@ -848,16 +848,16 @@ int
real_param(const ref * op, double *pparam)
{
switch (r_type(op)) {
- case t_integer:
- *pparam = op->value.intval;
- break;
- case t_real:
- *pparam = op->value.realval;
- break;
+ case t_integer:
+ *pparam = op->value.intval;
+ break;
+ case t_real:
+ *pparam = op->value.realval;
+ break;
case t__invalid:
- return_error(e_stackunderflow);
- default:
- return_error(e_typecheck);
+ return_error(e_stackunderflow);
+ default:
+ return_error(e_typecheck);
}
return 0;
}
@@ -868,7 +868,7 @@ float_param(const ref * op, float *pparam)
int code = real_param(op, &dval);
if (code >= 0)
- *pparam = (float)dval; /* can't overflow */
+ *pparam = (float)dval; /* can't overflow */
return code;
}
@@ -888,7 +888,7 @@ make_reals(ref * op, const double *pval, int count)
/* This should return e_limitcheck if any real is too large */
/* to fit into a float on the stack. */
for (; count--; op++, pval++)
- make_real(op, *pval);
+ make_real(op, *pval);
return 0;
}
int
@@ -896,7 +896,7 @@ make_floats(ref * op, const float *pval, int count)
{
/* This should return e_undefinedresult for infinities. */
for (; count--; op++, pval++)
- make_real(op, *pval);
+ make_real(op, *pval);
return 0;
}
@@ -939,28 +939,28 @@ read_matrix(const gs_memory_t *mem, const ref * op, gs_matrix * pmat)
const ref *pvalues;
switch (r_type(op)) {
- case t_array:
- pvalues = op->value.refs;
- break;
- case t_mixedarray:
- case t_shortarray:
- {
- int i;
-
- for (i = 0; i < 6; ++i) {
- code = array_get(mem, op, (long)i, &values[i]);
- if (code < 0)
- return code;
- }
- pvalues = values;
- }
- break;
- default:
- return_op_typecheck(op);
+ case t_array:
+ pvalues = op->value.refs;
+ break;
+ case t_mixedarray:
+ case t_shortarray:
+ {
+ int i;
+
+ for (i = 0; i < 6; ++i) {
+ code = array_get(mem, op, (long)i, &values[i]);
+ if (code < 0)
+ return code;
+ }
+ pvalues = values;
+ }
+ break;
+ default:
+ return_op_typecheck(op);
}
check_read(*op);
if (r_size(op) != 6)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = float_params(pvalues + 5, 6, (float *)pmat);
return (code < 0 ? code : 0);
}
@@ -969,7 +969,7 @@ read_matrix(const gs_memory_t *mem, const ref * op, gs_matrix * pmat)
/* Return 0 if OK, error code if not. */
int
write_matrix_in(ref * op, const gs_matrix * pmat, gs_dual_memory_t *idmemory,
- gs_ref_memory_t *imem)
+ gs_ref_memory_t *imem)
{
ref *aptr;
const float *pel;
@@ -977,16 +977,16 @@ write_matrix_in(ref * op, const gs_matrix * pmat, gs_dual_memory_t *idmemory,
check_write_type(*op, t_array);
if (r_size(op) != 6)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
aptr = op->value.refs;
pel = (const float *)pmat;
for (i = 5; i >= 0; i--, aptr++, pel++) {
- if (idmemory) {
- ref_save(op, aptr, "write_matrix");
- make_real_new(aptr, *pel);
- } else {
- make_tav(aptr, t_real, imemory_new_mask(imem), realval, *pel);
- }
+ if (idmemory) {
+ ref_save(op, aptr, "write_matrix");
+ make_real_new(aptr, *pel);
+ } else {
+ make_tav(aptr, t_real, imemory_new_mask(imem), realval, *pel);
+ }
}
return 0;
}
diff --git a/gs/psi/iutil.h b/gs/psi/iutil.h
index 3852a9182..7e845338b 100644
--- a/gs/psi/iutil.h
+++ b/gs/psi/iutil.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,9 +23,9 @@
/* Copy refs from one place to another. */
/* (If we are copying to the stack, we can just use memcpy.) */
void refcpy_to_new(ref * to, const ref * from, uint size,
- gs_dual_memory_t *dmem);
+ gs_dual_memory_t *dmem);
int refcpy_to_old(ref * aref, uint index, const ref * from, uint size,
- gs_dual_memory_t *dmem, client_name_t cname);
+ gs_dual_memory_t *dmem, client_name_t cname);
/*
* Fill an array with nulls.
@@ -62,7 +62,7 @@ int obj_string_data(const gs_memory_t *mem, const ref *op, const byte **pchars,
*/
#define CVP_MAX_STRING 200 /* strings are truncated here if full_print = 1 */
int obj_cvp(const ref * op, byte *str, uint len, uint * prlen,
- int full_print, uint start_pos, const gs_memory_t *mem, bool restart);
+ int full_print, uint start_pos, const gs_memory_t *mem, bool restart);
/*
* Create a printable representation of an object, a la cvs and =. Return 0
@@ -78,7 +78,7 @@ int obj_cvp(const ref * op, byte *str, uint len, uint * prlen,
* obj_string_data.
*/
int obj_cvs(const gs_memory_t *mem, const ref * op, byte * str, uint len, uint * prlen,
- const byte ** pchars);
+ const byte ** pchars);
/* Get an element from an array (packed or not). */
int array_get(const gs_memory_t *mem, const ref *, long, ref *);
@@ -142,7 +142,7 @@ int read_matrix(const gs_memory_t *mem, const ref *, gs_matrix *);
/* If dmem is NULL, the array is guaranteed newly allocated in imem. */
/* If dmem is not NULL, imem is ignored. */
int write_matrix_in(ref *op, const gs_matrix *pmat, gs_dual_memory_t *dmem,
- gs_ref_memory_t *imem);
+ gs_ref_memory_t *imem);
#define write_matrix_new(op, pmat, imem)\
write_matrix_in(op, pmat, NULL, imem)
#define write_matrix(op, pmat)\
diff --git a/gs/psi/iutil2.c b/gs/psi/iutil2.c
index a1d89fc2b..130b237da 100644
--- a/gs/psi/iutil2.c
+++ b/gs/psi/iutil2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,23 +37,23 @@ param_read_password(gs_param_list * plist, const char *kstr, password * ppass)
int code = param_read_string(plist, kstr, &ps);
switch (code) {
- case 0: /* OK */
- if (ps.size > MAX_PASSWORD)
- return_error(e_limitcheck);
- /* Copy the data back. */
- memcpy(ppass->data, ps.data, ps.size);
- ppass->size = ps.size;
- return 0;
- case 1: /* key is missing */
- return 1;
+ case 0: /* OK */
+ if (ps.size > MAX_PASSWORD)
+ return_error(e_limitcheck);
+ /* Copy the data back. */
+ memcpy(ppass->data, ps.data, ps.size);
+ ppass->size = ps.size;
+ return 0;
+ case 1: /* key is missing */
+ return 1;
}
/* We might have gotten a typecheck because */
/* the supplied password was an integer. */
if (code != e_typecheck)
- return code;
+ return code;
code = param_read_long(plist, kstr, &ipass);
if (code != 0) /* error or missing */
- return code;
+ return code;
sprintf((char *)ppass->data, "%ld", ipass);
ppass->size = strlen((char *)ppass->data);
return 0;
@@ -61,14 +61,14 @@ param_read_password(gs_param_list * plist, const char *kstr, password * ppass)
/* Write a password to a parameter list. */
int
param_write_password(gs_param_list * plist, const char *kstr,
- const password * ppass)
+ const password * ppass)
{
gs_param_string ps;
ps.data = (const byte *)ppass->data, ps.size = ppass->size,
- ps.persistent = false;
+ ps.persistent = false;
if (ps.size > MAX_PASSWORD)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
return param_write_string(plist, kstr, &ps);
}
@@ -78,17 +78,17 @@ int
param_check_password(gs_param_list * plist, const password * ppass)
{
if (ppass->size != 0) {
- password pass;
- int code = param_read_password(plist, "Password", &pass);
+ password pass;
+ int code = param_read_password(plist, "Password", &pass);
- if (code)
- return code;
- if (pass.size != ppass->size ||
- bytes_compare(&pass.data[0], pass.size,
- &ppass->data[0],
- ppass->size) != 0
- )
- return 1;
+ if (code)
+ return code;
+ if (pass.size != ppass->size ||
+ bytes_compare(&pass.data[0], pass.size,
+ &ppass->data[0],
+ ppass->size) != 0
+ )
+ return 1;
}
return 0;
}
@@ -101,12 +101,12 @@ dict_find_password(ref ** ppvalue, const ref * pdref, const char *kstr)
ref *pvalue;
if (dict_find_string(pdref, kstr, &pvalue) <= 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (!r_has_type(pvalue, t_string) ||
- r_has_attrs(pvalue, a_read) ||
- pvalue->value.const_bytes[0] >= r_size(pvalue)
- )
- return_error(e_rangecheck);
+ r_has_attrs(pvalue, a_read) ||
+ pvalue->value.const_bytes[0] >= r_size(pvalue)
+ )
+ return_error(e_rangecheck);
*ppvalue = pvalue;
return 0;
}
@@ -117,29 +117,29 @@ dict_read_password(password * ppass, const ref * pdref, const char *pkey)
int code = dict_find_password(&pvalue, pdref, pkey);
if (code < 0)
- return code;
+ return code;
if (pvalue->value.const_bytes[0] > MAX_PASSWORD)
- return_error(e_rangecheck); /* limitcheck? */
+ return_error(e_rangecheck); /* limitcheck? */
memcpy(ppass->data, pvalue->value.const_bytes + 1,
- (ppass->size = pvalue->value.const_bytes[0]));
+ (ppass->size = pvalue->value.const_bytes[0]));
return 0;
}
int
dict_write_password(const password * ppass, ref * pdref, const char *pkey,
- bool change_allowed)
+ bool change_allowed)
{
ref *pvalue;
int code = dict_find_password(&pvalue, pdref, pkey);
if (code < 0)
- return code;
+ return code;
if (ppass->size >= r_size(pvalue))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (!change_allowed &&
- bytes_compare(pvalue->value.bytes + 1, pvalue->value.bytes[0],
- ppass->data, ppass->size) != 0)
- return_error(e_invalidaccess);
+ bytes_compare(pvalue->value.bytes + 1, pvalue->value.bytes[0],
+ ppass->data, ppass->size) != 0)
+ return_error(e_invalidaccess);
memcpy(pvalue->value.bytes + 1, ppass->data,
- (pvalue->value.bytes[0] = ppass->size));
+ (pvalue->value.bytes[0] = ppass->size));
return 0;
}
diff --git a/gs/psi/iutil2.h b/gs/psi/iutil2.h
index 2eb93c838..2b94d6cd7 100644
--- a/gs/psi/iutil2.h
+++ b/gs/psi/iutil2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ivmem2.h b/gs/psi/ivmem2.h
index 2b07480e3..4cba2dfdd 100644
--- a/gs/psi/ivmem2.h
+++ b/gs/psi/ivmem2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ivmspace.h b/gs/psi/ivmspace.h
index fc5f48087..450280eca 100644
--- a/gs/psi/ivmspace.h
+++ b/gs/psi/ivmspace.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/main.h b/gs/psi/main.h
index 27db6e6ce..a98fabd5f 100644
--- a/gs/psi/main.h
+++ b/gs/psi/main.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -28,8 +28,7 @@
*/
/* conditional out the entire file */
-#if 0
-
+#if 0
/* ================ Data elements ================ */
@@ -72,7 +71,7 @@
#define gs_run_string_with_length(str, len, ue, pec, peo)\
gs_main_run_string_with_length(gs_main_instance_default(),\
- str, len, ue, pec, peo)
+ str, len, ue, pec, peo)
#define gs_run_file_open(fn, pfref)\
gs_main_run_file_open(gs_main_instance_default(), fn, pfref)
@@ -82,7 +81,7 @@
#define gs_run_string_continue(str, len, ue, pec, peo)\
gs_main_run_string_continue(gs_main_instance_default(),\
- str, len, ue, pec, peo)
+ str, len, ue, pec, peo)
#define gs_run_string_end(ue, pec, peo)\
gs_main_run_string_end(gs_main_instance_default(), ue, pec, peo)
@@ -101,7 +100,6 @@ void gs_debug_dump_stack(int code, ref * perror_object);
/* ---------------- Termination ---------------- */
-
#endif /* full file conditional */
#endif /* main_INCLUDED */
diff --git a/gs/psi/oparc.h b/gs/psi/oparc.h
index 5a8e7947b..7b73806b5 100644
--- a/gs/psi/oparc.h
+++ b/gs/psi/oparc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/opcheck.h b/gs/psi/opcheck.h
index 1ade21feb..f71596251 100644
--- a/gs/psi/opcheck.h
+++ b/gs/psi/opcheck.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/opdef.h b/gs/psi/opdef.h
index b00b9c7b6..ab345aed8 100644
--- a/gs/psi/opdef.h
+++ b/gs/psi/opdef.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/oper.h b/gs/psi/oper.h
index 7862ccf36..64aed9464 100644
--- a/gs/psi/oper.h
+++ b/gs/psi/oper.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -70,7 +70,7 @@ int check_type_failed(const ref *);
#define check_type_access(orf,typ,acc1)\
if ( !r_has_type_attrs(&orf,typ,acc1) )\
return_error((!r_has_type(&orf,typ) ? check_type_failed(&orf) :\
- e_invalidaccess))
+ e_invalidaccess))
#define check_read_type(orf,typ)\
check_type_access(orf,typ,a_read)
#define check_write_type(orf,typ)\
diff --git a/gs/psi/opextern.h b/gs/psi/opextern.h
index f2665a7dd..081ffc14c 100644
--- a/gs/psi/opextern.h
+++ b/gs/psi/opextern.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ostack.h b/gs/psi/ostack.h
index 329bc12f7..aa2cf5250 100644
--- a/gs/psi/ostack.h
+++ b/gs/psi/ostack.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/sfilter1.c b/gs/psi/sfilter1.c
index cdf9abffd..cf4a3cb50 100644
--- a/gs/psi/sfilter1.c
+++ b/gs/psi/sfilter1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ s_PFBD_init(stream_state * st)
/* Process a buffer */
static int
s_PFBD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_PFBD_state *const ss = (stream_PFBD_state *) st;
register const byte *p = pr->ptr;
@@ -49,30 +49,30 @@ top:
rcount = pr->limit - p;
wcount = pw->limit - q;
switch (ss->record_type) {
- case -1: /* new record */
- if (rcount < 2)
- goto out;
- if (p[1] != 0x80)
- goto err;
- c = p[2];
- switch (c) {
- case 1:
- case 2:
- break;
- case 3:
- status = EOFC;
- p += 2;
- goto out;
- default:
- p += 2;
- goto err;
- }
- if (rcount < 6)
- goto out;
- ss->record_type = c;
- ss->record_left = p[3] + ((uint) p[4] << 8) +
- ((ulong) p[5] << 16) +
- ((ulong) p[6] << 24);
+ case -1: /* new record */
+ if (rcount < 2)
+ goto out;
+ if (p[1] != 0x80)
+ goto err;
+ c = p[2];
+ switch (c) {
+ case 1:
+ case 2:
+ break;
+ case 3:
+ status = EOFC;
+ p += 2;
+ goto out;
+ default:
+ p += 2;
+ goto err;
+ }
+ if (rcount < 6)
+ goto out;
+ ss->record_type = c;
+ ss->record_left = p[3] + ((uint) p[4] << 8) +
+ ((ulong) p[5] << 16) +
+ ((ulong) p[6] << 24);
/* Check for an invalid counter found in an Adobe font, bug 689617 */
if (ss->record_left == 0 && ss->record_type == 1) {
@@ -85,76 +85,76 @@ top:
}
} else {
if (!last)
- goto out;
+ goto out;
}
}
- p += 6;
- goto top;
- case 1: /* text data */
- /* Translate \r to \n. */
- {
- int count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ p += 6;
+ goto top;
+ case 1: /* text data */
+ /* Translate \r to \n. */
+ {
+ int count = (wcount < rcount ? (status = 1, wcount) : rcount);
- if (count > ss->record_left)
- count = ss->record_left,
- status = 0;
- ss->record_left -= count;
- for (; count != 0; count--) {
- c = *++p;
- *++q = (c == '\r' ? '\n' : c);
- }
- }
- break;
- case 2: /* binary data */
- if (ss->binary_to_hex) {
- /* Translate binary to hex. */
- int count;
- const char *const hex_digits = "0123456789abcdef";
+ if (count > ss->record_left)
+ count = ss->record_left,
+ status = 0;
+ ss->record_left -= count;
+ for (; count != 0; count--) {
+ c = *++p;
+ *++q = (c == '\r' ? '\n' : c);
+ }
+ }
+ break;
+ case 2: /* binary data */
+ if (ss->binary_to_hex) {
+ /* Translate binary to hex. */
+ int count;
+ const char *const hex_digits = "0123456789abcdef";
- wcount >>= 1; /* 2 chars per input byte */
- count = (wcount < rcount ? (status = 1, wcount) : rcount);
- if (count > ss->record_left)
- count = ss->record_left,
- status = 0;
- ss->record_left -= count;
- for (; count != 0; count--) {
- c = *++p;
- q[1] = hex_digits[c >> 4];
- q[2] = hex_digits[c & 0xf];
- q += 2;
- }
- } else { /* Just read binary data. */
- int count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ wcount >>= 1; /* 2 chars per input byte */
+ count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ if (count > ss->record_left)
+ count = ss->record_left,
+ status = 0;
+ ss->record_left -= count;
+ for (; count != 0; count--) {
+ c = *++p;
+ q[1] = hex_digits[c >> 4];
+ q[2] = hex_digits[c & 0xf];
+ q += 2;
+ }
+ } else { /* Just read binary data. */
+ int count = (wcount < rcount ? (status = 1, wcount) : rcount);
- if (count > ss->record_left)
- count = ss->record_left,
- status = 0;
- ss->record_left -= count;
- memcpy(q + 1, p + 1, count);
- p += count;
- q += count;
- }
- break;
- case 4:
+ if (count > ss->record_left)
+ count = ss->record_left,
+ status = 0;
+ ss->record_left -= count;
+ memcpy(q + 1, p + 1, count);
+ p += count;
+ q += count;
+ }
+ break;
+ case 4:
/* Treat the text after empty ASCII block as ACSII stream */
- /* Translate \r to \n. */
- {
- int count = (wcount < rcount ? (status = 1, wcount) : rcount);
- for (; count != 0; count--) {
- c = *++p;
+ /* Translate \r to \n. */
+ {
+ int count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ for (; count != 0; count--) {
+ c = *++p;
if (c == 128)
{ --p;
ss->record_left = 0;
break;
}
- *++q = (c == '\r' ? '\n' : c);
- }
- }
- break;
+ *++q = (c == '\r' ? '\n' : c);
+ }
+ }
+ break;
}
if (ss->record_left == 0) {
- ss->record_type = -1;
- goto top;
+ ss->record_type = -1;
+ goto top;
}
out:
pr->ptr = p;
@@ -203,7 +203,7 @@ s_SFD_init(stream_state * st)
/* Refill the buffer */
static int
s_SFD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
stream_SFD_state *const ss = (stream_SFD_state *) st;
register const byte *p = pr->ptr;
@@ -213,119 +213,119 @@ s_SFD_process(stream_state * st, stream_cursor_read * pr,
int status = 0;
if (ss->eod.size == 0) { /* Just read, with no EOD pattern. */
- int rcount = rlimit - p;
- int wcount = wlimit - q;
- int count;
+ int rcount = rlimit - p;
+ int wcount = wlimit - q;
+ int count;
- if (rcount <= ss->skip_count) { /* skipping */
- ss->skip_count -= rcount;
- pr->ptr = rlimit;
- return 0;
- } else if (ss->skip_count > 0) {
- rcount -= ss->skip_count;
- pr->ptr = p += ss->skip_count;
- ss->skip_count = 0;
- }
- count = min(rcount, wcount);
- if (ss->count == 0) /* no EOD limit */
- return stream_move(pr, pw);
- else if (ss->count > count) { /* not EOD yet */
- ss->count -= count;
- return stream_move(pr, pw);
- } else { /* We're going to reach EOD. */
- count = ss->count;
- if (count > 0) {
- memcpy(q + 1, p + 1, count);
- pr->ptr = p + count;
- pw->ptr = q + count;
- }
- ss->count = -1;
- return EOFC;
- }
+ if (rcount <= ss->skip_count) { /* skipping */
+ ss->skip_count -= rcount;
+ pr->ptr = rlimit;
+ return 0;
+ } else if (ss->skip_count > 0) {
+ rcount -= ss->skip_count;
+ pr->ptr = p += ss->skip_count;
+ ss->skip_count = 0;
+ }
+ count = min(rcount, wcount);
+ if (ss->count == 0) /* no EOD limit */
+ return stream_move(pr, pw);
+ else if (ss->count > count) { /* not EOD yet */
+ ss->count -= count;
+ return stream_move(pr, pw);
+ } else { /* We're going to reach EOD. */
+ count = ss->count;
+ if (count > 0) {
+ memcpy(q + 1, p + 1, count);
+ pr->ptr = p + count;
+ pw->ptr = q + count;
+ }
+ ss->count = -1;
+ return EOFC;
+ }
} else { /* Read looking for an EOD pattern. */
- const byte *pattern = ss->eod.data;
- uint match = ss->match;
+ const byte *pattern = ss->eod.data;
+ uint match = ss->match;
cp:
- /* Check whether we're still copying a partial match. */
- if (ss->copy_count) {
- int count = min(wlimit - q, ss->copy_count);
+ /* Check whether we're still copying a partial match. */
+ if (ss->copy_count) {
+ int count = min(wlimit - q, ss->copy_count);
- memcpy(q + 1, ss->eod.data + ss->copy_ptr, count);
- ss->copy_count -= count;
- ss->copy_ptr += count;
- q += count;
- if (ss->copy_count != 0) { /* hit wlimit */
- status = 1;
- goto xit;
- } else if (ss->count < 0) {
- status = EOFC;
- goto xit;
- }
- }
- while (p < rlimit) {
- int c = *++p;
+ memcpy(q + 1, ss->eod.data + ss->copy_ptr, count);
+ ss->copy_count -= count;
+ ss->copy_ptr += count;
+ q += count;
+ if (ss->copy_count != 0) { /* hit wlimit */
+ status = 1;
+ goto xit;
+ } else if (ss->count < 0) {
+ status = EOFC;
+ goto xit;
+ }
+ }
+ while (p < rlimit) {
+ int c = *++p;
- if (c == pattern[match]) {
- if (++match == ss->eod.size) {
- if (ss->skip_count > 0) {
- q = pw->ptr; /* undo any writes */
- ss->skip_count--;
- match = 0;
- continue;
- }
- /*
- * We use if/else rather than switch because the value
- * is long, which is not supported as a switch value in
- * pre-ANSI C.
- */
- if (ss->count <= 0) {
- status = EOFC;
- goto xit;
- } else if (ss->count == 1) {
- ss->count = -1;
- } else
- ss->count--;
- ss->copy_ptr = 0;
- ss->copy_count = match;
- match = 0;
- goto cp;
- }
- continue;
- }
- /*
- * No match here, back up to find the longest one.
- * This may be quadratic in string_size, but
- * we don't expect this to be a real problem.
- */
- if (match > 0) {
- int end = match;
+ if (c == pattern[match]) {
+ if (++match == ss->eod.size) {
+ if (ss->skip_count > 0) {
+ q = pw->ptr; /* undo any writes */
+ ss->skip_count--;
+ match = 0;
+ continue;
+ }
+ /*
+ * We use if/else rather than switch because the value
+ * is long, which is not supported as a switch value in
+ * pre-ANSI C.
+ */
+ if (ss->count <= 0) {
+ status = EOFC;
+ goto xit;
+ } else if (ss->count == 1) {
+ ss->count = -1;
+ } else
+ ss->count--;
+ ss->copy_ptr = 0;
+ ss->copy_count = match;
+ match = 0;
+ goto cp;
+ }
+ continue;
+ }
+ /*
+ * No match here, back up to find the longest one.
+ * This may be quadratic in string_size, but
+ * we don't expect this to be a real problem.
+ */
+ if (match > 0) {
+ int end = match;
- while (match > 0) {
- match--;
- if (!memcmp(pattern, pattern + end - match, match))
- break;
- }
- /*
- * Copy the unmatched initial portion of
- * the EOD string to the output.
- */
- p--;
- ss->copy_ptr = 0;
- ss->copy_count = end - match;
- goto cp;
- }
- if (q == wlimit) {
- p--;
- status = 1;
- break;
- }
- *++q = c;
- }
+ while (match > 0) {
+ match--;
+ if (!memcmp(pattern, pattern + end - match, match))
+ break;
+ }
+ /*
+ * Copy the unmatched initial portion of
+ * the EOD string to the output.
+ */
+ p--;
+ ss->copy_ptr = 0;
+ ss->copy_count = end - match;
+ goto cp;
+ }
+ if (q == wlimit) {
+ p--;
+ status = 1;
+ break;
+ }
+ *++q = c;
+ }
xit: pr->ptr = p;
- if (ss->skip_count <= 0)
- pw->ptr = q;
- ss->match = match;
+ if (ss->skip_count <= 0)
+ pw->ptr = q;
+ ss->match = match;
}
return status;
}
diff --git a/gs/psi/store.h b/gs/psi/store.h
index 6fe69956f..e359cd413 100644
--- a/gs/psi/store.h
+++ b/gs/psi/store.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -72,23 +72,23 @@
* if not too bad. And we're using GCC anyways on Debian.
*/
#define ref_assign_inline(pto,pfrom)\
- (*(pto) = *(pfrom))
+ (*(pto) = *(pfrom))
#ifdef __TURBOC__
- /*
- * Move the data in two 32-bit chunks, because
- * otherwise the compiler calls SCOPY@.
- * The cast to void is to discourage the compiler from
- * wanting to deliver the value of the expression.
- */
+ /*
+ * Move the data in two 32-bit chunks, because
+ * otherwise the compiler calls SCOPY@.
+ * The cast to void is to discourage the compiler from
+ * wanting to deliver the value of the expression.
+ */
# define ref_assign(pto,pfrom)\
- discard(ref_assign_inline(pto, pfrom))
+ discard(ref_assign_inline(pto, pfrom))
#else
- /*
- * Trust the compiler and hope for the best.
- * The MIPS compiler doesn't like the cast to void.
- */
+ /*
+ * Trust the compiler and hope for the best.
+ * The MIPS compiler doesn't like the cast to void.
+ */
# define ref_assign(pto,pfrom)\
- (*(pto) = *(pfrom))
+ (*(pto) = *(pfrom))
#endif
#define ialloc_new_mask (idmemory->new_mask)
@@ -107,7 +107,7 @@
alloc_save_change(idmemory, pcont, (ref_packed *)(pto), cname)
#define ref_save_in(mem, pcont, pto, cname)\
discard((ref_must_save_in(mem, pto) ?\
- ref_do_save_in(mem, pcont, pto, cname) : 0))
+ ref_do_save_in(mem, pcont, pto, cname) : 0))
#define ref_save(pcont, pto, cname)\
discard((ref_must_save(pto) ? ref_do_save(pcont, pto, cname) : 0))
#define ref_mark_new_in(mmem,pto)\
@@ -143,7 +143,7 @@
#define DEADBEEF ((int)(((uint)0xdead << 16) | 0xbeef))
# define and_fill_sv(pref)\
, (gs_debug['$'] ? (r_set_size(pref, 0xfeed),\
- (pref)->value.intval = DEADBEEF) : 0)
+ (pref)->value.intval = DEADBEEF) : 0)
#else /* !DEBUG */
# define and_fill_s(pref) /* */
# define and_fill_sv(pref) /* */
diff --git a/gs/psi/wrfont.c b/gs/psi/wrfont.c
index 47c81a321..4aa191396 100644
--- a/gs/psi/wrfont.c
+++ b/gs/psi/wrfont.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,53 +26,53 @@ Started by Graham Asher, 9th August 2002.
#define EEXEC_OFFSET 22719
void WRF_init(WRF_output* a_output,unsigned char* a_buffer,long a_buffer_size)
- {
- a_output->m_pos = a_buffer;
- a_output->m_limit = a_buffer_size;
- a_output->m_count = 0;
- a_output->m_encrypt = false;
- a_output->m_key = EEXEC_KEY;
- }
+ {
+ a_output->m_pos = a_buffer;
+ a_output->m_limit = a_buffer_size;
+ a_output->m_count = 0;
+ a_output->m_encrypt = false;
+ a_output->m_key = EEXEC_KEY;
+ }
void WRF_wbyte(WRF_output* a_output,unsigned char a_byte)
- {
- if (a_output->m_count < a_output->m_limit)
- {
- if (a_output->m_encrypt)
- {
- a_byte ^= (a_output->m_key >> 8);
- a_output->m_key = (unsigned short)((a_output->m_key + a_byte) * EEXEC_FACTOR + EEXEC_OFFSET);
- }
- *a_output->m_pos++ = a_byte;
- }
- a_output->m_count++;
- }
+ {
+ if (a_output->m_count < a_output->m_limit)
+ {
+ if (a_output->m_encrypt)
+ {
+ a_byte ^= (a_output->m_key >> 8);
+ a_output->m_key = (unsigned short)((a_output->m_key + a_byte) * EEXEC_FACTOR + EEXEC_OFFSET);
+ }
+ *a_output->m_pos++ = a_byte;
+ }
+ a_output->m_count++;
+ }
void WRF_wtext(WRF_output* a_output,const unsigned char* a_string,long a_length)
- {
- while (a_length > 0)
- {
- WRF_wbyte(a_output,*a_string++);
- a_length--;
- }
- }
+ {
+ while (a_length > 0)
+ {
+ WRF_wbyte(a_output,*a_string++);
+ a_length--;
+ }
+ }
void WRF_wstring(WRF_output* a_output,const char* a_string)
- {
- while (*a_string)
- WRF_wbyte(a_output,*a_string++);
- }
+ {
+ while (*a_string)
+ WRF_wbyte(a_output,*a_string++);
+ }
void WRF_wfloat(WRF_output* a_output,double a_float)
- {
- char buffer[32];
- sprintf(buffer,"%f",a_float);
- WRF_wstring(a_output,buffer);
- }
+ {
+ char buffer[32];
+ sprintf(buffer,"%f",a_float);
+ WRF_wstring(a_output,buffer);
+ }
void WRF_wint(WRF_output* a_output,long a_int)
- {
- char buffer[32];
- sprintf(buffer,"%ld",a_int);
- WRF_wstring(a_output,buffer);
- }
+ {
+ char buffer[32];
+ sprintf(buffer,"%ld",a_int);
+ WRF_wstring(a_output,buffer);
+ }
diff --git a/gs/psi/wrfont.h b/gs/psi/wrfont.h
index 1acfdb85d..ed1c1290e 100644
--- a/gs/psi/wrfont.h
+++ b/gs/psi/wrfont.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -24,13 +24,13 @@ Started by Graham Asher, 9th August 2002.
#include "stdpre.h"
typedef struct WRF_output_
- {
- unsigned char* m_pos;
- long m_limit;
- long m_count;
- bool m_encrypt;
- unsigned short m_key;
- } WRF_output;
+ {
+ unsigned char* m_pos;
+ long m_limit;
+ long m_count;
+ bool m_encrypt;
+ unsigned short m_key;
+ } WRF_output;
void WRF_init(WRF_output* a_output,unsigned char* a_buffer,long a_buffer_size);
void WRF_wbyte(WRF_output* a_output,unsigned char a_byte);
diff --git a/gs/psi/write_t1.c b/gs/psi/write_t1.c
index 3c865a1fb..5ed1c401f 100644
--- a/gs/psi/write_t1.c
+++ b/gs/psi/write_t1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,92 +29,91 @@ the FAPI FreeType implementation.
*/
static void write_word_entry(FAPI_font* a_fapi_font,WRF_output* a_output,const char* a_name,int a_index,int a_divisor)
- {
- short x;
- WRF_wbyte(a_output,'/');
- WRF_wstring(a_output,a_name);
- WRF_wbyte(a_output,' ');
- /* Get the value and convert it from unsigned to signed by assigning it to a short. */
- x = a_fapi_font->get_word(a_fapi_font,a_index,0);
- /* Divide by the divisor to bring it back to font units. */
- x = (short)(x / a_divisor);
- WRF_wint(a_output,x);
- WRF_wstring(a_output," def\n");
- }
+ {
+ short x;
+ WRF_wbyte(a_output,'/');
+ WRF_wstring(a_output,a_name);
+ WRF_wbyte(a_output,' ');
+ /* Get the value and convert it from unsigned to signed by assigning it to a short. */
+ x = a_fapi_font->get_word(a_fapi_font,a_index,0);
+ /* Divide by the divisor to bring it back to font units. */
+ x = (short)(x / a_divisor);
+ WRF_wint(a_output,x);
+ WRF_wstring(a_output," def\n");
+ }
static void write_array_entry_with_count(FAPI_font* a_fapi_font,WRF_output* a_output,const char* a_name,int a_index,int a_count,int a_divisor)
- {
- int i;
-
- if (a_count <= 0)
- return;
-
- WRF_wbyte(a_output,'/');
- WRF_wstring(a_output,a_name);
- WRF_wstring(a_output," [");
- for (i = 0; i < a_count; i++)
- {
- /* Get the value and convert it from unsigned to signed by assigning it to a short. */
- short x = a_fapi_font->get_word(a_fapi_font,a_index,i);
- /* Divide by the divisor to bring it back to font units. */
- x = (short)(x / a_divisor);
- WRF_wint(a_output,x);
- WRF_wbyte(a_output,(byte)(i == a_count - 1 ? ']' : ' '));
- }
- WRF_wstring(a_output," def\n");
- }
-
+ {
+ int i;
+
+ if (a_count <= 0)
+ return;
+
+ WRF_wbyte(a_output,'/');
+ WRF_wstring(a_output,a_name);
+ WRF_wstring(a_output," [");
+ for (i = 0; i < a_count; i++)
+ {
+ /* Get the value and convert it from unsigned to signed by assigning it to a short. */
+ short x = a_fapi_font->get_word(a_fapi_font,a_index,i);
+ /* Divide by the divisor to bring it back to font units. */
+ x = (short)(x / a_divisor);
+ WRF_wint(a_output,x);
+ WRF_wbyte(a_output,(byte)(i == a_count - 1 ? ']' : ' '));
+ }
+ WRF_wstring(a_output," def\n");
+ }
static void write_array_entry(FAPI_font* a_fapi_font,WRF_output* a_output,const char* a_name,int a_index,int a_divisor)
- {
- /* NOTE that the feature index must be preceded by the count index for this to work. */
- int count = a_fapi_font->get_word(a_fapi_font,a_index - 1,0);
- write_array_entry_with_count(a_fapi_font,a_output,a_name,a_index,count,a_divisor);
- }
+ {
+ /* NOTE that the feature index must be preceded by the count index for this to work. */
+ int count = a_fapi_font->get_word(a_fapi_font,a_index - 1,0);
+ write_array_entry_with_count(a_fapi_font,a_output,a_name,a_index,count,a_divisor);
+ }
static void write_subrs(FAPI_font* a_fapi_font,WRF_output* a_output, int raw)
- {
- int i;
- int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
- if (count <= 0)
- return;
-
- WRF_wstring(a_output,"/Subrs ");
- WRF_wint(a_output,count);
- WRF_wstring(a_output," array\n");
-
- for (i = 0; i < count; i++)
- {
- long length;
- long buffer_size;
- if (raw)
- length = a_fapi_font->get_raw_subr(a_fapi_font,i,0,0);
- else
- length = a_fapi_font->get_subr(a_fapi_font,i,0,0);
- WRF_wstring(a_output,"dup ");
- WRF_wint(a_output,i);
- WRF_wbyte(a_output,' ');
- WRF_wint(a_output,length);
- WRF_wstring(a_output," RD ");
-
- /* Get the subroutine into the buffer and encrypt it in place. */
- buffer_size = a_output->m_limit - a_output->m_count;
- if (buffer_size >= length)
- {
- if (raw)
- a_fapi_font->get_raw_subr(a_fapi_font,i,a_output->m_pos,(ushort)length);
- else
- a_fapi_font->get_subr(a_fapi_font,i,a_output->m_pos,(ushort)length);
- WRF_wtext(a_output,a_output->m_pos,length);
- }
- else
- a_output->m_count += length;
-
- WRF_wstring(a_output," NP\n");
- }
-
- WRF_wstring(a_output,"ND\n");
- }
+ {
+ int i;
+ int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
+ if (count <= 0)
+ return;
+
+ WRF_wstring(a_output,"/Subrs ");
+ WRF_wint(a_output,count);
+ WRF_wstring(a_output," array\n");
+
+ for (i = 0; i < count; i++)
+ {
+ long length;
+ long buffer_size;
+ if (raw)
+ length = a_fapi_font->get_raw_subr(a_fapi_font,i,0,0);
+ else
+ length = a_fapi_font->get_subr(a_fapi_font,i,0,0);
+ WRF_wstring(a_output,"dup ");
+ WRF_wint(a_output,i);
+ WRF_wbyte(a_output,' ');
+ WRF_wint(a_output,length);
+ WRF_wstring(a_output," RD ");
+
+ /* Get the subroutine into the buffer and encrypt it in place. */
+ buffer_size = a_output->m_limit - a_output->m_count;
+ if (buffer_size >= length)
+ {
+ if (raw)
+ a_fapi_font->get_raw_subr(a_fapi_font,i,a_output->m_pos,(ushort)length);
+ else
+ a_fapi_font->get_subr(a_fapi_font,i,a_output->m_pos,(ushort)length);
+ WRF_wtext(a_output,a_output->m_pos,length);
+ }
+ else
+ a_output->m_count += length;
+
+ WRF_wstring(a_output," NP\n");
+ }
+
+ WRF_wstring(a_output,"ND\n");
+ }
static void write_charstrings(FAPI_font *a_fapi_font, WRF_output *a_output)
{
@@ -123,35 +122,35 @@ static void write_charstrings(FAPI_font *a_fapi_font, WRF_output *a_output)
int i, count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_CharStrings_count,0);
char NameBuf[256];
if (count <= 0)
- return;
+ return;
WRF_wstring(a_output, "2 index /CharStrings ");
WRF_wint(a_output,count);
WRF_wstring(a_output, " dict dup begin\n");
for (i=0;i< count;i++)
{
- length = a_fapi_font->get_charstring_name(a_fapi_font,i,(byte *)&NameBuf,256);
- if (length > 0)
- {
- length = a_fapi_font->get_charstring(a_fapi_font,i,0,0);
-
- WRF_wbyte(a_output,'/');
- WRF_wstring(a_output, (const char*)&NameBuf);
- WRF_wbyte(a_output,' ');
- WRF_wint(a_output,length);
- WRF_wstring(a_output," RD ");
-
- /* Get the CharString into the buffer and encrypt it in place. */
- buffer_size = a_output->m_limit - a_output->m_count;
- if (buffer_size >= length)
- {
- a_fapi_font->get_charstring(a_fapi_font,i,a_output->m_pos,(ushort)length);
- WRF_wtext(a_output,a_output->m_pos,length);
- }
- else
- a_output->m_count += length;
- WRF_wstring(a_output," ND\n");
- }
+ length = a_fapi_font->get_charstring_name(a_fapi_font,i,(byte *)&NameBuf,256);
+ if (length > 0)
+ {
+ length = a_fapi_font->get_charstring(a_fapi_font,i,0,0);
+
+ WRF_wbyte(a_output,'/');
+ WRF_wstring(a_output, (const char*)&NameBuf);
+ WRF_wbyte(a_output,' ');
+ WRF_wint(a_output,length);
+ WRF_wstring(a_output," RD ");
+
+ /* Get the CharString into the buffer and encrypt it in place. */
+ buffer_size = a_output->m_limit - a_output->m_count;
+ if (buffer_size >= length)
+ {
+ a_fapi_font->get_charstring(a_fapi_font,i,a_output->m_pos,(ushort)length);
+ WRF_wtext(a_output,a_output->m_pos,length);
+ }
+ else
+ a_output->m_count += length;
+ WRF_wstring(a_output," ND\n");
+ }
}
WRF_wstring(a_output, " end");
}
@@ -162,170 +161,170 @@ static int is_MM_font(FAPI_font *a_fapi_font)
}
static void write_private_dictionary(FAPI_font* a_fapi_font,WRF_output* a_output, int Write_CharStrings)
- {
- a_output->m_encrypt = true;
-
- /* Write 4 bytes that must encrypt to at least one character that cannot be a valid hexadecimal character. */
- WRF_wstring(a_output,"XXXX");
-
- /*+ to do: correct size of dictionary from 8. */
- WRF_wstring(a_output,"dup /Private 8 dict dup begin\n");
-
- WRF_wstring(a_output,"/MinFeature {16 16} def\n");
- WRF_wstring(a_output,"/password 5839 def\n");
- if (Write_CharStrings)
- write_word_entry(a_fapi_font,a_output,"lenIV",FAPI_FONT_FEATURE_lenIV,1);
- else
- WRF_wstring(a_output,"/lenIV -1 def\n"); /* indicate that /subrs are not encoded. */
- write_word_entry(a_fapi_font,a_output,"BlueFuzz",FAPI_FONT_FEATURE_BlueFuzz,16);
-
- WRF_wstring(a_output,"/BlueScale ");
- WRF_wfloat(a_output,a_fapi_font->get_long(a_fapi_font,FAPI_FONT_FEATURE_BlueScale,0) / 65536.0);
- WRF_wstring(a_output," def\n");
-
- write_word_entry(a_fapi_font,a_output,"BlueShift",FAPI_FONT_FEATURE_BlueShift,16);
- write_array_entry(a_fapi_font,a_output,"BlueValues",FAPI_FONT_FEATURE_BlueValues,16);
- write_array_entry(a_fapi_font,a_output,"OtherBlues",FAPI_FONT_FEATURE_OtherBlues,16);
- write_array_entry(a_fapi_font,a_output,"FamilyBlues",FAPI_FONT_FEATURE_FamilyBlues,16);
- write_array_entry(a_fapi_font,a_output,"FamilyOtherBlues",FAPI_FONT_FEATURE_FamilyOtherBlues,16);
- write_word_entry(a_fapi_font,a_output,"ForceBold",FAPI_FONT_FEATURE_ForceBold,1);
- write_array_entry_with_count(a_fapi_font,a_output,"StdHW",FAPI_FONT_FEATURE_StdHW,1,16);
- write_array_entry_with_count(a_fapi_font,a_output,"StdVW",FAPI_FONT_FEATURE_StdVW,1,16);
- write_array_entry(a_fapi_font,a_output,"StemSnapH",FAPI_FONT_FEATURE_StemSnapH,16);
- write_array_entry(a_fapi_font,a_output,"StemSnapV",FAPI_FONT_FEATURE_StemSnapV,16);
-
- if (is_MM_font(a_fapi_font)) {
- WRF_wstring(a_output,"3 index /Blend get /Private get begin\n");
- WRF_wstring(a_output,"|-\n");
- }
- if (Write_CharStrings)
- write_subrs(a_fapi_font,a_output, 1);
- else
- write_subrs(a_fapi_font,a_output, 0);
- if (Write_CharStrings)
- write_charstrings(a_fapi_font,a_output);
- }
+ {
+ a_output->m_encrypt = true;
+
+ /* Write 4 bytes that must encrypt to at least one character that cannot be a valid hexadecimal character. */
+ WRF_wstring(a_output,"XXXX");
+
+ /*+ to do: correct size of dictionary from 8. */
+ WRF_wstring(a_output,"dup /Private 8 dict dup begin\n");
+
+ WRF_wstring(a_output,"/MinFeature {16 16} def\n");
+ WRF_wstring(a_output,"/password 5839 def\n");
+ if (Write_CharStrings)
+ write_word_entry(a_fapi_font,a_output,"lenIV",FAPI_FONT_FEATURE_lenIV,1);
+ else
+ WRF_wstring(a_output,"/lenIV -1 def\n"); /* indicate that /subrs are not encoded. */
+ write_word_entry(a_fapi_font,a_output,"BlueFuzz",FAPI_FONT_FEATURE_BlueFuzz,16);
+
+ WRF_wstring(a_output,"/BlueScale ");
+ WRF_wfloat(a_output,a_fapi_font->get_long(a_fapi_font,FAPI_FONT_FEATURE_BlueScale,0) / 65536.0);
+ WRF_wstring(a_output," def\n");
+
+ write_word_entry(a_fapi_font,a_output,"BlueShift",FAPI_FONT_FEATURE_BlueShift,16);
+ write_array_entry(a_fapi_font,a_output,"BlueValues",FAPI_FONT_FEATURE_BlueValues,16);
+ write_array_entry(a_fapi_font,a_output,"OtherBlues",FAPI_FONT_FEATURE_OtherBlues,16);
+ write_array_entry(a_fapi_font,a_output,"FamilyBlues",FAPI_FONT_FEATURE_FamilyBlues,16);
+ write_array_entry(a_fapi_font,a_output,"FamilyOtherBlues",FAPI_FONT_FEATURE_FamilyOtherBlues,16);
+ write_word_entry(a_fapi_font,a_output,"ForceBold",FAPI_FONT_FEATURE_ForceBold,1);
+ write_array_entry_with_count(a_fapi_font,a_output,"StdHW",FAPI_FONT_FEATURE_StdHW,1,16);
+ write_array_entry_with_count(a_fapi_font,a_output,"StdVW",FAPI_FONT_FEATURE_StdVW,1,16);
+ write_array_entry(a_fapi_font,a_output,"StemSnapH",FAPI_FONT_FEATURE_StemSnapH,16);
+ write_array_entry(a_fapi_font,a_output,"StemSnapV",FAPI_FONT_FEATURE_StemSnapV,16);
+
+ if (is_MM_font(a_fapi_font)) {
+ WRF_wstring(a_output,"3 index /Blend get /Private get begin\n");
+ WRF_wstring(a_output,"|-\n");
+ }
+ if (Write_CharStrings)
+ write_subrs(a_fapi_font,a_output, 1);
+ else
+ write_subrs(a_fapi_font,a_output, 0);
+ if (Write_CharStrings)
+ write_charstrings(a_fapi_font,a_output);
+ }
static void write_blend_dictionary(FAPI_font* a_fapi_font,WRF_output* a_output)
{
}
static void write_main_dictionary(FAPI_font* a_fapi_font,WRF_output* a_output, int Write_CharStrings)
- {
- int i;
- WRF_wstring(a_output,"5 dict begin\n");
+ {
+ int i;
+ WRF_wstring(a_output,"5 dict begin\n");
WRF_wstring(a_output,"/FontType 1 def\n");
- WRF_wstring(a_output,"/FontMatrix [");
- for (i = 0; i < 6; i++)
- {
- WRF_wfloat(a_output,a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_FontMatrix,i));
- WRF_wbyte(a_output,(byte)(i == 5 ? ']' : ' '));
- }
- WRF_wbyte(a_output,'\n');
-
- /* For now, specify standard encoding - I think GS will pass glyph indices so doesn't matter. */
- WRF_wstring(a_output,"/Encoding StandardEncoding def\n");
-
- WRF_wstring(a_output,"/FontBBox {");
- for (i = 0; i < 4; i++)
- {
- short x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_FontBBox,i);
- WRF_wint(a_output,x);
- WRF_wbyte(a_output,(byte)(i == 3 ? '}' : ' '));
- }
- WRF_wbyte(a_output,'\n');
- if (is_MM_font(a_fapi_font)) {
- short x,x2;
- float x1;
- uint i, j, entries;
- char Buffer[255];
-
- entries = 0;
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
- if (x)
- entries++;
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrays_count,0);
- if (x)
- entries++;
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapArrays_count,0);
- if (x)
- entries++;
-
- sprintf(Buffer, "/FontInfo %d dict dup begin\n", entries);
- WRF_wstring(a_output, Buffer);
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
- if (x) {
- WRF_wstring(a_output, "/BlendAxisTypes [");
- for (i = 0;i < x;i++) {
- WRF_wstring(a_output," /");
- a_fapi_font->get_name(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes,i, (char *)&Buffer,255);
- WRF_wstring(a_output,Buffer);
- }
- WRF_wstring(a_output,"] def\n");
- }
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrays_count,0);
- if (x) {
- WRF_wstring(a_output, "/BlendDesignPositions [");
- x2 = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
- for (i = 0;i < x; i++) {
- WRF_wstring(a_output,"[");
- for (j = 0; j < x2; j++) {
- x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*8+j);
- sprintf(Buffer, "%f ", x1);
- WRF_wstring(a_output,Buffer);
- }
- WRF_wstring(a_output,"]");
- }
- WRF_wstring(a_output, "] def\n");
- }
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapArrays_count,0);
- if (x) {
- WRF_wstring(a_output, "/BlendDesignMap [");
- for (i = 0;i < x;i++) {
- x2 = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapSubArrays_count,i);
- WRF_wstring(a_output,"[");
- for (j = 0; j < x2; j++) {
- WRF_wstring(a_output,"[");
- x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*64+j*64);
- sprintf(Buffer, "%f ", x1);
- WRF_wstring(a_output,Buffer);
- x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*64+j*64 + 1);
- sprintf(Buffer, "%f ", x1);
- WRF_wstring(a_output,Buffer);
- WRF_wstring(a_output,"]");
- }
- WRF_wstring(a_output,"]");
- }
- WRF_wstring(a_output, "] def\n");
- }
- WRF_wstring(a_output,"end readonly def\n");
- WRF_wstring(a_output,"/$Blend {");
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_DollarBlend_length,0);
- if(a_output->m_count)
- a_output->m_count += x;
- x = a_fapi_font->get_proc(a_fapi_font,FAPI_FONT_FEATURE_DollarBlend,0,(char *)a_output->m_pos);
- if(a_output->m_pos)
- a_output->m_pos += x;
- WRF_wstring(a_output,"} def\n");
- WRF_wstring(a_output,"/$Blend {0.1 mul exch 0.45 mul add exch 0.17 mul add add} def\n");
- WRF_wstring(a_output,"/WeightVector [");
- x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_WeightVector_count,0);
- for (i = 0;i < x;i++) {
- x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_WeightVector,i);
- sprintf(Buffer, "%f ", x1);
- WRF_wstring(a_output,Buffer);
- }
- WRF_wstring(a_output,"] def\n");
- }
- WRF_wstring(a_output,"currentdict end\ncurrentfile eexec\n");
- write_private_dictionary(a_fapi_font,a_output, Write_CharStrings);
- if (is_MM_font(a_fapi_font)) {
- write_blend_dictionary(a_fapi_font, a_output);
- }
- }
-
+ WRF_wstring(a_output,"/FontMatrix [");
+ for (i = 0; i < 6; i++)
+ {
+ WRF_wfloat(a_output,a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_FontMatrix,i));
+ WRF_wbyte(a_output,(byte)(i == 5 ? ']' : ' '));
+ }
+ WRF_wbyte(a_output,'\n');
+
+ /* For now, specify standard encoding - I think GS will pass glyph indices so doesn't matter. */
+ WRF_wstring(a_output,"/Encoding StandardEncoding def\n");
+
+ WRF_wstring(a_output,"/FontBBox {");
+ for (i = 0; i < 4; i++)
+ {
+ short x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_FontBBox,i);
+ WRF_wint(a_output,x);
+ WRF_wbyte(a_output,(byte)(i == 3 ? '}' : ' '));
+ }
+ WRF_wbyte(a_output,'\n');
+ if (is_MM_font(a_fapi_font)) {
+ short x,x2;
+ float x1;
+ uint i, j, entries;
+ char Buffer[255];
+
+ entries = 0;
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
+ if (x)
+ entries++;
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrays_count,0);
+ if (x)
+ entries++;
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapArrays_count,0);
+ if (x)
+ entries++;
+
+ sprintf(Buffer, "/FontInfo %d dict dup begin\n", entries);
+ WRF_wstring(a_output, Buffer);
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
+ if (x) {
+ WRF_wstring(a_output, "/BlendAxisTypes [");
+ for (i = 0;i < x;i++) {
+ WRF_wstring(a_output," /");
+ a_fapi_font->get_name(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes,i, (char *)&Buffer,255);
+ WRF_wstring(a_output,Buffer);
+ }
+ WRF_wstring(a_output,"] def\n");
+ }
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrays_count,0);
+ if (x) {
+ WRF_wstring(a_output, "/BlendDesignPositions [");
+ x2 = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendAxisTypes_count,0);
+ for (i = 0;i < x; i++) {
+ WRF_wstring(a_output,"[");
+ for (j = 0; j < x2; j++) {
+ x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*8+j);
+ sprintf(Buffer, "%f ", x1);
+ WRF_wstring(a_output,Buffer);
+ }
+ WRF_wstring(a_output,"]");
+ }
+ WRF_wstring(a_output, "] def\n");
+ }
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapArrays_count,0);
+ if (x) {
+ WRF_wstring(a_output, "/BlendDesignMap [");
+ for (i = 0;i < x;i++) {
+ x2 = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignMapSubArrays_count,i);
+ WRF_wstring(a_output,"[");
+ for (j = 0; j < x2; j++) {
+ WRF_wstring(a_output,"[");
+ x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*64+j*64);
+ sprintf(Buffer, "%f ", x1);
+ WRF_wstring(a_output,Buffer);
+ x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_BlendDesignPositionsArrayValue,i*64+j*64 + 1);
+ sprintf(Buffer, "%f ", x1);
+ WRF_wstring(a_output,Buffer);
+ WRF_wstring(a_output,"]");
+ }
+ WRF_wstring(a_output,"]");
+ }
+ WRF_wstring(a_output, "] def\n");
+ }
+ WRF_wstring(a_output,"end readonly def\n");
+ WRF_wstring(a_output,"/$Blend {");
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_DollarBlend_length,0);
+ if(a_output->m_count)
+ a_output->m_count += x;
+ x = a_fapi_font->get_proc(a_fapi_font,FAPI_FONT_FEATURE_DollarBlend,0,(char *)a_output->m_pos);
+ if(a_output->m_pos)
+ a_output->m_pos += x;
+ WRF_wstring(a_output,"} def\n");
+ WRF_wstring(a_output,"/$Blend {0.1 mul exch 0.45 mul add exch 0.17 mul add add} def\n");
+ WRF_wstring(a_output,"/WeightVector [");
+ x = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_WeightVector_count,0);
+ for (i = 0;i < x;i++) {
+ x1 = a_fapi_font->get_float(a_fapi_font,FAPI_FONT_FEATURE_WeightVector,i);
+ sprintf(Buffer, "%f ", x1);
+ WRF_wstring(a_output,Buffer);
+ }
+ WRF_wstring(a_output,"] def\n");
+ }
+ WRF_wstring(a_output,"currentdict end\ncurrentfile eexec\n");
+ write_private_dictionary(a_fapi_font,a_output, Write_CharStrings);
+ if (is_MM_font(a_fapi_font)) {
+ write_blend_dictionary(a_fapi_font, a_output);
+ }
+ }
+
/**
Write a Type 1 font in textual format and return its length in bytes.
If a_buffer_size is less than the total length, only a_buffer_size bytes are written, but the total
@@ -336,25 +335,25 @@ is supplied to FreeType using the incremental interface, There is also no /Paint
by PostScript but FreeType doesn't use it.
*/
long FF_serialize_type1_font(FAPI_font* a_fapi_font,unsigned char* a_buffer,long a_buffer_size)
- {
- WRF_output output;
- WRF_init(&output,a_buffer,a_buffer_size);
-
- /* Leading comment identifying a Type 1 font. */
- WRF_wstring(&output,"%!PS-AdobeFont-1\n");
+ {
+ WRF_output output;
+ WRF_init(&output,a_buffer,a_buffer_size);
- write_main_dictionary(a_fapi_font,&output, 0);
- return output.m_count;
- }
+ /* Leading comment identifying a Type 1 font. */
+ WRF_wstring(&output,"%!PS-AdobeFont-1\n");
+
+ write_main_dictionary(a_fapi_font,&output, 0);
+ return output.m_count;
+ }
long FF_serialize_type1_font_complete(FAPI_font* a_fapi_font,unsigned char* a_buffer,long a_buffer_size)
- {
+ {
WRF_output output;
- WRF_init(&output,a_buffer,a_buffer_size);
-
- /* Leading comment identifying a Type 1 font. */
- WRF_wstring(&output,"%!PS-AdobeFont-1\n");
-
- write_main_dictionary(a_fapi_font,&output, 1);
- return output.m_count;
- }
+ WRF_init(&output,a_buffer,a_buffer_size);
+
+ /* Leading comment identifying a Type 1 font. */
+ WRF_wstring(&output,"%!PS-AdobeFont-1\n");
+
+ write_main_dictionary(a_fapi_font,&output, 1);
+ return output.m_count;
+ }
diff --git a/gs/psi/write_t1.h b/gs/psi/write_t1.h
index c0f538b73..8e6f01bbf 100644
--- a/gs/psi/write_t1.h
+++ b/gs/psi/write_t1.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/write_t2.c b/gs/psi/write_t2.c
index b9e29ed6c..123edc10b 100644
--- a/gs/psi/write_t2.c
+++ b/gs/psi/write_t2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,187 +31,187 @@ the FAPI FreeType implementation.
*/
static void write_4_byte_int(unsigned char* a_output,long a_int)
- {
- a_output[0] = (unsigned char)(a_int >> 24);
- a_output[1] = (unsigned char)(a_int >> 16);
- a_output[2] = (unsigned char)(a_int >> 8);
- a_output[3] = (unsigned char)(a_int & 0xFF);
- }
+ {
+ a_output[0] = (unsigned char)(a_int >> 24);
+ a_output[1] = (unsigned char)(a_int >> 16);
+ a_output[2] = (unsigned char)(a_int >> 8);
+ a_output[3] = (unsigned char)(a_int & 0xFF);
+ }
static void write_type2_int(WRF_output* a_output,long a_int)
- {
- if (a_int >= -107 && a_int <= 107)
- WRF_wbyte(a_output,(unsigned char)(a_int + 139));
- else if (a_int >= -32768 && a_int <= 32767)
- {
- if (a_int >= 108 && a_int <= 1131)
- a_int += 63124;
- else if (a_int >= -1131 && a_int <= -108)
- a_int = -a_int + 64148;
- else
- WRF_wbyte(a_output,28);
- WRF_wbyte(a_output,(unsigned char)(a_int >> 8));
- WRF_wbyte(a_output,(unsigned char)(a_int & 0xFF));
- }
- else
- {
- unsigned char buffer[4];
- WRF_wbyte(a_output,29);
- write_4_byte_int(buffer,a_int);
- WRF_wtext(a_output,buffer,4);
- }
- }
+ {
+ if (a_int >= -107 && a_int <= 107)
+ WRF_wbyte(a_output,(unsigned char)(a_int + 139));
+ else if (a_int >= -32768 && a_int <= 32767)
+ {
+ if (a_int >= 108 && a_int <= 1131)
+ a_int += 63124;
+ else if (a_int >= -1131 && a_int <= -108)
+ a_int = -a_int + 64148;
+ else
+ WRF_wbyte(a_output,28);
+ WRF_wbyte(a_output,(unsigned char)(a_int >> 8));
+ WRF_wbyte(a_output,(unsigned char)(a_int & 0xFF));
+ }
+ else
+ {
+ unsigned char buffer[4];
+ WRF_wbyte(a_output,29);
+ write_4_byte_int(buffer,a_int);
+ WRF_wtext(a_output,buffer,4);
+ }
+ }
static void write_type2_float(WRF_output* a_output,double a_float)
- {
- char buffer[32];
- const char* p = buffer;
- int high = true;
- char c = 0;
- sprintf(buffer,"%f",a_float);
- WRF_wbyte(a_output,30);
- for (;;)
- {
- char n = 0;
- if (*p >= '0' && *p <= '9')
- n = (char)(*p - '0');
- else if (*p == '.')
- n = 0xA;
- else if (*p == 'e' || *p == 'E')
- {
- if (p[1] == '-')
- {
- p++;
- n = 0xC;
- }
- else
- n = 0xB;
- }
- else if (*p == '-')
- n = 0xE;
- else if (*p == 0)
- n = 0xF;
- if (high)
- {
- if (*p == 0)
- WRF_wbyte(a_output,0xFF);
- else
- c = (char)(n << 4);
- }
- else
- {
- c |= n;
- WRF_wbyte(a_output,c);
- }
-
- if (*p == 0)
- break;
-
- high = !high;
- p++;
- }
- }
+ {
+ char buffer[32];
+ const char* p = buffer;
+ int high = true;
+ char c = 0;
+ sprintf(buffer,"%f",a_float);
+ WRF_wbyte(a_output,30);
+ for (;;)
+ {
+ char n = 0;
+ if (*p >= '0' && *p <= '9')
+ n = (char)(*p - '0');
+ else if (*p == '.')
+ n = 0xA;
+ else if (*p == 'e' || *p == 'E')
+ {
+ if (p[1] == '-')
+ {
+ p++;
+ n = 0xC;
+ }
+ else
+ n = 0xB;
+ }
+ else if (*p == '-')
+ n = 0xE;
+ else if (*p == 0)
+ n = 0xF;
+ if (high)
+ {
+ if (*p == 0)
+ WRF_wbyte(a_output,0xFF);
+ else
+ c = (char)(n << 4);
+ }
+ else
+ {
+ c |= n;
+ WRF_wbyte(a_output,c);
+ }
+
+ if (*p == 0)
+ break;
+
+ high = !high;
+ p++;
+ }
+ }
static void write_header(WRF_output* a_output)
- {
- WRF_wtext(a_output,(const unsigned char*)"\x1\x0\x4\x1",4);
- }
+ {
+ WRF_wtext(a_output,(const unsigned char*)"\x1\x0\x4\x1",4);
+ }
static void write_name_index(WRF_output* a_output)
- {
- /* Write a dummy name of 'x'. */
- WRF_wtext(a_output,(const unsigned char*)"\x0\x1\x1\x1\x2""x",6);
- }
+ {
+ /* Write a dummy name of 'x'. */
+ WRF_wtext(a_output,(const unsigned char*)"\x0\x1\x1\x1\x2""x",6);
+ }
static void write_word_entry(FAPI_font* a_fapi_font,WRF_output* a_output,int a_feature_id,
- int a_feature_count,bool a_two_byte_op,int a_op,int a_divisor)
- {
- if (a_feature_count > 0)
- {
- int i;
- for (i = 0; i < a_feature_count; i++)
- {
- /* Get the value and convert it from unsigned to signed. */
- short x = a_fapi_font->get_word(a_fapi_font,a_feature_id,i);
- /* Divide by the divisor to bring it back to font units. */
- x = (short)(x / a_divisor);
- write_type2_int(a_output,x);
- }
- if (a_two_byte_op)
- WRF_wbyte(a_output,12);
- WRF_wbyte(a_output,(unsigned char)a_op);
- }
- }
+ int a_feature_count,bool a_two_byte_op,int a_op,int a_divisor)
+ {
+ if (a_feature_count > 0)
+ {
+ int i;
+ for (i = 0; i < a_feature_count; i++)
+ {
+ /* Get the value and convert it from unsigned to signed. */
+ short x = a_fapi_font->get_word(a_fapi_font,a_feature_id,i);
+ /* Divide by the divisor to bring it back to font units. */
+ x = (short)(x / a_divisor);
+ write_type2_int(a_output,x);
+ }
+ if (a_two_byte_op)
+ WRF_wbyte(a_output,12);
+ WRF_wbyte(a_output,(unsigned char)a_op);
+ }
+ }
static void write_delta_array_entry(FAPI_font* a_fapi_font,WRF_output* a_output,int a_feature_id,
- bool a_two_byte_op,int a_op,int a_divisor)
- {
- int i;
- /* NOTE that the feature index (a_feature_id) must be preceded by the count index for this to work. */
- int count = a_fapi_font->get_word(a_fapi_font,a_feature_id - 1,0);
- if (count > 0)
- {
- short prev_value = 0;
- for (i = 0; i < count; i++)
- {
- /* Get the value and convert it from unsigned to signed. */
- short value = a_fapi_font->get_word(a_fapi_font,a_feature_id,i);
- /* Divide by the divisor to bring it back to font units. */
- value = (short)(value / a_divisor);
- write_type2_int(a_output,value - prev_value);
- prev_value = value;
- }
- if (a_two_byte_op)
- WRF_wbyte(a_output,12);
- WRF_wbyte(a_output,(unsigned char)a_op);
- }
- }
+ bool a_two_byte_op,int a_op,int a_divisor)
+ {
+ int i;
+ /* NOTE that the feature index (a_feature_id) must be preceded by the count index for this to work. */
+ int count = a_fapi_font->get_word(a_fapi_font,a_feature_id - 1,0);
+ if (count > 0)
+ {
+ short prev_value = 0;
+ for (i = 0; i < count; i++)
+ {
+ /* Get the value and convert it from unsigned to signed. */
+ short value = a_fapi_font->get_word(a_fapi_font,a_feature_id,i);
+ /* Divide by the divisor to bring it back to font units. */
+ value = (short)(value / a_divisor);
+ write_type2_int(a_output,value - prev_value);
+ prev_value = value;
+ }
+ if (a_two_byte_op)
+ WRF_wbyte(a_output,12);
+ WRF_wbyte(a_output,(unsigned char)a_op);
+ }
+ }
static void write_float_entry(FAPI_font* a_fapi_font,WRF_output* a_output,int a_feature_id,int a_feature_count,bool a_two_byte_op,int a_op)
- {
- if (a_feature_count > 0)
- {
- int i;
- for (i = 0; i < a_feature_count; i++)
- {
- double x = a_fapi_font->get_float(a_fapi_font,a_feature_id,i);
- write_type2_float(a_output,x);
- }
- if (a_two_byte_op)
- WRF_wbyte(a_output,12);
- WRF_wbyte(a_output,(unsigned char)a_op);
- }
- }
+ {
+ if (a_feature_count > 0)
+ {
+ int i;
+ for (i = 0; i < a_feature_count; i++)
+ {
+ double x = a_fapi_font->get_float(a_fapi_font,a_feature_id,i);
+ write_type2_float(a_output,x);
+ }
+ if (a_two_byte_op)
+ WRF_wbyte(a_output,12);
+ WRF_wbyte(a_output,(unsigned char)a_op);
+ }
+ }
static void write_font_dict_index(FAPI_font* a_fapi_font,WRF_output* a_output,
- unsigned char** a_charset_offset_ptr,
- unsigned char** a_charstrings_offset_ptr,
- unsigned char** a_private_dict_length_ptr)
- {
- unsigned char* data_start = 0;
- WRF_wtext(a_output,(const unsigned char *)"\x0\x1\x2\x0\x1\x0\x0",7); /* count = 1, offset size = 2, first offset = 1, last offset = 0 (to be filled in later). */
- if (a_output->m_pos)
- data_start = a_output->m_pos;
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FontBBox,4,false,5,1);
- write_float_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FontMatrix,6,true,7);
- write_type2_int(a_output,0); /* 0 = Standard Encoding. */
- WRF_wbyte(a_output,16); /* 16 = opcode for 'encoding'. */
- *a_charset_offset_ptr = a_output->m_pos;
- WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx",5); /* placeholder for the offset to the charset, which will be a 5-byte integer. */
- WRF_wbyte(a_output,15); /* opcode for 'charset' */
- *a_charstrings_offset_ptr = a_output->m_pos;
- WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx",5); /* placeholder for the offset to the Charstrings index, which will be a 5-byte integer. */
- WRF_wbyte(a_output,17); /* opcode for 'Charstrings' */
- *a_private_dict_length_ptr = a_output->m_pos;
- WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx\x1d""yyyy",10); /* placeholder for size and offset of Private dictionary, which will be 5-byte integers. */
- WRF_wbyte(a_output,18); /* opcode for 'Private' */
- if (a_output->m_pos)
- {
- int last_offset = a_output->m_pos - data_start + 1;
- data_start[-2] = (unsigned char)(last_offset >> 8);
- data_start[-1] = (unsigned char)(last_offset & 0xFF);
- }
- }
+ unsigned char** a_charset_offset_ptr,
+ unsigned char** a_charstrings_offset_ptr,
+ unsigned char** a_private_dict_length_ptr)
+ {
+ unsigned char* data_start = 0;
+ WRF_wtext(a_output,(const unsigned char *)"\x0\x1\x2\x0\x1\x0\x0",7); /* count = 1, offset size = 2, first offset = 1, last offset = 0 (to be filled in later). */
+ if (a_output->m_pos)
+ data_start = a_output->m_pos;
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FontBBox,4,false,5,1);
+ write_float_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FontMatrix,6,true,7);
+ write_type2_int(a_output,0); /* 0 = Standard Encoding. */
+ WRF_wbyte(a_output,16); /* 16 = opcode for 'encoding'. */
+ *a_charset_offset_ptr = a_output->m_pos;
+ WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx",5); /* placeholder for the offset to the charset, which will be a 5-byte integer. */
+ WRF_wbyte(a_output,15); /* opcode for 'charset' */
+ *a_charstrings_offset_ptr = a_output->m_pos;
+ WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx",5); /* placeholder for the offset to the Charstrings index, which will be a 5-byte integer. */
+ WRF_wbyte(a_output,17); /* opcode for 'Charstrings' */
+ *a_private_dict_length_ptr = a_output->m_pos;
+ WRF_wtext(a_output,(const unsigned char *)"\x1d""xxxx\x1d""yyyy",10); /* placeholder for size and offset of Private dictionary, which will be 5-byte integers. */
+ WRF_wbyte(a_output,18); /* opcode for 'Private' */
+ if (a_output->m_pos)
+ {
+ int last_offset = a_output->m_pos - data_start + 1;
+ data_start[-2] = (unsigned char)(last_offset >> 8);
+ data_start[-1] = (unsigned char)(last_offset & 0xFF);
+ }
+ }
/**
Write the character set. Return the number of characters.
@@ -220,219 +220,219 @@ via the FAPI interface, and FreeType doesn't need to know anything more
than the fact that there is at least one character.
*/
static int write_charset(WRF_output* a_output,unsigned char* a_charset_offset_ptr)
- {
- const int characters = 1;
- int i = 0;
-
- /* Write the offset to the start of the charset to the top dictionary. */
- if (a_output->m_pos)
- write_4_byte_int(a_charset_offset_ptr + 1,a_output->m_count);
-
- /*
- Write the charset. Write one less than the number of characters,
- because the first one is assumed to be .notdef. For the moment
- write all the others as .notdef (SID = 0) because we don't actually
- need the charset at the moment.
- */
- WRF_wbyte(a_output,0); /* format = 0 */
- for (i = 1; i < characters; i++)
- {
- WRF_wbyte(a_output,0);
- WRF_wbyte(a_output,0);
- }
-
- return characters;
- }
+ {
+ const int characters = 1;
+ int i = 0;
+
+ /* Write the offset to the start of the charset to the top dictionary. */
+ if (a_output->m_pos)
+ write_4_byte_int(a_charset_offset_ptr + 1,a_output->m_count);
+
+ /*
+ Write the charset. Write one less than the number of characters,
+ because the first one is assumed to be .notdef. For the moment
+ write all the others as .notdef (SID = 0) because we don't actually
+ need the charset at the moment.
+ */
+ WRF_wbyte(a_output,0); /* format = 0 */
+ for (i = 1; i < characters; i++)
+ {
+ WRF_wbyte(a_output,0);
+ WRF_wbyte(a_output,0);
+ }
+
+ return characters;
+ }
/**
Write a set of empty charstrings. The only reason for the existence of the charstrings index is to tell
FreeType how many glyphs there are.
*/
static void write_charstrings_index(WRF_output* a_output,int a_characters,unsigned char* a_charstrings_offset_ptr)
- {
- /* Write the offset to the charstrings index to the top dictionary. */
- if (a_output->m_pos)
- write_4_byte_int(a_charstrings_offset_ptr + 1,a_output->m_count);
-
- /* Write the index. */
- WRF_wbyte(a_output,(unsigned char)(a_characters >> 8));
- WRF_wbyte(a_output,(unsigned char)(a_characters & 0xFF));
- WRF_wbyte(a_output,1); /* offset size = 1. */
- while (a_characters-- >= 0)
- WRF_wbyte(a_output,1); /* offset = 1 */
- }
+ {
+ /* Write the offset to the charstrings index to the top dictionary. */
+ if (a_output->m_pos)
+ write_4_byte_int(a_charstrings_offset_ptr + 1,a_output->m_count);
+
+ /* Write the index. */
+ WRF_wbyte(a_output,(unsigned char)(a_characters >> 8));
+ WRF_wbyte(a_output,(unsigned char)(a_characters & 0xFF));
+ WRF_wbyte(a_output,1); /* offset size = 1. */
+ while (a_characters-- >= 0)
+ WRF_wbyte(a_output,1); /* offset = 1 */
+ }
static void write_gsubrs_index(FAPI_font* a_fapi_font,WRF_output* a_output)
- {
- unsigned char* cur_offset = 0;
- unsigned char* data_start = 0;
- int i;
- int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_GlobalSubrs_count,0);
-
- WRF_wbyte(a_output,(unsigned char)(count >> 8));
- WRF_wbyte(a_output,(unsigned char)(count & 0xFF));
-
- if (count <= 0)
- return;
-
- WRF_wbyte(a_output,4); /* offset size = 4 bytes */
- WRF_wtext(a_output,(const unsigned char *)"\x0\x0\x0\x1",4); /* first offset = 1 */
-
- if (a_output->m_pos)
- cur_offset = a_output->m_pos;
-
- /* Write dummy bytes for the offsets at the end of each data item. */
- for (i = 0; i < count; i++)
- WRF_wtext(a_output,(const unsigned char *)"xxxx",4);
-
- if (a_output->m_pos)
- data_start = a_output->m_pos;
-
- for (i = 0; i < count; i++)
- {
- long buffer_size = a_output->m_limit - a_output->m_count;
- long length = a_fapi_font->get_gsubr(a_fapi_font,i,a_output->m_pos,(ushort)buffer_size);
- if (a_output->m_pos)
- WRF_wtext(a_output,a_output->m_pos,length);
- else
- a_output->m_count += length;
- if (cur_offset)
- {
- long pos = a_output->m_pos - data_start + 1;
- write_4_byte_int(cur_offset,pos);
- cur_offset += 4;
- }
- }
- }
+ {
+ unsigned char* cur_offset = 0;
+ unsigned char* data_start = 0;
+ int i;
+ int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_GlobalSubrs_count,0);
+
+ WRF_wbyte(a_output,(unsigned char)(count >> 8));
+ WRF_wbyte(a_output,(unsigned char)(count & 0xFF));
+
+ if (count <= 0)
+ return;
+
+ WRF_wbyte(a_output,4); /* offset size = 4 bytes */
+ WRF_wtext(a_output,(const unsigned char *)"\x0\x0\x0\x1",4); /* first offset = 1 */
+
+ if (a_output->m_pos)
+ cur_offset = a_output->m_pos;
+
+ /* Write dummy bytes for the offsets at the end of each data item. */
+ for (i = 0; i < count; i++)
+ WRF_wtext(a_output,(const unsigned char *)"xxxx",4);
+
+ if (a_output->m_pos)
+ data_start = a_output->m_pos;
+
+ for (i = 0; i < count; i++)
+ {
+ long buffer_size = a_output->m_limit - a_output->m_count;
+ long length = a_fapi_font->get_gsubr(a_fapi_font,i,a_output->m_pos,(ushort)buffer_size);
+ if (a_output->m_pos)
+ WRF_wtext(a_output,a_output->m_pos,length);
+ else
+ a_output->m_count += length;
+ if (cur_offset)
+ {
+ long pos = a_output->m_pos - data_start + 1;
+ write_4_byte_int(cur_offset,pos);
+ cur_offset += 4;
+ }
+ }
+ }
static void write_subrs_index(FAPI_font* a_fapi_font,WRF_output* a_output)
- {
- unsigned char* cur_offset = 0;
- unsigned char* data_start = 0;
- int i;
- int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
-
- WRF_wbyte(a_output,(unsigned char)(count >> 8));
- WRF_wbyte(a_output,(unsigned char)(count & 0xFF));
-
- if (count <= 0)
- return;
-
- WRF_wbyte(a_output,4); /* offset size = 4 bytes */
- WRF_wtext(a_output,(const unsigned char *)"\x0\x0\x0\x1",4); /* first offset = 1 */
-
- if (a_output->m_pos)
- cur_offset = a_output->m_pos;
-
- /* Write dummy bytes for the offsets at the end of each data item. */
- for (i = 0; i < count; i++)
- WRF_wtext(a_output,(const unsigned char *)"xxxx",4);
-
- if (a_output->m_pos)
- data_start = a_output->m_pos;
-
- for (i = 0; i < count; i++)
- {
- long buffer_size = a_output->m_limit - a_output->m_count;
- long length = a_fapi_font->get_subr(a_fapi_font,i,a_output->m_pos,(ushort)buffer_size);
- if (a_output->m_pos)
- WRF_wtext(a_output,a_output->m_pos,length);
- else
- a_output->m_count += length;
- if (cur_offset)
- {
- long pos = a_output->m_pos - data_start + 1;
- write_4_byte_int(cur_offset,pos);
- cur_offset += 4;
- }
- }
- }
+ {
+ unsigned char* cur_offset = 0;
+ unsigned char* data_start = 0;
+ int i;
+ int count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
+
+ WRF_wbyte(a_output,(unsigned char)(count >> 8));
+ WRF_wbyte(a_output,(unsigned char)(count & 0xFF));
+
+ if (count <= 0)
+ return;
+
+ WRF_wbyte(a_output,4); /* offset size = 4 bytes */
+ WRF_wtext(a_output,(const unsigned char *)"\x0\x0\x0\x1",4); /* first offset = 1 */
+
+ if (a_output->m_pos)
+ cur_offset = a_output->m_pos;
+
+ /* Write dummy bytes for the offsets at the end of each data item. */
+ for (i = 0; i < count; i++)
+ WRF_wtext(a_output,(const unsigned char *)"xxxx",4);
+
+ if (a_output->m_pos)
+ data_start = a_output->m_pos;
+
+ for (i = 0; i < count; i++)
+ {
+ long buffer_size = a_output->m_limit - a_output->m_count;
+ long length = a_fapi_font->get_subr(a_fapi_font,i,a_output->m_pos,(ushort)buffer_size);
+ if (a_output->m_pos)
+ WRF_wtext(a_output,a_output->m_pos,length);
+ else
+ a_output->m_count += length;
+ if (cur_offset)
+ {
+ long pos = a_output->m_pos - data_start + 1;
+ write_4_byte_int(cur_offset,pos);
+ cur_offset += 4;
+ }
+ }
+ }
static void write_private_dict(FAPI_font* a_fapi_font,WRF_output* a_output,unsigned char* a_private_dict_length_ptr)
- {
- int count, initial = a_output->m_count;
- /* Write the offset to the start of the private dictionary to the top dictionary. */
- unsigned char* start = a_output->m_pos;
- if (a_output->m_pos)
- write_4_byte_int(a_private_dict_length_ptr + 6,a_output->m_count);
-
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueFuzz,1,true,11,16);
-
- write_type2_float(a_output,a_fapi_font->get_long(a_fapi_font,FAPI_FONT_FEATURE_BlueScale,0) / 65536.0);
- WRF_wbyte(a_output,12);
- WRF_wbyte(a_output,9);
-
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueShift,1,true,10,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueValues,false,6,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_OtherBlues,false,7,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FamilyBlues,false,8,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FamilyOtherBlues,false,9,16);
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_ForceBold,1,true,14,1);
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StdHW,1,false,10,16);
- write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StdVW,1,false,11,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StemSnapH,true,12,16);
- write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StemSnapV,true,13,16);
-
- /*
- Write the default width and the nominal width. These values are not available via
- the FAPI interface so we have to get a pointer to the Type 1 font structure and
- extract them directly.
- */
- {
- gs_font_type1* t1 = (gs_font_type1*)a_fapi_font->client_font_data;
+ {
+ int count, initial = a_output->m_count;
+ /* Write the offset to the start of the private dictionary to the top dictionary. */
+ unsigned char* start = a_output->m_pos;
+ if (a_output->m_pos)
+ write_4_byte_int(a_private_dict_length_ptr + 6,a_output->m_count);
+
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueFuzz,1,true,11,16);
+
+ write_type2_float(a_output,a_fapi_font->get_long(a_fapi_font,FAPI_FONT_FEATURE_BlueScale,0) / 65536.0);
+ WRF_wbyte(a_output,12);
+ WRF_wbyte(a_output,9);
+
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueShift,1,true,10,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_BlueValues,false,6,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_OtherBlues,false,7,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FamilyBlues,false,8,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_FamilyOtherBlues,false,9,16);
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_ForceBold,1,true,14,1);
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StdHW,1,false,10,16);
+ write_word_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StdVW,1,false,11,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StemSnapH,true,12,16);
+ write_delta_array_entry(a_fapi_font,a_output,FAPI_FONT_FEATURE_StemSnapV,true,13,16);
+
+ /*
+ Write the default width and the nominal width. These values are not available via
+ the FAPI interface so we have to get a pointer to the Type 1 font structure and
+ extract them directly.
+ */
+ {
+ gs_font_type1* t1 = (gs_font_type1*)a_fapi_font->client_font_data;
write_type2_float(a_output,fixed2float(t1->data.defaultWidthX));
- WRF_wbyte(a_output,20);
+ WRF_wbyte(a_output,20);
write_type2_float(a_output,fixed2float(t1->data.nominalWidthX));
- WRF_wbyte(a_output,21);
- }
-
- count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
- /* If we have local /Subrs we need to make a new dict ( see calling routine) and
- * we also need to add an entry to the Provate dict with an offset to the /Subrs
- * dict. This is complicated by the fact that the offset includes the data for
- * the offset (its contained in the Private dict) and the size of the data depends
- * on its value (because of number representation).
- */
- if (count) {
- int n = 1, n1;
-
- do {
- n1 = a_output->m_count - initial + 1 + n; /* one for the operator, plus the size needed for the representation */
- switch (n) {
- case 1:
- if (n1 >= -107 && n1 <= 107) {
- write_type2_int(a_output, n1);
- n = 5;
- }
- break;
- case 2:
- if ((n1 >= 108 && n1 <= 1131) || (n1 >= -1131 && n1 <= -108)) {
- write_type2_int(a_output, n1);
- n = 5;
- }
- break;
- case 3:
- if (n1 >= -32768 && n1 <= 32767) {
- write_type2_int(a_output, n1);
- n = 5;
- }
- break;
- case 4:
- break;
- case 5:
- write_type2_int(a_output, n1);
- break;
- }
- n++;
- } while (n < 5);
-
- WRF_wbyte(a_output,19);
- }
-
- /* Write the length in bytes of the private dictionary to the top dictionary. */
- if (a_output->m_pos)
- write_4_byte_int(a_private_dict_length_ptr + 1,a_output->m_pos - start);
- }
+ WRF_wbyte(a_output,21);
+ }
+
+ count = a_fapi_font->get_word(a_fapi_font,FAPI_FONT_FEATURE_Subrs_count,0);
+ /* If we have local /Subrs we need to make a new dict ( see calling routine) and
+ * we also need to add an entry to the Provate dict with an offset to the /Subrs
+ * dict. This is complicated by the fact that the offset includes the data for
+ * the offset (its contained in the Private dict) and the size of the data depends
+ * on its value (because of number representation).
+ */
+ if (count) {
+ int n = 1, n1;
+
+ do {
+ n1 = a_output->m_count - initial + 1 + n; /* one for the operator, plus the size needed for the representation */
+ switch (n) {
+ case 1:
+ if (n1 >= -107 && n1 <= 107) {
+ write_type2_int(a_output, n1);
+ n = 5;
+ }
+ break;
+ case 2:
+ if ((n1 >= 108 && n1 <= 1131) || (n1 >= -1131 && n1 <= -108)) {
+ write_type2_int(a_output, n1);
+ n = 5;
+ }
+ break;
+ case 3:
+ if (n1 >= -32768 && n1 <= 32767) {
+ write_type2_int(a_output, n1);
+ n = 5;
+ }
+ break;
+ case 4:
+ break;
+ case 5:
+ write_type2_int(a_output, n1);
+ break;
+ }
+ n++;
+ } while (n < 5);
+
+ WRF_wbyte(a_output,19);
+ }
+
+ /* Write the length in bytes of the private dictionary to the top dictionary. */
+ if (a_output->m_pos)
+ write_4_byte_int(a_private_dict_length_ptr + 1,a_output->m_pos - start);
+ }
/**
Write a Type 2 font in binary format and return its length in bytes.
@@ -440,27 +440,27 @@ If a_buffer_size is less than the total length, only a_buffer_size bytes are wri
length is returned correctly.
*/
long FF_serialize_type2_font(FAPI_font* a_fapi_font,unsigned char* a_buffer,long a_buffer_size)
- {
- unsigned char* charset_offset_ptr = NULL;
- unsigned char* charstrings_offset_ptr = NULL;
- unsigned char* private_dict_length_ptr = NULL;
- int characters = 0;
-
- WRF_output output;
- WRF_init(&output,a_buffer,a_buffer_size);
-
- write_header(&output);
- write_name_index(&output);
- write_font_dict_index(a_fapi_font,&output,&charset_offset_ptr,&charstrings_offset_ptr,&private_dict_length_ptr);
-
- /* Write an empty string index. */
- WRF_wtext(&output,(const unsigned char *)"\x0\x0",2);
-
- write_gsubrs_index(a_fapi_font,&output);
- characters = write_charset(&output,charset_offset_ptr);
- write_charstrings_index(&output,characters,charstrings_offset_ptr);
- write_private_dict(a_fapi_font,&output,private_dict_length_ptr);
- write_subrs_index(a_fapi_font,&output);
-
- return output.m_count;
- }
+ {
+ unsigned char* charset_offset_ptr = NULL;
+ unsigned char* charstrings_offset_ptr = NULL;
+ unsigned char* private_dict_length_ptr = NULL;
+ int characters = 0;
+
+ WRF_output output;
+ WRF_init(&output,a_buffer,a_buffer_size);
+
+ write_header(&output);
+ write_name_index(&output);
+ write_font_dict_index(a_fapi_font,&output,&charset_offset_ptr,&charstrings_offset_ptr,&private_dict_length_ptr);
+
+ /* Write an empty string index. */
+ WRF_wtext(&output,(const unsigned char *)"\x0\x0",2);
+
+ write_gsubrs_index(a_fapi_font,&output);
+ characters = write_charset(&output,charset_offset_ptr);
+ write_charstrings_index(&output,characters,charstrings_offset_ptr);
+ write_private_dict(a_fapi_font,&output,private_dict_length_ptr);
+ write_subrs_index(a_fapi_font,&output);
+
+ return output.m_count;
+ }
diff --git a/gs/psi/write_t2.h b/gs/psi/write_t2.h
index ee6b60121..383ffa9e3 100644
--- a/gs/psi/write_t2.h
+++ b/gs/psi/write_t2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zalg.c b/gs/psi/zalg.c
index ba05af810..ce7f31707 100644
--- a/gs/psi/zalg.c
+++ b/gs/psi/zalg.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,25 +57,25 @@ zsort(i_ctx_t *i_ctx_p)
/* Check operands for type and access */
/* we can sort only writable [and unpacked] arrays */
if (r_type(&op[-1]) == t_mixedarray || r_type(&op[-1]) == t_shortarray)
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
check_write_type(op[-1], t_array);
/* the predicate must be an executable array/ string/ name/ [pseudo-]operator */
if (!r_has_attr(&op[0], a_executable))
- return_op_typecheck(&op[0]);
+ return_op_typecheck(&op[0]);
switch (r_btype(&op[0])) {
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- case t_string:
- if (!r_has_attr(&op[0], a_execute))
- return_error(e_invalidaccess);
- break;
- case t_name:
- case t_operator:
- case t_oparray:
- break;
- default:
- return_op_typecheck(&op[0]);
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ case t_string:
+ if (!r_has_attr(&op[0], a_execute))
+ return_error(e_invalidaccess);
+ break;
+ case t_name:
+ case t_operator:
+ case t_oparray:
+ break;
+ default:
+ return_op_typecheck(&op[0]);
}
/*
* if array length <= 1, then nothing to sort
@@ -83,23 +83,23 @@ zsort(i_ctx_t *i_ctx_p)
*/
N = r_size(&op[-1]);
if (N <= 1) {
- pop(1);
- return 0;
+ pop(1);
+ return 0;
} else {
- check_estack(11);
- push_mark_estack(es_other, zsort_cleanup);
+ check_estack(11);
+ push_mark_estack(es_other, zsort_cleanup);
/*H1:*/ make_int(&esp[1], N / 2 + 1); /* l */
- make_int(&esp[2], N); /* r */
- make_int(&esp[3], 0); /* i */
- make_int(&esp[4], 0); /* j */
- make_null(&esp[5]); /* R */
- make_int(&esp[6], 2); /* H */
- ref_assign(&esp[7], &op[0]); /* lt */
- ref_assign(&esp[8], &op[-1]); /* the array */
- esp += 8;
- make_op_estack(&esp[1], zsort_continue);
- make_null(&op[0]); /* result of <lt>, not used when H = 2 */
- return zsort_continue(i_ctx_p);
+ make_int(&esp[2], N); /* r */
+ make_int(&esp[3], 0); /* i */
+ make_int(&esp[4], 0); /* j */
+ make_null(&esp[5]); /* R */
+ make_int(&esp[6], 2); /* H */
+ ref_assign(&esp[7], &op[0]); /* lt */
+ ref_assign(&esp[8], &op[-1]); /* the array */
+ esp += 8;
+ make_op_estack(&esp[1], zsort_continue);
+ make_null(&op[0]); /* result of <lt>, not used when H = 2 */
+ return zsort_continue(i_ctx_p);
}
}
@@ -122,59 +122,59 @@ zsort_continue(i_ctx_t *i_ctx_p)
status = esp - 8;
Rn = arry.value.refs - 1; /* the -1 compensates for using 1-based indices */
switch (H) {
- case 2:
+ case 2:
H2: if (l > 1) {
- l--;
- ref_assign(&R, &Rn[l]);
- } else {
- ref_assign(&R, &Rn[r]);
- ref_assign_old(&arry, &Rn[r], &Rn[1], ".sort(H2-a)");
- r--;
- if (r <= 1) {
- ref_assign_old(&arry, &Rn[1], &R, ".sort(H2-b)");
- esp -= 9;
- pop(1);
- return o_pop_estack;
- }
- }
+ l--;
+ ref_assign(&R, &Rn[l]);
+ } else {
+ ref_assign(&R, &Rn[r]);
+ ref_assign_old(&arry, &Rn[r], &Rn[1], ".sort(H2-a)");
+ r--;
+ if (r <= 1) {
+ ref_assign_old(&arry, &Rn[1], &R, ".sort(H2-b)");
+ esp -= 9;
+ pop(1);
+ return o_pop_estack;
+ }
+ }
/* H3: */ j = l;
H4: i = j;
- j <<= 1;
- if (j >= r)
- if (j == r)
- goto H6;
- else
- goto H8;
- else {
+ j <<= 1;
+ if (j >= r)
+ if (j == r)
+ goto H6;
+ else
+ goto H8;
+ else {
/* H5: */ H = 5;
- push(1);
- ref_assign(&op[-1], &Rn[j]);
- ref_assign(&op[0], &Rn[j + 1]);
- break;
- }
- case 5:
+ push(1);
+ ref_assign(&op[-1], &Rn[j]);
+ ref_assign(&op[0], &Rn[j + 1]);
+ break;
+ }
+ case 5:
/*H5_cont:*/if (!r_has_type(&op[0], t_boolean))
- return_error(e_typecheck);
- if (op[0].value.boolval)
- j++;
+ return_error(e_typecheck);
+ if (op[0].value.boolval)
+ j++;
H6: H = 6;
- push(1);
- ref_assign(&op[-1], &R);
- ref_assign(&op[0], &Rn[j]);
- break;
- case 6:
+ push(1);
+ ref_assign(&op[-1], &R);
+ ref_assign(&op[0], &Rn[j]);
+ break;
+ case 6:
/*H6_cont:*/if (!r_has_type(&op[0], t_boolean))
- return_error(e_typecheck);
- if (op[0].value.boolval) {
+ return_error(e_typecheck);
+ if (op[0].value.boolval) {
/* H7: */ ref_assign_old(&arry, &Rn[i], &Rn[j], ".sort(H7)");
- goto H4;
- } else {
+ goto H4;
+ } else {
H8: ref_assign_old(&arry, &Rn[i], &R, ".sort(H8)");
- goto H2;
- }
- default:
- pop(1);
- return_error(gs_error_unregistered); /* Must not happen. */
+ goto H2;
+ }
+ default:
+ pop(1);
+ return_error(gs_error_unregistered); /* Must not happen. */
}
esp += 2;
ref_assign(esp, &lt);
@@ -200,7 +200,7 @@ zsort_cleanup(i_ctx_t *i_ctx_p)
const op_def zalg_op_defs[] =
{
{"2.sort", zsort},
- /* Internal operators */
+ /* Internal operators */
{"1%zsort_continue", zsort_continue},
op_def_end(0)
};
diff --git a/gs/psi/zarith.c b/gs/psi/zarith.c
index a302f3885..9c0aac394 100644
--- a/gs/psi/zarith.c
+++ b/gs/psi/zarith.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,35 +38,35 @@ zop_add(register os_ptr op)
{
switch (r_type(op)) {
default:
- return_op_typecheck(op);
+ return_op_typecheck(op);
case t_real:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval += op->value.realval;
- break;
- case t_integer:
- make_real(op - 1, (double)op[-1].value.intval + op->value.realval);
- }
- break;
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval += op->value.realval;
+ break;
+ case t_integer:
+ make_real(op - 1, (double)op[-1].value.intval + op->value.realval);
+ }
+ break;
case t_integer:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval += (double)op->value.intval;
- break;
- case t_integer: {
- int int2 = op->value.intval;
-
- if (((op[-1].value.intval += int2) ^ int2) < 0 &&
- ((op[-1].value.intval - int2) ^ int2) >= 0
- ) { /* Overflow, convert to real */
- make_real(op - 1, (double)(op[-1].value.intval - int2) + int2);
- }
- }
- }
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval += (double)op->value.intval;
+ break;
+ case t_integer: {
+ int int2 = op->value.intval;
+
+ if (((op[-1].value.intval += int2) ^ int2) < 0 &&
+ ((op[-1].value.intval - int2) ^ int2) >= 0
+ ) { /* Overflow, convert to real */
+ make_real(op - 1, (double)(op[-1].value.intval - int2) + int2);
+ }
+ }
+ }
}
return 0;
}
@@ -77,7 +77,7 @@ zadd(i_ctx_t *i_ctx_p)
int code = zop_add(op);
if (code == 0) {
- pop(1);
+ pop(1);
}
return code;
}
@@ -92,33 +92,33 @@ zdiv(i_ctx_t *i_ctx_p)
/* We can't use the non_int_cases macro, */
/* because we have to check explicitly for op == 0. */
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- if (op->value.realval == 0)
- return_error(e_undefinedresult);
- switch (r_type(op1)) {
- default:
- return_op_typecheck(op1);
- case t_real:
- op1->value.realval /= op->value.realval;
- break;
- case t_integer:
- make_real(op1, (double)op1->value.intval / op->value.realval);
- }
- break;
- case t_integer:
- if (op->value.intval == 0)
- return_error(e_undefinedresult);
- switch (r_type(op1)) {
- default:
- return_op_typecheck(op1);
- case t_real:
- op1->value.realval /= (double)op->value.intval;
- break;
- case t_integer:
- make_real(op1, (double)op1->value.intval / (double)op->value.intval);
- }
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ if (op->value.realval == 0)
+ return_error(e_undefinedresult);
+ switch (r_type(op1)) {
+ default:
+ return_op_typecheck(op1);
+ case t_real:
+ op1->value.realval /= op->value.realval;
+ break;
+ case t_integer:
+ make_real(op1, (double)op1->value.intval / op->value.realval);
+ }
+ break;
+ case t_integer:
+ if (op->value.intval == 0)
+ return_error(e_undefinedresult);
+ switch (r_type(op1)) {
+ default:
+ return_op_typecheck(op1);
+ case t_real:
+ op1->value.realval /= (double)op->value.intval;
+ break;
+ case t_integer:
+ make_real(op1, (double)op1->value.intval / (double)op->value.intval);
+ }
}
pop(1);
return 0;
@@ -132,35 +132,35 @@ zmul(i_ctx_t *i_ctx_p)
switch (r_type(op)) {
default:
- return_op_typecheck(op);
+ return_op_typecheck(op);
case t_real:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval *= op->value.realval;
- break;
- case t_integer:
- make_real(op - 1, (double)op[-1].value.intval * op->value.realval);
- }
- break;
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval *= op->value.realval;
+ break;
+ case t_integer:
+ make_real(op - 1, (double)op[-1].value.intval * op->value.realval);
+ }
+ break;
case t_integer:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval *= (double)op->value.intval;
- break;
- case t_integer: {
- double ab = (double)op[-1].value.intval * op->value.intval;
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval *= (double)op->value.intval;
+ break;
+ case t_integer: {
+ double ab = (double)op[-1].value.intval * op->value.intval;
if (ab > 2147483647.) /* (double)0x7fffffff */
make_real(op - 1, ab);
else if (ab < -2147483648.) /* (double)(int)0x80000000 */
make_real(op - 1, ab);
else
op[-1].value.intval = (int)ab;
- }
- }
+ }
+ }
}
pop(1);
return 0;
@@ -174,35 +174,35 @@ zop_sub(register os_ptr op)
{
switch (r_type(op)) {
default:
- return_op_typecheck(op);
+ return_op_typecheck(op);
case t_real:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval -= op->value.realval;
- break;
- case t_integer:
- make_real(op - 1, (double)op[-1].value.intval - op->value.realval);
- }
- break;
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval -= op->value.realval;
+ break;
+ case t_integer:
+ make_real(op - 1, (double)op[-1].value.intval - op->value.realval);
+ }
+ break;
case t_integer:
- switch (r_type(op - 1)) {
- default:
- return_op_typecheck(op - 1);
- case t_real:
- op[-1].value.realval -= (double)op->value.intval;
- break;
- case t_integer: {
- int int1 = op[-1].value.intval;
-
- if ((int1 ^ (op[-1].value.intval = int1 - op->value.intval)) < 0 &&
- (int1 ^ op->value.intval) < 0
- ) { /* Overflow, convert to real */
- make_real(op - 1, (float)int1 - op->value.intval);
- }
- }
- }
+ switch (r_type(op - 1)) {
+ default:
+ return_op_typecheck(op - 1);
+ case t_real:
+ op[-1].value.realval -= (double)op->value.intval;
+ break;
+ case t_integer: {
+ int int1 = op[-1].value.intval;
+
+ if ((int1 ^ (op[-1].value.intval = int1 - op->value.intval)) < 0 &&
+ (int1 ^ op->value.intval) < 0
+ ) { /* Overflow, convert to real */
+ make_real(op - 1, (float)int1 - op->value.intval);
+ }
+ }
+ }
}
return 0;
}
@@ -213,7 +213,7 @@ zsub(i_ctx_t *i_ctx_p)
int code = zop_sub(op);
if (code == 0) {
- pop(1);
+ pop(1);
}
return code;
}
@@ -227,8 +227,8 @@ zidiv(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
check_type(op[-1], t_integer);
if ((op->value.intval == 0) || (op[-1].value.intval == MIN_INTVAL && op->value.intval == -1)) {
- /* Anomalous boundary case: -MININT / -1, fail. */
- return_error(e_undefinedresult);
+ /* Anomalous boundary case: -MININT / -1, fail. */
+ return_error(e_undefinedresult);
}
op[-1].value.intval /= op->value.intval;
pop(1);
@@ -244,7 +244,7 @@ zmod(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
check_type(op[-1], t_integer);
if (op->value.intval == 0)
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
op[-1].value.intval %= op->value.intval;
pop(1);
return 0;
@@ -257,16 +257,16 @@ zneg(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- op->value.realval = -op->value.realval;
- break;
- case t_integer:
- if (op->value.intval == MIN_INTVAL)
- make_real(op, -(float)MIN_INTVAL);
- else
- op->value.intval = -op->value.intval;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ op->value.realval = -op->value.realval;
+ break;
+ case t_integer:
+ if (op->value.intval == MIN_INTVAL)
+ make_real(op, -(float)MIN_INTVAL);
+ else
+ op->value.intval = -op->value.intval;
}
return 0;
}
@@ -278,16 +278,16 @@ zabs(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- if (op->value.realval >= 0)
- return 0;
- break;
- case t_integer:
- if (op->value.intval >= 0)
- return 0;
- break;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ if (op->value.realval >= 0)
+ return 0;
+ break;
+ case t_integer:
+ if (op->value.intval >= 0)
+ return 0;
+ break;
}
return zneg(i_ctx_p);
}
@@ -299,11 +299,11 @@ zceiling(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- op->value.realval = ceil(op->value.realval);
- case t_integer:;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ op->value.realval = ceil(op->value.realval);
+ case t_integer:;
}
return 0;
}
@@ -315,11 +315,11 @@ zfloor(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- op->value.realval = floor(op->value.realval);
- case t_integer:;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ op->value.realval = floor(op->value.realval);
+ case t_integer:;
}
return 0;
}
@@ -331,11 +331,11 @@ zround(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- op->value.realval = floor(op->value.realval + 0.5);
- case t_integer:;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ op->value.realval = floor(op->value.realval + 0.5);
+ case t_integer:;
}
return 0;
}
@@ -347,14 +347,14 @@ ztruncate(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- default:
- return_op_typecheck(op);
- case t_real:
- op->value.realval =
- (op->value.realval < 0.0 ?
- ceil(op->value.realval) :
- floor(op->value.realval));
- case t_integer:;
+ default:
+ return_op_typecheck(op);
+ case t_real:
+ op->value.realval =
+ (op->value.realval < 0.0 ?
+ ceil(op->value.realval) :
+ floor(op->value.realval));
+ case t_integer:;
}
return 0;
}
diff --git a/gs/psi/zarray.c b/gs/psi/zarray.c
index 15b671aa2..cdb1e840a 100644
--- a/gs/psi/zarray.c
+++ b/gs/psi/zarray.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,13 +33,13 @@ zarray(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (op->value.intval > max_array_size)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
size = op->value.intval;
code = ialloc_ref_array((ref *)op, a_all, size, "array");
if (code < 0)
- return code;
+ return code;
refset_null(op->value.refs, size);
return 0;
}
@@ -54,30 +54,30 @@ zaload(i_ctx_t *i_ctx_p)
ref_assign(&aref, op);
if (!r_is_array(&aref))
- return_op_typecheck(op);
+ return_op_typecheck(op);
check_read(aref);
asize = r_size(&aref);
if (asize > ostop - op) { /* Use the slow, general algorithm. */
- int code = ref_stack_push(&o_stack, asize);
- uint i;
- const ref_packed *packed = aref.value.packed;
+ int code = ref_stack_push(&o_stack, asize);
+ uint i;
+ const ref_packed *packed = aref.value.packed;
- if (code < 0)
- return code;
- for (i = asize; i > 0; i--, packed = packed_next(packed))
- packed_get(imemory, packed, ref_stack_index(&o_stack, i));
- *osp = aref;
- return 0;
+ if (code < 0)
+ return code;
+ for (i = asize; i > 0; i--, packed = packed_next(packed))
+ packed_get(imemory, packed, ref_stack_index(&o_stack, i));
+ *osp = aref;
+ return 0;
}
if (r_has_type(&aref, t_array))
- memcpy(op, aref.value.refs, asize * sizeof(ref));
+ memcpy(op, aref.value.refs, asize * sizeof(ref));
else {
- uint i;
- const ref_packed *packed = aref.value.packed;
- os_ptr pdest = op;
+ uint i;
+ const ref_packed *packed = aref.value.packed;
+ os_ptr pdest = op;
- for (i = 0; i < asize; i++, pdest++, packed = packed_next(packed))
- packed_get(imemory, packed, pdest);
+ for (i = 0; i < asize; i++, pdest++, packed = packed_next(packed))
+ packed_get(imemory, packed, pdest);
}
push(asize);
ref_assign(op, &aref);
@@ -93,32 +93,32 @@ zastore(i_ctx_t *i_ctx_p)
int code;
if (!r_is_array(op))
- return_op_typecheck(op);
+ return_op_typecheck(op);
size = r_size(op);
/* Amazingly, the following is valid: 0 array noaccess astore */
if (size == 0)
return 0;
- if (!r_has_type_attrs(op, t_array, a_write))
+ if (!r_has_type_attrs(op, t_array, a_write))
return_error(e_invalidaccess);
if (size > op - osbot) {
- /* The store operation might involve other stack segments. */
- ref arr;
+ /* The store operation might involve other stack segments. */
+ ref arr;
- if (size >= ref_stack_count(&o_stack))
- return_error(e_stackunderflow);
- arr = *op;
- code = ref_stack_store(&o_stack, &arr, size, 1, 0, true, idmemory,
- "astore");
- if (code < 0)
- return code;
- ref_stack_pop(&o_stack, size);
- *ref_stack_index(&o_stack, 0) = arr;
+ if (size >= ref_stack_count(&o_stack))
+ return_error(e_stackunderflow);
+ arr = *op;
+ code = ref_stack_store(&o_stack, &arr, size, 1, 0, true, idmemory,
+ "astore");
+ if (code < 0)
+ return code;
+ ref_stack_pop(&o_stack, size);
+ *ref_stack_index(&o_stack, 0) = arr;
} else {
- code = refcpy_to_old(op, 0, op - size, size, idmemory, "astore");
- if (code < 0)
- return code;
- op[-(int)size] = *op;
- pop(size);
+ code = refcpy_to_old(op, 0, op - size, size, idmemory, "astore");
+ if (code < 0)
+ return code;
+ op[-(int)size] = *op;
+ pop(size);
}
return 0;
}
diff --git a/gs/psi/zbfont.c b/gs/psi/zbfont.c
index 1b63566bb..83e9fb274 100644
--- a/gs/psi/zbfont.c
+++ b/gs/psi/zbfont.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -67,11 +67,11 @@ zbuildfont3(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = build_gs_font_procs(op, &build);
if (code < 0)
- return code;
+ return code;
code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_user_defined,
- &st_gs_font_base, &build, bf_options_none);
+ &st_gs_font_base, &build, bf_options_none);
if (code < 0)
- return code;
+ return code;
return define_gs_font(i_ctx_p, (gs_font *) pfont);
}
@@ -86,35 +86,35 @@ zfont_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t gspace)
int code = array_get(pfont->memory, pencoding, (long)index, &cname);
if (code < 0 || !r_has_type(&cname, t_name))
- return gs_no_glyph;
+ return gs_no_glyph;
if (pfont->FontType == ft_user_defined && r_type(&pdata->BuildGlyph) == t_null) {
- ref nsref, tname;
-
- name_string_ref(pfont->memory, &cname, &nsref);
- if (r_size(&nsref) == 7 &&
- !memcmp(nsref.value.const_bytes, ".notdef", r_size(&nsref))) {
- /* A special support for high level devices.
- They need a glyph name but the font doesn't provide one
- due to an instandard BuildChar.
- Such fonts don't conform to PLRM section 5.3.7,
- but we've got real examples that we want to handle (Bug 686982).
- Construct a name here.
- Low level devices don't pass here, because regular PS interpretation
- doesn't need such names.
- */
- char buf[20];
- int code;
-
- if (gspace == GLYPH_SPACE_NOGEN)
- return gs_no_glyph;
- sprintf(buf, "j%ld", chr); /* 'j' is arbutrary. */
- code = name_ref(pfont->memory, (const byte *)buf, strlen(buf), &tname, 1);
- if (code < 0) {
- /* Can't propagate the error due to interface limitation,
- return with .notdef */
- } else
- cname = tname;
- }
+ ref nsref, tname;
+
+ name_string_ref(pfont->memory, &cname, &nsref);
+ if (r_size(&nsref) == 7 &&
+ !memcmp(nsref.value.const_bytes, ".notdef", r_size(&nsref))) {
+ /* A special support for high level devices.
+ They need a glyph name but the font doesn't provide one
+ due to an instandard BuildChar.
+ Such fonts don't conform to PLRM section 5.3.7,
+ but we've got real examples that we want to handle (Bug 686982).
+ Construct a name here.
+ Low level devices don't pass here, because regular PS interpretation
+ doesn't need such names.
+ */
+ char buf[20];
+ int code;
+
+ if (gspace == GLYPH_SPACE_NOGEN)
+ return gs_no_glyph;
+ sprintf(buf, "j%ld", chr); /* 'j' is arbutrary. */
+ code = name_ref(pfont->memory, (const byte *)buf, strlen(buf), &tname, 1);
+ if (code < 0) {
+ /* Can't propagate the error due to interface limitation,
+ return with .notdef */
+ } else
+ cname = tname;
+ }
}
return (gs_glyph)name_index(pfont->memory, &cname);
}
@@ -126,106 +126,106 @@ zfont_glyph_name(gs_font *font, gs_glyph index, gs_const_string *pstr)
ref nref, sref;
if (index >= gs_min_cid_glyph) { /* Fabricate a numeric name. */
- char cid_name[sizeof(gs_glyph) * 3 + 1];
- int code;
-
- sprintf(cid_name, "%lu", (ulong) index);
- code = name_ref(font->memory, (const byte *)cid_name, strlen(cid_name),
- &nref, 1);
- if (code < 0)
- return code;
+ char cid_name[sizeof(gs_glyph) * 3 + 1];
+ int code;
+
+ sprintf(cid_name, "%lu", (ulong) index);
+ code = name_ref(font->memory, (const byte *)cid_name, strlen(cid_name),
+ &nref, 1);
+ if (code < 0)
+ return code;
} else
- name_index_ref(font->memory, index, &nref);
+ name_index_ref(font->memory, index, &nref);
name_string_ref(font->memory, &nref, &sref);
pstr->data = sref.value.const_bytes;
pstr->size = r_size(&sref);
return 0;
}
-static gs_char
+static gs_char
gs_font_map_glyph_by_dict(const gs_memory_t *mem, const ref *map, gs_glyph glyph)
{
ref *v, n;
if (glyph >= gs_min_cid_glyph) {
- uint cid = glyph - gs_min_cid_glyph;
-
- if (dict_find_string(map, "CIDCount", &v) > 0) {
- /* This is a CIDDEcoding resource. */
- make_int(&n, cid / 256);
- if (dict_find(map, &n, &v) > 0) {
- ref vv;
-
- if (array_get(mem, v, cid % 256, &vv) == 0 && r_type(&vv) == t_integer)
- return vv.value.intval;
- }
- return GS_NO_CHAR; /* Absent in the map. */
- }
- /* This is GlyphNames2Unicode dictionary. */
- make_int(&n, cid);
+ uint cid = glyph - gs_min_cid_glyph;
+
+ if (dict_find_string(map, "CIDCount", &v) > 0) {
+ /* This is a CIDDEcoding resource. */
+ make_int(&n, cid / 256);
+ if (dict_find(map, &n, &v) > 0) {
+ ref vv;
+
+ if (array_get(mem, v, cid % 256, &vv) == 0 && r_type(&vv) == t_integer)
+ return vv.value.intval;
+ }
+ return GS_NO_CHAR; /* Absent in the map. */
+ }
+ /* This is GlyphNames2Unicode dictionary. */
+ make_int(&n, cid);
} else
- name_index_ref(mem, glyph, &n);
+ name_index_ref(mem, glyph, &n);
if (dict_find(map, &n, &v) > 0) {
- if (r_has_type(v, t_string)) {
- int i, l = r_size(v);
- gs_char c = 0;
-
- for (i = 0; i < l; i++)
- c = (c << 8) | v->value.const_bytes[i];
- return c;
- }
- if (r_type(v) == t_integer)
- return v->value.intval;
+ if (r_has_type(v, t_string)) {
+ int i, l = r_size(v);
+ gs_char c = 0;
+
+ for (i = 0; i < l; i++)
+ c = (c << 8) | v->value.const_bytes[i];
+ return c;
+ }
+ if (r_type(v) == t_integer)
+ return v->value.intval;
}
return GS_NO_CHAR; /* Absent in the map. */
}
/* Get Unicode UTF-16 code for a glyph. */
-gs_char
+gs_char
gs_font_map_glyph_to_unicode(gs_font *font, gs_glyph glyph, int ch)
{
font_data *pdata = pfont_data(font);
const ref *UnicodeDecoding;
if (r_type(&pdata->GlyphNames2Unicode) == t_dictionary) {
- gs_char c = gs_font_map_glyph_by_dict(font->memory,
- &pdata->GlyphNames2Unicode, glyph);
-
- if (c != GS_NO_CHAR)
- return c;
- if (ch != -1) { /* -1 indicates a CIDFont */
- /* Its possible that we have a GlyphNames2Unicode dictionary
- * which contains integers and Unicode values, rather than names
- * and Unicode values. This happens if the input was PDF, the font
- * has a ToUnicode Cmap, but no Encoding. In this case we need to
- * use the character code as an index into the dictionary. Try that
- * now before we fall back to the UnicodeDecoding.
- */
- ref *v, n;
-
- make_int(&n, ch);
- if (dict_find(&pdata->GlyphNames2Unicode, &n, &v) > 0) {
- if (r_has_type(v, t_string)) {
- int i, l = r_size(v);
- gs_char c = 0;
-
- for (i = 0; i < l; i++)
- c = (c << 8) | v->value.const_bytes[i];
- return c;
- }
- if (r_type(v) == t_integer)
- return v->value.intval;
- }
- }
- /*
- * Fall through, because test.ps for SF bug #529103 requres
- * to examine both tables. Due to that the Unicode Decoding resource
- * can't be a default value for FontInfo.GlyphNames2Unicode .
- */
+ gs_char c = gs_font_map_glyph_by_dict(font->memory,
+ &pdata->GlyphNames2Unicode, glyph);
+
+ if (c != GS_NO_CHAR)
+ return c;
+ if (ch != -1) { /* -1 indicates a CIDFont */
+ /* Its possible that we have a GlyphNames2Unicode dictionary
+ * which contains integers and Unicode values, rather than names
+ * and Unicode values. This happens if the input was PDF, the font
+ * has a ToUnicode Cmap, but no Encoding. In this case we need to
+ * use the character code as an index into the dictionary. Try that
+ * now before we fall back to the UnicodeDecoding.
+ */
+ ref *v, n;
+
+ make_int(&n, ch);
+ if (dict_find(&pdata->GlyphNames2Unicode, &n, &v) > 0) {
+ if (r_has_type(v, t_string)) {
+ int i, l = r_size(v);
+ gs_char c = 0;
+
+ for (i = 0; i < l; i++)
+ c = (c << 8) | v->value.const_bytes[i];
+ return c;
+ }
+ if (r_type(v) == t_integer)
+ return v->value.intval;
+ }
+ }
+ /*
+ * Fall through, because test.ps for SF bug #529103 requres
+ * to examine both tables. Due to that the Unicode Decoding resource
+ * can't be a default value for FontInfo.GlyphNames2Unicode .
+ */
}
if (glyph <= GS_MIN_CID_GLYPH) {
- UnicodeDecoding = zfont_get_to_unicode_map(font->dir);
- if (UnicodeDecoding != NULL && r_type(UnicodeDecoding) == t_dictionary)
- return gs_font_map_glyph_by_dict(font->memory, UnicodeDecoding, glyph);
+ UnicodeDecoding = zfont_get_to_unicode_map(font->dir);
+ if (UnicodeDecoding != NULL && r_type(UnicodeDecoding) == t_dictionary)
+ return gs_font_map_glyph_by_dict(font->memory, UnicodeDecoding, glyph);
}
return GS_NO_CHAR; /* No map. */
}
@@ -243,25 +243,25 @@ const op_def zbfont_op_defs[] =
/* Convert strings to executable names for build_proc_refs. */
int
build_proc_name_refs(const gs_memory_t *mem, build_proc_refs * pbuild,
- const char *bcstr, const char *bgstr)
+ const char *bcstr, const char *bgstr)
{
int code;
if (!bcstr)
- make_null(&pbuild->BuildChar);
+ make_null(&pbuild->BuildChar);
else {
- if ((code = name_ref(mem, (const byte *)bcstr,
- strlen(bcstr), &pbuild->BuildChar, 0)) < 0)
- return code;
- r_set_attrs(&pbuild->BuildChar, a_executable);
+ if ((code = name_ref(mem, (const byte *)bcstr,
+ strlen(bcstr), &pbuild->BuildChar, 0)) < 0)
+ return code;
+ r_set_attrs(&pbuild->BuildChar, a_executable);
}
if (!bgstr)
- make_null(&pbuild->BuildGlyph);
+ make_null(&pbuild->BuildGlyph);
else {
- if ((code = name_ref(mem, (const byte *)bgstr,
- strlen(bgstr), &pbuild->BuildGlyph, 0)) < 0)
- return code;
- r_set_attrs(&pbuild->BuildGlyph, a_executable);
+ if ((code = name_ref(mem, (const byte *)bgstr,
+ strlen(bgstr), &pbuild->BuildGlyph, 0)) < 0)
+ return code;
+ r_set_attrs(&pbuild->BuildGlyph, a_executable);
}
return 0;
}
@@ -278,18 +278,18 @@ build_gs_font_procs(os_ptr op, build_proc_refs * pbuild)
ccode = dict_find_string(op, "BuildChar", &pBuildChar);
gcode = dict_find_string(op, "BuildGlyph", &pBuildGlyph);
if (ccode <= 0) {
- if (gcode <= 0)
- return_error(e_invalidfont);
- make_null(&pbuild->BuildChar);
+ if (gcode <= 0)
+ return_error(e_invalidfont);
+ make_null(&pbuild->BuildChar);
} else {
- check_proc(*pBuildChar);
- pbuild->BuildChar = *pBuildChar;
+ check_proc(*pBuildChar);
+ pbuild->BuildChar = *pBuildChar;
}
if (gcode <= 0)
- make_null(&pbuild->BuildGlyph);
+ make_null(&pbuild->BuildGlyph);
else {
- check_proc(*pBuildGlyph);
- pbuild->BuildGlyph = *pBuildGlyph;
+ check_proc(*pBuildGlyph);
+ pbuild->BuildGlyph = *pBuildGlyph;
}
return 0;
}
@@ -299,28 +299,27 @@ static int font_with_same_UID_and_another_metrics(const gs_font *pfont0, const g
const gs_font_base *pbfont0 = (const gs_font_base *)pfont0;
const gs_font_base *pbfont1 = (const gs_font_base *)pfont1;
-
if (uid_equal(&pbfont0->UID, &pbfont1->UID)) {
- const ref *pfdict0 = &pfont_data(gs_font_parent(pbfont0))->dict;
- const ref *pfdict1 = &pfont_data(gs_font_parent(pbfont1))->dict;
- ref *pmdict0, *pmdict1;
-
- if (pbfont0->WMode || dict_find_string(pfdict0, "Metrics", &pmdict0) <= 0)
- pmdict0 = NULL;
- if (pbfont1->WMode || dict_find_string(pfdict1, "Metrics", &pmdict1) <= 0)
- pmdict1 = NULL;
- if (!pmdict0 != !pmdict1)
- return 1;
- if (pmdict0 != NULL && !obj_eq(pfont0->memory, pmdict0, pmdict1))
- return 1;
- if (!pbfont0->WMode || dict_find_string(pfdict0, "Metrics2", &pmdict0) <= 0)
- pmdict0 = NULL;
- if (!pbfont0->WMode || dict_find_string(pfdict1, "Metrics2", &pmdict1) <= 0)
- pmdict1 = NULL;
- if (!pmdict0 != !pmdict1)
- return 1;
- if (pmdict0 != NULL && !obj_eq(pfont0->memory, pmdict0, pmdict1))
- return 1;
+ const ref *pfdict0 = &pfont_data(gs_font_parent(pbfont0))->dict;
+ const ref *pfdict1 = &pfont_data(gs_font_parent(pbfont1))->dict;
+ ref *pmdict0, *pmdict1;
+
+ if (pbfont0->WMode || dict_find_string(pfdict0, "Metrics", &pmdict0) <= 0)
+ pmdict0 = NULL;
+ if (pbfont1->WMode || dict_find_string(pfdict1, "Metrics", &pmdict1) <= 0)
+ pmdict1 = NULL;
+ if (!pmdict0 != !pmdict1)
+ return 1;
+ if (pmdict0 != NULL && !obj_eq(pfont0->memory, pmdict0, pmdict1))
+ return 1;
+ if (!pbfont0->WMode || dict_find_string(pfdict0, "Metrics2", &pmdict0) <= 0)
+ pmdict0 = NULL;
+ if (!pbfont0->WMode || dict_find_string(pfdict1, "Metrics2", &pmdict1) <= 0)
+ pmdict1 = NULL;
+ if (!pmdict0 != !pmdict1)
+ return 1;
+ if (pmdict0 != NULL && !obj_eq(pfont0->memory, pmdict0, pmdict1))
+ return 1;
}
return 0;
}
@@ -330,9 +329,9 @@ static int font_with_same_UID_and_another_metrics(const gs_font *pfont0, const g
/* The caller guarantees that *op is a dictionary. */
int
build_gs_primitive_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild,
- build_font_options_t options)
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild,
+ build_font_options_t options)
{
ref *pcharstrings = 0;
ref CharStrings;
@@ -341,48 +340,48 @@ build_gs_primitive_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
int code;
if (dict_find_string(op, "CharStrings", &pcharstrings) <= 0) {
- if (!(options & bf_CharStrings_optional))
- return_error(e_invalidfont);
+ if (!(options & bf_CharStrings_optional))
+ return_error(e_invalidfont);
} else {
- ref *ignore;
-
- if (!r_has_type(pcharstrings, t_dictionary))
- return_error(e_invalidfont);
- if ((options & bf_notdef_required) != 0 &&
- dict_find_string(pcharstrings, ".notdef", &ignore) <= 0
- )
- return_error(e_invalidfont);
- /*
- * Since build_gs_simple_font may resize the dictionary and cause
- * pointers to become invalid, save CharStrings.
- */
- CharStrings = *pcharstrings;
+ ref *ignore;
+
+ if (!r_has_type(pcharstrings, t_dictionary))
+ return_error(e_invalidfont);
+ if ((options & bf_notdef_required) != 0 &&
+ dict_find_string(pcharstrings, ".notdef", &ignore) <= 0
+ )
+ return_error(e_invalidfont);
+ /*
+ * Since build_gs_simple_font may resize the dictionary and cause
+ * pointers to become invalid, save CharStrings.
+ */
+ CharStrings = *pcharstrings;
}
code = build_gs_outline_font(i_ctx_p, op, ppfont, ftype, pstype, pbuild,
- options, build_gs_simple_font);
+ options, build_gs_simple_font);
if (code != 0)
- return code;
+ return code;
pfont = *ppfont;
pdata = pfont_data(pfont);
if (pcharstrings)
- ref_assign(&pdata->CharStrings, &CharStrings);
+ ref_assign(&pdata->CharStrings, &CharStrings);
else
- make_null(&pdata->CharStrings);
+ make_null(&pdata->CharStrings);
/* Check that the UniqueIDs match. This is part of the */
/* Adobe protection scheme, but we may as well emulate it. */
if (uid_is_valid(&pfont->UID) &&
- !dict_check_uid_param(op, &pfont->UID)
- )
- uid_set_invalid(&pfont->UID);
+ !dict_check_uid_param(op, &pfont->UID)
+ )
+ uid_set_invalid(&pfont->UID);
if (uid_is_valid(&pfont->UID)) {
- const gs_font *pfont0 = (const gs_font *)pfont;
-
- code = gs_font_find_similar(ifont_dir, &pfont0,
- font_with_same_UID_and_another_metrics);
- if (code < 0)
- return code; /* Must not happen. */
- if (code)
- uid_set_invalid(&pfont->UID);
+ const gs_font *pfont0 = (const gs_font *)pfont;
+
+ code = gs_font_find_similar(ifont_dir, &pfont0,
+ font_with_same_UID_and_another_metrics);
+ if (code < 0)
+ return code; /* Must not happen. */
+ if (code)
+ uid_set_invalid(&pfont->UID);
}
return 0;
}
@@ -392,35 +391,35 @@ build_gs_primitive_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
/* a Type 1 or Type 2 font. */
static int
build_FDArray_sub_font(i_ctx_t *i_ctx_p, ref *op,
- gs_font_base **ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild,
- build_font_options_t ignore_options)
+ gs_font_base **ppfont,
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild,
+ build_font_options_t ignore_options)
{
gs_font *pfont;
int code = build_gs_sub_font(i_ctx_p, op, &pfont, ftype, pstype, pbuild,
- NULL, op);
+ NULL, op);
if (code >= 0)
- *ppfont = (gs_font_base *)pfont;
+ *ppfont = (gs_font_base *)pfont;
return code;
}
int
build_gs_FDArray_font(i_ctx_t *i_ctx_p, ref *op,
- gs_font_base **ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild)
+ gs_font_base **ppfont,
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild)
{
gs_font_base *pfont;
font_data *pdata;
int code = build_gs_outline_font(i_ctx_p, op, &pfont, ftype, pstype,
- pbuild, bf_options_none,
- build_FDArray_sub_font);
+ pbuild, bf_options_none,
+ build_FDArray_sub_font);
static const double bbox[4] = { 0, 0, 0, 0 };
gs_uid uid;
if (code < 0)
- return code;
+ return code;
pdata = pfont_data(pfont);
/* Fill in members normally set by build_gs_primitive_font. */
make_null(&pdata->CharStrings);
@@ -440,10 +439,10 @@ build_gs_FDArray_font(i_ctx_t *i_ctx_p, ref *op,
/* The caller guarantees that *op is a dictionary. */
int
build_gs_outline_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild,
- build_font_options_t options,
- build_base_font_proc_t build_base_font)
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild,
+ build_font_options_t options,
+ build_base_font_proc_t build_base_font)
{
int painttype;
float strokewidth;
@@ -451,14 +450,14 @@ build_gs_outline_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
int code = dict_int_param(op, "PaintType", 0, 3, 0, &painttype);
if (code < 0)
- return code;
+ return code;
code = dict_float_param(op, "StrokeWidth", 0.0, &strokewidth);
if (code < 0)
- return code;
+ return code;
code = build_base_font(i_ctx_p, op, ppfont, ftype, pstype, pbuild,
- options);
+ options);
if (code != 0)
- return code;
+ return code;
pfont = *ppfont;
pfont->PaintType = painttype;
pfont->StrokeWidth = strokewidth;
@@ -472,10 +471,10 @@ get_GlyphNames2Unicode(i_ctx_t *i_ctx_p, gs_font *pfont, ref *pdref)
font_data *pdata;
if (dict_find_string(pdref, "FontInfo", &pfontinfo) <= 0 ||
- !r_has_type(pfontinfo, t_dictionary) ||
- dict_find_string(pfontinfo, "GlyphNames2Unicode", &g2u) <= 0 ||
- !r_has_type(pfontinfo, t_dictionary))
- return;
+ !r_has_type(pfontinfo, t_dictionary) ||
+ dict_find_string(pfontinfo, "GlyphNames2Unicode", &g2u) <= 0 ||
+ !r_has_type(pfontinfo, t_dictionary))
+ return;
/*
* Since build_gs_font may resize the dictionary and cause
* pointers to become invalid, save Glyph2Unicode
@@ -488,9 +487,9 @@ get_GlyphNames2Unicode(i_ctx_t *i_ctx_p, gs_font *pfont, ref *pdref)
/* The caller guarantees that *op is a dictionary. */
int
build_gs_simple_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild,
- build_font_options_t options)
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild,
+ build_font_options_t options)
{
double bbox[4];
gs_uid uid;
@@ -500,7 +499,7 @@ build_gs_simple_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
code = font_bbox_param(imemory, op, bbox);
if (code < 0)
- return code;
+ return code;
/*
* Make sure that we allocate uid
* in the same VM as the font dictionary
@@ -510,13 +509,13 @@ build_gs_simple_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
code = dict_uid_param(op, &uid, 0, imemory, i_ctx_p);
ialloc_set_space(idmemory, space);
if (code < 0)
- return code;
+ return code;
if ((options & bf_UniqueID_ignored) && uid_is_UniqueID(&uid))
- uid_set_invalid(&uid);
+ uid_set_invalid(&uid);
code = build_gs_font(i_ctx_p, op, (gs_font **) ppfont, ftype, pstype,
- pbuild, options);
+ pbuild, options);
if (code != 0) /* invalid or scaled font */
- return code;
+ return code;
pfont = *ppfont;
pfont->procs.init_fstack = gs_default_init_fstack;
pfont->procs.define_font = gs_no_define_font;
@@ -534,7 +533,7 @@ build_gs_simple_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_base ** ppfont,
/* Initialize the FontBBox and UID of a non-composite font. */
void
init_gs_simple_font(gs_font_base *pfont, const double bbox[4],
- const gs_uid *puid)
+ const gs_uid *puid)
{
pfont->FontBBox.p.x = bbox[0];
pfont->FontBBox.p.y = bbox[1];
@@ -552,55 +551,55 @@ lookup_gs_simple_font_encoding(gs_font_base * pfont)
pfont->encoding_index = index;
if (r_type(pfe) == t_array && r_size(pfe) <= 256) {
- /* Look for an encoding that's "close". */
- uint esize = r_size(pfe);
- int near_index = -1;
- uint best = esize / 3; /* must match at least this many */
- gs_const_string fstrs[256];
- int i;
-
- /* Get the string names of the glyphs in the font's Encoding. */
- for (i = 0; i < esize; ++i) {
- ref fchar;
-
- if (array_get(pfont->memory, pfe, (long)i, &fchar) < 0 ||
- !r_has_type(&fchar, t_name)
- )
- fstrs[i].data = 0, fstrs[i].size = 0;
- else {
- ref nsref;
-
- name_string_ref(pfont->memory, &fchar, &nsref);
- fstrs[i].data = nsref.value.const_bytes;
- fstrs[i].size = r_size(&nsref);
- }
- }
- /* Compare them against the known encodings. */
- for (index = 0; index < NUM_KNOWN_REAL_ENCODINGS; ++index) {
- uint match = esize;
-
- for (i = esize; --i >= 0;) {
- gs_const_string rstr;
-
- gs_c_glyph_name(gs_c_known_encode((gs_char)i, index), &rstr);
- if (rstr.size == fstrs[i].size &&
- !memcmp(rstr.data, fstrs[i].data, rstr.size)
- )
- continue;
- if (--match <= best)
- break;
- }
- if (match > best) {
- best = match;
- near_index = index;
- /* If we have a perfect match, stop now. */
- if (best == esize)
- break;
- }
- }
- index = near_index;
- if (best == esize)
- pfont->encoding_index = index;
+ /* Look for an encoding that's "close". */
+ uint esize = r_size(pfe);
+ int near_index = -1;
+ uint best = esize / 3; /* must match at least this many */
+ gs_const_string fstrs[256];
+ int i;
+
+ /* Get the string names of the glyphs in the font's Encoding. */
+ for (i = 0; i < esize; ++i) {
+ ref fchar;
+
+ if (array_get(pfont->memory, pfe, (long)i, &fchar) < 0 ||
+ !r_has_type(&fchar, t_name)
+ )
+ fstrs[i].data = 0, fstrs[i].size = 0;
+ else {
+ ref nsref;
+
+ name_string_ref(pfont->memory, &fchar, &nsref);
+ fstrs[i].data = nsref.value.const_bytes;
+ fstrs[i].size = r_size(&nsref);
+ }
+ }
+ /* Compare them against the known encodings. */
+ for (index = 0; index < NUM_KNOWN_REAL_ENCODINGS; ++index) {
+ uint match = esize;
+
+ for (i = esize; --i >= 0;) {
+ gs_const_string rstr;
+
+ gs_c_glyph_name(gs_c_known_encode((gs_char)i, index), &rstr);
+ if (rstr.size == fstrs[i].size &&
+ !memcmp(rstr.data, fstrs[i].data, rstr.size)
+ )
+ continue;
+ if (--match <= best)
+ break;
+ }
+ if (match > best) {
+ best = match;
+ near_index = index;
+ /* If we have a perfect match, stop now. */
+ if (best == esize)
+ break;
+ }
+ }
+ index = near_index;
+ if (best == esize)
+ pfont->encoding_index = index;
}
pfont->nearest_encoding_index = index;
}
@@ -612,44 +611,44 @@ sub_font_params(gs_memory_t *mem, const ref *op, gs_matrix *pmat, gs_matrix *pom
ref *pmatrix, *pfontname, *pfontstyle, *porigfont, *pfontinfo;
if (dict_find_string(op, "FontMatrix", &pmatrix) <= 0 ||
- read_matrix(mem, pmatrix, pmat) < 0
- )
- return_error(e_invalidfont);
+ read_matrix(mem, pmatrix, pmat) < 0
+ )
+ return_error(e_invalidfont);
if (dict_find_string(op, "OrigFont", &porigfont) <= 0)
- porigfont = NULL;
+ porigfont = NULL;
if (pomat!= NULL) {
- if (porigfont == NULL ||
- dict_find_string(porigfont, "FontMatrix", &pmatrix) <= 0 ||
- read_matrix(mem, pmatrix, pomat) < 0
- )
- memset(pomat, 0, sizeof(*pomat));
+ if (porigfont == NULL ||
+ dict_find_string(porigfont, "FontMatrix", &pmatrix) <= 0 ||
+ read_matrix(mem, pmatrix, pomat) < 0
+ )
+ memset(pomat, 0, sizeof(*pomat));
}
/* Use the FontInfo/OrigFontName key preferrentially (created by MS PSCRIPT driver) */
if ((dict_find_string((porigfont != NULL ? porigfont : op), "FontInfo", &pfontinfo) > 0) &&
- r_has_type(pfontinfo, t_dictionary) &&
+ r_has_type(pfontinfo, t_dictionary) &&
(dict_find_string(pfontinfo, "OrigFontName", &pfontname) > 0)) {
- if ((dict_find_string(pfontinfo, "OrigFontStyle", &pfontstyle) > 0) &&
- r_size(pfontstyle) > 0) {
- const byte *tmpStr1 = pfontname->value.const_bytes;
- const byte *tmpStr2 = pfontstyle->value.const_bytes;
- int fssize1 = r_size(pfontname), fssize2 = r_size(pfontstyle), fssize = fssize1 + fssize2 + 1;
- byte *sfname = gs_alloc_string(mem, fssize, "sub_font_params");
-
- if (sfname == NULL)
- return_error(e_VMerror);
- memcpy(sfname, tmpStr1, fssize1);
- sfname[fssize1]=',' ;
- memcpy(sfname + fssize1 + 1, tmpStr2, fssize2);
- make_string(pfname, a_readonly, fssize, sfname);
- } else
- get_font_name(mem, pfname, pfontname);
+ if ((dict_find_string(pfontinfo, "OrigFontStyle", &pfontstyle) > 0) &&
+ r_size(pfontstyle) > 0) {
+ const byte *tmpStr1 = pfontname->value.const_bytes;
+ const byte *tmpStr2 = pfontstyle->value.const_bytes;
+ int fssize1 = r_size(pfontname), fssize2 = r_size(pfontstyle), fssize = fssize1 + fssize2 + 1;
+ byte *sfname = gs_alloc_string(mem, fssize, "sub_font_params");
+
+ if (sfname == NULL)
+ return_error(e_VMerror);
+ memcpy(sfname, tmpStr1, fssize1);
+ sfname[fssize1]=',' ;
+ memcpy(sfname + fssize1 + 1, tmpStr2, fssize2);
+ make_string(pfname, a_readonly, fssize, sfname);
+ } else
+ get_font_name(mem, pfname, pfontname);
} else if (dict_find_string((porigfont != NULL ? porigfont : op), ".Alias", &pfontname) > 0) {
/* If we emulate the font, we want the requested name rather than a substitute. */
- get_font_name(mem, pfname, pfontname);
+ get_font_name(mem, pfname, pfontname);
} else if (dict_find_string((porigfont != NULL ? porigfont : op), "FontName", &pfontname) > 0) {
- get_font_name(mem, pfname, pfontname);
+ get_font_name(mem, pfname, pfontname);
} else
- make_empty_string(pfname, a_readonly);
+ make_empty_string(pfname, a_readonly);
return 0;
}
@@ -661,8 +660,8 @@ sub_font_params(gs_memory_t *mem, const ref *op, gs_matrix *pmat, gs_matrix *pom
/* or a negative error code. */
int
build_gs_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font ** ppfont, font_type ftype,
- gs_memory_type_ptr_t pstype, const build_proc_refs * pbuild,
- build_font_options_t options)
+ gs_memory_type_ptr_t pstype, const build_proc_refs * pbuild,
+ build_font_options_t options)
{
ref kname; /* t_string */
ref *pftype;
@@ -677,88 +676,88 @@ build_gs_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font ** ppfont, font_type ftype,
get_font_name(imemory, &kname, op - 1);
if (dict_find_string(op, "FontType", &pftype) <= 0 ||
- !r_has_type(pftype, t_integer) ||
- pftype->value.intval != (int)ftype
- )
- return_error(e_invalidfont);
+ !r_has_type(pftype, t_integer) ||
+ pftype->value.intval != (int)ftype
+ )
+ return_error(e_invalidfont);
if (dict_find_string(op, "Encoding", &pencoding) <= 0) {
- if (!(options & bf_Encoding_optional))
- return_error(e_invalidfont);
- pencoding = 0;
+ if (!(options & bf_Encoding_optional))
+ return_error(e_invalidfont);
+ pencoding = 0;
} else {
- if (!r_is_array(pencoding))
- return_error(e_invalidfont);
+ if (!r_is_array(pencoding))
+ return_error(e_invalidfont);
}
if (pencoding) { /* observed Adobe behavior */
int count = r_size(pencoding);
int type = ftype ? t_name : t_integer;
while (count--) {
ref r;
- if (array_get(imemory, pencoding, count, &r) < 0 ||
- !(r_has_type(&r, type) || r_has_type(&r, t_null)))
+ if (array_get(imemory, pencoding, count, &r) < 0 ||
+ !(r_has_type(&r, type) || r_has_type(&r, t_null)))
return_error(e_typecheck);
}
}
if ((code = dict_int_param(op, "WMode", 0, 1, 0, &wmode)) < 0 ||
- (code = dict_bool_param(op, "BitmapWidths", false, &bitmapwidths)) < 0 ||
- (code = dict_int_param(op, "ExactSize", 0, 2, fbit_use_bitmaps, &exactsize)) < 0 ||
- (code = dict_int_param(op, "InBetweenSize", 0, 2, fbit_use_outlines, &inbetweensize)) < 0 ||
- (code = dict_int_param(op, "TransformedChar", 0, 2, fbit_use_outlines, &transformedchar)) < 0
- )
- return code;
+ (code = dict_bool_param(op, "BitmapWidths", false, &bitmapwidths)) < 0 ||
+ (code = dict_int_param(op, "ExactSize", 0, 2, fbit_use_bitmaps, &exactsize)) < 0 ||
+ (code = dict_int_param(op, "InBetweenSize", 0, 2, fbit_use_outlines, &inbetweensize)) < 0 ||
+ (code = dict_int_param(op, "TransformedChar", 0, 2, fbit_use_outlines, &transformedchar)) < 0
+ )
+ return code;
code = dict_find_string(op, "FID", &pfid);
if (code > 0 && r_has_type(pfid, t_fontID)) { /* silently ignore invalid FID per CET 13-05.ps */
- /*
- * If this font has a FID entry already, it might be a scaled font
- * made by makefont or scalefont; in a Level 2 environment, it might
- * be an existing font being registered under a second name, or a
- * re-encoded font (which was invalid in Level 1, but dvips did it
- * anyway).
- */
- pfont = r_ptr(pfid, gs_font);
- /*
- * If the following condition is false this is a re-encoded font,
+ /*
+ * If this font has a FID entry already, it might be a scaled font
+ * made by makefont or scalefont; in a Level 2 environment, it might
+ * be an existing font being registered under a second name, or a
+ * re-encoded font (which was invalid in Level 1, but dvips did it
+ * anyway).
+ */
+ pfont = r_ptr(pfid, gs_font);
+ /*
+ * If the following condition is false this is a re-encoded font,
* or some other questionable situation in which the FID
- * was preserved. Pretend the FID wasn't there.
- */
- if (obj_eq(pfont->memory, pfont_dict(pfont), op)) {
- if (pfont->base == pfont) { /* original font */
- if (!level2_enabled)
- return_error(e_invalidfont);
- *ppfont = pfont;
- return 1;
- } else { /* This was made by makefont or scalefont. */
- /* Just insert the new name. */
- gs_matrix mat;
- ref fname; /* t_string */
-
- code = sub_font_params(imemory, op, &mat, NULL, &fname);
- if (code < 0)
- return code;
- code = 1;
- copy_font_name(&pfont->font_name, &fname);
- goto set_name;
- }
+ * was preserved. Pretend the FID wasn't there.
+ */
+ if (obj_eq(pfont->memory, pfont_dict(pfont), op)) {
+ if (pfont->base == pfont) { /* original font */
+ if (!level2_enabled)
+ return_error(e_invalidfont);
+ *ppfont = pfont;
+ return 1;
+ } else { /* This was made by makefont or scalefont. */
+ /* Just insert the new name. */
+ gs_matrix mat;
+ ref fname; /* t_string */
+
+ code = sub_font_params(imemory, op, &mat, NULL, &fname);
+ if (code < 0)
+ return code;
+ code = 1;
+ copy_font_name(&pfont->font_name, &fname);
+ goto set_name;
+ }
}
}
/* This is a new font. */
if (!r_has_attr(aop, a_write))
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
{
- ref encoding;
-
- /*
- * Since add_FID may resize the dictionary and cause
- * pencoding to become invalid, save the Encoding.
- */
- if (pencoding) {
- encoding = *pencoding;
- pencoding = &encoding;
- }
- code = build_gs_sub_font(i_ctx_p, op, &pfont, ftype, pstype,
- pbuild, pencoding, op);
- if (code < 0)
- return code;
+ ref encoding;
+
+ /*
+ * Since add_FID may resize the dictionary and cause
+ * pencoding to become invalid, save the Encoding.
+ */
+ if (pencoding) {
+ encoding = *pencoding;
+ pencoding = &encoding;
+ }
+ code = build_gs_sub_font(i_ctx_p, op, &pfont, ftype, pstype,
+ pbuild, pencoding, op);
+ if (code < 0)
+ return code;
}
pfont->BitmapWidths = bitmapwidths;
pfont->ExactSize = (fbit_type)exactsize;
@@ -779,9 +778,9 @@ set_name:
/* The caller guarantees that *op is a dictionary. */
int
build_gs_sub_font(i_ctx_t *i_ctx_p, const ref *op, gs_font **ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const build_proc_refs * pbuild, const ref *pencoding,
- ref *fid_op)
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const build_proc_refs * pbuild, const ref *pencoding,
+ ref *fid_op)
{
gs_matrix mat, omat;
ref fname; /* t_string */
@@ -795,28 +794,28 @@ build_gs_sub_font(i_ctx_t *i_ctx_p, const ref *op, gs_font **ppfont,
int code = sub_font_params(imemory, op, &mat, &omat, &fname);
if (code < 0)
- return code;
+ return code;
ialloc_set_space(idmemory, r_space(op));
pfont = gs_font_alloc(imemory, pstype, &gs_font_procs_default, NULL,
- "buildfont(font)");
+ "buildfont(font)");
pdata = ialloc_struct(font_data, &st_font_data,
- "buildfont(data)");
+ "buildfont(data)");
if (pfont == 0 || pdata == 0)
- code = gs_note_error(e_VMerror);
+ code = gs_note_error(e_VMerror);
else if (fid_op)
- code = add_FID(i_ctx_p, fid_op, pfont, iimemory);
+ code = add_FID(i_ctx_p, fid_op, pfont, iimemory);
if (code < 0) {
- ifree_object(pdata, "buildfont(data)");
- ifree_object(pfont, "buildfont(font)");
- ialloc_set_space(idmemory, space);
- return code;
+ ifree_object(pdata, "buildfont(data)");
+ ifree_object(pfont, "buildfont(font)");
+ ialloc_set_space(idmemory, space);
+ return code;
}
refset_null((ref *) pdata, sizeof(font_data) / sizeof(ref));
ref_assign_new(&pdata->dict, op);
ref_assign_new(&pdata->BuildChar, &pbuild->BuildChar);
ref_assign_new(&pdata->BuildGlyph, &pbuild->BuildGlyph);
if (pencoding)
- ref_assign_new(&pdata->Encoding, pencoding);
+ ref_assign_new(&pdata->Encoding, pencoding);
pfont->client_data = pdata;
pfont->FontType = ftype;
pfont->FontMatrix = mat;
@@ -840,15 +839,15 @@ void
get_font_name(const gs_memory_t *mem, ref * pfname, const ref * op)
{
switch (r_type(op)) {
- case t_string:
- *pfname = *op;
- break;
- case t_name:
- name_string_ref(mem, op, pfname);
- break;
- default:
- /* This is weird, but legal.... */
- make_empty_string(pfname, a_readonly);
+ case t_string:
+ *pfname = *op;
+ break;
+ case t_name:
+ name_string_ref(mem, op, pfname);
+ break;
+ default:
+ /* This is weird, but legal.... */
+ make_empty_string(pfname, a_readonly);
}
}
@@ -859,7 +858,7 @@ copy_font_name(gs_font_name * pfstr, const ref * pfname)
uint size = r_size(pfname);
if (size > gs_font_name_max)
- size = gs_font_name_max;
+ size = gs_font_name_max;
memcpy(&pfstr->chars[0], pfname->value.const_bytes, size);
/* Following is only for debugging printout. */
pfstr->chars[size] = 0;
@@ -871,7 +870,7 @@ int
define_gs_font(i_ctx_t *i_ctx_p, gs_font * pfont)
{
return (pfont->base == pfont && pfont->dir == 0 ?
- /* i.e., unregistered original font */
- gs_definefont(ifont_dir, pfont) :
- 0);
+ /* i.e., unregistered original font */
+ gs_definefont(ifont_dir, pfont) :
+ 0);
}
diff --git a/gs/psi/zbseq.c b/gs/psi/zbseq.c
index 3cdfd9000..8e2b36bd3 100644
--- a/gs/psi/zbseq.c
+++ b/gs/psi/zbseq.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,18 +30,18 @@ typedef struct names_array_ref_s {
ref names;
} names_array_ref_t;
gs_private_st_ref_struct(st_names_array_ref, names_array_ref_t,
- "names_array_ref_t");
+ "names_array_ref_t");
/* Create a system or user name table (in the stable memory of mem). */
int
create_names_array(ref **ppnames, gs_memory_t *mem, client_name_t cname)
{
ref *pnames = (ref *)
- gs_alloc_struct(gs_memory_stable(mem), names_array_ref_t,
- &st_names_array_ref, cname);
+ gs_alloc_struct(gs_memory_stable(mem), names_array_ref_t,
+ &st_names_array_ref, cname);
if (pnames == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_empty_array(pnames, a_readonly);
*ppnames = pnames;
return 0;
@@ -55,10 +55,10 @@ zbseq_init(i_ctx_t *i_ctx_p)
/* PostScript code will install the real system name table. */
ref *psystem_names = 0;
int code = create_names_array(&psystem_names, imemory_global,
- "zbseq_init(system_names)");
+ "zbseq_init(system_names)");
if (code < 0)
- return code;
+ return code;
system_names_p = psystem_names;
return 0;
}
@@ -70,7 +70,7 @@ zinstallsystemnames(i_ctx_t *i_ctx_p)
os_ptr op = osp;
if (r_space(op) != avm_global || imemory_save_level(iimemory_global) != 0)
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
check_read_type(*op, t_shortarray);
ref_assign_old(NULL, system_names_p, op, ".installsystemnames");
pop(1);
@@ -97,7 +97,7 @@ zsetobjectformat(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0 || op->value.intval > 4)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_struct(&cont, avm_local, ref_binary_object_format_container);
ref_assign_old(&cont, &ref_binary_object_format, op, "setobjectformat");
pop(1);
@@ -124,11 +124,11 @@ zbosobject(i_ctx_t *i_ctx_p)
check_type(op[-2], t_integer);
check_write_type(*op, t_string);
if (r_size(op) < 8)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = encode_binary_token(i_ctx_p, op - 1, &op[-3].value.intval,
- &op[-2].value.intval, op->value.bytes);
+ &op[-2].value.intval, op->value.bytes);
if (code < 0)
- return code;
+ return code;
op[-1] = *op;
r_set_size(op - 1, 8);
pop(1);
diff --git a/gs/psi/zcfont.c b/gs/psi/zcfont.c
index 6ed2275c2..8c738242e 100644
--- a/gs/psi/zcfont.c
+++ b/gs/psi/zcfont.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,21 +45,21 @@ zcshow(i_ctx_t *i_ctx_p)
* the procedure to be provided in either order!
*/
if (r_is_proc(proc_op))
- ;
+ ;
else if (r_is_proc(op)) { /* operands reversed */
- proc_op = op;
- str_op = op - 1;
+ proc_op = op;
+ str_op = op - 1;
} else {
- check_op(2);
- return_error(e_typecheck);
+ check_op(2);
+ return_error(e_typecheck);
}
if ((code = op_show_setup(i_ctx_p, str_op)) != 0 ||
- (code = gs_cshow_begin(igs, str_op->value.bytes, r_size(str_op),
- imemory, &penum)) < 0)
- return code;
+ (code = gs_cshow_begin(igs, str_op->value.bytes, r_size(str_op),
+ imemory, &penum)) < 0)
+ return code;
if ((code = op_show_finish_setup(i_ctx_p, penum, 2, NULL)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
sslot = *proc_op; /* save kerning proc */
pop(2);
@@ -75,65 +75,65 @@ cshow_continue(i_ctx_t *i_ctx_p)
check_estack(4); /* in case we call the procedure */
code = gs_text_process(penum);
if (code != TEXT_PROCESS_INTERVENE) {
- code = op_show_continue_dispatch(i_ctx_p, 0, code);
- if (code == o_push_estack) /* must be TEXT_PROCESS_RENDER */
- make_op_estack(esp - 1, cshow_continue);
- return code;
+ code = op_show_continue_dispatch(i_ctx_p, 0, code);
+ if (code == o_push_estack) /* must be TEXT_PROCESS_RENDER */
+ make_op_estack(esp - 1, cshow_continue);
+ return code;
}
/* Push the character code and width, and call the procedure. */
{
- ref *pslot = &sslot;
- gs_point wpt;
- gs_font *font = gs_text_current_font(penum);
- gs_font *root_font = gs_rootfont(igs);
- gs_font *scaled_font;
- uint font_space = r_space(pfont_dict(font));
- uint root_font_space = r_space(pfont_dict(root_font));
- int fdepth = penum->fstack.depth;
+ ref *pslot = &sslot;
+ gs_point wpt;
+ gs_font *font = gs_text_current_font(penum);
+ gs_font *root_font = gs_rootfont(igs);
+ gs_font *scaled_font;
+ uint font_space = r_space(pfont_dict(font));
+ uint root_font_space = r_space(pfont_dict(root_font));
+ int fdepth = penum->fstack.depth;
+
+ gs_text_current_width(penum, &wpt);
+ if (font == root_font)
+ scaled_font = font;
+ else if (fdepth > 0) {
+ /* Construct a scaled version of the leaf font.
+ If font stack is deep enough, get the matrix for scaling
+ from the immediate parent of current font.
+ (The font matrix of root font is not good for the purpose
+ in some case.)
+ assert_(penum->fstack.items[fdepth].font == font
+ && penum->fstack.items[0].font == root_font); */
+ uint save_space = idmemory->current_space;
+ gs_font * immediate_parent = penum->fstack.items[fdepth - 1].font;
- gs_text_current_width(penum, &wpt);
- if (font == root_font)
- scaled_font = font;
- else if (fdepth > 0) {
- /* Construct a scaled version of the leaf font.
- If font stack is deep enough, get the matrix for scaling
- from the immediate parent of current font.
- (The font matrix of root font is not good for the purpose
- in some case.)
- assert_(penum->fstack.items[fdepth].font == font
- && penum->fstack.items[0].font == root_font); */
- uint save_space = idmemory->current_space;
- gs_font * immediate_parent = penum->fstack.items[fdepth - 1].font;
+ ialloc_set_space(idmemory, font_space);
+ code = gs_makefont(font->dir, font,
+ &immediate_parent->FontMatrix,
+ &scaled_font);
+ ialloc_set_space(idmemory, save_space);
+ if (code < 0)
+ return code;
+ }
+ else {
+ /* Construct a scaled version of the leaf font. */
+ uint save_space = idmemory->current_space;
- ialloc_set_space(idmemory, font_space);
- code = gs_makefont(font->dir, font,
- &immediate_parent->FontMatrix,
- &scaled_font);
- ialloc_set_space(idmemory, save_space);
- if (code < 0)
- return code;
- }
- else {
- /* Construct a scaled version of the leaf font. */
- uint save_space = idmemory->current_space;
-
- ialloc_set_space(idmemory, font_space);
- code = gs_makefont(font->dir, font, &root_font->FontMatrix,
- &scaled_font);
- ialloc_set_space(idmemory, save_space);
- if (code < 0)
- return code;
- }
- push(3);
- make_int(op - 2, gs_text_current_char(penum) & 0xff);
- make_real(op - 1, wpt.x);
- make_real(op, wpt.y);
- make_struct(&ssfont, font_space, font);
- make_struct(&srfont, root_font_space, root_font);
- push_op_estack(cshow_restore_font);
- /* cshow does not change rootfont for user procedure */
- gs_set_currentfont(igs, scaled_font);
- *++esp = *pslot; /* user procedure */
+ ialloc_set_space(idmemory, font_space);
+ code = gs_makefont(font->dir, font, &root_font->FontMatrix,
+ &scaled_font);
+ ialloc_set_space(idmemory, save_space);
+ if (code < 0)
+ return code;
+ }
+ push(3);
+ make_int(op - 2, gs_text_current_char(penum) & 0xff);
+ make_real(op - 1, wpt.x);
+ make_real(op, wpt.y);
+ make_struct(&ssfont, font_space, font);
+ make_struct(&srfont, root_font_space, root_font);
+ push_op_estack(cshow_restore_font);
+ /* cshow does not change rootfont for user procedure */
+ gs_set_currentfont(igs, scaled_font);
+ *++esp = *pslot; /* user procedure */
}
return o_push_estack;
}
@@ -163,7 +163,7 @@ const op_def zcfont_op_defs[] =
{
{"2cshow", zcshow},
{"0rootfont", zrootfont},
- /* Internal operators */
+ /* Internal operators */
{"0%cshow_continue", cshow_continue},
{"0%cshow_restore_font", cshow_restore_font},
op_def_end(0)
diff --git a/gs/psi/zchar.c b/gs/psi/zchar.c
index 7ecd0f306..4cb28727a 100644
--- a/gs/psi/zchar.c
+++ b/gs/psi/zchar.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,8 +40,8 @@
#include "zchar42.h"
/* Forward references */
-static bool map_glyph_to_char(const gs_memory_t *mem,
- const ref *, const ref *, ref *);
+static bool map_glyph_to_char(const gs_memory_t *mem,
+ const ref *, const ref *, ref *);
static int finish_show(i_ctx_t *);
static int op_show_cleanup(i_ctx_t *);
static int op_show_return_width(i_ctx_t *, uint, double *);
@@ -55,12 +55,12 @@ zshow(i_ctx_t *i_ctx_p)
int code = op_show_setup(i_ctx_p, op);
if (code != 0 ||
- (code = gs_show_begin(igs, op->value.bytes, r_size(op), imemory, &penum)) < 0)
- return code;
+ (code = gs_show_begin(igs, op->value.bytes, r_size(op), imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zshow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 1, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 1);
}
@@ -75,13 +75,13 @@ zashow(i_ctx_t *i_ctx_p)
int code = num_params(op - 1, 2, axy);
if (code < 0 ||
- (code = op_show_setup(i_ctx_p, op)) != 0 ||
- (code = gs_ashow_begin(igs, axy[0], axy[1], op->value.bytes, r_size(op), imemory, &penum)) < 0)
- return code;
+ (code = op_show_setup(i_ctx_p, op)) != 0 ||
+ (code = gs_ashow_begin(igs, axy[0], axy[1], op->value.bytes, r_size(op), imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zashow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 3, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 3);
}
@@ -96,26 +96,26 @@ zwidthshow(i_ctx_t *i_ctx_p)
int code;
if ((code = op_show_setup(i_ctx_p, op)) != 0 )
- return code;
+ return code;
check_type(op[-1], t_integer);
if (gs_currentfont(igs)->FontType == ft_composite) {
if ((gs_char) (op[-1].value.intval) != op[-1].value.intval)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
} else {
if (op[-1].value.intval < 0 || op[-1].value.intval > 255)
- return_error(e_rangecheck); /* per PLRM and CET 13-26 */
+ return_error(e_rangecheck); /* per PLRM and CET 13-26 */
}
if ((code = num_params(op - 2, 2, cxy)) < 0 )
return code;
if ((code = gs_widthshow_begin(igs, cxy[0], cxy[1],
- (gs_char) op[-1].value.intval,
- op->value.bytes, r_size(op),
- imemory, &penum)) < 0)
- return code;
+ (gs_char) op[-1].value.intval,
+ op->value.bytes, r_size(op),
+ imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zwidthshow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 4, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 4);
}
@@ -130,29 +130,29 @@ zawidthshow(i_ctx_t *i_ctx_p)
int code;
if ((code = op_show_setup(i_ctx_p, op)) != 0 )
- return code;
+ return code;
if ((code = num_params(op - 1, 2, axy)) < 0 )
- return code;
+ return code;
check_type(op[-3], t_integer);
if (gs_currentfont(igs)->FontType == ft_composite) {
if ((gs_char) (op[-3].value.intval) != op[-3].value.intval)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
} else {
if (op[-3].value.intval < 0 || op[-3].value.intval > 255)
- return_error(e_rangecheck); /* per PLRM and CET 13-02 */
+ return_error(e_rangecheck); /* per PLRM and CET 13-02 */
}
if ((code = num_params(op - 4, 2, cxy)) < 0 )
- return code;
+ return code;
if ((code = gs_awidthshow_begin(igs, cxy[0], cxy[1],
- (gs_char) op[-3].value.intval,
- axy[0], axy[1],
- op->value.bytes, r_size(op),
- imemory, &penum)) < 0)
- return code;
+ (gs_char) op[-3].value.intval,
+ axy[0], axy[1],
+ op->value.bytes, r_size(op),
+ imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zawidthshow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 6, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 6);
}
@@ -173,15 +173,15 @@ zkshow(i_ctx_t *i_ctx_p)
* so we check for it here.
*/
if (gs_currentfont(igs)->FontType == ft_composite)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
if ((code = op_show_setup(i_ctx_p, op)) != 0 ||
- (code = gs_kshow_begin(igs, op->value.bytes, r_size(op),
- imemory, &penum)) < 0)
- return code;
+ (code = gs_kshow_begin(igs, op->value.bytes, r_size(op),
+ imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zkshow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 2, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
sslot = op[-1]; /* save kerning proc */
return op_show_continue_pop(i_ctx_p, 2);
@@ -204,13 +204,13 @@ zstringwidth(i_ctx_t *i_ctx_p)
int code = op_show_setup(i_ctx_p, op);
if (code != 0 ||
- (code = gs_stringwidth_begin(igs, op->value.bytes, r_size(op),
- imemory, &penum)) < 0)
- return code;
+ (code = gs_stringwidth_begin(igs, op->value.bytes, r_size(op),
+ imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zstringwidth;
if ((code = op_show_finish_setup(i_ctx_p, penum, 1, finish_stringwidth)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 1);
}
@@ -232,9 +232,9 @@ finish_stringwidth(i_ctx_t *i_ctx_p)
/* Common code for charpath and .charboxpath. */
static int
-zchar_path(i_ctx_t *i_ctx_p, op_proc_t proc,
- int (*begin)(gs_state *, const byte *, uint,
- bool, gs_memory_t *, gs_text_enum_t **))
+zchar_path(i_ctx_t *i_ctx_p, op_proc_t proc,
+ int (*begin)(gs_state *, const byte *, uint,
+ bool, gs_memory_t *, gs_text_enum_t **))
{
os_ptr op = osp;
gs_text_enum_t *penum;
@@ -243,13 +243,13 @@ zchar_path(i_ctx_t *i_ctx_p, op_proc_t proc,
check_type(*op, t_boolean);
code = op_show_setup(i_ctx_p, op - 1);
if (code != 0 ||
- (code = begin(igs, op[-1].value.bytes, r_size(op - 1),
- op->value.boolval, imemory, &penum)) < 0)
- return code;
+ (code = begin(igs, op[-1].value.bytes, r_size(op - 1),
+ op->value.boolval, imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = proc;
if ((code = op_show_finish_setup(i_ctx_p, penum, 2, finish_show)) < 0) {
- ifree_object(penum, "op_show_enum_setup");
- return code;
+ ifree_object(penum, "op_show_enum_setup");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 2);
}
@@ -276,17 +276,17 @@ zsetcachedevice(i_ctx_t *i_ctx_p)
int code = num_params(op, 6, wbox);
if (penum == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (code < 0)
- return code;
+ return code;
if (zchar_show_width_only(penum))
- return op_show_return_width(i_ctx_p, 6, &wbox[0]);
+ return op_show_return_width(i_ctx_p, 6, &wbox[0]);
code = gs_text_setcachedevice(penum, wbox);
if (code < 0)
- return code;
+ return code;
pop(6);
if (code == 1)
- clear_pagedevice(istate);
+ clear_pagedevice(istate);
return 0;
}
@@ -300,19 +300,19 @@ zsetcachedevice2(i_ctx_t *i_ctx_p)
int code = num_params(op, 10, wbox);
if (penum == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (code < 0)
- return code;
+ return code;
if (zchar_show_width_only(penum))
- return op_show_return_width(i_ctx_p, 10,
- (gs_rootfont(igs)->WMode ?
- &wbox[6] : &wbox[0]));
+ return op_show_return_width(i_ctx_p, 10,
+ (gs_rootfont(igs)->WMode ?
+ &wbox[6] : &wbox[0]));
code = gs_text_setcachedevice2(penum, wbox);
if (code < 0)
- return code;
+ return code;
pop(10);
if (code == 1)
- clear_pagedevice(istate);
+ clear_pagedevice(istate);
return 0;
}
@@ -326,14 +326,14 @@ zsetcharwidth(i_ctx_t *i_ctx_p)
int code = num_params(op, 2, width);
if (penum == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (code < 0)
- return code;
+ return code;
if (zchar_show_width_only(penum))
- return op_show_return_width(i_ctx_p, 2, &width[0]);
+ return op_show_return_width(i_ctx_p, 2, &width[0]);
code = gs_text_setcharwidth(penum, width);
if (code < 0)
- return code;
+ return code;
pop(2);
return 0;
}
@@ -351,13 +351,13 @@ zfontbbox(i_ctx_t *i_ctx_p)
check_dict_read(*op);
code = font_bbox_param(imemory, op, bbox);
if (code < 0)
- return code;
+ return code;
if (bbox[0] < bbox[2] && bbox[1] < bbox[3]) {
- push(4);
- make_reals(op - 4, bbox, 4);
- make_true(op);
+ push(4);
+ make_reals(op - 4, bbox, 4);
+ make_true(op);
} else { /* No bbox, or an empty one. */
- make_false(op);
+ make_false(op);
}
return 0;
}
@@ -376,7 +376,6 @@ zincachedevice(i_ctx_t *i_ctx_p)
return 0;
}
-
/* ------ Initialization procedure ------ */
const op_def zchar_a_op_defs[] =
@@ -392,9 +391,9 @@ const op_def zchar_a_op_defs[] =
{"1show", zshow},
{"1stringwidth", zstringwidth},
{"4widthshow", zwidthshow},
- /* Extensions */
+ /* Extensions */
{"1.fontbbox", zfontbbox},
- /* Internal operators */
+ /* Internal operators */
{"0%finish_show", finish_show},
{"0%finish_stringwidth", finish_stringwidth},
{"0%op_show_continue", op_show_continue},
@@ -418,7 +417,7 @@ glyph_ref(const gs_memory_t *mem, gs_glyph glyph, ref * gref)
if (glyph < gs_min_cid_glyph)
name_index_ref(mem, glyph, gref);
else
- make_int(gref, glyph - gs_min_cid_glyph);
+ make_int(gref, glyph - gs_min_cid_glyph);
}
/* Prepare to set up for a text operator. */
@@ -439,69 +438,69 @@ op_show_enum_setup(i_ctx_t *i_ctx_p)
/* Finish setting up a text operator. */
int
op_show_finish_setup(i_ctx_t *i_ctx_p, gs_text_enum_t * penum, int npop,
- op_proc_t endproc /* end procedure */ )
+ op_proc_t endproc /* end procedure */ )
{
gs_text_enum_t *osenum = op_show_find(i_ctx_p);
es_ptr ep = esp + snumpush;
gs_glyph glyph;
if (gs_currentcpsimode(igs->memory)) {
- /* CET 14-03.PS page 2 emits rangecheck before rendering a character.
- Early check the text to font compatibility
- with decomposing the text into characters.*/
- int code = gs_text_count_chars(igs, gs_get_text_params(penum), imemory);
+ /* CET 14-03.PS page 2 emits rangecheck before rendering a character.
+ Early check the text to font compatibility
+ with decomposing the text into characters.*/
+ int code = gs_text_count_chars(igs, gs_get_text_params(penum), imemory);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
/*
* If we are in the procedure of a cshow for a CID font and this is
* a show operator, do something special, per the Red Book.
*/
if (osenum &&
- SHOW_IS_ALL_OF(osenum,
- TEXT_FROM_STRING | TEXT_DO_NONE | TEXT_INTERVENE) &&
- SHOW_IS_ALL_OF(penum, TEXT_FROM_STRING | TEXT_RETURN_WIDTH) &&
- (glyph = gs_text_current_glyph(osenum)) != gs_no_glyph &&
- glyph >= gs_min_cid_glyph &&
+ SHOW_IS_ALL_OF(osenum,
+ TEXT_FROM_STRING | TEXT_DO_NONE | TEXT_INTERVENE) &&
+ SHOW_IS_ALL_OF(penum, TEXT_FROM_STRING | TEXT_RETURN_WIDTH) &&
+ (glyph = gs_text_current_glyph(osenum)) != gs_no_glyph &&
+ glyph >= gs_min_cid_glyph &&
/* According to PLRM, we don't need to raise a rangecheck error,
if currentfont is changed in the proc of the operator 'cshow'. */
- gs_default_same_font (gs_text_current_font(osenum),
- gs_text_current_font(penum), true)
- ) {
- gs_text_params_t text;
-
- if (!(penum->text.size == 1 &&
- penum->text.data.bytes[0] ==
- (gs_text_current_char(osenum) & 0xff))
- )
- return_error(e_rangecheck);
- text = penum->text;
- text.operation =
- (text.operation &
- ~(TEXT_FROM_STRING | TEXT_FROM_BYTES | TEXT_FROM_CHARS |
- TEXT_FROM_GLYPHS | TEXT_FROM_SINGLE_CHAR)) |
- TEXT_FROM_SINGLE_GLYPH;
- text.data.d_glyph = glyph;
- text.size = 1;
- gs_text_restart(penum, &text);
+ gs_default_same_font (gs_text_current_font(osenum),
+ gs_text_current_font(penum), true)
+ ) {
+ gs_text_params_t text;
+
+ if (!(penum->text.size == 1 &&
+ penum->text.data.bytes[0] ==
+ (gs_text_current_char(osenum) & 0xff))
+ )
+ return_error(e_rangecheck);
+ text = penum->text;
+ text.operation =
+ (text.operation &
+ ~(TEXT_FROM_STRING | TEXT_FROM_BYTES | TEXT_FROM_CHARS |
+ TEXT_FROM_GLYPHS | TEXT_FROM_SINGLE_CHAR)) |
+ TEXT_FROM_SINGLE_GLYPH;
+ text.data.d_glyph = glyph;
+ text.size = 1;
+ gs_text_restart(penum, &text);
}
if (osenum && osenum->current_font->FontType == ft_user_defined &&
- osenum->orig_font->FontType == ft_composite &&
- ((const gs_font_type0 *)osenum->orig_font)->data.FMapType == fmap_CMap) {
- /* A special behavior defined in PLRM3 section 5.11 page 389. */
- penum->outer_CID = osenum->returned.current_glyph;
+ osenum->orig_font->FontType == ft_composite &&
+ ((const gs_font_type0 *)osenum->orig_font)->data.FMapType == fmap_CMap) {
+ /* A special behavior defined in PLRM3 section 5.11 page 389. */
+ penum->outer_CID = osenum->returned.current_glyph;
}
if (osenum == NULL && !(penum->text.operation & (TEXT_FROM_GLYPHS | TEXT_FROM_SINGLE_GLYPH))) {
int ft = igs->root_font->FontType;
-
+
if ((ft >= ft_CID_encrypted && ft <= ft_CID_TrueType) || ft == ft_CID_bitmap)
return_error(e_typecheck);
}
make_mark_estack(ep - (snumpush - 1), es_show, op_show_cleanup);
if (endproc == NULL)
- endproc = finish_show;
+ endproc = finish_show;
make_null(&esslot(ep));
make_int(&esodepth(ep), ref_stack_count_inline(&o_stack) - npop); /* Save stack depth for */
make_int(&esddepth(ep), ref_stack_count_inline(&d_stack)); /* correct interrupt processing */
@@ -521,7 +520,7 @@ op_show_continue(i_ctx_t *i_ctx_p)
int code = gs_text_update_dev_color(igs, senum);
if (code >= 0)
- code = op_show_continue_dispatch(i_ctx_p, 0, gs_text_process(senum));
+ code = op_show_continue_dispatch(i_ctx_p, 0, gs_text_process(senum));
return code;
}
int
@@ -542,142 +541,142 @@ op_show_continue_dispatch(i_ctx_t *i_ctx_p, int npop, int code)
gs_text_enum_t *penum = senum;
switch (code) {
- case 0: { /* all done */
- os_ptr save_osp = osp;
-
- osp = op;
- code = (*real_opproc(&seproc)) (i_ctx_p);
- op_show_free(i_ctx_p, code);
- if (code < 0) {
- osp = save_osp;
- return code;
- }
- return o_pop_estack;
- }
- case TEXT_PROCESS_INTERVENE: {
- ref *pslot = &sslot; /* only used for kshow */
-
- push(2);
- make_int(op - 1, gs_text_current_char(penum)); /* previous char */
- make_int(op, gs_text_next_char(penum));
- push_op_estack(op_show_continue); /* continue after kerning */
- *++esp = *pslot; /* kerning procedure */
- return o_push_estack;
- }
- case TEXT_PROCESS_RENDER: {
- gs_font *pfont = gs_currentfont(igs);
- font_data *pfdata = pfont_data(pfont);
- gs_char chr = gs_text_current_char(penum);
- gs_glyph glyph = gs_text_current_glyph(penum);
-
- push(2);
- op[-1] = pfdata->dict; /* push the font */
- /*
- * For Type 1 and Type 4 fonts, prefer BuildChar to BuildGlyph
- * if there is no glyph, or if there is both a character and a
- * glyph and the glyph is the one that corresponds to the
- * character in the Encoding, so that PostScript procedures
- * appearing in the CharStrings dictionary will receive the
- * character code rather than the character name; for Type 3
- * fonts, prefer BuildGlyph to BuildChar. For other font types
- * (such as CID fonts), only BuildGlyph will be present.
- */
- if (pfont->FontType == ft_user_defined) {
- /* Type 3 font, prefer BuildGlyph. */
- if (level2_enabled &&
- !r_has_type(&pfdata->BuildGlyph, t_null) &&
- glyph != gs_no_glyph
- ) {
- glyph_ref(imemory, glyph, op);
- esp[2] = pfdata->BuildGlyph;
- } else if (r_has_type(&pfdata->BuildChar, t_null))
- goto err;
- else if (chr == gs_no_char) {
- /* glyphshow, reverse map the character */
- /* through the Encoding */
- ref gref;
- const ref *pencoding = &pfdata->Encoding;
-
- glyph_ref(imemory, glyph, &gref);
- if (!map_glyph_to_char(imemory, &gref, pencoding,
- (ref *) op)
- ) { /* Not found, try .notdef */
- name_enter_string(imemory, ".notdef", &gref);
- if (!map_glyph_to_char(imemory, &gref,
- pencoding,
- (ref *) op)
- )
- goto err;
- }
- esp[2] = pfdata->BuildChar;
- } else {
- make_int(op, chr & 0xff);
- esp[2] = pfdata->BuildChar;
- }
- } else {
- /*
- * For a Type 1 or Type 4 font, prefer BuildChar or
- * BuildGlyph as described above: we know that both
- * BuildChar and BuildGlyph are present. For other font
- * types, only BuildGlyph is available.
- */
- ref eref, gref;
-
- if (chr != gs_no_char &&
- !r_has_type(&pfdata->BuildChar, t_null) &&
- (glyph == gs_no_glyph ||
- (!r_has_type(&pfdata->Encoding, t_null) &&
- array_get(imemory, &pfdata->Encoding, (long)(chr & 0xff), &eref) >= 0 &&
- (glyph_ref(imemory, glyph, &gref), obj_eq(imemory, &gref, &eref))))
- ) {
- make_int(op, chr & 0xff);
- esp[2] = pfdata->BuildChar;
- } else {
- /* We might not have a glyph: substitute 0. **HACK** */
- if (glyph == gs_no_glyph)
- make_int(op, 0);
- else
- glyph_ref(imemory, glyph, op);
- esp[2] = pfdata->BuildGlyph;
- }
- }
- /* Save the stack depths in case we bail out. */
- sodepth.value.intval = ref_stack_count(&o_stack) - 2;
- sddepth.value.intval = ref_stack_count(&d_stack);
- push_op_estack(op_show_continue);
- ++esp; /* skip BuildChar or BuildGlyph proc */
- return o_push_estack;
- }
- case TEXT_PROCESS_CDEVPROC:
- { gs_font *pfont = penum->current_font;
- ref cnref;
- op_proc_t cont = op_show_continue, exec_cont = 0;
- gs_glyph glyph = penum->returned.current_glyph;
- int code;
-
- pop(npop);
- op = osp;
- glyph_ref(imemory, glyph, &cnref);
- if (pfont->FontType == ft_CID_TrueType) {
- gs_font_type42 *pfont42 = (gs_font_type42 *)pfont;
- uint glyph_index = pfont42->data.get_glyph_index(pfont42, glyph);
-
- code = zchar42_set_cache(i_ctx_p, (gs_font_base *)pfont42,
- &cnref, glyph_index, cont, &exec_cont);
- } else if (pfont->FontType == ft_CID_encrypted)
- code = z1_set_cache(i_ctx_p, (gs_font_base *)pfont,
- &cnref, glyph, cont, &exec_cont);
- else
- return_error(e_unregistered); /* Unimplemented. */
- if (exec_cont != 0)
- return_error(e_unregistered); /* Must not happen. */
- return code;
- }
- default: /* error */
+ case 0: { /* all done */
+ os_ptr save_osp = osp;
+
+ osp = op;
+ code = (*real_opproc(&seproc)) (i_ctx_p);
+ op_show_free(i_ctx_p, code);
+ if (code < 0) {
+ osp = save_osp;
+ return code;
+ }
+ return o_pop_estack;
+ }
+ case TEXT_PROCESS_INTERVENE: {
+ ref *pslot = &sslot; /* only used for kshow */
+
+ push(2);
+ make_int(op - 1, gs_text_current_char(penum)); /* previous char */
+ make_int(op, gs_text_next_char(penum));
+ push_op_estack(op_show_continue); /* continue after kerning */
+ *++esp = *pslot; /* kerning procedure */
+ return o_push_estack;
+ }
+ case TEXT_PROCESS_RENDER: {
+ gs_font *pfont = gs_currentfont(igs);
+ font_data *pfdata = pfont_data(pfont);
+ gs_char chr = gs_text_current_char(penum);
+ gs_glyph glyph = gs_text_current_glyph(penum);
+
+ push(2);
+ op[-1] = pfdata->dict; /* push the font */
+ /*
+ * For Type 1 and Type 4 fonts, prefer BuildChar to BuildGlyph
+ * if there is no glyph, or if there is both a character and a
+ * glyph and the glyph is the one that corresponds to the
+ * character in the Encoding, so that PostScript procedures
+ * appearing in the CharStrings dictionary will receive the
+ * character code rather than the character name; for Type 3
+ * fonts, prefer BuildGlyph to BuildChar. For other font types
+ * (such as CID fonts), only BuildGlyph will be present.
+ */
+ if (pfont->FontType == ft_user_defined) {
+ /* Type 3 font, prefer BuildGlyph. */
+ if (level2_enabled &&
+ !r_has_type(&pfdata->BuildGlyph, t_null) &&
+ glyph != gs_no_glyph
+ ) {
+ glyph_ref(imemory, glyph, op);
+ esp[2] = pfdata->BuildGlyph;
+ } else if (r_has_type(&pfdata->BuildChar, t_null))
+ goto err;
+ else if (chr == gs_no_char) {
+ /* glyphshow, reverse map the character */
+ /* through the Encoding */
+ ref gref;
+ const ref *pencoding = &pfdata->Encoding;
+
+ glyph_ref(imemory, glyph, &gref);
+ if (!map_glyph_to_char(imemory, &gref, pencoding,
+ (ref *) op)
+ ) { /* Not found, try .notdef */
+ name_enter_string(imemory, ".notdef", &gref);
+ if (!map_glyph_to_char(imemory, &gref,
+ pencoding,
+ (ref *) op)
+ )
+ goto err;
+ }
+ esp[2] = pfdata->BuildChar;
+ } else {
+ make_int(op, chr & 0xff);
+ esp[2] = pfdata->BuildChar;
+ }
+ } else {
+ /*
+ * For a Type 1 or Type 4 font, prefer BuildChar or
+ * BuildGlyph as described above: we know that both
+ * BuildChar and BuildGlyph are present. For other font
+ * types, only BuildGlyph is available.
+ */
+ ref eref, gref;
+
+ if (chr != gs_no_char &&
+ !r_has_type(&pfdata->BuildChar, t_null) &&
+ (glyph == gs_no_glyph ||
+ (!r_has_type(&pfdata->Encoding, t_null) &&
+ array_get(imemory, &pfdata->Encoding, (long)(chr & 0xff), &eref) >= 0 &&
+ (glyph_ref(imemory, glyph, &gref), obj_eq(imemory, &gref, &eref))))
+ ) {
+ make_int(op, chr & 0xff);
+ esp[2] = pfdata->BuildChar;
+ } else {
+ /* We might not have a glyph: substitute 0. **HACK** */
+ if (glyph == gs_no_glyph)
+ make_int(op, 0);
+ else
+ glyph_ref(imemory, glyph, op);
+ esp[2] = pfdata->BuildGlyph;
+ }
+ }
+ /* Save the stack depths in case we bail out. */
+ sodepth.value.intval = ref_stack_count(&o_stack) - 2;
+ sddepth.value.intval = ref_stack_count(&d_stack);
+ push_op_estack(op_show_continue);
+ ++esp; /* skip BuildChar or BuildGlyph proc */
+ return o_push_estack;
+ }
+ case TEXT_PROCESS_CDEVPROC:
+ { gs_font *pfont = penum->current_font;
+ ref cnref;
+ op_proc_t cont = op_show_continue, exec_cont = 0;
+ gs_glyph glyph = penum->returned.current_glyph;
+ int code;
+
+ pop(npop);
+ op = osp;
+ glyph_ref(imemory, glyph, &cnref);
+ if (pfont->FontType == ft_CID_TrueType) {
+ gs_font_type42 *pfont42 = (gs_font_type42 *)pfont;
+ uint glyph_index = pfont42->data.get_glyph_index(pfont42, glyph);
+
+ code = zchar42_set_cache(i_ctx_p, (gs_font_base *)pfont42,
+ &cnref, glyph_index, cont, &exec_cont);
+ } else if (pfont->FontType == ft_CID_encrypted)
+ code = z1_set_cache(i_ctx_p, (gs_font_base *)pfont,
+ &cnref, glyph, cont, &exec_cont);
+ else
+ return_error(e_unregistered); /* Unimplemented. */
+ if (exec_cont != 0)
+ return_error(e_unregistered); /* Must not happen. */
+ return code;
+ }
+ default: /* error */
err:
- if (code >= 0)
- code = gs_note_error(e_invalidfont);
- return op_show_free(i_ctx_p, code);
+ if (code >= 0)
+ code = gs_note_error(e_invalidfont);
+ return op_show_free(i_ctx_p, code);
}
}
/* Reverse-map a glyph name to a character code for glyphshow. */
@@ -690,10 +689,10 @@ map_glyph_to_char(const gs_memory_t *mem, const ref * pgref, const ref * pencodi
for (ch = 0; ch < esize; ch++) {
array_get(mem, pencoding, (long)ch, &eref);
- if (obj_eq(mem, pgref, &eref)) {
- make_int(pch, ch);
- return true;
- }
+ if (obj_eq(mem, pgref, &eref)) {
+ make_int(pch, ch);
+ return true;
+ }
}
return false;
}
@@ -708,12 +707,12 @@ op_show_find_index(i_ctx_t *i_ctx_p)
ref_stack_enum_begin(&rsenum, &e_stack);
do {
- es_ptr ep = rsenum.ptr;
- uint size = rsenum.size;
+ es_ptr ep = rsenum.ptr;
+ uint size = rsenum.size;
- for (ep += size - 1; size != 0; size--, ep--, count++)
- if (r_is_estack_mark(ep) && estack_mark_index(ep) == es_show)
- return count;
+ for (ep += size - 1; size != 0; size--, ep--, count++)
+ if (r_is_estack_mark(ep) && estack_mark_index(ep) == es_show)
+ return count;
} while (ref_stack_enum_next(&rsenum));
return 0; /* no mark */
}
@@ -725,9 +724,9 @@ op_show_find(i_ctx_t *i_ctx_p)
uint index = op_show_find_index(i_ctx_p);
if (index == 0)
- return 0; /* no mark */
+ return 0; /* no mark */
return r_ptr(ref_stack_index(&e_stack, index - (snumpush - 1)),
- gs_text_enum_t);
+ gs_text_enum_t);
}
/*
@@ -741,7 +740,7 @@ bool
zchar_show_width_only(const gs_text_enum_t * penum)
{
if (!gs_text_is_width_only(penum))
- return false;
+ return false;
switch (penum->orig_font->FontType) {
case ft_encrypted:
case ft_encrypted2:
@@ -749,9 +748,9 @@ zchar_show_width_only(const gs_text_enum_t * penum)
case ft_CID_TrueType:
case ft_CID_bitmap:
case ft_TrueType:
- return true;
+ return true;
default:
- return false;
+ return false;
}
}
@@ -768,20 +767,20 @@ op_show_return_width(i_ctx_t *i_ctx_p, uint npop, double *pwidth)
uint ocount, dsaved, dcount;
if (code < 0)
- return code;
+ return code;
/* Restore the operand and dictionary stacks. */
ocount = ref_stack_count(&o_stack) - (uint) esodepth(ep).value.intval;
if (ocount < npop)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
dsaved = (uint) esddepth(ep).value.intval;
dcount = ref_stack_count(&d_stack);
if (dcount < dsaved)
- return_error(e_dictstackunderflow);
+ return_error(e_dictstackunderflow);
while (dcount > dsaved) {
- code = zend(i_ctx_p);
- if (code < 0)
- return code;
- dcount--;
+ code = zend(i_ctx_p);
+ if (code < 0)
+ return code;
+ dcount--;
}
ref_stack_pop(&o_stack, ocount);
/* We don't want to pop the mark or the continuation */
@@ -803,30 +802,30 @@ op_show_restore(i_ctx_t *i_ctx_p, bool for_error)
int code = 0;
if (for_error) {
-#if 0 /* Disabled for CPSI compatibility for 13-12-4.
+#if 0 /* Disabled for CPSI compatibility for 13-12-4.
CPSI doesn't remove cshow, kshow proc operands. */
- uint saved_count = esodepth(ep).value.intval;
- uint count = ref_stack_count(&o_stack);
+ uint saved_count = esodepth(ep).value.intval;
+ uint count = ref_stack_count(&o_stack);
- if (count > saved_count) /* if <, we're in trouble */
- ref_stack_pop(&o_stack, count - saved_count);
+ if (count > saved_count) /* if <, we're in trouble */
+ ref_stack_pop(&o_stack, count - saved_count);
#endif
- if (ep[1].value.opproc == op_show_continue && penum->enum_client_data != NULL) {
- /* Replace the continuation operaton on estack with the right operator : */
- op_proc_t proc;
+ if (ep[1].value.opproc == op_show_continue && penum->enum_client_data != NULL) {
+ /* Replace the continuation operaton on estack with the right operator : */
+ op_proc_t proc;
- *(void **)&proc = penum->enum_client_data;
- make_op_estack(ep + 1, proc);
- }
+ *(void **)&proc = penum->enum_client_data;
+ make_op_estack(ep + 1, proc);
+ }
}
- if (SHOW_IS_STRINGWIDTH(penum) && igs->text_rendering_mode != 3) {
- /* stringwidth does an extra gsave */
- --saved_level;
+ if (SHOW_IS_STRINGWIDTH(penum) && igs->text_rendering_mode != 3) {
+ /* stringwidth does an extra gsave */
+ --saved_level;
}
if (penum->text.operation & TEXT_REPLACE_WIDTHS) {
- gs_free_const_object(penum->memory, penum->text.y_widths, "y_widths");
- if (penum->text.x_widths != penum->text.y_widths)
- gs_free_const_object(penum->memory, penum->text.x_widths, "x_widths");
+ gs_free_const_object(penum->memory, penum->text.y_widths, "y_widths");
+ if (penum->text.x_widths != penum->text.y_widths)
+ gs_free_const_object(penum->memory, penum->text.x_widths, "x_widths");
}
/*
* We might have been inside a cshow, in which case currentfont was
@@ -837,14 +836,14 @@ op_show_restore(i_ctx_t *i_ctx_p, bool for_error)
*/
gs_set_currentfont(igs, penum->orig_font);
while (igs->level > saved_level && code >= 0) {
- if (igs->saved == 0 || igs->saved->saved == 0) {
- /*
- * Bad news: we got an error inside a save inside a BuildChar or
- * BuildGlyph. Don't attempt to recover.
- */
- code = gs_note_error(e_Fatal);
- } else
- code = gs_grestore(igs);
+ if (igs->saved == 0 || igs->saved->saved == 0) {
+ /*
+ * Bad news: we got an error inside a save inside a BuildChar or
+ * BuildGlyph. Don't attempt to recover.
+ */
+ code = gs_note_error(e_Fatal);
+ } else
+ code = gs_grestore(igs);
}
gs_text_release(penum, "op_show_restore");
return code;
@@ -882,30 +881,30 @@ font_bbox_param(const gs_memory_t *mem, const ref * pfdict, double bbox[4])
*/
bbox[0] = bbox[1] = bbox[2] = bbox[3] = 0.0;
if (dict_find_string(pfdict, "FontBBox", &pbbox) > 0) {
- if (!r_is_array(pbbox))
- return_error(e_typecheck);
- if (r_size(pbbox) == 4) {
- const ref_packed *pbe = pbbox->value.packed;
- ref rbe[4];
- int i;
- int code;
- float dx, dy, ratio;
- const float max_ratio = 12; /* From the bug 687594. */
-
- for (i = 0; i < 4; i++) {
- packed_get(mem, pbe, rbe + i);
- pbe = packed_next(pbe);
- }
- if ((code = num_params(rbe + 3, 4, bbox)) < 0)
- return code;
- /* Require "reasonable" values. */
- dx = bbox[2] - bbox[0];
- dy = bbox[3] - bbox[1];
- if (dx <= 0 || dy <= 0 ||
- (ratio = dy / dx) < 1 / max_ratio || ratio > max_ratio
- )
- bbox[0] = bbox[1] = bbox[2] = bbox[3] = 0.0;
- }
+ if (!r_is_array(pbbox))
+ return_error(e_typecheck);
+ if (r_size(pbbox) == 4) {
+ const ref_packed *pbe = pbbox->value.packed;
+ ref rbe[4];
+ int i;
+ int code;
+ float dx, dy, ratio;
+ const float max_ratio = 12; /* From the bug 687594. */
+
+ for (i = 0; i < 4; i++) {
+ packed_get(mem, pbe, rbe + i);
+ pbe = packed_next(pbe);
+ }
+ if ((code = num_params(rbe + 3, 4, bbox)) < 0)
+ return code;
+ /* Require "reasonable" values. */
+ dx = bbox[2] - bbox[0];
+ dy = bbox[3] - bbox[1];
+ if (dx <= 0 || dy <= 0 ||
+ (ratio = dy / dx) < 1 / max_ratio || ratio > max_ratio
+ )
+ bbox[0] = bbox[1] = bbox[2] = bbox[3] = 0.0;
+ }
} else if (gs_currentcpsimode(mem)) {
return_error(e_invalidfont); /* CPSI requires FontBBox */
}
diff --git a/gs/psi/zchar1.c b/gs/psi/zchar1.c
index b99c1806b..fbbc85dcd 100644
--- a/gs/psi/zchar1.c
+++ b/gs/psi/zchar1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
#include "gxfcid.h"
#include "gxchar.h"
#include "gzstate.h" /* for path for gs_type1_init */
- /* (should only be gsstate.h) */
+ /* (should only be gsstate.h) */
#include "gscencs.h"
#include "gspaint.h" /* for gs_fill, gs_stroke */
#include "gspath.h"
@@ -49,7 +49,7 @@
* directions, aren't affected by choice of filling rule; but some
* badly designed fonts in the Genoa test suite seem to require
* using the even-odd rule to match Adobe interpreters.
- *
+ *
* Properly designed fonts will render correctly with: eofill
* (required for Adobe CPSI compliant behavior
*/
@@ -76,14 +76,14 @@ static bool
font_uses_charstrings(const gs_font *pfont)
{
return (pfont->FontType == ft_encrypted ||
- pfont->FontType == ft_encrypted2 ||
- pfont->FontType == ft_disk_based);
+ pfont->FontType == ft_encrypted2 ||
+ pfont->FontType == ft_disk_based);
}
/* Initialize a Type 1 interpreter. */
static int
type1_exec_init(gs_type1_state *pcis, gs_text_enum_t *penum,
- gs_state *pgs, gs_font_type1 *pfont1)
+ gs_state *pgs, gs_font_type1 *pfont1)
{
/*
* We have to disregard penum->pis and penum->path, and render to
@@ -91,24 +91,24 @@ type1_exec_init(gs_type1_state *pcis, gs_text_enum_t *penum,
* have to address someday!
*/
- int alpha_bits = 1;
+ int alpha_bits = 1;
gs_log2_scale_point log2_subpixels;
-
+
if (color_is_pure(gs_currentdevicecolor_inline(pgs))) /* Keep consistency with alpha_buffer_bits() */
- alpha_bits = (*dev_proc(pgs->device, get_alpha_bits)) (pgs->device, go_text);
+ alpha_bits = (*dev_proc(pgs->device, get_alpha_bits)) (pgs->device, go_text);
if (alpha_bits <= 1) {
- /* We render to cache device or the target device has no alpha bits. */
- log2_subpixels = penum->log2_scale;
+ /* We render to cache device or the target device has no alpha bits. */
+ log2_subpixels = penum->log2_scale;
} else {
- /* We'll render to target device through alpha buffer. */
- /* Keep consistency with alpha_buffer_init() */
- log2_subpixels.x = log2_subpixels.y = ilog2(alpha_bits);
+ /* We'll render to target device through alpha buffer. */
+ /* Keep consistency with alpha_buffer_init() */
+ log2_subpixels.x = log2_subpixels.y = ilog2(alpha_bits);
}
return gs_type1_interp_init(pcis, (gs_imager_state *)pgs, pgs->path,
- &penum->log2_scale, &log2_subpixels,
- (penum->text.operation & TEXT_DO_ANY_CHARPATH) != 0 ||
- penum->device_disabled_grid_fitting,
- pfont1->PaintType, pfont1);
+ &penum->log2_scale, &log2_subpixels,
+ (penum->text.operation & TEXT_DO_ANY_CHARPATH) != 0 ||
+ penum->device_disabled_grid_fitting,
+ pfont1->PaintType, pfont1);
}
/* ---------------- .type1execchar ---------------- */
@@ -141,20 +141,20 @@ typedef struct gs_type1exec_state_s {
} gs_type1exec_state;
gs_private_st_suffix_add1(st_gs_type1exec_state, gs_type1exec_state,
- "gs_type1exec_state", gs_type1exec_state_enum_ptrs,
- gs_type1exec_state_reloc_ptrs, st_gs_type1_state,
- i_ctx_p);
+ "gs_type1exec_state", gs_type1exec_state_enum_ptrs,
+ gs_type1exec_state_reloc_ptrs, st_gs_type1_state,
+ i_ctx_p);
/* Forward references */
static int bbox_continue(i_ctx_t *);
static int nobbox_continue(i_ctx_t *);
static int type1_push_OtherSubr(i_ctx_t *, const gs_type1exec_state *,
- int (*)(i_ctx_t *), const ref *);
+ int (*)(i_ctx_t *), const ref *);
static int type1_call_OtherSubr(i_ctx_t *, const gs_type1exec_state *,
- int (*)(i_ctx_t *), const ref *);
+ int (*)(i_ctx_t *), const ref *);
static int type1_callout_dispatch(i_ctx_t *, int (*)(i_ctx_t *), int);
static int type1_continue_dispatch(i_ctx_t *, gs_type1exec_state *,
- const ref *, ref *, int);
+ const ref *, ref *, int);
static int op_type1_cleanup(i_ctx_t *);
static void op_type1_free(i_ctx_t *);
static int bbox_getsbw_continue(i_ctx_t *);
@@ -173,7 +173,7 @@ static int
ztype1execchar(i_ctx_t *i_ctx_p)
{
return charstring_execchar(i_ctx_p, (1 << (int)ft_encrypted) |
- (1 << (int)ft_disk_based));
+ (1 << (int)ft_disk_based));
}
static int
charstring_execchar_aux(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_font *pfont)
@@ -188,11 +188,11 @@ charstring_execchar_aux(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_font *pfont)
int code;
if (penum->current_font->FontType == ft_CID_encrypted) {
- if (FontBBox.q.x <= FontBBox.p.x && FontBBox.q.y <= FontBBox.p.y) {
- gs_font_cid0 *pfcid0 = (gs_font_cid0 *)penum->current_font;
+ if (FontBBox.q.x <= FontBBox.p.x && FontBBox.q.y <= FontBBox.p.y) {
+ gs_font_cid0 *pfcid0 = (gs_font_cid0 *)penum->current_font;
- FontBBox = pfcid0->FontBBox;
- }
+ FontBBox = pfcid0->FontBBox;
+ }
}
pdata = &pfont1->data;
@@ -204,20 +204,20 @@ charstring_execchar_aux(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_font *pfont)
* If this is a stroked font, set the stroke width.
*/
if (pfont->PaintType)
- gs_setlinewidth(igs, pfont->StrokeWidth);
+ gs_setlinewidth(igs, pfont->StrokeWidth);
check_estack(3); /* for continuations */
/*
* Execute the definition of the character.
*/
if (r_is_proc(op))
- return zchar_exec_char_proc(i_ctx_p);
+ return zchar_exec_char_proc(i_ctx_p);
/*
* The definition must be a Type 1 CharString.
* Note that we do not require read access: this is deliberate.
*/
check_type(*op, t_string);
if (r_size(op) <= max(pdata->lenIV, 0))
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
/*
* In order to make character oversampling work, we must
* set up the cache before calling .type1addpath.
@@ -227,97 +227,97 @@ charstring_execchar_aux(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_font *pfont)
*/
if ((penum->FontBBox_as_Metrics2.x == 0 &&
- penum->FontBBox_as_Metrics2.y == 0) ||
- gs_rootfont(igs)->WMode == 0 ) {
- code = zchar_get_metrics(pbfont, op - 1, cxs.sbw);
- if (code < 0)
- return code;
- cxs.present = code;
- cxs.use_FontBBox_as_Metrics2 = false;
+ penum->FontBBox_as_Metrics2.y == 0) ||
+ gs_rootfont(igs)->WMode == 0 ) {
+ code = zchar_get_metrics(pbfont, op - 1, cxs.sbw);
+ if (code < 0)
+ return code;
+ cxs.present = code;
+ cxs.use_FontBBox_as_Metrics2 = false;
} else { /* pass here if FontType==9,11 && WMode==1*/
- cxs.sbw[0] = penum->FontBBox_as_Metrics2.x / 2;
- cxs.sbw[1] = penum->FontBBox_as_Metrics2.y;
- cxs.sbw[2] = 0;
- cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
- cxs.use_FontBBox_as_Metrics2 = true;
- cxs.present = metricsNone;
+ cxs.sbw[0] = penum->FontBBox_as_Metrics2.x / 2;
+ cxs.sbw[1] = penum->FontBBox_as_Metrics2.y;
+ cxs.sbw[2] = 0;
+ cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
+ cxs.use_FontBBox_as_Metrics2 = true;
+ cxs.present = metricsNone;
}
/* Establish a current point. */
code = gs_moveto(igs, 0.0, 0.0);
if (code < 0)
- return code;
+ return code;
code = type1_exec_init(pcis, penum, igs, pfont1);
if (code < 0)
- return code;
+ return code;
gs_type1_set_callback_data(pcis, &cxs);
if (FontBBox.q.x > FontBBox.p.x &&
- FontBBox.q.y > FontBBox.p.y
- ) {
- /* The FontBBox appears to be valid. */
- op_proc_t exec_cont = 0;
-
- cxs.char_bbox = pfont1->FontBBox;
- code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, &exec_cont);
- if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
- return code;
+ FontBBox.q.y > FontBBox.p.y
+ ) {
+ /* The FontBBox appears to be valid. */
+ op_proc_t exec_cont = 0;
+
+ cxs.char_bbox = pfont1->FontBBox;
+ code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, &exec_cont);
+ if (code >= 0 && exec_cont != 0)
+ code = (*exec_cont)(i_ctx_p);
+ return code;
} else {
- /* The FontBBox is not valid */
+ /* The FontBBox is not valid */
const ref *opstr = op;
- ref other_subr;
+ ref other_subr;
const gs_matrix * pctm = &ctm_only(igs);
- /* First, check for singular CTM */
+ /* First, check for singular CTM */
if (pctm->xx * pctm->yy == pctm->xy * pctm->yx) {
/* The code below won't be able to find the FontBBox but we
* don't need it anyway. Set an empty box and consider it valid.
*/
- op_proc_t exec_cont = 0;
-
- cxs.char_bbox.p.x = 0;
- cxs.char_bbox.p.y = 0;
- cxs.char_bbox.q.x = 0;
- cxs.char_bbox.q.y = 0;
- code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, &exec_cont);
- if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
- return code;
+ op_proc_t exec_cont = 0;
+
+ cxs.char_bbox.p.x = 0;
+ cxs.char_bbox.p.y = 0;
+ cxs.char_bbox.q.x = 0;
+ cxs.char_bbox.q.y = 0;
+ code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, &exec_cont);
+ if (code >= 0 && exec_cont != 0)
+ code = (*exec_cont)(i_ctx_p);
+ return code;
}
- /* Now we create the path first, then do the setcachedevice.
- * If we are oversampling (in this case, only for anti-
- * aliasing, not just to improve quality), we have to
- * create the path twice, since we can't know the
- * oversampling factor until after setcachedevice.
- */
- switch (cxs.present) {
- case metricsSideBearingAndWidth: {
+ /* Now we create the path first, then do the setcachedevice.
+ * If we are oversampling (in this case, only for anti-
+ * aliasing, not just to improve quality), we have to
+ * create the path twice, since we can't know the
+ * oversampling factor until after setcachedevice.
+ */
+ switch (cxs.present) {
+ case metricsSideBearingAndWidth: {
gs_point pt;
- pt.x = cxs.sbw[0], pt.y = cxs.sbw[1];
- gs_type1_set_lsb(pcis, &pt);
+ pt.x = cxs.sbw[0], pt.y = cxs.sbw[1];
+ gs_type1_set_lsb(pcis, &pt);
}
/* fall through */
case metricsWidthOnly: {
gs_point pt;
- pt.x = cxs.sbw[2], pt.y = cxs.sbw[3];
+ pt.x = cxs.sbw[2], pt.y = cxs.sbw[3];
gs_type1_set_width(pcis, &pt);
}
}
- /* Continue interpreting. */
+ /* Continue interpreting. */
icont:
- code = type1_continue_dispatch(i_ctx_p, &cxs, opstr, &other_subr, 4);
- op = osp; /* OtherSubrs might change it */
- switch (code) {
- case 0: /* all done */
- return nobbox_finish(i_ctx_p, &cxs);
- default: /* code < 0, error */
- return code;
- case type1_result_callothersubr: /* unknown OtherSubr */
- return type1_call_OtherSubr(i_ctx_p, &cxs, nobbox_continue,
- &other_subr);
- case type1_result_sbw: /* [h]sbw, just continue */
+ code = type1_continue_dispatch(i_ctx_p, &cxs, opstr, &other_subr, 4);
+ op = osp; /* OtherSubrs might change it */
+ switch (code) {
+ case 0: /* all done */
+ return nobbox_finish(i_ctx_p, &cxs);
+ default: /* code < 0, error */
+ return code;
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return type1_call_OtherSubr(i_ctx_p, &cxs, nobbox_continue,
+ &other_subr);
+ case type1_result_sbw: /* [h]sbw, just continue */
switch (cxs.present) {
case metricsNone:
cxs.sbw[0] = fixed2float(pcis->lsb.x);
@@ -328,8 +328,8 @@ charstring_execchar_aux(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_font *pfont)
cxs.sbw[3] = fixed2float(pcis->width.y);
}
opstr = 0;
- goto icont;
- }
+ goto icont;
+ }
}
}
@@ -342,24 +342,24 @@ charstring_execchar(i_ctx_t *i_ctx_p, int font_type_mask)
int code = font_param(op - 3, &pfont);
if (code < 0)
- return code;
+ return code;
if (penum == 0 ||
- pfont->FontType >= sizeof(font_type_mask) * 8 ||
- !(font_type_mask & (1 << (int)pfont->FontType)))
- return_error(e_undefined);
+ pfont->FontType >= sizeof(font_type_mask) * 8 ||
+ !(font_type_mask & (1 << (int)pfont->FontType)))
+ return_error(e_undefined);
code = charstring_execchar_aux(i_ctx_p, penum, pfont);
if (code < 0 && igs->in_cachedevice == CACHE_DEVICE_CACHING) {
- /* Perform the cache cleanup, when the cached character data
- has been allocated (gx_alloc_char_bits) but
- the character has not been added to the cache (gx_add_cached_char)
- due to a falure in the character renderer.
- */
- gs_show_enum *const penum_s = (gs_show_enum *)penum;
-
- if (penum_s->cc != NULL) {
- gx_free_cached_char(pfont->dir, penum_s->cc);
- penum_s->cc = NULL;
- }
+ /* Perform the cache cleanup, when the cached character data
+ has been allocated (gx_alloc_char_bits) but
+ the character has not been added to the cache (gx_add_cached_char)
+ due to a falure in the character renderer.
+ */
+ gs_show_enum *const penum_s = (gs_show_enum *)penum;
+
+ if (penum_s->cc != NULL) {
+ gx_free_cached_char(pfont->dir, penum_s->cc);
+ penum_s->cc = NULL;
+ }
}
return code;
}
@@ -370,69 +370,68 @@ charstring_execchar(i_ctx_t *i_ctx_p, int font_type_mask)
/* Returns exec_cont - a function, which must be called by caller after this function. */
static int
type1exec_bbox(i_ctx_t *i_ctx_p, gs_text_enum_t *penum, gs_type1exec_state * pcxs,
- gs_font * pfont, op_proc_t *exec_cont)
+ gs_font * pfont, op_proc_t *exec_cont)
{
os_ptr op = osp;
gs_type1_state *const pcis = &pcxs->cis;
gs_font_base *const pbfont = (gs_font_base *) pfont;
op_proc_t cont = (pbfont->PaintType == 0 && penum->orig_font->PaintType == 0
- ? bbox_finish_fill : bbox_finish_stroke);
+ ? bbox_finish_fill : bbox_finish_stroke);
ref *pcdevproc;
-
/*
* We appear to have a valid bounding box. If we don't have Metrics for
* this character, start interpreting the CharString; do the
* setcachedevice as soon as we know the (side bearing and) width.
*/
if ((pcxs->present == metricsNone && !pcxs->use_FontBBox_as_Metrics2) ||
- (penum->orig_font->WMode && zchar_get_CDevProc(pbfont, &pcdevproc))) {
- /* Get the width from the CharString,
- * then set the cache device. */
- /* We pass here when WMode==1 and the font has CDevProc,
- * because we do need sbw as CDevProc's argument.
- * A more natural way would be not setting pcxs->use_FontBBox_as_Metrics2
- * when the font has CDevProc, except for missing sbw in the glyph.
- * We prefer to pass here because we've got examples
- * of Tyoe 1 fonts with empty glyphs, i.e. with no sbw,
- * so we don't want to assume that they'll never appear in a CID font.
- * In that case penum->FontBBox_as_Metrics2 will go here to zchar_set_cache. */
- ref cnref;
- ref other_subr;
- int code;
-
- /* Since an OtherSubr callout might change osp, */
- /* save the character name now. */
- ref_assign(&cnref, op - 1);
- code = type1_continue_dispatch(i_ctx_p, pcxs, op, &other_subr, 4);
- op = osp; /* OtherSubrs might change it */
- switch (code) {
- default: /* code < 0 or done, error */
- return ((code < 0 ? code :
- gs_note_error(e_invalidfont)));
- case type1_result_callothersubr: /* unknown OtherSubr */
- return type1_call_OtherSubr(i_ctx_p, pcxs,
- bbox_getsbw_continue,
- &other_subr);
- case type1_result_sbw: /* [h]sbw, done */
- break;
- }
- type1_cis_get_metrics(pcis, pcxs->sbw);
- return zchar_set_cache(i_ctx_p, pbfont, &cnref,
- NULL, pcxs->sbw + 2,
- &pcxs->char_bbox,
- cont, exec_cont, NULL);
+ (penum->orig_font->WMode && zchar_get_CDevProc(pbfont, &pcdevproc))) {
+ /* Get the width from the CharString,
+ * then set the cache device. */
+ /* We pass here when WMode==1 and the font has CDevProc,
+ * because we do need sbw as CDevProc's argument.
+ * A more natural way would be not setting pcxs->use_FontBBox_as_Metrics2
+ * when the font has CDevProc, except for missing sbw in the glyph.
+ * We prefer to pass here because we've got examples
+ * of Tyoe 1 fonts with empty glyphs, i.e. with no sbw,
+ * so we don't want to assume that they'll never appear in a CID font.
+ * In that case penum->FontBBox_as_Metrics2 will go here to zchar_set_cache. */
+ ref cnref;
+ ref other_subr;
+ int code;
+
+ /* Since an OtherSubr callout might change osp, */
+ /* save the character name now. */
+ ref_assign(&cnref, op - 1);
+ code = type1_continue_dispatch(i_ctx_p, pcxs, op, &other_subr, 4);
+ op = osp; /* OtherSubrs might change it */
+ switch (code) {
+ default: /* code < 0 or done, error */
+ return ((code < 0 ? code :
+ gs_note_error(e_invalidfont)));
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return type1_call_OtherSubr(i_ctx_p, pcxs,
+ bbox_getsbw_continue,
+ &other_subr);
+ case type1_result_sbw: /* [h]sbw, done */
+ break;
+ }
+ type1_cis_get_metrics(pcis, pcxs->sbw);
+ return zchar_set_cache(i_ctx_p, pbfont, &cnref,
+ NULL, pcxs->sbw + 2,
+ &pcxs->char_bbox,
+ cont, exec_cont, NULL);
} else {
- /* We have the width and bounding box: */
- /* set up the cache device now. */
- return zchar_set_cache(i_ctx_p, pbfont, op - 1,
- (pcxs->present == metricsSideBearingAndWidth
- && !pcxs->use_FontBBox_as_Metrics2 ?
- pcxs->sbw : NULL),
- pcxs->sbw + 2,
- &pcxs->char_bbox,
- cont, exec_cont,
- (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
+ /* We have the width and bounding box: */
+ /* set up the cache device now. */
+ return zchar_set_cache(i_ctx_p, pbfont, op - 1,
+ (pcxs->present == metricsSideBearingAndWidth
+ && !pcxs->use_FontBBox_as_Metrics2 ?
+ pcxs->sbw : NULL),
+ pcxs->sbw + 2,
+ &pcxs->char_bbox,
+ cont, exec_cont,
+ (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
}
}
@@ -449,29 +448,29 @@ bbox_getsbw_continue(i_ctx_t *i_ctx_p)
code = type1_continue_dispatch(i_ctx_p, pcxs, NULL, &other_subr, 4);
op = osp; /* in case z1_push/pop_proc was called */
switch (code) {
- default: /* code < 0 or done, error */
- op_type1_free(i_ctx_p);
- return ((code < 0 ? code : gs_note_error(e_invalidfont)));
- case type1_result_callothersubr: /* unknown OtherSubr */
- return type1_push_OtherSubr(i_ctx_p, pcxs, bbox_getsbw_continue,
- &other_subr);
- case type1_result_sbw: { /* [h]sbw, done */
- double sbw[4];
- const gs_font_base *const pbfont =
- (const gs_font_base *)pcis->pfont;
- gs_rect bbox;
- op_proc_t cont = (pbfont->PaintType == 0 ? bbox_finish_fill : bbox_finish_stroke), exec_cont = 0;
-
- /* Get the metrics before freeing the state. */
- type1_cis_get_metrics(pcis, sbw);
- bbox = pcxs->char_bbox;
- op_type1_free(i_ctx_p);
- code = zchar_set_cache(i_ctx_p, pbfont, op - 1, sbw, sbw + 2, &bbox,
- cont, &exec_cont, NULL);
- if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
- return code;
- }
+ default: /* code < 0 or done, error */
+ op_type1_free(i_ctx_p);
+ return ((code < 0 ? code : gs_note_error(e_invalidfont)));
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return type1_push_OtherSubr(i_ctx_p, pcxs, bbox_getsbw_continue,
+ &other_subr);
+ case type1_result_sbw: { /* [h]sbw, done */
+ double sbw[4];
+ const gs_font_base *const pbfont =
+ (const gs_font_base *)pcis->pfont;
+ gs_rect bbox;
+ op_proc_t cont = (pbfont->PaintType == 0 ? bbox_finish_fill : bbox_finish_stroke), exec_cont = 0;
+
+ /* Get the metrics before freeing the state. */
+ type1_cis_get_metrics(pcis, sbw);
+ bbox = pcxs->char_bbox;
+ op_type1_free(i_ctx_p);
+ code = zchar_set_cache(i_ctx_p, pbfont, op - 1, sbw, sbw + 2, &bbox,
+ cont, &exec_cont, NULL);
+ if (code >= 0 && exec_cont != 0)
+ code = (*exec_cont)(i_ctx_p);
+ return code;
+ }
}
}
@@ -486,7 +485,7 @@ bbox_finish_fill(i_ctx_t *i_ctx_p)
code = bbox_finish(i_ctx_p, bbox_fill, &exec_cont);
if (code >= 0 && exec_cont != 0)
- code = exec_cont(i_ctx_p);
+ code = exec_cont(i_ctx_p);
return code;
}
static int
@@ -497,7 +496,7 @@ bbox_finish_stroke(i_ctx_t *i_ctx_p)
code = bbox_finish(i_ctx_p, bbox_stroke, &exec_cont);
if (code >= 0 && exec_cont != 0)
- code = exec_cont(i_ctx_p);
+ code = exec_cont(i_ctx_p);
return code;
}
@@ -518,55 +517,55 @@ bbox_finish(i_ctx_t *i_ctx_p, op_proc_t cont, op_proc_t *exec_cont)
ref other_subr;
if (!r_has_type(opc, t_string)) {
- check_op(3);
- code = num_params(op, 2, sbxy);
- if (code < 0)
- return code;
- sbpt.x = sbxy[0];
- sbpt.y = sbxy[1];
- psbpt = &sbpt;
- opc -= 2;
- check_type(*opc, t_string);
+ check_op(3);
+ code = num_params(op, 2, sbxy);
+ if (code < 0)
+ return code;
+ sbpt.x = sbxy[0];
+ sbpt.y = sbxy[1];
+ psbpt = &sbpt;
+ opc -= 2;
+ check_type(*opc, t_string);
}
code = font_param(opc - 3, &pfont);
if (code < 0)
- return code;
+ return code;
if (penum == 0 || !font_uses_charstrings(pfont))
- return_error(e_undefined);
+ return_error(e_undefined);
{
- gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
- int lenIV = pfont1->data.lenIV;
-
- if (lenIV > 0 && r_size(opc) <= lenIV)
- return_error(e_invalidfont);
- check_estack(5); /* in case we need to do a callout */
- code = type1_exec_init(pcis, penum, igs, pfont1);
- if (code < 0)
- return code;
- if (psbpt)
- gs_type1_set_lsb(pcis, psbpt);
+ gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
+ int lenIV = pfont1->data.lenIV;
+
+ if (lenIV > 0 && r_size(opc) <= lenIV)
+ return_error(e_invalidfont);
+ check_estack(5); /* in case we need to do a callout */
+ code = type1_exec_init(pcis, penum, igs, pfont1);
+ if (code < 0)
+ return code;
+ if (psbpt)
+ gs_type1_set_lsb(pcis, psbpt);
}
opstr = opc;
icont:
code = type1_continue_dispatch(i_ctx_p, &cxs, opstr, &other_subr,
- (psbpt ? 6 : 4));
+ (psbpt ? 6 : 4));
op = osp; /* OtherSubrs might have altered it */
switch (code) {
- case 0: /* all done */
- /* Call the continuation now. */
- if (psbpt)
- pop(2);
- *exec_cont = cont;
- return 0;
- case type1_result_callothersubr: /* unknown OtherSubr */
- push_op_estack(cont); /* call later */
- return type1_call_OtherSubr(i_ctx_p, &cxs, bbox_continue,
- &other_subr);
- case type1_result_sbw: /* [h]sbw, just continue */
- opstr = 0;
- goto icont;
- default: /* code < 0, error */
- return code;
+ case 0: /* all done */
+ /* Call the continuation now. */
+ if (psbpt)
+ pop(2);
+ *exec_cont = cont;
+ return 0;
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ push_op_estack(cont); /* call later */
+ return type1_call_OtherSubr(i_ctx_p, &cxs, bbox_continue,
+ &other_subr);
+ case type1_result_sbw: /* [h]sbw, just continue */
+ opstr = 0;
+ goto icont;
+ default: /* code < 0, error */
+ return code;
}
}
@@ -578,11 +577,11 @@ bbox_continue(i_ctx_t *i_ctx_p)
int code = type1_callout_dispatch(i_ctx_p, bbox_continue, npop);
if (code == 0) {
- op = osp; /* OtherSubrs might have altered it */
- npop -= 4; /* nobbox_fill/stroke handles the rest */
- pop(npop);
- op -= npop;
- op_type1_free(i_ctx_p);
+ op = osp; /* OtherSubrs might have altered it */
+ npop -= 4; /* nobbox_fill/stroke handles the rest */
+ pop(npop);
+ op -= npop;
+ op_type1_free(i_ctx_p);
}
return code;
}
@@ -605,58 +604,58 @@ bbox_draw(i_ctx_t *i_ctx_p, int (*draw)(gs_state *), op_proc_t *exec_cont)
int code;
if (igs->in_cachedevice < 2) /* not caching */
- return nobbox_draw(i_ctx_p, draw);
+ return nobbox_draw(i_ctx_p, draw);
if ((code = font_param(op - 3, &pfont)) < 0)
- return code;
+ return code;
penum = op_show_find(i_ctx_p);
if (penum == 0 || !font_uses_charstrings(pfont))
- return_error(e_undefined);
+ return_error(e_undefined);
if ((code = gs_pathbbox(igs, &bbox)) < 0) {
- /*
- * If the matrix is singular, all user coordinates map onto a
- * straight line. Don't bother rendering the character at all.
- */
- if (code == e_undefinedresult) {
- pop(4);
- gs_newpath(igs);
- return 0;
- }
- return code;
+ /*
+ * If the matrix is singular, all user coordinates map onto a
+ * straight line. Don't bother rendering the character at all.
+ */
+ if (code == e_undefinedresult) {
+ pop(4);
+ gs_newpath(igs);
+ return 0;
+ }
+ return code;
}
if (draw == gs_stroke) {
- /* Expand the bounding box by the line width. */
- float width = gs_currentlinewidth(igs) * 1.41422;
+ /* Expand the bounding box by the line width. */
+ float width = gs_currentlinewidth(igs) * 1.41422;
- bbox.p.x -= width, bbox.p.y -= width;
- bbox.q.x += width, bbox.q.y += width;
+ bbox.p.x -= width, bbox.p.y -= width;
+ bbox.q.x += width, bbox.q.y += width;
}
pbfont = (gs_font_base *)pfont;
if (rect_within(bbox, pbfont->FontBBox)) /* within bounds */
- return nobbox_draw(i_ctx_p, draw);
+ return nobbox_draw(i_ctx_p, draw);
/* Enlarge the FontBBox to save work in the future. */
rect_merge(pbfont->FontBBox, bbox);
/* Dismantle everything we've done, and start over. */
gs_text_retry(penum);
pfont1 = (gs_font_type1 *) pfont;
if ((penum->FontBBox_as_Metrics2.x == 0 &&
- penum->FontBBox_as_Metrics2.y == 0) ||
- gs_rootfont(igs)->WMode == 0 ) {
- code = zchar_get_metrics(pbfont, op - 1, cxs.sbw);
- if (code < 0)
- return code;
- cxs.present = code;
- cxs.use_FontBBox_as_Metrics2 = false;
+ penum->FontBBox_as_Metrics2.y == 0) ||
+ gs_rootfont(igs)->WMode == 0 ) {
+ code = zchar_get_metrics(pbfont, op - 1, cxs.sbw);
+ if (code < 0)
+ return code;
+ cxs.present = code;
+ cxs.use_FontBBox_as_Metrics2 = false;
} else {
- cxs.sbw[0] = penum->FontBBox_as_Metrics2.x / 2;
- cxs.sbw[1] = penum->FontBBox_as_Metrics2.y;
- cxs.sbw[2] = 0;
- cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
- cxs.use_FontBBox_as_Metrics2 = true;
- cxs.present = metricsSideBearingAndWidth;
+ cxs.sbw[0] = penum->FontBBox_as_Metrics2.x / 2;
+ cxs.sbw[1] = penum->FontBBox_as_Metrics2.y;
+ cxs.sbw[2] = 0;
+ cxs.sbw[3] = -penum->FontBBox_as_Metrics2.x; /* Sic! */
+ cxs.use_FontBBox_as_Metrics2 = true;
+ cxs.present = metricsSideBearingAndWidth;
}
code = type1_exec_init(&cxs.cis, penum, igs, pfont1);
if (code < 0)
- return code;
+ return code;
cxs.char_bbox = pfont1->FontBBox;
code = type1exec_bbox(i_ctx_p, penum, &cxs, pfont, exec_cont);
return code;
@@ -670,7 +669,7 @@ bbox_fill(i_ctx_t *i_ctx_p)
/* See above re GS_CHAR_FILL. */
code = bbox_draw(i_ctx_p, GS_CHAR_FILL, &exec_cont);
if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
+ code = (*exec_cont)(i_ctx_p);
return code;
}
static int
@@ -681,7 +680,7 @@ bbox_stroke(i_ctx_t *i_ctx_p)
code = bbox_draw(i_ctx_p, gs_stroke, &exec_cont);
if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
+ code = (*exec_cont)(i_ctx_p);
return code;
}
@@ -691,7 +690,7 @@ bbox_stroke(i_ctx_t *i_ctx_p)
/* pcref points to a t_string ref. */
static int
type1_continue_dispatch(i_ctx_t *i_ctx_p, gs_type1exec_state *pcxs,
- const ref * pcref, ref *pos, int num_args)
+ const ref * pcref, ref *pos, int num_args)
{
int value;
int code;
@@ -700,11 +699,11 @@ type1_continue_dispatch(i_ctx_t *i_ctx_p, gs_type1exec_state *pcxs,
cs_data.memory = imemory;
if (pcref == 0) {
- pcsd = 0;
+ pcsd = 0;
} else {
- gs_glyph_data_from_string(&cs_data, pcref->value.const_bytes,
- r_size(pcref), NULL);
- pcsd = &cs_data;
+ gs_glyph_data_from_string(&cs_data, pcref->value.const_bytes,
+ r_size(pcref), NULL);
+ pcsd = &cs_data;
}
/*
* Since OtherSubrs may push or pop values on the PostScript operand
@@ -720,17 +719,17 @@ type1_continue_dispatch(i_ctx_t *i_ctx_p, gs_type1exec_state *pcxs,
gs_type1_set_callback_data(&pcxs->cis, pcxs);
code = pcxs->cis.pfont->data.interpret(&pcxs->cis, pcsd, &value);
switch (code) {
- case type1_result_callothersubr: {
- /*
- * The Type 1 interpreter handles all known OtherSubrs,
- * so this must be an unknown one.
- */
- const font_data *pfdata = pfont_data(gs_currentfont(igs));
-
- code = array_get(imemory, &pfdata->u.type1.OtherSubrs, (long)value, pos);
- if (code >= 0)
- return type1_result_callothersubr;
- }
+ case type1_result_callothersubr: {
+ /*
+ * The Type 1 interpreter handles all known OtherSubrs,
+ * so this must be an unknown one.
+ */
+ const font_data *pfdata = pfont_data(gs_currentfont(igs));
+
+ code = array_get(imemory, &pfdata->u.type1.OtherSubrs, (long)value, pos);
+ if (code >= 0)
+ return type1_result_callothersubr;
+ }
}
/* Put back the arguments removed above. */
memcpy(osp + 1, pcxs->save_args, num_args * sizeof(ref));
@@ -744,7 +743,7 @@ type1_continue_dispatch(i_ctx_t *i_ctx_p, gs_type1exec_state *pcxs,
*/
static int
type1_push_OtherSubr(i_ctx_t *i_ctx_p, const gs_type1exec_state *pcxs,
- int (*cont)(i_ctx_t *), const ref *pos)
+ int (*cont)(i_ctx_t *), const ref *pos)
{
int i, n = pcxs->num_args;
@@ -754,8 +753,8 @@ type1_push_OtherSubr(i_ctx_t *i_ctx_p, const gs_type1exec_state *pcxs,
* back on the operand stack in the correct order) on the e-stack.
*/
for (i = n; --i >= 0; ) {
- *++esp = pcxs->save_args[i];
- r_clear_attrs(esp, a_executable); /* just in case */
+ *++esp = pcxs->save_args[i];
+ r_clear_attrs(esp, a_executable); /* just in case */
}
++esp;
*esp = *pos;
@@ -768,16 +767,16 @@ type1_push_OtherSubr(i_ctx_t *i_ctx_p, const gs_type1exec_state *pcxs,
*/
static int
type1_call_OtherSubr(i_ctx_t *i_ctx_p, const gs_type1exec_state * pcxs,
- int (*cont) (i_ctx_t *),
- const ref * pos)
+ int (*cont) (i_ctx_t *),
+ const ref * pos)
{
/* Move the Type 1 interpreter state to the heap. */
gs_type1exec_state *hpcxs =
- ialloc_struct(gs_type1exec_state, &st_gs_type1exec_state,
- "type1_call_OtherSubr");
+ ialloc_struct(gs_type1exec_state, &st_gs_type1exec_state,
+ "type1_call_OtherSubr");
if (hpcxs == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
*hpcxs = *pcxs;
gs_type1_set_callback_data(&hpcxs->cis, hpcxs);
push_mark_estack(es_show, op_type1_cleanup);
@@ -789,7 +788,7 @@ type1_call_OtherSubr(i_ctx_t *i_ctx_p, const gs_type1exec_state * pcxs,
/* Continue from an OtherSubr callout while building the path. */
static int
type1_callout_dispatch(i_ctx_t *i_ctx_p, int (*cont)(i_ctx_t *),
- int num_args)
+ int num_args)
{
ref other_subr;
gs_type1exec_state *pcxs = r_ptr(esp, gs_type1exec_state);
@@ -797,17 +796,17 @@ type1_callout_dispatch(i_ctx_t *i_ctx_p, int (*cont)(i_ctx_t *),
icont:
code = type1_continue_dispatch(i_ctx_p, pcxs, NULL, &other_subr,
- num_args);
+ num_args);
switch (code) {
- case 0: /* callout done, cont is on e-stack */
- return 0;
- default: /* code < 0 or done, error */
- op_type1_free(i_ctx_p);
- return ((code < 0 ? code : gs_note_error(e_invalidfont)));
- case type1_result_callothersubr: /* unknown OtherSubr */
- return type1_push_OtherSubr(i_ctx_p, pcxs, cont, &other_subr);
- case type1_result_sbw: /* [h]sbw, just continue */
- goto icont;
+ case 0: /* callout done, cont is on e-stack */
+ return 0;
+ default: /* code < 0 or done, error */
+ op_type1_free(i_ctx_p);
+ return ((code < 0 ? code : gs_note_error(e_invalidfont)));
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return type1_push_OtherSubr(i_ctx_p, pcxs, cont, &other_subr);
+ case type1_result_sbw: /* [h]sbw, just continue */
+ goto icont;
}
}
@@ -840,15 +839,15 @@ nobbox_continue(i_ctx_t *i_ctx_p)
int code = type1_callout_dispatch(i_ctx_p, nobbox_continue, 4);
if (code)
- return code;
+ return code;
{
- gs_type1exec_state *pcxs = r_ptr(esp, gs_type1exec_state);
- gs_type1exec_state cxs;
+ gs_type1exec_state *pcxs = r_ptr(esp, gs_type1exec_state);
+ gs_type1exec_state cxs;
- cxs = *pcxs;
- gs_type1_set_callback_data(&cxs.cis, &cxs);
- op_type1_free(i_ctx_p);
- return nobbox_finish(i_ctx_p, &cxs);
+ cxs = *pcxs;
+ gs_type1_set_callback_data(&cxs.cis, &cxs);
+ op_type1_free(i_ctx_p);
+ return nobbox_finish(i_ctx_p, &cxs);
}
}
@@ -864,49 +863,49 @@ nobbox_finish(i_ctx_t *i_ctx_p, gs_type1exec_state * pcxs)
gs_font *pfont;
if ((code = gs_pathbbox(igs, &pcxs->char_bbox)) < 0 ||
- (code = font_param(op - 3, &pfont)) < 0
- )
- return code;
+ (code = font_param(op - 3, &pfont)) < 0
+ )
+ return code;
if (penum == 0 || !font_uses_charstrings(pfont))
- return_error(e_undefined);
+ return_error(e_undefined);
{
- gs_font_base *const pbfont = (gs_font_base *) pfont;
- gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
- op_proc_t cont, exec_cont = 0;
-
- if (pcxs->present == metricsNone) {
- gs_point endpt;
-
- if ((code = gs_currentpoint(igs, &endpt)) < 0)
- return code;
- pcxs->sbw[2] = endpt.x, pcxs->sbw[3] = endpt.y;
- pcxs->present = metricsSideBearingAndWidth;
- }
- /*
- * We only need to rebuild the path from scratch if we might
- * oversample for anti-aliasing.
- */
- if ((*dev_proc(igs->device, get_alpha_bits))(igs->device, go_text) > 1
- ) {
- gs_newpath(igs);
- gs_moveto(igs, 0.0, 0.0);
- code = type1_exec_init(&pcxs->cis, penum, igs, pfont1);
- if (code < 0)
- return code;
- code = type1exec_bbox(i_ctx_p, penum, pcxs, pfont, &exec_cont);
- } else {
- cont = (pbfont->PaintType == 0 && penum->orig_font->PaintType == 0
- ? nobbox_fill : nobbox_stroke);
- exec_cont = 0;
- code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
- pcxs->sbw + 2,
- &pcxs->char_bbox,
- cont, &exec_cont,
- (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
- }
- if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
- return code;
+ gs_font_base *const pbfont = (gs_font_base *) pfont;
+ gs_font_type1 *const pfont1 = (gs_font_type1 *) pfont;
+ op_proc_t cont, exec_cont = 0;
+
+ if (pcxs->present == metricsNone) {
+ gs_point endpt;
+
+ if ((code = gs_currentpoint(igs, &endpt)) < 0)
+ return code;
+ pcxs->sbw[2] = endpt.x, pcxs->sbw[3] = endpt.y;
+ pcxs->present = metricsSideBearingAndWidth;
+ }
+ /*
+ * We only need to rebuild the path from scratch if we might
+ * oversample for anti-aliasing.
+ */
+ if ((*dev_proc(igs->device, get_alpha_bits))(igs->device, go_text) > 1
+ ) {
+ gs_newpath(igs);
+ gs_moveto(igs, 0.0, 0.0);
+ code = type1_exec_init(&pcxs->cis, penum, igs, pfont1);
+ if (code < 0)
+ return code;
+ code = type1exec_bbox(i_ctx_p, penum, pcxs, pfont, &exec_cont);
+ } else {
+ cont = (pbfont->PaintType == 0 && penum->orig_font->PaintType == 0
+ ? nobbox_fill : nobbox_stroke);
+ exec_cont = 0;
+ code = zchar_set_cache(i_ctx_p, pbfont, op - 1, NULL,
+ pcxs->sbw + 2,
+ &pcxs->char_bbox,
+ cont, &exec_cont,
+ (pcxs->use_FontBBox_as_Metrics2 ? pcxs->sbw : NULL));
+ }
+ if (code >= 0 && exec_cont != 0)
+ code = (*exec_cont)(i_ctx_p);
+ return code;
}
}
/* Finish by popping the operands and filling or stroking. */
@@ -916,7 +915,7 @@ nobbox_draw(i_ctx_t *i_ctx_p, int (*draw)(gs_state *))
int code = draw(igs);
if (code >= 0)
- pop(4);
+ pop(4);
return code;
}
static int
@@ -950,19 +949,19 @@ zsetweightvector(i_ctx_t *i_ctx_p)
int size;
if (code < 0) {
- /* The font was not defined yet. Just ignore. See lib/gs_type1.ps . */
- pop(2);
- return 0;
+ /* The font was not defined yet. Just ignore. See lib/gs_type1.ps . */
+ pop(2);
+ return 0;
}
if (pfont->FontType != ft_encrypted && pfont->FontType != ft_encrypted2)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
pfont1 = (gs_font_type1 *)pfont;
size = r_size(op);
if (size != pfont1->data.WeightVector.count)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
code = process_float_array(imemory, op, size, pfont1->data.WeightVector.values);
if (code < 0)
- return code;
+ return code;
pop(2);
return 0;
}
@@ -972,7 +971,7 @@ zsetweightvector(i_ctx_t *i_ctx_p)
const op_def zchar1_op_defs[] =
{
{"4.type1execchar", ztype1execchar},
- /* Internal operators */
+ /* Internal operators */
{"4%bbox_getsbw_continue", bbox_getsbw_continue},
{"4%bbox_continue", bbox_continue},
{"4%bbox_finish_fill", bbox_finish_fill},
@@ -997,42 +996,42 @@ z1_glyph_data(gs_font_type1 * pfont, gs_glyph glyph, gs_glyph_data_t *pgd)
static int
z1_subr_data(gs_font_type1 * pfont, int index, bool global,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
const font_data *pfdata = pfont_data(pfont);
ref subr;
int code;
code = array_get(pfont->memory, (global ? &pfdata->u.type1.GlobalSubrs :
- &pfdata->u.type1.Subrs),
- index, &subr);
+ &pfdata->u.type1.Subrs),
+ index, &subr);
if (code < 0)
- return code;
+ return code;
check_type_only(subr, t_string);
gs_glyph_data_from_string(pgd, subr.value.const_bytes, r_size(&subr),
- NULL);
+ NULL);
return 0;
}
static int
z1_seac_data(gs_font_type1 *pfont, int ccode, gs_glyph *pglyph,
- gs_const_string *gstr, gs_glyph_data_t *pgd)
+ gs_const_string *gstr, gs_glyph_data_t *pgd)
{
gs_glyph glyph = gs_c_known_encode((gs_char)ccode,
- ENCODING_INDEX_STANDARD);
+ ENCODING_INDEX_STANDARD);
int code;
ref rglyph;
if (glyph == GS_NO_GLYPH)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if ((code = gs_c_glyph_name(glyph, gstr)) < 0 ||
- (code = name_ref(pfont->memory, gstr->data, gstr->size, &rglyph, 0)) < 0
- )
- return code;
+ (code = name_ref(pfont->memory, gstr->data, gstr->size, &rglyph, 0)) < 0
+ )
+ return code;
if (pglyph)
- *pglyph = name_index(pfont->memory, &rglyph);
+ *pglyph = name_index(pfont->memory, &rglyph);
if (pgd)
- code = zchar_charstring_data((gs_font *)pfont, &rglyph, pgd);
+ code = zchar_charstring_data((gs_font *)pfont, &rglyph, pgd);
return code;
}
@@ -1046,8 +1045,8 @@ z1_push(void *callback_data, const fixed * pf, int count)
check_ostack(count);
for (i = 0; i < count; i++, p--) {
- osp++;
- make_real(osp, fixed2float(*p));
+ osp++;
+ make_real(osp, fixed2float(*p));
}
return 0;
}
@@ -1061,7 +1060,7 @@ z1_pop(void *callback_data, fixed * pf)
int code = real_param(osp, &val);
if (code < 0)
- return code;
+ return code;
*pf = float2fixed(val);
osp--;
return 0;
@@ -1080,7 +1079,7 @@ const gs_type1_data_procs_t z1_data_procs = {
*/
int
zchar1_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
gs_font_type1 *const pfont1 = (gs_font_type1 *)font;
ref gref;
@@ -1091,7 +1090,7 @@ zchar1_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *
gdata.memory = font->memory;
code = zchar_charstring_data(font, &gref, &gdata);
if (code < 0)
- return code;
+ return code;
return zcharstring_outline(pfont1, WMode, &gref, &gdata, pmat, ppath, sbw);
}
/*
@@ -1100,8 +1099,8 @@ zchar1_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *
*/
int
zcharstring_outline(gs_font_type1 *pfont1, int WMode, const ref *pgref,
- const gs_glyph_data_t *pgd_orig,
- const gs_matrix *pmat, gx_path *ppath, double sbw[4])
+ const gs_glyph_data_t *pgd_orig,
+ const gs_matrix *pmat, gx_path *ppath, double sbw[4])
{
const gs_glyph_data_t *pgd = pgd_orig;
int code;
@@ -1115,70 +1114,70 @@ zcharstring_outline(gs_font_type1 *pfont1, int WMode, const ref *pgref,
pdata = &pfont1->data;
if (pgd->bits.size <= max(pdata->lenIV, 0))
- return_error(e_invalidfont);
-#if 0 /* Ignore CDevProc for now. */
+ return_error(e_invalidfont);
+#if 0 /* Ignore CDevProc for now. */
if (zchar_get_CDevProc((const gs_font_base *)pfont1, &pcdevproc))
- return_error(e_rangecheck); /* can't call CDevProc from here */
+ return_error(e_rangecheck); /* can't call CDevProc from here */
#endif
switch (WMode) {
default:
- code = zchar_get_metrics2((gs_font_base *)pfont1, pgref, wv);
- if (code) {
- sbw[0] = wv[2];
- sbw[1] = wv[3];
- sbw[2] = wv[0];
- sbw[3] = wv[1];
- break;
- }
- /* falls through */
+ code = zchar_get_metrics2((gs_font_base *)pfont1, pgref, wv);
+ if (code) {
+ sbw[0] = wv[2];
+ sbw[1] = wv[3];
+ sbw[2] = wv[0];
+ sbw[3] = wv[1];
+ break;
+ }
+ /* falls through */
case 0:
- code = zchar_get_metrics((gs_font_base *)pfont1, pgref, sbw);
+ code = zchar_get_metrics((gs_font_base *)pfont1, pgref, sbw);
}
if (code < 0)
- return code;
+ return code;
cxs.present = code;
/* Initialize just enough of the imager state. */
if (pmat)
- gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
+ gs_matrix_fixed_from_matrix(&gis.ctm, pmat);
else {
- gs_matrix imat;
+ gs_matrix imat;
- gs_make_identity(&imat);
- gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
+ gs_make_identity(&imat);
+ gs_matrix_fixed_from_matrix(&gis.ctm, &imat);
}
gis.flatness = 0;
code = gs_type1_interp_init(&cxs.cis, &gis, ppath, NULL, NULL, true, 0,
- pfont1);
+ pfont1);
if (code < 0)
- return code;
+ return code;
cxs.cis.no_grid_fitting = true;
gs_type1_set_callback_data(pcis, &cxs);
switch (cxs.present) {
case metricsSideBearingAndWidth:
- mpt.x = sbw[0], mpt.y = sbw[1];
- gs_type1_set_lsb(pcis, &mpt);
- /* falls through */
+ mpt.x = sbw[0], mpt.y = sbw[1];
+ gs_type1_set_lsb(pcis, &mpt);
+ /* falls through */
case metricsWidthOnly:
- mpt.x = sbw[2], mpt.y = sbw[3];
- gs_type1_set_width(pcis, &mpt);
+ mpt.x = sbw[2], mpt.y = sbw[3];
+ gs_type1_set_width(pcis, &mpt);
case metricsNone:
- ;
+ ;
}
/* Continue interpreting. */
icont:
code = pfont1->data.interpret(pcis, pgd, &value);
switch (code) {
case 0: /* all done */
- /* falls through */
+ /* falls through */
default: /* code < 0, error */
- return code;
+ return code;
case type1_result_callothersubr: /* unknown OtherSubr */
- return_error(e_rangecheck); /* can't handle it */
+ return_error(e_rangecheck); /* can't handle it */
case type1_result_sbw: /* [h]sbw, just continue */
- type1_cis_get_metrics(pcis, cxs.sbw);
- type1_cis_get_metrics(pcis, sbw);
- pgd = 0;
- goto icont;
+ type1_cis_get_metrics(pcis, cxs.sbw);
+ type1_cis_get_metrics(pcis, sbw);
+ pgd = 0;
+ goto icont;
}
}
@@ -1189,7 +1188,7 @@ icont:
*/
int
z1_glyph_info_generic(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info, font_proc_glyph_info((*proc)), int wmode)
+ int members, gs_glyph_info_t *info, font_proc_glyph_info((*proc)), int wmode)
{
ref gref;
ref *pcdevproc;
@@ -1197,90 +1196,90 @@ z1_glyph_info_generic(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
int width_members = members & (GLYPH_INFO_WIDTH0 << wmode);
int outline_widths = members & GLYPH_INFO_OUTLINE_WIDTHS;
bool modified_widths = false;
- int default_members = members & ~(width_members + outline_widths +
- GLYPH_INFO_VVECTOR0 + GLYPH_INFO_VVECTOR1 +
- GLYPH_INFO_CDEVPROC);
+ int default_members = members & ~(width_members + outline_widths +
+ GLYPH_INFO_VVECTOR0 + GLYPH_INFO_VVECTOR1 +
+ GLYPH_INFO_CDEVPROC);
int done_members = 0;
int code;
if (!width_members)
- return (*proc)(font, glyph, pmat, members, info);
+ return (*proc)(font, glyph, pmat, members, info);
if (!outline_widths && zchar_get_CDevProc(pbfont, &pcdevproc)) {
- done_members |= GLYPH_INFO_CDEVPROC;
- if (members & GLYPH_INFO_CDEVPROC) {
- info->members = done_members;
- return_error(e_rangecheck);
- } else {
- /* Ignore CDevProc. Used to compure MissingWidth.*/
- }
+ done_members |= GLYPH_INFO_CDEVPROC;
+ if (members & GLYPH_INFO_CDEVPROC) {
+ info->members = done_members;
+ return_error(e_rangecheck);
+ } else {
+ /* Ignore CDevProc. Used to compure MissingWidth.*/
+ }
}
glyph_ref(pbfont->memory, glyph, &gref);
if (width_members == GLYPH_INFO_WIDTH1) {
- double wv[4];
- code = zchar_get_metrics2(pbfont, &gref, wv);
- if (code > 0) {
- modified_widths = true;
- info->width[1].x = wv[0];
- info->width[1].y = wv[1];
- info->v.x = wv[2];
- info->v.y = wv[3];
- done_members = width_members | GLYPH_INFO_VVECTOR1;
- width_members = 0;
- }
+ double wv[4];
+ code = zchar_get_metrics2(pbfont, &gref, wv);
+ if (code > 0) {
+ modified_widths = true;
+ info->width[1].x = wv[0];
+ info->width[1].y = wv[1];
+ info->v.x = wv[2];
+ info->v.y = wv[3];
+ done_members = width_members | GLYPH_INFO_VVECTOR1;
+ width_members = 0;
+ }
}
if (width_members) {
- double sbw[4];
- code = zchar_get_metrics(pbfont, &gref, sbw);
- if (code > 0) {
- modified_widths = true;
- info->width[wmode].x = sbw[2];
- info->width[wmode].y = sbw[3];
- if (code == metricsSideBearingAndWidth) {
- info->v.x = sbw[0];
- info->v.y = sbw[1];
- width_members |= GLYPH_INFO_VVECTOR0;
- } else {
- info->v.x = 0;
- info->v.y = 0;
- }
- done_members = width_members;
- width_members = 0;
- }
+ double sbw[4];
+ code = zchar_get_metrics(pbfont, &gref, sbw);
+ if (code > 0) {
+ modified_widths = true;
+ info->width[wmode].x = sbw[2];
+ info->width[wmode].y = sbw[3];
+ if (code == metricsSideBearingAndWidth) {
+ info->v.x = sbw[0];
+ info->v.y = sbw[1];
+ width_members |= GLYPH_INFO_VVECTOR0;
+ } else {
+ info->v.x = 0;
+ info->v.y = 0;
+ }
+ done_members = width_members;
+ width_members = 0;
+ }
}
if (outline_widths) {
- if (modified_widths || zchar_get_CDevProc(pbfont, &pcdevproc)) {
- /* Discard the modified widths, but indicate they exist. */
- width_members |= done_members;
- done_members = outline_widths;
- }
+ if (modified_widths || zchar_get_CDevProc(pbfont, &pcdevproc)) {
+ /* Discard the modified widths, but indicate they exist. */
+ width_members |= done_members;
+ done_members = outline_widths;
+ }
}
default_members |= width_members;
if (default_members) {
- code = (*proc)(font, glyph, pmat, default_members, info);
+ code = (*proc)(font, glyph, pmat, default_members, info);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
} else
- info->members = 0;
+ info->members = 0;
info->members |= done_members;
return 0;
}
int
z1_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
int wmode = font->WMode;
- return z1_glyph_info_generic(font, glyph, pmat, members, info,
- &gs_type1_glyph_info, wmode);
+ return z1_glyph_info_generic(font, glyph, pmat, members, info,
+ &gs_type1_glyph_info, wmode);
}
/* Get a Type 1 or Type 9 character metrics and set the cache device. */
int
-z1_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
- gs_glyph glyph, op_proc_t cont, op_proc_t *exec_cont)
+z1_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
+ gs_glyph glyph, op_proc_t cont, op_proc_t *exec_cont)
{ /* This function is similar to zchar42_set_cache. */
double sbw[4];
gs_glyph_info_t info;
@@ -1289,16 +1288,16 @@ z1_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
gs_matrix id_matrix = { identity_matrix_body };
code = gs_default_glyph_info((gs_font *)pbfont, glyph, &id_matrix,
- ((GLYPH_INFO_WIDTH0 | GLYPH_INFO_VVECTOR0) << wmode) | GLYPH_INFO_BBOX,
- &info);
+ ((GLYPH_INFO_WIDTH0 | GLYPH_INFO_VVECTOR0) << wmode) | GLYPH_INFO_BBOX,
+ &info);
if (code < 0)
- return code;
+ return code;
sbw[0] = info.v.x;
sbw[1] = info.v.y;
sbw[2] = info.width[wmode].x;
sbw[3] = info.width[wmode].y;
return zchar_set_cache(i_ctx_p, pbfont, cnref, NULL,
- sbw + 2, &info.bbox,
- cont, exec_cont,
- wmode ? sbw : NULL);
+ sbw + 2, &info.bbox,
+ cont, exec_cont,
+ wmode ? sbw : NULL);
}
diff --git a/gs/psi/zchar2.c b/gs/psi/zchar2.c
index ec0db5c70..c98c6b7a9 100644
--- a/gs/psi/zchar2.c
+++ b/gs/psi/zchar2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zchar32.c b/gs/psi/zchar32.c
index 52c38c588..2fe571420 100644
--- a/gs/psi/zchar32.c
+++ b/gs/psi/zchar32.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,20 +43,20 @@ zmakeglyph32(i_ctx_t *i_ctx_p)
check_array(op[-4]);
msize = r_size(op - 4);
switch (msize) {
- case 10:
- long_form = true;
- break;
- case 6:
- long_form = false;
- break;
- default:
- return_error(e_rangecheck);
+ case 10:
+ long_form = true;
+ break;
+ case 6:
+ long_form = false;
+ break;
+ default:
+ return_error(e_rangecheck);
}
code = num_params(op[-4].value.refs + msize - 1, msize, metrics);
if (code < 0)
- return code;
+ return code;
if (~code & 0x3c) /* check llx .. ury for integers */
- return_error(e_typecheck);
+ return_error(e_typecheck);
check_read_type(op[-3], t_string);
llx = (int)metrics[2];
lly = (int)metrics[3];
@@ -66,41 +66,41 @@ zmakeglyph32(i_ctx_t *i_ctx_p)
height = ury - lly;
raster = (width + 7) >> 3;
if (width < 0 || height < 0 || r_size(op - 3) != raster * height)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
check_int_leu(op[-2], 65535);
code = font_param(op - 1, &pfont);
if (code < 0)
- return code;
+ return code;
if (pfont->FontType != ft_CID_bitmap)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
check_write_type(*op, t_string);
if (r_size(op) < 22)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
str = op->value.bytes;
if (long_form || metrics[0] != (wx = (int)metrics[0]) ||
- metrics[1] != 0 || height == 0 ||
- ((wx | width | height | (llx + 128) | (lly + 128)) & ~255) != 0
- ) {
- /* Use the long form. */
- int i, n = (long_form ? 10 : 6);
+ metrics[1] != 0 || height == 0 ||
+ ((wx | width | height | (llx + 128) | (lly + 128)) & ~255) != 0
+ ) {
+ /* Use the long form. */
+ int i, n = (long_form ? 10 : 6);
- str[0] = 0;
- str[1] = long_form;
- for (i = 0; i < n; ++i) {
- int v = (int)metrics[i]; /* no floating point widths yet */
+ str[0] = 0;
+ str[1] = long_form;
+ for (i = 0; i < n; ++i) {
+ int v = (int)metrics[i]; /* no floating point widths yet */
- str[2 + 2 * i] = (byte)(v >> 8);
- str[2 + 2 * i + 1] = (byte)v;
- }
- r_set_size(op, 2 + n * 2);
+ str[2 + 2 * i] = (byte)(v >> 8);
+ str[2 + 2 * i + 1] = (byte)v;
+ }
+ r_set_size(op, 2 + n * 2);
} else {
- /* Use the short form. */
- str[0] = (byte)width;
- str[1] = (byte)height;
- str[2] = (byte)wx;
- str[3] = (byte)(llx + 128);
- str[4] = (byte)(lly + 128);
- r_set_size(op, 5);
+ /* Use the short form. */
+ str[0] = (byte)width;
+ str[1] = (byte)height;
+ str[2] = (byte)wx;
+ str[3] = (byte)(llx + 128);
+ str[4] = (byte)(lly + 128);
+ r_set_size(op, 5);
}
return code;
}
@@ -116,8 +116,8 @@ select_cid_range(const gs_memory_t *mem, cached_char * cc, void *range_ptr)
const font_cid_range_t *range = range_ptr;
return (cc->code >= range->cid_min &&
- cc->code <= range->cid_max &&
- cc->pair->font == range->font);
+ cc->code <= range->cid_max &&
+ cc->pair->font == range->font);
}
static int
zremoveglyphs(i_ctx_t *i_ctx_p)
@@ -130,13 +130,13 @@ zremoveglyphs(i_ctx_t *i_ctx_p)
check_int_leu(op[-1], 65535);
code = font_param(op, &range.font);
if (code < 0)
- return code;
+ return code;
if (range.font->FontType != ft_CID_bitmap)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
range.cid_min = gs_min_cid_glyph + op[-2].value.intval;
range.cid_max = gs_min_cid_glyph + op[-1].value.intval;
gx_purge_selected_cached_chars(range.font->dir, select_cid_range,
- &range);
+ &range);
pop(3);
return 0;
}
@@ -156,39 +156,39 @@ zgetmetrics32(i_ctx_t *i_ctx_p)
data = op->value.const_bytes;
size = r_size(op);
if (size < 5)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (data[0]) {
- /* Short form. */
- int llx = (int)data[3] - 128, lly = (int)data[4] - 128;
+ /* Short form. */
+ int llx = (int)data[3] - 128, lly = (int)data[4] - 128;
- n = 6;
- size = 5;
- push(8);
- make_int(op - 6, data[2]); /* wx */
- make_int(op - 5, 0); /* wy */
- make_int(op - 4, llx);
- make_int(op - 3, lly);
- make_int(op - 2, llx + data[0]); /* urx */
- make_int(op - 1, lly + data[1]); /* ury */
+ n = 6;
+ size = 5;
+ push(8);
+ make_int(op - 6, data[2]); /* wx */
+ make_int(op - 5, 0); /* wy */
+ make_int(op - 4, llx);
+ make_int(op - 3, lly);
+ make_int(op - 2, llx + data[0]); /* urx */
+ make_int(op - 1, lly + data[1]); /* ury */
} else {
- if (data[1]) {
- /* Long form, both WModes. */
- if (size < 22)
- return_error(e_rangecheck);
- n = 10;
- size = 22;
- } else {
- /* Long form, WMode = 0 only. */
- if (size < 14)
- return_error(e_rangecheck);
- n = 6;
- size = 14;
- }
- push(2 + n);
- for (i = 0; i < n; ++i)
- make_int(op - n + i,
- ((int)((data[2 * i + 2] << 8) + data[2 * i + 3]) ^ 0x8000)
- - 0x8000);
+ if (data[1]) {
+ /* Long form, both WModes. */
+ if (size < 22)
+ return_error(e_rangecheck);
+ n = 10;
+ size = 22;
+ } else {
+ /* Long form, WMode = 0 only. */
+ if (size < 14)
+ return_error(e_rangecheck);
+ n = 6;
+ size = 14;
+ }
+ push(2 + n);
+ for (i = 0; i < n; ++i)
+ make_int(op - n + i,
+ ((int)((data[2 * i + 2] << 8) + data[2 * i + 3]) ^ 0x8000)
+ - 0x8000);
}
wop = op - n;
make_int(wop - 2, wop[4].value.intval - wop[2].value.intval);
diff --git a/gs/psi/zchar42.c b/gs/psi/zchar42.c
index d250640e2..33761b297 100644
--- a/gs/psi/zchar42.c
+++ b/gs/psi/zchar42.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -38,8 +38,8 @@
/* Get a Type 42 character metrics and set the cache device. */
int
-zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
- uint glyph_index, op_proc_t cont, op_proc_t *exec_cont)
+zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
+ uint glyph_index, op_proc_t cont, op_proc_t *exec_cont)
{ double sbw[4];
double w[2];
int present;
@@ -50,73 +50,73 @@ zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
float sbw_bbox[8];
if (code < 0)
- return code;
+ return code;
present = code;
if (vertical) { /* for vertically-oriented metrics */
- float sbw_bbox_h[8];
+ float sbw_bbox_h[8];
- /* Always call get_metrics because we'll need glyph bbox below in any case
- as a workaround for Dynalab fonts. We can't recognize Dynalab here. */
- code = pfont42->data.get_metrics(pfont42, glyph_index,
- gs_type42_metrics_options_WMODE0_AND_BBOX, sbw_bbox_h);
- if (code < 0)
- return code;
- code = pfont42->data.get_metrics(pfont42, glyph_index,
- gs_type42_metrics_options_WMODE1_AND_BBOX, sbw_bbox);
- /* Here code=0 means success, code<0 means no vertical metrics. */
- if (code < 0) {
- /* No vertical metrics in the font,
- hewristically compose vertical metrics from bounding boxes. */
- sbw_bbox[0] = 0;
- sbw_bbox[1] = pbfont->FontBBox.q.y - 1;
- sbw_bbox[2] = 0;
- sbw_bbox[3] = -1;
- }
- if (present != metricsSideBearingAndWidth) {
- /* metricsNone or metricsWidthOnly. */
- /* No top side bearing (in Metrics2) in Postscript font. */
- /* Note that Postscript wants the 'V' vector in sbw[0:1],
- and True Type supplies Top Side Bearing in sbw_bbox[0:1],
- and Left Side Bearing in sbw_bbox_h[0:1].
- So we need to compute V from FontBBox as we do for FontType 9
- (see FontBBox_as_Metrics2) and add TSB to it. */
+ /* Always call get_metrics because we'll need glyph bbox below in any case
+ as a workaround for Dynalab fonts. We can't recognize Dynalab here. */
+ code = pfont42->data.get_metrics(pfont42, glyph_index,
+ gs_type42_metrics_options_WMODE0_AND_BBOX, sbw_bbox_h);
+ if (code < 0)
+ return code;
+ code = pfont42->data.get_metrics(pfont42, glyph_index,
+ gs_type42_metrics_options_WMODE1_AND_BBOX, sbw_bbox);
+ /* Here code=0 means success, code<0 means no vertical metrics. */
+ if (code < 0) {
+ /* No vertical metrics in the font,
+ hewristically compose vertical metrics from bounding boxes. */
+ sbw_bbox[0] = 0;
+ sbw_bbox[1] = pbfont->FontBBox.q.y - 1;
+ sbw_bbox[2] = 0;
+ sbw_bbox[3] = -1;
+ }
+ if (present != metricsSideBearingAndWidth) {
+ /* metricsNone or metricsWidthOnly. */
+ /* No top side bearing (in Metrics2) in Postscript font. */
+ /* Note that Postscript wants the 'V' vector in sbw[0:1],
+ and True Type supplies Top Side Bearing in sbw_bbox[0:1],
+ and Left Side Bearing in sbw_bbox_h[0:1].
+ So we need to compute V from FontBBox as we do for FontType 9
+ (see FontBBox_as_Metrics2) and add TSB to it. */
# if 0 /* old code taken from empirics, keepping it for a while to compare results. */
- sbw[0] = (sbw_bbox[6] + sbw_bbox[4]) / 2;
- sbw[1] = (pbfont->FontBBox.q.y + pbfont->FontBBox.p.y - sbw_bbox[3]) / 2;
+ sbw[0] = (sbw_bbox[6] + sbw_bbox[4]) / 2;
+ sbw[1] = (pbfont->FontBBox.q.y + pbfont->FontBBox.p.y - sbw_bbox[3]) / 2;
# else
- sbw[0] = sbw_bbox_h[2] / 2;
- sbw[1] = sbw_bbox[1] - sbw_bbox[3];
+ sbw[0] = sbw_bbox_h[2] / 2;
+ sbw[1] = sbw_bbox[1] - sbw_bbox[3];
# endif
- }
- if (present == metricsNone) {
- /* No adwance width (in Metrcis2) in Postscript font. */
- sbw[2] = 0;
- sbw[3] = sbw_bbox[3];
- }
+ }
+ if (present == metricsNone) {
+ /* No adwance width (in Metrcis2) in Postscript font. */
+ sbw[2] = 0;
+ sbw[3] = sbw_bbox[3];
+ }
} else {
- /* Always call get_metrics because we'll need glyph bbox below in any case
- as a workaround for Dynalab fonts. We can't recognize Dynalab here. */
- code = pfont42->data.get_metrics(pfont42, glyph_index,
- gs_type42_metrics_options_WMODE0_AND_BBOX, sbw_bbox);
- if (code < 0)
- return code;
- if (present != metricsSideBearingAndWidth) {
- /* metricsNone or metricsWidthOnly. */
- /* No left side bearing (in Metrics) in Postscript font. */
- sbw[0] = sbw_bbox[0];
- sbw[1] = sbw_bbox[1];
- }
- if (present == metricsNone) {
- /* No advance width (in Metrics) in Postscript font. */
- sbw[2] = sbw_bbox[2];
- sbw[3] = sbw_bbox[3];
- }
+ /* Always call get_metrics because we'll need glyph bbox below in any case
+ as a workaround for Dynalab fonts. We can't recognize Dynalab here. */
+ code = pfont42->data.get_metrics(pfont42, glyph_index,
+ gs_type42_metrics_options_WMODE0_AND_BBOX, sbw_bbox);
+ if (code < 0)
+ return code;
+ if (present != metricsSideBearingAndWidth) {
+ /* metricsNone or metricsWidthOnly. */
+ /* No left side bearing (in Metrics) in Postscript font. */
+ sbw[0] = sbw_bbox[0];
+ sbw[1] = sbw_bbox[1];
+ }
+ if (present == metricsNone) {
+ /* No advance width (in Metrics) in Postscript font. */
+ sbw[2] = sbw_bbox[2];
+ sbw[3] = sbw_bbox[3];
+ }
}
w[0] = sbw[2];
w[1] = sbw[3];
if (!vertical) {
- sbw_bbox[6] = (sbw_bbox[6] - sbw_bbox[4]) + sbw_bbox[0];
- sbw_bbox[4] = sbw_bbox[0];
+ sbw_bbox[6] = (sbw_bbox[6] - sbw_bbox[4]) + sbw_bbox[0];
+ sbw_bbox[4] = sbw_bbox[0];
}
/* Note: The glyph bbox usn't useful for Dynalab fonts,
which stretch subglyphs. Uniting with FontBBox helps.
@@ -127,10 +127,10 @@ zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
bbox.q.x = max(sbw_bbox[6], pbfont->FontBBox.q.x);
bbox.q.y = max(sbw_bbox[7], pbfont->FontBBox.q.y);
return zchar_set_cache(i_ctx_p, pbfont, cnref,
- NULL,
- w, &bbox,
- cont, exec_cont,
- gs_rootfont(igs)->WMode ? sbw : NULL);
+ NULL,
+ w, &bbox,
+ cont, exec_cont,
+ gs_rootfont(igs)->WMode ? sbw : NULL);
}
/* <font> <code|name> <name> <glyph_index> .type42execchar - */
@@ -150,12 +150,12 @@ ztype42execchar(i_ctx_t *i_ctx_p)
uint glyph_index;
if (code < 0)
- return code;
+ return code;
if (penum == 0 ||
- (pfont->FontType != ft_TrueType &&
- pfont->FontType != ft_CID_TrueType)
- )
- return_error(e_undefined);
+ (pfont->FontType != ft_TrueType &&
+ pfont->FontType != ft_CID_TrueType)
+ )
+ return_error(e_undefined);
/*
* Any reasonable implementation would execute something like
* 1 setmiterlimit 0 setlinejoin 0 setlinecap
@@ -164,13 +164,13 @@ ztype42execchar(i_ctx_t *i_ctx_p)
* If this is a stroked font, set the stroke width.
*/
if (pfont->PaintType)
- gs_setlinewidth(igs, pfont->StrokeWidth);
+ gs_setlinewidth(igs, pfont->StrokeWidth);
check_estack(3); /* for continuations */
/*
* Execute the definition of the character.
*/
if (r_is_proc(op))
- return zchar_exec_char_proc(i_ctx_p);
+ return zchar_exec_char_proc(i_ctx_p);
/*
* The definition must be a Type 42 glyph index.
* Note that we do not require read access: this is deliberate.
@@ -180,23 +180,23 @@ ztype42execchar(i_ctx_t *i_ctx_p)
/* Establish a current point. */
code = gs_moveto(igs, 0.0, 0.0);
if (code < 0)
- return code;
+ return code;
cnref = op - 1;
glyph_index = (uint)op->value.intval;
if (pfont42->data.gsub_size) {
- glyph_index = pfont42->data.substitute_glyph_index_vertical(pfont42, glyph_index,
- gs_rootfont(igs)->WMode, penum->returned.current_glyph);
- make_int(op, glyph_index);
+ glyph_index = pfont42->data.substitute_glyph_index_vertical(pfont42, glyph_index,
+ gs_rootfont(igs)->WMode, penum->returned.current_glyph);
+ make_int(op, glyph_index);
}
code = zchar42_set_cache(i_ctx_p, pbfont, cnref, glyph_index, cont, &exec_cont);
if (code >= 0 && exec_cont != 0)
- code = (*exec_cont)(i_ctx_p);
+ code = (*exec_cont)(i_ctx_p);
return code;
}
/* Continue after a CDevProc callout. */
static int type42_finish(i_ctx_t *i_ctx_p,
- int (*cont)(gs_state *));
+ int (*cont)(gs_state *));
static int
type42_fill(i_ctx_t *i_ctx_p)
{
@@ -229,39 +229,39 @@ type42_finish(i_ctx_t *i_ctx_p, int (*cont) (gs_state *))
check_type(*opc, t_integer);
code = font_param(opc - 3, &pfont);
if (code < 0)
- return code;
+ return code;
if (penum == 0 || (pfont->FontType != ft_TrueType &&
- pfont->FontType != ft_CID_TrueType)
- )
- return_error(e_undefined);
+ pfont->FontType != ft_CID_TrueType)
+ )
+ return_error(e_undefined);
pfont42 = (gs_font_type42 *)pfont;
if (!i_ctx_p->RenderTTNotdef) {
- if (r_has_type(opc - 1, t_name)) {
- ref gref;
+ if (r_has_type(opc - 1, t_name)) {
+ ref gref;
- name_string_ref(imemory, opc - 1, &gref);
- if ((gref.tas.rsize == 7 && strncmp((const char *)gref.value.const_bytes, ".notdef", 7) == 0) ||
- (gref.tas.rsize > 9 && strncmp((const char *)gref.value.const_bytes, ".notdef~GS", 10) == 0)) {
- pop(4);
- return (*cont)(igs);
- }
- }
+ name_string_ref(imemory, opc - 1, &gref);
+ if ((gref.tas.rsize == 7 && strncmp((const char *)gref.value.const_bytes, ".notdef", 7) == 0) ||
+ (gref.tas.rsize > 9 && strncmp((const char *)gref.value.const_bytes, ".notdef~GS", 10) == 0)) {
+ pop(4);
+ return (*cont)(igs);
+ }
+ }
}
glyph_index = (uint)opc->value.intval;
if (pfont42->data.gsub_size)
- glyph_index = pfont42->data.substitute_glyph_index_vertical(pfont42, glyph_index,
- gs_rootfont(igs)->WMode, penum->returned.current_glyph);
+ glyph_index = pfont42->data.substitute_glyph_index_vertical(pfont42, glyph_index,
+ gs_rootfont(igs)->WMode, penum->returned.current_glyph);
/*
* We have to disregard penum->pis and penum->path, and render to
* the current gstate and path. This is a design bug that we will
* have to address someday!
*/
code = gs_type42_append(glyph_index, igs,
- igs->path, penum, pfont,
- (penum->text.operation & TEXT_DO_ANY_CHARPATH) != 0);
+ igs->path, penum, pfont,
+ (penum->text.operation & TEXT_DO_ANY_CHARPATH) != 0);
if (code < 0)
- return code;
+ return code;
pop(4);
return (*cont)(igs);
}
diff --git a/gs/psi/zchar42.h b/gs/psi/zchar42.h
index 04b76c2f1..1921e2cab 100644
--- a/gs/psi/zchar42.h
+++ b/gs/psi/zchar42.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,7 +17,7 @@
# define zchar42_INCLUDED
/* Get a Type 42 character metrics and set the cache device. */
-int zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
- uint glyph_index, op_proc_t cont, op_proc_t *exec_cont);
+int zchar42_set_cache(i_ctx_t *i_ctx_p, gs_font_base *pbfont, ref *cnref,
+ uint glyph_index, op_proc_t cont, op_proc_t *exec_cont);
#endif /* zchar42_INCLUDED */
diff --git a/gs/psi/zcharout.c b/gs/psi/zcharout.c
index 230b72d91..4de092167 100644
--- a/gs/psi/zcharout.c
+++ b/gs/psi/zcharout.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,11 +40,11 @@ int
zchar_exec_char_proc(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
- /*
- * The definition is a PostScript procedure. Execute
- * <code|name> proc
- * within a systemdict begin/end and a font begin/end.
- */
+ /*
+ * The definition is a PostScript procedure. Execute
+ * <code|name> proc
+ * within a systemdict begin/end and a font begin/end.
+ */
es_ptr ep;
check_estack(5);
@@ -56,11 +56,11 @@ zchar_exec_char_proc(i_ctx_t *i_ctx_p)
make_op_estack(ep, zbegin);
ref_assign(op - 1, systemdict);
{
- ref rfont;
+ ref rfont;
- ref_assign(&rfont, op - 3);
- ref_assign(op - 3, op - 2);
- ref_assign(op - 2, &rfont);
+ ref_assign(&rfont, op - 3);
+ ref_assign(op - 3, op - 2);
+ ref_assign(op - 2, &rfont);
}
pop(1);
return o_push_estack;
@@ -73,43 +73,43 @@ zchar_exec_char_proc(i_ctx_t *i_ctx_p)
*/
int /*metrics_present*/
zchar_get_metrics(const gs_font_base * pbfont, const ref * pcnref,
- double psbw[4])
+ double psbw[4])
{
const ref *pfdict = &pfont_data(gs_font_parent(pbfont))->dict;
ref *pmdict;
if (dict_find_string(pfdict, "Metrics", &pmdict) > 0) {
- ref *pmvalue;
-
- check_type_only(*pmdict, t_dictionary);
- check_dict_read(*pmdict);
- if (dict_find(pmdict, pcnref, &pmvalue) > 0) {
- if (num_params(pmvalue, 1, psbw + 2) >= 0) { /* <wx> only */
- psbw[3] = 0;
- return metricsWidthOnly;
- } else {
- int code;
-
- check_read_type_only(*pmvalue, t_array);
- switch (r_size(pmvalue)) {
- case 2: /* [<sbx> <wx>] */
- code = num_params(pmvalue->value.refs + 1,
- 2, psbw);
- psbw[2] = psbw[1];
- psbw[1] = psbw[3] = 0;
- break;
- case 4: /* [<sbx> <sby> <wx> <wy>] */
- code = num_params(pmvalue->value.refs + 3,
- 4, psbw);
- break;
- default:
- return_error(e_rangecheck);
- }
- if (code < 0)
- return code;
- return metricsSideBearingAndWidth;
- }
- }
+ ref *pmvalue;
+
+ check_type_only(*pmdict, t_dictionary);
+ check_dict_read(*pmdict);
+ if (dict_find(pmdict, pcnref, &pmvalue) > 0) {
+ if (num_params(pmvalue, 1, psbw + 2) >= 0) { /* <wx> only */
+ psbw[3] = 0;
+ return metricsWidthOnly;
+ } else {
+ int code;
+
+ check_read_type_only(*pmvalue, t_array);
+ switch (r_size(pmvalue)) {
+ case 2: /* [<sbx> <wx>] */
+ code = num_params(pmvalue->value.refs + 1,
+ 2, psbw);
+ psbw[2] = psbw[1];
+ psbw[1] = psbw[3] = 0;
+ break;
+ case 4: /* [<sbx> <sby> <wx> <wy>] */
+ code = num_params(pmvalue->value.refs + 3,
+ 4, psbw);
+ break;
+ default:
+ return_error(e_rangecheck);
+ }
+ if (code < 0)
+ return code;
+ return metricsSideBearingAndWidth;
+ }
+ }
}
return metricsNone;
}
@@ -117,24 +117,24 @@ zchar_get_metrics(const gs_font_base * pbfont, const ref * pcnref,
/* Get the vertical metrics for a character from Metrics2, if present. */
int
zchar_get_metrics2(const gs_font_base * pbfont, const ref * pcnref,
- double pwv[4])
+ double pwv[4])
{
const ref *pfdict = &pfont_data(gs_font_parent(pbfont))->dict;
ref *pmdict;
if (dict_find_string(pfdict, "Metrics2", &pmdict) > 0) {
- ref *pmvalue;
-
- check_type_only(*pmdict, t_dictionary);
- check_dict_read(*pmdict);
- if (dict_find(pmdict, pcnref, &pmvalue) > 0) {
- check_read_type_only(*pmvalue, t_array);
- if (r_size(pmvalue) == 4) {
- int code = num_params(pmvalue->value.refs + 3, 4, pwv);
-
- return (code < 0 ? code : metricsSideBearingAndWidth);
- }
- }
+ ref *pmvalue;
+
+ check_type_only(*pmdict, t_dictionary);
+ check_dict_read(*pmdict);
+ if (dict_find(pmdict, pcnref, &pmvalue) > 0) {
+ check_read_type_only(*pmvalue, t_array);
+ if (r_size(pmvalue) == 4) {
+ int code = num_params(pmvalue->value.refs + 3, 4, pwv);
+
+ return (code < 0 ? code : metricsSideBearingAndWidth);
+ }
+ }
}
return metricsNone;
}
@@ -158,10 +158,10 @@ zchar_get_CDevProc(const gs_font_base * pbfont, ref **ppcdevproc)
*/
int
zchar_set_cache(i_ctx_t *i_ctx_p, const gs_font_base * pbfont,
- const ref * pcnref, const double psb[2],
- const double pwidth[2], const gs_rect * pbbox,
- op_proc_t cont, op_proc_t *exec_cont,
- const double Metrics2_sbw_default[4])
+ const ref * pcnref, const double psb[2],
+ const double pwidth[2], const gs_rect * pbbox,
+ op_proc_t cont, op_proc_t *exec_cont,
+ const double Metrics2_sbw_default[4])
{
os_ptr op = osp;
ref *pcdevproc, *valueref;
@@ -179,21 +179,21 @@ zchar_set_cache(i_ctx_t *i_ctx_p, const gs_font_base * pbfont,
w2[2] = pbbox->p.x, w2[3] = pbbox->p.y;
w2[4] = pbbox->q.x, w2[5] = pbbox->q.y;
if (pbfont->PaintType != 0) {
- double expand = max(1.415, gs_currentmiterlimit(igs)) *
- gs_currentlinewidth(igs) / 2;
+ double expand = max(1.415, gs_currentmiterlimit(igs)) *
+ gs_currentlinewidth(igs) / 2;
- w2[2] -= expand, w2[3] -= expand;
- w2[4] += expand, w2[5] += expand;
+ w2[2] -= expand, w2[3] -= expand;
+ w2[4] += expand, w2[5] += expand;
}
/* Check for Metrics2. */
{
- int code = zchar_get_metrics2(pbfont, pcnref, w2 + 6);
+ int code = zchar_get_metrics2(pbfont, pcnref, w2 + 6);
- if (code < 0)
- return code;
- metrics2 = code > 0;
+ if (code < 0)
+ return code;
+ metrics2 = code > 0;
}
/*
@@ -205,8 +205,8 @@ zchar_set_cache(i_ctx_t *i_ctx_p, const gs_font_base * pbfont,
w2[7] = Metrics2_sbw_default[3];
w2[8] = Metrics2_sbw_default[0];
w2[9] = Metrics2_sbw_default[1];
- metrics2 = true;
- metrics2_use_default = true;
+ metrics2 = true;
+ metrics2_use_default = true;
}
/* Check for CDevProc or "short-circuiting". */
@@ -214,78 +214,78 @@ zchar_set_cache(i_ctx_t *i_ctx_p, const gs_font_base * pbfont,
have_cdevproc = zchar_get_CDevProc(pbfont, &pcdevproc);
/* Obscure test. If we have replaced a CIDFont with a disk-based TrueType font, then we do *not*
- * want to execute the CDevProc. This is beacause the CDevProc is supposed to be called wiht the
+ * want to execute the CDevProc. This is beacause the CDevProc is supposed to be called wiht the
* original CID but what we have here is the TT GID. So the CDevProc won't do the right thing. Since
* the CDevProc is really rather closely tied to the font we almost certainly don't want to run it
* if we've replaced the font. So here we check the key_name against the font_name and if they do
* not match, we don't run the CDevProc because we assume that we have substituted a font.
*/
if (pbfont->FontType == ft_CID_TrueType && dict_find_string(&pfont_data(gs_font_parent(pbfont))->dict, "File", &valueref) > 0) {
- if (pbfont->key_name.size != pbfont->font_name.size ||
- strncmp((const char *)pbfont->key_name.chars, (const char *)pbfont->font_name.chars, pbfont->key_name.size)) {
- have_cdevproc = 0;
- }
+ if (pbfont->key_name.size != pbfont->font_name.size ||
+ strncmp((const char *)pbfont->key_name.chars, (const char *)pbfont->font_name.chars, pbfont->key_name.size)) {
+ have_cdevproc = 0;
+ }
}
if (have_cdevproc || zchar_show_width_only(penum)) {
- int i;
- op_proc_t zsetc;
- int nparams;
-
- if (have_cdevproc) {
- check_proc_only(*pcdevproc);
- zsetc = zsetcachedevice2;
-
- /* If we have cdevproc and the font type is CID type 0,
- we'll throw away Metrics2_sbw_default that is calculated
- from FontBBox. */
- if (!metrics2
- || (penum->current_font->FontType == ft_CID_encrypted
- && metrics2_use_default)) {
- w2[6] = w2[0], w2[7] = w2[1];
- w2[8] = w2[9] = 0;
- }
- nparams = 10;
- } else {
- make_oper(&rpop, 0, zpop);
- pcdevproc = &rpop;
- if (metrics2)
- zsetc = zsetcachedevice2, nparams = 10;
- else
- zsetc = zsetcachedevice, nparams = 6;
- }
- check_estack(3);
- /* Push the l.s.b. for .type1addpath if necessary. */
- if (psb != 0) {
- push(nparams + 3);
- make_real(op - (nparams + 2), psb[0]);
- make_real(op - (nparams + 1), psb[1]);
- } else {
- push(nparams + 1);
- }
- for (i = 0; i < nparams; ++i)
- make_real(op - nparams + i, w2[i]);
- ref_assign(op, pcnref);
- push_op_estack(cont);
- push_op_estack(zsetc);
- ++esp;
- ref_assign(esp, pcdevproc);
- return o_push_estack;
+ int i;
+ op_proc_t zsetc;
+ int nparams;
+
+ if (have_cdevproc) {
+ check_proc_only(*pcdevproc);
+ zsetc = zsetcachedevice2;
+
+ /* If we have cdevproc and the font type is CID type 0,
+ we'll throw away Metrics2_sbw_default that is calculated
+ from FontBBox. */
+ if (!metrics2
+ || (penum->current_font->FontType == ft_CID_encrypted
+ && metrics2_use_default)) {
+ w2[6] = w2[0], w2[7] = w2[1];
+ w2[8] = w2[9] = 0;
+ }
+ nparams = 10;
+ } else {
+ make_oper(&rpop, 0, zpop);
+ pcdevproc = &rpop;
+ if (metrics2)
+ zsetc = zsetcachedevice2, nparams = 10;
+ else
+ zsetc = zsetcachedevice, nparams = 6;
+ }
+ check_estack(3);
+ /* Push the l.s.b. for .type1addpath if necessary. */
+ if (psb != 0) {
+ push(nparams + 3);
+ make_real(op - (nparams + 2), psb[0]);
+ make_real(op - (nparams + 1), psb[1]);
+ } else {
+ push(nparams + 1);
+ }
+ for (i = 0; i < nparams; ++i)
+ make_real(op - nparams + i, w2[i]);
+ ref_assign(op, pcnref);
+ push_op_estack(cont);
+ push_op_estack(zsetc);
+ ++esp;
+ ref_assign(esp, pcdevproc);
+ return o_push_estack;
} {
- int code =
- (metrics2 ? gs_text_setcachedevice2(penum, w2) :
- gs_text_setcachedevice(penum, w2));
+ int code =
+ (metrics2 ? gs_text_setcachedevice2(penum, w2) :
+ gs_text_setcachedevice(penum, w2));
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
/* No metrics modification, do the stroke or fill now. */
/* Push the l.s.b. for .type1addpath if necessary. */
if (psb != 0) {
- push(2);
- make_real(op - 1, psb[0]);
- make_real(op, psb[1]);
+ push(2);
+ make_real(op - 1, psb[0]);
+ make_real(op, psb[1]);
}
*exec_cont = cont;
return 0;
@@ -303,51 +303,51 @@ zchar_charstring_data(gs_font *font, const ref *pgref, gs_glyph_data_t *pgd)
ref *pcstr;
if (dict_find(&pfont_data(font)->CharStrings, pgref, &pcstr) <= 0)
- return_error(e_undefined);
+ return_error(e_undefined);
if (!r_has_type(pcstr, t_string)) {
- /*
- * The ADOBEPS4 Windows driver replaces the .notdef entry of
- * otherwise normal Type 1 fonts with the procedure
- * {pop 0 0 setcharwidth}
- * To prevent this from making the font unembeddable in PDF files
- * (with our present font-writing code), we recognize this as a
- * special case and return a Type 1 CharString consisting of
- * 0 0 hsbw endchar
- */
- if (font->FontType == ft_encrypted &&
- charstring_is_notdef_proc(font->memory, pcstr)
- )
- return charstring_make_notdef(pgd, font);
- else
- return_error(e_typecheck);
+ /*
+ * The ADOBEPS4 Windows driver replaces the .notdef entry of
+ * otherwise normal Type 1 fonts with the procedure
+ * {pop 0 0 setcharwidth}
+ * To prevent this from making the font unembeddable in PDF files
+ * (with our present font-writing code), we recognize this as a
+ * special case and return a Type 1 CharString consisting of
+ * 0 0 hsbw endchar
+ */
+ if (font->FontType == ft_encrypted &&
+ charstring_is_notdef_proc(font->memory, pcstr)
+ )
+ return charstring_make_notdef(pgd, font);
+ else
+ return_error(e_typecheck);
}
gs_glyph_data_from_string(pgd, pcstr->value.const_bytes, r_size(pcstr),
- NULL);
+ NULL);
return 0;
}
static bool
charstring_is_notdef_proc(const gs_memory_t *mem, const ref *pcstr)
{
if (r_is_array(pcstr) && r_size(pcstr) == 4) {
- ref elts[4];
- long i;
-
- for (i = 0; i < 4; ++i)
- array_get(mem, pcstr, i, &elts[i]);
- if (r_has_type(&elts[0], t_name) &&
- r_has_type(&elts[1], t_integer) && elts[1].value.intval == 0 &&
- r_has_type(&elts[2], t_integer) && elts[2].value.intval == 0 &&
- r_has_type(&elts[3], t_name)
- ) {
- ref nref;
-
- name_enter_string(mem, "pop", &nref);
- if (name_eq(&elts[0], &nref)) {
- name_enter_string(mem, "setcharwidth", &nref);
- if (name_eq(&elts[3], &nref))
- return true;
- }
- }
+ ref elts[4];
+ long i;
+
+ for (i = 0; i < 4; ++i)
+ array_get(mem, pcstr, i, &elts[i]);
+ if (r_has_type(&elts[0], t_name) &&
+ r_has_type(&elts[1], t_integer) && elts[1].value.intval == 0 &&
+ r_has_type(&elts[2], t_integer) && elts[2].value.intval == 0 &&
+ r_has_type(&elts[3], t_name)
+ ) {
+ ref nref;
+
+ name_enter_string(mem, "pop", &nref);
+ if (name_eq(&elts[0], &nref)) {
+ name_enter_string(mem, "setcharwidth", &nref);
+ if (name_eq(&elts[3], &nref))
+ return true;
+ }
+ }
}
return false;
}
@@ -356,24 +356,24 @@ charstring_make_notdef(gs_glyph_data_t *pgd, gs_font *font)
{
gs_font_type1 *const pfont = (gs_font_type1 *)font;
static const byte char_data[4] = {
- 139, /* 0 */
- 139, /* 0 */
- c1_hsbw,
- cx_endchar
+ 139, /* 0 */
+ 139, /* 0 */
+ c1_hsbw,
+ cx_endchar
};
uint len = max(pfont->data.lenIV, 0) + sizeof(char_data);
byte *chars = gs_alloc_string(font->memory, len, "charstring_make_notdef");
if (chars == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
gs_glyph_data_from_string(pgd, chars, len, font);
if (pfont->data.lenIV < 0)
- memcpy(chars, char_data, sizeof(char_data));
+ memcpy(chars, char_data, sizeof(char_data));
else {
- crypt_state state = crypt_charstring_seed;
+ crypt_state state = crypt_charstring_seed;
- memcpy(chars + pfont->data.lenIV, char_data, sizeof(char_data));
- gs_type1_encrypt(chars, chars, len, &state);
+ memcpy(chars + pfont->data.lenIV, char_data, sizeof(char_data));
+ gs_type1_encrypt(chars, chars, len, &state);
}
return 0;
}
@@ -393,23 +393,23 @@ zchar_enumerate_glyph(const gs_memory_t *mem, const ref *prdict, int *pindex, gs
ref elt[2];
if (!r_has_type(prdict, t_dictionary))
- return 0; /* *pindex was 0, is still 0 */
+ return 0; /* *pindex was 0, is still 0 */
if (index < 0)
- index = dict_first(prdict);
+ index = dict_first(prdict);
next:
index = dict_next(prdict, index, elt);
*pindex = index + 1;
if (index >= 0) {
- switch (r_type(elt)) {
- case t_integer:
- *pglyph = gs_min_cid_glyph + elt[0].value.intval;
- break;
- case t_name:
- *pglyph = name_index(mem, elt);
- break;
- default: /* can't handle it */
- goto next;
- }
+ switch (r_type(elt)) {
+ case t_integer:
+ *pglyph = gs_min_cid_glyph + elt[0].value.intval;
+ break;
+ case t_name:
+ *pglyph = name_index(mem, elt);
+ break;
+ default: /* can't handle it */
+ goto next;
+ }
}
return 0;
}
diff --git a/gs/psi/zcharx.c b/gs/psi/zcharx.c
index bc1fa06e1..6bdf1c24c 100644
--- a/gs/psi/zcharx.c
+++ b/gs/psi/zcharx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,16 +34,16 @@ glyph_show_setup(i_ctx_t *i_ctx_p, gs_glyph *pglyph)
os_ptr op = osp;
switch (gs_currentfont(igs)->FontType) {
- case ft_CID_encrypted:
- case ft_CID_user_defined:
- case ft_CID_TrueType:
- case ft_CID_bitmap:
- check_int_leu(*op, gs_max_glyph - gs_min_cid_glyph);
- *pglyph = (gs_glyph) op->value.intval + gs_min_cid_glyph;
- break;
- default:
- check_type(*op, t_name);
- *pglyph = name_index(imemory, op);
+ case ft_CID_encrypted:
+ case ft_CID_user_defined:
+ case ft_CID_TrueType:
+ case ft_CID_bitmap:
+ check_int_leu(*op, gs_max_glyph - gs_min_cid_glyph);
+ *pglyph = (gs_glyph) op->value.intval + gs_min_cid_glyph;
+ break;
+ default:
+ check_type(*op, t_name);
+ *pglyph = name_index(imemory, op);
}
return op_show_enum_setup(i_ctx_p);
}
@@ -57,12 +57,12 @@ zglyphshow(i_ctx_t *i_ctx_p)
int code;
if ((code = glyph_show_setup(i_ctx_p, &glyph)) != 0 ||
- (code = gs_glyphshow_begin(igs, glyph, imemory, &penum)) < 0)
- return code;
+ (code = gs_glyphshow_begin(igs, glyph, imemory, &penum)) < 0)
+ return code;
*(op_proc_t *)&penum->enum_client_data = zglyphshow;
if ((code = op_show_finish_setup(i_ctx_p, penum, 1, NULL)) < 0) {
- ifree_object(penum, "zglyphshow");
- return code;
+ ifree_object(penum, "zglyphshow");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 1);
}
@@ -76,11 +76,11 @@ zglyphwidth(i_ctx_t *i_ctx_p)
int code;
if ((code = glyph_show_setup(i_ctx_p, &glyph)) != 0 ||
- (code = gs_glyphwidth_begin(igs, glyph, imemory, &penum)) < 0)
- return code;
+ (code = gs_glyphwidth_begin(igs, glyph, imemory, &penum)) < 0)
+ return code;
if ((code = op_show_finish_setup(i_ctx_p, penum, 1, finish_stringwidth)) < 0) {
- ifree_object(penum, "zglyphwidth");
- return code;
+ ifree_object(penum, "zglyphwidth");
+ return code;
}
return op_show_continue_pop(i_ctx_p, 1);
}
@@ -100,55 +100,55 @@ moveshow(i_ctx_t *i_ctx_p, bool have_x, bool have_y)
bool CPSI_mode = gs_currentcpsimode(imemory);
if (code != 0)
- return code;
+ return code;
format = num_array_format(op);
if (format < 0)
- return format;
+ return format;
size = num_array_size(op, format);
values = (float *)ialloc_byte_array(size, sizeof(float), "moveshow");
if (values == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (CPSI_mode)
- memset(values, 0, size * sizeof(values[0])); /* Safety. */
+ memset(values, 0, size * sizeof(values[0])); /* Safety. */
if ((code = gs_xyshow_begin(igs, op[-1].value.bytes, r_size(op - 1),
- (have_x ? values : (float *)0),
- (have_y ? values : (float *)0),
- size, imemory, &penum)) < 0) {
- ifree_object(values, "moveshow");
- return code;
+ (have_x ? values : (float *)0),
+ (have_y ? values : (float *)0),
+ size, imemory, &penum)) < 0) {
+ ifree_object(values, "moveshow");
+ return code;
}
if (CPSI_mode) {
- /* CET 13-29.PS page 2 defines a longer width array
- then the text requires, and CPSI silently ignores extra elements.
- So we need to compute exact number of characters
- to know how many elements to load and type check. */
- code = gs_text_count_chars(igs, gs_get_text_params(penum), imemory);
- if (code < 0)
- return code;
- widths_needed = code;
- if (have_x && have_y)
- widths_needed <<= 1;
+ /* CET 13-29.PS page 2 defines a longer width array
+ then the text requires, and CPSI silently ignores extra elements.
+ So we need to compute exact number of characters
+ to know how many elements to load and type check. */
+ code = gs_text_count_chars(igs, gs_get_text_params(penum), imemory);
+ if (code < 0)
+ return code;
+ widths_needed = code;
+ if (have_x && have_y)
+ widths_needed <<= 1;
} else
- widths_needed = size;
+ widths_needed = size;
for (i = 0; i < widths_needed; ++i) {
- ref value;
+ ref value;
- switch (code = num_array_get(imemory, op, format, i, &value)) {
- case t_integer:
- values[i] = (float)value.value.intval; break;
- case t_real:
- values[i] = value.value.realval; break;
- case t_null:
- code = gs_note_error(e_rangecheck);
- /* falls through */
- default:
- ifree_object(values, "moveshow");
- return code;
- }
+ switch (code = num_array_get(imemory, op, format, i, &value)) {
+ case t_integer:
+ values[i] = (float)value.value.intval; break;
+ case t_real:
+ values[i] = value.value.realval; break;
+ case t_null:
+ code = gs_note_error(e_rangecheck);
+ /* falls through */
+ default:
+ ifree_object(values, "moveshow");
+ return code;
+ }
}
if ((code = op_show_finish_setup(i_ctx_p, penum, 2, NULL)) < 0) {
- ifree_object(values, "moveshow");
- return code;
+ ifree_object(values, "moveshow");
+ return code;
}
pop(2);
return op_show_continue(i_ctx_p);
diff --git a/gs/psi/zcid.c b/gs/psi/zcid.c
index 731443377..d98d67c63 100644
--- a/gs/psi/zcid.c
+++ b/gs/psi/zcid.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,11 +32,11 @@ cid_system_info_param(gs_cid_system_info_t *pcidsi, const ref *prcidsi)
int code;
if (!r_has_type(prcidsi, t_dictionary))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (dict_find_string(prcidsi, "Registry", &pregistry) <= 0 ||
- dict_find_string(prcidsi, "Ordering", &pordering) <= 0
- )
- return_error(e_rangecheck);
+ dict_find_string(prcidsi, "Ordering", &pordering) <= 0
+ )
+ return_error(e_rangecheck);
check_read_type_only(*pregistry, t_string);
check_read_type_only(*pordering, t_string);
pcidsi->Registry.data = pregistry->value.const_bytes;
@@ -44,42 +44,42 @@ cid_system_info_param(gs_cid_system_info_t *pcidsi, const ref *prcidsi)
pcidsi->Ordering.data = pordering->value.const_bytes;
pcidsi->Ordering.size = r_size(pordering);
code = dict_int_param(prcidsi, "Supplement", 0, max_int, -1,
- &pcidsi->Supplement);
+ &pcidsi->Supplement);
return (code < 0 ? code : 0);
}
/* Convert a CID into TT char code or to TT glyph index. */
-static bool
-TT_char_code_from_CID_no_subst(const gs_memory_t *mem,
- const ref *Decoding, const ref *TT_cmap, uint nCID, uint *c)
+static bool
+TT_char_code_from_CID_no_subst(const gs_memory_t *mem,
+ const ref *Decoding, const ref *TT_cmap, uint nCID, uint *c)
{ ref *DecodingArray, char_code, char_code1, ih, *glyph_index;
bool found = false;
int i = nCID % 256, n;
make_int(&ih, nCID / 256);
- if (dict_find(Decoding, &ih, &DecodingArray) <= 0 ||
- !r_has_type(DecodingArray, t_array) ||
- array_get(mem, DecodingArray, i, &char_code) < 0)
- return false;
+ if (dict_find(Decoding, &ih, &DecodingArray) <= 0 ||
+ !r_has_type(DecodingArray, t_array) ||
+ array_get(mem, DecodingArray, i, &char_code) < 0)
+ return false;
if (r_has_type(&char_code, t_integer))
- n = 1;
+ n = 1;
else if (r_has_type(&char_code, t_array)) {
- DecodingArray = &char_code;
- i = 0;
- n = r_size(DecodingArray);
+ DecodingArray = &char_code;
+ i = 0;
+ n = r_size(DecodingArray);
} else
- return false; /* Must not happen. */
+ return false; /* Must not happen. */
for (;n--; i++) {
- if (array_get(mem, DecodingArray, i, &char_code1) < 0 ||
- !r_has_type(&char_code1, t_integer))
- return false; /* Must not happen. */
- if (dict_find(TT_cmap, &char_code1, &glyph_index) >= 0 &&
- r_has_type(glyph_index, t_integer)) {
- *c = glyph_index->value.intval;
- found = true;
- if (*c != 0)
- return true;
- }
+ if (array_get(mem, DecodingArray, i, &char_code1) < 0 ||
+ !r_has_type(&char_code1, t_integer))
+ return false; /* Must not happen. */
+ if (dict_find(TT_cmap, &char_code1, &glyph_index) >= 0 &&
+ r_has_type(glyph_index, t_integer)) {
+ *c = glyph_index->value.intval;
+ found = true;
+ if (*c != 0)
+ return true;
+ }
}
return found;
}
@@ -87,53 +87,53 @@ TT_char_code_from_CID_no_subst(const gs_memory_t *mem,
/* Convert a CID into a TT char code or into a TT glyph index, using SubstNWP. */
/* Returns 1 if a glyph presents, 0 if not, <0 if error. */
int
-cid_to_TT_charcode(const gs_memory_t *mem,
- const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP,
+cid_to_TT_charcode(const gs_memory_t *mem,
+ const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP,
uint nCID, uint *c, ref *src_type, ref *dst_type)
{
int SubstNWP_length = r_size(SubstNWP), i, code;
if (TT_char_code_from_CID_no_subst(mem, Decoding, TT_cmap, nCID, c)) {
- make_null(src_type);
- /* Leaving dst_type uninitialized. */
- return 1;
+ make_null(src_type);
+ /* Leaving dst_type uninitialized. */
+ return 1;
}
for (i = 0; i < SubstNWP_length; i += 5) {
ref rb, re, rs;
int nb, ne, ns;
-
- if ((code = array_get(mem, SubstNWP, i + 1, &rb)) < 0)
- return code;
+
+ if ((code = array_get(mem, SubstNWP, i + 1, &rb)) < 0)
+ return code;
if ((code = array_get(mem, SubstNWP, i + 2, &re)) < 0)
- return code;
+ return code;
if ((code = array_get(mem, SubstNWP, i + 3, &rs)) < 0)
- return code;
+ return code;
nb = rb.value.intval;
ne = re.value.intval;
ns = rs.value.intval;
if (nCID >= nb && nCID <= ne)
if (TT_char_code_from_CID_no_subst(mem, Decoding, TT_cmap, ns + (nCID - nb), c)) {
- if ((code = array_get(mem, SubstNWP, i + 0, src_type)) < 0)
- return code;
- if ((code = array_get(mem, SubstNWP, i + 4, dst_type)) < 0)
- return code;
+ if ((code = array_get(mem, SubstNWP, i + 0, src_type)) < 0)
+ return code;
+ if ((code = array_get(mem, SubstNWP, i + 4, dst_type)) < 0)
+ return code;
return 1;
- }
+ }
if (nCID >= ns && nCID <= ns + (ne - nb))
if (TT_char_code_from_CID_no_subst(mem, Decoding, TT_cmap, nb + (nCID - ns), c)) {
- if ((code = array_get(mem, SubstNWP, i + 0, dst_type)) < 0)
- return code;
- if ((code = array_get(mem, SubstNWP, i + 4, src_type)) < 0)
- return code;
+ if ((code = array_get(mem, SubstNWP, i + 0, dst_type)) < 0)
+ return code;
+ if ((code = array_get(mem, SubstNWP, i + 4, src_type)) < 0)
+ return code;
return 1;
- }
+ }
}
*c = 0;
return 0;
}
/* Set a CIDMap element. */
-static int
+static int
set_CIDMap_element(const gs_memory_t *mem, ref *CIDMap, uint cid, uint glyph_index)
{ /* Assuming the CIDMap is already type-checked. */
/* Assuming GDBytes == 2. */
@@ -143,17 +143,17 @@ set_CIDMap_element(const gs_memory_t *mem, ref *CIDMap, uint cid, uint glyph_ind
uchar *c;
if (glyph_index >= 65536)
- return_error(e_rangecheck); /* Can't store with GDBytes == 2. */
+ return_error(e_rangecheck); /* Can't store with GDBytes == 2. */
for (i = 0; i < count; i++) {
- array_get(mem, CIDMap, i, &s);
- size = r_size(&s) & ~1;
- if (offset < size) {
- c = s.value.bytes + offset;
- c[0] = (uchar)(glyph_index >> 8);
- c[1] = (uchar)(glyph_index & 255);
- break;
- }
- offset -= size;
+ array_get(mem, CIDMap, i, &s);
+ size = r_size(&s) & ~1;
+ if (offset < size) {
+ c = s.value.bytes + offset;
+ c[0] = (uchar)(glyph_index >> 8);
+ c[1] = (uchar)(glyph_index & 255);
+ break;
+ }
+ offset -= size;
}
/* We ignore the substitution if it goes out the CIDMap range.
It must not happen, except for empty Decoding elements */
@@ -162,82 +162,82 @@ set_CIDMap_element(const gs_memory_t *mem, ref *CIDMap, uint cid, uint glyph_ind
/* Create a CIDMap from a True Type cmap array, Decoding and SubstNWP. */
int
-cid_fill_CIDMap(const gs_memory_t *mem,
- const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP, int GDBytes,
+cid_fill_CIDMap(const gs_memory_t *mem,
+ const ref *Decoding, const ref *TT_cmap, const ref *SubstNWP, int GDBytes,
ref *CIDMap)
{ int dict_enum;
ref el[2];
int count, i;
if (GDBytes != 2)
- return_error(e_unregistered); /* Unimplemented. */
+ return_error(e_unregistered); /* Unimplemented. */
if (r_type(CIDMap) != t_array)
- return_error(e_unregistered); /* Unimplemented. It could be a single string. */
+ return_error(e_unregistered); /* Unimplemented. It could be a single string. */
count = r_size(CIDMap);
/* Checking the CIDMap structure correctness : */
for (i = 0; i < count; i++) {
- ref s;
- int code = array_get(mem, CIDMap, i, &s);
+ ref s;
+ int code = array_get(mem, CIDMap, i, &s);
- if (code < 0)
- return code;
- check_type(s, t_string); /* fixme : optimize with moving to TT_char_code_from_CID. */
+ if (code < 0)
+ return code;
+ check_type(s, t_string); /* fixme : optimize with moving to TT_char_code_from_CID. */
}
/* Compute the CIDMap : */
dict_enum = dict_first(Decoding);
for (;;) {
int index, count, i;
-
- if ((dict_enum = dict_next(Decoding, dict_enum, el)) == -1)
- break;
- if (!r_has_type(&el[0], t_integer))
- continue;
- if (!r_has_type(&el[1], t_array))
- return_error(e_typecheck);
- index = el[0].value.intval;
- count = r_size(&el[1]);
- for (i = 0; i < count; i++) {
- uint cid = index * 256 + i, glyph_index;
- ref src_type, dst_type;
- int code = cid_to_TT_charcode(mem, Decoding, TT_cmap, SubstNWP,
+
+ if ((dict_enum = dict_next(Decoding, dict_enum, el)) == -1)
+ break;
+ if (!r_has_type(&el[0], t_integer))
+ continue;
+ if (!r_has_type(&el[1], t_array))
+ return_error(e_typecheck);
+ index = el[0].value.intval;
+ count = r_size(&el[1]);
+ for (i = 0; i < count; i++) {
+ uint cid = index * 256 + i, glyph_index;
+ ref src_type, dst_type;
+ int code = cid_to_TT_charcode(mem, Decoding, TT_cmap, SubstNWP,
cid, &glyph_index, &src_type, &dst_type);
- if (code < 0)
- return code;
- if (code > 0) {
- code = set_CIDMap_element(mem, CIDMap, cid, glyph_index);
- if (code < 0)
- return code;
- }
- }
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ code = set_CIDMap_element(mem, CIDMap, cid, glyph_index);
+ if (code < 0)
+ return code;
+ }
+ }
}
return 0;
}
int
-cid_fill_Identity_CIDMap(const gs_memory_t *mem,
+cid_fill_Identity_CIDMap(const gs_memory_t *mem,
ref *CIDMap)
{ int count, i;
count = r_size(CIDMap);
if (count != 3)
- return_error(gs_error_rangecheck);
+ return_error(gs_error_rangecheck);
/* Checking the CIDMap structure correctness : */
for (i = 0; i < count; i++) {
- ref s;
- int code = array_get(mem, CIDMap, i, &s);
+ ref s;
+ int code = array_get(mem, CIDMap, i, &s);
- if (code < 0)
- return code;
- check_type(s, t_string); /* fixme : optimize with moving to TT_char_code_from_CID. */
+ if (code < 0)
+ return code;
+ check_type(s, t_string); /* fixme : optimize with moving to TT_char_code_from_CID. */
}
for (i=0; i < 255*255; i++) {
- int code;
+ int code;
- code = set_CIDMap_element(mem, CIDMap, i, i);
- if (code < 0)
- return code;
+ code = set_CIDMap_element(mem, CIDMap, i, i);
+ if (code < 0)
+ return code;
}
return 0;
}
diff --git a/gs/psi/zcidtest.c b/gs/psi/zcidtest.c
index 001952734..b54100f6b 100644
--- a/gs/psi/zcidtest.c
+++ b/gs/psi/zcidtest.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,40 +39,40 @@ zwrapfont(i_ctx_t *i_ctx_p)
switch (font->FontType) {
case ft_TrueType:
- code = gs_font_type0_from_type42(&font0, (gs_font_type42 *)font, wmode,
- true, font->memory);
- if (code < 0)
- return code;
- /*
- * Patch up BuildChar and CIDMap. This isn't necessary for
- * TrueType fonts in general, only for Type 42 fonts whose
- * BuildChar is implemented in PostScript code.
- */
- {
- font_data *pdata = pfont_data(font);
- const char *bgstr = "%Type11BuildGlyph";
- ref temp;
+ code = gs_font_type0_from_type42(&font0, (gs_font_type42 *)font, wmode,
+ true, font->memory);
+ if (code < 0)
+ return code;
+ /*
+ * Patch up BuildChar and CIDMap. This isn't necessary for
+ * TrueType fonts in general, only for Type 42 fonts whose
+ * BuildChar is implemented in PostScript code.
+ */
+ {
+ font_data *pdata = pfont_data(font);
+ const char *bgstr = "%Type11BuildGlyph";
+ ref temp;
- make_int(&temp, 0);
- ref_assign(&pdata->u.type42.CIDMap, &temp);
- code = name_ref((const byte *)bgstr, strlen(bgstr), &temp, 1);
- if (code < 0)
- return code;
- r_set_attrs(&temp, a_executable);
- ref_assign(&pdata->BuildGlyph, &temp);
- }
- break;
+ make_int(&temp, 0);
+ ref_assign(&pdata->u.type42.CIDMap, &temp);
+ code = name_ref((const byte *)bgstr, strlen(bgstr), &temp, 1);
+ if (code < 0)
+ return code;
+ r_set_attrs(&temp, a_executable);
+ ref_assign(&pdata->BuildGlyph, &temp);
+ }
+ break;
case ft_CID_encrypted:
case ft_CID_user_defined:
case ft_CID_TrueType:
- code = gs_font_type0_from_cidfont(&font0, font, wmode, NULL,
- font->memory);
- break;
+ code = gs_font_type0_from_cidfont(&font0, font, wmode, NULL,
+ font->memory);
+ break;
default:
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
}
if (code < 0)
- return code;
+ return code;
gs_setfont(igs, (gs_font *)font0);
return 0;
}
@@ -96,14 +96,14 @@ zwritecmap(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
if (dict_find_string(op, "CodeMap", &pcodemap) <= 0 ||
- !r_is_struct(pcodemap)
- )
- return_error(e_typecheck);
+ !r_is_struct(pcodemap)
+ )
+ return_error(e_typecheck);
check_write_file(s, op - 1);
pcmap = r_ptr(pcodemap, gs_cmap_t);
code = psf_write_cmap(s, pcmap, zfcmap_put_name_default, NULL, -1);
if (code >= 0)
- pop(2);
+ pop(2);
return code;
}
@@ -118,16 +118,16 @@ zwritefont9(i_ctx_t *i_ctx_p)
stream *s;
if (code < 0)
- return code;
+ return code;
if (pfont->FontType != ft_CID_encrypted)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
check_write_file(s, op - 1);
pfcid = (gs_font_cid0 *)pfont;
code = psf_write_cid0_font(s, pfcid,
- WRITE_TYPE2_NO_LENIV | WRITE_TYPE2_CHARSTRINGS,
- NULL, 0, NULL);
+ WRITE_TYPE2_NO_LENIV | WRITE_TYPE2_CHARSTRINGS,
+ NULL, 0, NULL);
if (code >= 0)
- pop(2);
+ pop(2);
return code;
}
diff --git a/gs/psi/zcie.c b/gs/psi/zcie.c
index 6b9060f06..26f0b9ac6 100644
--- a/gs/psi/zcie.c
+++ b/gs/psi/zcie.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,15 +37,15 @@
/* Prototype */
int cieicc_prepare_caches(i_ctx_t *i_ctx_p, const gs_range * domains,
- const ref * procs,
- cie_cache_floats * pc0, cie_cache_floats * pc1,
- cie_cache_floats * pc2, cie_cache_floats * pc3,
- void *container,
- const gs_ref_memory_t * imem, client_name_t cname);
+ const ref * procs,
+ cie_cache_floats * pc0, cie_cache_floats * pc1,
+ cie_cache_floats * pc2, cie_cache_floats * pc3,
+ void *container,
+ const gs_ref_memory_t * imem, client_name_t cname);
static int
cie_prepare_iccproc(i_ctx_t *i_ctx_p, const gs_range * domain, const ref * proc,
- cie_cache_floats * pcache, void *container,
- const gs_ref_memory_t * imem, client_name_t cname);
+ cie_cache_floats * pcache, void *container,
+ const gs_ref_memory_t * imem, client_name_t cname);
/* Empty procedures */
static const ref empty_procs[4] =
@@ -62,16 +62,16 @@ static const ref empty_procs[4] =
/* We know that count <= 4. */
int
dict_ranges_param(const gs_memory_t *mem,
- const ref * pdref, const char *kstr, int count,
- gs_range * prange)
+ const ref * pdref, const char *kstr, int count,
+ gs_range * prange)
{
int code = dict_floats_param(mem, pdref, kstr, count * 2,
- (float *)prange, NULL);
+ (float *)prange, NULL);
if (code < 0)
- return code;
+ return code;
else if (code == 0)
- memcpy(prange, Range4_default.ranges, count * sizeof(gs_range));
+ memcpy(prange, Range4_default.ranges, count * sizeof(gs_range));
return 0;
}
@@ -79,28 +79,28 @@ dict_ranges_param(const gs_memory_t *mem,
/* We know count <= countof(empty_procs). */
int
dict_proc_array_param(const gs_memory_t *mem,
- const ref *pdict, const char *kstr,
- uint count, ref *pparray)
+ const ref *pdict, const char *kstr,
+ uint count, ref *pparray)
{
ref *pvalue;
if (dict_find_string(pdict, kstr, &pvalue) > 0) {
- uint i;
-
- check_array_only(*pvalue);
- if (r_size(pvalue) != count)
- return_error(e_rangecheck);
- for (i = 0; i < count; i++) {
- ref proc;
-
- array_get(mem, pvalue, (long)i, &proc);
- check_proc_only(proc);
- }
- *pparray = *pvalue;
+ uint i;
+
+ check_array_only(*pvalue);
+ if (r_size(pvalue) != count)
+ return_error(e_rangecheck);
+ for (i = 0; i < count; i++) {
+ ref proc;
+
+ array_get(mem, pvalue, (long)i, &proc);
+ check_proc_only(proc);
+ }
+ *pparray = *pvalue;
return 0;
} else {
- make_const_array(pparray, a_readonly | avm_foreign,
- count, &empty_procs[0]);
+ make_const_array(pparray, a_readonly | avm_foreign,
+ count, &empty_procs[0]);
return 1;
}
}
@@ -108,8 +108,8 @@ dict_proc_array_param(const gs_memory_t *mem,
/* Get 3 ranges from a dictionary. */
int
dict_range3_param(const gs_memory_t *mem,
- const ref *pdref, const char *kstr,
- gs_range3 *prange3)
+ const ref *pdref, const char *kstr,
+ gs_range3 *prange3)
{
return dict_ranges_param(mem, pdref, kstr, 3, prange3->ranges);
}
@@ -117,7 +117,7 @@ dict_range3_param(const gs_memory_t *mem,
/* Get a 3x3 matrix from a dictionary. */
int
dict_matrix3_param(const gs_memory_t *mem,
- const ref *pdref, const char *kstr, gs_matrix3 *pmat3)
+ const ref *pdref, const char *kstr, gs_matrix3 *pmat3)
{
/*
* We can't simply call dict_float_array_param with the matrix
@@ -133,7 +133,7 @@ dict_matrix3_param(const gs_memory_t *mem,
memcpy(&defaults[6], &Matrix3_default.cw, 3 * sizeof(float));
code = dict_floats_param(mem, pdref, kstr, 9, values, defaults);
if (code < 0)
- return code;
+ return code;
memcpy(&pmat3->cu, &values[0], 3 * sizeof(float));
memcpy(&pmat3->cv, &values[3], 3 * sizeof(float));
memcpy(&pmat3->cw, &values[6], 3 * sizeof(float));
@@ -149,25 +149,25 @@ dict_proc3_param(const gs_memory_t *mem, const ref *pdref, const char *kstr, ref
/* Get WhitePoint and BlackPoint values. */
int
-cie_points_param(const gs_memory_t *mem,
- const ref * pdref, gs_cie_wb * pwb)
+cie_points_param(const gs_memory_t *mem,
+ const ref * pdref, gs_cie_wb * pwb)
{
int code;
- if ((code = dict_floats_param(mem, pdref, "WhitePoint", 3,
+ if ((code = dict_floats_param(mem, pdref, "WhitePoint", 3,
(float *)&pwb->WhitePoint, NULL)) < 0 ||
- (code = dict_floats_param(mem, pdref, "BlackPoint", 3,
+ (code = dict_floats_param(mem, pdref, "BlackPoint", 3,
(float *)&pwb->BlackPoint, (const float *)&BlackPoint_default)) < 0
- )
- return code;
+ )
+ return code;
if (pwb->WhitePoint.u <= 0 ||
- pwb->WhitePoint.v != 1 ||
- pwb->WhitePoint.w <= 0 ||
- pwb->BlackPoint.u < 0 ||
- pwb->BlackPoint.v < 0 ||
- pwb->BlackPoint.w < 0
- )
- return_error(e_rangecheck);
+ pwb->WhitePoint.v != 1 ||
+ pwb->WhitePoint.w <= 0 ||
+ pwb->BlackPoint.u < 0 ||
+ pwb->BlackPoint.v < 0 ||
+ pwb->BlackPoint.w < 0
+ )
+ return_error(e_rangecheck);
return 0;
}
@@ -175,10 +175,10 @@ cie_points_param(const gs_memory_t *mem,
/* The caller has set pclt->n and pclt->m. */
/* ptref is known to be a readable array of size at least n+1. */
static int cie_3d_table_param(const ref * ptable, uint count, uint nbytes,
- gs_const_string * strings);
+ gs_const_string * strings);
int
cie_table_param(const ref * ptref, gx_color_lookup_table * pclt,
- const gs_memory_t * mem)
+ const gs_memory_t * mem)
{
int n = pclt->n, m = pclt->m;
const ref *pta = ptref->value.const_refs;
@@ -188,69 +188,69 @@ cie_table_param(const ref * ptref, gx_color_lookup_table * pclt,
gs_const_string *table;
for (i = 0; i < n; ++i) {
- check_type_only(pta[i], t_integer);
- if (pta[i].value.intval <= 1 || pta[i].value.intval > max_ushort)
- return_error(e_rangecheck);
- pclt->dims[i] = (int)pta[i].value.intval;
+ check_type_only(pta[i], t_integer);
+ if (pta[i].value.intval <= 1 || pta[i].value.intval > max_ushort)
+ return_error(e_rangecheck);
+ pclt->dims[i] = (int)pta[i].value.intval;
}
nbytes = m * pclt->dims[n - 2] * pclt->dims[n - 1];
if (n == 3) {
- table =
- gs_alloc_struct_array(mem->stable_memory, pclt->dims[0], gs_const_string,
- &st_const_string_element, "cie_table_param");
- if (table == 0)
- return_error(e_VMerror);
- code = cie_3d_table_param(pta + 3, pclt->dims[0], nbytes, table);
+ table =
+ gs_alloc_struct_array(mem->stable_memory, pclt->dims[0], gs_const_string,
+ &st_const_string_element, "cie_table_param");
+ if (table == 0)
+ return_error(e_VMerror);
+ code = cie_3d_table_param(pta + 3, pclt->dims[0], nbytes, table);
} else { /* n == 4 */
- int d0 = pclt->dims[0], d1 = pclt->dims[1];
- uint ntables = d0 * d1;
- const ref *psuba;
-
- check_read_type(pta[4], t_array);
- if (r_size(pta + 4) != d0)
- return_error(e_rangecheck);
- table =
- gs_alloc_struct_array(mem->stable_memory, ntables, gs_const_string,
- &st_const_string_element, "cie_table_param");
- if (table == 0)
- return_error(e_VMerror);
- psuba = pta[4].value.const_refs;
- /*
- * We know that d0 > 0, so code will always be set in the loop:
- * we initialize code to 0 here solely to pacify stupid compilers.
- */
- for (code = 0, i = 0; i < d0; ++i) {
- code = cie_3d_table_param(psuba + i, d1, nbytes, table + d1 * i);
- if (code < 0)
- break;
- }
+ int d0 = pclt->dims[0], d1 = pclt->dims[1];
+ uint ntables = d0 * d1;
+ const ref *psuba;
+
+ check_read_type(pta[4], t_array);
+ if (r_size(pta + 4) != d0)
+ return_error(e_rangecheck);
+ table =
+ gs_alloc_struct_array(mem->stable_memory, ntables, gs_const_string,
+ &st_const_string_element, "cie_table_param");
+ if (table == 0)
+ return_error(e_VMerror);
+ psuba = pta[4].value.const_refs;
+ /*
+ * We know that d0 > 0, so code will always be set in the loop:
+ * we initialize code to 0 here solely to pacify stupid compilers.
+ */
+ for (code = 0, i = 0; i < d0; ++i) {
+ code = cie_3d_table_param(psuba + i, d1, nbytes, table + d1 * i);
+ if (code < 0)
+ break;
+ }
}
if (code < 0) {
- gs_free_object(mem, table, "cie_table_param");
- return code;
+ gs_free_object(mem, table, "cie_table_param");
+ return code;
}
pclt->table = table;
return 0;
}
static int
cie_3d_table_param(const ref * ptable, uint count, uint nbytes,
- gs_const_string * strings)
+ gs_const_string * strings)
{
const ref *rstrings;
uint i;
check_read_type(*ptable, t_array);
if (r_size(ptable) != count)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
rstrings = ptable->value.const_refs;
for (i = 0; i < count; ++i) {
- const ref *const prt2 = rstrings + i;
+ const ref *const prt2 = rstrings + i;
- check_read_type(*prt2, t_string);
- if (r_size(prt2) != nbytes)
- return_error(e_rangecheck);
- strings[i].data = prt2->value.const_bytes;
- strings[i].size = nbytes;
+ check_read_type(*prt2, t_string);
+ if (r_size(prt2) != nbytes)
+ return_error(e_rangecheck);
+ strings[i].data = prt2->value.const_bytes;
+ strings[i].size = nbytes;
}
return 0;
}
@@ -259,77 +259,77 @@ cie_3d_table_param(const ref * ptable, uint count, uint nbytes,
/* Common code for the CIEBased* cases of setcolorspace. */
static int
-cie_lmnp_param(const gs_memory_t *mem, const ref * pdref, gs_cie_common * pcie,
+cie_lmnp_param(const gs_memory_t *mem, const ref * pdref, gs_cie_common * pcie,
ref_cie_procs * pcprocs, bool *has_lmn_procs)
{
int code;
if ((code = dict_range3_param(mem, pdref, "RangeLMN", &pcie->RangeLMN)) < 0 ||
- (code = dict_matrix3_param(mem, pdref, "MatrixLMN", &pcie->MatrixLMN)) < 0 ||
- (code = cie_points_param(mem, pdref, &pcie->points)) < 0
- )
- return code;
+ (code = dict_matrix3_param(mem, pdref, "MatrixLMN", &pcie->MatrixLMN)) < 0 ||
+ (code = cie_points_param(mem, pdref, &pcie->points)) < 0
+ )
+ return code;
code = dict_proc3_param(mem, pdref, "DecodeLMN", &pcprocs->DecodeLMN);
if (code < 0)
return code;
- *has_lmn_procs = !code; /* Need to know for efficient creation of ICC profile */
+ *has_lmn_procs = !code; /* Need to know for efficient creation of ICC profile */
pcie->DecodeLMN = DecodeLMN_default;
return 0;
}
/* Get objects associated with cie color space */
static int
-cie_a_param(const gs_memory_t *mem, const ref * pdref, gs_cie_a * pcie,
+cie_a_param(const gs_memory_t *mem, const ref * pdref, gs_cie_a * pcie,
ref_cie_procs * pcprocs, bool *has_a_procs, bool *has_lmn_procs)
{
int code;
- code = dict_floats_param(mem, pdref, "RangeA", 2, (float *)&pcie->RangeA,
+ code = dict_floats_param(mem, pdref, "RangeA", 2, (float *)&pcie->RangeA,
(const float *)&RangeA_default);
if (code < 0)
- return code;
- code = dict_floats_param(mem, pdref, "MatrixA", 3, (float *)&pcie->MatrixA,
+ return code;
+ code = dict_floats_param(mem, pdref, "MatrixA", 3, (float *)&pcie->MatrixA,
(const float *)&MatrixA_default);
if (code < 0)
- return code;
+ return code;
code = cie_lmnp_param(mem, pdref, &pcie->common, pcprocs, has_lmn_procs);
if (code < 0)
- return code;
+ return code;
if ((code = dict_proc_param(pdref, "DecodeA", &(pcprocs->Decode.A), true)) < 0)
- return code;
+ return code;
*has_a_procs = !code;
return 0;
}
/* Common code for the CIEBasedABC/DEF[G] cases of setcolorspace. */
static int
-cie_abc_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
- gs_cie_abc * pcie, ref_cie_procs * pcprocs,
+cie_abc_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
+ gs_cie_abc * pcie, ref_cie_procs * pcprocs,
bool *has_abc_procs, bool *has_lmn_procs)
{
int code;
gs_ref_memory_t *imem = (gs_ref_memory_t *)mem;
if ((code = dict_range3_param(mem, pdref, "RangeABC", &pcie->RangeABC)) < 0 ||
- (code = dict_matrix3_param(mem, pdref, "MatrixABC", &pcie->MatrixABC)) < 0 ||
- (code = cie_lmnp_param(mem, pdref, &pcie->common, pcprocs, has_lmn_procs)) < 0
- )
- return code;
+ (code = dict_matrix3_param(mem, pdref, "MatrixABC", &pcie->MatrixABC)) < 0 ||
+ (code = cie_lmnp_param(mem, pdref, &pcie->common, pcprocs, has_lmn_procs)) < 0
+ )
+ return code;
code = dict_proc3_param(mem, pdref, "DecodeABC", &pcprocs->Decode.ABC);
if (code < 0)
return code;
*has_abc_procs = !code;
pcie->DecodeABC = DecodeABC_default;
- /* At this point, we have all the parameters in pcie including knowing if
+ /* At this point, we have all the parameters in pcie including knowing if
there
are procedures present. If there are no procedures, life is simple for us.
- If there are procedures, we can not create the ICC profile until we have the procedures
- sampled, which requires pushing the appropriate commands upon the postscript execution stack
+ If there are procedures, we can not create the ICC profile until we have the procedures
+ sampled, which requires pushing the appropriate commands upon the postscript execution stack
to create the sampled procs and then having a follow up operation to create the ICC profile.
Because the procs may have to be merged with other operators and/or packed
in a particular form, we will have the PS operators stuff them in the already
existing static buffers that already exist for this purpose in the cie structures
- e.g. gx_cie_vector_cache3_t that are in the common (params.abc.common.caches.DecodeLMN)
+ e.g. gx_cie_vector_cache3_t that are in the common (params.abc.common.caches.DecodeLMN)
and unique entries (e.g. params.abc.caches.DecodeABC.caches) */
if (*has_abc_procs) {
cieicc_prepare_caches(i_ctx_p, (&pcie->RangeABC)->ranges,
@@ -345,7 +345,7 @@ cie_abc_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
}
if (*has_lmn_procs) {
cieicc_prepare_caches(i_ctx_p, (&pcie->common.RangeLMN)->ranges,
- pcprocs->DecodeLMN.value.const_refs,
+ pcprocs->DecodeLMN.value.const_refs,
&(pcie->common.caches.DecodeLMN)->floats,
&(pcie->common.caches.DecodeLMN)[1].floats,
&(pcie->common.caches.DecodeLMN)[2].floats,
@@ -361,15 +361,15 @@ cie_abc_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
/* Finish setting a CIE space (successful or not). */
int
cie_set_finish(i_ctx_t *i_ctx_p, gs_color_space * pcs,
- const ref_cie_procs * pcprocs, int edepth, int code)
+ const ref_cie_procs * pcprocs, int edepth, int code)
{
if (code >= 0)
- code = gs_setcolorspace(igs, pcs);
+ code = gs_setcolorspace(igs, pcs);
/* Delete the extra reference to the parameter tables. */
rc_decrement_only_cs(pcs, "cie_set_finish");
if (code < 0) {
- ref_stack_pop_to(&e_stack, edepth);
- return code;
+ ref_stack_pop_to(&e_stack, edepth);
+ return code;
}
istate->colorspace[0].procs.cie = *pcprocs;
pop(1);
@@ -378,37 +378,37 @@ cie_set_finish(i_ctx_t *i_ctx_p, gs_color_space * pcs,
/* Forward references */
static int cache_common(i_ctx_t *, gs_cie_common *, const ref_cie_procs *,
- void *, gs_ref_memory_t *);
+ void *, gs_ref_memory_t *);
static int cache_abc_common(i_ctx_t *, gs_cie_abc *, const ref_cie_procs *,
- void *, gs_ref_memory_t *);
+ void *, gs_ref_memory_t *);
static int cie_defg_finish(i_ctx_t *);
static int
-cie_defg_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
- gs_cie_defg * pcie, ref_cie_procs * pcprocs, bool *has_abc_procs,
+cie_defg_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
+ gs_cie_defg * pcie, ref_cie_procs * pcprocs, bool *has_abc_procs,
bool *has_lmn_procs, bool *has_defg_procs, ref *ptref)
{
- int code;
+ int code;
gs_ref_memory_t *imem = (gs_ref_memory_t *)mem;
/* First get all the ABC and LMN information related to this space */
- code = cie_abc_param(i_ctx_p, mem, pdref, (gs_cie_abc *) pcie, pcprocs,
+ code = cie_abc_param(i_ctx_p, mem, pdref, (gs_cie_abc *) pcie, pcprocs,
has_abc_procs, has_lmn_procs);
- if (code < 0)
+ if (code < 0)
return code;
code = dict_ranges_param(mem, pdref, "RangeDEFG", 4, pcie->RangeDEFG.ranges);
- if (code < 0)
+ if (code < 0)
return code;
code = dict_ranges_param(mem, pdref, "RangeHIJK", 4, pcie->RangeHIJK.ranges);
- if (code < 0)
+ if (code < 0)
return code;
code = cie_table_param(ptref, &pcie->Table, mem);
- if (code < 0)
+ if (code < 0)
return code;
- code = dict_proc_array_param(mem, pdref, "DecodeDEFG", 4,
+ code = dict_proc_array_param(mem, pdref, "DecodeDEFG", 4,
&(pcprocs->PreDecode.DEFG));
- if (code < 0)
+ if (code < 0)
return code;
*has_defg_procs = !code;
if (*has_defg_procs) {
@@ -447,19 +447,19 @@ ciedefgspace(i_ctx_t *i_ctx_p, ref *CIEDict, ulong dictkey)
procs = istate->colorspace[0].procs.cie;
if (pcs == NULL ) {
if ((code = dict_find_string(CIEDict, "Table", &ptref)) <= 0)
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
check_read_type(*ptref, t_array);
if (r_size(ptref) != 5)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Stable memory due to current caching of color space */
code = gs_cspace_build_CIEDEFG(&pcs, NULL, mem->stable_memory);
if (code < 0)
- return code;
+ return code;
pcie = pcs->params.defg;
pcie->Table.n = 4;
pcie->Table.m = 3;
code = cie_cache_push_finish(i_ctx_p, cie_defg_finish, imem, pcie);
- code = cie_defg_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
+ code = cie_defg_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
&has_abc_procs, &has_lmn_procs, &has_defg_procs,ptref);
/* Add the color space to the profile cache */
gsicc_add_cs(igs, pcs,dictkey);
@@ -484,24 +484,24 @@ cie_defg_finish(i_ctx_t *i_ctx_p)
}
static int
-cie_def_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
- gs_cie_def * pcie, ref_cie_procs * pcprocs,
- bool *has_abc_procs, bool *has_lmn_procs,
+cie_def_param(i_ctx_t *i_ctx_p, const gs_memory_t *mem, const ref * pdref,
+ gs_cie_def * pcie, ref_cie_procs * pcprocs,
+ bool *has_abc_procs, bool *has_lmn_procs,
bool *has_def_procs, ref *ptref)
{
- int code;
+ int code;
gs_ref_memory_t *imem = (gs_ref_memory_t *)mem;
/* First get all the ABC and LMN information related to this space */
- code = cie_abc_param(i_ctx_p, mem, pdref, (gs_cie_abc *) pcie, pcprocs,
+ code = cie_abc_param(i_ctx_p, mem, pdref, (gs_cie_abc *) pcie, pcprocs,
has_abc_procs, has_lmn_procs);
- if (code < 0)
+ if (code < 0)
return code;
code = dict_range3_param(mem, pdref, "RangeDEF", &pcie->RangeDEF);
- if (code < 0)
+ if (code < 0)
return code;
code = dict_range3_param(mem, pdref, "RangeHIJ", &pcie->RangeHIJ);
- if (code < 0)
+ if (code < 0)
return code;
code = cie_table_param(ptref, &pcie->Table, mem);
if (code < 0)
@@ -547,19 +547,19 @@ ciedefspace(i_ctx_t *i_ctx_p, ref *CIEDict, ulong dictkey)
procs = istate->colorspace[0].procs.cie;
if (pcs == NULL ) {
if ((code = dict_find_string(CIEDict, "Table", &ptref)) <= 0)
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
check_read_type(*ptref, t_array);
if (r_size(ptref) != 4)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Stable memory due to current caching of color space */
code = gs_cspace_build_CIEDEF(&pcs, NULL, mem->stable_memory);
if (code < 0)
- return code;
+ return code;
pcie = pcs->params.def;
pcie->Table.n = 3;
pcie->Table.m = 3;
code = cie_cache_push_finish(i_ctx_p, cie_def_finish, imem, pcie);
- code = cie_def_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
+ code = cie_def_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
&has_abc_procs, &has_lmn_procs, &has_def_procs, ptref);
/* Add the color space to the profile cache */
gsicc_add_cs(igs, pcs,dictkey);
@@ -607,16 +607,16 @@ cieabcspace(i_ctx_t *i_ctx_p, ref *CIEDict, ulong dictkey)
/* Stable memory due to current caching of color space */
code = gs_cspace_build_CIEABC(&pcs, NULL, mem->stable_memory);
if (code < 0)
- return code;
+ return code;
pcie = pcs->params.abc;
code = cie_cache_push_finish(i_ctx_p, cie_abc_finish, imem, pcie);
- code = cie_abc_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
+ code = cie_abc_param(i_ctx_p, imemory, CIEDict, pcie, &procs,
&has_abc_procs, &has_lmn_procs);
- /* Set the color space in the graphic state. The ICC profile
- will be set later if we actually use the space. Procs will be
+ /* Set the color space in the graphic state. The ICC profile
+ will be set later if we actually use the space. Procs will be
sampled now though. Also, the finish procedure is on the stack
since that is where the vector cache is completed from the scalar
- caches. We may need the vector cache if we are going to go
+ caches. We may need the vector cache if we are going to go
ahead and create an MLUT for this thing */
/* Add the color space to the profile cache */
gsicc_add_cs(igs, pcs,dictkey);
@@ -664,9 +664,9 @@ cieaspace(i_ctx_t *i_ctx_p, ref *CIEdict, ulong dictkey)
/* Stable memory due to current caching of color space */
code = gs_cspace_build_CIEA(&pcs, NULL, mem->stable_memory);
if (code < 0)
- return code;
+ return code;
pcie = pcs->params.a;
- code = cie_a_param(imemory, CIEdict, pcie, &procs, &has_a_procs,
+ code = cie_a_param(imemory, CIEdict, pcie, &procs, &has_a_procs,
&has_lmn_procs);
/* Push finalize procedure on the execution stack */
code = cie_cache_push_finish(i_ctx_p, cie_a_finish, imem, pcie);
@@ -678,14 +678,14 @@ cieaspace(i_ctx_t *i_ctx_p, ref *CIEdict, ulong dictkey)
pcie->caches.DecodeA.floats.params.is_identity = true;
} else {
if (has_a_procs) {
- code = cie_prepare_iccproc(i_ctx_p, &pcie->RangeA,
+ code = cie_prepare_iccproc(i_ctx_p, &pcie->RangeA,
&procs.Decode.A, &pcie->caches.DecodeA.floats, pcie, imem, "Decode.A");
} else {
pcie->caches.DecodeA.floats.params.is_identity = true;
}
if (has_lmn_procs) {
cieicc_prepare_caches(i_ctx_p, (&pcie->common.RangeLMN)->ranges,
- procs.DecodeLMN.value.const_refs,
+ procs.DecodeLMN.value.const_refs,
&(pcie->common.caches.DecodeLMN)->floats,
&(pcie->common.caches.DecodeLMN)[1].floats,
&(pcie->common.caches.DecodeLMN)[2].floats,
@@ -723,28 +723,28 @@ cie_a_finish(i_ctx_t *i_ctx_p)
static int
cache_abc_common(i_ctx_t *i_ctx_p, gs_cie_abc * pcie,
- const ref_cie_procs * pcprocs,
- void *container, gs_ref_memory_t * imem)
+ const ref_cie_procs * pcprocs,
+ void *container, gs_ref_memory_t * imem)
{
int code =
- cie_prepare_cache3(i_ctx_p, &pcie->RangeABC,
- pcprocs->Decode.ABC.value.const_refs,
- pcie->caches.DecodeABC.caches, pcie, imem,
- "Decode.ABC");
+ cie_prepare_cache3(i_ctx_p, &pcie->RangeABC,
+ pcprocs->Decode.ABC.value.const_refs,
+ pcie->caches.DecodeABC.caches, pcie, imem,
+ "Decode.ABC");
return (code < 0 ? code :
- cache_common(i_ctx_p, &pcie->common, pcprocs, pcie, imem));
+ cache_common(i_ctx_p, &pcie->common, pcprocs, pcie, imem));
}
static int
cache_common(i_ctx_t *i_ctx_p, gs_cie_common * pcie,
- const ref_cie_procs * pcprocs,
- void *container, gs_ref_memory_t * imem)
+ const ref_cie_procs * pcprocs,
+ void *container, gs_ref_memory_t * imem)
{
return cie_prepare_cache3(i_ctx_p, &pcie->RangeLMN,
- pcprocs->DecodeLMN.value.const_refs,
- &pcie->caches.DecodeLMN[0], container, imem,
- "Decode.LMN");
+ pcprocs->DecodeLMN.value.const_refs,
+ &pcie->caches.DecodeLMN[0], container, imem,
+ "Decode.LMN");
}
/* ------ Internal routines ------ */
@@ -757,8 +757,8 @@ cache_common(i_ctx_t *i_ctx_p, gs_cie_common * pcie,
static int cie_cache_finish(i_ctx_t *);
int
cie_prepare_cache(i_ctx_t *i_ctx_p, const gs_range * domain, const ref * proc,
- cie_cache_floats * pcache, void *container,
- gs_ref_memory_t * imem, client_name_t cname)
+ cie_cache_floats * pcache, void *container,
+ gs_ref_memory_t * imem, client_name_t cname)
{
int space = imemory_space(imem);
gs_sample_loop_params_t lp;
@@ -789,23 +789,23 @@ cie_prepare_cache(i_ctx_t *i_ctx_p, const gs_range * domain, const ref * proc,
/* Note that pc3 may be 0, indicating that there are only 3 caches to load. */
int
cie_prepare_caches_4(i_ctx_t *i_ctx_p, const gs_range * domains,
- const ref * procs,
- cie_cache_floats * pc0, cie_cache_floats * pc1,
- cie_cache_floats * pc2, cie_cache_floats * pc3,
- void *container,
- gs_ref_memory_t * imem, client_name_t cname)
+ const ref * procs,
+ cie_cache_floats * pc0, cie_cache_floats * pc1,
+ cie_cache_floats * pc2, cie_cache_floats * pc3,
+ void *container,
+ gs_ref_memory_t * imem, client_name_t cname)
{
cie_cache_floats *pcn[4];
int i, n, code = 0;
pcn[0] = pc0, pcn[1] = pc1, pcn[2] = pc2;
if (pc3 == 0)
- n = 3;
+ n = 3;
else
- pcn[3] = pc3, n = 4;
+ pcn[3] = pc3, n = 4;
for (i = 0; i < n && code >= 0; ++i)
- code = cie_prepare_cache(i_ctx_p, domains + i, procs + i, pcn[i],
- container, imem, cname);
+ code = cie_prepare_cache(i_ctx_p, domains + i, procs + i, pcn[i],
+ container, imem, cname);
return code;
}
@@ -824,30 +824,30 @@ cie_cache_finish_store(i_ctx_t *i_ctx_p, bool replicate)
pcache->params.is_identity = false; /* cache_set_linear computes this */
if_debug3('c', "[c]cache 0x%lx base=%g, factor=%g:\n",
- (ulong) pcache, pcache->params.base, pcache->params.factor);
+ (ulong) pcache, pcache->params.base, pcache->params.factor);
if (replicate ||
- (code = float_params(op, gx_cie_cache_size, &pcache->values[0])) < 0
- ) {
- /* We might have underflowed the current stack block. */
- /* Handle the parameters one-by-one. */
- uint i;
-
- for (i = 0; i < gx_cie_cache_size; i++) {
- code = float_param(ref_stack_index(&o_stack,
- (replicate ? 0 : gx_cie_cache_size - 1 - i)),
- &pcache->values[i]);
- if (code < 0)
- return code;
- }
+ (code = float_params(op, gx_cie_cache_size, &pcache->values[0])) < 0
+ ) {
+ /* We might have underflowed the current stack block. */
+ /* Handle the parameters one-by-one. */
+ uint i;
+
+ for (i = 0; i < gx_cie_cache_size; i++) {
+ code = float_param(ref_stack_index(&o_stack,
+ (replicate ? 0 : gx_cie_cache_size - 1 - i)),
+ &pcache->values[i]);
+ if (code < 0)
+ return code;
+ }
}
#ifdef DEBUG
if (gs_debug_c('c')) {
- int i;
+ int i;
- for (i = 0; i < gx_cie_cache_size; i += 4)
- dlprintf5("[c] cache[%3d]=%g, %g, %g, %g\n", i,
- pcache->values[i], pcache->values[i + 1],
- pcache->values[i + 2], pcache->values[i + 3]);
+ for (i = 0; i < gx_cie_cache_size; i += 4)
+ dlprintf5("[c] cache[%3d]=%g, %g, %g, %g\n", i,
+ pcache->values[i], pcache->values[i + 1],
+ pcache->values[i + 2], pcache->values[i + 3]);
}
#endif
ref_stack_pop(&o_stack, (replicate ? 1 : gx_cie_cache_size));
@@ -872,7 +872,7 @@ cie_cache_finish1(i_ctx_t *i_ctx_p)
/* ptr will be the top element of the o-stack. */
int
cie_cache_push_finish(i_ctx_t *i_ctx_p, op_proc_t finish_proc,
- gs_ref_memory_t * imem, void *data)
+ gs_ref_memory_t * imem, void *data)
{
check_estack(2);
push_op_estack(finish_proc);
@@ -892,8 +892,8 @@ cie_cache_push_finish(i_ctx_t *i_ctx_p, op_proc_t finish_proc,
static int cie_create_icc(i_ctx_t *);
static int
cie_prepare_iccproc(i_ctx_t *i_ctx_p, const gs_range * domain, const ref * proc,
- cie_cache_floats * pcache, void *container,
- const gs_ref_memory_t * imem, client_name_t cname)
+ cie_cache_floats * pcache, void *container,
+ const gs_ref_memory_t * imem, client_name_t cname)
{
int space = imemory_space(imem);
gs_sample_loop_params_t lp;
@@ -924,23 +924,23 @@ cie_prepare_iccproc(i_ctx_t *i_ctx_p, const gs_range * domain, const ref * proc,
int
cieicc_prepare_caches(i_ctx_t *i_ctx_p, const gs_range * domains,
- const ref * procs,
- cie_cache_floats * pc0, cie_cache_floats * pc1,
- cie_cache_floats * pc2, cie_cache_floats * pc3,
- void *container,
- const gs_ref_memory_t * imem, client_name_t cname)
+ const ref * procs,
+ cie_cache_floats * pc0, cie_cache_floats * pc1,
+ cie_cache_floats * pc2, cie_cache_floats * pc3,
+ void *container,
+ const gs_ref_memory_t * imem, client_name_t cname)
{
cie_cache_floats *pcn[4];
int i, n, code = 0;
pcn[0] = pc0, pcn[1] = pc1, pcn[2] = pc2;
if (pc3 == 0)
- n = 3;
+ n = 3;
else
- pcn[3] = pc3, n = 4;
+ pcn[3] = pc3, n = 4;
for (i = 0; i < n && code >= 0; ++i)
- code = cie_prepare_iccproc(i_ctx_p, domains + i, procs + i, pcn[i],
- container, imem, cname);
+ code = cie_prepare_iccproc(i_ctx_p, domains + i, procs + i, pcn[i],
+ container, imem, cname);
return code;
}
@@ -959,27 +959,27 @@ cie_create_icc(i_ctx_t *i_ctx_p)
pcache->params.is_identity = false; /* cache_set_linear computes this */
if_debug3('c', "[c]icc_sample_proc 0x%lx base=%g, factor=%g:\n",
- (ulong) pcache, pcache->params.base, pcache->params.factor);
+ (ulong) pcache, pcache->params.base, pcache->params.factor);
if ((code = float_params(op, gx_cie_cache_size, &pcache->values[0])) < 0) {
- /* We might have underflowed the current stack block. */
- /* Handle the parameters one-by-one. */
- uint i;
-
- for (i = 0; i < gx_cie_cache_size; i++) {
- code = float_param(ref_stack_index(&o_stack,gx_cie_cache_size - 1 - i),
- &pcache->values[i]);
- if (code < 0)
- return code;
- }
+ /* We might have underflowed the current stack block. */
+ /* Handle the parameters one-by-one. */
+ uint i;
+
+ for (i = 0; i < gx_cie_cache_size; i++) {
+ code = float_param(ref_stack_index(&o_stack,gx_cie_cache_size - 1 - i),
+ &pcache->values[i]);
+ if (code < 0)
+ return code;
+ }
}
#ifdef DEBUG
if (gs_debug_c('c')) {
- int i;
+ int i;
- for (i = 0; i < gx_cie_cache_size; i += 4)
- dlprintf5("[c] icc_sample_proc[%3d]=%g, %g, %g, %g\n", i,
- pcache->values[i], pcache->values[i + 1],
- pcache->values[i + 2], pcache->values[i + 3]);
+ for (i = 0; i < gx_cie_cache_size; i += 4)
+ dlprintf5("[c] icc_sample_proc[%3d]=%g, %g, %g, %g\n", i,
+ pcache->values[i], pcache->values[i + 1],
+ pcache->values[i + 2], pcache->values[i + 3]);
}
#endif
ref_stack_pop(&o_stack, gx_cie_cache_size);
diff --git a/gs/psi/zcie.h b/gs/psi/zcie.h
index ffe57fbfc..80e58557f 100644
--- a/gs/psi/zcie.h
+++ b/gs/psi/zcie.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zcolor.c b/gs/psi/zcolor.c
index 2ad6d04c6..288e11cd9 100644
--- a/gs/psi/zcolor.c
+++ b/gs/psi/zcolor.c
@@ -65,7 +65,6 @@ static int setcolor_cont(i_ctx_t *i_ctx_p);
const int zcolor_remap_one_ostack = 4;
const int zcolor_remap_one_estack = 3;
-
/* utility to test whether a Pattern instance uses a base space */
static inline bool
pattern_instance_uses_base_space(const gs_pattern_instance_t * pinst)
@@ -156,53 +155,53 @@ zcurrentcolorspace(i_ctx_t * i_ctx_p)
* recover them here by executing PostScript.
*/
if (r_has_type(&istate->colorspace[0].array, t_name)) {
- name_string_ref(imemory, &istate->colorspace[0].array, &namestr);
- if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceGray", 10)) {
- body = ialloc_string(32, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "systemdict /DeviceGray_array get", 32);
- make_string(&stref, a_all | icurrent_space, 32, body);
- } else {
- if (r_size(&namestr) == 9 && !memcmp(namestr.value.bytes, "DeviceRGB", 9)) {
- body = ialloc_string(31, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "systemdict /DeviceRGB_array get", 31);
- make_string(&stref, a_all | icurrent_space, 31, body);
- } else {
- if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceCMYK", 10)) {
- body = ialloc_string(32, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "systemdict /DeviceCMYK_array get", 32);
- make_string(&stref, a_all | icurrent_space, 32, body);
- } else {
- /* Not one of the Device spaces, but still just a name. Give
- * up and return the name on the stack.
- */
- push(1);
- code = ialloc_ref_array(op, a_all, 1, "currentcolorspace");
- if (code < 0)
- return code;
- refset_null(op->value.refs, 1);
- ref_assign_old(op, op->value.refs,
- &istate->colorspace[0].array,
- "currentcolorspace");
- return 0;
- }
- }
- }
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
+ name_string_ref(imemory, &istate->colorspace[0].array, &namestr);
+ if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceGray", 10)) {
+ body = ialloc_string(32, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "systemdict /DeviceGray_array get", 32);
+ make_string(&stref, a_all | icurrent_space, 32, body);
+ } else {
+ if (r_size(&namestr) == 9 && !memcmp(namestr.value.bytes, "DeviceRGB", 9)) {
+ body = ialloc_string(31, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "systemdict /DeviceRGB_array get", 31);
+ make_string(&stref, a_all | icurrent_space, 31, body);
+ } else {
+ if (r_size(&namestr) == 10 && !memcmp(namestr.value.bytes, "DeviceCMYK", 10)) {
+ body = ialloc_string(32, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "systemdict /DeviceCMYK_array get", 32);
+ make_string(&stref, a_all | icurrent_space, 32, body);
+ } else {
+ /* Not one of the Device spaces, but still just a name. Give
+ * up and return the name on the stack.
+ */
+ push(1);
+ code = ialloc_ref_array(op, a_all, 1, "currentcolorspace");
+ if (code < 0)
+ return code;
+ refset_null(op->value.refs, 1);
+ ref_assign_old(op, op->value.refs,
+ &istate->colorspace[0].array,
+ "currentcolorspace");
+ return 0;
+ }
+ }
+ }
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
} else {
- /* If the space isn't a simple name, then we don't need any special
- * action and can simply use it.
- */
- push(1);
- *op = istate->colorspace[0].array;
+ /* If the space isn't a simple name, then we don't need any special
+ * action and can simply use it.
+ */
+ push(1);
+ *op = istate->colorspace[0].array;
}
return 0;
}
@@ -276,13 +275,13 @@ zsetcolor(i_ctx_t * i_ctx_p)
ref *pImpl, pPatInst;
int ptype;
- code = dict_find_string(op, "Implementation", &pImpl);
- if (code < 0)
- return code;
- code = array_get(imemory, pImpl, 0, &pPatInst);
- if (code < 0)
- return code;
- cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
+ code = dict_find_string(op, "Implementation", &pImpl);
+ if (code < 0)
+ return code;
+ code = array_get(imemory, pImpl, 0, &pPatInst);
+ if (code < 0)
+ return code;
+ cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
n_numeric_comps = ( pattern_instance_uses_base_space(cc.pattern)
? n_comps - 1
: 0 );
@@ -297,17 +296,17 @@ zsetcolor(i_ctx_t * i_ctx_p)
/* gather the numeric operands */
code = float_params(op - num_offset, n_numeric_comps, cc.paint.values);
if (code < 0)
- return code;
+ return code;
code = get_space_object(i_ctx_p, &istate->colorspace[0].array, &space);
if (code < 0)
- return code;
+ return code;
if (space->validatecomponents) {
- code = space->validatecomponents(i_ctx_p,
- &istate->colorspace[0].array,
- cc.paint.values, n_numeric_comps);
- if (code < 0)
- return code;
+ code = space->validatecomponents(i_ctx_p,
+ &istate->colorspace[0].array,
+ cc.paint.values, n_numeric_comps);
+ if (code < 0)
+ return code;
}
/* pass the color to the graphic library */
@@ -326,7 +325,7 @@ zsetcolor(i_ctx_t * i_ctx_p)
*/
code = validate_spaces(i_ctx_p, &istate->colorspace[0].array, &depth);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(5);
@@ -363,7 +362,6 @@ static bool name_is_device_color( char *cs_name )
}
-
/*
* Given two color space arrays, attempts to determine if they are the
* same space by comparing their contents recursively. For some spaces,
@@ -384,26 +382,26 @@ static int is_same_colorspace(i_ctx_t * i_ctx_p, ref *space1, ref *space2, bool
ref_assign(poldspace, space2);
do {
- if (r_type(poldspace) != r_type(pnewspace))
- return 0;
+ if (r_type(poldspace) != r_type(pnewspace))
+ return 0;
- code = get_space_object(i_ctx_p, poldspace, &oldcspace);
- if (code < 0)
- return 0;
+ code = get_space_object(i_ctx_p, poldspace, &oldcspace);
+ if (code < 0)
+ return 0;
- code = get_space_object(i_ctx_p, pnewspace, &newcspace);
- if (code < 0)
- return 0;
+ code = get_space_object(i_ctx_p, pnewspace, &newcspace);
+ if (code < 0)
+ return 0;
- /* Check the two color space types are the same
- * (Indexed, Separation, DeviceCMYK etc).
- */
- if (strcmp(oldcspace->name, newcspace->name) != 0)
- return 0;
+ /* Check the two color space types are the same
+ * (Indexed, Separation, DeviceCMYK etc).
+ */
+ if (strcmp(oldcspace->name, newcspace->name) != 0)
+ return 0;
- /* Call the space-specific comparison routine */
- if (!oldcspace->compareproc(i_ctx_p, poldspace, pnewspace))
- return 0;
+ /* Call the space-specific comparison routine */
+ if (!oldcspace->compareproc(i_ctx_p, poldspace, pnewspace))
+ return 0;
/* See if current space is CIE based (which could happen
if UseCIE had been true previously), but UseCIE is false
@@ -415,7 +413,7 @@ static int is_same_colorspace(i_ctx_t * i_ctx_p, ref *space1, ref *space2, bool
Device Color UseCIEColor true
Soft mask
- Device color UseCIEColor false
+ Device color UseCIEColor false
Soft mask
Device color UseCIEColor true
*/
@@ -428,30 +426,28 @@ static int is_same_colorspace(i_ctx_t * i_ctx_p, ref *space1, ref *space2, bool
}
}
- /* The current space is OK, if there is no alternate, then that's
- * good enough.
- */
- if (!oldcspace->alternateproc)
- break;
+ /* The current space is OK, if there is no alternate, then that's
+ * good enough.
+ */
+ if (!oldcspace->alternateproc)
+ break;
- /* Otherwise, retrieve the alternate space for each, and continue
- * round the loop, checking those.
- */
- code = oldcspace->alternateproc(i_ctx_p, poldspace, &poldspace, &CIESubst);
- if (code < 0)
- return 0;
+ /* Otherwise, retrieve the alternate space for each, and continue
+ * round the loop, checking those.
+ */
+ code = oldcspace->alternateproc(i_ctx_p, poldspace, &poldspace, &CIESubst);
+ if (code < 0)
+ return 0;
- code = newcspace->alternateproc(i_ctx_p, pnewspace, &pnewspace, &CIESubst);
- if (code < 0)
- return 0;
+ code = newcspace->alternateproc(i_ctx_p, pnewspace, &pnewspace, &CIESubst);
+ if (code < 0)
+ return 0;
}
while(1);
return 1;
}
-
-
/*
* <array> setcolorspace -
*
@@ -472,31 +468,31 @@ zsetcolorspace(i_ctx_t * i_ctx_p)
check_op(1);
/* Check its either a name (base space) or an array */
if (!r_has_type(op, t_name))
- if (!r_is_array(op))
- return_error(e_typecheck);
+ if (!r_is_array(op))
+ return_error(e_typecheck);
code = validate_spaces(i_ctx_p, op, &depth);
if (code < 0)
- return code;
+ return code;
is_CIE = istate->use_cie_color.value.boolval;
/* See if its the same as the current space */
if (is_same_colorspace(i_ctx_p, op, &istate->colorspace[0].array, is_CIE)) {
- PS_colour_space_t *cspace;
-
- /* Even if its the same space, we still need to set the correct
- * initial color value.
- */
- code = get_space_object(i_ctx_p, &istate->colorspace[0].array, &cspace);
- if (code < 0)
- return 0;
- if (cspace->initialcolorproc) {
- cspace->initialcolorproc(i_ctx_p, &istate->colorspace[0].array);
- }
- /* Pop the space off the stack */
- pop(1);
- return 0;
+ PS_colour_space_t *cspace;
+
+ /* Even if its the same space, we still need to set the correct
+ * initial color value.
+ */
+ code = get_space_object(i_ctx_p, &istate->colorspace[0].array, &cspace);
+ if (code < 0)
+ return 0;
+ if (cspace->initialcolorproc) {
+ cspace->initialcolorproc(i_ctx_p, &istate->colorspace[0].array);
+ }
+ /* Pop the space off the stack */
+ pop(1);
+ return 0;
}
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -537,12 +533,12 @@ setcolorspace_nosubst(i_ctx_t * i_ctx_p)
check_op(1);
/* Check its either a name (base space) or an array */
if (!r_has_type(op, t_name))
- if (!r_is_array(op))
- return_error(e_typecheck);
+ if (!r_is_array(op))
+ return_error(e_typecheck);
code = validate_spaces(i_ctx_p, op, &depth);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -583,7 +579,7 @@ zincludecolorspace(i_ctx_t * i_ctx_p)
name_string_ref(imemory, op, &nsref);
code = gs_includecolorspace(igs, nsref.value.const_bytes, r_size(&nsref));
if (!code)
- pop(1);
+ pop(1);
return code;
}
@@ -639,7 +635,6 @@ zsettransfer(i_ctx_t * i_ctx_p)
zcolor_remap_one_finish );
}
-
/*
* Internal routines
*/
@@ -664,13 +659,13 @@ zcolor_remap_one(
* more of these functions.
*/
if (r_size(pproc) == 0) {
- gx_set_identity_transfer(pmap);
- /*
- * Even though we don't actually push anything on the e-stack, all
- * clients do, so we return o_push_estack in this case. This is
- * needed so that clients' finishing procedures will get run.
- */
- return o_push_estack;
+ gx_set_identity_transfer(pmap);
+ /*
+ * Even though we don't actually push anything on the e-stack, all
+ * clients do, so we return o_push_estack in this case. This is
+ * needed so that clients' finishing procedures will get run.
+ */
+ return o_push_estack;
}
op = osp += 4;
make_real(op - 3, 0);
@@ -679,7 +674,7 @@ zcolor_remap_one(
*op = *pproc;
++esp;
make_struct(esp, imemory_space((gs_ref_memory_t *) pgs->memory),
- pmap);
+ pmap);
push_op_estack(finish_proc);
push_op_estack(zfor_samples);
return o_push_estack;
@@ -693,19 +688,19 @@ zcolor_remap_one_store(i_ctx_t *i_ctx_p, floatp min_value)
gx_transfer_map *pmap = r_ptr(esp, gx_transfer_map);
if (ref_stack_count(&o_stack) < transfer_map_size)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
for (i = 0; i < transfer_map_size; i++) {
- double v;
- int code =
- real_param(ref_stack_index(&o_stack, transfer_map_size - 1 - i),
- &v);
-
- if (code < 0)
- return code;
- pmap->values[i] =
- (v < min_value ? float2frac(min_value) :
- v >= 1.0 ? frac_1 :
- float2frac(v));
+ double v;
+ int code =
+ real_param(ref_stack_index(&o_stack, transfer_map_size - 1 - i),
+ &v);
+
+ if (code < 0)
+ return code;
+ pmap->values[i] =
+ (v < min_value ? float2frac(min_value) :
+ v >= 1.0 ? frac_1 :
+ float2frac(v));
}
ref_stack_pop(&o_stack, transfer_map_size);
esp--; /* pop pointer to transfer map */
@@ -756,16 +751,16 @@ zcolor_test(i_ctx_t *i_ctx_p)
os_ptr op = osp - (ncomp-1);
int i;
if (ref_stack_count(&o_stack) < ncomp)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
for (i = 0; i < ncomp; i++) {
- if (r_has_type(op+i, t_real))
- cv[i] = (gx_color_value)
- (op[i].value.realval * gx_max_color_value);
- else if (r_has_type(op+i, t_integer))
- cv[i] = (gx_color_value)
- (op[i].value.intval * gx_max_color_value);
- else
- return_error(e_typecheck);
+ if (r_has_type(op+i, t_real))
+ cv[i] = (gx_color_value)
+ (op[i].value.realval * gx_max_color_value);
+ else if (r_has_type(op+i, t_integer))
+ cv[i] = (gx_color_value)
+ (op[i].value.intval * gx_max_color_value);
+ else
+ return_error(e_typecheck);
}
color = (*dev_proc(dev, encode_color)) (dev, cv);
(*dev_proc(dev, decode_color)) (dev, color, cv);
@@ -802,33 +797,33 @@ zcolor_test_all(i_ctx_t *i_ctx_p)
int finished = 0;
if (ncomp == 1)
- acceptable_error = gx_max_color_value / dev->color_info.max_gray + 1;
+ acceptable_error = gx_max_color_value / dev->color_info.max_gray + 1;
else
- acceptable_error = gx_max_color_value / dev->color_info.max_color + 1;
+ acceptable_error = gx_max_color_value / dev->color_info.max_color + 1;
if (ref_stack_count(&o_stack) < 1)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_has_type(&osp[0], t_integer))
return_error(e_typecheck);
steps = osp[0].value.intval;
for (i = 0; i < ncomp; i++) {
counter[i] = 0;
- cvbad[i] = 0;
+ cvbad[i] = 0;
}
dprintf1("Number of components = %d\n", ncomp);
dprintf1("Depth = %d\n", dev->color_info.depth);
dprintf2("max_gray = %d dither_grays = %d\n",
- dev->color_info.max_gray, dev->color_info.dither_grays);
+ dev->color_info.max_gray, dev->color_info.dither_grays);
dprintf2("max_color = %d dither_colors = %d\n",
- dev->color_info.max_color, dev->color_info.dither_colors);
+ dev->color_info.max_color, dev->color_info.dither_colors);
dprintf1("polarity = %s\n",
dev->color_info.polarity == GX_CINFO_POLARITY_ADDITIVE ? "Additive" :
dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE ?"Subtractive":
"Unknown");
/* Indicate color index value with all colorants = zero */
for (i = 0; i < ncomp; i++)
- cv[i] = 0;
+ cv[i] = 0;
color = (*dev_proc(dev, encode_color)) (dev, cv);
if (sizeof(color) <= sizeof(ulong))
dprintf1("Zero color index: %8lx\n", (ulong)color);
@@ -848,79 +843,79 @@ zcolor_test_all(i_ctx_t *i_ctx_p)
dprintf(" Shift Mask Bits\n");
for (i = 0; i < ncomp; i++) {
dprintf3(" %5d %8x %4d\n",
- (int)(dev->color_info.comp_shift[i]),
- (int)(dev->color_info.comp_mask[i]),
- (int)(dev->color_info.comp_bits[i]));
+ (int)(dev->color_info.comp_shift[i]),
+ (int)(dev->color_info.comp_mask[i]),
+ (int)(dev->color_info.comp_bits[i]));
}
}
while (!finished) {
- for (j = 0; j <= steps; j++) {
- for (i = 0; i < ncomp; i++)
- cv[i] = counter[i] * gx_max_color_value / steps;
- color = (*dev_proc(dev, encode_color)) (dev, cv);
- if (linsep) {
- /* Derive it the other way */
- lscolor = gx_default_encode_color(dev, cv);
- if ((color != lscolor) && (linsepfailed < 5)) {
- linsepfailed++;
- dprintf("Failed separable_and_linear for");
- for (i = 0; i < ncomp; i++)
- dprintf1(" %d", cv[i]);
- dprintf("\n");
- dprintf2("encode_color=%x gx_default_encode_color=%x\n",
- (int)color, (int)lscolor);
- }
- }
- (*dev_proc(dev, decode_color)) (dev, color, cvout);
- for (i = 0; i < ncomp; i++) {
- err = (int)cvout[i] - (int)cv[i];
- if (err < 0)
- err = -err;
- if (err > maxerror) {
- maxerror = err;
- for (k=0; k < ncomp; k++)
- cvbad[k] = cv[k];
- }
- }
- if (linsep) {
- gx_default_decode_color(dev, color, cvout);
- for (i = 0; i < ncomp; i++) {
- err = (int)cvout[i] - (int)cv[i];
- if (err < 0)
- err = -err;
- if (err > lsmaxerror) {
- lsmaxerror = err;
- }
- }
- }
- counter[0] += 1;
- }
- counter[0] = 0;
- i = 1;
- while (i < ncomp) {
- counter[i] += 1;
- if (counter[i] > steps) {
- counter[i] = 0;
- i++;
- }
- else
- break;
- }
- if (i >= ncomp)
- finished = 1;
+ for (j = 0; j <= steps; j++) {
+ for (i = 0; i < ncomp; i++)
+ cv[i] = counter[i] * gx_max_color_value / steps;
+ color = (*dev_proc(dev, encode_color)) (dev, cv);
+ if (linsep) {
+ /* Derive it the other way */
+ lscolor = gx_default_encode_color(dev, cv);
+ if ((color != lscolor) && (linsepfailed < 5)) {
+ linsepfailed++;
+ dprintf("Failed separable_and_linear for");
+ for (i = 0; i < ncomp; i++)
+ dprintf1(" %d", cv[i]);
+ dprintf("\n");
+ dprintf2("encode_color=%x gx_default_encode_color=%x\n",
+ (int)color, (int)lscolor);
+ }
+ }
+ (*dev_proc(dev, decode_color)) (dev, color, cvout);
+ for (i = 0; i < ncomp; i++) {
+ err = (int)cvout[i] - (int)cv[i];
+ if (err < 0)
+ err = -err;
+ if (err > maxerror) {
+ maxerror = err;
+ for (k=0; k < ncomp; k++)
+ cvbad[k] = cv[k];
+ }
+ }
+ if (linsep) {
+ gx_default_decode_color(dev, color, cvout);
+ for (i = 0; i < ncomp; i++) {
+ err = (int)cvout[i] - (int)cv[i];
+ if (err < 0)
+ err = -err;
+ if (err > lsmaxerror) {
+ lsmaxerror = err;
+ }
+ }
+ }
+ counter[0] += 1;
+ }
+ counter[0] = 0;
+ i = 1;
+ while (i < ncomp) {
+ counter[i] += 1;
+ if (counter[i] > steps) {
+ counter[i] = 0;
+ i++;
+ }
+ else
+ break;
+ }
+ if (i >= ncomp)
+ finished = 1;
}
dprintf2("Maximum error %g %s\n",
- (float)maxerror / (float)gx_max_color_value,
- maxerror <= acceptable_error ? "is Ok" :
- maxerror <= 3*acceptable_error/2 ? "is POOR" : "FAILED");
+ (float)maxerror / (float)gx_max_color_value,
+ maxerror <= acceptable_error ? "is Ok" :
+ maxerror <= 3*acceptable_error/2 ? "is POOR" : "FAILED");
if (linsep)
dprintf2("Maximum linear_and_separable error %g %s\n",
- (float)lsmaxerror / (float)gx_max_color_value,
- lsmaxerror <= acceptable_error ? "is Ok" :
- lsmaxerror <= 3*acceptable_error/2 ? "is POOR" : "FAILED");
+ (float)lsmaxerror / (float)gx_max_color_value,
+ lsmaxerror <= acceptable_error ? "is Ok" :
+ lsmaxerror <= 3*acceptable_error/2 ? "is POOR" : "FAILED");
/* push worst value */
push(ncomp-1);
@@ -960,42 +955,42 @@ static int rgb2hsb(float *RGB)
v = 1.0;
for (i=0;i<3;i++)
- HSB[i] = 0.0;
+ HSB[i] = 0.0;
for (i=0;i<3;i++) {
- if (RGB[i] > HSB[2]) {
- HSB[2] = RGB[i];
- j = i;
- }
- if (RGB[i] < v)
- v = RGB[i];
+ if (RGB[i] > HSB[2]) {
+ HSB[2] = RGB[i];
+ j = i;
+ }
+ if (RGB[i] < v)
+ v = RGB[i];
}
if (HSB[2] != 0) {
- diff = HSB[2] - v;
- HSB[1] = diff / HSB[2];
- switch (j) {
- case 0 : /* R == Brightness */
- /* diff can only be zero if r == br, so we need to make sure here we
- * don't divide by zero
- */
- if (diff)
- HSB[0] = ((RGB[1] - RGB[2]) / (6.0 * diff)) + (RGB[2] > RGB[1] ? 1.0 : 0.0);
- else
- HSB[0] = (RGB[1] - RGB[2]) + (RGB[2] > RGB[1] ? 1.0 : 0.0);
- break;
- case 1 : /* G == Brightness */
- HSB[0] = (1.0 / 3.0) + (RGB[2] - RGB[0]) / (6.0 * diff);
- break;
- case 2 : /* B == Brightness */
- HSB[0] = (2.0 / 3.0) + (RGB[0] - RGB[1]) / (6.0 * diff);
- break;
- }
+ diff = HSB[2] - v;
+ HSB[1] = diff / HSB[2];
+ switch (j) {
+ case 0 : /* R == Brightness */
+ /* diff can only be zero if r == br, so we need to make sure here we
+ * don't divide by zero
+ */
+ if (diff)
+ HSB[0] = ((RGB[1] - RGB[2]) / (6.0 * diff)) + (RGB[2] > RGB[1] ? 1.0 : 0.0);
+ else
+ HSB[0] = (RGB[1] - RGB[2]) + (RGB[2] > RGB[1] ? 1.0 : 0.0);
+ break;
+ case 1 : /* G == Brightness */
+ HSB[0] = (1.0 / 3.0) + (RGB[2] - RGB[0]) / (6.0 * diff);
+ break;
+ case 2 : /* B == Brightness */
+ HSB[0] = (2.0 / 3.0) + (RGB[0] - RGB[1]) / (6.0 * diff);
+ break;
+ }
}
for (i=0;i<3;i++) {
- if (HSB[i] < 0)
- HSB[i] = 0;
- if (RGB[i] > 1)
- HSB[i] = 1;
- RGB[i] = HSB[i];
+ if (HSB[i] < 0)
+ HSB[i] = 0;
+ if (RGB[i] > 1)
+ HSB[i] = 1;
+ RGB[i] = HSB[i];
}
return 0;
}
@@ -1058,46 +1053,46 @@ static int hsb2rgb(float *HSB)
md = 6.0 * HSB[1] * HSB[2];
switch ((int)floor(6.0 * HSB[0])) {
- case 6:
- HSB[0] = (float)0;
- default: /* Shuts up compiler warning about RGB being uninited */
- case 0:
- RGB[0] = HSB[2];
- RGB[1] = mn + (HSB[0] * md);
- RGB[2] = mn;
- break;
- case 1:
- RGB[0] = mn + (md * ((1.0 / 3.0) - HSB[0]));
- RGB[1] = HSB[2];
- RGB[2] = mn;
- break;
- case 2:
- RGB[0] = mn;
- RGB[1] = HSB[2];
- RGB[2] = mn + ((HSB[0] - (1.0 / 3.0)) * md);
- break;
- case 3:
- RGB[0] = mn;
- RGB[1] = mn + (((2.0 / 3.0f) - HSB[0]) * md);
- RGB[2] = HSB[2];
- break;
- case 4:
- RGB[0] = mn + ((HSB[0] - (2.0 / 3.0)) * md);
- RGB[1] = mn;
- RGB[2] = HSB[2];
- break;
- case 5:
- RGB[0] = HSB[2];
- RGB[1] = mn;
- RGB[2] = mn + ((1.0 - HSB[0]) * md);
- break;
+ case 6:
+ HSB[0] = (float)0;
+ default: /* Shuts up compiler warning about RGB being uninited */
+ case 0:
+ RGB[0] = HSB[2];
+ RGB[1] = mn + (HSB[0] * md);
+ RGB[2] = mn;
+ break;
+ case 1:
+ RGB[0] = mn + (md * ((1.0 / 3.0) - HSB[0]));
+ RGB[1] = HSB[2];
+ RGB[2] = mn;
+ break;
+ case 2:
+ RGB[0] = mn;
+ RGB[1] = HSB[2];
+ RGB[2] = mn + ((HSB[0] - (1.0 / 3.0)) * md);
+ break;
+ case 3:
+ RGB[0] = mn;
+ RGB[1] = mn + (((2.0 / 3.0f) - HSB[0]) * md);
+ RGB[2] = HSB[2];
+ break;
+ case 4:
+ RGB[0] = mn + ((HSB[0] - (2.0 / 3.0)) * md);
+ RGB[1] = mn;
+ RGB[2] = HSB[2];
+ break;
+ case 5:
+ RGB[0] = HSB[2];
+ RGB[1] = mn;
+ RGB[2] = mn + ((1.0 - HSB[0]) * md);
+ break;
}
for (i=0;i<3;i++) {
- if (RGB[i] < 0)
- RGB[i] = 0;
- if (RGB[i] > 1)
- RGB[i] = 1;
- HSB[i] = RGB[i];
+ if (RGB[i] < 0)
+ RGB[i] = 0;
+ if (RGB[i] > 1)
+ RGB[i] = 1;
+ HSB[i] = RGB[i];
}
return 0;
}
@@ -1115,119 +1110,119 @@ static int setgrayspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CI
ref stref;
do {
- switch (*stage) {
- case 0:
- if (istate->use_cie_color.value.boolval && !CIESubst) {
- byte *body;
- ref *nosubst;
-
- code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
- if (code < 0)
- return code;
- if (!r_has_type(nosubst, t_boolean))
- return_error(e_typecheck);
- if (nosubst->value.boolval) {
- *stage = 4;
- *cont = 1;
- body = ialloc_string(32, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "/DefaultGray ..nosubstdevicetest",32);
- make_string(&stref, a_all | icurrent_space, 32, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- } else {
- *stage = 2;
- *cont = 1;
- body = ialloc_string(47, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "{/DefaultGray /ColorSpace findresource} stopped",47);
- make_string(&stref, a_all | icurrent_space, 47, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- }
- break;
- }
- /* fall through */
- case 1:
- pcs = gs_cspace_new_DeviceGray(imemory);
- if (pcs == NULL)
- return_error(e_VMerror);
- code = gs_setcolorspace(igs, pcs);
- if (code >= 0) {
- gs_client_color *pcc = gs_currentcolor_inline(igs);
-
- cs_adjust_color_count(igs, -1); /* not strictly necessary */
- pcc->paint.values[0] = (0);
- pcc->pattern = 0; /* for GC */
- gx_unset_dev_color(igs);
- }
- rc_decrement_only_cs(pcs, "zsetdevcspace");
- *cont = 0;
- *stage = 0;
- break;
- case 2:
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- if (op->value.boolval) {
- /* Failed to find the /DefaultGray CSA, so give up and
- * just use DeviceGray
- */
- pop(1);
- *stage = 1;
- break;
- }
- pop(1);
- *cont = 1;
- *stage = 3;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- break;
- case 3:
- /* We end up here after setting the DefaultGray space
- * We've finished setting the gray color space, so we
- * just exit now
- */
- *cont = 0;
- *stage = 0;
- break;
- case 4:
- /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
- * is also true. We will have a boolean on the stack, if its true
- * then we need to set the space (also on the stack), invoke
- * .includecolorspace, and set /DeviceGray, otherwise we just need
- * to set DeviceGray. See gs_cspace.ps.
- */
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- pop(1);
- *stage = 1;
- *cont = 1;
- if (op->value.boolval) {
- *stage = 5;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- }
- break;
- case 5:
- /* After stage 4 above, if we had to set a color space, we come
- * here. Now we need to use .includecolorspace to register the space
- * with any high-level devices which want it.
- */
- *stage = 1;
- *cont = 1;
- code = zincludecolorspace(i_ctx_p);
- if (code != 0)
- return code;
- break;
- }
+ switch (*stage) {
+ case 0:
+ if (istate->use_cie_color.value.boolval && !CIESubst) {
+ byte *body;
+ ref *nosubst;
+
+ code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
+ if (code < 0)
+ return code;
+ if (!r_has_type(nosubst, t_boolean))
+ return_error(e_typecheck);
+ if (nosubst->value.boolval) {
+ *stage = 4;
+ *cont = 1;
+ body = ialloc_string(32, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "/DefaultGray ..nosubstdevicetest",32);
+ make_string(&stref, a_all | icurrent_space, 32, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ } else {
+ *stage = 2;
+ *cont = 1;
+ body = ialloc_string(47, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "{/DefaultGray /ColorSpace findresource} stopped",47);
+ make_string(&stref, a_all | icurrent_space, 47, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ }
+ break;
+ }
+ /* fall through */
+ case 1:
+ pcs = gs_cspace_new_DeviceGray(imemory);
+ if (pcs == NULL)
+ return_error(e_VMerror);
+ code = gs_setcolorspace(igs, pcs);
+ if (code >= 0) {
+ gs_client_color *pcc = gs_currentcolor_inline(igs);
+
+ cs_adjust_color_count(igs, -1); /* not strictly necessary */
+ pcc->paint.values[0] = (0);
+ pcc->pattern = 0; /* for GC */
+ gx_unset_dev_color(igs);
+ }
+ rc_decrement_only_cs(pcs, "zsetdevcspace");
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 2:
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ if (op->value.boolval) {
+ /* Failed to find the /DefaultGray CSA, so give up and
+ * just use DeviceGray
+ */
+ pop(1);
+ *stage = 1;
+ break;
+ }
+ pop(1);
+ *cont = 1;
+ *stage = 3;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ case 3:
+ /* We end up here after setting the DefaultGray space
+ * We've finished setting the gray color space, so we
+ * just exit now
+ */
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 4:
+ /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
+ * is also true. We will have a boolean on the stack, if its true
+ * then we need to set the space (also on the stack), invoke
+ * .includecolorspace, and set /DeviceGray, otherwise we just need
+ * to set DeviceGray. See gs_cspace.ps.
+ */
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ pop(1);
+ *stage = 1;
+ *cont = 1;
+ if (op->value.boolval) {
+ *stage = 5;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ }
+ break;
+ case 5:
+ /* After stage 4 above, if we had to set a color space, we come
+ * here. Now we need to use .includecolorspace to register the space
+ * with any high-level devices which want it.
+ */
+ *stage = 1;
+ *cont = 1;
+ code = zincludecolorspace(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ }
} while (*stage);
return code;
}
@@ -1258,48 +1253,48 @@ static int graybasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, in
*stage = 0;
check_op(1);
if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- Gray = op->value.realval;
- } else
- return_error(e_typecheck);
+ if (r_has_type(op, t_real)) {
+ Gray = op->value.realval;
+ } else
+ return_error(e_typecheck);
} else
- Gray = (float)op->value.intval;
+ Gray = (float)op->value.intval;
if (Gray < 0 || Gray > 1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
switch (base) {
- case 0:
- /* Requested space is DeviceGray, just use the value */
+ case 0:
+ /* Requested space is DeviceGray, just use the value */
make_real(op, Gray);
- break;
- case 1:
- /* Requested space is HSB */
- case 2:
- /* Requested space is RGB, set all the components
- * to the gray value
- */
- push(2);
- RGB[0] = RGB[1] = RGB[2] = Gray;
- if (base == 1)
- /* If the requested space is HSB, convert the RGB to HSB */
- rgb2hsb((float *)&RGB);
+ break;
+ case 1:
+ /* Requested space is HSB */
+ case 2:
+ /* Requested space is RGB, set all the components
+ * to the gray value
+ */
+ push(2);
+ RGB[0] = RGB[1] = RGB[2] = Gray;
+ if (base == 1)
+ /* If the requested space is HSB, convert the RGB to HSB */
+ rgb2hsb((float *)&RGB);
make_real(&op[-2], RGB[0]);
make_real(&op[-1], RGB[1]);
make_real(op, RGB[2]);
- break;
- case 3:
- /* Requested space is CMYK, use the gray value to set the
- * black channel.
- */
- push(3);
+ break;
+ case 3:
+ /* Requested space is CMYK, use the gray value to set the
+ * black channel.
+ */
+ push(3);
make_real(&op[-3], (float)0);
make_real(&op[-2], (float)0);
make_real(&op[-1], (float)0);
make_real(op, (float)1.0 - Gray);
- break;
- default:
- return_error(e_undefined);
+ break;
+ default:
+ return_error(e_undefined);
}
return 0;
}
@@ -1308,16 +1303,16 @@ static int grayvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_com
os_ptr op = osp;
if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (num_comps < 1)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (*values > 1.0)
- *values = 1.0;
+ *values = 1.0;
if ( *values < 0.0)
- *values = 0.0;
+ *values = 0.0;
return 0;
}
@@ -1339,119 +1334,119 @@ static int setrgbspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CIE
ref stref;
do {
- switch (*stage) {
- case 0:
- if (istate->use_cie_color.value.boolval && !CIESubst) {
- byte *body;
- ref *nosubst;
-
- code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
- if (code < 0)
- return code;
- if (!r_has_type(nosubst, t_boolean))
- return_error(e_typecheck);
- if (nosubst->value.boolval) {
- *stage = 4;
- *cont = 1;
- body = ialloc_string(31, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "/DefaultRGB ..nosubstdevicetest",31);
- make_string(&stref, a_all | icurrent_space, 31, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- } else {
- *stage = 2;
- *cont = 1;
- body = ialloc_string(46, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "{/DefaultRGB /ColorSpace findresource} stopped", 46);
- make_string(&stref, a_all | icurrent_space, 46, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- }
- }
- /* fall through */
- case 1:
- pcs = gs_cspace_new_DeviceRGB(imemory);
- if (pcs == NULL)
- return_error(e_VMerror);
- code = gs_setcolorspace(igs, pcs);
- if (code >= 0) {
- gs_client_color *pcc = gs_currentcolor_inline(igs);
-
- cs_adjust_color_count(igs, -1); /* not strictly necessary */
- pcc->paint.values[0] = 0;
- pcc->paint.values[1] = 0;
- pcc->paint.values[2] = 0;
- pcc->pattern = 0; /* for GC */
- gx_unset_dev_color(igs);
- }
- rc_decrement_only_cs(pcs, "zsetdevcspace");
- *cont = 0;
- *stage = 0;
- break;
- case 2:
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- if (op->value.boolval) {
- /* Failed to find the /DefaultRGB CSA, so give up and
- * just use DeviceRGB
- */
- pop(1);
- *stage = 1;
- break;
- }
- pop(1);
- *stage = 3;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- break;
- case 3:
- /* We end up here after setting the DefaultGray CIE space
- * We've finished setting the gray color space, so we
- * just exit now
- */
- *cont = 0;
- *stage = 0;
- break;
- case 4:
- /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
- * is also true. We will have a boolean on the stack, if its true
- * then we need to set the space (also on the stack), invoke
- * .includecolorspace, and set /DeviceGray, otherwise we just need
- * to set DeviceGray. See gs-cspace.ps.
- */
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- pop(1);
- *stage = 1;
- *cont = 1;
- if (op->value.boolval) {
- *stage = 5;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- }
- break;
- case 5:
- /* After stage 4 above, if we had to set a color space, we come
- * here. Now we need to use .includecolorspace to register the space
- * with any high-level devices which want it.
- */
- *stage = 1;
- *cont = 1;
- code = zincludecolorspace(i_ctx_p);
- if (code != 0)
- return code;
- break;
- }
+ switch (*stage) {
+ case 0:
+ if (istate->use_cie_color.value.boolval && !CIESubst) {
+ byte *body;
+ ref *nosubst;
+
+ code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
+ if (code < 0)
+ return code;
+ if (!r_has_type(nosubst, t_boolean))
+ return_error(e_typecheck);
+ if (nosubst->value.boolval) {
+ *stage = 4;
+ *cont = 1;
+ body = ialloc_string(31, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "/DefaultRGB ..nosubstdevicetest",31);
+ make_string(&stref, a_all | icurrent_space, 31, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ } else {
+ *stage = 2;
+ *cont = 1;
+ body = ialloc_string(46, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "{/DefaultRGB /ColorSpace findresource} stopped", 46);
+ make_string(&stref, a_all | icurrent_space, 46, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ }
+ }
+ /* fall through */
+ case 1:
+ pcs = gs_cspace_new_DeviceRGB(imemory);
+ if (pcs == NULL)
+ return_error(e_VMerror);
+ code = gs_setcolorspace(igs, pcs);
+ if (code >= 0) {
+ gs_client_color *pcc = gs_currentcolor_inline(igs);
+
+ cs_adjust_color_count(igs, -1); /* not strictly necessary */
+ pcc->paint.values[0] = 0;
+ pcc->paint.values[1] = 0;
+ pcc->paint.values[2] = 0;
+ pcc->pattern = 0; /* for GC */
+ gx_unset_dev_color(igs);
+ }
+ rc_decrement_only_cs(pcs, "zsetdevcspace");
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 2:
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ if (op->value.boolval) {
+ /* Failed to find the /DefaultRGB CSA, so give up and
+ * just use DeviceRGB
+ */
+ pop(1);
+ *stage = 1;
+ break;
+ }
+ pop(1);
+ *stage = 3;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ case 3:
+ /* We end up here after setting the DefaultGray CIE space
+ * We've finished setting the gray color space, so we
+ * just exit now
+ */
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 4:
+ /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
+ * is also true. We will have a boolean on the stack, if its true
+ * then we need to set the space (also on the stack), invoke
+ * .includecolorspace, and set /DeviceGray, otherwise we just need
+ * to set DeviceGray. See gs-cspace.ps.
+ */
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ pop(1);
+ *stage = 1;
+ *cont = 1;
+ if (op->value.boolval) {
+ *stage = 5;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ }
+ break;
+ case 5:
+ /* After stage 4 above, if we had to set a color space, we come
+ * here. Now we need to use .includecolorspace to register the space
+ * with any high-level devices which want it.
+ */
+ *stage = 1;
+ *cont = 1;
+ code = zincludecolorspace(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ }
} while (*stage);
return code;
}
@@ -1460,8 +1455,8 @@ static int rgbdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
int i;
for (i = 0;i < 6;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -1470,8 +1465,8 @@ static int rgbrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
int i;
for (i = 0;i < 6;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -1489,156 +1484,156 @@ static int rgbbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int
const gs_color_space * pcs = gs_currentcolorspace(igs);
if (pcs->id == cs_DeviceGray_id) {
- /* UGLY hack. Its possible for the graphics library to change the
- * colour space to DeviceGray (setcachedevice), but this does not
- * change the PostScript space. It can't, because the graphics library
- * doesn't know about the PostScript objects. If we get a current*
- * operation before the space has been restored, the colour space in
- * the graphics library and the PostScript stored space won't match.
- * If that happens then we need to pretend the PS colour space was
- * DeviceGray
- */
- return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth));
+ /* UGLY hack. Its possible for the graphics library to change the
+ * colour space to DeviceGray (setcachedevice), but this does not
+ * change the PostScript space. It can't, because the graphics library
+ * doesn't know about the PostScript objects. If we get a current*
+ * operation before the space has been restored, the colour space in
+ * the graphics library and the PostScript stored space won't match.
+ * If that happens then we need to pretend the PS colour space was
+ * DeviceGray
+ */
+ return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth));
}
switch (*stage) {
- case 0:
- *cont = 0;
- check_op(3);
- op -= 2;
- for (i=0;i<3;i++) {
- if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- RGB[i] = op->value.realval;
- } else
- return_error(e_typecheck);
- } else
- RGB[i] = (float)op->value.intval;
- if (RGB[i] < 0 || RGB[i] > 1)
- return_error(e_rangecheck);
- op++;
- }
- op = osp;
-
- switch (base) {
- case 0:
- pop(2);
- op = osp;
- /* If R == G == B, then this is gray, so just use it. Avoids
- * rounding errors.
- */
- if (RGB[0] == RGB[1] && RGB[1] == RGB[2])
- Gray = RGB[0];
- else
- Gray = (0.3 * RGB[0]) + (0.59 * RGB[1]) + (0.11 * RGB[2]);
- make_real(op, Gray);
- return 0;
- break;
- case 1:
- rgb2hsb((float *)&RGB);
- make_real(&op[-2], RGB[0]);
- make_real(&op[-1], RGB[1]);
- make_real(op, RGB[2]);
- return 0;
- break;
- case 2:
- make_real(&op[-2], RGB[0]);
- make_real(&op[-1], RGB[1]);
- make_real(op, RGB[2]);
- return 0;
- break;
- case 3:
- *stage = 1;
- *cont = 1;
- for (i=0;i<3;i++)
- CMYK[i] = 1 - RGB[i];
- if (CMYK[0] < CMYK[1]) {
- if (CMYK[0] < CMYK[2])
- CMYK[3] = CMYK[0];
- else
- CMYK[3] = CMYK[2];
- } else {
- if (CMYK[1] < CMYK[2])
- CMYK[3] = CMYK[1];
- else
- CMYK[3] = CMYK[2];
- }
- check_estack(1);
- push(2);
- op = osp - 4;
- for (i=0;i<4;i++) {
- make_real(op, CMYK[i]);
- op++;
- }
- make_real(op, CMYK[3]);
- esp++;
- *esp = istate->undercolor_removal;
- return o_push_estack;
- break;
- default:
- return_error(e_undefined);
- break;
- }
- break;
- case 1:
- (*stage)++;
- *cont = 1;
- check_estack(1);
- check_op(5);
- op -= 4;
- for (i=0;i<4;i++) {
- if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- CMYK[i] = op->value.realval;
- } else
- return_error(e_typecheck);
- } else
- CMYK[i] = (float)op->value.intval;
- op++;
- }
- if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- UCR = op->value.realval;
- } else
- return_error(e_typecheck);
- } else
- UCR = (float)op->value.intval;
- for (i=0;i<3;i++) {
- CMYK[i] = CMYK[i] - UCR;
- if (CMYK[i] < 0)
- CMYK[i] = 0;
- if (CMYK[i] > 1)
- CMYK[i] = 1.0;
- }
- op -= 4;
- for (i=0;i<4;i++) {
- make_real(op, CMYK[i]);
- op++;
- }
- make_real(op, CMYK[3]);
- esp++;
- *esp = istate->black_generation;
- return o_push_estack;
- break;
- case 2:
- *stage = 0;
- *cont = 0;
- check_op(5);
- if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- BG = op->value.realval;
- } else
- return_error(e_typecheck);
- } else
- BG = (float)op->value.intval;
- pop(1);
- op = osp;
- if (BG < 0)
- BG = 0;
- if (BG > 1)
- BG = 1;
- make_real(op, BG);
- break;
+ case 0:
+ *cont = 0;
+ check_op(3);
+ op -= 2;
+ for (i=0;i<3;i++) {
+ if (!r_has_type(op, t_integer)) {
+ if (r_has_type(op, t_real)) {
+ RGB[i] = op->value.realval;
+ } else
+ return_error(e_typecheck);
+ } else
+ RGB[i] = (float)op->value.intval;
+ if (RGB[i] < 0 || RGB[i] > 1)
+ return_error(e_rangecheck);
+ op++;
+ }
+ op = osp;
+
+ switch (base) {
+ case 0:
+ pop(2);
+ op = osp;
+ /* If R == G == B, then this is gray, so just use it. Avoids
+ * rounding errors.
+ */
+ if (RGB[0] == RGB[1] && RGB[1] == RGB[2])
+ Gray = RGB[0];
+ else
+ Gray = (0.3 * RGB[0]) + (0.59 * RGB[1]) + (0.11 * RGB[2]);
+ make_real(op, Gray);
+ return 0;
+ break;
+ case 1:
+ rgb2hsb((float *)&RGB);
+ make_real(&op[-2], RGB[0]);
+ make_real(&op[-1], RGB[1]);
+ make_real(op, RGB[2]);
+ return 0;
+ break;
+ case 2:
+ make_real(&op[-2], RGB[0]);
+ make_real(&op[-1], RGB[1]);
+ make_real(op, RGB[2]);
+ return 0;
+ break;
+ case 3:
+ *stage = 1;
+ *cont = 1;
+ for (i=0;i<3;i++)
+ CMYK[i] = 1 - RGB[i];
+ if (CMYK[0] < CMYK[1]) {
+ if (CMYK[0] < CMYK[2])
+ CMYK[3] = CMYK[0];
+ else
+ CMYK[3] = CMYK[2];
+ } else {
+ if (CMYK[1] < CMYK[2])
+ CMYK[3] = CMYK[1];
+ else
+ CMYK[3] = CMYK[2];
+ }
+ check_estack(1);
+ push(2);
+ op = osp - 4;
+ for (i=0;i<4;i++) {
+ make_real(op, CMYK[i]);
+ op++;
+ }
+ make_real(op, CMYK[3]);
+ esp++;
+ *esp = istate->undercolor_removal;
+ return o_push_estack;
+ break;
+ default:
+ return_error(e_undefined);
+ break;
+ }
+ break;
+ case 1:
+ (*stage)++;
+ *cont = 1;
+ check_estack(1);
+ check_op(5);
+ op -= 4;
+ for (i=0;i<4;i++) {
+ if (!r_has_type(op, t_integer)) {
+ if (r_has_type(op, t_real)) {
+ CMYK[i] = op->value.realval;
+ } else
+ return_error(e_typecheck);
+ } else
+ CMYK[i] = (float)op->value.intval;
+ op++;
+ }
+ if (!r_has_type(op, t_integer)) {
+ if (r_has_type(op, t_real)) {
+ UCR = op->value.realval;
+ } else
+ return_error(e_typecheck);
+ } else
+ UCR = (float)op->value.intval;
+ for (i=0;i<3;i++) {
+ CMYK[i] = CMYK[i] - UCR;
+ if (CMYK[i] < 0)
+ CMYK[i] = 0;
+ if (CMYK[i] > 1)
+ CMYK[i] = 1.0;
+ }
+ op -= 4;
+ for (i=0;i<4;i++) {
+ make_real(op, CMYK[i]);
+ op++;
+ }
+ make_real(op, CMYK[3]);
+ esp++;
+ *esp = istate->black_generation;
+ return o_push_estack;
+ break;
+ case 2:
+ *stage = 0;
+ *cont = 0;
+ check_op(5);
+ if (!r_has_type(op, t_integer)) {
+ if (r_has_type(op, t_real)) {
+ BG = op->value.realval;
+ } else
+ return_error(e_typecheck);
+ } else
+ BG = (float)op->value.intval;
+ pop(1);
+ op = osp;
+ if (BG < 0)
+ BG = 0;
+ if (BG > 1)
+ BG = 1;
+ make_real(op, BG);
+ break;
}
return 0;
}
@@ -1648,21 +1643,21 @@ static int rgbvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comp
int i;
if (num_comps < 3)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 2;
for (i=0;i<3;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
for (i=0;i < 3; i++) {
- if (values[i] > 1.0)
- values[i] = 1.0;
+ if (values[i] > 1.0)
+ values[i] = 1.0;
- if (values[i] < 0.0)
- values[i] = 0.0;
+ if (values[i] < 0.0)
+ values[i] = 0.0;
}
return 0;
@@ -1687,120 +1682,120 @@ static int setcmykspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CI
ref stref;
do {
- switch (*stage) {
- case 0:
- if (istate->use_cie_color.value.boolval && !CIESubst) {
- byte *body;
- ref *nosubst;
-
- code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
- if (code < 0)
- return code;
- if (!r_has_type(nosubst, t_boolean))
- return_error(e_typecheck);
- if (nosubst->value.boolval) {
- *stage = 4;
- *cont = 1;
- body = ialloc_string(32, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "/DefaultCMYK ..nosubstdevicetest",32);
- make_string(&stref, a_all | icurrent_space, 32, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- } else {
- *stage = 2;
- *cont = 1;
- body = ialloc_string(47, "string");
- if (body == 0)
- return_error(e_VMerror);
- memcpy(body, "{/DefaultCMYK /ColorSpace findresource} stopped", 47);
- make_string(&stref, a_all | icurrent_space, 47, body);
- r_set_attrs(&stref, a_executable);
- esp++;
- ref_assign(esp, &stref);
- return o_push_estack;
- }
- }
- /* fall through */
- case 1:
- pcs = gs_cspace_new_DeviceCMYK(imemory);
- if (pcs == NULL)
- return_error(e_VMerror);
- code = gs_setcolorspace(igs, pcs);
- if (code >= 0) {
- gs_client_color *pcc = gs_currentcolor_inline(igs);
-
- cs_adjust_color_count(igs, -1); /* not strictly necessary */
- pcc->paint.values[0] = 0;
- pcc->paint.values[1] = 0;
- pcc->paint.values[2] = 0;
- pcc->paint.values[3] = 1;
- pcc->pattern = 0; /* for GC */
- gx_unset_dev_color(igs);
- }
- rc_decrement_only_cs(pcs, "zsetdevcspace");
- *cont = 0;
- *stage = 0;
- break;
- case 2:
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- if (op->value.boolval) {
- /* Failed to find the /DefaultCMYK CSA, so give up and
- * just use DeviceCMYK
- */
- pop(1);
- *stage = 1;
- break;
- }
- pop(1);
- *stage = 3;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- break;
- case 3:
- /* We end up here after setting the DefaultGray CIE space
- * We've finished setting the gray color space, so we
- * just exit now
- */
- *cont = 0;
- *stage = 0;
- break;
- case 4:
- /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
- * is also true. We will have a boolean on the stack, if its true
- * then we need to set the space (also on the stack), invoke
- * .includecolorspace, and set /DeviceGray, otherwise we just need
- * to set DeviceGray. See gs-cspace.ps.
- */
- if (!r_has_type(op, t_boolean))
- return_error(e_typecheck);
- pop(1);
- *stage = 1;
- *cont = 1;
- if (op->value.boolval) {
- *stage = 5;
- code = setcolorspace_nosubst(i_ctx_p);
- if (code != 0)
- return code;
- }
- break;
- case 5:
- /* After stage 4 above, if we had to set a color space, we come
- * here. Now we need to use .includecolorspace to register the space
- * with any high-level devices which want it.
- */
- *stage = 1;
- *cont = 1;
- code = zincludecolorspace(i_ctx_p);
- if (code != 0)
- return code;
- break;
- }
+ switch (*stage) {
+ case 0:
+ if (istate->use_cie_color.value.boolval && !CIESubst) {
+ byte *body;
+ ref *nosubst;
+
+ code = dict_find_string(systemdict, "NOSUBSTDEVICECOLORS", &nosubst);
+ if (code < 0)
+ return code;
+ if (!r_has_type(nosubst, t_boolean))
+ return_error(e_typecheck);
+ if (nosubst->value.boolval) {
+ *stage = 4;
+ *cont = 1;
+ body = ialloc_string(32, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "/DefaultCMYK ..nosubstdevicetest",32);
+ make_string(&stref, a_all | icurrent_space, 32, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ } else {
+ *stage = 2;
+ *cont = 1;
+ body = ialloc_string(47, "string");
+ if (body == 0)
+ return_error(e_VMerror);
+ memcpy(body, "{/DefaultCMYK /ColorSpace findresource} stopped", 47);
+ make_string(&stref, a_all | icurrent_space, 47, body);
+ r_set_attrs(&stref, a_executable);
+ esp++;
+ ref_assign(esp, &stref);
+ return o_push_estack;
+ }
+ }
+ /* fall through */
+ case 1:
+ pcs = gs_cspace_new_DeviceCMYK(imemory);
+ if (pcs == NULL)
+ return_error(e_VMerror);
+ code = gs_setcolorspace(igs, pcs);
+ if (code >= 0) {
+ gs_client_color *pcc = gs_currentcolor_inline(igs);
+
+ cs_adjust_color_count(igs, -1); /* not strictly necessary */
+ pcc->paint.values[0] = 0;
+ pcc->paint.values[1] = 0;
+ pcc->paint.values[2] = 0;
+ pcc->paint.values[3] = 1;
+ pcc->pattern = 0; /* for GC */
+ gx_unset_dev_color(igs);
+ }
+ rc_decrement_only_cs(pcs, "zsetdevcspace");
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 2:
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ if (op->value.boolval) {
+ /* Failed to find the /DefaultCMYK CSA, so give up and
+ * just use DeviceCMYK
+ */
+ pop(1);
+ *stage = 1;
+ break;
+ }
+ pop(1);
+ *stage = 3;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ case 3:
+ /* We end up here after setting the DefaultGray CIE space
+ * We've finished setting the gray color space, so we
+ * just exit now
+ */
+ *cont = 0;
+ *stage = 0;
+ break;
+ case 4:
+ /* We come here if /UseCIEColor is true, and NOSUBSTDEVICECOLORS
+ * is also true. We will have a boolean on the stack, if its true
+ * then we need to set the space (also on the stack), invoke
+ * .includecolorspace, and set /DeviceGray, otherwise we just need
+ * to set DeviceGray. See gs-cspace.ps.
+ */
+ if (!r_has_type(op, t_boolean))
+ return_error(e_typecheck);
+ pop(1);
+ *stage = 1;
+ *cont = 1;
+ if (op->value.boolval) {
+ *stage = 5;
+ code = setcolorspace_nosubst(i_ctx_p);
+ if (code != 0)
+ return code;
+ }
+ break;
+ case 5:
+ /* After stage 4 above, if we had to set a color space, we come
+ * here. Now we need to use .includecolorspace to register the space
+ * with any high-level devices which want it.
+ */
+ *stage = 1;
+ *cont = 1;
+ code = zincludecolorspace(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ }
} while (*stage);
return code;
}
@@ -1809,8 +1804,8 @@ static int cmykdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
int i;
for (i = 0;i < 8;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -1819,8 +1814,8 @@ static int cmykrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
int i;
for (i = 0;i < 8;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -1838,16 +1833,16 @@ static int cmykbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, in
const gs_color_space * pcs = gs_currentcolorspace(igs);
if (pcs->id == cs_DeviceGray_id) {
- /* UGLY hack. Its possible for the graphics library to change the
- * colour space to DeviceGray (setcachedevice), but this does not
- * change the PostScript space. It can't, because the graphics library
- * doesn't know about the PostScript objects. If we get a current*
- * operation before the space has been restored, the colour space in
- * the graphics library and the PostScript stored space won't match.
- * If that happens then we need to pretend the PS colour space was
- * DeviceGray
- */
- return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth));
+ /* UGLY hack. Its possible for the graphics library to change the
+ * colour space to DeviceGray (setcachedevice), but this does not
+ * change the PostScript space. It can't, because the graphics library
+ * doesn't know about the PostScript objects. If we get a current*
+ * operation before the space has been restored, the colour space in
+ * the graphics library and the PostScript stored space won't match.
+ * If that happens then we need to pretend the PS colour space was
+ * DeviceGray
+ */
+ return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth));
}
*cont = 0;
@@ -1856,56 +1851,56 @@ static int cmykbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, in
op -= 3;
for (i=0;i<4;i++) {
if (!r_has_type(op, t_integer)) {
- if (r_has_type(op, t_real)) {
- CMYK[i] = op->value.realval;
- } else
- return_error(e_typecheck);
- } else
- CMYK[i] = (float)op->value.intval;
+ if (r_has_type(op, t_real)) {
+ CMYK[i] = op->value.realval;
+ } else
+ return_error(e_typecheck);
+ } else
+ CMYK[i] = (float)op->value.intval;
if (CMYK[i] < 0 || CMYK[i] > 1)
- return_error(e_rangecheck);
- op++;
+ return_error(e_rangecheck);
+ op++;
}
switch (base) {
- case 0:
- pop(3);
- op = osp;
- Gray = (0.3 * CMYK[0]) + (0.59 * CMYK[1]) + (0.11 * CMYK[2]) + CMYK[3];
- if (Gray > 1.0)
- Gray = 0;
- else
- Gray = 1.0 - Gray;
+ case 0:
+ pop(3);
+ op = osp;
+ Gray = (0.3 * CMYK[0]) + (0.59 * CMYK[1]) + (0.11 * CMYK[2]) + CMYK[3];
+ if (Gray > 1.0)
+ Gray = 0;
+ else
+ Gray = 1.0 - Gray;
make_real(op, Gray);
- break;
- case 1:
- case 2:
- pop(1);
- op = osp;
- RGB[0] = 1.0 - (CMYK[0] + CMYK[3]);
- if (RGB[0] < 0)
- RGB[0] = 0;
- RGB[1] = 1.0 - (CMYK[1] + CMYK[3]);
- if (RGB[1] < 0)
- RGB[1] = 0;
- RGB[2] = 1.0 - (CMYK[2] + CMYK[3]);
- if (RGB[2] < 0)
- RGB[2] = 0;
- if (base == 1)
- rgb2hsb((float *)&RGB);
+ break;
+ case 1:
+ case 2:
+ pop(1);
+ op = osp;
+ RGB[0] = 1.0 - (CMYK[0] + CMYK[3]);
+ if (RGB[0] < 0)
+ RGB[0] = 0;
+ RGB[1] = 1.0 - (CMYK[1] + CMYK[3]);
+ if (RGB[1] < 0)
+ RGB[1] = 0;
+ RGB[2] = 1.0 - (CMYK[2] + CMYK[3]);
+ if (RGB[2] < 0)
+ RGB[2] = 0;
+ if (base == 1)
+ rgb2hsb((float *)&RGB);
make_real(&op[-2], RGB[0]);
make_real(&op[-1], RGB[1]);
make_real(op, RGB[2]);
- break;
- case 3:
- op = osp;
+ break;
+ case 3:
+ op = osp;
make_real(&op[-3], CMYK[0]);
make_real(&op[-2], CMYK[1]);
make_real(&op[-1], CMYK[2]);
make_real(op, CMYK[3]);
- break;
- default:
- return_error(e_undefined);
+ break;
+ default:
+ return_error(e_undefined);
}
return 0;
}
@@ -1915,21 +1910,21 @@ static int cmykvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_com
int i;
if (num_comps < 4)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 3;
for (i=0;i < 4;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
for (i=0;i < 4; i++) {
- if (values[i] > 1.0)
- values[i] = 1.0;
+ if (values[i] > 1.0)
+ values[i] = 1.0;
- if (values[i] < 0.0)
- values[i] = 0.0;
+ if (values[i] < 0.0)
+ values[i] = 0.0;
}
return 0;
@@ -1957,74 +1952,74 @@ static int comparearrays(i_ctx_t * i_ctx_p, ref *m1, ref *m2)
ref ref1, ref2;
if (r_size(m1) != r_size(m2))
- return 0;
+ return 0;
for (i=0;i < r_size(m1);i++) {
- code = array_get(imemory, m1, i, &ref1);
- if (code < 0)
- return 0;
- code = array_get(imemory, m2, i, &ref2);
- if (code < 0)
- return 0;
-
- if (r_type(&ref1) != r_type(&ref2))
- return 0;
-
- code = r_type(&ref1);
- switch(r_type(&ref1)) {
- case t_null:
- break;
- case t_boolean:
- if (ref1.value.boolval != ref2.value.boolval)
- return 0;
- break;
- case t_integer:
- if (ref1.value.intval != ref2.value.intval)
- return 0;
- break;
- case t_real:
- if (ref1.value.realval != ref2.value.realval)
- return 0;
- break;
- case t_name:
- if (!name_eq(&ref1, &ref2))
- return 0;
- break;
- case t_string:
- if (r_size(&ref1) != r_size(&ref2))
- return 0;
- if (strncmp((const char *)ref1.value.const_bytes, (const char *)ref2.value.const_bytes, r_size(&ref1)) != 0)
- return 0;
- break;
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- if (!comparearrays(i_ctx_p, &ref1, &ref2))
- return 0;
- break;
- case t_oparray:
- break;
- case t_operator:
- if (ref1.value.opproc != ref2.value.opproc)
- return 0;
- break;
- case t__invalid:
- case t_dictionary:
- case t_file:
- case t_unused_array_:
- case t_struct:
- case t_astruct:
- case t_fontID:
- case t_save:
- case t_mark:
- case t_device:
- return 0;
- default:
- /* Some high frequency operators are defined starting at t_next_index
- * I think as long as the 'type' of each is the same, we are OK
- */
- break;
- }
+ code = array_get(imemory, m1, i, &ref1);
+ if (code < 0)
+ return 0;
+ code = array_get(imemory, m2, i, &ref2);
+ if (code < 0)
+ return 0;
+
+ if (r_type(&ref1) != r_type(&ref2))
+ return 0;
+
+ code = r_type(&ref1);
+ switch(r_type(&ref1)) {
+ case t_null:
+ break;
+ case t_boolean:
+ if (ref1.value.boolval != ref2.value.boolval)
+ return 0;
+ break;
+ case t_integer:
+ if (ref1.value.intval != ref2.value.intval)
+ return 0;
+ break;
+ case t_real:
+ if (ref1.value.realval != ref2.value.realval)
+ return 0;
+ break;
+ case t_name:
+ if (!name_eq(&ref1, &ref2))
+ return 0;
+ break;
+ case t_string:
+ if (r_size(&ref1) != r_size(&ref2))
+ return 0;
+ if (strncmp((const char *)ref1.value.const_bytes, (const char *)ref2.value.const_bytes, r_size(&ref1)) != 0)
+ return 0;
+ break;
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ if (!comparearrays(i_ctx_p, &ref1, &ref2))
+ return 0;
+ break;
+ case t_oparray:
+ break;
+ case t_operator:
+ if (ref1.value.opproc != ref2.value.opproc)
+ return 0;
+ break;
+ case t__invalid:
+ case t_dictionary:
+ case t_file:
+ case t_unused_array_:
+ case t_struct:
+ case t_astruct:
+ case t_fontID:
+ case t_save:
+ case t_mark:
+ case t_device:
+ return 0;
+ default:
+ /* Some high frequency operators are defined starting at t_next_index
+ * I think as long as the 'type' of each is the same, we are OK
+ */
+ break;
+ }
}
return 1;
}
@@ -2041,16 +2036,16 @@ static int comparedictkey(i_ctx_t * i_ctx_p, ref *CIEdict1, ref *CIEdict2, char
code = dict_find_string(CIEdict1, key, &tempref1);
code1 = dict_find_string(CIEdict2, key, &tempref2);
if (code != code1)
- return 0;
+ return 0;
if (code < 0)
- return 1;
+ return 1;
if (r_type(tempref1) != r_type(tempref2))
- return 0;
+ return 0;
if (r_type(tempref1) == t_null)
- return 1;
+ return 1;
return comparearrays(i_ctx_p, tempref1, tempref2);
}
@@ -2064,27 +2059,27 @@ static int checkWhitePoint(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "WhitePoint", &tempref);
if (code < 0 || r_has_type(tempref, t_null))
- return code;
+ return code;
if (!r_is_array(tempref))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (r_size(tempref) != 3)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
for (i=0;i<3;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
/* Xw and Zw must be positive and Yw must be 1 (3rd edition PLRM p230) */
if (value[0] < 0 || value[1] != 1 || value[2] < 0 )
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return 0;
}
@@ -2097,21 +2092,21 @@ static int checkBlackPoint(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "BlackPoint", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 3)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 3)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
}
return 0;
@@ -2125,24 +2120,24 @@ static int checkRangeLMN(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "RangeLMN", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 6)
- return_error(e_rangecheck);
-
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 6)
+ return_error(e_rangecheck);
+
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
+ return_error(e_rangecheck);
}
return 0;
}
@@ -2154,17 +2149,17 @@ static int checkDecodeLMN(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "DecodeLMN", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 3)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- check_proc(valref);
- }
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 3)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ check_proc(valref);
+ }
}
return 0;
}
@@ -2177,21 +2172,21 @@ static int checkMatrixLMN(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "MatrixLMN", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 9)
- return_error(e_rangecheck);
-
- for (i=0;i<9;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 9)
+ return_error(e_rangecheck);
+
+ for (i=0;i<9;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
}
return 0;
@@ -2205,28 +2200,28 @@ static int setcieaspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CI
ulong dictkey;
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(nocie, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (nocie->value.boolval)
- return setgrayspace(i_ctx_p, r, stage, cont, 1);
+ return setgrayspace(i_ctx_p, r, stage, cont, 1);
*cont = 0;
code = array_get(imemory, r, 1, &CIEDict);
if (code < 0)
- return code;
+ return code;
if ((*stage) > 0) {
- gs_client_color cc;
+ gs_client_color cc;
- cc.pattern = 0x00;
- cc.paint.values[0] = 0;
- code = gs_setcolor(igs, &cc);
+ cc.pattern = 0x00;
+ cc.paint.values[0] = 0;
+ code = gs_setcolor(igs, &cc);
*stage = 0;
- return code;
+ return code;
}
dictkey = r->value.refs->value.saveid;
code = cieaspace(i_ctx_p, &CIEDict, dictkey);
@@ -2241,88 +2236,88 @@ static int validatecieaspace(i_ctx_t * i_ctx_p, ref **r)
ref CIEdict, *CIEspace = *r, *tempref, valref;
if (!r_is_array(CIEspace))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(CIEspace) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, CIEspace, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
check_read_type(CIEdict, t_dictionary);
/* Check white point exists, and is an array of three numbers */
code = checkWhitePoint(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
/* Remaining parameters are optional, but we must validate
* them if they are present
*/
code = dict_find_string(&CIEdict, "RangeA", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- /* Array of two numbers A0 < A1 */
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 2)
- return_error(e_rangecheck);
-
- for (i=0;i<2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ /* Array of two numbers A0 < A1 */
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 2)
+ return_error(e_rangecheck);
+
+ for (i=0;i<2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0])
- return_error(e_rangecheck);
+ if (value[1] < value[0])
+ return_error(e_rangecheck);
}
code = dict_find_string(&CIEdict, "DecodeA", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- check_proc(*tempref);
+ check_proc(*tempref);
}
code = dict_find_string(&CIEdict, "MatrixA", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 3)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 3)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
}
code = checkRangeLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkDecodeLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkMatrixLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkBlackPoint(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
*r = 0;
return 0;
@@ -2334,28 +2329,28 @@ static int cieadomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeA entry in the dictionary, get the
* values from that
*/
code = dict_find_string(&CIEdict, "RangeA", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for CIEBasedA */
- ptr[0] = 0;
- ptr[1] = 1;
+ /* Default values for CIEBasedA */
+ ptr[0] = 0;
+ ptr[1] = 1;
}
return 0;
}
@@ -2366,28 +2361,28 @@ static int ciearange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeA entry in the dictionary, get the
* values from that
*/
code = dict_find_string(&CIEdict, "RangeA", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for CIEBasedA */
- ptr[0] = 0;
- ptr[1] = 1;
+ /* Default values for CIEBasedA */
+ ptr[0] = 0;
+ ptr[1] = 1;
}
return 0;
}
@@ -2396,10 +2391,10 @@ static int cieavalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_com
os_ptr op = osp;
if (num_comps < 1)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
+ return_error(e_typecheck);
return 0;
}
@@ -2410,26 +2405,26 @@ static int cieacompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &CIEdict1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &CIEdict2);
if (code < 0)
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"WhitePoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"BlackPoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeA"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeA"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixA"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixMN"))
- return 0;
+ return 0;
return 1;
}
@@ -2441,31 +2436,31 @@ static int setcieabcspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
ulong dictkey;
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(nocie, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (nocie->value.boolval)
- return setrgbspace(i_ctx_p, r, stage, cont, 1);
+ return setrgbspace(i_ctx_p, r, stage, cont, 1);
*cont = 0;
code = array_get(imemory, r, 1, &CIEDict);
if (code < 0)
- return code;
+ return code;
if ((*stage) > 0) {
- gs_client_color cc;
- int i;
+ gs_client_color cc;
+ int i;
- cc.pattern = 0x00;
- for (i=0;i<3;i++)
- cc.paint.values[i] = 0;
- code = gs_setcolor(igs, &cc);
+ cc.pattern = 0x00;
+ for (i=0;i<3;i++)
+ cc.paint.values[i] = 0;
+ code = gs_setcolor(igs, &cc);
*stage = 0;
- return code;
+ return code;
}
dictkey = r->value.refs->value.saveid;
code = cieabcspace(i_ctx_p, &CIEDict,dictkey);
@@ -2480,97 +2475,96 @@ static int validatecieabcspace(i_ctx_t * i_ctx_p, ref **r)
ref CIEdict, *CIEspace = *r, *tempref, valref;
if (!r_is_array(CIEspace))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(CIEspace) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, CIEspace, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
check_read_type(CIEdict, t_dictionary);
/* Check white point exists, and is an array of three numbers */
code = checkWhitePoint(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
/* Remaining parameters are optional, but we must validate
* them if they are present
*/
code = dict_find_string(&CIEdict, "RangeABC", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 6)
- return_error(e_rangecheck);
-
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 6)
+ return_error(e_rangecheck);
+
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
+ return_error(e_rangecheck);
}
code = dict_find_string(&CIEdict, "DecodeABC", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 3)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- check_proc(valref);
- }
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 3)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ check_proc(valref);
+ }
}
code = dict_find_string(&CIEdict, "MatrixABC", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 9)
- return_error(e_rangecheck);
-
- for (i=0;i<9;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 9)
+ return_error(e_rangecheck);
+
+ for (i=0;i<9;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
}
-
code = checkRangeLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkDecodeLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkMatrixLMN(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
code = checkBlackPoint(i_ctx_p, &CIEdict);
if (code != 0)
- return code;
+ return code;
*r = 0;
return 0;
@@ -2582,28 +2576,28 @@ static int cieabcdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeABC, get the values from that */
code = dict_find_string(&CIEdict, "RangeABC", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for CIEBasedABC */
- for (i=0;i<3;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for CIEBasedABC */
+ for (i=0;i<3;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -2614,28 +2608,28 @@ static int cieabcrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeABC, get the values from that */
code = dict_find_string(&CIEdict, "RangeABC", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for CIEBasedABC */
- for (i=0;i<3;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for CIEBasedABC */
+ for (i=0;i<3;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -2645,13 +2639,13 @@ static int cieabcvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_c
int i;
if (num_comps < 3)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 2;
for (i=0;i<3;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
return 0;
@@ -2663,26 +2657,26 @@ static int cieabccompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &CIEdict1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &CIEdict2);
if (code < 0)
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"WhitePoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"BlackPoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixMN"))
- return 0;
+ return 0;
return 1;
}
@@ -2694,30 +2688,30 @@ static int setciedefspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
ulong dictkey;
if (i_ctx_p->language_level < 3)
- return_error(e_undefined);
+ return_error(e_undefined);
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(nocie, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (nocie->value.boolval)
- return setrgbspace(i_ctx_p, r, stage, cont, 1);
+ return setrgbspace(i_ctx_p, r, stage, cont, 1);
*cont = 0;
code = array_get(imemory, r, 1, &CIEDict);
if (code < 0)
- return code;
+ return code;
if ((*stage) > 0) {
- gs_client_color cc;
- int i;
+ gs_client_color cc;
+ int i;
- cc.pattern = 0x00;
- for (i=0;i<3;i++)
- cc.paint.values[i] = 0;
- code = gs_setcolor(igs, &cc);
+ cc.pattern = 0x00;
+ for (i=0;i<3;i++)
+ cc.paint.values[i] = 0;
+ code = gs_setcolor(igs, &cc);
*stage = 0;
- return code;
+ return code;
}
dictkey = r->value.refs->value.saveid;
code = ciedefspace(i_ctx_p, &CIEDict, dictkey);
@@ -2732,60 +2726,60 @@ static int validateciedefspace(i_ctx_t * i_ctx_p, ref **r)
ref CIEdict, *pref, *CIEspace = *r, tempref, valref;
if (!r_is_array(CIEspace))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(CIEspace) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, CIEspace, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
check_read_type(CIEdict, t_dictionary);
code = validatecieabcspace(i_ctx_p, r);
if (code != 0)
- return code;
+ return code;
pref = &tempref;
code = dict_find_string(&CIEdict, "Table", &pref);
if (code >= 0) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 4)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else
- return_error(e_typecheck);
- }
- if (value[0] <= 1 || value[1] <= 1 || value[2] <= 1)
- return_error(e_rangecheck);
-
- code = array_get(imemory, pref, 3, &valref);
- if (code < 0)
- return code;
- if (!r_is_array(&valref))
- return_error(e_typecheck);
- if (r_size(&valref) != value[0])
- return_error(e_rangecheck);
-
- for (i=0;i<value[0];i++) {
- code = array_get(imemory, &valref, i, &tempref);
- if (code < 0)
- return code;
- if (!r_has_type(&tempref, t_string))
- return_error(e_typecheck);
-
- if (r_size(&tempref) != (3 * value[1] * value[2]))
- return_error(e_rangecheck);
- }
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 4)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else
+ return_error(e_typecheck);
+ }
+ if (value[0] <= 1 || value[1] <= 1 || value[2] <= 1)
+ return_error(e_rangecheck);
+
+ code = array_get(imemory, pref, 3, &valref);
+ if (code < 0)
+ return code;
+ if (!r_is_array(&valref))
+ return_error(e_typecheck);
+ if (r_size(&valref) != value[0])
+ return_error(e_rangecheck);
+
+ for (i=0;i<value[0];i++) {
+ code = array_get(imemory, &valref, i, &tempref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&tempref, t_string))
+ return_error(e_typecheck);
+
+ if (r_size(&tempref) != (3 * value[1] * value[2]))
+ return_error(e_rangecheck);
+ }
} else {
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
}
/* Remaining parameters are optional, but we must validate
@@ -2793,61 +2787,61 @@ static int validateciedefspace(i_ctx_t * i_ctx_p, ref **r)
*/
code = dict_find_string(&CIEdict, "RangeDEF", &pref);
if (code >= 0 && !r_has_type(&tempref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 6)
- return_error(e_rangecheck);
-
- for (i=0;i<6;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 6)
+ return_error(e_rangecheck);
+
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
+ return_error(e_rangecheck);
}
code = dict_find_string(&CIEdict, "DecodeDEF", &pref);
if (code >= 0 && !r_has_type(pref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 3)
- return_error(e_rangecheck);
-
- for (i=0;i<3;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- check_proc(valref);
- }
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 3)
+ return_error(e_rangecheck);
+
+ for (i=0;i<3;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ check_proc(valref);
+ }
}
code = dict_find_string(&CIEdict, "RangeHIJ", &pref);
if (code >= 0 && !r_has_type(pref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 6)
- return_error(e_rangecheck);
-
- for (i=0;i<6;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 6)
+ return_error(e_rangecheck);
+
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4])
+ return_error(e_rangecheck);
}
*r = 0;
@@ -2860,28 +2854,28 @@ static int ciedefdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeDEF, get the values from that */
code = dict_find_string(&CIEdict, "RangeDEF", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for a CIEBasedDEF */
- for (i=0;i<3;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for a CIEBasedDEF */
+ for (i=0;i<3;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -2892,28 +2886,28 @@ static int ciedefrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeDEF, get the values from that */
code = dict_find_string(&CIEdict, "RangeDEF", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<6;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<6;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for a CIEBasedDEF */
- for (i=0;i<3;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for a CIEBasedDEF */
+ for (i=0;i<3;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -2923,13 +2917,13 @@ static int ciedefvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_c
int i;
if (num_comps < 3)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 2;
for (i=0;i<3;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
return 0;
@@ -2941,34 +2935,34 @@ static int ciedefcompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &CIEdict1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &CIEdict2);
if (code < 0)
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"WhitePoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"BlackPoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeDEF"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeDEF"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeHIJ"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"Table"))
- return 0;
+ return 0;
return 1;
}
@@ -2980,30 +2974,30 @@ static int setciedefgspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
ulong dictkey;
if (i_ctx_p->language_level < 3)
- return_error(e_undefined);
+ return_error(e_undefined);
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(nocie, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (nocie->value.boolval)
- return setcmykspace(i_ctx_p, r, stage, cont, 1);
+ return setcmykspace(i_ctx_p, r, stage, cont, 1);
*cont = 0;
code = array_get(imemory, r, 1, &CIEDict);
if (code < 0)
- return code;
+ return code;
if ((*stage) > 0) {
- gs_client_color cc;
- int i;
+ gs_client_color cc;
+ int i;
- cc.pattern = 0x00;
- for (i=0;i<4;i++)
- cc.paint.values[i] = 0;
- code = gs_setcolor(igs, &cc);
+ cc.pattern = 0x00;
+ for (i=0;i<4;i++)
+ cc.paint.values[i] = 0;
+ code = gs_setcolor(igs, &cc);
*stage = 0;
- return code;
+ return code;
}
dictkey = r->value.refs->value.saveid;
code = ciedefgspace(i_ctx_p, &CIEDict,dictkey);
@@ -3018,64 +3012,64 @@ static int validateciedefgspace(i_ctx_t * i_ctx_p, ref **r)
ref CIEdict, *CIEspace = *r, tempref, arrayref, valref, *pref = &tempref;
if (!r_is_array(CIEspace))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(CIEspace) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, CIEspace, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
check_read_type(CIEdict, t_dictionary);
code = validatecieabcspace(i_ctx_p, r);
if (code != 0)
- return code;
+ return code;
code = dict_find_string(&CIEdict, "Table", &pref);
if (code >= 0) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 5)
- return_error(e_rangecheck);
-
- for (i=0;i<4;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else
- return_error(e_typecheck);
- }
- if (value[0] <= 1 || value[1] <= 1 || value[2] <= 1 || value[3] <= 1)
- return_error(e_rangecheck);
-
- code = array_get(imemory, pref, 4, &arrayref);
- if (code < 0)
- return code;
- if (!r_is_array(&arrayref))
- return_error(e_typecheck);
- if (r_size(&arrayref) != value[0])
- return_error(e_rangecheck);
-
- for (i=0;i<value[0];i++) {
- code = array_get(imemory, &arrayref, i, &tempref);
- if (code < 0)
- return code;
- for (j=0;j<value[1];j++) {
- code = array_get(imemory, &tempref, i, &valref);
- if (code < 0)
- return code;
- if (!r_has_type(&valref, t_string))
- return_error(e_typecheck);
-
- if (r_size(&valref) != (3 * value[2] * value[3]))
- return_error(e_rangecheck);
- }
- }
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 5)
+ return_error(e_rangecheck);
+
+ for (i=0;i<4;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else
+ return_error(e_typecheck);
+ }
+ if (value[0] <= 1 || value[1] <= 1 || value[2] <= 1 || value[3] <= 1)
+ return_error(e_rangecheck);
+
+ code = array_get(imemory, pref, 4, &arrayref);
+ if (code < 0)
+ return code;
+ if (!r_is_array(&arrayref))
+ return_error(e_typecheck);
+ if (r_size(&arrayref) != value[0])
+ return_error(e_rangecheck);
+
+ for (i=0;i<value[0];i++) {
+ code = array_get(imemory, &arrayref, i, &tempref);
+ if (code < 0)
+ return code;
+ for (j=0;j<value[1];j++) {
+ code = array_get(imemory, &tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&valref, t_string))
+ return_error(e_typecheck);
+
+ if (r_size(&valref) != (3 * value[2] * value[3]))
+ return_error(e_rangecheck);
+ }
+ }
} else {
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
}
/* Remaining parameters are optional, but we must validate
@@ -3083,61 +3077,61 @@ static int validateciedefgspace(i_ctx_t * i_ctx_p, ref **r)
*/
code = dict_find_string(&CIEdict, "RangeDEFG", &pref);
if (code >= 0 && !r_has_type(pref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 8)
- return_error(e_rangecheck);
-
- for (i=0;i<8;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 8)
+ return_error(e_rangecheck);
+
+ for (i=0;i<8;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4] || value[7] < value[6])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4] || value[7] < value[6])
+ return_error(e_rangecheck);
}
code = dict_find_string(&CIEdict, "DecodeDEFG", &pref);
if (code >= 0 && !r_has_type(pref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 4)
- return_error(e_rangecheck);
-
- for (i=0;i<4;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- check_proc(valref);
- }
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 4)
+ return_error(e_rangecheck);
+
+ for (i=0;i<4;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ check_proc(valref);
+ }
}
code = dict_find_string(&CIEdict, "RangeHIJK", &pref);
if (code >= 0 && !r_has_type(pref, t_null)) {
- if (!r_is_array(pref))
- return_error(e_typecheck);
- if (r_size(pref) != 8)
- return_error(e_rangecheck);
-
- for (i=0;i<8;i++) {
- code = array_get(imemory, pref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(pref))
+ return_error(e_typecheck);
+ if (r_size(pref) != 8)
+ return_error(e_rangecheck);
+
+ for (i=0;i<8;i++) {
+ code = array_get(imemory, pref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4] || value[7] < value[6])
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] || value[5] < value[4] || value[7] < value[6])
+ return_error(e_rangecheck);
}
*r = 0;
@@ -3150,28 +3144,28 @@ static int ciedefgdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeDEFG, get the values from that */
code = dict_find_string(&CIEdict, "RangeDEFG", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<8;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<8;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for a CIEBasedDEFG */
- for (i=0;i<4;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for a CIEBasedDEFG */
+ for (i=0;i<4;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -3182,28 +3176,28 @@ static int ciedefgrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a RangeDEFG, get the values from that */
code = dict_find_string(&CIEdict, "RangeDEFG", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<8;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<8;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for a CIEBasedDEFG */
- for (i=0;i<4;i++) {
- ptr[2 * i] = 0;
- ptr[(2 * i) + 1] = 1;
- }
+ /* Default values for a CIEBasedDEFG */
+ for (i=0;i<4;i++) {
+ ptr[2 * i] = 0;
+ ptr[(2 * i) + 1] = 1;
+ }
}
return 0;
}
@@ -3213,13 +3207,13 @@ static int ciedefgvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_
int i;
if (num_comps < 4)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 3;
for (i=0;i < 4;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
return 0;
}
@@ -3233,34 +3227,34 @@ static int ciedefgcompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &CIEdict1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &CIEdict2);
if (code < 0)
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"WhitePoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"BlackPoint"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixABC"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeLMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"MatrixMN"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeDEFG"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"DecodeDEFG"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"RangeHIJK"))
- return 0;
+ return 0;
if (!comparedictkey(i_ctx_p, &CIEdict1, &CIEdict2, (char *)"Table"))
- return 0;
+ return 0;
return 1;
}
@@ -3284,34 +3278,34 @@ static int ciebasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int
if (r_is_array(space))
spacename = space->value.refs;
else
- spacename = space;
+ spacename = space;
/* Check that it really is a name */
if (!r_has_type(spacename, t_name))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Find the relevant color space object */
for (i=0;i<4;i++) {
- code = names_ref(imemory->gs_lib_ctx->gs_name_table, (const byte *)CIESpaces[i], strlen(CIESpaces[i]), &nref, 0);
- if (code < 0)
- return code;
- if (name_eq(spacename, &nref)) {
- break;
- }
+ code = names_ref(imemory->gs_lib_ctx->gs_name_table, (const byte *)CIESpaces[i], strlen(CIESpaces[i]), &nref, 0);
+ if (code < 0)
+ return code;
+ if (name_eq(spacename, &nref)) {
+ break;
+ }
}
/* Find out how many values are on the stack, which depends
* on what kind of CIEBased space this is.
*/
switch(i){
- case 0:
- components = 1;
- break;
- case 1:
- case 2:
- components = 3;
- break;
- case 3:
- components = 4;
- break;
+ case 0:
+ components = 1;
+ break;
+ case 1:
+ case 2:
+ components = 3;
+ break;
+ case 3:
+ components = 4;
+ break;
}
/* Remove teh requisite number of values */
pop(components);
@@ -3320,30 +3314,30 @@ static int ciebasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int
* depends on the requested space.
*/
switch(base) {
- case 0:
- components = 1;
- break;
- case 1:
- case 2:
- components = 3;
- break;
- case 3:
- components = 4;
- break;
+ case 0:
+ components = 1;
+ break;
+ case 1:
+ case 2:
+ components = 3;
+ break;
+ case 3:
+ components = 4;
+ break;
}
push(components);
/* The PLRM says that all the components should be returned as 0.0 */
op -= components-1;
for (i=0;i<components;i++) {
- make_real(op, (float)0);
- op++;
+ make_real(op, (float)0);
+ op++;
}
/* However, Adobe implementations actually return 1.0 for the black
* channel of CMYK...
*/
if (components == 4) {
- op--;
- make_real(op, (float)1);
+ op--;
+ make_real(op, (float)1);
}
*stage = 0;
*cont = 0;
@@ -3369,11 +3363,11 @@ static int convert_transform(i_ctx_t * i_ctx_p, ref *arr, ref *pproc)
code = buildfunction(i_ctx_p, arr, pproc, 4);
if (code < 0)
- /* If that fails, try a type 0. We prefer a type 4
- * because a type 0 will require us to sample the
- * space, which is expensive
- */
- code = buildfunction(i_ctx_p, arr, pproc, 0);
+ /* If that fails, try a type 0. We prefer a type 4
+ * because a type 0 will require us to sample the
+ * space, which is expensive
+ */
+ code = buildfunction(i_ctx_p, arr, pproc, 0);
return code;
}
@@ -3393,57 +3387,57 @@ static int setseparationspace(i_ctx_t * i_ctx_p, ref *sepspace, int *stage, int
gs_client_color cc;
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
*cont = 0;
if ((*stage) == 0) {
- code = array_get(imemory, sepspace, 3, &proc);
- if (code < 0)
- return code;
- /* Check to see if we already have a function (eg from a PDF file) */
- pfn = ref_function(&proc);
- if (pfn == NULL) {
- /* Convert tint transform to a PostScript function */
- code = convert_transform(i_ctx_p, sepspace, &proc);
- if (code < 0)
- return code;
- if (code > 0) {
- *cont = 1;
- (*stage)++;
- return code;
- }
- /* We can only get here if the transform converted to a function
- * without requiring a continuation. Most likely this means its a
- * type 4 function. If so then it is still on the stack.
- */
- op = osp;
- pfn = ref_function(op);
- pop (1);
- }
+ code = array_get(imemory, sepspace, 3, &proc);
+ if (code < 0)
+ return code;
+ /* Check to see if we already have a function (eg from a PDF file) */
+ pfn = ref_function(&proc);
+ if (pfn == NULL) {
+ /* Convert tint transform to a PostScript function */
+ code = convert_transform(i_ctx_p, sepspace, &proc);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ *cont = 1;
+ (*stage)++;
+ return code;
+ }
+ /* We can only get here if the transform converted to a function
+ * without requiring a continuation. Most likely this means its a
+ * type 4 function. If so then it is still on the stack.
+ */
+ op = osp;
+ pfn = ref_function(op);
+ pop (1);
+ }
} else {
- /* The function is returned on the operand stack */
- op = osp;
- pfn = ref_function(op);
- pop (1);
+ /* The function is returned on the operand stack */
+ op = osp;
+ pfn = ref_function(op);
+ pop (1);
}
*stage = 0;
if ((code = name_ref(imemory, (const byte *)"All", 3, &name_all, 0)) < 0)
- return code;
+ return code;
if ((code = name_ref(imemory, (const byte *)"None", 4, &name_none, 0)) < 0)
- return code;
+ return code;
/* Check separation name is a string or name object */
code = array_get(imemory, sepspace, 1, &sname);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&sname, t_string)) {
code = name_from_string(imemory, &sname, &sname);
if (code < 0)
- return code;
+ return code;
}
sep_type = ( name_eq(&sname, &name_all) ? SEP_ALL :
- name_eq(&sname, &name_none) ? SEP_NONE : SEP_OTHER);
+ name_eq(&sname, &name_none) ? SEP_NONE : SEP_OTHER);
/* The alternate color space has been selected as the current color space */
pacs = gs_currentcolorspace(igs);
@@ -3452,27 +3446,27 @@ static int setseparationspace(i_ctx_t * i_ctx_p, ref *sepspace, int *stage, int
/* Now set the current color space as Separation */
code = gs_cspace_new_Separation(&pcs, pacs, imemory);
if (code < 0)
- return code;
+ return code;
pcs->params.separation.sep_type = sep_type;
pcs->params.separation.sep_name = name_index(imemory, &sname);
pcs->params.separation.get_colorname_string = gs_get_colorname_string;
code = array_get(imemory, sepspace, 1, &proc);
if (code < 0)
- return code;
+ return code;
istate->colorspace[0].procs.special.separation.layer_name = proc;
code = array_get(imemory, sepspace, 3, &proc);
if (code < 0)
- return code;
+ return code;
istate->colorspace[0].procs.special.separation.tint_transform = proc;
if (code >= 0)
code = gs_cspace_set_sepr_function(pcs, pfn);
if (code >= 0)
- code = gs_setcolorspace(igs, pcs);
+ code = gs_setcolorspace(igs, pcs);
/* release reference from construction */
rc_decrement_only_cs(pcs, "setseparationspace");
if (code < 0) {
- istate->colorspace[0] = cspace_old;
- return code;
+ istate->colorspace[0] = cspace_old;
+ return code;
}
cc.pattern = 0x00;
cc.paint.values[0] = 1.0;
@@ -3486,64 +3480,64 @@ static int validateseparationspace(i_ctx_t * i_ctx_p, ref **space)
ref nameref, sref, sname, altspace, tref;
if (!r_is_array(sepspace))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(sepspace) != 4)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Check separation name is a string or name object */
code = array_get(imemory, sepspace, 1, &sname);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(&sname, t_name)) {
- if (!r_has_type(&sname, t_string))
- return_error(e_typecheck);
- else {
- code = name_from_string(imemory, &sname, &sname);
- if (code < 0)
- return code;
- }
+ if (!r_has_type(&sname, t_string))
+ return_error(e_typecheck);
+ else {
+ code = name_from_string(imemory, &sname, &sname);
+ if (code < 0)
+ return code;
+ }
}
/* Check the tint transform is a procedure */
code = array_get(imemory, sepspace, 3, &tref);
if (code < 0)
- return code;
+ return code;
check_proc(tref);
/* Get the name of the alternate space */
code = array_get(imemory, sepspace, 2, &altspace);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&altspace, t_name))
- ref_assign(&nameref, &altspace);
+ ref_assign(&nameref, &altspace);
else {
- /* Make sure the alternate space is an array */
- if (!r_is_array(&altspace))
- return_error(e_typecheck);
- /* And has a name for its type */
- code = array_get(imemory, &altspace, 0, &tref);
- if (code < 0)
- return code;
- if (!r_has_type(&tref, t_name))
- return_error(e_typecheck);
- ref_assign(&nameref, &tref);
+ /* Make sure the alternate space is an array */
+ if (!r_is_array(&altspace))
+ return_error(e_typecheck);
+ /* And has a name for its type */
+ code = array_get(imemory, &altspace, 0, &tref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&tref, t_name))
+ return_error(e_typecheck);
+ ref_assign(&nameref, &tref);
}
/* Convert alternate space name to string */
name_string_ref(imemory, &nameref, &sref);
/* Check its not /Indexed or /Pattern or /DeviceN */
if (r_size(&sref) == 7) {
- if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
- return_error(e_typecheck);
- if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
- return_error(e_typecheck);
- if (strncmp((const char *)sref.value.const_bytes, "DeviceN", 7) == 0)
- return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
+ return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
+ return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "DeviceN", 7) == 0)
+ return_error(e_typecheck);
}
/* and also not /Separation */
if (r_size(&sref) == 9 && strncmp((const char *)sref.value.const_bytes, "Separation", 9) == 0)
- return_error(e_typecheck);
+ return_error(e_typecheck);
ref_assign(*space, &altspace);
return 0;
@@ -3555,7 +3549,7 @@ static int separationalternatespace(i_ctx_t * i_ctx_p, ref *sepspace, ref **r, i
code = array_get(imemory, sepspace, 2, &tref);
if (code < 0)
- return code;
+ return code;
ref_assign(*r, &tref);
return 0;
}
@@ -3579,21 +3573,21 @@ static int septransform(i_ctx_t *i_ctx_p, ref *sepspace, int *usealternate, int
code = array_get(imemory, sepspace, 1, &sname);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&sname, t_name)) {
name_string_ref(imemory, &sname, &sname);
}
/* Check for /All and /None, never need the alternate for these */
if (r_size(&sname) == 3 &&
- strncmp("All", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 0;
- return 0;
+ strncmp("All", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 0;
+ return 0;
}
if (r_size(&sname) == 4 &&
- strncmp("None", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 0;
- return 0;
+ strncmp("None", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 0;
+ return 0;
}
/*
* Compare the colorant name to the device's. If the device's
@@ -3602,52 +3596,52 @@ static int septransform(i_ctx_t *i_ctx_p, ref *sepspace, int *usealternate, int
* SeparationOrder list.
*/
colorant_number = (*dev_proc(dev, get_color_comp_index))
- (dev, (const char *)sname.value.bytes, r_size(&sname), SEPARATION_NAME);
+ (dev, (const char *)sname.value.bytes, r_size(&sname), SEPARATION_NAME);
if (colorant_number >= 0) { /* If valid colorant name */
- *usealternate = 0;
+ *usealternate = 0;
} else
- *usealternate = 1;
+ *usealternate = 1;
if (r_size(&sname) == 4 &&
- strncmp("Gray", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Gray", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 4 &&
- strncmp("Cyan", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Cyan", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 7 &&
- strncmp("Magenta", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Magenta", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 6 &&
- strncmp("Yellow", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Yellow", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 5 &&
- strncmp("Black", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Black", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 3 &&
- strncmp("Red", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Red", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 5 &&
- strncmp("Green", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Green", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (r_size(&sname) == 4 &&
- strncmp("Blue", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
+ strncmp("Blue", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
}
if (*usealternate && *stage == 0) {
- (*stage)++;
- esp++;
- code = array_get(imemory, sepspace, 3, &proc);
- if (code < 0)
- return code;
- *esp = proc;
- return o_push_estack;
+ (*stage)++;
+ esp++;
+ code = array_get(imemory, sepspace, 3, &proc);
+ if (code < 0)
+ return code;
+ *esp = proc;
+ return o_push_estack;
}
*stage = 0;
return 0;
@@ -3657,38 +3651,38 @@ static int sepbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int
os_ptr op = osp; /* required by "push" macro */
int use, code;
- code = septransform(i_ctx_p, space, &use, stage, stack_depth);
- if (code != 0)
- return code;
- if (!use) {
- *stage = 0;
- *cont = 0;
- pop(1);
- op = osp;
- switch(base) {
- case 0:
- push(1);
- make_real(op, 0.0);
- break;
- case 1:
- case 2:
- push(3);
- make_real(&op[-2], 0.0);
- make_real(&op[-1], 0.0);
- make_real(op, 0.0);
- break;
- case 3:
- push(4);
- make_real(&op[-3], 0.0);
- make_real(&op[-2], 0.0);
- make_real(&op[-1], 0.0);
- make_real(op, 0.0);
- break;
- }
- } else {
- *stage = 0;
- *cont = 1;
- }
+ code = septransform(i_ctx_p, space, &use, stage, stack_depth);
+ if (code != 0)
+ return code;
+ if (!use) {
+ *stage = 0;
+ *cont = 0;
+ pop(1);
+ op = osp;
+ switch(base) {
+ case 0:
+ push(1);
+ make_real(op, 0.0);
+ break;
+ case 1:
+ case 2:
+ push(3);
+ make_real(&op[-2], 0.0);
+ make_real(&op[-1], 0.0);
+ make_real(op, 0.0);
+ break;
+ case 3:
+ push(4);
+ make_real(&op[-3], 0.0);
+ make_real(&op[-2], 0.0);
+ make_real(&op[-1], 0.0);
+ make_real(op, 0.0);
+ break;
+ }
+ } else {
+ *stage = 0;
+ *cont = 1;
+ }
return 0;
}
static int sepvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps)
@@ -3696,16 +3690,16 @@ static int sepvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comp
os_ptr op = osp;
if (num_comps < 1)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (*values > 1.0)
- *values = 1.0;
+ *values = 1.0;
if (*values < 0.0)
- *values = 0.0;
+ *values = 0.0;
return 0;
}
@@ -3716,53 +3710,53 @@ static int sepcompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &sname2);
if (code < 0)
- return 0;
+ return 0;
if (r_type(&sname1) != r_type(&sname2))
- return 0;
+ return 0;
switch(r_type(&sname1)) {
- case t_name:
- if (!name_eq(&sname1, &sname2))
- return 0;
- break;
- case t_string:
- if (r_size(&sname1) != r_size(&sname2))
- return 0;
- if (strncmp((const char *)sname1.value.const_bytes, (const char *)sname2.value.const_bytes, r_size(&sname1)) != 0)
- return 0;
- break;
- default:
- return 0;
+ case t_name:
+ if (!name_eq(&sname1, &sname2))
+ return 0;
+ break;
+ case t_string:
+ if (r_size(&sname1) != r_size(&sname2))
+ return 0;
+ if (strncmp((const char *)sname1.value.const_bytes, (const char *)sname2.value.const_bytes, r_size(&sname1)) != 0)
+ return 0;
+ break;
+ default:
+ return 0;
}
code = array_get(imemory, testspace, 2, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 2, &sname2);
if (code < 0)
- return 0;
+ return 0;
if (r_type(&sname1) != r_type(&sname2))
- return 0;
+ return 0;
if (r_is_array(&sname1)) {
- if (!comparearrays(i_ctx_p, &sname1, &sname2))
- return 0;
+ if (!comparearrays(i_ctx_p, &sname1, &sname2))
+ return 0;
} else {
- if (!r_has_type(&sname1, t_name))
- return 0;
- if (!name_eq(&sname1, &sname2))
- return 0;
+ if (!r_has_type(&sname1, t_name))
+ return 0;
+ if (!name_eq(&sname1, &sname2))
+ return 0;
}
code = array_get(imemory, space, 3, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 3, &sname2);
if (code < 0)
- return 0;
+ return 0;
return(comparearrays(i_ctx_p, &sname1, &sname2));
}
static int sepinitialproc(i_ctx_t *i_ctx_p, ref *space)
@@ -3791,72 +3785,72 @@ static int devicencolorants_cont(i_ctx_t *i_ctx_p)
do {
if (index >= dict_length(pdict)) {
- esp -= 4;
- return o_pop_estack;
- }
-
- if (stage == 0) {
- code = gs_gsave(igs);
- if (code < 0)
- return code;
-
- code = dict_index_entry(pdict, index, (ref *)&space);
- if (code < 0) {
- make_int(pindex, ++index);
- code = gs_grestore(igs);
- if (code < 0)
- return code;
- continue;
- }
-
- code = validate_spaces(i_ctx_p, &space[1], &depth);
- if (code < 0) {
- make_int(pindex, ++index);
- code = gs_grestore(igs);
- if (code < 0)
- return code;
- return o_push_estack;
- }
-
- /* If we get a continuation from a sub-procedure, we will want to come back
- * here afterward, to do any remaining stages. We need to set up for that now.
- * so that our continuation is ahead of the sub-proc's continuation.
- */
- check_estack(1);
- push(1);
- /* The push_op_estack macro increments esp before use, so we don't need to */
- push_op_estack(devicencolorants_cont);
-
- make_int(pstage, 1);
- *op = space[1];
- code = zsetcolorspace(i_ctx_p);
- if (code != 0)
- return code;
- } else {
- stage = 0;
- code = dict_index_entry(pdict, index, (ref *)&space);
- if (code == 0) {
- switch (r_type(&space[0])) {
- case t_string:
- code = name_from_string(imemory, &space[0], &sname);
- if (code == 0)
- sep_name = name_index(imemory, &sname);
- break;
- case t_name:
- sep_name = name_index(imemory, &space[0]);
- break;
- default:
- code = e_typecheck;
- }
- }
- make_int(pindex, ++index);
- make_int(pstage, stage);
- if (code == 0)
- gs_attachattributecolorspace(sep_name, igs);
- code = gs_grestore(igs);
- if (code < 0)
- return code;
- }
+ esp -= 4;
+ return o_pop_estack;
+ }
+
+ if (stage == 0) {
+ code = gs_gsave(igs);
+ if (code < 0)
+ return code;
+
+ code = dict_index_entry(pdict, index, (ref *)&space);
+ if (code < 0) {
+ make_int(pindex, ++index);
+ code = gs_grestore(igs);
+ if (code < 0)
+ return code;
+ continue;
+ }
+
+ code = validate_spaces(i_ctx_p, &space[1], &depth);
+ if (code < 0) {
+ make_int(pindex, ++index);
+ code = gs_grestore(igs);
+ if (code < 0)
+ return code;
+ return o_push_estack;
+ }
+
+ /* If we get a continuation from a sub-procedure, we will want to come back
+ * here afterward, to do any remaining stages. We need to set up for that now.
+ * so that our continuation is ahead of the sub-proc's continuation.
+ */
+ check_estack(1);
+ push(1);
+ /* The push_op_estack macro increments esp before use, so we don't need to */
+ push_op_estack(devicencolorants_cont);
+
+ make_int(pstage, 1);
+ *op = space[1];
+ code = zsetcolorspace(i_ctx_p);
+ if (code != 0)
+ return code;
+ } else {
+ stage = 0;
+ code = dict_index_entry(pdict, index, (ref *)&space);
+ if (code == 0) {
+ switch (r_type(&space[0])) {
+ case t_string:
+ code = name_from_string(imemory, &space[0], &sname);
+ if (code == 0)
+ sep_name = name_index(imemory, &sname);
+ break;
+ case t_name:
+ sep_name = name_index(imemory, &space[0]);
+ break;
+ default:
+ code = e_typecheck;
+ }
+ }
+ make_int(pindex, ++index);
+ make_int(pstage, stage);
+ if (code == 0)
+ gs_attachattributecolorspace(sep_name, igs);
+ code = gs_grestore(igs);
+ if (code < 0)
+ return code;
+ }
}
while(1);
}
@@ -3875,187 +3869,187 @@ static int setdevicenspace(i_ctx_t * i_ctx_p, ref *devicenspace, int *stage, int
gs_client_color cc;
if (i_ctx_p->language_level < 3)
- return_error(e_undefined);
+ return_error(e_undefined);
*cont = 0;
if ((*stage) == 2) {
- if (r_size(devicenspace) == 5) {
- /* We have a Colorants dictionary from a PDF file. We need to handle this by
- * temporarily setting each of the spaces in the dict, and attaching the
- * resulting space to the DeviceN array. This is complicated, because
- * each space must be fully set up, and may result in running tint transform
- * procedures and caching results. We need to handle this in yet another
- * layering of continuation procedures.
- */
- code = array_get(imemory, devicenspace, 4, &sref);
- if (code < 0)
- return code;
- if (!r_has_type(&sref, t_dictionary)) {
- *stage = 0;
- return 0;
- }
- if (dict_length(&sref) == 0)
- return(0);
-
- code = dict_index_entry(&sref, 0, (ref *)&tempref);
- if (code < 0)
- return code;
- name_string_ref(imemory, &tempref[0], &sname);
- if (r_size(&sname) != 9 || strncmp((const char *)sname.value.const_bytes, "Colorants", r_size(&sname)) != 0) {
- *stage = 0;
- return 0;
- }
-
- *stage = 3;
- *cont = 1;
- check_estack(5);
- push_mark_estack(es_other, colour_cleanup);
- esp++;
- /* variable to hold index of the space we are dealing with */
- make_int(esp, 0);
- esp++;
- /* variable to hold processing step */
- make_int(esp, 0);
- esp++;
- /* Store a pointer to the Colorants dictionary
- */
- ref_assign(esp, &tempref[1]);
- push_op_estack(devicencolorants_cont);
- return o_push_estack;
- } else {
- *stage = 0;
- return 0;
- }
+ if (r_size(devicenspace) == 5) {
+ /* We have a Colorants dictionary from a PDF file. We need to handle this by
+ * temporarily setting each of the spaces in the dict, and attaching the
+ * resulting space to the DeviceN array. This is complicated, because
+ * each space must be fully set up, and may result in running tint transform
+ * procedures and caching results. We need to handle this in yet another
+ * layering of continuation procedures.
+ */
+ code = array_get(imemory, devicenspace, 4, &sref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&sref, t_dictionary)) {
+ *stage = 0;
+ return 0;
+ }
+ if (dict_length(&sref) == 0)
+ return(0);
+
+ code = dict_index_entry(&sref, 0, (ref *)&tempref);
+ if (code < 0)
+ return code;
+ name_string_ref(imemory, &tempref[0], &sname);
+ if (r_size(&sname) != 9 || strncmp((const char *)sname.value.const_bytes, "Colorants", r_size(&sname)) != 0) {
+ *stage = 0;
+ return 0;
+ }
+
+ *stage = 3;
+ *cont = 1;
+ check_estack(5);
+ push_mark_estack(es_other, colour_cleanup);
+ esp++;
+ /* variable to hold index of the space we are dealing with */
+ make_int(esp, 0);
+ esp++;
+ /* variable to hold processing step */
+ make_int(esp, 0);
+ esp++;
+ /* Store a pointer to the Colorants dictionary
+ */
+ ref_assign(esp, &tempref[1]);
+ push_op_estack(devicencolorants_cont);
+ return o_push_estack;
+ } else {
+ *stage = 0;
+ return 0;
+ }
}
if ((*stage) == 3) {
- *stage = 0;
- return 0;
+ *stage = 0;
+ return 0;
}
if ((*stage) == 0) {
- code = array_get(imemory, devicenspace, 3, &proc);
- if (code < 0)
- return code;
- pfn = ref_function(&proc);
- if (pfn == NULL) {
- /* Convert tint transform to a PostScript function */
- code = convert_transform(i_ctx_p, devicenspace, &proc);
- if (code < 0)
- return code;
- if (code > 0) {
- *cont = 1;
- *stage = 1;
- return code;
- }
- /* We can only get here if the transform converted to a function
- * without requiring a continuation. Most likely this means its a
- * type 4 function. If so then it is still on the stack.
- */
- op = osp;
- pfn = ref_function(op);
- pop (1);
- }
+ code = array_get(imemory, devicenspace, 3, &proc);
+ if (code < 0)
+ return code;
+ pfn = ref_function(&proc);
+ if (pfn == NULL) {
+ /* Convert tint transform to a PostScript function */
+ code = convert_transform(i_ctx_p, devicenspace, &proc);
+ if (code < 0)
+ return code;
+ if (code > 0) {
+ *cont = 1;
+ *stage = 1;
+ return code;
+ }
+ /* We can only get here if the transform converted to a function
+ * without requiring a continuation. Most likely this means its a
+ * type 4 function. If so then it is still on the stack.
+ */
+ op = osp;
+ pfn = ref_function(op);
+ pop (1);
+ }
} else {
- /* The function is returned on the operand stack */
- op = osp;
- pfn = ref_function(op);
- pop (1);
+ /* The function is returned on the operand stack */
+ op = osp;
+ pfn = ref_function(op);
+ pop (1);
}
*stage = 2;
code = array_get(imemory, devicenspace, 1, &namesarray);
if (code < 0)
- return code;
+ return code;
num_components = r_size(&namesarray);
/* The alternate color space has been selected as the current color space */
pacs = gs_currentcolorspace(igs);
if (num_components == 1) {
- array_get(imemory, &namesarray, (long)0, &sname);
- switch (r_type(&sname)) {
- case t_string:
- tname = sname;
- break;
- case t_name:
- name_string_ref(imemory, &sname, &tname);
- break;
- default:
- return_error(e_typecheck);
- break;
- }
- if (strncmp((const char *)tname.value.const_bytes, "All", 3) == 0 && r_size(&tname) == 3) {
- separation_type sep_type;
-
- /* Sigh, Acrobat allows this, even though its contra the spec. Convert to
- * a /Separation space and go on
- */
- sep_type = SEP_ALL;
-
- /* The alternate color space has been selected as the current color space */
- pacs = gs_currentcolorspace(igs);
-
- cspace_old = istate->colorspace[0];
- /* Now set the current color space as Separation */
- code = gs_cspace_new_Separation(&pcs, pacs, imemory);
- if (code < 0)
- return code;
- pcs->params.separation.sep_type = sep_type;
- pcs->params.separation.sep_name = name_index(imemory, &sname);
- pcs->params.separation.get_colorname_string = gs_get_colorname_string;
- code = array_get(imemory, &namesarray, (long)0, &sname);
- if (code < 0)
- return code;
- istate->colorspace[0].procs.special.separation.layer_name = sname;
- code = array_get(imemory, devicenspace, 3, &proc);
- if (code < 0)
- return code;
- istate->colorspace[0].procs.special.separation.tint_transform = proc;
- if (code >= 0)
- code = gs_cspace_set_sepr_function(pcs, pfn);
- if (code >= 0)
- code = gs_setcolorspace(igs, pcs);
- /* release reference from construction */
- rc_decrement_only_cs(pcs, "setseparationspace");
- if (code < 0) {
- istate->colorspace[0] = cspace_old;
- return code;
- }
- cc.pattern = 0x00;
- cc.paint.values[0] = 1.0;
- code = gs_setcolor(igs, &cc);
- return code;
- }
+ array_get(imemory, &namesarray, (long)0, &sname);
+ switch (r_type(&sname)) {
+ case t_string:
+ tname = sname;
+ break;
+ case t_name:
+ name_string_ref(imemory, &sname, &tname);
+ break;
+ default:
+ return_error(e_typecheck);
+ break;
+ }
+ if (strncmp((const char *)tname.value.const_bytes, "All", 3) == 0 && r_size(&tname) == 3) {
+ separation_type sep_type;
+
+ /* Sigh, Acrobat allows this, even though its contra the spec. Convert to
+ * a /Separation space and go on
+ */
+ sep_type = SEP_ALL;
+
+ /* The alternate color space has been selected as the current color space */
+ pacs = gs_currentcolorspace(igs);
+
+ cspace_old = istate->colorspace[0];
+ /* Now set the current color space as Separation */
+ code = gs_cspace_new_Separation(&pcs, pacs, imemory);
+ if (code < 0)
+ return code;
+ pcs->params.separation.sep_type = sep_type;
+ pcs->params.separation.sep_name = name_index(imemory, &sname);
+ pcs->params.separation.get_colorname_string = gs_get_colorname_string;
+ code = array_get(imemory, &namesarray, (long)0, &sname);
+ if (code < 0)
+ return code;
+ istate->colorspace[0].procs.special.separation.layer_name = sname;
+ code = array_get(imemory, devicenspace, 3, &proc);
+ if (code < 0)
+ return code;
+ istate->colorspace[0].procs.special.separation.tint_transform = proc;
+ if (code >= 0)
+ code = gs_cspace_set_sepr_function(pcs, pfn);
+ if (code >= 0)
+ code = gs_setcolorspace(igs, pcs);
+ /* release reference from construction */
+ rc_decrement_only_cs(pcs, "setseparationspace");
+ if (code < 0) {
+ istate->colorspace[0] = cspace_old;
+ return code;
+ }
+ cc.pattern = 0x00;
+ cc.paint.values[0] = 1.0;
+ code = gs_setcolor(igs, &cc);
+ return code;
+ }
}
code = gs_cspace_new_DeviceN(&pcs, num_components, pacs, imemory);
if (code < 0)
- return code;
+ return code;
names = pcs->params.device_n.names;
pmap = pcs->params.device_n.map;
pcs->params.device_n.get_colorname_string = gs_get_colorname_string;
/* Pick up the names of the components */
{
- uint i;
- ref sname;
-
- for (i = 0; i < num_components; ++i) {
- array_get(imemory, &namesarray, (long)i, &sname);
- switch (r_type(&sname)) {
- case t_string:
- code = name_from_string(imemory, &sname, &sname);
- if (code < 0) {
- rc_decrement_cs(pcs, "setdevicenspace");
- return code;
- }
- /* falls through */
- case t_name:
- names[i] = name_index(imemory, &sname);
- break;
- default:
- rc_decrement_cs(pcs, "setdevicenspace");
- return_error(e_typecheck);
- }
- }
+ uint i;
+ ref sname;
+
+ for (i = 0; i < num_components; ++i) {
+ array_get(imemory, &namesarray, (long)i, &sname);
+ switch (r_type(&sname)) {
+ case t_string:
+ code = name_from_string(imemory, &sname, &sname);
+ if (code < 0) {
+ rc_decrement_cs(pcs, "setdevicenspace");
+ return code;
+ }
+ /* falls through */
+ case t_name:
+ names[i] = name_index(imemory, &sname);
+ break;
+ default:
+ rc_decrement_cs(pcs, "setdevicenspace");
+ return_error(e_typecheck);
+ }
+ }
}
/* Now set the current color space as DeviceN */
@@ -4064,20 +4058,20 @@ static int setdevicenspace(i_ctx_t * i_ctx_p, ref *devicenspace, int *stage, int
istate->colorspace[0].procs.special.device_n.layer_names = namesarray;
code = array_get(imemory, devicenspace, 3, &proc);
if (code < 0)
- return code;
+ return code;
istate->colorspace[0].procs.special.device_n.tint_transform = proc;
gs_cspace_set_devn_function(pcs, pfn);
code = gs_setcolorspace(igs, pcs);
/* release reference from construction */
rc_decrement_only_cs(pcs, "setdevicenspace");
if (code < 0) {
- istate->colorspace[0] = cspace_old;
- return code;
+ istate->colorspace[0] = cspace_old;
+ return code;
}
cc.pattern = 0x00;
for (i=0;i<num_components;i++)
- cc.paint.values[i] = 1.0;
+ cc.paint.values[i] = 1.0;
code = gs_setcolor(igs, &cc);
*cont = 1;
return code;
@@ -4090,68 +4084,68 @@ static int validatedevicenspace(i_ctx_t * i_ctx_p, ref **space)
/* Check enough arguments in the space */
if (r_size(devicenspace) < 4)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Check the names parameter is an array */
code = array_get(imemory, devicenspace, 1, &namesarray);
if (code < 0)
- return code;
+ return code;
if (!r_is_array(&namesarray))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Ensure we have at least one ink */
if (r_size(&namesarray) < 1)
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Make sure no more inks than we can cope with */
if (r_size(&namesarray) > GS_CLIENT_COLOR_MAX_COMPONENTS)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
/* Check the tint transform is a procedure */
code = array_get(imemory, devicenspace, 3, &proc);
if (code < 0)
- return code;
+ return code;
check_proc(proc);
/* Check the array of ink names only contains names or strings */
for (i = 0; i < r_size(&namesarray); ++i) {
- array_get(imemory, &namesarray, (long)i, &sname);
- switch (r_type(&sname)) {
- case t_string:
- case t_name:
- break;
- default:
- return_error(e_typecheck);
- }
+ array_get(imemory, &namesarray, (long)i, &sname);
+ switch (r_type(&sname)) {
+ case t_string:
+ case t_name:
+ break;
+ default:
+ return_error(e_typecheck);
+ }
}
/* Get the name of the alternate space */
code = array_get(imemory, devicenspace, 2, &altspace);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&altspace, t_name))
- ref_assign(&nameref, &altspace);
+ ref_assign(&nameref, &altspace);
else {
- /* Make sure the alternate space is an array */
- if (!r_is_array(&altspace))
- return_error(e_typecheck);
- /* And has a name for its type */
- code = array_get(imemory, &altspace, 0, &nameref);
- if (code < 0)
- return code;
- if (!r_has_type(&nameref, t_name))
- return_error(e_typecheck);
+ /* Make sure the alternate space is an array */
+ if (!r_is_array(&altspace))
+ return_error(e_typecheck);
+ /* And has a name for its type */
+ code = array_get(imemory, &altspace, 0, &nameref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&nameref, t_name))
+ return_error(e_typecheck);
}
/* Convert alternate space name to string */
name_string_ref(imemory, &nameref, &sref);
/* Check its not /Indexed, /Pattern, /DeviceN */
if (r_size(&sref) == 7) {
- if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
- return_error(e_typecheck);
- if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
- return_error(e_typecheck);
- if (strncmp((const char *)sref.value.const_bytes, "DeviceN", 7) == 0)
- return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
+ return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
+ return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "DeviceN", 7) == 0)
+ return_error(e_typecheck);
}
/* and also not /Separation */
if (r_size(&sref) == 9 && strncmp((const char *)sref.value.const_bytes, "Separation", 9) == 0)
- return_error(e_typecheck);
+ return_error(e_typecheck);
ref_assign(*space, &altspace);
return 0;
@@ -4163,7 +4157,7 @@ static int devicenalternatespace(i_ctx_t * i_ctx_p, ref *space, ref **r, int *CI
code = array_get(imemory, space, 2, &altspace);
if (code < 0)
- return code;
+ return code;
ref_assign(*r, &altspace);
return 0;
}
@@ -4174,7 +4168,7 @@ static int devicencomponents(i_ctx_t * i_ctx_p, ref *space, int *n)
code = array_get(imemory, space, 1, &namesarray);
if (code < 0)
- return code;
+ return code;
*n = r_size(&namesarray);
return 0;
}
@@ -4185,12 +4179,12 @@ static int devicendomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &namesarray);
if (code < 0)
- return code;
+ return code;
limit = r_size(&namesarray) * 2;
for (i = 0;i < limit;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -4203,19 +4197,19 @@ static int devicenrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &altspace);
if (code < 0)
- return code;
+ return code;
code = get_space_object(i_ctx_p, &altspace, &cspace);
if (code < 0)
- return code;
+ return code;
code = cspace->numcomponents(i_ctx_p, &altspace, &limit);
if (code < 0)
- return code;
+ return code;
for (i = 0;i < limit * 2;i+=2) {
- ptr[i] = 0;
- ptr[i+1] = 1;
+ ptr[i] = 0;
+ ptr[i+1] = 1;
}
return 0;
}
@@ -4228,91 +4222,91 @@ static int devicentransform(i_ctx_t *i_ctx_p, ref *devicenspace, int *usealterna
*usealternate = 0;
code = array_get(imemory, devicenspace, 1, &narray);
if (code < 0)
- return code;
+ return code;
if (!r_is_array(&narray))
- return_error(e_typecheck);
+ return_error(e_typecheck);
for (i=0;i<r_size(&narray);i++) {
- code = array_get(imemory, &narray, i, &sname);
- if (code < 0)
- return code;
- if (r_has_type(&sname, t_name)) {
- name_string_ref(imemory, &sname, &sname);
- }
-
- /* Check for /All and /None, never need the alternate for these */
- if (r_size(&sname) == 3 &&
- strncmp("All", (const char *)sname.value.bytes, r_size(&sname)) == 0)
- continue;
- if (r_size(&sname) == 4 &&
- strncmp("None", (const char *)sname.value.bytes, r_size(&sname)) == 0)
- continue;
- /*
- * Compare the colorant name to the device's. If the device's
- * compare routine returns GX_DEVICE_COLOR_MAX_COMPONENTS then the
- * colorant is in the SeparationNames list but not in the
- * SeparationOrder list.
- */
- colorant_number = (*dev_proc(dev, get_color_comp_index))
- (dev, (const char *)sname.value.bytes, r_size(&sname), SEPARATION_NAME);
- if (colorant_number < 0) { /* If not valid colorant name */
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 4 &&
- strncmp("Gray", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 4 &&
- strncmp("Cyan", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 7 &&
- strncmp("Magenta", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 6 &&
- strncmp("Yellow", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 5 &&
- strncmp("Black", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 3 &&
- strncmp("Red", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 5 &&
- strncmp("Green", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
- if (r_size(&sname) == 4 &&
- strncmp("Blue", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
- *usealternate = 1;
- break;
- }
+ code = array_get(imemory, &narray, i, &sname);
+ if (code < 0)
+ return code;
+ if (r_has_type(&sname, t_name)) {
+ name_string_ref(imemory, &sname, &sname);
+ }
+
+ /* Check for /All and /None, never need the alternate for these */
+ if (r_size(&sname) == 3 &&
+ strncmp("All", (const char *)sname.value.bytes, r_size(&sname)) == 0)
+ continue;
+ if (r_size(&sname) == 4 &&
+ strncmp("None", (const char *)sname.value.bytes, r_size(&sname)) == 0)
+ continue;
+ /*
+ * Compare the colorant name to the device's. If the device's
+ * compare routine returns GX_DEVICE_COLOR_MAX_COMPONENTS then the
+ * colorant is in the SeparationNames list but not in the
+ * SeparationOrder list.
+ */
+ colorant_number = (*dev_proc(dev, get_color_comp_index))
+ (dev, (const char *)sname.value.bytes, r_size(&sname), SEPARATION_NAME);
+ if (colorant_number < 0) { /* If not valid colorant name */
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 4 &&
+ strncmp("Gray", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 4 &&
+ strncmp("Cyan", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 7 &&
+ strncmp("Magenta", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 6 &&
+ strncmp("Yellow", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 5 &&
+ strncmp("Black", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 3 &&
+ strncmp("Red", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 5 &&
+ strncmp("Green", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
+ if (r_size(&sname) == 4 &&
+ strncmp("Blue", (const char *)sname.value.bytes, r_size(&sname)) == 0) {
+ *usealternate = 1;
+ break;
+ }
}
if (*usealternate && *stage == 0) {
- (*stage)++;
- esp++;
- code = array_get(imemory, devicenspace, 3, &proc);
- if (code < 0)
- return code;
- *esp = proc;
- return o_push_estack;
+ (*stage)++;
+ esp++;
+ code = array_get(imemory, devicenspace, 3, &proc);
+ if (code < 0)
+ return code;
+ *esp = proc;
+ return o_push_estack;
}
if (*stage == 1){
- *stack_depth = 0;
- *stage = 0;
+ *stack_depth = 0;
+ *stage = 0;
}
return 0;
}
@@ -4324,39 +4318,39 @@ static int devicenbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage,
code = devicentransform(i_ctx_p, space, &use, stage, stack_depth);
if (code != 0)
- return code;
+ return code;
if (!use) {
- *stage = 0;
- *cont = 0;
- code = array_get(imemory, space, 1, &narray);
- if (code < 0)
- return code;
- n_comp = r_size(&narray);
- pop(n_comp);
- op = osp;
- switch(base) {
- case 0:
- push(1);
- make_real(op, 0.0);
- break;
- case 1:
- case 2:
- push(3);
- make_real(&op[-2], 0.0);
- make_real(&op[-1], 0.0);
- make_real(op, 0.0);
- break;
- case 3:
- push(4);
- make_real(&op[-3], 0.0);
- make_real(&op[-2], 0.0);
- make_real(&op[-1], 0.0);
- make_real(op, 0.0);
- break;
- }
+ *stage = 0;
+ *cont = 0;
+ code = array_get(imemory, space, 1, &narray);
+ if (code < 0)
+ return code;
+ n_comp = r_size(&narray);
+ pop(n_comp);
+ op = osp;
+ switch(base) {
+ case 0:
+ push(1);
+ make_real(op, 0.0);
+ break;
+ case 1:
+ case 2:
+ push(3);
+ make_real(&op[-2], 0.0);
+ make_real(&op[-1], 0.0);
+ make_real(op, 0.0);
+ break;
+ case 3:
+ push(4);
+ make_real(&op[-3], 0.0);
+ make_real(&op[-2], 0.0);
+ make_real(&op[-1], 0.0);
+ make_real(op, 0.0);
+ break;
+ }
} else {
- *stage = 0;
- *cont = 1;
+ *stage = 0;
+ *cont = 1;
}
return 0;
}
@@ -4368,25 +4362,25 @@ static int devicenvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_
code = array_get(imemory, space, 1, &narray);
if (code < 0)
- return code;
+ return code;
if (!r_is_array(&narray))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (num_comps < r_size(&narray))
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= r_size(&narray) - 1;
for (i=0;i < r_size(&narray); i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
- if (values[i] > 1.0)
- values[i] = 1.0;
+ if (values[i] > 1.0)
+ values[i] = 1.0;
- if (values[i] < 0.0)
- values[i] = 0.0;
- op++;
+ if (values[i] < 0.0)
+ values[i] = 0.0;
+ op++;
}
return 0;
@@ -4398,44 +4392,44 @@ static int devicencompareproc(i_ctx_t *i_ctx_p, ref *space, ref *testspace)
code = array_get(imemory, space, 1, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 1, &sname2);
if (code < 0)
- return 0;
+ return 0;
if (!r_is_array(&sname1))
- return 0;
+ return 0;
if (!r_is_array(&sname2))
- return 0;
+ return 0;
if (!comparearrays(i_ctx_p, &sname1, &sname2))
- return 0;
+ return 0;
code = array_get(imemory, testspace, 2, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 2, &sname2);
if (code < 0)
- return 0;
+ return 0;
if (r_type(&sname1) != r_type(&sname2))
- return 0;
+ return 0;
if (r_is_array(&sname1)) {
- if (!comparearrays(i_ctx_p, &sname1, &sname2))
- return 0;
+ if (!comparearrays(i_ctx_p, &sname1, &sname2))
+ return 0;
} else {
- if (!r_has_type(&sname1, t_name))
- return 0;
- if (!name_eq(&sname1, &sname2))
- return 0;
+ if (!r_has_type(&sname1, t_name))
+ return 0;
+ if (!name_eq(&sname1, &sname2))
+ return 0;
}
code = array_get(imemory, space, 3, &sname1);
if (code < 0)
- return 0;
+ return 0;
code = array_get(imemory, testspace, 3, &sname2);
if (code < 0)
- return 0;
+ return 0;
return(comparearrays(i_ctx_p, &sname1, &sname2));
}
static int deviceninitialproc(i_ctx_t *i_ctx_p, ref *space)
@@ -4446,11 +4440,11 @@ static int deviceninitialproc(i_ctx_t *i_ctx_p, ref *space)
code = array_get(imemory, space, 1, &namesarray);
if (code < 0)
- return code;
+ return code;
num_components = r_size(&namesarray);
cc.pattern = 0x00;
for (i=0;i<num_components;i++)
- cc.paint.values[i] = 1.0;
+ cc.paint.values[i] = 1.0;
return gs_setcolor(igs, &cc);
}
@@ -4468,17 +4462,17 @@ indexed_cont(i_ctx_t *i_ctx_p)
int i = (int)ep[csme_index].value.intval;
if (i >= 0) { /* i.e., not first time */
- int m = (int)ep[csme_num_components].value.intval;
- int code = float_params(op, m, &r_ptr(&ep[csme_map], gs_indexed_map)->values[i * m]);
-
- if (code < 0)
- return code;
- pop(m);
- op -= m;
- if (i == (int)ep[csme_hival].value.intval) { /* All done. */
- esp -= num_csme;
- return o_pop_estack;
- }
+ int m = (int)ep[csme_num_components].value.intval;
+ int code = float_params(op, m, &r_ptr(&ep[csme_map], gs_indexed_map)->values[i * m]);
+
+ if (code < 0)
+ return code;
+ pop(m);
+ op -= m;
+ if (i == (int)ep[csme_hival].value.intval) { /* All done. */
+ esp -= num_csme;
+ return o_pop_estack;
+ }
}
push(1);
ep[csme_index].value.intval = ++i;
@@ -4499,12 +4493,12 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
gs_color_space *pcs_base;
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
*cont = 0;
if (*stage == 1) {
- *stage = 0;
- return 0;
+ *stage = 0;
+ return 0;
}
cspace_old = istate->colorspace[0];
@@ -4513,30 +4507,30 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
code = array_get(imemory, r, 3, &lookup);
if (code < 0)
- return code;
+ return code;
code = array_get(imemory, r, 2, &hival);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&lookup, t_string)) {
- int num_values = (hival.value.intval + 1) * cs_num_components(pcs_base);
+ int num_values = (hival.value.intval + 1) * cs_num_components(pcs_base);
byte *data_tmp;
- check_read(lookup);
- /*
- * The PDF and PS specifications state that the lookup table must have
- * the exact number of of data bytes needed. However we have found
- * PDF files from Amyuni with extra data bytes. Acrobat 6.0 accepts
- * these files without complaint, so we ignore the extra data.
- */
- if (r_size(&lookup) < num_values)
- return_error(e_rangecheck);
- pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed);
+ check_read(lookup);
+ /*
+ * The PDF and PS specifications state that the lookup table must have
+ * the exact number of of data bytes needed. However we have found
+ * PDF files from Amyuni with extra data bytes. Acrobat 6.0 accepts
+ * these files without complaint, so we ignore the extra data.
+ */
+ if (r_size(&lookup) < num_values)
+ return_error(e_rangecheck);
+ pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed);
if (!pcs) {
return_error(e_VMerror);
}
- pcs->base_space = pcs_base;
- rc_increment_cs(pcs_base);
-
+ pcs->base_space = pcs_base;
+ rc_increment_cs(pcs_base);
+
data_tmp = (byte *) (pcs->params.indexed.lookup.table.data = ialloc_string (lookup.tas.rsize, "setindexedspace"));
if (!data_tmp) {
rc_decrement(pcs, "setindexedspace");
@@ -4545,29 +4539,29 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
memcpy(data_tmp, lookup.value.const_bytes, lookup.tas.rsize);
- pcs->params.indexed.lookup.table.size = num_values;
- pcs->params.indexed.use_proc = 0;
- make_null(pproc);
- code = 0;
+ pcs->params.indexed.lookup.table.size = num_values;
+ pcs->params.indexed.use_proc = 0;
+ make_null(pproc);
+ code = 0;
} else {
- gs_indexed_map *map;
-
- /*
- * We have to call zcs_begin_map before moving the parameters,
- * since if the color space is a DeviceN or Separation space,
- * the memmove will overwrite its parameters.
- */
- code = zcs_begin_map(i_ctx_p, &map, &lookup, (hival.value.intval + 1),
- pcs_base, indexed_cont);
- if (code < 0)
- return code;
- pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed);
- pcs->base_space = pcs_base;
- rc_increment_cs(pcs_base);
- pcs->params.indexed.use_proc = 1;
- *pproc = lookup;
- map->proc.lookup_index = lookup_indexed_map;
- pcs->params.indexed.lookup.map = map;
+ gs_indexed_map *map;
+
+ /*
+ * We have to call zcs_begin_map before moving the parameters,
+ * since if the color space is a DeviceN or Separation space,
+ * the memmove will overwrite its parameters.
+ */
+ code = zcs_begin_map(i_ctx_p, &map, &lookup, (hival.value.intval + 1),
+ pcs_base, indexed_cont);
+ if (code < 0)
+ return code;
+ pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Indexed);
+ pcs->base_space = pcs_base;
+ rc_increment_cs(pcs_base);
+ pcs->params.indexed.use_proc = 1;
+ *pproc = lookup;
+ map->proc.lookup_index = lookup_indexed_map;
+ pcs->params.indexed.lookup.map = map;
}
pcs->params.indexed.hival = hival.value.intval;
pcs->params.indexed.n_comps = cs_num_components(pcs_base);
@@ -4575,17 +4569,17 @@ static int setindexedspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* release reference from construction */
rc_decrement_only_cs(pcs, "setindexedspace");
if (code < 0) {
- istate->colorspace[0] = cspace_old;
- ref_stack_pop_to(&e_stack, edepth);
- return code;
+ istate->colorspace[0] = cspace_old;
+ ref_stack_pop_to(&e_stack, edepth);
+ return code;
}
*stage = 0;
if (ref_stack_count(&e_stack) == edepth) {
- return 0;
+ return 0;
} else {
- *cont = 1;
- *stage = 1;
- return o_push_estack; /* installation will load the caches */
+ *cont = 1;
+ *stage = 1;
+ return o_push_estack; /* installation will load the caches */
}
}
static int validateindexedspace(i_ctx_t * i_ctx_p, ref **space)
@@ -4595,48 +4589,48 @@ static int validateindexedspace(i_ctx_t * i_ctx_p, ref **space)
ref nameref, sref, hival, lookup, altspace;
if (!r_is_array(r))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(r) != 4)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Check operand type(s) */
/* Make sure 'hival' is an integer */
code = array_get(imemory, r, 2, &hival);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(&hival, t_integer))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Make sure 'hival' lies between 0 and 4096 */
if (hival.value.intval < 0 || hival.value.intval > 4096)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Ensure the 'lookup' is either a string or a procedure */
code = array_get(imemory, r, 3, &lookup);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(&lookup, t_string))
- check_proc(lookup);
+ check_proc(lookup);
/* Get the name of the alternate space */
code = array_get(imemory, r, 1, &altspace);
if (code < 0)
- return code;
+ return code;
if (r_has_type(&altspace, t_name))
- ref_assign(&nameref, &altspace);
+ ref_assign(&nameref, &altspace);
else {
- if (!r_is_array(&altspace))
- return_error(e_typecheck);
- code = array_get(imemory, &altspace, 0, &nameref);
- if (code < 0)
- return code;
+ if (!r_is_array(&altspace))
+ return_error(e_typecheck);
+ code = array_get(imemory, &altspace, 0, &nameref);
+ if (code < 0)
+ return code;
}
/* Convert alternate space name to string */
name_string_ref(imemory, &nameref, &sref);
/* Check its not /Indexed or /Pattern */
if (r_size(&sref) == 7) {
- if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
- return_error(e_typecheck);
- if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
- return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Indexed", 7) == 0)
+ return_error(e_typecheck);
+ if (strncmp((const char *)sref.value.const_bytes, "Pattern", 7) == 0)
+ return_error(e_typecheck);
}
ref_assign(*space, &altspace);
return 0;
@@ -4648,7 +4642,7 @@ static int indexedalternatespace(i_ctx_t * i_ctx_p, ref *space, ref **r, int *CI
code = array_get(imemory, *r, 1, &alt);
if (code < 0)
- return code;
+ return code;
ref_assign(*r, &alt);
return 0;
}
@@ -4659,7 +4653,7 @@ static int indexeddomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 2, &hival);
if (code < 0)
- return code;
+ return code;
ptr[0] = 0;
ptr[1] = (float)hival.value.intval;
return 0;
@@ -4671,7 +4665,7 @@ static int indexedrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 2, &hival);
if (code < 0)
- return code;
+ return code;
ptr[0] = 0;
ptr[1] = (float)hival.value.intval;
return 0;
@@ -4681,73 +4675,73 @@ static int indexedbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage,
int code;
if (*stage == 0) {
- /* Usefully /Indexed can't be the base of any other space, so we know
- * the current space in the graphics state is this one.
- */
+ /* Usefully /Indexed can't be the base of any other space, so we know
+ * the current space in the graphics state is this one.
+ */
gs_color_space *pcs;
pcs = gs_currentcolorspace(igs);
- /* Update the counters */
- *stage = 1;
- *cont = 1;
-
- /* Indexed spaces can have *either* a procedure or a string for the
- * lookup.
- */
- if (pcs->params.indexed.use_proc) {
- es_ptr ep = ++esp;
- ref proc;
-
- /* We have a procedure, set up the continuation to run the
- * lookup procedure. (The index is already on the operand stack)
- */
- check_estack(1);
- code = array_get(imemory, space, 3, &proc);
- if (code < 0)
- return code;
- *ep = proc; /* lookup proc */
- return o_push_estack;
- } else {
- int i, index;
- os_ptr op = osp;
- unsigned char *ptr = (unsigned char *)pcs->params.indexed.lookup.table.data;
-
- *stage = 0;
- /* We have a string, start by retrieving the index from the op stack */
- /* Make sure its an integer! */
- if (!r_has_type(op, t_integer))
- return_error (e_typecheck);
- index = op->value.intval;
- /* And remove it from the stack. */
- pop(1);
- op = osp;
-
- /* Make sure we have enough space on the op stack to hold
- * one value for each component of the alternate space
- */
- push(pcs->params.indexed.n_comps);
- op -= pcs->params.indexed.n_comps - 1;
-
- /* Move along the lookup table, one byte for each component , the
- * number of times required to get to the lookup for this index
- */
- ptr += index * pcs->params.indexed.n_comps;
-
- /* For all the components of the alternate space, push the value
- * of the component on the stack. The value is given by the byte
- * from the lookup table divided by 255 to give a value between
- * 0 and 1.
- */
- for (i = 0; i < pcs->params.indexed.n_comps; i++, op++) {
- float rval = (*ptr++) / 255.0;
- make_real(op, rval);
- }
- return 0;
- }
+ /* Update the counters */
+ *stage = 1;
+ *cont = 1;
+
+ /* Indexed spaces can have *either* a procedure or a string for the
+ * lookup.
+ */
+ if (pcs->params.indexed.use_proc) {
+ es_ptr ep = ++esp;
+ ref proc;
+
+ /* We have a procedure, set up the continuation to run the
+ * lookup procedure. (The index is already on the operand stack)
+ */
+ check_estack(1);
+ code = array_get(imemory, space, 3, &proc);
+ if (code < 0)
+ return code;
+ *ep = proc; /* lookup proc */
+ return o_push_estack;
+ } else {
+ int i, index;
+ os_ptr op = osp;
+ unsigned char *ptr = (unsigned char *)pcs->params.indexed.lookup.table.data;
+
+ *stage = 0;
+ /* We have a string, start by retrieving the index from the op stack */
+ /* Make sure its an integer! */
+ if (!r_has_type(op, t_integer))
+ return_error (e_typecheck);
+ index = op->value.intval;
+ /* And remove it from the stack. */
+ pop(1);
+ op = osp;
+
+ /* Make sure we have enough space on the op stack to hold
+ * one value for each component of the alternate space
+ */
+ push(pcs->params.indexed.n_comps);
+ op -= pcs->params.indexed.n_comps - 1;
+
+ /* Move along the lookup table, one byte for each component , the
+ * number of times required to get to the lookup for this index
+ */
+ ptr += index * pcs->params.indexed.n_comps;
+
+ /* For all the components of the alternate space, push the value
+ * of the component on the stack. The value is given by the byte
+ * from the lookup table divided by 255 to give a value between
+ * 0 and 1.
+ */
+ for (i = 0; i < pcs->params.indexed.n_comps; i++, op++) {
+ float rval = (*ptr++) / 255.0;
+ make_real(op, rval);
+ }
+ return 0;
+ }
} else {
- *stage = 0;
- *cont = 1;
- return 0;
+ *stage = 0;
+ *cont = 1;
+ return 0;
}
}
static int indexedvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps)
@@ -4757,20 +4751,20 @@ static int indexedvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_
os_ptr op = osp;
if (num_comps < 1)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
+ return_error(e_typecheck);
code = array_get(imemory, space, 2, &hival);
if (code < 0)
- return code;
+ return code;
if (*values > hival.value.intval)
- *values = (float)hival.value.intval;
+ *values = (float)hival.value.intval;
if (*values < 0)
- *values = 0;
+ *values = 0;
/* The PLRM says 'If it is a real number, it is rounded to the nearest integer
* but in fact Acrobat simply floors the value.
@@ -4789,24 +4783,24 @@ static int setpatternspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
int code = 0;
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
*cont = 0;
pcs_base = NULL;
if (r_is_array(r)) {
- check_read(*r);
-
- switch (r_size(r)) {
- case 1: /* no base space */
- pcs_base = NULL;
- break;
- default:
- return_error(e_rangecheck);
- case 2:
- pcs_base = gs_currentcolorspace(igs);
- if (cs_num_components(pcs_base) < 0) /* i.e., Pattern space */
- return_error(e_rangecheck);
- }
+ check_read(*r);
+
+ switch (r_size(r)) {
+ case 1: /* no base space */
+ pcs_base = NULL;
+ break;
+ default:
+ return_error(e_rangecheck);
+ case 2:
+ pcs_base = gs_currentcolorspace(igs);
+ if (cs_num_components(pcs_base) < 0) /* i.e., Pattern space */
+ return_error(e_rangecheck);
+ }
}
pcs = gs_cspace_alloc(imemory, &gs_color_space_type_Pattern);
pcs->base_space = pcs_base;
@@ -4816,8 +4810,8 @@ static int setpatternspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
/* release reference from construction */
rc_decrement_only_cs(pcs, "zsetpatternspace");
if (code < 0) {
- ref_stack_pop_to(&e_stack, edepth);
- return code;
+ ref_stack_pop_to(&e_stack, edepth);
+ return code;
}
make_null(&istate->pattern[0]); /* PLRM: initial color value is a null object */
*stage = 0;
@@ -4830,18 +4824,18 @@ static int validatepatternspace(i_ctx_t * i_ctx_p, ref **r)
/* since makepattern has already been run, we don't need to do much validation */
if (!r_has_type(*r, t_name)) {
- if (r_is_array(*r)) {
- if (r_size(*r) > 1) {
- code = array_get(imemory, *r, 1, &tref);
- if (code < 0)
- return code;
- ref_assign(*r, &tref);
- } else
- *r = 0;
- } else
- return_error(e_typecheck);
+ if (r_is_array(*r)) {
+ if (r_size(*r) > 1) {
+ code = array_get(imemory, *r, 1, &tref);
+ if (code < 0)
+ return code;
+ ref_assign(*r, &tref);
+ } else
+ *r = 0;
+ } else
+ return_error(e_typecheck);
} else
- *r = 0;
+ *r = 0;
return 0;
}
static int patternalternatespace(i_ctx_t * i_ctx_p, ref *space, ref **r, int *CIESubst)
@@ -4850,18 +4844,18 @@ static int patternalternatespace(i_ctx_t * i_ctx_p, ref *space, ref **r, int *CI
int code;
if (!r_has_type(*r, t_name)) {
- if (r_is_array(*r)) {
- if (r_size(*r) > 1) {
- code = array_get(imemory, space, 1, &tref);
- if (code < 0)
- return code;
- ref_assign(*r, &tref);
- } else
- *r = 0;
- } else
- return_error(e_typecheck);
+ if (r_is_array(*r)) {
+ if (r_size(*r) > 1) {
+ code = array_get(imemory, space, 1, &tref);
+ if (code < 0)
+ return code;
+ ref_assign(*r, &tref);
+ } else
+ *r = 0;
+ } else
+ return_error(e_typecheck);
} else
- *r = 0;
+ *r = 0;
return 0;
}
static int patterncomponent(i_ctx_t * i_ctx_p, ref *space, int *n)
@@ -4877,19 +4871,19 @@ static int patterncomponent(i_ctx_t * i_ctx_p, ref *space, int *n)
if (r_has_type(op, t_dictionary)) {
ref *pImpl, pPatInst;
- code = dict_find_string(op, "Implementation", &pImpl);
- if (code < 0)
- return code;
- code = array_get(imemory, pImpl, 0, &pPatInst);
- if (code < 0)
- return code;
- cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
- if (pattern_instance_uses_base_space(cc.pattern))
- *n = n_comps;
- else
- *n = 1;
+ code = dict_find_string(op, "Implementation", &pImpl);
+ if (code < 0)
+ return code;
+ code = array_get(imemory, pImpl, 0, &pPatInst);
+ if (code < 0)
+ return code;
+ cc.pattern = r_ptr(&pPatInst, gs_pattern_instance_t);
+ if (pattern_instance_uses_base_space(cc.pattern))
+ *n = n_comps;
+ else
+ *n = 1;
} else
- *n = 1;
+ *n = 1;
} else
return_error(e_typecheck);
@@ -4901,49 +4895,49 @@ static int patternbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage,
int i, components=0;
if (r_size(space) > 1) {
- const gs_color_space * pcs = gs_currentcolorspace(igs);
- const gs_client_color * pcc = gs_currentcolor(igs);
- int n = cs_num_components(pcs);
- bool push_pattern = n < 0;
- gs_pattern_instance_t * pinst = pcc->pattern;
-
- if (pinst != 0 && pattern_instance_uses_base_space(pinst)) {
- /* check for pattern */
- if (push_pattern)
- pop(1); /* The pattern instance */
- *stage = 0;
- *cont = 1;
- return 0;
- }
- /* If the pattern isn't yet initialised, or doesn't use the
- * base space, treat as uncolored and return defaults below
- * Fall Through.
- */
+ const gs_color_space * pcs = gs_currentcolorspace(igs);
+ const gs_client_color * pcc = gs_currentcolor(igs);
+ int n = cs_num_components(pcs);
+ bool push_pattern = n < 0;
+ gs_pattern_instance_t * pinst = pcc->pattern;
+
+ if (pinst != 0 && pattern_instance_uses_base_space(pinst)) {
+ /* check for pattern */
+ if (push_pattern)
+ pop(1); /* The pattern instance */
+ *stage = 0;
+ *cont = 1;
+ return 0;
+ }
+ /* If the pattern isn't yet initialised, or doesn't use the
+ * base space, treat as uncolored and return defaults below
+ * Fall Through.
+ */
}
pop(1);
op = osp;
switch(base) {
- case 0:
- components = 1;
- break;
- case 1:
- case 2:
- components = 3;
- break;
- case 3:
- components = 4;
- break;
+ case 0:
+ components = 1;
+ break;
+ case 1:
+ case 2:
+ components = 3;
+ break;
+ case 3:
+ components = 4;
+ break;
}
push(components);
op -= components-1;
for (i=0;i<components;i++) {
- make_real(op, (float)0);
- op++;
+ make_real(op, (float)0);
+ op++;
}
if (components == 4) {
- op--;
- make_real(op, (float)1);
+ op--;
+ make_real(op, (float)1);
}
*stage = 0;
*cont = 0;
@@ -4956,7 +4950,7 @@ static int patternvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_
check_op(1);
if (!r_has_type(op, t_dictionary) && !r_has_type(op, t_null))
- return_error(e_typecheck);
+ return_error(e_typecheck);
return 0;
}
@@ -4975,17 +4969,17 @@ static int setdevicepspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
* Preserve the old behaviour anyway.
*/
if (i_ctx_p->language_level < 2)
- return_error(e_undefined);
+ return_error(e_undefined);
*cont = 0;
code = array_get(imemory, r, 1, &bpp);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(&bpp, t_integer))
- return_error(e_typecheck);
+ return_error(e_typecheck);
code = gs_cspace_new_DevicePixel(imemory, &pcs, (int)bpp.value.intval);
if (code < 0)
- return code;
+ return code;
code = gs_setcolorspace(igs, pcs);
/* release reference from construction */
*stage = 0;
@@ -4998,20 +4992,20 @@ static int validatedevicepspace(i_ctx_t * i_ctx_p, ref **space)
ref *r = *space, bpp;
if (!r_is_array(r))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(r) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Make sure 'bits per pixel' is an integer */
code = array_get(imemory, r, 1, &bpp);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(&bpp, t_integer))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Make sure 'bits per pixel' lies between 0 and 31 */
if (bpp.value.intval < 0 || bpp.value.intval > 31)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
*space = 0;
return code;
@@ -5023,7 +5017,7 @@ static int devicepdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &tref);
if (code < 0)
- return code;
+ return code;
ptr[0] = 0;
ptr[1] = (float)(1 << tref.value.intval);
return 0;
@@ -5035,7 +5029,7 @@ static int deviceprange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &tref);
if (code < 0)
- return code;
+ return code;
ptr[0] = 0;
ptr[1] = (float)(1 << tref.value.intval);
return 0;
@@ -5058,18 +5052,18 @@ static int set_dev_space(i_ctx_t * i_ctx_p, int components)
{
int code, stage = 1, cont = 0;
switch(components) {
- case 1:
- code = setgrayspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
- break;
- case 3:
- code = setrgbspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
- break;
- case 4:
- code = setcmykspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
- break;
- default:
- code = gs_note_error(e_rangecheck);
- break;
+ case 1:
+ code = setgrayspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
+ break;
+ case 3:
+ code = setrgbspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
+ break;
+ case 4:
+ code = setcmykspace(i_ctx_p, (ref *)0, &stage, &cont, 1);
+ break;
+ default:
+ code = gs_note_error(e_rangecheck);
+ break;
}
return code;
}
@@ -5085,32 +5079,32 @@ static int checkrangeab(i_ctx_t * i_ctx_p, ref *labdict)
code = dict_find_string(labdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 4)
- return_error(e_rangecheck);
-
- for (i=0;i<4;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 4)
+ return_error(e_rangecheck);
+
+ for (i=0;i<4;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
- if (value[1] < value[0] || value[3] < value[2] )
- return_error(e_rangecheck);
+ if (value[1] < value[0] || value[3] < value[2] )
+ return_error(e_rangecheck);
}
return 0;
}
-static int setlabspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont,
+static int setlabspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont,
int CIESubst)
{
- /* In this case, we will treat this as an ICC color space, with a
+ /* In this case, we will treat this as an ICC color space, with a
CIELAB 16 bit profile */
ref labdict;
int code = 0;
@@ -5119,18 +5113,18 @@ static int setlabspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont,
static const float dflt_black[3] = {0,0,0}, dflt_white[3] = {0,0,0};
int i;
gs_client_color cc;
-
+
*cont = 0;
code = array_get(imemory, r, 1, &labdict);
if (code < 0)
- return code;
+ return code;
/* Get all the parts */
code = dict_floats_param( imemory, &labdict, "Range", 4, range_buff,
dflt_range );
for (i = 0; i < 4 && range_buff[i + 1] >= range_buff[i]; i += 2);
if (i != 4)
return_error(e_rangecheck);
- code = dict_floats_param( imemory, &labdict, "BlackPoint", 3, black,
+ code = dict_floats_param( imemory, &labdict, "BlackPoint", 3, black,
dflt_black );
code = dict_floats_param( imemory, &labdict, "WhitePoint", 3, white,
dflt_white );
@@ -5140,7 +5134,7 @@ static int setlabspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont,
if ( code < 0)
return gs_rethrow(code, "setting PDF lab color space");
cc.pattern = 0x00;
- for (i=0;i<3;i++)
+ for (i=0;i<3;i++)
cc.paint.values[i] = 0;
code = gs_setcolor(igs, &cc);
return code;
@@ -5150,28 +5144,28 @@ static int validatelabspace(i_ctx_t * i_ctx_p, ref **r)
{
int code=0;
ref *space, labdict;
-
+
space = *r;
if (!r_is_array(space))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(space) < 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, space, 1, &labdict);
if (code < 0)
- return code;
+ return code;
/* Check the white point, which is required. */
code = checkWhitePoint(i_ctx_p, &labdict);
if (code != 0)
- return code;
+ return code;
/* The rest are optional. Need to validate though */
code = checkBlackPoint(i_ctx_p, &labdict);
if (code < 0)
- return code;
+ return code;
/* Range on a b values */
code = checkrangeab(i_ctx_p, &labdict);
if (code < 0)
- return code;
+ return code;
*r = 0; /* No nested space */
return 0;
}
@@ -5183,33 +5177,32 @@ static int labrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a Range entry, get the values from that */
code = dict_find_string(&CIEdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<4;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<4;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for Lab */
- for (i=0;i<2;i++) {
- ptr[2 * i] = -100;
- ptr[(2 * i) + 1] = 100;
- }
+ /* Default values for Lab */
+ for (i=0;i<2;i++) {
+ ptr[2 * i] = -100;
+ ptr[(2 * i) + 1] = 100;
+ }
}
return 0;
}
-
static int labdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
{
int i, code;
@@ -5217,28 +5210,28 @@ static int labdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &CIEdict);
if (code < 0)
- return code;
+ return code;
/* If we have a Range, get the values from that */
code = dict_find_string(&CIEdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<4;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- ptr[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ for (i=0;i<4;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ ptr[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
} else {
- /* Default values for Lab */
- for (i=0;i<2;i++) {
- ptr[2 * i] = -100;
- ptr[(2 * i) + 1] = 100;
- }
+ /* Default values for Lab */
+ for (i=0;i<2;i++) {
+ ptr[2 * i] = -100;
+ ptr[(2 * i) + 1] = 100;
+ }
}
return 0;
}
@@ -5255,8 +5248,8 @@ static int labbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int
push(components);
op -= components-1;
for (i=0;i<components;i++) {
- make_real(op, (float)0);
- op++;
+ make_real(op, (float)0);
+ op++;
}
*stage = 0;
*cont = 0;
@@ -5269,12 +5262,12 @@ static int labvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comp
int i;
if (num_comps < 3)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
op -= 2;
for (i=0;i<3;i++) {
- if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
- return_error(e_typecheck);
- op++;
+ if (!r_has_type(op, t_integer) && !r_has_type(op, t_real))
+ return_error(e_typecheck);
+ op++;
}
return 0;
}
@@ -5288,20 +5281,20 @@ static int checkCalMatrix(i_ctx_t * i_ctx_p, ref *CIEdict)
code = dict_find_string(CIEdict, "Matrix", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != 9)
- return_error(e_rangecheck);
- for (i=0;i<9;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != 9)
+ return_error(e_rangecheck);
+ for (i=0;i<9;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
}
}
return 0;
@@ -5318,29 +5311,29 @@ static int checkGamma(i_ctx_t * i_ctx_p, ref *CIEdict, int numvalues)
if (code >= 0 && !r_has_type(tempref, t_null)) {
if (numvalues > 1) {
/* Array of gammas (RGB) */
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) != numvalues)
- return_error(e_rangecheck);
- for (i=0;i<numvalues;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- value[i] = (float)valref.value.intval;
- else if (r_has_type(&valref, t_real))
- value[i] = (float)valref.value.realval;
- else
- return_error(e_typecheck);
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) != numvalues)
+ return_error(e_rangecheck);
+ for (i=0;i<numvalues;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ value[i] = (float)valref.value.intval;
+ else if (r_has_type(&valref, t_real))
+ value[i] = (float)valref.value.realval;
+ else
+ return_error(e_typecheck);
if (value[i] <= 0) return_error(e_rangecheck);
}
} else {
/* Single gamma (gray) */
- if (r_has_type(tempref, t_real))
+ if (r_has_type(tempref, t_real))
value[0] = (float)(tempref->value.realval);
else if (r_has_type(tempref, t_integer))
value[0] = (float)(tempref->value.intval);
- else
+ else
return_error(e_typecheck);
if (value[0] <= 0) return_error(e_rangecheck);
}
@@ -5357,31 +5350,31 @@ static int setcalgrayspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
floatp dflt_gamma = 1.0;
static const float dflt_black[3] = {0,0,0}, dflt_white[3] = {0,0,0};
gs_client_color cc;
-
+
*cont = 0;
code = array_get(imemory, r, 1, &graydict);
if (code < 0)
- return code;
+ return code;
/* Get all the parts */
code = dict_float_param(&graydict, "Gamma",
- dflt_gamma, &gamma);
+ dflt_gamma, &gamma);
if (gamma <= 0 ) return_error(e_rangecheck);
- code = dict_floats_param( imemory,
- &graydict,
+ code = dict_floats_param( imemory,
+ &graydict,
"BlackPoint",
3,
black,
dflt_black );
- code = dict_floats_param( imemory,
- &graydict,
+ code = dict_floats_param( imemory,
+ &graydict,
"WhitePoint",
3,
white,
dflt_white );
if (white[0] <= 0 || white[1] != 1.0 || white[2] <= 0)
return_error(e_rangecheck);
- code = seticc_cal(i_ctx_p, white, black, &gamma, NULL, 1,
- graydict.value.saveid);
+ code = seticc_cal(i_ctx_p, white, black, &gamma, NULL, 1,
+ graydict.value.saveid);
if ( code < 0)
return gs_rethrow(code, "setting CalGray color space");
cc.pattern = 0x00;
@@ -5394,30 +5387,30 @@ static int validatecalgrayspace(i_ctx_t * i_ctx_p, ref **r)
{
int code=0;
ref *space, calgraydict;
-
+
space = *r;
if (!r_is_array(space))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(space) < 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, space, 1, &calgraydict);
if (code < 0)
- return code;
+ return code;
/* Check the white point, which is required */
/* We have to have a white point */
/* Check white point exists, and is an array of three numbers */
code = checkWhitePoint(i_ctx_p, &calgraydict);
if (code != 0)
- return code;
+ return code;
/* The rest are optional. Need to validate though */
code = checkBlackPoint(i_ctx_p, &calgraydict);
if (code < 0)
- return code;
+ return code;
/* Check Gamma values */
code = checkGamma(i_ctx_p, &calgraydict, 1);
if (code < 0)
- return code;
+ return code;
*r = 0; /* No nested space */
return 0;
}
@@ -5433,45 +5426,45 @@ static int setcalrgbspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int
static const float dflt_matrix[9] = {1,0,0,0,1,0,0,0,1};
int i;
gs_client_color cc;
-
+
*cont = 0;
code = array_get(imemory, r, 1, &rgbdict);
if (code < 0)
- return code;
+ return code;
/* Get all the parts */
- code = dict_floats_param( imemory,
- &rgbdict,
+ code = dict_floats_param( imemory,
+ &rgbdict,
"Gamma",
3,
gamma,
dflt_gamma );
if (gamma[0] <= 0 || gamma[1] <= 0 || gamma[2] <= 0)
return_error(e_rangecheck);
- code = dict_floats_param( imemory,
- &rgbdict,
+ code = dict_floats_param( imemory,
+ &rgbdict,
"BlackPoint",
3,
black,
dflt_black );
- code = dict_floats_param( imemory,
- &rgbdict,
+ code = dict_floats_param( imemory,
+ &rgbdict,
"WhitePoint",
3,
white,
dflt_white );
if (white[0] <= 0 || white[1] != 1.0 || white[2] <= 0)
return_error(e_rangecheck);
- code = dict_floats_param( imemory,
- &rgbdict,
+ code = dict_floats_param( imemory,
+ &rgbdict,
"Matrix",
9,
matrix,
dflt_matrix );
- code = seticc_cal(i_ctx_p, white, black, gamma, matrix, 3, rgbdict.value.saveid);
+ code = seticc_cal(i_ctx_p, white, black, gamma, matrix, 3, rgbdict.value.saveid);
if ( code < 0)
return gs_rethrow(code, "setting CalRGB color space");
cc.pattern = 0x00;
- for (i=0;i<3;i++)
+ for (i=0;i<3;i++)
cc.paint.values[i] = 0;
code = gs_setcolor(igs, &cc);
return code;
@@ -5481,32 +5474,32 @@ static int validatecalrgbspace(i_ctx_t * i_ctx_p, ref **r)
{
int code=0;
ref *space, calrgbdict;
-
+
space = *r;
if (!r_is_array(space))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(space) < 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, space, 1, &calrgbdict);
if (code < 0)
- return code;
+ return code;
/* Check the white point, which is required */
code = checkWhitePoint(i_ctx_p, &calrgbdict);
if (code != 0)
- return code;
+ return code;
/* The rest are optional. Need to validate though */
code = checkBlackPoint(i_ctx_p, &calrgbdict);
if (code < 0)
- return code;
+ return code;
/* Check Gamma values */
code = checkGamma(i_ctx_p, &calrgbdict, 3);
if (code < 0)
- return code;
+ return code;
/* Check Matrix */
code = checkCalMatrix(i_ctx_p, &calrgbdict);
if (code < 0)
- return code;
+ return code;
*r = 0; /* No nested space */
return 0;
}
@@ -5522,58 +5515,58 @@ static int seticcspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CIE
code = dict_find_string(systemdict, "NOCIE", &nocie);
if (code < 0)
- return code;
+ return code;
if (!r_has_type(nocie, t_boolean))
- return_error(e_typecheck);
+ return_error(e_typecheck);
*cont = 0;
do {
- switch(*stage) {
- case 0:
- (*stage)++;
- code = array_get(imemory, r, 1, &ICCdict);
- if (code < 0)
- return code;
- code = dict_find_string(&ICCdict, "N", &tempref);
- if (code < 0)
- return code;
- components = tempref->value.intval;
- if (components > count_of(range))
- return_error(e_rangecheck);
-
- /* Don't allow ICCBased spaces if NOCIE is true */
- if (nocie->value.boolval) {
- code = dict_find_string(&ICCdict, "Alternate", &altref); /* Alternate is optional */
- if (code < 0)
- return code;
- if ((altref != NULL) && (r_type(altref) != t_null)) {
- /* The PDF interpreter sets a null Alternate. If we have an
- * Alternate, and its not null, and NOCIE is true, then use the
- * Alternate instead of the ICC
- */
- push(1);
- ref_assign(op, altref);
- /* If CIESubst, we are already substituting for CIE, so use nosubst
- * to prevent further substitution!
- */
- return setcolorspace_nosubst(i_ctx_p);
- } else {
- /* There's no /Alternate (or it is null), set a default space
- * based on the number of components in the ICCBased space
- */
- code = set_dev_space(i_ctx_p, components);
- if (code != 0)
- return code;
- *stage = 0;
- }
- } else {
- code = iccrange(i_ctx_p, r, (float *)&range);
- if (code < 0)
- return code;
- code = dict_find_string(&ICCdict, "DataSource", &tempref);
- if (code < 0)
- return code;
- /* Check for string based ICC and convert to a file */
- if (r_has_type(tempref, t_string)){
+ switch(*stage) {
+ case 0:
+ (*stage)++;
+ code = array_get(imemory, r, 1, &ICCdict);
+ if (code < 0)
+ return code;
+ code = dict_find_string(&ICCdict, "N", &tempref);
+ if (code < 0)
+ return code;
+ components = tempref->value.intval;
+ if (components > count_of(range))
+ return_error(e_rangecheck);
+
+ /* Don't allow ICCBased spaces if NOCIE is true */
+ if (nocie->value.boolval) {
+ code = dict_find_string(&ICCdict, "Alternate", &altref); /* Alternate is optional */
+ if (code < 0)
+ return code;
+ if ((altref != NULL) && (r_type(altref) != t_null)) {
+ /* The PDF interpreter sets a null Alternate. If we have an
+ * Alternate, and its not null, and NOCIE is true, then use the
+ * Alternate instead of the ICC
+ */
+ push(1);
+ ref_assign(op, altref);
+ /* If CIESubst, we are already substituting for CIE, so use nosubst
+ * to prevent further substitution!
+ */
+ return setcolorspace_nosubst(i_ctx_p);
+ } else {
+ /* There's no /Alternate (or it is null), set a default space
+ * based on the number of components in the ICCBased space
+ */
+ code = set_dev_space(i_ctx_p, components);
+ if (code != 0)
+ return code;
+ *stage = 0;
+ }
+ } else {
+ code = iccrange(i_ctx_p, r, (float *)&range);
+ if (code < 0)
+ return code;
+ code = dict_find_string(&ICCdict, "DataSource", &tempref);
+ if (code < 0)
+ return code;
+ /* Check for string based ICC and convert to a file */
+ if (r_has_type(tempref, t_string)){
uint n = r_size(tempref);
ref rss;
@@ -5581,52 +5574,52 @@ static int seticcspace(i_ctx_t * i_ctx_p, ref *r, int *stage, int *cont, int CIE
if (code < 0)
return code;
ref_assign(tempref, &rss);
- }
- /* Make space on operand stack to pass the ICC dictionary */
- push(1);
- ref_assign(op, &ICCdict);
- code = seticc(i_ctx_p, components, op, (float *)&range);
- if (code < 0) {
- code = dict_find_string(&ICCdict, "Alternate", &altref); /* Alternate is optional */
- if (code < 0)
- return code;
- if ((altref != NULL) && (r_type(altref) != t_null)) {
- /* We have a /Alternate in the ICC space */
- /* Our ICC dictionary still on operand stack, we can reuse the
- * slot on the stack to hold the alternate space.
- */
- ref_assign(op, (ref *)altref);
- /* If CIESubst, we are already substituting for CIE, so use nosubst
- * to prevent further substitution!
- */
- if (CIESubst)
- return setcolorspace_nosubst(i_ctx_p);
- else
- return zsetcolorspace(i_ctx_p);
- } else {
- /* We have no /Alternate in the ICC space, use hte /N key to
- * determine an 'appropriate' default space.
- */
- code = set_dev_space(i_ctx_p, components);
- if (code != 0)
- return code;
- *stage = 0;
- }
- pop(1);
- }
- if (code != 0)
- return code;
- }
- break;
- case 1:
- /* All done, exit */
- *stage = 0;
- code = 0;
- break;
- default:
- return_error (e_rangecheck);
- break;
- }
+ }
+ /* Make space on operand stack to pass the ICC dictionary */
+ push(1);
+ ref_assign(op, &ICCdict);
+ code = seticc(i_ctx_p, components, op, (float *)&range);
+ if (code < 0) {
+ code = dict_find_string(&ICCdict, "Alternate", &altref); /* Alternate is optional */
+ if (code < 0)
+ return code;
+ if ((altref != NULL) && (r_type(altref) != t_null)) {
+ /* We have a /Alternate in the ICC space */
+ /* Our ICC dictionary still on operand stack, we can reuse the
+ * slot on the stack to hold the alternate space.
+ */
+ ref_assign(op, (ref *)altref);
+ /* If CIESubst, we are already substituting for CIE, so use nosubst
+ * to prevent further substitution!
+ */
+ if (CIESubst)
+ return setcolorspace_nosubst(i_ctx_p);
+ else
+ return zsetcolorspace(i_ctx_p);
+ } else {
+ /* We have no /Alternate in the ICC space, use hte /N key to
+ * determine an 'appropriate' default space.
+ */
+ code = set_dev_space(i_ctx_p, components);
+ if (code != 0)
+ return code;
+ *stage = 0;
+ }
+ pop(1);
+ }
+ if (code != 0)
+ return code;
+ }
+ break;
+ case 1:
+ /* All done, exit */
+ *stage = 0;
+ code = 0;
+ break;
+ default:
+ return_error (e_rangecheck);
+ break;
+ }
}while(*stage);
return code;
}
@@ -5637,98 +5630,98 @@ static int validateiccspace(i_ctx_t * i_ctx_p, ref **r)
space = *r;
if (!r_is_array(space))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(space) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, space, 1, &ICCdict);
if (code < 0)
- return code;
+ return code;
code = dict_find_string(&ICCdict, "N", &tempref);
if (code <= 0)
- return code;
+ return code;
if (!r_has_type(tempref, t_null)) {
- if (!r_has_type(tempref, t_integer))
- return_error(e_typecheck);
- components = tempref->value.intval;
+ if (!r_has_type(tempref, t_integer))
+ return_error(e_typecheck);
+ components = tempref->value.intval;
} else
- return_error(e_typecheck);
+ return_error(e_typecheck);
code = dict_find_string(&ICCdict, "DataSource", &tempref);
if (code <= 0)
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (!r_has_type(tempref, t_null)) {
- if (!r_has_type(tempref, t_string) && !r_has_type(tempref, t_file))
- return_error(e_typecheck);
+ if (!r_has_type(tempref, t_string) && !r_has_type(tempref, t_file))
+ return_error(e_typecheck);
} else
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Following are optional entries */
code = dict_find_string(&ICCdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- if (!r_is_array(tempref))
- return_error(e_typecheck);
- if (r_size(tempref) < (components * 2))
- return_error(e_rangecheck);
- for (i=0;i<components * 2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (!r_has_type(&valref, t_integer) && !r_has_type(&valref, t_real))
- return_error(e_typecheck);
- }
+ if (!r_is_array(tempref))
+ return_error(e_typecheck);
+ if (r_size(tempref) < (components * 2))
+ return_error(e_rangecheck);
+ for (i=0;i<components * 2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&valref, t_integer) && !r_has_type(&valref, t_real))
+ return_error(e_typecheck);
+ }
}
code = dict_find_string(&ICCdict, "Alternate", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- ref_assign(*r, tempref);
- if (r_has_type(tempref, t_name)) {
- name_string_ref(imemory, tempref, &sref);
- if (sref.value.bytes && strncmp((const char *)sref.value.bytes, "Pattern", 7) == 0)
- return_error(e_typecheck);
- } else {
- if (r_is_array(tempref)) {
- code = array_get(imemory, tempref, 0, &valref);
- if (code < 0)
- return code;
- if (!r_has_type(&valref, t_name) && !r_has_type(&valref, t_string))
- return_error(e_typecheck);
- if (r_has_type(&valref, t_name))
- name_string_ref(imemory, &valref, &sref);
- else
- sref.value.bytes = valref.value.bytes;
- if (sref.value.bytes && strncmp((const char *)sref.value.bytes, "Pattern", 7) == 0)
- return_error(e_typecheck);
- } else
- return_error(e_typecheck);
- }
+ ref_assign(*r, tempref);
+ if (r_has_type(tempref, t_name)) {
+ name_string_ref(imemory, tempref, &sref);
+ if (sref.value.bytes && strncmp((const char *)sref.value.bytes, "Pattern", 7) == 0)
+ return_error(e_typecheck);
+ } else {
+ if (r_is_array(tempref)) {
+ code = array_get(imemory, tempref, 0, &valref);
+ if (code < 0)
+ return code;
+ if (!r_has_type(&valref, t_name) && !r_has_type(&valref, t_string))
+ return_error(e_typecheck);
+ if (r_has_type(&valref, t_name))
+ name_string_ref(imemory, &valref, &sref);
+ else
+ sref.value.bytes = valref.value.bytes;
+ if (sref.value.bytes && strncmp((const char *)sref.value.bytes, "Pattern", 7) == 0)
+ return_error(e_typecheck);
+ } else
+ return_error(e_typecheck);
+ }
} else {
ref nameref;
- switch (components) {
- case 1:
- code = name_enter_string(imemory, "DeviceGray", &nameref);
- break;
- case 3:
- code = name_enter_string(imemory, "DeviceRGB", &nameref);
- break;
- case 4:
- code = name_enter_string(imemory, "DeviceCMYK", &nameref);
- break;
- default:
- return_error(e_rangecheck);
- }
- /* In case this space is the /ALternate for a previous ICCBased space
- * insert the named space into the ICC dictionary. If we simply returned
- * the named space, as before, then we are replacing the second ICCBased
- * space in the first ICCBased space with the named space!
- */
- code = idict_put_string(&ICCdict, "Alternate", &nameref);
- if (code < 0)
- return code;
-
- /* And now revalidate with the newly updated dictionary */
- return validateiccspace(i_ctx_p, r);
+ switch (components) {
+ case 1:
+ code = name_enter_string(imemory, "DeviceGray", &nameref);
+ break;
+ case 3:
+ code = name_enter_string(imemory, "DeviceRGB", &nameref);
+ break;
+ case 4:
+ code = name_enter_string(imemory, "DeviceCMYK", &nameref);
+ break;
+ default:
+ return_error(e_rangecheck);
+ }
+ /* In case this space is the /ALternate for a previous ICCBased space
+ * insert the named space into the ICC dictionary. If we simply returned
+ * the named space, as before, then we are replacing the second ICCBased
+ * space in the first ICCBased space with the named space!
+ */
+ code = idict_put_string(&ICCdict, "Alternate", &nameref);
+ if (code < 0)
+ return code;
+
+ /* And now revalidate with the newly updated dictionary */
+ return validateiccspace(i_ctx_p, r);
}
return code;
}
@@ -5739,38 +5732,38 @@ static int iccalternatespace(i_ctx_t * i_ctx_p, ref *space, ref **r, int *CIESub
ref *tempref, ICCdict;
if (!r_is_array(space))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Validate parameters, check we have enough operands */
if (r_size(space) != 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = array_get(imemory, space, 1, &ICCdict);
if (code < 0)
- return code;
+ return code;
code = dict_find_string(&ICCdict, "N", &tempref);
if (code <= 0)
- return code;
+ return code;
components = tempref->value.intval;
code = dict_find_string(&ICCdict, "Alternate", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- *r = tempref;
+ *r = tempref;
} else {
- switch (components) {
- case 1:
- code = name_enter_string(imemory, "DeviceGray", *r);
- break;
- case 3:
- code = name_enter_string(imemory, "DeviceRGB", *r);
- break;
- case 4:
- code = name_enter_string(imemory, "DeviceCMYK", *r);
- break;
- default:
- return_error(e_rangecheck);
- }
+ switch (components) {
+ case 1:
+ code = name_enter_string(imemory, "DeviceGray", *r);
+ break;
+ case 3:
+ code = name_enter_string(imemory, "DeviceRGB", *r);
+ break;
+ case 4:
+ code = name_enter_string(imemory, "DeviceCMYK", *r);
+ break;
+ default:
+ return_error(e_rangecheck);
+ }
}
*CIESubst = 1;
return code;
@@ -5782,7 +5775,7 @@ static int icccomponents(i_ctx_t * i_ctx_p, ref *space, int *n)
code = array_get(imemory, space, 1, &ICCdict);
if (code < 0)
- return code;
+ return code;
code = dict_find_string(&ICCdict, "N", &tempref);
*n = tempref->value.intval;
@@ -5795,25 +5788,25 @@ static int iccdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &ICCdict);
if (code < 0)
- return code;
+ return code;
code = dict_find_string(&ICCdict, "N", &tempref);
components = tempref->value.intval;
code = dict_find_string(&ICCdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<components * 2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i * 2] = (float)valref.value.intval;
- else
- ptr[i * 2] = valref.value.realval;
- }
+ for (i=0;i<components * 2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i * 2] = (float)valref.value.intval;
+ else
+ ptr[i * 2] = valref.value.realval;
+ }
} else {
- for (i=0;i<components;i++) {
- ptr[i * 2] = 0;
- ptr[(i * 2) + 1] = 1;
- }
+ for (i=0;i<components;i++) {
+ ptr[i * 2] = 0;
+ ptr[(i * 2) + 1] = 1;
+ }
}
return 0;
}
@@ -5824,25 +5817,25 @@ static int iccrange(i_ctx_t * i_ctx_p, ref *space, float *ptr)
code = array_get(imemory, space, 1, &ICCdict);
if (code < 0)
- return code;
+ return code;
code = dict_find_string(&ICCdict, "N", &tempref);
components = tempref->value.intval;
code = dict_find_string(&ICCdict, "Range", &tempref);
if (code >= 0 && !r_has_type(tempref, t_null)) {
- for (i=0;i<components * 2;i++) {
- code = array_get(imemory, tempref, i, &valref);
- if (code < 0)
- return code;
- if (r_has_type(&valref, t_integer))
- ptr[i] = (float)valref.value.intval;
- else
- ptr[i] = (float)valref.value.realval;
- }
+ for (i=0;i<components * 2;i++) {
+ code = array_get(imemory, tempref, i, &valref);
+ if (code < 0)
+ return code;
+ if (r_has_type(&valref, t_integer))
+ ptr[i] = (float)valref.value.intval;
+ else
+ ptr[i] = (float)valref.value.realval;
+ }
} else {
- for (i=0;i<components;i++) {
- ptr[i * 2] = 0;
- ptr[(i * 2) + 1] = 1;
- }
+ for (i=0;i<components;i++) {
+ ptr[i * 2] = 0;
+ ptr[(i * 2) + 1] = 1;
+ }
}
return 0;
}
@@ -5934,23 +5927,23 @@ int get_space_object(i_ctx_t *i_ctx_p, ref *arr, PS_colour_space_t **obj)
/* If the spaece is an array, the first element is always the name */
if (r_is_array(arr))
- code = array_get(imemory, arr, 0, &spacename);
+ code = array_get(imemory, arr, 0, &spacename);
else
- ref_assign(&spacename, arr);
+ ref_assign(&spacename, arr);
/* Check that it really is a name */
if (!r_has_type(&spacename, t_name))
- return_error(e_typecheck);
+ return_error(e_typecheck);
/* Find the relevant color space object */
for (i=0;i<nprocs;i++) {
- code = names_ref(imemory->gs_lib_ctx->gs_name_table, (const byte *)colorProcs[i].name, strlen(colorProcs[i].name), &nref, 0);
- if (code < 0)
- return code;
- if (name_eq(&spacename, &nref)) {
- *obj = &colorProcs[i];
- return 0;
- }
+ code = names_ref(imemory->gs_lib_ctx->gs_name_table, (const byte *)colorProcs[i].name, strlen(colorProcs[i].name), &nref, 0);
+ if (code < 0)
+ return code;
+ if (name_eq(&spacename, &nref)) {
+ *obj = &colorProcs[i];
+ return 0;
+ }
}
return_error(e_undefined);
}
@@ -5968,17 +5961,17 @@ static int validate_spaces(i_ctx_t *i_ctx_p, ref *arr, int *depth)
ref_assign(&space, arr);
*depth = 0;
do {
- code = get_space_object(i_ctx_p, sp, &obj);
- if (code < 0)
- return code;
+ code = get_space_object(i_ctx_p, sp, &obj);
+ if (code < 0)
+ return code;
- (*depth)++;
- if (!obj->validateproc)
- break;
+ (*depth)++;
+ if (!obj->validateproc)
+ break;
- code = obj->validateproc(i_ctx_p, &sp);
- if (code < 0)
- return code;
+ code = obj->validateproc(i_ctx_p, &sp);
+ if (code < 0)
+ return code;
}while(sp);
return 0;
}
@@ -6015,36 +6008,36 @@ setcolor_cont(i_ctx_t *i_ctx_p)
push_op_estack(setcolor_cont);
while (code == 0) {
- ref_assign(&arr, ep);
- /* Run along the nested color spaces until we get to the first one
- * that we haven't yet processed (given by 'depth')
- */
- for (i=0;i<=depth;i++) {
- code = get_space_object(i_ctx_p, parr, &obj);
- if (code < 0)
- return code;
-
- if (i < (depth)) {
- if (!obj->alternateproc) {
- return_error(e_typecheck);
- }
- code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
- if (code < 0)
- return code;
- }
- }
- if (obj->runtransformproc) {
- code = obj->runtransformproc(i_ctx_p, &istate->colorspace[0].array, &usealternate, &stage, &stack_depth);
- make_int(&ep[-3], stack_depth);
- make_int(&ep[-1], stage);
- if (code != 0) {
- return code;
- }
- make_int(&ep[-2], ++depth);
- if (!usealternate)
- break;
- } else
- break;
+ ref_assign(&arr, ep);
+ /* Run along the nested color spaces until we get to the first one
+ * that we haven't yet processed (given by 'depth')
+ */
+ for (i=0;i<=depth;i++) {
+ code = get_space_object(i_ctx_p, parr, &obj);
+ if (code < 0)
+ return code;
+
+ if (i < (depth)) {
+ if (!obj->alternateproc) {
+ return_error(e_typecheck);
+ }
+ code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
+ if (code < 0)
+ return code;
+ }
+ }
+ if (obj->runtransformproc) {
+ code = obj->runtransformproc(i_ctx_p, &istate->colorspace[0].array, &usealternate, &stage, &stack_depth);
+ make_int(&ep[-3], stack_depth);
+ make_int(&ep[-1], stage);
+ if (code != 0) {
+ return code;
+ }
+ make_int(&ep[-2], ++depth);
+ if (!usealternate)
+ break;
+ } else
+ break;
}
/* Remove our next continuation and our data */
obj->numcomponents(i_ctx_p, parr, &i);
@@ -6090,43 +6083,43 @@ setcolorspace_cont(i_ctx_t *i_ctx_p)
push_op_estack(setcolorspace_cont);
while (code == 0 && depth) {
- ref_assign(&arr, ep);
- /* Run along the nested color spaces until we get to the lowest one
- * that we haven't yet processed (given by 'depth')
- */
- for (i = 0;i < depth;i++) {
- code = get_space_object(i_ctx_p, parr, &obj);
- if (code < 0)
- return code;
-
- if (i < (depth - 1)) {
- if (!obj->alternateproc) {
- return_error(e_typecheck);
- }
- code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
- if (code < 0)
- return code;
- }
- }
-
- code = obj->setproc(i_ctx_p, parr, &stage, &cont, CIESubst);
- make_int(pstage, stage);
- if (code != 0)
- return code;
- if (!cont) {
- /* Completed that space, decrement the 'depth' */
- make_int(pdepth, --depth);
- parr = &arr;
- }
+ ref_assign(&arr, ep);
+ /* Run along the nested color spaces until we get to the lowest one
+ * that we haven't yet processed (given by 'depth')
+ */
+ for (i = 0;i < depth;i++) {
+ code = get_space_object(i_ctx_p, parr, &obj);
+ if (code < 0)
+ return code;
+
+ if (i < (depth - 1)) {
+ if (!obj->alternateproc) {
+ return_error(e_typecheck);
+ }
+ code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
+ if (code < 0)
+ return code;
+ }
+ }
+
+ code = obj->setproc(i_ctx_p, parr, &stage, &cont, CIESubst);
+ make_int(pstage, stage);
+ if (code != 0)
+ return code;
+ if (!cont) {
+ /* Completed that space, decrement the 'depth' */
+ make_int(pdepth, --depth);
+ parr = &arr;
+ }
}
if (code == 0) {
/* Remove our next continuation and our data */
- esp -= 5;
- op = osp;
- istate->colorspace[0].array = *op;
- /* Remove the colorspace array form the operand stack */
- pop(1);
- code = o_pop_estack;
+ esp -= 5;
+ op = osp;
+ istate->colorspace[0].array = *op;
+ /* Remove the colorspace array form the operand stack */
+ pop(1);
+ code = o_pop_estack;
}
return code;
}
@@ -6164,37 +6157,37 @@ setdevicecolor_cont(i_ctx_t *i_ctx_p)
push_op_estack(setdevicecolor_cont);
do {
- switch(stage) {
- case 0:
- make_int(pstage, ++stage);
- push(1);
- switch(base) {
- case 0: /* DeviceGray */
- code = name_enter_string(imemory, "DeviceGray", op);
- break;
- case 1: /* DeviceRGB */
- code = name_enter_string(imemory, "DeviceRGB", op);
- break;
- case 2: /* DeviceCMYK */
- code = name_enter_string(imemory, "DeviceCMYK", op);
- break;
- }
- if (code < 0)
- return code;
- code = zsetcolorspace(i_ctx_p);
- if (code != 0)
- return code;
- break;
- case 1:
- make_int(pstage, ++stage);
- code = zsetcolor(i_ctx_p);
- if (code != 0)
- return code;
- break;
- case 2:
- esp -= 3;
- return o_pop_estack;
- break;
+ switch(stage) {
+ case 0:
+ make_int(pstage, ++stage);
+ push(1);
+ switch(base) {
+ case 0: /* DeviceGray */
+ code = name_enter_string(imemory, "DeviceGray", op);
+ break;
+ case 1: /* DeviceRGB */
+ code = name_enter_string(imemory, "DeviceRGB", op);
+ break;
+ case 2: /* DeviceCMYK */
+ code = name_enter_string(imemory, "DeviceCMYK", op);
+ break;
+ }
+ if (code < 0)
+ return code;
+ code = zsetcolorspace(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ case 1:
+ make_int(pstage, ++stage);
+ code = zsetcolor(i_ctx_p);
+ if (code != 0)
+ return code;
+ break;
+ case 2:
+ esp -= 3;
+ return o_pop_estack;
+ break;
}
}while(1);
return 0;
@@ -6214,15 +6207,15 @@ zsetgray(i_ctx_t * i_ctx_p)
/* Gather numeric operand value(s) */
code = float_params(op, 1, &value);
if (code < 0)
- return code;
+ return code;
/* Clamp numeric operand range(s) */
if (value < 0)
- value = 0;
+ value = 0;
else if (value > 1)
- value = 1;
+ value = 1;
code = make_floats(op, &value, 1);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -6248,20 +6241,20 @@ zsethsbcolor(i_ctx_t * i_ctx_p)
/* Gather numeric operand value(s) (also checks type) */
code = float_params(op, 3, (float *)&values);
if (code < 0)
- return code;
+ return code;
/* Clamp numeric operand range(s) */
for (i = 0;i < 3; i++) {
if (values[i] < 0)
- values[i] = 0;
- else if (values[i] > 1)
- values[i] = 1;
+ values[i] = 0;
+ else if (values[i] > 1)
+ values[i] = 1;
}
hsb2rgb((float *)&values);
code = make_floats(&op[-2], (const float *)&values, 3);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -6287,18 +6280,18 @@ zsetrgbcolor(i_ctx_t * i_ctx_p)
/* Gather numeric operand value(s) (also checks type) */
code = float_params(op, 3, (float *)&values);
if (code < 0)
- return code;
+ return code;
/* Clamp numeric operand range(s) */
for (i = 0;i < 3; i++) {
if (values[i] < 0)
- values[i] = 0;
- else if (values[i] > 1)
- values[i] = 1;
+ values[i] = 0;
+ else if (values[i] > 1)
+ values[i] = 1;
}
code = make_floats(&op[-2], (const float *)&values, 3);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -6325,18 +6318,18 @@ zsetcmykcolor(i_ctx_t * i_ctx_p)
/* Gather numeric operand value(s) (also checks type) */
code = float_params(op, 4, (float *)&values);
if (code < 0)
- return code;
+ return code;
/* Clamp numeric operand range(s) */
for (i = 0;i < 4; i++) {
if (values[i] < 0)
- values[i] = 0;
- else if (values[i] > 1)
- values[i] = 1;
+ values[i] = 0;
+ else if (values[i] > 1)
+ values[i] = 1;
}
code = make_floats(&op[-3], (const float *)&values, 4);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
@@ -6392,38 +6385,38 @@ currentbasecolor_cont(i_ctx_t *i_ctx_p)
push_op_estack(currentbasecolor_cont);
while (code == 0 && cont) {
- ref_assign(&arr, ep);
- parr = &arr;
- /* Run along the nested color spaces until we get to the lowest one
- * that we haven't yet processed (given by 'depth')
- */
- for (i = 0;i < depth;i++) {
- code = get_space_object(i_ctx_p, parr, &obj);
- if (code < 0)
- return code;
-
- if (i < (depth - 1)) {
- if (!obj->alternateproc) {
- return_error(e_typecheck);
- }
- code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
- if (code < 0)
- return code;
- }
- }
-
- code = obj->basecolorproc(i_ctx_p, parr, base, &stage, &cont, &stack_depth);
- make_int(&ep[-4], stack_depth);
- make_int(&ep[-1], stage);
- if (code != 0)
- return code;
- /* Completed that space, increment the 'depth' */
- make_int(&ep[-2], ++depth);
+ ref_assign(&arr, ep);
+ parr = &arr;
+ /* Run along the nested color spaces until we get to the lowest one
+ * that we haven't yet processed (given by 'depth')
+ */
+ for (i = 0;i < depth;i++) {
+ code = get_space_object(i_ctx_p, parr, &obj);
+ if (code < 0)
+ return code;
+
+ if (i < (depth - 1)) {
+ if (!obj->alternateproc) {
+ return_error(e_typecheck);
+ }
+ code = obj->alternateproc(i_ctx_p, parr, &parr, &CIESubst);
+ if (code < 0)
+ return code;
+ }
+ }
+
+ code = obj->basecolorproc(i_ctx_p, parr, base, &stage, &cont, &stack_depth);
+ make_int(&ep[-4], stack_depth);
+ make_int(&ep[-1], stage);
+ if (code != 0)
+ return code;
+ /* Completed that space, increment the 'depth' */
+ make_int(&ep[-2], ++depth);
}
if (code == 0) {
/* Remove our next continuation and our data */
- esp -= 7;
- code = o_pop_estack;
+ esp -= 7;
+ code = o_pop_estack;
}
return code;
}
@@ -6438,11 +6431,11 @@ zcurrentgray(i_ctx_t * i_ctx_p)
code = validate_spaces(i_ctx_p, &istate->colorspace[0].array, &depth);
if (code < 0)
- return code;
+ return code;
code = zcurrentcolor(i_ctx_p);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(7);
@@ -6473,11 +6466,11 @@ zcurrenthsbcolor(i_ctx_t * i_ctx_p)
code = validate_spaces(i_ctx_p, &istate->colorspace[0].array, &depth);
if (code < 0)
- return code;
+ return code;
code = zcurrentcolor(i_ctx_p);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(7);
@@ -6508,7 +6501,7 @@ zcurrentrgbcolor(i_ctx_t * i_ctx_p)
code = zcurrentcolor(i_ctx_p);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(7);
@@ -6539,7 +6532,7 @@ zcurrentcmykcolor(i_ctx_t * i_ctx_p)
code = zcurrentcolor(i_ctx_p);
if (code < 0)
- return code;
+ return code;
/* Set up for the continuation procedure which will do the work */
/* Make sure the exec stack has enough space */
check_estack(7);
diff --git a/gs/psi/zcolor.h b/gs/psi/zcolor.h
index ba6c0203e..9de3c99ab 100644
--- a/gs/psi/zcolor.h
+++ b/gs/psi/zcolor.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -17,37 +17,37 @@
#ifndef zcolor_INCLUDED
# define zcolor_INCLUDED
-/*
+/*
* The code to set color space and color values has been moved from PostScript
* into C (mostly). The new C code broadly follows the old PostScript method, each
* possible color space is defined by an instance of the PS_colour_space_s object below. These
- * are stored in an array (in zcolor.c) called colorProcs. When color spaces or
- * color values are set, or values retrieved, we examine the array or name which
- * represents the space, and extract a C string representation of the color space
- * name. We compare the name with each of the names in the colorProcs array to
+ * are stored in an array (in zcolor.c) called colorProcs. When color spaces or
+ * color values are set, or values retrieved, we examine the array or name which
+ * represents the space, and extract a C string representation of the color space
+ * name. We compare the name with each of the names in the colorProcs array to
* retrieve the instance which handles that color space.
*
- * When setting a new color space, we must follow the existing Ghostscript policy
+ * When setting a new color space, we must follow the existing Ghostscript policy
* which requires us to set the spaces 'backwards'. That is, before we set a space
- * which has an alternate color space (eg Separation) we must first set the
- * alternate space as the current.
+ * which has an alternate color space (eg Separation) we must first set the
+ * alternate space as the current.
*
- * Now, when setting a color space, we convert any tint transform procedure from
+ * Now, when setting a color space, we convert any tint transform procedure from
* a PostScript procedure into a PostScript Function, either a type 4 PostScript
* calculator or a type 0 sampled function. This has performance benefits, especially
* wehn dealing with images. Now, if we are converting into a type 4 function this is
* easy, however a type 0 function requires us to sample the color space and in order
* to do this, we must actually execute the tint transform procedure. This means we
- * must exit the C world and hand control back to the PostScript interpreter
+ * must exit the C world and hand control back to the PostScript interpreter
* temporarily.
*
* We do this with a 'continuation function', we store our procdure on the PostScript
* execution stack, and when we need to run a tint transform, we push the procedure
* onto the execution stack after our function, and exit back to the interpreter.
- * When the interpreter has finished executing the transform, it executes the next
+ * When the interpreter has finished executing the transform, it executes the next
* entry on the execution stack, which is our C procedure, and returns control back
* to our code. Of course, we need to know what stage of processing we were up to
- * and so we also store some variables on the execution stack. Continuation
+ * and so we also store some variables on the execution stack. Continuation
* procedures are basically state machines.
*
* In fact, we need quite a few of these, for setting the color space, the current
@@ -57,37 +57,36 @@
typedef struct PS_colour_space_s PS_colour_space_t;
struct PS_colour_space_s {
char *name; /* C string representing the name of the space */
- int (*setproc)(i_ctx_t * i_ctx_p, ref *r, /* Routine to set the color space, if CIESubst */
- int *stage, int *cont, int CIESubst); /* is true then we are already doing CIE substitution */
+ int (*setproc)(i_ctx_t * i_ctx_p, ref *r, /* Routine to set the color space, if CIESubst */
+ int *stage, int *cont, int CIESubst); /* is true then we are already doing CIE substitution */
int (*validateproc)(i_ctx_t * i_ctx_p, /* Validates the color space operands */
- ref **r);
- int (*alternateproc)(i_ctx_t * i_ctx_p, /* Retrieve the alternate color space (if any) */
- ref *space, ref **r, int *CIESubst); /* If CIESubst comes back true, then don't do further CIE substitution */
+ ref **r);
+ int (*alternateproc)(i_ctx_t * i_ctx_p, /* Retrieve the alternate color space (if any) */
+ ref *space, ref **r, int *CIESubst); /* If CIESubst comes back true, then don't do further CIE substitution */
int (*numcomponents)(i_ctx_t * i_ctx_p, /* Returns the number of components in the space */
- ref *space, int *n);
+ ref *space, int *n);
int (*range)(i_ctx_t * i_ctx_p, ref *space, /* Returns 'components' pairs of values which represent */
- float *ptr); /* the valid ranges of values for this space */
- int (*domain)(i_ctx_t * i_ctx_p, /* Returns 'components' pairs of values which represent */
- ref *space, float *ptr); /* the domain over which values are valid */
- int (*basecolorproc)(i_ctx_t * i_ctx_p, /* convert the current color values into device space */
- ref *space, int base, int *stage, /* values. 'base' is the requested base space, 0=gray */
- int *cont, int *stack_depth); /* 1 = HSB, 2 = RGB, 3 = CMYK. Separation and DeviceN */
- /* spaces will return default values if they are not using */
- /* the alternate space, and will convert the components */
- /* into values in the alternate otherwise, by executing */
- /* the tint transform procedure */
- int (*runtransformproc)(i_ctx_t *i_ctx_p, /* executes the tint transform for this space */
- ref *space, int *usealternate,
- int *stage, int *stack_depth);
+ float *ptr); /* the valid ranges of values for this space */
+ int (*domain)(i_ctx_t * i_ctx_p, /* Returns 'components' pairs of values which represent */
+ ref *space, float *ptr); /* the domain over which values are valid */
+ int (*basecolorproc)(i_ctx_t * i_ctx_p, /* convert the current color values into device space */
+ ref *space, int base, int *stage, /* values. 'base' is the requested base space, 0=gray */
+ int *cont, int *stack_depth); /* 1 = HSB, 2 = RGB, 3 = CMYK. Separation and DeviceN */
+ /* spaces will return default values if they are not using */
+ /* the alternate space, and will convert the components */
+ /* into values in the alternate otherwise, by executing */
+ /* the tint transform procedure */
+ int (*runtransformproc)(i_ctx_t *i_ctx_p, /* executes the tint transform for this space */
+ ref *space, int *usealternate,
+ int *stage, int *stack_depth);
int (*validatecomponents)(i_ctx_t *i_ctx_p, /* Check the components supplied as an argument to setcolor */
- ref *space, float *values, /* are valid */
- int num_comps);
- int (*compareproc)(i_ctx_t *i_ctx_p, /* Compare two color spaces of this type, to see if they */
- ref *space, ref *testspace); /* are the same */
- int (*initialcolorproc)(i_ctx_t *i_ctx_p, /* Set the appropriate initial color for this space */
- ref *space);
-};
-
+ ref *space, float *values, /* are valid */
+ int num_comps);
+ int (*compareproc)(i_ctx_t *i_ctx_p, /* Compare two color spaces of this type, to see if they */
+ ref *space, ref *testspace); /* are the same */
+ int (*initialcolorproc)(i_ctx_t *i_ctx_p, /* Set the appropriate initial color for this space */
+ ref *space);
+};
/* Given a pointer to a color space (name or array), returns
* the appropriate instance of PS_colour_space_s from the colorProcs array
diff --git a/gs/psi/zcolor1.c b/gs/psi/zcolor1.c
index 5feb2e875..1cb5dad46 100644
--- a/gs/psi/zcolor1.c
+++ b/gs/psi/zcolor1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -78,13 +78,13 @@ zsetblackgeneration(i_ctx_t *i_ctx_p)
check_estack(1 + zcolor_remap_one_estack);
code = gs_setblackgeneration_remap(igs, gs_mapped_transfer, false);
if (code < 0)
- return code;
+ return code;
istate->black_generation = *op;
pop(1);
push_op_estack(zcolor_remap_color);
return zcolor_remap_one(i_ctx_p, &istate->black_generation,
- igs->black_generation, igs,
- zcolor_remap_one_finish);
+ igs->black_generation, igs,
+ zcolor_remap_one_finish);
}
/* <redproc> <greenproc> <blueproc> <grayproc> setcolortransfer - */
@@ -105,31 +105,31 @@ zsetcolortransfer(i_ctx_t *i_ctx_p)
istate->transfer_procs.blue = op[-1];
istate->transfer_procs.gray = *op;
if ((code = gs_setcolortransfer_remap(igs,
- gs_mapped_transfer, gs_mapped_transfer,
- gs_mapped_transfer, gs_mapped_transfer,
- false)) < 0
- )
- return code;
+ gs_mapped_transfer, gs_mapped_transfer,
+ gs_mapped_transfer, gs_mapped_transfer,
+ false)) < 0
+ )
+ return code;
/* Use osp rather than op here, because zcolor_remap_one pushes. */
pop(4);
push_op_estack(zcolor_reset_transfer);
if ((code = zcolor_remap_one(i_ctx_p,
- &istate->transfer_procs.red,
- igs->set_transfer.red, igs,
- zcolor_remap_one_finish)) < 0 ||
- (code = zcolor_remap_one(i_ctx_p,
- &istate->transfer_procs.green,
- igs->set_transfer.green, igs,
- zcolor_remap_one_finish)) < 0 ||
- (code = zcolor_remap_one(i_ctx_p,
- &istate->transfer_procs.blue,
- igs->set_transfer.blue, igs,
- zcolor_remap_one_finish)) < 0 ||
- (code = zcolor_remap_one(i_ctx_p, &istate->transfer_procs.gray,
- igs->set_transfer.gray, igs,
- zcolor_remap_one_finish)) < 0
- )
- return code;
+ &istate->transfer_procs.red,
+ igs->set_transfer.red, igs,
+ zcolor_remap_one_finish)) < 0 ||
+ (code = zcolor_remap_one(i_ctx_p,
+ &istate->transfer_procs.green,
+ igs->set_transfer.green, igs,
+ zcolor_remap_one_finish)) < 0 ||
+ (code = zcolor_remap_one(i_ctx_p,
+ &istate->transfer_procs.blue,
+ igs->set_transfer.blue, igs,
+ zcolor_remap_one_finish)) < 0 ||
+ (code = zcolor_remap_one(i_ctx_p, &istate->transfer_procs.gray,
+ igs->set_transfer.gray, igs,
+ zcolor_remap_one_finish)) < 0
+ )
+ return code;
return o_push_estack;
}
@@ -145,16 +145,15 @@ zsetundercolorremoval(i_ctx_t *i_ctx_p)
check_estack(1 + zcolor_remap_one_estack);
code = gs_setundercolorremoval_remap(igs, gs_mapped_transfer, false);
if (code < 0)
- return code;
+ return code;
istate->undercolor_removal = *op;
pop(1);
push_op_estack(zcolor_remap_color);
return zcolor_remap_one(i_ctx_p, &istate->undercolor_removal,
- igs->undercolor_removal, igs,
- zcolor_remap_one_signed_finish);
+ igs->undercolor_removal, igs,
+ zcolor_remap_one_signed_finish);
}
-
/* ------ Initialization procedure ------ */
const op_def zcolor1_op_defs[] =
diff --git a/gs/psi/zcolor2.c b/gs/psi/zcolor2.c
index b836d978b..f7ddf9c16 100644
--- a/gs/psi/zcolor2.c
+++ b/gs/psi/zcolor2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,6 @@
#include "igstate.h"
#include "store.h"
-
/*
* - .useralternate <bool>
*
@@ -42,7 +41,6 @@ zusealternate(i_ctx_t * i_ctx_p)
return 0;
}
-
/* ------ Initialization procedure ------ */
const op_def zcolor2_l2_op_defs[] = {
diff --git a/gs/psi/zcolor3.c b/gs/psi/zcolor3.c
index d874afcff..28d7e6ae6 100644
--- a/gs/psi/zcolor3.c
+++ b/gs/psi/zcolor3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -18,7 +18,6 @@
#include "igstate.h"
#include "store.h"
-
/*
* <bool> .setuseciecolor -
*
@@ -55,7 +54,7 @@ zcurrentrenderingintent(i_ctx_t *i_ctx_p)
return 0;
}
-/* <int> .setrenderingintent -
+/* <int> .setrenderingintent -
* See the comment in gsstate.c about the argumet interepretation.
*/
static int
@@ -66,7 +65,7 @@ zsetrenderingintent(i_ctx_t * i_ctx_p)
int code = int_param(op, max_int, &param);
if (code < 0 || (code = gs_setrenderingintent(igs, param)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
diff --git a/gs/psi/zcontext.c b/gs/psi/zcontext.c
index da45a3c12..caee3ab0f 100644
--- a/gs/psi/zcontext.c
+++ b/gs/psi/zcontext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -73,18 +73,18 @@ struct gs_context_s {
ctx_status_t status;
ctx_index_t index; /* > 0 */
bool detach; /* true if a detach has been */
- /* executed for this context */
+ /* executed for this context */
bool saved_local_vm; /* (see above) */
bool visible; /* during GC, true if visible; */
- /* otherwise, always true */
+ /* otherwise, always true */
ctx_index_t next_index; /* next context with same status */
- /* (active, waiting on same lock, */
- /* waiting on same condition, */
- /* waiting to be destroyed) */
+ /* (active, waiting on same lock, */
+ /* waiting on same condition, */
+ /* waiting to be destroyed) */
ctx_index_t joiner_index; /* context waiting on a join */
- /* for this one */
+ /* for this one */
gs_context_t *table_next; /* hash table chain -- this must be a real */
- /* pointer, for looking up indices */
+ /* pointer, for looking up indices */
};
static inline bool
context_is_visible(const gs_context_t *pctx)
@@ -98,7 +98,7 @@ visible_context(gs_context_t *pctx)
}
/* GC descriptor */
-static
+static
CLEAR_MARKS_PROC(context_clear_marks)
{
gs_context_t *const pctx = vptr;
@@ -106,7 +106,7 @@ CLEAR_MARKS_PROC(context_clear_marks)
(*st_context_state.clear_marks)
(cmem, &pctx->state, sizeof(pctx->state), &st_context_state);
}
-static
+static
ENUM_PTRS_WITH(context_enum_ptrs, gs_context_t *pctx)
ENUM_PREFIX(st_context_state, 2);
case 0: return ENUM_OBJ(pctx->scheduler);
@@ -115,7 +115,7 @@ case 1: {
const gs_context_t *next = pctx->table_next;
while (next && !next->visible)
- next = next->table_next;
+ next = next->table_next;
return ENUM_OBJ(next);
}
ENUM_PTRS_END
@@ -125,7 +125,7 @@ static RELOC_PTRS_WITH(context_reloc_ptrs, gs_context_t *pctx)
/* Don't relocate table_next -- the scheduler object handles that. */
RELOC_PTRS_END
gs_private_st_complex_only(st_context, gs_context_t, "gs_context_t",
- context_clear_marks, context_enum_ptrs, context_reloc_ptrs, 0);
+ context_clear_marks, context_enum_ptrs, context_reloc_ptrs, 0);
/*
* Context list structure. Note that this uses context indices, not
@@ -145,12 +145,12 @@ gs_private_st_simple(st_condition, gs_condition_t, "conditiontype");
/* Lock structure */
typedef struct gs_lock_s {
ctx_list_t waiting; /* contexts waiting for this lock, */
- /* must be first for subclassing */
+ /* must be first for subclassing */
ctx_index_t holder_index; /* context holding the lock, if any */
gs_scheduler_t *scheduler;
} gs_lock_t;
gs_private_st_ptrs1(st_lock, gs_lock_t, "locktype",
- lock_enum_ptrs, lock_reloc_ptrs, scheduler);
+ lock_enum_ptrs, lock_reloc_ptrs, scheduler);
/* Global state */
/*typedef struct gs_scheduler_s gs_scheduler_t; *//* (above) */
@@ -171,16 +171,16 @@ index_context(const gs_scheduler_t *psched, long index)
gs_context_t *pctx;
if (index == 0)
- return 0;
+ return 0;
pctx = psched->table[index % CTX_TABLE_SIZE];
while (pctx != 0 && pctx->index != index)
- pctx = pctx->table_next;
+ pctx = pctx->table_next;
return pctx;
}
/* Structure definition */
gs_private_st_composite(st_scheduler, gs_scheduler_t, "gs_scheduler",
- scheduler_enum_ptrs, scheduler_reloc_ptrs);
+ scheduler_enum_ptrs, scheduler_reloc_ptrs);
/*
* The only cross-local-VM pointers in the context machinery are the
* table_next pointers in contexts, and the current and table[] pointers
@@ -190,11 +190,11 @@ static ENUM_PTRS_WITH(scheduler_enum_ptrs, gs_scheduler_t *psched)
{
index -= 1;
if (index < CTX_TABLE_SIZE) {
- gs_context_t *pctx = psched->table[index];
+ gs_context_t *pctx = psched->table[index];
- while (pctx && !pctx->visible)
- pctx = pctx->table_next;
- return ENUM_OBJ(pctx);
+ while (pctx && !pctx->visible)
+ pctx = pctx->table_next;
+ return ENUM_OBJ(pctx);
}
return 0;
}
@@ -203,20 +203,20 @@ ENUM_PTRS_END
static RELOC_PTRS_WITH(scheduler_reloc_ptrs, gs_scheduler_t *psched)
{
if (psched->current->visible)
- RELOC_VAR(psched->current);
+ RELOC_VAR(psched->current);
{
- int i;
-
- for (i = 0; i < CTX_TABLE_SIZE; ++i) {
- gs_context_t **ppctx = &psched->table[i];
- gs_context_t **pnext;
-
- for (; *ppctx; ppctx = pnext) {
- pnext = &(*ppctx)->table_next;
- if ((*ppctx)->visible)
- RELOC_VAR(*ppctx);
- }
- }
+ int i;
+
+ for (i = 0; i < CTX_TABLE_SIZE; ++i) {
+ gs_context_t **ppctx = &psched->table[i];
+ gs_context_t **pnext;
+
+ for (; *ppctx; ppctx = pnext) {
+ pnext = &(*ppctx)->table_next;
+ if ((*ppctx)->visible)
+ RELOC_VAR(*ppctx);
+ }
+ }
}
}
RELOC_PTRS_END
@@ -243,17 +243,17 @@ context_reclaim(vm_spaces * pspaces, bool global)
chunk_locator_t loc;
for (i = countof(pspaces->memories.indexed) - 1; psched == 0 && i > 0; --i) {
- gs_ref_memory_t *mem = pspaces->memories.indexed[i];
- const gs_gc_root_t *root = mem->roots;
-
- for (; root; root = root->next) {
- if (gs_object_type((gs_memory_t *)mem, *root->p) == &st_context) {
- pctx = *root->p;
- psched = pctx->scheduler;
- lmem = mem;
- break;
- }
- }
+ gs_ref_memory_t *mem = pspaces->memories.indexed[i];
+ const gs_gc_root_t *root = mem->roots;
+
+ for (; root; root = root->next) {
+ if (gs_object_type((gs_memory_t *)mem, *root->p) == &st_context) {
+ pctx = *root->p;
+ psched = pctx->scheduler;
+ lmem = mem;
+ break;
+ }
+ }
}
/* Hide all contexts in other (local) VMs. */
@@ -264,13 +264,13 @@ context_reclaim(vm_spaces * pspaces, bool global)
loc.memory = (gs_ref_memory_t *)gs_memory_stable((gs_memory_t *)lmem);
loc.cp = 0;
for (i = 0; i < CTX_TABLE_SIZE; ++i)
- for (pctx = psched->table[i]; pctx; pctx = pctx->table_next)
- pctx->visible = chunk_locate_ptr(pctx, &loc);
+ for (pctx = psched->table[i]; pctx; pctx = pctx->table_next)
+ pctx->visible = chunk_locate_ptr(pctx, &loc);
#ifdef DEBUG
if (!psched->current->visible) {
- lprintf("Current context is invisible!\n");
- gs_abort((gs_memory_t *)lmem);
+ lprintf("Current context is invisible!\n");
+ gs_abort((gs_memory_t *)lmem);
}
#endif
@@ -279,15 +279,14 @@ context_reclaim(vm_spaces * pspaces, bool global)
/* Make all contexts visible again. */
for (i = 0; i < CTX_TABLE_SIZE; ++i)
- for (pctx = psched->table[i]; pctx; pctx = pctx->table_next)
- pctx->visible = true;
+ for (pctx = psched->table[i]; pctx; pctx = pctx->table_next)
+ pctx->visible = true;
}
-
/* Forward references */
static int context_create(gs_scheduler_t *, gs_context_t **,
- const gs_dual_memory_t *,
- const gs_context_state_t *, bool);
+ const gs_dual_memory_t *,
+ const gs_context_state_t *, bool);
static long context_usertime(void);
static int context_param(const gs_scheduler_t *, os_ptr, gs_context_t **);
static void context_destroy(gs_context_t *);
@@ -320,9 +319,9 @@ add_last(const gs_scheduler_t *psched, ctx_list_t *pl, gs_context_t *pc)
{
pc->next_index = 0;
if (pl->head_index == 0)
- pl->head_index = pc->index;
+ pl->head_index = pc->index;
else
- index_context(psched, pl->tail_index)->next_index = pc->index;
+ index_context(psched, pl->tail_index)->next_index = pc->index;
pl->tail_index = pc->index;
}
@@ -350,8 +349,8 @@ ctx_initialize(i_ctx_t **pi_ctx_p)
i_ctx_t *i_ctx_p = *pi_ctx_p; /* for gs_imemory */
gs_ref_memory_t *imem = iimemory_system;
gs_scheduler_t *psched =
- gs_alloc_struct_immovable((gs_memory_t *) imem, gs_scheduler_t,
- &st_scheduler, "gs_scheduler");
+ gs_alloc_struct_immovable((gs_memory_t *) imem, gs_scheduler_t,
+ &st_scheduler, "gs_scheduler");
psched->current = 0;
psched->active.head_index = psched->active.tail_index = 0;
@@ -361,8 +360,8 @@ ctx_initialize(i_ctx_t **pi_ctx_p)
memset(psched->table, 0, sizeof(psched->table));
/* Create an initial context. */
if (context_create(psched, &psched->current, &gs_imemory, *pi_ctx_p, true) < 0) {
- lprintf("Can't create initial context!");
- gs_abort(imemory);
+ lprintf("Can't create initial context!");
+ gs_abort(imemory);
}
psched->current->scheduler = psched;
/* Hook into the interpreter. */
@@ -386,73 +385,73 @@ ctx_reschedule(i_ctx_t **pi_ctx_p)
#ifdef DEBUG
if (*pi_ctx_p != &current->state) {
- lprintf2("current->state = 0x%lx, != i_ctx_p = 0x%lx!\n",
- (ulong)&current->state, (ulong)*pi_ctx_p);
+ lprintf2("current->state = 0x%lx, != i_ctx_p = 0x%lx!\n",
+ (ulong)&current->state, (ulong)*pi_ctx_p);
}
#endif
/* If there are any dead contexts waiting to be released, */
/* take care of that now. */
while (psched->dead_index != 0) {
- gs_context_t *dead = index_context(psched, psched->dead_index);
- long next_index = dead->next_index;
-
- if (current == dead) {
- if_debug1('"', "[\"]storing dead %ld\n", current->index);
- context_state_store(&current->state);
- current = 0;
- }
- context_destroy(dead);
- psched->dead_index = next_index;
+ gs_context_t *dead = index_context(psched, psched->dead_index);
+ long next_index = dead->next_index;
+
+ if (current == dead) {
+ if_debug1('"', "[\"]storing dead %ld\n", current->index);
+ context_state_store(&current->state);
+ current = 0;
+ }
+ context_destroy(dead);
+ psched->dead_index = next_index;
}
/* Update saved_local_vm. See above for the invariant. */
if (current != 0)
- current->saved_local_vm =
- current->state.memory.space_local->saved != 0;
+ current->saved_local_vm =
+ current->state.memory.space_local->saved != 0;
/* Run the first ready context, taking the 'save' lock into account. */
{
- gs_context_t *prev = 0;
- gs_context_t *ready;
-
- for (ready = index_context(psched, psched->active.head_index);;
- prev = ready, ready = index_context(psched, ready->next_index)
- ) {
- if (ready == 0) {
- if (current != 0)
- context_store(psched, current);
- lprintf("No context to run!");
- return_error(e_Fatal);
- }
- /* See above for an explanation of the following test. */
- if (ready->state.memory.space_local->saved != 0 &&
- !ready->saved_local_vm
- )
- continue;
- /* Found a context to run. */
- {
- ctx_index_t next_index = ready->next_index;
-
- if (prev)
- prev->next_index = next_index;
- else
- psched->active.head_index = next_index;
- if (!next_index)
- psched->active.tail_index = (prev ? prev->index : 0);
- }
- break;
- }
- if (ready == current)
- return 0; /* no switch */
- /*
- * Save the state of the current context in psched->current,
- * if any context is current.
- */
- if (current != 0)
- context_store(psched, current);
- psched->current = ready;
- /* Load the state of the new current context. */
- context_load(psched, ready);
- /* Switch the interpreter's context state pointer. */
- *pi_ctx_p = &ready->state;
+ gs_context_t *prev = 0;
+ gs_context_t *ready;
+
+ for (ready = index_context(psched, psched->active.head_index);;
+ prev = ready, ready = index_context(psched, ready->next_index)
+ ) {
+ if (ready == 0) {
+ if (current != 0)
+ context_store(psched, current);
+ lprintf("No context to run!");
+ return_error(e_Fatal);
+ }
+ /* See above for an explanation of the following test. */
+ if (ready->state.memory.space_local->saved != 0 &&
+ !ready->saved_local_vm
+ )
+ continue;
+ /* Found a context to run. */
+ {
+ ctx_index_t next_index = ready->next_index;
+
+ if (prev)
+ prev->next_index = next_index;
+ else
+ psched->active.head_index = next_index;
+ if (!next_index)
+ psched->active.tail_index = (prev ? prev->index : 0);
+ }
+ break;
+ }
+ if (ready == current)
+ return 0; /* no switch */
+ /*
+ * Save the state of the current context in psched->current,
+ * if any context is current.
+ */
+ if (current != 0)
+ context_store(psched, current);
+ psched->current = ready;
+ /* Load the state of the new current context. */
+ context_load(psched, ready);
+ /* Switch the interpreter's context state pointer. */
+ *pi_ctx_p = &ready->state;
}
return 0;
}
@@ -465,7 +464,7 @@ ctx_time_slice(i_ctx_t **pi_ctx_p)
gs_scheduler_t *psched = ((gs_context_t *)*pi_ctx_p)->scheduler;
if (psched->active.head_index == 0)
- return 0;
+ return 0;
if_debug0('"', "[\"]time-slice\n");
add_last(psched, &psched->active, psched->current);
return ctx_reschedule(pi_ctx_p);
@@ -495,17 +494,17 @@ zdetach(i_ctx_t *i_ctx_p)
int code;
if ((code = context_param(psched, op, &pctx)) < 0)
- return code;
+ return code;
if_debug2('\'', "[']detach %ld, status = %d\n",
- pctx->index, pctx->status);
+ pctx->index, pctx->status);
if (pctx->joiner_index != 0 || pctx->detach)
- return_error(e_invalidcontext);
+ return_error(e_invalidcontext);
switch (pctx->status) {
- case cs_active:
- pctx->detach = true;
- break;
- case cs_done:
- context_destroy(pctx);
+ case cs_active:
+ pctx->detach = true;
+ break;
+ case cs_done:
+ context_destroy(pctx);
}
pop(1);
return 0;
@@ -513,9 +512,9 @@ zdetach(i_ctx_t *i_ctx_p)
static int
do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin,
- const ref * pstdout, uint mcount, bool local),
+ const ref * pstdout, uint mcount, bool local),
values_older_than(const ref_stack_t * pstack, uint first, uint last,
- int max_space);
+ int max_space);
static int
fork_done(i_ctx_t *),
fork_done_with_error(i_ctx_t *),
@@ -533,7 +532,7 @@ zfork(i_ctx_t *i_ctx_p)
ref rnull;
if (mcount == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
make_null(&rnull);
return do_fork(i_ctx_p, op, &rnull, &rnull, mcount, false);
}
@@ -545,13 +544,13 @@ zlocalfork(i_ctx_t *i_ctx_p)
int code;
if (mcount == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
code = values_older_than(&o_stack, 1, mcount - 1, avm_local);
if (code < 0)
- return code;
+ return code;
code = do_fork(i_ctx_p, op - 2, op - 1, op, mcount - 2, true);
if (code < 0)
- return code;
+ return code;
op = osp;
op[-2] = *op;
pop(2);
@@ -561,7 +560,7 @@ zlocalfork(i_ctx_t *i_ctx_p)
/* Internal procedure to actually do the fork operation. */
static int
do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, const ref * pstdout,
- uint mcount, bool local)
+ uint mcount, bool local)
{
gs_context_t *pcur = (gs_context_t *)i_ctx_p;
gs_scheduler_t *psched = pcur->scheduler;
@@ -573,98 +572,98 @@ do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, const ref * pstdout,
check_proc(*op);
if (iimemory_local->save_level)
- return_error(e_invalidcontext);
+ return_error(e_invalidcontext);
if (r_has_type(pstdout, t_null)) {
- code = zget_stdout(i_ctx_p, &s);
- if (code < 0)
- return code;
- pstdout = &ref_stdio[1];
+ code = zget_stdout(i_ctx_p, &s);
+ if (code < 0)
+ return code;
+ pstdout = &ref_stdio[1];
} else
- check_read_file(i_ctx_p, s, pstdout);
+ check_read_file(i_ctx_p, s, pstdout);
if (r_has_type(pstdin, t_null)) {
- code = zget_stdin(i_ctx_p, &s);
- if (code < 0)
- return code;
- pstdin = &ref_stdio[0];
+ code = zget_stdin(i_ctx_p, &s);
+ if (code < 0)
+ return code;
+ pstdin = &ref_stdio[0];
} else
- check_read_file(i_ctx_p, s, pstdin);
+ check_read_file(i_ctx_p, s, pstdin);
dmem = gs_imemory;
if (local) {
- /* Share global VM, private local VM. */
- ref *puserdict;
- uint userdict_size;
- gs_memory_t *parent = iimemory_local->non_gc_memory;
- gs_ref_memory_t *lmem;
- gs_ref_memory_t *lmem_stable;
-
- if (dict_find_string(systemdict, "userdict", &puserdict) <= 0 ||
- !r_has_type(puserdict, t_dictionary)
- )
- return_error(e_Fatal);
- old_userdict = *puserdict;
- userdict_size = dict_maxlength(&old_userdict);
- lmem = ialloc_alloc_state(parent, iimemory_local->chunk_size);
- lmem_stable = ialloc_alloc_state(parent, iimemory_local->chunk_size);
- if (lmem == 0 || lmem_stable == 0) {
- gs_free_object(parent, lmem_stable, "do_fork");
- gs_free_object(parent, lmem, "do_fork");
- return_error(e_VMerror);
- }
- lmem->space = avm_local;
- lmem_stable->space = avm_local;
- lmem->stable_memory = (gs_memory_t *)lmem_stable;
- dmem.space_local = lmem;
- code = context_create(psched, &pctx, &dmem, &pcur->state, false);
- if (code < 0) {
- /****** FREE lmem ******/
- return code;
- }
- /*
- * Create a new userdict. PostScript code will take care of
- * the rest of the initialization of the new context.
- */
- code = dict_alloc(lmem, userdict_size, &new_userdict);
- if (code < 0) {
- context_destroy(pctx);
- /****** FREE lmem ******/
- return code;
- }
+ /* Share global VM, private local VM. */
+ ref *puserdict;
+ uint userdict_size;
+ gs_memory_t *parent = iimemory_local->non_gc_memory;
+ gs_ref_memory_t *lmem;
+ gs_ref_memory_t *lmem_stable;
+
+ if (dict_find_string(systemdict, "userdict", &puserdict) <= 0 ||
+ !r_has_type(puserdict, t_dictionary)
+ )
+ return_error(e_Fatal);
+ old_userdict = *puserdict;
+ userdict_size = dict_maxlength(&old_userdict);
+ lmem = ialloc_alloc_state(parent, iimemory_local->chunk_size);
+ lmem_stable = ialloc_alloc_state(parent, iimemory_local->chunk_size);
+ if (lmem == 0 || lmem_stable == 0) {
+ gs_free_object(parent, lmem_stable, "do_fork");
+ gs_free_object(parent, lmem, "do_fork");
+ return_error(e_VMerror);
+ }
+ lmem->space = avm_local;
+ lmem_stable->space = avm_local;
+ lmem->stable_memory = (gs_memory_t *)lmem_stable;
+ dmem.space_local = lmem;
+ code = context_create(psched, &pctx, &dmem, &pcur->state, false);
+ if (code < 0) {
+ /****** FREE lmem ******/
+ return code;
+ }
+ /*
+ * Create a new userdict. PostScript code will take care of
+ * the rest of the initialization of the new context.
+ */
+ code = dict_alloc(lmem, userdict_size, &new_userdict);
+ if (code < 0) {
+ context_destroy(pctx);
+ /****** FREE lmem ******/
+ return code;
+ }
} else {
- /* Share global and local VM. */
- code = context_create(psched, &pctx, &dmem, &pcur->state, false);
- if (code < 0) {
- /****** FREE lmem ******/
- return code;
- }
- /*
- * Copy the gstate stack. The current method is not elegant;
- * in fact, I'm not entirely sure it works.
- */
- {
- int n;
- const gs_state *old;
- gs_state *new;
-
- for (n = 0, old = igs; old != 0; old = gs_state_saved(old))
- ++n;
- for (old = pctx->state.pgs; old != 0; old = gs_state_saved(old))
- --n;
- for (; n > 0 && code >= 0; --n)
- code = gs_gsave(pctx->state.pgs);
- if (code < 0) {
+ /* Share global and local VM. */
+ code = context_create(psched, &pctx, &dmem, &pcur->state, false);
+ if (code < 0) {
+ /****** FREE lmem ******/
+ return code;
+ }
+ /*
+ * Copy the gstate stack. The current method is not elegant;
+ * in fact, I'm not entirely sure it works.
+ */
+ {
+ int n;
+ const gs_state *old;
+ gs_state *new;
+
+ for (n = 0, old = igs; old != 0; old = gs_state_saved(old))
+ ++n;
+ for (old = pctx->state.pgs; old != 0; old = gs_state_saved(old))
+ --n;
+ for (; n > 0 && code >= 0; --n)
+ code = gs_gsave(pctx->state.pgs);
+ if (code < 0) {
/****** FREE lmem & GSTATES ******/
- return code;
- }
- for (old = igs, new = pctx->state.pgs;
- old != 0 /* (== new != 0) */ && code >= 0;
- old = gs_state_saved(old), new = gs_state_saved(new)
- )
- code = gs_setgstate(new, old);
- if (code < 0) {
+ return code;
+ }
+ for (old = igs, new = pctx->state.pgs;
+ old != 0 /* (== new != 0) */ && code >= 0;
+ old = gs_state_saved(old), new = gs_state_saved(new)
+ )
+ code = gs_setgstate(new, old);
+ if (code < 0) {
/****** FREE lmem & GSTATES ******/
- return code;
- }
- }
+ return code;
+ }
+ }
}
pctx->state.op_array_table_global = i_ctx_p->op_array_table_global;
pctx->state.op_array_table_local = i_ctx_p->op_array_table_local;
@@ -676,39 +675,39 @@ do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, const ref * pstdout,
pctx->state.stdio[2] = pcur->state.stdio[2];
/* Initialize the interpreter stacks. */
{
- ref_stack_t *dstack = (ref_stack_t *)&pctx->state.dict_stack;
- uint count = ref_stack_count(&d_stack);
- uint copy = (local ? min_dstack_size : count);
-
- ref_stack_push(dstack, copy);
- stack_copy(dstack, &d_stack, copy, count - copy);
- if (local) {
- /* Substitute the new userdict for the old one. */
- long i;
-
- for (i = 0; i < copy; ++i) {
- ref *pdref = ref_stack_index(dstack, i);
-
- if (obj_eq(imemory, pdref, &old_userdict))
- *pdref = new_userdict;
- }
- }
+ ref_stack_t *dstack = (ref_stack_t *)&pctx->state.dict_stack;
+ uint count = ref_stack_count(&d_stack);
+ uint copy = (local ? min_dstack_size : count);
+
+ ref_stack_push(dstack, copy);
+ stack_copy(dstack, &d_stack, copy, count - copy);
+ if (local) {
+ /* Substitute the new userdict for the old one. */
+ long i;
+
+ for (i = 0; i < copy; ++i) {
+ ref *pdref = ref_stack_index(dstack, i);
+
+ if (obj_eq(imemory, pdref, &old_userdict))
+ *pdref = new_userdict;
+ }
+ }
}
{
- ref_stack_t *estack = (ref_stack_t *)&pctx->state.exec_stack;
+ ref_stack_t *estack = (ref_stack_t *)&pctx->state.exec_stack;
- ref_stack_push(estack, 3);
- /* fork_done must be executed in both normal and error cases. */
- make_mark_estack(estack->p - 2, es_other, fork_done_with_error);
- make_oper(estack->p - 1, 0, fork_done);
- *estack->p = *op;
+ ref_stack_push(estack, 3);
+ /* fork_done must be executed in both normal and error cases. */
+ make_mark_estack(estack->p - 2, es_other, fork_done_with_error);
+ make_oper(estack->p - 1, 0, fork_done);
+ *estack->p = *op;
}
{
- ref_stack_t *ostack = (ref_stack_t *)&pctx->state.op_stack;
- uint count = mcount - 2;
+ ref_stack_t *ostack = (ref_stack_t *)&pctx->state.op_stack;
+ uint count = mcount - 2;
- ref_stack_push(ostack, count);
- stack_copy(ostack, &o_stack, count, osp - op + 1);
+ ref_stack_push(ostack, count);
+ stack_copy(ostack, &o_stack, count, osp - op + 1);
}
pctx->state.binary_object_format = pcur->state.binary_object_format;
add_last(psched, &psched->active, pctx);
@@ -724,13 +723,13 @@ do_fork(i_ctx_t *i_ctx_p, os_ptr op, const ref * pstdin, const ref * pstdout,
*/
static int
values_older_than(const ref_stack_t * pstack, uint first, uint last,
- int next_space)
+ int next_space)
{
uint i;
for (i = first; i <= last; ++i)
- if (r_space(ref_stack_index(pstack, (long)i)) >= next_space)
- return_error(e_invalidaccess);
+ if (r_space(ref_stack_index(pstack, (long)i)) >= next_space)
+ return_error(e_invalidaccess);
return 0;
}
@@ -745,7 +744,7 @@ fork_done(i_ctx_t *i_ctx_p)
gs_scheduler_t *psched = pcur->scheduler;
if_debug2('\'', "[']done %ld%s\n", pcur->index,
- (pcur->detach ? ", detached" : ""));
+ (pcur->detach ? ", detached" : ""));
/*
* Clear the context's dictionary, execution and graphics stacks
* now, to retain as little as possible in case of a garbage
@@ -761,42 +760,42 @@ fork_done(i_ctx_t *i_ctx_p)
* result in an error termination.
*/
if (iimemory_local->save_level) {
- ref *prestore;
-
- if (dict_find_string(systemdict, "restore", &prestore) <= 0) {
- lprintf("restore not found in systemdict!");
- return_error(e_Fatal);
- }
- if (pcur->detach) {
- ref_stack_clear(&o_stack); /* help avoid invalidrestore */
- op = osp;
- }
- push(1);
- make_tv(op, t_save, saveid, alloc_save_current_id(&gs_imemory));
- push_op_estack(fork_done);
- ++esp;
- ref_assign(esp, prestore);
- return o_push_estack;
+ ref *prestore;
+
+ if (dict_find_string(systemdict, "restore", &prestore) <= 0) {
+ lprintf("restore not found in systemdict!");
+ return_error(e_Fatal);
+ }
+ if (pcur->detach) {
+ ref_stack_clear(&o_stack); /* help avoid invalidrestore */
+ op = osp;
+ }
+ push(1);
+ make_tv(op, t_save, saveid, alloc_save_current_id(&gs_imemory));
+ push_op_estack(fork_done);
+ ++esp;
+ ref_assign(esp, prestore);
+ return o_push_estack;
}
if (pcur->detach) {
- /*
- * We would like to free the context's memory, but we can't do
- * it yet, because the interpreter still has references to it.
- * Instead, queue the context to be freed the next time we
- * reschedule. We can, however, clear its operand stack now.
- */
- ref_stack_clear(&o_stack);
- context_store(psched, pcur);
- pcur->next_index = psched->dead_index;
- psched->dead_index = pcur->index;
- psched->current = 0;
+ /*
+ * We would like to free the context's memory, but we can't do
+ * it yet, because the interpreter still has references to it.
+ * Instead, queue the context to be freed the next time we
+ * reschedule. We can, however, clear its operand stack now.
+ */
+ ref_stack_clear(&o_stack);
+ context_store(psched, pcur);
+ pcur->next_index = psched->dead_index;
+ psched->dead_index = pcur->index;
+ psched->current = 0;
} else {
- gs_context_t *pctx = index_context(psched, pcur->joiner_index);
+ gs_context_t *pctx = index_context(psched, pcur->joiner_index);
- pcur->status = cs_done;
- /* Schedule the context waiting to join this one, if any. */
- if (pctx != 0)
- add_last(psched, &psched->active, pctx);
+ pcur->status = cs_done;
+ /* Schedule the context waiting to join this one, if any. */
+ if (pctx != 0)
+ add_last(psched, &psched->active, pctx);
}
return o_reschedule;
}
@@ -822,50 +821,50 @@ zjoin(i_ctx_t *i_ctx_p)
int code;
if ((code = context_param(psched, op, &pctx)) < 0)
- return code;
+ return code;
if_debug2('\'', "[']join %ld, status = %d\n",
- pctx->index, pctx->status);
+ pctx->index, pctx->status);
/*
* It doesn't seem logically necessary, but the Red Book says that
* the context being joined must share both global and local VM with
* the current context.
*/
if (pctx->joiner_index != 0 || pctx->detach || pctx == current ||
- pctx->state.memory.space_global !=
- current->state.memory.space_global ||
- pctx->state.memory.space_local !=
- current->state.memory.space_local ||
- iimemory_local->save_level != 0
- )
- return_error(e_invalidcontext);
+ pctx->state.memory.space_global !=
+ current->state.memory.space_global ||
+ pctx->state.memory.space_local !=
+ current->state.memory.space_local ||
+ iimemory_local->save_level != 0
+ )
+ return_error(e_invalidcontext);
switch (pctx->status) {
- case cs_active:
- /*
- * We need to re-execute the join after the joined
- * context is done. Since we can't return both
- * o_push_estack and o_reschedule, we push a call on
- * reschedule_now, which accomplishes the latter.
- */
- check_estack(2);
- push_op_estack(finish_join);
- push_op_estack(reschedule_now);
- pctx->joiner_index = current->index;
- return o_push_estack;
- case cs_done:
- {
- const ref_stack_t *ostack =
- (ref_stack_t *)&pctx->state.op_stack;
- uint count = ref_stack_count(ostack);
-
- push(count);
- {
- ref *rp = ref_stack_index(&o_stack, count);
-
- make_mark(rp);
- }
- stack_copy(&o_stack, ostack, count, 0);
- context_destroy(pctx);
- }
+ case cs_active:
+ /*
+ * We need to re-execute the join after the joined
+ * context is done. Since we can't return both
+ * o_push_estack and o_reschedule, we push a call on
+ * reschedule_now, which accomplishes the latter.
+ */
+ check_estack(2);
+ push_op_estack(finish_join);
+ push_op_estack(reschedule_now);
+ pctx->joiner_index = current->index;
+ return o_push_estack;
+ case cs_done:
+ {
+ const ref_stack_t *ostack =
+ (ref_stack_t *)&pctx->state.op_stack;
+ uint count = ref_stack_count(ostack);
+
+ push(count);
+ {
+ ref *rp = ref_stack_index(&o_stack, count);
+
+ make_mark(rp);
+ }
+ stack_copy(&o_stack, ostack, count, 0);
+ context_destroy(pctx);
+ }
}
return 0;
}
@@ -881,11 +880,11 @@ finish_join(i_ctx_t *i_ctx_p)
int code;
if ((code = context_param(psched, op, &pctx)) < 0)
- return code;
+ return code;
if_debug2('\'', "[']finish_join %ld, status = %d\n",
- pctx->index, pctx->status);
+ pctx->index, pctx->status);
if (pctx->joiner_index != current->index)
- return_error(e_invalidcontext);
+ return_error(e_invalidcontext);
pctx->joiner_index = 0;
return zjoin(i_ctx_p);
}
@@ -905,7 +904,7 @@ zyield(i_ctx_t *i_ctx_p)
gs_scheduler_t *psched = current->scheduler;
if (psched->active.head_index == 0)
- return 0;
+ return 0;
if_debug0('"', "[\"]yield\n");
add_last(psched, &psched->active, current);
return o_reschedule;
@@ -926,10 +925,10 @@ zcondition(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
gs_condition_t *pcond =
- ialloc_struct(gs_condition_t, &st_condition, "zcondition");
+ ialloc_struct(gs_condition_t, &st_condition, "zcondition");
if (pcond == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
pcond->waiting.head_index = pcond->waiting.tail_index = 0;
push(1);
make_istruct(op, a_all, pcond);
@@ -944,7 +943,7 @@ zlock(i_ctx_t *i_ctx_p)
gs_lock_t *plock = ialloc_struct(gs_lock_t, &st_lock, "zlock");
if (plock == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
plock->holder_index = 0;
plock->waiting.head_index = plock->waiting.tail_index = 0;
push(1);
@@ -968,12 +967,12 @@ zmonitor(i_ctx_t *i_ctx_p)
pctx = index_context(current->scheduler, plock->holder_index);
if_debug1('\'', "[']monitor 0x%lx\n", (ulong) plock);
if (pctx != 0) {
- if (pctx == current ||
- (iimemory_local->save_level != 0 &&
- pctx->state.memory.space_local ==
- current->state.memory.space_local)
- )
- return_error(e_invalidcontext);
+ if (pctx == current ||
+ (iimemory_local->save_level != 0 &&
+ pctx->state.memory.space_local ==
+ current->state.memory.space_local)
+ )
+ return_error(e_invalidcontext);
}
/*
* We push on the e-stack:
@@ -986,8 +985,8 @@ zmonitor(i_ctx_t *i_ctx_p)
check_estack(4);
code = lock_acquire(op - 1, current);
if (code != 0) { /* We didn't acquire the lock. Re-execute this later. */
- push_op_estack(zmonitor);
- return code; /* o_reschedule */
+ push_op_estack(zmonitor);
+ return code; /* o_reschedule */
}
*++esp = op[-1];
push_mark_estack(es_other, monitor_cleanup);
@@ -1003,7 +1002,7 @@ monitor_cleanup(i_ctx_t *i_ctx_p)
int code = lock_release(esp);
if (code < 0)
- return code;
+ return code;
--esp;
return o_pop_estack;
}
@@ -1014,7 +1013,7 @@ monitor_release(i_ctx_t *i_ctx_p)
int code = lock_release(esp - 1);
if (code < 0)
- return code;
+ return code;
esp -= 2;
return o_pop_estack;
}
@@ -1033,7 +1032,7 @@ znotify(i_ctx_t *i_ctx_p)
pop(1);
op--;
if (pcond->waiting.head_index == 0) /* nothing to do */
- return 0;
+ return 0;
activate_waiting(current->scheduler, &pcond->waiting);
return zyield(i_ctx_p);
}
@@ -1054,13 +1053,13 @@ zwait(i_ctx_t *i_ctx_p)
check_stype(*op, st_condition);
pcond = r_ptr(op, gs_condition_t);
if_debug2('"', "[\"]wait lock 0x%lx, condition 0x%lx\n",
- (ulong) plock, (ulong) pcond);
+ (ulong) plock, (ulong) pcond);
pctx = index_context(psched, plock->holder_index);
if (pctx == 0 || pctx != psched->current ||
- (iimemory_local->save_level != 0 &&
- (r_space(op - 1) == avm_local || r_space(op) == avm_local))
- )
- return_error(e_invalidcontext);
+ (iimemory_local->save_level != 0 &&
+ (r_space(op - 1) == avm_local || r_space(op) == avm_local))
+ )
+ return_error(e_invalidcontext);
check_estack(1);
lock_release(op - 1);
add_last(psched, &pcond->waiting, pctx);
@@ -1076,8 +1075,8 @@ await_lock(i_ctx_t *i_ctx_p)
int code = lock_acquire(op - 1, current);
if (code == 0) {
- pop(2);
- return 0;
+ pop(2);
+ return 0;
}
/* We didn't acquire the lock. Re-execute the wait. */
push_op_estack(await_lock);
@@ -1092,8 +1091,8 @@ activate_waiting(gs_scheduler_t *psched, ctx_list_t * pcl)
gs_context_t *next;
for (; pctx != 0; pctx = next) {
- next = index_context(psched, pctx->next_index);
- add_last(psched, &psched->active, pctx);
+ next = index_context(psched, pctx->next_index);
+ add_last(psched, &psched->active, pctx);
}
pcl->head_index = pcl->tail_index = 0;
}
@@ -1111,15 +1110,15 @@ zusertime_context(i_ctx_t *i_ctx_p)
push(1);
if (!current->state.keep_usertime) {
- /*
- * This is the first time this context has executed usertime:
- * we must track its execution time from now on.
- */
- psched->usertime_initial = utime;
- current->state.keep_usertime = true;
+ /*
+ * This is the first time this context has executed usertime:
+ * we must track its execution time from now on.
+ */
+ psched->usertime_initial = utime;
+ current->state.keep_usertime = true;
}
make_int(op, current->state.usertime_total + utime -
- psched->usertime_initial);
+ psched->usertime_initial);
return 0;
}
@@ -1128,8 +1127,8 @@ zusertime_context(i_ctx_t *i_ctx_p)
/* Create a context. */
static int
context_create(gs_scheduler_t * psched, gs_context_t ** ppctx,
- const gs_dual_memory_t * dmem,
- const gs_context_state_t *i_ctx_p, bool copy_state)
+ const gs_dual_memory_t * dmem,
+ const gs_context_state_t *i_ctx_p, bool copy_state)
{
/*
* Contexts are always created at the outermost save level, so they do
@@ -1147,17 +1146,17 @@ context_create(gs_scheduler_t * psched, gs_context_t ** ppctx,
pctx = gs_alloc_struct(mem, gs_context_t, &st_context, "context_create");
if (pctx == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (copy_state) {
- pctx->state = *i_ctx_p;
+ pctx->state = *i_ctx_p;
} else {
- gs_context_state_t *pctx_st = &pctx->state;
+ gs_context_state_t *pctx_st = &pctx->state;
- code = context_state_alloc(&pctx_st, systemdict, dmem);
- if (code < 0) {
- gs_free_object(mem, pctx, "context_create");
- return code;
- }
+ code = context_state_alloc(&pctx_st, systemdict, dmem);
+ if (code < 0) {
+ gs_free_object(mem, pctx, "context_create");
+ return code;
+ }
}
ctx_index = gs_next_ids(mem, 1);
pctx->scheduler = psched;
@@ -1173,7 +1172,7 @@ context_create(gs_scheduler_t * psched, gs_context_t ** ppctx,
*pte = pctx;
*ppctx = pctx;
if (gs_debug_c('\'') | gs_debug_c('"'))
- dlprintf2("[']create %ld at 0x%lx\n", ctx_index, (ulong) pctx);
+ dlprintf2("[']create %ld at 0x%lx\n", ctx_index, (ulong) pctx);
return 0;
}
@@ -1186,7 +1185,7 @@ context_param(const gs_scheduler_t * psched, os_ptr op, gs_context_t ** ppctx)
check_type(*op, t_integer);
pctx = index_context(psched, op->value.intval);
if (pctx == 0)
- return_error(e_invalidcontext);
+ return_error(e_invalidcontext);
*ppctx = pctx;
return 0;
}
@@ -1210,13 +1209,13 @@ context_destroy(gs_context_t * pctx)
gs_context_t **ppctx = &psched->table[pctx->index % CTX_TABLE_SIZE];
while (*ppctx != pctx)
- ppctx = &(*ppctx)->table_next;
+ ppctx = &(*ppctx)->table_next;
*ppctx = (*ppctx)->table_next;
if (gs_debug_c('\'') | gs_debug_c('"'))
- dlprintf3("[']destroy %ld at 0x%lx, status = %d\n",
- pctx->index, (ulong) pctx, pctx->status);
+ dlprintf3("[']destroy %ld at 0x%lx, status = %d\n",
+ pctx->index, (ulong) pctx, pctx->status);
if (!context_state_free(&pctx->state))
- gs_free_object((gs_memory_t *) mem, pctx, "context_destroy");
+ gs_free_object((gs_memory_t *) mem, pctx, "context_destroy");
}
/* Copy the top elements of one stack to another. */
@@ -1224,12 +1223,12 @@ context_destroy(gs_context_t * pctx)
/* the destination stack must have enough space preallocated. */
static void
stack_copy(ref_stack_t * to, const ref_stack_t * from, uint count,
- uint from_index)
+ uint from_index)
{
long i;
for (i = (long)count - 1; i >= 0; --i)
- *ref_stack_index(to, i) = *ref_stack_index(from, i + from_index);
+ *ref_stack_index(to, i) = *ref_stack_index(from, i + from_index);
}
/* Acquire a lock. Return 0 if acquired, o_reschedule if not. */
@@ -1239,9 +1238,9 @@ lock_acquire(os_ptr op, gs_context_t * pctx)
gs_lock_t *plock = r_ptr(op, gs_lock_t);
if (plock->holder_index == 0) {
- plock->holder_index = pctx->index;
- plock->scheduler = pctx->scheduler;
- return 0;
+ plock->holder_index = pctx->index;
+ plock->scheduler = pctx->scheduler;
+ return 0;
}
add_last(pctx->scheduler, &plock->waiting, pctx);
return o_reschedule;
@@ -1256,9 +1255,9 @@ lock_release(ref * op)
gs_context_t *pctx = index_context(psched, plock->holder_index);
if (pctx != 0 && pctx == psched->current) {
- plock->holder_index = 0;
- activate_waiting(psched, &plock->waiting);
- return 0;
+ plock->holder_index = 0;
+ activate_waiting(psched, &plock->waiting);
+ return 0;
}
return_error(e_invalidcontext);
}
@@ -1278,13 +1277,13 @@ const op_def zcontext1_op_defs[] = {
{"1notify", znotify},
{"2wait", zwait},
{"0yield", zyield},
- /* Note that the following replace prior definitions */
- /* in the indicated files: */
+ /* Note that the following replace prior definitions */
+ /* in the indicated files: */
{"0usertime", zusertime_context}, /* zmisc.c */
op_def_end(0)
};
const op_def zcontext2_op_defs[] = {
- /* Internal operators */
+ /* Internal operators */
{"0%fork_done", fork_done},
{"1%finish_join", finish_join},
{"0%monitor_cleanup", monitor_cleanup},
diff --git a/gs/psi/zcontrol.c b/gs/psi/zcontrol.c
index ecff36312..b85b88948 100644
--- a/gs/psi/zcontrol.c
+++ b/gs/psi/zcontrol.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,12 +43,12 @@ zcond(i_ctx_t *i_ctx_p)
/* Push the array on the e-stack and call the continuation. */
if (!r_is_array(op))
- return_op_typecheck(op);
+ return_op_typecheck(op);
check_execute(*op);
if ((r_size(op) & 1) != 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (r_size(op) == 0)
- return zpop(i_ctx_p);
+ return zpop(i_ctx_p);
check_estack(3);
esp = ep += 3;
ref_assign(ep - 2, op); /* the cond body */
@@ -72,24 +72,24 @@ cond_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_boolean);
if (op->value.boolval) { /* true */
array_get(imemory, ep, 1L, ep);
- esfile_check_cache();
- code = o_pop_estack;
+ esfile_check_cache();
+ code = o_pop_estack;
} else if (r_size(ep) > 2) { /* false */
- const ref_packed *elts = ep->value.packed;
-
- check_estack(2);
- r_dec_size(ep, 2);
- elts = packed_next(elts);
- elts = packed_next(elts);
- ep->value.packed = elts;
- array_get(imemory, ep, 0L, ep + 2);
- make_op_estack(ep + 1, cond_continue);
- esp = ep + 2;
- esfile_check_cache();
- code = o_push_estack;
+ const ref_packed *elts = ep->value.packed;
+
+ check_estack(2);
+ r_dec_size(ep, 2);
+ elts = packed_next(elts);
+ elts = packed_next(elts);
+ ep->value.packed = elts;
+ array_get(imemory, ep, 0L, ep + 2);
+ make_op_estack(ep + 1, cond_continue);
+ esp = ep + 2;
+ esfile_check_cache();
+ code = o_push_estack;
} else { /* fall off end of cond */
- esp = ep - 1;
- code = o_pop_estack;
+ esp = ep - 1;
+ code = o_pop_estack;
}
pop(1); /* get rid of the boolean */
return code;
@@ -105,10 +105,10 @@ zexec(i_ctx_t *i_ctx_p)
check_op(1);
code = check_for_exec(op);
if (code < 0) {
- return code;
+ return code;
}
if (!r_has_attr(op, a_executable)) {
- return 0; /* shortcut, literal object just gets pushed back */
+ return 0; /* shortcut, literal object just gets pushed back */
}
check_estack(1);
++esp;
@@ -132,23 +132,23 @@ zexecn(i_ctx_t *i_ctx_p)
check_estack(n);
esp_orig = esp;
for (i = 0; i < n; ++i) {
- const ref *rp = ref_stack_index(&o_stack, (long)(i + 1));
-
- /* Make sure this object is legal to execute. */
- if (ref_type_uses_access(r_type(rp))) {
- if (!r_has_attr(rp, a_execute) &&
- r_has_attr(rp, a_executable)
- ) {
- esp = esp_orig;
- return_error(e_invalidaccess);
- }
- }
- /* Executable nulls have a special meaning on the e-stack, */
- /* so since they are no-ops, don't push them. */
- if (!r_has_type_attrs(rp, t_null, a_executable)) {
- ++esp;
- ref_assign(esp, rp);
- }
+ const ref *rp = ref_stack_index(&o_stack, (long)(i + 1));
+
+ /* Make sure this object is legal to execute. */
+ if (ref_type_uses_access(r_type(rp))) {
+ if (!r_has_attr(rp, a_execute) &&
+ r_has_attr(rp, a_executable)
+ ) {
+ esp = esp_orig;
+ return_error(e_invalidaccess);
+ }
+ }
+ /* Executable nulls have a special meaning on the e-stack, */
+ /* so since they are no-ops, don't push them. */
+ if (!r_has_type_attrs(rp, t_null, a_executable)) {
+ ++esp;
+ ref_assign(esp, rp);
+ }
}
esfile_check_cache();
pop(n + 1);
@@ -165,7 +165,7 @@ zsuperexec(i_ctx_t *i_ctx_p)
check_op(1);
if (!r_has_attr(op, a_executable))
- return 0; /* literal object just gets pushed back */
+ return 0; /* literal object just gets pushed back */
check_estack(2);
ep = esp += 3;
make_mark_estack(ep - 2, es_other, end_superexec); /* error case */
@@ -200,9 +200,9 @@ zrunandhide(i_ctx_t *i_ctx_p)
check_op(2);
if (!r_is_array(op - 1))
- return_op_typecheck(op);
+ return_op_typecheck(op);
if (!r_has_attr(op, a_executable))
- return 0; /* literal object just gets pushed back */
+ return 0; /* literal object just gets pushed back */
check_estack(5);
ep = esp += 5;
make_mark_estack(ep - 4, es_other, err_end_runandhide); /* error case */
@@ -263,10 +263,10 @@ zif(i_ctx_t *i_ctx_p)
check_proc(*op);
check_type(op[-1], t_boolean);
if (op[-1].value.boolval) {
- check_estack(1);
- ++esp;
- ref_assign(esp, op);
- esfile_check_cache();
+ check_estack(1);
+ ++esp;
+ ref_assign(esp, op);
+ esfile_check_cache();
}
pop(2);
return o_push_estack;
@@ -284,9 +284,9 @@ zifelse(i_ctx_t *i_ctx_p)
check_estack(1);
++esp;
if (op[-2].value.boolval) {
- ref_assign(esp, op - 1);
+ ref_assign(esp, op - 1);
} else {
- ref_assign(esp, op);
+ ref_assign(esp, op);
}
esfile_check_cache();
pop(3);
@@ -306,14 +306,14 @@ zfor(i_ctx_t *i_ctx_p)
int code;
float params[3];
- /* Mostly undocumented, and somewhat bizarre Adobe behavior discovered */
- /* with the CET (28-05) and FTS (124-01) is that the proc is not run */
- /* if BOTH the initial value and increment are zero. */
+ /* Mostly undocumented, and somewhat bizarre Adobe behavior discovered */
+ /* with the CET (28-05) and FTS (124-01) is that the proc is not run */
+ /* if BOTH the initial value and increment are zero. */
if ((code = float_params(op - 1, 3, params)) < 0)
- return code;
+ return code;
if ( params[0] == 0.0 && params[1] == 0.0 ) {
- pop(4); /* don't run the proc */
- return 0;
+ pop(4); /* don't run the proc */
+ return 0;
}
check_estack(7);
ep = esp + 6;
@@ -322,29 +322,29 @@ zfor(i_ctx_t *i_ctx_p)
/* the increment, the limit, and the procedure, */
/* and invoke the continuation operator. */
if (r_has_type(op - 3, t_integer) &&
- r_has_type(op - 2, t_integer)
- ) {
- make_int(ep - 4, op[-3].value.intval);
- make_int(ep - 3, op[-2].value.intval);
- switch (r_type(op - 1)) {
- case t_integer:
- make_int(ep - 2, op[-1].value.intval);
- break;
- case t_real:
- make_int(ep - 2, (long)op[-1].value.realval);
- break;
- default:
- return_op_typecheck(op - 1);
- }
- if (ep[-3].value.intval >= 0)
- make_op_estack(ep, for_pos_int_continue);
- else
- make_op_estack(ep, for_neg_int_continue);
+ r_has_type(op - 2, t_integer)
+ ) {
+ make_int(ep - 4, op[-3].value.intval);
+ make_int(ep - 3, op[-2].value.intval);
+ switch (r_type(op - 1)) {
+ case t_integer:
+ make_int(ep - 2, op[-1].value.intval);
+ break;
+ case t_real:
+ make_int(ep - 2, (long)op[-1].value.realval);
+ break;
+ default:
+ return_op_typecheck(op - 1);
+ }
+ if (ep[-3].value.intval >= 0)
+ make_op_estack(ep, for_pos_int_continue);
+ else
+ make_op_estack(ep, for_neg_int_continue);
} else {
- make_real(ep - 4, params[0]);
- make_real(ep - 3, params[1]);
- make_real(ep - 2, params[2]);
- make_op_estack(ep, for_real_continue);
+ make_real(ep - 4, params[0]);
+ make_real(ep - 3, params[1]);
+ make_real(ep - 2, params[2]);
+ make_op_estack(ep, for_real_continue);
}
make_mark_estack(ep - 5, es_for, no_cleanup);
ref_assign(ep - 1, op);
@@ -365,8 +365,8 @@ for_pos_int_continue(i_ctx_t *i_ctx_p)
int var = ep[-3].value.intval;
if (var > ep[-1].value.intval) {
- esp -= 5; /* pop everything */
- return o_pop_estack;
+ esp -= 5; /* pop everything */
+ return o_pop_estack;
}
push(1);
make_int(op, var);
@@ -384,8 +384,8 @@ for_neg_int_continue(i_ctx_t *i_ctx_p)
int var = ep[-3].value.intval;
if (var < ep[-1].value.intval) {
- esp -= 5; /* pop everything */
- return o_pop_estack;
+ esp -= 5; /* pop everything */
+ return o_pop_estack;
}
push(1);
make_int(op, var);
@@ -404,10 +404,10 @@ for_real_continue(i_ctx_t *i_ctx_p)
float incr = ep[-2].value.realval;
if (incr >= 0 ? (var > ep[-1].value.realval) :
- (var < ep[-1].value.realval)
- ) {
- esp -= 5; /* pop everything */
- return o_pop_estack;
+ (var < ep[-1].value.realval)
+ ) {
+ esp -= 5; /* pop everything */
+ return o_pop_estack;
}
push(1);
ref_assign(op, ep - 3);
@@ -460,8 +460,8 @@ for_samples_continue(i_ctx_t *i_ctx_p)
float b = ep[-1].value.realval;
if (var > n) {
- esp -= 6; /* pop everything */
- return o_pop_estack;
+ esp -= 6; /* pop everything */
+ return o_pop_estack;
}
push(1);
make_real(op, ((n - var) * a + var * b) / n);
@@ -480,7 +480,7 @@ zrepeat(i_ctx_t *i_ctx_p)
check_proc(*op);
check_type(op[-1], t_integer);
if (op[-1].value.intval < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
check_estack(5);
/* Push a mark, the count, and the procedure, and invoke */
/* the continuation operator. */
@@ -498,12 +498,12 @@ repeat_continue(i_ctx_t *i_ctx_p)
es_ptr ep = esp; /* saved proc */
if (--(ep[-1].value.intval) >= 0) { /* continue */
- esp += 2;
- ref_assign(esp, ep);
- return o_push_estack;
+ esp += 2;
+ ref_assign(esp, ep);
+ return o_push_estack;
} else { /* done */
- esp -= 3; /* pop mark, count, proc */
- return o_pop_estack;
+ esp -= 3; /* pop mark, count, proc */
+ return o_pop_estack;
}
}
@@ -545,20 +545,20 @@ zexit(i_ctx_t *i_ctx_p)
ref_stack_enum_begin(&rsenum, &e_stack);
do {
- uint used = rsenum.size;
- es_ptr ep = rsenum.ptr + used - 1;
- uint count = used;
-
- for (; count; count--, ep--)
- if (r_is_estack_mark(ep))
- switch (estack_mark_index(ep)) {
- case es_for:
- pop_estack(i_ctx_p, scanned + (used - count + 1));
- return o_pop_estack;
- case es_stopped:
- return_error(e_invalidexit); /* not a loop */
- }
- scanned += used;
+ uint used = rsenum.size;
+ es_ptr ep = rsenum.ptr + used - 1;
+ uint count = used;
+
+ for (; count; count--, ep--)
+ if (r_is_estack_mark(ep))
+ switch (estack_mark_index(ep)) {
+ case es_for:
+ pop_estack(i_ctx_p, scanned + (used - count + 1));
+ return o_pop_estack;
+ case es_stopped:
+ return_error(e_invalidexit); /* not a loop */
+ }
+ scanned += used;
} while (ref_stack_enum_next(&rsenum));
/* No mark, quit. (per Adobe documentation) */
push(2);
@@ -597,17 +597,17 @@ zstop(i_ctx_t *i_ctx_p)
uint count = count_to_stopped(i_ctx_p, 1L);
if (count) {
- /*
- * If there are any t_oparrays on the e-stack, they will pop
- * any new items from the o-stack. Wait to push the 'true'
- * until we have run all the unwind procedures.
- */
- check_ostack(2);
- pop_estack(i_ctx_p, count);
- op = osp;
- push(1);
- make_true(op);
- return o_pop_estack;
+ /*
+ * If there are any t_oparrays on the e-stack, they will pop
+ * any new items from the o-stack. Wait to push the 'true'
+ * until we have run all the unwind procedures.
+ */
+ check_ostack(2);
+ pop_estack(i_ctx_p, count);
+ op = osp;
+ push(1);
+ make_true(op);
+ return o_pop_estack;
}
/* No mark, quit. (per Adobe documentation) */
push(2);
@@ -624,21 +624,21 @@ zzstop(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
count = count_to_stopped(i_ctx_p, op->value.intval);
if (count) {
- /*
- * If there are any t_oparrays on the e-stack, they will pop
- * any new items from the o-stack. Wait to push the result
- * until we have run all the unwind procedures.
- */
- ref save_result;
-
- check_op(2);
- save_result = op[-1];
- pop(2);
- pop_estack(i_ctx_p, count);
- op = osp;
- push(1);
- *op = save_result;
- return o_pop_estack;
+ /*
+ * If there are any t_oparrays on the e-stack, they will pop
+ * any new items from the o-stack. Wait to push the result
+ * until we have run all the unwind procedures.
+ */
+ ref save_result;
+
+ check_op(2);
+ save_result = op[-1];
+ pop(2);
+ pop_estack(i_ctx_p, count);
+ op = osp;
+ push(1);
+ *op = save_result;
+ return o_pop_estack;
}
/* No mark, quit. (per Adobe documentation) */
return unmatched_exit(op, zzstop);
@@ -697,11 +697,11 @@ zinstopped(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
count = count_to_stopped(i_ctx_p, op->value.intval);
if (count) {
- push(1);
- op[-1] = *ref_stack_index(&e_stack, count - 2); /* default result */
- make_true(op);
+ push(1);
+ op[-1] = *ref_stack_index(&e_stack, count - 2); /* default result */
+ make_true(op);
} else
- make_false(op);
+ make_false(op);
return 0;
}
@@ -734,7 +734,7 @@ static int execstack_continue(i_ctx_t *);
static int execstack2_continue(i_ctx_t *);
static int
push_execstack(i_ctx_t *i_ctx_p, os_ptr op1, bool include_marks,
- op_proc_t cont)
+ op_proc_t cont)
{
uint size;
/*
@@ -747,18 +747,18 @@ push_execstack(i_ctx_t *i_ctx_p, os_ptr op1, bool include_marks,
uint depth;
if (!r_is_array(op1))
- return_op_typecheck(op1);
+ return_op_typecheck(op1);
/* Check the length before the write access per CET 28-03 */
size = r_size(op1);
depth = count_exec_stack(i_ctx_p, include_marks);
if (depth > size)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
check_write(*op1);
{
- int code = ref_stack_store_check(&e_stack, op1, size, 0);
+ int code = ref_stack_store_check(&e_stack, op1, size, 0);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
check_estack(1);
r_set_size(op1, depth);
@@ -800,34 +800,34 @@ do_execstack(i_ctx_t *i_ctx_p, bool include_marks, os_ptr op1)
* probably be freed when unwinding) to something harmless.
*/
for (i = 0, rq = arefs + asize; rq != arefs; ++i) {
- const ref *rp = ref_stack_index(&e_stack, (long)i);
-
- if (r_has_type_attrs(rp, t_null, a_executable) && !include_marks)
- continue;
- --rq;
- ref_assign_old(op1, rq, rp, "execstack");
- switch (r_type(rq)) {
- case t_operator: {
- uint opidx = op_index(rq);
-
- if (opidx == 0 || op_def_is_internal(op_index_def(opidx)))
- r_clear_attrs(rq, a_executable);
- break;
- }
- case t_struct:
- case t_astruct: {
- const char *tname = rq->value.pstruct ?
- gs_struct_type_name_string(
- gs_object_type(imemory, rq->value.pstruct))
+ const ref *rp = ref_stack_index(&e_stack, (long)i);
+
+ if (r_has_type_attrs(rp, t_null, a_executable) && !include_marks)
+ continue;
+ --rq;
+ ref_assign_old(op1, rq, rp, "execstack");
+ switch (r_type(rq)) {
+ case t_operator: {
+ uint opidx = op_index(rq);
+
+ if (opidx == 0 || op_def_is_internal(op_index_def(opidx)))
+ r_clear_attrs(rq, a_executable);
+ break;
+ }
+ case t_struct:
+ case t_astruct: {
+ const char *tname = rq->value.pstruct ?
+ gs_struct_type_name_string(
+ gs_object_type(imemory, rq->value.pstruct))
: "NULL";
- make_const_string(rq, a_readonly | avm_foreign,
- strlen(tname), (const byte *)tname);
- break;
- }
- default:
- ;
- }
+ make_const_string(rq, a_readonly | avm_foreign,
+ strlen(tname), (const byte *)tname);
+ break;
+ }
+ default:
+ ;
+ }
}
pop(op - op1);
return 0;
@@ -877,23 +877,23 @@ zcurrentfile(i_ctx_t *i_ctx_p)
/* Check the cache first */
if (esfile != 0) {
#ifdef DEBUG
- /* Check that esfile is valid. */
- ref *efp = zget_current_file(i_ctx_p);
-
- if (esfile != efp) {
- lprintf2("currentfile: esfile=0x%lx, efp=0x%lx\n",
- (ulong) esfile, (ulong) efp);
- ref_assign(op, efp);
- } else
+ /* Check that esfile is valid. */
+ ref *efp = zget_current_file(i_ctx_p);
+
+ if (esfile != efp) {
+ lprintf2("currentfile: esfile=0x%lx, efp=0x%lx\n",
+ (ulong) esfile, (ulong) efp);
+ ref_assign(op, efp);
+ } else
#endif
- ref_assign(op, esfile);
+ ref_assign(op, esfile);
} else if ((fp = zget_current_file(i_ctx_p)) == 0) { /* Return an invalid file object. */
- /* This doesn't make a lot of sense to me, */
- /* but it's what the PostScript manual specifies. */
- make_invalid_file(i_ctx_p, op);
+ /* This doesn't make a lot of sense to me, */
+ /* but it's what the PostScript manual specifies. */
+ make_invalid_file(i_ctx_p, op);
} else {
- ref_assign(op, fp);
- esfile_set_cache(fp);
+ ref_assign(op, fp);
+ esfile_set_cache(fp);
}
/* Make the returned value literal. */
r_clear_attrs(op, a_executable);
@@ -907,12 +907,12 @@ zget_current_file(i_ctx_t *i_ctx_p)
ref_stack_enum_begin(&rsenum, &e_stack);
do {
- uint count = rsenum.size;
- es_ptr ep = rsenum.ptr + count - 1;
+ uint count = rsenum.size;
+ es_ptr ep = rsenum.ptr + count - 1;
- for (; count; count--, ep--)
- if (r_has_type_attrs(ep, t_file, a_executable))
- return ep;
+ for (; count; count--, ep--)
+ if (r_has_type_attrs(ep, t_file, a_executable))
+ return ep;
} while (ref_stack_enum_next(&rsenum));
return 0;
}
@@ -948,7 +948,7 @@ const op_def zcontrol2_op_defs[] = {
op_def_end(0)
};
const op_def zcontrol3_op_defs[] = {
- /* Internal operators */
+ /* Internal operators */
{"1%cond_continue", cond_continue},
{"1%execstack_continue", execstack_continue},
{"2%execstack2_continue", execstack2_continue},
@@ -982,10 +982,10 @@ static bool
check_for_exec(const_os_ptr op)
{
if (!r_has_attr(op, a_execute) && /* only true if noaccess */
- ref_type_uses_access(r_type(op)) &&
- (r_has_attr(op, a_executable) || !r_has_type(op, t_dictionary))
- ) {
- return_error(e_invalidaccess);
+ ref_type_uses_access(r_type(op)) &&
+ (r_has_attr(op, a_executable) || !r_has_type(op, t_dictionary))
+ ) {
+ return_error(e_invalidaccess);
}
return 0;
}
@@ -1007,12 +1007,12 @@ count_exec_stack(i_ctx_t *i_ctx_p, bool include_marks)
uint count = ref_stack_count(&e_stack);
if (!include_marks) {
- uint i;
+ uint i;
- for (i = count; i--;)
- if (r_has_type_attrs(ref_stack_index(&e_stack, (long)i),
- t_null, a_executable))
- --count;
+ for (i = count; i--;)
+ if (r_has_type_attrs(ref_stack_index(&e_stack, (long)i),
+ t_null, a_executable))
+ --count;
}
return count;
}
@@ -1030,18 +1030,18 @@ count_to_stopped(i_ctx_t *i_ctx_p, long mask)
ref_stack_enum_begin(&rsenum, &e_stack);
do {
- uint used = rsenum.size;
- es_ptr ep = rsenum.ptr + used - 1;
- uint count = used;
-
- for (; count; count--, ep--) {
- if (r_is_estack_mark(ep)) {
- if (estack_mark_index(ep) == es_stopped &&
- (ep[2].value.intval & mask) != 0)
- return scanned + (used - count + 1);
- }
- }
- scanned += used;
+ uint used = rsenum.size;
+ es_ptr ep = rsenum.ptr + used - 1;
+ uint count = used;
+
+ for (; count; count--, ep--) {
+ if (r_is_estack_mark(ep)) {
+ if (estack_mark_index(ep) == es_stopped &&
+ (ep[2].value.intval & mask) != 0)
+ return scanned + (used - count + 1);
+ }
+ }
+ scanned += used;
} while (ref_stack_enum_next(&rsenum));
return 0;
}
@@ -1059,13 +1059,13 @@ pop_estack(i_ctx_t *i_ctx_p, uint count)
esfile_clear_cache();
for (; idx < count; idx++) {
- ref *ep = ref_stack_index(&e_stack, idx - popped);
+ ref *ep = ref_stack_index(&e_stack, idx - popped);
- if (r_is_estack_mark(ep)) {
- ref_stack_pop(&e_stack, idx + 1 - popped);
- popped = idx + 1;
- (*real_opproc(ep)) (i_ctx_p);
- }
+ if (r_is_estack_mark(ep)) {
+ ref_stack_pop(&e_stack, idx + 1 - popped);
+ popped = idx + 1;
+ (*real_opproc(ep)) (i_ctx_p);
+ }
}
ref_stack_pop(&e_stack, count - popped);
}
diff --git a/gs/psi/zcrd.c b/gs/psi/zcrd.c
index bba9ffbdb..1288631bf 100644
--- a/gs/psi/zcrd.c
+++ b/gs/psi/zcrd.c
@@ -34,10 +34,10 @@
/* Forward references */
static int zcrd1_proc_params(const gs_memory_t *mem, os_ptr op, ref_cie_render_procs * pcprocs);
static int zcrd1_params(os_ptr op, gs_cie_render * pcrd,
- ref_cie_render_procs * pcprocs, gs_memory_t * mem);
+ ref_cie_render_procs * pcprocs, gs_memory_t * mem);
static int cache_colorrendering1(i_ctx_t *i_ctx_p, gs_cie_render * pcrd,
- const ref_cie_render_procs * pcprocs,
- gs_ref_memory_t * imem);
+ const ref_cie_render_procs * pcprocs,
+ gs_ref_memory_t * imem);
/* - currentcolorrendering <dict> */
static int
@@ -65,15 +65,15 @@ zbuildcolorrendering1(i_ctx_t *i_ctx_p)
check_dict_read(*op);
code = gs_cie_render1_build(&pcrd, mem, ".buildcolorrendering1");
if (code < 0)
- return code;
+ return code;
code = zcrd1_params(op, pcrd, &procs, mem);
if (code < 0 ||
(code = cache_colorrendering1(i_ctx_p, pcrd, &procs,
- (gs_ref_memory_t *) mem)) < 0
- ) {
- rc_free_struct(pcrd, ".buildcolorrendering1");
- esp = ep;
- return code;
+ (gs_ref_memory_t *) mem)) < 0
+ ) {
+ rc_free_struct(pcrd, ".buildcolorrendering1");
+ esp = ep;
+ return code;
}
/****** FIX refct ******/
/*rc_decrement(pcrd, ".buildcolorrendering1"); *//* build sets rc = 1 */
@@ -95,20 +95,20 @@ zbuilddevicecolorrendering1(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = dict_param_list_read(&list, op, NULL, false, iimemory);
if (code < 0)
- return code;
+ return code;
code = gs_cie_render1_build(&pcrd, mem, ".builddevicecolorrendering1");
if (code >= 0) {
- code = param_get_cie_render1(pcrd, (gs_param_list *) & list,
- gs_currentdevice(igs));
- if (code >= 0) {
- /****** FIX refct ******/
- /*rc_decrement(pcrd, ".builddevicecolorrendering1"); *//* build sets rc = 1 */
- }
+ code = param_get_cie_render1(pcrd, (gs_param_list *) & list,
+ gs_currentdevice(igs));
+ if (code >= 0) {
+ /****** FIX refct ******/
+ /*rc_decrement(pcrd, ".builddevicecolorrendering1"); *//* build sets rc = 1 */
+ }
}
iparam_list_release(&list);
if (code < 0) {
- rc_free_struct(pcrd, ".builddevicecolorrendering1");
- return code;
+ rc_free_struct(pcrd, ".builddevicecolorrendering1");
+ return code;
}
istate->colorrendering.dict = *op;
make_istruct_new(op, a_readonly, pcrd);
@@ -128,14 +128,14 @@ zsetcolorrendering1(i_ctx_t *i_ctx_p)
check_stype(*op, st_cie_render1);
code = zcrd1_proc_params(imemory, op - 1, &procs);
if (code < 0)
- return code;
+ return code;
code = gs_setcolorrendering(igs, r_ptr(op, gs_cie_render));
if (code < 0)
- return code;
+ return code;
if (gs_cie_cs_common(igs) != 0 &&
- (code = cie_cache_joint(i_ctx_p, &procs, gs_cie_cs_common(igs), igs)) < 0
- )
- return code;
+ (code = cie_cache_joint(i_ctx_p, &procs, gs_cie_cs_common(igs), igs)) < 0
+ )
+ return code;
istate->colorrendering.dict = op[-1];
istate->colorrendering.procs = procs;
pop(2);
@@ -154,15 +154,15 @@ zsetdevicecolorrendering1(i_ctx_t *i_ctx_p)
check_stype(*op, st_cie_render1);
code = gs_setcolorrendering(igs, r_ptr(op, gs_cie_render));
if (code < 0)
- return code;
+ return code;
refset_null((ref *)&procs, sizeof(procs) / sizeof(ref));
if (gs_cie_cs_common(igs) != 0 &&
- (code = cie_cache_joint(i_ctx_p, &procs, gs_cie_cs_common(igs), igs)) < 0
- )
- return code;
+ (code = cie_cache_joint(i_ctx_p, &procs, gs_cie_cs_common(igs), igs)) < 0
+ )
+ return code;
istate->colorrendering.dict = op[-1];
refset_null((ref *)&istate->colorrendering.procs,
- sizeof(istate->colorrendering.procs) / sizeof(ref));
+ sizeof(istate->colorrendering.procs) / sizeof(ref));
pop(2);
return 0;
}
@@ -170,7 +170,7 @@ zsetdevicecolorrendering1(i_ctx_t *i_ctx_p)
/* Get ColorRenderingType 1 procedures from the PostScript dictionary. */
static int
zcrd1_proc_params(const gs_memory_t *mem,
- os_ptr op, ref_cie_render_procs * pcprocs)
+ os_ptr op, ref_cie_render_procs * pcprocs)
{
int code;
ref *pRT;
@@ -185,30 +185,30 @@ zcrd1_proc_params(const gs_memory_t *mem,
if (code < 0)
return code;
if (code == 1)
- return gs_note_error(e_undefined);
+ return gs_note_error(e_undefined);
if (dict_find_string(op, "RenderTable", &pRT) > 0) {
- const ref *prte;
- int size;
- int i;
-
- check_read_type(*pRT, t_array);
- size = r_size(pRT);
- if (size < 5)
- return_error(e_rangecheck);
- prte = pRT->value.const_refs;
- for (i = 5; i < size; i++)
- check_proc_only(prte[i]);
- make_const_array(&pcprocs->RenderTableT, a_readonly | r_space(pRT),
- size - 5, prte + 5);
+ const ref *prte;
+ int size;
+ int i;
+
+ check_read_type(*pRT, t_array);
+ size = r_size(pRT);
+ if (size < 5)
+ return_error(e_rangecheck);
+ prte = pRT->value.const_refs;
+ for (i = 5; i < size; i++)
+ check_proc_only(prte[i]);
+ make_const_array(&pcprocs->RenderTableT, a_readonly | r_space(pRT),
+ size - 5, prte + 5);
} else
- make_null(&pcprocs->RenderTableT);
+ make_null(&pcprocs->RenderTableT);
return 0;
}
/* Get ColorRenderingType 1 parameters from the PostScript dictionary. */
static int
zcrd1_params(os_ptr op, gs_cie_render * pcrd,
- ref_cie_render_procs * pcprocs, gs_memory_t * mem)
+ ref_cie_render_procs * pcprocs, gs_memory_t * mem)
{
int code;
int ignore;
@@ -216,32 +216,32 @@ zcrd1_params(os_ptr op, gs_cie_render * pcrd,
ref *pRT;
if ((code = dict_int_param(op, "ColorRenderingType", 1, 1, 0, &ignore)) < 0 ||
- (code = zcrd1_proc_params(mem, op, pcprocs)) < 0 ||
- (code = dict_matrix3_param(mem, op, "MatrixLMN", &pcrd->MatrixLMN)) < 0 ||
- (code = dict_range3_param(mem, op, "RangeLMN", &pcrd->RangeLMN)) < 0 ||
- (code = dict_matrix3_param(mem, op, "MatrixABC", &pcrd->MatrixABC)) < 0 ||
- (code = dict_range3_param(mem, op, "RangeABC", &pcrd->RangeABC)) < 0 ||
- (code = cie_points_param(mem, op, &pcrd->points)) < 0 ||
- (code = dict_matrix3_param(mem, op, "MatrixPQR", &pcrd->MatrixPQR)) < 0 ||
- (code = dict_range3_param(mem,op, "RangePQR", &pcrd->RangePQR)) < 0
- )
- return code;
+ (code = zcrd1_proc_params(mem, op, pcprocs)) < 0 ||
+ (code = dict_matrix3_param(mem, op, "MatrixLMN", &pcrd->MatrixLMN)) < 0 ||
+ (code = dict_range3_param(mem, op, "RangeLMN", &pcrd->RangeLMN)) < 0 ||
+ (code = dict_matrix3_param(mem, op, "MatrixABC", &pcrd->MatrixABC)) < 0 ||
+ (code = dict_range3_param(mem, op, "RangeABC", &pcrd->RangeABC)) < 0 ||
+ (code = cie_points_param(mem, op, &pcrd->points)) < 0 ||
+ (code = dict_matrix3_param(mem, op, "MatrixPQR", &pcrd->MatrixPQR)) < 0 ||
+ (code = dict_range3_param(mem,op, "RangePQR", &pcrd->RangePQR)) < 0
+ )
+ return code;
if (dict_find_string(op, "RenderTable", &pRT) > 0) {
- const ref *prte = pRT->value.const_refs;
-
- /* Finish unpacking and checking the RenderTable parameter. */
- check_type_only(prte[4], t_integer);
- if (!(prte[4].value.intval == 3 || prte[4].value.intval == 4))
- return_error(e_rangecheck);
- prtl->n = 3;
- prtl->m = prte[4].value.intval;
- if (r_size(pRT) != prtl->m + 5)
- return_error(e_rangecheck);
- code = cie_table_param(pRT, prtl, mem);
- if (code < 0)
- return code;
+ const ref *prte = pRT->value.const_refs;
+
+ /* Finish unpacking and checking the RenderTable parameter. */
+ check_type_only(prte[4], t_integer);
+ if (!(prte[4].value.intval == 3 || prte[4].value.intval == 4))
+ return_error(e_rangecheck);
+ prtl->n = 3;
+ prtl->m = prte[4].value.intval;
+ if (r_size(pRT) != prtl->m + 5)
+ return_error(e_rangecheck);
+ code = cie_table_param(pRT, prtl, mem);
+ if (code < 0)
+ return code;
} else {
- prtl->table = 0;
+ prtl->table = 0;
}
pcrd->EncodeLMN = Encode_default;
pcrd->EncodeABC = Encode_default;
@@ -254,41 +254,41 @@ zcrd1_params(os_ptr op, gs_cie_render * pcrd,
static int cie_cache_render_finish(i_ctx_t *);
static int
cache_colorrendering1(i_ctx_t *i_ctx_p, gs_cie_render * pcrd,
- const ref_cie_render_procs * pcrprocs,
- gs_ref_memory_t * imem)
+ const ref_cie_render_procs * pcrprocs,
+ gs_ref_memory_t * imem)
{
es_ptr ep = esp;
int code = gs_cie_render_init(pcrd); /* sets Domain values */
int i;
if (code < 0 ||
- (code = cie_cache_push_finish(i_ctx_p, cie_cache_render_finish, imem, pcrd)) < 0 ||
- (code = cie_prepare_cache3(i_ctx_p, &pcrd->DomainLMN, pcrprocs->EncodeLMN.value.const_refs, pcrd->caches.EncodeLMN.caches, pcrd, imem, "Encode.LMN")) < 0 ||
- (code = cie_prepare_cache3(i_ctx_p, &pcrd->DomainABC, pcrprocs->EncodeABC.value.const_refs, &pcrd->caches.EncodeABC[0], pcrd, imem, "Encode.ABC")) < 0
- ) {
- esp = ep;
- return code;
+ (code = cie_cache_push_finish(i_ctx_p, cie_cache_render_finish, imem, pcrd)) < 0 ||
+ (code = cie_prepare_cache3(i_ctx_p, &pcrd->DomainLMN, pcrprocs->EncodeLMN.value.const_refs, pcrd->caches.EncodeLMN.caches, pcrd, imem, "Encode.LMN")) < 0 ||
+ (code = cie_prepare_cache3(i_ctx_p, &pcrd->DomainABC, pcrprocs->EncodeABC.value.const_refs, &pcrd->caches.EncodeABC[0], pcrd, imem, "Encode.ABC")) < 0
+ ) {
+ esp = ep;
+ return code;
}
if (pcrd->RenderTable.lookup.table != 0) {
- bool is_identity = true;
-
- for (i = 0; i < pcrd->RenderTable.lookup.m; i++)
- if (r_size(pcrprocs->RenderTableT.value.const_refs + i) != 0) {
- is_identity = false;
- break;
- }
- pcrd->caches.RenderTableT_is_identity = is_identity;
- if (!is_identity)
- for (i = 0; i < pcrd->RenderTable.lookup.m; i++)
- if ((code =
- cie_prepare_cache(i_ctx_p, Range4_default.ranges,
- pcrprocs->RenderTableT.value.const_refs + i,
- &pcrd->caches.RenderTableT[i].floats,
- pcrd, imem, "RenderTable.T")) < 0
- ) {
- esp = ep;
- return code;
- }
+ bool is_identity = true;
+
+ for (i = 0; i < pcrd->RenderTable.lookup.m; i++)
+ if (r_size(pcrprocs->RenderTableT.value.const_refs + i) != 0) {
+ is_identity = false;
+ break;
+ }
+ pcrd->caches.RenderTableT_is_identity = is_identity;
+ if (!is_identity)
+ for (i = 0; i < pcrd->RenderTable.lookup.m; i++)
+ if ((code =
+ cie_prepare_cache(i_ctx_p, Range4_default.ranges,
+ pcrprocs->RenderTableT.value.const_refs + i,
+ &pcrd->caches.RenderTableT[i].floats,
+ pcrd, imem, "RenderTable.T")) < 0
+ ) {
+ esp = ep;
+ return code;
+ }
}
return o_push_estack;
}
@@ -302,14 +302,14 @@ cie_cache_render_finish(i_ctx_t *i_ctx_p)
int code;
if (pcrd->RenderTable.lookup.table != 0 &&
- !pcrd->caches.RenderTableT_is_identity
- ) {
- /* Convert the RenderTableT cache from floats to fracs. */
- int j;
-
- for (j = 0; j < pcrd->RenderTable.lookup.m; j++)
- gs_cie_cache_to_fracs(&pcrd->caches.RenderTableT[j].floats,
- &pcrd->caches.RenderTableT[j].fracs);
+ !pcrd->caches.RenderTableT_is_identity
+ ) {
+ /* Convert the RenderTableT cache from floats to fracs. */
+ int j;
+
+ for (j = 0; j < pcrd->RenderTable.lookup.m; j++)
+ gs_cie_cache_to_fracs(&pcrd->caches.RenderTableT[j].floats,
+ &pcrd->caches.RenderTableT[j].fracs);
}
pcrd->status = CIE_RENDER_STATUS_SAMPLED;
pcrd->EncodeLMN = EncodeLMN_from_cache;
@@ -317,7 +317,7 @@ cie_cache_render_finish(i_ctx_t *i_ctx_p)
pcrd->RenderTable.T = RenderTableT_from_cache;
code = gs_cie_render_complete(pcrd);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -331,7 +331,7 @@ static int
cie_tpqr_finish(i_ctx_t *);
int
cie_cache_joint(i_ctx_t *i_ctx_p, const ref_cie_render_procs * pcrprocs,
- const gs_cie_common *pcie, gs_state * pgs)
+ const gs_cie_common *pcie, gs_state * pgs)
{
const gs_cie_render *pcrd = gs_currentcolorrendering(pgs);
gx_cie_joint_caches *pjc = gx_unshare_cie_caches(pgs);
@@ -342,44 +342,44 @@ cie_cache_joint(i_ctx_t *i_ctx_p, const ref_cie_render_procs * pcrprocs,
int i;
if (pcrd == 0) /* cache is not set up yet */
- return 0;
+ return 0;
if (pjc == 0) /* must already be allocated */
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (r_has_type(&pcrprocs->TransformPQR, t_null)) {
- /*
- * This CRD came from a driver, not from a PostScript dictionary.
- * Resample TransformPQR in C code.
- */
- return gs_cie_cs_complete(pgs, true);
+ /*
+ * This CRD came from a driver, not from a PostScript dictionary.
+ * Resample TransformPQR in C code.
+ */
+ return gs_cie_cs_complete(pgs, true);
}
gs_cie_compute_points_sd(pjc, pcie, pcrd);
code = ialloc_ref_array(&pqr_procs, a_readonly, 3 * (1 + 4 + 4 * 6),
- "cie_cache_common");
+ "cie_cache_common");
if (code < 0)
- return code;
+ return code;
/* When we're done, deallocate the procs and complete the caches. */
check_estack(3);
cie_cache_push_finish(i_ctx_p, cie_tpqr_finish, imem, pgs);
*++esp = pqr_procs;
space = r_space(&pqr_procs);
for (i = 0; i < 3; i++) {
- ref *p = pqr_procs.value.refs + 3 + (4 + 4 * 6) * i;
- const float *ppt = (float *)&pjc->points_sd;
- int j;
-
- make_array(pqr_procs.value.refs + i, a_readonly | a_executable | space,
- 4, p);
- make_array(p, a_readonly | space, 4 * 6, p + 4);
- p[1] = pcrprocs->TransformPQR.value.refs[i];
- make_oper(p + 2, 0, cie_exec_tpqr);
- make_oper(p + 3, 0, cie_post_exec_tpqr);
- for (j = 0, p += 4; j < 4 * 6; j++, p++, ppt++)
- make_real(p, *ppt);
+ ref *p = pqr_procs.value.refs + 3 + (4 + 4 * 6) * i;
+ const float *ppt = (float *)&pjc->points_sd;
+ int j;
+
+ make_array(pqr_procs.value.refs + i, a_readonly | a_executable | space,
+ 4, p);
+ make_array(p, a_readonly | space, 4 * 6, p + 4);
+ p[1] = pcrprocs->TransformPQR.value.refs[i];
+ make_oper(p + 2, 0, cie_exec_tpqr);
+ make_oper(p + 3, 0, cie_post_exec_tpqr);
+ for (j = 0, p += 4; j < 4 * 6; j++, p++, ppt++)
+ make_real(p, *ppt);
}
return cie_prepare_cache3(i_ctx_p, &pcrd->RangePQR,
- pqr_procs.value.const_refs,
- pjc->TransformPQR.caches,
- pjc, imem, "Transform.PQR");
+ pqr_procs.value.const_refs,
+ pjc->TransformPQR.caches,
+ pjc, imem, "Transform.PQR");
}
/* Private operator to shuffle arguments for the TransformPQR procedure: */
@@ -397,8 +397,8 @@ cie_exec_tpqr(i_ctx_t *i_ctx_p)
*op = op[-4]; /* proc */
op[-1] = op[-6]; /* v */
for (i = 0; i < 4; i++)
- make_const_array(op - 5 + i, a_readonly | space,
- 6, ppt + i * 6);
+ make_const_array(op - 5 + i, a_readonly | space,
+ 6, ppt + i * 6);
make_mark(op - 6);
return zexec(i_ctx_p);
}
@@ -413,7 +413,7 @@ cie_post_exec_tpqr(i_ctx_t *i_ctx_p)
ref vref;
if (count < 2)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
vref = *op;
ref_stack_pop(&o_stack, count - 1);
*osp = vref;
@@ -427,7 +427,7 @@ cie_tpqr_finish(i_ctx_t *i_ctx_p)
os_ptr op = osp;
gs_state *pgs = r_ptr(op, gs_state);
gs_cie_render *pcrd =
- (gs_cie_render *)gs_currentcolorrendering(pgs); /* break const */
+ (gs_cie_render *)gs_currentcolorrendering(pgs); /* break const */
int code;
ifree_ref_array(op - 1, "cie_tpqr_finish");
@@ -458,16 +458,16 @@ ztpqr_scale_wb_common(i_ctx_t *i_ctx_p, int idx)
if (code < 0) return code;
for (i = 0; i < 4; i++) {
- ref tmp;
+ ref tmp;
- code = array_get(imemory, op - 4 + i, idx, &tmp);
- if (code >= 0)
- code = real_param(&tmp, &a[i]);
- if (code < 0) return code;
+ code = array_get(imemory, op - 4 + i, idx, &tmp);
+ if (code >= 0)
+ code = real_param(&tmp, &a[i]);
+ if (code < 0) return code;
}
if (a[0] == a[1])
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
result = a[3] + (a[2] - a[3]) * (Ps - a[1]) / (a[0] - a[1]);
make_real(op - 4, result);
pop(4);
@@ -505,7 +505,7 @@ const op_def zcrd_l2_op_defs[] =
{"2.setdevicecolorrendering1", zsetdevicecolorrendering1},
{"1.buildcolorrendering1", zbuildcolorrendering1},
{"1.builddevicecolorrendering1", zbuilddevicecolorrendering1},
- /* Internal "operators" */
+ /* Internal "operators" */
{"1%cie_render_finish", cie_cache_render_finish},
{"3%cie_exec_tpqr", cie_exec_tpqr},
{"2%cie_post_exec_tpqr", cie_post_exec_tpqr},
diff --git a/gs/psi/zcsdevn.c b/gs/psi/zcsdevn.c
index 012f4bb08..28d7f0af8 100644
--- a/gs/psi/zcsdevn.c
+++ b/gs/psi/zcsdevn.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zcsindex.c b/gs/psi/zcsindex.c
index 2b8f6d9b7..516c3e342 100644
--- a/gs/psi/zcsindex.c
+++ b/gs/psi/zcsindex.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,14 +29,13 @@
#include "ivmspace.h"
#include "store.h"
-
/* ------ Internal routines ------ */
/* Allocate, and prepare to load, the index or tint map. */
int
zcs_begin_map(i_ctx_t *i_ctx_p, gs_indexed_map ** pmap, const ref * pproc,
- int num_entries, const gs_color_space * base_space,
- op_proc_t map1)
+ int num_entries, const gs_color_space * base_space,
+ op_proc_t map1)
{
gs_memory_t *mem = gs_state_memory(igs);
int space = imemory_space((gs_ref_memory_t *)mem);
@@ -44,11 +43,11 @@ zcs_begin_map(i_ctx_t *i_ctx_p, gs_indexed_map ** pmap, const ref * pproc,
int num_values = num_entries * num_components;
gs_indexed_map *map;
int code = alloc_indexed_map(&map, num_values, mem,
- "setcolorspace(mapped)");
+ "setcolorspace(mapped)");
es_ptr ep;
if (code < 0)
- return code;
+ return code;
*pmap = map;
/* Map the entire set of color indices. Since the */
/* o-stack may not be able to hold N*4096 values, we have */
diff --git a/gs/psi/zcspixel.c b/gs/psi/zcspixel.c
index ef4584306..8676f33c9 100644
--- a/gs/psi/zcspixel.c
+++ b/gs/psi/zcspixel.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,4 +21,3 @@
#include "gscolor2.h"
#include "gscpixel.h"
#include "ialloc.h"
-
diff --git a/gs/psi/zcssepr.c b/gs/psi/zcssepr.c
index de0454dc1..65479b145 100644
--- a/gs/psi/zcssepr.c
+++ b/gs/psi/zcssepr.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -91,7 +91,7 @@ zsetoverprintmode(i_ctx_t *i_ctx_p)
int code = int_param(op, max_int, &param);
if (code < 0 || (code = gs_setoverprintmode(igs, param)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
diff --git a/gs/psi/zdevcal.c b/gs/psi/zdevcal.c
index 1ec6fb195..88e16413f 100644
--- a/gs/psi/zdevcal.c
+++ b/gs/psi/zdevcal.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,28 +41,28 @@ calendar_get_params(gx_io_device * iodev, gs_param_list * plist)
struct tm *pltime;
struct tm ltime;
static const gs_param_item_t items[] = {
- {"Year", gs_param_type_int, offset_of(struct tm, tm_year)},
- {"Month", gs_param_type_int, offset_of(struct tm, tm_mon)},
- {"Day", gs_param_type_int, offset_of(struct tm, tm_mday)},
- {"Weekday", gs_param_type_int, offset_of(struct tm, tm_wday)},
- {"Hour", gs_param_type_int, offset_of(struct tm, tm_hour)},
- {"Minute", gs_param_type_int, offset_of(struct tm, tm_min)},
- {"Second", gs_param_type_int, offset_of(struct tm, tm_sec)},
- gs_param_item_end
+ {"Year", gs_param_type_int, offset_of(struct tm, tm_year)},
+ {"Month", gs_param_type_int, offset_of(struct tm, tm_mon)},
+ {"Day", gs_param_type_int, offset_of(struct tm, tm_mday)},
+ {"Weekday", gs_param_type_int, offset_of(struct tm, tm_wday)},
+ {"Hour", gs_param_type_int, offset_of(struct tm, tm_hour)},
+ {"Minute", gs_param_type_int, offset_of(struct tm, tm_min)},
+ {"Second", gs_param_type_int, offset_of(struct tm, tm_sec)},
+ gs_param_item_end
};
bool running;
if (time(&t) == (time_t)-1 || (pltime = localtime(&t)) == 0) {
- ltime.tm_sec = ltime.tm_min = ltime.tm_hour =
- ltime.tm_mday = ltime.tm_mon = ltime.tm_year = 0;
- running = false;
+ ltime.tm_sec = ltime.tm_min = ltime.tm_hour =
+ ltime.tm_mday = ltime.tm_mon = ltime.tm_year = 0;
+ running = false;
} else {
- ltime = *pltime;
- ltime.tm_year += 1900;
- ltime.tm_mon++; /* 1-origin */
- running = true;
+ ltime = *pltime;
+ ltime.tm_year += 1900;
+ ltime.tm_mon++; /* 1-origin */
+ running = true;
}
if ((code = gs_param_write_items(plist, &ltime, NULL, items)) < 0)
- return code;
+ return code;
return param_write_bool(plist, "Running", &running);
}
diff --git a/gs/psi/zdevice.c b/gs/psi/zdevice.c
index d671d624a..8adeee436 100644
--- a/gs/psi/zdevice.c
+++ b/gs/psi/zdevice.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,9 +44,9 @@ zcopydevice2(i_ctx_t *i_ctx_p)
check_read_type(op[-1], t_device);
check_type(*op, t_boolean);
code = gs_copydevice2(&new_dev, op[-1].value.pdevice, op->value.boolval,
- imemory);
+ imemory);
if (code < 0)
- return code;
+ return code;
new_dev->memory = imemory;
make_tav(op - 1, t_device, icurrent_space | a_all, pdevice, new_dev);
pop(1);
@@ -63,8 +63,8 @@ zcurrentdevice(i_ctx_t *i_ctx_p)
push(1);
make_tav(op, t_device,
- (mem == 0 ? avm_foreign : imemory_space(mem)) | a_all,
- pdevice, dev);
+ (mem == 0 ? avm_foreign : imemory_space(mem)) | a_all,
+ pdevice, dev);
return 0;
}
@@ -78,7 +78,7 @@ zdevicename(i_ctx_t *i_ctx_p)
check_read_type(*op, t_device);
dname = op->value.pdevice->dname;
make_const_string(op, avm_foreign | a_readonly, strlen(dname),
- (const byte *)dname);
+ (const byte *)dname);
return 0;
}
@@ -90,7 +90,7 @@ zdoneshowpage(i_ctx_t *i_ctx_p)
gx_device *tdev = (*dev_proc(dev, get_page_device)) (dev);
if (tdev != 0)
- tdev->ShowpageCount++;
+ tdev->ShowpageCount++;
return 0;
}
@@ -106,18 +106,18 @@ zflushpage(i_ctx_t *i_ctx_p)
static int
zgetbitsrect(i_ctx_t *i_ctx_p)
{ /*
- * alpha? is 0 for no alpha, -1 for alpha first, 1 for alpha last.
- * std_depth is null for native pixels, depth/component for
- * standard color space.
- */
+ * alpha? is 0 for no alpha, -1 for alpha first, 1 for alpha last.
+ * std_depth is null for native pixels, depth/component for
+ * standard color space.
+ */
os_ptr op = osp;
gx_device *dev;
gs_int_rect rect;
gs_get_bits_params_t params;
int w, h;
gs_get_bits_options_t options =
- GB_ALIGN_ANY | GB_RETURN_COPY | GB_OFFSET_0 | GB_RASTER_STANDARD |
- GB_PACKING_CHUNKY;
+ GB_ALIGN_ANY | GB_RETURN_COPY | GB_OFFSET_0 | GB_RASTER_STANDARD |
+ GB_PACKING_CHUNKY;
int depth;
uint raster;
int num_rows;
@@ -139,48 +139,48 @@ zgetbitsrect(i_ctx_t *i_ctx_p)
* which is not supported as a switch value in pre-ANSI C.
*/
if (op[-2].value.intval == -1)
- options |= GB_ALPHA_FIRST;
+ options |= GB_ALPHA_FIRST;
else if (op[-2].value.intval == 0)
- options |= GB_ALPHA_NONE;
+ options |= GB_ALPHA_NONE;
else if (op[-2].value.intval == 1)
- options |= GB_ALPHA_LAST;
+ options |= GB_ALPHA_LAST;
else
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (r_has_type(op - 1, t_null)) {
- options |= GB_COLORS_NATIVE;
- depth = dev->color_info.depth;
+ options |= GB_COLORS_NATIVE;
+ depth = dev->color_info.depth;
} else {
- static const gs_get_bits_options_t depths[17] = {
- 0, GB_DEPTH_1, GB_DEPTH_2, 0, GB_DEPTH_4, 0, 0, 0, GB_DEPTH_8,
- 0, 0, 0, GB_DEPTH_12, 0, 0, 0, GB_DEPTH_16
- };
- gs_get_bits_options_t depth_option;
- int std_depth;
-
- check_int_leu(op[-1], 16);
- std_depth = (int)op[-1].value.intval;
- depth_option = depths[std_depth];
- if (depth_option == 0)
- return_error(e_rangecheck);
- options |= depth_option | GB_COLORS_NATIVE;
- depth = (dev->color_info.num_components +
- (options & GB_ALPHA_NONE ? 0 : 1)) * std_depth;
+ static const gs_get_bits_options_t depths[17] = {
+ 0, GB_DEPTH_1, GB_DEPTH_2, 0, GB_DEPTH_4, 0, 0, 0, GB_DEPTH_8,
+ 0, 0, 0, GB_DEPTH_12, 0, 0, 0, GB_DEPTH_16
+ };
+ gs_get_bits_options_t depth_option;
+ int std_depth;
+
+ check_int_leu(op[-1], 16);
+ std_depth = (int)op[-1].value.intval;
+ depth_option = depths[std_depth];
+ if (depth_option == 0)
+ return_error(e_rangecheck);
+ options |= depth_option | GB_COLORS_NATIVE;
+ depth = (dev->color_info.num_components +
+ (options & GB_ALPHA_NONE ? 0 : 1)) * std_depth;
}
if (w == 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
raster = (w * depth + 7) >> 3;
check_write_type(*op, t_string);
num_rows = r_size(op) / raster;
h = min(h, num_rows);
if (h == 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
rect.q.x = rect.p.x + w;
rect.q.y = rect.p.y + h;
params.options = options;
params.data[0] = op->value.bytes;
code = (*dev_proc(dev, get_bits_rectangle))(dev, &rect, &params, NULL);
if (code < 0)
- return code;
+ return code;
make_int(op - 7, h);
op[-6] = *op;
r_set_size(op - 6, h * raster);
@@ -197,14 +197,14 @@ zgetdevice(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval != (int)(op->value.intval))
- return_error(e_rangecheck); /* won't fit in an int */
+ return_error(e_rangecheck); /* won't fit in an int */
dev = gs_getdevice((int)(op->value.intval));
if (dev == 0) /* index out of range */
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Device prototypes are read-only; */
/* the cast is logically unnecessary. */
make_tav(op, t_device, avm_foreign | a_readonly, pdevice,
- (gx_device *) dev);
+ (gx_device *) dev);
return 0;
}
@@ -217,10 +217,10 @@ zgetdefaultdevice(i_ctx_t *i_ctx_p)
dev = gs_getdefaultdevice();
if (dev == 0) /* couldn't find a default device */
- return_error(e_unknownerror);
+ return_error(e_unknownerror);
push(1);
make_tav(op, t_device, avm_foreign | a_readonly, pdevice,
- (gx_device *) dev);
+ (gx_device *) dev);
return 0;
}
@@ -241,15 +241,15 @@ zget_device_params(i_ctx_t *i_ctx_p, bool is_hardware)
pop(1);
stack_param_list_write(&list, &o_stack, &rkeys, iimemory);
code = gs_get_device_or_hardware_params(dev, (gs_param_list *) & list,
- is_hardware);
+ is_hardware);
if (code < 0) {
- /* We have to put back the top argument. */
- if (list.count > 0)
- ref_stack_pop(&o_stack, list.count * 2 - 1);
- else
- ref_stack_push(&o_stack, 1);
- *osp = rkeys;
- return code;
+ /* We have to put back the top argument. */
+ if (list.count > 0)
+ ref_stack_pop(&o_stack, list.count * 2 - 1);
+ else
+ ref_stack_push(&o_stack, 1);
+ *osp = rkeys;
+ return code;
}
pmark = ref_stack_index(&o_stack, list.count * 2);
make_mark(pmark);
@@ -284,39 +284,39 @@ zmakewordimagedevice(i_ctx_t *i_ctx_p)
check_int_leu(op[-2], max_uint >> 1); /* height */
check_type(*op, t_boolean);
if (r_has_type(op1, t_null)) { /* true color */
- colors = 0;
- colors_size = -24; /* 24-bit true color */
+ colors = 0;
+ colors_size = -24; /* 24-bit true color */
} else if (r_has_type(op1, t_integer)) {
- /*
- * We use if/else rather than switch because the value is long,
- * which is not supported as a switch value in pre-ANSI C.
- */
- if (op1->value.intval != 16 && op1->value.intval != 24 &&
- op1->value.intval != 32
- )
- return_error(e_rangecheck);
- colors = 0;
- colors_size = -op1->value.intval;
+ /*
+ * We use if/else rather than switch because the value is long,
+ * which is not supported as a switch value in pre-ANSI C.
+ */
+ if (op1->value.intval != 16 && op1->value.intval != 24 &&
+ op1->value.intval != 32
+ )
+ return_error(e_rangecheck);
+ colors = 0;
+ colors_size = -op1->value.intval;
} else {
- check_type(*op1, t_string); /* palette */
- if (r_size(op1) > 3 * 256)
- return_error(e_rangecheck);
- colors = op1->value.bytes;
- colors_size = r_size(op1);
+ check_type(*op1, t_string); /* palette */
+ if (r_size(op1) > 3 * 256)
+ return_error(e_rangecheck);
+ colors = op1->value.bytes;
+ colors_size = r_size(op1);
}
if ((code = read_matrix(imemory, op - 4, &imat)) < 0)
- return code;
+ return code;
/* Everything OK, create device */
code = gs_makewordimagedevice(&new_dev, &imat,
- (int)op[-3].value.intval,
- (int)op[-2].value.intval,
- colors, colors_size,
- op->value.boolval, true, imemory);
+ (int)op[-3].value.intval,
+ (int)op[-2].value.intval,
+ colors, colors_size,
+ op->value.boolval, true, imemory);
if (code == 0) {
- new_dev->memory = imemory;
- make_tav(op - 4, t_device, imemory_space(iimemory) | a_all,
- pdevice, new_dev);
- pop(4);
+ new_dev->memory = imemory;
+ make_tav(op - 4, t_device, imemory_space(iimemory) | a_all,
+ pdevice, new_dev);
+ pop(4);
}
return code;
}
@@ -344,24 +344,24 @@ zoutputpage(i_ctx_t *i_ctx_p)
check_type(op[-1], t_integer);
check_type(*op, t_boolean);
if (gs_debug[':']) {
- gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory);
+ gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory);
- print_resource_usage(minst, &(i_ctx_p->memory), "Outputpage start");
+ print_resource_usage(minst, &(i_ctx_p->memory), "Outputpage start");
}
#ifdef PSI_INCLUDED
code = ps_end_page_top(imemory,
- (int)op[-1].value.intval, op->value.boolval);
+ (int)op[-1].value.intval, op->value.boolval);
#else
code = gs_output_page(igs, (int)op[-1].value.intval,
- op->value.boolval);
+ op->value.boolval);
#endif
if (code < 0)
- return code;
+ return code;
pop(2);
if (gs_debug[':']) {
- gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory);
+ gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory);
- print_resource_usage(minst, &(i_ctx_p->memory), "Outputpage end");
+ print_resource_usage(minst, &(i_ctx_p->memory), "Outputpage end");
}
return 0;
}
@@ -390,19 +390,19 @@ zputdeviceparams(i_ctx_t *i_ctx_p)
int code2;
if (count == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
prequire_all = ref_stack_index(&o_stack, count);
ppolicy = ref_stack_index(&o_stack, count + 1);
pdev = ref_stack_index(&o_stack, count + 2);
if (pdev == 0)
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
check_type_only(*prequire_all, t_boolean);
check_write_type_only(*pdev, t_device);
dev = pdev->value.pdevice;
code = stack_param_list_read(&list, &o_stack, 0, ppolicy,
- prequire_all->value.boolval, iimemory);
+ prequire_all->value.boolval, iimemory);
if (code < 0)
- return code;
+ return code;
old_width = dev->width;
old_height = dev->height;
code = gs_putdeviceparams(dev, (gs_param_list *) & list);
@@ -411,36 +411,36 @@ zputdeviceparams(i_ctx_t *i_ctx_p)
if (code2 < 0) return code2;
/* Check for names that were undefined or caused errors. */
for (dest = count - 2, i = 0; i < count >> 1; i++)
- if (list.results[i] < 0) {
- *ref_stack_index(&o_stack, dest) =
- *ref_stack_index(&o_stack, count - (i << 1) - 2);
- gs_errorname(i_ctx_p, list.results[i],
- ref_stack_index(&o_stack, dest - 1));
- dest -= 2;
- }
+ if (list.results[i] < 0) {
+ *ref_stack_index(&o_stack, dest) =
+ *ref_stack_index(&o_stack, count - (i << 1) - 2);
+ gs_errorname(i_ctx_p, list.results[i],
+ ref_stack_index(&o_stack, dest - 1));
+ dest -= 2;
+ }
iparam_list_release(&list);
if (code < 0) { /* There were errors reported. */
- ref_stack_pop(&o_stack, dest + 1);
- return 0;
+ ref_stack_pop(&o_stack, dest + 1);
+ return 0;
}
if (code > 0 || (code == 0 && (dev->width != old_width || dev->height != old_height))) {
- /*
- * The device was open and is now closed, or its dimensions have
- * changed. If it was the current device, call setdevice to
- * reinstall it and erase the page.
- */
- /****** DOESN'T FIND ALL THE GSTATES THAT REFERENCE THE DEVICE. ******/
- if (gs_currentdevice(igs) == dev) {
- bool was_open = dev->is_open;
-
- code = gs_setdevice_no_erase(igs, dev);
- /* If the device wasn't closed, setdevice won't erase the page. */
- if (was_open && code >= 0)
- code = 1;
- }
+ /*
+ * The device was open and is now closed, or its dimensions have
+ * changed. If it was the current device, call setdevice to
+ * reinstall it and erase the page.
+ */
+ /****** DOESN'T FIND ALL THE GSTATES THAT REFERENCE THE DEVICE. ******/
+ if (gs_currentdevice(igs) == dev) {
+ bool was_open = dev->is_open;
+
+ code = gs_setdevice_no_erase(igs, dev);
+ /* If the device wasn't closed, setdevice won't erase the page. */
+ if (was_open && code >= 0)
+ code = 1;
+ }
}
if (code < 0)
- return code;
+ return code;
ref_stack_pop(&o_stack, count + 1);
make_bool(osp, code);
clear_pagedevice(istate);
@@ -459,7 +459,7 @@ zsetdevice(i_ctx_t *i_ctx_p)
check_write_type(*op, t_device);
if (dev->LockSafetyParams) { /* do additional checking if locked */
if(op->value.pdevice != dev) /* don't allow a different device */
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
}
/* If the device has a profile, this will get it to the manager.
@@ -476,7 +476,7 @@ zsetdevice(i_ctx_t *i_ctx_p)
code = gs_setdevice_no_erase(igs, op->value.pdevice);
if (code < 0)
- return code;
+ return code;
#endif
make_bool(op, code != 0); /* erase page if 1 */
diff --git a/gs/psi/zdevice2.c b/gs/psi/zdevice2.c
index cad437f02..1c536c327 100644
--- a/gs/psi/zdevice2.c
+++ b/gs/psi/zdevice2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,9 +46,9 @@ z2copy(i_ctx_t *i_ctx_p)
int code = zcopy(i_ctx_p);
if (code >= 0)
- return code;
+ return code;
if (!r_has_type(op, t_astruct))
- return code;
+ return code;
return z2copy_gstate(i_ctx_p);
}
@@ -61,12 +61,12 @@ zcurrentshowpagecount(i_ctx_t *i_ctx_p)
gx_device *dev = gs_currentdevice(igs);
if ((*dev_proc(dev, get_page_device))(dev) == 0) {
- push(1);
- make_false(op);
+ push(1);
+ make_false(op);
} else {
- push(2);
- make_int(op - 1, dev->ShowpageCount);
- make_true(op);
+ push(2);
+ make_int(op - 1, dev->ShowpageCount);
+ make_true(op);
}
return 0;
}
@@ -80,11 +80,11 @@ zcurrentpagedevice(i_ctx_t *i_ctx_p)
push(2);
if ((*dev_proc(dev, get_page_device))(dev) != 0) {
- op[-1] = istate->pagedevice;
- make_true(op);
+ op[-1] = istate->pagedevice;
+ make_true(op);
} else {
- make_null(op - 1);
- make_false(op);
+ make_null(op - 1);
+ make_false(op);
}
return 0;
}
@@ -98,24 +98,24 @@ zsetpagedevice(i_ctx_t *i_ctx_p)
/******
if ( igs->in_cachedevice )
- return_error(e_undefined);
+ return_error(e_undefined);
******/
if (r_has_type(op, t_dictionary)) {
- check_dict_read(*op);
+ check_dict_read(*op);
#if 0 /****************/
- /*
- * In order to avoid invalidaccess errors on setpagedevice,
- * the dictionary must be allocated in local VM.
- */
- if (!(r_is_local(op)))
- return_error(e_invalidaccess);
+ /*
+ * In order to avoid invalidaccess errors on setpagedevice,
+ * the dictionary must be allocated in local VM.
+ */
+ if (!(r_is_local(op)))
+ return_error(e_invalidaccess);
#endif /****************/
- /* Make the dictionary read-only. */
- code = zreadonly(i_ctx_p);
- if (code < 0)
- return code;
+ /* Make the dictionary read-only. */
+ code = zreadonly(i_ctx_p);
+ if (code < 0)
+ return code;
} else {
- check_type(*op, t_null);
+ check_type(*op, t_null);
}
istate->pagedevice = *op;
pop(1);
@@ -132,10 +132,10 @@ zcallinstall(i_ctx_t *i_ctx_p)
gx_device *dev = gs_currentdevice(igs);
if ((dev = (*dev_proc(dev, get_page_device))(dev)) != 0) {
- int code = (*dev->page_procs.install) (dev, igs);
+ int code = (*dev->page_procs.install) (dev, igs);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
return 0;
}
@@ -149,10 +149,10 @@ zcallbeginpage(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if ((dev = (*dev_proc(dev, get_page_device))(dev)) != 0) {
- int code = (*dev->page_procs.begin_page)(dev, igs);
+ int code = (*dev->page_procs.begin_page)(dev, igs);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
pop(1);
return 0;
@@ -169,13 +169,13 @@ zcallendpage(i_ctx_t *i_ctx_p)
check_type(op[-1], t_integer);
check_type(*op, t_integer);
if ((dev = (*dev_proc(dev, get_page_device))(dev)) != 0) {
- code = (*dev->page_procs.end_page)(dev, (int)op->value.intval, igs);
- if (code < 0)
- return code;
- if (code > 1)
- return_error(e_rangecheck);
+ code = (*dev->page_procs.end_page)(dev, (int)op->value.intval, igs);
+ if (code < 0)
+ return code;
+ if (code > 1)
+ return_error(e_rangecheck);
} else {
- code = (op->value.intval == 2 ? 0 : 1);
+ code = (op->value.intval == 2 ? 0 : 1);
}
make_bool(op - 1, code);
pop(1);
@@ -194,9 +194,9 @@ zcallendpage(i_ctx_t *i_ctx_p)
static bool
save_page_device(gs_state *pgs)
{
- return
- (r_has_type(&gs_int_gstate(pgs)->pagedevice, t_null) &&
- (*dev_proc(gs_currentdevice(pgs), get_page_device))(gs_currentdevice(pgs)) != 0);
+ return
+ (r_has_type(&gs_int_gstate(pgs)->pagedevice, t_null) &&
+ (*dev_proc(gs_currentdevice(pgs), get_page_device))(gs_currentdevice(pgs)) != 0);
}
/* - gsave - */
@@ -204,7 +204,7 @@ static int
z2gsave(i_ctx_t *i_ctx_p)
{
if (!save_page_device(igs))
- return gs_gsave(igs);
+ return gs_gsave(igs);
return push_callout(i_ctx_p, "%gsavepagedevice");
}
@@ -213,7 +213,7 @@ static int
z2save(i_ctx_t *i_ctx_p)
{
if (!save_page_device(igs))
- return zsave(i_ctx_p);
+ return zsave(i_ctx_p);
return push_callout(i_ctx_p, "%savepagedevice");
}
@@ -222,7 +222,7 @@ static int
z2gstate(i_ctx_t *i_ctx_p)
{
if (!save_page_device(igs))
- return zgstate(i_ctx_p);
+ return zgstate(i_ctx_p);
return push_callout(i_ctx_p, "%gstatepagedevice");
}
@@ -231,7 +231,7 @@ static int
z2copy_gstate(i_ctx_t *i_ctx_p)
{
if (!save_page_device(igs))
- return zcopy_gstate(i_ctx_p);
+ return zcopy_gstate(i_ctx_p);
return push_callout(i_ctx_p, "%copygstatepagedevice");
}
@@ -240,7 +240,7 @@ static int
z2currentgstate(i_ctx_t *i_ctx_p)
{
if (!save_page_device(igs))
- return zcurrentgstate(i_ctx_p);
+ return zcurrentgstate(i_ctx_p);
return push_callout(i_ctx_p, "%currentgstatepagedevice");
}
@@ -255,10 +255,10 @@ restore_page_device(const gs_state * pgs_old, const gs_state * pgs_new)
gx_device *dev_t1;
gx_device *dev_t2;
bool samepagedevice = obj_eq(dev_old->memory, &gs_int_gstate(pgs_old)->pagedevice,
- &gs_int_gstate(pgs_new)->pagedevice);
+ &gs_int_gstate(pgs_new)->pagedevice);
if ((dev_t1 = (*dev_proc(dev_old, get_page_device)) (dev_old)) == 0)
- return false;
+ return false;
/* If we are going to putdeviceparams in a callout, we need to */
/* unlock temporarily. The device will be re-locked as needed */
/* by putdeviceparams from the pgs_old->pagedevice dict state. */
@@ -266,10 +266,10 @@ restore_page_device(const gs_state * pgs_old, const gs_state * pgs_new)
dev_old->LockSafetyParams = false;
dev_new = gs_currentdevice(pgs_new);
if (dev_old != dev_new) {
- if ((dev_t2 = (*dev_proc(dev_new, get_page_device)) (dev_new)) == 0)
- return false;
- if (dev_t1 != dev_t2)
- return true;
+ if ((dev_t2 = (*dev_proc(dev_new, get_page_device)) (dev_new)) == 0)
+ return false;
+ if (dev_t1 != dev_t2)
+ return true;
}
/*
* The current implementation of setpagedevice just sets new
@@ -284,7 +284,7 @@ static int
z2grestore(i_ctx_t *i_ctx_p)
{
if (!restore_page_device(igs, gs_state_saved(igs)))
- return gs_grestore(igs);
+ return gs_grestore(igs);
return push_callout(i_ctx_p, "%grestorepagedevice");
}
@@ -293,14 +293,14 @@ static int
z2grestoreall(i_ctx_t *i_ctx_p)
{
for (;;) {
- if (!restore_page_device(igs, gs_state_saved(igs))) {
- bool done = !gs_state_saved(gs_state_saved(igs));
-
- gs_grestore(igs);
- if (done)
- break;
- } else
- return push_callout(i_ctx_p, "%grestoreallpagedevice");
+ if (!restore_page_device(igs, gs_state_saved(igs))) {
+ bool done = !gs_state_saved(gs_state_saved(igs));
+
+ gs_grestore(igs);
+ if (done)
+ break;
+ } else
+ return push_callout(i_ctx_p, "%grestoreallpagedevice");
}
return 0;
}
@@ -310,12 +310,12 @@ static int
z2restore(i_ctx_t *i_ctx_p)
{
while (gs_state_saved(gs_state_saved(igs))) {
- if (restore_page_device(igs, gs_state_saved(igs)))
- return push_callout(i_ctx_p, "%restore1pagedevice");
- gs_grestore(igs);
+ if (restore_page_device(igs, gs_state_saved(igs)))
+ return push_callout(i_ctx_p, "%restore1pagedevice");
+ gs_grestore(igs);
}
if (restore_page_device(igs, gs_state_saved(igs)))
- return push_callout(i_ctx_p, "%restorepagedevice");
+ return push_callout(i_ctx_p, "%restorepagedevice");
return zrestore(i_ctx_p);
}
@@ -327,7 +327,7 @@ z2setgstate(i_ctx_t *i_ctx_p)
check_stype(*op, st_igstate_obj);
if (!restore_page_device(igs, igstate_ptr(op)))
- return zsetgstate(i_ctx_p);
+ return zsetgstate(i_ctx_p);
return push_callout(i_ctx_p, "%setgstatepagedevice");
}
@@ -339,8 +339,8 @@ const op_def zdevice2_l2_op_defs[] =
{"0.currentshowpagecount", zcurrentshowpagecount},
{"0.currentpagedevice", zcurrentpagedevice},
{"1.setpagedevice", zsetpagedevice},
- /* Note that the following replace prior definitions */
- /* in the indicated files: */
+ /* Note that the following replace prior definitions */
+ /* in the indicated files: */
{"1copy", z2copy}, /* zdps1.c */
{"0gsave", z2gsave}, /* zgstate.c */
{"0save", z2save}, /* zvmem.c */
@@ -350,8 +350,8 @@ const op_def zdevice2_l2_op_defs[] =
{"0grestoreall", z2grestoreall}, /* zgstate.c */
{"1restore", z2restore}, /* zvmem.c */
{"1setgstate", z2setgstate}, /* zdps1.c */
- /* Default Install/BeginPage/EndPage procedures */
- /* that just call the procedure in the device. */
+ /* Default Install/BeginPage/EndPage procedures */
+ /* that just call the procedure in the device. */
{"0.callinstall", zcallinstall},
{"1.callbeginpage", zcallbeginpage},
{"2.callendpage", zcallendpage},
@@ -369,7 +369,7 @@ push_callout(i_ctx_t *i_ctx_p, const char *callout_name)
check_estack(1);
code = name_enter_string(imemory, callout_name, esp + 1);
if (code < 0)
- return code;
+ return code;
++esp;
r_set_attrs(esp, a_executable);
return o_push_estack;
diff --git a/gs/psi/zdfilter.c b/gs/psi/zdfilter.c
index f7fef64b1..e3ef91243 100644
--- a/gs/psi/zdfilter.c
+++ b/gs/psi/zdfilter.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zdict.c b/gs/psi/zdict.c
index 536346af9..577499236 100644
--- a/gs/psi/zdict.c
+++ b/gs/psi/zdict.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@ zdict(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return dict_create((uint) op->value.intval, op);
}
@@ -55,7 +55,7 @@ zbegin(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
- if ( dsp == dstop ) {
+ if ( dsp == dstop ) {
int code = ref_stack_extend(&d_stack, 1);
if ( code < 0 ) {
@@ -79,12 +79,12 @@ int
zend(i_ctx_t *i_ctx_p)
{
if (ref_stack_count_inline(&d_stack) == min_dstack_size) {
- /* We would underflow the d-stack. */
- return_error(e_dictstackunderflow);
+ /* We would underflow the d-stack. */
+ return_error(e_dictstackunderflow);
}
while (dsp == dsbot) {
- /* We would underflow the current block. */
- ref_stack_pop_block(&d_stack);
+ /* We would underflow the current block. */
+ ref_stack_pop_block(&d_stack);
}
dsp--;
dict_set_top();
@@ -105,33 +105,33 @@ zop_def(i_ctx_t *i_ctx_p)
/* The following combines a check_op(2) with a type check. */
switch (r_type(op1)) {
- case t_name: {
- /* We can use the fast single-probe lookup here. */
- uint nidx = name_index(imemory, op1);
- uint htemp;
-
- if_dict_find_name_by_index_top(nidx, htemp, pvslot) {
- if (dtop_can_store(op))
- goto ra;
- }
- break; /* handle all slower cases */
- }
- case t_null:
- return_error(e_typecheck);
- case t__invalid:
- return_error(e_stackunderflow);
+ case t_name: {
+ /* We can use the fast single-probe lookup here. */
+ uint nidx = name_index(imemory, op1);
+ uint htemp;
+
+ if_dict_find_name_by_index_top(nidx, htemp, pvslot) {
+ if (dtop_can_store(op))
+ goto ra;
+ }
+ break; /* handle all slower cases */
+ }
+ case t_null:
+ return_error(e_typecheck);
+ case t__invalid:
+ return_error(e_stackunderflow);
}
/*
* Combine the check for a writable top dictionary with
* the global/local store check. See dstack.h for details.
*/
if (!dtop_can_store(op)) {
- check_dict_write(*dsp);
- /*
- * If the dictionary is writable, the problem must be
- * an invalid store.
- */
- return_error(e_invalidaccess);
+ check_dict_write(*dsp);
+ /*
+ * If the dictionary is writable, the problem must be
+ * an invalid store.
+ */
+ return_error(e_invalidaccess);
}
/*
* Save a level of procedure call in the common (redefinition)
@@ -139,10 +139,10 @@ zop_def(i_ctx_t *i_ctx_p)
* in the uncommon case.
*/
if (dict_find(dsp, op1, &pvslot) <= 0)
- return idict_put(dsp, op1, op);
+ return idict_put(dsp, op1, op);
ra:
if ((pvslot->tas.type_attrs & (&i_ctx_p->memory)->test_mask) == 0)
- alloc_save_change(idmemory, &dsp->value.pdict->values, (ref_packed *)pvslot, "dict_put(value)");
+ alloc_save_change(idmemory, &dsp->value.pdict->values, (ref_packed *)pvslot, "dict_put(value)");
ref_assign_new_inline(pvslot,op);
return 0;
@@ -153,7 +153,7 @@ zdef(i_ctx_t *i_ctx_p)
int code = zop_def(i_ctx_p);
if (code >= 0) {
- pop(2);
+ pop(2);
}
return code;
}
@@ -166,32 +166,32 @@ zload(i_ctx_t *i_ctx_p)
ref *pvalue;
switch (r_type(op)) {
- case t_name:
- /* Use the fast lookup. */
- if ((pvalue = dict_find_name(op)) == 0)
- return_error(e_undefined);
- ref_assign(op, pvalue);
- return 0;
- case t_null:
- return_error(e_typecheck);
- case t__invalid:
- return_error(e_stackunderflow);
- default: {
- /* Use an explicit loop. */
- uint size = ref_stack_count(&d_stack);
- uint i;
-
- for (i = 0; i < size; i++) {
- ref *dp = ref_stack_index(&d_stack, i);
-
- check_dict_read(*dp);
- if (dict_find(dp, op, &pvalue) > 0) {
- ref_assign(op, pvalue);
- return 0;
- }
- }
- return_error(e_undefined);
- }
+ case t_name:
+ /* Use the fast lookup. */
+ if ((pvalue = dict_find_name(op)) == 0)
+ return_error(e_undefined);
+ ref_assign(op, pvalue);
+ return 0;
+ case t_null:
+ return_error(e_typecheck);
+ case t__invalid:
+ return_error(e_stackunderflow);
+ default: {
+ /* Use an explicit loop. */
+ uint size = ref_stack_count(&d_stack);
+ uint i;
+
+ for (i = 0; i < size; i++) {
+ ref *dp = ref_stack_index(&d_stack, i);
+
+ check_dict_read(*dp);
+ if (dict_find(dp, op, &pvalue) > 0) {
+ ref_assign(op, pvalue);
+ return 0;
+ }
+ }
+ return_error(e_undefined);
+ }
}
}
@@ -210,10 +210,10 @@ zundef(i_ctx_t *i_ctx_p)
check_type(*op1, t_dictionary);
if (i_ctx_p->in_superexec == 0)
- check_dict_write(*op1);
+ check_dict_write(*op1);
code = idict_undef(op1, op);
if (code < 0 && code != e_undefined) /* ignore undefined error */
- return code;
+ return code;
pop(2);
return 0;
}
@@ -232,11 +232,11 @@ zknown(i_ctx_t *i_ctx_p)
code = dict_find(op1, op, &pvalue);
switch (code) {
case e_dictfull:
- code = 0;
+ code = 0;
case 0: case 1:
- break;
+ break;
default:
- return code;
+ return code;
}
make_bool(op1, code);
pop(1);
@@ -254,23 +254,23 @@ zwhere(i_ctx_t *i_ctx_p)
check_op(1);
ref_stack_enum_begin(&rsenum, &d_stack);
do {
- const ref *const bot = rsenum.ptr;
- const ref *pdref = bot + rsenum.size;
- ref *pvalue;
- int code;
-
- while (pdref-- > bot) {
- check_dict_read(*pdref);
- code = dict_find(pdref, op, &pvalue);
- if (code < 0 && code != e_dictfull)
- return code;
- if (code > 0) {
- push(1);
- ref_assign(op - 1, pdref);
- make_true(op);
- return 0;
- }
- }
+ const ref *const bot = rsenum.ptr;
+ const ref *pdref = bot + rsenum.size;
+ ref *pvalue;
+ int code;
+
+ while (pdref-- > bot) {
+ check_dict_read(*pdref);
+ code = dict_find(pdref, op, &pvalue);
+ if (code < 0 && code != e_dictfull)
+ return code;
+ if (code > 0) {
+ push(1);
+ ref_assign(op - 1, pdref);
+ make_true(op);
+ return 0;
+ }
+ }
} while (ref_stack_enum_next(&rsenum));
make_false(op);
return 0;
@@ -289,19 +289,19 @@ zcopy_dict(i_ctx_t *i_ctx_p)
check_dict_read(*op1);
check_dict_write(*op);
if (!imemory->gs_lib_ctx->dict_auto_expand &&
- (dict_length(op) != 0 || dict_maxlength(op) < dict_length(op1))
- )
- return_error(e_rangecheck);
+ (dict_length(op) != 0 || dict_maxlength(op) < dict_length(op1))
+ )
+ return_error(e_rangecheck);
code = idict_copy(op1, op);
if (code < 0)
- return code;
+ return code;
/*
* In Level 1 systems, we must copy the access attributes too.
* The only possible effect this can have is to make the
* copy read-only if the original dictionary is read-only.
*/
if (!level2_enabled)
- r_copy_attrs(dict_access_ref(op), a_write, dict_access_ref(op1));
+ r_copy_attrs(dict_access_ref(op), a_write, dict_access_ref(op1));
ref_assign(op1, op);
pop(1);
return 0;
@@ -327,7 +327,7 @@ zcountdictstack(i_ctx_t *i_ctx_p)
push(1);
if (!level2_enabled)
- count--; /* see dstack.h */
+ count--; /* see dstack.h */
make_int(op, count);
return 0;
}
@@ -340,15 +340,15 @@ zdictstack(i_ctx_t *i_ctx_p)
uint count = ref_stack_count(&d_stack);
if (!level2_enabled)
- count--; /* see dstack.h */
+ count--; /* see dstack.h */
if (!r_is_array(op))
- return_op_typecheck(op);
+ return_op_typecheck(op);
if (r_size(op) < count)
return_error(e_rangecheck);
- if (!r_has_type_attrs(op, t_array, a_write))
+ if (!r_has_type_attrs(op, t_array, a_write))
return_error(e_invalidaccess);
return ref_stack_store(&d_stack, op, count, 0, 0, true, idmemory,
- "dictstack");
+ "dictstack");
}
/* - cleardictstack - */
@@ -356,7 +356,7 @@ static int
zcleardictstack(i_ctx_t *i_ctx_p)
{
while (zend(i_ctx_p) >= 0)
- DO_NOTHING;
+ DO_NOTHING;
return 0;
}
@@ -373,22 +373,22 @@ zdicttomark(i_ctx_t *i_ctx_p)
uint idx;
if (count2 == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
count2--;
if ((count2 & 1) != 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = dict_create(count2 >> 1, &rdict);
if (code < 0)
- return code;
+ return code;
/* << /a 1 /a 2 >> => << /a 1 >>, i.e., */
/* we must enter the keys in top-to-bottom order. */
for (idx = 0; idx < count2; idx += 2) {
- code = idict_put(&rdict,
- ref_stack_index(&o_stack, idx + 1),
- ref_stack_index(&o_stack, idx));
- if (code < 0) { /* There's no way to free the dictionary -- too bad. */
- return code;
- }
+ code = idict_put(&rdict,
+ ref_stack_index(&o_stack, idx + 1),
+ ref_stack_index(&o_stack, idx));
+ if (code < 0) { /* There's no way to free the dictionary -- too bad. */
+ return code;
+ }
}
ref_stack_pop(&o_stack, count2);
ref_assign(osp, &rdict);
@@ -415,10 +415,10 @@ zforcecopynew(i_ctx_t *i_ctx_p)
/*check_dict_write(*op);*/ /* see above */
/* This is only recognized in Level 2 mode. */
if (!imemory->gs_lib_ctx->dict_auto_expand)
- return_error(e_undefined);
+ return_error(e_undefined);
code = idict_copy_new(op1, op);
if (code < 0)
- return code;
+ return code;
ref_assign(op1, op);
pop(1);
return 0;
@@ -454,11 +454,11 @@ zknownget(i_ctx_t *i_ctx_p)
check_type(*op1, t_dictionary);
check_dict_read(*op1);
if (dict_find(op1, op, &pvalue) <= 0) {
- make_false(op1);
- pop(1);
+ make_false(op1);
+ pop(1);
} else {
- ref_assign(op1, pvalue);
- make_true(op);
+ ref_assign(op1, pvalue);
+ make_true(op);
}
return 0;
}
@@ -490,16 +490,16 @@ zsetmaxlength(i_ctx_t *i_ctx_p)
check_type(*op1, t_dictionary);
if (i_ctx_p->in_superexec == 0)
- check_dict_write(*op1);
+ check_dict_write(*op1);
check_type(*op, t_integer);
if (op->value.intval < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
new_size = (uint) op->value.intval;
if (dict_length(op - 1) > new_size)
- return_error(e_dictfull);
+ return_error(e_dictfull);
code = idict_resize(op - 1, new_size);
if (code >= 0)
- pop(2);
+ pop(2);
return code;
}
@@ -523,20 +523,20 @@ const op_def zdict1_op_defs[] = {
op_def_end(0)
};
const op_def zdict2_op_defs[] = {
- /* Extensions */
+ /* Extensions */
{"1.dicttomark", zdicttomark},
{"2.forcecopynew", zforcecopynew},
{"2.forceundef", zforceundef},
{"2.knownget", zknownget},
{"1.knownundef", zknownundef},
{"2.setmaxlength", zsetmaxlength},
- /*
- * In Level 2, >> is a synonym for .dicttomark, and undef for
- * .undef. By giving the former their own entries, they will not be
- * "eq" to .dicttomark and .undef, but that doesn't matter, since
- * we're doing this only for the sake of Adobe- compatible error
- * stacks.
- */
+ /*
+ * In Level 2, >> is a synonym for .dicttomark, and undef for
+ * .undef. By giving the former their own entries, they will not be
+ * "eq" to .dicttomark and .undef, but that doesn't matter, since
+ * we're doing this only for the sake of Adobe- compatible error
+ * stacks.
+ */
op_def_begin_level2(),
{"1>>", zdicttomark},
{"2undef", zundef},
diff --git a/gs/psi/zdosio.c b/gs/psi/zdosio.c
index 132877951..a6c4b3172 100644
--- a/gs/psi/zdosio.c
+++ b/gs/psi/zdosio.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zdouble.c b/gs/psi/zdouble.c
index 4b5195056..abc251e25 100644
--- a/gs/psi/zdouble.c
+++ b/gs/psi/zdouble.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,20 +39,20 @@ static int double_result(i_ctx_t *, int, double);
static int double_unary(i_ctx_t *, double (*)(double));
#define dbegin_unary()\
- os_ptr op = osp;\
- double num;\
- int code = double_params_result(op, 1, &num);\
+ os_ptr op = osp;\
+ double num;\
+ int code = double_params_result(op, 1, &num);\
\
- if ( code < 0 )\
- return code
+ if ( code < 0 )\
+ return code
#define dbegin_binary()\
- os_ptr op = osp;\
- double num[2];\
- int code = double_params_result(op, 2, num);\
+ os_ptr op = osp;\
+ double num[2];\
+ int code = double_params_result(op, 2, num);\
\
- if ( code < 0 )\
- return code
+ if ( code < 0 )\
+ return code
/* ------ Arithmetic ------ */
@@ -70,7 +70,7 @@ zddiv(i_ctx_t *i_ctx_p)
{
dbegin_binary();
if (num[1] == 0.0)
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
return double_result(i_ctx_p, 2, num[0] / num[1]);
}
@@ -135,7 +135,7 @@ zdsqrt(i_ctx_t *i_ctx_p)
{
dbegin_unary();
if (num < 0.0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return double_result(i_ctx_p, 1, sqrt(num));
}
@@ -176,13 +176,13 @@ zdatan(i_ctx_t *i_ctx_p)
dbegin_binary();
if (num[0] == 0) { /* on X-axis, special case */
- if (num[1] == 0)
- return_error(e_undefinedresult);
- result = (num[1] < 0 ? 180 : 0);
+ if (num[1] == 0)
+ return_error(e_undefinedresult);
+ result = (num[1] < 0 ? 180 : 0);
} else {
- result = atan2(num[0], num[1]) * radians_to_degrees;
- if (result < 0)
- result += 360;
+ result = atan2(num[0], num[1]) * radians_to_degrees;
+ if (result < 0)
+ result += 360;
}
return double_result(i_ctx_p, 2, result);
}
@@ -202,9 +202,9 @@ zdexp(i_ctx_t *i_ctx_p)
dbegin_binary();
if (num[0] == 0.0 && num[1] == 0.0)
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
if (num[0] < 0.0 && modf(num[1], &ipart) != 0.0)
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
return double_result(i_ctx_p, 2, pow(num[0], num[1]));
}
@@ -213,7 +213,7 @@ dlog(i_ctx_t *i_ctx_p, double (*lfunc)(double))
{
dbegin_unary();
if (num <= 0.0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return double_result(i_ctx_p, 1, (*lfunc)(num));
}
/* <dposnum> <dresult> .dln <dresult> */
@@ -246,10 +246,10 @@ dcompare(i_ctx_t *i_ctx_p, int mask)
int code = double_params(op, 2, num);
if (code < 0)
- return code;
+ return code;
make_bool(op - 1,
- (mask & (num[0] < num[1] ? 1 : num[0] > num[1] ? 4 : 2))
- != 0);
+ (mask & (num[0] < num[1] ? 1 : num[0] > num[1] ? 4 : 2))
+ != 0);
pop(1);
return 0;
}
@@ -316,11 +316,11 @@ zcvsd(i_ctx_t *i_ctx_p)
char end;
if (code < 0)
- return code;
+ return code;
check_read_type(op[-1], t_string);
len = r_size(op - 1);
if (len > MAX_CHARS)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
sprintf(buf, "%f", 1.5);
dot = buf[1]; /* locale-dependent */
memcpy(str, op[-1].value.bytes, len);
@@ -331,12 +331,12 @@ zcvsd(i_ctx_t *i_ctx_p)
* the scanned number is a $.
*/
while (len > 0 && isspace(*str))
- ++str, --len;
+ ++str, --len;
while (len > 0 && isspace(str[len - 1]))
- --len;
+ --len;
str[len] = 0;
if (strspn(str, "0123456789+-.dDeE") != len)
- return_error(e_syntaxerror);
+ return_error(e_syntaxerror);
strcat(str, "$");
if (dot != '.') {
char *pdot = strchr(str, '.');
@@ -344,7 +344,7 @@ zcvsd(i_ctx_t *i_ctx_p)
*pdot = dot;
}
if (sscanf(str, "%lf%c", &num, &end) != 2 || end != '$')
- return_error(e_syntaxerror);
+ return_error(e_syntaxerror);
return double_result(i_ctx_p, 1, num);
}
@@ -361,10 +361,10 @@ zdcvi(i_ctx_t *i_ctx_p)
int code = double_params(op, 1, &num);
if (code < 0)
- return code;
+ return code;
if (num < min_int_real || num > max_int_real)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_int(op, (long)num); /* truncates toward 0 */
return 0;
}
@@ -384,9 +384,9 @@ zdcvr(i_ctx_t *i_ctx_p)
int code = double_params(op, 1, &num);
if (code < 0)
- return code;
+ return code;
if (num < min_real || num > max_real)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_real(op, (float)num);
return 0;
}
@@ -402,7 +402,7 @@ zdcvs(i_ctx_t *i_ctx_p)
int len;
if (code < 0)
- return code;
+ return code;
check_write_type(*op, t_string);
sprintf(str, "%f", 1.5);
dot = str[1]; /* locale-dependent */
@@ -416,19 +416,19 @@ zdcvs(i_ctx_t *i_ctx_p)
* using %.16g.
*/
{
- double scanned;
+ double scanned;
- sprintf(str, "%g", num);
- sscanf(str, "%lf", &scanned);
- if (scanned != num)
- sprintf(str, "%.16g", num);
+ sprintf(str, "%g", num);
+ sscanf(str, "%lf", &scanned);
+ if (scanned != num)
+ sprintf(str, "%.16g", num);
}
len = strlen(str);
if (len > r_size(op))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Juggling locales isn't thread-safe. Posix me harder. */
if (dot != '.') {
- char *pdot = strchr(str, dot);
+ char *pdot = strchr(str, dot);
if (pdot)
*pdot = '.';
}
@@ -443,19 +443,19 @@ zdcvs(i_ctx_t *i_ctx_p)
/* We need to split the table because of the 16-element limit. */
const op_def zdouble1_op_defs[] = {
- /* Arithmetic */
+ /* Arithmetic */
{"3.dadd", zdadd},
{"3.ddiv", zddiv},
{"3.dmul", zdmul},
{"3.dsub", zdsub},
- /* Comparison */
+ /* Comparison */
{"2.deq", zdeq},
{"2.dge", zdge},
{"2.dgt", zdgt},
{"2.dle", zdle},
{"2.dlt", zdlt},
{"2.dne", zdne},
- /* Conversion */
+ /* Conversion */
{"2.cvd", zcvd},
{"2.cvsd", zcvsd},
{"1.dcvi", zdcvi},
@@ -464,7 +464,7 @@ const op_def zdouble1_op_defs[] = {
op_def_end(0)
};
const op_def zdouble2_op_defs[] = {
- /* Simple functions */
+ /* Simple functions */
{"2.dabs", zdabs},
{"2.dceiling", zdceiling},
{"2.dfloor", zdfloor},
@@ -472,7 +472,7 @@ const op_def zdouble2_op_defs[] = {
{"2.dround", zdround},
{"2.dsqrt", zdsqrt},
{"2.dtruncate", zdtruncate},
- /* Transcendental functions */
+ /* Transcendental functions */
{"2.darccos", zdarccos},
{"2.darcsin", zdarcsin},
{"3.datan", zdatan},
@@ -492,27 +492,27 @@ double_params(os_ptr op, int count, double *pval)
{
pval += count;
while (--count >= 0) {
- switch (r_type(op)) {
- case t_real:
- *--pval = op->value.realval;
- break;
- case t_integer:
- *--pval = op->value.intval;
- break;
- case t_string:
- if (!r_has_attr(op, a_read) ||
- r_size(op) != sizeof(double)
- )
- return_error(e_typecheck);
- --pval;
- memcpy(pval, op->value.bytes, sizeof(double));
- break;
- case t__invalid:
- return_error(e_stackunderflow);
- default:
- return_error(e_typecheck);
- }
- op--;
+ switch (r_type(op)) {
+ case t_real:
+ *--pval = op->value.realval;
+ break;
+ case t_integer:
+ *--pval = op->value.intval;
+ break;
+ case t_string:
+ if (!r_has_attr(op, a_read) ||
+ r_size(op) != sizeof(double)
+ )
+ return_error(e_typecheck);
+ --pval;
+ memcpy(pval, op->value.bytes, sizeof(double));
+ break;
+ case t__invalid:
+ return_error(e_stackunderflow);
+ default:
+ return_error(e_typecheck);
+ }
+ op--;
}
return 0;
}
@@ -523,7 +523,7 @@ double_params_result(os_ptr op, int count, double *pval)
{
check_write_type(*op, t_string);
if (r_size(op) != sizeof(double))
- return_error(e_typecheck);
+ return_error(e_typecheck);
return double_params(op - 1, count, pval);
}
diff --git a/gs/psi/zdpnext.c b/gs/psi/zdpnext.c
index 08b847cde..415fc56b5 100644
--- a/gs/psi/zdpnext.c
+++ b/gs/psi/zdpnext.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,9 +54,9 @@ zsetalpha(i_ctx_t *i_ctx_p)
int code;
if (real_param(op, &alpha) < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
if ((code = gs_setalpha(igs, alpha)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -109,22 +109,22 @@ zcompositerect(i_ctx_t *i_ctx_p)
int code = xywh_param(op - 1, dest_rect);
if (code < 0)
- return code;
+ return code;
check_int_leu(*op, compositerect_last);
cstate.params.op = (gs_composite_op_t) op->value.intval;
code = begin_composite(i_ctx_p, &cstate);
if (code < 0)
- return code;
+ return code;
{
- gs_rect rect;
+ gs_rect rect;
- rect.q.x = (rect.p.x = dest_rect[0]) + dest_rect[2];
- rect.q.y = (rect.p.y = dest_rect[1]) + dest_rect[3];
- code = gs_rectfill(igs, &rect, 1);
+ rect.q.x = (rect.p.x = dest_rect[0]) + dest_rect[2];
+ rect.q.y = (rect.p.y = dest_rect[1]) + dest_rect[3];
+ code = gs_rectfill(igs, &rect, 1);
}
end_composite(i_ctx_p, &cstate);
if (code >= 0)
- pop(5);
+ pop(5);
return code;
}
@@ -143,15 +143,15 @@ composite_image(i_ctx_t *i_ctx_p, const gs_composite_alpha_params_t * params)
cstate.params = *params;
gs_image2_t_init(&image);
if (code < 0 ||
- (code = num_params(op - 1, 2, dest_pt)) < 0
- )
- return code;
+ (code = num_params(op - 1, 2, dest_pt)) < 0
+ )
+ return code;
if (r_has_type(op - 3, t_null))
- image.DataSource = igs;
+ image.DataSource = igs;
else {
- check_stype(op[-3], st_igstate_obj);
- check_read(op[-3]);
- image.DataSource = igstate_ptr(op - 3);
+ check_stype(op[-3], st_igstate_obj);
+ check_read(op[-3]);
+ image.DataSource = igstate_ptr(op - 3);
}
image.XOrigin = src_rect[0];
image.YOrigin = src_rect[1];
@@ -163,17 +163,17 @@ composite_image(i_ctx_t *i_ctx_p, const gs_composite_alpha_params_t * params)
gs_translate(igs, dest_pt[0], dest_pt[1]);
gs_make_identity(&image.ImageMatrix);
if (image.DataSource == igs) {
- image.XOrigin -= dest_pt[0];
- image.YOrigin -= dest_pt[1];
+ image.XOrigin -= dest_pt[0];
+ image.YOrigin -= dest_pt[1];
}
code = begin_composite(i_ctx_p, &cstate);
if (code >= 0) {
- code = process_non_source_image(i_ctx_p,
- (const gs_image_common_t *)&image,
- "composite_image");
- end_composite(i_ctx_p, &cstate);
- if (code >= 0)
- pop(8);
+ code = process_non_source_image(i_ctx_p,
+ (const gs_image_common_t *)&image,
+ "composite_image");
+ end_composite(i_ctx_p, &cstate);
+ if (code >= 0)
+ pop(8);
}
gs_setmatrix(igs, &save_ctm);
return code;
@@ -203,9 +203,9 @@ zdissolve(i_ctx_t *i_ctx_p)
int code = real_param(op, &delta);
if (code < 0)
- return code;
+ return code;
if (delta < 0 || delta > 1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
params.op = composite_Dissolve;
params.delta = delta;
return composite_image(i_ctx_p, &params);
@@ -264,7 +264,7 @@ zsizeimagebox(i_ctx_t *i_ctx_p)
mat.ty -= rect.p.y;
code = write_matrix(op, &mat);
if (code < 0)
- return code;
+ return code;
make_int(op - 4, rect.p.x);
make_int(op - 3, rect.p.y);
make_int(op - 2, w);
@@ -275,14 +275,14 @@ static void
box_confine(int *pp, int *pq, int wh)
{
if ( *pq <= 0 )
- *pp = *pq = 0;
+ *pp = *pq = 0;
else if ( *pp >= wh )
- *pp = *pq = wh;
+ *pp = *pq = wh;
else {
- if ( *pp < 0 )
- *pp = 0;
- if ( *pq > wh )
- *pq = wh;
+ if ( *pp < 0 )
+ *pp = 0;
+ if ( *pq > wh )
+ *pq = wh;
}
}
@@ -297,25 +297,25 @@ zsizeimageparams(i_ctx_t *i_ctx_p)
push(3);
if (device_is_true_color(dev))
- bps = dev->color_info.depth / ncomp;
+ bps = dev->color_info.depth / ncomp;
else {
- /*
- * Set bps to the smallest allowable number of bits that is
- * sufficient to represent the number of different colors.
- */
- gx_color_value max_value =
- (dev->color_info.num_components == 1 ?
- dev->color_info.max_gray :
- max(dev->color_info.max_gray, dev->color_info.max_color));
- static const gx_color_value sizes[] = {
- 1, 2, 4, 8, 12, sizeof(gx_max_color_value) * 8
- };
- int i;
-
- for (i = 0;; ++i)
- if (max_value <= ((ulong) 1 << sizes[i]) - 1)
- break;
- bps = sizes[i];
+ /*
+ * Set bps to the smallest allowable number of bits that is
+ * sufficient to represent the number of different colors.
+ */
+ gx_color_value max_value =
+ (dev->color_info.num_components == 1 ?
+ dev->color_info.max_gray :
+ max(dev->color_info.max_gray, dev->color_info.max_color));
+ static const gx_color_value sizes[] = {
+ 1, 2, 4, 8, 12, sizeof(gx_max_color_value) * 8
+ };
+ int i;
+
+ for (i = 0;; ++i)
+ if (max_value <= ((ulong) 1 << sizes[i]) - 1)
+ break;
+ bps = sizes[i];
}
make_int(op - 2, bps);
make_false(op - 1);
@@ -347,11 +347,11 @@ xywh_param(os_ptr op, double rect[4])
int code = num_params(op, 4, rect);
if (code < 0)
- return code;
+ return code;
if (rect[2] < 0)
- rect[0] += rect[2], rect[2] = -rect[2];
+ rect[0] += rect[2], rect[2] = -rect[2];
if (rect[3] < 0)
- rect[1] += rect[3], rect[3] = -rect[3];
+ rect[1] += rect[3], rect[3] = -rect[3];
return code;
}
@@ -361,16 +361,16 @@ begin_composite(i_ctx_t *i_ctx_p, alpha_composite_state_t * pcp)
{
gx_device *dev = gs_currentdevice(igs);
int code =
- gs_create_composite_alpha(&pcp->pcte, &pcp->params, imemory);
+ gs_create_composite_alpha(&pcp->pcte, &pcp->params, imemory);
if (code < 0)
- return code;
+ return code;
pcp->orig_dev = pcp->cdev = dev; /* for end_composite */
code = (*dev_proc(dev, create_compositor))
- (dev, &pcp->cdev, pcp->pcte, (gs_imager_state *)igs, imemory, NULL);
+ (dev, &pcp->cdev, pcp->pcte, (gs_imager_state *)igs, imemory, NULL);
if (code < 0) {
- end_composite(i_ctx_p, pcp);
- return code;
+ end_composite(i_ctx_p, pcp);
+ return code;
}
gs_setdevice_no_init(igs, pcp->cdev);
return 0;
@@ -382,8 +382,8 @@ end_composite(i_ctx_t *i_ctx_p, alpha_composite_state_t * pcp)
{
/* Close and free the compositor and the compositing object. */
if (pcp->cdev != pcp->orig_dev) {
- gs_closedevice(pcp->cdev); /* also frees the device */
- gs_setdevice_no_init(igs, pcp->orig_dev);
+ gs_closedevice(pcp->cdev); /* also frees the device */
+ gs_setdevice_no_init(igs, pcp->orig_dev);
}
ifree_object(pcp->pcte, "end_composite(gs_composite_t)");
}
@@ -406,52 +406,52 @@ device_is_true_color(gx_device * dev)
/****** DOESN'T HANDLE INVERSION YET ******/
switch (ncomp) {
- case 1: /* gray-scale */
- max_v = dev->color_info.max_gray;
- if (max_v != (1 << depth) - 1)
- return 0;
- for (i = 0; i <= max_v; ++i) {
- gx_color_value v[3];
+ case 1: /* gray-scale */
+ max_v = dev->color_info.max_gray;
+ if (max_v != (1 << depth) - 1)
+ return 0;
+ for (i = 0; i <= max_v; ++i) {
+ gx_color_value v[3];
v[0] = v[1] = v[2] = CV(i);
- if ((*dev_proc(dev, map_rgb_color)) (dev, v) != i)
- return 0;
- }
- return true;
- case 3: /* RGB */
- max_v = dev->color_info.max_color;
- if (depth % 3 != 0 || max_v != (1 << (depth / 3)) - 1)
- return false;
- {
- const int gs = depth / 3, rs = gs * 2;
-
- for (i = 0; i <= max_v; ++i) {
- gx_color_value red[3];
+ if ((*dev_proc(dev, map_rgb_color)) (dev, v) != i)
+ return 0;
+ }
+ return true;
+ case 3: /* RGB */
+ max_v = dev->color_info.max_color;
+ if (depth % 3 != 0 || max_v != (1 << (depth / 3)) - 1)
+ return false;
+ {
+ const int gs = depth / 3, rs = gs * 2;
+
+ for (i = 0; i <= max_v; ++i) {
+ gx_color_value red[3];
gx_color_value green[3];
gx_color_value blue[3];
red[0] = CV(i); red[1] = CV0, red[2] = CV0;
green[0] = CV0; green[1] = CV(i); green[2] = CV0;
blue[0] = CV0; blue[1] = CV0; blue[2] = CV(i);
- if ((*dev_proc(dev, map_rgb_color)) (dev, red) !=
- i << rs ||
- (*dev_proc(dev, map_rgb_color)) (dev, green) !=
- i << gs ||
- (*dev_proc(dev, map_rgb_color)) (dev, blue) !=
- i /*<< bs */
- )
- return 0;
- }
- }
- return true;
- case 4: /* CMYK */
- max_v = dev->color_info.max_color;
- if ((depth & 3) != 0 || max_v != (1 << (depth / 4)) - 1)
- return false;
- {
- const int ys = depth / 4, ms = ys * 2, cs = ys * 3;
-
- for (i = 0; i <= max_v; ++i) {
-
- gx_color_value cyan[4];
+ if ((*dev_proc(dev, map_rgb_color)) (dev, red) !=
+ i << rs ||
+ (*dev_proc(dev, map_rgb_color)) (dev, green) !=
+ i << gs ||
+ (*dev_proc(dev, map_rgb_color)) (dev, blue) !=
+ i /*<< bs */
+ )
+ return 0;
+ }
+ }
+ return true;
+ case 4: /* CMYK */
+ max_v = dev->color_info.max_color;
+ if ((depth & 3) != 0 || max_v != (1 << (depth / 4)) - 1)
+ return false;
+ {
+ const int ys = depth / 4, ms = ys * 2, cs = ys * 3;
+
+ for (i = 0; i <= max_v; ++i) {
+
+ gx_color_value cyan[4];
gx_color_value magenta[4];
gx_color_value yellow[4];
gx_color_value black[4];
@@ -459,21 +459,21 @@ device_is_true_color(gx_device * dev)
magenta[1] = CV(i); magenta[0] = magenta[2] = magenta[3] = CV0;
yellow[2] = CV(i); yellow[0] = yellow[1] = yellow[3] = CV0;
black[3] = CV(i); black[0] = black[1] = black[2] = CV0;
- if ((*dev_proc(dev, map_cmyk_color)) (dev, cyan) !=
- i << cs ||
- (*dev_proc(dev, map_cmyk_color)) (dev, magenta) !=
- i << ms ||
- (*dev_proc(dev, map_cmyk_color)) (dev, yellow) !=
- i << ys ||
- (*dev_proc(dev, map_cmyk_color)) (dev, black) !=
- i /*<< ks */
- )
- return 0;
- }
- }
- return 1;
- default:
- return 0; /* DeviceN */
+ if ((*dev_proc(dev, map_cmyk_color)) (dev, cyan) !=
+ i << cs ||
+ (*dev_proc(dev, map_cmyk_color)) (dev, magenta) !=
+ i << ms ||
+ (*dev_proc(dev, map_cmyk_color)) (dev, yellow) !=
+ i << ys ||
+ (*dev_proc(dev, map_cmyk_color)) (dev, black) !=
+ i /*<< ks */
+ )
+ return 0;
+ }
+ }
+ return 1;
+ default:
+ return 0; /* DeviceN */
}
#undef CV
#undef CV0
diff --git a/gs/psi/zdps.c b/gs/psi/zdps.c
index 19d305707..613388021 100644
--- a/gs/psi/zdps.c
+++ b/gs/psi/zdps.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,13 +49,13 @@ zsetscreenphase(i_ctx_t *i_ctx_p)
x = op[-1].value.intval;
y = op->value.intval;
if (op[-2].value.intval < -1 ||
- op[-2].value.intval >= gs_color_select_count
- )
- return_error(e_rangecheck);
+ op[-2].value.intval >= gs_color_select_count
+ )
+ return_error(e_rangecheck);
code = gs_setscreenphase(igs, x, y,
- (gs_color_select_t) op[-2].value.intval);
+ (gs_color_select_t) op[-2].value.intval);
if (code >= 0)
- pop(3);
+ pop(3);
return code;
}
@@ -69,13 +69,13 @@ zcurrentscreenphase(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < -1 ||
- op->value.intval >= gs_color_select_count
- )
- return_error(e_rangecheck);
+ op->value.intval >= gs_color_select_count
+ )
+ return_error(e_rangecheck);
code = gs_currentscreenphase(igs, &phase,
- (gs_color_select_t)op->value.intval);
+ (gs_color_select_t)op->value.intval);
if (code < 0)
- return code;
+ return code;
push(1);
make_int(op - 1, phase.x);
make_int(op, phase.y);
@@ -94,62 +94,62 @@ zimage2(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
{
- gs_image2_t image;
- ref *pDataSource;
+ gs_image2_t image;
+ ref *pDataSource;
- gs_image2_t_init(&image);
- if ((code = dict_matrix_param(imemory, op, "ImageMatrix",
- &image.ImageMatrix)) < 0 ||
- (code = dict_find_string(op, "DataSource", &pDataSource)) < 0 ||
- (code = dict_float_param(op, "XOrigin", 0.0,
- &image.XOrigin)) != 0 ||
- (code = dict_float_param(op, "YOrigin", 0.0,
- &image.YOrigin)) != 0 ||
- (code = dict_float_param(op, "Width", 0.0,
- &image.Width)) != 0 ||
- image.Width <= 0 ||
- (code = dict_float_param(op, "Height", 0.0,
- &image.Height)) != 0 ||
- image.Height <= 0 ||
- (code = dict_bool_param(op, "PixelCopy", false,
- &image.PixelCopy)) < 0
- )
- return (code < 0 ? code : gs_note_error(e_rangecheck));
- check_stype(*pDataSource, st_igstate_obj);
- image.DataSource = igstate_ptr(pDataSource);
- {
- ref *ignoref;
+ gs_image2_t_init(&image);
+ if ((code = dict_matrix_param(imemory, op, "ImageMatrix",
+ &image.ImageMatrix)) < 0 ||
+ (code = dict_find_string(op, "DataSource", &pDataSource)) < 0 ||
+ (code = dict_float_param(op, "XOrigin", 0.0,
+ &image.XOrigin)) != 0 ||
+ (code = dict_float_param(op, "YOrigin", 0.0,
+ &image.YOrigin)) != 0 ||
+ (code = dict_float_param(op, "Width", 0.0,
+ &image.Width)) != 0 ||
+ image.Width <= 0 ||
+ (code = dict_float_param(op, "Height", 0.0,
+ &image.Height)) != 0 ||
+ image.Height <= 0 ||
+ (code = dict_bool_param(op, "PixelCopy", false,
+ &image.PixelCopy)) < 0
+ )
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
+ check_stype(*pDataSource, st_igstate_obj);
+ image.DataSource = igstate_ptr(pDataSource);
+ {
+ ref *ignoref;
- if (dict_find_string(op, "UnpaintedPath", &ignoref) > 0) {
- check_dict_write(*op);
- image.UnpaintedPath = gx_path_alloc(imemory,
- ".image2 UnpaintedPath");
- if (image.UnpaintedPath == 0)
- return_error(e_VMerror);
- } else
- image.UnpaintedPath = 0;
- }
- code = process_non_source_image(i_ctx_p,
- (const gs_image_common_t *)&image,
- ".image2");
- if (image.UnpaintedPath) {
- ref rupath;
+ if (dict_find_string(op, "UnpaintedPath", &ignoref) > 0) {
+ check_dict_write(*op);
+ image.UnpaintedPath = gx_path_alloc(imemory,
+ ".image2 UnpaintedPath");
+ if (image.UnpaintedPath == 0)
+ return_error(e_VMerror);
+ } else
+ image.UnpaintedPath = 0;
+ }
+ code = process_non_source_image(i_ctx_p,
+ (const gs_image_common_t *)&image,
+ ".image2");
+ if (image.UnpaintedPath) {
+ ref rupath;
- if (code < 0)
- return code;
- if (gx_path_is_null(image.UnpaintedPath))
- make_null(&rupath);
- else
- code = make_upath(i_ctx_p, &rupath, igs, image.UnpaintedPath,
- false);
- gx_path_free(image.UnpaintedPath, ".image2 UnpaintedPath");
- if (code < 0)
- return code;
- code = idict_put_string(op, "UnpaintedPath", &rupath);
- }
+ if (code < 0)
+ return code;
+ if (gx_path_is_null(image.UnpaintedPath))
+ make_null(&rupath);
+ else
+ code = make_upath(i_ctx_p, &rupath, igs, image.UnpaintedPath,
+ false);
+ gx_path_free(image.UnpaintedPath, ".image2 UnpaintedPath");
+ if (code < 0)
+ return code;
+ code = idict_put_string(op, "UnpaintedPath", &rupath);
+ }
}
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -195,59 +195,59 @@ zdefineusername(i_ctx_t *i_ctx_p)
check_int_ltu(op[-1], max_array_size);
check_type(*op, t_name);
if (user_names_p == 0) {
- int code = create_names_array(&user_names_p, imemory_local,
- "defineusername");
+ int code = create_names_array(&user_names_p, imemory_local,
+ "defineusername");
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
- if (array_get(imemory, user_names_p,
- op[-1].value.intval, &uname) >= 0) {
- switch (r_type(&uname)) {
- case t_null:
- break;
- case t_name:
- if (name_eq(&uname, op))
- goto ret;
- /* falls through */
- default:
- return_error(e_invalidaccess);
- }
+ if (array_get(imemory, user_names_p,
+ op[-1].value.intval, &uname) >= 0) {
+ switch (r_type(&uname)) {
+ case t_null:
+ break;
+ case t_name:
+ if (name_eq(&uname, op))
+ goto ret;
+ /* falls through */
+ default:
+ return_error(e_invalidaccess);
+ }
} else { /* Expand the array. */
- ref new_array;
- uint old_size = r_size(user_names_p);
- uint new_size = (uint) op[-1].value.intval + 1;
+ ref new_array;
+ uint old_size = r_size(user_names_p);
+ uint new_size = (uint) op[-1].value.intval + 1;
- if (new_size < 100)
- new_size = 100;
- else if (new_size > max_array_size / 2)
- new_size = max_array_size;
- else if (new_size >> 1 < old_size)
- new_size = (old_size > max_array_size / 2 ? max_array_size :
- old_size << 1);
- else
- new_size <<= 1;
- /*
- * The user name array is allocated in stable local VM,
- * because it must be immune to save/restore.
- */
- {
- gs_ref_memory_t *slmem =
- (gs_ref_memory_t *)gs_memory_stable(imemory_local);
- int code;
+ if (new_size < 100)
+ new_size = 100;
+ else if (new_size > max_array_size / 2)
+ new_size = max_array_size;
+ else if (new_size >> 1 < old_size)
+ new_size = (old_size > max_array_size / 2 ? max_array_size :
+ old_size << 1);
+ else
+ new_size <<= 1;
+ /*
+ * The user name array is allocated in stable local VM,
+ * because it must be immune to save/restore.
+ */
+ {
+ gs_ref_memory_t *slmem =
+ (gs_ref_memory_t *)gs_memory_stable(imemory_local);
+ int code;
- code = gs_alloc_ref_array(slmem, &new_array, a_all, new_size,
- "defineusername(new)");
- if (code < 0)
- return code;
- refcpy_to_new(new_array.value.refs, user_names_p->value.refs,
- old_size, idmemory);
- refset_null(new_array.value.refs + old_size,
- new_size - old_size);
- if (old_size)
- gs_free_ref_array(slmem, user_names_p, "defineusername(old)");
- }
- ref_assign(user_names_p, &new_array);
+ code = gs_alloc_ref_array(slmem, &new_array, a_all, new_size,
+ "defineusername(new)");
+ if (code < 0)
+ return code;
+ refcpy_to_new(new_array.value.refs, user_names_p->value.refs,
+ old_size, idmemory);
+ refset_null(new_array.value.refs + old_size,
+ new_size - old_size);
+ if (old_size)
+ gs_free_ref_array(slmem, user_names_p, "defineusername(old)");
+ }
+ ref_assign(user_names_p, &new_array);
}
ref_assign(user_names_p->value.refs + op[-1].value.intval, op);
ret:
@@ -259,17 +259,17 @@ zdefineusername(i_ctx_t *i_ctx_p)
const op_def zdps_op_defs[] =
{
- /* Graphics state */
+ /* Graphics state */
{"1.currentscreenphase", zcurrentscreenphase},
{"3.setscreenphase", zsetscreenphase},
- /* Device-source images */
+ /* Device-source images */
{"1.image2", zimage2},
- /* View clipping */
+ /* View clipping */
{"0eoviewclip", zeoviewclip},
{"0initviewclip", zinitviewclip},
{"0viewclip", zviewclip},
{"0viewclippath", zviewclippath},
- /* User names */
+ /* User names */
{"2defineusername", zdefineusername},
op_def_end(0)
};
diff --git a/gs/psi/zdps1.c b/gs/psi/zdps1.c
index 46d420d1f..bc0f99031 100644
--- a/gs/psi/zdps1.c
+++ b/gs/psi/zdps1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,9 +45,9 @@ z1copy(i_ctx_t *i_ctx_p)
int code = zcopy(i_ctx_p);
if (code >= 0)
- return code;
+ return code;
if (!r_has_type(op, t_astruct))
- return code;
+ return code;
return zcopy_gstate(i_ctx_p);
}
@@ -97,7 +97,7 @@ gstate_check_space(i_ctx_t *i_ctx_p, int_gstate *isp, uint space)
*/
#if 1 /* ****** WORKAROUND ****** */
if (space != avm_local && imemory_save_level(iimemory) > 0)
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
#endif /* ****** END ****** */
#define gsref_check(p) store_check_space(space, p)
int_gstate_map_refs(isp, gsref_check);
@@ -117,14 +117,14 @@ zgstate(i_ctx_t *i_ctx_p)
int_gstate *isp;
if (code < 0)
- return code;
+ return code;
pigo = ialloc_struct(igstate_obj, &st_igstate_obj, "gstate");
if (pigo == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
pnew = gs_state_copy(igs, imemory);
if (pnew == 0) {
- ifree_object(pigo, "gstate");
- return_error(e_VMerror);
+ ifree_object(pigo, "gstate");
+ return_error(e_VMerror);
}
isp = gs_int_gstate(pnew);
int_gstate_map_refs(isp, ref_mark_new);
@@ -135,7 +135,7 @@ zgstate(i_ctx_t *i_ctx_p)
* automatically; we have to make sure this ref is on the changes chain.
*/
make_iastruct(op, a_all, pigo);
-#if 0 /* Bug 689849 "gstate leaks memory" */
+#if 0 /* Bug 689849 "gstate leaks memory" */
make_null(&pigo->gstate);
ref_save(op, &pigo->gstate, "gstate");
make_istruct_new(&pigo->gstate, 0, pnew);
@@ -162,13 +162,13 @@ zcopy_gstate(i_ctx_t *i_ctx_p)
check_write(*op);
code = gstate_unshare(i_ctx_p);
if (code < 0)
- return code;
+ return code;
pgs = igstate_ptr(op);
pgs1 = igstate_ptr(op1);
pistate = gs_int_gstate(pgs);
code = gstate_check_space(i_ctx_p, gs_int_gstate(pgs1), r_space(op));
if (code < 0)
- return code;
+ return code;
#define gsref_save(p) ref_save(op, p, "copygstate")
int_gstate_map_refs(pistate, gsref_save);
#undef gsref_save
@@ -176,7 +176,7 @@ zcopy_gstate(i_ctx_t *i_ctx_p)
code = gs_copygstate(pgs, pgs1);
gs_state_swap_memory(pgs, mem);
if (code < 0)
- return code;
+ return code;
int_gstate_map_refs(pistate, ref_mark_new);
*op1 = *op;
pop(1);
@@ -197,12 +197,12 @@ zcurrentgstate(i_ctx_t *i_ctx_p)
check_write(*op);
code = gstate_unshare(i_ctx_p);
if (code < 0)
- return code;
+ return code;
pgs = igstate_ptr(op);
pistate = gs_int_gstate(pgs);
code = gstate_check_space(i_ctx_p, istate, r_space(op));
if (code < 0)
- return code;
+ return code;
#define gsref_save(p) ref_save(op, p, "currentgstate")
int_gstate_map_refs(pistate, gsref_save);
#undef gsref_save
@@ -210,7 +210,7 @@ zcurrentgstate(i_ctx_t *i_ctx_p)
code = gs_currentgstate(pgs, igs);
gs_state_swap_memory(pgs, mem);
if (code < 0)
- return code;
+ return code;
int_gstate_map_refs(pistate, ref_mark_new);
return 0;
}
@@ -226,7 +226,7 @@ zsetgstate(i_ctx_t *i_ctx_p)
check_read(*op);
code = gs_setgstate(igs, igstate_ptr(op));
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -259,11 +259,11 @@ zrectappend(i_ctx_t *i_ctx_p)
int code;
if (npop < 0)
- return npop;
+ return npop;
code = gs_rectappend(igs, lr.pr, lr.count);
rect_release(&lr, imemory);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -279,11 +279,11 @@ zrectclip(i_ctx_t *i_ctx_p)
int code;
if (npop < 0)
- return npop;
+ return npop;
code = gs_rectclip(igs, lr.pr, lr.count);
rect_release(&lr, imemory);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -299,11 +299,11 @@ zrectfill(i_ctx_t *i_ctx_p)
int code;
if (npop < 0)
- return npop;
+ return npop;
code = gs_rectfill(igs, lr.pr, lr.count);
rect_release(&lr, imemory);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -319,22 +319,22 @@ zrectstroke(i_ctx_t *i_ctx_p)
int npop, code;
if (read_matrix(imemory, op, &mat) >= 0) {
- /* Concatenate the matrix to the CTM just before stroking the path. */
- npop = rect_get(&lr, op - 1, imemory);
- if (npop < 0)
- return npop;
- code = gs_rectstroke(igs, lr.pr, lr.count, &mat);
- npop++;
+ /* Concatenate the matrix to the CTM just before stroking the path. */
+ npop = rect_get(&lr, op - 1, imemory);
+ if (npop < 0)
+ return npop;
+ code = gs_rectstroke(igs, lr.pr, lr.count, &mat);
+ npop++;
} else {
- /* No matrix. */
- npop = rect_get(&lr, op, imemory);
- if (npop < 0)
- return npop;
- code = gs_rectstroke(igs, lr.pr, lr.count, (gs_matrix *) 0);
+ /* No matrix. */
+ npop = rect_get(&lr, op, imemory);
+ if (npop < 0)
+ return npop;
+ code = gs_rectstroke(igs, lr.pr, lr.count, (gs_matrix *) 0);
}
rect_release(&lr, imemory);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -352,59 +352,59 @@ rect_get(local_rects_t * plr, os_ptr op, gs_memory_t *mem)
double rv[4];
switch (r_type(op)) {
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- case t_string:
- code = num_array_format(op);
- if (code < 0)
- return code;
- format = code;
- count = num_array_size(op, format);
- if (count % 4)
- return_error(e_typecheck);
- count /= 4;
- break;
- default: /* better be 4 numbers */
- code = num_params(op, 4, rv);
- if (code < 0)
- return code;
- plr->pr = plr->rl;
- plr->count = 1;
- plr->rl[0].q.x = (plr->rl[0].p.x = rv[0]) + rv[2];
- plr->rl[0].q.y = (plr->rl[0].p.y = rv[1]) + rv[3];
- return 4;
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ case t_string:
+ code = num_array_format(op);
+ if (code < 0)
+ return code;
+ format = code;
+ count = num_array_size(op, format);
+ if (count % 4)
+ return_error(e_typecheck);
+ count /= 4;
+ break;
+ default: /* better be 4 numbers */
+ code = num_params(op, 4, rv);
+ if (code < 0)
+ return code;
+ plr->pr = plr->rl;
+ plr->count = 1;
+ plr->rl[0].q.x = (plr->rl[0].p.x = rv[0]) + rv[2];
+ plr->rl[0].q.y = (plr->rl[0].p.y = rv[1]) + rv[3];
+ return 4;
}
plr->count = count;
if (count <= MAX_LOCAL_RECTS)
- pr = plr->rl;
+ pr = plr->rl;
else {
- pr = (gs_rect *)gs_alloc_byte_array(mem, count, sizeof(gs_rect),
- "rect_get");
- if (pr == 0)
- return_error(e_VMerror);
+ pr = (gs_rect *)gs_alloc_byte_array(mem, count, sizeof(gs_rect),
+ "rect_get");
+ if (pr == 0)
+ return_error(e_VMerror);
}
plr->pr = pr;
for (n = 0; n < count; n++, pr++) {
- ref rnum;
- int i;
-
- for (i = 0; i < 4; i++) {
- code = num_array_get(mem, (const ref *)op, format,
- (n << 2) + i, &rnum);
- switch (code) {
- case t_integer:
- rv[i] = rnum.value.intval;
- break;
- case t_real:
- rv[i] = rnum.value.realval;
- break;
- default: /* code < 0 */
- return code;
- }
- }
- pr->q.x = (pr->p.x = rv[0]) + rv[2];
- pr->q.y = (pr->p.y = rv[1]) + rv[3];
+ ref rnum;
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ code = num_array_get(mem, (const ref *)op, format,
+ (n << 2) + i, &rnum);
+ switch (code) {
+ case t_integer:
+ rv[i] = rnum.value.intval;
+ break;
+ case t_real:
+ rv[i] = rnum.value.realval;
+ break;
+ default: /* code < 0 */
+ return code;
+ }
+ }
+ pr->q.x = (pr->p.x = rv[0]) + rv[2];
+ pr->q.y = (pr->p.y = rv[1]) + rv[3];
}
return 1;
}
@@ -414,7 +414,7 @@ static void
rect_release(local_rects_t * plr, gs_memory_t *mem)
{
if (plr->pr != plr->rl)
- gs_free_object(mem, plr->pr, "rect_release");
+ gs_free_object(mem, plr->pr, "rect_release");
}
/* ------ Graphics state ------ */
@@ -429,9 +429,9 @@ zsetbbox(i_ctx_t *i_ctx_p)
int code = num_params(op, 4, box);
if (code < 0)
- return code;
+ return code;
if ((code = gs_setbbox(igs, box[0], box[1], box[2], box[3])) < 0)
- return code;
+ return code;
pop(4);
return 0;
}
@@ -441,20 +441,20 @@ zsetbbox(i_ctx_t *i_ctx_p)
const op_def zdps1_l2_op_defs[] =
{
op_def_begin_level2(),
- /* Graphics state */
+ /* Graphics state */
{"0currentstrokeadjust", zcurrentstrokeadjust},
{"1setstrokeadjust", zsetstrokeadjust},
- /* Graphics state objects */
+ /* Graphics state objects */
{"1copy", z1copy},
{"1currentgstate", zcurrentgstate},
{"0gstate", zgstate},
{"1setgstate", zsetgstate},
- /* Rectangles */
+ /* Rectangles */
{"1.rectappend", zrectappend},
{"1rectclip", zrectclip},
{"1rectfill", zrectfill},
{"1rectstroke", zrectstroke},
- /* Graphics state components */
+ /* Graphics state components */
{"4setbbox", zsetbbox},
op_def_end(0)
};
@@ -473,11 +473,11 @@ gstate_unshare(i_ctx_t *i_ctx_p)
int_gstate *isp;
if (!ref_must_save(pgsref))
- return 0;
+ return 0;
/* Copy the gstate. */
pnew = gs_gstate(pgs);
if (pnew == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
isp = gs_int_gstate(pnew);
int_gstate_map_refs(isp, ref_mark_new);
ref_do_save(op, pgsref, "gstate_unshare");
diff --git a/gs/psi/zdscpars.c b/gs/psi/zdscpars.c
index bb9e6f9e2..6c3e5745d 100644
--- a/gs/psi/zdscpars.c
+++ b/gs/psi/zdscpars.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -115,7 +115,7 @@ static const char * const dsc_dict_name = "DSC_struct";
*/
static int
dsc_error_handler(void *caller_data, CDSC *dsc, unsigned int explanation,
- const char *line, unsigned int line_len)
+ const char *line, unsigned int line_len)
{
return CDSC_OK;
}
@@ -133,19 +133,19 @@ zinitialize_dsc_parser(i_ctx_t *i_ctx_p)
dict * const pdict = op->value.pdict;
gs_memory_t * const mem = (gs_memory_t *)dict_memory(pdict);
dsc_data_t * const data =
- gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
+ gs_alloc_struct(mem, dsc_data_t, &st_dsc_data_t, "DSC parser init");
if (!data)
return_error(e_VMerror);
data->document_level = 0;
data->dsc_data_ptr = dsc_init((void *) "Ghostscript DSC parsing");
if (!data->dsc_data_ptr)
- return_error(e_VMerror);
+ return_error(e_VMerror);
dsc_set_error_function(data->dsc_data_ptr, dsc_error_handler);
make_astruct(&local_ref, a_readonly | r_space(op), (byte *) data);
code = idict_put_string(op, dsc_dict_name, &local_ref);
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -158,11 +158,10 @@ dsc_finalize(void *vptr)
dsc_data_t * const st = vptr;
if (st->dsc_data_ptr)
- dsc_free(st->dsc_data_ptr);
+ dsc_free(st->dsc_data_ptr);
st->dsc_data_ptr = NULL;
}
-
/* ---------------- Parsing ---------------- */
/* ------ Utilities for returning values ------ */
@@ -177,7 +176,7 @@ dsc_put_int(gs_param_list *plist, const char *keyname, int value)
/* Return a string value. */
static int
dsc_put_string(gs_param_list *plist, const char *keyname,
- const char *string)
+ const char *string)
{
gs_param_string str;
@@ -188,14 +187,14 @@ dsc_put_string(gs_param_list *plist, const char *keyname,
/* Return a BoundingBox value. */
static int
dsc_put_bounding_box(gs_param_list *plist, const char *keyname,
- const CDSCBBOX *pbbox)
+ const CDSCBBOX *pbbox)
{
/* pbbox is NULL iff the bounding box values was "(atend)". */
int values[4];
gs_param_int_array va;
if (!pbbox)
- return 0;
+ return 0;
values[0] = pbbox->llx;
values[1] = pbbox->lly;
values[2] = pbbox->urx;
@@ -255,7 +254,7 @@ dsc_page(gs_param_list *plist, const CDSC *pData)
if (page_num) /* If we have page information */
return dsc_put_int(plist, "PageNum",
- pData->page[page_num - 1].ordinal );
+ pData->page[page_num - 1].ordinal );
else /* No page info - so return page=0 */
return dsc_put_int(plist, "PageNum", 0 );
}
@@ -298,18 +297,18 @@ dsc_page_orientation(gs_param_list *plist, const CDSC *pData)
* will be in page_orientation.
*/
if (page_num && pData->page[page_num - 1].orientation != CDSC_ORIENT_UNKNOWN)
- return dsc_put_int(plist, "PageOrientation",
- convert_orient(pData->page[page_num - 1].orientation));
+ return dsc_put_int(plist, "PageOrientation",
+ convert_orient(pData->page[page_num - 1].orientation));
else
return dsc_put_int(plist, "Orientation",
- convert_orient(pData->page_orientation));
+ convert_orient(pData->page_orientation));
}
static int
dsc_orientation(gs_param_list *plist, const CDSC *pData)
{
- return dsc_put_int(plist, "Orientation",
- convert_orient(pData->page_orientation));
+ return dsc_put_int(plist, "Orientation",
+ convert_orient(pData->page_orientation));
}
static int
@@ -326,11 +325,11 @@ dsc_viewing_orientation(gs_param_list *plist, const CDSC *pData)
* 'defaults' section or in a page section.
*/
if (page_num && pData->page[page_num - 1].viewing_orientation != NULL) {
- key = "PageViewingOrientation";
- pctm = pData->page[page_num - 1].viewing_orientation;
+ key = "PageViewingOrientation";
+ pctm = pData->page[page_num - 1].viewing_orientation;
} else {
key = "ViewingOrientation";
- pctm = pData->viewing_orientation;
+ pctm = pData->viewing_orientation;
}
values[0] = pctm->xx;
values[1] = pctm->xy;
@@ -350,12 +349,12 @@ typedef struct cmdlist_s {
int code; /* Russell's DSC parser code (see dsc.h) */
const char *comment_name; /* A name to be returned to postscript caller */
int (*dsc_proc) (gs_param_list *, const CDSC *);
- /* A routine for transferring parameter values
- from C data structure to postscript dictionary
- key/value pairs. */
+ /* A routine for transferring parameter values
+ from C data structure to postscript dictionary
+ key/value pairs. */
} cmdlist_t;
-static const cmdlist_t DSCcmdlist[] = {
+static const cmdlist_t DSCcmdlist[] = {
{ CDSC_PSADOBE, "Header", dsc_adobe_header },
{ CDSC_CREATOR, "Creator", dsc_creator },
{ CDSC_CREATIONDATE, "CreationDate", dsc_creation_date },
@@ -437,13 +436,13 @@ zparse_dsc_comments(i_ctx_t *i_ctx_p)
*/
while (*pBadList && strncmp(*pBadList, dsc_buffer, strlen(*pBadList)))
pBadList++;
- if (*pBadList) { /* If found in list, then skip comment */
+ if (*pBadList) { /* If found in list, then skip comment */
comment_code = 0; /* Ignore */
if (dsc_buffer[2] == 'B') {
- dsc_state->document_level++;
- } else if (dsc_state->document_level > 0) {
+ dsc_state->document_level++;
+ } else if (dsc_state->document_level > 0) {
dsc_state->document_level--;
- }
+ }
}
else if (dsc_state->document_level > 0) {
comment_code = 0; /* Ignore */
@@ -455,29 +454,29 @@ zparse_dsc_comments(i_ctx_t *i_ctx_p)
*/
comment_code = dsc_scan_data(dsc_state->dsc_data_ptr, dsc_buffer, ssize + 1);
if_debug1('%', "[%%].parse_dsc_comments: code = %d\n", comment_code);
- /*
- * We ignore any errors from Russell's parser. The only value that
- * it will return for an error is -1 so there is very little information.
- * We also do not want bad DSC comments to abort processing of an
- * otherwise valid PS file.
- */
+ /*
+ * We ignore any errors from Russell's parser. The only value that
+ * it will return for an error is -1 so there is very little information.
+ * We also do not want bad DSC comments to abort processing of an
+ * otherwise valid PS file.
+ */
if (comment_code < 0)
- comment_code = 0;
+ comment_code = 0;
}
/*
* Transfer data from DSC structure to postscript variables.
* Look up proper handler in the local cmd decode list.
*/
while (pCmdList->code && pCmdList->code != comment_code )
- pCmdList++;
+ pCmdList++;
if (pCmdList->dsc_proc) {
- code = dict_param_list_write(&list, opDict, NULL, iimemory);
- if (code < 0)
- return code;
- code = (pCmdList->dsc_proc)((gs_param_list *)&list, dsc_state->dsc_data_ptr);
- iparam_list_release(&list);
- if (code < 0)
- return code;
+ code = dict_param_list_write(&list, opDict, NULL, iimemory);
+ if (code < 0)
+ return code;
+ code = (pCmdList->dsc_proc)((gs_param_list *)&list, dsc_state->dsc_data_ptr);
+ iparam_list_release(&list);
+ if (code < 0)
+ return code;
}
/* Put DSC comment name onto operand stack (replace string). */
diff --git a/gs/psi/zfaes.c b/gs/psi/zfaes.c
index 857eaaa81..e6194b38c 100644
--- a/gs/psi/zfaes.c
+++ b/gs/psi/zfaes.c
@@ -42,13 +42,13 @@ z_aes_d(i_ctx_t * i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
if (dict_find_string(op, "Key", &sop) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
s_aes_set_key(&state, sop->value.const_bytes, r_size(sop));
/* extract the padding flag, which defaults to true for compatibility */
if (dict_bool_param(op, "Padding", 1, &use_padding) < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
s_aes_set_padding(&state, use_padding);
@@ -58,7 +58,7 @@ z_aes_d(i_ctx_t * i_ctx_p)
it's coding. this caused no trouble when we were the arcfour cipher
and maintained no pointers. */
return filter_read(i_ctx_p, 0, &s_aes_template,
- (stream_state *) & state, 0);
+ (stream_state *) & state, 0);
}
/* Match the above routine to its postscript filter name.
diff --git a/gs/psi/zfapi.c b/gs/psi/zfapi.c
index 439808769..f4e75a0c2 100644
--- a/gs/psi/zfapi.c
+++ b/gs/psi/zfapi.c
@@ -132,7 +132,7 @@ static int add_line(FAPI_path *I, int64_t x, int64_t y)
static int add_curve(FAPI_path *I, int64_t x0, int64_t y0, int64_t x1, int64_t y1, int64_t x2, int64_t y2)
{ FAPI_outline_handler *olh = (FAPI_outline_handler *)I->olh;
-
+
x0 = import_shift(x0, I->shift) + olh->x0;
y0 = -import_shift(y0, I->shift) + olh->y0;
x1 = import_shift(x1, I->shift) + olh->x0;
@@ -230,7 +230,7 @@ static ulong sfnts_reader_rlong(sfnts_reader *r)
static int sfnts_reader_rstring(sfnts_reader *r, byte *v, int length)
{
int rlength = length;
-
+
if (length <= 0)
return(0);
while (!r->error) {
@@ -480,7 +480,7 @@ static ushort FAPI_FF_get_word(FAPI_font *ff, fapi_font_feature var_id, int inde
case FAPI_FONT_FEATURE_lenIV: return (ff->need_decrypt ? 0 : pfont->data.lenIV);
case FAPI_FONT_FEATURE_GlobalSubrs_count:
{ ref *Private, *GlobalSubrs;
- if (pfont->FontType == ft_encrypted2) {
+ if (pfont->FontType == ft_encrypted2) {
if (dict_find_string(pdr, "Private", &Private) <= 0)
return 0;
if (dict_find_string(Private, "GlobalSubrs", &GlobalSubrs) <= 0)
@@ -952,15 +952,13 @@ static bool get_MetricsCount(FAPI_font *ff)
return 0;
}
-
-
static int get_charstring(FAPI_font *ff, int char_code, ref **proc)
{
ref *CharStrings, char_name;
ref *pdr = (ref *)ff->client_font_data2;
if (ff->is_type1) {
- if (ff->is_cid)
+ if (ff->is_cid)
return -1;
if (dict_find_string(pdr, "CharStrings", &CharStrings) <= 0)
return -1;
@@ -983,7 +981,7 @@ static int get_charstring(FAPI_font *ff, int char_code, ref **proc)
if (name_ref(ff->memory, (const byte *)".notdef", 7, &char_name, -1) < 0)
return -1;
}
- if (dict_find(CharStrings, &char_name, (ref **)proc) <= 0)
+ if (dict_find(CharStrings, &char_name, (ref **)proc) <= 0)
return -1;
}
return 0;
@@ -1052,14 +1050,14 @@ static int FAPI_FF_get_glyph(FAPI_font *ff, int char_code, byte *buf, ushort buf
return -1;
}
}
- if (r_has_type(glyph, t_array) || r_has_type(glyph, t_mixedarray))
+ if (r_has_type(glyph, t_array) || r_has_type(glyph, t_mixedarray))
return -1;
glyph_length = get_type1_data(ff, glyph, buf, buf_length);
}
} else { /* type 42 */
const byte *data_ptr;
int l = get_GlyphDirectory_data_ptr(ff->memory, pdr, char_code, &data_ptr);
-
+
/* We should only render the TT notdef if we've been told to - logic lifted from zchar42.c */
if (!i_ctx_p->RenderTTNotdef && ((ff->char_data_len == 7 && strncmp((const char *)ff->char_data, ".notdef", 7) == 0)
|| (ff->char_data_len > 9 && strncmp((const char *)ff->char_data, ".notdef~GS", 10) == 0))) {
@@ -1078,7 +1076,7 @@ static int FAPI_FF_get_glyph(FAPI_font *ff, int char_code, byte *buf, ushort buf
bool error = sfnt_get_glyph_offset(pdr, pfont42, char_code, &offset0);
glyph_length = (error ? -1 : pfont42->data.len_glyphs[char_code]);
-
+
if (buf != 0 && !error) {
sfnts_reader r;
sfnts_reader_init(&r, pdr);
@@ -1111,21 +1109,21 @@ static bool using_transparency_pattern (gs_state *pgs)
{
gx_device *dev = gs_currentdevice_inline(pgs);
int abits = 1;
-
+
if (dev_proc(dev, get_alpha_bits)) {
abits = (*dev_proc(dev, get_alpha_bits)) (dev, go_text);
}
-
+
return((!gs_color_writes_pure(pgs)) && dev->procs.begin_transparency_group != NULL && dev->procs.end_transparency_group != NULL);
}
static bool produce_outline_char (i_ctx_t *i_ctx_p, gs_show_enum *penum_s, gs_font_base *pbfont, int abits, gs_log2_scale_point *log2_scale)
{
gs_state *pgs = (gs_state *)penum_s->pis;
-
+
log2_scale->x = 0;
log2_scale->y = 0;
-
+
/* Checking both gx_compute_text_oversampling() result, and abits (below) may seem redundant,
* and hopefully it will be soon, but for now, gx_compute_text_oversampling() could opt to
* "oversample" sufficiently small glyphs (fwiw, I don't think gx_compute_text_oversampling is
@@ -1133,7 +1131,7 @@ static bool produce_outline_char (i_ctx_t *i_ctx_p, gs_show_enum *penum_s, gs_fo
* This was an old, partial solution for dropouts in small glyphs.
*/
gx_compute_text_oversampling(penum_s, (gs_font *)pbfont, abits, log2_scale);
-
+
return (pgs->in_charpath || pbfont->PaintType != 0 ||
(pgs->in_cachedevice != CACHE_DEVICE_CACHING && using_transparency_pattern ((gs_state *)penum_s->pis)) ||
(pgs->in_cachedevice != CACHE_DEVICE_CACHING && (log2_scale->x > 0 || log2_scale->y > 0)) ||
@@ -1544,24 +1542,24 @@ static int zFAPIrebuildfont(i_ctx_t *i_ctx_p)
}
pdata = (font_data *)pfont->client_data;
I = pbfont->FAPI;
-
+
if (r_type(&(pdata->BuildGlyph)) != t_null) {
has_buildglyph = true;
} else {
has_buildglyph = false;
}
-
+
if (r_type(&(pdata->BuildChar)) != t_null) {
has_buildchar = true;
} else {
has_buildchar = false;
}
-
+
/* This shouldn't happen, but just in case */
if (has_buildglyph == false && has_buildchar == false) {
has_buildglyph = true;
}
-
+
if (dict_find_string(op - 1, "Path", &v) <= 0 || !r_has_type(v, t_string))
v = NULL;
if (pfont->FontType == ft_CID_encrypted && v == NULL) {
@@ -1584,7 +1582,7 @@ static int zFAPIrebuildfont(i_ctx_t *i_ctx_p)
} else {
make_null(&pdata->BuildChar);
}
-
+
if (has_buildglyph == true) {
ref_assign_new(&pdata->BuildGlyph, &build.BuildGlyph);
} else {
@@ -1719,24 +1717,23 @@ static int fapi_image_uncached_glyph (i_ctx_t *i_ctx_p, gs_show_enum *penum, FAP
int sstr = rast->line_step;
dev1 = gs_currentdevice_inline(pgs); /* Possibly changed by zchar_set_cache. */
-
/* we can only safely use the gx_image_fill_masked() "shortcut" if we're drawing
* a "simple" colour, rather than a pattern.
*/
if (gs_color_writes_pure(pgs)) {
if (dstr != sstr) {
-
+
/* If the stride of the bitmap we've got doesn't match what the rest
* of the Ghostscript world expects, make one that does.
* Ghostscript aligns bitmap raster memory in a platform specific
* manner, so see gxbitmap.h for details.
- *
- * Ideally the padding bytes wouldn't matter, but currently the
- * clist code ends up compressing it using bitmap compression. To
- * ensure consistency across runs (and to get the best possible
- * compression ratios) we therefore set such bytes to zero. It would
- * be nicer if this was fixed in future.
+ *
+ * Ideally the padding bytes wouldn't matter, but currently the
+ * clist code ends up compressing it using bitmap compression. To
+ * ensure consistency across runs (and to get the best possible
+ * compression ratios) we therefore set such bytes to zero. It would
+ * be nicer if this was fixed in future.
*/
r = gs_alloc_bytes(penum->memory, dstr * rast->height, "fapi_finish_render_aux");
if (!r) {
@@ -1792,17 +1789,16 @@ static int fapi_image_uncached_glyph (i_ctx_t *i_ctx_p, gs_show_enum *penum, FAP
uint used;
int code1;
int x, y, w, h;
-
+
if (!pie) {
return_error(e_VMerror);
}
-
+
x = (floatp) (pgs->ctm.tx + (double)rast_orig_x / (1 << frac_pixel_shift) + 0.5);
y = (floatp) (pgs->ctm.ty + (double)rast_orig_y / (1 << frac_pixel_shift) + 0.5);
w = rast->width;
h = rast->height;
-
-
+
/* Make a matrix that will place the image */
/* at (x,y) with no transformation. */
gs_image_t_init_mask(&image, true);
@@ -1813,7 +1809,7 @@ static int fapi_image_uncached_glyph (i_ctx_t *i_ctx_p, gs_show_enum *penum, FAP
image.adjust = false;
code = gs_image_init(pie, &image, false, pgs);
nbytes = (rast->width + 7) >> 3;
-
+
switch (code) {
case 1: /* empty image */
code = 0;
@@ -1893,12 +1889,12 @@ static int fapi_finish_render_aux(i_ctx_t *i_ctx_p, gs_font_base *pbfont, FAPI_s
} else {
gs_in_cache_device_t in_cachedevice = pgs->in_cachedevice;
pgs->in_cachedevice = CACHE_DEVICE_NOT_CACHING;
-
+
pgs->fill_adjust.x = pgs->fill_adjust.y = 0;
-
+
if ((code = gs_fill(pgs)) < 0)
return code;
-
+
pgs->in_cachedevice = in_cachedevice;
}
if ((code = gs_moveto(pgs, pt.x, pt.y)) < 0)
@@ -2031,9 +2027,9 @@ static int FAPI_do_char(i_ctx_t *i_ctx_p, gs_font_base *pbfont, gx_device *dev,
SBW_SCALE,
SBW_FROM_RENDERER
} sbw_state = SBW_SCALE;
-
+
I->use_outline = false;
-
+
I->ff = ff_stub;
if(bBuildGlyph && !bCID) {
if (r_type(op) != t_name) {
@@ -2051,7 +2047,7 @@ static int FAPI_do_char(i_ctx_t *i_ctx_p, gs_font_base *pbfont, gx_device *dev,
if ((dict_find_string(op - 1, "CharStrings", &chstrs)) <= 0) {
return_error(e_undefined);
}
-
+
if ((dict_find_string(chstrs, ".notdef", &chs)) <= 0) {
return_error(e_undefined);
}
@@ -2074,10 +2070,10 @@ static int FAPI_do_char(i_ctx_t *i_ctx_p, gs_font_base *pbfont, gx_device *dev,
* 50% leeway on the maximum cache bitmap, just to be sure. Or the same maximum bitmap size
* used in gxchar.c
*/
- I->max_bitmap = pbfont->dir->ccache.upper + (pbfont->dir->ccache.upper >> 1) < MAX_TEMP_BITMAP_BITS ?
+ I->max_bitmap = pbfont->dir->ccache.upper + (pbfont->dir->ccache.upper >> 1) < MAX_TEMP_BITMAP_BITS ?
pbfont->dir->ccache.upper + (pbfont->dir->ccache.upper >> 1) : MAX_TEMP_BITMAP_BITS;
}
-
+
/* Compute the scale : */
if (!SHOW_IS(penum, TEXT_DO_NONE) && !I->use_outline) {
gs_currentcharmatrix(igs, NULL, 1); /* make char_tm valid */
@@ -2250,20 +2246,20 @@ retry_oversampling:
!r_has_type(&char_code1, t_integer))
return_error(e_invalidfont);
- c = char_code1.value.intval;
- I->check_cmap_for_GID(I, &c);
- if (c != 0)
- break;
- }
- } else {
- ref *CIDSystemInfo;
+ c = char_code1.value.intval;
+ I->check_cmap_for_GID(I, &c);
+ if (c != 0)
+ break;
+ }
+ } else {
+ ref *CIDSystemInfo;
ref *Ordering;
-
+
/* We only have to lookup the char code if we're *not* using an identity ordering */
if (dict_find_string(pdr, "CIDSystemInfo", &CIDSystemInfo) >= 0 && r_has_type(CIDSystemInfo, t_dictionary) &&
dict_find_string(CIDSystemInfo, "Ordering", &Ordering) >= 0 && r_has_type(Ordering, t_string) &&
strncmp((const char *)Ordering->value.bytes, "Identity", 8) != 0) {
-
+
code = cid_to_TT_charcode(imemory, Decoding, TT_cmap, SubstNWP,
client_char_code, &c, &src_type, &dst_type);
if (code < 0)
@@ -2282,8 +2278,8 @@ retry_oversampling:
c = client_char_code;
}
}
- cr.char_codes[0] = c;
- cr.is_glyph_index = is_glyph_index;
+ cr.char_codes[0] = c;
+ cr.is_glyph_index = is_glyph_index;
/* fixme : process the narrow/wide/proportional mapping type,
using src_type, dst_type. Should adjust the 'matrix' above.
Call get_font_proportional_feature for proper choice.
@@ -2305,7 +2301,7 @@ retry_oversampling:
*/
if (dict_find_string(pdr, "CIDMap", &CIDMap) > 0 && !r_has_type(CIDMap, t_name) &&
(r_has_type(CIDMap, t_array) || r_has_type(CIDMap, t_string))) {
-
+
if (r_has_type(CIDMap, t_array)) {
/* Too big for single string, so its an array of 2 strings */
@@ -2337,9 +2333,9 @@ retry_oversampling:
if (gs_debug_c('1') && (dict_find_string(systemdict,"QUIET", &pvalue)) > 0 &&
(r_has_type(pvalue, t_boolean) && pvalue->value.boolval == false)) {
char *glyphn;
-
+
name_string_ref (imemory, &char_name, &char_name);
-
+
glyphn = ref_to_string(&char_name, imemory, "FAPI_do_char");
if (glyphn) {
dprintf2(" Substituting .notdef for %s in the font %s \n", glyphn, pbfont->font_name.chars);
@@ -2347,7 +2343,7 @@ retry_oversampling:
}
}
#endif
-
+
cr.char_codes[0] = 0; /* .notdef */
if ((code = name_ref(imemory, (const byte *)".notdef", 7, &char_name, -1)) < 0)
return code;
@@ -2565,7 +2561,7 @@ retry_oversampling:
}
} else if (I->use_outline) {
-
+
code = I->get_char_outline_metrics(I, &I->ff, &cr, &metrics);
} else {
#if 0 /* Debug purpose only. */
@@ -2605,7 +2601,7 @@ retry_oversampling:
return o_push_estack;
}
}
-
+
if ((code = renderer_retcode(i_ctx_p, I, code)) < 0)
return code;
@@ -2623,7 +2619,7 @@ retry_oversampling:
char_bbox.p.y = min(char_bbox.p.y, pbfont->FontBBox.p.y);
char_bbox.q.x = max(char_bbox.q.x, pbfont->FontBBox.q.x);
char_bbox.q.y = max(char_bbox.q.y, pbfont->FontBBox.q.y);
- }
+ }
if (pbfont->PaintType != 0) {
float w = pbfont->StrokeWidth / 2;
@@ -2636,7 +2632,7 @@ retry_oversampling:
penum_s->fapi_glyph_shift.x = penum_s->fapi_glyph_shift.y = 0;
if (sbw_state == SBW_FROM_RENDERER) {
int can_replace_metrics;
-
+
if ((code = renderer_retcode(i_ctx_p, I, I->can_replace_metrics(I, &I->ff, &cr, &can_replace_metrics))) < 0)
return code;
@@ -2705,7 +2701,7 @@ retry_oversampling:
* from glyph code ? Currently we keep a compatibility
* to the native GS font renderer without a deep analyzis.
*/
-
+
if (igs->in_cachedevice == CACHE_DEVICE_CACHING) {
sbwp = sbw;
}
@@ -2715,7 +2711,7 @@ retry_oversampling:
* causes problems when we get to show_update().
*/
sbwp = NULL;
-
+
if (I->use_outline) {
/* HACK!!
* The decision about whether to cache has already been
@@ -2724,7 +2720,7 @@ retry_oversampling:
igs->in_cachedevice = CACHE_DEVICE_NOT_CACHING;
}
}
-
+
if (bCID)
code = zchar_set_cache(i_ctx_p, pbfont, op,
NULL, sbw + 2, &char_bbox,
@@ -2733,7 +2729,7 @@ retry_oversampling:
code = zchar_set_cache(i_ctx_p, pbfont, &char_name,
NULL, sbw + 2, &char_bbox,
fapi_finish_render, &exec_cont, sbwp);
-
+
if (code >= 0 && exec_cont != 0)
code = (*exec_cont)(i_ctx_p);
if (code != 0) {
@@ -2847,27 +2843,26 @@ static int do_FAPIpassfont(i_ctx_t *i_ctx_p, char *font_file_path, bool *success
ref *req, reqstr;
bool do_restart = false;
-
if (code < 0)
return code;
code = FAPI_get_xlatmap(i_ctx_p, &xlatmap); /* Useful for emulated fonts hooked with FAPI. */
if (code < 0)
return code;
pbfont = (gs_font_base *)pfont;
-
+
*success = false;
-
+
/* If the font dictionary contains a FAPIPlugInReq key, the the PS world wants us
* to try to use a specific FAPI plugin, so find it, and try it....
*/
if (dict_find_string(pdr, "FAPIPlugInReq", &req) >= 0 && r_type(req) == t_name) {
char *fapi_request;
name_string_ref (imemory, req, &reqstr);
-
+
fapi_request = ref_to_string(&reqstr, imemory, "FAPI_do_char");
if (fapi_request) {
dprintf1("Requested FAPI plugin: %s ", fapi_request);
-
+
while (h && (strncmp(h->I->d->type, "FAPI", 4) != 0 || strncmp(h->I->d->subtype, fapi_request, strlen(fapi_request)) != 0)) {
h = h->next;
}
@@ -2882,8 +2877,7 @@ static int do_FAPIpassfont(i_ctx_t *i_ctx_p, char *font_file_path, bool *success
gs_free_string(imemory, (byte *)fapi_request, strlen(fapi_request) + 1, "do_FAPIpassfont");
}
}
-
-
+
while (h) {
ref FAPI_ID;
FAPI_server *I;
@@ -2960,4 +2954,3 @@ const op_def zfapi_op_defs[] =
{"2.FAPIBuildGlyph9", zFAPIBuildGlyph9},
op_def_end(0)
};
-
diff --git a/gs/psi/zfarc4.c b/gs/psi/zfarc4.c
index 7403316d1..426896e46 100644
--- a/gs/psi/zfarc4.c
+++ b/gs/psi/zfarc4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,16 +42,16 @@ z_arcfour_d(i_ctx_t * i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
if (dict_find_string(op, "Key", &sop) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
s_arcfour_set_key(&state, sop->value.const_bytes, r_size(sop));
/* we pass npop=0, since we've no arguments left to consume */
- /* we pass 0 instead of the usual rspace(sop) will allocate storage for
+ /* we pass 0 instead of the usual rspace(sop) will allocate storage for
filter state from the same memory pool as the stream it's coding. this
causes no trouble because we maintain no pointers */
return filter_read(i_ctx_p, 0, &s_arcfour_template,
- (stream_state *) & state, 0);
+ (stream_state *) & state, 0);
}
/* encode version of the filter */
@@ -66,16 +66,16 @@ z_arcfour_e(i_ctx_t * i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
if (dict_find_string(op, "Key", &sop) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
s_arcfour_set_key(&state, sop->value.const_bytes, r_size(sop));
/* we pass npop=0, since we've no arguments left to consume */
- /* we pass 0 instead of the usual rspace(sop) will allocate storage for
+ /* we pass 0 instead of the usual rspace(sop) will allocate storage for
filter state from the same memory pool as the stream it's coding. this
causes no trouble because we maintain no pointers */
return filter_write(i_ctx_p, 0, &s_arcfour_template,
- (stream_state *) & state, 0);
+ (stream_state *) & state, 0);
}
/* Match the above routines to their postscript filter names.
diff --git a/gs/psi/zfbcp.c b/gs/psi/zfbcp.c
index 147fd3154..847f98f2a 100644
--- a/gs/psi/zfbcp.c
+++ b/gs/psi/zfbcp.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zfcid.c b/gs/psi/zfcid.c
index 5517bf40f..fbd31cb08 100644
--- a/gs/psi/zfcid.c
+++ b/gs/psi/zfcid.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@ cid_font_system_info_param(gs_cid_system_info_t *pcidsi, const ref *prfont)
ref *prcidsi;
if (dict_find_string(prfont, "CIDSystemInfo", &prcidsi) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return cid_system_info_param(pcidsi, prcidsi);
}
@@ -44,28 +44,28 @@ cid_font_data_param(os_ptr op, gs_font_cid_data *pdata, ref *pGlyphDirectory)
check_type(*op, t_dictionary);
if ((code = cid_font_system_info_param(&pdata->CIDSystemInfo, op)) < 0 ||
- (code = dict_int_param(op, "CIDCount", 0, max_int, -1,
- &pdata->CIDCount)) < 0
- )
- return code;
+ (code = dict_int_param(op, "CIDCount", 0, max_int, -1,
+ &pdata->CIDCount)) < 0
+ )
+ return code;
/*
* If the font doesn't have a GlyphDirectory, GDBytes is required.
* If it does have a GlyphDirectory, GDBytes may still be needed for
* CIDMap: it's up to the client to check this.
*/
if (dict_find_string(op, "GlyphDirectory", &pgdir) <= 0) {
- /* Standard CIDFont, require GDBytes. */
- make_null(pGlyphDirectory);
- return dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 0,
- &pdata->GDBytes);
+ /* Standard CIDFont, require GDBytes. */
+ make_null(pGlyphDirectory);
+ return dict_int_param(op, "GDBytes", 1, MAX_GDBytes, 0,
+ &pdata->GDBytes);
}
if (r_has_type(pgdir, t_dictionary) || r_is_array(pgdir)) {
- /* GlyphDirectory, GDBytes is optional. */
- *pGlyphDirectory = *pgdir;
- code = dict_int_param(op, "GDBytes", 0, MAX_GDBytes, 0,
- &pdata->GDBytes);
- return code;
+ /* GlyphDirectory, GDBytes is optional. */
+ *pGlyphDirectory = *pgdir;
+ code = dict_int_param(op, "GDBytes", 0, MAX_GDBytes, 0,
+ &pdata->GDBytes);
+ return code;
} else {
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
}
diff --git a/gs/psi/zfcid0.c b/gs/psi/zfcid0.c
index 707aba6f3..58780b866 100644
--- a/gs/psi/zfcid0.c
+++ b/gs/psi/zfcid0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,10 +53,10 @@ get_index(gs_glyph_data_t *pgd, int count, ulong *pval)
int i;
if (pgd->bits.size < count)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
*pval = 0;
for (i = 0; i < count; ++i)
- *pval = (*pval << 8) + pgd->bits.data[i];
+ *pval = (*pval << 8) + pgd->bits.data[i];
pgd->bits.data += count;
pgd->bits.size -= count;
return 0;
@@ -65,7 +65,7 @@ get_index(gs_glyph_data_t *pgd, int count, ulong *pval)
/* Get bytes from GlyphData or DataSource. */
static int
cid0_read_bytes(gs_font_cid0 *pfont, ulong base, uint count, byte *buf,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
const font_data *pfdata = pfont_data(pfont);
byte *data = buf;
@@ -74,96 +74,96 @@ cid0_read_bytes(gs_font_cid0 *pfont, ulong base, uint count, byte *buf,
/* Check for overflow. */
if (base != (long)base || base > base + count)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (r_has_type(&pfdata->u.cid0.DataSource, t_null)) {
- /* Get the bytes from GlyphData (a string or array of strings). */
- const ref *pgdata = &pfdata->u.cid0.GlyphData;
-
- if (r_has_type(pgdata, t_string)) { /* single string */
- uint size = r_size(pgdata);
-
- if (base >= size || count > size - base)
- return_error(e_rangecheck);
- data = pgdata->value.bytes + base;
- } else { /* array of strings */
- /*
- * The algorithm is similar to the one in
- * string_array_access_proc in zfont42.c, but it also has to
- * deal with the case where the requested string crosses array
- * elements.
- */
- ulong skip = base;
- uint copied = 0;
- uint index = 0;
- ref rstr;
- uint size;
-
- for (;; skip -= size, ++index) {
- int code = array_get(pfont->memory, pgdata, index, &rstr);
-
- if (code < 0)
- return code;
- if (!r_has_type(&rstr, t_string))
- return_error(e_typecheck);
- size = r_size(&rstr);
- if (skip < size)
- break;
- }
- size -= skip;
- if (count <= size) {
- data = rstr.value.bytes + skip;
- } else { /* multiple strings needed */
- if (data == 0) { /* no buffer provided */
- data = gs_alloc_string(pfont->memory, count,
- "cid0_read_bytes");
- if (data == 0)
- return_error(e_VMerror);
- gdfont = (gs_font *)pfont; /* newly allocated */
- }
- memcpy(data, rstr.value.bytes + skip, size);
- copied = size;
- while (copied < count) {
- int code = array_get(pfont->memory, pgdata, ++index, &rstr);
-
- if (code < 0)
- goto err;
- if (!r_has_type(&rstr, t_string)) {
- code = gs_note_error(e_typecheck);
- goto err;
- }
- size = r_size(&rstr);
- if (size > count - copied)
- size = count - copied;
- memcpy(data + copied, rstr.value.bytes, size);
- copied += size;
- }
- }
- }
+ /* Get the bytes from GlyphData (a string or array of strings). */
+ const ref *pgdata = &pfdata->u.cid0.GlyphData;
+
+ if (r_has_type(pgdata, t_string)) { /* single string */
+ uint size = r_size(pgdata);
+
+ if (base >= size || count > size - base)
+ return_error(e_rangecheck);
+ data = pgdata->value.bytes + base;
+ } else { /* array of strings */
+ /*
+ * The algorithm is similar to the one in
+ * string_array_access_proc in zfont42.c, but it also has to
+ * deal with the case where the requested string crosses array
+ * elements.
+ */
+ ulong skip = base;
+ uint copied = 0;
+ uint index = 0;
+ ref rstr;
+ uint size;
+
+ for (;; skip -= size, ++index) {
+ int code = array_get(pfont->memory, pgdata, index, &rstr);
+
+ if (code < 0)
+ return code;
+ if (!r_has_type(&rstr, t_string))
+ return_error(e_typecheck);
+ size = r_size(&rstr);
+ if (skip < size)
+ break;
+ }
+ size -= skip;
+ if (count <= size) {
+ data = rstr.value.bytes + skip;
+ } else { /* multiple strings needed */
+ if (data == 0) { /* no buffer provided */
+ data = gs_alloc_string(pfont->memory, count,
+ "cid0_read_bytes");
+ if (data == 0)
+ return_error(e_VMerror);
+ gdfont = (gs_font *)pfont; /* newly allocated */
+ }
+ memcpy(data, rstr.value.bytes + skip, size);
+ copied = size;
+ while (copied < count) {
+ int code = array_get(pfont->memory, pgdata, ++index, &rstr);
+
+ if (code < 0)
+ goto err;
+ if (!r_has_type(&rstr, t_string)) {
+ code = gs_note_error(e_typecheck);
+ goto err;
+ }
+ size = r_size(&rstr);
+ if (size > count - copied)
+ size = count - copied;
+ memcpy(data + copied, rstr.value.bytes, size);
+ copied += size;
+ }
+ }
+ }
} else {
- /* Get the bytes from DataSource (a stream). */
- stream *s;
- uint nread;
+ /* Get the bytes from DataSource (a stream). */
+ stream *s;
+ uint nread;
i_ctx_t *i_ctx_p = get_minst_from_memory(pfont->memory)->i_ctx_p;
- check_read_known_file(i_ctx_p, s, &pfdata->u.cid0.DataSource, return_error);
- if (sseek(s, base) < 0)
- return_error(e_ioerror);
- if (data == 0) { /* no buffer provided */
- data = gs_alloc_string(pfont->memory, count, "cid0_read_bytes");
- if (data == 0)
- return_error(e_VMerror);
- gdfont = (gs_font *)pfont; /* newly allocated */
- }
- if (sgets(s, data, count, &nread) < 0 || nread != count) {
- code = gs_note_error(e_ioerror);
- goto err;
- }
+ check_read_known_file(i_ctx_p, s, &pfdata->u.cid0.DataSource, return_error);
+ if (sseek(s, base) < 0)
+ return_error(e_ioerror);
+ if (data == 0) { /* no buffer provided */
+ data = gs_alloc_string(pfont->memory, count, "cid0_read_bytes");
+ if (data == 0)
+ return_error(e_VMerror);
+ gdfont = (gs_font *)pfont; /* newly allocated */
+ }
+ if (sgets(s, data, count, &nread) < 0 || nread != count) {
+ code = gs_note_error(e_ioerror);
+ goto err;
+ }
}
gs_glyph_data_from_string(pgd, data, count, gdfont);
return code;
err:
if (data != buf)
- gs_free_string(pfont->memory, data, count, "cid0_read_bytes");
+ gs_free_string(pfont->memory, data, count, "cid0_read_bytes");
return code;
}
@@ -172,7 +172,7 @@ cid0_read_bytes(gs_font_cid0 *pfont, ulong base, uint count, byte *buf,
/* Note that pgd may be NULL. */
static int
z9_glyph_data(gs_font_base *pbfont, gs_glyph glyph, gs_glyph_data_t *pgd,
- int *pfidx)
+ int *pfidx)
{
gs_font_cid0 *pfont = (gs_font_cid0 *)pbfont;
const font_data *pfdata = pfont_data(pfont);
@@ -184,74 +184,74 @@ z9_glyph_data(gs_font_base *pbfont, gs_glyph glyph, gs_glyph_data_t *pgd,
gdata.memory = pfont->memory;
if (!r_has_type(&pfdata->u.cid0.GlyphDirectory, t_null)) {
code = font_gdir_get_outline(pfont->memory,
- &pfdata->u.cid0.GlyphDirectory,
- glyph_index, &gdata);
- if (code < 0)
- return code;
- /* Get the definition from GlyphDirectory. */
- if (!gdata.bits.data)
- return_error(e_rangecheck);
- code = get_index(&gdata, pfont->cidata.FDBytes, &fidx);
- if (code < 0)
- return code;
- if (fidx >= pfont->cidata.FDArray_size)
- return_error(e_rangecheck);
- if (pgd)
- *pgd = gdata;
- *pfidx = (int)fidx;
- return code;
+ &pfdata->u.cid0.GlyphDirectory,
+ glyph_index, &gdata);
+ if (code < 0)
+ return code;
+ /* Get the definition from GlyphDirectory. */
+ if (!gdata.bits.data)
+ return_error(e_rangecheck);
+ code = get_index(&gdata, pfont->cidata.FDBytes, &fidx);
+ if (code < 0)
+ return code;
+ if (fidx >= pfont->cidata.FDArray_size)
+ return_error(e_rangecheck);
+ if (pgd)
+ *pgd = gdata;
+ *pfidx = (int)fidx;
+ return code;
}
/* Get the definition from the binary data (GlyphData or DataSource). */
if (glyph_index < 0 || glyph_index >= pfont->cidata.common.CIDCount) {
- *pfidx = 0;
- if (pgd)
- gs_glyph_data_from_null(pgd);
- return_error(e_rangecheck);
+ *pfidx = 0;
+ if (pgd)
+ gs_glyph_data_from_null(pgd);
+ return_error(e_rangecheck);
}
{
- byte fd_gd[(MAX_FDBytes + MAX_GDBytes) * 2];
- uint num_bytes = pfont->cidata.FDBytes + pfont->cidata.common.GDBytes;
- ulong base = pfont->cidata.CIDMapOffset + glyph_index * num_bytes;
- ulong gidx, fidx_next, gidx_next;
- int rcode = cid0_read_bytes(pfont, base, (ulong)(num_bytes * 2), fd_gd,
- &gdata);
- gs_glyph_data_t orig_data;
-
- if (rcode < 0)
- return rcode;
- orig_data = gdata;
- if ((code = get_index(&gdata, pfont->cidata.FDBytes, &fidx)) < 0 ||
- (code = get_index(&gdata, pfont->cidata.common.GDBytes, &gidx)) < 0 ||
- (code = get_index(&gdata, pfont->cidata.FDBytes, &fidx_next)) < 0 ||
- (code = get_index(&gdata, pfont->cidata.common.GDBytes, &gidx_next)) < 0
- )
- DO_NOTHING;
- gs_glyph_data_free(&orig_data, "z9_glyph_data");
- if (code < 0)
- return code;
- /*
- * Some CID fonts (from Adobe!) have invalid font indexes for
- * missing glyphs. Handle this now.
- */
- if (gidx_next <= gidx) { /* missing glyph */
- *pfidx = 0;
- if (pgd)
- gs_glyph_data_from_null(pgd);
- return_error(e_undefined);
- }
- if (fidx >= pfont->cidata.FDArray_size)
- return_error(e_rangecheck);
- *pfidx = (int)fidx;
- if (pgd == 0)
- return 0;
- return cid0_read_bytes(pfont, gidx, gidx_next - gidx, NULL, pgd);
+ byte fd_gd[(MAX_FDBytes + MAX_GDBytes) * 2];
+ uint num_bytes = pfont->cidata.FDBytes + pfont->cidata.common.GDBytes;
+ ulong base = pfont->cidata.CIDMapOffset + glyph_index * num_bytes;
+ ulong gidx, fidx_next, gidx_next;
+ int rcode = cid0_read_bytes(pfont, base, (ulong)(num_bytes * 2), fd_gd,
+ &gdata);
+ gs_glyph_data_t orig_data;
+
+ if (rcode < 0)
+ return rcode;
+ orig_data = gdata;
+ if ((code = get_index(&gdata, pfont->cidata.FDBytes, &fidx)) < 0 ||
+ (code = get_index(&gdata, pfont->cidata.common.GDBytes, &gidx)) < 0 ||
+ (code = get_index(&gdata, pfont->cidata.FDBytes, &fidx_next)) < 0 ||
+ (code = get_index(&gdata, pfont->cidata.common.GDBytes, &gidx_next)) < 0
+ )
+ DO_NOTHING;
+ gs_glyph_data_free(&orig_data, "z9_glyph_data");
+ if (code < 0)
+ return code;
+ /*
+ * Some CID fonts (from Adobe!) have invalid font indexes for
+ * missing glyphs. Handle this now.
+ */
+ if (gidx_next <= gidx) { /* missing glyph */
+ *pfidx = 0;
+ if (pgd)
+ gs_glyph_data_from_null(pgd);
+ return_error(e_undefined);
+ }
+ if (fidx >= pfont->cidata.FDArray_size)
+ return_error(e_rangecheck);
+ *pfidx = (int)fidx;
+ if (pgd == 0)
+ return 0;
+ return cid0_read_bytes(pfont, gidx, gidx_next - gidx, NULL, pgd);
}
}
/* Get the outline of a CIDFontType 0 glyph. */
static int
z9_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
gs_font_cid0 *const pfcid = (gs_font_cid0 *)font;
ref gref;
@@ -260,27 +260,26 @@ z9_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat
gdata.memory = font->memory;
code = pfcid->cidata.glyph_data((gs_font_base *)pfcid, glyph, &gdata,
- &fidx);
+ &fidx);
if (code < 0)
- return code;
+ return code;
glyph_ref(font->memory, glyph, &gref);
ocode = zcharstring_outline(pfcid->cidata.FDArray[fidx], WMode, &gref, &gdata,
- pmat, ppath, sbw);
+ pmat, ppath, sbw);
gs_glyph_data_free(&gdata, "z9_glyph_outline");
return ocode;
}
static int
z9_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{ /* fixme : same as z11_glyph_info. */
int wmode = (members & GLYPH_INFO_WIDTH0 ? 0 : 1);
- return z1_glyph_info_generic(font, glyph, pmat, members, info,
- &gs_default_glyph_info, wmode);
+ return z1_glyph_info_generic(font, glyph, pmat, members, info,
+ &gs_default_glyph_info, wmode);
}
-
/*
* The "fonts" in the FDArray don't have access to their outlines -- the
* outlines are always provided externally. Replace the accessor procedures
@@ -288,13 +287,13 @@ z9_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
*/
static int
z9_FDArray_glyph_data(gs_font_type1 * pfont, gs_glyph glyph,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
return_error(e_invalidfont);
}
static int
z9_FDArray_seac_data(gs_font_type1 *pfont, int ccode, gs_glyph *pglyph,
- gs_const_string *gstr, gs_glyph_data_t *pgd)
+ gs_const_string *gstr, gs_glyph_data_t *pgd)
{
return_error(e_invalidfont);
}
@@ -318,9 +317,9 @@ fd_array_element(i_ctx_t *i_ctx_p, gs_font_type1 **ppfont, ref *prfd)
int code = charstring_font_get_refs(prfd, &refs);
if (code < 0 ||
- (code = dict_int_param(prfd, "FontType", 1, 2, 1, &fonttype)) < 0
- )
- return code;
+ (code = dict_int_param(prfd, "FontType", 1, 2, 1, &fonttype)) < 0
+ )
+ return code;
/*
* We don't handle the alternate Subr representation (SubrCount,
* SDBytes, SubrMapOffset) here: currently that is handled in
@@ -328,34 +327,34 @@ fd_array_element(i_ctx_t *i_ctx_p, gs_font_type1 **ppfont, ref *prfd)
*/
switch (fonttype) {
case 1:
- data1.interpret = gs_type1_interpret;
- data1.subroutineNumberBias = 0;
- data1.lenIV = DEFAULT_LENIV_1;
- code = charstring_font_params(imemory, prfd, &refs, &data1);
- if (code < 0)
- return code;
- code = build_proc_name_refs(imemory, &build,
- "%Type1BuildChar", "%Type1BuildGlyph");
- break;
+ data1.interpret = gs_type1_interpret;
+ data1.subroutineNumberBias = 0;
+ data1.lenIV = DEFAULT_LENIV_1;
+ code = charstring_font_params(imemory, prfd, &refs, &data1);
+ if (code < 0)
+ return code;
+ code = build_proc_name_refs(imemory, &build,
+ "%Type1BuildChar", "%Type1BuildGlyph");
+ break;
case 2:
- code = type2_font_params(prfd, &refs, &data1);
- if (code < 0)
- return code;
- code = charstring_font_params(imemory, prfd, &refs, &data1);
- if (code < 0)
- return code;
- code = build_proc_name_refs(imemory, &build,
- "%Type2BuildChar", "%Type2BuildGlyph");
- break;
+ code = type2_font_params(prfd, &refs, &data1);
+ if (code < 0)
+ return code;
+ code = charstring_font_params(imemory, prfd, &refs, &data1);
+ if (code < 0)
+ return code;
+ code = build_proc_name_refs(imemory, &build,
+ "%Type2BuildChar", "%Type2BuildGlyph");
+ break;
default: /* can't happen */
- return_error(e_Fatal);
+ return_error(e_Fatal);
}
if (code < 0)
- return code;
+ return code;
code = build_gs_FDArray_font(i_ctx_p, prfd, &pbfont, fonttype,
- &st_gs_font_type1, &build);
+ &st_gs_font_type1, &build);
if (code < 0)
- return code;
+ return code;
pfont = (gs_font_type1 *)pbfont;
pbfont->FAPI = NULL;
pbfont->FAPI_font_data = NULL;
@@ -366,9 +365,7 @@ fd_array_element(i_ctx_t *i_ctx_p, gs_font_type1 **ppfont, ref *prfd)
return 0;
}
-
-
-static int
+static int
notify_remove_font_type9(void *proc_data, void *event_data)
{ /* Likely type 9 font descendents are never released explicitly.
So releaseing a type 9 font we must reset pointers in descendents.
@@ -376,12 +373,12 @@ notify_remove_font_type9(void *proc_data, void *event_data)
/* gs_font_finalize passes event_data == NULL, so check it here. */
if (event_data == NULL) {
gs_font_cid0 *pfcid = proc_data;
- int i;
+ int i;
- for (i = 0; i < pfcid->cidata.FDArray_size; ++i) {
- if (pfcid->cidata.FDArray[i]->data.parent == (gs_font_base *)pfcid)
- pfcid->cidata.FDArray[i]->data.parent = NULL;
- }
+ for (i = 0; i < pfcid->cidata.FDArray_size; ++i) {
+ if (pfcid->cidata.FDArray[i]->data.parent == (gs_font_base *)pfcid)
+ pfcid->cidata.FDArray[i]->data.parent = NULL;
+ }
}
return 0;
}
@@ -412,80 +409,80 @@ zbuildfont9(i_ctx_t *i_ctx_p)
* a (reusable) stream.
*/
if (code < 0 ||
- (code = cid_font_data_param(op, &common, &GlyphDirectory)) < 0 ||
- (code = dict_find_string(op, "FDArray", &prfda)) < 0 ||
- (code = dict_find_string(op, "CIDFontName", &pCIDFontName)) <= 0 ||
- (code = dict_int_param(op, "FDBytes", 0, MAX_FDBytes, -1, &FDBytes)) < 0
- )
- return code;
+ (code = cid_font_data_param(op, &common, &GlyphDirectory)) < 0 ||
+ (code = dict_find_string(op, "FDArray", &prfda)) < 0 ||
+ (code = dict_find_string(op, "CIDFontName", &pCIDFontName)) <= 0 ||
+ (code = dict_int_param(op, "FDBytes", 0, MAX_FDBytes, -1, &FDBytes)) < 0
+ )
+ return code;
/*
* Since build_gs_simple_font may resize the dictionary and cause
* pointers to become invalid, save CIDFontName
*/
CIDFontName = *pCIDFontName;
if (r_has_type(&GlyphDirectory, t_null)) {
- /* Standard CIDFont, require GlyphData and CIDMapOffset. */
- ref *pGlyphData;
-
- if ((code = dict_find_string(op, "GlyphData", &pGlyphData)) < 0 ||
- (code = dict_uint_param(op, "CIDMapOffset", 0, max_uint - 1,
- max_uint, &CIDMapOffset)) < 0)
- return code;
- GlyphData = *pGlyphData;
- if (r_has_type(&GlyphData, t_integer)) {
- ref *pds;
- stream *ignore_s;
-
- if ((code = dict_find_string(op, "DataSource", &pds)) < 0)
- return code;
- check_read_file(i_ctx_p, ignore_s, pds);
- DataSource = *pds;
- } else {
- if (!r_has_type(&GlyphData, t_string) && !r_is_array(&GlyphData))
- return_error(e_typecheck);
- make_null(&DataSource);
- }
+ /* Standard CIDFont, require GlyphData and CIDMapOffset. */
+ ref *pGlyphData;
+
+ if ((code = dict_find_string(op, "GlyphData", &pGlyphData)) < 0 ||
+ (code = dict_uint_param(op, "CIDMapOffset", 0, max_uint - 1,
+ max_uint, &CIDMapOffset)) < 0)
+ return code;
+ GlyphData = *pGlyphData;
+ if (r_has_type(&GlyphData, t_integer)) {
+ ref *pds;
+ stream *ignore_s;
+
+ if ((code = dict_find_string(op, "DataSource", &pds)) < 0)
+ return code;
+ check_read_file(i_ctx_p, ignore_s, pds);
+ DataSource = *pds;
+ } else {
+ if (!r_has_type(&GlyphData, t_string) && !r_is_array(&GlyphData))
+ return_error(e_typecheck);
+ make_null(&DataSource);
+ }
} else {
- make_null(&GlyphData);
- make_null(&DataSource);
- CIDMapOffset = 0;
+ make_null(&GlyphData);
+ make_null(&DataSource);
+ CIDMapOffset = 0;
}
if (!r_is_array(prfda))
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
FDArray_size = r_size(prfda);
if (FDArray_size == 0)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
FDArray = ialloc_struct_array(FDArray_size, gs_font_type1 *,
- &st_gs_font_type1_ptr_element,
- "buildfont9(FDarray)");
+ &st_gs_font_type1_ptr_element,
+ "buildfont9(FDarray)");
if (FDArray == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
memset(FDArray, 0, sizeof(gs_font_type1 *) * FDArray_size);
for (i = 0; i < FDArray_size; ++i) {
- ref rfd;
+ ref rfd;
- array_get(imemory, prfda, (long)i, &rfd);
- code = fd_array_element(i_ctx_p, &FDArray[i], &rfd);
- if (code < 0)
- goto fail;
+ array_get(imemory, prfda, (long)i, &rfd);
+ code = fd_array_element(i_ctx_p, &FDArray[i], &rfd);
+ if (code < 0)
+ goto fail;
}
- code = build_gs_outline_font(i_ctx_p, op, &pfont, ft_CID_encrypted,
- &st_gs_font_cid0, &build,
- bf_Encoding_optional | bf_UniqueID_ignored,
- build_gs_simple_font);
+ code = build_gs_outline_font(i_ctx_p, op, &pfont, ft_CID_encrypted,
+ &st_gs_font_cid0, &build,
+ bf_Encoding_optional | bf_UniqueID_ignored,
+ build_gs_simple_font);
if (code < 0)
- goto fail;
+ goto fail;
if (code == 1) {
- /* The font already has a FID, don't need to build it again.
- Release FDArray and return normally.
- fixme: FDArray fonts are thrown for garbager.
- We're not safe to build them after
- build_gs_simple_font(..., &pfont, ...),
- because a failure in building them would throw
- an underbuilt font with unclear consequences.
- */
- ifree_object(FDArray, "buildfont9(FDarray)");
- return 0;
+ /* The font already has a FID, don't need to build it again.
+ Release FDArray and return normally.
+ fixme: FDArray fonts are thrown for garbager.
+ We're not safe to build them after
+ build_gs_simple_font(..., &pfont, ...),
+ because a failure in building them would throw
+ an underbuilt font with unclear consequences.
+ */
+ ifree_object(FDArray, "buildfont9(FDarray)");
+ return 0;
}
pfont->procs.enumerate_glyph = gs_font_cid0_enumerate_glyph;
pfont->procs.glyph_outline = z9_glyph_outline;
@@ -499,8 +496,8 @@ zbuildfont9(i_ctx_t *i_ctx_p)
pfcid->cidata.glyph_data = z9_glyph_data;
pfcid->cidata.proc_data = 0; /* for GC */
if (pfcid->font_name.size == 0) {
- get_font_name(imemory, &cfnstr, &CIDFontName);
- copy_font_name(&pfcid->font_name, &cfnstr);
+ get_font_name(imemory, &cfnstr, &CIDFontName);
+ copy_font_name(&pfcid->font_name, &cfnstr);
}
ref_assign(&pfont_data(pfont)->u.cid0.GlyphDirectory, &GlyphDirectory);
ref_assign(&pfont_data(pfont)->u.cid0.GlyphData, &GlyphData);
@@ -509,11 +506,11 @@ zbuildfont9(i_ctx_t *i_ctx_p)
if (code >= 0)
code = gs_notify_register(&pfont->notify_list, notify_remove_font_type9, pfont);
if (code >= 0) {
- for (i = 0; i < FDArray_size; ++i) {
- FDArray[i]->dir = pfont->dir;
- FDArray[i]->data.parent = pfont;
- }
- return code;
+ for (i = 0; i < FDArray_size; ++i) {
+ FDArray[i]->dir = pfont->dir;
+ FDArray[i]->data.parent = pfont;
+ }
+ return code;
}
fail:
ifree_object(FDArray, "buildfont9(FDarray)");
@@ -532,15 +529,15 @@ ztype9mapcid(i_ctx_t *i_ctx_p)
int fidx;
if (code < 0)
- return code;
+ return code;
if (pfont->FontType != ft_CID_encrypted)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
check_type(*op, t_integer);
pfcid = (gs_font_cid0 *)pfont;
gdata.memory = pfont->memory;
code = pfcid->cidata.glyph_data((gs_font_base *)pfcid,
- (gs_glyph)(gs_min_cid_glyph + op->value.intval),
- &gdata, &fidx);
+ (gs_glyph)(gs_min_cid_glyph + op->value.intval),
+ &gdata, &fidx);
/* return code; original error-sensitive & fragile code */
if (code < 0) { /* failed to load glyph data, put CID 0 */
@@ -564,10 +561,10 @@ ztype9mapcid(i_ctx_t *i_ctx_p)
}
/****** FOLLOWING IS NOT GENERAL W.R.T. ALLOCATION OF GLYPH DATA ******/
- make_const_string(op - 1,
- a_readonly | imemory_space((gs_ref_memory_t *)pfont->memory),
- gdata.bits.size,
- gdata.bits.data);
+ make_const_string(op - 1,
+ a_readonly | imemory_space((gs_ref_memory_t *)pfont->memory),
+ gdata.bits.size,
+ gdata.bits.data);
make_int(op, fidx);
return code;
}
diff --git a/gs/psi/zfcid1.c b/gs/psi/zfcid1.c
index 5f281f431..d1bc11de4 100644
--- a/gs/psi/zfcid1.c
+++ b/gs/psi/zfcid1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -47,17 +47,17 @@ zbuildfont10(i_ctx_t *i_ctx_p)
gs_font_base *pfont;
if (code < 0)
- return code;
+ return code;
code = cid_font_system_info_param(&cidsi, op);
if (code < 0)
- return code;
+ return code;
make_null(&build.BuildChar); /* only BuildGlyph */
code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_CID_user_defined,
- &st_gs_font_cid1, &build,
- bf_Encoding_optional |
- bf_UniqueID_ignored);
+ &st_gs_font_cid1, &build,
+ bf_Encoding_optional |
+ bf_UniqueID_ignored);
if (code < 0)
- return code;
+ return code;
((gs_font_cid1 *)pfont)->cidata.CIDSystemInfo = cidsi;
return define_gs_font(i_ctx_p, (gs_font *)pfont);
}
@@ -81,54 +81,54 @@ z11_CIDMap_proc(gs_font_cid2 *pfont, gs_glyph glyph)
switch (r_type(pcidmap)) {
case t_string:
- if (cid >= r_size(pcidmap) / gdbytes)
- return_error(e_rangecheck);
- data = pcidmap->value.const_bytes + cid * gdbytes;
- break;
+ if (cid >= r_size(pcidmap) / gdbytes)
+ return_error(e_rangecheck);
+ data = pcidmap->value.const_bytes + cid * gdbytes;
+ break;
case t_integer:
- return cid + pcidmap->value.intval;
+ return cid + pcidmap->value.intval;
case t_dictionary:
- make_int(&rcid, cid);
- code = dict_find(pcidmap, &rcid, &prgnum);
- if (code <= 0)
- return (code < 0 ? code : gs_note_error(e_undefined));
- if (!r_has_type(prgnum, t_integer))
- return_error(e_typecheck);
- return prgnum->value.intval;
+ make_int(&rcid, cid);
+ code = dict_find(pcidmap, &rcid, &prgnum);
+ if (code <= 0)
+ return (code < 0 ? code : gs_note_error(e_undefined));
+ if (!r_has_type(prgnum, t_integer))
+ return_error(e_typecheck);
+ return prgnum->value.intval;
default: /* array type */
code = string_array_access_proc(pfont->memory, pcidmap, 1, cid * gdbytes,
- gdbytes, NULL, NULL, &data);
+ gdbytes, NULL, NULL, &data);
- if (code < 0)
- return code;
- if ( code > 0 )
- return_error(e_invalidfont);
+ if (code < 0)
+ return code;
+ if ( code > 0 )
+ return_error(e_invalidfont);
}
for (i = 0; i < gdbytes; ++i)
- gnum = (gnum << 8) + data[i];
+ gnum = (gnum << 8) + data[i];
if (gnum >= pfont->data.trueNumGlyphs)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
return gnum;
}
/* Handle MetricsCount when accessing outline or metrics information. */
static int
z11_get_outline(gs_font_type42 * pfont, uint glyph_index,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
gs_font_cid2 *const pfcid = (gs_font_cid2 *)pfont;
int skip = pfcid->cidata.MetricsCount << 1;
int code = pfcid->cidata.orig_procs.get_outline(pfont, glyph_index, pgd);
if (code >= 0) {
- uint size = pgd->bits.size;
-
- if (size <= skip) {
- gs_glyph_data_free(pgd, "z11_get_outline");
- gs_glyph_data_from_null(pgd);
- } else {
- gs_glyph_data_substring(pgd, skip, size - skip);
- }
+ uint size = pgd->bits.size;
+
+ if (size <= skip) {
+ gs_glyph_data_free(pgd, "z11_get_outline");
+ gs_glyph_data_from_null(pgd);
+ } else {
+ gs_glyph_data_substring(pgd, skip, size - skip);
+ }
}
return code;
}
@@ -137,8 +137,8 @@ z11_get_outline(gs_font_type42 * pfont, uint glyph_index,
#define GET_S16_MSB(p) (int)((GET_U16_MSB(p) ^ 0x8000) - 0x8000)
static int
-z11_get_metrics(gs_font_type42 * pfont, uint glyph_index,
- gs_type42_metrics_options_t options, float sbw[4])
+z11_get_metrics(gs_font_type42 * pfont, uint glyph_index,
+ gs_type42_metrics_options_t options, float sbw[4])
{
gs_font_cid2 *const pfcid = (gs_font_cid2 *)pfont;
int skip = pfcid->cidata.MetricsCount << 1;
@@ -150,31 +150,31 @@ z11_get_metrics(gs_font_type42 * pfont, uint glyph_index,
gdata.memory = pfont->memory;
if (wmode >= skip >> 2 ||
- (code = pfcid->cidata.orig_procs.get_outline(pfont, glyph_index, &gdata)) < 0 ||
- gdata.bits.size < skip
- )
- return pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index, options, sbw);
+ (code = pfcid->cidata.orig_procs.get_outline(pfont, glyph_index, &gdata)) < 0 ||
+ gdata.bits.size < skip
+ )
+ return pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index, options, sbw);
if(gs_type42_metrics_options_bbox_requested(options)) {
- code = pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index,
- gs_type42_metrics_options_BBOX, sbw);;
- if (code < 0)
- return code;
+ code = pfcid->cidata.orig_procs.get_metrics(pfont, glyph_index,
+ gs_type42_metrics_options_BBOX, sbw);;
+ if (code < 0)
+ return code;
}
if (gs_type42_metrics_options_sbw_requested(options)) {
- pmetrics = gdata.bits.data + skip - 4 - (wmode << 2);
- lsb = GET_S16_MSB(pmetrics + 2);
- width = GET_U16_MSB(pmetrics + 0);
- {
- double factor = 1.0 / pfont->data.unitsPerEm;
-
- if (wmode) {
- sbw[0] = 0, sbw[1] = -lsb * factor;
- sbw[2] = 0, sbw[3] = -width * factor;
- } else {
- sbw[0] = lsb * factor, sbw[1] = 0;
- sbw[2] = width * factor, sbw[3] = 0;
- }
- }
+ pmetrics = gdata.bits.data + skip - 4 - (wmode << 2);
+ lsb = GET_S16_MSB(pmetrics + 2);
+ width = GET_U16_MSB(pmetrics + 0);
+ {
+ double factor = 1.0 / pfont->data.unitsPerEm;
+
+ if (wmode) {
+ sbw[0] = 0, sbw[1] = -lsb * factor;
+ sbw[2] = 0, sbw[3] = -width * factor;
+ } else {
+ sbw[0] = lsb * factor, sbw[1] = 0;
+ sbw[2] = width * factor, sbw[3] = 0;
+ }
+ }
}
gs_glyph_data_free(&gdata, "z11_get_metrics");
return 0;
@@ -182,59 +182,58 @@ z11_get_metrics(gs_font_type42 * pfont, uint glyph_index,
static int
z11_glyph_info_aux(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
gs_font_cid2 *fontCID2 = (gs_font_cid2 *)font;
uint glyph_index;
- int code = (glyph > GS_MIN_GLYPH_INDEX
- ? glyph - GS_MIN_GLYPH_INDEX
- : fontCID2->cidata.CIDMap_proc(fontCID2, glyph));
+ int code = (glyph > GS_MIN_GLYPH_INDEX
+ ? glyph - GS_MIN_GLYPH_INDEX
+ : fontCID2->cidata.CIDMap_proc(fontCID2, glyph));
if(code < 0)
- return code;
+ return code;
glyph_index = (uint)code;
return gs_type42_glyph_info_by_gid(font, glyph, pmat, members, info, glyph_index);
}
static int
z11_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{
int wmode = (members & GLYPH_INFO_WIDTH0 ? 0 : 1);
- return z1_glyph_info_generic(font, glyph, pmat, members, info,
- &z11_glyph_info_aux, wmode);
+ return z1_glyph_info_generic(font, glyph, pmat, members, info,
+ &z11_glyph_info_aux, wmode);
}
-
/* Enumerate glyphs (keys) from GlyphDirectory instead of loca / glyf. */
static int
z11_enumerate_glyph(gs_font *font, int *pindex,
- gs_glyph_space_t glyph_space, gs_glyph *pglyph)
+ gs_glyph_space_t glyph_space, gs_glyph *pglyph)
{
gs_font_cid2 *pfont = (gs_font_cid2 *)font;
int code0 = z11_CIDMap_proc(pfont, GS_MIN_CID_GLYPH);
int code;
if(*pindex > pfont->cidata.common.CIDCount)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
for (;;) {
- code = z11_CIDMap_proc(pfont, GS_MIN_CID_GLYPH + *pindex);
-
- if (code < 0) {
- *pindex = 0;
- return 0;
- }
- (*pindex)++;
- if (*pindex == 1 || code != code0)
- break;
- /* else skip an underfined glyph */
+ code = z11_CIDMap_proc(pfont, GS_MIN_CID_GLYPH + *pindex);
+
+ if (code < 0) {
+ *pindex = 0;
+ return 0;
+ }
+ (*pindex)++;
+ if (*pindex == 1 || code != code0)
+ break;
+ /* else skip an underfined glyph */
}
if (glyph_space == GLYPH_SPACE_INDEX)
- *pglyph = GS_MIN_GLYPH_INDEX + (uint)code;
+ *pglyph = GS_MIN_GLYPH_INDEX + (uint)code;
else
- *pglyph = GS_MIN_CID_GLYPH + (uint)(*pindex - 1);
+ *pglyph = GS_MIN_CID_GLYPH + (uint)(*pindex - 1);
return 0;
}
@@ -246,37 +245,36 @@ z11_get_glyph_index(gs_font_type42 *pfont, gs_glyph glyph)
return (code < 0 ? 0 /* notdef */: (uint)code);
}
-
static int
z11_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
- return gs_type42_glyph_outline(font, WMode,
- z11_get_glyph_index((gs_font_type42 *)font, glyph) + GS_MIN_GLYPH_INDEX,
- pmat, ppath, sbw);
+ return gs_type42_glyph_outline(font, WMode,
+ z11_get_glyph_index((gs_font_type42 *)font, glyph) + GS_MIN_GLYPH_INDEX,
+ pmat, ppath, sbw);
}
-static int
+static int
get_subst_CID_on_WMode(gs_subst_CID_on_WMode_t *subst, ref *t, int WMode)
{
ref r, *a, e;;
make_int(&r, WMode);
if (dict_find(t, &r, &a) > 0 && r_type(a) == t_array) {
- int n = r_size(a), i;
- uint *s;
-
- s = (uint *)gs_alloc_byte_array(subst->rc.memory, n, sizeof(int), "zbuildfont11");
- if (s == NULL)
- return_error(e_VMerror);
- for (i = 0; i < n; i++) {
- array_get(subst->rc.memory, a, (long)i, &e);
- if (r_type(&e) != t_integer)
- return_error(e_invalidfont);
- s[i] = e.value.intval;
- }
- subst->data[WMode] = s;
- subst->size[WMode] = n;
+ int n = r_size(a), i;
+ uint *s;
+
+ s = (uint *)gs_alloc_byte_array(subst->rc.memory, n, sizeof(int), "zbuildfont11");
+ if (s == NULL)
+ return_error(e_VMerror);
+ for (i = 0; i < n; i++) {
+ array_get(subst->rc.memory, a, (long)i, &e);
+ if (r_type(&e) != t_integer)
+ return_error(e_invalidfont);
+ s[i] = e.value.intval;
+ }
+ subst->data[WMode] = s;
+ subst->size[WMode] = n;
}
return 0;
}
@@ -295,38 +293,38 @@ release_subst_CID_on_WMode(void *data, void *event)
return 0;
}
-static uint
+static uint
font11_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_index,
- int WMode, gs_glyph glyph)
+ int WMode, gs_glyph glyph)
{
gs_font_cid2 *pfcid = (gs_font_cid2 *)pfont;
uint cid = (glyph >= GS_MIN_CID_GLYPH ? glyph - GS_MIN_CID_GLYPH : glyph);
int WMode1 = !WMode;\
gs_subst_CID_on_WMode_t *s = pfcid->subst_CID_on_WMode;
-
+
if (s != NULL) {
- uint *subst = s->data[WMode1];
- int bi, ei, i;
-
- /* Binary search for cid in subst (2-int elements) : */
- bi = 0;
- ei = pfcid->subst_CID_on_WMode->size[WMode1];
-
- if (ei > 0) {
- for (;;) {
- i = ((bi + ei) / 2) & ~1;
- if (subst[i] == cid) {
- WMode = WMode1;
- break;
- }
- if (bi + 2 >= ei)
- break;
- if (subst[i] > cid)
- ei = i;
- else
- bi = i;
- }
- }
+ uint *subst = s->data[WMode1];
+ int bi, ei, i;
+
+ /* Binary search for cid in subst (2-int elements) : */
+ bi = 0;
+ ei = pfcid->subst_CID_on_WMode->size[WMode1];
+
+ if (ei > 0) {
+ for (;;) {
+ i = ((bi + ei) / 2) & ~1;
+ if (subst[i] == cid) {
+ WMode = WMode1;
+ break;
+ }
+ if (bi + 2 >= ei)
+ break;
+ if (subst[i] > cid)
+ ei = i;
+ else
+ bi = i;
+ }
+ }
}
return gs_type42_substitute_glyph_index_vertical(pfont, glyph_index, WMode, glyph);
}
@@ -349,117 +347,117 @@ zbuildfont11(i_ctx_t *i_ctx_p)
int code = cid_font_data_param(op, &common, &ignore_gdir);
if (code < 0 ||
- (code = dict_find_string(op, "CIDFontName", &pCIDFontName)) <= 0 ||
- (code = dict_int_param(op, "MetricsCount", 0, 4, 0, &MetricsCount)) < 0
- )
- return code;
+ (code = dict_find_string(op, "CIDFontName", &pCIDFontName)) <= 0 ||
+ (code = dict_int_param(op, "MetricsCount", 0, 4, 0, &MetricsCount)) < 0
+ )
+ return code;
/*
* Since build_gs_simple_font may resize the dictionary and cause
* pointers to become invalid, save CIDFontName
*/
CIDFontName = *pCIDFontName;
if (MetricsCount & 1) /* only allowable values are 0, 2, 4 */
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = dict_find_string(op, "File", &pfile);
if (code < 0 && code != e_undefined)
- return code;
+ return code;
if (code > 0) {
- ref *file_table_pos, *a, v;
- const char *name[2] = {"loca", "glyf"};
- int i, j;
-
- /*
- * Since build_gs_simple_font may resize the dictionary and cause
- * pointers to become invalid, save File and CIDFontName
- */
- file = *pfile;
+ ref *file_table_pos, *a, v;
+ const char *name[2] = {"loca", "glyf"};
+ int i, j;
+
+ /*
+ * Since build_gs_simple_font may resize the dictionary and cause
+ * pointers to become invalid, save File and CIDFontName
+ */
+ file = *pfile;
check_read_type(file, t_file);
- code = dict_find_string(op, "file_table_pos", &file_table_pos);
- if (code <= 0 || r_type(file_table_pos) != t_dictionary)
- return_error(e_invalidfont);
- for (i = 0; i < 2; i++) {
- code = dict_find_string(file_table_pos, name[i], &a);
- if (code <= 0 || r_type(a) != t_array)
- return_error(e_invalidfont);
- for (j = 0; j < 2; j++) {
- code = array_get(imemory, a, j, &v);
- if (code < 0 || r_type(&v) != t_integer)
- return_error(e_invalidfont);
- loca_glyph_pos[i][j] = v.value.intval;
- }
- }
+ code = dict_find_string(op, "file_table_pos", &file_table_pos);
+ if (code <= 0 || r_type(file_table_pos) != t_dictionary)
+ return_error(e_invalidfont);
+ for (i = 0; i < 2; i++) {
+ code = dict_find_string(file_table_pos, name[i], &a);
+ if (code <= 0 || r_type(a) != t_array)
+ return_error(e_invalidfont);
+ for (j = 0; j < 2; j++) {
+ code = array_get(imemory, a, j, &v);
+ if (code < 0 || r_type(&v) != t_integer)
+ return_error(e_invalidfont);
+ loca_glyph_pos[i][j] = v.value.intval;
+ }
+ }
} else
- pfile = NULL;
+ pfile = NULL;
code = font_string_array_param(imemory, op, "CIDMap", &rcidmap);
switch (code) {
case 0: /* in PLRM3 */
gdb:
- /* GDBytes is required for indexing a string or string array. */
- if (common.GDBytes == 0)
- return_error(e_rangecheck);
- break;
+ /* GDBytes is required for indexing a string or string array. */
+ if (common.GDBytes == 0)
+ return_error(e_rangecheck);
+ break;
default:
- return code;
+ return code;
case e_typecheck:
- switch (r_type(&rcidmap)) {
- case t_string: /* in PLRM3 */
- goto gdb;
- case t_dictionary: /* added in 3011 */
- case t_integer: /* added in 3011 */
- break;
- default:
- return code;
- }
- break;
+ switch (r_type(&rcidmap)) {
+ case t_string: /* in PLRM3 */
+ goto gdb;
+ case t_dictionary: /* added in 3011 */
+ case t_integer: /* added in 3011 */
+ break;
+ default:
+ return code;
+ }
+ break;
}
code = build_gs_TrueType_font(i_ctx_p, op, &pfont, ft_CID_TrueType,
- &st_gs_font_cid2,
- (const char *)0, "%Type11BuildGlyph",
- bf_Encoding_optional |
- bf_UniqueID_ignored |
- bf_CharStrings_optional |
- (pfile != NULL ? bf_has_font_file : 0));
+ &st_gs_font_cid2,
+ (const char *)0, "%Type11BuildGlyph",
+ bf_Encoding_optional |
+ bf_UniqueID_ignored |
+ bf_CharStrings_optional |
+ (pfile != NULL ? bf_has_font_file : 0));
if (code < 0)
- return code;
+ return code;
pfcid = (gs_font_cid2 *)pfont;
if (dict_find_string(op, "subst_CID_on_WMode", &t) > 0 && r_type(t) == t_dictionary) {
- gs_subst_CID_on_WMode_t *subst = NULL;
- ref *o;
- gs_font *font;
-
- if (dict_find_string(t, "Ordering", &o) <= 0 || r_type(o) != t_string)
- return_error(e_invalidfont);
- for (font = ifont_dir->orig_fonts; font != NULL; font = font->next) {
- if (font->FontType == ft_CID_TrueType) {
- gs_font_cid2 *pfcid1 = (gs_font_cid2 *)font;
- if (pfcid1->subst_CID_on_WMode != NULL &&
- bytes_compare(o->value.const_bytes, r_size(o),
- pfcid1->cidata.common.CIDSystemInfo.Ordering.data,
- pfcid1->cidata.common.CIDSystemInfo.Ordering.size)) {
- subst = pfcid1->subst_CID_on_WMode;
- break;
- }
- }
- }
- if (subst == NULL) {
- rc_alloc_struct_1(subst, gs_subst_CID_on_WMode_t, &st_subst_CID_on_WMode,
- pfcid->memory, return_error(e_VMerror), "zbuildfont11");
- subst->data[0] = subst->data[1] = 0;
- pfcid->subst_CID_on_WMode = subst;
- code = get_subst_CID_on_WMode(subst, t, 0);
- if (code < 0)
- return code;
- code = get_subst_CID_on_WMode(subst, t, 1);
- if (code < 0)
- return code;
- } else {
- pfcid->subst_CID_on_WMode = subst;
- rc_increment(subst);
- }
- code = gs_font_notify_register((gs_font *)pfcid, release_subst_CID_on_WMode, (void *)pfcid);
- if (code < 0)
- return code;
- rc_increment(subst);
+ gs_subst_CID_on_WMode_t *subst = NULL;
+ ref *o;
+ gs_font *font;
+
+ if (dict_find_string(t, "Ordering", &o) <= 0 || r_type(o) != t_string)
+ return_error(e_invalidfont);
+ for (font = ifont_dir->orig_fonts; font != NULL; font = font->next) {
+ if (font->FontType == ft_CID_TrueType) {
+ gs_font_cid2 *pfcid1 = (gs_font_cid2 *)font;
+ if (pfcid1->subst_CID_on_WMode != NULL &&
+ bytes_compare(o->value.const_bytes, r_size(o),
+ pfcid1->cidata.common.CIDSystemInfo.Ordering.data,
+ pfcid1->cidata.common.CIDSystemInfo.Ordering.size)) {
+ subst = pfcid1->subst_CID_on_WMode;
+ break;
+ }
+ }
+ }
+ if (subst == NULL) {
+ rc_alloc_struct_1(subst, gs_subst_CID_on_WMode_t, &st_subst_CID_on_WMode,
+ pfcid->memory, return_error(e_VMerror), "zbuildfont11");
+ subst->data[0] = subst->data[1] = 0;
+ pfcid->subst_CID_on_WMode = subst;
+ code = get_subst_CID_on_WMode(subst, t, 0);
+ if (code < 0)
+ return code;
+ code = get_subst_CID_on_WMode(subst, t, 1);
+ if (code < 0)
+ return code;
+ } else {
+ pfcid->subst_CID_on_WMode = subst;
+ rc_increment(subst);
+ }
+ code = gs_font_notify_register((gs_font *)pfcid, release_subst_CID_on_WMode, (void *)pfcid);
+ if (code < 0)
+ return code;
+ rc_increment(subst);
}
pfcid->cidata.common = common;
pfcid->cidata.MetricsCount = MetricsCount;
@@ -471,27 +469,27 @@ zbuildfont11(i_ctx_t *i_ctx_p)
pfont->procs.glyph_outline = z11_glyph_outline;
pfont->data.get_glyph_index = z11_get_glyph_index;
if (pfcid->font_name.size == 0) {
- get_font_name(imemory, &cfnstr, &CIDFontName);
- copy_font_name(&pfcid->font_name, &cfnstr);
+ get_font_name(imemory, &cfnstr, &CIDFontName);
+ copy_font_name(&pfcid->font_name, &cfnstr);
}
if (MetricsCount) {
- /* "Wrap" the glyph accessor procedures. */
- pfcid->cidata.orig_procs.get_outline = pfont->data.get_outline;
- pfont->data.get_outline = z11_get_outline;
- pfcid->cidata.orig_procs.get_metrics = pfont->data.get_metrics;
- pfont->data.get_metrics = z11_get_metrics;
+ /* "Wrap" the glyph accessor procedures. */
+ pfcid->cidata.orig_procs.get_outline = pfont->data.get_outline;
+ pfont->data.get_outline = z11_get_outline;
+ pfcid->cidata.orig_procs.get_metrics = pfont->data.get_metrics;
+ pfont->data.get_metrics = z11_get_metrics;
} else if(pfile != NULL) {
- /*
- * We assume that disk fonts has no MetricsCount.
- * We could do not, but the number of virtual function wariants increases.
- */
- stream *s;
-
- check_read_file(i_ctx_p, s, &file);
- pfont->data.loca = loca_glyph_pos[0][0];
- pfont->data.glyf = loca_glyph_pos[1][0];
- pfont->data.get_outline = gs_get_glyph_data_cached;
- pfont->data.gdcache = gs_glyph_cache__alloc(pfont, s, gs_type42_get_outline_from_TT_file);
+ /*
+ * We assume that disk fonts has no MetricsCount.
+ * We could do not, but the number of virtual function wariants increases.
+ */
+ stream *s;
+
+ check_read_file(i_ctx_p, s, &file);
+ pfont->data.loca = loca_glyph_pos[0][0];
+ pfont->data.glyf = loca_glyph_pos[1][0];
+ pfont->data.get_outline = gs_get_glyph_data_cached;
+ pfont->data.gdcache = gs_glyph_cache__alloc(pfont, s, gs_type42_get_outline_from_TT_file);
}
return define_gs_font(i_ctx_p, (gs_font *)pfont);
}
@@ -505,27 +503,27 @@ ztype11mapcid(i_ctx_t *i_ctx_p)
int code = font_param(op - 1, &pfont);
if (code < 0)
- return code;
+ return code;
check_type(*op, t_integer);
#if defined(TEST)
/* Allow a Type 42 font here, for testing .wrapfont. */
if (pfont->FontType == ft_TrueType) {
- /* Use the CID as the glyph index. */
- if (op->value.intval < 0 ||
- op->value.intval >= ((gs_font_type42 *)pfont)->data.numGlyphs
- )
- return_error(e_rangecheck);
- code = (int)op->value.intval;
+ /* Use the CID as the glyph index. */
+ if (op->value.intval < 0 ||
+ op->value.intval >= ((gs_font_type42 *)pfont)->data.numGlyphs
+ )
+ return_error(e_rangecheck);
+ code = (int)op->value.intval;
} else
#endif
{
- if (pfont->FontType != ft_CID_TrueType)
- return_error(e_invalidfont);
- code = z11_CIDMap_proc((gs_font_cid2 *)pfont,
- (gs_glyph)(gs_min_cid_glyph + op->value.intval));
+ if (pfont->FontType != ft_CID_TrueType)
+ return_error(e_invalidfont);
+ code = z11_CIDMap_proc((gs_font_cid2 *)pfont,
+ (gs_glyph)(gs_min_cid_glyph + op->value.intval));
}
if (code < 0)
- return code;
+ return code;
make_int(op - 1, code);
pop(1);
return 0;
@@ -536,7 +534,7 @@ static int
zfillCIDMap(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
- ref *Decoding = op - 4, *TT_cmap = op - 3, *SubstNWP = op - 2,
+ ref *Decoding = op - 4, *TT_cmap = op - 3, *SubstNWP = op - 2,
*GDBytes = op - 1, *CIDMap = op;
int code;
@@ -556,7 +554,7 @@ zfillIdentityCIDMap(i_ctx_t *i_ctx_p)
os_ptr op = osp;
/* ref *Decoding = op - 4; */
/* ref *TT_cmap = op - 3; */
- /* ref *SubstNWP = op - 2; */
+ /* ref *SubstNWP = op - 2; */
/* ref *GDBytes = op - 1; */
ref *CIDMap = op;
int code;
diff --git a/gs/psi/zfcmap.c b/gs/psi/zfcmap.c
index 479040c31..c1b9ffc72 100644
--- a/gs/psi/zfcmap.c
+++ b/gs/psi/zfcmap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,7 +31,7 @@
/* Exported for zfont0.c */
int ztype0_get_cmap(const gs_cmap_t ** ppcmap, const ref * pfdepvector,
- const ref * op, gs_memory_t *imem);
+ const ref * op, gs_memory_t *imem);
/*
* Define whether to check the compatibility of CIDSystemInfo between the
@@ -47,16 +47,16 @@ static void
free_code_map(gx_code_map_t * pcmap, gs_memory_t * mem)
{
if (pcmap->lookup) {
- int i;
+ int i;
- for (i = 0; i < pcmap->num_lookup; ++i) {
- gx_cmap_lookup_range_t *pclr = &pcmap->lookup[i];
+ for (i = 0; i < pcmap->num_lookup; ++i) {
+ gx_cmap_lookup_range_t *pclr = &pcmap->lookup[i];
- if (pclr->value_type == CODE_VALUE_GLYPH)
- gs_free_string(mem, pclr->values.data, pclr->values.size,
- "free_code_map(values)");
- }
- gs_free_object(mem, pcmap->lookup, "free_code_map(map)");
+ if (pclr->value_type == CODE_VALUE_GLYPH)
+ gs_free_string(mem, pclr->values.data, pclr->values.size,
+ "free_code_map(values)");
+ }
+ gs_free_object(mem, pcmap->lookup, "free_code_map(map)");
}
}
@@ -70,25 +70,25 @@ acquire_code_ranges(gs_cmap_adobe1_t *cmap, const ref *pref, gs_memory_t *mem)
ref elem;
if (!r_is_array(pref))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
for (i=0; i < r_size(pref); i++) {
int code = array_get(mem, pref, i, &elem);
if (code < 0)
return code;
elem_sz = r_size(&elem);
if (elem_sz & 1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
num_ranges += elem_sz;
}
if (num_ranges == 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
num_ranges >>= 1;
ranges = (gx_code_space_range_t *)
- gs_alloc_byte_array(mem, num_ranges, sizeof(gx_code_space_range_t),
- "acquire_code_ranges");
+ gs_alloc_byte_array(mem, num_ranges, sizeof(gx_code_space_range_t),
+ "acquire_code_ranges");
if (ranges == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
cmap->code_space.ranges = ranges;
cmap->code_space.num_ranges = num_ranges;
@@ -96,20 +96,20 @@ acquire_code_ranges(gs_cmap_adobe1_t *cmap, const ref *pref, gs_memory_t *mem)
array_get(mem, pref, i, &elem);
elem_sz = r_size(&elem);
for (j = 0; j < elem_sz; j += 2) {
- ref rfirst, rlast;
- int size;
-
- array_get(mem, &elem, j, &rfirst);
- array_get(mem, &elem, j + 1, &rlast);
- if (!r_has_type(&rfirst, t_string) ||
- !r_has_type(&rlast, t_string) ||
- (size = r_size(&rfirst)) == 0 || size > MAX_CMAP_CODE_SIZE ||
- r_size(&rlast) != size ||
- memcmp(rfirst.value.bytes, rlast.value.bytes, size) > 0)
- return_error(e_rangecheck);
- memcpy(ranges->first, rfirst.value.bytes, size);
- memcpy(ranges->last, rlast.value.bytes, size);
- ranges->size = size;
+ ref rfirst, rlast;
+ int size;
+
+ array_get(mem, &elem, j, &rfirst);
+ array_get(mem, &elem, j + 1, &rlast);
+ if (!r_has_type(&rfirst, t_string) ||
+ !r_has_type(&rlast, t_string) ||
+ (size = r_size(&rfirst)) == 0 || size > MAX_CMAP_CODE_SIZE ||
+ r_size(&rlast) != size ||
+ memcmp(rfirst.value.bytes, rlast.value.bytes, size) > 0)
+ return_error(e_rangecheck);
+ memcpy(ranges->first, rfirst.value.bytes, size);
+ memcpy(ranges->last, rlast.value.bytes, size);
+ ranges->size = size;
++ranges;
}
}
@@ -119,7 +119,7 @@ acquire_code_ranges(gs_cmap_adobe1_t *cmap, const ref *pref, gs_memory_t *mem)
/* Convert a code map to internal form. */
static int
acquire_code_map(gx_code_map_t *pcmap, const ref *pref, gs_cmap_adobe1_t *root,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
uint num_lookup = 0;
gx_cmap_lookup_range_t *pclr;
@@ -128,120 +128,119 @@ acquire_code_map(gx_code_map_t *pcmap, const ref *pref, gs_cmap_adobe1_t *root,
uint elem_sz;
if (!r_is_array(pref))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
for (i=0; i < r_size(pref); i++) {
int code = array_get(mem, pref, i, &elem);
if (code < 0)
return code;
elem_sz = r_size(&elem);
if (elem_sz % 5 != 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
num_lookup += elem_sz;
}
num_lookup /= 5;
pclr = gs_alloc_struct_array(mem, num_lookup, gx_cmap_lookup_range_t,
- &st_cmap_lookup_range_element,
- "acquire_code_map(lookup ranges)");
+ &st_cmap_lookup_range_element,
+ "acquire_code_map(lookup ranges)");
if (pclr == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
memset(pclr, 0, sizeof(*pclr) * num_lookup);
pcmap->lookup = pclr;
pcmap->num_lookup = num_lookup;
-
-
+
for (i = 0; i < r_size(pref); i++) {
uint j;
array_get(mem, pref, i, &elem);
elem_sz = r_size(&elem);
for (j = 0; j < elem_sz; j += 5) {
- ref rprefix, rmisc, rkeys, rvalues, rfxs;
-
- array_get(mem, &elem, j, &rprefix);
- array_get(mem, &elem, j + 1, &rmisc);
- array_get(mem, &elem, j + 2, &rkeys);
- array_get(mem, &elem, j + 3, &rvalues);
- array_get(mem, &elem, j + 4, &rfxs);
-
- if (!r_has_type(&rprefix, t_string) ||
- !r_has_type(&rmisc, t_string) ||
- !r_has_type(&rkeys, t_string) ||
- !(r_has_type(&rvalues, t_string) || r_is_array(&rvalues)) ||
- !r_has_type(&rfxs, t_integer)
- )
- return_error(e_typecheck);
- if (r_size(&rmisc) != 4 ||
- rmisc.value.bytes[0] > MAX_CMAP_CODE_SIZE - r_size(&rprefix) ||
- rmisc.value.bytes[1] > 1 ||
- rmisc.value.bytes[2] > CODE_VALUE_MAX ||
- rmisc.value.bytes[3] == 0)
- return_error(e_rangecheck);
- pclr->cmap = root;
- pclr->key_size = rmisc.value.bytes[0];
- pclr->key_prefix_size = r_size(&rprefix);
- memcpy(pclr->key_prefix, rprefix.value.bytes, pclr->key_prefix_size);
- pclr->key_is_range = rmisc.value.bytes[1];
- if (pclr->key_size == 0) {
- /* This is a single entry consisting only of the prefix. */
- if (r_size(&rkeys) != 0)
- return_error(e_rangecheck);
- pclr->num_entries = 1;
- } else {
- int step = pclr->key_size * (pclr->key_is_range ? 2 : 1);
-
- if (r_size(&rkeys) % step != 0)
- return_error(e_rangecheck);
- pclr->num_entries = r_size(&rkeys) / step;
- }
- pclr->keys.data = rkeys.value.bytes,
- pclr->keys.size = r_size(&rkeys);
- pclr->value_type = rmisc.value.bytes[2];
- pclr->value_size = rmisc.value.bytes[3];
- if (r_has_type(&rvalues, t_string)) {
- if (pclr->value_type == CODE_VALUE_GLYPH)
- return_error(e_rangecheck);
- if (r_size(&rvalues) % pclr->num_entries != 0 ||
- r_size(&rvalues) / pclr->num_entries != pclr->value_size)
- return_error(e_rangecheck);
- pclr->values.data = rvalues.value.bytes,
- pclr->values.size = r_size(&rvalues);
- } else {
- uint values_size = pclr->num_entries * pclr->value_size;
- long k;
- byte *pvalue;
-
- if (pclr->value_type != CODE_VALUE_GLYPH ||
- r_size(&rvalues) != pclr->num_entries ||
- pclr->value_size > sizeof(gs_glyph))
- return_error(e_rangecheck);
- pclr->values.data = gs_alloc_string(mem, values_size,
- "acquire_code_map(values)");
- if (pclr->values.data == 0)
- return_error(e_VMerror);
- pclr->values.size = values_size;
- pvalue = pclr->values.data;
- for (k = 0; k < pclr->num_entries; ++k) {
- ref rvalue;
- gs_glyph value;
- int i;
-
- array_get(mem, &rvalues, k, &rvalue);
- if (!r_has_type(&rvalue, t_name))
- return_error(e_rangecheck);
- value = name_index(mem, &rvalue);
- /*
- * We need a special check here because some CPUs cannot
- * shift by the full size of an int or long.
- */
- if (pclr->value_size < sizeof(value) &&
- (value >> (pclr->value_size * 8)) != 0
- )
- return_error(e_rangecheck);
- for (i = pclr->value_size; --i >= 0; )
- *pvalue++ = (byte)(value >> (i * 8));
- }
- }
- check_int_leu_only(rfxs, 0xff);
- pclr->font_index = (int)rfxs.value.intval;
+ ref rprefix, rmisc, rkeys, rvalues, rfxs;
+
+ array_get(mem, &elem, j, &rprefix);
+ array_get(mem, &elem, j + 1, &rmisc);
+ array_get(mem, &elem, j + 2, &rkeys);
+ array_get(mem, &elem, j + 3, &rvalues);
+ array_get(mem, &elem, j + 4, &rfxs);
+
+ if (!r_has_type(&rprefix, t_string) ||
+ !r_has_type(&rmisc, t_string) ||
+ !r_has_type(&rkeys, t_string) ||
+ !(r_has_type(&rvalues, t_string) || r_is_array(&rvalues)) ||
+ !r_has_type(&rfxs, t_integer)
+ )
+ return_error(e_typecheck);
+ if (r_size(&rmisc) != 4 ||
+ rmisc.value.bytes[0] > MAX_CMAP_CODE_SIZE - r_size(&rprefix) ||
+ rmisc.value.bytes[1] > 1 ||
+ rmisc.value.bytes[2] > CODE_VALUE_MAX ||
+ rmisc.value.bytes[3] == 0)
+ return_error(e_rangecheck);
+ pclr->cmap = root;
+ pclr->key_size = rmisc.value.bytes[0];
+ pclr->key_prefix_size = r_size(&rprefix);
+ memcpy(pclr->key_prefix, rprefix.value.bytes, pclr->key_prefix_size);
+ pclr->key_is_range = rmisc.value.bytes[1];
+ if (pclr->key_size == 0) {
+ /* This is a single entry consisting only of the prefix. */
+ if (r_size(&rkeys) != 0)
+ return_error(e_rangecheck);
+ pclr->num_entries = 1;
+ } else {
+ int step = pclr->key_size * (pclr->key_is_range ? 2 : 1);
+
+ if (r_size(&rkeys) % step != 0)
+ return_error(e_rangecheck);
+ pclr->num_entries = r_size(&rkeys) / step;
+ }
+ pclr->keys.data = rkeys.value.bytes,
+ pclr->keys.size = r_size(&rkeys);
+ pclr->value_type = rmisc.value.bytes[2];
+ pclr->value_size = rmisc.value.bytes[3];
+ if (r_has_type(&rvalues, t_string)) {
+ if (pclr->value_type == CODE_VALUE_GLYPH)
+ return_error(e_rangecheck);
+ if (r_size(&rvalues) % pclr->num_entries != 0 ||
+ r_size(&rvalues) / pclr->num_entries != pclr->value_size)
+ return_error(e_rangecheck);
+ pclr->values.data = rvalues.value.bytes,
+ pclr->values.size = r_size(&rvalues);
+ } else {
+ uint values_size = pclr->num_entries * pclr->value_size;
+ long k;
+ byte *pvalue;
+
+ if (pclr->value_type != CODE_VALUE_GLYPH ||
+ r_size(&rvalues) != pclr->num_entries ||
+ pclr->value_size > sizeof(gs_glyph))
+ return_error(e_rangecheck);
+ pclr->values.data = gs_alloc_string(mem, values_size,
+ "acquire_code_map(values)");
+ if (pclr->values.data == 0)
+ return_error(e_VMerror);
+ pclr->values.size = values_size;
+ pvalue = pclr->values.data;
+ for (k = 0; k < pclr->num_entries; ++k) {
+ ref rvalue;
+ gs_glyph value;
+ int i;
+
+ array_get(mem, &rvalues, k, &rvalue);
+ if (!r_has_type(&rvalue, t_name))
+ return_error(e_rangecheck);
+ value = name_index(mem, &rvalue);
+ /*
+ * We need a special check here because some CPUs cannot
+ * shift by the full size of an int or long.
+ */
+ if (pclr->value_size < sizeof(value) &&
+ (value >> (pclr->value_size * 8)) != 0
+ )
+ return_error(e_rangecheck);
+ for (i = pclr->value_size; --i >= 0; )
+ *pvalue++ = (byte)(value >> (i * 8));
+ }
+ }
+ check_int_leu_only(rfxs, 0xff);
+ pclr->font_index = (int)rfxs.value.intval;
++pclr;
}
}
@@ -258,15 +257,15 @@ acquire_cid_system_info(ref *psia, const ref *op)
ref *prcidsi;
if (dict_find_string(op, "CIDSystemInfo", &prcidsi) <= 0) {
- make_empty_array(psia, a_readonly);
- return 1;
+ make_empty_array(psia, a_readonly);
+ return 1;
}
if (r_has_type(prcidsi, t_dictionary)) {
- make_array(psia, a_readonly, 1, prcidsi);
- return 0;
+ make_array(psia, a_readonly, 1, prcidsi);
+ return 0;
}
if (!r_is_array(prcidsi))
- return_error(e_typecheck);
+ return_error(e_typecheck);
*psia = *prcidsi;
return 0;
}
@@ -282,8 +281,8 @@ get_cid_system_info(const gs_memory_t *mem, gs_cid_system_info_t *pcidsi, const
int code = array_get(mem, psia, (long)index, &rcidsi);
if (code < 0 || r_has_type(&rcidsi, t_null)) {
- cid_system_info_set_null(pcidsi);
- return 1;
+ cid_system_info_set_null(pcidsi);
+ return 1;
}
return cid_system_info_param(pcidsi, &rcidsi);
}
@@ -295,14 +294,14 @@ static bool
bytes_eq(const gs_const_string *pcs1, const gs_const_string *pcs2)
{
return !bytes_compare(pcs1->data, pcs1->size,
- pcs2->data, pcs2->size);
+ pcs2->data, pcs2->size);
}
static bool
cid_system_info_compatible(const gs_cid_system_info_t * psi1,
- const gs_cid_system_info_t * psi2)
+ const gs_cid_system_info_t * psi2)
{
return bytes_eq(&psi1->Registry, &psi2->Registry) &&
- bytes_eq(&psi1->Ordering, &psi2->Ordering);
+ bytes_eq(&psi1->Ordering, &psi2->Ordering);
}
#endif /* CHECK_CID_SYSTEM_INFO_COMPATIBILITY */
@@ -313,7 +312,7 @@ cid_system_info_compatible(const gs_cid_system_info_t * psi1,
/* its subsidiary fonts. */
int
ztype0_get_cmap(const gs_cmap_t **ppcmap, const ref *pfdepvector,
- const ref *op, gs_memory_t *imem)
+ const ref *op, gs_memory_t *imem)
{
ref *prcmap;
ref *pcodemap;
@@ -328,36 +327,36 @@ ztype0_get_cmap(const gs_cmap_t **ppcmap, const ref *pfdepvector,
* t_struct and is large enough.
*/
if (dict_find_string(op, "CMap", &prcmap) <= 0 ||
- !r_has_type(prcmap, t_dictionary) ||
- dict_find_string(prcmap, "CodeMap", &pcodemap) <= 0 ||
- !r_is_struct(pcodemap) ||
- gs_object_size(imem, r_ptr(pcodemap, gs_cmap_t)) < sizeof(gs_cmap_t)
- )
- return_error(e_invalidfont);
+ !r_has_type(prcmap, t_dictionary) ||
+ dict_find_string(prcmap, "CodeMap", &pcodemap) <= 0 ||
+ !r_is_struct(pcodemap) ||
+ gs_object_size(imem, r_ptr(pcodemap, gs_cmap_t)) < sizeof(gs_cmap_t)
+ )
+ return_error(e_invalidfont);
pcmap = r_ptr(pcodemap, gs_cmap_t);
num_fonts = r_size(pfdepvector);
for (i = 0; i < num_fonts; ++i) {
- ref rfdep, rfsi;
-
- array_get(imem, pfdepvector, (long)i, &rfdep);
- code = acquire_cid_system_info(&rfsi, &rfdep);
- if (code < 0)
- return code;
- if (code == 0) {
- if (r_size(&rfsi) != 1)
- return_error(e_rangecheck);
+ ref rfdep, rfsi;
+
+ array_get(imem, pfdepvector, (long)i, &rfdep);
+ code = acquire_cid_system_info(&rfsi, &rfdep);
+ if (code < 0)
+ return code;
+ if (code == 0) {
+ if (r_size(&rfsi) != 1)
+ return_error(e_rangecheck);
#ifdef CHECK_CID_SYSTEM_INFO_COMPATIBILITY
- {
- gs_cid_system_info_t cidsi;
-
- get_cid_system_info(&cidsi, &rfsi, 0);
- if (!cid_system_info_is_null(&cidsi) &&
- !cid_system_info_compatible(&cidsi,
- pcmap->CIDSystemInfo + i))
- return_error(e_rangecheck);
- }
+ {
+ gs_cid_system_info_t cidsi;
+
+ get_cid_system_info(&cidsi, &rfsi, 0);
+ if (!cid_system_info_is_null(&cidsi) &&
+ !cid_system_info_compatible(&cidsi,
+ pcmap->CIDSystemInfo + i))
+ return_error(e_rangecheck);
+ }
#endif
- }
+ }
}
*ppcmap = pcmap;
return 0;
@@ -376,8 +375,8 @@ ztype0_get_cmap(const gs_cmap_t **ppcmap, const ref *pfdepvector,
* For details, see lib/gs_cmap.ps and the Adobe documentation.
*/
static int
-zfcmap_glyph_name(const gs_memory_t *mem,
- gs_glyph glyph, gs_const_string *pstr, void *proc_data)
+zfcmap_glyph_name(const gs_memory_t *mem,
+ gs_glyph glyph, gs_const_string *pstr, void *proc_data)
{
ref nref, nsref;
@@ -404,61 +403,61 @@ zbuildcmap(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
check_dict_write(*op);
if ((code = dict_find_string(op, "CMapName", &pcmapname)) <= 0) {
- code = gs_note_error(e_rangecheck);
- goto fail;
+ code = gs_note_error(e_rangecheck);
+ goto fail;
}
if (!r_has_type(pcmapname, t_name)) {
- code = gs_note_error(e_typecheck);
- goto fail;
+ code = gs_note_error(e_typecheck);
+ goto fail;
}
name_string_ref(imemory, pcmapname, &rname);
if (dict_find_string(op, ".CodeMapData", &pcodemapdata) <= 0 ||
- !r_has_type(pcodemapdata, t_array) ||
- r_size(pcodemapdata) != 3 ||
- dict_find_string(op, "CodeMap", &pcodemap) <= 0 ||
- !r_has_type(pcodemap, t_null)
- ) {
- code = gs_note_error(e_rangecheck);
- goto fail;
+ !r_has_type(pcodemapdata, t_array) ||
+ r_size(pcodemapdata) != 3 ||
+ dict_find_string(op, "CodeMap", &pcodemap) <= 0 ||
+ !r_has_type(pcodemap, t_null)
+ ) {
+ code = gs_note_error(e_rangecheck);
+ goto fail;
}
if ((code = acquire_cid_system_info(&rcidsi, op)) < 0)
- goto fail;
+ goto fail;
if ((code = gs_cmap_adobe1_alloc(&pcmap, 0, rname.value.const_bytes,
- r_size(&rname), r_size(&rcidsi),
- 0, 0, 0, 0, 0, imemory)) < 0)
- goto fail;
+ r_size(&rname), r_size(&rcidsi),
+ 0, 0, 0, 0, 0, imemory)) < 0)
+ goto fail;
if ((code = dict_int_param(op, "CMapType", 0, 1, 0, &pcmap->CMapType)) < 0 ||
- (code = dict_float_param(op, "CMapVersion", 0.0, &pcmap->CMapVersion)) < 0 ||
- (code = dict_uid_param(op, &pcmap->uid, 0, imemory, i_ctx_p)) < 0 ||
- (code = dict_int_param(op, "WMode", 0, 1, 0, &pcmap->WMode)) < 0
- )
- goto fail;
+ (code = dict_float_param(op, "CMapVersion", 0.0, &pcmap->CMapVersion)) < 0 ||
+ (code = dict_uid_param(op, &pcmap->uid, 0, imemory, i_ctx_p)) < 0 ||
+ (code = dict_int_param(op, "WMode", 0, 1, 0, &pcmap->WMode)) < 0
+ )
+ goto fail;
if (dict_find_string(op, "UIDOffset", &puidoffset) > 0) {
- if (!r_has_type(puidoffset, t_integer)) {
- code = gs_note_error(e_typecheck);
- goto fail;
- }
- pcmap->UIDOffset = puidoffset->value.intval; /* long, not int */
+ if (!r_has_type(puidoffset, t_integer)) {
+ code = gs_note_error(e_typecheck);
+ goto fail;
+ }
+ pcmap->UIDOffset = puidoffset->value.intval; /* long, not int */
}
for (i = 0; i < r_size(&rcidsi); ++i) {
code = get_cid_system_info(imemory, pcmap->CIDSystemInfo + i, &rcidsi, i);
- if (code < 0)
- goto fail;
+ if (code < 0)
+ goto fail;
}
array_get(imemory, pcodemapdata, 0L, &rcoderanges);
array_get(imemory, pcodemapdata, 1L, &rdefs);
array_get(imemory, pcodemapdata, 2L, &rnotdefs);
if ((code = acquire_code_ranges(pcmap, &rcoderanges, imemory)) < 0)
- goto fail;
+ goto fail;
if ((code = acquire_code_map(&pcmap->def, &rdefs, pcmap, imemory)) < 0)
- goto fail;
+ goto fail;
if ((code = acquire_code_map(&pcmap->notdef, &rnotdefs, pcmap, imemory)) < 0)
- goto fail;
+ goto fail;
if (!bytes_compare(pcmap->CIDSystemInfo->Registry.data, pcmap->CIDSystemInfo->Registry.size,
- (const byte *)"Artifex", 7) &&
- !bytes_compare(pcmap->CIDSystemInfo->Ordering.data, pcmap->CIDSystemInfo->Ordering.size,
- (const byte *)"Unicode", 7))
- pcmap->from_Unicode = true;
+ (const byte *)"Artifex", 7) &&
+ !bytes_compare(pcmap->CIDSystemInfo->Ordering.data, pcmap->CIDSystemInfo->Ordering.size,
+ (const byte *)"Unicode", 7))
+ pcmap->from_Unicode = true;
pcmap->mark_glyph = zfont_mark_glyph_name;
pcmap->mark_glyph_data = 0;
pcmap->glyph_name = zfcmap_glyph_name;
@@ -466,14 +465,14 @@ zbuildcmap(i_ctx_t *i_ctx_p)
make_istruct_new(&rcmap, a_readonly, pcmap);
code = idict_put_string(op, "CodeMap", &rcmap);
if (code < 0)
- goto fail;
+ goto fail;
return zreadonly(i_ctx_p);
fail:
if (pcmap) {
- free_code_map(&pcmap->notdef, imemory);
- free_code_map(&pcmap->def, imemory);
- ifree_object(pcmap->CIDSystemInfo, "zbuildcmap(CIDSystemInfo)");
- ifree_object(pcmap, "zbuildcmap(cmap)");
+ free_code_map(&pcmap->notdef, imemory);
+ free_code_map(&pcmap->def, imemory);
+ ifree_object(pcmap->CIDSystemInfo, "zbuildcmap(CIDSystemInfo)");
+ ifree_object(pcmap, "zbuildcmap(cmap)");
}
return code;
}
diff --git a/gs/psi/zfdctd.c b/gs/psi/zfdctd.c
index e1f06bcee..36711b5df 100644
--- a/gs/psi/zfdctd.c
+++ b/gs/psi/zfdctd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,7 +39,7 @@ find_stream_memory(i_ctx_t *i_ctx_p, int npop, uint space)
os_ptr sop = osp - npop;
if (r_has_type(sop, t_dictionary)) {
- --sop;
+ --sop;
}
use_space = max(use_space, r_space(sop));
return idmemory->spaces_indexed[use_space >> r_space_shift];
@@ -60,35 +60,35 @@ zDCTD(i_ctx_t *i_ctx_p)
uint dspace;
if (r_has_type(op, t_dictionary))
- dop = op, dspace = r_space(op);
+ dop = op, dspace = r_space(op);
else
- dop = 0, dspace = 0;
+ dop = 0, dspace = 0;
mem = (gs_memory_t *)find_stream_memory(i_ctx_p, 0, dspace);
state.memory = mem;
/* First allocate space for IJG parameters. */
jddp = gs_alloc_struct_immovable(mem,jpeg_decompress_data,
&st_jpeg_decompress_data, "zDCTD");
if (jddp == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (s_DCTD_template.set_defaults)
- (*s_DCTD_template.set_defaults) ((stream_state *) & state);
+ (*s_DCTD_template.set_defaults) ((stream_state *) & state);
state.data.decompress = jddp;
jddp->memory = state.jpeg_memory = mem; /* set now for allocation */
jddp->scanline_buffer = NULL; /* set this early for safe error exit */
state.report_error = filter_report_error; /* in case create fails */
if ((code = gs_jpeg_create_decompress(&state)) < 0)
- goto fail; /* correct to do jpeg_destroy here */
+ goto fail; /* correct to do jpeg_destroy here */
/* Read parameters from dictionary */
if ((code = dict_param_list_read(&list, dop, NULL, false, iimemory)) < 0)
- goto fail;
+ goto fail;
if ((code = s_DCTD_put_params((gs_param_list *) & list, &state)) < 0)
- goto rel;
+ goto rel;
/* Create the filter. */
jddp->template = s_DCTD_template;
code = filter_read(i_ctx_p, 0, &jddp->template,
- (stream_state *) & state, dspace);
+ (stream_state *) & state, dspace);
if (code >= 0) /* Success! */
- return code;
+ return code;
/*
* We assume that if filter_read fails, the stream has not been
* registered for closing, so s_DCTD_release will never be called.
diff --git a/gs/psi/zfdcte.c b/gs/psi/zfdcte.c
index d3a27bed8..f74f4c86a 100644
--- a/gs/psi/zfdcte.c
+++ b/gs/psi/zfdcte.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -52,38 +52,38 @@ zDCTE(i_ctx_t *i_ctx_p)
jcdp = gs_alloc_struct_immovable(mem, jpeg_compress_data,
&st_jpeg_compress_data, "zDCTE");
if (jcdp == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
state.memory = mem;
if (s_DCTE_template.set_defaults)
- (*s_DCTE_template.set_defaults) ((stream_state *) & state);
+ (*s_DCTE_template.set_defaults) ((stream_state *) & state);
state.data.compress = jcdp;
jcdp->memory = state.jpeg_memory = mem; /* set now for allocation */
state.report_error = filter_report_error; /* in case create fails */
if ((code = gs_jpeg_create_compress(&state)) < 0)
- goto fail; /* correct to do jpeg_destroy here */
+ goto fail; /* correct to do jpeg_destroy here */
/* Read parameters from dictionary */
if (r_has_type(op, t_dictionary))
- dop = op, dspace = r_space(op);
+ dop = op, dspace = r_space(op);
else
- dop = 0, dspace = 0;
+ dop = 0, dspace = 0;
if ((code = dict_param_list_read(&list, dop, NULL, false, iimemory)) < 0)
- goto fail;
+ goto fail;
if ((code = s_DCTE_put_params((gs_param_list *) & list, &state)) < 0)
- goto rel;
+ goto rel;
/* Create the filter. */
jcdp->template = s_DCTE_template;
/* Make sure we get at least a full scan line of input. */
state.scan_line_size = jcdp->cinfo.input_components *
- jcdp->cinfo.image_width;
+ jcdp->cinfo.image_width;
jcdp->template.min_in_size =
- max(s_DCTE_template.min_in_size, state.scan_line_size);
+ max(s_DCTE_template.min_in_size, state.scan_line_size);
/* Make sure we can write the user markers in a single go. */
jcdp->template.min_out_size =
- max(s_DCTE_template.min_out_size, state.Markers.size);
+ max(s_DCTE_template.min_out_size, state.Markers.size);
code = filter_write(i_ctx_p, 0, &jcdp->template,
- (stream_state *) & state, dspace);
+ (stream_state *) & state, dspace);
if (code >= 0) /* Success! */
- return code;
+ return code;
/* We assume that if filter_write fails, the stream has not been
* registered for closing, so s_DCTE_release will never be called.
* Therefore we free the allocated memory before failing.
@@ -113,16 +113,16 @@ zdcteparams(i_ctx_t *i_ctx_p)
check_type(op[-2], t_dictionary);
/* The DCT filters copy the template.... */
if (s->state->template->process != s_DCTE_template.process)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = dict_param_list_write(&list, op - 2, NULL, iimemory);
if (code < 0)
- return code;
+ return code;
code = s_DCTE_get_params((gs_param_list *) & list,
- (stream_DCT_state *) s->state,
- op->value.boolval);
+ (stream_DCT_state *) s->state,
+ op->value.boolval);
iparam_list_release(&list);
if (code >= 0)
- pop(2);
+ pop(2);
return code;
}
#endif
diff --git a/gs/psi/zfdecode.c b/gs/psi/zfdecode.c
index ca83d3a5b..832ea8ba3 100644
--- a/gs/psi/zfdecode.c
+++ b/gs/psi/zfdecode.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -60,9 +60,9 @@ zA85D(i_ctx_t *i_ctx_p)
int code;
if (r_has_type(op, t_dictionary)) {
- check_dict_read(*op);
- if ((code = dict_bool_param(op, "PDFRules", false, &ss.pdf_rules)) < 0)
- return code;
+ check_dict_read(*op);
+ if ((code = dict_bool_param(op, "PDFRules", false, &ss.pdf_rules)) < 0)
+ return code;
} else {
ss.pdf_rules = false;
}
@@ -80,7 +80,7 @@ zcf_setup(os_ptr op, stream_CF_state *pcfs, gs_ref_memory_t *imem)
int code = dict_param_list_read(&list, op, NULL, false, imem);
if (code < 0)
- return code;
+ return code;
s_CF_set_defaults_inline(pcfs);
code = s_CF_put_params((gs_param_list *)&list, pcfs);
iparam_list_release(&list);
@@ -98,13 +98,13 @@ zCFD(i_ctx_t *i_ctx_p)
int code;
if (r_has_type(op, t_dictionary)) {
- check_dict_read(*op);
- dop = op;
+ check_dict_read(*op);
+ dop = op;
} else
- dop = 0;
+ dop = 0;
code = zcf_setup(dop, (stream_CF_state *)&cfs, iimemory);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_CFD_template, (stream_state *)&cfs, 0);
}
@@ -112,7 +112,7 @@ zCFD(i_ctx_t *i_ctx_p)
int
filter_read_predictor(i_ctx_t *i_ctx_p, int npop,
- const stream_template * template, stream_state * st)
+ const stream_template * template, stream_state * st)
{
os_ptr op = osp;
int predictor, code;
@@ -120,65 +120,65 @@ filter_read_predictor(i_ctx_t *i_ctx_p, int npop,
stream_PNGP_state pps;
if (r_has_type(op, t_dictionary)) {
- if ((code = dict_int_param(op, "Predictor", 0, 15, 1, &predictor)) < 0)
- return code;
- switch (predictor) {
- case 0: /* identity */
- predictor = 1;
- case 1: /* identity */
- break;
- case 2: /* componentwise horizontal differencing */
- code = zpd_setup(op, &pds);
- break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- /* PNG prediction */
- code = zpp_setup(op, &pps);
- break;
- default:
- return_error(e_rangecheck);
- }
- if (code < 0)
- return code;
+ if ((code = dict_int_param(op, "Predictor", 0, 15, 1, &predictor)) < 0)
+ return code;
+ switch (predictor) {
+ case 0: /* identity */
+ predictor = 1;
+ case 1: /* identity */
+ break;
+ case 2: /* componentwise horizontal differencing */
+ code = zpd_setup(op, &pds);
+ break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ /* PNG prediction */
+ code = zpp_setup(op, &pps);
+ break;
+ default:
+ return_error(e_rangecheck);
+ }
+ if (code < 0)
+ return code;
} else
- predictor = 1;
+ predictor = 1;
if (predictor == 1)
- return filter_read(i_ctx_p, npop, template, st, 0);
+ return filter_read(i_ctx_p, npop, template, st, 0);
{
- /* We need to cascade filters. */
- ref rsource, rdict;
- int code;
-
- /* Save the operands, just in case. */
- ref_assign(&rsource, op - 1);
- ref_assign(&rdict, op);
- code = filter_read(i_ctx_p, 1, template, st, 0);
- if (code < 0)
- return code;
- /* filter_read changed osp.... */
- op = osp;
- code =
- (predictor == 2 ?
- filter_read(i_ctx_p, 0, &s_PDiffD_template, (stream_state *) & pds, 0) :
- filter_read(i_ctx_p, 0, &s_PNGPD_template, (stream_state *) & pps, 0));
- if (code < 0) {
- /* Restore the operands. Don't bother trying to clean up */
- /* the first stream. */
- osp = ++op;
- ref_assign(op - 1, &rsource);
- ref_assign(op, &rdict);
- return code;
- }
- /*
- * Mark the compression stream as temporary, and propagate
- * CloseSource from it to the predictor stream.
- */
- filter_mark_strm_temp(op, 2);
- return code;
+ /* We need to cascade filters. */
+ ref rsource, rdict;
+ int code;
+
+ /* Save the operands, just in case. */
+ ref_assign(&rsource, op - 1);
+ ref_assign(&rdict, op);
+ code = filter_read(i_ctx_p, 1, template, st, 0);
+ if (code < 0)
+ return code;
+ /* filter_read changed osp.... */
+ op = osp;
+ code =
+ (predictor == 2 ?
+ filter_read(i_ctx_p, 0, &s_PDiffD_template, (stream_state *) & pds, 0) :
+ filter_read(i_ctx_p, 0, &s_PNGPD_template, (stream_state *) & pps, 0));
+ if (code < 0) {
+ /* Restore the operands. Don't bother trying to clean up */
+ /* the first stream. */
+ osp = ++op;
+ ref_assign(op - 1, &rsource);
+ ref_assign(op, &rdict);
+ return code;
+ }
+ /*
+ * Mark the compression stream as temporary, and propagate
+ * CloseSource from it to the predictor stream.
+ */
+ filter_mark_strm_temp(op, 2);
+ return code;
}
}
@@ -192,25 +192,25 @@ zlz_setup(os_ptr op, stream_LZW_state * plzs)
const ref *dop;
if (r_has_type(op, t_dictionary)) {
- check_dict_read(*op);
- dop = op;
+ check_dict_read(*op);
+ dop = op;
} else
- dop = 0;
+ dop = 0;
if ( (code = dict_int_param(dop, "EarlyChange", 0, 1, 1,
- &plzs->EarlyChange)) < 0 ||
- /*
- * The following are not PostScript standard, although
- * LanguageLevel 3 provides the first two under different
- * names.
- */
- (code = dict_int_param(dop, "InitialCodeLength", 2, 11, 8,
- &plzs->InitialCodeLength)) < 0 ||
- (code = dict_bool_param(dop, "FirstBitLowOrder", false,
- &plzs->FirstBitLowOrder)) < 0 ||
- (code = dict_bool_param(dop, "BlockData", false,
- &plzs->BlockData)) < 0
- )
- return code;
+ &plzs->EarlyChange)) < 0 ||
+ /*
+ * The following are not PostScript standard, although
+ * LanguageLevel 3 provides the first two under different
+ * names.
+ */
+ (code = dict_int_param(dop, "InitialCodeLength", 2, 11, 8,
+ &plzs->InitialCodeLength)) < 0 ||
+ (code = dict_bool_param(dop, "FirstBitLowOrder", false,
+ &plzs->FirstBitLowOrder)) < 0 ||
+ (code = dict_bool_param(dop, "BlockData", false,
+ &plzs->BlockData)) < 0
+ )
+ return code;
return 0;
}
@@ -224,21 +224,21 @@ zLZWD(i_ctx_t *i_ctx_p)
int code = zlz_setup(op, &lzs);
if (code < 0)
- return code;
+ return code;
if (LL3_ENABLED && r_has_type(op, t_dictionary)) {
- int unit_size;
-
- if ((code = dict_bool_param(op, "LowBitFirst", lzs.FirstBitLowOrder,
- &lzs.FirstBitLowOrder)) < 0 ||
- (code = dict_int_param(op, "UnitSize", 3, 8, 8,
- &unit_size)) < 0
- )
- return code;
- if (code == 0 /* UnitSize specified */ )
- lzs.InitialCodeLength = unit_size + 1;
+ int unit_size;
+
+ if ((code = dict_bool_param(op, "LowBitFirst", lzs.FirstBitLowOrder,
+ &lzs.FirstBitLowOrder)) < 0 ||
+ (code = dict_int_param(op, "UnitSize", 3, 8, 8,
+ &unit_size)) < 0
+ )
+ return code;
+ if (code == 0 /* UnitSize specified */ )
+ lzs.InitialCodeLength = unit_size + 1;
}
return filter_read_predictor(i_ctx_p, 0, &s_LZWD_template,
- (stream_state *) & lzs);
+ (stream_state *) & lzs);
}
/* ------ Color differencing filters ------ */
@@ -255,14 +255,14 @@ zpd_setup(os_ptr op, stream_PDiff_state * ppds)
check_type(*op, t_dictionary);
check_dict_read(*op);
if ((code = dict_int_param(op, "Colors", 1, s_PDiff_max_Colors, 1,
- &ppds->Colors)) < 0 ||
- (code = dict_int_param(op, "BitsPerComponent", 1, 16, 8,
- &bpc)) < 0 ||
- (bpc & (bpc - 1)) != 0 ||
- (code = dict_int_param(op, "Columns", 1, max_int, 1,
- &ppds->Columns)) < 0
- )
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ &ppds->Colors)) < 0 ||
+ (code = dict_int_param(op, "BitsPerComponent", 1, 16, 8,
+ &bpc)) < 0 ||
+ (bpc & (bpc - 1)) != 0 ||
+ (code = dict_int_param(op, "Columns", 1, max_int, 1,
+ &ppds->Columns)) < 0
+ )
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
ppds->BitsPerComponent = bpc;
return 0;
}
@@ -276,7 +276,7 @@ zPDiffE(i_ctx_t *i_ctx_p)
int code = zpd_setup(op, &pds);
if (code < 0)
- return code;
+ return code;
return filter_write(i_ctx_p, 0, &s_PDiffE_template, (stream_state *) & pds, 0);
}
@@ -289,7 +289,7 @@ zPDiffD(i_ctx_t *i_ctx_p)
int code = zpd_setup(op, &pds);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_PDiffD_template, (stream_state *) & pds, 0);
}
@@ -304,16 +304,16 @@ zpp_setup(os_ptr op, stream_PNGP_state * ppps)
check_type(*op, t_dictionary);
check_dict_read(*op);
if ((code = dict_int_param(op, "Colors", 1, s_PNG_max_Colors, 1,
- &ppps->Colors)) < 0 ||
- (code = dict_int_param(op, "BitsPerComponent", 1, 16, 8,
- &bpc)) < 0 ||
- (bpc & (bpc - 1)) != 0 ||
- (code = dict_uint_param(op, "Columns", 1, max_uint, 1,
- &ppps->Columns)) < 0 ||
- (code = dict_int_param(op, "Predictor", 10, 15, 15,
- &ppps->Predictor)) < 0
- )
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ &ppps->Colors)) < 0 ||
+ (code = dict_int_param(op, "BitsPerComponent", 1, 16, 8,
+ &bpc)) < 0 ||
+ (bpc & (bpc - 1)) != 0 ||
+ (code = dict_uint_param(op, "Columns", 1, max_uint, 1,
+ &ppps->Columns)) < 0 ||
+ (code = dict_int_param(op, "Predictor", 10, 15, 15,
+ &ppps->Predictor)) < 0
+ )
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
ppps->BitsPerComponent = bpc;
return 0;
}
@@ -327,7 +327,7 @@ zPNGPE(i_ctx_t *i_ctx_p)
int code = zpp_setup(op, &pps);
if (code < 0)
- return code;
+ return code;
return filter_write(i_ctx_p, 0, &s_PNGPE_template, (stream_state *) & pps, 0);
}
@@ -340,7 +340,7 @@ zPNGPD(i_ctx_t *i_ctx_p)
int code = zpp_setup(op, &pps);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_PNGPD_template, (stream_state *) & pps, 0);
}
diff --git a/gs/psi/zfile.c b/gs/psi/zfile.c
index e54f0edac..8d237ef92 100644
--- a/gs/psi/zfile.c
+++ b/gs/psi/zfile.c
@@ -468,13 +468,13 @@ zstatus(i_ctx_t *i_ctx_p)
struct stat fstat;
int code = parse_file_name(op, &pname,
i_ctx_p->LockFilePermissions, imemory);
- if (code < 0) {
- if (code == e_undefinedfilename) {
+ if (code < 0) {
+ if (code == e_undefinedfilename) {
make_bool(op, 0);
code = 0;
- }
+ }
return code;
- }
+ }
code = gs_terminate_file_name(&pname, imemory, "status");
if (code < 0)
return code;
@@ -893,7 +893,6 @@ check_file_permissions_aux(i_ctx_t *i_ctx_p, char *fname, uint flen)
return 0;
}
-
/* return zero for success, -ve for error, +1 for continue */
static int
lib_file_open_search_with_no_combine(gs_file_path_ptr lib_path, const gs_memory_t *mem, i_ctx_t *i_ctx_p,
diff --git a/gs/psi/zfile.h b/gs/psi/zfile.h
index defa2408e..2a33c414d 100644
--- a/gs/psi/zfile.h
+++ b/gs/psi/zfile.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zfile1.c b/gs/psi/zfile1.c
index 73bd96fd0..927d18d40 100644
--- a/gs/psi/zfile1.c
+++ b/gs/psi/zfile1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,21 +45,21 @@ zfile_name_combine(i_ctx_t *i_ctx_p)
blen = blen0 = plen + flen + 2; /* Inserts separator and ending zero byte. */
buffer = ialloc_string(blen, "zfile_name_combine");
if (buffer == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
prefix = op[-2].value.const_bytes;
fname = op[-1].value.const_bytes;
no_sibling = op[0].value.boolval;
- if (gp_file_name_combine((const char *)prefix, plen,
- (const char *)fname, flen, no_sibling,
- (char *)buffer, &blen) != gp_combine_success) {
- make_bool(op, false);
+ if (gp_file_name_combine((const char *)prefix, plen,
+ (const char *)fname, flen, no_sibling,
+ (char *)buffer, &blen) != gp_combine_success) {
+ make_bool(op, false);
} else {
- buffer = iresize_string(buffer, blen0, blen, "zfile_name_combine");
- if (buffer == 0)
- return_error(e_VMerror);
- make_string(op - 2, a_all | icurrent_space, blen, buffer);
- make_bool(op - 1, true);
- pop(1);
+ buffer = iresize_string(buffer, blen0, blen, "zfile_name_combine");
+ if (buffer == 0)
+ return_error(e_VMerror);
+ make_string(op - 2, a_all | icurrent_space, blen, buffer);
+ make_bool(op - 1, true);
+ pop(1);
}
return 0;
}
@@ -74,8 +74,8 @@ zfile_name_is_absolute(i_ctx_t *i_ctx_p)
{ os_ptr op = osp;
check_type(op[0], t_string);
- make_bool(op, gp_file_name_is_absolute((const char *)op->value.const_bytes,
- r_size(op)));
+ make_bool(op, gp_file_name_is_absolute((const char *)op->value.const_bytes,
+ r_size(op)));
return 0;
}
@@ -86,7 +86,7 @@ push_string(i_ctx_t *i_ctx_p, const char *v)
push(1);
make_const_string(op, avm_foreign | a_readonly,
- len, (const byte *)v);
+ len, (const byte *)v);
return 0;
}
@@ -124,4 +124,3 @@ const op_def zfile1_op_defs[] =
{"0.file_name_parent", zfile_name_parent},
op_def_end(0)
};
-
diff --git a/gs/psi/zfileio.c b/gs/psi/zfileio.c
index fa5e39f26..61f5c2bd2 100644
--- a/gs/psi/zfileio.c
+++ b/gs/psi/zfileio.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -31,9 +31,9 @@
/* Forward references */
static int write_string(ref *, stream *);
static int handle_read_status(i_ctx_t *, int, const ref *, const uint *,
- op_proc_t);
+ op_proc_t);
static int handle_write_status(i_ctx_t *, int, const ref *, const uint *,
- op_proc_t);
+ op_proc_t);
/* ------ Operators ------ */
@@ -46,16 +46,16 @@ zclosefile(i_ctx_t *i_ctx_p)
check_type(*op, t_file);
if (file_is_valid(s, op)) { /* closing a closed file is a no-op */
- int status = sclose(s);
-
- if (status != 0 && status != EOFC) {
- if (s_is_writing(s))
- return handle_write_status(i_ctx_p, status, op, NULL,
- zclosefile);
- else
- return handle_read_status(i_ctx_p, status, op, NULL,
- zclosefile);
- }
+ int status = sclose(s);
+
+ if (status != 0 && status != EOFC) {
+ if (s_is_writing(s))
+ return handle_write_status(i_ctx_p, status, op, NULL,
+ zclosefile);
+ else
+ return handle_read_status(i_ctx_p, status, op, NULL,
+ zclosefile);
+ }
}
pop(1);
return 0;
@@ -82,15 +82,15 @@ zread(i_ctx_t *i_ctx_p)
push(1);
ch = sgetc(s);
if (ch >= 0) {
- make_int(op - 1, ch);
- make_bool(op, 1);
+ make_int(op - 1, ch);
+ make_bool(op, 1);
} else {
- pop(1); /* Adjust ostack back from preparatory 'pop' */
- op--;
- if (ch == EOFC)
- make_bool(op, 0);
+ pop(1); /* Adjust ostack back from preparatory 'pop' */
+ op--;
+ if (ch == EOFC)
+ make_bool(op, 0);
else
- return handle_read_status(i_ctx_p, ch, op, NULL, zread);
+ return handle_read_status(i_ctx_p, ch, op, NULL, zread);
}
return 0;
}
@@ -109,8 +109,8 @@ zwrite(i_ctx_t *i_ctx_p)
ch = (byte) op->value.intval;
status = sputc(s, (byte) ch);
if (status >= 0) {
- pop(2);
- return 0;
+ pop(2);
+ return 0;
}
return handle_write_status(i_ctx_p, status, op - 1, NULL, zwrite);
}
@@ -137,25 +137,25 @@ zreadhexstring_at(i_ctx_t *i_ctx_p, os_ptr op, uint start, int odd)
cw.ptr = str + start - 1;
cw.limit = str + len - 1;
for (;;) {
- status = s_hex_process(&s->cursor.r, &cw, &odd_byte,
- hex_ignore_garbage);
- if (status == 1) { /* filled the string */
- ref_assign_inline(op - 1, op);
- make_true(op);
- return 0;
- } else if (status != 0) /* error or EOF */
- break;
- /* Didn't fill, keep going. */
- status = spgetc(s);
- if (status < 0)
- break;
- sputback(s);
+ status = s_hex_process(&s->cursor.r, &cw, &odd_byte,
+ hex_ignore_garbage);
+ if (status == 1) { /* filled the string */
+ ref_assign_inline(op - 1, op);
+ make_true(op);
+ return 0;
+ } else if (status != 0) /* error or EOF */
+ break;
+ /* Didn't fill, keep going. */
+ status = spgetc(s);
+ if (status < 0)
+ break;
+ sputback(s);
}
nread = cw.ptr + 1 - str;
if (status != EOFC) { /* Error */
- nread |= odd_byte << 24;
+ nread |= odd_byte << 24;
return handle_read_status(i_ctx_p, status, op - 1, &nread,
- zreadhexstring_continue);
+ zreadhexstring_continue);
}
/* Reached end-of-file before filling the string. */
/* Return an appropriate substring. */
@@ -183,13 +183,13 @@ zreadhexstring_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
length = op->value.intval & 0xFFFFFF;
odd = op->value.intval >> 24;
-
+
if (length > r_size(op - 1) || odd < -1 || odd > 0xF)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
check_write_type(op[-1], t_string);
code = zreadhexstring_at(i_ctx_p, op - 1, (uint)length, odd);
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -213,36 +213,36 @@ zwritehexstring_at(i_ctx_t *i_ctx_p, os_ptr op, uint odd)
p = op->value.bytes;
len = r_size(op);
while (len) {
- uint len1 = min(len, MAX_HEX / 2);
- register byte *q = buf;
- uint count = len1;
- ref rbuf;
-
- do {
- ch = *p++;
- *q++ = hex_digits[ch >> 4];
- *q++ = hex_digits[ch & 0xf];
- }
- while (--count);
- r_set_size(&rbuf, (len1 << 1) - odd);
- rbuf.value.bytes = buf + odd;
- status = write_string(&rbuf, s);
- switch (status) {
- default:
- return_error(e_ioerror);
- case 0:
- len -= len1;
- odd = 0;
- continue;
- case INTC:
- case CALLC:
- count = rbuf.value.bytes - buf;
- op->value.bytes += count >> 1;
- r_set_size(op, len - (count >> 1));
- count &= 1;
- return handle_write_status(i_ctx_p, status, op - 1, &count,
- zwritehexstring_continue);
- }
+ uint len1 = min(len, MAX_HEX / 2);
+ register byte *q = buf;
+ uint count = len1;
+ ref rbuf;
+
+ do {
+ ch = *p++;
+ *q++ = hex_digits[ch >> 4];
+ *q++ = hex_digits[ch & 0xf];
+ }
+ while (--count);
+ r_set_size(&rbuf, (len1 << 1) - odd);
+ rbuf.value.bytes = buf + odd;
+ status = write_string(&rbuf, s);
+ switch (status) {
+ default:
+ return_error(e_ioerror);
+ case 0:
+ len -= len1;
+ odd = 0;
+ continue;
+ case INTC:
+ case CALLC:
+ count = rbuf.value.bytes - buf;
+ op->value.bytes += count >> 1;
+ r_set_size(op, len - (count >> 1));
+ count &= 1;
+ return handle_write_status(i_ctx_p, status, op - 1, &count,
+ zwritehexstring_continue);
+ }
}
pop(2);
return 0;
@@ -265,10 +265,10 @@ zwritehexstring_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if ((op->value.intval & ~1) != 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = zwritehexstring_at(i_ctx_p, op - 1, (uint) op->value.intval);
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -287,12 +287,12 @@ zreadstring_at(i_ctx_t *i_ctx_p, os_ptr op, uint start)
status = sgets(s, op->value.bytes + start, len - start, &rlen);
rlen += start;
switch (status) {
- case EOFC:
- case 0:
- break;
- default:
- return handle_read_status(i_ctx_p, status, op - 1, &rlen,
- zreadstring_continue);
+ case EOFC:
+ case 0:
+ break;
+ default:
+ return handle_read_status(i_ctx_p, status, op - 1, &rlen,
+ zreadstring_continue);
}
/*
* The most recent Adobe specification says that readstring
@@ -302,7 +302,7 @@ zreadstring_at(i_ctx_t *i_ctx_p, os_ptr op, uint start)
* len is zero, sgets will return 0 immediately with rlen = 0.
*/
if (len == 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
r_set_size(op, rlen);
op[-1] = *op;
make_bool(op, (rlen == len ? 1 : 0));
@@ -325,10 +325,10 @@ zreadstring_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0 || op->value.intval > r_size(op - 1))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = zreadstring_at(i_ctx_p, op - 1, (uint) op->value.intval);
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -344,8 +344,8 @@ zwritestring(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
status = write_string(op, s);
if (status >= 0) {
- pop(2);
- return 0;
+ pop(2);
+ return 0;
}
return handle_write_status(i_ctx_p, status, op - 1, NULL, zwritestring);
}
@@ -377,23 +377,23 @@ zreadline_at(i_ctx_t *i_ctx_p, os_ptr op, uint count, bool in_eol)
str.size = r_size(op);
status = zreadline_from(s, &str, NULL, &count, &in_eol);
switch (status) {
- case 0:
- case EOFC:
- break;
- case 1:
- return_error(e_rangecheck);
- default:
- if (count == 0 && !in_eol)
- return handle_read_status(i_ctx_p, status, op - 1, NULL,
- zreadline);
- else {
- if (in_eol) {
- r_set_size(op, count);
- count = 0;
- }
- return handle_read_status(i_ctx_p, status, op - 1, &count,
- zreadline_continue);
- }
+ case 0:
+ case EOFC:
+ break;
+ case 1:
+ return_error(e_rangecheck);
+ default:
+ if (count == 0 && !in_eol)
+ return handle_read_status(i_ctx_p, status, op - 1, NULL,
+ zreadline);
+ else {
+ if (in_eol) {
+ r_set_size(op, count);
+ count = 0;
+ }
+ return handle_read_status(i_ctx_p, status, op - 1, &count,
+ zreadline_continue);
+ }
}
r_set_size(op, count);
op[-1] = *op;
@@ -419,12 +419,12 @@ zreadline_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0 || op->value.intval > size)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
start = (uint) op->value.intval;
code = (start == 0 ? zreadline_at(i_ctx_p, op - 1, size, true) :
- zreadline_at(i_ctx_p, op - 1, start, false));
+ zreadline_at(i_ctx_p, op - 1, start, false));
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -433,16 +433,16 @@ zreadline_continue(i_ctx_t *i_ctx_p)
/* This is exported for %lineedit. */
int
zreadline_from(stream *s, gs_string *buf, gs_memory_t *bufmem,
- uint *pcount, bool *pin_eol)
+ uint *pcount, bool *pin_eol)
{
sreadline_proc((*readline));
if (zis_stdin(s))
- readline = gp_readline;
+ readline = gp_readline;
else
- readline = sreadline;
+ readline = sreadline;
return readline(s, NULL, NULL /*WRONG*/, NULL, buf, bufmem,
- pcount, pin_eol, zis_stdin);
+ pcount, pin_eol, zis_stdin);
}
/* <file> bytesavailable <int> */
@@ -455,12 +455,12 @@ zbytesavailable(i_ctx_t *i_ctx_p)
check_read_file(i_ctx_p, s, op);
switch (savailable(s, &avail)) {
- default:
- return_error(e_ioerror);
- case EOFC:
- avail = -1;
- case 0:
- ;
+ default:
+ return_error(e_ioerror);
+ case EOFC:
+ avail = -1;
+ case 0:
+ ;
}
make_int(op, avail);
return 0;
@@ -476,17 +476,17 @@ zflush(i_ctx_t *i_ctx_p)
int code = zget_stdout(i_ctx_p, &s);
if (code < 0)
- return code;
+ return code;
make_stream_file(&rstdout, s, "w");
status = sflush(s);
if (status == 0 || status == EOFC) {
- return 0;
+ return 0;
}
return
- (s_is_writing(s) ?
- handle_write_status(i_ctx_p, status, &rstdout, NULL, zflush) :
- handle_read_status(i_ctx_p, status, &rstdout, NULL, zflush));
+ (s_is_writing(s) ?
+ handle_write_status(i_ctx_p, status, &rstdout, NULL, zflush) :
+ handle_read_status(i_ctx_p, status, &rstdout, NULL, zflush));
}
/* <file> flushfile - */
@@ -503,20 +503,20 @@ zflushfile(i_ctx_t *i_ctx_p)
* error on closed output files.
*/
if (file_is_invalid(s, op)) {
- if (r_has_attr(op, a_write))
- return_error(e_invalidaccess);
- pop(1);
- return 0;
+ if (r_has_attr(op, a_write))
+ return_error(e_invalidaccess);
+ pop(1);
+ return 0;
}
status = sflush(s);
if (status == 0 || status == EOFC) {
- pop(1);
- return 0;
+ pop(1);
+ return 0;
}
return
- (s_is_writing(s) ?
- handle_write_status(i_ctx_p, status, op, NULL, zflushfile) :
- handle_read_status(i_ctx_p, status, op, NULL, zflushfile));
+ (s_is_writing(s) ?
+ handle_write_status(i_ctx_p, status, op, NULL, zflushfile) :
+ handle_read_status(i_ctx_p, status, op, NULL, zflushfile));
}
/* <file> resetfile - */
@@ -529,7 +529,7 @@ zresetfile(i_ctx_t *i_ctx_p)
/* According to Adobe, resetfile is a no-op on closed files. */
check_type(*op, t_file);
if (file_is_valid(s, op))
- sreset(s);
+ sreset(s);
pop(1);
return 0;
}
@@ -547,18 +547,18 @@ zprint(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
code = zget_stdout(i_ctx_p, &s);
if (code < 0)
- return code;
+ return code;
status = write_string(op, s);
if (status >= 0) {
- pop(1);
- return 0;
+ pop(1);
+ return 0;
}
/* Convert print to writestring on the fly. */
make_stream_file(&rstdout, s, "w");
code = handle_write_status(i_ctx_p, status, &rstdout, NULL,
- zwritestring);
+ zwritestring);
if (code != o_push_estack)
- return code;
+ return code;
push(1);
*op = op[-1];
op[-1] = rstdout;
@@ -592,7 +592,7 @@ zfileposition(i_ctx_t *i_ctx_p)
* streams.
*/
if (!s_can_seek(s))
- return_error(e_ioerror);
+ return_error(e_ioerror);
make_int(op, stell(s));
return 0;
}
@@ -622,7 +622,7 @@ zsetfileposition(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
check_file(s, op - 1);
if (sseek(s, op->value.intval) < 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
pop(2);
return 0;
}
@@ -641,19 +641,19 @@ zfilename(i_ctx_t *i_ctx_p)
check_file(s, op);
if (sfilename(s, &fname) < 0) {
- make_false(op);
- return 0;
+ make_false(op);
+ return 0;
}
check_ostack(1);
str = ialloc_string(fname.size, "filename");
if (str == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
memcpy(str, fname.data, fname.size);
push(1); /* can't fail */
- make_const_string( op - 1 ,
- a_all | imemory_space((const struct gs_ref_memory_s*) imemory),
- fname.size,
- str);
+ make_const_string( op - 1 ,
+ a_all | imemory_space((const struct gs_ref_memory_s*) imemory),
+ fname.size,
+ str);
make_true(op);
return 0;
}
@@ -667,7 +667,7 @@ zisprocfilter(i_ctx_t *i_ctx_p)
check_file(s, op);
while (s->strm != 0)
- s = s->strm;
+ s = s->strm;
make_bool(op, s_is_proc(s));
return 0;
}
@@ -684,29 +684,29 @@ zpeekstring(i_ctx_t *i_ctx_p)
check_write_type(*op, t_string);
len = r_size(op);
while ((rlen = sbufavailable(s)) < len) {
- int status = s->end_status;
-
- switch (status) {
- case EOFC:
- break;
- case 0:
- /*
- * The following is a HACK. It should reallocate the buffer to hold
- * at least len bytes. However, this raises messy problems about
- * which allocator to use and how it should interact with restore.
- */
- if (len >= s->bsize)
- return_error(e_rangecheck);
- s_process_read_buf(s);
- continue;
- default:
- return handle_read_status(i_ctx_p, status, op - 1, NULL,
- zpeekstring);
- }
- break;
+ int status = s->end_status;
+
+ switch (status) {
+ case EOFC:
+ break;
+ case 0:
+ /*
+ * The following is a HACK. It should reallocate the buffer to hold
+ * at least len bytes. However, this raises messy problems about
+ * which allocator to use and how it should interact with restore.
+ */
+ if (len >= s->bsize)
+ return_error(e_rangecheck);
+ s_process_read_buf(s);
+ continue;
+ default:
+ return handle_read_status(i_ctx_p, status, op - 1, NULL,
+ zpeekstring);
+ }
+ break;
}
if (rlen > len)
- rlen = len;
+ rlen = len;
/* Don't remove the data from the buffer. */
memcpy(op->value.bytes, sbufptr(s), rlen);
r_set_size(op, rlen);
@@ -727,9 +727,9 @@ zunread(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
ch = op->value.intval;
if (ch > 0xff)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (sungetc(s, (byte) ch) < 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
pop(2);
return 0;
}
@@ -749,45 +749,45 @@ zwritecvp_at(i_ctx_t *i_ctx_p, os_ptr op, uint start, bool first)
check_write_file(s, op - 2);
check_type(*op, t_integer);
code = obj_cvp(op - 1, str, sizeof(str), &len, (int)op->value.intval,
- start, imemory, true);
+ start, imemory, true);
if (code == e_rangecheck) {
code = obj_string_data(imemory, op - 1, &data, &len);
- if (len < start)
- return_error(e_rangecheck);
- data += start;
- len -= start;
+ if (len < start)
+ return_error(e_rangecheck);
+ data += start;
+ len -= start;
}
if (code < 0)
- return code;
+ return code;
r_set_size(&rstr, len);
rstr.value.const_bytes = data;
status = write_string(&rstr, s);
switch (status) {
- default:
- return_error(e_ioerror);
- case 0:
- break;
- case INTC:
- case CALLC:
- len = start + len - r_size(&rstr);
- if (!first)
- --osp; /* pop(1) without affecting op */
- return handle_write_status(i_ctx_p, status, op - 2, &len,
- zwritecvp_continue);
+ default:
+ return_error(e_ioerror);
+ case 0:
+ break;
+ case INTC:
+ case CALLC:
+ len = start + len - r_size(&rstr);
+ if (!first)
+ --osp; /* pop(1) without affecting op */
+ return handle_write_status(i_ctx_p, status, op - 2, &len,
+ zwritecvp_continue);
}
if (code == 1) {
- if (first)
- check_ostack(1);
- push_op_estack(zwritecvp_continue);
- if (first)
- push(1);
- make_int(osp, start + len);
- return o_push_estack;
+ if (first)
+ check_ostack(1);
+ push_op_estack(zwritecvp_continue);
+ if (first)
+ push(1);
+ make_int(osp, start + len);
+ return o_push_estack;
}
if (first) /* zwritecvp */
- pop(3);
+ pop(3);
else /* zwritecvp_continue */
- pop(4);
+ pop(4);
return 0;
}
static int
@@ -804,18 +804,17 @@ zwritecvp_continue(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval != (uint) op->value.intval)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return zwritecvp_at(i_ctx_p, op - 1, (uint) op->value.intval, false);
}
-
/* ------ Initialization procedure ------ */
/* We need to split the table because of the 16-element limit. */
const op_def zfileio1_op_defs[] = {
{"1bytesavailable", zbytesavailable},
{"1closefile", zclosefile},
- /* currentfile is in zcontrol.c */
+ /* currentfile is in zcontrol.c */
{"1echo", zecho},
{"1.filename", zfilename},
{"1.fileposition", zxfileposition},
@@ -839,7 +838,7 @@ const op_def zfileio2_op_defs[] = {
{"3.writecvp", zwritecvp},
{"2writehexstring", zwritehexstring},
{"2writestring", zwritestring},
- /* Internal operators */
+ /* Internal operators */
{"3%zreadhexstring_continue", zreadhexstring_continue},
{"3%zreadline_continue", zreadline_continue},
{"3%zreadstring_continue", zreadstring_continue},
@@ -858,9 +857,9 @@ file_switch_to_read(const ref * op)
stream *s = fptr(op);
if (s->write_id != r_size(op) || s->file == 0) /* not valid */
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
if (sswitch(s, false) < 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
s->read_id = s->write_id; /* enable reading */
s->write_id = 0; /* disable writing */
return 0;
@@ -874,9 +873,9 @@ file_switch_to_write(const ref * op)
stream *s = fptr(op);
if (s->read_id != r_size(op) || s->file == 0) /* not valid */
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
if (sswitch(s, true) < 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
s->write_id = s->read_id; /* enable writing */
s->read_id = 0; /* disable reading */
return 0;
@@ -895,13 +894,13 @@ write_string(ref * op, stream * s)
int status = sputs(s, data, len, &wlen);
switch (status) {
- case INTC:
- case CALLC:
- op->value.const_bytes = data + wlen;
- r_set_size(op, len - wlen);
- /* falls through */
- default: /* 0, EOFC, ERRC */
- return status;
+ case INTC:
+ case CALLC:
+ op->value.const_bytes = data + wlen;
+ r_set_size(op, len - wlen);
+ /* falls through */
+ default: /* 0, EOFC, ERRC */
+ return status;
}
}
@@ -915,13 +914,13 @@ copy_error_string(i_ctx_t *i_ctx_p, const ref *fop)
stream *s;
for (s = fptr(fop); s->strm != 0 && s->state->error_string[0] == 0;)
- s = s->strm;
+ s = s->strm;
if (s->state->error_string[0]) {
- int code = gs_errorinfo_put_string(i_ctx_p, s->state->error_string);
+ int code = gs_errorinfo_put_string(i_ctx_p, s->state->error_string);
- if (code < 0)
- return code;
- s->state->error_string[0] = 0; /* just do it once */
+ if (code < 0)
+ return code;
+ s->state->error_string[0] = 0; /* just do it once */
}
return_error(e_ioerror);
}
@@ -932,24 +931,24 @@ copy_error_string(i_ctx_t *i_ctx_p, const ref *fop)
/* Return 0, 1 (EOF), o_push_estack, or an error. */
static int
handle_read_status(i_ctx_t *i_ctx_p, int ch, const ref * fop,
- const uint * pindex, op_proc_t cont)
+ const uint * pindex, op_proc_t cont)
{
switch (ch) {
- default: /* error */
- return copy_error_string(i_ctx_p, fop);
- case EOFC:
- return 1;
- case INTC:
- case CALLC:
- if (pindex) {
- ref index;
-
- make_int(&index, *pindex);
- return s_handle_read_exception(i_ctx_p, ch, fop, &index, 1,
- cont);
- } else
- return s_handle_read_exception(i_ctx_p, ch, fop, NULL, 0,
- cont);
+ default: /* error */
+ return copy_error_string(i_ctx_p, fop);
+ case EOFC:
+ return 1;
+ case INTC:
+ case CALLC:
+ if (pindex) {
+ ref index;
+
+ make_int(&index, *pindex);
+ return s_handle_read_exception(i_ctx_p, ch, fop, &index, 1,
+ cont);
+ } else
+ return s_handle_read_exception(i_ctx_p, ch, fop, NULL, 0,
+ cont);
}
}
@@ -959,23 +958,23 @@ handle_read_status(i_ctx_t *i_ctx_p, int ch, const ref * fop,
/* Return 0, 1 (EOF), o_push_estack, or an error. */
static int
handle_write_status(i_ctx_t *i_ctx_p, int ch, const ref * fop,
- const uint * pindex, op_proc_t cont)
+ const uint * pindex, op_proc_t cont)
{
switch (ch) {
- default: /* error */
- return copy_error_string(i_ctx_p, fop);
- case EOFC:
- return 1;
- case INTC:
- case CALLC:
- if (pindex) {
- ref index;
-
- make_int(&index, *pindex);
- return s_handle_write_exception(i_ctx_p, ch, fop, &index, 1,
- cont);
- } else
- return s_handle_write_exception(i_ctx_p, ch, fop, NULL, 0,
- cont);
+ default: /* error */
+ return copy_error_string(i_ctx_p, fop);
+ case EOFC:
+ return 1;
+ case INTC:
+ case CALLC:
+ if (pindex) {
+ ref index;
+
+ make_int(&index, *pindex);
+ return s_handle_write_exception(i_ctx_p, ch, fop, &index, 1,
+ cont);
+ } else
+ return s_handle_write_exception(i_ctx_p, ch, fop, NULL, 0,
+ cont);
}
}
diff --git a/gs/psi/zfilter.c b/gs/psi/zfilter.c
index 19e44b40f..466471288 100644
--- a/gs/psi/zfilter.c
+++ b/gs/psi/zfilter.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -81,15 +81,15 @@ static int
rl_setup(os_ptr dop, bool * eod)
{
if (r_has_type(dop, t_dictionary)) {
- int code;
+ int code;
- check_dict_read(*dop);
- if ((code = dict_bool_param(dop, "EndOfData", true, eod)) < 0)
- return code;
- return 1;
+ check_dict_read(*dop);
+ if ((code = dict_bool_param(dop, "EndOfData", true, eod)) < 0)
+ return code;
+ return 1;
} else {
- *eod = true;
- return 0;
+ *eod = true;
+ return 0;
}
}
@@ -105,7 +105,7 @@ zRLE(i_ctx_t *i_ctx_p)
check_op(2);
code = rl_setup(op - 1, &state.EndOfData);
if (code < 0)
- return code;
+ return code;
check_int_leu(*op, max_uint);
state.record_size = op->value.intval;
return filter_write(i_ctx_p, 1, &s_RLE_template, (stream_state *) & state, 0);
@@ -121,7 +121,7 @@ zRLD(i_ctx_t *i_ctx_p)
int code = rl_setup(op, &state.EndOfData);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_RLD_template, (stream_state *) & state, 0);
}
@@ -137,35 +137,35 @@ zSFD(i_ctx_t *i_ctx_p)
int npop;
if (s_SFD_template.set_defaults)
- s_SFD_template.set_defaults((stream_state *)&state);
+ s_SFD_template.set_defaults((stream_state *)&state);
if (LL3_ENABLED && r_has_type(op, t_dictionary)) {
- int count;
- int code;
-
- check_dict_read(*op);
- /*
- * The PLRM-3rd says that EODCount is a required parameter. However
- * Adobe accepts files without this value and apparently defaults to
- * zero. Thus we are doing the same.
- */
- if ((code = dict_int_param(op, "EODCount", 0, max_int, 0, &count)) < 0)
- return code;
- if (dict_find_string(op, "EODString", &sop) <= 0)
- return_error(e_rangecheck);
- state.count = count;
- npop = 0;
+ int count;
+ int code;
+
+ check_dict_read(*op);
+ /*
+ * The PLRM-3rd says that EODCount is a required parameter. However
+ * Adobe accepts files without this value and apparently defaults to
+ * zero. Thus we are doing the same.
+ */
+ if ((code = dict_int_param(op, "EODCount", 0, max_int, 0, &count)) < 0)
+ return code;
+ if (dict_find_string(op, "EODString", &sop) <= 0)
+ return_error(e_rangecheck);
+ state.count = count;
+ npop = 0;
} else {
- check_type(sop[-1], t_integer);
- if (sop[-1].value.intval < 0)
- return_error(e_rangecheck);
- state.count = sop[-1].value.intval;
- npop = 2;
+ check_type(sop[-1], t_integer);
+ if (sop[-1].value.intval < 0)
+ return_error(e_rangecheck);
+ state.count = sop[-1].value.intval;
+ npop = 2;
}
check_read_type(*sop, t_string);
state.eod.data = sop->value.const_bytes;
state.eod.size = r_size(sop);
return filter_read(i_ctx_p, npop, &s_SFD_template,
- (stream_state *)&state, r_space(sop));
+ (stream_state *)&state, r_space(sop));
}
/* ------ Utilities ------ */
@@ -176,7 +176,7 @@ static int filter_ensure_buf(stream **, uint, gs_ref_memory_t *, bool, int );
/* Set up an input filter. */
int
filter_read(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
- stream_state * st, uint space)
+ stream_state * st, uint space)
{
os_ptr op = osp;
uint min_size = template->min_out_size + max_min_left;
@@ -191,10 +191,10 @@ filter_read(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
/* Skip over an optional dictionary parameter. */
if (r_has_type(sop, t_dictionary)) {
- check_dict_read(*sop);
- if ((code = dict_bool_param(sop, "CloseSource", false, &close)) < 0)
- return code;
- --sop;
+ check_dict_read(*sop);
+ if ((code = dict_bool_param(sop, "CloseSource", false, &close)) < 0)
+ return code;
+ --sop;
}
/*
* Check to make sure that the underlying data
@@ -202,43 +202,43 @@ filter_read(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
*/
use_space = max(use_space, r_space(sop));
switch (r_type(sop)) {
- case t_string:
- check_read(*sop);
- ialloc_set_space(idmemory, use_space);
- sstrm = file_alloc_stream(imemory, "filter_read(string stream)");
- if (sstrm == 0) {
- code = gs_note_error(e_VMerror);
- goto out;
- }
- sread_string(sstrm, sop->value.bytes, r_size(sop));
- sstrm->is_temp = 1;
- break;
- case t_file:
+ case t_string:
+ check_read(*sop);
+ ialloc_set_space(idmemory, use_space);
+ sstrm = file_alloc_stream(imemory, "filter_read(string stream)");
+ if (sstrm == 0) {
+ code = gs_note_error(e_VMerror);
+ goto out;
+ }
+ sread_string(sstrm, sop->value.bytes, r_size(sop));
+ sstrm->is_temp = 1;
+ break;
+ case t_file:
check_read_known_file_else(sstrm, sop, return, DO_NOTHING);
- ialloc_set_space(idmemory, use_space);
- goto ens;
- default:
- check_proc(*sop);
- ialloc_set_space(idmemory, use_space);
- code = sread_proc(sop, &sstrm, iimemory);
- if (code < 0)
- goto out;
- sstrm->is_temp = 2;
- ens:
- code = filter_ensure_buf(&sstrm,
- template->min_in_size +
- sstrm->state->template->min_out_size,
- iimemory, false, close);
- if (code < 0)
- goto out;
- break;
+ ialloc_set_space(idmemory, use_space);
+ goto ens;
+ default:
+ check_proc(*sop);
+ ialloc_set_space(idmemory, use_space);
+ code = sread_proc(sop, &sstrm, iimemory);
+ if (code < 0)
+ goto out;
+ sstrm->is_temp = 2;
+ ens:
+ code = filter_ensure_buf(&sstrm,
+ template->min_in_size +
+ sstrm->state->template->min_out_size,
+ iimemory, false, close);
+ if (code < 0)
+ goto out;
+ break;
}
if (min_size < 128)
- min_size = file_default_buffer_size;
+ min_size = file_default_buffer_size;
code = filter_open("r", min_size, (ref *) sop,
- &s_filter_read_procs, template, st, imemory);
+ &s_filter_read_procs, template, st, imemory);
if (code < 0)
- goto out;
+ goto out;
s = fptr(sop);
s->strm = sstrm;
s->close_strm = close;
@@ -256,7 +256,7 @@ filter_read_simple(i_ctx_t *i_ctx_p, const stream_template * template)
/* Set up an output filter. */
int
filter_write(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
- stream_state * st, uint space)
+ stream_state * st, uint space)
{
os_ptr op = osp;
uint min_size = template->min_in_size + max_min_left;
@@ -271,10 +271,10 @@ filter_write(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
/* Skip over an optional dictionary parameter. */
if (r_has_type(sop, t_dictionary)) {
- check_dict_read(*sop);
- if ((code = dict_bool_param(sop, "CloseTarget", false, &close)) < 0)
- return code;
- --sop;
+ check_dict_read(*sop);
+ if ((code = dict_bool_param(sop, "CloseTarget", false, &close)) < 0)
+ return code;
+ --sop;
}
/*
* Check to make sure that the underlying data
@@ -282,43 +282,43 @@ filter_write(i_ctx_t *i_ctx_p, int npop, const stream_template * template,
*/
use_space = max(use_space, r_space(sop));
switch (r_type(sop)) {
- case t_string:
- check_write(*sop);
- ialloc_set_space(idmemory, use_space);
- sstrm = file_alloc_stream(imemory, "filter_write(string)");
- if (sstrm == 0) {
- code = gs_note_error(e_VMerror);
- goto out;
- }
- swrite_string(sstrm, sop->value.bytes, r_size(sop));
- sstrm->is_temp = 1;
- break;
- case t_file:
- check_write_known_file(sstrm, sop, return);
- ialloc_set_space(idmemory, use_space);
- goto ens;
- default:
- check_proc(*sop);
- ialloc_set_space(idmemory, use_space);
- code = swrite_proc(sop, &sstrm, iimemory);
- if (code < 0)
- goto out;
- sstrm->is_temp = 2;
- ens:
- code = filter_ensure_buf(&sstrm,
- template->min_out_size +
- sstrm->state->template->min_in_size,
- iimemory, true, close);
- if (code < 0)
- goto out;
- break;
+ case t_string:
+ check_write(*sop);
+ ialloc_set_space(idmemory, use_space);
+ sstrm = file_alloc_stream(imemory, "filter_write(string)");
+ if (sstrm == 0) {
+ code = gs_note_error(e_VMerror);
+ goto out;
+ }
+ swrite_string(sstrm, sop->value.bytes, r_size(sop));
+ sstrm->is_temp = 1;
+ break;
+ case t_file:
+ check_write_known_file(sstrm, sop, return);
+ ialloc_set_space(idmemory, use_space);
+ goto ens;
+ default:
+ check_proc(*sop);
+ ialloc_set_space(idmemory, use_space);
+ code = swrite_proc(sop, &sstrm, iimemory);
+ if (code < 0)
+ goto out;
+ sstrm->is_temp = 2;
+ ens:
+ code = filter_ensure_buf(&sstrm,
+ template->min_out_size +
+ sstrm->state->template->min_in_size,
+ iimemory, true, close);
+ if (code < 0)
+ goto out;
+ break;
}
if (min_size < 128)
- min_size = file_default_buffer_size;
+ min_size = file_default_buffer_size;
code = filter_open("w", min_size, (ref *) sop,
- &s_filter_write_procs, template, st, imemory);
+ &s_filter_write_procs, template, st, imemory);
if (code < 0)
- goto out;
+ goto out;
s = fptr(sop);
s->strm = sstrm;
s->close_strm = close;
@@ -337,12 +337,12 @@ filter_write_simple(i_ctx_t *i_ctx_p, const stream_template * template)
/* (The standard NullDecode filter can read ahead too far.) */
static int
s_Null1D_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
if (pr->ptr >= pr->limit)
- return 0;
+ return 0;
if (pw->ptr >= pw->limit)
- return 1;
+ return 1;
*++(pw->ptr) = *++(pr->ptr);
return 1;
}
@@ -355,7 +355,7 @@ static const stream_template s_Null1D_template = {
/* filter types. */
static int
s_EOFD_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
return EOFC;
}
@@ -371,12 +371,11 @@ zEOFD(i_ctx_t *i_ctx_p)
return filter_read_simple(i_ctx_p, &s_EOFD_template);
}
-
/* Ensure a minimum buffer size for a filter. */
/* This may require creating an intermediate stream. */
static int
filter_ensure_buf(stream ** ps, uint min_buf_size, gs_ref_memory_t *imem,
- bool writing, int close)
+ bool writing, int close)
{
stream *s = *ps;
uint min_size = min_buf_size + max_min_left;
@@ -385,38 +384,38 @@ filter_ensure_buf(stream ** ps, uint min_buf_size, gs_ref_memory_t *imem,
int code;
if (s->modes == 0 /* stream is closed */ || s->bsize >= min_size)
- return 0;
+ return 0;
/* Otherwise, allocate an intermediate stream. */
if (s->cbuf == 0) {
- /* This is a newly created procedure stream. */
- /* Just allocate a buffer for it. */
- uint len = max(min_size, 128);
- byte *buf = gs_alloc_bytes((gs_memory_t *)imem, len,
- "filter_ensure_buf");
-
- if (buf == 0)
- return_error(e_VMerror);
- s->cbuf = buf;
- s->srptr = s->srlimit = s->swptr = buf - 1;
- s->swlimit = buf - 1 + len;
- s->bsize = s->cbsize = len;
- return 0;
+ /* This is a newly created procedure stream. */
+ /* Just allocate a buffer for it. */
+ uint len = max(min_size, 128);
+ byte *buf = gs_alloc_bytes((gs_memory_t *)imem, len,
+ "filter_ensure_buf");
+
+ if (buf == 0)
+ return_error(e_VMerror);
+ s->cbuf = buf;
+ s->srptr = s->srlimit = s->swptr = buf - 1;
+ s->swlimit = buf - 1 + len;
+ s->bsize = s->cbsize = len;
+ return 0;
} else {
- /* Allocate an intermediate stream. */
- if (writing)
- code = filter_open("w", min_size, &bsop, &s_filter_write_procs,
- &s_NullE_template, NULL, (gs_memory_t *)imem);
- else
- code = filter_open("r", min_size, &bsop, &s_filter_read_procs,
- &s_Null1D_template, NULL, (gs_memory_t *)imem);
- if (code < 0)
- return code;
- bs = fptr(&bsop);
- bs->strm = s;
- bs->is_temp = 2;
+ /* Allocate an intermediate stream. */
+ if (writing)
+ code = filter_open("w", min_size, &bsop, &s_filter_write_procs,
+ &s_NullE_template, NULL, (gs_memory_t *)imem);
+ else
+ code = filter_open("r", min_size, &bsop, &s_filter_read_procs,
+ &s_Null1D_template, NULL, (gs_memory_t *)imem);
+ if (code < 0)
+ return code;
+ bs = fptr(&bsop);
+ bs->strm = s;
+ bs->is_temp = 2;
bs->close_strm = close;
- *ps = bs;
- return code;
+ *ps = bs;
+ return code;
}
}
@@ -443,8 +442,8 @@ filter_mark_strm_temp(const ref * fop, int is_temp)
/* ------ Initialization procedure ------ */
const op_def zfilter_op_defs[] = {
- /* We enter PSStringEncode and SubFileDecode (only) */
- /* as separate operators. */
+ /* We enter PSStringEncode and SubFileDecode (only) */
+ /* as separate operators. */
{"1.psstringencode", zPSSE},
{"2.subfiledecode", zSFD},
op_def_begin_filter(),
diff --git a/gs/psi/zfilter2.c b/gs/psi/zfilter2.c
index addf9a49a..8179cbbd5 100644
--- a/gs/psi/zfilter2.c
+++ b/gs/psi/zfilter2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -45,7 +45,7 @@ zCFE(i_ctx_t *i_ctx_p)
check_dict_read(*op);
code = zcf_setup(op, (stream_CF_state *)&cfs, iimemory);
if (code < 0)
- return code;
+ return code;
return filter_write(i_ctx_p, 0, &s_CFE_template, (stream_state *)&cfs, 0);
}
@@ -53,7 +53,7 @@ zCFE(i_ctx_t *i_ctx_p)
int
filter_write_predictor(i_ctx_t *i_ctx_p, int npop,
- const stream_template * template, stream_state * st)
+ const stream_template * template, stream_state * st)
{
os_ptr op = osp;
int predictor, code;
@@ -61,65 +61,65 @@ filter_write_predictor(i_ctx_t *i_ctx_p, int npop,
stream_PNGP_state pps;
if (r_has_type(op, t_dictionary)) {
- if ((code = dict_int_param(op, "Predictor", 0, 15, 1, &predictor)) < 0)
- return code;
- switch (predictor) {
- case 0: /* identity */
- predictor = 1;
- case 1: /* identity */
- break;
- case 2: /* componentwise horizontal differencing */
- code = zpd_setup(op, &pds);
- break;
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- /* PNG prediction */
- code = zpp_setup(op, &pps);
- break;
- default:
- return_error(e_rangecheck);
- }
- if (code < 0)
- return code;
+ if ((code = dict_int_param(op, "Predictor", 0, 15, 1, &predictor)) < 0)
+ return code;
+ switch (predictor) {
+ case 0: /* identity */
+ predictor = 1;
+ case 1: /* identity */
+ break;
+ case 2: /* componentwise horizontal differencing */
+ code = zpd_setup(op, &pds);
+ break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ /* PNG prediction */
+ code = zpp_setup(op, &pps);
+ break;
+ default:
+ return_error(e_rangecheck);
+ }
+ if (code < 0)
+ return code;
} else
- predictor = 1;
+ predictor = 1;
if (predictor == 1)
- return filter_write(i_ctx_p, npop, template, st, 0);
+ return filter_write(i_ctx_p, npop, template, st, 0);
{
- /* We need to cascade filters. */
- ref rtarget, rdict;
- int code;
+ /* We need to cascade filters. */
+ ref rtarget, rdict;
+ int code;
- /* Save the operands, just in case. */
- ref_assign(&rtarget, op - 1);
- ref_assign(&rdict, op);
- code = filter_write(i_ctx_p, npop, template, st, 0);
- if (code < 0)
- return code;
- /* filter_write changed osp.... */
- op = osp;
- code =
- (predictor == 2 ?
- filter_write(i_ctx_p, 0, &s_PDiffE_template, (stream_state *)&pds, 0) :
- filter_write(i_ctx_p, 0, &s_PNGPE_template, (stream_state *)&pps, 0));
- if (code < 0) {
- /* Restore the operands. Don't bother trying to clean up */
- /* the first stream. */
- osp = ++op;
- ref_assign(op - 1, &rtarget);
- ref_assign(op, &rdict);
- return code;
- }
- /*
- * Mark the compression stream as temporary, and propagate
- * CloseTarget from it to the predictor stream.
- */
- filter_mark_strm_temp(op, 2);
- return code;
+ /* Save the operands, just in case. */
+ ref_assign(&rtarget, op - 1);
+ ref_assign(&rdict, op);
+ code = filter_write(i_ctx_p, npop, template, st, 0);
+ if (code < 0)
+ return code;
+ /* filter_write changed osp.... */
+ op = osp;
+ code =
+ (predictor == 2 ?
+ filter_write(i_ctx_p, 0, &s_PDiffE_template, (stream_state *)&pds, 0) :
+ filter_write(i_ctx_p, 0, &s_PNGPE_template, (stream_state *)&pps, 0));
+ if (code < 0) {
+ /* Restore the operands. Don't bother trying to clean up */
+ /* the first stream. */
+ osp = ++op;
+ ref_assign(op - 1, &rtarget);
+ ref_assign(op, &rdict);
+ return code;
+ }
+ /*
+ * Mark the compression stream as temporary, and propagate
+ * CloseTarget from it to the predictor stream.
+ */
+ filter_mark_strm_temp(op, 2);
+ return code;
}
}
@@ -135,9 +135,9 @@ zLZWE(i_ctx_t *i_ctx_p)
int code = zlz_setup(op, &lzs);
if (code < 0)
- return code;
+ return code;
return filter_write_predictor(i_ctx_p, 0, &s_LZWE_template,
- (stream_state *) & lzs);
+ (stream_state *) & lzs);
}
/* ================ Initialization procedure ================ */
diff --git a/gs/psi/zfilterx.c b/gs/psi/zfilterx.c
index 6441372de..8afed2276 100644
--- a/gs/psi/zfilterx.c
+++ b/gs/psi/zfilterx.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -48,61 +48,61 @@ bhc_setup(os_ptr op, stream_BHC_state * pbhcs)
check_type(*op, t_dictionary);
check_dict_read(*op);
if ((code = dict_bool_param(op, "FirstBitLowOrder", false,
- &pbhcs->FirstBitLowOrder)) < 0 ||
- (code = dict_int_param(op, "MaxCodeLength", 1, max_hc_length,
- max_hc_length, &num_counts)) < 0 ||
- (code = dict_bool_param(op, "EndOfData", true,
- &pbhcs->EndOfData)) < 0 ||
- (code = dict_uint_param(op, "EncodeZeroRuns", 2, 256,
- 256, &pbhcs->EncodeZeroRuns)) < 0 ||
+ &pbhcs->FirstBitLowOrder)) < 0 ||
+ (code = dict_int_param(op, "MaxCodeLength", 1, max_hc_length,
+ max_hc_length, &num_counts)) < 0 ||
+ (code = dict_bool_param(op, "EndOfData", true,
+ &pbhcs->EndOfData)) < 0 ||
+ (code = dict_uint_param(op, "EncodeZeroRuns", 2, 256,
+ 256, &pbhcs->EncodeZeroRuns)) < 0 ||
/* Note: the code returned from the following call */
/* is actually the number of elements in the array. */
- (code = dict_int_array_param(imemory, op, "Tables", countof(data),
- data)) <= 0
- )
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ (code = dict_int_array_param(imemory, op, "Tables", countof(data),
+ data)) <= 0
+ )
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
dsize = code;
if (dsize <= num_counts + 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
for (i = 0, num_values = 0, accum = 0; i <= num_counts;
- i++, accum <<= 1
- ) {
- int count = data[i];
-
- if (count < 0)
- return_error(e_rangecheck);
- num_values += count;
- accum += count;
+ i++, accum <<= 1
+ ) {
+ int count = data[i];
+
+ if (count < 0)
+ return_error(e_rangecheck);
+ num_values += count;
+ accum += count;
}
if (dsize != num_counts + 1 + num_values ||
- accum != 1 << (num_counts + 1) ||
- pbhcs->EncodeZeroRuns >
- (pbhcs->EndOfData ? num_values - 1 : num_values)
- )
- return_error(e_rangecheck);
+ accum != 1 << (num_counts + 1) ||
+ pbhcs->EncodeZeroRuns >
+ (pbhcs->EndOfData ? num_values - 1 : num_values)
+ )
+ return_error(e_rangecheck);
for (; i < num_counts + 1 + num_values; i++) {
- int value = data[i];
+ int value = data[i];
- if (value < 0 || value >= num_values)
- return_error(e_rangecheck);
+ if (value < 0 || value >= num_values)
+ return_error(e_rangecheck);
}
pbhcs->definition.counts = counts =
- (ushort *) ialloc_byte_array(num_counts + 1, sizeof(ushort),
- "bhc_setup(counts)");
+ (ushort *) ialloc_byte_array(num_counts + 1, sizeof(ushort),
+ "bhc_setup(counts)");
pbhcs->definition.values = values =
- (ushort *) ialloc_byte_array(num_values, sizeof(ushort),
- "bhc_setup(values)");
+ (ushort *) ialloc_byte_array(num_values, sizeof(ushort),
+ "bhc_setup(values)");
if (counts == 0 || values == 0) {
- ifree_object(values, "bhc_setup(values)");
- ifree_object(counts, "bhc_setup(counts)");
- return_error(e_VMerror);
+ ifree_object(values, "bhc_setup(values)");
+ ifree_object(counts, "bhc_setup(counts)");
+ return_error(e_VMerror);
}
for (i = 0; i <= num_counts; i++)
- counts[i] = data[i];
+ counts[i] = data[i];
pbhcs->definition.counts = counts;
pbhcs->definition.num_counts = num_counts;
for (i = 0; i < num_values; i++)
- values[i] = data[i + num_counts + 1];
+ values[i] = data[i + num_counts + 1];
pbhcs->definition.values = values;
pbhcs->definition.num_values = num_values;
return 0;
@@ -117,7 +117,7 @@ zBHCE(i_ctx_t *i_ctx_p)
int code = bhc_setup(op, (stream_BHC_state *)&bhcs);
if (code < 0)
- return code;
+ return code;
return filter_write(op, 0, &s_BHCE_template, (stream_state *)&bhcs, 0);
}
@@ -130,7 +130,7 @@ zBHCD(i_ctx_t *i_ctx_p)
int code = bhc_setup(op, (stream_BHC_state *)&bhcs);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_BHCD_template, (stream_state *)&bhcs, 0);
}
@@ -154,46 +154,46 @@ zcomputecodes(i_ctx_t *i_ctx_p)
check_write_type(*op1, t_array);
asize = r_size(op1);
if (op->value.intval < 1 || op->value.intval > max_hc_length)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
def.num_counts = op->value.intval;
if (asize < def.num_counts + 2)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
def.num_values = asize - (def.num_counts + 1);
data = (ushort *) gs_alloc_byte_array(imemory, asize, sizeof(ushort),
- "zcomputecodes");
+ "zcomputecodes");
freqs = (long *)gs_alloc_byte_array(imemory, def.num_values,
- sizeof(long),
- "zcomputecodes(freqs)");
+ sizeof(long),
+ "zcomputecodes(freqs)");
if (data == 0 || freqs == 0)
- code = gs_note_error(e_VMerror);
+ code = gs_note_error(e_VMerror);
else {
- uint i;
-
- def.counts = data;
- def.values = data + (def.num_counts + 1);
- for (i = 0; i < def.num_values; i++) {
- const ref *pf = op1->value.const_refs + i + def.num_counts + 1;
-
- if (!r_has_type(pf, t_integer)) {
- code = gs_note_error(e_typecheck);
- break;
- }
- freqs[i] = pf->value.intval;
- }
- if (!code) {
- code = hc_compute(&def, freqs, imemory);
- if (code >= 0) {
- /* Copy back results. */
- for (i = 0; i < asize; i++)
- make_int(op1->value.refs + i, data[i]);
- }
- }
+ uint i;
+
+ def.counts = data;
+ def.values = data + (def.num_counts + 1);
+ for (i = 0; i < def.num_values; i++) {
+ const ref *pf = op1->value.const_refs + i + def.num_counts + 1;
+
+ if (!r_has_type(pf, t_integer)) {
+ code = gs_note_error(e_typecheck);
+ break;
+ }
+ freqs[i] = pf->value.intval;
+ }
+ if (!code) {
+ code = hc_compute(&def, freqs, imemory);
+ if (code >= 0) {
+ /* Copy back results. */
+ for (i = 0; i < asize; i++)
+ make_int(op1->value.refs + i, data[i]);
+ }
+ }
}
gs_free_object(imemory, freqs, "zcomputecodes(freqs)");
gs_free_object(imemory, data, "zcomputecodes");
if (code < 0)
- return code;
+ return code;
pop(1);
return code;
}
@@ -205,11 +205,11 @@ static int
bwbs_setup(os_ptr op, stream_BWBS_state * pbwbss)
{
int code =
- dict_int_param(op, "BlockSize", 1, max_int / sizeof(int) - 10, 16384,
- &pbwbss->BlockSize);
+ dict_int_param(op, "BlockSize", 1, max_int / sizeof(int) - 10, 16384,
+ &pbwbss->BlockSize);
if (code < 0)
- return code;
+ return code;
return 0;
}
@@ -225,7 +225,7 @@ zBWBSE(i_ctx_t *i_ctx_p)
check_dict_read(*op);
code = bwbs_setup(op, (stream_BWBS_state *)&bwbss);
if (code < 0)
- return code;
+ return code;
return filter_write(op, 0, &s_BWBSE_template, (stream_state *)&bwbss, 0);
}
@@ -238,7 +238,7 @@ zBWBSD(i_ctx_t *i_ctx_p)
int code = bwbs_setup(op, (stream_BWBS_state *)&bwbss);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_BWBSD_template, (stream_state *)&bwbss, 0);
}
@@ -250,7 +250,7 @@ bt_setup(os_ptr op, stream_BT_state * pbts)
{
check_read_type(*op, t_string);
if (r_size(op) != 256)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
memcpy(pbts->table, op->value.const_bytes, 256);
return 0;
}
@@ -265,7 +265,7 @@ zBTE(i_ctx_t *i_ctx_p)
int code = bt_setup(op, &bts);
if (code < 0)
- return code;
+ return code;
return filter_write(op, 0, &s_BTE_template, (stream_state *)&bts, 0);
}
@@ -279,7 +279,7 @@ zBTD(i_ctx_t *i_ctx_p)
int code = bt_setup(op, &bts);
if (code < 0)
- return code;
+ return code;
return filter_read(i_ctx_p, 0, &s_BTD_template, (stream_state *)&bts, 0);
}
@@ -311,7 +311,7 @@ const op_def zfilterx_op_defs[] =
{
{"2.computecodes", zcomputecodes}, /* not a filter */
op_def_begin_filter(),
- /* Non-standard filters */
+ /* Non-standard filters */
{"2BoundedHuffmanEncode", zBHCE},
{"2BoundedHuffmanDecode", zBHCD},
{"2BWBlockSortEncode", zBWBSE},
diff --git a/gs/psi/zfimscale.c b/gs/psi/zfimscale.c
index d351ecf3d..4c3dca747 100644
--- a/gs/psi/zfimscale.c
+++ b/gs/psi/zfimscale.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,9 +42,9 @@ z_imscale_d(i_ctx_t * i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
if (dict_int_param(op, "Width", 0, 1<<24, -1, &width) < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (dict_int_param(op, "Height", 0, 1<<24, -1, &height) < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
state.params.Colors = 1;
state.params.BitsPerComponentIn = 1;
@@ -57,11 +57,11 @@ z_imscale_d(i_ctx_t * i_ctx_p)
state.params.HeightOut = height << 2;
/* we pass npop=0, since we've no arguments left to consume */
- /* we pass 0 instead of the usual rspace(sop) will allocate storage for
+ /* we pass 0 instead of the usual rspace(sop) will allocate storage for
filter state from the same memory pool as the stream it's coding. this
causes no trouble because we maintain no pointers */
return filter_read(i_ctx_p, 0, &s_imscale_template,
- (stream_state *) & state, 0);
+ (stream_state *) & state, 0);
}
/* Match the above routines to their postscript filter names.
diff --git a/gs/psi/zfjbig2.c b/gs/psi/zfjbig2.c
index 50bff866b..0986888f2 100644
--- a/gs/psi/zfjbig2.c
+++ b/gs/psi/zfjbig2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -35,7 +35,7 @@
#include "sjbig2.h"
#endif
-/* We define a structure, s_jbig2_global_data_t,
+/* We define a structure, s_jbig2_global_data_t,
allocated in the postscript
memory space, to hold a pointer to the global decoder
context (which is allocated by libjbig2). This allows
@@ -44,11 +44,10 @@
enumerated and will not be garbage collected. We use
a finalize method to deallocate it when the reference
is no longer in use. */
-
+
static void jbig2_global_data_finalize(void *vptr);
gs_private_st_simple_final(st_jbig2_global_data_t, s_jbig2_global_data_t,
- "jbig2globaldata", jbig2_global_data_finalize);
-
+ "jbig2globaldata", jbig2_global_data_finalize);
/* <source> /JBIG2Decode <file> */
/* <source> <dict> /JBIG2Decode <file> */
@@ -61,9 +60,9 @@ z_jbig2decode(i_ctx_t * i_ctx_p)
stream_jbig2decode_state state;
/* Extract the global context reference, if any, from the parameter
- dictionary and embed it in our stream state. The original object
+ dictionary and embed it in our stream state. The original object
ref is under the JBIG2Globals key.
- We expect the postscript code to resolve this and call
+ We expect the postscript code to resolve this and call
z_jbig2makeglobalctx() below to create an astruct wrapping the
global decoder data and store it under the .jbig2globalctx key
*/
@@ -71,17 +70,16 @@ z_jbig2decode(i_ctx_t * i_ctx_p)
if (r_has_type(op, t_dictionary)) {
check_dict_read(*op);
if ( dict_find_string(op, ".jbig2globalctx", &sop) > 0) {
- gref = r_ptr(sop, s_jbig2_global_data_t);
- s_jbig2decode_set_global_data((stream_state*)&state, gref);
+ gref = r_ptr(sop, s_jbig2_global_data_t);
+ s_jbig2decode_set_global_data((stream_state*)&state, gref);
}
}
-
+
/* we pass npop=0, since we've no arguments left to consume */
return filter_read(i_ctx_p, 0, &s_jbig2decode_template,
- (stream_state *) & state, (sop ? r_space(sop) : 0));
+ (stream_state *) & state, (sop ? r_space(sop) : 0));
}
-
/* <bytestring> .jbig2makeglobalctx <jbig2globalctx> */
/* we call this from ps code to instantiate a jbig2_global_context
object which the JBIG2Decode filter uses if available. The
@@ -91,44 +89,44 @@ z_jbig2decode(i_ctx_t * i_ctx_p)
static int
z_jbig2makeglobalctx(i_ctx_t * i_ctx_p)
{
- void *global = NULL;
- s_jbig2_global_data_t *st;
- os_ptr op = osp;
- byte *data;
- int size;
- int code = 0;
-
- check_type(*op, t_astruct);
- size = gs_object_size(imemory, op->value.pstruct);
- data = r_ptr(op, byte);
-
- code = s_jbig2decode_make_global_data(data, size,
- &global);
- if (size > 0 && global == NULL) {
- dlprintf("failed to create parsed JBIG2GLOBALS object.");
- return_error(e_unknownerror);
- }
-
- st = ialloc_struct(s_jbig2_global_data_t,
- &st_jbig2_global_data_t,
- "jbig2decode parsed global context");
- if (st == NULL) return_error(e_VMerror);
-
- st->data = global;
- make_astruct(op, a_readonly | icurrent_space, (byte*)st);
-
- return code;
+ void *global = NULL;
+ s_jbig2_global_data_t *st;
+ os_ptr op = osp;
+ byte *data;
+ int size;
+ int code = 0;
+
+ check_type(*op, t_astruct);
+ size = gs_object_size(imemory, op->value.pstruct);
+ data = r_ptr(op, byte);
+
+ code = s_jbig2decode_make_global_data(data, size,
+ &global);
+ if (size > 0 && global == NULL) {
+ dlprintf("failed to create parsed JBIG2GLOBALS object.");
+ return_error(e_unknownerror);
+ }
+
+ st = ialloc_struct(s_jbig2_global_data_t,
+ &st_jbig2_global_data_t,
+ "jbig2decode parsed global context");
+ if (st == NULL) return_error(e_VMerror);
+
+ st->data = global;
+ make_astruct(op, a_readonly | icurrent_space, (byte*)st);
+
+ return code;
}
/* free our referenced global context data */
static void jbig2_global_data_finalize(void *vptr)
{
- s_jbig2_global_data_t *st = vptr;
-
- if (st->data) s_jbig2decode_free_global_data(st->data);
- st->data = NULL;
+ s_jbig2_global_data_t *st = vptr;
+
+ if (st->data) s_jbig2decode_free_global_data(st->data);
+ st->data = NULL;
}
-
+
/* Match the above routine to the corresponding filter name.
This is how our static routines get called externally. */
const op_def zfjbig2_op_defs[] = {
diff --git a/gs/psi/zfjpx.c b/gs/psi/zfjpx.c
index 1abf078f0..33c50d656 100644
--- a/gs/psi/zfjpx.c
+++ b/gs/psi/zfjpx.c
@@ -39,7 +39,7 @@
/* macro to test a name ref against a C string */
# define ISTRCMP(ref, string) (memcmp((ref)->value.const_bytes, string, \
- min(strlen(string), r_size(ref))))
+ min(strlen(string), r_size(ref))))
/* <source> /JPXDecode <file> */
/* <source> <dict> /JPXDecode <file> */
@@ -64,68 +64,68 @@ z_jpx_decode(i_ctx_t * i_ctx_p)
state.alpha = true;
}
if ( dict_find_string(op, "ColorSpace", &sop) > 0) {
- /* parse the value */
- if (r_is_array(sop)) {
- /* assume it's the first array element */
- csname = sop->value.refs;
- } else if (r_has_type(sop,t_name)) {
- /* use the name directly */
- csname = sop;
- } else {
- dprintf("warning: JPX ColorSpace value is an unhandled type!\n");
- }
- if (csname != NULL) {
- ref sref;
- /* get a reference to the name's string value */
- name_string_ref(imemory, csname, &sref);
- /* request raw index values if the colorspace is /Indexed */
- if (!ISTRCMP(&sref, "Indexed"))
- state.colorspace = gs_jpx_cs_indexed;
- /* tell the filter what output we want for other spaces */
- else if (!ISTRCMP(&sref, "DeviceGray"))
- state.colorspace = gs_jpx_cs_gray;
- else if (!ISTRCMP(&sref, "DeviceRGB"))
- state.colorspace = gs_jpx_cs_rgb;
- else if (!ISTRCMP(&sref, "DeviceCMYK"))
- state.colorspace = gs_jpx_cs_cmyk;
- else if (!ISTRCMP(&sref, "ICCBased")) {
- /* The second array element should be the profile's
- stream dict */
- ref *csdict = sop->value.refs + 1;
- ref *nref;
- ref altname;
- if (r_is_array(sop) && (r_size(sop) > 1) &&
- r_has_type(csdict, t_dictionary)) {
- check_dict_read(*csdict);
- /* try to look up the alternate space */
- if (dict_find_string(csdict, "Alternate", &nref) > 0) {
- name_string_ref(imemory, csname, &altname);
- if (!ISTRCMP(&altname, "DeviceGray"))
- state.colorspace = gs_jpx_cs_gray;
- else if (!ISTRCMP(&altname, "DeviceRGB"))
- state.colorspace = gs_jpx_cs_rgb;
- else if (!ISTRCMP(&altname, "DeviceCMYK"))
- state.colorspace = gs_jpx_cs_cmyk;
- }
- /* else guess based on the number of components */
- if (state.colorspace == gs_jpx_cs_unset &&
- dict_find_string(csdict, "N", &nref) > 0) {
- if_debug1('w', "[w] JPX image has an external %d"
- " channel colorspace\n", nref->value.intval);
- switch (nref->value.intval) {
- case 1: state.colorspace = gs_jpx_cs_gray;
- break;
- case 3: state.colorspace = gs_jpx_cs_rgb;
- break;
- case 4: state.colorspace = gs_jpx_cs_cmyk;
- break;
- }
- }
- }
- }
- } else {
- if_debug0('w', "[w] Couldn't read JPX ColorSpace key!\n");
- }
+ /* parse the value */
+ if (r_is_array(sop)) {
+ /* assume it's the first array element */
+ csname = sop->value.refs;
+ } else if (r_has_type(sop,t_name)) {
+ /* use the name directly */
+ csname = sop;
+ } else {
+ dprintf("warning: JPX ColorSpace value is an unhandled type!\n");
+ }
+ if (csname != NULL) {
+ ref sref;
+ /* get a reference to the name's string value */
+ name_string_ref(imemory, csname, &sref);
+ /* request raw index values if the colorspace is /Indexed */
+ if (!ISTRCMP(&sref, "Indexed"))
+ state.colorspace = gs_jpx_cs_indexed;
+ /* tell the filter what output we want for other spaces */
+ else if (!ISTRCMP(&sref, "DeviceGray"))
+ state.colorspace = gs_jpx_cs_gray;
+ else if (!ISTRCMP(&sref, "DeviceRGB"))
+ state.colorspace = gs_jpx_cs_rgb;
+ else if (!ISTRCMP(&sref, "DeviceCMYK"))
+ state.colorspace = gs_jpx_cs_cmyk;
+ else if (!ISTRCMP(&sref, "ICCBased")) {
+ /* The second array element should be the profile's
+ stream dict */
+ ref *csdict = sop->value.refs + 1;
+ ref *nref;
+ ref altname;
+ if (r_is_array(sop) && (r_size(sop) > 1) &&
+ r_has_type(csdict, t_dictionary)) {
+ check_dict_read(*csdict);
+ /* try to look up the alternate space */
+ if (dict_find_string(csdict, "Alternate", &nref) > 0) {
+ name_string_ref(imemory, csname, &altname);
+ if (!ISTRCMP(&altname, "DeviceGray"))
+ state.colorspace = gs_jpx_cs_gray;
+ else if (!ISTRCMP(&altname, "DeviceRGB"))
+ state.colorspace = gs_jpx_cs_rgb;
+ else if (!ISTRCMP(&altname, "DeviceCMYK"))
+ state.colorspace = gs_jpx_cs_cmyk;
+ }
+ /* else guess based on the number of components */
+ if (state.colorspace == gs_jpx_cs_unset &&
+ dict_find_string(csdict, "N", &nref) > 0) {
+ if_debug1('w', "[w] JPX image has an external %d"
+ " channel colorspace\n", nref->value.intval);
+ switch (nref->value.intval) {
+ case 1: state.colorspace = gs_jpx_cs_gray;
+ break;
+ case 3: state.colorspace = gs_jpx_cs_rgb;
+ break;
+ case 4: state.colorspace = gs_jpx_cs_cmyk;
+ break;
+ }
+ }
+ }
+ }
+ } else {
+ if_debug0('w', "[w] Couldn't read JPX ColorSpace key!\n");
+ }
}
}
@@ -134,10 +134,9 @@ z_jpx_decode(i_ctx_t * i_ctx_p)
for filter state from the same memory pool as the stream it's coding.
this causes no trouble because we maintain no pointers */
return filter_read(i_ctx_p, 0, &s_jpxd_template,
- (stream_state *) & state, 0);
+ (stream_state *) & state, 0);
}
-
/* Match the above routine to the corresponding filter name.
This is how our static routines get called externally. */
const op_def zfjpx_op_defs[] = {
diff --git a/gs/psi/zfmd5.c b/gs/psi/zfmd5.c
index a8c7f7628..c8392b0c0 100644
--- a/gs/psi/zfmd5.c
+++ b/gs/psi/zfmd5.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zfont.c b/gs/psi/zfont.c
index 283462c84..6dbc286ac 100644
--- a/gs/psi/zfont.c
+++ b/gs/psi/zfont.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,18 +40,18 @@ bool
zfont_mark_glyph_name(const gs_memory_t *mem, gs_glyph glyph, void *ignore_data)
{
return (glyph >= gs_c_min_std_encoding_glyph || glyph == gs_no_glyph ? false :
- name_mark_index(mem, (uint) glyph));
+ name_mark_index(mem, (uint) glyph));
}
/* Get a global glyph code. */
-static int
+static int
zfont_global_glyph_code(const gs_memory_t *mem, gs_const_string *gstr, gs_glyph *pglyph)
{
ref v;
int code = name_ref(mem, gstr->data, gstr->size, &v, 0);
if (code < 0)
- return code;
+ return code;
*pglyph = (gs_glyph)name_index(mem, &v);
return 0;
}
@@ -64,7 +64,7 @@ zfont_init(i_ctx_t *i_ctx_p)
ifont_dir->ccache.mark_glyph = zfont_mark_glyph_name;
ifont_dir->global_glyph_code = zfont_global_glyph_code;
return gs_register_struct_root(imemory, NULL, (void **)&ifont_dir,
- "ifont_dir");
+ "ifont_dir");
}
/* <font> <scale> scalefont <new_font> */
@@ -77,9 +77,9 @@ zscalefont(i_ctx_t *i_ctx_p)
gs_matrix mat;
if ((code = real_param(op, &scale)) < 0)
- return code;
+ return code;
if ((code = gs_make_scaling(scale, scale, &mat)) < 0)
- return code;
+ return code;
return make_font(i_ctx_p, &mat);
}
@@ -92,7 +92,7 @@ zmakefont(i_ctx_t *i_ctx_p)
gs_matrix mat;
if ((code = read_matrix(imemory, op, &mat)) < 0)
- return code;
+ return code;
return make_font(i_ctx_p, &mat);
}
@@ -105,7 +105,7 @@ zsetfont(i_ctx_t *i_ctx_p)
int code = font_param(op, &pfont);
if (code < 0 || (code = gs_setfont(igs, pfont)) < 0)
- return code;
+ return code;
pop(1);
return code;
}
@@ -156,20 +156,20 @@ zsetcacheparams(i_ctx_t *i_ctx_p)
os_ptr opp = op;
for (i = 0; i < 3 && !r_has_type(opp, t_mark); i++, opp--) {
- check_int_leu(*opp, max_uint);
- params[i] = opp->value.intval;
+ check_int_leu(*opp, max_uint);
+ params[i] = opp->value.intval;
}
switch (i) {
- case 3:
- if ((code = gs_setcachesize(igs, ifont_dir, params[2])) < 0)
- return code;
- case 2:
- if ((code = gs_setcachelower(ifont_dir, params[1])) < 0)
- return code;
- case 1:
- if ((code = gs_setcacheupper(ifont_dir, params[0])) < 0)
- return code;
- case 0:;
+ case 3:
+ if ((code = gs_setcachesize(igs, ifont_dir, params[2])) < 0)
+ return code;
+ case 2:
+ if ((code = gs_setcachelower(ifont_dir, params[1])) < 0)
+ return code;
+ case 1:
+ if ((code = gs_setcacheupper(ifont_dir, params[0])) < 0)
+ return code;
+ case 0:;
}
return zcleartomark(i_ctx_p);
}
@@ -199,13 +199,12 @@ zregisterfont(i_ctx_t *i_ctx_p)
int code = font_param(op, &pfont);
if (code < 0)
- return code;
+ return code;
pfont->is_resource = true;
pop(1);
return 0;
}
-
/* <Decoding> .setupUnicodeDecoder - */
static int
zsetupUnicodeDecoder(i_ctx_t *i_ctx_p)
@@ -216,7 +215,7 @@ zsetupUnicodeDecoder(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = setup_unicode_decoder(i_ctx_p, op);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -244,26 +243,26 @@ const op_def zfont_op_defs[] =
int
font_param(const ref * pfdict, gs_font ** ppfont)
{ /*
- * Check that pfdict is a read-only dictionary, that it has a FID
- * entry whose value is a fontID, and that the fontID points to a
- * gs_font structure whose associated PostScript dictionary is
- * pfdict.
- */
+ * Check that pfdict is a read-only dictionary, that it has a FID
+ * entry whose value is a fontID, and that the fontID points to a
+ * gs_font structure whose associated PostScript dictionary is
+ * pfdict.
+ */
ref *pid;
gs_font *pfont;
const font_data *pdata;
check_type(*pfdict, t_dictionary);
if (dict_find_string(pfdict, "FID", &pid) <= 0 ||
- !r_has_type(pid, t_fontID)
- )
- return_error(e_invalidfont);
+ !r_has_type(pid, t_fontID)
+ )
+ return_error(e_invalidfont);
pfont = r_ptr(pid, gs_font);
if (pfont == 0)
- return_error(e_invalidfont); /* unregistered font */
+ return_error(e_invalidfont); /* unregistered font */
pdata = pfont->client_data;
if (!obj_eq(pfont->memory, &pdata->dict, pfdict))
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
*ppfont = pfont;
return 0;
}
@@ -272,15 +271,15 @@ font_param(const ref * pfdict, gs_font ** ppfont)
/* Note that i_ctx_p may be NULL. */
int
add_FID(i_ctx_t *i_ctx_p, ref * fp /* t_dictionary */ , gs_font * pfont,
- gs_ref_memory_t *imem)
+ gs_ref_memory_t *imem)
{
ref fid;
make_tav(&fid, t_fontID,
- a_readonly | imemory_space(imem) | imemory_new_mask(imem),
- pstruct, (void *)pfont);
+ a_readonly | imemory_space(imem) | imemory_new_mask(imem),
+ pstruct, (void *)pfont);
return (i_ctx_p ? idict_put_string(fp, "FID", &fid) :
- dict_put_string(fp, "FID", &fid, NULL));
+ dict_put_string(fp, "FID", &fid, NULL));
}
/* Make a transformed font (common code for makefont/scalefont). */
@@ -295,44 +294,44 @@ make_font(i_ctx_t *i_ctx_p, const gs_matrix * pmat)
code = font_param(fp, &oldfont);
if (code < 0)
- return code;
+ return code;
{
- uint space = ialloc_space(idmemory);
-
- ialloc_set_space(idmemory, r_space(fp));
- if (dict_find_string(fp, "Encoding", &pencoding) > 0 &&
- !r_is_array(pencoding)
- )
- code = gs_note_error(e_invalidfont);
- else {
- /*
- * Temporarily substitute the new dictionary
- * for the old one, in case the Encoding changed.
- */
- ref olddict;
-
- olddict = *pfont_dict(oldfont);
- *pfont_dict(oldfont) = *fp;
- code = gs_makefont(ifont_dir, oldfont, pmat, &newfont);
- *pfont_dict(oldfont) = olddict;
- }
- ialloc_set_space(idmemory, space);
+ uint space = ialloc_space(idmemory);
+
+ ialloc_set_space(idmemory, r_space(fp));
+ if (dict_find_string(fp, "Encoding", &pencoding) > 0 &&
+ !r_is_array(pencoding)
+ )
+ code = gs_note_error(e_invalidfont);
+ else {
+ /*
+ * Temporarily substitute the new dictionary
+ * for the old one, in case the Encoding changed.
+ */
+ ref olddict;
+
+ olddict = *pfont_dict(oldfont);
+ *pfont_dict(oldfont) = *fp;
+ code = gs_makefont(ifont_dir, oldfont, pmat, &newfont);
+ *pfont_dict(oldfont) = olddict;
+ }
+ ialloc_set_space(idmemory, space);
}
if (code < 0)
- return code;
+ return code;
/*
* We have to allow for the possibility that the font's Encoding
* is different from that of the base font. Note that the
* font_data of the new font was simply copied from the old one.
*/
if (pencoding != 0 &&
- !obj_eq(imemory, pencoding, &pfont_data(newfont)->Encoding)
- ) {
- if (newfont->FontType == ft_composite)
- return_error(e_rangecheck);
- /* We should really do validity checking here.... */
- ref_assign(&pfont_data(newfont)->Encoding, pencoding);
- lookup_gs_simple_font_encoding((gs_font_base *) newfont);
+ !obj_eq(imemory, pencoding, &pfont_data(newfont)->Encoding)
+ ) {
+ if (newfont->FontType == ft_composite)
+ return_error(e_rangecheck);
+ /* We should really do validity checking here.... */
+ ref_assign(&pfont_data(newfont)->Encoding, pencoding);
+ lookup_gs_simple_font_encoding((gs_font_base *) newfont);
}
*fp = *pfont_dict(newfont);
pop(1);
@@ -343,7 +342,7 @@ make_font(i_ctx_t *i_ctx_p, const gs_matrix * pmat)
/* created at the interpreter level (see build_gs_simple_font in zbfont.c.) */
int
zbase_make_font(gs_font_dir * pdir, const gs_font * oldfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
/*
* We must call gs_base_make_font so that the XUID gets copied
@@ -352,12 +351,12 @@ zbase_make_font(gs_font_dir * pdir, const gs_font * oldfont,
int code = gs_base_make_font(pdir, oldfont, pmat, ppfont);
if (code < 0)
- return code;
+ return code;
return zdefault_make_font(pdir, oldfont, pmat, ppfont);
}
int
zdefault_make_font(gs_font_dir * pdir, const gs_font * oldfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
gs_font *newfont = *ppfont;
gs_memory_t *mem = newfont->memory;
@@ -371,21 +370,21 @@ zdefault_make_font(gs_font_dir * pdir, const gs_font * oldfont,
int code;
if (dlen < mlen)
- dlen = mlen;
+ dlen = mlen;
if ((pdata = gs_alloc_struct(mem, font_data, &st_font_data,
- "make_font(font_data)")) == 0
- )
- return_error(e_VMerror);
+ "make_font(font_data)")) == 0
+ )
+ return_error(e_VMerror);
/*
* This dictionary is newly created: it's safe to pass NULL as the
* dstack pointer to dict_copy and dict_put_string.
*/
if ((code = dict_alloc(imem, dlen, &newdict)) < 0 ||
- (code = dict_copy(fp, &newdict, NULL)) < 0 ||
- (code = gs_alloc_ref_array(imem, &newmat, a_all, 12,
- "make_font(matrices)")) < 0
- )
- return code;
+ (code = dict_copy(fp, &newdict, NULL)) < 0 ||
+ (code = gs_alloc_ref_array(imem, &newmat, a_all, 12,
+ "make_font(matrices)")) < 0
+ )
+ return code;
refset_null_new(newmat.value.refs, 12, imemory_new_mask(imem));
ref_assign(&scalemat, &newmat);
r_set_size(&scalemat, 6);
@@ -399,26 +398,26 @@ zdefault_make_font(gs_font_dir * pdir, const gs_font * oldfont,
* these.
*/
{
- gs_matrix scale, prev_scale;
- ref *ppsm;
-
- if (!(dict_find_string(fp, "ScaleMatrix", &ppsm) > 0 &&
- read_matrix(mem, ppsm, &prev_scale) >= 0 &&
- gs_matrix_multiply(pmat, &prev_scale, &scale) >= 0)
- )
- scale = *pmat;
- write_matrix_new(&scalemat, &scale, imem);
+ gs_matrix scale, prev_scale;
+ ref *ppsm;
+
+ if (!(dict_find_string(fp, "ScaleMatrix", &ppsm) > 0 &&
+ read_matrix(mem, ppsm, &prev_scale) >= 0 &&
+ gs_matrix_multiply(pmat, &prev_scale, &scale) >= 0)
+ )
+ scale = *pmat;
+ write_matrix_new(&scalemat, &scale, imem);
}
r_clear_attrs(&scalemat, a_write);
r_set_size(&newmat, 6);
write_matrix_new(&newmat, &newfont->FontMatrix, imem);
r_clear_attrs(&newmat, a_write);
if ((code = dict_put_string(&newdict, "FontMatrix", &newmat, NULL)) < 0 ||
- (code = dict_put_string(&newdict, "OrigFont", pfont_dict(oldfont->base), NULL)) < 0 ||
- (code = dict_put_string(&newdict, "ScaleMatrix", &scalemat, NULL)) < 0 ||
- (code = add_FID(NULL, &newdict, newfont, imem)) < 0
- )
- return code;
+ (code = dict_put_string(&newdict, "OrigFont", pfont_dict(oldfont->base), NULL)) < 0 ||
+ (code = dict_put_string(&newdict, "ScaleMatrix", &scalemat, NULL)) < 0 ||
+ (code = add_FID(NULL, &newdict, newfont, imem)) < 0
+ )
+ return code;
newfont->client_data = pdata;
*pdata = *pfont_data(oldfont);
pdata->dict = newdict;
@@ -433,7 +432,7 @@ make_uint_array(register os_ptr op, const uint * intp, int count)
int i;
for (i = 0; i < count; i++, op++, intp++)
- make_int(op, *intp);
+ make_int(op, *intp);
}
/* Remove scaled font and character cache entries that would be */
@@ -445,7 +444,7 @@ purge_if_name_removed(const gs_memory_t *mem, cached_char * cc, void *vsave)
}
/* Remove entries from font and character caches. */
-int
+int
font_restore(const alloc_save_t * save)
{
@@ -455,86 +454,86 @@ font_restore(const alloc_save_t * save)
int code;
if (pdir == 0) /* not initialized yet */
- return 0;
+ return 0;
/* Purge original (unscaled) fonts. */
{
- gs_font *pfont;
+ gs_font *pfont;
otop:
- for (pfont = pdir->orig_fonts; pfont != 0;
- pfont = pfont->next
- ) {
- mem = pfont->memory;
- if (alloc_is_since_save((char *)pfont, save)) {
- code = gs_purge_font(pfont);
- if (code < 0)
- return code;
- goto otop;
- }
- }
+ for (pfont = pdir->orig_fonts; pfont != 0;
+ pfont = pfont->next
+ ) {
+ mem = pfont->memory;
+ if (alloc_is_since_save((char *)pfont, save)) {
+ code = gs_purge_font(pfont);
+ if (code < 0)
+ return code;
+ goto otop;
+ }
+ }
}
/* Purge cached scaled fonts. */
{
- gs_font *pfont;
+ gs_font *pfont;
top:
- for (pfont = pdir->scaled_fonts; pfont != 0;
- pfont = pfont->next
- ) {
- if (alloc_is_since_save((char *)pfont, save)) {
- code = gs_purge_font(pfont);
- if (code < 0)
- return code;
- goto top;
- }
- }
+ for (pfont = pdir->scaled_fonts; pfont != 0;
+ pfont = pfont->next
+ ) {
+ if (alloc_is_since_save((char *)pfont, save)) {
+ code = gs_purge_font(pfont);
+ if (code < 0)
+ return code;
+ goto top;
+ }
+ }
}
/* Purge xfonts and uncached scaled fonts. */
{
- cached_fm_pair *pair;
- uint n;
+ cached_fm_pair *pair;
+ uint n;
- for (pair = pdir->fmcache.mdata, n = pdir->fmcache.mmax;
- n > 0; pair++, n--
- )
- if (!fm_pair_is_free(pair)) {
+ for (pair = pdir->fmcache.mdata, n = pdir->fmcache.mmax;
+ n > 0; pair++, n--
+ )
+ if (!fm_pair_is_free(pair)) {
#if 0
- /* We disabled this code portion because
- gx_add_fm_pair now copied xvalues
- into a stable memory.
- */
- if ((uid_is_XUID(&pair->UID) &&
- alloc_is_since_save((char *)pair->UID.xvalues,
- save))
- ) {
- code = gs_purge_fm_pair(pdir, pair, 0);
- if (code < 0)
- return code;
- continue;
- }
+ /* We disabled this code portion because
+ gx_add_fm_pair now copied xvalues
+ into a stable memory.
+ */
+ if ((uid_is_XUID(&pair->UID) &&
+ alloc_is_since_save((char *)pair->UID.xvalues,
+ save))
+ ) {
+ code = gs_purge_fm_pair(pdir, pair, 0);
+ if (code < 0)
+ return code;
+ continue;
+ }
#endif
- if (pair->font != 0 &&
- alloc_is_since_save((char *)pair->font, save)
- ) {
- if (!uid_is_valid(&pair->UID))
- gs_clean_fm_pair(pdir, pair);
- /* Don't discard pairs with a surviving UID. */
- pair->font = 0;
- }
- if (pair->xfont != 0 &&
- alloc_is_since_save((char *)pair->xfont, save)
- ) {
- code = gs_purge_fm_pair(pdir, pair, 1);
- if (code < 0)
- return code;
- }
- }
+ if (pair->font != 0 &&
+ alloc_is_since_save((char *)pair->font, save)
+ ) {
+ if (!uid_is_valid(&pair->UID))
+ gs_clean_fm_pair(pdir, pair);
+ /* Don't discard pairs with a surviving UID. */
+ pair->font = 0;
+ }
+ if (pair->xfont != 0 &&
+ alloc_is_since_save((char *)pair->xfont, save)
+ ) {
+ code = gs_purge_fm_pair(pdir, pair, 1);
+ if (code < 0)
+ return code;
+ }
+ }
}
/* Purge characters with names about to be removed. */
@@ -542,8 +541,8 @@ top:
/* since the save. */
if (alloc_any_names_since_save(save))
- gx_purge_selected_cached_chars(pdir, purge_if_name_removed,
- (void *)save);
+ gx_purge_selected_cached_chars(pdir, purge_if_name_removed,
+ (void *)save);
return 0;
}
@@ -556,47 +555,47 @@ zfont_info_has(const ref *pfidict, const char *key, gs_const_string *pmember)
ref *pvalue;
if (dict_find_string(pfidict, key, &pvalue) > 0 &&
- r_has_type(pvalue, t_string)
- ) {
- pmember->data = pvalue->value.const_bytes;
- pmember->size = r_size(pvalue);
- return true;
+ r_has_type(pvalue, t_string)
+ ) {
+ pmember->data = pvalue->value.const_bytes;
+ pmember->size = r_size(pvalue);
+ return true;
}
return false;
}
int
zfont_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
int code = gs_default_font_info(font, pscale, members &
- ~(FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
- FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
- info);
+ ~(FONT_INFO_COPYRIGHT | FONT_INFO_NOTICE |
+ FONT_INFO_FAMILY_NAME | FONT_INFO_FULL_NAME),
+ info);
const ref *pfdict;
ref *pfontinfo, *pvalue;
if (code < 0)
- return code;
+ return code;
pfdict = &pfont_data(font)->dict;
if (dict_find_string(pfdict, "FontInfo", &pfontinfo) <= 0 ||
- !r_has_type(pfontinfo, t_dictionary))
- return 0;
+ !r_has_type(pfontinfo, t_dictionary))
+ return 0;
if ((members & FONT_INFO_COPYRIGHT) &&
- zfont_info_has(pfontinfo, "Copyright", &info->Copyright))
- info->members |= FONT_INFO_COPYRIGHT;
+ zfont_info_has(pfontinfo, "Copyright", &info->Copyright))
+ info->members |= FONT_INFO_COPYRIGHT;
if ((members & FONT_INFO_NOTICE) &&
- zfont_info_has(pfontinfo, "Notice", &info->Notice))
- info->members |= FONT_INFO_NOTICE;
+ zfont_info_has(pfontinfo, "Notice", &info->Notice))
+ info->members |= FONT_INFO_NOTICE;
if ((members & FONT_INFO_FAMILY_NAME) &&
- zfont_info_has(pfontinfo, "FamilyName", &info->FamilyName))
- info->members |= FONT_INFO_FAMILY_NAME;
+ zfont_info_has(pfontinfo, "FamilyName", &info->FamilyName))
+ info->members |= FONT_INFO_FAMILY_NAME;
if ((members & FONT_INFO_FULL_NAME) &&
- zfont_info_has(pfontinfo, "FullName", &info->FullName))
- info->members |= FONT_INFO_FULL_NAME;
- if ((members & FONT_INFO_EMBEDDING_RIGHTS)
- && (dict_find_string(pfontinfo, "FSType", &pvalue) > 0)) {
- info->EmbeddingRights = pvalue->value.intval;
- info->members |= FONT_INFO_EMBEDDING_RIGHTS;
+ zfont_info_has(pfontinfo, "FullName", &info->FullName))
+ info->members |= FONT_INFO_FULL_NAME;
+ if ((members & FONT_INFO_EMBEDDING_RIGHTS)
+ && (dict_find_string(pfontinfo, "FSType", &pvalue) > 0)) {
+ info->EmbeddingRights = pvalue->value.intval;
+ info->members |= FONT_INFO_EMBEDDING_RIGHTS;
}
return code;
}
@@ -608,13 +607,13 @@ typedef struct gs_unicode_decoder_s {
} gs_unicode_decoder;
/* GC procedures */
-static
+static
CLEAR_MARKS_PROC(unicode_decoder_clear_marks)
{ gs_unicode_decoder *const pptr = vptr;
r_clear_attrs(&pptr->data, l_mark);
}
-static
+static
ENUM_PTRS_WITH(unicode_decoder_enum_ptrs, gs_unicode_decoder *pptr) return 0;
case 0:
ENUM_RETURN_REF(&pptr->data);
@@ -625,7 +624,7 @@ r_clear_attrs(&pptr->data, l_mark);
RELOC_PTRS_END
gs_private_st_complex_only(st_unicode_decoder, gs_unicode_decoder,\
- "unicode_decoder", unicode_decoder_clear_marks, unicode_decoder_enum_ptrs,
+ "unicode_decoder", unicode_decoder_clear_marks, unicode_decoder_enum_ptrs,
unicode_decoder_reloc_ptrs, 0);
/* Get the Unicode value for a glyph. */
@@ -633,17 +632,17 @@ const ref *
zfont_get_to_unicode_map(gs_font_dir *dir)
{
const gs_unicode_decoder *pud = (gs_unicode_decoder *)dir->glyph_to_unicode_table;
-
+
return (pud == NULL ? NULL : &pud->data);
}
static int
setup_unicode_decoder(i_ctx_t *i_ctx_p, ref *Decoding)
{
- gs_unicode_decoder *pud = gs_alloc_struct(imemory, gs_unicode_decoder,
+ gs_unicode_decoder *pud = gs_alloc_struct(imemory, gs_unicode_decoder,
&st_unicode_decoder, "setup_unicode_decoder");
if (pud == NULL)
- return_error(e_VMerror);
+ return_error(e_VMerror);
ref_assign_new(&pud->data, Decoding);
ifont_dir->glyph_to_unicode_table = pud;
return 0;
diff --git a/gs/psi/zfont0.c b/gs/psi/zfont0.c
index 1ec17b98b..d50d5cb71 100644
--- a/gs/psi/zfont0.c
+++ b/gs/psi/zfont0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,7 +40,7 @@
/* Imported from zfcmap.c */
int ztype0_get_cmap(const gs_cmap_t ** ppcmap, const ref * pfdepvector,
- const ref * op, gs_memory_t *imem);
+ const ref * op, gs_memory_t *imem);
/* Forward references */
static font_proc_define_font(ztype0_define_font);
@@ -64,114 +64,114 @@ zbuildfont0(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
{
- ref *pfmaptype;
- ref *pfdepvector;
+ ref *pfmaptype;
+ ref *pfdepvector;
- if (dict_find_string(op, "FMapType", &pfmaptype) <= 0 ||
- !r_has_type(pfmaptype, t_integer) ||
- pfmaptype->value.intval < (int)fmap_type_min ||
- pfmaptype->value.intval > (int)fmap_type_max ||
- dict_find_string(op, "FDepVector", &pfdepvector) <= 0 ||
- !r_is_array(pfdepvector)
- )
- return_error(e_invalidfont);
- data.FMapType = (fmap_type) pfmaptype->value.intval;
- /*
- * Adding elements below could cause the font dictionary to be
- * resized, which would invalidate pfdepvector.
- */
- fdepvector = *pfdepvector;
+ if (dict_find_string(op, "FMapType", &pfmaptype) <= 0 ||
+ !r_has_type(pfmaptype, t_integer) ||
+ pfmaptype->value.intval < (int)fmap_type_min ||
+ pfmaptype->value.intval > (int)fmap_type_max ||
+ dict_find_string(op, "FDepVector", &pfdepvector) <= 0 ||
+ !r_is_array(pfdepvector)
+ )
+ return_error(e_invalidfont);
+ data.FMapType = (fmap_type) pfmaptype->value.intval;
+ /*
+ * Adding elements below could cause the font dictionary to be
+ * resized, which would invalidate pfdepvector.
+ */
+ fdepvector = *pfdepvector;
}
/* Check that every element of the FDepVector is a font. */
data.fdep_size = r_size(&fdepvector);
for (i = 0; i < data.fdep_size; i++) {
- ref fdep;
- gs_font *psub;
+ ref fdep;
+ gs_font *psub;
- array_get(imemory, &fdepvector, i, &fdep);
- if ((code = font_param(&fdep, &psub)) < 0)
- return code;
- /*
- * Check the inheritance rules. Allowed configurations
- * (paths from root font) are defined by the regular
- * expression:
- * (shift | double_escape escape* | escape*)
- * non_modal* non_composite
- */
- if (psub->FontType == ft_composite) {
- const gs_font_type0 *const psub0 = (const gs_font_type0 *)psub;
- fmap_type fmt = psub0->data.FMapType;
+ array_get(imemory, &fdepvector, i, &fdep);
+ if ((code = font_param(&fdep, &psub)) < 0)
+ return code;
+ /*
+ * Check the inheritance rules. Allowed configurations
+ * (paths from root font) are defined by the regular
+ * expression:
+ * (shift | double_escape escape* | escape*)
+ * non_modal* non_composite
+ */
+ if (psub->FontType == ft_composite) {
+ const gs_font_type0 *const psub0 = (const gs_font_type0 *)psub;
+ fmap_type fmt = psub0->data.FMapType;
- if (fmt == fmap_double_escape ||
- fmt == fmap_shift ||
- (fmt == fmap_escape &&
- !(data.FMapType == fmap_escape ||
- data.FMapType == fmap_double_escape))
- )
- return_error(e_invalidfont);
- }
+ if (fmt == fmap_double_escape ||
+ fmt == fmap_shift ||
+ (fmt == fmap_escape &&
+ !(data.FMapType == fmap_escape ||
+ data.FMapType == fmap_double_escape))
+ )
+ return_error(e_invalidfont);
+ }
}
switch (data.FMapType) {
- case fmap_escape:
- case fmap_double_escape: /* need EscChar */
- code = ensure_char_entry(i_ctx_p, op, "EscChar", &data.EscChar, 255);
- break;
- case fmap_shift: /* need ShiftIn & ShiftOut */
- code = ensure_char_entry(i_ctx_p, op, "ShiftIn", &data.ShiftIn, 15);
- if (code >= 0)
- code = ensure_char_entry(i_ctx_p, op, "ShiftOut", &data.ShiftOut, 14);
- break;
- case fmap_SubsVector: /* need SubsVector */
- {
- ref *psubsvector;
- uint svsize;
+ case fmap_escape:
+ case fmap_double_escape: /* need EscChar */
+ code = ensure_char_entry(i_ctx_p, op, "EscChar", &data.EscChar, 255);
+ break;
+ case fmap_shift: /* need ShiftIn & ShiftOut */
+ code = ensure_char_entry(i_ctx_p, op, "ShiftIn", &data.ShiftIn, 15);
+ if (code >= 0)
+ code = ensure_char_entry(i_ctx_p, op, "ShiftOut", &data.ShiftOut, 14);
+ break;
+ case fmap_SubsVector: /* need SubsVector */
+ {
+ ref *psubsvector;
+ uint svsize;
- if (dict_find_string(op, "SubsVector", &psubsvector) <= 0 ||
- !r_has_type(psubsvector, t_string) ||
- (svsize = r_size(psubsvector)) == 0 ||
- (data.subs_width = (int)*psubsvector->value.bytes + 1) > 4 ||
- (svsize - 1) % data.subs_width != 0
- )
- return_error(e_invalidfont);
- data.subs_size = (svsize - 1) / data.subs_width;
- data.SubsVector.data = psubsvector->value.bytes + 1;
- data.SubsVector.size = svsize - 1;
- } break;
- case fmap_CMap: /* need CMap */
- code = ztype0_get_cmap(&data.CMap, (const ref *)&fdepvector,
- (const ref *)op, imemory);
- break;
- default:
- ;
+ if (dict_find_string(op, "SubsVector", &psubsvector) <= 0 ||
+ !r_has_type(psubsvector, t_string) ||
+ (svsize = r_size(psubsvector)) == 0 ||
+ (data.subs_width = (int)*psubsvector->value.bytes + 1) > 4 ||
+ (svsize - 1) % data.subs_width != 0
+ )
+ return_error(e_invalidfont);
+ data.subs_size = (svsize - 1) / data.subs_width;
+ data.SubsVector.data = psubsvector->value.bytes + 1;
+ data.SubsVector.size = svsize - 1;
+ } break;
+ case fmap_CMap: /* need CMap */
+ code = ztype0_get_cmap(&data.CMap, (const ref *)&fdepvector,
+ (const ref *)op, imemory);
+ break;
+ default:
+ ;
}
if (code < 0)
- return code;
+ return code;
/*
* Save the old FID in case we have to back out.
* build_gs_font will return an error if there is a FID entry
* but it doesn't reference a valid font.
*/
{
- ref *pfid;
+ ref *pfid;
- if (dict_find_string(op, "FID", &pfid) <= 0)
- make_null(&save_FID);
- else
- save_FID = *pfid;
+ if (dict_find_string(op, "FID", &pfid) <= 0)
+ make_null(&save_FID);
+ else
+ save_FID = *pfid;
}
{
- build_proc_refs build;
+ build_proc_refs build;
- code = build_proc_name_refs(imemory, &build,
- "%Type0BuildChar", "%Type0BuildGlyph");
- if (code < 0)
- return code;
- code = build_gs_font(i_ctx_p, op, (gs_font **) & pfont,
- ft_composite, &st_gs_font_type0, &build,
- bf_options_none);
+ code = build_proc_name_refs(imemory, &build,
+ "%Type0BuildChar", "%Type0BuildGlyph");
+ if (code < 0)
+ return code;
+ code = build_gs_font(i_ctx_p, op, (gs_font **) & pfont,
+ ft_composite, &st_gs_font_type0, &build,
+ bf_options_none);
}
if (code != 0)
- return code;
+ return code;
/* Fill in the rest of the basic font data. */
pfont->procs.init_fstack = gs_type0_init_fstack;
pfont->procs.define_font = ztype0_define_font;
@@ -179,11 +179,11 @@ zbuildfont0(i_ctx_t *i_ctx_p)
pfont->procs.next_char_glyph = gs_type0_next_char_glyph;
pfont->procs.decode_glyph = gs_font_map_glyph_to_unicode; /* PDF needs. */
if (dict_find_string(op, "PrefEnc", &pprefenc) <= 0) {
- ref nul;
+ ref nul;
- make_null_new(&nul);
- if ((code = idict_put_string(op, "PrefEnc", &nul)) < 0)
- goto fail;
+ make_null_new(&nul);
+ if ((code = idict_put_string(op, "PrefEnc", &nul)) < 0)
+ goto fail;
}
get_GlyphNames2Unicode(i_ctx_p, (gs_font *)pfont, op);
/* Fill in the font data */
@@ -198,67 +198,67 @@ zbuildfont0(i_ctx_t *i_ctx_p)
* check this here rather than in the library.
*/
if (data.FMapType == fmap_SubsVector) {
- if (data.subs_size >= r_size(&pdata->Encoding)) {
- code = gs_note_error(e_rangecheck);
- goto fail;
- }
+ if (data.subs_size >= r_size(&pdata->Encoding)) {
+ code = gs_note_error(e_rangecheck);
+ goto fail;
+ }
}
data.Encoding =
- (uint *) ialloc_byte_array(data.encoding_size, sizeof(uint),
- "buildfont0(Encoding)");
+ (uint *) ialloc_byte_array(data.encoding_size, sizeof(uint),
+ "buildfont0(Encoding)");
if (data.Encoding == 0) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
/* Fill in the encoding vector, checking to make sure that */
/* each element is an integer between 0 and fdep_size-1. */
for (i = 0; i < data.encoding_size; i++) {
- ref enc;
+ ref enc;
- array_get(imemory, &pdata->Encoding, i, &enc);
- if (!r_has_type(&enc, t_integer)) {
- code = gs_note_error(e_typecheck);
- goto fail;
- }
- if ((ulong) enc.value.intval >= data.fdep_size) {
- code = gs_note_error(e_rangecheck);
- goto fail;
- }
- data.Encoding[i] = (uint) enc.value.intval;
+ array_get(imemory, &pdata->Encoding, i, &enc);
+ if (!r_has_type(&enc, t_integer)) {
+ code = gs_note_error(e_typecheck);
+ goto fail;
+ }
+ if ((ulong) enc.value.intval >= data.fdep_size) {
+ code = gs_note_error(e_rangecheck);
+ goto fail;
+ }
+ data.Encoding[i] = (uint) enc.value.intval;
}
data.FDepVector =
- ialloc_struct_array(data.fdep_size, gs_font *,
- &st_gs_font_ptr_element,
- "buildfont0(FDepVector)");
+ ialloc_struct_array(data.fdep_size, gs_font *,
+ &st_gs_font_ptr_element,
+ "buildfont0(FDepVector)");
if (data.FDepVector == 0) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
for (i = 0; i < data.fdep_size; i++) {
- ref fdep;
- ref *pfid;
+ ref fdep;
+ ref *pfid;
- array_get(pfont->memory, &fdepvector, i, &fdep);
- /* The lookup can't fail, because of the pre-check above. */
- dict_find_string(&fdep, "FID", &pfid);
- data.FDepVector[i] = r_ptr(pfid, gs_font);
+ array_get(pfont->memory, &fdepvector, i, &fdep);
+ /* The lookup can't fail, because of the pre-check above. */
+ dict_find_string(&fdep, "FID", &pfid);
+ data.FDepVector[i] = r_ptr(pfid, gs_font);
}
pfont->data = data;
code = define_gs_font(i_ctx_p, (gs_font *) pfont);
if (code >= 0)
- return code;
+ return code;
fail:
- /*
- * Undo the insertion of the FID entry in the dictionary. Note that
- * some allocations (Encoding, FDepVector) are not undone.
- */
+ /*
+ * Undo the insertion of the FID entry in the dictionary. Note that
+ * some allocations (Encoding, FDepVector) are not undone.
+ */
if (r_has_type(&save_FID, t_null)) {
- ref rnfid;
+ ref rnfid;
- name_enter_string(pfont->memory, "FID", &rnfid);
- idict_undef(op, &rnfid);
+ name_enter_string(pfont->memory, "FID", &rnfid);
+ idict_undef(op, &rnfid);
} else
- idict_put_string(op, "FID", &save_FID);
+ idict_put_string(op, "FID", &save_FID);
gs_free_object(pfont->memory, pfont, "buildfont0(font)");
return code;
}
@@ -278,15 +278,15 @@ ztype0_adjust_FDepVector(gs_font_type0 * pfont)
ref *prdep;
uint i;
int code = gs_alloc_ref_array(imem, &newdep, a_readonly, fdep_size,
- "ztype0_adjust_matrix");
+ "ztype0_adjust_matrix");
if (code < 0)
- return code;
+ return code;
for (prdep = newdep.value.refs, i = 0; i < fdep_size; i++, prdep++) {
- const ref *pdict = pfont_dict(pdep[i]);
+ const ref *pdict = pfont_dict(pdep[i]);
- ref_assign(prdep, pdict);
- r_set_attrs(prdep, imemory_new_mask(imem));
+ ref_assign(prdep, pdict);
+ r_set_attrs(prdep, imemory_new_mask(imem));
}
/*
* The FDepVector is an existing key in the parent's dictionary,
@@ -302,12 +302,12 @@ ztype0_define_font(gs_font_dir * pdir, gs_font * pfont)
int code = gs_type0_define_font(pdir, pfont);
if (code < 0 || pfont0->data.FDepVector == pdep)
- return code;
+ return code;
return ztype0_adjust_FDepVector(pfont0);
}
static int
ztype0_make_font(gs_font_dir * pdir, const gs_font * pfont,
- const gs_matrix * pmat, gs_font ** ppfont)
+ const gs_matrix * pmat, gs_font ** ppfont)
{
gs_font_type0 **const ppfont0 = (gs_font_type0 **)ppfont;
gs_font **pdep = (*ppfont0)->data.FDepVector;
@@ -315,12 +315,12 @@ ztype0_make_font(gs_font_dir * pdir, const gs_font * pfont,
code = zdefault_make_font(pdir, pfont, pmat, ppfont);
if (code < 0)
- return code;
+ return code;
code = gs_type0_make_font(pdir, pfont, pmat, ppfont);
if (code < 0)
- return code;
+ return code;
if ((*ppfont0)->data.FDepVector == pdep)
- return 0;
+ return 0;
return ztype0_adjust_FDepVector(*ppfont0);
}
@@ -329,20 +329,20 @@ ztype0_make_font(gs_font_dir * pdir, const gs_font * pfont,
/* Find or add a character entry in a font dictionary. */
static int
ensure_char_entry(i_ctx_t *i_ctx_p, os_ptr op, const char *kstr,
- byte * pvalue, int default_value)
+ byte * pvalue, int default_value)
{
ref *pentry;
if (dict_find_string(op, kstr, &pentry) <= 0) {
- ref ent;
+ ref ent;
- make_int(&ent, default_value);
- *pvalue = (byte) default_value;
- return idict_put_string(op, kstr, &ent);
+ make_int(&ent, default_value);
+ *pvalue = (byte) default_value;
+ return idict_put_string(op, kstr, &ent);
} else {
- check_int_leu_only(*pentry, 255);
- *pvalue = (byte) pentry->value.intval;
- return 0;
+ check_int_leu_only(*pentry, 255);
+ *pvalue = (byte) pentry->value.intval;
+ return 0;
}
}
diff --git a/gs/psi/zfont1.c b/gs/psi/zfont1.c
index d0452f5c4..39e434ff0 100644
--- a/gs/psi/zfont1.c
+++ b/gs/psi/zfont1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,15 +46,15 @@ find_zone_height(float *pmax_height, int count, const float *values)
float zone_height;
for (i = 0; i < count; i += 2)
- if ((zone_height = values[i + 1] - values[i]) > *pmax_height)
- *pmax_height = zone_height;
+ if ((zone_height = values[i + 1] - values[i]) > *pmax_height)
+ *pmax_height = zone_height;
}
/* ------ Font procedures ------ */
static int
z1_enumerate_glyph(gs_font * pfont, int *pindex, gs_glyph_space_t ignored,
- gs_glyph * pglyph)
+ gs_glyph * pglyph)
{
const gs_font_type1 *const pfont1 = (gs_font_type1 *)pfont;
const ref *pcsdict = &pfont_data(pfont1)->CharStrings;
@@ -70,29 +70,29 @@ charstring_font_get_refs(const_os_ptr op, charstring_font_refs_t *pfr)
{
check_type(*op, t_dictionary);
if (dict_find_string(op, "Private", &pfr->Private) <= 0 ||
- !r_has_type(pfr->Private, t_dictionary)
- )
- return_error(e_invalidfont);
+ !r_has_type(pfr->Private, t_dictionary)
+ )
+ return_error(e_invalidfont);
make_empty_array(&pfr->no_subrs, 0);
if (dict_find_string(pfr->Private, "OtherSubrs", &pfr->OtherSubrs) > 0) {
- if (!r_is_array(pfr->OtherSubrs))
- return_error(e_typecheck);
+ if (!r_is_array(pfr->OtherSubrs))
+ return_error(e_typecheck);
} else
- pfr->OtherSubrs = &pfr->no_subrs;
+ pfr->OtherSubrs = &pfr->no_subrs;
if (dict_find_string(pfr->Private, "Subrs", &pfr->Subrs) > 0) {
- if (!r_is_array(pfr->Subrs))
- return_error(e_typecheck);
+ if (!r_is_array(pfr->Subrs))
+ return_error(e_typecheck);
} else
- pfr->Subrs = &pfr->no_subrs;
+ pfr->Subrs = &pfr->no_subrs;
pfr->GlobalSubrs = &pfr->no_subrs;
return 0;
}
/* Get the parameters of a CharString-based font or a FDArray entry. */
int
-charstring_font_params(const gs_memory_t *mem,
- const_os_ptr op, charstring_font_refs_t *pfr,
- gs_type1_data *pdata1)
+charstring_font_params(const gs_memory_t *mem,
+ const_os_ptr op, charstring_font_refs_t *pfr,
+ gs_type1_data *pdata1)
{
const ref *pprivate = pfr->Private;
int code;
@@ -148,7 +148,7 @@ charstring_font_params(const gs_memory_t *mem,
/* The WeightVector is in the font dictionary, not Private. */
if ((code = pdata1->WeightVector.count = dict_float_array_param(mem, op, "WeightVector",
max_WeightVector, pdata1->WeightVector.values, NULL)) < 0)
- return code;
+ return code;
/*
* According to section 5.6 of the "Adobe Type 1 Font Format",
* there is a requirement that BlueScale times the maximum
@@ -157,14 +157,14 @@ charstring_font_params(const gs_memory_t *mem,
* values, so we force BlueScale back into range here.
*/
{
- float max_zone_height = 1.0;
+ float max_zone_height = 1.0;
find_zone_height(&max_zone_height, pdata1->BlueValues.count, pdata1->BlueValues.values);
find_zone_height(&max_zone_height, pdata1->OtherBlues.count, pdata1->OtherBlues.values);
find_zone_height(&max_zone_height, pdata1->FamilyBlues.count, pdata1->FamilyBlues.values);
find_zone_height(&max_zone_height, pdata1->FamilyOtherBlues.count, pdata1->FamilyOtherBlues.values);
- if (pdata1->BlueScale * max_zone_height > 1.0)
- pdata1->BlueScale = 1.0 / max_zone_height;
+ if (pdata1->BlueScale * max_zone_height > 1.0)
+ pdata1->BlueScale = 1.0 / max_zone_height;
}
/*
* According to the same Adobe book, section 5.11, only values
@@ -174,11 +174,11 @@ charstring_font_params(const gs_memory_t *mem,
* unexpected value.
*/
if (pdata1->LanguageGroup > 1 || pdata1->LanguageGroup < 0)
- pdata1->LanguageGroup = 0;
+ pdata1->LanguageGroup = 0;
/* This is used only when determining if its possible to copy glyphs
- * between fonts. Currenly only by pdfwrite and friends. Rather than
+ * between fonts. Currenly only by pdfwrite and friends. Rather than
* check all the subrs (which we used to do) we hash tehm, store it
- * and check the hashes. Zero except when in use by pdfwrite..
+ * and check the hashes. Zero except when in use by pdfwrite..
*/
memset(&pdata1->hash_subrs, 0x00, 16);
return 0;
@@ -187,7 +187,7 @@ charstring_font_params(const gs_memory_t *mem,
/* Fill in a newly built CharString-based font or FDArray entry. */
int
charstring_font_init(gs_font_type1 *pfont, const charstring_font_refs_t *pfr,
- const gs_type1_data *pdata1)
+ const gs_type1_data *pdata1)
{
font_data *pdata;
@@ -209,18 +209,18 @@ charstring_font_init(gs_font_type1 *pfont, const charstring_font_refs_t *pfr,
/* Build a Type 1, Type 2, or Type 4 font. */
int
build_charstring_font(i_ctx_t *i_ctx_p, os_ptr op, build_proc_refs *pbuild,
- font_type ftype, charstring_font_refs_t *pfr,
- gs_type1_data *pdata1, build_font_options_t options)
+ font_type ftype, charstring_font_refs_t *pfr,
+ gs_type1_data *pdata1, build_font_options_t options)
{
int code = charstring_font_params(imemory, op, pfr, pdata1);
gs_font_type1 *pfont;
if (code < 0)
- return code;
+ return code;
code = build_gs_primitive_font(i_ctx_p, op, (gs_font_base **)&pfont, ftype,
- &st_gs_font_type1, pbuild, options);
+ &st_gs_font_type1, pbuild, options);
if (code != 0)
- return code;
+ return code;
/* This is a new font, fill it in. */
charstring_font_init(pfont, pfr, pdata1);
return define_gs_font(i_ctx_p, (gs_font *)pfont);
@@ -231,19 +231,19 @@ build_charstring_font(i_ctx_t *i_ctx_p, os_ptr op, build_proc_refs *pbuild,
/* Build a Type 1 or Type 4 font. */
static int
buildfont1or4(i_ctx_t *i_ctx_p, os_ptr op, build_proc_refs * pbuild,
- font_type ftype, build_font_options_t options)
+ font_type ftype, build_font_options_t options)
{
charstring_font_refs_t refs;
int code = charstring_font_get_refs(op, &refs);
gs_type1_data data1;
if (code < 0)
- return code;
+ return code;
data1.interpret = gs_type1_interpret;
data1.subroutineNumberBias = 0;
data1.lenIV = DEFAULT_LENIV_1;
return build_charstring_font(i_ctx_p, op, pbuild, ftype, &refs, &data1,
- options);
+ options);
}
/* <string|name> <font_dict> .buildfont1 <string|name> <font> */
@@ -254,12 +254,12 @@ zbuildfont1(i_ctx_t *i_ctx_p)
os_ptr op = osp;
build_proc_refs build;
int code = build_proc_name_refs(imemory, &build,
- "%Type1BuildChar", "%Type1BuildGlyph");
+ "%Type1BuildChar", "%Type1BuildGlyph");
if (code < 0)
- return code;
+ return code;
return buildfont1or4(i_ctx_p, op, &build, ft_encrypted,
- bf_notdef_required);
+ bf_notdef_required);
}
/* <string|name> <font_dict> .buildfont4 <string|name> <font> */
@@ -272,7 +272,7 @@ zbuildfont4(i_ctx_t *i_ctx_p)
int code = build_gs_font_procs(op, &build);
if (code < 0)
- return code;
+ return code;
return buildfont1or4(i_ctx_p, op, &build, ft_disk_based, bf_options_none);
}
@@ -290,7 +290,7 @@ const op_def zfont1_op_defs[] =
/* same_font procedure */
static bool
same_font_dict(const font_data *pdata, const font_data *podata,
- const char *key)
+ const char *key)
{
ref *pvalue;
bool present = dict_find_string(&pdata->dict, key, &pvalue) > 0;
@@ -299,54 +299,53 @@ same_font_dict(const font_data *pdata, const font_data *podata,
dict *pdict = (&(podata->dict))->value.pdict;
return (present == opresent &&
- (present <= 0 || obj_eq(dict_mem(pdict), pvalue, povalue)));
+ (present <= 0 || obj_eq(dict_mem(pdict), pvalue, povalue)));
}
static int
z1_same_font(const gs_font *font, const gs_font *ofont, int mask)
{
if (ofont->FontType != font->FontType)
- return 0;
+ return 0;
while (font->base != font)
- font = font->base;
+ font = font->base;
while (ofont->base != ofont)
- ofont = ofont->base;
+ ofont = ofont->base;
if (ofont == font)
- return mask;
+ return mask;
{
- int same = gs_base_same_font(font, ofont, mask);
- int check = mask & ~same;
- const gs_font_type1 *const pfont1 = (const gs_font_type1 *)font;
- const font_data *const pdata = pfont_data(pfont1);
- const gs_font_type1 *pofont1 = (const gs_font_type1 *)ofont;
- const font_data *const podata = pfont_data(pofont1);
-
- if ((check & (FONT_SAME_OUTLINES | FONT_SAME_METRICS)) &&
- !memcmp(&pofont1->data.procs, &z1_data_procs, sizeof(z1_data_procs)) &&
- obj_eq(font->memory, &pdata->CharStrings, &podata->CharStrings) &&
- /*
- * We use same_font_dict for convenience: we know that
- * both fonts do have Private dictionaries.
- */
- same_font_dict(pdata, podata, "Private")
- )
- same |= FONT_SAME_OUTLINES;
-
- if ((check & FONT_SAME_METRICS) && (same & FONT_SAME_OUTLINES) &&
- !memcmp(&pofont1->data.procs, &z1_data_procs, sizeof(z1_data_procs)) &&
- /* Metrics may be affected by CDevProc, Metrics, Metrics2. */
- same_font_dict(pdata, podata, "Metrics") &&
- same_font_dict(pdata, podata, "Metrics2") &&
- same_font_dict(pdata, podata, "CDevProc")
- )
- same |= FONT_SAME_METRICS;
-
- if ((check & FONT_SAME_ENCODING) &&
- pofont1->procs.same_font == z1_same_font &&
- obj_eq(font->memory, &pdata->Encoding, &podata->Encoding)
- )
- same |= FONT_SAME_ENCODING;
-
- return same & mask;
+ int same = gs_base_same_font(font, ofont, mask);
+ int check = mask & ~same;
+ const gs_font_type1 *const pfont1 = (const gs_font_type1 *)font;
+ const font_data *const pdata = pfont_data(pfont1);
+ const gs_font_type1 *pofont1 = (const gs_font_type1 *)ofont;
+ const font_data *const podata = pfont_data(pofont1);
+
+ if ((check & (FONT_SAME_OUTLINES | FONT_SAME_METRICS)) &&
+ !memcmp(&pofont1->data.procs, &z1_data_procs, sizeof(z1_data_procs)) &&
+ obj_eq(font->memory, &pdata->CharStrings, &podata->CharStrings) &&
+ /*
+ * We use same_font_dict for convenience: we know that
+ * both fonts do have Private dictionaries.
+ */
+ same_font_dict(pdata, podata, "Private")
+ )
+ same |= FONT_SAME_OUTLINES;
+
+ if ((check & FONT_SAME_METRICS) && (same & FONT_SAME_OUTLINES) &&
+ !memcmp(&pofont1->data.procs, &z1_data_procs, sizeof(z1_data_procs)) &&
+ /* Metrics may be affected by CDevProc, Metrics, Metrics2. */
+ same_font_dict(pdata, podata, "Metrics") &&
+ same_font_dict(pdata, podata, "Metrics2") &&
+ same_font_dict(pdata, podata, "CDevProc")
+ )
+ same |= FONT_SAME_METRICS;
+
+ if ((check & FONT_SAME_ENCODING) &&
+ pofont1->procs.same_font == z1_same_font &&
+ obj_eq(font->memory, &pdata->Encoding, &podata->Encoding)
+ )
+ same |= FONT_SAME_ENCODING;
+
+ return same & mask;
}
}
-
diff --git a/gs/psi/zfont2.c b/gs/psi/zfont2.c
index 9e616f123..df81dcf09 100644
--- a/gs/psi/zfont2.c
+++ b/gs/psi/zfont2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2010 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,7 +46,7 @@ subr_bias(const ref * psubrs)
*/
int
type2_font_params(const_os_ptr op, charstring_font_refs_t *pfr,
- gs_type1_data *pdata1)
+ gs_type1_data *pdata1)
{
int code;
float dwx, nwx;
@@ -57,31 +57,31 @@ type2_font_params(const_os_ptr op, charstring_font_refs_t *pfr,
pdata1->subroutineNumberBias = subr_bias(pfr->Subrs);
/* Get information specific to Type 2 fonts. */
if (dict_find_string(pfr->Private, "GlobalSubrs", &temp) > 0) {
- if (!r_is_array(temp))
- return_error(e_typecheck);
+ if (!r_is_array(temp))
+ return_error(e_typecheck);
pfr->GlobalSubrs = temp;
}
pdata1->gsubrNumberBias = subr_bias(pfr->GlobalSubrs);
if ((code = dict_uint_param(pfr->Private, "gsubrNumberBias",
- 0, max_uint, pdata1->gsubrNumberBias,
- &pdata1->gsubrNumberBias)) < 0 ||
- (code = dict_float_param(pfr->Private, "defaultWidthX", 0.0,
- &dwx)) < 0 ||
- (code = dict_float_param(pfr->Private, "nominalWidthX", 0.0,
- &nwx)) < 0
- )
- return code;
+ 0, max_uint, pdata1->gsubrNumberBias,
+ &pdata1->gsubrNumberBias)) < 0 ||
+ (code = dict_float_param(pfr->Private, "defaultWidthX", 0.0,
+ &dwx)) < 0 ||
+ (code = dict_float_param(pfr->Private, "nominalWidthX", 0.0,
+ &nwx)) < 0
+ )
+ return code;
pdata1->defaultWidthX = float2fixed(dwx);
pdata1->nominalWidthX = float2fixed(nwx);
{
- ref *pirs;
-
- if (dict_find_string(pfr->Private, "initialRandomSeed", &pirs) <= 0)
- pdata1->initialRandomSeed = 0;
- else if (!r_has_type(pirs, t_integer))
- return_error(e_typecheck);
- else
- pdata1->initialRandomSeed = pirs->value.intval;
+ ref *pirs;
+
+ if (dict_find_string(pfr->Private, "initialRandomSeed", &pirs) <= 0)
+ pdata1->initialRandomSeed = 0;
+ else if (!r_has_type(pirs, t_integer))
+ return_error(e_typecheck);
+ else
+ pdata1->initialRandomSeed = pirs->value.intval;
}
return 0;
}
@@ -95,19 +95,19 @@ zbuildfont2(i_ctx_t *i_ctx_p)
charstring_font_refs_t refs;
build_proc_refs build;
int code = build_proc_name_refs(imemory, &build,
- "%Type2BuildChar", "%Type2BuildGlyph");
+ "%Type2BuildChar", "%Type2BuildGlyph");
gs_type1_data data1;
if (code < 0)
- return code;
+ return code;
code = charstring_font_get_refs(op, &refs);
if (code < 0)
- return code;
+ return code;
code = type2_font_params(op, &refs, &data1);
if (code < 0)
- return code;
+ return code;
return build_charstring_font(i_ctx_p, op, &build, ft_encrypted2, &refs,
- &data1, bf_notdef_required);
+ &data1, bf_notdef_required);
}
/* CFF parser */
@@ -116,400 +116,399 @@ zbuildfont2(i_ctx_t *i_ctx_p)
#define MAXOP 50 /* Max value according to TN 5176 is 48 */
static const char * const standard_strings[] = {
- /* 0 */ ".notdef",
- /* 1 */ "space",
- /* 2 */ "exclam",
- /* 3 */ "quotedbl",
- /* 4 */ "numbersign",
- /* 5 */ "dollar",
- /* 6 */ "percent",
- /* 7 */ "ampersand",
- /* 8 */ "quoteright",
- /* 9 */ "parenleft",
- /* 10 */ "parenright",
- /* 11 */ "asterisk",
- /* 12 */ "plus",
- /* 13 */ "comma",
- /* 14 */ "hyphen",
- /* 15 */ "period",
- /* 16 */ "slash",
- /* 17 */ "zero",
- /* 18 */ "one",
- /* 19 */ "two",
- /* 20 */ "three",
- /* 21 */ "four",
- /* 22 */ "five",
- /* 23 */ "six",
- /* 24 */ "seven",
- /* 25 */ "eight",
- /* 26 */ "nine",
- /* 27 */ "colon",
- /* 28 */ "semicolon",
- /* 29 */ "less",
- /* 30 */ "equal",
- /* 31 */ "greater",
- /* 32 */ "question",
- /* 33 */ "at",
- /* 34 */ "A",
- /* 35 */ "B",
- /* 36 */ "C",
- /* 37 */ "D",
- /* 38 */ "E",
- /* 39 */ "F",
- /* 40 */ "G",
- /* 41 */ "H",
- /* 42 */ "I",
- /* 43 */ "J",
- /* 44 */ "K",
- /* 45 */ "L",
- /* 46 */ "M",
- /* 47 */ "N",
- /* 48 */ "O",
- /* 49 */ "P",
- /* 50 */ "Q",
- /* 51 */ "R",
- /* 52 */ "S",
- /* 53 */ "T",
- /* 54 */ "U",
- /* 55 */ "V",
- /* 56 */ "W",
- /* 57 */ "X",
- /* 58 */ "Y",
- /* 59 */ "Z",
- /* 60 */ "bracketleft",
- /* 61 */ "backslash",
- /* 62 */ "bracketright",
- /* 63 */ "asciicircum",
- /* 64 */ "underscore",
- /* 65 */ "quoteleft",
- /* 66 */ "a",
- /* 67 */ "b",
- /* 68 */ "c",
- /* 69 */ "d",
- /* 70 */ "e",
- /* 71 */ "f",
- /* 72 */ "g",
- /* 73 */ "h",
- /* 74 */ "i",
- /* 75 */ "j",
- /* 76 */ "k",
- /* 77 */ "l",
- /* 78 */ "m",
- /* 79 */ "n",
- /* 80 */ "o",
- /* 81 */ "p",
- /* 82 */ "q",
- /* 83 */ "r",
- /* 84 */ "s",
- /* 85 */ "t",
- /* 86 */ "u",
- /* 87 */ "v",
- /* 88 */ "w",
- /* 89 */ "x",
- /* 90 */ "y",
- /* 91 */ "z",
- /* 92 */ "braceleft",
- /* 93 */ "bar",
- /* 94 */ "braceright",
- /* 95 */ "asciitilde",
- /* 96 */ "exclamdown",
- /* 97 */ "cent",
- /* 98 */ "sterling",
- /* 99 */ "fraction",
- /* 100 */ "yen",
- /* 101 */ "florin",
- /* 102 */ "section",
- /* 103 */ "currency",
- /* 104 */ "quotesingle",
- /* 105 */ "quotedblleft",
- /* 106 */ "guillemotleft",
- /* 107 */ "guilsinglleft",
- /* 108 */ "guilsinglright",
- /* 109 */ "fi",
- /* 110 */ "fl",
- /* 111 */ "endash",
- /* 112 */ "dagger",
- /* 113 */ "daggerdbl",
- /* 114 */ "periodcentered",
- /* 115 */ "paragraph",
- /* 116 */ "bullet",
- /* 117 */ "quotesinglbase",
- /* 118 */ "quotedblbase",
- /* 119 */ "quotedblright",
- /* 120 */ "guillemotright",
- /* 121 */ "ellipsis",
- /* 122 */ "perthousand",
- /* 123 */ "questiondown",
- /* 124 */ "grave",
- /* 125 */ "acute",
- /* 126 */ "circumflex",
- /* 127 */ "tilde",
- /* 128 */ "macron",
- /* 129 */ "breve",
- /* 130 */ "dotaccent",
- /* 131 */ "dieresis",
- /* 132 */ "ring",
- /* 133 */ "cedilla",
- /* 134 */ "hungarumlaut",
- /* 135 */ "ogonek",
- /* 136 */ "caron",
- /* 137 */ "emdash",
- /* 138 */ "AE",
- /* 139 */ "ordfeminine",
- /* 140 */ "Lslash",
- /* 141 */ "Oslash",
- /* 142 */ "OE",
- /* 143 */ "ordmasculine",
- /* 144 */ "ae",
- /* 145 */ "dotlessi",
- /* 146 */ "lslash",
- /* 147 */ "oslash",
- /* 148 */ "oe",
- /* 149 */ "germandbls",
- /* 150 */ "onesuperior",
- /* 151 */ "logicalnot",
- /* 152 */ "mu",
- /* 153 */ "trademark",
- /* 154 */ "Eth",
- /* 155 */ "onehalf",
- /* 156 */ "plusminus",
- /* 157 */ "Thorn",
- /* 158 */ "onequarter",
- /* 159 */ "divide",
- /* 160 */ "brokenbar",
- /* 161 */ "degree",
- /* 162 */ "thorn",
- /* 163 */ "threequarters",
- /* 164 */ "twosuperior",
- /* 165 */ "registered",
- /* 166 */ "minus",
- /* 167 */ "eth",
- /* 168 */ "multiply",
- /* 169 */ "threesuperior",
- /* 170 */ "copyright",
- /* 171 */ "Aacute",
- /* 172 */ "Acircumflex",
- /* 173 */ "Adieresis",
- /* 174 */ "Agrave",
- /* 175 */ "Aring",
- /* 176 */ "Atilde",
- /* 177 */ "Ccedilla",
- /* 178 */ "Eacute",
- /* 179 */ "Ecircumflex",
- /* 180 */ "Edieresis",
- /* 181 */ "Egrave",
- /* 182 */ "Iacute",
- /* 183 */ "Icircumflex",
- /* 184 */ "Idieresis",
- /* 185 */ "Igrave",
- /* 186 */ "Ntilde",
- /* 187 */ "Oacute",
- /* 188 */ "Ocircumflex",
- /* 189 */ "Odieresis",
- /* 190 */ "Ograve",
- /* 191 */ "Otilde",
- /* 192 */ "Scaron",
- /* 193 */ "Uacute",
- /* 194 */ "Ucircumflex",
- /* 195 */ "Udieresis",
- /* 196 */ "Ugrave",
- /* 197 */ "Yacute",
- /* 198 */ "Ydieresis",
- /* 199 */ "Zcaron",
- /* 200 */ "aacute",
- /* 201 */ "acircumflex",
- /* 202 */ "adieresis",
- /* 203 */ "agrave",
- /* 204 */ "aring",
- /* 205 */ "atilde",
- /* 206 */ "ccedilla",
- /* 207 */ "eacute",
- /* 208 */ "ecircumflex",
- /* 209 */ "edieresis",
- /* 210 */ "egrave",
- /* 211 */ "iacute",
- /* 212 */ "icircumflex",
- /* 213 */ "idieresis",
- /* 214 */ "igrave",
- /* 215 */ "ntilde",
- /* 216 */ "oacute",
- /* 217 */ "ocircumflex",
- /* 218 */ "odieresis",
- /* 219 */ "ograve",
- /* 220 */ "otilde",
- /* 221 */ "scaron",
- /* 222 */ "uacute",
- /* 223 */ "ucircumflex",
- /* 224 */ "udieresis",
- /* 225 */ "ugrave",
- /* 226 */ "yacute",
- /* 227 */ "ydieresis",
- /* 228 */ "zcaron",
- /* 229 */ "exclamsmall",
- /* 230 */ "Hungarumlautsmall",
- /* 231 */ "dollaroldstyle",
- /* 232 */ "dollarsuperior",
- /* 233 */ "ampersandsmall",
- /* 234 */ "Acutesmall",
- /* 235 */ "parenleftsuperior",
- /* 236 */ "parenrightsuperior",
- /* 237 */ "twodotenleader",
- /* 238 */ "onedotenleader",
- /* 239 */ "zerooldstyle",
- /* 240 */ "oneoldstyle",
- /* 241 */ "twooldstyle",
- /* 242 */ "threeoldstyle",
- /* 243 */ "fouroldstyle",
- /* 244 */ "fiveoldstyle",
- /* 245 */ "sixoldstyle",
- /* 246 */ "sevenoldstyle",
- /* 247 */ "eightoldstyle",
- /* 248 */ "nineoldstyle",
- /* 249 */ "commasuperior",
- /* 250 */ "threequartersemdash",
- /* 251 */ "periodsuperior",
- /* 252 */ "questionsmall",
- /* 253 */ "asuperior",
- /* 254 */ "bsuperior",
- /* 255 */ "centsuperior",
- /* 256 */ "dsuperior",
- /* 257 */ "esuperior",
- /* 258 */ "isuperior",
- /* 259 */ "lsuperior",
- /* 260 */ "msuperior",
- /* 261 */ "nsuperior",
- /* 262 */ "osuperior",
- /* 263 */ "rsuperior",
- /* 264 */ "ssuperior",
- /* 265 */ "tsuperior",
- /* 266 */ "ff",
- /* 267 */ "ffi",
- /* 268 */ "ffl",
- /* 269 */ "parenleftinferior",
- /* 270 */ "parenrightinferior",
- /* 271 */ "Circumflexsmall",
- /* 272 */ "hyphensuperior",
- /* 273 */ "Gravesmall",
- /* 274 */ "Asmall",
- /* 275 */ "Bsmall",
- /* 276 */ "Csmall",
- /* 277 */ "Dsmall",
- /* 278 */ "Esmall",
- /* 279 */ "Fsmall",
- /* 280 */ "Gsmall",
- /* 281 */ "Hsmall",
- /* 282 */ "Ismall",
- /* 283 */ "Jsmall",
- /* 284 */ "Ksmall",
- /* 285 */ "Lsmall",
- /* 286 */ "Msmall",
- /* 287 */ "Nsmall",
- /* 288 */ "Osmall",
- /* 289 */ "Psmall",
- /* 290 */ "Qsmall",
- /* 291 */ "Rsmall",
- /* 292 */ "Ssmall",
- /* 293 */ "Tsmall",
- /* 294 */ "Usmall",
- /* 295 */ "Vsmall",
- /* 296 */ "Wsmall",
- /* 297 */ "Xsmall",
- /* 298 */ "Ysmall",
- /* 299 */ "Zsmall",
- /* 300 */ "colonmonetary",
- /* 301 */ "onefitted",
- /* 302 */ "rupiah",
- /* 303 */ "Tildesmall",
- /* 304 */ "exclamdownsmall",
- /* 305 */ "centoldstyle",
- /* 306 */ "Lslashsmall",
- /* 307 */ "Scaronsmall",
- /* 308 */ "Zcaronsmall",
- /* 309 */ "Dieresissmall",
- /* 310 */ "Brevesmall",
- /* 311 */ "Caronsmall",
- /* 312 */ "Dotaccentsmall",
- /* 313 */ "Macronsmall",
- /* 314 */ "figuredash",
- /* 315 */ "hypheninferior",
- /* 316 */ "Ogoneksmall",
- /* 317 */ "Ringsmall",
- /* 318 */ "Cedillasmall",
- /* 319 */ "questiondownsmall",
- /* 320 */ "oneeighth",
- /* 321 */ "threeeighths",
- /* 322 */ "fiveeighths",
- /* 323 */ "seveneighths",
- /* 324 */ "onethird",
- /* 325 */ "twothirds",
- /* 326 */ "zerosuperior",
- /* 327 */ "foursuperior",
- /* 328 */ "fivesuperior",
- /* 329 */ "sixsuperior",
- /* 330 */ "sevensuperior",
- /* 331 */ "eightsuperior",
- /* 332 */ "ninesuperior",
- /* 333 */ "zeroinferior",
- /* 334 */ "oneinferior",
- /* 335 */ "twoinferior",
- /* 336 */ "threeinferior",
- /* 337 */ "fourinferior",
- /* 338 */ "fiveinferior",
- /* 339 */ "sixinferior",
- /* 340 */ "seveninferior",
- /* 341 */ "eightinferior",
- /* 342 */ "nineinferior",
- /* 343 */ "centinferior",
- /* 344 */ "dollarinferior",
- /* 345 */ "periodinferior",
- /* 346 */ "commainferior",
- /* 347 */ "Agravesmall",
- /* 348 */ "Aacutesmall",
- /* 349 */ "Acircumflexsmall",
- /* 350 */ "Atildesmall",
- /* 351 */ "Adieresissmall",
- /* 352 */ "Aringsmall",
- /* 353 */ "AEsmall",
- /* 354 */ "Ccedillasmall",
- /* 355 */ "Egravesmall",
- /* 356 */ "Eacutesmall",
- /* 357 */ "Ecircumflexsmall",
- /* 358 */ "Edieresissmall",
- /* 359 */ "Igravesmall",
- /* 360 */ "Iacutesmall",
- /* 361 */ "Icircumflexsmall",
- /* 362 */ "Idieresissmall",
- /* 363 */ "Ethsmall",
- /* 364 */ "Ntildesmall",
- /* 365 */ "Ogravesmall",
- /* 366 */ "Oacutesmall",
- /* 367 */ "Ocircumflexsmall",
- /* 368 */ "Otildesmall",
- /* 369 */ "Odieresissmall",
- /* 370 */ "OEsmall",
- /* 371 */ "Oslashsmall",
- /* 372 */ "Ugravesmall",
- /* 373 */ "Uacutesmall",
- /* 374 */ "Ucircumflexsmall",
- /* 375 */ "Udieresissmall",
- /* 376 */ "Yacutesmall",
- /* 377 */ "Thornsmall",
- /* 378 */ "Ydieresissmall",
- /* 379 */ "001.000",
- /* 380 */ "001.001",
- /* 381 */ "001.002",
- /* 382 */ "001.003",
- /* 383 */ "Black",
- /* 384 */ "Bold",
- /* 385 */ "Book",
- /* 386 */ "Light",
- /* 387 */ "Medium",
- /* 388 */ "Regular",
- /* 389 */ "Roman",
+ /* 0 */ ".notdef",
+ /* 1 */ "space",
+ /* 2 */ "exclam",
+ /* 3 */ "quotedbl",
+ /* 4 */ "numbersign",
+ /* 5 */ "dollar",
+ /* 6 */ "percent",
+ /* 7 */ "ampersand",
+ /* 8 */ "quoteright",
+ /* 9 */ "parenleft",
+ /* 10 */ "parenright",
+ /* 11 */ "asterisk",
+ /* 12 */ "plus",
+ /* 13 */ "comma",
+ /* 14 */ "hyphen",
+ /* 15 */ "period",
+ /* 16 */ "slash",
+ /* 17 */ "zero",
+ /* 18 */ "one",
+ /* 19 */ "two",
+ /* 20 */ "three",
+ /* 21 */ "four",
+ /* 22 */ "five",
+ /* 23 */ "six",
+ /* 24 */ "seven",
+ /* 25 */ "eight",
+ /* 26 */ "nine",
+ /* 27 */ "colon",
+ /* 28 */ "semicolon",
+ /* 29 */ "less",
+ /* 30 */ "equal",
+ /* 31 */ "greater",
+ /* 32 */ "question",
+ /* 33 */ "at",
+ /* 34 */ "A",
+ /* 35 */ "B",
+ /* 36 */ "C",
+ /* 37 */ "D",
+ /* 38 */ "E",
+ /* 39 */ "F",
+ /* 40 */ "G",
+ /* 41 */ "H",
+ /* 42 */ "I",
+ /* 43 */ "J",
+ /* 44 */ "K",
+ /* 45 */ "L",
+ /* 46 */ "M",
+ /* 47 */ "N",
+ /* 48 */ "O",
+ /* 49 */ "P",
+ /* 50 */ "Q",
+ /* 51 */ "R",
+ /* 52 */ "S",
+ /* 53 */ "T",
+ /* 54 */ "U",
+ /* 55 */ "V",
+ /* 56 */ "W",
+ /* 57 */ "X",
+ /* 58 */ "Y",
+ /* 59 */ "Z",
+ /* 60 */ "bracketleft",
+ /* 61 */ "backslash",
+ /* 62 */ "bracketright",
+ /* 63 */ "asciicircum",
+ /* 64 */ "underscore",
+ /* 65 */ "quoteleft",
+ /* 66 */ "a",
+ /* 67 */ "b",
+ /* 68 */ "c",
+ /* 69 */ "d",
+ /* 70 */ "e",
+ /* 71 */ "f",
+ /* 72 */ "g",
+ /* 73 */ "h",
+ /* 74 */ "i",
+ /* 75 */ "j",
+ /* 76 */ "k",
+ /* 77 */ "l",
+ /* 78 */ "m",
+ /* 79 */ "n",
+ /* 80 */ "o",
+ /* 81 */ "p",
+ /* 82 */ "q",
+ /* 83 */ "r",
+ /* 84 */ "s",
+ /* 85 */ "t",
+ /* 86 */ "u",
+ /* 87 */ "v",
+ /* 88 */ "w",
+ /* 89 */ "x",
+ /* 90 */ "y",
+ /* 91 */ "z",
+ /* 92 */ "braceleft",
+ /* 93 */ "bar",
+ /* 94 */ "braceright",
+ /* 95 */ "asciitilde",
+ /* 96 */ "exclamdown",
+ /* 97 */ "cent",
+ /* 98 */ "sterling",
+ /* 99 */ "fraction",
+ /* 100 */ "yen",
+ /* 101 */ "florin",
+ /* 102 */ "section",
+ /* 103 */ "currency",
+ /* 104 */ "quotesingle",
+ /* 105 */ "quotedblleft",
+ /* 106 */ "guillemotleft",
+ /* 107 */ "guilsinglleft",
+ /* 108 */ "guilsinglright",
+ /* 109 */ "fi",
+ /* 110 */ "fl",
+ /* 111 */ "endash",
+ /* 112 */ "dagger",
+ /* 113 */ "daggerdbl",
+ /* 114 */ "periodcentered",
+ /* 115 */ "paragraph",
+ /* 116 */ "bullet",
+ /* 117 */ "quotesinglbase",
+ /* 118 */ "quotedblbase",
+ /* 119 */ "quotedblright",
+ /* 120 */ "guillemotright",
+ /* 121 */ "ellipsis",
+ /* 122 */ "perthousand",
+ /* 123 */ "questiondown",
+ /* 124 */ "grave",
+ /* 125 */ "acute",
+ /* 126 */ "circumflex",
+ /* 127 */ "tilde",
+ /* 128 */ "macron",
+ /* 129 */ "breve",
+ /* 130 */ "dotaccent",
+ /* 131 */ "dieresis",
+ /* 132 */ "ring",
+ /* 133 */ "cedilla",
+ /* 134 */ "hungarumlaut",
+ /* 135 */ "ogonek",
+ /* 136 */ "caron",
+ /* 137 */ "emdash",
+ /* 138 */ "AE",
+ /* 139 */ "ordfeminine",
+ /* 140 */ "Lslash",
+ /* 141 */ "Oslash",
+ /* 142 */ "OE",
+ /* 143 */ "ordmasculine",
+ /* 144 */ "ae",
+ /* 145 */ "dotlessi",
+ /* 146 */ "lslash",
+ /* 147 */ "oslash",
+ /* 148 */ "oe",
+ /* 149 */ "germandbls",
+ /* 150 */ "onesuperior",
+ /* 151 */ "logicalnot",
+ /* 152 */ "mu",
+ /* 153 */ "trademark",
+ /* 154 */ "Eth",
+ /* 155 */ "onehalf",
+ /* 156 */ "plusminus",
+ /* 157 */ "Thorn",
+ /* 158 */ "onequarter",
+ /* 159 */ "divide",
+ /* 160 */ "brokenbar",
+ /* 161 */ "degree",
+ /* 162 */ "thorn",
+ /* 163 */ "threequarters",
+ /* 164 */ "twosuperior",
+ /* 165 */ "registered",
+ /* 166 */ "minus",
+ /* 167 */ "eth",
+ /* 168 */ "multiply",
+ /* 169 */ "threesuperior",
+ /* 170 */ "copyright",
+ /* 171 */ "Aacute",
+ /* 172 */ "Acircumflex",
+ /* 173 */ "Adieresis",
+ /* 174 */ "Agrave",
+ /* 175 */ "Aring",
+ /* 176 */ "Atilde",
+ /* 177 */ "Ccedilla",
+ /* 178 */ "Eacute",
+ /* 179 */ "Ecircumflex",
+ /* 180 */ "Edieresis",
+ /* 181 */ "Egrave",
+ /* 182 */ "Iacute",
+ /* 183 */ "Icircumflex",
+ /* 184 */ "Idieresis",
+ /* 185 */ "Igrave",
+ /* 186 */ "Ntilde",
+ /* 187 */ "Oacute",
+ /* 188 */ "Ocircumflex",
+ /* 189 */ "Odieresis",
+ /* 190 */ "Ograve",
+ /* 191 */ "Otilde",
+ /* 192 */ "Scaron",
+ /* 193 */ "Uacute",
+ /* 194 */ "Ucircumflex",
+ /* 195 */ "Udieresis",
+ /* 196 */ "Ugrave",
+ /* 197 */ "Yacute",
+ /* 198 */ "Ydieresis",
+ /* 199 */ "Zcaron",
+ /* 200 */ "aacute",
+ /* 201 */ "acircumflex",
+ /* 202 */ "adieresis",
+ /* 203 */ "agrave",
+ /* 204 */ "aring",
+ /* 205 */ "atilde",
+ /* 206 */ "ccedilla",
+ /* 207 */ "eacute",
+ /* 208 */ "ecircumflex",
+ /* 209 */ "edieresis",
+ /* 210 */ "egrave",
+ /* 211 */ "iacute",
+ /* 212 */ "icircumflex",
+ /* 213 */ "idieresis",
+ /* 214 */ "igrave",
+ /* 215 */ "ntilde",
+ /* 216 */ "oacute",
+ /* 217 */ "ocircumflex",
+ /* 218 */ "odieresis",
+ /* 219 */ "ograve",
+ /* 220 */ "otilde",
+ /* 221 */ "scaron",
+ /* 222 */ "uacute",
+ /* 223 */ "ucircumflex",
+ /* 224 */ "udieresis",
+ /* 225 */ "ugrave",
+ /* 226 */ "yacute",
+ /* 227 */ "ydieresis",
+ /* 228 */ "zcaron",
+ /* 229 */ "exclamsmall",
+ /* 230 */ "Hungarumlautsmall",
+ /* 231 */ "dollaroldstyle",
+ /* 232 */ "dollarsuperior",
+ /* 233 */ "ampersandsmall",
+ /* 234 */ "Acutesmall",
+ /* 235 */ "parenleftsuperior",
+ /* 236 */ "parenrightsuperior",
+ /* 237 */ "twodotenleader",
+ /* 238 */ "onedotenleader",
+ /* 239 */ "zerooldstyle",
+ /* 240 */ "oneoldstyle",
+ /* 241 */ "twooldstyle",
+ /* 242 */ "threeoldstyle",
+ /* 243 */ "fouroldstyle",
+ /* 244 */ "fiveoldstyle",
+ /* 245 */ "sixoldstyle",
+ /* 246 */ "sevenoldstyle",
+ /* 247 */ "eightoldstyle",
+ /* 248 */ "nineoldstyle",
+ /* 249 */ "commasuperior",
+ /* 250 */ "threequartersemdash",
+ /* 251 */ "periodsuperior",
+ /* 252 */ "questionsmall",
+ /* 253 */ "asuperior",
+ /* 254 */ "bsuperior",
+ /* 255 */ "centsuperior",
+ /* 256 */ "dsuperior",
+ /* 257 */ "esuperior",
+ /* 258 */ "isuperior",
+ /* 259 */ "lsuperior",
+ /* 260 */ "msuperior",
+ /* 261 */ "nsuperior",
+ /* 262 */ "osuperior",
+ /* 263 */ "rsuperior",
+ /* 264 */ "ssuperior",
+ /* 265 */ "tsuperior",
+ /* 266 */ "ff",
+ /* 267 */ "ffi",
+ /* 268 */ "ffl",
+ /* 269 */ "parenleftinferior",
+ /* 270 */ "parenrightinferior",
+ /* 271 */ "Circumflexsmall",
+ /* 272 */ "hyphensuperior",
+ /* 273 */ "Gravesmall",
+ /* 274 */ "Asmall",
+ /* 275 */ "Bsmall",
+ /* 276 */ "Csmall",
+ /* 277 */ "Dsmall",
+ /* 278 */ "Esmall",
+ /* 279 */ "Fsmall",
+ /* 280 */ "Gsmall",
+ /* 281 */ "Hsmall",
+ /* 282 */ "Ismall",
+ /* 283 */ "Jsmall",
+ /* 284 */ "Ksmall",
+ /* 285 */ "Lsmall",
+ /* 286 */ "Msmall",
+ /* 287 */ "Nsmall",
+ /* 288 */ "Osmall",
+ /* 289 */ "Psmall",
+ /* 290 */ "Qsmall",
+ /* 291 */ "Rsmall",
+ /* 292 */ "Ssmall",
+ /* 293 */ "Tsmall",
+ /* 294 */ "Usmall",
+ /* 295 */ "Vsmall",
+ /* 296 */ "Wsmall",
+ /* 297 */ "Xsmall",
+ /* 298 */ "Ysmall",
+ /* 299 */ "Zsmall",
+ /* 300 */ "colonmonetary",
+ /* 301 */ "onefitted",
+ /* 302 */ "rupiah",
+ /* 303 */ "Tildesmall",
+ /* 304 */ "exclamdownsmall",
+ /* 305 */ "centoldstyle",
+ /* 306 */ "Lslashsmall",
+ /* 307 */ "Scaronsmall",
+ /* 308 */ "Zcaronsmall",
+ /* 309 */ "Dieresissmall",
+ /* 310 */ "Brevesmall",
+ /* 311 */ "Caronsmall",
+ /* 312 */ "Dotaccentsmall",
+ /* 313 */ "Macronsmall",
+ /* 314 */ "figuredash",
+ /* 315 */ "hypheninferior",
+ /* 316 */ "Ogoneksmall",
+ /* 317 */ "Ringsmall",
+ /* 318 */ "Cedillasmall",
+ /* 319 */ "questiondownsmall",
+ /* 320 */ "oneeighth",
+ /* 321 */ "threeeighths",
+ /* 322 */ "fiveeighths",
+ /* 323 */ "seveneighths",
+ /* 324 */ "onethird",
+ /* 325 */ "twothirds",
+ /* 326 */ "zerosuperior",
+ /* 327 */ "foursuperior",
+ /* 328 */ "fivesuperior",
+ /* 329 */ "sixsuperior",
+ /* 330 */ "sevensuperior",
+ /* 331 */ "eightsuperior",
+ /* 332 */ "ninesuperior",
+ /* 333 */ "zeroinferior",
+ /* 334 */ "oneinferior",
+ /* 335 */ "twoinferior",
+ /* 336 */ "threeinferior",
+ /* 337 */ "fourinferior",
+ /* 338 */ "fiveinferior",
+ /* 339 */ "sixinferior",
+ /* 340 */ "seveninferior",
+ /* 341 */ "eightinferior",
+ /* 342 */ "nineinferior",
+ /* 343 */ "centinferior",
+ /* 344 */ "dollarinferior",
+ /* 345 */ "periodinferior",
+ /* 346 */ "commainferior",
+ /* 347 */ "Agravesmall",
+ /* 348 */ "Aacutesmall",
+ /* 349 */ "Acircumflexsmall",
+ /* 350 */ "Atildesmall",
+ /* 351 */ "Adieresissmall",
+ /* 352 */ "Aringsmall",
+ /* 353 */ "AEsmall",
+ /* 354 */ "Ccedillasmall",
+ /* 355 */ "Egravesmall",
+ /* 356 */ "Eacutesmall",
+ /* 357 */ "Ecircumflexsmall",
+ /* 358 */ "Edieresissmall",
+ /* 359 */ "Igravesmall",
+ /* 360 */ "Iacutesmall",
+ /* 361 */ "Icircumflexsmall",
+ /* 362 */ "Idieresissmall",
+ /* 363 */ "Ethsmall",
+ /* 364 */ "Ntildesmall",
+ /* 365 */ "Ogravesmall",
+ /* 366 */ "Oacutesmall",
+ /* 367 */ "Ocircumflexsmall",
+ /* 368 */ "Otildesmall",
+ /* 369 */ "Odieresissmall",
+ /* 370 */ "OEsmall",
+ /* 371 */ "Oslashsmall",
+ /* 372 */ "Ugravesmall",
+ /* 373 */ "Uacutesmall",
+ /* 374 */ "Ucircumflexsmall",
+ /* 375 */ "Udieresissmall",
+ /* 376 */ "Yacutesmall",
+ /* 377 */ "Thornsmall",
+ /* 378 */ "Ydieresissmall",
+ /* 379 */ "001.000",
+ /* 380 */ "001.001",
+ /* 381 */ "001.002",
+ /* 382 */ "001.003",
+ /* 383 */ "Black",
+ /* 384 */ "Bold",
+ /* 385 */ "Book",
+ /* 386 */ "Light",
+ /* 387 */ "Medium",
+ /* 388 */ "Regular",
+ /* 389 */ "Roman",
/* 390 */ "Semibold"
};
-
const static unsigned short expert_charset[] = {
1, /* space */
229, /* exclamsmall */
@@ -1297,7 +1296,6 @@ typedef struct tag_cff_index_t {
unsigned int offsize, count;
} cff_index_t;
-
static int
card8(unsigned int *u, const cff_data_t *o, unsigned p, unsigned pe)
{
@@ -1345,7 +1343,7 @@ static int (* const offset_procs[])(unsigned int *, const cff_data_t *, unsigned
static int
get_cff_string(unsigned char *dst, const cff_data_t *o, unsigned p, unsigned len)
-{
+{
if (p + len > o->length)
return_error(e_rangecheck); /* out of range access */
while (len) {
@@ -1364,7 +1362,7 @@ get_cff_string(unsigned char *dst, const cff_data_t *o, unsigned p, unsigned len
static int
parse_index(cff_index_t *x, const cff_data_t *data, unsigned p, unsigned pe)
{ int code;
-
+
if (p == 0) {
/* Make an empty index when the offset to the index is not defined. */
memset(x, 0, sizeof(*x));
@@ -1422,7 +1420,7 @@ peek_index(unsigned *pp, unsigned int *len, const cff_index_t *x, const cff_data
static int
get_int(int *v, const cff_data_t *data, unsigned p, unsigned pe)
-{
+{
int code;
unsigned int c, u;
const int ext16 = ~0 << 15; /* sign extension constant */
@@ -1430,7 +1428,7 @@ get_int(int *v, const cff_data_t *data, unsigned p, unsigned pe)
if ((code = card8(&c, data, p, pe)) < 0)
return code;
-
+
if (c == 28) {
if ((code = card16(&u, data, p + 1, pe)) < 0)
return code;
@@ -1442,7 +1440,7 @@ get_int(int *v, const cff_data_t *data, unsigned p, unsigned pe)
return code;
*v = ((int)u + ext32) ^ ext32;
return 5;
- }
+ }
if (c < 32)
return_error(e_rangecheck); /* out of range */
if (c < 247) {
@@ -1466,7 +1464,7 @@ get_int(int *v, const cff_data_t *data, unsigned p, unsigned pe)
static int
get_float(float *v, const cff_data_t *data, unsigned p, unsigned pe)
-{
+{
int code;
unsigned int c, i;
char buf[80];
@@ -1538,7 +1536,7 @@ idict_undef_c_name(i_ctx_t *i_ctx_p, ref *dst, const char *c_name, unsigned int
return code;
code = idict_undef(dst, &ps_name);
if (code < 0 && code != e_undefined) /* ignore undefined error */
- return code;
+ return code;
return 0;
}
@@ -1559,7 +1557,7 @@ idict_move_c_name(i_ctx_t *i_ctx_p, ref *dst, ref *src, const char *c_name, unsi
return 0;
}
-static int
+static int
make_string_from_index(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *index, const cff_data_t *data, unsigned int id, int fd_num)
{
int code;
@@ -1572,7 +1570,7 @@ make_string_from_index(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *index, con
if (len + fdoff> 65535)
return_error(e_limitcheck);
if ((sbody = ialloc_string(len + fdoff, "make_string_from_index")) == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_string(dst, icurrent_space | a_readonly, len + fdoff, sbody);
if ((code = get_cff_string(sbody + fdoff, data, doff, len)) < 0)
return code;
@@ -1581,19 +1579,18 @@ make_string_from_index(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *index, con
return 0;
}
-static int
+static int
make_string_from_sid(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *strings, const cff_data_t *data, unsigned int sid)
{
if (sid < count_of(standard_strings)) {
- make_string(dst, avm_foreign | a_readonly,
+ make_string(dst, avm_foreign | a_readonly,
strlen(standard_strings[sid]), (unsigned char *)standard_strings[sid]); /* break const */
return 0;
- } else
+ } else
return make_string_from_index(i_ctx_p, dst, strings, data, sid - count_of(standard_strings), -1);
}
-
-static int
+static int
make_name_from_sid(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *strings, const cff_data_t *data, unsigned int sid)
{
if (sid < count_of(standard_strings)) {
@@ -1614,7 +1611,7 @@ make_name_from_sid(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *strings, const
}
}
-static int
+static int
make_stringarray_from_index(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *index, const cff_data_t *data)
{
int code;
@@ -1635,7 +1632,7 @@ make_stringarray_from_index(i_ctx_t *i_ctx_p, ref *dst, const cff_index_t *index
static void
undelta(ref *ops, unsigned int cnt)
-{
+{
unsigned int i;
for (i = 0; i < cnt; i++) {
@@ -1647,7 +1644,7 @@ undelta(ref *ops, unsigned int cnt)
}
}
-static int
+static int
iso_adobe_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i)
{
if (i < 228)
@@ -1656,7 +1653,7 @@ iso_adobe_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned
return_error(e_rangecheck);
}
-static int
+static int
expert_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i)
{
if (i < sizeof(expert_charset)/sizeof(*expert_charset))
@@ -1665,7 +1662,7 @@ expert_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i)
return_error(e_rangecheck);
}
-static int
+static int
expert_subset_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
if (i < sizeof(expert_subset_charset)/sizeof(*expert_subset_charset))
@@ -1674,7 +1671,7 @@ expert_subset_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsi
return_error(e_rangecheck);
}
-static int
+static int
format0_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
int code;
@@ -1685,7 +1682,7 @@ format0_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i
return (int)u;
}
-static int
+static int
format1_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
int code;
@@ -1707,7 +1704,7 @@ format1_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i
return_error(e_rangecheck);
}
-static int
+static int
format2_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
int code;
@@ -1730,23 +1727,23 @@ format2_charset_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned i
return_error(e_rangecheck);
}
-static int
+static int
format0_fdselect_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
int code;
unsigned u;
-
+
if ((code = card8(&u, data, p + i, pe)) < 0)
return code;
return (int)u;
}
-static int
+static int
format3_fdselect_proc(const cff_data_t *data, unsigned p, unsigned pe, unsigned int i)
{
int code;
unsigned int u, n_ranges;
-
+
if ((code = card16(&n_ranges, data, p, pe)) < 0)
return code;
p += 2;
@@ -1871,7 +1868,6 @@ typedef enum {
#define CONTROL(id, n_op, flags) ((flags) | (n_op) | ((k_##id) << 8))
-
typedef enum {
k_0, k_1, k_2, k_7, k_50, k_neg_100, k_8720, k_0_039625, k_0_06, k_false, k_box,
k_matrix, k_matrix_1, k_emptydict
@@ -1901,7 +1897,7 @@ static const font_defaults_t cid_font_defaults[] = {
{ k_CIDFontVersion, k_0 },
{ k_CIDFontRevision, k_0 },
{ k_CIDFontType, k_0 },
- { k_CIDCount, k_8720 }
+ { k_CIDCount, k_8720 }
};
static const font_defaults_t fd_font_defaults[] = {
@@ -1940,7 +1936,7 @@ set_defaults(i_ctx_t *i_ctx_p, ref *dest, const font_defaults_t *def, int count)
if ((code = name_ref(imemory, (const unsigned char *)font_keys[def[i].key],
font_keys_sz[def[i].key], &name, 0)) < 0)
return code;
- if (dict_find(dest, &name, &dummy) <= 0) {
+ if (dict_find(dest, &name, &dummy) <= 0) {
switch (def[i].value) {
default:
case k_0:
@@ -2073,7 +2069,7 @@ parse_dict(i_ctx_t *i_ctx_p, ref *topdict, font_offsets_t *offsets,
return_error(e_rangecheck);
if ((code = card8(&c, data, p++, pe)) < 0)
return code;
- switch(c) {
+ switch(c) {
case 0: /* Copyright 12 0 SID -, FontInfo */
control = CONTROL(Copyright, 1, k_fontinfodict | k_sid);
break;
@@ -2261,9 +2257,9 @@ parse_dict(i_ctx_t *i_ctx_p, ref *topdict, font_offsets_t *offsets,
continue;
case 31: case 255: /* reserved */
continue;
- default:
+ default:
{ int n; /* int operand */
-
+
if (op_i >= MAXOP)
return_error(e_limitcheck);
if ((code = get_int(&n, data, p - 1, pe)) < 0)
@@ -2272,7 +2268,7 @@ parse_dict(i_ctx_t *i_ctx_p, ref *topdict, font_offsets_t *offsets,
op_i++;
p += code - 1;
}
- continue;
+ continue;
}
{
unsigned int n_op = control & 255;
@@ -2287,7 +2283,7 @@ parse_dict(i_ctx_t *i_ctx_p, ref *topdict, font_offsets_t *offsets,
undelta(ops + op_i - n_op, n_op);
op_i -= n_op;
if (control & (k_sid | k_int | k_bool)) {
- if (!r_has_type(&ops[op_i], t_integer))
+ if (!r_has_type(&ops[op_i], t_integer))
return_error(e_typecheck);
}
if (control & k_bool)
@@ -2309,7 +2305,7 @@ parse_dict(i_ctx_t *i_ctx_p, ref *topdict, font_offsets_t *offsets,
if ((code = find_font_dict(i_ctx_p, topdict, &fontinfodict, "FontInfo")) < 0)
return code;
dict = fontinfodict;
- } else
+ } else
dict = topdict;
code = idict_put_c_name(i_ctx_p, dict, font_keys[string_id], font_keys_sz[string_id],
((control & (k_bool | k_sid | k_array)) == 0 ? &ops[op_i] : &arg));
@@ -2398,7 +2394,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
}
}
}
-
+
if (offsets.have_ros) { /* CIDFont */
unsigned int i;
cff_index_t fdarray;
@@ -2467,15 +2463,15 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
*
* 1) If both Top DICT and Font DICT does _not_ have FontMatrix, then Top DICT =
* [0.001 0 0 0.001 0 0], Font DICT= [1 0 0 1 0 0]. (Or, Top DICT = (absent),
- * Font DICT = [0.001 0 0 0.001 0 0] then let '/CIDFont defineresource'
+ * Font DICT = [0.001 0 0 0.001 0 0] then let '/CIDFont defineresource'
* make Top DICT = [0.001 0 0 0.001 0 0], Font DICT = [1 0 0 1 0 0].)
*
* 2) If Top DICT has FontMatrix and Font DICT doesn't, then Top DICT = (supplied
* matrix), Font DICT = [1 0 0 1 0 0].
*
* 3) If Top DICT does not have FontMatrix but Font DICT does, then Top DICT = [1
- * 0 0 1 0 0], Font DICT = (supplied matrix). (Or, Top DICT = (absent),
- * Font DICT = (supplied matrix) then let '/CIDFont defineresource'
+ * 0 0 1 0 0], Font DICT = (supplied matrix). (Or, Top DICT = (absent),
+ * Font DICT = (supplied matrix) then let '/CIDFont defineresource'
* make Top DICT = [0.001 0 0 0.001 0 0], Font DICT = (supplied matrix 1000 times
* larger).)
*
@@ -2491,12 +2487,12 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
if ((code = set_defaults(i_ctx_p, fdfont, fd_font_defaults, count_of(fd_font_defaults))) < 0)
return code;
}
-
+
if ((code = card8(&fdselect_code, data, p_all + fdselect_off, pe_all)) < 0)
return code;
if (fdselect_code == 0)
fdselect_proc = format0_fdselect_proc;
- else if (fdselect_code == 3)
+ else if (fdselect_code == 3)
fdselect_proc = format3_fdselect_proc;
else
return_error(e_rangecheck);
@@ -2504,7 +2500,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
make_int(&int_ref, 0);
for (i = 0; i < charstrings_index.count; i++) {
int fd;
-
+
if (fdarray.count <= 1)
fd = -1;
else {
@@ -2531,9 +2527,9 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
ref int_ref, str_ref, glyph_directory_ref, fdarray_ref, cidsysteminfo_ref;
if ((code = idict_undef_c_name(i_ctx_p, topdict, STR2MEM("UniqueID"))) < 0)
- return code;
+ return code;
if ((code = idict_undef_c_name(i_ctx_p, topdict, STR2MEM("XUID"))) < 0)
- return code;
+ return code;
if ((code = ialloc_ref_array(&fdarray_ref, a_readonly, 1, "force_cid.fdarray")) < 0)
return code;
if ((code = idict_put_c_name(i_ctx_p, topdict, STR2MEM("FDArray"), &fdarray_ref)) < 0)
@@ -2573,7 +2569,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
make_int(&int_ref, 0);
for ( ; int_ref.value.intval < (int)charstrings_index.count; int_ref.value.intval++) {
ref cstr_ref;
-
+
if ((code = make_string_from_index(i_ctx_p, &cstr_ref, &charstrings_index, data, int_ref.value.intval, -1)) < 0)
return code;
if ((code = idict_put(&glyph_directory_ref, &int_ref, &cstr_ref)) < 0)
@@ -2606,7 +2602,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
if ((code = ialloc_ref_array(&encoding, a_readonly, 256, "cff_parser.encoding")) < 0)
return code;
for (i = 0; i < 256; i++) {
- if ((code = make_name_from_sid(i_ctx_p, &encoding.value.refs[i],
+ if ((code = make_name_from_sid(i_ctx_p, &encoding.value.refs[i],
strings, data, (offsets.encoding_off ? expert_encoding : standard_encoding)[i])) < 0)
return code;
}
@@ -2662,7 +2658,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
if ((code = make_name_from_sid(i_ctx_p, &name, strings, data, sid)) < 0) {
char buf[40];
int len = sprintf(buf, "sid-%d", sid);
-
+
if ((code = name_ref(imemory, (unsigned char *)buf, len, &name, 1)) < 0)
return code;
}
@@ -2670,7 +2666,7 @@ parse_font(i_ctx_t *i_ctx_p, ref *topdict,
return code;
if (offsets.encoding_off > 1 && gid < 256) {
encoding.value.refs[gid2char[gid]] = name;
- }
+ }
}
if (offsets.encoding_off > 1 && (enc_format & 0x80)) {
unsigned int n_supp, charcode, sid;
@@ -2715,7 +2711,7 @@ zparsecff(i_ctx_t *i_ctx_p)
check_read(*op);
if (r_has_type(op, t_array)) { /* no packedarrays */
int i, blk_sz, blk_cnt;
-
+
data.blk_ref = op->value.refs;
blk_cnt = r_size(op);
blk_sz = r_size(data.blk_ref);
@@ -2731,14 +2727,14 @@ zparsecff(i_ctx_t *i_ctx_p)
}
if (data.length == 0)
return_error(e_rangecheck);
-
+
if (blk_cnt == 1) {
data.mask = 0xffff; /* stub */
data.shift = 16; /* stub */
} else {
- static const int mod2shift[] = {
+ static const int mod2shift[] = {
0, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17,
- 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18
+ 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18
};
data.mask = blk_sz - 1;
if (data.mask & blk_sz)
@@ -2784,7 +2780,7 @@ zparsecff(i_ctx_t *i_ctx_p)
return_error(e_limitcheck);
if ((code = dict_create(names.count, &fontset)) < 0)
return code;
-
+
for (i_font = 0; i_font < names.count; i_font++) {
unsigned int name_data;
unsigned int name_len;
@@ -2802,23 +2798,23 @@ zparsecff(i_ctx_t *i_ctx_p)
return_error(e_limitcheck);
if ((code = get_cff_string(buf, &data, name_data, name_len)) < 0)
return code;
- if (buf[0] == 0) /* deleted entry */
+ if (buf[0] == 0) /* deleted entry */
continue;
if ((code = name_ref(imemory, buf, name_len, &name, 1)) < 0)
- return code;
+ return code;
if ((code = peek_index(&topdict_data, &topdict_len, &topdicts, &data, i_font)) < 0)
return code;
-
+
if ((code = dict_create(20, &topdict)) < 0)
return code;
if ((code = idict_put(&fontset, &name, &topdict)) < 0)
- return code;
+ return code;
if ((code = parse_font(i_ctx_p, &topdict, &strings, (gsubrs.count ? &gsubrs_array : 0),
&data, topdict_data, topdict_data + topdict_len, p, pe, force_cidfont)) < 0)
return code;
- }
+ }
ref_assign(op - 1, &fontset);
pop(1);
return 0;
diff --git a/gs/psi/zfont32.c b/gs/psi/zfont32.c
index ec180440f..16cd6305c 100644
--- a/gs/psi/zfont32.c
+++ b/gs/psi/zfont32.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,12 +44,12 @@ zbuildfont32(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = build_proc_name_refs(imemory, &build, NULL, "%Type32BuildGlyph");
if (code < 0)
- return code;
+ return code;
code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_CID_bitmap,
- &st_gs_font_base, &build,
- bf_Encoding_optional);
+ &st_gs_font_base, &build,
+ bf_Encoding_optional);
if (code < 0)
- return code;
+ return code;
/* Always transform cached bitmaps. */
pfont->BitmapWidths = true;
pfont->ExactSize = fbit_transform_bitmaps;
@@ -68,7 +68,7 @@ zgetshowoperator(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
gs_text_enum_t *osenum = op_show_find(i_ctx_p);
-
+
push(1);
if (osenum == NULL)
make_null(op);
@@ -80,7 +80,6 @@ zgetshowoperator(i_ctx_t *i_ctx_p)
return 0;
}
-
/* ------ Initialization procedure ------ */
const op_def zfont32_op_defs[] =
diff --git a/gs/psi/zfont42.c b/gs/psi/zfont42.c
index 07c540362..489120518 100644
--- a/gs/psi/zfont42.c
+++ b/gs/psi/zfont42.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -44,9 +44,9 @@ static font_proc_font_info(z42_font_info);
/* Build a type 11 (TrueType CID-keyed) or 42 (TrueType) font. */
int
build_gs_TrueType_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_type42 **ppfont,
- font_type ftype, gs_memory_type_ptr_t pstype,
- const char *bcstr, const char *bgstr,
- build_font_options_t options)
+ font_type ftype, gs_memory_type_ptr_t pstype,
+ const char *bcstr, const char *bgstr,
+ build_font_options_t options)
{
build_proc_refs build;
ref sfnts, GlyphDirectory;
@@ -56,20 +56,20 @@ build_gs_TrueType_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_type42 **ppfont,
code = build_proc_name_refs(imemory, &build, bcstr, bgstr);
if (code < 0)
- return code;
+ return code;
check_type(*op, t_dictionary);
/*
* Since build_gs_primitive_font may resize the dictionary and cause
* pointers to become invalid, we save sfnts and GlyphDirectory.
*/
if ((code = font_string_array_param(imemory, op, "sfnts", &sfnts)) < 0 ||
- (code = font_GlyphDirectory_param(op, &GlyphDirectory)) < 0
- )
- return code;
+ (code = font_GlyphDirectory_param(op, &GlyphDirectory)) < 0
+ )
+ return code;
code = build_gs_primitive_font(i_ctx_p, op, (gs_font_base **)ppfont,
- ftype, pstype, &build, options);
+ ftype, pstype, &build, options);
if (code != 0)
- return code;
+ return code;
pfont = *ppfont;
pdata = pfont_data(pfont);
ref_assign(&pdata->u.type42.sfnts, &sfnts);
@@ -82,7 +82,7 @@ build_gs_TrueType_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_type42 **ppfont,
pfont->is_resource = (options & bf_has_font_file ? true : false);
code = gs_type42_font_init(pfont, 0);
if (code < 0)
- return code;
+ return code;
pfont->procs.font_info = z42_font_info;
/*
* If the font has a GlyphDictionary, this replaces loca and glyf for
@@ -90,10 +90,10 @@ build_gs_TrueType_font(i_ctx_t *i_ctx_p, os_ptr op, gs_font_type42 **ppfont,
* get_outline and enumerate_glyph procedures.
*/
if (!r_has_type(&GlyphDirectory, t_null)) {
- pfont->data.get_outline = z42_gdir_get_outline;
- pfont->procs.enumerate_glyph = z42_gdir_enumerate_glyph;
+ pfont->data.get_outline = z42_gdir_get_outline;
+ pfont->procs.enumerate_glyph = z42_gdir_enumerate_glyph;
} else
- pfont->procs.enumerate_glyph = z42_enumerate_glyph;
+ pfont->procs.enumerate_glyph = z42_enumerate_glyph;
/*
* The procedures that access glyph information must accept either
* glyph names or glyph indexes.
@@ -111,11 +111,11 @@ zbuildfont42(i_ctx_t *i_ctx_p)
os_ptr op = osp;
gs_font_type42 *pfont;
int code = build_gs_TrueType_font(i_ctx_p, op, &pfont, ft_TrueType,
- &st_gs_font_type42, "%Type42BuildChar",
- "%Type42BuildGlyph", bf_options_none);
+ &st_gs_font_type42, "%Type42BuildChar",
+ "%Type42BuildGlyph", bf_options_none);
if (code < 0)
- return code;
+ return code;
return define_gs_font(i_ctx_p, (gs_font *)pfont);
}
@@ -131,16 +131,16 @@ font_string_array_param(const gs_memory_t *mem, os_ptr op, const char *kstr, ref
int code;
if (dict_find_string(op, kstr, &pvsa) <= 0)
- return_error(e_invalidfont);
+ return_error(e_invalidfont);
*psa = *pvsa;
/*
* We only check the first element of the array now, as a sanity test;
* elements are checked as needed by string_array_access_proc.
*/
if ((code = array_get(mem, pvsa, 0L, &rstr0)) < 0)
- return code;
+ return code;
if (!r_has_type(&rstr0, t_string))
- return_error(e_typecheck);
+ return_error(e_typecheck);
return 0;
}
@@ -154,11 +154,11 @@ font_GlyphDirectory_param(os_ptr op, ref *pGlyphDirectory)
ref *pgdir;
if (dict_find_string(op, "GlyphDirectory", &pgdir) <= 0)
- make_null(pGlyphDirectory);
+ make_null(pGlyphDirectory);
else if (!r_has_type(pgdir, t_dictionary) && !r_is_array(pgdir))
- return_error(e_typecheck);
+ return_error(e_typecheck);
else
- *pGlyphDirectory = *pgdir;
+ *pGlyphDirectory = *pgdir;
return 0;
}
@@ -166,14 +166,14 @@ font_GlyphDirectory_param(os_ptr op, ref *pGlyphDirectory)
* Access a given byte offset and length in an array of strings.
* This is used for sfnts and for CIDMap. The int argument is 2 for sfnts
* (because of the strange behavior of odd-length strings), 1 for CIDMap.
- * Return code : 0 - success, <0 - error,
+ * Return code : 0 - success, <0 - error,
* >0 - number of accessible bytes (client must cycle).
*/
int
-string_array_access_proc(const gs_memory_t *mem,
- const ref *psa, int modulus, ulong offset, uint length,
- uint *mru_index, ulong *mru_pos,
- const byte **pdata)
+string_array_access_proc(const gs_memory_t *mem,
+ const ref *psa, int modulus, ulong offset, uint length,
+ uint *mru_index, ulong *mru_pos,
+ const byte **pdata)
{
ulong left;
uint index;
@@ -182,61 +182,61 @@ string_array_access_proc(const gs_memory_t *mem,
if (length == 0)
return 0;
if (mru_index && mru_pos && offset >= (*mru_pos >> 1)) {
- /* offset in or after mru string */
- /* OR offset in 2nd half of the fragment before the mru string */
- backwards = (*mru_pos > offset);
- if (backwards) {
- index = *mru_index - 1; /* 1st string to examine */
- left = *mru_pos - offset; /* how many bytes to seek backwards */
- } else {
- index = *mru_index; /* 1st string to examine */
- left = offset - *mru_pos; /* how many bytes to seek forward */
- }
+ /* offset in or after mru string */
+ /* OR offset in 2nd half of the fragment before the mru string */
+ backwards = (*mru_pos > offset);
+ if (backwards) {
+ index = *mru_index - 1; /* 1st string to examine */
+ left = *mru_pos - offset; /* how many bytes to seek backwards */
+ } else {
+ index = *mru_index; /* 1st string to examine */
+ left = offset - *mru_pos; /* how many bytes to seek forward */
+ }
} else {
- /* no mru */
- /* OR offset in 1st half of the fragment before the mru string */
- backwards = false;
- index = 0;
- left = offset;
+ /* no mru */
+ /* OR offset in 1st half of the fragment before the mru string */
+ backwards = false;
+ index = 0;
+ left = offset;
}
for (;;) {
- ref rstr;
- int code = array_get(mem, psa, index, &rstr);
- uint size;
-
- if (code < 0)
- return code;
- if (!r_has_type(&rstr, t_string))
- return_error(e_typecheck);
- /*
- * NOTE: According to the Adobe documentation, each sfnts
- * string should have even length. If the length is odd,
- * the additional byte is padding and should be ignored.
- */
- size = r_size(&rstr) & -modulus;
- if (backwards) {
- if (left <= size) {
- left = size - left;
- backwards = false;
- /* "index" does not change */
- } else {
- left -= size;
- --index;
- continue;
- }
- }
- if (left < size) {
- *pdata = rstr.value.const_bytes + left;
- if (mru_index)
- *mru_index = index;
- if (mru_pos)
- *mru_pos = offset - left;
- if (left + length > size)
- return size - left;
- return 0;
- }
- left -= size;
- ++index;
+ ref rstr;
+ int code = array_get(mem, psa, index, &rstr);
+ uint size;
+
+ if (code < 0)
+ return code;
+ if (!r_has_type(&rstr, t_string))
+ return_error(e_typecheck);
+ /*
+ * NOTE: According to the Adobe documentation, each sfnts
+ * string should have even length. If the length is odd,
+ * the additional byte is padding and should be ignored.
+ */
+ size = r_size(&rstr) & -modulus;
+ if (backwards) {
+ if (left <= size) {
+ left = size - left;
+ backwards = false;
+ /* "index" does not change */
+ } else {
+ left -= size;
+ --index;
+ continue;
+ }
+ }
+ if (left < size) {
+ *pdata = rstr.value.const_bytes + left;
+ if (mru_index)
+ *mru_index = index;
+ if (mru_pos)
+ *mru_pos = offset - left;
+ if (left + length > size)
+ return size - left;
+ return 0;
+ }
+ left -= size;
+ ++index;
}
}
@@ -256,15 +256,15 @@ glyph_to_index(const gs_font *font, gs_glyph glyph)
ref *pcstr;
if (glyph >= GS_MIN_GLYPH_INDEX)
- return glyph;
+ return glyph;
name_index_ref(font->memory, glyph, &gref);
if (dict_find(&pfont_data(font)->CharStrings, &gref, &pcstr) > 0 &&
- r_has_type(pcstr, t_integer)
- ) {
- gs_glyph index_glyph = pcstr->value.intval + GS_MIN_GLYPH_INDEX;
+ r_has_type(pcstr, t_integer)
+ ) {
+ gs_glyph index_glyph = pcstr->value.intval + GS_MIN_GLYPH_INDEX;
- if (index_glyph >= GS_MIN_GLYPH_INDEX && index_glyph <= gs_max_glyph)
- return index_glyph;
+ if (index_glyph >= GS_MIN_GLYPH_INDEX && index_glyph <= gs_max_glyph)
+ return index_glyph;
}
return GS_MIN_GLYPH_INDEX; /* glyph 0 is notdef */
}
@@ -281,10 +281,10 @@ z42_get_glyph_index(gs_font_type42 *pfont, gs_glyph glyph)
* the glyph is missing or out of range.
*/
int
-font_gdir_get_outline(const gs_memory_t *mem,
- const ref *pgdir,
- long glyph_index,
- gs_glyph_data_t *pgd)
+font_gdir_get_outline(const gs_memory_t *mem,
+ const ref *pgdir,
+ long glyph_index,
+ gs_glyph_data_t *pgd)
{
ref iglyph;
ref gdef;
@@ -292,25 +292,25 @@ font_gdir_get_outline(const gs_memory_t *mem,
int code;
if (r_has_type(pgdir, t_dictionary)) {
- make_int(&iglyph, glyph_index);
- code = dict_find(pgdir, &iglyph, &pgdef) - 1; /* 0 => not found */
+ make_int(&iglyph, glyph_index);
+ code = dict_find(pgdir, &iglyph, &pgdef) - 1; /* 0 => not found */
} else {
- code = array_get(mem, pgdir, glyph_index, &gdef);
- pgdef = &gdef;
+ code = array_get(mem, pgdir, glyph_index, &gdef);
+ pgdef = &gdef;
}
if (code < 0) {
- gs_glyph_data_from_null(pgd);
+ gs_glyph_data_from_null(pgd);
} else if (!r_has_type(pgdef, t_string)) {
- return_error(e_typecheck);
+ return_error(e_typecheck);
} else {
- gs_glyph_data_from_string(pgd, pgdef->value.const_bytes, r_size(pgdef),
- NULL);
+ gs_glyph_data_from_string(pgd, pgdef->value.const_bytes, r_size(pgdef),
+ NULL);
}
return 0;
}
static int
z42_gdir_get_outline(gs_font_type42 * pfont, uint glyph_index,
- gs_glyph_data_t *pgd)
+ gs_glyph_data_t *pgd)
{
const font_data *pfdata = pfont_data(pfont);
const ref *pgdir = &pfdata->u.type42.GlyphDirectory;
@@ -321,47 +321,47 @@ z42_gdir_get_outline(gs_font_type42 * pfont, uint glyph_index,
/* Enumerate glyphs from CharStrings or loca / glyf. */
static int
z42_enumerate_glyph(gs_font *font, int *pindex, gs_glyph_space_t glyph_space,
- gs_glyph *pglyph)
+ gs_glyph *pglyph)
{
if (glyph_space == GLYPH_SPACE_INDEX)
- return gs_type42_enumerate_glyph(font, pindex, glyph_space, pglyph);
+ return gs_type42_enumerate_glyph(font, pindex, glyph_space, pglyph);
else {
- const ref *pcsdict = &pfont_data(font)->CharStrings;
+ const ref *pcsdict = &pfont_data(font)->CharStrings;
- return zchar_enumerate_glyph(font->memory, pcsdict, pindex, pglyph);
+ return zchar_enumerate_glyph(font->memory, pcsdict, pindex, pglyph);
}
}
/* Enumerate glyphs (keys) from GlyphDirectory instead of loca / glyf. */
static int
z42_gdir_enumerate_glyph(gs_font *font, int *pindex,
- gs_glyph_space_t glyph_space, gs_glyph *pglyph)
+ gs_glyph_space_t glyph_space, gs_glyph *pglyph)
{
const ref *pgdict;
int code;
if (glyph_space == GLYPH_SPACE_INDEX) {
- pgdict = &pfont_data(font)->u.type42.GlyphDirectory;
- if (!r_has_type(pgdict, t_dictionary)) {
- ref gdef;
-
- for (;; (*pindex)++) {
- if (array_get(font->memory, pgdict, (long)*pindex, &gdef) < 0) {
- *pindex = 0;
- return 0;
- }
- if (!r_has_type(&gdef, t_null)) {
- *pglyph = GS_MIN_GLYPH_INDEX + (*pindex)++;
- return 0;
- }
- }
- }
+ pgdict = &pfont_data(font)->u.type42.GlyphDirectory;
+ if (!r_has_type(pgdict, t_dictionary)) {
+ ref gdef;
+
+ for (;; (*pindex)++) {
+ if (array_get(font->memory, pgdict, (long)*pindex, &gdef) < 0) {
+ *pindex = 0;
+ return 0;
+ }
+ if (!r_has_type(&gdef, t_null)) {
+ *pglyph = GS_MIN_GLYPH_INDEX + (*pindex)++;
+ return 0;
+ }
+ }
+ }
} else
- pgdict = &pfont_data(font)->CharStrings;
+ pgdict = &pfont_data(font)->CharStrings;
/* A trick : use zchar_enumerate_glyph to enumerate GIDs : */
code = zchar_enumerate_glyph(font->memory, pgdict, pindex, pglyph);
if (*pindex != 0 && *pglyph >= gs_min_cid_glyph)
- *pglyph = *pglyph - gs_min_cid_glyph + GS_MIN_GLYPH_INDEX;
+ *pglyph = *pglyph - gs_min_cid_glyph + GS_MIN_GLYPH_INDEX;
return code;
}
@@ -375,18 +375,18 @@ z42_encode_char(gs_font *font, gs_char chr, gs_glyph_space_t glyph_space)
gs_glyph glyph = zfont_encode_char(font, chr, glyph_space);
return (glyph_space == GLYPH_SPACE_INDEX && glyph != gs_no_glyph ?
- glyph_to_index(font, glyph) : glyph);
+ glyph_to_index(font, glyph) : glyph);
}
static int
z42_glyph_outline(gs_font *font, int WMode, gs_glyph glyph, const gs_matrix *pmat,
- gx_path *ppath, double sbw[4])
+ gx_path *ppath, double sbw[4])
{
return gs_type42_glyph_outline(font, WMode, glyph_to_index(font, glyph),
- pmat, ppath, sbw);
+ pmat, ppath, sbw);
}
static int
z42_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
- int members, gs_glyph_info_t *info)
+ int members, gs_glyph_info_t *info)
{ /* fixme : same as z1_glyph_info. */
int wmode = font->WMode;
@@ -394,26 +394,25 @@ z42_glyph_info(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
}
/* Procedure for accessing the sfnts array.
- * Return code : 0 - success, <0 - error,
+ * Return code : 0 - success, <0 - error,
* >0 - number of accessible bytes (client must cycle).
*/
static int
z42_string_proc(gs_font_type42 * pfont, ulong offset, uint length,
- const byte ** pdata)
+ const byte ** pdata)
{
return string_array_access_proc(pfont->memory, &pfont_data(pfont)->u.type42.sfnts, 2,
- offset, length, &pfont_data(pfont)->u.type42.mru_sfnts_index,
- &pfont_data(pfont)->u.type42.mru_sfnts_pos, pdata);
+ offset, length, &pfont_data(pfont)->u.type42.mru_sfnts_index,
+ &pfont_data(pfont)->u.type42.mru_sfnts_pos, pdata);
}
static int
z42_font_info(gs_font *font, const gs_point *pscale, int members,
- gs_font_info_t *info)
+ gs_font_info_t *info)
{
int code = zfont_info(font, pscale, members, info);
if (code < 0)
- return code;
+ return code;
return gs_truetype_font_info(font, pscale, members, info);
}
-
diff --git a/gs/psi/zfontenum.c b/gs/psi/zfontenum.c
index 2f36f0ee8..578db2fc2 100644
--- a/gs/psi/zfontenum.c
+++ b/gs/psi/zfontenum.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,10 +32,9 @@
#include "store.h"
#include "gp.h"
-
typedef struct fontenum_s {
- char *fontname, *path;
- struct fontenum_s *next;
+ char *fontname, *path;
+ struct fontenum_s *next;
} fontenum_t;
/* .getnativefonts [ [<name> <path>] ... ] */
@@ -51,7 +50,7 @@ z_fontenum(i_ctx_t *i_ctx_p)
ref array;
uint length;
byte *string;
-
+
enum_state = gp_enumerate_fonts_init(imemory);
if (enum_state == NULL) {
/* put false on the stack and return */
@@ -63,68 +62,67 @@ z_fontenum(i_ctx_t *i_ctx_p)
r = results = gs_malloc(imemory->non_gc_memory, 1, sizeof(fontenum_t), "fontenum list");
elements = 0;
while((code = gp_enumerate_fonts_next(enum_state, &fontname, &path )) > 0) {
- if (fontname == NULL || path == NULL) {
- gp_enumerate_fonts_free(enum_state);
- return_error(e_ioerror);
- }
-
- length = strlen(fontname) + 1;
- r->fontname = gs_malloc(imemory->non_gc_memory, length, 1, "native font name");
- memcpy(r->fontname, fontname, length);
-
- length = strlen(path) + 1;
- r->path = gs_malloc(imemory->non_gc_memory, length, 1, "native font path");
- memcpy(r->path, path, length);
-
- r->next = gs_malloc(imemory->non_gc_memory, 1, sizeof(fontenum_t), "fontenum list");
- r = r->next;
- elements += 1;
- }
-
- gp_enumerate_fonts_free(enum_state);
-
- code = ialloc_ref_array(&array, a_all | icurrent_space, elements, "native fontmap");
-
- r = results;
- for (e = 0; e < elements; e++) {
- ref mapping;
-
- code = ialloc_ref_array(&mapping, a_all | icurrent_space, 2, "native font mapping");
-
- length = strlen(r->fontname);
- string = ialloc_string(length, "native font name");
- if (string == NULL)
- return_error(e_VMerror);
- memcpy(string, r->fontname, length);
- make_string(&(mapping.value.refs[0]), a_all | icurrent_space, length, string);
-
- length = strlen(r->path);
- string = ialloc_string(length, "native font path");
- if (string == NULL)
- return_error(e_VMerror);
- memcpy(string, r->path, length);
- make_string(&(mapping.value.refs[1]), a_all | icurrent_space, length, string);
-
- ref_assign(&(array.value.refs[e]), &mapping);
- results = r;
- r = r->next;
-
- gs_free(imemory->non_gc_memory,
- results->fontname, strlen(results->fontname) + 1, 1, "native font name");
- gs_free(imemory->non_gc_memory,
- results->path, strlen(results->path) + 1, 1, "native font path");
- gs_free(imemory->non_gc_memory,
- results, 1, sizeof(fontenum_t), "fontenum list");
- }
-
- push(2);
+ if (fontname == NULL || path == NULL) {
+ gp_enumerate_fonts_free(enum_state);
+ return_error(e_ioerror);
+ }
+
+ length = strlen(fontname) + 1;
+ r->fontname = gs_malloc(imemory->non_gc_memory, length, 1, "native font name");
+ memcpy(r->fontname, fontname, length);
+
+ length = strlen(path) + 1;
+ r->path = gs_malloc(imemory->non_gc_memory, length, 1, "native font path");
+ memcpy(r->path, path, length);
+
+ r->next = gs_malloc(imemory->non_gc_memory, 1, sizeof(fontenum_t), "fontenum list");
+ r = r->next;
+ elements += 1;
+ }
+
+ gp_enumerate_fonts_free(enum_state);
+
+ code = ialloc_ref_array(&array, a_all | icurrent_space, elements, "native fontmap");
+
+ r = results;
+ for (e = 0; e < elements; e++) {
+ ref mapping;
+
+ code = ialloc_ref_array(&mapping, a_all | icurrent_space, 2, "native font mapping");
+
+ length = strlen(r->fontname);
+ string = ialloc_string(length, "native font name");
+ if (string == NULL)
+ return_error(e_VMerror);
+ memcpy(string, r->fontname, length);
+ make_string(&(mapping.value.refs[0]), a_all | icurrent_space, length, string);
+
+ length = strlen(r->path);
+ string = ialloc_string(length, "native font path");
+ if (string == NULL)
+ return_error(e_VMerror);
+ memcpy(string, r->path, length);
+ make_string(&(mapping.value.refs[1]), a_all | icurrent_space, length, string);
+
+ ref_assign(&(array.value.refs[e]), &mapping);
+ results = r;
+ r = r->next;
+
+ gs_free(imemory->non_gc_memory,
+ results->fontname, strlen(results->fontname) + 1, 1, "native font name");
+ gs_free(imemory->non_gc_memory,
+ results->path, strlen(results->path) + 1, 1, "native font path");
+ gs_free(imemory->non_gc_memory,
+ results, 1, sizeof(fontenum_t), "fontenum list");
+ }
+
+ push(2);
ref_assign(op-1, &array);
make_bool(op, true);
-
+
return code;
}
-
/* Match the above routines to their postscript filter names.
This is how our static routines get called externally. */
const op_def zfontenum_op_defs[] = {
diff --git a/gs/psi/zfproc.c b/gs/psi/zfproc.c
index 6034aa952..9b9124907 100644
--- a/gs/psi/zfproc.c
+++ b/gs/psi/zfproc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -30,7 +30,7 @@
/* ---------------- Generic ---------------- */
/* GC procedures */
-static
+static
CLEAR_MARKS_PROC(sproc_clear_marks)
{
stream_proc_state *const pptr = vptr;
@@ -38,7 +38,7 @@ CLEAR_MARKS_PROC(sproc_clear_marks)
r_clear_attrs(&pptr->proc, l_mark);
r_clear_attrs(&pptr->data, l_mark);
}
-static
+static
ENUM_PTRS_WITH(sproc_enum_ptrs, stream_proc_state *pptr) return 0;
case 0:
ENUM_RETURN_REF(&pptr->proc);
@@ -59,18 +59,18 @@ private_st_stream_proc_state();
/* The caller must have checked that *sop is a procedure. */
static int
s_proc_init(ref * sop, stream ** psstrm, uint mode,
- const stream_template * temp, const stream_procs * procs,
- gs_ref_memory_t *imem)
+ const stream_template * temp, const stream_procs * procs,
+ gs_ref_memory_t *imem)
{
gs_memory_t *const mem = (gs_memory_t *)imem;
stream *sstrm = file_alloc_stream(mem, "s_proc_init(stream)");
stream_proc_state *state = (stream_proc_state *)
- s_alloc_state(mem, &st_sproc_state, "s_proc_init(state)");
+ s_alloc_state(mem, &st_sproc_state, "s_proc_init(state)");
if (sstrm == 0 || state == 0) {
- gs_free_object(mem, state, "s_proc_init(state)");
- /*gs_free_object(mem, sstrm, "s_proc_init(stream)"); *//* just leave it on the file list */
- return_error(e_VMerror);
+ gs_free_object(mem, state, "s_proc_init(state)");
+ /*gs_free_object(mem, sstrm, "s_proc_init(stream)"); *//* just leave it on the file list */
+ return_error(e_VMerror);
}
s_std_init(sstrm, NULL, 0, procs, mode);
sstrm->procs.process = temp->process;
@@ -90,19 +90,19 @@ s_proc_init(ref * sop, stream ** psstrm, uint mode,
/* but it is also associated with the interpreter stream machinery. */
static int
s_handle_intc(i_ctx_t *i_ctx_p, const ref *pstate, int nstate,
- op_proc_t cont)
+ op_proc_t cont)
{
int npush = nstate + 2;
check_estack(npush);
if (nstate)
- memcpy(esp + 2, pstate, nstate * sizeof(ref));
+ memcpy(esp + 2, pstate, nstate * sizeof(ref));
#if 0 /* **************** */
{
- int code = gs_interpret_error(e_interrupt, (ref *) (esp + npush));
+ int code = gs_interpret_error(e_interrupt, (ref *) (esp + npush));
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
}
#else /* **************** */
npush--;
@@ -144,11 +144,11 @@ int
sread_proc(ref * sop, stream ** psstrm, gs_ref_memory_t *imem)
{
int code =
- s_proc_init(sop, psstrm, s_mode_read, &s_proc_read_template,
- &s_proc_read_procs, imem);
+ s_proc_init(sop, psstrm, s_mode_read, &s_proc_read_template,
+ &s_proc_read_procs, imem);
if (code < 0)
- return code;
+ return code;
(*psstrm)->end_status = CALLC;
return code;
}
@@ -156,7 +156,7 @@ sread_proc(ref * sop, stream ** psstrm, gs_ref_memory_t *imem)
/* Handle an input request. */
static int
s_proc_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
/* Move data from the string returned by the procedure */
/* into the stream buffer, or ask for a callback. */
@@ -164,14 +164,14 @@ s_proc_read_process(stream_state * st, stream_cursor_read * ignore_pr,
uint count = r_size(&ss->data) - ss->index;
if (count > 0) {
- uint wcount = pw->limit - pw->ptr;
-
- if (wcount < count)
- count = wcount;
- memcpy(pw->ptr + 1, ss->data.value.bytes + ss->index, count);
- pw->ptr += count;
- ss->index += count;
- return 1;
+ uint wcount = pw->limit - pw->ptr;
+
+ if (wcount < count)
+ count = wcount;
+ memcpy(pw->ptr + 1, ss->data.value.bytes + ss->index, count);
+ pw->ptr += count;
+ ss->index += count;
+ return 1;
}
return (ss->eof ? EOFC : CALLC);
}
@@ -180,25 +180,25 @@ s_proc_read_process(stream_state * st, stream_cursor_read * ignore_pr,
/* whose buffer is empty. */
int
s_handle_read_exception(i_ctx_t *i_ctx_p, int status, const ref * fop,
- const ref * pstate, int nstate, op_proc_t cont)
+ const ref * pstate, int nstate, op_proc_t cont)
{
int npush = nstate + 4;
stream *ps;
switch (status) {
- case INTC:
- return s_handle_intc(i_ctx_p, pstate, nstate, cont);
- case CALLC:
- break;
- default:
- return_error(e_ioerror);
+ case INTC:
+ return s_handle_intc(i_ctx_p, pstate, nstate, cont);
+ case CALLC:
+ break;
+ default:
+ return_error(e_ioerror);
}
/* Find the stream whose buffer needs refilling. */
for (ps = fptr(fop); ps->strm != 0;)
- ps = ps->strm;
+ ps = ps->strm;
check_estack(npush);
if (nstate)
- memcpy(esp + 2, pstate, nstate * sizeof(ref));
+ memcpy(esp + 2, pstate, nstate * sizeof(ref));
make_op_estack(esp + 1, cont);
esp += npush;
make_op_estack(esp - 2, s_proc_read_continue);
@@ -222,12 +222,12 @@ s_proc_read_continue(i_ctx_t *i_ctx_p)
check_file(ps, op);
check_read_type(*opbuf, t_string);
while ((ps->end_status = 0, ps->strm) != 0)
- ps = ps->strm;
+ ps = ps->strm;
ss = (stream_proc_state *) ps->state;
ss->data = *opbuf;
ss->index = 0;
if (r_size(opbuf) == 0)
- ss->eof = true;
+ ss->eof = true;
pop(2);
return 0;
}
@@ -255,13 +255,13 @@ int
swrite_proc(ref * sop, stream ** psstrm, gs_ref_memory_t *imem)
{
return s_proc_init(sop, psstrm, s_mode_write, &s_proc_write_template,
- &s_proc_write_procs, imem);
+ &s_proc_write_procs, imem);
}
/* Handle an output request. */
static int
s_proc_write_process(stream_state * st, stream_cursor_read * pr,
- stream_cursor_write * ignore_pw, bool last)
+ stream_cursor_write * ignore_pw, bool last)
{
/* Move data from the stream buffer to the string */
/* returned by the procedure, or ask for a callback. */
@@ -270,19 +270,19 @@ s_proc_write_process(stream_state * st, stream_cursor_read * pr,
/* if 'last' return CALLC even when rcount == 0. ss->eof terminates */
if (rcount > 0 || (last && !ss->eof)) {
- uint wcount = r_size(&ss->data) - ss->index;
- uint count = min(rcount, wcount);
-
- memcpy(ss->data.value.bytes + ss->index, pr->ptr + 1, count);
- pr->ptr += count;
- ss->index += count;
- if (rcount > wcount)
- return CALLC;
- else if (last) {
- ss->eof = true;
- return CALLC;
- } else
- return 0;
+ uint wcount = r_size(&ss->data) - ss->index;
+ uint count = min(rcount, wcount);
+
+ memcpy(ss->data.value.bytes + ss->index, pr->ptr + 1, count);
+ pr->ptr += count;
+ ss->index += count;
+ if (rcount > wcount)
+ return CALLC;
+ else if (last) {
+ ss->eof = true;
+ return CALLC;
+ } else
+ return 0;
}
return ((ss->eof = last) ? EOFC : 0);
}
@@ -302,35 +302,35 @@ s_proc_write_flush(stream *s)
/* whose buffer is full. */
int
s_handle_write_exception(i_ctx_t *i_ctx_p, int status, const ref * fop,
- const ref * pstate, int nstate, op_proc_t cont)
+ const ref * pstate, int nstate, op_proc_t cont)
{
stream *ps;
stream_proc_state *psst;
switch (status) {
- case INTC:
- return s_handle_intc(i_ctx_p, pstate, nstate, cont);
- case CALLC:
- break;
- default:
- return_error(e_ioerror);
+ case INTC:
+ return s_handle_intc(i_ctx_p, pstate, nstate, cont);
+ case CALLC:
+ break;
+ default:
+ return_error(e_ioerror);
}
/* Find the stream whose buffer needs emptying. */
for (ps = fptr(fop); ps->strm != 0;)
- ps = ps->strm;
+ ps = ps->strm;
psst = (stream_proc_state *) ps->state;
{
- int npush = nstate + 6;
-
- check_estack(npush);
- if (nstate)
- memcpy(esp + 2, pstate, nstate * sizeof(ref));
- make_op_estack(esp + 1, cont);
- esp += npush;
- make_op_estack(esp - 4, s_proc_write_continue);
- esp[-3] = *fop;
- r_clear_attrs(esp - 3, a_executable);
- make_bool(esp - 1, !psst->eof);
+ int npush = nstate + 6;
+
+ check_estack(npush);
+ if (nstate)
+ memcpy(esp + 2, pstate, nstate * sizeof(ref));
+ make_op_estack(esp + 1, cont);
+ esp += npush;
+ make_op_estack(esp - 4, s_proc_write_continue);
+ esp[-3] = *fop;
+ r_clear_attrs(esp - 3, a_executable);
+ make_bool(esp - 1, !psst->eof);
}
esp[-2] = psst->proc;
*esp = psst->data;
@@ -352,9 +352,9 @@ s_proc_write_continue(i_ctx_t *i_ctx_p)
check_file(ps, op);
check_write_type(*opbuf, t_string);
while (ps->strm != 0) {
- if (ps->end_status == CALLC)
- ps->end_status = 0;
- ps = ps->strm;
+ if (ps->end_status == CALLC)
+ ps->end_status = 0;
+ ps = ps->strm;
}
ps->end_status = 0;
ss = (stream_proc_state *) ps->state;
@@ -371,14 +371,14 @@ bool
s_is_proc(const stream *s)
{
return (s->procs.process == s_proc_read_process ||
- s->procs.process == s_proc_write_process);
+ s->procs.process == s_proc_write_process);
}
/* ------ Initialization procedure ------ */
const op_def zfproc_op_defs[] =
{
- /* Internal operators */
+ /* Internal operators */
{"2%s_proc_read_continue", s_proc_read_continue},
{"2%s_proc_write_continue", s_proc_write_continue},
op_def_end(0)
diff --git a/gs/psi/zfrsd.c b/gs/psi/zfrsd.c
index 4aac9e7a2..09890b4c2 100644
--- a/gs/psi/zfrsd.c
+++ b/gs/psi/zfrsd.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -54,56 +54,56 @@ zrsdparams(i_ctx_t *i_ctx_p)
make_empty_array(&empty_array, a_readonly);
if (dict_find_string(op, "Filter", &pFilter) > 0) {
- if (!r_is_array(pFilter)) {
- if (!r_has_type(pFilter, t_name))
- return_error(e_typecheck);
- make_array(&filter1_array, a_readonly, 1, pFilter);
- pFilter = &filter1_array;
- }
+ if (!r_is_array(pFilter)) {
+ if (!r_has_type(pFilter, t_name))
+ return_error(e_typecheck);
+ make_array(&filter1_array, a_readonly, 1, pFilter);
+ pFilter = &filter1_array;
+ }
} else
- pFilter = &empty_array;
+ pFilter = &empty_array;
/* If Filter is undefined, ignore DecodeParms. */
if (pFilter != &empty_array &&
- dict_find_string(op, "DecodeParms", &pDecodeParms) > 0
- ) {
- if (pFilter == &filter1_array) {
- make_array(&parms1_array, a_readonly, 1, pDecodeParms);
- pDecodeParms = &parms1_array;
- } else if (!r_is_array(pDecodeParms))
- return_error(e_typecheck);
- else if (r_size(pFilter) != r_size(pDecodeParms))
- return_error(e_rangecheck);
+ dict_find_string(op, "DecodeParms", &pDecodeParms) > 0
+ ) {
+ if (pFilter == &filter1_array) {
+ make_array(&parms1_array, a_readonly, 1, pDecodeParms);
+ pDecodeParms = &parms1_array;
+ } else if (!r_is_array(pDecodeParms))
+ return_error(e_typecheck);
+ else if (r_size(pFilter) != r_size(pDecodeParms))
+ return_error(e_rangecheck);
} else
- pDecodeParms = 0;
+ pDecodeParms = 0;
for (i = 0; i < r_size(pFilter); ++i) {
- ref f, fname, dp;
-
- array_get(imemory, pFilter, (long)i, &f);
- if (!r_has_type(&f, t_name))
- return_error(e_typecheck);
- name_string_ref(imemory, &f, &fname);
- if (r_size(&fname) < 6 ||
- memcmp(fname.value.bytes + r_size(&fname) - 6, "Decode", 6)
- )
- return_error(e_rangecheck);
- if (pDecodeParms) {
- array_get(imemory, pDecodeParms, (long)i, &dp);
- if (!(r_has_type(&dp, t_dictionary) || r_has_type(&dp, t_null)))
- return_error(e_typecheck);
- }
+ ref f, fname, dp;
+
+ array_get(imemory, pFilter, (long)i, &f);
+ if (!r_has_type(&f, t_name))
+ return_error(e_typecheck);
+ name_string_ref(imemory, &f, &fname);
+ if (r_size(&fname) < 6 ||
+ memcmp(fname.value.bytes + r_size(&fname) - 6, "Decode", 6)
+ )
+ return_error(e_rangecheck);
+ if (pDecodeParms) {
+ array_get(imemory, pDecodeParms, (long)i, &dp);
+ if (!(r_has_type(&dp, t_dictionary) || r_has_type(&dp, t_null)))
+ return_error(e_typecheck);
+ }
}
code = dict_int_param(op, "Intent", 0, 3, 0, &Intent);
if (code < 0 && code != e_rangecheck) /* out-of-range int is ok, use 0 */
- return code;
+ return code;
if ((code = dict_bool_param(op, "AsyncRead", false, &AsyncRead)) < 0
- )
- return code;
+ )
+ return code;
push(1);
op[-1] = *pFilter;
if (pDecodeParms)
- *op = *pDecodeParms;
+ *op = *pDecodeParms;
else
- make_null(op);
+ make_null(op);
return 0;
}
@@ -120,7 +120,7 @@ zrsdparams(i_ctx_t *i_ctx_p)
* ordinary file or string streams.
*/
static int make_rfs(i_ctx_t *i_ctx_p, os_ptr op, stream *fs,
- long offset, long length);
+ long offset, long length);
static int make_aos(i_ctx_t *i_ctx_p, os_ptr op,
int blk_sz, int blk_sz_last, unsigned int file_sz);
@@ -137,28 +137,28 @@ zreusablestream(i_ctx_t *i_ctx_p)
check_type(*op, t_boolean);
close_source = op->value.boolval;
if (r_has_type(source_op, t_string)) {
- uint size = r_size(source_op);
+ uint size = r_size(source_op);
- check_read(*source_op);
- code = make_rss(i_ctx_p, source_op, source_op->value.const_bytes,
- size, r_space(source_op), 0L, size, false);
+ check_read(*source_op);
+ code = make_rss(i_ctx_p, source_op, source_op->value.const_bytes,
+ size, r_space(source_op), 0L, size, false);
} else if (r_has_type(source_op, t_astruct)) {
- uint size = gs_object_size(imemory, source_op->value.pstruct);
-
- if (gs_object_type(imemory, source_op->value.pstruct) != &st_bytes)
- return_error(e_rangecheck);
- check_read(*source_op);
- code = make_rss(i_ctx_p, source_op,
- (const byte *)source_op->value.pstruct, size,
- r_space(source_op), 0L, size, true);
+ uint size = gs_object_size(imemory, source_op->value.pstruct);
+
+ if (gs_object_type(imemory, source_op->value.pstruct) != &st_bytes)
+ return_error(e_rangecheck);
+ check_read(*source_op);
+ code = make_rss(i_ctx_p, source_op,
+ (const byte *)source_op->value.pstruct, size,
+ r_space(source_op), 0L, size, true);
} else if (r_has_type(source_op, t_array)) { /* no packedarrays */
- int i, blk_cnt, blk_sz;
+ int i, blk_cnt, blk_sz;
ref *blk_ref;
ulong filelen = 0;
check_read(*source_op);
blk_cnt = r_size(source_op);
- blk_ref = source_op->value.refs;
+ blk_ref = source_op->value.refs;
if (blk_cnt > 0) {
blk_sz = r_size(blk_ref);
for (i = 0; i < blk_cnt; i++) {
@@ -173,66 +173,66 @@ zreusablestream(i_ctx_t *i_ctx_p)
}
if (filelen == 0) {
code = make_rss(i_ctx_p, source_op, (unsigned char *)"", 0,
- r_space(source_op), 0, 0, false);
+ r_space(source_op), 0, 0, false);
} else {
code = make_aos(i_ctx_p, source_op, blk_sz, r_size(&blk_ref[blk_cnt - 1]), filelen);
}
} else {
- long offset = 0;
- stream *source;
- stream *s;
+ long offset = 0;
+ stream *source;
+ stream *s;
- check_read_file(i_ctx_p, source, source_op);
- s = source;
+ check_read_file(i_ctx_p, source, source_op);
+ s = source;
rs:
- if (s->cbuf_string.data != 0) { /* string stream */
- long pos = stell(s);
- long avail = sbufavailable(s) + pos;
-
- offset += pos;
- code = make_rss(i_ctx_p, source_op, s->cbuf_string.data,
- s->cbuf_string.size,
- imemory_space((const gs_ref_memory_t *)s->memory),
- offset, min(avail, length), false);
- } else if (s->file != 0) { /* file stream */
- if (~s->modes & (s_mode_read | s_mode_seek))
- return_error(e_ioerror);
- code = make_rfs(i_ctx_p, source_op, s, offset + stell(s), length);
- } else if (s->state->template == &s_SFD_template) {
- /* SubFileDecode filter */
- const stream_SFD_state *const sfd_state =
- (const stream_SFD_state *)s->state;
-
- if (sfd_state->eod.size != 0)
- return_error(e_rangecheck);
- offset += sfd_state->skip_count - sbufavailable(s);
- if (sfd_state->count != 0) {
- long left = max(sfd_state->count, 0) + sbufavailable(s);
-
- if (left < length)
- length = left;
- }
- s = s->strm;
- goto rs;
- }
- else /* some other kind of stream */
- return_error(e_rangecheck);
- if (close_source) {
- stream *rs = fptr(source_op);
-
- rs->strm = source; /* only for close_source */
- rs->close_strm = true;
- }
+ if (s->cbuf_string.data != 0) { /* string stream */
+ long pos = stell(s);
+ long avail = sbufavailable(s) + pos;
+
+ offset += pos;
+ code = make_rss(i_ctx_p, source_op, s->cbuf_string.data,
+ s->cbuf_string.size,
+ imemory_space((const gs_ref_memory_t *)s->memory),
+ offset, min(avail, length), false);
+ } else if (s->file != 0) { /* file stream */
+ if (~s->modes & (s_mode_read | s_mode_seek))
+ return_error(e_ioerror);
+ code = make_rfs(i_ctx_p, source_op, s, offset + stell(s), length);
+ } else if (s->state->template == &s_SFD_template) {
+ /* SubFileDecode filter */
+ const stream_SFD_state *const sfd_state =
+ (const stream_SFD_state *)s->state;
+
+ if (sfd_state->eod.size != 0)
+ return_error(e_rangecheck);
+ offset += sfd_state->skip_count - sbufavailable(s);
+ if (sfd_state->count != 0) {
+ long left = max(sfd_state->count, 0) + sbufavailable(s);
+
+ if (left < length)
+ length = left;
+ }
+ s = s->strm;
+ goto rs;
+ }
+ else /* some other kind of stream */
+ return_error(e_rangecheck);
+ if (close_source) {
+ stream *rs = fptr(source_op);
+
+ rs->strm = source; /* only for close_source */
+ rs->close_strm = true;
+ }
}
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
/* Make a reusable string stream. */
int
make_rss(i_ctx_t *i_ctx_p, os_ptr op, const byte * data, uint size,
- uint string_space, long offset, long length, bool is_bytestring)
+ uint string_space, long offset, long length, bool is_bytestring)
{
uint save_space = icurrent_space;
stream *s;
@@ -242,10 +242,10 @@ make_rss(i_ctx_t *i_ctx_p, os_ptr op, const byte * data, uint size,
s = file_alloc_stream(imemory, "make_rss");
ialloc_set_space(idmemory, save_space);
if (s == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
sread_string_reusable(s, data + offset, max(left, 0));
if (is_bytestring)
- s->cbuf_string.data = 0; /* byte array, not string */
+ s->cbuf_string.data = 0; /* byte array, not string */
make_stream_file(op, s, "r");
return 0;
}
@@ -262,24 +262,24 @@ make_rfs(i_ctx_t *i_ctx_p, os_ptr op, stream *fs, long offset, long length)
int code;
if (sfilename(fs, &fname) < 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
code = gs_parse_file_name(&pname, (const char *)fname.data, fname.size,
imemory);
if (code < 0)
- return code;
+ return code;
if (pname.len == 0) /* %stdin% etc. won't have a filename */
- return_error(e_invalidfileaccess); /* can't reopen */
+ return_error(e_invalidfileaccess); /* can't reopen */
if (pname.iodev == NULL)
- pname.iodev = iodev_default(imemory);
+ pname.iodev = iodev_default(imemory);
/* Open the file again, to be independent of the source. */
ialloc_set_space(idmemory, stream_space);
code = zopen_file(i_ctx_p, &pname, "r", &s, imemory);
ialloc_set_space(idmemory, save_space);
if (code < 0)
- return code;
+ return code;
if (sread_subfile(s, offset, length) < 0) {
- sclose(s);
- return_error(e_ioerror);
+ sclose(s);
+ return_error(e_ioerror);
}
s->close_at_eod = false;
make_stream_file(op, s, "r");
@@ -293,26 +293,26 @@ static void s_aos_reset(stream *s);
static int s_aos_flush(stream *s);
static int s_aos_close(stream *);
static int s_aos_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
/* Stream state */
typedef struct aos_state_s {
stream_state_common;
ref blocks;
- stream *s;
+ stream *s;
int blk_sz;
int blk_sz_last;
- uint file_sz;
+ uint file_sz;
} aos_state_t;
/* GC procedures */
-static
+static
CLEAR_MARKS_PROC(aos_clear_marks)
{ aos_state_t *const pptr = vptr;
r_clear_attrs(&pptr->blocks, l_mark);
}
-static
+static
ENUM_PTRS_WITH(aos_enum_ptrs, aos_state_t *pptr) return 0;
ENUM_PTR(0, aos_state_t, s);
case 1:
@@ -328,11 +328,11 @@ gs_private_st_complex_only(st_aos_state, aos_state_t,
"aos_state", aos_clear_marks, aos_enum_ptrs, aos_reloc_ptrs, 0);
/* Stream template */
-static const stream_template s_aos_template = {
+static const stream_template s_aos_template = {
&st_aos_state, 0, s_aos_process, 1, 1, 0, 0 };
/* Stream procs */
-static const stream_procs s_aos_procs = {
+static const stream_procs s_aos_procs = {
s_aos_available, s_aos_seek, s_aos_reset,
s_aos_flush, s_aos_close, s_aos_process,
NULL /* no s_aos_switch */
@@ -347,7 +347,7 @@ make_aos(i_ctx_t *i_ctx_p, os_ptr op, int blk_sz, int blk_sz_last, uint file_sz)
const int aos_buf_size = 1024; /* arbitrary */
uint save_space = icurrent_space;
ialloc_set_space(idmemory, r_space(op));
-
+
s = s_alloc(imemory, "aos_stream");
ss = (aos_state_t *)s_alloc_state(imemory, &st_aos_state, "st_aos_state");
buf = gs_alloc_bytes(imemory, aos_buf_size, "aos_stream_buf");
@@ -391,11 +391,11 @@ s_aos_seek(register stream * s, long pos)
long offset = pos - s->position;
if (offset >= 0 && offset <= end) { /* Staying within the same buffer */
- s->srptr = s->cbuf + offset - 1;
- return 0;
+ s->srptr = s->cbuf + offset - 1;
+ return 0;
}
if (pos < 0 || pos > s->file_limit)
- return ERRC;
+ return ERRC;
s->srptr = s->srlimit = s->cbuf - 1;
s->end_status = 0;
s->position = pos;
@@ -407,7 +407,7 @@ s_aos_reset(stream *s)
{
/* PLRM definition of reset operator is strange. */
/* Rewind the file and discard the buffer. */
- s->position = 0;
+ s->position = 0;
s->srptr = s->srlimit = s->cbuf - 1;
s->end_status = 0;
}
@@ -432,7 +432,7 @@ s_aos_close(stream * s)
static int
s_aos_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
int blk_i, blk_off, blk_cnt, status = 1;
uint count;
@@ -444,7 +444,7 @@ s_aos_process(stream_state * st, stream_cursor_read * ignore_pr,
pos += sbufavailable(ss->s);
if (pos >= ss->file_sz)
- return EOFC;
+ return EOFC;
blk_i = pos / ss->blk_sz;
blk_off = pos % ss->blk_sz;
blk_cnt = r_size(&ss->blocks);
@@ -455,7 +455,7 @@ s_aos_process(stream_state * st, stream_cursor_read * ignore_pr,
if (max_count > count - blk_off) {
max_count = count - blk_off;
if (blk_i == blk_cnt - 1)
- status = EOFC;
+ status = EOFC;
}
memcpy(pw->ptr+1, data + blk_off, max_count);
pw->ptr += max_count;
diff --git a/gs/psi/zfrsd.h b/gs/psi/zfrsd.h
index 1d7e0bd15..97536d5d2 100644
--- a/gs/psi/zfrsd.h
+++ b/gs/psi/zfrsd.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -25,7 +25,7 @@ make_rss(i_ctx_t *i_ctx_p, os_ptr op, const byte * data, uint size,
#endif /* zfrsd_INCLUDED */
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zfsample.c b/gs/psi/zfsample.c
index ac37e63d9..232cd02c8 100644
--- a/gs/psi/zfsample.c
+++ b/gs/psi/zfsample.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -58,25 +58,23 @@ struct gs_sampled_data_enum_s {
typedef struct gs_sampled_data_enum_s gs_sampled_data_enum;
-
gs_private_st_ptrs1(st_gs_sampled_data_enum, gs_sampled_data_enum,
- "gs_sampled_data_enum", gs_sampled_data_enum_enum_ptrs,
- gs_sampled_data_enum_reloc_ptrs, pfn);
-
+ "gs_sampled_data_enum", gs_sampled_data_enum_enum_ptrs,
+ gs_sampled_data_enum_reloc_ptrs, pfn);
/* Forward references */
static int cube_build_func0(const ref * pdict,
- gs_function_Sd_params_t * params, gs_memory_t *mem);
+ gs_function_Sd_params_t * params, gs_memory_t *mem);
static int sampled_data_setup(i_ctx_t *i_ctx_p, gs_function_t *pfn,
- const ref * pproc, int (*finish_proc)(i_ctx_t *),
- gs_memory_t * mem);
+ const ref * pproc, int (*finish_proc)(i_ctx_t *),
+ gs_memory_t * mem);
static int sampled_data_sample(i_ctx_t *i_ctx_p);
static int sampled_data_continue(i_ctx_t *i_ctx_p);
static int sampled_data_finish(i_ctx_t *i_ctx_p);
static gs_sampled_data_enum * gs_sampled_data_enum_alloc
- (gs_memory_t * mem, client_name_t cname);
+ (gs_memory_t * mem, client_name_t cname);
/*
* Collect data for a type 0 (sampled data) function
@@ -102,18 +100,18 @@ zbuildsampledfunction(i_ctx_t *i_ctx_p)
gs_function_Sd_params_t params = {0};
check_type(*pdict, t_dictionary);
- /*
+ /*
* Check procedure to be sampled.
*/
if (dict_find_string(pdict, "Function", &pfunc) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
check_proc(*pfunc);
/*
* Set up the hyper cube function data structure.
*/
code = cube_build_func0(pdict, &params, imemory);
if (code < 0)
- return code;
+ return code;
/*
* This is temporary. We will call gs_function_Sd_init again after
* we have collected the cube data. We are doing it now because we need
@@ -124,7 +122,7 @@ zbuildsampledfunction(i_ctx_t *i_ctx_p)
*/
code = gs_function_Sd_init(&pfn, &params, imemory);
if (code < 0)
- return code;
+ return code;
/*
* Now setup to collect the sample data.
*/
@@ -133,7 +131,6 @@ zbuildsampledfunction(i_ctx_t *i_ctx_p)
/* ------- Internal procedures ------- */
-
#define bits2bytes(x) ((x) >> 3) /* Convert bit count to byte count */
/*
@@ -146,9 +143,9 @@ valid_cube_size(int num_inputs, int num_outputs, int sample_size, const int Size
int i, total_size = num_outputs * sample_size;
for (i = 0; i < num_inputs; i++) {
- if (Size[i] <= 0 || Size[i] > MAX_DATA_SIZE / total_size)
- return false;
- total_size *= Size[i];
+ if (Size[i] <= 0 || Size[i] > MAX_DATA_SIZE / total_size)
+ return false;
+ total_size *= Size[i];
}
return true;
}
@@ -169,16 +166,16 @@ valid_cube_size(int num_inputs, int num_outputs, int sample_size, const int Size
*/
static int
determine_sampled_data_size(int num_inputs, int num_outputs,
- int sample_size, int Size[])
+ int sample_size, int Size[])
{
static const int size_list[] = {512, 50, 20, 10, 7, 5, 4, 3};
int i, size;
/* Start with initial guess at cube size */
if (num_inputs > 0 && num_inputs <= 8)
- size = size_list[num_inputs - 1];
+ size = size_list[num_inputs - 1];
else
- size = 2;
+ size = 2;
/*
* Verify that the cube will fit into MAX_DATA_SIZE. If not then
* decrement the cube size until it will fit.
@@ -188,16 +185,15 @@ determine_sampled_data_size(int num_inputs, int num_outputs,
for (i = 0; i < num_inputs; i++)
Size[i] = size;
- if (valid_cube_size(num_inputs, num_outputs, sample_size, Size))
- return 0; /* We have a valid size */
+ if (valid_cube_size(num_inputs, num_outputs, sample_size, Size))
+ return 0; /* We have a valid size */
- if (size == 2) /* Cannot have less than 2 points per side */
- return_error(e_rangecheck);
- size--;
+ if (size == 2) /* Cannot have less than 2 points per side */
+ return_error(e_rangecheck);
+ size--;
}
}
-
/*
* Allocate the enumerator used while collecting sampled data. This enumerator
* is used to hold the various state data required while sampling.
@@ -206,7 +202,7 @@ static gs_sampled_data_enum *
gs_sampled_data_enum_alloc(gs_memory_t * mem, client_name_t cname)
{
return gs_alloc_struct(mem, gs_sampled_data_enum,
- &st_gs_sampled_data_enum, cname);
+ &st_gs_sampled_data_enum, cname);
}
/*
@@ -220,11 +216,11 @@ cube_ptr_from_index(gs_function_Sd_params_t * params, int indexes[])
int i, sum = indexes[params->m - 1];
for (i = params->m - 2; i >= 0; i--) {
- sum *= params->Size[i];
- sum += indexes[i];
+ sum *= params->Size[i];
+ sum += indexes[i];
}
- return (byte *)(params->DataSource.data.str.data) +
- sum * params->n * bits2bytes(params->BitsPerSample);
+ return (byte *)(params->DataSource.data.str.data) +
+ sum * params->n * bits2bytes(params->BitsPerSample);
}
/*
@@ -238,29 +234,29 @@ increment_cube_indexes(gs_function_Sd_params_t * params, int indexes[])
int i = 0;
while (true) {
- /*
- * Increment an index value for an edge and test if we have
- * gone past the final value for the edge.
- */
- indexes[i]++;
- if (indexes[i] < params->Size[i])
- /*
- * We have not reached the end of the edge. Exit but
- * indicate that we are not done with the hypercube.
- */
- return false;
- /*
- * We have reached the end of one edge of the hypercube and we
- * need to increment the next index.
- */
- indexes[i] = 0;
- i++;
- if (i == params->m)
- /*
- * We have finished the last edge of the hyper cube.
- * We are done.
- */
- return true;
+ /*
+ * Increment an index value for an edge and test if we have
+ * gone past the final value for the edge.
+ */
+ indexes[i]++;
+ if (indexes[i] < params->Size[i])
+ /*
+ * We have not reached the end of the edge. Exit but
+ * indicate that we are not done with the hypercube.
+ */
+ return false;
+ /*
+ * We have reached the end of one edge of the hypercube and we
+ * need to increment the next index.
+ */
+ indexes[i] = 0;
+ i++;
+ if (i == params->m)
+ /*
+ * We have finished the last edge of the hyper cube.
+ * We are done.
+ */
+ return true;
}
}
@@ -272,23 +268,23 @@ increment_cube_indexes(gs_function_Sd_params_t * params, int indexes[])
*/
static int
cube_build_func0(const ref * pdict, gs_function_Sd_params_t * params,
- gs_memory_t *mem)
+ gs_memory_t *mem)
{
byte * bytes = 0;
int code, i;
int total_size;
if ((code = dict_int_param(pdict, "Order", 1, 3, 1, &params->Order)) < 0 ||
- (code = dict_int_param(pdict, "BitsPerSample", 1, 32, 0,
- &params->BitsPerSample)) < 0 ||
- ((code = params->m =
- fn_build_float_array(pdict, "Domain", false, true,
- &params->Domain, mem)) < 0 ) ||
- ((code = params->n =
- fn_build_float_array(pdict, "Range", false, true,
- &params->Range, mem)) < 0)
- ) {
- goto fail;
+ (code = dict_int_param(pdict, "BitsPerSample", 1, 32, 0,
+ &params->BitsPerSample)) < 0 ||
+ ((code = params->m =
+ fn_build_float_array(pdict, "Domain", false, true,
+ &params->Domain, mem)) < 0 ) ||
+ ((code = params->n =
+ fn_build_float_array(pdict, "Range", false, true,
+ &params->Range, mem)) < 0)
+ ) {
+ goto fail;
}
/*
* The previous logic set the size of m and n to the size of the Domain
@@ -299,7 +295,7 @@ cube_build_func0(const ref * pdict, gs_function_Sd_params_t * params,
params->n >>= 1;
if (params->m == 0 || params->n == 0 ||
params->m > MAX_NUM_INPUTS || params->n > MAX_NUM_OUTPUTS) {
- code = gs_note_error(e_rangecheck);
+ code = gs_note_error(e_rangecheck);
goto fail;
}
/*
@@ -307,50 +303,50 @@ cube_build_func0(const ref * pdict, gs_function_Sd_params_t * params,
* we need to determine a set of default values for the Size array.
*/
{
- int *ptr = (int *)
- gs_alloc_byte_array(mem, params->m, sizeof(int), "Size");
-
- if (ptr == NULL) {
- code = gs_note_error(e_VMerror);
- goto fail;
- }
- params->Size = ptr;
- code = dict_ints_param(mem, pdict, "Size", params->m, ptr);
+ int *ptr = (int *)
+ gs_alloc_byte_array(mem, params->m, sizeof(int), "Size");
+
+ if (ptr == NULL) {
+ code = gs_note_error(e_VMerror);
+ goto fail;
+ }
+ params->Size = ptr;
+ code = dict_ints_param(mem, pdict, "Size", params->m, ptr);
if (code < 0)
- goto fail;
+ goto fail;
if (code == 0) {
- /*
- * The Size array has not been specified. Determine a default
- * set of values.
- */
+ /*
+ * The Size array has not been specified. Determine a default
+ * set of values.
+ */
code = determine_sampled_data_size(params->m, params->n,
- params->BitsPerSample, (int *)params->Size);
+ params->BitsPerSample, (int *)params->Size);
if (code < 0)
- goto fail;
+ goto fail;
+ }
+ else { /* Size array specified - verify valid */
+ if (code != params->m || !valid_cube_size(params->m, params->n,
+ params->BitsPerSample, params->Size))
+ code = gs_note_error(e_rangecheck);
+ goto fail;
}
- else { /* Size array specified - verify valid */
- if (code != params->m || !valid_cube_size(params->m, params->n,
- params->BitsPerSample, params->Size))
- code = gs_note_error(e_rangecheck);
- goto fail;
- }
}
/*
* Determine space required for the sample data storage.
*/
total_size = params->n * bits2bytes(params->BitsPerSample);
for (i = 0; i < params->m; i++)
- total_size *= params->Size[i];
+ total_size *= params->Size[i];
/*
* Allocate space for the data cube itself.
*/
bytes = gs_alloc_byte_array(mem, total_size, 1, "cube_build_func0(bytes)");
if (!bytes) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
data_source_init_bytes(&params->DataSource,
- (const unsigned char *)bytes, total_size);
+ (const unsigned char *)bytes, total_size);
return 0;
@@ -389,7 +385,7 @@ fail:
*/
static int
sampled_data_setup(i_ctx_t *i_ctx_p, gs_function_t *pfn,
- const ref * pproc, int (*finish_proc)(i_ctx_t *), gs_memory_t * mem)
+ const ref * pproc, int (*finish_proc)(i_ctx_t *), gs_memory_t * mem)
{
os_ptr op = osp;
gs_sampled_data_enum *penum;
@@ -405,7 +401,7 @@ sampled_data_setup(i_ctx_t *i_ctx_p, gs_function_t *pfn,
*/
penum = gs_sampled_data_enum_alloc(imemory, "zbuildsampledfuntion(params)");
if (penum == NULL)
- return_error(e_VMerror);
+ return_error(e_VMerror);
/* Initialize data in the enumeration structure */
@@ -426,7 +422,7 @@ sampled_data_setup(i_ctx_t *i_ctx_p, gs_function_t *pfn,
*/
push(O_STACK_PAD);
for (i = 0; i < O_STACK_PAD; i++) /* Set space = null */
- make_null(op - i);
+ make_null(op - i);
/* Push everything on the estack */
@@ -448,18 +444,18 @@ sampled_data_sample(i_ctx_t *i_ctx_p)
gs_sampled_data_enum *penum = senum;
ref proc;
gs_function_Sd_params_t * params =
- (gs_function_Sd_params_t *)&penum->pfn->params;
+ (gs_function_Sd_params_t *)&penum->pfn->params;
int num_inputs = params->m;
int i;
/* Put set of input values onto the stack. */
push(num_inputs);
for (i = 0; i < num_inputs; i++) {
- double dmin = params->Domain[2 * i];
- double dmax = params->Domain[2 * i + 1];
+ double dmin = params->Domain[2 * i];
+ double dmax = params->Domain[2 * i + 1];
- make_real(op - num_inputs + i + 1, (float) (
- penum->indexes[i] * (dmax - dmin)/(params->Size[i] - 1) + dmin));
+ make_real(op - num_inputs + i + 1, (float) (
+ penum->indexes[i] * (dmax - dmin)/(params->Size[i] - 1) + dmin));
}
proc = sample_proc; /* Get procedure from storage */
@@ -468,7 +464,7 @@ sampled_data_sample(i_ctx_t *i_ctx_p)
return o_push_estack;
}
-/*
+/*
* Continuation procedure for processing sampled values.
*/
static int
@@ -477,7 +473,7 @@ sampled_data_continue(i_ctx_t *i_ctx_p)
os_ptr op = osp;
gs_sampled_data_enum *penum = senum;
gs_function_Sd_params_t * params =
- (gs_function_Sd_params_t *)&penum->pfn->params;
+ (gs_function_Sd_params_t *)&penum->pfn->params;
int i, j, num_out = params->n;
int code = 0;
byte * data_ptr;
@@ -489,67 +485,67 @@ sampled_data_continue(i_ctx_t *i_ctx_p)
* values. If not, move the stack back to where it belongs and abort
*/
if (num_out + O_STACK_PAD + penum->o_stack_depth != ref_stack_count(&o_stack)) {
- stack_depth_adjust = ref_stack_count(&o_stack) - penum->o_stack_depth;
-
- if (stack_depth_adjust < 0) {
- /*
- * If we get to here then there were major problems. The function
- * removed too many items off of the stack. We had placed extra
- * (unused) stack stack space to allow for this but the function
- * exceeded even that. Data on the stack may have been lost.
- * The only thing that we can do is move the stack pointer back and
- * hope. (We have not seen real Postscript files that have this
- * problem.)
- */
- push(-stack_depth_adjust);
- ifree_object(penum->pfn, "sampled_data_continue(pfn)");
- ifree_object(penum, "sampled_data_continue((enum)");
- return_error(e_undefinedresult);
- }
+ stack_depth_adjust = ref_stack_count(&o_stack) - penum->o_stack_depth;
+
+ if (stack_depth_adjust < 0) {
+ /*
+ * If we get to here then there were major problems. The function
+ * removed too many items off of the stack. We had placed extra
+ * (unused) stack stack space to allow for this but the function
+ * exceeded even that. Data on the stack may have been lost.
+ * The only thing that we can do is move the stack pointer back and
+ * hope. (We have not seen real Postscript files that have this
+ * problem.)
+ */
+ push(-stack_depth_adjust);
+ ifree_object(penum->pfn, "sampled_data_continue(pfn)");
+ ifree_object(penum, "sampled_data_continue((enum)");
+ return_error(e_undefinedresult);
+ }
}
-
+
/* Save data from the given function */
data_ptr = cube_ptr_from_index(params, penum->indexes);
for (i=0; i < num_out; i++) {
- ulong cv;
+ ulong cv;
double value;
- double rmin = params->Range[2 * i];
- double rmax = params->Range[2 * i + 1];
+ double rmin = params->Range[2 * i];
+ double rmax = params->Range[2 * i + 1];
code = real_param(op + i - num_out + 1, &value);
if (code < 0)
- return code;
- if (value < rmin)
- value = rmin;
- else if (value > rmax)
- value = rmax;
- value = (value - rmin) / (rmax - rmin); /* Convert to 0 to 1.0 */
- cv = (int) (value * sampled_data_value_max + 0.5);
- for (j = 0; j < bps; j++)
- data_ptr[bps * i + j] = (byte)(cv >> ((bps - 1 - j) * 8)); /* MSB first */
+ return code;
+ if (value < rmin)
+ value = rmin;
+ else if (value > rmax)
+ value = rmax;
+ value = (value - rmin) / (rmax - rmin); /* Convert to 0 to 1.0 */
+ cv = (int) (value * sampled_data_value_max + 0.5);
+ for (j = 0; j < bps; j++)
+ data_ptr[bps * i + j] = (byte)(cv >> ((bps - 1 - j) * 8)); /* MSB first */
}
pop(num_out); /* Move op to base of result values */
-
+
/* Check if we are done collecting data. */
if (increment_cube_indexes(params, penum->indexes)) {
- if (stack_depth_adjust == 0)
- pop(O_STACK_PAD); /* Remove spare stack space */
- else
- pop(stack_depth_adjust - num_out);
- /* Execute the closing procedure, if given */
- code = 0;
- if (esp_finish_proc != 0)
- code = esp_finish_proc(i_ctx_p);
-
- return code;
+ if (stack_depth_adjust == 0)
+ pop(O_STACK_PAD); /* Remove spare stack space */
+ else
+ pop(stack_depth_adjust - num_out);
+ /* Execute the closing procedure, if given */
+ code = 0;
+ if (esp_finish_proc != 0)
+ code = esp_finish_proc(i_ctx_p);
+
+ return code;
} else {
- if (stack_depth_adjust) {
- stack_depth_adjust -= num_out;
- push(O_STACK_PAD - stack_depth_adjust);
- for (i=0;i<O_STACK_PAD - stack_depth_adjust;i++)
- make_null(op - i);
- }
+ if (stack_depth_adjust) {
+ stack_depth_adjust -= num_out;
+ push(O_STACK_PAD - stack_depth_adjust);
+ for (i=0;i<O_STACK_PAD - stack_depth_adjust;i++)
+ make_null(op - i);
+ }
}
/* Now get the data for the next location */
@@ -567,18 +563,18 @@ sampled_data_finish(i_ctx_t *i_ctx_p)
gs_sampled_data_enum *penum = senum;
/* Build a type 0 function using the given parameters */
gs_function_Sd_params_t * params =
- (gs_function_Sd_params_t *)&penum->pfn->params;
+ (gs_function_Sd_params_t *)&penum->pfn->params;
gs_function_t * pfn;
ref cref; /* closure */
int code = gs_function_Sd_init(&pfn, params, imemory);
if (code < 0)
- return code;
+ return code;
code = ialloc_ref_array(&cref, a_executable | a_execute, 2,
- "sampled_data_finish(cref)");
+ "sampled_data_finish(cref)");
if (code < 0)
- return code;
+ return code;
make_istruct_new(cref.value.refs, a_executable | a_execute, pfn);
make_oper_new(cref.value.refs + 1, 0, zexecfunction);
@@ -602,50 +598,50 @@ int make_sampled_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t
code = get_space_object(i_ctx_p, arr, &space);
if (code < 0)
- return code;
+ return code;
if (!space->alternateproc)
- return e_typecheck;
+ return e_typecheck;
code = space->alternateproc(i_ctx_p, arr, &palternatespace, &CIESubst);
if (code < 0)
- return code;
+ return code;
code = get_space_object(i_ctx_p, palternatespace, &altspace);
if (code < 0)
- return code;
+ return code;
/*
* Set up the hyper cube function data structure.
*/
params.Order = 3;
params.BitsPerSample = 16;
- code = space->numcomponents(i_ctx_p, arr, &num_components);
+ code = space->numcomponents(i_ctx_p, arr, &num_components);
if (code < 0)
- return code;
+ return code;
fptr = (float *)gs_alloc_byte_array(imemory, num_components * 2, sizeof(float), "make_sampled_function(Domain)");
if (!fptr)
- return e_VMerror;
- code = space->domain(i_ctx_p, arr, fptr);
+ return e_VMerror;
+ code = space->domain(i_ctx_p, arr, fptr);
if (code < 0) {
- gs_free_const_object(imemory, fptr, "make_sampled_function(Domain)");
- return code;
+ gs_free_const_object(imemory, fptr, "make_sampled_function(Domain)");
+ return code;
}
params.Domain = fptr;
params.m = num_components;
- code = altspace->numcomponents(i_ctx_p, palternatespace, &num_components);
+ code = altspace->numcomponents(i_ctx_p, palternatespace, &num_components);
if (code < 0) {
- gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
- return code;
+ gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
+ return code;
}
fptr = (float *)gs_alloc_byte_array(imemory, num_components * 2, sizeof(float), "make_sampled_function(Range)");
if (!fptr) {
- gs_free_const_object(imemory, params.Domain, "make_sampled_function(Domain)");
- return e_VMerror;
+ gs_free_const_object(imemory, params.Domain, "make_sampled_function(Domain)");
+ return e_VMerror;
}
- code = altspace->range(i_ctx_p, palternatespace, fptr);
+ code = altspace->range(i_ctx_p, palternatespace, fptr);
if (code < 0) {
- gs_free_const_object(imemory, params.Domain, "make_sampled_function(Domain)");
- gs_free_const_object(imemory, fptr, "make_sampled_function(Range)");
- return code;
+ gs_free_const_object(imemory, params.Domain, "make_sampled_function(Domain)");
+ gs_free_const_object(imemory, fptr, "make_sampled_function(Range)");
+ return code;
}
params.Range = fptr;
params.n = num_components;
@@ -656,8 +652,8 @@ int make_sampled_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t
*/
ptr = (int *)gs_alloc_byte_array(imemory, params.m, sizeof(int), "Size");
if (ptr == NULL) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
params.Size = ptr;
/*
@@ -665,25 +661,25 @@ int make_sampled_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t
* set of values.
*/
code = determine_sampled_data_size(params.m, params.n,
- params.BitsPerSample, (int *)params.Size);
+ params.BitsPerSample, (int *)params.Size);
if (code < 0)
- goto fail;
+ goto fail;
/*
* Determine space required for the sample data storage.
*/
total_size = params.n * bits2bytes(params.BitsPerSample);
for (i = 0; i < params.m; i++)
- total_size *= params.Size[i];
+ total_size *= params.Size[i];
/*
* Allocate space for the data cube itself.
*/
bytes = gs_alloc_byte_array(imemory, total_size, 1, "cube_build_func0(bytes)");
if (!bytes) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
data_source_init_bytes(&params.DataSource,
- (const unsigned char *)bytes, total_size);
+ (const unsigned char *)bytes, total_size);
/*
* This is temporary. We will call gs_function_Sd_init again after
@@ -695,7 +691,7 @@ int make_sampled_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t
*/
code = gs_function_Sd_init(&pfn, &params, imemory);
if (code < 0)
- return code;
+ return code;
/*
* Now setup to collect the sample data.
*/
diff --git a/gs/psi/zfunc.c b/gs/psi/zfunc.c
index 3309bce64..d3061fa12 100644
--- a/gs/psi/zfunc.c
+++ b/gs/psi/zfunc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,9 +41,9 @@ make_function_proc(i_ctx_t *i_ctx_p, ref *op, gs_function_t *pfn)
int code;
code = ialloc_ref_array(&cref, a_executable | a_execute, 2,
- ".buildfunction");
+ ".buildfunction");
if (code < 0)
- return code;
+ return code;
make_istruct_new(cref.value.refs, a_executable | a_execute, pfn);
make_oper_new(cref.value.refs + 1, 0, zexecfunction);
ref_assign(op, &cref);
@@ -59,10 +59,10 @@ zbuildfunction(i_ctx_t *i_ctx_p)
int code = fn_build_function(i_ctx_p, op, &pfn, imemory, 0, 0);
if (code < 0)
- return code;
+ return code;
code = make_function_proc(i_ctx_p, op, pfn);
if (code < 0)
- gs_function_free(pfn, true, imemory);
+ gs_function_free(pfn, true, imemory);
return 0;
}
@@ -73,18 +73,18 @@ int buildfunction(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, int type)
int code=0;
switch(type) {
- case 0:
- code = make_sampled_function(i_ctx_p, arr, pproc, &pfn);
- break;
- case 4:
- code = make_type4_function(i_ctx_p, arr, pproc, &pfn);
- if (code == 0) {
- code = make_function_proc(i_ctx_p, op, pfn);
- if (code < 0) {
- gs_function_free(pfn, true, imemory);
- }
- }
- break;
+ case 0:
+ code = make_sampled_function(i_ctx_p, arr, pproc, &pfn);
+ break;
+ case 4:
+ code = make_type4_function(i_ctx_p, arr, pproc, &pfn);
+ if (code == 0) {
+ code = make_function_proc(i_ctx_p, op, pfn);
+ if (code < 0) {
+ gs_function_free(pfn, true, imemory);
+ }
+ }
+ break;
}
return code;
}
@@ -105,31 +105,31 @@ zscalefunction(i_ctx_t *i_ctx_p)
check_proc(op[-1]);
pfn = ref_function(op - 1);
if (pfn == 0 || !r_is_array(op))
- return_error(e_typecheck);
+ return_error(e_typecheck);
if (r_size(op) != 2 * pfn->params.n)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
ranges = (gs_range_t *)
- gs_alloc_byte_array(imemory, pfn->params.n, sizeof(gs_range_t),
- "zscalefunction");
+ gs_alloc_byte_array(imemory, pfn->params.n, sizeof(gs_range_t),
+ "zscalefunction");
if (ranges == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
for (i = 0; i < pfn->params.n; ++i) {
- ref rval[2];
- float val[2];
-
- if ((code = array_get(op, 2 * i, &rval[0])) < 0 ||
- (code = array_get(op, 2 * i + 1, &rval[1])) < 0 ||
- (code = float_params(rval + 1, 2, val)) < 0)
- return code;
- ranges[i].rmin = val[0];
- ranges[i].rmax = val[1];
+ ref rval[2];
+ float val[2];
+
+ if ((code = array_get(op, 2 * i, &rval[0])) < 0 ||
+ (code = array_get(op, 2 * i + 1, &rval[1])) < 0 ||
+ (code = float_params(rval + 1, 2, val)) < 0)
+ return code;
+ ranges[i].rmin = val[0];
+ ranges[i].rmax = val[1];
}
code = gs_function_make_scaled(pfn, &psfn, ranges, imemory);
gs_free_object(imemory, ranges, "zscalefunction");
if (code < 0 ||
- (code = make_function_proc(i_ctx_p, op - 1, psfn)) < 0) {
- gs_function_free(psfn, true, imemory);
- return code;
+ (code = make_function_proc(i_ctx_p, op - 1, psfn)) < 0) {
+ gs_function_free(psfn, true, imemory);
+ return code;
}
pop(1);
return 0;
@@ -143,60 +143,60 @@ zexecfunction(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
- /*
- * Since this operator's name begins with %, the name is not defined
- * in systemdict. The only place this operator can ever appear is
- * in the execute-only closure created by .buildfunction.
- * Therefore, in principle it is unnecessary to check the argument.
- * However, we do a little checking anyway just on general
- * principles. Note that since the argument may be an instance of
- * any subclass of gs_function_t, we currently have no way to check
- * its type.
- */
+ /*
+ * Since this operator's name begins with %, the name is not defined
+ * in systemdict. The only place this operator can ever appear is
+ * in the execute-only closure created by .buildfunction.
+ * Therefore, in principle it is unnecessary to check the argument.
+ * However, we do a little checking anyway just on general
+ * principles. Note that since the argument may be an instance of
+ * any subclass of gs_function_t, we currently have no way to check
+ * its type.
+ */
if (!r_is_struct(op) ||
- !r_has_masked_attrs(op, a_executable | a_execute, a_executable | a_all)
- )
- return_error(e_typecheck);
+ !r_has_masked_attrs(op, a_executable | a_execute, a_executable | a_all)
+ )
+ return_error(e_typecheck);
{
- gs_function_t *pfn = (gs_function_t *) op->value.pstruct;
- int m = pfn->params.m, n = pfn->params.n;
- int diff = n - (m + 1);
-
- if (diff > 0)
- check_ostack(diff);
- {
- float params[20]; /* arbitrary size, just to avoid allocs */
- float *in;
- float *out;
- int code = 0;
-
- if (m + n <= countof(params)) {
- in = params;
- } else {
- in = (float *)ialloc_byte_array(m + n, sizeof(float),
- "%execfunction(in/out)");
- if (in == 0)
- code = gs_note_error(e_VMerror);
- }
- out = in + m;
- if (code < 0 ||
- (code = float_params(op - 1, m, in)) < 0 ||
- (code = gs_function_evaluate(pfn, in, out)) < 0
- )
- DO_NOTHING;
- else {
- if (diff > 0)
- push(diff); /* can't fail */
- else if (diff < 0) {
- pop(-diff);
- op = osp;
- }
- code = make_floats(op + 1 - n, out, n);
- }
- if (in != params)
- ifree_object(in, "%execfunction(in)");
- return code;
- }
+ gs_function_t *pfn = (gs_function_t *) op->value.pstruct;
+ int m = pfn->params.m, n = pfn->params.n;
+ int diff = n - (m + 1);
+
+ if (diff > 0)
+ check_ostack(diff);
+ {
+ float params[20]; /* arbitrary size, just to avoid allocs */
+ float *in;
+ float *out;
+ int code = 0;
+
+ if (m + n <= countof(params)) {
+ in = params;
+ } else {
+ in = (float *)ialloc_byte_array(m + n, sizeof(float),
+ "%execfunction(in/out)");
+ if (in == 0)
+ code = gs_note_error(e_VMerror);
+ }
+ out = in + m;
+ if (code < 0 ||
+ (code = float_params(op - 1, m, in)) < 0 ||
+ (code = gs_function_evaluate(pfn, in, out)) < 0
+ )
+ DO_NOTHING;
+ else {
+ if (diff > 0)
+ push(diff); /* can't fail */
+ else if (diff < 0) {
+ pop(-diff);
+ op = osp;
+ }
+ code = make_floats(op + 1 - n, out, n);
+ }
+ if (in != params)
+ ifree_object(in, "%execfunction(in)");
+ return code;
+ }
}
}
@@ -238,30 +238,30 @@ fn_build_sub_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
gs_function_params_t params;
if (depth > MAX_SUB_FUNCTION_DEPTH)
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
check_type(*op, t_dictionary);
code = dict_int_param(op, "FunctionType", 0, max_int, -1, &type);
if (code < 0)
- return code;
+ return code;
for (i = 0; i < build_function_type_table_count; ++i)
- if (build_function_type_table[i].type == type)
- break;
+ if (build_function_type_table[i].type == type)
+ break;
if (i == build_function_type_table_count)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
/* Collect parameters common to all function types. */
params.Domain = 0;
params.Range = 0;
code = fn_build_float_array(op, "Domain", true, true, &params.Domain, mem);
if (code < 0) {
- gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
- goto fail;
+ gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
+ goto fail;
}
params.m = code >> 1;
for (j = 0; j < params.m << 1; j += 2) {
if (params.Domain[j] > params.Domain[j + 1]) {
code = gs_note_error(e_rangecheck);
- gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
- goto fail;
+ gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
+ goto fail;
}
}
if (shading_domain) {
@@ -285,12 +285,12 @@ fn_build_sub_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
}
code = fn_build_float_array(op, "Range", false, true, &params.Range, mem);
if (code < 0)
- goto fail;
+ goto fail;
params.n = code >> 1;
/* Finish building the function. */
/* If this fails, it will free all the parameters. */
return (*build_function_type_table[i].proc)
- (i_ctx_p, op, &params, depth + 1, ppfn, mem);
+ (i_ctx_p, op, &params, depth + 1, ppfn, mem);
fail:
gs_free_const_object(mem, params.Range, "Range");
gs_free_const_object(mem, params.Domain, "Domain");
@@ -305,31 +305,31 @@ fail:
*/
int
fn_build_float_array(const ref * op, const char *kstr, bool required,
- bool even, const float **pparray, gs_memory_t *mem)
+ bool even, const float **pparray, gs_memory_t *mem)
{
ref *par;
int code;
*pparray = 0;
if (dict_find_string(op, kstr, &par) <= 0)
- return (required ? gs_note_error(e_rangecheck) : 0);
+ return (required ? gs_note_error(e_rangecheck) : 0);
if (!r_is_array(par))
- return_error(e_typecheck);
+ return_error(e_typecheck);
{
- uint size = r_size(par);
- float *ptr = (float *)
- gs_alloc_byte_array(mem, size, sizeof(float), kstr);
-
- if (ptr == 0)
- return_error(e_VMerror);
- code = dict_float_array_check_param(mem, op, kstr, size,
- ptr, NULL,
- 0, e_rangecheck);
- if (code < 0 || (even && (code & 1) != 0)) {
- gs_free_object(mem, ptr, kstr);
- return(code < 0 ? code : gs_note_error(e_rangecheck));
- }
- *pparray = ptr;
+ uint size = r_size(par);
+ float *ptr = (float *)
+ gs_alloc_byte_array(mem, size, sizeof(float), kstr);
+
+ if (ptr == 0)
+ return_error(e_VMerror);
+ code = dict_float_array_check_param(mem, op, kstr, size,
+ ptr, NULL,
+ 0, e_rangecheck);
+ if (code < 0 || (even && (code & 1) != 0)) {
+ gs_free_object(mem, ptr, kstr);
+ return(code < 0 ? code : gs_note_error(e_rangecheck));
+ }
+ *pparray = ptr;
}
return code;
}
@@ -341,7 +341,7 @@ fn_build_float_array(const ref * op, const char *kstr, bool required,
*/
int
fn_build_float_array_forced(const ref * op, const char *kstr, bool required,
- const float **pparray, gs_memory_t *mem)
+ const float **pparray, gs_memory_t *mem)
{
ref *par;
int code;
@@ -350,22 +350,22 @@ fn_build_float_array_forced(const ref * op, const char *kstr, bool required,
*pparray = 0;
if (dict_find_string(op, kstr, &par) <= 0)
- return (required ? gs_note_error(e_rangecheck) : 0);
+ return (required ? gs_note_error(e_rangecheck) : 0);
if( r_is_array(par) )
- size = r_size(par);
+ size = r_size(par);
else if(r_type(par) == t_integer || r_type(par) == t_real)
size = 1;
else
- return_error(e_typecheck);
+ return_error(e_typecheck);
ptr = (float *)gs_alloc_byte_array(mem, size, sizeof(float), kstr);
if (ptr == 0)
return_error(e_VMerror);
- if(r_is_array(par) )
- code = dict_float_array_check_param(mem, op, kstr,
- size, ptr, NULL,
- 0, e_rangecheck);
+ if(r_is_array(par) )
+ code = dict_float_array_check_param(mem, op, kstr,
+ size, ptr, NULL,
+ 0, e_rangecheck);
else {
code = dict_float_param(op, kstr, 0., ptr); /* defailt cannot happen */
if( code == 0 )
@@ -373,7 +373,7 @@ fn_build_float_array_forced(const ref * op, const char *kstr, bool required,
}
if (code < 0 ) {
- gs_free_object(mem, ptr, kstr);
+ gs_free_object(mem, ptr, kstr);
return code;
}
*pparray = ptr;
@@ -388,16 +388,16 @@ gs_function_t *
ref_function(const ref *op)
{
if (r_has_type(op, t_array) &&
- r_has_masked_attrs(op, a_executable | a_execute,
- a_executable | a_all) &&
- r_size(op) == 2 &&
- r_has_type_attrs(op->value.refs + 1, t_operator, a_executable) &&
- op->value.refs[1].value.opproc == zexecfunction &&
- r_is_struct(op->value.refs) &&
- r_has_masked_attrs(op->value.refs, a_executable | a_execute,
- a_executable | a_all)
- )
- return (gs_function_t *)op->value.refs->value.pstruct;
+ r_has_masked_attrs(op, a_executable | a_execute,
+ a_executable | a_all) &&
+ r_size(op) == 2 &&
+ r_has_type_attrs(op->value.refs + 1, t_operator, a_executable) &&
+ op->value.refs[1].value.opproc == zexecfunction &&
+ r_is_struct(op->value.refs) &&
+ r_has_masked_attrs(op->value.refs, a_executable | a_execute,
+ a_executable | a_all)
+ )
+ return (gs_function_t *)op->value.refs->value.pstruct;
return 0;
}
diff --git a/gs/psi/zfunc.h b/gs/psi/zfunc.h
index 933020873..3d91379b3 100644
--- a/gs/psi/zfunc.h
+++ b/gs/psi/zfunc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zfunc0.c b/gs/psi/zfunc0.c
index 8e8decaa8..edaf5d0d5 100644
--- a/gs/psi/zfunc0.c
+++ b/gs/psi/zfunc0.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,7 +32,7 @@ build_function_proc(gs_build_function_0);
/* Finish building a FunctionType 0 (Sampled) function. */
int
gs_build_function_0(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t * mnDR,
- int depth, gs_function_t ** ppfn, gs_memory_t *mem)
+ int depth, gs_function_t ** ppfn, gs_memory_t *mem)
{
gs_function_Sd_params_t params;
ref *pDataSource;
@@ -43,49 +43,49 @@ gs_build_function_0(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t
params.pole = NULL;
params.Size = params.array_step = params.stream_step = NULL;
if ((code = dict_find_string(op, "DataSource", &pDataSource)) <= 0)
- return (code < 0 ? code : gs_note_error(e_rangecheck));
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
switch (r_type(pDataSource)) {
- case t_string:
- data_source_init_string2(&params.DataSource,
- pDataSource->value.const_bytes,
- r_size(pDataSource));
- break;
- case t_file: {
- stream *s;
+ case t_string:
+ data_source_init_string2(&params.DataSource,
+ pDataSource->value.const_bytes,
+ r_size(pDataSource));
+ break;
+ case t_file: {
+ stream *s;
- check_read_known_file_else(s, pDataSource, return_error,
- return_error(e_invalidfileaccess));
- if (!(s->modes & s_mode_seek))
- return_error(e_ioerror);
- data_source_init_stream(&params.DataSource, s);
- break;
- }
- default:
- return_error(e_rangecheck);
+ check_read_known_file_else(s, pDataSource, return_error,
+ return_error(e_invalidfileaccess));
+ if (!(s->modes & s_mode_seek))
+ return_error(e_ioerror);
+ data_source_init_stream(&params.DataSource, s);
+ break;
+ }
+ default:
+ return_error(e_rangecheck);
}
if ((code = dict_int_param(op, "Order", 1, 3, 1, &params.Order)) < 0 ||
- (code = dict_int_param(op, "BitsPerSample", 1, 32, 0,
- &params.BitsPerSample)) < 0 ||
- ((code = fn_build_float_array(op, "Encode", false, true, &params.Encode, mem)) != 2 * params.m && (code != 0 || params.Encode != 0)) ||
- ((code = fn_build_float_array(op, "Decode", false, true, &params.Decode, mem)) != 2 * params.n && (code != 0 || params.Decode != 0))
- ) {
- goto fail;
+ (code = dict_int_param(op, "BitsPerSample", 1, 32, 0,
+ &params.BitsPerSample)) < 0 ||
+ ((code = fn_build_float_array(op, "Encode", false, true, &params.Encode, mem)) != 2 * params.m && (code != 0 || params.Encode != 0)) ||
+ ((code = fn_build_float_array(op, "Decode", false, true, &params.Decode, mem)) != 2 * params.n && (code != 0 || params.Decode != 0))
+ ) {
+ goto fail;
} {
- int *ptr = (int *)
- gs_alloc_byte_array(mem, params.m, sizeof(int), "Size");
+ int *ptr = (int *)
+ gs_alloc_byte_array(mem, params.m, sizeof(int), "Size");
- if (ptr == 0) {
- code = gs_note_error(e_VMerror);
- goto fail;
- }
- params.Size = ptr;
- code = dict_ints_param(mem, op, "Size", params.m, ptr);
- if (code != params.m)
- goto fail;
+ if (ptr == 0) {
+ code = gs_note_error(e_VMerror);
+ goto fail;
+ }
+ params.Size = ptr;
+ code = dict_ints_param(mem, op, "Size", params.m, ptr);
+ if (code != params.m)
+ goto fail;
}
code = gs_function_Sd_init(ppfn, &params, mem);
if (code >= 0)
- return 0;
+ return 0;
fail:
gs_function_Sd_free_params(&params, mem);
return (code < 0 ? code : gs_note_error(e_rangecheck));
diff --git a/gs/psi/zfunc3.c b/gs/psi/zfunc3.c
index 3a8bbc485..a940c0b82 100644
--- a/gs/psi/zfunc3.c
+++ b/gs/psi/zfunc3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@ build_function_proc(gs_build_function_3);
/* Finish building a FunctionType 2 (ExponentialInterpolation) function. */
int
gs_build_function_2(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t * mnDR,
- int depth, gs_function_t ** ppfn, gs_memory_t *mem)
+ int depth, gs_function_t ** ppfn, gs_memory_t *mem)
{
gs_function_ElIn_params_t params;
int code, n0, n1;
@@ -43,21 +43,21 @@ gs_build_function_2(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t
params.C0 = 0;
params.C1 = 0;
if ((code = dict_float_param(op, "N", 0.0, &params.N)) != 0 ||
- (code = n0 = fn_build_float_array_forced(op, "C0", false, &params.C0, mem)) < 0 ||
- (code = n1 = fn_build_float_array_forced(op, "C1", false, &params.C1, mem)) < 0
- )
- goto fail;
+ (code = n0 = fn_build_float_array_forced(op, "C0", false, &params.C0, mem)) < 0 ||
+ (code = n1 = fn_build_float_array_forced(op, "C1", false, &params.C1, mem)) < 0
+ )
+ goto fail;
if (params.C0 == 0)
- n0 = 1; /* C0 defaulted */
+ n0 = 1; /* C0 defaulted */
if (params.C1 == 0)
- n1 = 1; /* C1 defaulted */
+ n1 = 1; /* C1 defaulted */
if (params.Range == 0)
- params.n = n0; /* either one will do */
+ params.n = n0; /* either one will do */
if (n0 != n1 || n0 != params.n)
- goto fail;
+ goto fail;
code = gs_function_ElIn_init(ppfn, &params, mem);
if (code >= 0)
- return 0;
+ return 0;
fail:
gs_function_ElIn_free_params(&params, mem);
return (code < 0 ? code : gs_note_error(e_rangecheck));
@@ -66,7 +66,7 @@ fail:
/* Finish building a FunctionType 3 (1-Input Stitching) function. */
int
gs_build_function_3(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t * mnDR,
- int depth, gs_function_t ** ppfn, gs_memory_t *mem)
+ int depth, gs_function_t ** ppfn, gs_memory_t *mem)
{
gs_function_1ItSg_params_t params;
int code;
@@ -76,63 +76,63 @@ gs_build_function_3(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t
params.Bounds = 0;
params.Encode = 0;
{
- ref *pFunctions;
- gs_function_t **ptr;
- int i;
+ ref *pFunctions;
+ gs_function_t **ptr;
+ int i;
- if ((code = dict_find_string(op, "Functions", &pFunctions)) <= 0)
- return (code < 0 ? code : gs_note_error(e_rangecheck));
- check_array_only(*pFunctions);
- params.k = r_size(pFunctions);
- code = alloc_function_array(params.k, &ptr, mem);
- if (code < 0)
- return code;
- params.Functions = (const gs_function_t * const *)ptr;
- for (i = 0; i < params.k; ++i) {
- ref subfn;
+ if ((code = dict_find_string(op, "Functions", &pFunctions)) <= 0)
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
+ check_array_only(*pFunctions);
+ params.k = r_size(pFunctions);
+ code = alloc_function_array(params.k, &ptr, mem);
+ if (code < 0)
+ return code;
+ params.Functions = (const gs_function_t * const *)ptr;
+ for (i = 0; i < params.k; ++i) {
+ ref subfn;
- array_get(mem, pFunctions, (long)i, &subfn);
- code = fn_build_sub_function(i_ctx_p, &subfn, &ptr[i], depth, mem, 0, 0);
- if (code < 0)
- goto fail;
- }
+ array_get(mem, pFunctions, (long)i, &subfn);
+ code = fn_build_sub_function(i_ctx_p, &subfn, &ptr[i], depth, mem, 0, 0);
+ if (code < 0)
+ goto fail;
+ }
}
if ((code = fn_build_float_array(op, "Bounds", true, false, &params.Bounds, mem)) != params.k - 1)
- goto fail;
+ goto fail;
if (gs_currentcpsimode(imemory)) {
- /* 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");
+ /* 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);
- if (code < 0)
- goto fail;
- while (sz < k2)
- p[sz++] = 0.0;
+ 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);
+ if (code < 0)
+ goto fail;
+ while (sz < k2)
+ p[sz++] = 0.0;
} else if ((code = fn_build_float_array(op, "Encode", true, true, &params.Encode, mem)) != 2 * params.k)
- goto fail;
+ goto fail;
if (params.Range == 0)
- params.n = params.Functions[0]->params.n;
+ params.n = params.Functions[0]->params.n;
code = gs_function_1ItSg_init(ppfn, &params, mem);
if (code >= 0)
- return 0;
+ return 0;
fail:
gs_function_1ItSg_free_params(&params, mem);
return (code < 0 ? code : gs_note_error(e_rangecheck));
diff --git a/gs/psi/zfunc4.c b/gs/psi/zfunc4.c
index 172b2452a..2655b4bac 100644
--- a/gs/psi/zfunc4.c
+++ b/gs/psi/zfunc4.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -136,11 +136,11 @@ resolves_to_oper(i_ctx_t *i_ctx_p, const ref *pref, const op_proc_t proc)
} else if (r_btype(pref) == t_name) {
ref * val;
if (dict_find(systemdict, pref, &val) <= 0)
- return false;
+ return false;
if (r_btype(val) != t_operator)
- return false;
+ return false;
if (!r_has_attr(val, a_executable))
- return false;
+ return false;
return val->value.opproc == proc;
}
else
@@ -148,7 +148,7 @@ resolves_to_oper(i_ctx_t *i_ctx_p, const ref *pref, const op_proc_t proc)
}
/* Store an int in the buffer */
-static int
+static int
put_int(byte **p, int n) {
if (n == (byte)n) {
if (*p) {
@@ -168,7 +168,7 @@ put_int(byte **p, int n) {
}
/* Store a float in the buffer */
-static int
+static int
put_float(byte **p, float n) {
if (*p) {
**p = PtCr_float;
@@ -179,7 +179,7 @@ put_float(byte **p, float n) {
}
/* Store an op code in the buffer */
-static int
+static int
put_op(byte **p, byte op) {
if (*p)
*(*p)++ = op;
@@ -230,7 +230,7 @@ check_psc_function(i_ctx_t *i_ctx_p, const ref *pref, int depth, byte *ops, int
outColor aload pop
}
*/
- ref r_tp, r_cttf; /* original references */
+ ref r_tp, r_cttf; /* original references */
ref n_tp, n_cttf; /* names */
ref *v_tp, *v_cttf; /* values */
int sz;
@@ -253,7 +253,7 @@ check_psc_function(i_ctx_t *i_ctx_p, const ref *pref, int depth, byte *ops, int
if (v_tp && v_cttf && r_is_array(v_tp) && r_is_array(v_cttf)) {
uint n_elem = r_size(v_tp);
- if ((n_elem & 3) == 0 && r_size(v_cttf) == 31) {
+ if ((n_elem & 3) == 0 && r_size(v_cttf) == 31) {
/* Enough testing, idiom recognition tests less. */
uint n_col = n_elem/4;
@@ -261,7 +261,7 @@ check_psc_function(i_ctx_t *i_ctx_p, const ref *pref, int depth, byte *ops, int
ref v;
float fv;
bool first = true;
-
+
for (j = 0; j < n_col; j++) {
if (array_get(imemory, v_tp, j*4 + i, &v) < 0)
goto idiom_failed;
@@ -285,7 +285,7 @@ check_psc_function(i_ctx_t *i_ctx_p, const ref *pref, int depth, byte *ops, int
sz += put_op(&p, PtCr_sub);
if (first)
first = false;
- else
+ else
sz += put_op(&p, PtCr_mul);
}
}
@@ -310,126 +310,126 @@ check_psc_function(i_ctx_t *i_ctx_p, const ref *pref, int depth, byte *ops, int
}
idiom_failed:;
for (i = 0; i < size; ++i) {
- byte no_ops[1 + max(sizeof(int), sizeof(float))];
- ref elt, elt2, elt3;
- ref * delp;
-
- p = (ops ? ops + *psize : no_ops);
- array_get(imemory, pref, i, &elt);
- switch (r_btype(&elt)) {
- case t_integer:
- *psize += put_int(&p, elt.value.intval);
- break;
- case t_real:
- *psize += put_float(&p, elt.value.realval);
- break;
- case t_boolean:
- *p = (elt.value.boolval ? PtCr_true : PtCr_false);
- ++*psize;
- break;
- case t_name:
- if (!r_has_attr(&elt, a_executable))
- return_error(e_rangecheck);
- name_string_ref(imemory, &elt, &elt);
- if (!bytes_compare(elt.value.bytes, r_size(&elt),
- (const byte *)"true", 4)) {
- *p = PtCr_true;
- ++*psize;
- break;
- }
- if (!bytes_compare(elt.value.bytes, r_size(&elt),
- (const byte *)"false", 5)) {
- *p = PtCr_false;
- ++*psize;
- break;
- }
- /* Check if the name is a valid operator in systemdict */
- if (dict_find(systemdict, &elt, &delp) <= 0)
- return_error(e_undefined);
- if (r_btype(delp) != t_operator)
- return_error(e_typecheck);
- if (!r_has_attr(delp, a_executable))
- return_error(e_rangecheck);
- elt = *delp;
- /* Fall into the operator case */
- case t_operator: {
- int j;
-
- for (j = 0; j < countof(calc_ops); ++j)
- if (elt.value.opproc == calc_ops[j].proc) {
- *p = calc_ops[j].opcode;
- ++*psize;
- goto next;
- }
- return_error(e_rangecheck);
- }
- default: {
- if (!r_is_proc(&elt))
- return_error(e_typecheck);
- if (depth == MAX_PSC_FUNCTION_NESTING)
- return_error(e_limitcheck);
- if ((code = array_get(imemory, pref, ++i, &elt2)) < 0)
- return code;
- *psize += 3;
- code = check_psc_function(i_ctx_p, &elt, depth + 1, ops, psize);
- if (code < 0)
- return code;
- /* Check for { proc } repeat | {proc} if | {proc1} {proc2} ifelse */
- if (resolves_to_oper(i_ctx_p, &elt2, zrepeat)) {
- gs_c_param_list list;
- int AllowRepeat = 1;
-
- /* Check if the device allows the use of repeat in functions */
- /* We can't handle 'repeat' with pdfwrite since it emits FunctionType 4 */
- gs_c_param_list_write(&list, i_ctx_p->pgs->device->memory);
- code = gs_getdeviceparams(i_ctx_p->pgs->device, (gs_param_list *)&list);
- if (code < 0)
- return code;
- gs_c_param_list_read(&list);
- code = param_read_bool((gs_param_list *)&list,
- "AllowPSRepeatFunctions",
- &AllowRepeat);
- if (code < 0)
- return code;
- gs_c_param_list_release(&list);
-
- if (!AllowRepeat)
- return_error(e_rangecheck);
- if (ops) {
- *p = PtCr_repeat;
- psc_fixup(p, ops + *psize);
- p = ops + *psize;
- *p++ = PtCr_repeat_end;
- }
- *psize += 1; /* extra room for repeat_end */
- } else if (resolves_to_oper(i_ctx_p, &elt2, zif)) {
- if (ops) {
- *p = PtCr_if;
- psc_fixup(p, ops + *psize);
- }
- } else if (!r_is_proc(&elt2))
- return_error(e_rangecheck);
- else if ((code = array_get(imemory, pref, ++i, &elt3)) < 0)
- return code;
- else if (resolves_to_oper(i_ctx_p, &elt3, zifelse)) {
- if (ops) {
- *p = PtCr_if;
- psc_fixup(p, ops + *psize + 3);
- p = ops + *psize;
- *p = PtCr_else;
- }
- *psize += 3;
- code = check_psc_function(i_ctx_p, &elt2, depth + 1, ops, psize);
- if (code < 0)
- return code;
- if (ops)
- psc_fixup(p, ops + *psize);
- } else
- return_error(e_rangecheck);
- } /* end 'default' */
- }
+ byte no_ops[1 + max(sizeof(int), sizeof(float))];
+ ref elt, elt2, elt3;
+ ref * delp;
+
+ p = (ops ? ops + *psize : no_ops);
+ array_get(imemory, pref, i, &elt);
+ switch (r_btype(&elt)) {
+ case t_integer:
+ *psize += put_int(&p, elt.value.intval);
+ break;
+ case t_real:
+ *psize += put_float(&p, elt.value.realval);
+ break;
+ case t_boolean:
+ *p = (elt.value.boolval ? PtCr_true : PtCr_false);
+ ++*psize;
+ break;
+ case t_name:
+ if (!r_has_attr(&elt, a_executable))
+ return_error(e_rangecheck);
+ name_string_ref(imemory, &elt, &elt);
+ if (!bytes_compare(elt.value.bytes, r_size(&elt),
+ (const byte *)"true", 4)) {
+ *p = PtCr_true;
+ ++*psize;
+ break;
+ }
+ if (!bytes_compare(elt.value.bytes, r_size(&elt),
+ (const byte *)"false", 5)) {
+ *p = PtCr_false;
+ ++*psize;
+ break;
+ }
+ /* Check if the name is a valid operator in systemdict */
+ if (dict_find(systemdict, &elt, &delp) <= 0)
+ return_error(e_undefined);
+ if (r_btype(delp) != t_operator)
+ return_error(e_typecheck);
+ if (!r_has_attr(delp, a_executable))
+ return_error(e_rangecheck);
+ elt = *delp;
+ /* Fall into the operator case */
+ case t_operator: {
+ int j;
+
+ for (j = 0; j < countof(calc_ops); ++j)
+ if (elt.value.opproc == calc_ops[j].proc) {
+ *p = calc_ops[j].opcode;
+ ++*psize;
+ goto next;
+ }
+ return_error(e_rangecheck);
+ }
+ default: {
+ if (!r_is_proc(&elt))
+ return_error(e_typecheck);
+ if (depth == MAX_PSC_FUNCTION_NESTING)
+ return_error(e_limitcheck);
+ if ((code = array_get(imemory, pref, ++i, &elt2)) < 0)
+ return code;
+ *psize += 3;
+ code = check_psc_function(i_ctx_p, &elt, depth + 1, ops, psize);
+ if (code < 0)
+ return code;
+ /* Check for { proc } repeat | {proc} if | {proc1} {proc2} ifelse */
+ if (resolves_to_oper(i_ctx_p, &elt2, zrepeat)) {
+ gs_c_param_list list;
+ int AllowRepeat = 1;
+
+ /* Check if the device allows the use of repeat in functions */
+ /* We can't handle 'repeat' with pdfwrite since it emits FunctionType 4 */
+ gs_c_param_list_write(&list, i_ctx_p->pgs->device->memory);
+ code = gs_getdeviceparams(i_ctx_p->pgs->device, (gs_param_list *)&list);
+ if (code < 0)
+ return code;
+ gs_c_param_list_read(&list);
+ code = param_read_bool((gs_param_list *)&list,
+ "AllowPSRepeatFunctions",
+ &AllowRepeat);
+ if (code < 0)
+ return code;
+ gs_c_param_list_release(&list);
+
+ if (!AllowRepeat)
+ return_error(e_rangecheck);
+ if (ops) {
+ *p = PtCr_repeat;
+ psc_fixup(p, ops + *psize);
+ p = ops + *psize;
+ *p++ = PtCr_repeat_end;
+ }
+ *psize += 1; /* extra room for repeat_end */
+ } else if (resolves_to_oper(i_ctx_p, &elt2, zif)) {
+ if (ops) {
+ *p = PtCr_if;
+ psc_fixup(p, ops + *psize);
+ }
+ } else if (!r_is_proc(&elt2))
+ return_error(e_rangecheck);
+ else if ((code = array_get(imemory, pref, ++i, &elt3)) < 0)
+ return code;
+ else if (resolves_to_oper(i_ctx_p, &elt3, zifelse)) {
+ if (ops) {
+ *p = PtCr_if;
+ psc_fixup(p, ops + *psize + 3);
+ p = ops + *psize;
+ *p = PtCr_else;
+ }
+ *psize += 3;
+ code = check_psc_function(i_ctx_p, &elt2, depth + 1, ops, psize);
+ if (code < 0)
+ return code;
+ if (ops)
+ psc_fixup(p, ops + *psize);
+ } else
+ return_error(e_rangecheck);
+ } /* end 'default' */
+ }
next:
- DO_NOTHING;
+ DO_NOTHING;
}
return 0;
}
@@ -441,7 +441,7 @@ build_function_proc(gs_build_function_4);
/* Finish building a FunctionType 4 (PostScript Calculator) function. */
int
gs_build_function_4(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t * mnDR,
- int depth, gs_function_t ** ppfn, gs_memory_t *mem)
+ int depth, gs_function_t ** ppfn, gs_memory_t *mem)
{
gs_function_PtCr_params_t params;
ref *proc;
@@ -453,21 +453,21 @@ gs_build_function_4(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t
params.ops.data = 0; /* in case of failure */
params.ops.size = 0; /* ditto */
if (dict_find_string(op, "Function", &proc) <= 0) {
- code = gs_note_error(e_rangecheck);
- goto fail;
+ code = gs_note_error(e_rangecheck);
+ goto fail;
}
if (!r_is_proc(proc)) {
- code = gs_note_error(e_typecheck);
- goto fail;
+ code = gs_note_error(e_typecheck);
+ goto fail;
}
size = 0;
code = check_psc_function(i_ctx_p, proc, 0, NULL, &size);
if (code < 0)
- goto fail;
+ goto fail;
ops = gs_alloc_string(mem, size + 1, "gs_build_function_4(ops)");
if (ops == 0) {
- code = gs_note_error(e_VMerror);
- goto fail;
+ code = gs_note_error(e_VMerror);
+ goto fail;
}
size = 0;
check_psc_function(i_ctx_p, proc, 0, ops, &size); /* can't fail */
@@ -476,7 +476,7 @@ gs_build_function_4(i_ctx_t *i_ctx_p, const ref *op, const gs_function_params_t
params.ops.size = size + 1;
code = gs_function_PtCr_init(ppfn, &params, mem);
if (code >= 0)
- return 0;
+ return 0;
/* free_params will free the ops string */
fail:
gs_function_PtCr_free_params(&params, mem);
@@ -494,56 +494,56 @@ int make_type4_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t *
code = get_space_object(i_ctx_p, arr, &space);
if (code < 0)
- return code;
+ return code;
if (!space->alternateproc)
- return e_typecheck;
+ return e_typecheck;
code = space->alternateproc(i_ctx_p, arr, &palternatespace, &CIESubst);
if (code < 0)
- return code;
+ return code;
code = get_space_object(i_ctx_p, palternatespace, &altspace);
if (code < 0)
- return code;
+ return code;
- code = space->numcomponents(i_ctx_p, arr, &num_components);
+ code = space->numcomponents(i_ctx_p, arr, &num_components);
if (code < 0)
- return code;
+ return code;
ptr = (float *)gs_alloc_byte_array(imemory, num_components * 2, sizeof(float), "make_type4_function(Domain)");
if (!ptr)
- return e_VMerror;
- code = space->domain(i_ctx_p, arr, ptr);
+ return e_VMerror;
+ code = space->domain(i_ctx_p, arr, ptr);
if (code < 0) {
- gs_free_const_object(imemory, ptr, "make_type4_function(Domain)");
- return code;
+ gs_free_const_object(imemory, ptr, "make_type4_function(Domain)");
+ return code;
}
params.Domain = ptr;
params.m = num_components;
- code = altspace->numcomponents(i_ctx_p, &alternatespace, &num_components);
+ code = altspace->numcomponents(i_ctx_p, &alternatespace, &num_components);
if (code < 0) {
- gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
- return code;
+ gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
+ return code;
}
ptr = (float *)gs_alloc_byte_array(imemory, num_components * 2, sizeof(float), "make_type4_function(Range)");
if (!ptr) {
- gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
- return e_VMerror;
+ gs_free_const_object(imemory, params.Domain, "make_type4_function(Domain)");
+ return e_VMerror;
}
- code = altspace->range(i_ctx_p, &alternatespace, ptr);
+ code = altspace->range(i_ctx_p, &alternatespace, ptr);
if (code < 0) {
- gs_free_const_object(imemory, ptr, "make_type4_function(Domain)");
- gs_free_const_object(imemory, params.Domain, "make_type4_function(Range)");
- return code;
+ gs_free_const_object(imemory, ptr, "make_type4_function(Domain)");
+ gs_free_const_object(imemory, params.Domain, "make_type4_function(Range)");
+ return code;
}
params.Range = ptr;
params.n = num_components;
-
+
params.ops.data = 0; /* in case of failure, see gs_function_PtCr_free_params */
params.ops.size = 0; /* ditto */
size = 0;
code = check_psc_function(i_ctx_p, (const ref *)pproc, 0, NULL, &size);
if (code < 0) {
- gs_function_PtCr_free_params(&params, imemory);
- return code;
+ gs_function_PtCr_free_params(&params, imemory);
+ return code;
}
ops = gs_alloc_string(imemory, size + 1, "make_type4_function(ops)");
size = 0;
@@ -552,8 +552,8 @@ int make_type4_function(i_ctx_t * i_ctx_p, ref *arr, ref *pproc, gs_function_t *
params.ops.data = ops;
params.ops.size = size + 1;
code = gs_function_PtCr_init(func, &params, imemory);
- if (code < 0)
- gs_function_PtCr_free_params(&params, imemory);
+ if (code < 0)
+ gs_function_PtCr_free_params(&params, imemory);
return code;
}
diff --git a/gs/psi/zfzlib.c b/gs/psi/zfzlib.c
index a4b6e6267..e2e514e1e 100644
--- a/gs/psi/zfzlib.c
+++ b/gs/psi/zfzlib.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,7 +34,7 @@ filter_zlib(i_ctx_t *i_ctx_p, stream_zlib_state *pzls)
(*s_zlibE_template.set_defaults)((stream_state *)pzls);
if (r_has_type(op, t_dictionary))
- code = dict_int_param(op, "Effort", -1, 9, -1, &pzls->level);
+ code = dict_int_param(op, "Effort", -1, 9, -1, &pzls->level);
return code;
}
@@ -47,7 +47,7 @@ zzlibE(i_ctx_t *i_ctx_p)
int code = filter_zlib(i_ctx_p, &zls);
if (code < 0)
- return code;
+ return code;
return filter_write(i_ctx_p, 0, &s_zlibE_template, (stream_state *)&zls, 0);
}
@@ -71,9 +71,9 @@ zFlateE(i_ctx_t *i_ctx_p)
int code = filter_zlib(i_ctx_p, &zls);
if (code < 0)
- return code;
+ return code;
return filter_write_predictor(i_ctx_p, 0, &s_zlibE_template,
- (stream_state *)&zls);
+ (stream_state *)&zls);
}
/* <target> FlateDecode/filter <file> */
@@ -85,7 +85,7 @@ zFlateD(i_ctx_t *i_ctx_p)
(*s_zlibD_template.set_defaults)((stream_state *)&zls);
return filter_read_predictor(i_ctx_p, 0, &s_zlibD_template,
- (stream_state *)&zls);
+ (stream_state *)&zls);
}
/* ------ Initialization procedure ------ */
diff --git a/gs/psi/zgeneric.c b/gs/psi/zgeneric.c
index bd1c191c3..0bf347155 100644
--- a/gs/psi/zgeneric.c
+++ b/gs/psi/zgeneric.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,16 +49,16 @@ zcopy(i_ctx_t *i_ctx_p)
int type = r_type(op);
if (type == t_integer)
- return zcopy_integer(i_ctx_p);
+ return zcopy_integer(i_ctx_p);
check_op(2);
switch (type) {
- case t_array:
- case t_string:
- return zcopy_interval(i_ctx_p);
- case t_dictionary:
- return zcopy_dict(i_ctx_p);
- default:
- return_op_typecheck(op);
+ case t_array:
+ case t_string:
+ return zcopy_interval(i_ctx_p);
+ case t_dictionary:
+ return zcopy_dict(i_ctx_p);
+ default:
+ return_op_typecheck(op);
}
}
@@ -72,27 +72,27 @@ zcopy_integer(i_ctx_t *i_ctx_p)
int code;
if ((uint) op->value.intval > (uint)(op - osbot)) {
- /* There might be enough elements in other blocks. */
- check_type(*op, t_integer);
- if (op->value.intval >= (int)ref_stack_count(&o_stack))
+ /* There might be enough elements in other blocks. */
+ check_type(*op, t_integer);
+ if (op->value.intval >= (int)ref_stack_count(&o_stack))
return_error(e_stackunderflow);
- if (op->value.intval < 0)
+ if (op->value.intval < 0)
return_error(e_rangecheck);
check_int_ltu(*op, ref_stack_count(&o_stack));
- count = op->value.intval;
+ count = op->value.intval;
} else if (op1 + (count = op->value.intval) <= ostop) {
- /* Fast case. */
- memcpy((char *)op, (char *)(op - count), count * sizeof(ref));
- push(count - 1);
- return 0;
+ /* Fast case. */
+ memcpy((char *)op, (char *)(op - count), count * sizeof(ref));
+ push(count - 1);
+ return 0;
}
/* Do it the slow, general way. */
code = ref_stack_push(&o_stack, count - 1);
if (code < 0)
- return code;
+ return code;
for (i = 0; i < count; i++)
- *ref_stack_index(&o_stack, i) =
- *ref_stack_index(&o_stack, i + count);
+ *ref_stack_index(&o_stack, i) =
+ *ref_stack_index(&o_stack, i + count);
return 0;
}
@@ -106,7 +106,7 @@ zcopy_interval(i_ctx_t *i_ctx_p)
int code = copy_interval(i_ctx_p, op, 0, op1, "copy");
if (code < 0)
- return code;
+ return code;
r_set_size(op, r_size(op1));
*op1 = *op;
pop(1);
@@ -119,32 +119,32 @@ zlength(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
switch (r_type(op)) {
- case t_array:
- case t_string:
- case t_mixedarray:
- case t_shortarray:
- check_read(*op);
- make_int(op, r_size(op));
- return 0;
- case t_dictionary:
- check_dict_read(*op);
- make_int(op, dict_length(op));
- return 0;
- case t_name: {
- ref str;
-
- name_string_ref(imemory, op, &str);
- make_int(op, r_size(&str));
- return 0;
- }
- case t_astruct:
- if (gs_object_type(imemory, op->value.pstruct) != &st_bytes)
- return_error(e_typecheck);
- check_read(*op);
- make_int(op, gs_object_size(imemory, op->value.pstruct));
- return 0;
- default:
- return_op_typecheck(op);
+ case t_array:
+ case t_string:
+ case t_mixedarray:
+ case t_shortarray:
+ check_read(*op);
+ make_int(op, r_size(op));
+ return 0;
+ case t_dictionary:
+ check_dict_read(*op);
+ make_int(op, dict_length(op));
+ return 0;
+ case t_name: {
+ ref str;
+
+ name_string_ref(imemory, op, &str);
+ make_int(op, r_size(&str));
+ return 0;
+ }
+ case t_astruct:
+ if (gs_object_type(imemory, op->value.pstruct) != &st_bytes)
+ return_error(e_typecheck);
+ check_read(*op);
+ make_int(op, gs_object_size(imemory, op->value.pstruct));
+ return 0;
+ default:
+ return_op_typecheck(op);
}
}
@@ -159,30 +159,30 @@ zget(i_ctx_t *i_ctx_p)
ref *pvalue;
switch (r_type(op1)) {
- case t_dictionary:
- check_dict_read(*op1);
- if (dict_find(op1, op, &pvalue) <= 0)
- return_error(e_undefined);
- op[-1] = *pvalue;
- break;
- case t_string:
- check_read(*op1);
- check_int_ltu(*op, r_size(op1));
- make_int(op1, op1->value.bytes[(uint) op->value.intval]);
- break;
- case t_array:
- case t_mixedarray:
- case t_shortarray:
- check_type(*op, t_integer);
- check_read(*op1);
- code = array_get(imemory, op1, op->value.intval, op1);
- if (code < 0)
- return code;
- break;
+ case t_dictionary:
+ check_dict_read(*op1);
+ if (dict_find(op1, op, &pvalue) <= 0)
+ return_error(e_undefined);
+ op[-1] = *pvalue;
+ break;
+ case t_string:
+ check_read(*op1);
+ check_int_ltu(*op, r_size(op1));
+ make_int(op1, op1->value.bytes[(uint) op->value.intval]);
+ break;
+ case t_array:
+ case t_mixedarray:
+ case t_shortarray:
+ check_type(*op, t_integer);
+ check_read(*op1);
+ code = array_get(imemory, op1, op->value.intval, op1);
+ if (code < 0)
+ return code;
+ break;
case t__invalid:
return_error(e_stackunderflow);
default:
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
pop(1);
return 0;
@@ -201,45 +201,45 @@ zput(i_ctx_t *i_ctx_p)
uint ssize;
switch (r_type(op2)) {
- case t_dictionary:
- if (i_ctx_p->in_superexec == 0)
- check_dict_write(*op2);
- {
- int code = idict_put(op2, op1, op);
-
- if (code < 0)
- return code; /* error */
- }
- break;
- case t_array:
- check_write(*op2);
- check_int_ltu(*op1, r_size(op2));
- store_check_dest(op2, op);
- {
- ref *eltp = op2->value.refs + (uint) op1->value.intval;
-
- ref_assign_old(op2, eltp, op, "put");
- }
- break;
- case t_mixedarray: /* packed arrays are read-only */
- case t_shortarray:
- return_error(e_invalidaccess);
- case t_string:
- sdata = op2->value.bytes;
- ssize = r_size(op2);
+ case t_dictionary:
+ if (i_ctx_p->in_superexec == 0)
+ check_dict_write(*op2);
+ {
+ int code = idict_put(op2, op1, op);
+
+ if (code < 0)
+ return code; /* error */
+ }
+ break;
+ case t_array:
+ check_write(*op2);
+ check_int_ltu(*op1, r_size(op2));
+ store_check_dest(op2, op);
+ {
+ ref *eltp = op2->value.refs + (uint) op1->value.intval;
+
+ ref_assign_old(op2, eltp, op, "put");
+ }
+ break;
+ case t_mixedarray: /* packed arrays are read-only */
+ case t_shortarray:
+ return_error(e_invalidaccess);
+ case t_string:
+ sdata = op2->value.bytes;
+ ssize = r_size(op2);
str: check_write(*op2);
- check_int_ltu(*op1, ssize);
- check_int_leu(*op, 0xff);
- sdata[(uint)op1->value.intval] = (byte)op->value.intval;
- break;
- case t_astruct:
- if (gs_object_type(imemory, op2->value.pstruct) != &st_bytes)
- return_error(e_typecheck);
- sdata = r_ptr(op2, byte);
- ssize = gs_object_size(imemory, op2->value.pstruct);
- goto str;
- default:
- return_op_typecheck(op2);
+ check_int_ltu(*op1, ssize);
+ check_int_leu(*op, 0xff);
+ sdata[(uint)op1->value.intval] = (byte)op->value.intval;
+ break;
+ case t_astruct:
+ if (gs_object_type(imemory, op2->value.pstruct) != &st_bytes)
+ return_error(e_typecheck);
+ sdata = r_ptr(op2, byte);
+ ssize = gs_object_size(imemory, op2->value.pstruct);
+ goto str;
+ default:
+ return_op_typecheck(op2);
}
pop(3);
return 0;
@@ -265,33 +265,33 @@ zforceput(i_ctx_t *i_ctx_p)
switch (r_type(op2)) {
case t_array:
- check_int_ltu(*op1, r_size(op2));
- if (r_space(op2) > r_space(op)) {
- if (imemory_save_level(iimemory))
- return_error(e_invalidaccess);
- }
- {
- ref *eltp = op2->value.refs + (uint) op1->value.intval;
-
- ref_assign_old(op2, eltp, op, "put");
- }
- break;
+ check_int_ltu(*op1, r_size(op2));
+ if (r_space(op2) > r_space(op)) {
+ if (imemory_save_level(iimemory))
+ return_error(e_invalidaccess);
+ }
+ {
+ ref *eltp = op2->value.refs + (uint) op1->value.intval;
+
+ ref_assign_old(op2, eltp, op, "put");
+ }
+ break;
case t_dictionary:
- if (op2->value.pdict == systemdict->value.pdict ||
- !imemory_save_level(iimemory)
- ) {
- uint space = r_space(op2);
-
- r_set_space(op2, avm_local);
- code = idict_put(op2, op1, op);
- r_set_space(op2, space);
- } else
- code = idict_put(op2, op1, op);
- if (code < 0)
- return code;
- break;
+ if (op2->value.pdict == systemdict->value.pdict ||
+ !imemory_save_level(iimemory)
+ ) {
+ uint space = r_space(op2);
+
+ r_set_space(op2, avm_local);
+ code = idict_put(op2, op1, op);
+ r_set_space(op2, space);
+ } else
+ code = idict_put(op2, op1, op);
+ if (code < 0)
+ return code;
+ break;
default:
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
pop(3);
return 0;
@@ -308,12 +308,12 @@ zgetinterval(i_ctx_t *i_ctx_p)
uint count;
switch (r_type(op2)) {
- default:
- return_op_typecheck(op2);
- case t_array:
- case t_string:
- case t_mixedarray:
- case t_shortarray:;
+ default:
+ return_op_typecheck(op2);
+ case t_array:
+ case t_string:
+ case t_mixedarray:
+ case t_shortarray:;
}
check_read(*op2);
check_int_leu(*op1, r_size(op2));
@@ -321,23 +321,23 @@ zgetinterval(i_ctx_t *i_ctx_p)
check_int_leu(*op, r_size(op2) - index);
count = op->value.intval;
switch (r_type(op2)) {
- case t_array:
- op2->value.refs += index;
- break;
- case t_string:
- op2->value.bytes += index;
- break;
- case t_mixedarray: {
- const ref_packed *packed = op2->value.packed;
-
- for (; index--;)
- packed = packed_next(packed);
- op2->value.packed = packed;
- break;
- }
- case t_shortarray:
- op2->value.packed += index;
- break;
+ case t_array:
+ op2->value.refs += index;
+ break;
+ case t_string:
+ op2->value.bytes += index;
+ break;
+ case t_mixedarray: {
+ const ref_packed *packed = op2->value.packed;
+
+ for (; index--;)
+ packed = packed_next(packed);
+ op2->value.packed = packed;
+ break;
+ }
+ case t_shortarray:
+ op2->value.packed += index;
+ break;
}
r_set_size(op2, count);
pop(2);
@@ -356,43 +356,43 @@ zputinterval(i_ctx_t *i_ctx_p)
int code;
switch (r_type(opto)) {
- default:
+ default:
return_error(e_typecheck);
case t__invalid:
if (r_type(op) != t_array && r_type(op) != t_string && r_type(op) != t__invalid)
return_error(e_typecheck); /* to match Distiller */
else
return_error(e_stackunderflow);
- case t_mixedarray:
- case t_shortarray:
- return_error(e_invalidaccess);
- case t_array:
- case t_string:
- check_write(*opto);
- check_int_leu(*opindex, r_size(opto));
- code = copy_interval(i_ctx_p, opto, (uint)(opindex->value.intval),
- op, "putinterval");
- break;
- case t_astruct: {
- uint dsize, ssize, index;
-
- check_write(*opto);
- if (gs_object_type(imemory, opto->value.pstruct) != &st_bytes)
- return_error(e_typecheck);
- dsize = gs_object_size(imemory, opto->value.pstruct);
- check_int_leu(*opindex, dsize);
- index = (uint)opindex->value.intval;
- check_read_type(*op, t_string);
- ssize = r_size(op);
- if (ssize > dsize - index)
- return_error(e_rangecheck);
- memcpy(r_ptr(opto, byte) + index, op->value.const_bytes, ssize);
- code = 0;
- break;
- }
+ case t_mixedarray:
+ case t_shortarray:
+ return_error(e_invalidaccess);
+ case t_array:
+ case t_string:
+ check_write(*opto);
+ check_int_leu(*opindex, r_size(opto));
+ code = copy_interval(i_ctx_p, opto, (uint)(opindex->value.intval),
+ op, "putinterval");
+ break;
+ case t_astruct: {
+ uint dsize, ssize, index;
+
+ check_write(*opto);
+ if (gs_object_type(imemory, opto->value.pstruct) != &st_bytes)
+ return_error(e_typecheck);
+ dsize = gs_object_size(imemory, opto->value.pstruct);
+ check_int_leu(*opindex, dsize);
+ index = (uint)opindex->value.intval;
+ check_read_type(*op, t_string);
+ ssize = r_size(op);
+ if (ssize > dsize - index)
+ return_error(e_rangecheck);
+ memcpy(r_ptr(opto, byte) + index, op->value.const_bytes, ssize);
+ code = 0;
+ break;
+ }
}
if (code >= 0)
- pop(3);
+ pop(3);
return code;
}
@@ -415,27 +415,27 @@ zforall(i_ctx_t *i_ctx_p)
check_estack(6);
check_proc(*op);
switch (r_type(obj)) {
- default:
- return_op_typecheck(obj);
- case t_array:
- check_read(*obj);
- make_op_estack(cproc, array_continue);
- break;
- case t_dictionary:
- check_dict_read(*obj);
- make_int(cproc, dict_first(obj));
- ++cproc;
- make_op_estack(cproc, dict_continue);
- break;
- case t_string:
- check_read(*obj);
- make_op_estack(cproc, string_continue);
- break;
- case t_mixedarray:
- case t_shortarray:
- check_read(*obj);
- make_op_estack(cproc, packedarray_continue);
- break;
+ default:
+ return_op_typecheck(obj);
+ case t_array:
+ check_read(*obj);
+ make_op_estack(cproc, array_continue);
+ break;
+ case t_dictionary:
+ check_dict_read(*obj);
+ make_int(cproc, dict_first(obj));
+ ++cproc;
+ make_op_estack(cproc, dict_continue);
+ break;
+ case t_string:
+ check_read(*obj);
+ make_op_estack(cproc, string_continue);
+ break;
+ case t_mixedarray:
+ case t_shortarray:
+ check_read(*obj);
+ make_op_estack(cproc, packedarray_continue);
+ break;
}
/*
* Push:
@@ -460,16 +460,16 @@ array_continue(i_ctx_t *i_ctx_p)
es_ptr obj = esp - 1;
if (r_size(obj)) { /* continue */
- push(1);
- r_dec_size(obj, 1);
- *op = *obj->value.refs;
- obj->value.refs++;
- esp += 2;
- *esp = obj[1];
- return o_push_estack;
+ push(1);
+ r_dec_size(obj, 1);
+ *op = *obj->value.refs;
+ obj->value.refs++;
+ esp += 2;
+ *esp = obj[1];
+ return o_push_estack;
} else { /* done */
- esp -= 3; /* pop mark, object, proc */
- return o_pop_estack;
+ esp -= 3; /* pop mark, object, proc */
+ return o_pop_estack;
}
}
/* Continuation operator for dictionaries */
@@ -482,14 +482,14 @@ dict_continue(i_ctx_t *i_ctx_p)
push(2); /* make room for key and value */
if ((index = dict_next(obj, index, op - 1)) >= 0) { /* continue */
- esp->value.intval = index;
- esp += 2;
- *esp = obj[1];
- return o_push_estack;
+ esp->value.intval = index;
+ esp += 2;
+ *esp = obj[1];
+ return o_push_estack;
} else { /* done */
- pop(2); /* undo push */
- esp -= 4; /* pop mark, object, proc, index */
- return o_pop_estack;
+ pop(2); /* undo push */
+ esp -= 4; /* pop mark, object, proc, index */
+ return o_pop_estack;
}
}
/* Continuation operator for strings */
@@ -500,16 +500,16 @@ string_continue(i_ctx_t *i_ctx_p)
es_ptr obj = esp - 1;
if (r_size(obj)) { /* continue */
- r_dec_size(obj, 1);
- push(1);
- make_int(op, *obj->value.bytes);
- obj->value.bytes++;
- esp += 2;
- *esp = obj[1];
- return o_push_estack;
+ r_dec_size(obj, 1);
+ push(1);
+ make_int(op, *obj->value.bytes);
+ obj->value.bytes++;
+ esp += 2;
+ *esp = obj[1];
+ return o_push_estack;
} else { /* done */
- esp -= 3; /* pop mark, object, proc */
- return o_pop_estack;
+ esp -= 3; /* pop mark, object, proc */
+ return o_pop_estack;
}
}
/* Continuation operator for packed arrays */
@@ -520,18 +520,18 @@ packedarray_continue(i_ctx_t *i_ctx_p)
es_ptr obj = esp - 1;
if (r_size(obj)) { /* continue */
- const ref_packed *packed = obj->value.packed;
-
- r_dec_size(obj, 1);
- push(1);
- packed_get(imemory, packed, op);
- obj->value.packed = packed_next(packed);
- esp += 2;
- *esp = obj[1];
- return o_push_estack;
+ const ref_packed *packed = obj->value.packed;
+
+ r_dec_size(obj, 1);
+ push(1);
+ packed_get(imemory, packed, op);
+ obj->value.packed = packed_next(packed);
+ esp += 2;
+ *esp = obj[1];
+ return o_push_estack;
} else { /* done */
- esp -= 3; /* pop mark, object, proc */
- return o_pop_estack;
+ esp -= 3; /* pop mark, object, proc */
+ return o_pop_estack;
}
}
/* Vacuous cleanup procedure */
@@ -553,7 +553,7 @@ const op_def zgeneric_op_defs[] =
{"1length", zlength},
{"3put", zput},
{"3putinterval", zputinterval},
- /* Internal operators */
+ /* Internal operators */
{"0%array_continue", array_continue},
{"0%dict_continue", dict_continue},
{"0%packedarray_continue", packedarray_continue},
@@ -570,50 +570,50 @@ const op_def zgeneric_op_defs[] =
/* its length; nothing else has been checked. */
static int
copy_interval(i_ctx_t *i_ctx_p /* for ref_assign_old */, os_ptr prto,
- uint index, os_ptr prfrom, client_name_t cname)
+ uint index, os_ptr prfrom, client_name_t cname)
{
int fromtype = r_type(prfrom);
uint fromsize = r_size(prfrom);
if (!(fromtype == r_type(prto) ||
- ((fromtype == t_shortarray || fromtype == t_mixedarray) &&
- r_type(prto) == t_array))
- )
- return_op_typecheck(prfrom);
+ ((fromtype == t_shortarray || fromtype == t_mixedarray) &&
+ r_type(prto) == t_array))
+ )
+ return_op_typecheck(prfrom);
check_read(*prfrom);
check_write(*prto);
if (fromsize > r_size(prto) - index)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
switch (fromtype) {
- case t_array:
- { /* We have to worry about aliasing, */
- /* but refcpy_to_old takes care of it for us. */
- return refcpy_to_old(prto, index, prfrom->value.refs,
- fromsize, idmemory, cname);
- }
- case t_string:
- { /* memmove takes care of aliasing. */
- memmove(prto->value.bytes + index, prfrom->value.bytes,
- fromsize);
- }
- break;
- case t_mixedarray:
- case t_shortarray:
- { /* We don't have to worry about aliasing, because */
- /* packed arrays are read-only and hence the destination */
- /* can't be a packed array. */
- uint i;
- const ref_packed *packed = prfrom->value.packed;
- ref *pdest = prto->value.refs + index;
- ref elt;
-
- for (i = 0; i < fromsize; i++, pdest++) {
- packed_get(imemory, packed, &elt);
- ref_assign_old(prto, pdest, &elt, cname);
- packed = packed_next(packed);
- }
- }
- break;
+ case t_array:
+ { /* We have to worry about aliasing, */
+ /* but refcpy_to_old takes care of it for us. */
+ return refcpy_to_old(prto, index, prfrom->value.refs,
+ fromsize, idmemory, cname);
+ }
+ case t_string:
+ { /* memmove takes care of aliasing. */
+ memmove(prto->value.bytes + index, prfrom->value.bytes,
+ fromsize);
+ }
+ break;
+ case t_mixedarray:
+ case t_shortarray:
+ { /* We don't have to worry about aliasing, because */
+ /* packed arrays are read-only and hence the destination */
+ /* can't be a packed array. */
+ uint i;
+ const ref_packed *packed = prfrom->value.packed;
+ ref *pdest = prto->value.refs + index;
+ ref elt;
+
+ for (i = 0; i < fromsize; i++, pdest++) {
+ packed_get(imemory, packed, &elt);
+ ref_assign_old(prto, pdest, &elt, cname);
+ packed = packed_next(packed);
+ }
+ }
+ break;
}
return 0;
}
diff --git a/gs/psi/zgstate.c b/gs/psi/zgstate.c
index 8a030f0e9..1c06bfd24 100644
--- a/gs/psi/zgstate.c
+++ b/gs/psi/zgstate.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,10 +40,10 @@ zset_real(i_ctx_t *i_ctx_p, int (*set_proc)(gs_state *, floatp))
int code = real_param(op, &param);
if (code < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
code = set_proc(igs, param);
if (!code)
- pop(1);
+ pop(1);
return code;
}
@@ -114,11 +114,11 @@ int_gstate_alloc(const gs_dual_memory_t * dmem)
gs_state *pgs = gs_state_alloc((gs_memory_t *)lmem);
iigs = gs_alloc_struct((gs_memory_t *)lmem, int_gstate, &st_int_gstate,
- "int_gstate_alloc(int_gstate)");
+ "int_gstate_alloc(int_gstate)");
int_gstate_map_refs(iigs, make_null);
make_empty_array(&iigs->dash_pattern_array, a_all);
gs_alloc_ref_array(lmem, &proc0, a_readonly + a_executable, 2,
- "int_gstate_alloc(proc0)");
+ "int_gstate_alloc(proc0)");
make_oper(proc0.value.refs, 0, zpop);
make_real(proc0.value.refs + 1, 0.0);
iigs->black_generation = proc0;
@@ -130,8 +130,8 @@ int_gstate_alloc(const gs_dual_memory_t * dmem)
* global VM so that the gstate can be copied into global VM.
*/
prci = gs_alloc_struct((gs_memory_t *)gmem, int_remap_color_info_t,
- &st_int_remap_color_info,
- "int_gstate_alloc(remap color info)");
+ &st_int_remap_color_info,
+ "int_gstate_alloc(remap color info)");
make_struct(&iigs->remap_color_info, imemory_space(gmem), prci);
clear_pagedevice(iigs);
gs_state_set_client(pgs, iigs, &istate_procs, true);
@@ -185,19 +185,19 @@ static int
zsetlinewidth(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
- /*
- * The Red Book doesn't say anything about this, but Adobe
- * interpreters return (or perhaps store) the absolute value
- * of the width.
- */
+ /*
+ * The Red Book doesn't say anything about this, but Adobe
+ * interpreters return (or perhaps store) the absolute value
+ * of the width.
+ */
double width;
int code = real_param(op, &width);
if (code < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
code = gs_setlinewidth(igs, fabs(width));
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -221,7 +221,7 @@ zsetlinecap(i_ctx_t *i_ctx_p)
int code = int_param(op, max_int, &param);
if (code < 0 || (code = gs_setlinecap(igs, (gs_line_cap) param)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -246,7 +246,7 @@ zsetlinejoin(i_ctx_t *i_ctx_p)
int code = int_param(op, max_int, &param);
if (code < 0 || (code = gs_setlinejoin(igs, (gs_line_join) param)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -293,30 +293,30 @@ zsetdash(i_ctx_t *i_ctx_p)
float *pattern;
if (code < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
if (!r_is_array(op1))
- return_op_typecheck(op1);
+ return_op_typecheck(op1);
/* Adobe interpreters apparently don't check the array for */
/* read access, so we won't either. */
/*check_read(*op1); */
/* Unpack the dash pattern and check it */
n = r_size(op1);
pattern =
- (float *)gs_alloc_byte_array(mem, n, sizeof(float), "setdash");
+ (float *)gs_alloc_byte_array(mem, n, sizeof(float), "setdash");
if (pattern == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
for (i = 0, code = 0; i < n && code >= 0; ++i) {
- ref element;
+ ref element;
- array_get(mem, op1, (long)i, &element);
- code = float_param(&element, &pattern[i]);
+ array_get(mem, op1, (long)i, &element);
+ code = float_param(&element, &pattern[i]);
}
if (code >= 0)
- code = gs_setdash(igs, pattern, n, offset);
+ code = gs_setdash(igs, pattern, n, offset);
gs_free_object(mem, pattern, "setdash"); /* gs_setdash copies this */
if (code < 0)
- return code;
+ return code;
ref_assign(&istate->dash_pattern_array, op1);
pop(2);
return code;
@@ -377,10 +377,10 @@ zsetcurvejoin(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < -1 || op->value.intval > max_int)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = gs_setcurvejoin(igs, (int)op->value.intval);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -405,10 +405,10 @@ zsetfilladjust2(i_ctx_t *i_ctx_p)
int code = num_params(op, 2, adjust);
if (code < 0)
- return code;
+ return code;
code = gs_setfilladjust(igs, adjust[0], adjust[1]);
if (code < 0)
- return code;
+ return code;
pop(2);
return 0;
}
@@ -450,11 +450,11 @@ zsetdotlength(i_ctx_t *i_ctx_p)
int code = real_param(op - 1, &length);
if (code < 0)
- return code;
+ return code;
check_type(*op, t_boolean);
code = gs_setdotlength(igs, length, op->value.boolval);
if (code < 0)
- return code;
+ return code;
pop(2);
return 0;
}
diff --git a/gs/psi/zhsb.c b/gs/psi/zhsb.c
index 15ec8b7f5..87d45ee4f 100644
--- a/gs/psi/zhsb.c
+++ b/gs/psi/zhsb.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -41,9 +41,9 @@ zsethsbcolor(i_ctx_t *i_ctx_p)
int code;
if ((code = num_params(op, 3, par)) < 0 ||
- (code = gs_sethsbcolor(igs, par[0], par[1], par[2])) < 0
- )
- return code;
+ (code = gs_sethsbcolor(igs, par[0], par[1], par[2])) < 0
+ )
+ return code;
make_null(&istate->colorspace.array);
pop(3);
return 0;
diff --git a/gs/psi/zht.c b/gs/psi/zht.c
index 40d4d5c6f..a93b6a63e 100644
--- a/gs/psi/zht.c
+++ b/gs/psi/zht.c
@@ -18,7 +18,7 @@
#include "oper.h"
#include "estack.h"
#include "gsstruct.h" /* must precede igstate.h, */
- /* because of #ifdef in gsht.h */
+ /* because of #ifdef in gsht.h */
#include "ialloc.h"
#include "igstate.h"
#include "gsmatrix.h"
@@ -44,49 +44,49 @@ zcurrenthalftone(i_ctx_t *i_ctx_p)
gs_currenthalftone(igs, &ht);
switch (ht.type) {
- case ht_type_screen:
- push(4);
- make_real(op - 3, ht.params.screen.frequency);
- make_real(op - 2, ht.params.screen.angle);
- op[-1] = istate->screen_procs.gray;
- make_int(op, 1);
- break;
- case ht_type_colorscreen:
- push(13);
- {
- os_ptr opc = op - 12;
- gs_screen_halftone *pht =
- &ht.params.colorscreen.screens.colored.red;
+ case ht_type_screen:
+ push(4);
+ make_real(op - 3, ht.params.screen.frequency);
+ make_real(op - 2, ht.params.screen.angle);
+ op[-1] = istate->screen_procs.gray;
+ make_int(op, 1);
+ break;
+ case ht_type_colorscreen:
+ push(13);
+ {
+ os_ptr opc = op - 12;
+ gs_screen_halftone *pht =
+ &ht.params.colorscreen.screens.colored.red;
- make_real(opc, pht->frequency);
- make_real(opc + 1, pht->angle);
- opc[2] = istate->screen_procs.red;
+ make_real(opc, pht->frequency);
+ make_real(opc + 1, pht->angle);
+ opc[2] = istate->screen_procs.red;
- opc = op - 9;
- pht = &ht.params.colorscreen.screens.colored.green;
- make_real(opc, pht->frequency);
- make_real(opc + 1, pht->angle);
- opc[2] = istate->screen_procs.green;
+ opc = op - 9;
+ pht = &ht.params.colorscreen.screens.colored.green;
+ make_real(opc, pht->frequency);
+ make_real(opc + 1, pht->angle);
+ opc[2] = istate->screen_procs.green;
- opc = op - 6;
- pht = &ht.params.colorscreen.screens.colored.blue;
- make_real(opc, pht->frequency);
- make_real(opc + 1, pht->angle);
- opc[2] = istate->screen_procs.blue;
+ opc = op - 6;
+ pht = &ht.params.colorscreen.screens.colored.blue;
+ make_real(opc, pht->frequency);
+ make_real(opc + 1, pht->angle);
+ opc[2] = istate->screen_procs.blue;
- opc = op - 3;
- pht = &ht.params.colorscreen.screens.colored.gray;
- make_real(opc, pht->frequency);
- make_real(opc + 1, pht->angle);
- opc[2] = istate->screen_procs.gray;
- }
- make_int(op, 2);
- break;
- default: /* Screen was set by sethalftone. */
- push(2);
- op[-1] = istate->halftone;
- make_int(op, 0);
- break;
+ opc = op - 3;
+ pht = &ht.params.colorscreen.screens.colored.gray;
+ make_real(opc, pht->frequency);
+ make_real(opc + 1, pht->angle);
+ opc[2] = istate->screen_procs.gray;
+ }
+ make_int(op, 2);
+ break;
+ default: /* Screen was set by sethalftone. */
+ push(2);
+ op[-1] = istate->halftone;
+ make_int(op, 0);
+ break;
}
return 0;
}
@@ -131,26 +131,26 @@ zsetscreen(i_ctx_t *i_ctx_p)
int space_index = r_space_index(op);
if (code < 0)
- return code;
+ return code;
mem = (gs_memory_t *)idmemory->spaces_indexed[space_index];
/*
* Allocate the halftone in the same VM space as the procedure.
* This keeps the space relationships consistent.
*/
code = gs_screen_order_init_memory(&order, igs, &screen,
- gs_currentaccuratescreens(mem), mem);
+ gs_currentaccuratescreens(mem), mem);
if (code < 0)
- return code;
+ return code;
return zscreen_enum_init(i_ctx_p, &order, &screen, op, 3,
- setscreen_finish, space_index);
+ setscreen_finish, space_index);
}
/* We break out the body of this operator so it can be shared with */
/* the code for Type 1 halftones in sethalftone. */
int
zscreen_enum_init(i_ctx_t *i_ctx_p, const gx_ht_order * porder,
- gs_screen_halftone * psp, ref * pproc, int npop,
- int (*finish_proc)(i_ctx_t *), int space_index)
+ gs_screen_halftone * psp, ref * pproc, int npop,
+ int (*finish_proc)(i_ctx_t *), int space_index)
{
gs_screen_enum *penum;
gs_memory_t * mem = (gs_memory_t *)idmemory->spaces_indexed[space_index];
@@ -159,12 +159,12 @@ zscreen_enum_init(i_ctx_t *i_ctx_p, const gx_ht_order * porder,
check_estack(snumpush + 1);
penum = gs_screen_enum_alloc(mem, "setscreen");
if (penum == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_struct(esp + snumpush, space_index << r_space_shift, penum); /* do early for screen_cleanup in case of error */
code = gs_screen_enum_init_memory(penum, porder, igs, psp, mem);
if (code < 0) {
- screen_cleanup(i_ctx_p);
- return code;
+ screen_cleanup(i_ctx_p);
+ return code;
}
/* Push everything on the estack */
make_mark_estack(esp + 1, es_other, screen_cleanup);
@@ -186,17 +186,17 @@ screen_sample(i_ctx_t *i_ctx_p)
ref proc;
switch (code) {
- default:
- return code;
- case 1:
- /* All done */
- if (real_opproc(esp - 2) != 0)
- code = (*real_opproc(esp - 2)) (i_ctx_p);
- esp -= snumpush;
- screen_cleanup(i_ctx_p);
- return (code < 0 ? code : o_pop_estack);
- case 0:
- ;
+ default:
+ return code;
+ case 1:
+ /* All done */
+ if (real_opproc(esp - 2) != 0)
+ code = (*real_opproc(esp - 2)) (i_ctx_p);
+ esp -= snumpush;
+ screen_cleanup(i_ctx_p);
+ return (code < 0 ? code : o_pop_estack);
+ case 0:
+ ;
}
push(2);
make_real(op - 1, pt.x);
@@ -215,10 +215,10 @@ set_screen_continue(i_ctx_t *i_ctx_p)
int code = real_param(op, &value);
if (code < 0)
- return code;
+ return code;
code = gs_screen_next(senum, value);
if (code < 0)
- return code;
+ return code;
pop(1);
return screen_sample(i_ctx_p);
}
@@ -254,7 +254,7 @@ zscreen_params(os_ptr op, gs_screen_halftone * phs)
int code = num_params(op - 1, 2, fa);
if (code < 0)
- return code;
+ return code;
check_proc(*op);
phs->frequency = fa[0];
phs->angle = fa[1];
@@ -268,7 +268,7 @@ const op_def zht_op_defs[] =
{"0.currenthalftone", zcurrenthalftone},
{"0.currentscreenlevels", zcurrentscreenlevels},
{"3setscreen", zsetscreen},
- /* Internal operators */
+ /* Internal operators */
{"0%screen_sample", screen_sample},
{"1%set_screen_continue", set_screen_continue},
{"0%setscreen_finish", setscreen_finish},
diff --git a/gs/psi/zht1.c b/gs/psi/zht1.c
index a8e9a1114..1d92162ad 100644
--- a/gs/psi/zht1.c
+++ b/gs/psi/zht1.c
@@ -18,7 +18,7 @@
#include "oper.h"
#include "estack.h"
#include "gsstruct.h" /* must precede igstate.h, */
- /* because of #ifdef in gsht.h */
+ /* because of #ifdef in gsht.h */
#include "ialloc.h"
#include "igstate.h"
#include "gsmatrix.h"
@@ -52,54 +52,54 @@ zsetcolorscreen(i_ctx_t *i_ctx_p)
gs_memory_t *mem;
for (i = 0; i < 4; i++) {
- os_ptr op1 = op - 9 + i * 3;
- int code = zscreen_params(op1, &cscreen.screens.indexed[i]);
+ os_ptr op1 = op - 9 + i * 3;
+ int code = zscreen_params(op1, &cscreen.screens.indexed[i]);
- if (code < 0)
- return code;
- cscreen.screens.indexed[i].spot_function = spot_dummy;
- sprocs[i] = *op1;
- space = max(space, r_space_index(op1));
+ if (code < 0)
+ return code;
+ cscreen.screens.indexed[i].spot_function = spot_dummy;
+ sprocs[i] = *op1;
+ space = max(space, r_space_index(op1));
}
mem = (gs_memory_t *)idmemory->spaces_indexed[space];
check_estack(8); /* for sampling screens */
rc_alloc_struct_0(pht, gs_halftone, &st_halftone,
- mem, pht = 0, "setcolorscreen(halftone)");
+ mem, pht = 0, "setcolorscreen(halftone)");
rc_alloc_struct_0(pdht, gx_device_halftone, &st_device_halftone,
- mem, pdht = 0, "setcolorscreen(device halftone)");
+ mem, pdht = 0, "setcolorscreen(device halftone)");
if (pht == 0 || pdht == 0)
- code = gs_note_error(e_VMerror);
+ code = gs_note_error(e_VMerror);
else {
- pht->type = ht_type_colorscreen;
- pht->params.colorscreen = cscreen;
- code = gs_sethalftone_prepare(igs, pht, pdht);
+ pht->type = ht_type_colorscreen;
+ pht->params.colorscreen = cscreen;
+ code = gs_sethalftone_prepare(igs, pht, pdht);
}
if (code >= 0) { /* Schedule the sampling of the screens. */
- es_ptr esp0 = esp; /* for backing out */
+ es_ptr esp0 = esp; /* for backing out */
- esp += 8;
- make_mark_estack(esp - 7, es_other, setcolorscreen_cleanup);
- memcpy(esp - 6, sprocs, sizeof(ref) * 4); /* procs */
- make_istruct(esp - 2, 0, pht);
- make_istruct(esp - 1, 0, pdht);
- make_op_estack(esp, setcolorscreen_finish);
- for (i = 0; i < 4; i++) {
- /* Shuffle the indices to correspond to */
- /* the component order. */
- code = zscreen_enum_init(i_ctx_p,
- &pdht->components[(i + 1) & 3].corder,
- &pht->params.colorscreen.screens.indexed[i],
- &sprocs[i], 0, 0, space);
- if (code < 0) {
- esp = esp0;
- break;
- }
- }
+ esp += 8;
+ make_mark_estack(esp - 7, es_other, setcolorscreen_cleanup);
+ memcpy(esp - 6, sprocs, sizeof(ref) * 4); /* procs */
+ make_istruct(esp - 2, 0, pht);
+ make_istruct(esp - 1, 0, pdht);
+ make_op_estack(esp, setcolorscreen_finish);
+ for (i = 0; i < 4; i++) {
+ /* Shuffle the indices to correspond to */
+ /* the component order. */
+ code = zscreen_enum_init(i_ctx_p,
+ &pdht->components[(i + 1) & 3].corder,
+ &pht->params.colorscreen.screens.indexed[i],
+ &sprocs[i], 0, 0, space);
+ if (code < 0) {
+ esp = esp0;
+ break;
+ }
+ }
}
if (code < 0) {
- gs_free_object(mem, pdht, "setcolorscreen(device halftone)");
- gs_free_object(mem, pht, "setcolorscreen(halftone)");
- return code;
+ gs_free_object(mem, pdht, "setcolorscreen(device halftone)");
+ gs_free_object(mem, pht, "setcolorscreen(halftone)");
+ return code;
}
pop(12);
return o_push_estack;
@@ -114,7 +114,7 @@ setcolorscreen_finish(i_ctx_t *i_ctx_p)
pdht->order = pdht->components[0].corder;
code = gx_ht_install(igs, r_ptr(esp - 1, gs_halftone), pdht);
if (code < 0)
- return code;
+ return code;
istate->screen_procs.red = esp[-5];
istate->screen_procs.green = esp[-4];
istate->screen_procs.blue = esp[-3];
@@ -132,9 +132,9 @@ setcolorscreen_cleanup(i_ctx_t *i_ctx_p)
gx_device_halftone *pdht = r_ptr(esp + 7, gx_device_halftone);
gs_free_object(pdht->rc.memory, pdht,
- "setcolorscreen_cleanup(device halftone)");
+ "setcolorscreen_cleanup(device halftone)");
gs_free_object(pht->rc.memory, pht,
- "setcolorscreen_cleanup(halftone)");
+ "setcolorscreen_cleanup(halftone)");
return 0;
}
@@ -143,7 +143,7 @@ setcolorscreen_cleanup(i_ctx_t *i_ctx_p)
const op_def zht1_op_defs[] =
{
{"<setcolorscreen", zsetcolorscreen},
- /* Internal operators */
+ /* Internal operators */
{"0%setcolorscreen_finish", setcolorscreen_finish},
op_def_end(0)
};
diff --git a/gs/psi/zht2.c b/gs/psi/zht2.c
index 16515cfd6..c4d15e35e 100644
--- a/gs/psi/zht2.c
+++ b/gs/psi/zht2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,9 +34,9 @@ static int dict_spot_params(const ref *, gs_spot_halftone *, ref *, ref *,
gs_memory_t *);
static int dict_spot_results(i_ctx_t *, ref *, const gs_spot_halftone *);
static int dict_threshold_params(const ref *, gs_threshold_halftone *,
- ref *);
+ ref *);
static int dict_threshold2_params(const ref *, gs_threshold2_halftone *,
- ref *, gs_memory_t *);
+ ref *, gs_memory_t *);
/*
* This routine translates a gs_separation_name value into a character string
@@ -44,7 +44,7 @@ static int dict_threshold2_params(const ref *, gs_threshold2_halftone *,
*/
int
gs_get_colorname_string(const gs_memory_t *mem, gs_separation_name colorname_index,
- unsigned char **ppstr, unsigned int *pname_size)
+ unsigned char **ppstr, unsigned int *pname_size)
{
ref nref;
@@ -94,7 +94,7 @@ zsethalftone5(i_ctx_t *i_ctx_p)
check_dict_read(*op);
check_type(op[-1], t_dictionary);
check_dict_read(op[-1]);
-
+
/*
* We think that Type 2 and Type 4 halftones, like
* screens set by setcolorscreen, adapt automatically to
@@ -105,48 +105,48 @@ zsethalftone5(i_ctx_t *i_ctx_p)
if (code < 0)
return code;
halftonetype = (type == 2 || type == 4)
- ? ht_type_multiple_colorscreen
- : ht_type_multiple;
+ ? ht_type_multiple_colorscreen
+ : ht_type_multiple;
/* Count how many components that we will actually use. */
for (count = 0; ;) {
- bool have_default = false;
-
- /* Move to next element in the dictionary */
- if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
- break;
- /*
- * Verify that we have a valid component. We may have a
- * /HalfToneType entry.
- */
- if (!r_has_type(&rvalue[1], t_dictionary))
- continue;
-
- /* Get the name of the component verify that we will use it. */
- cname = name_index(mem, &rvalue[0]);
- code = gs_get_colorname_string(mem, cname, &pname, &name_size);
- if (code < 0)
- break;
- colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
- halftonetype);
- if (colorant_number < 0)
- continue;
- else if (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
- /* If here then we have the "Default" component */
- if (have_default)
- return_error(e_rangecheck);
- have_default = true;
- }
-
- count++;
- /*
- * Check to see if we have already reached the legal number of
- * components.
- */
- if (count > GS_CLIENT_COLOR_MAX_COMPONENTS + 1) {
- code = gs_note_error(e_rangecheck);
- break;
+ bool have_default = false;
+
+ /* Move to next element in the dictionary */
+ if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
+ break;
+ /*
+ * Verify that we have a valid component. We may have a
+ * /HalfToneType entry.
+ */
+ if (!r_has_type(&rvalue[1], t_dictionary))
+ continue;
+
+ /* Get the name of the component verify that we will use it. */
+ cname = name_index(mem, &rvalue[0]);
+ code = gs_get_colorname_string(mem, cname, &pname, &name_size);
+ if (code < 0)
+ break;
+ colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
+ halftonetype);
+ if (colorant_number < 0)
+ continue;
+ else if (colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS) {
+ /* If here then we have the "Default" component */
+ if (have_default)
+ return_error(e_rangecheck);
+ have_default = true;
+ }
+
+ count++;
+ /*
+ * Check to see if we have already reached the legal number of
+ * components.
+ */
+ if (count > GS_CLIENT_COLOR_MAX_COMPONENTS + 1) {
+ code = gs_note_error(e_rangecheck);
+ break;
}
}
if (code >= 0) {
@@ -154,194 +154,194 @@ zsethalftone5(i_ctx_t *i_ctx_p)
refset_null(sprocs, count);
refset_null(tprocs, count);
rc_alloc_struct_0(pht, gs_halftone, &st_halftone,
- imemory, pht = 0, ".sethalftone5");
+ imemory, pht = 0, ".sethalftone5");
phtc = gs_alloc_struct_array(mem, count, gs_halftone_component,
- &st_ht_component_element,
- ".sethalftone5");
+ &st_ht_component_element,
+ ".sethalftone5");
rc_alloc_struct_0(pdht, gx_device_halftone, &st_device_halftone,
- imemory, pdht = 0, ".sethalftone5");
+ imemory, pdht = 0, ".sethalftone5");
if (pht == 0 || phtc == 0 || pdht == 0) {
- j = 0; /* Quiet the compiler:
- gs_note_error isn't necessarily identity,
- so j could be left ununitialized. */
- code = gs_note_error(e_VMerror);
+ j = 0; /* Quiet the compiler:
+ gs_note_error isn't necessarily identity,
+ so j could be left ununitialized. */
+ code = gs_note_error(e_VMerror);
}
}
if (code >= 0) {
dict_enum = dict_first(op);
- for (j = 0, pc = phtc; ;) {
- int type;
-
- /* Move to next element in the dictionary */
- if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
- break;
- /*
- * Verify that we have a valid component. We may have a
- * /HalfToneType entry.
- */
- if (!r_has_type(&rvalue[1], t_dictionary))
- continue;
-
- /* Get the name of the component */
- cname = name_index(mem, &rvalue[0]);
- code = gs_get_colorname_string(mem, cname, &pname, &name_size);
- if (code < 0)
- break;
- colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
- halftonetype);
- if (colorant_number < 0)
- continue; /* Do not use this component */
- pc->cname = cname;
- pc->comp_number = colorant_number;
-
- /* Now process the component dictionary */
- check_dict_read(rvalue[1]);
- if (dict_int_param(&rvalue[1], "HalftoneType", 1, 7, 0, &type) < 0) {
- code = gs_note_error(e_typecheck);
- break;
- }
- switch (type) {
- default:
- code = gs_note_error(e_rangecheck);
- break;
- case 1:
- code = dict_spot_params(&rvalue[1], &pc->params.spot,
- sprocs + j, tprocs + j, mem);
- pc->params.spot.screen.spot_function = spot1_dummy;
- pc->type = ht_type_spot;
- break;
- case 3:
- code = dict_threshold_params(&rvalue[1], &pc->params.threshold,
- tprocs + j);
- pc->type = ht_type_threshold;
- break;
- case 7:
- code = dict_threshold2_params(&rvalue[1], &pc->params.threshold2,
- tprocs + j, imemory);
- pc->type = ht_type_threshold2;
- break;
- }
- if (code < 0)
- break;
- pc++;
- j++;
- }
+ for (j = 0, pc = phtc; ;) {
+ int type;
+
+ /* Move to next element in the dictionary */
+ if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
+ break;
+ /*
+ * Verify that we have a valid component. We may have a
+ * /HalfToneType entry.
+ */
+ if (!r_has_type(&rvalue[1], t_dictionary))
+ continue;
+
+ /* Get the name of the component */
+ cname = name_index(mem, &rvalue[0]);
+ code = gs_get_colorname_string(mem, cname, &pname, &name_size);
+ if (code < 0)
+ break;
+ colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
+ halftonetype);
+ if (colorant_number < 0)
+ continue; /* Do not use this component */
+ pc->cname = cname;
+ pc->comp_number = colorant_number;
+
+ /* Now process the component dictionary */
+ check_dict_read(rvalue[1]);
+ if (dict_int_param(&rvalue[1], "HalftoneType", 1, 7, 0, &type) < 0) {
+ code = gs_note_error(e_typecheck);
+ break;
+ }
+ switch (type) {
+ default:
+ code = gs_note_error(e_rangecheck);
+ break;
+ case 1:
+ code = dict_spot_params(&rvalue[1], &pc->params.spot,
+ sprocs + j, tprocs + j, mem);
+ pc->params.spot.screen.spot_function = spot1_dummy;
+ pc->type = ht_type_spot;
+ break;
+ case 3:
+ code = dict_threshold_params(&rvalue[1], &pc->params.threshold,
+ tprocs + j);
+ pc->type = ht_type_threshold;
+ break;
+ case 7:
+ code = dict_threshold2_params(&rvalue[1], &pc->params.threshold2,
+ tprocs + j, imemory);
+ pc->type = ht_type_threshold2;
+ break;
+ }
+ if (code < 0)
+ break;
+ pc++;
+ j++;
+ }
}
if (code >= 0) {
- pht->type = halftonetype;
- pht->params.multiple.components = phtc;
- pht->params.multiple.num_comp = j;
- pht->params.multiple.get_colorname_string = gs_get_colorname_string;
- code = gs_sethalftone_prepare(igs, pht, pdht);
+ pht->type = halftonetype;
+ pht->params.multiple.components = phtc;
+ pht->params.multiple.num_comp = j;
+ pht->params.multiple.get_colorname_string = gs_get_colorname_string;
+ code = gs_sethalftone_prepare(igs, pht, pdht);
}
if (code >= 0) {
- /*
- * Put the actual frequency and angle in the spot function component dictionaries.
- */
- dict_enum = dict_first(op);
- for (pc = phtc; ; ) {
- /* Move to next element in the dictionary */
- if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
- break;
-
- /* Verify that we have a valid component */
- if (!r_has_type(&rvalue[1], t_dictionary))
- continue;
-
- /* Get the name of the component and verify that we will use it. */
- cname = name_index(mem, &rvalue[0]);
- code = gs_get_colorname_string(mem, cname, &pname, &name_size);
- if (code < 0)
- break;
- colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
- halftonetype);
- if (colorant_number < 0)
- continue;
-
- if (pc->type == ht_type_spot) {
- code = dict_spot_results(i_ctx_p, &rvalue[1], &pc->params.spot);
- if (code < 0)
- break;
- }
- pc++;
- }
+ /*
+ * Put the actual frequency and angle in the spot function component dictionaries.
+ */
+ dict_enum = dict_first(op);
+ for (pc = phtc; ; ) {
+ /* Move to next element in the dictionary */
+ if ((dict_enum = dict_next(op, dict_enum, rvalue)) == -1)
+ break;
+
+ /* Verify that we have a valid component */
+ if (!r_has_type(&rvalue[1], t_dictionary))
+ continue;
+
+ /* Get the name of the component and verify that we will use it. */
+ cname = name_index(mem, &rvalue[0]);
+ code = gs_get_colorname_string(mem, cname, &pname, &name_size);
+ if (code < 0)
+ break;
+ colorant_number = gs_cname_to_colorant_number(pgs, pname, name_size,
+ halftonetype);
+ if (colorant_number < 0)
+ continue;
+
+ if (pc->type == ht_type_spot) {
+ code = dict_spot_results(i_ctx_p, &rvalue[1], &pc->params.spot);
+ if (code < 0)
+ break;
+ }
+ pc++;
+ }
}
if (code >= 0) {
- /*
- * Schedule the sampling of any Type 1 screens,
- * and any (Type 1 or Type 3) TransferFunctions.
- * Save the stack depths in case we have to back out.
- */
- uint odepth = ref_stack_count(&o_stack);
- ref odict, odict5;
-
- odict = op[-1];
- odict5 = *op;
- pop(2);
- op = osp;
- esp += 5;
- make_mark_estack(esp - 4, es_other, sethalftone_cleanup);
- esp[-3] = odict;
- make_istruct(esp - 2, 0, pht);
- make_istruct(esp - 1, 0, pdht);
- make_op_estack(esp, sethalftone_finish);
- for (j = 0; j < count; j++) {
- gx_ht_order *porder = NULL;
-
- if (pdht->components == 0)
- porder = &pdht->order;
- else {
- /* Find the component in pdht that matches component j in
- the pht; gs_sethalftone_prepare() may permute these. */
- int k;
- int comp_number = phtc[j].comp_number;
- for (k = 0; k < count; k++) {
- if (pdht->components[k].comp_number == comp_number) {
- porder = &pdht->components[k].corder;
- break;
- }
- }
- }
- switch (phtc[j].type) {
- case ht_type_spot:
- code = zscreen_enum_init(i_ctx_p, porder,
- &phtc[j].params.spot.screen,
- &sprocs[j], 0, 0, space_index);
- if (code < 0)
- break;
- /* falls through */
- case ht_type_threshold:
- if (!r_has_type(tprocs + j, t__invalid)) {
- /* Schedule TransferFunction sampling. */
- /****** check_xstack IS WRONG ******/
- check_ostack(zcolor_remap_one_ostack);
- check_estack(zcolor_remap_one_estack);
- code = zcolor_remap_one(i_ctx_p, tprocs + j,
- porder->transfer, igs,
- zcolor_remap_one_finish);
- op = osp;
- }
- break;
- default: /* not possible here, but to keep */
- /* the compilers happy.... */
- ;
- }
- if (code < 0) { /* Restore the stack. */
- ref_stack_pop_to(&o_stack, odepth);
- ref_stack_pop_to(&e_stack, edepth);
- op = osp;
- op[-1] = odict;
- *op = odict5;
- break;
- }
- npop = 0;
- }
+ /*
+ * Schedule the sampling of any Type 1 screens,
+ * and any (Type 1 or Type 3) TransferFunctions.
+ * Save the stack depths in case we have to back out.
+ */
+ uint odepth = ref_stack_count(&o_stack);
+ ref odict, odict5;
+
+ odict = op[-1];
+ odict5 = *op;
+ pop(2);
+ op = osp;
+ esp += 5;
+ make_mark_estack(esp - 4, es_other, sethalftone_cleanup);
+ esp[-3] = odict;
+ make_istruct(esp - 2, 0, pht);
+ make_istruct(esp - 1, 0, pdht);
+ make_op_estack(esp, sethalftone_finish);
+ for (j = 0; j < count; j++) {
+ gx_ht_order *porder = NULL;
+
+ if (pdht->components == 0)
+ porder = &pdht->order;
+ else {
+ /* Find the component in pdht that matches component j in
+ the pht; gs_sethalftone_prepare() may permute these. */
+ int k;
+ int comp_number = phtc[j].comp_number;
+ for (k = 0; k < count; k++) {
+ if (pdht->components[k].comp_number == comp_number) {
+ porder = &pdht->components[k].corder;
+ break;
+ }
+ }
+ }
+ switch (phtc[j].type) {
+ case ht_type_spot:
+ code = zscreen_enum_init(i_ctx_p, porder,
+ &phtc[j].params.spot.screen,
+ &sprocs[j], 0, 0, space_index);
+ if (code < 0)
+ break;
+ /* falls through */
+ case ht_type_threshold:
+ if (!r_has_type(tprocs + j, t__invalid)) {
+ /* Schedule TransferFunction sampling. */
+ /****** check_xstack IS WRONG ******/
+ check_ostack(zcolor_remap_one_ostack);
+ check_estack(zcolor_remap_one_estack);
+ code = zcolor_remap_one(i_ctx_p, tprocs + j,
+ porder->transfer, igs,
+ zcolor_remap_one_finish);
+ op = osp;
+ }
+ break;
+ default: /* not possible here, but to keep */
+ /* the compilers happy.... */
+ ;
+ }
+ if (code < 0) { /* Restore the stack. */
+ ref_stack_pop_to(&o_stack, odepth);
+ ref_stack_pop_to(&e_stack, edepth);
+ op = osp;
+ op[-1] = odict;
+ *op = odict5;
+ break;
+ }
+ npop = 0;
+ }
}
if (code < 0) {
- gs_free_object(mem, pdht, ".sethalftone5");
- gs_free_object(mem, phtc, ".sethalftone5");
- gs_free_object(mem, pht, ".sethalftone5");
- return code;
+ gs_free_object(mem, pdht, ".sethalftone5");
+ gs_free_object(mem, phtc, ".sethalftone5");
+ gs_free_object(mem, pht, ".sethalftone5");
+ return code;
}
pop(npop);
return (ref_stack_count(&e_stack) > edepth ? o_push_estack : 0);
@@ -355,10 +355,10 @@ sethalftone_finish(i_ctx_t *i_ctx_p)
int code;
if (pdht->components)
- pdht->order = pdht->components[0].corder;
+ pdht->order = pdht->components[0].corder;
code = gx_ht_install(igs, r_ptr(esp - 1, gs_halftone), pdht);
if (code < 0)
- return code;
+ return code;
istate->halftone = esp[-2];
esp -= 4;
sethalftone_cleanup(i_ctx_p);
@@ -372,9 +372,9 @@ sethalftone_cleanup(i_ctx_t *i_ctx_p)
gs_halftone *pht = r_ptr(&esp[3], gs_halftone);
gs_free_object(pdht->rc.memory, pdht,
- "sethalftone_cleanup(device halftone)");
+ "sethalftone_cleanup(device halftone)");
gs_free_object(pht->rc.memory, pht,
- "sethalftone_cleanup(halftone)");
+ "sethalftone_cleanup(halftone)");
return 0;
}
@@ -384,7 +384,7 @@ const op_def zht2_l2_op_defs[] =
{
op_def_begin_level2(),
{"2.sethalftone5", zsethalftone5},
- /* Internal operators */
+ /* Internal operators */
{"0%sethalftone_finish", sethalftone_finish},
op_def_end(0)
};
@@ -395,22 +395,22 @@ const op_def zht2_l2_op_defs[] =
/* from a dictionary. */
static int
dict_spot_params(const ref * pdict, gs_spot_halftone * psp,
- ref * psproc, ref * ptproc, gs_memory_t *mem)
+ ref * psproc, ref * ptproc, gs_memory_t *mem)
{
int code;
check_dict_read(*pdict);
if ((code = dict_float_param(pdict, "Frequency", 0.0,
- &psp->screen.frequency)) != 0 ||
- (code = dict_float_param(pdict, "Angle", 0.0,
- &psp->screen.angle)) != 0 ||
+ &psp->screen.frequency)) != 0 ||
+ (code = dict_float_param(pdict, "Angle", 0.0,
+ &psp->screen.angle)) != 0 ||
(code = dict_proc_param(pdict, "SpotFunction", psproc, false)) != 0 ||
- (code = dict_bool_param(pdict, "AccurateScreens",
- gs_currentaccuratescreens(mem),
- &psp->accurate_screens)) < 0 ||
+ (code = dict_bool_param(pdict, "AccurateScreens",
+ gs_currentaccuratescreens(mem),
+ &psp->accurate_screens)) < 0 ||
(code = dict_proc_param(pdict, "TransferFunction", ptproc, false)) < 0
- )
- return (code < 0 ? code : e_undefined);
+ )
+ return (code < 0 ? code : e_undefined);
psp->transfer = (code > 0 ? (gs_mapping_proc) 0 : gs_mapped_transfer);
psp->transfer_closure.proc = 0;
psp->transfer_closure.data = 0;
@@ -425,11 +425,11 @@ dict_real_result(i_ctx_t *i_ctx_p, ref * pdict, const char *kstr, floatp val)
ref *ignore;
if (dict_find_string(pdict, kstr, &ignore) > 0) {
- ref rval;
+ ref rval;
- check_dict_write(*pdict);
- make_real(&rval, val);
- code = idict_put_string(pdict, kstr, &rval);
+ check_dict_write(*pdict);
+ make_real(&rval, val);
+ code = idict_put_string(pdict, kstr, &rval);
}
return code;
}
@@ -439,30 +439,30 @@ dict_spot_results(i_ctx_t *i_ctx_p, ref * pdict, const gs_spot_halftone * psp)
int code;
code = dict_real_result(i_ctx_p, pdict, "ActualFrequency",
- psp->screen.actual_frequency);
+ psp->screen.actual_frequency);
if (code < 0)
- return code;
+ return code;
return dict_real_result(i_ctx_p, pdict, "ActualAngle",
- psp->screen.actual_angle);
+ psp->screen.actual_angle);
}
/* Extract Width, Height, and TransferFunction from a dictionary. */
static int
dict_threshold_common_params(const ref * pdict,
- gs_threshold_halftone_common * ptp,
- ref **pptstring, ref *ptproc)
+ gs_threshold_halftone_common * ptp,
+ ref **pptstring, ref *ptproc)
{
int code;
check_dict_read(*pdict);
if ((code = dict_int_param(pdict, "Width", 1, 0x7fff, -1,
- &ptp->width)) < 0 ||
- (code = dict_int_param(pdict, "Height", 1, 0x7fff, -1,
- &ptp->height)) < 0 ||
- (code = dict_find_string(pdict, "Thresholds", pptstring)) <= 0 ||
+ &ptp->width)) < 0 ||
+ (code = dict_int_param(pdict, "Height", 1, 0x7fff, -1,
+ &ptp->height)) < 0 ||
+ (code = dict_find_string(pdict, "Thresholds", pptstring)) <= 0 ||
(code = dict_proc_param(pdict, "TransferFunction", ptproc, false)) < 0
- )
- return (code < 0 ? code : e_undefined);
+ )
+ return (code < 0 ? code : e_undefined);
ptp->transfer_closure.proc = 0;
ptp->transfer_closure.data = 0;
return code;
@@ -471,19 +471,19 @@ dict_threshold_common_params(const ref * pdict,
/* Extract threshold common parameters + Thresholds. */
static int
dict_threshold_params(const ref * pdict, gs_threshold_halftone * ptp,
- ref * ptproc)
+ ref * ptproc)
{
ref *tstring;
int code =
- dict_threshold_common_params(pdict,
- (gs_threshold_halftone_common *)ptp,
- &tstring, ptproc);
+ dict_threshold_common_params(pdict,
+ (gs_threshold_halftone_common *)ptp,
+ &tstring, ptproc);
if (code < 0)
- return code;
+ return code;
check_read_type_only(*tstring, t_string);
if (r_size(tstring) != (long)ptp->width * ptp->height)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
ptp->thresholds.data = tstring->value.const_bytes;
ptp->thresholds.size = r_size(tstring);
ptp->transfer = (code > 0 ? (gs_mapping_proc) 0 : gs_mapped_transfer);
@@ -494,49 +494,49 @@ dict_threshold_params(const ref * pdict, gs_threshold_halftone * ptp,
/* BitsPerSample. */
static int
dict_threshold2_params(const ref * pdict, gs_threshold2_halftone * ptp,
- ref * ptproc, gs_memory_t *mem)
+ ref * ptproc, gs_memory_t *mem)
{
ref *tstring;
int code =
- dict_threshold_common_params(pdict,
- (gs_threshold_halftone_common *)ptp,
- &tstring, ptproc);
+ dict_threshold_common_params(pdict,
+ (gs_threshold_halftone_common *)ptp,
+ &tstring, ptproc);
int bps;
uint size;
int cw2, ch2;
if (code < 0 ||
- (code = cw2 = dict_int_param(pdict, "Width2", 0, 0x7fff, 0,
- &ptp->width2)) < 0 ||
- (code = ch2 = dict_int_param(pdict, "Height2", 0, 0x7fff, 0,
- &ptp->height2)) < 0 ||
- (code = dict_int_param(pdict, "BitsPerSample", 8, 16, -1, &bps)) < 0
- )
- return code;
+ (code = cw2 = dict_int_param(pdict, "Width2", 0, 0x7fff, 0,
+ &ptp->width2)) < 0 ||
+ (code = ch2 = dict_int_param(pdict, "Height2", 0, 0x7fff, 0,
+ &ptp->height2)) < 0 ||
+ (code = dict_int_param(pdict, "BitsPerSample", 8, 16, -1, &bps)) < 0
+ )
+ return code;
if ((bps != 8 && bps != 16) || cw2 != ch2 ||
- (!cw2 && (ptp->width2 == 0 || ptp->height2 == 0))
- )
- return_error(e_rangecheck);
+ (!cw2 && (ptp->width2 == 0 || ptp->height2 == 0))
+ )
+ return_error(e_rangecheck);
ptp->bytes_per_sample = bps / 8;
switch (r_type(tstring)) {
case t_string:
- size = r_size(tstring);
- gs_bytestring_from_string(&ptp->thresholds, tstring->value.const_bytes,
- size);
- break;
+ size = r_size(tstring);
+ gs_bytestring_from_string(&ptp->thresholds, tstring->value.const_bytes,
+ size);
+ break;
case t_astruct:
- if (gs_object_type(mem, tstring->value.pstruct) != &st_bytes)
- return_error(e_typecheck);
- size = gs_object_size(mem, tstring->value.pstruct);
- gs_bytestring_from_bytes(&ptp->thresholds, r_ptr(tstring, byte),
- 0, size);
- break;
+ if (gs_object_type(mem, tstring->value.pstruct) != &st_bytes)
+ return_error(e_typecheck);
+ size = gs_object_size(mem, tstring->value.pstruct);
+ gs_bytestring_from_bytes(&ptp->thresholds, r_ptr(tstring, byte),
+ 0, size);
+ break;
default:
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
check_read(*tstring);
if (size != (ptp->width * ptp->height + ptp->width2 * ptp->height2) *
- ptp->bytes_per_sample)
- return_error(e_rangecheck);
+ ptp->bytes_per_sample)
+ return_error(e_rangecheck);
return 0;
}
diff --git a/gs/psi/zht2.h b/gs/psi/zht2.h
index 1b6404254..5551184a4 100644
--- a/gs/psi/zht2.h
+++ b/gs/psi/zht2.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,9 +23,9 @@
* This routine translates a gs_separation_name value into a character string
* pointer and a string length.
*/
-int gs_get_colorname_string(const gs_memory_t *mem,
- gs_separation_name colorname_index,
- unsigned char **ppstr,
- unsigned int *pname_size);
+int gs_get_colorname_string(const gs_memory_t *mem,
+ gs_separation_name colorname_index,
+ unsigned char **ppstr,
+ unsigned int *pname_size);
#endif /* zht2_INCLUDED */
diff --git a/gs/psi/zicc.c b/gs/psi/zicc.c
index c2e581a97..80cedd27d 100644
--- a/gs/psi/zicc.c
+++ b/gs/psi/zicc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2008 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -50,11 +50,11 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
int i, expected = 0;
ref * pnameval;
static const char *const icc_std_profile_names[] = {
- GSICC_STANDARD_PROFILES
- };
+ GSICC_STANDARD_PROFILES
+ };
static const char *const icc_std_profile_keys[] = {
- GSICC_STANDARD_PROFILES_KEYS
- };
+ GSICC_STANDARD_PROFILES_KEYS
+ };
palt_cs = gs_currentcolorspace(igs);
@@ -69,11 +69,11 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
return gs_rethrow(code, "building color space object");
/* For now, dump the profile into a buffer
- and obtain handle from the buffer when we need it.
+ and obtain handle from the buffer when we need it.
We may want to change this later.
This depends to some degree on what the CMS is capable of doing.
I don't want to get bogged down on stream I/O at this point.
- Note also, if we are going to be putting these into the clist we will
+ Note also, if we are going to be putting these into the clist we will
want to have this buffer. */
/* Check if we have the /Name entry. This is used to associate with
specs that have enumerated types to indicate sRGB sGray etc */
@@ -87,7 +87,7 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
picc_profile = NULL;
for (k = 0; k < GSICC_NUMBER_STANDARD_PROFILES; k++) {
if ( strcmp( str, icc_std_profile_keys[k] ) == 0 ) {
- picc_profile = gsicc_get_profile_handle_file(icc_std_profile_names[k],
+ picc_profile = gsicc_get_profile_handle_file(icc_std_profile_names[k],
strlen(icc_std_profile_names[k]), gs_state_memory(igs));
break;
}
@@ -110,11 +110,11 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
/* We have to get the profile handle due to the fact that we need to know
if it has a data space that is CIELAB */
- picc_profile->profile_handle =
+ picc_profile->profile_handle =
gsicc_get_profile_handle_buffer(picc_profile->buffer,
picc_profile->buffer_size);
if (picc_profile->profile_handle == NULL) {
- /* Free up everything, the profile is not valid. We will end up going
+ /* Free up everything, the profile is not valid. We will end up going
ahead and using a default based upon the number of components */
rc_decrement(picc_profile,"seticc");
rc_decrement(pcs,"seticc");
@@ -122,32 +122,32 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
}
picc_profile->data_cs = gscms_get_profile_data_space(picc_profile->profile_handle);
switch( picc_profile->data_cs ) {
- case gsCIEXYZ:
- case gsCIELAB:
- case gsRGB:
- expected = 3;
- break;
- case gsGRAY:
- expected = 1;
- break;
- case gsCMYK:
- expected = 4;
- break;
- case gsNCHANNEL:
- expected = 0;
- break;
+ case gsCIEXYZ:
+ case gsCIELAB:
+ case gsRGB:
+ expected = 3;
+ break;
+ case gsGRAY:
+ expected = 1;
+ break;
+ case gsCMYK:
+ expected = 4;
+ break;
+ case gsNCHANNEL:
+ expected = 0;
+ break;
}
if (expected && ncomps != expected) {
- rc_decrement(picc_profile,"seticc");
- rc_decrement(pcs,"seticc");
- return_error(e_rangecheck);
+ rc_decrement(picc_profile,"seticc");
+ rc_decrement(pcs,"seticc");
+ return_error(e_rangecheck);
}
/* Lets go ahead and get the hash code and check if we match one of the default spaces */
/* Later we may want to delay this, but for now lets go ahead and do it */
gsicc_init_hash_cs(picc_profile, pis);
- /* Set the range according to the data type that is associated with the
+ /* Set the range according to the data type that is associated with the
ICC input color type. Occasionally, we will run into CIELAB to CIELAB
profiles for spot colors in PDF documents. These spot colors are typically described
as separation colors with tint transforms that go from a tint value
@@ -176,17 +176,17 @@ int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff)
for (i = 0; i < ncomps; i++) {
picc_profile->Range.ranges[i].rmin = range_buff[2 * i];
picc_profile->Range.ranges[i].rmax = range_buff[2 * i + 1];
- }
- }
+ }
+ }
/* Set the color space. We are done. No joint cache here... */
code = gs_setcolorspace(igs, pcs);
- /* In this case, we already have a ref count of 2 on the icc profile
+ /* In this case, we already have a ref count of 2 on the icc profile
one for when it was created and one for when it was set. We really
only want one here so adjust */
rc_decrement(picc_profile,"seticc");
/* Remove the ICC dict from the stack */
pop(1);
- return code;
+ return code;
}
/*
@@ -231,7 +231,7 @@ zseticcspace(i_ctx_t * i_ctx_p)
code = dict_find_string(op, "N", &pnval);
if (code < 0)
- return code;
+ return code;
ncomps = pnval->value.intval;
if (2*ncomps > sizeof(range_buff)/sizeof(range_buff[0]))
return_error(e_rangecheck);
@@ -264,8 +264,8 @@ zseticcspace(i_ctx_t * i_ctx_p)
* space, we use the range values only to restrict the set of input
* values; they are not used for normalization.
*/
- code = dict_floats_param( imemory,
- op,
+ code = dict_floats_param( imemory,
+ op,
"Range",
2 * ncomps,
range_buff,
@@ -277,7 +277,6 @@ zseticcspace(i_ctx_t * i_ctx_p)
return seticc(i_ctx_p, ncomps, op, range_buff);
}
-
/* Install a ICC type color space and use the ICC LABLUT profile. */
int
seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff)
@@ -288,7 +287,7 @@ seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff)
gs_imager_state * pis = (gs_imager_state *)igs;
int i;
static const char *const rfs = LAB_ICC;
- gs_param_string val, *pval;
+ gs_param_string val, *pval;
val.data = (const byte *)rfs;
val.size = strlen(rfs);
@@ -310,7 +309,7 @@ seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff)
should be initialized during the
setting of the user params */
return gs_rethrow(code, "cannot find lab icc profile");
- }
+ }
/* Assign the LAB to LAB profile to this color space */
code = gsicc_set_gscs_profile(pcs, pis->icc_manager->lab_profile, gs_state_memory(igs));
rc_increment(pis->icc_manager->lab_profile);
@@ -319,11 +318,11 @@ seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff)
pcs->cmm_icc_profile_data->Range.ranges[0].rmin = 0.0;
pcs->cmm_icc_profile_data->Range.ranges[0].rmax = 100.0;
for (i = 1; i < 3; i++) {
- pcs->cmm_icc_profile_data->Range.ranges[i].rmin =
+ pcs->cmm_icc_profile_data->Range.ranges[i].rmin =
range_buff[2 * (i-1)];
- pcs->cmm_icc_profile_data->Range.ranges[i].rmax =
+ pcs->cmm_icc_profile_data->Range.ranges[i].rmax =
range_buff[2 * (i-1) + 1];
- }
+ }
/* Set the color space. We are done. */
code = gs_setcolorspace(igs, pcs);
return code;
@@ -331,13 +330,13 @@ seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff)
/* Install an ICC space from the PDF CalRGB or CalGray types */
int
-seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
+seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
float *matrix, int num_colorants, ulong dictkey)
{
int code;
gs_color_space * pcs;
gs_imager_state * pis = (gs_imager_state *)igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
int i;
cmm_profile_t *cal_profile;
@@ -346,7 +345,7 @@ seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
if (pcs == NULL ) {
/* build the color space object. Since this is cached
in the profile cache which is a member variable
- of the graphic state, we will want to use stable
+ of the graphic state, we will want to use stable
memory here */
code = gs_cspace_build_ICC(&pcs, NULL, mem->stable_memory);
if (code < 0)
@@ -354,7 +353,7 @@ seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
/* There is no alternate for this. Perhaps we should set DeviceRGB? */
pcs->base_space = NULL;
/* Create the ICC profile from the CalRGB or CalGray parameters */
- cal_profile = gsicc_create_from_cal(white, black, gamma, matrix,
+ cal_profile = gsicc_create_from_cal(white, black, gamma, matrix,
mem->stable_memory, num_colorants);
if (cal_profile == NULL)
return gs_rethrow(-1, "creating the cal profile");
@@ -365,7 +364,7 @@ seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
for (i = 0; i < num_colorants; i++) {
pcs->cmm_icc_profile_data->Range.ranges[i].rmin = 0;
pcs->cmm_icc_profile_data->Range.ranges[i].rmax = 1;
- }
+ }
/* Add the color space to the profile cache */
gsicc_add_cs(igs, pcs,dictkey);
}
diff --git a/gs/psi/zicc.h b/gs/psi/zicc.h
index ba3603db9..148fc1975 100644
--- a/gs/psi/zicc.h
+++ b/gs/psi/zicc.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -19,6 +19,6 @@
int seticc(i_ctx_t * i_ctx_p, int ncomps, ref *ICCdict, float *range_buff);
int seticc_lab(i_ctx_t * i_ctx_p, float *white, float *black, float *range_buff);
-int seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
+int seticc_cal(i_ctx_t * i_ctx_p, float *white, float *black, float *gamma,
float *matrix, int num_colorants,ulong dictkey);
#endif /* zicc_INCLUDED */
diff --git a/gs/psi/zimage.c b/gs/psi/zimage.c
index c59f13008..60ac46c48 100644
--- a/gs/psi/zimage.c
+++ b/gs/psi/zimage.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -40,22 +40,20 @@
/* Forward references */
static int zimage_data_setup(i_ctx_t *i_ctx_p, const gs_pixel_image_t * pim,
- gx_image_enum_common_t * pie,
- const ref * sources, int npop);
+ gx_image_enum_common_t * pie,
+ const ref * sources, int npop);
static int image_proc_process(i_ctx_t *);
static int image_file_continue(i_ctx_t *);
static int image_string_continue(i_ctx_t *);
static int image_cleanup(i_ctx_t *);
-
-
/* Extract and check the parameters for a gs_data_image_t. */
int
-data_image_params(const gs_memory_t *mem,
- const ref *op, gs_data_image_t *pim,
- image_params *pip, bool require_DataSource,
- int num_components, int max_bits_per_component,
- bool has_alpha, bool islab)
+data_image_params(const gs_memory_t *mem,
+ const ref *op, gs_data_image_t *pim,
+ image_params *pip, bool require_DataSource,
+ int num_components, int max_bits_per_component,
+ bool has_alpha, bool islab)
{
int code;
int decode_size;
@@ -64,37 +62,37 @@ data_image_params(const gs_memory_t *mem,
check_type(*op, t_dictionary);
check_dict_read(*op);
if ((code = dict_int_param(op, "Width", 0, max_int_in_fixed / 2,
- -1, &pim->Width)) < 0 ||
- (code = dict_int_param(op, "Height", 0, max_int_in_fixed / 2,
- -1, &pim->Height)) < 0 ||
- (code = dict_matrix_param(mem, op, "ImageMatrix",
- &pim->ImageMatrix)) < 0 ||
- (code = dict_bool_param(op, "MultipleDataSources", false,
- &pip->MultipleDataSources)) < 0 ||
- (code = dict_int_param(op, "BitsPerComponent", 1,
- max_bits_per_component, -1,
- &pim->BitsPerComponent)) < 0 ||
- (code = dict_bool_param(op, "Interpolate", false,
- &pim->Interpolate)) < 0
- )
- return code;
+ -1, &pim->Width)) < 0 ||
+ (code = dict_int_param(op, "Height", 0, max_int_in_fixed / 2,
+ -1, &pim->Height)) < 0 ||
+ (code = dict_matrix_param(mem, op, "ImageMatrix",
+ &pim->ImageMatrix)) < 0 ||
+ (code = dict_bool_param(op, "MultipleDataSources", false,
+ &pip->MultipleDataSources)) < 0 ||
+ (code = dict_int_param(op, "BitsPerComponent", 1,
+ max_bits_per_component, -1,
+ &pim->BitsPerComponent)) < 0 ||
+ (code = dict_bool_param(op, "Interpolate", false,
+ &pim->Interpolate)) < 0
+ )
+ return code;
/* Decode size pulled out of here to catch case of Lab color space which
has a 4 entry range. We also do NOT want to do Lab decoding IF range
is the common -128 127 for a and b. Otherwise we end up doing multiple
- decode operations, since ICC flow will expect encoded data.
+ decode operations, since ICC flow will expect encoded data.
That is resolved later. Also discovered that PDF write will stick
6 entry range in wich appears to be OK as far as AR is concerned so
we have to handle that too. */
if (islab) {
- /* Note that it is possible that only the ab range values are there
+ /* Note that it is possible that only the ab range values are there
or the lab values. I have seen both cases.... */
code = decode_size = dict_floats_param(mem, op, "Decode", 4,
- &pim->Decode[2], NULL);
+ &pim->Decode[2], NULL);
if (code < 0) {
/* Try for all three */
code = decode_size = dict_floats_param(mem, op, "Decode", 6,
- &pim->Decode[0], NULL);
+ &pim->Decode[0], NULL);
} else {
/* Set the range on the L */
pim->Decode[0] = 0;
@@ -103,87 +101,87 @@ data_image_params(const gs_memory_t *mem,
if (code < 0) return code;
} else {
code = decode_size = dict_floats_param(mem, op, "Decode",
- num_components * 2,
- &pim->Decode[0], NULL);
+ num_components * 2,
+ &pim->Decode[0], NULL);
if (code < 0) return code;
}
pip->pDecode = &pim->Decode[0];
/* Extract and check the data sources. */
if ((code = dict_find_string(op, "DataSource", &pds)) <= 0) {
- if (require_DataSource)
- return (code < 0 ? code : gs_note_error(e_rangecheck));
- return 1; /* no data source */
+ if (require_DataSource)
+ return (code < 0 ? code : gs_note_error(e_rangecheck));
+ return 1; /* no data source */
}
if (pip->MultipleDataSources) {
- ref *ds = pip->DataSource;
+ ref *ds = pip->DataSource;
long i, n = num_components + (has_alpha ? 1 : 0);
if (!r_is_array(pds))
return_error(e_typecheck);
- if (r_size(pds) != n)
- return_error(e_rangecheck);
- for (i = 0; i < n; ++i)
- array_get(mem, pds, i, &ds[i]);
+ if (r_size(pds) != n)
+ return_error(e_rangecheck);
+ for (i = 0; i < n; ++i)
+ array_get(mem, pds, i, &ds[i]);
if (r_type(&ds[0]) == t_string) {
/* We don't have a problem with the strings of different length
* but Adobe does and CET tast 12-02.ps reports this as an error.
*/
- if (has_alpha)
+ if (has_alpha)
n--;
for (i = 1; i < n; ++i) {
if (r_type(&ds[i]) == t_string && r_size(&ds[i]) != r_size(&ds[0])) {
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
}
}
}
} else
- pip->DataSource[0] = *pds;
+ pip->DataSource[0] = *pds;
return 0;
}
/* Extract and check the parameters for a gs_pixel_image_t. */
int
pixel_image_params(i_ctx_t *i_ctx_p, const ref *op, gs_pixel_image_t *pim,
- image_params *pip, int max_bits_per_component,
- bool has_alpha, gs_color_space *csp)
+ image_params *pip, int max_bits_per_component,
+ bool has_alpha, gs_color_space *csp)
{
bool islab = false;
int num_components =
- gs_color_space_num_components(csp);
+ gs_color_space_num_components(csp);
int code;
if (num_components < 1)
- return_error(e_rangecheck); /* Pattern space not allowed */
+ return_error(e_rangecheck); /* Pattern space not allowed */
pim->ColorSpace = csp;
if (pim->ColorSpace->cmm_icc_profile_data != NULL)
islab = pim->ColorSpace->cmm_icc_profile_data->islab;
code = data_image_params(imemory, op, (gs_data_image_t *) pim, pip, true,
- num_components, max_bits_per_component,
- has_alpha, islab);
+ num_components, max_bits_per_component,
+ has_alpha, islab);
if (code < 0)
- return code;
+ return code;
pim->format =
- (pip->MultipleDataSources ? gs_image_format_component_planar :
- gs_image_format_chunky);
+ (pip->MultipleDataSources ? gs_image_format_component_planar :
+ gs_image_format_chunky);
return dict_bool_param(op, "CombineWithColor", false,
- &pim->CombineWithColor);
+ &pim->CombineWithColor);
}
/* Common setup for all Level 1 and 2 images, and ImageType 4 images. */
int
zimage_setup(i_ctx_t *i_ctx_p, const gs_pixel_image_t * pim,
- const ref * sources, bool uses_color, int npop)
+ const ref * sources, bool uses_color, int npop)
{
gx_image_enum_common_t *pie;
int code =
- gs_image_begin_typed((const gs_image_common_t *)pim, igs,
- uses_color, &pie);
+ gs_image_begin_typed((const gs_image_common_t *)pim, igs,
+ uses_color, &pie);
if (code < 0)
- return code;
+ return code;
return zimage_data_setup(i_ctx_p, (const gs_pixel_image_t *)pim, pie,
- sources, npop);
+ sources, npop);
}
/* Common code for .image1 and .alphaimage operators */
@@ -213,16 +211,16 @@ image1_setup(i_ctx_t * i_ctx_p, bool has_alpha)
op,
(gs_pixel_image_t *)&image,
&ip,
- (level2_enabled ? 16 : 8),
+ (level2_enabled ? 16 : 8),
has_alpha, csp);
if (code < 0)
- return code;
+ return code;
image.Alpha = (has_alpha ? gs_image_alpha_last : gs_image_alpha_none);
return zimage_setup( i_ctx_p,
(gs_pixel_image_t *)&image,
&ip.DataSource[0],
- image.CombineWithColor,
+ image.CombineWithColor,
1 );
}
@@ -243,16 +241,15 @@ zimagemask1(i_ctx_t *i_ctx_p)
int code;
gs_image_t_init_mask_adjust(&image, false,
- gs_incachedevice(igs) != CACHE_DEVICE_NONE);
+ gs_incachedevice(igs) != CACHE_DEVICE_NONE);
code = data_image_params(imemory, op, (gs_data_image_t *) & image,
- &ip, true, 1, 1, false, false);
+ &ip, true, 1, 1, false, false);
if (code < 0)
- return code;
+ return code;
return zimage_setup(i_ctx_p, (gs_pixel_image_t *)&image, &ip.DataSource[0],
- true, 1);
+ true, 1);
}
-
/* Common setup for all Level 1 and 2 images, and ImageType 3 and 4 images. */
/*
* We push the following on the estack.
@@ -286,7 +283,7 @@ zimagemask1(i_ctx_t *i_ctx_p)
#define ETOP_NUM_SOURCES(ep) ((ep) - 1)
static int
zimage_data_setup(i_ctx_t *i_ctx_p, const gs_pixel_image_t * pim,
- gx_image_enum_common_t * pie, const ref * sources, int npop)
+ gx_image_enum_common_t * pie, const ref * sources, int npop)
{
int num_sources = pie->num_planes;
int inumpush = NUM_PUSH(num_sources);
@@ -312,61 +309,61 @@ zimage_data_setup(i_ctx_t *i_ctx_p, const gs_pixel_image_t * pim,
* That is the reason for the aliasing information described above.
*/
for (px = 0, pp = sources; px < num_sources; px++, pp++) {
- es_ptr ep = EBOT_SOURCE(esp, px);
-
- make_int(ep + 1, 1); /* default is no aliasing */
- switch (r_type(pp)) {
- case t_file:
- if (!level2_enabled)
- return_error(e_typecheck);
- /* Check for aliasing. */
- {
- int pi;
-
- for (pi = 0; pi < px; ++pi)
- if (sources[pi].value.pfile == pp->value.pfile) {
- /* Record aliasing */
- make_int(ep + 1, -pi);
- EBOT_SOURCE(esp, pi)[1].value.intval++;
- break;
- }
- }
- string_sources = false;
- /* falls through */
- case t_string:
- if (r_type(pp) != r_type(sources)) {
- gx_image_end(pie, false); /* Clean up pie */
- return_error(e_typecheck);
- }
- check_read(*pp);
- break;
- default:
- if (!r_is_proc(sources)) {
- static const char ds[] = "DataSource";
+ es_ptr ep = EBOT_SOURCE(esp, px);
+
+ make_int(ep + 1, 1); /* default is no aliasing */
+ switch (r_type(pp)) {
+ case t_file:
+ if (!level2_enabled)
+ return_error(e_typecheck);
+ /* Check for aliasing. */
+ {
+ int pi;
+
+ for (pi = 0; pi < px; ++pi)
+ if (sources[pi].value.pfile == pp->value.pfile) {
+ /* Record aliasing */
+ make_int(ep + 1, -pi);
+ EBOT_SOURCE(esp, pi)[1].value.intval++;
+ break;
+ }
+ }
+ string_sources = false;
+ /* falls through */
+ case t_string:
+ if (r_type(pp) != r_type(sources)) {
+ gx_image_end(pie, false); /* Clean up pie */
+ return_error(e_typecheck);
+ }
+ check_read(*pp);
+ break;
+ default:
+ if (!r_is_proc(sources)) {
+ static const char ds[] = "DataSource";
gx_image_end(pie, false); /* Clean up pie */
gs_errorinfo_put_pair(i_ctx_p, ds, sizeof(ds) - 1, pp);
- return_error(e_typecheck);
- }
- check_proc(*pp);
- string_sources = false;
- }
- *ep = *pp;
+ return_error(e_typecheck);
+ }
+ check_proc(*pp);
+ string_sources = false;
+ }
+ *ep = *pp;
}
/* Always place the image enumerator into local memory,
because pie may have local objects inherited from igs,
- which may be local when the current allocation mode is global.
+ which may be local when the current allocation mode is global.
Bug 688140. */
if ((penum = gs_image_enum_alloc(imemory_local, "image_setup")) == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
code = gs_image_enum_init(penum, pie, (const gs_data_image_t *)pim, igs);
if (code != 0 || (pie->skipping && string_sources)) { /* error, or empty image */
- int code1 = gs_image_cleanup_and_free_enum(penum, igs);
+ int code1 = gs_image_cleanup_and_free_enum(penum, igs);
- if (code >= 0) /* empty image */
- pop(npop);
- if (code >= 0 && code1 < 0)
- code = code1;
- return code;
+ if (code >= 0) /* empty image */
+ pop(npop);
+ if (code >= 0 && code1 < 0)
+ code = code1;
+ return code;
}
push_mark_estack(es_other, image_cleanup);
esp += inumpush - 1;
@@ -374,15 +371,15 @@ zimage_data_setup(i_ctx_t *i_ctx_p, const gs_pixel_image_t * pim,
make_int(ETOP_NUM_SOURCES(esp), num_sources);
make_struct(esp, avm_local, penum);
switch (r_type(sources)) {
- case t_file:
- push_op_estack(image_file_continue);
- break;
- case t_string:
- push_op_estack(image_string_continue);
- break;
- default: /* procedure */
- push_op_estack(image_proc_process);
- break;
+ case t_file:
+ push_op_estack(image_file_continue);
+ break;
+ case t_string:
+ push_op_estack(image_string_continue);
+ break;
+ default: /* procedure */
+ push_op_estack(image_proc_process);
+ break;
}
pop(npop);
return o_push_estack;
@@ -412,39 +409,39 @@ image_proc_continue(i_ctx_t *i_ctx_p)
int i, code;
if (!r_has_type_attrs(op, t_string, a_read)) {
- check_op(1);
- /* Procedure didn't return a (readable) string. Quit. */
- esp = zimage_pop_estack(esp);
- image_cleanup(i_ctx_p);
- return_error(!r_has_type(op, t_string) ? e_typecheck : e_invalidaccess);
+ check_op(1);
+ /* Procedure didn't return a (readable) string. Quit. */
+ esp = zimage_pop_estack(esp);
+ image_cleanup(i_ctx_p);
+ return_error(!r_has_type(op, t_string) ? e_typecheck : e_invalidaccess);
}
size = r_size(op);
if (size == 0 && ETOP_SOURCE(esp, 0)[1].value.intval == 0)
- code = 1;
+ code = 1;
else {
- for (i = 0; i < num_sources; i++)
- plane_data[i].size = 0;
- plane_data[px].data = op->value.bytes;
- plane_data[px].size = size;
- code = gs_image_next_planes(penum, plane_data, used);
- if (code == e_RemapColor) {
- op->value.bytes += used[px]; /* skip used data */
- r_dec_size(op, used[px]);
- ETOP_SOURCE(esp, 0)[1].value.intval = 0; /* RemapColor callout */
- return code;
- }
+ for (i = 0; i < num_sources; i++)
+ plane_data[i].size = 0;
+ plane_data[px].data = op->value.bytes;
+ plane_data[px].size = size;
+ code = gs_image_next_planes(penum, plane_data, used);
+ if (code == e_RemapColor) {
+ op->value.bytes += used[px]; /* skip used data */
+ r_dec_size(op, used[px]);
+ ETOP_SOURCE(esp, 0)[1].value.intval = 0; /* RemapColor callout */
+ return code;
+ }
}
if (code) { /* Stop now. */
- esp = zimage_pop_estack(esp);
- pop(1);
- image_cleanup(i_ctx_p);
- return (code < 0 ? code : o_pop_estack);
+ esp = zimage_pop_estack(esp);
+ pop(1);
+ image_cleanup(i_ctx_p);
+ return (code < 0 ? code : o_pop_estack);
}
pop(1);
wanted = gs_image_planes_wanted(penum);
do {
- if (++px == num_sources)
- px = 0;
+ if (++px == num_sources)
+ px = 0;
} while (!wanted[px]);
ETOP_PLANE_INDEX(esp)->value.intval = px;
return image_proc_process(i_ctx_p);
@@ -460,9 +457,9 @@ image_proc_process(i_ctx_t *i_ctx_p)
ETOP_SOURCE(esp, 0)[1].value.intval = 0; /* procedure callout */
while (!wanted[px]) {
- if (++px == num_sources)
- px = 0;
- ETOP_PLANE_INDEX(esp)->value.intval = px;
+ if (++px == num_sources)
+ px = 0;
+ ETOP_PLANE_INDEX(esp)->value.intval = px;
}
pp = ETOP_SOURCE(esp, px);
push_op_estack(image_proc_continue);
@@ -478,94 +475,94 @@ image_file_continue(i_ctx_t *i_ctx_p)
int num_sources = ETOP_NUM_SOURCES(esp)->value.intval;
for (;;) {
- uint min_avail = max_int;
- gs_const_string plane_data[GS_IMAGE_MAX_COMPONENTS];
- int code;
- int px;
- const ref *pp;
- int at_eof_count = 0;
+ uint min_avail = max_int;
+ gs_const_string plane_data[GS_IMAGE_MAX_COMPONENTS];
+ int code;
+ int px;
+ const ref *pp;
+ int at_eof_count = 0;
int total_used;
- /*
- * Do a first pass through the files to ensure that at least
- * one has data available in its buffer.
- */
-
- for (px = 0, pp = ETOP_SOURCE(esp, 0); px < num_sources;
- ++px, pp -= 2
- ) {
- int num_aliases = pp[1].value.intval;
- stream *s = pp->value.pfile;
- int min_left;
- uint avail;
-
- if (num_aliases <= 0)
- num_aliases = ETOP_SOURCE(esp, -num_aliases)[1].value.intval;
- while ((avail = sbufavailable(s)) <=
- (min_left = sbuf_min_left(s)) + num_aliases - 1) {
- int next = s->end_status;
-
- switch (next) {
- case 0:
- s_process_read_buf(s);
- continue;
- case EOFC:
- at_eof_count++;
- break; /* with no data available */
- case INTC:
- case CALLC:
- return
- s_handle_read_exception(i_ctx_p, next, pp,
- NULL, 0, image_file_continue);
- default:
- /* case ERRC: */
- return_error(e_ioerror);
- }
- break; /* for EOFC */
- }
- /*
- * Note that in the EOF case, we can get here with no data
- * available.
- */
- if (avail >= min_left)
- avail = (avail - min_left) / num_aliases; /* may be 0 */
- if (avail < min_avail)
- min_avail = avail;
- plane_data[px].data = sbufptr(s);
- plane_data[px].size = avail;
- }
-
- /*
- * Now pass the available buffered data to the image processor.
- * Even if there is no available data, we must call
- * gs_image_next_planes one more time to finish processing any
- * retained data.
- */
-
- {
- int pi;
- uint used[GS_IMAGE_MAX_COMPONENTS];
-
- code = gs_image_next_planes(penum, plane_data, used);
- /* Now that used has been set, update the streams. */
- total_used = 0;
+ /*
+ * Do a first pass through the files to ensure that at least
+ * one has data available in its buffer.
+ */
+
+ for (px = 0, pp = ETOP_SOURCE(esp, 0); px < num_sources;
+ ++px, pp -= 2
+ ) {
+ int num_aliases = pp[1].value.intval;
+ stream *s = pp->value.pfile;
+ int min_left;
+ uint avail;
+
+ if (num_aliases <= 0)
+ num_aliases = ETOP_SOURCE(esp, -num_aliases)[1].value.intval;
+ while ((avail = sbufavailable(s)) <=
+ (min_left = sbuf_min_left(s)) + num_aliases - 1) {
+ int next = s->end_status;
+
+ switch (next) {
+ case 0:
+ s_process_read_buf(s);
+ continue;
+ case EOFC:
+ at_eof_count++;
+ break; /* with no data available */
+ case INTC:
+ case CALLC:
+ return
+ s_handle_read_exception(i_ctx_p, next, pp,
+ NULL, 0, image_file_continue);
+ default:
+ /* case ERRC: */
+ return_error(e_ioerror);
+ }
+ break; /* for EOFC */
+ }
+ /*
+ * Note that in the EOF case, we can get here with no data
+ * available.
+ */
+ if (avail >= min_left)
+ avail = (avail - min_left) / num_aliases; /* may be 0 */
+ if (avail < min_avail)
+ min_avail = avail;
+ plane_data[px].data = sbufptr(s);
+ plane_data[px].size = avail;
+ }
+
+ /*
+ * Now pass the available buffered data to the image processor.
+ * Even if there is no available data, we must call
+ * gs_image_next_planes one more time to finish processing any
+ * retained data.
+ */
+
+ {
+ int pi;
+ uint used[GS_IMAGE_MAX_COMPONENTS];
+
+ code = gs_image_next_planes(penum, plane_data, used);
+ /* Now that used has been set, update the streams. */
+ total_used = 0;
for (pi = 0, pp = ETOP_SOURCE(esp, 0); pi < num_sources;
- ++pi, pp -= 2 ) {
- sbufskip(pp->value.pfile, used[pi]);
+ ++pi, pp -= 2 ) {
+ sbufskip(pp->value.pfile, used[pi]);
total_used += used[pi];
}
- if (code == e_RemapColor)
- return code;
- }
- if (at_eof_count >= num_sources || (at_eof_count && total_used == 0))
- code = 1;
- if (code) {
- int code1;
-
- esp = zimage_pop_estack(esp);
- code1 = image_cleanup(i_ctx_p);
- return (code < 0 ? code : code1 < 0 ? code1 : o_pop_estack);
- }
+ if (code == e_RemapColor)
+ return code;
+ }
+ if (at_eof_count >= num_sources || (at_eof_count && total_used == 0))
+ code = 1;
+ if (code) {
+ int code1;
+
+ esp = zimage_pop_estack(esp);
+ code1 = image_cleanup(i_ctx_p);
+ return (code < 0 ? code : code1 < 0 ? code1 : o_pop_estack);
+ }
}
}
@@ -582,29 +579,29 @@ image_string_continue(i_ctx_t *i_ctx_p)
/* Pass no data initially, to find out how much is retained. */
memset(sources, 0, sizeof(sources[0]) * num_sources);
for (;;) {
- int px;
- int code = gs_image_next_planes(penum, sources, used);
+ int px;
+ int code = gs_image_next_planes(penum, sources, used);
- if (code == e_RemapColor)
- return code;
+ if (code == e_RemapColor)
+ return code;
stop_now:
- if (code) { /* Stop now. */
- esp -= NUM_PUSH(num_sources);
- image_cleanup(i_ctx_p);
- return (code < 0 ? code : o_pop_estack);
- }
- for (px = 0; px < num_sources; ++px)
- if (sources[px].size == 0) {
- const ref *psrc = ETOP_SOURCE(esp, px);
- uint size = r_size(psrc);
-
- if (size == 0) { /* empty source */
- code = 1;
- goto stop_now;
+ if (code) { /* Stop now. */
+ esp -= NUM_PUSH(num_sources);
+ image_cleanup(i_ctx_p);
+ return (code < 0 ? code : o_pop_estack);
+ }
+ for (px = 0; px < num_sources; ++px)
+ if (sources[px].size == 0) {
+ const ref *psrc = ETOP_SOURCE(esp, px);
+ uint size = r_size(psrc);
+
+ if (size == 0) { /* empty source */
+ code = 1;
+ goto stop_now;
}
- sources[px].data = psrc->value.bytes;
- sources[px].size = size;
- }
+ sources[px].data = psrc->value.bytes;
+ sources[px].size = size;
+ }
}
}
@@ -614,7 +611,7 @@ image_cleanup(i_ctx_t *i_ctx_p)
{
es_ptr ep_top = esp + NUM_PUSH(EBOT_NUM_SOURCES(esp)->value.intval);
gs_image_enum *penum = r_ptr(ep_top, gs_image_enum);
-
+
return gs_image_cleanup_and_free_enum(penum, igs);
}
@@ -624,7 +621,7 @@ const op_def zimage_op_defs[] =
{
{"1.image1", zimage1},
{"1.imagemask1", zimagemask1},
- /* Internal operators */
+ /* Internal operators */
{"1%image_proc_continue", image_proc_continue},
{"0%image_file_continue", image_file_continue},
{"0%image_string_continue", image_string_continue},
diff --git a/gs/psi/zimage2.c b/gs/psi/zimage2.c
index 09c147fef..3ae12c2af 100644
--- a/gs/psi/zimage2.c
+++ b/gs/psi/zimage2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -21,7 +21,6 @@
#include "iimage2.h"
#include "igstate.h" /* for igs */
-
/*
* Process an image that has no explicit source data. This isn't used by
* standard Level 2, but it's a very small procedure and is needed by
@@ -29,11 +28,11 @@
*/
int
process_non_source_image(i_ctx_t *i_ctx_p, const gs_image_common_t * pic,
- client_name_t cname)
+ client_name_t cname)
{
gx_image_enum_common_t *pie;
int code = gs_image_begin_typed(pic, igs, false /****** WRONG ******/ ,
- &pie);
+ &pie);
/* We didn't pass any data, so there's nothing to clean up. */
return code;
diff --git a/gs/psi/zimage3.c b/gs/psi/zimage3.c
index c4884ac49..117fe7cef 100644
--- a/gs/psi/zimage3.c
+++ b/gs/psi/zimage3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,41 +43,41 @@ zimage3(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
check_dict_read(*op);
if ((code = dict_int_param(op, "InterleaveType", 1, 3, -1,
- &interleave_type)) < 0
- )
- return code;
+ &interleave_type)) < 0
+ )
+ return code;
gs_image3_t_init(&image, NULL, interleave_type);
if (dict_find_string(op, "DataDict", &pDataDict) <= 0 ||
- dict_find_string(op, "MaskDict", &pMaskDict) <= 0
- )
- return_error(e_rangecheck);
+ dict_find_string(op, "MaskDict", &pMaskDict) <= 0
+ )
+ return_error(e_rangecheck);
if ((code = pixel_image_params(i_ctx_p, pDataDict,
- (gs_pixel_image_t *)&image, &ip_data,
- 12, false, gs_currentcolorspace(igs))) < 0 ||
- (mcode = code = data_image_params(imemory, pMaskDict, &image.MaskDict,
- &ip_mask, false, 1, 12, false, false)) < 0 ||
- (code = dict_int_param(pDataDict, "ImageType", 1, 1, 0, &ignored)) < 0 ||
- (code = dict_int_param(pMaskDict, "ImageType", 1, 1, 0, &ignored)) < 0
- )
- return code;
+ (gs_pixel_image_t *)&image, &ip_data,
+ 12, false, gs_currentcolorspace(igs))) < 0 ||
+ (mcode = code = data_image_params(imemory, pMaskDict, &image.MaskDict,
+ &ip_mask, false, 1, 12, false, false)) < 0 ||
+ (code = dict_int_param(pDataDict, "ImageType", 1, 1, 0, &ignored)) < 0 ||
+ (code = dict_int_param(pMaskDict, "ImageType", 1, 1, 0, &ignored)) < 0
+ )
+ return code;
/*
* MaskDict must have a DataSource iff InterleaveType == 3.
*/
if ((ip_data.MultipleDataSources && interleave_type != 3) ||
- ip_mask.MultipleDataSources ||
- mcode != (image.InterleaveType != 3)
- )
- return_error(e_rangecheck);
+ ip_mask.MultipleDataSources ||
+ mcode != (image.InterleaveType != 3)
+ )
+ return_error(e_rangecheck);
if (image.InterleaveType == 3) {
- /* Insert the mask DataSource before the data DataSources. */
- memmove(&ip_data.DataSource[1], &ip_data.DataSource[0],
- (countof(ip_data.DataSource) - 1) *
- sizeof(ip_data.DataSource[0]));
- ip_data.DataSource[0] = ip_mask.DataSource[0];
+ /* Insert the mask DataSource before the data DataSources. */
+ memmove(&ip_data.DataSource[1], &ip_data.DataSource[0],
+ (countof(ip_data.DataSource) - 1) *
+ sizeof(ip_data.DataSource[0]));
+ ip_data.DataSource[0] = ip_mask.DataSource[0];
}
return zimage_setup(i_ctx_p, (gs_pixel_image_t *)&image,
- &ip_data.DataSource[0],
- image.CombineWithColor, 1);
+ &ip_data.DataSource[0],
+ image.CombineWithColor, 1);
}
/* <dict> .image4 - */
@@ -88,38 +88,38 @@ zimage4(i_ctx_t *i_ctx_p)
gs_image4_t image;
image_params ip;
int num_components =
- gs_color_space_num_components(gs_currentcolorspace(igs));
+ gs_color_space_num_components(gs_currentcolorspace(igs));
int colors[countof(image.MaskColor)];
int code;
int i;
gs_image4_t_init(&image, NULL);
code = pixel_image_params(i_ctx_p, op, (gs_pixel_image_t *)&image, &ip,
- 12, false, gs_currentcolorspace(igs));
+ 12, false, gs_currentcolorspace(igs));
if (code < 0)
- return code;
+ return code;
code = dict_int_array_check_param(imemory, op, "MaskColor",
num_components * 2, colors, 0, e_rangecheck);
/* Clamp the color values to the unsigned range. */
if (code == num_components) {
- image.MaskColor_is_range = false;
- for (i = 0; i < code; ++i)
- image.MaskColor[i] = (colors[i] < 0 ? ~(uint)0 : colors[i]);
+ image.MaskColor_is_range = false;
+ for (i = 0; i < code; ++i)
+ image.MaskColor[i] = (colors[i] < 0 ? ~(uint)0 : colors[i]);
}
else if (code == num_components * 2) {
- image.MaskColor_is_range = true;
- for (i = 0; i < code; i += 2) {
- if (colors[i+1] < 0) /* no match possible */
- image.MaskColor[i] = 1, image.MaskColor[i+1] = 0;
- else {
- image.MaskColor[i+1] = colors[i+1];
- image.MaskColor[i] = max(colors[i], 0);
- }
- }
+ image.MaskColor_is_range = true;
+ for (i = 0; i < code; i += 2) {
+ if (colors[i+1] < 0) /* no match possible */
+ image.MaskColor[i] = 1, image.MaskColor[i+1] = 0;
+ else {
+ image.MaskColor[i+1] = colors[i+1];
+ image.MaskColor[i] = max(colors[i], 0);
+ }
+ }
} else
- return_error(code < 0 ? code : gs_note_error(e_rangecheck));
+ return_error(code < 0 ? code : gs_note_error(e_rangecheck));
return zimage_setup(i_ctx_p, (gs_pixel_image_t *)&image, &ip.DataSource[0],
- image.CombineWithColor, 1);
+ image.CombineWithColor, 1);
}
/* ------ Initialization procedure ------ */
diff --git a/gs/psi/ziodev2.c b/gs/psi/ziodev2.c
index f366cecd2..9b7d45e5f 100644
--- a/gs/psi/ziodev2.c
+++ b/gs/psi/ziodev2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -32,24 +32,24 @@ static iodev_proc_open_device(null_open);
const gx_io_device gs_iodev_null = {
"%null%", "Special",
{
- iodev_no_init, null_open, iodev_no_open_file,
- iodev_os_fopen, iodev_os_fclose,
- iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,
- iodev_no_enumerate_files, NULL, NULL,
- iodev_no_get_params, iodev_no_put_params
+ iodev_no_init, null_open, iodev_no_open_file,
+ iodev_os_fopen, iodev_os_fclose,
+ iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,
+ iodev_no_enumerate_files, NULL, NULL,
+ iodev_no_get_params, iodev_no_put_params
}
};
static int
null_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
if (!streq1(access, 'w'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
return file_open_stream(gp_null_file_name,
- strlen(gp_null_file_name),
- access, 256 /* arbitrary */ , ps,
- iodev, iodev->procs.fopen, mem);
+ strlen(gp_null_file_name),
+ access, 256 /* arbitrary */ , ps,
+ iodev, iodev->procs.fopen, mem);
}
/* ------ Operators ------ */
@@ -68,11 +68,11 @@ zgetdevparams(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
iodev = gs_findiodevice(imemory, op->value.bytes, r_size(op));
if (iodev == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
stack_param_list_write(&list, &o_stack, NULL, iimemory);
if ((code = gs_getdevparams(iodev, plist)) < 0) {
- ref_stack_pop(&o_stack, list.count * 2);
- return code;
+ ref_stack_pop(&o_stack, list.count * 2);
+ return code;
}
pmark = ref_stack_index(&o_stack, list.count * 2);
make_mark(pmark);
@@ -93,23 +93,23 @@ zputdevparams(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
iodev = gs_findiodevice(imemory, op->value.bytes, r_size(op));
if (iodev == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
code = stack_param_list_read(&list, &o_stack, 1, NULL, false, iimemory);
if (code < 0)
- return code;
+ return code;
code = dict_read_password(&system_params_password, systemdict,
- "SystemParamsPassword");
+ "SystemParamsPassword");
if (code < 0)
- return code;
+ return code;
code = param_check_password(plist, &system_params_password);
if (code != 0) {
- iparam_list_release(&list);
- return_error(code < 0 ? code : e_invalidaccess);
+ iparam_list_release(&list);
+ return_error(code < 0 ? code : e_invalidaccess);
}
code = gs_putdevparams(iodev, plist);
iparam_list_release(&list);
if (code < 0)
- return code;
+ return code;
ref_stack_pop(&o_stack, list.count * 2 + 2);
return 0;
}
diff --git a/gs/psi/ziodevs.c b/gs/psi/ziodevs.c
index 020b04e87..eedddab64 100644
--- a/gs/psi/ziodevs.c
+++ b/gs/psi/ziodevs.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
#include "oper.h"
#include "stream.h"
#include "gxiodev.h" /* must come after stream.h */
- /* and before files.h */
+ /* and before files.h */
#include "files.h"
#include "store.h"
@@ -28,11 +28,11 @@
const char iodev_dtype_stdio[] = "Special";
#define iodev_special(dname, init, open) {\
dname, iodev_dtype_stdio,\
- { init, open, iodev_no_open_file, iodev_no_fopen, iodev_no_fclose,\
- iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
- iodev_no_enumerate_files, NULL, NULL,\
- iodev_no_get_params, iodev_no_put_params\
- }\
+ { init, open, iodev_no_open_file, iodev_no_fopen, iodev_no_fclose,\
+ iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
+ iodev_no_enumerate_files, NULL, NULL,\
+ iodev_no_get_params, iodev_no_put_params\
+ }\
}
/*
@@ -71,7 +71,7 @@ const gx_io_device gs_iodev_stderr =
static int
s_stdin_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
stdin_init(gx_io_device * iodev, gs_memory_t * mem)
@@ -84,49 +84,49 @@ stdin_init(gx_io_device * iodev, gs_memory_t * mem)
/* If interactive, only read one character. */
static int
s_stdin_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
FILE *file = ((stream *) st)->file; /* hack for file streams */
int wcount = (int)(pw->limit - pw->ptr);
int count;
if (wcount <= 0)
- return 0;
+ return 0;
count = gp_stdin_read( (char*) pw->ptr + 1, wcount,
- st->memory->gs_lib_ctx->stdin_is_interactive, file);
+ st->memory->gs_lib_ctx->stdin_is_interactive, file);
pw->ptr += (count < 0) ? 0 : count;
return ((count < 0) ? ERRC : (count == 0) ? EOFC : count);
}
static int
stdin_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'r'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stdin)) {
- /****** stdin SHOULD NOT LINE-BUFFER ******/
- gs_memory_t *mem = imemory_system;
- byte *buf;
+ /****** stdin SHOULD NOT LINE-BUFFER ******/
+ gs_memory_t *mem = imemory_system;
+ byte *buf;
- s = file_alloc_stream(mem, "stdin_open(stream)");
- /* We want stdin to read only one character at a time, */
- /* but it must have a substantial buffer, in case it is used */
- /* by a stream that requires more than one input byte */
- /* to make progress. */
- buf = gs_alloc_bytes(mem, STDIN_BUF_SIZE, "stdin_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
- sread_file(s, gs_stdin, buf, STDIN_BUF_SIZE);
- s->procs.process = s_stdin_read_process;
- s->save_close = s_std_null;
- s->procs.close = file_close_file;
- make_file(&ref_stdin, a_readonly | avm_system, s->read_id, s);
- *ps = s;
- return 1;
+ s = file_alloc_stream(mem, "stdin_open(stream)");
+ /* We want stdin to read only one character at a time, */
+ /* but it must have a substantial buffer, in case it is used */
+ /* by a stream that requires more than one input byte */
+ /* to make progress. */
+ buf = gs_alloc_bytes(mem, STDIN_BUF_SIZE, "stdin_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+ sread_file(s, gs_stdin, buf, STDIN_BUF_SIZE);
+ s->procs.process = s_stdin_read_process;
+ s->save_close = s_std_null;
+ s->procs.close = file_close_file;
+ make_file(&ref_stdin, a_readonly | avm_system, s->read_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -140,8 +140,8 @@ zget_stdin(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stdin)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice((const byte *)"%stdin", 6);
iodev->state = i_ctx_p;
@@ -158,49 +158,49 @@ zis_stdin(const stream *s)
static int
s_stdout_swrite_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
/* Write a buffer to stdout, potentially writing to callback */
static int
s_stdout_write_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
uint count = pr->limit - pr->ptr;
int written;
- if (count == 0)
- return 0;
+ if (count == 0)
+ return 0;
written = outwrite(st->memory, pr->ptr + 1, count);
if (written < count) {
- return ERRC;
+ return ERRC;
pr->ptr += written;
return 0;
}
static int
stdout_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'w'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stdout)) {
- gs_memory_t *mem = imemory_system;
- byte *buf;
+ gs_memory_t *mem = imemory_system;
+ byte *buf;
- s = file_alloc_stream(mem, "stdout_open(stream)");
- buf = gs_alloc_bytes(mem, STDOUT_BUF_SIZE, "stdout_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
- swrite_file(s, gs_stdout, buf, STDOUT_BUF_SIZE);
- s->save_close = s->procs.flush;
- s->procs.close = file_close_file;
- s->procs.process = s_stdout_write_process;
- make_file(&ref_stdout, a_write | avm_system, s->write_id, s);
- *ps = s;
- return 1;
+ s = file_alloc_stream(mem, "stdout_open(stream)");
+ buf = gs_alloc_bytes(mem, STDOUT_BUF_SIZE, "stdout_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+ swrite_file(s, gs_stdout, buf, STDOUT_BUF_SIZE);
+ s->save_close = s->procs.flush;
+ s->procs.close = file_close_file;
+ s->procs.process = s_stdout_write_process;
+ make_file(&ref_stdout, a_write | avm_system, s->write_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -214,8 +214,8 @@ zget_stdout(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stdout)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice((const byte *)"%stdout", 7);
iodev->state = i_ctx_p;
@@ -226,27 +226,27 @@ zget_stdout(i_ctx_t *i_ctx_p, stream ** ps)
static int
stderr_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'w'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stderr)) {
- gs_memory_t *mem = imemory_system;
- byte *buf;
+ gs_memory_t *mem = imemory_system;
+ byte *buf;
- s = file_alloc_stream(mem, "stderr_open(stream)");
- buf = gs_alloc_bytes(mem, STDERR_BUF_SIZE, "stderr_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
- swrite_file(s, gs_stderr, buf, STDERR_BUF_SIZE);
- s->save_close = s->procs.flush;
- s->procs.close = file_close_file;
- make_file(&ref_stderr, a_write | avm_system, s->write_id, s);
- *ps = s;
- return 1;
+ s = file_alloc_stream(mem, "stderr_open(stream)");
+ buf = gs_alloc_bytes(mem, STDERR_BUF_SIZE, "stderr_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+ swrite_file(s, gs_stderr, buf, STDERR_BUF_SIZE);
+ s->save_close = s->procs.flush;
+ s->procs.close = file_close_file;
+ make_file(&ref_stderr, a_write | avm_system, s->write_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -260,8 +260,8 @@ zget_stderr(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stderr)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice((const byte *)"%stderr", 7);
iodev->state = i_ctx_p;
diff --git a/gs/psi/ziodevsc.c b/gs/psi/ziodevsc.c
index 72378c12b..ab508bcd8 100644
--- a/gs/psi/ziodevsc.c
+++ b/gs/psi/ziodevsc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
#include "oper.h"
#include "stream.h"
#include "gxiodev.h" /* must come after stream.h */
- /* and before files.h */
+ /* and before files.h */
#include "istream.h"
#include "files.h"
#include "ifilter.h"
@@ -30,11 +30,11 @@
const char iodev_dtype_stdio[] = "Special";
#define iodev_special(dname, init, open) {\
dname, iodev_dtype_stdio,\
- { init, open, iodev_no_open_file, iodev_no_fopen, iodev_no_fclose,\
- iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
- iodev_no_enumerate_files, NULL, NULL,\
- iodev_no_get_params, iodev_no_put_params\
- }\
+ { init, open, iodev_no_open_file, iodev_no_fopen, iodev_no_fclose,\
+ iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,\
+ iodev_no_enumerate_files, NULL, NULL,\
+ iodev_no_get_params, iodev_no_put_params\
+ }\
}
/*
@@ -73,7 +73,7 @@ const gx_io_device gs_iodev_stderr =
static int
s_stdin_read_process(stream_state *, stream_cursor_read *,
- stream_cursor_write *, bool);
+ stream_cursor_write *, bool);
static int
stdin_init(gx_io_device * iodev, gs_memory_t * mem)
@@ -86,24 +86,24 @@ stdin_init(gx_io_device * iodev, gs_memory_t * mem)
/* If interactive, only read one character. */
static int
s_stdin_read_process(stream_state * st, stream_cursor_read * ignore_pr,
- stream_cursor_write * pw, bool last)
+ stream_cursor_write * pw, bool last)
{
int wcount = (int)(pw->limit - pw->ptr);
int count;
gs_memory_t *mem = st->memory;
if (wcount <= 0)
- return 0;
+ return 0;
/* do the callout */
if (mem->gs_lib_ctx->stdin_fn)
- count = (*mem->gs_lib_ctx->stdin_fn)
- (mem->gs_lib_ctx->caller_handle, (char *)pw->ptr + 1,
- mem->gs_lib_ctx->stdin_is_interactive ? 1 : wcount);
+ count = (*mem->gs_lib_ctx->stdin_fn)
+ (mem->gs_lib_ctx->caller_handle, (char *)pw->ptr + 1,
+ mem->gs_lib_ctx->stdin_is_interactive ? 1 : wcount);
else
- count = gp_stdin_read((char *)pw->ptr + 1, wcount,
- mem->gs_lib_ctx->stdin_is_interactive,
- mem->gs_lib_ctx->fstdin);
+ count = gp_stdin_read((char *)pw->ptr + 1, wcount,
+ mem->gs_lib_ctx->stdin_is_interactive,
+ mem->gs_lib_ctx->fstdin);
pw->ptr += (count < 0) ? 0 : count;
return ((count < 0) ? ERRC : (count == 0) ? EOFC : count);
@@ -111,41 +111,41 @@ s_stdin_read_process(stream_state * st, stream_cursor_read * ignore_pr,
static int
stdin_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'r'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stdin)) {
- /****** stdin SHOULD NOT LINE-BUFFER ******/
- gs_memory_t *sysmem = imemory_system;
- byte *buf;
- static const stream_procs p = {
- s_std_noavailable, s_std_noseek, s_std_read_reset,
- s_std_read_flush, file_close_file, s_stdin_read_process
- };
-
- s = file_alloc_stream(sysmem, "stdin_open(stream)");
-
- /* We want stdin to read only one character at a time, */
- /* but it must have a substantial buffer, in case it is used */
- /* by a stream that requires more than one input byte */
- /* to make progress. */
- buf = gs_alloc_bytes(sysmem, STDIN_BUF_SIZE, "stdin_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
-
- s_std_init(s, buf, STDIN_BUF_SIZE, &p, s_mode_read);
- s->file = 0;
- s->file_modes = s->modes;
- s->file_offset = 0;
- s->file_limit = max_long;
- s->save_close = s_std_null;
- make_file(&ref_stdin, a_readonly | avm_system, s->read_id, s);
- *ps = s;
- return 1;
+ /****** stdin SHOULD NOT LINE-BUFFER ******/
+ gs_memory_t *sysmem = imemory_system;
+ byte *buf;
+ static const stream_procs p = {
+ s_std_noavailable, s_std_noseek, s_std_read_reset,
+ s_std_read_flush, file_close_file, s_stdin_read_process
+ };
+
+ s = file_alloc_stream(sysmem, "stdin_open(stream)");
+
+ /* We want stdin to read only one character at a time, */
+ /* but it must have a substantial buffer, in case it is used */
+ /* by a stream that requires more than one input byte */
+ /* to make progress. */
+ buf = gs_alloc_bytes(sysmem, STDIN_BUF_SIZE, "stdin_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+
+ s_std_init(s, buf, STDIN_BUF_SIZE, &p, s_mode_read);
+ s->file = 0;
+ s->file_modes = s->modes;
+ s->file_offset = 0;
+ s->file_limit = max_long;
+ s->save_close = s_std_null;
+ make_file(&ref_stdin, a_readonly | avm_system, s->read_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -159,8 +159,8 @@ zget_stdin(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stdin)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice(imemory, (const byte *)"%stdin", 6);
iodev->state = i_ctx_p;
@@ -179,50 +179,50 @@ zis_stdin(const stream *s)
/* Write a buffer to stdout, potentially writing to callback */
static int
s_stdout_write_process(stream_state * st, stream_cursor_read *pr,
- stream_cursor_write *ignore_pw, bool last)
+ stream_cursor_write *ignore_pw, bool last)
{
uint count = pr->limit - pr->ptr;
int written;
- if (count == 0)
- return 0;
+ if (count == 0)
+ return 0;
written = outwrite(st->memory, (const char *)pr->ptr + 1, count);
if (written < count)
- return ERRC;
+ return ERRC;
pr->ptr += written;
return 0;
}
static int
stdout_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'w'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stdout)) {
- gs_memory_t *sysmem = imemory_system;
- byte *buf;
- static const stream_procs p = {
- s_std_noavailable, s_std_noseek, s_std_write_reset,
- s_std_write_flush, file_close_file, s_stdout_write_process
- };
-
- s = file_alloc_stream(sysmem, "stdout_open(stream)");
- buf = gs_alloc_bytes(sysmem, STDOUT_BUF_SIZE, "stdout_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
- s_std_init(s, buf, STDOUT_BUF_SIZE, &p, s_mode_write);
- s->file = 0;
- s->file_modes = s->modes;
- s->file_offset = 0; /* in case we switch to reading later */
- s->file_limit = max_long; /* ibid. */
- s->save_close = s->procs.flush;
- make_file(&ref_stdout, a_write | avm_system, s->write_id, s);
- *ps = s;
- return 1;
+ gs_memory_t *sysmem = imemory_system;
+ byte *buf;
+ static const stream_procs p = {
+ s_std_noavailable, s_std_noseek, s_std_write_reset,
+ s_std_write_flush, file_close_file, s_stdout_write_process
+ };
+
+ s = file_alloc_stream(sysmem, "stdout_open(stream)");
+ buf = gs_alloc_bytes(sysmem, STDOUT_BUF_SIZE, "stdout_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+ s_std_init(s, buf, STDOUT_BUF_SIZE, &p, s_mode_write);
+ s->file = 0;
+ s->file_modes = s->modes;
+ s->file_offset = 0; /* in case we switch to reading later */
+ s->file_limit = max_long; /* ibid. */
+ s->save_close = s->procs.flush;
+ make_file(&ref_stdout, a_write | avm_system, s->write_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -237,8 +237,8 @@ zget_stdout(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stdout)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice(imemory, (const byte *)"%stdout", 7);
iodev->state = i_ctx_p;
@@ -250,50 +250,50 @@ zget_stdout(i_ctx_t *i_ctx_p, stream ** ps)
/* Write a buffer to stderr, potentially writing to callback */
static int
s_stderr_write_process(stream_state * st, stream_cursor_read *pr,
- stream_cursor_write *ignore_pw, bool last)
+ stream_cursor_write *ignore_pw, bool last)
{
uint count = pr->limit - pr->ptr;
int written;
- if (count == 0)
- return 0;
+ if (count == 0)
+ return 0;
written = errwrite(st->memory, (const char *)(pr->ptr + 1), count);
- if (written < count)
- return ERRC;
+ if (written < count)
+ return ERRC;
pr->ptr += written;
return 0;
}
static int
stderr_open(gx_io_device * iodev, const char *access, stream ** ps,
- gs_memory_t * mem)
+ gs_memory_t * mem)
{
i_ctx_t *i_ctx_p = (i_ctx_t *)iodev->state; /* see above */
stream *s;
if (!streq1(access, 'w'))
- return_error(e_invalidfileaccess);
+ return_error(e_invalidfileaccess);
if (file_is_invalid(s, &ref_stderr)) {
- gs_memory_t *sysmem = imemory_system;
- byte *buf;
- static const stream_procs p = {
- s_std_noavailable, s_std_noseek, s_std_write_reset,
- s_std_write_flush, file_close_file, s_stderr_write_process
- };
-
- s = file_alloc_stream(sysmem, "stderr_open(stream)");
- buf = gs_alloc_bytes(sysmem, STDERR_BUF_SIZE, "stderr_open(buffer)");
- if (s == 0 || buf == 0)
- return_error(e_VMerror);
- s_std_init(s, buf, STDERR_BUF_SIZE, &p, s_mode_write);
- s->file = 0;
- s->file_modes = s->modes;
- s->file_offset = 0; /* in case we switch to reading later */
- s->file_limit = max_long; /* ibid. */
- s->save_close = s->procs.flush;
- make_file(&ref_stderr, a_write | avm_system, s->write_id, s);
- *ps = s;
- return 1;
+ gs_memory_t *sysmem = imemory_system;
+ byte *buf;
+ static const stream_procs p = {
+ s_std_noavailable, s_std_noseek, s_std_write_reset,
+ s_std_write_flush, file_close_file, s_stderr_write_process
+ };
+
+ s = file_alloc_stream(sysmem, "stderr_open(stream)");
+ buf = gs_alloc_bytes(sysmem, STDERR_BUF_SIZE, "stderr_open(buffer)");
+ if (s == 0 || buf == 0)
+ return_error(e_VMerror);
+ s_std_init(s, buf, STDERR_BUF_SIZE, &p, s_mode_write);
+ s->file = 0;
+ s->file_modes = s->modes;
+ s->file_offset = 0; /* in case we switch to reading later */
+ s->file_limit = max_long; /* ibid. */
+ s->save_close = s->procs.flush;
+ make_file(&ref_stderr, a_write | avm_system, s->write_id, s);
+ *ps = s;
+ return 1;
}
*ps = s;
return 0;
@@ -308,8 +308,8 @@ zget_stderr(i_ctx_t *i_ctx_p, stream ** ps)
int code;
if (file_is_valid(s, &ref_stderr)) {
- *ps = s;
- return 0;
+ *ps = s;
+ return 0;
}
iodev = gs_findiodevice(imemory, (const byte *)"%stderr", 7);
iodev->state = i_ctx_p;
diff --git a/gs/psi/zmath.c b/gs/psi/zmath.c
index 1f6cfb599..2fc6980ae 100644
--- a/gs/psi/zmath.c
+++ b/gs/psi/zmath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -51,9 +51,9 @@ zsqrt(i_ctx_t *i_ctx_p)
int code = real_param(op, &num);
if (code < 0)
- return code;
+ return code;
if (num < 0.0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_real(op, sqrt(num));
return 0;
}
@@ -67,7 +67,7 @@ zarccos(i_ctx_t *i_ctx_p)
int code = real_param(op, &num);
if (code < 0)
- return code;
+ return code;
result = acos(num) * radians_to_degrees;
make_real(op, result);
return 0;
@@ -82,7 +82,7 @@ zarcsin(i_ctx_t *i_ctx_p)
int code = real_param(op, &num);
if (code < 0)
- return code;
+ return code;
result = asin(num) * radians_to_degrees;
make_real(op, result);
return 0;
@@ -98,10 +98,10 @@ zatan(i_ctx_t *i_ctx_p)
int code = num_params(op, 2, args);
if (code < 0)
- return code;
+ return code;
code = gs_atan2_degrees(args[0], args[1], &result);
if (code < 0)
- return code;
+ return code;
make_real(op - 1, result);
pop(1);
return 0;
@@ -116,7 +116,7 @@ zcos(i_ctx_t *i_ctx_p)
int code = real_param(op, &angle);
if (code < 0)
- return code;
+ return code;
make_real(op, gs_cos_degrees(angle));
return 0;
}
@@ -130,7 +130,7 @@ zsin(i_ctx_t *i_ctx_p)
int code = real_param(op, &angle);
if (code < 0)
- return code;
+ return code;
make_real(op, gs_sin_degrees(angle));
return 0;
}
@@ -146,13 +146,13 @@ zexp(i_ctx_t *i_ctx_p)
int code = num_params(op, 2, args);
if (code < 0)
- return code;
+ return code;
if (args[0] < 0.0 && modf(args[1], &ipart) != 0.0)
- return_error(e_undefinedresult);
+ return_error(e_undefinedresult);
if (args[0] == 0.0 && args[1] == 0.0)
- result = 1.0; /* match Adobe; can't rely on C library */
+ result = 1.0; /* match Adobe; can't rely on C library */
else
- result = pow(args[0], args[1]);
+ result = pow(args[0], args[1]);
make_real(op - 1, result);
pop(1);
return 0;
@@ -167,9 +167,9 @@ zln(i_ctx_t *i_ctx_p)
int code = real_param(op, &num);
if (code < 0)
- return code;
+ return code;
if (num <= 0.0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_real(op, log(num));
return 0;
}
@@ -183,9 +183,9 @@ zlog(i_ctx_t *i_ctx_p)
int code = real_param(op, &num);
if (code < 0)
- return code;
+ return code;
if (num <= 0.0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
make_real(op, log10(num));
return 0;
}
@@ -196,13 +196,13 @@ zrand(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
- /*
- * We use an algorithm from CACM 31 no. 10, pp. 1192-1201,
- * October 1988. According to a posting by Ed Taft on
- * comp.lang.postscript, Level 2 (Adobe) PostScript interpreters
- * use this algorithm too:
- * x[n+1] = (16807 * x[n]) mod (2^31 - 1)
- */
+ /*
+ * We use an algorithm from CACM 31 no. 10, pp. 1192-1201,
+ * October 1988. According to a posting by Ed Taft on
+ * comp.lang.postscript, Level 2 (Adobe) PostScript interpreters
+ * use this algorithm too:
+ * x[n+1] = (16807 * x[n]) mod (2^31 - 1)
+ */
#define A 16807
#define M 0x7fffffff
#define Q 127773 /* M / A */
@@ -210,7 +210,7 @@ zrand(i_ctx_t *i_ctx_p)
zrand_state = A * (zrand_state % Q) - R * (zrand_state / Q);
/* Note that zrand_state cannot be 0 here. */
if (zrand_state <= 0)
- zrand_state += M;
+ zrand_state += M;
#undef A
#undef M
#undef Q
@@ -234,9 +234,9 @@ zsrand(i_ctx_t *i_ctx_p)
* public information from Adobe describing their implementation.
*/
if (state < 1)
- state = -(state % 0x7ffffffe) + 1;
+ state = -(state % 0x7ffffffe) + 1;
else if (state > 0x7ffffffe)
- state = 0x7ffffffe;
+ state = 0x7ffffffe;
zrand_state = state;
pop(1);
return 0;
diff --git a/gs/psi/zmatrix.c b/gs/psi/zmatrix.c
index 619db2cec..24fc0a6f9 100644
--- a/gs/psi/zmatrix.c
+++ b/gs/psi/zmatrix.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -22,8 +22,8 @@
/* Forward references */
static int common_transform(i_ctx_t *,
- int (*)(gs_state *, floatp, floatp, gs_point *),
- int (*)(floatp, floatp, const gs_matrix *, gs_point *));
+ int (*)(gs_state *, floatp, floatp, gs_point *),
+ int (*)(floatp, floatp, const gs_matrix *, gs_point *));
/* - initmatrix - */
static int
@@ -52,11 +52,11 @@ zcurrentmatrix(i_ctx_t *i_ctx_p)
int code = gs_currentmatrix(igs, &mat);
if (code < 0)
- return code;
+ return code;
push(6);
code = make_floats(op - 5, &mat.xx, 6);
if (code < 0)
- pop(6);
+ pop(6);
return code;
}
@@ -69,9 +69,9 @@ zsetmatrix(i_ctx_t *i_ctx_p)
int code = float_params(op, 6, &mat.xx);
if (code < 0)
- return code;
+ return code;
if ((code = gs_setmatrix(igs, &mat)) < 0)
- return code;
+ return code;
pop(6);
return 0;
}
@@ -84,17 +84,17 @@ zsetdefaultmatrix(i_ctx_t *i_ctx_p)
int code;
if (r_has_type(op, t_null))
- code = gs_setdefaultmatrix(igs, NULL);
+ code = gs_setdefaultmatrix(igs, NULL);
else {
- gs_matrix mat;
+ gs_matrix mat;
- code = read_matrix(imemory, op, &mat);
- if (code < 0)
- return code;
- code = gs_setdefaultmatrix(igs, &mat);
+ code = read_matrix(imemory, op, &mat);
+ if (code < 0)
+ return code;
+ code = gs_setdefaultmatrix(igs, &mat);
}
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -109,22 +109,22 @@ ztranslate(i_ctx_t *i_ctx_p)
double trans[2];
if ((code = num_params(op, 2, trans)) >= 0) {
- code = gs_translate(igs, trans[0], trans[1]);
- if (code < 0)
- return code;
+ code = gs_translate(igs, trans[0], trans[1]);
+ if (code < 0)
+ return code;
} else { /* matrix operand */
- gs_matrix mat;
-
- /* The num_params failure might be a stack underflow. */
- check_op(2);
- if ((code = num_params(op - 1, 2, trans)) < 0 ||
- (code = gs_make_translation(trans[0], trans[1], &mat)) < 0 ||
- (code = write_matrix(op, &mat)) < 0
- ) { /* Might be a stack underflow. */
- check_op(3);
- return code;
- }
- op[-2] = *op;
+ gs_matrix mat;
+
+ /* The num_params failure might be a stack underflow. */
+ check_op(2);
+ if ((code = num_params(op - 1, 2, trans)) < 0 ||
+ (code = gs_make_translation(trans[0], trans[1], &mat)) < 0 ||
+ (code = write_matrix(op, &mat)) < 0
+ ) { /* Might be a stack underflow. */
+ check_op(3);
+ return code;
+ }
+ op[-2] = *op;
}
pop(2);
return code;
@@ -140,22 +140,22 @@ zscale(i_ctx_t *i_ctx_p)
double scale[2];
if ((code = num_params(op, 2, scale)) >= 0) {
- code = gs_scale(igs, scale[0], scale[1]);
- if (code < 0)
- return code;
+ code = gs_scale(igs, scale[0], scale[1]);
+ if (code < 0)
+ return code;
} else { /* matrix operand */
- gs_matrix mat;
-
- /* The num_params failure might be a stack underflow. */
- check_op(2);
- if ((code = num_params(op - 1, 2, scale)) < 0 ||
- (code = gs_make_scaling(scale[0], scale[1], &mat)) < 0 ||
- (code = write_matrix(op, &mat)) < 0
- ) { /* Might be a stack underflow. */
- check_op(3);
- return code;
- }
- op[-2] = *op;
+ gs_matrix mat;
+
+ /* The num_params failure might be a stack underflow. */
+ check_op(2);
+ if ((code = num_params(op - 1, 2, scale)) < 0 ||
+ (code = gs_make_scaling(scale[0], scale[1], &mat)) < 0 ||
+ (code = write_matrix(op, &mat)) < 0
+ ) { /* Might be a stack underflow. */
+ check_op(3);
+ return code;
+ }
+ op[-2] = *op;
}
pop(2);
return code;
@@ -171,22 +171,22 @@ zrotate(i_ctx_t *i_ctx_p)
double ang;
if ((code = real_param(op, &ang)) >= 0) {
- code = gs_rotate(igs, ang);
- if (code < 0)
- return code;
+ code = gs_rotate(igs, ang);
+ if (code < 0)
+ return code;
} else { /* matrix operand */
- gs_matrix mat;
-
- /* The num_params failure might be a stack underflow. */
- check_op(1);
- if ((code = num_params(op - 1, 1, &ang)) < 0 ||
- (code = gs_make_rotation(ang, &mat)) < 0 ||
- (code = write_matrix(op, &mat)) < 0
- ) { /* Might be a stack underflow. */
- check_op(2);
- return code;
- }
- op[-1] = *op;
+ gs_matrix mat;
+
+ /* The num_params failure might be a stack underflow. */
+ check_op(1);
+ if ((code = num_params(op - 1, 1, &ang)) < 0 ||
+ (code = gs_make_rotation(ang, &mat)) < 0 ||
+ (code = write_matrix(op, &mat)) < 0
+ ) { /* Might be a stack underflow. */
+ check_op(2);
+ return code;
+ }
+ op[-1] = *op;
}
pop(1);
return code;
@@ -201,10 +201,10 @@ zconcat(i_ctx_t *i_ctx_p)
int code = read_matrix(imemory, op, &mat);
if (code < 0)
- return code;
+ return code;
code = gs_concat(igs, &mat);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -218,11 +218,11 @@ zconcatmatrix(i_ctx_t *i_ctx_p)
int code;
if ((code = read_matrix(imemory, op - 2, &m1)) < 0 ||
- (code = read_matrix(imemory, op - 1, &m2)) < 0 ||
- (code = gs_matrix_multiply(&m1, &m2, &mp)) < 0 ||
- (code = write_matrix(op, &mp)) < 0
- )
- return code;
+ (code = read_matrix(imemory, op - 1, &m2)) < 0 ||
+ (code = gs_matrix_multiply(&m1, &m2, &mp)) < 0 ||
+ (code = write_matrix(op, &mp)) < 0
+ )
+ return code;
op[-2] = *op;
pop(2);
return code;
@@ -263,8 +263,8 @@ zidtransform(i_ctx_t *i_ctx_p)
/* Common logic for [i][d]transform */
static int
common_transform(i_ctx_t *i_ctx_p,
- int (*ptproc)(gs_state *, floatp, floatp, gs_point *),
- int (*matproc)(floatp, floatp, const gs_matrix *, gs_point *))
+ int (*ptproc)(gs_state *, floatp, floatp, gs_point *),
+ int (*matproc)(floatp, floatp, const gs_matrix *, gs_point *))
{
os_ptr op = osp;
double opxy[2];
@@ -273,44 +273,44 @@ common_transform(i_ctx_t *i_ctx_p,
/* Optimize for the non-matrix case */
switch (r_type(op)) {
- case t_real:
- opxy[1] = op->value.realval;
- break;
- case t_integer:
- opxy[1] = op->value.intval;
- break;
- case t_array: /* might be a matrix */
- case t_shortarray:
- case t_mixedarray: {
- gs_matrix mat;
- gs_matrix *pmat = &mat;
-
- if ((code = read_matrix(imemory, op, pmat)) < 0 ||
- (code = num_params(op - 1, 2, opxy)) < 0 ||
- (code = (*matproc) (opxy[0], opxy[1], pmat, &pt)) < 0
- ) { /* Might be a stack underflow. */
- check_op(3);
- return code;
- }
- op--;
- pop(1);
- goto out;
- }
- default:
- return_op_typecheck(op);
+ case t_real:
+ opxy[1] = op->value.realval;
+ break;
+ case t_integer:
+ opxy[1] = op->value.intval;
+ break;
+ case t_array: /* might be a matrix */
+ case t_shortarray:
+ case t_mixedarray: {
+ gs_matrix mat;
+ gs_matrix *pmat = &mat;
+
+ if ((code = read_matrix(imemory, op, pmat)) < 0 ||
+ (code = num_params(op - 1, 2, opxy)) < 0 ||
+ (code = (*matproc) (opxy[0], opxy[1], pmat, &pt)) < 0
+ ) { /* Might be a stack underflow. */
+ check_op(3);
+ return code;
+ }
+ op--;
+ pop(1);
+ goto out;
+ }
+ default:
+ return_op_typecheck(op);
}
switch (r_type(op - 1)) {
- case t_real:
- opxy[0] = (op - 1)->value.realval;
- break;
- case t_integer:
- opxy[0] = (op - 1)->value.intval;
- break;
- default:
- return_op_typecheck(op - 1);
+ case t_real:
+ opxy[0] = (op - 1)->value.realval;
+ break;
+ case t_integer:
+ opxy[0] = (op - 1)->value.intval;
+ break;
+ default:
+ return_op_typecheck(op - 1);
}
if ((code = (*ptproc) (igs, opxy[0], opxy[1], &pt)) < 0)
- return code;
+ return code;
out:
make_real(op - 1, pt.x);
make_real(op, pt.y);
@@ -326,10 +326,10 @@ zinvertmatrix(i_ctx_t *i_ctx_p)
int code;
if ((code = read_matrix(imemory, op - 1, &m)) < 0 ||
- (code = gs_matrix_invert(&m, &m)) < 0 ||
- (code = write_matrix(op, &m)) < 0
- )
- return code;
+ (code = gs_matrix_invert(&m, &m)) < 0 ||
+ (code = write_matrix(op, &m)) < 0
+ )
+ return code;
op[-1] = *op;
pop(1);
return code;
@@ -349,9 +349,9 @@ zbbox_transform(i_ctx_t *i_ctx_p)
if ((code = read_matrix(imemory, op, &m)) < 0)
return code;
-
+
if (!r_is_array(op - 1))
- return_op_typecheck(op - 1);
+ return_op_typecheck(op - 1);
check_read(op[-1]);
if (r_size(op - 1) != 4)
return_error(e_rangecheck);
diff --git a/gs/psi/zmedia2.c b/gs/psi/zmedia2.c
index a30607cef..b228b51d7 100644
--- a/gs/psi/zmedia2.c
+++ b/gs/psi/zmedia2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,10 +27,10 @@
/* <pagedict> <attrdict> <policydict> <keys> .matchmedia false */
/* <pagedict> null <policydict> <keys> .matchmedia null true */
static int zmatch_page_size(const gs_memory_t *mem,
- const ref * pvreq, const ref * pvmed,
- int policy, int orient, bool roll,
- float *best_mismatch, gs_matrix * pmat,
- gs_point * pmsize);
+ const ref * pvreq, const ref * pvmed,
+ int policy, int orient, bool roll,
+ float *best_mismatch, gs_matrix * pmat,
+ gs_point * pmsize);
typedef struct match_record_s {
ref best_key, match_key;
uint priority, no_match_priority;
@@ -62,14 +62,14 @@ zmatchmedia(i_ctx_t *i_ctx_p)
int code;
int ai;
struct mkd_ {
- ref key, dict;
+ ref key, dict;
} aelt;
if (r_has_type(pattr, t_null)) {
- check_op(4);
- make_null(op - 3);
- make_true(op - 2);
- pop(2);
- return 0;
+ check_op(4);
+ make_null(op - 3);
+ make_true(op - 2);
+ pop(2);
+ return 0;
}
check_type(*preq, t_dictionary);
check_dict_read(*preq);
@@ -80,148 +80,148 @@ zmatchmedia(i_ctx_t *i_ctx_p)
check_array(*pkeys);
check_read(*pkeys);
switch (code = dict_int_null_param(preq, "MediaPosition", 0, 0x7fff,
- 0, &mepos)) {
- default:
- return code;
- case 2:
- case 1:
- mepos = -1;
- case 0:;
+ 0, &mepos)) {
+ default:
+ return code;
+ case 2:
+ case 1:
+ mepos = -1;
+ case 0:;
}
switch (code = dict_int_null_param(preq, "Orientation", 0, 3,
- 0, &orient)) {
- default:
- return code;
- case 2:
- case 1:
- orient = -1;
- case 0:;
+ 0, &orient)) {
+ default:
+ return code;
+ case 2:
+ case 1:
+ orient = -1;
+ case 0:;
}
code = dict_bool_param(preq, "RollFedMedia", false, &roll);
if (code < 0)
- return code;
+ return code;
code = dict_int_param(ppol, "PolicyNotFound", 0, 7, 0,
- &policy_default);
+ &policy_default);
if (code < 0)
- return code;
+ return code;
if (dict_find_string(pattr, "Priority", &ppriority) > 0) {
- check_array_only(*ppriority);
- check_read(*ppriority);
+ check_array_only(*ppriority);
+ check_read(*ppriority);
} else {
- make_empty_array(&no_priority, a_readonly);
- ppriority = &no_priority;
+ make_empty_array(&no_priority, a_readonly);
+ ppriority = &no_priority;
}
match.no_match_priority = r_size(ppriority);
reset_match(&match);
for (ai = dict_first(pattr);
- (ai = dict_next(pattr, ai, (ref * /*[2]*/)&aelt)) >= 0;
- ) {
- if (r_has_type(&aelt.dict, t_dictionary) &&
- r_has_attr(dict_access_ref(&aelt.dict), a_read) &&
- r_has_type(&aelt.key, t_integer)
- ) {
- bool match_all;
- uint ki, pi;
+ (ai = dict_next(pattr, ai, (ref * /*[2]*/)&aelt)) >= 0;
+ ) {
+ if (r_has_type(&aelt.dict, t_dictionary) &&
+ r_has_attr(dict_access_ref(&aelt.dict), a_read) &&
+ r_has_type(&aelt.key, t_integer)
+ ) {
+ bool match_all;
+ uint ki, pi;
- code = dict_bool_param(&aelt.dict, "MatchAll", false,
- &match_all);
- if (code < 0)
- return code;
- for (ki = 0; ki < r_size(pkeys); ki++) {
- ref key;
- ref kstr;
- ref *prvalue;
- ref *pmvalue;
- ref *ppvalue;
- int policy;
+ code = dict_bool_param(&aelt.dict, "MatchAll", false,
+ &match_all);
+ if (code < 0)
+ return code;
+ for (ki = 0; ki < r_size(pkeys); ki++) {
+ ref key;
+ ref kstr;
+ ref *prvalue;
+ ref *pmvalue;
+ ref *ppvalue;
+ int policy;
- array_get(imemory, pkeys, ki, &key);
- if (dict_find(&aelt.dict, &key, &pmvalue) <= 0)
- continue;
- if (dict_find(preq, &key, &prvalue) <= 0 ||
- r_has_type(prvalue, t_null)
- ) {
- if (match_all)
- goto no;
- else
- continue;
- }
- /* Look for the Policies entry for this key. */
- if (dict_find(ppol, &key, &ppvalue) > 0) {
- check_type_only(*ppvalue, t_integer);
- policy = ppvalue->value.intval;
- } else
- policy = policy_default;
- /*
- * Match a requested attribute value with the attribute value in the
- * description of a medium. For all attributes except PageSize,
- * matching means equality. PageSize is special; see match_page_size
- * below.
- */
- if (r_has_type(&key, t_name) &&
- (name_string_ref(imemory, &key, &kstr),
- r_size(&kstr) == 8 &&
- !memcmp(kstr.value.bytes, "PageSize", 8))
- ) {
- gs_matrix ignore_mat;
- gs_point ignore_msize;
+ array_get(imemory, pkeys, ki, &key);
+ if (dict_find(&aelt.dict, &key, &pmvalue) <= 0)
+ continue;
+ if (dict_find(preq, &key, &prvalue) <= 0 ||
+ r_has_type(prvalue, t_null)
+ ) {
+ if (match_all)
+ goto no;
+ else
+ continue;
+ }
+ /* Look for the Policies entry for this key. */
+ if (dict_find(ppol, &key, &ppvalue) > 0) {
+ check_type_only(*ppvalue, t_integer);
+ policy = ppvalue->value.intval;
+ } else
+ policy = policy_default;
+ /*
+ * Match a requested attribute value with the attribute value in the
+ * description of a medium. For all attributes except PageSize,
+ * matching means equality. PageSize is special; see match_page_size
+ * below.
+ */
+ if (r_has_type(&key, t_name) &&
+ (name_string_ref(imemory, &key, &kstr),
+ r_size(&kstr) == 8 &&
+ !memcmp(kstr.value.bytes, "PageSize", 8))
+ ) {
+ gs_matrix ignore_mat;
+ gs_point ignore_msize;
- if (zmatch_page_size(imemory, prvalue, pmvalue,
- policy, orient, roll,
- &best_mismatch,
- &ignore_mat,
- &ignore_msize)
- <= 0)
- goto no;
- } else if (!obj_eq(imemory, prvalue, pmvalue))
- goto no;
- }
+ if (zmatch_page_size(imemory, prvalue, pmvalue,
+ policy, orient, roll,
+ &best_mismatch,
+ &ignore_mat,
+ &ignore_msize)
+ <= 0)
+ goto no;
+ } else if (!obj_eq(imemory, prvalue, pmvalue))
+ goto no;
+ }
- mepos_penalty = (mepos < 0 || aelt.key.value.intval == mepos) ?
- 0 : .001;
+ mepos_penalty = (mepos < 0 || aelt.key.value.intval == mepos) ?
+ 0 : .001;
- /* We have a match. Save the match in case no better match is found */
- if (r_has_type(&match.match_key, t_null))
- match.match_key = aelt.key;
- /*
- * If it is a better match than the current best it supersedes it
- * regardless of priority. If the match is the same, then update
- * to the current only if the key value is lower.
- */
- if (best_mismatch + mepos_penalty <= mbest) {
- if (best_mismatch + mepos_penalty < mbest ||
- (r_has_type(&match.match_key, t_integer) &&
- match.match_key.value.intval > aelt.key.value.intval)) {
- reset_match(&match);
- match.match_key = aelt.key;
- mbest = best_mismatch + mepos_penalty;
- }
- }
- /* In case of a tie, see if the new match has priority. */
- for (pi = match.priority; pi > 0;) {
- ref pri;
+ /* We have a match. Save the match in case no better match is found */
+ if (r_has_type(&match.match_key, t_null))
+ match.match_key = aelt.key;
+ /*
+ * If it is a better match than the current best it supersedes it
+ * regardless of priority. If the match is the same, then update
+ * to the current only if the key value is lower.
+ */
+ if (best_mismatch + mepos_penalty <= mbest) {
+ if (best_mismatch + mepos_penalty < mbest ||
+ (r_has_type(&match.match_key, t_integer) &&
+ match.match_key.value.intval > aelt.key.value.intval)) {
+ reset_match(&match);
+ match.match_key = aelt.key;
+ mbest = best_mismatch + mepos_penalty;
+ }
+ }
+ /* In case of a tie, see if the new match has priority. */
+ for (pi = match.priority; pi > 0;) {
+ ref pri;
- pi--;
- array_get(imemory, ppriority, pi, &pri);
- if (obj_eq(imemory, &aelt.key, &pri)) { /* Yes, higher priority. */
- match.best_key = aelt.key;
- match.priority = pi;
- break;
- }
- }
+ pi--;
+ array_get(imemory, ppriority, pi, &pri);
+ if (obj_eq(imemory, &aelt.key, &pri)) { /* Yes, higher priority. */
+ match.best_key = aelt.key;
+ match.priority = pi;
+ break;
+ }
+ }
no:;
- }
+ }
}
if (r_has_type(&match.match_key, t_null)) {
- make_false(op - 3);
- pop(3);
+ make_false(op - 3);
+ pop(3);
} else {
- if (r_has_type(&match.best_key, t_null))
- op[-3] = match.match_key;
- else
- op[-3] = match.best_key;
- make_true(op - 2);
- pop(2);
+ if (r_has_type(&match.best_key, t_null))
+ op[-3] = match.match_key;
+ else
+ op[-3] = match.best_key;
+ make_true(op - 2);
+ pop(2);
}
return 0;
}
@@ -243,48 +243,48 @@ zmatchpagesize(i_ctx_t *i_ctx_p)
check_type(op[-3], t_integer);
if (r_has_type(op - 2, t_null))
- orient = -1;
+ orient = -1;
else {
- check_int_leu(op[-2], 3);
- orient = (int)op[-2].value.intval;
+ check_int_leu(op[-2], 3);
+ orient = (int)op[-2].value.intval;
}
check_type(op[-1], t_boolean);
roll = op[-1].value.boolval;
- code = zmatch_page_size(imemory,
- op - 5, op - 4, (int)op[-3].value.intval,
- orient, roll,
- &ignore_mismatch, &mat, &media_size);
+ code = zmatch_page_size(imemory,
+ op - 5, op - 4, (int)op[-3].value.intval,
+ orient, roll,
+ &ignore_mismatch, &mat, &media_size);
switch (code) {
- default:
- return code;
- case 0:
- make_false(op - 5);
- pop(5);
- break;
- case 1:
- code = write_matrix(op, &mat);
- if (code < 0 && !r_has_type(op, t_null))
- return code;
- op[-5] = *op;
- make_real(op - 4, media_size.x);
- make_real(op - 3, media_size.y);
- make_true(op - 2);
- pop(2);
- break;
+ default:
+ return code;
+ case 0:
+ make_false(op - 5);
+ pop(5);
+ break;
+ case 1:
+ code = write_matrix(op, &mat);
+ if (code < 0 && !r_has_type(op, t_null))
+ return code;
+ op[-5] = *op;
+ make_real(op - 4, media_size.x);
+ make_real(op - 3, media_size.y);
+ make_true(op - 2);
+ pop(2);
+ break;
}
return 0;
}
/* Match the PageSize. See below for details. */
static int
match_page_size(const gs_point * request,
- const gs_rect * medium,
- int policy, int orient, bool roll,
- float *best_mismatch, gs_matrix * pmat,
- gs_point * pmsize);
+ const gs_rect * medium,
+ int policy, int orient, bool roll,
+ float *best_mismatch, gs_matrix * pmat,
+ gs_point * pmsize);
static int
zmatch_page_size(const gs_memory_t *mem, const ref * pvreq, const ref * pvmed,
- int policy, int orient, bool roll,
- float *best_mismatch, gs_matrix * pmat, gs_point * pmsize)
+ int policy, int orient, bool roll,
+ float *best_mismatch, gs_matrix * pmat, gs_point * pmsize)
{
uint nr, nm;
int code;
@@ -299,27 +299,27 @@ zmatch_page_size(const gs_memory_t *mem, const ref * pvreq, const ref * pvmed,
return_error(code);
nm = r_size(pvmed);
if (!((nm == 2 || nm == 4) && (nr == 2 || nr == nm)))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
{
- uint i;
- double v[6];
- int code;
+ uint i;
+ double v[6];
+ int code;
- array_get(mem, pvreq, 0, &rv[0]);
- for (i = 0; i < 4; ++i)
- array_get(mem,pvmed, i % nm, &rv[i + 2]);
- if ((code = num_params(rv + 5, 6, v)) < 0)
- return code;
- {
- gs_point request;
- gs_rect medium;
+ array_get(mem, pvreq, 0, &rv[0]);
+ for (i = 0; i < 4; ++i)
+ array_get(mem,pvmed, i % nm, &rv[i + 2]);
+ if ((code = num_params(rv + 5, 6, v)) < 0)
+ return code;
+ {
+ gs_point request;
+ gs_rect medium;
- request.x = v[0], request.y = v[1];
- medium.p.x = v[2], medium.p.y = v[3],
- medium.q.x = v[4], medium.q.y = v[5];
- return match_page_size(&request, &medium, policy, orient,
- roll, best_mismatch, pmat, pmsize);
- }
+ request.x = v[0], request.y = v[1];
+ medium.p.x = v[2], medium.p.y = v[3],
+ medium.q.x = v[4], medium.q.y = v[5];
+ return match_page_size(&request, &medium, policy, orient,
+ roll, best_mismatch, pmat, pmsize);
+ }
}
}
/*
@@ -336,104 +336,104 @@ zmatch_page_size(const gs_memory_t *mem, const ref * pvreq, const ref * pvmed,
* when the match isn't exact. We'll fix it if we ever need to.
*/
static void make_adjustment_matrix(const gs_point * request,
- const gs_rect * medium,
- gs_matrix * pmat,
- bool scale, int rotate);
+ const gs_rect * medium,
+ gs_matrix * pmat,
+ bool scale, int rotate);
static int
match_page_size(const gs_point * request, const gs_rect * medium, int policy,
- int orient, bool roll, float *best_mismatch, gs_matrix * pmat,
- gs_point * pmsize)
+ int orient, bool roll, float *best_mismatch, gs_matrix * pmat,
+ gs_point * pmsize)
{
double rx = request->x, ry = request->y;
if ((rx <= 0) || (ry <= 0))
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (policy == 7) {
- /* (Adobe) hack: just impose requested values */
- *best_mismatch = 0;
- gs_make_identity(pmat);
- *pmsize = *request;
+ /* (Adobe) hack: just impose requested values */
+ *best_mismatch = 0;
+ gs_make_identity(pmat);
+ *pmsize = *request;
} else {
- int fit_direct = rx - medium->p.x >= -5 && rx - medium->q.x <= 5
+ int fit_direct = rx - medium->p.x >= -5 && rx - medium->q.x <= 5
&& ry - medium->p.y >= -5 && ry - medium->q.y <= 5;
- int fit_rotated = rx - medium->p.y >= -5 && rx - medium->q.y <= 5
+ int fit_rotated = rx - medium->p.y >= -5 && rx - medium->q.y <= 5
&& ry - medium->p.x >= -5 && ry - medium->q.x <= 5;
-
- /* Fudge matches from a non-standard page size match (4 element array) */
- /* as worse than an exact match from a standard (2 element array), but */
- /* better than for a rotated match to a standard pagesize. This should */
- /* prevent rotation unless we have to (particularly for raster file */
- /* formats like TIFF, JPEG, PNG, PCX, BMP, etc. and also should allow */
- /* exact page size specification when there is a range PageSize entry. */
- /* As the comment in gs_setpd.ps says "Devices that care will provide */
- /* a real InputAttributes dictionary (most without a range pagesize) */
+
+ /* Fudge matches from a non-standard page size match (4 element array) */
+ /* as worse than an exact match from a standard (2 element array), but */
+ /* better than for a rotated match to a standard pagesize. This should */
+ /* prevent rotation unless we have to (particularly for raster file */
+ /* formats like TIFF, JPEG, PNG, PCX, BMP, etc. and also should allow */
+ /* exact page size specification when there is a range PageSize entry. */
+ /* As the comment in gs_setpd.ps says "Devices that care will provide */
+ /* a real InputAttributes dictionary (most without a range pagesize) */
if ( fit_direct && fit_rotated) {
- make_adjustment_matrix(request, medium, pmat, false, orient < 0 ? 0 : orient);
- if (medium->p.x < medium->q.x || medium->p.y < medium->q.y)
- *best_mismatch = (float)0.001; /* fudge a match to a range as a small number */
- else /* should be 0 for an exact match */
- *best_mismatch = fabs((rx - medium->p.x) * (medium->q.x - rx)) +
- fabs((ry - medium->p.y) * (medium->q.y - ry));
+ make_adjustment_matrix(request, medium, pmat, false, orient < 0 ? 0 : orient);
+ if (medium->p.x < medium->q.x || medium->p.y < medium->q.y)
+ *best_mismatch = (float)0.001; /* fudge a match to a range as a small number */
+ else /* should be 0 for an exact match */
+ *best_mismatch = fabs((rx - medium->p.x) * (medium->q.x - rx)) +
+ fabs((ry - medium->p.y) * (medium->q.y - ry));
} else if ( fit_direct ) {
int rotate = orient < 0 ? 0 : orient;
- make_adjustment_matrix(request, medium, pmat, false, (rotate + 1) & 2);
- *best_mismatch = fabs((medium->p.x - rx) * (medium->q.x - rx)) +
- fabs((medium->p.y - ry) * (medium->q.y - ry)) +
- (pmat->xx == 0.0 || (rotate & 1) == 1 ? 0.01 : 0); /* rotated */
+ make_adjustment_matrix(request, medium, pmat, false, (rotate + 1) & 2);
+ *best_mismatch = fabs((medium->p.x - rx) * (medium->q.x - rx)) +
+ fabs((medium->p.y - ry) * (medium->q.y - ry)) +
+ (pmat->xx == 0.0 || (rotate & 1) == 1 ? 0.01 : 0); /* rotated */
} else if ( fit_rotated ) {
int rotate = (orient < 0 ? 1 : orient);
- make_adjustment_matrix(request, medium, pmat, false, rotate | 1);
- *best_mismatch = fabs((medium->p.y - rx) * (medium->q.y - rx)) +
- fabs((medium->p.x - ry) * (medium->q.x - ry)) +
- (pmat->xx == 0.0 || (rotate & 1) == 1 ? 0.01 : 0); /* rotated */
+ make_adjustment_matrix(request, medium, pmat, false, rotate | 1);
+ *best_mismatch = fabs((medium->p.y - rx) * (medium->q.y - rx)) +
+ fabs((medium->p.x - ry) * (medium->q.x - ry)) +
+ (pmat->xx == 0.0 || (rotate & 1) == 1 ? 0.01 : 0); /* rotated */
} else {
- int rotate =
- (orient >= 0 ? orient :
- (rx < ry) ^ (medium->q.x < medium->q.y));
- bool larger =
- (rotate & 1 ? medium->q.y >= rx && medium->q.x >= ry :
- medium->q.x >= rx && medium->q.y >= ry);
- bool adjust = false;
- float mismatch = medium->q.x * medium->q.y - rx * ry;
+ int rotate =
+ (orient >= 0 ? orient :
+ (rx < ry) ^ (medium->q.x < medium->q.y));
+ bool larger =
+ (rotate & 1 ? medium->q.y >= rx && medium->q.x >= ry :
+ medium->q.x >= rx && medium->q.y >= ry);
+ bool adjust = false;
+ float mismatch = medium->q.x * medium->q.y - rx * ry;
- switch (policy) {
- default: /* exact match only */
- return 0;
- case 3: /* nearest match, adjust */
- adjust = true;
- case 5: /* nearest match, don't adjust */
- if (fabs(mismatch) >= fabs(*best_mismatch))
- return 0;
- break;
- case 4: /* next larger match, adjust */
- adjust = true;
- case 6: /* next larger match, don't adjust */
- if (!larger || mismatch >= *best_mismatch)
- return 0;
- break;
- }
- if (adjust)
- make_adjustment_matrix(request, medium, pmat, !larger, rotate);
- else {
- gs_rect req_rect;
- if(rotate & 1) {
+ switch (policy) {
+ default: /* exact match only */
+ return 0;
+ case 3: /* nearest match, adjust */
+ adjust = true;
+ case 5: /* nearest match, don't adjust */
+ if (fabs(mismatch) >= fabs(*best_mismatch))
+ return 0;
+ break;
+ case 4: /* next larger match, adjust */
+ adjust = true;
+ case 6: /* next larger match, don't adjust */
+ if (!larger || mismatch >= *best_mismatch)
+ return 0;
+ break;
+ }
+ if (adjust)
+ make_adjustment_matrix(request, medium, pmat, !larger, rotate);
+ else {
+ gs_rect req_rect;
+ if(rotate & 1) {
req_rect.p.x = ry;
req_rect.p.y = rx;
} else {
req_rect.p.x = rx;
req_rect.p.y = ry;
}
- req_rect.q = req_rect.p;
- make_adjustment_matrix(request, &req_rect, pmat, false, rotate);
- }
- *best_mismatch = fabs(mismatch);
+ req_rect.q = req_rect.p;
+ make_adjustment_matrix(request, &req_rect, pmat, false, rotate);
+ }
+ *best_mismatch = fabs(mismatch);
}
if (pmat->xx == 0) { /* Swap request X and Y. */
- double temp = rx;
+ double temp = rx;
- rx = ry, ry = temp;
+ rx = ry, ry = temp;
}
#define ADJUST_INTO(req, mmin, mmax)\
(req < mmin ? mmin : req > mmax ? mmax : req)
@@ -450,55 +450,55 @@ match_page_size(const gs_point * request, const gs_rect * medium, int policy,
* we must adjust its size in that dimension to match the request.
* We recognize this by an unreasonably small medium->p.{x,y}.
*/
-static void
+static void
make_adjustment_matrix(const gs_point * request, const gs_rect * medium,
- gs_matrix * pmat, bool scale, int rotate)
+ gs_matrix * pmat, bool scale, int rotate)
{
double rx = request->x, ry = request->y;
double mx = medium->q.x, my = medium->q.y;
- /* Rotate the request if necessary. */
+ /* Rotate the request if necessary. */
if (rotate & 1) {
- double temp = rx;
+ double temp = rx;
- rx = ry, ry = temp;
+ rx = ry, ry = temp;
}
/* If 'medium' is flexible, adjust 'mx' and 'my' towards 'rx' and 'ry',
respectively. Note that 'mx' and 'my' have just acquired the largest
permissible value, medium->q. */
if (medium->p.x < mx) { /* non-empty width range */
- if (rx < medium->p.x)
- mx = medium->p.x; /* use minimum of the range */
- else if (rx < mx)
- mx = rx; /* fits */
- /* else leave mx == medium->q.x, i.e., the maximum */
+ if (rx < medium->p.x)
+ mx = medium->p.x; /* use minimum of the range */
+ else if (rx < mx)
+ mx = rx; /* fits */
+ /* else leave mx == medium->q.x, i.e., the maximum */
}
if (medium->p.y < my) { /* non-empty height range */
- if (ry < medium->p.y)
- my = medium->p.y; /* use minimum of the range */
- else if (ry < my)
- my = ry; /* fits */
- /* else leave my == medium->q.y, i.e., the maximum */
+ if (ry < medium->p.y)
+ my = medium->p.y; /* use minimum of the range */
+ else if (ry < my)
+ my = ry; /* fits */
+ /* else leave my == medium->q.y, i.e., the maximum */
}
- /* Translate to align the centers. */
+ /* Translate to align the centers. */
gs_make_translation(mx / 2, my / 2, pmat);
- /* Rotate if needed. */
+ /* Rotate if needed. */
if (rotate)
- gs_matrix_rotate(pmat, 90.0 * rotate, pmat);
+ gs_matrix_rotate(pmat, 90.0 * rotate, pmat);
- /* Scale if needed. */
+ /* Scale if needed. */
if (scale) {
- double xfactor = mx / rx;
- double yfactor = my / ry;
- double factor = min(xfactor, yfactor);
+ double xfactor = mx / rx;
+ double yfactor = my / ry;
+ double factor = min(xfactor, yfactor);
- if (factor < 1)
- gs_matrix_scale(pmat, factor, factor, pmat);
+ if (factor < 1)
+ gs_matrix_scale(pmat, factor, factor, pmat);
}
- /* Now translate the origin back, */
- /* using the original, unswapped request. */
+ /* Now translate the origin back, */
+ /* using the original, unswapped request. */
gs_matrix_translate(pmat, -request->x / 2, -request->y / 2, pmat);
}
#undef MIN_MEDIA_SIZE
diff --git a/gs/psi/zmisc.c b/gs/psi/zmisc.c
index 07f012857..d67c680d6 100644
--- a/gs/psi/zmisc.c
+++ b/gs/psi/zmisc.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ static inline bool
r_is_ex_oper(const ref *rp)
{
return (r_has_attr(rp, a_executable) &&
- (r_btype(rp) == t_operator || r_type(rp) == t_oparray));
+ (r_btype(rp) == t_operator || r_type(rp) == t_oparray));
}
static int
zbind(i_ctx_t *i_ctx_p)
@@ -48,19 +48,19 @@ zbind(i_ctx_t *i_ctx_p)
register os_ptr bsp;
switch (r_type(op)) {
- case t_array:
- if (!r_has_attr(op, a_write)) {
- return 0; /* per PLRM3 */
- }
- case t_mixedarray:
- case t_shortarray:
- defn = *op;
- break;
- case t_oparray:
- defn = *op->value.const_refs;
- break;
- default:
- return_op_typecheck(op);
+ case t_array:
+ if (!r_has_attr(op, a_write)) {
+ return 0; /* per PLRM3 */
+ }
+ case t_mixedarray:
+ case t_shortarray:
+ defn = *op;
+ break;
+ case t_oparray:
+ defn = *op->value.const_refs;
+ break;
+ default:
+ return_op_typecheck(op);
}
push(1);
*op = defn;
@@ -75,86 +75,86 @@ zbind(i_ctx_t *i_ctx_p)
* *p is an array (or packedarray) ref.
*/
while (depth) {
- while (r_size(bsp)) {
- ref_packed *const tpp = (ref_packed *)bsp->value.packed; /* break const */
-
- r_dec_size(bsp, 1);
- if (r_is_packed(tpp)) {
- /* Check for a packed executable name */
- ushort elt = *tpp;
-
- if (r_packed_is_exec_name(&elt)) {
- ref nref;
- ref *pvalue;
-
- name_index_ref(imemory, packed_name_index(&elt),
- &nref);
- if ((pvalue = dict_find_name(&nref)) != 0 &&
- r_is_ex_oper(pvalue)
- ) {
- store_check_dest(bsp, pvalue);
- /*
- * Always save the change, since this can only
- * happen once.
- */
- ref_do_save(bsp, tpp, "bind");
- *tpp = pt_tag(pt_executable_operator) +
- op_index(pvalue);
- }
- }
- bsp->value.packed = tpp + 1;
- } else {
- ref *const tp = bsp->value.refs++;
-
- switch (r_type(tp)) {
- case t_name: /* bind the name if an operator */
- if (r_has_attr(tp, a_executable)) {
- ref *pvalue;
-
- if ((pvalue = dict_find_name(tp)) != 0 &&
- r_is_ex_oper(pvalue)
- ) {
- store_check_dest(bsp, pvalue);
- ref_assign_old(bsp, tp, pvalue, "bind");
- }
- }
- break;
- case t_array: /* push into array if writable */
- if (!r_has_attr(tp, a_write))
- break;
- case t_mixedarray:
- case t_shortarray:
- if (r_has_attr(tp, a_executable)) {
- /* Make reference read-only */
- r_clear_attrs(tp, a_write);
- if (bsp >= ostop) {
- /* Push a new stack block. */
- ref temp;
- int code;
-
- temp = *tp;
- osp = bsp;
- code = ref_stack_push(&o_stack, 1);
- if (code < 0) {
- ref_stack_pop(&o_stack, depth);
- return_error(code);
- }
- bsp = osp;
- *bsp = temp;
- } else
- *++bsp = *tp;
- depth++;
- }
- }
- }
- }
- bsp--;
- depth--;
- if (bsp < osbot) { /* Pop back to the previous stack block. */
- osp = bsp;
- ref_stack_pop_block(&o_stack);
- bsp = osp;
- }
+ while (r_size(bsp)) {
+ ref_packed *const tpp = (ref_packed *)bsp->value.packed; /* break const */
+
+ r_dec_size(bsp, 1);
+ if (r_is_packed(tpp)) {
+ /* Check for a packed executable name */
+ ushort elt = *tpp;
+
+ if (r_packed_is_exec_name(&elt)) {
+ ref nref;
+ ref *pvalue;
+
+ name_index_ref(imemory, packed_name_index(&elt),
+ &nref);
+ if ((pvalue = dict_find_name(&nref)) != 0 &&
+ r_is_ex_oper(pvalue)
+ ) {
+ store_check_dest(bsp, pvalue);
+ /*
+ * Always save the change, since this can only
+ * happen once.
+ */
+ ref_do_save(bsp, tpp, "bind");
+ *tpp = pt_tag(pt_executable_operator) +
+ op_index(pvalue);
+ }
+ }
+ bsp->value.packed = tpp + 1;
+ } else {
+ ref *const tp = bsp->value.refs++;
+
+ switch (r_type(tp)) {
+ case t_name: /* bind the name if an operator */
+ if (r_has_attr(tp, a_executable)) {
+ ref *pvalue;
+
+ if ((pvalue = dict_find_name(tp)) != 0 &&
+ r_is_ex_oper(pvalue)
+ ) {
+ store_check_dest(bsp, pvalue);
+ ref_assign_old(bsp, tp, pvalue, "bind");
+ }
+ }
+ break;
+ case t_array: /* push into array if writable */
+ if (!r_has_attr(tp, a_write))
+ break;
+ case t_mixedarray:
+ case t_shortarray:
+ if (r_has_attr(tp, a_executable)) {
+ /* Make reference read-only */
+ r_clear_attrs(tp, a_write);
+ if (bsp >= ostop) {
+ /* Push a new stack block. */
+ ref temp;
+ int code;
+
+ temp = *tp;
+ osp = bsp;
+ code = ref_stack_push(&o_stack, 1);
+ if (code < 0) {
+ ref_stack_pop(&o_stack, depth);
+ return_error(code);
+ }
+ bsp = osp;
+ *bsp = temp;
+ } else
+ *++bsp = *tp;
+ depth++;
+ }
+ }
+ }
+ }
+ bsp--;
+ depth--;
+ if (bsp < osbot) { /* Pop back to the previous stack block. */
+ osp = bsp;
+ ref_stack_pop_block(&o_stack);
+ bsp = osp;
+ }
}
osp = bsp;
return 0;
@@ -215,22 +215,22 @@ zgetenv(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
str = ref_to_string(op, imemory, "getenv key");
if (str == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
if (gp_getenv(str, (char *)0, &len) > 0) { /* key missing */
- ifree_string((byte *) str, r_size(op) + 1, "getenv key");
- make_false(op);
- return 0;
+ ifree_string((byte *) str, r_size(op) + 1, "getenv key");
+ make_false(op);
+ return 0;
}
value = ialloc_string(len, "getenv value");
if (value == 0) {
- ifree_string((byte *) str, r_size(op) + 1, "getenv key");
- return_error(e_VMerror);
+ ifree_string((byte *) str, r_size(op) + 1, "getenv key");
+ return_error(e_VMerror);
}
DISCARD(gp_getenv(str, (char *)value, &len)); /* can't fail */
ifree_string((byte *) str, r_size(op) + 1, "getenv key");
/* Delete the stupid C string terminator. */
value = iresize_string(value, len, len - 1,
- "getenv value"); /* can't fail */
+ "getenv value"); /* can't fail */
push(1);
make_string(op - 1, a_all | icurrent_space, len - 1, value);
make_true(op);
@@ -247,20 +247,20 @@ zdefaultpapersize(i_ctx_t *i_ctx_p)
int len = 0;
if (gp_defaultpapersize((char *)0, &len) > 0) {
- /* no default paper size */
+ /* no default paper size */
push(1);
- make_false(op);
- return 0;
+ make_false(op);
+ return 0;
}
value = ialloc_string(len, "defaultpapersize value");
if (value == 0) {
- return_error(e_VMerror);
+ return_error(e_VMerror);
}
DISCARD(gp_defaultpapersize((char *)value, &len)); /* can't fail */
/* Delete the stupid C string terminator. */
value = iresize_string(value, len, len - 1,
- "defaultpapersize value"); /* can't fail */
+ "defaultpapersize value"); /* can't fail */
push(2);
make_string(op - 1, a_all | icurrent_space, len - 1, value);
make_true(op);
@@ -279,14 +279,14 @@ zmakeoperator(i_ctx_t *i_ctx_p)
check_type(op[-1], t_name);
check_proc(*op);
switch (r_space(op)) {
- case avm_global:
- opt = &i_ctx_p->op_array_table_global;
- break;
- case avm_local:
- opt = &i_ctx_p->op_array_table_local;
- break;
- default:
- return_error(e_invalidaccess);
+ case avm_global:
+ opt = &i_ctx_p->op_array_table_global;
+ break;
+ case avm_local:
+ opt = &i_ctx_p->op_array_table_local;
+ break;
+ default:
+ return_error(e_invalidaccess);
}
count = opt->count;
tab = opt->table.value.refs;
@@ -299,9 +299,9 @@ zmakeoperator(i_ctx_t *i_ctx_p)
* to find the true end of the table.
*/
while (count > 0 && r_has_type(&tab[count - 1], t_null))
- --count;
+ --count;
if (count == r_size(&opt->table))
- return_error(e_limitcheck);
+ return_error(e_limitcheck);
ref_assign_old(&opt->table, &tab[count], op, "makeoperator");
opt->nx_table[count] = name_index(imemory, op - 1);
op_index_ref(imemory, opt->base_index + count, op - 1);
@@ -347,18 +347,18 @@ zoserrorstring(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
str = gp_strerror((int)op->value.intval);
if (str == 0 || (len = strlen(str)) == 0) {
- make_false(op);
- return 0;
+ make_false(op);
+ return 0;
}
check_ostack(1);
code = string_to_ref(str, op, iimemory, ".oserrorstring");
if (code < 0)
- return code;
+ return code;
/* Strip trailing end-of-line characters. */
while ((len = r_size(op)) != 0 &&
- ((ch = op->value.bytes[--len]) == '\r' || ch == '\n')
- )
- r_dec_size(op, 1);
+ ((ch = op->value.bytes[--len]) == '\r' || ch == '\n')
+ )
+ r_dec_size(op, 1);
push(1);
make_true(op);
return 0;
@@ -372,17 +372,17 @@ zsetdebug(i_ctx_t *i_ctx_p)
check_read_type(op[-1], t_string);
check_type(*op, t_boolean);
{
- int i;
+ int i;
- for (i = 0; i < r_size(op - 1); i++)
- gs_debug[op[-1].value.bytes[i] & 127] =
- op->value.boolval;
+ for (i = 0; i < r_size(op - 1); i++)
+ gs_debug[op[-1].value.bytes[i] & 127] =
+ op->value.boolval;
}
pop(2);
return 0;
}
-/* There are a few cases where a customer/user might want CPSI behavior
+/* There are a few cases where a customer/user might want CPSI behavior
* instead of the GS default behavior. cmyk_to_rgb and Type 1 char fill
* method are two that have come up so far. This operator allows a PS
* program to control the behavior without needing to recompile.
@@ -417,7 +417,7 @@ zgetCPSImode(i_ctx_t *i_ctx_p)
* (value) (key) .pcacheinsert
* (key) .pcachequery { (\n) concatstrings print } if
*/
-
+
#ifdef DEBUG_CACHE
/* <string> <string> .pcacheinsert */
@@ -428,20 +428,20 @@ zpcacheinsert(i_ctx_t *i_ctx_p)
char *key, *buffer;
int keylen, buflen;
int code = 0;
-
+
check_read_type(*op, t_string);
keylen = r_size(op);
key = op->value.bytes;
check_read_type(*(op - 1), t_string);
buflen = r_size(op - 1);
buffer = (op - 1)->value.bytes;
-
+
code = gp_cache_insert(0, key, keylen, buffer, buflen);
if (code < 0)
- return code;
-
- pop(2);
-
+ return code;
+
+ pop(2);
+
return code;
}
@@ -449,7 +449,7 @@ zpcacheinsert(i_ctx_t *i_ctx_p)
static void *
pcache_alloc_callback(void *userdata, int bytes)
{
- i_ctx_t *i_ctx_p = (i_ctx_t*)userdata;
+ i_ctx_t *i_ctx_p = (i_ctx_t*)userdata;
return ialloc_string(bytes, "pcache buffer");
}
@@ -458,28 +458,28 @@ pcache_alloc_callback(void *userdata, int bytes)
static int
zpcachequery(i_ctx_t *i_ctx_p)
{
- os_ptr op = osp;
- int len;
- char *key;
- byte *string;
- int code = 0;
-
- check_read_type(*op, t_string);
- len = r_size(op);
- key = op->value.bytes;
- len = gp_cache_query(GP_CACHE_TYPE_TEST, key, len, (void**)&string, &pcache_alloc_callback, i_ctx_p);
- if (len < 0) {
- make_false(op);
- return 0;
- }
- if (string == NULL)
- return_error(e_VMerror);
- make_string(op, a_all | icurrent_space, len, string);
-
- push(1);
- make_true(op);
-
- return code;
+ os_ptr op = osp;
+ int len;
+ char *key;
+ byte *string;
+ int code = 0;
+
+ check_read_type(*op, t_string);
+ len = r_size(op);
+ key = op->value.bytes;
+ len = gp_cache_query(GP_CACHE_TYPE_TEST, key, len, (void**)&string, &pcache_alloc_callback, i_ctx_p);
+ if (len < 0) {
+ make_false(op);
+ return 0;
+ }
+ if (string == NULL)
+ return_error(e_VMerror);
+ make_string(op, a_all | icurrent_space, len, string);
+
+ push(1);
+ make_true(op);
+
+ return code;
}
#endif /* DEBUG_CACHE */
@@ -502,7 +502,7 @@ const op_def zmisc_op_defs[] =
{"1.setCPSImode", zsetCPSImode},
{"0.getCPSImode", zgetCPSImode},
#ifdef DEBUG_CACHE
- /* pcache test */
+ /* pcache test */
{"2.pcacheinsert", zpcacheinsert},
{"1.pcachequery", zpcachequery},
#endif
diff --git a/gs/psi/zmisc1.c b/gs/psi/zmisc1.c
index 4a457edc5..3ee8d301e 100644
--- a/gs/psi/zmisc1.c
+++ b/gs/psi/zmisc1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -27,7 +27,7 @@
/* <state> <from_string> <to_string> .type1encrypt <new_state> <substring> */
/* <state> <from_string> <to_string> .type1decrypt <new_state> <substring> */
static int type1crypt(i_ctx_t *,
- int (*)(byte *, const byte *, uint, ushort *));
+ int (*)(byte *, const byte *, uint, ushort *));
static int
ztype1encrypt(i_ctx_t *i_ctx_p)
{
@@ -40,7 +40,7 @@ ztype1decrypt(i_ctx_t *i_ctx_p)
}
static int
type1crypt(i_ctx_t *i_ctx_p,
- int (*proc)(byte *, const byte *, uint, ushort *))
+ int (*proc)(byte *, const byte *, uint, ushort *))
{
os_ptr op = osp;
crypt_state state;
@@ -49,14 +49,14 @@ type1crypt(i_ctx_t *i_ctx_p,
check_type(op[-2], t_integer);
state = op[-2].value.intval;
if (op[-2].value.intval != state)
- return_error(e_rangecheck); /* state value was truncated */
+ return_error(e_rangecheck); /* state value was truncated */
check_read_type(op[-1], t_string);
check_write_type(*op, t_string);
ssize = r_size(op - 1);
if (r_size(op) < ssize)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
discard((*proc)(op->value.bytes, op[-1].value.const_bytes, ssize,
- &state)); /* can't fail */
+ &state)); /* can't fail */
op[-2].value.intval = state;
op[-1] = *op;
r_set_size(op - 1, ssize);
@@ -72,11 +72,11 @@ eexec_param(os_ptr op, ushort * pcstate)
int npop = 1;
if (r_has_type(op, t_dictionary))
- ++npop, --op;
+ ++npop, --op;
check_type(*op, t_integer);
*pcstate = op->value.intval;
if (op->value.intval != *pcstate)
- return_error(e_rangecheck); /* state value was truncated */
+ return_error(e_rangecheck); /* state value was truncated */
return npop;
}
@@ -90,7 +90,7 @@ zexE(i_ctx_t *i_ctx_p)
int code = eexec_param(op, &state.cstate);
if (code < 0)
- return code;
+ return code;
return filter_write(i_ctx_p, code, &s_exE_template, (stream_state *)&state, 0);
}
@@ -105,58 +105,58 @@ zexD(i_ctx_t *i_ctx_p)
(*s_exD_template.set_defaults)((stream_state *)&state);
if (r_has_type(op, t_dictionary)) {
- uint cstate;
+ uint cstate;
bool is_eexec;
- check_dict_read(*op);
- if ((code = dict_uint_param(op, "seed", 0, 0xffff, 0x10000,
- &cstate)) < 0 ||
- (code = dict_int_param(op, "lenIV", 0, max_int, 4,
- &state.lenIV)) < 0 ||
- (code = dict_bool_param(op, "eexec", false,
- &is_eexec)) < 0 ||
- (code = dict_bool_param(op, "keep_spaces", false,
- &state.keep_spaces)) < 0
- )
- return code;
- state.cstate = cstate;
+ check_dict_read(*op);
+ if ((code = dict_uint_param(op, "seed", 0, 0xffff, 0x10000,
+ &cstate)) < 0 ||
+ (code = dict_int_param(op, "lenIV", 0, max_int, 4,
+ &state.lenIV)) < 0 ||
+ (code = dict_bool_param(op, "eexec", false,
+ &is_eexec)) < 0 ||
+ (code = dict_bool_param(op, "keep_spaces", false,
+ &state.keep_spaces)) < 0
+ )
+ return code;
+ state.cstate = cstate;
state.binary = (is_eexec ? -1 : 1);
- code = 1;
+ code = 1;
} else {
state.binary = 1;
- code = eexec_param(op, &state.cstate);
+ code = eexec_param(op, &state.cstate);
}
if (code < 0)
- return code;
+ return code;
/*
* If we're reading a .PFB file, let the filter know about it,
* so it can read recklessly to the end of the binary section.
*/
if (r_has_type(op - 1, t_file)) {
- stream *s = (op - 1)->value.pfile;
-
- if (s->state != 0 && s->state->template == &s_PFBD_template) {
- stream_PFBD_state *pss = (stream_PFBD_state *)s->state;
-
- state.pfb_state = pss;
- /*
- * If we're reading the binary section of a PFB stream,
- * avoid the conversion from binary to hex and back again.
- */
- if (pss->record_type == 2) {
- /*
- * The PFB decoder may have converted some data to hex
- * already. Convert it back if necessary.
- */
- if (pss->binary_to_hex && sbufavailable(s) > 0) {
- state.binary = 0; /* start as hex */
- state.hex_left = sbufavailable(s);
- } else {
- state.binary = 1;
- }
- pss->binary_to_hex = 0;
- }
- }
+ stream *s = (op - 1)->value.pfile;
+
+ if (s->state != 0 && s->state->template == &s_PFBD_template) {
+ stream_PFBD_state *pss = (stream_PFBD_state *)s->state;
+
+ state.pfb_state = pss;
+ /*
+ * If we're reading the binary section of a PFB stream,
+ * avoid the conversion from binary to hex and back again.
+ */
+ if (pss->record_type == 2) {
+ /*
+ * The PFB decoder may have converted some data to hex
+ * already. Convert it back if necessary.
+ */
+ if (pss->binary_to_hex && sbufavailable(s) > 0) {
+ state.binary = 0; /* start as hex */
+ state.hex_left = sbufavailable(s);
+ } else {
+ state.binary = 1;
+ }
+ pss->binary_to_hex = 0;
+ }
+ }
}
return filter_read(i_ctx_p, code, &s_exD_template, (stream_state *)&state, 0);
}
diff --git a/gs/psi/zmisc2.c b/gs/psi/zmisc2.c
index a45f37ae2..6bf957b9a 100644
--- a/gs/psi/zmisc2.c
+++ b/gs/psi/zmisc2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -53,9 +53,9 @@ zsetlanguagelevel(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval != LANGUAGE_LEVEL) {
- code = set_language_level(i_ctx_p, (int)op->value.intval);
- if (code < 0)
- return code;
+ code = set_language_level(i_ctx_p, (int)op->value.intval);
+ if (code < 0)
+ return code;
}
LANGUAGE_LEVEL = op->value.intval;
pop(1);
@@ -81,23 +81,23 @@ const op_def zmisc2_op_defs[] =
*/
static int swap_level_dict(i_ctx_t *i_ctx_p, const char *dict_name);
static int swap_entry(i_ctx_t *i_ctx_p, ref elt[2], ref * pdict,
- ref * pdict2);
+ ref * pdict2);
static int
set_language_level(i_ctx_t *i_ctx_p, int new_level)
{
int old_level = LANGUAGE_LEVEL;
ref *pgdict = /* globaldict, if present */
- ref_stack_index(&d_stack, ref_stack_count(&d_stack) - 2);
+ ref_stack_index(&d_stack, ref_stack_count(&d_stack) - 2);
ref *level2dict;
int code = 0;
if (new_level < 1 ||
- new_level >
- (dict_find_string(systemdict, "ll3dict", &level2dict) > 0 ? 3 : 2)
- )
- return_error(e_rangecheck);
+ new_level >
+ (dict_find_string(systemdict, "ll3dict", &level2dict) > 0 ? 3 : 2)
+ )
+ return_error(e_rangecheck);
if (dict_find_string(systemdict, "level2dict", &level2dict) <= 0)
- return_error(e_undefined);
+ return_error(e_undefined);
/*
* As noted in dstack.h, we allocate the extra d-stack entry for
* globaldict even in Level 1 mode; in Level 1 mode, this entry
@@ -105,66 +105,66 @@ set_language_level(i_ctx_t *i_ctx_p, int new_level)
* very bottommost entry.
*/
while (new_level != old_level) {
- switch (old_level) {
- case 1: { /* 1 => 2 or 3 */
- /* Put globaldict in the dictionary stack. */
- ref *pdict;
+ switch (old_level) {
+ case 1: { /* 1 => 2 or 3 */
+ /* Put globaldict in the dictionary stack. */
+ ref *pdict;
- /*
- * This might be called so early in initialization that
- * globaldict hasn't been defined yet. If so, just skip
- * this step.
- */
- code = dict_find_string(level2dict, "globaldict", &pdict);
- if (code > 0) {
- if (!r_has_type(pdict, t_dictionary))
- return_error(e_typecheck);
- *pgdict = *pdict;
- }
- /* Set other flags for Level 2 operation. */
- imemory->gs_lib_ctx->dict_auto_expand = true;
- }
- code = swap_level_dict(i_ctx_p, "level2dict");
- if (code < 0)
- return code;
- ++old_level;
- continue;
- case 3: /* 3 => 1 or 2 */
- code = swap_level_dict(i_ctx_p, "ll3dict");
- if (code < 0)
- return code;
- --old_level;
- continue;
- default: /* 2 => 1 or 3 */
- break;
- }
- switch (new_level) {
- case 1: { /* 2 => 1 */
- /*
- * Clear the cached definition pointers of all names defined
- * in globaldict. This will slow down future lookups, but
- * we don't care.
- */
- int index = dict_first(pgdict);
- ref elt[2];
+ /*
+ * This might be called so early in initialization that
+ * globaldict hasn't been defined yet. If so, just skip
+ * this step.
+ */
+ code = dict_find_string(level2dict, "globaldict", &pdict);
+ if (code > 0) {
+ if (!r_has_type(pdict, t_dictionary))
+ return_error(e_typecheck);
+ *pgdict = *pdict;
+ }
+ /* Set other flags for Level 2 operation. */
+ imemory->gs_lib_ctx->dict_auto_expand = true;
+ }
+ code = swap_level_dict(i_ctx_p, "level2dict");
+ if (code < 0)
+ return code;
+ ++old_level;
+ continue;
+ case 3: /* 3 => 1 or 2 */
+ code = swap_level_dict(i_ctx_p, "ll3dict");
+ if (code < 0)
+ return code;
+ --old_level;
+ continue;
+ default: /* 2 => 1 or 3 */
+ break;
+ }
+ switch (new_level) {
+ case 1: { /* 2 => 1 */
+ /*
+ * Clear the cached definition pointers of all names defined
+ * in globaldict. This will slow down future lookups, but
+ * we don't care.
+ */
+ int index = dict_first(pgdict);
+ ref elt[2];
- while ((index = dict_next(pgdict, index, &elt[0])) >= 0)
- if (r_has_type(&elt[0], t_name))
- name_invalidate_value_cache(imemory, &elt[0]);
- /* Overwrite globaldict in the dictionary stack. */
- *pgdict = *systemdict;
- /* Set other flags for Level 1 operation. */
- imemory->gs_lib_ctx->dict_auto_expand = false;
- }
- code = swap_level_dict(i_ctx_p, "level2dict");
- break;
- case 3: /* 2 => 3 */
- code = swap_level_dict(i_ctx_p, "ll3dict");
- break;
- default: /* not possible */
- return_error(e_Fatal);
- }
- break;
+ while ((index = dict_next(pgdict, index, &elt[0])) >= 0)
+ if (r_has_type(&elt[0], t_name))
+ name_invalidate_value_cache(imemory, &elt[0]);
+ /* Overwrite globaldict in the dictionary stack. */
+ *pgdict = *systemdict;
+ /* Set other flags for Level 1 operation. */
+ imemory->gs_lib_ctx->dict_auto_expand = false;
+ }
+ code = swap_level_dict(i_ctx_p, "level2dict");
+ break;
+ case 3: /* 2 => 3 */
+ code = swap_level_dict(i_ctx_p, "ll3dict");
+ break;
+ default: /* not possible */
+ return_error(e_Fatal);
+ }
+ break;
}
dict_set_top(); /* reload dict stack cache */
return code;
@@ -191,37 +191,37 @@ swap_level_dict(i_ctx_t *i_ctx_p, const char *dict_name)
* move if their containing dictionary is resized.
*/
if (dict_find_string(systemdict, dict_name, &pleveldict) <= 0)
- return_error(e_undefined);
+ return_error(e_undefined);
rleveldict = *pleveldict;
index = dict_first(&rleveldict);
while ((index = dict_next(&rleveldict, index, &elt[0])) >= 0)
- if (r_has_type(&elt[1], t_dictionary) &&
- dict_find(&elt[1], &elt[0], &psubdict) > 0 &&
- obj_eq(imemory, &elt[1], psubdict)
- ) {
- /* elt[1] is the 2nd-level sub-dictionary */
- int isub = dict_first(&elt[1]);
- ref subelt[2];
- int found = dict_find(systemdict, &elt[0], &psubdict);
- ref rsubdict;
+ if (r_has_type(&elt[1], t_dictionary) &&
+ dict_find(&elt[1], &elt[0], &psubdict) > 0 &&
+ obj_eq(imemory, &elt[1], psubdict)
+ ) {
+ /* elt[1] is the 2nd-level sub-dictionary */
+ int isub = dict_first(&elt[1]);
+ ref subelt[2];
+ int found = dict_find(systemdict, &elt[0], &psubdict);
+ ref rsubdict;
- if (found <= 0)
- continue;
- rsubdict = *psubdict;
- while ((isub = dict_next(&elt[1], isub, &subelt[0])) >= 0)
- if (!obj_eq(imemory, &subelt[0], &elt[0])) {
- /* don't swap dict itself */
- int code = swap_entry(i_ctx_p, subelt, &rsubdict, &elt[1]);
+ if (found <= 0)
+ continue;
+ rsubdict = *psubdict;
+ while ((isub = dict_next(&elt[1], isub, &subelt[0])) >= 0)
+ if (!obj_eq(imemory, &subelt[0], &elt[0])) {
+ /* don't swap dict itself */
+ int code = swap_entry(i_ctx_p, subelt, &rsubdict, &elt[1]);
- if (code < 0)
- return code;
- }
- } else {
- int code = swap_entry(i_ctx_p, elt, systemdict, &rleveldict);
+ if (code < 0)
+ return code;
+ }
+ } else {
+ int code = swap_entry(i_ctx_p, elt, systemdict, &rleveldict);
- if (code < 0)
- return code;
- }
+ if (code < 0)
+ return code;
+ }
return 0;
}
@@ -238,17 +238,17 @@ swap_entry(i_ctx_t *i_ctx_p, ref elt[2], ref * pdict, ref * pdict2)
int found = dict_find(pdict, &elt[0], &pvalue);
switch (found) {
- default: /* <0, error */
- /*
- * The only possible error here is a dictfull error, which is
- * harmless.
- */
- /* fall through */
- case 0: /* missing */
- make_null(&old_value);
- break;
- case 1: /* present */
- old_value = *pvalue;
+ default: /* <0, error */
+ /*
+ * The only possible error here is a dictfull error, which is
+ * harmless.
+ */
+ /* fall through */
+ case 0: /* missing */
+ make_null(&old_value);
+ break;
+ case 1: /* present */
+ old_value = *pvalue;
}
/*
* Temporarily flag the dictionaries as local, so that we don't
@@ -257,25 +257,25 @@ swap_entry(i_ctx_t *i_ctx_p, ref elt[2], ref * pdict, ref * pdict2)
* local objects even if they are global.)
*/
{
- uint space2 = r_space(pdict2);
- int code;
+ uint space2 = r_space(pdict2);
+ int code;
- r_set_space(pdict2, avm_local);
- idict_put(pdict2, &elt[0], &old_value);
- if (r_has_type(&elt[1], t_null)) {
- code = idict_undef(pdict, &elt[0]);
- if (code == e_undefined &&
- r_has_type(&old_value, t_null)
- )
- code = 0;
- } else {
- uint space = r_space(pdict);
+ r_set_space(pdict2, avm_local);
+ idict_put(pdict2, &elt[0], &old_value);
+ if (r_has_type(&elt[1], t_null)) {
+ code = idict_undef(pdict, &elt[0]);
+ if (code == e_undefined &&
+ r_has_type(&old_value, t_null)
+ )
+ code = 0;
+ } else {
+ uint space = r_space(pdict);
- r_set_space(pdict, avm_local);
- code = idict_put(pdict, &elt[0], &elt[1]);
- r_set_space(pdict, space);
- }
- r_set_space(pdict2, space2);
- return code;
+ r_set_space(pdict, avm_local);
+ code = idict_put(pdict, &elt[0], &elt[1]);
+ r_set_space(pdict, space);
+ }
+ r_set_space(pdict2, space2);
+ return code;
}
}
diff --git a/gs/psi/zmisc3.c b/gs/psi/zmisc3.c
index 840d9c41e..5755d9abf 100644
--- a/gs/psi/zmisc3.c
+++ b/gs/psi/zmisc3.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,7 +43,7 @@ zcliprestore(i_ctx_t *i_ctx_p)
*/
/* Adobe specifies maximum depth of 10 but 12 is needed */
/* to reproduce the observed behavior. CET 31-01-05 */
-#define MAX_DEPTH 12
+#define MAX_DEPTH 12
typedef struct ref2_s {
ref proc1, proc2;
} ref2_t;
@@ -57,54 +57,54 @@ zeqproc(i_ctx_t *i_ctx_p)
make_array(&stack[0].proc1, 0, 1, op - 1);
make_array(&stack[0].proc2, 0, 1, op);
for (;;) {
- long i;
+ long i;
- if (r_size(&top->proc1) == 0) {
- /* Finished these arrays, go up to next level. */
- if (top == stack) {
- /* We're done matching: it succeeded. */
- make_true(op - 1);
- pop(1);
- return 0;
- }
- --top;
- continue;
- }
- /* Look at the next elements of the arrays. */
- i = r_size(&top->proc1) - 1;
- array_get(imemory, &top->proc1, i, &top[1].proc1);
- array_get(imemory, &top->proc2, i, &top[1].proc2);
- r_dec_size(&top->proc1, 1);
- ++top;
- /*
- * Amazingly enough, the objects' executable attributes are not
- * required to match. This means { x load } will match { /x load },
- * even though this is clearly wrong.
- */
+ if (r_size(&top->proc1) == 0) {
+ /* Finished these arrays, go up to next level. */
+ if (top == stack) {
+ /* We're done matching: it succeeded. */
+ make_true(op - 1);
+ pop(1);
+ return 0;
+ }
+ --top;
+ continue;
+ }
+ /* Look at the next elements of the arrays. */
+ i = r_size(&top->proc1) - 1;
+ array_get(imemory, &top->proc1, i, &top[1].proc1);
+ array_get(imemory, &top->proc2, i, &top[1].proc2);
+ r_dec_size(&top->proc1, 1);
+ ++top;
+ /*
+ * Amazingly enough, the objects' executable attributes are not
+ * required to match. This means { x load } will match { /x load },
+ * even though this is clearly wrong.
+ */
#if 0
- if (r_has_attr(&top->proc1, a_executable) !=
- r_has_attr(&top->proc2, a_executable)
- )
- break;
+ if (r_has_attr(&top->proc1, a_executable) !=
+ r_has_attr(&top->proc2, a_executable)
+ )
+ break;
#endif
- if (obj_eq(imemory, &top->proc1, &top->proc2)) {
- /* Names don't match strings. */
- if (r_type(&top->proc1) != r_type(&top->proc2) &&
- (r_type(&top->proc1) == t_name ||
- r_type(&top->proc2) == t_name)
- )
- break;
- --top; /* no recursion */
- continue;
- }
- if (r_is_array(&top->proc1) && r_is_array(&top->proc2) &&
- r_size(&top->proc1) == r_size(&top->proc2) &&
- top < stack + (MAX_DEPTH - 1)
- ) {
- /* Descend into the arrays. */
- continue;
- }
- break;
+ if (obj_eq(imemory, &top->proc1, &top->proc2)) {
+ /* Names don't match strings. */
+ if (r_type(&top->proc1) != r_type(&top->proc2) &&
+ (r_type(&top->proc1) == t_name ||
+ r_type(&top->proc2) == t_name)
+ )
+ break;
+ --top; /* no recursion */
+ continue;
+ }
+ if (r_is_array(&top->proc1) && r_is_array(&top->proc2) &&
+ r_size(&top->proc1) == r_size(&top->proc2) &&
+ top < stack + (MAX_DEPTH - 1)
+ ) {
+ /* Descend into the arrays. */
+ continue;
+ }
+ break;
}
/* An exit from the loop indicates that matching failed. */
make_false(op - 1);
diff --git a/gs/psi/zncdummy.c b/gs/psi/zncdummy.c
index d30c9d1b6..5cb911201 100644
--- a/gs/psi/zncdummy.c
+++ b/gs/psi/zncdummy.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2007 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/zpacked.c b/gs/psi/zpacked.c
index 469cd81fa..6e1c4b3d5 100644
--- a/gs/psi/zpacked.c
+++ b/gs/psi/zpacked.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -46,17 +46,17 @@ zpackedarray(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval < 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (op->value.intval > op - osbot &&
- op->value.intval >= ref_stack_count(&o_stack)
- )
- return_error(e_stackunderflow);
+ op->value.intval >= ref_stack_count(&o_stack)
+ )
+ return_error(e_stackunderflow);
osp--;
code = make_packed_array(&parr, &o_stack, (uint) op->value.intval,
- idmemory, "packedarray");
+ idmemory, "packedarray");
osp++;
if (code >= 0)
- *osp = parr;
+ *osp = parr;
return code;
}
@@ -81,7 +81,7 @@ zsetpacking(i_ctx_t *i_ctx_p)
#undef idmemory /****** NOTA BENE ******/
int
make_packed_array(ref * parr, ref_stack_t * pstack, uint size,
- gs_dual_memory_t *idmemory, client_name_t cname)
+ gs_dual_memory_t *idmemory, client_name_t cname)
{
uint i;
const ref *pref;
@@ -89,7 +89,7 @@ make_packed_array(ref * parr, ref_stack_t * pstack, uint size,
ref_packed *pbody;
ref_packed *pdest;
ref_packed *pshort; /* points to start of */
- /* last run of short elements */
+ /* last run of short elements */
gs_ref_memory_t *imem = idmemory->current;
uint space = imemory_space(imem);
int skip = 0, pad;
@@ -100,63 +100,63 @@ make_packed_array(ref * parr, ref_stack_t * pstack, uint size,
/* and to detect local-into-global stores. */
for (i = size; i != 0; i--) {
- pref = ref_stack_index(pstack, i - 1);
- switch (r_btype(pref)) { /* not r_type, opers are special */
- case t_name:
- if (name_index(imem, pref) >= packed_name_max_index)
- break; /* can't pack */
- idest++;
- continue;
- case t_integer:
- if (pref->value.intval < packed_min_intval ||
- pref->value.intval > packed_max_intval
- )
- break;
- idest++;
- continue;
- case t_oparray:
- /* Check for local-into-global store. */
- store_check_space(space, pref);
- /* falls through */
- case t_operator:
- {
- uint oidx;
-
- if (!r_has_attr(pref, a_executable))
- break;
- oidx = op_index(pref);
- if (oidx == 0 || oidx > packed_int_mask)
- break;
- }
- idest++;
- continue;
- default:
- /* Check for local-into-global store. */
- store_check_space(space, pref);
- }
- /* Can't pack this element, use a full ref. */
- /* We may have to unpack up to align_packed_per_ref - 1 */
- /* preceding short elements. */
- /* If we are at the beginning of the array, however, */
- /* we can just move the elements up. */
- {
- int i = (idest - ishort) & (align_packed_per_ref - 1);
-
- if (ishort == 0) /* first time */
- idest += skip = -i & (align_packed_per_ref - 1);
- else
- idest += (packed_per_ref - 1) * i;
- }
- ishort = idest += packed_per_ref;
+ pref = ref_stack_index(pstack, i - 1);
+ switch (r_btype(pref)) { /* not r_type, opers are special */
+ case t_name:
+ if (name_index(imem, pref) >= packed_name_max_index)
+ break; /* can't pack */
+ idest++;
+ continue;
+ case t_integer:
+ if (pref->value.intval < packed_min_intval ||
+ pref->value.intval > packed_max_intval
+ )
+ break;
+ idest++;
+ continue;
+ case t_oparray:
+ /* Check for local-into-global store. */
+ store_check_space(space, pref);
+ /* falls through */
+ case t_operator:
+ {
+ uint oidx;
+
+ if (!r_has_attr(pref, a_executable))
+ break;
+ oidx = op_index(pref);
+ if (oidx == 0 || oidx > packed_int_mask)
+ break;
+ }
+ idest++;
+ continue;
+ default:
+ /* Check for local-into-global store. */
+ store_check_space(space, pref);
+ }
+ /* Can't pack this element, use a full ref. */
+ /* We may have to unpack up to align_packed_per_ref - 1 */
+ /* preceding short elements. */
+ /* If we are at the beginning of the array, however, */
+ /* we can just move the elements up. */
+ {
+ int i = (idest - ishort) & (align_packed_per_ref - 1);
+
+ if (ishort == 0) /* first time */
+ idest += skip = -i & (align_packed_per_ref - 1);
+ else
+ idest += (packed_per_ref - 1) * i;
+ }
+ ishort = idest += packed_per_ref;
}
pad = -(int)idest & (packed_per_ref - 1); /* padding at end */
/* Now we can allocate the array. */
code = gs_alloc_ref_array(imem, &rtemp, 0, (idest + pad) / packed_per_ref,
- cname);
+ cname);
if (code < 0)
- return code;
+ return code;
pbody = (ref_packed *) rtemp.value.refs;
/* Make sure any initial skipped elements contain legal packed */
@@ -164,82 +164,82 @@ make_packed_array(ref * parr, ref_stack_t * pstack, uint size,
pshort = pbody;
for (; skip; skip--)
- *pbody++ = pt_tag(pt_integer);
+ *pbody++ = pt_tag(pt_integer);
pdest = pbody;
for (i = size; i != 0; i--) {
- pref = ref_stack_index(pstack, i - 1);
- switch (r_btype(pref)) { /* not r_type, opers are special */
- case t_name:
- {
- uint nidx = name_index(imem, pref);
-
- if (nidx >= packed_name_max_index)
- break; /* can't pack */
- *pdest++ = nidx +
- (r_has_attr(pref, a_executable) ?
- pt_tag(pt_executable_name) :
- pt_tag(pt_literal_name));
- }
- continue;
- case t_integer:
- if (pref->value.intval < packed_min_intval ||
- pref->value.intval > packed_max_intval
- )
- break;
- *pdest++ = pt_tag(pt_integer) +
- ((short)pref->value.intval - packed_min_intval);
- continue;
- case t_oparray:
- case t_operator:
- {
- uint oidx;
-
- if (!r_has_attr(pref, a_executable))
- break;
- oidx = op_index(pref);
- if (oidx == 0 || oidx > packed_int_mask)
- break;
- *pdest++ = pt_tag(pt_executable_operator) + oidx;
- }
- continue;
- }
- /* Can't pack this element, use a full ref. */
- /* We may have to unpack up to align_packed_per_ref - 1 */
- /* preceding short elements. */
- /* Note that if we are at the beginning of the array, */
- /* 'skip' already ensures that we don't need to do this. */
- {
- int i = (pdest - pshort) & (align_packed_per_ref - 1);
- const ref_packed *psrc = pdest;
- ref *pmove =
- (ref *) (pdest += (packed_per_ref - 1) * i);
-
- ref_assign_new(pmove, pref);
- while (--i >= 0) {
- --psrc;
- --pmove;
- packed_get(imem->non_gc_memory, psrc, pmove);
- }
- }
- pshort = pdest += packed_per_ref;
+ pref = ref_stack_index(pstack, i - 1);
+ switch (r_btype(pref)) { /* not r_type, opers are special */
+ case t_name:
+ {
+ uint nidx = name_index(imem, pref);
+
+ if (nidx >= packed_name_max_index)
+ break; /* can't pack */
+ *pdest++ = nidx +
+ (r_has_attr(pref, a_executable) ?
+ pt_tag(pt_executable_name) :
+ pt_tag(pt_literal_name));
+ }
+ continue;
+ case t_integer:
+ if (pref->value.intval < packed_min_intval ||
+ pref->value.intval > packed_max_intval
+ )
+ break;
+ *pdest++ = pt_tag(pt_integer) +
+ ((short)pref->value.intval - packed_min_intval);
+ continue;
+ case t_oparray:
+ case t_operator:
+ {
+ uint oidx;
+
+ if (!r_has_attr(pref, a_executable))
+ break;
+ oidx = op_index(pref);
+ if (oidx == 0 || oidx > packed_int_mask)
+ break;
+ *pdest++ = pt_tag(pt_executable_operator) + oidx;
+ }
+ continue;
+ }
+ /* Can't pack this element, use a full ref. */
+ /* We may have to unpack up to align_packed_per_ref - 1 */
+ /* preceding short elements. */
+ /* Note that if we are at the beginning of the array, */
+ /* 'skip' already ensures that we don't need to do this. */
+ {
+ int i = (pdest - pshort) & (align_packed_per_ref - 1);
+ const ref_packed *psrc = pdest;
+ ref *pmove =
+ (ref *) (pdest += (packed_per_ref - 1) * i);
+
+ ref_assign_new(pmove, pref);
+ while (--i >= 0) {
+ --psrc;
+ --pmove;
+ packed_get(imem->non_gc_memory, psrc, pmove);
+ }
+ }
+ pshort = pdest += packed_per_ref;
}
{
- int atype =
- (pdest == pbody + size ? t_shortarray : t_mixedarray);
+ int atype =
+ (pdest == pbody + size ? t_shortarray : t_mixedarray);
- /* Pad with legal packed refs so that the garbage collector */
- /* can scan storage. */
+ /* Pad with legal packed refs so that the garbage collector */
+ /* can scan storage. */
- for (; pad; pad--)
- *pdest++ = pt_tag(pt_integer);
+ for (; pad; pad--)
+ *pdest++ = pt_tag(pt_integer);
- /* Finally, make the array. */
+ /* Finally, make the array. */
- ref_stack_pop(pstack, size);
- make_tasv_new(parr, atype, a_readonly | space, size,
- packed, pbody + skip);
+ ref_stack_pop(pstack, size);
+ make_tasv_new(parr, atype, a_readonly | space, size,
+ packed, pbody + skip);
}
return 0;
}
diff --git a/gs/psi/zpaint.c b/gs/psi/zpaint.c
index 5e98f5d36..9c16c2a24 100644
--- a/gs/psi/zpaint.c
+++ b/gs/psi/zpaint.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -59,12 +59,12 @@ zimagepath(i_ctx_t *i_ctx_p)
check_type(op[-1], t_integer);
check_read_type(*op, t_string);
if (r_size(op) < ((op[-2].value.intval + 7) >> 3) * op[-1].value.intval)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
code = gs_imagepath(igs,
- (int)op[-2].value.intval, (int)op[-1].value.intval,
- op->value.const_bytes);
+ (int)op[-2].value.intval, (int)op[-1].value.intval,
+ op->value.const_bytes);
if (code >= 0)
- pop(3);
+ pop(3);
return code;
}
@@ -75,7 +75,7 @@ const op_def zpaint_op_defs[] =
{"0eofill", zeofill},
{"0fill", zfill},
{"0stroke", zstroke},
- /* Non-standard operators */
+ /* Non-standard operators */
{"0.fillpage", zfillpage},
{"3.imagepath", zimagepath},
op_def_end(0)
diff --git a/gs/psi/zpath.c b/gs/psi/zpath.c
index e610bcd32..558f57135 100644
--- a/gs/psi/zpath.c
+++ b/gs/psi/zpath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -23,7 +23,7 @@
/* Forward references */
static int common_to(i_ctx_t *,
- int (*)(gs_state *, floatp, floatp));
+ int (*)(gs_state *, floatp, floatp));
static int common_curve(i_ctx_t *,
int (*)(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp));
@@ -43,7 +43,7 @@ zcurrentpoint(i_ctx_t *i_ctx_p)
int code = gs_currentpoint(igs, &pt);
if (code < 0)
- return code;
+ return code;
push(2);
make_real(op - 1, pt.x);
make_real(op, pt.y);
@@ -81,16 +81,16 @@ zrlineto(i_ctx_t *i_ctx_p)
/* Common code for [r](move/line)to */
static int
common_to(i_ctx_t *i_ctx_p,
- int (*add_proc)(gs_state *, floatp, floatp))
+ int (*add_proc)(gs_state *, floatp, floatp))
{
os_ptr op = osp;
double opxy[2];
int code;
if ((code = num_params(op, 2, opxy)) < 0 ||
- (code = (*add_proc)(igs, opxy[0], opxy[1])) < 0
- )
- return code;
+ (code = (*add_proc)(igs, opxy[0], opxy[1])) < 0
+ )
+ return code;
pop(2);
return 0;
}
@@ -112,17 +112,17 @@ zrcurveto(i_ctx_t *i_ctx_p)
/* Common code for [r]curveto */
static int
common_curve(i_ctx_t *i_ctx_p,
- int (*add_proc)(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp))
+ int (*add_proc)(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp))
{
os_ptr op = osp;
double opxy[6];
int code;
if ((code = num_params(op, 6, opxy)) < 0)
- return code;
+ return code;
code = (*add_proc)(igs, opxy[0], opxy[1], opxy[2], opxy[3], opxy[4], opxy[5]);
if (code >= 0)
- pop(6);
+ pop(6);
return code;
}
diff --git a/gs/psi/zpath1.c b/gs/psi/zpath1.c
index f07319f7f..afcca4e53 100644
--- a/gs/psi/zpath1.c
+++ b/gs/psi/zpath1.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -26,7 +26,7 @@
/* Forward references */
static int common_arc(i_ctx_t *,
- int (*)(gs_state *, floatp, floatp, floatp, floatp, floatp));
+ int (*)(gs_state *, floatp, floatp, floatp, floatp, floatp));
static int common_arct(i_ctx_t *, float *);
/* <x> <y> <r> <ang1> <ang2> arc - */
@@ -53,10 +53,10 @@ common_arc(i_ctx_t *i_ctx_p,
int code = num_params(op, 5, xyra);
if (code < 0)
- return code;
+ return code;
code = (*aproc)(igs, xyra[0], xyra[1], xyra[2], xyra[3], xyra[4]);
if (code >= 0)
- pop(5);
+ pop(5);
return code;
}
@@ -67,7 +67,7 @@ zarct(i_ctx_t *i_ctx_p)
int code = common_arct(i_ctx_p, (float *)0);
if (code < 0)
- return code;
+ return code;
pop(5);
return 0;
}
@@ -81,7 +81,7 @@ zarcto(i_ctx_t *i_ctx_p)
int code = common_arct(i_ctx_p, tanxy);
if (code < 0)
- return code;
+ return code;
make_real(op - 4, tanxy[0]);
make_real(op - 3, tanxy[1]);
make_real(op - 2, tanxy[2]);
@@ -99,7 +99,7 @@ common_arct(i_ctx_t *i_ctx_p, float *tanxy)
int code = num_params(op, 5, args);
if (code < 0)
- return code;
+ return code;
return gs_arcto(igs, args[0], args[1], args[2], args[3], args[4], tanxy);
}
@@ -149,7 +149,7 @@ z1pathbbox(i_ctx_t *i_ctx_p)
check_type(*op, t_boolean);
code = gs_upathbbox(igs, &box, op->value.boolval);
if (code < 0)
- return code;
+ return code;
push(3);
make_real(op - 3, box.p.x);
make_real(op - 2, box.p.y);
@@ -173,7 +173,7 @@ zpathbbox(i_ctx_t *i_ctx_p)
make_false(op);
code = z1pathbbox(i_ctx_p);
if (code < 0) {
- pop(1); /* remove the Boolean */
+ pop(1); /* remove the Boolean */
}
return code;
}
@@ -194,11 +194,11 @@ zpathforall(i_ctx_t *i_ctx_p)
check_proc(*op);
check_estack(8);
if ((penum = gs_path_enum_alloc(imemory, "pathforall")) == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
code = gs_path_enum_init(penum, igs);
if (code < 0) {
- ifree_object(penum, "path_cleanup");
- return code;
+ ifree_object(penum, "path_cleanup");
+ return code;
}
/* Push a mark, the four procedures, and the path enumerator. */
push_mark_estack(es_for, path_cleanup); /* iterator */
@@ -224,27 +224,27 @@ path_continue(i_ctx_t *i_ctx_p)
check_ostack(6); /* 3 points for curveto */
code = gs_path_enum_next(penum, ppts);
switch (code) {
- case 0: /* all done */
- esp -= 6;
- path_cleanup(i_ctx_p);
- return o_pop_estack;
- default: /* error */
- return code;
- case gs_pe_moveto:
- esp[2] = esp[-4]; /* moveto proc */
- pf_push(i_ctx_p, ppts, 1);
- break;
- case gs_pe_lineto:
- esp[2] = esp[-3]; /* lineto proc */
- pf_push(i_ctx_p, ppts, 1);
- break;
- case gs_pe_curveto:
- esp[2] = esp[-2]; /* curveto proc */
- pf_push(i_ctx_p, ppts, 3);
- break;
- case gs_pe_closepath:
- esp[2] = esp[-1]; /* closepath proc */
- break;
+ case 0: /* all done */
+ esp -= 6;
+ path_cleanup(i_ctx_p);
+ return o_pop_estack;
+ default: /* error */
+ return code;
+ case gs_pe_moveto:
+ esp[2] = esp[-4]; /* moveto proc */
+ pf_push(i_ctx_p, ppts, 1);
+ break;
+ case gs_pe_lineto:
+ esp[2] = esp[-3]; /* lineto proc */
+ pf_push(i_ctx_p, ppts, 1);
+ break;
+ case gs_pe_curveto:
+ esp[2] = esp[-2]; /* curveto proc */
+ pf_push(i_ctx_p, ppts, 3);
+ break;
+ case gs_pe_closepath:
+ esp[2] = esp[-1]; /* closepath proc */
+ break;
}
push_op_estack(path_continue);
++esp; /* include pushed procedure */
@@ -257,10 +257,10 @@ pf_push(i_ctx_t *i_ctx_p, gs_point * ppts, int n)
os_ptr op = osp;
while (n--) {
- op += 2;
- make_real(op - 1, ppts->x);
- make_real(op, ppts->y);
- ppts++;
+ op += 2;
+ make_real(op - 1, ppts->x);
+ make_real(op, ppts->y);
+ ppts++;
}
osp = op;
}
@@ -291,7 +291,7 @@ const op_def zpath1_op_defs[] =
{"0strokepath", zstrokepath},
{"1.pathbbox", z1pathbbox},
{"0pathbbox", zpathbbox},
- /* Internal operators */
+ /* Internal operators */
{"0%path_continue", path_continue},
op_def_end(0)
};
diff --git a/gs/psi/zpcolor.c b/gs/psi/zpcolor.c
index 16b83f602..d6ec6e49f 100644
--- a/gs/psi/zpcolor.c
+++ b/gs/psi/zpcolor.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -57,9 +57,9 @@ static int
zpcolor_init(i_ctx_t *i_ctx_p)
{
gstate_set_pattern_cache(igs,
- gx_pattern_alloc_cache(imemory_system,
- gx_pat_cache_default_tiles(),
- gx_pat_cache_default_bits()));
+ gx_pattern_alloc_cache(imemory_system,
+ gx_pat_cache_default_tiles(),
+ gx_pat_cache_default_bits()));
return 0;
}
@@ -68,10 +68,10 @@ int
int_pattern_alloc(int_pattern **ppdata, const ref *op, gs_memory_t *mem)
{
int_pattern *pdata =
- gs_alloc_struct(mem, int_pattern, &st_int_pattern, "int_pattern");
+ gs_alloc_struct(mem, int_pattern, &st_int_pattern, "int_pattern");
if (pdata == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
pdata->dict = *op;
*ppdata = pdata;
return 0;
@@ -111,7 +111,7 @@ zbuildpattern1(i_ctx_t *i_ctx_p)
code = dict_int_param(op1, "TilingType", 1, 3, 0, &template.TilingType);
if (code < 0)
return code;
-
+
code = dict_bool_param(op1, ".pattern_uses_transparency", 0, &template.uses_transparency);
if (code < 0)
return code;
@@ -120,25 +120,25 @@ zbuildpattern1(i_ctx_t *i_ctx_p)
if (code < 0)
return code;
if (code == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
code = dict_float_param(op1, "XStep", 0.0, &template.XStep);
if (code < 0)
return code;
if (code == 1)
- return_error(e_undefined);
-
+ return_error(e_undefined);
+
code = dict_float_param(op1, "YStep", 0.0, &template.YStep);
if (code < 0)
return code;
if (code == 1)
- return_error(e_undefined);
-
+ return_error(e_undefined);
+
code = dict_find_string(op1, "PaintProc", &pPaintProc);
if (code < 0)
return code;
if (code == 0)
- return_error(e_undefined);
+ return_error(e_undefined);
check_proc(*pPaintProc);
@@ -154,12 +154,12 @@ zbuildpattern1(i_ctx_t *i_ctx_p)
template.PaintProc = zPaintProc;
code = int_pattern_alloc(&pdata, op1, imemory);
if (code < 0)
- return code;
+ return code;
template.client_data = pdata;
code = gs_makepattern(&cc_instance, &template, &mat, igs, imemory);
if (code < 0) {
- ifree_object(pdata, "int_pattern");
- return code;
+ ifree_object(pdata, "int_pattern");
+ return code;
}
make_istruct(op, a_readonly, cc_instance.pattern);
return code;
@@ -185,8 +185,8 @@ zPaintProc(const gs_client_color * pcc, gs_state * pgs)
{
/* Just schedule a call on the real PaintProc. */
r_ptr(&gs_int_gstate(pgs)->remap_color_info,
- int_remap_color_info_t)->proc =
- pattern_paint_prepare;
+ int_remap_color_info_t)->proc =
+ pattern_paint_prepare;
return_error(e_RemapColor);
}
/* Prepare to run the PaintProc. */
@@ -195,7 +195,7 @@ pattern_paint_prepare(i_ctx_t *i_ctx_p)
{
gs_state *pgs = igs;
gs_pattern1_instance_t *pinst =
- (gs_pattern1_instance_t *)gs_currentcolor(pgs)->pattern;
+ (gs_pattern1_instance_t *)gs_currentcolor(pgs)->pattern;
ref *pdict = &((int_pattern *) pinst->template.client_data)->dict;
gx_device_forward *pdev = NULL;
gx_device *cdev = gs_currentdevice_inline(igs);
@@ -205,76 +205,76 @@ pattern_paint_prepare(i_ctx_t *i_ctx_p)
check_estack(6);
if (pgs->have_pattern_streams) {
- code = dev_proc(cdev, dev_spec_op)(cdev, gxdso_pattern_can_accum,
- pinst, pinst->id);
- if (code < 0)
- return code;
- internal_accum = (code == 0);
+ code = dev_proc(cdev, dev_spec_op)(cdev, gxdso_pattern_can_accum,
+ pinst, pinst->id);
+ if (code < 0)
+ return code;
+ internal_accum = (code == 0);
}
if (internal_accum) {
- gs_memory_t *storage_memory = gstate_pattern_cache(pgs)->memory;
-
- pdev = gx_pattern_accum_alloc(imemory, storage_memory, pinst, "pattern_paint_prepare");
- if (pdev == 0)
- return_error(e_VMerror);
- code = (*dev_proc(pdev, open_device)) ((gx_device *) pdev);
- if (code < 0) {
- ifree_object(pdev, "pattern_paint_prepare");
- return code;
- }
+ gs_memory_t *storage_memory = gstate_pattern_cache(pgs)->memory;
+
+ pdev = gx_pattern_accum_alloc(imemory, storage_memory, pinst, "pattern_paint_prepare");
+ if (pdev == 0)
+ return_error(e_VMerror);
+ code = (*dev_proc(pdev, open_device)) ((gx_device *) pdev);
+ if (code < 0) {
+ ifree_object(pdev, "pattern_paint_prepare");
+ return code;
+ }
} else {
- code = gx_pattern_cache_add_dummy_entry((gs_imager_state *)igs,
- pinst, cdev->color_info.depth);
- if (code < 0)
- return code;
+ code = gx_pattern_cache_add_dummy_entry((gs_imager_state *)igs,
+ pinst, cdev->color_info.depth);
+ if (code < 0)
+ return code;
}
code = gs_gsave(pgs);
if (code < 0)
- return code;
+ return code;
code = gs_setgstate(pgs, pinst->saved);
if (code < 0) {
- gs_grestore(pgs);
- return code;
+ gs_grestore(pgs);
+ return code;
}
/* gx_set_device_only(pgs, (gx_device *) pdev); */
if (internal_accum) {
- gs_setdevice_no_init(pgs, (gx_device *)pdev);
- if (pinst->template.uses_transparency) {
- if_debug0('v', " pushing the pdf14 compositor device into this graphics state\n");
- if ((code = gs_push_pdf14trans_device(pgs)) < 0)
- return code;
- } else { /* not transparent */
+ gs_setdevice_no_init(pgs, (gx_device *)pdev);
+ if (pinst->template.uses_transparency) {
+ if_debug0('v', " pushing the pdf14 compositor device into this graphics state\n");
+ if ((code = gs_push_pdf14trans_device(pgs)) < 0)
+ return code;
+ } else { /* not transparent */
if (pinst->template.PaintType == 1)
if ((code = gx_erase_colored_pattern(pgs)) < 0)
return code;
}
} else {
- gs_matrix m;
- gs_rect bbox;
- gs_fixed_rect clip_box;
-
- dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m);
- gs_setmatrix(igs, &m);
- code = gs_bbox_transform(&pinst->template.BBox, &ctm_only(pgs), &bbox);
- if (code < 0) {
- gs_grestore(pgs);
- return code;
- }
- clip_box.p.x = float2fixed(bbox.p.x);
- clip_box.p.y = float2fixed(bbox.p.y);
- clip_box.q.x = float2fixed(bbox.q.x);
- clip_box.q.y = float2fixed(bbox.q.y);
- code = gx_clip_to_rectangle(igs, &clip_box);
- if (code < 0) {
- gs_grestore(pgs);
- return code;
- }
- code = dev_proc(cdev, dev_spec_op)(cdev, gxdso_pattern_start_accum,
- pinst, pinst->id);
- if (code < 0) {
- gs_grestore(pgs);
- return code;
- }
+ gs_matrix m;
+ gs_rect bbox;
+ gs_fixed_rect clip_box;
+
+ dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m);
+ gs_setmatrix(igs, &m);
+ code = gs_bbox_transform(&pinst->template.BBox, &ctm_only(pgs), &bbox);
+ if (code < 0) {
+ gs_grestore(pgs);
+ return code;
+ }
+ clip_box.p.x = float2fixed(bbox.p.x);
+ clip_box.p.y = float2fixed(bbox.p.y);
+ clip_box.q.x = float2fixed(bbox.q.x);
+ clip_box.q.y = float2fixed(bbox.q.y);
+ code = gx_clip_to_rectangle(igs, &clip_box);
+ if (code < 0) {
+ gs_grestore(pgs);
+ return code;
+ }
+ code = dev_proc(cdev, dev_spec_op)(cdev, gxdso_pattern_start_accum,
+ pinst, pinst->id);
+ if (code < 0) {
+ gs_grestore(pgs);
+ return code;
+ }
}
push_mark_estack(es_other, pattern_paint_cleanup);
++esp;
@@ -295,31 +295,31 @@ pattern_paint_finish(i_ctx_t *i_ctx_p)
int o_stack_adjust = ref_stack_count(&o_stack) - esp->value.intval;
gx_device_forward *pdev = r_ptr(esp - 1, gx_device_forward);
gs_pattern1_instance_t *pinst =
- (gs_pattern1_instance_t *)gs_currentcolor(igs->saved)->pattern;
+ (gs_pattern1_instance_t *)gs_currentcolor(igs->saved)->pattern;
gx_device_pattern_accum const *padev = (const gx_device_pattern_accum *) pdev;
if (pdev != NULL) {
- gx_color_tile *ctile;
- int code;
- if (pinst->template.uses_transparency) {
- gs_state *pgs = igs;
- int code;
+ gx_color_tile *ctile;
+ int code;
+ if (pinst->template.uses_transparency) {
+ gs_state *pgs = igs;
+ int code;
/* Get PDF14 buffer information */
code = pdf14_get_buffer_information(pgs->device,padev->transbuff);
- /* PDF14 device (and buffer) is destroyed when pattern cache
+ /* PDF14 device (and buffer) is destroyed when pattern cache
entry is removed */
- if (code < 0)
- return code;
- }
- code = gx_pattern_cache_add_entry((gs_imager_state *)igs, pdev, &ctile);
- if (code < 0)
- return code;
+ if (code < 0)
+ return code;
+ }
+ code = gx_pattern_cache_add_entry((gs_imager_state *)igs, pdev, &ctile);
+ if (code < 0)
+ return code;
}
if (o_stack_adjust > 0) {
#if 0
- dlprintf1("PaintProc left %d extra on operator stack!\n", o_stack_adjust);
+ dlprintf1("PaintProc left %d extra on operator stack!\n", o_stack_adjust);
#endif
- pop(o_stack_adjust);
+ pop(o_stack_adjust);
}
esp -= 3;
pattern_paint_cleanup(i_ctx_p);
@@ -330,23 +330,23 @@ pattern_paint_finish(i_ctx_t *i_ctx_p)
static int
pattern_paint_cleanup(i_ctx_t *i_ctx_p)
{
- gx_device_pattern_accum *const pdev =
- r_ptr(esp + 2, gx_device_pattern_accum);
+ gx_device_pattern_accum *const pdev =
+ r_ptr(esp + 2, gx_device_pattern_accum);
int code;
if (pdev != NULL) {
- /* grestore will free the device, so close it first. */
- (*dev_proc(pdev, close_device)) ((gx_device *) pdev);
+ /* grestore will free the device, so close it first. */
+ (*dev_proc(pdev, close_device)) ((gx_device *) pdev);
}
code = gs_grestore(igs);
gx_unset_dev_color(igs); /* dev_color may need updating if GC ran */
if (pdev == NULL) {
- gx_device *cdev = gs_currentdevice_inline(igs);
- int code1 = dev_proc(cdev, dev_spec_op)(cdev,
- gxdso_pattern_finish_accum, NULL, gx_no_bitmap_id);
-
- if (code == 0 && code1 < 0)
- code = code1;
+ gx_device *cdev = gs_currentdevice_inline(igs);
+ int code1 = dev_proc(cdev, dev_spec_op)(cdev,
+ gxdso_pattern_finish_accum, NULL, gx_no_bitmap_id);
+
+ if (code == 0 && code1 < 0)
+ code = code1;
}
return code;
}
diff --git a/gs/psi/zpdfops.c b/gs/psi/zpdfops.c
index dc388b1a4..fc12d07f2 100644
--- a/gs/psi/zpdfops.c
+++ b/gs/psi/zpdfops.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -49,13 +49,13 @@ zpdfinkpath(i_ctx_t *i_ctx_p)
const double smooth_value = 1; /* from 0..1 range */
if (count == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
if ((count & 1) == 0 || count < 3)
- return_error(e_rangecheck);
-
+ return_error(e_rangecheck);
+
ocount = count - 1;
optr = op - ocount + 1;
-
+
if ((code = real_param(optr, &x1)) < 0)
return code;
if ((code = real_param(optr + 1, &y1)) < 0)
@@ -76,7 +76,7 @@ zpdfinkpath(i_ctx_t *i_ctx_p)
}
x0 = 2*x1 - x2;
y0 = 2*y1 - y2;
-
+
for (i = 4; i <= ocount; i += 2) {
if (i < ocount) {
if ((code = real_param(optr + i, &x3)) < 0)
@@ -120,7 +120,7 @@ zpdfinkpath(i_ctx_t *i_ctx_p)
x0 = x1, x1 = x2, x2 = x3;
y0 = y1, y1 = y2, y2 = y3;
}
- pop:
+ pop:
ref_stack_pop(&o_stack, count);
return 0;
}
@@ -161,30 +161,30 @@ zsaslprep(i_ctx_t *i_ctx_p)
err = stringprep((char *)buffer, buffer_size, 0, stringprep_saslprep);
if (err != STRINGPREP_OK) {
- ifree_string(buffer, buffer_size, "saslprep result");
-
- /* Since we're just verifying the password to an existing
- * document here, we don't care about "invalid input" errors
- * like STRINGPREP_CONTAINS_PROHIBITED. In these cases, we
- * ignore the error and return the original string unchanged --
- * chances are it's not the right password anyway, and if it
- * is we shouldn't gratuitously fail to decrypt the document.
- *
- * On the other hand, errors like STRINGPREP_NFKC_FAILED are
- * real errors, and should be returned to the user.
- *
- * Fortunately, the stringprep error codes are sorted to make
- * this easy: the errors we want to ignore are the ones with
- * codes less than 100. */
- if ((int)err < 100)
- return 0;
-
- return_error(e_ioerror);
+ ifree_string(buffer, buffer_size, "saslprep result");
+
+ /* Since we're just verifying the password to an existing
+ * document here, we don't care about "invalid input" errors
+ * like STRINGPREP_CONTAINS_PROHIBITED. In these cases, we
+ * ignore the error and return the original string unchanged --
+ * chances are it's not the right password anyway, and if it
+ * is we shouldn't gratuitously fail to decrypt the document.
+ *
+ * On the other hand, errors like STRINGPREP_NFKC_FAILED are
+ * real errors, and should be returned to the user.
+ *
+ * Fortunately, the stringprep error codes are sorted to make
+ * this easy: the errors we want to ignore are the ones with
+ * codes less than 100. */
+ if ((int)err < 100)
+ return 0;
+
+ return_error(e_ioerror);
}
output_size = strlen((char *)buffer);
buffer = iresize_string(buffer, buffer_size, output_size,
- "saslprep result"); /* can't fail */
+ "saslprep result"); /* can't fail */
make_string(op, a_all | icurrent_space, output_size, buffer);
return 0;
diff --git a/gs/psi/zrelbit.c b/gs/psi/zrelbit.c
index 9d733ebb1..47f605234 100644
--- a/gs/psi/zrelbit.c
+++ b/gs/psi/zrelbit.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,11 +29,11 @@
/* Define the type test for eq and its relatives. */
#define EQ_CHECK_READ(opp, dflt)\
switch ( r_type(opp) ) {\
- case t_string:\
- check_read(*(opp));\
- break;\
- default:\
- dflt;\
+ case t_string:\
+ check_read(*(opp));\
+ break;\
+ default:\
+ dflt;\
}
/* Forward references */
@@ -58,7 +58,7 @@ zne(i_ctx_t *i_ctx_p)
int code = zeq(i_ctx_p);
if (!code)
- osp->value.boolval ^= 1;
+ osp->value.boolval ^= 1;
return code;
}
@@ -71,7 +71,7 @@ zge(i_ctx_t *i_ctx_p)
int code = obj_le(op, op - 1);
if (code < 0)
- return code;
+ return code;
make_bool(op - 1, code);
pop(1);
return 0;
@@ -86,7 +86,7 @@ zgt(i_ctx_t *i_ctx_p)
int code = obj_le(op - 1, op);
if (code < 0)
- return code;
+ return code;
make_bool(op - 1, code ^ 1);
pop(1);
return 0;
@@ -101,7 +101,7 @@ zle(i_ctx_t *i_ctx_p)
int code = obj_le(op - 1, op);
if (code < 0)
- return code;
+ return code;
make_bool(op - 1, code);
pop(1);
return 0;
@@ -116,7 +116,7 @@ zlt(i_ctx_t *i_ctx_p)
int code = obj_le(op, op - 1);
if (code < 0)
- return code;
+ return code;
make_bool(op - 1, code ^ 1);
pop(1);
return 0;
@@ -131,9 +131,9 @@ zmax(i_ctx_t *i_ctx_p)
int code = obj_le(op - 1, op);
if (code < 0)
- return code;
+ return code;
if (code) {
- ref_assign(op - 1, op);
+ ref_assign(op - 1, op);
}
pop(1);
return 0;
@@ -148,9 +148,9 @@ zmin(i_ctx_t *i_ctx_p)
int code = obj_le(op - 1, op);
if (code < 0)
- return code;
+ return code;
if (!code) {
- ref_assign(op - 1, op);
+ ref_assign(op - 1, op);
}
pop(1);
return 0;
@@ -164,16 +164,16 @@ zand(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- case t_boolean:
- check_type(op[-1], t_boolean);
- op[-1].value.boolval &= op->value.boolval;
- break;
- case t_integer:
- check_type(op[-1], t_integer);
- op[-1].value.intval &= op->value.intval;
- break;
- default:
- return_op_typecheck(op);
+ case t_boolean:
+ check_type(op[-1], t_boolean);
+ op[-1].value.boolval &= op->value.boolval;
+ break;
+ case t_integer:
+ check_type(op[-1], t_integer);
+ op[-1].value.intval &= op->value.intval;
+ break;
+ default:
+ return_op_typecheck(op);
}
pop(1);
return 0;
@@ -187,14 +187,14 @@ znot(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- case t_boolean:
- op->value.boolval = !op->value.boolval;
- break;
- case t_integer:
- op->value.intval = ~op->value.intval;
- break;
- default:
- return_op_typecheck(op);
+ case t_boolean:
+ op->value.boolval = !op->value.boolval;
+ break;
+ case t_integer:
+ op->value.intval = ~op->value.intval;
+ break;
+ default:
+ return_op_typecheck(op);
}
return 0;
}
@@ -207,16 +207,16 @@ zor(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- case t_boolean:
- check_type(op[-1], t_boolean);
- op[-1].value.boolval |= op->value.boolval;
- break;
- case t_integer:
- check_type(op[-1], t_integer);
- op[-1].value.intval |= op->value.intval;
- break;
- default:
- return_op_typecheck(op);
+ case t_boolean:
+ check_type(op[-1], t_boolean);
+ op[-1].value.boolval |= op->value.boolval;
+ break;
+ case t_integer:
+ check_type(op[-1], t_integer);
+ op[-1].value.intval |= op->value.intval;
+ break;
+ default:
+ return_op_typecheck(op);
}
pop(1);
return 0;
@@ -230,16 +230,16 @@ zxor(i_ctx_t *i_ctx_p)
os_ptr op = osp;
switch (r_type(op)) {
- case t_boolean:
- check_type(op[-1], t_boolean);
- op[-1].value.boolval ^= op->value.boolval;
- break;
- case t_integer:
- check_type(op[-1], t_integer);
- op[-1].value.intval ^= op->value.intval;
- break;
- default:
- return_op_typecheck(op);
+ case t_boolean:
+ check_type(op[-1], t_boolean);
+ op[-1].value.boolval ^= op->value.boolval;
+ break;
+ case t_integer:
+ check_type(op[-1], t_integer);
+ op[-1].value.intval ^= op->value.intval;
+ break;
+ default:
+ return_op_typecheck(op);
}
pop(1);
return 0;
@@ -255,11 +255,11 @@ zbitshift(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
check_type(op[-1], t_integer);
if (op->value.intval < -31 || op->value.intval > 31)
- op[-1].value.intval = 0;
+ op[-1].value.intval = 0;
else if ((shift = op->value.intval) < 0)
- op[-1].value.intval = ((uint)(op[-1].value.intval)) >> -shift;
+ op[-1].value.intval = ((uint)(op[-1].value.intval)) >> -shift;
else
- op[-1].value.intval <<= shift;
+ op[-1].value.intval <<= shift;
pop(1);
return 0;
}
@@ -284,11 +284,11 @@ zidenteq(i_ctx_t *i_ctx_p)
static int
zidentne(i_ctx_t *i_ctx_p)
{
- /* We'll just be lazy and use .identeq. */
+ /* We'll just be lazy and use .identeq. */
int code = zidenteq(i_ctx_p);
if (!code)
- osp->value.boolval ^= 1;
+ osp->value.boolval ^= 1;
return code;
}
@@ -309,7 +309,7 @@ const op_def zrelbit_op_defs[] =
{"1not", znot},
{"2or", zor},
{"2xor", zxor},
- /* Extensions */
+ /* Extensions */
{"2.identeq", zidenteq},
{"2.identne", zidentne},
op_def_end(0)
@@ -324,30 +324,30 @@ static int
obj_le(register os_ptr op1, register os_ptr op)
{
switch (r_type(op1)) {
- case t_integer:
- switch (r_type(op)) {
- case t_integer:
- return (op1->value.intval <= op->value.intval);
- case t_real:
- return ((double)op1->value.intval <= op->value.realval);
- default:
- return_op_typecheck(op);
- }
- case t_real:
- switch (r_type(op)) {
- case t_real:
- return (op1->value.realval <= op->value.realval);
- case t_integer:
- return (op1->value.realval <= (double)op->value.intval);
- default:
- return_op_typecheck(op);
- }
- case t_string:
- check_read(*op1);
- check_read_type(*op, t_string);
- return (bytes_compare(op1->value.bytes, r_size(op1),
- op->value.bytes, r_size(op)) <= 0);
- default:
- return_op_typecheck(op1);
+ case t_integer:
+ switch (r_type(op)) {
+ case t_integer:
+ return (op1->value.intval <= op->value.intval);
+ case t_real:
+ return ((double)op1->value.intval <= op->value.realval);
+ default:
+ return_op_typecheck(op);
+ }
+ case t_real:
+ switch (r_type(op)) {
+ case t_real:
+ return (op1->value.realval <= op->value.realval);
+ case t_integer:
+ return (op1->value.realval <= (double)op->value.intval);
+ default:
+ return_op_typecheck(op);
+ }
+ case t_string:
+ check_read(*op1);
+ check_read_type(*op, t_string);
+ return (bytes_compare(op1->value.bytes, r_size(op1),
+ op->value.bytes, r_size(op)) <= 0);
+ default:
+ return_op_typecheck(op1);
}
}
diff --git a/gs/psi/zrop.c b/gs/psi/zrop.c
index 55bb6bd87..082fb4d38 100644
--- a/gs/psi/zrop.c
+++ b/gs/psi/zrop.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -33,7 +33,7 @@ zsetrasterop(i_ctx_t *i_ctx_p)
int code = int_param(op, 0xff, &param);
if (code < 0)
- return code;
+ return code;
gs_setrasterop(igs, (gs_rop3_t)param);
pop(1);
return 0;
diff --git a/gs/psi/zshade.c b/gs/psi/zshade.c
index 733a44574..bd28f2818 100644
--- a/gs/psi/zshade.c
+++ b/gs/psi/zshade.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -60,9 +60,9 @@ zsetsmoothness(i_ctx_t *i_ctx_p)
int code;
if (real_param(op, &smoothness) < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
if ((code = gs_setsmoothness(igs, smoothness)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -76,7 +76,7 @@ zshfill(i_ctx_t *i_ctx_p)
int code = shading_param(op, &psh);
if (code < 0 || (code = gs_shfill(igs, psh)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -99,18 +99,18 @@ zbuildshadingpattern(i_ctx_t *i_ctx_p)
check_dict_read(*op2);
gs_pattern2_init(&template);
if ((code = read_matrix(imemory, op - 1, &mat)) < 0 ||
- (code = dict_uid_param(op2, &template.uid, 1, imemory, i_ctx_p)) != 1 ||
- (code = shading_param(op, &template.Shading)) < 0 ||
- (code = int_pattern_alloc(&pdata, op2, imemory)) < 0
- )
- return_error((code < 0 ? code : e_rangecheck));
+ (code = dict_uid_param(op2, &template.uid, 1, imemory, i_ctx_p)) != 1 ||
+ (code = shading_param(op, &template.Shading)) < 0 ||
+ (code = int_pattern_alloc(&pdata, op2, imemory)) < 0
+ )
+ return_error((code < 0 ? code : e_rangecheck));
template.client_data = pdata;
code = gs_make_pattern(&cc_instance,
- (const gs_pattern_template_t *)&template,
- &mat, igs, imemory);
+ (const gs_pattern_template_t *)&template,
+ &mat, igs, imemory);
if (code < 0) {
- ifree_object(pdata, "int_pattern");
- return code;
+ ifree_object(pdata, "int_pattern");
+ return code;
}
make_istruct(op - 1, a_readonly, cc_instance.pattern);
pop(1);
@@ -123,13 +123,13 @@ zbuildshadingpattern(i_ctx_t *i_ctx_p)
static int
shading_param(const_os_ptr op, const gs_shading_t ** ppsh)
{ /*
- * Since shadings form a subclass hierarchy, we currently have
- * no way to check whether a structure is actually a shading.
- */
+ * Since shadings form a subclass hierarchy, we currently have
+ * no way to check whether a structure is actually a shading.
+ */
if (!r_is_struct(op) ||
- r_has_masked_attrs(op, a_executable | a_execute, a_all)
- )
- return_error(e_typecheck);
+ r_has_masked_attrs(op, a_executable | a_execute, a_all)
+ )
+ return_error(e_typecheck);
*ppsh = (gs_shading_t *) op->value.pstruct;
return 0;
}
@@ -163,79 +163,79 @@ build_shading(i_ctx_t *i_ctx_p, build_shading_proc_t proc)
params.Background = 0;
/* Collect parameters common to all shading types. */
{
- gs_color_space *pcs = gs_currentcolorspace(igs);
- int num_comp = gs_color_space_num_components(pcs);
+ gs_color_space *pcs = gs_currentcolorspace(igs);
+ int num_comp = gs_color_space_num_components(pcs);
- if (num_comp < 0) { /* Pattern color space */
+ if (num_comp < 0) { /* Pattern color space */
gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "ColorSpace");
- return_error(e_typecheck);
+ return_error(e_typecheck);
}
- params.ColorSpace = pcs;
- rc_increment_cs(pcs);
- if (dict_find_string(op, "Background", &pvalue) > 0) {
- gs_client_color *pcc =
- ialloc_struct(gs_client_color, &st_client_color,
- "build_shading");
-
- if (pcc == 0) {
- code = gs_note_error(e_VMerror);
- goto fail;
- }
- pcc->pattern = 0;
- params.Background = pcc;
- code = dict_floats_param(imemory, op, "Background",
- gs_color_space_num_components(pcs),
- pcc->paint.values, NULL);
- if (code < 0) {
+ params.ColorSpace = pcs;
+ rc_increment_cs(pcs);
+ if (dict_find_string(op, "Background", &pvalue) > 0) {
+ gs_client_color *pcc =
+ ialloc_struct(gs_client_color, &st_client_color,
+ "build_shading");
+
+ if (pcc == 0) {
+ code = gs_note_error(e_VMerror);
+ goto fail;
+ }
+ pcc->pattern = 0;
+ params.Background = pcc;
+ code = dict_floats_param(imemory, op, "Background",
+ gs_color_space_num_components(pcs),
+ pcc->paint.values, NULL);
+ if (code < 0) {
gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Background");
- goto fail;
+ goto fail;
}
- }
+ }
}
if (dict_find_string(op, "BBox", &pvalue) <= 0)
- params.have_BBox = false;
- else if ((code = dict_floats_param(imemory, op, "BBox",
- 4, box, NULL)) == 4) {
- /* Adobe Interpreters accept denormalised BBox - bug 688937 */
+ params.have_BBox = false;
+ else if ((code = dict_floats_param(imemory, op, "BBox",
+ 4, box, NULL)) == 4) {
+ /* Adobe Interpreters accept denormalised BBox - bug 688937 */
if (box[0] <= box[2]) {
params.BBox.p.x = box[0];
- params.BBox.q.x = box[2];
+ params.BBox.q.x = box[2];
} else {
params.BBox.p.x = box[2];
- params.BBox.q.x = box[0];
+ params.BBox.q.x = box[0];
}
- if (box[1] <= box[3]) {
+ if (box[1] <= box[3]) {
params.BBox.p.y = box[1];
- params.BBox.q.y = box[3];
+ params.BBox.q.y = box[3];
} else {
params.BBox.p.y = box[3];
- params.BBox.q.y = box[1];
+ params.BBox.q.y = box[1];
}
- params.have_BBox = true;
+ params.have_BBox = true;
} else {
gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "BBox");
- goto fail;
+ goto fail;
}
code = dict_bool_param(op, "AntiAlias", false, &params.AntiAlias);
if (code < 0) {
gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "AntiAlias");
- goto fail;
+ goto fail;
}
/* Finish building the shading. */
code = (*proc)(i_ctx_p, op, &params, &psh, imemory);
if (code < 0)
- goto fail;
+ goto fail;
if (gx_color_space_needs_cie_caches(psh->params.ColorSpace)) {
- rc_decrement(psh->params.cie_joint_caches, "build_shading");
- psh->params.cie_joint_caches = gx_currentciecaches(igs);
- rc_increment(psh->params.cie_joint_caches);
+ rc_decrement(psh->params.cie_joint_caches, "build_shading");
+ psh->params.cie_joint_caches = gx_currentciecaches(igs);
+ rc_increment(psh->params.cie_joint_caches);
}
make_istruct_new(op, 0, psh);
return code;
fail:
gs_free_object(imemory, params.Background, "Background");
if (params.ColorSpace) {
- rc_decrement_only_cs(params.ColorSpace, "build_shading");
+ rc_decrement_only_cs(params.ColorSpace, "build_shading");
}
return (code < 0 ? code : gs_note_error(e_rangecheck));
}
@@ -243,53 +243,53 @@ fail:
/* Collect a Function value. */
static int
build_shading_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
- int num_inputs, gs_memory_t *mem, const float *shading_domain)
+ int num_inputs, gs_memory_t *mem, const float *shading_domain)
{
ref *pFunction;
int code;
*ppfn = 0;
if (dict_find_string(op, "Function", &pFunction) <= 0)
- return 0;
+ return 0;
if (r_is_array(pFunction)) {
- uint size = r_size(pFunction);
- gs_function_t **Functions;
- uint i;
- gs_function_AdOt_params_t params;
-
- check_read(*pFunction);
- if (size == 0)
- return_error(e_rangecheck);
- code = alloc_function_array(size, &Functions, mem);
- if (code < 0)
- return code;
- for (i = 0; i < size; ++i) {
- ref rsubfn;
-
- array_get(imemory, pFunction, (long)i, &rsubfn);
- code = fn_build_function(i_ctx_p, &rsubfn, &Functions[i], mem,
+ uint size = r_size(pFunction);
+ gs_function_t **Functions;
+ uint i;
+ gs_function_AdOt_params_t params;
+
+ check_read(*pFunction);
+ if (size == 0)
+ return_error(e_rangecheck);
+ code = alloc_function_array(size, &Functions, mem);
+ if (code < 0)
+ return code;
+ for (i = 0; i < size; ++i) {
+ ref rsubfn;
+
+ array_get(imemory, pFunction, (long)i, &rsubfn);
+ code = fn_build_function(i_ctx_p, &rsubfn, &Functions[i], mem,
shading_domain, num_inputs);
- if (code < 0)
- break;
- }
- params.m = num_inputs;
- params.Domain = 0;
- params.n = size;
- params.Range = 0;
- params.Functions = (const gs_function_t * const *)Functions;
- if (code >= 0)
- code = gs_function_AdOt_init(ppfn, &params, mem);
- if (code < 0)
- gs_function_AdOt_free_params(&params, mem);
+ if (code < 0)
+ break;
+ }
+ params.m = num_inputs;
+ params.Domain = 0;
+ params.n = size;
+ params.Range = 0;
+ params.Functions = (const gs_function_t * const *)Functions;
+ if (code >= 0)
+ code = gs_function_AdOt_init(ppfn, &params, mem);
+ if (code < 0)
+ gs_function_AdOt_free_params(&params, mem);
} else {
- code = fn_build_function(i_ctx_p, pFunction, ppfn, mem,
+ code = fn_build_function(i_ctx_p, pFunction, ppfn, mem,
shading_domain, num_inputs);
- if (code < 0)
- return code;
- if ((*ppfn)->params.m != num_inputs) {
- gs_function_free(*ppfn, true, mem);
- return_error(e_rangecheck);
- }
+ if (code < 0)
+ return code;
+ if ((*ppfn)->params.m != num_inputs) {
+ gs_function_free(*ppfn, true, mem);
+ return_error(e_rangecheck);
+ }
}
return code;
}
@@ -317,7 +317,7 @@ check_indexed_vs_function(i_ctx_t *i_ctx_p, const ref *op,
/* Build a ShadingType 1 (Function-based) shading. */
static int
build_shading_1(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_Fb_params_t params;
int code;
@@ -327,19 +327,19 @@ build_shading_1(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pc
*(gs_shading_params_t *)&params = *pcommon;
gs_make_identity(&params.Matrix);
params.Function = 0;
- code = dict_floats_param_errorinfo(i_ctx_p, op, "Domain",
- 4, params.Domain, default_Domain);
+ code = dict_floats_param_errorinfo(i_ctx_p, op, "Domain",
+ 4, params.Domain, default_Domain);
if (code < 0)
goto out;
if (params.Domain[0] > params.Domain[1] || params.Domain[2] > params.Domain[3]) {
- gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
+ gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
code = gs_note_error(e_rangecheck);
goto out; /* CPSI 3017 and CET 12-14b reject un-normalised domain */
}
if (dict_find_string(op, "Matrix", &pmatrix) > 0 ) {
code = read_matrix(imemory, pmatrix, &params.Matrix);
if (code < 0) {
- gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Matrix");
+ gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Matrix");
goto out;
}
}
@@ -347,8 +347,8 @@ build_shading_1(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pc
if (code < 0)
goto out;
if (params.Function == 0) { /* Function is required */
- code = gs_note_error(e_undefined);
- gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Function");
+ code = gs_note_error(e_undefined);
+ gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Function");
goto out;
}
code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function);
@@ -357,7 +357,7 @@ build_shading_1(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pc
code = gs_shading_Fb_init(ppsh, &params, mem);
out:;
if (code < 0 && params.Function)
- gs_free_object(mem, params.Function, "Function");
+ gs_free_object(mem, params.Function, "Function");
return code;
}
/* <dict> .buildshading1 <shading_struct> */
@@ -370,39 +370,39 @@ zbuildshading1(i_ctx_t *i_ctx_p)
/* Collect parameters for an Axial or Radial shading. */
static int
build_directional_shading(i_ctx_t *i_ctx_p, const ref * op, float *Coords, int num_Coords,
- float Domain[2], gs_function_t ** pFunction,
- bool Extend[2], gs_memory_t *mem)
+ float Domain[2], gs_function_t ** pFunction,
+ bool Extend[2], gs_memory_t *mem)
{
- int code = dict_floats_param(imemory, op, "Coords",
- num_Coords, Coords, NULL);
+ int code = dict_floats_param(imemory, op, "Coords",
+ num_Coords, Coords, NULL);
static const float default_Domain[2] = {0, 1};
ref *pExtend;
*pFunction = 0;
if (code < 0 ||
- (code = dict_floats_param_errorinfo(i_ctx_p, op, "Domain", 2, Domain,
- default_Domain)) < 0 ||
- (code = build_shading_function(i_ctx_p, op, pFunction, 1, mem, Domain)) < 0
- )
- return code;
+ (code = dict_floats_param_errorinfo(i_ctx_p, op, "Domain", 2, Domain,
+ default_Domain)) < 0 ||
+ (code = build_shading_function(i_ctx_p, op, pFunction, 1, mem, Domain)) < 0
+ )
+ return code;
if (!*pFunction)
- return_error(e_undefined);
+ return_error(e_undefined);
if (dict_find_string(op, "Extend", &pExtend) <= 0)
- Extend[0] = Extend[1] = false;
+ Extend[0] = Extend[1] = false;
else {
- ref E0, E1;
-
- if (!r_is_array(pExtend))
- return_error(e_typecheck);
- else if (r_size(pExtend) != 2)
- return_error(e_rangecheck);
- else if ((array_get(imemory, pExtend, 0L, &E0),
- !r_has_type(&E0, t_boolean)) ||
- (array_get(imemory, pExtend, 1L, &E1),
- !r_has_type(&E1, t_boolean))
- )
- return_error(e_typecheck);
- Extend[0] = E0.value.boolval, Extend[1] = E1.value.boolval;
+ ref E0, E1;
+
+ if (!r_is_array(pExtend))
+ return_error(e_typecheck);
+ else if (r_size(pExtend) != 2)
+ return_error(e_rangecheck);
+ else if ((array_get(imemory, pExtend, 0L, &E0),
+ !r_has_type(&E0, t_boolean)) ||
+ (array_get(imemory, pExtend, 1L, &E1),
+ !r_has_type(&E1, t_boolean))
+ )
+ return_error(e_typecheck);
+ Extend[0] = E0.value.boolval, Extend[1] = E1.value.boolval;
}
return 0;
}
@@ -410,19 +410,19 @@ build_directional_shading(i_ctx_t *i_ctx_p, const ref * op, float *Coords, int n
/* Build a ShadingType 2 (Axial) shading. */
static int
build_shading_2(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_A_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code = build_directional_shading(i_ctx_p, op, params.Coords, 4,
- params.Domain, &params.Function,
- params.Extend, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = gs_shading_A_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
+ params.Domain, &params.Function,
+ params.Extend, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = gs_shading_A_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
}
return code;
}
@@ -436,22 +436,22 @@ zbuildshading2(i_ctx_t *i_ctx_p)
/* Build a ShadingType 3 (Radial) shading. */
static int
build_shading_3(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_R_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code = build_directional_shading(i_ctx_p, op, params.Coords, 6,
- params.Domain, &params.Function,
- params.Extend, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = gs_shading_R_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
+ params.Domain, &params.Function,
+ params.Extend, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = gs_shading_R_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
}
if (params.Function == 0) /* Function is required */
- return_error(e_undefined);
+ return_error(e_undefined);
return code;
}
/* <dict> .buildshading3 <shading_struct> */
@@ -464,9 +464,9 @@ zbuildshading3(i_ctx_t *i_ctx_p)
/* Collect parameters for a mesh shading. */
static int
build_mesh_shading(i_ctx_t *i_ctx_p, const ref * op,
- gs_shading_mesh_params_t * params,
- float **pDecode, gs_function_t ** pFunction,
- gs_memory_t *mem)
+ gs_shading_mesh_params_t * params,
+ float **pDecode, gs_function_t ** pFunction,
+ gs_memory_t *mem)
{
int code;
float *data = 0;
@@ -475,76 +475,76 @@ build_mesh_shading(i_ctx_t *i_ctx_p, const ref * op,
*pDecode = 0;
*pFunction = 0;
if (dict_find_string(op, "DataSource", &pDataSource) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if (r_is_array(pDataSource)) {
- uint size = r_size(pDataSource);
-
- data = (float *)gs_alloc_byte_array(mem, size, sizeof(float),
- "build_mesh_shading");
- if (data == 0)
- return_error(e_VMerror);
- code = process_float_array(mem, pDataSource, size, data);
- if (code < 0) {
- gs_free_object(mem, data, "build_mesh_shading");
- return code;
- }
- data_source_init_floats(&params->DataSource, data, size);
+ uint size = r_size(pDataSource);
+
+ data = (float *)gs_alloc_byte_array(mem, size, sizeof(float),
+ "build_mesh_shading");
+ if (data == 0)
+ return_error(e_VMerror);
+ code = process_float_array(mem, pDataSource, size, data);
+ if (code < 0) {
+ gs_free_object(mem, data, "build_mesh_shading");
+ return code;
+ }
+ data_source_init_floats(&params->DataSource, data, size);
} else
- switch (r_type(pDataSource)) {
- case t_file: {
- stream *s;
-
- check_read_file(i_ctx_p, s, pDataSource);
- data_source_init_stream(&params->DataSource, s);
- break;
- }
- case t_string:
- check_read(*pDataSource);
- data_source_init_string2(&params->DataSource,
- pDataSource->value.bytes,
- r_size(pDataSource));
- break;
- default:
- return_error(e_typecheck);
- }
+ switch (r_type(pDataSource)) {
+ case t_file: {
+ stream *s;
+
+ check_read_file(i_ctx_p, s, pDataSource);
+ data_source_init_stream(&params->DataSource, s);
+ break;
+ }
+ case t_string:
+ check_read(*pDataSource);
+ data_source_init_string2(&params->DataSource,
+ pDataSource->value.bytes,
+ r_size(pDataSource));
+ break;
+ default:
+ return_error(e_typecheck);
+ }
code = build_shading_function(i_ctx_p, op, pFunction, 1, mem, NULL);
if (code < 0) {
- gs_free_object(mem, data, "build_mesh_shading");
- return code;
+ gs_free_object(mem, data, "build_mesh_shading");
+ return code;
}
if (data_source_is_array(params->DataSource)) {
- params->BitsPerCoordinate = 0;
- params->BitsPerComponent = 0;
+ params->BitsPerCoordinate = 0;
+ params->BitsPerComponent = 0;
} else {
- int num_decode = 4 +
- (*pFunction != 0 ? 1 :
- gs_color_space_num_components(params->ColorSpace)) * 2;
-
- if ((code = dict_int_param(op, "BitsPerCoordinate", 1, 32, 0,
- &params->BitsPerCoordinate)) >= 0 &&
- (code = dict_int_param(op, "BitsPerComponent", 1, 16, 0,
- &params->BitsPerComponent)) >= 0
- ) {
- *pDecode = (float *)
- gs_alloc_byte_array(mem, num_decode, sizeof(float),
- "build_mesh_shading");
- if (*pDecode == 0)
- code = gs_note_error(e_VMerror);
- else {
- code = dict_floats_param(mem, op, "Decode", num_decode, *pDecode, NULL);
- if (code < 0) {
- gs_free_object(mem, *pDecode, "build_mesh_shading");
- *pDecode = 0;
- }
- }
- }
+ int num_decode = 4 +
+ (*pFunction != 0 ? 1 :
+ gs_color_space_num_components(params->ColorSpace)) * 2;
+
+ if ((code = dict_int_param(op, "BitsPerCoordinate", 1, 32, 0,
+ &params->BitsPerCoordinate)) >= 0 &&
+ (code = dict_int_param(op, "BitsPerComponent", 1, 16, 0,
+ &params->BitsPerComponent)) >= 0
+ ) {
+ *pDecode = (float *)
+ gs_alloc_byte_array(mem, num_decode, sizeof(float),
+ "build_mesh_shading");
+ if (*pDecode == 0)
+ code = gs_note_error(e_VMerror);
+ else {
+ code = dict_floats_param(mem, op, "Decode", num_decode, *pDecode, NULL);
+ if (code < 0) {
+ gs_free_object(mem, *pDecode, "build_mesh_shading");
+ *pDecode = 0;
+ }
+ }
+ }
}
if (code < 0) {
- if (*pFunction != 0) {
- gs_function_free(*pFunction, true, mem);
- *pFunction = 0;
- }
- gs_free_object(mem, data, "build_mesh_shading");
+ if (*pFunction != 0) {
+ gs_function_free(*pFunction, true, mem);
+ *pFunction = 0;
+ }
+ gs_free_object(mem, data, "build_mesh_shading");
}
return code;
}
@@ -552,35 +552,35 @@ build_mesh_shading(i_ctx_t *i_ctx_p, const ref * op,
/* Collect the BitsPerFlag parameter, if relevant. */
static int
flag_bits_param(const ref * op, const gs_shading_mesh_params_t * params,
- int *pBitsPerFlag)
+ int *pBitsPerFlag)
{
if (data_source_is_array(params->DataSource)) {
- *pBitsPerFlag = 0;
- return 0;
+ *pBitsPerFlag = 0;
+ return 0;
} else {
- return dict_int_param(op, "BitsPerFlag", 2, 8, 0, pBitsPerFlag);
+ return dict_int_param(op, "BitsPerFlag", 2, 8, 0, pBitsPerFlag);
}
}
/* Build a ShadingType 4 (Free-form Gouraud triangle mesh) shading. */
static int
build_shading_4(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_FfGt_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code =
- build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
- &params.Decode, &params.Function, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
- &params.BitsPerFlag)) < 0 ||
- (code = gs_shading_FfGt_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
- gs_free_object(mem, params.Decode, "Decode");
+ build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
+ &params.Decode, &params.Function, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
+ &params.BitsPerFlag)) < 0 ||
+ (code = gs_shading_FfGt_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
+ gs_free_object(mem, params.Decode, "Decode");
}
return code;
}
@@ -594,22 +594,22 @@ zbuildshading4(i_ctx_t *i_ctx_p)
/* Build a ShadingType 5 (Lattice-form Gouraud triangle mesh) shading. */
static int
build_shading_5(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_LfGt_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code =
- build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
- &params.Decode, &params.Function, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = dict_int_param(op, "VerticesPerRow", 2, max_int, 0,
- &params.VerticesPerRow)) < 0 ||
- (code = gs_shading_LfGt_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
- gs_free_object(mem, params.Decode, "Decode");
+ build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
+ &params.Decode, &params.Function, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = dict_int_param(op, "VerticesPerRow", 2, max_int, 0,
+ &params.VerticesPerRow)) < 0 ||
+ (code = gs_shading_LfGt_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
+ gs_free_object(mem, params.Decode, "Decode");
}
return code;
}
@@ -623,22 +623,22 @@ zbuildshading5(i_ctx_t *i_ctx_p)
/* Build a ShadingType 6 (Coons patch mesh) shading. */
static int
build_shading_6(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_Cp_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code =
- build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
- &params.Decode, &params.Function, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
- &params.BitsPerFlag)) < 0 ||
- (code = gs_shading_Cp_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
- gs_free_object(mem, params.Decode, "Decode");
+ build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
+ &params.Decode, &params.Function, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
+ &params.BitsPerFlag)) < 0 ||
+ (code = gs_shading_Cp_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
+ gs_free_object(mem, params.Decode, "Decode");
}
return code;
}
@@ -652,22 +652,22 @@ zbuildshading6(i_ctx_t *i_ctx_p)
/* Build a ShadingType 7 (Tensor product patch mesh) shading. */
static int
build_shading_7(i_ctx_t *i_ctx_p, const ref * op, const gs_shading_params_t * pcommon,
- gs_shading_t ** ppsh, gs_memory_t *mem)
+ gs_shading_t ** ppsh, gs_memory_t *mem)
{
gs_shading_Tpp_params_t params;
int code;
*(gs_shading_params_t *)&params = *pcommon;
if ((code =
- build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
- &params.Decode, &params.Function, mem)) < 0 ||
- (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
- (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
- &params.BitsPerFlag)) < 0 ||
- (code = gs_shading_Tpp_init(ppsh, &params, mem)) < 0
- ) {
- gs_free_object(mem, params.Function, "Function");
- gs_free_object(mem, params.Decode, "Decode");
+ build_mesh_shading(i_ctx_p, op, (gs_shading_mesh_params_t *)&params,
+ &params.Decode, &params.Function, mem)) < 0 ||
+ (code = check_indexed_vs_function(i_ctx_p, op, params.ColorSpace, params.Function)) < 0 ||
+ (code = flag_bits_param(op, (gs_shading_mesh_params_t *)&params,
+ &params.BitsPerFlag)) < 0 ||
+ (code = gs_shading_Tpp_init(ppsh, &params, mem)) < 0
+ ) {
+ gs_free_object(mem, params.Function, "Function");
+ gs_free_object(mem, params.Decode, "Decode");
}
return code;
}
diff --git a/gs/psi/zstack.c b/gs/psi/zstack.c
index 21703f9b7..503b24d9b 100644
--- a/gs/psi/zstack.c
+++ b/gs/psi/zstack.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -66,16 +66,16 @@ zindex(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if ((ulong)op->value.intval >= (ulong)(op - osbot)) {
- /* Might be in an older stack block. */
- ref *elt;
+ /* Might be in an older stack block. */
+ ref *elt;
- if (op->value.intval < 0)
- return_error(e_rangecheck);
- elt = ref_stack_index(&o_stack, op->value.intval + 1);
- if (elt == 0)
- return_error(e_stackunderflow);
- ref_assign(op, elt);
- return 0;
+ if (op->value.intval < 0)
+ return_error(e_rangecheck);
+ elt = ref_stack_index(&o_stack, op->value.intval + 1);
+ if (elt == 0)
+ return_error(e_stackunderflow);
+ ref_assign(op, elt);
+ return 0;
}
opn = op + ~(int)op->value.intval;
ref_assign_inline(op, opn);
@@ -95,7 +95,7 @@ zargindex(i_ctx_t *i_ctx_p)
* in fact, the only reason this operator exists.)
*/
if (code == e_rangecheck && osp->value.intval >= 0)
- code = gs_note_error(e_stackunderflow);
+ code = gs_note_error(e_stackunderflow);
return code;
}
@@ -113,55 +113,55 @@ zroll(i_ctx_t *i_ctx_p)
check_type(*op1, t_integer);
check_type(*op, t_integer);
if ((uint) op1->value.intval > (uint)(op1 - osbot)) {
- /*
- * The data might span multiple stack blocks.
- * There are efficient ways to handle this situation,
- * but they're more complicated than seems worth implementing;
- * for now, do something very simple and inefficient.
- */
- int left, i;
+ /*
+ * The data might span multiple stack blocks.
+ * There are efficient ways to handle this situation,
+ * but they're more complicated than seems worth implementing;
+ * for now, do something very simple and inefficient.
+ */
+ int left, i;
- if (op1->value.intval < 0)
- return_error(e_rangecheck);
- if (op1->value.intval + 2 > (int)ref_stack_count(&o_stack))
- return_error(e_stackunderflow);
- count = op1->value.intval;
- if (count <= 1) {
- pop(2);
- return 0;
- }
- mod = op->value.intval;
- if (mod >= count)
- mod %= count;
- else if (mod < 0) {
- mod %= count;
- if (mod < 0)
- mod += count; /* can't assume % means mod! */
- }
- /* Use the chain rotation algorithm mentioned below. */
- for (i = 0, left = count; left; i++) {
- ref *elt = ref_stack_index(&o_stack, i + 2);
- ref save;
- int j, k;
- ref *next;
+ if (op1->value.intval < 0)
+ return_error(e_rangecheck);
+ if (op1->value.intval + 2 > (int)ref_stack_count(&o_stack))
+ return_error(e_stackunderflow);
+ count = op1->value.intval;
+ if (count <= 1) {
+ pop(2);
+ return 0;
+ }
+ mod = op->value.intval;
+ if (mod >= count)
+ mod %= count;
+ else if (mod < 0) {
+ mod %= count;
+ if (mod < 0)
+ mod += count; /* can't assume % means mod! */
+ }
+ /* Use the chain rotation algorithm mentioned below. */
+ for (i = 0, left = count; left; i++) {
+ ref *elt = ref_stack_index(&o_stack, i + 2);
+ ref save;
+ int j, k;
+ ref *next;
- save = *elt;
- for (j = i, left--;; j = k, elt = next, left--) {
- k = (j + mod) % count;
- if (k == i)
- break;
- next = ref_stack_index(&o_stack, k + 2);
- ref_assign(elt, next);
- }
- *elt = save;
- }
- pop(2);
- return 0;
+ save = *elt;
+ for (j = i, left--;; j = k, elt = next, left--) {
+ k = (j + mod) % count;
+ if (k == i)
+ break;
+ next = ref_stack_index(&o_stack, k + 2);
+ ref_assign(elt, next);
+ }
+ *elt = save;
+ }
+ pop(2);
+ return 0;
}
count = op1->value.intval;
if (count <= 1) {
- pop(2);
- return 0;
+ pop(2);
+ return 0;
}
mod = op->value.intval;
/*
@@ -173,65 +173,65 @@ zroll(i_ctx_t *i_ctx_p)
* in *either* direction.
*/
switch (mod) {
- case 1: /* common special case */
- pop(2);
- op -= 2;
- {
- ref top;
+ case 1: /* common special case */
+ pop(2);
+ op -= 2;
+ {
+ ref top;
- ref_assign_inline(&top, op);
- for (from = op, n = count; --n; from--)
- ref_assign_inline(from, from - 1);
- ref_assign_inline(from, &top);
- }
- return 0;
- case -1: /* common special case */
- pop(2);
- op -= 2;
- {
- ref bot;
+ ref_assign_inline(&top, op);
+ for (from = op, n = count; --n; from--)
+ ref_assign_inline(from, from - 1);
+ ref_assign_inline(from, &top);
+ }
+ return 0;
+ case -1: /* common special case */
+ pop(2);
+ op -= 2;
+ {
+ ref bot;
- to = op - count + 1;
- ref_assign_inline(&bot, to);
- for (n = count; --n; to++)
- ref_assign(to, to + 1);
- ref_assign_inline(to, &bot);
- }
- return 0;
+ to = op - count + 1;
+ ref_assign_inline(&bot, to);
+ for (n = count; --n; to++)
+ ref_assign(to, to + 1);
+ ref_assign_inline(to, &bot);
+ }
+ return 0;
}
if (mod < 0) {
- mod += count;
- if (mod < 0) {
- mod %= count;
- if (mod < 0)
- mod += count; /* can't assume % means mod! */
- }
+ mod += count;
+ if (mod < 0) {
+ mod %= count;
+ if (mod < 0)
+ mod += count; /* can't assume % means mod! */
+ }
} else if (mod >= count)
- mod %= count;
+ mod %= count;
if (mod <= count >> 1) {
- /* Move everything up, then top elements down. */
- if (mod >= ostop - op) {
- o_stack.requested = mod;
- return_error(e_stackoverflow);
- }
- pop(2);
- op -= 2;
- for (to = op + mod, from = op, n = count; n--; to--, from--)
- ref_assign(to, from);
- memcpy((char *)(from + 1), (char *)(op + 1), mod * sizeof(ref));
+ /* Move everything up, then top elements down. */
+ if (mod >= ostop - op) {
+ o_stack.requested = mod;
+ return_error(e_stackoverflow);
+ }
+ pop(2);
+ op -= 2;
+ for (to = op + mod, from = op, n = count; n--; to--, from--)
+ ref_assign(to, from);
+ memcpy((char *)(from + 1), (char *)(op + 1), mod * sizeof(ref));
} else {
- /* Move bottom elements up, then everything down. */
- mod = count - mod;
- if (mod >= ostop - op) {
- o_stack.requested = mod;
- return_error(e_stackoverflow);
- }
- pop(2);
- op -= 2;
- to = op - count + 1;
- memcpy((char *)(op + 1), (char *)to, mod * sizeof(ref));
- for (from = to + mod, n = count; n--; to++, from++)
- ref_assign(to, from);
+ /* Move bottom elements up, then everything down. */
+ mod = count - mod;
+ if (mod >= ostop - op) {
+ o_stack.requested = mod;
+ return_error(e_stackoverflow);
+ }
+ pop(2);
+ op -= 2;
+ to = op - count + 1;
+ memcpy((char *)(op + 1), (char *)to, mod * sizeof(ref));
+ for (from = to + mod, n = count; n--; to++, from++)
+ ref_assign(to, from);
}
return 0;
}
@@ -275,7 +275,7 @@ zcleartomark(i_ctx_t *i_ctx_p)
uint count = ref_stack_counttomark(&o_stack);
if (count == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
ref_stack_pop(&o_stack, count);
return 0;
}
@@ -289,7 +289,7 @@ zcounttomark(i_ctx_t *i_ctx_p)
uint count = ref_stack_counttomark(&o_stack);
if (count == 0)
- return_error(e_unmatchedmark);
+ return_error(e_unmatchedmark);
push(1);
make_int(op, count - 1);
return 0;
diff --git a/gs/psi/zstring.c b/gs/psi/zstring.c
index afff12807..4d52adf7a 100644
--- a/gs/psi/zstring.c
+++ b/gs/psi/zstring.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -37,7 +37,7 @@ zbytestring(i_ctx_t *i_ctx_p)
size = (uint)op->value.intval;
sbody = ialloc_bytes(size, ".bytestring");
if (sbody == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_astruct(op, a_all | icurrent_space, sbody);
memset(sbody, 0, size);
return 0;
@@ -52,14 +52,14 @@ zstring(i_ctx_t *i_ctx_p)
uint size;
check_type(*op, t_integer);
- if (op->value.intval < 0 )
+ if (op->value.intval < 0 )
return_error(e_rangecheck);
- if (op->value.intval > max_string_size )
+ if (op->value.intval > max_string_size )
return_error(e_limitcheck); /* to match Distiller */
size = op->value.intval;
sbody = ialloc_string(size, "string");
if (sbody == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
make_string(op, a_all | icurrent_space, size, sbody);
memset(sbody, 0, size);
return 0;
@@ -88,16 +88,16 @@ zanchorsearch(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
check_read_type(*op1, t_string);
if (size <= r_size(op1) && !memcmp(op1->value.bytes, op->value.bytes, size)) {
- os_ptr op0 = op;
-
- push(1);
- *op0 = *op1;
- r_set_size(op0, size);
- op1->value.bytes += size;
- r_dec_size(op1, size);
- make_true(op);
+ os_ptr op0 = op;
+
+ push(1);
+ *op0 = *op1;
+ r_set_size(op0, size);
+ op1->value.bytes += size;
+ r_dec_size(op1, size);
+ make_true(op);
} else
- make_false(op);
+ make_false(op);
return 0;
}
@@ -117,19 +117,19 @@ zsearch(i_ctx_t *i_ctx_p)
check_read_type(*op1, t_string);
check_read_type(*op, t_string);
if (size > r_size(op1)) { /* can't match */
- make_false(op);
- return 0;
+ make_false(op);
+ return 0;
}
count = r_size(op1) - size;
ptr = op1->value.bytes;
if (size == 0)
- goto found;
+ goto found;
pat = op->value.bytes;
ch = pat[0];
do {
- if (*ptr == ch && (size == 1 || !memcmp(ptr, pat, size)))
- goto found;
- ptr++;
+ if (*ptr == ch && (size == 1 || !memcmp(ptr, pat, size)))
+ goto found;
+ ptr++;
}
while (count--);
/* No match */
@@ -159,11 +159,11 @@ zstringbreak(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
/* We can't use strpbrk here, because C doesn't allow nulls in strings. */
for (i = 0; i < r_size(op - 1); ++i)
- for (j = 0; j < r_size(op); ++j)
- if (op[-1].value.const_bytes[i] == op->value.const_bytes[j]) {
- make_int(op - 1, i);
- goto done;
- }
+ for (j = 0; j < r_size(op); ++j)
+ if (op[-1].value.const_bytes[i] == op->value.const_bytes[j]) {
+ make_int(op - 1, i);
+ goto done;
+ }
make_null(op - 1);
done:
pop(1);
@@ -180,18 +180,18 @@ zstringmatch(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
switch (r_type(op1)) {
- case t_string:
- check_read(*op1);
- goto cmp;
- case t_name:
- name_string_ref(imemory, op1, op1); /* can't fail */
+ case t_string:
+ check_read(*op1);
+ goto cmp;
+ case t_name:
+ name_string_ref(imemory, op1, op1); /* can't fail */
cmp:
- result = string_match(op1->value.const_bytes, r_size(op1),
- op->value.const_bytes, r_size(op),
- NULL);
- break;
- default:
- result = (r_size(op) == 1 && *op->value.bytes == '*');
+ result = string_match(op1->value.const_bytes, r_size(op1),
+ op->value.const_bytes, r_size(op),
+ NULL);
+ break;
+ default:
+ result = (r_size(op) == 1 && *op->value.bytes == '*');
}
make_bool(op1, result);
pop(1);
diff --git a/gs/psi/zsysvm.c b/gs/psi/zsysvm.c
index c2290b760..503b91bdb 100644
--- a/gs/psi/zsysvm.c
+++ b/gs/psi/zsysvm.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/gs/psi/ztrans.c b/gs/psi/ztrans.c
index 663490e53..7829c32a8 100644
--- a/gs/psi/ztrans.c
+++ b/gs/psi/ztrans.c
@@ -45,16 +45,16 @@ set_float_value(i_ctx_t *i_ctx_p, int (*set_value)(gs_state *, floatp))
int code;
if (real_param(op, &value) < 0)
- return_op_typecheck(op);
+ return_op_typecheck(op);
if ((code = set_value(igs, value)) < 0)
- return code;
+ return code;
pop(1);
return 0;
}
static int
current_float_value(i_ctx_t *i_ctx_p,
- float (*current_value)(const gs_state *))
+ float (*current_value)(const gs_state *))
{
os_ptr op = osp;
@@ -65,17 +65,17 @@ current_float_value(i_ctx_t *i_ctx_p,
static int
enum_param(const gs_memory_t *mem, const ref *pnref,
- const char *const names[])
+ const char *const names[])
{
const char *const *p;
ref nsref;
name_string_ref(mem, pnref, &nsref);
for (p = names; *p; ++p)
- if (r_size(&nsref) == strlen(*p) &&
- !memcmp(*p, nsref.value.const_bytes, r_size(&nsref))
- )
- return p - names;
+ if (r_size(&nsref) == strlen(*p) &&
+ !memcmp(*p, nsref.value.const_bytes, r_size(&nsref))
+ )
+ return p - names;
return_error(e_rangecheck);
}
@@ -94,9 +94,9 @@ zsetblendmode(i_ctx_t *i_ctx_p)
check_type(*op, t_name);
if ((code = enum_param(imemory, op, blend_mode_names)) < 0 ||
- (code = gs_setblendmode(igs, code)) < 0
- )
- return code;
+ (code = gs_setblendmode(igs, code)) < 0
+ )
+ return code;
pop(1);
return 0;
}
@@ -111,7 +111,7 @@ zcurrentblendmode(i_ctx_t *i_ctx_p)
int code = name_enter_string(imemory, mode_name, &nref);
if (code < 0)
- return code;
+ return code;
push(1);
*op = nref;
return 0;
@@ -177,7 +177,7 @@ rect_param(gs_rect *prect, os_ptr op)
int code = num_params(op, 4, coords);
if (code < 0)
- return code;
+ return code;
prect->p.x = coords[0], prect->p.y = coords[1];
prect->q.x = coords[2], prect->q.y = coords[3];
return 0;
@@ -185,16 +185,16 @@ rect_param(gs_rect *prect, os_ptr op)
static int
mask_op(i_ctx_t *i_ctx_p,
- int (*mask_proc)(gs_state *, gs_transparency_channel_selector_t))
+ int (*mask_proc)(gs_state *, gs_transparency_channel_selector_t))
{
int csel;
int code = int_param(osp, 1, &csel);
if (code < 0)
- return code;
+ return code;
code = mask_proc(igs, csel);
if (code >= 0)
- pop(1);
+ pop(1);
return code;
}
@@ -214,24 +214,24 @@ zbegintransparencygroup(i_ctx_t *i_ctx_p)
check_dict_read(*dop);
gs_trans_group_params_init(&params);
if ((code = dict_bool_param(dop, "Isolated", false, &params.Isolated)) < 0 ||
- (code = dict_bool_param(dop, "Knockout", false, &params.Knockout)) < 0 ||
- (code = dict_bool_param(dop, ".image_with_SMask", false, &params.image_with_SMask)) < 0
- )
- return code;
+ (code = dict_bool_param(dop, "Knockout", false, &params.Knockout)) < 0 ||
+ (code = dict_bool_param(dop, ".image_with_SMask", false, &params.image_with_SMask)) < 0
+ )
+ return code;
code = rect_param(&bbox, op);
if (code < 0)
- return code;
+ return code;
/* If the CS is not given in the transparency group dict, set to NULL */
/* so that the transparency code knows to inherit from the parent layer */
if (dict_find_string(dop, "CS", &dummy) <= 0) {
- params.ColorSpace = NULL;
+ params.ColorSpace = NULL;
} else {
- /* the PDF interpreter set the colorspace, so use it */
- params.ColorSpace = gs_currentcolorspace(igs);
+ /* the PDF interpreter set the colorspace, so use it */
+ params.ColorSpace = gs_currentcolorspace(igs);
}
code = gs_begin_transparency_group(igs, &params, &bbox);
if (code < 0)
- return code;
+ return code;
pop(5);
return code;
}
@@ -241,7 +241,7 @@ static int
zdiscardtransparencygroup(i_ctx_t *i_ctx_p)
{
if (gs_current_transparency_type(igs) != TRANSPARENCY_STATE_Group)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return gs_discard_transparency_layer(igs);
}
@@ -265,46 +265,46 @@ zbegintransparencymaskgroup(i_ctx_t *i_ctx_p)
gs_rect bbox;
int code;
static const char *const subtype_names[] = {
- GS_TRANSPARENCY_MASK_SUBTYPE_NAMES, 0
+ GS_TRANSPARENCY_MASK_SUBTYPE_NAMES, 0
};
check_type(*dop, t_dictionary);
check_dict_read(*dop);
if (dict_find_string(dop, "Subtype", &pparam) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if ((code = enum_param(imemory, pparam, subtype_names)) < 0)
- return code;
+ return code;
gs_trans_mask_params_init(&params, code);
params.replacing = true;
if ((code = dict_floats_param(imemory, dop, "Background",
- cs_num_components(gs_currentcolorspace(i_ctx_p->pgs)),
- params.Background, NULL)) < 0)
- return code;
+ cs_num_components(gs_currentcolorspace(i_ctx_p->pgs)),
+ params.Background, NULL)) < 0)
+ return code;
else if (code > 0)
- params.Background_components = code;
+ params.Background_components = code;
if ((code = dict_floats_param(imemory, dop, "GrayBackground",
- 1, &params.GrayBackground, NULL)) < 0)
- return code;
+ 1, &params.GrayBackground, NULL)) < 0)
+ return code;
if (dict_find_string(dop, "TransferFunction", &pparam) > 0) {
- gs_function_t *pfn = ref_function(pparam);
+ gs_function_t *pfn = ref_function(pparam);
- if (pfn == 0 || pfn->params.m != 1 || pfn->params.n != 1)
- return_error(e_rangecheck);
- params.TransferFunction = tf_using_function;
- params.TransferFunction_data = pfn;
+ if (pfn == 0 || pfn->params.m != 1 || pfn->params.n != 1)
+ return_error(e_rangecheck);
+ params.TransferFunction = tf_using_function;
+ params.TransferFunction_data = pfn;
}
code = rect_param(&bbox, op);
if (code < 0)
- return code;
+ return code;
/* Is the colorspace set for this mask ? */
if (op[-5].value.boolval) {
- params.ColorSpace = gs_currentcolorspace(igs);
+ params.ColorSpace = gs_currentcolorspace(igs);
} else {
- params.ColorSpace = NULL;
+ params.ColorSpace = NULL;
}
code = gs_begin_transparency_mask(igs, &params, &bbox, false);
if (code < 0)
- return code;
+ return code;
pop(6);
return code;
}
@@ -319,12 +319,12 @@ zbegintransparencymaskimage(i_ctx_t *i_ctx_p)
gs_color_space *gray_cs = gs_cspace_new_DeviceGray(imemory);
if (!gray_cs)
- return_error(e_VMerror);
+ return_error(e_VMerror);
params.ColorSpace = gray_cs; /* per PDF spec, Image SMask is alway DeviceGray */
gs_trans_mask_params_init(&params, TRANSPARENCY_MASK_Luminosity);
code = gs_begin_transparency_mask(igs, &params, &bbox, true);
if (code < 0)
- return code;
+ return code;
rc_decrement_cs(gray_cs, "zbegintransparencymaskimage");
return code;
}
@@ -344,7 +344,7 @@ static int
zdiscardtransparencymask(i_ctx_t *i_ctx_p)
{
if (gs_current_transparency_type(igs) != TRANSPARENCY_STATE_Mask)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
return gs_discard_transparency_layer(igs);
}
@@ -359,8 +359,8 @@ zendtransparencymask(i_ctx_t *i_ctx_p)
/* <dict> .image3x - */
static int mask_dict_param(const gs_memory_t *mem, os_ptr,
- image_params *, const char *, int,
- gs_image3x_mask_t *);
+ image_params *, const char *, int,
+ gs_image3x_mask_t *);
static int
zimage3x(i_ctx_t *i_ctx_p)
{
@@ -369,7 +369,7 @@ zimage3x(i_ctx_t *i_ctx_p)
ref *pDataDict;
image_params ip_data;
int num_components =
- gs_color_space_num_components(gs_currentcolorspace(igs));
+ gs_color_space_num_components(gs_currentcolorspace(igs));
int ignored;
int code;
@@ -377,35 +377,35 @@ zimage3x(i_ctx_t *i_ctx_p)
check_dict_read(*op);
gs_image3x_t_init(&image, NULL);
if (dict_find_string(op, "DataDict", &pDataDict) <= 0)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
if ((code = pixel_image_params(i_ctx_p, pDataDict,
- (gs_pixel_image_t *)&image, &ip_data,
- 16, false, gs_currentcolorspace(igs))) < 0 ||
- (code = dict_int_param(pDataDict, "ImageType", 1, 1, 0, &ignored)) < 0
- )
- return code;
+ (gs_pixel_image_t *)&image, &ip_data,
+ 16, false, gs_currentcolorspace(igs))) < 0 ||
+ (code = dict_int_param(pDataDict, "ImageType", 1, 1, 0, &ignored)) < 0
+ )
+ return code;
/*
* We have to process the masks in the reverse order, because they
* insert their DataSource before the one(s) for the DataDict.
*/
if ((code = mask_dict_param(imemory, op, &ip_data,
- "ShapeMaskDict", num_components,
- &image.Shape)) < 0 ||
- (code = mask_dict_param(imemory, op, &ip_data,
- "OpacityMaskDict", num_components,
- &image.Opacity)) < 0
- )
- return code;
+ "ShapeMaskDict", num_components,
+ &image.Shape)) < 0 ||
+ (code = mask_dict_param(imemory, op, &ip_data,
+ "OpacityMaskDict", num_components,
+ &image.Opacity)) < 0
+ )
+ return code;
return zimage_setup(i_ctx_p, (gs_pixel_image_t *)&image,
- &ip_data.DataSource[0],
- image.CombineWithColor, 1);
+ &ip_data.DataSource[0],
+ image.CombineWithColor, 1);
}
/* Get one soft-mask dictionary parameter. */
static int
mask_dict_param(const gs_memory_t *mem, os_ptr op,
image_params *pip_data, const char *dict_name,
- int num_components, gs_image3x_mask_t *pixm)
+ int num_components, gs_image3x_mask_t *pixm)
{
ref *pMaskDict;
image_params ip_mask;
@@ -413,31 +413,31 @@ image_params *pip_data, const char *dict_name,
int code, mcode;
if (dict_find_string(op, dict_name, &pMaskDict) <= 0)
- return 1;
+ return 1;
if ((mcode = code = data_image_params(mem, pMaskDict, &pixm->MaskDict,
- &ip_mask, false, 1, 16, false, false)) < 0 ||
- (code = dict_int_param(pMaskDict, "ImageType", 1, 1, 0, &ignored)) < 0 ||
- (code = dict_int_param(pMaskDict, "InterleaveType", 1, 3, -1,
- &pixm->InterleaveType)) < 0 ||
- (code = dict_floats_param(mem, op, "Matte", num_components,
- pixm->Matte, NULL)) < 0
- )
- return code;
+ &ip_mask, false, 1, 16, false, false)) < 0 ||
+ (code = dict_int_param(pMaskDict, "ImageType", 1, 1, 0, &ignored)) < 0 ||
+ (code = dict_int_param(pMaskDict, "InterleaveType", 1, 3, -1,
+ &pixm->InterleaveType)) < 0 ||
+ (code = dict_floats_param(mem, op, "Matte", num_components,
+ pixm->Matte, NULL)) < 0
+ )
+ return code;
pixm->has_Matte = code > 0;
/*
* The MaskDict must have a DataSource iff InterleaveType == 3.
*/
if ((pip_data->MultipleDataSources && pixm->InterleaveType != 3) ||
- ip_mask.MultipleDataSources ||
- mcode != (pixm->InterleaveType != 3)
- )
- return_error(e_rangecheck);
+ ip_mask.MultipleDataSources ||
+ mcode != (pixm->InterleaveType != 3)
+ )
+ return_error(e_rangecheck);
if (pixm->InterleaveType == 3) {
- /* Insert the mask DataSource before the data DataSources. */
- memmove(&pip_data->DataSource[1], &pip_data->DataSource[0],
- (countof(pip_data->DataSource) - 1) *
- sizeof(pip_data->DataSource[0]));
- pip_data->DataSource[0] = ip_mask.DataSource[0];
+ /* Insert the mask DataSource before the data DataSources. */
+ memmove(&pip_data->DataSource[1], &pip_data->DataSource[0],
+ (countof(pip_data->DataSource) - 1) *
+ sizeof(pip_data->DataSource[0]));
+ pip_data->DataSource[0] = ip_mask.DataSource[0];
}
return 0;
}
diff --git a/gs/psi/ztrap.c b/gs/psi/ztrap.c
index 2a1d77479..51979ac58 100644
--- a/gs/psi/ztrap.c
+++ b/gs/psi/ztrap.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -34,11 +34,11 @@ zsettrapparams(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = dict_param_list_read(&list, op, NULL, false, iimemory);
if (code < 0)
- return code;
+ return code;
code = gs_settrapparams(&i_trap_params, (gs_param_list *) & list);
iparam_list_release(&list);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
diff --git a/gs/psi/zupath.c b/gs/psi/zupath.c
index a3d1757da..89691341a 100644
--- a/gs/psi/zupath.c
+++ b/gs/psi/zupath.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -117,19 +117,19 @@ zinustroke(i_ctx_t *i_ctx_p)
gx_device hdev;
if (code < 0)
- return code;
+ return code;
if ((spop = upath_stroke(i_ctx_p, &mat, false)) < 0) {
- gs_grestore(igs);
- return spop;
+ gs_grestore(igs);
+ return spop;
}
if ((npop = in_path(op - spop, i_ctx_p, &hdev)) < 0) {
- gs_grestore(igs);
- return npop;
+ gs_grestore(igs);
+ return npop;
}
if (npop > 1) /* matrix was supplied */
- code = gs_concat(igs, &mat);
+ code = gs_concat(igs, &mat);
if (code >= 0)
- code = gs_stroke(igs);
+ code = gs_stroke(igs);
return in_upath_result(i_ctx_p, npop + spop, code);
}
@@ -145,7 +145,7 @@ in_test(i_ctx_t *i_ctx_p, int (*paintproc)(gs_state *))
int code;
if (npop < 0)
- return npop;
+ return npop;
code = (*paintproc)(igs);
return in_path_result(i_ctx_p, npop, code);
}
@@ -159,46 +159,46 @@ in_path(os_ptr oppath, i_ctx_t *i_ctx_p, gx_device * phdev)
double uxy[2];
if (code < 0)
- return code;
+ return code;
code = num_params(oppath, 2, uxy);
if (code >= 0) { /* Aperture is a single pixel. */
- gs_point dxy;
- gs_fixed_rect fr;
-
- gs_transform(igs, uxy[0], uxy[1], &dxy);
- fr.p.x = fixed_floor(float2fixed(dxy.x));
- fr.p.y = fixed_floor(float2fixed(dxy.y));
- fr.q.x = fr.p.x + fixed_1;
- fr.q.y = fr.p.y + fixed_1;
- code = gx_clip_to_rectangle(igs, &fr);
- npop = 2;
+ gs_point dxy;
+ gs_fixed_rect fr;
+
+ gs_transform(igs, uxy[0], uxy[1], &dxy);
+ fr.p.x = fixed_floor(float2fixed(dxy.x));
+ fr.p.y = fixed_floor(float2fixed(dxy.y));
+ fr.q.x = fr.p.x + fixed_1;
+ fr.q.y = fr.p.y + fixed_1;
+ code = gx_clip_to_rectangle(igs, &fr);
+ npop = 2;
} else if (code == e_stackunderflow) {
- /* If 0 elements, definitely a stackunderflow; otherwise, */
- /* only 1 number, also a stackunderflow. */
- npop = code;
+ /* If 0 elements, definitely a stackunderflow; otherwise, */
+ /* only 1 number, also a stackunderflow. */
+ npop = code;
} else { /* Aperture is a user path. */
- /* We have to set the clipping path without disturbing */
- /* the current path. */
- gx_path *ipath = igs->path;
- gx_path save;
-
- gx_path_init_local(&save, imemory);
- gx_path_assign_preserve(&save, ipath);
- gs_newpath(igs);
- code = upath_append(oppath, i_ctx_p, false);
- if (code >= 0)
- code = gx_clip_to_path(igs);
- gx_path_assign_free(igs->path, &save);
- npop = 1;
+ /* We have to set the clipping path without disturbing */
+ /* the current path. */
+ gx_path *ipath = igs->path;
+ gx_path save;
+
+ gx_path_init_local(&save, imemory);
+ gx_path_assign_preserve(&save, ipath);
+ gs_newpath(igs);
+ code = upath_append(oppath, i_ctx_p, false);
+ if (code >= 0)
+ code = gx_clip_to_path(igs);
+ gx_path_assign_free(igs->path, &save);
+ npop = 1;
}
if (code < 0) {
- gs_grestore(igs);
- return code;
+ gs_grestore(igs);
+ return code;
}
/* Install the hit detection device. */
gx_set_device_color_1(igs);
gx_device_init((gx_device *) phdev, (const gx_device *)&gs_hit_device,
- NULL, true);
+ NULL, true);
phdev->width = phdev->height = max_int;
gx_device_fill_in_procs(phdev);
gx_set_device_only(igs, phdev);
@@ -214,11 +214,11 @@ in_path_result(i_ctx_t *i_ctx_p, int npop, int code)
gs_grestore(igs); /* matches gsave in in_path */
if (code == gs_hit_detected)
- result = true;
+ result = true;
else if (code == 0) /* completed painting without a hit */
- result = false;
+ result = false;
else /* error */
- return code;
+ return code;
npop--;
pop(npop);
op -= npop;
@@ -236,7 +236,7 @@ in_utest(i_ctx_t *i_ctx_p, int (*paintproc)(gs_state *))
int code;
if (npop < 0)
- return npop;
+ return npop;
code = (*paintproc)(igs);
return in_upath_result(i_ctx_p, npop, code);
}
@@ -251,12 +251,12 @@ in_upath(i_ctx_t *i_ctx_p, gx_device * phdev)
int npop;
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, false)) < 0 ||
- (code = npop = in_path(op - 1, i_ctx_p, phdev)) < 0
- ) {
- gs_grestore(igs);
- return code;
+ (code = npop = in_path(op - 1, i_ctx_p, phdev)) < 0
+ ) {
+ gs_grestore(igs);
+ return code;
}
return npop + 1;
}
@@ -346,12 +346,12 @@ zuappend(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, false)) >= 0)
- code = gs_upmergepath(igs);
+ code = gs_upmergepath(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -364,12 +364,12 @@ zueofill(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, gs_currentcpsimode(imemory))) >= 0)
- code = gs_eofill(igs);
+ code = gs_eofill(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -382,12 +382,12 @@ zufill(i_ctx_t *i_ctx_p)
int code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
if ((code = upath_append(op, i_ctx_p, gs_currentcpsimode(imemory))) >= 0)
- code = gs_fill(igs);
+ code = gs_fill(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -401,12 +401,12 @@ zustroke(i_ctx_t *i_ctx_p)
int npop;
if (code < 0)
- return code;
+ return code;
if ((code = npop = upath_stroke(i_ctx_p, NULL, gs_currentcpsimode(imemory))) >= 0)
- code = gs_stroke(igs);
+ code = gs_stroke(igs);
gs_grestore(igs);
if (code < 0)
- return code;
+ return code;
pop(npop);
return 0;
}
@@ -421,23 +421,23 @@ zustrokepath(i_ctx_t *i_ctx_p)
int npop, code = gs_currentmatrix(igs, &saved_matrix);
if (code < 0)
- return code;
+ return code;
/* Save and reset the path. */
gx_path_init_local(&save, imemory);
gx_path_assign_preserve(&save, igs->path);
if ((code = npop = upath_stroke(i_ctx_p, NULL, false)) < 0 ||
- (code = gs_strokepath(igs)) < 0
- ) {
- gx_path_assign_free(igs->path, &save);
- return code;
+ (code = gs_strokepath(igs)) < 0
+ ) {
+ gx_path_assign_free(igs->path, &save);
+ return code;
}
/*
* If a matrix was specified then restore the previous matrix.
*/
if (npop > 1) {
if ((code = gs_setmatrix(igs, &saved_matrix)) < 0) {
- gx_path_assign_free(igs->path, &save);
- return code;
+ gx_path_assign_free(igs->path, &save);
+ return code;
}
}
gx_path_free(&save, "ustrokepath");
@@ -449,7 +449,7 @@ zustrokepath(i_ctx_t *i_ctx_p)
/* We do all the work in a procedure that is also used to construct */
/* the UnpaintedPath user path for ImageType 2 images. */
int make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
- bool with_ucache);
+ bool with_ucache);
static int
zupath(i_ctx_t *i_ctx_p)
{
@@ -460,7 +460,7 @@ zupath(i_ctx_t *i_ctx_p)
}
/* Compute the path length for user path purposes. */
-static int
+static int
path_length_for_upath(const gx_path *ppath)
{
gs_path_enum penum;
@@ -469,27 +469,27 @@ path_length_for_upath(const gx_path *ppath)
gx_path_enum_init(&penum, ppath);
while ((op = gx_path_enum_next(&penum, pts)) != 0) {
- switch (op) {
- case gs_pe_moveto:
- case gs_pe_lineto:
- size += 3;
- continue;
- case gs_pe_curveto:
- size += 7;
- continue;
- case gs_pe_closepath:
- size += 1;
- continue;
- default:
- return_error(e_unregistered);
- }
+ switch (op) {
+ case gs_pe_moveto:
+ case gs_pe_lineto:
+ size += 3;
+ continue;
+ case gs_pe_curveto:
+ size += 7;
+ continue;
+ case gs_pe_closepath:
+ size += 1;
+ continue;
+ default:
+ return_error(e_unregistered);
+ }
}
return size;
}
int
make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
- bool with_ucache)
+ bool with_ucache)
{
int size = (with_ucache ? 6 : 5);
gs_path_enum penum;
@@ -498,18 +498,17 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
ref *next;
int code;
-
/* Compute the bounding box. */
if ((code = gs_upathbbox(pgs, &bbox, true)) < 0) {
- /*
- * Note: Adobe throws 'nocurrentpoint' error, but the PLRM does
- * not list this as a possible error from 'upath', so if we are
- * not in CPSI compatibility mode, we set a reasonable default
- * bbox instead.
- */
- if (code != e_nocurrentpoint || gs_currentcpsimode(imemory))
- return code;
- bbox.p.x = bbox.p.y = bbox.q.x = bbox.q.y = 0;
+ /*
+ * Note: Adobe throws 'nocurrentpoint' error, but the PLRM does
+ * not list this as a possible error from 'upath', so if we are
+ * not in CPSI compatibility mode, we set a reasonable default
+ * bbox instead.
+ */
+ if (code != e_nocurrentpoint || gs_currentcpsimode(imemory))
+ return code;
+ bbox.p.x = bbox.p.y = bbox.q.x = bbox.q.y = 0;
}
code = path_length_for_upath(ppath);
@@ -520,16 +519,16 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
return_error(e_limitcheck);
code = ialloc_ref_array(rupath, a_all | a_executable, size,
- "make_upath");
+ "make_upath");
if (code < 0)
- return code;
+ return code;
/* Construct the path. */
next = rupath->value.refs;
if (with_ucache) {
if ((code = name_enter_string(pgs->memory, "ucache", next)) < 0)
- return code;
- r_set_attrs(next, a_executable | l_new);
- ++next;
+ return code;
+ r_set_attrs(next, a_executable | l_new);
+ ++next;
}
make_real_new(next, bbox.p.x);
make_real_new(next + 1, bbox.p.y);
@@ -537,57 +536,56 @@ make_upath(i_ctx_t *i_ctx_p, ref *rupath, gs_state *pgs, gx_path *ppath,
make_real_new(next + 3, bbox.q.y);
next += 4;
if ((code = name_enter_string(pgs->memory, "setbbox", next)) < 0)
- return code;
+ return code;
r_set_attrs(next, a_executable | l_new);
++next;
{
- gs_point pts[3];
-
- /* Patch the path in the gstate to set up the enumerator. */
- gx_path *save_path = pgs->path;
-
- pgs->path = ppath;
- gs_path_enum_copy_init(&penum, pgs, false);
- pgs->path = save_path;
- while ((op = gs_path_enum_next(&penum, pts)) != 0) {
- const char *opstr;
-
- switch (op) {
- case gs_pe_moveto:
- opstr = "moveto";
- goto ml;
- case gs_pe_lineto:
- opstr = "lineto";
- ml:make_real_new(next, pts[0].x);
- make_real_new(next + 1, pts[0].y);
- next += 2;
- break;
- case gs_pe_curveto:
- opstr = "curveto";
- make_real_new(next, pts[0].x);
- make_real_new(next + 1, pts[0].y);
- make_real_new(next + 2, pts[1].x);
- make_real_new(next + 3, pts[1].y);
- make_real_new(next + 4, pts[2].x);
- make_real_new(next + 5, pts[2].y);
- next += 6;
- break;
- case gs_pe_closepath:
- opstr = "closepath";
- break;
- default:
- return_error(e_unregistered);
- }
- if ((code = name_enter_string(pgs->memory, opstr, next)) < 0)
- return code;
- r_set_attrs(next, a_executable);
- ++next;
- }
+ gs_point pts[3];
+
+ /* Patch the path in the gstate to set up the enumerator. */
+ gx_path *save_path = pgs->path;
+
+ pgs->path = ppath;
+ gs_path_enum_copy_init(&penum, pgs, false);
+ pgs->path = save_path;
+ while ((op = gs_path_enum_next(&penum, pts)) != 0) {
+ const char *opstr;
+
+ switch (op) {
+ case gs_pe_moveto:
+ opstr = "moveto";
+ goto ml;
+ case gs_pe_lineto:
+ opstr = "lineto";
+ ml:make_real_new(next, pts[0].x);
+ make_real_new(next + 1, pts[0].y);
+ next += 2;
+ break;
+ case gs_pe_curveto:
+ opstr = "curveto";
+ make_real_new(next, pts[0].x);
+ make_real_new(next + 1, pts[0].y);
+ make_real_new(next + 2, pts[1].x);
+ make_real_new(next + 3, pts[1].y);
+ make_real_new(next + 4, pts[2].x);
+ make_real_new(next + 5, pts[2].y);
+ next += 6;
+ break;
+ case gs_pe_closepath:
+ opstr = "closepath";
+ break;
+ default:
+ return_error(e_unregistered);
+ }
+ if ((code = name_enter_string(pgs->memory, opstr, next)) < 0)
+ return code;
+ r_set_attrs(next, a_executable);
+ ++next;
+ }
}
return 0;
}
-
static int
zgetpath(i_ctx_t *i_ctx_p)
{
@@ -607,9 +605,9 @@ zgetpath(i_ctx_t *i_ctx_p)
return 0;
if (dict_find_string(systemdict, "moveto", &operators[1]) <= 0 ||
- dict_find_string(systemdict, "lineto", &operators[2]) <= 0 ||
- dict_find_string(systemdict, "curveto", &operators[3]) <= 0 ||
- dict_find_string(systemdict, "closepath", &operators[4]) <= 0)
+ dict_find_string(systemdict, "lineto", &operators[2]) <= 0 ||
+ dict_find_string(systemdict, "curveto", &operators[3]) <= 0 ||
+ dict_find_string(systemdict, "closepath", &operators[4]) <= 0)
return_error(e_undefined);
main_ref = op->value.refs;
@@ -624,8 +622,8 @@ zgetpath(i_ctx_t *i_ctx_p)
int pe, j, k;
gs_path_enum penum;
static const int oper_count[5] = { 0, 2, 2, 6, 0 };
- gs_point pts[3];
- const double *fts[6];
+ gs_point pts[3];
+ const double *fts[6];
fts[0] = &pts[0].x;
fts[1] = &pts[0].y;
@@ -635,7 +633,7 @@ zgetpath(i_ctx_t *i_ctx_p)
fts[5] = &pts[2].y;
main_ref = op->value.refs;
- gs_path_enum_copy_init(&penum, igs, false);
+ gs_path_enum_copy_init(&penum, igs, false);
pe = gs_path_enum_next(&penum, pts);
if (pe < 0)
return pe;
@@ -644,7 +642,7 @@ zgetpath(i_ctx_t *i_ctx_p)
for (i = 0; i < leaf_count; i++) {
int leaf_size = ( i == leaf_count - 1) ? path_size - i * max_array_size : max_array_size;
ref *leaf_ref = main_ref[i].value.refs;
-
+
for (j = 0; j < leaf_size; j++) {
if (k < oper_count[pe])
make_real_new(&leaf_ref[j], (float)*fts[k++]);
@@ -673,156 +671,156 @@ upath_append_aux(os_ptr oppath, i_ctx_t *i_ctx_p, int *pnargs, bool upath_compat
ref opcodes;
if (r_has_type(oppath, t__invalid))
- return_error(e_stackunderflow);
+ return_error(e_stackunderflow);
if (!r_is_array(oppath))
- return_error(e_typecheck);
+ return_error(e_typecheck);
check_read(*oppath);
gs_newpath(igs);
/****** ROUND tx AND ty ******/
-
+
if ( r_size(oppath) == 2 &&
- array_get(imemory, oppath, 1, &opcodes) >= 0 &&
+ array_get(imemory, oppath, 1, &opcodes) >= 0 &&
r_has_type(&opcodes, t_string)
- ) { /* 1st element is operands, 2nd is operators */
- ref operands;
- int code, format;
- int repcount = 1;
- const byte *opp;
- uint ocount, i = 0;
+ ) { /* 1st element is operands, 2nd is operators */
+ ref operands;
+ int code, format;
+ int repcount = 1;
+ const byte *opp;
+ uint ocount, i = 0;
array_get(imemory, oppath, 0, &operands);
code = num_array_format(&operands);
- if (code < 0)
- return code;
- format = code;
- check_read(opcodes);
- opp = opcodes.value.bytes;
- ocount = r_size(&opcodes);
- while (ocount--) {
- byte opx = *opp++;
-
- if (opx > UPATH_REPEAT)
- repcount = opx - UPATH_REPEAT;
- else if (opx > UPATH_MAX_OP)
- return_error(e_rangecheck);
- else { /* operator */
- const up_data_t data = up_data[opx];
-
- *pnargs = 0; /* in case of error */
- if (upath_compat && opx == upath_op_ucache) {
- /* CPSI does not complain about incorrect ucache
- placement, even though PLRM3 says it's illegal. */
- ups = ups > UPS_UCACHE ? ups : data.state_after;
- } else {
- if (!(ups & data.states_before))
- return_error(e_typecheck);
- ups = data.state_after;
- }
- do {
- os_ptr op = osp;
- byte opargs = data.num_args;
-
- while (opargs--) {
- push(1);
- (*pnargs)++; /* in case of error */
- code = num_array_get(imemory, &operands, format, i++, op);
- switch (code) {
- case t_integer:
- r_set_type_attrs(op, t_integer, 0);
- break;
- case t_real:
- r_set_type_attrs(op, t_real, 0);
- break;
- default:
- return_error(e_typecheck);
- }
- }
- code = (*up_ops[opx])(i_ctx_p);
- if (code < 0)
- return code;
- }
- while (--repcount);
- repcount = 1;
- }
- }
+ if (code < 0)
+ return code;
+ format = code;
+ check_read(opcodes);
+ opp = opcodes.value.bytes;
+ ocount = r_size(&opcodes);
+ while (ocount--) {
+ byte opx = *opp++;
+
+ if (opx > UPATH_REPEAT)
+ repcount = opx - UPATH_REPEAT;
+ else if (opx > UPATH_MAX_OP)
+ return_error(e_rangecheck);
+ else { /* operator */
+ const up_data_t data = up_data[opx];
+
+ *pnargs = 0; /* in case of error */
+ if (upath_compat && opx == upath_op_ucache) {
+ /* CPSI does not complain about incorrect ucache
+ placement, even though PLRM3 says it's illegal. */
+ ups = ups > UPS_UCACHE ? ups : data.state_after;
+ } else {
+ if (!(ups & data.states_before))
+ return_error(e_typecheck);
+ ups = data.state_after;
+ }
+ do {
+ os_ptr op = osp;
+ byte opargs = data.num_args;
+
+ while (opargs--) {
+ push(1);
+ (*pnargs)++; /* in case of error */
+ code = num_array_get(imemory, &operands, format, i++, op);
+ switch (code) {
+ case t_integer:
+ r_set_type_attrs(op, t_integer, 0);
+ break;
+ case t_real:
+ r_set_type_attrs(op, t_real, 0);
+ break;
+ default:
+ return_error(e_typecheck);
+ }
+ }
+ code = (*up_ops[opx])(i_ctx_p);
+ if (code < 0)
+ return code;
+ }
+ while (--repcount);
+ repcount = 1;
+ }
+ }
} else { /* Ordinary executable array. */
- const ref *arp = oppath;
- uint ocount = r_size(oppath);
- long index = 0;
- int argcount = 0;
- op_proc_t oproc;
- int opx, code;
-
- for (; index < ocount; index++) {
- ref rup;
- ref *defp;
- os_ptr op = osp;
- up_data_t data;
-
- *pnargs = argcount;
- array_get(imemory, arp, index, &rup);
- switch (r_type(&rup)) {
- case t_integer:
- case t_real:
- argcount++;
- push(1);
- *op = rup;
- break;
- case t_name:
- if (!r_has_attr(&rup, a_executable) ||
- dict_find(systemdict, &rup, &defp) <= 0 ||
- r_btype(defp) != t_operator)
- return_error(e_typecheck); /* all errors = typecheck */
- goto xop;
- case t_operator:
- defp = &rup;
- xop:if (!r_has_attr(defp, a_executable))
- return_error(e_typecheck);
- oproc = real_opproc(defp);
- for (opx = 0; opx <= UPATH_MAX_OP; opx++)
- if (oproc == up_ops[opx])
- break;
- if (opx > UPATH_MAX_OP)
- return_error(e_typecheck);
- data = up_data[opx];
- if (argcount != data.num_args)
- return_error(e_typecheck);
- if (upath_compat && opx == upath_op_ucache) {
- /* CPSI does not complain about incorrect ucache
- placement, even though PLRM3 says it's illegal. */
- ups = ups > UPS_UCACHE ? ups : data.state_after;
- } else {
- if (!(ups & data.states_before))
- return_error(e_typecheck);
- ups = data.state_after;
- }
- code = (*up_ops[opx])(i_ctx_p);
- if (code < 0) {
- if (code == e_nocurrentpoint)
+ const ref *arp = oppath;
+ uint ocount = r_size(oppath);
+ long index = 0;
+ int argcount = 0;
+ op_proc_t oproc;
+ int opx, code;
+
+ for (; index < ocount; index++) {
+ ref rup;
+ ref *defp;
+ os_ptr op = osp;
+ up_data_t data;
+
+ *pnargs = argcount;
+ array_get(imemory, arp, index, &rup);
+ switch (r_type(&rup)) {
+ case t_integer:
+ case t_real:
+ argcount++;
+ push(1);
+ *op = rup;
+ break;
+ case t_name:
+ if (!r_has_attr(&rup, a_executable) ||
+ dict_find(systemdict, &rup, &defp) <= 0 ||
+ r_btype(defp) != t_operator)
+ return_error(e_typecheck); /* all errors = typecheck */
+ goto xop;
+ case t_operator:
+ defp = &rup;
+ xop:if (!r_has_attr(defp, a_executable))
+ return_error(e_typecheck);
+ oproc = real_opproc(defp);
+ for (opx = 0; opx <= UPATH_MAX_OP; opx++)
+ if (oproc == up_ops[opx])
+ break;
+ if (opx > UPATH_MAX_OP)
+ return_error(e_typecheck);
+ data = up_data[opx];
+ if (argcount != data.num_args)
+ return_error(e_typecheck);
+ if (upath_compat && opx == upath_op_ucache) {
+ /* CPSI does not complain about incorrect ucache
+ placement, even though PLRM3 says it's illegal. */
+ ups = ups > UPS_UCACHE ? ups : data.state_after;
+ } else {
+ if (!(ups & data.states_before))
+ return_error(e_typecheck);
+ ups = data.state_after;
+ }
+ code = (*up_ops[opx])(i_ctx_p);
+ if (code < 0) {
+ if (code == e_nocurrentpoint)
return_error(e_rangecheck); /* CET 11-22 */
return code;
- }
+ }
argcount = 0;
- break;
- default:
- return_error(e_typecheck);
- }
- }
- if (argcount) {
- *pnargs = argcount;
- return_error(e_typecheck); /* leftover args */
- }
+ break;
+ default:
+ return_error(e_typecheck);
+ }
+ }
+ if (argcount) {
+ *pnargs = argcount;
+ return_error(e_typecheck); /* leftover args */
+ }
}
if (ups < UPS_SETBBOX)
- return_error(e_typecheck); /* no setbbox */
+ return_error(e_typecheck); /* no setbbox */
if (ups == UPS_SETBBOX && upath_compat) {
- /*
- * In CPSI compatibility mode, an empty path with a setbbox also
- * does a moveto (but only if the path is empty). Since setbbox
- * was the last operator, its operands are still on the o-stack.
- */
- osp += 2;
- return zmoveto(i_ctx_p);
+ /*
+ * In CPSI compatibility mode, an empty path with a setbbox also
+ * does a moveto (but only if the path is empty). Since setbbox
+ * was the last operator, its operands are still on the o-stack.
+ */
+ osp += 2;
+ return zmoveto(i_ctx_p);
}
return 0;
}
@@ -833,9 +831,9 @@ upath_append(os_ptr oppath, i_ctx_t *i_ctx_p, bool upath_compat)
int code = upath_append_aux(oppath, i_ctx_p, &nargs, upath_compat);
if (code < 0) {
- /* Pop args on error, to match Adobe interpreters. */
- pop(nargs);
- return code;
+ /* Pop args on error, to match Adobe interpreters. */
+ pop(nargs);
+ return code;
}
return 0;
}
@@ -850,18 +848,18 @@ upath_stroke(i_ctx_t *i_ctx_p, gs_matrix *pmat, bool upath_compat)
gs_matrix mat;
if ((code = read_matrix(imemory, op, &mat)) >= 0) {
- if ((code = upath_append(op - 1, i_ctx_p, upath_compat)) >= 0) {
- if (pmat)
- *pmat = mat;
- else
- code = gs_concat(igs, &mat);
- }
- npop = 2;
+ if ((code = upath_append(op - 1, i_ctx_p, upath_compat)) >= 0) {
+ if (pmat)
+ *pmat = mat;
+ else
+ code = gs_concat(igs, &mat);
+ }
+ npop = 2;
} else {
- if ((code = upath_append(op, i_ctx_p, upath_compat)) >= 0)
- if (pmat)
- gs_make_identity(pmat);
- npop = 1;
+ if ((code = upath_append(op, i_ctx_p, upath_compat)) >= 0)
+ if (pmat)
+ gs_make_identity(pmat);
+ npop = 1;
}
return (code < 0 ? code : npop);
}
@@ -871,14 +869,14 @@ upath_stroke(i_ctx_t *i_ctx_p, gs_matrix *pmat, bool upath_compat)
const op_def zupath_l2_op_defs[] =
{
op_def_begin_level2(),
- /* Insideness testing */
+ /* Insideness testing */
{"1ineofill", zineofill},
{"1infill", zinfill},
{"1instroke", zinstroke},
{"2inueofill", zinueofill},
{"2inufill", zinufill},
{"2inustroke", zinustroke},
- /* User paths */
+ /* User paths */
{"1uappend", zuappend},
{"0ucache", zucache},
{"1ueofill", zueofill},
@@ -886,7 +884,7 @@ const op_def zupath_l2_op_defs[] =
{"1upath", zupath},
{"1ustroke", zustroke},
{"1ustrokepath", zustrokepath},
- /* Path access for PDF */
+ /* Path access for PDF */
{"0.getpath", zgetpath},
op_def_end(0)
};
diff --git a/gs/psi/zusparam.c b/gs/psi/zusparam.c
index 9680a4cf2..ffc82aa80 100644
--- a/gs/psi/zusparam.c
+++ b/gs/psi/zusparam.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -42,7 +42,6 @@
#include "gx.h"
#include "gxistate.h"
-
/* The (global) font directory */
extern gs_font_dir *ifont_dir; /* in zfont.c */
@@ -112,17 +111,17 @@ zcheckpassword(i_ctx_t *i_ctx_p)
password pass;
if (code < 0)
- return code;
+ return code;
params[1] = *op;
array_param_list_read(&list, params, 2, NULL, false, iimemory);
if (dict_read_password(&pass, systemdict, "StartJobPassword") >= 0 &&
- param_check_password(plist, &pass) == 0
- )
- result = 1;
+ param_check_password(plist, &pass) == 0
+ )
+ result = 1;
if (dict_read_password(&pass, systemdict, "SystemParamsPassword") >= 0 &&
- param_check_password(plist, &pass) == 0
- )
- result = 2;
+ param_check_password(plist, &pass) == 0
+ )
+ result = 2;
iparam_list_release(&list);
make_int(op, result);
return 0;
@@ -151,8 +150,8 @@ static int
set_MaxFontCache(i_ctx_t *i_ctx_p, long val)
{
return gs_setcachesize(igs, ifont_dir,
- (uint)(val < 0 ? 0 : val > max_uint ? max_uint :
- val));
+ (uint)(val < 0 ? 0 : val > max_uint ? max_uint :
+ val));
}
static long
current_CurFontCache(i_ctx_t *i_ctx_p)
@@ -221,8 +220,6 @@ current_RealFormat(i_ctx_t *i_ctx_p, gs_param_string * pval)
pval->persistent = true;
}
-
-
static const string_param_def_t system_string_params[] =
{
{"RealFormat", current_RealFormat, NULL},
@@ -249,48 +246,48 @@ zsetsystemparams(i_ctx_t *i_ctx_p)
check_type(*op, t_dictionary);
code = dict_param_list_read(&list, op, NULL, false, iimemory);
if (code < 0)
- return code;
+ return code;
code = dict_read_password(&pass, systemdict, "SystemParamsPassword");
if (code < 0)
- return code;
+ return code;
code = param_check_password(plist, &pass);
if (code != 0) {
- if (code > 0)
- code = gs_note_error(e_invalidaccess);
- goto out;
+ if (code > 0)
+ code = gs_note_error(e_invalidaccess);
+ goto out;
}
code = param_read_password(plist, "StartJobPassword", &pass);
switch (code) {
- default: /* invalid */
- goto out;
- case 1: /* missing */
- break;
- case 0:
- code = dict_write_password(&pass, systemdict,
- "StartJobPassword",
- ! i_ctx_p->LockFilePermissions);
- if (code < 0)
- goto out;
+ default: /* invalid */
+ goto out;
+ case 1: /* missing */
+ break;
+ case 0:
+ code = dict_write_password(&pass, systemdict,
+ "StartJobPassword",
+ ! i_ctx_p->LockFilePermissions);
+ if (code < 0)
+ goto out;
}
code = param_read_password(plist, "SystemParamsPassword", &pass);
switch (code) {
- default: /* invalid */
- goto out;
- case 1: /* missing */
- break;
- case 0:
- code = dict_write_password(&pass, systemdict,
- "SystemParamsPassword",
- ! i_ctx_p->LockFilePermissions);
- if (code < 0)
- goto out;
+ default: /* invalid */
+ goto out;
+ case 1: /* missing */
+ break;
+ case 0:
+ code = dict_write_password(&pass, systemdict,
+ "SystemParamsPassword",
+ ! i_ctx_p->LockFilePermissions);
+ if (code < 0)
+ goto out;
}
code = setparams(i_ctx_p, plist, &system_param_set);
out:
iparam_list_release(&list);
if (code < 0)
- return code;
+ return code;
pop(1);
return 0;
}
@@ -453,7 +450,6 @@ set_GridFitTT(i_ctx_t *i_ctx_p, long val)
#undef ifont_dir
-
/* No default for the proofing profile. It would
seem that I should be able to set the default
operator to NULL but this introduces issues */
@@ -465,8 +461,8 @@ current_proof_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)((pis->icc_manager->proof_profile == NULL) ?
- rfs :
- pis->icc_manager->proof_profile->name);
+ rfs :
+ pis->icc_manager->proof_profile->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -478,12 +474,12 @@ set_proof_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char *pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
/* Check if it was "NULL" */
if ( pval->size != 0 ) {
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_proof_profile_icc");
+ "set_proof_profile_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
code = gsicc_set_profile(pis->icc_manager, (const char*) pname, namelen, PROOF_TYPE);
@@ -507,7 +503,7 @@ current_devicen_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
/*FIXME: This should return the entire list !!! */
/* Just return the first one for now */
pval->data = (const byte *)( (pis->icc_manager->device_n == NULL) ?
- rfs : pis->icc_manager->device_n->head->iccprofile->name);
+ rfs : pis->icc_manager->device_n->head->iccprofile->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -519,18 +515,18 @@ set_devicen_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char *pname, *pstr, *pstrend;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
/* Check if it was "NULL" */
if (pval->size != 0) {
- /* The DeviceN name can have multiple files
- in it. This way we can define all the
+ /* The DeviceN name can have multiple files
+ in it. This way we can define all the
DeviceN color spaces with ICC profiles.
- divide using , and ; delimeters as well as
+ divide using , and ; delimeters as well as
remove leading and ending spaces (file names
can have internal spaces). */
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_devicen_profile_icc");
+ "set_devicen_profile_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
pstr = strtok(pname, ",;");
@@ -566,7 +562,7 @@ current_default_gray_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->default_gray == NULL) ?
- rfs : pis->icc_manager->default_gray->name);
+ rfs : pis->icc_manager->default_gray->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -581,17 +577,17 @@ set_default_gray_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
gs_memory_t *mem = pis->memory;
bool not_initialized;
- /* Detect if this is our first time in here. If so, then we need to
+ /* Detect if this is our first time in here. If so, then we need to
reset up the default gray color spaces that are in the graphic state
to be ICC based. It was not possible to do it until after we get
the profile */
not_initialized = (pis->icc_manager->default_gray == NULL);
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_default_gray_icc");
+ "set_default_gray_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, DEFAULT_GRAY);
gs_free_object(mem, pname,
"set_default_gray_icc");
@@ -614,7 +610,7 @@ current_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->profiledir == NULL) ?
- rfs : pis->icc_manager->profiledir);
+ rfs : pis->icc_manager->profiledir);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -629,7 +625,7 @@ set_icc_directory(i_ctx_t *i_ctx_p, gs_param_string * pval)
/* Check if it was "NULL" */
if (pval->size != 0 ) {
pname = (char *)gs_alloc_bytes(pis->icc_manager->memory, namelen,
- "set_icc_directory");
+ "set_icc_directory");
if (pname == NULL)
return gs_rethrow(-1, "cannot allocate directory name");
memcpy(pname,pval->data,namelen-1);
@@ -649,7 +645,7 @@ current_default_rgb_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->default_rgb == NULL) ?
- rfs : pis->icc_manager->default_rgb->name);
+ rfs : pis->icc_manager->default_rgb->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -661,13 +657,13 @@ set_default_rgb_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char *pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_default_rgb_icc");
+ "set_default_rgb_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, DEFAULT_RGB);
gs_free_object(mem, pname,
"set_default_rgb_icc");
@@ -683,7 +679,7 @@ current_link_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->output_link == NULL) ?
- rfs : pis->icc_manager->output_link->name);
+ rfs : pis->icc_manager->output_link->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -695,15 +691,15 @@ set_link_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char* pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
/* Check if it was "NULL" */
if (pval->size != 0) {
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_link_profile_icc");
+ "set_link_profile_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, LINKED_TYPE);
gs_free_object(mem, pname,
"set_link_profile_icc");
@@ -721,7 +717,7 @@ current_named_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->device_named == NULL) ?
- rfs : pis->icc_manager->device_named->name);
+ rfs : pis->icc_manager->device_named->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -733,15 +729,15 @@ set_named_profile_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char* pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
/* Check if it was "NULL" */
if (pval->size != 0) {
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_named_profile_icc");
+ "set_named_profile_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, NAMED_TYPE);
gs_free_object(mem, pname,
"set_named_profile_icc");
@@ -759,7 +755,7 @@ current_default_cmyk_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->default_cmyk == NULL) ?
- rfs : pis->icc_manager->default_cmyk->name);
+ rfs : pis->icc_manager->default_cmyk->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -771,13 +767,13 @@ set_default_cmyk_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char* pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_default_cmyk_icc");
+ "set_default_cmyk_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, DEFAULT_CMYK);
gs_free_object(mem, pname,
"set_default_cmyk_icc");
@@ -793,7 +789,7 @@ current_lab_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
const gs_imager_state * pis = (gs_imager_state *) igs;
pval->data = (const byte *)( (pis->icc_manager->lab_profile == NULL) ?
- rfs : pis->icc_manager->lab_profile->name);
+ rfs : pis->icc_manager->lab_profile->name);
pval->size = strlen((const char *)pval->data);
pval->persistent = true;
}
@@ -805,13 +801,13 @@ set_lab_icc(i_ctx_t *i_ctx_p, gs_param_string * pval)
char* pname;
int namelen = (pval->size)+1;
const gs_imager_state * pis = (gs_imager_state *) igs;
- gs_memory_t *mem = pis->memory;
+ gs_memory_t *mem = pis->memory;
pname = (char *)gs_alloc_bytes(mem, namelen,
- "set_lab_icc");
+ "set_lab_icc");
memcpy(pname,pval->data,namelen-1);
pname[namelen-1] = 0;
- code = gsicc_set_profile(pis->icc_manager,
+ code = gsicc_set_profile(pis->icc_manager,
(const char*) pname, namelen, LAB_TYPE);
gs_free_object(mem, pname,
"set_lab_icc");
@@ -847,21 +843,21 @@ static const long_param_def_t user_long_params[] =
current_MinScreenLevels, set_MinScreenLevels},
{"AlignToPixels", 0, 1,
current_AlignToPixels, set_AlignToPixels},
- {"GridFitTT", 0, 3,
+ {"GridFitTT", 0, 3,
current_GridFitTT, set_GridFitTT}
};
-/* Note that string objects that are maintained as user params must be
+/* Note that string objects that are maintained as user params must be
either allocated in non-gc memory or be a constant in the executable.
The problem stems from the way userparams are retained during garbage
collection in a param_list (collected by currentuserparams). For
- some reason this param_list does not get the pointers to strings relocated
- during the GC. Note that the param_dict itself is correctly updated by reloc,
- it is just the pointers to the strings in the param_list that are not traced
- and updated. An example of this includes the ICCProfilesDir, which sets a
- string in the icc_manager. When a reclaim occurs, the string is relocated
- (when in non-gc memory and when it is noted to the gc with the proper object
- descriptor). Then if a set_icc_directory occurs, the user params pointer has
+ some reason this param_list does not get the pointers to strings relocated
+ during the GC. Note that the param_dict itself is correctly updated by reloc,
+ it is just the pointers to the strings in the param_list that are not traced
+ and updated. An example of this includes the ICCProfilesDir, which sets a
+ string in the icc_manager. When a reclaim occurs, the string is relocated
+ (when in non-gc memory and when it is noted to the gc with the proper object
+ descriptor). Then if a set_icc_directory occurs, the user params pointer has
NOT been updated and validation problems will occur. */
static const string_param_def_t user_string_params[] =
{
@@ -871,9 +867,9 @@ static const string_param_def_t user_string_params[] =
{"ProofProfile", current_proof_icc, set_proof_profile_icc},
{"NamedProfile", current_named_icc, set_named_profile_icc},
{"DeviceLinkProfile", current_link_icc, set_link_profile_icc},
- {"ICCProfilesDir", current_icc_directory, set_icc_directory},
+ {"ICCProfilesDir", current_icc_directory, set_icc_directory},
{"LabProfile", current_lab_icc, set_lab_icc},
- {"DeviceNProfile", current_devicen_icc, set_devicen_profile_icc}
+ {"DeviceNProfile", current_devicen_icc, set_devicen_profile_icc}
};
@@ -911,7 +907,7 @@ set_LockFilePermissions(i_ctx_t *i_ctx_p, bool val)
{
/* allow locking even if already locked */
if (i_ctx_p->LockFilePermissions && !val)
- return_error(e_invalidaccess);
+ return_error(e_invalidaccess);
i_ctx_p->LockFilePermissions = val;
return 0;
}
@@ -953,7 +949,7 @@ set_user_params(i_ctx_t *i_ctx_p, const ref *paramdict)
check_type(*paramdict, t_dictionary);
code = dict_param_list_read(&list, paramdict, NULL, false, iimemory);
if (code < 0)
- return code;
+ return code;
code = setparams(i_ctx_p, (gs_param_list *)&list, &user_param_set);
iparam_list_release(&list);
return code;
@@ -965,10 +961,10 @@ zsetuserparams(i_ctx_t *i_ctx_p)
int code = set_user_params(i_ctx_p, op);
if (code >= 0) {
- /* Update cached scanner options. */
- i_ctx_p->scanner_options =
- ztoken_scanner_options(op, i_ctx_p->scanner_options);
- pop(1);
+ /* Update cached scanner options. */
+ i_ctx_p->scanner_options =
+ ztoken_scanner_options(op, i_ctx_p->scanner_options);
+ pop(1);
}
return code;
}
@@ -991,15 +987,15 @@ zgetuserparam(i_ctx_t *i_ctx_p)
const op_def zusparam_op_defs[] =
{
- /* User and system parameters are accessible even in Level 1 */
- /* (if this is a Level 2 system). */
+ /* User and system parameters are accessible even in Level 1 */
+ /* (if this is a Level 2 system). */
{"0.currentsystemparams", zcurrentsystemparams},
{"0.currentuserparams", zcurrentuserparams},
{"1.getsystemparam", zgetsystemparam},
{"1.getuserparam", zgetuserparam},
{"1.setsystemparams", zsetsystemparams},
{"1.setuserparams", zsetuserparams},
- /* The rest of the operators are defined only in Level 2. */
+ /* The rest of the operators are defined only in Level 2. */
op_def_begin_level2(),
{"1.checkpassword", zcheckpassword},
op_def_end(0)
@@ -1016,55 +1012,55 @@ setparams(i_ctx_t *i_ctx_p, gs_param_list * plist, const param_set * pset)
unsigned int i;
for (i = 0; i < pset->long_count; i++) {
- const long_param_def_t *pdef = &pset->long_defs[i];
- long val;
-
- if (pdef->set == NULL)
- continue;
- code = param_read_long(plist, pdef->pname, &val);
- switch (code) {
- default: /* invalid */
- return code;
- case 1: /* missing */
- break;
- case 0:
- if (val < pdef->min_value || val > pdef->max_value)
- return_error(e_rangecheck);
- code = (*pdef->set)(i_ctx_p, val);
- if (code < 0)
- return code;
- }
+ const long_param_def_t *pdef = &pset->long_defs[i];
+ long val;
+
+ if (pdef->set == NULL)
+ continue;
+ code = param_read_long(plist, pdef->pname, &val);
+ switch (code) {
+ default: /* invalid */
+ return code;
+ case 1: /* missing */
+ break;
+ case 0:
+ if (val < pdef->min_value || val > pdef->max_value)
+ return_error(e_rangecheck);
+ code = (*pdef->set)(i_ctx_p, val);
+ if (code < 0)
+ return code;
+ }
}
for (i = 0; i < pset->bool_count; i++) {
- const bool_param_def_t *pdef = &pset->bool_defs[i];
- bool val;
-
- if (pdef->set == NULL)
- continue;
- code = param_read_bool(plist, pdef->pname, &val);
- if (code == 0)
- code = (*pdef->set)(i_ctx_p, val);
- if (code < 0)
- return code;
+ const bool_param_def_t *pdef = &pset->bool_defs[i];
+ bool val;
+
+ if (pdef->set == NULL)
+ continue;
+ code = param_read_bool(plist, pdef->pname, &val);
+ if (code == 0)
+ code = (*pdef->set)(i_ctx_p, val);
+ if (code < 0)
+ return code;
}
for (i = 0; i < pset->string_count; i++) {
- const string_param_def_t *pdef = &pset->string_defs[i];
- gs_param_string val;
-
- if (pdef->set == NULL)
- continue;
- code = param_read_string(plist, pdef->pname, &val);
- switch (code) {
- default: /* invalid */
- return code;
- case 1: /* missing */
- break;
- case 0:
- code = (*pdef->set)(i_ctx_p, &val);
- if (code < 0)
- return code;
- }
+ const string_param_def_t *pdef = &pset->string_defs[i];
+ gs_param_string val;
+
+ if (pdef->set == NULL)
+ continue;
+ code = param_read_string(plist, pdef->pname, &val);
+ switch (code) {
+ default: /* invalid */
+ return code;
+ case 1: /* missing */
+ break;
+ case 0:
+ code = (*pdef->set)(i_ctx_p, &val);
+ if (code < 0)
+ return code;
+ }
}
return 0;
@@ -1075,13 +1071,13 @@ static bool
pname_matches(const char *pname, const ref * psref)
{
return
- (psref == 0 ||
- !bytes_compare((const byte *)pname, strlen(pname),
- psref->value.const_bytes, r_size(psref)));
+ (psref == 0 ||
+ !bytes_compare((const byte *)pname, strlen(pname),
+ psref->value.const_bytes, r_size(psref)));
}
static int
current_param_list(i_ctx_t *i_ctx_p, const param_set * pset,
- const ref * psref /*t_string */ )
+ const ref * psref /*t_string */ )
{
stack_param_list list;
gs_param_list *const plist = (gs_param_list *)&list;
@@ -1090,62 +1086,62 @@ current_param_list(i_ctx_t *i_ctx_p, const param_set * pset,
stack_param_list_write(&list, &o_stack, NULL, iimemory);
for (i = 0; i < pset->long_count; i++) {
- const char *pname = pset->long_defs[i].pname;
+ const char *pname = pset->long_defs[i].pname;
- if (pname_matches(pname, psref)) {
- long val = (*pset->long_defs[i].current)(i_ctx_p);
+ if (pname_matches(pname, psref)) {
+ long val = (*pset->long_defs[i].current)(i_ctx_p);
- code = param_write_long(plist, pname, &val);
- if (code < 0)
- return code;
- }
+ code = param_write_long(plist, pname, &val);
+ if (code < 0)
+ return code;
+ }
}
for (i = 0; i < pset->bool_count; i++) {
- const char *pname = pset->bool_defs[i].pname;
+ const char *pname = pset->bool_defs[i].pname;
- if (pname_matches(pname, psref)) {
- bool val = (*pset->bool_defs[i].current)(i_ctx_p);
+ if (pname_matches(pname, psref)) {
+ bool val = (*pset->bool_defs[i].current)(i_ctx_p);
- code = param_write_bool(plist, pname, &val);
- if (code < 0)
- return code;
- }
+ code = param_write_bool(plist, pname, &val);
+ if (code < 0)
+ return code;
+ }
}
for (i = 0; i < pset->string_count; i++) {
- const char *pname = pset->string_defs[i].pname;
+ const char *pname = pset->string_defs[i].pname;
- if (pname_matches(pname, psref)) {
- gs_param_string val;
+ if (pname_matches(pname, psref)) {
+ gs_param_string val;
- (*pset->string_defs[i].current)(i_ctx_p, &val);
- code = param_write_string(plist, pname, &val);
- if (code < 0)
- return code;
- }
+ (*pset->string_defs[i].current)(i_ctx_p, &val);
+ code = param_write_string(plist, pname, &val);
+ if (code < 0)
+ return code;
+ }
}
if (psref) {
- /*
- * Scanner options can be read, but only individually by .getuserparam.
- * This avoids putting them into userparams, and being affected by save/restore.
- */
- const char *pname;
- bool val;
- int code;
-
- switch (ztoken_get_scanner_option(psref, i_ctx_p->scanner_options, &pname)) {
- case 0:
- code = param_write_null(plist, pname);
- break;
- case 1:
- val = true;
- code = param_write_bool(plist, pname, &val);
- break;
- default:
- code = 0;
- break;
- }
- if (code < 0)
- return code;
+ /*
+ * Scanner options can be read, but only individually by .getuserparam.
+ * This avoids putting them into userparams, and being affected by save/restore.
+ */
+ const char *pname;
+ bool val;
+ int code;
+
+ switch (ztoken_get_scanner_option(psref, i_ctx_p->scanner_options, &pname)) {
+ case 0:
+ code = param_write_null(plist, pname);
+ break;
+ case 1:
+ val = true;
+ code = param_write_bool(plist, pname, &val);
+ break;
+ default:
+ code = 0;
+ break;
+ }
+ if (code < 0)
+ return code;
}
return code;
}
@@ -1170,9 +1166,9 @@ currentparam1(i_ctx_t *i_ctx_p, const param_set * pset)
name_string_ref(imemory, (const ref *)op, &sref);
code = current_param_list(i_ctx_p, pset, &sref);
if (code < 0)
- return code;
+ return code;
if (osp == op)
- return_error(e_undefined);
+ return_error(e_undefined);
/* We know osp == op + 2. */
ref_assign(op, op + 2);
pop(2);
diff --git a/gs/psi/zutf8.c b/gs/psi/zutf8.c
index b31326b55..d61b68bc3 100644
--- a/gs/psi/zutf8.c
+++ b/gs/psi/zutf8.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -39,34 +39,34 @@ zlocale_to_utf8(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
input = ref_to_string(op, imemory, "locale_to_utf8 input");
if (input == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
output = stringprep_locale_to_utf8(input);
ifree_string((byte *)input, r_size(op) + 1, "locale_to_utf8 input");
if (output == 0) {
- /* This function is intended to be used on strings whose
- * character set is unknown, so it's not an error if the
- * input contains invalid characters. Just return the input
- * string unchanged.
- *
- * Sadly, EINVAL from stringprep_locale_to_utf8 can mean
- * either an invalid character set conversion (which we care
- * about), or an incomplete input string (which we don't).
- * For now, we ignore EINVAL; the right solution is probably
- * to not use stringprep_locale_to_utf8, and just call iconv
- * by hand. */
- if (errno == EILSEQ || errno == EINVAL)
- return 0;
+ /* This function is intended to be used on strings whose
+ * character set is unknown, so it's not an error if the
+ * input contains invalid characters. Just return the input
+ * string unchanged.
+ *
+ * Sadly, EINVAL from stringprep_locale_to_utf8 can mean
+ * either an invalid character set conversion (which we care
+ * about), or an incomplete input string (which we don't).
+ * For now, we ignore EINVAL; the right solution is probably
+ * to not use stringprep_locale_to_utf8, and just call iconv
+ * by hand. */
+ if (errno == EILSEQ || errno == EINVAL)
+ return 0;
- /* Other errors (like ENFILE) are real errors, which we
- * want to return to the user. */
- return_error(e_ioerror);
+ /* Other errors (like ENFILE) are real errors, which we
+ * want to return to the user. */
+ return_error(e_ioerror);
}
code = string_to_ref(output, op, iimemory, "locale_to_utf8 output");
free(output);
if (code < 0)
- return code;
+ return code;
return 0;
}
diff --git a/gs/psi/zvmem.c b/gs/psi/zvmem.c
index ac71af50d..a5c6b1255 100644
--- a/gs/psi/zvmem.c
+++ b/gs/psi/zvmem.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,17 +43,17 @@ struct vm_save_s {
};
gs_private_st_ptrs1(st_vm_save, vm_save_t, "savetype",
- vm_save_enum_ptrs, vm_save_reloc_ptrs, gsave);
+ vm_save_enum_ptrs, vm_save_reloc_ptrs, gsave);
/* Clean up the stacks and validate storage. */
static void
ivalidate_clean_spaces(i_ctx_t *i_ctx_p)
{
if (gs_debug_c('?')) {
- ref_stack_cleanup(&d_stack);
- ref_stack_cleanup(&e_stack);
- ref_stack_cleanup(&o_stack);
- ivalidate_spaces();
+ ref_stack_cleanup(&d_stack);
+ ref_stack_cleanup(&e_stack);
+ ref_stack_cleanup(&o_stack);
+ ivalidate_spaces();
}
}
@@ -69,32 +69,32 @@ zsave(i_ctx_t *i_ctx_p)
gs_state *prev;
if (I_VALIDATE_BEFORE_SAVE)
- ivalidate_clean_spaces(i_ctx_p);
+ ivalidate_clean_spaces(i_ctx_p);
ialloc_set_space(idmemory, avm_local);
vmsave = ialloc_struct(vm_save_t, &st_vm_save, "zsave");
ialloc_set_space(idmemory, space);
if (vmsave == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
code = alloc_save_state(idmemory, vmsave, &sid);
if (code < 0)
- return code;
+ return code;
if (sid == 0) {
- ifree_object(vmsave, "zsave");
- return_error(e_VMerror);
+ ifree_object(vmsave, "zsave");
+ return_error(e_VMerror);
}
if_debug2('u', "[u]vmsave 0x%lx, id = %lu\n",
- (ulong) vmsave, (ulong) sid);
+ (ulong) vmsave, (ulong) sid);
code = gs_gsave_for_save(igs, &prev);
if (code < 0)
- return code;
+ return code;
code = gs_gsave(igs);
if (code < 0)
- return code;
+ return code;
vmsave->gsave = prev;
push(1);
make_tav(op, t_save, 0, saveid, sid);
if (I_VALIDATE_AFTER_SAVE)
- ivalidate_clean_spaces(i_ctx_p);
+ ivalidate_clean_spaces(i_ctx_p);
return 0;
}
@@ -112,24 +112,24 @@ zrestore(i_ctx_t *i_ctx_p)
int code = restore_check_operand(op, &asave, idmemory);
if (code < 0)
- return code;
+ return code;
if_debug2('u', "[u]vmrestore 0x%lx, id = %lu\n",
- (ulong) alloc_save_client_data(asave),
- (ulong) op->value.saveid);
+ (ulong) alloc_save_client_data(asave),
+ (ulong) op->value.saveid);
if (I_VALIDATE_BEFORE_RESTORE)
- ivalidate_clean_spaces(i_ctx_p);
+ ivalidate_clean_spaces(i_ctx_p);
/* Check the contents of the stacks. */
osp--;
{
- int code;
+ int code;
- if ((code = restore_check_stack(i_ctx_p, &o_stack, asave, false)) < 0 ||
- (code = restore_check_stack(i_ctx_p, &e_stack, asave, true)) < 0 ||
- (code = restore_check_stack(i_ctx_p, &d_stack, asave, false)) < 0
- ) {
- osp++;
- return code;
- }
+ if ((code = restore_check_stack(i_ctx_p, &o_stack, asave, false)) < 0 ||
+ (code = restore_check_stack(i_ctx_p, &e_stack, asave, true)) < 0 ||
+ (code = restore_check_stack(i_ctx_p, &d_stack, asave, false)) < 0
+ ) {
+ osp++;
+ return code;
+ }
}
/* Reset l_new in all stack entries if the new save level is zero. */
/* Also do some special fixing on the e-stack. */
@@ -139,35 +139,35 @@ zrestore(i_ctx_t *i_ctx_p)
/* Iteratively restore the state of memory, */
/* also doing a grestoreall at each step. */
do {
- vmsave = alloc_save_client_data(alloc_save_current(idmemory));
- /* Restore the graphics state. */
- gs_grestoreall_for_restore(igs, vmsave->gsave);
- /*
- * If alloc_save_space decided to do a second save, the vmsave
- * object was allocated one save level less deep than the
- * current level, so ifree_object won't actually free it;
- * however, it points to a gsave object that definitely
- * *has* been freed. In order not to trip up the garbage
- * collector, we clear the gsave pointer now.
- */
- vmsave->gsave = 0;
- /* Now it's safe to restore the state of memory. */
- code = alloc_restore_step_in(idmemory, asave);
- if (code < 0)
- return code;
- last = code;
+ vmsave = alloc_save_client_data(alloc_save_current(idmemory));
+ /* Restore the graphics state. */
+ gs_grestoreall_for_restore(igs, vmsave->gsave);
+ /*
+ * If alloc_save_space decided to do a second save, the vmsave
+ * object was allocated one save level less deep than the
+ * current level, so ifree_object won't actually free it;
+ * however, it points to a gsave object that definitely
+ * *has* been freed. In order not to trip up the garbage
+ * collector, we clear the gsave pointer now.
+ */
+ vmsave->gsave = 0;
+ /* Now it's safe to restore the state of memory. */
+ code = alloc_restore_step_in(idmemory, asave);
+ if (code < 0)
+ return code;
+ last = code;
}
while (!last);
{
- uint space = icurrent_space;
+ uint space = icurrent_space;
- ialloc_set_space(idmemory, avm_local);
- ifree_object(vmsave, "zrestore");
- ialloc_set_space(idmemory, space);
+ ialloc_set_space(idmemory, avm_local);
+ ifree_object(vmsave, "zrestore");
+ ialloc_set_space(idmemory, space);
}
dict_set_top(); /* reload dict stack cache */
if (I_VALIDATE_AFTER_RESTORE)
- ivalidate_clean_spaces(i_ctx_p);
+ ivalidate_clean_spaces(i_ctx_p);
/* If the i_ctx_p LockFilePermissions is true, but the userparams */
/* we just restored is false, we need to make sure that we do not */
/* cause an 'invalidaccess' in setuserparams. Temporarily set */
@@ -179,7 +179,7 @@ zrestore(i_ctx_t *i_ctx_p)
/* Check the operand of a restore. */
static int
restore_check_operand(os_ptr op, alloc_save_t ** pasave,
- gs_dual_memory_t *idmem)
+ gs_dual_memory_t *idmem)
{
vm_save_t *vmsave;
ulong sid;
@@ -188,110 +188,110 @@ restore_check_operand(os_ptr op, alloc_save_t ** pasave,
check_type(*op, t_save);
vmsave = r_ptr(op, vm_save_t);
if (vmsave == 0) /* invalidated save */
- return_error(e_invalidrestore);
+ return_error(e_invalidrestore);
sid = op->value.saveid;
asave = alloc_find_save(idmem, sid);
if (asave == 0)
- return_error(e_invalidrestore);
+ return_error(e_invalidrestore);
*pasave = asave;
return 0;
}
/* Check a stack to make sure all its elements are older than a save. */
static int
restore_check_stack(const i_ctx_t *i_ctx_p, const ref_stack_t * pstack,
- const alloc_save_t * asave, bool is_estack)
+ const alloc_save_t * asave, bool is_estack)
{
ref_stack_enum_t rsenum;
ref_stack_enum_begin(&rsenum, pstack);
do {
- const ref *stkp = rsenum.ptr;
- uint size = rsenum.size;
+ const ref *stkp = rsenum.ptr;
+ uint size = rsenum.size;
- for (; size; stkp++, size--) {
- const void *ptr;
+ for (; size; stkp++, size--) {
+ const void *ptr;
- switch (r_type(stkp)) {
- case t_array:
- /*
- * Zero-length arrays are a special case: see the
- * t_*array case (label rr:) in igc.c:gc_trace.
- */
- if (r_size(stkp) == 0) {
- /*stkp->value.refs = (void *)0;*/
- continue;
- }
- ptr = stkp->value.refs;
- break;
- case t_dictionary:
- ptr = stkp->value.pdict;
- break;
- case t_file:
- /* Don't check executable or closed literal */
- /* files on the e-stack. */
- {
- stream *s;
+ switch (r_type(stkp)) {
+ case t_array:
+ /*
+ * Zero-length arrays are a special case: see the
+ * t_*array case (label rr:) in igc.c:gc_trace.
+ */
+ if (r_size(stkp) == 0) {
+ /*stkp->value.refs = (void *)0;*/
+ continue;
+ }
+ ptr = stkp->value.refs;
+ break;
+ case t_dictionary:
+ ptr = stkp->value.pdict;
+ break;
+ case t_file:
+ /* Don't check executable or closed literal */
+ /* files on the e-stack. */
+ {
+ stream *s;
- if (is_estack &&
- (r_has_attr(stkp, a_executable) ||
- file_is_invalid(s, stkp))
- )
- continue;
- }
- ptr = stkp->value.pfile;
- break;
- case t_name:
- /* Names are special because of how they are allocated. */
- if (alloc_name_is_since_save((const gs_memory_t *)pstack->memory,
- stkp, asave))
- return_error(e_invalidrestore);
- continue;
- case t_string:
- /* Don't check empty executable strings */
- /* on the e-stack. */
- if (r_size(stkp) == 0 &&
- r_has_attr(stkp, a_executable) && is_estack
- )
- continue;
- ptr = stkp->value.bytes;
- break;
- case t_mixedarray:
- case t_shortarray:
- /* See the t_array case above. */
- if (r_size(stkp) == 0) {
- /*stkp->value.packed = (void *)0;*/
- continue;
- }
- ptr = stkp->value.packed;
- break;
- case t_device:
- ptr = stkp->value.pdevice;
- break;
- case t_fontID:
- case t_struct:
- case t_astruct:
- ptr = stkp->value.pstruct;
- break;
- case t_save:
- /* See the comment in isave.h regarding the following. */
- if (i_ctx_p->language_level <= 2)
- continue;
- ptr = alloc_find_save(&gs_imemory, stkp->value.saveid);
- /*
- * Invalid save objects aren't supposed to be possible
- * in LL3, but just in case....
- */
- if (ptr == 0)
- return_error(e_invalidrestore);
- if (ptr == asave)
- continue;
- break;
- default:
- continue;
- }
- if (alloc_is_since_save(ptr, asave))
- return_error(e_invalidrestore);
- }
+ if (is_estack &&
+ (r_has_attr(stkp, a_executable) ||
+ file_is_invalid(s, stkp))
+ )
+ continue;
+ }
+ ptr = stkp->value.pfile;
+ break;
+ case t_name:
+ /* Names are special because of how they are allocated. */
+ if (alloc_name_is_since_save((const gs_memory_t *)pstack->memory,
+ stkp, asave))
+ return_error(e_invalidrestore);
+ continue;
+ case t_string:
+ /* Don't check empty executable strings */
+ /* on the e-stack. */
+ if (r_size(stkp) == 0 &&
+ r_has_attr(stkp, a_executable) && is_estack
+ )
+ continue;
+ ptr = stkp->value.bytes;
+ break;
+ case t_mixedarray:
+ case t_shortarray:
+ /* See the t_array case above. */
+ if (r_size(stkp) == 0) {
+ /*stkp->value.packed = (void *)0;*/
+ continue;
+ }
+ ptr = stkp->value.packed;
+ break;
+ case t_device:
+ ptr = stkp->value.pdevice;
+ break;
+ case t_fontID:
+ case t_struct:
+ case t_astruct:
+ ptr = stkp->value.pstruct;
+ break;
+ case t_save:
+ /* See the comment in isave.h regarding the following. */
+ if (i_ctx_p->language_level <= 2)
+ continue;
+ ptr = alloc_find_save(&gs_imemory, stkp->value.saveid);
+ /*
+ * Invalid save objects aren't supposed to be possible
+ * in LL3, but just in case....
+ */
+ if (ptr == 0)
+ return_error(e_invalidrestore);
+ if (ptr == asave)
+ continue;
+ break;
+ default:
+ continue;
+ }
+ if (alloc_is_since_save(ptr, asave))
+ return_error(e_invalidrestore);
+ }
} while (ref_stack_enum_next(&rsenum));
return 0; /* OK */
}
@@ -313,41 +313,41 @@ restore_fix_stack(i_ctx_t *i_ctx_p, ref_stack_t * pstack,
ref_stack_enum_begin(&rsenum, pstack);
do {
- ref *stkp = rsenum.ptr;
- uint size = rsenum.size;
+ ref *stkp = rsenum.ptr;
+ uint size = rsenum.size;
- for (; size; stkp++, size--) {
- r_clear_attrs(stkp, l_new); /* always do it, no harm */
- if (is_estack) {
- ref ofile;
+ for (; size; stkp++, size--) {
+ r_clear_attrs(stkp, l_new); /* always do it, no harm */
+ if (is_estack) {
+ ref ofile;
- ref_assign(&ofile, stkp);
- switch (r_type(stkp)) {
- case t_string:
- if (r_size(stkp) == 0 &&
- alloc_is_since_save(stkp->value.bytes,
- asave)
- ) {
- make_empty_const_string(stkp,
- avm_foreign);
- break;
- }
- continue;
- case t_file:
- if (alloc_is_since_save(stkp->value.pfile,
- asave)
- ) {
- make_invalid_file(i_ctx_p, stkp);
- break;
- }
- continue;
- default:
- continue;
- }
- r_copy_attrs(stkp, a_all | a_executable,
- &ofile);
- }
- }
+ ref_assign(&ofile, stkp);
+ switch (r_type(stkp)) {
+ case t_string:
+ if (r_size(stkp) == 0 &&
+ alloc_is_since_save(stkp->value.bytes,
+ asave)
+ ) {
+ make_empty_const_string(stkp,
+ avm_foreign);
+ break;
+ }
+ continue;
+ case t_file:
+ if (alloc_is_since_save(stkp->value.pfile,
+ asave)
+ ) {
+ make_invalid_file(i_ctx_p, stkp);
+ break;
+ }
+ continue;
+ default:
+ continue;
+ }
+ r_copy_attrs(stkp, a_all | a_executable,
+ &ofile);
+ }
+ }
} while (ref_stack_enum_next(&rsenum));
}
@@ -360,11 +360,11 @@ zvmstatus(i_ctx_t *i_ctx_p)
gs_memory_status(imemory, &mstat);
if (imemory == imemory_global) {
- gs_memory_status_t sstat;
+ gs_memory_status_t sstat;
- gs_memory_status(imemory_system, &sstat);
- mstat.allocated += sstat.allocated;
- mstat.used += sstat.used;
+ gs_memory_status(imemory_system, &sstat);
+ mstat.allocated += sstat.allocated;
+ mstat.used += sstat.used;
}
gs_memory_status(imemory->non_gc_memory, &dstat);
push(3);
@@ -386,7 +386,7 @@ zforgetsave(i_ctx_t *i_ctx_p)
int code = restore_check_operand(op, &asave, idmemory);
if (code < 0)
- return 0;
+ return 0;
vmsave = alloc_save_client_data(asave);
/* Reset l_new in all stack entries if the new save level is zero. */
restore_fix_stack(i_ctx_p, &o_stack, asave, false);
@@ -398,27 +398,27 @@ zforgetsave(i_ctx_t *i_ctx_p)
* concatenating the stacks together.
*/
{
- gs_state *pgs = igs;
- gs_state *last;
+ gs_state *pgs = igs;
+ gs_state *last;
- while (gs_state_saved(last = gs_state_saved(pgs)) != 0)
- pgs = last;
- gs_state_swap_saved(last, vmsave->gsave);
- gs_grestore(last);
- gs_grestore(last);
+ while (gs_state_saved(last = gs_state_saved(pgs)) != 0)
+ pgs = last;
+ gs_state_swap_saved(last, vmsave->gsave);
+ gs_grestore(last);
+ gs_grestore(last);
}
/* Forget the save in the memory manager. */
code = alloc_forget_save_in(idmemory, asave);
if (code < 0)
- return code;
+ return code;
{
- uint space = icurrent_space;
+ uint space = icurrent_space;
- ialloc_set_space(idmemory, avm_local);
- /* See above for why we clear the gsave pointer here. */
- vmsave->gsave = 0;
- ifree_object(vmsave, "zrestore");
- ialloc_set_space(idmemory, space);
+ ialloc_set_space(idmemory, avm_local);
+ /* See above for why we clear the gsave pointer here. */
+ vmsave->gsave = 0;
+ ifree_object(vmsave, "zrestore");
+ ialloc_set_space(idmemory, space);
}
pop(1);
return 0;
diff --git a/gs/psi/zvmem2.c b/gs/psi/zvmem2.c
index 8fa2fb686..53be7254f 100644
--- a/gs/psi/zvmem2.c
+++ b/gs/psi/zvmem2.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -36,7 +36,7 @@ zsetglobal(i_ctx_t *i_ctx_p)
os_ptr op = osp;
check_type(*op, t_boolean);
ialloc_set_space(idmemory,
- (op->value.boolval ? avm_global : avm_local));
+ (op->value.boolval ? avm_global : avm_local));
pop(1);
return 0;
}
@@ -76,14 +76,14 @@ int
set_vm_threshold(i_ctx_t *i_ctx_p, long val)
{
if (val < -1)
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
else if (val == -1)
- val = (gs_debug_c('.') ? DEFAULT_VM_THRESHOLD_SMALL :
- DEFAULT_VM_THRESHOLD_LARGE);
+ val = (gs_debug_c('.') ? DEFAULT_VM_THRESHOLD_SMALL :
+ DEFAULT_VM_THRESHOLD_LARGE);
else if (val < MIN_VM_THRESHOLD)
- val = MIN_VM_THRESHOLD;
+ val = MIN_VM_THRESHOLD;
else if (val > MAX_VM_THRESHOLD)
- val = MAX_VM_THRESHOLD;
+ val = MAX_VM_THRESHOLD;
gs_memory_set_vm_threshold(idmemory->space_global, val);
gs_memory_set_vm_threshold(idmemory->space_local, val);
return 0;
@@ -93,12 +93,12 @@ int
set_vm_reclaim(i_ctx_t *i_ctx_p, long val)
{
if (val >= -2 && val <= 0) {
- gs_memory_set_vm_reclaim(idmemory->space_system, (val >= -1));
- gs_memory_set_vm_reclaim(idmemory->space_global, (val >= -1));
- gs_memory_set_vm_reclaim(idmemory->space_local, (val == 0));
- return 0;
+ gs_memory_set_vm_reclaim(idmemory->space_system, (val >= -1));
+ gs_memory_set_vm_reclaim(idmemory->space_global, (val >= -1));
+ gs_memory_set_vm_reclaim(idmemory->space_local, (val == 0));
+ return 0;
} else
- return_error(e_rangecheck);
+ return_error(e_rangecheck);
}
/*
@@ -114,9 +114,9 @@ zvmreclaim(i_ctx_t *i_ctx_p)
check_type(*op, t_integer);
if (op->value.intval == 1 || op->value.intval == 2) {
- /* Force the interpreter to store its state and exit. */
- /* The interpreter's caller will do the actual GC. */
- return_error(e_VMreclaim);
+ /* Force the interpreter to store its state and exit. */
+ /* The interpreter's caller will do the actual GC. */
+ return_error(e_VMreclaim);
}
return_error(e_rangecheck);
}
@@ -130,7 +130,7 @@ const op_def zvmem2_op_defs[] =
{"0.currentglobal", zcurrentglobal},
{"1.gcheck", zgcheck},
{"1.setglobal", zsetglobal},
- /* The rest of the operators are defined only in Level 2. */
+ /* The rest of the operators are defined only in Level 2. */
op_def_begin_level2(),
{"1.vmreclaim", zvmreclaim},
op_def_end(0)
diff --git a/gs/psi/zwinutf8.c b/gs/psi/zwinutf8.c
index c53c965c5..19f7cb9a7 100644
--- a/gs/psi/zwinutf8.c
+++ b/gs/psi/zwinutf8.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -43,22 +43,22 @@ zlocale_to_utf8(i_ctx_t *i_ctx_p)
check_read_type(*op, t_string);
input = ref_to_string(op, imemory, "locale_to_utf8 input");
if (input == 0)
- return_error(e_VMerror);
+ return_error(e_VMerror);
success = MultiByteToWideChar(CP_ACP, 0, input, -1,
- wide_buffer, LOCALE_TO_UTF8_BUFFER_SIZE);
+ wide_buffer, LOCALE_TO_UTF8_BUFFER_SIZE);
ifree_string((byte *)input, r_size(op) + 1, "locale_to_utf8 input");
if (success == 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
success = WideCharToMultiByte(CP_UTF8, 0, wide_buffer, -1,
- utf8_buffer, LOCALE_TO_UTF8_BUFFER_SIZE, NULL, NULL);
+ utf8_buffer, LOCALE_TO_UTF8_BUFFER_SIZE, NULL, NULL);
if (success == 0)
- return_error(e_ioerror);
+ return_error(e_ioerror);
code = string_to_ref(utf8_buffer, op, iimemory, "locale_to_utf8 output");
if (code < 0)
- return code;
+ return code;
return 0;
#undef LOCALE_TO_UTF8_BUFFER_SIZE
diff --git a/gs/toolbin/GenSubstCID.ps b/gs/toolbin/GenSubstCID.ps
index 20ee86e0b..6bb7188c6 100644
--- a/gs/toolbin/GenSubstCID.ps
+++ b/gs/toolbin/GenSubstCID.ps
Binary files differ
diff --git a/gs/toolbin/bmpcmp.c b/gs/toolbin/bmpcmp.c
index 483771d81..768a78a27 100644
--- a/gs/toolbin/bmpcmp.c
+++ b/gs/toolbin/bmpcmp.c
@@ -98,7 +98,6 @@ typedef void (DiffFn)(unsigned char *bmp,
BBox *bbox,
Params *params);
-
static void *Malloc(size_t size) {
void *block;
@@ -1342,7 +1341,6 @@ static int fuzzy_fast_exhaustive(FuzzyParams *fuzzy_params,
return ret;
}
-
static void fuzzy_diff(unsigned char *bmp,
unsigned char *bmp2,
unsigned char *map,
@@ -2296,6 +2294,5 @@ done:
image_close(&image1);
image_close(&image2);
-
return EXIT_SUCCESS;
}
diff --git a/gs/toolbin/color/halftone/halfttoning/halftone.c b/gs/toolbin/color/halftone/halfttoning/halftone.c
index 624f44fac..23e1a1fb6 100644
--- a/gs/toolbin/color/halftone/halfttoning/halftone.c
+++ b/gs/toolbin/color/halftone/halfttoning/halftone.c
@@ -69,44 +69,44 @@ int htsc_getpoint(htsc_dig_grid_t *dig_grid, int x, int y);
void htsc_setpoint(htsc_dig_grid_t *dig_grid, int x, int y, int value);
void htsc_create_dot_mask(htsc_dig_grid_t *dig_grid, int x, int y, int u, int v,
double screen_angle, htsc_vertices_t vertices);
-void htsc_diffpoint(htsc_point_t point1, htsc_point_t point2,
+void htsc_diffpoint(htsc_point_t point1, htsc_point_t point2,
htsc_point_t *diff_point);
-double htsc_vertex_dist(htsc_vertices_t vertices, htsc_point_t test_point,
+double htsc_vertex_dist(htsc_vertices_t vertices, htsc_point_t test_point,
double horiz_dpi, double vert_dpi);
-double htsc_normpoint(htsc_point_t *diff_point, double horiz_dpi, double vert_dpi);
+double htsc_normpoint(htsc_point_t *diff_point, double horiz_dpi, double vert_dpi);
int htsc_sumsum(htsc_dig_grid_t dig_grid);
-void htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y,
- int u, int v, htsc_point_t center, double horiz_dpi,
- double vert_dpi, htsc_vertices_t vertices,
+void htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y,
+ int u, int v, htsc_point_t center, double horiz_dpi,
+ double vert_dpi, htsc_vertices_t vertices,
htsc_point_t *one_index);
-int htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
- int v, int target_size, bool use_holladay_grid,
+int htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
+ int v, int target_size, bool use_holladay_grid,
htsc_dig_grid_t dot_grid, int N, int *S, int *H, int *L);
-void htsc_tile_supercell(htsc_dig_grid_t *super_cell, htsc_dig_grid_t *dot_grid,
+void htsc_tile_supercell(htsc_dig_grid_t *super_cell, htsc_dig_grid_t *dot_grid,
int x, int y, int u, int v, int N);
-void htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
+void htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
double gamma, htsc_dig_grid_t *final_mask);
-void htsc_create_dither_mask(htsc_dig_grid_t super_cell,
- htsc_dig_grid_t *final_mask,
+void htsc_create_dither_mask(htsc_dig_grid_t super_cell,
+ htsc_dig_grid_t *final_mask,
int num_levels, int y, int x, double vert_dpi,
double horiz_dpi, int N, double gamma,
htsc_dig_grid_t dot_grid, htsc_point_t one_index);
-void htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
+void htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
double gamma, htsc_dig_grid_t *final_mask);
-void htsc_save_mask(htsc_dig_grid_t final_mask, bool use_holladay_grid, int S,
+void htsc_save_mask(htsc_dig_grid_t final_mask, bool use_holladay_grid, int S,
output_format_type output_format);
int htsc_gcd(int a, int b);
int htsc_lcm(int a, int b);
int htsc_matrix_inverse(htsc_matrix_t matrix_in, htsc_matrix_t *matrix_out);
-void htsc_matrix_vector_mult(htsc_matrix_t matrix_in, htsc_vector_t vector_in,
+void htsc_matrix_vector_mult(htsc_matrix_t matrix_in, htsc_vector_t vector_in,
htsc_vector_t *vector_out);
#if RAW_SCREEN_DUMP
void htsc_dump_screen(htsc_dig_grid_t *dig_grid, char filename[]);
void htsc_dump_float_image(float *image, int height, int width, float max_val,
- char filename[]);
+ char filename[]);
void htsc_dump_byte_image(byte *image, int height, int width, float max_val,
- char filename[]);
+ char filename[]);
#endif
int usage (void) {
@@ -121,9 +121,9 @@ static const char * get_arg (int argc, char **argv, int *pi, const char *arg) {
} else {
(*pi)++;
if (*pi == argc) {
- return NULL;
+ return NULL;
} else {
- return argv[*pi];
+ return argv[*pi];
}
}
}
@@ -162,7 +162,7 @@ main (int argc, char **argv)
output_format_type output_format = OUTPUT_BIN;
horiz_dpi = 300; /* Default values */
- vert_dpi = 300;
+ vert_dpi = 300;
target_lpi = 75;
use_dither_grid = true;
target_screen_angle = 0;
@@ -173,43 +173,43 @@ main (int argc, char **argv)
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
if (arg[0] == '-') {
- switch (arg[1]) {
- case 'a':
- target_screen_angle = atoi(get_arg(argc, argv, &i, arg + 2));
+ switch (arg[1]) {
+ case 'a':
+ target_screen_angle = atoi(get_arg(argc, argv, &i, arg + 2));
target_screen_angle = target_screen_angle % 90;
screen_angle = target_screen_angle;
- break;
- case 'l':
- target_lpi = atoi(get_arg(argc, argv, &i, arg + 2));
- break;
- case 'p':
- output_format = (arg[2] == 's') ? OUTPUT_PS :
- (arg[2] == 'p' ? OUTPUT_PPM : OUTPUT_BIN);
- break;
- case 'q':
- target_quantization = atoi(get_arg(argc, argv, &i, arg + 2));
+ break;
+ case 'l':
+ target_lpi = atoi(get_arg(argc, argv, &i, arg + 2));
+ break;
+ case 'p':
+ output_format = (arg[2] == 's') ? OUTPUT_PS :
+ (arg[2] == 'p' ? OUTPUT_PPM : OUTPUT_BIN);
+ break;
+ case 'q':
+ target_quantization = atoi(get_arg(argc, argv, &i, arg + 2));
target_quant_specified = true;
- break;
- case 'r':
- horiz_dpi = atoi(get_arg(argc, argv, &i, arg + 2));
- vert_dpi = horiz_dpi;
- break;
+ break;
+ case 'r':
+ horiz_dpi = atoi(get_arg(argc, argv, &i, arg + 2));
+ vert_dpi = horiz_dpi;
+ break;
case 's':
target_size = atoi(get_arg(argc, argv, &i, arg + 2));
target_size_specified = true;
- break;
- default:
- return usage();
- }
- }
+ break;
+ default:
+ return usage();
+ }
+ }
}
dot_grid.data = NULL;
super_cell.data = NULL;
final_mask.data = NULL;
- num_levels = 6;
+ num_levels = 6;
use_holladay_grid = false;
/* Go through and find the rational angle options that gets us to the
- best LPI. Pick the one that is just over what is requested.
+ best LPI. Pick the one that is just over what is requested.
That is really our limiting factor here. Pick it and
then figure out how much dithering we need to do to get to the proper
number of levels. */
@@ -227,7 +227,7 @@ main (int argc, char **argv)
x_use = x;
y=ROUND((double) x_use / ratio);
true_angle = 180.0 * atan(((double) x_use / horiz_dpi) / ( (double) y /vert_dpi) ) / pi;
- lpi = 1.0/( sqrt( ((double) y / vert_dpi) * ( (double) y / vert_dpi) +
+ lpi = 1.0/( sqrt( ((double) y / vert_dpi) * ( (double) y / vert_dpi) +
( (double) x_use / horiz_dpi) * ((double) x_use / horiz_dpi) ));
v = -x_use / scaled_x;
u = y * scaled_x;
@@ -252,11 +252,11 @@ main (int argc, char **argv)
x_use = x - 1;
y=ROUND((double) x_use / ratio);
true_angle = 180.0 * atan(((double) x_use / horiz_dpi) / ( (double) y /vert_dpi) ) / pi;
- lpi = 1.0/( sqrt( ((double) y / vert_dpi) * ( (double) y / vert_dpi) +
+ lpi = 1.0/( sqrt( ((double) y / vert_dpi) * ( (double) y / vert_dpi) +
( (double) x_use / horiz_dpi) * ((double) x_use / horiz_dpi) ));
v = -x_use / scaled_x;
u = y * scaled_x;
- N = y *u - x_use * v;
+ N = y *u - x_use * v;
}
use = true;
}
@@ -281,13 +281,13 @@ main (int argc, char **argv)
for (y = 1; y < 11; y++) {
y_use = y;
x = ROUND(y_use * ratio);
- /* compute the true angle */
+ /* compute the true angle */
true_angle = 180.0 * atan((x / horiz_dpi) / (y_use / vert_dpi)) / pi;
lpi = 1.0 / sqrt( (y_use /vert_dpi) * (y_use /vert_dpi) +
(x/horiz_dpi) * (x/horiz_dpi));
v = ROUND(-x / scaled_x);
u = ROUND(y_use * scaled_x);
- N = y_use * u - x * v;
+ N = y_use * u - x * v;
if (prev_lpi == 0) {
prev_lpi = lpi;
if (target_lpi > lpi) {
@@ -307,13 +307,13 @@ main (int argc, char **argv)
/* Reset these to previous x */
y_use = y - 1;
x = ROUND(y_use * ratio);
- /* compute the true angle */
+ /* compute the true angle */
true_angle = 180.0 * atan((x / horiz_dpi) / (y_use / vert_dpi)) / pi;
lpi = 1.0 / sqrt( (y_use /vert_dpi) * (y_use /vert_dpi) +
(x/horiz_dpi) * (x/horiz_dpi));
v = ROUND(-x / scaled_x);
u = ROUND(y_use * scaled_x);
- N = y_use * u - x * v;
+ N = y_use * u - x * v;
}
use = true;
}
@@ -328,7 +328,7 @@ main (int argc, char **argv)
printf("%3.0lf\t%3.0lf\t%3.0lf\t%3.0lf\t%3.1lf\t%3.1lf\t%3.0lf\n",
x,y_use,u,v,true_angle,lpi,N);
prev_lpi = lpi;
- }
+ }
y = y_use;
}
if (ratio == 0) {
@@ -338,12 +338,12 @@ main (int argc, char **argv)
printf("-----------------------------------------------------------\n");
for (y = 1; y < 11; y++) {
y_use = y;
- x = ROUND( y_use * ratio );
+ x = ROUND( y_use * ratio );
v = ROUND(-x / scaled_x);
u = ROUND(y_use * scaled_x);
- N = y_use * u - x * v;
+ N = y_use * u - x * v;
true_angle = 0;
- lpi = 1.0/(double) sqrt( (double) ((y_use / vert_dpi) *
+ lpi = 1.0/(double) sqrt( (double) ((y_use / vert_dpi) *
(y_use / vert_dpi) + (x / horiz_dpi) * (x / horiz_dpi)) );
if (prev_lpi == 0) {
prev_lpi = lpi;
@@ -363,13 +363,13 @@ main (int argc, char **argv)
} else {
/* Reset these to previous x */
y_use = y - 1;
- x = ROUND( y_use * ratio );
+ x = ROUND( y_use * ratio );
v = ROUND(-x / scaled_x);
u = ROUND(y_use * scaled_x);
- N = y_use * u - x * v;
+ N = y_use * u - x * v;
true_angle = 0;
- lpi = 1.0/(double) sqrt( (double) ((y_use / vert_dpi) *
- (y_use / vert_dpi) + (x / horiz_dpi) * (x / horiz_dpi)) );
+ lpi = 1.0/(double) sqrt( (double) ((y_use / vert_dpi) *
+ (y_use / vert_dpi) + (x / horiz_dpi) * (x / horiz_dpi)) );
}
use = true;
}
@@ -384,7 +384,7 @@ main (int argc, char **argv)
printf("%3.0lf\t%3.0lf\t%3.0lf\t%3.0lf\t%3.1lf\t%3.1lf\t%3.0lf\n",
x,y_use,u,v,true_angle,lpi,N);
prev_lpi = lpi;
- }
+ }
y = y_use;
} else {
printf("x\ty\tu\tv\tAngle\tLPI\tLevels\n");
@@ -393,11 +393,11 @@ main (int argc, char **argv)
x_use = x;
y = ROUND(x_use * ratio);
true_angle = 0;
- lpi = 1.0/( sqrt( (y / vert_dpi) * (y / vert_dpi) +
+ lpi = 1.0/( sqrt( (y / vert_dpi) * (y / vert_dpi) +
(x_use / horiz_dpi) * (x_use / horiz_dpi) ));
v = ROUND( -x_use / scaled_x);
u = ROUND( y * scaled_x);
- N = y *u - x_use * v;
+ N = y *u - x_use * v;
if (prev_lpi == 0) {
prev_lpi = lpi;
if (target_lpi > lpi) {
@@ -418,11 +418,11 @@ main (int argc, char **argv)
x_use = x - 1;
y = ROUND(x_use * ratio);
true_angle = 0;
- lpi = 1.0/( sqrt( (y / vert_dpi) * (y / vert_dpi) +
+ lpi = 1.0/( sqrt( (y / vert_dpi) * (y / vert_dpi) +
(x_use / horiz_dpi) * (x_use / horiz_dpi) ));
v = ROUND( -x_use / scaled_x);
u = ROUND( y * scaled_x);
- N = y *u - x_use * v;
+ N = y *u - x_use * v;
}
use = true;
}
@@ -443,14 +443,14 @@ main (int argc, char **argv)
}
/* Figure out how many levels to dither across. */
if (target_quant_specified) {
- num_levels = ROUND((double) target_quantization / N);
+ num_levels = ROUND((double) target_quantization / N);
} else {
num_levels = 1;
}
if (num_levels == 1 && !target_size_specified) {
printf("No quantization, creating minimal sized periodic screen\n");
target_size = 1;
- }
+ }
/* Lower left of the cell is at the origin. Define the other vertices */
vertices.lower_left.x = 0;
vertices.lower_left.y = 0;
@@ -474,13 +474,13 @@ main (int argc, char **argv)
return -1;
}
/* Now actually determine the turn on sequence */
- htsc_create_dot_profile(&dot_grid, N, x, y, u, v, center, horiz_dpi,
+ htsc_create_dot_profile(&dot_grid, N, x, y, u, v, center, horiz_dpi,
vert_dpi, vertices, &one_index);
#if RAW_SCREEN_DUMP
htsc_dump_screen(&dot_grid, "dot_profile");
-#endif
+#endif
/* Allocate super cell */
- code = htsc_allocate_supercell(&super_cell, x, y, u, v, target_size,
+ code = htsc_allocate_supercell(&super_cell, x, y, u, v, target_size,
use_holladay_grid, dot_grid, N, &S, &H, &L);
if (code < 0) {
printf("ERROR! grid size problem!\n");
@@ -490,16 +490,16 @@ main (int argc, char **argv)
htsc_tile_supercell(&super_cell, &dot_grid, x, y, u, v, N);
#if RAW_SCREEN_DUMP
htsc_dump_screen(&super_cell, "super_cell_tiled");
-#endif
+#endif
/* If we are using the Holladay grid (non dithered) then we are done. */
if (use_holladay_grid) {
htsc_create_holladay_mask(super_cell, H, L, gamma, &final_mask);
} else {
- if (super_cell.height == dot_grid.height &&
+ if (super_cell.height == dot_grid.height &&
super_cell.width == dot_grid.width) {
htsc_create_nondithered_mask(super_cell, H, L, gamma, &final_mask);
} else {
- htsc_create_dither_mask(super_cell, &final_mask, num_levels, y, x,
+ htsc_create_dither_mask(super_cell, &final_mask, num_levels, y, x,
vert_dpi, horiz_dpi, N, gamma, dot_grid,
one_index);
}
@@ -512,9 +512,9 @@ main (int argc, char **argv)
}
void
-htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, int v,
+htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, int v,
htsc_point_t center, double horiz_dpi, double vert_dpi,
- htsc_vertices_t vertices, htsc_point_t *one_index)
+ htsc_vertices_t vertices, htsc_point_t *one_index)
{
int done, dot_index, hole_index, count, index_x, index_y;
htsc_dot_shape_search_t dot_search;
@@ -531,7 +531,7 @@ htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, i
val_min=MIN(0,v);
while (!done) {
- /* First perform a search for the closest one to the center
+ /* First perform a search for the closest one to the center
(of those remaining) and assign the current smallest index */
index_x = 0;
dot_search.index_x = 0;
@@ -541,11 +541,11 @@ htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, i
index_y = 0;
for (j = val_min; j < y; j++) {
test_point.x = k + 0.5;
- test_point.y = j + 0.5;
+ test_point.y = j + 0.5;
if ( htsc_getpoint(dig_grid, index_x, index_y) == -1 ) {
htsc_diffpoint(test_point, center, &differ);
dist = htsc_normpoint(&differ, horiz_dpi, vert_dpi);
- if (dist < dot_search.norm) {
+ if (dist < dot_search.norm) {
dot_search.norm = dist;
dot_search.index_x = index_x;
dot_search.index_y = index_y;
@@ -562,29 +562,29 @@ htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, i
if (count == N) {
done = 1;
break;
- }
+ }
/* The ones position for the dig_grid is locatd at the first dot_search entry */
/* We need this later so grab it now */
if (count == 1) {
one_index->x = dot_search.index_x;
one_index->y = dot_search.index_y;
}
- /* Now search for the closest one to a vertix (of those remaining).
+ /* Now search for the closest one to a vertix (of those remaining).
and assign the current largest index */
index_x = 0;
dot_search.index_x = 0;
dot_search.index_y = 0;
- dot_search.norm = 10000000000;
+ dot_search.norm = 10000000000;
for (k = 0; k < x + u; k++) {
index_y = 0;
for (j = val_min; j < y; j++) {
test_point.x = k + 0.5;
- test_point.y = j + 0.5;
+ test_point.y = j + 0.5;
if ( htsc_getpoint(dig_grid, index_x, index_y) == -1 ) {
/* Find closest to a vertex */
- dist = htsc_vertex_dist(vertices, test_point, horiz_dpi,
+ dist = htsc_vertex_dist(vertices, test_point, horiz_dpi,
vert_dpi);
- if (dist < dot_search.norm) {
+ if (dist < dot_search.norm) {
dot_search.norm = dist;
dot_search.index_x = index_x;
dot_search.index_y = index_y;
@@ -601,13 +601,13 @@ htsc_create_dot_profile(htsc_dig_grid_t *dig_grid, int N, int x, int y, int u, i
if (count == N) {
done = 1;
break;
- }
+ }
}
}
/* This creates a mask for creating the dot shape */
-void
-htsc_create_dot_mask(htsc_dig_grid_t *dot_grid, int x, int y, int u, int v,
+void
+htsc_create_dot_mask(htsc_dig_grid_t *dot_grid, int x, int y, int u, int v,
double screen_angle, htsc_vertices_t vertices)
{
int k,j,val_min,index_x,index_y;
@@ -622,7 +622,7 @@ htsc_create_dot_mask(htsc_dig_grid_t *dot_grid, int x, int y, int u, int v,
val_min=MIN(0,v);
dot_grid->height = abs(val_min) + y;
dot_grid->width = x + u;
- dot_grid->data =
+ dot_grid->data =
(int *) malloc(dot_grid->height * dot_grid->width * sizeof(int));
memset(dot_grid->data,0,dot_grid->height * dot_grid->width * sizeof(int));
index_x = 0;
@@ -644,11 +644,11 @@ htsc_create_dot_mask(htsc_dig_grid_t *dot_grid, int x, int y, int u, int v,
if (point_in) {
htsc_setpoint(dot_grid, index_x, index_y, -1);
}
- index_y++;
+ index_y++;
}
index_x++;
}
- } else {
+ } else {
/* All points are valid */
dot_grid->height = y;
dot_grid->width = u;
@@ -660,7 +660,7 @@ htsc_create_dot_mask(htsc_dig_grid_t *dot_grid, int x, int y, int u, int v,
}
double
-htsc_vertex_dist(htsc_vertices_t vertices, htsc_point_t test_point,
+htsc_vertex_dist(htsc_vertices_t vertices, htsc_point_t test_point,
double horiz_dpi, double vert_dpi)
{
double dist[4], smallest;
@@ -684,8 +684,8 @@ htsc_vertex_dist(htsc_vertices_t vertices, htsc_point_t test_point,
return smallest;
}
-double
-htsc_normpoint(htsc_point_t *diff_point, double horiz_dpi, double vert_dpi)
+double
+htsc_normpoint(htsc_point_t *diff_point, double horiz_dpi, double vert_dpi)
{
diff_point->x = diff_point->x / horiz_dpi;
diff_point->y = diff_point->y / vert_dpi;
@@ -693,13 +693,13 @@ htsc_normpoint(htsc_point_t *diff_point, double horiz_dpi, double vert_dpi)
}
int
-htsc_getpoint(htsc_dig_grid_t *dig_grid, int x, int y)
+htsc_getpoint(htsc_dig_grid_t *dig_grid, int x, int y)
{
- return dig_grid->data[ y * dig_grid->width + x];
+ return dig_grid->data[ y * dig_grid->width + x];
}
void
-htsc_setpoint(htsc_dig_grid_t *dig_grid, int x, int y, int value)
+htsc_setpoint(htsc_dig_grid_t *dig_grid, int x, int y, int value)
{
int kk;
if (x < 0 || x > dig_grid->width-1 || y < 0 || y > dig_grid->height-1) {
@@ -708,9 +708,9 @@ htsc_setpoint(htsc_dig_grid_t *dig_grid, int x, int y, int value)
dig_grid->data[ y * dig_grid->width + x] = value;
}
-void
-htsc_diffpoint(htsc_point_t point1, htsc_point_t point2,
- htsc_point_t *diff_point)
+void
+htsc_diffpoint(htsc_point_t point1, htsc_point_t point2,
+ htsc_point_t *diff_point)
{
diff_point->x = point1.x - point2.x;
@@ -718,7 +718,7 @@ htsc_diffpoint(htsc_point_t point1, htsc_point_t point2,
}
int
-htsc_sumsum(htsc_dig_grid_t dig_grid)
+htsc_sumsum(htsc_dig_grid_t dig_grid)
{
int pos;
@@ -732,7 +732,7 @@ htsc_sumsum(htsc_dig_grid_t dig_grid)
return value;
}
-int
+int
htsc_gcd(int a, int b)
{
if ( b == 0 ) return a;
@@ -750,7 +750,7 @@ htsc_gcd(int a, int b)
}
}
-int
+int
htsc_lcm(int a, int b)
{
int product = a * b;
@@ -761,14 +761,14 @@ htsc_lcm(int a, int b)
return lcm;
}
-int
+int
htsc_matrix_inverse(htsc_matrix_t matrix_in, htsc_matrix_t *matrix_out)
{
double determinant;
determinant = matrix_in.row[0].xy[0] * matrix_in.row[1].xy[1] -
matrix_in.row[0].xy[1] * matrix_in.row[1].xy[0];
- if (determinant == 0)
+ if (determinant == 0)
return -1;
matrix_out->row[0].xy[0] = matrix_in.row[1].xy[1] / determinant;
matrix_out->row[0].xy[1] = -matrix_in.row[0].xy[1] / determinant;
@@ -778,7 +778,7 @@ htsc_matrix_inverse(htsc_matrix_t matrix_in, htsc_matrix_t *matrix_out)
}
void
-htsc_matrix_vector_mult(htsc_matrix_t matrix_in, htsc_vector_t vector_in,
+htsc_matrix_vector_mult(htsc_matrix_t matrix_in, htsc_vector_t vector_in,
htsc_vector_t *vector_out)
{
vector_out->xy[0] = matrix_in.row[0].xy[0] * vector_in.xy[0] +
@@ -788,8 +788,8 @@ htsc_matrix_vector_mult(htsc_matrix_t matrix_in, htsc_vector_t vector_in,
}
int
-htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
- int v, int target_size, bool use_holladay_grid,
+htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
+ int v, int target_size, bool use_holladay_grid,
htsc_dig_grid_t dot_grid, int N, int *S, int *H, int *L)
{
htsc_matrix_t matrix;
@@ -843,9 +843,9 @@ htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
The macrocell must be H*a by L*b where a and b are integers due to the
periodicity of the screen. */
- /* To create the Holladay screen (no stocastic stuff),
- select the size H and L to create the matrix i.e. super_size_x
- and super_size_y need to be H by L at least and then just take an
+ /* To create the Holladay screen (no stocastic stuff),
+ select the size H and L to create the matrix i.e. super_size_x
+ and super_size_y need to be H by L at least and then just take an
H by L section. */
/* Force a periodicity in the screen to avoid the shift factor */
if (*S != 0) {
@@ -871,7 +871,7 @@ htsc_allocate_supercell(htsc_dig_grid_t *super_cell, int x, int y, int u,
}
super_cell->height = super_size_y;
super_cell->width = super_size_x;
- super_cell->data =
+ super_cell->data =
(int *) malloc(super_size_x * super_size_y * sizeof(int));
memset(super_cell->data, 0, super_size_x * super_size_y * sizeof(int));
return 0;
@@ -890,7 +890,7 @@ htsc_supercell_assign_point(int new_k, int new_j, int sc_xsize, int sc_ysize,
}
void
-htsc_tile_supercell(htsc_dig_grid_t *super_cell, htsc_dig_grid_t *dot_grid,
+htsc_tile_supercell(htsc_dig_grid_t *super_cell, htsc_dig_grid_t *dot_grid,
int x, int y, int u, int v, int N)
{
int sc_ysize = super_cell->height;
@@ -963,8 +963,8 @@ create_2d_gauss_filter(float *filter, int x_size, int y_size,
for (j = -y_half_size; j < y_half_size+1; j++) {
index_y = j + y_half_size;
- for (k = -x_half_size; k < x_half_size+1; k++) {
- arg = -(k * k / (stdvalx * stdvalx) +
+ for (k = -x_half_size; k < x_half_size+1; k++) {
+ arg = -(k * k / (stdvalx * stdvalx) +
j * j / (stdvaly * stdvaly) ) /2;
val = (float) exp(arg);
sum += val;
@@ -983,10 +983,10 @@ create_2d_gauss_filter(float *filter, int x_size, int y_size,
/* 2-D convolution (or correlation) with periodic boundary condition */
void
-htsc_apply_filter(byte *screen_matrix, int num_cols_sc,
- int num_rows_sc, float *filter, int num_cols_filt,
+htsc_apply_filter(byte *screen_matrix, int num_cols_sc,
+ int num_rows_sc, float *filter, int num_cols_filt,
int num_rows_filt, float *screen_blur,
- float *max_val, htsc_point_t *max_pos, float *min_val,
+ float *max_val, htsc_point_t *max_pos, float *min_val,
htsc_point_t *min_pos)
{
int k,j,kk,jj;
@@ -1003,19 +1003,19 @@ htsc_apply_filter(byte *screen_matrix, int num_cols_sc,
sum = 0.0;
for (jj = -half_rows_filt; jj <= half_rows_filt; jj++) {
j_circ = j + jj;
- if (j_circ < 0) {
- j_circ =
+ if (j_circ < 0) {
+ j_circ =
(num_rows_sc - ((-j_circ) % num_rows_sc)) % num_rows_sc;
- }
+ }
if (j_circ > (num_rows_sc - 1)) {
j_circ = j_circ % num_rows_sc;
}
for (kk = -half_cols_filt; kk <= half_cols_filt; kk++) {
k_circ = k + kk;
- if (k_circ < 0) {
- k_circ =
+ if (k_circ < 0) {
+ k_circ =
(num_cols_sc - ((-k_circ) % num_cols_sc)) % num_cols_sc;
- }
+ }
if (k_circ > (num_cols_sc - 1)) {
k_circ = k_circ % num_cols_sc;
}
@@ -1044,10 +1044,10 @@ htsc_apply_filter(byte *screen_matrix, int num_cols_sc,
int
htsc_add_dots(byte *screen_matrix, int num_cols, int num_rows,
- double horiz_dpi, double vert_dpi, double lpi_act,
+ double horiz_dpi, double vert_dpi, double lpi_act,
unsigned short *pos_x, unsigned short *pos_y,
- int *locate, int num_dots,
- htsc_dither_pos_t *dot_level_position, int level_num,
+ int *locate, int num_dots,
+ htsc_dither_pos_t *dot_level_position, int level_num,
int num_dots_add)
{
double xscale = horiz_dpi / vert_dpi;
@@ -1078,16 +1078,16 @@ htsc_add_dots(byte *screen_matrix, int num_cols, int num_rows,
for (j = 0; j < num_dots_add; j++) {
/* Perform the blur */
- htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
+ htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
sizefilty, screen_blur, &max_val, &max_pos, &min_val, &min_pos);
- /* Find the closest OFF dot to the min position. */
+ /* Find the closest OFF dot to the min position. */
white_pos = 0;
dist = (pos_y[0] - min_pos.y) * (pos_y[0] - min_pos.y) +
(pos_x[0] - min_pos.x) * (pos_x[0] - min_pos.x);
for ( k = 1; k < num_dots; k++) {
curr_dist = (pos_y[k] - min_pos.y) * (pos_y[k] - min_pos.y) +
(pos_x[k] - min_pos.x) * (pos_x[k] - min_pos.x);
- if (curr_dist < dist &&
+ if (curr_dist < dist &&
screen_matrix[pos_x[k] + num_cols * pos_y[k]] == 0) {
white_pos = k;
dist = curr_dist;
@@ -1108,7 +1108,7 @@ htsc_add_dots(byte *screen_matrix, int num_cols, int num_rows,
int
htsc_init_dot_position(byte *screen_matrix, int num_cols, int num_rows,
- double horiz_dpi, double vert_dpi, double lpi_act,
+ double horiz_dpi, double vert_dpi, double lpi_act,
unsigned short *pos_x, unsigned short *pos_y, int num_dots,
htsc_dither_pos_t *dot_level_position)
{
@@ -1138,21 +1138,21 @@ htsc_init_dot_position(byte *screen_matrix, int num_cols, int num_rows,
create_2d_gauss_filter(filter, sizefiltx, sizefilty, sizefiltx, sizefilty);
screen_blur = (float*) malloc(sizeof(float) * num_cols * num_rows);
/* Start moving dots until the whitest and darkest dot are the same */
- while (!done) {
+ while (!done) {
/* Blur */
- htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
+ htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
sizefilty, screen_blur, &max_val, &max_pos, &min_val, &min_pos);
#if RAW_SCREEN_DUMP
htsc_dump_float_image(screen_blur, num_cols, num_rows, max_val, "blur_one");
-#endif
- /* Find the closest on dot to the max position */
+#endif
+ /* Find the closest on dot to the max position */
black_pos = 0;
dist = (pos_y[0] - max_pos.y) * (pos_y[0] - max_pos.y) +
(pos_x[0] - max_pos.x) * (pos_x[0] - max_pos.x);
for ( k = 1; k < num_dots; k++) {
curr_dist = (pos_y[k] - max_pos.y) * (pos_y[k] - max_pos.y) +
(pos_x[k] - max_pos.x) * (pos_x[k] - max_pos.x);
- if (curr_dist < dist &&
+ if (curr_dist < dist &&
screen_matrix[pos_x[k] + num_cols * pos_y[k]] == 1) {
black_pos = k;
dist = curr_dist;
@@ -1161,16 +1161,16 @@ htsc_init_dot_position(byte *screen_matrix, int num_cols, int num_rows,
/* Set this dot to black */
screen_matrix[pos_x[black_pos] + num_cols * pos_y[black_pos]] = 0;
/* Blur again */
- htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
+ htsc_apply_filter(screen_matrix, num_cols, num_rows, filter, sizefiltx,
sizefilty, screen_blur, &max_val, &max_pos, &min_val, &min_pos);
- /* Find the closest OFF dot to the min position. */
+ /* Find the closest OFF dot to the min position. */
white_pos = 0;
dist = (pos_y[0] - min_pos.y) * (pos_y[0] - min_pos.y) +
(pos_x[0] - min_pos.x) * (pos_x[0] - min_pos.x);
for ( k = 1; k < num_dots; k++) {
curr_dist = (pos_y[k] - min_pos.y) * (pos_y[k] - min_pos.y) +
(pos_x[k] - min_pos.x) * (pos_x[k] - min_pos.x);
- if (curr_dist < dist &&
+ if (curr_dist < dist &&
screen_matrix[pos_x[k] + num_cols * pos_y[k]] == 0) {
white_pos = k;
dist = curr_dist;
@@ -1194,7 +1194,7 @@ htsc_init_dot_position(byte *screen_matrix, int num_cols, int num_rows,
found_it = true;
dot_level_position->point[k].x = pos_x[white_pos];
dot_level_position->point[k].y = pos_y[white_pos];
- dot_level_position->locations[k] =
+ dot_level_position->locations[k] =
pos_x[white_pos] + pos_y[white_pos] * num_cols;
break;
}
@@ -1210,10 +1210,10 @@ htsc_init_dot_position(byte *screen_matrix, int num_cols, int num_rows,
return 0;
}
-void
-htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
+void
+htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
int num_levels, int y, int x, double vert_dpi,
- double horiz_dpi, int N, double gamma,
+ double horiz_dpi, int N, double gamma,
htsc_dig_grid_t dot_grid, htsc_point_t dot_grid_one_index)
{
int *dot_levels;
@@ -1242,14 +1242,14 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
int j_index, k_index, threshold_value;
int *dot_level_sort;
bool found;
-
+
lpi_act = 1.0/((double) sqrt( vert_scale * vert_scale +
horiz_scale * horiz_scale));
if (num_levels > 1) {
curr_size = 2 * MAX(height_supercell, width_supercell);
locate = (int*) malloc(sizeof(int) * curr_size);
screen_matrix = (byte*) malloc(sizeof(byte) * number_points);
- memset(screen_matrix, 0, sizeof(byte) * number_points);
+ memset(screen_matrix, 0, sizeof(byte) * number_points);
/* Determine the number of dots in the screen and their index */
for (j = 0; j < number_points; j++) {
if (super_cell.data[j] == 1) {
@@ -1270,7 +1270,7 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
pos_x[k] = locate[k] % width_supercell;
pos_y[k] = (locate[k] - pos_x[k])/width_supercell;
}
- dot_level_pos =
+ dot_level_pos =
(htsc_dither_pos_t*) malloc(sizeof(htsc_dither_pos_t) * num_levels);
dot_levels = (int*) malloc(sizeof(int) * num_levels);
percent = 1.0/((float)num_levels+1.0);
@@ -1281,16 +1281,16 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
curr_num_dots = dot_levels[k] -prev_dot_level;
prev_dot_level = dot_levels[k];
dot_level_pos[k].locations = (int*) malloc(sizeof(int) * curr_num_dots);
- dot_level_pos[k].point =
+ dot_level_pos[k].point =
(htsc_point_t*) malloc(sizeof(htsc_point_t) * curr_num_dots);
dot_level_pos[k].number_points = curr_num_dots;
}
- /* An initial random location for the first level */
+ /* An initial random location for the first level */
dots_needed = dot_levels[0];
count = 0;
if (dots_needed > 0) {
done = 0;
- while (!done) {
+ while (!done) {
rand_pos = ROUND((num_dots-1)*(double) rand()/ (double) RAND_MAX);
if (screen_matrix[locate[rand_pos]] != 1) {
screen_matrix[locate[rand_pos]] = 1;
@@ -1307,30 +1307,30 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
}
/* Rearrange these dots into a pleasing pattern */
#if RAW_SCREEN_DUMP
- htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
+ htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
1, "screen0_init");
-#endif
- code = htsc_init_dot_position(screen_matrix, width_supercell,
+#endif
+ code = htsc_init_dot_position(screen_matrix, width_supercell,
height_supercell, horiz_dpi, vert_dpi, lpi_act,
pos_x, pos_y, num_dots, dot_level_pos);
#if RAW_SCREEN_DUMP
- htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
+ htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
1, "screen0_arrange");
-#endif
+#endif
/* Now we want to introduce more dots at each level */
for (k = 1; k < num_levels; k++) {
code = htsc_add_dots(screen_matrix, width_supercell, height_supercell,
- horiz_dpi, vert_dpi, lpi_act, pos_x, pos_y, locate,
- num_dots, dot_level_pos, k,
+ horiz_dpi, vert_dpi, lpi_act, pos_x, pos_y, locate,
+ num_dots, dot_level_pos, k,
dot_level_pos[k].number_points);
#if RAW_SCREEN_DUMP
{
char str_name[30];
sprintf(str_name,"screen%d_arrange",k);
- htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
+ htsc_dump_byte_image(screen_matrix, width_supercell, height_supercell,
1, str_name);
}
-#endif
+#endif
}
/* Create the threshold mask. */
step_size = 256.0 / (double) N;
@@ -1338,8 +1338,8 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
for (k = 0; k < N; k++) {
thresholds[N-1-k] = (k + 1) * step_size - (step_size / 2);
}
- mag_offset =
- (double) (thresholds[0]-thresholds[1]) / (double) (num_levels+1);
+ mag_offset =
+ (double) (thresholds[0]-thresholds[1]) / (double) (num_levels+1);
if ( gamma != 1.0) {
for (k = 0; k < N; k++) {
temp_dbl = (double) pow((double) thresholds[k]/255.0, (double) gamma);
@@ -1352,9 +1352,9 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
/* allocate the mask */
final_mask->height = height_supercell;
final_mask->width = width_supercell;
- final_mask->data =
+ final_mask->data =
(int*) malloc(sizeof(int) * height_supercell * width_supercell);
- /* We need to associate the locate index with a particular level
+ /* We need to associate the locate index with a particular level
for the when the dot begins to turn on. Go through the dot_level_pos
array to get the values. Probably should create this earlier and avoid
this */
@@ -1364,7 +1364,7 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
for (jj = 0; jj < num_levels; jj++) {
curr_dot_level = &(dot_level_pos[jj]);
for (mm = 0; mm < curr_dot_level->number_points; mm++) {
- if (pos_x[h] == curr_dot_level->point[mm].x &&
+ if (pos_x[h] == curr_dot_level->point[mm].x &&
pos_y[h] == curr_dot_level->point[mm].y ) {
found = true;
dot_level_sort[h] = jj + 1;
@@ -1386,11 +1386,11 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
val = htsc_getpoint(&dot_grid, k, j);
if (val != 0) {
/* Assign a offset threshold values */
- j_index =
+ j_index =
(pos_y[h] + j - (int) dot_grid_one_index.y) % height_supercell;
- k_index =
+ k_index =
(pos_x[h] + k - (int) dot_grid_one_index.x) % width_supercell;
- threshold_value = thresholds[val-1] +
+ threshold_value = thresholds[val-1] +
mag_offset * dot_level_sort[h];
if (threshold_value > 255) threshold_value = 255;
if (threshold_value < 0) threshold_value = 0;
@@ -1414,8 +1414,8 @@ htsc_create_dither_mask(htsc_dig_grid_t super_cell, htsc_dig_grid_t *final_mask,
}
}
-void
-htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
+void
+htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
double gamma, htsc_dig_grid_t *final_mask)
{
double step_size = 256.0 /( (double) H * (double) L);
@@ -1437,11 +1437,11 @@ htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
if ( gamma != 1.0) {
/* Possible linearization */
temp = (double) pow((double) temp, (double) gamma);
- }
+ }
thresholds[number_points - k - 1] = ROUND(temp * 253.0 + 1);
}
memset(final_mask->data, 0, H * L * sizeof(int));
-
+
for (j = 0; j < H; j++) {
for (k = 0; k < L; k++) {
index_point = htsc_getpoint(&super_cell,k,j) - 1;
@@ -1452,8 +1452,8 @@ htsc_create_holladay_mask(htsc_dig_grid_t super_cell, int H, int L,
free(thresholds);
}
-void
-htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
+void
+htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
double gamma, htsc_dig_grid_t *final_mask)
{
double step_size = 256.0 /( (double) H * (double) L);
@@ -1467,7 +1467,7 @@ htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
final_mask->height = super_cell.height;
final_mask->width = super_cell.width;
- final_mask->data = (int *) malloc(super_cell.height * super_cell.width *
+ final_mask->data = (int *) malloc(super_cell.height * super_cell.width *
sizeof(int));
thresholds = (double *) malloc(H * L * sizeof(double));
for (k = 0; k < number_points; k++) {
@@ -1475,10 +1475,10 @@ htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
if ( gamma != 1.0) {
/* Possible linearization */
temp = (double) pow((double) temp, (double) gamma);
- }
+ }
thresholds[number_points - k - 1] = ROUND(temp * 253.0 + 1);
}
- memset(final_mask->data, 0, super_cell.height * super_cell.width *
+ memset(final_mask->data, 0, super_cell.height * super_cell.width *
sizeof(int));
for (j = 0; j < super_cell.height; j++) {
for (k = 0; k < super_cell.width; k++) {
@@ -1490,8 +1490,8 @@ htsc_create_nondithered_mask(htsc_dig_grid_t super_cell, int H, int L,
free(thresholds);
}
-void
-htsc_save_mask(htsc_dig_grid_t final_mask, bool use_holladay_grid, int S,
+void
+htsc_save_mask(htsc_dig_grid_t final_mask, bool use_holladay_grid, int S,
output_format_type output_format)
{
char full_file_name[50];
@@ -1502,63 +1502,63 @@ htsc_save_mask(htsc_dig_grid_t final_mask, bool use_holladay_grid, int S,
int height = final_mask.height;
byte data;
char *output_extension = (output_format == OUTPUT_PS) ? "ps" :
- ((output_format == OUTPUT_PPM) ? "ppm" : "raw");
-
+ ((output_format == OUTPUT_PPM) ? "ppm" : "raw");
+
if (use_holladay_grid) {
- sprintf(full_file_name,"Screen_Holladay_Shift%d_%dx%d.%s", S, width,
+ sprintf(full_file_name,"Screen_Holladay_Shift%d_%dx%d.%s", S, width,
height, output_extension);
} else {
- sprintf(full_file_name,"Screen_Dithered_%dx%d.%s",width,height,
+ sprintf(full_file_name,"Screen_Dithered_%dx%d.%s",width,height,
output_extension);
}
fid = fopen(full_file_name,"wb");
if (output_format == OUTPUT_PPM)
- fprintf(fid, "P5\n"
- "# Halftone threshold array, %s, [%d, %d], S=%d\n"
- "%d %d\n"
- "255\n",
- use_holladay_grid ? "Holladay_Shift" : "Dithered", width, height,
+ fprintf(fid, "P5\n"
+ "# Halftone threshold array, %s, [%d, %d], S=%d\n"
+ "%d %d\n"
+ "255\n",
+ use_holladay_grid ? "Holladay_Shift" : "Dithered", width, height,
S, width, height);
if (output_format != OUTPUT_PS) {
- /* Both BIN and PPM format write the same binary data */
- for (y = 0; y < height; y++) {
- for ( x = 0; x < width; x++ ) {
- data = (byte) *buff_ptr;
- fwrite(&data,sizeof(byte),1,fid);
- buff_ptr++;
- }
- }
+ /* Both BIN and PPM format write the same binary data */
+ for (y = 0; y < height; y++) {
+ for ( x = 0; x < width; x++ ) {
+ data = (byte) *buff_ptr;
+ fwrite(&data,sizeof(byte),1,fid);
+ buff_ptr++;
+ }
+ }
} else {
- /* Output PS HalftoneType 3 dictionary */
- fprintf(fid, "%%!PS\n"
- "<< /HalftoneType 3\n"
- " /Width %d\n"
- " /Height %d\n"
- " /Thresholds <\n",
- width, height);
-
- for (y = 0; y < height; y++) {
- for ( x = 0; x < width; x++ ) {
- data = (byte) *buff_ptr;
- fprintf(fid, "%02x", data);
- buff_ptr++;
- if ((x & 0x1f) == 0x1f && (x != (width - 1)))
- fprintf(fid, "\n");
- }
- fprintf(fid, "\n");
- }
- fprintf(fid, " >\n"
- ">>\n"
- );
+ /* Output PS HalftoneType 3 dictionary */
+ fprintf(fid, "%%!PS\n"
+ "<< /HalftoneType 3\n"
+ " /Width %d\n"
+ " /Height %d\n"
+ " /Thresholds <\n",
+ width, height);
+
+ for (y = 0; y < height; y++) {
+ for ( x = 0; x < width; x++ ) {
+ data = (byte) *buff_ptr;
+ fprintf(fid, "%02x", data);
+ buff_ptr++;
+ if ((x & 0x1f) == 0x1f && (x != (width - 1)))
+ fprintf(fid, "\n");
+ }
+ fprintf(fid, "\n");
+ }
+ fprintf(fid, " >\n"
+ ">>\n"
+ );
}
fclose(fid);
}
-
+
#if RAW_SCREEN_DUMP
void
-htsc_dump_screen(htsc_dig_grid_t *dig_grid, char filename[])
+htsc_dump_screen(htsc_dig_grid_t *dig_grid, char filename[])
{
char full_file_name[50];
FILE *fid;
@@ -1595,7 +1595,7 @@ htsc_dump_screen(htsc_dig_grid_t *dig_grid, char filename[])
void
htsc_dump_float_image(float *image, int height, int width, float max_val,
- char filename[])
+ char filename[])
{
char full_file_name[50];
FILE *fid;
@@ -1619,7 +1619,7 @@ htsc_dump_float_image(float *image, int height, int width, float max_val,
void
htsc_dump_byte_image(byte *image, int height, int width, float max_val,
- char filename[])
+ char filename[])
{
char full_file_name[50];
FILE *fid;
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/CIELAB.h b/gs/toolbin/color/icc_creator/ICC_Creator/CIELAB.h
index 39ccb305a..c65331725 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/CIELAB.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/CIELAB.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -29,4 +29,3 @@ typedef struct colornames_s {
int length;
} colornames_t;
-
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h b/gs/toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h
index 639f217b8..18a953682 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/ICC_Creator.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,16 +11,14 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
#pragma once
#ifndef __AFXWIN_H__
- #error "include 'stdafx.h' before including this file for PCH"
+ #error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
-
// CICC_CreatorApp:
// See ICC_Creator.cpp for the implementation of this class
//
@@ -28,15 +26,15 @@
class CICC_CreatorApp : public CWinApp
{
public:
- CICC_CreatorApp();
+ CICC_CreatorApp();
// Overrides
- public:
- virtual BOOL InitInstance();
+ public:
+ virtual BOOL InitInstance();
// Implementation
- DECLARE_MESSAGE_MAP()
+ DECLARE_MESSAGE_MAP()
};
-extern CICC_CreatorApp theApp; \ No newline at end of file
+extern CICC_CreatorApp theApp;
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h b/gs/toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h
index 5fb01f67d..a8c463e90 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/ICC_CreatorDlg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,7 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
#pragma once
#include "CIELAB.h"
@@ -23,18 +22,17 @@ class CICC_CreatorDlg : public CDialog
{
// Construction
public:
- CICC_CreatorDlg(CWnd* pParent = NULL); // standard constructor
+ CICC_CreatorDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
- enum { IDD = IDD_ICC_CREATOR_DIALOG };
-
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ enum { IDD = IDD_ICC_CREATOR_DIALOG };
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
- HICON m_hIcon;
+ HICON m_hIcon;
int GetCIELAB(LPCTSTR lpszPathName);
int GetNames(LPCTSTR lpszPathName);
@@ -49,19 +47,18 @@ protected:
int m_num_icc_colorants;
int m_sample_rate;
- // Generated message map functions
- virtual BOOL OnInitDialog();
- afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- DECLARE_MESSAGE_MAP()
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedCielab();
afx_msg void OnBnClickedNames();
afx_msg void OnBnClickedIccProfile();
afx_msg void OnBnClickedIccHelp();
-
afx_msg void OnBnClickedCmyk2gray();
afx_msg void OnBnClickedGray2cmyk();
afx_msg void OnBnClickedCmyk2rgb();
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/icc34.h b/gs/toolbin/color/icc_creator/ICC_Creator/icc34.h
index 6ac4625a8..97451240f 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/icc34.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/icc34.h
@@ -2,55 +2,55 @@
#ifndef ICC_H
#define ICC_H
-/*****************************************************************
+/*****************************************************************
Copyright (c) 1994-1996 SunSoft, Inc.
Rights Reserved
-Permission is hereby granted, free of charge, to any person
+Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without restrict-
-ion, including without limitation the rights to use, copy, modify,
-merge, publish distribute, sublicense, and/or sell copies of the
-Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+files (the "Software"), to deal in the Software without restrict-
+ion, including without limitation the rights to use, copy, modify,
+merge, publish distribute, sublicense, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
-INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
-COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of SunSoft, Inc.
-shall not be used in advertising or otherwise to promote the
-sale, use or other dealings in this Software without written
-authorization from SunSoft Inc.
+INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
+COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of SunSoft, Inc.
+shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without written
+authorization from SunSoft Inc.
******************************************************************/
/*
* This version of the header file corresponds to the profile
* specification version 3.4.
*
- * All header file entries are pre-fixed with "ic" to help
+ * All header file entries are pre-fixed with "ic" to help
* avoid name space collisions. Signatures are pre-fixed with
* icSig.
*
* The structures defined in this header file were created to
* represent a description of an ICC profile on disk. Rather
- * than use pointers a technique is used where a single byte array
+ * than use pointers a technique is used where a single byte array
* was placed at the end of each structure. This allows us in "C"
* to extend the structure by allocating more data than is needed
* to account for variable length structures.
*
* This also ensures that data following is allocated
* contiguously and makes it easier to write and read data from
- * the file.
+ * the file.
*
* For example to allocate space for a 256 count length UCR
* and BG array, and fill the allocated data. Note strlen + 1
@@ -62,20 +62,20 @@ authorization from SunSoft Inc.
char ucr_string[100], *ucr_char;
strcpy(ucr_string, "Example ucrBG curves");
- ucr_nbytes = sizeof(icUInt32Number) +
+ ucr_nbytes = sizeof(icUInt32Number) +
(UCR_CURVE_SIZE * sizeof(icUInt16Number));
- bg_nbytes = sizeof(icUInt32Number) +
+ bg_nbytes = sizeof(icUInt32Number) +
(BG_CURVE_SIZE * sizeof(icUInt16Number));
string_bytes = strlen(ucr_string) + 1;
ucrBgWrite = (icUcrBg *)malloc(
(ucr_nbytes + bg_nbytes + string_bytes));
-
+
ucrCurve = (icUcrBgCurve *)ucrBgWrite->data;
ucrCurve->count = UCR_CURVE_SIZE;
for (i=0; i<ucrCurve->count; i++)
ucrCurve->curve[i] = (icUInt16Number)i;
-
+
bgCurve = (icUcrBgCurve *)((char *)ucrCurve + ucr_nbytes);
bgCurve->count = BG_CURVE_SIZE;
for (i=0; i<bgCurve->count; i++)
@@ -106,7 +106,7 @@ authorization from SunSoft Inc.
#define icLinesPerInch 0x00000002L /* Bit pos 1 */
#define icLinesPerCm 0x00000000L /* Bit pos 1 */
-/*
+/*
* Device attributes, currently defined values correspond
* to the low 4 bytes of the 8 byte attribute quantity, see
* the header for their location.
@@ -126,15 +126,14 @@ authorization from SunSoft Inc.
#define icUseWithEmbeddedDataOnly 0x00000002L /* Bit pos 1 */
/* Ascii or Binary data */
-#define icAsciiData 0x00000000L
+#define icAsciiData 0x00000000L
#define icBinaryData 0x00000001L
-/*
+/*
* Define used to indicate that this is a variable length array
*/
#define icAny 1
-
/*------------------------------------------------------------------------*/
/*
* Use this area to translate platform definitions of long
@@ -143,12 +142,11 @@ authorization from SunSoft Inc.
*
*/
-
#ifdef PACKAGE_NAME
/*
June 9, 2003, Adapted for use with configure by Bob Friesenhahn
- Added the stupid check for autoconf by Marti Maria.
- PACKAGE_NAME is defined if autoconf is being used
+ Added the stupid check for autoconf by Marti Maria.
+ PACKAGE_NAME is defined if autoconf is being used
*/
typedef @UINT8_T@ icUInt8Number;
@@ -163,7 +161,7 @@ typedef @INT32_T@ icInt64Number[2];
#else
-/*
+/*
*Apr-17-2002: Modified by Marti Maria in order to provide wider portability.
*/
@@ -187,7 +185,6 @@ typedef int32_t icInt64Number[2];
#ifdef __sgi
#include "sgidefs.h"
-
/*
* Number definitions
*/
@@ -204,8 +201,7 @@ typedef short icInt16Number;
typedef __int32_t icInt32Number;
typedef __int32_t icInt64Number[2];
-
-#else
+#else
#if defined(__GNUC__) || defined(__unix__) || defined(__unix)
#include <sys/types.h>
@@ -216,7 +212,6 @@ typedef __int32_t icInt64Number[2];
#include <stdint.h>
#endif
-
typedef uint8_t icUInt8Number;
typedef uint16_t icUInt16Number;
typedef uint32_t icUInt32Number;
@@ -232,14 +227,12 @@ typedef u_int32_t icUInt64Number[2];
#endif
-
/* Signed numbers */
typedef int8_t icInt8Number;
typedef int16_t icInt16Number;
typedef int32_t icInt32Number;
typedef int32_t icInt64Number[2];
-
#else /* default definitions */
/*
@@ -258,7 +251,6 @@ typedef short icInt16Number;
typedef long icInt32Number;
typedef long icInt64Number[2];
-
#endif /* default defs */
#endif
#endif
@@ -270,20 +262,19 @@ typedef icInt32Number icSignature;
typedef icInt32Number icS15Fixed16Number;
typedef icUInt32Number icU16Fixed16Number;
-
/*------------------------------------------------------------------------*/
/* public tags and sizes */
typedef enum {
- icSigAToB0Tag = 0x41324230L, /* 'A2B0' */
+ icSigAToB0Tag = 0x41324230L, /* 'A2B0' */
icSigAToB1Tag = 0x41324231L, /* 'A2B1' */
- icSigAToB2Tag = 0x41324232L, /* 'A2B2' */
+ icSigAToB2Tag = 0x41324232L, /* 'A2B2' */
icSigBlueColorantTag = 0x6258595AL, /* 'bXYZ' */
icSigBlueTRCTag = 0x62545243L, /* 'bTRC' */
icSigBToA0Tag = 0x42324130L, /* 'B2A0' */
icSigBToA1Tag = 0x42324131L, /* 'B2A1' */
icSigBToA2Tag = 0x42324132L, /* 'B2A2' */
icSigCalibrationDateTimeTag = 0x63616C74L, /* 'calt' */
- icSigCharTargetTag = 0x74617267L, /* 'targ' */
+ icSigCharTargetTag = 0x74617267L, /* 'targ' */
icSigCopyrightTag = 0x63707274L, /* 'cprt' */
icSigCrdInfoTag = 0x63726469L, /* 'crdi' */
icSigDeviceMfgDescTag = 0x646D6E64L, /* 'dmnd' */
@@ -296,7 +287,7 @@ typedef enum {
icSigMeasurementTag = 0x6D656173L, /* 'meas' */
icSigMediaBlackPointTag = 0x626B7074L, /* 'bkpt' */
icSigMediaWhitePointTag = 0x77747074L, /* 'wtpt' */
- icSigNamedColorTag = 0x6E636f6CL, /* 'ncol'
+ icSigNamedColorTag = 0x6E636f6CL, /* 'ncol'
* OBSOLETE, use ncl2 */
icSigNamedColor2Tag = 0x6E636C32L, /* 'ncl2' */
icSigPreview0Tag = 0x70726530L, /* 'pre0' */
@@ -318,7 +309,7 @@ typedef enum {
icSigUcrBgTag = 0x62666420L, /* 'bfd ' */
icSigViewingCondDescTag = 0x76756564L, /* 'vued' */
icSigViewingConditionsTag = 0x76696577L, /* 'view' */
- icMaxEnumTag = 0xFFFFFFFFL
+ icMaxEnumTag = 0xFFFFFFFFL
} icTagSignature;
/* technology signature descriptions */
@@ -326,7 +317,7 @@ typedef enum {
icSigDigitalCamera = 0x6463616DL, /* 'dcam' */
icSigFilmScanner = 0x6673636EL, /* 'fscn' */
icSigReflectiveScanner = 0x7273636EL, /* 'rscn' */
- icSigInkJetPrinter = 0x696A6574L, /* 'ijet' */
+ icSigInkJetPrinter = 0x696A6574L, /* 'ijet' */
icSigThermalWaxPrinter = 0x74776178L, /* 'twax' */
icSigElectrophotographicPrinter = 0x6570686FL, /* 'epho' */
icSigElectrostaticPrinter = 0x65737461L, /* 'esta' */
@@ -345,7 +336,7 @@ typedef enum {
icSigOffsetLithography = 0x6F666673L, /* 'offs' */
icSigSilkscreen = 0x73696C6BL, /* 'silk' */
icSigFlexography = 0x666C6578L, /* 'flex' */
- icMaxEnumTechnology = 0xFFFFFFFFL
+ icMaxEnumTechnology = 0xFFFFFFFFL
} icTechnologySignature;
/* type signatures */
@@ -356,7 +347,7 @@ typedef enum {
icSigLut16Type = 0x6d667432L, /* 'mft2' */
icSigLut8Type = 0x6d667431L, /* 'mft1' */
icSigMeasurementType = 0x6D656173L, /* 'meas' */
- icSigNamedColorType = 0x6E636f6CL, /* 'ncol'
+ icSigNamedColorType = 0x6E636f6CL, /* 'ncol'
* OBSOLETE, use ncl2 */
icSigProfileSequenceDescType = 0x70736571L, /* 'pseq' */
icSigS15Fixed16ArrayType = 0x73663332L, /* 'sf32' */
@@ -375,14 +366,14 @@ typedef enum {
icSigXYZArrayType = 0x58595A20L, /* 'XYZ ' */
icSigNamedColor2Type = 0x6E636C32L, /* 'ncl2' */
icSigCrdInfoType = 0x63726469L, /* 'crdi' */
- icMaxEnumType = 0xFFFFFFFFL
+ icMaxEnumType = 0xFFFFFFFFL
} icTagTypeSignature;
-/*
+/*
* Color Space Signatures
* Note that only icSigXYZData and icSigLabData are valid
* Profile Connection Spaces (PCSs)
- */
+ */
typedef enum {
icSigXYZData = 0x58595A20L, /* 'XYZ ' */
icSigLabData = 0x4C616220L, /* 'Lab ' */
@@ -409,7 +400,7 @@ typedef enum {
icSig13colorData = 0x44434C52L, /* 'DCLR' */
icSig14colorData = 0x45434C52L, /* 'ECLR' */
icSig15colorData = 0x46434C52L, /* 'FCLR' */
- icMaxEnumData = 0xFFFFFFFFL
+ icMaxEnumData = 0xFFFFFFFFL
} icColorSpaceSignature;
/* profileClass enumerations */
@@ -421,7 +412,7 @@ typedef enum {
icSigAbstractClass = 0x61627374L, /* 'abst' */
icSigColorSpaceClass = 0x73706163L, /* 'spac' */
icSigNamedColorClass = 0x6e6d636cL, /* 'nmcl' */
- icMaxEnumClass = 0xFFFFFFFFL
+ icMaxEnumClass = 0xFFFFFFFFL
} icProfileClassSignature;
/* Platform Signatures */
@@ -431,7 +422,7 @@ typedef enum {
icSigSolaris = 0x53554E57L, /* 'SUNW' */
icSigSGI = 0x53474920L, /* 'SGI ' */
icSigTaligent = 0x54474E54L, /* 'TGNT' */
- icMaxEnumPlatform = 0xFFFFFFFFL
+ icMaxEnumPlatform = 0xFFFFFFFFL
} icPlatformSignature;
/*------------------------------------------------------------------------*/
@@ -443,7 +434,7 @@ typedef enum {
typedef enum {
icFlare0 = 0x00000000L, /* 0% flare */
icFlare100 = 0x00000001L, /* 100% flare */
- icMaxFlare = 0xFFFFFFFFL
+ icMaxFlare = 0xFFFFFFFFL
} icMeasurementFlare;
/* Measurement Geometry, used in the measurmentType tag */
@@ -451,7 +442,7 @@ typedef enum {
icGeometryUnknown = 0x00000000L, /* Unknown */
icGeometry045or450 = 0x00000001L, /* 0/45, 45/0 */
icGeometry0dord0 = 0x00000002L, /* 0/d or d/0 */
- icMaxGeometry = 0xFFFFFFFFL
+ icMaxGeometry = 0xFFFFFFFFL
} icMeasurementGeometry;
/* Rendering Intents, used in the profile header */
@@ -460,7 +451,7 @@ typedef enum {
icRelativeColorimetric = 1,
icSaturation = 2,
icAbsoluteColorimetric = 3,
- icMaxEnumIntent = 0xFFFFFFFFL
+ icMaxEnumIntent = 0xFFFFFFFFL
} icRenderingIntent;
/* Different Spot Shapes currently defined, used for screeningType */
@@ -473,7 +464,7 @@ typedef enum {
icSpotShapeLine = 5,
icSpotShapeSquare = 6,
icSpotShapeCross = 7,
- icMaxEnumSpot = 0xFFFFFFFFL
+ icMaxEnumSpot = 0xFFFFFFFFL
} icSpotShape;
/* Standard Observer, used in the measurmentType tag */
@@ -481,7 +472,7 @@ typedef enum {
icStdObsUnknown = 0x00000000L, /* Unknown */
icStdObs1931TwoDegrees = 0x00000001L, /* 2 deg */
icStdObs1964TenDegrees = 0x00000002L, /* 10 deg */
- icMaxStdObs = 0xFFFFFFFFL
+ icMaxStdObs = 0xFFFFFFFFL
} icStandardObserver;
/* Pre-defined illuminants, used in measurement and viewing conditions type */
@@ -493,15 +484,14 @@ typedef enum {
icIlluminantF2 = 0x00000004L,
icIlluminantD55 = 0x00000005L,
icIlluminantA = 0x00000006L,
- icIlluminantEquiPowerE = 0x00000007L,
- icIlluminantF8 = 0x00000008L,
- icMaxEnumIluminant = 0xFFFFFFFFL
+ icIlluminantEquiPowerE = 0x00000007L,
+ icIlluminantF8 = 0x00000008L,
+ icMaxEnumIluminant = 0xFFFFFFFFL
} icIlluminant;
-
/*------------------------------------------------------------------------*/
/*
- * Arrays of numbers
+ * Arrays of numbers
*/
/* Int8 Array */
@@ -543,7 +533,7 @@ typedef struct {
typedef struct {
icInt64Number data[icAny]; /* Variable array of values */
} icInt64Array;
-
+
/* u16Fixed16 Array */
typedef struct {
icU16Fixed16Number data[icAny]; /* Variable array of values */
@@ -599,13 +589,13 @@ typedef struct {
icUInt8Number clutPoints; /* Number of grid points */
icInt8Number pad; /* Padding for byte alignment */
icS15Fixed16Number e00; /* e00 in the 3 * 3 */
- icS15Fixed16Number e01; /* e01 in the 3 * 3 */
+ icS15Fixed16Number e01; /* e01 in the 3 * 3 */
icS15Fixed16Number e02; /* e02 in the 3 * 3 */
icS15Fixed16Number e10; /* e10 in the 3 * 3 */
- icS15Fixed16Number e11; /* e11 in the 3 * 3 */
- icS15Fixed16Number e12; /* e12 in the 3 * 3 */
+ icS15Fixed16Number e11; /* e11 in the 3 * 3 */
+ icS15Fixed16Number e12; /* e12 in the 3 * 3 */
icS15Fixed16Number e20; /* e20 in the 3 * 3 */
- icS15Fixed16Number e21; /* e21 in the 3 * 3 */
+ icS15Fixed16Number e21; /* e21 in the 3 * 3 */
icS15Fixed16Number e22; /* e22 in the 3 * 3 */
icUInt16Number inputEnt; /* Num of in-table entries */
icUInt16Number outputEnt; /* Num of out-table entries */
@@ -614,7 +604,7 @@ typedef struct {
* Data that follows is of this form
*
* icUInt16Number inputTable[inputChan][icAny]; * The in-table
- * icUInt16Number clutTable[icAny]; * The clut
+ * icUInt16Number clutTable[icAny]; * The clut
* icUInt16Number outputTable[outputChan][icAny]; * The out-table
*/
} icLut16;
@@ -626,20 +616,20 @@ typedef struct {
icUInt8Number clutPoints; /* Num of grid points */
icInt8Number pad;
icS15Fixed16Number e00; /* e00 in the 3 * 3 */
- icS15Fixed16Number e01; /* e01 in the 3 * 3 */
+ icS15Fixed16Number e01; /* e01 in the 3 * 3 */
icS15Fixed16Number e02; /* e02 in the 3 * 3 */
icS15Fixed16Number e10; /* e10 in the 3 * 3 */
- icS15Fixed16Number e11; /* e11 in the 3 * 3 */
- icS15Fixed16Number e12; /* e12 in the 3 * 3 */
+ icS15Fixed16Number e11; /* e11 in the 3 * 3 */
+ icS15Fixed16Number e12; /* e12 in the 3 * 3 */
icS15Fixed16Number e20; /* e20 in the 3 * 3 */
- icS15Fixed16Number e21; /* e21 in the 3 * 3 */
+ icS15Fixed16Number e21; /* e21 in the 3 * 3 */
icS15Fixed16Number e22; /* e22 in the 3 * 3 */
icUInt8Number data[icAny]; /* Data follows see spec */
/*
* Data that follows is of this form
*
* icUInt8Number inputTable[inputChan][256]; * The in-table
- * icUInt8Number clutTable[icAny]; * The clut
+ * icUInt8Number clutTable[icAny]; * The clut
* icUInt8Number outputTable[outputChan][256]; * The out-table
*/
} icLut8;
@@ -656,7 +646,7 @@ typedef struct {
/* Named color */
/*
- * icNamedColor2 takes the place of icNamedColor
+ * icNamedColor2 takes the place of icNamedColor
*/
typedef struct {
icUInt32Number vendorFlag; /* Bottom 16 bits for IC use */
@@ -677,16 +667,16 @@ typedef struct {
* :
* :
* Repeat for name and PCS and device color coordinates up to (count-1)
- *
- * NOTES:
+ *
+ * NOTES:
* PCS and device space can be determined from the header.
*
- * PCS coordinates are icUInt16 numbers and are described in Annex A of
- * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of
+ * PCS coordinates are icUInt16 numbers and are described in Annex A of
+ * the ICC spec. Only 16 bit L*a*b* and XYZ are allowed. The number of
* coordinates is consistent with the headers PCS.
*
* Device coordinates are icUInt16 numbers where 0x0000 represents
- * the minimum value and 0xFFFF represents the maximum value.
+ * the minimum value and 0xFFFF represents the maximum value.
* If the nDeviceCoords value is 0 this field is not given.
*/
} icNamedColor2;
@@ -700,7 +690,7 @@ typedef struct {
icInt8Number data[icAny]; /* Desc text follows */
/*
* Data that follows is of this form, this is an icInt8Number
- * to avoid problems with a compiler generating bad code as
+ * to avoid problems with a compiler generating bad code as
* these arrays are variable in length.
*
* icTextDescription deviceMfgDesc; * Manufacturer text
@@ -760,7 +750,7 @@ typedef struct {
icInt8Number data[icAny]; /* The Ucr BG data */
/*
* Data that follows is of this form, this is a icInt8Number
- * to avoid problems with a compiler generating bad code as
+ * to avoid problems with a compiler generating bad code as
* these arrays are variable in length.
*
* icUcrBgCurve ucr; * Ucr curve
@@ -907,7 +897,7 @@ typedef struct {
icTagBase base; /* Signature, "ui64" */
icUInt64Array data; /* Variable array of values */
} icUInt64ArrayType;
-
+
/* uInt8Type */
typedef struct {
icTagBase base; /* Signature, "ui08" */
@@ -934,11 +924,11 @@ typedef struct {
icCrdInfo info; /* 5 sets of counts & strings */
}icCrdInfoType;
/* icCrdInfo productName; PS product count/string */
- /* icCrdInfo CRDName0; CRD name for intent 0 */
- /* icCrdInfo CRDName1; CRD name for intent 1 */
- /* icCrdInfo CRDName2; CRD name for intent 2 */
+ /* icCrdInfo CRDName0; CRD name for intent 0 */
+ /* icCrdInfo CRDName1; CRD name for intent 1 */
+ /* icCrdInfo CRDName2; CRD name for intent 2 */
/* icCrdInfo CRDName3; CRD name for intent 3 */
-
+
/*------------------------------------------------------------------------*/
/*
@@ -948,8 +938,8 @@ typedef struct {
/* A tag */
typedef struct {
icTagSignature sig; /* The tag signature */
- icUInt32Number offset; /* Start of tag relative to
- * start of header, Spec
+ icUInt32Number offset; /* Start of tag relative to
+ * start of header, Spec
* Clause 5 */
icUInt32Number size; /* Size in bytes */
} icTag;
@@ -981,8 +971,8 @@ typedef struct {
icInt8Number reserved[44]; /* Reserved */
} icHeader;
-/*
- * A profile,
+/*
+ * A profile,
* we can't use icTagList here because its not at the end of the structure
*/
typedef struct {
@@ -992,10 +982,10 @@ typedef struct {
/*
* Data that follows is of the form
*
- * icTag tagTable[icAny]; * The tag table
- * icInt8Number tagData[icAny]; * The tag data
+ * icTag tagTable[icAny]; * The tag table
+ * icInt8Number tagData[icAny]; * The tag data
*/
-} icProfile;
+} icProfile;
/*------------------------------------------------------------------------*/
/* Obsolete entries */
@@ -1008,12 +998,12 @@ typedef struct {
/*
* Data that follows is of this form
*
- * icInt8Number prefix[icAny]; * Prefix
- * icInt8Number suffix[icAny]; * Suffix
- * icInt8Number root1[icAny]; * Root name
- * icInt8Number coords1[icAny]; * Color coordinates
- * icInt8Number root2[icAny]; * Root name
- * icInt8Number coords2[icAny]; * Color coordinates
+ * icInt8Number prefix[icAny]; * Prefix
+ * icInt8Number suffix[icAny]; * Suffix
+ * icInt8Number root1[icAny]; * Root name
+ * icInt8Number coords1[icAny]; * Color coordinates
+ * icInt8Number root2[icAny]; * Root name
+ * icInt8Number coords2[icAny]; * Color coordinates
* :
* :
* Repeat for root name and color coordinates up to (count-1)
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/icc_create.h b/gs/toolbin/color/icc_creator/ICC_Creator/icc_create.h
index 387341326..46b2d0272 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/icc_create.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/icc_create.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2009 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -11,8 +11,6 @@
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
-
-
#ifndef gsicc_create_INCLUDED
# define gsicc_create_INCLUDED
@@ -25,14 +23,13 @@ typedef enum {
RGB2CMYK
} link_t;
-typedef struct ucr_bg {
+typedef struct ucr_bg {
unsigned char *cyan;
unsigned char *magenta;
unsigned char *yellow;
unsigned char *black;
} ucrbg_t;
-
int create_devicen_profile(cielab_t *cielab, colornames_t *colorant_names, int num_colors, int num_samples, TCHAR FileName[]);
int create_devicelink_profile(TCHAR FileName[],link_t link_type);
int create_psrgb_profile(TCHAR FileName[]);
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/resource.h b/gs/toolbin/color/icc_creator/ICC_Creator/resource.h
index 535aa3bb5..767908f98 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/resource.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/resource.h
@@ -30,7 +30,7 @@
#define IDC_CHECK1 1015
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/stdafx.h b/gs/toolbin/color/icc_creator/ICC_Creator/stdafx.h
index 8ae60714f..536318581 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/stdafx.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/stdafx.h
@@ -22,11 +22,8 @@
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
-
#include <afxdisp.h> // MFC Automation classes
-
-
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
@@ -34,14 +31,6 @@
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
-
-
-
-
-
-
-
-
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
@@ -53,5 +42,3 @@
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
-
-
diff --git a/gs/toolbin/color/icc_creator/ICC_Creator/targetver.h b/gs/toolbin/color/icc_creator/ICC_Creator/targetver.h
index 11730d5da..28ff06c94 100644
--- a/gs/toolbin/color/icc_creator/ICC_Creator/targetver.h
+++ b/gs/toolbin/color/icc_creator/ICC_Creator/targetver.h
@@ -1,9 +1,8 @@
-
#pragma once
// The following macros define the minimum required platform. The minimum required platform
-// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
-// your application. The macros work by enabling all features available on platform versions up to and
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
@@ -23,4 +22,3 @@
#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
#endif
-
diff --git a/gs/toolbin/drawafm.ps b/gs/toolbin/drawafm.ps
index e4e1d2251..a8403b6bc 100644
--- a/gs/toolbin/drawafm.ps
+++ b/gs/toolbin/drawafm.ps
@@ -1,6 +1,6 @@
% Draw all glyphs from the AFM
%
-% expects AFM to be the file for the font
+% expects AFM to be the file for the font
%
% For example:
%
@@ -28,12 +28,12 @@
/skiptokens {
true 3 1 roll
{ token { pop } { not () exit } ifelse } repeat
- exch
+ exch
} bind def
% --------------------------------------------------------------------
% Find the /FontName line and load that font
-/FontName searchtoken
+/FontName searchtoken
token not {
(OOPS: /FontName line didn't have a name following) = flush quit
} if
@@ -71,9 +71,9 @@ findfont FONTSIZE scalefont setfont
[ exch
4 {
token not {
- (OOPS: C line missing Metrics value) = flush quit
- } if
- exch
+ (OOPS: C line missing Metrics value) = flush quit
+ } if
+ exch
} repeat
pop % discard remaining paramters
] /Metrics exch def
diff --git a/gs/toolbin/encs2c.ps b/gs/toolbin/encs2c.ps
index 2c0cdf615..98f26853f 100644
--- a/gs/toolbin/encs2c.ps
+++ b/gs/toolbin/encs2c.ps
@@ -73,21 +73,21 @@
(#include "gstypes.h") =
(#include "gscedata.h") =
- % Write the name strings, sorted by increasing length, and
- % alphabetically increasing within the same length.
+ % Write the name strings, sorted by increasing length, and
+ % alphabetically increasing within the same length.
(
const char gs_c_known_encoding_chars[] = {) =
1 1 maxlen {
/len exch def
/noff 0 def
- % Collect and sort names of this length.
+ % Collect and sort names of this length.
[ estrs {
pop dup length len ne { pop } { .namestring } ifelse
} forall ] /lt load .sort
- % Output the names.
+ % Output the names.
{
dup {
- (') print (x) dup 0 4 -1 roll put print (',) print
+ (') print (x) dup 0 4 -1 roll put print (',) print
} forall
( /*N\() print len =only (,) print noff =only (\)*/) =
estrs exch get noff ne {
@@ -101,7 +101,7 @@ const char gs_c_known_encoding_chars[] = {) =
const int gs_c_known_encoding_total_chars = ) print
offset =only (;) =
- % Write the starting offsets of the names of each length.
+ % Write the starting offsets of the names of each length.
/numchars 0 estrs { pop length add } forall def
(
const int gs_c_known_encoding_max_length = ) print
@@ -113,7 +113,7 @@ const ushort gs_c_known_encoding_offsets[] = {) =
} for
numchars =only (};) =
- % Write the encodings themselves.
+ % Write the encodings themselves.
(
const int gs_c_known_encoding_count = ) print
encodings length =only (;) =
@@ -152,7 +152,7 @@ const int gs_c_known_encoding_count = ) print
/i i 1 add def
} forall
- % Write the table of pointers to the encodings.
+ % Write the table of pointers to the encodings.
(
const ushort *const gs_c_known_encodings[] = {) =
0 1 encodings length 1 sub {
@@ -168,8 +168,7 @@ const ushort *const gs_c_known_encodings[] = {) =
} for ( 0
};) =
-
- % Write the table of encoding lengths.
+ % Write the table of encoding lengths.
(
const ushort gs_c_known_encoding_lengths[] = {) =
0 1 encodings length 1 sub {
@@ -297,11 +296,11 @@ lbase 0 0 put
/len exch def
lbase len offset put
/noff 0 def
- % Collect and sort names of this length.
+ % Collect and sort names of this length.
[ estrs {
pop dup length len ne { pop } { .namestring } ifelse
} forall ] /lt load .sort
- % Output the names.
+ % Output the names.
{
estrs exch noff put
/noff noff len add def
diff --git a/gs/toolbin/extractFonts.ps b/gs/toolbin/extractFonts.ps
index 781256ce9..dc882c091 100644
--- a/gs/toolbin/extractFonts.ps
+++ b/gs/toolbin/extractFonts.ps
@@ -1,6 +1,6 @@
% Copyright (C) 2009 Artifex Software, Inc.
% All Rights Reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
@@ -35,7 +35,7 @@
pop closefile
} bind def
-/extractFonts { % (filename) extractFonts
+/extractFonts { % (filename) extractFonts
/FontsFound 100 dict def
(r) file runpdfbegin
1 1 pdfpagecount % stack: first_page# last_page#
@@ -43,59 +43,58 @@
pdfgetpage % get pagedict
/Resources pget {
/Font knownoget {
- { exch pop oforce
+ { exch pop oforce
dup /DescendantFonts knownoget {
exch pop 0 get oforce
} if
- dup /FontDescriptor knownoget {
+ dup /FontDescriptor knownoget {
dup /FontFile known 1 index /FontFile2 known or exch /FontFile3 known or
- {
+ {
% embedded font found!
- dup /BaseFont oget
- FontsFound 1 index known not {
- 1 index /Subtype oget
- FontsFound 2 index 2 index put % mark the font we found
- % data for different types of fonts is handled separately
- % stack: -dict- BaseFont Subtype
- dup /Type1 eq {
- 2 index /FontDescriptor oget
- dup /FontFile knownoget {
- true resolvestream
- 2 index 100 string cvs (.pfb) concatstrings
- (Extracting Type1 font: ) print dup = flush
- (w) file copyfile
- } if
- /FontFile3 knownoget {
- dup /Subtype oget /Type1C ne {
- (Warning: Font ) print 2 index =print ( of type: ) print dup
- /Subtype oget =print ( is being written with extension .cff) = flush
- } if
- true resolvestream
- 2 index 100 string cvs (.cff) concatstrings
- (Extracting Type1C font: ) print dup = flush
- (w) file copyfile
- } if
- } if
- dup /TrueType eq {
- 2 index /FontDescriptor oget
- dup ===
- /FontFile2 oget true resolvestream
- 2 index 100 string cvs (.ttf) concatstrings
- (Extracting TrueType font: ) print dup = flush
- (w) file copyfile
- } if
- pop pop % done with BaseFont and Subtype
- } if % end if font not already in FontsFound
- pop % done with the font resource dictionary
- } {
- pop % not embedded
- } ifelse
- } {
- pop % no FontDescriptor, not embedded
- } ifelse
- } forall % traverse the Font resource dictionary
+ dup /BaseFont oget
+ FontsFound 1 index known not {
+ 1 index /Subtype oget
+ FontsFound 2 index 2 index put % mark the font we found
+ % data for different types of fonts is handled separately
+ % stack: -dict- BaseFont Subtype
+ dup /Type1 eq {
+ 2 index /FontDescriptor oget
+ dup /FontFile knownoget {
+ true resolvestream
+ 2 index 100 string cvs (.pfb) concatstrings
+ (Extracting Type1 font: ) print dup = flush
+ (w) file copyfile
+ } if
+ /FontFile3 knownoget {
+ dup /Subtype oget /Type1C ne {
+ (Warning: Font ) print 2 index =print ( of type: ) print dup
+ /Subtype oget =print ( is being written with extension .cff) = flush
+ } if
+ true resolvestream
+ 2 index 100 string cvs (.cff) concatstrings
+ (Extracting Type1C font: ) print dup = flush
+ (w) file copyfile
+ } if
+ } if
+ dup /TrueType eq {
+ 2 index /FontDescriptor oget
+ dup ===
+ /FontFile2 oget true resolvestream
+ 2 index 100 string cvs (.ttf) concatstrings
+ (Extracting TrueType font: ) print dup = flush
+ (w) file copyfile
+ } if
+ pop pop % done with BaseFont and Subtype
+ } if % end if font not already in FontsFound
+ pop % done with the font resource dictionary
+ } {
+ pop % not embedded
+ } ifelse
+ } {
+ pop % no FontDescriptor, not embedded
+ } ifelse
+ } forall % traverse the Font resource dictionary
} if
- } if
+ } if
} for
} bind def
-
diff --git a/gs/toolbin/extractICCprofiles.ps b/gs/toolbin/extractICCprofiles.ps
index ed129e47e..2a6b42568 100644
--- a/gs/toolbin/extractICCprofiles.ps
+++ b/gs/toolbin/extractICCprofiles.ps
@@ -1,6 +1,6 @@
% Copyright (C) 2009 Artifex Software, Inc.
% All Rights Reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
@@ -43,7 +43,7 @@
pop closefile
} bind def
-/extractICCprofiles { % (prefix) (filename) extractICCprofiles
+/extractICCprofiles { % (prefix) (filename) extractICCprofiles
/DoICCin /ICCin where { pop true } { /ICCout where { pop false } { true } ifelse } ifelse def
/DoICCout /ICCout where { pop true } { /ICCin where { pop false } { true } ifelse } ifelse def
currentglobal true setglobal /CSNameDict 100 dict def setglobal
@@ -55,30 +55,30 @@
1 exch {
pdfgetpage % get pagedict
/Resources pget {
- /ColorSpace knownoget {
- {
- CSNameDict 2 index known not {
- oforce
- % stack: CSname CSobject
- dup type /arraytype eq {
- dup 0 get /ICCBased eq {
- dup PDFfile fileposition exch
- 1 oget
- mark exch { oforce } forall .dicttomark
- true resolvestream
- % construct a destination file name
- fnprefix 4 index 100 string cvs concatstrings
- (Found ICC input profile, extracting to: ) print dup = flush
- (w) file copyfile
- PDFfile exch setfileposition
- currentglobal true setglobal CSNameDict 3 index //null put setglobal
- } if % CS must be ICCBased
- } if % ICCBased must be array
- } if % CS Resource Name already known ?
- pop pop % done with CSname and object
- } forall % enumerate the ColorSpace Resource dict
- } if
- } if
+ /ColorSpace knownoget {
+ {
+ CSNameDict 2 index known not {
+ oforce
+ % stack: CSname CSobject
+ dup type /arraytype eq {
+ dup 0 get /ICCBased eq {
+ dup PDFfile fileposition exch
+ 1 oget
+ mark exch { oforce } forall .dicttomark
+ true resolvestream
+ % construct a destination file name
+ fnprefix 4 index 100 string cvs concatstrings
+ (Found ICC input profile, extracting to: ) print dup = flush
+ (w) file copyfile
+ PDFfile exch setfileposition
+ currentglobal true setglobal CSNameDict 3 index //null put setglobal
+ } if % CS must be ICCBased
+ } if % ICCBased must be array
+ } if % CS Resource Name already known ?
+ pop pop % done with CSname and object
+ } forall % enumerate the ColorSpace Resource dict
+ } if
+ } if
} for % for each Page
} {
pop pop
@@ -89,21 +89,21 @@
/ICCoutcount 1 def
Trailer /Root oget /OutputIntents knownoget {
{ % process all output profiles present
- dup /DestOutputProfile knownoget {
- PDFfile fileposition exch
- mark exch { oforce } forall .dicttomark
- true resolvestream
+ dup /DestOutputProfile knownoget {
+ PDFfile fileposition exch
+ mark exch { oforce } forall .dicttomark
+ true resolvestream
(ICC output profile, extracted to: ) print
- fnprefix ICCoutcount 10 string cvs concatstrings
- dup = flush
- (w) file
- copyfile
- PDFfile exch setfileposition
- dup /OutputCondition knownoget { ( OutputCondition: ) print = } if
- dup /OutputConditionIdentifier knownoget { ( OutputConditionIdentifier: ) print = } if
- dup /Info knownoget { ( Info: ) print = } if
- /ICCoutcount dup load 1 add def
- } if
+ fnprefix ICCoutcount 10 string cvs concatstrings
+ dup = flush
+ (w) file
+ copyfile
+ PDFfile exch setfileposition
+ dup /OutputCondition knownoget { ( OutputCondition: ) print = } if
+ dup /OutputConditionIdentifier knownoget { ( OutputConditionIdentifier: ) print = } if
+ dup /Info knownoget { ( Info: ) print = } if
+ /ICCoutcount dup load 1 add def
+ } if
pop % done with this OutputIntent dictionary
} forall
} if % OutputIntents known
diff --git a/gs/toolbin/genfontmap.ps b/gs/toolbin/genfontmap.ps
index 2bcd445ac..1a2a610d0 100644
--- a/gs/toolbin/genfontmap.ps
+++ b/gs/toolbin/genfontmap.ps
@@ -1,13 +1,13 @@
%!PS
% Copyright (C) 2003 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -16,7 +16,7 @@
% $Id$
% Create a Fontmap format file after scanning the FONTPATH directories
-%
+%
% Example usage:
% windows: gswin32c -q -sFONTPATH=c:/windows/fonts genfontmap.ps > myFontmap
%
@@ -59,7 +59,7 @@ count array astore
dup 0 get % get the name of the font
% Since the name might be Unicode, write it as a string
100 string cvs ==only
- ( ) print 1 get 0 get ==only ( ;) =
+ ( ) print 1 get 0 get ==only ( ;) =
} forall
flush
diff --git a/gs/toolbin/jpxtopdf.c b/gs/toolbin/jpxtopdf.c
index 0f49c0b8c..a0a3151ec 100644
--- a/gs/toolbin/jpxtopdf.c
+++ b/gs/toolbin/jpxtopdf.c
@@ -158,7 +158,7 @@ void box_print(box_t *box)
box_ihdr_t *ihdr = box->rez;
if (ihdr)
fprintf(stderr, " %ux%u %u component image with %d bit %s samples",
- ihdr->width, ihdr->height, ihdr->nc,
+ ihdr->width, ihdr->height, ihdr->nc,
ihdr->bpc, ihdr->sign ? "signed" : "unsigned");
else
fprintf(stderr, " no parse result");
@@ -180,7 +180,7 @@ static int jpx_read_imagedata(imagedata * jpx)
in = fopen(jpx->filename, "rb");
if (in == NULL) {
fprintf(stderr, "Error: could not open input file '%s'\n",
- jpx->filename);
+ jpx->filename);
return FALSE;
}
@@ -210,14 +210,14 @@ static int jpx_read_imagedata(imagedata * jpx)
if (!memcmp(box->type, "jp2h", 4)) {
box->next = box_read(buf + offset + 8, box->size);
if (box->next) {
- box_ihdr_t *ihdr = box->next->rez;
+ box_ihdr_t *ihdr = box->next->rez;
#ifdef DEBUG
box_print(box->next);
#endif
- jpx->width = ihdr->width;
- jpx->height = ihdr->height;
- jpx->numcmpts = ihdr->nc;
- jpx->depth = ihdr->bpc;
+ jpx->width = ihdr->width;
+ jpx->height = ihdr->height;
+ jpx->numcmpts = ihdr->nc;
+ jpx->depth = ihdr->bpc;
box_free(box->next);
header = TRUE;
}
@@ -235,136 +235,135 @@ static int jpx_read_imagedata(imagedata * jpx)
}
fprintf(stderr,
- "Note on file '%s': %dx%d pixel, %d color component%s, dpi %lf\n",
- jpx->filename, jpx->width, jpx->height,
- jpx->numcmpts, (jpx->numcmpts == 1 ? "" : "s"),
- jpx->dpi);
+ "Note on file '%s': %dx%d pixel, %d color component%s, dpi %lf\n",
+ jpx->filename, jpx->width, jpx->height,
+ jpx->numcmpts, (jpx->numcmpts == 1 ? "" : "s"),
+ jpx->dpi);
if (jpx->dpi == 0.0)
- jpx->dpi = 100.0;
+ jpx->dpi = 100.0;
return TRUE;
}
static int jpx_pdf(imagedata * jpx, FILE * out)
{
- FILE *in;
- unsigned char buf[BUFSIZE];
- int n;
- double scale;
-
- if ( !jpx_read_imagedata(jpx) ) return -1;
-
- in = fopen(jpx->filename, "rb");
- if (in == NULL) {
- fprintf(stderr, "Error: unable to open input file '%s'\n", jpx->filename);
- return -1;
- }
- fseek(in, 0, SEEK_END);
- jpx->filesize = ftell(in);
- fseek(in, 0, SEEK_SET);
-
- xref[nxref++] = ftell(out);
- fprintf(out, "%d 0 obj\n", nxref);
- fprintf(out, "<</Type/XObject/Subtype/Image\n");
- fprintf(out, "/Width %d /Height %d\n", jpx->width, jpx->height);
- fprintf(out, "/ColorSpace/%s\n", jpx->numcmpts == 1 ? "DeviceGray" : "DeviceRGB");
- fprintf(out, "/BitsPerComponent %d\n", jpx->depth);
- fprintf(out, "/Length %d\n", jpx->filesize);
- fprintf(out, "/Filter/JPXDecode\n");
- fprintf(out, ">>\n");
- fprintf(out, "stream\n");
-
- /* copy data from jpx file */
- while ((n = fread(buf, 1, sizeof(buf), in)) != 0)
- fwrite(buf, 1, n, out);
-
- fprintf(out, "endstream\n");
- fprintf(out, "endobj\n");
- fprintf(out, "\n");
-
- fclose(in);
-
- scale = 72.0 / jpx->dpi;
- sprintf((char *)buf, "%d 0 0 %d 0 0 cm /x%d Do\n",
- (int)ceil(jpx->width * scale),
- (int)ceil(jpx->height * scale),
- nxref);
-
- xref[nxref++] = ftell(out);
- fprintf(out, "%d 0 obj\n<</Length %lu>>\n",
- nxref, (unsigned long)strlen((char*)buf));
- fprintf(out, "stream\n");
- fprintf(out, "%s", buf);
- fprintf(out, "endstream\n");
- fprintf(out, "endobj\n");
- fprintf(out, "\n");
-
- xref[nxref++] = ftell(out);
- fprintf(out, "%d 0 obj\n", nxref);
- fprintf(out, "<</Type/Page/Parent 3 0 R\n");
- fprintf(out, "/Resources << /XObject << /x%d %d 0 R >> >>\n", nxref-2, nxref-2);
- fprintf(out, "/MediaBox [0 0 %d %d]\n",
- (int)ceil(jpx->width * scale),
- (int)ceil(jpx->height * scale));
- fprintf(out, "/Contents %d 0 R\n", nxref-1);
- fprintf(out, ">>\n");
- fprintf(out, "endobj\n");
- fprintf(out, "\n");
-
- return nxref;
+ FILE *in;
+ unsigned char buf[BUFSIZE];
+ int n;
+ double scale;
+
+ if ( !jpx_read_imagedata(jpx) ) return -1;
+
+ in = fopen(jpx->filename, "rb");
+ if (in == NULL) {
+ fprintf(stderr, "Error: unable to open input file '%s'\n", jpx->filename);
+ return -1;
+ }
+ fseek(in, 0, SEEK_END);
+ jpx->filesize = ftell(in);
+ fseek(in, 0, SEEK_SET);
+
+ xref[nxref++] = ftell(out);
+ fprintf(out, "%d 0 obj\n", nxref);
+ fprintf(out, "<</Type/XObject/Subtype/Image\n");
+ fprintf(out, "/Width %d /Height %d\n", jpx->width, jpx->height);
+ fprintf(out, "/ColorSpace/%s\n", jpx->numcmpts == 1 ? "DeviceGray" : "DeviceRGB");
+ fprintf(out, "/BitsPerComponent %d\n", jpx->depth);
+ fprintf(out, "/Length %d\n", jpx->filesize);
+ fprintf(out, "/Filter/JPXDecode\n");
+ fprintf(out, ">>\n");
+ fprintf(out, "stream\n");
+
+ /* copy data from jpx file */
+ while ((n = fread(buf, 1, sizeof(buf), in)) != 0)
+ fwrite(buf, 1, n, out);
+
+ fprintf(out, "endstream\n");
+ fprintf(out, "endobj\n");
+ fprintf(out, "\n");
+
+ fclose(in);
+
+ scale = 72.0 / jpx->dpi;
+ sprintf((char *)buf, "%d 0 0 %d 0 0 cm /x%d Do\n",
+ (int)ceil(jpx->width * scale),
+ (int)ceil(jpx->height * scale),
+ nxref);
+
+ xref[nxref++] = ftell(out);
+ fprintf(out, "%d 0 obj\n<</Length %lu>>\n",
+ nxref, (unsigned long)strlen((char*)buf));
+ fprintf(out, "stream\n");
+ fprintf(out, "%s", buf);
+ fprintf(out, "endstream\n");
+ fprintf(out, "endobj\n");
+ fprintf(out, "\n");
+
+ xref[nxref++] = ftell(out);
+ fprintf(out, "%d 0 obj\n", nxref);
+ fprintf(out, "<</Type/Page/Parent 3 0 R\n");
+ fprintf(out, "/Resources << /XObject << /x%d %d 0 R >> >>\n", nxref-2, nxref-2);
+ fprintf(out, "/MediaBox [0 0 %d %d]\n",
+ (int)ceil(jpx->width * scale),
+ (int)ceil(jpx->height * scale));
+ fprintf(out, "/Contents %d 0 R\n", nxref-1);
+ fprintf(out, ">>\n");
+ fprintf(out, "endobj\n");
+ fprintf(out, "\n");
+
+ return nxref;
}
int main(int argc, char **argv)
{
- imagedata image;
- FILE *outfile;
- int i;
- int startxref;
+ imagedata image;
+ FILE *outfile;
+ int i;
+ int startxref;
- image.filename = NULL;
+ image.filename = NULL;
- outfile = fopen("out.pdf", "w");
+ outfile = fopen("out.pdf", "w");
- fprintf(outfile, "%%PDF-1.5\n\n");
+ fprintf(outfile, "%%PDF-1.5\n\n");
- xref[nxref++] = ftell(outfile);
- fprintf(outfile, "1 0 obj\n");
- fprintf(outfile, "<</Type/Catalog/Pages 3 0 R>>\n");
- fprintf(outfile, "endobj\n\n");
+ xref[nxref++] = ftell(outfile);
+ fprintf(outfile, "1 0 obj\n");
+ fprintf(outfile, "<</Type/Catalog/Pages 3 0 R>>\n");
+ fprintf(outfile, "endobj\n\n");
- xref[nxref++] = ftell(outfile);
- fprintf(outfile, "2 0 obj\n");
- fprintf(outfile, "<</Creator(jpxtopdf)/Title(%s)>>\n", getenv("TITLE"));
- fprintf(outfile, "endobj\n\n");
+ xref[nxref++] = ftell(outfile);
+ fprintf(outfile, "2 0 obj\n");
+ fprintf(outfile, "<</Creator(jpxtopdf)/Title(%s)>>\n", getenv("TITLE"));
+ fprintf(outfile, "endobj\n\n");
- /* delay obj #3 (pages) until later */
- nxref++;
+ /* delay obj #3 (pages) until later */
+ nxref++;
- for (i = 1; i < argc; i++) {
- image.filename = argv[i];
+ for (i = 1; i < argc; i++) {
+ image.filename = argv[i];
- /* copy the jpx stream wrapped in a pdf object */
- pages[npages++] = jpx_pdf(&image, outfile);
- }
+ /* copy the jpx stream wrapped in a pdf object */
+ pages[npages++] = jpx_pdf(&image, outfile);
+ }
- xref[2] = ftell(outfile);
- fprintf(outfile, "3 0 obj\n");
- fprintf(outfile, "<</Type/Pages/Count %d/Kids[\n", npages);
- for (i = 0; i < npages; i++)
- fprintf(outfile, "%d 0 R\n", pages[i]);
- fprintf(outfile, "]>>\nendobj\n\n");
+ xref[2] = ftell(outfile);
+ fprintf(outfile, "3 0 obj\n");
+ fprintf(outfile, "<</Type/Pages/Count %d/Kids[\n", npages);
+ for (i = 0; i < npages; i++)
+ fprintf(outfile, "%d 0 R\n", pages[i]);
+ fprintf(outfile, "]>>\nendobj\n\n");
- startxref = ftell(outfile);
- fprintf(outfile, "xref\n0 %d\n", nxref + 1);
- fprintf(outfile, "0000000000 65535 f \n");
- for (i = 0; i < nxref; i++)
- fprintf(outfile, "%010d 00000 n \n", xref[i]);
- fprintf(outfile, "trailer\n<< /Size %d /Root 1 0 R /Info 2 0 R >>\n", nxref + 1);
- fprintf(outfile, "startxref\n%d\n%%%%EOF\n", startxref);
+ startxref = ftell(outfile);
+ fprintf(outfile, "xref\n0 %d\n", nxref + 1);
+ fprintf(outfile, "0000000000 65535 f \n");
+ for (i = 0; i < nxref; i++)
+ fprintf(outfile, "%010d 00000 n \n", xref[i]);
+ fprintf(outfile, "trailer\n<< /Size %d /Root 1 0 R /Info 2 0 R >>\n", nxref + 1);
+ fprintf(outfile, "startxref\n%d\n%%%%EOF\n", startxref);
- fclose(outfile);
+ fclose(outfile);
- return 0;
+ return 0;
}
-
diff --git a/gs/toolbin/pdf_info.ps b/gs/toolbin/pdf_info.ps
index 32e91a332..d32c665dd 100644
--- a/gs/toolbin/pdf_info.ps
+++ b/gs/toolbin/pdf_info.ps
@@ -1,13 +1,13 @@
%!PS
% Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -36,12 +36,12 @@
[ shellarguments
{ counttomark 1 eq {
- dup 0 get (-) 0 get ne {
- % File specified on the command line using: -- toolbin/pdf_info.ps infile.pdf
- /File exch def
- false % don't show usage
+ dup 0 get (-) 0 get ne {
+ % File specified on the command line using: -- toolbin/pdf_info.ps infile.pdf
+ /File exch def
+ false % don't show usage
} {
- true % show usage and quit
+ true % show usage and quit
} ifelse
} { true } ifelse
{
@@ -50,7 +50,7 @@
quit
} if
} if
-
+
/File where not {
(\n *** Missing input file name \(use -sFile=____.pdf\)\n) =
( usage: gs -dNODISPLAY -q -sFile=____.pdf [ options ] toolbin/pdf_info.ps\n) =
@@ -85,7 +85,7 @@ DumpMediaSizes
() =
% Print out the Page Size info for each page.
1 1 PDFPageCount {
- dup (Page ) print =print
+ dup (Page ) print =print
pdfgetpage dup
/MediaBox pget {
aload pop exch 4 1 roll exch sub 3 1 roll sub
@@ -99,7 +99,7 @@ DumpMediaSizes
( Rotate = ) print =print
} if
pageusestransparency {
- ( Page uses transparency features) print
+ ( Page uses transparency features) print
} if
() = flush
} for
@@ -120,24 +120,24 @@ DumpMediaSizes
pdfgetpage % get pagedict
/Resources pget {
/Font knownoget {
- { exch pop oforce
+ { exch pop oforce
dup /DescendantFonts knownoget {
exch pop 0 get oforce
} if
- dup /FontDescriptor knownoget {
+ dup /FontDescriptor knownoget {
dup /FontFile known 1 index /FontFile2 known or exch /FontFile3 known or
- /ShowEmbeddedFonts where { pop pop false} if {
- pop % skip embedded fonts
- } {
- /BaseFont knownoget pop % not embedded
- } ifelse
- } {
- /BaseFont knownoget pop % no FontDescriptor, not embedded
- } ifelse
- counttomark 0 gt { FontsUsed exch null put } if % stick it in the dict
- } forall % traverse the dictionary
+ /ShowEmbeddedFonts where { pop pop false} if {
+ pop % skip embedded fonts
+ } {
+ /BaseFont knownoget pop % not embedded
+ } ifelse
+ } {
+ /BaseFont knownoget pop % no FontDescriptor, not embedded
+ } ifelse
+ counttomark 0 gt { FontsUsed exch null put } if % stick it in the dict
+ } forall % traverse the dictionary
} if
- } if
+ } if
} for
% If DumpFontsUsed is not true, then remove the 'standard' fonts from the list
systemdict /DumpFontsUsed known not {
@@ -146,7 +146,7 @@ DumpMediaSizes
pop
} forall
} if
-
+
% Now dump the FontsUsed dict into an array so we can sort it.
[ FontsUsed { pop } forall ]
{ 100 string cvs exch 100 string cvs exch lt } .sort
@@ -166,8 +166,7 @@ systemdict /DumpFontsUsed known
pop
(\nNo system fonts are needed.) =
} ifelse
- } if
+ } if
} ifelse
-
quit
diff --git a/gs/toolbin/pdfinflt.ps b/gs/toolbin/pdfinflt.ps
index 94cb5a53b..b89001287 100644
--- a/gs/toolbin/pdfinflt.ps
+++ b/gs/toolbin/pdfinflt.ps
@@ -1,12 +1,12 @@
% Copyright (C) 1992, 1993, 1994, 1995, 1999 Aladdin Enterprises. All rights reserved.
-%
+%
% This software is provided AS-IS with no warranty, either express or
% implied.
-%
+%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
-%
+%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -15,22 +15,22 @@
% $Id$
% pdfinflt.ps
-%
+%
% Try to decompress any FlateDecode streams in the input file.
-%
+%
% Usage: gs -- toolbin/pdfinflt.ps infile outfile
%
% Requires: lib/pdfwrite.ps.
-%
-%
+%
+%
% It is not yet ready for prime time, but it is available for anyone wants
% to fix it.
-%
+%
% The main problem is:
-%
+%
% 1. Sometimes the PDF files that are written are broken. When they are
% broken, GS gets an xref problem.
-%
+%
% This problem is actually due to lib/pdfwrite.ps since even
% when no conversion is done, the file is may be bad.
@@ -40,108 +40,108 @@
% Arguments ok
/OutFileName exch def
/InFileName exch def
-
+
(pdfwrite.ps) runlibfile
-
+
/justcopy /pdfcopystream load def
/filterstoremove <<
- % list of filters to apply
- % - kept as a dictionary, for faster searches
- /ASCIIHexDecode {}
+ % list of filters to apply
+ % - kept as a dictionary, for faster searches
+ /ASCIIHexDecode {}
/AHx { pop /ASCIIHexDecode } bind
- /ASCII85Decode {}
- /A85 { pop /ASCII85Decode } bind
- /LZWDecode {}
+ /ASCII85Decode {}
+ /A85 { pop /ASCII85Decode } bind
+ /LZWDecode {}
/LZW { pop /LZWDecode } bind
- /FlateDecode {}
+ /FlateDecode {}
/Fl { pop /FlateDecode } bind
- % /RunLengthDecode {}
+ % /RunLengthDecode {}
% /RL { pop /RunLengthDecode } bind
% /CCITTFaxDecode {}
% /CCF { pop /CCITTFaxDecode } bind
- % /DCTDecode {}
+ % /DCTDecode {}
% /DCT { pop /DCTDecode } bind
- % /JBIG2Decode dup /Filter resourcestatus {pop pop (GS-specific)} {pop} ifelse
- % /JPXDecode dup /Filter resourcestatus {pop pop (GS-specific)} {pop} ifelse
- % /Crypt (no equivalent)
- >> def
+ % /JBIG2Decode dup /Filter resourcestatus {pop pop (GS-specific)} {pop} ifelse
+ % /JPXDecode dup /Filter resourcestatus {pop pop (GS-specific)} {pop} ifelse
+ % /Crypt (no equivalent)
+ >> def
/pdfcopystream { % <newstreamdict> <file> pdfcopystream -
- % (file has been positioned)
- 1 index /Filter known {
+ % (file has been positioned)
+ 1 index /Filter known {
10 dict begin
- %stack: <newstreamdict> <file>
- /infile exch def /sdict exch def
- RMap ld_length neg omapnew pop /lenobj exch def
- /copyofsdict sdict dup length dict copy def
- copyofsdict dup /Length lenobj /O cvx 2 packedarray cvx put
- infile sdict /Length oget () /SubFileDecode filter
- % apply filters to the (input) stream
- {
- %stack: <file>
- % extract first filter and its parameters
- {/DecodeParms/Filter} {
- copyofsdict exch knownoget {
- dup type /arraytype eq { 0 get } if
- } {
- null
- } ifelse
- } forall
- %stack: <file> <decode|null> <filter|null>
- dup null eq {
- pop pop exit
- } if
- filterstoremove 1 index .knownget {
+ %stack: <newstreamdict> <file>
+ /infile exch def /sdict exch def
+ RMap ld_length neg omapnew pop /lenobj exch def
+ /copyofsdict sdict dup length dict copy def
+ copyofsdict dup /Length lenobj /O cvx 2 packedarray cvx put
+ infile sdict /Length oget () /SubFileDecode filter
+ % apply filters to the (input) stream
+ {
+ %stack: <file>
+ % extract first filter and its parameters
+ {/DecodeParms/Filter} {
+ copyofsdict exch knownoget {
+ dup type /arraytype eq { 0 get } if
+ } {
+ null
+ } ifelse
+ } forall
+ %stack: <file> <decode|null> <filter|null>
+ dup null eq {
+ pop pop exit
+ } if
+ filterstoremove 1 index .knownget {
exec
- % apply the filter
- exch dup null eq { pop } { exch } ifelse
- filter
- %stack: <file>
- % remove first element from each of /Filter and /DecodeParms
- copyofsdict dup {/DecodeParms/Filter} {
- %stack: <file> <copyofsdict> <copyofsdict> </Key>
- 2 copy knownoget {
- dup type /arraytype eq {
- dup length dup 3 ge {
- 1 exch 1 sub getinterval put
- } {
- {
- {pop undef} % []
- {pop undef} % [elem]
- {1 get put} % [elem1 elem2]
- } exch get exec
- } ifelse
- } {
- pop undef
- } ifelse
- dup
- } {
- pop
- } ifelse
- } forall pop pop
- } {
- pop pop exit
- } ifelse
- } loop
- /infile exch def
- copyofsdict pdfwritevalue (stream\n) ows
- /opos OFile fileposition def
- infile dup OFile 16#7fffffff pdfcopybytes closefile
- /len OFile fileposition opos sub def
- (\nendstream\nendobj\n) ows
- lenobj pdfwriteobjheader len pdfwritevalue
- end
- } {
- justcopy
- } ifelse
+ % apply the filter
+ exch dup null eq { pop } { exch } ifelse
+ filter
+ %stack: <file>
+ % remove first element from each of /Filter and /DecodeParms
+ copyofsdict dup {/DecodeParms/Filter} {
+ %stack: <file> <copyofsdict> <copyofsdict> </Key>
+ 2 copy knownoget {
+ dup type /arraytype eq {
+ dup length dup 3 ge {
+ 1 exch 1 sub getinterval put
+ } {
+ {
+ {pop undef} % []
+ {pop undef} % [elem]
+ {1 get put} % [elem1 elem2]
+ } exch get exec
+ } ifelse
+ } {
+ pop undef
+ } ifelse
+ dup
+ } {
+ pop
+ } ifelse
+ } forall pop pop
+ } {
+ pop pop exit
+ } ifelse
+ } loop
+ /infile exch def
+ copyofsdict pdfwritevalue (stream\n) ows
+ /opos OFile fileposition def
+ infile dup OFile 16#7fffffff pdfcopybytes closefile
+ /len OFile fileposition opos sub def
+ (\nendstream\nendobj\n) ows
+ lenobj pdfwriteobjheader len pdfwritevalue
+ end
+ } {
+ justcopy
+ } ifelse
} def
-
+
{ InFileName (r) file } stopped
{ (\n*** Cannot open input file: ) print InFileName print ( ***\n\n) print flush
quit
}
if
pdfdict begin pdfopen begin
-
+
{ OutFileName (w) file } stopped
{ (\n*** Cannot open output file: ) print OutFileName print ( ***\n\n) print flush
quit
@@ -166,7 +166,7 @@
(\n*** Missing '--' preceding toolbin/pdfinflt.ps ***\n\n) print
cleartomark false % not in shell arguments mode (missing -- )
}
-ifelse
+ifelse
not {
(Usage: gs -- toolbin/pdfinflt.ps infile outfile\n\n) print flush
}
diff --git a/gs/toolbin/tests/fuzzy.c b/gs/toolbin/tests/fuzzy.c
index aef8613b6..250edb284 100644
--- a/gs/toolbin/tests/fuzzy.c
+++ b/gs/toolbin/tests/fuzzy.c
@@ -17,7 +17,7 @@ typedef int bool;
#define BMP_FILE_HEADER_SIZE 14
#define BMP_INFO_HEADER_SIZE 40
#define BMP_HEADER_SIZE ((BMP_FILE_HEADER_SIZE) + \
- (BMP_INFO_HEADER_SIZE))
+ (BMP_INFO_HEADER_SIZE))
#define MIN(x,y) ((x)>(y)?(y):(x))
#define MAX(x,y) ((x)>(y)?(x):(y))
@@ -84,22 +84,22 @@ image_get_rgb_scan_line (Image *image, uchar *buf)
else if (image->n_chan == 1 && image->bpp == 8)
{
for (x = 0; x < width; x++)
- {
- uchar g = image_buf[x];
- buf[x * 3] = g;
- buf[x * 3 + 1] = g;
- buf[x * 3 + 2] = g;
- }
+ {
+ uchar g = image_buf[x];
+ buf[x * 3] = g;
+ buf[x * 3 + 1] = g;
+ buf[x * 3 + 2] = g;
+ }
}
else if (image->n_chan == 1 && image->bpp == 1)
{
for (x = 0; x < width; x++)
- {
- uchar g = -!(image_buf[x >> 3] & (128 >> (x & 7)));
- buf[x * 3] = g;
- buf[x * 3 + 1] = g;
- buf[x * 3 + 2] = g;
- }
+ {
+ uchar g = -!(image_buf[x >> 3] & (128 >> (x & 7)));
+ buf[x * 3] = g;
+ buf[x * 3 + 1] = g;
+ buf[x * 3 + 2] = g;
+ }
}
else
code = -1;
@@ -112,8 +112,8 @@ image_get_rgb_scan_line_with_error (Image *image, uchar *buf, int image_index, i
int code = image_get_rgb_scan_line (image, buf);
if (code == 1) {
- *rcode = 1;
- printf("*** I/O error in file %d at y = %d\n", image_index, row_index);
+ *rcode = 1;
+ printf("*** I/O error in file %d at y = %d\n", image_index, row_index);
}
return code;
}
@@ -130,7 +130,6 @@ no_seek(Image *self, int y)
return 0;
}
-
typedef struct _ImagePnm ImagePnm;
struct _ImagePnm {
@@ -266,12 +265,12 @@ create_bmp_image(Image *templ, const char *path)
if (linebuf == NULL) {
printf ("Couldn't allocate dummy bmp line buffer; diff image may be corrupt.\n");
} else {
- int k;
+ int k;
memset(linebuf, 0, raster);
- for (k = 0; k < pnm->super.height; k++)
- fwrite(linebuf, 1, raster, pnm->f);
+ for (k = 0; k < pnm->super.height; k++)
+ fwrite(linebuf, 1, raster, pnm->f);
free(linebuf);
}
@@ -280,7 +279,6 @@ create_bmp_image(Image *templ, const char *path)
return pnm;
}
-
static int
image_pnm_get_scan_line (Image *self, uchar *buf)
{
@@ -348,7 +346,7 @@ open_pnm_image (ImagePnm *image)
do
{
if (fgets (linebuf, sizeof(linebuf), image->f) == NULL)
- return 1;
+ return 1;
}
while (linebuf[0] == '#');
if (sscanf (linebuf, "%d %d", &width, &height) != 2)
@@ -356,11 +354,11 @@ open_pnm_image (ImagePnm *image)
while (!maxval)
{
if (fgets (linebuf, sizeof(linebuf), image->f) == NULL)
- return 1;
+ return 1;
if (linebuf[0] == '#')
continue;
if (sscanf(linebuf, "%d", &maxval) != 1 || maxval <= 0 || maxval > 255)
- return 1;
+ return 1;
}
image->super.width = width;
image->super.height = height;
@@ -433,8 +431,8 @@ roll_window (uchar **buf, int window_size)
static bool
check_window (uchar **buf1, uchar **buf2,
- const FuzzyParams *fparams,
- int x, int y, int width, int height)
+ const FuzzyParams *fparams,
+ int x, int y, int width, int height)
{
int tolerance = fparams->tolerance;
int window_size = fparams->window_size;
@@ -451,26 +449,26 @@ check_window (uchar **buf1, uchar **buf2,
const uchar *row1 = buf1[j + half_win];
const uchar *row2 = buf2[j + half_win];
for (i = -half_win; i <= half_win; i++)
- if ((i != 0 || j != 0) &&
- x + i >= 0 && x + i < width &&
- y + j >= 0 && y + j < height)
- {
- if (abs (r1 - row2[(x + i) * 3]) <= tolerance &&
- abs (g1 - row2[(x + i) * 3 + 1]) <= tolerance &&
- abs (b1 - row2[(x + i) * 3 + 2]) <= tolerance)
- match1 = TRUE;
- if (abs (r2 - row1[(x + i) * 3]) <= tolerance &&
- abs (g2 - row1[(x + i) * 3 + 1]) <= tolerance &&
- abs (b2 - row1[(x + i) * 3 + 2]) <= tolerance)
- match2 = TRUE;
- }
+ if ((i != 0 || j != 0) &&
+ x + i >= 0 && x + i < width &&
+ y + j >= 0 && y + j < height)
+ {
+ if (abs (r1 - row2[(x + i) * 3]) <= tolerance &&
+ abs (g1 - row2[(x + i) * 3 + 1]) <= tolerance &&
+ abs (b1 - row2[(x + i) * 3 + 2]) <= tolerance)
+ match1 = TRUE;
+ if (abs (r2 - row1[(x + i) * 3]) <= tolerance &&
+ abs (g2 - row1[(x + i) * 3 + 1]) <= tolerance &&
+ abs (b2 - row1[(x + i) * 3 + 2]) <= tolerance)
+ match2 = TRUE;
+ }
}
return !(match1 && match2);
}
static int
fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams,
- FuzzyReport *freport, ImagePnm *image_out)
+ FuzzyReport *freport, ImagePnm *image_out)
{
int width = MIN(image1->width, image2->width);
int height = MIN(image1->height, image2->height);
@@ -500,9 +498,9 @@ fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams,
for (y = 0; y < MIN(half_win, height); y++)
{
if (image_get_rgb_scan_line_with_error (image1, buf1[half_win - y], 1, y, &rcode))
- goto ex;
+ goto ex;
if (image_get_rgb_scan_line_with_error (image2, buf2[half_win - y], 2, y, &rcode))
- goto ex;
+ goto ex;
}
/* Initialie remaining scanlines if height < half_win */
for (; y < half_win; y++) {
@@ -529,100 +527,100 @@ fuzzy_diff_images (Image *image1, Image *image2, const FuzzyParams *fparams,
if (y < height - half_win)
{
- if (image_get_rgb_scan_line_with_error (image1, row1, 1, y + half_win, &rcode))
- goto ex;
- if (image_get_rgb_scan_line_with_error (image2, row2, 2, y + half_win, &rcode))
- goto ex;
+ if (image_get_rgb_scan_line_with_error (image1, row1, 1, y + half_win, &rcode))
+ goto ex;
+ if (image_get_rgb_scan_line_with_error (image2, row2, 2, y + half_win, &rcode))
+ goto ex;
}
if (out_buf)
- memset(out_buf, 0, out_buffer_size);
+ memset(out_buf, 0, out_buffer_size);
if (memcmp(rowmid1, rowmid2, width * 3))
{
for (x = 0; x < width; x++)
- {
- if (rowmid1[x * 3] != rowmid2[x * 3] ||
- rowmid1[x * 3 + 1] != rowmid2[x * 3 + 1] ||
- rowmid1[x * 3 + 2] != rowmid2[x * 3 + 2])
- {
- freport->n_diff++;
- /* If max error is the largest it can be in a 3 band
+ {
+ if (rowmid1[x * 3] != rowmid2[x * 3] ||
+ rowmid1[x * 3 + 1] != rowmid2[x * 3 + 1] ||
+ rowmid1[x * 3 + 2] != rowmid2[x * 3 + 2])
+ {
+ freport->n_diff++;
+ /* If max error is the largest it can be in a 3 band
unsigned char image, then stop collecting this
information since we are likely dealing with a half
tone image and the max color error is not of interest */
- if ( freport->max_color_error < 440) {
+ if ( freport->max_color_error < 440) {
diff[0] = rowmid1[x * 3] - rowmid2[x * 3];
diff[1] = rowmid1[x * 3 + 1] - rowmid2[x * 3 + 1];
diff[2] = rowmid1[x * 3 + 2] - rowmid2[x * 3 + 2];
- color_diff = sqrt(diff[0]*diff[0] + diff[1]*diff[1] + diff[2]*diff[2]);
+ color_diff = sqrt(diff[0]*diff[0] + diff[1]*diff[1] + diff[2]*diff[2]);
if (color_diff > freport->max_color_error) {
freport->max_color_error = color_diff;
}
- if( freport->n_diff == 1) {
+ if( freport->n_diff == 1) {
freport->avg_color_error = color_diff;
} else {
- freport->avg_color_error =
- ( freport->avg_color_error*(freport->n_diff-1) +
+ freport->avg_color_error =
+ ( freport->avg_color_error*(freport->n_diff-1) +
color_diff) / freport->n_diff;
}
}
- if (abs (rowmid1[x * 3] - rowmid2[x * 3]) > tolerance ||
- abs (rowmid1[x * 3 + 1] - rowmid2[x * 3 + 1]) > tolerance ||
- abs (rowmid1[x * 3 + 2] - rowmid2[x * 3 + 2]) > tolerance)
- {
- freport->n_outof_tolerance++;
- if (check_window (buf1, buf2, fparams, x, y, width, height)) {
- freport->n_outof_window++;
- if (out_buf && x < image1->width) {
- out_buf[x * 3 + 0] = abs(rowmid1[x * 3 + 0]- rowmid2[x * 3 + 0]);
- out_buf[x * 3 + 1] = abs(rowmid1[x * 3 + 1]- rowmid2[x * 3 + 1]);
- out_buf[x * 3 + 2] = abs(rowmid1[x * 3 + 2]- rowmid2[x * 3 + 2]);
- }
- if (fparams->report_coordinates &&
- (abs(x - x0) > 1 && y == y0 || y - y0 > 1))
- {
- /* fixme : a contiguity test wanted. */
- x0 = x; y0 = y;
- mc++;
- if (mc < mmax) {
- printf("diff: x=%d y=%d c1=%02X%02X%02X c2=%02X%02X%02X\n", x, y,
- rowmid1[x * 3], rowmid1[x * 3 + 1], rowmid1[x * 3 + 2],
- rowmid2[x * 3], rowmid2[x * 3 + 1], rowmid2[x * 3 + 2]);
- } else if (mc == mmax)
- printf("Won't report more differences.\n");
- }
- }
- }
- }
- }
+ if (abs (rowmid1[x * 3] - rowmid2[x * 3]) > tolerance ||
+ abs (rowmid1[x * 3 + 1] - rowmid2[x * 3 + 1]) > tolerance ||
+ abs (rowmid1[x * 3 + 2] - rowmid2[x * 3 + 2]) > tolerance)
+ {
+ freport->n_outof_tolerance++;
+ if (check_window (buf1, buf2, fparams, x, y, width, height)) {
+ freport->n_outof_window++;
+ if (out_buf && x < image1->width) {
+ out_buf[x * 3 + 0] = abs(rowmid1[x * 3 + 0]- rowmid2[x * 3 + 0]);
+ out_buf[x * 3 + 1] = abs(rowmid1[x * 3 + 1]- rowmid2[x * 3 + 1]);
+ out_buf[x * 3 + 2] = abs(rowmid1[x * 3 + 2]- rowmid2[x * 3 + 2]);
+ }
+ if (fparams->report_coordinates &&
+ (abs(x - x0) > 1 && y == y0 || y - y0 > 1))
+ {
+ /* fixme : a contiguity test wanted. */
+ x0 = x; y0 = y;
+ mc++;
+ if (mc < mmax) {
+ printf("diff: x=%d y=%d c1=%02X%02X%02X c2=%02X%02X%02X\n", x, y,
+ rowmid1[x * 3], rowmid1[x * 3 + 1], rowmid1[x * 3 + 2],
+ rowmid2[x * 3], rowmid2[x * 3 + 1], rowmid2[x * 3 + 2]);
+ } else if (mc == mmax)
+ printf("Won't report more differences.\n");
+ }
+ }
+ }
+ }
+ }
}
roll_window (buf1, window_size);
roll_window (buf2, window_size);
if (out_buf) {
if (image_out->super.seek(&image_out->super, y))
- {
- printf ("I/O Error seeking to the output image position.\n");
- free(out_buf);
- out_buf = NULL;
- }
- else if (fwrite(out_buf, 1, out_buffer_size, image_out->f) != out_buffer_size)
- {
- printf ("I/O Error writing the output image.\n");
- free(out_buf);
- out_buf = NULL;
- }
+ {
+ printf ("I/O Error seeking to the output image position.\n");
+ free(out_buf);
+ out_buf = NULL;
+ }
+ else if (fwrite(out_buf, 1, out_buffer_size, image_out->f) != out_buffer_size)
+ {
+ printf ("I/O Error writing the output image.\n");
+ free(out_buf);
+ out_buf = NULL;
+ }
}
}
y += half_win;
for (; y < max_height; y++) {
if (y < image1->height) {
- if (image_get_rgb_scan_line_with_error(image1, buf1[0], 1, y, &rcode))
- goto ex;
+ if (image_get_rgb_scan_line_with_error(image1, buf1[0], 1, y, &rcode))
+ goto ex;
}
if (y < image2->height) {
- if (image_get_rgb_scan_line_with_error(image2, buf2[0], 2, y, &rcode))
- goto ex;
+ if (image_get_rgb_scan_line_with_error(image2, buf2[0], 2, y, &rcode))
+ goto ex;
}
}
ex:
@@ -642,9 +640,9 @@ get_arg (int argc, char **argv, int *pi, const char *arg)
{
(*pi)++;
if (*pi == argc)
- return NULL;
+ return NULL;
else
- return argv[*pi];
+ return argv[*pi];
}
}
@@ -676,31 +674,31 @@ main (int argc, char **argv)
const char *arg = argv[i];
if (arg[0] == '-')
- {
- switch (arg[1])
- {
- case 'w':
- fparams.window_size = atoi (get_arg (argc, argv, &i, arg + 2));
- if ((fparams.window_size & 1) == 0)
- {
- printf ("window size must be odd\n");
- return 1;
- }
- break;
- case 't':
- fparams.tolerance = atoi (get_arg (argc, argv, &i, arg + 2));
- break;
- case 'c':
- fparams.report_coordinates = TRUE;
- break;
- default:
- return usage ();
- }
- }
+ {
+ switch (arg[1])
+ {
+ case 'w':
+ fparams.window_size = atoi (get_arg (argc, argv, &i, arg + 2));
+ if ((fparams.window_size & 1) == 0)
+ {
+ printf ("window size must be odd\n");
+ return 1;
+ }
+ break;
+ case 't':
+ fparams.tolerance = atoi (get_arg (argc, argv, &i, arg + 2));
+ break;
+ case 'c':
+ fparams.report_coordinates = TRUE;
+ break;
+ default:
+ return usage ();
+ }
+ }
else if (fn_idx < sizeof(fn)/sizeof(fn[0]))
- fn[fn_idx++] = argv[i];
+ fn[fn_idx++] = argv[i];
else
- return usage ();
+ return usage ();
}
if (fn_idx < 2)
@@ -720,8 +718,8 @@ main (int argc, char **argv)
if (fn[2]) {
out_fn = malloc(strlen(fn[2]) + 5);
if (out_fn == NULL) {
- printf("Can't alloc the output file name.\n");
- return 1;
+ printf("Can't alloc the output file name.\n");
+ return 1;
}
}
@@ -749,30 +747,30 @@ main (int argc, char **argv)
return 1;
}
if (image1->width != image2->width) {
- printf("Different image width for page %d\n", page);
- rcode = MAX(rcode, 1);
+ printf("Different image width for page %d\n", page);
+ rcode = MAX(rcode, 1);
}
if (image1->height != image2->height) {
- printf("Different image height for page %d\n", page);
- rcode = MAX(rcode, 1);
+ printf("Different image height for page %d\n", page);
+ rcode = MAX(rcode, 1);
}
if (out_fn != NULL) {
int l = strlen(fn[2]);
strcpy(out_fn, fn[2]);
for (i = l; i >= 0; i--) {
- if (out_fn[i] == '\\' || out_fn[i] == '/' || out_fn[i] == '.')
- break;
+ if (out_fn[i] == '\\' || out_fn[i] == '/' || out_fn[i] == '.')
+ break;
}
if (out_fn[i] == '.') {
- char c;
+ char c;
- memmove(out_fn + i + 4, out_fn + i, l + 1 - i);
- c = out_fn[i + 4];
- sprintf(out_fn + i, "-%03d", page);
- out_fn[i + 4] = c;
+ memmove(out_fn + i + 4, out_fn + i, l + 1 - i);
+ c = out_fn[i + 4];
+ sprintf(out_fn + i, "-%03d", page);
+ out_fn[i + 4] = c;
} else
- sprintf(out_fn + l, "-%03d", page);
+ sprintf(out_fn + l, "-%03d", page);
image_out =
(!strcmp(fn[2]+ strlen(fn[2]) - 4, ".bmp") ? create_bmp_image
: create_pnm_image)
@@ -786,15 +784,15 @@ main (int argc, char **argv)
freport.avg_color_error = 0;
freport.max_color_error = 0;
if (fuzzy_diff_images (image1, image2, &fparams, &freport, image_out))
- return 1;
+ return 1;
if (image_out)
image_pnm_close (&image_out->super);
image_out = NULL;
if (freport.n_diff > 0)
{
printf ("%s: page %d: %d diff., %d out of tol., %d out of win., %3.2lf avg diff, %3.2lf max diff\n",
- fn[0], page, freport.n_diff, freport.n_outof_tolerance,
- freport.n_outof_window,freport.avg_color_error,
+ fn[0], page, freport.n_diff, freport.n_outof_tolerance,
+ freport.n_outof_window,freport.avg_color_error,
freport.max_color_error);
rcode = MAX(rcode, 1);
}
diff --git a/pcl/pcbiptrn.c b/pcl/pcbiptrn.c
index 5d351e693..1a5709a15 100644
--- a/pcl/pcbiptrn.c
+++ b/pcl/pcbiptrn.c
@@ -109,12 +109,11 @@ static const byte bi_data_array[(PCL_NUM_SHADE_PATTERNS + PCL_NUM_CROSSHATCH_PA
0x38, 0x1c, 0x70, 0x0e, 0xe0, 0x07, 0xc0, 0x03
};
-
#define make_pixmap(indx) \
{ (byte *)(bi_data_array + indx * 2 * 16), 2, {16, 16}, 0, 1, 1 }
static const gs_depth_bitmap bi_pixmap_array[PCL_NUM_CROSSHATCH_PATTERNS +
- PCL_NUM_SHADE_PATTERNS] = {
+ PCL_NUM_SHADE_PATTERNS] = {
make_pixmap(0),
make_pixmap(1),
make_pixmap(2),
@@ -222,7 +221,7 @@ pcl_pattern_clear_bi_patterns(pcl_state_t *pcs)
}
}
-/*
+/*
* pcl patterns are always always 300 dpi but we use the device
* resolution on devices lower than 300 dpi so we can at least see the
* patterns on screen resolution devices. We also provide a #define
@@ -240,19 +239,19 @@ pcl_get_pattern_resolution(pcl_state_t *pcs, gs_point *pattern_res)
pattern_res->y = 300;
/* get the current resolutions based on the device. */
{
- gs_point device_res;
- gx_device *pdev = gs_currentdevice(pcs->pgs);
- device_res.x = pdev->HWResolution[0];
- device_res.y = pdev->HWResolution[1];
+ gs_point device_res;
+ gx_device *pdev = gs_currentdevice(pcs->pgs);
+ device_res.x = pdev->HWResolution[0];
+ device_res.y = pdev->HWResolution[1];
#ifdef DEVICE_RES_PATTERNS
- pattern_res->x = device_res.x;
- pattern_res->y = device_res.y;
+ pattern_res->x = device_res.x;
+ pattern_res->y = device_res.y;
#else
- /* if both are less than 300 dpi override the 300 dpi default. */
- if ( (device_res.x < 300) && (device_res.y < 300) ) {
- pattern_res->x = device_res.x;
- pattern_res->y = device_res.y;
- }
+ /* if both are less than 300 dpi override the 300 dpi default. */
+ if ( (device_res.x < 300) && (device_res.y < 300) ) {
+ pattern_res->x = device_res.x;
+ pattern_res->y = device_res.y;
+ }
#endif
}
return 0;
@@ -265,13 +264,13 @@ pcl_get_pattern_resolution(pcl_state_t *pcs, gs_point *pattern_res)
get_bi_pattern(pcl_state_t *pcs, int indx)
{
if (pcs->bi_pattern_array[indx] == 0) {
- gs_point pattern_res;
- pcl_get_pattern_resolution(pcs, &pattern_res);
+ gs_point pattern_res;
+ pcl_get_pattern_resolution(pcs, &pattern_res);
(void)pcl_pattern_build_pattern( &(pcs->bi_pattern_array[indx]),
&(bi_pixmap_array[indx]),
pcl_pattern_uncolored,
- pattern_res.x,
- pattern_res.y,
+ pattern_res.x,
+ pattern_res.y,
pcs->memory
);
pcs->bi_pattern_array[indx]->ppat_data->storage = pcds_internal;
@@ -289,21 +288,21 @@ pcl_pattern_get_shade(pcl_state_t *pcs, int inten)
{
pcl_pattern_t *shade = 0;
if (inten <= 0)
- shade = 0;
+ shade = 0;
else if (inten <= 2)
- shade = get_bi_pattern(pcs, 0);
+ shade = get_bi_pattern(pcs, 0);
else if (inten <= 10)
- shade = get_bi_pattern(pcs, 1);
+ shade = get_bi_pattern(pcs, 1);
else if (inten <= 20)
- shade = get_bi_pattern(pcs, 2);
+ shade = get_bi_pattern(pcs, 2);
else if (inten <= 35)
- shade = get_bi_pattern(pcs, 3);
+ shade = get_bi_pattern(pcs, 3);
else if (inten <= 55)
- shade = get_bi_pattern(pcs, 4);
+ shade = get_bi_pattern(pcs, 4);
else if (inten <= 80)
- shade = get_bi_pattern(pcs, 5);
+ shade = get_bi_pattern(pcs, 5);
else if (inten <= 99)
- shade = get_bi_pattern(pcs, 6);
+ shade = get_bi_pattern(pcs, 6);
return shade;
}
@@ -328,8 +327,8 @@ pcl_pattern_get_cross(pcl_state_t *pcs, int indx)
pcl_pattern_get_solid_pattern(pcl_state_t *pcs)
{
if (pcs->psolid_pattern == 0) {
- gs_point pattern_res;
- pcl_get_pattern_resolution(pcs, &pattern_res);
+ gs_point pattern_res;
+ pcl_get_pattern_resolution(pcs, &pattern_res);
(void)pcl_pattern_build_pattern( &(pcs->psolid_pattern),
&solid_pattern_pixmap,
pcl_pattern_uncolored,
@@ -349,8 +348,8 @@ pcl_pattern_get_solid_pattern(pcl_state_t *pcs)
pcl_pattern_get_unsolid_pattern(pcl_state_t *pcs)
{
if (pcs->punsolid_pattern == 0) {
- gs_point pattern_res;
- pcl_get_pattern_resolution(pcs, &pattern_res);
+ gs_point pattern_res;
+ pcl_get_pattern_resolution(pcs, &pattern_res);
(void)pcl_pattern_build_pattern( &(pcs->punsolid_pattern),
&unsolid_pattern_pixmap,
pcl_pattern_uncolored,
@@ -362,5 +361,3 @@ pcl_pattern_get_unsolid_pattern(pcl_state_t *pcs)
}
return pcs->punsolid_pattern;
}
-
-
diff --git a/pcl/pccid.c b/pcl/pccid.c
index 159d19ed4..5ce542203 100644
--- a/pcl/pccid.c
+++ b/pcl/pccid.c
@@ -10,7 +10,7 @@
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
San Rafael, CA 94903, (415)492-9861, for further information. */
/*$Id$ */
-
+
/* pccid.c - PCL configure image data command and object implementation */
#include "gx.h"
#include "gsmemory.h"
@@ -31,7 +31,7 @@
/* CID accessors */
pcl_cspace_type_t
-pcl_cid_get_cspace(const pcl_cid_data_t *pcid)
+pcl_cid_get_cspace(const pcl_cid_data_t *pcid)
{
return pcid->u.hdr.cspace;
}
@@ -54,7 +54,6 @@ pcl_cid_get_bits_per_primary(const pcl_cid_data_t *pcid, int index)
return pcid->u.hdr.bits_per_primary[index];
}
-
/*
* Convert a 32-bit floating point number stored in HP's big-endian form
* into the native form required by the host processor.
@@ -137,7 +136,6 @@ convert_int16_array(
}
}
-
/*
* Build the various long-form configure image data structures.
* Returns 0 on success, < 0 in case of an error.
@@ -165,7 +163,7 @@ normalize_cid_minmax_valrange_long(float *minmax)
{
int i;
for ( i = 0; i < 6; i++ ) {
- minmax[i] /= 255;
+ minmax[i] /= 255;
}
}
@@ -247,7 +245,6 @@ check_cid_hdr(
if (pcidh->encoding == pcl_penc_direct_by_pixel)
pcidh->bits_per_index = 8;
-
/*
* Map zero values. Zero bits per index is equivalent to one bit per index;
* zero bits per primary is equivalent to 8 bits per primary.
@@ -257,12 +254,10 @@ check_cid_hdr(
for (i = 0; i < countof(pcidh->bits_per_primary); i++) {
if (pcidh->bits_per_primary[i] == 0)
pcidh->bits_per_primary[i] = 8;
- if ( pcs->personality == pcl5e && pcidh->bits_per_primary[i] != 1 )
- dprintf("pcl5e personality with color primaries\n" );
+ if ( pcs->personality == pcl5e && pcidh->bits_per_primary[i] != 1 )
+ dprintf("pcl5e personality with color primaries\n" );
}
-
-
switch (pcidh->encoding) {
case pcl_penc_indexed_by_pixel:
@@ -313,7 +308,7 @@ check_cid_hdr(
pcid->len = 6;
}
#endif
-
+
/* if the device handles color conversion remap the colorimetric color space to rgb */
if (pl_device_does_color_conversion() && pcidh->cspace == pcl_cspace_Colorimetric) {
pcidh->cspace = pcl_cspace_RGB;
@@ -325,8 +320,8 @@ check_cid_hdr(
static int
substitute_colorimetric_cs(
- pcl_state_t *pcs,
- pcl_cid_data_t *pcid
+ pcl_state_t *pcs,
+ pcl_cid_data_t *pcid
)
{
pcl_cid_col_long_t * pcol = &(pcid->u.col);
@@ -446,7 +441,6 @@ set_simple_color_mode(
return install_cid_data(6, pbuff, pcs, true, false);
}
-
/*
* ESC * v <nbytes> W
*
@@ -460,7 +454,7 @@ pcl_configure_image_data(
)
{
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
return install_cid_data( uint_arg(pargs),
arg_data(pargs),
pcs,
@@ -482,7 +476,7 @@ pcl_simple_color_space(
)
{
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
return set_simple_color_mode(int_arg(pargs), pcs);
}
@@ -509,7 +503,7 @@ set_view_illuminant(
gs_vector3 wht_pt;
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
if (len != 8)
return e_Range;
@@ -544,16 +538,16 @@ pcl_cid_IN(
)
{
static const byte cid_GL2_Color[6] = { (byte)pcl_cspace_RGB,
- (byte)pcl_penc_indexed_by_plane,
- 3, 8, 8, 8 };
+ (byte)pcl_penc_indexed_by_plane,
+ 3, 8, 8, 8 };
static const byte cid_GL2_Mono[6] = { (byte)pcl_cspace_RGB,
- (byte)pcl_penc_indexed_by_plane,
- 3, 1, 1, 1 };
+ (byte)pcl_penc_indexed_by_plane,
+ 3, 1, 1, 1 };
return install_cid_data(6,
- pcs->personality == pcl5e ? cid_GL2_Mono : cid_GL2_Color,
- pcs, false, true);
+ pcs->personality == pcl5e ? cid_GL2_Mono : cid_GL2_Color,
+ pcs, false, true);
}
/*
@@ -589,7 +583,7 @@ pcl_cid_do_reset(pcl_state_t * pcs,
pcl_reset_type_t type
)
{
- static const uint mask = (pcl_reset_initial |
+ static const uint mask = (pcl_reset_initial |
pcl_reset_cold |
pcl_reset_printer);
@@ -597,6 +591,6 @@ pcl_cid_do_reset(pcl_state_t * pcs,
pcs->useciecolor = !pjl_proc_compare(pcs->pjls,
pjl_proc_get_envvar(pcs->pjls, "useciecolor"), "on");
}
-}
+}
const pcl_init_t pcl_cid_init = { pcl_cid_do_registration, pcl_cid_do_reset, 0 };
diff --git a/pcl/pccolor.c b/pcl/pccolor.c
index 52c651cf2..081a227db 100644
--- a/pcl/pccolor.c
+++ b/pcl/pccolor.c
@@ -41,7 +41,7 @@ set_color_comp_1(
)
{
if ( pcs->personality == pcl5e )
- return 0;
+ return 0;
if (!pcs->raster_state.graphics_mode)
pcs->color_comps[0] = float_arg(pargs);
return 0;
@@ -57,7 +57,7 @@ set_color_comp_2(
)
{
if ( pcs->personality == pcl5e )
- return 0;
+ return 0;
if (!pcs->raster_state.graphics_mode)
pcs->color_comps[1] = float_arg(pargs);
return 0;
@@ -73,7 +73,7 @@ set_color_comp_3(
)
{
if ( pcs->personality == pcl5e )
- return 0;
+ return 0;
if (!pcs->raster_state.graphics_mode)
pcs->color_comps[2] = float_arg(pargs);
return 0;
@@ -88,7 +88,7 @@ set_color_comp_3(
* will not affect the palette, but will reset the color component registers.
* This matches the behavior of the HP Color Laser Jet 5/5M, but not that of
* the HP DeskJet 1600C/CM. For the latter, negative indices are ignored and
- * the color component registers are NOT cleared, while positive indices are
+ * the color component registers are NOT cleared, while positive indices are
* interpreted modulo the palette size.
*/
static int
@@ -100,7 +100,7 @@ assign_color_index(
int indx = int_arg(pargs);
if ( pcs->personality == pcl5e )
- return 0;
+ return 0;
if (!pcs->raster_state.graphics_mode) {
if ((indx >= 0) && (indx < pcl_palette_get_num_entries(pcs->ppalet)))
pcl_palette_set_color(pcs, indx, pcs->color_comps);
@@ -124,30 +124,30 @@ color_do_registration(
DEFINE_CLASS('*')
{
'v', 'A',
- PCL_COMMAND( "Color Component 1",
+ PCL_COMMAND( "Color Component 1",
set_color_comp_1,
- pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
+ pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
)
},
{
'v', 'B',
- PCL_COMMAND( "Color Component 2",
+ PCL_COMMAND( "Color Component 2",
set_color_comp_2,
- pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
+ pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
)
},
{
'v', 'C',
PCL_COMMAND( "Color Component 3",
set_color_comp_3,
- pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
+ pca_neg_ok | pca_big_error | pca_raster_graphics | pca_in_rtl
)
},
{
'v', 'I',
PCL_COMMAND( "Assign Color Index",
assign_color_index,
- pca_neg_ok | pca_big_ignore | pca_raster_graphics | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_raster_graphics | pca_in_rtl
)
},
END_CLASS
diff --git a/pcl/pccprint.c b/pcl/pccprint.c
index c37e71645..90713119f 100644
--- a/pcl/pccprint.c
+++ b/pcl/pccprint.c
@@ -37,7 +37,7 @@ pcl_logical_operation(
if (pcs->raster_state.graphics_mode)
return 0;
if (rop > 255)
- return e_Range;
+ return e_Range;
pcl_break_underline(pcs); /* use the 5c convention; in 5e, the
* underline is not broken by a change in
@@ -63,7 +63,7 @@ pcl_pixel_placement(
if (pcs->raster_state.graphics_mode)
return 0;
if (i > 1)
- return 0;
+ return 0;
pcs->pp_mode = i;
return 0;
}
@@ -81,16 +81,16 @@ pccprint_do_registration(
DEFINE_CLASS('*')
{
'l', 'O',
- PCL_COMMAND( "Logical Operation",
+ PCL_COMMAND( "Logical Operation",
pcl_logical_operation,
- pca_neg_ok | pca_big_error | pca_in_rtl | pca_raster_graphics
+ pca_neg_ok | pca_big_error | pca_in_rtl | pca_raster_graphics
)
},
{
'l', 'R',
PCL_COMMAND( "Pixel Placement",
pcl_pixel_placement,
- pca_neg_ok | pca_big_ignore | pca_in_rtl | pca_raster_graphics
+ pca_neg_ok | pca_big_ignore | pca_in_rtl | pca_raster_graphics
)
},
END_CLASS
diff --git a/pcl/pccrd.c b/pcl/pccrd.c
index 440eb8cb8..cb3f532c3 100644
--- a/pcl/pccrd.c
+++ b/pcl/pccrd.c
@@ -144,7 +144,7 @@ alloc_crd(
* and uses the device parameter "CRDName" to select the one that is to be
* used as a default.
*
- * Returns
+ * Returns
*/
static bool
read_device_CRD(
@@ -280,7 +280,7 @@ pcl_crd_set_view_illuminant(
if (pold == 0) {
pcs->dflt_TransformPQR = dflt_TransformPQR_proto;
return gs_cie_render1_initialize( pcs->memory,
- pcrd->pgscrd,
+ pcrd->pgscrd,
NULL,
pwht_pt,
NULL,
@@ -297,9 +297,9 @@ pcl_crd_set_view_illuminant(
);
}
code = gs_cie_render1_init_from( pcs->memory,
- pcrd->pgscrd,
+ pcrd->pgscrd,
NULL, /* for now */
- pold->pgscrd,
+ pold->pgscrd,
pwht_pt,
&(pold->pgscrd->points.BlackPoint),
&(pold->pgscrd->MatrixPQR),
@@ -315,7 +315,7 @@ pcl_crd_set_view_illuminant(
);
if (pcrd != pold)
- rc_decrement(pold, "pcl set viewing illuminant");
+ rc_decrement(pold, "pcl set viewing illuminant");
return code;
}
diff --git a/pcl/pccrd.h b/pcl/pccrd.h
index 9c922d8d5..33751f02f 100644
--- a/pcl/pccrd.h
+++ b/pcl/pccrd.h
@@ -29,11 +29,11 @@
/*
* In PCL, color rendering dictionaries are set by the device, but the
- * default white point is specified by the language, and the white point
+ * default white point is specified by the language, and the white point
* may be modified by the language via the "View Illuminant" command.
*
* Though trivial in principle, this arrangement is a bit awkward for the
- * graphic library as there is no make-unique functionality provided
+ * graphic library as there is no make-unique functionality provided
* for color rendering dictionaries (none is necessary for PostScript as
* color rendering dictionaries may not be modified once they are set).
*
@@ -42,13 +42,13 @@
*/
/*
- * The PCL id exists to provide an identifier for a color rendering
- * dictionary. Having such an identifier is important to avoid the need
- * to repeatedly re-insert the color rendering dictionary into the
+ * The PCL id exists to provide an identifier for a color rendering
+ * dictionary. Having such an identifier is important to avoid the need
+ * to repeatedly re-insert the color rendering dictionary into the
* graphic state.
*
* The is_dflt_illum flag is used to optimize the case in which a CRD that
- * already uses the default view illuminant is once again set to use this
+ * already uses the default view illuminant is once again set to use this
* view illuminant.
*/
struct pcl_crd_s {
diff --git a/pcl/pccsbase.c b/pcl/pccsbase.c
index 5df687d35..ca762aed8 100644
--- a/pcl/pccsbase.c
+++ b/pcl/pccsbase.c
@@ -131,7 +131,6 @@ private_st_cs_base_t();
val = min_val + val * range; \
END
-
/*
* Default Configure Image Data information for the various color spaces.
*
@@ -192,7 +191,6 @@ static const struct {
/* pcl_cspace_LumChrom */
};
-
/*
* Code for constructing/modifying the client data structure of PCL base
* color spaces.
@@ -275,7 +273,7 @@ build_client_data(
*/
static void
init_client_data_from( pcl_cs_client_data_t * pnew,
- const pcl_cs_client_data_t * pfrom
+ const pcl_cs_client_data_t * pfrom
)
{
*pnew = *pfrom;
@@ -304,7 +302,6 @@ update_lookup_tbls(
#define free_lookup_tbls(pdata) \
update_lookup_tbls((pdata), NULL, NULL)
-
/*
* The colorimetric case.
*
@@ -599,7 +596,7 @@ finish_colmet_cspace(
* a1 = a* / 500
* b1 = b* / 200
* - -
- * { a2, T1, b2 } = { T1, a1, b1 } * | 1 1 1 |
+ * { a2, T1, b2 } = { T1, a1, b1 } * | 1 1 1 |
* | 1 0 0 |
* | 0 0 -1 |
* - -
@@ -713,7 +710,6 @@ static const gs_cie_common_proc3 lab_DecodeLMN = {
static const gs_vector3 lab_WhitePoint = { .9504, 1.0, 1.0889 };
-
/*
* Finish the creation of a CIE L*a*b* color space.
*/
@@ -735,7 +731,6 @@ finish_lab_cspace(
return 0;
}
-
/*
* The luminance-chrominance color space
*
@@ -833,7 +828,6 @@ static const gs_cie_common_proc3 lumchrom_DecodeLMN = {
{ lumchrom_DecodeLMN_0, lumchrom_DecodeLMN_1, lumchrom_DecodeLMN_2 }
};
-
/*
* Build the MatrixABC value for a luminance/chrominance color space. Note that
* this is the inverse of the matrix provided in the Configure Image Data
@@ -848,7 +842,7 @@ build_lum_chrom_mtxABC(
)
{
int i;
- pcl_mtx3_t tmp_mtx;
+ pcl_mtx3_t tmp_mtx;
/* transpose the input to create a row-order matrix */
for (i = 0; i < 3; i++) {
@@ -912,7 +906,6 @@ static int (*const finish_cspace[(int)pcl_cspace_num])( gs_color_space *,
finish_lumchrom_cspace /* pcl_cspace_LumChrom */
};
-
/*
* Free a PCL base color space. This decrements the reference count for the
* GS color space, and frees any lookup tables that might have been
@@ -976,7 +969,7 @@ alloc_base_cspace(
);
if (code < 0 || pbase->pcspace == NULL)
free_base_cspace(pmem, pbase, "allocate pcl base color space");
- else
+ else
*ppbase = pbase;
return code;
}
@@ -1001,8 +994,8 @@ alloc_base_cspace(
* client data may have been changed).
*/
static int
-unshare_base_cspace(const gs_memory_t *mem,
- pcl_cs_base_t ** ppbase
+unshare_base_cspace(const gs_memory_t *mem,
+ pcl_cs_base_t ** ppbase
)
{
pcl_cs_base_t * pbase = *ppbase;
@@ -1124,7 +1117,7 @@ pcl_cs_base_update_lookup_tbl(
int code = 0;
if (plktbl == 0) {
- if ( (pbase->client_data.plktbl1 == 0) &&
+ if ( (pbase->client_data.plktbl1 == 0) &&
(pbase->client_data.plktbl2 == 0) )
return 0;
plktbl1 = 0;
@@ -1137,7 +1130,7 @@ pcl_cs_base_update_lookup_tbl(
/* lookup tables for "higher" color spaces are always ignored */
if ( (cstype < lktype) ||
(lktype == pcl_cspace_RGB) ||
- (lktype == pcl_cspace_CMY) )
+ (lktype == pcl_cspace_CMY) )
return 0;
/* CIE L*a*b* space and the L*a*b* lookup table must match */
diff --git a/pcl/pccsbase.h b/pcl/pccsbase.h
index 3f92e85b4..42497565b 100644
--- a/pcl/pccsbase.h
+++ b/pcl/pccsbase.h
@@ -25,7 +25,6 @@
#include "pccid.h"
#include "pclookup.h"
-
/*
* The client data structure for use with color-metric RGB, CIE L*a*b*, and
* luminanace-chrominance color spaces.
@@ -105,7 +104,6 @@ typedef struct pcl_cs_base_s {
#define pcl_cs_base_release(pbase) \
rc_decrement(pbase, "pcl_cs_base_release")
-
/*
* Build a PCL base color space. In principle this may be invoked at any time,
* but it should generally be called the first time a color space is required
diff --git a/pcl/pcdict.h b/pcl/pcdict.h
index 4eaa41527..c8755ff18 100644
--- a/pcl/pcdict.h
+++ b/pcl/pcdict.h
@@ -18,7 +18,6 @@
#include "gx.h"
-
/* Define the type for an ID key used in a dictionary. */
typedef struct pcl_id_s {
uint value;
diff --git a/pcl/pcdraw.c b/pcl/pcdraw.c
index 191ec51df..a71cf5369 100644
--- a/pcl/pcdraw.c
+++ b/pcl/pcdraw.c
@@ -25,7 +25,6 @@
#include "pcpatrn.h"
#include "pcdraw.h"
-
/*
* Set all necessary graphics state parameters for PCL drawing
* (currently only CTM and clipping region).
@@ -113,7 +112,7 @@ pcl_gsave(
if (pids == 0)
return e_Memory;
- pids->pht = 0;
+ pids->pht = 0;
pids->pcrd = 0;
pids->pccolor = 0;
@@ -177,4 +176,3 @@ pcl_free_gstate_stk(pcl_state_t *pcs)
{
gs_free_object(pcs->memory, pcs->pids, "PCL grestore");
}
-
diff --git a/pcl/pcfont.c b/pcl/pcfont.c
index 2a8d658d7..a64b1f398 100644
--- a/pcl/pcfont.c
+++ b/pcl/pcfont.c
@@ -38,38 +38,37 @@
* Decache the HMI after resetting the font. According to TRM 5-22,
* this always happens, regardless of how the HMI was set; formerly,
* we only invalidated the HMI if it was set from the font rather than
- * explicitly. TRM 7-14 any font characteristic change decaches HMI
+ * explicitly. TRM 7-14 any font characteristic change decaches HMI
*/
#define pcl_decache_hmi(pcs)\
do {\
pcs->hmi_cp = HMI_DEFAULT;\
} while (0)
-
/* Clear the font pointer cache after changing a font parameter. set
* indicates which font (0/1 for primary/secondary). -1 means both. */
void
pcl_decache_font(pcl_state_t *pcs, int set)
-{
- if ( set < 0 )
- {
- pcl_decache_font(pcs, 0);
- pcl_decache_font(pcs, 1);
- }
- else
- {
- pcs->font_selection[set].font = NULL;
- pcs->font_selection[set].selected_id = -1;
- pcs->g.font_selection[set].font = NULL;
- if ( pcs->font_selected == set )
- {
- pcs->font = NULL;
- pcs->map = NULL;
- pcs->g.font = NULL;
- pcs->g.map = NULL;
- pcl_decache_hmi(pcs);
- }
- }
+{
+ if ( set < 0 )
+ {
+ pcl_decache_font(pcs, 0);
+ pcl_decache_font(pcs, 1);
+ }
+ else
+ {
+ pcs->font_selection[set].font = NULL;
+ pcs->font_selection[set].selected_id = -1;
+ pcs->g.font_selection[set].font = NULL;
+ if ( pcs->font_selected == set )
+ {
+ pcs->font = NULL;
+ pcs->map = NULL;
+ pcs->g.font = NULL;
+ pcs->g.map = NULL;
+ pcl_decache_hmi(pcs);
+ }
+ }
}
/* set current font and symbol table to selected parameter's font and
@@ -77,9 +76,9 @@ pcl_decache_font(pcl_state_t *pcs, int set)
static int
pcl_set_font(pcl_state_t *pcs, pcl_font_selection_t *pfs)
{
- pcs->font = pfs->font;
- pcs->map = pfs->map;
- return 0;
+ pcs->font = pfs->font;
+ pcs->map = pfs->map;
+ return 0;
}
/* Recompute the current font from the descriptive parameters. */
@@ -89,32 +88,32 @@ pcl_recompute_font(pcl_state_t *pcs, bool internal_only)
{ pcl_font_selection_t *pfs = &pcs->font_selection[pcs->font_selected];
int code = pcl_reselect_font(pfs, pcs, internal_only);
- if ( code < 0 )
- return code;
- pcl_set_font(pcs, pfs);
- /* load it if necessary */
- return pl_load_resident_font_data_from_file(pcs->memory, pfs->font);
+ if ( code < 0 )
+ return code;
+ pcl_set_font(pcs, pfs);
+ /* load it if necessary */
+ return pl_load_resident_font_data_from_file(pcs->memory, pfs->font);
}
/* The font parameter commands all come in primary and secondary variants. */
static int
pcl_symbol_set(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint num = uint_arg(pargs);
- uint symset;
-
- if ( num > 1023 )
- return e_Range;
-
- pcl_decache_hmi(pcs);
- /* The following algorithm is from Appendix C of the */
- /* PCL5 Comparison Guide. */
- symset = (num << 5) + pargs->command - 64;
- if ( symset != pcs->font_selection[set].params.symbol_set )
- {
- pcs->font_selection[set].params.symbol_set = symset;
- pcl_decache_font(pcs, set);
- }
- return 0;
+ uint symset;
+
+ if ( num > 1023 )
+ return e_Range;
+
+ pcl_decache_hmi(pcs);
+ /* The following algorithm is from Appendix C of the */
+ /* PCL5 Comparison Guide. */
+ symset = (num << 5) + pargs->command - 64;
+ if ( symset != pcs->font_selection[set].params.symbol_set )
+ {
+ pcs->font_selection[set].params.symbol_set = symset;
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( <> others */
pcl_primary_symbol_set(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -129,16 +128,16 @@ static int
pcl_spacing(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint spacing = uint_arg(pargs);
- if ( spacing > 1 )
- return 0;
+ if ( spacing > 1 )
+ return 0;
- pcl_decache_hmi(pcs);
- if ( spacing != pcs->font_selection[set].params.proportional_spacing )
- {
- pcs->font_selection[set].params.proportional_spacing = spacing;
- pcl_decache_font(pcs, set);
- }
- return 0;
+ pcl_decache_hmi(pcs);
+ if ( spacing != pcs->font_selection[set].params.proportional_spacing )
+ {
+ pcs->font_selection[set].params.proportional_spacing = spacing;
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( s <prop_bool> P */
pcl_primary_spacing(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -152,24 +151,24 @@ pcl_secondary_spacing(pcl_args_t *pargs, pcl_state_t *pcs)
static int
pcl_pitch(floatp cpi, pcl_state_t *pcs, int set)
{ uint pitch_cp;
- pcl_font_selection_t *pfs = &pcs->font_selection[set];
-
- pcl_decache_hmi(pcs);
- if ( cpi < 0.1 )
- cpi = 0.1;
- /* Convert characters per inch to 100ths of design units. */
- pitch_cp = 7200.0 / cpi;
- if ( pitch_cp > 65535 )
- return e_Range;
- if ( pitch_cp < 1 )
- pitch_cp = 1;
- if ( pitch_cp != pl_fp_pitch_cp(&pfs->params) )
- {
- pl_fp_set_pitch_cp(&pfs->params, pitch_cp);
- if ( (int)pfs->selected_id < 0)
- pcl_decache_font(pcs, set);
- }
- return 0;
+ pcl_font_selection_t *pfs = &pcs->font_selection[set];
+
+ pcl_decache_hmi(pcs);
+ if ( cpi < 0.1 )
+ cpi = 0.1;
+ /* Convert characters per inch to 100ths of design units. */
+ pitch_cp = 7200.0 / cpi;
+ if ( pitch_cp > 65535 )
+ return e_Range;
+ if ( pitch_cp < 1 )
+ pitch_cp = 1;
+ if ( pitch_cp != pl_fp_pitch_cp(&pfs->params) )
+ {
+ pl_fp_set_pitch_cp(&pfs->params, pitch_cp);
+ if ( (int)pfs->selected_id < 0)
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( s <pitch> H */
pcl_primary_pitch(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -183,16 +182,16 @@ pcl_secondary_pitch(pcl_args_t *pargs, pcl_state_t *pcs)
static int
pcl_height(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint height_4ths = (uint)(float_arg(pargs) * 4 + 0.5);
- pcl_font_selection_t *pfs = &pcs->font_selection[set];
+ pcl_font_selection_t *pfs = &pcs->font_selection[set];
- pcl_decache_hmi(pcs);
- if ( height_4ths != pfs->params.height_4ths )
- {
- pfs->params.height_4ths = height_4ths;
- if ( (int)pfs->selected_id < 0)
- pcl_decache_font(pcs, set);
- }
- return 0;
+ pcl_decache_hmi(pcs);
+ if ( height_4ths != pfs->params.height_4ths )
+ {
+ pfs->params.height_4ths = height_4ths;
+ if ( (int)pfs->selected_id < 0)
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( s <height> V */
pcl_primary_height(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -207,13 +206,13 @@ static int
pcl_style(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint style = uint_arg(pargs);
- pcl_decache_hmi(pcs);
- if ( style != pcs->font_selection[set].params.style )
- {
- pcs->font_selection[set].params.style = style;
- pcl_decache_font(pcs, set);
- }
- return 0;
+ pcl_decache_hmi(pcs);
+ if ( style != pcs->font_selection[set].params.style )
+ {
+ pcs->font_selection[set].params.style = style;
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( s <style> S */
pcl_primary_style(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -228,18 +227,18 @@ static int
pcl_stroke_weight(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ int weight = int_arg(pargs);
- pcl_decache_hmi(pcs);
- if ( weight < -7 )
- weight = -7;
- else if ( weight > 7 )
- weight = 7;
- if ( weight != pcs->font_selection[set].params.stroke_weight )
- {
- pcs->font_selection[set].params.stroke_weight = weight;
- if ( (int)pcs->font_selection[set].selected_id < 0)
+ pcl_decache_hmi(pcs);
+ if ( weight < -7 )
+ weight = -7;
+ else if ( weight > 7 )
+ weight = 7;
+ if ( weight != pcs->font_selection[set].params.stroke_weight )
+ {
+ pcs->font_selection[set].params.stroke_weight = weight;
+ if ( (int)pcs->font_selection[set].selected_id < 0)
pcl_decache_font(pcs, set);
- }
- return 0;
+ }
+ return 0;
}
static int /* ESC ( s <weight> B */
pcl_primary_stroke_weight(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -254,13 +253,13 @@ static int
pcl_typeface(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint typeface = uint_arg(pargs);
- pcl_decache_hmi(pcs);
- if ( typeface != pcs->font_selection[set].params.typeface_family )
- {
- pcs->font_selection[set].params.typeface_family = typeface;
- pcl_decache_font(pcs, set);
- }
- return 0;
+ pcl_decache_hmi(pcs);
+ if ( typeface != pcs->font_selection[set].params.typeface_family )
+ {
+ pcs->font_selection[set].params.typeface_family = typeface;
+ pcl_decache_font(pcs, set);
+ }
+ return 0;
}
static int /* ESC ( s <typeface> T */
pcl_primary_typeface(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -274,19 +273,19 @@ pcl_secondary_typeface(pcl_args_t *pargs, pcl_state_t *pcs)
static int
pcl_font_selection_id(pcl_args_t *pargs, pcl_state_t *pcs, int set)
{ uint id = uint_arg(pargs);
- pcl_font_selection_t *pfs = &pcs->font_selection[set];
- int code = pcl_select_font_by_id(pfs, id, pcs);
-
- switch ( code )
- {
- default: /* error */
- return code;
- case 0:
- pcl_decache_font(pcs, -1);
- pfs->selected_id = id;
- case 1: /* not found */
- return 0;
- }
+ pcl_font_selection_t *pfs = &pcs->font_selection[set];
+ int code = pcl_select_font_by_id(pfs, id, pcs);
+
+ switch ( code )
+ {
+ default: /* error */
+ return code;
+ case 0:
+ pcl_decache_font(pcs, -1);
+ pfs->selected_id = id;
+ case 1: /* not found */
+ return 0;
+ }
}
static int /* ESC ( <font_id> X */
pcl_primary_font_selection_id(pcl_args_t *pargs, pcl_state_t *pcs)
@@ -299,16 +298,16 @@ pcl_secondary_font_selection_id(pcl_args_t *pargs, pcl_state_t *pcs)
static int
pcl_select_default_font(pcl_args_t *pargs, pcl_state_t *pcs, int set)
-{
+{
if ( int_arg(pargs) != 3 )
- return e_Range;
+ return e_Range;
pcs->font_selection[set].params.proportional_spacing = false;
pcs->font_selection[set].params.symbol_set = pcs->default_symbol_set_value;
pl_fp_set_pitch_per_inch(&pcs->font_selection[set].params,
- pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "pitch")));
+ pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "pitch")));
pcs->font_selection[set].params.height_4ths =
- pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "ptsize")) * 4.0;
+ pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "ptsize")) * 4.0;
pcs->font_selection[set].params.style = 0;
pcs->font_selection[set].params.stroke_weight = 0;
@@ -328,20 +327,20 @@ pcl_select_default_font_secondary(pcl_args_t *pargs, pcl_state_t *pcs)
static int /* SO */
pcl_SO(pcl_args_t *pargs, pcl_state_t *pcs)
-{
- if ( pcs->font_selected != 1 ) {
- pcs->font_selected = secondary;
- pcl_decache_font(pcs, secondary);
+{
+ if ( pcs->font_selected != 1 ) {
+ pcs->font_selected = secondary;
+ pcl_decache_font(pcs, secondary);
}
return 0;
}
static int /* SI */
pcl_SI(pcl_args_t *pargs, pcl_state_t *pcs)
-{
- if ( pcs->font_selected != 0 ) {
- pcs->font_selected = primary;
- pcl_decache_font(pcs, primary);
+{
+ if ( pcs->font_selected != 0 ) {
+ pcs->font_selected = primary;
+ pcl_decache_font(pcs, primary);
}
return 0;
}
@@ -350,20 +349,20 @@ pcl_SI(pcl_args_t *pargs, pcl_state_t *pcs)
static int /* ESC & k <mode> S */
pcl_set_pitch_mode(pcl_args_t *pargs, pcl_state_t *pcs)
{ int mode = int_arg(pargs);
- floatp cpi;
+ floatp cpi;
int code = 0;
- /*
- * The specification in the PCL5 Comparison Guide is:
- * 0 => 10.0, 2 => 16.67, 4 => 12.0.
- */
- switch ( mode )
- {
- case 0: cpi = 10.0; break;
- case 2: cpi = 16.67; break;
- case 4: cpi = 12.0; break;
- default: return e_Range;
- }
+ /*
+ * The specification in the PCL5 Comparison Guide is:
+ * 0 => 10.0, 2 => 16.67, 4 => 12.0.
+ */
+ switch ( mode )
+ {
+ case 0: cpi = 10.0; break;
+ case 2: cpi = 16.67; break;
+ case 4: cpi = 12.0; break;
+ default: return e_Range;
+ }
/* set the pitch in both primary and secondary font selection tables */
{
@@ -371,7 +370,7 @@ pcl_set_pitch_mode(pcl_args_t *pargs, pcl_state_t *pcs)
if (code == 0)
code = pcl_pitch(cpi, pcs, secondary);
}
- return code;
+ return code;
}
/* Initialization */
@@ -381,86 +380,86 @@ pcfont_do_registration(
gs_memory_t *mem
)
{ /* Register commands */
- { int chr;
- /*
- * The H-P manual only talks about A through Z, but it appears
- * that characters from A through ^ (94) can be used.
- */
- for ( chr = 'A'; chr <= '^'; ++chr )
- if ( chr != 'X' )
- { DEFINE_CLASS_COMMAND_ARGS('(', 0, chr, "Primary Symbol Set",
- pcl_primary_symbol_set,
- pca_neg_error|pca_big_error);
- DEFINE_CLASS_COMMAND_ARGS(')', 0, chr, "Secondary Symbol Set",
- pcl_secondary_symbol_set,
- pca_neg_error|pca_big_error);
- }
- }
- DEFINE_CLASS('(')
- {'s', 'P',
- PCL_COMMAND("Primary Spacing", pcl_primary_spacing,
- pca_neg_ignore|pca_big_ignore)},
- {'s', 'H',
- PCL_COMMAND("Primary Pitch", pcl_primary_pitch,
- pca_neg_error|pca_big_error)},
- {'s', 'V',
- PCL_COMMAND("Primary Height", pcl_primary_height,
- pca_neg_error|pca_big_error)},
- {'s', 'S',
- PCL_COMMAND("Primary Style", pcl_primary_style,
- pca_neg_error|pca_big_clamp)},
- {'s', 'B',
- PCL_COMMAND("Primary Stroke Weight", pcl_primary_stroke_weight,
- pca_neg_ok|pca_big_error)},
- {'s', 'T',
- PCL_COMMAND("Primary Typeface", pcl_primary_typeface,
- pca_neg_error|pca_big_ok)},
- {0, 'X',
- PCL_COMMAND("Primary Font Selection ID",
- pcl_primary_font_selection_id,
- pca_neg_error|pca_big_error)},
- {0, '@',
- PCL_COMMAND("Default Font Primary",
- pcl_select_default_font_primary,
- pca_neg_error|pca_big_error)},
- END_CLASS
- DEFINE_CLASS(')')
- {'s', 'P',
- PCL_COMMAND("Secondary Spacing", pcl_secondary_spacing,
- pca_neg_ignore|pca_big_ignore)},
- {'s', 'H',
- PCL_COMMAND("Secondary Pitch", pcl_secondary_pitch,
- pca_neg_error|pca_big_error)},
- {'s', 'V',
- PCL_COMMAND("Secondary Height", pcl_secondary_height,
- pca_neg_error|pca_big_error)},
- {'s', 'S',
- PCL_COMMAND("Secondary Style", pcl_secondary_style,
- pca_neg_error|pca_big_clamp)},
- {'s', 'B',
- PCL_COMMAND("Secondary Stroke Weight",
- pcl_secondary_stroke_weight,
- pca_neg_ok|pca_big_error)},
- {'s', 'T',
- PCL_COMMAND("Secondary Typeface", pcl_secondary_typeface,
- pca_neg_error|pca_big_ok)},
- {0, 'X',
- PCL_COMMAND("Secondary Font Selection ID",
- pcl_secondary_font_selection_id,
- pca_neg_error|pca_big_error)},
- {0, '@',
- PCL_COMMAND("Default Font Secondary",
- pcl_select_default_font_secondary,
- pca_neg_error|pca_big_error)},
- END_CLASS
- DEFINE_CONTROL(SO, "SO", pcl_SO)
- DEFINE_CONTROL(SI, "SI", pcl_SI)
- DEFINE_CLASS('&')
- {'k', 'S',
- PCL_COMMAND("Set Pitch Mode", pcl_set_pitch_mode,
- pca_neg_error|pca_big_error)},
- END_CLASS
- return 0;
+ { int chr;
+ /*
+ * The H-P manual only talks about A through Z, but it appears
+ * that characters from A through ^ (94) can be used.
+ */
+ for ( chr = 'A'; chr <= '^'; ++chr )
+ if ( chr != 'X' )
+ { DEFINE_CLASS_COMMAND_ARGS('(', 0, chr, "Primary Symbol Set",
+ pcl_primary_symbol_set,
+ pca_neg_error|pca_big_error);
+ DEFINE_CLASS_COMMAND_ARGS(')', 0, chr, "Secondary Symbol Set",
+ pcl_secondary_symbol_set,
+ pca_neg_error|pca_big_error);
+ }
+ }
+ DEFINE_CLASS('(')
+ {'s', 'P',
+ PCL_COMMAND("Primary Spacing", pcl_primary_spacing,
+ pca_neg_ignore|pca_big_ignore)},
+ {'s', 'H',
+ PCL_COMMAND("Primary Pitch", pcl_primary_pitch,
+ pca_neg_error|pca_big_error)},
+ {'s', 'V',
+ PCL_COMMAND("Primary Height", pcl_primary_height,
+ pca_neg_error|pca_big_error)},
+ {'s', 'S',
+ PCL_COMMAND("Primary Style", pcl_primary_style,
+ pca_neg_error|pca_big_clamp)},
+ {'s', 'B',
+ PCL_COMMAND("Primary Stroke Weight", pcl_primary_stroke_weight,
+ pca_neg_ok|pca_big_error)},
+ {'s', 'T',
+ PCL_COMMAND("Primary Typeface", pcl_primary_typeface,
+ pca_neg_error|pca_big_ok)},
+ {0, 'X',
+ PCL_COMMAND("Primary Font Selection ID",
+ pcl_primary_font_selection_id,
+ pca_neg_error|pca_big_error)},
+ {0, '@',
+ PCL_COMMAND("Default Font Primary",
+ pcl_select_default_font_primary,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ DEFINE_CLASS(')')
+ {'s', 'P',
+ PCL_COMMAND("Secondary Spacing", pcl_secondary_spacing,
+ pca_neg_ignore|pca_big_ignore)},
+ {'s', 'H',
+ PCL_COMMAND("Secondary Pitch", pcl_secondary_pitch,
+ pca_neg_error|pca_big_error)},
+ {'s', 'V',
+ PCL_COMMAND("Secondary Height", pcl_secondary_height,
+ pca_neg_error|pca_big_error)},
+ {'s', 'S',
+ PCL_COMMAND("Secondary Style", pcl_secondary_style,
+ pca_neg_error|pca_big_clamp)},
+ {'s', 'B',
+ PCL_COMMAND("Secondary Stroke Weight",
+ pcl_secondary_stroke_weight,
+ pca_neg_ok|pca_big_error)},
+ {'s', 'T',
+ PCL_COMMAND("Secondary Typeface", pcl_secondary_typeface,
+ pca_neg_error|pca_big_ok)},
+ {0, 'X',
+ PCL_COMMAND("Secondary Font Selection ID",
+ pcl_secondary_font_selection_id,
+ pca_neg_error|pca_big_error)},
+ {0, '@',
+ PCL_COMMAND("Default Font Secondary",
+ pcl_select_default_font_secondary,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ DEFINE_CONTROL(SO, "SO", pcl_SO)
+ DEFINE_CONTROL(SI, "SI", pcl_SI)
+ DEFINE_CLASS('&')
+ {'k', 'S',
+ PCL_COMMAND("Set Pitch Mode", pcl_set_pitch_mode,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ return 0;
}
/* look up pjl font number with data storage type. Return 0 on
@@ -470,7 +469,7 @@ pcfont_do_registration(
font for the active resource. */
static int
pcl_lookup_pjl_font(pcl_state_t *pcs, int pjl_font_number,
- pcl_data_storage_t pcl_data_storage, pl_font_params_t *params)
+ pcl_data_storage_t pcl_data_storage, pl_font_params_t *params)
{
pl_dict_enum_t dictp;
gs_const_string key;
@@ -479,15 +478,15 @@ pcl_lookup_pjl_font(pcl_state_t *pcs, int pjl_font_number,
pl_dict_enum_begin(&pcs->soft_fonts, &dictp);
while ( pl_dict_enum_next(&dictp, &key, &value) ) {
- pl_font_t *fp = (pl_font_t *)value;
- int ds = fp->storage;
- if ( (int)pcl_data_storage == ds ) {
- found_resource = true;
- *params = fp->params;
- if ( fp->params.pjl_font_number == pjl_font_number ) {
- return 0;
- }
- }
+ pl_font_t *fp = (pl_font_t *)value;
+ int ds = fp->storage;
+ if ( (int)pcl_data_storage == ds ) {
+ found_resource = true;
+ *params = fp->params;
+ if ( fp->params.pjl_font_number == pjl_font_number ) {
+ return 0;
+ }
+ }
}
return (found_resource ? 1 : -1);
}
@@ -500,102 +499,102 @@ pcl_set_current_font_environment(pcl_state_t *pcs)
pcl's storage identifier to mirror pjl's */
pcl_data_storage_t pcl_data_storage;
while( 1 ) {
- /* get current font source */
- pjl_envvar_t *fontsource = pjl_proc_get_envvar(pcs->pjls, "fontsource");
- switch (fontsource[0]) {
- case 'I':
- /* NB what happens if pjl command is not I - hmmph? */
- if (!pl_load_built_in_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
- pcs->memory,
- &pcs->built_in_fonts,
- pcs->font_dir, (int)pcds_internal,
- false /* do not use unicode font names for keys */ ))
+ /* get current font source */
+ pjl_envvar_t *fontsource = pjl_proc_get_envvar(pcs->pjls, "fontsource");
+ switch (fontsource[0]) {
+ case 'I':
+ /* NB what happens if pjl command is not I - hmmph? */
+ if (!pl_load_built_in_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
+ pcs->memory,
+ &pcs->built_in_fonts,
+ pcs->font_dir, (int)pcds_internal,
+ false /* do not use unicode font names for keys */ ))
/* simply continue without fonts if none are found */
return 0;
- pcl_data_storage = pcds_internal;
- break;
- case 'S':
- /* nothing to load */
- pcl_data_storage = pcds_permanent;
- break;
- /* NB we incorrectly treat C, C1, C2... as one collective resource */
- case 'C':
- if ( !pl_load_cartridge_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
- pcs->memory,
- &pcs->cartridge_fonts,
- pcs->font_dir, (int)pcds_all_cartridges)) {
- pjl_proc_set_next_fontsource(pcs->pjls);
- continue; /* try next resource */
- }
- pcl_data_storage = pcds_all_cartridges;
- break;
- /* NB we incorrectly treat M, M1, M2... as one collective resource */
- case 'M':
- if ( !pl_load_simm_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
- pcs->memory,
- &pcs->simm_fonts,
- pcs->font_dir, (int)pcds_all_simms)) {
-
- continue; /* try next resource */
- }
- pcl_data_storage = pcds_all_simms;
- break;
- default:
- dprintf("pcfont.c: unknown pjl resource\n");
- return -1;
- }
- {
- int code;
- pl_font_params_t params;
- code = pcl_lookup_pjl_font(pcs,
- pjl_proc_vartoi(pcs->pjls,
- pjl_proc_get_envvar(pcs->pjls, "fontnumber")),
- pcl_data_storage, &params);
- /* resource found, but if code is 1 we did not match the
+ pcl_data_storage = pcds_internal;
+ break;
+ case 'S':
+ /* nothing to load */
+ pcl_data_storage = pcds_permanent;
+ break;
+ /* NB we incorrectly treat C, C1, C2... as one collective resource */
+ case 'C':
+ if ( !pl_load_cartridge_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
+ pcs->memory,
+ &pcs->cartridge_fonts,
+ pcs->font_dir, (int)pcds_all_cartridges)) {
+ pjl_proc_set_next_fontsource(pcs->pjls);
+ continue; /* try next resource */
+ }
+ pcl_data_storage = pcds_all_cartridges;
+ break;
+ /* NB we incorrectly treat M, M1, M2... as one collective resource */
+ case 'M':
+ if ( !pl_load_simm_fonts(pjl_proc_fontsource_to_path(pcs->pjls, fontsource),
+ pcs->memory,
+ &pcs->simm_fonts,
+ pcs->font_dir, (int)pcds_all_simms)) {
+
+ continue; /* try next resource */
+ }
+ pcl_data_storage = pcds_all_simms;
+ break;
+ default:
+ dprintf("pcfont.c: unknown pjl resource\n");
+ return -1;
+ }
+ {
+ int code;
+ pl_font_params_t params;
+ code = pcl_lookup_pjl_font(pcs,
+ pjl_proc_vartoi(pcs->pjls,
+ pjl_proc_get_envvar(pcs->pjls, "fontnumber")),
+ pcl_data_storage, &params);
+ /* resource found, but if code is 1 we did not match the
font number. NB unsure what to do when code == 1. */
- if ( code >= 0 ) {
- /* copy parameters to the requested font and
- apply the other pjl settings to construct the
- initial font request from pjltrm: "The recommended
- order for setting FONTNUMBER, FONTSOURCE, and
- SYMSET is SYMSET first, then FONTSOURCE, then
- FONTNUMBER". Perhaps this is a clue as to how
- these interact. We search for the font number in
- the fontsource and apply pjl's SYMSET, PTSIZE and
- PITCH to the font we found. That in turn becomes
- the default requested font */
- pcs->font_selection[0].params = params;
- pcs->default_symbol_set_value = pcs->font_selection[0].params.symbol_set;
- /* NB: The fontsource and fontnumber selection
+ if ( code >= 0 ) {
+ /* copy parameters to the requested font and
+ apply the other pjl settings to construct the
+ initial font request from pjltrm: "The recommended
+ order for setting FONTNUMBER, FONTSOURCE, and
+ SYMSET is SYMSET first, then FONTSOURCE, then
+ FONTNUMBER". Perhaps this is a clue as to how
+ these interact. We search for the font number in
+ the fontsource and apply pjl's SYMSET, PTSIZE and
+ PITCH to the font we found. That in turn becomes
+ the default requested font */
+ pcs->font_selection[0].params = params;
+ pcs->default_symbol_set_value = pcs->font_selection[0].params.symbol_set;
+ /* NB: The fontsource and fontnumber selection
parameters get stepped on next, unless pjl symset,
pitch and ptsize are properly updated by the PJL
interpreter when the font changes. Our pjl
interpreter does not currently do this.
Consequently wrong selections are possible. */
- pcs->default_symbol_set_value = pcs->font_selection[0].params.symbol_set =
- pjl_proc_map_pjl_sym_to_pcl_sym(pcs->pjls,
+ pcs->default_symbol_set_value = pcs->font_selection[0].params.symbol_set =
+ pjl_proc_map_pjl_sym_to_pcl_sym(pcs->pjls,
pjl_proc_get_envvar(pcs->pjls, "symset"));
- pl_fp_set_pitch_per_inch(&pcs->font_selection[0].params,
- pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "pitch")));
- pcs->font_selection[0].params.height_4ths =
+ pl_fp_set_pitch_per_inch(&pcs->font_selection[0].params,
+ pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "pitch")));
+ pcs->font_selection[0].params.height_4ths =
pjl_proc_vartof(pcs->pjls, pjl_proc_get_envvar(pcs->pjls, "ptsize")) * 4.0;
- pcs->font_selection[0].font = 0;
- pcs->font_selection[0].selected_id = (uint)-1;
- pcs->font_selection[1] = pcs->font_selection[0];
- pcs->font_selected = primary;
- pcs->font = 0;
- }
- else {
- /* no resouce found - Note for everything but 'S' this
- is a double check, since we should have failed when
- checking for the resource Note this is fatal for
- internal resources but should be caught above. */
- pjl_proc_set_next_fontsource(pcs->pjls);
- continue; /* try next resource */
-
- }
- }
- return 0; /* done */
+ pcs->font_selection[0].font = 0;
+ pcs->font_selection[0].selected_id = (uint)-1;
+ pcs->font_selection[1] = pcs->font_selection[0];
+ pcs->font_selected = primary;
+ pcs->font = 0;
+ }
+ else {
+ /* no resouce found - Note for everything but 'S' this
+ is a double check, since we should have failed when
+ checking for the resource Note this is fatal for
+ internal resources but should be caught above. */
+ pjl_proc_set_next_fontsource(pcs->pjls);
+ continue; /* try next resource */
+
+ }
+ }
+ return 0; /* done */
}
}
@@ -615,48 +614,48 @@ pcl_unload_resident_fonts(pcl_state_t *pcs)
affect soft fonts */
pl_dict_enum_begin(&pcs->soft_fonts, &dictp);
while ( pl_dict_enum_next(&dictp, &key, &value) ) {
- pl_font_t *plfont = (pl_font_t *)value;
- if ( plfont->font_file )
- if ( pl_store_resident_font_data_in_file(plfont->font_file, pcs->memory, plfont) < 0 )
- dprintf1("%s", "could not store data" );
-
+ pl_font_t *plfont = (pl_font_t *)value;
+ if ( plfont->font_file )
+ if ( pl_store_resident_font_data_in_file(plfont->font_file, pcs->memory, plfont) < 0 )
+ dprintf1("%s", "could not store data" );
+
}
}
static void
pcfont_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
-{
+{
if ((type & pcl_reset_initial) != 0) {
- pcs->font_dir = gs_font_dir_alloc(pcs->memory);
+ pcs->font_dir = gs_font_dir_alloc(pcs->memory);
/* disable hinting at high res */
if (gs_currentdevice(pcs->pgs)->HWResolution[0] >= 300)
gs_setgridfittt(pcs->font_dir, 0);
- pcs->font = 0;
- pcs->font_selection[0].font =
- pcs->font_selection[1].font = 0;
- pcs->font_selected = primary;
- pl_dict_init(&pcs->built_in_fonts, pcs->memory, pl_free_font);
- pl_dict_init(&pcs->soft_fonts, pcs->memory, pl_free_font);
- pl_dict_init(&pcs->cartridge_fonts, pcs->memory, pl_free_font);
- pl_dict_init(&pcs->simm_fonts, pcs->memory, pl_free_font);
- pl_dict_set_parent(&pcs->soft_fonts, &pcs->built_in_fonts);
- pl_dict_set_parent(&pcs->cartridge_fonts, &pcs->soft_fonts);
- pl_dict_set_parent(&pcs->simm_fonts, &pcs->cartridge_fonts);
+ pcs->font = 0;
+ pcs->font_selection[0].font =
+ pcs->font_selection[1].font = 0;
+ pcs->font_selected = primary;
+ pl_dict_init(&pcs->built_in_fonts, pcs->memory, pl_free_font);
+ pl_dict_init(&pcs->soft_fonts, pcs->memory, pl_free_font);
+ pl_dict_init(&pcs->cartridge_fonts, pcs->memory, pl_free_font);
+ pl_dict_init(&pcs->simm_fonts, pcs->memory, pl_free_font);
+ pl_dict_set_parent(&pcs->soft_fonts, &pcs->built_in_fonts);
+ pl_dict_set_parent(&pcs->cartridge_fonts, &pcs->soft_fonts);
+ pl_dict_set_parent(&pcs->simm_fonts, &pcs->cartridge_fonts);
}
if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay) ) {
- int code = 0;
- if ( pcs->personality != rtl )
- code = pcl_set_current_font_environment(pcs);
- /* corrupt configuration */
- if ( code != 0 )
- exit( 1 );
+ int code = 0;
+ if ( pcs->personality != rtl )
+ code = pcl_set_current_font_environment(pcs);
+ /* corrupt configuration */
+ if ( code != 0 )
+ exit( 1 );
}
if ( type & pcl_reset_permanent ) {
- pcl_unload_resident_fonts(pcs);
- pl_dict_release(&pcs->soft_fonts);
- pl_dict_release(&pcs->built_in_fonts);
- pl_dict_release(&pcs->cartridge_fonts);
- pl_dict_release(&pcs->simm_fonts);
+ pcl_unload_resident_fonts(pcs);
+ pl_dict_release(&pcs->soft_fonts);
+ pl_dict_release(&pcs->built_in_fonts);
+ pl_dict_release(&pcs->cartridge_fonts);
+ pl_dict_release(&pcs->simm_fonts);
}
}
diff --git a/pcl/pcfont.h b/pcl/pcfont.h
index e0c12b7e9..3995b2a2c 100644
--- a/pcl/pcfont.h
+++ b/pcl/pcfont.h
@@ -38,7 +38,7 @@ int pcl_recompute_font(pcl_state_t * pcs, bool internal_only);
#define pcl_break_underline(pcs) \
BEGIN \
if (pcs->underline_enabled) \
- pcl_do_underline(pcs); \
+ pcl_do_underline(pcs); \
END
/* ...and then, after repositioning, restart underlining if necessary... */
diff --git a/pcl/pcfontpg.c b/pcl/pcfontpg.c
index 4f63afae1..4b08c0708 100644
--- a/pcl/pcfontpg.c
+++ b/pcl/pcfontpg.c
@@ -28,8 +28,8 @@ static inline void
print_blank_lines(pcl_state_t *pcs, int count)
{
while( count-- ) {
- pcl_do_CR(pcs);
- pcl_do_LF(pcs);
+ pcl_do_CR(pcs);
+ pcl_do_LF(pcs);
}
}
@@ -105,19 +105,19 @@ pcl_print_font_page(pcl_args_t *pargs, pcl_state_t *pcs)
/* font page header */
{
- const char *header_str = "PCL Font List";
- const char *sample_str = "Sample";
- const char *select_str = "Font Selection Command";
- uint hlen = strlen(header_str);
- /* assume the pcl font list string is 1 inch 7200 units */
- uint pos = pcs->margins.right / 2 - 7200 / 2;
- pcl_set_cap_x(pcs, pos, false, false);
- pcl_text((byte *)header_str, hlen, pcs, false);
- print_blank_lines(pcs, 2);
- pcl_text((byte *)sample_str, strlen(sample_str), pcs, false);
- pcl_set_cap_x(pcs, pcs->margins.right / 2, false, false);
- pcl_text((byte *)select_str, strlen(select_str), pcs, false);
- print_blank_lines(pcs, 2);
+ const char *header_str = "PCL Font List";
+ const char *sample_str = "Sample";
+ const char *select_str = "Font Selection Command";
+ uint hlen = strlen(header_str);
+ /* assume the pcl font list string is 1 inch 7200 units */
+ uint pos = pcs->margins.right / 2 - 7200 / 2;
+ pcl_set_cap_x(pcs, pos, false, false);
+ pcl_text((byte *)header_str, hlen, pcs, false);
+ print_blank_lines(pcs, 2);
+ pcl_text((byte *)sample_str, strlen(sample_str), pcs, false);
+ pcl_set_cap_x(pcs, pcs->margins.right / 2, false, false);
+ pcl_text((byte *)select_str, strlen(select_str), pcs, false);
+ print_blank_lines(pcs, 2);
}
/* enumerate all non-resident fonts.*/
diff --git a/pcl/pcfrgrnd.c b/pcl/pcfrgrnd.c
index 979cf0c6f..ffb02df1d 100644
--- a/pcl/pcfrgrnd.c
+++ b/pcl/pcfrgrnd.c
@@ -20,7 +20,6 @@
/* GC routines */
private_st_frgrnd_t();
-
/*
* Free a pcl foreground object.
*/
@@ -49,7 +48,7 @@ free_foreground(
*/
static int
alloc_foreground(
- pcl_state_t *pcs,
+ pcl_state_t *pcs,
pcl_frgrnd_t ** ppfrgrnd,
gs_memory_t * pmem
)
@@ -95,7 +94,7 @@ build_foreground(
bool is_default = false;
int code = 0;
- /*
+ /*
* Check for a request for the default foreground. Since there are only
* three fixed palettes, it is sufficient to check that the palette provided
* is fixed and has two entries. The default foreground is black, which is
@@ -124,15 +123,15 @@ build_foreground(
/* pal_entry is interpreted modulo the current palette size */
if ((pal_entry < 0) || (pal_entry >= num_entries)) {
- if (pindexed->is_GL) {
- int max_pen = num_entries -1;
- while (pal_entry > max_pen)
- pal_entry -= max_pen;
- } else {
- pal_entry %= num_entries;
- if (pal_entry < 0)
- pal_entry += num_entries;
- }
+ if (pindexed->is_GL) {
+ int max_pen = num_entries -1;
+ while (pal_entry > max_pen)
+ pal_entry -= max_pen;
+ } else {
+ pal_entry %= num_entries;
+ if (pal_entry < 0)
+ pal_entry += num_entries;
+ }
}
pfrgrnd->is_cmy = (ppalet->pindexed->original_cspace == 1);
@@ -166,7 +165,7 @@ pcl_frgrnd_set_default_foreground(
return code;
return build_foreground( pcs,
- &(pcs->pfrgrnd),
+ &(pcs->pfrgrnd),
pcs->ppalet,
1,
pcs->memory
@@ -187,21 +186,20 @@ set_foreground(
int code;
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
/* check that the palette is complete */
if ((code = pcl_palette_check_complete(pcs)) < 0)
return code;
return build_foreground( pcs,
- &(pcs->pfrgrnd),
+ &(pcs->pfrgrnd),
pcs->ppalet,
int_arg(pargs),
pcs->memory
);
}
-
/*
* Initialization, reset, and copy procedures.
*
@@ -216,7 +214,7 @@ frgrnd_do_registration(
{
DEFINE_CLASS('*')
{
- 'v', 'S',
+ 'v', 'S',
PCL_COMMAND("Set Foreground", set_foreground, pca_neg_ok | pca_raster_graphics)
},
END_CLASS
@@ -229,7 +227,7 @@ frgrnd_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
if ( type & (pcl_reset_permanent) ) {
rc_decrement(pcs->pfrgrnd, "foreground reset pfrgrnd");
rc_decrement(pcs->pdflt_frgrnd, "foreground reset pdflt_frgrnd");
- rc_decrement(pcs->pwhite_cs, "foreground reset p_white_cs");
+ rc_decrement(pcs->pwhite_cs, "foreground reset p_white_cs");
}
}
@@ -248,21 +246,20 @@ frgrnd_do_copy(
}
/* (white pattern or white foreground color) and transparent pattern
- * is a NOP
+ * is a NOP
*/
-bool
-is_invisible_pattern( pcl_state_t *pcs )
+bool
+is_invisible_pattern( pcl_state_t *pcs )
{
if ( pcs->pattern_transparent ) {
- if (pcs->pattern_type == pcl_pattern_solid_white )
- return true;
- if ( pcs->pfrgrnd->color[0] == 0xff &&
- pcs->pfrgrnd->color[1] == 0xff &&
- pcs->pfrgrnd->color[2] == 0xff )
- return true; /* NB: depends on CMY conversion to internal RGB */
+ if (pcs->pattern_type == pcl_pattern_solid_white )
+ return true;
+ if ( pcs->pfrgrnd->color[0] == 0xff &&
+ pcs->pfrgrnd->color[1] == 0xff &&
+ pcs->pfrgrnd->color[2] == 0xff )
+ return true; /* NB: depends on CMY conversion to internal RGB */
}
return false;
}
-
const pcl_init_t pcl_frgrnd_init = { frgrnd_do_registration, frgrnd_do_reset, frgrnd_do_copy };
diff --git a/pcl/pcfrgrnd.h b/pcl/pcfrgrnd.h
index 95ea9f66d..fe4b8ea31 100644
--- a/pcl/pcfrgrnd.h
+++ b/pcl/pcfrgrnd.h
@@ -61,13 +61,13 @@
* uncolored patterns.
*
* HP Bug is_cmy is set when the base colorspace of the foreground color
- * is CMY.
- * if foreground colorspace is the different than palette's force black
+ * is CMY.
+ * if foreground colorspace is the different than palette's force black
* CMY foreground + RGB raster --> black + raster
* RGB foreground + CMY raster --> black + raster
* else same colorspaces:
* foreground + raster -> fg_color + raster
- * This is an HP bug in the 4550 4600.
+ * This is an HP bug in the 4550 4600.
*/
struct pcl_frgrnd_s {
rc_header rc;
@@ -128,11 +128,11 @@ typedef struct pcl_frgrnd_s pcl_frgrnd_t;
*/
int pcl_frgrnd_set_default_foreground(pcl_state_t * pcs);
-/* checks for:
+/* checks for:
* (white pattern or white foreground color) and transparent pattern
- * is a NOP
+ * is a NOP
*/
-bool
+bool
is_invisible_pattern( pcl_state_t *pcs );
-
+
#endif /* pcfrgrnd_INCLUDED */
diff --git a/pcl/pcfsel.c b/pcl/pcfsel.c
index a8059c95c..1ae47a9c9 100644
--- a/pcl/pcfsel.c
+++ b/pcl/pcfsel.c
@@ -64,21 +64,21 @@ static const char * const score_name[] = {
static void
dprint_cc(const byte *pcc)
{ dprintf8("cc=%02x %02x %02x %02x %02x %02x %02x %02x", pcc[0],
- pcc[1], pcc[2], pcc[3], pcc[4], pcc[5], pcc[6], pcc[7]);
+ pcc[1], pcc[2], pcc[3], pcc[4], pcc[5], pcc[6], pcc[7]);
}
void
dprint_font_params_t(const pl_font_params_t *pfp)
{ dprintf8("symset=%u %s pitch=%g ht=%u style=%u wt=%d face=%u:%u\n",
- pfp->symbol_set,
- (pfp->proportional_spacing ? "prop." : "fixed"),
- pl_fp_pitch_cp(pfp) / 100.0, pfp->height_4ths / 4, pfp->style,
- pfp->stroke_weight, pfp->typeface_family, (0x07FF &pfp->typeface_family) );
+ pfp->symbol_set,
+ (pfp->proportional_spacing ? "prop." : "fixed"),
+ pl_fp_pitch_cp(pfp) / 100.0, pfp->height_4ths / 4, pfp->style,
+ pfp->stroke_weight, pfp->typeface_family, (0x07FF &pfp->typeface_family) );
}
#include "plftable.h"
static void
-dprint_font_name(const pl_font_t *pfont)
+dprint_font_name(const pl_font_t *pfont)
{
int i;
bool found = false;
@@ -104,7 +104,7 @@ dprint_font_name(const pl_font_t *pfont)
static void
dprint_font_t(const pl_font_t *pfont)
-{
+{
dprint_font_name(pfont);
dprintf3("storage=%d scaling=%d type=%d ",
pfont->storage, pfont->scaling_technology, pfont->font_type);
@@ -165,7 +165,6 @@ check_support(const pcl_state_t *pcs, uint symbol_set, const pl_font_t *fp,
if (pl_font_is_bound(fp))
return fp->params.symbol_set == symbol_set ? 2 : 0;
-
if (*mapp == 0) {
/* selecting by id and did not find the symbol map specified
@@ -174,7 +173,7 @@ check_support(const pcl_state_t *pcs, uint symbol_set, const pl_font_t *fp,
if (id_selection || pl_wide_encoding(symbol_set))
return 2;
else {
- /*
+ /*
* Interestingly, if we look up a symbol set that does not
* exist the default symbol set is replaced with roman-8.
* This is certainly a bug in HP printers.
@@ -191,9 +190,9 @@ check_support(const pcl_state_t *pcs, uint symbol_set, const pl_font_t *fp,
if ( pcl_check_symbol_support((*mapp)->character_requirements,
fp->character_complement) )
- return 2; /* best */
+ return 2; /* best */
else
- return 1;
+ return 1;
}
/* Identify the internal lineprinter font */
@@ -211,97 +210,96 @@ font_is_scalable_selection_wise(const pl_font_t *fp)
else
return pl_font_is_scalable(fp);
}
-
-
+
/* Compute a font's score against selection parameters. TRM 8-27.
* Also set *mapp to the symbol map to be used if this font wins. */
static void
score_match(const pcl_state_t *pcs, const pcl_font_selection_t *pfs,
const pl_font_t *fp, pl_symbol_map_t **mapp, match_score_t score)
{
- int tscore;
+ int tscore;
- /* 1. Symbol set. 2 for exact match or full support, 1 for
- * default supported, 0 for no luck. */
+ /* 1. Symbol set. 2 for exact match or full support, 1 for
+ * default supported, 0 for no luck. */
score[score_symbol_set] = check_support(pcs, pfs->params.symbol_set, fp, mapp, false);
- /* 2. Spacing. */
- score[score_spacing] =
- pfs->params.proportional_spacing == fp->params.proportional_spacing;
-
- /* 3. Pitch. */
- /* Need to score this so that (1) exact match is highest, (2) any
- * higher-than-requested pitch is better than any lower-than-
- * requested pitch, (3) within these categories, nearer is better. */
- if ( pfs->params.proportional_spacing )
- score[score_pitch] = 0; /* should not influence score */
- else { /* fixed space selection */
+ /* 2. Spacing. */
+ score[score_spacing] =
+ pfs->params.proportional_spacing == fp->params.proportional_spacing;
+
+ /* 3. Pitch. */
+ /* Need to score this so that (1) exact match is highest, (2) any
+ * higher-than-requested pitch is better than any lower-than-
+ * requested pitch, (3) within these categories, nearer is better. */
+ if ( pfs->params.proportional_spacing )
+ score[score_pitch] = 0; /* should not influence score */
+ else { /* fixed space selection */
if ( fp->params.proportional_spacing )
/* scalable; match is worst possible */
score[score_pitch] = 0;
- else {
+ else {
int delta = pl_fp_pitch_per_inch_x100(&fp->params) -
- pl_fp_pitch_per_inch_x100(&pfs->params);
+ pl_fp_pitch_per_inch_x100(&pfs->params);
- /* If within one unit, call it exact; otherwise give
- * preference to higher pitch than requested. */
- if (font_is_scalable_selection_wise(fp) || (abs(delta) <= 10 ))
+ /* If within one unit, call it exact; otherwise give
+ * preference to higher pitch than requested. */
+ if (font_is_scalable_selection_wise(fp) || (abs(delta) <= 10 ))
score[score_pitch] = 0x2000000;
- else if ( delta > 0 )
+ else if ( delta > 0 )
score[score_pitch] = 0x2000000 - delta;
- else
+ else
score[score_pitch] = 0x1000000 + delta;
}
}
- /* 4. Height. */
- /* Closest match scores highest (no preference for + or -). Otherwise
- * similar to pitch, and again, values assigned have no meaning out-
- * side this code. */
- if ( font_is_scalable_selection_wise(fp) )
- score[score_height] = 0x1000000;
- else
- { int delta = abs(pfs->params.height_4ths - fp->params.height_4ths);
-
- /* As before, allow one unit of error to appear "exact". */
- if ( delta <= 1 )
- delta = 0;
- score[score_height] = 0x1000000 - delta;
- }
-
- /* 5. Style. */
- if ( pfs->params.style == fp->params.style )
- score[score_style] = 2;
- else if ( fp->params.style == 0 && pfs->params.style != 0 )
- score[score_style] = 1; /* prefer NO style fonts to wrong style */
- else
- score[score_style] = 0;
-
- /* 6. Stroke Weight. */
- /* If not exact match, prefer closest value away from 0 (more
- * extreme). If none, then prefer closest value nearer 0. Once
- * again, the actual values assigned here have no meaning outside
- * this chunk of code. */
- { /* Worst cases (font value toward zero from request) 0..13.
- * Nearest more extreme: 14..21. 21 is exact. */
- int fwt = fp->params.stroke_weight;
- int pwt = pfs->params.stroke_weight;
- int delta = pwt - fwt;
-
- /* With a little time, this could be collapsed. */
- if ( pwt >= 0 )
- if ( fwt >= pwt )
- tscore = 21 + delta;
- else
- tscore = 14 - delta;
- else
- if ( fwt <= pwt )
- tscore = 21 - delta;
- else
- tscore = 14 + delta;
- score[score_weight] = tscore;
- }
-
- /* 7. Typeface family. */
- {
+ /* 4. Height. */
+ /* Closest match scores highest (no preference for + or -). Otherwise
+ * similar to pitch, and again, values assigned have no meaning out-
+ * side this code. */
+ if ( font_is_scalable_selection_wise(fp) )
+ score[score_height] = 0x1000000;
+ else
+ { int delta = abs(pfs->params.height_4ths - fp->params.height_4ths);
+
+ /* As before, allow one unit of error to appear "exact". */
+ if ( delta <= 1 )
+ delta = 0;
+ score[score_height] = 0x1000000 - delta;
+ }
+
+ /* 5. Style. */
+ if ( pfs->params.style == fp->params.style )
+ score[score_style] = 2;
+ else if ( fp->params.style == 0 && pfs->params.style != 0 )
+ score[score_style] = 1; /* prefer NO style fonts to wrong style */
+ else
+ score[score_style] = 0;
+
+ /* 6. Stroke Weight. */
+ /* If not exact match, prefer closest value away from 0 (more
+ * extreme). If none, then prefer closest value nearer 0. Once
+ * again, the actual values assigned here have no meaning outside
+ * this chunk of code. */
+ { /* Worst cases (font value toward zero from request) 0..13.
+ * Nearest more extreme: 14..21. 21 is exact. */
+ int fwt = fp->params.stroke_weight;
+ int pwt = pfs->params.stroke_weight;
+ int delta = pwt - fwt;
+
+ /* With a little time, this could be collapsed. */
+ if ( pwt >= 0 )
+ if ( fwt >= pwt )
+ tscore = 21 + delta;
+ else
+ tscore = 14 - delta;
+ else
+ if ( fwt <= pwt )
+ tscore = 21 - delta;
+ else
+ tscore = 14 + delta;
+ score[score_weight] = tscore;
+ }
+
+ /* 7. Typeface family. */
+ {
uint diff = pfs->params.typeface_family - fp->params.typeface_family;
if (diff == 0)
score[score_typeface] = 2;
@@ -312,52 +310,52 @@ score_match(const pcl_state_t *pcs, const pcl_font_selection_t *pfs,
else
score[score_typeface] = 0;
}
- }
-
- /* 8. Location. */
- /* Rearrange the value from "storage" into priority for us. We
- * only care that we get the priority sequence: soft-font, cartridge,
- * SIMM, and internal, and that we order at least 2 cartridges. (TRM
- * implies that SIMMs are *not* to be ordered.) Once again, values
- * assigned here have no external meaning. */
- /* 1 bit at bottom for SIMM _vs_ internal, then cartridge-number
- * bits, then soft-font bit at top. */
- if ( fp->storage & pcds_downloaded )
- tscore = 1 << (pcds_cartridge_max + 1);
- else if ( fp->storage & pcds_all_cartridges )
- tscore = (fp->storage & pcds_all_cartridges) >>
- (pcds_cartridge_shift - 1);
- else
- /* no priority among SIMMs, and internal is 0 */
- tscore = (fp->storage & pcds_all_simms)? 1: 0;
- score[score_location] = tscore;
-
- /* 9. Orientation */
- if ( fp->scaling_technology != plfst_bitmap )
- score[score_orientation] = 1;
- else
- { pcl_font_header_t *fhp = (pcl_font_header_t *)(fp->header);
-
- score[score_orientation] = fhp?
- fhp->Orientation == pcs->xfm_state.lp_orient :
- 0;
- }
-
- /* 10. Location: 11 in the implementors Guide.
- * lower typeface ID's are better.
- * supposed to be ordered by bitmap/scalable and SoftFont ... Internal but
- * these didn't seem to have an effect.
- *
- * Lineprinter has a special case, making it harder to accidently select.
- */
-
- if (INTERNAL_LPFONT)
- score[score_fontnumber] = 0x100000 - fp->params.typeface_family;
- else
- score[score_fontnumber] = 0x200000 - fp->params.typeface_family;
+ }
+
+ /* 8. Location. */
+ /* Rearrange the value from "storage" into priority for us. We
+ * only care that we get the priority sequence: soft-font, cartridge,
+ * SIMM, and internal, and that we order at least 2 cartridges. (TRM
+ * implies that SIMMs are *not* to be ordered.) Once again, values
+ * assigned here have no external meaning. */
+ /* 1 bit at bottom for SIMM _vs_ internal, then cartridge-number
+ * bits, then soft-font bit at top. */
+ if ( fp->storage & pcds_downloaded )
+ tscore = 1 << (pcds_cartridge_max + 1);
+ else if ( fp->storage & pcds_all_cartridges )
+ tscore = (fp->storage & pcds_all_cartridges) >>
+ (pcds_cartridge_shift - 1);
+ else
+ /* no priority among SIMMs, and internal is 0 */
+ tscore = (fp->storage & pcds_all_simms)? 1: 0;
+ score[score_location] = tscore;
+
+ /* 9. Orientation */
+ if ( fp->scaling_technology != plfst_bitmap )
+ score[score_orientation] = 1;
+ else
+ { pcl_font_header_t *fhp = (pcl_font_header_t *)(fp->header);
+
+ score[score_orientation] = fhp?
+ fhp->Orientation == pcs->xfm_state.lp_orient :
+ 0;
+ }
+
+ /* 10. Location: 11 in the implementors Guide.
+ * lower typeface ID's are better.
+ * supposed to be ordered by bitmap/scalable and SoftFont ... Internal but
+ * these didn't seem to have an effect.
+ *
+ * Lineprinter has a special case, making it harder to accidently select.
+ */
+
+ if (INTERNAL_LPFONT)
+ score[score_fontnumber] = 0x100000 - fp->params.typeface_family;
+ else
+ score[score_fontnumber] = 0x200000 - fp->params.typeface_family;
#ifdef DEBUG
- if ( gs_debug_c('=') )
+ if ( gs_debug_c('=') )
dprintf_font_scoring("candidate", fp, *mapp, score);
#endif
@@ -368,64 +366,64 @@ score_match(const pcl_state_t *pcs, const pcl_font_selection_t *pfs,
int
pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool internal_only)
{ if ( pfs->font == 0 )
- { pl_dict_enum_t dictp;
- gs_const_string key;
- void *value;
- pl_font_t *best_font = 0;
- pl_symbol_map_t *best_map = 0;
- pl_symbol_map_t *mapp = 0;
- match_score_t best_match;
+ { pl_dict_enum_t dictp;
+ gs_const_string key;
+ void *value;
+ pl_font_t *best_font = 0;
+ pl_symbol_map_t *best_map = 0;
+ pl_symbol_map_t *mapp = 0;
+ match_score_t best_match;
score_index_t i;
#ifdef DEBUG
- if ( gs_debug_c('=') )
- { dputs("[=]request: ");
- dprint_font_params_t(&pfs->params);
- }
+ if ( gs_debug_c('=') )
+ { dputs("[=]request: ");
+ dprint_font_params_t(&pfs->params);
+ }
#endif
- /* if the font table is set up to select character by id
+ /* if the font table is set up to select character by id
we attempt to reselect the font by id. As a fallback
we use family selection. NB We do not correctly handle
the fonts with alphanumeric id's */
- if ( (int)pfs->selected_id >= 0 ) {
- byte id_key[2];
- void *value;
- id_key[0] = pfs->selected_id >> 8;
- id_key[1] = (byte)(pfs->selected_id);
- if ( pl_dict_find((pl_dict_t *)&pcs->soft_fonts, id_key, 2, &value) ) {
-
- pfs->font = (pl_font_t *)value;
+ if ( (int)pfs->selected_id >= 0 ) {
+ byte id_key[2];
+ void *value;
+ id_key[0] = pfs->selected_id >> 8;
+ id_key[1] = (byte)(pfs->selected_id);
+ if ( pl_dict_find((pl_dict_t *)&pcs->soft_fonts, id_key, 2, &value) ) {
+
+ pfs->font = (pl_font_t *)value;
(void)check_support(pcs, pfs->params.symbol_set, pfs->font, &pfs->map, true);
return 0;
- }
- }
- /* Initialize the best match to be worse than any real font. */
+ }
+ }
+ /* Initialize the best match to be worse than any real font. */
for (i=(score_index_t)0; i<score_limit; i++)
best_match[i] = -1;
- pl_dict_enum_begin(&pcs->soft_fonts, &dictp);
- while ( pl_dict_enum_next(&dictp, &key, &value) )
- { pl_font_t *fp = (pl_font_t *)value;
- match_score_t match;
+ pl_dict_enum_begin(&pcs->soft_fonts, &dictp);
+ while ( pl_dict_enum_next(&dictp, &key, &value) )
+ { pl_font_t *fp = (pl_font_t *)value;
+ match_score_t match;
if ((internal_only) && fp->storage != pcds_internal)
continue;
- score_match(pcs, pfs, fp, &mapp, match);
+ score_match(pcs, pfs, fp, &mapp, match);
#ifdef DEBUG
if ( gs_debug_c('=') ) {
if (best_match[0] != -1) /* skip sentinel */
dprintf_font_scoring("best", best_font, mapp, best_match);
}
#endif
- for (i=(score_index_t)0; i<score_limit; i++)
- if ( match[i] != best_match[i] )
- {
- if ( match[i] > best_match[i] )
- {
- best_font = fp;
- best_map = mapp;
- memcpy((void*)best_match, (void*)match,
- sizeof(match));
+ for (i=(score_index_t)0; i<score_limit; i++)
+ if ( match[i] != best_match[i] )
+ {
+ if ( match[i] > best_match[i] )
+ {
+ best_font = fp;
+ best_map = mapp;
+ memcpy((void*)best_match, (void*)match,
+ sizeof(match));
#ifdef DEBUG
if ( gs_debug_c('=') ) {
dprintf_font_scoring("usurper", fp, mapp, best_match);
@@ -434,11 +432,11 @@ pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool intern
}
#endif
- }
- break;
- }
- }
- if ( best_font == 0 )
+ }
+ break;
+ }
+ }
+ if ( best_font == 0 )
return -1; /* no fonts */
#ifdef DEBUG
if ( gs_debug_c('=') ) {
@@ -446,61 +444,61 @@ pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool intern
}
#endif
- pfs->font = best_font;
- pfs->map = best_map;
- }
- pfs->selected_id = (uint)-1;
- return 0;
+ pfs->font = best_font;
+ pfs->map = best_map;
+ }
+ pfs->selected_id = (uint)-1;
+ return 0;
}
/* set font parameters after an id selection */
void
-pcl_set_id_parameters(const pcl_state_t *pcs,
- pcl_font_selection_t *pfs, pl_font_t *fp, uint id)
+pcl_set_id_parameters(const pcl_state_t *pcs,
+ pcl_font_selection_t *pfs, pl_font_t *fp, uint id)
{
- /* Transfer parameters from the selected font into the selection
- * parameters, being careful with the softer parameters. */
- pfs->font = fp;
- pfs->selected_id = id;
- pfs->map = 0;
- if ( pl_font_is_bound(fp) )
- pfs->params.symbol_set = fp->params.symbol_set;
-
- if ( check_support(pcs, pfs->params.symbol_set, fp, &pfs->map, true) )
- DO_NOTHING;
+ /* Transfer parameters from the selected font into the selection
+ * parameters, being careful with the softer parameters. */
+ pfs->font = fp;
+ pfs->selected_id = id;
+ pfs->map = 0;
+ if ( pl_font_is_bound(fp) )
+ pfs->params.symbol_set = fp->params.symbol_set;
+
+ if ( check_support(pcs, pfs->params.symbol_set, fp, &pfs->map, true) )
+ DO_NOTHING;
else if ( check_support(pcs, pcs->default_symbol_set_value,
fp, &pfs->map, true)
- )
+ )
DO_NOTHING;
else { /*
- * This font doesn't support the required symbol set.
- * Punt -- map 1-for-1.
- */
+ * This font doesn't support the required symbol set.
+ * Punt -- map 1-for-1.
+ */
}
- pfs->params.proportional_spacing = fp->params.proportional_spacing;
- if ( !pfs->params.proportional_spacing && !pl_font_is_scalable(fp) )
- pfs->params.pitch = fp->params.pitch;
- if ( !pl_font_is_scalable(fp) )
- pfs->params.height_4ths = fp->params.height_4ths;
- pfs->params.style = fp->params.style;
- pfs->params.stroke_weight = fp->params.stroke_weight;
- pfs->params.typeface_family = fp->params.typeface_family;
- return;
+ pfs->params.proportional_spacing = fp->params.proportional_spacing;
+ if ( !pfs->params.proportional_spacing && !pl_font_is_scalable(fp) )
+ pfs->params.pitch = fp->params.pitch;
+ if ( !pl_font_is_scalable(fp) )
+ pfs->params.height_4ths = fp->params.height_4ths;
+ pfs->params.style = fp->params.style;
+ pfs->params.stroke_weight = fp->params.stroke_weight;
+ pfs->params.typeface_family = fp->params.typeface_family;
+ return;
}
-
+
/* Select a font by ID, updating the selection parameters. */
/* Return 0 normally, 1 if no font was found, or an error code. */
int
pcl_select_font_by_id(pcl_font_selection_t *pfs, uint id, pcl_state_t *pcs)
{ byte id_key[2];
- void *value;
- pl_font_t *fp;
-
- id_key[0] = id >> 8;
- id_key[1] = (byte)id;
- if ( !pl_dict_find(&pcs->soft_fonts, id_key, 2, &value) )
- return 1; /* font not found */
- fp = (pl_font_t *)value;
- pcl_set_id_parameters(pcs, pfs, fp, id);
- return 0;
+ void *value;
+ pl_font_t *fp;
+
+ id_key[0] = id >> 8;
+ id_key[1] = (byte)id;
+ if ( !pl_dict_find(&pcs->soft_fonts, id_key, 2, &value) )
+ return 1; /* font not found */
+ fp = (pl_font_t *)value;
+ pcl_set_id_parameters(pcs, pfs, fp, id);
+ return 0;
}
diff --git a/pcl/pcfsel.h b/pcl/pcfsel.h
index 605f74a4f..e83e87bdf 100644
--- a/pcl/pcfsel.h
+++ b/pcl/pcfsel.h
@@ -19,7 +19,6 @@
#include "pcstate.h"
-
/* Recompute the font from the parameters if necessary. */
/* This is used by both PCL and HP-GL/2. */
int pcl_reselect_font(pcl_font_selection_t *pfs, const pcl_state_t *pcs, bool intenal_only);
@@ -34,8 +33,7 @@ int pcl_select_font_by_id(pcl_font_selection_t *pfs, uint id,
/* set font parameters after an id selection */
void
-pcl_set_id_parameters(const pcl_state_t *pcs,
- pcl_font_selection_t *pfs, pl_font_t *fp, uint id);
-
+pcl_set_id_parameters(const pcl_state_t *pcs,
+ pcl_font_selection_t *pfs, pl_font_t *fp, uint id);
#endif /* pcfsel_INCLUDED */
diff --git a/pcl/pcht.c b/pcl/pcht.c
index f2e3fbc3c..8b8ec1493 100644
--- a/pcl/pcht.c
+++ b/pcl/pcht.c
@@ -61,7 +61,6 @@ RELOC_PTRS_END
private_st_ht_builtin_dither_t();
-
static
ENUM_PTRS_BEGIN(ht_enum_ptrs)
return 0;
@@ -97,40 +96,40 @@ private_st_ht_t();
* with logical operations (raster-ops).
*/
static const byte ordered_dither_data[16 * 16] = {
- 142, 46, 174, 6, 134, 38, 166, 12, 140, 44, 172, 4, 132, 36, 164, 14,
- 78, 238, 110, 198, 70, 230, 102, 204, 76, 236, 108, 196, 68, 228, 100, 206,
- 190, 30, 158, 54, 182, 22, 150, 60, 188, 28, 156, 52, 180, 20, 148, 62,
- 126, 222, 94, 246, 118, 214, 86, 252, 124, 220, 92, 244, 116, 212, 84, 254,
- 129, 33, 161, 9, 137, 41, 169, 3, 131, 35, 163, 11, 139, 43, 171, 1,
- 65, 225, 97, 201, 73, 233, 105, 195, 67, 227, 99, 203, 75, 235, 107, 193,
- 177, 17, 145, 57, 185, 25, 153, 51, 179, 19, 147, 59, 187, 27, 155, 49,
- 113, 209, 81, 249, 121, 217, 89, 243, 115, 211, 83, 251, 123, 219, 91, 241,
- 141, 45, 173, 5, 133, 37, 165, 15, 143, 47, 175, 7, 135, 39, 167, 13,
- 77, 237, 109, 197, 69, 229, 101, 207, 79, 239, 111, 199, 71, 231, 103, 205,
- 189, 29, 157, 53, 181, 21, 149, 63, 191, 31, 159, 55, 183, 23, 151, 61,
- 125, 221, 93, 245, 117, 213, 85, 255, 127, 223, 95, 247, 119, 215, 87, 253,
- 130, 34, 162, 10, 138, 42, 170, 1, 128, 32, 160, 8, 136, 40, 168, 2,
- 66, 226, 98, 202, 74, 234, 106, 192, 64, 224, 96, 200, 72, 232, 104, 194,
- 178, 18, 146, 58, 186, 26, 154, 48, 176, 16, 144, 56, 184, 24, 152, 50,
+ 142, 46, 174, 6, 134, 38, 166, 12, 140, 44, 172, 4, 132, 36, 164, 14,
+ 78, 238, 110, 198, 70, 230, 102, 204, 76, 236, 108, 196, 68, 228, 100, 206,
+ 190, 30, 158, 54, 182, 22, 150, 60, 188, 28, 156, 52, 180, 20, 148, 62,
+ 126, 222, 94, 246, 118, 214, 86, 252, 124, 220, 92, 244, 116, 212, 84, 254,
+ 129, 33, 161, 9, 137, 41, 169, 3, 131, 35, 163, 11, 139, 43, 171, 1,
+ 65, 225, 97, 201, 73, 233, 105, 195, 67, 227, 99, 203, 75, 235, 107, 193,
+ 177, 17, 145, 57, 185, 25, 153, 51, 179, 19, 147, 59, 187, 27, 155, 49,
+ 113, 209, 81, 249, 121, 217, 89, 243, 115, 211, 83, 251, 123, 219, 91, 241,
+ 141, 45, 173, 5, 133, 37, 165, 15, 143, 47, 175, 7, 135, 39, 167, 13,
+ 77, 237, 109, 197, 69, 229, 101, 207, 79, 239, 111, 199, 71, 231, 103, 205,
+ 189, 29, 157, 53, 181, 21, 149, 63, 191, 31, 159, 55, 183, 23, 151, 61,
+ 125, 221, 93, 245, 117, 213, 85, 255, 127, 223, 95, 247, 119, 215, 87, 253,
+ 130, 34, 162, 10, 138, 42, 170, 1, 128, 32, 160, 8, 136, 40, 168, 2,
+ 66, 226, 98, 202, 74, 234, 106, 192, 64, 224, 96, 200, 72, 232, 104, 194,
+ 178, 18, 146, 58, 186, 26, 154, 48, 176, 16, 144, 56, 184, 24, 152, 50,
114, 210, 82, 250, 122, 218, 90, 240, 112, 208, 80, 248, 120, 216, 88, 242
};
static const byte clustered_dither_data[16 * 16] = {
- 228, 164, 40, 8, 24, 152, 199, 247, 231, 167, 43, 11, 27, 155, 196, 244,
- 116, 52, 96, 176, 80, 64, 135, 215, 119, 55, 99, 179, 83, 67, 132, 212,
- 20, 148, 192, 240, 224, 160, 39, 7, 23, 151, 195, 243, 227, 163, 36, 4,
- 94, 78, 128, 208, 112, 48, 109, 189, 93, 77, 131, 211, 115, 51, 111, 190,
- 238, 174, 32, 1, 16, 144, 205, 253, 237, 173, 35, 3, 19, 147, 206, 254,
- 126, 62, 106, 186, 90, 74, 141, 221, 125, 61, 105, 185, 89, 73, 142, 222,
- 30, 158, 202, 250, 234, 170, 45, 13, 29, 157, 201, 249, 233, 169, 46, 14,
- 86, 70, 138, 218, 122, 58, 101, 181, 85, 69, 137, 217, 121, 57, 102, 182,
- 230, 166, 42, 10, 26, 154, 197, 245, 229, 165, 41, 9, 25, 153, 198, 246,
- 118, 54, 98, 178, 82, 66, 133, 213, 117, 53, 97, 177, 81, 65, 134, 214,
- 22, 150, 194, 242, 226, 162, 37, 5, 21, 149, 193, 241, 225, 161, 38, 6,
- 92, 76, 130, 210, 114, 50, 111, 191, 95, 79, 129, 209, 113, 49, 108, 188,
- 236, 172, 34, 2, 18, 146, 207, 255, 239, 175, 33, 1, 17, 145, 204, 252,
- 124, 60, 104, 184, 88, 72, 143, 223, 127, 63, 107, 187, 91, 75, 140, 220,
- 28, 156, 200, 248, 232, 168, 47, 15, 31, 159, 203, 251, 235, 171, 44, 12,
+ 228, 164, 40, 8, 24, 152, 199, 247, 231, 167, 43, 11, 27, 155, 196, 244,
+ 116, 52, 96, 176, 80, 64, 135, 215, 119, 55, 99, 179, 83, 67, 132, 212,
+ 20, 148, 192, 240, 224, 160, 39, 7, 23, 151, 195, 243, 227, 163, 36, 4,
+ 94, 78, 128, 208, 112, 48, 109, 189, 93, 77, 131, 211, 115, 51, 111, 190,
+ 238, 174, 32, 1, 16, 144, 205, 253, 237, 173, 35, 3, 19, 147, 206, 254,
+ 126, 62, 106, 186, 90, 74, 141, 221, 125, 61, 105, 185, 89, 73, 142, 222,
+ 30, 158, 202, 250, 234, 170, 45, 13, 29, 157, 201, 249, 233, 169, 46, 14,
+ 86, 70, 138, 218, 122, 58, 101, 181, 85, 69, 137, 217, 121, 57, 102, 182,
+ 230, 166, 42, 10, 26, 154, 197, 245, 229, 165, 41, 9, 25, 153, 198, 246,
+ 118, 54, 98, 178, 82, 66, 133, 213, 117, 53, 97, 177, 81, 65, 134, 214,
+ 22, 150, 194, 242, 226, 162, 37, 5, 21, 149, 193, 241, 225, 161, 38, 6,
+ 92, 76, 130, 210, 114, 50, 111, 191, 95, 79, 129, 209, 113, 49, 108, 188,
+ 236, 172, 34, 2, 18, 146, 207, 255, 239, 175, 33, 1, 17, 145, 204, 252,
+ 124, 60, 104, 184, 88, 72, 143, 223, 127, 63, 107, 187, 91, 75, 140, 220,
+ 28, 156, 200, 248, 232, 168, 47, 15, 31, 159, 203, 251, 235, 171, 44, 12,
84, 68, 136, 216, 120, 56, 103, 183, 87, 71, 139, 219, 123, 59, 100, 180
};
@@ -1180,18 +1179,18 @@ static const pcl_ht_builtin_threshold_t noise_dither_thresh = {
noise_dither_data
};
-/* table used to map color rendering modes into monochrome
+/* table used to map color rendering modes into monochrome
*/
static const byte monochrome_remap[20] = { 5, 5, 2, 5,
- 6, 5, 6, 8,
- 8, 10, 10, 12,
- 12, 14, 14, 17,
- 16, 17, 19, 19 };
+ 6, 5, 6, 8,
+ 8, 10, 10, 12,
+ 12, 14, 14, 17,
+ 16, 17, 19, 19 };
/* if true an all gray palette will automatically map
- * itself to a monochrome rendering mode using the monochrome_remap
+ * itself to a monochrome rendering mode using the monochrome_remap
* if false all render algorithms are are left alone
- *
+ *
* This is an optimization that if only gray is used on a page the page is printed with
* only the K plane. This is a work around for PCL not having a gray colorspace.
* Should match the behavior of hp clj 4500, 4550 printers.
@@ -1357,7 +1356,7 @@ pcl_ht_init_render_methods(
pcs->rendering_info[0].pbidither = &pcs->ordered_dither;
- /* 1 - dither doesn't matter */
+ /* 1 - dither doesn't matter */
pcs->rendering_info[1].flags = HT_FIXED | HT_DEVCSPACE;
pcs->rendering_info[1].pbidither = &pcs->ordered_dither;
@@ -1403,7 +1402,7 @@ pcl_ht_init_render_methods(
/* 12 */
pcs->rendering_info[12].flags = HT_FIXED;
pcs->rendering_info[12].pbidither = &pcs->ordered_dither;
-
+
/* 13 - device should override */
pcs->rendering_info[13].flags = HT_NONE;
pcs->rendering_info[13].pbidither = &pcs->noise_dither;
@@ -1411,7 +1410,7 @@ pcl_ht_init_render_methods(
/* 14 - device should override */
pcs->rendering_info[14].flags = HT_NONE;
pcs->rendering_info[14].pbidither = &pcs->noise_dither;
-
+
/* 15 - device should override */
pcs->rendering_info[15].flags = HT_NONE;
pcs->rendering_info[15].pbidither = &pcs->ordered_dither;
@@ -1432,23 +1431,23 @@ pcl_ht_init_render_methods(
pcs->rendering_info[19].flags = HT_NONE;
pcs->rendering_info[19].pbidither = &pcs->ordered_dither;
- {
- /*
- * Remap the the rendering methods. This will generally be
- * selected from the device; the default value provided below
- * maps all methods to ones that are supported in the default
- * system.
- */
- static const byte rendering_remap[20] = {
- 0, 1, 2, 3, /* 0 - 3 */
- 3, 5, 5, 7, /* 4 - 7 */
- 8, 9, 10, 11, /* 8 - 11 */
- 12, 13, 14, 3, /* 12 - 15 */
- 5, 5, 3, 5 /* 16 - 19 */
- };
- for ( i = 0; i < countof(rendering_remap); i++ )
- pcs->dflt_rendering_remap[i] =
- pcs->rendering_remap[i] = rendering_remap[i];
+ {
+ /*
+ * Remap the the rendering methods. This will generally be
+ * selected from the device; the default value provided below
+ * maps all methods to ones that are supported in the default
+ * system.
+ */
+ static const byte rendering_remap[20] = {
+ 0, 1, 2, 3, /* 0 - 3 */
+ 3, 5, 5, 7, /* 4 - 7 */
+ 8, 9, 10, 11, /* 8 - 11 */
+ 12, 13, 14, 3, /* 12 - 15 */
+ 5, 5, 3, 5 /* 16 - 19 */
+ };
+ for ( i = 0; i < countof(rendering_remap); i++ )
+ pcs->dflt_rendering_remap[i] =
+ pcs->rendering_remap[i] = rendering_remap[i];
}
/* get any dither information from the current device */
@@ -1459,7 +1458,7 @@ pcl_ht_init_render_methods(
continue;
gs_c_param_list_write(&list, pmem);
sprintf(nbuff, "Dither_%d", i);
- if ( (param_request((gs_param_list *)&list, nbuff) >= 0) &&
+ if ( (param_request((gs_param_list *)&list, nbuff) >= 0) &&
(gs_getdeviceparams(pcur_dev, (gs_param_list *)&list) >= 0) ) {
gs_param_dict dict;
@@ -1507,12 +1506,11 @@ pcl_ht_set_print_mode(
memcpy(pcs->rendering_remap, pcs->dflt_rendering_remap, sizeof(pcs->rendering_remap));
if (monochrome) {
int i;
- for (i = 0; i < countof(pcs->rendering_remap); i++)
+ for (i = 0; i < countof(pcs->rendering_remap); i++)
pcs->rendering_remap[i] = monochrome_remap[pcs->rendering_remap[i]];
}
}
-
/*
* Free the graphic library halftone objects associated with a PCL halftone
* object.
@@ -1604,8 +1602,8 @@ alloc_pcl_ht(
pht->pdither = 0;
pht->render_method = 3; /* HP specified default value */
- pht->orig_render_method = 3;
- pht->is_gray_render_method = false;
+ pht->orig_render_method = 3;
+ pht->is_gray_render_method = false;
pht->pfg_ht = 0;
pht->pim_ht = 0;
@@ -1623,7 +1621,6 @@ alloc_pcl_ht(
return 0;
}
-
/*
* Make a unique copy of a PCL halftone object.
*
@@ -1682,35 +1679,35 @@ unshare_pcl_ht(
}
/* return true if all palette entries are gray
- * return false if any entry is color
+ * return false if any entry is color
* checks the entire palette
* all gray palette ONLY has meaning if ENABLE_AUTO_GRAY_RENDER_METHODS is true
* otherwise this is a NOP that always returns false.
*/
-bool
+bool
pcl_ht_is_all_gray_palette(pcl_state_t *pcs)
{
- if ( pcs->monochrome_mode )
+ if ( pcs->monochrome_mode )
return true;
if ( ENABLE_AUTO_GRAY_RENDER_METHODS ) {
- bool is_gray = true;
- const char *pb = 0;
- pcl_palette_t * ppalet = pcs->ppalet;
- pcl_cs_indexed_t * pindexed = ppalet->pindexed;
- int i;
-
- for ( i = 0; i < pindexed->num_entries; i++ ) {
- pb = pindexed->palette.data + (3 * i);
- if ( pb[0] == pb[1] && pb[0] == pb[2] ) {
- continue;
- }
- else {
- is_gray = false;
- break;
- }
- }
- return is_gray;
+ bool is_gray = true;
+ const char *pb = 0;
+ pcl_palette_t * ppalet = pcs->ppalet;
+ pcl_cs_indexed_t * pindexed = ppalet->pindexed;
+ int i;
+
+ for ( i = 0; i < pindexed->num_entries; i++ ) {
+ pb = pindexed->palette.data + (3 * i);
+ if ( pb[0] == pb[1] && pb[0] == pb[2] ) {
+ continue;
+ }
+ else {
+ is_gray = false;
+ break;
+ }
+ }
+ return is_gray;
}
return false; /* feature disabled, concider it color */
}
@@ -1734,11 +1731,11 @@ pcl_ht_set_render_method(
return 0;
/* normal rendering remap */
- color_render_method = pcs->rendering_remap[render_method];
-
+ color_render_method = pcs->rendering_remap[render_method];
+
if (color_render_method == (*ppht)->orig_render_method)
return 0;
-
+
if ((code = unshare_pcl_ht(ppht)) < 0)
return code;
@@ -1747,15 +1744,15 @@ pcl_ht_set_render_method(
(*ppht)->is_gray_render_method = false;
/* remap render algo based on is the palette gray palette check */
- return pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- pcl_ht_is_all_gray_palette(pcs));
+ return pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ pcl_ht_is_all_gray_palette(pcs));
}
/* if the palette is gray remap the render_algorithm to a gray algo
* if the palette is color use the original "color" render_algorithm
* degenerates to NOP if ENABLE_AUTO_GRAY_RENDER_METHODS is false
- */
+ */
int
pcl_ht_remap_render_method(
pcl_state_t * pcs,
@@ -1765,21 +1762,21 @@ pcl_ht_remap_render_method(
{
if ( ENABLE_AUTO_GRAY_RENDER_METHODS ) {
uint render_method = (*ppht)->orig_render_method;
- int code = 0;
- if (is_gray != (*ppht)->is_gray_render_method ) {
- if( is_gray ) {
- render_method = monochrome_remap[pcs->rendering_remap[render_method]];
- (*ppht)->is_gray_render_method = is_gray;
- }
- else {
- render_method = (*ppht)->orig_render_method;
- }
-
- if ((code = unshare_pcl_ht(ppht)) < 0)
- return code;
-
- (*ppht)->render_method = render_method;
- }
+ int code = 0;
+ if (is_gray != (*ppht)->is_gray_render_method ) {
+ if( is_gray ) {
+ render_method = monochrome_remap[pcs->rendering_remap[render_method]];
+ (*ppht)->is_gray_render_method = is_gray;
+ }
+ else {
+ render_method = (*ppht)->orig_render_method;
+ }
+
+ if ((code = unshare_pcl_ht(ppht)) < 0)
+ return code;
+
+ (*ppht)->render_method = render_method;
+ }
}
/* else feature disabled NOP */
return 0;
@@ -1801,7 +1798,7 @@ pcl_ht_set_gamma(
int code = 0;
int i;
- /*
+ /*
* All of the gamma correction factors and lookup table pointers are the
* same, so just check the first of these. If nothing has changed, just
* return.
@@ -1938,7 +1935,6 @@ identity_transfer(floatp tint, const gx_transfer_map *ignore_map)
{ return tint;
}
-
#ifdef DEVICE_HAS_CRD
/*
* Get the rendering information corresponding to a given rendering method.
@@ -1956,7 +1952,7 @@ get_rendering_info(
{
pcl_rend_info_t * pinfo = &(pcs->rendering_info[sel_method]);
uint flags = pinfo->flags;
-
+
/* check for methods that require device-dependent color spaces */
if ( (((flags & HT_DEVCSPACE) != 0) && (cstype > pcl_cspace_CMY)) ||
(((flags & HT_IMONLY) != 0) && !for_image) )
diff --git a/pcl/pcht.h b/pcl/pcht.h
index aff54b65a..1e0cd2047 100644
--- a/pcl/pcht.h
+++ b/pcl/pcht.h
@@ -26,7 +26,6 @@
#include "pclookup.h"
#include "pcdither.h"
-
/*
* Structure for built-in dither methods. "built-in" in this case refers to
* items that cannot be modifiied by the user via the PCL interpreter; there
@@ -47,7 +46,7 @@
* should be provided as:
*
* red(0, 0), red(1, 0), red(0, 1), red(1, 1), green(0, 0), ..., blue(1, 1)
- *
+ *
* For table dithers, data is organized by (device-space) row, then column,
* then level (the intensity level to which the given color plane corresponds),
* then color plane. Data is one bit per pixel, high-order-bit leftmost, and
@@ -122,7 +121,7 @@ typedef struct pcl_ht_builtin_dither_s {
*
* The HT_FIXED flag indicates which methods may not be changed by the output
* device. The ordered, clustered ordered, and user-defined dithers (both
- * color and monochrome versions) are in this category, because they must
+ * color and monochrome versions) are in this category, because they must
* have predictable matrices for the logical operations to produce predictable
* results.
*
@@ -268,14 +267,13 @@ void pcl_ht_set_print_mode(pcl_state_t *pcs, bool monochrome);
*/
int pcl_ht_set_render_method(pcl_state_t *pcs, pcl_ht_t ** ppht, uint render_method);
-
-/**
- * Remap render method to a gray render method iff enabled && palette is all gray
+/**
+ * Remap render method to a gray render method iff enabled && palette is all gray
*
* if the palette is gray remap the render_algorithm to a gray algo
* if the palette is color use the original "color" render_algorithm
* degenerates to NOP if ENABLE_AUTO_GRAY_RENDER_METHODS is false
- */
+ */
int pcl_ht_remap_render_method(pcl_state_t * pcs,
pcl_ht_t **ppht,
bool is_gray
@@ -285,7 +283,7 @@ int pcl_ht_remap_render_method(pcl_state_t * pcs,
* Checks if all palette entries are gray iff enabled.
*
* Returns true if all palette entries are gray
- * Returns false if any entry is color
+ * Returns false if any entry is color
* checks the entire palette
* all gray palette ONLY has meaning if ENABLE_AUTO_GRAY_RENDER_METHODS is true
* otherwise this is a NOP that always returns false.
diff --git a/pcl/pcimpl.c b/pcl/pcimpl.c
index 6f43868b9..2735e3db8 100644
--- a/pcl/pcimpl.c
+++ b/pcl/pcimpl.c
@@ -22,7 +22,6 @@ extern const pl_interp_implementation_t pcl_implementation;
/* Zero-terminated list of pointers to implementations */
pl_interp_implementation_t const * const pdl_implementation[] = {
- &pcl_implementation,
- 0
+ &pcl_implementation,
+ 0
};
-
diff --git a/pcl/pcindxed.c b/pcl/pcindxed.c
index 2ec174566..dff9185f7 100644
--- a/pcl/pcindxed.c
+++ b/pcl/pcindxed.c
@@ -51,9 +51,8 @@ RELOC_PTRS_END
private_st_cs_indexed_t();
-
/*
- * Find the smallest non-negative integral exponent of 2 larger than
+ * Find the smallest non-negative integral exponent of 2 larger than
* or equal to the given number; 8 => 2^3 12 => 2^4
* Note: in/out should be unsigned.
*/
@@ -65,8 +64,8 @@ get_pow_2(
int i;
unsigned power_2 = 1;
- for (i = 0; (unsigned)num > power_2; ++i)
- power_2 <<= 1;
+ for (i = 0; (unsigned)num > power_2; ++i)
+ power_2 <<= 1;
return i;
}
@@ -212,7 +211,6 @@ unshare_indexed_cspace(
return 0;
}
-
/*
* Fill in the default entries in a color palette. This is handled separately
* for each color space type.
@@ -340,7 +338,7 @@ set_colmet_default_palette(
* a somewhat different output is produced, but this is as close as we can
* come to a "device independent" set of default entries.
*
- * The code provides some compensation for range: if the desired value is
+ * The code provides some compensation for range: if the desired value is
* within the permitted range, the palette entry intensity (always in the range
* [0, 1]) will be adjusted so as to achieve it; otherwise the intensity will
* be set to the appropriate bound. Obviously, none of this works if a
@@ -389,7 +387,7 @@ set_CIELab_default_palette(
* and we provide those primaries in the default palette. Since the
* palette entries themselves are in the luminance-chrominance color space,
* the default values must be converted to that color space.
- *
+ *
* An adjustment is made for the specified ranges.
*/
static void
@@ -407,7 +405,7 @@ set_lumchrom_default_palette(
pcl_mtx3_t tmp_mtx;
int i;
static const pcl_vec3_t lumchrom_default[8] = {
- { 1.0, 1.0, 1.0 }, /* white */
+ { 1.0, 1.0, 1.0 }, /* white */
{ 0.0, 1.0, 1.0 }, /* cyan */
{ 1.0, 0.0, 1.0 }, /* magenta */
{ 0.0, 0.0, 1.0 }, /* blue */
@@ -457,7 +455,7 @@ set_default_entries(
byte * palette,
const byte * porder,
int start,
- int num
+ int num
) = {
set_dev_specific_default_palette, /* RGB */
set_dev_specific_default_palette, /* CMY */
@@ -710,7 +708,7 @@ pcl_cs_indexed_set_num_entries(
* Set new_num to the smallest larger power of 2 less than
* pcl_cs_indexed_palette_size.
*/
- bits = ( bits > pcl_cs_indexed_palette_size_log
+ bits = ( bits > pcl_cs_indexed_palette_size_log
? pcl_cs_indexed_palette_size_log
: bits );
new_num = 1L << bits;
@@ -798,7 +796,7 @@ pcl_cs_indexed_update_lookup_tbl(
(gs_const_string *)&(pindexed->palette),
pindexed->rc.memory
);
-
+
}
/*
@@ -833,7 +831,7 @@ pcl_cs_indexed_set_palette_entry(
/* get a unique copy of the indexed color space */
if ((code = unshare_indexed_cspace(ppindexed)) < 0)
return code;
- pindexed = *ppindexed;
+ pindexed = *ppindexed;
/* normalize and store the entry */
indx *= 3;
@@ -842,7 +840,7 @@ pcl_cs_indexed_set_palette_entry(
floatp val = comps[i];
if (pn->inv_range == 0)
- val = (val >= pn->blkref ? 255.0 : 0.0);
+ val = (val >= pn->blkref ? 255.0 : 0.0);
else {
val = (val - pn->blkref) * pn->inv_range;
val = (val < 0.0 ? 0.0 : (val > 255.0 ? 255.0 : val));
@@ -880,7 +878,7 @@ pcl_cs_indexed_set_default_palette_entry(
/* get a unique copy of the indexed color space */
if ((code = unshare_indexed_cspace(ppindexed)) < 0)
return code;
- pindexed = *ppindexed;
+ pindexed = *ppindexed;
return set_default_entries(*ppindexed, indx, 1, true);
}
@@ -997,7 +995,7 @@ pcl_cs_indexed_build_cspace(
int i;
for (i = 0; i < 3; i++) {
- wht_ref[i] = (1L << pcl_cid_get_bits_per_primary(pcid, i)) - 1;
+ wht_ref[i] = (1L << pcl_cid_get_bits_per_primary(pcid, i)) - 1;
blk_ref[i] = 0.0;
}
@@ -1035,7 +1033,7 @@ pcl_cs_indexed_build_cspace(
* Build the default indexed color space. This function is usually called only
* once, at initialization time.
*
- * Returns 0 on success, < 0
+ * Returns 0 on success, < 0
*/
int
pcl_cs_indexed_build_default_cspace(
@@ -1049,7 +1047,7 @@ pcl_cs_indexed_build_default_cspace(
pcs->dflt_cid_data.u.hdr = dflt_cid_hdr;
pcs->dflt_cid_data.original_cspace = pcl_cspace_num;
return pcl_cs_indexed_build_cspace( pcs,
- ppindexed,
+ ppindexed,
&pcs->dflt_cid_data,
true,
false,
diff --git a/pcl/pcindxed.h b/pcl/pcindxed.h
index d0639cd68..9412c4c1d 100644
--- a/pcl/pcindxed.h
+++ b/pcl/pcindxed.h
@@ -26,7 +26,6 @@
#include "pclookup.h"
#include "pccsbase.h"
-
/*
* Size of a PCL color palette. All palettes are allocated at this size, as
* GL/2 may change the size of a palette after it has been created.
@@ -40,7 +39,6 @@
#define pcl_cs_indexed_palette_size_log 8
#define pcl_cs_indexed_palette_size (1 << pcl_cs_indexed_palette_size_log)
-
/*
* Structure to hold the parameters that normalize raw color values to values
* usable for the base color space. The formula used is:
@@ -60,7 +58,6 @@ typedef struct pcl_cs_indexed_norm_s {
float inv_range; /* 255 / (whtref - blkref) */
} pcl_cs_indexed_norm_t;
-
/*
* PCL indexed color space. This consists of:
*
@@ -294,7 +291,7 @@ int pcl_cs_indexed_set_pen_width(
* Returns 0 if successful, < 0 in case of error.
*/
int pcl_cs_indexed_build_cspace(
- pcl_state_t * pcs,
+ pcl_state_t * pcs,
pcl_cs_indexed_t ** ppindexed,
const pcl_cid_data_t * pcid,
bool fixed,
@@ -306,7 +303,7 @@ int pcl_cs_indexed_build_cspace(
* Build the default indexed color space. This function is usually called only
* once, at initialization time.
*
- * Returns 0 on success, < 0
+ * Returns 0 on success, < 0
*/
int pcl_cs_indexed_build_default_cspace(
pcl_state_t * pcs,
diff --git a/pcl/pcjob.c b/pcl/pcjob.c
index 1304bf212..539281185 100644
--- a/pcl/pcjob.c
+++ b/pcl/pcjob.c
@@ -31,207 +31,207 @@ int
pcl_do_printer_reset(pcl_state_t *pcs)
{
if ( pcs->macro_level )
- return e_Range; /* not allowed inside macro */
+ return e_Range; /* not allowed inside macro */
/* reset the other parser in case we have gotten the
pcl_printer_reset while in gl/2 mode. */
pcl_implicit_gl2_finish(pcs);
/* Print any partial page if not pclxl snippet mode. */
if (pcs->end_page == pcl_end_page_top) {
- int code = pcl_end_page_if_marked(pcs);
- if ( code < 0 )
- return code;
- /* if duplex start on the front side of the paper */
- if ( pcs->duplex )
- put_param1_bool(pcs, "FirstSide", true);
+ int code = pcl_end_page_if_marked(pcs);
+ if ( code < 0 )
+ return code;
+ /* if duplex start on the front side of the paper */
+ if ( pcs->duplex )
+ put_param1_bool(pcs, "FirstSide", true);
}
/* unload fonts */
-
+
/* Reset to user default state. */
return pcl_do_resets(pcs, pcl_reset_printer);
}
-
+
static int /* ESC E */
pcl_printer_reset(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
return pcl_do_printer_reset(pcs);
}
static int /* ESC % -12345 X */
pcl_exit_language(pcl_args_t *pargs, pcl_state_t *pcs)
{ if ( int_arg(pargs) != -12345 )
- return e_Range;
- { int code = pcl_printer_reset(pargs, pcs);
- return (code < 0 ? code : e_ExitLanguage);
- }
+ return e_Range;
+ { int code = pcl_printer_reset(pargs, pcs);
+ return (code < 0 ? code : e_ExitLanguage);
+ }
}
static int /* ESC & l <num_copies> X */
pcl_number_of_copies(pcl_args_t *pargs, pcl_state_t *pcs)
{ int i = int_arg(pargs);
- if ( i < 1 )
- return 0;
- pcs->num_copies = i;
- return put_param1_int(pcs, "NumCopies", i);
+ if ( i < 1 )
+ return 0;
+ pcs->num_copies = i;
+ return put_param1_int(pcs, "NumCopies", i);
}
static int /* ESC & l <sd_enum> S */
pcl_simplex_duplex_print(pcl_args_t *pargs, pcl_state_t *pcs)
{ int code;
- bool reopen = false;
+ bool reopen = false;
- /* oddly the command goes to the next page irrespective of
+ /* oddly the command goes to the next page irrespective of
arguments */
- code = pcl_end_page_if_marked(pcs);
- if ( code < 0 )
- return code;
- pcl_home_cursor(pcs);
- switch ( int_arg(pargs) )
- {
- case 0:
- pcs->duplex = false;
- break;
- case 1:
- pcs->duplex = true;
- pcs->bind_short_edge = false;
- break;
- case 2:
- pcs->duplex = true;
- pcs->bind_short_edge = true;
- break;
- default:
- return 0;
- }
- code = put_param1_bool(pcs, "Duplex", pcs->duplex);
- switch ( code )
- {
- case 1: /* reopen device */
- reopen = true;
- case 0:
- break;
- case gs_error_undefined:
- return 0;
- default: /* error */
- if ( code < 0 )
- return code;
- }
- code = put_param1_bool(pcs, "BindShortEdge", pcs->bind_short_edge);
- switch ( code )
- {
- case 1: /* reopen device */
- reopen = true;
- case 0:
- case gs_error_undefined:
- break;
- default: /* error */
- if ( code < 0 )
- return code;
- }
- return (reopen ? gs_setdevice_no_erase(pcs->pgs,
- gs_currentdevice(pcs->pgs)) :
- 0);
+ code = pcl_end_page_if_marked(pcs);
+ if ( code < 0 )
+ return code;
+ pcl_home_cursor(pcs);
+ switch ( int_arg(pargs) )
+ {
+ case 0:
+ pcs->duplex = false;
+ break;
+ case 1:
+ pcs->duplex = true;
+ pcs->bind_short_edge = false;
+ break;
+ case 2:
+ pcs->duplex = true;
+ pcs->bind_short_edge = true;
+ break;
+ default:
+ return 0;
+ }
+ code = put_param1_bool(pcs, "Duplex", pcs->duplex);
+ switch ( code )
+ {
+ case 1: /* reopen device */
+ reopen = true;
+ case 0:
+ break;
+ case gs_error_undefined:
+ return 0;
+ default: /* error */
+ if ( code < 0 )
+ return code;
+ }
+ code = put_param1_bool(pcs, "BindShortEdge", pcs->bind_short_edge);
+ switch ( code )
+ {
+ case 1: /* reopen device */
+ reopen = true;
+ case 0:
+ case gs_error_undefined:
+ break;
+ default: /* error */
+ if ( code < 0 )
+ return code;
+ }
+ return (reopen ? gs_setdevice_no_erase(pcs->pgs,
+ gs_currentdevice(pcs->pgs)) :
+ 0);
}
static int /* ESC & a <side_enum> G */
pcl_duplex_page_side_select(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint i = uint_arg(pargs);
- int code;
+ int code;
- /* oddly the command goes to the next page irrespective of
+ /* oddly the command goes to the next page irrespective of
arguments */
- code = pcl_end_page_if_marked(pcs);
- if ( code < 0 )
- return code;
- pcl_home_cursor(pcs);
+ code = pcl_end_page_if_marked(pcs);
+ if ( code < 0 )
+ return code;
+ pcl_home_cursor(pcs);
- if ( i > 2 )
- return 0;
+ if ( i > 2 )
+ return 0;
- if ( i > 0 && pcs->duplex )
- put_param1_bool(pcs, "FirstSide", i == 1);
- return 0;
+ if ( i > 0 && pcs->duplex )
+ put_param1_bool(pcs, "FirstSide", i == 1);
+ return 0;
}
static int /* ESC & l 1 T */
pcl_job_separation(pcl_args_t *pargs, pcl_state_t *pcs)
{ int i = int_arg(pargs);
- if ( i != 1 )
- return 0;
- /**** NEED A DRIVER PROCEDURE FOR END-OF-JOB ****/
- return 0;
+ if ( i != 1 )
+ return 0;
+ /**** NEED A DRIVER PROCEDURE FOR END-OF-JOB ****/
+ return 0;
}
static int /* ESC & l <bin_enum> G */
pcl_output_bin_selection(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint i = uint_arg(pargs);
- if ( i < 1 || i > 2 )
- return e_Range;
- return put_param1_int(pcs, "OutputBin", i);
+ if ( i < 1 || i > 2 )
+ return e_Range;
+ return put_param1_int(pcs, "OutputBin", i);
}
static int /* ESC & u <upi> B */
pcl_set_unit_of_measure(pcl_args_t *pargs, pcl_state_t *pcs)
{ int num = int_arg(pargs);
- if ( num <= 96 )
- num = 96;
- else if ( num >= 7200 )
- num = 7200;
- else if ( 7200 % num != 0 )
- { /* Pick the exact divisor of 7200 with the smallest */
- /* relative error. */
- static const int values[] = {
- 96, 100, 120, 144, 150, 160, 180, 200, 225, 240, 288,
- 300, 360, 400, 450, 480, 600, 720, 800, 900,
- 1200, 1440, 1800, 2400, 3600, 7200
- };
- const int *p = values;
+ if ( num <= 96 )
+ num = 96;
+ else if ( num >= 7200 )
+ num = 7200;
+ else if ( 7200 % num != 0 )
+ { /* Pick the exact divisor of 7200 with the smallest */
+ /* relative error. */
+ static const int values[] = {
+ 96, 100, 120, 144, 150, 160, 180, 200, 225, 240, 288,
+ 300, 360, 400, 450, 480, 600, 720, 800, 900,
+ 1200, 1440, 1800, 2400, 3600, 7200
+ };
+ const int *p = values;
- while ( num > p[1] ) p++;
- /* Now *p < num < p[1]. */
- if ( (p[1] - (float)num) / p[1] < ((float)num - *p) / *p )
- p++;
- num = *p;
- }
- pcs->uom_cp = pcl_coord_scale / num;
- return 0;
+ while ( num > p[1] ) p++;
+ /* Now *p < num < p[1]. */
+ if ( (p[1] - (float)num) / p[1] < ((float)num - *p) / *p )
+ p++;
+ num = *p;
+ }
+ pcs->uom_cp = pcl_coord_scale / num;
+ return 0;
}
/* Initialization */
static int
pcjob_do_registration(pcl_parser_state_t *pcl_parser_state, gs_memory_t *mem)
{ /* Register commands */
- DEFINE_ESCAPE_ARGS('E', "Printer Reset", pcl_printer_reset, pca_in_rtl)
- DEFINE_CLASS('%')
- {0, 'X', {pcl_exit_language, pca_neg_ok|pca_big_error|pca_in_rtl}},
- END_CLASS
- DEFINE_CLASS('&')
- {'l', 'X',
- PCL_COMMAND("Number of Copies", pcl_number_of_copies,
- pca_neg_ignore|pca_big_clamp)},
- {'l', 'S',
- PCL_COMMAND("Simplex/Duplex Print", pcl_simplex_duplex_print,
- pca_neg_ignore|pca_big_ignore)},
- {'a', 'G',
- PCL_COMMAND("Duplex Page Side Select",
- pcl_duplex_page_side_select,
- pca_neg_ignore|pca_big_ignore)},
- {'l', 'T',
- PCL_COMMAND("Job Separation", pcl_job_separation,
- pca_neg_error|pca_big_error)},
- {'l', 'G',
- PCL_COMMAND("Output Bin Selection", pcl_output_bin_selection,
- pca_neg_error|pca_big_error)},
- {'u', 'D',
- PCL_COMMAND("Set Unit of Measure", pcl_set_unit_of_measure,
- pca_neg_error|pca_big_error)},
- END_CLASS
- return 0;
+ DEFINE_ESCAPE_ARGS('E', "Printer Reset", pcl_printer_reset, pca_in_rtl)
+ DEFINE_CLASS('%')
+ {0, 'X', {pcl_exit_language, pca_neg_ok|pca_big_error|pca_in_rtl}},
+ END_CLASS
+ DEFINE_CLASS('&')
+ {'l', 'X',
+ PCL_COMMAND("Number of Copies", pcl_number_of_copies,
+ pca_neg_ignore|pca_big_clamp)},
+ {'l', 'S',
+ PCL_COMMAND("Simplex/Duplex Print", pcl_simplex_duplex_print,
+ pca_neg_ignore|pca_big_ignore)},
+ {'a', 'G',
+ PCL_COMMAND("Duplex Page Side Select",
+ pcl_duplex_page_side_select,
+ pca_neg_ignore|pca_big_ignore)},
+ {'l', 'T',
+ PCL_COMMAND("Job Separation", pcl_job_separation,
+ pca_neg_error|pca_big_error)},
+ {'l', 'G',
+ PCL_COMMAND("Output Bin Selection", pcl_output_bin_selection,
+ pca_neg_error|pca_big_error)},
+ {'u', 'D',
+ PCL_COMMAND("Set Unit of Measure", pcl_set_unit_of_measure,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ return 0;
}
static void
pcjob_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
-{
- if ( type & (pcl_reset_initial | pcl_reset_printer) ) {
+{
+ if ( type & (pcl_reset_initial | pcl_reset_printer) ) {
pcs->num_copies = pjl_proc_vartoi(pcs->pjls,
pjl_proc_get_envvar(pcs->pjls, "copies"));
pcs->duplex = !pjl_proc_compare(pcs->pjls,
diff --git a/pcl/pclookup.c b/pcl/pclookup.c
index 7ac39166c..a39fa7bc5 100644
--- a/pcl/pclookup.c
+++ b/pcl/pclookup.c
@@ -53,7 +53,7 @@ set_lookup_tbl(
int code = 0;
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
/* check for clearing of lookup tables, and for incorrect size */
if (len == 0)
@@ -122,7 +122,7 @@ set_gamma_correction(
float gamma = float_arg(pargs);
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
if ((gamma < 0.0) || (gamma > (float)((1L << 15) - 1)))
return 0;
else
diff --git a/pcl/pclookup.h b/pcl/pclookup.h
index 8ba5c2434..d05393bce 100644
--- a/pcl/pclookup.h
+++ b/pcl/pclookup.h
@@ -153,7 +153,7 @@ typedef struct pcl__lookup_tbl_s {
* The pcl_lookup_t structure provides a reference-count header for a lookup
* table. This is necessary because there is a way that lookup tables can
* shared between PCL base color spaces (this could occur in the case of a
- * luminance-chrominance color space, which might have an instantiation with
+ * luminance-chrominance color space, which might have an instantiation with
* two color tables that shares one of these color tables with another
* instantiation).
*/
diff --git a/pcl/pcmacros.c b/pcl/pcmacros.c
index be95b444e..49db5bd8f 100644
--- a/pcl/pcmacros.c
+++ b/pcl/pcmacros.c
@@ -27,43 +27,43 @@ static int
do_copies(pcl_state_t *psaved, pcl_state_t *pcs,
pcl_copy_operation_t copy)
{ const pcl_init_t **init = pcl_init_table;
- int code = 0;
+ int code = 0;
- for ( ; *init && code >= 0; ++init )
- if ( (*init)->do_copy )
- code = (*(*init)->do_copy)(psaved, pcs, copy);
- return code;
+ for ( ; *init && code >= 0; ++init )
+ if ( (*init)->do_copy )
+ code = (*(*init)->do_copy)(psaved, pcs, copy);
+ return code;
}
int
pcl_execute_macro(const pcl_macro_t *pmac, pcl_state_t *pcs,
pcl_copy_operation_t before, pcl_reset_type_t reset,
pcl_copy_operation_t after)
-{
+{
pcl_parser_state_t state;
hpgl_parser_state_t gstate;
pcl_state_t saved;
stream_cursor_read r;
int code;
- if ( before ) {
- memcpy(&saved, pcs, sizeof(*pcs));
- do_copies(&saved, pcs, before);
- pcs->saved = &saved;
+ if ( before ) {
+ memcpy(&saved, pcs, sizeof(*pcs));
+ do_copies(&saved, pcs, before);
+ pcs->saved = &saved;
}
if ( reset )
- pcl_do_resets(pcs, reset);
+ pcl_do_resets(pcs, reset);
state.definitions = pcs->pcl_commands;
state.hpgl_parser_state=&gstate;
pcl_process_init(&state);
r.ptr = (const byte *)(pmac + 1) - 1;
r.limit =
- (const byte *)pmac + (gs_object_size(pcs->memory, pmac) - 1);
+ (const byte *)pmac + (gs_object_size(pcs->memory, pmac) - 1);
pcs->macro_level++;
code = pcl_process(&state, pcs, &r);
pcs->macro_level--;
- if ( after ) {
- do_copies(&saved, pcs, after);
- memcpy(pcs, &saved, sizeof(*pcs));
+ if ( after ) {
+ do_copies(&saved, pcs, after);
+ memcpy(pcs, &saved, sizeof(*pcs));
}
return code;
}
@@ -81,128 +81,128 @@ enum {
static int /* ESC & f <mc_enum> X */
pcl_macro_control(pcl_args_t *pargs, pcl_state_t *pcs)
{ int i = int_arg(pargs);
- gs_const_string key;
- void *value;
- pl_dict_enum_t denum;
+ gs_const_string key;
+ void *value;
+ pl_dict_enum_t denum;
- if ( i == macro_end_definition )
- { if ( pcs->defining_macro )
- { /* The parser has included everything through this command */
- /* in the macro_definition, so we can finish things up. */
- int code;
- code = pl_dict_put(&pcs->macros, current_macro_id,
- current_macro_id_size, pcs->macro_definition);
- pcs->defining_macro = false;
- pcs->macro_definition = 0;
- return code;
- }
- }
- else if ( pcs->defining_macro )
- return 0; /* don't execute other macro operations */
- else if ( i == macro_execute || i == macro_call )
- { /*
- * TRM 12-9 says that "two levels of nesting are allowed",
- * which means 3 levels of macros (1 non-nested, 2 nested).
- */
- if ( pcs->macro_level > 2 )
- return 0;
- }
- else if ( pcs->macro_level )
- return e_Range; /* macro operations not allowed inside macro */
- switch ( i )
- {
- case 0:
- { /* Start defining <macro_id>. */
- pcl_macro_t *pmac;
+ if ( i == macro_end_definition )
+ { if ( pcs->defining_macro )
+ { /* The parser has included everything through this command */
+ /* in the macro_definition, so we can finish things up. */
+ int code;
+ code = pl_dict_put(&pcs->macros, current_macro_id,
+ current_macro_id_size, pcs->macro_definition);
+ pcs->defining_macro = false;
+ pcs->macro_definition = 0;
+ return code;
+ }
+ }
+ else if ( pcs->defining_macro )
+ return 0; /* don't execute other macro operations */
+ else if ( i == macro_execute || i == macro_call )
+ { /*
+ * TRM 12-9 says that "two levels of nesting are allowed",
+ * which means 3 levels of macros (1 non-nested, 2 nested).
+ */
+ if ( pcs->macro_level > 2 )
+ return 0;
+ }
+ else if ( pcs->macro_level )
+ return e_Range; /* macro operations not allowed inside macro */
+ switch ( i )
+ {
+ case 0:
+ { /* Start defining <macro_id>. */
+ pcl_macro_t *pmac;
- pl_dict_undef_purge_synonyms(&pcs->macros, current_macro_id, current_macro_id_size);
- pmac = (pcl_macro_t *)
- gs_alloc_bytes(pcs->memory, sizeof(pcl_macro_t),
- "begin macro definition");
- if ( pmac == 0 )
- return_error(e_Memory);
- pmac->storage = pcds_temporary;
- pcs->macro_definition = (byte *)pmac;
- pcs->defining_macro = true;
- return 0;
- }
- case macro_end_definition: /* 1 */
- { /* Stop defining macro. Outside a macro, this is an error. */
- return e_Range;
- }
- case macro_execute: /* 2 */
- { /* Execute <macro_id>. */
- void *value;
- if ( !pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size,
- &value)
- )
- return 0;
- return pcl_execute_macro((const pcl_macro_t *)value, pcs,
- pcl_copy_none, pcl_reset_none, pcl_copy_none);
- }
- case macro_call: /* 3 */
- { /* Call <macro_id>, saving and restoring environment. */
- void *value;
- if ( !pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size,
- &value)
- )
- return 0;
- return pcl_execute_macro((const pcl_macro_t *)value, pcs,
- pcl_copy_before_call, pcl_reset_none,
- pcl_copy_after_call);
- }
- case 4:
- { /* Define <macro_id> as automatic overlay. */
- pcs->overlay_macro_id = pcs->macro_id;
- pcs->overlay_enabled = true;
- return 0;
- }
- case 5:
- { /* Cancel automatic overlay. */
- pcs->overlay_enabled = false;
- return 0;
- }
- case 6:
- { /* Delete all macros. */
- pl_dict_release(&pcs->macros);
- return 0;
- }
- case macro_delete_temporary: /* 7 */
- { /* Delete temporary macros. */
- pl_dict_enum_stack_begin(&pcs->macros, &denum, false);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- if ( ((pcl_macro_t *)value)->storage == pcds_temporary )
- pl_dict_undef_purge_synonyms(&pcs->macros, key.data, key.size);
- return 0;
- }
- case 8:
- { /* Delete <macro_id>. */
- pl_dict_undef_purge_synonyms(&pcs->macros, current_macro_id, current_macro_id_size);
- return 0;
- }
- case 9:
- { /* Make <macro_id> temporary. */
- if ( pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size, &value) )
- ((pcl_macro_t *)value)->storage = pcds_temporary;
- return 0;
- }
- case 10:
- { /* Make <macro_id> permanent. */
- if ( pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size, &value) )
- ((pcl_macro_t *)value)->storage = pcds_permanent;
- return 0;
- }
- default:
- return e_Range;
- }
+ pl_dict_undef_purge_synonyms(&pcs->macros, current_macro_id, current_macro_id_size);
+ pmac = (pcl_macro_t *)
+ gs_alloc_bytes(pcs->memory, sizeof(pcl_macro_t),
+ "begin macro definition");
+ if ( pmac == 0 )
+ return_error(e_Memory);
+ pmac->storage = pcds_temporary;
+ pcs->macro_definition = (byte *)pmac;
+ pcs->defining_macro = true;
+ return 0;
+ }
+ case macro_end_definition: /* 1 */
+ { /* Stop defining macro. Outside a macro, this is an error. */
+ return e_Range;
+ }
+ case macro_execute: /* 2 */
+ { /* Execute <macro_id>. */
+ void *value;
+ if ( !pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size,
+ &value)
+ )
+ return 0;
+ return pcl_execute_macro((const pcl_macro_t *)value, pcs,
+ pcl_copy_none, pcl_reset_none, pcl_copy_none);
+ }
+ case macro_call: /* 3 */
+ { /* Call <macro_id>, saving and restoring environment. */
+ void *value;
+ if ( !pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size,
+ &value)
+ )
+ return 0;
+ return pcl_execute_macro((const pcl_macro_t *)value, pcs,
+ pcl_copy_before_call, pcl_reset_none,
+ pcl_copy_after_call);
+ }
+ case 4:
+ { /* Define <macro_id> as automatic overlay. */
+ pcs->overlay_macro_id = pcs->macro_id;
+ pcs->overlay_enabled = true;
+ return 0;
+ }
+ case 5:
+ { /* Cancel automatic overlay. */
+ pcs->overlay_enabled = false;
+ return 0;
+ }
+ case 6:
+ { /* Delete all macros. */
+ pl_dict_release(&pcs->macros);
+ return 0;
+ }
+ case macro_delete_temporary: /* 7 */
+ { /* Delete temporary macros. */
+ pl_dict_enum_stack_begin(&pcs->macros, &denum, false);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ if ( ((pcl_macro_t *)value)->storage == pcds_temporary )
+ pl_dict_undef_purge_synonyms(&pcs->macros, key.data, key.size);
+ return 0;
+ }
+ case 8:
+ { /* Delete <macro_id>. */
+ pl_dict_undef_purge_synonyms(&pcs->macros, current_macro_id, current_macro_id_size);
+ return 0;
+ }
+ case 9:
+ { /* Make <macro_id> temporary. */
+ if ( pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size, &value) )
+ ((pcl_macro_t *)value)->storage = pcds_temporary;
+ return 0;
+ }
+ case 10:
+ { /* Make <macro_id> permanent. */
+ if ( pl_dict_find(&pcs->macros, current_macro_id, current_macro_id_size, &value) )
+ ((pcl_macro_t *)value)->storage = pcds_permanent;
+ return 0;
+ }
+ default:
+ return e_Range;
+ }
}
static int /* ESC & f <id> Y */
pcl_assign_macro_id(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint id = uint_arg(pargs);
- id_set_value(pcs->macro_id, id);
- pcs->macro_id_type = numeric_id;
- return 0;
+ id_set_value(pcs->macro_id, id);
+ pcs->macro_id_type = numeric_id;
+ return 0;
}
/* Initialization */
@@ -211,56 +211,56 @@ pcmacros_do_registration(
pcl_parser_state_t *pcl_parser_state,
gs_memory_t *mem)
{ /* Register commands */
- DEFINE_CLASS('&')
- {'f', 'X',
- PCL_COMMAND("Macro Control", pcl_macro_control,
- pca_neg_error|pca_big_error|pca_in_macro)},
- {'f', 'Y',
- PCL_COMMAND("Assign Macro ID", pcl_assign_macro_id,
- pca_neg_error|pca_big_error)},
- END_CLASS
- return 0;
+ DEFINE_CLASS('&')
+ {'f', 'X',
+ PCL_COMMAND("Macro Control", pcl_macro_control,
+ pca_neg_error|pca_big_error|pca_in_macro)},
+ {'f', 'Y',
+ PCL_COMMAND("Assign Macro ID", pcl_assign_macro_id,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ return 0;
}
static void
pcmacros_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
{ if ( type & (pcl_reset_initial | pcl_reset_printer) )
- { pcs->overlay_enabled = false;
- pcs->macro_level = 0;
- pcs->defining_macro = false;
- pcs->saved = 0;
- pcs->macro_definition = 0;
+ { pcs->overlay_enabled = false;
+ pcs->macro_level = 0;
+ pcs->defining_macro = false;
+ pcs->saved = 0;
+ pcs->macro_definition = 0;
- if ( type & pcl_reset_initial )
- pl_dict_init(&pcs->macros, pcs->memory, NULL);
- else
- { pcl_args_t args;
- arg_set_uint(&args, macro_delete_temporary);
- pcl_macro_control(&args, pcs);
- if ( pcs->alpha_macro_id.id != 0 )
- gs_free_object(pcs->memory,
- pcs->alpha_macro_id.id,
- "pcmacros_do_reset");
- }
- }
+ if ( type & pcl_reset_initial )
+ pl_dict_init(&pcs->macros, pcs->memory, NULL);
+ else
+ { pcl_args_t args;
+ arg_set_uint(&args, macro_delete_temporary);
+ pcl_macro_control(&args, pcs);
+ if ( pcs->alpha_macro_id.id != 0 )
+ gs_free_object(pcs->memory,
+ pcs->alpha_macro_id.id,
+ "pcmacros_do_reset");
+ }
+ }
- if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay | pcl_reset_permanent) )
+ if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay | pcl_reset_permanent) )
{
- pcs->alpha_macro_id.size = 0;
- pcs->macro_id_type = numeric_id;
- id_set_value(pcs->macro_id, 0);
- pcs->alpha_macro_id.id = 0;
+ pcs->alpha_macro_id.size = 0;
+ pcs->macro_id_type = numeric_id;
+ id_set_value(pcs->macro_id, 0);
+ pcs->alpha_macro_id.id = 0;
}
- if ( type & pcl_reset_permanent )
- pl_dict_release(&pcs->macros);
+ if ( type & pcl_reset_permanent )
+ pl_dict_release(&pcs->macros);
}
static int
pcmacros_do_copy(pcl_state_t *psaved, const pcl_state_t *pcs,
pcl_copy_operation_t operation)
{ if ( operation & pcl_copy_after )
- { /* Don't restore the macro dictionary. */
- psaved->macros = pcs->macros;
- }
- return 0;
+ { /* Don't restore the macro dictionary. */
+ psaved->macros = pcs->macros;
+ }
+ return 0;
}
const pcl_init_t pcmacros_init = {
pcmacros_do_registration, pcmacros_do_reset, pcmacros_do_copy
diff --git a/pcl/pcmisc.c b/pcl/pcmisc.c
index bb2b2796b..062c4b9f3 100644
--- a/pcl/pcmisc.c
+++ b/pcl/pcmisc.c
@@ -21,23 +21,23 @@ static int /* ESC & s <bool> C */
pcl_end_of_line_wrap(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint i = uint_arg(pargs);
- if ( i > 1 )
- return e_Range;
- pcs->end_of_line_wrap = i == 0;
- return 0;
+ if ( i > 1 )
+ return e_Range;
+ pcs->end_of_line_wrap = i == 0;
+ return 0;
}
static int /* ESC Y */
pcl_enable_display_functions(pcl_args_t *pargs, pcl_state_t *pcs)
{ pcs->display_functions = true;
- return 0;
+ return 0;
}
/* We export this procedure so we can detect the end of display fns mode. */
int /* ESC Z */
pcl_disable_display_functions(pcl_args_t *pargs, pcl_state_t *pcs)
{ pcs->display_functions = false;
- return 0;
+ return 0;
}
/* Initialization */
@@ -46,21 +46,21 @@ pcmisc_do_registration(
pcl_parser_state_t *pcl_parser_state,
gs_memory_t *mem)
{ /* Register commands */
- DEFINE_CLASS_COMMAND_ARGS('&', 's', 'C', "End of Line Wrap",
- pcl_end_of_line_wrap,
- pca_neg_error|pca_big_error)
- DEFINE_ESCAPE_ARGS('Y', "Enable Display Functions",
- pcl_enable_display_functions, pca_in_macro)
- DEFINE_ESCAPE_ARGS('Z', "Disable Display Functions",
- pcl_disable_display_functions, pca_in_macro)
- return 0;
+ DEFINE_CLASS_COMMAND_ARGS('&', 's', 'C', "End of Line Wrap",
+ pcl_end_of_line_wrap,
+ pca_neg_error|pca_big_error)
+ DEFINE_ESCAPE_ARGS('Y', "Enable Display Functions",
+ pcl_enable_display_functions, pca_in_macro)
+ DEFINE_ESCAPE_ARGS('Z', "Disable Display Functions",
+ pcl_disable_display_functions, pca_in_macro)
+ return 0;
}
static void
pcmisc_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
{ if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay) )
- { pcs->end_of_line_wrap = false;
- pcs->display_functions = false;
- }
+ { pcs->end_of_line_wrap = false;
+ pcs->display_functions = false;
+ }
}
const pcl_init_t pcmisc_init = {
pcmisc_do_registration, pcmisc_do_reset
diff --git a/pcl/pcmtx3.c b/pcl/pcmtx3.c
index e857dab20..064c8308f 100644
--- a/pcl/pcmtx3.c
+++ b/pcl/pcmtx3.c
@@ -19,7 +19,6 @@
#include "pcommand.h"
#include "pcmtx3.h"
-
/*
* Calculate the co-factor for the (i, j) component of a 3 x 3 matrix,
* including the sign. Note that i and j range from 0 to 2.
@@ -67,7 +66,6 @@ make_cofactor_mtx(
}
}
-
/*
* Add and subtract 3 dimensional vectors. These are not currently needed,
* but are included for completeness. No inner-product is provided because
diff --git a/pcl/pcmtx3.h b/pcl/pcmtx3.h
index 264b6148a..350d3b958 100644
--- a/pcl/pcmtx3.h
+++ b/pcl/pcmtx3.h
@@ -23,7 +23,6 @@
#include "gscolor2.h"
#include "gscie.h"
-
/*
* To support device independent color spaces, PCL performs a number of
* calculations with 3 x 3 matrices. The CIE color space code in the graphic
@@ -31,21 +30,21 @@
* unusual and no corresponding utilities are provided. Hence, a separate
* (though logically identical) format is provided here.
*
- * Essentially all of the literature on color spaces deals with column
- * vectors, EXCEPT that specific to PostScript. The latter deals with row
- * vectors to remain consistent with the use of matrices for geometric
+ * Essentially all of the literature on color spaces deals with column
+ * vectors, EXCEPT that specific to PostScript. The latter deals with row
+ * vectors to remain consistent with the use of matrices for geometric
* transformations. The graphics library code, being based on PostScript,
* uses the latter arrangement of components. The CIE code in the library is
* documented for column vectors, but specifies matrices in the less usual
- * column-first order. The current code takes the logically equivalent and
- * no less intuitive approach of using row vectors, and specifying
+ * column-first order. The current code takes the logically equivalent and
+ * no less intuitive approach of using row vectors, and specifying
* matrices in the more normal row-first order.
*
* There is actually some reason for these alternate approaches. The CIE code
* is primarily concerned with transformation of color vectors, and performs
- * relatively few other matrix operations. The current code infrequently
- * transforms color vectors, but does perform other matrix operations.
- * Each code module uses the format that is more intuitive for its more
+ * relatively few other matrix operations. The current code infrequently
+ * transforms color vectors, but does perform other matrix operations.
+ * Each code module uses the format that is more intuitive for its more
* common operation.
*/
typedef union {
diff --git a/pcl/pcommand.c b/pcl/pcommand.c
index afefa698c..892991fa7 100644
--- a/pcl/pcommand.c
+++ b/pcl/pcommand.c
@@ -57,7 +57,6 @@ float_value(
: (float)int_value(pv) );
}
-
/*
* "put" parameters to the device.
*/
diff --git a/pcl/pcommand.h b/pcl/pcommand.h
index fe2d3e7e3..161074747 100644
--- a/pcl/pcommand.h
+++ b/pcl/pcommand.h
@@ -35,7 +35,7 @@ typedef ulong uint32;
typedef enum {
pcv_none = 0,
- /* The following masks merge together: */
+ /* The following masks merge together: */
pcv_int = 1,
pcv_float = 2,
pcv_neg = 4,
@@ -50,9 +50,9 @@ typedef enum {
#define value_is_signed(pv)\
((pv)->type & (pcv_neg | pcv_pos))
typedef struct pcl_value_s {
- pcl_value_type_t type;
- uint i; /* integer part */
- float fraction;
+ pcl_value_type_t type;
+ uint i; /* integer part */
+ float fraction;
} pcl_value_t;
#define value_set_uint(pv, ui)\
((pv)->type = pcv_int, (pv)->i = (ui))
@@ -235,12 +235,12 @@ typedef enum {
} pcl_copy_operation_t;
/* Define the structure for per-module implementation procedures. */
typedef struct pcl_init_s {
- /* Register commands */
+ /* Register commands */
int (*do_registration)(pcl_parser_state_t *pcl_parser_state,
gs_memory_t *mem);
- /* Initialize state at startup, printer reset, and other times. */
+ /* Initialize state at startup, printer reset, and other times. */
void (*do_reset)(pcl_state_t *pcs, pcl_reset_type_t type);
- /* Partially copy the state for macro call, overlay, and exit. */
+ /* Partially copy the state for macro call, overlay, and exit. */
int (*do_copy)(pcl_state_t *psaved, const pcl_state_t *pcs,
pcl_copy_operation_t operation);
} pcl_init_t;
diff --git a/pcl/pcpage.c b/pcl/pcpage.c
index 6339d3efd..1edc69292 100644
--- a/pcl/pcpage.c
+++ b/pcl/pcpage.c
@@ -46,7 +46,6 @@
#define round(x) (((x) < 0.0) ? (ceil ((x) - 0.5)) : (floor ((x) + 0.5)))
-
/* Procedures */
/*
@@ -243,7 +242,6 @@ update_xfm_state(
*/
}
-
/* default margins, relative to the logical page boundaries */
#define DFLT_TOP_MARGIN inch2coord(0.5)
#define DFLT_LEFT_MARGIN inch2coord(0.0)
@@ -366,7 +364,6 @@ new_page_size(
changed_page_size = !(old_page_size[0] == pcs->xfm_state.paper_size->width &&
old_page_size[1] == pcs->xfm_state.paper_size->height);
-
/*
* make sure underlining is disabled (homing the cursor may cause
* an underline to be put out.
@@ -464,8 +461,6 @@ pcl_new_logical_page_for_passthrough(pcl_state_t *pcs, int orient, gs_point *pdi
}
-
-
/* page marking routines */
/* set page marked for path drawing commands. NB doesn't handle 0 width - lenghth */
@@ -607,7 +602,6 @@ pcl_end_page(
return (code < 0 ? code : 1);
}
-
/* Commands */
/*
@@ -851,7 +845,6 @@ clear_horizontal_margins(
return 0;
}
-
/*
* ESC & l <line> E
*
diff --git a/pcl/pcpalet.c b/pcl/pcpalet.c
index 7e84b7ab8..81c1c3e61 100644
--- a/pcl/pcpalet.c
+++ b/pcl/pcpalet.c
@@ -51,8 +51,8 @@ free_palette(
gs_free_object(pmem, pvpalet, cname);
}
-void
-pcl_free_default_objects(
+void
+pcl_free_default_objects(
gs_memory_t * mem,
pcl_state_t * pcs
)
@@ -62,14 +62,14 @@ pcl_free_default_objects(
rc_decrement(pcs->pdflt_cs_indexed, "free_default_palette(pdflt_cs_indexed)");
if (ppalette != 0) {
-
+
rc_decrement(ppalette->pindexed, "free_default_palette cs indexed released");
- if (ppalette->pht)
- rc_decrement(ppalette->pht, "free_default_palette ht released");
- if (ppalette->pcrd)
- rc_decrement(ppalette->pcrd, "free_default_palette pcl_crd_release");
- gs_free_object(mem, ppalette, "free_default_palette ppalette free");
- pcs->pdflt_palette = 0;
+ if (ppalette->pht)
+ rc_decrement(ppalette->pht, "free_default_palette ht released");
+ if (ppalette->pcrd)
+ rc_decrement(ppalette->pcrd, "free_default_palette pcl_crd_release");
+ gs_free_object(mem, ppalette, "free_default_palette ppalette free");
+ pcs->pdflt_palette = 0;
}
rc_decrement(pcs->pdflt_ht, "free_default_palette pdflt_ht release");
rc_decrement(pcs->pdflt_ht, "free_default_palette pdflt_ht release");
@@ -203,7 +203,7 @@ build_default_palette(
code = alloc_palette(pcs, &ppalet, pmem);
if (code == 0)
code = pcl_cs_indexed_build_default_cspace( pcs,
- &(ppalet->pindexed),
+ &(ppalet->pindexed),
pmem
);
if ((code == 0) && (pcs->pcl_default_crd == 0))
@@ -221,7 +221,6 @@ build_default_palette(
} else
pcl_palette_init_from(ppalet, pcs->pdflt_palette);
-
/* NB: definitions do NOT record a referece */
id_set_value(key, pcs->sel_palette_id);
code = pl_dict_put(&pcs->palette_store, id_key(key), 2, ppalet);
@@ -270,7 +269,7 @@ push_pop_palette(
int action = uint_arg(pargs);
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
if (action == 0) {
pstack_entry_t * pentry;
@@ -324,7 +323,7 @@ push_pop_palette(
* Returns 0 on success, < 0 in the event of an error.
*/
-int pcl_palette_CR(
+int pcl_palette_CR(
pcl_state_t * pcs,
floatp wht0,
floatp wht1,
@@ -344,10 +343,9 @@ int pcl_palette_CR(
return pcl_cs_indexed_set_norm_and_Decode( &(pcs->ppalet->pindexed),
wht0, wht1, wht2,
blk0, blk1, blk2
- );
+ );
}
-
/*
* Set the number of entries in a color palette. This is needed only for the
* GL/2 NP command; PCL sets the number of entries in a palette via the
@@ -374,9 +372,9 @@ pcl_palette_NP(
);
/* shrinking a palette may make it gray, growing may make it color */
if (code == 0)
- code = pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- pcl_ht_is_all_gray_palette(pcs));
+ code = pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ pcl_ht_is_all_gray_palette(pcs));
return code;
}
@@ -462,7 +460,7 @@ pcl_palette_set_lookup_tbl(
if ((code == 0) && (pcs->ppalet->pindexed == 0))
code = pcl_cs_indexed_build_default_cspace( pcs,
- &(pcs->ppalet->pindexed),
+ &(pcs->ppalet->pindexed),
pcs->memory
);
if ((code == 0) && (pcs->ppalet->pht == 0))
@@ -506,30 +504,30 @@ pcl_palette_set_color(
indx,
comps
);
-
+
if ( pcs->monochrome_mode == 0 ) {
was_gray = pcs->ppalet->pht->is_gray_render_method;
-
- now_gray = ((pcs->ppalet->pindexed->palette.data[indx*3 + 0] ==
- pcs->ppalet->pindexed->palette.data[indx*3 + 1]) &&
- (pcs->ppalet->pindexed->palette.data[indx*3 + 1] ==
- pcs->ppalet->pindexed->palette.data[indx*3 + 2]) );
-
- if ( !was_gray && now_gray ) {
- /* change one entry from color to gray,
- * check entire palette for grey
- */
- code = pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- pcl_ht_is_all_gray_palette(pcs));
- }
- else if ( was_gray && !now_gray ) {
- /* one color entry in gray palette makes it color
- */
- code = pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- false);
- }
+
+ now_gray = ((pcs->ppalet->pindexed->palette.data[indx*3 + 0] ==
+ pcs->ppalet->pindexed->palette.data[indx*3 + 1]) &&
+ (pcs->ppalet->pindexed->palette.data[indx*3 + 1] ==
+ pcs->ppalet->pindexed->palette.data[indx*3 + 2]) );
+
+ if ( !was_gray && now_gray ) {
+ /* change one entry from color to gray,
+ * check entire palette for grey
+ */
+ code = pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ pcl_ht_is_all_gray_palette(pcs));
+ }
+ else if ( was_gray && !now_gray ) {
+ /* one color entry in gray palette makes it color
+ */
+ code = pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ false);
+ }
}
return code;
}
@@ -557,9 +555,9 @@ pcl_palette_set_default_color(
indx
);
if (code == 0)
- code = pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- pcl_ht_is_all_gray_palette(pcs));
+ code = pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ pcl_ht_is_all_gray_palette(pcs));
return code;
}
@@ -663,22 +661,22 @@ pcl_palette_set_cid(
/* pcl_cspace_bnuild_indexed_cspace will release the old space */
code = pcl_cs_indexed_build_cspace( pcs,
- &(ppalet->pindexed),
+ &(ppalet->pindexed),
pcid,
fixed,
gl2,
pcs->memory
);
if (code == 0) {
- bool is_gray = false;
+ bool is_gray = false;
/* direct raster is always color */
- if ( pcl_cid_get_encoding(pcid) <= 1 ) {
- /* indexed used palette which maybe gray or color */
- is_gray = pcl_ht_is_all_gray_palette(pcs);
+ if ( pcl_cid_get_encoding(pcid) <= 1 ) {
+ /* indexed used palette which maybe gray or color */
+ is_gray = pcl_ht_is_all_gray_palette(pcs);
}
- code = pcl_ht_remap_render_method(pcs,
- &(pcs->ppalet->pht),
- is_gray);
+ code = pcl_ht_remap_render_method(pcs,
+ &(pcs->ppalet->pht),
+ is_gray);
}
/* if a halftone exist, inform it of the update and discard lookup tables */
@@ -741,7 +739,7 @@ pcl_palette_check_complete(
ppalet = pcs->ppalet;
if (ppalet->pindexed == 0)
code = pcl_cs_indexed_build_default_cspace( pcs,
- &(ppalet->pindexed),
+ &(ppalet->pindexed),
pcs->memory
);
if ((code == 0) && (ppalet->pcrd == 0)) {
@@ -753,7 +751,6 @@ pcl_palette_check_complete(
return code;
}
-
/*
* ESC & p # S
*
@@ -770,13 +767,13 @@ set_sel_palette_id(
pcl_id_t key;
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
/* ignore attempts to select non-existent palettes */
id_set_value(key, id);
if ( pl_dict_lookup( &pcs->palette_store,
id_key(key),
- 2,
+ 2,
(void **)&(pcs->ppalet),
false,
NULL
@@ -797,7 +794,7 @@ set_ctrl_palette_id(
)
{
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode)
- return 0;
+ return 0;
pcs->ctrl_palette_id = uint_arg(pargs);
return 0;
@@ -826,7 +823,7 @@ clear_palette_store(
int id = (((int)plkey.data[0]) << 8) + plkey.data[1];
if (id == sel_id) {
- if (pvalue != pcs->pdflt_palette)
+ if (pvalue != pcs->pdflt_palette)
build_default_palette(pcs); /* will redefine sel_id */
} else
pl_dict_undef(&pcs->palette_store, plkey.data, plkey.size);
@@ -847,7 +844,7 @@ palette_control(
uint action = uint_arg(pargs);
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
switch (action) {
@@ -882,7 +879,7 @@ palette_control(
if (code < 0)
return code;
rc_increment(pcs->ppalet);
-
+
}
break;
@@ -907,7 +904,7 @@ set_render_algorithm(
)
{
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
return pcl_palette_set_render_method(pcs, uint_arg(pargs));
}
@@ -948,7 +945,6 @@ pcl_mono_color_mapping_procs(const gx_device * dev)
return &pcl_mono_procs;
}
-
/* set monochrome page device parameter. NB needs testing. We don't
currently have a device that does what we need with
ProcessColorModel. We assume non color devices will simply ignore
@@ -974,15 +970,15 @@ pcl_update_mono(pcl_state_t *pcs)
gx_unset_dev_color(pcs->pgs);
return 0;
}
-
+
/*
* ESC & b # M
*
- * Set monochrome or normal print mode.
- * Note ForceMono=1 is similar to monochrome mode locked on.
+ * Set monochrome or normal print mode.
+ * Note ForceMono=1 is similar to monochrome mode locked on.
*
* The monochrome print mode command is ignored if the page is dirty.
- *
+ *
*/
static int
set_print_mode(
@@ -993,7 +989,7 @@ set_print_mode(
uint mode = uint_arg(pargs);
if ( pcs->personality == pcl5e || pcs->raster_state.graphics_mode )
- return 0;
+ return 0;
if (mode > 1)
return 0;
@@ -1030,7 +1026,7 @@ palette_do_registration(
't', 'J',
PCL_COMMAND( "Render Algorithm",
set_render_algorithm,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
END_CLASS
@@ -1040,28 +1036,28 @@ palette_do_registration(
'b', 'M',
PCL_COMMAND( "Monochrome Printing",
set_print_mode,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
{
'p', 'S',
PCL_COMMAND( "Select Palette",
set_sel_palette_id,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
{
'p', 'I',
PCL_COMMAND( "Palette Control ID",
set_ctrl_palette_id,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
{
'p', 'C',
PCL_COMMAND( "Palette Control",
palette_control,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
END_CLASS
@@ -1081,9 +1077,7 @@ palette_do_reset(
| pcl_reset_cold
| pcl_reset_printer
| pcl_reset_overlay
- | pcl_reset_permanent);
-
-
+ | pcl_reset_permanent);
if ((type & mask) == 0)
return;
@@ -1094,34 +1088,33 @@ palette_do_reset(
pcs->ppalet = 0;
pcs->pfrgrnd = 0;
- /* set up the built-in render methods and dithers matrices */
- pcl_ht_init_render_methods(pcs, pcs->memory);
-
+ /* set up the built-in render methods and dithers matrices */
+ pcl_ht_init_render_methods(pcs, pcs->memory);
} else if ((type & (pcl_reset_cold | pcl_reset_printer | pcl_reset_permanent)) != 0) {
- pcs->monochrome_mode = 0;
+ pcs->monochrome_mode = 0;
pcl_update_mono(pcs);
/* clear the palette stack and store */
clear_palette_stack(pcs, pcs->memory);
- clear_palette_store(pcs);
+ clear_palette_store(pcs);
}
if ( type & pcl_reset_permanent ) {
- pl_dict_release(&pcs->palette_store);
- if (pcs->ppalet != pcs->pdflt_palette) {
- /* stefan foo: free or decrement reference counts? */
- gs_free_object(pcs->memory, pcs->ppalet->pindexed, "palette cs indexed released permanent reset");
- gs_free_object(pcs->memory, pcs->ppalet->pht, "palette ht released permanent reset");
- gs_free_object(pcs->memory, pcs->ppalet->pcrd, "palette ht released permanent reset");
- gs_free_object(pcs->memory, pcs->ppalet, "palette released permanent reset");
- }
+ pl_dict_release(&pcs->palette_store);
+ if (pcs->ppalet != pcs->pdflt_palette) {
+ /* stefan foo: free or decrement reference counts? */
+ gs_free_object(pcs->memory, pcs->ppalet->pindexed, "palette cs indexed released permanent reset");
+ gs_free_object(pcs->memory, pcs->ppalet->pht, "palette ht released permanent reset");
+ gs_free_object(pcs->memory, pcs->ppalet->pcrd, "palette ht released permanent reset");
+ gs_free_object(pcs->memory, pcs->ppalet, "palette released permanent reset");
+ }
}
/* select and control palette ID's must be set back to 0 */
pcs->sel_palette_id = 0;
pcs->ctrl_palette_id = 0;
if ( !(type & pcl_reset_permanent) ) {
- (void)build_default_palette(pcs);
- (void)pcl_frgrnd_set_default_foreground(pcs);
+ (void)build_default_palette(pcs);
+ (void)pcl_frgrnd_set_default_foreground(pcs);
}
}
@@ -1157,9 +1150,9 @@ palette_do_copy(
if ((operation & (pcl_copy_before_call | pcl_copy_before_overlay)) != 0)
pcl_palette_init_from(psaved->ppalet, pcs->ppalet);
else if ((operation & pcl_copy_after) != 0) {
- pcl_id_t key;
- /* fix the compiler warning resulting from overuse of const */
- pcl_state_t *pcs2 = (pcl_state_t *)pcs;
+ pcl_id_t key;
+ /* fix the compiler warning resulting from overuse of const */
+ pcl_state_t *pcs2 = (pcl_state_t *)pcs;
id_set_value(key, psaved->sel_palette_id);
pl_dict_put(&pcs2->palette_store, id_key(key), 2, psaved->ppalet);
psaved->palette_stack = pcs2->palette_stack;
diff --git a/pcl/pcpalet.h b/pcl/pcpalet.h
index 4df5b4924..62ff13656 100644
--- a/pcl/pcpalet.h
+++ b/pcl/pcpalet.h
@@ -75,7 +75,6 @@ typedef struct pcl_palette_s pcl_palette_t;
pht \
)
-
/*
* The usual init, copy,and release macros.
*/
@@ -97,7 +96,6 @@ typedef struct pcl_palette_s pcl_palette_t;
#define pcl_palette_release(pbase) \
rc_decrement(pbase, "pcl_frgrnd_release")
-
/*
* Get the color space type for the base color space of a palette.
*/
@@ -293,7 +291,6 @@ int pcl_palette_set_view_illuminant(
*/
int pcl_palette_check_complete(pcl_state_t * pcs);
-
#define private_st_pstack_entry_t() \
gs_private_st_ptrs1( st_pstack_entry_t, \
pstack_entry_t, \
@@ -309,11 +306,9 @@ int pcl_palette_check_complete(pcl_state_t * pcs);
extern const pcl_init_t pcl_palette_init;
extern const pcl_init_t pcl_color_init;
-
-/* free default objects (pcs->pdfl_*)
+/* free default objects (pcs->pdfl_*)
* called at end of process.
*/
void pcl_free_default_objects(gs_memory_t *mem, pcl_state_t *pcs);
-
-#endif /* pcpalet_INCLUDED */
+#endif /* pcpalet_INCLUDED */
diff --git a/pcl/pcparse.c b/pcl/pcparse.c
index ab4a896ae..e3db977ee 100644
--- a/pcl/pcparse.c
+++ b/pcl/pcparse.c
@@ -32,56 +32,56 @@
/* Register a command. Return true if this is a redefinition. */
static bool
-pcl_register_command(byte *pindex, const pcl_command_definition_t *pcmd,
- pcl_parser_state_t *pcl_parser_state)
+pcl_register_command(byte *pindex, const pcl_command_definition_t *pcmd,
+ pcl_parser_state_t *pcl_parser_state)
{ int index = pcl_parser_state->definitions->pcl_command_next_index;
- byte prev = *pindex;
+ byte prev = *pindex;
- if ( prev != 0 && prev <= index && pcl_parser_state->definitions->pcl_command_list[prev] == pcmd )
- index = prev;
- else if ( index != 0 && pcl_parser_state->definitions->pcl_command_list[index] == pcmd )
- ;
- else
+ if ( prev != 0 && prev <= index && pcl_parser_state->definitions->pcl_command_list[prev] == pcmd )
+ index = prev;
+ else if ( index != 0 && pcl_parser_state->definitions->pcl_command_list[index] == pcmd )
+ ;
+ else
pcl_parser_state->definitions->pcl_command_list[pcl_parser_state->definitions->pcl_command_next_index = ++index] = (pcl_command_definition_t *)pcmd;
- *pindex = index;
- return (prev != 0 && prev != index);
+ *pindex = index;
+ return (prev != 0 && prev != index);
}
/* Define a command or list of commands. */
void
pcl_define_control_command(int/*char*/ chr, const pcl_command_definition_t *pcmd,
- pcl_parser_state_t *pcl_parser_state)
+ pcl_parser_state_t *pcl_parser_state)
{
#ifdef DEBUG
- if ( chr < 0 || chr >= countof(pcl_parser_state->definitions->pcl_control_command_indices) )
- if_debug1('I', "Invalid control character %d\n", chr);
- else if (
+ if ( chr < 0 || chr >= countof(pcl_parser_state->definitions->pcl_control_command_indices) )
+ if_debug1('I', "Invalid control character %d\n", chr);
+ else if (
#endif
- pcl_register_command(&pcl_parser_state->definitions->pcl_control_command_indices[chr], pcmd, pcl_parser_state)
+ pcl_register_command(&pcl_parser_state->definitions->pcl_control_command_indices[chr], pcmd, pcl_parser_state)
#ifdef DEBUG
- )
- if_debug1('I', "Redefining control character %d\n", chr);
+ )
+ if_debug1('I', "Redefining control character %d\n", chr);
#endif
- ;
+ ;
}
void
pcl_define_escape_command(int/*char*/ chr,
- const pcl_command_definition_t *pcmd,
- pcl_parser_state_t *pcl_parser_state)
+ const pcl_command_definition_t *pcmd,
+ pcl_parser_state_t *pcl_parser_state)
{
#ifdef DEBUG
if ( chr < min_escape_2char || chr > max_escape_2char )
- if_debug1('I', "Invalid escape character %c\n", chr);
+ if_debug1('I', "Invalid escape character %c\n", chr);
else if (
#endif
- pcl_register_command(&pcl_parser_state->definitions->pcl_escape_command_indices
- [chr - min_escape_2char], pcmd,
- pcl_parser_state)
+ pcl_register_command(&pcl_parser_state->definitions->pcl_escape_command_indices
+ [chr - min_escape_2char], pcmd,
+ pcl_parser_state)
#ifdef DEBUG
- )
- if_debug1('I', "Redefining ESC %c\n", chr)
+ )
+ if_debug1('I', "Redefining ESC %c\n", chr)
#endif
- ;
+ ;
}
/*
@@ -93,40 +93,40 @@ static const byte pcl_escape_class_indices[max_escape_class - min_escape_class +
void
pcl_define_class_command(int/*char*/ class, int/*char*/ group,
- int/*char*/ command,
- const pcl_command_definition_t *pcmd,
- pcl_parser_state_t *pcl_parser_state)
+ int/*char*/ command,
+ const pcl_command_definition_t *pcmd,
+ pcl_parser_state_t *pcl_parser_state)
{
#ifdef DEBUG
- if ( class < min_escape_class || class > max_escape_class ||
- pcl_escape_class_indices[class - min_escape_class] == 0 ||
- (group != 0 && (group < min_escape_group || group > max_escape_group)) ||
- command < min_escape_command || command > max_escape_command
- )
- if_debug3('I', "Invalid command %c %c %c\n", class, group, command);
- else if (
+ if ( class < min_escape_class || class > max_escape_class ||
+ pcl_escape_class_indices[class - min_escape_class] == 0 ||
+ (group != 0 && (group < min_escape_group || group > max_escape_group)) ||
+ command < min_escape_command || command > max_escape_command
+ )
+ if_debug3('I', "Invalid command %c %c %c\n", class, group, command);
+ else if (
#endif
- pcl_register_command(&pcl_parser_state->definitions->pcl_grouped_command_indices
- [pcl_escape_class_indices[class - min_escape_class] - 1]
- [group == 0 ? 0 : group - min_escape_group + 1]
- [command - min_escape_command], pcmd,
- pcl_parser_state)
+ pcl_register_command(&pcl_parser_state->definitions->pcl_grouped_command_indices
+ [pcl_escape_class_indices[class - min_escape_class] - 1]
+ [group == 0 ? 0 : group - min_escape_group + 1]
+ [command - min_escape_command], pcmd,
+ pcl_parser_state)
#ifdef DEBUG
- )
- if_debug3('I', "Redefining ESC %c %c %c\n", class,
- (group == 0 ? ' ' : group), command)
+ )
+ if_debug3('I', "Redefining ESC %c %c %c\n", class,
+ (group == 0 ? ' ' : group), command)
#endif
- ;
+ ;
}
void
pcl_define_class_commands(int/*char*/ class,
- const pcl_grouped_command_definition_t *pgroup,
- pcl_parser_state_t *pcl_parser_state)
+ const pcl_grouped_command_definition_t *pgroup,
+ pcl_parser_state_t *pcl_parser_state)
{ const pcl_grouped_command_definition_t *pgc = pgroup;
- for ( ; pgc->command != 0; ++pgc )
- pcl_define_class_command(class, pgc->group, pgc->command,
- &pgc->defn, pcl_parser_state);
+ for ( ; pgc->command != 0; ++pgc )
+ pcl_define_class_command(class, pgc->group, pgc->command,
+ &pgc->defn, pcl_parser_state);
}
/*
@@ -137,37 +137,37 @@ pcl_define_class_commands(int/*char*/ class,
* The caller is responsible for providing valid arguments.
*/
static const pcl_command_definition_t *
-pcl_get_command_definition(pcl_parser_state_t *pcl_parser_state,
- int/*char*/ class,
- int/*char*/ group,
+pcl_get_command_definition(pcl_parser_state_t *pcl_parser_state,
+ int/*char*/ class,
+ int/*char*/ group,
int/*char*/ command)
{ const pcl_command_definition_t *cdefn = 0;
- if ( class == 0 )
- {if ( command >= min_escape_2char && command <= max_escape_2char )
- cdefn = pcl_parser_state->definitions->pcl_command_list
- [pcl_parser_state->definitions->pcl_escape_command_indices[command - min_escape_2char]];
- }
- else
- { int class_index = pcl_escape_class_indices[class - min_escape_class];
- if ( class_index )
- cdefn = pcl_parser_state->definitions->pcl_command_list
- [pcl_parser_state->definitions->pcl_grouped_command_indices[class_index - 1]
- [group ? group - min_escape_group + 1 : 0]
- [command - min_escape_command]
- ];
- }
+ if ( class == 0 )
+ {if ( command >= min_escape_2char && command <= max_escape_2char )
+ cdefn = pcl_parser_state->definitions->pcl_command_list
+ [pcl_parser_state->definitions->pcl_escape_command_indices[command - min_escape_2char]];
+ }
+ else
+ { int class_index = pcl_escape_class_indices[class - min_escape_class];
+ if ( class_index )
+ cdefn = pcl_parser_state->definitions->pcl_command_list
+ [pcl_parser_state->definitions->pcl_grouped_command_indices[class_index - 1]
+ [group ? group - min_escape_group + 1 : 0]
+ [command - min_escape_command]
+ ];
+ }
#ifdef DEBUG
- if ( cdefn == 0 )
- { if ( class == 0 )
- if_debug1('I', "ESC %c undefined\n", command);
- else if ( group == 0 )
- if_debug2('I', "ESC %c %c undefined\n", class, command);
- else
- if_debug3('I', "ESC %c %c %c undefined\n", class, group, command);
- }
+ if ( cdefn == 0 )
+ { if ( class == 0 )
+ if_debug1('I', "ESC %c undefined\n", command);
+ else if ( group == 0 )
+ if_debug2('I', "ESC %c %c undefined\n", class, command);
+ else
+ if_debug3('I', "ESC %c %c %c undefined\n", class, group, command);
+ }
#endif
- return cdefn;
+ return cdefn;
}
/* ---------------- Parsing ---------------- */
@@ -184,61 +184,61 @@ static int
pcl_adjust_arg(pcl_args_t *pargs, const pcl_command_definition_t *pdefn)
{ uint acts = pdefn->actions;
- if ( value_is_neg(&pargs->value) )
- { switch ( acts & pca_neg_action )
- {
- case pca_neg_clamp:
- arg_set_uint(pargs, 0); break;
- case pca_neg_error:
- return e_Range;
- case pca_neg_ignore:
- return 1;
- default: /* case pca_neg_ok */
- ;
- }
- }
- else if ( pargs->value.i > 32767 ) /* overflowed int range */
- switch ( acts & pca_big_action )
- {
- case pca_big_clamp:
- arg_set_uint(pargs, 32767); break;
- case pca_big_error:
- return e_Range;
- case pca_big_ignore:
- return 1;
- default: /* case pca_big_ok */
- ;
- }
- return 0;
+ if ( value_is_neg(&pargs->value) )
+ { switch ( acts & pca_neg_action )
+ {
+ case pca_neg_clamp:
+ arg_set_uint(pargs, 0); break;
+ case pca_neg_error:
+ return e_Range;
+ case pca_neg_ignore:
+ return 1;
+ default: /* case pca_neg_ok */
+ ;
+ }
+ }
+ else if ( pargs->value.i > 32767 ) /* overflowed int range */
+ switch ( acts & pca_big_action )
+ {
+ case pca_big_clamp:
+ arg_set_uint(pargs, 32767); break;
+ case pca_big_error:
+ return e_Range;
+ case pca_big_ignore:
+ return 1;
+ default: /* case pca_big_ok */
+ ;
+ }
+ return 0;
}
/* Append some just-scanned input data to the macro being defined. */
static int
append_macro(const byte *from, const byte *to, pcl_state_t *pcs)
{ uint count = to - from;
- uint size = gs_object_size(pcs->memory, pcs->macro_definition);
- byte *new_defn =
- gs_resize_object(pcs->memory, pcs->macro_definition, size + count,
- "append_macro");
+ uint size = gs_object_size(pcs->memory, pcs->macro_definition);
+ byte *new_defn =
+ gs_resize_object(pcs->memory, pcs->macro_definition, size + count,
+ "append_macro");
- if ( new_defn == 0 )
- return_error(e_Memory);
- memcpy(new_defn + size, from + 1, count);
- pcs->macro_definition = new_defn;
- return 0;
+ if ( new_defn == 0 )
+ return_error(e_Memory);
+ memcpy(new_defn + size, from + 1, count);
+ pcs->macro_definition = new_defn;
+ return 0;
}
/* Process a buffer of PCL commands. */
int
pcl_process(pcl_parser_state_t *pst, pcl_state_t *pcs, stream_cursor_read *pr)
{ const byte *p = pr->ptr;
- const byte *rlimit = pr->limit;
- int code = 0;
- int bytelen = 0;
- bool in_macro = pcs->defining_macro;
- /* Record how much of the input we've copied into a macro */
- /* in the process of being defined. */
- const byte *macro_p = p;
+ const byte *rlimit = pr->limit;
+ int code = 0;
+ int bytelen = 0;
+ bool in_macro = pcs->defining_macro;
+ /* Record how much of the input we've copied into a macro */
+ /* in the process of being defined. */
+ const byte *macro_p = p;
/* Reset the parameter scanner */
#define avalue pst->args.value
@@ -251,373 +251,373 @@ pcl_process(pcl_parser_state_t *pst, pcl_state_t *pcs, stream_cursor_read *pr)
# define do_display_functions() (!in_macro)
#endif
- while ( p < rlimit )
- { byte chr;
- const pcl_command_definition_t *cdefn = NULL;
+ while ( p < rlimit )
+ { byte chr;
+ const pcl_command_definition_t *cdefn = NULL;
- switch ( pst->scan_type )
- {
- case scanning_data:
- { /* Accumulate command data in a buffer. */
- uint count = uint_arg(&pst->args);
- uint pos = pst->data_pos;
+ switch ( pst->scan_type )
+ {
+ case scanning_data:
+ { /* Accumulate command data in a buffer. */
+ uint count = uint_arg(&pst->args);
+ uint pos = pst->data_pos;
- if ( pos < count )
- { uint avail = rlimit - p;
- uint copy = min(count - pos, avail);
+ if ( pos < count )
+ { uint avail = rlimit - p;
+ uint copy = min(count - pos, avail);
- memcpy(pst->args.data + pos, p + 1, copy);
- pst->data_pos += copy;
- p += copy;
- continue;
- }
- /* Invoke the command. */
- cdefn = pcl_get_command_definition(pst,
- pst->param_class,
- pst->param_group,
- pst->args.command);
- pst->scan_type = scanning_none;
- break;
- }
- case scanning_display:
- { /* Display, don't execute, all characters. */
- chr = *++p;
- if ( chr == ESC )
- { int index;
- if ( p >= rlimit )
- goto x;
- if ( p[1] >= min_escape_2char && p[1] <= max_escape_2char &&
- (index = pst->definitions->pcl_escape_command_indices[p[1] - min_escape_2char]) != 0 &&
- pst->definitions->pcl_command_list[index]->proc ==
- pcl_disable_display_functions
- )
- { if ( do_display_functions() )
- { pst->args.command = chr;
- code = pcl_plain_char(&pst->args, pcs);
- if ( code < 0 )
- goto x;
- }
- pst->args.command = chr = *++p;
- pcl_disable_display_functions(&pst->args, pcs);
- pst->scan_type = scanning_none;
- }
- }
- if ( do_display_functions() )
- { if ( chr == CR )
- { pcl_do_CR(pcs);
- code = pcl_do_LF(pcs);
- }
- else
- { pst->args.command = chr;
- code = pcl_plain_char(&pst->args, pcs);
- }
- if ( code < 0 )
- goto x;
- }
- continue;
- }
- case scanning_parameter:
- for ( ; ; )
- { if ( p >= rlimit )
- goto x;
- chr = *++p;
- /*
- * The parser for numbers is very lenient, and accepts
- * many strings that aren't valid numbers. If this
- * ever becomes a problem, we can tighten it up....
- */
- if ( chr >= '0' && chr <= '9' )
- { chr -= '0';
- if ( value_is_float(&avalue) )
- avalue.fraction += (chr / (pst->scale *= 10));
- else
- avalue.type |= pcv_int,
- avalue.i = avalue.i * 10 + chr;
- }
- else if ( chr == '-' )
- avalue.type |= pcv_neg;
- else if ( chr == '+' )
- avalue.type |= pcv_pos;
- else if ( chr == '.' )
- avalue.type |= pcv_float,
- avalue.fraction = 0,
- pst->scale = 1.0;
- else if ( chr >= ' ' && chr <= '?' )
- { /* Ignore garbage nearby in the code space. */
- continue;
- }
- else
- break;
- }
+ memcpy(pst->args.data + pos, p + 1, copy);
+ pst->data_pos += copy;
+ p += copy;
+ continue;
+ }
+ /* Invoke the command. */
+ cdefn = pcl_get_command_definition(pst,
+ pst->param_class,
+ pst->param_group,
+ pst->args.command);
+ pst->scan_type = scanning_none;
+ break;
+ }
+ case scanning_display:
+ { /* Display, don't execute, all characters. */
+ chr = *++p;
+ if ( chr == ESC )
+ { int index;
+ if ( p >= rlimit )
+ goto x;
+ if ( p[1] >= min_escape_2char && p[1] <= max_escape_2char &&
+ (index = pst->definitions->pcl_escape_command_indices[p[1] - min_escape_2char]) != 0 &&
+ pst->definitions->pcl_command_list[index]->proc ==
+ pcl_disable_display_functions
+ )
+ { if ( do_display_functions() )
+ { pst->args.command = chr;
+ code = pcl_plain_char(&pst->args, pcs);
+ if ( code < 0 )
+ goto x;
+ }
+ pst->args.command = chr = *++p;
+ pcl_disable_display_functions(&pst->args, pcs);
+ pst->scan_type = scanning_none;
+ }
+ }
+ if ( do_display_functions() )
+ { if ( chr == CR )
+ { pcl_do_CR(pcs);
+ code = pcl_do_LF(pcs);
+ }
+ else
+ { pst->args.command = chr;
+ code = pcl_plain_char(&pst->args, pcs);
+ }
+ if ( code < 0 )
+ goto x;
+ }
+ continue;
+ }
+ case scanning_parameter:
+ for ( ; ; )
+ { if ( p >= rlimit )
+ goto x;
+ chr = *++p;
+ /*
+ * The parser for numbers is very lenient, and accepts
+ * many strings that aren't valid numbers. If this
+ * ever becomes a problem, we can tighten it up....
+ */
+ if ( chr >= '0' && chr <= '9' )
+ { chr -= '0';
+ if ( value_is_float(&avalue) )
+ avalue.fraction += (chr / (pst->scale *= 10));
+ else
+ avalue.type |= pcv_int,
+ avalue.i = avalue.i * 10 + chr;
+ }
+ else if ( chr == '-' )
+ avalue.type |= pcv_neg;
+ else if ( chr == '+' )
+ avalue.type |= pcv_pos;
+ else if ( chr == '.' )
+ avalue.type |= pcv_float,
+ avalue.fraction = 0,
+ pst->scale = 1.0;
+ else if ( chr >= ' ' && chr <= '?' )
+ { /* Ignore garbage nearby in the code space. */
+ continue;
+ }
+ else
+ break;
+ }
#ifdef DEBUG
- if ( gs_debug_c('i') )
- { dprintf2("(ESC %c %c)",
- pst->param_class, pst->param_group);
- if ( value_is_present(&avalue) )
- { dputc(' ');
- if ( value_is_signed(&avalue) )
- dputc((value_is_neg(&avalue) ? '-' : '+'));
- if ( value_is_float(&avalue) )
- dprintf1("%g", avalue.i + avalue.fraction);
- else
- dprintf1("%u", avalue.i);
- }
- dprintf1(" %c\n", chr);
- }
+ if ( gs_debug_c('i') )
+ { dprintf2("(ESC %c %c)",
+ pst->param_class, pst->param_group);
+ if ( value_is_present(&avalue) )
+ { dputc(' ');
+ if ( value_is_signed(&avalue) )
+ dputc((value_is_neg(&avalue) ? '-' : '+'));
+ if ( value_is_float(&avalue) )
+ dprintf1("%g", avalue.i + avalue.fraction);
+ else
+ dprintf1("%u", avalue.i);
+ }
+ dprintf1(" %c\n", chr);
+ }
#endif
- if ( chr >= min_escape_command + 32 &&
- chr <= max_escape_command + 32
- )
- chr -= 32;
- else if ( chr >= min_escape_command &&
- chr <= max_escape_command
- )
- pst->scan_type = scanning_none;
- else
- { pst->scan_type = scanning_none;
- /* Rescan the out-of-place character. */
- --p;
- continue;
- }
- /* Dispatch on param_class, param_group, and chr. */
- cdefn = pcl_get_command_definition(pst,
- pst->param_class,
- pst->param_group,
- chr);
- if ( cdefn )
- { if_debug1('i', " [%s]\n", cdefn->cname);
- code = pcl_adjust_arg(&pst->args, cdefn);
- if ( code < 0 )
- goto x;
- if ( cdefn->actions & pca_byte_data ) {
- uint count = uint_arg(&pst->args);
- if ( (count > 0 ) && (rlimit - p <= count) ) {
- pst->args.data =
- gs_alloc_bytes(pcs->memory, count,
- "command data");
- if ( pst->args.data == 0 )
- { --p;
- code = gs_note_error(e_Memory);
- goto x;
- }
- pst->args.data_on_heap = true;
- pst->args.command = chr;
- pst->data_pos = 0;
- pst->scan_type = scanning_data;
- continue;
- }
- pst->args.data = (byte *)(p + 1);
- pst->args.data_on_heap = false;
- p += count;
- }
- break;
- }
- param_init();
- continue;
- case scanning_none:
- if ( pcs->parse_other )
- { /*
- * Hand off the data stream
- * to another parser (HP-GL/2).
- */
- pr->ptr = p;
- code = (*pcs->parse_other)
- (pcs->parse_data, pcs, pr);
- p = pr->ptr;
- if ( code < 0 || (code == 0 && pcs->parse_other) )
- goto x;
- }
- chr = *++p;
- /* check for multi-byte scanning */
- bytelen = pcl_char_bytelen( chr, pcs->text_parsing_method );
- if ( bytelen == 0 ) {
- bytelen = 1; /* invalid utf-8 leading char */
- }
- if ( bytelen > 1 ) {
- /* check if we need more data */
- if ( (p + bytelen - 1) > rlimit ) {
- --p;
- goto x;
- }
- if_debug2('i', "%x%x\n", p[0], p[1]);
- code = pcl_text(p, bytelen, pcs, false);
- if ( code < 0 ) goto x;
- /* now pass over the remaining bytes */
- p += (bytelen - 1);
- cdefn = NULL;
- } else if ( chr != ESC )
- { if_debug1('i',
- (chr == '\\' ? "\\%c\n" :
- chr >= 33 && chr <= 126 ?
- "%c\n" : "\\%03o\n"),
- chr);
- cdefn = pst->definitions->pcl_command_list
- [chr < 33 ?
- pst->definitions->pcl_control_command_indices[chr] :
- pst->definitions->pcl_control_command_indices[1]];
- if ( (cdefn == 0 ||
- cdefn->proc == pcl_plain_char) &&
- !in_macro &&
- !pcs->parse_other &&
- !pcs->raster_state.graphics_mode
- )
- { /*
- * Look ahead for a run of plain text.
- * We can be very conservative about this,
- * because this is only a performance
- * enhancement.
- */
- const byte *str = p;
- while ( p < rlimit && p[1] >= 32 &&
- p[1] <= 127
- )
- { if_debug1('i', "%c", p[1]);
- ++p;
- }
+ if ( chr >= min_escape_command + 32 &&
+ chr <= max_escape_command + 32
+ )
+ chr -= 32;
+ else if ( chr >= min_escape_command &&
+ chr <= max_escape_command
+ )
+ pst->scan_type = scanning_none;
+ else
+ { pst->scan_type = scanning_none;
+ /* Rescan the out-of-place character. */
+ --p;
+ continue;
+ }
+ /* Dispatch on param_class, param_group, and chr. */
+ cdefn = pcl_get_command_definition(pst,
+ pst->param_class,
+ pst->param_group,
+ chr);
+ if ( cdefn )
+ { if_debug1('i', " [%s]\n", cdefn->cname);
+ code = pcl_adjust_arg(&pst->args, cdefn);
+ if ( code < 0 )
+ goto x;
+ if ( cdefn->actions & pca_byte_data ) {
+ uint count = uint_arg(&pst->args);
+ if ( (count > 0 ) && (rlimit - p <= count) ) {
+ pst->args.data =
+ gs_alloc_bytes(pcs->memory, count,
+ "command data");
+ if ( pst->args.data == 0 )
+ { --p;
+ code = gs_note_error(e_Memory);
+ goto x;
+ }
+ pst->args.data_on_heap = true;
+ pst->args.command = chr;
+ pst->data_pos = 0;
+ pst->scan_type = scanning_data;
+ continue;
+ }
+ pst->args.data = (byte *)(p + 1);
+ pst->args.data_on_heap = false;
+ p += count;
+ }
+ break;
+ }
+ param_init();
+ continue;
+ case scanning_none:
+ if ( pcs->parse_other )
+ { /*
+ * Hand off the data stream
+ * to another parser (HP-GL/2).
+ */
+ pr->ptr = p;
+ code = (*pcs->parse_other)
+ (pcs->parse_data, pcs, pr);
+ p = pr->ptr;
+ if ( code < 0 || (code == 0 && pcs->parse_other) )
+ goto x;
+ }
+ chr = *++p;
+ /* check for multi-byte scanning */
+ bytelen = pcl_char_bytelen( chr, pcs->text_parsing_method );
+ if ( bytelen == 0 ) {
+ bytelen = 1; /* invalid utf-8 leading char */
+ }
+ if ( bytelen > 1 ) {
+ /* check if we need more data */
+ if ( (p + bytelen - 1) > rlimit ) {
+ --p;
+ goto x;
+ }
+ if_debug2('i', "%x%x\n", p[0], p[1]);
+ code = pcl_text(p, bytelen, pcs, false);
+ if ( code < 0 ) goto x;
+ /* now pass over the remaining bytes */
+ p += (bytelen - 1);
+ cdefn = NULL;
+ } else if ( chr != ESC )
+ { if_debug1('i',
+ (chr == '\\' ? "\\%c\n" :
+ chr >= 33 && chr <= 126 ?
+ "%c\n" : "\\%03o\n"),
+ chr);
+ cdefn = pst->definitions->pcl_command_list
+ [chr < 33 ?
+ pst->definitions->pcl_control_command_indices[chr] :
+ pst->definitions->pcl_control_command_indices[1]];
+ if ( (cdefn == 0 ||
+ cdefn->proc == pcl_plain_char) &&
+ !in_macro &&
+ !pcs->parse_other &&
+ !pcs->raster_state.graphics_mode
+ )
+ { /*
+ * Look ahead for a run of plain text.
+ * We can be very conservative about this,
+ * because this is only a performance
+ * enhancement.
+ */
+ const byte *str = p;
+ while ( p < rlimit && p[1] >= 32 &&
+ p[1] <= 127
+ )
+ { if_debug1('i', "%c", p[1]);
+ ++p;
+ }
- if_debug0('i', "\n");
- code = pcl_text(str, (uint)(p + 1 - str),
- pcs, false);
- if ( code < 0 )
- goto x;
- cdefn = NULL;
- }
- }
- else
- { if ( p >= rlimit ) { --p; goto x; }
- chr = *++p;
- if ( chr < min_escape_class ||
- chr > max_escape_class
- )
- { if_debug1('i',
- (chr >= 33 && chr <= 126 ?
- "ESC %c\n" :
- "ESC \\%03o\n"),
- chr);
- cdefn =
- pcl_get_command_definition(pst, 0, 0, chr);
- if ( !cdefn )
- {
+ if_debug0('i', "\n");
+ code = pcl_text(str, (uint)(p + 1 - str),
+ pcs, false);
+ if ( code < 0 )
+ goto x;
+ cdefn = NULL;
+ }
+ }
+ else
+ { if ( p >= rlimit ) { --p; goto x; }
+ chr = *++p;
+ if ( chr < min_escape_class ||
+ chr > max_escape_class
+ )
+ { if_debug1('i',
+ (chr >= 33 && chr <= 126 ?
+ "ESC %c\n" :
+ "ESC \\%03o\n"),
+ chr);
+ cdefn =
+ pcl_get_command_definition(pst, 0, 0, chr);
+ if ( !cdefn )
+ {
/* Skip the ESC, back up
to the char following the
ESC. */
--p;
- continue;
- }
- if_debug1('i', " [%s]\n",
- cdefn->cname);
- }
- else
- { if ( p >= rlimit ) { p -= 2; goto x; }
- pst->param_class = chr;
- chr = *++p;
- if ( chr < min_escape_group ||
- chr > max_escape_group
- )
- { /* Class but no group */
- --p;
- chr = 0;
- }
- pst->param_group = chr;
- if_debug2('i', "ESC %c %c\n",
- pst->param_class, chr);
- pst->scan_type = scanning_parameter;
- param_init();
- continue;
- }
- }
- break;
- }
- if ( cdefn == NULL )
- { param_init();
- continue;
- }
- if ( !in_macro || (cdefn->actions & pca_in_macro) )
- { /* This might be the end-of-macro command. */
- /* Make sure all the data through this point */
- /* has been captured in the macro definition. */
- if ( in_macro )
- { code = append_macro(macro_p, p, pcs);
- macro_p = p;
- if ( code < 0 )
- goto x;
- }
- pst->args.command = chr;
- if ( !pcs->raster_state.graphics_mode ||
- (cdefn->actions & pca_raster_graphics) ||
- (code = pcl_end_graphics_mode(pcs)) >= 0
- ) {
- if ( (pcs->personality != rtl) ||
- ((pcs->personality == rtl) && (cdefn->actions & pca_in_rtl)) )
- code = (*cdefn->proc)(&pst->args, pcs);
- }
- /*
- * If we allocated a buffer for command data,
- * and the command didn't take possession of it,
- * free it now. */
- if ( pst->args.data_on_heap && pst->args.data )
- { gs_free_object(pcs->memory, pst->args.data,
- "command data");
- pst->args.data = 0;
- }
- if ( code == e_Unimplemented )
- {
+ continue;
+ }
+ if_debug1('i', " [%s]\n",
+ cdefn->cname);
+ }
+ else
+ { if ( p >= rlimit ) { p -= 2; goto x; }
+ pst->param_class = chr;
+ chr = *++p;
+ if ( chr < min_escape_group ||
+ chr > max_escape_group
+ )
+ { /* Class but no group */
+ --p;
+ chr = 0;
+ }
+ pst->param_group = chr;
+ if_debug2('i', "ESC %c %c\n",
+ pst->param_class, chr);
+ pst->scan_type = scanning_parameter;
+ param_init();
+ continue;
+ }
+ }
+ break;
+ }
+ if ( cdefn == NULL )
+ { param_init();
+ continue;
+ }
+ if ( !in_macro || (cdefn->actions & pca_in_macro) )
+ { /* This might be the end-of-macro command. */
+ /* Make sure all the data through this point */
+ /* has been captured in the macro definition. */
+ if ( in_macro )
+ { code = append_macro(macro_p, p, pcs);
+ macro_p = p;
+ if ( code < 0 )
+ goto x;
+ }
+ pst->args.command = chr;
+ if ( !pcs->raster_state.graphics_mode ||
+ (cdefn->actions & pca_raster_graphics) ||
+ (code = pcl_end_graphics_mode(pcs)) >= 0
+ ) {
+ if ( (pcs->personality != rtl) ||
+ ((pcs->personality == rtl) && (cdefn->actions & pca_in_rtl)) )
+ code = (*cdefn->proc)(&pst->args, pcs);
+ }
+ /*
+ * If we allocated a buffer for command data,
+ * and the command didn't take possession of it,
+ * free it now. */
+ if ( pst->args.data_on_heap && pst->args.data )
+ { gs_free_object(pcs->memory, pst->args.data,
+ "command data");
+ pst->args.data = 0;
+ }
+ if ( code == e_Unimplemented )
+ {
#if e_Unimplemented != 0
- if_debug0('i', "Unimplemented\n");
+ if_debug0('i', "Unimplemented\n");
#endif
- }
- else if ( code < 0 )
- break;
- if ( pcs->display_functions )
- { /* This calls for a special parsing state. */
- pst->scan_type = scanning_display;
- }
- if ( pcs->defining_macro && !in_macro )
- { /* We just started a macro definition. */
- if (pst->scan_type != scanning_none)
- { /* combinded command started macro */
- /* start definition of macro with esc& preloaded */
- static const byte macro_prefix[3] = " \033&";
- append_macro(&macro_prefix[0], &macro_prefix[2], pcs);
- }
- macro_p = p;
- }
- in_macro = pcs->defining_macro;
- }
- else
- { /*
- * If we allocated a buffer for command data,
- * free it now.
- */
- if ( pst->args.data_on_heap && pst->args.data )
- { gs_free_object(pcs->memory, pst->args.data,
- "command data");
- pst->args.data = 0;
- }
- }
- param_init();
- }
+ }
+ else if ( code < 0 )
+ break;
+ if ( pcs->display_functions )
+ { /* This calls for a special parsing state. */
+ pst->scan_type = scanning_display;
+ }
+ if ( pcs->defining_macro && !in_macro )
+ { /* We just started a macro definition. */
+ if (pst->scan_type != scanning_none)
+ { /* combinded command started macro */
+ /* start definition of macro with esc& preloaded */
+ static const byte macro_prefix[3] = " \033&";
+ append_macro(&macro_prefix[0], &macro_prefix[2], pcs);
+ }
+ macro_p = p;
+ }
+ in_macro = pcs->defining_macro;
+ }
+ else
+ { /*
+ * If we allocated a buffer for command data,
+ * free it now.
+ */
+ if ( pst->args.data_on_heap && pst->args.data )
+ { gs_free_object(pcs->memory, pst->args.data,
+ "command data");
+ pst->args.data = 0;
+ }
+ }
+ param_init();
+ }
x: pr->ptr = p;
- /* Append the last bit of data to the macro, if defining. */
- if ( in_macro )
- { int mcode = append_macro(macro_p, p, pcs);
- if ( mcode < 0 && code >= 0 )
- code = mcode;
- }
- return code;
+ /* Append the last bit of data to the macro, if defining. */
+ if ( in_macro )
+ { int mcode = append_macro(macro_p, p, pcs);
+ if ( mcode < 0 && code >= 0 )
+ code = mcode;
+ }
+ return code;
}
/* inialize the pcl command counter */
int
pcl_init_command_index(pcl_parser_state_t *pcl_parser_state, pcl_state_t *pcs)
{
- pcl_command_definitions_t *definitions =
- (pcl_command_definitions_t *)gs_alloc_bytes(pcs->memory,
- sizeof(pcl_command_definitions_t),
- "pcl_init_command_index");
+ pcl_command_definitions_t *definitions =
+ (pcl_command_definitions_t *)gs_alloc_bytes(pcs->memory,
+ sizeof(pcl_command_definitions_t),
+ "pcl_init_command_index");
/* fatal */
if ( definitions == 0 )
- return -1;
+ return -1;
/* we should set these individually but each field is properly
initialized to zero */
memset(definitions, 0, sizeof(pcl_command_definitions_t));
@@ -635,16 +635,16 @@ pcl_init_command_index(pcl_parser_state_t *pcl_parser_state, pcl_state_t *pcs)
pcl_parser_shutdown(pcl_parser_state_t *pcl_parser_state, gs_memory_t *mem)
{
gs_free_object(mem, pcl_parser_state->definitions,
- "pcl_parser_shutdown");
+ "pcl_parser_shutdown");
return 0;
}
/* ---------------- Initialization ---------------- */
void
pcparse_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
-{
+{
if ( type & (pcl_reset_initial | pcl_reset_printer) )
- pcs->parse_other = 0;
+ pcs->parse_other = 0;
}
const pcl_init_t pcparse_init = {
diff --git a/pcl/pcparse.h b/pcl/pcparse.h
index 747882925..23c6cc89b 100644
--- a/pcl/pcparse.h
+++ b/pcl/pcparse.h
@@ -23,10 +23,10 @@
/* Define the lexical state of the scanner. */
typedef enum {
- scanning_none,
- scanning_parameter,
- scanning_display, /* display_functions mode */
- scanning_data /* data following a command */
+ scanning_none,
+ scanning_parameter,
+ scanning_display, /* display_functions mode */
+ scanning_data /* data following a command */
} pcl_scan_type_t;
#define min_escape_2char '0'
diff --git a/pcl/pcpatrn.c b/pcl/pcpatrn.c
index 6c1d63ba8..53b7d39b0 100644
--- a/pcl/pcpatrn.c
+++ b/pcl/pcpatrn.c
@@ -31,8 +31,6 @@
#include "pcuptrn.h"
#include "pcpatxfm.h"
-
-
/*
* The base color space for setting the color white. Unlike all other color
* spaces in PCL, this uses the DeviceGray color space in the graphic library.
@@ -47,7 +45,6 @@ static const gs_paint_color white_paint = {{ 1.0, 0.0, 0.0, 0.0 }};
/* GC routines */
private_st_ccolor_t();
-
/*
* Convert a color value specified as a three-element byte array, or an index
* to a palette, into a gs_paint_color structure.
@@ -124,7 +121,6 @@ set_ht_crd_from_foreground(
return code;
}
-
/*
* Free a PCL client color structure.
*/
@@ -218,7 +214,7 @@ unshare_ccolor(
}
/*
- * Set a solid color (unpattered) color. This is handled separately from
+ * Set a solid color (unpattered) color. This is handled separately from
* patterns as it will usually not be necessary to build a PCL client color
* structure in this case.
*
@@ -237,9 +233,9 @@ set_unpatterned_color(
pcl_ccolor_type_t type;
if ( pcur != 0 )
- type = pcur->type;
+ type = pcur->type;
else
- type = pcl_ccolor_unpatterned;
+ type = pcl_ccolor_unpatterned;
if ( (pcur != 0) &&
(type == pcl_ccolor_unpatterned) &&
@@ -301,7 +297,7 @@ set_patterned_color(
if ( (pnew->pindexed != 0) &&
((pcur == 0) || (pcur->pindexed != pnew->pindexed)) )
code = pcl_cs_indexed_install(&(pnew->pindexed), pcs);
-
+
if ( (pnew->pbase != 0) &&
((pcur == 0) || (pcur->pbase != pnew->pbase)) )
code = pcl_cs_base_install(&(pnew->pbase), pcs);
@@ -440,7 +436,7 @@ render_pattern(
pcl_ccolor_release(pptrn->pmask_ccolor);
pptrn->pmask_ccolor = 0;
}
- }
+ }
/* un-share, or allocate, the appropriate client color */
if (type == pcl_ccolor_mask_pattern) {
@@ -485,9 +481,9 @@ render_pattern(
pixinfo = pptrn->ppat_data->pixinfo;
if (pcspace != 0)
- code = pcl_cs_indexed_install(&pindexed, pcs);
+ code = pcl_cs_indexed_install(&pindexed, pcs);
if ( code < 0 )
- return code;
+ return code;
/* the following is placed here until we have time to properly
address this. The makepixmappattern() procedure detects a
@@ -728,7 +724,7 @@ set_colored_pattern(
* Note that this routine does NOT set the current
* line width (it does not have sufficient
* information to convert the dimensions).
- *
+ *
* pattern_set_frgrnd One additional operands. Sets currect base
* color space as the color space, and the
* foreground color as the current color.
@@ -755,12 +751,12 @@ set_colored_pattern(
* foreground.
*
* Special considerations apply if the pattern is
- * being set to render a PCL raster. See the
+ * being set to render a PCL raster. See the
* paragraphs at the bottom of this comment for
* additional information.
*
* pattern_set_shade_gl Two additional operands; the first provides
- * the pattern intensity, the latter the pen
+ * the pattern intensity, the latter the pen
* number to be be used as the foreground color.
* This routine generates the pattern using a two
* entry palette consisting of canonical white in
@@ -917,8 +913,8 @@ pattern_set_pen(
/* put the pen number in the proper range */
if ( (pen >= num_entries) &&
- ((pen = (pen % num_entries) + 1) == num_entries) )
- pen = 1;
+ ((pen = (pen % num_entries) + 1) == num_entries) )
+ pen = 1;
/* check if the current pen is white; if so, use the "unsolid" pattern */
@@ -926,7 +922,7 @@ pattern_set_pen(
/* Optimization for a special case where we don't need the
unsolid pattern, drawing an opaque white rectangle with
simple rops (we only check for 2 common rops). */
- if (!pcs->g.source_transparent &&
+ if (!pcs->g.source_transparent &&
(pcs->logical_op == rop3_default || pcs->logical_op == rop3_T))
goto skip_unsolid;
else
@@ -962,25 +958,25 @@ pattern_set_frgrnd(
/* check if a solid pattern should be substituted */
if ( for_image ) {
- if ((pfrgrnd->pht != ppalet->pht) ||
- (pfrgrnd->pcrd != ppalet->pcrd) ) {
- code = set_frgrnd_pattern(pcs, pcl_pattern_get_solid_pattern(pcs), true);
- if (code >= 0)
- code = set_ht_crd_from_palette(pcs);
- return code;
- }
- else if ( (ppalet->pindexed->original_cspace == 1 && !pfrgrnd->is_cmy ) ||
- (ppalet->pindexed->original_cspace != 1 && pfrgrnd->is_cmy ) ) {
- const byte blk[] = {0, 0, 0};
- gs_paint_color paint;
-
- /* NB: HP forces black foreground, as they can't handle different
- * colorspaces in foreground and raster palette
- */
- convert_color_to_paint(blk, &paint);
- code = set_unpatterned_color(pcs, NULL, pfrgrnd->pbase, &paint);
- return code;
- }
+ if ((pfrgrnd->pht != ppalet->pht) ||
+ (pfrgrnd->pcrd != ppalet->pcrd) ) {
+ code = set_frgrnd_pattern(pcs, pcl_pattern_get_solid_pattern(pcs), true);
+ if (code >= 0)
+ code = set_ht_crd_from_palette(pcs);
+ return code;
+ }
+ else if ( (ppalet->pindexed->original_cspace == 1 && !pfrgrnd->is_cmy ) ||
+ (ppalet->pindexed->original_cspace != 1 && pfrgrnd->is_cmy ) ) {
+ const byte blk[] = {0, 0, 0};
+ gs_paint_color paint;
+
+ /* NB: HP forces black foreground, as they can't handle different
+ * colorspaces in foreground and raster palette
+ */
+ convert_color_to_paint(blk, &paint);
+ code = set_unpatterned_color(pcs, NULL, pfrgrnd->pbase, &paint);
+ return code;
+ }
}
{
gs_paint_color paint;
@@ -1009,7 +1005,7 @@ pattern_set_shade_pcl(
pcl_xfm_pcl_set_pat_ref_pt(pcs);
code = set_frgrnd_pattern(pcs, pptrn, for_image);
-
+
if (for_image && (code >= 0))
code = set_ht_crd_from_palette(pcs);
return code;
@@ -1031,7 +1027,7 @@ pattern_set_shade_gl(
else if (pptrn == 0)
return ( inten > 0 ? pattern_set_pen(pcs, pen, false)
: pattern_set_white(pcs, 0, 0) );
-
+
pcl_xfm_gl_set_pat_ref_pt(pcs);
return set_uncolored_palette_pattern(pcs, pptrn, pen);
}
@@ -1117,7 +1113,7 @@ pattern_set_user_gl(
pcl_xfm_gl_set_pat_ref_pt(pcs);
if (pptrn->ppat_data->type == pcl_pattern_uncolored) {
- /* check if the current pen is white */
+ /* check if the current pen is white */
if (pcl_cs_indexed_is_white(pcs->ppalet->pindexed, pen))
pptrn = pcl_pattern_get_unsolid_pattern(pcs);
return set_uncolored_palette_pattern(pcs, pptrn, pen);
@@ -1160,7 +1156,6 @@ pattern_set_gl_RF(
}
}
-
/*
* Return the appropriate "set" procedure, given a PCL pattern type.
*/
@@ -1226,7 +1221,6 @@ pcl_pattern_get_proc_SV(
return 0;
}
-
/*
* ESC * c <#/id> G
*
@@ -1310,7 +1304,7 @@ select_current_pattern(
* that we are parsing the command correctly. The lightness and
* saturation parameters are not documented so we do not believe this
* command will be used by an application or driver.
- *
+ *
*/
typedef struct driver_configuration_s {
@@ -1329,42 +1323,42 @@ set_driver_configuration(
driver_configuration_t *driver = (driver_configuration_t *)arg_data(pargs);
if ( pcs->personality == pcl5e )
- return 0;
+ return 0;
if ( count != sizeof(driver_configuration_t) )
- return e_Range;
+ return e_Range;
/* the only device known to support this command */
- if ( ( driver->device_id < 6 ) /* 6 == hp color laserjet */
- || /* 7 == hp clj 5 */
+ if ( ( driver->device_id < 6 ) /* 6 == hp color laserjet */
+ || /* 7 == hp clj 5 */
( driver->device_id > 8 ) ) /* 8 == hp 4500 - 4550 */ {
dprintf1("unknown device id %d\n", driver->device_id );
- return e_Range;
+ return e_Range;
}
switch (driver->function_index) {
case 0: /* lightness */
- {
- int code;
- if ( driver->arguments < -100 || driver->arguments > 100 )
- return e_Range;
- /* map -100..100 to gamma setting 0.05..4.05 */
- code = pcl_palette_set_gamma(pcs, ((driver->arguments + 100.0) / 200.0) + 0.05);
- if ( code < 0 )
- return code;
- }
- break;
+ {
+ int code;
+ if ( driver->arguments < -100 || driver->arguments > 100 )
+ return e_Range;
+ /* map -100..100 to gamma setting 0.05..4.05 */
+ code = pcl_palette_set_gamma(pcs, ((driver->arguments + 100.0) / 200.0) + 0.05);
+ if ( code < 0 )
+ return code;
+ }
+ break;
case 1: /* saturation */
- {
- int code;
- if ( driver->arguments < -100 || driver->arguments > 100 )
- return e_Range;
- /* map -100..100 to gamma setting 0.05..4.05 */
- code = pcl_palette_set_gamma(pcs, ((driver->arguments + 100.0) / 200.0) + 0.05);
- if ( code < 0 )
- return code;
- }
- break;
+ {
+ int code;
+ if ( driver->arguments < -100 || driver->arguments > 100 )
+ return e_Range;
+ /* map -100..100 to gamma setting 0.05..4.05 */
+ code = pcl_palette_set_gamma(pcs, ((driver->arguments + 100.0) / 200.0) + 0.05);
+ if ( code < 0 )
+ return code;
+ }
+ break;
case 4:
/* driver arguments 3 & 6 are parsed, but not implemented. In
our model where all data is treated as sRGB and color
@@ -1382,12 +1376,11 @@ set_driver_configuration(
return e_Range;
break;
default:
- return e_Range;
+ return e_Range;
}
return 0;
}
-
/*
* Initialization and reset routines.
*/
@@ -1435,7 +1428,7 @@ pattern_do_registration(
},
END_CLASS
return 0;
-
+
}
static void
@@ -1464,11 +1457,11 @@ pattern_do_reset(
gs_state *pgs = pcs->pgs;
(gstate_pattern_cache(pgs)->free_all)(gstate_pattern_cache(pgs));
- gs_free_object(pcs->memory,
- gstate_pattern_cache(pgs)->tiles,
+ gs_free_object(pcs->memory,
+ gstate_pattern_cache(pgs)->tiles,
"pattern_do_reset(tiles)");
- gs_free_object(pcs->memory,
- gstate_pattern_cache(pgs),
+ gs_free_object(pcs->memory,
+ gstate_pattern_cache(pgs),
"pattern_do_reset(struct)");
while (pgs) {
gstate_set_pattern_cache(pgs, 0);
diff --git a/pcl/pcpatrn.h b/pcl/pcpatrn.h
index e81265615..ab4264402 100644
--- a/pcl/pcpatrn.h
+++ b/pcl/pcpatrn.h
@@ -26,8 +26,8 @@
* PCL pattern types.
*
* There are two types of patterns used in PCL, colored and uncolored. In
- * order to support transparency, both types are implemented as colored
- * patterns in the graphics library (which does not support opaque
+ * order to support transparency, both types are implemented as colored
+ * patterns in the graphics library (which does not support opaque
* uncolored patterns).
*
* The values used are defined by HP.
@@ -95,8 +95,6 @@ typedef struct pcl_pattern_data_s {
#define pcl_pattern_data_release(ppat_data) \
rc_decrement(ppat_data, "pcl_pattern_data_release")
-
-
/* forward declaration */
#ifndef pcl_ccolor_DEFINED
#define pcl_ccolor_DEFINED
@@ -111,7 +109,7 @@ typedef struct pcl_ccolor_s pcl_ccolor_t;
* instances. There are potentially two rendered instances of a pattern,
* one as a mask (uncolored) pattern and one as a colored pattern.
*
- * A "colored" pattern in the PCL sense will never have a mask rendering, but
+ * A "colored" pattern in the PCL sense will never have a mask rendering, but
* an "uncolored" PCL pattern may have both a mask and a colored rendering,
* because mask patterns in the graphic library cannot be opaque, and cannot
* use a halftone or color redering dictionary that differs from that being
@@ -130,7 +128,7 @@ typedef struct pcl_ccolor_s pcl_ccolor_t;
* the range 0 to 3.
*
* The pen field applies only to the colored pattern rendering and is used
- * only for patterns that are uncolored in the PCL sense and rendered
+ * only for patterns that are uncolored in the PCL sense and rendered
* from GL/2. The pen field indicates the palette entry used as the
* foreground for the pattern. For PCL colored patterns or uncolored
* patterns rendered from PCL, this field will be 0. The value 0 is
@@ -175,7 +173,6 @@ typedef struct pcl_pattern_t {
pmask_ccolor \
)
-
/*
* The PCL structure corresponding to the graphic library's client color
* structure. The latter potentially contains a client data structure pointer
@@ -205,7 +202,7 @@ typedef struct pcl_pattern_t {
*
* one of pindexed or pbase points to the base color space of the
* pattern color space (the other is NULL)
- *
+ *
* ccolor.paint.values[0] or ccolor.paint.values[0..2] holds the
* color values to be use for the pattern foreground
*
@@ -243,7 +240,7 @@ typedef enum {
struct pcl_ccolor_s {
rc_header rc;
pcl_ccolor_type_t type;
- pcl_pattern_data_t * ppat_data;
+ pcl_pattern_data_t * ppat_data;
pcl_cs_indexed_t * pindexed;
pcl_cs_base_t * pbase;
const byte * prast;
@@ -283,7 +280,6 @@ struct pcl_ccolor_s {
#define pcl_ccolor_release(pccolor) \
rc_decrement(pccolor, "pcl_ccolor_release")
-
/*
* Create a colored pcl_pattern_t object from a gs_depth_bitmap object. This
* object will be considered "temporary" in the sense of a PCL resource, and
@@ -317,8 +313,8 @@ int pcl_pattern_RF(
* the graphic state in different situations. The chart below characterizes
* what the operands are interpreted to mean, and what the source of the
* (graphic state) color space, color, color rendering dictionary, and
- * halftone (including transfer function) are for each case. Note in
- * particular that uncolored patterns (including the built-in shades and
+ * halftone (including transfer function) are for each case. Note in
+ * particular that uncolored patterns (including the built-in shades and
* cross-hatch patterns) must be handled separately for PCL and GL.
*
* solid white (PCL or GL)
@@ -329,7 +325,7 @@ int pcl_pattern_RF(
*
* cspace DeviceGray (irrespective of current space)
* color 1,0 (irrespective of current color)
- * CRD unchanged (irrelevant since DeviceGray is
+ * CRD unchanged (irrelevant since DeviceGray is
* the color space)
* halftone Fixed halftone with null transfer function
*
@@ -367,17 +363,17 @@ int pcl_pattern_RF(
* pattern source built-in shade patterns
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current foreground and a 2-entry palette. The
- * palette contains the canonical white color and
- * the foreground color. The color rendering
- * dictionary and halftone also are taken from
+ * palette contains the canonical white color and
+ * the foreground color. The color rendering
+ * dictionary and halftone also are taken from
* the current color.
- * CRD from current foreground (only relevant for
+ * CRD from current foreground (only relevant for
* pattern rendering)
- * halftone from current foreground (only relevant for
+ * halftone from current foreground (only relevant for
* pattern rendering).
*
* shade pattern (GL only)
@@ -387,17 +383,17 @@ int pcl_pattern_RF(
* pattern source built-in shade patterns
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current palette and a 2-entry palette. The
- * palette contains the canonical white color and
- * the color corresponding to the given pen. The
- * color rendering dictionary and halftone are
+ * palette contains the canonical white color and
+ * the color corresponding to the given pen. The
+ * color rendering dictionary and halftone are
* taken from the given palette.
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for
+ * halftone from current palette (only relevant for
* pattern rendering).
*
* cross-hatch pattern (PCL only)
@@ -407,17 +403,17 @@ int pcl_pattern_RF(
* pattern-source built-in cross-hatch patterns
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current foreground and a 2-entry palette. The
- * palette contains the canonical white color and
- * the foreground color. The color rendering
- * dictionary and halftone also are taken from the
+ * palette contains the canonical white color and
+ * the foreground color. The color rendering
+ * dictionary and halftone also are taken from the
* current color.
- * CRD from current foreground (only relevant for
+ * CRD from current foreground (only relevant for
* pattern rendering)
- * halftone from current foreground (only relevant for
+ * halftone from current foreground (only relevant for
* pattern rendering).
*
* cross-hatch pattern (GL only)
@@ -427,17 +423,17 @@ int pcl_pattern_RF(
* pattern source built-in cross-hatch patterns
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current palette und and a 2-entry palette. The
- * palette contains the canonical white color and
- * the color corresponding to the given pen. The
- * color rendering dictionary and halftone are
+ * palette contains the canonical white color and
+ * the color corresponding to the given pen. The
+ * color rendering dictionary and halftone are
* taken from the given palette.
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for
+ * halftone from current palette (only relevant for
* pattern rendering).
*
* PCL user-defined pattern (PCL only)
@@ -448,31 +444,31 @@ int pcl_pattern_RF(
*
* Handling depends on the pattern type. For uncolored patterns, the
* settings are:
- *
+ *
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current foreground and a 2-entry palette. The
- * palette contains the canonical white color and
- * the foreground color. The color rendering
- * dictionary and halftone also are taken from the
+ * palette contains the canonical white color and
+ * the foreground color. The color rendering
+ * dictionary and halftone also are taken from the
* current color.
- * CRD from current foreground (only relevant for
+ * CRD from current foreground (only relevant for
* pattern rendering)
- * halftone from current foreground (only relevant for
+ * halftone from current foreground (only relevant for
* pattern rendering).
*
* For colored patterns, the settings are:
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and the indexed color space in the
- * current palette, along with the halftone and
+ * color Colored pattern generated from the pixmap data
+ * provided and the indexed color space in the
+ * current palette, along with the halftone and
* color rendering dictionary in the current palette
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for color
+ * halftone from current palette (only relevant for color
* generation)
*
* PCL user-defined pattern (GL only)
@@ -483,31 +479,31 @@ int pcl_pattern_RF(
*
* Handling depends on the pattern type. For uncolored patterns, the
* settings are:
- *
+ *
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and a special indexed color space
- * which utilizes the base color space in the
+ * color Colored pattern generated from the pixmap data
+ * provided and a special indexed color space
+ * which utilizes the base color space in the
* current palette and a 2-entry palette. The
- * palette contains the canonical white color and
- * the color corresponding to the given pen. The
- * color rendering dictionary and halftone are
+ * palette contains the canonical white color and
+ * the color corresponding to the given pen. The
+ * color rendering dictionary and halftone are
* taken from the given palette.
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for
+ * halftone from current palette (only relevant for
* pattern rendering).
- *
+ *
* For colored patterns, the settings are:
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and the indexed color space in the
- * current palette, along with the halftone and
+ * color Colored pattern generated from the pixmap data
+ * provided and the indexed color space in the
+ * current palette, along with the halftone and
* color rendering dictionary in the current palette
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for color
+ * halftone from current palette (only relevant for color
* generation)
*
* RF pattern (GL only)
@@ -517,13 +513,13 @@ int pcl_pattern_RF(
* pattern source GL user defined patterns
*
* cspace Pattern color space without base color space
- * color Colored pattern generated from the pixmap data
- * provided and the indexed color space in the
- * current palette, along with the halftone and
+ * color Colored pattern generated from the pixmap data
+ * provided and the indexed color space in the
+ * current palette, along with the halftone and
* color rendering dictionary in the current palette
- * CRD from current palette (only relevant for
+ * CRD from current palette (only relevant for
* pattern rendering)
- * halftone from current palette (only relevant for color
+ * halftone from current palette (only relevant for color
* generation)
*
* These routines will also set the pattern reference point appropriatel for
diff --git a/pcl/pcpattyp.h b/pcl/pcpattyp.h
index 82875599f..89d0657ed 100644
--- a/pcl/pcpattyp.h
+++ b/pcl/pcpattyp.h
@@ -50,7 +50,6 @@ typedef enum {
hpgl_SV_pattern_cross_hatch = 21,
hpgl_SV_pattern_user_defined = 22
} hpgl_SV_pattern_source_t;
-
/*
* Opaque definitions of palettes, foregrounds, client colors, halftones,
diff --git a/pcl/pcpatxfm.c b/pcl/pcpatxfm.c
index 6723110e3..e08b912f8 100644
--- a/pcl/pcpatxfm.c
+++ b/pcl/pcpatxfm.c
@@ -19,7 +19,6 @@
#include "pcfont.h"
#include "pcpatxfm.h"
-
/*
* The four rotation matrices used by PCL. Note that rotations in PCL are
* always multiples of 90 degrees, and map the positive x-axis to the negative
@@ -35,10 +34,9 @@ static const gs_matrix rot_mtx[4] = {
{ 0.0, 1.0, -1.0, 0.0, 0.0, 0.0 } /* 270 degrees */
};
-
/*
* Inverst a diagonal 2-dimensional affine transformation. This is much simpler
- * than inverting a general 2-dimensional affine transformation, hence a
+ * than inverting a general 2-dimensional affine transformation, hence a
* separate routine is provided for this purpose.
*
* Note that both operands may point to the same matrix.
@@ -66,7 +64,7 @@ pcl_invert_mtx(
pmtx2->yy = 0.0;
pmtx2->tx = -ty / xy;
pmtx2->ty = -tx / yx;
-
+
} else {
float yy = pmtx1->yy;
@@ -88,9 +86,9 @@ pcl_invert_mtx(
*/
void
pcl_transform_rect(const gs_memory_t *mem,
- const gs_rect * prect1,
- gs_rect * prect2,
- const gs_matrix * pmtx
+ const gs_rect * prect1,
+ gs_rect * prect2,
+ const gs_matrix * pmtx
)
{
gs_point_transform(prect1->p.x, prect1->p.y, pmtx, &(prect2->p));
@@ -275,7 +273,7 @@ pcl_xfm_pcl_set_pat_ref_pt(
);
pcs->pat_ref_pt.x = floor(pcs->pat_ref_pt.x + 0.5);
pcs->pat_ref_pt.y = floor(pcs->pat_ref_pt.y + 0.5);
- pcs->pat_orient = (pxfmst->lp_orient
+ pcs->pat_orient = (pxfmst->lp_orient
+ (pcs->rotate_patterns ? pxfmst->print_dir : 0)) & 0x3;
}
@@ -299,7 +297,6 @@ pcl_xfm_gl_set_pat_ref_pt(
pcs->pat_orient = (pcs->xfm_state.lp_orient + (pcs->g.rotation / 90)) & 0x3;
}
-
/*
* ESC * p # R
*
@@ -326,7 +323,6 @@ set_pat_ref_pt(
return 0;
}
-
/*
* Initializaton and reset routines. There is currently no copy routine, as the
* desired transformation is reset for each object printed. No special reset
diff --git a/pcl/pcpatxfm.h b/pcl/pcpatxfm.h
index f12ee6064..502482b3f 100644
--- a/pcl/pcpatxfm.h
+++ b/pcl/pcpatxfm.h
@@ -23,15 +23,14 @@
#include "pcommand.h"
#include "pcpatrn.h"
-
/* invert a diagonal matrix (assumed to be non-signular) */
void pcl_invert_mtx(const gs_matrix * pmtx1, gs_matrix * pmtx2);
/* transform a rectangel via a diagonal matrix */
void pcl_transform_rect(const gs_memory_t *mem,
- const gs_rect * prect1,
- gs_rect * prect2,
- const gs_matrix * pmtx
+ const gs_rect * prect1,
+ gs_rect * prect2,
+ const gs_matrix * pmtx
);
/*
diff --git a/pcl/pcrect.c b/pcl/pcrect.c
index 64c54782f..bb8c8ba8e 100644
--- a/pcl/pcrect.c
+++ b/pcl/pcrect.c
@@ -26,12 +26,10 @@
#include "gspaint.h"
#include "gsrop.h"
-
-
/*
* The graphic library is, unfortunately, not equipped to produce accurate
* PCL rectangles on its own. These rectangles must always be rendered with
- * the same pixel dimensions, regardless of location (ignoring clipping),
+ * the same pixel dimensions, regardless of location (ignoring clipping),
* in the "grid intersection" pixel placement mode, must always add one
* additional pixel in the "right" and "down" directions, relative to print
* direction 0.
@@ -231,37 +229,37 @@ pcrect_do_registration(
DEFINE_CLASS('*')
{
'c', 'H',
- PCL_COMMAND( "Horizontal Rectangle Size Decipoints",
- pcl_horiz_rect_size_decipoints,
- pca_neg_error | pca_big_error | pca_in_rtl
+ PCL_COMMAND( "Horizontal Rectangle Size Decipoints",
+ pcl_horiz_rect_size_decipoints,
+ pca_neg_error | pca_big_error | pca_in_rtl
)
},
{
'c', 'A',
- PCL_COMMAND( "Horizontal Rectangle Size Units",
- pcl_horiz_rect_size_units,
- pca_neg_error | pca_big_error | pca_in_rtl
+ PCL_COMMAND( "Horizontal Rectangle Size Units",
+ pcl_horiz_rect_size_units,
+ pca_neg_error | pca_big_error | pca_in_rtl
)
},
{
'c', 'V',
- PCL_COMMAND( "Vertical Rectangle Size Decipoint",
- pcl_vert_rect_size_decipoints,
- pca_neg_error | pca_big_error | pca_in_rtl
+ PCL_COMMAND( "Vertical Rectangle Size Decipoint",
+ pcl_vert_rect_size_decipoints,
+ pca_neg_error | pca_big_error | pca_in_rtl
)
},
{
'c', 'B',
- PCL_COMMAND( "Vertical Rectangle Size Units",
- pcl_vert_rect_size_units,
- pca_neg_error | pca_big_error | pca_in_rtl
+ PCL_COMMAND( "Vertical Rectangle Size Units",
+ pcl_vert_rect_size_units,
+ pca_neg_error | pca_big_error | pca_in_rtl
)
},
{
'c', 'P',
PCL_COMMAND( "Fill Rectangular Area",
pcl_fill_rect_area,
- pca_neg_ignore | pca_big_ignore | pca_in_rtl
+ pca_neg_ignore | pca_big_ignore | pca_in_rtl
)
},
END_CLASS
@@ -278,8 +276,8 @@ pcrect_do_reset(
| pcl_reset_printer
| pcl_reset_overlay );
if ((type & mask) != 0) {
- pcs->rectangle.x = 0;
- pcs->rectangle.y = 0;
+ pcs->rectangle.x = 0;
+ pcs->rectangle.y = 0;
}
}
diff --git a/pcl/pcsfont.c b/pcl/pcsfont.c
index 2ed6ade3f..09f88d02a 100644
--- a/pcl/pcsfont.c
+++ b/pcl/pcsfont.c
@@ -124,10 +124,9 @@ pcl_make_resident_font_copy(pcl_state_t *pcs)
return 0;
}
-
static int /* ESC * c <fc_enum> F */
pcl_font_control(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
gs_const_string key;
void *value;
pl_dict_enum_t denum;
@@ -149,17 +148,17 @@ pcl_font_control(pcl_args_t *pargs, pcl_state_t *pcs)
pl_dict_release(&pcs->soft_fonts);
break;
case 1:
- /* Delete all temporary soft fonts. */
- pl_dict_enum_stack_begin(&pcs->soft_fonts, &denum, false);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- if ( ((pl_font_t *)value)->storage == pcds_temporary )
- pcl_delete_soft_font(pcs, key.data, key.size, value);
+ /* Delete all temporary soft fonts. */
+ pl_dict_enum_stack_begin(&pcs->soft_fonts, &denum, false);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ if ( ((pl_font_t *)value)->storage == pcds_temporary )
+ pcl_delete_soft_font(pcs, key.data, key.size, value);
break;
case 2:
- /* Delete soft font <font_id>. */
- pcl_delete_soft_font(pcs, current_font_id, current_font_id_size, NULL);
- /* decache the currently selected font in case we deleted it. */
- pcl_decache_font(pcs, -1);
+ /* Delete soft font <font_id>. */
+ pcl_delete_soft_font(pcs, current_font_id, current_font_id_size, NULL);
+ /* decache the currently selected font in case we deleted it. */
+ pcl_decache_font(pcs, -1);
break;
case 3:
@@ -167,26 +166,26 @@ pcl_font_control(pcl_args_t *pargs, pcl_state_t *pcs)
if ( pl_dict_find_no_stack(&pcs->soft_fonts, current_font_id, current_font_id_size, &value) )
pl_font_remove_glyph((pl_font_t *)value, pcs->character_code);
return 0;
-
+
break;
case 4:
/* Make soft font <font_id> temporary. */
if ( pl_dict_find_no_stack(&pcs->soft_fonts, current_font_id, current_font_id_size, &value) )
((pl_font_t *)value)->storage = pcds_temporary;
-
+
break;
case 5:
/* Make soft font <font_id> permanent. */
if ( pl_dict_find_no_stack(&pcs->soft_fonts, current_font_id, current_font_id_size, &value) ) {
((pl_font_t *)value)->storage = pcds_permanent;
- ((pl_font_t *)value)->params.pjl_font_number =
+ ((pl_font_t *)value)->params.pjl_font_number =
pjl_proc_register_permanent_soft_font_addition(pcs->pjls);
}
break;
case 6:
{
int code;
- if ( pcs->font == 0 ) {
+ if ( pcs->font == 0 ) {
code = pcl_recompute_font(pcs, false);
if ( code < 0 )
return code;
@@ -230,7 +229,7 @@ pcl_font_header(pcl_args_t *pargs, pcl_state_t *pcs)
int code;
bool has_checksum;
if ( count < 64 && pfh->HeaderFormat != pcfh_bitmap)
- return e_Range; /* pcfh_bitmap defaults short headers to 0 except underline position = 5; */
+ return e_Range; /* pcfh_bitmap defaults short headers to 0 except underline position = 5; */
desc_size =
(pfh->FontDescriptorSize[0] << 8) + pfh->FontDescriptorSize[1];
/* Dispatch on the header format. */
@@ -378,7 +377,7 @@ bitmap: pfont = gs_alloc_struct(mem, gs_font_base, &st_gs_font_base,
if ( ( pfh->HeaderFormat == pcfh_truetype_large ) &&
( plfont->scaling_technology == plfst_bitmap ) )
goto bitmap;
-
+
}
pfont = gs_alloc_struct(mem, gs_font_type42, &st_gs_font_type42,
"pcl_font_header(truetype font)");
@@ -445,14 +444,14 @@ bitmap: pfont = gs_alloc_struct(mem, gs_font_base, &st_gs_font_base,
static int /* ESC * c <char_code> E */
pcl_character_code(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
pcs->character_code = uint_arg(pargs);
return 0;
}
static int /* ESC ( s <count> W */
pcl_character_data(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
uint count = uint_arg(pargs);
uint font_data_size = count;
const byte *data = arg_data(pargs);
@@ -511,20 +510,20 @@ pcl_character_data(pcl_args_t *pargs, pcl_state_t *pcs)
return e_Range;
height = pl_get_uint16(data + 12);
if (height < 1 || height > 16384)
- return e_Range;
+ return e_Range;
/* more error checking of offsets, delta, width and height. */
{
int toff, loff;
int deltax;
loff = pl_get_int16(data + 6);
if ((-16384 > loff) || (loff > 16384))
- return e_Range;
+ return e_Range;
toff = pl_get_int16(data + 8);
if ((-16384 > toff) || (toff > 16384))
- return e_Range;
+ return e_Range;
deltax = pl_get_int16(data + 14);
if ((-32768 > deltax) || (deltax > 32767))
- return e_Range;
+ return e_Range;
/* also reject if width * height larger than 1MByte */
if ((width * height / 8) > 1024 *1024) return e_Range;
}
@@ -592,7 +591,7 @@ pcl_character_data(pcl_args_t *pargs, pcl_state_t *pcs)
/* See TRM Figure 11-16 (p. 11-67) for the following. */
if ( count < 14 )
return e_Range;
- {
+ {
uint data_size = pl_get_uint16(data + 4);
uint contour_offset = pl_get_uint16(data + 6);
uint metric_offset = pl_get_uint16(data + 8);
@@ -640,7 +639,7 @@ pcl_character_data(pcl_args_t *pargs, pcl_state_t *pcs)
/**** FREE PREVIOUS DEFINITION ****/
/* Compressed bitmaps have already allocated and filled in */
/* the character data structure. */
- if ( char_data == 0 ) {
+ if ( char_data == 0 ) {
char_data = gs_alloc_bytes(pcs->memory, font_data_size,
"pcl_character_data");
if ( char_data == 0 )
@@ -649,7 +648,7 @@ pcl_character_data(pcl_args_t *pargs, pcl_state_t *pcs)
/* if count > font_data_size extra data is ignored */
memcpy(char_data, data, min(count, font_data_size) );
/* NB we only handle continuation for uncompressed bitmap characters */
- if ( data[0] == pccd_bitmap &&
+ if ( data[0] == pccd_bitmap &&
data[3] == 1 &&
font_data_size > count /* expecting continuation */
) {
@@ -682,11 +681,11 @@ typedef struct alphanumeric_data_s {
byte string_id[512];
} alphanumeric_data_t;
-typedef enum resource_type_enum {
+typedef enum resource_type_enum {
macro_resource,
font_resource
} resource_type_t;
-
+
/* look up a macro in the macro dictionary, if it is not found search
on disk and add the macro to the macro dictionary */
static void *
@@ -696,7 +695,7 @@ pcl_find_resource(pcl_state_t *pcs,
resource_type_t resource_type
)
{
- pl_dict_t *dict = (resource_type == macro_resource ?
+ pl_dict_t *dict = (resource_type == macro_resource ?
&pcs->macros :
&pcs->soft_fonts);
void *value = NULL;
@@ -743,12 +742,12 @@ static int /* ESC & n <count> W [operation][string ID] */
pcl_alphanumeric_id_data(pcl_args_t *pargs, pcl_state_t *pcs)
{
uint count = uint_arg(pargs);
- const alphanumeric_data_t *alpha_data =
+ const alphanumeric_data_t *alpha_data =
(const alphanumeric_data_t *)arg_data(pargs);
int string_id_size = (count - 1); /* size of id data size - operation size */
- if ( count == 0 )
+ if ( count == 0 )
return 0;
- if ( count < 1 || count > 512 )
+ if ( count < 1 || count > 512 )
return e_Range;
switch ( alpha_data->operation )
{
@@ -757,7 +756,7 @@ pcl_alphanumeric_id_data(pcl_args_t *pargs, pcl_state_t *pcs)
{
char *new_id = (char *)gs_alloc_bytes(pcs->memory, string_id_size,
"pcl_alphanumeric_id_data");
- if ( new_id == 0 )
+ if ( new_id == 0 )
return_error(e_Memory);
/* release the previous id, if necessary */
if ( pcs->alpha_font_id.id )
@@ -826,7 +825,7 @@ pcl_alphanumeric_id_data(pcl_args_t *pargs, pcl_state_t *pcs)
/* sets the current macro id to the string id */
char *new_id = (char *)gs_alloc_bytes(pcs->memory, string_id_size,
"pcl_alphanumeric_id_data");
- if ( new_id == 0 )
+ if ( new_id == 0 )
return_error(e_Memory);
/* release the previous id, if necessary */
if ( pcs->alpha_macro_id.id )
@@ -878,7 +877,7 @@ pcl_alphanumeric_id_data(pcl_args_t *pargs, pcl_state_t *pcs)
}
return 0;
}
-
+
/* Initialization */
static int
pcsfont_do_registration(
@@ -906,14 +905,14 @@ pcsfont_do_registration(
}
static void
pcsfont_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
-{
- if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay) ) {
+{
+ if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay) ) {
pcs->soft_font_char_data = 0;
pcs->soft_font_count = 0;
id_set_value(pcs->font_id, 0);
pcs->character_code = 0;
pcs->font_id_type = numeric_id;
- if ( (type & pcl_reset_printer) != 0 ) {
+ if ( (type & pcl_reset_printer) != 0 ) {
pcl_args_t args;
arg_set_uint(&args, 1); /* delete temporary fonts */
pcl_font_control(&args, pcs);
diff --git a/pcl/pcstate.h b/pcl/pcstate.h
index a894cfe25..095338a07 100644
--- a/pcl/pcstate.h
+++ b/pcl/pcstate.h
@@ -37,7 +37,7 @@
#include "rtrstst.h" /* raster state information */
#include "pcht.h"
#include "pcident.h"
-#include "pccsbase.h"
+#include "pccsbase.h"
/*#include "pgstate.h"*/ /* HP-GL/2 state, included below */
#include "pjtop.h"
@@ -64,7 +64,7 @@ typedef enum personality_enum { /* NB document */
/*
* Palette stack. This is implemented as a simple linked list. NB
- * needs to be moved.
+ * needs to be moved.
*/
typedef struct pstack_entry_s {
struct pstack_entry_s * pnext;
@@ -96,7 +96,6 @@ void pcl_free_gstate_stk(pcl_state_t * pcs);
*/
void pcl_init_state(pcl_state_t * pcs, gs_memory_t * pmem);
-
#include "pgstate.h" /* HP-GL/2 state */
#ifndef pcl_pattern_data_DEFINED
@@ -132,7 +131,7 @@ struct pcl_state_s {
/* Define an optional procedure for parsing non-ESC data. */
int (*parse_other)( void * parse_data,
pcl_state_t * pcs,
- stream_cursor_read * pr
+ stream_cursor_read * pr
);
void * parse_data; /* closure data for parse_other */
@@ -163,7 +162,7 @@ struct pcl_state_s {
pcl_font_selection_t font_selection[2];
enum {
primary = 0,
- secondary = 1
+ secondary = 1
} font_selected;
pl_font_t * font; /* 0 means recompute from params */
pl_dict_t built_in_fonts; /* "built-in", known at start-up */
@@ -261,7 +260,6 @@ struct pcl_state_s {
* known as source transparent */
bool pcl_pattern_transparent;
-
/* Chapter 14 (pcrect.c) */
coord_point_t rectangle;
@@ -272,10 +270,10 @@ struct pcl_state_s {
int location_type;
int location_unit;
struct _sb {
- byte internal_buffer[80]; /* enough for an error message */
- byte * buffer;
- uint write_pos;
- uint read_pos;
+ byte internal_buffer[80]; /* enough for an error message */
+ byte * buffer;
+ uint write_pos;
+ uint read_pos;
} status;
/* Chapter 24 (pcmisc.c) */
@@ -283,7 +281,7 @@ struct pcl_state_s {
bool display_functions;
int (*configure_appletalk)( const byte * key,
uint key_length,
- const byte * value,
+ const byte * value,
uint value_length
);
@@ -297,7 +295,7 @@ struct pcl_state_s {
colors see pcident.h */
pcl_frgrnd_t * pfrgrnd;
pcl_gsid_t frgnd_cache_id;
-
+
pcl_gstate_ids_t * pids;
/*
* Unlike other elements of the PCL "palette", color rendering dictionaries
@@ -306,7 +304,7 @@ struct pcl_state_s {
* are determined by the output device rather than the language.
*/
pcl_crd_t * pcl_default_crd;
-
+
/* internal dithers */
pcl_ht_builtin_dither_t ordered_dither;
pcl_ht_builtin_dither_t clustered_dither;
@@ -347,13 +345,13 @@ struct pcl_state_s {
/* the current language personality */
pcl_personality_t personality;
-
+
/* enable image interpolation */
bool interpolate;
/* store a pointer to the command definitions for use by macros */
void *pcl_commands;
-
+
/* indicates page has been written to with a drawing command */
bool page_marked;
diff --git a/pcl/pcstatus.c b/pcl/pcstatus.c
index e5091b93b..267de7383 100644
--- a/pcl/pcstatus.c
+++ b/pcl/pcstatus.c
@@ -36,28 +36,27 @@
static int status_add_symbol_id(ushort *, int, ushort);
-
/* Read out from the status buffer. */
/* Return the number of bytes read. */
uint
pcl_status_read(byte *data, uint max_data, pcl_state_t *pcs)
{ uint count = min(max_data,
- pcs->status.write_pos - pcs->status.read_pos);
- if ( count )
- memcpy(data, pcs->status.buffer + pcs->status.read_pos, count);
- pcs->status.read_pos += count;
- if ( pcs->status.read_pos == pcs->status.write_pos )
- { gs_free_object(pcs->memory, pcs->status.buffer, "status buffer");
- pcs->status.write_pos = pcs->status.read_pos = 0;
- }
- return count;
+ pcs->status.write_pos - pcs->status.read_pos);
+ if ( count )
+ memcpy(data, pcs->status.buffer + pcs->status.read_pos, count);
+ pcs->status.read_pos += count;
+ if ( pcs->status.read_pos == pcs->status.write_pos )
+ { gs_free_object(pcs->memory, pcs->status.buffer, "status buffer");
+ pcs->status.write_pos = pcs->status.read_pos = 0;
+ }
+ return count;
}
/* Write a string on a stream. */
static void
stputs(stream *s, const char *str)
{ uint ignore_count;
- sputs(s, (const byte *)str, strlen(str), &ignore_count);
+ sputs(s, (const byte *)str, strlen(str), &ignore_count);
}
/* printf on a stream. */
@@ -65,12 +64,12 @@ stputs(stream *s, const char *str)
void
stprintf(stream *s, const char *fmt, ...)
{ uint count;
- va_list args;
- char buf[1024];
+ va_list args;
+ char buf[1024];
- va_start(args, fmt);
- count = vsprintf(buf, fmt, args);
- sputs(s, (const byte *)buf, count, &count);
+ va_start(args, fmt);
+ count = vsprintf(buf, fmt, args);
+ sputs(s, (const byte *)buf, count, &count);
}
/* Set up a stream for writing into the status buffer. */
@@ -78,79 +77,76 @@ static void
status_begin(stream *s, pcl_state_t *pcs)
{ byte *buffer = pcs->status.buffer;
- if ( pcs->status.read_pos > 0 )
- { memmove(buffer, buffer + pcs->status.read_pos,
- pcs->status.write_pos - pcs->status.read_pos);
- pcs->status.write_pos -= pcs->status.read_pos;
- pcs->status.read_pos = 0;
- }
- if ( buffer == 0 )
- { buffer = gs_alloc_bytes(pcs->memory, STATUS_BUFFER_SIZE,
- "status buffer");
- pcs->status.buffer = buffer;
- }
- if ( buffer == 0 )
- swrite_string(s, pcs->status.internal_buffer,
- sizeof(pcs->status.internal_buffer));
- else
- swrite_string(s, buffer, gs_object_size(pcs->memory, buffer));
- sseek(s, pcs->status.write_pos);
- stputs(s, "PCL\r\n");
+ if ( pcs->status.read_pos > 0 )
+ { memmove(buffer, buffer + pcs->status.read_pos,
+ pcs->status.write_pos - pcs->status.read_pos);
+ pcs->status.write_pos -= pcs->status.read_pos;
+ pcs->status.read_pos = 0;
+ }
+ if ( buffer == 0 )
+ { buffer = gs_alloc_bytes(pcs->memory, STATUS_BUFFER_SIZE,
+ "status buffer");
+ pcs->status.buffer = buffer;
+ }
+ if ( buffer == 0 )
+ swrite_string(s, pcs->status.internal_buffer,
+ sizeof(pcs->status.internal_buffer));
+ else
+ swrite_string(s, buffer, gs_object_size(pcs->memory, buffer));
+ sseek(s, pcs->status.write_pos);
+ stputs(s, "PCL\r\n");
}
/* Add an ID to a list being written. */
static void
status_put_id(stream *s, const char *title, const char *id)
{ /* HACK: we know that there's at least one character in the buffer. */
- if ( *s->cursor.w.ptr == '\n' )
- { /* We haven't started the list yet. */
- stprintf(s, "%s=\"%s", title, id);
- }
- else
- { stprintf(s, ",%s", id);
- }
+ if ( *s->cursor.w.ptr == '\n' )
+ { /* We haven't started the list yet. */
+ stprintf(s, "%s=\"%s", title, id);
+ }
+ else
+ { stprintf(s, ",%s", id);
+ }
}
-
/* Finish writing an ID list. */
static void
status_end_id_list(stream *s)
{ /* HACK: we know that there's at least one character in the buffer. */
- if ( *s->cursor.w.ptr != '\n' )
- stputs(s, "\"\r\n");
+ if ( *s->cursor.w.ptr != '\n' )
+ stputs(s, "\"\r\n");
}
-
static void
status_print_idlist(stream *s, const ushort *idlist, int nid, const char *title)
{
- int i;
-
- for ( i = 0; i < nid; i++ )
- { char idstr[6]; /* ddddL and a null */
- int n, l;
- n = idlist[i] >> 6;
- l = (idlist[i] & 077) + 'A' - 1;
- sprintf(idstr, "%d%c", n, l);
- status_put_id(s, title, idstr);
- }
- status_end_id_list(s);
+ int i;
+
+ for ( i = 0; i < nid; i++ )
+ { char idstr[6]; /* ddddL and a null */
+ int n, l;
+ n = idlist[i] >> 6;
+ l = (idlist[i] & 077) + 'A' - 1;
+ sprintf(idstr, "%d%c", n, l);
+ status_put_id(s, title, idstr);
+ }
+ status_end_id_list(s);
}
-
/* Output a number, at most two decimal places, but trimming trailing 0's
* and possibly the ".". Want to match HP's output as closely as we can. */
static void
status_put_floating(stream *s, double v)
{ /* Figure the format--easier than printing and chipping out the
- * chars we need. */
- int vf = (int)(v * 100 + ((v < 0)? -0.5: 0.5));
- if ( vf / 100 * 100 == vf )
- stprintf(s, "%d", vf / 100);
- else if ( vf / 10 * 10 == vf )
- stprintf(s, "%.1f", v);
- else
- stprintf(s, "%.2f", v);
+ * chars we need. */
+ int vf = (int)(v * 100 + ((v < 0)? -0.5: 0.5));
+ if ( vf / 100 * 100 == vf )
+ stprintf(s, "%d", vf / 100);
+ else if ( vf / 10 * 10 == vf )
+ stprintf(s, "%.1f", v);
+ else
+ stprintf(s, "%.2f", v);
}
/* Print font status information. */
@@ -160,143 +156,143 @@ status_put_font(stream *s, pcl_state_t *pcs,
uint font_id, uint internal_id,
pl_font_t *plfont, int font_set, bool extended)
{ char paren = (font_set > 0 ? ')' : '(');
- bool proportional = plfont->params.proportional_spacing;
-
- /* first escape sequence: symbol-set selection */
- stputs(s, "SELECT=\"");
- if ( pl_font_is_bound(plfont) || font_set > 0 )
- { /* Bound or current font, put out the symbol set. */
- uint symbol_set = font_set > 0?
- pcs->font_selection[font_set].params.symbol_set:
- plfont->params.symbol_set;
- stprintf(s, "<Esc>%c%u%c", paren, symbol_set >> 5,
- (symbol_set & 31) + 'A' - 1);
- }
-
- /* second escape sequence: font selection */
- stprintf(s, "<Esc>%cs%dp", paren, proportional);
- if ( plfont->scaling_technology == plfst_bitmap )
- { /* Bitmap font */
- status_put_floating(s, pl_fp_pitch_per_inch(&plfont->params));
- stputs(s, "h");
- status_put_floating(s, plfont->params.height_4ths / 4.0);
- stputs(s, "v");
- }
- else
- { /* Scalable font: output depends on whether selected */
- if ( font_set > 0 )
- { /* If selected, we have to cheat and reach up for info;
- * plfont is below where the scaled values exist. */
- if ( proportional )
- { status_put_floating(s,
- pcs->font_selection[font_set].params.height_4ths / 4.0);
- stputs(s, "h");
- }
- else
- { status_put_floating(s,
- pl_fp_pitch_per_inch(&pcs->font_selection[font_set].
- params));
- stputs(s, "v");
- }
- }
- else
- {
- stputs(s, proportional? "__v": "__h");
- }
- }
- stprintf(s, "%ds%db%uT", plfont->params.style,
- plfont->params.stroke_weight, plfont->params.typeface_family);
- if ( plfont->storage & pcds_downloaded )
- stprintf(s, "<Esc>%c%uX", paren, font_id);
- stputs(s, "\"\r\n");
- if ( !pl_font_is_bound(plfont) && font_set < 0 )
- { int nid;
- ushort *idlist;
- pl_dict_enum_t denum;
- gs_const_string key;
- void *value;
-
- idlist = (ushort *)gs_alloc_bytes(pcs->memory,
- pl_dict_length(&pcs->soft_symbol_sets, false) +
- pl_dict_length(&pcs->built_in_symbol_sets, false),
- "status_fonts(idlist)");
- if ( idlist == NULL )
- return e_Memory;
- nid = 0;
- /* Current fonts show the symbol set bound to them, above. */
-
- /* NOTE: Temporarily chain soft, built-in symbol sets. DON'T
- * exit this section without unchaining them. */
- pl_dict_set_parent(&pcs->soft_symbol_sets,
- &pcs->built_in_symbol_sets);
- pl_dict_enum_begin(&pcs->soft_symbol_sets, &denum);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- { pcl_symbol_set_t *ssp = (pcl_symbol_set_t *)value;
- pl_glyph_vocabulary_t gx;
-
- for ( gx = plgv_MSL; gx < plgv_next; gx++ )
- if ( ssp->maps[gx] != NULL &&
- pcl_check_symbol_support(
- ssp->maps[gx]->character_requirements,
- plfont->character_complement) )
- {
- nid = status_add_symbol_id(idlist, nid,
- (ssp->maps[gx]->id[0] << 8) + ssp->maps[gx]->id[1]);
- break; /* one will suffice */
- }
- }
- pl_dict_set_parent(&pcs->soft_symbol_sets, NULL);
- /* Symbol sets are back to normal. */
-
- gs_free_object(pcs->memory, (void*)idlist,
- "status_fonts(idlist)");
- }
- if ( extended )
- { /* Put out the "internal ID number". */
- if ( plfont->storage & pcds_temporary )
- stputs(s, "DEFID=NONE\r\n");
- else
- {
- stputs(s, "DEFID=\"");
- if ( plfont->storage & pcds_all_cartridges )
- { int c;
- int n = (plfont->storage & pcds_all_cartridges) >>
- pcds_cartridge_shift;
-
- /* pick out the bit index of the cartridge */
- for (c = 0; (n & 1) == 0; c++)
- n >>= 1;
- stprintf(s, "C%d ", c);
- }
- else if ( plfont->storage & pcds_all_simms )
- { int m;
- int n = (plfont->storage & pcds_all_simms) >>
- pcds_simm_shift;
-
- /* pick out the bit index of the SIMM */
- for (m = 0; (n & 1) == 0; m++)
- n >>= 1;
- stprintf(s, "M%d ", m);
- }
- else
- /* internal _vs_ permanent soft */
- stputs(s, (plfont->storage & pcds_internal)? "I ": "S ");
- stprintf(s, "%d\"\r\n", internal_id);
- }
-
- /* XXX Put out the font name - we need a way to get the name
- * for fonts that weren't downloaded, hence lack the known
- * header field. */
- if ( (plfont->storage & pcds_downloaded) &&
- plfont->header != NULL )
- { /* Wire in the size of the FontName field (16)--it can't
- * change anyway, and this saves work. */
- pcl_font_header_t *hdr = (pcl_font_header_t *)(plfont->header);
-
- stprintf(s, "NAME=\"%.16s\"\r\n", hdr->FontName);
- }
- }
- return 0;
+ bool proportional = plfont->params.proportional_spacing;
+
+ /* first escape sequence: symbol-set selection */
+ stputs(s, "SELECT=\"");
+ if ( pl_font_is_bound(plfont) || font_set > 0 )
+ { /* Bound or current font, put out the symbol set. */
+ uint symbol_set = font_set > 0?
+ pcs->font_selection[font_set].params.symbol_set:
+ plfont->params.symbol_set;
+ stprintf(s, "<Esc>%c%u%c", paren, symbol_set >> 5,
+ (symbol_set & 31) + 'A' - 1);
+ }
+
+ /* second escape sequence: font selection */
+ stprintf(s, "<Esc>%cs%dp", paren, proportional);
+ if ( plfont->scaling_technology == plfst_bitmap )
+ { /* Bitmap font */
+ status_put_floating(s, pl_fp_pitch_per_inch(&plfont->params));
+ stputs(s, "h");
+ status_put_floating(s, plfont->params.height_4ths / 4.0);
+ stputs(s, "v");
+ }
+ else
+ { /* Scalable font: output depends on whether selected */
+ if ( font_set > 0 )
+ { /* If selected, we have to cheat and reach up for info;
+ * plfont is below where the scaled values exist. */
+ if ( proportional )
+ { status_put_floating(s,
+ pcs->font_selection[font_set].params.height_4ths / 4.0);
+ stputs(s, "h");
+ }
+ else
+ { status_put_floating(s,
+ pl_fp_pitch_per_inch(&pcs->font_selection[font_set].
+ params));
+ stputs(s, "v");
+ }
+ }
+ else
+ {
+ stputs(s, proportional? "__v": "__h");
+ }
+ }
+ stprintf(s, "%ds%db%uT", plfont->params.style,
+ plfont->params.stroke_weight, plfont->params.typeface_family);
+ if ( plfont->storage & pcds_downloaded )
+ stprintf(s, "<Esc>%c%uX", paren, font_id);
+ stputs(s, "\"\r\n");
+ if ( !pl_font_is_bound(plfont) && font_set < 0 )
+ { int nid;
+ ushort *idlist;
+ pl_dict_enum_t denum;
+ gs_const_string key;
+ void *value;
+
+ idlist = (ushort *)gs_alloc_bytes(pcs->memory,
+ pl_dict_length(&pcs->soft_symbol_sets, false) +
+ pl_dict_length(&pcs->built_in_symbol_sets, false),
+ "status_fonts(idlist)");
+ if ( idlist == NULL )
+ return e_Memory;
+ nid = 0;
+ /* Current fonts show the symbol set bound to them, above. */
+
+ /* NOTE: Temporarily chain soft, built-in symbol sets. DON'T
+ * exit this section without unchaining them. */
+ pl_dict_set_parent(&pcs->soft_symbol_sets,
+ &pcs->built_in_symbol_sets);
+ pl_dict_enum_begin(&pcs->soft_symbol_sets, &denum);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ { pcl_symbol_set_t *ssp = (pcl_symbol_set_t *)value;
+ pl_glyph_vocabulary_t gx;
+
+ for ( gx = plgv_MSL; gx < plgv_next; gx++ )
+ if ( ssp->maps[gx] != NULL &&
+ pcl_check_symbol_support(
+ ssp->maps[gx]->character_requirements,
+ plfont->character_complement) )
+ {
+ nid = status_add_symbol_id(idlist, nid,
+ (ssp->maps[gx]->id[0] << 8) + ssp->maps[gx]->id[1]);
+ break; /* one will suffice */
+ }
+ }
+ pl_dict_set_parent(&pcs->soft_symbol_sets, NULL);
+ /* Symbol sets are back to normal. */
+
+ gs_free_object(pcs->memory, (void*)idlist,
+ "status_fonts(idlist)");
+ }
+ if ( extended )
+ { /* Put out the "internal ID number". */
+ if ( plfont->storage & pcds_temporary )
+ stputs(s, "DEFID=NONE\r\n");
+ else
+ {
+ stputs(s, "DEFID=\"");
+ if ( plfont->storage & pcds_all_cartridges )
+ { int c;
+ int n = (plfont->storage & pcds_all_cartridges) >>
+ pcds_cartridge_shift;
+
+ /* pick out the bit index of the cartridge */
+ for (c = 0; (n & 1) == 0; c++)
+ n >>= 1;
+ stprintf(s, "C%d ", c);
+ }
+ else if ( plfont->storage & pcds_all_simms )
+ { int m;
+ int n = (plfont->storage & pcds_all_simms) >>
+ pcds_simm_shift;
+
+ /* pick out the bit index of the SIMM */
+ for (m = 0; (n & 1) == 0; m++)
+ n >>= 1;
+ stprintf(s, "M%d ", m);
+ }
+ else
+ /* internal _vs_ permanent soft */
+ stputs(s, (plfont->storage & pcds_internal)? "I ": "S ");
+ stprintf(s, "%d\"\r\n", internal_id);
+ }
+
+ /* XXX Put out the font name - we need a way to get the name
+ * for fonts that weren't downloaded, hence lack the known
+ * header field. */
+ if ( (plfont->storage & pcds_downloaded) &&
+ plfont->header != NULL )
+ { /* Wire in the size of the FontName field (16)--it can't
+ * change anyway, and this saves work. */
+ pcl_font_header_t *hdr = (pcl_font_header_t *)(plfont->header);
+
+ stprintf(s, "NAME=\"%.16s\"\r\n", hdr->FontName);
+ }
+ }
+ return 0;
}
/* Finish writing status. */
@@ -304,23 +300,23 @@ status_put_font(stream *s, pcl_state_t *pcs,
static void
status_end(stream *s, pcl_state_t *pcs)
{ if ( sendwp(s) )
- { /* Overrun. Scan back to the last EOL that leaves us */
- /* enough room for the error line. */
- static const char *error_line = "ERROR=INTERNAL ERROR\r\n";
- int error_size = strlen(error_line) + 1;
- uint limit = gs_object_size(pcs->memory, pcs->status.buffer);
- uint wpos = stell(s);
-
- while ( limit - wpos < error_size ||
- pcs->status.buffer[wpos - 1] != '\n'
- )
- --wpos;
- s->end_status = 0; /**** SHOULDN'T BE NECESSARY ****/
- sseek(s, wpos);
- stputs(s, error_line);
- }
- sputc(s, FF);
- pcs->status.write_pos = stell(s);
+ { /* Overrun. Scan back to the last EOL that leaves us */
+ /* enough room for the error line. */
+ static const char *error_line = "ERROR=INTERNAL ERROR\r\n";
+ int error_size = strlen(error_line) + 1;
+ uint limit = gs_object_size(pcs->memory, pcs->status.buffer);
+ uint wpos = stell(s);
+
+ while ( limit - wpos < error_size ||
+ pcs->status.buffer[wpos - 1] != '\n'
+ )
+ --wpos;
+ s->end_status = 0; /**** SHOULDN'T BE NECESSARY ****/
+ sseek(s, wpos);
+ stputs(s, error_line);
+ }
+ sputc(s, FF);
+ pcs->status.write_pos = stell(s);
}
/* Status readouts */
@@ -330,22 +326,22 @@ static int
status_do_fonts(stream *s, pcl_state_t *pcs,
pcl_data_storage_t storage, bool extended)
{ gs_const_string key;
- void *value;
- pl_dict_enum_t denum;
- int res;
-
- pl_dict_enum_begin(&pcs->soft_fonts, &denum);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- { uint id = (key.data[0] << 8) + key.data[1];
- if ( (((pl_font_t *)value)->storage & storage) != 0 ||
- (storage == 0 && pcs->font == (pl_font_t *)value)
- )
- res = status_put_font(s, pcs, id, id, (pl_font_t *)value,
- (storage != 0 ? -1 : pcs->font_selected), extended);
- if ( res != 0 )
- return res;
- }
- return 0;
+ void *value;
+ pl_dict_enum_t denum;
+ int res;
+
+ pl_dict_enum_begin(&pcs->soft_fonts, &denum);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ { uint id = (key.data[0] << 8) + key.data[1];
+ if ( (((pl_font_t *)value)->storage & storage) != 0 ||
+ (storage == 0 && pcs->font == (pl_font_t *)value)
+ )
+ res = status_put_font(s, pcs, id, id, (pl_font_t *)value,
+ (storage != 0 ? -1 : pcs->font_selected), extended);
+ if ( res != 0 )
+ return res;
+ }
+ return 0;
}
static int
@@ -358,20 +354,20 @@ static int
status_macros(stream *s, pcl_state_t *pcs,
pcl_data_storage_t storage)
{ gs_const_string key;
- void *value;
- pl_dict_enum_t denum;
-
- if ( storage == 0 )
- return 0; /* no "currently selected" macro */
- pl_dict_enum_begin(&pcs->macros, &denum);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- if ( ((pcl_macro_t *)value)->storage & storage )
- { char id_string[6];
- sprintf(id_string, "%u", (key.data[0] << 8) + key.data[1]);
- status_put_id(s, "IDLIST", id_string);
- }
- status_end_id_list(s);
- return 0;
+ void *value;
+ pl_dict_enum_t denum;
+
+ if ( storage == 0 )
+ return 0; /* no "currently selected" macro */
+ pl_dict_enum_begin(&pcs->macros, &denum);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ if ( ((pcl_macro_t *)value)->storage & storage )
+ { char id_string[6];
+ sprintf(id_string, "%u", (key.data[0] << 8) + key.data[1]);
+ status_put_id(s, "IDLIST", id_string);
+ }
+ status_end_id_list(s);
+ return 0;
}
/*
@@ -393,15 +389,15 @@ status_patterns(
if ((pptrn != 0) && (pcs->pattern_type == pcl_pattern_user_defined)) {
char id_string[6];
- sprintf(id_string, "%u", id);
- status_put_id(s, "IDLIST", id_string);
- }
+ sprintf(id_string, "%u", id);
+ status_put_id(s, "IDLIST", id_string);
+ }
} else {
int id;
for (id = 0; id < (1L << 15) - 1; id++) {
pcl_pattern_t * pptrn = pcl_pattern_get_pcl_uptrn(pcs, id);
-
+
if (pptrn != 0) {
char id_string[6];
@@ -414,103 +410,102 @@ status_patterns(
return 0;
}
-
static bool /* Is this symbol map supported by any relevant font? */
status_check_symbol_set(pcl_state_t *pcs, pl_symbol_map_t *mapp,
pcl_data_storage_t storage)
{ gs_const_string key;
- void *value;
- pl_dict_enum_t fenum;
-
- pl_dict_enum_begin(&pcs->soft_fonts, &fenum);
- while ( pl_dict_enum_next(&fenum, &key, &value) )
- { pl_font_t *fp = (pl_font_t *)value;
-
- if ( fp->storage != storage )
- continue;
- if ( pcl_check_symbol_support(mapp->character_requirements,
- fp->character_complement) )
- return true;
- }
- return false;
+ void *value;
+ pl_dict_enum_t fenum;
+
+ pl_dict_enum_begin(&pcs->soft_fonts, &fenum);
+ while ( pl_dict_enum_next(&fenum, &key, &value) )
+ { pl_font_t *fp = (pl_font_t *)value;
+
+ if ( fp->storage != storage )
+ continue;
+ if ( pcl_check_symbol_support(mapp->character_requirements,
+ fp->character_complement) )
+ return true;
+ }
+ return false;
}
static int /* add symbol set ID to list (insertion), return new length */
status_add_symbol_id(ushort *idlist, int nid, ushort new_id)
{ int i;
- ushort *idp;
- ushort t1, t2;
-
- for ( i = 0, idp = idlist; i < nid; i++ )
- if ( new_id <= *idp )
- break;
- if ( new_id == *idp ) /* duplicate item */
- return nid;
- /* insert new_id in front of *idp */
- for ( t1 = new_id; i < nid; i++ )
- {
- t2 = *idp;
- *idp++ = t1;
- t1 = t2;
- }
- *idp = t1;
- return nid + 1;
+ ushort *idp;
+ ushort t1, t2;
+
+ for ( i = 0, idp = idlist; i < nid; i++ )
+ if ( new_id <= *idp )
+ break;
+ if ( new_id == *idp ) /* duplicate item */
+ return nid;
+ /* insert new_id in front of *idp */
+ for ( t1 = new_id; i < nid; i++ )
+ {
+ t2 = *idp;
+ *idp++ = t1;
+ t1 = t2;
+ }
+ *idp = t1;
+ return nid + 1;
}
static int
status_symbol_sets(stream *s, pcl_state_t *pcs, pcl_data_storage_t storage)
{ gs_const_string key;
- void *value;
- pl_dict_enum_t denum;
- ushort *idlist;
- int nid;
-
- if ( storage == 0 )
- return 0; /* no "currently selected" symbol set */
-
- /* Note carefully the meaning of this status inquiry. First,
- * we return only symbol sets applicable to unbound fonts. Second,
- * the "storage" value refers to the location of fonts. */
-
- /* total up built-in symbol sets, downloaded ones */
- nid = pl_dict_length(&pcs->soft_symbol_sets, false) +
- pl_dict_length(&pcs->built_in_symbol_sets, false);
- idlist = (ushort *)gs_alloc_bytes(pcs->memory, nid * sizeof(ushort),
- "status_symbol_sets(idlist)");
- if ( idlist == NULL )
- return e_Memory;
- nid = 0;
-
- /* For each symbol set,
- * for each font in appropriate storage,
- * if the font supports that symbol set, list the symbol set
- * and break (because we only need to find one such font). */
-
- /* NOTE: Temporarily chain soft, built-in symbol sets. DON'T
- * exit this section without unchaining them. */
- pl_dict_set_parent(&pcs->soft_symbol_sets,
- &pcs->built_in_symbol_sets);
- pl_dict_enum_begin(&pcs->soft_symbol_sets, &denum);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- { pcl_symbol_set_t *ssp = (pcl_symbol_set_t *)value;
- pl_glyph_vocabulary_t gx;
-
- for ( gx = plgv_MSL; gx < plgv_next; gx++ )
- if ( ssp->maps[gx] != NULL &&
- status_check_symbol_set(pcs, ssp->maps[gx], storage) )
- {
- nid = status_add_symbol_id(idlist, nid,
- (ssp->maps[gx]->id[0] << 8) + ssp->maps[gx]->id[1]);
- break; /* one will suffice */
- }
- }
- pl_dict_set_parent(&pcs->soft_symbol_sets, NULL);
- /* Symbol sets are back to normal. */
-
- status_print_idlist(s, idlist, nid, "IDLIST");
- gs_free_object(pcs->memory, (void*)idlist,
- "status_symbol_sets(idlist)");
- return 0;
+ void *value;
+ pl_dict_enum_t denum;
+ ushort *idlist;
+ int nid;
+
+ if ( storage == 0 )
+ return 0; /* no "currently selected" symbol set */
+
+ /* Note carefully the meaning of this status inquiry. First,
+ * we return only symbol sets applicable to unbound fonts. Second,
+ * the "storage" value refers to the location of fonts. */
+
+ /* total up built-in symbol sets, downloaded ones */
+ nid = pl_dict_length(&pcs->soft_symbol_sets, false) +
+ pl_dict_length(&pcs->built_in_symbol_sets, false);
+ idlist = (ushort *)gs_alloc_bytes(pcs->memory, nid * sizeof(ushort),
+ "status_symbol_sets(idlist)");
+ if ( idlist == NULL )
+ return e_Memory;
+ nid = 0;
+
+ /* For each symbol set,
+ * for each font in appropriate storage,
+ * if the font supports that symbol set, list the symbol set
+ * and break (because we only need to find one such font). */
+
+ /* NOTE: Temporarily chain soft, built-in symbol sets. DON'T
+ * exit this section without unchaining them. */
+ pl_dict_set_parent(&pcs->soft_symbol_sets,
+ &pcs->built_in_symbol_sets);
+ pl_dict_enum_begin(&pcs->soft_symbol_sets, &denum);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ { pcl_symbol_set_t *ssp = (pcl_symbol_set_t *)value;
+ pl_glyph_vocabulary_t gx;
+
+ for ( gx = plgv_MSL; gx < plgv_next; gx++ )
+ if ( ssp->maps[gx] != NULL &&
+ status_check_symbol_set(pcs, ssp->maps[gx], storage) )
+ {
+ nid = status_add_symbol_id(idlist, nid,
+ (ssp->maps[gx]->id[0] << 8) + ssp->maps[gx]->id[1]);
+ break; /* one will suffice */
+ }
+ }
+ pl_dict_set_parent(&pcs->soft_symbol_sets, NULL);
+ /* Symbol sets are back to normal. */
+
+ status_print_idlist(s, idlist, nid, "IDLIST");
+ gs_free_object(pcs->memory, (void*)idlist,
+ "status_symbol_sets(idlist)");
+ return 0;
}
static int
@@ -520,7 +515,7 @@ status_fonts_extended(stream *s, pcl_state_t *pcs,
}
static int (*const status_write[])(stream *s, pcl_state_t *pcs,
- pcl_data_storage_t storage) = {
+ pcl_data_storage_t storage) = {
status_fonts, status_macros, status_patterns, status_symbol_sets,
status_fonts_extended
};
@@ -530,160 +525,160 @@ static int (*const status_write[])(stream *s, pcl_state_t *pcs,
static int /* ESC * s <enum> T */
pcl_set_readback_loc_type(pcl_args_t *pargs, pcl_state_t *pcs)
{ pcs->location_type = uint_arg(pargs);
- return 0;
+ return 0;
}
static int /* ESC * s <enum> U */
pcl_set_readback_loc_unit(pcl_args_t *pargs, pcl_state_t *pcs)
{ pcs->location_unit = uint_arg(pargs);
- return 0;
+ return 0;
}
static int /* ESC * s <enum> I */
pcl_inquire_readback_entity(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint i = uint_arg(pargs);
- int unit = pcs->location_unit;
- stream st;
- static const char *entity_types[] = {
- "FONTS", "MACROS", "PATTERNS", "SYMBOLSETS", "FONTS EXTENDED"
- };
- pcl_data_storage_t storage;
- int code = 0;
- long pos;
-
- if ( i > 4 )
- return e_Range;
- status_begin(&st, pcs);
- stprintf(&st, "INFO %s\r\n", entity_types[i]);
- switch ( pcs->location_type )
- {
- case 0: /* invalid location */
- code = -1;
- break;
- case 1: /* currently selected */
- storage = (pcl_data_storage_t)0; /* indicates currently selected */
- break;
- case 2: /* all locations */
- storage = (pcl_data_storage_t)~0;
- break;
- case 3: /* internal */
- if ( unit != 0 )
- { code = -1;
- break;
- }
- storage = pcds_internal;
- break;
- case 4: /* downloaded */
- if ( unit > 2 )
- code = -1;
- else
- { static const pcl_data_storage_t dl_masks[] =
- { pcds_downloaded, pcds_temporary, pcds_permanent
- };
- storage = dl_masks[unit];
- }
- break;
- case 5: /* cartridges */
- if ( unit == 0 )
- storage = (pcl_data_storage_t)pcds_all_cartridges;
- else if ( unit <= pcds_cartridge_max )
- storage = (pcl_data_storage_t)
+ int unit = pcs->location_unit;
+ stream st;
+ static const char *entity_types[] = {
+ "FONTS", "MACROS", "PATTERNS", "SYMBOLSETS", "FONTS EXTENDED"
+ };
+ pcl_data_storage_t storage;
+ int code = 0;
+ long pos;
+
+ if ( i > 4 )
+ return e_Range;
+ status_begin(&st, pcs);
+ stprintf(&st, "INFO %s\r\n", entity_types[i]);
+ switch ( pcs->location_type )
+ {
+ case 0: /* invalid location */
+ code = -1;
+ break;
+ case 1: /* currently selected */
+ storage = (pcl_data_storage_t)0; /* indicates currently selected */
+ break;
+ case 2: /* all locations */
+ storage = (pcl_data_storage_t)~0;
+ break;
+ case 3: /* internal */
+ if ( unit != 0 )
+ { code = -1;
+ break;
+ }
+ storage = pcds_internal;
+ break;
+ case 4: /* downloaded */
+ if ( unit > 2 )
+ code = -1;
+ else
+ { static const pcl_data_storage_t dl_masks[] =
+ { pcds_downloaded, pcds_temporary, pcds_permanent
+ };
+ storage = dl_masks[unit];
+ }
+ break;
+ case 5: /* cartridges */
+ if ( unit == 0 )
+ storage = (pcl_data_storage_t)pcds_all_cartridges;
+ else if ( unit <= pcds_cartridge_max )
+ storage = (pcl_data_storage_t)
(1 << (pcds_cartridge_shift + unit - 1));
- else
- code = -1;
- break;
- case 6: /* SIMMs */
- if ( unit == 0 )
- storage = (pcl_data_storage_t)pcds_all_simms;
- else if ( unit <= pcds_simm_max )
- storage = (pcl_data_storage_t)(1 << (pcds_simm_shift + unit - 1));
- else
- code = -1;
- break;
- default:
- stputs(&st, "ERROR=INVALID ENTITY\r\n");
- break;
- }
- if ( code >= 0 )
- { pos = stell(&st);
- code = (*status_write[i])(&st, pcs, storage);
- if ( code >= 0 )
- { if ( stell(&st) == pos )
- stputs(&st, "ERROR=NONE\r\n");
- else if ( storage == 0 ) /* currently selected */
- stprintf(&st, "LOCTYPE=%d\r\nLOCUNIT=%d\r\n",
- pcs->location_type, unit);
- }
- }
- if ( code < 0 )
- {
- if ( code == e_Memory )
- stputs(&st, "ERROR=INTERNAL ERROR\r\n");
- else
- stputs(&st, "ERROR=INVALID LOCATION\r\n");
- }
- status_end(&st, pcs);
- return 0;
+ else
+ code = -1;
+ break;
+ case 6: /* SIMMs */
+ if ( unit == 0 )
+ storage = (pcl_data_storage_t)pcds_all_simms;
+ else if ( unit <= pcds_simm_max )
+ storage = (pcl_data_storage_t)(1 << (pcds_simm_shift + unit - 1));
+ else
+ code = -1;
+ break;
+ default:
+ stputs(&st, "ERROR=INVALID ENTITY\r\n");
+ break;
+ }
+ if ( code >= 0 )
+ { pos = stell(&st);
+ code = (*status_write[i])(&st, pcs, storage);
+ if ( code >= 0 )
+ { if ( stell(&st) == pos )
+ stputs(&st, "ERROR=NONE\r\n");
+ else if ( storage == 0 ) /* currently selected */
+ stprintf(&st, "LOCTYPE=%d\r\nLOCUNIT=%d\r\n",
+ pcs->location_type, unit);
+ }
+ }
+ if ( code < 0 )
+ {
+ if ( code == e_Memory )
+ stputs(&st, "ERROR=INTERNAL ERROR\r\n");
+ else
+ stputs(&st, "ERROR=INVALID LOCATION\r\n");
+ }
+ status_end(&st, pcs);
+ return 0;
}
static int /* ESC * s 1 M */
pcl_free_space(pcl_args_t *pargs, pcl_state_t *pcs)
{ stream st;
- status_begin(&st, pcs);
- stprintf(&st, "INFO MEMORY\r\n");
- if ( int_arg(pargs) != 1 )
- stprintf(&st, "ERROR=INVALID UNIT\r\n");
- else
- { gs_memory_status_t mstat;
- gs_memory_status(pcs->memory, &mstat);
- if ( pcs->memory != pcs->memory->non_gc_memory )
- { gs_memory_status_t dstat;
- gs_memory_status(pcs->memory->non_gc_memory, &dstat);
- mstat.allocated += dstat.allocated;
- mstat.used += dstat.used;
- }
- stprintf(&st, "TOTAL=%ld\r\n", mstat.allocated - mstat.used);
- /* We don't currently have an API for determining */
- /* the largest contiguous block. */
- /**** RETURN SOMETHING RANDOM ****/
- stprintf(&st, "LARGEST=%ld\r\n",
- (mstat.allocated - mstat.used) >> 2);
- }
- status_end(&st, pcs);
- return 0;
+ status_begin(&st, pcs);
+ stprintf(&st, "INFO MEMORY\r\n");
+ if ( int_arg(pargs) != 1 )
+ stprintf(&st, "ERROR=INVALID UNIT\r\n");
+ else
+ { gs_memory_status_t mstat;
+ gs_memory_status(pcs->memory, &mstat);
+ if ( pcs->memory != pcs->memory->non_gc_memory )
+ { gs_memory_status_t dstat;
+ gs_memory_status(pcs->memory->non_gc_memory, &dstat);
+ mstat.allocated += dstat.allocated;
+ mstat.used += dstat.used;
+ }
+ stprintf(&st, "TOTAL=%ld\r\n", mstat.allocated - mstat.used);
+ /* We don't currently have an API for determining */
+ /* the largest contiguous block. */
+ /**** RETURN SOMETHING RANDOM ****/
+ stprintf(&st, "LARGEST=%ld\r\n",
+ (mstat.allocated - mstat.used) >> 2);
+ }
+ status_end(&st, pcs);
+ return 0;
}
static int /* ESC & r <bool> F */
pcl_flush_all_pages(pcl_args_t *pargs, pcl_state_t *pcs)
{ switch ( uint_arg(pargs) )
- {
- case 0:
- { /* Flush all complete pages. */
- /* This is a driver function.... */
- return 0;
- }
- case 1:
- { /* Flush all pages, including an incomplete one. */
- int code = pcl_end_page_if_marked(pcs);
+ {
+ case 0:
+ { /* Flush all complete pages. */
+ /* This is a driver function.... */
+ return 0;
+ }
+ case 1:
+ { /* Flush all pages, including an incomplete one. */
+ int code = pcl_end_page_if_marked(pcs);
if (code >= 0)
pcl_home_cursor(pcs);
- return code;
- }
- default:
- return e_Range;
- }
+ return code;
+ }
+ default:
+ return e_Range;
+ }
}
static int /* ESC * s <int_id> X */
pcl_echo(pcl_args_t *pargs, pcl_state_t *pcs)
{ stream st;
- status_begin(&st, pcs);
- stprintf(&st, "ECHO %d\r\n", int_arg(pargs));
- status_end(&st, pcs);
- return 0;
+ status_begin(&st, pcs);
+ stprintf(&st, "ECHO %d\r\n", int_arg(pargs));
+ status_end(&st, pcs);
+ return 0;
}
/* Initialization */
@@ -693,42 +688,42 @@ pcstatus_do_registration(
gs_memory_t *mem
)
{ /* Register commands */
- DEFINE_CLASS('*')
- {'s', 'T',
- PCL_COMMAND("Set Readback Location Type",
- pcl_set_readback_loc_type,
- pca_neg_error|pca_big_error)},
- {'s', 'U',
- PCL_COMMAND("Set Readback Location Unit",
- pcl_set_readback_loc_unit,
- pca_neg_error|pca_big_error)},
- {'s', 'I',
- PCL_COMMAND("Inquire Readback Entity",
- pcl_inquire_readback_entity,
- pca_neg_error|pca_big_error)},
- {'s', 'M',
- PCL_COMMAND("Free Space", pcl_free_space,
- pca_neg_ok|pca_big_ok)},
- END_CLASS
- DEFINE_CLASS_COMMAND_ARGS('&', 'r', 'F', "Flush All Pages",
- pcl_flush_all_pages,
- pca_neg_error|pca_big_error)
- DEFINE_CLASS_COMMAND_ARGS('*', 's', 'X', "Echo",
- pcl_echo, pca_neg_ok|pca_big_error)
- return 0;
+ DEFINE_CLASS('*')
+ {'s', 'T',
+ PCL_COMMAND("Set Readback Location Type",
+ pcl_set_readback_loc_type,
+ pca_neg_error|pca_big_error)},
+ {'s', 'U',
+ PCL_COMMAND("Set Readback Location Unit",
+ pcl_set_readback_loc_unit,
+ pca_neg_error|pca_big_error)},
+ {'s', 'I',
+ PCL_COMMAND("Inquire Readback Entity",
+ pcl_inquire_readback_entity,
+ pca_neg_error|pca_big_error)},
+ {'s', 'M',
+ PCL_COMMAND("Free Space", pcl_free_space,
+ pca_neg_ok|pca_big_ok)},
+ END_CLASS
+ DEFINE_CLASS_COMMAND_ARGS('&', 'r', 'F', "Flush All Pages",
+ pcl_flush_all_pages,
+ pca_neg_error|pca_big_error)
+ DEFINE_CLASS_COMMAND_ARGS('*', 's', 'X', "Echo",
+ pcl_echo, pca_neg_ok|pca_big_error)
+ return 0;
}
static void
pcstatus_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
{ if ( type & (pcl_reset_initial | pcl_reset_printer) )
- { if ( type & pcl_reset_initial )
- { pcs->status.buffer = 0;
-
- pcs->status.write_pos = 0;
- pcs->status.read_pos = 0;
- }
- pcs->location_type = 0;
- pcs->location_unit = 0;
- }
+ { if ( type & pcl_reset_initial )
+ { pcs->status.buffer = 0;
+
+ pcs->status.write_pos = 0;
+ pcs->status.read_pos = 0;
+ }
+ pcs->location_type = 0;
+ pcs->location_unit = 0;
+ }
}
const pcl_init_t pcstatus_init = {
diff --git a/pcl/pcsymbol.c b/pcl/pcsymbol.c
index d46a661dc..8d376b9dd 100644
--- a/pcl/pcsymbol.c
+++ b/pcl/pcsymbol.c
@@ -20,8 +20,6 @@
#include "pcfont.h"
#include "pcsymbol.h"
-
-
/* HP printers will not convert MSL coded symbol table to unicode. An
MSL based font must be used with an MSL symbol set. We think this
is a bug. The following definition can be uncommented to support
@@ -32,8 +30,8 @@
static int /* ESC * c <id> R */
pcl_symbol_set_id_code(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint id = uint_arg(pargs);
- id_set_value(pcs->symbol_set_id, id);
- return 0;
+ id_set_value(pcs->symbol_set_id, id);
+ return 0;
}
#ifdef DEBUG
@@ -60,52 +58,52 @@ dump_dl_symbol_set(const pl_symbol_map_t *psm)
static int /* ESC ( f <count> W */
pcl_define_symbol_set(pcl_args_t *pargs, pcl_state_t *pcs)
{ uint count = uint_arg(pargs);
- const pl_symbol_map_t *psm = (pl_symbol_map_t *)arg_data(pargs);
- uint header_size;
- uint first_code, last_code;
- gs_memory_t *mem = pcs->memory;
- pl_symbol_map_t *header;
- pcl_symbol_set_t *symsetp;
- pl_glyph_vocabulary_t gv;
+ const pl_symbol_map_t *psm = (pl_symbol_map_t *)arg_data(pargs);
+ uint header_size;
+ uint first_code, last_code;
+ gs_memory_t *mem = pcs->memory;
+ pl_symbol_map_t *header;
+ pcl_symbol_set_t *symsetp;
+ pl_glyph_vocabulary_t gv;
#define psm_header_size 18
- if ( count < psm_header_size )
- return e_Range;
- header_size = pl_get_uint16(psm->header_size);
- if ( header_size < psm_header_size ||
- psm->id[0] != id_key(pcs->symbol_set_id)[0] ||
- psm->id[1] != id_key(pcs->symbol_set_id)[1] ||
- psm->type > 2
- )
- return e_Range;
- switch ( psm->format )
- {
- case 1:
+ if ( count < psm_header_size )
+ return e_Range;
+ header_size = pl_get_uint16(psm->header_size);
+ if ( header_size < psm_header_size ||
+ psm->id[0] != id_key(pcs->symbol_set_id)[0] ||
+ psm->id[1] != id_key(pcs->symbol_set_id)[1] ||
+ psm->type > 2
+ )
+ return e_Range;
+ switch ( psm->format )
+ {
+ case 1:
gv = plgv_MSL;
break;
- case 3:
+ case 3:
gv = plgv_Unicode;
break;
- default:
- return e_Range;
- }
- first_code = pl_get_uint16(psm->first_code);
- last_code = pl_get_uint16(psm->last_code);
+ default:
+ return e_Range;
+ }
+ first_code = pl_get_uint16(psm->first_code);
+ last_code = pl_get_uint16(psm->last_code);
/* NB fixme should check psm->Format to identify the vocabulary. */
- { int num_codes = last_code - first_code + 1;
- int i;
-
- if ( num_codes <= 0 || last_code > 255 || (count != psm_header_size + num_codes * 2) )
- return e_Range;
-
- header =
- (pl_symbol_map_t *)gs_alloc_bytes(mem,
- sizeof(pl_symbol_map_t),
- "pcl_font_header(header)");
- if ( header == 0 )
- return_error(e_Memory);
- memcpy((void *)header, (void *)psm, psm_header_size);
- /* allow mapping to and from msl and unicode */
+ { int num_codes = last_code - first_code + 1;
+ int i;
+
+ if ( num_codes <= 0 || last_code > 255 || (count != psm_header_size + num_codes * 2) )
+ return e_Range;
+
+ header =
+ (pl_symbol_map_t *)gs_alloc_bytes(mem,
+ sizeof(pl_symbol_map_t),
+ "pcl_font_header(header)");
+ if ( header == 0 )
+ return_error(e_Memory);
+ memcpy((void *)header, (void *)psm, psm_header_size);
+ /* allow mapping to and from msl and unicode */
if (psm->format == 1)
#ifdef SUPPORT_MSL_TO_UNICODE
header->mapping_type = PLGV_M2U_MAPPING;
@@ -115,14 +113,14 @@ pcl_define_symbol_set(pcl_args_t *pargs, pcl_state_t *pcs)
else
header->mapping_type = PLGV_U2M_MAPPING;
- /*
- * Byte swap the codes now, so that we don't have to byte swap
- * them every time we access them.
- */
- for ( i = num_codes; --i >= 0; )
- header->codes[i] =
- pl_get_uint16((byte *)psm + psm_header_size + i * 2);
- }
+ /*
+ * Byte swap the codes now, so that we don't have to byte swap
+ * them every time we access them.
+ */
+ for ( i = num_codes; --i >= 0; )
+ header->codes[i] =
+ pl_get_uint16((byte *)psm + psm_header_size + i * 2);
+ }
#undef psm_header_size
#ifdef DEBUG
@@ -130,150 +128,149 @@ pcl_define_symbol_set(pcl_args_t *pargs, pcl_state_t *pcs)
dump_dl_symbol_set(psm);
#endif
- /* Symbol set may already exist; if so, we may be replacing one of
- * its existing maps or adding one for a new glyph vocabulary. */
- if ( pl_dict_find(&pcs->soft_symbol_sets, id_key(pcs->symbol_set_id),
- 2, (void **)&symsetp) )
- {
- if ( symsetp->maps[gv] != NULL )
- gs_free_object(mem, symsetp->maps[gv], "symset map");
- }
- else
- { pl_glyph_vocabulary_t gx;
- symsetp = (pcl_symbol_set_t *)gs_alloc_bytes(mem,
- sizeof(pcl_symbol_set_t), "symset dict value");
- if ( !symsetp )
- return_error(e_Memory);
- for ( gx = plgv_MSL; gx < plgv_next; gx++ )
- symsetp->maps[gx] = NULL;
- symsetp->storage = pcds_temporary;
- pl_dict_put(&pcs->soft_symbol_sets, id_key(pcs->symbol_set_id),
- 2, symsetp);
- }
- symsetp->maps[gv] = header;
-
- return 0;
+ /* Symbol set may already exist; if so, we may be replacing one of
+ * its existing maps or adding one for a new glyph vocabulary. */
+ if ( pl_dict_find(&pcs->soft_symbol_sets, id_key(pcs->symbol_set_id),
+ 2, (void **)&symsetp) )
+ {
+ if ( symsetp->maps[gv] != NULL )
+ gs_free_object(mem, symsetp->maps[gv], "symset map");
+ }
+ else
+ { pl_glyph_vocabulary_t gx;
+ symsetp = (pcl_symbol_set_t *)gs_alloc_bytes(mem,
+ sizeof(pcl_symbol_set_t), "symset dict value");
+ if ( !symsetp )
+ return_error(e_Memory);
+ for ( gx = plgv_MSL; gx < plgv_next; gx++ )
+ symsetp->maps[gx] = NULL;
+ symsetp->storage = pcds_temporary;
+ pl_dict_put(&pcs->soft_symbol_sets, id_key(pcs->symbol_set_id),
+ 2, symsetp);
+ }
+ symsetp->maps[gv] = header;
+
+ return 0;
}
static int /* ESC * c <ssc_enum> S */
pcl_symbol_set_control(pcl_args_t *pargs, pcl_state_t *pcs)
{ gs_const_string key;
- void *value;
- pl_dict_enum_t denum;
-
- switch ( int_arg(pargs) )
- {
- case 0:
- { /* Delete all user-defined symbol sets. */
- /* Note: When deleting symbol set(s), it is easier (safer?)
- * to decache and reselect fonts unconditionally. (Consider,
- * for example, deleting a downloaded overload of a built-in
- * which might be the default ID.) */
- pl_dict_release(&pcs->soft_symbol_sets);
- pcl_decache_font(pcs, -1);
- }
- return 0;
- case 1:
- { /* Delete all temporary symbol sets. */
- pl_dict_enum_stack_begin(&pcs->soft_symbol_sets, &denum, false);
- while ( pl_dict_enum_next(&denum, &key, &value) )
- if ( ((pcl_symbol_set_t *)value)->storage == pcds_temporary )
- pl_dict_undef(&pcs->soft_symbol_sets, key.data, key.size);
- pcl_decache_font(pcs, -1);
- }
- return 0;
- case 2:
- { /* Delete symbol set <symbol_set_id>. */
- pl_dict_undef(&pcs->soft_symbol_sets,
- id_key(pcs->symbol_set_id), 2);
- pcl_decache_font(pcs, -1);
- }
- return 0;
- case 4:
- { /* Make <symbol_set_id> temporary. */
- if ( pl_dict_find(&pcs->soft_symbol_sets,
- id_key(pcs->symbol_set_id), 2, &value) )
- ((pcl_symbol_set_t *)value)->storage = pcds_temporary;
- }
- return 0;
- case 5:
- { /* Make <symbol_set_id> permanent. */
- if ( pl_dict_find(&pcs->soft_symbol_sets,
- id_key(pcs->symbol_set_id), 2, &value) )
- ((pcl_symbol_set_t *)value)->storage = pcds_permanent;
- }
- return 0;
- default:
- return 0;
- }
+ void *value;
+ pl_dict_enum_t denum;
+
+ switch ( int_arg(pargs) )
+ {
+ case 0:
+ { /* Delete all user-defined symbol sets. */
+ /* Note: When deleting symbol set(s), it is easier (safer?)
+ * to decache and reselect fonts unconditionally. (Consider,
+ * for example, deleting a downloaded overload of a built-in
+ * which might be the default ID.) */
+ pl_dict_release(&pcs->soft_symbol_sets);
+ pcl_decache_font(pcs, -1);
+ }
+ return 0;
+ case 1:
+ { /* Delete all temporary symbol sets. */
+ pl_dict_enum_stack_begin(&pcs->soft_symbol_sets, &denum, false);
+ while ( pl_dict_enum_next(&denum, &key, &value) )
+ if ( ((pcl_symbol_set_t *)value)->storage == pcds_temporary )
+ pl_dict_undef(&pcs->soft_symbol_sets, key.data, key.size);
+ pcl_decache_font(pcs, -1);
+ }
+ return 0;
+ case 2:
+ { /* Delete symbol set <symbol_set_id>. */
+ pl_dict_undef(&pcs->soft_symbol_sets,
+ id_key(pcs->symbol_set_id), 2);
+ pcl_decache_font(pcs, -1);
+ }
+ return 0;
+ case 4:
+ { /* Make <symbol_set_id> temporary. */
+ if ( pl_dict_find(&pcs->soft_symbol_sets,
+ id_key(pcs->symbol_set_id), 2, &value) )
+ ((pcl_symbol_set_t *)value)->storage = pcds_temporary;
+ }
+ return 0;
+ case 5:
+ { /* Make <symbol_set_id> permanent. */
+ if ( pl_dict_find(&pcs->soft_symbol_sets,
+ id_key(pcs->symbol_set_id), 2, &value) )
+ ((pcl_symbol_set_t *)value)->storage = pcds_permanent;
+ }
+ return 0;
+ default:
+ return 0;
+ }
}
static void /* free any symbol maps as well as dict value entry */
pcsymbol_dict_value_free(gs_memory_t *mem, void *value, client_name_t cname)
{ pcl_symbol_set_t *ssp = (pcl_symbol_set_t *)value;
- pl_glyph_vocabulary_t gx;
-
- if ( ssp->storage != pcds_internal )
- {
- for ( gx = plgv_MSL; gx < plgv_next; gx++ )
- {
- if ( ssp->maps[gx] != NULL )
- gs_free_object(mem, (void*)ssp->maps[gx], cname);
- }
- }
- gs_free_object(mem, value, cname);
+ pl_glyph_vocabulary_t gx;
+
+ if ( ssp->storage != pcds_internal )
+ {
+ for ( gx = plgv_MSL; gx < plgv_next; gx++ )
+ {
+ if ( ssp->maps[gx] != NULL )
+ gs_free_object(mem, (void*)ssp->maps[gx], cname);
+ }
+ }
+ gs_free_object(mem, value, cname);
}
static int
pcl_load_built_in_symbol_sets(pcl_state_t *pcs)
{
- const pl_symbol_map_t **maplp;
- pcl_symbol_set_t *symsetp;
- pl_glyph_vocabulary_t gv;
-
- for ( maplp = &pl_built_in_symbol_maps[0]; *maplp; maplp++ )
- {
- const pl_symbol_map_t *mapp = *maplp;
- /* Create entry for symbol set if this is the first map for
- * that set. */
- if ( !pl_dict_find(&pcs->built_in_symbol_sets, mapp->id, 2,
- (void **)&symsetp) )
- { pl_glyph_vocabulary_t gx;
- symsetp = (pcl_symbol_set_t *)gs_alloc_bytes(pcs->memory,
- sizeof(pcl_symbol_set_t), "symset init dict value");
- if ( !symsetp )
- return_error(e_Memory);
- for ( gx = plgv_MSL; gx < plgv_next; gx++ )
- symsetp->maps[gx] = NULL;
- symsetp->storage = pcds_internal;
- }
- gv = (mapp->character_requirements[7] & 07)==1?
- plgv_Unicode: plgv_MSL;
- pl_dict_put(&pcs->built_in_symbol_sets, mapp->id, 2, symsetp);
- symsetp->maps[gv] = (pl_symbol_map_t *)mapp;
- }
- return 0;
+ const pl_symbol_map_t **maplp;
+ pcl_symbol_set_t *symsetp;
+ pl_glyph_vocabulary_t gv;
+
+ for ( maplp = &pl_built_in_symbol_maps[0]; *maplp; maplp++ )
+ {
+ const pl_symbol_map_t *mapp = *maplp;
+ /* Create entry for symbol set if this is the first map for
+ * that set. */
+ if ( !pl_dict_find(&pcs->built_in_symbol_sets, mapp->id, 2,
+ (void **)&symsetp) )
+ { pl_glyph_vocabulary_t gx;
+ symsetp = (pcl_symbol_set_t *)gs_alloc_bytes(pcs->memory,
+ sizeof(pcl_symbol_set_t), "symset init dict value");
+ if ( !symsetp )
+ return_error(e_Memory);
+ for ( gx = plgv_MSL; gx < plgv_next; gx++ )
+ symsetp->maps[gx] = NULL;
+ symsetp->storage = pcds_internal;
+ }
+ gv = (mapp->character_requirements[7] & 07)==1?
+ plgv_Unicode: plgv_MSL;
+ pl_dict_put(&pcs->built_in_symbol_sets, mapp->id, 2, symsetp);
+ symsetp->maps[gv] = (pl_symbol_map_t *)mapp;
+ }
+ return 0;
}
bool
pcl_check_symbol_support(const byte *symset_req, const byte *font_sup)
{ int i;
- /* if glyph vocabularies match, following will work on the
- * last 3 bits of last byte. Note that the font-support bits
- * are inverted (0 means available).
- */
- for ( i = 0; i < 7; i++ )
- if ( symset_req[i] & font_sup[i] )
- return false; /* something needed, not present */
- /* check the last byte but not the glyph vocabularies. */
- if ((symset_req[7] >> 3) & (font_sup[7] >> 3))
- return false;
-
- return true;
+ /* if glyph vocabularies match, following will work on the
+ * last 3 bits of last byte. Note that the font-support bits
+ * are inverted (0 means available).
+ */
+ for ( i = 0; i < 7; i++ )
+ if ( symset_req[i] & font_sup[i] )
+ return false; /* something needed, not present */
+ /* check the last byte but not the glyph vocabularies. */
+ if ((symset_req[7] >> 3) & (font_sup[7] >> 3))
+ return false;
+
+ return true;
}
-
/* Find the symbol map for a particular symbol set and glyph vocabulary,
* if it exists.
* There are two dictionaries--one for soft (downloaded) symbol sets and
@@ -282,34 +279,33 @@ pcl_check_symbol_support(const byte *symset_req, const byte *font_sup)
pl_symbol_map_t *
pcl_find_symbol_map(const pcl_state_t *pcs, const byte *id,
pl_glyph_vocabulary_t gv, bool wide16)
-{
+{
pcl_symbol_set_t *setp;
-
if ( pl_dict_find((pl_dict_t *)&pcs->soft_symbol_sets,
- id, 2, (void **)&setp) ||
+ id, 2, (void **)&setp) ||
pl_dict_find((pl_dict_t *)&pcs->built_in_symbol_sets,
- id, 2, (void**)&setp) ) {
+ id, 2, (void**)&setp) ) {
/* 16 bit sets are not supported, they aren't strictly
necessary, yet. */
if (wide16)
return NULL;
- /* simple case we found a matching symbol set */
- if ( setp->maps[gv] != NULL )
- return setp->maps[gv];
- /* we requested a unicode symbol set and found an msl
- symbol set that can be mapped to unicode */
- if ( (gv == plgv_Unicode) &&
- (setp->maps[plgv_MSL]) &&
- ((setp->maps[plgv_MSL])->mapping_type == PLGV_M2U_MAPPING) )
- return setp->maps[plgv_MSL];
- /* we requested an msl symbol set and found a unicode
- symbol set that can be mapped to msl */
- if ( (gv == plgv_MSL) &&
- (setp->maps[plgv_Unicode]) &&
- ((setp->maps[plgv_Unicode])->mapping_type == PLGV_U2M_MAPPING) )
- return setp->maps[plgv_Unicode];
+ /* simple case we found a matching symbol set */
+ if ( setp->maps[gv] != NULL )
+ return setp->maps[gv];
+ /* we requested a unicode symbol set and found an msl
+ symbol set that can be mapped to unicode */
+ if ( (gv == plgv_Unicode) &&
+ (setp->maps[plgv_MSL]) &&
+ ((setp->maps[plgv_MSL])->mapping_type == PLGV_M2U_MAPPING) )
+ return setp->maps[plgv_MSL];
+ /* we requested an msl symbol set and found a unicode
+ symbol set that can be mapped to msl */
+ if ( (gv == plgv_MSL) &&
+ (setp->maps[plgv_Unicode]) &&
+ ((setp->maps[plgv_Unicode])->mapping_type == PLGV_U2M_MAPPING) )
+ return setp->maps[plgv_Unicode];
}
return NULL;
}
@@ -321,45 +317,45 @@ pcsymbol_do_registration(
gs_memory_t *mem
)
{ /* Register commands */
- DEFINE_CLASS_COMMAND_ARGS('*', 'c', 'R', "Symbol Set ID Code",
- pcl_symbol_set_id_code,
- pca_neg_error|pca_big_error)
- DEFINE_CLASS_COMMAND_ARGS('(', 'f', 'W', "Define Symbol Set",
- pcl_define_symbol_set, pca_byte_data|pca_neg_error|pca_big_clamp)
- DEFINE_CLASS_COMMAND_ARGS('*', 'c', 'S', "Symbol Set Control",
- pcl_symbol_set_control,
- pca_neg_ignore|pca_big_ignore)
- return 0;
+ DEFINE_CLASS_COMMAND_ARGS('*', 'c', 'R', "Symbol Set ID Code",
+ pcl_symbol_set_id_code,
+ pca_neg_error|pca_big_error)
+ DEFINE_CLASS_COMMAND_ARGS('(', 'f', 'W', "Define Symbol Set",
+ pcl_define_symbol_set, pca_byte_data|pca_neg_error|pca_big_clamp)
+ DEFINE_CLASS_COMMAND_ARGS('*', 'c', 'S', "Symbol Set Control",
+ pcl_symbol_set_control,
+ pca_neg_ignore|pca_big_ignore)
+ return 0;
}
static void
pcsymbol_do_reset(pcl_state_t *pcs, pcl_reset_type_t type)
-{
+{
if ( type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_overlay) ) {
- id_set_value(pcs->symbol_set_id, 0);
- if ( type & pcl_reset_initial ) {
- /* Don't set a parent relationship from soft to built-in
- * symbol sets. Although it is arguably useful, it's
- * better to avoid it and keep anyone who's looking at the
- * soft symbol sets from mucking up the permanent ones. */
- pl_dict_init(&pcs->soft_symbol_sets, pcs->memory,
- pcsymbol_dict_value_free);
- pl_dict_init(&pcs->built_in_symbol_sets, pcs->memory,
- pcsymbol_dict_value_free);
- /* NB. Symbol sets are require for RTL/HPGL/2 mode for
- * stickfonts but we shouldn't load all of them. */
- if ( pcl_load_built_in_symbol_sets(pcs) < 0 )
- dprintf("Internal error, no symbol sets found");
- }
- else if ( type & pcl_reset_printer ) {
- pcl_args_t args;
- arg_set_uint(&args, 1); /* delete temporary symbol sets */
- pcl_symbol_set_control(&args, pcs);
- }
+ id_set_value(pcs->symbol_set_id, 0);
+ if ( type & pcl_reset_initial ) {
+ /* Don't set a parent relationship from soft to built-in
+ * symbol sets. Although it is arguably useful, it's
+ * better to avoid it and keep anyone who's looking at the
+ * soft symbol sets from mucking up the permanent ones. */
+ pl_dict_init(&pcs->soft_symbol_sets, pcs->memory,
+ pcsymbol_dict_value_free);
+ pl_dict_init(&pcs->built_in_symbol_sets, pcs->memory,
+ pcsymbol_dict_value_free);
+ /* NB. Symbol sets are require for RTL/HPGL/2 mode for
+ * stickfonts but we shouldn't load all of them. */
+ if ( pcl_load_built_in_symbol_sets(pcs) < 0 )
+ dprintf("Internal error, no symbol sets found");
+ }
+ else if ( type & pcl_reset_printer ) {
+ pcl_args_t args;
+ arg_set_uint(&args, 1); /* delete temporary symbol sets */
+ pcl_symbol_set_control(&args, pcs);
+ }
}
if ( type & pcl_reset_permanent ) {
- pl_dict_release(&pcs->soft_symbol_sets);
- pl_dict_release(&pcs->built_in_symbol_sets);
+ pl_dict_release(&pcs->soft_symbol_sets);
+ pl_dict_release(&pcs->built_in_symbol_sets);
}
}
@@ -367,10 +363,10 @@ static int
pcsymbol_do_copy(pcl_state_t *psaved, const pcl_state_t *pcs,
pcl_copy_operation_t operation)
{ if ( operation & pcl_copy_after )
- { /* Don't restore the downloaded symbol set dictionary. */
- psaved->built_in_symbol_sets = pcs->built_in_symbol_sets;
- }
- return 0;
+ { /* Don't restore the downloaded symbol set dictionary. */
+ psaved->built_in_symbol_sets = pcs->built_in_symbol_sets;
+ }
+ return 0;
}
const pcl_init_t pcsymbol_init = {
diff --git a/pcl/pcsymbol.h b/pcl/pcsymbol.h
index f5c85f337..676ec4b1c 100644
--- a/pcl/pcsymbol.h
+++ b/pcl/pcsymbol.h
@@ -34,7 +34,7 @@ typedef struct pcl_symbol_set_s {
/* Check whether a symbol map's character requirements are supported by a
* font's character complement. */
bool pcl_check_symbol_support(const byte *symset_req,
- const byte *font_sup);
+ const byte *font_sup);
/* Find a symbol map, given its ID and glyph vocabulary. */
pl_symbol_map_t *pcl_find_symbol_map(const pcl_state_t *pcs,
diff --git a/pcl/pctext.c b/pcl/pctext.c
index bcd7c64f5..eb5cd0c82 100644
--- a/pcl/pctext.c
+++ b/pcl/pctext.c
@@ -40,7 +40,6 @@
/* pseudo-"dots" (actually 1/300" units) used in underline only */
#define dots(n) ((float)(7200 / 300 * n))
-
/*
* Install a font in the graphic state.
*/
@@ -61,7 +60,6 @@ pcl_downloaded_and_bound(pl_font_t *plfont)
return (plfont->storage != pcds_internal && pl_font_is_bound(plfont));
}
-
/* uncomment the following definition to treat map type 0 as defined
in the specification. The default is to use the behavior we have
observed on several HP devices. Map type 0 is treated as map type
@@ -312,11 +310,11 @@ get_next_char(
*pchr = 0xffff;
return 0;
}
-/*
- * return length of multibyte sequence from starting byte
+/*
+ * return length of multibyte sequence from starting byte
* replacement of macro pcl_char_is_2_byte, UTF-8 sequence length may be up to 6 bytes
*
- * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence
+ * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence
*/
int
pcl_char_bytelen(byte ch, pcl_text_parsing_method_t tpm)
@@ -324,71 +322,71 @@ pcl_char_bytelen(byte ch, pcl_text_parsing_method_t tpm)
int bytelen = 1;
- switch(tpm) {
- default:
- /* byte length defaults to 1 */
- break;
-
- case tpm_21_DBCS7:
- /* 0x21-0xff are double-byte */
- bytelen = (ch < 0x21) ? 1 : 2;
- break;
-
- case tpm_31_sjis:
- /* 0x81-0x9f, 0xe0-0xfc are double-byte */
- bytelen = (ch < 0x81 || (ch > 0x9f && ch < 0xe0) || ch > 0xfc) ? 1 : 2;
- break;
-
- case tpm_38_DBCS8:
- /* 0x80-0xff are double-byte */
- bytelen = (ch < 0x80) ? 1 : 2;
- break;
+ switch(tpm) {
+ default:
+ /* byte length defaults to 1 */
+ break;
+
+ case tpm_21_DBCS7:
+ /* 0x21-0xff are double-byte */
+ bytelen = (ch < 0x21) ? 1 : 2;
+ break;
+
+ case tpm_31_sjis:
+ /* 0x81-0x9f, 0xe0-0xfc are double-byte */
+ bytelen = (ch < 0x81 || (ch > 0x9f && ch < 0xe0) || ch > 0xfc) ? 1 : 2;
+ break;
+
+ case tpm_38_DBCS8:
+ /* 0x80-0xff are double-byte */
+ bytelen = (ch < 0x80) ? 1 : 2;
+ break;
case tpm_83_utf8:
case tpm_1008_utf8:
- if (ch < 0x80) {
- /* 0xxxxxxx */
- bytelen = 1;
- break;
- }
- if (ch < 0xc2) {
- bytelen = 0; /* illegal */
- break;
- }
- if (ch < 0xe0) {
- /* 110XXXXx 10xxxxxx */
- bytelen = 2;
- break;
- }
- if (ch < 0xf0) {
- /* 1110XXXX 10Xxxxxx 10xxxxxx */
- bytelen = 3;
- break;
- }
- if (ch < 0xf8) {
- /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
- bytelen = 4;
- break;
- }
- if (ch < 0xfc) {
- /* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
- bytelen = 5;
- break;
- }
- if (ch < 0xfe) {
- /* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
- bytelen = 6;
- break;
- }
- bytelen = 0; /* illegal */
- break;
- }
- return bytelen;
+ if (ch < 0x80) {
+ /* 0xxxxxxx */
+ bytelen = 1;
+ break;
+ }
+ if (ch < 0xc2) {
+ bytelen = 0; /* illegal */
+ break;
+ }
+ if (ch < 0xe0) {
+ /* 110XXXXx 10xxxxxx */
+ bytelen = 2;
+ break;
+ }
+ if (ch < 0xf0) {
+ /* 1110XXXX 10Xxxxxx 10xxxxxx */
+ bytelen = 3;
+ break;
+ }
+ if (ch < 0xf8) {
+ /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
+ bytelen = 4;
+ break;
+ }
+ if (ch < 0xfc) {
+ /* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ bytelen = 5;
+ break;
+ }
+ if (ch < 0xfe) {
+ /* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ bytelen = 6;
+ break;
+ }
+ bytelen = 0; /* illegal */
+ break;
+ }
+ return bytelen;
}
-/*
+/*
* convert multibyte sequence to unicode (16-bit)
* Both the string pointer and the length are modified.
*
- * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence
+ * Returns 0 for invalid byte, byte length > 0 of multibyte character sequence
*/
gs_char
pcl_char_get_char(pcl_text_parsing_method_t tpm, const byte ** psrc, int src_len)
@@ -404,66 +402,66 @@ pcl_char_get_char(pcl_text_parsing_method_t tpm, const byte ** psrc, int src_len
switch(tpm) {
default:
chr = src[0];
- break;
+ break;
case tpm_21_DBCS7:
- /* 0x21-0xff are double-byte */
- chr = (src[0] < 0x21) ? src[0] : (src[0] << 8 | src[1]);
- break;
+ /* 0x21-0xff are double-byte */
+ chr = (src[0] < 0x21) ? src[0] : (src[0] << 8 | src[1]);
+ break;
case tpm_31_sjis:
- /* 0x81-0x9f, 0xe0-0xfc are double-byte */
- chr = (src[0] < 0x81 || (src[0] > 0x9f && src[0] < 0xe0) || src[0] > 0xfc) ? src[0] : (src[0] << 8 | src[1]);
- break;
+ /* 0x81-0x9f, 0xe0-0xfc are double-byte */
+ chr = (src[0] < 0x81 || (src[0] > 0x9f && src[0] < 0xe0) || src[0] > 0xfc) ? src[0] : (src[0] << 8 | src[1]);
+ break;
case tpm_38_DBCS8:
- /* 0x80-0xff are double-byte */
- chr = (src[0] < 0x80) ? src[0] : (src[0] << 8 | src[1]);
- break;
+ /* 0x80-0xff are double-byte */
+ chr = (src[0] < 0x80) ? src[0] : (src[0] << 8 | src[1]);
+ break;
case tpm_83_utf8:
case tpm_1008_utf8:
- if (src[0] < 0x80) {
- /* 0xxxxxxx */
- chr = src[0];
- break;
- }
- if (src[0] < 0xc2) {
+ if (src[0] < 0x80) {
+ /* 0xxxxxxx */
+ chr = src[0];
+ break;
+ }
+ if (src[0] < 0xc2) {
chr = INVALID_UC;
- break;
- }
- if (src[0] < 0xe0) {
- /* 110XXXXx 10xxxxxx */
- chr = (src[0] & 0x1f);
- chr = (chr << 6) | (src[1] & 0x3f);
- break;
- }
- if (src[0] < 0xf0) {
- /* 1110XXXX 10Xxxxxx 10xxxxxx */
- chr = (src[0] & 0x0f);
- chr = (chr << 6) | (src[1] & 0x3f);
- chr = (chr << 6) | (src[2] & 0x3f);
- break;
- }
- if (src[0] < 0xf8) {
- /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
- /* chr is 16 bit: overflow */
+ break;
+ }
+ if (src[0] < 0xe0) {
+ /* 110XXXXx 10xxxxxx */
+ chr = (src[0] & 0x1f);
+ chr = (chr << 6) | (src[1] & 0x3f);
+ break;
+ }
+ if (src[0] < 0xf0) {
+ /* 1110XXXX 10Xxxxxx 10xxxxxx */
+ chr = (src[0] & 0x0f);
+ chr = (chr << 6) | (src[1] & 0x3f);
+ chr = (chr << 6) | (src[2] & 0x3f);
+ break;
+ }
+ if (src[0] < 0xf8) {
+ /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */
+ /* chr is 16 bit: overflow */
chr = INVALID_UC;
- break;
- }
- if (src[0] < 0xfc) {
- /* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
- /* chr is 16 bit: overflow */
+ break;
+ }
+ if (src[0] < 0xfc) {
+ /* 111110XX 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ /* chr is 16 bit: overflow */
chr = INVALID_UC;
- break;
- }
- if (src[0] < 0xfe) {
- /* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
- /* chr is 16 bit: overflow */
+ break;
+ }
+ if (src[0] < 0xfe) {
+ /* 1111110X 10XXxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
+ /* chr is 16 bit: overflow */
chr = INVALID_UC;
- break;
- }
- chr = INVALID_UC;
- break;
+ break;
+ }
+ chr = INVALID_UC;
+ break;
}
*psrc += bytelen;
return chr;
@@ -974,7 +972,6 @@ pcl_text(
else
pcs->font->allow_vertical_substitutes = false;
-
/* Print remaining characters, restore the ctm */
code = pcl_show_chars_slow(pcs, &scale, str, size, literal);
gs_setmatrix(pgs, &user_ctm);
@@ -1254,10 +1251,10 @@ pctext_do_reset(
if ((type & mask) != 0) {
pcs->underline_enabled = false;
- pcs->last_was_BS = false;
- pcs->last_width = inch2coord(1.0 / 10.0);
+ pcs->last_was_BS = false;
+ pcs->last_width = inch2coord(1.0 / 10.0);
pcs->text_parsing_method = tpm_0_SBCS;
- pcs->text_path = 0;
+ pcs->text_path = 0;
}
}
diff --git a/pcl/pctop.c b/pcl/pctop.c
index 2b37f8340..6301f1412 100644
--- a/pcl/pctop.c
+++ b/pcl/pctop.c
@@ -39,43 +39,41 @@
#include "pcpalet.h"
#include "gsicc_manage.h"
-
-
/* Configuration table for modules */
-extern const pcl_init_t pcparse_init;
-extern const pcl_init_t rtmisc_init;
-extern const pcl_init_t rtraster_init;
-extern const pcl_init_t pcjob_init;
-extern const pcl_init_t pcpage_init;
-extern const pcl_init_t pcfont_init;
-extern const pcl_init_t pctext_init;
-extern const pcl_init_t pcsymbol_init;
-extern const pcl_init_t pcsfont_init;
-extern const pcl_init_t pcmacros_init;
-extern const pcl_init_t pcrect_init;
-extern const pcl_init_t pcstatus_init;
-extern const pcl_init_t pcmisc_init;
-extern const pcl_init_t pcursor_init;
-extern const pcl_init_t pcl_cid_init;
-extern const pcl_init_t pcl_color_init;
-extern const pcl_init_t pcl_udither_init;
-extern const pcl_init_t pcl_frgrnd_init;
-extern const pcl_init_t pcl_lookup_tbl_init;
-extern const pcl_init_t pcl_palette_init;
-extern const pcl_init_t pcl_pattern_init;
-extern const pcl_init_t pcl_xfm_init;
-extern const pcl_init_t pcl_upattern_init;
-extern const pcl_init_t rtgmode_init;
-extern const pcl_init_t pccprint_init;
-extern const pcl_init_t pginit_init;
-extern const pcl_init_t pgframe_init;
-extern const pcl_init_t pgconfig_init;
-extern const pcl_init_t pgvector_init;
-extern const pcl_init_t pgpoly_init;
-extern const pcl_init_t pglfill_init;
-extern const pcl_init_t pgchar_init;
-extern const pcl_init_t pglabel_init;
-extern const pcl_init_t pgcolor_init;
+extern const pcl_init_t pcparse_init;
+extern const pcl_init_t rtmisc_init;
+extern const pcl_init_t rtraster_init;
+extern const pcl_init_t pcjob_init;
+extern const pcl_init_t pcpage_init;
+extern const pcl_init_t pcfont_init;
+extern const pcl_init_t pctext_init;
+extern const pcl_init_t pcsymbol_init;
+extern const pcl_init_t pcsfont_init;
+extern const pcl_init_t pcmacros_init;
+extern const pcl_init_t pcrect_init;
+extern const pcl_init_t pcstatus_init;
+extern const pcl_init_t pcmisc_init;
+extern const pcl_init_t pcursor_init;
+extern const pcl_init_t pcl_cid_init;
+extern const pcl_init_t pcl_color_init;
+extern const pcl_init_t pcl_udither_init;
+extern const pcl_init_t pcl_frgrnd_init;
+extern const pcl_init_t pcl_lookup_tbl_init;
+extern const pcl_init_t pcl_palette_init;
+extern const pcl_init_t pcl_pattern_init;
+extern const pcl_init_t pcl_xfm_init;
+extern const pcl_init_t pcl_upattern_init;
+extern const pcl_init_t rtgmode_init;
+extern const pcl_init_t pccprint_init;
+extern const pcl_init_t pginit_init;
+extern const pcl_init_t pgframe_init;
+extern const pcl_init_t pgconfig_init;
+extern const pcl_init_t pgvector_init;
+extern const pcl_init_t pgpoly_init;
+extern const pcl_init_t pglfill_init;
+extern const pcl_init_t pgchar_init;
+extern const pcl_init_t pglabel_init;
+extern const pcl_init_t pgcolor_init;
extern const pcl_init_t fontpg_init;
const pcl_init_t * pcl_init_table[] = {
@@ -135,7 +133,7 @@ pcl_gstate_client_alloc(
/*
* set and get for pcl's target device. This is the device at the end
- * of the pipeline.
+ * of the pipeline.
*/
static int
pcl_gstate_client_copy_for(
@@ -187,7 +185,6 @@ typedef struct pcl_interp_instance_s {
void *post_page_closure;/* closure to call post_page_action with */
} pcl_interp_instance_t;
-
/* Get implemtation's characteristics */
const pl_interp_characteristics_t * /* always returns a descriptor */
pcl_impl_characteristics(
@@ -240,21 +237,21 @@ pcl_impl_allocate_interp_instance(
{
/* Allocate everything up front */
pcl_interp_instance_t *pcli /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
- = (pcl_interp_instance_t *)gs_alloc_bytes( mem,
- sizeof(pcl_interp_instance_t),
- "pcl_allocate_interp_instance(pcl_interp_instance_t)"
- );
- gs_state *pgs = gs_state_alloc(mem);
+ = (pcl_interp_instance_t *)gs_alloc_bytes( mem,
+ sizeof(pcl_interp_instance_t),
+ "pcl_allocate_interp_instance(pcl_interp_instance_t)"
+ );
+ gs_state *pgs = gs_state_alloc(mem);
gsicc_init_iccmanager(pgs);
/* If allocation error, deallocate & return */
if (!pcli || !pgs) {
- if (pcli)
- gs_free_object(mem, pcli, "pcl_allocate_interp_instance(pcl_interp_instance_t)");
- if (pgs)
- gs_state_free(pgs);
- return gs_error_VMerror;
+ if (pcli)
+ gs_free_object(mem, pcli, "pcl_allocate_interp_instance(pcl_interp_instance_t)");
+ if (pgs)
+ gs_state_free(pgs);
+ return gs_error_VMerror;
}
pcli->memory = mem;
@@ -265,16 +262,16 @@ pcl_impl_allocate_interp_instance(
pcl_init_state(&pcli->pcs, mem);
pcli->pcs.client_data = pcli;
pcli->pcs.pgs = pgs;
- pcli->pcs.xfm_state.paper_size = 0;
+ pcli->pcs.xfm_state.paper_size = 0;
/* provide an end page procedure */
pcli->pcs.end_page = pcl_end_page_top;
/* Init gstate to point to pcl state */
gs_state_set_client(pgs, &pcli->pcs, &pcl_gstate_procs, false);
/* register commands */
{
- int code = pcl_do_registrations(&pcli->pcs, &pcli->pst);
- if ( code < 0 )
- return(code);
+ int code = pcl_do_registrations(&pcli->pcs, &pcli->pst);
+ if ( code < 0 )
+ return(code);
}
/* Return success */
@@ -290,12 +287,12 @@ pcl_impl_set_client_instance(
pl_interp_instance_clients_t which_client
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
-
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+
if ( which_client == PJL_CLIENT )
pcli->pcs.pjls = client;
/* ignore unknown clients */
- return 0;
+ return 0;
}
/* Set an interpreter instance's pre-page action */
@@ -306,10 +303,10 @@ pcl_impl_set_pre_page_action(
void *closure /* closure to call action with */
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- pcli->pre_page_action = action;
- pcli->pre_page_closure = closure;
- return 0;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ pcli->pre_page_action = action;
+ pcli->pre_page_closure = closure;
+ return 0;
}
/* Set an interpreter instance's post-page action */
@@ -320,10 +317,10 @@ pcl_impl_set_post_page_action(
void *closure /* closure to call action with */
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- pcli->post_page_action = action;
- pcli->post_page_closure = closure;
- return 0;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ pcli->post_page_action = action;
+ pcli->post_page_closure = closure;
+ return 0;
}
/* if the device option string PCL is not given, the default
@@ -332,15 +329,15 @@ static pcl_personality_t
pcl_get_personality(pl_interp_instance_t *instance, gx_device *device)
{
if ( !strcmp(instance->pcl_personality, "PCL5C" ) )
- return pcl5c;
+ return pcl5c;
else if ( !strcmp(instance->pcl_personality, "PCL5E" ) )
- return pcl5e;
+ return pcl5e;
else if ( !strcmp(instance->pcl_personality, "RTL" ) )
- return rtl;
+ return rtl;
else if ( device->color_info.depth == 1 )
- return pcl5e;
+ return pcl5e;
else
- return pcl5c;
+ return pcl5c;
}
static bool
@@ -389,86 +386,85 @@ pcl_impl_set_device(
stage = Sgsave1;
if ( (code = gs_gsave(pcli->pcs.pgs)) < 0 )
- goto pisdEnd;
+ goto pisdEnd;
stage = Serase;
if ( (code = gs_erasepage(pcli->pcs.pgs)) < 0 )
- goto pisdEnd;
+ goto pisdEnd;
/* Do device-dependent pcl inits */
stage = Sreset;
if ((code = pcl_do_resets(&pcli->pcs, pcl_reset_initial)) < 0 )
- goto pisdEnd;
+ goto pisdEnd;
/* provide a PCL graphic state we can return to */
stage = Spclgsave;
if ( (code = pcl_gsave(&pcli->pcs)) < 0 )
- goto pisdEnd;
+ goto pisdEnd;
stage = Sdone; /* success */
/* Unwind any errors */
pisdEnd:
switch (stage) {
case Sdone: /* don't undo success */
case Sinitg: /* can't happen removes warning */
- break;
+ break;
case Spclgsave: /* 2nd gsave failed */
- /* fall thru to next */
+ /* fall thru to next */
case Sreset: /* pcl_do_resets failed */
case Serase: /* gs_erasepage failed */
- /* undo 1st gsave */
- gs_grestore_only(pcli->pcs.pgs); /* destroys gs_save stack */
- /* fall thru to next */
+ /* undo 1st gsave */
+ gs_grestore_only(pcli->pcs.pgs); /* destroys gs_save stack */
+ /* fall thru to next */
case Sgsave1: /* 1st gsave failed */
- /* undo setdevice */
- gs_nulldevice(pcli->pcs.pgs);
- /* fall thru to next */
+ /* undo setdevice */
+ gs_nulldevice(pcli->pcs.pgs);
+ /* fall thru to next */
case Ssetdevice: /* gs_setdevice failed */
case Sbegin: /* nothing left to undo */
- break;
+ break;
}
return code;
}
-static int
+static int
pcl_impl_get_device_memory(
pl_interp_instance_t *instance, /* interp instance to use */
gs_memory_t **pmem)
{
return 0;
}
-
/* Prepare interp instance for the next "job" */
static int /* ret 0 ok, else -ve error code */
pcl_impl_init_job(
- pl_interp_instance_t *instance /* interp instance to start job in */
+ pl_interp_instance_t *instance /* interp instance to start job in */
)
{
- int code = 0;
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- pcl_process_init(&pcli->pst);
- return code;
+ int code = 0;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ pcl_process_init(&pcli->pst);
+ return code;
}
/* Parse a cursor-full of data */
static int /* ret 0 or +ve if ok, else -ve error code */
pcl_impl_process(
- pl_interp_instance_t *instance, /* interp instance to process data job in */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to process data job in */
+ stream_cursor_read *cursor /* data to process */
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- int code = pcl_process(&pcli->pst, &pcli->pcs, cursor);
- return code;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ int code = pcl_process(&pcli->pst, &pcli->pcs, cursor);
+ return code;
}
/* Skip to end of job ret 1 if done, 0 ok but EOJ not found, else -ve error code */
-static int
+static int
pcl_impl_flush_to_eoj(
- pl_interp_instance_t *instance, /* interp instance to flush for */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to flush for */
+ stream_cursor_read *cursor /* data to process */
)
{
const byte *p = cursor->ptr;
@@ -476,16 +472,16 @@ pcl_impl_flush_to_eoj(
/* Skip to, but leave UEL in buffer for PJL to find later */
for (; p < rlimit; ++p)
- if (p[1] == '\033') {
- uint avail = rlimit - p;
-
- if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
- continue;
- if (avail < 9)
- break;
- cursor->ptr = p;
- return 1; /* found eoj */
- }
+ if (p[1] == '\033') {
+ uint avail = rlimit - p;
+
+ if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
+ continue;
+ if (avail < 9)
+ break;
+ cursor->ptr = p;
+ return 1; /* found eoj */
+ }
cursor->ptr = p;
return 0; /* need more data */
}
@@ -493,45 +489,45 @@ pcl_impl_flush_to_eoj(
/* Parser action for end-of-file */
static int /* ret 0 or +ve if ok, else -ve error code */
pcl_impl_process_eof(
- pl_interp_instance_t *instance /* interp instance to process data job in */
+ pl_interp_instance_t *instance /* interp instance to process data job in */
)
{
int code;
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- pcl_process_init(&pcli->pst);
- code = pcl_end_page_if_marked(&pcli->pcs);
- if ( code < 0 )
- return code;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ pcl_process_init(&pcli->pst);
+ code = pcl_end_page_if_marked(&pcli->pcs);
+ if ( code < 0 )
+ return code;
/* force restore & cleanup if unexpected data end was encountered */
- return 0;
+ return 0;
}
/* Report any errors after running a job */
static int /* ret 0 ok, else -ve error code */
pcl_impl_report_errors(
- pl_interp_instance_t *instance, /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance, /* interp instance to wrap up job in */
int code, /* prev termination status */
long file_position, /* file position of error, -1 if unknown */
bool force_to_cout /* force errors to cout */
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- byte buf[200];
- uint count;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ byte buf[200];
+ uint count;
- while ( (count = pcl_status_read(buf, sizeof(buf), &pcli->pcs)) != 0 )
- errwrite(pcli->memory, (const char *)buf, count);
+ while ( (count = pcl_status_read(buf, sizeof(buf), &pcli->pcs)) != 0 )
+ errwrite(pcli->memory, (const char *)buf, count);
- return 0;
+ return 0;
}
/* Wrap up interp instance after a "job" */
static int /* ret 0 ok, else -ve error code */
pcl_impl_dnit_job(
- pl_interp_instance_t *instance /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance /* interp instance to wrap up job in */
)
{
- return 0;
+ return 0;
}
/* Remove a device from an interperter instance */
@@ -541,23 +537,23 @@ pcl_impl_remove_device(
)
{
int code;
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
/* NB use the PXL code */
- /* return to the original graphic state w/color mapper, bbox, target */
- code = pcl_grestore(&pcli->pcs);
- if (code < 0 )
- dprintf1("error code %d restoring gstate, continuing\n", code );
- /* return to original gstate w/bbox, target */
- code = gs_grestore_only(pcli->pcs.pgs); /* destroys gs_save stack */
- if (code < 0 )
- dprintf1("error code %d destroying gstate, continuing\n", code );
-
- /* Deselect bbox. Bbox has been prevented from auto-closing/deleting */
- code = gs_nulldevice(pcli->pcs.pgs);
- if ( code < 0 )
- dprintf1("error code %d installing nulldevice, continuing\n", code );
- return pcl_do_resets(&pcli->pcs, pcl_reset_permanent);
+ /* return to the original graphic state w/color mapper, bbox, target */
+ code = pcl_grestore(&pcli->pcs);
+ if (code < 0 )
+ dprintf1("error code %d restoring gstate, continuing\n", code );
+ /* return to original gstate w/bbox, target */
+ code = gs_grestore_only(pcli->pcs.pgs); /* destroys gs_save stack */
+ if (code < 0 )
+ dprintf1("error code %d destroying gstate, continuing\n", code );
+
+ /* Deselect bbox. Bbox has been prevented from auto-closing/deleting */
+ code = gs_nulldevice(pcli->pcs.pgs);
+ if ( code < 0 )
+ dprintf1("error code %d installing nulldevice, continuing\n", code );
+ return pcl_do_resets(&pcli->pcs, pcl_reset_permanent);
}
/* Deallocate a interpreter instance */
@@ -566,27 +562,27 @@ pcl_impl_deallocate_interp_instance(
pl_interp_instance_t *instance /* instance to dealloc */
)
{
- pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
- gs_memory_t *mem = pcli->memory;
+ pcl_interp_instance_t *pcli = (pcl_interp_instance_t *)instance;
+ gs_memory_t *mem = pcli->memory;
/* free memory used by the parsers */
if ( pcl_parser_shutdown(&pcli->pst, mem ) < 0 ) {
dprintf("Undefined error shutting down parser, continuing\n" );
}
/* this should have a shutdown procedure like pcl above */
- gs_free_object(mem,
+ gs_free_object(mem,
pcli->pst.hpgl_parser_state,
"pcl_deallocate_interp_instance(pcl_interp_instance_t)");
/* free default, pdflt_* objects */
- pcl_free_default_objects( mem, &pcli->pcs);
-
- /* free halftone cache in gs state */
- gs_state_free(pcli->pcs.pgs);
- /* remove pcl's gsave grestore stack */
- pcl_free_gstate_stk(&pcli->pcs);
- gs_free_object(mem, pcli,
- "pcl_deallocate_interp_instance(pcl_interp_instance_t)");
- return 0;
+ pcl_free_default_objects( mem, &pcli->pcs);
+
+ /* free halftone cache in gs state */
+ gs_state_free(pcli->pcs.pgs);
+ /* remove pcl's gsave grestore stack */
+ pcl_free_gstate_stk(&pcli->pcs);
+ gs_free_object(mem, pcli,
+ "pcl_deallocate_interp_instance(pcl_interp_instance_t)");
+ return 0;
}
/* Do static deinit of PCL interpreter */
@@ -595,11 +591,11 @@ pcl_impl_deallocate_interp(
pl_interp_t *interp /* interpreter to deallocate */
)
{
- /* Deinit interp */
- return 0;
+ /* Deinit interp */
+ return 0;
}
-/*
+/*
* End-of-page called back by PCL - NB now exported.
*/
int
@@ -631,7 +627,7 @@ pcl_end_page_top(
if (pcli->post_page_action) {
code = pcli->post_page_action(instance, pcli->post_page_closure);
if (code < 0)
- return code;
+ return code;
}
return 0;
}
diff --git a/pcl/pctop.h b/pcl/pctop.h
index d77610854..8ae574fac 100644
--- a/pcl/pctop.h
+++ b/pcl/pctop.h
@@ -19,5 +19,4 @@
pcl_state_t * pcl_get_gstate(pl_interp_instance_t *instance);
-
#endif /* pctop_INCLUDED */
diff --git a/pcl/pctpm.h b/pcl/pctpm.h
index cdab7c349..15f121c00 100644
--- a/pcl/pctpm.h
+++ b/pcl/pctpm.h
@@ -23,7 +23,7 @@ typedef enum {
tpm_0_SBCS = 0,
tpm_21_DBCS7 = 21, /* e.g. GB_2312-80 (China), JIS_X0208-1983 (Japan), KSC_5601 (Korea) */
tpm_31_sjis = 31,
- tpm_38_DBCS8 = 38,
+ tpm_38_DBCS8 = 38,
tpm_83_utf8 = 83, /* http://docs.hp.com/en/5991-7956/5991-7956.pdf */
/* HP-UX 11i v3 International Printing Features */
tpm_1008_utf8 = 1008 /* http://www.lexmark.com/publications/pdfs/TRef_3Q01.pdf */
@@ -33,7 +33,7 @@ int pcl_char_bytelen(byte ch, pcl_text_parsing_method_t tpm);
gs_char pcl_char_get_char(pcl_text_parsing_method_t tpm, const byte ** psrc, int len);
/*
- * was 0xfffd
+ * was 0xfffd
*/
#define INVALID_UC 0xffff
diff --git a/pcl/pcuptrn.c b/pcl/pcuptrn.c
index da6ec5cf3..247d8c79b 100644
--- a/pcl/pcuptrn.c
+++ b/pcl/pcuptrn.c
@@ -53,7 +53,7 @@ free_pattern_data(
}
/*
- * Build a pattern data structure. This routine is static as pattern
+ * Build a pattern data structure. This routine is static as pattern
* data structures may only be built as part of a pattern.
*
* All pattern data structure are built as "temporary". Routines that build
@@ -99,7 +99,7 @@ build_pattern_data(
*/
static void
free_pattern_rendering(const gs_memory_t *mem,
- pcl_pattern_t * pptrn
+ pcl_pattern_t * pptrn
)
{
if (pptrn->pcol_ccolor != 0) {
@@ -260,7 +260,7 @@ delete_all_pcl_ptrns(
pl_dict_t * pdict[2];
int i;
- pdict[0] = &pcs->pcl_patterns;
+ pdict[0] = &pcs->pcl_patterns;
pdict[1] = &pcs->gl_patterns;
for (i = 0; i < 2; i++) {
@@ -330,17 +330,17 @@ pcl_pattern_RF(
if (ppixmap != 0) {
pcl_pattern_type_t type = ( ppixmap->pix_depth == 1
? pcl_pattern_uncolored
- : pcl_pattern_colored );
- /* RF appears to use the resolution of the device contrary to
+ : pcl_pattern_colored );
+ /* RF appears to use the resolution of the device contrary to
what the pcl documentation implies */
- gx_device *pdev = gs_currentdevice(pcs->pgs);
+ gx_device *pdev = gs_currentdevice(pcs->pgs);
int code = pcl_pattern_build_pattern( &pptrn,
- ppixmap,
- type,
- pdev->HWResolution[0],
- pdev->HWResolution[1],
- pcs->memory
- );
+ ppixmap,
+ type,
+ pdev->HWResolution[0],
+ pdev->HWResolution[1],
+ pcs->memory
+ );
if (code < 0)
return code;
@@ -362,7 +362,6 @@ pcl_pattern_RF(
return 0;
}
-
/*
* The PCL user-define pattern type. For memory management reasons, this has
* a transitory existence.
@@ -415,7 +414,7 @@ download_pcl_pattern(
int code = 0;
if (count < 8)
- return e_Range;
+ return e_Range;
format = puptrn0->format;
/* non data size - the size of the parameters that describe the data */
@@ -449,7 +448,6 @@ download_pcl_pattern(
if (pixinfo.data == 0)
return e_Memory;
-
if (format == 20) {
pcl_upattern1_t * puptrn1 = (pcl_upattern1_t *)puptrn0;
@@ -465,7 +463,7 @@ download_pcl_pattern(
/* build the pattern */
code = pcl_pattern_build_pattern( &(pptrn),
&pixinfo,
- (format == 1 ? pcl_pattern_colored
+ (format == 1 ? pcl_pattern_colored
: pcl_pattern_uncolored),
xres,
yres,
@@ -540,7 +538,7 @@ pattern_control(
static int
upattern_do_copy(pcl_state_t *psaved, const pcl_state_t *pcs,
pcl_copy_operation_t operation)
-{
+{
int i;
/* copy back any patterns created during macro invocation. */
if ((operation & pcl_copy_after) != 0) {
@@ -560,7 +558,7 @@ upattern_do_copy(pcl_state_t *psaved, const pcl_state_t *pcs,
/*
* Initialization and reset routines.
- */
+ */
static int
upattern_do_registration(
pcl_parser_state_t *pcl_parser_state,
@@ -574,7 +572,7 @@ upattern_do_registration(
},
{
'c', 'Q',
- PCL_COMMAND( "Pattern Control",
+ PCL_COMMAND( "Pattern Control",
pattern_control,
pca_neg_ignore | pca_big_ignore
)
diff --git a/pcl/pcursor.c b/pcl/pcursor.c
index 048a23fe1..99721ad90 100644
--- a/pcl/pcursor.c
+++ b/pcl/pcursor.c
@@ -305,7 +305,6 @@ do_horiz_motion(
return;
}
-
static inline int
do_vertical_move(pcl_state_t *pcs, pcl_args_t *pargs, float mul,
bool use_margins, bool by_row, bool by_row_command, bool truncate_arg)
@@ -418,7 +417,6 @@ pcl_updated_hmi(
return pcs->hmi_cp = hmi - (hmi % pcs->uom_cp);
}
-
/* Commands */
/*
@@ -507,7 +505,6 @@ set_line_termination(
return 0;
}
-
/*
* ESC & a <cols> C
*/
@@ -600,7 +597,6 @@ cmd_HT(
return 0;
}
-
/*
* ESC & a <rows> R
*/
@@ -685,7 +681,6 @@ cmd_FF(
return pcl_do_FF(pcs);
}
-
/*
* ESC & f <pp_enum> S
*
diff --git a/pcl/pcwhtidx.c b/pcl/pcwhtidx.c
index 93ac41836..e7cb63269 100644
--- a/pcl/pcwhtidx.c
+++ b/pcl/pcwhtidx.c
@@ -211,7 +211,7 @@ remap_raster_ary(
if (out_nbits > 8 * sizeof(ulong) - b_per_p) {
while (out_nbits >= 8) {
-
+
*outp++ = (out_accum >> (out_nbits - 8)) & 0xff;
out_nbits -= 8;
out_accum <<= 8;
@@ -267,7 +267,7 @@ pcl_cmap_map_raster(
/* see if any remapping is necessary */
*pout_pixinfo = *pin_pixinfo;
if ( !build_remap_array( pindexed->palette.data,
- pindexed->num_entries,
+ pindexed->num_entries,
remap,
pfirst_white,
pix_depth,
@@ -383,5 +383,5 @@ pcl_cmap_int_apply_ary(
remap_raster_ary8(prast, prast, npixels, b_per_p, (const byte *)vpmap);
else
remap_raster_ary(prast, prast, npixels, b_per_p, (const byte *)vpmap);
-
+
}
diff --git a/pcl/pcxfmst.h b/pcl/pcxfmst.h
index 624a71aa7..2e01771af 100644
--- a/pcl/pcxfmst.h
+++ b/pcl/pcxfmst.h
@@ -21,21 +21,21 @@
#include "gxfixed.h"
#include "pccoord.h"
-/*
+/*
* Structure for paper size parameters. Note that these values are all coords
* (centipoints).
*/
typedef struct pcl_paper_size_s {
coord width, height; /* physical page size */
coord offset_portrait; /* offset of logical page left edge from
- * the physical page in portrait orientations */
+ * the physical page in portrait orientations */
coord offset_landscape; /* ditto for landscape orientations */
} pcl_paper_size_t;
/*
* Geometric transformation structure for PCL.
*
- * Except for GL/2, PCL deals strictly in diagonal transformations: all
+ * Except for GL/2, PCL deals strictly in diagonal transformations: all
* transformations are compositions of 90 degree rotations, scaling, and
* translations. Thus, maintaining a full matrix representation is overkill.
* For the most part, however, any gains in performance from use of a simpler
diff --git a/pcl/pgchar.c b/pcl/pgchar.c
index 68dce6461..c229d1ec4 100644
--- a/pcl/pgchar.c
+++ b/pcl/pgchar.c
@@ -31,51 +31,51 @@
static int
hpgl_font_definition(hpgl_args_t *pargs, hpgl_state_t *pgls, int index)
{ /*
- * Since these commands take an arbitrary number of arguments,
- * we reset the argument bookkeeping after each group.
- * We reset phase to 1, 2, or 3 after seeing the first pair,
- * so we can tell whether there were any arguments at all.
- * (1 means no parameter changed, >1 means some parameter changed.)
- */
- pcl_font_selection_t *pfs = &pgls->g.font_selection[index];
+ * Since these commands take an arbitrary number of arguments,
+ * we reset the argument bookkeeping after each group.
+ * We reset phase to 1, 2, or 3 after seeing the first pair,
+ * so we can tell whether there were any arguments at all.
+ * (1 means no parameter changed, >1 means some parameter changed.)
+ */
+ pcl_font_selection_t *pfs = &pgls->g.font_selection[index];
#define pfp (&pfs->params)
- int kind;
- pfs->selected_id = (uint)-1;
- for ( ; hpgl_arg_c_int(pgls->memory, pargs, &kind); pargs->phase |= 1 )
- switch ( kind )
- {
- case 1: /* symbol set */
- { int32 sset;
- if ( !hpgl_arg_int(pgls->memory, pargs, &sset) )
- return e_Range;
- if ( pfp->symbol_set != (uint)sset )
- pfp->symbol_set = (uint)sset,
- pargs->phase |= 2;
- }
- break;
- case 2: /* spacing */
- { int spacing;
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &spacing) )
- return e_Range;
- if ( ((spacing == 1) || (spacing == 0)) && (pfp->proportional_spacing != spacing) )
- pfp->proportional_spacing = spacing,
- pargs->phase |= 2;
- }
- break;
- case 3: /* pitch */
- { hpgl_real_t pitch;
- if ( !hpgl_arg_c_real(pgls->memory, pargs, &pitch) )
- return e_Range;
- if ( (pl_fp_pitch_per_inch(pfp) != pitch) &&
+ int kind;
+ pfs->selected_id = (uint)-1;
+ for ( ; hpgl_arg_c_int(pgls->memory, pargs, &kind); pargs->phase |= 1 )
+ switch ( kind )
+ {
+ case 1: /* symbol set */
+ { int32 sset;
+ if ( !hpgl_arg_int(pgls->memory, pargs, &sset) )
+ return e_Range;
+ if ( pfp->symbol_set != (uint)sset )
+ pfp->symbol_set = (uint)sset,
+ pargs->phase |= 2;
+ }
+ break;
+ case 2: /* spacing */
+ { int spacing;
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &spacing) )
+ return e_Range;
+ if ( ((spacing == 1) || (spacing == 0)) && (pfp->proportional_spacing != spacing) )
+ pfp->proportional_spacing = spacing,
+ pargs->phase |= 2;
+ }
+ break;
+ case 3: /* pitch */
+ { hpgl_real_t pitch;
+ if ( !hpgl_arg_c_real(pgls->memory, pargs, &pitch) )
+ return e_Range;
+ if ( (pl_fp_pitch_per_inch(pfp) != pitch) &&
(pitch >= 0) && (pitch < 32768.0) ) {
pl_fp_set_pitch_per_inch(pfp, pitch > 7200.0 ? 7200.0 : pitch);
pargs->phase |= 2;
}
-
- }
- break;
- case 4: /* height */
- {
+
+ }
+ break;
+ case 4: /* height */
+ {
hpgl_real_t height;
if ( !hpgl_arg_c_real(pgls->memory, pargs, &height) )
return e_Range;
@@ -87,73 +87,73 @@ hpgl_font_definition(hpgl_args_t *pargs, hpgl_state_t *pgls, int index)
it probably should be rounded as in pcl but
doing so would change a lot of files for no
compelling reason so for now truncate. */
- uint trunc_height_4ths = (uint)(height * 4);
+ uint trunc_height_4ths = (uint)(height * 4);
pfp->height_4ths = (trunc_height_4ths == 0 ? 1 : trunc_height_4ths);
pargs->phase |= 2;
}
- }
- break;
- case 5: /* posture */
- { int posture;
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &posture) )
- return e_Range;
- if ( pfp->style != posture )
- pfp->style = posture,
- pargs->phase |= 2;
-
- }
- break;
- case 6: /* stroke weight */
- { int weight;
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &weight) )
- return e_Range;
- if ( pfp->stroke_weight != weight )
- if ( ((weight >= -7 ) && (weight <= 7)) || (weight == 9999 ) )
- pfp->stroke_weight = weight,
- pargs->phase |= 2;
- }
- break;
- case 7: /* typeface */
- { int32 face;
- if ( !hpgl_arg_int(pgls->memory, pargs, &face) )
- return e_Range;
- if ( pfp->typeface_family != (uint)face )
- pfp->typeface_family = (uint)face,
- pargs->phase |= 2;
- }
- break;
- default:
- return e_Range;
- }
- /* If there were no arguments at all, default all values. */
- if ( !pargs->phase )
- hpgl_default_font_params(pfs);
- if ( pargs->phase != 1 )
- { /* A value changed, or we are defaulting. Decache the font. */
- pfs->font = 0;
- if ( index == pgls->g.font_selected )
- pgls->g.font = 0;
- }
- return 0;
+ }
+ break;
+ case 5: /* posture */
+ { int posture;
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &posture) )
+ return e_Range;
+ if ( pfp->style != posture )
+ pfp->style = posture,
+ pargs->phase |= 2;
+
+ }
+ break;
+ case 6: /* stroke weight */
+ { int weight;
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &weight) )
+ return e_Range;
+ if ( pfp->stroke_weight != weight )
+ if ( ((weight >= -7 ) && (weight <= 7)) || (weight == 9999 ) )
+ pfp->stroke_weight = weight,
+ pargs->phase |= 2;
+ }
+ break;
+ case 7: /* typeface */
+ { int32 face;
+ if ( !hpgl_arg_int(pgls->memory, pargs, &face) )
+ return e_Range;
+ if ( pfp->typeface_family != (uint)face )
+ pfp->typeface_family = (uint)face,
+ pargs->phase |= 2;
+ }
+ break;
+ default:
+ return e_Range;
+ }
+ /* If there were no arguments at all, default all values. */
+ if ( !pargs->phase )
+ hpgl_default_font_params(pfs);
+ if ( pargs->phase != 1 )
+ { /* A value changed, or we are defaulting. Decache the font. */
+ pfs->font = 0;
+ if ( index == pgls->g.font_selected )
+ pgls->g.font = 0;
+ }
+ return 0;
}
/* Define label drawing direction (DI, DR). */
static int
hpgl_label_direction(hpgl_args_t *pargs, hpgl_state_t *pgls, bool relative)
{ hpgl_real_t run = 1, rise = 0;
- if ( hpgl_arg_c_real(pgls->memory, pargs, &run) )
- { if ( !hpgl_arg_c_real(pgls->memory, pargs, &rise) || (run == 0 && rise == 0) )
- return e_Range;
- { double hyp = hypot(run, rise);
- run /= hyp;
- rise /= hyp;
- }
- }
- pgls->g.character.direction.x = run;
- pgls->g.character.direction.y = rise;
- pgls->g.character.direction_relative = relative;
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- return 0;
+ if ( hpgl_arg_c_real(pgls->memory, pargs, &run) )
+ { if ( !hpgl_arg_c_real(pgls->memory, pargs, &rise) || (run == 0 && rise == 0) )
+ return e_Range;
+ { double hyp = hypot(run, rise);
+ run /= hyp;
+ rise /= hyp;
+ }
+ }
+ pgls->g.character.direction.x = run;
+ pgls->g.character.direction.y = rise;
+ pgls->g.character.direction_relative = relative;
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ return 0;
}
/* forward declaration */
@@ -163,27 +163,27 @@ static int hpgl_select_font(hpgl_state_t *pgls, int index);
static int
hpgl_select_font_by_id(hpgl_args_t *pargs, hpgl_state_t *pgls, int index)
{ pcl_font_selection_t *pfs = &pgls->g.font_selection[index];
- int32 id;
- int code;
-
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &id) || id < 0 )
- return e_Range;
- code = pcl_select_font_by_id(pfs, id, pgls /****** NOTA BENE ******/);
- switch ( code )
- {
- default: /* error */
- return code;
- case 1: /* ID not found, no effect */
- return 0;
- case 0: /* ID found */
- break;
- }
+ int32 id;
+ int code;
+
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &id) || id < 0 )
+ return e_Range;
+ code = pcl_select_font_by_id(pfs, id, pgls /****** NOTA BENE ******/);
+ switch ( code )
+ {
+ default: /* error */
+ return code;
+ case 1: /* ID not found, no effect */
+ return 0;
+ case 0: /* ID found */
+ break;
+ }
pgls->g.font_selection[index].font = pfs->font;
pgls->g.font_selection[index].map = pfs->map;
- /*
- * If we just selected a bitmap font, force the equivalent of SB1.
- * See TRM 23-65 and 23-81.
- */
+ /*
+ * If we just selected a bitmap font, force the equivalent of SB1.
+ * See TRM 23-65 and 23-81.
+ */
if ( pfs->font->scaling_technology == plfst_bitmap ) {
hpgl_args_t args;
hpgl_args_setup(&args);
@@ -213,8 +213,8 @@ hpgl_select_font(hpgl_state_t *pgls, int index)
/* AD [kind,value...]; */
int
hpgl_AD(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_font_definition(pargs, pgls, 1);
+{
+ return hpgl_font_definition(pargs, pgls, 1);
}
#define CHAR_EDGE_PEN_UNSET -1
@@ -228,12 +228,12 @@ hpgl_get_character_edge_pen(
/* if the character edge pen has not been set then we return the
current pen number, otherwise the state value as set in the CF
command is used. (see hpgl_CF) */
- return (pgls->g.character.edge_pen == CHAR_EDGE_PEN_UNSET ?
- hpgl_get_selected_pen(pgls) :
- pgls->g.character.edge_pen);
+ return (pgls->g.character.edge_pen == CHAR_EDGE_PEN_UNSET ?
+ hpgl_get_selected_pen(pgls) :
+ pgls->g.character.edge_pen);
}
-
+
/*
* CF [mode[,pen]];
*/
@@ -249,16 +249,16 @@ hpgl_CF(
if (hpgl_arg_c_int(pgls->memory, pargs, &mode)) {
if ((mode & ~3) != 0)
- return e_Range;
- /* With only 1 argument, we "unset" the current pen. This
+ return e_Range;
+ /* With only 1 argument, we "unset" the current pen. This
causes the drawing machinery to use the current pen when
the stroke is rendered (i.e. a subsequent SP will change
the character edge pen */
- if (hpgl_arg_int(pgls->memory, pargs, &pen)) {
+ if (hpgl_arg_int(pgls->memory, pargs, &pen)) {
if ((pen < 0) || (pen >= npen))
- return e_Range;
- } else
- pen = CHAR_EDGE_PEN_UNSET;
+ return e_Range;
+ } else
+ pen = CHAR_EDGE_PEN_UNSET;
}
pgls->g.character.fill_mode = mode;
pgls->g.character.edge_pen = pen;
@@ -270,52 +270,52 @@ hpgl_CF(
/* DI [run,rise]; */
int
hpgl_DI(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_label_direction(pargs, pgls, false);
+{
+ return hpgl_label_direction(pargs, pgls, false);
}
/* DR [run,rise]; */
int
hpgl_DR(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_label_direction(pargs, pgls, true);
+{
+ return hpgl_label_direction(pargs, pgls, true);
}
/* DT terminator[,mode]; */
int
hpgl_DT(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ const byte *p = pargs->source.ptr;
- const byte *rlimit = pargs->source.limit;
- byte ch = (byte)pargs->phase;
- int mode = 1;
-
- /* We use phase to remember the terminator character */
- /* in case we had to restart execution. */
- if ( p >= rlimit )
- return e_NeedData;
- if ( !ch )
- switch ( (ch = *++p) )
- {
- case ';':
- pargs->source.ptr = p;
- pgls->g.label.terminator = 3;
- pgls->g.label.print_terminator = false;
- return 0;
- case 0: case 5: case 27:
- return e_Range;
- default:
- if ( p >= rlimit )
- return e_NeedData;
- if ( *++p ==',' )
- { pargs->source.ptr = p;
- pargs->phase = ch;
- }
- }
- if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
- return e_Range;
- pgls->g.label.terminator = ch;
- pgls->g.label.print_terminator = !mode;
- return 0;
+ const byte *rlimit = pargs->source.limit;
+ byte ch = (byte)pargs->phase;
+ int mode = 1;
+
+ /* We use phase to remember the terminator character */
+ /* in case we had to restart execution. */
+ if ( p >= rlimit )
+ return e_NeedData;
+ if ( !ch )
+ switch ( (ch = *++p) )
+ {
+ case ';':
+ pargs->source.ptr = p;
+ pgls->g.label.terminator = 3;
+ pgls->g.label.print_terminator = false;
+ return 0;
+ case 0: case 5: case 27:
+ return e_Range;
+ default:
+ if ( p >= rlimit )
+ return e_NeedData;
+ if ( *++p ==',' )
+ { pargs->source.ptr = p;
+ pargs->phase = ch;
+ }
+ }
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
+ return e_Range;
+ pgls->g.label.terminator = ch;
+ pgls->g.label.print_terminator = !mode;
+ return 0;
}
/* DV [path[,line]]; */
@@ -323,14 +323,14 @@ hpgl_DT(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_DV(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int path = 0, line = 0;
- hpgl_arg_c_int(pgls->memory, pargs, &path);
- hpgl_arg_c_int(pgls->memory, pargs, &line);
- if ( (path & ~3) | (line & ~1) )
- return e_Range;
- pgls->g.character.text_path = path;
- pgls->g.character.line_feed_direction = (line ? -1 : 1);
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- return 0;
+ hpgl_arg_c_int(pgls->memory, pargs, &path);
+ hpgl_arg_c_int(pgls->memory, pargs, &line);
+ if ( (path & ~3) | (line & ~1) )
+ return e_Range;
+ pgls->g.character.text_path = path;
+ pgls->g.character.line_feed_direction = (line ? -1 : 1);
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ return 0;
}
/* ES [width[,height]]; */
@@ -338,25 +338,25 @@ hpgl_DV(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_ES(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t width = 0, height = 0;
- hpgl_arg_c_real(pgls->memory, pargs, &width);
- hpgl_arg_c_real(pgls->memory, pargs, &height);
- pgls->g.character.extra_space.x = width;
- pgls->g.character.extra_space.y = height;
- return 0;
+ hpgl_arg_c_real(pgls->memory, pargs, &width);
+ hpgl_arg_c_real(pgls->memory, pargs, &height);
+ pgls->g.character.extra_space.x = width;
+ pgls->g.character.extra_space.y = height;
+ return 0;
}
/* FI fontid; */
int
hpgl_FI(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_select_font_by_id(pargs, pgls, 0);
+{
+ return hpgl_select_font_by_id(pargs, pgls, 0);
}
/* FN fontid; */
int
hpgl_FN(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_select_font_by_id(pargs, pgls, 1);
+{
+ return hpgl_select_font_by_id(pargs, pgls, 1);
}
/* The following is an extension documented in the Comparison Guide. */
@@ -364,25 +364,25 @@ hpgl_FN(hpgl_args_t *pargs, hpgl_state_t *pgls)
int
hpgl_LM(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int mode = 0, row_number = 0;
- int old_mode =
- (pgls->g.label.double_byte ? 1 : 0) +
- (pgls->g.label.write_vertical ? 2 : 0);
-
- hpgl_arg_c_int(pgls->memory, pargs, &mode);
- hpgl_arg_c_int(pgls->memory, pargs, &row_number);
- pgls->g.label.row_offset =
- (row_number < 0 ? 0 : row_number > 255 ? 255 : row_number) << 8;
- mode &= 3;
- pgls->g.label.double_byte = (mode & 1) != 0;
- pgls->g.label.write_vertical = (mode & 2) != 0;
- /*
- * The documentation says "When LM switches modes, it turns off
- * symbol mode." We take this literally: LM only turns off
- * symbol mode if the new label mode differs from the old one.
- */
- if ( mode != old_mode )
- pgls->g.symbol_mode = 0;
- return 0;
+ int old_mode =
+ (pgls->g.label.double_byte ? 1 : 0) +
+ (pgls->g.label.write_vertical ? 2 : 0);
+
+ hpgl_arg_c_int(pgls->memory, pargs, &mode);
+ hpgl_arg_c_int(pgls->memory, pargs, &row_number);
+ pgls->g.label.row_offset =
+ (row_number < 0 ? 0 : row_number > 255 ? 255 : row_number) << 8;
+ mode &= 3;
+ pgls->g.label.double_byte = (mode & 1) != 0;
+ pgls->g.label.write_vertical = (mode & 2) != 0;
+ /*
+ * The documentation says "When LM switches modes, it turns off
+ * symbol mode." We take this literally: LM only turns off
+ * symbol mode if the new label mode differs from the old one.
+ */
+ if ( mode != old_mode )
+ pgls->g.symbol_mode = 0;
+ return 0;
}
/* LO [origin]; */
@@ -390,19 +390,19 @@ hpgl_LM(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_LO(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int origin = 1;
- hpgl_arg_c_int(pgls->memory, pargs, &origin);
- if ( origin < 1 || origin == 10 || origin == 20 || origin > 21 )
- return e_Range;
- pgls->g.label.origin = origin;
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- return 0;
+ hpgl_arg_c_int(pgls->memory, pargs, &origin);
+ if ( origin < 1 || origin == 10 || origin == 20 || origin > 21 )
+ return e_Range;
+ pgls->g.label.origin = origin;
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ return 0;
}
/* SA; */
int
hpgl_SA(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_select_font(pgls, 1);
+{
+ return hpgl_select_font(pgls, 1);
}
/* SB [mode]; */
@@ -410,37 +410,37 @@ hpgl_SA(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_SB(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int mode = 0;
- if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
- return e_Range;
- { int i;
-
- pgls->g.bitmap_fonts_allowed = mode;
- /*
- * A different set of fonts is now available for consideration.
- * Decache any affected font(s): those selected by parameter,
- * and bitmap fonts selected by ID if bitmap fonts are now
- * disallowed.
- */
- for ( i = 0; i < countof(pgls->g.font_selection); ++i ) {
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
+ return e_Range;
+ { int i;
+
+ pgls->g.bitmap_fonts_allowed = mode;
+ /*
+ * A different set of fonts is now available for consideration.
+ * Decache any affected font(s): those selected by parameter,
+ * and bitmap fonts selected by ID if bitmap fonts are now
+ * disallowed.
+ */
+ for ( i = 0; i < countof(pgls->g.font_selection); ++i ) {
pcl_font_selection_t *pfs = &pgls->g.font_selection[i];
- if ( ((int)pfs->selected_id < 0) ||
- (!mode && pfs->font != 0 &&
- pfs->font->scaling_technology == plfst_bitmap)
- )
- { pfs->font = 0;
- }
- }
+ if ( ((int)pfs->selected_id < 0) ||
+ (!mode && pfs->font != 0 &&
+ pfs->font->scaling_technology == plfst_bitmap)
+ )
+ { pfs->font = 0;
+ }
+ }
pgls->g.font = 0;
pgls->g.map = 0;
- }
- return 0;
+ }
+ return 0;
}
/* SD [kind,value...]; */
int
hpgl_SD(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_font_definition(pargs, pgls, 0);
+{
+ return hpgl_font_definition(pargs, pgls, 0);
}
/* SI [width,height]; */
@@ -448,39 +448,39 @@ hpgl_SD(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_SI(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t width_cm, height_cm;
- if ( hpgl_arg_c_real(pgls->memory, pargs, &width_cm) )
- { if ( !hpgl_arg_c_real(pgls->memory, pargs, &height_cm) )
- return e_Range;
+ if ( hpgl_arg_c_real(pgls->memory, pargs, &width_cm) )
+ { if ( !hpgl_arg_c_real(pgls->memory, pargs, &height_cm) )
+ return e_Range;
/* this isn't documented but HP seems to ignore the
command (retains previous value) if either parameter is
zero. NB probably should use epsilon have not tested. */
if (width_cm == 0.0 || height_cm == 0.0)
return e_Range;
- pgls->g.character.size.x = mm_2_plu(width_cm * 10);
- pgls->g.character.size.y = mm_2_plu(height_cm * 10);
- pgls->g.character.size_mode = hpgl_size_absolute;
- }
- else
- pgls->g.character.size_mode = hpgl_size_not_set;
- return 0;
+ pgls->g.character.size.x = mm_2_plu(width_cm * 10);
+ pgls->g.character.size.y = mm_2_plu(height_cm * 10);
+ pgls->g.character.size_mode = hpgl_size_absolute;
+ }
+ else
+ pgls->g.character.size_mode = hpgl_size_not_set;
+ return 0;
}
-#define MAX_SL_TANGENT 114.5887
+#define MAX_SL_TANGENT 114.5887
/* SL [slant]; */
int
hpgl_SL(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t slant = 0;
- hpgl_arg_c_real(pgls->memory, pargs, &slant);
- /* clamp to 89.5 degrees of char slant, avoids math issues around
- * tan 90degrees == infinity. Visually close to HP,
- * performance decrease as slant approaches tan(90).
- */
-
- pgls->g.character.slant = slant > MAX_SL_TANGENT ?
- MAX_SL_TANGENT : slant < -MAX_SL_TANGENT ?
- -MAX_SL_TANGENT : slant;
- return 0;
+ hpgl_arg_c_real(pgls->memory, pargs, &slant);
+ /* clamp to 89.5 degrees of char slant, avoids math issues around
+ * tan 90degrees == infinity. Visually close to HP,
+ * performance decrease as slant approaches tan(90).
+ */
+
+ pgls->g.character.slant = slant > MAX_SL_TANGENT ?
+ MAX_SL_TANGENT : slant < -MAX_SL_TANGENT ?
+ -MAX_SL_TANGENT : slant;
+ return 0;
}
#undef MAX_SL_TANGENT
@@ -489,7 +489,7 @@ hpgl_SL(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_SR(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t width_pct, height_pct;
- if ( hpgl_arg_c_real(pgls->memory, pargs, &width_pct) ) {
+ if ( hpgl_arg_c_real(pgls->memory, pargs, &width_pct) ) {
if ( !hpgl_arg_c_real(pgls->memory, pargs, &height_pct) )
return e_Range;
/* this isn't documented but HP seems to ignore the
@@ -497,22 +497,22 @@ hpgl_SR(hpgl_args_t *pargs, hpgl_state_t *pgls)
zero. NB probably should use epsilon have not tested. */
if (width_pct == 0.0 || height_pct == 0.0)
return e_Range;
- pgls->g.character.size.x = width_pct / 100;
- pgls->g.character.size.y = height_pct / 100;
- }
- else
- { pgls->g.character.size.x = 0.0075;
- pgls->g.character.size.y = 0.015;
- }
- pgls->g.character.size_mode = hpgl_size_relative;
- return 0;
+ pgls->g.character.size.x = width_pct / 100;
+ pgls->g.character.size.y = height_pct / 100;
+ }
+ else
+ { pgls->g.character.size.x = 0.0075;
+ pgls->g.character.size.y = 0.015;
+ }
+ pgls->g.character.size_mode = hpgl_size_relative;
+ return 0;
}
/* SS; */
int
hpgl_SS(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return hpgl_select_font(pgls, 0);
+{
+ return hpgl_select_font(pgls, 0);
}
/* TD [mode]; */
@@ -520,10 +520,10 @@ hpgl_SS(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_TD(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int mode = 0;
- if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
- return e_Range;
- pgls->g.transparent_data = mode;
- return 0;
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) && (mode & ~1) )
+ return e_Range;
+ pgls->g.transparent_data = mode;
+ return 0;
}
/* Initialization */
@@ -533,29 +533,29 @@ pgchar_do_registration(
gs_memory_t *mem)
{ /* Register commands */
DEFINE_HPGL_COMMANDS(mem)
- HPGL_COMMAND('A', 'D', hpgl_AD, hpgl_cdf_pcl_rtl_both), /* kind/value pairs */
- HPGL_COMMAND('C', 'F', hpgl_CF, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('D', 'I', hpgl_DI, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('D', 'R', hpgl_DR, hpgl_cdf_pcl_rtl_both),
- /* DT has special argument parsing, so it must handle skipping */
- /* in polygon mode itself. */
- HPGL_COMMAND('D', 'T', hpgl_DT, hpgl_cdf_polygon|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('D', 'V', hpgl_DV, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('E', 'S', hpgl_ES, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('F', 'I', hpgl_FI, hpgl_cdf_pcl),
- HPGL_COMMAND('F', 'N', hpgl_FN, hpgl_cdf_pcl),
- HPGL_COMMAND('L', 'M', hpgl_LM, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('L', 'O', hpgl_LO, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'A', hpgl_SA, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'B', hpgl_SB, hpgl_cdf_pcl),
- HPGL_COMMAND('S', 'D', hpgl_SD, hpgl_cdf_pcl_rtl_both), /* kind/value pairs */
- HPGL_COMMAND('S', 'I', hpgl_SI, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'L', hpgl_SL, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'R', hpgl_SR, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'S', hpgl_SS, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('T', 'D', hpgl_TD, hpgl_cdf_pcl_rtl_both),
- END_HPGL_COMMANDS
- return 0;
+ HPGL_COMMAND('A', 'D', hpgl_AD, hpgl_cdf_pcl_rtl_both), /* kind/value pairs */
+ HPGL_COMMAND('C', 'F', hpgl_CF, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('D', 'I', hpgl_DI, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('D', 'R', hpgl_DR, hpgl_cdf_pcl_rtl_both),
+ /* DT has special argument parsing, so it must handle skipping */
+ /* in polygon mode itself. */
+ HPGL_COMMAND('D', 'T', hpgl_DT, hpgl_cdf_polygon|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('D', 'V', hpgl_DV, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('E', 'S', hpgl_ES, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('F', 'I', hpgl_FI, hpgl_cdf_pcl),
+ HPGL_COMMAND('F', 'N', hpgl_FN, hpgl_cdf_pcl),
+ HPGL_COMMAND('L', 'M', hpgl_LM, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('L', 'O', hpgl_LO, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'A', hpgl_SA, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'B', hpgl_SB, hpgl_cdf_pcl),
+ HPGL_COMMAND('S', 'D', hpgl_SD, hpgl_cdf_pcl_rtl_both), /* kind/value pairs */
+ HPGL_COMMAND('S', 'I', hpgl_SI, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'L', hpgl_SL, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'R', hpgl_SR, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'S', hpgl_SS, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('T', 'D', hpgl_TD, hpgl_cdf_pcl_rtl_both),
+ END_HPGL_COMMANDS
+ return 0;
}
const pcl_init_t pgchar_init = {
pgchar_do_registration, 0
diff --git a/pcl/pgcolor.c b/pcl/pgcolor.c
index 1637b34f6..7dbd58744 100644
--- a/pcl/pgcolor.c
+++ b/pcl/pgcolor.c
@@ -37,7 +37,7 @@ hpgl_PC(
int32 npen = pcl_palette_get_num_entries(pgls->ppalet);
if ( pgls->personality == pcl5e )
- return 0;
+ return 0;
/* output any current path */
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
@@ -46,25 +46,25 @@ hpgl_PC(
hpgl_real_t primary[3];
if ((pen < 0) || (pen >= npen))
- return e_Range;
+ return e_Range;
- if (hpgl_arg_c_real(pgls->memory, pargs, &primary[0])) {
+ if (hpgl_arg_c_real(pgls->memory, pargs, &primary[0])) {
float comps[3];
- if ( !hpgl_arg_c_real(pgls->memory, pargs, &primary[1]) ||
- !hpgl_arg_c_real(pgls->memory, pargs, &primary[2]) )
- return e_Range;
+ if ( !hpgl_arg_c_real(pgls->memory, pargs, &primary[1]) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &primary[2]) )
+ return e_Range;
comps[0] = primary[0];
comps[1] = primary[1];
comps[2] = primary[2];
return pcl_palette_set_color(pgls, pen, comps);
} else
- return pcl_palette_set_default_color(pgls, pen);
+ return pcl_palette_set_default_color(pgls, pen);
} else {
int i;
int code;
- for (i = 0; i < npen; ++i) {
+ for (i = 0; i < npen; ++i) {
if ((code = pcl_palette_set_default_color(pgls, i)) < 0)
return code;
}
@@ -85,13 +85,13 @@ hpgl_NP(
int32 n = 8;
if ( pgls->personality == pcl5e )
- return 0;
+ return 0;
/* output any current path */
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
if ( hpgl_arg_int(pgls->memory, pargs, &n) && ((n < 2) || (n > 32768)) )
- return e_Range;
+ return e_Range;
return pcl_palette_NP(pgls, n);
}
@@ -124,8 +124,6 @@ hpgl_CR(
else /* no args - default references */
return pcl_palette_CR(pgls, 255, 255, 255, 0, 0, 0);
}
-
-
/*
* Initialization. There is no reset or copy command, as those operations are
diff --git a/pcl/pgconfig.c b/pcl/pgconfig.c
index 585df5b2e..6b0103a8d 100644
--- a/pcl/pgconfig.c
+++ b/pcl/pgconfig.c
@@ -34,52 +34,52 @@
int
hpgl_CO(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ const byte *p = pargs->source.ptr;
- const byte *rlimit = pargs->source.limit;
-
- while ( p < rlimit ) {
- if ( !pargs->phase ) {
- switch ( *++p ) {
- case ' ':
- /* Ignore spaces between command and opening ". */
- continue;
- case '"':
- pargs->phase = 1;
- break;
- default:
- /* Search for semicolon */
- pargs->phase = 2;
- break;
-
- }
- } else {
- /* Scanning for closing " or closing ';' */
- switch ( pargs->phase ) {
- case 1:
- if ( *++p == '"' ) {
- pargs->source.ptr = p;
- return 0;
- }
- /* syntax error on some hp devices */
- if ( *p == '\\' ) {
- pargs->source.ptr = p;
- return 0;
- }
- break;
- case 2:
- if ( *++p == ';' ) {
- pargs->source.ptr = p;
- return 0;
- }
- break;
- default:
- dprintf("HPGL CO automata is in an unknown state\n" );
- pargs->source.ptr = p;
- return 0;
- }
- }
- }
- pargs->source.ptr = p;
- return e_NeedData;
+ const byte *rlimit = pargs->source.limit;
+
+ while ( p < rlimit ) {
+ if ( !pargs->phase ) {
+ switch ( *++p ) {
+ case ' ':
+ /* Ignore spaces between command and opening ". */
+ continue;
+ case '"':
+ pargs->phase = 1;
+ break;
+ default:
+ /* Search for semicolon */
+ pargs->phase = 2;
+ break;
+
+ }
+ } else {
+ /* Scanning for closing " or closing ';' */
+ switch ( pargs->phase ) {
+ case 1:
+ if ( *++p == '"' ) {
+ pargs->source.ptr = p;
+ return 0;
+ }
+ /* syntax error on some hp devices */
+ if ( *p == '\\' ) {
+ pargs->source.ptr = p;
+ return 0;
+ }
+ break;
+ case 2:
+ if ( *++p == ';' ) {
+ pargs->source.ptr = p;
+ return 0;
+ }
+ break;
+ default:
+ dprintf("HPGL CO automata is in an unknown state\n" );
+ pargs->source.ptr = p;
+ return 0;
+ }
+ }
+ }
+ pargs->source.ptr = p;
+ return e_NeedData;
}
#ifdef DEBUG
@@ -97,15 +97,15 @@ hpgl_ZZ(hpgl_args_t *pargs, hpgl_state_t *pgls)
const byte *p = pargs->source.ptr;
const byte *rlimit = pargs->source.limit;
while ( p < rlimit ) {
- byte ch = *++p;
- /* ; terminates the command */
- if ( ch == ';' ) {
- pargs->source.ptr = p;
- return 0;
- }
- else {
- gs_debug[(int)ch] = 1;
- }
+ byte ch = *++p;
+ /* ; terminates the command */
+ if ( ch == ';' ) {
+ pargs->source.ptr = p;
+ return 0;
+ }
+ else {
+ gs_debug[(int)ch] = 1;
+ }
}
pargs->source.ptr = p;
return e_NeedData;
@@ -115,33 +115,33 @@ hpgl_ZZ(hpgl_args_t *pargs, hpgl_state_t *pgls)
int
hpgl_reset_overlay(hpgl_state_t *pgls)
{ hpgl_args_t args;
- hpgl_args_setup(&args);
- hpgl_AC(&args, pgls);
- hpgl_args_setup(&args);
- pgls->g.font_selected = 0;
- hpgl_AD(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_SD(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_CF(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_args_add_int(&args, 1);
- hpgl_args_add_int(&args, 0);
- hpgl_DI(&args, pgls);
- /* HAS -- Figure out some way to do this so that it is consistant */
- pgls->g.label.terminator = 3;
- pgls->g.label.print_terminator = false;
- hpgl_args_setup(&args);
- hpgl_DV(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_ES(&args, pgls);
- pgls->g.label.write_vertical = false;
- pgls->g.label.double_byte = false;
- hpgl_args_setup(&args);
- hpgl_LM(&args, pgls);
- hpgl_args_set_int(&args, 1);
- hpgl_LO(&args, pgls);
- /* we do this instead of calling SC directly */
+ hpgl_args_setup(&args);
+ hpgl_AC(&args, pgls);
+ hpgl_args_setup(&args);
+ pgls->g.font_selected = 0;
+ hpgl_AD(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_SD(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_CF(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_args_add_int(&args, 1);
+ hpgl_args_add_int(&args, 0);
+ hpgl_DI(&args, pgls);
+ /* HAS -- Figure out some way to do this so that it is consistant */
+ pgls->g.label.terminator = 3;
+ pgls->g.label.print_terminator = false;
+ hpgl_args_setup(&args);
+ hpgl_DV(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_ES(&args, pgls);
+ pgls->g.label.write_vertical = false;
+ pgls->g.label.double_byte = false;
+ hpgl_args_setup(&args);
+ hpgl_LM(&args, pgls);
+ hpgl_args_set_int(&args, 1);
+ hpgl_LO(&args, pgls);
+ /* we do this instead of calling SC directly */
if ( pgls->g.scaling_type != hpgl_scaling_none ) {
gs_point dpt, pt; /* device point and user point */
hpgl_call(hpgl_get_current_position(pgls, &pt));
@@ -151,33 +151,33 @@ hpgl_reset_overlay(hpgl_state_t *pgls)
hpgl_call(gs_itransform(pgls->pgs, dpt.x, dpt.y, &pt));
hpgl_call(hpgl_set_current_position(pgls, &pt));
}
- pgls->g.fill_type = hpgl_even_odd_rule;
- hpgl_args_set_int(&args,0);
- hpgl_PM(&args, pgls);
- hpgl_args_set_int(&args,2);
- hpgl_PM(&args, pgls);
- pgls->g.bitmap_fonts_allowed = 0;
- hpgl_args_setup(&args);
- hpgl_SI(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_SL(&args, pgls);
- /* We initialize symbol mode directly because hpgl_SM parses
+ pgls->g.fill_type = hpgl_even_odd_rule;
+ hpgl_args_set_int(&args,0);
+ hpgl_PM(&args, pgls);
+ hpgl_args_set_int(&args,2);
+ hpgl_PM(&args, pgls);
+ pgls->g.bitmap_fonts_allowed = 0;
+ hpgl_args_setup(&args);
+ hpgl_SI(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_SL(&args, pgls);
+ /* We initialize symbol mode directly because hpgl_SM parses
its argument differently than most other commands */
- pgls->g.symbol_mode = 0;
- hpgl_args_setup(&args);
- hpgl_SS(&args, pgls);
- hpgl_args_set_int(&args,1);
- hpgl_TR(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_TD(&args, pgls);
- hpgl_args_setup(&args);
- hpgl_MC(&args, pgls);
+ pgls->g.symbol_mode = 0;
+ hpgl_args_setup(&args);
+ hpgl_SS(&args, pgls);
+ hpgl_args_set_int(&args,1);
+ hpgl_TR(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_TD(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_MC(&args, pgls);
#ifdef LJ6_COMPAT
- /* LJ6 seems to reset PP with an IN command the Color Laserjet
+ /* LJ6 seems to reset PP with an IN command the Color Laserjet
does not. NB this needs to be handled with dynamic
configuration */
- hpgl_args_setup(&args);
- hpgl_PP(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_PP(&args, pgls);
#endif
return 0;
}
@@ -185,7 +185,7 @@ hpgl_reset_overlay(hpgl_state_t *pgls)
/* DF; sets programmable features except P1 and P2 */
int
hpgl_DF(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
hpgl_args_t args;
hpgl_call(hpgl_reset_overlay(pgls));
@@ -240,7 +240,7 @@ hpgl_IN_implicit(
hpgl_args_setup(&args);
hpgl_PS(&args, pgls);
}
-
+
/* defaults P1 and P2 */
hpgl_args_setup(&args);
hpgl_IP(&args, pgls);
@@ -249,7 +249,6 @@ hpgl_IN_implicit(
hpgl_args_setup(&args);
hpgl_WU(&args, pgls);
-
/*
* pen up-absolute position and set gl/2 current positon to
* 0,0 or the lower left of the picture frame. Simply sets
@@ -273,7 +272,7 @@ hpgl_IN(
hpgl_args_t * pargs,
hpgl_state_t * pgls
)
-{
+{
int code = 0;
hpgl_args_t args;
@@ -304,36 +303,36 @@ hpgl_IN(
static int
hpgl_picture_frame_coords(hpgl_state_t *pgls, gs_int_rect *gl2_win)
{
- gs_rect dev_win; /* device window */
- hpgl_real_t x1 = pgls->g.picture_frame.anchor_point.x;
- hpgl_real_t y1 = pgls->g.picture_frame.anchor_point.y;
- hpgl_real_t x2 = x1 + pgls->g.picture_frame_width;
- hpgl_real_t y2 = y1 + pgls->g.picture_frame_height;
-
- pcl_set_ctm(pgls, false);
- hpgl_call(gs_transform(pgls->pgs, x1, y1, &dev_win.p));
- hpgl_call(gs_transform(pgls->pgs, x2, y2, &dev_win.q));
- hpgl_call(hpgl_set_plu_ctm(pgls));
- /*
- * gs_bbox_transform_inverse puts the resulting points in the
- * correct order, with p < q.
- */
- { gs_matrix mat;
- gs_rect pcl_win; /* pcl window */
-
- gs_currentmatrix(pgls->pgs, &mat);
- hpgl_call(gs_bbox_transform_inverse(&dev_win, &mat, &pcl_win));
+ gs_rect dev_win; /* device window */
+ hpgl_real_t x1 = pgls->g.picture_frame.anchor_point.x;
+ hpgl_real_t y1 = pgls->g.picture_frame.anchor_point.y;
+ hpgl_real_t x2 = x1 + pgls->g.picture_frame_width;
+ hpgl_real_t y2 = y1 + pgls->g.picture_frame_height;
+
+ pcl_set_ctm(pgls, false);
+ hpgl_call(gs_transform(pgls->pgs, x1, y1, &dev_win.p));
+ hpgl_call(gs_transform(pgls->pgs, x2, y2, &dev_win.q));
+ hpgl_call(hpgl_set_plu_ctm(pgls));
+ /*
+ * gs_bbox_transform_inverse puts the resulting points in the
+ * correct order, with p < q.
+ */
+ { gs_matrix mat;
+ gs_rect pcl_win; /* pcl window */
+
+ gs_currentmatrix(pgls->pgs, &mat);
+ hpgl_call(gs_bbox_transform_inverse(&dev_win, &mat, &pcl_win));
/* Round all coordinates to the nearest integer. */
#define set_round(e) gl2_win->e = (int)floor(pcl_win.e + 0.5)
- set_round(p.x);
- set_round(p.y);
- set_round(q.x);
- set_round(q.y);
+ set_round(p.x);
+ set_round(p.y);
+ set_round(q.x);
+ set_round(q.y);
#undef set_round
- }
- /* restore the ctm */
- hpgl_call(hpgl_set_ctm(pgls));
- return 0;
+ }
+ /* restore the ctm */
+ hpgl_call(hpgl_set_ctm(pgls));
+ return 0;
}
/* IP p1x,p1y[,p2x,p2y]; */
@@ -341,44 +340,44 @@ hpgl_picture_frame_coords(hpgl_state_t *pgls, gs_int_rect *gl2_win)
int
hpgl_IP(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int32 ptxy[4];
- int i;
- gs_int_rect win;
-
- /* draw the current path */
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- /* get the default picture frame coordinates */
- hpgl_call(hpgl_picture_frame_coords(pgls, &win));
-
- /* round the picture frame coordinates */
- ptxy[0] = win.p.x; ptxy[1] = win.p.y;
- ptxy[2] = win.q.x; ptxy[3] = win.q.y;
- for ( i = 0; i < 4 && hpgl_arg_int(pgls->memory, pargs, &ptxy[i]); ++i )
- ;
- if ( i & 1 )
- return e_Range;
-
- if ( i == 2 )
- {
- pgls->g.P2.x = (ptxy[0] - pgls->g.P1.x) +
- pgls->g.P2.x;
- pgls->g.P2.y = (ptxy[1] - pgls->g.P1.y) +
- pgls->g.P2.y;
- pgls->g.P1.x = ptxy[0];
- pgls->g.P1.y = ptxy[1];
- }
- else
- {
- pgls->g.P1.x = ptxy[0];
- pgls->g.P1.y = ptxy[1];
- pgls->g.P2.x = ptxy[2];
- pgls->g.P2.y = ptxy[3];
- }
-
- /* if either coordinate is equal it is incremented by 1 */
- if ( pgls->g.P1.x == pgls->g.P2.x ) pgls->g.P2.x++;
- if ( pgls->g.P1.y == pgls->g.P2.y ) pgls->g.P2.y++;
-
- return 0;
+ int i;
+ gs_int_rect win;
+
+ /* draw the current path */
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ /* get the default picture frame coordinates */
+ hpgl_call(hpgl_picture_frame_coords(pgls, &win));
+
+ /* round the picture frame coordinates */
+ ptxy[0] = win.p.x; ptxy[1] = win.p.y;
+ ptxy[2] = win.q.x; ptxy[3] = win.q.y;
+ for ( i = 0; i < 4 && hpgl_arg_int(pgls->memory, pargs, &ptxy[i]); ++i )
+ ;
+ if ( i & 1 )
+ return e_Range;
+
+ if ( i == 2 )
+ {
+ pgls->g.P2.x = (ptxy[0] - pgls->g.P1.x) +
+ pgls->g.P2.x;
+ pgls->g.P2.y = (ptxy[1] - pgls->g.P1.y) +
+ pgls->g.P2.y;
+ pgls->g.P1.x = ptxy[0];
+ pgls->g.P1.y = ptxy[1];
+ }
+ else
+ {
+ pgls->g.P1.x = ptxy[0];
+ pgls->g.P1.y = ptxy[1];
+ pgls->g.P2.x = ptxy[2];
+ pgls->g.P2.y = ptxy[3];
+ }
+
+ /* if either coordinate is equal it is incremented by 1 */
+ if ( pgls->g.P1.x == pgls->g.P2.x ) pgls->g.P2.x++;
+ if ( pgls->g.P1.y == pgls->g.P2.y ) pgls->g.P2.y++;
+
+ return 0;
}
/* IR r1x,r1y[,r2x,r2y]; */
@@ -386,18 +385,18 @@ hpgl_IP(hpgl_args_t *pargs, hpgl_state_t *pgls)
int
hpgl_IR(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t rptxy[4];
- int i;
- hpgl_args_t args;
- gs_int_rect win;
-
- for ( i = 0; i < 4 && hpgl_arg_c_real(pgls->memory, pargs, &rptxy[i]); ++i )
- ;
- if ( i & 1 )
- return e_Range;
-
- /* get the PCL picture frame coordinates */
- hpgl_call(hpgl_picture_frame_coords(pgls, &win));
- hpgl_args_setup(&args);
+ int i;
+ hpgl_args_t args;
+ gs_int_rect win;
+
+ for ( i = 0; i < 4 && hpgl_arg_c_real(pgls->memory, pargs, &rptxy[i]); ++i )
+ ;
+ if ( i & 1 )
+ return e_Range;
+
+ /* get the PCL picture frame coordinates */
+ hpgl_call(hpgl_picture_frame_coords(pgls, &win));
+ hpgl_args_setup(&args);
if ( i != 0 )
{
hpgl_args_add_int(&args, win.p.x + (win.q.x - win.p.x) *
@@ -405,16 +404,16 @@ hpgl_IR(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_args_add_int(&args, win.p.y + (win.q.y - win.p.y) *
rptxy[1] / 100.0);
}
- if ( i == 4 )
- {
- hpgl_args_add_int(&args, win.p.x + (win.q.x - win.p.x) *
- rptxy[2] / 100.0);
-
- hpgl_args_add_int(&args, win.p.y + (win.q.y - win.p.y) *
- rptxy[3] / 100.0);
- }
- hpgl_IP( &args, pgls );
- return 0;
+ if ( i == 4 )
+ {
+ hpgl_args_add_int(&args, win.p.x + (win.q.x - win.p.x) *
+ rptxy[2] / 100.0);
+
+ hpgl_args_add_int(&args, win.p.y + (win.q.y - win.p.y) *
+ rptxy[3] / 100.0);
+ }
+ hpgl_IP( &args, pgls );
+ return 0;
}
/* IW llx,lly,urx,ury; */
@@ -422,46 +421,46 @@ hpgl_IR(hpgl_args_t *pargs, hpgl_state_t *pgls)
int
hpgl_IW(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t wxy[4];
- int i;
- gs_int_rect win;
-
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- /* get the default picture frame coordinates. */
- hpgl_call(hpgl_picture_frame_coords(pgls, &win));
- wxy[0] = win.p.x;
- wxy[1] = win.p.y;
- wxy[2] = win.q.x;
- wxy[3] = win.q.y;
- for ( i = 0; i < 4 && hpgl_arg_units(pgls->memory, pargs, &wxy[i]); ++i )
- ;
- if ( i & 3 )
- return e_Range;
-
- /* no args case disables the soft clip window */
- if ( i == 0 ) {
- pgls->g.soft_clip_window.active = false;
+ int i;
+ gs_int_rect win;
+
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ /* get the default picture frame coordinates. */
+ hpgl_call(hpgl_picture_frame_coords(pgls, &win));
+ wxy[0] = win.p.x;
+ wxy[1] = win.p.y;
+ wxy[2] = win.q.x;
+ wxy[3] = win.q.y;
+ for ( i = 0; i < 4 && hpgl_arg_units(pgls->memory, pargs, &wxy[i]); ++i )
+ ;
+ if ( i & 3 )
+ return e_Range;
+
+ /* no args case disables the soft clip window */
+ if ( i == 0 ) {
+ pgls->g.soft_clip_window.active = false;
pgls->g.soft_clip_window.isbound = false;
- return 0;
- }
- /* HAS needs error checking */
- pgls->g.soft_clip_window.rect.p.x = wxy[0];
- pgls->g.soft_clip_window.rect.p.y = wxy[1];
- pgls->g.soft_clip_window.rect.q.x = wxy[2];
- pgls->g.soft_clip_window.rect.q.y = wxy[3];
- pgls->g.soft_clip_window.active = true;
- return 0;
+ return 0;
+ }
+ /* HAS needs error checking */
+ pgls->g.soft_clip_window.rect.p.x = wxy[0];
+ pgls->g.soft_clip_window.rect.p.y = wxy[1];
+ pgls->g.soft_clip_window.rect.q.x = wxy[2];
+ pgls->g.soft_clip_window.rect.q.y = wxy[3];
+ pgls->g.soft_clip_window.active = true;
+ return 0;
}
/* PG; */
int
hpgl_PG(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
if ( pgls->personality == rtl ) {
- int dummy;
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- /* with parameter always feed, without parameter feed if marked */
- if ( pcl_page_marked(pgls) || hpgl_arg_c_int(pgls->memory, pargs, &dummy) )
- hpgl_call(pcl_do_FF(pgls));
+ int dummy;
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ /* with parameter always feed, without parameter feed if marked */
+ if ( pcl_page_marked(pgls) || hpgl_arg_c_int(pgls->memory, pargs, &dummy) )
+ hpgl_call(pcl_do_FF(pgls));
}
return 0;
}
@@ -483,12 +482,12 @@ hpgl_PS(hpgl_args_t *pargs, hpgl_state_t *pgls)
int i;
if ( pgls->personality != rtl )
- return 0;
+ return 0;
/* PS return an error if the page is dirty */
if ( pcl_page_marked(pgls) )
return e_Range;
-
+
/* check for pjl override of the arguments - this is custom code
for a customer and is not the normal interaction between PCL &
PJL */
@@ -505,7 +504,7 @@ hpgl_PS(hpgl_args_t *pargs, hpgl_state_t *pgls)
}
paper.height = plu_2_coord(page_dims[0]);
paper.width = plu_2_coord(page_dims[1]);
- paper.offset_portrait = 0;
+ paper.offset_portrait = 0;
paper.offset_landscape = 0;
new_logical_page(pgls, 0, &paper, false, false);
return 0;
@@ -515,42 +514,42 @@ hpgl_PS(hpgl_args_t *pargs, hpgl_state_t *pgls)
/* RO; */
int
hpgl_RO(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- int angle=0;
- gs_point point, dev_pt;
+{
+ int angle=0;
+ gs_point point, dev_pt;
- /* this business is used by both SC and RO -- perhaps it needs
+ /* this business is used by both SC and RO -- perhaps it needs
a new home */
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(hpgl_get_current_position(pgls, &point));
- hpgl_call(gs_transform(pgls->pgs, point.x, point.y, &dev_pt));
-
- if ( hpgl_arg_c_int(pgls->memory, pargs, &angle) )
- switch ( angle )
- {
- case 0: case 90: case 180: case 270:
- break;
- default:
- return e_Range;
- }
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(hpgl_get_current_position(pgls, &point));
+ hpgl_call(gs_transform(pgls->pgs, point.x, point.y, &dev_pt));
+
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &angle) )
+ switch ( angle )
+ {
+ case 0: case 90: case 180: case 270:
+ break;
+ default:
+ return e_Range;
+ }
if ( angle != pgls->g.rotation )
- {
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- pgls->g.rotation = angle;
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &point));
- hpgl_call(hpgl_set_current_position(pgls, &point));
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- }
- return 0;
+ {
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ pgls->g.rotation = angle;
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &point));
+ hpgl_call(hpgl_set_current_position(pgls, &point));
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ }
+ return 0;
}
/* RP; */
int
hpgl_RP(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- return e_Unimplemented;
+{
+ return e_Unimplemented;
}
/* SC xmin,xmax,ymin,ymax[,type=0]; */
@@ -560,21 +559,21 @@ hpgl_RP(hpgl_args_t *pargs, hpgl_state_t *pgls)
int
hpgl_SC(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t xy[4];
- int i;
- int type;
- hpgl_scaling_params_t scale_params;
- gs_point point, dev_pt, dev_anchor;
-
- scale_params = pgls->g.scaling_params;
- hpgl_call(hpgl_get_current_position(pgls, &point));
- hpgl_call(gs_transform(pgls->pgs, point.x, point.y, &dev_pt));
- hpgl_call(gs_transform(pgls->pgs, pgls->g.anchor_corner.x,
- pgls->g.anchor_corner.y, &dev_anchor));
- for ( i = 0; i < 4 && hpgl_arg_real(pgls->memory, pargs, &xy[i]); ++i )
- ;
- switch ( i )
- {
- case 0: /* set defaults */
+ int i;
+ int type;
+ hpgl_scaling_params_t scale_params;
+ gs_point point, dev_pt, dev_anchor;
+
+ scale_params = pgls->g.scaling_params;
+ hpgl_call(hpgl_get_current_position(pgls, &point));
+ hpgl_call(gs_transform(pgls->pgs, point.x, point.y, &dev_pt));
+ hpgl_call(gs_transform(pgls->pgs, pgls->g.anchor_corner.x,
+ pgls->g.anchor_corner.y, &dev_anchor));
+ for ( i = 0; i < 4 && hpgl_arg_real(pgls->memory, pargs, &xy[i]); ++i )
+ ;
+ switch ( i )
+ {
+ case 0: /* set defaults */
{
/* a naked SC implies the soft clip window is bound
to plotter units. */
@@ -588,108 +587,107 @@ hpgl_SC(hpgl_args_t *pargs, hpgl_state_t *pgls)
pgls->g.soft_clip_window.isbound = true;
break;
}
- default:
- return e_Range;
- case 4:
- type = hpgl_scaling_anisotropic;
- hpgl_arg_c_int(pgls->memory, pargs, &type);
- switch ( type )
- {
- case hpgl_scaling_anisotropic: /* 0 */
- if ( xy[0] == xy[1] || xy[2] == xy[3] )
- return e_Range;
+ default:
+ return e_Range;
+ case 4:
+ type = hpgl_scaling_anisotropic;
+ hpgl_arg_c_int(pgls->memory, pargs, &type);
+ switch ( type )
+ {
+ case hpgl_scaling_anisotropic: /* 0 */
+ if ( xy[0] == xy[1] || xy[2] == xy[3] )
+ return e_Range;
pxy: scale_params.pmin.x = xy[0];
- scale_params.pmax.x = xy[1];
- scale_params.pmin.y = xy[2];
- scale_params.pmax.y = xy[3];
- break;
- case hpgl_scaling_isotropic: /* 1 */
- if ( xy[0] == xy[1] || xy[2] == xy[3] )
- return e_Range;
- { hpgl_real_t left = 50, bottom = 50;
- if ( (hpgl_arg_c_real(pgls->memory, pargs, &left) &&
- (left < 0 || left > 100 ||
- !hpgl_arg_c_real(pgls->memory, pargs, &bottom) ||
- bottom < 0 || bottom > 100))
- )
- return e_Range;
- scale_params.left = left;
- scale_params.bottom = bottom;
- }
- goto pxy;
- case hpgl_scaling_point_factor: /* 2 */
- if ( xy[1] == 0 || xy[3] == 0 )
- return e_Range;
- scale_params.pmin.x = xy[0];
- scale_params.factor.x = xy[1];
- scale_params.pmin.y = xy[2];
- scale_params.factor.y = xy[3];
- break;
- default:
- return e_Range;
- }
- }
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- pgls->g.scaling_params = scale_params;
- pgls->g.scaling_type = type;
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &point));
- hpgl_call(hpgl_set_current_position(pgls, &point));
- hpgl_call(gs_itransform(pgls->pgs, dev_anchor.x, dev_anchor.y,
- &pgls->g.anchor_corner));
-
- /* PCLTRM 23-7 (commands the update cr position) does not list
+ scale_params.pmax.x = xy[1];
+ scale_params.pmin.y = xy[2];
+ scale_params.pmax.y = xy[3];
+ break;
+ case hpgl_scaling_isotropic: /* 1 */
+ if ( xy[0] == xy[1] || xy[2] == xy[3] )
+ return e_Range;
+ { hpgl_real_t left = 50, bottom = 50;
+ if ( (hpgl_arg_c_real(pgls->memory, pargs, &left) &&
+ (left < 0 || left > 100 ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &bottom) ||
+ bottom < 0 || bottom > 100))
+ )
+ return e_Range;
+ scale_params.left = left;
+ scale_params.bottom = bottom;
+ }
+ goto pxy;
+ case hpgl_scaling_point_factor: /* 2 */
+ if ( xy[1] == 0 || xy[3] == 0 )
+ return e_Range;
+ scale_params.pmin.x = xy[0];
+ scale_params.factor.x = xy[1];
+ scale_params.pmin.y = xy[2];
+ scale_params.factor.y = xy[3];
+ break;
+ default:
+ return e_Range;
+ }
+ }
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ pgls->g.scaling_params = scale_params;
+ pgls->g.scaling_type = type;
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &point));
+ hpgl_call(hpgl_set_current_position(pgls, &point));
+ hpgl_call(gs_itransform(pgls->pgs, dev_anchor.x, dev_anchor.y,
+ &pgls->g.anchor_corner));
+
+ /* PCLTRM 23-7 (commands the update cr position) does not list
SC but PCL updates the position */
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- return 0;
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ return 0;
}
-/* BP - Begin Plot
+/* BP - Begin Plot
*/
static int
hpgl_BP(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
hpgl_args_t args;
int32 command = 0;
int32 value = 0;
bool more = true;
-
while (more) {
more = hpgl_arg_int(pgls->memory, pargs, &command);
- if (!more)
- break;
- if (command == 1) {
- /* parse string */
- const byte *p = pargs->source.ptr;
- const byte *rlimit = pargs->source.limit;
- while ( p < rlimit ) {
- switch ( *++p ) {
- case ' ':
- /* Ignore spaces between command and opening ". */
- continue;
- case '"':
- if ( !pargs->phase ) {
- /* begin string */
- pargs->phase = 1;
- continue;
- }
- else /* end string */
- break;
- default:
- if ( !pargs->phase )
- break; /* ill formed command exit */
- else
- continue; /* character inside of string */
- }
- break; /* error or trailing " exits */
- }
- pargs->source.ptr = p;
- }
- else {
- more = hpgl_arg_int(pgls->memory, pargs, &value);
- /* BP command value pair is currently ignored */
- }
+ if (!more)
+ break;
+ if (command == 1) {
+ /* parse string */
+ const byte *p = pargs->source.ptr;
+ const byte *rlimit = pargs->source.limit;
+ while ( p < rlimit ) {
+ switch ( *++p ) {
+ case ' ':
+ /* Ignore spaces between command and opening ". */
+ continue;
+ case '"':
+ if ( !pargs->phase ) {
+ /* begin string */
+ pargs->phase = 1;
+ continue;
+ }
+ else /* end string */
+ break;
+ default:
+ if ( !pargs->phase )
+ break; /* ill formed command exit */
+ else
+ continue; /* character inside of string */
+ }
+ break; /* error or trailing " exits */
+ }
+ pargs->source.ptr = p;
+ }
+ else {
+ more = hpgl_arg_int(pgls->memory, pargs, &value);
+ /* BP command value pair is currently ignored */
+ }
}
hpgl_args_setup(&args);
@@ -705,26 +703,26 @@ pgconfig_do_registration(
)
{ /* Register commands */
DEFINE_HPGL_COMMANDS(mem)
- /* CO has special argument parsing, so it must handle skipping */
- /* in polygon mode itself. */
- HPGL_COMMAND('C', 'O', hpgl_CO, hpgl_cdf_polygon | hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('D', 'F', hpgl_DF, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('I', 'N', hpgl_IN, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('I', 'P', hpgl_IP, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('I', 'R', hpgl_IR, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('I', 'W', hpgl_IW, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('P', 'G', hpgl_PG, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('P', 'S', hpgl_PS, hpgl_cdf_rtl),
- HPGL_COMMAND('E','C', hpgl_EC, hpgl_cdf_rtl),
- HPGL_COMMAND('R', 'O', hpgl_RO, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('R', 'P', hpgl_RP, hpgl_cdf_rtl),
- HPGL_COMMAND('S', 'C', hpgl_SC, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('B', 'P', hpgl_BP, hpgl_cdf_pcl_rtl_both),
+ /* CO has special argument parsing, so it must handle skipping */
+ /* in polygon mode itself. */
+ HPGL_COMMAND('C', 'O', hpgl_CO, hpgl_cdf_polygon | hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('D', 'F', hpgl_DF, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('I', 'N', hpgl_IN, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('I', 'P', hpgl_IP, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('I', 'R', hpgl_IR, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('I', 'W', hpgl_IW, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('P', 'G', hpgl_PG, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('P', 'S', hpgl_PS, hpgl_cdf_rtl),
+ HPGL_COMMAND('E','C', hpgl_EC, hpgl_cdf_rtl),
+ HPGL_COMMAND('R', 'O', hpgl_RO, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('R', 'P', hpgl_RP, hpgl_cdf_rtl),
+ HPGL_COMMAND('S', 'C', hpgl_SC, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('B', 'P', hpgl_BP, hpgl_cdf_pcl_rtl_both),
#ifdef DEBUG
- HPGL_COMMAND('Z', 'Z', hpgl_ZZ, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('Z', 'Z', hpgl_ZZ, hpgl_cdf_pcl_rtl_both),
#endif
- END_HPGL_COMMANDS
- return 0;
+ END_HPGL_COMMANDS
+ return 0;
}
const pcl_init_t pgconfig_init = {
pgconfig_do_registration, 0
diff --git a/pcl/pgdraw.c b/pcl/pgdraw.c
index fd0ea134f..a45f74d8f 100644
--- a/pcl/pgdraw.c
+++ b/pcl/pgdraw.c
@@ -13,7 +13,7 @@
/* pgdraw.c - HP-GL/2 line drawing/path building routines. */
-#include "stdio_.h"
+#include "stdio_.h"
#include "math_.h"
#include "gdebug.h"
#include "gstypes.h" /* for gsstate.h */
@@ -35,8 +35,6 @@
#include "pcpatrn.h"
#include "pcpage.h"
-
-
/* hack to quiet compiler warnings */
#ifndef abs
extern int abs( int );
@@ -44,7 +42,6 @@ extern int abs( int );
#define round(x) (((x) < 0.0) ? (ceil ((x) - 0.5)) : (floor ((x) + 0.5)))
-
static inline gs_point
hpgl_picture_frame_scale(hpgl_state_t *pgls)
{
@@ -53,29 +50,29 @@ hpgl_picture_frame_scale(hpgl_state_t *pgls)
/* this should not happen in a real system */
if ( (pgls->g.picture_frame_height == 0) ||
- (pgls->g.picture_frame_width == 0) ||
- (pgls->g.plot_width == 0) ||
- (pgls->g.plot_height == 0) ) {
- dprintf("bad picture frame coordinates\n");
+ (pgls->g.picture_frame_width == 0) ||
+ (pgls->g.plot_width == 0) ||
+ (pgls->g.plot_height == 0) ) {
+ dprintf("bad picture frame coordinates\n");
} else {
scale.x = (pgls->g.plot_size_horizontal_specified) ?
- ((hpgl_real_t)pgls->g.picture_frame_width /
- (hpgl_real_t)pgls->g.plot_width) :
- 1.0;
+ ((hpgl_real_t)pgls->g.picture_frame_width /
+ (hpgl_real_t)pgls->g.plot_width) :
+ 1.0;
scale.y = (pgls->g.plot_size_vertical_specified) ?
- ((hpgl_real_t)pgls->g.picture_frame_height /
- (hpgl_real_t)pgls->g.plot_height) :
- 1.0;
+ ((hpgl_real_t)pgls->g.picture_frame_height /
+ (hpgl_real_t)pgls->g.plot_height) :
+ 1.0;
}
return scale;
}
-
+
static int
hpgl_set_picture_frame_scaling(hpgl_state_t *pgls)
{
if ( pgls->g.scaling_type != hpgl_scaling_point_factor ) {
gs_point scale = hpgl_picture_frame_scale(pgls);
- hpgl_call(gs_scale(pgls->pgs, scale.x, scale.y));
+ hpgl_call(gs_scale(pgls->pgs, scale.x, scale.y));
}
return 0;
}
@@ -91,72 +88,72 @@ hpgl_width_scale(hpgl_state_t *pgls)
int
hpgl_set_pcl_to_plu_ctm(hpgl_state_t *pgls)
{
- hpgl_real_t swap_temp;
- hpgl_real_t fw_plu = (coord_2_plu(pgls->g.picture_frame_width));
- hpgl_real_t fh_plu = (coord_2_plu(pgls->g.picture_frame_height));
+ hpgl_real_t swap_temp;
+ hpgl_real_t fw_plu = (coord_2_plu(pgls->g.picture_frame_width));
+ hpgl_real_t fh_plu = (coord_2_plu(pgls->g.picture_frame_height));
- hpgl_call(pcl_set_ctm(pgls, false));
- if ( pgls->personality == rtl ) {
- /* If plot length >= width, y increases across the short
+ hpgl_call(pcl_set_ctm(pgls, false));
+ if ( pgls->personality == rtl ) {
+ /* If plot length >= width, y increases across the short
edge and x increases down the plot. Rotate the pcl
coordinate system -90, scale and flip the x axis. Else
for plot width > length the origin is in the upper
right and x increases going to the left and y increases
going down, translate the pcl coordinate system by the
- picture frame width, scale and flip x.
- PLOTSIZEROTATE==OFF forces -90 rotation, top/left 0,0
- not legal pcl default is ON */
- if ( pgls->g.picture_frame_height >= pgls->g.picture_frame_width ||
- !pjl_proc_compare(pgls->pjls,
- pjl_proc_get_envvar(pgls->pjls, "plotsizerotate"), "on")) {
- hpgl_call(gs_rotate(pgls->pgs, -90));
- /* swap picture frame height and width
- * for the translation portion of the next RO cmd rotation.
- */
- swap_temp = fw_plu;
- fw_plu = fh_plu;
- fh_plu = swap_temp;
- }
- else
- hpgl_call(gs_translate(pgls->pgs, pgls->g.picture_frame_width, 0));
- hpgl_call(gs_scale(pgls->pgs, -(7200.0/1016.0), (7200.0/1016.0)));
- } else {
- hpgl_call(gs_translate(pgls->pgs,
- pgls->g.picture_frame.anchor_point.x,
- pgls->g.picture_frame.anchor_point.y));
- /* move the origin */
- hpgl_call(gs_translate(pgls->pgs, 0, pgls->g.picture_frame_height));
- /* scale to plotter units and a flip for y */
- hpgl_call(gs_scale(pgls->pgs, (7200.0/1016.0), -(7200.0/1016.0)));
- /* account for rotated coordinate system */
- }
- hpgl_call(gs_rotate(pgls->pgs, pgls->g.rotation));
- {
- switch (pgls->g.rotation)
- {
- case 0 :
- hpgl_call(gs_translate(pgls->pgs, 0, 0));
- break;
- case 90 :
- hpgl_call(gs_translate(pgls->pgs, 0, -fw_plu));
- break;
- case 180 :
- hpgl_call(gs_translate(pgls->pgs, -fw_plu, -fh_plu));
- break;
- case 270 :
- hpgl_call(gs_translate(pgls->pgs, -fh_plu, 0));
- break;
- }
- }
- hpgl_call(hpgl_set_picture_frame_scaling(pgls));
- {
- gs_matrix mat;
- gs_currentmatrix(pgls->pgs, &mat);
- mat.ty = floor(mat.ty); mat.tx = floor(mat.tx);
- gs_setmatrix(pgls->pgs, &mat);
- }
- hpgl_call(gs_setdotorientation(pgls->pgs));
- return 0;
+ picture frame width, scale and flip x.
+ PLOTSIZEROTATE==OFF forces -90 rotation, top/left 0,0
+ not legal pcl default is ON */
+ if ( pgls->g.picture_frame_height >= pgls->g.picture_frame_width ||
+ !pjl_proc_compare(pgls->pjls,
+ pjl_proc_get_envvar(pgls->pjls, "plotsizerotate"), "on")) {
+ hpgl_call(gs_rotate(pgls->pgs, -90));
+ /* swap picture frame height and width
+ * for the translation portion of the next RO cmd rotation.
+ */
+ swap_temp = fw_plu;
+ fw_plu = fh_plu;
+ fh_plu = swap_temp;
+ }
+ else
+ hpgl_call(gs_translate(pgls->pgs, pgls->g.picture_frame_width, 0));
+ hpgl_call(gs_scale(pgls->pgs, -(7200.0/1016.0), (7200.0/1016.0)));
+ } else {
+ hpgl_call(gs_translate(pgls->pgs,
+ pgls->g.picture_frame.anchor_point.x,
+ pgls->g.picture_frame.anchor_point.y));
+ /* move the origin */
+ hpgl_call(gs_translate(pgls->pgs, 0, pgls->g.picture_frame_height));
+ /* scale to plotter units and a flip for y */
+ hpgl_call(gs_scale(pgls->pgs, (7200.0/1016.0), -(7200.0/1016.0)));
+ /* account for rotated coordinate system */
+ }
+ hpgl_call(gs_rotate(pgls->pgs, pgls->g.rotation));
+ {
+ switch (pgls->g.rotation)
+ {
+ case 0 :
+ hpgl_call(gs_translate(pgls->pgs, 0, 0));
+ break;
+ case 90 :
+ hpgl_call(gs_translate(pgls->pgs, 0, -fw_plu));
+ break;
+ case 180 :
+ hpgl_call(gs_translate(pgls->pgs, -fw_plu, -fh_plu));
+ break;
+ case 270 :
+ hpgl_call(gs_translate(pgls->pgs, -fh_plu, 0));
+ break;
+ }
+ }
+ hpgl_call(hpgl_set_picture_frame_scaling(pgls));
+ {
+ gs_matrix mat;
+ gs_currentmatrix(pgls->pgs, &mat);
+ mat.ty = floor(mat.ty); mat.tx = floor(mat.tx);
+ gs_setmatrix(pgls->pgs, &mat);
+ }
+ hpgl_call(gs_setdotorientation(pgls->pgs));
+ return 0;
}
/* Set the CTM to map PLU to device units, regardless of scaling. */
@@ -164,62 +161,62 @@ hpgl_set_pcl_to_plu_ctm(hpgl_state_t *pgls)
int
hpgl_set_plu_ctm(hpgl_state_t *pgls)
{
- hpgl_call(hpgl_set_pcl_to_plu_ctm(pgls));
- return 0;
+ hpgl_call(hpgl_set_pcl_to_plu_ctm(pgls));
+ return 0;
}
int
hpgl_compute_user_units_to_plu_ctm(const hpgl_state_t *pgls, gs_matrix *pmat)
{ floatp origin_x = pgls->g.P1.x, origin_y = pgls->g.P1.y;
- switch ( pgls->g.scaling_type )
- {
- case hpgl_scaling_none:
- gs_make_identity(pmat);
- break;
- case hpgl_scaling_point_factor:
- hpgl_call(gs_make_translation(origin_x, origin_y, pmat));
- hpgl_call(gs_matrix_scale(pmat, pgls->g.scaling_params.factor.x,
- pgls->g.scaling_params.factor.y, pmat));
- hpgl_call(gs_matrix_translate(pmat,
- -pgls->g.scaling_params.pmin.x,
- -pgls->g.scaling_params.pmin.y, pmat));
- break;
- default:
- /*case hpgl_scaling_anisotropic:*/
- /*case hpgl_scaling_isotropic:*/
- {
- floatp window_x = pgls->g.P2.x - origin_x,
- range_x = pgls->g.scaling_params.pmax.x -
- pgls->g.scaling_params.pmin.x,
- scale_x = window_x / range_x;
- floatp window_y = pgls->g.P2.y - origin_y,
- range_y = pgls->g.scaling_params.pmax.y -
- pgls->g.scaling_params.pmin.y,
- scale_y = window_y / range_y;
+ switch ( pgls->g.scaling_type )
+ {
+ case hpgl_scaling_none:
+ gs_make_identity(pmat);
+ break;
+ case hpgl_scaling_point_factor:
+ hpgl_call(gs_make_translation(origin_x, origin_y, pmat));
+ hpgl_call(gs_matrix_scale(pmat, pgls->g.scaling_params.factor.x,
+ pgls->g.scaling_params.factor.y, pmat));
+ hpgl_call(gs_matrix_translate(pmat,
+ -pgls->g.scaling_params.pmin.x,
+ -pgls->g.scaling_params.pmin.y, pmat));
+ break;
+ default:
+ /*case hpgl_scaling_anisotropic:*/
+ /*case hpgl_scaling_isotropic:*/
+ {
+ floatp window_x = pgls->g.P2.x - origin_x,
+ range_x = pgls->g.scaling_params.pmax.x -
+ pgls->g.scaling_params.pmin.x,
+ scale_x = window_x / range_x;
+ floatp window_y = pgls->g.P2.y - origin_y,
+ range_y = pgls->g.scaling_params.pmax.y -
+ pgls->g.scaling_params.pmin.y,
+ scale_y = window_y / range_y;
#define SIGN(x) ((x) < 0 ? -1.0 : 1.0)
-
- if ( pgls->g.scaling_type == hpgl_scaling_isotropic ) {
- if ( fabs(scale_x) > fabs(scale_y) ) { /* Reduce the X scaling. */
- origin_x += SIGN(scale_x) * (range_x * (fabs(scale_x) - fabs(scale_y)) *
+
+ if ( pgls->g.scaling_type == hpgl_scaling_isotropic ) {
+ if ( fabs(scale_x) > fabs(scale_y) ) { /* Reduce the X scaling. */
+ origin_x += SIGN(scale_x) * (range_x * (fabs(scale_x) - fabs(scale_y)) *
(pgls->g.scaling_params.left / 100.0));
scale_x = SIGN(scale_x) * fabs(scale_y);
} else { /* Reduce the Y scaling. */
- origin_y += SIGN(scale_y) * (range_y * (fabs(scale_y) - fabs(scale_x)) *
+ origin_y += SIGN(scale_y) * (range_y * (fabs(scale_y) - fabs(scale_x)) *
(pgls->g.scaling_params.bottom / 100.0));
scale_y = SIGN(scale_y) * fabs(scale_x);
}
}
- hpgl_call(gs_make_translation(origin_x, origin_y, pmat));
- hpgl_call(gs_matrix_scale(pmat, scale_x, scale_y, pmat));
- hpgl_call(gs_matrix_translate(pmat,
- -pgls->g.scaling_params.pmin.x,
- -pgls->g.scaling_params.pmin.y, pmat));
- break;
- }
- }
- return 0;
+ hpgl_call(gs_make_translation(origin_x, origin_y, pmat));
+ hpgl_call(gs_matrix_scale(pmat, scale_x, scale_y, pmat));
+ hpgl_call(gs_matrix_translate(pmat,
+ -pgls->g.scaling_params.pmin.x,
+ -pgls->g.scaling_params.pmin.y, pmat));
+ break;
+ }
+ }
+ return 0;
}
@@ -230,13 +227,13 @@ hpgl_set_ctm(hpgl_state_t *pgls)
{
hpgl_call(hpgl_set_plu_ctm(pgls));
if ( pgls->g.scaling_type != hpgl_scaling_none ) {
- gs_matrix mat;
- hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &mat));
- hpgl_call(gs_concat(pgls->pgs, &mat));
- hpgl_call(gs_currentmatrix(pgls->pgs, &mat));
- mat.tx = round(mat.tx);
- mat.ty = round(mat.ty);
- hpgl_call(gs_setmatrix(pgls->pgs, &mat));
+ gs_matrix mat;
+ hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &mat));
+ hpgl_call(gs_concat(pgls->pgs, &mat));
+ hpgl_call(gs_currentmatrix(pgls->pgs, &mat));
+ mat.tx = round(mat.tx);
+ mat.ty = round(mat.ty);
+ hpgl_call(gs_setmatrix(pgls->pgs, &mat));
}
return 0;
}
@@ -252,108 +249,108 @@ hpgl_get_line_pattern_length(hpgl_state_t *pgls)
/* dispense with the unusual "isotropic relative" case first. The
normal calculation afterward is straightforward */
if ( (pgls->g.line.current.pattern_length_relative == 0) &&
- (pgls->g.scaling_type == hpgl_scaling_isotropic) ) {
- /* the box in user space */
- gs_rect isotropic_user_box;
- /* box in plotter units we compute 4% of the diagonal of this box */
- gs_rect isotropic_plu_box;
- gs_matrix user_to_plu_mat;
-
- hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &user_to_plu_mat));
-
- isotropic_user_box.p = pgls->g.scaling_params.pmin;
- isotropic_user_box.q = pgls->g.scaling_params.pmax;
-
- hpgl_call(gs_bbox_transform(&isotropic_user_box,
- &user_to_plu_mat,
- &isotropic_plu_box));
-
- return (pgls->g.line.current.pattern_length / 100.0) *
- hpgl_compute_distance(isotropic_plu_box.p.x,
- isotropic_plu_box.p.y,
- isotropic_plu_box.q.x,
- isotropic_plu_box.q.y);
+ (pgls->g.scaling_type == hpgl_scaling_isotropic) ) {
+ /* the box in user space */
+ gs_rect isotropic_user_box;
+ /* box in plotter units we compute 4% of the diagonal of this box */
+ gs_rect isotropic_plu_box;
+ gs_matrix user_to_plu_mat;
+
+ hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &user_to_plu_mat));
+
+ isotropic_user_box.p = pgls->g.scaling_params.pmin;
+ isotropic_user_box.q = pgls->g.scaling_params.pmax;
+
+ hpgl_call(gs_bbox_transform(&isotropic_user_box,
+ &user_to_plu_mat,
+ &isotropic_plu_box));
+
+ return (pgls->g.line.current.pattern_length / 100.0) *
+ hpgl_compute_distance(isotropic_plu_box.p.x,
+ isotropic_plu_box.p.y,
+ isotropic_plu_box.q.x,
+ isotropic_plu_box.q.y);
}
/* simple case 4% of the diagonal of P1 and P2 or absolute in millimeters */
return ((pgls->g.line.current.pattern_length_relative == 0) ?
- ((pgls->g.line.current.pattern_length / 100.0) *
- hpgl_compute_distance(pgls->g.P1.x,
- pgls->g.P1.y,
- pgls->g.P2.x,
- pgls->g.P2.y) *
+ ((pgls->g.line.current.pattern_length / 100.0) *
+ hpgl_compute_distance(pgls->g.P1.x,
+ pgls->g.P1.y,
+ pgls->g.P2.x,
+ pgls->g.P2.y) *
hpgl_width_scale(pgls)) :
- (mm_2_plu(pgls->g.line.current.pattern_length)));
+ (mm_2_plu(pgls->g.line.current.pattern_length)));
}
static int
hpgl_set_graphics_dash_state(hpgl_state_t *pgls)
{
- int entry = abs(pgls->g.line.current.type);
- bool adaptive;
- const hpgl_line_type_t *pat;
- float length;
- float pattern[20];
- float offset;
- int count;
- int i;
-
- /* handle the simple case (no dash) and return */
- if ( pgls->g.line.current.is_solid )
- {
- /* use a 0 count pattern to turn off dashing in case it is
+ int entry = abs(pgls->g.line.current.type);
+ bool adaptive;
+ const hpgl_line_type_t *pat;
+ float length;
+ float pattern[20];
+ float offset;
+ int count;
+ int i;
+
+ /* handle the simple case (no dash) and return */
+ if ( pgls->g.line.current.is_solid )
+ {
+ /* use a 0 count pattern to turn off dashing in case it is
set, and allow drawing dots */
- hpgl_call(gs_setdash(pgls->pgs, pattern, 0, 0));
- hpgl_call(gs_setdotlength(pgls->pgs, 0.00098, true));
- return 0;
- }
-
- hpgl_call(gs_setdotlength(pgls->pgs, 0.0, false));
- if ( entry == 0 )
- {
- /* dot length NOTE this is in absolute 1/72" units not
+ hpgl_call(gs_setdash(pgls->pgs, pattern, 0, 0));
+ hpgl_call(gs_setdotlength(pgls->pgs, 0.00098, true));
+ return 0;
+ }
+
+ hpgl_call(gs_setdotlength(pgls->pgs, 0.0, false));
+ if ( entry == 0 )
+ {
+ /* dot length NOTE this is in absolute 1/72" units not
user space */
- /* Use an adaptive pattern with an infinitely long segment length
- to get the dots drawn just at the ends of lines. */
- pattern[0] = 0;
- pattern[1] = 1.0e6; /* "infinity" */
- hpgl_call(gs_setdash(pgls->pgs, pattern, 2, 0));
- gs_setdashadapt(pgls->pgs, true);
- return 0;
- }
-
- adaptive = ( pgls->g.line.current.type < 0 );
- pat = ((adaptive) ?
- (&pgls->g.adaptive_line_type[entry - 1]) :
- (&pgls->g.fixed_line_type[entry - 1]));
-
- length = hpgl_get_line_pattern_length(pgls);
- gs_setdashadapt(pgls->pgs, adaptive);
- /*
- * The graphics library interprets odd pattern counts differently
- * from GL: if the pattern count is odd, we need to do something
- * a little special.
- */
- count = pat->count;
- for ( i = 0; i < count; i++ )
- pattern[i] = length * pat->gap[i];
- offset = pgls->g.line.current.pattern_offset * hpgl_get_line_pattern_length(pgls);
- if ( count & 1 )
- {
- /*
- * Combine the last gap with the first one, and change the
- * offset to compensate. NOTE: this doesn't work right with
- * adaptive line type: we may need to change the library to
- * make this work properly.
- */
- --count;
- pattern[0] += pattern[count];
- offset += pattern[count];
- }
-
- hpgl_call(gs_setdash(pgls->pgs, pattern, count, offset));
-
- return 0;
+ /* Use an adaptive pattern with an infinitely long segment length
+ to get the dots drawn just at the ends of lines. */
+ pattern[0] = 0;
+ pattern[1] = 1.0e6; /* "infinity" */
+ hpgl_call(gs_setdash(pgls->pgs, pattern, 2, 0));
+ gs_setdashadapt(pgls->pgs, true);
+ return 0;
+ }
+
+ adaptive = ( pgls->g.line.current.type < 0 );
+ pat = ((adaptive) ?
+ (&pgls->g.adaptive_line_type[entry - 1]) :
+ (&pgls->g.fixed_line_type[entry - 1]));
+
+ length = hpgl_get_line_pattern_length(pgls);
+ gs_setdashadapt(pgls->pgs, adaptive);
+ /*
+ * The graphics library interprets odd pattern counts differently
+ * from GL: if the pattern count is odd, we need to do something
+ * a little special.
+ */
+ count = pat->count;
+ for ( i = 0; i < count; i++ )
+ pattern[i] = length * pat->gap[i];
+ offset = pgls->g.line.current.pattern_offset * hpgl_get_line_pattern_length(pgls);
+ if ( count & 1 )
+ {
+ /*
+ * Combine the last gap with the first one, and change the
+ * offset to compensate. NOTE: this doesn't work right with
+ * adaptive line type: we may need to change the library to
+ * make this work properly.
+ */
+ --count;
+ pattern[0] += pattern[count];
+ offset += pattern[count];
+ }
+
+ hpgl_call(gs_setdash(pgls->pgs, pattern, count, offset));
+
+ return 0;
}
/* catch pen not being in the palette */
@@ -383,29 +380,29 @@ hpgl_set_graphics_line_attribute_state(
)
{
const gs_line_cap cap_map[] = { gs_cap_butt, /* 0 not supported */
- gs_cap_butt, /* 1 butt end */
- gs_cap_square, /* 2 square end */
- gs_cap_triangle, /* 3 triag. end */
- gs_cap_round /* 4 round cap */
+ gs_cap_butt, /* 1 butt end */
+ gs_cap_square, /* 2 square end */
+ gs_cap_triangle, /* 3 triag. end */
+ gs_cap_round /* 4 round cap */
};
const gs_line_join join_map[] = { gs_join_none, /* 0 not supported */
- gs_join_miter, /* 1 mitered */
- gs_join_miter, /* 2 mitrd/bevld */
- gs_join_triangle, /* 3 triag. join */
- gs_join_round, /* 4 round join */
- gs_join_bevel, /* 5 bevel join */
- gs_join_none /* 6 no join */
+ gs_join_miter, /* 1 mitered */
+ gs_join_miter, /* 2 mitrd/bevld */
+ gs_join_triangle, /* 3 triag. join */
+ gs_join_round, /* 4 round join */
+ gs_join_bevel, /* 5 bevel join */
+ gs_join_none /* 6 no join */
};
const float * widths = pcl_palette_get_pen_widths(pgls->ppalet);
floatp pen_wid = widths[hpgl_get_selected_pen(pgls)];
gs_setfilladjust(pgls->pgs, 0.0, 0.0);
-
+
/* character mode has already set up all of this information in
the build character routine for the font */
if ( render_mode == hpgl_rm_character )
- return 0;
+ return 0;
/*
* HP appears to use default line attributes if the the pen
* width is less than or equal to .35mm or 14.0 plu. This
@@ -413,11 +410,11 @@ hpgl_set_graphics_line_attribute_state(
* plotter units
*/
if ( render_mode != hpgl_rm_character && pen_wid <= 14.0 ) {
- hpgl_call(gs_setlinejoin(pgls->pgs, gs_join_miter));
- hpgl_call(gs_setlinecap(pgls->pgs, gs_cap_butt));
- hpgl_call(gs_setlinewidth(pgls->pgs, pen_wid));
- hpgl_call(gs_setmiterlimit(pgls->pgs, 5.0));
- return 0;
+ hpgl_call(gs_setlinejoin(pgls->pgs, gs_join_miter));
+ hpgl_call(gs_setlinecap(pgls->pgs, gs_cap_butt));
+ hpgl_call(gs_setlinewidth(pgls->pgs, pen_wid));
+ hpgl_call(gs_setmiterlimit(pgls->pgs, 5.0));
+ return 0;
}
switch (render_mode) {
@@ -425,30 +422,30 @@ hpgl_set_graphics_line_attribute_state(
case hpgl_rm_character:
case hpgl_rm_polygon:
case hpgl_rm_clip_and_fill_polygon:
- hpgl_call(gs_setlinejoin(pgls->pgs, gs_join_round));
- hpgl_call(gs_setlinecap(pgls->pgs, gs_cap_round));
- break;
+ hpgl_call(gs_setlinejoin(pgls->pgs, gs_join_round));
+ hpgl_call(gs_setlinecap(pgls->pgs, gs_cap_round));
+ break;
case hpgl_rm_vector_fill:
case hpgl_rm_vector:
vector:
- hpgl_call(gs_setlinejoin(pgls->pgs, join_map[pgls->g.line.join]));
- hpgl_call(gs_setlinecap(pgls->pgs, cap_map[pgls->g.line.cap]));
- hpgl_call(gs_setlinewidth(pgls->pgs, pen_wid));
- break;
+ hpgl_call(gs_setlinejoin(pgls->pgs, join_map[pgls->g.line.join]));
+ hpgl_call(gs_setlinecap(pgls->pgs, cap_map[pgls->g.line.cap]));
+ hpgl_call(gs_setlinewidth(pgls->pgs, pen_wid));
+ break;
default:
- /* shouldn't happen; we must have a mode to properly parse hpgl file. */
- dprintf("warning no hpgl rendering mode set using vector mode\n");
- goto vector;
+ /* shouldn't happen; we must have a mode to properly parse hpgl file. */
+ dprintf("warning no hpgl rendering mode set using vector mode\n");
+ goto vector;
}
#ifdef COMMENT
/* I do not remember the rational for the large miter */
hpgl_call(gs_setmiterlimit( pgls->pgs,
- (pgls->g.line.join == 1)
- ? 5000.0
- : pgls->g.miter_limit
+ (pgls->g.line.join == 1)
+ ? 5000.0
+ : pgls->g.miter_limit
) );
#endif
hpgl_call(gs_setmiterlimit(pgls->pgs, pgls->g.miter_limit));
@@ -481,41 +478,41 @@ hpgl_set_clipping_region(hpgl_state_t *pgls, hpgl_rendering_mode_t render_mode)
return 0;
else
{
- gs_fixed_rect fixed_box;
- gs_rect pcl_clip_box;
- gs_rect dev_clip_box;
- gs_matrix save_ctm;
- gs_matrix pcl_ctm;
-
- /* get pcl to device ctm and restore the current ctm */
- hpgl_call(gs_currentmatrix(pgls->pgs, &save_ctm));
- hpgl_call(pcl_set_ctm(pgls, false));
- hpgl_call(gs_currentmatrix(pgls->pgs, &pcl_ctm));
- hpgl_call(gs_setmatrix(pgls->pgs, &save_ctm));
- /* find the clipping region defined by the picture frame
+ gs_fixed_rect fixed_box;
+ gs_rect pcl_clip_box;
+ gs_rect dev_clip_box;
+ gs_matrix save_ctm;
+ gs_matrix pcl_ctm;
+
+ /* get pcl to device ctm and restore the current ctm */
+ hpgl_call(gs_currentmatrix(pgls->pgs, &save_ctm));
+ hpgl_call(pcl_set_ctm(pgls, false));
+ hpgl_call(gs_currentmatrix(pgls->pgs, &pcl_ctm));
+ hpgl_call(gs_setmatrix(pgls->pgs, &save_ctm));
+ /* find the clipping region defined by the picture frame
which is defined in pcl coordinates */
- pcl_clip_box.p.x = pgls->g.picture_frame.anchor_point.x;
- pcl_clip_box.p.y = pgls->g.picture_frame.anchor_point.y;
- pcl_clip_box.q.x = pcl_clip_box.p.x + pgls->g.picture_frame_width;
- pcl_clip_box.q.y = pcl_clip_box.p.y + pgls->g.picture_frame_height;
-
- hpgl_call(gs_bbox_transform(&pcl_clip_box,
- &pcl_ctm,
- &dev_clip_box));
- /* HP cheats and expands the clip box's extant by at least
+ pcl_clip_box.p.x = pgls->g.picture_frame.anchor_point.x;
+ pcl_clip_box.p.y = pgls->g.picture_frame.anchor_point.y;
+ pcl_clip_box.q.x = pcl_clip_box.p.x + pgls->g.picture_frame_width;
+ pcl_clip_box.q.y = pcl_clip_box.p.y + pgls->g.picture_frame_height;
+
+ hpgl_call(gs_bbox_transform(&pcl_clip_box,
+ &pcl_ctm,
+ &dev_clip_box));
+ /* HP cheats and expands the clip box's extant by at least
one device pixel in all directions */
- dev_clip_box.q.x += 1.0;
- dev_clip_box.q.y += 1.0;
+ dev_clip_box.q.x += 1.0;
+ dev_clip_box.q.y += 1.0;
dev_clip_box.p.x -= 1.0;
dev_clip_box.p.y -= 1.0;
- /* if the clipping window is active calculate the new clip
+ /* if the clipping window is active calculate the new clip
box derived from IW and the intersection of the device
space boxes replace the current box. Note that IW
coordinates are in current units and and the picture
frame in pcl coordinates. */
- if ( pgls->g.soft_clip_window.active ) {
- gs_rect dev_soft_window_box;
- gs_matrix ctm;
+ if ( pgls->g.soft_clip_window.active ) {
+ gs_rect dev_soft_window_box;
+ gs_matrix ctm;
if (pgls->g.soft_clip_window.isbound) {
/* we need the plotter unit matrix */
hpgl_call(gs_currentmatrix(pgls->pgs, &save_ctm));
@@ -525,28 +522,28 @@ hpgl_set_clipping_region(hpgl_state_t *pgls, hpgl_rendering_mode_t render_mode)
} else {
hpgl_call(gs_currentmatrix(pgls->pgs, &ctm));
}
- hpgl_call(gs_bbox_transform(&pgls->g.soft_clip_window.rect,
- &ctm,
- &dev_soft_window_box));
- /* Enlarge IW by 1 device dot to compensate for it's
- 'on the line' is not clipped behavior. */
- dev_clip_box.p.x = max(dev_clip_box.p.x, dev_soft_window_box.p.x - 1.0);
- dev_clip_box.p.y = max(dev_clip_box.p.y, dev_soft_window_box.p.y - 1.0);
- dev_clip_box.q.x = min(dev_clip_box.q.x, dev_soft_window_box.q.x + 1.0);
- dev_clip_box.q.y = min(dev_clip_box.q.y, dev_soft_window_box.q.y + 1.0);
-
- }
- /* convert intersection box to fixed point and clip */
- fixed_box.p.x = float2fixed(floor(dev_clip_box.p.x));
- fixed_box.p.y = float2fixed(floor(dev_clip_box.p.y));
- fixed_box.q.x = float2fixed(ceil(dev_clip_box.q.x));
- fixed_box.q.y = float2fixed(ceil(dev_clip_box.q.y));
- /* intersect with pcl clipping region */
- fixed_box.p.x = max(fixed_box.p.x, pgls->xfm_state.dev_print_rect.p.x);
- fixed_box.p.y = max(fixed_box.p.y, pgls->xfm_state.dev_print_rect.p.y);
- fixed_box.q.x = min(fixed_box.q.x, pgls->xfm_state.dev_print_rect.q.x);
- fixed_box.q.y = min(fixed_box.q.y, pgls->xfm_state.dev_print_rect.q.y);
- hpgl_call(gx_clip_to_rectangle(pgls->pgs, &fixed_box));
+ hpgl_call(gs_bbox_transform(&pgls->g.soft_clip_window.rect,
+ &ctm,
+ &dev_soft_window_box));
+ /* Enlarge IW by 1 device dot to compensate for it's
+ 'on the line' is not clipped behavior. */
+ dev_clip_box.p.x = max(dev_clip_box.p.x, dev_soft_window_box.p.x - 1.0);
+ dev_clip_box.p.y = max(dev_clip_box.p.y, dev_soft_window_box.p.y - 1.0);
+ dev_clip_box.q.x = min(dev_clip_box.q.x, dev_soft_window_box.q.x + 1.0);
+ dev_clip_box.q.y = min(dev_clip_box.q.y, dev_soft_window_box.q.y + 1.0);
+
+ }
+ /* convert intersection box to fixed point and clip */
+ fixed_box.p.x = float2fixed(floor(dev_clip_box.p.x));
+ fixed_box.p.y = float2fixed(floor(dev_clip_box.p.y));
+ fixed_box.q.x = float2fixed(ceil(dev_clip_box.q.x));
+ fixed_box.q.y = float2fixed(ceil(dev_clip_box.q.y));
+ /* intersect with pcl clipping region */
+ fixed_box.p.x = max(fixed_box.p.x, pgls->xfm_state.dev_print_rect.p.x);
+ fixed_box.p.y = max(fixed_box.p.y, pgls->xfm_state.dev_print_rect.p.y);
+ fixed_box.q.x = min(fixed_box.q.x, pgls->xfm_state.dev_print_rect.q.x);
+ fixed_box.q.y = min(fixed_box.q.y, pgls->xfm_state.dev_print_rect.q.y);
+ hpgl_call(gx_clip_to_rectangle(pgls->pgs, &fixed_box));
}
return 0;
}
@@ -567,13 +564,13 @@ hpgl_draw_vector_absolute(
hpgl_call(hpgl_add_point_to_path( pgls,
x0,
y0,
- hpgl_plot_move_absolute,
+ hpgl_plot_move_absolute,
set_ctm
) );
hpgl_call(hpgl_add_point_to_path( pgls,
x1,
y1,
- hpgl_plot_draw_absolute,
+ hpgl_plot_draw_absolute,
set_ctm
) );
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector_fill));
@@ -593,15 +590,15 @@ hpgl_get_adjusted_corner(
adjusted_anchor_corner->y = current_anchor_corner->y;
/* account for anchor corner greater than origin */
if (x_fill_increment != 0) {
- while (adjusted_anchor_corner->x > bbox->p.x)
- adjusted_anchor_corner->x -= x_fill_increment;
+ while (adjusted_anchor_corner->x > bbox->p.x)
+ adjusted_anchor_corner->x -= x_fill_increment;
} else if (adjusted_anchor_corner->x > bbox->p.x)
- adjusted_anchor_corner->x = bbox->p.x;
+ adjusted_anchor_corner->x = bbox->p.x;
if (y_fill_increment != 0) {
- while (adjusted_anchor_corner->y > bbox->p.y)
- adjusted_anchor_corner->y -= y_fill_increment;
+ while (adjusted_anchor_corner->y > bbox->p.y)
+ adjusted_anchor_corner->y -= y_fill_increment;
} else if (adjusted_anchor_corner->y > bbox->p.y)
- adjusted_anchor_corner->y = bbox->p.y;
+ adjusted_anchor_corner->y = bbox->p.y;
return 0;
}
@@ -609,9 +606,9 @@ static void
hpgl_alternate_line_pattern_offset(hpgl_state_t *pgls, uint lines_filled)
{
if ( lines_filled & 1 )
- pgls->g.line.current.pattern_offset = 0.5;
+ pgls->g.line.current.pattern_offset = 0.5;
else
- pgls->g.line.current.pattern_offset = 0.0;
+ pgls->g.line.current.pattern_offset = 0.0;
}
/* this definition is used to factor out the effect of the orientation
@@ -649,12 +646,12 @@ hpgl_polyfill(
: &pgls->g.fill.param.hatch);
gs_point spacing;
#ifdef FILL_IGNORES_PCL_ORIENTATION
- hpgl_real_t direction =
+ hpgl_real_t direction =
params->angle + pgls->xfm_state.lp_orient * 90;
#else
hpgl_real_t direction = params->angle;
#endif
-
+
hpgl_real_t unscaled_direction;
float saved_line_pattern_offset = pgls->g.line.current.pattern_offset;
int lines_filled;
@@ -668,20 +665,20 @@ hpgl_polyfill(
hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &user_to_plu_mat));
if (params->spacing == 0) {
/* Per TRM 22-12, use 1% of the P1/P2 distance. */
-
- spacing.x = 0.01 * hpgl_compute_distance( pgls->g.P1.x,
- pgls->g.P1.y,
- pgls->g.P2.x,
- pgls->g.P2.y
- );
-
- /* 1% is in plu, convert back to user units */
- spacing.y = spacing.x / fabs(user_to_plu_mat.yy);
- spacing.x /= fabs(user_to_plu_mat.xx);
+
+ spacing.x = 0.01 * hpgl_compute_distance( pgls->g.P1.x,
+ pgls->g.P1.y,
+ pgls->g.P2.x,
+ pgls->g.P2.y
+ );
+
+ /* 1% is in plu, convert back to user units */
+ spacing.y = spacing.x / fabs(user_to_plu_mat.yy);
+ spacing.x /= fabs(user_to_plu_mat.xx);
}
else {
- /* set spacing.y based on ratio of x/y scaling, still in user units */
- spacing.y = spacing.x * fabs(user_to_plu_mat.xx) / fabs(user_to_plu_mat.yy);
+ /* set spacing.y based on ratio of x/y scaling, still in user units */
+ spacing.y = spacing.x * fabs(user_to_plu_mat.xx) / fabs(user_to_plu_mat.yy);
}
/* get the bounding box */
hpgl_call(hpgl_polyfill_bbox(pgls, &bbox));
@@ -696,21 +693,20 @@ hpgl_polyfill(
hpgl_real_t line_width = widths[hpgl_get_selected_pen(pgls)];
line_width /= min(fabs(user_to_plu_mat.xx), fabs(user_to_plu_mat.yy));
- if (line_width >= spacing.x || line_width >= spacing.y) {
+ if (line_width >= spacing.x || line_width >= spacing.y) {
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_polygon));
- return 0;
- }
+ return 0;
+ }
}
/* get rid of the current path */
hpgl_call(hpgl_clear_current_path(pgls));
-
start: /* Change direction, come back and draw crosshatch lines. */
/* hatch angles are isotropic; ie 45degrees is not affected by y scale != x scale.
- unscaled_direction ::= user requested angle
+ unscaled_direction ::= user requested angle
direction ::= the angle that when scaled will generate user requested angle */
/* save unscaled angle */
@@ -718,41 +714,41 @@ hpgl_polyfill(
/* not necessery if direction is orthogonal */
if ( !equal(fmod( direction, 90 ), 0 ) ) {
- hpgl_real_t slope, scaled_slope;
- gs_sincos_degrees(direction, &sincos);
- /* take the tangent by dividing sin by cos. Since we know
- the angle is non-orthogonal the cosine is non-zero */
- slope = sin_dir / cos_dir;
- /* scale the slope by the ratio of the scaling factors */
- scaled_slope = (user_to_plu_mat.xx / user_to_plu_mat.yy) * slope;
- /* preserved angle in user space */
- direction = radians_to_degrees * atan(scaled_slope);
+ hpgl_real_t slope, scaled_slope;
+ gs_sincos_degrees(direction, &sincos);
+ /* take the tangent by dividing sin by cos. Since we know
+ the angle is non-orthogonal the cosine is non-zero */
+ slope = sin_dir / cos_dir;
+ /* scale the slope by the ratio of the scaling factors */
+ scaled_slope = (user_to_plu_mat.xx / user_to_plu_mat.yy) * slope;
+ /* preserved angle in user space */
+ direction = radians_to_degrees * atan(scaled_slope);
}
lines_filled = 0;
- /* spacing is done with the unscaled angle
- spacing.x .y is already scaled hence the unscaled angle is used.
+ /* spacing is done with the unscaled angle
+ spacing.x .y is already scaled hence the unscaled angle is used.
scale * spacing * sin(unscaled_angle) */
gs_sincos_degrees(unscaled_direction, &sincos);
if (sin_dir < 0)
- sin_dir = -sin_dir, cos_dir = -cos_dir; /* ensure y_inc >= 0 */
+ sin_dir = -sin_dir, cos_dir = -cos_dir; /* ensure y_inc >= 0 */
x_fill_increment = (sin_dir != 0) ? fabs(spacing.x / sin_dir) : 0;
y_fill_increment = (cos_dir != 0) ? fabs(spacing.y / cos_dir) : 0;
-
- /* scaled angle is used for end point calculation
- distance * sin( scaled_angle )
+
+ /* scaled angle is used for end point calculation
+ distance * sin( scaled_angle )
scale is applyed once and only once per calculation */
gs_sincos_degrees(direction, &sincos);
if (sin_dir < 0)
- sin_dir = -sin_dir, cos_dir = -cos_dir; /* ensure y_inc >= 0 */
+ sin_dir = -sin_dir, cos_dir = -cos_dir; /* ensure y_inc >= 0 */
hpgl_call(hpgl_get_adjusted_corner( x_fill_increment,
- y_fill_increment,
- &bbox,
- &pgls->g.anchor_corner,
- &start
- ) );
+ y_fill_increment,
+ &bbox,
+ &pgls->g.anchor_corner,
+ &start
+ ) );
/*
* calculate the diagonals magnitude. Note we clip this
@@ -765,67 +761,67 @@ hpgl_polyfill(
endy = (diag_mag * sin_dir) + start.y;
hpgl_alternate_line_pattern_offset(pgls, lines_filled++);
hpgl_call(hpgl_draw_vector_absolute( pgls,
- start.x,
- start.y,
- endx,
- endy,
- render_mode
- ) );
+ start.x,
+ start.y,
+ endx,
+ endy,
+ render_mode
+ ) );
/* Travel along +x using current spacing. */
if (x_fill_increment != 0) {
- while ( endx += x_fill_increment,
- (start.x += x_fill_increment) <= bbox.q.x ) {
-
- hpgl_alternate_line_pattern_offset(pgls, lines_filled++);
- hpgl_call(hpgl_draw_vector_absolute( pgls,
- start.x,
- start.y,
- endx,
- endy,
- render_mode
- ) );
- }
+ while ( endx += x_fill_increment,
+ (start.x += x_fill_increment) <= bbox.q.x ) {
+
+ hpgl_alternate_line_pattern_offset(pgls, lines_filled++);
+ hpgl_call(hpgl_draw_vector_absolute( pgls,
+ start.x,
+ start.y,
+ endx,
+ endy,
+ render_mode
+ ) );
+ }
}
/* Travel along +Y similarly. */
if (y_fill_increment != 0) {
- /*
- * If the slope is negative, we have to travel along the right
- * edge of the box rather than the left edge. Fortuitously,
- * the X loop left everything set up exactly right for this case.
- */
- if (cos_dir >= 0) {
- hpgl_call(hpgl_get_adjusted_corner( x_fill_increment,
- y_fill_increment,
- &bbox,
- &pgls->g.anchor_corner,
- &start
- ) );
- endx = (diag_mag * cos_dir) + start.x;
- endy = (diag_mag * sin_dir) + start.y;
- } else
- start.y -= y_fill_increment, endy -= y_fill_increment;
-
- while ( endy += y_fill_increment,
- (start.y += y_fill_increment) <= bbox.q.y ) {
- hpgl_alternate_line_pattern_offset(pgls, lines_filled++);
- hpgl_call(hpgl_draw_vector_absolute( pgls,
- start.x,
- start.y,
- endx,
- endy,
- render_mode
- ) );
- }
-
+ /*
+ * If the slope is negative, we have to travel along the right
+ * edge of the box rather than the left edge. Fortuitously,
+ * the X loop left everything set up exactly right for this case.
+ */
+ if (cos_dir >= 0) {
+ hpgl_call(hpgl_get_adjusted_corner( x_fill_increment,
+ y_fill_increment,
+ &bbox,
+ &pgls->g.anchor_corner,
+ &start
+ ) );
+ endx = (diag_mag * cos_dir) + start.x;
+ endy = (diag_mag * sin_dir) + start.y;
+ } else
+ start.y -= y_fill_increment, endy -= y_fill_increment;
+
+ while ( endy += y_fill_increment,
+ (start.y += y_fill_increment) <= bbox.q.y ) {
+ hpgl_alternate_line_pattern_offset(pgls, lines_filled++);
+ hpgl_call(hpgl_draw_vector_absolute( pgls,
+ start.x,
+ start.y,
+ endx,
+ endy,
+ render_mode
+ ) );
+ }
+
}
- if (cross) {
- /* go back and draw the perpendicular lines, +90degress */
- cross = false;
- direction = unscaled_direction + 90;
- if ( direction >= 180 )
- direction -= 180;
- goto start;
+ if (cross) {
+ /* go back and draw the perpendicular lines, +90degress */
+ cross = false;
+ direction = unscaled_direction + 90;
+ if ( direction >= 180 )
+ direction -= 180;
+ goto start;
}
hpgl_restore_pen_state(pgls, &saved_pen_state, hpgl_pen_pos);
pgls->g.line.current.pattern_offset = saved_line_pattern_offset;
@@ -847,7 +843,7 @@ hpgl_fill_polyfill_background(hpgl_state_t *pgls)
pcl_mark_page_for_path(pgls);
/* if we are drawing on a transparent background */
if ( pgls->g.source_transparent )
- return 0;
+ return 0;
/* preserve the current foreground color */
hpgl_call(hpgl_gsave(pgls));
/* fill a white region. */
@@ -857,7 +853,7 @@ hpgl_fill_polyfill_background(hpgl_state_t *pgls)
hpgl_call(hpgl_grestore(pgls));
return 0;
}
-
+
static int
hpgl_polyfill_using_current_line_type(
hpgl_state_t * pgls,
@@ -872,9 +868,9 @@ hpgl_polyfill_using_current_line_type(
* beginning at the anchor corner replicate lines
*/
if (pgls->g.fill_type == hpgl_even_odd_rule)
- hpgl_call(gs_eoclip(pgls->pgs));
+ hpgl_call(gs_eoclip(pgls->pgs));
else
- hpgl_call(gs_clip(pgls->pgs));
+ hpgl_call(gs_clip(pgls->pgs));
hpgl_call(hpgl_fill_polyfill_background(pgls));
hpgl_call(hpgl_polyfill(pgls, render_mode));
hpgl_call(hpgl_grestore(pgls));
@@ -895,7 +891,6 @@ hpgl_rop(hpgl_state_t *pgls, hpgl_rendering_mode_t render_mode)
return rop;
}
-
int
hpgl_set_drawing_color(
hpgl_state_t * pgls,
@@ -908,124 +903,124 @@ hpgl_set_drawing_color(
switch (render_mode) {
case hpgl_rm_clip_and_fill_polygon:
- hpgl_call(hpgl_polyfill_using_current_line_type(pgls, render_mode));
- return 0;
+ hpgl_call(hpgl_polyfill_using_current_line_type(pgls, render_mode));
+ return 0;
case hpgl_rm_character:
- switch (pgls->g.character.fill_mode) {
+ switch (pgls->g.character.fill_mode) {
- case hpgl_char_solid_edge: /* fall through */
- case hpgl_char_edge:
+ case hpgl_char_solid_edge: /* fall through */
+ case hpgl_char_edge:
set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
- break;
-
- case hpgl_char_fill:
- case hpgl_char_fill_edge:
- if ( (pgls->g.fill.type == hpgl_FT_pattern_one_line) ||
- (pgls->g.fill.type == hpgl_FT_pattern_two_lines) ) {
- hpgl_call(hpgl_polyfill_using_current_line_type( pgls,
- render_mode
- ) );
- return 0;
- } else
- goto fill;
-
- default:
- dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
- return 0;
- }
- break;
-
- /* fill like a polygon */
+ break;
+
+ case hpgl_char_fill:
+ case hpgl_char_fill_edge:
+ if ( (pgls->g.fill.type == hpgl_FT_pattern_one_line) ||
+ (pgls->g.fill.type == hpgl_FT_pattern_two_lines) ) {
+ hpgl_call(hpgl_polyfill_using_current_line_type( pgls,
+ render_mode
+ ) );
+ return 0;
+ } else
+ goto fill;
+
+ default:
+ dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
+ return 0;
+ }
+ break;
+
+ /* fill like a polygon */
case hpgl_rm_polygon:
fill:
- /* pixel placement mode is only relevant to polygon fills */
+ /* pixel placement mode is only relevant to polygon fills */
pixel_placement_mode = pgls->pp_mode;
set_proc = pcl_pattern_get_proc_FT(pgls->g.fill.type);
- switch (pgls->g.fill.type) {
+ switch (pgls->g.fill.type) {
- case hpgl_FT_pattern_solid_pen1:
- case hpgl_FT_pattern_solid_pen2:
- /*
+ case hpgl_FT_pattern_solid_pen1:
+ case hpgl_FT_pattern_solid_pen2:
+ /*
* this is documented incorrectly PCLTRM 22-12 says
* these should be solid black but they are actually
* set to the value of the current pen - (i.e pen 0 is
* solid white
*/
- code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
- break;
+ code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
+ break;
case hpgl_FT_pattern_one_line:
- case hpgl_FT_pattern_two_lines:
- set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
+ case hpgl_FT_pattern_two_lines:
+ set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
- break;
+ break;
- case hpgl_FT_pattern_cross_hatch:
+ case hpgl_FT_pattern_cross_hatch:
code = set_proc( pgls,
pgls->g.fill.param.pattern_type,
hpgl_get_selected_pen(pgls)
);
- break;
+ break;
- case hpgl_FT_pattern_shading:
+ case hpgl_FT_pattern_shading:
code = set_proc( pgls,
pgls->g.fill.param.shading,
hpgl_get_selected_pen(pgls)
);
- break;
+ break;
- case hpgl_FT_pattern_user_defined:
+ case hpgl_FT_pattern_user_defined:
code = set_proc( pgls,
pgls->g.fill.param.pattern_id,
hpgl_get_selected_pen(pgls)
);
break;
- case hpgl_FT_pattern_RF:
- /* pcl5e does not care about the current pen it always uses black (1). */
- if ( pgls->personality == pcl5e )
- code = set_proc( pgls,
- -pgls->g.fill.param.user_defined.pattern_index,
- 1 );
- else
- code = set_proc( pgls,
+ case hpgl_FT_pattern_RF:
+ /* pcl5e does not care about the current pen it always uses black (1). */
+ if ( pgls->personality == pcl5e )
+ code = set_proc( pgls,
+ -pgls->g.fill.param.user_defined.pattern_index,
+ 1 );
+ else
+ code = set_proc( pgls,
(pgls->g.fill.param.user_defined.use_current_pen
? -pgls->g.fill.param.user_defined.pattern_index
: pgls->g.fill.param.user_defined.pattern_index),
hpgl_get_selected_pen(pgls)
- );
+ );
break;
- default:
- dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
- break;
- }
- break;
+ default:
+ dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
+ break;
+ }
+ break;
case hpgl_rm_vector:
case hpgl_rm_vector_fill:
set_proc = pcl_pattern_get_proc_SV(pgls->g.screen.type);
- switch(pgls->g.screen.type) {
+ switch(pgls->g.screen.type) {
- case hpgl_SV_pattern_solid_pen:
- code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
- break;
+ case hpgl_SV_pattern_solid_pen:
+ code = set_proc(pgls, hpgl_get_selected_pen(pgls), false);
+ break;
- case hpgl_SV_pattern_shade:
+ case hpgl_SV_pattern_shade:
code = set_proc( pgls,
pgls->g.screen.param.shading,
hpgl_get_selected_pen(pgls)
);
- break;
+ break;
case hpgl_SV_pattern_cross_hatch:
code = set_proc( pgls,
pgls->g.screen.param.pattern_type,
hpgl_get_selected_pen(pgls)
);
- break;
+ break;
case hpgl_SV_pattern_RF:
code = set_proc( pgls,
@@ -1036,22 +1031,22 @@ fill:
);
break;
- case hpgl_SV_pattern_user_defined:
+ case hpgl_SV_pattern_user_defined:
code = set_proc( pgls,
pgls->g.screen.param.pattern_id,
hpgl_get_selected_pen(pgls)
);
break;
- default:
- dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
- break;
- }
- break;
+ default:
+ dprintf("hpgl_set_drawing_color: internal error illegal fill\n");
+ break;
+ }
+ break;
default:
- dprintf("hpgl_set_drawing_color: internal error illegal mode\n");
- break;
+ dprintf("hpgl_set_drawing_color: internal error illegal mode\n");
+ break;
}
if (code >= 0) {
@@ -1117,7 +1112,7 @@ hpgl_add_point_to_path(
hpgl_plot_function_t func,
bool set_ctm
)
-{
+{
static int (*const gs_procs[])(gs_state *, floatp, floatp)
= { hpgl_plot_function_procedures };
@@ -1127,41 +1122,41 @@ hpgl_add_point_to_path(
is moot - so we set it to false. */
pgls->g.subpolygon_started = false;
if (gx_path_is_null(gx_current_path(pgls->pgs))) {
- /* Start a new GL/2 path. */
- gs_point current_pt;
-
- if (set_ctm)
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(gs_newpath(pgls->pgs));
-
- /* moveto the current position */
- hpgl_call(hpgl_get_current_position(pgls, &current_pt));
- hpgl_call_check_lost( gs_moveto( pgls->pgs,
- current_pt.x,
- current_pt.y
- ) );
+ /* Start a new GL/2 path. */
+ gs_point current_pt;
+
+ if (set_ctm)
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(gs_newpath(pgls->pgs));
+
+ /* moveto the current position */
+ hpgl_call(hpgl_get_current_position(pgls, &current_pt));
+ hpgl_call_check_lost( gs_moveto( pgls->pgs,
+ current_pt.x,
+ current_pt.y
+ ) );
}
{
int code = (*gs_procs[func])(pgls->pgs, x, y);
- if (code < 0) {
- if (code == gs_error_limitcheck)
- hpgl_set_lost_mode(pgls, hpgl_lost_mode_entered);
- } else {
+ if (code < 0) {
+ if (code == gs_error_limitcheck)
+ hpgl_set_lost_mode(pgls, hpgl_lost_mode_entered);
+ } else {
gs_point point;
- if (hpgl_plot_is_absolute(func))
- hpgl_set_lost_mode(pgls, hpgl_lost_mode_cleared);
-
- /* update hpgl's state position */
- if (hpgl_plot_is_absolute(func)) {
- point.x = x;
- point.y = y;
- } else {
- hpgl_call(hpgl_get_current_position(pgls, &point));
- point.x += x; point.y += y;
- }
- hpgl_call(hpgl_set_current_position(pgls, &point));
- }
+ if (hpgl_plot_is_absolute(func))
+ hpgl_set_lost_mode(pgls, hpgl_lost_mode_cleared);
+
+ /* update hpgl's state position */
+ if (hpgl_plot_is_absolute(func)) {
+ point.x = x;
+ point.y = y;
+ } else {
+ hpgl_call(hpgl_get_current_position(pgls, &point));
+ point.x += x; point.y += y;
+ }
+ hpgl_call(hpgl_set_current_position(pgls, &point));
+ }
}
return 0;
}
@@ -1170,35 +1165,35 @@ hpgl_add_point_to_path(
int
hpgl_clear_current_path(hpgl_state_t *pgls)
{
- hpgl_call(gs_newpath(pgls->pgs));
- return 0;
+ hpgl_call(gs_newpath(pgls->pgs));
+ return 0;
}
/* closes the current path, making the first point and last point coincident */
int
hpgl_close_current_path(hpgl_state_t *pgls)
{
- hpgl_call(gs_closepath(pgls->pgs));
- return 0;
+ hpgl_call(gs_closepath(pgls->pgs));
+ return 0;
}
/* converts pcl coordinate to device space and back to hpgl space */
int
hpgl_add_pcl_point_to_path(hpgl_state_t *pgls, const gs_point *pcl_pt)
{
- gs_point dev_pt, hpgl_pt;
-
- hpgl_call(hpgl_clear_current_path(pgls));
- pcl_set_ctm(pgls, true);
- hpgl_call(gs_transform(pgls->pgs, pcl_pt->x, pcl_pt->y, &dev_pt));
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &hpgl_pt));
- hpgl_call(hpgl_add_point_to_path(pgls, hpgl_pt.x, hpgl_pt.y,
- hpgl_plot_move_absolute, true));
- return 0;
+ gs_point dev_pt, hpgl_pt;
+
+ hpgl_call(hpgl_clear_current_path(pgls));
+ pcl_set_ctm(pgls, true);
+ hpgl_call(gs_transform(pgls->pgs, pcl_pt->x, pcl_pt->y, &dev_pt));
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(gs_itransform(pgls->pgs, dev_pt.x, dev_pt.y, &hpgl_pt));
+ hpgl_call(hpgl_add_point_to_path(pgls, hpgl_pt.x, hpgl_pt.y,
+ hpgl_plot_move_absolute, true));
+ return 0;
}
-static floatp
+static floatp
compute_chord_angle(floatp chord_angle)
{
floatp ca = fmod(chord_angle, 360);
@@ -1213,22 +1208,22 @@ compute_chord_angle(floatp chord_angle)
}
return ca;
}
-
+
int
hpgl_add_arc_to_path(hpgl_state_t *pgls, floatp center_x, floatp center_y,
- floatp radius, floatp start_angle, floatp sweep_angle,
- floatp chord_angle, bool start_moveto, hpgl_plot_function_t draw,
- bool set_ctm)
+ floatp radius, floatp start_angle, floatp sweep_angle,
+ floatp chord_angle, bool start_moveto, hpgl_plot_function_t draw,
+ bool set_ctm)
{
floatp num_chordsf = sweep_angle / compute_chord_angle(chord_angle);
int num_chords = (int)(num_chordsf >= 0.0 ? ceil(num_chordsf) : floor(num_chordsf));
floatp integral_chord_angle = fabs(sweep_angle / num_chords);
int i;
floatp arccoord_x, arccoord_y;
-
+
if ( hpgl_plot_is_draw(draw) )
pgls->g.have_drawn_in_path = true;
-
+
(void)hpgl_compute_arc_coords(radius, center_x, center_y,
start_angle,
&arccoord_x, &arccoord_y);
@@ -1239,7 +1234,7 @@ hpgl_add_arc_to_path(hpgl_state_t *pgls, floatp center_x, floatp center_y,
for ( i = 0; i < abs(num_chords); i++ ) {
if (sweep_angle > 0)
- start_angle += integral_chord_angle;
+ start_angle += integral_chord_angle;
else
start_angle -= integral_chord_angle;
hpgl_compute_arc_coords(radius, center_x, center_y,
@@ -1250,7 +1245,7 @@ hpgl_add_arc_to_path(hpgl_state_t *pgls, floatp center_x, floatp center_y,
}
/* NB this is suspicious - why not any +- multiple of 360 if this
is correct at all. */
- if (sweep_angle - 360.0 > -0.0001)
+ if (sweep_angle - 360.0 > -0.0001)
hpgl_call(hpgl_close_current_path(pgls));
return 0;
}
@@ -1258,108 +1253,108 @@ hpgl_add_arc_to_path(hpgl_state_t *pgls, floatp center_x, floatp center_y,
/* add a 3 point arc to the path */
int
hpgl_add_arc_3point_to_path(hpgl_state_t *pgls, floatp start_x, floatp
- start_y, floatp inter_x, floatp inter_y,
- floatp end_x, floatp end_y, floatp chord_angle,
- hpgl_plot_function_t draw)
+ start_y, floatp inter_x, floatp inter_y,
+ floatp end_x, floatp end_y, floatp chord_angle,
+ hpgl_plot_function_t draw)
{
- /* handle unusual cases as per pcltrm */
- if ( hpgl_3_same_points(start_x, start_y,
- inter_x, inter_y,
- end_x, end_y) )
- {
- hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
- return 0;
- }
- if ( hpgl_3_no_intermediate(start_x, start_y,
- inter_x, inter_y,
- end_x, end_y) )
- {
- hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
- hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_y, draw, true));
- return 0;
- }
- if ( hpgl_3_same_endpoints(start_x, start_y,
- inter_x, y_inter,
- end_x, end_y) )
- {
- hpgl_call(hpgl_add_arc_to_path(pgls, (start_x + inter_x) / 2.0,
- (start_y + inter_y) / 2.0,
- (hypot((inter_x - start_x),
- (inter_y - start_y)) / 2.0),
- 0.0, 360.0, chord_angle, false,
- draw, true));
- return 0;
- }
-
- if ( hpgl_3_colinear_points(start_x, start_y, inter_x, inter_y, end_x, end_y) )
- {
- if ( hpgl_3_intermediate_between(start_x, start_y,
- inter_x, inter_y,
- end_x, end_y) )
- {
- hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
- hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_x, draw, true));
- }
- else
- {
- hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
- hpgl_call(hpgl_add_point_to_path(pgls, inter_x, inter_y, draw, true));
- hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_y, draw, true));
- }
- return 0;
- }
-
- /* normal 3 point arc case */
- {
- hpgl_real_t center_x, center_y, radius;
- hpgl_real_t start_angle, inter_angle, end_angle;
- hpgl_real_t sweep_angle;
-
- hpgl_call(hpgl_compute_arc_center(start_x, start_y,
- inter_x, inter_y,
- end_x, end_y,
- &center_x, &center_y));
-
- radius = hypot(start_x - center_x, start_y - center_y);
- start_angle = radians_to_degrees *
- hpgl_compute_angle(start_x - center_x, start_y - center_y);
-
- inter_angle = radians_to_degrees *
- hpgl_compute_angle(inter_x - center_x, inter_y - center_y);
-
- end_angle = radians_to_degrees *
- hpgl_compute_angle(end_x - center_x, end_y - center_y);
- sweep_angle = end_angle - start_angle;
-
- /*
- * Figure out which direction to draw the arc, depending on the
- * relative position of start, inter, and end. Case analysis
- * shows that we should draw the arc counter-clockwise from S to
- * E iff exactly 2 of S<I, I<E, and E<S are true, and clockwise
- * if exactly 1 of these relations is true. (These are the only
- * possible cases if no 2 of the points coincide.)
- */
-
- if ( (start_angle < inter_angle) + (inter_angle < end_angle) +
- (end_angle < start_angle) == 1
- )
- {
- if ( sweep_angle > 0 )
- sweep_angle -= 360;
- }
- else
- {
- if ( sweep_angle < 0 )
- sweep_angle += 360;
- }
-
- hpgl_call(hpgl_add_arc_to_path(pgls, center_x, center_y,
- radius, start_angle, sweep_angle,
- (sweep_angle < 0.0 ) ?
- -chord_angle : chord_angle, false,
- draw, true));
- return 0;
- }
+ /* handle unusual cases as per pcltrm */
+ if ( hpgl_3_same_points(start_x, start_y,
+ inter_x, inter_y,
+ end_x, end_y) )
+ {
+ hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
+ return 0;
+ }
+ if ( hpgl_3_no_intermediate(start_x, start_y,
+ inter_x, inter_y,
+ end_x, end_y) )
+ {
+ hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_y, draw, true));
+ return 0;
+ }
+ if ( hpgl_3_same_endpoints(start_x, start_y,
+ inter_x, y_inter,
+ end_x, end_y) )
+ {
+ hpgl_call(hpgl_add_arc_to_path(pgls, (start_x + inter_x) / 2.0,
+ (start_y + inter_y) / 2.0,
+ (hypot((inter_x - start_x),
+ (inter_y - start_y)) / 2.0),
+ 0.0, 360.0, chord_angle, false,
+ draw, true));
+ return 0;
+ }
+
+ if ( hpgl_3_colinear_points(start_x, start_y, inter_x, inter_y, end_x, end_y) )
+ {
+ if ( hpgl_3_intermediate_between(start_x, start_y,
+ inter_x, inter_y,
+ end_x, end_y) )
+ {
+ hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_x, draw, true));
+ }
+ else
+ {
+ hpgl_call(hpgl_add_point_to_path(pgls, start_x, start_y, draw, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, inter_x, inter_y, draw, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, end_x, end_y, draw, true));
+ }
+ return 0;
+ }
+
+ /* normal 3 point arc case */
+ {
+ hpgl_real_t center_x, center_y, radius;
+ hpgl_real_t start_angle, inter_angle, end_angle;
+ hpgl_real_t sweep_angle;
+
+ hpgl_call(hpgl_compute_arc_center(start_x, start_y,
+ inter_x, inter_y,
+ end_x, end_y,
+ &center_x, &center_y));
+
+ radius = hypot(start_x - center_x, start_y - center_y);
+ start_angle = radians_to_degrees *
+ hpgl_compute_angle(start_x - center_x, start_y - center_y);
+
+ inter_angle = radians_to_degrees *
+ hpgl_compute_angle(inter_x - center_x, inter_y - center_y);
+
+ end_angle = radians_to_degrees *
+ hpgl_compute_angle(end_x - center_x, end_y - center_y);
+ sweep_angle = end_angle - start_angle;
+
+ /*
+ * Figure out which direction to draw the arc, depending on the
+ * relative position of start, inter, and end. Case analysis
+ * shows that we should draw the arc counter-clockwise from S to
+ * E iff exactly 2 of S<I, I<E, and E<S are true, and clockwise
+ * if exactly 1 of these relations is true. (These are the only
+ * possible cases if no 2 of the points coincide.)
+ */
+
+ if ( (start_angle < inter_angle) + (inter_angle < end_angle) +
+ (end_angle < start_angle) == 1
+ )
+ {
+ if ( sweep_angle > 0 )
+ sweep_angle -= 360;
+ }
+ else
+ {
+ if ( sweep_angle < 0 )
+ sweep_angle += 360;
+ }
+
+ hpgl_call(hpgl_add_arc_to_path(pgls, center_x, center_y,
+ radius, start_angle, sweep_angle,
+ (sweep_angle < 0.0 ) ?
+ -chord_angle : chord_angle, false,
+ draw, true));
+ return 0;
+ }
}
/* Bezier's are handled a bit differently than arcs as we use the
@@ -1368,24 +1363,24 @@ hpgl_add_arc_3point_to_path(hpgl_state_t *pgls, floatp start_x, floatp
int
hpgl_add_bezier_to_path(hpgl_state_t *pgls, floatp x1, floatp y1,
- floatp x2, floatp y2, floatp x3, floatp y3,
- floatp x4, floatp y4, hpgl_plot_function_t draw)
+ floatp x2, floatp y2, floatp x3, floatp y3,
+ floatp x4, floatp y4, hpgl_plot_function_t draw)
{
gx_path * ppath = gx_current_path(pgls->pgs);
/* Don't add superflous points in polygon mode */
- if ( ( !pgls->g.polygon_mode ) ||
- ( !ppath->current_subpath ) )
- hpgl_call(hpgl_add_point_to_path(pgls, x1, y1,
- draw ?
- hpgl_plot_draw_absolute :
- hpgl_plot_move_absolute, true));
+ if ( ( !pgls->g.polygon_mode ) ||
+ ( !ppath->current_subpath ) )
+ hpgl_call(hpgl_add_point_to_path(pgls, x1, y1,
+ draw ?
+ hpgl_plot_draw_absolute :
+ hpgl_plot_move_absolute, true));
if ( draw )
- hpgl_call(gs_curveto(pgls->pgs, x2, y2, x3, y3, x4, y4));
+ hpgl_call(gs_curveto(pgls->pgs, x2, y2, x3, y3, x4, y4));
/* update hpgl's state position to last point of the curve. */
{
- gs_point point;
- point.x = x4; point.y = y4;
- hpgl_call(hpgl_set_current_position(pgls, &point));
+ gs_point point;
+ point.x = x4; point.y = y4;
+ hpgl_call(hpgl_set_current_position(pgls, &point));
}
return 0;
}
@@ -1403,12 +1398,12 @@ hpgl_close_path(
gs_fixed_point first_device;
gx_path *ppath = gx_current_path(pgls->pgs);
if (!ppath->current_subpath)
- return 0;
+ return 0;
/* if we do not have a subpath there is nothing to do, get the
first points of the path in device space and convert to floats */
if ( gx_path_subpath_start_point(gx_current_path(pgls->pgs),
- &first_device) < 0 )
- return 0;
+ &first_device) < 0 )
+ return 0;
first.x = fixed2float(first_device.x);
first.y = fixed2float(first_device.y);
/* get gl/2 current position -- always current units */
@@ -1420,39 +1415,38 @@ hpgl_close_path(
* force gs to apply join and miter)
*/
if (equal(first.x, last.x) && equal(first.y, last.y))
- hpgl_call(gs_closepath(pgls->pgs));
+ hpgl_call(gs_closepath(pgls->pgs));
return 0;
}
-
/* To implement centered we move the points in the path to a pixel boundary.
Note this routine is sensitive to the orientation of the device.
Since rounding 0.5 is used here and 0.5 fill adjust this can fail to reduce and
- object in size by 1 pixel left/bottom for some user scale factors. This is not a
+ object in size by 1 pixel left/bottom for some user scale factors. This is not a
grave concern as the objects will still seam together. */
int
hpgl_set_special_pixel_placement(hpgl_state_t *pgls, hpgl_rendering_mode_t render_mode)
{
if ( pgls->pp_mode == 1 ) {
- gs_matrix default_matrix;
- gs_point distance, adjust;
- gx_path *ppath = gx_current_path(pgls->pgs);
- /* arbitrary just need the signs after transformation to
- device space */
- gs_setfilladjust(pgls->pgs, 0, 0);
- adjust.x = -1;
- adjust.y = -1;
- /* determine the adjustment in device space */
- hpgl_call(gs_defaultmatrix(pgls->pgs, &default_matrix));
- hpgl_call(gs_distance_transform(adjust.x, adjust.y, &default_matrix, &distance));
+ gs_matrix default_matrix;
+ gs_point distance, adjust;
+ gx_path *ppath = gx_current_path(pgls->pgs);
+ /* arbitrary just need the signs after transformation to
+ device space */
+ gs_setfilladjust(pgls->pgs, 0, 0);
+ adjust.x = -1;
+ adjust.y = -1;
+ /* determine the adjustment in device space */
+ hpgl_call(gs_defaultmatrix(pgls->pgs, &default_matrix));
+ hpgl_call(gs_distance_transform(adjust.x, adjust.y, &default_matrix, &distance));
/* modify the path but first it should be "unshared" so the
translation (next statement) does not update the polygon
buffer */
hpgl_call(gx_path_unshare(ppath));
- /* translate all points in the path by the adjustment. */
- hpgl_call(gx_path_translate(ppath,
+ /* translate all points in the path by the adjustment. */
+ hpgl_call(gx_path_translate(ppath,
float2fixed(distance.x / fabs(distance.x)),
float2fixed(distance.y / fabs(distance.y))));
}
@@ -1476,82 +1470,82 @@ hpgl_draw_current_path(
/* check if we have a current path - we don't need the current
point */
if (!ppath->current_subpath) {
- hpgl_call(hpgl_clear_current_path(pgls));
- return 0;
+ hpgl_call(hpgl_clear_current_path(pgls));
+ return 0;
}
if ( render_mode == hpgl_rm_vector_no_close )
- render_mode = hpgl_rm_vector;
- else
- hpgl_call(hpgl_close_path(pgls));
+ render_mode = hpgl_rm_vector;
+ else
+ hpgl_call(hpgl_close_path(pgls));
hpgl_call(hpgl_set_drawing_state(pgls, render_mode));
switch (render_mode) {
case hpgl_rm_character:
- {
- /* HAS need to set attributes in set_drawing color (next 2) */
-
- /* Intellifonts require eofill, but TrueType require fill. */
- /****** HACK: look at the scaling technology of ******/
- /****** the current font to decide. ******/
- int (*fill)(gs_state *);
-
- if (pgls->g.font->scaling_technology == plfst_Intellifont)
- fill = gs_eofill;
- else
- fill = gs_fill;
-
- switch (pgls->g.character.fill_mode) {
-
- case hpgl_char_solid_edge:
+ {
+ /* HAS need to set attributes in set_drawing color (next 2) */
+
+ /* Intellifonts require eofill, but TrueType require fill. */
+ /****** HACK: look at the scaling technology of ******/
+ /****** the current font to decide. ******/
+ int (*fill)(gs_state *);
+
+ if (pgls->g.font->scaling_technology == plfst_Intellifont)
+ fill = gs_eofill;
+ else
+ fill = gs_fill;
+
+ switch (pgls->g.character.fill_mode) {
+
+ case hpgl_char_solid_edge:
set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
if ((code = set_proc(pgls, hpgl_get_selected_pen(pgls), false)) < 0)
return code;
- hpgl_call((*fill)(pgs));
- /* falls through */
+ hpgl_call((*fill)(pgs));
+ /* falls through */
- case hpgl_char_edge:
- if (pgls->g.bitmap_fonts_allowed)
- break; /* no edging */
+ case hpgl_char_edge:
+ if (pgls->g.bitmap_fonts_allowed)
+ break; /* no edging */
set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
if ((code = set_proc(pgls, hpgl_get_character_edge_pen(pgls), false)) < 0)
return code;
- hpgl_call(hpgl_set_plu_ctm(pgls));
+ hpgl_call(hpgl_set_plu_ctm(pgls));
{
gs_point scale = hpgl_current_char_scale(pgls);
/* NB fix and comment */
hpgl_call(gs_setlinewidth(pgls->pgs, min(scale.x, scale.y) * 0.0375 * 0.2835));
}
pcl_mark_page_for_path(pgls);
- hpgl_call(gs_stroke(pgls->pgs));
- break;
+ hpgl_call(gs_stroke(pgls->pgs));
+ break;
- case hpgl_char_fill:
- /* the fill has already been done if the fill type is
+ case hpgl_char_fill:
+ /* the fill has already been done if the fill type is
hpgl/2 vector fills. This was handled when we set
the drawing color */
- if ((pgls->g.fill.type != hpgl_FT_pattern_one_line) &&
- (pgls->g.fill.type != hpgl_FT_pattern_two_lines))
- hpgl_call((*fill)(pgs));
- else
- hpgl_call(hpgl_clear_current_path(pgls));
- break;
- case hpgl_char_fill_edge:
- /* the fill has already been done if the fill type is
+ if ((pgls->g.fill.type != hpgl_FT_pattern_one_line) &&
+ (pgls->g.fill.type != hpgl_FT_pattern_two_lines))
+ hpgl_call((*fill)(pgs));
+ else
+ hpgl_call(hpgl_clear_current_path(pgls));
+ break;
+ case hpgl_char_fill_edge:
+ /* the fill has already been done if the fill type is
hpgl/2 vector fills. This was handled when we set
the drawing color. gsave to preserve the path for
subsequent edging */
- if ((pgls->g.fill.type != hpgl_FT_pattern_one_line) &&
- (pgls->g.fill.type != hpgl_FT_pattern_two_lines)) {
- hpgl_call(hpgl_gsave(pgls));
- /* all character fills appear to have 0 fill adjustment */
- gs_setfilladjust(pgls->pgs, 0, 0);
- hpgl_call((*fill)(pgs));
- hpgl_call(hpgl_grestore(pgls));
- }
+ if ((pgls->g.fill.type != hpgl_FT_pattern_one_line) &&
+ (pgls->g.fill.type != hpgl_FT_pattern_two_lines)) {
+ hpgl_call(hpgl_gsave(pgls));
+ /* all character fills appear to have 0 fill adjustment */
+ gs_setfilladjust(pgls->pgs, 0, 0);
+ hpgl_call((*fill)(pgs));
+ hpgl_call(hpgl_grestore(pgls));
+ }
if (pgls->g.bitmap_fonts_allowed) /* no edging */
- hpgl_call(hpgl_clear_current_path(pgls));
+ hpgl_call(hpgl_clear_current_path(pgls));
else {
set_proc = pcl_pattern_get_proc_FT(hpgl_FT_pattern_solid_pen1);
if ((code = set_proc(pgls, hpgl_get_character_edge_pen(pgls), false)) < 0)
@@ -1564,61 +1558,61 @@ hpgl_draw_current_path(
pgls->g.font_selection[pgls->g.font_selected].params.height_4ths * 0.0375));
hpgl_call(gs_stroke(pgls->pgs));
}
- break;
-
- }
- break;
- }
- break;
+ break;
+
+ }
+ break;
+ }
+ break;
case hpgl_rm_polygon:
- hpgl_set_special_pixel_placement(pgls, hpgl_rm_polygon);
+ hpgl_set_special_pixel_placement(pgls, hpgl_rm_polygon);
pcl_mark_page_for_path(pgls);
- if (pgls->g.fill_type == hpgl_even_odd_rule)
- hpgl_call(gs_eofill(pgs));
- else /* hpgl_winding_number_rule */
- hpgl_call(gs_fill(pgs));
- break;
+ if (pgls->g.fill_type == hpgl_even_odd_rule)
+ hpgl_call(gs_eofill(pgs));
+ else /* hpgl_winding_number_rule */
+ hpgl_call(gs_fill(pgs));
+ break;
case hpgl_rm_clip_and_fill_polygon:
- /*
- * A bizarre HPISM - If the pen is white we do a solid
+ /*
+ * A bizarre HPISM - If the pen is white we do a solid
* white fill this is true for *all* fill types (arg!) as
* tested on the 6mp. If pen 1 (black)
* hpgl_set_drawing_color() handles this case by drawing
* the lines that comprise the vector fill
*/
- if (hpgl_get_selected_pen(pgls) == 0) {
+ if (hpgl_get_selected_pen(pgls) == 0) {
pcl_mark_page_for_path(pgls);
- hpgl_call(gs_fill(pgls->pgs));
+ hpgl_call(gs_fill(pgls->pgs));
}
- hpgl_call(hpgl_clear_current_path(pgls));
- break;
+ hpgl_call(hpgl_clear_current_path(pgls));
+ break;
case hpgl_rm_vector:
case hpgl_rm_vector_fill:
- /*
- * we reset the ctm before stroking to preserve the line width
+ /*
+ * we reset the ctm before stroking to preserve the line width
* information, then restore the ctm.
*/
- {
- gs_matrix save_ctm;
- int save_scaling_type = pgls->g.scaling_type;
-
- hpgl_call(gs_currentmatrix(pgs, &save_ctm));
-
- /* force no picture frame scaling */
- pgls->g.scaling_type = hpgl_scaling_point_factor;
- hpgl_call(hpgl_set_plu_ctm(pgls));
- pgls->g.scaling_type = save_scaling_type;
-
- /* NB: what does reversing the path do? Currently DEAD code see pglfill.c */
- if ( !pgls->g.line.current.is_solid && (pgls->g.line.current.type == 0) )
- hpgl_call(gs_reversepath(pgls->pgs));
+ {
+ gs_matrix save_ctm;
+ int save_scaling_type = pgls->g.scaling_type;
+
+ hpgl_call(gs_currentmatrix(pgs, &save_ctm));
+
+ /* force no picture frame scaling */
+ pgls->g.scaling_type = hpgl_scaling_point_factor;
+ hpgl_call(hpgl_set_plu_ctm(pgls));
+ pgls->g.scaling_type = save_scaling_type;
+
+ /* NB: what does reversing the path do? Currently DEAD code see pglfill.c */
+ if ( !pgls->g.line.current.is_solid && (pgls->g.line.current.type == 0) )
+ hpgl_call(gs_reversepath(pgls->pgs));
pcl_mark_page_for_path(pgls);
- hpgl_call(gs_stroke(pgls->pgs));
- gs_setmatrix(pgs, &save_ctm);
- break;
- }
+ hpgl_call(gs_stroke(pgls->pgs));
+ gs_setmatrix(pgs, &save_ctm);
+ break;
+ }
default :
dprintf("unknown render mode\n");
}
diff --git a/pcl/pgdraw.h b/pcl/pgdraw.h
index ff4e7112e..dc5e1a383 100644
--- a/pcl/pgdraw.h
+++ b/pcl/pgdraw.h
@@ -22,7 +22,7 @@ int hpgl_set_plu_ctm(hpgl_state_t *pgls);
/* compute the scaling transformation from plu to user units */
int hpgl_compute_user_units_to_plu_ctm(const hpgl_state_t *pgls,
- gs_matrix *pmat);
+ gs_matrix *pmat);
/* The following 2 functions can be used together to calculate a ctm
without picture frame scaling. */
@@ -57,7 +57,7 @@ int hpgl_set_current_position(hpgl_state_t *pgls, gs_point *pt);
/* puts a point into the path using the operation specified by func */
int hpgl_add_point_to_path(hpgl_state_t *pgls, floatp x, floatp y,
- hpgl_plot_function_t func, bool set_ctm);
+ hpgl_plot_function_t func, bool set_ctm);
/* puts an arc into the current path. start moveto indicates that we
use moveto to go from the arc center to arc circumference. */
@@ -71,9 +71,9 @@ int hpgl_add_arc_to_path(hpgl_state_t *pgls, floatp center_x,
decomposition is a bit different for 3 point arcs since the polygon
wedge routines use this function as well */
int hpgl_add_arc_3point_to_path(hpgl_state_t *pgls, floatp start_x, floatp
- start_y, floatp inter_x, floatp inter_y,
- floatp end_x, floatp end_y, floatp chord_angle,
- hpgl_plot_function_t draw);
+ start_y, floatp inter_x, floatp inter_y,
+ floatp end_x, floatp end_y, floatp chord_angle,
+ hpgl_plot_function_t draw);
int hpgl_close_path(hpgl_state_t *pgls);
@@ -85,7 +85,7 @@ int hpgl_add_bezier_to_path(hpgl_state_t *pgls, floatp x1,
/* clears the current path with stroke or fill */
int hpgl_draw_current_path(hpgl_state_t *pgls,
- hpgl_rendering_mode_t render_mode);
+ hpgl_rendering_mode_t render_mode);
/* save/restore gs graphics state + HPGL/2's first moveto state */
#define hpgl_gsave(pgls) pcl_gsave(pgls)
@@ -98,7 +98,7 @@ int hpgl_copy_current_path_to_polygon_buffer(hpgl_state_t *pgls);
/* draw the current path with stroke or fill, but do not clear */
int hpgl_draw_and_preserve_path(hpgl_state_t *pgls,
- hpgl_rendering_mode_t render_mode);
+ hpgl_rendering_mode_t render_mode);
/* destroy the current path */
int hpgl_clear_current_path(hpgl_state_t *pgls);
diff --git a/pcl/pgfdata.c b/pcl/pgfdata.c
index 69ba3c7f6..983e910d8 100644
--- a/pcl/pgfdata.c
+++ b/pcl/pgfdata.c
@@ -23,7 +23,6 @@
#include "gxarith.h" /* for any_abs */
#include "pgfdata.h"
-
/* Font data consists of instructions for each character.
Fonts are on a 1024x1024 grid. */
@@ -5055,29 +5054,29 @@ hpgl_stick_segments(const gs_memory_t *mem, void *data, uint char_index)
/* set up tables debending on stick or arc font */
int i;
- if ( (char_index < 0x20) ||
- (char_index > 0xff) ||
- ((char_index > 0x7f) && (char_index < 0xa0)) )
- return 0; /* no glyph */
+ if ( (char_index < 0x20) ||
+ (char_index > 0xff) ||
+ ((char_index > 0x7f) && (char_index < 0xa0)) )
+ return 0; /* no glyph */
/* all entries have 3 short entries */
i = offset;
while ( i < stop ) {
- if ( stick_font_data[i] == FNT_LINETO ) {
- gs_lineto(data, (floatp)(stick_font_data[i+1]), (floatp)(stick_font_data[i+2]));
- i += 3;
- }
- else if ( stick_font_data[i] == FNT_MOVETO ) {
- gs_moveto(data, (floatp)(stick_font_data[i+1]), (floatp)(stick_font_data[i+2]));
- i += 3;
- }
- else
- return_error(gs_error_invalidfont);
+ if ( stick_font_data[i] == FNT_LINETO ) {
+ gs_lineto(data, (floatp)(stick_font_data[i+1]), (floatp)(stick_font_data[i+2]));
+ i += 3;
+ }
+ else if ( stick_font_data[i] == FNT_MOVETO ) {
+ gs_moveto(data, (floatp)(stick_font_data[i+1]), (floatp)(stick_font_data[i+2]));
+ i += 3;
+ }
+ else
+ return_error(gs_error_invalidfont);
}
/* table must be corrupt if the loop didn't stop at stop */
if ( i != stop )
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
return 0;
}
@@ -5098,37 +5097,37 @@ hpgl_arc_segments(const gs_memory_t *mem, void *data, uint char_index)
int i;
/* 3 entries for moveto and lineto and 5 for curveto */
- if ( (char_index < 0x20) ||
- (char_index > 0xff) ||
- ((char_index > 0x7f) && (char_index < 0xa0)) )
- return 0; /* no glyph */
+ if ( (char_index < 0x20) ||
+ (char_index > 0xff) ||
+ ((char_index > 0x7f) && (char_index < 0xa0)) )
+ return 0; /* no glyph */
i = offset;
while ( i < stop ) {
- if ( arc_font_data[i] == FNT_LINETO ) {
- gs_lineto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]));
- i += 3;
- }
- else if ( arc_font_data[i] == FNT_MOVETO ) {
- gs_moveto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]));
- i += 3;
- }
- else if ( arc_font_data[i] == FNT_CURVETO ) {
- gs_curveto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]),
- (floatp)(arc_font_data[i+3]), (floatp)(arc_font_data[i+4]),
- (floatp)(arc_font_data[i+5]), (floatp)(arc_font_data[i+6]));
- i += 7;
- }
- else
- return_error(gs_error_invalidfont);
+ if ( arc_font_data[i] == FNT_LINETO ) {
+ gs_lineto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]));
+ i += 3;
+ }
+ else if ( arc_font_data[i] == FNT_MOVETO ) {
+ gs_moveto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]));
+ i += 3;
+ }
+ else if ( arc_font_data[i] == FNT_CURVETO ) {
+ gs_curveto(data, (floatp)(arc_font_data[i+1]), (floatp)(arc_font_data[i+2]),
+ (floatp)(arc_font_data[i+3]), (floatp)(arc_font_data[i+4]),
+ (floatp)(arc_font_data[i+5]), (floatp)(arc_font_data[i+6]));
+ i += 7;
+ }
+ else
+ return_error(gs_error_invalidfont);
}
/* table must be corrupt if the loop didn't stop at stop */
if ( i != stop )
- return_error(gs_error_invalidfont);
+ return_error(gs_error_invalidfont);
return 0;
}
-
+
static int
hpgl_stick_width(uint char_index)
{
@@ -5139,28 +5138,28 @@ hpgl_stick_width(uint char_index)
/* Get the unscaled width of a stick/arc character. */
static int
hpgl_arc_width(uint char_index)
-{
+{
if ( char_index < 0x20 || (char_index < 0xa0 && char_index > 0x7f))
- return arc_font_widths[0];
+ return arc_font_widths[0];
return arc_font_widths[char_index - 0x20];
}
/* interface procedure render the characters */
-int
+int
hpgl_stick_arc_segments(const gs_memory_t *mem,
- void *data, uint char_index, hpgl_font_type_t font_type)
+ void *data, uint char_index, hpgl_font_type_t font_type)
{
if ( font_type == HPGL_ARC_FONT )
- return hpgl_arc_segments(mem, data, char_index);
+ return hpgl_arc_segments(mem, data, char_index);
else
- return hpgl_stick_segments(mem, data, char_index);
+ return hpgl_stick_segments(mem, data, char_index);
}
/* interface procedure to get the width of the characters */
int hpgl_stick_arc_width(uint char_index, hpgl_font_type_t font_type)
{
if ( font_type == HPGL_ARC_FONT )
- return hpgl_arc_width(char_index);
+ return hpgl_arc_width(char_index);
else
- return hpgl_stick_width(char_index);
-}
+ return hpgl_stick_width(char_index);
+}
diff --git a/pcl/pgfdata.h b/pcl/pgfdata.h
index ba224858e..a849bc7b7 100644
--- a/pcl/pgfdata.h
+++ b/pcl/pgfdata.h
@@ -22,7 +22,7 @@ typedef enum {
/* Enumerate the segments of a stick/arc character. */
int hpgl_stick_arc_segments(const gs_memory_t *mem,
- void *data, uint char_index, hpgl_font_type_t font_type);
+ void *data, uint char_index, hpgl_font_type_t font_type);
/* Get the unscaled width of a stick/arc character. */
int hpgl_stick_arc_width(uint char_index, hpgl_font_type_t font_type);
diff --git a/pcl/pgfont.c b/pcl/pgfont.c
index 0f0ca0c6d..a8f71d4f1 100644
--- a/pcl/pgfont.c
+++ b/pcl/pgfont.c
@@ -30,15 +30,13 @@
#include "pgfdata.h"
#include "pgfont.h"
-
-
/* The client always asks for a Unicode indexed chr.
* The stick/arc fonts themselves use Roman-8 (8U) indexing.
*/
extern const pl_symbol_map_t map_8U_unicode;
static gs_glyph
hpgl_stick_arc_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t not_used)
-{
+{
int i;
/* reverse map unicode back to roman 8 */
for (i = 0; i < countof(map_8U_unicode.codes); i++) {
@@ -48,20 +46,20 @@ hpgl_stick_arc_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t not_use
return (gs_glyph)0xffff;
}
-/* The stick font is fixed-pitch.
+/* The stick font is fixed-pitch.
*/
static int
hpgl_stick_char_width(const pl_font_t *plfont, const void *pgs, uint uni_code, gs_point *pwidth)
-{
+{
/* first map uni_code to roman-8 */
uni_code = (uint) hpgl_stick_arc_encode_char(NULL, uni_code, 0);
/* NB need an interface function call to verify the character exists */
if ( (uni_code >= 0x20) && (uni_code <= 0xff) )
- pwidth->x = hpgl_stick_arc_width(uni_code, HPGL_STICK_FONT);
+ pwidth->x = hpgl_stick_arc_width(uni_code, HPGL_STICK_FONT);
else
- /* doesn't exist */
- return 1;
+ /* doesn't exist */
+ return 1;
return 0;
}
@@ -76,28 +74,28 @@ hpgl_stick_char_metrics(const pl_font_t *plfont, const void *pgs, uint uni_code,
metrics[0] = 0;
/* just get the width */
if ( (hpgl_stick_char_width(plfont, pgs, uni_code, &width)) == 1 )
- /* doesn't exist */
- return 1;
+ /* doesn't exist */
+ return 1;
metrics[2] = width.x;
return 0;
-}
+}
/* The arc font is proportionally spaced. */
static int
hpgl_arc_char_width(const pl_font_t *plfont, const void *pgs, uint uni_code, gs_point *pwidth)
-{
+{
/* first map uni_code to roman-8 */
uni_code = (uint) hpgl_stick_arc_encode_char(NULL, uni_code, 0);
/* NB need an interface function call to verify the character exists */
if ( (uni_code >= 0x20) && (uni_code <= 0xff) ) {
pwidth->x = hpgl_stick_arc_width(uni_code, HPGL_ARC_FONT)
- / 1024.0 /* convert to ratio of cell size to be multiplied by point size */
- * 0.667; /* TRM 23-18 cell is 2/3 of point size */
- }
+ / 1024.0 /* convert to ratio of cell size to be multiplied by point size */
+ * 0.667; /* TRM 23-18 cell is 2/3 of point size */
+ }
else
- /* doesn't exist */
- return 1;
+ /* doesn't exist */
+ return 1;
return 0;
}
@@ -111,17 +109,17 @@ hpgl_arc_char_metrics(const pl_font_t *plfont, const void *pgs, uint uni_code, f
metrics[0] = 0;
/* just get the width */
if ( (hpgl_arc_char_width(plfont, pgs, uni_code, &width)) == 1 )
- /* doesn't exist */
- return 1;
+ /* doesn't exist */
+ return 1;
metrics[2] = width.x;
return 0;
-}
+}
/* Add a symbol to the path. */
static int
hpgl_stick_arc_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
gs_glyph uni_code, hpgl_font_type_t font_type)
-{
+{
int width;
gs_matrix save_ctm;
int code;
@@ -140,14 +138,14 @@ hpgl_stick_arc_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
gs_moveto(pgs, 0.0, 0.0);
code = hpgl_stick_arc_segments(pfont->memory, (void *)pgs, uni_code, font_type);
if ( code < 0 )
- return code;
+ return code;
gs_setdefaultmatrix(pgs, NULL);
gs_initmatrix(pgs);
/* Set predictable join and cap styles. */
gs_setlinejoin(pgs, gs_join_round);
gs_setmiterlimit(pgs, 2.61); /* start beveling at 45 degrees */
gs_setlinecap(pgs, gs_cap_round);
- {
+ {
float pattern[1];
gs_setdash(pgs, pattern, 0, 0);
}
@@ -159,55 +157,55 @@ hpgl_stick_arc_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
static int
hpgl_stick_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
gs_char ignore_chr, gs_glyph uni_code)
-{
+{
return hpgl_stick_arc_build_char(penum, pgs, pfont, uni_code, HPGL_STICK_FONT);
}
static int
hpgl_arc_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
gs_char ignore_chr, gs_glyph uni_code)
{ return hpgl_stick_arc_build_char(penum, pgs, pfont, uni_code, HPGL_ARC_FONT);
-
+
}
/* Fill in stick/arc font boilerplate. */
static void
hpgl_fill_in_stick_arc_font(gs_font_base *pfont, long unique_id)
{ /* The way the code is written requires FontMatrix = identity. */
- gs_make_identity(&pfont->FontMatrix);
- pfont->FontType = ft_user_defined;
- pfont->PaintType = 1; /* stroked fonts */
- pfont->BitmapWidths = false;
- pfont->ExactSize = fbit_use_outlines;
- pfont->InBetweenSize = fbit_use_outlines;
- pfont->TransformedChar = fbit_use_outlines;
- pfont->procs.encode_char = hpgl_stick_arc_encode_char; /* FIX ME (void *) */
- /* p.y of the FontBBox is a guess, because of descenders. */
- /* Because of descenders, we have no real idea what the */
- /* FontBBox should be. */
- pfont->FontBBox.p.x = 0;
- pfont->FontBBox.p.y = -0.333;
- pfont->FontBBox.q.x = 0.667;
- pfont->FontBBox.q.y = 0.667;
- uid_set_UniqueID(&pfont->UID, unique_id);
- pfont->encoding_index = 1; /****** WRONG ******/
- pfont->nearest_encoding_index = 1; /****** WRONG ******/
+ gs_make_identity(&pfont->FontMatrix);
+ pfont->FontType = ft_user_defined;
+ pfont->PaintType = 1; /* stroked fonts */
+ pfont->BitmapWidths = false;
+ pfont->ExactSize = fbit_use_outlines;
+ pfont->InBetweenSize = fbit_use_outlines;
+ pfont->TransformedChar = fbit_use_outlines;
+ pfont->procs.encode_char = hpgl_stick_arc_encode_char; /* FIX ME (void *) */
+ /* p.y of the FontBBox is a guess, because of descenders. */
+ /* Because of descenders, we have no real idea what the */
+ /* FontBBox should be. */
+ pfont->FontBBox.p.x = 0;
+ pfont->FontBBox.p.y = -0.333;
+ pfont->FontBBox.q.x = 0.667;
+ pfont->FontBBox.q.y = 0.667;
+ uid_set_UniqueID(&pfont->UID, unique_id);
+ pfont->encoding_index = 1; /****** WRONG ******/
+ pfont->nearest_encoding_index = 1; /****** WRONG ******/
}
void
hpgl_fill_in_stick_font(gs_font_base *pfont, long unique_id)
{ hpgl_fill_in_stick_arc_font(pfont, unique_id);
#define plfont ((pl_font_t *)pfont->client_data)
- pfont->procs.build_char = hpgl_stick_build_char; /* FIX ME (void *) */
- plfont->char_width = hpgl_stick_char_width;
- plfont->char_metrics = hpgl_stick_char_metrics;
+ pfont->procs.build_char = hpgl_stick_build_char; /* FIX ME (void *) */
+ plfont->char_width = hpgl_stick_char_width;
+ plfont->char_metrics = hpgl_stick_char_metrics;
#undef plfont
}
void
hpgl_fill_in_arc_font(gs_font_base *pfont, long unique_id)
{ hpgl_fill_in_stick_arc_font(pfont, unique_id);
#define plfont ((pl_font_t *)pfont->client_data)
- pfont->procs.build_char = hpgl_arc_build_char; /* FIX ME (void *) */
- plfont->char_width = hpgl_arc_char_width;
- plfont->char_metrics = hpgl_arc_char_metrics;
+ pfont->procs.build_char = hpgl_arc_build_char; /* FIX ME (void *) */
+ plfont->char_width = hpgl_arc_char_width;
+ plfont->char_metrics = hpgl_arc_char_metrics;
#undef plfont
}
@@ -215,13 +213,13 @@ void
hpgl_initialize_stick_fonts( hpgl_state_t *pcs )
{
pcs->g.stick_font[0][0].pfont =
- pcs->g.stick_font[0][1].pfont =
- pcs->g.stick_font[1][0].pfont =
- pcs->g.stick_font[1][1].pfont = 0;
+ pcs->g.stick_font[0][1].pfont =
+ pcs->g.stick_font[1][0].pfont =
+ pcs->g.stick_font[1][1].pfont = 0;
/* NB most of the pl_font structure is uninitialized! */
pcs->g.stick_font[0][0].font_file =
- pcs->g.stick_font[0][1].font_file =
- pcs->g.stick_font[1][0].font_file =
- pcs->g.stick_font[1][1].font_file = 0;
+ pcs->g.stick_font[0][1].font_file =
+ pcs->g.stick_font[1][0].font_file =
+ pcs->g.stick_font[1][1].font_file = 0;
}
diff --git a/pcl/pgframe.c b/pcl/pgframe.c
index f39d88f05..87127e99c 100644
--- a/pcl/pgframe.c
+++ b/pcl/pgframe.c
@@ -20,7 +20,7 @@
#include "gstypes.h" /* for gsstate.h */
#include "gsmatrix.h" /* for gsstate.h */
#include "gsmemory.h" /* for gsstate.h */
-#include "gsstate.h"
+#include "gsstate.h"
#include "pcdraw.h"
#include "pcfont.h" /* for pcl_continue_underline */
#include "pcstate.h"
@@ -51,58 +51,57 @@ pcl_set_picture_frame_side_effects(pcl_state_t *pcs)
/* default P1 and P2 */
hpgl_args_setup(&args);
hpgl_IP(&args, pcs);
-
+
/* default the clipping window */
hpgl_args_setup(&args);
hpgl_IW(&args, pcs);
-
+
/* clear the polygon buffer */
hpgl_args_set_int(&args,0);
hpgl_PM(&args, pcs);
-
+
hpgl_args_set_int(&args,2);
hpgl_PM(&args, pcs);
/* NB according to spec should move pen to P1. */
return 0;
}
-
-int /* ESC * c <w_dp> X */
+int /* ESC * c <w_dp> X */
pcl_horiz_pic_frame_size_decipoints(pcl_args_t *pargs, pcl_state_t *pcs)
{
- coord size = (coord)(float_arg(pargs) * 10.0); /* --> centipoints */
-
- if ( size == 0 )
- size = pcs->xfm_state.lp_size.x;
- if ( size != pcs->g.picture_frame_width ) {
- pcs->g.picture_frame_width = size;
- pcl_set_picture_frame_side_effects(pcs);
- }
- return 0;
+ coord size = (coord)(float_arg(pargs) * 10.0); /* --> centipoints */
+
+ if ( size == 0 )
+ size = pcs->xfm_state.lp_size.x;
+ if ( size != pcs->g.picture_frame_width ) {
+ pcs->g.picture_frame_width = size;
+ pcl_set_picture_frame_side_effects(pcs);
+ }
+ return 0;
}
-int /* ESC * c <h_dp> Y */
+int /* ESC * c <h_dp> Y */
pcl_vert_pic_frame_size_decipoints(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
coord size = (coord)(float_arg(pargs) * 10.0); /* --> centipoints */
-
+
/* default to pcl logical page */
if ( size == 0 ) {
- size = pcs->xfm_state.lp_size.y;
- if ( pcs->personality != rtl )
- size -= inch2coord(1.0);
+ size = pcs->xfm_state.lp_size.y;
+ if ( pcs->personality != rtl )
+ size -= inch2coord(1.0);
}
if ( size != pcs->g.picture_frame_height ) {
- pcs->g.picture_frame_height = size;
- pcl_set_picture_frame_side_effects(pcs);
+ pcs->g.picture_frame_height = size;
+ pcl_set_picture_frame_side_effects(pcs);
}
return 0;
}
/*
* ESC * c 0 T
- */
+ */
int
pcl_set_pic_frame_anchor_point(
pcl_args_t * pargs,
@@ -120,43 +119,43 @@ pcl_set_pic_frame_anchor_point(
tmp_pt.y = pcs->cap.y;
pcl_xfm_to_logical_page_space(pcs, &tmp_pt);
if ( ( tmp_pt.x != pcs->g.picture_frame.anchor_point.x ) ||
- ( tmp_pt.y != pcs->g.picture_frame.anchor_point.y ) ) {
- pcs->g.picture_frame.anchor_point.x = tmp_pt.x;
- pcs->g.picture_frame.anchor_point.y = tmp_pt.y;
- pcl_set_picture_frame_side_effects(pcs);
+ ( tmp_pt.y != pcs->g.picture_frame.anchor_point.y ) ) {
+ pcs->g.picture_frame.anchor_point.x = tmp_pt.x;
+ pcs->g.picture_frame.anchor_point.y = tmp_pt.y;
+ pcl_set_picture_frame_side_effects(pcs);
}
return 0;
}
-int /* ESC * c <w_in> K */
+int /* ESC * c <w_in> K */
pcl_hpgl_plot_horiz_size(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
/* convert to centipoints as to match the picture frame */
float size = float_arg(pargs) * 7200.0;
-
+
if ( (coord)size == 0 ) {
- size = pcs->g.picture_frame_width;
- pcs->g.plot_size_horizontal_specified = false;
+ size = pcs->g.picture_frame_width;
+ pcs->g.plot_size_horizontal_specified = false;
}
else
- pcs->g.plot_size_horizontal_specified = true;
+ pcs->g.plot_size_horizontal_specified = true;
pcs->g.plot_width = (coord)size;
pcl_set_picture_frame_side_effects(pcs);
return 0;
}
-int /* ESC * c <h_in> L */
+int /* ESC * c <h_in> L */
pcl_hpgl_plot_vert_size(pcl_args_t *pargs, pcl_state_t *pcs)
-{
+{
/* convert to centipoints as to match the picture frame */
float size = float_arg(pargs) * 7200.0;
if ( (coord)size == 0 ) {
- size = pcs->g.picture_frame_height;
- pcs->g.plot_size_vertical_specified = false;
+ size = pcs->g.picture_frame_height;
+ pcs->g.plot_size_vertical_specified = false;
}
else
- pcs->g.plot_size_vertical_specified = true;
+ pcs->g.plot_size_vertical_specified = true;
pcs->g.plot_height = (coord)size;
pcl_set_picture_frame_side_effects(pcs);
return 0;
@@ -164,22 +163,22 @@ pcl_hpgl_plot_vert_size(pcl_args_t *pargs, pcl_state_t *pcs)
/* We redefine this command so we can draw the current GL path */
/* and, if appropriate, reset the underline bookkeeping. */
-static int /* ESC % <enum> A */
+static int /* ESC % <enum> A */
pcl_enter_pcl_mode(pcl_args_t *pargs, pcl_state_t *pcs)
{ int code;
- hpgl_call_mem(pcs->memory, hpgl_draw_current_path(pcs, hpgl_rm_vector));
- code = rtl_enter_pcl_mode(pargs, pcs);
- switch ( code )
- {
- default: /* error */
- return code;
- case 1: /* CAP changed */
- pcl_continue_underline(pcs);
- case 0: /* CAP not changed */
- break;
- }
- return 0;
+ hpgl_call_mem(pcs->memory, hpgl_draw_current_path(pcs, hpgl_rm_vector));
+ code = rtl_enter_pcl_mode(pargs, pcs);
+ switch ( code )
+ {
+ default: /* error */
+ return code;
+ case 1: /* CAP changed */
+ pcl_continue_underline(pcs);
+ case 0: /* CAP not changed */
+ break;
+ }
+ return 0;
}
/* Initialization */
@@ -189,35 +188,35 @@ pgframe_do_registration(
gs_memory_t *mem
)
{ /* Register commands */
- DEFINE_CLASS('*')
- {'c', 'X',
- PCL_COMMAND("Horizontal Picture Frame Size Decipoints",
- pcl_horiz_pic_frame_size_decipoints,
- pca_neg_error|pca_big_error)},
- {'c', 'Y',
- PCL_COMMAND("Vertical Picture Frame Size Decipoints",
- pcl_vert_pic_frame_size_decipoints,
- pca_neg_error|pca_big_error)},
- {'c', 'T',
- PCL_COMMAND("Set Picture Frame Anchor Point",
- pcl_set_pic_frame_anchor_point,
- pca_neg_error|pca_big_error)},
- {'c', 'K',
- PCL_COMMAND("HP-GL/2 Plot Horizontal Size",
- pcl_hpgl_plot_horiz_size,
- pca_neg_error|pca_big_error)},
- {'c', 'L',
- PCL_COMMAND("HP-GL/2 Plot Vertical Size",
- pcl_hpgl_plot_vert_size,
- pca_neg_error|pca_big_error)},
- END_CLASS
- DEFINE_CLASS('%')
- {0, 'A',
- PCL_COMMAND("Enter PCL Mode",
- pcl_enter_pcl_mode,
- pca_neg_ok|pca_big_ok|pca_in_rtl)},
- END_CLASS
- return 0;
+ DEFINE_CLASS('*')
+ {'c', 'X',
+ PCL_COMMAND("Horizontal Picture Frame Size Decipoints",
+ pcl_horiz_pic_frame_size_decipoints,
+ pca_neg_error|pca_big_error)},
+ {'c', 'Y',
+ PCL_COMMAND("Vertical Picture Frame Size Decipoints",
+ pcl_vert_pic_frame_size_decipoints,
+ pca_neg_error|pca_big_error)},
+ {'c', 'T',
+ PCL_COMMAND("Set Picture Frame Anchor Point",
+ pcl_set_pic_frame_anchor_point,
+ pca_neg_error|pca_big_error)},
+ {'c', 'K',
+ PCL_COMMAND("HP-GL/2 Plot Horizontal Size",
+ pcl_hpgl_plot_horiz_size,
+ pca_neg_error|pca_big_error)},
+ {'c', 'L',
+ PCL_COMMAND("HP-GL/2 Plot Vertical Size",
+ pcl_hpgl_plot_vert_size,
+ pca_neg_error|pca_big_error)},
+ END_CLASS
+ DEFINE_CLASS('%')
+ {0, 'A',
+ PCL_COMMAND("Enter PCL Mode",
+ pcl_enter_pcl_mode,
+ pca_neg_ok|pca_big_ok|pca_in_rtl)},
+ END_CLASS
+ return 0;
}
const pcl_init_t pgframe_init = {
pgframe_do_registration, 0
diff --git a/pcl/pggeom.c b/pcl/pggeom.c
index e804388bb..ead8daf16 100644
--- a/pcl/pggeom.c
+++ b/pcl/pggeom.c
@@ -26,85 +26,85 @@
floatp
hpgl_compute_angle(floatp dx, floatp dy)
{
- floatp alpha = atan2(dy, dx);
+ floatp alpha = atan2(dy, dx);
- return (alpha < 0 ? alpha + M_PI * 2.0 : alpha);
+ return (alpha < 0 ? alpha + M_PI * 2.0 : alpha);
}
/* compute the center of an arc given 3 points on the arc */
int
hpgl_compute_arc_center(floatp x1, floatp y1, floatp x2, floatp y2,
- floatp x3, floatp y3, floatp *pcx, floatp *pcy)
+ floatp x3, floatp y3, floatp *pcx, floatp *pcy)
{
- floatp px2, py2, dx2, dy2, px3, py3, dx3, dy3;
- double denom, t2;
-
- /*
- * The center is the intersection of the perpendicular bisectors
- * of the 3 chords. Any two will do for the computation.
- * (For greatest numerical stability, we should probably choose
- * the two outside chords, but this is a refinement that we will
- * leave for the future.)
- * We define each bisector by a line with the equations
- * xi = pxi + ti * dxi
- * yi = pyi + ti * dyi
- * where i is 2 or 3.
- */
+ floatp px2, py2, dx2, dy2, px3, py3, dx3, dy3;
+ double denom, t2;
+
+ /*
+ * The center is the intersection of the perpendicular bisectors
+ * of the 3 chords. Any two will do for the computation.
+ * (For greatest numerical stability, we should probably choose
+ * the two outside chords, but this is a refinement that we will
+ * leave for the future.)
+ * We define each bisector by a line with the equations
+ * xi = pxi + ti * dxi
+ * yi = pyi + ti * dyi
+ * where i is 2 or 3.
+ */
#define compute_bisector(px, py, dx, dy, xa, ya, xb, yb)\
(px = (xa + xb) / 2, py = (ya + yb) / 2,\
dx = (ya - yb), dy = (xb - xa) /* 90 degree rotation (either way is OK) */)
- compute_bisector(px2, py2, dx2, dy2, x1, y1, x2, y2);
- compute_bisector(px3, py3, dx3, dy3, x1, y1, x3, y3);
+ compute_bisector(px2, py2, dx2, dy2, x1, y1, x2, y2);
+ compute_bisector(px3, py3, dx3, dy3, x1, y1, x3, y3);
#undef compute_bisector
- /*
- * Now find the intersections by solving for t2 or t3:
- * px2 + t2 * dx2 = px3 + t3 * dx3
- * py2 + t2 * dy2 = py3 + t3 * dy3
- * i.e., in standard form,
- * t2 * dx2 - t3 * dx3 = px3 - px2
- * t2 * dy2 - t3 * dy3 = py3 - py2
- * The solution of
- * a*x + b*y = c
- * d*x + e*y = f
- * is
- * denom = a*e - b*d
- * x = (c*e - b*f) / denom
- * y = (a*f - c*d) / denom
- */
- denom = dx3 * dy2 - dx2 * dy3;
- if ( fabs(denom) < 1.0e-6 )
- return -1; /* degenerate */
-
- t2 = ((px3 - px2) * (-dy3) - (-dx3) * (py3 - py2)) / denom;
- *pcx = px2 + t2 * dx2;
- *pcy = py2 + t2 * dy2;
- return 0;
+ /*
+ * Now find the intersections by solving for t2 or t3:
+ * px2 + t2 * dx2 = px3 + t3 * dx3
+ * py2 + t2 * dy2 = py3 + t3 * dy3
+ * i.e., in standard form,
+ * t2 * dx2 - t3 * dx3 = px3 - px2
+ * t2 * dy2 - t3 * dy3 = py3 - py2
+ * The solution of
+ * a*x + b*y = c
+ * d*x + e*y = f
+ * is
+ * denom = a*e - b*d
+ * x = (c*e - b*f) / denom
+ * y = (a*f - c*d) / denom
+ */
+ denom = dx3 * dy2 - dx2 * dy3;
+ if ( fabs(denom) < 1.0e-6 )
+ return -1; /* degenerate */
+
+ t2 = ((px3 - px2) * (-dy3) - (-dx3) * (py3 - py2)) / denom;
+ *pcx = px2 + t2 * dx2;
+ *pcy = py2 + t2 * dy2;
+ return 0;
}
/* compute the coordinates of a point on an arc */
int
hpgl_compute_arc_coords(floatp radius, floatp center_x, floatp center_y,
- floatp angle, floatp *px, floatp *py)
+ floatp angle, floatp *px, floatp *py)
{
- gs_sincos_t sincos;
- gs_sincos_degrees(angle, &sincos);
- *px = radius * sincos.cos + center_x;
- *py = radius * sincos.sin + center_y;
- return 0;
+ gs_sincos_t sincos;
+ gs_sincos_degrees(angle, &sincos);
+ *px = radius * sincos.cos + center_x;
+ *py = radius * sincos.sin + center_y;
+ return 0;
}
/* given a start point, angle (degrees) and magnitude of a vector compute its
endpoints */
int
hpgl_compute_vector_endpoints(floatp magnitude, floatp x, floatp y,
- floatp angle_degrees, floatp *endx, floatp *endy)
+ floatp angle_degrees, floatp *endx, floatp *endy)
{
- return hpgl_compute_arc_coords(magnitude, x, y,
- angle_degrees, endx, endy);
+ return hpgl_compute_arc_coords(magnitude, x, y,
+ angle_degrees, endx, endy);
}
diff --git a/pcl/pggeom.h b/pcl/pggeom.h
index be8d4532e..9d8f79a81 100644
--- a/pcl/pggeom.h
+++ b/pcl/pggeom.h
@@ -43,19 +43,19 @@ floatp hpgl_compute_angle(floatp dx, floatp dy);
/* compute the center of an arc given 3 points on the arc */
int hpgl_compute_arc_center(floatp x1, floatp y1, floatp x2,
- floatp y2, floatp x3, floatp y3,
- floatp *pcx, floatp *pcy);
+ floatp y2, floatp x3, floatp y3,
+ floatp *pcx, floatp *pcy);
/* compute the coordinates of a point on an arc */
int hpgl_compute_arc_coords(floatp radius, floatp center_x,
- floatp center_y, floatp angle,
- floatp *px, floatp *py);
+ floatp center_y, floatp angle,
+ floatp *px, floatp *py);
/* given a start point, angle (degrees) and magnitude of a vector compute its
endpoints */
int hpgl_compute_vector_endpoints(floatp magnitude, floatp x, floatp y,
- floatp angle_degrees, floatp *endx,
- floatp *endy);
+ floatp angle_degrees, floatp *endx,
+ floatp *endy);
/* ------ 3-point arcs ------ */
@@ -68,15 +68,15 @@ int hpgl_compute_vector_endpoints(floatp magnitude, floatp x, floatp y,
/* points are equal. HAS -- TEST for epsilon */
#define hpgl_3_same_points(x1, y1, x2, y2, x3, y3) \
- ((equal2((x1), (x2), (x2), (x3))) && (equal2((y1), (y2), (y2), (y3))))
+ ((equal2((x1), (x2), (x2), (x3))) && (equal2((y1), (y2), (y2), (y3))))
/* points are on the same line */
#define hpgl_3_colinear_points(x1, y1, x2, y2, x3, y3) \
- (equal(((y1) - (y3)) * ((x1) - (x2)), ((y1) - (y2)) * ((x1) - (x3))))
+ (equal(((y1) - (y3)) * ((x1) - (x2)), ((y1) - (y2)) * ((x1) - (x3))))
/* intermediate is the same as first point or last */
#define hpgl_3_no_intermediate(x1, y1, x2, y2, x3, y3) \
- ((equal2((x1), (x2), (y1), (y2))) || (equal2((x2), (x3), (y2), (y3))))
+ ((equal2((x1), (x2), (y1), (y2))) || (equal2((x2), (x3), (y2), (y3))))
/* intermediate lies between endpoints */
#define hpgl_3_intermediate_between(x1, y1, x2, y2, x3, y3) \
@@ -85,5 +85,5 @@ int hpgl_compute_vector_endpoints(floatp magnitude, floatp x, floatp y,
/* equal endpoints */
#define hpgl_3_same_endpoints(x1, y1, x2, y2, x3, y3) \
- (equal2((x1), (x3), (y1), (y3)))
+ (equal2((x1), (x3), (y1), (y3)))
#endif /* pggeom_INCLUDED */
diff --git a/pcl/pglabel.c b/pcl/pglabel.c
index 3391e6cd0..25f059d78 100644
--- a/pcl/pglabel.c
+++ b/pcl/pglabel.c
@@ -70,12 +70,12 @@ hpgl_is_currentfont_stick(const hpgl_state_t *pgls)
/* convert points 2 plu - agfa uses 72.307 points per inch */
static floatp
hpgl_points_2_plu(const hpgl_state_t *pgls, floatp points)
-{
+{
const pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
+ &pgls->g.font_selection[pgls->g.font_selected];
floatp ppi = 72.0;
if ( pfs->font->scaling_technology == plfst_Intellifont )
- ppi = 72.307;
+ ppi = 72.307;
return points * (1016.0 / ppi);
}
@@ -90,11 +90,11 @@ hpgl_is_printable(
bool is_stick,
bool transparent
)
-{
+{
if (transparent)
return true;
if ( is_stick )
- return (chr >= ' ') && (chr <= 0xff);
+ return (chr >= ' ') && (chr <= 0xff);
if ((psm == 0) || (psm->type >= 2))
return true;
else if (psm->type == 1)
@@ -107,11 +107,11 @@ hpgl_is_printable(
*/
static gs_char
hpgl_map_symbol(uint chr, const hpgl_state_t *pgls)
-{
+{
const pcl_font_selection_t *pfs =
&pgls->g.font_selection[pgls->g.font_selected];
const pl_symbol_map_t *psm = pfs->map;
-
+
return pl_map_symbol(psm, chr,
pfs->font->storage == pcds_internal,
pfs->font->font_type == plgv_MSL,
@@ -126,8 +126,8 @@ hpgl_select_font_pri_alt(hpgl_state_t *pgls, int index)
{
if ( pgls->g.font_selected != index ) {
hpgl_free_stick_fonts(pgls);
- pgls->g.font_selected = index;
- pgls->g.font = 0;
+ pgls->g.font_selected = index;
+ pgls->g.font = 0;
}
return;
}
@@ -137,10 +137,10 @@ static int hpgl_recompute_font(hpgl_state_t *pgls);
/* Ensure a font is available. */
static int
-hpgl_ensure_font(hpgl_state_t *pgls)
+hpgl_ensure_font(hpgl_state_t *pgls)
{
if ( ( pgls->g.font == 0 ) || ( pgls->g.font->pfont == 0 ) )
- hpgl_call(hpgl_recompute_font(pgls));
+ hpgl_call(hpgl_recompute_font(pgls));
return 0;
}
@@ -159,16 +159,15 @@ static const byte stick_character_complement[8] = {
static int
hpgl_select_stick_font(hpgl_state_t *pgls)
{ pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
- pl_font_t *font = &pgls->g.stick_font[pgls->g.font_selected]
- [pfs->params.proportional_spacing];
+ &pgls->g.font_selection[pgls->g.font_selected];
+ pl_font_t *font = &pgls->g.stick_font[pgls->g.font_selected]
+ [pfs->params.proportional_spacing];
gs_font_base *pfont;
int code;
- /* Create a gs_font if none has been created yet. */
+ /* Create a gs_font if none has been created yet. */
hpgl_free_stick_fonts(pgls);
- pfont = gs_alloc_struct(pgls->memory, gs_font_base, &st_gs_font_base,
- "stick/arc font");
-
+ pfont = gs_alloc_struct(pgls->memory, gs_font_base, &st_gs_font_base,
+ "stick/arc font");
if ( pfont == 0 )
return_error(e_Memory);
@@ -184,37 +183,37 @@ hpgl_select_stick_font(hpgl_state_t *pgls)
font->scaling_technology = plfst_TrueType;/****** WRONG ******/
font->font_type = plft_Unicode;
memcpy(font->character_complement, stick_character_complement, 8);
- /*
- * The stick/arc font is protean: set its proportional spacing,
- * style, and stroke weight parameters to the requested ones.
- * We could fill in some of the other characteristics earlier,
- * but it's simpler to do it here.
- */
- font->params = pfs->params;
- font->params.typeface_family = STICK_FONT_TYPEFACE;
- /*
- * The stick font is defined in a cell that's only 2/3
- * the size of the actual character.
- */
- pl_fp_set_pitch_cp(&font->params, 1000.0*2/3);
- pfs->font = font;
- {
- byte id[2];
-
- id[0] = pfs->params.symbol_set >> 8;
- id[1] = pfs->params.symbol_set & 0xff;
- pfs->map = pcl_find_symbol_map(pgls,
- id, plgv_Unicode,
+ /*
+ * The stick/arc font is protean: set its proportional spacing,
+ * style, and stroke weight parameters to the requested ones.
+ * We could fill in some of the other characteristics earlier,
+ * but it's simpler to do it here.
+ */
+ font->params = pfs->params;
+ font->params.typeface_family = STICK_FONT_TYPEFACE;
+ /*
+ * The stick font is defined in a cell that's only 2/3
+ * the size of the actual character.
+ */
+ pl_fp_set_pitch_cp(&font->params, 1000.0*2/3);
+ pfs->font = font;
+ {
+ byte id[2];
+
+ id[0] = pfs->params.symbol_set >> 8;
+ id[1] = pfs->params.symbol_set & 0xff;
+ pfs->map = pcl_find_symbol_map(pgls,
+ id, plgv_Unicode,
font->font_type == plft_16bit);
- }
- return 0;
+ }
+ return 0;
}
/* Check whether the stick font supports a given symbol set. */
static bool
hpgl_stick_font_supports(const pcl_state_t *pcs, uint symbol_set)
-{
- pl_glyph_vocabulary_t gv =
+{
+ pl_glyph_vocabulary_t gv =
pl_complement_to_vocab(stick_character_complement);
byte id[2];
pl_symbol_map_t *map;
@@ -231,45 +230,45 @@ hpgl_stick_font_supports(const pcl_state_t *pcs, uint symbol_set)
static int
hpgl_recompute_font(hpgl_state_t *pgls)
{ pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
-
- if (( ((pfs->params.typeface_family & 0xfff) == STICK_FONT_TYPEFACE ||
- (pfs->params.typeface_family & 0xfff) == ARC_FONT_TYPEFACE )
- && pfs->params.style == 0 /* upright */
- && hpgl_stick_font_supports(pgls,
- pfs->params.symbol_set))
- /* rtl only has stick fonts */
- || ( pgls->personality == rtl )
- )
- hpgl_call(hpgl_select_stick_font(pgls));
- else
+ &pgls->g.font_selection[pgls->g.font_selected];
+
+ if (( ((pfs->params.typeface_family & 0xfff) == STICK_FONT_TYPEFACE ||
+ (pfs->params.typeface_family & 0xfff) == ARC_FONT_TYPEFACE )
+ && pfs->params.style == 0 /* upright */
+ && hpgl_stick_font_supports(pgls,
+ pfs->params.symbol_set))
+ /* rtl only has stick fonts */
+ || ( pgls->personality == rtl )
+ )
+ hpgl_call(hpgl_select_stick_font(pgls));
+ else
{ int code = pcl_reselect_font(pfs, pgls, false);
- if ( code < 0 )
- return code;
- }
- pgls->g.font = pfs->font;
- pgls->g.map = pfs->map;
- return pl_load_resident_font_data_from_file(pgls->memory, pfs->font);
+ if ( code < 0 )
+ return code;
+ }
+ pgls->g.font = pfs->font;
+ pgls->g.map = pfs->map;
+ return pl_load_resident_font_data_from_file(pgls->memory, pfs->font);
}
/* ------ Position management ------ */
/* accessor for character extra space takes line feed direction into account */
static inline hpgl_real_t
-hpgl_get_character_extra_space_x(const hpgl_state_t *pgls)
+hpgl_get_character_extra_space_x(const hpgl_state_t *pgls)
{
- return (pgls->g.character.line_feed_direction < 0) ?
- pgls->g.character.extra_space.y :
- pgls->g.character.extra_space.x;
+ return (pgls->g.character.line_feed_direction < 0) ?
+ pgls->g.character.extra_space.y :
+ pgls->g.character.extra_space.x;
}
static inline hpgl_real_t
-hpgl_get_character_extra_space_y(const hpgl_state_t *pgls)
+hpgl_get_character_extra_space_y(const hpgl_state_t *pgls)
{
- return (pgls->g.character.line_feed_direction < 0) ?
- pgls->g.character.extra_space.x :
- pgls->g.character.extra_space.y;
+ return (pgls->g.character.line_feed_direction < 0) ?
+ pgls->g.character.extra_space.x :
+ pgls->g.character.extra_space.y;
}
/* Get a character width in the current font, plus extra space if any. */
@@ -279,12 +278,12 @@ hpgl_get_char_width(const hpgl_state_t *pgls, gs_char ch, hpgl_real_t *width)
{
gs_glyph glyph = hpgl_map_symbol(ch, pgls);
const pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
+ &pgls->g.font_selection[pgls->g.font_selected];
int code = 0;
gs_point gs_width;
if ( pgls->g.character.size_mode == hpgl_size_not_set ) {
- if ( pfs->params.proportional_spacing ) {
- code = pl_font_char_width(pfs->font, (void *)(pgls->pgs), glyph, &gs_width);
+ if ( pfs->params.proportional_spacing ) {
+ code = pl_font_char_width(pfs->font, (void *)(pgls->pgs), glyph, &gs_width);
/* hack until this code gets written properly, the
following should amount to a percentage of the
em-square the space character would occupy... */
@@ -292,47 +291,47 @@ hpgl_get_char_width(const hpgl_state_t *pgls, gs_char ch, hpgl_real_t *width)
gs_width.y = 0;
gs_width.x = pl_fp_pitch_cp(&pfs->font->params) / 1000.0;
}
-
- if ( !pl_font_is_scalable(pfs->font) ) {
- if ( code == 0 )
- *width = gs_width.x * inches_2_plu(1.0 / pfs->font->resolution.x);
- else
- *width = coord_2_plu(pl_fp_pitch_cp(&pfs->font->params));
- goto add;
- }
- else if ( code >= 0 ) {
- *width = gs_width.x * hpgl_points_2_plu(pgls, pfs->params.height_4ths / 4.0);
- goto add;
- }
- code = 1;
- }
- *width = hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) / 100.0);
+
+ if ( !pl_font_is_scalable(pfs->font) ) {
+ if ( code == 0 )
+ *width = gs_width.x * inches_2_plu(1.0 / pfs->font->resolution.x);
+ else
+ *width = coord_2_plu(pl_fp_pitch_cp(&pfs->font->params));
+ goto add;
+ }
+ else if ( code >= 0 ) {
+ *width = gs_width.x * hpgl_points_2_plu(pgls, pfs->params.height_4ths / 4.0);
+ goto add;
+ }
+ code = 1;
+ }
+ *width = hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) / 100.0);
} else {
- *width = pgls->g.character.size.x;
- if (pgls->g.character.size_mode == hpgl_size_relative)
- *width *= pgls->g.P2.x - pgls->g.P1.x;
+ *width = pgls->g.character.size.x;
+ if (pgls->g.character.size_mode == hpgl_size_relative)
+ *width *= pgls->g.P2.x - pgls->g.P1.x;
}
- add:
+ add:
if ( hpgl_get_character_extra_space_x(pgls) != 0 ) {
- /* Add extra space. */
- if ( pfs->params.proportional_spacing && ch != ' ' ) {
- /* Get the width of the space character. */
- int scode =
- pl_font_char_width(pfs->font, (void *)(pgls->pgs), hpgl_map_symbol(' ', pgls), &gs_width);
- hpgl_real_t extra;
-
- if ( scode >= 0 )
- extra = gs_width.x * hpgl_points_2_plu(pgls, pfs->params.height_4ths / 4.0);
- else
- extra = hpgl_points_2_plu(pgls, (pl_fp_pitch_cp(&pfs->params)) / 10.0);
- *width += extra * hpgl_get_character_extra_space_x(pgls);
- } else {
- /* All characters have the same width, */
- /* or we're already getting the width of a space. */
- *width *= 1.0 + hpgl_get_character_extra_space_x(pgls);
- }
+ /* Add extra space. */
+ if ( pfs->params.proportional_spacing && ch != ' ' ) {
+ /* Get the width of the space character. */
+ int scode =
+ pl_font_char_width(pfs->font, (void *)(pgls->pgs), hpgl_map_symbol(' ', pgls), &gs_width);
+ hpgl_real_t extra;
+
+ if ( scode >= 0 )
+ extra = gs_width.x * hpgl_points_2_plu(pgls, pfs->params.height_4ths / 4.0);
+ else
+ extra = hpgl_points_2_plu(pgls, (pl_fp_pitch_cp(&pfs->params)) / 10.0);
+ *width += extra * hpgl_get_character_extra_space_x(pgls);
+ } else {
+ /* All characters have the same width, */
+ /* or we're already getting the width of a space. */
+ *width *= 1.0 + hpgl_get_character_extra_space_x(pgls);
+ }
}
return code;
}
@@ -341,13 +340,13 @@ hpgl_get_char_width(const hpgl_state_t *pgls, gs_char ch, hpgl_real_t *width)
static int
hpgl_get_current_cell_height(const hpgl_state_t *pgls, hpgl_real_t *height)
{
- const pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
+ const pcl_font_selection_t *pfs =
+ &pgls->g.font_selection[pgls->g.font_selected];
if ( pfs->font->scaling_technology != plfst_bitmap ) {
gs_point scale = hpgl_current_char_scale(pgls);
*height = fabs(scale.y);
- } else {
+ } else {
/* NB temporary not correct */
*height = hpgl_points_2_plu(pgls, pfs->params.height_4ths / 4.0);
}
@@ -369,10 +368,9 @@ hpgl_get_current_cell_height(const hpgl_state_t *pgls, hpgl_real_t *height)
else
*height *= .898;
}
-
- *height *= 1.0 + hpgl_get_character_extra_space_y(pgls);
- return 0;
+ *height *= 1.0 + hpgl_get_character_extra_space_y(pgls);
+ return 0;
}
/* distance tranformation for character slant */
@@ -380,11 +378,11 @@ static int
hpgl_slant_transform_distance(hpgl_state_t *pgls, gs_point *dxy, gs_point *s_dxy)
{
if ( pgls->g.character.slant && !pgls->g.bitmap_fonts_allowed ) {
- gs_matrix smat;
- gs_point tmp_dxy = *dxy;
- gs_make_identity(&smat);
- smat.yx = pgls->g.character.slant;
- hpgl_call(gs_distance_transform(tmp_dxy.x, tmp_dxy.y, &smat, s_dxy));
+ gs_matrix smat;
+ gs_point tmp_dxy = *dxy;
+ gs_make_identity(&smat);
+ smat.yx = pgls->g.character.slant;
+ hpgl_call(gs_distance_transform(tmp_dxy.x, tmp_dxy.y, &smat, s_dxy));
}
return 0;
}
@@ -396,15 +394,15 @@ hpgl_rotation_transform_distance(hpgl_state_t *pgls, gs_point *dxy, gs_point *r_
double run = pgls->g.character.direction.x;
double rise = pgls->g.character.direction.y;
if ( rise != 0 ) {
- double denom = hypot(run, rise);
- gs_point tmp_dxy = *dxy;
- gs_matrix rmat;
- gs_make_identity(&rmat);
- rmat.xx = run / denom;
- rmat.xy = rise / denom;
- rmat.yx = -rmat.xy;
- rmat.yy = rmat.xx;
- hpgl_call(gs_distance_transform(tmp_dxy.x, tmp_dxy.y, &rmat, r_dxy));
+ double denom = hypot(run, rise);
+ gs_point tmp_dxy = *dxy;
+ gs_matrix rmat;
+ gs_make_identity(&rmat);
+ rmat.xx = run / denom;
+ rmat.xy = rise / denom;
+ rmat.yx = -rmat.xy;
+ rmat.yy = rmat.xx;
+ hpgl_call(gs_distance_transform(tmp_dxy.x, tmp_dxy.y, &rmat, r_dxy));
}
return 0;
}
@@ -424,28 +422,28 @@ hpgl_move_cursor_by_characters(hpgl_state_t *pgls, hpgl_real_t spaces,
lines *= pgls->g.character.line_feed_direction;
/* For vertical text paths, we have to swap spaces and lines. */
switch ( pgls->g.character.text_path )
- {
- case hpgl_text_right:
- nx = spaces, ny = lines; break;
- case hpgl_text_down:
- nx = lines, ny = -spaces; break;
- case hpgl_text_left:
- nx = -spaces, ny = -lines; break;
- case hpgl_text_up:
- nx = -lines, ny = spaces; break;
- }
+ {
+ case hpgl_text_right:
+ nx = spaces, ny = lines; break;
+ case hpgl_text_down:
+ nx = lines, ny = -spaces; break;
+ case hpgl_text_left:
+ nx = -spaces, ny = -lines; break;
+ case hpgl_text_up:
+ nx = -lines, ny = spaces; break;
+ }
/* calculate the next label position in relative coordinates. */
if ( nx != 0 ) {
- hpgl_real_t width;
- if ( pwidth != 0 )
- width = *pwidth;
- else
- hpgl_get_char_width(pgls, ' ', &width);
- dx = width * nx;
+ hpgl_real_t width;
+ if ( pwidth != 0 )
+ width = *pwidth;
+ else
+ hpgl_get_char_width(pgls, ' ', &width);
+ dx = width * nx;
}
if ( ny != 0 ) {
- hpgl_real_t height;
- hpgl_call(hpgl_get_current_cell_height(pgls, &height));
+ hpgl_real_t height;
+ hpgl_call(hpgl_get_current_cell_height(pgls, &height));
dy = ny * height;
}
@@ -456,31 +454,31 @@ hpgl_move_cursor_by_characters(hpgl_state_t *pgls, hpgl_real_t spaces,
* sizing, we have to convert the deltas to user units.
*/
if ( pgls->g.scaling_type != hpgl_scaling_none )
- {
- gs_matrix mat;
- gs_point user_dxy;
- hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &mat));
- hpgl_call(gs_distance_transform_inverse(dx, dy, &mat, &user_dxy));
- dx = user_dxy.x;
- dy = user_dxy.y;
- }
+ {
+ gs_matrix mat;
+ gs_point user_dxy;
+ hpgl_call(hpgl_compute_user_units_to_plu_ctm(pgls, &mat));
+ hpgl_call(gs_distance_transform_inverse(dx, dy, &mat, &user_dxy));
+ dx = user_dxy.x;
+ dy = user_dxy.y;
+ }
{
- gs_point dxy;
- dxy.x = dx;
- dxy.y = dy;
- hpgl_rotation_transform_distance(pgls, &dxy, &dxy);
- dx = dxy.x;
- dy = dxy.y;
+ gs_point dxy;
+ dxy.x = dx;
+ dxy.y = dy;
+ hpgl_rotation_transform_distance(pgls, &dxy, &dxy);
+ dx = dxy.x;
+ dy = dxy.y;
}
/* a relative move to the new position */
hpgl_call(hpgl_add_point_to_path(pgls, dx, dy,
- hpgl_plot_move_relative, true));
+ hpgl_plot_move_relative, true));
- if ( lines != 0 ) {
- /* update the position of the carriage return point */
- pgls->g.carriage_return_pos.x += dx;
- pgls->g.carriage_return_pos.y += dy;
+ if ( lines != 0 ) {
+ /* update the position of the carriage return point */
+ pgls->g.carriage_return_pos.x += dx;
+ pgls->g.carriage_return_pos.y += dy;
}
/* free any selected stick fonts */
hpgl_free_stick_fonts(pgls);
@@ -490,34 +488,34 @@ hpgl_move_cursor_by_characters(hpgl_state_t *pgls, hpgl_real_t spaces,
/* Execute a CR for CP or LB. */
static int
hpgl_do_CR(hpgl_state_t *pgls)
-{
+{
return hpgl_add_point_to_path(pgls, pgls->g.carriage_return_pos.x,
- pgls->g.carriage_return_pos.y,
- hpgl_plot_move_absolute,
- true);
+ pgls->g.carriage_return_pos.y,
+ hpgl_plot_move_absolute,
+ true);
}
/* CP [spaces,lines]; */
/* CP [;] */
int
hpgl_CP(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- hpgl_real_t spaces, lines;
-
- if ( hpgl_arg_c_real(pgls->memory, pargs, &spaces) )
- {
- if ( !hpgl_arg_c_real(pgls->memory, pargs, &lines) )
- return e_Range;
- }
- else
- {
- /* if there are no arguments a carriage return and line feed
- is executed */
- hpgl_call(hpgl_do_CR(pgls));
- spaces = 0, lines = -1;
- }
- return hpgl_move_cursor_by_characters(pgls, spaces, lines,
- (const hpgl_real_t *)0);
+{
+ hpgl_real_t spaces, lines;
+
+ if ( hpgl_arg_c_real(pgls->memory, pargs, &spaces) )
+ {
+ if ( !hpgl_arg_c_real(pgls->memory, pargs, &lines) )
+ return e_Range;
+ }
+ else
+ {
+ /* if there are no arguments a carriage return and line feed
+ is executed */
+ hpgl_call(hpgl_do_CR(pgls));
+ spaces = 0, lines = -1;
+ }
+ return hpgl_move_cursor_by_characters(pgls, spaces, lines,
+ (const hpgl_real_t *)0);
}
/* ------ Label buffer management ------ */
@@ -528,48 +526,48 @@ hpgl_CP(hpgl_args_t *pargs, hpgl_state_t *pgls)
static int
hpgl_init_label_buffer(hpgl_state_t *pgls)
{
- pgls->g.label.char_count = 0;
- pgls->g.label.buffer_size = hpgl_char_count;
- return ((pgls->g.label.buffer =
- gs_alloc_bytes(pgls->memory, hpgl_char_count,
- "hpgl_init_label_buffer")) == 0 ?
- e_Memory :
- 0);
+ pgls->g.label.char_count = 0;
+ pgls->g.label.buffer_size = hpgl_char_count;
+ return ((pgls->g.label.buffer =
+ gs_alloc_bytes(pgls->memory, hpgl_char_count,
+ "hpgl_init_label_buffer")) == 0 ?
+ e_Memory :
+ 0);
}
/* release the character buffer */
static int
hpgl_destroy_label_buffer(hpgl_state_t *pgls)
{
- gs_free_object(pgls->memory, pgls->g.label.buffer,
- "hpgl_destroy_label_buffer");
- pgls->g.label.char_count = 0;
- pgls->g.label.buffer_size = 0;
- pgls->g.label.buffer = 0;
- return 0;
+ gs_free_object(pgls->memory, pgls->g.label.buffer,
+ "hpgl_destroy_label_buffer");
+ pgls->g.label.char_count = 0;
+ pgls->g.label.buffer_size = 0;
+ pgls->g.label.buffer = 0;
+ return 0;
}
/* add a single character to the line buffer */
static int
hpgl_buffer_char(hpgl_state_t *pgls, byte ch)
{
- /* check if there is room for the new character and resize if
+ /* check if there is room for the new character and resize if
necessary */
- if ( pgls->g.label.buffer_size == pgls->g.label.char_count )
- { /* Resize the label buffer, currently by doubling its size. */
- uint new_size = pgls->g.label.buffer_size << 1;
- byte *new_mem =
- gs_resize_object(pgls->memory, pgls->g.label.buffer, new_size,
- "hpgl_resize_label_buffer");
-
- if ( new_mem == 0 )
- return_error(e_Memory);
- pgls->g.label.buffer = new_mem;
- pgls->g.label.buffer_size = new_size;
- }
- /* store the character */
- pgls->g.label.buffer[pgls->g.label.char_count++] = ch;
- return 0;
+ if ( pgls->g.label.buffer_size == pgls->g.label.char_count )
+ { /* Resize the label buffer, currently by doubling its size. */
+ uint new_size = pgls->g.label.buffer_size << 1;
+ byte *new_mem =
+ gs_resize_object(pgls->memory, pgls->g.label.buffer, new_size,
+ "hpgl_resize_label_buffer");
+
+ if ( new_mem == 0 )
+ return_error(e_Memory);
+ pgls->g.label.buffer = new_mem;
+ pgls->g.label.buffer_size = new_size;
+ }
+ /* store the character */
+ pgls->g.label.buffer[pgls->g.label.char_count++] = ch;
+ return 0;
}
/*
@@ -589,16 +587,16 @@ hpgl_use_show(hpgl_state_t *pgls, pl_font_t *pfont)
world */
if (pgls->g.source_transparent == 0 && pfont->scaling_technology != plfst_bitmap)
return false;
-
+
/* Show cannot be used if CF is not default since the character
may require additional processing by the line drawing code. */
if ( (pgls->g.character.fill_mode == 0 && pgls->g.character.edge_pen == 0) ||
(pfont->scaling_technology == plfst_bitmap) )
- return true;
+ return true;
else
- return false;
+ return false;
}
-
+
/* get the scaling factors for a gl/2 character */
gs_point
hpgl_current_char_scale(const hpgl_state_t *pgls)
@@ -609,7 +607,7 @@ hpgl_current_char_scale(const hpgl_state_t *pgls)
bool bitmaps_allowed = pgls->g.bitmap_fonts_allowed;
gs_point scale;
-
+
if (pgls->g.character.size_mode == hpgl_size_not_set || font->scaling_technology == plfst_bitmap) {
if (font->scaling_technology == plfst_bitmap) {
scale.x = inches_2_plu(1.0 / font->resolution.x);
@@ -646,7 +644,7 @@ hpgl_current_char_scale(const hpgl_state_t *pgls)
scale.y = pgls->g.character.size.y * 1.5;
if (pgls->g.character.size_mode == hpgl_size_relative)
scale.x *= pgls->g.P2.x - pgls->g.P1.x,
- scale.y *= pgls->g.P2.y - pgls->g.P1.y;
+ scale.y *= pgls->g.P2.y - pgls->g.P1.y;
if (bitmaps_allowed) /* no mirroring */
scale.x = fabs(scale.x), scale.y = fabs(scale.y);
}
@@ -664,7 +662,7 @@ hpgl_print_char(
{
int text_path = pgls->g.character.text_path;
const pcl_font_selection_t * pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
+ &pgls->g.font_selection[pgls->g.font_selected];
pl_font_t * font = pfs->font;
gs_state * pgs = pgls->pgs;
gs_matrix save_ctm;
@@ -677,7 +675,7 @@ hpgl_print_char(
hpgl_call( hpgl_add_point_to_path( pgls,
pgls->g.pos.x,
pgls->g.pos.y,
- hpgl_plot_move_absolute,
+ hpgl_plot_move_absolute,
true
) );
hpgl_call(gs_currentmatrix(pgs, &save_ctm));
@@ -690,17 +688,17 @@ hpgl_print_char(
/* ?? WRONG and UGLY */
{
float metrics[4];
- if ( (pl_font_char_metrics(font, (void *)(pgls->pgs),
+ if ( (pl_font_char_metrics(font, (void *)(pgls->pgs),
hpgl_map_symbol(ch, pgls), metrics)) == 1)
ch = ' ';
}
- /*
- * If we're using a stroked font, patch the pen width to reflect
- * the stroke weight. Note that when the font's build_char
- * procedure calls stroke, the CTM is still scaled.
- ****** WHAT IF scale.x != scale.y? ****** this should be unnecessary.
- */
+ /*
+ * If we're using a stroked font, patch the pen width to reflect
+ * the stroke weight. Note that when the font's build_char
+ * procedure calls stroke, the CTM is still scaled.
+ ****** WHAT IF scale.x != scale.y? ****** this should be unnecessary.
+ */
if (pfont->PaintType != 0) {
const float * widths = pcl_palette_get_pen_widths(pgls->ppalet);
@@ -718,7 +716,6 @@ hpgl_print_char(
gs_setlinewidth(pgs, nwidth * (72.0/1016.0));
}
-
/*
* We know that the drawing machinery only sets the CTM
* once, at the beginning of the path. We now impose the scale
@@ -731,153 +728,153 @@ hpgl_print_char(
bool use_show = hpgl_use_show(pgls, font);
gs_matrix pre_rmat, rmat, advance_mat;
int angle = -1; /* a multiple of 90 if used */
- gs_text_enum_t *penum;
+ gs_text_enum_t *penum;
byte str[2];
int code;
gs_point start_pt, end_pt;
- hpgl_real_t space_width;
- int space_code;
- hpgl_real_t width;
+ hpgl_real_t space_width;
+ int space_code;
+ hpgl_real_t width;
- /* Handle size. */
+ /* Handle size. */
- gs_scale(pgs, scale.x, scale.y);
- /* Handle rotation. */
- {
+ gs_scale(pgs, scale.x, scale.y);
+ /* Handle rotation. */
+ {
double run = pgls->g.character.direction.x,
- rise = pgls->g.character.direction.y;
+ rise = pgls->g.character.direction.y;
/* gl/2 bitmap fonts are scaled in a left handed coordinate
system - so the "rise" direction is opposite. */
if (font->scaling_technology == plfst_bitmap)
rise *= -1;
-
- if (pgls->g.character.direction_relative)
- run *= pgls->g.P2.x - pgls->g.P1.x,
- rise *= pgls->g.P2.y - pgls->g.P1.y;
- gs_make_identity(&rmat);
- if ((run < 0) || (rise != 0)) {
+
+ if (pgls->g.character.direction_relative)
+ run *= pgls->g.P2.x - pgls->g.P1.x,
+ rise *= pgls->g.P2.y - pgls->g.P1.y;
+ gs_make_identity(&rmat);
+ if ((run < 0) || (rise != 0)) {
double denom = hypot(run, rise);
- rmat.xx = run / denom;
- rmat.xy = rise / denom;
- rmat.yx = -rmat.xy;
- rmat.yy = rmat.xx;
- if ( bitmaps_allowed &&
- (run != 0) &&
+ rmat.xx = run / denom;
+ rmat.xy = rise / denom;
+ rmat.yx = -rmat.xy;
+ rmat.yy = rmat.xx;
+ if ( bitmaps_allowed &&
+ (run != 0) &&
(rise != 0) ) { /* not a multple of 90 degrees */
- /*
- * If bitmap fonts are allowed, rotate to the nearest
- * multiple of 90 degrees. We have to do something
- * special at the end to create the correct escapement.
- */
- gs_currentmatrix(pgs, &pre_rmat);
- if (run >= 0) {
- if (rise >= 0)
- angle = (run >= rise ? 0 : 90);
- else
- angle = (-rise >= run ? 270 : 0);
- } else {
- if (rise >= 0)
- angle = (rise >= -run ? 90 : 180);
- else
- angle = (-run >= -rise ? 180 : 270);
- }
- }
- gs_concat(pgs, &rmat);
- }
+ /*
+ * If bitmap fonts are allowed, rotate to the nearest
+ * multiple of 90 degrees. We have to do something
+ * special at the end to create the correct escapement.
+ */
+ gs_currentmatrix(pgs, &pre_rmat);
+ if (run >= 0) {
+ if (rise >= 0)
+ angle = (run >= rise ? 0 : 90);
+ else
+ angle = (-rise >= run ? 270 : 0);
+ } else {
+ if (rise >= 0)
+ angle = (rise >= -run ? 90 : 180);
+ else
+ angle = (-run >= -rise ? 180 : 270);
+ }
+ }
+ gs_concat(pgs, &rmat);
+ }
}
- /* Handle slant. */
- if (pgls->g.character.slant && !bitmaps_allowed) {
+ /* Handle slant. */
+ if (pgls->g.character.slant && !bitmaps_allowed) {
gs_matrix smat;
- gs_make_identity(&smat);
- smat.yx = pgls->g.character.slant;
- gs_concat(pgs, &smat);
- }
+ gs_make_identity(&smat);
+ smat.yx = pgls->g.character.slant;
+ gs_concat(pgs, &smat);
+ }
- gs_setfont(pgs, pfont);
+ gs_setfont(pgs, pfont);
pfont->FontMatrix = pfont->orig_FontMatrix;
- /*
- * Adjust the initial position of the character according to
- * the text path. And the left side bearing. It appears
- * HPGL/2 renders all characters without a left side bearing.
- */
- hpgl_call(gs_currentpoint(pgs, &start_pt));
- if (text_path == hpgl_text_left) {
+ /*
+ * Adjust the initial position of the character according to
+ * the text path. And the left side bearing. It appears
+ * HPGL/2 renders all characters without a left side bearing.
+ */
+ hpgl_call(gs_currentpoint(pgs, &start_pt));
+ if (text_path == hpgl_text_left) {
hpgl_get_char_width(pgls, ch, &width);
- start_pt.x -= width / scale.x;
- hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x, start_pt.y,
- hpgl_plot_move_absolute, false));
+ start_pt.x -= width / scale.x;
+ hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x, start_pt.y,
+ hpgl_plot_move_absolute, false));
- }
+ }
- /*
- * Reset the rotation if we're using a bitmap font.
- */
- gs_currentmatrix(pgs, &advance_mat);
- if (angle >= 0) {
+ /*
+ * Reset the rotation if we're using a bitmap font.
+ */
+ gs_currentmatrix(pgs, &advance_mat);
+ if (angle >= 0) {
gs_setmatrix(pgs, &pre_rmat);
- gs_rotate(pgs, (floatp)angle);
- }
+ gs_rotate(pgs, (floatp)angle);
+ }
- str[0] = ch;
- str[1] = 0;
+ str[0] = ch;
+ str[1] = 0;
- /* If SP is a control code, get the width of the space character. */
- if (ch == ' ') {
+ /* If SP is a control code, get the width of the space character. */
+ if (ch == ' ') {
space_code = hpgl_get_char_width(pgls, ' ', &space_width);
-
- if ( 0 == space_code &&
- pl_font_is_scalable(font) &&
- pfs->params.proportional_spacing )
- space_code = 1; /* NB hpgl_get_width lies. */
- if (space_code == 1) {
+ if ( 0 == space_code &&
+ pl_font_is_scalable(font) &&
+ pfs->params.proportional_spacing )
+ space_code = 1; /* NB hpgl_get_width lies. */
+
+ if (space_code == 1) {
/* Space is a control code. */
- if ( pl_font_is_scalable(font) ) {
- if (pfs->params.proportional_spacing)
- space_width =
- (coord_2_plu((pl_fp_pitch_cp(&pfs->font->params) / 10)
- * pfs->params.height_4ths / 4) ) / scale.x;
- else
- space_width = 1.0;
- /* error! NB scalable fixed pitch space_code == 0 */
- } else
- space_width =
+ if ( pl_font_is_scalable(font) ) {
+ if (pfs->params.proportional_spacing)
+ space_width =
+ (coord_2_plu((pl_fp_pitch_cp(&pfs->font->params) / 10)
+ * pfs->params.height_4ths / 4) ) / scale.x;
+ else
+ space_width = 1.0;
+ /* error! NB scalable fixed pitch space_code == 0 */
+ } else
+ space_width =
coord_2_plu(pl_fp_pitch_cp(&pfs->font->params)) / scale.x;
- space_width *= (1.0 + hpgl_get_character_extra_space_x(pgls));
+ space_width *= (1.0 + hpgl_get_character_extra_space_x(pgls));
}
- }
+ }
- /* Check for SP control code. */
- if (ch == ' ' && space_code != 0) {
+ /* Check for SP control code. */
+ if (ch == ' ' && space_code != 0) {
/* Space is a control code. Just advance the position. */
- gs_setmatrix(pgs, &advance_mat);
- hpgl_call(hpgl_add_point_to_path(pgls, space_width, 0.0,
- hpgl_plot_move_relative, false));
- hpgl_call(gs_currentpoint(pgs, &end_pt));
+ gs_setmatrix(pgs, &advance_mat);
+ hpgl_call(hpgl_add_point_to_path(pgls, space_width, 0.0,
+ hpgl_plot_move_relative, false));
+ hpgl_call(gs_currentpoint(pgs, &end_pt));
/* at this point we will assume the page is marked */
pgls->page_marked = true;
- } else {
+ } else {
gs_text_params_t text;
gs_char mychar_buff[1];
mychar_buff[0] = hpgl_map_symbol(ch, pgls);
if (use_show) {
/* not a path that needs to be drawn by the hpgl/2
vector drawing code. */
- hpgl_call(hpgl_set_drawing_color(pgls, hpgl_rm_character));
+ hpgl_call(hpgl_set_drawing_color(pgls, hpgl_rm_character));
text.operation = TEXT_FROM_CHARS | TEXT_DO_DRAW | TEXT_RETURN_WIDTH;
- } else
+ } else
text.operation = TEXT_FROM_CHARS | TEXT_DO_TRUE_CHARPATH | TEXT_RETURN_WIDTH;
text.data.chars = mychar_buff;
/* always on char (gs_chars (ints)) at a time */
text.size = 1;
code = gs_text_begin(pgs, &text, pgls->memory, &penum);
- if ( code >= 0 )
- code = gs_text_process(penum);
+ if ( code >= 0 )
+ code = gs_text_process(penum);
if ( code >= 0 ) {
/* we just check the current position for
@@ -886,77 +883,77 @@ hpgl_print_char(
pcl_mark_page_for_current_pos(pgls);
gs_text_release(penum, "hpgl_print_char");
}
- if ( code < 0 )
- return code;
- gs_setmatrix(pgs, &advance_mat);
- if (angle >= 0) {
+ if ( code < 0 )
+ return code;
+ gs_setmatrix(pgs, &advance_mat);
+ if (angle >= 0) {
/* Compensate for bitmap font non-rotation. */
- if (text_path == hpgl_text_right) {
+ if (text_path == hpgl_text_right) {
hpgl_get_char_width(pgls, ch, &width);
- hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x + width / scale.x,
- start_pt.y, hpgl_plot_move_absolute, false));
- }
+ hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x + width / scale.x,
+ start_pt.y, hpgl_plot_move_absolute, false));
+ }
}
- hpgl_call(gs_currentpoint(pgs, &end_pt));
- if ( start_pt.x == end_pt.x && start_pt.y == end_pt.y ) {
- /* freetype doesn't move currentpoint in gs_show(),
- * since gs cache is not used. NB we don't support
- * freetype anymore is this necessary?
- */
- hpgl_get_char_width(pgls, ch, &width);
- hpgl_call(hpgl_add_point_to_path(pgls, width / scale.x, 0.0,
- hpgl_plot_move_relative, false));
- hpgl_call(gs_currentpoint(pgs, &end_pt));
- }
- if ( (text_path == hpgl_text_right) &&
- (hpgl_get_character_extra_space_x(pgls) != 0) ) {
- hpgl_get_char_width(pgls, ch, &width);
- end_pt.x = start_pt.x + width / scale.x;
- hpgl_call(hpgl_add_point_to_path(pgls, end_pt.x, end_pt.y, hpgl_plot_move_absolute, false));
- }
- }
- /*
- * Adjust the final position according to the text path.
- */
- switch (text_path) {
- case hpgl_text_right:
- break;
-
- case hpgl_text_down:
- {
+ hpgl_call(gs_currentpoint(pgs, &end_pt));
+ if ( start_pt.x == end_pt.x && start_pt.y == end_pt.y ) {
+ /* freetype doesn't move currentpoint in gs_show(),
+ * since gs cache is not used. NB we don't support
+ * freetype anymore is this necessary?
+ */
+ hpgl_get_char_width(pgls, ch, &width);
+ hpgl_call(hpgl_add_point_to_path(pgls, width / scale.x, 0.0,
+ hpgl_plot_move_relative, false));
+ hpgl_call(gs_currentpoint(pgs, &end_pt));
+ }
+ if ( (text_path == hpgl_text_right) &&
+ (hpgl_get_character_extra_space_x(pgls) != 0) ) {
+ hpgl_get_char_width(pgls, ch, &width);
+ end_pt.x = start_pt.x + width / scale.x;
+ hpgl_call(hpgl_add_point_to_path(pgls, end_pt.x, end_pt.y, hpgl_plot_move_absolute, false));
+ }
+ }
+ /*
+ * Adjust the final position according to the text path.
+ */
+ switch (text_path) {
+ case hpgl_text_right:
+ break;
+
+ case hpgl_text_down:
+ {
hpgl_real_t height;
- hpgl_call(hpgl_get_current_cell_height(pgls, &height));
+ hpgl_call(hpgl_get_current_cell_height(pgls, &height));
hpgl_call( hpgl_add_point_to_path(pgls, start_pt.x, end_pt.y - height / scale.y,
- hpgl_plot_move_absolute, false) );
+ hpgl_plot_move_absolute, false) );
- }
- break;
+ }
+ break;
- case hpgl_text_left:
- hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x, start_pt.y,
- hpgl_plot_move_absolute, false));
- break;
- case hpgl_text_up:
- {
+ case hpgl_text_left:
+ hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x, start_pt.y,
+ hpgl_plot_move_absolute, false));
+ break;
+ case hpgl_text_up:
+ {
hpgl_real_t height;
- hpgl_call(hpgl_get_current_cell_height(pgls, &height));
- hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x,
- end_pt.y + height / scale.y, hpgl_plot_move_absolute, false));
- }
- break;
- }
+ hpgl_call(hpgl_get_current_cell_height(pgls, &height));
+ hpgl_call(hpgl_add_point_to_path(pgls, start_pt.x,
+ end_pt.y + height / scale.y, hpgl_plot_move_absolute, false));
+ }
+ break;
+ }
- gs_setmatrix(pgs, &save_ctm);
- hpgl_call(gs_currentpoint(pgs, &end_pt));
- if (!use_show)
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_character));
+ gs_setmatrix(pgs, &save_ctm);
+ hpgl_call(gs_currentpoint(pgs, &end_pt));
+ if (!use_show)
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_character));
- hpgl_call( hpgl_add_point_to_path( pgls,
+ hpgl_call( hpgl_add_point_to_path( pgls,
end_pt.x,
end_pt.y,
- hpgl_plot_move_absolute,
+ hpgl_plot_move_absolute,
true
) );
}
@@ -969,22 +966,21 @@ hpgl_print_char(
static bool
hpgl_can_concat_labels(const hpgl_state_t *pgls)
{ /* The following is per TRM 23-78. */
- static const byte can_concat[22] = {
- 0, 9, 1, 3, 8, 0, 2, 12, 4, 6,
- 0, 9, 1, 3, 8, 0, 2, 12, 4, 6,
- 0, 9
- };
-
- return (can_concat[pgls->g.label.origin] &
- (1 << pgls->g.character.text_path)) != 0;
+ static const byte can_concat[22] = {
+ 0, 9, 1, 3, 8, 0, 2, 12, 4, 6,
+ 0, 9, 1, 3, 8, 0, 2, 12, 4, 6,
+ 0, 9
+ };
+
+ return (can_concat[pgls->g.label.origin] &
+ (1 << pgls->g.character.text_path)) != 0;
}
-
/* return relative coordinates to compensate for origin placement -- LO */
static int
hpgl_get_character_origin_offset(hpgl_state_t *pgls, int origin,
- hpgl_real_t width, hpgl_real_t height,
- gs_point *offset)
+ hpgl_real_t width, hpgl_real_t height,
+ gs_point *offset)
{
double pos_x = 0.0, pos_y = 0.0;
double off_x, off_y;
@@ -997,7 +993,7 @@ hpgl_get_character_origin_offset(hpgl_state_t *pgls, int origin,
adjusted_height /= 1.6;
if (hpgl_is_currentfont_stick(pgls))
adjusted_height /= 1.4;
-
+
/* offset values specified by the documentation */
if ( (origin >= 11 && origin <= 14) || (origin >= 16 && origin <= 19) ) {
if (hpgl_is_currentfont_stick(pgls)) {
@@ -1102,7 +1098,7 @@ hpgl_get_character_origin_offset(hpgl_state_t *pgls, int origin,
DO_NOTHING;
}
- {
+ {
gs_matrix mat;
hpgl_compute_user_units_to_plu_ctm(pgls, &mat);
offset->x /= mat.xx;
@@ -1117,7 +1113,7 @@ hpgl_next_char(hpgl_state_t *pgls, byte **ppb)
{
byte *pb = *ppb;
gs_char chr = *pb++;
-
+
if (pgls->g.label.double_byte)
chr = (chr << 8) + *pb++;
*ppb = pb;
@@ -1142,7 +1138,6 @@ hpgl_process_buffer(hpgl_state_t *pgls, gs_point *offset)
} else {
inc = 1;
}
-
/*
* NOTE: the two loops below must be consistent with each other!
@@ -1157,44 +1152,44 @@ hpgl_process_buffer(hpgl_state_t *pgls, gs_point *offset)
for ( i=0; i < pgls->g.label.char_count; i+=inc ) {
gs_char ch = hpgl_next_char(pgls, &b);
if ( ch < 0x20 && !pgls->g.transparent_data )
- switch (ch) {
- case BS :
+ switch (ch) {
+ case BS :
if ( width == 0.0 ) { /* BS as first char of string */
hpgl_call(hpgl_ensure_font(pgls));
hpgl_get_char_width(pgls, ' ', &width);
hpgl_call(hpgl_get_current_cell_height(pgls, &height));
- }
+ }
if ( vertical ) { /* Vertical text path, back up in Y. */
label_height -= height;
if ( label_height < 0.0 )
label_height = 0.0;
- } else { /* Horizontal text path, back up in X. */
+ } else { /* Horizontal text path, back up in X. */
label_length -= width;
if ( label_length < 0.0 )
label_length = 0.0;
}
continue;
- case LF :
- first_char_on_line = true;
- continue;
- case CR :
+ case LF :
+ first_char_on_line = true;
+ continue;
+ case CR :
continue;
- case FF :
+ case FF :
continue;
- case HT :
+ case HT :
hpgl_call(hpgl_ensure_font(pgls));
hpgl_get_char_width(pgls, ' ', &width);
width *= 5;
goto acc_ht;
- case SI :
+ case SI :
hpgl_select_font_pri_alt(pgls, 0);
continue;
- case SO :
+ case SO :
hpgl_select_font_pri_alt(pgls, 1);
continue;
- default :
+ default :
break;
- }
+ }
hpgl_call(hpgl_ensure_font(pgls));
hpgl_get_char_width(pgls, ch, &width);
acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
@@ -1208,7 +1203,7 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
} else { /* Horizontal text path: sum widths, take max of heights. */
label_length += width;
if ( height > label_height )
- label_height = height;
+ label_height = height;
}
}
hpgl_select_font_pri_alt(pgls, save_index);
@@ -1223,9 +1218,9 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
{
byte *b = pgls->g.label.buffer;
- for ( i = 0; i < pgls->g.label.char_count; i+=inc ) {
+ for ( i = 0; i < pgls->g.label.char_count; i+=inc ) {
gs_char ch = hpgl_next_char(pgls, &b);
- if ( ch < 0x20 && !pgls->g.transparent_data ) {
+ if ( ch < 0x20 && !pgls->g.transparent_data ) {
hpgl_real_t spaces, lines;
switch (ch) {
@@ -1238,7 +1233,7 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
* computed label (horizontal) width, not the width
* of a space.
*/
- if ( vertical ) {
+ if ( vertical ) {
const pcl_font_selection_t * pfs =
&pgls->g.font_selection[pgls->g.font_selected];
hpgl_real_t label_advance;
@@ -1257,7 +1252,7 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
/*** WRONG ****/
label_advance = hpgl_points_2_plu(pgls, pl_fp_pitch_cp(&pfs->params) /
((pl_fp_pitch_cp(&pfs->font->params)/10.0)));
- if ( hpgl_get_character_extra_space_x(pgls) != 0 )
+ if ( hpgl_get_character_extra_space_x(pgls) != 0 )
label_advance *= 1.0 + hpgl_get_character_extra_space_x(pgls);
} else {
/*
@@ -1266,7 +1261,7 @@ acc_ht: hpgl_call(hpgl_get_current_cell_height(pgls, &height));
*
*
* HACKS - I am not sure what this should be the
- * actual values ???
+ * actual values ???
*/
label_advance = pgls->g.character.size.x * 1.5 * 1.25;
if (pgls->g.character.size_mode == hpgl_size_relative)
@@ -1311,7 +1306,7 @@ print: {
it is printed as a space character */
const pcl_font_selection_t *pfs =
&pgls->g.font_selection[pgls->g.font_selected];
- if ( !hpgl_is_printable(pfs->map, ch,
+ if ( !hpgl_is_printable(pfs->map, ch,
(pfs->params.typeface_family & 0xfff) == STICK_FONT_TYPEFACE,
pgls->g.transparent_data) )
continue;
@@ -1324,22 +1319,21 @@ print: {
return 0;
}
-
/**
* used by hpgl_LB() to find the end of a label
- *
+ *
* 8bit and 16bit label terminator check
* (prev << 8) & curr -> 16 bit
* have_16bits allows per byte call with true on 16bit boundary.
- */
-static
+ */
+static
bool is_terminator( hpgl_state_t *pgls, byte prev, byte curr, bool have_16bits )
{
- return
- pgls->g.label.double_byte ?
- ( have_16bits && prev == 0 && curr == pgls->g.label.terminator ) :
- ( curr == pgls->g.label.terminator );
-}
+ return
+ pgls->g.label.double_byte ?
+ ( have_16bits && prev == 0 && curr == pgls->g.label.terminator ) :
+ ( curr == pgls->g.label.terminator );
+}
#define GL_LB_HAVE_16BITS (pgls->g.label.have_16bits)
#define GL_LB_CH (pgls->g.label.ch)
@@ -1349,50 +1343,50 @@ bool is_terminator( hpgl_state_t *pgls, byte prev, byte curr, bool have_16bits )
int
hpgl_LB(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ const byte *p = pargs->source.ptr;
- const byte *rlimit = pargs->source.limit;
- bool print_terminator = pgls->g.label.print_terminator;
-
- if ( pargs->phase == 0 )
- {
- /* initialize the character buffer and CTM first time only */
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- hpgl_call(hpgl_init_label_buffer(pgls));
- hpgl_call(hpgl_set_ctm(pgls));
- hpgl_call(hpgl_set_clipping_region(pgls, hpgl_rm_vector));
- pgls->g.label.initial_pos = pgls->g.pos;
+ const byte *rlimit = pargs->source.limit;
+ bool print_terminator = pgls->g.label.print_terminator;
+
+ if ( pargs->phase == 0 )
+ {
+ /* initialize the character buffer and CTM first time only */
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ hpgl_call(hpgl_init_label_buffer(pgls));
+ hpgl_call(hpgl_set_ctm(pgls));
+ hpgl_call(hpgl_set_clipping_region(pgls, hpgl_rm_vector));
+ pgls->g.label.initial_pos = pgls->g.pos;
GL_LB_HAVE_16BITS = true;
GL_LB_CH = 0xff;
- GL_LB_PREV_CH = 0xff; /* for two byte terminators */
- pargs->phase = 1;
- }
+ GL_LB_PREV_CH = 0xff; /* for two byte terminators */
+ pargs->phase = 1;
+ }
- while ( p < rlimit )
- {
+ while ( p < rlimit )
+ {
/* This is not ugly and unintuitive */
- GL_LB_HAVE_16BITS = !GL_LB_HAVE_16BITS;
- GL_LB_PREV_CH = GL_LB_CH;
- GL_LB_CH = *++p;
- if_debug1('I',
- (GL_LB_CH == '\\' ? " \\%c" : GL_LB_CH >= 33 && GL_LB_CH <= 126 ? " %c" :
- " \\%03o"),
- GL_LB_CH);
- if ( is_terminator(pgls, GL_LB_PREV_CH, GL_LB_CH, GL_LB_HAVE_16BITS) )
- {
- if ( !print_terminator )
- {
+ GL_LB_HAVE_16BITS = !GL_LB_HAVE_16BITS;
+ GL_LB_PREV_CH = GL_LB_CH;
+ GL_LB_CH = *++p;
+ if_debug1('I',
+ (GL_LB_CH == '\\' ? " \\%c" : GL_LB_CH >= 33 && GL_LB_CH <= 126 ? " %c" :
+ " \\%03o"),
+ GL_LB_CH);
+ if ( is_terminator(pgls, GL_LB_PREV_CH, GL_LB_CH, GL_LB_HAVE_16BITS) )
+ {
+ if ( !print_terminator )
+ {
gs_point lo_offsets;
- hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
- hpgl_call(hpgl_destroy_label_buffer(pgls));
- pargs->source.ptr = p;
- /*
- * Depending on the DV/LO combination, conditionally
- * restore the initial position, per TRM 23-78.
- */
- if ( !hpgl_can_concat_labels(pgls) ) {
- hpgl_call(hpgl_add_point_to_path(pgls,
- pgls->g.carriage_return_pos.x,
- pgls->g.carriage_return_pos.y,
- hpgl_plot_move_absolute, true));
+ hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
+ hpgl_call(hpgl_destroy_label_buffer(pgls));
+ pargs->source.ptr = p;
+ /*
+ * Depending on the DV/LO combination, conditionally
+ * restore the initial position, per TRM 23-78.
+ */
+ if ( !hpgl_can_concat_labels(pgls) ) {
+ hpgl_call(hpgl_add_point_to_path(pgls,
+ pgls->g.carriage_return_pos.x,
+ pgls->g.carriage_return_pos.y,
+ hpgl_plot_move_absolute, true));
} else {
/* undo the label origin offsets */
hpgl_call(hpgl_add_point_to_path(pgls, lo_offsets.x, lo_offsets.y,
@@ -1408,43 +1402,43 @@ hpgl_LB(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_free_stick_fonts(pgls);
return 0;
}
- /*
- * Process the character in the ordinary way, then come here
- * again. We do things this way to simplify the case where
- * the terminator is a control character.
- */
- --p;
- print_terminator = false;
- }
-
- /* process the buffer for a carriage return so that we can
+ /*
+ * Process the character in the ordinary way, then come here
+ * again. We do things this way to simplify the case where
+ * the terminator is a control character.
+ */
+ --p;
+ print_terminator = false;
+ }
+
+ /* process the buffer for a carriage return so that we can
treat the label origin correctly, and initialize a new
buffer */
- hpgl_call(hpgl_buffer_char(pgls, GL_LB_CH));
- if ( GL_LB_CH == CR && !pgls->g.transparent_data )
+ hpgl_call(hpgl_buffer_char(pgls, GL_LB_CH));
+ if ( GL_LB_CH == CR && !pgls->g.transparent_data )
{
gs_point lo_offsets;
- hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
- hpgl_call(hpgl_destroy_label_buffer(pgls));
- hpgl_call(hpgl_init_label_buffer(pgls));
- }
- }
- pargs->source.ptr = p;
- return e_NeedData;
+ hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
+ hpgl_call(hpgl_destroy_label_buffer(pgls));
+ hpgl_call(hpgl_init_label_buffer(pgls));
+ }
+ }
+ pargs->source.ptr = p;
+ return e_NeedData;
}
void
hpgl_free_stick_fonts(hpgl_state_t *pgls)
{
pcl_font_selection_t *pfs =
- &pgls->g.font_selection[pgls->g.font_selected];
+ &pgls->g.font_selection[pgls->g.font_selected];
pl_font_t *font = &pgls->g.stick_font[pgls->g.font_selected]
- [pfs->params.proportional_spacing];
+ [pfs->params.proportional_spacing];
/* no stick fonts - nothing to do */
if ( font->pfont == 0 )
- return;
+ return;
gs_free_object(pgls->memory, font->pfont, "stick/arc font");
font->pfont = 0;
@@ -1453,28 +1447,28 @@ hpgl_free_stick_fonts(hpgl_state_t *pgls)
int
hpgl_print_symbol_mode_char(hpgl_state_t *pgls)
-{
+{
/* save the original origin since symbol mode character are
always centered */
- int saved_origin = pgls->g.label.origin;
- gs_point save_pos = pgls->g.pos;
+ int saved_origin = pgls->g.label.origin;
+ gs_point save_pos = pgls->g.pos;
gs_point lo_offsets;
- hpgl_call(hpgl_gsave(pgls));
- /* HAS this need checking. I don't know how text direction
+ hpgl_call(hpgl_gsave(pgls));
+ /* HAS this need checking. I don't know how text direction
and label origin interact in symbol mode */
- pgls->g.label.origin = 5;
- /* HAS - alot of work for one character */
- hpgl_call(hpgl_clear_current_path(pgls));
- hpgl_call(hpgl_init_label_buffer(pgls));
- hpgl_call(hpgl_buffer_char(pgls, pgls->g.symbol_mode));
- hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
- hpgl_call(hpgl_destroy_label_buffer(pgls));
- hpgl_call(hpgl_grestore(pgls));
- /* restore the origin */
- pgls->g.label.origin = saved_origin;
- hpgl_call(hpgl_set_current_position(pgls, &save_pos));
+ pgls->g.label.origin = 5;
+ /* HAS - alot of work for one character */
+ hpgl_call(hpgl_clear_current_path(pgls));
+ hpgl_call(hpgl_init_label_buffer(pgls));
+ hpgl_call(hpgl_buffer_char(pgls, pgls->g.symbol_mode));
+ hpgl_call(hpgl_process_buffer(pgls, &lo_offsets));
+ hpgl_call(hpgl_destroy_label_buffer(pgls));
+ hpgl_call(hpgl_grestore(pgls));
+ /* restore the origin */
+ pgls->g.label.origin = saved_origin;
+ hpgl_call(hpgl_set_current_position(pgls, &save_pos));
hpgl_free_stick_fonts(pgls);
- return 0;
+ return 0;
}
/* Initialization */
@@ -1485,11 +1479,11 @@ pglabel_do_registration(
)
{ /* Register commands */
DEFINE_HPGL_COMMANDS(mem)
- HPGL_COMMAND('C', 'P', hpgl_CP, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- /* LB also has special argument parsing. */
- HPGL_COMMAND('L', 'B', hpgl_LB, hpgl_cdf_polygon|hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- END_HPGL_COMMANDS
- return 0;
+ HPGL_COMMAND('C', 'P', hpgl_CP, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ /* LB also has special argument parsing. */
+ HPGL_COMMAND('L', 'B', hpgl_LB, hpgl_cdf_polygon|hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ END_HPGL_COMMANDS
+ return 0;
}
const pcl_init_t pglabel_init = {
diff --git a/pcl/pglfill.c b/pcl/pglfill.c
index cab275e21..65b7a55ea 100644
--- a/pcl/pglfill.c
+++ b/pcl/pglfill.c
@@ -42,7 +42,7 @@ hpgl_AC(
if (hpgl_arg_units(pgls->memory, pargs, &x)) {
if (!hpgl_arg_units(pgls->memory, pargs, &y))
- return e_Range;
+ return e_Range;
} else {
x = 0.0;
y = 0.0;
@@ -80,102 +80,102 @@ hpgl_FT(
case hpgl_FT_pattern_solid_pen1: /* 1 */
case hpgl_FT_pattern_solid_pen2: /* 2 */
- /* Default all the parameters. */
- pgls->g.fill.param.hatch.spacing = 0;
- pgls->g.fill.param.hatch.angle = 0;
- pgls->g.fill.param.crosshatch.spacing = 0;
- pgls->g.fill.param.crosshatch.angle = 0;
- pgls->g.fill.param.shading = 100;
- pgls->g.fill.param.user_defined.pattern_index = 1;
+ /* Default all the parameters. */
+ pgls->g.fill.param.hatch.spacing = 0;
+ pgls->g.fill.param.hatch.angle = 0;
+ pgls->g.fill.param.crosshatch.spacing = 0;
+ pgls->g.fill.param.crosshatch.angle = 0;
+ pgls->g.fill.param.shading = 100;
+ pgls->g.fill.param.user_defined.pattern_index = 1;
pgls->g.fill.param.user_defined.use_current_pen = false;
- pgls->g.fill.param.pattern_type = 1; /****** NOT SURE ******/
- pgls->g.fill.param.pattern_id = 0; /****** NOT SURE ******/
- break;
+ pgls->g.fill.param.pattern_type = 1; /****** NOT SURE ******/
+ pgls->g.fill.param.pattern_id = 0; /****** NOT SURE ******/
+ break;
case hpgl_FT_pattern_one_line: /* 3 */
- params = &pgls->g.fill.param.hatch;
- goto hatch;
+ params = &pgls->g.fill.param.hatch;
+ goto hatch;
case hpgl_FT_pattern_two_lines: /* 4 */
- params = &pgls->g.fill.param.crosshatch;
+ params = &pgls->g.fill.param.crosshatch;
hatch:
- {
+ {
hpgl_real_t spacing = params->spacing;
- hpgl_real_t angle = params->angle;
+ hpgl_real_t angle = params->angle;
- if (hpgl_arg_real(pgls->memory, pargs, &spacing)) {
+ if (hpgl_arg_real(pgls->memory, pargs, &spacing)) {
if (spacing < 0)
- return e_Range;
- hpgl_arg_real(pgls->memory, pargs, &angle);
- }
-
- /*
- * If the specified spacing is 0, we use 1% of the P1/P2
- * diagonal distance. We handle this when performing the
- * fill, not here, because this distance may change
- * depending on the position of P1 and P2.
- */
- params->spacing = spacing;
- params->angle = angle;
- }
- break;
+ return e_Range;
+ hpgl_arg_real(pgls->memory, pargs, &angle);
+ }
+
+ /*
+ * If the specified spacing is 0, we use 1% of the P1/P2
+ * diagonal distance. We handle this when performing the
+ * fill, not here, because this distance may change
+ * depending on the position of P1 and P2.
+ */
+ params->spacing = spacing;
+ params->angle = angle;
+ }
+ break;
case hpgl_FT_pattern_shading: /* 10 */
- {
+ {
int level;
- if (hpgl_arg_c_int(pgls->memory, pargs, &level)) {
+ if (hpgl_arg_c_int(pgls->memory, pargs, &level)) {
if ((level < 0) || (level > 100))
- return e_Range;
- pgls->g.fill.param.shading = level;
- }
- }
- break;
+ return e_Range;
+ pgls->g.fill.param.shading = level;
+ }
+ }
+ break;
case hpgl_FT_pattern_RF: /* 11 */
- {
+ {
int index, mode;
/* contrary to the documentation, option 2 is used */
- if (!hpgl_arg_int(pgls->memory, pargs, &index))
+ if (!hpgl_arg_int(pgls->memory, pargs, &index))
index = pgls->g.fill.param.user_defined.pattern_index;
else if ((index < 1) || (index > 8))
return e_Range;
- if (!hpgl_arg_c_int(pgls->memory, pargs, &mode))
- mode = pgls->g.fill.param.user_defined.use_current_pen;
+ if (!hpgl_arg_c_int(pgls->memory, pargs, &mode))
+ mode = pgls->g.fill.param.user_defined.use_current_pen;
else if ((mode & ~1) != 0)
- return e_Range;
- pgls->g.fill.param.user_defined.pattern_index = index;
- pgls->g.fill.param.user_defined.use_current_pen = mode;
- }
- break;
+ return e_Range;
+ pgls->g.fill.param.user_defined.pattern_index = index;
+ pgls->g.fill.param.user_defined.use_current_pen = mode;
+ }
+ break;
case hpgl_FT_pattern_cross_hatch: /* 21 */
- {
+ {
int pattern;
- if (hpgl_arg_c_int(pgls->memory, pargs, &pattern)) {
+ if (hpgl_arg_c_int(pgls->memory, pargs, &pattern)) {
if ((pattern < 1) || (pattern > 6))
- return e_Range;
- pgls->g.fill.param.pattern_type = pattern;
- }
- }
- break;
+ return e_Range;
+ pgls->g.fill.param.pattern_type = pattern;
+ }
+ }
+ break;
case hpgl_FT_pattern_user_defined: /* 22 */
- {
+ {
int32 id;
- if (hpgl_arg_int(pgls->memory, pargs, &id)) {
- if ((id < 0) || (id > 0xffff))
- return e_Range;
- pgls->g.fill.param.pattern_id = id;
- }
- }
- break;
+ if (hpgl_arg_int(pgls->memory, pargs, &id)) {
+ if ((id < 0) || (id > 0xffff))
+ return e_Range;
+ pgls->g.fill.param.pattern_id = id;
+ }
+ }
+ break;
default:
- return e_Range;
+ return e_Range;
}
pgls->g.fill.type = (hpgl_FT_pattern_source_t)type;
return 0;
@@ -203,44 +203,44 @@ hpgl_LA(
int kind;
while (hpgl_arg_c_int(pgls->memory, pargs, &kind)) {
- no_args=false;
- switch (kind) {
-
- case 1: /* line ends */
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &cap) || (cap < 1) || (cap > 4) )
- return e_Range;
- break;
-
- case 2: /* line joins */
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &join) || (join < 1) || (join > 6) )
- return e_Range;
- break;
-
- case 3: /* miter limit */
- if ( !hpgl_arg_c_real(pgls->memory, pargs, &miter_limit) )
- return e_Range;
- if (miter_limit < 1)
- miter_limit = 1;
- break;
-
- default:
- return e_Range;
- }
+ no_args=false;
+ switch (kind) {
+
+ case 1: /* line ends */
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &cap) || (cap < 1) || (cap > 4) )
+ return e_Range;
+ break;
+
+ case 2: /* line joins */
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &join) || (join < 1) || (join > 6) )
+ return e_Range;
+ break;
+
+ case 3: /* miter limit */
+ if ( !hpgl_arg_c_real(pgls->memory, pargs, &miter_limit) )
+ return e_Range;
+ if (miter_limit < 1)
+ miter_limit = 1;
+ break;
+
+ default:
+ return e_Range;
+ }
}
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
/* LA1,1,2,1,3,5 is the same as LA */
if (no_args) {
- hpgl_args_setup(pargs);
- hpgl_args_add_int(pargs, 1);
- hpgl_args_add_int(pargs, 1);
- hpgl_args_add_int(pargs, 2);
- hpgl_args_add_int(pargs, 1);
- hpgl_args_add_int(pargs, 3);
- hpgl_args_add_real(pargs, 5.0);
- hpgl_LA(pargs, pgls);
- return 0;
+ hpgl_args_setup(pargs);
+ hpgl_args_add_int(pargs, 1);
+ hpgl_args_add_int(pargs, 1);
+ hpgl_args_add_int(pargs, 2);
+ hpgl_args_add_int(pargs, 1);
+ hpgl_args_add_int(pargs, 3);
+ hpgl_args_add_real(pargs, 5.0);
+ hpgl_LA(pargs, pgls);
+ return 0;
}
pgls->g.line.cap = cap;
@@ -281,13 +281,13 @@ hpgl_set_line_pattern_defaults(hpgl_state_t *pgls)
pgls->g.line.current.is_solid = true;
pgls->g.line.current.type = 0;
memcpy( &pgls->g.fixed_line_type,
- &hpgl_fixed_pats,
- sizeof(hpgl_fixed_pats)
- );
+ &hpgl_fixed_pats,
+ sizeof(hpgl_fixed_pats)
+ );
memcpy( &pgls->g.adaptive_line_type,
- &hpgl_adaptive_pats,
- sizeof(hpgl_adaptive_pats)
- );
+ &hpgl_adaptive_pats,
+ sizeof(hpgl_adaptive_pats)
+ );
/* initialize the current pattern offset - this is not part of the
command but is used internally to modulate the phase of the
@@ -299,14 +299,14 @@ hpgl_set_line_pattern_defaults(hpgl_state_t *pgls)
* LT type[,length[,mode]];
* LT99;
* LT;
- * NB - needs reorganizing
+ * NB - needs reorganizing
*/
int
hpgl_LT(
hpgl_args_t * pargs,
hpgl_state_t * pgls
)
-{
+{
int type;
/* Draw the current path for any LT command irrespective of
@@ -319,11 +319,11 @@ hpgl_LT(
since type 99 can only be invoked if the current line is solid
(i.e. the 99 pattern only needs to be saved here */
if ( !hpgl_arg_c_int(pgls->memory, pargs, &type) ) {
- pgls->g.line.saved = pgls->g.line.current;
+ pgls->g.line.saved = pgls->g.line.current;
pgls->g.line.saved.pos.x = pgls->g.pos.x;
pgls->g.line.saved.pos.y = pgls->g.pos.y;
- pgls->g.line.current.is_solid = true;
- return 0;
+ pgls->g.line.current.is_solid = true;
+ return 0;
}
/* 99 restores the previous line type if a solid line type is the
@@ -331,50 +331,50 @@ hpgl_LT(
type is in effect, of course the previous line may have been a
solid line resulting in nop. */
if ( type == 99 && pgls->g.line.current.is_solid == true &&
- pgls->g.line.saved.pos.x == pgls->g.pos.x &&
- pgls->g.line.saved.pos.y == pgls->g.pos.y ) {
- pgls->g.line.current = pgls->g.line.saved;
- return 0;
+ pgls->g.line.saved.pos.x == pgls->g.pos.x &&
+ pgls->g.line.saved.pos.y == pgls->g.pos.y ) {
+ pgls->g.line.current = pgls->g.line.saved;
+ return 0;
}
-
+
/* check line type range */
if ( type < -8 || type > 8 )
- return e_Range;
+ return e_Range;
/* Initialize, get and check pattern length and mode. If the mode
is relative (0) the units are a % of the distance from P1 to P2
for the absolute mode units are millimeters */
{
- /* initialize pattern lengths to current state values */
- hpgl_real_t length = pgls->g.line.current.pattern_length;
- int mode = pgls->g.line.current.pattern_length_relative;
-
- /* get/check the pattern length and mode */
- if ( hpgl_arg_c_real(pgls->memory, pargs, &length) ) {
- if ( length <= 0 )
- return e_Range;
- if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) )
- if ( (mode != 0) && (mode != 1) )
- return e_Range;
- }
-
- /* if we are here this is a non-solid line and we should be
+ /* initialize pattern lengths to current state values */
+ hpgl_real_t length = pgls->g.line.current.pattern_length;
+ int mode = pgls->g.line.current.pattern_length_relative;
+
+ /* get/check the pattern length and mode */
+ if ( hpgl_arg_c_real(pgls->memory, pargs, &length) ) {
+ if ( length <= 0 )
+ return e_Range;
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &mode) )
+ if ( (mode != 0) && (mode != 1) )
+ return e_Range;
+ }
+
+ /* if we are here this is a non-solid line and we should be
able to set the rest of the line parameter state values.
NB have not checked if some of these get set if there is a
range error for pattern length or mode. An experiment for
another day... */
- if ( type == 0 ) {
- /* Spec says this is for dots, on clj4550 its solid line type!
- * NB: need multiple device testing as its likely to be device specific.
- * fts 1435 1451 1830 1833. */
- pgls->g.line.current.is_solid = true;
- }
- else
- pgls->g.line.current.is_solid = false;
+ if ( type == 0 ) {
+ /* Spec says this is for dots, on clj4550 its solid line type!
+ * NB: need multiple device testing as its likely to be device specific.
+ * fts 1435 1451 1830 1833. */
+ pgls->g.line.current.is_solid = true;
+ }
+ else
+ pgls->g.line.current.is_solid = false;
+ pgls->g.line.current.type = type;
+ pgls->g.line.current.pattern_length = length;
+ pgls->g.line.current.pattern_length_relative = mode;
pgls->g.line.current.type = type;
- pgls->g.line.current.pattern_length = length;
- pgls->g.line.current.pattern_length_relative = mode;
- pgls->g.line.current.type = type;
}
return 0;
}
@@ -387,17 +387,17 @@ hpgl_MC(
hpgl_args_t * pargs,
hpgl_state_t * pgls
)
-{
+{
int mode = 0, opcode;
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
if (hpgl_arg_c_int(pgls->memory, pargs, &mode) && ((mode & ~1) != 0))
- return e_Range;
+ return e_Range;
opcode = mode ? 168 : 252;
if ((mode != 0) && hpgl_arg_c_int(pgls->memory, pargs, &opcode)) {
- if ((opcode < 0) || (opcode > 255)) {
- pgls->logical_op = 252;
- return e_Range;
- }
+ if ((opcode < 0) || (opcode > 255)) {
+ pgls->logical_op = 252;
+ return e_Range;
+ }
}
pgls->logical_op = opcode;
return 0;
@@ -415,8 +415,8 @@ hpgl_PP(
int mode = 0;
if (hpgl_arg_c_int(pgls->memory, pargs, &mode)) {
- if ((mode < 0) || (mode > 1))
- return e_Range;
+ if ((mode < 0) || (mode > 1))
+ return e_Range;
}
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
pgls->pp_mode = mode;
@@ -431,7 +431,7 @@ hpgl_PW(
hpgl_args_t * pargs,
hpgl_state_t * pgls
)
-{
+{
/*
* we initialize the parameter to be parsed to either .1 which
* is a % of the magnitude of P1 P2 or .35 MM WU sets up how
@@ -449,8 +449,8 @@ hpgl_PW(
*/
if (hpgl_arg_c_real(pgls->memory, pargs, &param)) {
if (hpgl_arg_c_int(pgls->memory, pargs, &pmin)) {
- if ((pmin < 0) || (pmin > pmax))
- return e_Range;
+ if ((pmin < 0) || (pmin > pmax))
+ return e_Range;
pmax = pmin;
}
}
@@ -476,12 +476,12 @@ hpgl_PW(
* the line width in PU not MM.
*/
if (pgls->g.pen.width_relative)
- width_plu *= pf_factor;
+ width_plu *= pf_factor;
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
{
- int i;
- for (i = pmin; i <= pmax; ++i)
+ int i;
+ for (i = pmin; i <= pmax; ++i)
pcl_palette_PW(pgls, i, width_plu);
}
return 0;
@@ -497,7 +497,7 @@ hpgl_PW(
* pattern.
*/
-/*
+/*
* RF helper procedure to construct a mask if the input is only 1's
* and 0's. Note we store the original pattern in a dictionary keyed
* on the index, the mask is stored simultaneously keyed on the
@@ -567,58 +567,58 @@ hpgl_RF(
if (pargs->phase == 0) {
- if (!hpgl_arg_c_int(pgls->memory, pargs, (int *)&index)) {
- hpgl_default_all_fill_patterns(pgls);
- return 0;
- }
- if ((index < 1) || (index > 8))
- return e_Range;
+ if (!hpgl_arg_c_int(pgls->memory, pargs, (int *)&index)) {
+ hpgl_default_all_fill_patterns(pgls);
+ return 0;
+ }
+ if ((index < 1) || (index > 8))
+ return e_Range;
- if (!hpgl_arg_c_int(pgls->memory, pargs, (int *)&width)) {
- pcl_pattern_RF(index, NULL, pgls);
+ if (!hpgl_arg_c_int(pgls->memory, pargs, (int *)&width)) {
+ pcl_pattern_RF(index, NULL, pgls);
return 0;
- }
- if ( (width < 1) ||
+ }
+ if ( (width < 1) ||
(width > 255) ||
- !hpgl_arg_c_int(pgls->memory, pargs, (int *)&height) ||
- (height < 1) ||
+ !hpgl_arg_c_int(pgls->memory, pargs, (int *)&height) ||
+ (height < 1) ||
(height > 255) )
- return e_Range;
+ return e_Range;
/* allocate enough memory for pattern header and data */
data = gs_alloc_bytes(pgls->memory, width * height, "hpgl raster fill");
if (data == 0)
- return e_Memory;
+ return e_Memory;
/*
* All variables must be saved in globals since the parser
* the parser reinvokes hpgl_RF() while processing data
* (hpgl_arg_c_int can execute a longjmp).
*/
- pgls->g.raster_fill.width = width;
- pgls->g.raster_fill.height = height;
+ pgls->g.raster_fill.width = width;
+ pgls->g.raster_fill.height = height;
pgls->g.raster_fill.data = data;
pgls->g.raster_fill.is_mask = is_mask;
- pgls->g.raster_fill.index = index;
+ pgls->g.raster_fill.index = index;
/* set bitmap to 0, as not all pens need be provided */
- memset(data, 0, width * height);
- /* prepare to read the pixel values */
- hpgl_next_phase(pargs);
+ memset(data, 0, width * height);
+ /* prepare to read the pixel values */
+ hpgl_next_phase(pargs);
} else {
width = pgls->g.raster_fill.width;
height = pgls->g.raster_fill.height;
data = pgls->g.raster_fill.data;
is_mask = pgls->g.raster_fill.is_mask;
- index = pgls->g.raster_fill.index;
+ index = pgls->g.raster_fill.index;
}
while ((pargs->phase - 1) < width * height) {
- int pixel;
+ int pixel;
- if (!hpgl_arg_c_int(pgls->memory, pargs, &pixel))
- break;
- if (pixel != 0) {
+ if (!hpgl_arg_c_int(pgls->memory, pargs, &pixel))
+ break;
+ if (pixel != 0) {
data[pargs->phase - 1] = pixel;
if (pixel != 1)
is_mask = false;
@@ -627,7 +627,7 @@ hpgl_RF(
}
if ( pgls->personality == pcl5e )
- is_mask = true; /* always for a monochrome configuration */
+ is_mask = true; /* always for a monochrome configuration */
/* if the pattern is uncolored, collapse it to 1-bit per pixel */
if (is_mask) {
@@ -673,31 +673,31 @@ hpgl_SM(
for (;;) {
if (p >= rlimit) {
pargs->source.ptr = p;
- return e_NeedData;
- }
- ++p;
- if (*p == ' ')
- continue; /* ignore initial spaces */
- else if (*p == ';') {
+ return e_NeedData;
+ }
+ ++p;
+ if (*p == ' ')
+ continue; /* ignore initial spaces */
+ else if (*p == ';') {
pgls->g.symbol_mode = 0;
- break;
- }
-
- /*
- * p. 22-44 of the PCL5 manual says that the allowable codes
- * are 33-58, 60-126, 161 and 254. This is surely an error:
- * it must be 161-254.
- */
- else if ( ((*p >= 33) && (*p <= 126)) || ((*p >= 161) && (*p <= 254)) ) {
- pgls->g.symbol_mode = *p;
- return 0;
+ break;
+ }
+
+ /*
+ * p. 22-44 of the PCL5 manual says that the allowable codes
+ * are 33-58, 60-126, 161 and 254. This is surely an error:
+ * it must be 161-254.
+ */
+ else if ( ((*p >= 33) && (*p <= 126)) || ((*p >= 161) && (*p <= 254)) ) {
+ pgls->g.symbol_mode = *p;
+ return 0;
} else
- return e_Range;
+ return e_Range;
}
return 0;
}
-/*
+/*
* SP [pen];
*/
int
@@ -714,15 +714,15 @@ hpgl_SP(
if (hpgl_arg_c_int(pgls->memory, pargs, &pen)) {
if (pen < 0)
return e_Range;
- while ( pen > max_pen )
- pen = pen - max_pen;
+ while ( pen > max_pen )
+ pen = pen - max_pen;
}
if (pen == pgls->g.pen.selected)
return 0;
if ( !pgls->g.polygon_mode )
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
pgls->g.pen.selected = pen;
return 0;
}
@@ -747,70 +747,70 @@ hpgl_SV(
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
if (hpgl_arg_c_int(pgls->memory, pargs, &type)) {
- switch (type) {
+ switch (type) {
- case hpgl_SV_pattern_solid_pen: /* 0 */
+ case hpgl_SV_pattern_solid_pen: /* 0 */
pgls->g.screen.param.shading = 100;
pgls->g.screen.param.user_defined.pattern_index = 1;
pgls->g.screen.param.user_defined.use_current_pen = false;
pgls->g.screen.param.pattern_type = 1;
pgls->g.screen.param.pattern_id = 0;
- break;
+ break;
- case hpgl_SV_pattern_shade: /* 1 */
- {
+ case hpgl_SV_pattern_shade: /* 1 */
+ {
int level;
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &level) ||
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &level) ||
(level < 0) ||
(level > 100) )
- return e_Range;
- pgls->g.screen.param.shading = level;
- }
- break;
+ return e_Range;
+ pgls->g.screen.param.shading = level;
+ }
+ break;
- case hpgl_SV_pattern_RF: /* 2 */
- {
+ case hpgl_SV_pattern_RF: /* 2 */
+ {
int index, mode;
- if (!hpgl_arg_int(pgls->memory, pargs, &index))
+ if (!hpgl_arg_int(pgls->memory, pargs, &index))
index = pgls->g.screen.param.user_defined.pattern_index;
else if ((index < 1) || (index > 8))
return e_Range;
- if (!hpgl_arg_c_int(pgls->memory, pargs, &mode))
- mode = pgls->g.screen.param.user_defined.use_current_pen;
+ if (!hpgl_arg_c_int(pgls->memory, pargs, &mode))
+ mode = pgls->g.screen.param.user_defined.use_current_pen;
else if ((mode & ~1) != 0)
- return e_Range;
- pgls->g.screen.param.user_defined.pattern_index = index;
- pgls->g.screen.param.user_defined.use_current_pen = mode;
- }
- break;
-
- case hpgl_SV_pattern_cross_hatch: /* 21 */
- {
+ return e_Range;
+ pgls->g.screen.param.user_defined.pattern_index = index;
+ pgls->g.screen.param.user_defined.use_current_pen = mode;
+ }
+ break;
+
+ case hpgl_SV_pattern_cross_hatch: /* 21 */
+ {
int pattern;
- if ( !hpgl_arg_c_int(pgls->memory, pargs, &pattern) ||
- (pattern < 1) ||
+ if ( !hpgl_arg_c_int(pgls->memory, pargs, &pattern) ||
+ (pattern < 1) ||
(pattern > 6) )
- return e_Range;
- pgls->g.screen.param.pattern_type = pattern;
- }
- break;
+ return e_Range;
+ pgls->g.screen.param.pattern_type = pattern;
+ }
+ break;
- case hpgl_SV_pattern_user_defined: /* 22 */
- {
+ case hpgl_SV_pattern_user_defined: /* 22 */
+ {
int32 id;
- if (!hpgl_arg_int(pgls->memory, pargs, &id) || (id < 0) || (id > 0xffff))
- return e_Range;
- pgls->g.screen.param.pattern_id = id;
- }
- break;
+ if (!hpgl_arg_int(pgls->memory, pargs, &id) || (id < 0) || (id > 0xffff))
+ return e_Range;
+ pgls->g.screen.param.pattern_id = id;
+ }
+ break;
- default:
- return e_Range;
- }
+ default:
+ return e_Range;
+ }
}
pgls->g.screen.type = (hpgl_SV_pattern_source_t)type;
@@ -838,7 +838,7 @@ hpgl_TR(
int mode = 1;
if (hpgl_arg_c_int(pgls->memory, pargs, &mode) && ((mode & ~1) != 0))
- return e_Range;
+ return e_Range;
pgls->g.source_transparent = (mode != 0);
return 0;
@@ -856,36 +856,36 @@ hpgl_UL(
int index;
hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
if (hpgl_arg_c_int(pgls->memory, pargs, &index)) {
- hpgl_real_t gap[20];
+ hpgl_real_t gap[20];
double total = 0;
int i, k;
if ((index < -8) || (index > 8) || (index == 0))
- return e_Range;
- for (i = 0; (i < 20) && hpgl_arg_c_real(pgls->memory, pargs, &gap[i]); ++i ) {
+ return e_Range;
+ for (i = 0; (i < 20) && hpgl_arg_c_real(pgls->memory, pargs, &gap[i]); ++i ) {
if (gap[i] < 0)
- return e_Range;
- total += gap[i];
- }
- if (total == 0)
- return e_Range;
+ return e_Range;
+ total += gap[i];
+ }
+ if (total == 0)
+ return e_Range;
- for (k = 0; k < i; k++)
- gap[k] /= total;
+ for (k = 0; k < i; k++)
+ gap[k] /= total;
- {
- hpgl_line_type_t * fixed_plt =
+ {
+ hpgl_line_type_t * fixed_plt =
&pgls->g.fixed_line_type[(index < 0 ? -index : index) - 1];
hpgl_line_type_t * adaptive_plt =
- &pgls->g.adaptive_line_type[(index < 0 ? -index : index) - 1];
+ &pgls->g.adaptive_line_type[(index < 0 ? -index : index) - 1];
- fixed_plt->count = adaptive_plt->count = i;
- memcpy(fixed_plt->gap, gap, i * sizeof(hpgl_real_t));
- memcpy(adaptive_plt->gap, gap, i * sizeof(hpgl_real_t));
- }
+ fixed_plt->count = adaptive_plt->count = i;
+ memcpy(fixed_plt->gap, gap, i * sizeof(hpgl_real_t));
+ memcpy(adaptive_plt->gap, gap, i * sizeof(hpgl_real_t));
+ }
} else {
- hpgl_set_line_pattern_defaults(pgls);
+ hpgl_set_line_pattern_defaults(pgls);
}
return 0;
}
@@ -902,8 +902,8 @@ hpgl_WU(
int mode = 0;
if (hpgl_arg_c_int(pgls->memory, pargs, &mode)) {
- if ((mode != 0) && (mode != 1))
- return e_Range;
+ if ((mode != 0) && (mode != 1))
+ return e_Range;
}
pgls->g.pen.width_relative = mode;
hpgl_args_setup(pargs);
@@ -936,7 +936,7 @@ pglfill_do_registration(
* in polygon mode itself.`
*/
HPGL_COMMAND('S', 'M', hpgl_SM, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('S', 'P', hpgl_SP, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('S', 'P', hpgl_SP, hpgl_cdf_pcl_rtl_both),
HPGL_COMMAND('S', 'V', hpgl_SV, hpgl_cdf_pcl_rtl_both),
HPGL_COMMAND('T', 'R', hpgl_TR, hpgl_cdf_pcl_rtl_both),
HPGL_COMMAND('U', 'L', hpgl_UL, hpgl_cdf_pcl_rtl_both),
diff --git a/pcl/pgmisc.c b/pcl/pgmisc.c
index 58911aeb1..5f0388e98 100644
--- a/pcl/pgmisc.c
+++ b/pcl/pgmisc.c
@@ -32,23 +32,23 @@ current_units_out_of_range(hpgl_real_t x)
void
hpgl_set_lost_mode(hpgl_state_t *pgls, hpgl_lost_mode_t lost_mode)
{
- if ( lost_mode == hpgl_lost_mode_entered )
- {
+ if ( lost_mode == hpgl_lost_mode_entered )
+ {
#ifdef INFINITE_LOOP
- hpgl_args_t args;
- /* raise the pen. Note this should handle the pcl oddity
+ hpgl_args_t args;
+ /* raise the pen. Note this should handle the pcl oddity
that when lost mode is cleared with an absolute PD we
draw a line from the last valid position to the first
args of pen down. The following appends a moveto the
current point in the gs path */
- hpgl_args_setup(&args);
- hpgl_PU(&args, pgls);
+ hpgl_args_setup(&args);
+ hpgl_PU(&args, pgls);
#endif
#ifdef DEBUG
- dprintf("entering lost mode\n");
+ dprintf("entering lost mode\n");
#endif
- }
- pgls->g.lost_mode = lost_mode;
+ }
+ pgls->g.lost_mode = lost_mode;
}
@@ -57,19 +57,19 @@ hpgl_set_lost_mode(hpgl_state_t *pgls, hpgl_lost_mode_t lost_mode)
/* Print an error message. Note that function may be NULL. */
/* This procedure must return its 'code' argument: see pgmisc.h. */
int
-hpgl_print_error(const gs_memory_t *mem,
- const char *function, const char *file, int line, int code)
+hpgl_print_error(const gs_memory_t *mem,
+ const char *function, const char *file, int line, int code)
{
- dprintf4("hpgl call failed\n\tcalled from: %s\n\tfile: %s\n\tline: %d\n\terror code: %d\n",
- (function == 0 ? "" : function), file, line, code);
- hpgl_error();
- return code;
+ dprintf4("hpgl call failed\n\tcalled from: %s\n\tfile: %s\n\tline: %d\n\terror code: %d\n",
+ (function == 0 ? "" : function), file, line, code);
+ hpgl_error();
+ return code;
}
/* called when there is a graphics error. Keep a breakpoint on this function */
void
hpgl_error()
{
- return;
+ return;
}
#endif
diff --git a/pcl/pgmisc.h b/pcl/pgmisc.h
index f86c08f2b..320d4bca3 100644
--- a/pcl/pgmisc.h
+++ b/pcl/pgmisc.h
@@ -33,8 +33,8 @@ int32 hpgl_get_character_edge_pen(hpgl_state_t *pgls);
#ifdef DEBUG
void hpgl_error(void);
-int hpgl_print_error(const gs_memory_t *mem,
- const char *function, const char *file, int line, int code);
+int hpgl_print_error(const gs_memory_t *mem,
+ const char *function, const char *file, int line, int code);
# ifdef __GNUC__
# define hpgl_call_note_error(mem, code)\
diff --git a/pcl/pgparse.c b/pcl/pgparse.c
index e140757f7..f3745a05e 100644
--- a/pcl/pgparse.c
+++ b/pcl/pgparse.c
@@ -25,19 +25,19 @@
/* Register a command. Return true if this is a redefinition. */
static bool
hpgl_register_command(hpgl_parser_state_t *pgl_parser_state,
- byte *pindex,
- const hpgl_command_definition_t *pcmd)
+ byte *pindex,
+ const hpgl_command_definition_t *pcmd)
{
int index = pgl_parser_state->hpgl_command_next_index;
byte prev = *pindex;
- if ( prev != 0 && prev <= index &&
- pgl_parser_state->hpgl_command_list[prev] == pcmd )
- index = prev;
+ if ( prev != 0 && prev <= index &&
+ pgl_parser_state->hpgl_command_list[prev] == pcmd )
+ index = prev;
else if ( index != 0 && pgl_parser_state->hpgl_command_list[index] == pcmd )
- ;
+ ;
else
- pgl_parser_state->hpgl_command_list[pgl_parser_state->hpgl_command_next_index = ++index] = (hpgl_command_definition_t *)pcmd;
+ pgl_parser_state->hpgl_command_list[pgl_parser_state->hpgl_command_next_index = ++index] = (hpgl_command_definition_t *)pcmd;
*pindex = index;
return (prev != 0 && prev != index);
}
@@ -45,23 +45,23 @@ hpgl_register_command(hpgl_parser_state_t *pgl_parser_state,
/* Define a list of commands. */
void
hpgl_define_commands(const gs_memory_t *mem, const hpgl_named_command_t *pcmds,
- hpgl_parser_state_t *pgl_parser_state
+ hpgl_parser_state_t *pgl_parser_state
)
{ const hpgl_named_command_t *pcmd = pcmds;
- for ( ; pcmd->char1; ++pcmd )
+ for ( ; pcmd->char1; ++pcmd )
#ifdef DEBUG
- if (
+ if (
#endif
- hpgl_register_command(pgl_parser_state,
- &pgl_parser_state->hpgl_command_indices
- [pcmd->char1 - 'A'][pcmd->char2 - 'A'],
- &pcmd->defn)
+ hpgl_register_command(pgl_parser_state,
+ &pgl_parser_state->hpgl_command_indices
+ [pcmd->char1 - 'A'][pcmd->char2 - 'A'],
+ &pcmd->defn)
#ifdef DEBUG
- )
- dprintf2("Redefining command %c%c\n", pcmd->char1, pcmd->char2);
+ )
+ dprintf2("Redefining command %c%c\n", pcmd->char1, pcmd->char2);
#endif
- ;
+ ;
}
/* ---------------- Parsing ---------------- */
@@ -70,7 +70,7 @@ hpgl_define_commands(const gs_memory_t *mem, const hpgl_named_command_t *pcmds,
void
hpgl_process_init(hpgl_parser_state_t *pst)
{ pst->first_letter = -1;
- pst->command = 0;
+ pst->command = 0;
}
/* Process a buffer of HP-GL/2 commands. */
@@ -79,117 +79,117 @@ int
hpgl_process(hpgl_parser_state_t *pst, hpgl_state_t *pgls,
stream_cursor_read *pr)
{ const byte *p = pr->ptr;
- const byte *rlimit = pr->limit;
- int code = 0;
+ const byte *rlimit = pr->limit;
+ int code = 0;
- pst->source.limit = rlimit;
- /* Prepare to catch a longjmp indicating the argument scanner */
- /* needs more data, or encountered an error. */
- code = setjmp(pst->exit_to_parser);
- if ( code )
- { /* The command detected an error, or we need to ask */
- /* the caller for more data. pst->command != 0. */
- pr->ptr = pst->source.ptr;
- if ( code < 0 && code != e_NeedData )
- { pst->command = 0; /* cancel command */
- if_debug0('i', "\n");
- return code;
- }
- return 0;
- }
- /* Check whether we're still feeding data to a command. */
+ pst->source.limit = rlimit;
+ /* Prepare to catch a longjmp indicating the argument scanner */
+ /* needs more data, or encountered an error. */
+ code = setjmp(pst->exit_to_parser);
+ if ( code )
+ { /* The command detected an error, or we need to ask */
+ /* the caller for more data. pst->command != 0. */
+ pr->ptr = pst->source.ptr;
+ if ( code < 0 && code != e_NeedData )
+ { pst->command = 0; /* cancel command */
+ if_debug0('i', "\n");
+ return code;
+ }
+ return 0;
+ }
+ /* Check whether we're still feeding data to a command. */
call: if ( pst->command )
- { pst->source.ptr = p;
- pst->arg.next = 0;
- code = (*pst->command->proc)(pst, pgls);
- p = pst->source.ptr;
- if ( code < 0 )
- goto x;
- pst->command = 0;
- if_debug0('i', "\n");
- }
- while ( p < rlimit )
- { byte next = *++p;
+ { pst->source.ptr = p;
+ pst->arg.next = 0;
+ code = (*pst->command->proc)(pst, pgls);
+ p = pst->source.ptr;
+ if ( code < 0 )
+ goto x;
+ pst->command = 0;
+ if_debug0('i', "\n");
+ }
+ while ( p < rlimit )
+ { byte next = *++p;
- if ( next >= 'A' && next <= 'Z' )
- next -= 'A';
- else if ( next >= 'a' && next <= 'z' )
- next -= 'a';
- else if ( next == ESC )
- { --p;
- pst->first_letter = -1;
- code = 1;
- break;
- }
- else /* ignore everything else */
- { /* Apparently this is what H-P plotters do.... */
- if ( next > ' ' && next != ',' )
- pst->first_letter = -1;
- continue;
- }
- if ( pst->first_letter < 0 )
- { pst->first_letter = next;
- continue;
- }
- { int index = pst->hpgl_command_indices[pst->first_letter][next];
+ if ( next >= 'A' && next <= 'Z' )
+ next -= 'A';
+ else if ( next >= 'a' && next <= 'z' )
+ next -= 'a';
+ else if ( next == ESC )
+ { --p;
+ pst->first_letter = -1;
+ code = 1;
+ break;
+ }
+ else /* ignore everything else */
+ { /* Apparently this is what H-P plotters do.... */
+ if ( next > ' ' && next != ',' )
+ pst->first_letter = -1;
+ continue;
+ }
+ if ( pst->first_letter < 0 )
+ { pst->first_letter = next;
+ continue;
+ }
+ { int index = pst->hpgl_command_indices[pst->first_letter][next];
#ifdef DEBUG
- if ( gs_debug_c('i') )
- { char c = (index ? '-' : '?');
- dprintf4("--%c%c%c%c", pst->first_letter + 'A',
- next + 'A', c, c);
- }
+ if ( gs_debug_c('i') )
+ { char c = (index ? '-' : '?');
+ dprintf4("--%c%c%c%c", pst->first_letter + 'A',
+ next + 'A', c, c);
+ }
#endif
- if ( index == 0 ) /* anomalous, drop 1st letter */
- { pst->first_letter = next;
- continue;
- }
- pst->first_letter = -1;
- pst->command = pst->hpgl_command_list[index];
- pst->phase = 0;
- pst->done = false;
- hpgl_args_init(pst);
- /*
- * Only a few commands should be executed while we're in
- * polygon mode: check for this here. Note that we rely
- * on the garbage-skipping property of the parser to skip
- * over any following arguments. This doesn't work for
- * the few commands with special syntax that should be
- * ignored in polygon mode (CO, DT, LB, SM); they must be
- * flagged as executable even in polygon mode, and check
- * the render_mode themselves.
- */
- {
- bool ignore_command = false;
- if (( pgls->g.polygon_mode ) &&
- !(pst->command->flags & hpgl_cdf_polygon)
- )
- ignore_command = true;
- else
- { /* similarly if we are in lost mode we do not
- execute the commands that are only defined to
- be used when lost mode is cleared. */
- if (( pgls->g.lost_mode == hpgl_lost_mode_entered ) &&
- (pst->command->flags & hpgl_cdf_lost_mode_cleared)
- )
- ignore_command = true;
- }
- /* Also, check that we have a command that can be executed
- with the current personality. NB reorganize me. */
- if ( pgls->personality == rtl )
- if ( !(pst->command->flags & hpgl_cdf_rtl) ) /* not rtl pcl only */
- ignore_command = true;
- if ( (pgls->personality == pcl5c) || (pgls->personality == pcl5e) )
- if ( !(pst->command->flags & hpgl_cdf_pcl) ) /* not pcl rtl only */
- ignore_command = true;
- if ( ignore_command )
- pst->command = 0;
- }
- goto call;
- }
- }
+ if ( index == 0 ) /* anomalous, drop 1st letter */
+ { pst->first_letter = next;
+ continue;
+ }
+ pst->first_letter = -1;
+ pst->command = pst->hpgl_command_list[index];
+ pst->phase = 0;
+ pst->done = false;
+ hpgl_args_init(pst);
+ /*
+ * Only a few commands should be executed while we're in
+ * polygon mode: check for this here. Note that we rely
+ * on the garbage-skipping property of the parser to skip
+ * over any following arguments. This doesn't work for
+ * the few commands with special syntax that should be
+ * ignored in polygon mode (CO, DT, LB, SM); they must be
+ * flagged as executable even in polygon mode, and check
+ * the render_mode themselves.
+ */
+ {
+ bool ignore_command = false;
+ if (( pgls->g.polygon_mode ) &&
+ !(pst->command->flags & hpgl_cdf_polygon)
+ )
+ ignore_command = true;
+ else
+ { /* similarly if we are in lost mode we do not
+ execute the commands that are only defined to
+ be used when lost mode is cleared. */
+ if (( pgls->g.lost_mode == hpgl_lost_mode_entered ) &&
+ (pst->command->flags & hpgl_cdf_lost_mode_cleared)
+ )
+ ignore_command = true;
+ }
+ /* Also, check that we have a command that can be executed
+ with the current personality. NB reorganize me. */
+ if ( pgls->personality == rtl )
+ if ( !(pst->command->flags & hpgl_cdf_rtl) ) /* not rtl pcl only */
+ ignore_command = true;
+ if ( (pgls->personality == pcl5c) || (pgls->personality == pcl5e) )
+ if ( !(pst->command->flags & hpgl_cdf_pcl) ) /* not pcl rtl only */
+ ignore_command = true;
+ if ( ignore_command )
+ pst->command = 0;
+ }
+ goto call;
+ }
+ }
x: pr->ptr = p;
- return (code == e_NeedData ? 0 : code);
+ return (code == e_NeedData ? 0 : code);
}
/*
@@ -198,201 +198,201 @@ x: pr->ptr = p;
* need more data. Note that no errors are possible.
*/
static const hpgl_value_t *
-hpgl_arg(const gs_memory_t *mem,
- hpgl_parser_state_t *pst)
+hpgl_arg(const gs_memory_t *mem,
+ hpgl_parser_state_t *pst)
{ const byte *p;
const byte *rlimit;
- hpgl_value_t *pvalue;
+ hpgl_value_t *pvalue;
#define parg (&pst->arg)
- if ( parg->next < parg->count )
- { /* We're still replaying already-scanned arguments. */
- return &parg->scanned[parg->next++];
- }
- if ( pst->done )
- return 0;
+ if ( parg->next < parg->count )
+ { /* We're still replaying already-scanned arguments. */
+ return &parg->scanned[parg->next++];
+ }
+ if ( pst->done )
+ return 0;
p = pst->source.ptr;
rlimit = pst->source.limit;
- pvalue = &parg->scanned[parg->count];
+ pvalue = &parg->scanned[parg->count];
#define check_value()\
if ( parg->have_value ) goto done
- for ( ; p < rlimit; ++p )
- { byte ch = p[1];
- switch ( ch )
- {
- case '+':
- check_value();
- parg->have_value = 1;
- parg->sign = 1;
- pvalue->v_n.i = 0;
- break;
- case '-':
- check_value();
- parg->have_value = 1;
- parg->sign = -1;
- pvalue->v_n.i = 0;
- break;
- case '.':
- switch ( parg->have_value )
- {
- default: /* > 1 */
- goto out;
- case 0:
- pvalue->v_n.r = 0;
- break;
- case 1:
- pvalue->v_n.r = pvalue->v_n.i;
- }
- parg->have_value = 2;
- parg->frac_scale = 1.0;
- break;
- case ';':
- pst->done = true;
- check_value();
- goto out;
- case HT: case LF: case FF: case CR:
- /* control charachers are ignored during parsing hpgl
- */
- continue;
- case SP: case ',':
- /*
- * The specification doesn't say what to do with extra
- * separators; we just ignore them.
- */
- if ( !parg->have_value )
- break;
- ++p;
+ for ( ; p < rlimit; ++p )
+ { byte ch = p[1];
+ switch ( ch )
+ {
+ case '+':
+ check_value();
+ parg->have_value = 1;
+ parg->sign = 1;
+ pvalue->v_n.i = 0;
+ break;
+ case '-':
+ check_value();
+ parg->have_value = 1;
+ parg->sign = -1;
+ pvalue->v_n.i = 0;
+ break;
+ case '.':
+ switch ( parg->have_value )
+ {
+ default: /* > 1 */
+ goto out;
+ case 0:
+ pvalue->v_n.r = 0;
+ break;
+ case 1:
+ pvalue->v_n.r = pvalue->v_n.i;
+ }
+ parg->have_value = 2;
+ parg->frac_scale = 1.0;
+ break;
+ case ';':
+ pst->done = true;
+ check_value();
+ goto out;
+ case HT: case LF: case FF: case CR:
+ /* control charachers are ignored during parsing hpgl
+ */
+ continue;
+ case SP: case ',':
+ /*
+ * The specification doesn't say what to do with extra
+ * separators; we just ignore them.
+ */
+ if ( !parg->have_value )
+ break;
+ ++p;
done: if ( parg->sign < 0 )
- { if ( parg->have_value > 1 )
- pvalue->v_n.r = -pvalue->v_n.r;
- else
- pvalue->v_n.i = -pvalue->v_n.i;
- }
- goto out;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- ch -= '0';
+ { if ( parg->have_value > 1 )
+ pvalue->v_n.r = -pvalue->v_n.r;
+ else
+ pvalue->v_n.i = -pvalue->v_n.i;
+ }
+ goto out;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ ch -= '0';
#define max_i 0x7fffffff
- switch ( parg->have_value )
- {
- default: /* case 2 */
- pvalue->v_n.r += ch / (parg->frac_scale *= 10);
- break;
- case 0:
- parg->have_value = 1;
- pvalue->v_n.i = ch;
- break;
- case 1:
- if ( pvalue->v_n.i >= max_i/10 &&
- (pvalue->v_n.i > max_i/10 || ch > max_i%10)
- )
+ switch ( parg->have_value )
+ {
+ default: /* case 2 */
+ pvalue->v_n.r += ch / (parg->frac_scale *= 10);
+ break;
+ case 0:
+ parg->have_value = 1;
+ pvalue->v_n.i = ch;
+ break;
+ case 1:
+ if ( pvalue->v_n.i >= max_i/10 &&
+ (pvalue->v_n.i > max_i/10 || ch > max_i%10)
+ )
return NULL;
- else
- pvalue->v_n.i = pvalue->v_n.i * 10 + ch;
- }
- break;
- default:
- pst->done = true;
- check_value();
- goto out;
- }
- }
- /* We ran out of data before reaching a terminator. */
- pst->source.ptr = p;
- longjmp(pst->exit_to_parser, e_NeedData);
- /* NOTREACHED */
+ else
+ pvalue->v_n.i = pvalue->v_n.i * 10 + ch;
+ }
+ break;
+ default:
+ pst->done = true;
+ check_value();
+ goto out;
+ }
+ }
+ /* We ran out of data before reaching a terminator. */
+ pst->source.ptr = p;
+ longjmp(pst->exit_to_parser, e_NeedData);
+ /* NOTREACHED */
out: pst->source.ptr = p;
- switch ( parg->have_value )
- {
- case 0: /* no argument */
- return NULL;
- case 1: /* integer */
- if_debug1('I', " %ld", (long)pvalue->v_n.i);
- pvalue->is_real = false;
- break;
- default /* case 2 */: /* real */
- if_debug1('I', " %g", pvalue->v_n.r);
- pvalue->is_real = true;
- }
- hpgl_arg_init(pst);
- parg->next = ++(parg->count);
- return pvalue;
+ switch ( parg->have_value )
+ {
+ case 0: /* no argument */
+ return NULL;
+ case 1: /* integer */
+ if_debug1('I', " %ld", (long)pvalue->v_n.i);
+ pvalue->is_real = false;
+ break;
+ default /* case 2 */: /* real */
+ if_debug1('I', " %g", pvalue->v_n.r);
+ pvalue->is_real = true;
+ }
+ hpgl_arg_init(pst);
+ parg->next = ++(parg->count);
+ return pvalue;
#undef parg
}
/* Get a real argument. */
bool
hpgl_arg_real(const gs_memory_t *mem,
- hpgl_args_t *pargs, hpgl_real_t *pr)
+ hpgl_args_t *pargs, hpgl_real_t *pr)
{ const hpgl_value_t *pvalue = hpgl_arg(mem, pargs);
- if ( !pvalue )
- return false;
- *pr = (pvalue->is_real ? pvalue->v_n.r : pvalue->v_n.i);
- return true;
+ if ( !pvalue )
+ return false;
+ *pr = (pvalue->is_real ? pvalue->v_n.r : pvalue->v_n.i);
+ return true;
}
/* Get a clamped real argument. */
bool
hpgl_arg_c_real(const gs_memory_t *mem,
- hpgl_args_t *pargs, hpgl_real_t *pr)
+ hpgl_args_t *pargs, hpgl_real_t *pr)
{ const hpgl_value_t *pvalue = hpgl_arg(mem, pargs);
- hpgl_real_t r;
+ hpgl_real_t r;
- if ( !pvalue )
- return false;
- r = (pvalue->is_real ? pvalue->v_n.r : pvalue->v_n.i);
- *pr = (r < -32768 ? -32768 : r > 32767 ? 32767 : r);
- return true;
+ if ( !pvalue )
+ return false;
+ r = (pvalue->is_real ? pvalue->v_n.r : pvalue->v_n.i);
+ *pr = (r < -32768 ? -32768 : r > 32767 ? 32767 : r);
+ return true;
}
/* Get an integer argument. */
bool
hpgl_arg_int(const gs_memory_t *mem,
- hpgl_args_t *pargs, int32 *pi)
+ hpgl_args_t *pargs, int32 *pi)
{ const hpgl_value_t *pvalue = hpgl_arg(mem, pargs);
- if ( !pvalue )
- return false;
- *pi = (pvalue->is_real ? (int32)pvalue->v_n.r : pvalue->v_n.i);
- return true;
+ if ( !pvalue )
+ return false;
+ *pi = (pvalue->is_real ? (int32)pvalue->v_n.r : pvalue->v_n.i);
+ return true;
}
/* Get a clamped integer argument. */
bool
-hpgl_arg_c_int(const gs_memory_t *mem,
- hpgl_args_t *pargs, int *pi)
+hpgl_arg_c_int(const gs_memory_t *mem,
+ hpgl_args_t *pargs, int *pi)
{ const hpgl_value_t *pvalue = hpgl_arg(mem, pargs);
- int32 i;
+ int32 i;
- if ( !pvalue )
- return false;
- i = (pvalue->is_real ? (int32)pvalue->v_n.r : pvalue->v_n.i);
- *pi = (i < -32768 ? -32768 : i > 32767 ? 32767 : i);
- return true;
+ if ( !pvalue )
+ return false;
+ i = (pvalue->is_real ? (int32)pvalue->v_n.r : pvalue->v_n.i);
+ *pi = (i < -32768 ? -32768 : i > 32767 ? 32767 : i);
+ return true;
}
/* Get a "current units" argument. */
bool
-hpgl_arg_units(const gs_memory_t *mem,
- hpgl_args_t *pargs, hpgl_real_t *pu)
+hpgl_arg_units(const gs_memory_t *mem,
+ hpgl_args_t *pargs, hpgl_real_t *pu)
{ /****** PROBABLY WRONG ******/
- return hpgl_arg_real(mem, pargs, pu);
+ return hpgl_arg_real(mem, pargs, pu);
}
/* initialize the HPGL command counter */
int
hpgl_init_command_index(hpgl_parser_state_t **pgl_parser_state, gs_memory_t *mem)
{
- hpgl_parser_state_t *pgst =
- (hpgl_parser_state_t *)gs_alloc_bytes(mem, sizeof(hpgl_parser_state_t),
- "hpgl_init_command_index");
+ hpgl_parser_state_t *pgst =
+ (hpgl_parser_state_t *)gs_alloc_bytes(mem, sizeof(hpgl_parser_state_t),
+ "hpgl_init_command_index");
/* fatal */
if ( pgst == 0 )
- return -1;
-
+ return -1;
+
pgst->hpgl_command_next_index = 0;
/* NB fix me the parser should not depend on this behavior the
previous design had these in bss which was automatically
diff --git a/pcl/pgpoly.c b/pcl/pgpoly.c
index d4f504d61..cc75b2374 100644
--- a/pcl/pgpoly.c
+++ b/pcl/pgpoly.c
@@ -39,49 +39,49 @@ hpgl_clear_polygon_buffer(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_call(hpgl_PM(pargs, pgls));
return 0;
}
-
+
/* Build a rectangle in polygon mode used by (EA, ER, RA, RR). */
static int
hpgl_rectangle(hpgl_args_t *pargs, hpgl_state_t *pgls, int flags, bool do_poly)
{ hpgl_real_t x2, y2;
- if ( !hpgl_arg_units(pgls->memory, pargs, &x2) ||
- !hpgl_arg_units(pgls->memory, pargs, &y2) ||
+ if ( !hpgl_arg_units(pgls->memory, pargs, &x2) ||
+ !hpgl_arg_units(pgls->memory, pargs, &y2) ||
current_units_out_of_range(x2) ||
current_units_out_of_range(y2) ) {
hpgl_call(hpgl_clear_polygon_buffer(pargs, pgls));
return e_Range;
}
- if ( flags & DO_RELATIVE )
- {
- x2 += pgls->g.pos.x;
- y2 += pgls->g.pos.y;
- }
-
+ if ( flags & DO_RELATIVE )
+ {
+ x2 += pgls->g.pos.x;
+ y2 += pgls->g.pos.y;
+ }
+
if ( do_poly ) {
hpgl_args_setup(pargs);
/* enter polygon mode. */
hpgl_call(hpgl_PM(pargs, pgls));
}
- /* do the rectangle */
- {
- hpgl_real_t x1 = pgls->g.pos.x;
- hpgl_real_t y1 = pgls->g.pos.y;
+ /* do the rectangle */
+ {
+ hpgl_real_t x1 = pgls->g.pos.x;
+ hpgl_real_t y1 = pgls->g.pos.y;
- hpgl_call(hpgl_add_point_to_path(pgls, x1, y1, hpgl_plot_move_absolute, true));
- hpgl_call(hpgl_add_point_to_path(pgls, x2, y1, hpgl_plot_draw_absolute, true));
- hpgl_call(hpgl_add_point_to_path(pgls, x2, y2, hpgl_plot_draw_absolute, true));
- hpgl_call(hpgl_add_point_to_path(pgls, x1, y2, hpgl_plot_draw_absolute, true));
- hpgl_call(hpgl_close_current_path(pgls));
- }
+ hpgl_call(hpgl_add_point_to_path(pgls, x1, y1, hpgl_plot_move_absolute, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, x2, y1, hpgl_plot_draw_absolute, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, x2, y2, hpgl_plot_draw_absolute, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, x1, y2, hpgl_plot_draw_absolute, true));
+ hpgl_call(hpgl_close_current_path(pgls));
+ }
- /* exit polygon mode PM2 */
+ /* exit polygon mode PM2 */
if ( do_poly ) {
hpgl_args_set_int(pargs,2);
hpgl_call(hpgl_PM(pargs, pgls));
}
- return 0;
+ return 0;
}
/* Fill or edge a wedge (EW, WG). */
@@ -89,9 +89,9 @@ static int
hpgl_wedge(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ hpgl_real_t radius, start, sweep, chord = 5.0;
- if ( !hpgl_arg_units(pgls->memory, pargs, &radius) ||
- !hpgl_arg_c_real(pgls->memory, pargs, &start) ||
- !hpgl_arg_c_real(pgls->memory, pargs, &sweep) || sweep < -360 || sweep > 360
+ if ( !hpgl_arg_units(pgls->memory, pargs, &radius) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &start) ||
+ !hpgl_arg_c_real(pgls->memory, pargs, &sweep) || sweep < -360 || sweep > 360
) {
hpgl_call(hpgl_clear_polygon_buffer(pargs, pgls));
return e_Range;
@@ -99,49 +99,49 @@ hpgl_wedge(hpgl_args_t *pargs, hpgl_state_t *pgls)
hpgl_arg_c_real(pgls->memory, pargs, &chord);
- /* enter polygon mode */
- hpgl_args_setup(pargs);
- hpgl_call(hpgl_PM(pargs, pgls));
-
- if ( sweep > 359.9 || sweep < -359.9) {
- floatp num_chordsf = 360 / chord;
- /* match hp 4600 rounding, precompute since regular arc rounding is different. */
- floatp intpart;
- int num_chords = (modf(num_chordsf, &intpart) < 0.06) ? intpart : intpart+1;
- floatp integral_chord_angle = fabs(sweep / num_chords);
-
- hpgl_call(hpgl_add_arc_to_path(pgls, pgls->g.pos.x, pgls->g.pos.y,
- radius, start, 360.0, integral_chord_angle, true,
- hpgl_plot_draw_absolute, true));
- }
- else
- /* draw the 2 lines and the arc using 3 point this does seem
+ /* enter polygon mode */
+ hpgl_args_setup(pargs);
+ hpgl_call(hpgl_PM(pargs, pgls));
+
+ if ( sweep > 359.9 || sweep < -359.9) {
+ floatp num_chordsf = 360 / chord;
+ /* match hp 4600 rounding, precompute since regular arc rounding is different. */
+ floatp intpart;
+ int num_chords = (modf(num_chordsf, &intpart) < 0.06) ? intpart : intpart+1;
+ floatp integral_chord_angle = fabs(sweep / num_chords);
+
+ hpgl_call(hpgl_add_arc_to_path(pgls, pgls->g.pos.x, pgls->g.pos.y,
+ radius, start, 360.0, integral_chord_angle, true,
+ hpgl_plot_draw_absolute, true));
+ }
+ else
+ /* draw the 2 lines and the arc using 3 point this does seem
convoluted but it does guarantee that the endpoint lines
for the vectors and the arc endpoints are coincident. */
- {
- hpgl_real_t x1, y1, x2, y2, x3, y3;
- hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
- start, &x1, &y1);
- hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
- (start + (sweep / 2.0)), &x2, &y2);
- hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
- (start + sweep), &x3, &y3);
- hpgl_call(hpgl_add_point_to_path(pgls, pgls->g.pos.x, pgls->g.pos.y,
- hpgl_plot_move_absolute, true));
- hpgl_call(hpgl_add_point_to_path(pgls, x1, y1,
- hpgl_plot_draw_absolute, true));
- hpgl_call(hpgl_add_arc_3point_to_path(pgls,
- x1, y1,
- x2, y2,
- x3, y3, chord,
- hpgl_plot_draw_absolute));
- }
-
- hpgl_call(hpgl_close_current_path(pgls));
- hpgl_args_set_int(pargs,2);
- hpgl_call(hpgl_PM(pargs, pgls));
-
- return 0;
+ {
+ hpgl_real_t x1, y1, x2, y2, x3, y3;
+ hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
+ start, &x1, &y1);
+ hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
+ (start + (sweep / 2.0)), &x2, &y2);
+ hpgl_compute_vector_endpoints(radius, pgls->g.pos.x, pgls->g.pos.y,
+ (start + sweep), &x3, &y3);
+ hpgl_call(hpgl_add_point_to_path(pgls, pgls->g.pos.x, pgls->g.pos.y,
+ hpgl_plot_move_absolute, true));
+ hpgl_call(hpgl_add_point_to_path(pgls, x1, y1,
+ hpgl_plot_draw_absolute, true));
+ hpgl_call(hpgl_add_arc_3point_to_path(pgls,
+ x1, y1,
+ x2, y2,
+ x3, y3, chord,
+ hpgl_plot_draw_absolute));
+ }
+
+ hpgl_call(hpgl_close_current_path(pgls));
+ hpgl_args_set_int(pargs,2);
+ hpgl_call(hpgl_PM(pargs, pgls));
+
+ return 0;
}
/* ------ Commands ------ */
@@ -149,45 +149,45 @@ hpgl_wedge(hpgl_args_t *pargs, hpgl_state_t *pgls)
/* EA x,y; */
int
hpgl_EA(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
-
+{
+
hpgl_call(hpgl_rectangle(pargs, pgls, DO_EDGE, true));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- return 0;
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ return 0;
}
/* EP; */
int
hpgl_EP(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- /* preserve the current path and copy the polygon buffer to
+{
+ /* preserve the current path and copy the polygon buffer to
the current path */
- hpgl_call(hpgl_gsave(pgls));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector_no_close));
- hpgl_call(hpgl_grestore(pgls));
- return 0;
+ hpgl_call(hpgl_gsave(pgls));
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector_no_close));
+ hpgl_call(hpgl_grestore(pgls));
+ return 0;
}
/* ER dx,dy; */
int
hpgl_ER(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
hpgl_call(hpgl_rectangle(pargs, pgls, DO_RELATIVE, true));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- return 0;
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ return 0;
}
/* EW radius,astart,asweep[,achord]; */
int
hpgl_EW(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- hpgl_call(hpgl_wedge(pargs, pgls));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- return 0;
+{
+ hpgl_call(hpgl_wedge(pargs, pgls));
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ return 0;
}
static hpgl_rendering_mode_t
@@ -198,7 +198,7 @@ hpgl_get_poly_render_mode(
hpgl_FT_pattern_source_t type = pgls->g.fill.type;
return ( ((type == hpgl_FT_pattern_one_line) ||
- (type == hpgl_FT_pattern_two_lines) )
+ (type == hpgl_FT_pattern_two_lines) )
? hpgl_rm_clip_and_fill_polygon
: hpgl_rm_polygon );
}
@@ -222,49 +222,49 @@ hpgl_FP(hpgl_args_t *pargs, hpgl_state_t *pgls)
}
/* close a subpolygon; PM1 or CI inside of a polygon */
-int
+int
hpgl_close_subpolygon(hpgl_state_t *pgls)
{
gs_point first, last;
gs_point point;
gs_fixed_point first_device;
-
+
if ( pgls->g.polygon_mode ) {
- if ( gx_path_subpath_start_point(gx_current_path(pgls->pgs),
- &first_device) >= 0 ) {
- first.x = fixed2float(first_device.x);
- first.y = fixed2float(first_device.y);
-
- /* get gl/2 current position -- always current units */
- hpgl_call(hpgl_get_current_position(pgls, &last));
- /* convert to device space using the current ctm */
- hpgl_call(gs_transform(pgls->pgs, last.x, last.y, &last));
- /*
- * if the first and last are the same close the path (i.e
- * force gs to apply join and miter)
- */
- if (equal(first.x, last.x) && equal(first.y, last.y)) {
- hpgl_call(gs_closepath(pgls->pgs));
- }
- else {
- /* explicitly close the path if the pen has been down */
- if ( pgls->g.have_drawn_in_path ) {
- hpgl_call(hpgl_close_current_path(pgls));
-
- /* update current position to the first point in sub-path,
- * should be the same as last point after close path
- * needed for relative moves after close of unclosed polygon
- */
- hpgl_call(gs_itransform(pgls->pgs, first.x, first.y, &point));
- hpgl_call(hpgl_set_current_position(pgls, &point));
- hpgl_call(hpgl_update_carriage_return_pos(pgls));
- }
- }
- /* remain in poly mode, this shouldn't be necessary */
- pgls->g.polygon_mode = true;
- }
- pgls->g.subpolygon_started = true;
+ if ( gx_path_subpath_start_point(gx_current_path(pgls->pgs),
+ &first_device) >= 0 ) {
+ first.x = fixed2float(first_device.x);
+ first.y = fixed2float(first_device.y);
+
+ /* get gl/2 current position -- always current units */
+ hpgl_call(hpgl_get_current_position(pgls, &last));
+ /* convert to device space using the current ctm */
+ hpgl_call(gs_transform(pgls->pgs, last.x, last.y, &last));
+ /*
+ * if the first and last are the same close the path (i.e
+ * force gs to apply join and miter)
+ */
+ if (equal(first.x, last.x) && equal(first.y, last.y)) {
+ hpgl_call(gs_closepath(pgls->pgs));
+ }
+ else {
+ /* explicitly close the path if the pen has been down */
+ if ( pgls->g.have_drawn_in_path ) {
+ hpgl_call(hpgl_close_current_path(pgls));
+
+ /* update current position to the first point in sub-path,
+ * should be the same as last point after close path
+ * needed for relative moves after close of unclosed polygon
+ */
+ hpgl_call(gs_itransform(pgls->pgs, first.x, first.y, &point));
+ hpgl_call(hpgl_set_current_position(pgls, &point));
+ hpgl_call(hpgl_update_carriage_return_pos(pgls));
+ }
+ }
+ /* remain in poly mode, this shouldn't be necessary */
+ pgls->g.polygon_mode = true;
+ }
+ pgls->g.subpolygon_started = true;
}
return 0;
}
@@ -274,75 +274,75 @@ int
hpgl_PM(hpgl_args_t *pargs, hpgl_state_t *pgls)
{ int op;
- if ( hpgl_arg_c_int(pgls->memory, pargs, &op) == 0 )
- op = 0;
+ if ( hpgl_arg_c_int(pgls->memory, pargs, &op) == 0 )
+ op = 0;
- switch( op )
- {
- case 0 :
- /* draw the current path if there is one */
- hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
- /* clear the polygon buffer as well */
+ switch( op )
+ {
+ case 0 :
+ /* draw the current path if there is one */
+ hpgl_call(hpgl_draw_current_path(pgls, hpgl_rm_vector));
+ /* clear the polygon buffer as well */
gx_path_new(&pgls->g.polygon.buffer.path);
- /* global flag to indicate that we are in polygon mode */
- pgls->g.polygon_mode = true;
- /* save the pen state, to be restored by PM2 */
- hpgl_save_pen_state(pgls,
- &pgls->g.polygon.pen_state,
- hpgl_pen_down | hpgl_pen_pos);
- break;
- case 1 :
- hpgl_call(hpgl_close_subpolygon(pgls));
- break;
- case 2 :
- if ( pgls->g.polygon_mode ) {
- /* explicitly close the path if the pen is down */
- if ( pgls->g.move_or_draw == hpgl_pen_down
- && pgls->g.have_drawn_in_path )
- hpgl_call(hpgl_close_current_path(pgls));
- /* make a copy of the path and clear the current path */
- hpgl_call(hpgl_copy_current_path_to_polygon_buffer(pgls));
- hpgl_call(hpgl_clear_current_path(pgls));
- /* return to vector mode */
- pgls->g.polygon_mode = false;
- /* restore the pen state */
- hpgl_restore_pen_state(pgls,
- &pgls->g.polygon.pen_state,
- hpgl_pen_down | hpgl_pen_pos);
- }
- break;
- default:
- return e_Range;
- }
- return 0;
+ /* global flag to indicate that we are in polygon mode */
+ pgls->g.polygon_mode = true;
+ /* save the pen state, to be restored by PM2 */
+ hpgl_save_pen_state(pgls,
+ &pgls->g.polygon.pen_state,
+ hpgl_pen_down | hpgl_pen_pos);
+ break;
+ case 1 :
+ hpgl_call(hpgl_close_subpolygon(pgls));
+ break;
+ case 2 :
+ if ( pgls->g.polygon_mode ) {
+ /* explicitly close the path if the pen is down */
+ if ( pgls->g.move_or_draw == hpgl_pen_down
+ && pgls->g.have_drawn_in_path )
+ hpgl_call(hpgl_close_current_path(pgls));
+ /* make a copy of the path and clear the current path */
+ hpgl_call(hpgl_copy_current_path_to_polygon_buffer(pgls));
+ hpgl_call(hpgl_clear_current_path(pgls));
+ /* return to vector mode */
+ pgls->g.polygon_mode = false;
+ /* restore the pen state */
+ hpgl_restore_pen_state(pgls,
+ &pgls->g.polygon.pen_state,
+ hpgl_pen_down | hpgl_pen_pos);
+ }
+ break;
+ default:
+ return e_Range;
+ }
+ return 0;
}
/* RA x,y; */
int
hpgl_RA(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
hpgl_call(hpgl_rectangle(pargs, pgls, 0, true));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls,
- hpgl_get_poly_render_mode(pgls)));
- return 0;
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls,
+ hpgl_get_poly_render_mode(pgls)));
+ return 0;
}
/* RR dx,dy;*/
int
hpgl_RR(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
hpgl_call(hpgl_rectangle(pargs, pgls, DO_RELATIVE, true));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls,
- hpgl_get_poly_render_mode(pgls)));
- return 0;
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls,
+ hpgl_get_poly_render_mode(pgls)));
+ return 0;
}
/* RQ dx,dy;*/
int
hpgl_RQ(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
+{
/* contary to the specification HP uses default pixel placement
with RQ */
byte save_pp = pgls->pp_mode;
@@ -355,16 +355,15 @@ hpgl_RQ(hpgl_args_t *pargs, hpgl_state_t *pgls)
return 0;
}
-
/* WG radius,astart,asweep[,achord]; */
int
hpgl_WG(hpgl_args_t *pargs, hpgl_state_t *pgls)
-{
- hpgl_call(hpgl_wedge(pargs, pgls));
- hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
- hpgl_call(hpgl_draw_current_path(pgls,
- hpgl_get_poly_render_mode(pgls)));
- return 0;
+{
+ hpgl_call(hpgl_wedge(pargs, pgls));
+ hpgl_call(hpgl_copy_polygon_buffer_to_current_path(pgls));
+ hpgl_call(hpgl_draw_current_path(pgls,
+ hpgl_get_poly_render_mode(pgls)));
+ return 0;
}
/* Initialization */
@@ -374,18 +373,18 @@ pgpoly_do_registration(
gs_memory_t *mem)
{ /* Register commands */
DEFINE_HPGL_COMMANDS(mem)
- HPGL_COMMAND('E', 'A', hpgl_EA, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('E', 'P', hpgl_EP, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('E', 'R', hpgl_ER, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('E', 'W', hpgl_EW, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('F', 'P', hpgl_FP, hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('P', 'M', hpgl_PM, hpgl_cdf_polygon|hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('R', 'A', hpgl_RA, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('R', 'R', hpgl_RR, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('R', 'Q', hpgl_RQ, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- HPGL_COMMAND('W', 'G', hpgl_WG, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
- END_HPGL_COMMANDS
- return 0;
+ HPGL_COMMAND('E', 'A', hpgl_EA, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('E', 'P', hpgl_EP, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('E', 'R', hpgl_ER, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('E', 'W', hpgl_EW, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('F', 'P', hpgl_FP, hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('P', 'M', hpgl_PM, hpgl_cdf_polygon|hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('R', 'A', hpgl_RA, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('R', 'R', hpgl_RR, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('R', 'Q', hpgl_RQ, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ HPGL_COMMAND('W', 'G', hpgl_WG, hpgl_cdf_lost_mode_cleared|hpgl_cdf_pcl_rtl_both),
+ END_HPGL_COMMANDS
+ return 0;
}
const pcl_init_t pgpoly_init = {
pgpoly_do_registration, 0
diff --git a/pcl/pgstate.h b/pcl/pgstate.h
index 4dbce5f7c..419cca0a9 100644
--- a/pcl/pgstate.h
+++ b/pcl/pgstate.h
@@ -21,7 +21,7 @@
#ifndef pgstate_INCLUDED
#define pgstate_INCLUDED
-/*
+/*
* HPGL/2 coordinates are internally represented in plotter units
* 1/1024" when scaling is off and user units when scaling is in
* effect. The data structure g.pos maintains the coordinates in the
@@ -63,7 +63,7 @@ typedef struct hpgl_line_type_s {
} hpgl_line_type_t;
typedef struct hpgl_path_state_s {
- gx_path path;
+ gx_path path;
} hpgl_path_state_t;
/* Define rendering modes - character, polygon, or vector.
@@ -71,33 +71,33 @@ typedef struct hpgl_path_state_s {
hpgl_set_graphics_line_attribute_state) and whether we use
stroke or fill on the path. */
typedef enum {
- hpgl_rm_vector,
- hpgl_rm_vector_no_close,
- hpgl_rm_character,
- hpgl_rm_polygon,
- hpgl_rm_vector_fill,
- hpgl_rm_clip_and_fill_polygon, /* for hpgl/2 line type filling */
- hpgl_rm_nop /* don't do anything with the path. future use */
+ hpgl_rm_vector,
+ hpgl_rm_vector_no_close,
+ hpgl_rm_character,
+ hpgl_rm_polygon,
+ hpgl_rm_vector_fill,
+ hpgl_rm_clip_and_fill_polygon, /* for hpgl/2 line type filling */
+ hpgl_rm_nop /* don't do anything with the path. future use */
} hpgl_rendering_mode_t;
/* state of lost mode */
typedef enum {
- hpgl_lost_mode_entered,
- hpgl_lost_mode_cleared
+ hpgl_lost_mode_entered,
+ hpgl_lost_mode_cleared
} hpgl_lost_mode_t;
typedef enum {
- hpgl_even_odd_rule,
- hpgl_winding_number_rule
+ hpgl_even_odd_rule,
+ hpgl_winding_number_rule
} hpgl_render_fill_type_t;
/* Define the structure for saving the pen state temporarily. */
/* HAS: note don't mix and match save a restores. perhaps there
should be a type check field in the structure. */
typedef struct hpgl_pen_state_s {
- int relative_coords;
- int move_or_draw;
- gs_point pos;
+ int relative_coords;
+ int move_or_draw;
+ gs_point pos;
} hpgl_pen_state_t;
/* Define the parameters for GL hatch/cross-hatch fill types. */
@@ -129,190 +129,190 @@ typedef enum {
gs_moveto, gs_rmoveto, gs_lineto, gs_rlineto
typedef struct pcl_hpgl_state_s {
- /* Chapter 17 lost mode (pgmisc.c) */
-
- /* According to PCLTRM IN, PG, RP and PA with args in range clears
- lost mode. Note that all these commands have PA with valid args
- as a side effect so only PA needs to clear lost mode. */
+ /* Chapter 17 lost mode (pgmisc.c) */
+
+ /* According to PCLTRM IN, PG, RP and PA with args in range clears
+ lost mode. Note that all these commands have PA with valid args
+ as a side effect so only PA needs to clear lost mode. */
- hpgl_lost_mode_t lost_mode;
+ hpgl_lost_mode_t lost_mode;
- /* Chapter 18 (pgframe.c) */
+ /* Chapter 18 (pgframe.c) */
- struct pf_ {
- coord_point_t size;
- coord_point_t anchor_point;
- } picture_frame;
+ struct pf_ {
+ coord_point_t size;
+ coord_point_t anchor_point;
+ } picture_frame;
#define picture_frame_width picture_frame.size.x
#define picture_frame_height picture_frame.size.y
- coord_point_t plot_size;
+ coord_point_t plot_size;
#define plot_width plot_size.x
#define plot_height plot_size.y
bool plot_size_vertical_specified;
bool plot_size_horizontal_specified;
- /* Chapter 19 (pgconfig.c) */
-
- enum {
- hpgl_scaling_none = -1,
- hpgl_scaling_anisotropic = 0,
- hpgl_scaling_isotropic = 1,
- hpgl_scaling_point_factor = 2
- } scaling_type;
- hpgl_scaling_params_t scaling_params;
- struct soft_clip_window_ {
+ /* Chapter 19 (pgconfig.c) */
+
+ enum {
+ hpgl_scaling_none = -1,
+ hpgl_scaling_anisotropic = 0,
+ hpgl_scaling_isotropic = 1,
+ hpgl_scaling_point_factor = 2
+ } scaling_type;
+ hpgl_scaling_params_t scaling_params;
+ struct soft_clip_window_ {
bool active; /* current unit window has be given,
if not use picture frame */
bool isbound; /* bound to plotter units */
- gs_rect rect; /* clipping window (IW) */
- } soft_clip_window;
- int rotation;
- gs_point P1, P2; /* in plotter units */
-
- /* Chapter 20 (pgvector.c) */
-
- int move_or_draw; /* hpgl_plot_move/draw */
- int relative_coords; /* hpgl_plot_absolute/relative */
+ gs_rect rect; /* clipping window (IW) */
+ } soft_clip_window;
+ int rotation;
+ gs_point P1, P2; /* in plotter units */
+
+ /* Chapter 20 (pgvector.c) */
+
+ int move_or_draw; /* hpgl_plot_move/draw */
+ int relative_coords; /* hpgl_plot_absolute/relative */
gs_point pos;
/* used to track the line drawing state in hpgl */
gs_point first_point;
- /* Chapter 21 (pgpoly.c) */
- struct polygon_ {
- hpgl_path_state_t buffer; /* path for polygon buffer */
- hpgl_pen_state_t pen_state; /* save pen state during polygon mode */
- } polygon;
- bool polygon_mode;
-
- /* Chapter 22 (pglfill.c) */
-
- struct lp_ {
- struct ltl_ {
- int type;
- /* the offset value is not required by the gl/2
+ /* Chapter 21 (pgpoly.c) */
+ struct polygon_ {
+ hpgl_path_state_t buffer; /* path for polygon buffer */
+ hpgl_pen_state_t pen_state; /* save pen state during polygon mode */
+ } polygon;
+ bool polygon_mode;
+
+ /* Chapter 22 (pglfill.c) */
+
+ struct lp_ {
+ struct ltl_ {
+ int type;
+ /* the offset value is not required by the gl/2
language, however we use it to implement offsetting
line patterns for hpgl/2 vector fills */
float pattern_offset;
- float pattern_length;
- bool pattern_length_relative;
- bool is_solid;
- gs_point pos;
- } current, saved; /* enable saving for LT99 */
- int cap;
- int join;
- } line;
- float miter_limit;
- struct pen_ {
- bool width_relative;
- int selected; /* currently selected pen # */
- } pen;
- byte symbol_mode; /* 0 if not in symbol mode */
- struct ft_ {
+ float pattern_length;
+ bool pattern_length_relative;
+ bool is_solid;
+ gs_point pos;
+ } current, saved; /* enable saving for LT99 */
+ int cap;
+ int join;
+ } line;
+ float miter_limit;
+ struct pen_ {
+ bool width_relative;
+ int selected; /* currently selected pen # */
+ } pen;
+ byte symbol_mode; /* 0 if not in symbol mode */
+ struct ft_ {
hpgl_FT_pattern_source_t type;
- /*
- * Because each fill type remembers its previous parameter values,
- * we must use a structure rather than a union here.
- */
- struct fp_ {
- hpgl_hatch_params_t hatch;
- hpgl_hatch_params_t crosshatch;
- int shading; /* 0..100 */
- struct { int pattern_index; bool use_current_pen; } user_defined;
- int pattern_type;
- uint pattern_id;
- } param;
- } fill;
+ /*
+ * Because each fill type remembers its previous parameter values,
+ * we must use a structure rather than a union here.
+ */
+ struct fp_ {
+ hpgl_hatch_params_t hatch;
+ hpgl_hatch_params_t crosshatch;
+ int shading; /* 0..100 */
+ struct { int pattern_index; bool use_current_pen; } user_defined;
+ int pattern_type;
+ uint pattern_id;
+ } param;
+ } fill;
/* current bits of fraction for polyline encoded numbers */
int32 fraction_bits;
- hpgl_render_fill_type_t fill_type;
- hpgl_line_type_t fixed_line_type[8];
- hpgl_line_type_t adaptive_line_type[8];
- gs_point anchor_corner;
- bool source_transparent;
- struct scr_ {
+ hpgl_render_fill_type_t fill_type;
+ hpgl_line_type_t fixed_line_type[8];
+ hpgl_line_type_t adaptive_line_type[8];
+ gs_point anchor_corner;
+ bool source_transparent;
+ struct scr_ {
hpgl_SV_pattern_source_t type;
- struct sp_ {
- int shading; /* 0..100 */
- struct { int pattern_index; bool use_current_pen; } user_defined;
- int pattern_type;
- uint pattern_id;
- } param;
- } screen;
- /* Temporary while downloading raster fill pattern */
- struct rf_ {
- int index, width, height;
- uint raster;
- byte *data;
+ struct sp_ {
+ int shading; /* 0..100 */
+ struct { int pattern_index; bool use_current_pen; } user_defined;
+ int pattern_type;
+ uint pattern_id;
+ } param;
+ } screen;
+ /* Temporary while downloading raster fill pattern */
+ struct rf_ {
+ int index, width, height;
+ uint raster;
+ byte *data;
bool is_mask;
- } raster_fill;
-
- /* Chapter 23 (pgchar.c, pglabel.c) */
-
- pcl_font_selection_t font_selection[2];
- int font_selected; /* 0 or 1 */
- pl_font_t *font; /* 0 means recompute from params */
- pl_symbol_map_t *map; /* map for current font */
- pl_font_t stick_font[2][2]; /* stick/arc fonts */
- struct ch_ {
- gs_point direction;
- bool direction_relative;
- enum {
- hpgl_text_right = 0,
- hpgl_text_down = 1,
- hpgl_text_left = 2,
- hpgl_text_up = 3
- } text_path;
+ } raster_fill;
+
+ /* Chapter 23 (pgchar.c, pglabel.c) */
+
+ pcl_font_selection_t font_selection[2];
+ int font_selected; /* 0 or 1 */
+ pl_font_t *font; /* 0 means recompute from params */
+ pl_symbol_map_t *map; /* map for current font */
+ pl_font_t stick_font[2][2]; /* stick/arc fonts */
+ struct ch_ {
+ gs_point direction;
+ bool direction_relative;
+ enum {
+ hpgl_text_right = 0,
+ hpgl_text_down = 1,
+ hpgl_text_left = 2,
+ hpgl_text_up = 3
+ } text_path;
#define hpgl_text_is_vertical(path) (((path) & 1) != 0)
- int line_feed_direction; /* +1 = normal, -1 = reversed */
- gs_point extra_space;
- gs_point size;
- enum {
- hpgl_size_not_set,
- hpgl_size_absolute,
- hpgl_size_relative
- } size_mode;
- hpgl_real_t slant;
- enum {
- hpgl_char_solid_edge = 0,
- hpgl_char_edge = 1,
- hpgl_char_fill = 2,
- hpgl_char_fill_edge = 3
- } fill_mode;
- int edge_pen; /* 0 = no edge */
- } character;
- struct lb_ {
- int origin;
- uint terminator;
- bool print_terminator;
- /* Double-byte support */
- uint row_offset; /* implicit high byte */
- bool double_byte;
- bool write_vertical;
- /*
- * The following are only used during the execution of a
- * single LB command, but since hpgl_LB may need to exit
- * back to the parser for more data, we can't make them
- * local variables of hpgl_LB.
- */
- gs_point initial_pos;
+ int line_feed_direction; /* +1 = normal, -1 = reversed */
+ gs_point extra_space;
+ gs_point size;
+ enum {
+ hpgl_size_not_set,
+ hpgl_size_absolute,
+ hpgl_size_relative
+ } size_mode;
+ hpgl_real_t slant;
+ enum {
+ hpgl_char_solid_edge = 0,
+ hpgl_char_edge = 1,
+ hpgl_char_fill = 2,
+ hpgl_char_fill_edge = 3
+ } fill_mode;
+ int edge_pen; /* 0 = no edge */
+ } character;
+ struct lb_ {
+ int origin;
+ uint terminator;
+ bool print_terminator;
+ /* Double-byte support */
+ uint row_offset; /* implicit high byte */
+ bool double_byte;
+ bool write_vertical;
+ /*
+ * The following are only used during the execution of a
+ * single LB command, but since hpgl_LB may need to exit
+ * back to the parser for more data, we can't make them
+ * local variables of hpgl_LB.
+ */
+ gs_point initial_pos;
#define hpgl_char_count 128 /* initial buffer size */
- byte *buffer; /* start of line buffer pointer */
+ byte *buffer; /* start of line buffer pointer */
uint buffer_size; /* size of the current buffer */
- uint char_count; /* count of chars in the buffer */
+ uint char_count; /* count of chars in the buffer */
byte ch;
byte prev_ch;
bool have_16bits; /* two byte terminators need 16 bits */
- } label;
- bool transparent_data;
- uint font_id[2];
- bool bitmap_fonts_allowed;
- gs_point carriage_return_pos;
+ } label;
+ bool transparent_data;
+ uint font_id[2];
+ bool bitmap_fonts_allowed;
+ gs_point carriage_return_pos;
/* extra pen state for routines that cannot use local variables
- because of longjmp parser braindamage. */
+ because of longjmp parser braindamage. */
hpgl_pen_state_t pen_state;
- bool subpolygon_started; /* true if we are just starting a subpolygon */
- bool have_drawn_in_path; /* true if the pen has been down during this path */
+ bool subpolygon_started; /* true if we are just starting a subpolygon */
+ bool have_drawn_in_path; /* true if the pen has been down during this path */
} pcl_hpgl_state_t;
#define hpgl_pen_relative (1)
diff --git a/pcl/rtgmode.c b/pcl/rtgmode.c
index ec68c5e49..45adc0ee4 100644
--- a/pcl/rtgmode.c
+++ b/pcl/rtgmode.c
@@ -69,11 +69,11 @@ adjust_pres_mode(pcl_state_t *pcs)
* Get the effective printing region in raster space
*/
static void
-get_raster_print_rect( const gs_memory_t *mem,
- const gs_rect * plp_print_rect,
- gs_rect * prst_print_rect,
- const gs_matrix * prst2lp
- )
+get_raster_print_rect( const gs_memory_t *mem,
+ const gs_rect * plp_print_rect,
+ gs_rect * prst_print_rect,
+ const gs_matrix * prst2lp
+ )
{
gs_matrix lp2rst;
@@ -164,14 +164,14 @@ get_raster_print_rect( const gs_memory_t *mem,
*
* If only one destination dimension is specified, the ratio of this
* dimension to the corresponding source dimension determins the
- * raster scale for both dimensions; With strange interactions with
+ * raster scale for both dimensions; With strange interactions with
* the 1200centipoint margin and rotated pages (Bug emulation).
*
* If neither dimension is specified, the page printable region is
* transformed to raster space, the intersection of this with the
* positive quadrant is taken. The dimensions of the resulting region
* are compared with the dimensions of the source raster. The smaller
- * of the two dest_dim / src_dim ratios is used as the ratio for
+ * of the two dest_dim / src_dim ratios is used as the ratio for
* the raster scale in both dimensions (i.e.: select the largest
* isotropic scaling that does not cause clipping).
*
@@ -179,7 +179,7 @@ get_raster_print_rect( const gs_memory_t *mem,
* converting the page printable region to raster space and intersecting
* the result with the positive quadrant. This region is used to determine
* the useable source raster width and height.
- *
+ *
*/
int
pcl_enter_graphics_mode(
@@ -248,32 +248,32 @@ pcl_enter_graphics_mode(
scale_y = scale_x;
} else if (prstate->dest_width_set) {
- scale_x = (floatp)prstate->dest_width_cp / (floatp)prstate->src_width;
-
- if ( clip_x < 0 && pxfmst->lp_orient == 3 ) {
- scale_y = (floatp)(prstate->dest_width_cp - clip_y ) / (floatp)prstate->src_width;
- if ( rot == 2 && scale_y <= 2* prstate->src_width) /* empirical test 1 */
- scale_y = scale_x;
- }
- else if ( clip_x < 0 && pxfmst->lp_orient == 1 && rot == 3 ) {
- scale_y = (floatp)(prstate->dest_width_cp - clip_y) / (floatp)prstate->src_width;
-
- if ( prstate->dest_width_cp <= 7200 ) /* empirical test 2 */
- scale_y = (floatp)(prstate->dest_width_cp + clip_y) / (floatp)prstate->src_width;
- }
- else
- scale_y = scale_x;
-
- if (prstate->dest_height_set)
- scale_y = (floatp)prstate->dest_height_cp / (floatp)prstate->src_height;
-
- } else if (prstate->dest_height_set) {
- scale_x = scale_y = (floatp)prstate->dest_height_cp / (floatp)prstate->src_height;
+ scale_x = (floatp)prstate->dest_width_cp / (floatp)prstate->src_width;
+
+ if ( clip_x < 0 && pxfmst->lp_orient == 3 ) {
+ scale_y = (floatp)(prstate->dest_width_cp - clip_y ) / (floatp)prstate->src_width;
+ if ( rot == 2 && scale_y <= 2* prstate->src_width) /* empirical test 1 */
+ scale_y = scale_x;
+ }
+ else if ( clip_x < 0 && pxfmst->lp_orient == 1 && rot == 3 ) {
+ scale_y = (floatp)(prstate->dest_width_cp - clip_y) / (floatp)prstate->src_width;
+
+ if ( prstate->dest_width_cp <= 7200 ) /* empirical test 2 */
+ scale_y = (floatp)(prstate->dest_width_cp + clip_y) / (floatp)prstate->src_width;
+ }
+ else
+ scale_y = scale_x;
+
+ if (prstate->dest_height_set)
+ scale_y = (floatp)prstate->dest_height_cp / (floatp)prstate->src_height;
+
+ } else if (prstate->dest_height_set) {
+ scale_x = scale_y = (floatp)prstate->dest_height_cp / (floatp)prstate->src_height;
} else {
/* select isotropic scaling with no clipping */
- scale_x = (floatp)dwid / (floatp)prstate->src_width;
- scale_y = (floatp)dhgt / (floatp)prstate->src_height;
+ scale_x = (floatp)dwid / (floatp)prstate->src_width;
+ scale_y = (floatp)dhgt / (floatp)prstate->src_height;
if (scale_x > scale_y)
scale_x = scale_y;
else
@@ -382,12 +382,11 @@ pcl_end_graphics_mode(
);
}
-
/*
* ESC * t # R
*
- * Set raster graphics resolution.
- * The value provided will be rounded up to the nearest legal value or down to 600dpi.
+ * Set raster graphics resolution.
+ * The value provided will be rounded up to the nearest legal value or down to 600dpi.
* 75 100 150 200 300 600 are legal; 120 and 85.7143 are multiples of 75 but not legal.
*/
static int
@@ -399,7 +398,6 @@ set_graphics_resolution(
uint res = arg_is_present(pargs) ? uint_arg(pargs) : 75;
uint qi = 600 / res;
-
/* HP does not allow 120 dpi or 85.7 dpi as a resolution */
qi = (qi == 0 ? 1 : (qi > 8 ? 8 : (qi == 7 ? 6 : (qi == 5 ? 4 : qi))));
@@ -529,14 +527,14 @@ set_dest_raster_width(
)
{
if (!pcs->raster_state.graphics_mode) {
- if ( arg_is_present(pargs) ) {
- uint dw = 10 * fabs(float_arg(pargs));
-
- pcs->raster_state.dest_width_cp = dw;
- pcs->raster_state.dest_width_set = (dw != 0);
- }
- else
- pcs->raster_state.dest_width_set = false;
+ if ( arg_is_present(pargs) ) {
+ uint dw = 10 * fabs(float_arg(pargs));
+
+ pcs->raster_state.dest_width_cp = dw;
+ pcs->raster_state.dest_width_set = (dw != 0);
+ }
+ else
+ pcs->raster_state.dest_width_set = false;
}
return 0;
}
@@ -558,15 +556,15 @@ set_dest_raster_height(
pcl_state_t * pcs
)
{
- if (!pcs->raster_state.graphics_mode) {
- if ( arg_is_present(pargs) ) {
- uint dh = 10 * fabs(float_arg(pargs));
-
- pcs->raster_state.dest_height_cp = dh;
- pcs->raster_state.dest_height_set = (dh != 0);
- }
- else
- pcs->raster_state.dest_height_set = false;
+ if (!pcs->raster_state.graphics_mode) {
+ if ( arg_is_present(pargs) ) {
+ uint dh = 10 * fabs(float_arg(pargs));
+
+ pcs->raster_state.dest_height_cp = dh;
+ pcs->raster_state.dest_height_set = (dh != 0);
+ }
+ else
+ pcs->raster_state.dest_height_set = false;
}
return 0;
}
@@ -638,7 +636,6 @@ end_graphics_mode_C(
return 0;
}
-
/*
* Initialization
*/
@@ -736,7 +733,7 @@ gmode_do_reset(
if ((type & mask) != 0) {
pcl_raster_state_t * prstate = &(pcs->raster_state);
- prstate->gmargin_cp = 0L;
+ prstate->gmargin_cp = 0L;
prstate->resolution = 75;
prstate->pres_mode_3 = true;
prstate->scale_raster = false;
diff --git a/pcl/rtgmode.h b/pcl/rtgmode.h
index eb2b21013..39dc7a748 100644
--- a/pcl/rtgmode.h
+++ b/pcl/rtgmode.h
@@ -32,7 +32,6 @@ typedef enum {
IMPLICIT = 100
} pcl_gmode_entry_t;
-
/* enter raster graphics mode */
int pcl_enter_graphics_mode(
pcl_state_t * pcs,
diff --git a/pcl/rtmisc.c b/pcl/rtmisc.c
index acf21d6ca..0b0f64559 100644
--- a/pcl/rtmisc.c
+++ b/pcl/rtmisc.c
@@ -18,7 +18,7 @@
#include "pgdraw.h" /* for hpgl_add_pcl_point_to_path() */
#include "pgmisc.h" /* for hpgl_call */
#include "gsmemory.h"
-#include "gsrop.h"
+#include "gsrop.h"
#include "gscoord.h"
#include "pcpatxfm.h"
#include "pcpage.h"
@@ -33,7 +33,7 @@ extern const pcl_init_t * pcl_init_table[];
/*
* ESC % <enum> B
- */
+ */
static int
rtl_enter_hpgl_mode(
pcl_args_t * pargs,
@@ -44,9 +44,9 @@ rtl_enter_hpgl_mode(
/* Note: -1..3 for PCL5c, 0..1 for PCL5 */
if (i < 0)
- i = -1;
+ i = -1;
else if (i > 3)
- return 0;
+ return 0;
hpgl_call_mem(pcs->memory, hpgl_clear_current_path(pcs));
pcs->parse_other = ( int (*)( void *,
pcl_state_t *,
@@ -55,12 +55,12 @@ rtl_enter_hpgl_mode(
/* add the pcl cap to hpgl/2's path */
if (i == 1) {
- gs_point pcl_pt;
+ gs_point pcl_pt;
- pcl_pt.x = (hpgl_real_t)pcs->cap.x;
- pcl_pt.y = (hpgl_real_t)pcs->cap.y;
+ pcl_pt.x = (hpgl_real_t)pcs->cap.x;
+ pcl_pt.y = (hpgl_real_t)pcs->cap.y;
hpgl_add_pcl_point_to_path(pcs, &pcl_pt);
- hpgl_update_carriage_return_pos(pcs);
+ hpgl_update_carriage_return_pos(pcs);
}
hpgl_call_mem(pcs->memory, hpgl_set_ctm(pcs));
return 0;
@@ -71,7 +71,7 @@ rtl_enter_hpgl_mode(
* Note that it returns 1 iff it changed the PCL CAP.
*
* ESC % <enum> A
- */
+ */
int
rtl_enter_pcl_mode(
pcl_args_t * pargs,
@@ -80,30 +80,30 @@ rtl_enter_pcl_mode(
{
int b = int_arg(pargs) & 1;
- if ( pcs->parse_other ==
- (int(*)(void *, pcl_state_t *, stream_cursor_read *))hpgl_process ) {
- /*
+ if ( pcs->parse_other ==
+ (int(*)(void *, pcl_state_t *, stream_cursor_read *))hpgl_process ) {
+ /*
* We were in HP-GL/2 mode. Destroy the gl/2 polygon path
- * and conditionally copy back the cursor position.
+ * and conditionally copy back the cursor position.
*/
- if (b != 0) {
+ if (b != 0) {
/* the usual user -> device -> user dance. */
- gs_point pt, dev_pt;
+ gs_point pt, dev_pt;
- hpgl_call_mem(pcs->memory, hpgl_set_ctm(pcs));
- hpgl_call_mem(pcs->memory, hpgl_get_current_position(pcs, &pt));
- hpgl_call_mem(pcs->memory, gs_transform(pcs->pgs, pt.x, pt.y, &dev_pt));
- hpgl_call_mem(pcs->memory, pcl_set_ctm(pcs, true));
- hpgl_call_mem(pcs->memory, gs_itransform(pcs->pgs, dev_pt.x, dev_pt.y, &pt));
+ hpgl_call_mem(pcs->memory, hpgl_set_ctm(pcs));
+ hpgl_call_mem(pcs->memory, hpgl_get_current_position(pcs, &pt));
+ hpgl_call_mem(pcs->memory, gs_transform(pcs->pgs, pt.x, pt.y, &dev_pt));
+ hpgl_call_mem(pcs->memory, pcl_set_ctm(pcs, true));
+ hpgl_call_mem(pcs->memory, gs_itransform(pcs->pgs, dev_pt.x, dev_pt.y, &pt));
- /* HPGL/2 uses floats for coordinates */
+ /* HPGL/2 uses floats for coordinates */
#define round(x) (((x) < 0.0) ? (ceil ((x) - 0.5)) : (floor ((x) + 0.5)))
- pcs->cap.x = round(pt.x);
- pcs->cap.y = round(pt.y);
+ pcs->cap.x = round(pt.x);
+ pcs->cap.y = round(pt.y);
#undef round
- }
+ }
} else
- b = 0;
+ b = 0;
pcs->parse_other = 0;
return b; /* not 0, see comment above */
@@ -127,15 +127,15 @@ pcl_appletalk_configuration(
uint i;
if ((count < 2) || (data[0] == ' '))
- return e_Range;
+ return e_Range;
/* split the string at the first space */
for (i = 1; data[i] != ' '; ++i) {
- if (i == count - 1)
- return e_Range;
+ if (i == count - 1)
+ return e_Range;
}
if (pcs->configure_appletalk == 0)
- return 0;
+ return 0;
return (*pcs->configure_appletalk)(data, i, data + i + 1, count - (i + 1));
}
@@ -153,7 +153,7 @@ pcl_negative_motion(
int motion = int_arg(pargs);
if (motion > 1)
- return e_Range;
+ return e_Range;
/* Currently we can't take any advantage of this.... */
return 0;
@@ -174,14 +174,14 @@ rtmisc_do_registration(
0, 'B',
PCL_COMMAND( "Enter HP-GL/2 Mode",
rtl_enter_hpgl_mode,
- pca_neg_ok | pca_big_ok | pca_in_rtl
+ pca_neg_ok | pca_big_ok | pca_in_rtl
)
},
{
0, 'A',
- PCL_COMMAND( "Enter PCL Mode",
+ PCL_COMMAND( "Enter PCL Mode",
rtl_enter_pcl_mode,
- pca_neg_ok | pca_big_ok | pca_in_rtl
+ pca_neg_ok | pca_big_ok | pca_in_rtl
)
},
END_CLASS
@@ -190,16 +190,16 @@ rtmisc_do_registration(
DEFINE_CLASS('&')
{
'b', 'W',
- PCL_COMMAND( "Appletalk Configuration",
- pcl_appletalk_configuration,
- pca_bytes
+ PCL_COMMAND( "Appletalk Configuration",
+ pcl_appletalk_configuration,
+ pca_bytes
)
},
{
'a', 'N',
- PCL_COMMAND( "Negative Motion",
+ PCL_COMMAND( "Negative Motion",
pcl_negative_motion,
- pca_neg_error | pca_big_error
+ pca_neg_error | pca_big_error
)
},
END_CLASS
diff --git a/pcl/rtraster.c b/pcl/rtraster.c
index a40249262..24c3109f8 100644
--- a/pcl/rtraster.c
+++ b/pcl/rtraster.c
@@ -47,14 +47,14 @@
* Structure to describe a PCL raster
*/
typedef struct pcl_raster_s {
-
+
/* memory used to allocate this structure */
gs_memory_t * pmem;
-
+
byte nplanes; /* # of planes (seed rows) */
byte bits_per_plane; /* bits per plane */
byte nsrcs; /* # of data sources, 1 or 3 */
-
+
uint transparent:1; /* 1 ==> source transparency */
uint src_height_set:1; /* source height was set */
uint indexed:1; /* != 0 ==> indexed color space */
@@ -64,27 +64,27 @@ typedef struct pcl_raster_s {
int wht_indx; /* white index, for indexed color
space only */
const void * remap_ary; /* remap array, if needed */
-
+
pcl_state_t * pcs; /* to avoid n extra operand */
pcl_cs_indexed_t * pindexed; /* color space */
-
+
gs_image_enum * pen; /* image enumerator */
uint16 plane_index; /* next plane to be received */
uint16 rows_rendered; /* # of source rows rendered */
uint16 src_width; /* usable raster width */
uint16 src_height; /* remaining usable raster height */
-
+
/* objects required for opaque source/transparent pattern case */
gs_image_enum * mask_pen; /* enumerator for mask */
pcl_cs_indexed_t * mask_pindexed; /* special color space for mask */
ulong white_val; /* value interpreted as white */
void (*gen_mask_row)( struct pcl_raster_s * prast );
-
+
/* buffers */
pcl_seed_row_t * pseed_rows; /* seed rows, one per plane */
byte * cons_buff; /* consolidation buffer */
byte * mask_buff; /* buffer for mask row, if needed */
-
+
} pcl_raster_t;
/* GC routines */
@@ -103,7 +103,6 @@ gs_private_st_ptrs2( st_raster_t,
/* forward declaration */
static int process_zero_rows( gs_state * pgs, pcl_raster_t * prast, int nrows );
-
/*
* Clear the consolidation buffer, allocating it if it does not already
* exist.
@@ -316,39 +315,39 @@ consolidate_row(
byte * op = pcons;
int cnt = npixels;
- for (; cnt >= 8; ip++, op += 8, cnt -= 8) {
- uint val = *ip;
+ for (; cnt >= 8; ip++, op += 8, cnt -= 8) {
+ uint val = *ip;
- /*
- * cons_buff was allocated with gs_alloc_bytes, so we know
- * it is aligned for (at least) bits32 access.
- */
+ /*
+ * cons_buff was allocated with gs_alloc_bytes, so we know
+ * it is aligned for (at least) bits32 access.
+ */
#if ARCH_IS_BIG_ENDIAN
- static const bits32 spread[16] = {
- 0x00000000, 0x00000001, 0x00000100, 0x00000101,
- 0x00010000, 0x00010001, 0x00010100, 0x00010101,
- 0x01000000, 0x01000001, 0x01000100, 0x01000101,
- 0x01010000, 0x01010001, 0x01010100, 0x01010101
- };
+ static const bits32 spread[16] = {
+ 0x00000000, 0x00000001, 0x00000100, 0x00000101,
+ 0x00010000, 0x00010001, 0x00010100, 0x00010101,
+ 0x01000000, 0x01000001, 0x01000100, 0x01000101,
+ 0x01010000, 0x01010001, 0x01010100, 0x01010101
+ };
#else
- static const bits32 spread[16] = {
- 0x00000000, 0x01000000, 0x00010000, 0x01010000,
- 0x00000100, 0x01000100, 0x00010100, 0x01010100,
- 0x00000001, 0x01000001, 0x00010001, 0x01010001,
- 0x00000101, 0x01000101, 0x00010101, 0x01010101
- };
+ static const bits32 spread[16] = {
+ 0x00000000, 0x01000000, 0x00010000, 0x01010000,
+ 0x00000100, 0x01000100, 0x00010100, 0x01010100,
+ 0x00000001, 0x01000001, 0x00010001, 0x01010001,
+ 0x00000101, 0x01000101, 0x00010101, 0x01010101
+ };
#endif
- ((bits32 *)op)[0] |= spread[val >> 4] << i;
- ((bits32 *)op)[1] |= spread[val & 0xf] << i;
- }
- if (cnt) {
- uint ishift = 7;
- uint val = *ip;
-
- do {
- *op++ |= ((val >> ishift--) & 0x1) << i;
- } while (--cnt > 0);
- }
+ ((bits32 *)op)[0] |= spread[val >> 4] << i;
+ ((bits32 *)op)[1] |= spread[val & 0xf] << i;
+ }
+ if (cnt) {
+ uint ishift = 7;
+ uint val = *ip;
+
+ do {
+ *op++ |= ((val >> ishift--) & 0x1) << i;
+ } while (--cnt > 0);
+ }
}
}
@@ -372,10 +371,10 @@ create_mask_enumerator(
*/
union {
gs_image1_t i1;
- gs_image4_t i4;
+ gs_image4_t i4;
} image;
gs_image_enum * pen = gs_image_enum_alloc( prast->pmem,
- "Create image for PCL raster" );
+ "Create image for PCL raster" );
int code = 0;
const byte * pcolor = 0;
gx_image_enum_common_t * pie = 0;
@@ -408,22 +407,22 @@ create_mask_enumerator(
image.i1.Width = prast->src_width;
image.i1.Height = prast->src_height;
- if ( pcs->personality == pcl5e )
- image.i1.CombineWithColor = false;
- else
- image.i1.CombineWithColor = true;
- image.i1.format = gs_image_format_chunky;
- image.i1.BitsPerComponent = 1;
- image.i1.Decode[0] = 0.0;
- image.i1.Decode[1] = 1.0;
+ if ( pcs->personality == pcl5e )
+ image.i1.CombineWithColor = false;
+ else
+ image.i1.CombineWithColor = true;
+ image.i1.format = gs_image_format_chunky;
+ image.i1.BitsPerComponent = 1;
+ image.i1.Decode[0] = 0.0;
+ image.i1.Decode[1] = 1.0;
if (transparent)
- image.i4.MaskColor[0] = 0.0;
-
- code = gs_image_begin_typed( (const gs_image_common_t *)&image,
- pcs->pgs,
- true,
- &pie
- );
+ image.i4.MaskColor[0] = 0.0;
+
+ code = gs_image_begin_typed( (const gs_image_common_t *)&image,
+ pcs->pgs,
+ true,
+ &pie
+ );
if (code >= 0)
code = gs_image_common_init( pen,
@@ -468,7 +467,7 @@ create_image_enumerator(
int use_image4 = prast->transparent;
union {
gs_image1_t i1;
- gs_image4_t i4;
+ gs_image4_t i4;
} image;
gs_image_enum * pen = gs_image_enum_alloc( prast->pmem,
"Create image for PCL raster" );
@@ -514,7 +513,7 @@ create_image_enumerator(
image.i1.Interpolate = prast->interpolate;
if (prast->indexed) {
- if (use_image4)
+ if (use_image4)
image.i4.MaskColor[0] = prast->wht_indx;
image.i1.Decode[0] = 0.0;
image.i1.Decode[1] = (1 << image.i1.BitsPerComponent) - 1;
@@ -525,7 +524,7 @@ create_image_enumerator(
image.i1.Decode[2 * i] = prast->pindexed->Decode[2 * i];
image.i1.Decode[2 * i + 1] = prast->pindexed->Decode[2 * i + 1];
- if (use_image4) {
+ if (use_image4) {
image.i4.MaskColor[i] = (1 << image.i1.BitsPerComponent);
if (image.i1.Decode[2 * i] == 1.0)
image.i4.MaskColor[i] = 0;
@@ -540,7 +539,7 @@ create_image_enumerator(
true,
&pie
);
- if (code >= 0)
+ if (code >= 0)
code = gs_image_common_init( pen,
pie,
(gs_data_image_t *)&image,
@@ -575,7 +574,7 @@ close_raster(
)
{
/* see if we need to fill in any missing rows */
- if ( complete &&
+ if ( complete &&
(prast->src_height > prast->rows_rendered) &&
prast->src_height_set )
(void)process_zero_rows(pgs, prast, prast->src_height - prast->rows_rendered);
@@ -594,7 +593,6 @@ close_raster(
prast->rows_rendered = 0;
}
-
/*
* Generate the white-mask corresponding to an image scanline. This is
* necessary to implement the opaque source/transparent texture case.
@@ -743,7 +741,7 @@ process_zero_rows(
}
/* render as raster or rectangle */
- if ( ((nrows * nbytes > 1024) || (prast->pen == 0)) &&
+ if ( ((nrows * nbytes > 1024) || (prast->pen == 0)) &&
(prast->zero_is_white || prast->zero_is_black) ) {
gs_state * pgs = prast->pcs->pgs;
@@ -760,21 +758,21 @@ process_zero_rows(
gs_setrasterop( pgs,
(gs_rop3_t)rop3_invert_S(gs_currentrasterop(pgs))
);
- gs_rectfill(pgs, &tmp_rect, 1 );
+ gs_rectfill(pgs, &tmp_rect, 1 );
gs_setrasterop( pgs,
(gs_rop3_t)rop3_invert_S(gs_currentrasterop(pgs))
);
- }
- else
- gs_rectfill(pgs, &tmp_rect, 1);
-
+ }
+ else
+ gs_rectfill(pgs, &tmp_rect, 1);
+
}
prast->src_height -= nrows;
- /* NB HP bug CET21.04 pg 7 */
- /* NB text cap move to moveto_nrows, but raster cap moveto nrows */
- gs_translate(pgs, 0.0, (floatp)moveto_nrows);
+ /* NB HP bug CET21.04 pg 7 */
+ /* NB text cap move to moveto_nrows, but raster cap moveto nrows */
+ gs_translate(pgs, 0.0, (floatp)moveto_nrows);
return 0;
@@ -817,7 +815,7 @@ process_zero_rows(
return code;
}
}
-
+
/*
* Process the next raster row.
*
@@ -920,7 +918,7 @@ process_row(
*/
static int
process_adaptive_compress(
- gs_state * pgs,
+ gs_state * pgs,
pcl_raster_t * prast,
const byte * pin,
uint insize
@@ -1093,7 +1091,7 @@ pcl_start_raster(
prast->pmem = pcs->memory;
- if ( pcs->source_transparent || pcs->pattern_transparent)
+ if ( pcs->source_transparent || pcs->pattern_transparent)
prast->transparent = true;
else
prast->transparent = false;
@@ -1183,7 +1181,7 @@ pcl_start_raster(
/* memory exhaustion; release the already allocated seed rows */
for (j = 0; j < i; j++)
- gs_free_object( prast->pmem,
+ gs_free_object( prast->pmem,
pseed_rows[j].pdata,
"start PCL raster"
);
@@ -1204,7 +1202,7 @@ pcl_start_raster(
/* see if a mask is required */
if ( !pcs->source_transparent &&
pcs->pattern_transparent &&
- (!prast->indexed ||
+ (!prast->indexed ||
(prast->wht_indx
< (1 << prast->nplanes * prast->bits_per_plane)) ) ) {
@@ -1293,7 +1291,6 @@ pcl_complete_raster(pcl_state_t *pcs)
gs_free_object(prast->pmem, prast->cons_buff, "Complete PCL raster");
if (prast->mask_buff != 0)
gs_free_object(prast->pmem, prast->mask_buff, "Complete PCL raster");
-
/* free the PCL raster robject itself */
gs_free_object(prast->pmem, prast, "Complete PCL raster");
@@ -1377,7 +1374,7 @@ set_line_path(
uint i = uint_arg(pargs);
if (i <= 1)
- pcs->raster_state.y_advance = (i == 1 ? -1 : 1);
+ pcs->raster_state.y_advance = (i == 1 ? -1 : 1);
return 0;
}
@@ -1416,12 +1413,12 @@ raster_do_registration(
)
},
{
- /* NB this command should *only* be exectuted in rtl but we
+ /* NB this command should *only* be exectuted in rtl but we
use it in both rtl and pcl5 */
'b', 'L',
PCL_COMMAND( "Line Path",
set_line_path,
- pca_neg_ok | pca_big_ignore | pca_in_rtl
+ pca_neg_ok | pca_big_ignore | pca_in_rtl
)
},
END_CLASS
diff --git a/pcl/rtrstcmp.c b/pcl/rtrstcmp.c
index 159f28f4f..fcddedd5c 100644
--- a/pcl/rtrstcmp.c
+++ b/pcl/rtrstcmp.c
@@ -136,7 +136,7 @@ uncompress_3(
if ((offset == 0x1f) && (i-- > 0)) {
uint add_offset;
- do
+ do
offset += (add_offset = *pin++);
while ((add_offset == 0xff) && (i-- > 0));
}
@@ -163,7 +163,7 @@ uncompress_3(
/*
* Compression mode 9.
*
- * HP's documentation of this command is not completely clear regarding the
+ * HP's documentation of this command is not completely clear regarding the
* interpretation of the replacement byte count for the run-length compression
* case. The interpretation used here, based on the documentation in the
* "PCL 5 Comparison Guide", October 1996 edition, pp. 2.94-2.96, is that the
@@ -182,7 +182,6 @@ uncompress_9(
byte * pb = pout->pdata;
byte * plim = pb + pout->size;
-
while (i-- > 0) {
uint val = *pin++;
uint cnt = 0;
@@ -231,7 +230,7 @@ uncompress_9(
*pb++ = rep_val;
}
i -= 2 * j;
-
+
} else {
if (cnt > i)
cnt = i;
@@ -248,10 +247,9 @@ uncompress_9(
}
-
void (*const pcl_decomp_proc[9 + 1])( pcl_seed_row_t * pout,
const byte * pin,
- int in_size
+ int in_size
) = {
uncompress_0,
uncompress_1,
diff --git a/pcl/rtrstcmp.h b/pcl/rtrstcmp.h
index b996cbaa8..e9b34c378 100644
--- a/pcl/rtrstcmp.h
+++ b/pcl/rtrstcmp.h
@@ -82,8 +82,8 @@ typedef struct pcl_seed_row_s {
* The array of decompression functions.
*/
extern void (*const pcl_decomp_proc[9 + 1])(pcl_seed_row_t *pout,
- const byte *pin,
- int in_size
+ const byte *pin,
+ int in_size
);
#endif /* rtrstcmp_INCLUDED */
diff --git a/pcl/rtrstst.h b/pcl/rtrstst.h
index c71e4283e..5afd64c3b 100644
--- a/pcl/rtrstst.h
+++ b/pcl/rtrstst.h
@@ -137,11 +137,11 @@ typedef struct pcl_raster_state_s {
* origin was at the logical page edge, hence
* the raster needs to be clipped */
pcl_raster_type *pcur_raster; /* There is at most one image
- * actively under construction in PCL
- * at one time. This pointer points
- * to that image, if it exists. The
- * pointer will be non-null while in
- * graphic mode. */
+ * actively under construction in PCL
+ * at one time. This pointer points
+ * to that image, if it exists. The
+ * pointer will be non-null while in
+ * graphic mode. */
} pcl_raster_state_t;
#endif /* rtrstst_INCLUDED */
diff --git a/pl/dwimg.c b/pl/dwimg.c
index d6d10ef96..e168aa62d 100644
--- a/pl/dwimg.c
+++ b/pl/dwimg.c
@@ -41,7 +41,6 @@
#include "dwreg.h"
#include "gdevdsp.h"
-
static const char szImgName2[] = "Ghostscript Image";
static const char szTrcName2[] = "Ghostscript Graphical Trace";
@@ -70,7 +69,6 @@ static void create_window(IMAGE *img);
# define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
-
/* GUI thread only */
void image_color(unsigned int format, int index,
unsigned char *r, unsigned char *g, unsigned char *b);
@@ -90,14 +88,13 @@ void image_32CMYK_to_24BGR(int width, unsigned char *dest,
void image_devicen_to_24BGR(int width, unsigned char *dest,
unsigned char *source, IMAGE_DEVICEN *devicen, int devicen_gray);
-
/****************************************************************/
/* These functions are only accessed by the main thread */
IMAGE *first_image = NULL;
static HWND img_hwndtext = (HWND)0;
-void
+void
image_textwindow(HWND hwnd)
{
/* Save the handle to the text window in a global variable
@@ -115,8 +112,8 @@ image_find(void *handle, void *device)
{
IMAGE *img;
for (img = first_image; img!=0; img=img->next) {
- if ((img->handle == handle) && (img->device == device))
- return img;
+ if ((img->handle == handle) && (img->device == device))
+ return img;
}
return NULL;
}
@@ -129,20 +126,20 @@ image_new(void *handle, void *device)
IMAGE *img = (IMAGE *)malloc(sizeof(IMAGE));
if (img) {
memset(img, 0, sizeof(IMAGE));
- /* remember device and handle */
- img->handle = handle;
- img->device = device;
- img->hwndtext = img_hwndtext;
+ /* remember device and handle */
+ img->handle = handle;
+ img->device = device;
+ img->hwndtext = img_hwndtext;
- img->update_tick = 100; /* milliseconds */
- img->update_interval = 1; /* 1 tick */
- img->update_count = 0;
+ img->update_tick = 100; /* milliseconds */
+ img->update_interval = 1; /* 1 tick */
+ img->update_count = 0;
img->hmutex = INVALID_HANDLE_VALUE;
- /* add to list */
- img->next = first_image;
- first_image = img;
+ /* add to list */
+ img->next = first_image;
+ first_image = img;
}
return img;
}
@@ -154,19 +151,18 @@ image_delete(IMAGE *img)
{
/* remove from list */
if (img == first_image) {
- first_image = img->next;
+ first_image = img->next;
}
else {
- IMAGE *tmp;
- for (tmp = first_image; tmp!=0; tmp=tmp->next) {
- if (img == tmp->next)
- tmp->next = img->next;
- }
+ IMAGE *tmp;
+ for (tmp = first_image; tmp!=0; tmp=tmp->next) {
+ if (img == tmp->next)
+ tmp->next = img->next;
+ }
}
/* Note: img is freed by image_close, not image_delete */
}
-
/* resize image */
/* valid for main thread */
int
@@ -186,134 +182,134 @@ image_size(IMAGE *img, int new_width, int new_height, int new_raster,
/* Reset separations */
for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- img->devicen[i].used = 0;
- img->devicen[i].visible = 1;
- memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
- img->devicen[i].cyan = 0;
- img->devicen[i].magenta = 0;
- img->devicen[i].yellow = 0;
- img->devicen[i].black = 0;
+ img->devicen[i].used = 0;
+ img->devicen[i].visible = 1;
+ memset(img->devicen[i].name, 0, sizeof(img->devicen[i].name));
+ img->devicen[i].cyan = 0;
+ img->devicen[i].magenta = 0;
+ img->devicen[i].yellow = 0;
+ img->devicen[i].black = 0;
}
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- img->bmih.biBitCount = 1;
- img->bmih.biClrUsed = 2;
- img->bmih.biClrImportant = 2;
- break;
- case DISPLAY_DEPTH_4:
- /* Fixed color palette */
- img->bmih.biBitCount = 4;
- img->bmih.biClrUsed = 16;
- img->bmih.biClrImportant = 16;
- break;
- case DISPLAY_DEPTH_8:
- /* Fixed color palette */
- img->bmih.biBitCount = 8;
- img->bmih.biClrUsed = 96;
- img->bmih.biClrImportant = 96;
- break;
- case DISPLAY_DEPTH_16:
- /* RGB bitfields */
- /* Bit fields */
- if ((img->format & DISPLAY_ENDIAN_MASK)
- == DISPLAY_BIGENDIAN) {
- /* convert to 24BGR */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- else {
- img->bmih.biBitCount = 16;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- break;
- default:
- return DISPLAY_ERROR;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- img->bmih.biBitCount = 1;
- img->bmih.biClrUsed = 2;
- img->bmih.biClrImportant = 2;
- break;
- case DISPLAY_DEPTH_4:
- /* Fixed gray palette */
- img->bmih.biBitCount = 4;
- img->bmih.biClrUsed = 16;
- img->bmih.biClrImportant = 16;
- break;
- case DISPLAY_DEPTH_8:
- /* Fixed gray palette */
- img->bmih.biBitCount = 8;
- img->bmih.biClrUsed = 256;
- img->bmih.biClrImportant = 256;
- break;
- default:
- return DISPLAY_ERROR;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return DISPLAY_ERROR;
- if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN)) {
- /* use bitfields to display this */
- img->bmih.biBitCount = 32;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- else {
- /* either native BGR, or we need to convert it */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- }
- break;
- case DISPLAY_COLORS_CMYK:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_8:
- /* we can convert these formats */
- break;
- default:
- return DISPLAY_ERROR;
- }
- /* we can't display this natively */
- /* we will convert it just before displaying */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- img->devicen[0].used = 1;
- img->devicen[0].cyan = 65535;
- /* We already know about the CMYK components */
- strncpy(img->devicen[0].name, "Cyan",
- sizeof(img->devicen[0].name));
- img->devicen[1].used = 1;
- img->devicen[1].magenta = 65535;
- strncpy(img->devicen[1].name, "Magenta",
- sizeof(img->devicen[1].name));
- img->devicen[2].used = 1;
- img->devicen[2].yellow = 65535;
- strncpy(img->devicen[2].name, "Yellow",
- sizeof(img->devicen[2].name));
- img->devicen[3].used = 1;
- img->devicen[3].black = 65535;
- strncpy(img->devicen[3].name, "Black",
- sizeof(img->devicen[3].name));
- break;
- case DISPLAY_COLORS_SEPARATION:
- /* we can't display this natively */
- /* we will convert it just before displaying */
- img->bmih.biBitCount = 24;
- img->bmih.biClrUsed = 0;
- img->bmih.biClrImportant = 0;
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ img->bmih.biBitCount = 1;
+ img->bmih.biClrUsed = 2;
+ img->bmih.biClrImportant = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ /* Fixed color palette */
+ img->bmih.biBitCount = 4;
+ img->bmih.biClrUsed = 16;
+ img->bmih.biClrImportant = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ /* Fixed color palette */
+ img->bmih.biBitCount = 8;
+ img->bmih.biClrUsed = 96;
+ img->bmih.biClrImportant = 96;
+ break;
+ case DISPLAY_DEPTH_16:
+ /* RGB bitfields */
+ /* Bit fields */
+ if ((img->format & DISPLAY_ENDIAN_MASK)
+ == DISPLAY_BIGENDIAN) {
+ /* convert to 24BGR */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ else {
+ img->bmih.biBitCount = 16;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ img->bmih.biBitCount = 1;
+ img->bmih.biClrUsed = 2;
+ img->bmih.biClrImportant = 2;
+ break;
+ case DISPLAY_DEPTH_4:
+ /* Fixed gray palette */
+ img->bmih.biBitCount = 4;
+ img->bmih.biClrUsed = 16;
+ img->bmih.biClrImportant = 16;
+ break;
+ case DISPLAY_DEPTH_8:
+ /* Fixed gray palette */
+ img->bmih.biBitCount = 8;
+ img->bmih.biClrUsed = 256;
+ img->bmih.biClrImportant = 256;
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return DISPLAY_ERROR;
+ if (((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN)) {
+ /* use bitfields to display this */
+ img->bmih.biBitCount = 32;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ else {
+ /* either native BGR, or we need to convert it */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ }
+ break;
+ case DISPLAY_COLORS_CMYK:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_8:
+ /* we can convert these formats */
+ break;
+ default:
+ return DISPLAY_ERROR;
+ }
+ /* we can't display this natively */
+ /* we will convert it just before displaying */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ img->devicen[0].used = 1;
+ img->devicen[0].cyan = 65535;
+ /* We already know about the CMYK components */
+ strncpy(img->devicen[0].name, "Cyan",
+ sizeof(img->devicen[0].name));
+ img->devicen[1].used = 1;
+ img->devicen[1].magenta = 65535;
+ strncpy(img->devicen[1].name, "Magenta",
+ sizeof(img->devicen[1].name));
+ img->devicen[2].used = 1;
+ img->devicen[2].yellow = 65535;
+ strncpy(img->devicen[2].name, "Yellow",
+ sizeof(img->devicen[2].name));
+ img->devicen[3].used = 1;
+ img->devicen[3].black = 65535;
+ strncpy(img->devicen[3].name, "Black",
+ sizeof(img->devicen[3].name));
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ /* we can't display this natively */
+ /* we will convert it just before displaying */
+ img->bmih.biBitCount = 24;
+ img->bmih.biClrUsed = 0;
+ img->bmih.biClrImportant = 0;
+ break;
}
img->bmih.biCompression = 0;
@@ -323,7 +319,7 @@ image_size(IMAGE *img, int new_width, int new_height, int new_raster,
img->bytewidth = ((img->bmih.biWidth * img->bmih.biBitCount + 31 ) & ~31) >> 3;
if (img->palette)
- DeleteObject(img->palette);
+ DeleteObject(img->palette);
img->palette = create_palette(img);
return 0;
@@ -336,10 +332,10 @@ image_separation(IMAGE *img,
unsigned short y, unsigned short k)
{
if ((comp_num < 0) || (comp_num > IMAGE_DEVICEN_MAX))
- return DISPLAY_ERROR;
+ return DISPLAY_ERROR;
img->devicen[comp_num].used = 1;
strncpy(img->devicen[comp_num].name, name,
- sizeof(img->devicen[comp_num].name)-1);
+ sizeof(img->devicen[comp_num].name)-1);
img->devicen[comp_num].cyan = c;
img->devicen[comp_num].magenta = m;
img->devicen[comp_num].yellow = y;
@@ -347,7 +343,6 @@ image_separation(IMAGE *img,
return 0;
}
-
/****************************************************************/
/* These functions are only accessed by the GUI thread */
@@ -370,17 +365,16 @@ image_close(IMAGE *img)
img->hwnd = NULL;
if (img->palette)
- DeleteObject(img->palette);
+ DeleteObject(img->palette);
img->palette = NULL;
if (img->hBrush)
- DeleteObject(img->hBrush);
+ DeleteObject(img->hBrush);
img->hBrush = NULL;
free(img);
}
-
void
register_class(void)
{
@@ -410,36 +404,36 @@ void image_separations(IMAGE *img)
HMENU sysmenu = GetSystemMenu(img->hwnd, FALSE);
if (((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_CMYK) ||
((img->format & DISPLAY_COLORS_MASK) == DISPLAY_COLORS_SEPARATION)) {
- /* Add menus if needed */
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- exist = 0;
- if (img->devicen[i].menu)
- exist = GetMenuString(sysmenu, M_SEPARATION+i,
- buf, sizeof(buf)-1, MF_BYCOMMAND) != 0;
- if (exist && (strcmp(img->devicen[i].name, buf) != 0)) {
- /* remove it because name changed */
- RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
- img->devicen[i].menu = 0;
- }
- if (img->devicen[i].name[0] && !img->devicen[i].menu) {
- AppendMenu(sysmenu, MF_STRING | MF_CHECKED,
- M_SEPARATION+i, img->devicen[i].name);
- img->devicen[i].menu = 1;
- }
- if (img->devicen[i].used && img->devicen[i].visible)
- num_visible++;
- }
- EnableMenuItem(sysmenu, M_DEVICEN_GRAY,
- MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
+ /* Add menus if needed */
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ exist = 0;
+ if (img->devicen[i].menu)
+ exist = GetMenuString(sysmenu, M_SEPARATION+i,
+ buf, sizeof(buf)-1, MF_BYCOMMAND) != 0;
+ if (exist && (strcmp(img->devicen[i].name, buf) != 0)) {
+ /* remove it because name changed */
+ RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
+ img->devicen[i].menu = 0;
+ }
+ if (img->devicen[i].name[0] && !img->devicen[i].menu) {
+ AppendMenu(sysmenu, MF_STRING | MF_CHECKED,
+ M_SEPARATION+i, img->devicen[i].name);
+ img->devicen[i].menu = 1;
+ }
+ if (img->devicen[i].used && img->devicen[i].visible)
+ num_visible++;
+ }
+ EnableMenuItem(sysmenu, M_DEVICEN_GRAY,
+ MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
}
else {
- for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
- if (img->devicen[i].menu) {
- RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
- img->devicen[i].menu = 0;
- }
- }
- EnableMenuItem(sysmenu, M_DEVICEN_GRAY, MF_BYCOMMAND | MF_GRAYED);
+ for (i=0; i<IMAGE_DEVICEN_MAX; i++) {
+ if (img->devicen[i].menu) {
+ RemoveMenu(sysmenu, M_SEPARATION+i, MF_BYCOMMAND);
+ img->devicen[i].menu = 0;
+ }
+ }
+ EnableMenuItem(sysmenu, M_DEVICEN_GRAY, MF_BYCOMMAND | MF_GRAYED);
}
}
@@ -449,18 +443,17 @@ void sep_menu(IMAGE *img, int component)
int num_visible = 0;
img->devicen[component].visible = !img->devicen[component].visible;
CheckMenuItem(GetSystemMenu(img->hwnd, FALSE),
- M_SEPARATION+component,
- (img->devicen[component].visible ? MF_CHECKED : MF_UNCHECKED));
+ M_SEPARATION+component,
+ (img->devicen[component].visible ? MF_CHECKED : MF_UNCHECKED));
for (i=0; i<IMAGE_DEVICEN_MAX; i++)
if (img->devicen[i].used && img->devicen[i].visible)
- num_visible++;
+ num_visible++;
EnableMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
- MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
+ MF_BYCOMMAND | ((num_visible <= 1) ? MF_ENABLED : MF_GRAYED));
InvalidateRect(img->hwnd, NULL, 0);
UpdateWindow(img->hwnd);
}
-
static void
create_window(IMAGE *img)
{
@@ -475,11 +468,11 @@ create_window(IMAGE *img)
lb.lbHatch = 0;
lb.lbColor = GetSysColor(COLOR_WINDOW);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = GetSysColor(COLOR_MENU);
+ lb.lbColor = GetSysColor(COLOR_MENU);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = GetSysColor(COLOR_APPWORKSPACE);
+ lb.lbColor = GetSysColor(COLOR_APPWORKSPACE);
if (lb.lbColor = RGB(255,255,255)) /* Don't allow white */
- lb.lbColor = RGB(192,192,192);
+ lb.lbColor = RGB(192,192,192);
img->hBrush = CreateBrushIndirect(&lb);
img->cxClient = img->cyClient = 0;
@@ -487,54 +480,54 @@ create_window(IMAGE *img)
img->nHscrollPos = img->nHscrollMax = 0;
img->x = img->y = img->cx = img->cy = CW_USEDEFAULT;
if (win_get_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf, &len) == 0) {
- int x, y, cx, cy;
-
- if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4) {
- img->x = x;
- img->y = y;
- img->cx = cx;
- img->cy = cy;
- }
+ int x, y, cx, cy;
+
+ if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4) {
+ img->x = x;
+ img->y = y;
+ img->cx = cx;
+ img->cy = cy;
+ }
}
strcpy(window_title, (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2));
{ /*
* This section is for debug purpose only.
- * It allows to replace window title so that user can identify window
- * when multiple instances of the application run in same time.
- * Create gs\bin\gswin32.ini or gs\bin\gswin32c.ini and
- * put an identifier to there like this :
- *
- * [Window]
- * Title=Current Revision
- *
- * It is useful to compare images generated with different revisions.
- */
+ * It allows to replace window title so that user can identify window
+ * when multiple instances of the application run in same time.
+ * Create gs\bin\gswin32.ini or gs\bin\gswin32c.ini and
+ * put an identifier to there like this :
+ *
+ * [Window]
+ * Title=Current Revision
+ *
+ * It is useful to compare images generated with different revisions.
+ */
char ini_path[MAX_PATH];
- DWORD ini_path_length;
-
- ini_path_length = GetModuleFileName(NULL, ini_path, sizeof(ini_path));
- if (ini_path_length > 0) {
- int i = ini_path_length - 1;
- for (; i>=0; i--)
- if(ini_path[i] == '.')
- break;
- if (i < sizeof(ini_path) - 4) {
- strcpy(ini_path + i, ".ini");
- GetPrivateProfileString("Window", "Title",
- (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2),
- window_title, sizeof(window_title), ini_path);
- }
- }
+ DWORD ini_path_length;
+
+ ini_path_length = GetModuleFileName(NULL, ini_path, sizeof(ini_path));
+ if (ini_path_length > 0) {
+ int i = ini_path_length - 1;
+ for (; i>=0; i--)
+ if(ini_path[i] == '.')
+ break;
+ if (i < sizeof(ini_path) - 4) {
+ strcpy(ini_path + i, ".ini");
+ GetPrivateProfileString("Window", "Title",
+ (img->device != NULL ? (LPSTR)szImgName2 : (LPSTR)szTrcName2),
+ window_title, sizeof(window_title), ini_path);
+ }
+ }
}
/* create window */
img->hwnd = CreateWindow(szImgName2, window_title,
- WS_OVERLAPPEDWINDOW,
- img->x, img->y, img->cx, img->cy,
- NULL, NULL, GetModuleHandle(NULL), (void *)img);
+ WS_OVERLAPPEDWINDOW,
+ img->x, img->y, img->cx, img->cy,
+ NULL, NULL, GetModuleHandle(NULL), (void *)img);
if (img->device == NULL && img->x != CW_USEDEFAULT &&
- img->y != CW_USEDEFAULT &&
- img->cx != CW_USEDEFAULT &&
- img->cy != CW_USEDEFAULT)
+ img->y != CW_USEDEFAULT &&
+ img->cx != CW_USEDEFAULT &&
+ img->cy != CW_USEDEFAULT)
MoveWindow(img->hwnd, img->x, img->y, img->cx, img->cy, FALSE);
ShowWindow(img->hwnd, (img->device != NULL ? SW_SHOWMINNOACTIVE : SW_SHOW));
@@ -548,17 +541,16 @@ create_window(IMAGE *img)
image_separations(img);
}
-
void
image_poll(IMAGE *img)
{
if ((img->bmih.biWidth == 0) || (img->bmih.biHeight == 0))
- return;
+ return;
img->pending_update = 1;
if (img->update_timer == 0) {
- img->update_timer = 1;
- img->update_count = 0;
- SetTimer(img->hwnd, img->update_timer, img->update_tick, NULL);
+ img->update_timer = 1;
+ img->update_count = 0;
+ SetTimer(img->hwnd, img->update_timer, img->update_tick, NULL);
}
}
@@ -570,37 +562,36 @@ image_update_now(IMAGE *img)
SYSTEMTIME t2;
int delta;
if ( !IsWindow(img->hwnd) ) /* some clod closed the window */
- create_window(img);
+ create_window(img);
if ( !IsIconic(img->hwnd) ) { /* redraw window */
- GetSystemTime(&t1);
- InvalidateRect(img->hwnd, NULL, 1);
- UpdateWindow(img->hwnd);
- GetSystemTime(&t2);
- /* Make sure the update interval is at least 10 times
- * what it takes to paint the window
- */
- delta = (t2.wSecond - t1.wSecond)*1000 +
- (t2.wMilliseconds - t1.wMilliseconds);
- if (delta < 0)
- delta += 60000;
- delta = 10 * delta / img->update_tick + 1;
- if (delta > img->update_interval)
- img->update_interval = delta;
- else if ((delta >= 2) &&
- (delta < img->update_interval / 4))
- img->update_interval = delta/2;
+ GetSystemTime(&t1);
+ InvalidateRect(img->hwnd, NULL, 1);
+ UpdateWindow(img->hwnd);
+ GetSystemTime(&t2);
+ /* Make sure the update interval is at least 10 times
+ * what it takes to paint the window
+ */
+ delta = (t2.wSecond - t1.wSecond)*1000 +
+ (t2.wMilliseconds - t1.wMilliseconds);
+ if (delta < 0)
+ delta += 60000;
+ delta = 10 * delta / img->update_tick + 1;
+ if (delta > img->update_interval)
+ img->update_interval = delta;
+ else if ((delta >= 2) &&
+ (delta < img->update_interval / 4))
+ img->update_interval = delta/2;
}
img->update_count = 0;
}
-
void
image_sync(IMAGE *img)
{
if (img->update_timer) {
- /* stop timer when nothing is happening */
- KillTimer(img->hwnd, img->update_timer);
+ /* stop timer when nothing is happening */
+ KillTimer(img->hwnd, img->update_timer);
img->update_timer = 0;
}
img->pending_sync = 0;
@@ -609,18 +600,16 @@ image_sync(IMAGE *img)
img->pending_update = 0;
}
-
void
image_page(IMAGE *img)
{
if (IsIconic(img->hwnd)) /* useless as an Icon so fix it */
- ShowWindow(img->hwnd, SW_SHOWNORMAL);
+ ShowWindow(img->hwnd, SW_SHOWNORMAL);
BringWindowToTop(img->hwnd);
image_sync(img);
}
-
/* GUI thread */
void
image_updatesize(IMAGE *img)
@@ -630,13 +619,13 @@ image_updatesize(IMAGE *img)
image_separations(img);
/* update scroll bars */
if (!IsIconic(img->hwnd)) {
- if (IsZoomed(img->hwnd))
- nSizeType = SIZE_MAXIMIZED;
- else
- nSizeType = SIZE_RESTORED;
- GetClientRect(img->hwnd, &rect);
- SendMessage(img->hwnd, WM_SIZE, nSizeType,
- MAKELONG(rect.right, rect.bottom));
+ if (IsZoomed(img->hwnd))
+ nSizeType = SIZE_MAXIMIZED;
+ else
+ nSizeType = SIZE_RESTORED;
+ GetClientRect(img->hwnd, &rect);
+ SendMessage(img->hwnd, WM_SIZE, nSizeType,
+ MAKELONG(rect.right, rect.bottom));
}
}
@@ -645,56 +634,55 @@ image_color(unsigned int format, int index,
unsigned char *r, unsigned char *g, unsigned char *b)
{
switch (format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 0 : 255);
- break;
- case DISPLAY_DEPTH_4:
- if (index == 7)
- *r = *g = *b = 170;
- else if (index == 8)
- *r = *g = *b = 85;
- else {
- int one = index & 8 ? 255 : 128;
- *r = (index & 4 ? one : 0);
- *g = (index & 2 ? one : 0);
- *b = (index & 1 ? one : 0);
- }
- break;
- case DISPLAY_DEPTH_8:
- /* palette of 96 colors */
- /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
- if (index < 64) {
- int one = 255 / 3;
- *r = ((index & 0x30) >> 4) * one;
- *g = ((index & 0x0c) >> 2) * one;
- *b = (index & 0x03) * one;
- }
- else {
- int val = index & 0x1f;
- *r = *g = *b = (val << 3) + (val >> 2);
- }
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- *r = *g = *b = (index ? 255 : 0);
- break;
- case DISPLAY_DEPTH_4:
- *r = *g = *b = (unsigned char)((index<<4) + index);
- break;
- case DISPLAY_DEPTH_8:
- *r = *g = *b = (unsigned char)index;
- break;
- }
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 0 : 255);
+ break;
+ case DISPLAY_DEPTH_4:
+ if (index == 7)
+ *r = *g = *b = 170;
+ else if (index == 8)
+ *r = *g = *b = 85;
+ else {
+ int one = index & 8 ? 255 : 128;
+ *r = (index & 4 ? one : 0);
+ *g = (index & 2 ? one : 0);
+ *b = (index & 1 ? one : 0);
+ }
+ break;
+ case DISPLAY_DEPTH_8:
+ /* palette of 96 colors */
+ /* 0->63 = 00RRGGBB, 64->95 = 010YYYYY */
+ if (index < 64) {
+ int one = 255 / 3;
+ *r = ((index & 0x30) >> 4) * one;
+ *g = ((index & 0x0c) >> 2) * one;
+ *b = (index & 0x03) * one;
+ }
+ else {
+ int val = index & 0x1f;
+ *r = *g = *b = (val << 3) + (val >> 2);
+ }
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ *r = *g = *b = (index ? 255 : 0);
+ break;
+ case DISPLAY_DEPTH_4:
+ *r = *g = *b = (unsigned char)((index<<4) + index);
+ break;
+ case DISPLAY_DEPTH_8:
+ *r = *g = *b = (unsigned char)index;
+ break;
+ }
+ break;
}
}
-
/* convert one line of 16BGR555 to 24BGR */
/* byte0=GGGBBBBB byte1=0RRRRRGG */
void
@@ -704,14 +692,14 @@ image_16BGR555_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = source[0] + (source[1] << 8);
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 10) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = source[0] + (source[1] << 8);
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 10) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -724,14 +712,14 @@ image_16BGR565_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = source[0] + (source[1] << 8);
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *dest++ = (value << 2) + (value >> 4);
- value = (w >> 11) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = source[0] + (source[1] << 8);
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *dest++ = (value << 2) + (value >> 4);
+ value = (w >> 11) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -744,14 +732,14 @@ image_16RGB555_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = (source[0] << 8) + source[1];
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x1f; /* green */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 10) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = (source[0] << 8) + source[1];
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x1f; /* green */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 10) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -764,14 +752,14 @@ image_16RGB565_to_24BGR(int width, unsigned char *dest, unsigned char *source)
WORD w;
unsigned char value;
for (i=0; i<width; i++) {
- w = (source[0] << 8) + source[1];
- value = w & 0x1f; /* blue */
- *dest++ = (value << 3) + (value >> 2);
- value = (w >> 5) & 0x3f; /* green */
- *dest++ = (value << 2) + (value >> 4);
- value = (w >> 11) & 0x1f; /* red */
- *dest++ = (value << 3) + (value >> 2);
- source += 2;
+ w = (source[0] << 8) + source[1];
+ value = w & 0x1f; /* blue */
+ *dest++ = (value << 3) + (value >> 2);
+ value = (w >> 5) & 0x3f; /* green */
+ *dest++ = (value << 2) + (value >> 4);
+ value = (w >> 11) & 0x1f; /* red */
+ *dest++ = (value << 3) + (value >> 2);
+ source += 2;
}
}
@@ -790,29 +778,29 @@ image_4CMYK_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int value;
for (i=0; i<width; i++) {
value = source[i/2];
- if (i & 0)
- value >>= 4;
- cyan = ((value >> 3) & 1) * 255;
- magenta = ((value >> 2) & 1) * 255;
- yellow = ((value >> 1) & 1) * 255;
- black = (value & 1) * 255;
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ if (i & 0)
+ value >>= 4;
+ cyan = ((value >> 3) & 1) * 255;
+ magenta = ((value >> 2) & 1) * 255;
+ yellow = ((value >> 1) & 1) * 255;
+ black = (value & 1) * 255;
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
}
}
@@ -830,28 +818,28 @@ image_32CMYK_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int vall = vc && vm && vy && vk;
int show_gray = (vc + vm + vy + vk == 1) && devicen_gray;
for (i=0; i<width; i++) {
- cyan = source[0];
- magenta = source[1];
- yellow = source[2];
- black = source[3];
- if (!vall) {
- if (!vc)
- cyan = 0;
- if (!vm)
- magenta = 0;
- if (!vy)
- yellow = 0;
- if (!vk)
- black = 0;
- if (show_gray) {
- black += cyan + magenta + yellow;
- cyan = magenta = yellow = 0;
- }
- }
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
- source += 4;
+ cyan = source[0];
+ magenta = source[1];
+ yellow = source[2];
+ black = source[3];
+ if (!vall) {
+ if (!vc)
+ cyan = 0;
+ if (!vm)
+ magenta = 0;
+ if (!vy)
+ yellow = 0;
+ if (!vk)
+ black = 0;
+ if (show_gray) {
+ black += cyan + magenta + yellow;
+ cyan = magenta = yellow = 0;
+ }
+ }
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ source += 4;
}
}
@@ -866,42 +854,42 @@ image_devicen_to_24BGR(int width, unsigned char *dest, unsigned char *source,
int num_visible = 0;
int show_gray = 0;
for (j=0; j<IMAGE_DEVICEN_MAX; j++) {
- if (devicen[j].used) {
- num_comp = j+1;
- if (devicen[j].visible)
- num_visible++;
- }
+ if (devicen[j].used) {
+ num_comp = j+1;
+ if (devicen[j].visible)
+ num_visible++;
+ }
}
if ((num_visible == 1) && devicen_gray)
- show_gray = 1;
+ show_gray = 1;
for (i=0; i<width; i++) {
- cyan = magenta = yellow = black = 0;
- for (j=0; j<num_comp; j++) {
- if (devicen[j].visible && devicen[j].used) {
- value = source[j];
- if (show_gray)
- black += value;
- else {
- cyan += value * devicen[j].cyan / 65535;
- magenta += value * devicen[j].magenta / 65535;
- yellow += value * devicen[j].yellow / 65535;
- black += value * devicen[j].black / 65535;
- }
- }
- }
- if (cyan > 255)
- cyan = 255;
- if (magenta > 255)
- magenta = 255;
- if (yellow > 255)
- yellow = 255;
- if (black > 255)
- black = 255;
- *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
- *dest++ = (255 - magenta) * (255 - black)/255; /* green */
- *dest++ = (255 - cyan) * (255 - black)/255; /* red */
- source += 8;
+ cyan = magenta = yellow = black = 0;
+ for (j=0; j<num_comp; j++) {
+ if (devicen[j].visible && devicen[j].used) {
+ value = source[j];
+ if (show_gray)
+ black += value;
+ else {
+ cyan += value * devicen[j].cyan / 65535;
+ magenta += value * devicen[j].magenta / 65535;
+ yellow += value * devicen[j].yellow / 65535;
+ black += value * devicen[j].black / 65535;
+ }
+ }
+ }
+ if (cyan > 255)
+ cyan = 255;
+ if (magenta > 255)
+ magenta = 255;
+ if (yellow > 255)
+ yellow = 255;
+ if (black > 255)
+ black = 255;
+ *dest++ = (255 - yellow) * (255 - black)/255; /* blue */
+ *dest++ = (255 - magenta) * (255 - black)/255; /* green */
+ *dest++ = (255 - cyan) * (255 - black)/255; /* red */
+ source += 8;
}
}
@@ -916,73 +904,73 @@ image_convert_line(IMAGE *img, unsigned char *dest, unsigned char *source)
int i;
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_16) {
- if (bigendian) {
- if ((img->format & DISPLAY_555_MASK)
- == DISPLAY_NATIVE_555)
- image_16RGB555_to_24BGR(img->bmih.biWidth,
- dest, source);
- else
- image_16RGB565_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- else {
- if ((img->format & DISPLAY_555_MASK)
- == DISPLAY_NATIVE_555) {
- image_16BGR555_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- else
- image_16BGR565_to_24BGR(img->bmih.biWidth,
- dest, source);
- }
- }
- break;
- case DISPLAY_COLORS_RGB:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return;
- for (i=0; i<width; i++) {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST))
- s++;
- if (bigendian) {
- *d++ = s[2];
- *d++ = s[1];
- *d++ = s[0];
- s+=3;
- }
- else {
- *d++ = *s++;
- *d++ = *s++;
- *d++ = *s++;
- }
- if ((alpha == DISPLAY_ALPHA_LAST) ||
- (alpha == DISPLAY_UNUSED_LAST))
- s++;
- }
+ case DISPLAY_COLORS_NATIVE:
+ if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_16) {
+ if (bigendian) {
+ if ((img->format & DISPLAY_555_MASK)
+ == DISPLAY_NATIVE_555)
+ image_16RGB555_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ else
+ image_16RGB565_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ else {
+ if ((img->format & DISPLAY_555_MASK)
+ == DISPLAY_NATIVE_555) {
+ image_16BGR555_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ else
+ image_16BGR565_to_24BGR(img->bmih.biWidth,
+ dest, source);
+ }
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return;
+ for (i=0; i<width; i++) {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST))
+ s++;
+ if (bigendian) {
+ *d++ = s[2];
+ *d++ = s[1];
+ *d++ = s[0];
+ s+=3;
+ }
+ else {
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ }
+ if ((alpha == DISPLAY_ALPHA_LAST) ||
+ (alpha == DISPLAY_UNUSED_LAST))
+ s++;
+ }
/*
printf("rgb, width=%d alpha=%d d=0x%x s=0x%x\n", width, alpha, (int)d, (int)s);
printf(" d=0x%x s=0x%x\n", (int)d, (int)s);
*/
- break;
- case DISPLAY_COLORS_CMYK:
- if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
- image_32CMYK_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- else if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1) {
- image_4CMYK_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- }
- else
- return;
- break;
- case DISPLAY_COLORS_SEPARATION:
- if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
- return;
- image_devicen_to_24BGR(width, dest, source,
- img->devicen, img->devicen_gray);
- break;
+ break;
+ case DISPLAY_COLORS_CMYK:
+ if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8)
+ image_32CMYK_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ else if ((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_1) {
+ image_4CMYK_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ }
+ else
+ return;
+ break;
+ case DISPLAY_COLORS_SEPARATION:
+ if ((img->format & DISPLAY_DEPTH_MASK) != DISPLAY_DEPTH_8)
+ return;
+ image_devicen_to_24BGR(width, dest, source,
+ img->devicen, img->devicen_gray);
+ break;
}
}
@@ -1007,28 +995,27 @@ copy_dib(IMAGE *img)
/* Allocates memory for the clipboard bitmap */
if (img->bmih.biBitCount <= 1)
- bitsperpixel = 1;
+ bitsperpixel = 1;
else if (img->bmih.biBitCount <= 4)
- bitsperpixel = 4;
+ bitsperpixel = 4;
else if (img->bmih.biBitCount <= 8)
- bitsperpixel = 8;
+ bitsperpixel = 8;
else
- bitsperpixel = 24;
+ bitsperpixel = 24;
bytewidth = ((img->bmih.biWidth * bitsperpixel + 31 ) & ~31) >> 3;
bitmapsize = bytewidth * img->bmih.biHeight;
if (bitsperpixel > 8)
- palcount = 0; /* 24-bit BGR */
+ palcount = 0; /* 24-bit BGR */
else
- palcount = img->bmih.biClrUsed;
+ palcount = img->bmih.biClrUsed;
hglobal = GlobalAlloc(GHND | GMEM_SHARE, sizeof(BITMAPINFOHEADER)
- + sizeof(RGBQUAD) * palcount + bitmapsize);
+ + sizeof(RGBQUAD) * palcount + bitmapsize);
if (hglobal == (HGLOBAL) NULL)
- return (HGLOBAL) NULL;
+ return (HGLOBAL) NULL;
pDIB = (BYTE *) GlobalLock(hglobal);
if (pDIB == (BYTE *) NULL)
- return (HGLOBAL) NULL;
-
+ return (HGLOBAL) NULL;
/* initialize the clipboard bitmap */
pbmih = (BITMAPINFOHEADER *) (pDIB);
@@ -1047,49 +1034,49 @@ copy_dib(IMAGE *img)
pbmih->biClrImportant = palcount;
for (i = 0; i < palcount; i++) {
- image_color(img->format, i, &pColors[i].rgbRed,
- &pColors[i].rgbGreen, &pColors[i].rgbBlue);
- pColors[i].rgbReserved = 0;
+ image_color(img->format, i, &pColors[i].rgbRed,
+ &pColors[i].rgbGreen, &pColors[i].rgbBlue);
+ pColors[i].rgbReserved = 0;
}
/* find out if the format needs to be converted */
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN))
- directcopy = TRUE;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN))
+ directcopy = TRUE;
}
pLine = pBits;
if (directcopy) {
- for (i = 0; i < img->bmih.biHeight; i++) {
- memcpy(pLine, img->image + i * img->raster, bytewidth);
- pLine += bytewidth;
- }
+ for (i = 0; i < img->bmih.biHeight; i++) {
+ memcpy(pLine, img->image + i * img->raster, bytewidth);
+ pLine += bytewidth;
+ }
}
else {
- /* we need to convert the format to 24BGR */
- for (i = 0; i < img->bmih.biHeight; i++) {
- image_convert_line(img, pLine, img->image + i * img->raster);
- pLine += bytewidth;
- }
+ /* we need to convert the format to 24BGR */
+ for (i = 0; i < img->bmih.biHeight; i++) {
+ image_convert_line(img, pLine, img->image + i * img->raster);
+ pLine += bytewidth;
+ }
}
GlobalUnlock(hglobal);
@@ -1106,22 +1093,22 @@ create_palette(IMAGE *img)
nColors = img->bmih.biClrUsed;
if (nColors) {
- LPLOGPALETTE logpalette;
- logpalette = (LPLOGPALETTE) malloc(sizeof(LOGPALETTE) +
- nColors * sizeof(PALETTEENTRY));
- if (logpalette == (LPLOGPALETTE) NULL)
- return (HPALETTE)0;
- logpalette->palVersion = 0x300;
- logpalette->palNumEntries = img->bmih.biClrUsed;
- for (i = 0; i < nColors; i++) {
- logpalette->palPalEntry[i].peFlags = 0;
- image_color(img->format, i,
- &logpalette->palPalEntry[i].peRed,
- &logpalette->palPalEntry[i].peGreen,
- &logpalette->palPalEntry[i].peBlue);
- }
- palette = CreatePalette(logpalette);
- free(logpalette);
+ LPLOGPALETTE logpalette;
+ logpalette = (LPLOGPALETTE) malloc(sizeof(LOGPALETTE) +
+ nColors * sizeof(PALETTEENTRY));
+ if (logpalette == (LPLOGPALETTE) NULL)
+ return (HPALETTE)0;
+ logpalette->palVersion = 0x300;
+ logpalette->palNumEntries = img->bmih.biClrUsed;
+ for (i = 0; i < nColors; i++) {
+ logpalette->palPalEntry[i].peFlags = 0;
+ image_color(img->format, i,
+ &logpalette->palPalEntry[i].peRed,
+ &logpalette->palPalEntry[i].peGreen,
+ &logpalette->palPalEntry[i].peBlue);
+ }
+ palette = CreatePalette(logpalette);
+ free(logpalette);
}
return palette;
}
@@ -1138,361 +1125,359 @@ WndImg2Proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
IMAGE *img;
if (message == WM_CREATE) {
- /* Object is stored in window extra data.
- * Nothing must try to use the object before WM_CREATE
- * initializes it here.
- */
- img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams);
- SetWindowLong(hwnd, 0, (LONG)img);
+ /* Object is stored in window extra data.
+ * Nothing must try to use the object before WM_CREATE
+ * initializes it here.
+ */
+ img = (IMAGE *)(((CREATESTRUCT *)lParam)->lpCreateParams);
+ SetWindowLong(hwnd, 0, (LONG)img);
}
img = (IMAGE *)GetWindowLong(hwnd, 0);
-
switch(message) {
- case WM_SYSCOMMAND:
- /* copy to clipboard */
- if (LOWORD(wParam) == M_COPY_CLIP) {
- HGLOBAL hglobal;
- HPALETTE hpalette;
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- hglobal = copy_dib(img);
- if (hglobal == (HGLOBAL)NULL) {
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- MessageBox(hwnd, "Not enough memory to Copy to Clipboard",
- szImgName2, MB_OK | MB_ICONEXCLAMATION);
- return 0;
- }
- OpenClipboard(hwnd);
- EmptyClipboard();
- SetClipboardData(CF_DIB, hglobal);
- hpalette = create_palette(img);
- if (hpalette)
- SetClipboardData(CF_PALETTE, hpalette);
- CloseClipboard();
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- return 0;
- }
- else if ((LOWORD(wParam) >= M_SEPARATION) &&
- (LOWORD(wParam) < M_SEPARATION+IMAGE_DEVICEN_MAX)) {
- sep_menu(img, LOWORD(wParam) - M_SEPARATION);
- }
- else if (LOWORD(wParam) == M_DEVICEN_GRAY) {
- img->devicen_gray = !img->devicen_gray;
- CheckMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
- (img->devicen_gray ? MF_CHECKED : MF_UNCHECKED));
- InvalidateRect(img->hwnd, NULL, 0);
- UpdateWindow(img->hwnd);
- }
- break;
- case WM_CREATE:
- /* enable drag-drop */
- DragAcceptFiles(hwnd, TRUE);
- break;
- case WM_MOVE:
- if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
- GetWindowRect(hwnd, &rect);
- img->x = rect.left;
- img->y = rect.top;
- }
- break;
- case WM_SIZE:
- if (wParam == SIZE_MINIMIZED)
- return(0);
-
- /* remember current window size */
- if (wParam != SIZE_MAXIMIZED) {
- GetWindowRect(hwnd, &rect);
- img->cx = rect.right - rect.left;
- img->cy = rect.bottom - rect.top;
- img->x = rect.left;
- img->y = rect.top;
- }
-
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- img->cyClient = HIWORD(lParam);
- img->cxClient = LOWORD(lParam);
-
- img->cyAdjust = min(img->bmih.biHeight, img->cyClient) - img->cyClient;
- img->cyClient += img->cyAdjust;
-
- img->nVscrollMax = max(0, img->bmih.biHeight - img->cyClient);
- img->nVscrollPos = min(img->nVscrollPos, img->nVscrollMax);
-
- SetScrollRange(hwnd, SB_VERT, 0, img->nVscrollMax, FALSE);
- SetScrollPos(hwnd, SB_VERT, img->nVscrollPos, TRUE);
-
- img->cxAdjust = min(img->bmih.biWidth, img->cxClient) - img->cxClient;
- img->cxClient += img->cxAdjust;
-
- img->nHscrollMax = max(0, img->bmih.biWidth - img->cxClient);
- img->nHscrollPos = min(img->nHscrollPos, img->nHscrollMax);
-
- SetScrollRange(hwnd, SB_HORZ, 0, img->nHscrollMax, FALSE);
- SetScrollPos(hwnd, SB_HORZ, img->nHscrollPos, TRUE);
-
- if ((wParam==SIZENORMAL)
- && (img->cxAdjust!=0 || img->cyAdjust!=0)) {
- GetWindowRect(GetParent(hwnd),&rect);
- MoveWindow(GetParent(hwnd),rect.left,rect.top,
- rect.right-rect.left+img->cxAdjust,
- rect.bottom-rect.top+img->cyAdjust, TRUE);
- img->cxAdjust = img->cyAdjust = 0;
- }
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- return(0);
- case WM_VSCROLL:
- switch(LOWORD(wParam)) {
- case SB_TOP:
- nVscrollInc = -img->nVscrollPos;
- break;
- case SB_BOTTOM:
- nVscrollInc = img->nVscrollMax - img->nVscrollPos;
- break;
- case SB_LINEUP:
- nVscrollInc = -img->cyClient/16;
- break;
- case SB_LINEDOWN:
- nVscrollInc = img->cyClient/16;
- break;
- case SB_PAGEUP:
- nVscrollInc = min(-1,-img->cyClient);
- break;
- case SB_PAGEDOWN:
- nVscrollInc = max(1,img->cyClient);
- break;
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- nVscrollInc = HIWORD(wParam) - img->nVscrollPos;
- break;
- default:
- nVscrollInc = 0;
- }
- if ((nVscrollInc = max(-img->nVscrollPos,
- min(nVscrollInc, img->nVscrollMax - img->nVscrollPos)))!=0) {
- img->nVscrollPos += nVscrollInc;
- ScrollWindow(hwnd,0,-nVscrollInc,NULL,NULL);
- SetScrollPos(hwnd,SB_VERT,img->nVscrollPos,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_HSCROLL:
- switch(LOWORD(wParam)) {
- case SB_LINEUP:
- nHscrollInc = -img->cxClient/16;
- break;
- case SB_LINEDOWN:
- nHscrollInc = img->cyClient/16;
- break;
- case SB_PAGEUP:
- nHscrollInc = min(-1,-img->cxClient);
- break;
- case SB_PAGEDOWN:
- nHscrollInc = max(1,img->cxClient);
- break;
- case SB_THUMBTRACK:
- case SB_THUMBPOSITION:
- nHscrollInc = HIWORD(wParam) - img->nHscrollPos;
- break;
- default:
- nHscrollInc = 0;
- }
- if ((nHscrollInc = max(-img->nHscrollPos,
- min(nHscrollInc, img->nHscrollMax - img->nHscrollPos)))!=0) {
- img->nHscrollPos += nHscrollInc;
- ScrollWindow(hwnd,-nHscrollInc,0,NULL,NULL);
- SetScrollPos(hwnd,SB_HORZ,img->nHscrollPos,TRUE);
- UpdateWindow(hwnd);
- }
- return(0);
- case WM_KEYDOWN:
- switch(LOWORD(wParam)) {
- case VK_HOME:
- SendMessage(hwnd,WM_VSCROLL,SB_TOP,0L);
- break;
- case VK_END:
- SendMessage(hwnd,WM_VSCROLL,SB_BOTTOM,0L);
- break;
- case VK_PRIOR:
- SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP,0L);
- break;
- case VK_NEXT:
- SendMessage(hwnd,WM_VSCROLL,SB_PAGEDOWN,0L);
- break;
- case VK_UP:
- SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L);
- break;
- case VK_DOWN:
- SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0L);
- break;
- case VK_LEFT:
- SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L);
- break;
- case VK_RIGHT:
- SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L);
- break;
- case VK_RETURN:
- if (img->hwndtext)
- BringWindowToTop(img->hwndtext);
- break;
- }
- return(0);
- case WM_CHAR:
- /* send on all characters to text window */
- if (img->hwndtext)
- SendMessage(img->hwndtext, message, wParam, lParam);
- else {
- /* assume we have a console */
- INPUT_RECORD ir;
- HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
- DWORD dwWritten = 0;
- DWORD cks = 0;
- ir.EventType = KEY_EVENT;
- ir.Event.KeyEvent.bKeyDown = TRUE;
- ir.Event.KeyEvent.wRepeatCount = lParam & 0xffff;
- ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan((TCHAR)wParam) & 0xff;
- ir.Event.KeyEvent.wVirtualScanCode =
- (lParam >> 16) & 0xff;
- ir.Event.KeyEvent.uChar.AsciiChar = wParam;
- if (GetKeyState(VK_CAPITAL))
- cks |= CAPSLOCK_ON;
- /* ENHANCED_KEY unimplemented */
- if (GetKeyState(VK_LMENU))
- cks |= LEFT_ALT_PRESSED;
- if (GetKeyState(VK_LCONTROL))
- cks |= LEFT_CTRL_PRESSED;
- if (GetKeyState(VK_NUMLOCK))
- cks |= NUMLOCK_ON;
- if (GetKeyState(VK_RMENU))
- cks |= RIGHT_ALT_PRESSED;
- if (GetKeyState(VK_RCONTROL))
- cks |= RIGHT_CTRL_PRESSED;
- if (GetKeyState(VK_SCROLL))
- cks |= SCROLLLOCK_ON;
- if (GetKeyState(VK_SHIFT))
- cks |= SHIFT_PRESSED;
- ir.Event.KeyEvent.dwControlKeyState = cks;
- if (ir.Event.KeyEvent.uChar.AsciiChar == 3)
- GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0L);
- else if (hStdin != INVALID_HANDLE_VALUE)
- WriteConsoleInput(hStdin, &ir, 1, &dwWritten);
- }
- return 0;
- case WM_TIMER:
- img->update_count++;
- if (img->update_count >= img->update_interval)
- image_update_now(img);
- return 0;
- case WM_PAINT:
- {
- int sx,sy,wx,wy,dx,dy;
- RECT fillrect;
- hdc = BeginPaint(hwnd, &ps);
- if (img->hmutex != INVALID_HANDLE_VALUE)
- WaitForSingleObject(img->hmutex, 120000);
- SetMapMode(hdc, MM_TEXT);
- SetBkMode(hdc,OPAQUE);
- rect = ps.rcPaint;
- dx = rect.left; /* destination */
- dy = rect.top;
- wx = rect.right-rect.left; /* width */
- wy = rect.bottom-rect.top;
- sx = rect.left; /* source */
- sy = rect.top;
- sx += img->nHscrollPos; /* scrollbars */
- sy += img->nVscrollPos;
- if (sx+wx > img->bmih.biWidth)
- wx = img->bmih.biWidth - sx;
- if (sy+wy > img->bmih.biHeight)
- wy = img->bmih.biHeight - sy;
-
- draw(img, hdc, dx, dy, wx, wy, sx, sy);
-
- /* fill areas around page */
- if (rect.right > img->bmih.biWidth) {
- fillrect.top = rect.top;
- fillrect.left = img->bmih.biWidth;
- fillrect.bottom = rect.bottom;
- fillrect.right = rect.right;
- FillRect(hdc, &fillrect, img->hBrush);
- }
- if (rect.bottom > img->bmih.biHeight) {
- fillrect.top = img->bmih.biHeight;
- fillrect.left = rect.left;
- fillrect.bottom = rect.bottom;
- fillrect.right = rect.right;
- FillRect(hdc, &fillrect, img->hBrush);
- }
-
- if (img->hmutex != INVALID_HANDLE_VALUE)
- ReleaseMutex(img->hmutex);
- EndPaint(hwnd, &ps);
- return 0;
- }
- case WM_DROPFILES:
- if (img->hwndtext)
- SendMessage(img->hwndtext, message, wParam, lParam);
- else {
- char *szFile;
- int i, cFiles;
- unsigned int Len, error;
- const char *p;
- const char *szDragPre = "\r(";
- const char *szDragPost = ") run\r";
- HDROP hdrop = (HDROP)wParam;
- cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
- for (i=0; i<cFiles; i++) {
- Len = DragQueryFile(hdrop, i, NULL, 0);
- szFile = malloc(Len+1);
- if (szFile != 0) {
- error = DragQueryFile(hdrop, i, szFile, Len+1);
- if (error != 0) {
- for (p=szDragPre; *p; p++)
- SendMessage(hwnd,WM_CHAR,*p,1L);
- for (p=szFile; *p; p++) {
- if (*p == '\\')
- SendMessage(hwnd,WM_CHAR,'/',1L);
- else
- SendMessage(hwnd,WM_CHAR,*p,1L);
- }
- for (p=szDragPost; *p; p++)
- SendMessage(hwnd,WM_CHAR,*p,1L);
- }
- free(szFile);
- }
- }
- DragFinish(hdrop);
- }
- break;
- case WM_DESTROY:
- { /* Save the text window size */
- char winposbuf[64];
- sprintf(winposbuf, "%d %d %d %d", img->x, img->y,
- img->cx, img->cy);
- win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf);
- }
- DragAcceptFiles(hwnd, FALSE);
- break;
+ case WM_SYSCOMMAND:
+ /* copy to clipboard */
+ if (LOWORD(wParam) == M_COPY_CLIP) {
+ HGLOBAL hglobal;
+ HPALETTE hpalette;
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ hglobal = copy_dib(img);
+ if (hglobal == (HGLOBAL)NULL) {
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ MessageBox(hwnd, "Not enough memory to Copy to Clipboard",
+ szImgName2, MB_OK | MB_ICONEXCLAMATION);
+ return 0;
+ }
+ OpenClipboard(hwnd);
+ EmptyClipboard();
+ SetClipboardData(CF_DIB, hglobal);
+ hpalette = create_palette(img);
+ if (hpalette)
+ SetClipboardData(CF_PALETTE, hpalette);
+ CloseClipboard();
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ return 0;
+ }
+ else if ((LOWORD(wParam) >= M_SEPARATION) &&
+ (LOWORD(wParam) < M_SEPARATION+IMAGE_DEVICEN_MAX)) {
+ sep_menu(img, LOWORD(wParam) - M_SEPARATION);
+ }
+ else if (LOWORD(wParam) == M_DEVICEN_GRAY) {
+ img->devicen_gray = !img->devicen_gray;
+ CheckMenuItem(GetSystemMenu(img->hwnd, FALSE), M_DEVICEN_GRAY,
+ (img->devicen_gray ? MF_CHECKED : MF_UNCHECKED));
+ InvalidateRect(img->hwnd, NULL, 0);
+ UpdateWindow(img->hwnd);
+ }
+ break;
+ case WM_CREATE:
+ /* enable drag-drop */
+ DragAcceptFiles(hwnd, TRUE);
+ break;
+ case WM_MOVE:
+ if (!IsIconic(hwnd) && !IsZoomed(hwnd)) {
+ GetWindowRect(hwnd, &rect);
+ img->x = rect.left;
+ img->y = rect.top;
+ }
+ break;
+ case WM_SIZE:
+ if (wParam == SIZE_MINIMIZED)
+ return(0);
+
+ /* remember current window size */
+ if (wParam != SIZE_MAXIMIZED) {
+ GetWindowRect(hwnd, &rect);
+ img->cx = rect.right - rect.left;
+ img->cy = rect.bottom - rect.top;
+ img->x = rect.left;
+ img->y = rect.top;
+ }
+
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ img->cyClient = HIWORD(lParam);
+ img->cxClient = LOWORD(lParam);
+
+ img->cyAdjust = min(img->bmih.biHeight, img->cyClient) - img->cyClient;
+ img->cyClient += img->cyAdjust;
+
+ img->nVscrollMax = max(0, img->bmih.biHeight - img->cyClient);
+ img->nVscrollPos = min(img->nVscrollPos, img->nVscrollMax);
+
+ SetScrollRange(hwnd, SB_VERT, 0, img->nVscrollMax, FALSE);
+ SetScrollPos(hwnd, SB_VERT, img->nVscrollPos, TRUE);
+
+ img->cxAdjust = min(img->bmih.biWidth, img->cxClient) - img->cxClient;
+ img->cxClient += img->cxAdjust;
+
+ img->nHscrollMax = max(0, img->bmih.biWidth - img->cxClient);
+ img->nHscrollPos = min(img->nHscrollPos, img->nHscrollMax);
+
+ SetScrollRange(hwnd, SB_HORZ, 0, img->nHscrollMax, FALSE);
+ SetScrollPos(hwnd, SB_HORZ, img->nHscrollPos, TRUE);
+
+ if ((wParam==SIZENORMAL)
+ && (img->cxAdjust!=0 || img->cyAdjust!=0)) {
+ GetWindowRect(GetParent(hwnd),&rect);
+ MoveWindow(GetParent(hwnd),rect.left,rect.top,
+ rect.right-rect.left+img->cxAdjust,
+ rect.bottom-rect.top+img->cyAdjust, TRUE);
+ img->cxAdjust = img->cyAdjust = 0;
+ }
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ return(0);
+ case WM_VSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_TOP:
+ nVscrollInc = -img->nVscrollPos;
+ break;
+ case SB_BOTTOM:
+ nVscrollInc = img->nVscrollMax - img->nVscrollPos;
+ break;
+ case SB_LINEUP:
+ nVscrollInc = -img->cyClient/16;
+ break;
+ case SB_LINEDOWN:
+ nVscrollInc = img->cyClient/16;
+ break;
+ case SB_PAGEUP:
+ nVscrollInc = min(-1,-img->cyClient);
+ break;
+ case SB_PAGEDOWN:
+ nVscrollInc = max(1,img->cyClient);
+ break;
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ nVscrollInc = HIWORD(wParam) - img->nVscrollPos;
+ break;
+ default:
+ nVscrollInc = 0;
+ }
+ if ((nVscrollInc = max(-img->nVscrollPos,
+ min(nVscrollInc, img->nVscrollMax - img->nVscrollPos)))!=0) {
+ img->nVscrollPos += nVscrollInc;
+ ScrollWindow(hwnd,0,-nVscrollInc,NULL,NULL);
+ SetScrollPos(hwnd,SB_VERT,img->nVscrollPos,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_HSCROLL:
+ switch(LOWORD(wParam)) {
+ case SB_LINEUP:
+ nHscrollInc = -img->cxClient/16;
+ break;
+ case SB_LINEDOWN:
+ nHscrollInc = img->cyClient/16;
+ break;
+ case SB_PAGEUP:
+ nHscrollInc = min(-1,-img->cxClient);
+ break;
+ case SB_PAGEDOWN:
+ nHscrollInc = max(1,img->cxClient);
+ break;
+ case SB_THUMBTRACK:
+ case SB_THUMBPOSITION:
+ nHscrollInc = HIWORD(wParam) - img->nHscrollPos;
+ break;
+ default:
+ nHscrollInc = 0;
+ }
+ if ((nHscrollInc = max(-img->nHscrollPos,
+ min(nHscrollInc, img->nHscrollMax - img->nHscrollPos)))!=0) {
+ img->nHscrollPos += nHscrollInc;
+ ScrollWindow(hwnd,-nHscrollInc,0,NULL,NULL);
+ SetScrollPos(hwnd,SB_HORZ,img->nHscrollPos,TRUE);
+ UpdateWindow(hwnd);
+ }
+ return(0);
+ case WM_KEYDOWN:
+ switch(LOWORD(wParam)) {
+ case VK_HOME:
+ SendMessage(hwnd,WM_VSCROLL,SB_TOP,0L);
+ break;
+ case VK_END:
+ SendMessage(hwnd,WM_VSCROLL,SB_BOTTOM,0L);
+ break;
+ case VK_PRIOR:
+ SendMessage(hwnd,WM_VSCROLL,SB_PAGEUP,0L);
+ break;
+ case VK_NEXT:
+ SendMessage(hwnd,WM_VSCROLL,SB_PAGEDOWN,0L);
+ break;
+ case VK_UP:
+ SendMessage(hwnd,WM_VSCROLL,SB_LINEUP,0L);
+ break;
+ case VK_DOWN:
+ SendMessage(hwnd,WM_VSCROLL,SB_LINEDOWN,0L);
+ break;
+ case VK_LEFT:
+ SendMessage(hwnd,WM_HSCROLL,SB_PAGEUP,0L);
+ break;
+ case VK_RIGHT:
+ SendMessage(hwnd,WM_HSCROLL,SB_PAGEDOWN,0L);
+ break;
+ case VK_RETURN:
+ if (img->hwndtext)
+ BringWindowToTop(img->hwndtext);
+ break;
+ }
+ return(0);
+ case WM_CHAR:
+ /* send on all characters to text window */
+ if (img->hwndtext)
+ SendMessage(img->hwndtext, message, wParam, lParam);
+ else {
+ /* assume we have a console */
+ INPUT_RECORD ir;
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
+ DWORD dwWritten = 0;
+ DWORD cks = 0;
+ ir.EventType = KEY_EVENT;
+ ir.Event.KeyEvent.bKeyDown = TRUE;
+ ir.Event.KeyEvent.wRepeatCount = lParam & 0xffff;
+ ir.Event.KeyEvent.wVirtualKeyCode = VkKeyScan((TCHAR)wParam) & 0xff;
+ ir.Event.KeyEvent.wVirtualScanCode =
+ (lParam >> 16) & 0xff;
+ ir.Event.KeyEvent.uChar.AsciiChar = wParam;
+ if (GetKeyState(VK_CAPITAL))
+ cks |= CAPSLOCK_ON;
+ /* ENHANCED_KEY unimplemented */
+ if (GetKeyState(VK_LMENU))
+ cks |= LEFT_ALT_PRESSED;
+ if (GetKeyState(VK_LCONTROL))
+ cks |= LEFT_CTRL_PRESSED;
+ if (GetKeyState(VK_NUMLOCK))
+ cks |= NUMLOCK_ON;
+ if (GetKeyState(VK_RMENU))
+ cks |= RIGHT_ALT_PRESSED;
+ if (GetKeyState(VK_RCONTROL))
+ cks |= RIGHT_CTRL_PRESSED;
+ if (GetKeyState(VK_SCROLL))
+ cks |= SCROLLLOCK_ON;
+ if (GetKeyState(VK_SHIFT))
+ cks |= SHIFT_PRESSED;
+ ir.Event.KeyEvent.dwControlKeyState = cks;
+ if (ir.Event.KeyEvent.uChar.AsciiChar == 3)
+ GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0L);
+ else if (hStdin != INVALID_HANDLE_VALUE)
+ WriteConsoleInput(hStdin, &ir, 1, &dwWritten);
+ }
+ return 0;
+ case WM_TIMER:
+ img->update_count++;
+ if (img->update_count >= img->update_interval)
+ image_update_now(img);
+ return 0;
+ case WM_PAINT:
+ {
+ int sx,sy,wx,wy,dx,dy;
+ RECT fillrect;
+ hdc = BeginPaint(hwnd, &ps);
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ WaitForSingleObject(img->hmutex, 120000);
+ SetMapMode(hdc, MM_TEXT);
+ SetBkMode(hdc,OPAQUE);
+ rect = ps.rcPaint;
+ dx = rect.left; /* destination */
+ dy = rect.top;
+ wx = rect.right-rect.left; /* width */
+ wy = rect.bottom-rect.top;
+ sx = rect.left; /* source */
+ sy = rect.top;
+ sx += img->nHscrollPos; /* scrollbars */
+ sy += img->nVscrollPos;
+ if (sx+wx > img->bmih.biWidth)
+ wx = img->bmih.biWidth - sx;
+ if (sy+wy > img->bmih.biHeight)
+ wy = img->bmih.biHeight - sy;
+
+ draw(img, hdc, dx, dy, wx, wy, sx, sy);
+
+ /* fill areas around page */
+ if (rect.right > img->bmih.biWidth) {
+ fillrect.top = rect.top;
+ fillrect.left = img->bmih.biWidth;
+ fillrect.bottom = rect.bottom;
+ fillrect.right = rect.right;
+ FillRect(hdc, &fillrect, img->hBrush);
+ }
+ if (rect.bottom > img->bmih.biHeight) {
+ fillrect.top = img->bmih.biHeight;
+ fillrect.left = rect.left;
+ fillrect.bottom = rect.bottom;
+ fillrect.right = rect.right;
+ FillRect(hdc, &fillrect, img->hBrush);
+ }
+
+ if (img->hmutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(img->hmutex);
+ EndPaint(hwnd, &ps);
+ return 0;
+ }
+ case WM_DROPFILES:
+ if (img->hwndtext)
+ SendMessage(img->hwndtext, message, wParam, lParam);
+ else {
+ char *szFile;
+ int i, cFiles;
+ unsigned int Len, error;
+ const char *p;
+ const char *szDragPre = "\r(";
+ const char *szDragPost = ") run\r";
+ HDROP hdrop = (HDROP)wParam;
+ cFiles = DragQueryFile(hdrop, (UINT)(-1), (LPSTR)NULL, 0);
+ for (i=0; i<cFiles; i++) {
+ Len = DragQueryFile(hdrop, i, NULL, 0);
+ szFile = malloc(Len+1);
+ if (szFile != 0) {
+ error = DragQueryFile(hdrop, i, szFile, Len+1);
+ if (error != 0) {
+ for (p=szDragPre; *p; p++)
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ for (p=szFile; *p; p++) {
+ if (*p == '\\')
+ SendMessage(hwnd,WM_CHAR,'/',1L);
+ else
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ }
+ for (p=szDragPost; *p; p++)
+ SendMessage(hwnd,WM_CHAR,*p,1L);
+ }
+ free(szFile);
+ }
+ }
+ DragFinish(hdrop);
+ }
+ break;
+ case WM_DESTROY:
+ { /* Save the text window size */
+ char winposbuf[64];
+ sprintf(winposbuf, "%d %d %d %d", img->x, img->y,
+ img->cx, img->cy);
+ win_set_reg_value((img->device != NULL ? "Image" : "Tracer"), winposbuf);
+ }
+ DragAcceptFiles(hwnd, FALSE);
+ break;
}
- return DefWindowProc(hwnd, message, wParam, lParam);
+ return DefWindowProc(hwnd, message, wParam, lParam);
}
-
/* Repaint a section of the window. */
static void
draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
- int sx, int sy)
+ int sx, int sy)
{
HPALETTE oldpalette;
struct bmi_s {
- BITMAPINFOHEADER h;
- unsigned short pal_index[256];
+ BITMAPINFOHEADER h;
+ unsigned short pal_index[256];
} bmi;
int i;
UINT which_colors;
@@ -1519,117 +1504,115 @@ draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
bmi.h.biClrImportant = img->bmih.biClrImportant;
if (img->bmih.biClrUsed) {
- /* palette colors */
- for (i = 0; i < img->bmih.biClrUsed; i++)
- bmi.pal_index[i] = i;
- which_colors = DIB_PAL_COLORS;
+ /* palette colors */
+ for (i = 0; i < img->bmih.biClrUsed; i++)
+ bmi.pal_index[i] = i;
+ which_colors = DIB_PAL_COLORS;
}
else if (bmi.h.biBitCount == 16) {
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- which_colors = DIB_RGB_COLORS;
- if ((img->format & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
- /* 5-5-5 RGB mode */
- bmi_colors[0] = 0x7c00;
- bmi_colors[1] = 0x03e0;
- bmi_colors[2] = 0x001f;
- }
- else {
- /* 5-6-5 RGB mode */
- bmi_colors[0] = 0xf800;
- bmi_colors[1] = 0x07e0;
- bmi_colors[2] = 0x001f;
- }
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ which_colors = DIB_RGB_COLORS;
+ if ((img->format & DISPLAY_555_MASK) == DISPLAY_NATIVE_555) {
+ /* 5-5-5 RGB mode */
+ bmi_colors[0] = 0x7c00;
+ bmi_colors[1] = 0x03e0;
+ bmi_colors[2] = 0x001f;
+ }
+ else {
+ /* 5-6-5 RGB mode */
+ bmi_colors[0] = 0xf800;
+ bmi_colors[1] = 0x07e0;
+ bmi_colors[2] = 0x001f;
+ }
}
else if (bmi.h.biBitCount == 32) {
- unsigned int alpha = img->format & DISPLAY_ALPHA_MASK;
- DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
- bmi.h.biCompression = BI_BITFIELDS;
- which_colors = DIB_RGB_COLORS;
- if ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST)) {
- /* Mac mode */
- bmi_colors[0] = 0x0000ff00;
- bmi_colors[1] = 0x00ff0000;
- bmi_colors[2] = 0xff000000;
- }
- else {
- bmi_colors[0] = 0x000000ff;
- bmi_colors[1] = 0x0000ff00;
- bmi_colors[2] = 0x00ff0000;
- }
- }
- else {
- if ((alpha == DISPLAY_ALPHA_FIRST) ||
- (alpha == DISPLAY_UNUSED_FIRST)) {
- /* ignore alpha */
- bmi_colors[0] = 0xff000000;
- bmi_colors[1] = 0x00ff0000;
- bmi_colors[2] = 0x0000ff00;
- }
- else {
- /* Windows mode */
- /* ignore alpha */
- bmi_colors[0] = 0x00ff0000;
- bmi_colors[1] = 0x0000ff00;
- bmi_colors[2] = 0x000000ff;
- }
- }
+ unsigned int alpha = img->format & DISPLAY_ALPHA_MASK;
+ DWORD* bmi_colors = (DWORD*)(&bmi.pal_index[0]);
+ bmi.h.biCompression = BI_BITFIELDS;
+ which_colors = DIB_RGB_COLORS;
+ if ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_BIGENDIAN) {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST)) {
+ /* Mac mode */
+ bmi_colors[0] = 0x0000ff00;
+ bmi_colors[1] = 0x00ff0000;
+ bmi_colors[2] = 0xff000000;
+ }
+ else {
+ bmi_colors[0] = 0x000000ff;
+ bmi_colors[1] = 0x0000ff00;
+ bmi_colors[2] = 0x00ff0000;
+ }
+ }
+ else {
+ if ((alpha == DISPLAY_ALPHA_FIRST) ||
+ (alpha == DISPLAY_UNUSED_FIRST)) {
+ /* ignore alpha */
+ bmi_colors[0] = 0xff000000;
+ bmi_colors[1] = 0x00ff0000;
+ bmi_colors[2] = 0x0000ff00;
+ }
+ else {
+ /* Windows mode */
+ /* ignore alpha */
+ bmi_colors[0] = 0x00ff0000;
+ bmi_colors[1] = 0x0000ff00;
+ bmi_colors[2] = 0x000000ff;
+ }
+ }
} else {
- bmi.h.biClrUsed = 0;
- bmi.h.biClrImportant = 0;
- which_colors = DIB_RGB_COLORS;
+ bmi.h.biClrUsed = 0;
+ bmi.h.biClrImportant = 0;
+ which_colors = DIB_RGB_COLORS;
}
if (img->raster <= 0)
- return;
+ return;
if (img->bytewidth <= 0)
- return;
+ return;
/* Determine if the format is native and we can do a direct copy */
switch (img->format & DISPLAY_COLORS_MASK) {
- case DISPLAY_COLORS_NATIVE:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- break;
- case DISPLAY_DEPTH_16:
- if ((img->format & DISPLAY_ENDIAN_MASK)
- == DISPLAY_LITTLEENDIAN)
- directcopy = TRUE;
- break;
- }
- break;
- case DISPLAY_COLORS_GRAY:
- switch (img->format & DISPLAY_DEPTH_MASK) {
- case DISPLAY_DEPTH_1:
- case DISPLAY_DEPTH_4:
- case DISPLAY_DEPTH_8:
- directcopy = TRUE;
- }
- break;
- case DISPLAY_COLORS_RGB:
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE))
- directcopy = TRUE; /* BGR24 */
- if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
- ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
- ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST))
- directcopy = TRUE; /* 32-bit */
- break;
+ case DISPLAY_COLORS_NATIVE:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ break;
+ case DISPLAY_DEPTH_16:
+ if ((img->format & DISPLAY_ENDIAN_MASK)
+ == DISPLAY_LITTLEENDIAN)
+ directcopy = TRUE;
+ break;
+ }
+ break;
+ case DISPLAY_COLORS_GRAY:
+ switch (img->format & DISPLAY_DEPTH_MASK) {
+ case DISPLAY_DEPTH_1:
+ case DISPLAY_DEPTH_4:
+ case DISPLAY_DEPTH_8:
+ directcopy = TRUE;
+ }
+ break;
+ case DISPLAY_COLORS_RGB:
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_ALPHA_NONE))
+ directcopy = TRUE; /* BGR24 */
+ if (((img->format & DISPLAY_DEPTH_MASK) == DISPLAY_DEPTH_8) &&
+ ((img->format & DISPLAY_ENDIAN_MASK) == DISPLAY_LITTLEENDIAN) &&
+ ((img->format & DISPLAY_ALPHA_MASK) == DISPLAY_UNUSED_LAST))
+ directcopy = TRUE; /* 32-bit */
+ break;
}
-
if (which_colors == DIB_PAL_COLORS) {
- oldpalette = SelectPalette(hdc, img->palette, FALSE);
- RealizePalette(hdc);
+ oldpalette = SelectPalette(hdc, img->palette, FALSE);
+ RealizePalette(hdc);
}
-
/*
* Windows apparently limits the size of a single transfer
* to 2 Mb, which can be exceeded on 24-bit displays.
@@ -1637,35 +1620,34 @@ draw(IMAGE *img, HDC hdc, int dx, int dy, int wx, int wy,
ny = 2000000 / img->raster;
if (img->raster != img->bytewidth) /* not 32-bit architecture */
- ny = 1;
+ ny = 1;
/* If color format not native, convert it line by line */
/* This is slow, but these formats aren't normally used */
if (!directcopy) {
- ny = 1;
- line = (unsigned char *)malloc(img->bytewidth);
- if (line == NULL)
- return;
+ ny = 1;
+ line = (unsigned char *)malloc(img->bytewidth);
+ if (line == NULL)
+ return;
}
for (; wy; dy += ny, wy -= ny, sy += ny) {
- ny = min(ny, wy);
- if (directcopy) {
- bits = img->image + img->raster * (img->bmih.biHeight - (sy + ny));
- }
- else {
- image_convert_line(img, line,
- img->image + img->raster * (img->bmih.biHeight - (sy + ny)));
- bits = line;
- }
- SetDIBitsToDevice(hdc, dx, dy, wx, ny, sx, 0, 0, ny, bits,
- (BITMAPINFO *) & bmi, which_colors);
+ ny = min(ny, wy);
+ if (directcopy) {
+ bits = img->image + img->raster * (img->bmih.biHeight - (sy + ny));
+ }
+ else {
+ image_convert_line(img, line,
+ img->image + img->raster * (img->bmih.biHeight - (sy + ny)));
+ bits = line;
+ }
+ SetDIBitsToDevice(hdc, dx, dy, wx, ny, sx, 0, 0, ny, bits,
+ (BITMAPINFO *) & bmi, which_colors);
}
if (which_colors == DIB_PAL_COLORS)
- SelectPalette(hdc, oldpalette, FALSE);
+ SelectPalette(hdc, oldpalette, FALSE);
if (line)
- free(line);
+ free(line);
}
-
diff --git a/pl/dwimg.h b/pl/dwimg.h
index 2ebee84fa..9d5e8a41f 100644
--- a/pl/dwimg.h
+++ b/pl/dwimg.h
@@ -15,7 +15,6 @@
#ifndef dwimg_INCLUDED
# define dwimg_INCLUDED
-
/* Windows Image Window structure */
typedef struct IMAGE_DEVICEN_S IMAGE_DEVICEN;
@@ -94,5 +93,4 @@ void image_updatesize(IMAGE *img);
/* To be called during initialization after the text window has been created */
void image_textwindow(HWND hwnd);
-
#endif /* dwimg_INCLUDED */
diff --git a/pl/dwmainc.c b/pl/dwmainc.c
index bbca9ab98..ca1ad742d 100644
--- a/pl/dwmainc.c
+++ b/pl/dwmainc.c
@@ -10,7 +10,7 @@
/*$Id: dwmain.c 11973 2010-12-22 19:16:02Z robin $ */
/* dwmain.c */
-/* Windows version of the main program command-line interpreter for PCL interpreters
+/* Windows version of the main program command-line interpreter for PCL interpreters
*/
#include "string_.h"
#include "gdebug.h"
@@ -82,7 +82,6 @@ HANDLE hthread;
DWORD thread_id;
HWND hwndforeground; /* our best guess for our console window handle */
-
/* This section copied in large part from the Ghostscript Windows client, to
* support the Windows display device.
*/
@@ -114,39 +113,38 @@ static void winthread(void *arg)
hthread = GetCurrentThread();
while (!quitnow && GetMessage(&msg, (HWND)NULL, 0, 0)) {
- switch (msg.message) {
- case DISPLAY_OPEN:
- image_open((IMAGE *)msg.lParam);
- break;
- case DISPLAY_CLOSE:
- {
- HANDLE hmutex;
- IMAGE *img = (IMAGE *)msg.lParam;
- hmutex = img->hmutex;
- image_close(img);
- CloseHandle(hmutex);
- }
- break;
- case DISPLAY_SIZE:
- image_updatesize((IMAGE *)msg.lParam);
- break;
- case DISPLAY_SYNC:
- image_sync((IMAGE *)msg.lParam);
- break;
- case DISPLAY_PAGE:
- image_page((IMAGE *)msg.lParam);
- break;
- case DISPLAY_UPDATE:
- image_poll((IMAGE *)msg.lParam);
- break;
- default:
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
+ switch (msg.message) {
+ case DISPLAY_OPEN:
+ image_open((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_CLOSE:
+ {
+ HANDLE hmutex;
+ IMAGE *img = (IMAGE *)msg.lParam;
+ hmutex = img->hmutex;
+ image_close(img);
+ CloseHandle(hmutex);
+ }
+ break;
+ case DISPLAY_SIZE:
+ image_updatesize((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_SYNC:
+ image_sync((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_PAGE:
+ image_page((IMAGE *)msg.lParam);
+ break;
+ case DISPLAY_UPDATE:
+ image_poll((IMAGE *)msg.lParam);
+ break;
+ default:
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
}
}
-
/* New device has been opened */
/* Tell user to use another device */
int display_open(void *handle, void *device)
@@ -158,7 +156,7 @@ int display_open(void *handle, void *device)
img = image_new(handle, device); /* create and add to list */
img->hmutex = CreateMutex(NULL, FALSE, NULL);
if (img)
- PostThreadMessage(thread_id, DISPLAY_OPEN, 0, (LPARAM)img);
+ PostThreadMessage(thread_id, DISPLAY_OPEN, 0, (LPARAM)img);
return 0;
}
@@ -170,8 +168,8 @@ int display_preclose(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img) {
- /* grab mutex to stop other thread using bitmap */
- WaitForSingleObject(img->hmutex, 120000);
+ /* grab mutex to stop other thread using bitmap */
+ WaitForSingleObject(img->hmutex, 120000);
}
return 0;
}
@@ -184,50 +182,50 @@ int display_close(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img) {
- /* This is a hack to pass focus from image window to console */
- if (GetForegroundWindow() == img->hwnd)
- SetForegroundWindow(hwndforeground);
+ /* This is a hack to pass focus from image window to console */
+ if (GetForegroundWindow() == img->hwnd)
+ SetForegroundWindow(hwndforeground);
- image_delete(img); /* remove from list, but don't free */
- PostThreadMessage(thread_id, DISPLAY_CLOSE, 0, (LPARAM)img);
+ image_delete(img); /* remove from list, but don't free */
+ PostThreadMessage(thread_id, DISPLAY_CLOSE, 0, (LPARAM)img);
}
return 0;
}
-int display_presize(void *handle, void *device, int width, int height,
- int raster, unsigned int format)
+int display_presize(void *handle, void *device, int width, int height,
+ int raster, unsigned int format)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
fprintf(stdout, "display_presize(0x%x 0x%x, %d, %d, %d, %d, %ld)\n",
- handle, device, width, height, raster, format);
+ handle, device, width, height, raster, format);
#endif
img = image_find(handle, device);
if (img) {
- /* grab mutex to stop other thread using bitmap */
- WaitForSingleObject(img->hmutex, 120000);
+ /* grab mutex to stop other thread using bitmap */
+ WaitForSingleObject(img->hmutex, 120000);
}
return 0;
}
-
-int display_size(void *handle, void *device, int width, int height,
- int raster, unsigned int format, unsigned char *pimage)
+
+int display_size(void *handle, void *device, int width, int height,
+ int raster, unsigned int format, unsigned char *pimage)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
fprintf(stdout, "display_size(0x%x 0x%x, %d, %d, %d, %d, %ld, 0x%x)\n",
- handle, device, width, height, raster, format, pimage);
+ handle, device, width, height, raster, format, pimage);
#endif
img = image_find(handle, device);
if (img) {
- image_size(img, width, height, raster, format, pimage);
- /* release mutex to allow other thread to use bitmap */
- ReleaseMutex(img->hmutex);
- PostThreadMessage(thread_id, DISPLAY_SIZE, 0, (LPARAM)img);
+ image_size(img, width, height, raster, format, pimage);
+ /* release mutex to allow other thread to use bitmap */
+ ReleaseMutex(img->hmutex);
+ PostThreadMessage(thread_id, DISPLAY_SIZE, 0, (LPARAM)img);
}
return 0;
}
-
+
int display_sync(void *handle, void *device)
{
IMAGE *img;
@@ -236,8 +234,8 @@ int display_sync(void *handle, void *device)
#endif
img = image_find(handle, device);
if (img && !img->pending_sync) {
- img->pending_sync = 1;
- PostThreadMessage(thread_id, DISPLAY_SYNC, 0, (LPARAM)img);
+ img->pending_sync = 1;
+ PostThreadMessage(thread_id, DISPLAY_SYNC, 0, (LPARAM)img);
}
return 0;
}
@@ -246,23 +244,23 @@ int display_page(void *handle, void *device, int copies, int flush)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
- handle, device, copies, flush);
+ fprintf(stdout, "display_page(0x%x, 0x%x, copies=%d, flush=%d)\n",
+ handle, device, copies, flush);
#endif
img = image_find(handle, device);
if (img)
- PostThreadMessage(thread_id, DISPLAY_PAGE, 0, (LPARAM)img);
+ PostThreadMessage(thread_id, DISPLAY_PAGE, 0, (LPARAM)img);
return 0;
}
-int display_update(void *handle, void *device,
+int display_update(void *handle, void *device,
int x, int y, int w, int h)
{
IMAGE *img;
img = image_find(handle, device);
if (img && !img->pending_update && !img->pending_sync) {
- img->pending_update = 1;
- PostThreadMessage(thread_id, DISPLAY_UPDATE, 0, (LPARAM)img);
+ img->pending_update = 1;
+ PostThreadMessage(thread_id, DISPLAY_UPDATE, 0, (LPARAM)img);
}
return 0;
}
@@ -276,8 +274,8 @@ void *display_memalloc(void *handle, void *device, unsigned long size)
{
void *mem;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
- handle, device, size);
+ fprintf(stdout, "display_memalloc(0x%x 0x%x %d)\n",
+ handle, device, size);
#endif
mem = malloc(size);
#ifdef DISPLAY_DEBUG
@@ -289,23 +287,23 @@ void *display_memalloc(void *handle, void *device, unsigned long size)
int display_memfree(void *handle, void *device, void *mem)
{
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
- handle, device, mem);
+ fprintf(stdout, "display_memfree(0x%x, 0x%x, 0x%x)\n",
+ handle, device, mem);
#endif
free(mem);
return 0;
}
#endif
-int display_separation(void *handle, void *device,
+int display_separation(void *handle, void *device,
int comp_num, const char *name,
unsigned short c, unsigned short m,
unsigned short y, unsigned short k)
{
IMAGE *img;
#ifdef DISPLAY_DEBUG
- fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
- handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
+ fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n",
+ handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
#endif
img = image_find(handle, device);
if (img)
@@ -313,8 +311,7 @@ int display_separation(void *handle, void *device,
return 0;
}
-
-display_callback display = {
+display_callback display = {
sizeof(display_callback),
DISPLAY_VERSION_MAJOR,
DISPLAY_VERSION_MINOR,
@@ -340,10 +337,9 @@ display_callback display = {
* device
*/
-
/*********************************************************************/
-/* Our 'main' routine sets up the separate thread to look after the
+/* Our 'main' routine sets up the separate thread to look after the
* display window, and inserts the relevant defaults for the display device.
* If the user specifies a different device, or different parameters to
* the display device, the later ones should take precedence.
@@ -363,46 +359,46 @@ int main(int argc, char *argv[])
memset(buf, 0, sizeof(buf));
if (_beginthread(winthread, 65535, NULL) == -1) {
- wprintf(L"GUI thread creation failed\n");
+ wprintf(L"GUI thread creation failed\n");
}
else {
- int n = 30;
- /* wait for thread to start */
- Sleep(0);
- while (n && (hthread == INVALID_HANDLE_VALUE)) {
- n--;
- Sleep(100);
+ int n = 30;
+ /* wait for thread to start */
+ Sleep(0);
+ while (n && (hthread == INVALID_HANDLE_VALUE)) {
+ n--;
+ Sleep(100);
+ }
+ while (n && (PostThreadMessage(thread_id, WM_USER, 0, 0) == 0)) {
+ n--;
+ Sleep(100);
}
- while (n && (PostThreadMessage(thread_id, WM_USER, 0, 0) == 0)) {
- n--;
- Sleep(100);
- }
- if (n == 0)
- wprintf(L"Can't post message to GUI thread\n");
+ if (n == 0)
+ wprintf(L"Can't post message to GUI thread\n");
}
- { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_1 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
- HDC hdc = GetDC(NULL); /* get hdc for desktop */
- int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
- sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
+ { int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_1 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
+ HDC hdc = GetDC(NULL); /* get hdc for desktop */
+ int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
+ sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
ReleaseDC(NULL, hdc);
- if (depth == 32)
- format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
- DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth == 16)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_16 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST |
- DISPLAY_NATIVE_555;
- else if (depth > 8)
- format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 8)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
- else if (depth >= 4)
- format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
- DISPLAY_DEPTH_4 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
+ if (depth == 32)
+ format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST |
+ DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth == 16)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_16 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST |
+ DISPLAY_NATIVE_555;
+ else if (depth > 8)
+ format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 8)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_8 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
+ else if (depth >= 4)
+ format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE |
+ DISPLAY_DEPTH_4 | DISPLAY_BIGENDIAN | DISPLAY_BOTTOMFIRST;
sprintf(dformat, "-dDisplayFormat=%d", format);
}
nargc = argc + 2;
@@ -417,24 +413,22 @@ int main(int argc, char *argv[])
free(nargv);
/* close other thread */
- quitnow = TRUE;
+ quitnow = TRUE;
PostThreadMessage(thread_id, WM_QUIT, 0, (LPARAM)0);
Sleep(0);
exit_status = 0;
switch (code) {
- case 0:
- case e_Info:
- case e_Quit:
- break;
- case e_Fatal:
- exit_status = 1;
- break;
- default:
- exit_status = 255;
+ case 0:
+ case e_Info:
+ case e_Quit:
+ break;
+ case e_Fatal:
+ exit_status = 1;
+ break;
+ default:
+ exit_status = 255;
}
-
return exit_status;
}
-
diff --git a/pl/dwreg.c b/pl/dwreg.c
index 18936f8d3..051bdc1cc 100644
--- a/pl/dwreg.c
+++ b/pl/dwreg.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
@@ -20,7 +20,7 @@
#include <string.h>
#include "gscdefs.h" /* for gs_productfamily and gs_revision */
-/* We store registry named values under the key
+/* We store registry named values under the key
* "Software\\GPL Ghostscript"
* where "GPL Ghostscript" is actually gs_productfamily.
* Either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER will be used.
@@ -30,7 +30,7 @@ win_registry_key(char *buf, int len)
{
const char *software = "Software";
if (strlen(software) + 1 + strlen(gs_productfamily) >= len)
- return -1;
+ return -1;
strcpy(buf, software);
strcat(buf, "\\");
@@ -42,7 +42,7 @@ win_registry_key(char *buf, int len)
* Get a named registry value from HKCU.
* name, ptr, plen and return values are the same as in gp_getenv();
*/
-int
+int
win_get_reg_value(const char *name, char *ptr, int *plen)
{
HKEY hkey;
@@ -54,22 +54,22 @@ win_get_reg_value(const char *name, char *ptr, int *plen)
win_registry_key(key, sizeof(key));
if (RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_READ, &hkey)
- == ERROR_SUCCESS) {
- keytype = REG_SZ;
- cbData = *plen;
- if (bptr == (char *)NULL)
- bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
- /* if ptr is NULL */
- rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
- RegCloseKey(hkey);
- if (rc == ERROR_SUCCESS) {
- *plen = cbData;
- return 0; /* found environment variable and copied it */
- } else if (rc == ERROR_MORE_DATA) {
- /* buffer wasn't large enough */
- *plen = cbData;
- return -1;
- }
+ == ERROR_SUCCESS) {
+ keytype = REG_SZ;
+ cbData = *plen;
+ if (bptr == (char *)NULL)
+ bptr = &b; /* Registry API won't return ERROR_MORE_DATA */
+ /* if ptr is NULL */
+ rc = RegQueryValueEx(hkey, (char *)name, 0, &keytype, bptr, &cbData);
+ RegCloseKey(hkey);
+ if (rc == ERROR_SUCCESS) {
+ *plen = cbData;
+ return 0; /* found environment variable and copied it */
+ } else if (rc == ERROR_MORE_DATA) {
+ /* buffer wasn't large enough */
+ *plen = cbData;
+ return -1;
+ }
}
return 1; /* not found */
}
@@ -80,7 +80,7 @@ win_get_reg_value(const char *name, char *ptr, int *plen)
* str = value of named value
* Returns 0 on success.
*/
-int
+int
win_set_reg_value(const char *name, const char *value)
{
HKEY hkey;
@@ -91,14 +91,13 @@ win_set_reg_value(const char *name, const char *value)
win_registry_key(key, sizeof(key));
rc = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_WRITE, &hkey);
if (rc != ERROR_SUCCESS)
- rc = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, "", 0,
- KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition);
+ rc = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, "", 0,
+ KEY_ALL_ACCESS, NULL, &hkey, &dwDisposition);
if (rc == ERROR_SUCCESS) {
- rc = RegSetValueEx(hkey, name, 0, REG_SZ,
- (CONST BYTE *)value, strlen(value)+1);
- RegCloseKey(hkey);
+ rc = RegSetValueEx(hkey, name, 0, REG_SZ,
+ (CONST BYTE *)value, strlen(value)+1);
+ RegCloseKey(hkey);
}
return rc == ERROR_SUCCESS ? 0 : -1;
}
-
diff --git a/pl/dwreg.h b/pl/dwreg.h
index 56929d4bc..b2bf20c8a 100644
--- a/pl/dwreg.h
+++ b/pl/dwreg.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/pl/dwres.h b/pl/dwres.h
index a6ac671c6..c09646235 100644
--- a/pl/dwres.h
+++ b/pl/dwres.h
@@ -1,6 +1,6 @@
/* Copyright (C) 2001-2006 Artifex Software, Inc.
All Rights Reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
diff --git a/pl/pjparse.c b/pl/pjparse.c
index 40fd89ba4..a6e1365c3 100644
--- a/pl/pjparse.c
+++ b/pl/pjparse.c
@@ -32,10 +32,9 @@
#define PJL_PATH_NAME_LENGTH (256)
#define MAXPATHLEN 1024
-
/* definitions for fontsource and font number table entries */
typedef struct pjl_fontsource {
- char designator[2];
+ char designator[2];
char pathname[PJL_PATH_NAME_LENGTH+1];
char fontnumber[PJL_STRING_LENGTH+1];
} pjl_fontsource_t;
@@ -61,8 +60,8 @@ typedef struct pjl_parser_state_s {
pjl_fontsource_t *font_defaults;
pjl_fontsource_t *font_envir;
char *environment_font_path; /* if there is an operating sytem env
- var it is used instead of the
- default pjl fontsource */
+ var it is used instead of the
+ default pjl fontsource */
gs_memory_t *mem;
} pjl_parser_state_t;
@@ -76,9 +75,9 @@ static const pjl_envir_var_t pjl_factory_defaults[] = {
{"fontnumber", "0"},
{"pitch", "10.00"},
{"ptsize", "12.00"},
- /* NB pc8 is used on 6mp, clj4550, clj4600
+ /* NB pc8 is used on 6mp, clj4550, clj4600
roman8 is used on most other HP devices */
- {"symset", "pc8"},
+ {"symset", "pc8"},
{"copies", "1"},
{"paper", "letter"},
{"orientation", "portrait"},
@@ -104,7 +103,6 @@ static const pjl_envir_var_t pjl_factory_defaults[] = {
should probably have index definitions for each variable */
#define FDEF_PAPER_INDX 8
-
/* FONTS I (Internal Fonts) C, C1, C2 (Cartridge Fonts) S (Permanent
Soft Fonts) M1, M2, M3, M4 (fonts stored in one of the printer's
ROM SIMM slots). Simulate cartridge, permanent soft fonts, and
@@ -137,7 +135,7 @@ typedef enum {
UNIDENTIFIED, /* NB not used */
LPARM, /* NB not used */
PREFIX, /* @PJL */
- INITIALIZE,
+ INITIALIZE,
RESET,
INQUIRE,
DINQUIRE,
@@ -155,7 +153,7 @@ typedef enum {
FSQUERY,
FSUPLOAD,
FORMATBINARY, /* this nonsense is ignored.
- all data is treated as binary */
+ all data is treated as binary */
NAME, /* used for pathnames */
SIZE, /* size of data */
VOLUME, /* volume indicator for filesystem initialization */
@@ -187,7 +185,7 @@ static const pjl_lookup_table_t pjl_table[] = {
{ "FSQUERY", FSQUERY },
{ "FSUPLOAD", FSUPLOAD },
{ "FORMAT:BINARY", FORMATBINARY }, /* this nonsense is ignored.
- all data is treated as binary */
+ all data is treated as binary */
{ "NAME", NAME }, /* used for pathnames */
{ "SIZE", SIZE }, /* size of data */
{ "VOLUME", VOLUME }, /* used for volume name */
@@ -208,7 +206,7 @@ static const pjl_lookup_table_t pjl_table[] = {
} pjl_media[] = {
px_enumerate_media(PJLMEDIA)
};
-
+
/* permenant soft font slots - bit n is the n'th font number. */
#define MAX_PERMANENT_FONTS 256 /* multiple of 8 */
unsigned char pjl_permanent_soft_fonts[MAX_PERMANENT_FONTS / 8];
@@ -250,15 +248,14 @@ pjl_calc_formlines_new_page_size(int page_length)
floatp formlines = (page_length - 300.0)/50.0;
return (int)(formlines + 0.5);
-}
-
+}
/* handle pjl variables which affect the state of other variables - we
don't handle all of these yet. NB not complete. */
static void
pjl_side_effects(pjl_parser_state_t *pst, char *variable, char *value, bool defaults)
{
- if (!pjl_compare(variable, "PAPER") ||
+ if (!pjl_compare(variable, "PAPER") ||
!pjl_compare(variable, "ORIENTATION")) {
pjl_envir_var_t *table = (defaults ? pst->defaults : pst->envir);
@@ -270,7 +267,7 @@ pjl_side_effects(pjl_parser_state_t *pst, char *variable, char *value, bool defa
int formlines = pjl_calc_formlines_new_page_size(page_length);
pjl_envir_var_t var;
sprintf(var.value, "%d", formlines);
- pjl_set(pst, (char *)"FORMLINES", var.value, defaults);
+ pjl_set(pst, (char *)"FORMLINES", var.value, defaults);
}
/* fill in other side effects here */
return;
@@ -284,20 +281,20 @@ pjl_set(pjl_parser_state_t *pst, char *variable, char *value, bool defaults)
int i;
if (defaults) /* default also sets current environment. */
- pjl_set( pst, variable, value, false );
+ pjl_set( pst, variable, value, false );
for (i = 0; table[i].var[0]; i++)
- if (!pjl_compare(table[i].var, variable)) {
- /* set the value */
- strcpy(table[i].value, value);
- /* set any side effects of setting the value */
- pjl_side_effects(pst, variable, value, defaults);
- return 1;
- }
+ if (!pjl_compare(table[i].var, variable)) {
+ /* set the value */
+ strcpy(table[i].value, value);
+ /* set any side effects of setting the value */
+ pjl_side_effects(pst, variable, value, defaults);
+ return 1;
+ }
/* didn't find variable */
return 0;
}
-
+
/* get next token from the command line buffer */
static pjl_token_type_t
pjl_get_token(pjl_parser_state_t *pst, char token[])
@@ -311,8 +308,8 @@ pjl_get_token(pjl_parser_state_t *pst, char token[])
/* special case to allow = with no intevervening spaces between
lhs and rhs */
if ( c == '=' ) {
- pst->pos++;
- return EQUAL;
+ pst->pos++;
+ return EQUAL;
}
/* set the starting position */
@@ -320,57 +317,57 @@ pjl_get_token(pjl_parser_state_t *pst, char token[])
/* end of line reached; null shouldn't happen but we check anyway */
if ( c == '\0' || c == '\n' )
- return DONE;
+ return DONE;
/* check for a quoted string. It should not span a line */
if ( c == '"' ) {
- c = pst->line[pst->pos++];
- while ((c = pst->line[pst->pos]) != '"' &&
- c != '\0' &&
- c != '\n')
- pst->pos++;
- /* this routine doesn't yet support real error handling - here
+ c = pst->line[pst->pos++];
+ while ((c = pst->line[pst->pos]) != '"' &&
+ c != '\0' &&
+ c != '\n')
+ pst->pos++;
+ /* this routine doesn't yet support real error handling - here
we should check if c == '"' */
- if ( c == '"' )
- pst->pos++;
- else
- return DONE;
+ if ( c == '"' )
+ pst->pos++;
+ else
+ return DONE;
} else {
- /* set the ptr to the next delimeter. */
- while((c = pst->line[pst->pos]) != ' ' &&
- c != '\t' &&
- c != '\r' &&
- c != '\n' &&
- c != '=' &&
- c != '\0')
- pst->pos++;
+ /* set the ptr to the next delimeter. */
+ while((c = pst->line[pst->pos]) != ' ' &&
+ c != '\t' &&
+ c != '\r' &&
+ c != '\n' &&
+ c != '=' &&
+ c != '\0')
+ pst->pos++;
}
/* build the token */
{
- int slength = pst->pos - start_pos;
- int i;
- /* we allow = to special case for allowing
- token doesn't fit or is empty */
- if (( slength > PJL_STRING_LENGTH) || slength == 0)
- return DONE;
- /* now the string can be safely copied */
- strncpy(token, &pst->line[start_pos], slength);
- token[slength] = '\0';
-
- /* for known tokens */
- for (i = 0; pjl_table[i].pjl_string[0]; i++)
- if (!pjl_compare(pjl_table[i].pjl_string, token))
- return pjl_table[i].pjl_token;
-
- /* NB add other cases here */
- /* check for variables that we support */
- for (i = 0; pst->envir[i].var[0]; i++)
- if (!pjl_compare(pst->envir[i].var, token))
- return VARIABLE;
-
- /* NB assume this is a setting yuck */
- return SETTING;
+ int slength = pst->pos - start_pos;
+ int i;
+ /* we allow = to special case for allowing
+ token doesn't fit or is empty */
+ if (( slength > PJL_STRING_LENGTH) || slength == 0)
+ return DONE;
+ /* now the string can be safely copied */
+ strncpy(token, &pst->line[start_pos], slength);
+ token[slength] = '\0';
+
+ /* for known tokens */
+ for (i = 0; pjl_table[i].pjl_string[0]; i++)
+ if (!pjl_compare(pjl_table[i].pjl_string, token))
+ return pjl_table[i].pjl_token;
+
+ /* NB add other cases here */
+ /* check for variables that we support */
+ for (i = 0; pst->envir[i].var[0]; i++)
+ if (!pjl_compare(pst->envir[i].var, token))
+ return VARIABLE;
+
+ /* NB assume this is a setting yuck */
+ return SETTING;
}
/* shouldn't happen */
return DONE;
@@ -394,29 +391,29 @@ pjl_check_font_path(char *path_list, gs_memory_t *mem)
check if the directory resource has files without checking if
the files are indeed fonts. */
while ( (dirname = strtok(tmp_pathp, ";")) != NULL ) {
- file_enum *fe;
- strcpy(tmp_path_and_pattern, dirname);
- strcat(tmp_path_and_pattern, pattern);
-
- fe = gs_enumerate_files_init(tmp_path_and_pattern, strlen(tmp_path_and_pattern), mem);
- if ( fe == NULL || (gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH) ) == -1 ) {
- tmp_pathp = NULL;
- } else {
- /* wind through the rest of the files. This should close
+ file_enum *fe;
+ strcpy(tmp_path_and_pattern, dirname);
+ strcat(tmp_path_and_pattern, pattern);
+
+ fe = gs_enumerate_files_init(tmp_path_and_pattern, strlen(tmp_path_and_pattern), mem);
+ if ( fe == NULL || (gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH) ) == -1 ) {
+ tmp_pathp = NULL;
+ } else {
+ /* wind through the rest of the files. This should close
things up as well. All we need to do is clean up but
gs_enumerate_files_close() does not close the current
directory */
- while ( 1 ) {
- int fstatus = (int)gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
- /* we don't care if the file does not fit (return +1) */
- if ( fstatus == -1 )
- break;
- }
- /* NB fix me - replace : separated path with real path.
+ while ( 1 ) {
+ int fstatus = (int)gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
+ /* we don't care if the file does not fit (return +1) */
+ if ( fstatus == -1 )
+ break;
+ }
+ /* NB fix me - replace : separated path with real path.
We should do this elsewhere */
- strcpy(path_list, dirname);
- return path_list;
- }
+ strcpy(path_list, dirname);
+ return path_list;
+ }
}
return NULL;
}
@@ -434,18 +431,17 @@ pjl_reset_fontsource_fontnumbers(pjl_parser_state_t* pst)
int i;
for (i = 0; pst->font_defaults[i].designator[0]; i++) {
- if ( pjl_check_font_path(pst->font_defaults[i].pathname, mem) )
- strcpy(pst->font_defaults[i].fontnumber, default_font_number);
- if ( pjl_check_font_path(pst->font_envir[i].pathname, mem) )
- strcpy(pst->font_envir[i].fontnumber, default_font_number);
+ if ( pjl_check_font_path(pst->font_defaults[i].pathname, mem) )
+ strcpy(pst->font_defaults[i].fontnumber, default_font_number);
+ if ( pjl_check_font_path(pst->font_envir[i].pathname, mem) )
+ strcpy(pst->font_envir[i].fontnumber, default_font_number);
}
}
-
/* Strips off extra quotes '"'
- * and changes pjl volume from 0: to makefile specifed PJL_VOLUME_0 directory
- * and translates '\\' to '/'
- * result in fnamep,
+ * and changes pjl volume from 0: to makefile specifed PJL_VOLUME_0 directory
+ * and translates '\\' to '/'
+ * result in fnamep,
* ie: ""0:\\dir\subdir\file"" --> "PJL_VOLUME_0/dir/subdir/file"
*/
static void
@@ -453,34 +449,34 @@ pjl_parsed_filename_to_string(char *fnamep, const char *pathname)
{
int i;
int size;
-
+
*fnamep = 0; /* in case of bad input */
- if (pathname == 0 || pathname[0] != '"' || strlen(pathname) < 3)
- return; /* bad input pjl file */
-
+ if (pathname == 0 || pathname[0] != '"' || strlen(pathname) < 3)
+ return; /* bad input pjl file */
+
if ( pathname[1] == '0' && pathname[2] == ':') {
- /* copy pjl_volume string in */
- strncpy(fnamep, PJL_VOLUME_0, strlen(PJL_VOLUME_0));
- fnamep += strlen(PJL_VOLUME_0);
+ /* copy pjl_volume string in */
+ strncpy(fnamep, PJL_VOLUME_0, strlen(PJL_VOLUME_0));
+ fnamep += strlen(PJL_VOLUME_0);
}
else if ( pathname[1] == '1' && pathname[2] == ':') {
- /* copy pjl_volume string in */
- strncpy(fnamep, PJL_VOLUME_1, strlen(PJL_VOLUME_1));
- fnamep += strlen(PJL_VOLUME_1);
+ /* copy pjl_volume string in */
+ strncpy(fnamep, PJL_VOLUME_1, strlen(PJL_VOLUME_1));
+ fnamep += strlen(PJL_VOLUME_1);
}
- else
- return; /* bad input pjl file */
-
- /* the pathname parsed has whatever quoting mechanism was used
+ else
+ return; /* bad input pjl file */
+
+ /* the pathname parsed has whatever quoting mechanism was used
* remove quotes, use forward slash, copy rest.
*/
size = strlen(pathname);
-
+
for( i = 3; i < size; i++ ) {
- if ( pathname[i] == '\\')
- *fnamep++ = '/';
- else if ( pathname[i] != '"')
- *fnamep++ = pathname[i];
+ if ( pathname[i] == '\\')
+ *fnamep++ = '/';
+ else if ( pathname[i] != '"')
+ *fnamep++ = pathname[i];
/* else it is a quote skip it */
}
/* NULL terminate */
@@ -495,31 +491,31 @@ pjl_verify_file_operation(pjl_parser_state_t *pst, char *fname)
{
/* make sure we are playing in the pjl sandbox */
if ( 0 != strncmp(PJL_VOLUME_0, fname, strlen(PJL_VOLUME_0))
- && 0 != strncmp(PJL_VOLUME_1, fname, strlen(PJL_VOLUME_1)) ) {
- dprintf1("illegal path name %s\n", fname);
- return -1;
+ && 0 != strncmp(PJL_VOLUME_1, fname, strlen(PJL_VOLUME_1)) ) {
+ dprintf1("illegal path name %s\n", fname);
+ return -1;
}
/* make sure we are not currently writing to a file.
Simultaneously file writing is not supported */
if ( pst->bytes_to_write || pst->fp )
- return -1;
+ return -1;
/* no operation if disklocak is enabled */
if ( !pjl_compare(pjl_get_envvar(pst, "disklock"), "on") )
- return -1;
+ return -1;
/* ok */
return 0;
}
/* debugging procedure to warn about writing to an extant file */
static void
-pjl_warn_exists(const gs_memory_t *mem, char *fname)
+pjl_warn_exists(const gs_memory_t *mem, char *fname)
{
FILE *fpdownload;
/* issue a warning if the file exists */
if ( (fpdownload = fopen(fname, gp_fmode_rb) ) != NULL ) {
- fclose(fpdownload);
- dprintf1("warning file exists overwriting %s\n", fname);
+ fclose(fpdownload);
+ dprintf1("warning file exists overwriting %s\n", fname);
}
}
@@ -532,17 +528,17 @@ pjl_setup_file_for_writing(pjl_parser_state_t *pst, char *pathname, int size, bo
pjl_parsed_filename_to_string(fname, pathname);
if ( pjl_verify_file_operation(pst, fname) < 0 )
- return NULL;
+ return NULL;
pjl_warn_exists(pst->mem, fname);
{
- char fmode[4];
- strcpy(fmode, gp_fmode_wb);
- if (append)
- strcat(fmode, "+");
- if ( (fp = fopen(fname, gp_fmode_wb)) == NULL) {
- dprintf("warning file open for writing failed\n" );
- return NULL;
- }
+ char fmode[4];
+ strcpy(fmode, gp_fmode_wb);
+ if (append)
+ strcat(fmode, "+");
+ if ( (fp = fopen(fname, gp_fmode_wb)) == NULL) {
+ dprintf("warning file open for writing failed\n" );
+ return NULL;
+ }
}
return fp;
}
@@ -552,9 +548,9 @@ static int
pjl_set_fs_download_state(pjl_parser_state_t *pst, char *pathname, int size)
{
/* somethink is wrong if the state indicates we are already writing to a file */
- FILE *fp = pjl_setup_file_for_writing(pst, pathname, size, false /* append */);
+ FILE *fp = pjl_setup_file_for_writing(pst, pathname, size, false /* append */);
if ( fp == NULL )
- return -1;
+ return -1;
pst->fp = fp;
pst->bytes_to_write = size;
return 0;
@@ -565,9 +561,9 @@ pjl_set_fs_download_state(pjl_parser_state_t *pst, char *pathname, int size)
static int
pjl_set_append_state(pjl_parser_state_t *pst, char *pathname, int size)
{
- FILE *fp = pjl_setup_file_for_writing(pst, pathname, size, true /* append */);
+ FILE *fp = pjl_setup_file_for_writing(pst, pathname, size, true /* append */);
if ( fp == NULL )
- return -1;
+ return -1;
pst->fp = fp;
pst->bytes_to_write = size;
return 0;
@@ -581,7 +577,7 @@ pjl_fsinit(pjl_parser_state_t *pst, char *pathname)
char fname[MAXPATHLEN];
pjl_parsed_filename_to_string(fname, pathname);
if ( pjl_verify_file_operation(pst, fname) < 0 )
- return -1;
+ return -1;
return mkdir(fname, 0777);
}
@@ -592,7 +588,7 @@ pjl_fsmkdir(pjl_parser_state_t *pst, char *pathname)
char fname[MAXPATHLEN];
pjl_parsed_filename_to_string(fname, pathname);
if ( pjl_verify_file_operation(pst, fname) < 0 )
- return -1;
+ return -1;
return mkdir(fname, 0777);
}
@@ -612,7 +608,6 @@ pjl_fsupload(pjl_parser_state_t *pst, char *pathname, int offset, int size)
return -1;
}
-
/* search pathname for filename return a match in result. result
should be a 0 length string upon calling this routine. If a match
is found result will hold the matching path and filename. Thie
@@ -630,22 +625,22 @@ pjl_search_for_file(pjl_parser_state_t *pst, char *pathname, char *filename, cha
strcat(fontfilename, "/*");
fe = gs_enumerate_files_init(fontfilename, strlen(fontfilename), pst->mem);
if ( fe ) {
- do {
- uint fstatus = gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
- /* done */
- if ( fstatus == ~(uint)0 )
- return 0;
- fontfilename[fstatus] = '\0';
- if (fontfilename[fstatus-1] != '.') { /* skip over . and .. */
- /* a directory */
- if ( ( stat(fontfilename, &stbuf) >= 0 ) && stat_is_dir(stbuf) )
- pjl_search_for_file(pst, fontfilename, filename, result);
- else /* a file */
- if ( !strcmp(strrchr( fontfilename, '/' ) + 1, filename) )
- strcpy(result, fontfilename);
- }
-
- } while (1);
+ do {
+ uint fstatus = gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
+ /* done */
+ if ( fstatus == ~(uint)0 )
+ return 0;
+ fontfilename[fstatus] = '\0';
+ if (fontfilename[fstatus-1] != '.') { /* skip over . and .. */
+ /* a directory */
+ if ( ( stat(fontfilename, &stbuf) >= 0 ) && stat_is_dir(stbuf) )
+ pjl_search_for_file(pst, fontfilename, filename, result);
+ else /* a file */
+ if ( !strcmp(strrchr( fontfilename, '/' ) + 1, filename) )
+ strcpy(result, fontfilename);
+ }
+
+ } while (1);
}
/* not implemented */
return -1;
@@ -661,15 +656,15 @@ pjl_fsdirlist(pjl_parser_state_t *pst, char *pathname, int entry, int count)
strcat(fontfilename, "/*");
fe = gs_enumerate_files_init(fontfilename, strlen(fontfilename), pst->mem);
if ( fe ) {
- do {
- uint fstatus = gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
- /* done */
- if ( fstatus == ~(uint)0 )
- return 0;
- fontfilename[fstatus] = '\0';
- /* NB - debugging output only */
- dprintf1("%s\n", fontfilename);
- } while (1);
+ do {
+ uint fstatus = gs_enumerate_files_next(fe, fontfilename, PJL_PATH_NAME_LENGTH);
+ /* done */
+ if ( fstatus == ~(uint)0 )
+ return 0;
+ fontfilename[fstatus] = '\0';
+ /* NB - debugging output only */
+ dprintf1("%s\n", fontfilename);
+ } while (1);
}
/* should not get here */
return -1;
@@ -684,14 +679,14 @@ pjl_write_remaining_data(pjl_parser_state_t *pst, const byte **pptr, const byte
uint avail = plimit - ptr;
uint bytes_written = min( avail, pst->bytes_to_write );
if ( fwrite( ptr, 1, bytes_written, pst->fp ) != bytes_written ) {
- /* try to close the file before failing */
- fclose(pst->fp);
+ /* try to close the file before failing */
+ fclose(pst->fp);
pst->fp = NULL;
- return -1;
+ return -1;
}
pst->bytes_to_write -= bytes_written;
if ( pst->bytes_to_write == 0 ) { /* done */
- fclose(pst->fp);
+ fclose(pst->fp);
pst->fp = NULL;
}
/* update stream pointer */
@@ -705,7 +700,7 @@ pjl_delete_file(pjl_parser_state_t *pst, char *pathname)
char fname[MAXPATHLEN];
pjl_parsed_filename_to_string(fname, pathname);
if ( pjl_verify_file_operation(pst, fname) < 0 )
- return -1;
+ return -1;
return unlink(fname);
}
@@ -717,14 +712,14 @@ pjl_get_setting(pjl_parser_state_t *pst, pjl_token_type_t tok, char *token)
{
pjl_token_type_t lhs = pjl_get_token(pst, token);
if ( lhs != tok )
- return -1;
+ return -1;
if ( (tok = pjl_get_token(pst, token) ) != EQUAL )
- return -1;
+ return -1;
if ( (tok = pjl_get_token(pst, token) ) != SETTING )
- return -1;
+ return -1;
return 0;
}
-
+
/* parse and set up state for one line of pjl commands */
static int
pjl_parse_and_process_line(pjl_parser_state_t *pst)
@@ -736,125 +731,125 @@ pjl_parse_and_process_line(pjl_parser_state_t *pst)
pst->pos = 0;
/* all pjl commands start with the pjl prefix @PJL */
if ( (tok = pjl_get_token(pst, token)) != PREFIX )
- return -1;
+ return -1;
/* NB we should check for required and optional used of whitespace
but we don't see PJLTRM 2-6 PJL Command Syntax and Format. */
while( (tok = pjl_get_token(pst, token)) != DONE ) {
- switch( tok ) {
- case SET:
- case DEFAULT:
- {
- bool defaults;
-var: defaults = (tok == DEFAULT);
- /* NB we skip over lparm and search for the variable */
- while( (tok = pjl_get_token(pst, token)) != DONE )
- if ( tok == VARIABLE ) {
- char variable[PJL_STRING_LENGTH+1];
- strcpy(variable, token);
- if (((tok = pjl_get_token(pst, token)) == EQUAL) &&
- (tok = pjl_get_token(pst, token)) == SETTING) {
- return pjl_set(pst, variable, token, defaults);
- } else
- return -1; /* syntax error */
- } else
- continue;
- return 0;
- }
- case INITIALIZE:
- /* set the user default environment to the factory default environment */
- memcpy(pst->defaults, &pjl_factory_defaults, sizeof(pjl_factory_defaults));
- memcpy(pst->font_defaults, &pjl_fontsource_table, sizeof(pjl_fontsource_table));
- pjl_reset_fontsource_fontnumbers(pst);
- return 0;
- /* set the current environment to the user default environment */
- case RESET:
- memcpy(pst->envir, pst->defaults, sizeof(pjl_factory_defaults));
- memcpy(pst->font_envir, pst->font_defaults, sizeof(pjl_fontsource_table));
- return 0;
- case ENTER:
- /* there is no setting for the default language */
- tok = SET;
- goto var;
- case FSDOWNLOAD: {
- /* consume and ignore FORMAT:BINARY foolishness. if it is
+ switch( tok ) {
+ case SET:
+ case DEFAULT:
+ {
+ bool defaults;
+var: defaults = (tok == DEFAULT);
+ /* NB we skip over lparm and search for the variable */
+ while( (tok = pjl_get_token(pst, token)) != DONE )
+ if ( tok == VARIABLE ) {
+ char variable[PJL_STRING_LENGTH+1];
+ strcpy(variable, token);
+ if (((tok = pjl_get_token(pst, token)) == EQUAL) &&
+ (tok = pjl_get_token(pst, token)) == SETTING) {
+ return pjl_set(pst, variable, token, defaults);
+ } else
+ return -1; /* syntax error */
+ } else
+ continue;
+ return 0;
+ }
+ case INITIALIZE:
+ /* set the user default environment to the factory default environment */
+ memcpy(pst->defaults, &pjl_factory_defaults, sizeof(pjl_factory_defaults));
+ memcpy(pst->font_defaults, &pjl_fontsource_table, sizeof(pjl_fontsource_table));
+ pjl_reset_fontsource_fontnumbers(pst);
+ return 0;
+ /* set the current environment to the user default environment */
+ case RESET:
+ memcpy(pst->envir, pst->defaults, sizeof(pjl_factory_defaults));
+ memcpy(pst->font_envir, pst->font_defaults, sizeof(pjl_fontsource_table));
+ return 0;
+ case ENTER:
+ /* there is no setting for the default language */
+ tok = SET;
+ goto var;
+ case FSDOWNLOAD: {
+ /* consume and ignore FORMAT:BINARY foolishness. if it is
present or search for the name */
- int size;
- /* ignore format binary stuff */
- if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
- ;
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- if ( pjl_get_setting(pst, SIZE, token) < 0 )
- return -1;
- size = pjl_vartoi(token);
- return pjl_set_fs_download_state(pst, pathname, size);
- }
- case FSAPPEND: {
- int size;
- if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
- ;
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- if ( pjl_get_setting(pst, SIZE, token) < 0 )
- return -1;
- size = pjl_vartoi(token);
- return pjl_set_append_state(pst, pathname, size);
- }
- case FSDELETE:
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- return pjl_delete_file(pst, pathname);
- case FSDIRLIST: {
- int entry;
- int count;
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- if ( pjl_get_setting(pst, ENTRY, token) < 0 )
- return -1;
- entry = pjl_vartoi(token);
- if ( pjl_get_setting(pst, COUNT, token) < 0 )
- return -1;
- count = pjl_vartoi(token);
- return pjl_fsdirlist(pst, pathname, entry, count);
- }
- case FSINIT:
- if ( pjl_get_setting(pst, VOLUME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- return pjl_fsinit(pst, pathname);
- case FSMKDIR:
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- return pjl_fsmkdir(pst, pathname);
- case FSQUERY:
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- return pjl_fsquery(pst, pathname);
- case FSUPLOAD: {
- int size;
- int offset;
- if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
- ;
- if ( pjl_get_setting(pst, NAME, token) < 0 )
- return -1;
- strcpy(pathname, token);
- if ( pjl_get_setting(pst, OFFSET, token) < 0 )
- return -1;
- offset = pjl_vartoi(token);
- if ( pjl_get_setting(pst, SIZE, token) < 0 )
- return -1;
- size = pjl_vartoi(token);
- return pjl_fsupload(pst, pathname, size, offset);
- }
- default:
- return -1;
- }
+ int size;
+ /* ignore format binary stuff */
+ if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
+ ;
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ if ( pjl_get_setting(pst, SIZE, token) < 0 )
+ return -1;
+ size = pjl_vartoi(token);
+ return pjl_set_fs_download_state(pst, pathname, size);
+ }
+ case FSAPPEND: {
+ int size;
+ if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
+ ;
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ if ( pjl_get_setting(pst, SIZE, token) < 0 )
+ return -1;
+ size = pjl_vartoi(token);
+ return pjl_set_append_state(pst, pathname, size);
+ }
+ case FSDELETE:
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ return pjl_delete_file(pst, pathname);
+ case FSDIRLIST: {
+ int entry;
+ int count;
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ if ( pjl_get_setting(pst, ENTRY, token) < 0 )
+ return -1;
+ entry = pjl_vartoi(token);
+ if ( pjl_get_setting(pst, COUNT, token) < 0 )
+ return -1;
+ count = pjl_vartoi(token);
+ return pjl_fsdirlist(pst, pathname, entry, count);
+ }
+ case FSINIT:
+ if ( pjl_get_setting(pst, VOLUME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ return pjl_fsinit(pst, pathname);
+ case FSMKDIR:
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ return pjl_fsmkdir(pst, pathname);
+ case FSQUERY:
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ return pjl_fsquery(pst, pathname);
+ case FSUPLOAD: {
+ int size;
+ int offset;
+ if ( ( tok = pjl_get_token(pst, token) ) == FORMATBINARY )
+ ;
+ if ( pjl_get_setting(pst, NAME, token) < 0 )
+ return -1;
+ strcpy(pathname, token);
+ if ( pjl_get_setting(pst, OFFSET, token) < 0 )
+ return -1;
+ offset = pjl_vartoi(token);
+ if ( pjl_get_setting(pst, SIZE, token) < 0 )
+ return -1;
+ size = pjl_vartoi(token);
+ return pjl_fsupload(pst, pathname, size, offset);
+ }
+ default:
+ return -1;
+ }
}
return (tok == DONE ? 0 : -1);
}
@@ -864,19 +859,19 @@ static FILE *
get_fp(pjl_parser_state_t *pst, char *name)
{
char result[MAXPATHLEN];
-
+
/* 0: */
result[0] = '\0';
pjl_search_for_file(pst, (char *)PJL_VOLUME_0, name, result);
if ( result[0] == '\0' ) {
- /* try 1: */
- pjl_search_for_file(pst, (char *)PJL_VOLUME_1, name, result);
- if ( result[0] == '\0' )
- return 0;
+ /* try 1: */
+ pjl_search_for_file(pst, (char *)PJL_VOLUME_1, name, result);
+ if ( result[0] == '\0' )
+ return 0;
}
return fopen(result, gp_fmode_rb);
}
-
+
/* scan for a named resoource in the pcl sandbox 0: or 1: and return
the size of the object. We do not distinguish between empty and
non-existant files */
@@ -886,7 +881,7 @@ pjl_get_named_resource_size(pjl_parser_state_t *pst, char *name)
long int size;
FILE *fp = get_fp(pst, name);
if ( fp == NULL )
- return 0;
+ return 0;
fseek(fp, 0L, SEEK_END);
size = ftell(fp);
fclose(fp);
@@ -901,13 +896,13 @@ pjl_get_named_resource(pjl_parser_state *pst, char *name, byte *data)
long int size;
FILE *fp = get_fp(pst, name);
if ( fp == NULL )
- return 0;
+ return 0;
fseek(fp, 0L, SEEK_END);
size = ftell(fp);
rewind(fp);
if ( size != fread(data, 1, size, fp) ) {
- fclose(fp);
- return -1;
+ fclose(fp);
+ return -1;
}
return 0;
}
@@ -961,9 +956,9 @@ pjl_get_envvar(pjl_parser_state *pst, const char *pjl_var)
pjl_envir_var_t *env = pst->envir;
/* lookup up the value */
for (i = 0; env[i].var[0]; i++)
- if (!pjl_compare(env[i].var, pjl_var)) {
- return env[i].value;
- }
+ if (!pjl_compare(env[i].var, pjl_var)) {
+ return env[i].value;
+ }
return NULL;
}
@@ -980,49 +975,49 @@ pjl_process(pjl_parser_state* pst, void *pstate, stream_cursor_read * pr)
file system commands */
while (p < rlimit) {
- if ( pst->bytes_to_write != 0 ) {
- p++;
- if (pjl_write_remaining_data(pst, &p, &rlimit) == 0 ) {
- p--;
- continue;
- }
- else
- return -1;
- }
-
- if (pst->pos == 0) { /* Look ahead for the @PJL prefix or a UEL. */
- uint avail = rlimit - p;
-
- if (!memcmp(p + 1, "\033%-12345X", min(avail, 9))) { /* Might be a UEL. */
- if (avail < 9) { /* Not enough data to know yet. */
- break;
- }
- /* Skip the UEL and continue. */
- p += 9;
- continue;
- } else if (!memcmp(p + 1, "@PJL", min(avail, 4))) { /* Might be PJL. */
- if (avail < 4) { /* Not enough data to know yet. */
- break;
- }
- /* Definitely a PJL command. */
- } else { /* Definitely not PJL. */
- code = 1;
- break;
- }
- }
- if (p[1] == '\n') {
- ++p;
- /* null terminate, parse and set the pjl state */
- pst->line[pst->pos] = '\0';
- pjl_parse_and_process_line(pst);
- pst->pos = 0;
- continue;
- }
- /* Copy the PJL line into the parser's line buffer. */
- /* Always leave room for a terminator. */
- if (pst->pos < countof(pst->line) - 1)
- pst->line[pst->pos] = p[1], pst->pos++;
- ++p;
+ if ( pst->bytes_to_write != 0 ) {
+ p++;
+ if (pjl_write_remaining_data(pst, &p, &rlimit) == 0 ) {
+ p--;
+ continue;
+ }
+ else
+ return -1;
+ }
+
+ if (pst->pos == 0) { /* Look ahead for the @PJL prefix or a UEL. */
+ uint avail = rlimit - p;
+
+ if (!memcmp(p + 1, "\033%-12345X", min(avail, 9))) { /* Might be a UEL. */
+ if (avail < 9) { /* Not enough data to know yet. */
+ break;
+ }
+ /* Skip the UEL and continue. */
+ p += 9;
+ continue;
+ } else if (!memcmp(p + 1, "@PJL", min(avail, 4))) { /* Might be PJL. */
+ if (avail < 4) { /* Not enough data to know yet. */
+ break;
+ }
+ /* Definitely a PJL command. */
+ } else { /* Definitely not PJL. */
+ code = 1;
+ break;
+ }
+ }
+ if (p[1] == '\n') {
+ ++p;
+ /* null terminate, parse and set the pjl state */
+ pst->line[pst->pos] = '\0';
+ pjl_parse_and_process_line(pst);
+ pst->pos = 0;
+ continue;
+ }
+ /* Copy the PJL line into the parser's line buffer. */
+ /* Always leave room for a terminator. */
+ if (pst->pos < countof(pst->line) - 1)
+ pst->line[pst->pos] = p[1], pst->pos++;
+ ++p;
}
pr->ptr = p;
return code;
@@ -1037,16 +1032,16 @@ pjl_skip_to_uel(stream_cursor_read * pr)
const byte *rlimit = pr->limit;
for (; p < rlimit; ++p)
- if (p[1] == '\033') {
- uint avail = rlimit - p;
-
- if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
- continue;
- if (avail < 9)
- break;
- pr->ptr = p + 9;
- return true;
- }
+ if (p[1] == '\033') {
+ uint avail = rlimit - p;
+
+ if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
+ continue;
+ if (avail < 9)
+ break;
+ pr->ptr = p + 9;
+ return true;
+ }
pr->ptr = p;
return false;
}
@@ -1099,35 +1094,34 @@ pjl_map_pjl_sym_to_pcl_sym(const char *symname)
{
int i;
for (i = 0; symbol_sets[i].symname; i++)
- if (!pjl_compare(symname, symbol_sets[i].symname)) {
- /* convert the character code to it's integer
+ if (!pjl_compare(symname, symbol_sets[i].symname)) {
+ /* convert the character code to it's integer
representation. NB peculiar code! */
- char pcl_symbol[4], chr;
- int char_pos;
- strcpy(pcl_symbol, symbol_sets[i].pcl_selectcode);
- char_pos = strlen(pcl_symbol) - 1;
- chr = pcl_symbol[char_pos];
- pcl_symbol[char_pos] = '\0';
- return (atoi(pcl_symbol) << 5) + chr - 64;
- }
+ char pcl_symbol[4], chr;
+ int char_pos;
+ strcpy(pcl_symbol, symbol_sets[i].pcl_selectcode);
+ char_pos = strlen(pcl_symbol) - 1;
+ chr = pcl_symbol[char_pos];
+ pcl_symbol[char_pos] = '\0';
+ return (atoi(pcl_symbol) << 5) + chr - 64;
+ }
return -1;
}
/* environment variable to integer */
- int
+ int
pjl_vartoi(const pjl_envvar_t *s)
{
return atoi(s);
}
/* environment variable to float */
- floatp
+ floatp
pjl_vartof(const pjl_envvar_t *s)
{
return atof(s);
}
-
/* convert a pjl font source to a pathname */
char *
pjl_fontsource_to_path(const pjl_parser_state *pjls, const pjl_envvar_t *fontsource)
@@ -1136,10 +1130,10 @@ pjl_fontsource_to_path(const pjl_parser_state *pjls, const pjl_envvar_t *fontsou
/* if an environment variable is set we use it, otherwise use the PJL
machinery */
if ( pjls->environment_font_path != NULL )
- return pjl_check_font_path(pjls->environment_font_path, pjls->mem);
+ return pjl_check_font_path(pjls->environment_font_path, pjls->mem);
for (i = 0; pjls->font_envir[i].designator[0]; i++)
- if (!pjl_compare(pjls->font_envir[i].designator, fontsource))
- return pjl_check_font_path(pjls->font_envir[i].pathname, pjls->mem);
+ if (!pjl_compare(pjls->font_envir[i].designator, fontsource))
+ return pjl_check_font_path(pjls->font_envir[i].pathname, pjls->mem);
return NULL;
}
@@ -1148,43 +1142,43 @@ pjl_fontsource_to_path(const pjl_parser_state *pjls, const pjl_envvar_t *fontsou
pjl_process_init(gs_memory_t *mem)
{
pjl_parser_state_t *pjlstate =
- (pjl_parser_state *)gs_alloc_bytes(mem,
- sizeof(pjl_parser_state_t), "pjl_state" );
+ (pjl_parser_state *)gs_alloc_bytes(mem,
+ sizeof(pjl_parser_state_t), "pjl_state" );
pjl_envir_var_t *pjl_env =
- (pjl_envir_var_t *)gs_alloc_bytes(mem,
+ (pjl_envir_var_t *)gs_alloc_bytes(mem,
sizeof(pjl_factory_defaults), "pjl_envir" );
pjl_envir_var_t *pjl_def =
- (pjl_envir_var_t *)gs_alloc_bytes(mem,
+ (pjl_envir_var_t *)gs_alloc_bytes(mem,
sizeof(pjl_factory_defaults), "pjl_defaults" );
pjl_fontsource_t *pjl_fontenv =
- (pjl_fontsource_t *)gs_alloc_bytes(mem,
+ (pjl_fontsource_t *)gs_alloc_bytes(mem,
sizeof(pjl_fontsource_table), "pjl_font_envir" );
pjl_fontsource_t *pjl_fontdef =
- (pjl_fontsource_t *)gs_alloc_bytes(mem,
+ (pjl_fontsource_t *)gs_alloc_bytes(mem,
sizeof(pjl_fontsource_table), "pjl_font_defaults" );
if ( pjlstate == NULL || pjl_env == NULL || pjl_def == NULL )
- return NULL; /* should be fatal so we don't bother piecemeal frees */
+ return NULL; /* should be fatal so we don't bother piecemeal frees */
/* check for an environment variable */
{
- int pathlen, code;
- /* The environment variable exists if the function fails to
+ int pathlen, code;
+ /* The environment variable exists if the function fails to
fit in the null - odd but it works. We allow an
environment variable to override the font default PJL font
path for desktop setups */
- pathlen = 0;
- if ( (code = gp_getenv( "PCLFONTSOURCE", (char *)0, &pathlen)) < 0 ) {
- char *path = (char *)gs_alloc_bytes(mem, pathlen, "pjl_font_path");
- /* if the allocation fails we use the pjl fontsource */
- if ( path == NULL )
- pjlstate->environment_font_path = NULL;
- else {
- gp_getenv("PCLFONTSOURCE", path, &pathlen); /* can't fail */
- pjlstate->environment_font_path = path;
- }
- } else /* environmet variable does not exist use pjl fontsource */
- pjlstate->environment_font_path = NULL;
+ pathlen = 0;
+ if ( (code = gp_getenv( "PCLFONTSOURCE", (char *)0, &pathlen)) < 0 ) {
+ char *path = (char *)gs_alloc_bytes(mem, pathlen, "pjl_font_path");
+ /* if the allocation fails we use the pjl fontsource */
+ if ( path == NULL )
+ pjlstate->environment_font_path = NULL;
+ else {
+ gp_getenv("PCLFONTSOURCE", path, &pathlen); /* can't fail */
+ pjlstate->environment_font_path = path;
+ }
+ } else /* environmet variable does not exist use pjl fontsource */
+ pjlstate->environment_font_path = NULL;
}
pjlstate->defaults = pjl_def;
pjlstate->envir = pjl_env;
@@ -1207,9 +1201,9 @@ pjl_process_init(gs_memory_t *mem)
/* initialize available font sources */
pjl_reset_fontsource_fontnumbers(pjlstate);
{
- int i;
- for (i = 0; i < countof(pjl_permanent_soft_fonts); i++)
- pjl_permanent_soft_fonts[i] = 0;
+ int i;
+ for (i = 0; i < countof(pjl_permanent_soft_fonts); i++)
+ pjl_permanent_soft_fonts[i] = 0;
}
return (pjl_parser_state *)pjlstate;
}
@@ -1219,8 +1213,8 @@ pjl_process_init(gs_memory_t *mem)
pjl_compare(const pjl_envvar_t *s1, const char *s2)
{
for (; toupper(*s1) == toupper(*s2); ++s1, ++s2)
- if (*s1 == '\0')
- return(0);
+ if (*s1 == '\0')
+ return(0);
return 1;
}
@@ -1233,7 +1227,7 @@ pjl_process_destroy(pjl_parser_state *pst, gs_memory_t *mem)
gs_free_object(mem, pst->defaults, "pjl_defaults");
gs_free_object(mem, pst->envir, "pjl_envir");
if ( pst->environment_font_path )
- gs_free_object(mem, pst->environment_font_path, "pjl_state");
+ gs_free_object(mem, pst->environment_font_path, "pjl_state");
gs_free_object(mem, pst, "pjl_state");
}
@@ -1242,38 +1236,38 @@ pjl_process_destroy(pjl_parser_state *pst, gs_memory_t *mem)
pjl_register_permanent_soft_font_deletion(pjl_parser_state *pst, int font_number)
{
if ( (font_number > MAX_PERMANENT_FONTS - 1) || (font_number < 0) ) {
- dprintf("pjparse.c:pjl_register_permanent_soft_font_deletion() bad font number\n");
- return 0;
+ dprintf("pjparse.c:pjl_register_permanent_soft_font_deletion() bad font number\n");
+ return 0;
}
/* if the font is present. */
if ( (pjl_permanent_soft_fonts[font_number >> 3]) & (128 >> (font_number & 7)) ) {
- /* set the bit to zero to indicate the fontnumber has been deleted */
- pjl_permanent_soft_fonts[font_number >> 3] &= ~(128 >> (font_number & 7));
- /* if the current font source is 'S' and the current font number
- is the highest number, and *any* soft font was deleted or if
- the last font has been removed, set the stage for changing to
- the next priority font source. BLAME HP not me. */
- {
- bool is_S = !pjl_compare(pjl_get_envvar(pst, "fontsource"), "S");
- bool empty = true;
- int highest_fontnumber = -1;
- int current_fontnumber = pjl_vartoi(pjl_get_envvar(pst, "fontnumber"));
- int i;
- /* check for no more fonts and the highest font number.
- NB should look at longs not bits in the loop */
- for ( i = 0; i < MAX_PERMANENT_FONTS; i++ )
- if ( (pjl_permanent_soft_fonts[i >> 3]) & (128 >> (i & 7)) ) {
- empty = false;
- highest_fontnumber = i;
- }
- if ( is_S && ((highest_fontnumber == current_fontnumber) || empty) ) {
+ /* set the bit to zero to indicate the fontnumber has been deleted */
+ pjl_permanent_soft_fonts[font_number >> 3] &= ~(128 >> (font_number & 7));
+ /* if the current font source is 'S' and the current font number
+ is the highest number, and *any* soft font was deleted or if
+ the last font has been removed, set the stage for changing to
+ the next priority font source. BLAME HP not me. */
+ {
+ bool is_S = !pjl_compare(pjl_get_envvar(pst, "fontsource"), "S");
+ bool empty = true;
+ int highest_fontnumber = -1;
+ int current_fontnumber = pjl_vartoi(pjl_get_envvar(pst, "fontnumber"));
+ int i;
+ /* check for no more fonts and the highest font number.
+ NB should look at longs not bits in the loop */
+ for ( i = 0; i < MAX_PERMANENT_FONTS; i++ )
+ if ( (pjl_permanent_soft_fonts[i >> 3]) & (128 >> (i & 7)) ) {
+ empty = false;
+ highest_fontnumber = i;
+ }
+ if ( is_S && ((highest_fontnumber == current_fontnumber) || empty) ) {
#define SINDEX 4
- pst->font_defaults[SINDEX].fontnumber[0] = '\0';
- pst->font_envir[SINDEX].fontnumber[0] = '\0';
- return 1;
+ pst->font_defaults[SINDEX].fontnumber[0] = '\0';
+ pst->font_envir[SINDEX].fontnumber[0] = '\0';
+ return 1;
#undef SINDEX
- }
- }
+ }
+ }
}
return 0;
}
@@ -1288,15 +1282,15 @@ pjl_register_permanent_soft_font_addition(pjl_parser_state *pst)
int font_num;
bool slot_found;
for ( font_num = 0; font_num < MAX_PERMANENT_FONTS; font_num++ )
- if ( !((pjl_permanent_soft_fonts[font_num >> 3]) & (128 >> (font_num & 7))) ) {
- slot_found = true;
- break;
- }
+ if ( !((pjl_permanent_soft_fonts[font_num >> 3]) & (128 >> (font_num & 7))) ) {
+ slot_found = true;
+ break;
+ }
/* yikes, shouldn't happen */
if ( !slot_found ) {
- dprintf("pjparse.c:pjl_register_permanent_soft_font_addition()\
+ dprintf("pjparse.c:pjl_register_permanent_soft_font_addition()\
font table full recycling font number 0\n");
- font_num = 0;
+ font_num = 0;
}
/* set the bit to 1 to indicate the fontnumber has been added */
pjl_permanent_soft_fonts[font_num >> 3] |= (128 >> (font_num & 7));
diff --git a/pl/pjparse.h b/pl/pjparse.h
index 33c8b2112..8576657e4 100644
--- a/pl/pjparse.h
+++ b/pl/pjparse.h
@@ -55,13 +55,13 @@ int pjl_process(pjl_parser_state *pst, void *pstate,
bool pjl_skip_to_uel(stream_cursor_read *pr);
/* return the current setting of a pjl environment variable. The
input parameter should be the exact string used in PJLTRM.
- Sample Usage:
+ Sample Usage:
char *formlines = pjl_get_envvar(pst, "formlines");
- if (formlines) {
- int fl = atoi(formlines);
- .
- .
- }
+ if (formlines) {
+ int fl = atoi(formlines);
+ .
+ .
+ }
Both variables and values are case insensitive.
*/
pjl_envvar_t *pjl_get_envvar(pjl_parser_state *pst, const char *pjl_var);
diff --git a/pl/pjparsei.c b/pl/pjparsei.c
index f0b5eb574..8f45b1344 100644
--- a/pl/pjparsei.c
+++ b/pl/pjparsei.c
@@ -37,7 +37,6 @@ typedef struct pjl_interp_instance_s {
pjl_parser_state *state; /* parser's state */
} pjl_interp_instance_t;
-
/* Get implemtation's characteristics */
const pl_interp_characteristics_t * /* always returns a descriptor */
pjl_impl_characteristics(
@@ -63,17 +62,17 @@ pjl_impl_allocate_interp(
gs_memory_t *mem /* allocator to allocate interp from */
)
{
- /* Allocate an interpreter */
- pjl_interp_t *pjl /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
- = (pjl_interp_t *)gs_alloc_bytes( mem,
- sizeof(pjl_interp_t),
- "pjl_impl_allocate_interp(pjl_interp_t)"
- );
- if (pjl == 0)
- return gs_error_VMerror;
- pjl->memory = mem;
- *interp = (pl_interp_t *)pjl;
- return 0; /* success */
+ /* Allocate an interpreter */
+ pjl_interp_t *pjl /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
+ = (pjl_interp_t *)gs_alloc_bytes( mem,
+ sizeof(pjl_interp_t),
+ "pjl_impl_allocate_interp(pjl_interp_t)"
+ );
+ if (pjl == 0)
+ return gs_error_VMerror;
+ pjl->memory = mem;
+ *interp = (pl_interp_t *)pjl;
+ return 0; /* success */
}
/* Do per-instance interpreter allocation/init. No device is set yet */
@@ -84,25 +83,25 @@ pjl_impl_allocate_interp_instance(
gs_memory_t *mem /* allocator to allocate instance from */
)
{
- /* Allocate everything up front */
- pjl_interp_instance_t *pjli /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
- = (pjl_interp_instance_t *)gs_alloc_bytes( mem,
- sizeof(pjl_interp_instance_t),
- "pjl_impl_allocate_interp_instance(pjl_interp_instance_t)"
+ /* Allocate everything up front */
+ pjl_interp_instance_t *pjli /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
+ = (pjl_interp_instance_t *)gs_alloc_bytes( mem,
+ sizeof(pjl_interp_instance_t),
+ "pjl_impl_allocate_interp_instance(pjl_interp_instance_t)"
);
- pjl_parser_state *pjls = pjl_process_init(mem);
+ pjl_parser_state *pjls = pjl_process_init(mem);
- /* If any allocation error simply return */
- if (!pjli || !pjls)
- return gs_error_VMerror;
+ /* If any allocation error simply return */
+ if (!pjli || !pjls)
+ return gs_error_VMerror;
- /* Setup pointers to allocated mem within instance */
- pjli->state = pjls;
- pjli->memory = mem;
+ /* Setup pointers to allocated mem within instance */
+ pjli->state = pjls;
+ pjli->memory = mem;
- /* Return success */
- *instance = (pl_interp_instance_t *)pjli;
- return 0;
+ /* Return success */
+ *instance = (pl_interp_instance_t *)pjli;
+ return 0;
}
/* Set a client language into an interperter instance */
@@ -113,7 +112,7 @@ pjl_impl_set_client_instance(
pl_interp_instance_clients_t which_client
)
{
- return 0;
+ return 0;
}
/* Set a device into an interperter instance */
@@ -123,7 +122,7 @@ pjl_impl_set_device(
gx_device *device /* device to set (open or closed) */
)
{
- return gs_error_undefined; /* this operation is undefined for PJL */
+ return gs_error_undefined; /* this operation is undefined for PJL */
}
/* Set an interpreter instance's pre-page action */
@@ -134,7 +133,7 @@ pjl_impl_set_pre_page_action(
void *closure /* closure to call action with */
)
{
- return gs_error_undefined; /* this operation is undefined for PJL */
+ return gs_error_undefined; /* this operation is undefined for PJL */
}
/* Set an interpreter instance's post-page action */
@@ -145,10 +144,10 @@ pjl_impl_set_post_page_action(
void *closure /* closure to call action with */
)
{
- return gs_error_undefined; /* this operation is undefined for PJL */
+ return gs_error_undefined; /* this operation is undefined for PJL */
}
-static int
+static int
pjl_impl_get_device_memory(
pl_interp_instance_t *instance, /* interp instance to use */
gs_memory_t **pmem)
@@ -156,20 +155,19 @@ pjl_impl_get_device_memory(
return 0;
}
-
/* Prepare interp instance for the next "job" */
int /* ret 0 ok, else -ve error code */
pjl_impl_init_job(
- pl_interp_instance_t *instance /* interp instance to start job in */
+ pl_interp_instance_t *instance /* interp instance to start job in */
)
{
- int code = 0;
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
- if (pjli->state == 0)
- code = gs_error_VMerror;
- /* copy the default state to the initial state */
- pjl_set_init_from_defaults(pjli->state);
- return code;
+ int code = 0;
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
+ if (pjli->state == 0)
+ code = gs_error_VMerror;
+ /* copy the default state to the initial state */
+ pjl_set_init_from_defaults(pjli->state);
+ return code;
}
/* Parse a cursor-full of data */
@@ -180,54 +178,54 @@ int /* The parser reads data from the input
* <0 value - an error was detected.
*/
pjl_impl_process(
- pl_interp_instance_t *instance, /* interp instance to process data job in */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to process data job in */
+ stream_cursor_read *cursor /* data to process */
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
- int code = pjl_process(pjli->state, NULL, cursor);
- return code == 1 ? e_ExitLanguage : code;
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
+ int code = pjl_process(pjli->state, NULL, cursor);
+ return code == 1 ? e_ExitLanguage : code;
}
/* Skip to end of job ret 1 if done, 0 ok but EOJ not found, else -ve error code */
int
pjl_impl_flush_to_eoj(
- pl_interp_instance_t *instance, /* interp instance to flush for */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to flush for */
+ stream_cursor_read *cursor /* data to process */
)
{
- return pjl_skip_to_uel(cursor) ? 1 : 0;
+ return pjl_skip_to_uel(cursor) ? 1 : 0;
}
/* Parser action for end-of-file */
int /* ret 0 or +ve if ok, else -ve error code */
pjl_impl_process_eof(
- pl_interp_instance_t *instance /* interp instance to process data job in */
+ pl_interp_instance_t *instance /* interp instance to process data job in */
)
{
- return 0;
+ return 0;
}
/* Report any errors after running a job */
int /* ret 0 ok, else -ve error code */
pjl_impl_report_errors(
- pl_interp_instance_t *instance, /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance, /* interp instance to wrap up job in */
int code, /* prev termination status */
long file_position, /* file position of error, -1 if unknown */
- bool force_to_cout /* force errors to cout */
+ bool force_to_cout /* force errors to cout */
)
{
- return 0;
+ return 0;
}
/* Wrap up interp instance after a "job" */
int /* ret 0 ok, else -ve error code */
pjl_impl_dnit_job(
- pl_interp_instance_t *instance /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance /* interp instance to wrap up job in */
)
{
- int code = 0;
- return code;
+ int code = 0;
+ return code;
}
/* Remove a device from an interperter instance */
@@ -236,7 +234,7 @@ pjl_impl_remove_device(
pl_interp_instance_t *instance /* interp instance to use */
)
{
- return gs_error_undefined; /* this operation is undefined for PJL */
+ return gs_error_undefined; /* this operation is undefined for PJL */
}
/* Deallocate a interpreter instance */
@@ -245,13 +243,13 @@ pjl_impl_deallocate_interp_instance(
pl_interp_instance_t *instance /* instance to dealloc */
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
- gs_memory_t *mem = pjli->memory;
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)instance;
+ gs_memory_t *mem = pjli->memory;
- pjl_process_destroy(pjli->state, mem);
- gs_free_object(mem, pjli, "pjl_impl_deallocate_interp_instance(pjl_interp_instance_t)");
+ pjl_process_destroy(pjli->state, mem);
+ gs_free_object(mem, pjli, "pjl_impl_deallocate_interp_instance(pjl_interp_instance_t)");
- return 0;
+ return 0;
}
/* Do static deinit of PJL interpreter */
@@ -260,11 +258,11 @@ pjl_impl_deallocate_interp(
pl_interp_t *interp /* interpreter to deallocate */
)
{
- pjl_interp_t *pi = (pjl_interp_t *)interp;
- gs_memory_t *mem = pi->memory;
- gs_free_object(mem, pi, "pjl_impl_deallocte_interp(pjl_interp_t)");
-
- return 0;
+ pjl_interp_t *pi = (pjl_interp_t *)interp;
+ gs_memory_t *mem = pi->memory;
+ gs_free_object(mem, pi, "pjl_impl_deallocte_interp(pjl_interp_t)");
+
+ return 0;
}
/* return the current setting of a pjl environment variable. */
@@ -274,8 +272,8 @@ pjl_impl_get_envvar(
const char *pjl_var
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
- return pjl_get_envvar(pjli->state, pjl_var);
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
+ return pjl_get_envvar(pjli->state, pjl_var);
}
/* compare a pjl environment variable to a string values. */
@@ -286,7 +284,7 @@ pjl_impl_compare(
const char *s2
)
{
- return pjl_compare(s1, s2);
+ return pjl_compare(s1, s2);
}
/* map a pjl symbol set name to a pcl integer */
@@ -296,7 +294,7 @@ pjl_impl_map_pjl_sym_to_pcl_sym(
const pjl_envvar_t *symname
)
{
- return pjl_map_pjl_sym_to_pcl_sym(symname);
+ return pjl_map_pjl_sym_to_pcl_sym(symname);
}
/* pjl environment variable to integer. */
@@ -306,7 +304,7 @@ pjl_impl_vartoi(
const pjl_envvar_t *s
)
{
- return pjl_vartoi(s);
+ return pjl_vartoi(s);
}
/* pjl envioronment variable to float. */
@@ -316,7 +314,7 @@ pjl_impl_vartof(
const pjl_envvar_t *s
)
{
- return pjl_vartof(s);
+ return pjl_vartof(s);
}
/* convert a pjl designated fontsource to a subdirectory pathname. */
@@ -326,8 +324,8 @@ pjl_impl_fontsource_to_path(
const pjl_envvar_t *fontsource
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
- return pjl_fontsource_to_path(pjli->state, fontsource);
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
+ return pjl_fontsource_to_path(pjli->state, fontsource);
}
/* Change to next highest priority font source. */
@@ -336,8 +334,8 @@ pjl_impl_set_next_fontsource(
pl_interp_instance_t *pli
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
- pjl_set_next_fontsource(pjli->state);
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
+ pjl_set_next_fontsource(pjli->state);
}
/* tell pjl that a soft font is being deleted. */
@@ -347,19 +345,18 @@ pjl_impl_register_permanent_soft_font_deletion(
int font_number
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
- return pjl_register_permanent_soft_font_deletion(pjli->state, font_number);
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
+ return pjl_register_permanent_soft_font_deletion(pjli->state, font_number);
}
-
/* request that pjl add a soft font and return a pjl font number for the font. */
int
pjl_impl_register_permanent_soft_font_addition(
pl_interp_instance_t *pli
)
{
- pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
- return pjl_register_permanent_soft_font_addition(pjli->state);
+ pjl_interp_instance_t *pjli = (pjl_interp_instance_t *)pli;
+ return pjl_register_permanent_soft_font_addition(pjli->state);
}
long int
@@ -376,7 +373,6 @@ pjl_impl_get_named_resource(pl_interp_instance_t *pli, char *name, unsigned char
return pjl_get_named_resource(pjli->state, name, data);
}
-
/* Parser implementation descriptor */
pjl_implementation_t pjl_implementation = {
/* Generic language parser portion */
diff --git a/pl/pjtop.c b/pl/pjtop.c
index 30c93df66..ea1dd002e 100644
--- a/pl/pjtop.c
+++ b/pl/pjtop.c
@@ -24,8 +24,8 @@ pjl_proc_get_envvar(
const char *pjl_var
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_get_envvar(pli, pjl_var);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_get_envvar(pli, pjl_var);
}
/* compare a pjl environment variable to a string values. */
@@ -36,8 +36,8 @@ pjl_proc_compare(
const char *s2
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_compare(pli, s1, s2);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_compare(pli, s1, s2);
}
/* map a pjl symbol set name to a pcl integer */
@@ -47,8 +47,8 @@ pjl_proc_map_pjl_sym_to_pcl_sym(
const pjl_envvar_t *symname
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_map_pjl_sym_to_pcl_sym(pli, symname);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_map_pjl_sym_to_pcl_sym(pli, symname);
}
/* pjl environment variable to integer. */
@@ -58,8 +58,8 @@ pjl_proc_vartoi(
const pjl_envvar_t *s
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_vartoi(pli, s);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_vartoi(pli, s);
}
/* pjl envioronment variable to float. */
@@ -69,8 +69,8 @@ pjl_proc_vartof(
const pjl_envvar_t *s
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_vartof(pli, s);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_vartof(pli, s);
}
/* convert a pjl designated fontsource to a subdirectory pathname. */
@@ -80,8 +80,8 @@ pjl_proc_fontsource_to_path(
const pjl_envvar_t *fontsource
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_fontsource_to_path(pli, fontsource);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_fontsource_to_path(pli, fontsource);
}
/* Change to next highest priority font source. */
@@ -90,8 +90,8 @@ pjl_proc_set_next_fontsource(
pl_interp_instance_t *pli
)
{
- ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_set_next_fontsource(pli);
+ ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_set_next_fontsource(pli);
}
/* tell pjl that a soft font is being deleted. */
@@ -101,8 +101,8 @@ pjl_proc_register_permanent_soft_font_deletion(
int font_number
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_register_permanent_soft_font_deletion(pli, font_number);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_register_permanent_soft_font_deletion(pli, font_number);
}
/* request that pjl add a soft font and return a pjl font number for the font. */
@@ -111,20 +111,20 @@ pjl_proc_register_permanent_soft_font_addition(
pl_interp_instance_t *pli
)
{
- return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_register_permanent_soft_font_addition(pli);
+ return ((pjl_implementation_t *)pli->interp->implementation)
+ ->proc_register_permanent_soft_font_addition(pli);
}
long int
pjl_proc_get_named_resource_size(pl_interp_instance_t *pli, char *name)
{
return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_get_named_resource_size(pli, name);
+ ->proc_get_named_resource_size(pli, name);
}
int
pjl_proc_get_named_resource(pl_interp_instance_t *pli, char *name, byte *data)
{
return ((pjl_implementation_t *)pli->interp->implementation)
- ->proc_get_named_resource(pli, name, data);
+ ->proc_get_named_resource(pli, name, data);
}
diff --git a/pl/pjtop.h b/pl/pjtop.h
index 1c396794f..26f9e0dbf 100644
--- a/pl/pjtop.h
+++ b/pl/pjtop.h
@@ -34,13 +34,13 @@ typedef char pjl_envvar_t; /* opaque decl */
*/
/* return the current setting of a pjl environment variable. The
input parameter should be the exact string used in PJLTRM.
- Sample Usage:
+ Sample Usage:
char *formlines = pjl_get_envvar(pst, "formlines");
- if (formlines) {
- int fl = atoi(formlines);
- .
- .
- }
+ if (formlines) {
+ int fl = atoi(formlines);
+ .
+ .
+ }
Both variables and values are case insensitive.
*/
typedef pjl_envvar_t * (*pjl_proc_get_envvar_t)(pl_interp_instance_t *pli, const char *pjl_var);
@@ -107,7 +107,7 @@ int pjl_proc_get_named_resource(pl_interp_instance_t *pli, char *name, byte *dat
* Define a generic interpreter implementation
*/
typedef struct pjl_implementation_s {
- pl_interp_implementation_t pl; /* MUST BE FIRST generic impl */
+ pl_interp_implementation_t pl; /* MUST BE FIRST generic impl */
/* PJL-specific procedure vector */
pjl_proc_get_envvar_t proc_get_envvar;
@@ -122,9 +122,6 @@ typedef struct pjl_implementation_s {
pjl_proc_get_named_resource_size_t proc_get_named_resource_size;
pjl_proc_get_named_resource_t proc_get_named_resource;
-
} pjl_implementation_t;
-
#endif /* pjtop_INCLUDED */
-
diff --git a/pl/plalloc.c b/pl/plalloc.c
index d7604989a..61f7f15e8 100644
--- a/pl/plalloc.c
+++ b/pl/plalloc.c
@@ -1,5 +1,5 @@
/* Allocator for languages (pcl, xps, etc.), simply uses the chunk
- memory manager see gsmchunk.c */
+ memory manager see gsmchunk.c */
/*$Id$*/
@@ -16,7 +16,7 @@ pl_alloc_init()
gs_memory_t *pl_mem;
int code;
- if (mem == NULL)
+ if (mem == NULL)
return NULL;
#ifdef HEAP_ALLOCATOR_ONLY
diff --git a/pl/plalloc.h b/pl/plalloc.h
index 71d8bbfa3..a0398e086 100644
--- a/pl/plalloc.h
+++ b/pl/plalloc.h
@@ -13,5 +13,3 @@
/* initialize the gs allocator. */
gs_memory_t *pl_alloc_init(void);
-
-
diff --git a/pl/plapi.h b/pl/plapi.h
index 59ec2610e..0833d312d 100644
--- a/pl/plapi.h
+++ b/pl/plapi.h
@@ -18,17 +18,17 @@
# define plapi_INCLUDED
/*
- * This API level is intended to hide everything behind
+ * This API level is intended to hide everything behind
* a simple main_like argc, argv interface
*/
/* Exported functions may need different prefix
* GSDLLEXPORT marks functions as exported
- * GSDLLAPI is the calling convention used on functions exported
+ * GSDLLAPI is the calling convention used on functions exported
* When you include this header file in the caller, you may
* need to change the definitions by defining these
* before including this header file.
- * Make sure you get the calling convention correct, otherwise your
+ * Make sure you get the calling convention correct, otherwise your
* program will crash soon after returning due to stack corruption.
*/
@@ -68,16 +68,15 @@
# define GSDLLAPIPTR GSDLLAPI *
#endif
-
/* Run this just like you would pcl6 on the command line.
*
- * Returns: 0 success
- * < 0 error code
+ * Returns: 0 success
+ * < 0 error code
*/
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
pl_main(int argc, char *argv[]);
-GSDLLEXPORT int GSDLLAPI
+GSDLLEXPORT int GSDLLAPI
pl_main_aux(int argc, char *argv[], void *disp);
#endif /* plapi_INCLUDED */
diff --git a/pl/plchar.c b/pl/plchar.c
index 86424f632..bd2c7a0d4 100644
--- a/pl/plchar.c
+++ b/pl/plchar.c
@@ -105,17 +105,17 @@ pl_bitmap_encode_char(gs_font *pfont, gs_char chr, gs_glyph not_used)
/* This is simple for the same reason. */
static int
pl_bitmap_char_width(const pl_font_t *plfont, const void *pgs, uint char_code, gs_point *pwidth)
-{
+{
const byte *cdata = pl_font_lookup_glyph(plfont, char_code)->data;
pwidth->x = pwidth->y = 0;
if ( !pwidth ) {
-#ifdef DEBUG
+#ifdef DEBUG
dprintf("Warning should not call width function without width\n" );
#endif
return (cdata == 0 ? 1 : 0);
}
- if ( cdata == 0 ) {
+ if ( cdata == 0 ) {
return 1;
}
if ( cdata[0] == 0 ) { /* PCL XL characters don't have an escapement. */
@@ -123,7 +123,7 @@ pl_bitmap_char_width(const pl_font_t *plfont, const void *pgs, uint char_code, g
return 0;
}
- {
+ {
const byte *params = cdata + 6;
pwidth->x = (plfont->header[13] ? /* variable pitch */
pl_get_int16(params + 8) * 0.25 :
@@ -145,7 +145,7 @@ pl_bitmap_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code,
/* We are not concerned about PCL XL characters */
if ( cdata[0] == 0 )
return 0;
-
+
metrics[0] = pl_get_int16(cdata + 6);
pl_bitmap_char_width(plfont, pgs, char_code, &width);
metrics[2] = width.x;
@@ -208,7 +208,7 @@ bits_smear_horizontally(byte *dest, const byte *src, uint width,
sdmask = 0x80, *dp++ = dbyte, dbyte = sbyte = *++sp;
}
}
-
+
/* Process all but the last smear_width bits. */
{ for ( ; i < width; ++i ) {
if ( sbyte & sdmask )
@@ -344,7 +344,6 @@ image_bitmap_char(gs_image_enum *ienum, const gs_image_t *pim,
}
}
-
code = (*dev_proc(dev, image_data))
(dev, iinfo, planes, 0, dest_bytes, 1);
if ( code != 0 )
@@ -362,7 +361,6 @@ image_bitmap_char(gs_image_enum *ienum, const gs_image_t *pim,
return code;
}
-
/* Render a character for a bitmap font. */
/* This handles both format 0 (PCL XL) and format 4 (PCL5 bitmap). */
static int
@@ -409,7 +407,7 @@ pl_bitmap_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
image.Width = pl_get_uint16(params + 4);
image.Height = pl_get_uint16(params + 6);
/* Determine the amount of pseudo-bolding. */
- if ( plfont->bold_fraction != 0 ) {
+ if ( plfont->bold_fraction != 0 ) {
bold = (uint)(2 * image.Height * plfont->bold_fraction + 0.5);
bold_lines = alloc_bold_lines(pgs->memory, image.Width, bold,
"pl_bitmap_build_char(bold_line)");
@@ -443,7 +441,7 @@ pl_bitmap_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
}
if ( code < 0 )
return code;
-#ifdef DEBUG
+#ifdef DEBUG
if ( gs_debug_c('B') ) {
int i;
int pixels = round_up(image.Width,8) * image.Height;
@@ -524,25 +522,25 @@ pl_font_vertical_glyph(gs_glyph glyph, const pl_font_t *plfont)
return gs_no_glyph;
}
-/* get metrics with support for XL tt class 1 and 2
- * pl overrides gstype42_default_get_metrics
+/* get metrics with support for XL tt class 1 and 2
+ * pl overrides gstype42_default_get_metrics
*/
int
pl_tt_get_metrics(gs_font_type42 * pfont, uint glyph_index,
gs_type42_metrics_options_t options, float *sbw)
-{
+{
pl_font_t *plfont = pfont->client_data;
const pl_font_glyph_t *pfg = 0;
const byte *cdata = 0;
int wmode = gs_type42_metrics_options_wmode(options);
if ( plfont->glyphs.table != 0 ) {
- /* at least one caller calls before the glyph.table is valid, no chars yet
+ /* at least one caller calls before the glyph.table is valid, no chars yet
* test routes caller to gs_type42_default_get_metrics
*/
pfg = pl_font_lookup_glyph(plfont, glyph_index);
- cdata = pfg->data;
+ cdata = pfg->data;
if (cdata && (cdata[1] == 1 || cdata[1] == 2)) {
double factor = 1.0 / pfont->data.unitsPerEm;
@@ -564,7 +562,7 @@ pl_tt_get_metrics(gs_font_type42 * pfont, uint glyph_index,
} else {
sbw[0] = lsb * factor, sbw[1] = 0;
sbw[2] = width * factor, sbw[3] = 0;
- }
+ }
return 0; /* tt class 1,2 */
}
}
@@ -600,43 +598,42 @@ pl_tt_get_metrics(gs_font_type42 * pfont, uint glyph_index,
return gs_type42_default_get_metrics(pfont, glyph_index, wmode, sbw);
}
-
/* Get the outline data for a glyph in a downloaded TrueType font. */
int
pl_tt_get_outline(gs_font_type42 *pfont, uint index, gs_glyph_data_t *pdata)
-{
+{
pl_font_t *plfont = pfont->client_data;
const pl_font_glyph_t *pfg = pl_font_lookup_glyph(plfont, index);
const byte *cdata = pfg->data;
- if ( cdata == 0 ) {
+ if ( cdata == 0 ) {
/* undefined glyph */
gs_glyph_data_from_null(pdata);
}
- else {
+ else {
uint desc_size = (*cdata == 15 ? cdata[2] /* PCL5 */ : 0 /* PCL XL */);
uint data_size = pl_get_uint16(cdata + 2 + desc_size);
- if ( data_size <= 4 ) {
+ if ( data_size <= 4 ) {
/* empty outline */
gs_glyph_data_from_null(pdata);
- } else if ( cdata[1] == 0) {
- gs_glyph_data_from_bytes(pdata,
+ } else if ( cdata[1] == 0) {
+ gs_glyph_data_from_bytes(pdata,
cdata,
- 6 + desc_size,
- data_size - 4,
+ 6 + desc_size,
+ data_size - 4,
NULL);
- } else if ( cdata[1] == 1) {
- gs_glyph_data_from_bytes(pdata,
+ } else if ( cdata[1] == 1) {
+ gs_glyph_data_from_bytes(pdata,
cdata,
- 10,
- data_size - 8,
+ 10,
+ data_size - 8,
NULL);
- } else if ( cdata[1] == 2) {
- gs_glyph_data_from_bytes(pdata,
+ } else if ( cdata[1] == 2) {
+ gs_glyph_data_from_bytes(pdata,
cdata,
- 12,
- data_size - 10,
+ 12,
+ data_size - 10,
NULL);
}
}
@@ -849,11 +846,11 @@ gs_char last_char = 0;
/* we may return either gs_no_glyph or 0 for an undefined character. */
gs_glyph
pl_tt_encode_char(gs_font *pfont_generic, gs_char chr, gs_glyph not_used)
-{
+{
gs_font_type42 *pfont = (gs_font_type42 *)pfont_generic;
uint cmap_len;
ulong cmap_offset = tt_find_table(pfont, "cmap", &cmap_len);
- gs_glyph glyph =
+ gs_glyph glyph =
(cmap_offset == 0 ?
/* This is a downloaded font with no cmap. */
pl_tt_dynamic_encode_char(pfont, chr) :
@@ -882,7 +879,6 @@ pl_tt_encode_char(gs_font *pfont_generic, gs_char chr, gs_glyph not_used)
return glyph; /* no substitute */
}
-
/* Get metrics */
static int
pl_tt_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code, float metrics[4])
@@ -905,7 +901,7 @@ pl_tt_char_width(const pl_font_t *plfont, const void *pgs, uint char_code, gs_po
gs_glyph glyph = pl_tt_encode_char(pfont, chr, unused_glyph);
int code;
float sbw[4];
-
+
pwidth->x = pwidth->y = 0;
/* Check for a vertical substitute. */
@@ -927,7 +923,6 @@ pl_tt_char_width(const pl_font_t *plfont, const void *pgs, uint char_code, gs_po
return 0;
}
-
/* Render a TrueType character. */
static int
pl_tt_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
@@ -1009,7 +1004,6 @@ pl_tt_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
}
}
-
/*
* If we want pseudo-bold, render untransformed to an intermediate
* bitmap, smear it, and then transform it to produce the output.
@@ -1196,7 +1190,7 @@ pl_intelli_merge_box(float wbox[6], const pl_font_t *plfont, gs_glyph glyph)
/* The caller has done the setcachedevice. */
static int
pl_intelli_show_char(gs_state *pgs, const pl_font_t *plfont, gs_glyph glyph)
-{
+{
int code;
const byte *cdata;
pl_font_glyph_t *font_glyph;
@@ -1207,78 +1201,78 @@ pl_intelli_show_char(gs_state *pgs, const pl_font_t *plfont, gs_glyph glyph)
cdata = font_glyph->data;
if ( cdata == 0 ) {
- if_debug1('1', "[1] no character data for glyph %ld\n",glyph);
- return 0;
+ if_debug1('1', "[1] no character data for glyph %ld\n",glyph);
+ return 0;
}
if ( cdata[3] == 4 ) { /* Compound character */
- gs_matrix save_ctm;
- int i;
- gs_currentmatrix(pgs, &save_ctm);
- for ( i = 0; i < cdata[6]; ++i ) {
- const byte *edata = cdata + 8 + i * 6;
- floatp x_offset = pl_get_int16(edata + 2);
- floatp y_offset = pl_get_int16(edata + 4);
- gs_translate(pgs, x_offset, y_offset);
- code = pl_intelli_show_char(pgs, plfont, pl_get_uint16(edata));
- gs_setmatrix(pgs, &save_ctm);
- if ( code < 0 )
- return code;
- }
- return 0;
+ gs_matrix save_ctm;
+ int i;
+ gs_currentmatrix(pgs, &save_ctm);
+ for ( i = 0; i < cdata[6]; ++i ) {
+ const byte *edata = cdata + 8 + i * 6;
+ floatp x_offset = pl_get_int16(edata + 2);
+ floatp y_offset = pl_get_int16(edata + 4);
+ gs_translate(pgs, x_offset, y_offset);
+ code = pl_intelli_show_char(pgs, plfont, pl_get_uint16(edata));
+ gs_setmatrix(pgs, &save_ctm);
+ if ( code < 0 )
+ return code;
+ }
+ return 0;
} /* compound character */
/* not compound character */
{
- const byte *outlines;
- uint num_loops;
- uint i;
- cdata += 4; /* skip PCL character header */
- outlines = cdata + pl_get_uint16(cdata + 6);
- num_loops = pl_get_uint16(outlines);
+ const byte *outlines;
+ uint num_loops;
+ uint i;
+ cdata += 4; /* skip PCL character header */
+ outlines = cdata + pl_get_uint16(cdata + 6);
+ num_loops = pl_get_uint16(outlines);
- if_debug2('1', "[1]ifont glyph %lu: loops=%u\n",(ulong)glyph, num_loops);
+ if_debug2('1', "[1]ifont glyph %lu: loops=%u\n",(ulong)glyph, num_loops);
if (num_loops == 0)
return -1;
- for ( i = 0; i < num_loops; ++i ) {
- const byte *xyc = cdata + pl_get_uint16(outlines + 4 + i * 8);
- uint num_points;
- uint num_aux_points;
- const byte *x_coords, *y_coords, *x_coords_last;
- const byte *x_aux_coords, *y_aux_coords, *x_aux_coords_last;
- int llx, lly, urx, ury; /* character bounding box */
- int x, y;
- int xAux, yAux;
- int *xLimit, *yLimit, *xScan, *yScan, *xLast;
- int pointBufferSize;
+ for ( i = 0; i < num_loops; ++i ) {
+ const byte *xyc = cdata + pl_get_uint16(outlines + 4 + i * 8);
+ uint num_points;
+ uint num_aux_points;
+ const byte *x_coords, *y_coords, *x_coords_last;
+ const byte *x_aux_coords, *y_aux_coords, *x_aux_coords_last;
+ int llx, lly, urx, ury; /* character bounding box */
+ int x, y;
+ int xAux, yAux;
+ int *xLimit, *yLimit, *xScan, *yScan, *xLast;
+ int pointBufferSize;
uint sz;
- num_points = pl_get_uint16(xyc);
- num_aux_points = pl_get_uint16(xyc + 2);
-
- x_coords = xyc + 4;
- y_coords = x_coords + num_points * 2;
- x_coords_last = y_coords;
-
- metrics = (const intelli_metrics_t *)(cdata + pl_get_uint16(cdata + 2));
- llx = pl_get_int16(metrics->charSymbolBox[0]);
- lly = pl_get_int16(metrics->charSymbolBox[1]);
- urx = pl_get_int16(metrics->charSymbolBox[2]);
- ury = pl_get_int16(metrics->charSymbolBox[3]);
-
- pointBufferSize = num_points; /* allocate enough to hold all points */
- if ( num_aux_points != 0xffff ) {
- pointBufferSize += num_aux_points;
- x_aux_coords = y_coords + num_points * 2;
- y_aux_coords = x_aux_coords + num_aux_points;
- x_aux_coords_last = y_coords;
- }
- else {
- x_aux_coords = NULL;
- y_aux_coords = NULL;
- x_aux_coords_last = NULL;
- }
+ num_points = pl_get_uint16(xyc);
+ num_aux_points = pl_get_uint16(xyc + 2);
+
+ x_coords = xyc + 4;
+ y_coords = x_coords + num_points * 2;
+ x_coords_last = y_coords;
+
+ metrics = (const intelli_metrics_t *)(cdata + pl_get_uint16(cdata + 2));
+ llx = pl_get_int16(metrics->charSymbolBox[0]);
+ lly = pl_get_int16(metrics->charSymbolBox[1]);
+ urx = pl_get_int16(metrics->charSymbolBox[2]);
+ ury = pl_get_int16(metrics->charSymbolBox[3]);
+
+ pointBufferSize = num_points; /* allocate enough to hold all points */
+ if ( num_aux_points != 0xffff ) {
+ pointBufferSize += num_aux_points;
+ x_aux_coords = y_coords + num_points * 2;
+ y_aux_coords = x_aux_coords + num_aux_points;
+ x_aux_coords_last = y_coords;
+ }
+ else {
+ x_aux_coords = NULL;
+ y_aux_coords = NULL;
+ x_aux_coords_last = NULL;
+ }
sz = pointBufferSize * sizeof(int);
@@ -1291,82 +1285,82 @@ pl_intelli_show_char(gs_state *pgs, const pl_font_t *plfont, gs_glyph glyph)
yBuffer = (int *)gs_resize_object(pgs->memory, yBuffer, sz, cname);
}
- if (xBuffer == NULL || yBuffer == NULL) {
- if( xBuffer != NULL)
- gs_free_object(pgs->memory, xBuffer, "x point buffer");
- if( yBuffer != NULL)
- gs_free_object(pgs->memory, yBuffer, "y point buffer");
- if_debug1('1', "[1]cannot allocate point buffers %i\n",pointBufferSize * sizeof(int));
- return_error(gs_error_VMerror);
- }
-
- xLimit = xBuffer + pointBufferSize;
- yLimit = yBuffer + pointBufferSize;
- xLast = NULL;
-
- if_debug2('1', "[1]num_points=%u num_aux_points=%u\n", num_points, num_aux_points);
-
- /* collect the points in the buffers, since we need to clean them up later */
- /* only points inside the bounding box are allowed */
- /* aux points are points inserted between two points, making the outline smoother */
- /* the aux points could be used for curve fitting, but we add line segments */
- for ( xScan = xBuffer, yScan = yBuffer; x_coords < x_coords_last; x_coords += 2, y_coords += 2 ) {
- x = pl_get_uint16(x_coords) & 0x3fff;
- y = pl_get_uint16(y_coords) & 0x3fff;
-
- if_debug4('1', "[1]%s (%d,%d) %s\n",
- (*x_coords & 0x80 ? " line" : "curve"), x, y,
- (*y_coords & 0x80 ? " line" : "curve"));
-
- if (xScan > xBuffer) { /* not first point, therefore aux is possible */
- if ( x_aux_coords < x_aux_coords_last &&!(*x_coords & 0x80) ) { /* use an aux point */
- /* The auxiliary dx and dy values are signed. */
- int dx = (*x_aux_coords++ ^ 0x80) - 0x80;
- int dy = (*y_aux_coords++ ^ 0x80) - 0x80;
-
- if_debug2('1', "[1]... aux (%d,%d)\n", dx, dy);
-
- xAux = (x + *(xScan-1)) / 2 + dx;
- yAux = (y + *(yScan-1)) / 2 + dy;
- if ((xAux >= llx && xAux <= urx) && (yAux >= lly && yAux <= ury)) { /* aux point is inside bounding box */
- *xScan++ = xAux;
- *yScan++ = yAux;
- } /* end point inside bounding box */
- /* what do points outside the bounding box mean? */
- } /* use an aux point */
- } /* not first point */
-
- if ( (x >= llx && x <= urx) && (y >= lly && y <= ury) ) { /* point inside bounding box */
- *xScan++ = x;
- *yScan++ = y;
- } /* point inside bounding box */
- } /* for num_points - first time through */
-
- if ( num_aux_points != 0xffff )
- xLast = xScan;
- else
- xLast = xScan - 1; /* discard the last point */
-
- xScan = xBuffer;
- yScan = yBuffer;
- if (xLast > xBuffer) {
- code = gs_moveto(pgs, (floatp)*xScan++, (floatp)*yScan++);
- if ( code < 0 )
- goto cleanup;
- }
-
- for (; xScan < xLast; ) {
- code = gs_lineto(pgs, (floatp)*xScan++, (floatp)*yScan++);
- if ( code < 0 )
- goto cleanup;
- }
- /* close the path of this loop */
- code = gs_closepath(pgs);
- if ( code < 0 )
+ if (xBuffer == NULL || yBuffer == NULL) {
+ if( xBuffer != NULL)
+ gs_free_object(pgs->memory, xBuffer, "x point buffer");
+ if( yBuffer != NULL)
+ gs_free_object(pgs->memory, yBuffer, "y point buffer");
+ if_debug1('1', "[1]cannot allocate point buffers %i\n",pointBufferSize * sizeof(int));
+ return_error(gs_error_VMerror);
+ }
+
+ xLimit = xBuffer + pointBufferSize;
+ yLimit = yBuffer + pointBufferSize;
+ xLast = NULL;
+
+ if_debug2('1', "[1]num_points=%u num_aux_points=%u\n", num_points, num_aux_points);
+
+ /* collect the points in the buffers, since we need to clean them up later */
+ /* only points inside the bounding box are allowed */
+ /* aux points are points inserted between two points, making the outline smoother */
+ /* the aux points could be used for curve fitting, but we add line segments */
+ for ( xScan = xBuffer, yScan = yBuffer; x_coords < x_coords_last; x_coords += 2, y_coords += 2 ) {
+ x = pl_get_uint16(x_coords) & 0x3fff;
+ y = pl_get_uint16(y_coords) & 0x3fff;
+
+ if_debug4('1', "[1]%s (%d,%d) %s\n",
+ (*x_coords & 0x80 ? " line" : "curve"), x, y,
+ (*y_coords & 0x80 ? " line" : "curve"));
+
+ if (xScan > xBuffer) { /* not first point, therefore aux is possible */
+ if ( x_aux_coords < x_aux_coords_last &&!(*x_coords & 0x80) ) { /* use an aux point */
+ /* The auxiliary dx and dy values are signed. */
+ int dx = (*x_aux_coords++ ^ 0x80) - 0x80;
+ int dy = (*y_aux_coords++ ^ 0x80) - 0x80;
+
+ if_debug2('1', "[1]... aux (%d,%d)\n", dx, dy);
+
+ xAux = (x + *(xScan-1)) / 2 + dx;
+ yAux = (y + *(yScan-1)) / 2 + dy;
+ if ((xAux >= llx && xAux <= urx) && (yAux >= lly && yAux <= ury)) { /* aux point is inside bounding box */
+ *xScan++ = xAux;
+ *yScan++ = yAux;
+ } /* end point inside bounding box */
+ /* what do points outside the bounding box mean? */
+ } /* use an aux point */
+ } /* not first point */
+
+ if ( (x >= llx && x <= urx) && (y >= lly && y <= ury) ) { /* point inside bounding box */
+ *xScan++ = x;
+ *yScan++ = y;
+ } /* point inside bounding box */
+ } /* for num_points - first time through */
+
+ if ( num_aux_points != 0xffff )
+ xLast = xScan;
+ else
+ xLast = xScan - 1; /* discard the last point */
+
+ xScan = xBuffer;
+ yScan = yBuffer;
+ if (xLast > xBuffer) {
+ code = gs_moveto(pgs, (floatp)*xScan++, (floatp)*yScan++);
+ if ( code < 0 )
+ goto cleanup;
+ }
+
+ for (; xScan < xLast; ) {
+ code = gs_lineto(pgs, (floatp)*xScan++, (floatp)*yScan++);
+ if ( code < 0 )
+ goto cleanup;
+ }
+ /* close the path of this loop */
+ code = gs_closepath(pgs);
+ if ( code < 0 )
break;
- } /* for num_loops */
-
+ } /* for num_loops */
+
cleanup:
gs_free_object(pgs->memory, xBuffer, "x point buffer");
gs_free_object(pgs->memory, yBuffer, "y point buffer");
@@ -1377,7 +1371,7 @@ cleanup:
/* Get character existence and escapement for an Intellifont. */
static int
pl_intelli_char_width(const pl_font_t *plfont, const void *pgs, uint char_code, gs_point *pwidth)
-{
+{
const byte *cdata = pl_font_lookup_glyph(plfont, char_code)->data;
int wx;
@@ -1426,7 +1420,7 @@ pl_intelli_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code
metrics[0] = metrics[1] = metrics[2] = metrics[3] = 0;
- if ( cdata == 0 ) {
+ if ( cdata == 0 ) {
return 1;
}
@@ -1437,7 +1431,7 @@ pl_intelli_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code
}
cdata += 4;
-
+
{
const intelli_metrics_t *intelli_metrics =
(const intelli_metrics_t *)(cdata + pl_get_uint16(cdata + 2));
@@ -1480,7 +1474,6 @@ pl_intelli_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont,
return (code < 0 ? code : 0);
}
-
/* ---------------- Internal initialization ---------------- */
/* Initialize the procedures for a bitmap font. */
@@ -1497,7 +1490,7 @@ pl_bitmap_init_procs(gs_font_base *pfont)
/* Initialize the procedures for a TrueType font. */
void
pl_tt_init_procs(gs_font_type42 *pfont)
-{
+{
pfont->procs.encode_char = (void *)pl_tt_encode_char; /* FIX ME (void *) */
pfont->procs.build_char = (void *)pl_tt_build_char; /* FIX ME (void *) */
pfont->data.string_proc = pl_tt_string_proc;
@@ -1690,11 +1683,11 @@ tcg: if ( plfont->char_glyphs.table )
}
/* get glyph id from character download */
if ( cdata[0] == 1 )
- /* pxl truetype format 1,
+ /* pxl truetype format 1,
* class 0 at offset 4, class 1 at offset 8 or class 2 at 10 */
key = pl_get_uint16(cdata + ((cdata[1] == 0) ? 4 : ((cdata[1] == 1) ? 8 : 10)));
else
- /* pcl truetype format 15 */
+ /* pcl truetype format 15 */
key = pl_get_uint16(cdata + cdata[2] + 4);
}
fg: pfg = pl_font_lookup_glyph(plfont, key);
@@ -1752,7 +1745,7 @@ pl_font_disable_composite_metrics(pl_font_t *plfont, gs_glyph glyph)
font wrapper format. It is documented in several other places
in this file. If a char_glyphs table is not available it is
not a downloadedd TT font wrapper so we do nothing. */
- if (plfont->char_glyphs.table) {
+ if (plfont->char_glyphs.table) {
pl_tt_char_glyph_t *ptcg = pl_tt_lookup_char(plfont, key);
if ( ptcg->chr == gs_no_char )
return 0;
@@ -1770,7 +1763,7 @@ pl_font_disable_composite_metrics(pl_font_t *plfont, gs_glyph glyph)
/* null glyph */
if (glyph_data.bits.data == 0)
return 0;
-
+
/* the glyph is guaranteed by the langauges to be have a reasonable
header (enough to test for a composite glyph and do the tests
below for components) so a UMR or overflow is not possible but
diff --git a/pl/pldict.c b/pl/pldict.c
index 437d6aa4b..37540e604 100644
--- a/pl/pldict.c
+++ b/pl/pldict.c
@@ -43,15 +43,15 @@ gs_private_st_composite(st_pl_dict_entry, pl_dict_entry_t, "pl_dict_entry_t",
#define pde ((pl_dict_entry_t *)vptr)
static ENUM_PTRS_BEGIN(pl_dict_entry_enum_ptrs) return 0;
/* ENUM_CONST_STRING_PTR(0, pl_dict_entry_t, key); */
- ENUM_PTR(1, pl_dict_entry_t, value);
- ENUM_PTR(2, pl_dict_entry_t, next);
- ENUM_PTR(3, pl_dict_entry_t, link);
+ ENUM_PTR(1, pl_dict_entry_t, value);
+ ENUM_PTR(2, pl_dict_entry_t, next);
+ ENUM_PTR(3, pl_dict_entry_t, link);
ENUM_PTRS_END
static RELOC_PTRS_BEGIN(pl_dict_entry_reloc_ptrs) {
/* RELOC_CONST_STRING_PTR(pl_dict_entry_t, key); */
- RELOC_PTR(pl_dict_entry_t, value);
- RELOC_PTR(pl_dict_entry_t, next);
- RELOC_PTR(pl_dict_entry_t, link);
+ RELOC_PTR(pl_dict_entry_t, value);
+ RELOC_PTR(pl_dict_entry_t, next);
+ RELOC_PTR(pl_dict_entry_t, link);
} RELOC_PTRS_END
#undef pde
@@ -70,29 +70,29 @@ pl_dict_value_free(gs_memory_t *mem, void *value, client_name_t cname)
static pl_dict_entry_t **
pl_dict_lookup_entry(pl_dict_t *pdict, const byte *kdata, uint ksize)
{ pl_dict_entry_t **ppde = &pdict->entries;
- pl_dict_entry_t *pde;
- for ( ; (pde = *ppde) != 0; ppde = &pde->next )
- { if ( pde->key.size == ksize &&
- !memcmp(entry_key_data(pde), kdata, ksize)
- )
- return ppde;
- }
- return 0;
+ pl_dict_entry_t *pde;
+ for ( ; (pde = *ppde) != 0; ppde = &pde->next )
+ { if ( pde->key.size == ksize &&
+ !memcmp(entry_key_data(pde), kdata, ksize)
+ )
+ return ppde;
+ }
+ return 0;
}
/* Delete a dictionary entry. */
static void
pl_dict_free(pl_dict_t *pdict, pl_dict_entry_t **ppde, client_name_t cname)
{ pl_dict_entry_t *pde = *ppde;
- gs_memory_t *mem = pdict->memory;
+ gs_memory_t *mem = pdict->memory;
- *ppde = pde->next;
- if ( !pde->link ) /* values are not freed for links */
- (*pdict->free_proc)(mem, pde->value, cname);
- if ( pde->key.size > pl_dict_max_short_key )
- gs_free_string(mem, (byte *)pde->key.data, pde->key.size, cname);
- gs_free_object(mem, pde, cname);
- pdict->entry_count--;
+ *ppde = pde->next;
+ if ( !pde->link ) /* values are not freed for links */
+ (*pdict->free_proc)(mem, pde->value, cname);
+ if ( pde->key.size > pl_dict_max_short_key )
+ gs_free_string(mem, (byte *)pde->key.data, pde->key.size, cname);
+ gs_free_object(mem, pde, cname);
+ pdict->entry_count--;
}
/* ---------------- API procedures ---------------- */
@@ -102,10 +102,10 @@ void
pl_dict_init(pl_dict_t *pdict, gs_memory_t *mem,
pl_dict_value_free_proc_t free_proc)
{ pdict->memory = mem;
- pdict->free_proc = (free_proc ? free_proc : pl_dict_value_free);
- pdict->entries = 0;
- pdict->entry_count = 0;
- pdict->parent = 0;
+ pdict->free_proc = (free_proc ? free_proc : pl_dict_value_free);
+ pdict->entries = 0;
+ pdict->entry_count = 0;
+ pdict->parent = 0;
}
/*
@@ -119,16 +119,16 @@ bool
pl_dict_lookup(pl_dict_t *pdict, const byte *kdata, uint ksize, void **pvalue,
bool with_stack, pl_dict_t **ppdict)
{ pl_dict_t *pdcur = pdict;
- pl_dict_entry_t **ppde;
+ pl_dict_entry_t **ppde;
- while ( (ppde = pl_dict_lookup_entry(pdcur, kdata, ksize)) == 0 )
- { if ( !with_stack || (pdcur = pdcur->parent) == 0 )
- return false;
- }
- *pvalue = (*ppde)->value;
- if ( ppdict )
- *ppdict = pdcur;
- return true;
+ while ( (ppde = pl_dict_lookup_entry(pdcur, kdata, ksize)) == 0 )
+ { if ( !with_stack || (pdcur = pdcur->parent) == 0 )
+ return false;
+ }
+ *pvalue = (*ppde)->value;
+ if ( ppdict )
+ *ppdict = pdcur;
+ return true;
}
/*
@@ -136,30 +136,30 @@ pl_dict_lookup(pl_dict_t *pdict, const byte *kdata, uint ksize, void **pvalue,
*/
static int
pl_dict_build_new_entry(pl_dict_t *pdict, const byte *kdata, uint ksize,
- void *value, pl_dict_entry_t *link)
+ void *value, pl_dict_entry_t *link)
{ /* Make a new entry. */
byte *kstr;
- gs_memory_t *mem = pdict->memory;
- pl_dict_entry_t *pde;
- pde = gs_alloc_struct(mem, pl_dict_entry_t, &st_pl_dict_entry,
- "pl_dict_put(entry)");
- kstr = (ksize <= pl_dict_max_short_key ? pde->short_key :
- gs_alloc_string(mem, ksize, "pl_dict_put(key)"));
- if ( pde == 0 || kstr == 0 )
- { if ( kstr && kstr != pde->short_key )
- gs_free_string(mem, kstr, ksize, "pl_dict_put(key)");
- gs_free_object(mem, pde, "pl_dict_put(entry)");
- return -1;
- }
- memcpy(kstr, kdata, ksize);
- pde->key.data = (ksize <= pl_dict_max_short_key ? 0 : kstr);
- pde->key.size = ksize;
- pde->link = link;
- pde->value = value;
- pde->next = pdict->entries;
- pdict->entries = pde;
- pdict->entry_count++;
- return 0;
+ gs_memory_t *mem = pdict->memory;
+ pl_dict_entry_t *pde;
+ pde = gs_alloc_struct(mem, pl_dict_entry_t, &st_pl_dict_entry,
+ "pl_dict_put(entry)");
+ kstr = (ksize <= pl_dict_max_short_key ? pde->short_key :
+ gs_alloc_string(mem, ksize, "pl_dict_put(key)"));
+ if ( pde == 0 || kstr == 0 )
+ { if ( kstr && kstr != pde->short_key )
+ gs_free_string(mem, kstr, ksize, "pl_dict_put(key)");
+ gs_free_object(mem, pde, "pl_dict_put(entry)");
+ return -1;
+ }
+ memcpy(kstr, kdata, ksize);
+ pde->key.data = (ksize <= pl_dict_max_short_key ? 0 : kstr);
+ pde->key.size = ksize;
+ pde->link = link;
+ pde->value = value;
+ pde->next = pdict->entries;
+ pdict->entries = pde;
+ pdict->entry_count++;
+ return 0;
}
/*
@@ -171,19 +171,19 @@ pl_dict_build_new_entry(pl_dict_t *pdict, const byte *kdata, uint ksize,
int
pl_dict_put(pl_dict_t *pdict, const byte *kdata, uint ksize, void *value)
{ pl_dict_entry_t **ppde = pl_dict_lookup_entry(pdict, kdata, ksize);
- if ( !ppde )
- { void *link = 0;
- return pl_dict_build_new_entry(pdict, kdata, ksize, value, link);
- }
- else
- { /* Replace the value in an existing entry. */
- pl_dict_entry_t *pde;
- pde = *ppde;
- (*pdict->free_proc)(pdict->memory, pde->value,
- "pl_dict_put(old value)");
- pde->value = value;
- return 1;
- }
+ if ( !ppde )
+ { void *link = 0;
+ return pl_dict_build_new_entry(pdict, kdata, ksize, value, link);
+ }
+ else
+ { /* Replace the value in an existing entry. */
+ pl_dict_entry_t *pde;
+ pde = *ppde;
+ (*pdict->free_proc)(pdict->memory, pde->value,
+ "pl_dict_put(old value)");
+ pde->value = value;
+ return 1;
+ }
}
/*
@@ -191,23 +191,23 @@ pl_dict_put(pl_dict_t *pdict, const byte *kdata, uint ksize, void *value)
*/
int
pl_dict_put_synonym(pl_dict_t *pdict, const byte *old_kdata, uint old_ksize,
- const byte *new_kdata, uint new_ksize)
+ const byte *new_kdata, uint new_ksize)
{ pl_dict_entry_t **old_ppde = pl_dict_lookup_entry(pdict, old_kdata, old_ksize);
- pl_dict_entry_t *old_pde;
- pl_dict_entry_t **new_ppde = pl_dict_lookup_entry(pdict, new_kdata, new_ksize);
- /* old value doesn't exist or new value does exist */
- if ( !old_ppde || new_ppde )
- return -1;
- /* find the original data if this is a link to a link */
- old_pde = *old_ppde;
- if ( old_pde->link != 0 )
- old_pde = old_pde->link;
+ pl_dict_entry_t *old_pde;
+ pl_dict_entry_t **new_ppde = pl_dict_lookup_entry(pdict, new_kdata, new_ksize);
+ /* old value doesn't exist or new value does exist */
+ if ( !old_ppde || new_ppde )
+ return -1;
+ /* find the original data if this is a link to a link */
+ old_pde = *old_ppde;
+ if ( old_pde->link != 0 )
+ old_pde = old_pde->link;
- return pl_dict_build_new_entry(pdict, new_kdata, new_ksize,
- old_pde->value, old_pde);
+ return pl_dict_build_new_entry(pdict, new_kdata, new_ksize,
+ old_pde->value, old_pde);
}
-/*
+/*
* Purge alias entries. A bit tricky but this doesn't fowl the
* enumeration code since links are always prior to their entries. We
* insert at the head of the list and a real entry must be present to
@@ -217,28 +217,28 @@ pl_dict_put_synonym(pl_dict_t *pdict, const byte *old_kdata, uint old_ksize,
void
pl_dict_undef_purge_synonyms(pl_dict_t *pdict, const byte *kdata, uint ksize)
{ pl_dict_entry_t **ppde = &pdict->entries;
- pl_dict_entry_t **pptarget = pl_dict_lookup_entry(pdict, kdata, ksize);
- pl_dict_entry_t *pde;
- pl_dict_entry_t *ptarget;
+ pl_dict_entry_t **pptarget = pl_dict_lookup_entry(pdict, kdata, ksize);
+ pl_dict_entry_t *pde;
+ pl_dict_entry_t *ptarget;
- if ( !pptarget )
- return;
- ptarget = *pptarget;
- /* get the real entry if this is a link. */
- if ( ptarget->link )
- ptarget = ptarget->link;
+ if ( !pptarget )
+ return;
+ ptarget = *pptarget;
+ /* get the real entry if this is a link. */
+ if ( ptarget->link )
+ ptarget = ptarget->link;
#define dict_get_key_data(entry) ((entry)->key.size > pl_dict_max_short_key ?\
(entry)->key.data : (entry)->short_key)
- pl_dict_undef(pdict, dict_get_key_data(ptarget), ptarget->key.size);
- /* delete links to the target */
- pde = *ppde;
- while ( pde )
- {
- pl_dict_entry_t *npde = pde->next; /* next entry */
- if ( pde->link && pde->link == ptarget )
- pl_dict_undef(pdict, dict_get_key_data(pde), pde->key.size);
- pde = npde;
- }
+ pl_dict_undef(pdict, dict_get_key_data(ptarget), ptarget->key.size);
+ /* delete links to the target */
+ pde = *ppde;
+ while ( pde )
+ {
+ pl_dict_entry_t *npde = pde->next; /* next entry */
+ if ( pde->link && pde->link == ptarget )
+ pl_dict_undef(pdict, dict_get_key_data(pde), pde->key.size);
+ pde = npde;
+ }
#undef dict_get_key_data
}
@@ -249,10 +249,10 @@ bool
pl_dict_undef(pl_dict_t *pdict, const byte *kdata, uint ksize)
{ pl_dict_entry_t **ppde = pl_dict_lookup_entry(pdict, kdata, ksize);
- if ( !ppde )
- return false;
- pl_dict_free(pdict, ppde, "pl_dict_undef");
- return true;
+ if ( !ppde )
+ return false;
+ pl_dict_free(pdict, ppde, "pl_dict_undef");
+ return true;
}
/*
@@ -262,12 +262,12 @@ uint
pl_dict_length(const pl_dict_t *pdict, bool with_stack)
{ uint count = pdict->entry_count;
- if ( with_stack )
- { const pl_dict_t *pdcur;
- for ( pdcur = pdict->parent; pdcur != 0; pdcur = pdcur->parent )
- count += pdcur->entry_count;
- }
- return count;
+ if ( with_stack )
+ { const pl_dict_t *pdcur;
+ for ( pdcur = pdict->parent; pdcur != 0; pdcur = pdcur->parent )
+ count += pdcur->entry_count;
+ }
+ return count;
}
/*
@@ -278,27 +278,27 @@ void
pl_dict_enum_stack_begin(const pl_dict_t *pdict, pl_dict_enum_t *penum,
bool with_stack)
{ penum->pdict = pdict;
- penum->next = 0;
- penum->first = true;
- penum->next_dict = (with_stack ? pdict->parent : 0);
+ penum->next = 0;
+ penum->first = true;
+ penum->next_dict = (with_stack ? pdict->parent : 0);
}
bool
pl_dict_enum_next(pl_dict_enum_t *penum, gs_const_string *pkey,
void **pvalue)
{ pl_dict_entry_t *pde;
- while ( (pde = (penum->first ? penum->pdict->entries : penum->next)) == 0 )
- { if ( penum->next_dict == 0 )
- return false;
- penum->next_dict = (penum->pdict = penum->next_dict)->parent;
- penum->first = true;
- }
- pkey->data = entry_key_data(pde);
- pkey->size = pde->key.size;
- *pvalue = pde->value;
- penum->next = pde->next;
- penum->first = false;
- return true;
+ while ( (pde = (penum->first ? penum->pdict->entries : penum->next)) == 0 )
+ { if ( penum->next_dict == 0 )
+ return false;
+ penum->next_dict = (penum->pdict = penum->next_dict)->parent;
+ penum->first = true;
+ }
+ pkey->data = entry_key_data(pde);
+ pkey->size = pde->key.size;
+ *pvalue = pde->value;
+ penum->next = pde->next;
+ penum->first = false;
+ return true;
}
/*
@@ -307,5 +307,5 @@ pl_dict_enum_next(pl_dict_enum_t *penum, gs_const_string *pkey,
void
pl_dict_release(pl_dict_t *pdict)
{ while ( pdict->entries )
- pl_dict_free(pdict, &pdict->entries, "pl_dict_release");
+ pl_dict_free(pdict, &pdict->entries, "pl_dict_release");
}
diff --git a/pl/pldict.h b/pl/pldict.h
index b18da8902..ef0be4b6a 100644
--- a/pl/pldict.h
+++ b/pl/pldict.h
@@ -84,7 +84,7 @@ bool pl_dict_lookup(pl_dict_t *pdict, const byte *kdata, uint ksize,
int pl_dict_put(pl_dict_t *pdict, const byte *kdata, uint ksize,
void *value);
-/*
+/*
* When a dictionary entry is created, it can be designated as being a
* synonym or alias of an existing entry, rather than having a value
* of its own. All entries in a synonym group are equivalent: there
@@ -153,7 +153,7 @@ bool pl_dict_enum_next(pl_dict_enum_t *penum, gs_const_string *pkey,
*/
void pl_dict_release(pl_dict_t *pdict);
-/*
+/*
* Delete an entry that is a synonym or a canonical entry that has
* related synonyms. The entire group of entries is deleted. Note
* that this routine should be used in liueu of pl_dict_undef() if
diff --git a/pl/pldraw.c b/pl/pldraw.c
index b6408afb5..397dc401f 100644
--- a/pl/pldraw.c
+++ b/pl/pldraw.c
@@ -26,11 +26,11 @@ pl_begin_image(gs_state *pgs, const gs_image_t *pim,
void **pinfo)
{ gx_device *dev = pgs->device;
- if ( pim->ImageMask | pim->CombineWithColor )
- gx_set_dev_color(pgs);
- return (*dev_proc(dev, begin_image))
- (dev, (const gs_imager_state *)pgs, pim,
- gs_image_format_chunky, (const gs_int_rect *)0,
- gs_currentdevicecolor_inline(pgs), pgs->clip_path, pgs->memory,
- (gx_image_enum_common_t **)pinfo);
+ if ( pim->ImageMask | pim->CombineWithColor )
+ gx_set_dev_color(pgs);
+ return (*dev_proc(dev, begin_image))
+ (dev, (const gs_imager_state *)pgs, pim,
+ gs_image_format_chunky, (const gs_int_rect *)0,
+ gs_currentdevicecolor_inline(pgs), pgs->clip_path, pgs->memory,
+ (gx_image_enum_common_t **)pinfo);
}
diff --git a/pl/plfont.c b/pl/plfont.c
index dd609acdf..b6373e9e9 100644
--- a/pl/plfont.c
+++ b/pl/plfont.c
@@ -47,32 +47,32 @@ private_st_pl_font();
void
pl_free_font(gs_memory_t *mem, void *plf, client_name_t cname)
{ pl_font_t *plfont = plf;
- /* Free the characters. */
+ /* Free the characters. */
if ( !plfont->data_are_permanent )
- { if ( plfont->glyphs.table )
- { uint i;
- for ( i = plfont->glyphs.size; i > 0; )
+ { if ( plfont->glyphs.table )
+ { uint i;
+ for ( i = plfont->glyphs.size; i > 0; )
{ void *data = (void *)plfont->glyphs.table[--i].data;
- if ( data )
- gs_free_object(mem, data, cname);
- }
- }
- gs_free_object(mem, (void *)plfont->header, cname);
- plfont->header = 0; /* see hack note above */
- }
- /* Free the font data itself. */
- gs_free_object(mem, (void *)plfont->char_glyphs.table, cname);
- gs_free_object(mem, (void *)plfont->glyphs.table, cname);
- if ( plfont->pfont ) { /* might be only partially constructed */
+ if ( data )
+ gs_free_object(mem, data, cname);
+ }
+ }
+ gs_free_object(mem, (void *)plfont->header, cname);
+ plfont->header = 0; /* see hack note above */
+ }
+ /* Free the font data itself. */
+ gs_free_object(mem, (void *)plfont->char_glyphs.table, cname);
+ gs_free_object(mem, (void *)plfont->glyphs.table, cname);
+ if ( plfont->pfont ) { /* might be only partially constructed */
gs_purge_font_from_char_caches_completely(plfont->pfont);
- gs_purge_font(plfont->pfont);
- gs_free_object(mem, plfont->pfont, cname);
- }
- if ( plfont->font_file ) {
- gs_free_object(mem, plfont->font_file, cname);
- plfont->font_file = 0;
- }
- gs_free_object(mem, plf, cname);
+ gs_purge_font(plfont->pfont);
+ gs_free_object(mem, plfont->pfont, cname);
+ }
+ if ( plfont->font_file ) {
+ gs_free_object(mem, plfont->font_file, cname);
+ plfont->font_file = 0;
+ }
+ gs_free_object(mem, plf, cname);
}
/* ---------------- Library callbacks ---------------- */
@@ -342,7 +342,7 @@ extern ulong tt_find_table(gs_font_type42 *pfont, const char *tname, uint *plen)
static int
pl_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr)
-{
+{
uint table_length;
ulong table_offset;
/* guess if the font type is not truetype */
@@ -353,11 +353,11 @@ pl_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr)
pstr->size = strlen(pstr->data);
return 0;
} else {
- dprintf1("glyph index %lx out of range\n", (ulong)glyph);
- return -1;
+ dprintf1("glyph index %lx out of range\n", (ulong)glyph);
+ return -1;
}
}
-
+
table_offset = tt_find_table((gs_font_type42 *)pfont, "post", &table_length);
/* no post table */
if ( table_offset == 0 )
@@ -365,13 +365,13 @@ pl_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr)
/* this shoudn't happen but... */
if ( table_length == 0 )
return -1;
-
+
{
ulong format;
uint numGlyphs;
uint glyph_name_index;
const byte *postp; /* post table pointer */
-
+
((gs_font_type42 *)pfont)->data.string_proc((gs_font_type42 *)pfont,
table_offset, table_length, &postp);
format = u32(postp);
@@ -395,7 +395,7 @@ pl_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr)
return -1;
/* mac easy */
if ( glyph_name_index < 258 ) {
-
+
pstr->data = pl_mac_names[glyph_name_index];
pstr->size = strlen(pstr->data);
return 0;
@@ -403,7 +403,7 @@ pl_glyph_name(gs_font *pfont, gs_glyph glyph, gs_const_string *pstr)
} else {
char *mydata;
/* and here's the tricky part */
- const byte *pascal_stringp =
+ const byte *pascal_stringp =
postp + 34 + (numGlyphs * 2);
/* 0 - 257 lives in the mac table above */
glyph_name_index -= 258;
@@ -441,7 +441,7 @@ extern gs_char last_char;
/* Get the unicode valude for a glyph */
static gs_char
pl_decode_glyph(gs_font *font, gs_glyph glyph, int ch)
-{
+{
return last_char;
}
@@ -463,26 +463,26 @@ int pl_font_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_cod
pl_font_t *
pl_alloc_font(gs_memory_t *mem, client_name_t cname)
{ pl_font_t *plfont =
- gs_alloc_struct(mem, pl_font_t, &st_pl_font, cname);
+ gs_alloc_struct(mem, pl_font_t, &st_pl_font, cname);
- if ( plfont )
- { /* Initialize pointers. */
- plfont->pfont = 0;
- plfont->header = 0;
- plfont->glyphs.table = 0;
- plfont->char_glyphs.table = 0;
- /* Initialize other defaults. */
- plfont->orient = 0;
+ if ( plfont )
+ { /* Initialize pointers. */
+ plfont->pfont = 0;
+ plfont->header = 0;
+ plfont->glyphs.table = 0;
+ plfont->char_glyphs.table = 0;
+ /* Initialize other defaults. */
+ plfont->orient = 0;
plfont->allow_vertical_substitutes = false;
- plfont->bold_fraction = 0;
- plfont->font_file = 0;
- plfont->resolution.x = plfont->resolution.y = 0;
- plfont->params.proportional_spacing = true;
- memset(plfont->character_complement, 0xff, 8);
- plfont->offsets.GC = plfont->offsets.GT = plfont->offsets.VT = -1;
- plfont->pts_per_inch = 72.0; /* normal value */
- }
- return plfont;
+ plfont->bold_fraction = 0;
+ plfont->font_file = 0;
+ plfont->resolution.x = plfont->resolution.y = 0;
+ plfont->params.proportional_spacing = true;
+ memset(plfont->character_complement, 0xff, 8);
+ plfont->offsets.GC = plfont->offsets.GT = plfont->offsets.VT = -1;
+ plfont->pts_per_inch = 72.0; /* normal value */
+ }
+ return plfont;
}
/* import from plchar.c - used to determine if this is a downloaded
true type font or a resident font - yuck. */
@@ -498,251 +498,251 @@ gs_private_st_element(st_pl_font_glyph_element_f, pl_font_glyph_t,
pl_font_t *
pl_clone_font(const pl_font_t *src, gs_memory_t *mem, client_name_t cname)
{
- pl_font_t *plfont =
- gs_alloc_struct(mem, pl_font_t, &st_pl_font, cname);
- if ( plfont == 0 )
- return 0;
- /* copy technology common parts */
- plfont->storage = src->storage;
- plfont->header_size = src->header_size;
- plfont->scaling_technology = src->scaling_technology;
+ pl_font_t *plfont =
+ gs_alloc_struct(mem, pl_font_t, &st_pl_font, cname);
+ if ( plfont == 0 )
+ return 0;
+ /* copy technology common parts */
+ plfont->storage = src->storage;
+ plfont->header_size = src->header_size;
+ plfont->scaling_technology = src->scaling_technology;
plfont->is_xl_format = src->is_xl_format;
plfont->allow_vertical_substitutes = src->allow_vertical_substitutes;
- plfont->font_type = src->font_type;
- plfont->char_width = src->char_width;
- plfont->char_metrics = src->char_metrics;
- plfont->large_sizes = src->large_sizes;
- plfont->resolution = src->resolution;
- plfont->params = src->params;
+ plfont->font_type = src->font_type;
+ plfont->char_width = src->char_width;
+ plfont->char_metrics = src->char_metrics;
+ plfont->large_sizes = src->large_sizes;
+ plfont->resolution = src->resolution;
+ plfont->params = src->params;
plfont->pts_per_inch = src->pts_per_inch;
- plfont->font_file_loaded = src->font_file_loaded;
- plfont->orient = src->orient;
- plfont->bold_fraction = src->bold_fraction;
- {
- int i;
- for (i = 0; i < sizeof(src->character_complement); i++ )
- plfont->character_complement[i] = src->character_complement[i];
- }
- plfont->offsets = src->offsets;
- plfont->header = gs_alloc_bytes(mem, src->header_size, cname);
- if ( plfont->header == 0 )
- return 0;
- memcpy(plfont->header, src->header, src->header_size);
-
- if ( src->font_file ) {
- plfont->font_file = gs_alloc_bytes(mem, strlen(src->font_file) + 1,
- "pl_clone_font");
- if ( plfont->font_file == 0 )
- return 0; /* #NB errors!!! */
- strcpy(plfont->font_file, src->font_file);
- }
- else
- plfont->font_file = 0;
- /* technology specific setup */
- switch ( plfont->scaling_technology )
- {
- case plfst_bitmap:
- {
- gs_font_base *pfont =
- gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, cname);
- if ( pfont == 0 )
- return 0;
- pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
- pl_fill_in_bitmap_font(pfont, gs_next_ids(mem, 1));
- break;
- }
- case plfst_Intellifont:
- {
- gs_font_base *pfont =
- gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, cname);
- if ( pfont == 0 )
- return 0;
- pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
- pl_fill_in_intelli_font(pfont, gs_next_ids(mem, 1));
- break;
- }
- case plfst_TrueType:
- {
- {
- gs_font_type42 *pfont =
- gs_alloc_struct(mem, gs_font_type42, &st_gs_font_type42, cname);
- /* detect if a truetype font is downloaded or
+ plfont->font_file_loaded = src->font_file_loaded;
+ plfont->orient = src->orient;
+ plfont->bold_fraction = src->bold_fraction;
+ {
+ int i;
+ for (i = 0; i < sizeof(src->character_complement); i++ )
+ plfont->character_complement[i] = src->character_complement[i];
+ }
+ plfont->offsets = src->offsets;
+ plfont->header = gs_alloc_bytes(mem, src->header_size, cname);
+ if ( plfont->header == 0 )
+ return 0;
+ memcpy(plfont->header, src->header, src->header_size);
+
+ if ( src->font_file ) {
+ plfont->font_file = gs_alloc_bytes(mem, strlen(src->font_file) + 1,
+ "pl_clone_font");
+ if ( plfont->font_file == 0 )
+ return 0; /* #NB errors!!! */
+ strcpy(plfont->font_file, src->font_file);
+ }
+ else
+ plfont->font_file = 0;
+ /* technology specific setup */
+ switch ( plfont->scaling_technology )
+ {
+ case plfst_bitmap:
+ {
+ gs_font_base *pfont =
+ gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, cname);
+ if ( pfont == 0 )
+ return 0;
+ pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
+ pl_fill_in_bitmap_font(pfont, gs_next_ids(mem, 1));
+ break;
+ }
+ case plfst_Intellifont:
+ {
+ gs_font_base *pfont =
+ gs_alloc_struct(mem, gs_font_base, &st_gs_font_base, cname);
+ if ( pfont == 0 )
+ return 0;
+ pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
+ pl_fill_in_intelli_font(pfont, gs_next_ids(mem, 1));
+ break;
+ }
+ case plfst_TrueType:
+ {
+ {
+ gs_font_type42 *pfont =
+ gs_alloc_struct(mem, gs_font_type42, &st_gs_font_type42, cname);
+ /* detect if a truetype font is downloaded or
internal. There must be a better way... */
- gs_font_type42 *pfont_src = (gs_font_type42 *)src->pfont;
- bool downloaded = (pfont_src->data.get_outline == pl_tt_get_outline);
- if ( pfont == 0 )
- return 0;
- pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
- pl_fill_in_tt_font(pfont, downloaded ? NULL : src->header, gs_next_ids(mem, 1));
- }
- break;
- }
+ gs_font_type42 *pfont_src = (gs_font_type42 *)src->pfont;
+ bool downloaded = (pfont_src->data.get_outline == pl_tt_get_outline);
+ if ( pfont == 0 )
+ return 0;
+ pl_fill_in_font((gs_font *)pfont, plfont, src->pfont->dir, mem, "nameless_font");
+ pl_fill_in_tt_font(pfont, downloaded ? NULL : src->header, gs_next_ids(mem, 1));
+ }
+ break;
+ }
default:
return 0;
- }
- if ( src->char_glyphs.table != 0 )
- {
- /* HAS may gs_alloc_struct_array() here but this is
- consistant with pl_tt_alloc_char_glyphs() */
- pl_tt_char_glyph_t *char_glyphs =
- (pl_tt_char_glyph_t *) gs_alloc_byte_array(mem,
- src->char_glyphs.size,
- sizeof(pl_tt_char_glyph_t), cname);
- int i;
- if ( char_glyphs == 0 )
- return 0;
- for ( i = 0; i < src->char_glyphs.size; i++ )
- char_glyphs[i] = src->char_glyphs.table[i];
- /* once again a copy struct shortcut and then are restore
+ }
+ if ( src->char_glyphs.table != 0 )
+ {
+ /* HAS may gs_alloc_struct_array() here but this is
+ consistant with pl_tt_alloc_char_glyphs() */
+ pl_tt_char_glyph_t *char_glyphs =
+ (pl_tt_char_glyph_t *) gs_alloc_byte_array(mem,
+ src->char_glyphs.size,
+ sizeof(pl_tt_char_glyph_t), cname);
+ int i;
+ if ( char_glyphs == 0 )
+ return 0;
+ for ( i = 0; i < src->char_glyphs.size; i++ )
+ char_glyphs[i] = src->char_glyphs.table[i];
+ /* once again a copy struct shortcut and then are restore
of the char_glyphs.table pointer */
- plfont->char_glyphs = src->char_glyphs;
- plfont->char_glyphs.table = char_glyphs;
- }
- else /* no character glyph table data */
- plfont->char_glyphs = src->char_glyphs;
+ plfont->char_glyphs = src->char_glyphs;
+ plfont->char_glyphs.table = char_glyphs;
+ }
+ else /* no character glyph table data */
+ plfont->char_glyphs = src->char_glyphs;
- if ( src->glyphs.table != 0 )
- {
- int i;
- plfont->glyphs.table =
- gs_alloc_struct_array(mem, src->glyphs.size, pl_font_glyph_t,
- &st_pl_font_glyph_element_f, cname);
- plfont->glyphs.used = src->glyphs.used;
- plfont->glyphs.limit = src->glyphs.limit;
- plfont->glyphs.size = src->glyphs.size;
- plfont->glyphs.skip = src->glyphs.skip;
- for ( i = 0; i < src->glyphs.size; i++ )
- {
- const byte *data = src->glyphs.table[i].data;
- byte *char_data;
- plfont->glyphs.table[i].glyph =
- src->glyphs.table[i].glyph;
- plfont->glyphs.table[i].data = 0;
- if ( data )
- { /* ARGH --- */
- uint size;
- if ( plfont->scaling_technology == plfst_bitmap )
- {
- size = 16 +
- ((pl_get_uint16(data + 10) + 7) >> 3) *
- pl_get_uint16(data + 12);
- }
- else if ( plfont->scaling_technology == plfst_Intellifont ) {
- /* non compound characters */
- if ( data[3] == 3 )
- size = 6 + pl_get_uint16(data + 4);
- else /* assume data[3] == 4 (compound) */
- size = 8 + data[6] * 6 + 2;
- }
- else /* truetype */
- size = 2 + 2 + data[2] +
- pl_get_uint16(data + 2 + data[2]);
- char_data = gs_alloc_bytes(mem, size, cname);
- if ( char_data == 0 )
- return 0;
- memcpy(char_data, data, size);
- plfont->glyphs.table[i].data = char_data;
- }
+ if ( src->glyphs.table != 0 )
+ {
+ int i;
+ plfont->glyphs.table =
+ gs_alloc_struct_array(mem, src->glyphs.size, pl_font_glyph_t,
+ &st_pl_font_glyph_element_f, cname);
+ plfont->glyphs.used = src->glyphs.used;
+ plfont->glyphs.limit = src->glyphs.limit;
+ plfont->glyphs.size = src->glyphs.size;
+ plfont->glyphs.skip = src->glyphs.skip;
+ for ( i = 0; i < src->glyphs.size; i++ )
+ {
+ const byte *data = src->glyphs.table[i].data;
+ byte *char_data;
+ plfont->glyphs.table[i].glyph =
+ src->glyphs.table[i].glyph;
+ plfont->glyphs.table[i].data = 0;
+ if ( data )
+ { /* ARGH --- */
+ uint size;
+ if ( plfont->scaling_technology == plfst_bitmap )
+ {
+ size = 16 +
+ ((pl_get_uint16(data + 10) + 7) >> 3) *
+ pl_get_uint16(data + 12);
+ }
+ else if ( plfont->scaling_technology == plfst_Intellifont ) {
+ /* non compound characters */
+ if ( data[3] == 3 )
+ size = 6 + pl_get_uint16(data + 4);
+ else /* assume data[3] == 4 (compound) */
+ size = 8 + data[6] * 6 + 2;
+ }
+ else /* truetype */
+ size = 2 + 2 + data[2] +
+ pl_get_uint16(data + 2 + data[2]);
+ char_data = gs_alloc_bytes(mem, size, cname);
+ if ( char_data == 0 )
+ return 0;
+ memcpy(char_data, data, size);
+ plfont->glyphs.table[i].data = char_data;
+ }
- }
- }
- else /* no glyph table */
- plfont->glyphs = src->glyphs;
- return plfont;
+ }
+ }
+ else /* no glyph table */
+ plfont->glyphs = src->glyphs;
+ return plfont;
}
-
+
/* Fill in generic font boilerplate. NB TODO examine duplication with
gs_font_alloc() */
int
pl_fill_in_font(gs_font *pfont, pl_font_t *plfont, gs_font_dir *pdir, gs_memory_t *mem, const char *font_name)
-{
+{
int i;
- plfont->pfont = pfont;
- /* Initialize generic font data. */
+ plfont->pfont = pfont;
+ /* Initialize generic font data. */
gs_make_identity(&pfont->orig_FontMatrix);
- pfont->next = pfont->prev = 0;
- pfont->memory = mem;
- pfont->dir = pdir;
- pfont->is_resource = false;
- gs_notify_init(&pfont->notify_list, gs_memory_stable(mem));
- pfont->base = pfont;
- pfont->client_data = plfont;
- pfont->WMode = 0;
- pfont->PaintType = 0;
- pfont->StrokeWidth = 0;
+ pfont->next = pfont->prev = 0;
+ pfont->memory = mem;
+ pfont->dir = pdir;
+ pfont->is_resource = false;
+ gs_notify_init(&pfont->notify_list, gs_memory_stable(mem));
+ pfont->base = pfont;
+ pfont->client_data = plfont;
+ pfont->WMode = 0;
+ pfont->PaintType = 0;
+ pfont->StrokeWidth = 0;
pfont->is_cached = 0;
- pfont->procs.init_fstack = gs_default_init_fstack;
- pfont->procs.next_char_glyph = gs_default_next_char_glyph;
+ pfont->procs.init_fstack = gs_default_init_fstack;
+ pfont->procs.next_char_glyph = gs_default_next_char_glyph;
- pfont->procs.glyph_name = pl_glyph_name;
- pfont->procs.decode_glyph = pl_decode_glyph;
- /* NB pfont->procs.callbacks.known_encode = pl_known_encode; */
- pfont->procs.define_font = gs_no_define_font;
- pfont->procs.make_font = gs_no_make_font;
- pfont->procs.font_info = gs_default_font_info;
+ pfont->procs.glyph_name = pl_glyph_name;
+ pfont->procs.decode_glyph = pl_decode_glyph;
+ /* NB pfont->procs.callbacks.known_encode = pl_known_encode; */
+ pfont->procs.define_font = gs_no_define_font;
+ pfont->procs.make_font = gs_no_make_font;
+ pfont->procs.font_info = gs_default_font_info;
pfont->procs.glyph_info = gs_default_glyph_info;
pfont->procs.glyph_outline = gs_no_glyph_outline;
- pfont->id = gs_next_ids(mem, 1);
- pfont->font_name.size = strlen(font_name);
- strncpy(pfont->font_name.chars, font_name, pfont->font_name.size);
- /* replace spaces with '-', seems acrobat doesn't like spaces. */
- for (i = 0; i < pfont->font_name.size; i++) {
- if (pfont->font_name.chars[i] == ' ')
- pfont->font_name.chars[i] = '-';
- }
- strncpy(pfont->key_name.chars, font_name, sizeof(pfont->font_name.chars));
- pfont->key_name.size = strlen(font_name);
- return 0;
+ pfont->id = gs_next_ids(mem, 1);
+ pfont->font_name.size = strlen(font_name);
+ strncpy(pfont->font_name.chars, font_name, pfont->font_name.size);
+ /* replace spaces with '-', seems acrobat doesn't like spaces. */
+ for (i = 0; i < pfont->font_name.size; i++) {
+ if (pfont->font_name.chars[i] == ' ')
+ pfont->font_name.chars[i] = '-';
+ }
+ strncpy(pfont->key_name.chars, font_name, sizeof(pfont->font_name.chars));
+ pfont->key_name.size = strlen(font_name);
+ return 0;
}
/* Fill in bitmap font boilerplate. */
void
pl_fill_in_bitmap_font(gs_font_base *pfont, long unique_id)
{ pfont->FontType = ft_user_defined;
- pfont->BitmapWidths = true;
- pfont->ExactSize = fbit_use_bitmaps;
- pfont->InBetweenSize = fbit_use_bitmaps;
- pfont->TransformedChar = fbit_transform_bitmaps;
- pl_bitmap_init_procs(pfont);
- /* We have no idea what the FontBBox should be. */
- pfont->FontBBox.p.x = pfont->FontBBox.p.y =
- pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
- uid_set_UniqueID(&pfont->UID, unique_id);
- pfont->encoding_index = 1; /****** WRONG ******/
- pfont->nearest_encoding_index = 1; /****** WRONG ******/
+ pfont->BitmapWidths = true;
+ pfont->ExactSize = fbit_use_bitmaps;
+ pfont->InBetweenSize = fbit_use_bitmaps;
+ pfont->TransformedChar = fbit_transform_bitmaps;
+ pl_bitmap_init_procs(pfont);
+ /* We have no idea what the FontBBox should be. */
+ pfont->FontBBox.p.x = pfont->FontBBox.p.y =
+ pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
+ uid_set_UniqueID(&pfont->UID, unique_id);
+ pfont->encoding_index = 1; /****** WRONG ******/
+ pfont->nearest_encoding_index = 1; /****** WRONG ******/
}
/* Fill in TrueType font boilerplate. */
int
pl_fill_in_tt_font(gs_font_type42 *pfont, void *data, long unique_id)
{ pfont->FontType = ft_TrueType;
- pfont->BitmapWidths = true;
- pfont->ExactSize = fbit_use_outlines;
- pfont->InBetweenSize = fbit_use_outlines;
- pfont->TransformedChar = fbit_use_outlines;
- /* Initialize base font data. */
- /*
- * We can't set the FontBBox correctly until we've initialized the
- * Type 42 specific data, but we need to set it to an empty box now
- * for the sake of gs_type42_font_init.
- */
- pfont->FontBBox.p.x = pfont->FontBBox.p.y =
- pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
- uid_set_UniqueID(&pfont->UID, unique_id);
- pfont->encoding_index = 1; /****** WRONG ******/
- pfont->nearest_encoding_index = 1; /****** WRONG ******/
- /* Initialize Type 42 specific data. */
- pfont->data.proc_data = data;
- pl_tt_init_procs(pfont);
+ pfont->BitmapWidths = true;
+ pfont->ExactSize = fbit_use_outlines;
+ pfont->InBetweenSize = fbit_use_outlines;
+ pfont->TransformedChar = fbit_use_outlines;
+ /* Initialize base font data. */
+ /*
+ * We can't set the FontBBox correctly until we've initialized the
+ * Type 42 specific data, but we need to set it to an empty box now
+ * for the sake of gs_type42_font_init.
+ */
+ pfont->FontBBox.p.x = pfont->FontBBox.p.y =
+ pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
+ uid_set_UniqueID(&pfont->UID, unique_id);
+ pfont->encoding_index = 1; /****** WRONG ******/
+ pfont->nearest_encoding_index = 1; /****** WRONG ******/
+ /* Initialize Type 42 specific data. */
+ pfont->data.proc_data = data;
+ pl_tt_init_procs(pfont);
{
int code = gs_type42_font_init(pfont, 0);
if (code < 0)
return code;
}
- /* disable unused FAPI */
- pfont->FAPI = 0;
- pfont->FAPI_font_data = 0;
- pl_tt_finish_init(pfont, !data);
+ /* disable unused FAPI */
+ pfont->FAPI = 0;
+ pfont->FAPI_font_data = 0;
+ pl_tt_finish_init(pfont, !data);
return 0;
}
@@ -750,22 +750,22 @@ pl_fill_in_tt_font(gs_font_type42 *pfont, void *data, long unique_id)
void
pl_fill_in_intelli_font(gs_font_base *pfont, long unique_id)
{ /* Intellifonts have an 8782-unit design space. */
- { gs_matrix mat;
- gs_make_scaling(1.0/8782, 1.0/8782, &mat);
- gs_matrix_translate(&mat, -2980.0, -5380.0, &pfont->orig_FontMatrix);
- }
- pfont->FontType = ft_MicroType;
- pfont->BitmapWidths = true;
- pfont->ExactSize = fbit_use_outlines;
- pfont->InBetweenSize = fbit_use_outlines;
- pfont->TransformedChar = fbit_use_outlines;
- /* We have no idea what the FontBBox should be. */
- pfont->FontBBox.p.x = pfont->FontBBox.p.y =
- pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
- uid_set_UniqueID(&pfont->UID, unique_id);
- pfont->encoding_index = 1; /****** WRONG ******/
- pfont->nearest_encoding_index = 1; /****** WRONG ******/
- pl_intelli_init_procs(pfont);
+ { gs_matrix mat;
+ gs_make_scaling(1.0/8782, 1.0/8782, &mat);
+ gs_matrix_translate(&mat, -2980.0, -5380.0, &pfont->orig_FontMatrix);
+ }
+ pfont->FontType = ft_MicroType;
+ pfont->BitmapWidths = true;
+ pfont->ExactSize = fbit_use_outlines;
+ pfont->InBetweenSize = fbit_use_outlines;
+ pfont->TransformedChar = fbit_use_outlines;
+ /* We have no idea what the FontBBox should be. */
+ pfont->FontBBox.p.x = pfont->FontBBox.p.y =
+ pfont->FontBBox.q.x = pfont->FontBBox.q.y = 0;
+ uid_set_UniqueID(&pfont->UID, unique_id);
+ pfont->encoding_index = 1; /****** WRONG ******/
+ pfont->nearest_encoding_index = 1; /****** WRONG ******/
+ pl_intelli_init_procs(pfont);
}
/*
@@ -779,139 +779,139 @@ pl_fill_in_intelli_font(gs_font_base *pfont, long unique_id)
*/
int
pl_font_scan_segments(const gs_memory_t *mem,
- pl_font_t *plfont, int fst_offset, int start_offset,
+ pl_font_t *plfont, int fst_offset, int start_offset,
long end_offset, bool large_sizes, const pl_font_offset_errors_t *pfoe)
{ const byte *header = plfont->header;
- pl_font_scaling_technology_t fst = header[fst_offset];
- int wsize = (large_sizes ? 4 : 2);
- const byte *segment = header + start_offset;
- const byte *end = header + end_offset;
- const byte *null_segment = end - (2 + wsize);
- bool found = false;
- ulong seg_size;
- int illegal_font_data = pfoe->illegal_font_data;
+ pl_font_scaling_technology_t fst = header[fst_offset];
+ int wsize = (large_sizes ? 4 : 2);
+ const byte *segment = header + start_offset;
+ const byte *end = header + end_offset;
+ const byte *null_segment = end - (2 + wsize);
+ bool found = false;
+ ulong seg_size;
+ int illegal_font_data = pfoe->illegal_font_data;
#define return_scan_error(err)\
return_error((err) ? (err) : illegal_font_data);
- if ( memcmp(null_segment, "\377\377", 2) /* NULL segment header */ )
- return_scan_error(pfoe->missing_required_segment);
- if ( memcmp(null_segment + 2, "\0\0\0\0", wsize) /* NULL segment size */ )
- return_scan_error(pfoe->illegal_null_segment_size);
- switch ( fst )
- {
- case plfst_bitmap:
- case plfst_TrueType:
- break;
- default:
- return_scan_error(pfoe->illegal_font_header_fields);
- }
- if ( header[fst_offset + 1] ) /* variety, must be 0 */
- return_scan_error(pfoe->illegal_font_header_fields);
- /* Scan the segments. */
- for ( ; end - segment >= 2 + wsize; segment += 2 + wsize + seg_size )
- { uint seg_id = u16(segment);
- const byte *sdata = segment + 2 + wsize;
+ if ( memcmp(null_segment, "\377\377", 2) /* NULL segment header */ )
+ return_scan_error(pfoe->missing_required_segment);
+ if ( memcmp(null_segment + 2, "\0\0\0\0", wsize) /* NULL segment size */ )
+ return_scan_error(pfoe->illegal_null_segment_size);
+ switch ( fst )
+ {
+ case plfst_bitmap:
+ case plfst_TrueType:
+ break;
+ default:
+ return_scan_error(pfoe->illegal_font_header_fields);
+ }
+ if ( header[fst_offset + 1] ) /* variety, must be 0 */
+ return_scan_error(pfoe->illegal_font_header_fields);
+ /* Scan the segments. */
+ for ( ; end - segment >= 2 + wsize; segment += 2 + wsize + seg_size )
+ { uint seg_id = u16(segment);
+ const byte *sdata = segment + 2 + wsize;
#define id2(c1,c2) (((uint)(c1) << 8) + (c2))
- seg_size = (large_sizes ? u32(segment + 2) : u16(segment + 2));
- if ( seg_size + 2 + wsize > end - segment )
- return_error(illegal_font_data);
- /* Handle segments common to all fonts. */
- switch ( seg_id )
- {
- case 0xffff: /* NULL segment ID */
- if ( segment != null_segment )
- return_error(illegal_font_data);
- continue;
- case id2('V','I'):
- continue;
- case id2('C', 'C'):
- if ( seg_size != 8 )
- return_error(illegal_font_data);
- memcpy(plfont->character_complement, sdata, 8);
- continue;
- default:
- ;
- }
- /* Handle segments specific to the scaling technology. */
- if ( fst == plfst_bitmap )
- switch ( seg_id )
- {
- case id2('B','R'):
- if ( seg_size != 4 )
- return_scan_error(pfoe->illegal_BR_segment);
- { uint xres = pl_get_uint16(sdata);
- uint yres = pl_get_uint16(sdata + 2);
- if ( xres == 0 || yres == 0 )
- return_scan_error(pfoe->illegal_BR_segment);
- plfont->resolution.x = xres;
- plfont->resolution.y = yres;
- }
- found = true;
- break;
- default:
- if ( pfoe->illegal_font_segment < 0 )
- return_error(pfoe->illegal_font_segment);
- }
- else /* fst == plfst_TrueType */
- switch ( seg_id )
- {
- case id2('G','T'):
- /*
- * We don't do much checking here, but we do check that
- * the segment starts with a table directory that
- * includes at least 3 elements (gdir, head,
- * maxp -- but we don't check the actual names).
- */
- if ( seg_size < 12 + 5 * 16 ||
- /* memcmp(sdata, "\000\001\000\000", 4) || */
- u16(sdata + 4) < 3
- )
- return_scan_error(pfoe->illegal_GT_segment);
- plfont->offsets.GT = segment - header;
- found = true;
- break;
- case id2('G','C'):
- if ( seg_size < 6 || u16(sdata) != 0 ||
- seg_size != u16(sdata + 4) * 6 + 6
- )
- return_scan_error(pfoe->illegal_GC_segment);
- plfont->offsets.GC = segment - header;
- break;
- case id2('V','T'):
- /* Check for end of table mark */
- if ( (seg_size & 3) != 0 || seg_size < 4 ||
- u16(sdata + seg_size - 4) != 0xffff
- )
- return_scan_error(pfoe->illegal_VT_segment);
- /* Check for table sorted by horizontal glyph ID */
- { uint i;
- for ( i = 0; i < seg_size - 4; i += 4 )
- if ( u16(sdata + i) > u16(sdata + i + 4) )
- return_scan_error(pfoe->illegal_VT_segment);
- }
- plfont->offsets.VT = segment - header;
- break;
+ seg_size = (large_sizes ? u32(segment + 2) : u16(segment + 2));
+ if ( seg_size + 2 + wsize > end - segment )
+ return_error(illegal_font_data);
+ /* Handle segments common to all fonts. */
+ switch ( seg_id )
+ {
+ case 0xffff: /* NULL segment ID */
+ if ( segment != null_segment )
+ return_error(illegal_font_data);
+ continue;
+ case id2('V','I'):
+ continue;
+ case id2('C', 'C'):
+ if ( seg_size != 8 )
+ return_error(illegal_font_data);
+ memcpy(plfont->character_complement, sdata, 8);
+ continue;
+ default:
+ ;
+ }
+ /* Handle segments specific to the scaling technology. */
+ if ( fst == plfst_bitmap )
+ switch ( seg_id )
+ {
+ case id2('B','R'):
+ if ( seg_size != 4 )
+ return_scan_error(pfoe->illegal_BR_segment);
+ { uint xres = pl_get_uint16(sdata);
+ uint yres = pl_get_uint16(sdata + 2);
+ if ( xres == 0 || yres == 0 )
+ return_scan_error(pfoe->illegal_BR_segment);
+ plfont->resolution.x = xres;
+ plfont->resolution.y = yres;
+ }
+ found = true;
+ break;
+ default:
+ if ( pfoe->illegal_font_segment < 0 )
+ return_error(pfoe->illegal_font_segment);
+ }
+ else /* fst == plfst_TrueType */
+ switch ( seg_id )
+ {
+ case id2('G','T'):
+ /*
+ * We don't do much checking here, but we do check that
+ * the segment starts with a table directory that
+ * includes at least 3 elements (gdir, head,
+ * maxp -- but we don't check the actual names).
+ */
+ if ( seg_size < 12 + 5 * 16 ||
+ /* memcmp(sdata, "\000\001\000\000", 4) || */
+ u16(sdata + 4) < 3
+ )
+ return_scan_error(pfoe->illegal_GT_segment);
+ plfont->offsets.GT = segment - header;
+ found = true;
+ break;
+ case id2('G','C'):
+ if ( seg_size < 6 || u16(sdata) != 0 ||
+ seg_size != u16(sdata + 4) * 6 + 6
+ )
+ return_scan_error(pfoe->illegal_GC_segment);
+ plfont->offsets.GC = segment - header;
+ break;
+ case id2('V','T'):
+ /* Check for end of table mark */
+ if ( (seg_size & 3) != 0 || seg_size < 4 ||
+ u16(sdata + seg_size - 4) != 0xffff
+ )
+ return_scan_error(pfoe->illegal_VT_segment);
+ /* Check for table sorted by horizontal glyph ID */
+ { uint i;
+ for ( i = 0; i < seg_size - 4; i += 4 )
+ if ( u16(sdata + i) > u16(sdata + i + 4) )
+ return_scan_error(pfoe->illegal_VT_segment);
+ }
+ plfont->offsets.VT = segment - header;
+ break;
case id2('V', 'E'): /* nb unimplemented */
break;
case id2('V', 'R'): /* nb unimplemented */
break;
case id2('C', 'E'): /* nb unimplemented */
break;
- default:
- if ( pfoe->illegal_font_segment < 0 )
- return_error(pfoe->illegal_font_segment);
- }
+ default:
+ if ( pfoe->illegal_font_segment < 0 )
+ return_error(pfoe->illegal_font_segment);
+ }
#undef id2
- }
- if ( !found )
- return_scan_error(pfoe->missing_required_segment);
- if ( segment != end )
- return_error(illegal_font_data);
- plfont->large_sizes = large_sizes;
- plfont->scaling_technology = fst;
- return 0;
+ }
+ if ( !found )
+ return_scan_error(pfoe->missing_required_segment);
+ if ( segment != end )
+ return_error(illegal_font_data);
+ plfont->large_sizes = large_sizes;
+ plfont->scaling_technology = fst;
+ return 0;
#undef return_scan_error
}
@@ -922,25 +922,25 @@ pl_free_tt_fontfile_buffer(gs_memory_t *mem, byte *ptt_font_data)
return 0;
}
-int
+int
pl_alloc_tt_fontfile_buffer(stream *in, gs_memory_t *mem, byte **pptt_font_data, ulong *size)
{
ulong len = (sfseek(in, 0L, SEEK_END), sftell(in));
*size = 6 + len; /* leave room for segment header */
- if ( *size != (uint)(*size) ) {
- /*
- * The font is too big to load in a single piece -- punt.
- * The error message is bogus, but there isn't any more
- * appropriate one.
- */
- sfclose(in);
- return_error(gs_error_VMerror);
+ if ( *size != (uint)(*size) ) {
+ /*
+ * The font is too big to load in a single piece -- punt.
+ * The error message is bogus, but there isn't any more
+ * appropriate one.
+ */
+ sfclose(in);
+ return_error(gs_error_VMerror);
}
srewind(in);
*pptt_font_data = gs_alloc_bytes(mem, *size, "pl_tt_load_font data");
if ( *pptt_font_data == 0 ) {
- sfclose(in);
- return_error(gs_error_VMerror);
+ sfclose(in);
+ return_error(gs_error_VMerror);
}
sfread(*pptt_font_data + 6, 1, len, in);
sfclose(in);
@@ -951,7 +951,7 @@ pl_alloc_tt_fontfile_buffer(stream *in, gs_memory_t *mem, byte **pptt_font_data,
int
pl_load_tt_font(stream *in, gs_font_dir *pdir, gs_memory_t *mem,
long unique_id, pl_font_t **pplfont, char *font_name)
-{
+{
byte *tt_font_datap;
ulong size;
int code;
@@ -960,33 +960,33 @@ pl_load_tt_font(stream *in, gs_font_dir *pdir, gs_memory_t *mem,
/* get the data from the file */
code = pl_alloc_tt_fontfile_buffer(in, mem, &tt_font_datap, &size);
if ( code < 0 )
- return_error(gs_error_VMerror);
+ return_error(gs_error_VMerror);
/* Make a Type 42 font out of the TrueType data. */
pfont = gs_alloc_struct(mem, gs_font_type42, &st_gs_font_type42,
- "pl_tt_load_font(gs_font_type42)");
+ "pl_tt_load_font(gs_font_type42)");
plfont = pl_alloc_font(mem, "pl_tt_load_font(pl_font_t)");
if ( pfont == 0 || plfont == 0 )
- code = gs_note_error(gs_error_VMerror);
+ code = gs_note_error(gs_error_VMerror);
else { /* Initialize general font boilerplate. */
- code = pl_fill_in_font((gs_font *)pfont, plfont, pdir, mem, font_name);
- if ( code >= 0 ) { /* Initialize TrueType font boilerplate. */
- plfont->header = tt_font_datap;
- plfont->header_size = size;
- plfont->scaling_technology = plfst_TrueType;
- plfont->font_type = plft_Unicode;
- plfont->large_sizes = true;
- plfont->offsets.GT = 0;
+ code = pl_fill_in_font((gs_font *)pfont, plfont, pdir, mem, font_name);
+ if ( code >= 0 ) { /* Initialize TrueType font boilerplate. */
+ plfont->header = tt_font_datap;
+ plfont->header_size = size;
+ plfont->scaling_technology = plfst_TrueType;
+ plfont->font_type = plft_Unicode;
+ plfont->large_sizes = true;
+ plfont->offsets.GT = 0;
plfont->is_xl_format = false;
- pl_fill_in_tt_font(pfont, tt_font_datap, unique_id);
- code = gs_definefont(pdir, (gs_font *)pfont);
- }
+ pl_fill_in_tt_font(pfont, tt_font_datap, unique_id);
+ code = gs_definefont(pdir, (gs_font *)pfont);
+ }
}
- if ( code < 0 ) {
- gs_free_object(mem, plfont, "pl_tt_load_font(pl_font_t)");
- gs_free_object(mem, pfont, "pl_tt_load_font(gs_font_type42)");
- pl_free_tt_fontfile_buffer(mem, tt_font_datap);
- return code;
+ if ( code < 0 ) {
+ gs_free_object(mem, plfont, "pl_tt_load_font(pl_font_t)");
+ gs_free_object(mem, pfont, "pl_tt_load_font(gs_font_type42)");
+ pl_free_tt_fontfile_buffer(mem, tt_font_datap);
+ return code;
}
*pplfont = plfont;
return 0;
@@ -1000,33 +1000,33 @@ pl_load_resident_font_data_from_file(gs_memory_t *mem, pl_font_t *plfont)
ulong len, size;
byte *data;
if (plfont->font_file && !plfont->font_file_loaded) {
- stream *in = sfopen(plfont->font_file, gp_fmode_rb, mem);
- if ( in == NULL )
- return -1;
- /* note this is exactly the same as the code in pl_load_tt_font */
- len = (sfseek(in, 0L, SEEK_END), sftell(in));
- size = 6 + len; /* leave room for segment header */
+ stream *in = sfopen(plfont->font_file, gp_fmode_rb, mem);
+ if ( in == NULL )
+ return -1;
+ /* note this is exactly the same as the code in pl_load_tt_font */
+ len = (sfseek(in, 0L, SEEK_END), sftell(in));
+ size = 6 + len; /* leave room for segment header */
- if ( size != (uint)size ) {
- /*
- * The font is too big to load in a single piece -- punt.
- * The error message is bogus, but there isn't any more
- * appropriate one.
- */
- sfclose(in);
- return_error(gs_error_VMerror);
- }
- srewind(in);
- data = gs_alloc_bytes(mem, size, "pl_tt_load_font data");
- if ( data == 0 ) {
- sfclose(in);
- return_error(gs_error_VMerror);
- }
- sfread(data + 6, 1, len, in);
- sfclose(in);
- plfont->header = data;
- plfont->header_size = size;
- plfont->font_file_loaded = true;
+ if ( size != (uint)size ) {
+ /*
+ * The font is too big to load in a single piece -- punt.
+ * The error message is bogus, but there isn't any more
+ * appropriate one.
+ */
+ sfclose(in);
+ return_error(gs_error_VMerror);
+ }
+ srewind(in);
+ data = gs_alloc_bytes(mem, size, "pl_tt_load_font data");
+ if ( data == 0 ) {
+ sfclose(in);
+ return_error(gs_error_VMerror);
+ }
+ sfread(data + 6, 1, len, in);
+ sfclose(in);
+ plfont->header = data;
+ plfont->header_size = size;
+ plfont->font_file_loaded = true;
}
return 0;
}
@@ -1037,20 +1037,20 @@ pl_store_resident_font_data_in_file(char *font_file, gs_memory_t *mem, pl_font_t
{
/* Free the header data */
if ( plfont->header ) {
- gs_free_object(mem, plfont->header, "pl_store_resident_font_data_in_file");
- plfont->header = 0;
- plfont->header_size = 0;
+ gs_free_object(mem, plfont->header, "pl_store_resident_font_data_in_file");
+ plfont->header = 0;
+ plfont->header_size = 0;
} else {
- /* nothing to do */
- return 0;
+ /* nothing to do */
+ return 0;
}
/* we don't yet have a filename for this font object. create one
and store it in the font. */
if ( !plfont->font_file ) {
- plfont->font_file = gs_alloc_bytes(mem, strlen(font_file) + 1, "pl_store_resident_font_data_in_file");
- if ( plfont->font_file == 0 )
- return -1;
- strcpy(plfont->font_file, font_file);
+ plfont->font_file = gs_alloc_bytes(mem, strlen(font_file) + 1, "pl_store_resident_font_data_in_file");
+ if ( plfont->font_file == 0 )
+ return -1;
+ strcpy(plfont->font_file, font_file);
}
/* designate that the font data is not in RAM */
plfont->font_file_loaded = false;
diff --git a/pl/plfont.h b/pl/plfont.h
index 94933adb7..70e8387fe 100644
--- a/pl/plfont.h
+++ b/pl/plfont.h
@@ -150,13 +150,13 @@ struct pl_font_s {
int storage; /* where the font is stored */
bool data_are_permanent; /* glyph data stored in rom */
char *font_file; /* non null only if data is stored in a
- file only relevant to pcl resident
- fonts. NB this should be done
- dynamically */
+ file only relevant to pcl resident
+ fonts. NB this should be done
+ dynamically */
bool font_file_loaded; /* contents of the font file have be read into memory */
byte *header; /* downloaded header, or built-in font data */
ulong header_size;
- /* Information extracted from the font or supplied by the client. */
+ /* Information extracted from the font or supplied by the client. */
pl_font_scaling_technology_t scaling_technology;
bool is_xl_format; /* this is required for the agfa ufst scaler */
pl_font_type_t font_type;
@@ -165,7 +165,7 @@ struct pl_font_s {
int (*char_width)(const pl_font_t *plfont, const void *pgs, uint char_code, gs_point *pwidth);
int (*char_metrics)(const pl_font_t *plfont, const void *pgs, uint char_code, float metrics[4]);
bool large_sizes; /* segment sizes are 32 bits if true, 16 if false */
- /* (for segmented fonts only) */
+ /* (for segmented fonts only) */
struct { uint x, y; } resolution; /* resolution (for bitmap fonts) */
float bold_fraction; /* for PXL algorithmic bolding */
int orient; /* true if pcl bitmap font designed in landscape */
@@ -176,9 +176,9 @@ struct pl_font_s {
long GT; /* Global TrueType data (required, for TT fonts) */
long VT; /* VerTical substitution (optional) */
} offsets; /* segment offsets, -1 if segment missing */
- /* Glyph table for downloaded fonts. */
+ /* Glyph table for downloaded fonts. */
pl_glyph_table_t glyphs;
- /* Character to glyph map for downloaded TrueType fonts. */
+ /* Character to glyph map for downloaded TrueType fonts. */
pl_tt_char_glyph_table_t char_glyphs;
float pts_per_inch; /* either 72 or 72.307 (for Intellifont) */
@@ -207,7 +207,7 @@ int pl_tt_alloc_char_glyphs(pl_font_t *plfont, uint num_chars,
/* Fill in generic gs_font boilerplate. */
#ifndef gs_font_dir_DEFINED
-# define gs_font_dir_DEFINED
+# define gs_font_dir_DEFINED
typedef struct gs_font_dir_s gs_font_dir;
#endif
int pl_fill_in_font(gs_font *pfont, pl_font_t *plfont, gs_font_dir *pdir,
@@ -259,8 +259,8 @@ typedef struct pl_font_offset_errors_s {
int illegal_VT_segment;
int illegal_BR_segment;
} pl_font_offset_errors_t;
-int pl_font_scan_segments(const gs_memory_t *mem,
- pl_font_t *plfont, int fst_offset,
+int pl_font_scan_segments(const gs_memory_t *mem,
+ pl_font_t *plfont, int fst_offset,
int start_offset, long end_offset,
bool large_sizes,
const pl_font_offset_errors_t *pfoe);
@@ -273,7 +273,6 @@ int pl_load_tt_font(stream *in, gs_font_dir *pdir, gs_memory_t *mem,
int pl_alloc_tt_fontfile_buffer(stream *in, gs_memory_t *mem, byte **pptt_font_data, ulong *size);
int pl_free_tt_fontfile_buffer(gs_memory_t *mem, byte *ptt_font_data);
-
/* Add a glyph to a font. Return -1 if the table is full. */
int pl_font_add_glyph(pl_font_t *plfont, gs_glyph glyph, const byte *data);
@@ -288,7 +287,6 @@ int pl_font_char_width(const pl_font_t *plfont, const void *pgs, uint char_code,
lsb and metrics 2 = width. The same rules for character width apply */
int pl_font_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code, float metrics[4]);
-
/* Look up a glyph in a font. Return a pointer to the glyph's slot */
/* (data != 0) or where it should be added (data == 0). */
pl_font_glyph_t *pl_font_lookup_glyph(const pl_font_t *plfont,
diff --git a/pl/plftable.c b/pl/plftable.c
index f180030ba..db7737480 100644
--- a/pl/plftable.c
+++ b/pl/plftable.c
@@ -38,15 +38,14 @@
#define fontnames(agfascreenfontname, agfaname, urwname) urwname
#endif
-
const font_resident_t resident_table[] = {
#define C(b) ((byte)((b) ^ 0xff))
#define cc_alphabetic\
- { C(0), C(0), C(0), C(0), C(0xff), C(0xc0), C(0), C(plgv_Unicode) }
+ { C(0), C(0), C(0), C(0), C(0xff), C(0xc0), C(0), C(plgv_Unicode) }
#define cc_symbol\
- { C(0), C(0), C(0), C(4), C(0), C(0), C(0), C(plgv_Unicode) }
+ { C(0), C(0), C(0), C(4), C(0), C(0), C(0), C(plgv_Unicode) }
#define cc_dingbats\
- { C(0), C(0), C(0), C(1), C(0), C(0), C(0), C(plgv_Unicode) }
+ { C(0), C(0), C(0), C(1), C(0), C(0), C(0), C(plgv_Unicode) }
/*
* Per TRM 23-87, PCL5 printers are supposed to have Univers
* and CG Times fonts. Substitute Arial for Univers and
@@ -56,7 +55,7 @@ const font_resident_t resident_table[] = {
#define agfa (4096)
/* definition for style word as defined on 11-19 PCLTRM */
#define style_word(posture, width, structure) \
- ((posture) + (4 * (width)) + (32 * (structure)))
+ ((posture) + (4 * (width)) + (32 * (structure)))
#define REGULAR (style_word(0, 0, 0))
#define ITALIC (style_word(1, 0, 0))
#define CONDENSEDITALIC (style_word(1, 1, 0))
@@ -146,21 +145,21 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("UniversMedium", "Univers-Medium", "U001-Reg"),
+ fontnames("UniversMedium", "Univers-Medium", "U001-Reg"),
{'U','n','i','v','e','r','s',' ',' ',' ',' ',' ',' ',' ','M','d'},
{0, 1, {332.0, 720000.0/332.0}, 0, REGULAR, NOBOLD, 4148, 11},
cc_alphabetic, plft_Unicode
},
{
- fontnames("UniversBold", "Univers-Bold", "U001-Bol"),
+ fontnames("UniversBold", "Univers-Bold", "U001-Bol"),
{'U','n','i','v','e','r','s',' ',' ',' ',' ',' ',' ',' ','B','d'},
{0, 1, {332.0, 720000.0/332.0}, 0, REGULAR, BOLD, 4148, 12},
cc_alphabetic, plft_Unicode
},
{
- fontnames("UniversMediumItalic", "Univers-MediumItalic", "U001-Ita"),
+ fontnames("UniversMediumItalic", "Univers-MediumItalic", "U001-Ita"),
{'U','n','i','v','e','r','s',' ',' ',' ',' ',' ','M','d','I','t'},
{0, 1, {332.0, 720000.0/332.0}, 0, ITALIC, NOBOLD, 4148, 13},
cc_alphabetic, plft_Unicode
@@ -172,9 +171,9 @@ const font_resident_t resident_table[] = {
{0, 1, {332.0, 720000.0/332.0}, 0, ITALIC, BOLD, 4148, 14},
cc_alphabetic, plft_Unicode
},
-
+
{
- fontnames("UniversCondensedMedium", "Univers-Condensed-Medium", "U001Con-Reg"),
+ fontnames("UniversCondensedMedium", "Univers-Condensed-Medium", "U001Con-Reg"),
{'U','n','i','v','e','r','s',' ',' ',' ',' ',' ','C','d','M','d'},
{0, 1, {221.0, 720000.0/221.0}, 0, CONDENSED, NOBOLD, 4148, 15},
cc_alphabetic, plft_Unicode
@@ -188,33 +187,33 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("UniversCondensedMediumItalic", "Univers-Condensed-MediumItalic", "U001Con-Ita"),
+ fontnames("UniversCondensedMediumItalic", "Univers-Condensed-MediumItalic", "U001Con-Ita"),
{'U','n','i','v','e','r','s',' ',' ',' ','C','d','M','d','I','t'},
{0, 1, {221.0, 720000.0/221.0}, 0, CONDENSEDITALIC, NOBOLD, 4148, 17},
cc_alphabetic, plft_Unicode
},
-
+
{
- fontnames("UniversCondensedBoldItalic", "Univers-Condensed-BoldItalic", "U001Con-BolIta"),
+ fontnames("UniversCondensedBoldItalic", "Univers-Condensed-BoldItalic", "U001Con-BolIta"),
{'U','n','i','v','e','r','s',' ',' ',' ','C','d','B','d','I','t'},
{0, 1, {221.0, 720000.0/221.0}, 0, CONDENSEDITALIC, BOLD, 4148, 18},
cc_alphabetic, plft_Unicode
},
{
- fontnames("AntiqueOlive", "AntiqueOlive", "AntiqueOlive-Reg"),
+ fontnames("AntiqueOlive", "AntiqueOlive", "AntiqueOlive-Reg"),
{'A','n','t','i','q','O','l','i','v','e',' ',' ',' ',' ',' ',' '},
{0, 1, {295.0, 720000.0/295.0}, 0, REGULAR, NOBOLD, 4168, 19},
cc_alphabetic, plft_Unicode
},
{
- fontnames("AntiqueOliveBold", "AntiqueOlive-Bold", "AntiqueOlive-Bol"),
+ fontnames("AntiqueOliveBold", "AntiqueOlive-Bold", "AntiqueOlive-Bol"),
{'A','n','t','i','q','O','l','i','v','e',' ',' ',' ',' ','B','d'},
{0, 1, {332.0, 720000.0/332.0}, 0, REGULAR, BOLD, 4168, 20},
cc_alphabetic, plft_Unicode
},
-
+
{
fontnames("AntiqueOliveItalic", "AntiqueOlive-Italic", "AntiqueOlive-Ita"),
{'A','n','t','i','q','O','l','i','v','e',' ',' ',' ',' ','I','t'},
@@ -223,7 +222,7 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("GaramondAntiqua", "Garamond-Antiqua", "GaramondNo8-Reg"),
+ fontnames("GaramondAntiqua", "Garamond-Antiqua", "GaramondNo8-Reg"),
{'G','a','r','a','m','o','n','d',' ','A','n','t','i','q','u','a'},
{0, 1, {258.0, 720000.0/258.0}, 0, REGULAR, NOBOLD, 4197, 22},
cc_alphabetic, plft_Unicode
@@ -244,49 +243,49 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("GaramondKursivHalbfett", "Garamond-KursivHalbfett", "GaramondNo8-MedIta"),
+ fontnames("GaramondKursivHalbfett", "Garamond-KursivHalbfett", "GaramondNo8-MedIta"),
{'G','a','r','a','m','o','n','d',' ','K','r','s','v','H','l','b'},
{0, 1, {258.0, 720000.0/258.0}, 0, ITALIC, BOLD, 4197, 25},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Marigold", "Marigold", "Mauritius-Reg"),
+ fontnames("Marigold", "Marigold", "Mauritius-Reg"),
{'M','a','r','i','g','o','l','d',' ',' ',' ',' ',' ',' ',' ',' '},
{0, 1, {221.0, 720000.0/221.0}, 0, REGULAR, NOBOLD, 4297, 26},
cc_alphabetic, plft_Unicode
},
{
- fontnames("AlbertusMedium", "Albertus-Medium", "A028-Med"),
+ fontnames("AlbertusMedium", "Albertus-Medium", "A028-Med"),
{'A','l','b','e','r','t','u','s',' ',' ',' ',' ',' ',' ','M','d'},
{0, 1, {313.0, 720000.0/313.0}, 0, REGULAR, MEDIUMBOLD, 4362, 27},
cc_alphabetic, plft_Unicode
},
{
- fontnames("AlbertusExtraBold", "Albertus-ExtraBold", "A028-Ext"),
+ fontnames("AlbertusExtraBold", "Albertus-ExtraBold", "A028-Ext"),
{'A','l','b','e','r','t','u','s',' ',' ',' ',' ',' ',' ','X','b'},
{0, 1, {369.0, 720000.0/369.0}, 0, REGULAR, EXBOLD, 4362, 28},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Arial", "Arial", "A030-Reg"),
+ fontnames("Arial", "Arial", "A030-Reg"),
{'A','r','i','a','l',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
{0, 1, {278.0, 720000.0/278.0}, 0, REGULAR, NOBOLD, 16602, 29},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Arial-BoldMT", "Arial-Bold", "A030-Bol"),
+ fontnames("Arial-BoldMT", "Arial-Bold", "A030-Bol"),
{'A','r','i','a','l',' ',' ',' ',' ',' ',' ',' ',' ',' ','B','d'},
{0, 1, {278.0, 720000.0/278.0}, 0, REGULAR, BOLD, 16602, 30},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Arial-ItalicMT", "Arial-Italic", "A030-Ita"),
+ fontnames("Arial-ItalicMT", "Arial-Italic", "A030-Ita"),
{'A','r','i','a','l',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','t'},
{0, 1, {278.0, 720000.0/278.0}, 0, ITALIC, NOBOLD, 16602, 31},
cc_alphabetic, plft_Unicode
@@ -300,7 +299,7 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("TimesNewRoman", "TimesNewRoman", "NimbusRomanNo9-Reg"),
+ fontnames("TimesNewRoman", "TimesNewRoman", "NimbusRomanNo9-Reg"),
{'T','i','m','e','s','N','e','w','R','m','n',' ',' ',' ',' ',' '},
{0, 1, {250.0, 720000.0/250.0}, 0, REGULAR, NOBOLD, 16901, 33},
cc_alphabetic, plft_Unicode
@@ -321,21 +320,21 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("TimesNewRoman-BoldItalic", "TimesNewRoman-BoldItalic", "NimbusRomanNo9-MedIta"),
+ fontnames("TimesNewRoman-BoldItalic", "TimesNewRoman-BoldItalic", "NimbusRomanNo9-MedIta"),
{'T','i','m','e','s','N','e','w','R','m','n',' ','B','d','I','t'},
{0, 1, {250.0, 720000.0/250.0}, 0, ITALIC, BOLD, 16901, 35},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Helvetica", "Helvetica", "NimbusSanL-Regu"),
+ fontnames("Helvetica", "Helvetica", "NimbusSanL-Regu"),
{'H','e','l','v','e','t','i','c','a',' ',' ',' ',' ',' ',' ',' '},
{0, 1, {278.0, 720000.0/278.0}, 0, REGULAR, NOBOLD, 24580, 37},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Helvetica-Bold", "Helvetica-Bold", "NimbusSanL-Bold"),
+ fontnames("Helvetica-Bold", "Helvetica-Bold", "NimbusSanL-Bold"),
{'H','e','l','v','e','t','i','c','a',' ',' ',' ',' ',' ','B','d'},
{0, 1, {278.0, 720000.0/278.0}, 0, REGULAR, BOLD, 24580, 38},
cc_alphabetic, plft_Unicode
@@ -363,14 +362,14 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("Helvetica-Narrow-BoldOblique", "Helvetica-Narrow-BoldOblique", "NimbusSanL-BoldCondItal"),
+ fontnames("Helvetica-Narrow-BoldOblique", "Helvetica-Narrow-BoldOblique", "NimbusSanL-BoldCondItal"),
{'H','e','l','v','e','t','i','c','a',' ','N','r','B','d','O','b'},
{0, 1, {228.0, 720000.0/228.0}, 0, CONDENSEDITALIC, BOLD, 24580, 44},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Helvetica-Narrow-Oblique", "Helvetica-Narrow-Oblique", "NimbusSanL-ReguCondItal"),
+ fontnames("Helvetica-Narrow-Oblique", "Helvetica-Narrow-Oblique", "NimbusSanL-ReguCondItal"),
{'H','e','l','v','e','t','i','c','a',' ',' ',' ','N','r','O','b'},
{0, 1, {228.0, 720000.0/228.0}, 0, CONDENSEDITALIC, NOBOLD, 24580, 43},
cc_alphabetic, plft_Unicode
@@ -391,21 +390,21 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("Palatino-Italic", "Palatino-Italic", "URWPalladioL-Ital"),
+ fontnames("Palatino-Italic", "Palatino-Italic", "URWPalladioL-Ital"),
{'P','a','l','a','t','i','n','o',' ',' ',' ',' ',' ',' ','I','t'},
{0, 1, {250.0, 720000.0/250.0}, 0, ITALIC, NOBOLD, 24591, 47},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Palatino-Bold", "Palatino-Bold", "URWPalladioL-Bold"),
+ fontnames("Palatino-Bold", "Palatino-Bold", "URWPalladioL-Bold"),
{'P','a','l','a','t','i','n','o',' ',' ',' ',' ',' ',' ','B','d'},
{0, 1, {250.0, 720000.0/250.0}, 0, REGULAR, BOLD, 24591, 46},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Palatino-BoldItalic", "Palatino-BoldItalic", "URWPalladioL-BoldItal"),
+ fontnames("Palatino-BoldItalic", "Palatino-BoldItalic", "URWPalladioL-BoldItal"),
{'P','a','l','a','t','i','n','o',' ',' ',' ',' ','B','d','I','t'},
{0, 1, {250.0, 720000.0/250.0}, 0, ITALIC, BOLD, 24591, 48},
cc_alphabetic, plft_Unicode
@@ -468,28 +467,28 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("NewCenturySchlbk-Bold", "NewCenturySchlbk-Bold", "CenturySchL-Bold"),
+ fontnames("NewCenturySchlbk-Bold", "NewCenturySchlbk-Bold", "CenturySchL-Bold"),
{'N','w','C','e','n','t','S','c','h','l','b','k',' ',' ','B','d'},
{0, 1, {287.0, 720000.0/287.0}, 0, REGULAR, BOLD, 24703, 58},
cc_alphabetic, plft_Unicode
},
{
- fontnames("NewCenturySchlbk-BoldItalic", "NewCenturySchlbk-BoldItalic", "CenturySchL-BoldItal"),
+ fontnames("NewCenturySchlbk-BoldItalic", "NewCenturySchlbk-BoldItalic", "CenturySchL-BoldItal"),
{'N','w','C','e','n','t','S','c','h','l','b','k','B','d','I','t'},
{0, 1, {287.0, 720000.0/287.0}, 0, ITALIC, BOLD, 24703, 60},
cc_alphabetic, plft_Unicode
},
{
- fontnames("NewCenturySchlbk-Italic", "NewCenturySchlbk-Italic", "CenturySchL-Ital"),
+ fontnames("NewCenturySchlbk-Italic", "NewCenturySchlbk-Italic", "CenturySchL-Ital"),
{'N','w','C','e','n','t','S','c','h','l','b','k',' ',' ','I','t'},
{0, 1, {278.0, 720000.0/278.0}, 0, ITALIC, NOBOLD, 24703, 59},
cc_alphabetic, plft_Unicode
},
{
- fontnames("NewCenturySchlbk-Roman", "NewCenturySchlbk-Roman", "CenturySchL-Roma"),
+ fontnames("NewCenturySchlbk-Roman", "NewCenturySchlbk-Roman", "CenturySchL-Roma"),
{'N','w','C','e','n','t','S','c','h','l','b','k',' ','R','m','n'},
{0, 1, {278.0, 720000.0/278.0}, 0, REGULAR, NOBOLD, 24703, 57},
cc_alphabetic, plft_Unicode
@@ -510,14 +509,14 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("Times-Italic", "Times-Italic", "NimbusRomNo9L-ReguItal"),
+ fontnames("Times-Italic", "Times-Italic", "NimbusRomNo9L-ReguItal"),
{'T','i','m','e','s',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','t'},
{0, 1, {250.0, 720000.0/250.0}, 0, ITALIC, NOBOLD, 25093, 63},
cc_alphabetic, plft_Unicode
},
{
- fontnames("Times-BoldItalic", "Times-BoldItalic", "NimbusRomNo9L-MediItal"),
+ fontnames("Times-BoldItalic", "Times-BoldItalic", "NimbusRomNo9L-MediItal"),
{'T','i','m','e','s',' ',' ',' ',' ',' ',' ',' ','B','d','I','t'},
{0, 1, {250.0, 720000.0/250.0}, 0, ITALIC, BOLD, 25093, 64},
cc_alphabetic, plft_Unicode
@@ -526,10 +525,10 @@ const font_resident_t resident_table[] = {
{
fontnames("ZapfChancery-MediumItalic", "ZapfChancery-MediumItalic", "URWChanceryL-MediItal"),
{'Z','a','p','f','C','h','a','n','c','e','r','y','M','d','I','t'},
- {0, 1, {220.0, 720000.0/220.0},0, ITALIC, NOBOLD, 45099, 65},
+ {0, 1, {220.0, 720000.0/220.0},0, ITALIC, NOBOLD, 45099, 65},
cc_alphabetic, plft_Unicode
},
-
+
{
fontnames("SymbolMT", "Symbol", "StandardSymL"),
{'S','y','m','b','o','l',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '},
@@ -555,25 +554,24 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("ZapfDingbats", "ZapfDingbats", "Dingbats"),
+ fontnames("ZapfDingbats", "ZapfDingbats", "Dingbats"),
{'Z','a','p','f','D','i','n','g','b','a','t','s',' ',' ',' ',' '},
{460, 1, {280.0, 720000.0/280.0},0, REGULAR, NOBOLD, 45101, 69},
cc_dingbats, plft_8bit
},
{
- fontnames("CourierBold", "CourierMT-Bold", "NimbusMono-Bol"),
+ fontnames("CourierBold", "CourierMT-Bold", "NimbusMono-Bol"),
{'C','o','u','r','i','e','r',' ',' ',' ',' ',' ',' ',' ','B','d'},
- {0, 0, {600.0, 720000.0/600.0}, 0, REGULAR, BOLD, 4099, 70},
- cc_alphabetic, plft_Unicode
+ {0, 0, {600.0, 720000.0/600.0}, 0, REGULAR, BOLD, 4099, 70},
+ cc_alphabetic, plft_Unicode
},
-
{
fontnames("CourierItalic", "CourierMT-Italic", "NimbusMono-Ita"),
{'C','o','u','r','i','e','r',' ',' ',' ',' ',' ',' ',' ','I','t'},
{0, 0, {600.0, 720000.0/600.0}, 0, ITALIC, NOBOLD, 4099, 71},
- cc_alphabetic, plft_Unicode
+ cc_alphabetic, plft_Unicode
},
{
@@ -584,12 +582,12 @@ const font_resident_t resident_table[] = {
},
{
- fontnames("LetterGothic", "LetterGothic", "LetterGothic-Reg"),
+ fontnames("LetterGothic", "LetterGothic", "LetterGothic-Reg"),
{'L','e','t','t','e','r','G','o','t','h','i','c',' ',' ',' ',' '},
{0, 0, {500.0, 720000.0/500.0}, 0, REGULAR, NOBOLD, 4102, 73},
cc_alphabetic, plft_Unicode
},
-
+
{
fontnames("LetterGothicBold", "LetterGothic-Bold", "LetterGothic-Bol"),
{'L','e','t','t','e','r','G','o','t','h','i','c',' ',' ','B','d'},
@@ -604,7 +602,6 @@ const font_resident_t resident_table[] = {
cc_alphabetic, plft_Unicode
},
-
{
fontnames("Courier", "Courier", "NimbusMonL-Regu"),
{'C','o','u','r','i','e','r','P','S',' ',' ',' ',' ',' ',' ',' '},
diff --git a/pl/plht.c b/pl/plht.c
index 1dc090e47..78b5f3721 100644
--- a/pl/plht.c
+++ b/pl/plht.c
@@ -26,7 +26,7 @@ typedef struct gs_state_s gs_state;
#include "gxdevice.h"
#include "plht.h"
-int
+int
pl_set_pcl_halftone(gs_state *pgs, gs_mapping_proc transfer_proc,
int width, int height,
gs_string threshold_data,
diff --git a/pl/plimpl.c b/pl/plimpl.c
index e92dae23b..392535f89 100644
--- a/pl/plimpl.c
+++ b/pl/plimpl.c
@@ -30,19 +30,17 @@ extern pl_interp_implementation_t ps_implementation;
/* Zero-terminated list of pointers to implementations */
pl_interp_implementation_t const * const pdl_implementation[] = {
#ifdef XPS_INCLUDED
- &xps_implementation,
+ &xps_implementation,
#endif
#ifdef SVG_INCLUDED
- &svg_implementation,
+ &svg_implementation,
#endif
#ifdef PCL_INCLUDED
- &pcl_implementation,
- &pxl_implementation,
+ &pcl_implementation,
+ &pxl_implementation,
#endif
#ifdef PSI_INCLUDED
- &ps_implementation,
+ &ps_implementation,
#endif
- 0
+ 0
};
-
-
diff --git a/pl/pllfont.c b/pl/pllfont.c
index 3afed1fa2..5712f2386 100644
--- a/pl/pllfont.c
+++ b/pl/pllfont.c
@@ -168,8 +168,8 @@ check_resident_fonts(pl_dict_t *pfontdict, gs_memory_t *mem)
int j;
dprintf2("%s (entry %d) not found\n", resident_table[i].full_font_name, i);
dprintf("pxl unicode name:");
- for (j = 0;
- j < countof(resident_table[i].unicode_fontname);
+ for (j = 0;
+ j < countof(resident_table[i].unicode_fontname);
j++)
dprintf1("'%c'", resident_table[i].unicode_fontname[j]);
dprintf("\n");
diff --git a/pl/plmain.c b/pl/plmain.c
index c196fe1e5..74a778c39 100644
--- a/pl/plmain.c
+++ b/pl/plmain.c
@@ -66,7 +66,6 @@ typedef struct pl_main_universe_s {
gx_device *curr_device;
} pl_main_universe_t;
-
/* Include the extern for the device list. */
extern_gs_lib_device_list();
@@ -138,7 +137,6 @@ pl_select_implementation(
pl_top_cursor_t r
);
-
/* Process the options on the command line. */
static FILE *pl_main_arg_fopen(const char *fname, void *ignore_data);
@@ -187,7 +185,6 @@ long pl_main_cursor_position(pl_top_cursor_t *cursor);
/* Close read cursor */
void pl_main_cursor_close(pl_top_cursor_t *cursor);
-
/* return index in gs device list -1 if not found */
static inline int
get_device_index(const gs_memory_t *mem, const char *value)
@@ -239,7 +236,6 @@ pl_main_aux(
pl_platform_init(mem->gs_lib_ctx->fstdout);
-
pjl_mem = mem;
gs_lib_init1(pjl_mem);
@@ -262,7 +258,6 @@ pl_main_aux(
pl_main_init_instance(&inst, mem);
arg_init(&args, (const char **)argv, argc, pl_main_arg_fopen, NULL);
-
/* Create PJL instance */
if ( pl_allocate_interp(&pjl_interp, &pjl_implementation, pjl_mem) < 0
|| pl_allocate_interp_instance(&pjl_instance, pjl_interp, pjl_mem) < 0 ) {
@@ -282,7 +277,6 @@ pl_main_aux(
pl_print_usage(&inst, "Start");
#endif
-
/* ------ Begin Main LOOP ------- */
for (;;) {
/* Process one input file. */
@@ -298,7 +292,6 @@ pl_main_aux(
bool in_pjl = true;
bool new_job = false;
-
if ( pl_init_job(pjl_instance) < 0 ) {
errprintf(mem, "Unable to init PJL job.\n");
return -1;
@@ -337,18 +330,18 @@ pl_main_aux(
if (!filename)
break; /* no nore files to process */
- /* If the display device is selected (default), set up the callback */
- if (strcmp(inst.device->dname, "display") == 0) {
- gx_device_display *ddev;
- if (!disp) {
- errprintf(mem, "Display device selected, but no display device configured.\n");
- return -1;
- }
- ddev = (gx_device_display *)inst.device;
- ddev->callback = (display_callback *)disp;
- }
-
- /* open file for reading - NB we should respect the minimum
+ /* If the display device is selected (default), set up the callback */
+ if (strcmp(inst.device->dname, "display") == 0) {
+ gx_device_display *ddev;
+ if (!disp) {
+ errprintf(mem, "Display device selected, but no display device configured.\n");
+ return -1;
+ }
+ ddev = (gx_device_display *)inst.device;
+ ddev->callback = (display_callback *)disp;
+ }
+
+ /* open file for reading - NB we should respect the minimum
requirements specified by each implementation in the
characteristics structure */
if (pl_main_cursor_open(mem, &r, filename, buf, sizeof(buf)) < 0) {
@@ -597,7 +590,6 @@ pl_interp_instance_t *get_interpreter_from_memory( const gs_memory_t *mem )
return universe->curr_instance;
}
-
/* Undo pl_main_universe_init */
int /* 0 ok, else -1 error */
pl_main_universe_dnit(
@@ -833,7 +825,6 @@ pl_top_create_device(pl_main_instance_t *pti, int index, bool is_default)
return code;
}
-
/* Process the options on the command line. */
static FILE *
pl_main_arg_fopen(const char *fname, void *ignore_data)
@@ -904,38 +895,38 @@ pl_main_process_options(pl_main_instance_t *pmi, arg_list *pal,
code = param_write_bool((gs_param_list *)params, arg_heap_copy(arg), &bval);
continue;
}
- /* Search for a non-decimal 'radix' number */
- if ( strchr(value, '#') ) {
- int base, number = 0;
- char *val = strchr(value, '#');
-
- *val++ = 0x00;
- sscanf(value, "%d", &base);
- if (base < 2 || base > 36) {
- dprintf1("Value out of range %s", value);
- return -1;
- }
- while(*val) {
- if (*val >= '0' && *val <= '9') {
- number = number * base + (*val - '0');
- } else {
- if (*val >= 'A' && *val <= 'Z') {
- number = number * base + (*val - 'A');
- } else {
- if (*val >= 'a' && *val <= 'z') {
- number = number * base + (*val - 'a');
- } else {
- dprintf1("Value out of range %s", val);
- return -1;
- }
- }
- }
- val++;
- }
+ /* Search for a non-decimal 'radix' number */
+ if ( strchr(value, '#') ) {
+ int base, number = 0;
+ char *val = strchr(value, '#');
+
+ *val++ = 0x00;
+ sscanf(value, "%d", &base);
+ if (base < 2 || base > 36) {
+ dprintf1("Value out of range %s", value);
+ return -1;
+ }
+ while(*val) {
+ if (*val >= '0' && *val <= '9') {
+ number = number * base + (*val - '0');
+ } else {
+ if (*val >= 'A' && *val <= 'Z') {
+ number = number * base + (*val - 'A');
+ } else {
+ if (*val >= 'a' && *val <= 'z') {
+ number = number * base + (*val - 'a');
+ } else {
+ dprintf1("Value out of range %s", val);
+ return -1;
+ }
+ }
+ }
+ val++;
+ }
strncpy(buffer, arg, eqp - arg);
buffer[eqp - arg] = '\0';
code = param_write_int((gs_param_list *)params, arg_heap_copy(buffer), &number);
- } else if ( ( !strchr(value, '.' ) ) &&
+ } else if ( ( !strchr(value, '.' ) ) &&
/* search for an int (no decimal), if fail try a float */
( sscanf(value, "%d", &vi) == 1 ) ) {
if ( !strncmp(arg, "FirstPage", 9) )
@@ -1028,7 +1019,7 @@ pl_main_process_options(pl_main_instance_t *pmi, arg_list *pal,
#ifdef HEAP_ALLOCATOR_ONLY
gs_malloc_memory_t *rawheap =
(gs_malloc_memory_t *)gs_malloc_wrapped_contents(pmi->memory);
-#else
+#else
gs_malloc_memory_t *rawheap =
(gs_malloc_memory_t *)gs_memory_chunk_target(pmi->memory)->non_gc_memory;
#endif
@@ -1044,13 +1035,13 @@ pl_main_process_options(pl_main_instance_t *pmi, arg_list *pal,
const char *adef;
gs_param_string str;
- if (arg[0] == 0) {
- adef = arg_next(pal, &code);
- if (code < 0)
+ if (arg[0] == 0) {
+ adef = arg_next(pal, &code);
+ if (code < 0)
break;
- } else
- adef = arg;
- param_string_from_transient_string(str, adef);
+ } else
+ adef = arg;
+ param_string_from_transient_string(str, adef);
code = param_write_string((gs_param_list *)params, "OutputFile", &str);
pmi->pause=false;
break;
diff --git a/pl/plplatf.c b/pl/plplatf.c
index da4ecd47b..7fb8732be 100644
--- a/pl/plplatf.c
+++ b/pl/plplatf.c
@@ -23,7 +23,6 @@
#include "gslib.h"
#include "plplatf.h"
-
/* ------------- Platform de/init --------- */
void
pl_platform_init(FILE *debug_out)
@@ -66,6 +65,5 @@ gs_reloc_const_string(gs_const_string *sptr, gc_state_t *gcst)
void
gs_exit(int exit_status)
{ pl_platform_dnit(exit_status);
- pl_exit(exit_status); /* must be implemeted by caller */
+ pl_exit(exit_status); /* must be implemeted by caller */
}
-
diff --git a/pl/plplatf.h b/pl/plplatf.h
index f218eeadf..703a213a0 100644
--- a/pl/plplatf.h
+++ b/pl/plplatf.h
@@ -23,10 +23,8 @@ pl_platform_init(FILE *debug_out);
void
pl_platform_dnit(int exit_status);
-
/*----- The following is declared here, but must be implemented by client ----*/
/* Terminate execution */
void pl_exit(int exit_status);
#endif /* plplatf_INCLUDED */
-
diff --git a/pl/plplatfps.c b/pl/plplatfps.c
index ba3d34dd7..fb3411e47 100644
--- a/pl/plplatfps.c
+++ b/pl/plplatfps.c
@@ -23,7 +23,6 @@
#include "gslib.h"
#include "plplatf.h"
-
/* ------------- Platform de/init --------- */
void
pl_platform_init(FILE *debug_out)
@@ -39,7 +38,7 @@ pl_platform_init(FILE *debug_out)
void
pl_platform_dnit(int exit_status)
{
- // hack
+ // hack
// fflush(gs_stderr); /* in case of error exit */
/* Do platform-specific cleanup. */
gp_exit(exit_status, 0);
@@ -65,4 +64,3 @@ gp_check_interrupts(void)
{
return 0;
}
-
diff --git a/pl/plsrgb.c b/pl/plsrgb.c
index 251f9aee6..42253b004 100644
--- a/pl/plsrgb.c
+++ b/pl/plsrgb.c
@@ -46,8 +46,7 @@ pl_device_does_color_conversion()
return true;
#endif
return false;
-}
-
+}
/* shared language (pcl and pclxl) for setting up sRGB to XYZ and an
associated default CRD to be used. The code will request a crd
@@ -56,11 +55,11 @@ pl_device_does_color_conversion()
definitions are repeated here
[ /CIEBasedABC <<
- % sRGB gamma transform
+ % sRGB gamma transform
/DecodeLMN [
{dup 0.03928 le {12.92321 div}{0.055 add 1.055 div 2.4 exp}ifelse}
bind dup dup ]
-
+
% sRGB to XYZ (D65) matrix (ITU-R BT.709-2 Primaries)
/MatrixLMN [
0.412457 0.212673 0.019334
@@ -68,51 +67,49 @@ pl_device_does_color_conversion()
0.180437 0.072175 0.950301 ]
/WhitePoint [ 0.9505 1 1.0890 ] % D65
/BlackPoint[0 0 0]
- >> ] setcolorspace
-
+ >> ] setcolorspace
+
<<
% sRGB output CRD, D65 white point
/ColorRenderingType 1
- /RangePQR [ -0.5 2 -0.5 2 -0.5 2 ]
-
+ /RangePQR [ -0.5 2 -0.5 2 -0.5 2 ]
+
% Bradford Cone Space
/MatrixPQR [0.8951 -0.7502 0.0389
0.2664 1.7135 -0.0685
- -0.1614 0.0367 1.0296]
-
+ -0.1614 0.0367 1.0296]
+
% VonKries-like transform in Bradford Cone Space
/TransformPQR
[{exch pop exch 3 get mul exch pop exch 3 get div} bind
{exch pop exch 4 get mul exch pop exch 4 get div} bind
- {exch pop exch 5 get mul exch pop exch 5 get div} bind]
-
+ {exch pop exch 5 get mul exch pop exch 5 get div} bind]
+
/MatrixLMN [3.240449 -0.969265 0.055643
-1.537136 1.876011 -0.204026
- -0.498531 0.041556 1.057229]
-
+ -0.498531 0.041556 1.057229]
+
% Inverse sRGB gamma transform
/EncodeABC [{dup 0.00304 le {12.92321 mul}
{1 2.4 div exp 1.055 mul 0.055 sub}ifelse}
- bind dup dup]
-
+ bind dup dup]
+
/WhitePoint[0.9505 1 1.0890] % D65
/BlackPoint [0 0 0]
>> setcolorrendering
*/
-
/* CIEBasedABC definitions */
/* Decode LMN procedures for srgb color spaces or sRGB gamma transform. */
inline static float
pl_decodeLMN(floatp val, const gs_cie_common *pcie)
{
if ( val <= 0.03928 )
- return (float)(val / 12.92321);
+ return (float)(val / 12.92321);
else
- return (float)pow((val + 0.055) / 1.055, (double)2.4);
+ return (float)pow((val + 0.055) / 1.055, (double)2.4);
}
-
static float
pl_DecodeLMN_0(floatp val, const gs_cie_common *pcie)
{
@@ -169,7 +166,6 @@ static const gs_range3 pl_RangePQR = {
{-0.5, 2.0}}
};
-
/* tranform pqr */
static int
pl_TransformPQR_proc(int indx, floatp val, const gs_cie_wbsd *cs_wbsd,
@@ -188,7 +184,6 @@ static const gs_cie_transform_proc3 pl_TransformPQR = {
NULL
};
-
/* ABC - inverse srgb gamma transform */
inline static float
pl_encodeABC(floatp in, const gs_cie_render * pcrd)
@@ -284,13 +279,11 @@ pl_read_device_CRD(gs_cie_render *pcrd, gs_state *pgs)
return (code == 0);
}
-
/* statics to see if the crd has been built, in practice the crd is a
singleton. */
gs_cie_render *pl_pcrd;
bool pl_pcrd_built = false; /* the crd has been built */
-
static int
pl_build_crd(gs_state *pgs)
{
@@ -301,7 +294,7 @@ pl_build_crd(gs_state *pgs)
code = gs_cie_render1_build(&pl_pcrd, gs_state_memory(pgs), "build_crd");
if ( code < 0 )
- return code;
+ return code;
pl_pcrd_built = true;
if ( pl_read_device_CRD(pl_pcrd, pgs) ) {
@@ -309,8 +302,8 @@ pl_build_crd(gs_state *pgs)
return 0;
}
- code = gs_cie_render1_initialize(pgs->memory,
- pl_pcrd,
+ code = gs_cie_render1_initialize(pgs->memory,
+ pl_pcrd,
NULL,
&pl_WhitePoint,
&pl_BlackPoint,
@@ -325,12 +318,11 @@ pl_build_crd(gs_state *pgs)
NULL,
NULL);
if ( code < 0 )
- return code; /* should not fail */
+ return code; /* should not fail */
code = gs_setcolorrendering(pgs, pl_pcrd);
return code;
}
-
/* return SRGB color space to the client */
int
pl_cspace_init_SRGB(gs_color_space **ppcs, const gs_state *pgs)
@@ -347,8 +339,6 @@ pl_cspace_init_SRGB(gs_color_space **ppcs, const gs_state *pgs)
if ( code < 0 )
return code;
-
-
code = gs_cspace_build_CIEABC(ppcs, NULL, gs_state_memory(pgs));
if ( code < 0 )
return code;
@@ -392,7 +382,7 @@ pl_setSRGBcolor(gs_state *pgs, float r, float g, float b)
code = pl_setSRGB(pgs);
if ( code < 0 )
return code;
-
+
/* set the color */
color.paint.values[0] = r;
color.paint.values[1] = g;
diff --git a/pl/plsymbol.c b/pl/plsymbol.c
index 7baf70757..b58800fe5 100644
--- a/pl/plsymbol.c
+++ b/pl/plsymbol.c
@@ -681,7 +681,6 @@ static const pl_symbol_map_t map_9J_unicode = {
}
};
-
/**************************************
* ISO 8859/1 Latin 1 Unicode mapping *
**************************************/
@@ -856,7 +855,7 @@ static const pl_symbol_map_t map_10U_unicode = {
0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4,
0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229,
/*0xf0*/
- 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
+ 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25aa, 0x00a0
}
};
@@ -1321,7 +1320,6 @@ static const pl_symbol_map_t map_17U_unicode = {
}
};
-
/************************************
* PC-Turkish (PT) Unicode mapping *
************************************/
@@ -1374,7 +1372,7 @@ static const pl_symbol_map_t map_9T_unicode = {
0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4,
0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229,
/*0xf0*/
- 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
+ 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248,
0x00b0, 0x2219, 0x2219, 0x221a, 0x207f, 0x00b2, 0x25aa, 0x00a0
}
};
@@ -1494,7 +1492,6 @@ static const pl_symbol_map_t map_9E_unicode = {
}
};
-
/* NB The following 3 symbols sets need to be formatted consistently
with the other symbol sets. */
@@ -2023,7 +2020,7 @@ static const pl_symbol_map_t map_9G_unicode = {
0x03cc,
0x03cd,
0x03ce,
- 0xffff
+ 0xffff
}
};
/********************************************
@@ -2032,7 +2029,7 @@ static const pl_symbol_map_t map_9G_unicode = {
static const pl_symbol_map_t map_9V_unicode = {
map_header(9, 'V', plgv_Unicode, 2, 0, 0, 0, 0, 0xc0, 0, 0, 0, PLGV_U2M_MAPPING),
{
- 0x0000,
+ 0x0000,
0x0001,
0x0002,
0x0003,
@@ -2287,7 +2284,7 @@ static const pl_symbol_map_t map_9V_unicode = {
0x00fc,
0x200e,
0x200f,
- 0x06d2
+ 0x06d2
}
};
@@ -3567,7 +3564,6 @@ const pl_symbol_map_t *pl_built_in_symbol_maps[] = {
const int pl_built_in_symbol_map_count =
countof(pl_built_in_symbol_maps) - 1;
-
ulong
pl_map_symbol(const pl_symbol_map_t *psm,
uint chr, bool is_resident_font, bool is_MSL,
@@ -3586,12 +3582,12 @@ pl_map_symbol(const pl_symbol_map_t *psm,
*/
if (psm == 0) {
- if (is_resident_font && !is_590)
- return chr + 0xf000;
+ if (is_resident_font && !is_590)
+ return chr + 0xf000;
else
return chr;
}
-
+
if (pl_get_uint16(psm->id) == 590) {
return chr;
}
@@ -3599,7 +3595,7 @@ pl_map_symbol(const pl_symbol_map_t *psm,
first_code = pl_get_uint16(psm->first_code);
last_code = pl_get_uint16(psm->last_code);
if ((chr < first_code) || (chr > last_code))
- code = ((last_code <= 0xff) && (chr > 0xff) ? chr : 0xffff);
+ code = ((last_code <= 0xff) && (chr > 0xff) ? chr : 0xffff);
else
code = psm->codes[chr - first_code];
/* we do not provide many of the symbol sets in MSL format.
diff --git a/pl/plsymbol.h b/pl/plsymbol.h
index e41a0a544..5ce52e8b6 100644
--- a/pl/plsymbol.h
+++ b/pl/plsymbol.h
@@ -39,7 +39,7 @@ typedef enum {
* the mapping function defined in pl/plvocab.h to map to and from msl
* and unicode. There are 3 mutually exclusive possibilities: (1) a
* unicode symbol set that can be mapped to msl, (2) an msl symbol set
- * that can be mapped to unicode and (3) neither (1) or (2).
+ * that can be mapped to unicode and (3) neither (1) or (2).
*/
#define PLGV_M2U_MAPPING 1
@@ -82,7 +82,7 @@ extern const int pl_built_in_symbol_map_count;
if the symbol set in null. We cheat here and use a ulong instead
of gs_char to avoid pulling in all the gs_char graphics library
dependencies. */
-ulong pl_map_symbol(const pl_symbol_map_t *psm, uint chr, bool is_resident_font,
+ulong pl_map_symbol(const pl_symbol_map_t *psm, uint chr, bool is_resident_font,
bool is_MSL, bool is_590);
/* supported pcl and xl wide encodings - 4 Asian encodings and an an
diff --git a/pl/pltop.c b/pl/pltop.c
index bed6c8c56..0e421415c 100644
--- a/pl/pltop.c
+++ b/pl/pltop.c
@@ -23,13 +23,12 @@
#include "gsdevice.h"
#include "pltop.h"
-
/* Get implemtation's characteristics */
const pl_interp_characteristics_t * /* always returns a descriptor */
pl_characteristics(
const pl_interp_implementation_t *impl /* implementation of interpereter to alloc */
)
-{
+{
return impl->proc_characteristics(impl);
}
@@ -41,11 +40,11 @@ pl_allocate_interp(
gs_memory_t *mem /* allocator to allocate interp from */
)
{
- int code = impl->proc_allocate_interp(interp, impl, mem);
- if (code < 0)
- return code;
- (*interp)->implementation = impl;
- return code;
+ int code = impl->proc_allocate_interp(interp, impl, mem);
+ if (code < 0)
+ return code;
+ (*interp)->implementation = impl;
+ return code;
}
/* Do per-instance interpreter allocation/init. No device is set yet */
@@ -56,15 +55,15 @@ pl_allocate_interp_instance(
gs_memory_t *mem /* allocator to allocate instance from */
)
{
- pl_interp_instance_t *pli;
- int code
- = interp->implementation->proc_allocate_interp_instance(instance, interp, mem);
- if (code < 0)
- return code;
- pli = *instance;
- pli->interp = interp;
+ pl_interp_instance_t *pli;
+ int code
+ = interp->implementation->proc_allocate_interp_instance(instance, interp, mem);
+ if (code < 0)
+ return code;
+ pli = *instance;
+ pli->interp = interp;
- return code;
+ return code;
}
/* Set a client language into an interperter instance */
@@ -75,8 +74,8 @@ pl_set_client_instance(
pl_interp_instance_clients_t which_client
)
{
- return instance->interp->implementation->proc_set_client_instance
- (instance, client, which_client);
+ return instance->interp->implementation->proc_set_client_instance
+ (instance, client, which_client);
}
/* Set an interpreter instance's pre-page action */
@@ -87,8 +86,8 @@ pl_set_pre_page_action(
void *closure /* closure to call action with */
)
{
- return instance->interp->implementation->proc_set_pre_page_action
- (instance, action, closure);
+ return instance->interp->implementation->proc_set_pre_page_action
+ (instance, action, closure);
}
/* Set an interpreter instance's post-page action */
@@ -99,18 +98,17 @@ pl_set_post_page_action(
void *closure /* closure to call action with */
)
{
- return instance->interp->implementation->proc_set_post_page_action
- (instance, action, closure);
+ return instance->interp->implementation->proc_set_post_page_action
+ (instance, action, closure);
}
-
int /* ret 0 ok, else -ve err */
pl_get_device_memory(
pl_interp_instance_t *instance, /* interp instance to use */
gs_memory_t **memory
)
{
- return instance->interp->implementation->proc_get_device_memory(instance, memory);
+ return instance->interp->implementation->proc_get_device_memory(instance, memory);
}
/* Get and interpreter prefered device memory allocator if any */
@@ -120,16 +118,16 @@ pl_set_device(
gx_device *device /* device to set (open or closed) */
)
{
- return instance->interp->implementation->proc_set_device(instance, device);
+ return instance->interp->implementation->proc_set_device(instance, device);
}
/* Prepare interp instance for the next "job" */
int /* ret 0 ok, else -ve error code */
pl_init_job(
- pl_interp_instance_t *instance /* interp instance to start job in */
+ pl_interp_instance_t *instance /* interp instance to start job in */
)
{
- return instance->interp->implementation->proc_init_job(instance);
+ return instance->interp->implementation->proc_init_job(instance);
}
/* Parse a random access seekable file.
@@ -139,8 +137,8 @@ pl_init_job(
*/
int
pl_process_file(
- pl_interp_instance_t *instance,
- char *filename
+ pl_interp_instance_t *instance,
+ char *filename
)
{
return instance->interp->implementation->proc_process_file(instance, filename);
@@ -155,54 +153,54 @@ int /* The parser reads data from the input
* other <0 value - an error was detected.
*/
pl_process(
- pl_interp_instance_t *instance, /* interp instance to process data job in */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to process data job in */
+ stream_cursor_read *cursor /* data to process */
)
{
- return instance->interp->implementation->proc_process(instance, cursor);
+ return instance->interp->implementation->proc_process(instance, cursor);
}
/* Skip to end of job ret 1 if done, 0 ok but EOJ not found, else -ve error code */
int
pl_flush_to_eoj(
- pl_interp_instance_t *instance, /* interp instance to flush for */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to flush for */
+ stream_cursor_read *cursor /* data to process */
)
{
- return instance->interp->implementation->proc_flush_to_eoj(instance, cursor);
+ return instance->interp->implementation->proc_flush_to_eoj(instance, cursor);
}
/* Parser action for end-of-file (also resets after unexpected EOF) */
int /* ret 0 or +ve if ok, else -ve error code */
pl_process_eof(
- pl_interp_instance_t *instance /* interp instance to process data job in */
+ pl_interp_instance_t *instance /* interp instance to process data job in */
)
{
- return instance->interp->implementation->proc_process_eof(instance);
+ return instance->interp->implementation->proc_process_eof(instance);
}
/* Report any errors after running a job */
int /* ret 0 ok, else -ve error code */
pl_report_errors(pl_interp_instance_t *instance, /* interp instance to wrap up job in */
- int code, /* prev termination status */
- long file_position, /* file position of error, -1 if unknown */
- bool force_to_cout /* force errors to cout */
+ int code, /* prev termination status */
+ long file_position, /* file position of error, -1 if unknown */
+ bool force_to_cout /* force errors to cout */
)
{
- return instance->interp->implementation->proc_report_errors
- (instance, code, file_position, force_to_cout);
+ return instance->interp->implementation->proc_report_errors
+ (instance, code, file_position, force_to_cout);
}
/* Wrap up interp instance after a "job" */
int /* ret 0 ok, else -ve error code */
pl_dnit_job(
- pl_interp_instance_t *instance /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance /* interp instance to wrap up job in */
)
{
- if ( instance )
- return instance->interp->implementation->proc_dnit_job(instance);
+ if ( instance )
+ return instance->interp->implementation->proc_dnit_job(instance);
else
- return 0;
+ return 0;
}
/* Remove a device from an interperter instance */
@@ -211,8 +209,8 @@ pl_remove_device(
pl_interp_instance_t *instance /* interp instance to use */
)
{
- int code = instance->interp->implementation->proc_remove_device(instance);
- return code;
+ int code = instance->interp->implementation->proc_remove_device(instance);
+ return code;
}
/* Deallocate a interpreter instance */
@@ -221,9 +219,9 @@ pl_deallocate_interp_instance(
pl_interp_instance_t *instance /* instance to dealloc */
)
{
- int code
- = instance->interp->implementation->proc_deallocate_interp_instance(instance);
- return code;
+ int code
+ = instance->interp->implementation->proc_deallocate_interp_instance(instance);
+ return code;
}
/* Do static deinit of interpreter */
@@ -232,8 +230,7 @@ pl_deallocate_interp(
pl_interp_t *interp /* interpreter to deallocate */
)
{
- int code
- = interp->implementation->proc_deallocate_interp(interp);
- return code;
+ int code
+ = interp->implementation->proc_deallocate_interp(interp);
+ return code;
}
-
diff --git a/pl/pltop.h b/pl/pltop.h
index f0d33c641..cca93ae63 100644
--- a/pl/pltop.h
+++ b/pl/pltop.h
@@ -33,7 +33,7 @@ typedef struct gx_device_s gx_device;
*/
typedef struct pl_interp_implementation_s pl_interp_implementation_t; /* fwd decl */
typedef struct pl_interp_s {
- const struct pl_interp_implementation_s *implementation; /* implementation of actual interp */
+ const struct pl_interp_implementation_s *implementation; /* implementation of actual interp */
} pl_interp_t;
typedef struct pl_interp_instance_s {
@@ -51,7 +51,7 @@ typedef int (*pl_page_action_t)(pl_interp_instance_t *, void *);
*/
typedef struct pl_interp_characteristics_s {
const char* language; /* generic language should correspond with
- HP documented PJL name */
+ HP documented PJL name */
const char* auto_sense_string; /* string used to detect language */
const char* manufacturer; /* manuf str */
const char* version; /* version str */
@@ -61,7 +61,7 @@ typedef struct pl_interp_characteristics_s {
/*
* The pl_interp_t and pl_interp_instance are intended to provide a generic
- * front end for language interpreters, in tandem with a
+ * front end for language interpreters, in tandem with a
* pl_interp_implementation_t. pl_interp_t and pl_interp_impmementation_t
* together are used to describe a particular implementation. An implementation
* can then generate one or more instances, which are more-or-less
@@ -111,14 +111,13 @@ int pl_allocate_interp_instance(pl_interp_instance_t **, pl_interp_t *, gs_memor
typedef int (*pl_interp_proc_allocate_interp_instance_t)(pl_interp_instance_t **, pl_interp_t *, gs_memory_t *);
/* clients that can be set into an interpreter's state */
-typedef enum {
+typedef enum {
/* needed to access the pcl interpreter in pxl (passthrough mode) */
PCL_CLIENT,
/* needed by all interpreters to query pjl state */
PJL_CLIENT
} pl_interp_instance_clients_t;
-
int pl_set_client_instance(pl_interp_instance_t *, pl_interp_instance_t *, pl_interp_instance_clients_t client);
typedef int (*pl_interp_proc_set_client_instance_t)(pl_interp_instance_t *, pl_interp_instance_t *, pl_interp_instance_clients_t client);
@@ -175,7 +174,7 @@ pl_interp_instance_t *get_interpreter_from_memory( const gs_memory_t *mem );
* Define a generic interpreter implementation
*/
struct pl_interp_implementation_s {
- /* Procedure vector */
+ /* Procedure vector */
pl_interp_proc_characteristics_t proc_characteristics;
pl_interp_proc_allocate_interp_t proc_allocate_interp;
pl_interp_proc_allocate_interp_instance_t proc_allocate_interp_instance;
diff --git a/pl/pltoputl.c b/pl/pltoputl.c
index a2e62d010..bf1657d33 100644
--- a/pl/pltoputl.c
+++ b/pl/pltoputl.c
@@ -23,21 +23,21 @@
/* Initialize cursor */
int /* returns 0 ok, else -ve error code */
pl_top_cursor_init(
- pl_top_cursor_t *cursor, /* cursor to init/open */
- FILE *strm, /* open stream to read from */
- byte *buffer, /* buffer to use for reading */
- unsigned buffer_length /* length of *buffer */
+ pl_top_cursor_t *cursor, /* cursor to init/open */
+ FILE *strm, /* open stream to read from */
+ byte *buffer, /* buffer to use for reading */
+ unsigned buffer_length /* length of *buffer */
)
{
- int status;
- cursor->strm = strm;
- cursor->buffer = buffer;
- cursor->buffer_length = buffer_length;
- cursor->cursor.limit = cursor->cursor.ptr = buffer - 1;
- cursor->status = 1; /* non-status */
+ int status;
+ cursor->strm = strm;
+ cursor->buffer = buffer;
+ cursor->buffer_length = buffer_length;
+ cursor->cursor.limit = cursor->cursor.ptr = buffer - 1;
+ cursor->status = 1; /* non-status */
- status = pl_top_cursor_next(cursor);
- return status < 0 ? status : 0; /* report errors, not EOF */
+ status = pl_top_cursor_next(cursor);
+ return status < 0 ? status : 0; /* report errors, not EOF */
}
/* End of data condition. */
@@ -55,45 +55,45 @@ pl_renew_cursor_status(pl_top_cursor_t *cursor)
if (pl_cursor_EOD(cursor)) {
cursor->status = 1;
}
-}
+}
/* Refill from input */
int /* rets 1 ok, else 0 EOF, -ve error */
pl_top_cursor_next(
- pl_top_cursor_t *cursor /* cursor to operate on */
+ pl_top_cursor_t *cursor /* cursor to operate on */
)
{
- int len;
+ int len;
- /* Declare EOF even if chars left in buffer if no chars were consumed */
- if (pl_cursor_EOD(cursor))
+ /* Declare EOF even if chars left in buffer if no chars were consumed */
+ if (pl_cursor_EOD(cursor))
return cursor->status;
- /* Copy any remaining bytes to head of buffer */
- len = cursor->cursor.limit - cursor->cursor.ptr;
- if (len > 0)
- memmove(cursor->buffer, cursor->cursor.ptr + 1, len);
- cursor->cursor.ptr = cursor->buffer - 1;
- cursor->cursor.limit = cursor->buffer + (len - 1);
+ /* Copy any remaining bytes to head of buffer */
+ len = cursor->cursor.limit - cursor->cursor.ptr;
+ if (len > 0)
+ memmove(cursor->buffer, cursor->cursor.ptr + 1, len);
+ cursor->cursor.ptr = cursor->buffer - 1;
+ cursor->cursor.limit = cursor->buffer + (len - 1);
- /* Top off rest of buffer by reading stream */
- if (cursor->status > 0 && len < cursor->buffer_length) {
- cursor->status = fread((byte *)(cursor->cursor.limit + 1),
- 1, cursor->buffer_length - len,
- cursor->strm);
- if (cursor->status > 0)
- cursor->cursor.limit += cursor->status;
- }
+ /* Top off rest of buffer by reading stream */
+ if (cursor->status > 0 && len < cursor->buffer_length) {
+ cursor->status = fread((byte *)(cursor->cursor.limit + 1),
+ 1, cursor->buffer_length - len,
+ cursor->strm);
+ if (cursor->status > 0)
+ cursor->cursor.limit += cursor->status;
+ }
- /* Return success if there's anything in the buffer */
- return cursor->cursor.limit == cursor->cursor.ptr ? cursor->status : 1;
+ /* Return success if there's anything in the buffer */
+ return cursor->cursor.limit == cursor->cursor.ptr ? cursor->status : 1;
}
/* Deinit a read cursor */
void
pl_top_cursor_dnit(
- pl_top_cursor_t *cursor /* cursor to operate on */
+ pl_top_cursor_t *cursor /* cursor to operate on */
)
{
- return;
+ return;
}
diff --git a/pl/pltoputl.h b/pl/pltoputl.h
index aeb90634e..ecaddeee3 100644
--- a/pl/pltoputl.h
+++ b/pl/pltoputl.h
@@ -23,11 +23,11 @@
* Stream-driven reading cursor
*/
typedef struct pl_top_cursor_s {
- stream_cursor_read cursor; /* cursor actually used to read */
- FILE *strm; /* stream that data comes from */
- unsigned char *buffer; /* buffer to use */
+ stream_cursor_read cursor; /* cursor actually used to read */
+ FILE *strm; /* stream that data comes from */
+ unsigned char *buffer; /* buffer to use */
unsigned buffer_length; /* # bytes in buffer */
- int status; /* if <=0, status to report to caller */
+ int status; /* if <=0, status to report to caller */
} pl_top_cursor_t;
/* Init a read cursor w/specified open stream */
diff --git a/pl/pluchar.c b/pl/pluchar.c
index 6f6aebf4a..c107b2c85 100644
--- a/pl/pluchar.c
+++ b/pl/pluchar.c
@@ -55,7 +55,6 @@
#include "shareinc.h"
#include "gxfapiu.h"
-
/* ---------------- UFST utilities ---------------- */
#define UFST_SCALE 16
@@ -138,9 +137,9 @@ pl_init_fc(
pfc->ExtndFlags |= EF_VERTSUBS_TYPE;
}
else if (plfont->scaling_technology == plfst_TrueType && plfont->large_sizes) {
- pfc->ExtndFlags = EF_FORMAT16_TYPE | EF_GALLEYSEG_TYPE;
- if ((pfont->WMode & 0x1) != 0) /* vertical substitution */
- pfc->ExtndFlags |= EF_VERTSUBS_TYPE;
+ pfc->ExtndFlags = EF_FORMAT16_TYPE | EF_GALLEYSEG_TYPE;
+ if ((pfont->WMode & 0x1) != 0) /* vertical substitution */
+ pfc->ExtndFlags |= EF_VERTSUBS_TYPE;
}
pfc->ExtndFlags |= EF_NOUSBOUNDBOX; /* UFST 5.0+ addition */
@@ -231,13 +230,13 @@ image_outline_char(
pt[0].x, pt[0].y,
pt[1].x, pt[1].y,
pt[2].x, pt[2].y );
- }
+ }
if (code < 0)
return code;
}
if ((code = gx_path_close_subpath(ppath)) < 0)
return code;
- }
+ }
return 0;
}
@@ -252,7 +251,7 @@ pl_ufst_char_width(
gs_point * pwidth,
FONTCONTEXT * pfc )
{
-
+
UW16 chIdloc = char_code;
UW16 fontWidth[2];
int status;
@@ -287,7 +286,7 @@ pl_ufst_make_char(
gs_font * pfont,
gs_char chr,
FONTCONTEXT * pfc )
-{
+{
gs_imager_state * pis = (gs_imager_state *)pgs;
MEM_HANDLE memhdl;
UW16 status, chIdloc = chr;
@@ -350,11 +349,11 @@ pl_ufst_make_char(
wbox[4] = psbm->black_width + wbox[2];
wbox[5] = psbm->black_depth + wbox[3];
- /* if (status == ERR_fixed_space)
- * we are relying on ufst to
- * send a zero sized image; we then cache the escapements of the space character
- * psbm->bm = psbm->width = psbm->height = 0;
- * note that the outline code can't be reached on ERR_fixed_space
+ /* if (status == ERR_fixed_space)
+ * we are relying on ufst to
+ * send a zero sized image; we then cache the escapements of the space character
+ * psbm->bm = psbm->width = psbm->height = 0;
+ * note that the outline code can't be reached on ERR_fixed_space
*/
if ((code = gs_setcachedevice(penum, pgs, wbox)) < 0) {
@@ -426,10 +425,9 @@ pl_ufst_make_char(
MEMfree(FSA CACHE_POOL, memhdl);
gs_setmatrix(pgs, &sv_ctm);
return (code < 0 ? code : 0);
- }
+ }
}
-
/* ---------------- MicroType font support ---------------- */
/*
* MicroType accepts unicode values a glyph identifiers, so no explicit
@@ -441,7 +439,6 @@ pl_mt_encode_char(gs_font * pfont, gs_char pchr, gs_glyph_space_t not_used)
return (gs_glyph)pchr;
}
-
/*
* Set the current UFST font to be a MicroType font.
*/
@@ -496,10 +493,10 @@ struct pl_glyph_width_node_s {
pl_glyph_width_node_t *head = NULL;
/* add at the front of the list */
-int
+int
pl_glyph_width_cache_node_add(gs_memory_t *mem, gs_id font_id, uint char_code, gs_point *pwidth)
{
- pl_glyph_width_node_t *node =
+ pl_glyph_width_node_t *node =
(pl_glyph_width_node_t *)gs_alloc_bytes(mem,
sizeof(pl_glyph_width_node_t),
"pl_glyph_width_cache_node_add");
@@ -512,7 +509,7 @@ pl_glyph_width_cache_node_add(gs_memory_t *mem, gs_id font_id, uint char_code, g
node->next = head;
head = node;
}
-
+
head->char_code = char_code;
head->font_id = font_id;
head->width = *pwidth;
@@ -548,7 +545,6 @@ pl_glyph_width_list_remove(gs_memory_t *mem)
return;
}
-
/* Get character existence and escapement for an MicroType font. */
static int
pl_mt_char_width(
@@ -568,7 +564,7 @@ pl_mt_char_width(
return 0;
code = pl_ufst_char_width(char_code, pgs, pwidth, &fc);
if ( code == 0 )
- code = pl_glyph_width_cache_node_add(plfont->pfont->memory,
+ code = pl_glyph_width_cache_node_add(plfont->pfont->memory,
plfont->pfont->id,
char_code, pwidth);
}
@@ -581,7 +577,7 @@ pl_mt_char_metrics(const pl_font_t *plfont, const void *pgs, uint char_code, flo
gs_point width;
metrics[0] = metrics[1] = metrics[2] = metrics[3] = 0;
if ( 0 == pl_mt_char_width(plfont, pgs, char_code, &width) ) {
- /* width is correct,
+ /* width is correct,
stefan foo: lsb is missing. */
metrics[2] = width.x;
/* metrics[0] = left_side_bearing;
@@ -641,7 +637,7 @@ LPUB8 pl_PCLEO_charptr(LPUB8 pfont_hdr, UW16 char_code)
return pl_PCLchId2ptr(FSA char_code);
}
-void plu_set_callbacks()
+void plu_set_callbacks()
{
gx_set_UFST_Callbacks(pl_PCLEO_charptr, pl_PCLchId2ptr, pl_PCLglyphID2Ptr);
/* nothing */
@@ -656,4 +652,3 @@ pl_mt_init_procs(gs_font_base *pfont)
plfont->char_metrics = pl_mt_char_metrics;
#undef plfont
}
-
diff --git a/pl/plufont.c b/pl/plufont.c
index e8591a20e..9030df894 100644
--- a/pl/plufont.c
+++ b/pl/plufont.c
@@ -56,7 +56,7 @@ extern void pl_init_fc(
bool width_request);
/* ---------------- Library callbacks ---------------- */
-
+
/* Fill in AGFA MicroType font boilerplate. */
void
pl_fill_in_mt_font(gs_font_base *pfont, SW16 data, long unique_id)
@@ -79,14 +79,14 @@ pl_fill_in_mt_font(gs_font_base *pfont, SW16 data, long unique_id)
int
pl_load_mt_font(SW16 handle, gs_font_dir *pdir, gs_memory_t *mem,
long unique_id, pl_font_t **pplfont)
-{
- gs_font_base *pfont = gs_alloc_struct(mem, gs_font_base,
- &st_gs_font_base, "pl_mt_load_font(gs_font_base)");
- pl_font_t *plfont = pl_alloc_font(mem, "pl_mt_load_font(pl_font_t)");
+{
+ gs_font_base *pfont = gs_alloc_struct(mem, gs_font_base,
+ &st_gs_font_base, "pl_mt_load_font(gs_font_base)");
+ pl_font_t *plfont = pl_alloc_font(mem, "pl_mt_load_font(pl_font_t)");
int code;
- if ( pfont == 0 || plfont == 0 )
- code = gs_note_error(gs_error_VMerror);
+ if ( pfont == 0 || plfont == 0 )
+ code = gs_note_error(gs_error_VMerror);
else
{ /* Initialize general font boilerplate. */
code = pl_fill_in_font((gs_font *)pfont, plfont, pdir, mem, "illegal font");
diff --git a/pl/plulfont.c b/pl/plulfont.c
index 31c57c4a9..faa0f7389 100644
--- a/pl/plulfont.c
+++ b/pl/plulfont.c
@@ -38,14 +38,12 @@
#include "shareinc.h"
#include "gxfapiu.h"
-
/* the line printer font NB FIXME use a header file. */
#include "plulp.c"
/* global warning. ufst state structure passed to each ufst function */
IF_STATE IFS;
PIF_STATE pIFS = &IFS;
-
/* GLOBAL Warning! NB fix me */
/*
* fco and plugin handles which must be freed when the interpreter shuts down
@@ -56,7 +54,6 @@ static bool plugins_opened = false;
/* NB fixme - we might as well require an environment variable for the
fco names and plugins, these change every UFST release */
-
/* defaults for locations of font collection objects (fco's) and
plugins the root data directory. These are internally separated with
':' but environment variable use the gp separator */
@@ -71,7 +68,7 @@ const char *UFSTPLUGINS="mtfonts/pcl45/mt3/plug__xi.fco";
/* return a null terminated array of strings on the heap from
str0:str1:str:. Use gs separator */
-static
+static
char **build_strs(gs_memory_t *mem, char *str, char separator)
{
int i;
@@ -90,7 +87,7 @@ char **build_strs(gs_memory_t *mem, char *str, char separator)
/* reallocate the list that holds the string pointers */
if ( i == 0 )
/* first time */
- list =
+ list =
(char **)gs_alloc_bytes(mem,
((i+1) + 1) /* terminating null */ * sizeof(char *),
"build_strs");
@@ -107,10 +104,10 @@ char **build_strs(gs_memory_t *mem, char *str, char separator)
/* terminate the list of strings */
list[i + 1] = (char *)NULL;
/* allocate space for the string */
- list[i] = gs_alloc_bytes(mem,
+ list[i] = gs_alloc_bytes(mem,
end_path - start_path + 1 /* NULL term */,
"build_strs");
-
+
if ( list[i] == NULL ) {
/* NB no fall back or freeing of memory already consumed */
dprintf("Fatal System Failure\n" );
@@ -148,7 +145,6 @@ free_strs(gs_memory_t *mem, char **str_of_strs)
#define MAXPATHLEN 1024
-
/* these are lists of fco's and plugins relative to the root directory
they can be set by an environment variable or defaults. */
static char **
@@ -190,8 +186,8 @@ pl_check_fonts(pl_dict_t *pfontdict, bool use_unicode_names_for_keys)
&value, true, NULL) /* return data ignored */ ) {
int i;
dprintf("Font with unicode key: ");
- for (i = 0;
- i < sizeof(resident_table[j].unicode_fontname)/sizeof(resident_table[j].unicode_fontname[0]);
+ for (i = 0;
+ i < sizeof(resident_table[j].unicode_fontname)/sizeof(resident_table[j].unicode_fontname[0]);
i++) {
dprintf1("%c", (char)resident_table[j].unicode_fontname[i]);
}
@@ -215,7 +211,7 @@ pl_check_fonts(pl_dict_t *pfontdict, bool use_unicode_names_for_keys)
int
pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontdict,
- gs_font_dir *pdir, int storage, bool use_unicode_names_for_keys)
+ gs_font_dir *pdir, int storage, bool use_unicode_names_for_keys)
{
int i, k;
UW16 bSize, status = 0;
@@ -226,7 +222,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontd
char **plugins;
/* don't load fonts more than once */
if (pl_dict_length(pfontdict, true) > 0)
- return true;
+ return true;
pl_ufst_root_dir(ufst_root_dir, sizeof(ufst_root_dir));
@@ -234,7 +230,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontd
if (!plugins_opened) {
- gx_UFST_close_static_fcos();
+ gx_UFST_close_static_fcos();
plugins = pl_ufst_get_list(mem, "UFSTPLUGINS", UFSTPLUGINS);
for (k = 0; plugins[k]; k++) {
strcpy((char *)pthnm, ufst_root_dir);
@@ -265,15 +261,15 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontd
*/
fcos = pl_ufst_get_list(mem, "UFSTFCOS", UFSTFCOS);
for (k = 0; fcos[k]; k++) {
- SW16 fcoHandle;
+ SW16 fcoHandle;
/* build and open (get handle) for the k'th fco file name */
strcpy((char *)pthnm, ufst_root_dir);
strcat((char *)pthnm, fcos[k]);
-
- fcoHandle = gx_UFST_find_fco_handle_by_name(pthnm);
- if (fcoHandle == 0 &&
- (status = gx_UFST_open_static_fco(pthnm, &fcoHandle)) != 0) {
+ fcoHandle = gx_UFST_find_fco_handle_by_name(pthnm);
+
+ if (fcoHandle == 0 &&
+ (status = gx_UFST_open_static_fco(pthnm, &fcoHandle)) != 0) {
dprintf2("CGIFfco_Open error %d for %s\n", status, pthnm);
continue;
}
@@ -324,7 +320,7 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontd
#endif
/* Record the differing points per inch value
for Intellifont derived fonts. */
-
+
if (pfDesc->scaleFactor == 8782) {
plfont->pts_per_inch = 72.307;
pitch_cp = (pfDesc->spaceBand * 100 * 72.0)
@@ -372,9 +368,9 @@ pl_load_built_in_fonts(const char *pathname, gs_memory_t *mem, pl_dict_t *pfontd
#endif
return TRUE;
}
-
+
int
-pl_load_ufst_lineprinter(gs_memory_t *mem, pl_dict_t *pfontdict, gs_font_dir *pdir,
+pl_load_ufst_lineprinter(gs_memory_t *mem, pl_dict_t *pfontdict, gs_font_dir *pdir,
int storage, bool use_unicode_names_for_keys)
{
int i;
@@ -392,12 +388,11 @@ pl_load_ufst_lineprinter(gs_memory_t *mem, pl_dict_t *pfontdict, gs_font_dir *pd
return -1;
if (pl_fill_in_font(pfont, pplfont, pdir, mem, "lineprinter fonts") < 0)
return -1;
-
+
pl_fill_in_bitmap_font(pfont, gs_next_ids(mem, 1));
pplfont->params = resident_table[i].params;
memcpy(pplfont->character_complement, resident_table[i].character_complement, 8);
-
if ( use_unicode_names_for_keys )
pl_dict_put(pfontdict, resident_table[i].unicode_fontname, 32, pplfont );
else {
@@ -414,13 +409,13 @@ pl_load_ufst_lineprinter(gs_memory_t *mem, pl_dict_t *pfontdict, gs_font_dir *pd
pplfont->is_xl_format = false;
pplfont->resolution.x = pplfont->resolution.y = 300;
- code = pl_font_alloc_glyph_table(pplfont, 256, mem,
+ code = pl_font_alloc_glyph_table(pplfont, 256, mem,
"pl_load_ufst_lineprinter pplfont (glyph table)");
if ( code < 0 )
return code;
while (1) {
-
+
uint width = pl_get_uint16(char_data + 12);
uint height = pl_get_uint16(char_data + 14);
uint ccode_plus_header_plus_data = 2 + 16 + (((width + 7) >> 3) * height);
diff --git a/pl/plvocab.c b/pl/plvocab.c
index 471a17285..9d68636a9 100644
--- a/pl/plvocab.c
+++ b/pl/plvocab.c
@@ -234,7 +234,7 @@ static const pl_glyph_mapping_t pl_map_m2u[] = {
{206, 0x2666}, /* Solid Diamond */
{207, 0x2663}, /* Solid Club */
{208, 0x2660}, /* Solid Spade */
- {209, 0x2022}, /* Medium Solid Bullet */ /* (PC), 0x25CF (other) */
+ {209, 0x2022}, /* Medium Solid Bullet */ /* (PC), 0x25CF (other) */
{210, 0x25D8}, /* Large Solid Sq/Open Dot */
{211, 0x25CB}, /* Large Open Bullet */ /* (PC only) */
{212, 0x25D9}, /* Large Solid Sq/Open Ring */
@@ -344,7 +344,7 @@ static const pl_glyph_mapping_t pl_map_m2u[] = {
{317, 0x02CA}, /* Uppercase Acute */
{318, 0x02CB}, /* Uppercase Grave */
{319, 0x02C6}, /* Uppercase Circumflex */
- {320, 0x00A8}, /* Uppercase Dieresis */
+ {320, 0x00A8}, /* Uppercase Dieresis */
{321, 0x02DC}, /* Uppercase Tilde */
{322, 0x02C7}, /* Uppercase Hacek */
{323, 0x02DA}, /* Uppercase Ring */
@@ -500,7 +500,7 @@ static const pl_glyph_mapping_t pl_map_m2u[] = {
{555, 0x21D5}, /* Up/Dn Arrow Dbl Stroke */
{556, 0x21D4}, /* Lft/Rt Arrow Dbl Stroke */
{557, 0x21C4}, /* Right Over Left Arrow */
- {558, 0x21C6}, /* Left Over Right Arrow */
+ {558, 0x21C6}, /* Left Over Right Arrow */
{559, 0xEFE9}, /* Vector Symbol */
{560, 0xEFEA}, /* Overline, Composite */
{561, 0x2200}, /* For All Symbol */
@@ -641,7 +641,7 @@ static const pl_glyph_mapping_t pl_map_m2u[] = {
{1036, 0x211E}, /* Prescription Sign */
{1040, 0xF001}, /* Lowercase FI Ligature */ /* u */
{1041, 0xF002}, /* Lowercase FL Ligature */ /* u */
- {1042, 0xFB00}, /* Lowercase FF Ligature */
+ {1042, 0xFB00}, /* Lowercase FF Ligature */
{1043, 0xFB03}, /* Lowercase FFI Ligature */
{1044, 0xFB04}, /* Lowercase ffl Ligature */
{1045, 0x02DD}, /* Uppercase Dbl Acute */
@@ -1157,7 +1157,7 @@ static const pl_glyph_mapping_t pl_map_u2m[] = {
{0x0143, 446}, /* Nacute */
{0x0144, 447}, /* nacute */
{0x0145, 450}, /* Ncomma (NEW) */
- {0x0146, 451}, /* ncomma (NEW) */
+ {0x0146, 451}, /* ncomma (NEW) */
{0x0147, 448}, /* Ncaron */
{0x0148, 449}, /* ncaron */
{0x0149, 309}, /* apostrophe_n */
@@ -1679,7 +1679,6 @@ static const pl_glyph_mapping_t pl_map_u2m[] = {
{0x27BD, 2104}, /* a190 */
{0x27BE, 2212}, /* a191 */
-
{0x301A, 643}, /* (NEW) */
{0x301B, 645}, /* (NEW) */
@@ -1769,7 +1768,6 @@ static const pl_glyph_mapping_t pl_map_u2m[] = {
{0xEFFC, 653}, /* (NEW) */
{0xEFFD, 211}, /* (NEW) */
-
{0xEFFE, 640}, /* (NEW) */
{0xEFFF, 623}, /* (NEW) */
diff --git a/psi/psitop.c b/psi/psitop.c
index 04d46582b..107222703 100755..100644
--- a/psi/psitop.c
+++ b/psi/psitop.c
@@ -92,7 +92,6 @@ ps_impl_characteristics(
return &ps_characteristics;
}
-
/* Don't need to do anything to PS interpreter */
static int /* ret 0 ok, else -ve error code */
ps_impl_allocate_interp(
@@ -112,7 +111,7 @@ ps_impl_allocate_interp(
plugins the root data directory. These are internally separated with
':' but environment variable use the gp separator */
#ifndef UFSTFONTDIR
- /* not using UFST */
+ /* not using UFST */
# define UFSTFONTDIR ""
#endif
@@ -129,109 +128,108 @@ ps_impl_allocate_interp_instance(
#else
# define MAX_ARGS /* unspecified */
#endif
- int code = 0, exit_code;
- const char *argv[MAX_ARGS] = {
- "",
- "-dNOPAUSE",
+ int code = 0, exit_code;
+ const char *argv[MAX_ARGS] = {
+ "",
+ "-dNOPAUSE",
#ifndef DEBUG
- "-dQUIET",
+ "-dQUIET",
#else
- "-dOSTACKPRINT", // NB: debuggging postscript Needs to be removed.
- "-dESTACKPRINT", // NB: debuggging postscript Needs to be removed.
+ "-dOSTACKPRINT", // NB: debuggging postscript Needs to be removed.
+ "-dESTACKPRINT", // NB: debuggging postscript Needs to be removed.
#endif
#if UFST_BRIDGE==1
- "-dJOBSERVER",
- "-sUFST_PlugIn=" UFSTFONTDIR "mtfonts/pcl45/mt3/plug__xi.fco",
+ "-dJOBSERVER",
+ "-sUFST_PlugIn=" UFSTFONTDIR "mtfonts/pcl45/mt3/plug__xi.fco",
"-sFCOfontfile=" UFSTFONTDIR "mtfonts/pclps2/mt3/pclp2_xj.fco",
"-sFCOfontfile2=" UFSTFONTDIR "mtfonts/pcl45/mt3/wd____xh.fco",
- "-sFAPIfontmap=FCOfontmap-PCLPS2",
- "-sFAPIconfig=FAPIconfig-FCO",
+ "-sFAPIfontmap=FCOfontmap-PCLPS2",
+ "-sFAPIconfig=FAPIconfig-FCO",
#endif
- 0
- };
+ 0
+ };
#ifndef DEBUG
- int argc = 9;
+ int argc = 9;
#else
- int argc = 10;
+ int argc = 10;
#endif
#ifdef DEBUG_WITH_EXPERIMENTAL_GSOPTIONS_FILE
- char argbuf[1024];
+ char argbuf[1024];
#endif
# undef MAX_ARGS
- ps_interp_instance_t *psi /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
- = (ps_interp_instance_t *)
- gs_alloc_bytes( mem,
- sizeof(ps_interp_instance_t),
- "ps_allocate_interp_instance(ps_interp_instance_t)"
- );
+ ps_interp_instance_t *psi /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
+ = (ps_interp_instance_t *)
+ gs_alloc_bytes( mem,
+ sizeof(ps_interp_instance_t),
+ "ps_allocate_interp_instance(ps_interp_instance_t)"
+ );
#if UFST_BRIDGE!=1
argc -= 6;
#endif
-
- /* If allocation error, deallocate & return */
- if (!psi) {
- return gs_error_VMerror;
- }
- /* Initialize for pl_main_universe_dnit/pl_deallocate_interp_instance
- in case of gs_main_init_with_args returns with error code. */
- psi->pl.interp = interp;
- /* Setup pointer to mem used by PostScript */
- psi->plmemory = mem;
- psi->minst = gs_main_alloc_instance(mem->non_gc_memory);
+ /* If allocation error, deallocate & return */
+ if (!psi) {
+ return gs_error_VMerror;
+ }
+ /* Initialize for pl_main_universe_dnit/pl_deallocate_interp_instance
+ in case of gs_main_init_with_args returns with error code. */
+ psi->pl.interp = interp;
+ /* Setup pointer to mem used by PostScript */
+ psi->plmemory = mem;
+ psi->minst = gs_main_alloc_instance(mem->non_gc_memory);
#ifdef DEBUG_WITH_EXPERIMENTAL_GSOPTIONS_FILE
- { /* Fetch more GS arguments (debug purposes only).
- Pulling debugging arguments from a file allows easy additions
- of postscript arguments to a debug system, it is not recommended for
- production systems since some options will conflict with commandline
- arguments in unpleasant ways.
- */
- FILE *f = fopen("gsoptions", "rb"); /* Sorry we handle
- the current directory only.
- Assuming it always fails with no crash
- in a real embedded system. */
-
- if (f != NULL) {
- int i;
- int l = fread(argbuf, 1, sizeof(argbuf) - 1, f);
-
- if (l >= sizeof(argbuf) - 1)
- errprintf("The gsoptions file is too big. Truncated to the buffer length %d.\n", l - 1);
- if (l > 0) {
- argbuf[l] = 0;
- if (argbuf[0] && argbuf[0] != '\r' && argbuf[0] != '\n') /* Silently skip empty lines. */
- argv[argc++] = argbuf;
- for (i = 0; i < l; i++)
- if (argbuf[i] == '\r' || argbuf[i] == '\n') {
- argbuf[i] = 0;
- if (argbuf[i + 1] == 0 || argbuf[i + 1] == '\r' || argbuf[i + 1] == '\n')
- continue; /* Silently skip empty lines. */
- if (argc >= count_of(argv)) {
- errprintf("The gsoptions file contains too many options. "
- "Truncated to the buffer length %d.\n", argc);
- break;
- }
- argv[argc++] = argbuf + i + 1;
- }
- }
- fclose(f);
- }
- }
+ { /* Fetch more GS arguments (debug purposes only).
+ Pulling debugging arguments from a file allows easy additions
+ of postscript arguments to a debug system, it is not recommended for
+ production systems since some options will conflict with commandline
+ arguments in unpleasant ways.
+ */
+ FILE *f = fopen("gsoptions", "rb"); /* Sorry we handle
+ the current directory only.
+ Assuming it always fails with no crash
+ in a real embedded system. */
+
+ if (f != NULL) {
+ int i;
+ int l = fread(argbuf, 1, sizeof(argbuf) - 1, f);
+
+ if (l >= sizeof(argbuf) - 1)
+ errprintf("The gsoptions file is too big. Truncated to the buffer length %d.\n", l - 1);
+ if (l > 0) {
+ argbuf[l] = 0;
+ if (argbuf[0] && argbuf[0] != '\r' && argbuf[0] != '\n') /* Silently skip empty lines. */
+ argv[argc++] = argbuf;
+ for (i = 0; i < l; i++)
+ if (argbuf[i] == '\r' || argbuf[i] == '\n') {
+ argbuf[i] = 0;
+ if (argbuf[i + 1] == 0 || argbuf[i + 1] == '\r' || argbuf[i + 1] == '\n')
+ continue; /* Silently skip empty lines. */
+ if (argc >= count_of(argv)) {
+ errprintf("The gsoptions file contains too many options. "
+ "Truncated to the buffer length %d.\n", argc);
+ break;
+ }
+ argv[argc++] = argbuf + i + 1;
+ }
+ }
+ fclose(f);
+ }
+ }
#endif
- *instance = (pl_interp_instance_t *)psi;
- code = gs_main_init_with_args(psi->minst, argc, (char**)argv);
- if (code<0)
- return code;
+ *instance = (pl_interp_instance_t *)psi;
+ code = gs_main_init_with_args(psi->minst, argc, (char**)argv);
+ if (code<0)
+ return code;
+
+ /* General init of PS interp instance */
- /* General init of PS interp instance */
-
- if ((code = gs_main_run_string_begin(psi->minst, 0, &exit_code, &psi->minst->error_object)) < 0)
- return exit_code;
+ if ((code = gs_main_run_string_begin(psi->minst, 0, &exit_code, &psi->minst->error_object)) < 0)
+ return exit_code;
- {
+ {
gs_state *pgs = psi->minst->i_ctx_p->pgs;
gsicc_init_iccmanager(pgs);
}
@@ -241,8 +239,8 @@ ps_impl_allocate_interp_instance(
/* default is a postscript stream */
psi->pdf_stream = false;
- /* Return success */
- return 0;
+ /* Return success */
+ return 0;
}
/* NB this pointer should be placed in the ps instance */
@@ -255,7 +253,7 @@ ps_impl_set_client_instance(
pl_interp_instance_clients_t which_client
)
{
- return 0;
+ return 0;
}
/* Set an interpreter instance's pre-page action */
@@ -280,10 +278,10 @@ ps_impl_set_post_page_action(
void *closure /* closure to call action with */
)
{
- ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
- psi->post_page_action = action;
- psi->post_page_closure = closure;
- return 0;
+ ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
+ psi->post_page_action = action;
+ psi->post_page_closure = closure;
+ return 0;
}
/* Set a device into an interpreter instance */
@@ -305,7 +303,7 @@ ps_impl_set_device(
/* Set the device into the gstate */
code = gs_setdevice_no_erase(pgs, device);
if (code >= 0 )
- code = gs_erasepage(pgs);
+ code = gs_erasepage(pgs);
if (code < 0)
return code;
@@ -325,10 +323,10 @@ ps_impl_set_device(
return exit_code;
}
-/* fetch the gs_memory_t ptr so that the device and ps use the same
+/* fetch the gs_memory_t ptr so that the device and ps use the same
* garbage collection aware a memory
*/
-static int
+static int
ps_impl_get_device_memory(
pl_interp_instance_t *instance, /* interp instance to use */
gs_memory_t **pmem)
@@ -348,11 +346,11 @@ gs_main_instance *ps_impl_get_minst( const gs_memory_t *mem )
ps_interp_instance_t *psi = (ps_interp_instance_t *)get_interpreter_from_memory(mem);
return psi->minst;
}
-
+
/* Prepare interp instance for the next "job" */
static int /* ret 0 ok, else -ve error code */
ps_impl_init_job(
- pl_interp_instance_t *instance /* interp instance to start job in */
+ pl_interp_instance_t *instance /* interp instance to start job in */
)
{
ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
@@ -368,8 +366,8 @@ ps_impl_init_job(
/* Parse a buffer full of data */
static int /* ret 0 or +ve if ok, else -ve error code */
ps_impl_process(
- pl_interp_instance_t *instance, /* interp instance to process data job in */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to process data job in */
+ stream_cursor_read *cursor /* data to process */
)
{
ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
@@ -410,7 +408,7 @@ ps_impl_process(
/* we only check for pdf at the beginning of the job */
psi->fresh_job = false;
}
-
+
/* for a pdf stream we append to the open pdf file but for
postscript we hand it directly to the ps interpreter. PDF
files are processed subsequently, at end job time */
@@ -434,7 +432,7 @@ ps_impl_process(
cursor->ptr += avail;
/* flush stdout on error. */
if (code < 0)
- zflush(psi->minst->i_ctx_p);
+ zflush(psi->minst->i_ctx_p);
/* return the exit code */
return code;
}
@@ -442,33 +440,33 @@ ps_impl_process(
/* Skip to end of job ret 1 if done, 0 ok but EOJ not found, else -ve error code */
static int
ps_impl_flush_to_eoj(
- pl_interp_instance_t *instance, /* interp instance to flush for */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to flush for */
+ stream_cursor_read *cursor /* data to process */
)
{
- const byte *p = cursor->ptr;
- const byte *rlimit = cursor->limit;
-
- /* Skip to, but leave UEL in buffer for PJL to find later */
- for (; p < rlimit; ++p)
- if (p[1] == '\033') {
- uint avail = rlimit - p;
-
- if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
- continue;
- if (avail < 9)
- break;
- cursor->ptr = p;
- return 1; /* found eoj */
- }
- cursor->ptr = p;
- return 0; /* need more */
+ const byte *p = cursor->ptr;
+ const byte *rlimit = cursor->limit;
+
+ /* Skip to, but leave UEL in buffer for PJL to find later */
+ for (; p < rlimit; ++p)
+ if (p[1] == '\033') {
+ uint avail = rlimit - p;
+
+ if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
+ continue;
+ if (avail < 9)
+ break;
+ cursor->ptr = p;
+ return 1; /* found eoj */
+ }
+ cursor->ptr = p;
+ return 0; /* need more */
}
/* Parser action for end-of-file */
static int /* ret 0 or +ve if ok, else -ve error code */
ps_impl_process_eof(
- pl_interp_instance_t *instance /* interp instance to process data job in */
+ pl_interp_instance_t *instance /* interp instance to process data job in */
)
{
int code = 0;
@@ -479,9 +477,9 @@ ps_impl_process_eof(
/* Report any errors after running a job */
static int /* ret 0 ok, else -ve error code */
ps_impl_report_errors(pl_interp_instance_t *instance, /* interp instance to wrap up job in */
- int code, /* prev termination status */
- long file_position, /* file position of error, -1 if unknown */
- bool force_to_cout /* force errors to cout */
+ int code, /* prev termination status */
+ long file_position, /* file position of error, -1 if unknown */
+ bool force_to_cout /* force errors to cout */
)
{
/* ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
@@ -492,10 +490,10 @@ ps_impl_report_errors(pl_interp_instance_t *instance, /* interp instance to
/* Wrap up interp instance after a "job" */
static int /* ret 0 ok, else -ve error code */
ps_impl_dnit_job(
- pl_interp_instance_t *instance /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance /* interp instance to wrap up job in */
)
{
- int code = 0;
+ int code = 0;
int exit_code = 0;
static const char *buf = "\n.endjob\n"; /* restore to initial state, non-encapsualted */
ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
@@ -503,20 +501,20 @@ ps_impl_dnit_job(
/* take care of a stored pdf file */
if ( psi->pdf_stream ) {
- /*
+ /*
* Hex encode to avoid problems with window's directory
- * separators '\' being interpreted in postscript as escape
- * sequences. The buffer length is the maximum file name size
- * (gp_file_name_sizeof) * 2 (hex encoding) + 2 (hex
- * delimiters '<' and '>') + the rest of the run command 7
- * (space + (run) + new line + null).
- */
+ * separators '\' being interpreted in postscript as escape
+ * sequences. The buffer length is the maximum file name size
+ * (gp_file_name_sizeof) * 2 (hex encoding) + 2 (hex
+ * delimiters '<' and '>') + the rest of the run command 7
+ * (space + (run) + new line + null).
+ */
char buf[gp_file_name_sizeof * 2 + 2 + 7];
const char *run_str = " run\n";
const char *hex_digits = "0123456789ABCDEF";
char *pd = buf; /* destination */
const char *ps = psi->pdf_file_name; /* source */
-
+
*pd = '<'; pd++;
while (*ps) {
*pd = hex_digits[*ps >> 4 ]; pd++;
@@ -551,7 +549,7 @@ ps_impl_dnit_job(
gsapi_run_string_begin(psi->plmemory->gs_lib_ctx, 0, &exit_code); /* prepare to send .endjob */
gsapi_run_string_continue(psi->plmemory->gs_lib_ctx, buf, strlen(buf), 0, &exit_code); /* .endjob */
/* Note the above will restore to the server save level and will not be encapsulated */
-
+
/* Flush stdout. */
zflush(psi->minst->i_ctx_p);
@@ -573,7 +571,7 @@ ps_impl_remove_device(
int code = gs_nulldevice(pgs);
if ( code < 0 )
- dprintf1("error code %d installing nulldevice, continuing\n", code );
+ dprintf1("error code %d installing nulldevice, continuing\n", code );
return 0;
}
@@ -583,18 +581,18 @@ ps_impl_deallocate_interp_instance(
pl_interp_instance_t *instance /* instance to dealloc */
)
{
- int code = 0, exit_code;
- ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
- gs_memory_t *mem = psi->plmemory;
-
- /* do total dnit of interp state */
- code = gsapi_run_string_end(mem->gs_lib_ctx, 0, &exit_code);
+ int code = 0, exit_code;
+ ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
+ gs_memory_t *mem = psi->plmemory;
+
+ /* do total dnit of interp state */
+ code = gsapi_run_string_end(mem->gs_lib_ctx, 0, &exit_code);
- gsapi_exit(psi->minst);
+ gsapi_exit(psi->minst);
- gs_free_object(mem, psi, "ps_impl_deallocate_interp_instance(ps_interp_instance_t)");
+ gs_free_object(mem, psi, "ps_impl_deallocate_interp_instance(ps_interp_instance_t)");
- return (code < 0) ? exit_code : 0;
+ return (code < 0) ? exit_code : 0;
}
/* Do static deinit of PS interpreter */
@@ -603,11 +601,11 @@ ps_impl_deallocate_interp(
pl_interp_t *interp /* interpreter to deallocate */
)
{
- /* nothing to do */
- return 0;
+ /* nothing to do */
+ return 0;
}
-/*
+/*
* End-of-page called back by PS
*/
int
@@ -617,16 +615,16 @@ ps_end_page_top(const gs_memory_t *mem, int num_copies, bool flush)
ps_interp_instance_t *psi = (ps_interp_instance_t *)instance;
int code = 0;
- if (psi == 0)
- return 0;
+ if (psi == 0)
+ return 0;
/* do pre-page action */
if (psi->pre_page_action) {
code = psi->pre_page_action(instance, psi->pre_page_closure);
if (code < 0)
- return code;
+ return code;
if (code != 0)
- return 0; /* code > 0 means abort w/no error */
+ return 0; /* code > 0 means abort w/no error */
}
/* output the page */
@@ -641,7 +639,7 @@ ps_end_page_top(const gs_memory_t *mem, int num_copies, bool flush)
if (psi->post_page_action) {
code = psi->post_page_action(instance, psi->post_page_closure);
if (code < 0)
- return code;
+ return code;
}
return 0;
@@ -668,4 +666,3 @@ const pl_interp_implementation_t ps_implementation = {
ps_impl_deallocate_interp,
ps_impl_get_device_memory,
};
-
diff --git a/pxl/pxasm.ps b/pxl/pxasm.ps
index 8c8e73450..115993560 100644
--- a/pxl/pxasm.ps
+++ b/pxl/pxasm.ps
@@ -43,7 +43,7 @@ bind def
( pxa) anchorsearch
{ pop ( = ) search
{ exch pop exch (,) search pop exch pop exch pop cvi
- 3 -1 roll pop exch
+ 3 -1 roll pop exch
}
{ (,) search pop exch pop exch pop
}
@@ -65,13 +65,13 @@ loop pop closefile
(,) search { exch pop exch pop } if
dup ( e) anchorsearch
{ pop pop token pop exch
- % Stack: file value name rest
+ % Stack: file value name rest
token
{ % The token must be an '='.
- pop token pop exch pop 3 -1 roll pop exch
+ pop token pop exch pop 3 -1 roll pop exch
}
if
- % Stack: file value name
+ % Stack: file value name
1 index .defenum 1 add
}
{ pop pop
diff --git a/pxl/pxbfont.c b/pxl/pxbfont.c
index d48664542..250f9a0f2 100644
--- a/pxl/pxbfont.c
+++ b/pxl/pxbfont.c
@@ -15,7 +15,7 @@
#include "pxbfont.h"
const byte px_bitmap_font_char_data[] = {
- 34 /* " */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 23, 0, 14, 0, 92,
+ 34 /* " */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 23, 0, 14, 0, 92,
1,252,254,
1,252,254,
0,248,124,
@@ -30,7 +30,7 @@ const byte px_bitmap_font_char_data[] = {
0,112,56,
0,112,56,
0,112,56,
- 40 /* ( */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 23, 0, 36, 0, 92,
+ 40 /* ( */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 23, 0, 36, 0, 92,
0,0,6,
0,0,14,
0,0,12,
@@ -67,7 +67,7 @@ const byte px_bitmap_font_char_data[] = {
0,0,12,
0,0,14,
0,0,6,
- 41 /* ) */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 16, 0, 36, 0, 64,
+ 41 /* ) */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 16, 0, 36, 0, 64,
1,128,
0,192,
0,224,
@@ -104,10 +104,10 @@ const byte px_bitmap_font_char_data[] = {
0,224,
0,192,
1,128,
- 45 /* - */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 15, 0, 26, 0, 2, 0, 104,
+ 45 /* - */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 15, 0, 26, 0, 2, 0, 104,
15,255,255,192,
15,255,255,192,
- 47 /* / */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 33, 0, 24, 0, 37, 0, 96,
+ 47 /* / */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 33, 0, 24, 0, 37, 0, 96,
0,0,3,
0,0,3,
0,0,7,
@@ -145,7 +145,7 @@ const byte px_bitmap_font_char_data[] = {
3,128,0,
3,0,0,
3,0,0,
- 48 /* 0 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 32, 0, 96,
+ 48 /* 0 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 32, 0, 96,
0,15,192,
0,63,240,
0,120,120,
@@ -178,7 +178,7 @@ const byte px_bitmap_font_char_data[] = {
0,120,120,
0,31,224,
0,15,192,
- 49 /* 1 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
+ 49 /* 1 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
0,7,0,
0,127,0,
3,251,0,
@@ -209,7 +209,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,
3,255,255,
3,255,255,
- 50 /* 2 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 31, 0, 96,
+ 50 /* 2 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 31, 0, 96,
0,15,128,
0,127,240,
0,240,120,
@@ -241,7 +241,7 @@ const byte px_bitmap_font_char_data[] = {
12,0,3,
15,255,255,
15,255,255,
- 51 /* 3 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 32, 0, 100,
+ 51 /* 3 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 32, 0, 100,
0,15,192,0,
0,127,240,0,
0,240,60,0,
@@ -274,7 +274,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,124,0,
0,127,240,0,
0,31,192,0,
- 52 /* 4 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
+ 52 /* 4 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
0,0,248,
0,0,248,
0,1,152,
@@ -305,7 +305,7 @@ const byte px_bitmap_font_char_data[] = {
0,0,24,
0,3,255,
0,3,255,
- 53 /* 5 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 25, 0, 31, 0, 100,
+ 53 /* 5 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 25, 0, 31, 0, 100,
1,255,254,0,
1,255,254,0,
1,128,0,0,
@@ -337,7 +337,7 @@ const byte px_bitmap_font_char_data[] = {
1,240,56,0,
0,127,240,0,
0,15,192,0,
- 54 /* 6 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 32, 0, 100,
+ 54 /* 6 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 32, 0, 100,
0,0,63,0,
0,1,255,128,
0,3,193,128,
@@ -370,7 +370,7 @@ const byte px_bitmap_font_char_data[] = {
0,28,28,0,
0,15,248,0,
0,3,240,0,
- 55 /* 7 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
+ 55 /* 7 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 24, 0, 30, 0, 96,
7,255,255,
7,255,255,
6,0,3,
@@ -401,7 +401,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,
0,3,0,
0,3,0,
- 56 /* 8 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 32, 0, 96,
+ 56 /* 8 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 24, 0, 32, 0, 96,
0,15,192,
0,63,240,
0,112,56,
@@ -434,7 +434,7 @@ const byte px_bitmap_font_char_data[] = {
0,112,56,
0,63,240,
0,15,192,
- 57 /* 9 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 26, 0, 32, 0, 104,
+ 57 /* 9 */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 26, 0, 32, 0, 104,
0,7,192,0,
0,31,240,0,
0,56,56,0,
@@ -467,7 +467,7 @@ const byte px_bitmap_font_char_data[] = {
1,131,192,0,
1,255,128,0,
0,124,0,0,
- 58 /* : */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 19, 0, 22, 0, 76,
+ 58 /* : */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 19, 0, 22, 0, 76,
0,7,128,
0,15,192,
0,31,224,
@@ -490,7 +490,7 @@ const byte px_bitmap_font_char_data[] = {
0,31,224,
0,15,192,
0,7,128,
- 59 /* ; */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 17, 0, 28, 0, 68,
+ 59 /* ; */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 17, 0, 28, 0, 68,
0,15,0,
0,31,128,
0,63,128,
@@ -519,7 +519,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,0,
1,192,0,
1,192,0,
- 63 /* ? */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 24, 0, 30, 0, 96,
+ 63 /* ? */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 24, 0, 30, 0, 96,
0,15,224,
0,127,248,
1,240,60,
@@ -550,7 +550,7 @@ const byte px_bitmap_font_char_data[] = {
0,15,224,
0,15,192,
0,7,128,
- 65 /* A */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
+ 65 /* A */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
7,255,128,0,
7,255,128,0,
0,13,128,0,
@@ -579,7 +579,7 @@ const byte px_bitmap_font_char_data[] = {
12,0,0,192,
127,192,31,248,
127,224,31,248,
- 66 /* B */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
+ 66 /* B */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
63,255,240,0,
63,255,252,0,
3,0,30,0,
@@ -608,7 +608,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,7,128,
63,255,255,0,
63,255,252,0,
- 67 /* C */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 30, 0, 108,
+ 67 /* C */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 30, 0, 108,
0,15,224,0,
0,63,248,192,
0,240,62,192,
@@ -639,7 +639,7 @@ const byte px_bitmap_font_char_data[] = {
0,120,30,0,
0,63,252,0,
0,7,224,0,
- 68 /* D */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
+ 68 /* D */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
63,255,192,0,
63,255,240,0,
6,0,56,0,
@@ -668,7 +668,7 @@ const byte px_bitmap_font_char_data[] = {
6,0,120,0,
63,255,240,0,
63,255,192,0,
- 69 /* E */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
+ 69 /* E */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
63,255,255,128,
63,255,255,128,
3,0,1,128,
@@ -697,7 +697,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,0,192,
63,255,255,192,
63,255,255,192,
- 70 /* F */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
+ 70 /* F */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
63,255,255,192,
63,255,255,192,
3,0,0,192,
@@ -726,7 +726,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,0,0,
63,255,128,0,
63,255,128,0,
- 71 /* G */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 28, 0, 30, 0, 112,
+ 71 /* G */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 28, 0, 30, 0, 112,
0,15,224,0,
0,63,252,192,
0,248,30,192,
@@ -757,7 +757,7 @@ const byte px_bitmap_font_char_data[] = {
0,248,15,128,
0,63,254,0,
0,7,240,0,
- 72 /* H */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
+ 72 /* H */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
15,240,63,192,
15,240,63,192,
3,0,3,0,
@@ -786,7 +786,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,3,0,
31,240,63,224,
31,240,63,224,
- 73 /* I */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 24, 0, 28, 0, 96,
+ 73 /* I */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 24, 0, 28, 0, 96,
3,255,255,
3,255,255,
0,3,0,
@@ -815,7 +815,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,
3,255,255,
3,255,255,
- 74 /* J */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 29, 0, 116,
+ 74 /* J */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 29, 0, 116,
0,15,255,248,
0,15,255,248,
0,0,6,0,
@@ -845,7 +845,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,240,0,
0,255,224,0,
0,63,128,0,
- 75 /* K */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
+ 75 /* K */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
63,248,31,224,
63,248,31,224,
3,0,3,128,
@@ -874,7 +874,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,3,0,
63,248,3,240,
63,248,1,240,
- 76 /* L */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
+ 76 /* L */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
31,255,128,0,
31,255,128,0,
0,96,0,0,
@@ -903,7 +903,7 @@ const byte px_bitmap_font_char_data[] = {
0,96,0,96,
31,255,255,224,
31,255,255,224,
- 77 /* M */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
+ 77 /* M */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
127,0,1,248,
127,0,3,248,
15,0,3,96,
@@ -932,7 +932,7 @@ const byte px_bitmap_font_char_data[] = {
12,0,0,96,
127,224,15,248,
127,224,15,248,
- 78 /* N */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
+ 78 /* N */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
127,0,63,240,
127,128,63,240,
7,128,1,128,
@@ -961,7 +961,7 @@ const byte px_bitmap_font_char_data[] = {
6,0,7,128,
63,240,3,128,
63,240,3,128,
- 79 /* O */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 30, 0, 108,
+ 79 /* O */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 30, 0, 108,
0,15,192,0,
0,63,240,0,
0,240,60,0,
@@ -992,7 +992,7 @@ const byte px_bitmap_font_char_data[] = {
0,240,60,0,
0,63,240,0,
0,15,192,0,
- 80 /* P */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 28, 0, 100,
+ 80 /* P */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 28, 0, 100,
63,255,224,0,
63,255,248,0,
3,0,28,0,
@@ -1021,7 +1021,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,0,0,
63,255,0,0,
63,255,0,0,
- 81 /* Q */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 35, 0, 108,
+ 81 /* Q */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 27, 0, 35, 0, 108,
0,15,192,0,
0,63,240,0,
0,240,60,0,
@@ -1057,7 +1057,7 @@ const byte px_bitmap_font_char_data[] = {
0,255,248,224,
1,248,63,192,
0,128,15,0,
- 82 /* R */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
+ 82 /* R */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
63,255,224,0,
63,255,248,0,
3,0,30,0,
@@ -1086,7 +1086,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,0,192,
63,248,0,248,
63,248,0,120,
- 83 /* S */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 25, 0, 30, 0, 100,
+ 83 /* S */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 29, 0, 25, 0, 30, 0, 100,
0,15,192,0,
0,63,243,0,
0,240,59,0,
@@ -1117,7 +1117,7 @@ const byte px_bitmap_font_char_data[] = {
6,240,60,0,
6,63,248,0,
0,15,224,0,
- 84 /* T */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
+ 84 /* T */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 26, 0, 28, 0, 104,
15,255,255,192,
15,255,255,192,
12,3,0,192,
@@ -1146,7 +1146,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,0,
0,255,252,0,
0,255,252,0,
- 85 /* U */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 29, 0, 112,
+ 85 /* U */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 29, 0, 112,
63,240,63,240,
63,240,63,240,
6,0,1,128,
@@ -1176,7 +1176,7 @@ const byte px_bitmap_font_char_data[] = {
0,240,60,0,
0,63,240,0,
0,15,192,0,
- 86 /* V */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
+ 86 /* V */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
127,224,31,248,
127,192,15,248,
12,0,0,192,
@@ -1205,7 +1205,7 @@ const byte px_bitmap_font_char_data[] = {
0,15,128,0,
0,7,128,0,
0,7,0,0,
- 87 /* W */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
+ 87 /* W */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 29, 0, 28, 0, 116,
127,224,31,248,
127,224,31,248,
24,0,0,96,
@@ -1234,7 +1234,7 @@ const byte px_bitmap_font_char_data[] = {
3,192,15,0,
3,192,15,0,
3,128,15,0,
- 88 /* X */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
+ 88 /* X */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 112,
31,224,31,224,
31,224,31,224,
7,0,3,128,
@@ -1263,7 +1263,7 @@ const byte px_bitmap_font_char_data[] = {
6,0,1,128,
63,224,31,240,
63,224,31,240,
- 89 /* Y */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
+ 89 /* Y */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 27, 0, 28, 0, 108,
31,224,31,224,
31,224,31,224,
7,0,3,128,
@@ -1292,7 +1292,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,0,
0,255,252,0,
0,255,254,0,
- 90 /* Z */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 28, 0, 100,
+ 90 /* Z */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 28, 0, 100,
3,255,255,0,
3,255,255,0,
3,0,7,0,
@@ -1321,10 +1321,10 @@ const byte px_bitmap_font_char_data[] = {
6,0,1,128,
7,255,255,128,
7,255,255,128,
- 95 /* _ */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 252, 0, 31, 0, 2, 0, 124,
+ 95 /* _ */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 252, 0, 31, 0, 2, 0, 124,
255,255,255,254,
255,255,255,254,
- 97 /* a */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 23, 0, 108,
+ 97 /* a */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 23, 0, 108,
0,15,192,0,
0,255,240,0,
3,248,120,0,
@@ -1348,7 +1348,7 @@ const byte px_bitmap_font_char_data[] = {
7,131,231,224,
3,255,135,224,
0,254,0,0,
- 98 /* b */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 31, 0, 108,
+ 98 /* b */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 31, 0, 108,
126,0,0,0,
126,0,0,0,
6,0,0,0,
@@ -1380,7 +1380,7 @@ const byte px_bitmap_font_char_data[] = {
126,56,30,0,
126,31,252,0,
0,7,224,0,
- 99 /* c */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 23, 0, 108,
+ 99 /* c */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 23, 0, 108,
0,15,224,0,
0,63,252,192,
0,248,62,192,
@@ -1404,7 +1404,7 @@ const byte px_bitmap_font_char_data[] = {
0,248,31,0,
0,127,252,0,
0,31,240,0,
- 100 /* d */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 29, 0, 31, 0, 116,
+ 100 /* d */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 29, 0, 31, 0, 116,
0,0,31,128,
0,0,31,128,
0,0,1,128,
@@ -1436,7 +1436,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,113,248,
0,127,225,248,
0,31,128,0,
- 101 /* e */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 26, 0, 23, 0, 104,
+ 101 /* e */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 26, 0, 23, 0, 104,
0,31,192,0,
0,127,240,0,
1,240,124,0,
@@ -1460,7 +1460,7 @@ const byte px_bitmap_font_char_data[] = {
0,240,63,0,
0,127,252,0,
0,31,240,0,
- 102 /* f */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
+ 102 /* f */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
0,0,255,128,
0,3,255,224,
0,7,0,0,
@@ -1491,7 +1491,7 @@ const byte px_bitmap_font_char_data[] = {
0,12,0,0,
7,255,255,0,
7,255,255,0,
- 103 /* g */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 28, 0, 31, 0, 112,
+ 103 /* g */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 28, 0, 31, 0, 112,
0,63,0,0,
0,255,195,240,
1,224,243,240,
@@ -1523,7 +1523,7 @@ const byte px_bitmap_font_char_data[] = {
0,0,60,0,
0,127,248,0,
0,127,224,0,
- 104 /* h */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
+ 104 /* h */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
63,0,0,0,
63,0,0,0,
3,0,0,0,
@@ -1554,7 +1554,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,3,0,
31,240,63,224,
31,240,63,224,
- 105 /* i */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 31, 0, 100,
+ 105 /* i */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 25, 0, 31, 0, 100,
0,6,0,0,
0,6,0,0,
0,6,0,0,
@@ -1586,7 +1586,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,0,
7,255,255,128,
7,255,255,128,
- 106 /* j */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 23, 0, 40, 0, 92,
+ 106 /* j */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 31, 0, 23, 0, 40, 0, 92,
0,0,48,
0,0,48,
0,0,48,
@@ -1627,7 +1627,7 @@ const byte px_bitmap_font_char_data[] = {
0,0,56,
0,255,240,
1,255,192,
- 107 /* k */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
+ 107 /* k */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 27, 0, 30, 0, 108,
31,128,0,0,
31,128,0,0,
1,128,0,0,
@@ -1658,7 +1658,7 @@ const byte px_bitmap_font_char_data[] = {
1,128,14,0,
31,128,63,224,
31,128,63,224,
- 108 /* l */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 25, 0, 30, 0, 100,
+ 108 /* l */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 30, 0, 25, 0, 30, 0, 100,
1,255,0,0,
1,255,0,0,
0,3,0,0,
@@ -1689,7 +1689,7 @@ const byte px_bitmap_font_char_data[] = {
0,3,0,0,
7,255,255,128,
7,255,255,128,
- 109 /* m */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 30, 0, 22, 0, 120,
+ 109 /* m */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 30, 0, 22, 0, 120,
0,48,15,0,
124,252,63,128,
125,198,113,192,
@@ -1712,7 +1712,7 @@ const byte px_bitmap_font_char_data[] = {
12,1,128,96,
127,1,224,124,
127,1,224,124,
- 110 /* n */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 22, 0, 108,
+ 110 /* n */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 22, 0, 108,
0,1,128,0,
31,15,240,0,
31,60,60,0,
@@ -1735,7 +1735,7 @@ const byte px_bitmap_font_char_data[] = {
3,0,3,0,
31,240,31,224,
31,240,31,224,
- 111 /* o */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 26, 0, 23, 0, 104,
+ 111 /* o */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 26, 0, 23, 0, 104,
0,31,224,0,
0,127,248,0,
0,240,124,0,
@@ -1759,7 +1759,7 @@ const byte px_bitmap_font_char_data[] = {
0,240,60,0,
0,127,248,0,
0,31,224,0,
- 112 /* p */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 31, 0, 108,
+ 112 /* p */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 31, 0, 108,
30,7,224,0,
126,31,252,0,
126,120,30,0,
@@ -1791,7 +1791,7 @@ const byte px_bitmap_font_char_data[] = {
6,0,0,0,
127,248,0,0,
127,248,0,0,
- 113 /* q */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 29, 0, 31, 0, 116,
+ 113 /* q */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 29, 0, 31, 0, 116,
0,31,128,0,
0,127,225,248,
1,224,121,248,
@@ -1823,7 +1823,7 @@ const byte px_bitmap_font_char_data[] = {
0,0,1,128,
0,0,127,248,
0,0,127,248,
- 114 /* r */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 22, 0, 108,
+ 114 /* r */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 27, 0, 22, 0, 108,
0,16,31,0,
7,240,63,128,
7,240,241,192,
@@ -1846,7 +1846,7 @@ const byte px_bitmap_font_char_data[] = {
0,48,0,0,
15,255,254,0,
15,255,254,0,
- 115 /* s */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 25, 0, 23, 0, 100,
+ 115 /* s */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 22, 0, 25, 0, 23, 0, 100,
0,31,192,0,
0,127,243,0,
0,240,63,0,
@@ -1870,7 +1870,7 @@ const byte px_bitmap_font_char_data[] = {
7,240,62,0,
6,127,252,0,
0,31,224,0,
- 116 /* t */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 29, 0, 100,
+ 116 /* t */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 28, 0, 25, 0, 29, 0, 100,
1,128,0,0,
1,128,0,0,
1,128,0,0,
@@ -1900,7 +1900,7 @@ const byte px_bitmap_font_char_data[] = {
0,240,31,0,
0,63,252,0,
0,15,224,0,
- 117 /* u */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 22, 0, 108,
+ 117 /* u */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 22, 0, 108,
63,0,127,0,
63,0,127,0,
3,0,3,0,
@@ -1923,7 +1923,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,243,224,
0,127,195,224,
0,31,0,0,
- 118 /* v */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 28, 0, 21, 0, 112,
+ 118 /* v */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 28, 0, 21, 0, 112,
63,240,63,240,
63,240,63,240,
6,0,1,128,
@@ -1945,7 +1945,7 @@ const byte px_bitmap_font_char_data[] = {
0,12,192,0,
0,7,128,0,
0,7,128,0,
- 119 /* w */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 28, 0, 21, 0, 112,
+ 119 /* w */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 28, 0, 21, 0, 112,
63,192,15,240,
63,192,15,240,
12,0,0,192,
@@ -1967,7 +1967,7 @@ const byte px_bitmap_font_char_data[] = {
1,224,30,0,
0,224,28,0,
0,224,28,0,
- 120 /* x */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 21, 0, 108,
+ 120 /* x */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 21, 0, 108,
15,240,63,192,
15,240,63,192,
3,128,7,0,
@@ -1989,7 +1989,7 @@ const byte px_bitmap_font_char_data[] = {
7,0,3,128,
31,240,63,224,
31,240,63,224,
- 121 /* y */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 30, 0, 108,
+ 121 /* y */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 27, 0, 30, 0, 108,
31,224,31,224,
31,224,31,224,
6,0,1,128,
@@ -2020,7 +2020,7 @@ const byte px_bitmap_font_char_data[] = {
0,24,0,0,
31,255,128,0,
31,255,128,0,
- 122 /* z */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 24, 0, 21, 0, 96,
+ 122 /* z */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 21, 0, 24, 0, 21, 0, 96,
3,255,254,
3,255,254,
3,0,14,
@@ -2042,8 +2042,8 @@ const byte px_bitmap_font_char_data[] = {
3,128,3,
3,255,255,
3,255,255,
- 32 /* */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 64,
- 0
+ 32 /* */, 4, 0, 14, 1, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 64,
+ 0
};
const int px_bitmap_font_point_size = 24;
@@ -2051,7 +2051,7 @@ const int px_bitmap_font_resolution = 150;
const byte px_bitmap_font_header[] = {
0, 0, 0, 14, 254, 0, 0, 72,
'B', 'R', 0, 0, 0, 4,
- 0, 150, 0, 150,
+ 0, 150, 0, 150,
0xff, 0xff, 0, 0, 0, 0
};
const uint px_bitmap_font_header_size = sizeof(px_bitmap_font_header);
diff --git a/pxl/pxbfont.ps b/pxl/pxbfont.ps
index c2f0ee075..ce841c380 100644
--- a/pxl/pxbfont.ps
+++ b/pxl/pxbfont.ps
@@ -6,7 +6,6 @@
% /usr/bin/gs -I/usr/lib/ghostscript -q -dNODISPLAY pxbfont.ps >pxbfont.c
-
% Put space last so we can fake the width.
/Chars
@@ -48,28 +47,28 @@ Chars
{ 1 string dup 0 4 -1 roll put /Ch exch def
erasepage 0 36 moveto Ch show
0 Res
- % Remove blank lines at bottom.
+ % Remove blank lines at bottom.
{ 2 copy eq { exit } if
dup 1 sub ID exch Row copyscanlines ZRow ne { exit } if
1 sub
}
loop
- % Remove blank lines at top.
+ % Remove blank lines at top.
{ 2 copy eq { exit } if
1 index ID exch Row copyscanlines ZRow ne { exit } if
exch 1 add exch
}
loop
- % Determine the character width.
+ % Determine the character width.
/B 0 def
/W 0 def
2 copy 1 sub 1 exch
{ ID exch Row copyscanlines pop
Row length 1 sub -1 W
{ Row 1 index get dup 0 ne
- { 1 index W eq { B or } if /B exch def /W exch def exit
- }
- if pop pop
+ { 1 index W eq { B or } if /B exch def /W exch def exit
+ }
+ if pop pop
}
for
}
@@ -83,17 +82,17 @@ Chars
2 copy eq { pop pop Base dup } if % empty character
/Asc Asc Base 4 index sub max def
/Desc Desc 2 index Base sub max def
- % Write the character code.
+ % Write the character code.
(\t) print Ch 0 get =only ( /* ) print Ch =only ( */, ) print
- % Write the character header.
- % We use the PCL5 format, rather than the PCL XL format,
- % so that we can represent the inter-character spacing.
+ % Write the character header.
+ % We use the PCL5 format, rather than the PCL XL format,
+ % so that we can represent the inter-character spacing.
(4, 0, 14, 1, 0, 0, 0, 0, ) =only
Base 2 index sub print16 (, ) print
WB print16 (, ) print
2 copy exch sub print16 (, ) print
WB 4 mul print16 (,) =
- % Write the bits.
+ % Write the bits.
1 sub 1 exch
{ ID exch Row copyscanlines 0 W 1 add getinterval
{ =only (,) print
@@ -114,7 +113,7 @@ const int px_bitmap_font_resolution = ) print Res =only (;
(const byte px_bitmap_font_header[] = {
0, 0, 0, 14, 254, 0, 0, ) print Chars length =only (,
'B', 'R', 0, 0, 0, 4,
- 0, ) print Res =only (, 0, ) print Res =only (,
+ 0, ) print Res =only (, 0, ) print Res =only (,
0xff, 0xff, 0, 0, 0, 0
};
const uint px_bitmap_font_header_size = sizeof(px_bitmap_font_header);
diff --git a/pxl/pxerrors.h b/pxl/pxerrors.h
index 5da6f4a58..6249459b7 100644
--- a/pxl/pxerrors.h
+++ b/pxl/pxerrors.h
@@ -150,8 +150,8 @@ typedef enum {
_e_(errorUnsupportedProtocol, "UnsupportedProtocol")
_e_(errorIllegalStreamHeader, "IllegalStreamHeader")
- /* We define a special "error" that EndSession returns */
- /* to indicate that there were warnings to report. */
+ /* We define a special "error" that EndSession returns */
+ /* to indicate that there were warnings to report. */
_e_(errorWarningsReported, "WarningsReported")
diff --git a/pxl/pxffont.c b/pxl/pxffont.c
index f544e42e7..a39cfb5ba 100644
--- a/pxl/pxffont.c
+++ b/pxl/pxffont.c
@@ -42,37 +42,37 @@ static int
px_widen_font_name(px_value_t *pfnv, px_state_t *pxs)
{ uint type = pfnv->type;
- if ( (type & (pxd_uint16 | pxd_big_endian)) ==
- (pxd_uint16 | pxd_native_byte_order)
- )
- return 0; /* already in correct format */
- { byte *old_data = (byte *)pfnv->value.array.data; /* break const */
- uint size = pfnv->value.array.size;
- char16 *new_data;
- uint i;
-
- if ( type & pxd_on_heap )
- old_data = (byte *)
- (new_data =
- (char16 *)gs_resize_object(pxs->memory, old_data,
- size * 2, "px_widen_font_name"));
- else
- new_data =
- (char16 *)gs_alloc_byte_array(pxs->memory, size, sizeof(char16),
- "px_widen_font_name");
- if ( new_data == 0 )
- return_error(errorInsufficientMemory);
- for ( i = size; i; )
- { --i;
- new_data[i] =
- (type & pxd_ubyte ? old_data[i] :
- uint16at(old_data + i * 2, type & pxd_big_endian));
- }
- pfnv->value.array.data = (byte *)new_data;
- }
- pfnv->type = (type & ~(pxd_ubyte | pxd_big_endian)) |
- (pxd_uint16 | pxd_native_byte_order | pxd_on_heap);
- return 0;
+ if ( (type & (pxd_uint16 | pxd_big_endian)) ==
+ (pxd_uint16 | pxd_native_byte_order)
+ )
+ return 0; /* already in correct format */
+ { byte *old_data = (byte *)pfnv->value.array.data; /* break const */
+ uint size = pfnv->value.array.size;
+ char16 *new_data;
+ uint i;
+
+ if ( type & pxd_on_heap )
+ old_data = (byte *)
+ (new_data =
+ (char16 *)gs_resize_object(pxs->memory, old_data,
+ size * 2, "px_widen_font_name"));
+ else
+ new_data =
+ (char16 *)gs_alloc_byte_array(pxs->memory, size, sizeof(char16),
+ "px_widen_font_name");
+ if ( new_data == 0 )
+ return_error(errorInsufficientMemory);
+ for ( i = size; i; )
+ { --i;
+ new_data[i] =
+ (type & pxd_ubyte ? old_data[i] :
+ uint16at(old_data + i * 2, type & pxd_big_endian));
+ }
+ pfnv->value.array.data = (byte *)new_data;
+ }
+ pfnv->type = (type & ~(pxd_ubyte | pxd_big_endian)) |
+ (pxd_uint16 | pxd_native_byte_order | pxd_on_heap);
+ return 0;
}
/* ---------------- Operator implementations ---------------- */
@@ -87,31 +87,31 @@ px_find_existing_font(px_value_t *pfnv, px_font_t **ppxfont,
{ int code;
void *pxfont;
- /* Normalize the font name to Unicode. */
- code = px_widen_font_name(pfnv, pxs);
- if ( code < 0 )
- return code;
-
- if ( px_dict_find(&pxs->font_dict, pfnv, &pxfont) ) {
- /* Make sure this isn't a partially defined font */
- if ( ((px_font_t *)pxfont)->pfont )
- *ppxfont = pxfont;
- else {
- /* in the process of being downloaded. */
- dprintf("font is being downloaded???\n");
- return -1;
- }
- } else if ( px_dict_find(&pxs->builtin_font_dict, pfnv, &pxfont) )
- if ( ((px_font_t *)pxfont)->pfont )
- *ppxfont = pxfont;
- else {
- dprintf("corrupt pxl builtin font\n");
- return -1;
- }
- else
- return -1; /* font not found or corrupt builtin font */
-
- return 0;
+ /* Normalize the font name to Unicode. */
+ code = px_widen_font_name(pfnv, pxs);
+ if ( code < 0 )
+ return code;
+
+ if ( px_dict_find(&pxs->font_dict, pfnv, &pxfont) ) {
+ /* Make sure this isn't a partially defined font */
+ if ( ((px_font_t *)pxfont)->pfont )
+ *ppxfont = pxfont;
+ else {
+ /* in the process of being downloaded. */
+ dprintf("font is being downloaded???\n");
+ return -1;
+ }
+ } else if ( px_dict_find(&pxs->builtin_font_dict, pfnv, &pxfont) )
+ if ( ((px_font_t *)pxfont)->pfont )
+ *ppxfont = pxfont;
+ else {
+ dprintf("corrupt pxl builtin font\n");
+ return -1;
+ }
+ else
+ return -1; /* font not found or corrupt builtin font */
+
+ return 0;
}
/* Look up a font name and return a font, possibly with substitution. */
@@ -148,7 +148,7 @@ px_find_font(px_value_t *pfnv, uint symbol_set, px_font_t **ppxfont,
code = px_record_warning(message, false, pxs);
}
if ( code >= 0 )
- return pl_load_resident_font_data_from_file(pxs->memory, *ppxfont);
+ return pl_load_resident_font_data_from_file(pxs->memory, *ppxfont);
else
- return code;
+ return code;
}
diff --git a/pxl/pxfont.c b/pxl/pxfont.c
index c652c3243..b04dce91f 100644
--- a/pxl/pxfont.c
+++ b/pxl/pxfont.c
@@ -62,7 +62,6 @@ pxl_find_symbol_map(uint symbol_set)
return (*ppsm ? *ppsm : NULL);
}
-
/* Compute the symbol map from the font and symbol set. */
void
set_symbol_map(px_state_t *pxs, bool wide16)
@@ -386,7 +385,7 @@ px_text(px_args_t *par, px_state_t *pxs, bool to_path)
&cmat);
gs_setcharmatrix(pgs, &cmat);
}
-
+
/* The character matrix is not visible to devices. High level
devices get character scaling information from the font's
matrix (FontMatrix). */
@@ -452,7 +451,6 @@ px_text(px_args_t *par, px_state_t *pxs, bool to_path)
gs_note_error(errorBadFontData) : code);
}
-
/* ---------------- Operators ---------------- */
const byte apxSetFont[] = {
@@ -648,12 +646,12 @@ const byte apxReadChar[] = {
};
int
pxReadChar(px_args_t *par, px_state_t *pxs)
-{
+{
uint char_code = par->pv[0]->value.i;
uint size = par->pv[1]->value.i;
uint pos = par->source.position;
- if ( pos == 0 ) {
+ if ( pos == 0 ) {
/* We're starting a character definition. */
byte *def;
@@ -667,7 +665,7 @@ pxReadChar(px_args_t *par, px_state_t *pxs)
pxs->download_bytes.data = def;
pxs->download_bytes.size = size;
}
- while ( pos < size ) {
+ while ( pos < size ) {
uint copy = min(par->source.available, size - pos);
if ( copy == 0 )
return pxNeedData;
diff --git a/pxl/pxgstate.c b/pxl/pxgstate.c
index e2536227d..516a30ce9 100644
--- a/pxl/pxgstate.c
+++ b/pxl/pxgstate.c
@@ -59,7 +59,6 @@ px_operator_proc(pxRectanglePath);
/* Forward references */
px_operator_proc(pxSetClipIntersect);
-
/* Imported color space types */
extern const gs_color_space_type gs_color_space_type_Indexed; /* gscolor2.c */
extern const gs_color_space_type gs_color_space_type_Pattern; /* gspcolor.c */
@@ -70,38 +69,38 @@ extern const gs_color_space_type gs_color_space_type_Pattern; /* gspcolor.c */
void
px_paint_rc_adjust(px_paint_t *ppt, int delta, gs_memory_t *mem)
{ if ( ppt->type == pxpPattern )
- { /*
- * There is no public API for adjusting the reference count of a
- * gs_client_color, and even the private API requires having a
- * color space available. We'll need to fix this properly
- * sooner or later, but for the moment, fake it.
- */
- gs_color_space cspace;
-
- /*
- * Even though this is a colored Pattern, and hence does have a
- * base space, we set has_base_space to false to prevent the
- * adjust_color_count procedure from trying to call the
- * adjustment procedures for the base space.
- */
- cspace.type = &gs_color_space_type_Pattern;
- cspace.params.pattern.has_base_space = false;
- (*cspace.type->adjust_color_count)(&ppt->value.pattern.color,
- &cspace, delta);
- rc_adjust_only(ppt->value.pattern.pattern, delta,
- "px_paint_rc_adjust");
- }
+ { /*
+ * There is no public API for adjusting the reference count of a
+ * gs_client_color, and even the private API requires having a
+ * color space available. We'll need to fix this properly
+ * sooner or later, but for the moment, fake it.
+ */
+ gs_color_space cspace;
+
+ /*
+ * Even though this is a colored Pattern, and hence does have a
+ * base space, we set has_base_space to false to prevent the
+ * adjust_color_count procedure from trying to call the
+ * adjustment procedures for the base space.
+ */
+ cspace.type = &gs_color_space_type_Pattern;
+ cspace.params.pattern.has_base_space = false;
+ (*cspace.type->adjust_color_count)(&ppt->value.pattern.color,
+ &cspace, delta);
+ rc_adjust_only(ppt->value.pattern.pattern, delta,
+ "px_paint_rc_adjust");
+ }
}
void
px_gstate_rc_adjust(px_gstate_t *pxgs, int delta, gs_memory_t *mem)
{ px_paint_rc_adjust(&pxgs->pen, delta, mem);
- px_paint_rc_adjust(&pxgs->brush, delta, mem);
+ px_paint_rc_adjust(&pxgs->brush, delta, mem);
}
static void *
px_gstate_client_alloc(gs_memory_t *mem)
-{
- px_gstate_t *pxgs =
- (px_gstate_t *)gs_alloc_bytes(mem,
+{
+ px_gstate_t *pxgs =
+ (px_gstate_t *)gs_alloc_bytes(mem,
sizeof(px_gstate_t),
"px_gstate_alloc");
@@ -124,69 +123,69 @@ px_gstate_client_copy_for(void *to, void *from, gs_state_copy_reason_t reason)
{
#define pxfrom ((px_gstate_t *)from)
#define pxto ((px_gstate_t *)to)
- px_gstate_rc_adjust(pxfrom, 1, pxfrom->memory);
- px_gstate_rc_adjust(pxto, -1, pxto->memory);
- /*
- * In the context of the PCL XL code, this routine may be called for
- * gsave, grestore, or gstate (copying the gstate for makepattern
- * or Pattern rendering). See gxstate.h for details of the 'from'
- * and 'to' arguments for each of these cases.
- *
- * We have some structures that belong to the individual gstates for
- * storage management purposes. Currently these are:
- * dither_matrix, temp_pattern_dict
- * px_gstate_client_alloc initializes them to an empty state.
- * For gsave and gstate, the new current gstate or copied gstate
- * respectively should have the empty structure. For grestore,
- * we want to swap the structures, because we will then free the
- * saved gstate (and release the structure that was in the current
- * gstate before the grestore).
- *
- * halftone.thresholds is a different special case. We need to
- * copy it for gsave and gstate, and free it on grestore.
- */
- { gs_string tmat;
- gs_string thtt;
- pl_dict_t tdict;
- gs_string *phtt;
-
- tmat = pxto->dither_matrix;
- thtt = pxto->halftone.thresholds;
- tdict = pxto->temp_pattern_dict;
- *pxto = *pxfrom;
- switch ( reason )
- {
- case copy_for_gstate:
- /* Just put back the (empty) 'to' structures. */
- pxto->dither_matrix = tmat;
- pxto->temp_pattern_dict = tdict;
- phtt = &pxto->halftone.thresholds;
- goto copy;
- case copy_for_gsave:
- /* Swap the structures, but set the parent of the new */
- /* (empty) dictionary to the old one. */
- pxfrom->dither_matrix = tmat;
- pxfrom->temp_pattern_dict = tdict;
- pl_dict_set_parent(&pxfrom->temp_pattern_dict,
- &pxto->temp_pattern_dict);
- phtt = &pxfrom->halftone.thresholds;
+ px_gstate_rc_adjust(pxfrom, 1, pxfrom->memory);
+ px_gstate_rc_adjust(pxto, -1, pxto->memory);
+ /*
+ * In the context of the PCL XL code, this routine may be called for
+ * gsave, grestore, or gstate (copying the gstate for makepattern
+ * or Pattern rendering). See gxstate.h for details of the 'from'
+ * and 'to' arguments for each of these cases.
+ *
+ * We have some structures that belong to the individual gstates for
+ * storage management purposes. Currently these are:
+ * dither_matrix, temp_pattern_dict
+ * px_gstate_client_alloc initializes them to an empty state.
+ * For gsave and gstate, the new current gstate or copied gstate
+ * respectively should have the empty structure. For grestore,
+ * we want to swap the structures, because we will then free the
+ * saved gstate (and release the structure that was in the current
+ * gstate before the grestore).
+ *
+ * halftone.thresholds is a different special case. We need to
+ * copy it for gsave and gstate, and free it on grestore.
+ */
+ { gs_string tmat;
+ gs_string thtt;
+ pl_dict_t tdict;
+ gs_string *phtt;
+
+ tmat = pxto->dither_matrix;
+ thtt = pxto->halftone.thresholds;
+ tdict = pxto->temp_pattern_dict;
+ *pxto = *pxfrom;
+ switch ( reason )
+ {
+ case copy_for_gstate:
+ /* Just put back the (empty) 'to' structures. */
+ pxto->dither_matrix = tmat;
+ pxto->temp_pattern_dict = tdict;
+ phtt = &pxto->halftone.thresholds;
+ goto copy;
+ case copy_for_gsave:
+ /* Swap the structures, but set the parent of the new */
+ /* (empty) dictionary to the old one. */
+ pxfrom->dither_matrix = tmat;
+ pxfrom->temp_pattern_dict = tdict;
+ pl_dict_set_parent(&pxfrom->temp_pattern_dict,
+ &pxto->temp_pattern_dict);
+ phtt = &pxfrom->halftone.thresholds;
copy: if ( phtt->data )
- { byte *str = gs_alloc_string(pxfrom->memory, phtt->size,
- "px_gstate_client_copy(thresholds)");
- if ( str == 0 )
- return_error(errorInsufficientMemory);
- memcpy(str, phtt->data, phtt->size);
- phtt->data = str;
- }
- break;
- default: /* copy_for_grestore */
- /* Swap the structures. */
- pxfrom->dither_matrix = tmat;
- pxfrom->halftone.thresholds = thtt;
- pxfrom->temp_pattern_dict = tdict;
- }
- }
- return 0;
+ { byte *str = gs_alloc_string(pxfrom->memory, phtt->size,
+ "px_gstate_client_copy(thresholds)");
+ if ( str == 0 )
+ return_error(errorInsufficientMemory);
+ memcpy(str, phtt->data, phtt->size);
+ phtt->data = str;
+ }
+ break;
+ default: /* copy_for_grestore */
+ /* Swap the structures. */
+ pxfrom->dither_matrix = tmat;
+ pxfrom->halftone.thresholds = thtt;
+ pxfrom->temp_pattern_dict = tdict;
+ }
+ }
+ return 0;
#undef pxfrom
#undef pxto
}
@@ -194,17 +193,17 @@ static void
px_gstate_client_free(void *old, gs_memory_t *mem)
{ px_gstate_t *pxgs = old;
- px_dict_release(&pxgs->temp_pattern_dict);
- if ( pxgs->halftone.thresholds.data )
+ px_dict_release(&pxgs->temp_pattern_dict);
+ if ( pxgs->halftone.thresholds.data )
gs_free_string(mem, (byte *)pxgs->halftone.thresholds.data,
- pxgs->halftone.thresholds.size,
- "px_gstate_free(halftone.thresholds)");
- if ( pxgs->dither_matrix.data )
+ pxgs->halftone.thresholds.size,
+ "px_gstate_free(halftone.thresholds)");
+ if ( pxgs->dither_matrix.data )
gs_free_string(mem, (byte *)pxgs->dither_matrix.data,
- pxgs->dither_matrix.size,
- "px_gstate_free(dither_matrix)");
- px_gstate_rc_adjust(old, -1, mem);
- gs_free_object(mem, old, "px_gstate_free");
+ pxgs->dither_matrix.size,
+ "px_gstate_free(dither_matrix)");
+ px_gstate_rc_adjust(old, -1, mem);
+ gs_free_object(mem, old, "px_gstate_free");
}
static const gs_state_client_procs px_gstate_procs = {
px_gstate_client_alloc,
@@ -220,23 +219,23 @@ px_gstate_t *
px_gstate_alloc(gs_memory_t *mem)
{ px_gstate_t *pxgs = px_gstate_client_alloc(mem);
- if ( pxgs == 0 )
- return 0;
- pxgs->stack_depth = 0;
- px_gstate_init(pxgs, NULL);
- return pxgs;
+ if ( pxgs == 0 )
+ return 0;
+ pxgs->stack_depth = 0;
+ px_gstate_init(pxgs, NULL);
+ return pxgs;
}
/* Initialize a px_gstate_t. */
void
px_gstate_init(px_gstate_t *pxgs, gs_state *pgs)
{ pxgs->halftone.method = eDeviceBest;
- pxgs->halftone.set = false;
- pxgs->halftone.origin.x = pxgs->halftone.origin.y = 0;
- /* halftone.thresholds was initialized at alloc time */
- px_gstate_reset(pxgs);
- if ( pgs )
- gs_state_set_client(pgs, pxgs, &px_gstate_procs, false);
+ pxgs->halftone.set = false;
+ pxgs->halftone.origin.x = pxgs->halftone.origin.y = 0;
+ /* halftone.thresholds was initialized at alloc time */
+ px_gstate_reset(pxgs);
+ if ( pgs )
+ gs_state_set_client(pgs, pxgs, &px_gstate_procs, false);
}
/* Initialize the graphics state for a page. */
@@ -245,68 +244,68 @@ int
px_initgraphics(px_state_t *pxs)
{ gs_state *pgs = pxs->pgs;
- px_gstate_reset(pxs->pxgs);
- gs_initgraphics(pgs);
+ px_gstate_reset(pxs->pxgs);
+ gs_initgraphics(pgs);
- gs_setfilladjust(pgs, 0.5, 0.5);
+ gs_setfilladjust(pgs, 0.5, 0.5);
- { gs_point inch;
- float dpi;
+ { gs_point inch;
+ float dpi;
- gs_dtransform(pgs, 72.0, 0.0, &inch);
- dpi = fabs(inch.x) + fabs(inch.y);
+ gs_dtransform(pgs, 72.0, 0.0, &inch);
+ dpi = fabs(inch.x) + fabs(inch.y);
- /* Stroke adjustment leads to anomalies at high resolutions. */
- if ( dpi >= 150 )
- gs_setstrokeadjust(pgs, false);
+ /* Stroke adjustment leads to anomalies at high resolutions. */
+ if ( dpi >= 150 )
+ gs_setstrokeadjust(pgs, false);
- /* We need the H-P interpretation of zero-length lines */
- /* and of using bevel joins for the segments of flattened curves. */
- gs_setdotlength(pgs, 72.0 / 300, true);
- }
- /* we always clamp coordinates hp does not seem to report
+ /* We need the H-P interpretation of zero-length lines */
+ /* and of using bevel joins for the segments of flattened curves. */
+ gs_setdotlength(pgs, 72.0 / 300, true);
+ }
+ /* we always clamp coordinates hp does not seem to report
limit checks in paths */
- gs_setlimitclamp(pgs, true);
- return 0;
+ gs_setlimitclamp(pgs, true);
+ return 0;
}
/* Reset a px_gstate_t, initially or at the beginning of a page. */
void
px_gstate_reset(px_gstate_t *pxgs)
{ pxgs->brush.type = pxpGray;
- pxgs->brush.value.gray = 0;
- pxgs->char_angle = 0;
- pxgs->char_bold_value = 0;
- pxgs->char_scale.x = pxgs->char_scale.y = 1;
- pxgs->char_shear.x = pxgs->char_shear.y = 0;
- /* The order of transforms is arbitrary, */
- /* because the transforms are all no-ops. */
- pxgs->char_transforms[0] = pxct_rotate;
- pxgs->char_transforms[1] = pxct_shear;
- pxgs->char_transforms[2] = pxct_scale;
- pxgs->char_sub_mode = eNoSubstitution;
- pxgs->clip_mode = eNonZeroWinding;
- pxgs->color_space = eRGB;
- pxgs->palette.size = 0;
- pxgs->palette.data = 0;
- pxgs->palette_is_shared = false;
- pxgs->base_font = 0;
- /* halftone_method was set above. */
- pxgs->fill_mode = eNonZeroWinding;
- pxgs->dashed = false;
- pxgs->pen.type = pxpGray;
- pxgs->pen.value.gray = 0;
- /* temp_pattern_dict was set at allocation time. */
- gs_make_identity(&pxgs->text_ctm);
- pxgs->char_matrix_set = false;
- pxgs->symbol_map = 0;
- pxgs->writing_mode = eHorizontal;
+ pxgs->brush.value.gray = 0;
+ pxgs->char_angle = 0;
+ pxgs->char_bold_value = 0;
+ pxgs->char_scale.x = pxgs->char_scale.y = 1;
+ pxgs->char_shear.x = pxgs->char_shear.y = 0;
+ /* The order of transforms is arbitrary, */
+ /* because the transforms are all no-ops. */
+ pxgs->char_transforms[0] = pxct_rotate;
+ pxgs->char_transforms[1] = pxct_shear;
+ pxgs->char_transforms[2] = pxct_scale;
+ pxgs->char_sub_mode = eNoSubstitution;
+ pxgs->clip_mode = eNonZeroWinding;
+ pxgs->color_space = eRGB;
+ pxgs->palette.size = 0;
+ pxgs->palette.data = 0;
+ pxgs->palette_is_shared = false;
+ pxgs->base_font = 0;
+ /* halftone_method was set above. */
+ pxgs->fill_mode = eNonZeroWinding;
+ pxgs->dashed = false;
+ pxgs->pen.type = pxpGray;
+ pxgs->pen.value.gray = 0;
+ /* temp_pattern_dict was set at allocation time. */
+ gs_make_identity(&pxgs->text_ctm);
+ pxgs->char_matrix_set = false;
+ pxgs->symbol_map = 0;
+ pxgs->writing_mode = eHorizontal;
}
/* initial clip region note, we don't use gs_initclip() because we
give special handling for the XL 1/6" border */
int
-px_initclip(px_state_t *pxs)
+px_initclip(px_state_t *pxs)
{
return gs_initclip(pxs->pgs);
}
@@ -322,7 +321,7 @@ int
px_image_color_space(gs_image_t *pim,
const px_bitmap_params_t *params, const gs_string *palette,
const gs_state *pgs)
-{
+{
int depth = params->depth;
gs_color_space *pbase_pcs = NULL;
@@ -331,11 +330,11 @@ px_image_color_space(gs_image_t *pim,
int code = 0;
switch ( params->color_space ) {
case eGray:
- pbase_pcs = gs_cspace_new_DeviceGray(pgs->memory);
+ pbase_pcs = gs_cspace_new_DeviceGray(pgs->memory);
pbase_pcs->cmm_icc_profile_data = pgs->icc_manager->default_gray;
pbase_pcs->type = &gs_color_space_type_ICC;
rc_increment(pbase_pcs->cmm_icc_profile_data);
- break;
+ break;
case eRGB:
pbase_pcs = gs_cspace_new_DeviceRGB(pgs->memory);
pbase_pcs->cmm_icc_profile_data = pgs->icc_manager->default_rgb;
@@ -351,23 +350,23 @@ px_image_color_space(gs_image_t *pim,
pbase_pcs->cmm_icc_profile_data = pgs->icc_manager->default_rgb;
pbase_pcs->type = &gs_color_space_type_ICC;
rc_increment(pbase_pcs->cmm_icc_profile_data);
- break;
+ break;
default:
- return_error(errorIllegalAttributeValue);
+ return_error(errorIllegalAttributeValue);
}
if (pbase_pcs == NULL)
return_error(errorInsufficientMemory);
- if ( params->indexed ) {
+ if ( params->indexed ) {
pcs = gs_cspace_alloc(pgs->memory, &gs_color_space_type_Indexed);
if ( pcs == NULL ) {
/* free the base space also */
rc_decrement(pbase_pcs, "px_image_color_space");
return_error(errorInsufficientMemory);
}
- pcs->base_space = pbase_pcs;
- pcs->params.indexed.hival = (1 << depth) - 1;
- pcs->params.indexed.lookup.table.size = palette->size;
+ pcs->base_space = pbase_pcs;
+ pcs->params.indexed.hival = (1 << depth) - 1;
+ pcs->params.indexed.lookup.table.size = palette->size;
{
uint n = palette->size;
byte *p = gs_alloc_string(pgs->memory, n,
@@ -380,7 +379,7 @@ px_image_color_space(gs_image_t *pim,
memcpy(p, palette->data, n);
pcs->params.indexed.lookup.table.data = p;
}
- pcs->params.indexed.use_proc = 0;
+ pcs->params.indexed.use_proc = 0;
} else {
pcs = pbase_pcs;
}
@@ -388,7 +387,7 @@ px_image_color_space(gs_image_t *pim,
pim->ColorSpace = pcs;
pim->BitsPerComponent = depth;
if ( params->indexed )
- pim->Decode[1] = (1 << depth) - 1;
+ pim->Decode[1] = (1 << depth) - 1;
/* NB - this needs investigation */
if (cie_space && !px_is_currentcolor_pattern(pgs)) {
code = pl_setSRGBcolor((gs_state *)pgs, 0.0, 0.0, 0.0);
@@ -405,13 +404,13 @@ px_image_color_space(gs_image_t *pim,
static void
add_char_transform(px_gstate_t *pxgs, px_char_transform_t trans)
{ /* Promote this transformation to the head of the list. */
- if ( pxgs->char_transforms[2] == trans )
- pxgs->char_transforms[2] = pxgs->char_transforms[1],
- pxgs->char_transforms[1] = pxgs->char_transforms[0];
- else if ( pxgs->char_transforms[1] == trans )
- pxgs->char_transforms[1] = pxgs->char_transforms[0];
- pxgs->char_transforms[0] = trans;
- pxgs->char_matrix_set = false;
+ if ( pxgs->char_transforms[2] == trans )
+ pxgs->char_transforms[2] = pxgs->char_transforms[1],
+ pxgs->char_transforms[1] = pxgs->char_transforms[0];
+ else if ( pxgs->char_transforms[1] == trans )
+ pxgs->char_transforms[1] = pxgs->char_transforms[0];
+ pxgs->char_transforms[0] = trans;
+ pxgs->char_matrix_set = false;
}
/* ---------------- Operators ---------------- */
@@ -420,41 +419,41 @@ const byte apxPopGS[] = {0, 0};
int
pxPopGS(px_args_t *par, px_state_t *pxs)
{ gs_state *pgs = pxs->pgs;
- px_gstate_t *pxgs = pxs->pxgs;
- int code;
-
- /*
- * Even though the H-P documentation says that a PopGS with an
- * empty stack is illegal, the implementations apparently simply
- * do nothing in this case.
- */
- if ( pxgs->stack_depth == 0 )
- return 0;
- if ( pxgs->palette.data && !pxgs->palette_is_shared ) {
+ px_gstate_t *pxgs = pxs->pxgs;
+ int code;
+
+ /*
+ * Even though the H-P documentation says that a PopGS with an
+ * empty stack is illegal, the implementations apparently simply
+ * do nothing in this case.
+ */
+ if ( pxgs->stack_depth == 0 )
+ return 0;
+ if ( pxgs->palette.data && !pxgs->palette_is_shared ) {
gs_free_string(pxs->memory, (byte *)pxgs->palette.data,
- pxgs->palette.size, "pxPopGS(palette)");
- pxgs->palette.data = 0;
- }
- px_purge_pattern_cache(pxs, eTempPattern);
- code = gs_grestore(pgs);
- pxs->pxgs = gs_state_client_data(pgs);
- return code;
+ pxgs->palette.size, "pxPopGS(palette)");
+ pxgs->palette.data = 0;
+ }
+ px_purge_pattern_cache(pxs, eTempPattern);
+ code = gs_grestore(pgs);
+ pxs->pxgs = gs_state_client_data(pgs);
+ return code;
}
const byte apxPushGS[] = {0, 0};
int
pxPushGS(px_args_t *par, px_state_t *pxs)
{ gs_state *pgs = pxs->pgs;
- int code = gs_gsave(pgs);
- px_gstate_t *pxgs;
-
- if ( code < 0 )
- return code;
- pxgs = pxs->pxgs = gs_state_client_data(pgs);
- if ( pxgs->palette.data )
- pxgs->palette_is_shared = true;
- ++(pxgs->stack_depth);
- return code;
+ int code = gs_gsave(pgs);
+ px_gstate_t *pxgs;
+
+ if ( code < 0 )
+ return code;
+ pxgs = pxs->pxgs = gs_state_client_data(pgs);
+ if ( pxgs->palette.data )
+ pxgs->palette_is_shared = true;
+ ++(pxgs->stack_depth);
+ return code;
}
/* To restore the interpreters to default state we assemble the
@@ -533,7 +532,6 @@ static const byte pxSetDefaultGSstr[] = {
84,127,105,133,192,0,248,70,110
};
-
const byte apxSetDefaultGS[] = {0, 0};
int
pxSetDefaultGS(px_args_t *par, px_state_t *pxs)
@@ -564,10 +562,10 @@ int
pxSetClipReplace(px_args_t *par, px_state_t *pxs)
{ int code;
- check_clip_region(par, pxs);
- if ( (code = px_initclip(pxs)) < 0 )
- return code;
- return pxSetClipIntersect(par, pxs);
+ check_clip_region(par, pxs);
+ if ( (code = px_initclip(pxs)) < 0 )
+ return code;
+ return pxSetClipIntersect(par, pxs);
}
const byte apxSetCharAngle[] = {
@@ -576,15 +574,15 @@ const byte apxSetCharAngle[] = {
int
pxSetCharAngle(px_args_t *par, px_state_t *pxs)
{ real angle = real_value(par->pv[0], 0);
- px_gstate_t *pxgs = pxs->pxgs;
-
- if ( angle != pxgs->char_angle ||
- pxgs->char_transforms[0] != pxct_rotate
- )
- { pxgs->char_angle = angle;
- add_char_transform(pxgs, pxct_rotate);
- }
- return 0;
+ px_gstate_t *pxgs = pxs->pxgs;
+
+ if ( angle != pxgs->char_angle ||
+ pxgs->char_transforms[0] != pxct_rotate
+ )
+ { pxgs->char_angle = angle;
+ add_char_transform(pxgs, pxct_rotate);
+ }
+ return 0;
}
/* confusion in the 3.0 spec - this argument identifier WritingMode
@@ -609,17 +607,17 @@ const byte apxSetCharScale[] = {
int
pxSetCharScale(px_args_t *par, px_state_t *pxs)
{ real x_scale = real_value(par->pv[0], 0);
- real y_scale = real_value(par->pv[0], 1);
- px_gstate_t *pxgs = pxs->pxgs;
-
- if ( x_scale != pxgs->char_scale.x || y_scale != pxgs->char_scale.y ||
- pxgs->char_transforms[0] != pxct_scale
- )
- { pxgs->char_scale.x = x_scale;
- pxgs->char_scale.y = y_scale;
- add_char_transform(pxgs, pxct_scale);
- }
- return 0;
+ real y_scale = real_value(par->pv[0], 1);
+ px_gstate_t *pxgs = pxs->pxgs;
+
+ if ( x_scale != pxgs->char_scale.x || y_scale != pxgs->char_scale.y ||
+ pxgs->char_transforms[0] != pxct_scale
+ )
+ { pxgs->char_scale.x = x_scale;
+ pxgs->char_scale.y = y_scale;
+ add_char_transform(pxgs, pxct_scale);
+ }
+ return 0;
}
const byte apxSetCharShear[] = {
@@ -635,20 +633,20 @@ const byte apxSetCharShear[] = {
int
pxSetCharShear(px_args_t *par, px_state_t *pxs)
{ real x_shear = real_value(par->pv[0], 0);
- real y_shear = real_value(par->pv[0], 1);
- px_gstate_t *pxgs = pxs->pxgs;
+ real y_shear = real_value(par->pv[0], 1);
+ px_gstate_t *pxgs = pxs->pxgs;
x_shear = x_shear > SHEAR_LIMIT ? SHEAR_LIMIT : x_shear;
y_shear = y_shear > SHEAR_LIMIT ? SHEAR_LIMIT : y_shear;
- if ( x_shear != pxgs->char_shear.x || y_shear != pxgs->char_shear.y ||
- pxgs->char_transforms[0] != pxct_shear
- )
- { pxgs->char_shear.x = x_shear;
- pxgs->char_shear.y = y_shear;
- add_char_transform(pxgs, pxct_shear);
- }
- return 0;
+ if ( x_shear != pxgs->char_shear.x || y_shear != pxgs->char_shear.y ||
+ pxgs->char_transforms[0] != pxct_shear
+ )
+ { pxgs->char_shear.x = x_shear;
+ pxgs->char_shear.y = y_shear;
+ add_char_transform(pxgs, pxct_shear);
+ }
+ return 0;
}
const byte apxSetClipIntersect[] = {
@@ -657,54 +655,54 @@ const byte apxSetClipIntersect[] = {
int
pxSetClipIntersect(px_args_t *par, px_state_t *pxs)
{ gs_state *pgs = pxs->pgs;
- pxeClipRegion_t clip_region = par->pv[0]->value.i;
- int code;
-
- check_clip_region(par, pxs);
- /*
- * The discussion of ClipMode and ClipRegion in the published
- * specification is confused and incorrect. Based on testing with
- * the LaserJet 6MP, we believe that ClipMode works just like
- * PostScript clip and eoclip, and that ClipRegion applies only to
- * the *current* path (i.e., support for "outside clipping" in the
- * library is unnecessary). If we had only known....
- */
+ pxeClipRegion_t clip_region = par->pv[0]->value.i;
+ int code;
+
+ check_clip_region(par, pxs);
+ /*
+ * The discussion of ClipMode and ClipRegion in the published
+ * specification is confused and incorrect. Based on testing with
+ * the LaserJet 6MP, we believe that ClipMode works just like
+ * PostScript clip and eoclip, and that ClipRegion applies only to
+ * the *current* path (i.e., support for "outside clipping" in the
+ * library is unnecessary). If we had only known....
+ */
#if 0
- gs_setclipoutside(pgs, false);
+ gs_setclipoutside(pgs, false);
#endif
- if ( clip_region == eExterior )
- { /*
- * We know clip_mode is eEvenOdd, so we can complement the
- * region defined by the current path by just adding a
- * rectangle that encloses the entire page.
- */
- gs_rect bbox;
-
- code = gs_gsave(pgs);
- if ( code < 0 )
- return code;
- px_initclip(pxs);
- if ( (code = gs_clippath(pgs)) < 0 ||
- (code = gs_pathbbox(pgs, &bbox)) < 0
- )
- DO_NOTHING;
- gs_grestore(pgs);
- if ( code < 0 ||
- (code = gs_rectappend(pgs, &bbox, 1)) < 0
- )
- return code;
+ if ( clip_region == eExterior )
+ { /*
+ * We know clip_mode is eEvenOdd, so we can complement the
+ * region defined by the current path by just adding a
+ * rectangle that encloses the entire page.
+ */
+ gs_rect bbox;
+
+ code = gs_gsave(pgs);
+ if ( code < 0 )
+ return code;
+ px_initclip(pxs);
+ if ( (code = gs_clippath(pgs)) < 0 ||
+ (code = gs_pathbbox(pgs, &bbox)) < 0
+ )
+ DO_NOTHING;
+ gs_grestore(pgs);
+ if ( code < 0 ||
+ (code = gs_rectappend(pgs, &bbox, 1)) < 0
+ )
+ return code;
#ifdef CLIP_INTERSECT_EXTERIOR_REPLACES
- px_initclip(pxs);
+ px_initclip(pxs);
#endif
- }
- code =
- (pxs->pxgs->clip_mode == eEvenOdd ? gs_eoclip(pgs) : gs_clip(pgs));
- if ( code < 0 )
- return code;
+ }
+ code =
+ (pxs->pxgs->clip_mode == eEvenOdd ? gs_eoclip(pgs) : gs_clip(pgs));
+ if ( code < 0 )
+ return code;
#if 0
- gs_setclipoutside(pgs, clip_region == eExterior);
+ gs_setclipoutside(pgs, clip_region == eExterior);
#endif
- return gs_newpath(pgs);
+ return gs_newpath(pgs);
}
const byte apxSetClipRectangle[] = {
@@ -713,22 +711,22 @@ const byte apxSetClipRectangle[] = {
int
pxSetClipRectangle(px_args_t *par, px_state_t *pxs)
{ px_args_t args;
- gs_state *pgs = pxs->pgs;
- int code;
-
- check_clip_region(par, pxs);
- gs_newpath(pgs);
- args.pv[0] = par->pv[1];
- if ( (code = pxRectanglePath(&args, pxs)) < 0 )
- return code;
- return pxSetClipReplace(par, pxs);
+ gs_state *pgs = pxs->pgs;
+ int code;
+
+ check_clip_region(par, pxs);
+ gs_newpath(pgs);
+ args.pv[0] = par->pv[1];
+ if ( (code = pxRectanglePath(&args, pxs)) < 0 )
+ return code;
+ return pxSetClipReplace(par, pxs);
}
const byte apxSetClipToPage[] = {0, 0};
int
pxSetClipToPage(px_args_t *par, px_state_t *pxs)
{ gs_newpath(pxs->pgs);
- return px_initclip(pxs);
+ return px_initclip(pxs);
}
const byte apxSetCursor[] = {
@@ -737,7 +735,7 @@ const byte apxSetCursor[] = {
int
pxSetCursor(px_args_t *par, px_state_t *pxs)
{ return gs_moveto(pxs->pgs, real_value(par->pv[0], 0),
- real_value(par->pv[0], 1));
+ real_value(par->pv[0], 1));
}
const byte apxSetCursorRel[] = {
@@ -746,7 +744,7 @@ const byte apxSetCursorRel[] = {
int
pxSetCursorRel(px_args_t *par, px_state_t *pxs)
{ return gs_rmoveto(pxs->pgs, real_value(par->pv[0], 0),
- real_value(par->pv[0], 1));;
+ real_value(par->pv[0], 1));;
}
/* SetHalftoneMethod is in pxink.c */
@@ -757,7 +755,7 @@ const byte apxSetFillMode[] = {
int
pxSetFillMode(px_args_t *par, px_state_t *pxs)
{ pxs->pxgs->fill_mode = par->pv[0]->value.i;
- return 0;
+ return 0;
}
/* SetFont is in pxfont.c */
@@ -768,140 +766,140 @@ const byte apxSetLineDash[] = {
int
pxSetLineDash(px_args_t *par, px_state_t *pxs)
{ px_gstate_t *pxgs = pxs->pxgs;
- gs_state *pgs = pxs->pgs;
-
- if ( par->pv[0] )
- { float pattern[MAX_DASH_ELEMENTS * 2];
- uint size = par->pv[0]->value.array.size;
- real offset = (par->pv[1] ? real_value(par->pv[1], 0) : 0.0);
- int code;
-
- if ( par->pv[2] )
- return_error(errorIllegalAttributeCombination);
- if ( size > MAX_DASH_ELEMENTS )
- return_error(errorIllegalArraySize);
-
- /*
- * The H-P documentation gives no clue about what a negative
- * dash pattern element is supposed to do. The H-P printers
- * apparently interpret it as drawing a line backwards in the
- * current direction (which may extend outside the original
- * subpath) with the caps inside the line instead of outside; a
- * dash pattern with a negative total length crashes the LJ 6MP
- * firmware so badly the printer has to be power cycled! We
- * take a different approach here: we compensate for negative
- * elements by propagating them to adjacent positive ones. This
- * doesn't produce quite the same output as the H-P printers do,
- * but this is such an obscure feature that we don't think it's
- * worth the trouble to emulate exactly.
- */
- { uint orig_size = size;
- int i;
-
- /* Acquire the pattern, duplicating it if the length is odd. */
- if ( size & 1 )
- size <<= 1;
- for ( i = 0; i < size; ++i )
- pattern[i] = real_elt(par->pv[0], i % orig_size);
- /* Get rid of negative draws. */
- if ( pattern[0] < 0 )
- offset -= pattern[0],
- pattern[size - 1] += pattern[0],
- pattern[1] += pattern[0],
- pattern[0] = -pattern[0];
- for ( i = 2; i < size; i += 2 )
- if ( pattern[i] < 0 )
- pattern[i - 1] += pattern[i],
- pattern[i + 1] += pattern[i],
- pattern[i] = -pattern[i];
- /*
- * Now propagate negative skips iteratively. Since each step
- * decreases either the remaining total of negative skips or
- * the total number of pattern elements, the process is
- * guaranteed to terminate.
- */
+ gs_state *pgs = pxs->pgs;
+
+ if ( par->pv[0] )
+ { float pattern[MAX_DASH_ELEMENTS * 2];
+ uint size = par->pv[0]->value.array.size;
+ real offset = (par->pv[1] ? real_value(par->pv[1], 0) : 0.0);
+ int code;
+
+ if ( par->pv[2] )
+ return_error(errorIllegalAttributeCombination);
+ if ( size > MAX_DASH_ELEMENTS )
+ return_error(errorIllegalArraySize);
+
+ /*
+ * The H-P documentation gives no clue about what a negative
+ * dash pattern element is supposed to do. The H-P printers
+ * apparently interpret it as drawing a line backwards in the
+ * current direction (which may extend outside the original
+ * subpath) with the caps inside the line instead of outside; a
+ * dash pattern with a negative total length crashes the LJ 6MP
+ * firmware so badly the printer has to be power cycled! We
+ * take a different approach here: we compensate for negative
+ * elements by propagating them to adjacent positive ones. This
+ * doesn't produce quite the same output as the H-P printers do,
+ * but this is such an obscure feature that we don't think it's
+ * worth the trouble to emulate exactly.
+ */
+ { uint orig_size = size;
+ int i;
+
+ /* Acquire the pattern, duplicating it if the length is odd. */
+ if ( size & 1 )
+ size <<= 1;
+ for ( i = 0; i < size; ++i )
+ pattern[i] = real_elt(par->pv[0], i % orig_size);
+ /* Get rid of negative draws. */
+ if ( pattern[0] < 0 )
+ offset -= pattern[0],
+ pattern[size - 1] += pattern[0],
+ pattern[1] += pattern[0],
+ pattern[0] = -pattern[0];
+ for ( i = 2; i < size; i += 2 )
+ if ( pattern[i] < 0 )
+ pattern[i - 1] += pattern[i],
+ pattern[i + 1] += pattern[i],
+ pattern[i] = -pattern[i];
+ /*
+ * Now propagate negative skips iteratively. Since each step
+ * decreases either the remaining total of negative skips or
+ * the total number of pattern elements, the process is
+ * guaranteed to terminate.
+ */
elim: for ( i = 0; i < size; i += 2 )
- { float draw = pattern[i], skip = pattern[i + 1];
- int inext, iprev;
- float next, prev;
-
- if ( skip > 0 )
- continue;
- if ( size == 2 ) /* => i == 0 */
- { if ( (pattern[0] = draw + skip) <= 0 )
- pattern[0] = -pattern[0];
- pattern[1] = 0;
- break;
- }
- inext = (i == size - 2 ? 0 : i + 2);
- next = pattern[inext];
- /*
- * Consider the sequence D, -S, E, where D and E are draws
- * and -S is a negative skip. If S <= D, replace the 3
- * elements with D - S + E.
- */
- if ( draw + skip >= 0 )
- { next += draw + skip;
- goto shrink;
- }
- /*
- * Otherwise, let T be the skip preceding D. Replace T
- * with T + D - S. If S > E, replace D, -S, E with E, S -
- * (D + E), D; otherwise, replace D, -S, E with E. In
- * both cases, net progress has occurred.
- */
- iprev = (i == 0 ? size - 1 : i - 1);
- prev = pattern[iprev];
- pattern[iprev] = prev + draw + skip;
- if ( -skip > next )
- { pattern[i] = next;
- pattern[i + 1] = -(skip + draw + next);
- pattern[i + 2] = draw;
- goto elim;
- }
+ { float draw = pattern[i], skip = pattern[i + 1];
+ int inext, iprev;
+ float next, prev;
+
+ if ( skip > 0 )
+ continue;
+ if ( size == 2 ) /* => i == 0 */
+ { if ( (pattern[0] = draw + skip) <= 0 )
+ pattern[0] = -pattern[0];
+ pattern[1] = 0;
+ break;
+ }
+ inext = (i == size - 2 ? 0 : i + 2);
+ next = pattern[inext];
+ /*
+ * Consider the sequence D, -S, E, where D and E are draws
+ * and -S is a negative skip. If S <= D, replace the 3
+ * elements with D - S + E.
+ */
+ if ( draw + skip >= 0 )
+ { next += draw + skip;
+ goto shrink;
+ }
+ /*
+ * Otherwise, let T be the skip preceding D. Replace T
+ * with T + D - S. If S > E, replace D, -S, E with E, S -
+ * (D + E), D; otherwise, replace D, -S, E with E. In
+ * both cases, net progress has occurred.
+ */
+ iprev = (i == 0 ? size - 1 : i - 1);
+ prev = pattern[iprev];
+ pattern[iprev] = prev + draw + skip;
+ if ( -skip > next )
+ { pattern[i] = next;
+ pattern[i + 1] = -(skip + draw + next);
+ pattern[i + 2] = draw;
+ goto elim;
+ }
shrink: if ( inext == 0 )
- { offset += next - pattern[0];
- pattern[0] = next;
- }
- else
- { pattern[i] = next;
- memmove(&pattern[i + 1], &pattern[i + 3],
- (size - (i + 3)) * sizeof(pattern[0]));
- }
- size -= 2;
- goto elim;
- }
- }
- code = gs_setdash(pgs, pattern, size, offset);
- if ( code < 0 )
- return code;
- /* patterns with 0 total skip length are treated as solid
+ { offset += next - pattern[0];
+ pattern[0] = next;
+ }
+ else
+ { pattern[i] = next;
+ memmove(&pattern[i + 1], &pattern[i + 3],
+ (size - (i + 3)) * sizeof(pattern[0]));
+ }
+ size -= 2;
+ goto elim;
+ }
+ }
+ code = gs_setdash(pgs, pattern, size, offset);
+ if ( code < 0 )
+ return code;
+ /* patterns with 0 total skip length are treated as solid
line pattern on the LJ6 */
- {
- bool skips_have_length = false;
- int i;
- for ( i = 0; i < size; i += 2 )
- if ( pattern[i + 1] != 0 ) {
- skips_have_length = true;
- break;
- }
- if ( skips_have_length == false ) {
- pxgs->dashed = false;
- return gs_setdash(pgs, NULL, 0, 0.0);
- }
- pxgs->dashed = (size != 0);
- }
- gs_currentmatrix(pgs, &pxgs->dash_matrix);
- return 0;
- }
- else if ( par->pv[2] )
- { if ( par->pv[1] )
- return_error(errorIllegalAttributeCombination);
- pxgs->dashed = false;
- return gs_setdash(pgs, NULL, 0, 0.0);
- }
- else
- return_error(errorMissingAttribute);
+ {
+ bool skips_have_length = false;
+ int i;
+ for ( i = 0; i < size; i += 2 )
+ if ( pattern[i + 1] != 0 ) {
+ skips_have_length = true;
+ break;
+ }
+ if ( skips_have_length == false ) {
+ pxgs->dashed = false;
+ return gs_setdash(pgs, NULL, 0, 0.0);
+ }
+ pxgs->dashed = (size != 0);
+ }
+ gs_currentmatrix(pgs, &pxgs->dash_matrix);
+ return 0;
+ }
+ else if ( par->pv[2] )
+ { if ( par->pv[1] )
+ return_error(errorIllegalAttributeCombination);
+ pxgs->dashed = false;
+ return gs_setdash(pgs, NULL, 0, 0.0);
+ }
+ else
+ return_error(errorMissingAttribute);
}
const byte apxSetLineCap[] = {
@@ -910,7 +908,7 @@ const byte apxSetLineCap[] = {
int
pxSetLineCap(px_args_t *par, px_state_t *pxs)
{ static const gs_line_cap cap_map[] = pxeLineCap_to_library;
- return gs_setlinecap(pxs->pgs, cap_map[par->pv[0]->value.i]);
+ return gs_setlinecap(pxs->pgs, cap_map[par->pv[0]->value.i]);
}
const byte apxBeginUserDefinedLineCap[] = { 0, 0 };
@@ -922,7 +920,6 @@ pxBeginUserDefinedLineCap(px_args_t *par, px_state_t *pxs)
return 0;
}
-
const byte apxEndUserDefinedLineCap[] = { 0, 0 };
int
pxEndUserDefinedLineCap(px_args_t *par, px_state_t *pxs)
@@ -938,7 +935,7 @@ const byte apxSetLineJoin[] = {
int
pxSetLineJoin(px_args_t *par, px_state_t *pxs)
{ static const gs_line_join join_map[] = pxeLineJoin_to_library;
- return gs_setlinejoin(pxs->pgs, join_map[par->pv[0]->value.i]);
+ return gs_setlinejoin(pxs->pgs, join_map[par->pv[0]->value.i]);
}
const byte apxSetMiterLimit[] = {
@@ -948,26 +945,26 @@ int
pxSetMiterLimit(px_args_t *par, px_state_t *pxs)
{ float limit = real_value(par->pv[0], 0);
- if ( limit == 0 )
- { /*
- * H-P printers interpret this to mean use the default value
- * of 10, even though nothing in the documentation says or
- * implies this.
- */
- limit = 10;
- }
- else
- { /* PCL XL, but not the library, allows limit values <1. */
- if ( limit < 1 ) limit = 1;
- }
- return gs_setmiterlimit(pxs->pgs, limit);
+ if ( limit == 0 )
+ { /*
+ * H-P printers interpret this to mean use the default value
+ * of 10, even though nothing in the documentation says or
+ * implies this.
+ */
+ limit = 10;
+ }
+ else
+ { /* PCL XL, but not the library, allows limit values <1. */
+ if ( limit < 1 ) limit = 1;
+ }
+ return gs_setmiterlimit(pxs->pgs, limit);
}
const byte apxSetPageDefaultCTM[] = {0, 0};
int
pxSetPageDefaultCTM(px_args_t *par, px_state_t *pxs)
{ gs_make_identity(&pxs->pxgs->text_ctm);
- return gs_setmatrix(pxs->pgs, &pxs->initial_matrix);
+ return gs_setmatrix(pxs->pgs, &pxs->initial_matrix);
}
const byte apxSetPageOrigin[] = {
@@ -976,7 +973,7 @@ const byte apxSetPageOrigin[] = {
int
pxSetPageOrigin(px_args_t *par, px_state_t *pxs)
{ return gs_translate(pxs->pgs, real_value(par->pv[0], 0),
- real_value(par->pv[0], 1));
+ real_value(par->pv[0], 1));
}
const byte apxSetPageRotation[] = {
@@ -985,20 +982,20 @@ const byte apxSetPageRotation[] = {
int
pxSetPageRotation(px_args_t *par, px_state_t *pxs)
{ /* Since the Y coordinate of user space is inverted, */
- /* we must negate rotation angles. */
- real angle = -real_value(par->pv[0], 0);
- int code = gs_rotate(pxs->pgs, angle);
-
- if ( code < 0 )
- return code;
- /* Post-multiply the text CTM by the rotation matrix. */
- { gs_matrix rmat;
- px_gstate_t *pxgs = pxs->pxgs;
-
- gs_make_rotation(angle, &rmat);
- gs_matrix_multiply(&pxgs->text_ctm, &rmat, &pxgs->text_ctm);
- }
- return 0;
+ /* we must negate rotation angles. */
+ real angle = -real_value(par->pv[0], 0);
+ int code = gs_rotate(pxs->pgs, angle);
+
+ if ( code < 0 )
+ return code;
+ /* Post-multiply the text CTM by the rotation matrix. */
+ { gs_matrix rmat;
+ px_gstate_t *pxgs = pxs->pxgs;
+
+ gs_make_rotation(angle, &rmat);
+ gs_matrix_multiply(&pxgs->text_ctm, &rmat, &pxgs->text_ctm);
+ }
+ return 0;
}
const byte apxSetPageScale[] = {
@@ -1007,14 +1004,14 @@ const byte apxSetPageScale[] = {
int
pxSetPageScale(px_args_t *par, px_state_t *pxs)
-{
+{
int code;
real sx = 1;
real sy = 1;
static const real units_conversion_table[3][3] = {
{ 1, 25.4, 254 }, /* in -> in, mill, 1/10 mill */
{ 0.0394, 1, 10 }, /* mill -> in, mill, 1/10 mill */
- { 0.00394, .1, 1 } /* 1/10 mill -> in, mill, 1/10 mill */
+ { 0.00394, .1, 1 } /* 1/10 mill -> in, mill, 1/10 mill */
};
/* measuure and units of measure. Actually session user units
@@ -1034,8 +1031,8 @@ pxSetPageScale(px_args_t *par, px_state_t *pxs)
sy = pxs->units_per_measure.y / suy;
/* check for overflow. NB we should do a better job here */
if ( fabs(sx) > 1000.0 ) {
- dprintf2("warning probable overflow avoided for scaling factors %f %f\n",
- sx, sy );
+ dprintf2("warning probable overflow avoided for scaling factors %f %f\n",
+ sx, sy );
sx = sy = 1;
}
}
@@ -1047,7 +1044,7 @@ pxSetPageScale(px_args_t *par, px_state_t *pxs)
if ( code < 0 )
return code;
/* Post-multiply the text CTM by the scale matrix. */
- {
+ {
gs_matrix smat;
px_gstate_t *pxgs = pxs->pxgs;
gs_make_scaling(sx, sy, &smat);
@@ -1062,7 +1059,7 @@ const byte apxSetPaintTxMode[] = {
int
pxSetPaintTxMode(px_args_t *par, px_state_t *pxs)
{ gs_settexturetransparent(pxs->pgs, par->pv[0]->value.i == eTransparent);
- return 0;
+ return 0;
}
const byte apxSetPenWidth[] = {
@@ -1079,7 +1076,7 @@ const byte apxSetROP[] = {
int
pxSetROP(px_args_t *par, px_state_t *pxs)
{ gs_setrasterop(pxs->pgs, (gs_rop3_t)(par->pv[0]->value.i));
- return 0;
+ return 0;
}
const byte apxSetSourceTxMode[] = {
@@ -1088,7 +1085,7 @@ const byte apxSetSourceTxMode[] = {
int
pxSetSourceTxMode(px_args_t *par, px_state_t *pxs)
{ gs_setsourcetransparent(pxs->pgs, par->pv[0]->value.i == eTransparent);
- return 0;
+ return 0;
}
const byte apxSetCharBoldValue[] = {
@@ -1096,7 +1093,7 @@ const byte apxSetCharBoldValue[] = {
};
int
pxSetCharBoldValue(px_args_t *par, px_state_t *pxs)
-{
+{
float arg = real_value(par->pv[0], 0);
pxs->pxgs->char_bold_value = arg;
return 0;
@@ -1108,7 +1105,7 @@ const byte apxSetClipMode[] = {
int
pxSetClipMode(px_args_t *par, px_state_t *pxs)
{ pxs->pxgs->clip_mode = par->pv[0]->value.i;
- return 0;
+ return 0;
}
const byte apxSetPathToClip[] = {0, 0};
@@ -1123,21 +1120,21 @@ const byte apxSetCharSubMode[] = {
int
pxSetCharSubMode(px_args_t *par, px_state_t *pxs)
{ /*
- * It isn't clear from the documentation why the attribute is an
- * array rather than just a Boolean, but we have to assume there
- * is some reason for this.
- */
- const px_value_t *psubs = par->pv[0];
+ * It isn't clear from the documentation why the attribute is an
+ * array rather than just a Boolean, but we have to assume there
+ * is some reason for this.
+ */
+ const px_value_t *psubs = par->pv[0];
pxeCharSubModeArray_t arg;
- if ( psubs->value.array.size != 1 ||
- psubs->value.array.data[0] >= pxeCharSubModeArray_next
- )
- return_error(errorIllegalAttributeValue);
+ if ( psubs->value.array.size != 1 ||
+ psubs->value.array.data[0] >= pxeCharSubModeArray_next
+ )
+ return_error(errorIllegalAttributeValue);
arg = psubs->value.array.data[0];
if (pxs->pxgs->char_sub_mode != arg) {
pxs->pxgs->char_sub_mode = arg;
px_purge_character_cache(pxs);
}
- return 0;
+ return 0;
}
diff --git a/pxl/pxgstate.h b/pxl/pxgstate.h
index 4ef8f4a7d..e3b191df5 100644
--- a/pxl/pxgstate.h
+++ b/pxl/pxgstate.h
@@ -57,11 +57,11 @@ typedef struct px_bitmap_params_s {
/* Define the structure for downloaded raster patterns. */
typedef struct px_pattern_s {
rc_header rc; /* counts refs from gstates, dicts */
- /* Original parameters */
+ /* Original parameters */
px_bitmap_params_t params;
gs_string palette; /* copy of palette if indexed color */
byte *data; /* raster data */
- /* Internal values */
+ /* Internal values */
gx_bitmap_id id; /* PCL XL ID * #persistence + persistence */
} px_pattern_t;
#define private_st_px_pattern() /* in pximage.c */\
@@ -110,10 +110,10 @@ typedef enum {
/* Define the PCL XL extension of the PostScript graphics state. */
typedef struct px_gstate_s {
gs_memory_t *memory;
- /* Since this is what the 'client data' of the gs_state points to, */
- /* we need a pointer back to the px_state_t. */
+ /* Since this is what the 'client data' of the gs_state points to, */
+ /* we need a pointer back to the px_state_t. */
px_state_t *pxs;
- /* State information */
+ /* State information */
px_paint_t brush;
float char_angle;
float char_bold_value;
@@ -138,7 +138,7 @@ typedef struct px_gstate_s {
struct ht_ {
pxeDitherMatrix_t method;
bool set; /* true if we have done gs_sethalftone */
- /* with these parameters */
+ /* with these parameters */
uint width;
uint height;
gs_point origin;
@@ -149,11 +149,11 @@ typedef struct px_gstate_s {
bool dashed;
gs_matrix dash_matrix;
px_paint_t pen;
- /* Pattern dictionary */
+ /* Pattern dictionary */
px_dict_t temp_pattern_dict;
- /* Cached values */
+ /* Cached values */
gs_matrix text_ctm; /* scale/rotate transformations applied in */
- /* the reverse order */
+ /* the reverse order */
gs_matrix char_matrix; /* char_size+angle+scale+shear */
bool char_matrix_set;
int stack_depth; /* # of unmatched PushGS */
diff --git a/pxl/pximage.c b/pxl/pximage.c
index 091210ace..ceab23f04 100644
--- a/pxl/pximage.c
+++ b/pxl/pximage.c
@@ -51,17 +51,17 @@
void
px_free_pattern(gs_memory_t *mem, void *vptr, client_name_t cname)
{ px_pattern_t *pattern = vptr;
- rc_decrement(pattern, cname);
+ rc_decrement(pattern, cname);
}
/* Define the real freeing procedure for patterns. */
static void
rc_free_px_pattern(gs_memory_t *mem, void *vptr, client_name_t cname)
{ px_pattern_t *pattern = vptr;
- gs_free_string(mem, (void *)pattern->palette.data, pattern->palette.size,
- cname);
- gs_free_object(mem, pattern->data, cname);
- gs_free_object(mem, pattern, cname);
+ gs_free_string(mem, (void *)pattern->palette.data, pattern->palette.size,
+ cname);
+ gs_free_object(mem, pattern->data, cname);
+ gs_free_object(mem, pattern, cname);
}
/* Define the purging procedure for the Pattern cache. */
/* The proc_data points to a pxePatternPersistence_t that specifies */
@@ -69,16 +69,15 @@ rc_free_px_pattern(gs_memory_t *mem, void *vptr, client_name_t cname)
static bool
px_pattern_purge_proc(gx_color_tile *ctile, void *proc_data)
{ return ctile->uid.id % pxePatternPersistence_next <=
- *(pxePatternPersistence_t *)proc_data;
+ *(pxePatternPersistence_t *)proc_data;
}
void
px_purge_pattern_cache(px_state_t *pxs, pxePatternPersistence_t max_persist)
{ gx_pattern_cache_winnow(gstate_pattern_cache(pxs->pgs),
- px_pattern_purge_proc,
- (void *)&max_persist);
+ px_pattern_purge_proc,
+ (void *)&max_persist);
}
-
/* pxl delta row decompression state machine states */
typedef enum {
next_is_bytecount,
@@ -92,8 +91,8 @@ typedef enum {
typedef struct deltarow_state_s {
deltarow_parse_state_t state;
uint row_byte_count;
- uint short_cnt;
- uint short_offset;
+ uint short_cnt;
+ uint short_offset;
byte *seedrow;
uint rowwritten;
} deltarow_state_t;
@@ -135,30 +134,30 @@ static int
begin_bitmap(px_bitmap_params_t *params, px_bitmap_enum_t *benum,
const px_args_t *par, const px_state_t *pxs)
{ px_gstate_t *pxgs = pxs->pxgs;
- int depth = "\001\004\010"[par->pv[1]->value.i];
- int num_components = (pxgs->color_space == eGray ? 1 : 3);
-
- params->width = par->pv[2]->value.i;
- params->height = par->pv[3]->value.i;
- params->depth = depth;
- params->color_space = pxgs->color_space;
- if ( par->pv[0]->value.i == eIndexedPixel )
- { if ( pxgs->palette.data == 0 )
- return_error(errorMissingPalette);
- if ( pxgs->palette.size != (1 << depth) * num_components )
- return_error( errorImagePaletteMismatch);
- params->indexed = true;
- num_components = 1;
- }
- else
- params->indexed = false;
- params->dest_width = real_value(par->pv[4], 0);
- params->dest_height = real_value(par->pv[4], 1);
- benum->data_per_row =
- round_up(params->width * params->depth * num_components, 8) >> 3;
- benum->mem = pxs->memory;
- benum->initialized = false;
- return 0;
+ int depth = "\001\004\010"[par->pv[1]->value.i];
+ int num_components = (pxgs->color_space == eGray ? 1 : 3);
+
+ params->width = par->pv[2]->value.i;
+ params->height = par->pv[3]->value.i;
+ params->depth = depth;
+ params->color_space = pxgs->color_space;
+ if ( par->pv[0]->value.i == eIndexedPixel )
+ { if ( pxgs->palette.data == 0 )
+ return_error(errorMissingPalette);
+ if ( pxgs->palette.size != (1 << depth) * num_components )
+ return_error( errorImagePaletteMismatch);
+ params->indexed = true;
+ num_components = 1;
+ }
+ else
+ params->indexed = false;
+ params->dest_width = real_value(par->pv[4], 0);
+ params->dest_height = real_value(par->pv[4], 1);
+ benum->data_per_row =
+ round_up(params->width * params->depth * num_components, 8) >> 3;
+ benum->mem = pxs->memory;
+ benum->initialized = false;
+ return 0;
}
static int
@@ -168,7 +167,6 @@ stream_error(stream_state * st, const char *str)
return 0;
}
-
static int
read_jpeg_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
{
@@ -248,12 +246,12 @@ read_uncompressed_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *
if ( par->source.position >= data_per_row_padded * par->pv[1]->value.i )
return 0;
- if ( avail >= data_per_row_padded && pos_in_row == 0 ) {
+ if ( avail >= data_per_row_padded && pos_in_row == 0 ) {
/* Use the data directly from the input buffer. */
*pdata = (byte *)data;
used = data_per_row_padded;
code = 1;
- } else {
+ } else {
used = min(avail, data_per_row_padded - pos_in_row);
if ( pos_in_row < data_per_row )
memcpy(*pdata + pos_in_row, data,
@@ -296,7 +294,7 @@ read_rle_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
}
r.ptr = data - 1;
r.limit = r.ptr + avail;
- if ( pos_in_row < data_per_row ) {
+ if ( pos_in_row < data_per_row ) {
/* Read more of the current row. */
byte *data = *pdata;
@@ -310,7 +308,7 @@ read_rle_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
if ( pos_in_row >= data_per_row && pos_in_row < data_per_row_padded )
{ /* We've read all the real data; skip the padding. */
byte pad[3]; /* maximum padding per row */
-
+
w.ptr = pad - 1;
w.limit = w.ptr + data_per_row_padded - pos_in_row;
(*s_RLD_template.process)((stream_state *)ss, &r, &w, false);
@@ -325,9 +323,9 @@ read_rle_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
return (pos_in_row < data_per_row_padded ? pxNeedData : 1);
}
-/** PCL XL delta row decompression
+/** PCL XL delta row decompression
*
- * delta row Algorithm:
+ * delta row Algorithm:
*
* Seed Row is initialized with zeros.
*
@@ -337,42 +335,42 @@ read_rle_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
*
* if row byte count is zero duplicate previous row
* if row byte count doesn't fill row duplicate remainder and end the row (undocumented)
- *
+ *
* delta row data: command byte, optional extra offset bytes, delta raster snippit
- * command byte 7-5 delta raster length: 4-0 offset
+ * command byte 7-5 delta raster length: 4-0 offset
*
* offset = bits 4-0;
- * if offset == 31 then do { add next byte } repeat while next byte was 0xFF
+ * if offset == 31 then do { add next byte } repeat while next byte was 0xFF
* example offset = 31 + 255 + 255 + 255 + 4
*
- * delta length = bits 5-7 + 1; range 1 to 8 bytes.
- *
+ * delta length = bits 5-7 + 1; range 1 to 8 bytes.
+ *
* output raster is:
* last position + offset; "copies" old data
- * copy delta length bytes from input to output
- *
+ * copy delta length bytes from input to output
+ *
* Internal Algorithm:
- *
+ *
* No row padding is used.
- * State is need since available data can be short at any time.
- * read = *pin++; // out of data? save state, return eNeedData
- *
+ * State is need since available data can be short at any time.
+ * read = *pin++; // out of data? save state, return eNeedData
+ *
* deltarow.state maintains state between requests for more data
* state : description
* -> next state
- * ---------------------------------------
- * next_is_bytecount : lsb of row bytecount
+ * ---------------------------------------
+ * next_is_bytecount : lsb of row bytecount
* -> partial_bytecount
* partial_bytecount : msb of row bytecount
* -> next_is_cmd
* next_is_cmd : 1 byte cmd contains cnt and partial offset
* -> partial_offset or partial_cnt
- * partial_offset : accumulates extra offset bytes, moves output by offset
+ * partial_offset : accumulates extra offset bytes, moves output by offset
* -> partial_offset or partial_cnt
* partial_cnt : copies cnt bytes one at a time from input
- * -> partial_cnt or next_is_cmd or (next_bytecount && end_of_row)
+ * -> partial_cnt or next_is_cmd or (next_bytecount && end_of_row)
*
- * RETURN values:
+ * RETURN values:
* 0 == end of image // end of row returns, next call returns end of image.
* 1 == end of row
* eNeedData == on need more input
@@ -393,7 +391,7 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
}
/* initialize at begin of image */
- if ( !benum->initialized ) {
+ if ( !benum->initialized ) {
/* zero seed row */
deltarow->seedrow = gs_alloc_bytes(benum->mem, benum->data_per_row, "read_deltarow_bitmap_data");
memset(deltarow->seedrow, 0, benum->data_per_row);
@@ -404,36 +402,36 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
deltarow->rowwritten = 0;
benum->initialized = true;
}
-
+
if (deltarow->row_byte_count == 0) {
memcpy(*pdata, deltarow->seedrow, benum->data_per_row);
}
-
+
/* one byte at a time until end of input or end of row */
while (avail && !end_of_row) {
switch ( deltarow->state ) {
case next_is_bytecount:{
- deltarow->short_cnt = *pin++;
- --avail;
+ deltarow->short_cnt = *pin++;
+ --avail;
deltarow->state = partial_bytecount;
break;
}
-
+
case partial_bytecount: {
deltarow->row_byte_count = deltarow->short_cnt + ((*pin++) << 8 );
--avail;
-
+
if ( deltarow->row_byte_count == 0 ) {
- /* duplicate the row */
- deltarow->state = next_is_bytecount;
- end_of_row = true;
+ /* duplicate the row */
+ deltarow->state = next_is_bytecount;
+ end_of_row = true;
}
else
- deltarow->state = next_is_cmd;
+ deltarow->state = next_is_cmd;
break;
}
-
+
case next_is_cmd: {
uint val = *pin++;
@@ -441,11 +439,11 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
deltarow->row_byte_count--;
deltarow->short_cnt = (val >> 5) + 1; /* 1 to 8 new bytes to copy */
deltarow->short_offset = val & 0x1f; /* num to retain from last row, skip */
- if (deltarow->short_offset == 0x1f)
- deltarow->state = partial_offset; /* accumulate more offset */
+ if (deltarow->short_offset == 0x1f)
+ deltarow->state = partial_offset; /* accumulate more offset */
else {
- pout += deltarow->short_offset; /* skip keeps old data in row */
- deltarow->state = partial_cnt; /* done with offset do count */
+ pout += deltarow->short_offset; /* skip keeps old data in row */
+ deltarow->state = partial_cnt; /* done with offset do count */
}
break;
}
@@ -454,14 +452,14 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
uint offset = *pin++;
avail--;
deltarow->row_byte_count--;
-
+
deltarow->short_offset += offset;
-
- if (offset == 0xff)
- deltarow->state = partial_offset; /* 0x1f + ff ff ff ff ff + 1 */
+
+ if (offset == 0xff)
+ deltarow->state = partial_offset; /* 0x1f + ff ff ff ff ff + 1 */
else {
- pout += deltarow->short_offset; /* skip keeps old data in row */
- deltarow->state = partial_cnt; /* done with offset do count */
+ pout += deltarow->short_offset; /* skip keeps old data in row */
+ deltarow->state = partial_cnt; /* done with offset do count */
}
break;
}
@@ -474,27 +472,26 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
avail--;
deltarow->row_byte_count--;
deltarow->short_cnt--;
-
- if (deltarow->row_byte_count == 0) {
- end_of_row = true;
- deltarow->state = next_is_bytecount;
+
+ if (deltarow->row_byte_count == 0) {
+ end_of_row = true;
+ deltarow->state = next_is_bytecount;
}
- else if (deltarow->short_cnt == 0)
- deltarow->state = next_is_cmd;
+ else if (deltarow->short_cnt == 0)
+ deltarow->state = next_is_cmd;
/* else more bytes to copy */
break;
}
} /* end switch */
} /* end of while */
-
par->source.available -= pin - par->source.data; /* subract comressed data used */
par->source.data = pin; /* new compressed data position */
if (end_of_row) {
/* uncompressed raster position */
- par->source.position =
+ par->source.position =
(par->source.position / benum->data_per_row + 1) * benum->data_per_row;
deltarow->rowwritten++;
memcpy(deltarow->seedrow, *pdata, benum->data_per_row);
@@ -517,7 +514,7 @@ read_deltarow_bitmap_data(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
*/
static int
read_bitmap(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
-{
+{
benum->compress_type = par->pv[2]->value.i;
switch( benum->compress_type ) {
case eRLECompression:
@@ -534,7 +531,6 @@ read_bitmap(px_bitmap_enum_t *benum, byte **pdata, px_args_t *par)
return -1;
}
-
/* ---------------- Image operators ---------------- */
const byte apxBeginImage[] = {
@@ -544,88 +540,88 @@ const byte apxBeginImage[] = {
int
pxBeginImage(px_args_t *par, px_state_t *pxs)
{ gs_point origin;
- px_bitmap_params_t params;
- px_bitmap_enum_t benum;
- gs_state *pgs = pxs->pgs;
- px_gstate_t *pxgs = pxs->pxgs;
- px_image_enum_t *pxenum;
- int code;
-
- if ( gs_currentpoint(pgs, &origin) < 0 )
- return_error(errorCurrentCursorUndefined);
- /*
- * If the current logical operation doesn't involve the texture,
- * don't set a null brush, which would cause the image not to
- * appear.
- */
- if ( pxs->pxgs->brush.type == pxpNull &&
- !rop3_uses_T(gs_currentrasterop(pgs))
+ px_bitmap_params_t params;
+ px_bitmap_enum_t benum;
+ gs_state *pgs = pxs->pgs;
+ px_gstate_t *pxgs = pxs->pxgs;
+ px_image_enum_t *pxenum;
+ int code;
+
+ if ( gs_currentpoint(pgs, &origin) < 0 )
+ return_error(errorCurrentCursorUndefined);
+ /*
+ * If the current logical operation doesn't involve the texture,
+ * don't set a null brush, which would cause the image not to
+ * appear.
+ */
+ if ( pxs->pxgs->brush.type == pxpNull &&
+ !rop3_uses_T(gs_currentrasterop(pgs))
) {
if ( pxs->useciecolor )
code = pl_setSRGBcolor(pgs, 0.0, 0.0, 0.0);
else
code = gs_setgray(pgs, 0.0);
}
- else
- code = px_set_paint(&pxgs->brush, pxs);
- if ( code < 0 )
- return code;
- /*
- * Make sure the proper halftone is current.
- */
- code = px_set_halftone(pxs);
- if ( code < 0 )
- return code;
- code = begin_bitmap(&params, &benum, par, pxs);
- if ( code < 0 )
- return code;
- pxenum =
- gs_alloc_struct(pxs->memory, px_image_enum_t,
- &st_px_image_enum, "setup_bitmap(pxenum)");
-
- if ( pxenum == 0 )
- return_error(errorInsufficientMemory);
- {
+ else
+ code = px_set_paint(&pxgs->brush, pxs);
+ if ( code < 0 )
+ return code;
+ /*
+ * Make sure the proper halftone is current.
+ */
+ code = px_set_halftone(pxs);
+ if ( code < 0 )
+ return code;
+ code = begin_bitmap(&params, &benum, par, pxs);
+ if ( code < 0 )
+ return code;
+ pxenum =
+ gs_alloc_struct(pxs->memory, px_image_enum_t,
+ &st_px_image_enum, "setup_bitmap(pxenum)");
+
+ if ( pxenum == 0 )
+ return_error(errorInsufficientMemory);
+ {
pxenum->raster = round_up(benum.data_per_row, align_bitmap_mod);
pxenum->row = gs_alloc_byte_array(pxs->memory, 1, pxenum->raster,
"pxReadImage(row)");
- if ( pxenum->row == 0 )
- code = gs_note_error(errorInsufficientMemory);
- else
- code = px_image_color_space(&pxenum->image, &params, (const gs_string *)&pxgs->palette, pgs);
- }
- if ( code < 0 )
- { gs_free_object(pxs->memory, pxenum->row, "pxReadImage(row)");
- gs_free_object(pxs->memory, pxenum, "pxReadImage(pxenum)");
- return code;
- }
- /* Set up the image parameters. */
- pxenum->image.Width = params.width;
- pxenum->image.Height = params.height;
- { gs_matrix imat, dmat;
- /* We need the cast because height is unsigned. */
- /* We also need to account for the upside-down H-P */
- /* coordinate system. */
- gs_make_scaling(params.width, params.height, &imat);
- gs_make_translation(origin.x, origin.y, &dmat);
- gs_matrix_scale(&dmat, params.dest_width, params.dest_height,
- &dmat);
- /* The ImageMatrix is dmat' * imat. */
- gs_matrix_invert(&dmat, &dmat);
- gs_matrix_multiply(&dmat, &imat, &pxenum->image.ImageMatrix);
- }
- pxenum->image.CombineWithColor = true;
+ if ( pxenum->row == 0 )
+ code = gs_note_error(errorInsufficientMemory);
+ else
+ code = px_image_color_space(&pxenum->image, &params, (const gs_string *)&pxgs->palette, pgs);
+ }
+ if ( code < 0 )
+ { gs_free_object(pxs->memory, pxenum->row, "pxReadImage(row)");
+ gs_free_object(pxs->memory, pxenum, "pxReadImage(pxenum)");
+ return code;
+ }
+ /* Set up the image parameters. */
+ pxenum->image.Width = params.width;
+ pxenum->image.Height = params.height;
+ { gs_matrix imat, dmat;
+ /* We need the cast because height is unsigned. */
+ /* We also need to account for the upside-down H-P */
+ /* coordinate system. */
+ gs_make_scaling(params.width, params.height, &imat);
+ gs_make_translation(origin.x, origin.y, &dmat);
+ gs_matrix_scale(&dmat, params.dest_width, params.dest_height,
+ &dmat);
+ /* The ImageMatrix is dmat' * imat. */
+ gs_matrix_invert(&dmat, &dmat);
+ gs_matrix_multiply(&dmat, &imat, &pxenum->image.ImageMatrix);
+ }
+ pxenum->image.CombineWithColor = true;
pxenum->image.Interpolate = pxs->interpolate;
- code = pl_begin_image(pgs, &pxenum->image, &pxenum->info);
- if ( code < 0 )
- { gs_free_object(pxs->memory, pxenum->row, "pxReadImage(row)");
- gs_free_object(pxs->memory, pxenum, "pxBeginImage(pxenum)");
- return code;
- }
- pxenum->benum = benum;
- pxs->image_enum = pxenum;
- return 0;
+ code = pl_begin_image(pgs, &pxenum->image, &pxenum->info);
+ if ( code < 0 )
+ { gs_free_object(pxs->memory, pxenum->row, "pxReadImage(row)");
+ gs_free_object(pxs->memory, pxenum, "pxBeginImage(pxenum)");
+ return code;
+ }
+ pxenum->benum = benum;
+ pxs->image_enum = pxenum;
+ return 0;
}
const byte apxReadImage[] = {
@@ -634,10 +630,10 @@ const byte apxReadImage[] = {
int
pxReadImage(px_args_t *par, px_state_t *pxs)
-{
+{
px_image_enum_t *pxenum = pxs->image_enum;
gx_device *dev = gs_currentdevice(pxs->pgs);
-
+
if ( par->pv[1]->value.i == 0 )
return 0; /* no data */
/* Make a quick check for the first call, when no data is available. */
@@ -660,7 +656,7 @@ pxReadImage(px_args_t *par, px_state_t *pxs)
const byte apxEndImage[] = {0, 0};
int
pxEndImage(px_args_t *par, px_state_t *pxs)
-{
+{
gx_device *dev = gs_currentdevice(pxs->pgs);
px_image_enum_t *pxenum = pxs->image_enum;
px_bitmap_enum_t *pbenum = &pxenum->benum;
@@ -699,55 +695,55 @@ const byte apxBeginRastPattern[] = {
int
pxBeginRastPattern(px_args_t *par, px_state_t *pxs)
{ gs_memory_t *mem = pxs->memory;
- px_bitmap_params_t params;
- px_pattern_t *pattern;
- px_pattern_enum_t *pxenum;
- px_bitmap_enum_t benum;
- byte *data;
- uint psize;
- byte *pdata;
- int code = begin_bitmap(&params, &benum, par, pxs);
- static const gs_memory_struct_type_t st_px_pattern =
+ px_bitmap_params_t params;
+ px_pattern_t *pattern;
+ px_pattern_enum_t *pxenum;
+ px_bitmap_enum_t benum;
+ byte *data;
+ uint psize;
+ byte *pdata;
+ int code = begin_bitmap(&params, &benum, par, pxs);
+ static const gs_memory_struct_type_t st_px_pattern =
{sizeof(px_pattern_t), "", 0, 0, 0, 0, 0};
- if ( code < 0 )
- return code;
- rc_alloc_struct_1(pattern, px_pattern_t, &st_px_pattern, mem,
- return_error(errorInsufficientMemory),
- "raster pattern");
- pattern->rc.free = rc_free_px_pattern;
- data = gs_alloc_byte_array(mem, params.height, benum.data_per_row,
- "raster pattern data");
- if ( params.indexed )
- { psize = pxs->pxgs->palette.size;
- pdata = gs_alloc_string(mem, psize, "raster pattern palette");
- if ( pdata != 0 )
- memcpy(pdata, pxs->pxgs->palette.data, psize);
- }
- else
- { psize = 0;
- pdata = 0;
- }
- pxenum = gs_alloc_struct(mem, px_pattern_enum_t, &st_px_pattern_enum,
- "raster pattern enum");
- if ( data == 0 || (params.indexed && pdata == 0) || pxenum == 0 )
- { gs_free_object(mem, pxenum, "raster pattern enum");
- gs_free_string(mem, pdata, psize, "raster pattern palette");
- gs_free_object(mem, data, "raster pattern data");
- gs_free_object(mem, pattern, "raster pattern");
- return_error(errorInsufficientMemory);
- }
- pxenum->benum = benum;
- pxenum->pattern_id = par->pv[5]->value.i;
- pxenum->persistence = par->pv[6]->value.i;
- pattern->params = params;
- pattern->palette.data = pdata;
- pattern->palette.size = psize;
- pattern->data = data;
- pattern->id = gs_next_ids(mem, 1);
- pxenum->pattern = pattern;
- pxs->pattern_enum = pxenum;
- return 0;
+ if ( code < 0 )
+ return code;
+ rc_alloc_struct_1(pattern, px_pattern_t, &st_px_pattern, mem,
+ return_error(errorInsufficientMemory),
+ "raster pattern");
+ pattern->rc.free = rc_free_px_pattern;
+ data = gs_alloc_byte_array(mem, params.height, benum.data_per_row,
+ "raster pattern data");
+ if ( params.indexed )
+ { psize = pxs->pxgs->palette.size;
+ pdata = gs_alloc_string(mem, psize, "raster pattern palette");
+ if ( pdata != 0 )
+ memcpy(pdata, pxs->pxgs->palette.data, psize);
+ }
+ else
+ { psize = 0;
+ pdata = 0;
+ }
+ pxenum = gs_alloc_struct(mem, px_pattern_enum_t, &st_px_pattern_enum,
+ "raster pattern enum");
+ if ( data == 0 || (params.indexed && pdata == 0) || pxenum == 0 )
+ { gs_free_object(mem, pxenum, "raster pattern enum");
+ gs_free_string(mem, pdata, psize, "raster pattern palette");
+ gs_free_object(mem, data, "raster pattern data");
+ gs_free_object(mem, pattern, "raster pattern");
+ return_error(errorInsufficientMemory);
+ }
+ pxenum->benum = benum;
+ pxenum->pattern_id = par->pv[5]->value.i;
+ pxenum->persistence = par->pv[6]->value.i;
+ pattern->params = params;
+ pattern->palette.data = pdata;
+ pattern->palette.size = psize;
+ pattern->data = data;
+ pattern->id = gs_next_ids(mem, 1);
+ pxenum->pattern = pattern;
+ pxs->pattern_enum = pxenum;
+ return 0;
}
const byte apxReadRastPattern[] = {
@@ -757,66 +753,66 @@ const byte apxReadRastPattern[] = {
int
pxReadRastPattern(px_args_t *par, px_state_t *pxs)
{ px_pattern_enum_t *pxenum = pxs->pattern_enum;
- int code;
- uint input_per_row = round_up(pxenum->benum.data_per_row, 4);
- if ( par->pv[3] )
- input_per_row = round_up(pxenum->benum.data_per_row, par->pv[3]->value.i);
- /* Make a quick check for the first call, when no data is available. */
- if ( par->source.available == 0 && par->pv[1]->value.i != 0 )
- return pxNeedData;
+ int code;
+ uint input_per_row = round_up(pxenum->benum.data_per_row, 4);
+ if ( par->pv[3] )
+ input_per_row = round_up(pxenum->benum.data_per_row, par->pv[3]->value.i);
+ /* Make a quick check for the first call, when no data is available. */
+ if ( par->source.available == 0 && par->pv[1]->value.i != 0 )
+ return pxNeedData;
/* emulate hp bug */
{
pxeCompressMode_t c = par->pv[2]->value.i;
if ( c == eDeltaRowCompression || c == eJPEGCompression )
input_per_row = pxenum->benum.data_per_row;
}
- for ( ; ; )
- {
- byte *data = pxenum->pattern->data +
- (par->pv[0]->value.i +
- par->source.position / input_per_row)
- * pxenum->benum.data_per_row;
- byte *rdata = data;
-
- code = read_bitmap(&pxenum->benum, &rdata, par);
- if ( code != 1 )
- break;
- if ( rdata != data )
- memcpy(data, rdata, pxenum->benum.data_per_row);
- }
- return code;
+ for ( ; ; )
+ {
+ byte *data = pxenum->pattern->data +
+ (par->pv[0]->value.i +
+ par->source.position / input_per_row)
+ * pxenum->benum.data_per_row;
+ byte *rdata = data;
+
+ code = read_bitmap(&pxenum->benum, &rdata, par);
+ if ( code != 1 )
+ break;
+ if ( rdata != data )
+ memcpy(data, rdata, pxenum->benum.data_per_row);
+ }
+ return code;
}
const byte apxEndRastPattern[] = {0, 0};
int
pxEndRastPattern(px_args_t *par, px_state_t *pxs)
{ px_pattern_enum_t *pxenum = pxs->pattern_enum;
- /* We extract the key and value from the pattern_enum structure */
- /* and then free the structure, to encourage LIFO allocation. */
- px_pattern_t *pattern = pxenum->pattern;
- int32_t id = pxenum->pattern_id;
- px_value_t key;
- px_dict_t *pdict;
-
- switch ( pxenum->persistence )
- {
- case eTempPattern:
- pdict = &pxs->pxgs->temp_pattern_dict;
- break;
- case ePagePattern:
- pdict = &pxs->page_pattern_dict;
- break;
- case eSessionPattern:
- pdict = &pxs->session_pattern_dict;
- break;
- default: /* can't happen */
- return_error(errorIllegalAttributeValue);
- }
- key.type = pxd_array | pxd_ubyte;
- key.value.array.data = (byte *)&id;
- key.value.array.size = sizeof(id);
- gs_free_object(pxs->memory, pxenum, "pxEndRastPattern(pxenum)");
- return px_dict_put(pdict, &key, pattern);
+ /* We extract the key and value from the pattern_enum structure */
+ /* and then free the structure, to encourage LIFO allocation. */
+ px_pattern_t *pattern = pxenum->pattern;
+ int32_t id = pxenum->pattern_id;
+ px_value_t key;
+ px_dict_t *pdict;
+
+ switch ( pxenum->persistence )
+ {
+ case eTempPattern:
+ pdict = &pxs->pxgs->temp_pattern_dict;
+ break;
+ case ePagePattern:
+ pdict = &pxs->page_pattern_dict;
+ break;
+ case eSessionPattern:
+ pdict = &pxs->session_pattern_dict;
+ break;
+ default: /* can't happen */
+ return_error(errorIllegalAttributeValue);
+ }
+ key.type = pxd_array | pxd_ubyte;
+ key.value.array.data = (byte *)&id;
+ key.value.array.size = sizeof(id);
+ gs_free_object(pxs->memory, pxenum, "pxEndRastPattern(pxenum)");
+ return px_dict_put(pdict, &key, pattern);
}
/* ---------------- Scan line operators ---------------- */
@@ -826,10 +822,10 @@ int
pxBeginScan(px_args_t *par, px_state_t *pxs)
{ int code = px_set_paint(&pxs->pxgs->brush, pxs);
- if ( code < 0 )
- return code;
- /* We may as well reset the path now instead of at the end. */
- return gs_newpath(pxs->pgs);
+ if ( code < 0 )
+ return code;
+ /* We may as well reset the path now instead of at the end. */
+ return gs_newpath(pxs->pgs);
}
const byte apxEndScan[] = {0, 0};
@@ -844,128 +840,128 @@ const byte apxScanLineRel[] = {
int
pxScanLineRel(px_args_t *par, px_state_t *pxs)
{ /*
- * In order to keep the number of intermediate states down to a
- * reasonable number, we require enough data to be present to be
- * able to read the control information for each line, or an entire
- * x-pair. Initially, source.position is zero. As soon as we have
- * read the X/YStart type byte, we change it to:
- * (X/YStart type) << 28 + (x-pair type << 24) +
- * (# of full or partial scan lines left to process) + 1
- * We use the separate variable source.count to keep track of
- * the number of x-pairs left in the scan line.
- */
- gs_state *pgs = pxs->pgs;
- bool big_endian = pxs->data_source_big_endian;
- const byte *data = par->source.data;
- pxeDataType_t
- xystart_type = (par->source.position >> 28) & 0xf,
- xpair_type = (par->source.position >> 24) & 0xf;
- int code = 0;
- int rcount;
- gs_rect rlist[20]; /* 20 is arbitrary */
-
- /* Check for initial state. */
- if ( par->source.position == 0 )
- { /* Read XStart/YStart data type. */
- if ( par->source.available < 1 )
- return pxNeedData;
- xystart_type = data[0];
- if ( xystart_type != eSInt16 )
- return_error(errorIllegalDataValue);
- par->source.position =
- ((ulong)xystart_type << 28) +
- (par->pv[0] ? par->pv[0]->value.i : 1) + 1;
- par->source.data = data += 1;
- par->source.available -= 1;
- par->source.count = 0;
- }
- for ( rcount = 0; ; )
- {
-
- /* Check for start of scan line. */
- if ( par->source.count == 0 )
- { int ystart;
-
- if ( (par->source.position & 0xffffff) == 1 )
- { code = 0;
- break;
- }
- /* Read XStart and YStart values. */
- /* We know that eSInt16 is the only possible data type. */
- if ( par->source.available < 7 )
- { code = pxNeedData;
- break;
- }
- pxs->scan_point.x = sint16at(data, big_endian);
- ystart = sint16at(data + 2, big_endian);
- pxs->scan_point.y0 = ystart - 0.5;
- pxs->scan_point.y1 = ystart + 0.5;
- par->source.count = uint16at(data + 4, big_endian);
- if ( par->source.count == 0 )
- { code = gs_note_error(errorIllegalDataValue);
- break;
- }
- xpair_type = data[6];
- par->source.position =
- (par->source.position & 0xf0ffffff) +
- ((ulong)xpair_type << 24);
- par->source.data = data += 7;
- par->source.available -= 7;
- }
- /* Read and process one x-pair. */
- { uint x0, x1;
- uint used;
-
- switch ( xpair_type )
- {
- case eUByte:
- if ( par->source.available < 2 )
- { code = pxNeedData;
- goto out; /* 2-level break */
- }
- x0 = data[0];
- x1 = data[1];
- used = 2;
- break;
- case eUInt16:
- if ( par->source.available < 4 )
- { code = pxNeedData;
- goto out; /* 2-level break */
- }
- x0 = uint16at(data, big_endian);
- x1 = uint16at(data + 2, big_endian);
- used = 4;
- break;
- default:
- code = gs_note_error(errorIllegalDataValue);
- goto out; /* 2-level break; */
- }
- if ( rcount == countof(rlist) )
- { code = gs_rectfill(pgs, rlist, rcount);
- rcount = 0;
- pxs->have_page = true;
- if ( code < 0 )
- break;
- }
- { gs_rect *pr = &rlist[rcount++];
-
- pr->p.x = pxs->scan_point.x += x0;
- pr->p.y = pxs->scan_point.y0;
- pr->q.x = pxs->scan_point.x += x1;
- pr->q.y = pxs->scan_point.y1;
- }
- par->source.data = data += used;
- par->source.available -= used;
- }
- if ( !--(par->source.count) )
- --(par->source.position);
- }
+ * In order to keep the number of intermediate states down to a
+ * reasonable number, we require enough data to be present to be
+ * able to read the control information for each line, or an entire
+ * x-pair. Initially, source.position is zero. As soon as we have
+ * read the X/YStart type byte, we change it to:
+ * (X/YStart type) << 28 + (x-pair type << 24) +
+ * (# of full or partial scan lines left to process) + 1
+ * We use the separate variable source.count to keep track of
+ * the number of x-pairs left in the scan line.
+ */
+ gs_state *pgs = pxs->pgs;
+ bool big_endian = pxs->data_source_big_endian;
+ const byte *data = par->source.data;
+ pxeDataType_t
+ xystart_type = (par->source.position >> 28) & 0xf,
+ xpair_type = (par->source.position >> 24) & 0xf;
+ int code = 0;
+ int rcount;
+ gs_rect rlist[20]; /* 20 is arbitrary */
+
+ /* Check for initial state. */
+ if ( par->source.position == 0 )
+ { /* Read XStart/YStart data type. */
+ if ( par->source.available < 1 )
+ return pxNeedData;
+ xystart_type = data[0];
+ if ( xystart_type != eSInt16 )
+ return_error(errorIllegalDataValue);
+ par->source.position =
+ ((ulong)xystart_type << 28) +
+ (par->pv[0] ? par->pv[0]->value.i : 1) + 1;
+ par->source.data = data += 1;
+ par->source.available -= 1;
+ par->source.count = 0;
+ }
+ for ( rcount = 0; ; )
+ {
+
+ /* Check for start of scan line. */
+ if ( par->source.count == 0 )
+ { int ystart;
+
+ if ( (par->source.position & 0xffffff) == 1 )
+ { code = 0;
+ break;
+ }
+ /* Read XStart and YStart values. */
+ /* We know that eSInt16 is the only possible data type. */
+ if ( par->source.available < 7 )
+ { code = pxNeedData;
+ break;
+ }
+ pxs->scan_point.x = sint16at(data, big_endian);
+ ystart = sint16at(data + 2, big_endian);
+ pxs->scan_point.y0 = ystart - 0.5;
+ pxs->scan_point.y1 = ystart + 0.5;
+ par->source.count = uint16at(data + 4, big_endian);
+ if ( par->source.count == 0 )
+ { code = gs_note_error(errorIllegalDataValue);
+ break;
+ }
+ xpair_type = data[6];
+ par->source.position =
+ (par->source.position & 0xf0ffffff) +
+ ((ulong)xpair_type << 24);
+ par->source.data = data += 7;
+ par->source.available -= 7;
+ }
+ /* Read and process one x-pair. */
+ { uint x0, x1;
+ uint used;
+
+ switch ( xpair_type )
+ {
+ case eUByte:
+ if ( par->source.available < 2 )
+ { code = pxNeedData;
+ goto out; /* 2-level break */
+ }
+ x0 = data[0];
+ x1 = data[1];
+ used = 2;
+ break;
+ case eUInt16:
+ if ( par->source.available < 4 )
+ { code = pxNeedData;
+ goto out; /* 2-level break */
+ }
+ x0 = uint16at(data, big_endian);
+ x1 = uint16at(data + 2, big_endian);
+ used = 4;
+ break;
+ default:
+ code = gs_note_error(errorIllegalDataValue);
+ goto out; /* 2-level break; */
+ }
+ if ( rcount == countof(rlist) )
+ { code = gs_rectfill(pgs, rlist, rcount);
+ rcount = 0;
+ pxs->have_page = true;
+ if ( code < 0 )
+ break;
+ }
+ { gs_rect *pr = &rlist[rcount++];
+
+ pr->p.x = pxs->scan_point.x += x0;
+ pr->p.y = pxs->scan_point.y0;
+ pr->q.x = pxs->scan_point.x += x1;
+ pr->q.y = pxs->scan_point.y1;
+ }
+ par->source.data = data += used;
+ par->source.available -= used;
+ }
+ if ( !--(par->source.count) )
+ --(par->source.position);
+ }
out:
- if ( rcount > 0 && code >= 0 )
- { int rcode = gs_rectfill(pgs, rlist, rcount);
- pxs->have_page = true;
- if ( rcode < 0 )
- code = rcode;
- }
- return code;
+ if ( rcount > 0 && code >= 0 )
+ { int rcode = gs_rectfill(pgs, rlist, rcount);
+ pxs->have_page = true;
+ if ( rcode < 0 )
+ code = rcode;
+ }
+ return code;
}
diff --git a/pxl/pximpl.c b/pxl/pximpl.c
index 8bcddb065..453162661 100644
--- a/pxl/pximpl.c
+++ b/pxl/pximpl.c
@@ -23,8 +23,6 @@ extern const pl_interp_implementation_t pxl_implementation;
/* Zero-terminated list of pointers to implementations */
pl_interp_implementation_t const * const pdl_implementation[] = {
- &pxl_implementation,
- 0
+ &pxl_implementation,
+ 0
};
-
-
diff --git a/pxl/pxink.c b/pxl/pxink.c
index 7e202a5fc..70707120d 100644
--- a/pxl/pxink.c
+++ b/pxl/pxink.c
@@ -412,7 +412,6 @@ fraction_value(const px_value_t *pv, int i)
return (v < 0 ? 0 : v / int_type_max(type));
}
-
/* we use an enumeration instead of index numbers improve readability in this
"very busy" routine */
typedef enum {
@@ -859,4 +858,3 @@ pxSetAdaptiveHalftoning(px_args_t *par, px_state_t *pxs)
{
return 0;
}
-
diff --git a/pxl/pxoper.h b/pxl/pxoper.h
index 2579481c5..cd488556e 100644
--- a/pxl/pxoper.h
+++ b/pxl/pxoper.h
@@ -79,7 +79,7 @@ typedef struct px_parser_state_s px_parser_state_t;
typedef struct px_args_s {
struct ds_ {
ulong position; /* position in data block, initially 0, */
- /* provided for the operator's convenience */
+ /* provided for the operator's convenience */
uint count; /* another variable for the operators */
uint available; /* amount of data available in block */
bool phase; /* upon first call of the operator this will be 0. */
diff --git a/pxl/pxpaint.c b/pxl/pxpaint.c
index b70188e08..bdd6df9c8 100644
--- a/pxl/pxpaint.c
+++ b/pxl/pxpaint.c
@@ -74,58 +74,58 @@ add_lines(px_args_t *par, px_state_t *pxs,
int (*line_proc)(gs_state *, floatp, floatp))
{ int code = 0;
- if ( par->pv[0] )
- { /* Single segment, specified as argument. */
- if ( par->pv[1] || par->pv[2] )
- return_error(errorIllegalAttributeCombination);
- return (*line_proc)(pxs->pgs, real_value(par->pv[0], 0),
- real_value(par->pv[0], 1));
- }
- /* Multiple segments, specified in source data. */
- if ( !(par->pv[1] && par->pv[2]) )
- return_error(errorMissingAttribute);
- { int32_t num_points = par->pv[1]->value.i;
- pxeDataType_t type = (pxeDataType_t)par->pv[2]->value.i;
- int point_size = (type == eUByte || type == eSByte ? 2 : 4);
-
- while ( par->source.position < num_points * point_size )
- { const byte *dp = par->source.data;
- int px, py;
-
- if ( par->source.available < point_size )
- { /* We don't even have one point's worth of source data. */
- return pxNeedData;
- }
- switch ( type )
- {
- case eUByte:
- px = dp[0];
- py = dp[1];
- break;
- case eSByte:
- px = (int)(dp[0] ^ 0x80) - 0x80;
- py = (int)(dp[1] ^ 0x80) - 0x80;
- break;
- case eUInt16:
- px = uint16at(dp, pxs->data_source_big_endian);
- py = uint16at(dp + 2, pxs->data_source_big_endian);
- break;
- case eSInt16:
- px = sint16at(dp, pxs->data_source_big_endian);
- py = sint16at(dp + 2, pxs->data_source_big_endian);
- break;
- default: /* can't happen, pacify compiler */
- return_error(errorIllegalAttributeValue);
- }
- code = (*line_proc)(pxs->pgs, (floatp)px, (floatp)py);
- if ( code < 0 )
- break;
- par->source.position += point_size;
- par->source.available -= point_size;
- par->source.data += point_size;
- }
- }
- return code;
+ if ( par->pv[0] )
+ { /* Single segment, specified as argument. */
+ if ( par->pv[1] || par->pv[2] )
+ return_error(errorIllegalAttributeCombination);
+ return (*line_proc)(pxs->pgs, real_value(par->pv[0], 0),
+ real_value(par->pv[0], 1));
+ }
+ /* Multiple segments, specified in source data. */
+ if ( !(par->pv[1] && par->pv[2]) )
+ return_error(errorMissingAttribute);
+ { int32_t num_points = par->pv[1]->value.i;
+ pxeDataType_t type = (pxeDataType_t)par->pv[2]->value.i;
+ int point_size = (type == eUByte || type == eSByte ? 2 : 4);
+
+ while ( par->source.position < num_points * point_size )
+ { const byte *dp = par->source.data;
+ int px, py;
+
+ if ( par->source.available < point_size )
+ { /* We don't even have one point's worth of source data. */
+ return pxNeedData;
+ }
+ switch ( type )
+ {
+ case eUByte:
+ px = dp[0];
+ py = dp[1];
+ break;
+ case eSByte:
+ px = (int)(dp[0] ^ 0x80) - 0x80;
+ py = (int)(dp[1] ^ 0x80) - 0x80;
+ break;
+ case eUInt16:
+ px = uint16at(dp, pxs->data_source_big_endian);
+ py = uint16at(dp + 2, pxs->data_source_big_endian);
+ break;
+ case eSInt16:
+ px = sint16at(dp, pxs->data_source_big_endian);
+ py = sint16at(dp + 2, pxs->data_source_big_endian);
+ break;
+ default: /* can't happen, pacify compiler */
+ return_error(errorIllegalAttributeValue);
+ }
+ code = (*line_proc)(pxs->pgs, (floatp)px, (floatp)py);
+ if ( code < 0 )
+ break;
+ par->source.position += point_size;
+ par->source.available -= point_size;
+ par->source.data += point_size;
+ }
+ }
+ return code;
}
/* Add Bezier curves to the path. curve_proc is gs_curveto or gs_rcurveto. */
@@ -136,75 +136,75 @@ add_curves(px_args_t *par, px_state_t *pxs,
int (*curve_proc)(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp))
{ int code = 0;
- if ( par->pv[2] && par->pv[3] && par->pv[4] )
- { /* Single curve, specified as argument. */
- if ( par->pv[0] || par->pv[1] )
- return_error(errorIllegalAttributeCombination);
- return (*curve_proc)(pxs->pgs, real_value(par->pv[2], 0),
- real_value(par->pv[2], 1),
- real_value(par->pv[3], 0),
- real_value(par->pv[3], 1),
- real_value(par->pv[4], 0),
- real_value(par->pv[4], 1));
- }
- /* Multiple segments, specified in source data. */
- else if ( par->pv[0] && par->pv[1] )
- { if ( par->pv[2] || par->pv[3] || par->pv[4] )
- return_error(errorIllegalAttributeCombination);
- }
- else
- return_error(errorMissingAttribute);
- { int32_t num_points = par->pv[0]->value.i;
- pxeDataType_t type = (pxeDataType_t)par->pv[1]->value.i;
- int point_size = (type == eUByte || type == eSByte ? 2 : 4);
- int segment_size = point_size * 3;
-
- if ( num_points % 3 )
- return_error(errorIllegalDataLength);
- while ( par->source.position < num_points * point_size )
- { const byte *dp = par->source.data;
- int points[6];
- int i;
-
- if ( par->source.available < point_size * 3 )
- { /* We don't even have one point's worth of source data. */
- return pxNeedData;
- }
- switch ( type )
- {
- case eUByte:
- for ( i = 0; i < 6; ++i )
- points[i] = dp[i];
- break;
- case eSByte:
- for ( i = 0; i < 6; ++i )
- points[i] = (int)(dp[i] ^ 0x80) - 0x80;
- break;
- case eUInt16:
- for ( i = 0; i < 12; i += 2 )
- points[i >> 1] =
- uint16at(dp + i, pxs->data_source_big_endian);
- break;
- case eSInt16:
- for ( i = 0; i < 12; i += 2 )
- points[i >> 1]
- = sint16at(dp + i, pxs->data_source_big_endian);
- break;
- default: /* can't happen, pacify compiler */
- return_error(errorIllegalAttributeValue);
- }
- code = (*curve_proc)(pxs->pgs,
- (floatp)points[0], (floatp)points[1],
- (floatp)points[2], (floatp)points[3],
- (floatp)points[4], (floatp)points[5]);
- if ( code < 0 )
- break;
- par->source.position += segment_size;
- par->source.available -= segment_size;
- par->source.data += segment_size;
- }
- }
- return code;
+ if ( par->pv[2] && par->pv[3] && par->pv[4] )
+ { /* Single curve, specified as argument. */
+ if ( par->pv[0] || par->pv[1] )
+ return_error(errorIllegalAttributeCombination);
+ return (*curve_proc)(pxs->pgs, real_value(par->pv[2], 0),
+ real_value(par->pv[2], 1),
+ real_value(par->pv[3], 0),
+ real_value(par->pv[3], 1),
+ real_value(par->pv[4], 0),
+ real_value(par->pv[4], 1));
+ }
+ /* Multiple segments, specified in source data. */
+ else if ( par->pv[0] && par->pv[1] )
+ { if ( par->pv[2] || par->pv[3] || par->pv[4] )
+ return_error(errorIllegalAttributeCombination);
+ }
+ else
+ return_error(errorMissingAttribute);
+ { int32_t num_points = par->pv[0]->value.i;
+ pxeDataType_t type = (pxeDataType_t)par->pv[1]->value.i;
+ int point_size = (type == eUByte || type == eSByte ? 2 : 4);
+ int segment_size = point_size * 3;
+
+ if ( num_points % 3 )
+ return_error(errorIllegalDataLength);
+ while ( par->source.position < num_points * point_size )
+ { const byte *dp = par->source.data;
+ int points[6];
+ int i;
+
+ if ( par->source.available < point_size * 3 )
+ { /* We don't even have one point's worth of source data. */
+ return pxNeedData;
+ }
+ switch ( type )
+ {
+ case eUByte:
+ for ( i = 0; i < 6; ++i )
+ points[i] = dp[i];
+ break;
+ case eSByte:
+ for ( i = 0; i < 6; ++i )
+ points[i] = (int)(dp[i] ^ 0x80) - 0x80;
+ break;
+ case eUInt16:
+ for ( i = 0; i < 12; i += 2 )
+ points[i >> 1] =
+ uint16at(dp + i, pxs->data_source_big_endian);
+ break;
+ case eSInt16:
+ for ( i = 0; i < 12; i += 2 )
+ points[i >> 1]
+ = sint16at(dp + i, pxs->data_source_big_endian);
+ break;
+ default: /* can't happen, pacify compiler */
+ return_error(errorIllegalAttributeValue);
+ }
+ code = (*curve_proc)(pxs->pgs,
+ (floatp)points[0], (floatp)points[1],
+ (floatp)points[2], (floatp)points[3],
+ (floatp)points[4], (floatp)points[5]);
+ if ( code < 0 )
+ break;
+ par->source.position += segment_size;
+ par->source.available -= segment_size;
+ par->source.data += segment_size;
+ }
+ }
+ return code;
}
/*
@@ -242,86 +242,86 @@ static int /* px_arc_type_t or error code */
setup_arc(px_arc_params_t *params, const px_value_t *pbox,
const px_value_t *pp3, const px_value_t *pp4, const px_state_t *pxs, bool ellipse)
{ real x1 = real_value(pbox, 0);
- real y1 = real_value(pbox, 1);
- real x2 = real_value(pbox, 2);
- real y2 = real_value(pbox, 3);
- real xc = (x1 + x2) * 0.5;
- real yc = (y1 + y2) * 0.5;
- real xr, yr;
- bool rotated;
- int code;
+ real y1 = real_value(pbox, 1);
+ real x2 = real_value(pbox, 2);
+ real y2 = real_value(pbox, 3);
+ real xc = (x1 + x2) * 0.5;
+ real yc = (y1 + y2) * 0.5;
+ real xr, yr;
+ bool rotated;
+ int code;
#ifdef REFLECT_NEGATIVE_ARCS
- rotated = x1 > x2;
- params->reversed = rotated ^ (y1 > y2);
+ rotated = x1 > x2;
+ params->reversed = rotated ^ (y1 > y2);
#else
- rotated = false;
- params->reversed = false;
+ rotated = false;
+ params->reversed = false;
#endif
- if ( x1 > x2 )
- { real temp = x1; x1 = x2; x2 = temp;
- }
- if ( y1 > y2 )
- { real temp = y1; y1 = y2; y2 = temp;
- }
- params->origin.x = x1;
- params->origin.y = y1;
- xr = (x2 - x1) * 0.5;
- yr = (y2 - y1) * 0.5;
- /* From what we can gather ellipses are degenerate if both
+ if ( x1 > x2 )
+ { real temp = x1; x1 = x2; x2 = temp;
+ }
+ if ( y1 > y2 )
+ { real temp = y1; y1 = y2; y2 = temp;
+ }
+ params->origin.x = x1;
+ params->origin.y = y1;
+ xr = (x2 - x1) * 0.5;
+ yr = (y2 - y1) * 0.5;
+ /* From what we can gather ellipses are degenerate if both
width and height of the bounding box are 0. Other objects
behave as expected. A 0 area bounding box is degenerate */
- if ( ellipse ) {
- /* The bounding box is degenerate, set what we can and exit. */
- if ( xr == 0 && yr == 0 ) {
- params->center.x = xc;
- params->center.y = yc;
- return arc_degenerate;
- }
- } else {
- if ( xr == 0 || yr == 0 ) {
- params->center.x = xc;
- params->center.y = yc;
- return arc_degenerate;
- }
- }
-
- if ( pp3 && pp4 )
- { real dx3 = real_value(pp3, 0) - xc;
- real dy3 = real_value(pp3, 1) - yc;
- real dx4 = real_value(pp4, 0) - xc;
- real dy4 = real_value(pp4, 1) - yc;
-
- if ( (dx3 == 0 && dy3 == 0) || (dx4 == 0 && dy4 == 0) )
- return_error(errorIllegalAttributeValue);
- { double ang3 = atan2(dy3 * xr, dx3 * yr) * radians_to_degrees;
- double ang4 = atan2(dy4 * xr, dx4 * yr) * radians_to_degrees;
-
- if ( rotated )
- ang3 += 180, ang4 += 180;
- params->ang3 = ang3;
- params->ang4 = ang4;
- }
- }
- params->radius = yr;
- if ( xr == yr )
- { params->center.x = xc;
- params->center.y = yc;
- return arc_square;
- }
- else
- { /* Must adjust the CTM. Move the origin to (xc,yc) */
- /* for simplicity. */
- if ( (code = gs_currentmatrix(pxs->pgs, &params->save_ctm)) < 0 ||
- (code = gs_translate(pxs->pgs, xc, yc)) < 0 ||
- (code = gs_scale(pxs->pgs, xr, yr)) < 0
- )
- return code;
- params->center.x = 0;
- params->center.y = 0;
- params->radius = 1.0;
- return arc_rectangular;
- }
+ if ( ellipse ) {
+ /* The bounding box is degenerate, set what we can and exit. */
+ if ( xr == 0 && yr == 0 ) {
+ params->center.x = xc;
+ params->center.y = yc;
+ return arc_degenerate;
+ }
+ } else {
+ if ( xr == 0 || yr == 0 ) {
+ params->center.x = xc;
+ params->center.y = yc;
+ return arc_degenerate;
+ }
+ }
+
+ if ( pp3 && pp4 )
+ { real dx3 = real_value(pp3, 0) - xc;
+ real dy3 = real_value(pp3, 1) - yc;
+ real dx4 = real_value(pp4, 0) - xc;
+ real dy4 = real_value(pp4, 1) - yc;
+
+ if ( (dx3 == 0 && dy3 == 0) || (dx4 == 0 && dy4 == 0) )
+ return_error(errorIllegalAttributeValue);
+ { double ang3 = atan2(dy3 * xr, dx3 * yr) * radians_to_degrees;
+ double ang4 = atan2(dy4 * xr, dx4 * yr) * radians_to_degrees;
+
+ if ( rotated )
+ ang3 += 180, ang4 += 180;
+ params->ang3 = ang3;
+ params->ang4 = ang4;
+ }
+ }
+ params->radius = yr;
+ if ( xr == yr )
+ { params->center.x = xc;
+ params->center.y = yc;
+ return arc_square;
+ }
+ else
+ { /* Must adjust the CTM. Move the origin to (xc,yc) */
+ /* for simplicity. */
+ if ( (code = gs_currentmatrix(pxs->pgs, &params->save_ctm)) < 0 ||
+ (code = gs_translate(pxs->pgs, xc, yc)) < 0 ||
+ (code = gs_scale(pxs->pgs, xr, yr)) < 0
+ )
+ return code;
+ params->center.x = 0;
+ params->center.y = 0;
+ params->radius = 1.0;
+ return arc_rectangular;
+ }
}
/* per the nonsense in 5.7.3 (The ROP3 Operands) from the pxl
@@ -339,99 +339,99 @@ pxl_allow_rop_for_stroke(gs_state *pgs)
static int
paint_path(px_state_t *pxs, bool reset)
{ gs_state *pgs = pxs->pgs;
- gx_path *ppath = gx_current_path(pgs);
- px_gstate_t *pxgs = pxs->pxgs;
- bool will_stroke = pxgs->pen.type != pxpNull;
- gs_point cursor;
- int code = 0;
- gx_path *save_path = 0;
-
- if ( gx_path_is_void(ppath) )
- return 0; /* nothing to draw */
+ gx_path *ppath = gx_current_path(pgs);
+ px_gstate_t *pxgs = pxs->pxgs;
+ bool will_stroke = pxgs->pen.type != pxpNull;
+ gs_point cursor;
+ int code = 0;
+ gx_path *save_path = 0;
+
+ if ( gx_path_is_void(ppath) )
+ return 0; /* nothing to draw */
#ifdef NO_SCALE_DASH_PATTERN
# define save_for_stroke (!reset || pxgs->dashed)
#else
# define save_for_stroke (!reset)
#endif
- if ( pxgs->brush.type != pxpNull )
- { int (*fill_proc)(gs_state *) =
- (pxgs->fill_mode == eEvenOdd ? gs_eofill : gs_fill);
-
- if ( (code = px_set_paint(&pxgs->brush, pxs)) < 0 )
- return code;
- pxs->have_page = true;
- if ( !will_stroke && reset )
- { gs_currentpoint(pgs, &cursor);
- code = (*fill_proc)(pgs);
- gs_moveto(pgs, cursor.x, cursor.y);
- return code;
- }
- save_path = gx_path_alloc(pxs->memory, "paint_path(save_path)");
- if ( save_path == 0 )
- return_error(errorInsufficientMemory);
- gx_path_assign_preserve(save_path, ppath);
- code = (*fill_proc)(pgs);
- if ( code < 0 )
- goto rx;
- if ( !will_stroke )
- goto rx;
- if ( save_for_stroke )
- gx_path_assign_preserve(ppath, save_path);
- else {
- gx_path_assign_free(ppath, save_path);
+ if ( pxgs->brush.type != pxpNull )
+ { int (*fill_proc)(gs_state *) =
+ (pxgs->fill_mode == eEvenOdd ? gs_eofill : gs_fill);
+
+ if ( (code = px_set_paint(&pxgs->brush, pxs)) < 0 )
+ return code;
+ pxs->have_page = true;
+ if ( !will_stroke && reset )
+ { gs_currentpoint(pgs, &cursor);
+ code = (*fill_proc)(pgs);
+ gs_moveto(pgs, cursor.x, cursor.y);
+ return code;
+ }
+ save_path = gx_path_alloc(pxs->memory, "paint_path(save_path)");
+ if ( save_path == 0 )
+ return_error(errorInsufficientMemory);
+ gx_path_assign_preserve(save_path, ppath);
+ code = (*fill_proc)(pgs);
+ if ( code < 0 )
+ goto rx;
+ if ( !will_stroke )
+ goto rx;
+ if ( save_for_stroke )
+ gx_path_assign_preserve(ppath, save_path);
+ else {
+ gx_path_assign_free(ppath, save_path);
gx_setcurrentpoint_from_path((gs_imager_state *)pgs, ppath);
- gs_currentpoint(pgs, &cursor);
- save_path = 0;
- }
- }
- else if ( !will_stroke )
- return 0;
- else if ( save_for_stroke )
- { save_path =
- gx_path_alloc(pxs->memory, "paint_path(save_path)");
- if ( save_path == 0 )
- return_error(errorInsufficientMemory);
- gx_path_assign_preserve(save_path, ppath);
- }
- else
- gs_currentpoint(pgs, &cursor);
- /*
- * The PCL XL documentation from H-P says that dash lengths do not
- * scale according to the CTM, but according to H-P developer
- * support, this isn't true. We went to the trouble of implementing
- * the published specification, so if it turns out to be right after
- * all, we execute the following block of code.
- */
+ gs_currentpoint(pgs, &cursor);
+ save_path = 0;
+ }
+ }
+ else if ( !will_stroke )
+ return 0;
+ else if ( save_for_stroke )
+ { save_path =
+ gx_path_alloc(pxs->memory, "paint_path(save_path)");
+ if ( save_path == 0 )
+ return_error(errorInsufficientMemory);
+ gx_path_assign_preserve(save_path, ppath);
+ }
+ else
+ gs_currentpoint(pgs, &cursor);
+ /*
+ * The PCL XL documentation from H-P says that dash lengths do not
+ * scale according to the CTM, but according to H-P developer
+ * support, this isn't true. We went to the trouble of implementing
+ * the published specification, so if it turns out to be right after
+ * all, we execute the following block of code.
+ */
#ifdef NO_SCALE_DASH_PATTERN
- /*
- * If we have a dash pattern that was defined with a different
- * CTM than the current one, we must pre-expand the dashes.
- * (Eventually we should expand the library API to handle this.)
- */
- if ( pxgs->dashed )
- { gs_matrix mat;
- gs_currentmatrix(pgs, &mat);
- if ( mat.xx != pxgs->dash_matrix.xx ||
- mat.xy != pxgs->dash_matrix.xy ||
- mat.yx != pxgs->dash_matrix.yx ||
- mat.yy != pxgs->dash_matrix.yy
- )
- { code = gs_flattenpath(pgs);
- if ( code < 0 )
- goto rx;
- gs_setmatrix(pgs, &pxgs->dash_matrix);
- code = gs_dashpath(pgs);
- gs_setmatrix(pgs, &mat);
- if ( code < 0 )
- goto rx;
- }
- }
+ /*
+ * If we have a dash pattern that was defined with a different
+ * CTM than the current one, we must pre-expand the dashes.
+ * (Eventually we should expand the library API to handle this.)
+ */
+ if ( pxgs->dashed )
+ { gs_matrix mat;
+ gs_currentmatrix(pgs, &mat);
+ if ( mat.xx != pxgs->dash_matrix.xx ||
+ mat.xy != pxgs->dash_matrix.xy ||
+ mat.yx != pxgs->dash_matrix.yx ||
+ mat.yy != pxgs->dash_matrix.yy
+ )
+ { code = gs_flattenpath(pgs);
+ if ( code < 0 )
+ goto rx;
+ gs_setmatrix(pgs, &pxgs->dash_matrix);
+ code = gs_dashpath(pgs);
+ gs_setmatrix(pgs, &mat);
+ if ( code < 0 )
+ goto rx;
+ }
+ }
#endif
- /*
- * Per the description in the PCL XL reference documentation,
- * set a standard logical operation and transparency for stroking.
- */
- {
+ /*
+ * Per the description in the PCL XL reference documentation,
+ * set a standard logical operation and transparency for stroking.
+ */
+ {
gs_rop3_t save_rop = gs_currentrasterop(pgs);
bool save_transparent = gs_currenttexturetransparent(pgs);
bool need_restore_rop = false;
@@ -452,27 +452,27 @@ paint_path(px_state_t *pxs, bool reset)
}
}
rx: if ( save_path ) {
- gx_path_assign_free(ppath, save_path); /* path without a Current point! */
- gx_setcurrentpoint_from_path((gs_imager_state *)pgs, ppath);
- }
- else /* Iff save_path is NULL, set currentpoint back to original */
- gs_moveto(pgs, cursor.x, cursor.y);
- return code;
+ gx_path_assign_free(ppath, save_path); /* path without a Current point! */
+ gx_setcurrentpoint_from_path((gs_imager_state *)pgs, ppath);
+ }
+ else /* Iff save_path is NULL, set currentpoint back to original */
+ gs_moveto(pgs, cursor.x, cursor.y);
+ return code;
}
/* Paint a shape defined by a one-operator path. */
static int
paint_shape(px_args_t *par, px_state_t *pxs, px_operator_proc((*path_op)))
{ int code;
- if ( (code = pxNewPath(par, pxs)) < 0 ||
- (code = (*path_op)(par, pxs)) < 0
- )
- return code;
- /* See the beginning of the file regarding the following. */
+ if ( (code = pxNewPath(par, pxs)) < 0 ||
+ (code = (*path_op)(par, pxs)) < 0
+ )
+ return code;
+ /* See the beginning of the file regarding the following. */
#ifdef NEWPATH_AFTER_PAINT_SHAPE
- return paint_path(pxs, true);
+ return paint_path(pxs, true);
#else
- return paint_path(pxs, false);
+ return paint_path(pxs, false);
#endif
}
@@ -503,33 +503,33 @@ const byte apxArcPath[] = {
int
pxArcPath(px_args_t *par, px_state_t *pxs)
{ /*
- * Note that "clockwise" in user space is counter-clockwise on
- * the page, because the Y coordinate is inverted.
- */
- bool clockwise =
- (par->pv[3] != 0 && par->pv[3]->value.i == eClockWise);
- px_arc_params_t params;
- int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
- int rcode = code;
-
- if ( code >= 0 && code != arc_degenerate )
- { bool closed = params.ang3 == params.ang4;
- clockwise ^= params.reversed;
- if ( closed )
- { if ( clockwise ) params.ang4 += 360;
- else params.ang3 += 360;
- }
- code = gs_arc_add(pxs->pgs, !clockwise, params.center.x,
- params.center.y, params.radius, params.ang3,
- params.ang4, false);
- if ( code >= 0 && closed )
- { /* We have to close the path explicitly. */
- code = gs_closepath(pxs->pgs);
- }
- }
- if ( rcode == arc_rectangular )
- gs_setmatrix(pxs->pgs, &params.save_ctm);
- return code;
+ * Note that "clockwise" in user space is counter-clockwise on
+ * the page, because the Y coordinate is inverted.
+ */
+ bool clockwise =
+ (par->pv[3] != 0 && par->pv[3]->value.i == eClockWise);
+ px_arc_params_t params;
+ int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
+ int rcode = code;
+
+ if ( code >= 0 && code != arc_degenerate )
+ { bool closed = params.ang3 == params.ang4;
+ clockwise ^= params.reversed;
+ if ( closed )
+ { if ( clockwise ) params.ang4 += 360;
+ else params.ang3 += 360;
+ }
+ code = gs_arc_add(pxs->pgs, !clockwise, params.center.x,
+ params.center.y, params.radius, params.ang3,
+ params.ang4, false);
+ if ( code >= 0 && closed )
+ { /* We have to close the path explicitly. */
+ code = gs_closepath(pxs->pgs);
+ }
+ }
+ if ( rcode == arc_rectangular )
+ gs_setmatrix(pxs->pgs, &params.save_ctm);
+ return code;
}
const byte apxBezierPath[] = {
@@ -565,25 +565,25 @@ const byte apxChordPath[] = {
int
pxChordPath(px_args_t *par, px_state_t *pxs)
{ px_arc_params_t params;
- int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
- int rcode = code;
-
- /* See ArcPath above for the meaning of "clockwise". */
- if ( code >= 0 && code != arc_degenerate )
- { if ( params.ang3 == params.ang4 )
- params.ang3 += 360;
- code = gs_arc_add(pxs->pgs, !params.reversed,
- params.center.x, params.center.y,
- params.radius, params.ang3, params.ang4,
- false);
- if ( code >= 0 )
- code = gs_closepath(pxs->pgs);
- }
- if ( rcode == arc_rectangular )
- gs_setmatrix(pxs->pgs, &params.save_ctm);
- if ( code >= 0 )
- code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y);
- return code;
+ int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
+ int rcode = code;
+
+ /* See ArcPath above for the meaning of "clockwise". */
+ if ( code >= 0 && code != arc_degenerate )
+ { if ( params.ang3 == params.ang4 )
+ params.ang3 += 360;
+ code = gs_arc_add(pxs->pgs, !params.reversed,
+ params.center.x, params.center.y,
+ params.radius, params.ang3, params.ang4,
+ false);
+ if ( code >= 0 )
+ code = gs_closepath(pxs->pgs);
+ }
+ if ( rcode == arc_rectangular )
+ gs_setmatrix(pxs->pgs, &params.save_ctm);
+ if ( code >= 0 )
+ code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y);
+ return code;
}
@@ -602,30 +602,30 @@ const byte apxEllipsePath[] = {
int
pxEllipsePath(px_args_t *par, px_state_t *pxs)
{ px_arc_params_t params;
- int code = setup_arc(&params, par->pv[0], NULL, NULL, pxs, true);
- int rcode = code;
- real a_start = 180.0;
- real a_end = -180.0;
-
- /* swap start and end angles if counter clockwise ellipse */
- if ( params.reversed )
- { a_start = -180.0;
- a_end = 180.0;
- }
- /* See ArcPath above for the meaning of "clockwise". */
- if ( code < 0 || code == arc_degenerate ||
- (code = gs_arc_add(pxs->pgs, !params.reversed,
- params.center.x, params.center.y,
- params.radius, a_start, a_end, false)) < 0 ||
- /* We have to close the path explicitly. */
- (code = gs_closepath(pxs->pgs)) < 0
- )
- DO_NOTHING;
- if ( rcode == arc_rectangular )
- gs_setmatrix(pxs->pgs, &params.save_ctm);
- if ( code >= 0 )
- code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y);
- return code;
+ int code = setup_arc(&params, par->pv[0], NULL, NULL, pxs, true);
+ int rcode = code;
+ real a_start = 180.0;
+ real a_end = -180.0;
+
+ /* swap start and end angles if counter clockwise ellipse */
+ if ( params.reversed )
+ { a_start = -180.0;
+ a_end = 180.0;
+ }
+ /* See ArcPath above for the meaning of "clockwise". */
+ if ( code < 0 || code == arc_degenerate ||
+ (code = gs_arc_add(pxs->pgs, !params.reversed,
+ params.center.x, params.center.y,
+ params.radius, a_start, a_end, false)) < 0 ||
+ /* We have to close the path explicitly. */
+ (code = gs_closepath(pxs->pgs)) < 0
+ )
+ DO_NOTHING;
+ if ( rcode == arc_rectangular )
+ gs_setmatrix(pxs->pgs, &params.save_ctm);
+ if ( code >= 0 )
+ code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y);
+ return code;
}
const byte apxLinePath[] = {
@@ -659,29 +659,29 @@ const byte apxPiePath[] = {
int
pxPiePath(px_args_t *par, px_state_t *pxs)
{ px_arc_params_t params;
- int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
- int rcode = code;
-
- /* See ArcPath above for the meaning of "clockwise". */
- if ( code >= 0 && code != arc_degenerate )
- { if ( params.ang3 == params.ang4 )
- params.ang3 += 360;
- code = gs_moveto(pxs->pgs, params.center.x, params.center.y);
- if ( code >= 0 )
- { code = gs_arc_add(pxs->pgs, !params.reversed,
- params.center.x, params.center.y,
- params.radius, params.ang3, params.ang4,
- true);
- }
- }
- if ( rcode == arc_rectangular )
- gs_setmatrix(pxs->pgs, &params.save_ctm);
- if ( code < 0 || rcode == arc_degenerate ||
- (code = gs_closepath(pxs->pgs)) < 0 ||
- (code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y)) < 0
- )
- DO_NOTHING;
- return code;
+ int code = setup_arc(&params, par->pv[0], par->pv[1], par->pv[2], pxs, false);
+ int rcode = code;
+
+ /* See ArcPath above for the meaning of "clockwise". */
+ if ( code >= 0 && code != arc_degenerate )
+ { if ( params.ang3 == params.ang4 )
+ params.ang3 += 360;
+ code = gs_moveto(pxs->pgs, params.center.x, params.center.y);
+ if ( code >= 0 )
+ { code = gs_arc_add(pxs->pgs, !params.reversed,
+ params.center.x, params.center.y,
+ params.radius, params.ang3, params.ang4,
+ true);
+ }
+ }
+ if ( rcode == arc_rectangular )
+ gs_setmatrix(pxs->pgs, &params.save_ctm);
+ if ( code < 0 || rcode == arc_degenerate ||
+ (code = gs_closepath(pxs->pgs)) < 0 ||
+ (code = gs_moveto(pxs->pgs, params.origin.x, params.origin.y)) < 0
+ )
+ DO_NOTHING;
+ return code;
}
const byte apxRectangle[] = {
@@ -699,45 +699,45 @@ const byte apxRectanglePath[] = {
int
pxRectanglePath(px_args_t *par, px_state_t *pxs)
{ floatp x1, y1, x2, y2;
- gs_fixed_point p1;
- gs_state *pgs = pxs->pgs;
- gx_path *ppath = gx_current_path(pgs);
- gs_fixed_point lines[3];
+ gs_fixed_point p1;
+ gs_state *pgs = pxs->pgs;
+ gx_path *ppath = gx_current_path(pgs);
+ gs_fixed_point lines[3];
#define p2 lines[1]
#define pctm (&((const gs_imager_state *)pgs)->ctm)
- int code;
-
- set_box_value(x1, y1, x2, y2, par->pv[0]);
- /*
- * Rectangles are always drawn in a canonical order.
- */
- if ( x1 > x2 )
- { floatp t = x1; x1 = x2; x2 = t; }
- if ( y1 > y2 )
- { floatp t = y1; y1 = y2; y2 = t; }
- if ( (code = gs_point_transform2fixed(pctm, x1, y1, &p1)) < 0 ||
- (code = gs_point_transform2fixed(pctm, x2, y2, &p2)) < 0 ||
- (code = gs_moveto(pgs, x1, y1)) < 0
- )
- return code;
+ int code;
+
+ set_box_value(x1, y1, x2, y2, par->pv[0]);
+ /*
+ * Rectangles are always drawn in a canonical order.
+ */
+ if ( x1 > x2 )
+ { floatp t = x1; x1 = x2; x2 = t; }
+ if ( y1 > y2 )
+ { floatp t = y1; y1 = y2; y2 = t; }
+ if ( (code = gs_point_transform2fixed(pctm, x1, y1, &p1)) < 0 ||
+ (code = gs_point_transform2fixed(pctm, x2, y2, &p2)) < 0 ||
+ (code = gs_moveto(pgs, x1, y1)) < 0
+ )
+ return code;
#ifdef DRAW_RECTANGLES_CLOCKWISE
- /*
- * DRAW_RECTANGLES_CLOCKWISE means clockwise on the page, which is
- * counter-clockwise in user space.
- */
- if ( (code = gs_point_transform2fixed(pctm, x2, y1, &lines[0])) < 0 ||
- (code = gs_point_transform2fixed(pctm, x1, y2, &lines[2])) < 0
- )
- return code;
+ /*
+ * DRAW_RECTANGLES_CLOCKWISE means clockwise on the page, which is
+ * counter-clockwise in user space.
+ */
+ if ( (code = gs_point_transform2fixed(pctm, x2, y1, &lines[0])) < 0 ||
+ (code = gs_point_transform2fixed(pctm, x1, y2, &lines[2])) < 0
+ )
+ return code;
#else
- if ( (code = gs_point_transform2fixed(pctm, x1, y2, &lines[0])) < 0 ||
- (code = gs_point_transform2fixed(pctm, x2, y1, &lines[2])) < 0
- )
- return code;
+ if ( (code = gs_point_transform2fixed(pctm, x1, y2, &lines[0])) < 0 ||
+ (code = gs_point_transform2fixed(pctm, x2, y1, &lines[2])) < 0
+ )
+ return code;
#endif
- if ( (code = gx_path_add_lines(ppath, lines, 3)) < 0 )
- return code;
- return gs_closepath(pgs);
+ if ( (code = gx_path_add_lines(ppath, lines, 3)) < 0 )
+ return code;
+ return gs_closepath(pgs);
#undef pctm
#undef p2
}
@@ -757,50 +757,50 @@ const byte apxRoundRectanglePath[] = {
int
pxRoundRectanglePath(px_args_t *par, px_state_t *pxs)
{ floatp x1, y1, x2, y2;
- real xr = real_value(par->pv[1], 0) * 0.5;
- real yr = real_value(par->pv[1], 1) * 0.5;
- real xd, yd;
- gs_matrix save_ctm;
- gs_state *pgs = pxs->pgs;
- int code;
-
- set_box_value(x1, y1, x2, y2, par->pv[0]);
- xd = x2 - x1;
- yd = y2 - y1;
- /*
- * H-P printers give an error if the points are specified out
- * of order.
- */
- if ( xd < 0 || yd < 0 )
- return_error(errorIllegalAttributeValue);
- if ( xr == 0 || yr == 0 )
- return pxRectanglePath(par, pxs);
- gs_currentmatrix(pgs, &save_ctm);
- gs_translate(pgs, x1, y1);
- if ( xr != yr )
- { /* Change coordinates so the arcs are circular. */
- double scale = xr / yr;
- if ( (code = gs_scale(pgs, scale, 1.0)) < 0 )
- return code;
- xd *= yr / xr;
- }
+ real xr = real_value(par->pv[1], 0) * 0.5;
+ real yr = real_value(par->pv[1], 1) * 0.5;
+ real xd, yd;
+ gs_matrix save_ctm;
+ gs_state *pgs = pxs->pgs;
+ int code;
+
+ set_box_value(x1, y1, x2, y2, par->pv[0]);
+ xd = x2 - x1;
+ yd = y2 - y1;
+ /*
+ * H-P printers give an error if the points are specified out
+ * of order.
+ */
+ if ( xd < 0 || yd < 0 )
+ return_error(errorIllegalAttributeValue);
+ if ( xr == 0 || yr == 0 )
+ return pxRectanglePath(par, pxs);
+ gs_currentmatrix(pgs, &save_ctm);
+ gs_translate(pgs, x1, y1);
+ if ( xr != yr )
+ { /* Change coordinates so the arcs are circular. */
+ double scale = xr / yr;
+ if ( (code = gs_scale(pgs, scale, 1.0)) < 0 )
+ return code;
+ xd *= yr / xr;
+ }
#define r yr
- /*
- * Draw the rectangle counter-clockwise on the page, which is
- * clockwise in user space. (This may be reversed if the
- * coordinates are specified in a non-standard order.)
- */
- if ( (code = gs_moveto(pgs, 0.0, r)) < 0 ||
- (code = gs_arcn(pgs, r, yd - r, r, 180.0, 90.0)) < 0 ||
- (code = gs_arcn(pgs, xd - r, yd - r, r, 90.0, 0.0)) < 0 ||
- (code = gs_arcn(pgs, xd - r, r, r, 0.0, 270.0)) < 0 ||
- (code = gs_arcn(pgs, r, r, r, 270.0, 180.0)) < 0 ||
- (code = gs_closepath(pgs)) < 0 ||
- (code = gs_moveto(pgs, 0.0, 0.0)) < 0
- )
- return code;
+ /*
+ * Draw the rectangle counter-clockwise on the page, which is
+ * clockwise in user space. (This may be reversed if the
+ * coordinates are specified in a non-standard order.)
+ */
+ if ( (code = gs_moveto(pgs, 0.0, r)) < 0 ||
+ (code = gs_arcn(pgs, r, yd - r, r, 180.0, 90.0)) < 0 ||
+ (code = gs_arcn(pgs, xd - r, yd - r, r, 90.0, 0.0)) < 0 ||
+ (code = gs_arcn(pgs, xd - r, r, r, 0.0, 270.0)) < 0 ||
+ (code = gs_arcn(pgs, r, r, r, 270.0, 180.0)) < 0 ||
+ (code = gs_closepath(pgs)) < 0 ||
+ (code = gs_moveto(pgs, 0.0, 0.0)) < 0
+ )
+ return code;
#undef r
- return gs_setmatrix(pgs, &save_ctm);
+ return gs_setmatrix(pgs, &save_ctm);
}
const byte apxText[] = {
@@ -809,14 +809,14 @@ const byte apxText[] = {
int
pxText(px_args_t *par, px_state_t *pxs)
{ { int code = px_set_paint(&pxs->pxgs->brush, pxs);
- if ( code < 0 )
- return code;
- }
- if ( par->pv[0]->value.array.size != 0 &&
- pxs->pxgs->brush.type != pxpNull
- )
- pxs->have_page = true;
- return px_text(par, pxs, false);
+ if ( code < 0 )
+ return code;
+ }
+ if ( par->pv[0]->value.array.size != 0 &&
+ pxs->pxgs->brush.type != pxpNull
+ )
+ pxs->have_page = true;
+ return px_text(par, pxs, false);
}
const byte apxTextPath[] = {
@@ -824,16 +824,15 @@ const byte apxTextPath[] = {
};
int
pxTextPath(px_args_t *par, px_state_t *pxs)
-{
+{
int code = px_set_paint(&pxs->pxgs->pen, pxs);
if ( code < 0 )
return code;
/* NB this should be refactored with pxText (immediately above)
and it is not a good heuristic for detecting a marked page. */
if ( par->pv[0]->value.array.size != 0 &&
- pxs->pxgs->pen.type != pxpNull
+ pxs->pxgs->pen.type != pxpNull
)
pxs->have_page = true;
return px_text(par, pxs, true);
}
-
diff --git a/pxl/pxparse.c b/pxl/pxparse.c
index 6ffb10d39..ae462070b 100644
--- a/pxl/pxparse.c
+++ b/pxl/pxparse.c
@@ -37,36 +37,36 @@ gs_private_st_composite(st_px_parser_state, px_parser_state_t,
"px_parser_state_t", parser_state_enum_ptrs, parser_state_reloc_ptrs);
#define st ((px_parser_state_t *)vptr)
static ENUM_PTRS_BEGIN(parser_state_enum_ptrs)
- /* Mark from array pointers on the stack. */
- if ( index < st->stack_count )
- { px_value_t *pv = &st->stack[index];
- ENUM_RETURN((!(~pv->type & (pxd_array | pxd_on_heap)) ?
- pv->value.array.data : 0));
- }
- return 0;
+ /* Mark from array pointers on the stack. */
+ if ( index < st->stack_count )
+ { px_value_t *pv = &st->stack[index];
+ ENUM_RETURN((!(~pv->type & (pxd_array | pxd_on_heap)) ?
+ pv->value.array.data : 0));
+ }
+ return 0;
ENUM_PTRS_END
static RELOC_PTRS_BEGIN(parser_state_reloc_ptrs) {
- px_parser_state_t *st_new =
- (*gc_proc(gcst, reloc_struct_ptr))((const void *)st, gcst);
- long diff = (byte *)st_new - (byte *)st;
-
- /* Relocate array pointers on the stack. */
- { px_value_t *pv = &st->stack[0];
- int i;
-
- for ( i = 0; i < st->stack_count; ++pv, ++i )
- if ( !(~pv->type & (pxd_array | pxd_on_heap)) )
- RELOC_OBJ_VAR(pv->value.array.data);
- }
- /* Relocate the pointers from the args. */
- st->args.parser = st_new;
- { px_value_t **ppv = &st->args.pv[0];
- int i;
-
- for ( i = 0; i < max_px_args; ++ppv, ++i )
- if ( *ppv )
- *ppv = (px_value_t *)((byte *)*ppv + diff);
- }
+ px_parser_state_t *st_new =
+ (*gc_proc(gcst, reloc_struct_ptr))((const void *)st, gcst);
+ long diff = (byte *)st_new - (byte *)st;
+
+ /* Relocate array pointers on the stack. */
+ { px_value_t *pv = &st->stack[0];
+ int i;
+
+ for ( i = 0; i < st->stack_count; ++pv, ++i )
+ if ( !(~pv->type & (pxd_array | pxd_on_heap)) )
+ RELOC_OBJ_VAR(pv->value.array.data);
+ }
+ /* Relocate the pointers from the args. */
+ st->args.parser = st_new;
+ { px_value_t **ppv = &st->args.pv[0];
+ int i;
+
+ for ( i = 0; i < max_px_args; ++ppv, ++i )
+ if ( *ppv )
+ *ppv = (px_value_t *)((byte *)*ppv + diff);
+ }
} RELOC_PTRS_END
#undef st
@@ -173,13 +173,13 @@ static const px_tag_syntax_t tag_syntax[256] = {
px_parser_state_t *
px_process_alloc(gs_memory_t *memory)
{ px_parser_state_t *st = gs_alloc_struct(memory, px_parser_state_t,
- &st_px_parser_state,
- "px_process_alloc");
- if ( st == 0 )
- return 0;
- st->memory = memory;
- px_process_init(st, true);
- return st;
+ &st_px_parser_state,
+ "px_process_alloc");
+ if ( st == 0 )
+ return 0;
+ st->memory = memory;
+ px_process_init(st, true);
+ return st;
}
/* Release a parser state. */
@@ -192,20 +192,20 @@ px_process_release(px_parser_state_t *st)
void
px_process_init(px_parser_state_t *st, bool big_endian)
{ st->big_endian = big_endian;
- st->operator_count = 0;
- st->parent_operator_count = 0;
- st->last_operator = pxtNull;
- st->saved_count = 0;
- st->data_left = 0;
- st->macro_state = ptsInitial;
- st->stack_count = 0;
- st->data_proc = 0;
- { int i;
- for ( i = 0; i < max_px_args; ++i )
- st->args.pv[i] = 0;
- }
- st->args.parser = 0; /* for garbage collector */
- memset(st->attribute_indices, 0, px_attribute_next);
+ st->operator_count = 0;
+ st->parent_operator_count = 0;
+ st->last_operator = pxtNull;
+ st->saved_count = 0;
+ st->data_left = 0;
+ st->macro_state = ptsInitial;
+ st->stack_count = 0;
+ st->data_proc = 0;
+ { int i;
+ for ( i = 0; i < max_px_args; ++i )
+ st->args.pv[i] = 0;
+ }
+ st->args.parser = 0; /* for garbage collector */
+ memset(st->attribute_indices, 0, px_attribute_next);
}
/* Get numeric values from the input. */
@@ -221,87 +221,87 @@ static int
px_save_array(px_value_t *pv, px_state_t *pxs, client_name_t cname,
uint nbytes)
{ if ( pv->type & pxd_on_heap )
- { /* Turn off the "on heap" bit, to prevent freeing. */
- pv->type &= ~pxd_on_heap;
- }
- else
- { /* Allocate a heap copy. Only the first nbytes bytes */
- /* of the data are valid. */
- uint num_elements = pv->value.array.size;
- uint elt_size = value_size(pv);
-
- byte *copy = gs_alloc_byte_array(pxs->memory, num_elements,
- elt_size, cname);
- if ( copy == 0 )
- return_error(errorInsufficientMemory);
- memcpy(copy, pv->value.array.data, nbytes);
- pv->value.array.data = copy;
- }
- return 0;
+ { /* Turn off the "on heap" bit, to prevent freeing. */
+ pv->type &= ~pxd_on_heap;
+ }
+ else
+ { /* Allocate a heap copy. Only the first nbytes bytes */
+ /* of the data are valid. */
+ uint num_elements = pv->value.array.size;
+ uint elt_size = value_size(pv);
+
+ byte *copy = gs_alloc_byte_array(pxs->memory, num_elements,
+ elt_size, cname);
+ if ( copy == 0 )
+ return_error(errorInsufficientMemory);
+ memcpy(copy, pv->value.array.data, nbytes);
+ pv->value.array.data = copy;
+ }
+ return 0;
}
/* Clear the stack and the attribute indices, */
/* and free heap-allocated arrays. */
#define clear_stack()\
- for ( ; sp > st->stack; --sp )\
- { if ( sp->type & pxd_on_heap )\
- gs_free_object(memory, (void *)sp->value.array.data,\
- "px stack pop");\
- st->attribute_indices[sp->attribute] = 0;\
- }
+ for ( ; sp > st->stack; --sp )\
+ { if ( sp->type & pxd_on_heap )\
+ gs_free_object(memory, (void *)sp->value.array.data,\
+ "px stack pop");\
+ st->attribute_indices[sp->attribute] = 0;\
+ }
/* Define data tracing if debugging. */
#ifdef DEBUG
# define trace_data(format, cast, ptr, count)\
- do\
- { uint i_;\
- for ( i_ = 0; i_ < count; ++i_ )\
- dprintf1(format, (cast)((ptr)[i_]));\
- dputc('\n');\
- }\
- while (0)
+ do\
+ { uint i_;\
+ for ( i_ = 0; i_ < count; ++i_ )\
+ dprintf1(format, (cast)((ptr)[i_]));\
+ dputc('\n');\
+ }\
+ while (0)
static void
trace_array_data(const char *label, const px_value_t *pav)
{ px_data_type_t type = pav->type;
- const byte *ptr = pav->value.array.data;
- uint count = pav->value.array.size;
- bool big_endian = (type & pxd_big_endian) != 0;
- bool text = (type & pxd_ubyte) != 0;
- uint i;
-
- dputs(label);
- dputs((type & pxd_ubyte ? " <" : " {"));
- for ( i = 0; i < count; ++i )
- { if ( !(i & 15) && i )
- { const char *p;
- dputs("\n ");
- for ( p = label; *p; ++p )
- dputc(' ');
- }
- if ( type & pxd_ubyte )
- { dprintf1("%02x ", ptr[i]);
- if ( ptr[i] < 32 || ptr[i] > 126 )
- text = false;
- }
- else if ( type & pxd_uint16 )
- dprintf1("%u ", uint16at(ptr + i * 2, big_endian));
- else if ( type & pxd_sint16 )
- dprintf1("%d ", sint16at(ptr + i * 2, big_endian));
- else if ( type & pxd_uint32 )
- dprintf1("%lu ", (ulong)uint32at(ptr + i * 4, big_endian));
- else if ( type & pxd_sint32 )
- dprintf1("%ld ", (long)sint32at(ptr + i * 4, big_endian));
- else if ( type & pxd_real32 )
- dprintf1("%g ", real32at(ptr + i * 4, big_endian));
- else
- dputs("? ");
- }
- dputs((type & pxd_ubyte ? ">\n" : "}\n"));
- if ( text )
- { dputs("%chars: \"");
- debug_print_string(ptr, count);
- dputs("\"\n");
- }
+ const byte *ptr = pav->value.array.data;
+ uint count = pav->value.array.size;
+ bool big_endian = (type & pxd_big_endian) != 0;
+ bool text = (type & pxd_ubyte) != 0;
+ uint i;
+
+ dputs(label);
+ dputs((type & pxd_ubyte ? " <" : " {"));
+ for ( i = 0; i < count; ++i )
+ { if ( !(i & 15) && i )
+ { const char *p;
+ dputs("\n ");
+ for ( p = label; *p; ++p )
+ dputc(' ');
+ }
+ if ( type & pxd_ubyte )
+ { dprintf1("%02x ", ptr[i]);
+ if ( ptr[i] < 32 || ptr[i] > 126 )
+ text = false;
+ }
+ else if ( type & pxd_uint16 )
+ dprintf1("%u ", uint16at(ptr + i * 2, big_endian));
+ else if ( type & pxd_sint16 )
+ dprintf1("%d ", sint16at(ptr + i * 2, big_endian));
+ else if ( type & pxd_uint32 )
+ dprintf1("%lu ", (ulong)uint32at(ptr + i * 4, big_endian));
+ else if ( type & pxd_sint32 )
+ dprintf1("%ld ", (long)sint32at(ptr + i * 4, big_endian));
+ else if ( type & pxd_real32 )
+ dprintf1("%g ", real32at(ptr + i * 4, big_endian));
+ else
+ dputs("? ");
+ }
+ dputs((type & pxd_ubyte ? ">\n" : "}\n"));
+ if ( text )
+ { dputs("%chars: \"");
+ debug_print_string(ptr, count);
+ dputs("\"\n");
+ }
}
# define trace_array(pav)\
if ( gs_debug_c('I') )\
@@ -315,241 +315,241 @@ trace_array_data(const char *label, const px_value_t *pav)
int
px_process(px_parser_state_t *st, px_state_t *pxs, stream_cursor_read *pr)
{ const byte *orig_p = pr->ptr;
- const byte *next_p = orig_p; /* start of data not copied to saved */
- const byte *p;
- const byte *rlimit;
- px_value_t *sp = &st->stack[st->stack_count];
+ const byte *next_p = orig_p; /* start of data not copied to saved */
+ const byte *p;
+ const byte *rlimit;
+ px_value_t *sp = &st->stack[st->stack_count];
#define stack_limit &st->stack[max_stack - 1]
- gs_memory_t *memory = st->memory;
- int code = 0;
- uint left;
- uint min_left;
- px_tag_t tag;
- const px_tag_syntax_t *syntax = 0;
-
- st->args.parser = st;
- st->parent_operator_count = 0; /* in case of error */
- /* Check for leftover data from the previous call. */
+ gs_memory_t *memory = st->memory;
+ int code = 0;
+ uint left;
+ uint min_left;
+ px_tag_t tag;
+ const px_tag_syntax_t *syntax = 0;
+
+ st->args.parser = st;
+ st->parent_operator_count = 0; /* in case of error */
+ /* Check for leftover data from the previous call. */
parse: if ( st->saved_count )
- { /* Fill up the saved buffer so we can make progress. */
- int move = min(sizeof(st->saved) - st->saved_count,
- pr->limit - next_p);
- memcpy(&st->saved[st->saved_count], next_p + 1, move);
- next_p += move;
- p = st->saved - 1;
- rlimit = p + st->saved_count + move;
- }
- else
- { /* No leftover data, just read from the input. */
- p = next_p;
- rlimit = pr->limit;
- }
+ { /* Fill up the saved buffer so we can make progress. */
+ int move = min(sizeof(st->saved) - st->saved_count,
+ pr->limit - next_p);
+ memcpy(&st->saved[st->saved_count], next_p + 1, move);
+ next_p += move;
+ p = st->saved - 1;
+ rlimit = p + st->saved_count + move;
+ }
+ else
+ { /* No leftover data, just read from the input. */
+ p = next_p;
+ rlimit = pr->limit;
+ }
top: if ( st->data_left )
- { /* We're in the middle of reading an array or data block. */
- if ( st->data_proc )
- { /* This is a data block. */
- uint avail = min(rlimit - p, st->data_left);
- uint used;
-
- st->args.source.available = avail;
- st->args.source.data = p + 1;
- code = (*st->data_proc)(&st->args, pxs);
- used = st->args.source.data - (p + 1);
+ { /* We're in the middle of reading an array or data block. */
+ if ( st->data_proc )
+ { /* This is a data block. */
+ uint avail = min(rlimit - p, st->data_left);
+ uint used;
+
+ st->args.source.available = avail;
+ st->args.source.data = p + 1;
+ code = (*st->data_proc)(&st->args, pxs);
+ used = st->args.source.data - (p + 1);
#ifdef DEBUG
- if ( gs_debug_c('I') )
- { px_value_t data_array;
- data_array.type = pxd_ubyte;
- data_array.value.array.data = p + 1;
- data_array.value.array.size = used;
- trace_array_data("data:", &data_array);
- }
+ if ( gs_debug_c('I') )
+ { px_value_t data_array;
+ data_array.type = pxd_ubyte;
+ data_array.value.array.data = p + 1;
+ data_array.value.array.size = used;
+ trace_array_data("data:", &data_array);
+ }
#endif
- p = st->args.source.data - 1;
- st->data_left -= used;
- if ( code < 0 )
- { st->args.source.position = 0;
- goto x;
- }
- else if ( ( code == pxNeedData ) || ( code == pxPassThrough && st->data_left != 0 ) )
- { code = 0; /* exit for more data */
- goto x;
- }
- else
- { st->args.source.position = 0;
- st->data_proc = 0;
- if ( st->data_left != 0 )
- { code = gs_note_error(errorExtraData);
- goto x;
- }
- clear_stack();
- }
- }
- else
- { /* This is an array. */
- uint size = sp->value.array.size;
- uint scale = value_size(sp);
- uint nbytes = size * scale;
- byte *dest =
- (byte *)sp->value.array.data + nbytes - st->data_left;
-
- left = rlimit - p;
- if ( left < st->data_left )
- { /* We still don't have enough data to fill the array. */
- memcpy(dest, p + 1, left);
- st->data_left -= left;
- p = rlimit;
- code = 0;
- goto x;
- }
- /* Complete the array and continue parsing. */
- memcpy(dest, p + 1, st->data_left);
- trace_array(sp);
- p += st->data_left;
- }
- st->data_left = 0;
- }
- else if ( st->data_proc )
- { /* An operator is awaiting data. */
- /* Skip white space until we find some. */
- code = 0; /* in case we exit */
- while ( (left = rlimit - p) != 0 )
- { switch ( (tag = p[1]) )
- {
- case pxtNull:
- case pxtHT: case pxtLF: case pxtVT: case pxtFF: case pxtCR:
- ++p;
- continue;
- case pxt_dataLength:
- if ( left < 5 )
- goto x; /* can't look ahead */
- st->data_left = get_uint32(st, p + 2);
- if_debug2('i', "tag= 0x%2x data, length %u\n",
- p[1], st->data_left);
- p += 5;
- goto top;
- case pxt_dataLengthByte:
- if ( left < 2 )
- goto x; /* can't look ahead */
- st->data_left = p[2];
- if_debug2('i', "tag= 0x%2x data, length %u\n",
- p[1], st->data_left);
- p += 2;
- goto top;
- default:
- { code = gs_note_error(errorMissingData);
- goto x;
- }
- }
- }
- }
- st->args.source.position = 0;
- st->args.source.available = 0;
- while ( (left = rlimit - p) != 0 &&
- left >= (min_left = (syntax = &tag_syntax[tag = p[1]])->min_input)
- )
- { int count;
+ p = st->args.source.data - 1;
+ st->data_left -= used;
+ if ( code < 0 )
+ { st->args.source.position = 0;
+ goto x;
+ }
+ else if ( ( code == pxNeedData ) || ( code == pxPassThrough && st->data_left != 0 ) )
+ { code = 0; /* exit for more data */
+ goto x;
+ }
+ else
+ { st->args.source.position = 0;
+ st->data_proc = 0;
+ if ( st->data_left != 0 )
+ { code = gs_note_error(errorExtraData);
+ goto x;
+ }
+ clear_stack();
+ }
+ }
+ else
+ { /* This is an array. */
+ uint size = sp->value.array.size;
+ uint scale = value_size(sp);
+ uint nbytes = size * scale;
+ byte *dest =
+ (byte *)sp->value.array.data + nbytes - st->data_left;
+
+ left = rlimit - p;
+ if ( left < st->data_left )
+ { /* We still don't have enough data to fill the array. */
+ memcpy(dest, p + 1, left);
+ st->data_left -= left;
+ p = rlimit;
+ code = 0;
+ goto x;
+ }
+ /* Complete the array and continue parsing. */
+ memcpy(dest, p + 1, st->data_left);
+ trace_array(sp);
+ p += st->data_left;
+ }
+ st->data_left = 0;
+ }
+ else if ( st->data_proc )
+ { /* An operator is awaiting data. */
+ /* Skip white space until we find some. */
+ code = 0; /* in case we exit */
+ while ( (left = rlimit - p) != 0 )
+ { switch ( (tag = p[1]) )
+ {
+ case pxtNull:
+ case pxtHT: case pxtLF: case pxtVT: case pxtFF: case pxtCR:
+ ++p;
+ continue;
+ case pxt_dataLength:
+ if ( left < 5 )
+ goto x; /* can't look ahead */
+ st->data_left = get_uint32(st, p + 2);
+ if_debug2('i', "tag= 0x%2x data, length %u\n",
+ p[1], st->data_left);
+ p += 5;
+ goto top;
+ case pxt_dataLengthByte:
+ if ( left < 2 )
+ goto x; /* can't look ahead */
+ st->data_left = p[2];
+ if_debug2('i', "tag= 0x%2x data, length %u\n",
+ p[1], st->data_left);
+ p += 2;
+ goto top;
+ default:
+ { code = gs_note_error(errorMissingData);
+ goto x;
+ }
+ }
+ }
+ }
+ st->args.source.position = 0;
+ st->args.source.available = 0;
+ while ( (left = rlimit - p) != 0 &&
+ left >= (min_left = (syntax = &tag_syntax[tag = p[1]])->min_input)
+ )
+ { int count;
#ifdef DEBUG
- if ( gs_debug_c('i') )
- { dprintf1("tag= 0x%02x ", tag);
- if ( tag == pxt_attr_ubyte || tag == pxt_attr_uint16 )
- { px_attribute_t attr =
- (tag == pxt_attr_ubyte ? p[2] : get_uint16(st, p + 2));
- const char *aname = px_attribute_names[attr];
- if ( aname )
- dprintf1(" @%s\n", aname);
- else
- dprintf1(" attribute %u ???\n", attr);
- }
- else
- { const char *format;
- const char *tname;
+ if ( gs_debug_c('i') )
+ { dprintf1("tag= 0x%02x ", tag);
+ if ( tag == pxt_attr_ubyte || tag == pxt_attr_uint16 )
+ { px_attribute_t attr =
+ (tag == pxt_attr_ubyte ? p[2] : get_uint16(st, p + 2));
+ const char *aname = px_attribute_names[attr];
+ if ( aname )
+ dprintf1(" @%s\n", aname);
+ else
+ dprintf1(" attribute %u ???\n", attr);
+ }
+ else
+ { const char *format;
+ const char *tname;
bool operator = false;
- if ( tag < 0x40 )
- format = "%s\n", tname = px_tag_0_names[tag];
- else if ( tag < 0xc0 )
- format = "%s", tname = px_operator_names[tag - 0x40],
+ if ( tag < 0x40 )
+ format = "%s\n", tname = px_tag_0_names[tag];
+ else if ( tag < 0xc0 )
+ format = "%s", tname = px_operator_names[tag - 0x40],
operator = true;
- else
- { tname = px_tag_c0_names[tag - 0xc0];
- if ( tag < 0xf0 )
- format = " %s"; /* data values follow */
- else
- format = "%s\n";
- }
- if ( tname ) {
- dprintf1(format, tname);
+ else
+ { tname = px_tag_c0_names[tag - 0xc0];
+ if ( tag < 0xf0 )
+ format = " %s"; /* data values follow */
+ else
+ format = "%s\n";
+ }
+ if ( tname ) {
+ dprintf1(format, tname);
if (operator)
dprintf1(" (%ld)\n", st->operator_count+1);
}
- else
- dputs("???\n");
- }
- }
+ else
+ dputs("???\n");
+ }
+ }
#endif
- if ( (st->macro_state & syntax->state_mask) != syntax->state_value )
- { /*
- * We should probably distinguish here between
- * out-of-context operators and illegal tags, but it's too
- * much trouble.
- */
- code = gs_note_error(errorIllegalOperatorSequence);
- if ( tag >= 0x40 && tag < 0xc0 )
- st->last_operator = tag;
- goto x;
- }
- st->macro_state ^= syntax->state_transition;
- switch ( tag >> 3 )
- {
- case 0:
- switch ( tag )
- {
- case pxtNull: ++p; continue;
- default: break;
- }
- break;
- case 1:
- switch ( tag )
- {
- case pxtHT: case pxtLF: case pxtVT: case pxtFF: case pxtCR:
- ++p;
- continue;
- default:
- break;
- }
- break;
- case 3:
- if ( tag == pxt1b ) /* ESC */
- { /* Check for UEL */
- if ( memcmp(p + 1, "\033%-12345X", min(left, 9)) )
- break; /* not UEL, error */
- if ( left < 9 )
- goto x; /* need more data */
- p += 9;
- code = e_ExitLanguage;
- goto x;
- }
- break;
- case 4:
- switch ( tag )
- {
- case pxtSpace:
- /* break; will error, compatible with lj */
- /* ++p;continue; silently ignores the space */
- ++p;
- continue;
- default: break;
- }
- break;
- case 8: case 9:
- case 10: case 11: case 12: case 13: case 14:
- case 15: case 16: case 17: case 18: case 19:
- case 20: case 21: case 22: case 23:
- /* Operators */
- /* Make sure that we have all the required attributes, */
- /* and no attributes that are neither required nor */
- /* optional. (It's up to the operator to make any */
- /* more precise checks than this. */
- st->operator_count++;
+ if ( (st->macro_state & syntax->state_mask) != syntax->state_value )
+ { /*
+ * We should probably distinguish here between
+ * out-of-context operators and illegal tags, but it's too
+ * much trouble.
+ */
+ code = gs_note_error(errorIllegalOperatorSequence);
+ if ( tag >= 0x40 && tag < 0xc0 )
+ st->last_operator = tag;
+ goto x;
+ }
+ st->macro_state ^= syntax->state_transition;
+ switch ( tag >> 3 )
+ {
+ case 0:
+ switch ( tag )
+ {
+ case pxtNull: ++p; continue;
+ default: break;
+ }
+ break;
+ case 1:
+ switch ( tag )
+ {
+ case pxtHT: case pxtLF: case pxtVT: case pxtFF: case pxtCR:
+ ++p;
+ continue;
+ default:
+ break;
+ }
+ break;
+ case 3:
+ if ( tag == pxt1b ) /* ESC */
+ { /* Check for UEL */
+ if ( memcmp(p + 1, "\033%-12345X", min(left, 9)) )
+ break; /* not UEL, error */
+ if ( left < 9 )
+ goto x; /* need more data */
+ p += 9;
+ code = e_ExitLanguage;
+ goto x;
+ }
+ break;
+ case 4:
+ switch ( tag )
+ {
+ case pxtSpace:
+ /* break; will error, compatible with lj */
+ /* ++p;continue; silently ignores the space */
+ ++p;
+ continue;
+ default: break;
+ }
+ break;
+ case 8: case 9:
+ case 10: case 11: case 12: case 13: case 14:
+ case 15: case 16: case 17: case 18: case 19:
+ case 20: case 21: case 22: case 23:
+ /* Operators */
+ /* Make sure that we have all the required attributes, */
+ /* and no attributes that are neither required nor */
+ /* optional. (It's up to the operator to make any */
+ /* more precise checks than this. */
+ st->operator_count++;
/* if this is a passthrough operator we have to tell
the passthrough module if this operator was
preceded by another passthrough operator or a
@@ -557,356 +557,356 @@ top: if ( st->data_left )
if (tag == pxtPassThrough) {
pxpcl_passthroughcontiguous(st->last_operator == tag);
} else if ( st->last_operator == pxtPassThrough ) {
- pxpcl_endpassthroughcontiguous(pxs);
- }
-
- st->last_operator = tag;
- { const px_operator_definition_t *pod =
- &px_operator_definitions[tag - 0x40];
- int left = sp - st->stack;
- const byte /*px_attribute_t*/ *pal = pod->attrs;
- px_value_t **ppv = st->args.pv;
- bool required = true;
-
- code = 0;
- /*
- * Scan the attributes. Illegal attributes take priority
- * over missing attributes, which in turn take priority
- * over illegal data types.
- */
- for ( ; ; ++pal, ++ppv )
- { px_attribute_t attr = *pal;
- uint index;
-
- if ( !attr )
- { /*
- * We've reached the end of either the required or
- * the optional attribute list.
- */
- if ( !required )
- break;
- required = false;
- --ppv; /* cancel incrementing */
- continue;
- }
- if ( (index = st->attribute_indices[attr]) == 0 )
- { if ( required )
- code = gs_note_error(errorMissingAttribute);
- else
- *ppv = 0;
- }
- else
- { /* Check the attribute data type and value. */
- px_value_t *pv = *ppv = &st->stack[index];
- const px_attr_value_type_t *pavt =
- &px_attr_value_types[attr];
- int acode;
-
- if ( (~pavt->mask & pv->type &
- (pxd_structure | pxd_representation)) ||
- (pavt->mask == (pxd_scalar | pxd_ubyte) &&
- (pv->value.i < 0 || pv->value.i > pavt->limit))
- )
- { if ( code >= 0 )
- code = gs_note_error(errorIllegalAttributeDataType);
- }
- if ( pavt->proc != 0 && (acode = (*pavt->proc)(pv)) < 0 )
- { if ( code >= 0 )
- code = acode;
- }
- --left;
- }
- }
+ pxpcl_endpassthroughcontiguous(pxs);
+ }
+
+ st->last_operator = tag;
+ { const px_operator_definition_t *pod =
+ &px_operator_definitions[tag - 0x40];
+ int left = sp - st->stack;
+ const byte /*px_attribute_t*/ *pal = pod->attrs;
+ px_value_t **ppv = st->args.pv;
+ bool required = true;
+
+ code = 0;
+ /*
+ * Scan the attributes. Illegal attributes take priority
+ * over missing attributes, which in turn take priority
+ * over illegal data types.
+ */
+ for ( ; ; ++pal, ++ppv )
+ { px_attribute_t attr = *pal;
+ uint index;
+
+ if ( !attr )
+ { /*
+ * We've reached the end of either the required or
+ * the optional attribute list.
+ */
+ if ( !required )
+ break;
+ required = false;
+ --ppv; /* cancel incrementing */
+ continue;
+ }
+ if ( (index = st->attribute_indices[attr]) == 0 )
+ { if ( required )
+ code = gs_note_error(errorMissingAttribute);
+ else
+ *ppv = 0;
+ }
+ else
+ { /* Check the attribute data type and value. */
+ px_value_t *pv = *ppv = &st->stack[index];
+ const px_attr_value_type_t *pavt =
+ &px_attr_value_types[attr];
+ int acode;
+
+ if ( (~pavt->mask & pv->type &
+ (pxd_structure | pxd_representation)) ||
+ (pavt->mask == (pxd_scalar | pxd_ubyte) &&
+ (pv->value.i < 0 || pv->value.i > pavt->limit))
+ )
+ { if ( code >= 0 )
+ code = gs_note_error(errorIllegalAttributeDataType);
+ }
+ if ( pavt->proc != 0 && (acode = (*pavt->proc)(pv)) < 0 )
+ { if ( code >= 0 )
+ code = acode;
+ }
+ --left;
+ }
+ }
- /* Make sure there are no attributes left over. */
- if ( left )
- code = gs_note_error(errorIllegalAttribute);
- if ( code >= 0 ) {
+ /* Make sure there are no attributes left over. */
+ if ( left )
+ code = gs_note_error(errorIllegalAttribute);
+ if ( code >= 0 ) {
st->args.source.phase = 0;
- code = (*pod->proc)(&st->args, pxs);
+ code = (*pod->proc)(&st->args, pxs);
}
- if ( code < 0 )
- goto x;
- /* Check whether the operator wanted source data. */
- if ( code == pxNeedData )
- { if ( !pxs->data_source_open )
- { code = gs_note_error(errorDataSourceNotOpen);
- goto x;
- }
- st->data_proc = pod->proc;
- ++p;
- goto top;
- }
- }
- clear_stack();
- ++p;
- continue;
- case 24: sp[1].type = pxd_scalar; count = 1; goto data;
- case 26: sp[1].type = pxd_xy; count = 2; goto data;
- case 28: sp[1].type = pxd_box; count = 4; goto data;
- /* Scalar, point, and box data */
+ if ( code < 0 )
+ goto x;
+ /* Check whether the operator wanted source data. */
+ if ( code == pxNeedData )
+ { if ( !pxs->data_source_open )
+ { code = gs_note_error(errorDataSourceNotOpen);
+ goto x;
+ }
+ st->data_proc = pod->proc;
+ ++p;
+ goto top;
+ }
+ }
+ clear_stack();
+ ++p;
+ continue;
+ case 24: sp[1].type = pxd_scalar; count = 1; goto data;
+ case 26: sp[1].type = pxd_xy; count = 2; goto data;
+ case 28: sp[1].type = pxd_box; count = 4; goto data;
+ /* Scalar, point, and box data */
data: { int i;
- if ( sp == stack_limit )
- { code = gs_note_error(errorInternalOverflow);
- goto x;
- }
- ++sp;
- sp->attribute = 0;
- p += 2;
+ if ( sp == stack_limit )
+ { code = gs_note_error(errorInternalOverflow);
+ goto x;
+ }
+ ++sp;
+ sp->attribute = 0;
+ p += 2;
#ifdef DEBUG
# define trace_scalar(format, cast, alt)\
- if ( gs_debug_c('i') )\
- trace_data(format, cast, sp->value.alt, count)
+ if ( gs_debug_c('i') )\
+ trace_data(format, cast, sp->value.alt, count)
#else
# define trace_scalar(format, cast, alt) DO_NOTHING
#endif
- switch ( tag & 7 )
- {
- case pxt_ubyte & 7:
- sp->type |= pxd_ubyte;
- for ( i = 0; i < count; ++p, ++i )
- sp->value.ia[i] = *p;
+ switch ( tag & 7 )
+ {
+ case pxt_ubyte & 7:
+ sp->type |= pxd_ubyte;
+ for ( i = 0; i < count; ++p, ++i )
+ sp->value.ia[i] = *p;
dux: trace_scalar(" %lu", ulong, ia);
- --p;
- continue;
- case pxt_uint16 & 7:
- sp->type |= pxd_uint16;
- for ( i = 0; i < count; p += 2, ++i )
- sp->value.ia[i] = get_uint16(st, p);
- goto dux;
- case pxt_uint32 & 7:
- sp->type |= pxd_uint32;
- for ( i = 0; i < count; p += 4, ++i )
- sp->value.ia[i] = get_uint32(st, p);
- goto dux;
- case pxt_sint16 & 7:
- sp->type |= pxd_sint16;
- for ( i = 0; i < count; p += 2, ++i )
- sp->value.ia[i] = get_sint16(st, p);
+ --p;
+ continue;
+ case pxt_uint16 & 7:
+ sp->type |= pxd_uint16;
+ for ( i = 0; i < count; p += 2, ++i )
+ sp->value.ia[i] = get_uint16(st, p);
+ goto dux;
+ case pxt_uint32 & 7:
+ sp->type |= pxd_uint32;
+ for ( i = 0; i < count; p += 4, ++i )
+ sp->value.ia[i] = get_uint32(st, p);
+ goto dux;
+ case pxt_sint16 & 7:
+ sp->type |= pxd_sint16;
+ for ( i = 0; i < count; p += 2, ++i )
+ sp->value.ia[i] = get_sint16(st, p);
dsx: trace_scalar(" %ld", long, ia);
- --p;
- continue;
- case pxt_sint32 & 7:
- sp->type |= pxd_sint32;
- for ( i = 0; i < count; p += 4, ++i )
- sp->value.ia[i] = get_sint32(st, p);
- goto dsx;
- case pxt_real32 & 7:
- sp->type |= pxd_real32;
- for ( i = 0; i < count; p += 4, ++i )
- sp->value.ra[i] = get_real32(st, p);
- trace_scalar(" %g", double, ra);
- --p;
- continue;
- default:
- break;
- }
- }
- break;
- case 25:
- /* Array data */
- { const byte *dp;
- uint nbytes;
- if ( sp == stack_limit )
- { code = gs_note_error(errorInternalOverflow);
- goto x;
- }
- switch ( p[2] )
- {
- case pxt_ubyte:
- sp[1].value.array.size = p[3];
- dp = p + 4;
- break;
- case pxt_uint16:
- if ( left < 4 )
- { if_debug0('i', "...\n");
- /* Undo the state transition. */
- st->macro_state ^= syntax->state_transition;
- goto x;
- }
- sp[1].value.array.size = get_uint16(st, p+3);
- dp = p + 5;
- break;
- default:
- st->last_operator = tag; /* for error message */
- code = gs_note_error(errorIllegalTag);
- goto x;
- }
- nbytes = sp[1].value.array.size;
- if_debug1('i', "[%u]\n", sp[1].value.array.size);
- switch ( tag )
- {
- case pxt_ubyte_array:
- sp[1].type = pxd_array | pxd_ubyte;
+ --p;
+ continue;
+ case pxt_sint32 & 7:
+ sp->type |= pxd_sint32;
+ for ( i = 0; i < count; p += 4, ++i )
+ sp->value.ia[i] = get_sint32(st, p);
+ goto dsx;
+ case pxt_real32 & 7:
+ sp->type |= pxd_real32;
+ for ( i = 0; i < count; p += 4, ++i )
+ sp->value.ra[i] = get_real32(st, p);
+ trace_scalar(" %g", double, ra);
+ --p;
+ continue;
+ default:
+ break;
+ }
+ }
+ break;
+ case 25:
+ /* Array data */
+ { const byte *dp;
+ uint nbytes;
+ if ( sp == stack_limit )
+ { code = gs_note_error(errorInternalOverflow);
+ goto x;
+ }
+ switch ( p[2] )
+ {
+ case pxt_ubyte:
+ sp[1].value.array.size = p[3];
+ dp = p + 4;
+ break;
+ case pxt_uint16:
+ if ( left < 4 )
+ { if_debug0('i', "...\n");
+ /* Undo the state transition. */
+ st->macro_state ^= syntax->state_transition;
+ goto x;
+ }
+ sp[1].value.array.size = get_uint16(st, p+3);
+ dp = p + 5;
+ break;
+ default:
+ st->last_operator = tag; /* for error message */
+ code = gs_note_error(errorIllegalTag);
+ goto x;
+ }
+ nbytes = sp[1].value.array.size;
+ if_debug1('i', "[%u]\n", sp[1].value.array.size);
+ switch ( tag )
+ {
+ case pxt_ubyte_array:
+ sp[1].type = pxd_array | pxd_ubyte;
array: ++sp;
- if ( st->big_endian )
- sp->type |= pxd_big_endian;
- sp->value.array.data = dp;
- sp->attribute = 0;
- /* Check whether we have enough data for the entire */
- /* array. */
- if ( rlimit + 1 - dp < nbytes )
- { /* Exit now, continue reading when we return. */
- uint avail = rlimit + 1 - dp;
-
- code = px_save_array(sp, pxs, "partial array",
- avail);
- if ( code < 0 )
- goto x;
- sp->type |= pxd_on_heap;
- st->data_left = nbytes - avail;
- st->data_proc = 0;
- p = rlimit;
- goto x;
- }
- p = dp + nbytes - 1;
- trace_array(sp);
- continue;
- case pxt_uint16_array:
- sp[1].type = pxd_array | pxd_uint16;
+ if ( st->big_endian )
+ sp->type |= pxd_big_endian;
+ sp->value.array.data = dp;
+ sp->attribute = 0;
+ /* Check whether we have enough data for the entire */
+ /* array. */
+ if ( rlimit + 1 - dp < nbytes )
+ { /* Exit now, continue reading when we return. */
+ uint avail = rlimit + 1 - dp;
+
+ code = px_save_array(sp, pxs, "partial array",
+ avail);
+ if ( code < 0 )
+ goto x;
+ sp->type |= pxd_on_heap;
+ st->data_left = nbytes - avail;
+ st->data_proc = 0;
+ p = rlimit;
+ goto x;
+ }
+ p = dp + nbytes - 1;
+ trace_array(sp);
+ continue;
+ case pxt_uint16_array:
+ sp[1].type = pxd_array | pxd_uint16;
a16: nbytes <<= 1;
- goto array;
- case pxt_uint32_array:
- sp[1].type = pxd_array | pxd_uint32;
+ goto array;
+ case pxt_uint32_array:
+ sp[1].type = pxd_array | pxd_uint32;
a32: nbytes <<= 2;
- goto array;
- case pxt_sint16_array:
- sp[1].type = pxd_array | pxd_sint16;
- goto a16;
- case pxt_sint32_array:
- sp[1].type = pxd_array | pxd_sint32;
- goto a32;
- case pxt_real32_array:
- sp[1].type = pxd_array | pxd_real32;
- goto a32;
- default:
- break;
- }
- break;
- }
- break;
- case 31:
- { px_attribute_t attr;
- const byte *pnext;
-
- switch ( tag )
- {
- case pxt_attr_ubyte:
- attr = p[2];
- pnext = p + 2;
- goto a;
- case pxt_attr_uint16:
- attr = get_uint16(st, p+2);
- pnext = p + 3;
+ goto array;
+ case pxt_sint16_array:
+ sp[1].type = pxd_array | pxd_sint16;
+ goto a16;
+ case pxt_sint32_array:
+ sp[1].type = pxd_array | pxd_sint32;
+ goto a32;
+ case pxt_real32_array:
+ sp[1].type = pxd_array | pxd_real32;
+ goto a32;
+ default:
+ break;
+ }
+ break;
+ }
+ break;
+ case 31:
+ { px_attribute_t attr;
+ const byte *pnext;
+
+ switch ( tag )
+ {
+ case pxt_attr_ubyte:
+ attr = p[2];
+ pnext = p + 2;
+ goto a;
+ case pxt_attr_uint16:
+ attr = get_uint16(st, p+2);
+ pnext = p + 3;
a: if ( attr >= px_attribute_next )
- break;
- /*
- * We could check the attribute value type here, but
- * in order to match the behavior of the H-P printers,
- * we don't do it until we see the operator.
- *
- * It is legal to specify the same attribute more than
- * once; the last value has priority. If this happens,
- * since the order of attributes doesn't matter, we can
- * just replace the former value on the stack.
- */
- sp->attribute = attr;
- if ( st->attribute_indices[attr] != 0 )
- { px_value_t *old_sp =
- &st->stack[st->attribute_indices[attr]];
- /* If the old value is on the heap, free it. */
- if ( old_sp->type & pxd_on_heap )
+ break;
+ /*
+ * We could check the attribute value type here, but
+ * in order to match the behavior of the H-P printers,
+ * we don't do it until we see the operator.
+ *
+ * It is legal to specify the same attribute more than
+ * once; the last value has priority. If this happens,
+ * since the order of attributes doesn't matter, we can
+ * just replace the former value on the stack.
+ */
+ sp->attribute = attr;
+ if ( st->attribute_indices[attr] != 0 )
+ { px_value_t *old_sp =
+ &st->stack[st->attribute_indices[attr]];
+ /* If the old value is on the heap, free it. */
+ if ( old_sp->type & pxd_on_heap )
gs_free_object(memory, (void *)old_sp->value.array.data,
- "old value for duplicate attribute");
- *old_sp = *sp--;
- }
- else
- st->attribute_indices[attr] = sp - st->stack;
- p = pnext;
- continue;
- case pxt_dataLength:
- /*
- * Unexpected data length operators are normally not
- * allowed, but there might be a zero-length data
- * block immediately following a zero-size image,
- * which doesn't ask for any data.
- */
- if ( uint32at(p + 2, true /*arbitrary*/) == 0 )
- { p += 5;
- continue;
- }
- break;
- case pxt_dataLengthByte:
- /* See the comment under pxt_dataLength above. */
- if ( p[2] == 0 )
- { p += 2;
- continue;
- }
- break;
- default:
- break;
- }
- }
- break;
- default:
- break;
- }
- /* Unknown tag value. Report an error. */
- st->last_operator = tag; /* for error message */
- code = gs_note_error(errorIllegalTag);
- break;
- }
+ "old value for duplicate attribute");
+ *old_sp = *sp--;
+ }
+ else
+ st->attribute_indices[attr] = sp - st->stack;
+ p = pnext;
+ continue;
+ case pxt_dataLength:
+ /*
+ * Unexpected data length operators are normally not
+ * allowed, but there might be a zero-length data
+ * block immediately following a zero-size image,
+ * which doesn't ask for any data.
+ */
+ if ( uint32at(p + 2, true /*arbitrary*/) == 0 )
+ { p += 5;
+ continue;
+ }
+ break;
+ case pxt_dataLengthByte:
+ /* See the comment under pxt_dataLength above. */
+ if ( p[2] == 0 )
+ { p += 2;
+ continue;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ /* Unknown tag value. Report an error. */
+ st->last_operator = tag; /* for error message */
+ code = gs_note_error(errorIllegalTag);
+ break;
+ }
x: /* Save any leftover input. */
- left = rlimit - p;
- if ( rlimit != pr->limit )
- { /* We were reading saved input. */
- if ( left <= next_p - orig_p )
- { /* We finished reading the previously saved input. */
- /* Continue reading current input, unless we got an error. */
- p = next_p -= left;
- rlimit = pr->limit;
- st->saved_count = 0;
- if ( code >= 0 )
- goto parse;
- }
- else
- { /* There's still some previously saved input left over. */
- memmove(st->saved, p + 1, st->saved_count = left);
- p = next_p;
- rlimit = pr->limit;
- left = rlimit - p;
- }
- }
- /* Except in case of error, save any remaining input. */
- if ( code >= 0 )
- { if ( left + st->saved_count > sizeof(st->saved) )
- { /* Fatal error -- shouldn't happen! */
- code = gs_note_error(errorInternalOverflow);
- st->saved_count = 0;
- }
- else
- { memcpy(&st->saved[st->saved_count], p + 1, left);
- st->saved_count += left;
- p = rlimit;
- }
- }
- pr->ptr = p;
- st->stack_count = sp - st->stack;
- /* Move to the heap any arrays whose data was being referenced */
- /* directly in the input buffer. */
- for ( ; sp > st->stack; --sp )
- if ( (sp->type & (pxd_array | pxd_on_heap)) == pxd_array )
- { int code = px_save_array(sp, pxs, "px stack array to heap",
- sp->value.array.size * value_size(sp));
- if ( code < 0 )
- break;
- sp->type |= pxd_on_heap;
- }
- if ( code < 0 && syntax != 0 )
- { /* Undo the state transition. */
- st->macro_state ^= syntax->state_transition;
- }
- return code;
+ left = rlimit - p;
+ if ( rlimit != pr->limit )
+ { /* We were reading saved input. */
+ if ( left <= next_p - orig_p )
+ { /* We finished reading the previously saved input. */
+ /* Continue reading current input, unless we got an error. */
+ p = next_p -= left;
+ rlimit = pr->limit;
+ st->saved_count = 0;
+ if ( code >= 0 )
+ goto parse;
+ }
+ else
+ { /* There's still some previously saved input left over. */
+ memmove(st->saved, p + 1, st->saved_count = left);
+ p = next_p;
+ rlimit = pr->limit;
+ left = rlimit - p;
+ }
+ }
+ /* Except in case of error, save any remaining input. */
+ if ( code >= 0 )
+ { if ( left + st->saved_count > sizeof(st->saved) )
+ { /* Fatal error -- shouldn't happen! */
+ code = gs_note_error(errorInternalOverflow);
+ st->saved_count = 0;
+ }
+ else
+ { memcpy(&st->saved[st->saved_count], p + 1, left);
+ st->saved_count += left;
+ p = rlimit;
+ }
+ }
+ pr->ptr = p;
+ st->stack_count = sp - st->stack;
+ /* Move to the heap any arrays whose data was being referenced */
+ /* directly in the input buffer. */
+ for ( ; sp > st->stack; --sp )
+ if ( (sp->type & (pxd_array | pxd_on_heap)) == pxd_array )
+ { int code = px_save_array(sp, pxs, "px stack array to heap",
+ sp->value.array.size * value_size(sp));
+ if ( code < 0 )
+ break;
+ sp->type |= pxd_on_heap;
+ }
+ if ( code < 0 && syntax != 0 )
+ { /* Undo the state transition. */
+ st->macro_state ^= syntax->state_transition;
+ }
+ return code;
}
uint
@@ -914,4 +914,3 @@ px_parser_data_left(px_parser_state_t *pxp)
{
return pxp->data_left;
}
-
diff --git a/pxl/pxparse.h b/pxl/pxparse.h
index b3ec1b8c1..5a4d358c2 100644
--- a/pxl/pxparse.h
+++ b/pxl/pxparse.h
@@ -59,14 +59,14 @@ typedef struct px_parser_state_s px_parser_state_t;
#endif
#define max_stack max_px_args /* must not exceed 256 */
struct px_parser_state_s {
- /* Set at initialization */
+ /* Set at initialization */
gs_memory_t *memory;
bool big_endian;
- /* Updated dynamically, for error reporting only */
+ /* Updated dynamically, for error reporting only */
long operator_count;
long parent_operator_count;
int /*px_tag_t*/ last_operator; /* pxtNull if none */
- /* Updated dynamically */
+ /* Updated dynamically */
int saved_count; /* amount of leftover input in saved */
uint data_left; /* amount left to read of data or array */
uint macro_state; /* mask for macro-state */
@@ -97,7 +97,7 @@ void px_process_init(px_parser_state_t *st, bool big_endian);
/* Process a buffer of PCL XL commands. */
int px_process(px_parser_state_t *st, px_state_t *pxs,
- stream_cursor_read *pr);
+ stream_cursor_read *pr);
/* unfortunately we have to export this for pass through mode, other
commands do not need to know how much data is left to parse. */
diff --git a/pxl/pxpthr.c b/pxl/pxpthr.c
index b22580885..fc63f9d6e 100644
--- a/pxl/pxpthr.c
+++ b/pxl/pxpthr.c
@@ -61,8 +61,6 @@ float global_char_bold_value;
void pxpcl_release(void);
void pxpcl_pagestatereset(void);
-
-
/* NB: tests for this function are used to flag pxl snippet mode
*/
static int
@@ -274,7 +272,6 @@ pxPassthrough(px_args_t *par, px_state_t *pxs)
}
}
-
void
pxpcl_pagestatereset()
{
@@ -400,7 +397,6 @@ int pxpcl_selectfont(px_args_t *par, px_state_t *pxs)
{
pl_font_t *plf = global_pcs->font;
-
/* unfortunately the storage identifier is inconsistent
between PCL and PCL XL, NB we should use the pxfont.h
enumerations pxfsInternal and pxfsDownloaded but there is a
diff --git a/pxl/pxsessio.c b/pxl/pxsessio.c
index 0ee0d6529..65c1c27c8 100644
--- a/pxl/pxsessio.c
+++ b/pxl/pxsessio.c
@@ -21,7 +21,7 @@
#include "pxpthr.h"
#include "pxstate.h"
#include "pxfont.h"
-#include "pjparse.h"
+#include "pjparse.h"
#include "gschar.h"
#include "gscoord.h"
#include "gserrors.h" /* for gs_error_undefined */
@@ -75,22 +75,21 @@ px_paper_string_to_media(pjl_envvar_t *paper_str)
/* table to map pjl paper type strings to pxl enums */
int i;
for (i = 0; i < countof(known_media); i++) {
- if ( !pjl_compare(paper_str, known_media[i].mname) )
- return known_media[i].ms_enum;
+ if ( !pjl_compare(paper_str, known_media[i].mname) )
+ return known_media[i].ms_enum;
}
/* not found return letter */
return eLetterPaper;
}
-
/* return the default media set up in the XL state */
-static px_media_t *
+static px_media_t *
px_get_default_media(px_state_t *pxs)
{
int i;
for (i = 0; i < countof(known_media); i++)
- if ( known_media[i].ms_enum == pxs->media_size )
- return &known_media[i];
+ if ( known_media[i].ms_enum == pxs->media_size )
+ return &known_media[i];
/* shouldn't get here but just in case we return letter. */
return &known_media[1];
}
@@ -107,35 +106,35 @@ px_get_default_media_size(px_state_t *pxs, gs_point *pt)
static int
px_put1(gx_device *dev, gs_c_param_list *plist, int ecode)
{ int code = ecode;
- if ( code >= 0 )
- { gs_c_param_list_read(plist);
- code = gs_putdeviceparams(dev, (gs_param_list *)plist);
- }
- gs_c_param_list_release(plist);
- return (code == 0 || code == gs_error_undefined ? ecode : code);
+ if ( code >= 0 )
+ { gs_c_param_list_read(plist);
+ code = gs_putdeviceparams(dev, (gs_param_list *)plist);
+ }
+ gs_c_param_list_release(plist);
+ return (code == 0 || code == gs_error_undefined ? ecode : code);
}
/* Adjust one scale factor to an integral value if we can. */
static double
px_adjust_scale(double value, double extent)
{ /* If we can make the value an integer with a total error */
- /* of less than 1/2 pixel over the entire page, we do it. */
- double int_value = floor(value + 0.5);
+ /* of less than 1/2 pixel over the entire page, we do it. */
+ double int_value = floor(value + 0.5);
- return (fabs((int_value - value) * extent) < 0.5 ? int_value : value);
+ return (fabs((int_value - value) * extent) < 0.5 ? int_value : value);
}
/* Clean up at the end of a page, but before rendering. */
static void
px_end_page_cleanup(px_state_t *pxs)
{ px_dict_release(&pxs->page_pattern_dict);
- /* Clean up stray gstate information. */
- while ( pxs->pxgs->stack_depth > 0 )
- pxPopGS(NULL, pxs);
- /* Pop an extra time to mirror the push in BeginPage. */
- pxs->pxgs->stack_depth++;
- pxPopGS(NULL, pxs);
- pxNewPath(NULL, pxs);
+ /* Clean up stray gstate information. */
+ while ( pxs->pxgs->stack_depth > 0 )
+ pxPopGS(NULL, pxs);
+ /* Pop an extra time to mirror the push in BeginPage. */
+ pxs->pxgs->stack_depth++;
+ pxPopGS(NULL, pxs);
+ pxNewPath(NULL, pxs);
px_purge_pattern_cache(pxs, ePagePattern);
pxpcl_pagestatereset();
}
@@ -143,7 +142,7 @@ px_end_page_cleanup(px_state_t *pxs)
/* Purge all */
static bool
purge_all(const gs_memory_t *mem, cached_char *cc, void *dummy)
-{
+{
return true;
}
@@ -152,9 +151,9 @@ purge_all(const gs_memory_t *mem, cached_char *cc, void *dummy)
static void
px_end_session_cleanup(px_state_t *pxs)
{ if ( pxs->data_source_open )
- pxCloseDataSource(NULL, pxs);
- px_purge_character_cache(pxs);
- px_dict_release(&pxs->session_pattern_dict);
+ pxCloseDataSource(NULL, pxs);
+ px_purge_character_cache(pxs);
+ px_dict_release(&pxs->session_pattern_dict);
if (gstate_pattern_cache(pxs->pgs)) {
(gstate_pattern_cache(pxs->pgs)->free_all)
(gstate_pattern_cache(pxs->pgs));
@@ -172,10 +171,10 @@ px_end_session_cleanup(px_state_t *pxs)
}
}
}
- /* We believe that streams do *not* persist across sessions.... */
- px_dict_release(&pxs->stream_dict);
- /* delete downloaded fonts on end of session */
- px_dict_release(&pxs->font_dict);
+ /* We believe that streams do *not* persist across sessions.... */
+ px_dict_release(&pxs->stream_dict);
+ /* delete downloaded fonts on end of session */
+ px_dict_release(&pxs->font_dict);
pxpcl_release();
}
@@ -184,8 +183,8 @@ px_end_session_cleanup(px_state_t *pxs)
/* Clean up after an error or UEL. */
void px_state_cleanup(px_state_t *pxs)
{ px_end_page_cleanup(pxs);
- px_end_session_cleanup(pxs);
- pxs->have_page = false;
+ px_end_session_cleanup(pxs);
+ pxs->have_page = false;
}
void px_purge_character_cache(px_state_t *pxs)
@@ -202,75 +201,75 @@ const byte apxBeginSession[] = {
int
pxBeginSession(px_args_t *par, px_state_t *pxs)
{ pxs->measure = par->pv[0]->value.i;
- pxs->units_per_measure.x = real_value(par->pv[1], 0);
- pxs->units_per_measure.y = real_value(par->pv[1], 1);
+ pxs->units_per_measure.x = real_value(par->pv[1], 0);
+ pxs->units_per_measure.y = real_value(par->pv[1], 1);
pxs->stream_level = 0;
- if ( par->pv[2] )
- pxs->error_report = par->pv[2]->value.i;
- else
- pxs->error_report = eNoReporting;
- px_dict_init(&pxs->session_pattern_dict, pxs->memory, px_free_pattern);
- /* Set media parameters to device defaults, in case BeginPage */
- /* doesn't specify valid ones. */
- /* This is obviously device-dependent. */
- /* get the pjl state */
- {
- pjl_envvar_t *pjl_psize = pjl_proc_get_envvar(pxs->pjls, "paper");
- /* NB. We are not sure about the interaction of pjl's
+ if ( par->pv[2] )
+ pxs->error_report = par->pv[2]->value.i;
+ else
+ pxs->error_report = eNoReporting;
+ px_dict_init(&pxs->session_pattern_dict, pxs->memory, px_free_pattern);
+ /* Set media parameters to device defaults, in case BeginPage */
+ /* doesn't specify valid ones. */
+ /* This is obviously device-dependent. */
+ /* get the pjl state */
+ {
+ pjl_envvar_t *pjl_psize = pjl_proc_get_envvar(pxs->pjls, "paper");
+ /* NB. We are not sure about the interaction of pjl's
wide a4 commands so we don't attempt to implement
it. */
- /* bool pjl_widea4
- = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "widea4"), "no"); */
- int pjl_copies
- = pjl_proc_vartoi(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "copies"));
- bool pjl_duplex
- = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "duplex"), "off");
- bool pjl_bindshort
- = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "binding"), "longedge");
- bool pjl_manualfeed
- = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "manualfeed"), "off");
- pxs->media_size = px_paper_string_to_media(pjl_psize);
- pxs->media_source = (pjl_manualfeed ? eManualFeed : eDefaultSource);
- pxs->duplex = pjl_duplex;
- pxs->duplex_page_mode = (pjl_bindshort ? eDuplexHorizontalBinding :
- eDuplexVerticalBinding);
- pxs->duplex_back_side = eFrontMediaSide;
- pxs->copies = pjl_copies;
- pxs->media_destination = eDefaultDestination;
- pxs->media_type = eDefaultType;
+ /* bool pjl_widea4
+ = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "widea4"), "no"); */
+ int pjl_copies
+ = pjl_proc_vartoi(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "copies"));
+ bool pjl_duplex
+ = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "duplex"), "off");
+ bool pjl_bindshort
+ = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "binding"), "longedge");
+ bool pjl_manualfeed
+ = pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "manualfeed"), "off");
+ pxs->media_size = px_paper_string_to_media(pjl_psize);
+ pxs->media_source = (pjl_manualfeed ? eManualFeed : eDefaultSource);
+ pxs->duplex = pjl_duplex;
+ pxs->duplex_page_mode = (pjl_bindshort ? eDuplexHorizontalBinding :
+ eDuplexVerticalBinding);
+ pxs->duplex_back_side = eFrontMediaSide;
+ pxs->copies = pjl_copies;
+ pxs->media_destination = eDefaultDestination;
+ pxs->media_type = eDefaultType;
pxs->useciecolor = !pjl_proc_compare(pxs->pjls,
pjl_proc_get_envvar(pxs->pjls, "useciecolor"), "on");
-
- if (!pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "orientation"), "LANDSCAPE"))
- pxs->orientation = eLandscapeOrientation;
- if (!pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "orientation"), "PORTRAIT"))
- pxs->orientation = ePortraitOrientation;
- /* NB reverse orientations missing */
-
- /* install the built in fonts */
- if ( pl_load_built_in_fonts(pjl_proc_fontsource_to_path(pxs->pjls, "I"),
- pxs->memory,
- &pxs->builtin_font_dict,
- pxs->font_dir,
- (int)pxfsInternal,
- true /* use unicode key names */) < 0 ) {
- dprintf("Fatal error - no resident fonts\n");
- return -1;
-
- }
- }
- return 0;
+
+ if (!pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "orientation"), "LANDSCAPE"))
+ pxs->orientation = eLandscapeOrientation;
+ if (!pjl_proc_compare(pxs->pjls, pjl_proc_get_envvar(pxs->pjls, "orientation"), "PORTRAIT"))
+ pxs->orientation = ePortraitOrientation;
+ /* NB reverse orientations missing */
+
+ /* install the built in fonts */
+ if ( pl_load_built_in_fonts(pjl_proc_fontsource_to_path(pxs->pjls, "I"),
+ pxs->memory,
+ &pxs->builtin_font_dict,
+ pxs->font_dir,
+ (int)pxfsInternal,
+ true /* use unicode key names */) < 0 ) {
+ dprintf("Fatal error - no resident fonts\n");
+ return -1;
+
+ }
+ }
+ return 0;
}
const byte apxEndSession[] = {0, 0};
int
pxEndSession(px_args_t *par, px_state_t *pxs)
{ px_end_session_cleanup(pxs);
- if ( pxs->warning_length )
- return_error(errorWarningsReported);
- return 0;
+ if ( pxs->warning_length )
+ return_error(errorWarningsReported);
+ return 0;
}
const byte apxBeginPage[] = {
@@ -282,10 +281,10 @@ const byte apxBeginPage[] = {
int
pxBeginPage(px_args_t *par, px_state_t *pxs)
{ gs_state *pgs = pxs->pgs;
- gx_device *dev = gs_currentdevice(pgs);
- gs_point page_size_pixels;
- gs_matrix points2device;
- bool no_pv_2 = false;
+ gx_device *dev = gs_currentdevice(pgs);
+ gs_point page_size_pixels;
+ gs_matrix points2device;
+ bool no_pv_2 = false;
/* check for 2.1 no parameter special cases */
{
@@ -298,7 +297,7 @@ pxBeginPage(px_args_t *par, px_state_t *pxs)
}
}
if ( have_params == false ) {
- if (par->pv[0]) {
+ if (par->pv[0]) {
int32_t orientation = par->pv[0]->value.i;
if ( orientation < 0 || orientation >= pxeOrientation_next )
{ px_record_warning("IllegalOrientation", true, pxs);
@@ -309,296 +308,294 @@ pxBeginPage(px_args_t *par, px_state_t *pxs)
goto setd;
}
}
- /* Check parameter presence for legal combinations. */
- if ( par->pv[2] )
- { if ( par->pv[3] || par->pv[4] )
- return_error(errorIllegalAttributeCombination);
- }
- else if ( par->pv[3] && par->pv[4] )
- { if ( par->pv[2] )
- return_error(errorIllegalAttributeCombination);
- }
- else {
- pxs->pm = px_get_default_media(pxs);
- no_pv_2 = true;
- }
- if ( par->pv[5] )
- { if ( par->pv[6] || par->pv[7] )
- return_error(errorIllegalAttributeCombination);
- }
- else if ( par->pv[6] )
- { if ( par->pv[5] )
- return_error(errorIllegalAttributeCombination);
- }
-
-
- /* Copy parameters to the PCL XL state. */
- /* For some reason, invalid Orientations only produces a warning. */
- if ( par->pv[0] ) {
- int32_t orientation = par->pv[0]->value.i;
- if ( orientation < 0 || orientation >= pxeOrientation_next ) {
- px_record_warning("IllegalOrientation", true, pxs);
- orientation = ePortraitOrientation;
- }
- pxs->orientation = (pxeOrientation_t)orientation;
- }
-
- if ( par->pv[1] )
- pxs->media_source = par->pv[1]->value.i;
- if ( par->pv[2] ) {
- /* default to letter */
- pxeMediaSize_t ms_enum = eLetterPaper;
- int i;
- /* could be an array or enumeration */
- if ( par->pv[2]->type & pxd_array ) {
- /* it's an array, so convert it to the associated
+ /* Check parameter presence for legal combinations. */
+ if ( par->pv[2] )
+ { if ( par->pv[3] || par->pv[4] )
+ return_error(errorIllegalAttributeCombination);
+ }
+ else if ( par->pv[3] && par->pv[4] )
+ { if ( par->pv[2] )
+ return_error(errorIllegalAttributeCombination);
+ }
+ else {
+ pxs->pm = px_get_default_media(pxs);
+ no_pv_2 = true;
+ }
+ if ( par->pv[5] )
+ { if ( par->pv[6] || par->pv[7] )
+ return_error(errorIllegalAttributeCombination);
+ }
+ else if ( par->pv[6] )
+ { if ( par->pv[5] )
+ return_error(errorIllegalAttributeCombination);
+ }
+
+ /* Copy parameters to the PCL XL state. */
+ /* For some reason, invalid Orientations only produces a warning. */
+ if ( par->pv[0] ) {
+ int32_t orientation = par->pv[0]->value.i;
+ if ( orientation < 0 || orientation >= pxeOrientation_next ) {
+ px_record_warning("IllegalOrientation", true, pxs);
+ orientation = ePortraitOrientation;
+ }
+ pxs->orientation = (pxeOrientation_t)orientation;
+ }
+
+ if ( par->pv[1] )
+ pxs->media_source = par->pv[1]->value.i;
+ if ( par->pv[2] ) {
+ /* default to letter */
+ pxeMediaSize_t ms_enum = eLetterPaper;
+ int i;
+ /* could be an array or enumeration */
+ if ( par->pv[2]->type & pxd_array ) {
+ /* it's an array, so convert it to the associated
enumeration */
- byte *str = gs_alloc_string(pxs->memory,
- array_value_size(par->pv[2]) + 1,
- "pxBeginPage");
- if ( str == 0 )
- return_error(errorInsufficientMemory);
- /* null terminate */
- memcpy(str, par->pv[2]->value.array.data, array_value_size(par->pv[2]));
- str[array_value_size(par->pv[2])] = '\0';
- ms_enum = px_paper_string_to_media(/* NB */(pjl_envvar_t *)str);
- gs_free_string(pxs->memory, str,
- array_value_size(par->pv[2]) + 1, "pxBeginPage");
-
- } else if ( par->pv[2]->value.i ) { /* it's an enumeration */
- ms_enum = par->pv[2]->value.i;
- }
- if ( ms_enum == eDefaultPaperSize ) {
- pxs->pm = px_get_default_media(pxs);
- }
- else {
+ byte *str = gs_alloc_string(pxs->memory,
+ array_value_size(par->pv[2]) + 1,
+ "pxBeginPage");
+ if ( str == 0 )
+ return_error(errorInsufficientMemory);
+ /* null terminate */
+ memcpy(str, par->pv[2]->value.array.data, array_value_size(par->pv[2]));
+ str[array_value_size(par->pv[2])] = '\0';
+ ms_enum = px_paper_string_to_media(/* NB */(pjl_envvar_t *)str);
+ gs_free_string(pxs->memory, str,
+ array_value_size(par->pv[2]) + 1, "pxBeginPage");
+
+ } else if ( par->pv[2]->value.i ) { /* it's an enumeration */
+ ms_enum = par->pv[2]->value.i;
+ }
+ if ( ms_enum == eDefaultPaperSize ) {
+ pxs->pm = px_get_default_media(pxs);
+ }
+ else {
bool found_media = false;
- for ( pxs->pm = known_media, i = 0; i < countof(known_media); ++pxs->pm, ++i )
- if ( pxs->pm->ms_enum == ms_enum ) {
+ for ( pxs->pm = known_media, i = 0; i < countof(known_media); ++pxs->pm, ++i )
+ if ( pxs->pm->ms_enum == ms_enum ) {
found_media = true;
break;
}
- if ( !found_media ) { /* No match, select default media. */
- pxs->pm = px_get_default_media(pxs);
- px_record_warning("IllegalMediaSize", false, pxs);
- }
- }
+ if ( !found_media ) { /* No match, select default media. */
+ pxs->pm = px_get_default_media(pxs);
+ px_record_warning("IllegalMediaSize", false, pxs);
+ }
+ }
media: pxs->media_size = pxs->pm->ms_enum;
- pxs->media_dims.x = pxs->pm->width * media_size_scale;
- pxs->media_dims.y = pxs->pm->height * media_size_scale;
- pxs->media_height = pxs->pm->height;
- pxs->media_width = pxs->pm->width;
- } else if ( no_pv_2 ) {
- goto media;
- } else { /* custom (!par->pv[2]) */
- double scale = measure_to_points[par->pv[4]->value.i];
- pxs->media_dims.x = real_value(par->pv[3], 0) * scale;
- pxs->media_dims.y = real_value(par->pv[3], 1) * scale;
- /*
- * Assume the unprintable margins for custom media are the same
- * as for the default media. This may not be right.
- */
- pxs->pm = px_get_default_media(pxs);
- pxs->media_height = pxs->media_dims.y / media_size_scale;
- pxs->media_width = pxs->media_dims.x / media_size_scale;
- }
- if ( par->pv[5] )
- { pxs->duplex = false;
- }
- else if ( par->pv[6] )
- { pxs->duplex = true;
- pxs->duplex_page_mode = par->pv[6]->value.i;
- if ( par->pv[7] )
- pxs->duplex_back_side = (par->pv[7]->value.i == eBackMediaSide);
- }
- if ( par->pv[8] )
- pxs->media_destination = par->pv[8]->value.i;
- if ( par->pv[9] )
- pxs->media_type = par->pv[9]->value.i;
-
- /* Pass the media parameters to the device. */
+ pxs->media_dims.x = pxs->pm->width * media_size_scale;
+ pxs->media_dims.y = pxs->pm->height * media_size_scale;
+ pxs->media_height = pxs->pm->height;
+ pxs->media_width = pxs->pm->width;
+ } else if ( no_pv_2 ) {
+ goto media;
+ } else { /* custom (!par->pv[2]) */
+ double scale = measure_to_points[par->pv[4]->value.i];
+ pxs->media_dims.x = real_value(par->pv[3], 0) * scale;
+ pxs->media_dims.y = real_value(par->pv[3], 1) * scale;
+ /*
+ * Assume the unprintable margins for custom media are the same
+ * as for the default media. This may not be right.
+ */
+ pxs->pm = px_get_default_media(pxs);
+ pxs->media_height = pxs->media_dims.y / media_size_scale;
+ pxs->media_width = pxs->media_dims.x / media_size_scale;
+ }
+ if ( par->pv[5] )
+ { pxs->duplex = false;
+ }
+ else if ( par->pv[6] )
+ { pxs->duplex = true;
+ pxs->duplex_page_mode = par->pv[6]->value.i;
+ if ( par->pv[7] )
+ pxs->duplex_back_side = (par->pv[7]->value.i == eBackMediaSide);
+ }
+ if ( par->pv[8] )
+ pxs->media_destination = par->pv[8]->value.i;
+ if ( par->pv[9] )
+ pxs->media_type = par->pv[9]->value.i;
+
+ /* Pass the media parameters to the device. */
setd: { gs_memory_t *mem = pxs->memory;
- gs_c_param_list list;
+ gs_c_param_list list;
#define plist ((gs_param_list *)&list)
- gs_param_float_array fa;
- float fv[4];
- int iv;
- bool bv;
- int ecode = 0;
- int code;
-
- fa.data = fv;
- fa.persistent = false;
-
- gs_c_param_list_write(&list, mem);
- iv = pxs->orientation; /* might not be an int */
- code = param_write_int(plist, "Orientation", &iv);
- ecode = px_put1(dev, &list, ecode);
-
- gs_c_param_list_write(&list, mem);
- fv[0] = pxs->media_dims.x;
- fv[1] = pxs->media_dims.y;
- fa.size = 2;
- code = param_write_float_array(plist, ".MediaSize", &fa);
- ecode = px_put1(dev, &list, ecode);
- gs_c_param_list_write(&list, mem);
-
- /* Set the mis-named "Margins" (actually the offset on the page) */
- /* to zero. */
- gs_c_param_list_write(&list, mem);
- fv[0] = 0;
- fv[1] = 0;
- fa.size = 2;
- code = param_write_float_array(plist, "Margins", &fa);
- ecode = px_put1(dev, &list, ecode);
-
- iv = pxs->media_source; /* might not be an int */
- if ( iv < 0 || iv >= pxeMediaSource_next )
- px_record_warning("IllegalMediaSource", false, pxs);
- else
- { gs_c_param_list_write(&list, mem);
- code = param_write_int(plist, ".MediaSource", &iv);
- ecode = px_put1(dev, &list, ecode);
- }
-
- gs_c_param_list_write(&list, mem);
- code = param_write_bool(plist, "Duplex", &pxs->duplex);
- ecode = px_put1(dev, &list, ecode);
-
- gs_c_param_list_write(&list, mem);
- bv = pxs->duplex_page_mode == eDuplexHorizontalBinding;
- code = param_write_bool(plist, "Tumble", &bv);
- ecode = px_put1(dev, &list, ecode);
-
- gs_c_param_list_write(&list, mem);
- bv = !pxs->duplex_back_side;
- code = param_write_bool(plist, "FirstSide", &bv);
- ecode = px_put1(dev, &list, ecode);
-
- gs_c_param_list_write(&list, mem);
- iv = pxs->media_destination; /* might not be an int */
- code = param_write_int(plist, ".MediaDestination", &iv);
- ecode = px_put1(dev, &list, ecode);
-
- gs_c_param_list_write(&list, mem);
- iv = pxs->media_type; /* might not be an int */
- code = param_write_int(plist, ".MediaType", &iv);
- ecode = px_put1(dev, &list, ecode);
-
- /*
- * We aren't sure what to do if the device rejects the parameter
- * value....
- */
- switch ( ecode )
- {
- case 1:
- code = gs_setdevice(pgs, dev);
- if ( code < 0 )
- return code;
- case 0:
- break;
- default:
- return_error(errorIllegalAttributeValue);
- }
+ gs_param_float_array fa;
+ float fv[4];
+ int iv;
+ bool bv;
+ int ecode = 0;
+ int code;
+
+ fa.data = fv;
+ fa.persistent = false;
+
+ gs_c_param_list_write(&list, mem);
+ iv = pxs->orientation; /* might not be an int */
+ code = param_write_int(plist, "Orientation", &iv);
+ ecode = px_put1(dev, &list, ecode);
+
+ gs_c_param_list_write(&list, mem);
+ fv[0] = pxs->media_dims.x;
+ fv[1] = pxs->media_dims.y;
+ fa.size = 2;
+ code = param_write_float_array(plist, ".MediaSize", &fa);
+ ecode = px_put1(dev, &list, ecode);
+ gs_c_param_list_write(&list, mem);
+
+ /* Set the mis-named "Margins" (actually the offset on the page) */
+ /* to zero. */
+ gs_c_param_list_write(&list, mem);
+ fv[0] = 0;
+ fv[1] = 0;
+ fa.size = 2;
+ code = param_write_float_array(plist, "Margins", &fa);
+ ecode = px_put1(dev, &list, ecode);
+
+ iv = pxs->media_source; /* might not be an int */
+ if ( iv < 0 || iv >= pxeMediaSource_next )
+ px_record_warning("IllegalMediaSource", false, pxs);
+ else
+ { gs_c_param_list_write(&list, mem);
+ code = param_write_int(plist, ".MediaSource", &iv);
+ ecode = px_put1(dev, &list, ecode);
+ }
+
+ gs_c_param_list_write(&list, mem);
+ code = param_write_bool(plist, "Duplex", &pxs->duplex);
+ ecode = px_put1(dev, &list, ecode);
+
+ gs_c_param_list_write(&list, mem);
+ bv = pxs->duplex_page_mode == eDuplexHorizontalBinding;
+ code = param_write_bool(plist, "Tumble", &bv);
+ ecode = px_put1(dev, &list, ecode);
+
+ gs_c_param_list_write(&list, mem);
+ bv = !pxs->duplex_back_side;
+ code = param_write_bool(plist, "FirstSide", &bv);
+ ecode = px_put1(dev, &list, ecode);
+
+ gs_c_param_list_write(&list, mem);
+ iv = pxs->media_destination; /* might not be an int */
+ code = param_write_int(plist, ".MediaDestination", &iv);
+ ecode = px_put1(dev, &list, ecode);
+
+ gs_c_param_list_write(&list, mem);
+ iv = pxs->media_type; /* might not be an int */
+ code = param_write_int(plist, ".MediaType", &iv);
+ ecode = px_put1(dev, &list, ecode);
+
+ /*
+ * We aren't sure what to do if the device rejects the parameter
+ * value....
+ */
+ switch ( ecode )
+ {
+ case 1:
+ code = gs_setdevice(pgs, dev);
+ if ( code < 0 )
+ return code;
+ case 0:
+ break;
+ default:
+ return_error(errorIllegalAttributeValue);
+ }
#undef plist
- }
- { int code;
-
- px_initgraphics(pxs);
- gs_currentmatrix(pgs, &points2device);
- gs_dtransform(pgs, pxs->media_dims.x, pxs->media_dims.y,
- &page_size_pixels);
- { /*
- * Put the origin at the upper left corner of the page;
- * also account for the orientation.
- */
- gs_matrix orient;
-
- orient.xx = orient.xy = orient.yx = orient.yy =
- orient.tx = orient.ty = 0;
- switch ( pxs->orientation )
- {
- case eDefaultOrientation:
- case ePortraitOrientation:
- code = gs_translate(pgs, 0.0, pxs->media_dims.y);
- orient.xx = 1, orient.yy = -1;
- break;
- case eLandscapeOrientation:
- code = 0;
- orient.xy = 1, orient.yx = 1;
- break;
- case eReversePortrait:
- code = gs_translate(pgs, pxs->media_dims.x, 0);
- orient.xx = -1, orient.yy = 1;
- break;
- case eReverseLandscape:
- code = gs_translate(pgs, pxs->media_dims.x, pxs->media_dims.y);
- orient.xy = -1, orient.yx = -1;
- break;
- default: /* can't happen */
- return_error(errorIllegalAttributeValue);
- }
- if ( code < 0 ||
- (code = gs_concat(pgs, &orient)) < 0
- )
- return code;
- }
- { /* Scale according to session parameters. */
- /* If we can make the scale integral safely, we do. */
- double scale = measure_to_points[pxs->measure];
- gs_matrix mat;
-
- if ( (code = gs_scale(pgs, scale / pxs->units_per_measure.x,
- scale / pxs->units_per_measure.y)) < 0
- )
- return code;
- gs_currentmatrix(pgs, &mat);
- mat.xx = px_adjust_scale(mat.xx, page_size_pixels.x);
- mat.xy = px_adjust_scale(mat.xy, page_size_pixels.y);
- mat.yx = px_adjust_scale(mat.yx, page_size_pixels.x);
- mat.yy = px_adjust_scale(mat.yy, page_size_pixels.y);
- gs_setmatrix(pgs, &mat);
- pxs->initial_matrix = mat;
- }
- }
- { /*
- * Set the default halftone method. We have to do this here,
- * rather than earlier, so that the origin is set correctly.
- */
- px_args_t args;
- px_value_t device_matrix;
+ }
+ { int code;
+
+ px_initgraphics(pxs);
+ gs_currentmatrix(pgs, &points2device);
+ gs_dtransform(pgs, pxs->media_dims.x, pxs->media_dims.y,
+ &page_size_pixels);
+ { /*
+ * Put the origin at the upper left corner of the page;
+ * also account for the orientation.
+ */
+ gs_matrix orient;
+
+ orient.xx = orient.xy = orient.yx = orient.yy =
+ orient.tx = orient.ty = 0;
+ switch ( pxs->orientation )
+ {
+ case eDefaultOrientation:
+ case ePortraitOrientation:
+ code = gs_translate(pgs, 0.0, pxs->media_dims.y);
+ orient.xx = 1, orient.yy = -1;
+ break;
+ case eLandscapeOrientation:
+ code = 0;
+ orient.xy = 1, orient.yx = 1;
+ break;
+ case eReversePortrait:
+ code = gs_translate(pgs, pxs->media_dims.x, 0);
+ orient.xx = -1, orient.yy = 1;
+ break;
+ case eReverseLandscape:
+ code = gs_translate(pgs, pxs->media_dims.x, pxs->media_dims.y);
+ orient.xy = -1, orient.yx = -1;
+ break;
+ default: /* can't happen */
+ return_error(errorIllegalAttributeValue);
+ }
+ if ( code < 0 ||
+ (code = gs_concat(pgs, &orient)) < 0
+ )
+ return code;
+ }
+ { /* Scale according to session parameters. */
+ /* If we can make the scale integral safely, we do. */
+ double scale = measure_to_points[pxs->measure];
+ gs_matrix mat;
+
+ if ( (code = gs_scale(pgs, scale / pxs->units_per_measure.x,
+ scale / pxs->units_per_measure.y)) < 0
+ )
+ return code;
+ gs_currentmatrix(pgs, &mat);
+ mat.xx = px_adjust_scale(mat.xx, page_size_pixels.x);
+ mat.xy = px_adjust_scale(mat.xy, page_size_pixels.y);
+ mat.yx = px_adjust_scale(mat.yx, page_size_pixels.x);
+ mat.yy = px_adjust_scale(mat.yy, page_size_pixels.y);
+ gs_setmatrix(pgs, &mat);
+ pxs->initial_matrix = mat;
+ }
+ }
+ { /*
+ * Set the default halftone method. We have to do this here,
+ * rather than earlier, so that the origin is set correctly.
+ */
+ px_args_t args;
+ px_value_t device_matrix;
memset(args.pv, 0, sizeof(args.pv));
- args.pv[1] = &device_matrix; /* DeviceMatrix */
- device_matrix.type = pxd_scalar | pxd_ubyte;
- device_matrix.value.i = eDeviceBest;
- pxSetHalftoneMethod(&args, pxs);
- }
- /* Initialize other parts of the PCL XL state. */
- px_dict_init(&pxs->page_pattern_dict, pxs->memory, px_free_pattern);
- gs_erasepage(pgs);
- pxs->have_page = false;
- /* Make sure there is a legitimate halftone installed. */
- { int code = px_set_halftone(pxs);
- if ( code < 0 )
- return code;
- }
- /*
- * Do a gsave so we can be sure to get rid of all page-related
- * state at the end of the page, but make sure PopGS doesn't pop
- * this state from the stack.
- */
- { int code = pxPushGS(NULL, pxs);
- if ( code < 0 )
- return code;
- pxs->pxgs->stack_depth--;
- return code;
- }
+ args.pv[1] = &device_matrix; /* DeviceMatrix */
+ device_matrix.type = pxd_scalar | pxd_ubyte;
+ device_matrix.value.i = eDeviceBest;
+ pxSetHalftoneMethod(&args, pxs);
+ }
+ /* Initialize other parts of the PCL XL state. */
+ px_dict_init(&pxs->page_pattern_dict, pxs->memory, px_free_pattern);
+ gs_erasepage(pgs);
+ pxs->have_page = false;
+ /* Make sure there is a legitimate halftone installed. */
+ { int code = px_set_halftone(pxs);
+ if ( code < 0 )
+ return code;
+ }
+ /*
+ * Do a gsave so we can be sure to get rid of all page-related
+ * state at the end of the page, but make sure PopGS doesn't pop
+ * this state from the stack.
+ */
+ { int code = pxPushGS(NULL, pxs);
+ if ( code < 0 )
+ return code;
+ pxs->pxgs->stack_depth--;
+ return code;
+ }
}
-
int
pxBeginPageFromPassthrough(px_state_t *pxs)
-{
+{
int code;
gs_state *pgs = pxs->pgs;
gx_device *dev = gs_currentdevice(pgs);
@@ -608,58 +605,58 @@ pxBeginPageFromPassthrough(px_state_t *pxs)
px_initgraphics(pxs);
gs_currentmatrix(pgs, &points2device);
gs_dtransform(pgs, pxs->media_dims.x, pxs->media_dims.y,
- &page_size_pixels);
+ &page_size_pixels);
{ /*
* Put the origin at the upper left corner of the page;
* also account for the orientation.
*/
- gs_matrix orient;
-
- orient.xx = orient.xy = orient.yx = orient.yy =
- orient.tx = orient.ty = 0;
- switch ( pxs->orientation )
- {
- case eDefaultOrientation:
- case ePortraitOrientation:
- code = gs_translate(pgs, 0.0, pxs->media_dims.y);
- orient.xx = 1, orient.yy = -1;
- break;
- case eLandscapeOrientation:
- code = 0;
- orient.xy = 1, orient.yx = 1;
- break;
- case eReversePortrait:
- code = gs_translate(pgs, pxs->media_dims.x, 0);
- orient.xx = -1, orient.yy = 1;
- break;
- case eReverseLandscape:
- code = gs_translate(pgs, pxs->media_dims.x, pxs->media_dims.y);
- orient.xy = -1, orient.yx = -1;
- break;
- default: /* can't happen */
- return_error(errorIllegalAttributeValue);
- }
- if ( code < 0 ||
- (code = gs_concat(pgs, &orient)) < 0
- )
- return code;
+ gs_matrix orient;
+
+ orient.xx = orient.xy = orient.yx = orient.yy =
+ orient.tx = orient.ty = 0;
+ switch ( pxs->orientation )
+ {
+ case eDefaultOrientation:
+ case ePortraitOrientation:
+ code = gs_translate(pgs, 0.0, pxs->media_dims.y);
+ orient.xx = 1, orient.yy = -1;
+ break;
+ case eLandscapeOrientation:
+ code = 0;
+ orient.xy = 1, orient.yx = 1;
+ break;
+ case eReversePortrait:
+ code = gs_translate(pgs, pxs->media_dims.x, 0);
+ orient.xx = -1, orient.yy = 1;
+ break;
+ case eReverseLandscape:
+ code = gs_translate(pgs, pxs->media_dims.x, pxs->media_dims.y);
+ orient.xy = -1, orient.yx = -1;
+ break;
+ default: /* can't happen */
+ return_error(errorIllegalAttributeValue);
+ }
+ if ( code < 0 ||
+ (code = gs_concat(pgs, &orient)) < 0
+ )
+ return code;
}
{ /* Scale according to session parameters. */
- /* If we can make the scale integral safely, we do. */
- double scale = measure_to_points[pxs->measure];
- gs_matrix mat;
-
- if ( (code = gs_scale(pgs, scale / pxs->units_per_measure.x,
- scale / pxs->units_per_measure.y)) < 0
- )
- return code;
- gs_currentmatrix(pgs, &mat);
- mat.xx = px_adjust_scale(mat.xx, page_size_pixels.x);
- mat.xy = px_adjust_scale(mat.xy, page_size_pixels.y);
- mat.yx = px_adjust_scale(mat.yx, page_size_pixels.x);
- mat.yy = px_adjust_scale(mat.yy, page_size_pixels.y);
- gs_setmatrix(pgs, &mat);
- pxs->initial_matrix = mat;
+ /* If we can make the scale integral safely, we do. */
+ double scale = measure_to_points[pxs->measure];
+ gs_matrix mat;
+
+ if ( (code = gs_scale(pgs, scale / pxs->units_per_measure.x,
+ scale / pxs->units_per_measure.y)) < 0
+ )
+ return code;
+ gs_currentmatrix(pgs, &mat);
+ mat.xx = px_adjust_scale(mat.xx, page_size_pixels.x);
+ mat.xy = px_adjust_scale(mat.xy, page_size_pixels.y);
+ mat.yx = px_adjust_scale(mat.yx, page_size_pixels.x);
+ mat.yy = px_adjust_scale(mat.yy, page_size_pixels.y);
+ gs_setmatrix(pgs, &mat);
+ pxs->initial_matrix = mat;
}
pxs->have_page = true;
return 0;
@@ -672,9 +669,9 @@ const byte apxEndPage[] = {
int
pxEndPage(px_args_t *par, px_state_t *pxs)
{ px_end_page_cleanup(pxs);
- (*pxs->end_page)(pxs, (par->pv[0] ? par->pv[0]->value.i : pxs->copies), 1);
- pxs->have_page = false;
- return 0;
+ (*pxs->end_page)(pxs, (par->pv[0] ? par->pv[0]->value.i : pxs->copies), 1);
+ pxs->have_page = false;
+ return 0;
}
/* The default end-page procedure just calls the device procedure. */
int
@@ -689,16 +686,14 @@ const byte apxVendorUnique[] = {
/** we do NOTHING with the vendor unique command.
* it is undocumented, but appears that it contains the sames color commands as the
* XL 2.1 spec. This is based on only finding it in hpclj 4500 driver output.
- * of course HP denys that the 4500 supports XL.
+ * of course HP denys that the 4500 supports XL.
*/
int
pxVendorUnique(px_args_t *par, px_state_t *pxs)
-{
+{
return 0;
}
-
-
const byte apxComment[] = {
0,
pxaCommentData, 0
@@ -714,17 +709,16 @@ const byte apxOpenDataSource[] = {
int
pxOpenDataSource(px_args_t *par, px_state_t *pxs)
{ if ( pxs->data_source_open )
- return_error(errorDataSourceNotClosed);
- pxs->data_source_open = true;
- pxs->data_source_big_endian =
- par->pv[1]->value.i == eBinaryHighByteFirst;
- return 0;
+ return_error(errorDataSourceNotClosed);
+ pxs->data_source_open = true;
+ pxs->data_source_big_endian =
+ par->pv[1]->value.i == eBinaryHighByteFirst;
+ return 0;
}
const byte apxCloseDataSource[] = {0, 0};
int
pxCloseDataSource(px_args_t *par, px_state_t *pxs)
{ pxs->data_source_open = false;
- return 0;
+ return 0;
}
-
diff --git a/pxl/pxstate.c b/pxl/pxstate.c
index 858e60f53..8f2b054f6 100644
--- a/pxl/pxstate.c
+++ b/pxl/pxstate.c
@@ -31,13 +31,13 @@ extern const px_init_proc px_init_table[];
/* Allocate a px_state_t. */
px_state_t *
px_state_alloc(gs_memory_t *memory)
-{
+{
px_state_t *pxs = (px_state_t *)gs_alloc_bytes(memory,
sizeof(px_state_t),
"px_state_alloc");
px_gstate_t *pxgs = px_gstate_alloc(memory);
- if ( pxs == 0 || pxgs == 0 ) {
+ if ( pxs == 0 || pxgs == 0 ) {
gs_free_object(memory, pxgs, "px_gstate_alloc");
gs_free_object(memory, pxs, "px_state_alloc");
return 0;
@@ -47,10 +47,10 @@ px_state_alloc(gs_memory_t *memory)
pxgs->pxs = pxs;
px_state_init(pxs, NULL);
/* Run module initialization code. */
- {
+ {
const px_init_proc *init;
for ( init = px_init_table; *init; ++init )
- (*init)(pxs);
+ (*init)(pxs);
}
return pxs;
}
@@ -70,17 +70,17 @@ px_state_release(px_state_t *pxs)
void
px_state_init(px_state_t *pxs, gs_state *pgs)
{ pxs->pgs = pgs;
- px_gstate_init(pxs->pxgs, pgs);
- pxs->error_report = eErrorPage; /* default before first session */
- pxs->end_page = px_default_end_page;
- pxs->data_source_open = false;
- px_dict_init(&pxs->stream_dict, pxs->memory, NULL);
- px_dict_init(&pxs->builtin_font_dict, pxs->memory, px_free_font);
- px_dict_init(&pxs->font_dict, pxs->memory, px_free_font);
+ px_gstate_init(pxs->pxgs, pgs);
+ pxs->error_report = eErrorPage; /* default before first session */
+ pxs->end_page = px_default_end_page;
+ pxs->data_source_open = false;
+ px_dict_init(&pxs->stream_dict, pxs->memory, NULL);
+ px_dict_init(&pxs->builtin_font_dict, pxs->memory, px_free_font);
+ px_dict_init(&pxs->font_dict, pxs->memory, px_free_font);
px_dict_init(&pxs->page_pattern_dict, pxs->memory, px_free_pattern);
px_dict_init(&pxs->session_pattern_dict, pxs->memory, px_free_pattern);
pxs->have_page = false;
- pxs->warning_length = 0;
+ pxs->warning_length = 0;
}
/* Do one-time finalization at the end of execution. */
@@ -88,6 +88,6 @@ void
px_state_finit(px_state_t *pxs)
{ /* If streams persisted across sessions, we would release them here. */
#if 0
- px_dict_release(&pxs->stream_dict);
+ px_dict_release(&pxs->stream_dict);
#endif
}
diff --git a/pxl/pxstate.h b/pxl/pxstate.h
index 233ca807c..51a07b2db 100644
--- a/pxl/pxstate.h
+++ b/pxl/pxstate.h
@@ -23,7 +23,7 @@
/* Define an abstract type for a font directory. */
#ifndef gs_font_dir_DEFINED
-# define gs_font_dir_DEFINED
+# define gs_font_dir_DEFINED
typedef struct gs_font_dir_s gs_font_dir;
#endif
@@ -65,21 +65,21 @@ typedef struct px_media_s {
struct px_state_s {
gs_memory_t *memory;
- /* Hook back to client data, for callback procedures */
+ /* Hook back to client data, for callback procedures */
void *client_data;
gs_id known_fonts_base_id;
- /* Session state */
+ /* Session state */
pxeMeasure_t measure;
gs_point units_per_measure;
pxeErrorReport_t error_report;
bool useciecolor;
- /* Pattern dictionary */
+ /* Pattern dictionary */
px_dict_t session_pattern_dict;
- /* Page state */
+ /* Page state */
pxeOrientation_t orientation;
pxeMediaSource_t media_source;
@@ -99,20 +99,20 @@ struct px_state_s {
short media_width;
int (*end_page)(px_state_t *pxs, int num_copies, int flush);
- /* Pattern dictionary */
+ /* Pattern dictionary */
px_dict_t page_pattern_dict;
- /* Internal variables */
+ /* Internal variables */
bool have_page; /* true if anything has been written on page */
- /* Cached values */
+ /* Cached values */
gs_matrix initial_matrix;
- /* Data source */
+ /* Data source */
bool data_source_open;
bool data_source_big_endian;
- /* Stream dictionary */
+ /* Stream dictionary */
px_dict_t stream_dict;
- /* Stream reading state */
+ /* Stream reading state */
gs_string stream_name;
int stream_level; /* recursion depth */
struct sd2_ {
@@ -120,25 +120,25 @@ struct px_state_s {
uint size;
} stream_def;
- /* Font dictionary */
+ /* Font dictionary */
px_dict_t font_dict;
px_dict_t builtin_font_dict;
- /* Font/character downloading state */
+ /* Font/character downloading state */
px_font_t *download_font;
int font_format;
- /* Global structures */
+ /* Global structures */
gs_font_dir *font_dir;
px_font_t *error_page_font;
- /* Graphics state */
+ /* Graphics state */
gs_state *pgs; /* PostScript graphics state */
px_gstate_t *pxgs;
- /* Image/pattern reading state */
+ /* Image/pattern reading state */
px_image_enum_t *image_enum;
px_pattern_enum_t *pattern_enum;
- /* Miscellaneous */
+ /* Miscellaneous */
bool interpolate; /* image interpolation */
struct db_ {
@@ -151,8 +151,8 @@ struct px_state_s {
double y0, y1;
} scan_point; /* position when reading scan lines */
- /* We put the warning table and error line buffer at the end */
- /* so that the offsets of the scalars will stay small. */
+ /* We put the warning table and error line buffer at the end */
+ /* so that the offsets of the scalars will stay small. */
#define px_max_error_line 120
char error_line[px_max_error_line + 1]; /* for errors with their own msg */
#define px_max_warning_message 500
diff --git a/pxl/pxstream.c b/pxl/pxstream.c
index e432a6653..a109795ad 100644
--- a/pxl/pxstream.c
+++ b/pxl/pxstream.c
@@ -102,14 +102,14 @@ const byte apxRemoveStream[] = {
int
pxRemoveStream(px_args_t *par, px_state_t *pxs)
-{
+{
gs_string str;
void *def;
int code = tag_stream_name(par->pv[0], &str, pxs->memory,
"pxExecStream(name)");
if ( code < 0 )
return code;
- {
+ {
bool found = pl_dict_find(&pxs->stream_dict, str.data, str.size,
&def);
if ( !found )
@@ -167,7 +167,7 @@ pxExecStream(px_args_t *par, px_state_t *pxs)
)
return_error(errorUnsupportedClassName);
/* support protocol level 1, 2 and 3 */
- if ( strncmp((const char *)def_data + 11, ";1;", 3) &&
+ if ( strncmp((const char *)def_data + 11, ";1;", 3) &&
strncmp((const char *)def_data + 11, ";2;", 3) &&
strncmp((const char *)def_data + 11, ";3;", 3) )
return_error(errorUnsupportedProtocol);
diff --git a/pxl/pxsymbol.ps b/pxl/pxsymbol.ps
index e8ccae018..dfc44417a 100644
--- a/pxl/pxsymbol.ps
+++ b/pxl/pxsymbol.ps
@@ -13,7 +13,7 @@
5 { pop dup token pop } repeat
}
if
- % stack: file token
+ % stack: file token
/Encoding resourcestatus
{ pop 2 ne
{ closefile }
@@ -95,7 +95,7 @@ const unsigned short px) print dup =only ([257] = {) print
) print
dup 1 exch 3 add
{ ( pxg_) print 2 copy get dup /.notdef eq { pop (_notdef) } if
- =only (,) print pop
+ =only (,) print pop
}
for
}
diff --git a/pxl/pxtop.c b/pxl/pxtop.c
index 4b1f9c30f..aab546420 100644
--- a/pxl/pxtop.c
+++ b/pxl/pxtop.c
@@ -61,81 +61,79 @@ px_operator_proc(pxBeginSession);
static int pxl_end_page_top(px_state_t *pxs, int num_copies, int flush);
static int px_top_init(px_parser_state_t *st, px_state_t *pxs, bool big_endian);
-
/* ------------ PCXL stream header processor ------- */
/* State used to process an XL stream header */
typedef struct px_stream_header_process_s {
- enum {PSHPReady, PSHPSkipping, PSHPDone} state;
- px_parser_state_t *st; /* parser state to refer to */
+ enum {PSHPReady, PSHPSkipping, PSHPDone} state;
+ px_parser_state_t *st; /* parser state to refer to */
px_state_t *pxs; /* xl state to refer to */
} px_stream_header_process_t;
-
/* Initialize stream header processor */
static void
px_stream_header_init(
- px_stream_header_process_t *process, /* header state to init */
- px_parser_state_t *st, /* parser state to refer to */
- px_state_t *pxs /* xl state to refer to */
+ px_stream_header_process_t *process, /* header state to init */
+ px_parser_state_t *st, /* parser state to refer to */
+ px_state_t *pxs /* xl state to refer to */
)
{
- process->state = PSHPReady;
- process->st = st;
- process->pxs = pxs;
+ process->state = PSHPReady;
+ process->st = st;
+ process->pxs = pxs;
}
/* Process stream header input */
static int /* ret -ve error, 0 if needs more input, 1 if done successfully */
px_stream_header_process(
- px_stream_header_process_t *process, /* header state to refer */
- stream_cursor_read *cursor /* cusor to read data */
+ px_stream_header_process_t *process, /* header state to refer */
+ stream_cursor_read *cursor /* cusor to read data */
)
{
- while (cursor->ptr != cursor->limit)
- {
- byte chr;
- switch (process->state)
- {
- case PSHPReady:
- process->state = PSHPSkipping; /* switch to next state */
- switch ( (chr = *++cursor->ptr) )
- {
- case '(':
- px_top_init(process->st, process->pxs, true);
- break;
- case ')':
- px_top_init(process->st, process->pxs, false);
- break;
- default:
- /* Initialize state to avoid confusion */
- px_top_init(process->st, process->pxs, true);
- return gs_note_error(errorUnsupportedBinding);
- }
- break;
- case PSHPSkipping:
- if ( (chr = *++cursor->ptr) == '\n' )
- {
- process->state = PSHPDone;
- return 1;
- }
- break;
- case PSHPDone:
- default:
- /* Shouldn't ever come here */
- return gs_note_error(errorIllegalStreamHeader);
- }
- }
-
- return 0; /* need more input */
+ while (cursor->ptr != cursor->limit)
+ {
+ byte chr;
+ switch (process->state)
+ {
+ case PSHPReady:
+ process->state = PSHPSkipping; /* switch to next state */
+ switch ( (chr = *++cursor->ptr) )
+ {
+ case '(':
+ px_top_init(process->st, process->pxs, true);
+ break;
+ case ')':
+ px_top_init(process->st, process->pxs, false);
+ break;
+ default:
+ /* Initialize state to avoid confusion */
+ px_top_init(process->st, process->pxs, true);
+ return gs_note_error(errorUnsupportedBinding);
+ }
+ break;
+ case PSHPSkipping:
+ if ( (chr = *++cursor->ptr) == '\n' )
+ {
+ process->state = PSHPDone;
+ return 1;
+ }
+ break;
+ case PSHPDone:
+ default:
+ /* Shouldn't ever come here */
+ return gs_note_error(errorIllegalStreamHeader);
+ }
+ }
+
+ return 0; /* need more input */
}
/* De-initialize stream header processor */
static void
px_stream_header_dnit(
- px_stream_header_process_t *process /* header state to dnit */
+ px_stream_header_process_t *process /* header state to dnit */
)
{
- /* empty proc */
+ /* empty proc */
}
/************************************************************/
@@ -169,7 +167,6 @@ typedef struct pxl_interp_instance_s {
headerState; /* used to decode stream header */
} pxl_interp_instance_t;
-
/* Get implemtation's characteristics */
static const pl_interp_characteristics_t * /* always returns a descriptor */
pxl_impl_characteristics(
@@ -198,11 +195,11 @@ pxl_impl_allocate_interp(
gs_memory_t *mem /* allocator to allocate interp from */
)
{
- static pl_interp_t pi; /* there's only one interpreter */
+ static pl_interp_t pi; /* there's only one interpreter */
- /* There's only one PXL interp, so return the static */
- *interp = &pi;
- return 0; /* success */
+ /* There's only one PXL interp, so return the static */
+ *interp = &pi;
+ return 0; /* success */
}
/* Do per-instance interpreter allocation/init. No device is set yet */
@@ -213,47 +210,47 @@ pxl_impl_allocate_interp_instance(
gs_memory_t *mem /* allocator to allocate instance from */
)
{
- /* Allocate everything up front */
- pxl_interp_instance_t *pxli /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
- = (pxl_interp_instance_t *)gs_alloc_bytes( mem,
- sizeof(pxl_interp_instance_t),
- "pxl_allocate_interp_instance(pxl_interp_instance_t)"
+ /* Allocate everything up front */
+ pxl_interp_instance_t *pxli /****** SHOULD HAVE A STRUCT DESCRIPTOR ******/
+ = (pxl_interp_instance_t *)gs_alloc_bytes( mem,
+ sizeof(pxl_interp_instance_t),
+ "pxl_allocate_interp_instance(pxl_interp_instance_t)"
);
- gs_state *pgs = gs_state_alloc(mem);
- px_parser_state_t *st = px_process_alloc(mem); /* parser init, cheap */
- px_state_t *pxs = px_state_alloc(mem); /* inits interp state, potentially expensive */
- /* If allocation error, deallocate & return */
- if (!pxli || !pgs || !st || !pxs) {
- if (pxli)
- gs_free_object(mem, pxli, "pxl_impl_allocate_interp_instance(pxl_interp_instance_t)");
- if (pgs)
- gs_state_free(pgs);
- if (st)
- px_process_release(st);
- if (pxs)
- px_state_release(pxs);
- return gs_error_VMerror;
- }
+ gs_state *pgs = gs_state_alloc(mem);
+ px_parser_state_t *st = px_process_alloc(mem); /* parser init, cheap */
+ px_state_t *pxs = px_state_alloc(mem); /* inits interp state, potentially expensive */
+ /* If allocation error, deallocate & return */
+ if (!pxli || !pgs || !st || !pxs) {
+ if (pxli)
+ gs_free_object(mem, pxli, "pxl_impl_allocate_interp_instance(pxl_interp_instance_t)");
+ if (pgs)
+ gs_state_free(pgs);
+ if (st)
+ px_process_release(st);
+ if (pxs)
+ px_state_release(pxs);
+ return gs_error_VMerror;
+ }
gsicc_init_iccmanager(pgs);
- /* Setup pointers to allocated mem within instance */
- pxli->memory = mem;
- pxli->pgs = pgs;
- pxli->pxs = pxs;
- pxli->st = st;
+ /* Setup pointers to allocated mem within instance */
+ pxli->memory = mem;
+ pxli->pgs = pgs;
+ pxli->pxs = pxs;
+ pxli->st = st;
- /* zero-init pre/post page actions for now */
- pxli->pre_page_action = 0;
- pxli->post_page_action = 0;
+ /* zero-init pre/post page actions for now */
+ pxli->pre_page_action = 0;
+ pxli->post_page_action = 0;
- /* General init of pxl_state */
- px_state_init(pxs, pgs); /*pgs only needed to set pxs as pgs' client */
- pxs->client_data = pxli;
- pxs->end_page = pxl_end_page_top; /* after px_state_init */
+ /* General init of pxl_state */
+ px_state_init(pxs, pgs); /*pgs only needed to set pxs as pgs' client */
+ pxs->client_data = pxli;
+ pxs->end_page = pxl_end_page_top; /* after px_state_init */
- /* Return success */
- *instance = (pl_interp_instance_t *)pxli;
- return 0;
+ /* Return success */
+ *instance = (pl_interp_instance_t *)pxli;
+ return 0;
}
/* Set a client language into an interperter instance */
@@ -264,13 +261,13 @@ pxl_impl_set_client_instance(
pl_interp_instance_clients_t which_client
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
if ( which_client == PCL_CLIENT )
pxli->pxs->pcls = client;
else if ( which_client == PJL_CLIENT )
pxli->pxs->pjls = client;
/* ignore unknown clients */
- return 0;
+ return 0;
}
/* Set an interpreter instance's pre-page action */
@@ -281,10 +278,10 @@ pxl_impl_set_pre_page_action(
void *closure /* closure to call action with */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- pxli->pre_page_action = action;
- pxli->pre_page_closure = closure;
- return 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ pxli->pre_page_action = action;
+ pxli->pre_page_closure = closure;
+ return 0;
}
/* Set an interpreter instance's post-page action */
@@ -295,10 +292,10 @@ pxl_impl_set_post_page_action(
void *closure /* closure to call action with */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- pxli->post_page_action = action;
- pxli->post_page_closure = closure;
- return 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ pxli->post_page_action = action;
+ pxli->post_page_closure = closure;
+ return 0;
}
static bool
@@ -314,71 +311,70 @@ pxl_impl_set_device(
gx_device *device /* device to set (open or closed) */
)
{
- int code;
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- px_state_t *pxs = pxli->pxs;
+ int code;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ px_state_t *pxs = pxli->pxs;
- enum {Sbegin, Ssetdevice, Sinitg, Sgsave, Serase, Sdone} stage;
- stage = Sbegin;
- gs_opendevice(device);
+ enum {Sbegin, Ssetdevice, Sinitg, Sgsave, Serase, Sdone} stage;
+ stage = Sbegin;
+ gs_opendevice(device);
pxs->interpolate = pxl_get_interpolation(instance);
- /* Set the device into the gstate */
- stage = Ssetdevice;
- if ((code = gs_setdevice_no_erase(pxli->pgs, device)) < 0) /* can't erase yet */
- goto pisdEnd;
+ /* Set the device into the gstate */
+ stage = Ssetdevice;
+ if ((code = gs_setdevice_no_erase(pxli->pgs, device)) < 0) /* can't erase yet */
+ goto pisdEnd;
/* Initialize device ICC profile */
code = gsicc_init_device_profile(pxli->pgs, device);
if (code < 0)
return code;
- /* Init XL graphics */
- stage = Sinitg;
- if ((code = px_initgraphics(pxli->pxs)) < 0)
- goto pisdEnd;
+ /* Init XL graphics */
+ stage = Sinitg;
+ if ((code = px_initgraphics(pxli->pxs)) < 0)
+ goto pisdEnd;
- /* Do inits of gstate that may be reset by setdevice */
- gs_setaccuratecurves(pxli->pgs, true); /* All H-P languages want accurate curves. */
+ /* Do inits of gstate that may be reset by setdevice */
+ gs_setaccuratecurves(pxli->pgs, true); /* All H-P languages want accurate curves. */
/* disable hinting at high res */
if (gs_currentdevice(pxli->pgs)->HWResolution[0] >= 300)
gs_setgridfittt(pxs->font_dir, 0);
+ /* gsave and grestore (among other places) assume that */
+ /* there are at least 2 gstates on the graphics stack. */
+ /* Ensure that now. */
+ stage = Sgsave;
+ if ( (code = gs_gsave(pxli->pgs)) < 0)
+ goto pisdEnd;
- /* gsave and grestore (among other places) assume that */
- /* there are at least 2 gstates on the graphics stack. */
- /* Ensure that now. */
- stage = Sgsave;
- if ( (code = gs_gsave(pxli->pgs)) < 0)
- goto pisdEnd;
-
- stage = Serase;
- if ( (code = gs_erasepage(pxli->pgs)) < 0 )
- goto pisdEnd;
+ stage = Serase;
+ if ( (code = gs_erasepage(pxli->pgs)) < 0 )
+ goto pisdEnd;
- stage = Sdone; /* success */
- /* Unwind any errors */
+ stage = Sdone; /* success */
+ /* Unwind any errors */
pisdEnd:
- switch (stage) {
- case Sdone: /* don't undo success */
- break;
-
- case Serase: /* gs_erasepage failed */
- /* undo gsave */
- gs_grestore_only(pxli->pgs); /* destroys gs_save stack */
- /* fall thru to next */
- case Sgsave: /* gsave failed */
- case Sinitg:
- /* undo setdevice */
- gs_nulldevice(pxli->pgs);
- /* fall thru to next */
-
- case Ssetdevice: /* gs_setdevice failed */
- case Sbegin: /* nothing left to undo */
- break;
- }
- return code;
+ switch (stage) {
+ case Sdone: /* don't undo success */
+ break;
+
+ case Serase: /* gs_erasepage failed */
+ /* undo gsave */
+ gs_grestore_only(pxli->pgs); /* destroys gs_save stack */
+ /* fall thru to next */
+ case Sgsave: /* gsave failed */
+ case Sinitg:
+ /* undo setdevice */
+ gs_nulldevice(pxli->pgs);
+ /* fall thru to next */
+
+ case Ssetdevice: /* gs_setdevice failed */
+ case Sbegin: /* nothing left to undo */
+ break;
+ }
+ return code;
}
-static int
+static int
pxl_impl_get_device_memory(
pl_interp_instance_t *instance, /* interp instance to use */
gs_memory_t **pmem)
@@ -389,175 +385,175 @@ pxl_impl_get_device_memory(
/* Prepare interp instance for the next "job" */
static int /* ret 0 ok, else -ve error code */
pxl_impl_init_job(
- pl_interp_instance_t *instance /* interp instance to start job in */
+ pl_interp_instance_t *instance /* interp instance to start job in */
)
{
- int code = 0;
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- px_reset_errors(pxli->pxs);
- px_process_init(pxli->st, true);
+ int code = 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ px_reset_errors(pxli->pxs);
+ px_process_init(pxli->st, true);
- /* set input status to: expecting stream header */
- px_stream_header_init(&pxli->headerState, pxli->st, pxli->pxs);
- pxli->processState = PSHeader;
+ /* set input status to: expecting stream header */
+ px_stream_header_init(&pxli->headerState, pxli->st, pxli->pxs);
+ pxli->processState = PSHeader;
- return code;
+ return code;
}
/* Parse a cursor-full of data */
static int /* ret 0 or +ve if ok, else -ve error code */
pxl_impl_process(
- pl_interp_instance_t *instance, /* interp instance to process data job in */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to process data job in */
+ stream_cursor_read *cursor /* data to process */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- int code;
-
- /* Process some input */
- switch (pxli->processState)
- {
- case PSDone:
- return e_ExitLanguage;
- case PSHeader: /* Input stream header */
- code = px_stream_header_process(&pxli->headerState, cursor);
- if (code == 0)
- break; /* need more input later */
- else
- /* stream header termination */
- if (code < 0)
- {
- pxli->processState = PSDone;
- return code; /* return error */
- }
- else
- {
- code = 0;
- pxli->processState = PSXL;
- }
- /* fall thru to PSXL */
- case PSXL: /* PCL XL */
- code = px_process(pxli->st, pxli->pxs, cursor);
- if ( code == e_ExitLanguage )
- { pxli->processState = PSDone;
- code = 0;
- }
- else if ( code == errorWarningsReported )
- { /* The parser doesn't skip over the EndSession */
- /* operator, because an "error" occurred. */
- cursor->ptr++;
- }
- else if (code < 0)
- /* Map library error codes to PCL XL codes when possible. */
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ int code;
+
+ /* Process some input */
+ switch (pxli->processState)
+ {
+ case PSDone:
+ return e_ExitLanguage;
+ case PSHeader: /* Input stream header */
+ code = px_stream_header_process(&pxli->headerState, cursor);
+ if (code == 0)
+ break; /* need more input later */
+ else
+ /* stream header termination */
+ if (code < 0)
+ {
+ pxli->processState = PSDone;
+ return code; /* return error */
+ }
+ else
+ {
+ code = 0;
+ pxli->processState = PSXL;
+ }
+ /* fall thru to PSXL */
+ case PSXL: /* PCL XL */
+ code = px_process(pxli->st, pxli->pxs, cursor);
+ if ( code == e_ExitLanguage )
+ { pxli->processState = PSDone;
+ code = 0;
+ }
+ else if ( code == errorWarningsReported )
+ { /* The parser doesn't skip over the EndSession */
+ /* operator, because an "error" occurred. */
+ cursor->ptr++;
+ }
+ else if (code < 0)
+ /* Map library error codes to PCL XL codes when possible. */
switch ( code )
- {
+ {
#define subst(gs_error, px_error)\
case gs_error: code = px_error; break
- subst(gs_error_invalidfont, errorIllegalFontData);
- subst(gs_error_limitcheck, errorInternalOverflow);
- subst(gs_error_nocurrentpoint, errorCurrentCursorUndefined);
- subst(gs_error_rangecheck, errorIllegalAttributeValue);
- subst(gs_error_VMerror, errorInsufficientMemory);
+ subst(gs_error_invalidfont, errorIllegalFontData);
+ subst(gs_error_limitcheck, errorInternalOverflow);
+ subst(gs_error_nocurrentpoint, errorCurrentCursorUndefined);
+ subst(gs_error_rangecheck, errorIllegalAttributeValue);
+ subst(gs_error_VMerror, errorInsufficientMemory);
#undef subst
- }
- break; /* may need more input later */
- }
+ }
+ break; /* may need more input later */
+ }
- return code;
+ return code;
}
/* Skip to end of job ret 1 if done, 0 ok but EOJ not found, else -ve error code */
static int
pxl_impl_flush_to_eoj(
- pl_interp_instance_t *instance, /* interp instance to flush for */
- stream_cursor_read *cursor /* data to process */
+ pl_interp_instance_t *instance, /* interp instance to flush for */
+ stream_cursor_read *cursor /* data to process */
)
{
- const byte *p = cursor->ptr;
- const byte *rlimit = cursor->limit;
-
- /* Skip to, but leave UEL in buffer for PJL to find later */
- for (; p < rlimit; ++p)
- if (p[1] == '\033') {
- uint avail = rlimit - p;
-
- if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
- continue;
- if (avail < 9)
- break;
- cursor->ptr = p;
- return 1; /* found eoj */
- }
- cursor->ptr = p;
- return 0; /* need more */
+ const byte *p = cursor->ptr;
+ const byte *rlimit = cursor->limit;
+
+ /* Skip to, but leave UEL in buffer for PJL to find later */
+ for (; p < rlimit; ++p)
+ if (p[1] == '\033') {
+ uint avail = rlimit - p;
+
+ if (memcmp(p + 1, "\033%-12345X", min(avail, 9)))
+ continue;
+ if (avail < 9)
+ break;
+ cursor->ptr = p;
+ return 1; /* found eoj */
+ }
+ cursor->ptr = p;
+ return 0; /* need more */
}
/* Parser action for end-of-file */
static int /* ret 0 or +ve if ok, else -ve error code */
pxl_impl_process_eof(
- pl_interp_instance_t *instance /* interp instance to process data job in */
+ pl_interp_instance_t *instance /* interp instance to process data job in */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- px_state_cleanup(pxli->pxs);
+ px_state_cleanup(pxli->pxs);
- return 0;
+ return 0;
}
/* Report any errors after running a job */
static int /* ret 0 ok, else -ve error code */
pxl_impl_report_errors(
- pl_interp_instance_t *instance, /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance, /* interp instance to wrap up job in */
int code, /* prev termination status */
long file_position, /* file position of error, -1 if unknown */
bool force_to_cout /* force errors to cout */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- px_parser_state_t *st = pxli->st;
- px_state_t *pxs = pxli->pxs;
- int report = pxs->error_report;
- const char *subsystem =
- (code <= px_error_next ? "KERNEL" : "GRAPHICS");
- char message[px_max_error_line+1];
- int N = 0;
- int y;
-
- if (code >= 0)
- return code; /* not really an error */
- if ( report & eErrorPage )
- y = px_begin_error_page(pxs);
- while ( (N = px_error_message_line(message, N, subsystem,
- code, st, pxs)) >= 0
- )
- { if ( (report & eBackChannel) || force_to_cout )
- errprintf(pxli->memory, message);
- if ( report & eErrorPage )
- y = px_error_page_show(message, y, pxs);
- }
- if ( ((report & pxeErrorReport_next) && file_position != -1L) || force_to_cout )
- errprintf(pxli->memory, "file position of error = %ld\n", file_position);
- if ( report & eErrorPage )
- { px_args_t args;
- args.pv[0] = 0;
- pxEndPage(&args, pxs);
- }
- px_reset_errors(pxs);
-
- return code;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ px_parser_state_t *st = pxli->st;
+ px_state_t *pxs = pxli->pxs;
+ int report = pxs->error_report;
+ const char *subsystem =
+ (code <= px_error_next ? "KERNEL" : "GRAPHICS");
+ char message[px_max_error_line+1];
+ int N = 0;
+ int y;
+
+ if (code >= 0)
+ return code; /* not really an error */
+ if ( report & eErrorPage )
+ y = px_begin_error_page(pxs);
+ while ( (N = px_error_message_line(message, N, subsystem,
+ code, st, pxs)) >= 0
+ )
+ { if ( (report & eBackChannel) || force_to_cout )
+ errprintf(pxli->memory, message);
+ if ( report & eErrorPage )
+ y = px_error_page_show(message, y, pxs);
+ }
+ if ( ((report & pxeErrorReport_next) && file_position != -1L) || force_to_cout )
+ errprintf(pxli->memory, "file position of error = %ld\n", file_position);
+ if ( report & eErrorPage )
+ { px_args_t args;
+ args.pv[0] = 0;
+ pxEndPage(&args, pxs);
+ }
+ px_reset_errors(pxs);
+
+ return code;
}
/* Wrap up interp instance after a "job" */
static int /* ret 0 ok, else -ve error code */
pxl_impl_dnit_job(
- pl_interp_instance_t *instance /* interp instance to wrap up job in */
+ pl_interp_instance_t *instance /* interp instance to wrap up job in */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- px_stream_header_dnit(&pxli->headerState);
- px_state_cleanup(pxli->pxs);
- return 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ px_stream_header_dnit(&pxli->headerState);
+ px_state_cleanup(pxli->pxs);
+ return 0;
}
/* Remove a device from an interperter instance */
@@ -566,18 +562,18 @@ pxl_impl_remove_device(
pl_interp_instance_t *instance /* interp instance to use */
)
{
- int code = 0; /* first error status encountered */
- int error;
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- /* return to original gstate */
- gs_grestore_only(pxli->pgs); /* destroys gs_save stack */
- /* Deselect device */
- /* NB */
- error = gs_nulldevice(pxli->pgs);
- if (code >= 0)
- code = error;
-
- return code;
+ int code = 0; /* first error status encountered */
+ int error;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ /* return to original gstate */
+ gs_grestore_only(pxli->pgs); /* destroys gs_save stack */
+ /* Deselect device */
+ /* NB */
+ error = gs_nulldevice(pxli->pgs);
+ if (code >= 0)
+ code = error;
+
+ return code;
}
/* Deallocate a interpreter instance */
@@ -586,19 +582,19 @@ pxl_impl_deallocate_interp_instance(
pl_interp_instance_t *instance /* instance to dealloc */
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
- gs_memory_t *mem = pxli->memory;
-
- px_dict_release(&pxli->pxs->font_dict);
- px_dict_release(&pxli->pxs->builtin_font_dict);
- /* do total dnit of interp state */
- px_state_finit(pxli->pxs);
- /* free halftone cache */
- gs_state_free(pxli->pgs);
- px_process_release(pxli->st);
- px_state_release(pxli->pxs);
- gs_free_object(mem, pxli, "pxl_impl_deallocate_interp_instance(pxl_interp_instance_t)");
- return 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
+ gs_memory_t *mem = pxli->memory;
+
+ px_dict_release(&pxli->pxs->font_dict);
+ px_dict_release(&pxli->pxs->builtin_font_dict);
+ /* do total dnit of interp state */
+ px_state_finit(pxli->pxs);
+ /* free halftone cache */
+ gs_state_free(pxli->pgs);
+ px_process_release(pxli->st);
+ px_state_release(pxli->pxs);
+ gs_free_object(mem, pxli, "pxl_impl_deallocate_interp_instance(pxl_interp_instance_t)");
+ return 0;
}
/* Do static deinit of PXL interpreter */
@@ -607,11 +603,11 @@ pxl_impl_deallocate_interp(
pl_interp_t *interp /* interpreter to deallocate */
)
{
- /* nothing to do */
- return 0;
+ /* nothing to do */
+ return 0;
}
-/*
+/*
* End-of-page called back by PXL
*/
static int
@@ -621,34 +617,34 @@ pxl_end_page_top(
int flush
)
{
- pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)(pxls->client_data);
- pl_interp_instance_t *instance = (pl_interp_instance_t *)pxli;
- int code = 0;
-
- /* do pre-page action */
- if (pxli->pre_page_action)
- {
- code = pxli->pre_page_action(instance, pxli->pre_page_closure);
- if (code < 0)
- return code;
- if (code != 0)
- return 0; /* code > 0 means abort w/no error */
- }
-
- /* output the page */
- code = gs_output_page(pxli->pgs, num_copies, flush);
- if (code < 0)
- return code;
-
- /* do post-page action */
- if (pxli->post_page_action)
- {
- code = pxli->post_page_action(instance, pxli->post_page_closure);
- if (code < 0)
- return code;
- }
-
- return 0;
+ pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)(pxls->client_data);
+ pl_interp_instance_t *instance = (pl_interp_instance_t *)pxli;
+ int code = 0;
+
+ /* do pre-page action */
+ if (pxli->pre_page_action)
+ {
+ code = pxli->pre_page_action(instance, pxli->pre_page_closure);
+ if (code < 0)
+ return code;
+ if (code != 0)
+ return 0; /* code > 0 means abort w/no error */
+ }
+
+ /* output the page */
+ code = gs_output_page(pxli->pgs, num_copies, flush);
+ if (code < 0)
+ return code;
+
+ /* do post-page action */
+ if (pxli->post_page_action)
+ {
+ code = pxli->post_page_action(instance, pxli->post_page_closure);
+ if (code < 0)
+ return code;
+ }
+
+ return 0;
}
/* Parser implementation descriptor */
@@ -697,9 +693,9 @@ px_top_init(px_parser_state_t *st, px_state_t *pxs, bool big_endian)
v[2].value.i = eErrorPage;
args.pv[2] = &v[2];
{
- int code = pxBeginSession(&args, pxs);
- if ( code < 0 )
- return code;
+ int code = pxBeginSession(&args, pxs);
+ if ( code < 0 )
+ return code;
}
return 0;
}
diff --git a/pxl/pxvalue.c b/pxl/pxvalue.c
index 77f743d15..474b1240f 100644
--- a/pxl/pxvalue.c
+++ b/pxl/pxvalue.c
@@ -30,9 +30,9 @@ sint16at(const byte *p, bool big_endian)
int32_t
uint32at(const byte *p, bool big_endian)
{ return
- (big_endian ?
- ((int32_t)((p[0] << 8) + p[1]) << 16) + (p[2] << 8) + p[3] :
- ((int32_t)((p[3] << 8) + p[2]) << 16) + (p[1] << 8) + p[0]);
+ (big_endian ?
+ ((int32_t)((p[0] << 8) + p[1]) << 16) + (p[2] << 8) + p[3] :
+ ((int32_t)((p[3] << 8) + p[2]) << 16) + (p[1] << 8) + p[0]);
}
int32_t
sint32at(const byte *p, bool big_endian)
@@ -40,7 +40,7 @@ sint32at(const byte *p, bool big_endian)
}
real
real32at(const byte *p, bool big_endian)
-{
+{
union {
float f;
int32_t d;
@@ -55,26 +55,26 @@ real32at(const byte *p, bool big_endian)
int32_t
integer_elt(const px_value_t *pav, uint index)
{ px_data_type_t type = pav->type;
- const byte *base = pav->value.array.data;
- bool big_endian;
+ const byte *base = pav->value.array.data;
+ bool big_endian;
- if ( type & pxd_ubyte )
- return base[index];
- big_endian = (type & pxd_big_endian) != 0;
- if ( type & pxd_uint16 )
- return uint16at(base + (index << 1), big_endian);
- else if ( type & pxd_sint16 )
- return sint16at(base + (index << 1), big_endian);
- else if ( type & pxd_uint32 )
- return uint32at(base + (index << 2), big_endian);
- else /* ( type & pxd_sint32 ) */
- return sint32at(base + (index << 2), big_endian);
+ if ( type & pxd_ubyte )
+ return base[index];
+ big_endian = (type & pxd_big_endian) != 0;
+ if ( type & pxd_uint16 )
+ return uint16at(base + (index << 1), big_endian);
+ else if ( type & pxd_sint16 )
+ return sint16at(base + (index << 1), big_endian);
+ else if ( type & pxd_uint32 )
+ return uint32at(base + (index << 2), big_endian);
+ else /* ( type & pxd_sint32 ) */
+ return sint32at(base + (index << 2), big_endian);
}
real
real_elt(const px_value_t *pav, uint index)
{ return
- (pav->type & pxd_real32 ?
- real32at(pav->value.array.data + (index << 2),
- (pav->type & pxd_big_endian) != 0) :
- (real)integer_elt(pav, index));
+ (pav->type & pxd_real32 ?
+ real32at(pav->value.array.data + (index << 2),
+ (pav->type & pxd_big_endian) != 0) :
+ (real)integer_elt(pav, index));
}
diff --git a/pxl/pxvalue.h b/pxl/pxvalue.h
index 3d5a6bbb1..15d826f8b 100644
--- a/pxl/pxvalue.h
+++ b/pxl/pxvalue.h
@@ -74,10 +74,10 @@ typedef struct {
const px_value_t *pv_ = (pv);\
if ( pv_->type & pxd_any_real )\
x1 = pv_->value.ra[0], y1 = pv_->value.ra[1],\
- x2 = pv_->value.ra[2], y2 = pv_->value.ra[3];\
+ x2 = pv_->value.ra[2], y2 = pv_->value.ra[3];\
else\
x1 = pv_->value.ia[0], y1 = pv_->value.ia[1],\
- x2 = pv_->value.ia[2], y2 = pv_->value.ia[3];\
+ x2 = pv_->value.ia[2], y2 = pv_->value.ia[3];\
} while ( 0 )
#define value_size(pv)\
diff --git a/svg/ghostsvg.h b/svg/ghostsvg.h
index 5460314ac..369f7e217 100644
--- a/svg/ghostsvg.h
+++ b/svg/ghostsvg.h
@@ -203,4 +203,3 @@ struct svg_context_s
const char *error;
void *parser; /* Expat XML_Parser */
};
-
diff --git a/svg/svgcolor.c b/svg/svgcolor.c
index fefeb721c..d56c5d7fc 100644
--- a/svg/svgcolor.c
+++ b/svg/svgcolor.c
@@ -77,61 +77,61 @@ svg_parse_color(char *str, float *rgb)
if (str[0] == '#')
{
- str ++;
-
- if (strlen(str) == 3)
- {
- rgb[0] = (unhex(str[0]) * 16 + unhex(str[0])) / 255.0;
- rgb[1] = (unhex(str[1]) * 16 + unhex(str[1])) / 255.0;
- rgb[2] = (unhex(str[2]) * 16 + unhex(str[2])) / 255.0;
- return 0;
- }
-
- if (strlen(str) == 6)
- {
- rgb[0] = (unhex(str[0]) * 16 + unhex(str[1])) / 255.0;
- rgb[1] = (unhex(str[2]) * 16 + unhex(str[3])) / 255.0;
- rgb[2] = (unhex(str[4]) * 16 + unhex(str[5])) / 255.0;
- return 0;
- }
-
- return gs_throw(-1, "syntax error in color - wrong length of string after #");
+ str ++;
+
+ if (strlen(str) == 3)
+ {
+ rgb[0] = (unhex(str[0]) * 16 + unhex(str[0])) / 255.0;
+ rgb[1] = (unhex(str[1]) * 16 + unhex(str[1])) / 255.0;
+ rgb[2] = (unhex(str[2]) * 16 + unhex(str[2])) / 255.0;
+ return 0;
+ }
+
+ if (strlen(str) == 6)
+ {
+ rgb[0] = (unhex(str[0]) * 16 + unhex(str[1])) / 255.0;
+ rgb[1] = (unhex(str[2]) * 16 + unhex(str[3])) / 255.0;
+ rgb[2] = (unhex(str[4]) * 16 + unhex(str[5])) / 255.0;
+ return 0;
+ }
+
+ return gs_throw(-1, "syntax error in color - wrong length of string after #");
}
/* rgb(X,Y,Z) -- whitespace allowed around numbers */
else if (strstr(str, "rgb("))
{
- int numberlen = 0;
- char numberbuf[50];
-
- str = str + 4;
-
- for (i = 0; i < 3; i++)
- {
- while (svg_is_whitespace_or_comma(*str))
- str ++;
-
- if (svg_is_digit(*str))
- {
- numberlen = 0;
- while (svg_is_digit(*str) && numberlen < sizeof(numberbuf) - 1)
- numberbuf[numberlen++] = *str++;
- numberbuf[numberlen] = 0;
-
- if (*str == '%')
- {
- str ++;
- rgb[i] = atof(numberbuf) / 100.0;
- }
- else
- {
- rgb[i] = atof(numberbuf) / 255.0;
- }
- }
- }
-
- return 0;
+ int numberlen = 0;
+ char numberbuf[50];
+
+ str = str + 4;
+
+ for (i = 0; i < 3; i++)
+ {
+ while (svg_is_whitespace_or_comma(*str))
+ str ++;
+
+ if (svg_is_digit(*str))
+ {
+ numberlen = 0;
+ while (svg_is_digit(*str) && numberlen < sizeof(numberbuf) - 1)
+ numberbuf[numberlen++] = *str++;
+ numberbuf[numberlen] = 0;
+
+ if (*str == '%')
+ {
+ str ++;
+ rgb[i] = atof(numberbuf) / 100.0;
+ }
+ else
+ {
+ rgb[i] = atof(numberbuf) / 255.0;
+ }
+ }
+ }
+
+ return 0;
}
/* TODO: parse icc-profile(X,Y,Z,W) syntax */
@@ -140,27 +140,26 @@ svg_parse_color(char *str, float *rgb)
else
{
- l = 0;
- r = sizeof(svg_predefined_colors) / sizeof(svg_predefined_colors[0]);
-
- while (l <= r)
- {
- m = (l + r) / 2;
- cmp = strcmp(svg_predefined_colors[m].name, str);
- if (cmp > 0)
- r = m - 1;
- else if (cmp < 0)
- l = m + 1;
- else
- {
- rgb[0] = svg_predefined_colors[m].red;
- rgb[1] = svg_predefined_colors[m].green;
- rgb[2] = svg_predefined_colors[m].blue;
- return 0;
- }
- }
+ l = 0;
+ r = sizeof(svg_predefined_colors) / sizeof(svg_predefined_colors[0]);
+
+ while (l <= r)
+ {
+ m = (l + r) / 2;
+ cmp = strcmp(svg_predefined_colors[m].name, str);
+ if (cmp > 0)
+ r = m - 1;
+ else if (cmp < 0)
+ l = m + 1;
+ else
+ {
+ rgb[0] = svg_predefined_colors[m].red;
+ rgb[1] = svg_predefined_colors[m].green;
+ rgb[2] = svg_predefined_colors[m].blue;
+ return 0;
+ }
+ }
}
return gs_throw1(-1, "cannot recognize color syntax: '%s'", str);
}
-
diff --git a/svg/svgdoc.c b/svg/svgdoc.c
index 16eeac8f5..fc058e74a 100644
--- a/svg/svgdoc.c
+++ b/svg/svgdoc.c
@@ -31,99 +31,99 @@ svg_parse_common(svg_context_t *ctx, svg_item_t *node)
if (fill_att)
{
- if (!strcmp(fill_att, "none"))
- {
- ctx->fill_is_set = 0;
- }
- else
- {
- ctx->fill_is_set = 1;
- code = svg_parse_color(fill_att, ctx->fill_color);
- if (code < 0)
- return gs_rethrow(code, "cannot parse fill attribute");
- }
+ if (!strcmp(fill_att, "none"))
+ {
+ ctx->fill_is_set = 0;
+ }
+ else
+ {
+ ctx->fill_is_set = 1;
+ code = svg_parse_color(fill_att, ctx->fill_color);
+ if (code < 0)
+ return gs_rethrow(code, "cannot parse fill attribute");
+ }
}
if (stroke_att)
{
- if (!strcmp(stroke_att, "none"))
- {
- ctx->stroke_is_set = 0;
- }
- else
- {
- ctx->stroke_is_set = 1;
- code = svg_parse_color(stroke_att, ctx->stroke_color);
- if (code < 0)
- return gs_rethrow(code, "cannot parse stroke attribute");
- }
+ if (!strcmp(stroke_att, "none"))
+ {
+ ctx->stroke_is_set = 0;
+ }
+ else
+ {
+ ctx->stroke_is_set = 1;
+ code = svg_parse_color(stroke_att, ctx->stroke_color);
+ if (code < 0)
+ return gs_rethrow(code, "cannot parse stroke attribute");
+ }
}
if (transform_att)
{
- code = svg_parse_transform(ctx, transform_att);
- if (code < 0)
- return gs_rethrow(code, "cannot parse transform attribute");
+ code = svg_parse_transform(ctx, transform_att);
+ if (code < 0)
+ return gs_rethrow(code, "cannot parse transform attribute");
}
if (fill_rule_att)
{
- if (!strcmp(fill_rule_att, "nonzero"))
- ctx->fill_rule = 1;
- if (!strcmp(fill_rule_att, "evenodd"))
- ctx->fill_rule = 0;
+ if (!strcmp(fill_rule_att, "nonzero"))
+ ctx->fill_rule = 1;
+ if (!strcmp(fill_rule_att, "evenodd"))
+ ctx->fill_rule = 0;
}
if (stroke_width_att)
{
- if (!strcmp(stroke_width_att, "inherit"))
- ;
- else
- gs_setlinewidth(ctx->pgs, svg_parse_length(stroke_width_att, ctx->viewbox_size, 12));
+ if (!strcmp(stroke_width_att, "inherit"))
+ ;
+ else
+ gs_setlinewidth(ctx->pgs, svg_parse_length(stroke_width_att, ctx->viewbox_size, 12));
}
else
{
- gs_setlinewidth(ctx->pgs, 1);
+ gs_setlinewidth(ctx->pgs, 1);
}
if (stroke_linecap_att)
{
- if (!strcmp(stroke_linecap_att, "butt"))
- gs_setlinecap(ctx->pgs, gs_cap_butt);
- if (!strcmp(stroke_linecap_att, "round"))
- gs_setlinecap(ctx->pgs, gs_cap_round);
- if (!strcmp(stroke_linecap_att, "square"))
- gs_setlinecap(ctx->pgs, gs_cap_square);
+ if (!strcmp(stroke_linecap_att, "butt"))
+ gs_setlinecap(ctx->pgs, gs_cap_butt);
+ if (!strcmp(stroke_linecap_att, "round"))
+ gs_setlinecap(ctx->pgs, gs_cap_round);
+ if (!strcmp(stroke_linecap_att, "square"))
+ gs_setlinecap(ctx->pgs, gs_cap_square);
}
else
{
- gs_setlinecap(ctx->pgs, gs_cap_butt);
+ gs_setlinecap(ctx->pgs, gs_cap_butt);
}
if (stroke_linejoin_att)
{
- if (!strcmp(stroke_linejoin_att, "miter"))
- gs_setlinejoin(ctx->pgs, gs_join_miter);
- if (!strcmp(stroke_linejoin_att, "round"))
- gs_setlinejoin(ctx->pgs, gs_join_round);
- if (!strcmp(stroke_linejoin_att, "bevel"))
- gs_setlinejoin(ctx->pgs, gs_join_bevel);
+ if (!strcmp(stroke_linejoin_att, "miter"))
+ gs_setlinejoin(ctx->pgs, gs_join_miter);
+ if (!strcmp(stroke_linejoin_att, "round"))
+ gs_setlinejoin(ctx->pgs, gs_join_round);
+ if (!strcmp(stroke_linejoin_att, "bevel"))
+ gs_setlinejoin(ctx->pgs, gs_join_bevel);
}
else
{
- gs_setlinejoin(ctx->pgs, gs_join_miter);
+ gs_setlinejoin(ctx->pgs, gs_join_miter);
}
if (stroke_miterlimit_att)
{
- if (!strcmp(stroke_miterlimit_att, "inherit"))
- ;
- else
- gs_setmiterlimit(ctx->pgs, svg_parse_length(stroke_miterlimit_att, ctx->viewbox_size, 12));
+ if (!strcmp(stroke_miterlimit_att, "inherit"))
+ ;
+ else
+ gs_setmiterlimit(ctx->pgs, svg_parse_length(stroke_miterlimit_att, ctx->viewbox_size, 12));
}
else
{
- gs_setmiterlimit(ctx->pgs, 4.0);
+ gs_setmiterlimit(ctx->pgs, 4.0);
}
return 0;
@@ -142,9 +142,9 @@ svg_parse_g(svg_context_t *ctx, svg_item_t *root)
for (node = svg_down(root); node; node = svg_next(node))
{
- code = svg_parse_element(ctx, node);
- if (code < 0)
- return gs_rethrow(code, "cannot parse <g> element");
+ code = svg_parse_element(ctx, node);
+ if (code < 0)
+ return gs_rethrow(code, "cannot parse <g> element");
}
gs_setmatrix(ctx->pgs, &mtx);
@@ -159,60 +159,60 @@ svg_parse_element(svg_context_t *ctx, svg_item_t *root)
int code;
if (!strcmp(tag, "g"))
- code = svg_parse_g(ctx, root);
+ code = svg_parse_g(ctx, root);
else if (!strcmp(tag, "title"))
- return 0;
+ return 0;
else if (!strcmp(tag, "desc"))
- return 0;
+ return 0;
#if 0
else if (!strcmp(tag, "defs"))
- code = svg_parse_defs(ctx, root);
+ code = svg_parse_defs(ctx, root);
else if (!strcmp(tag, "symbol"))
- code = svg_parse_symbol(ctx, root);
+ code = svg_parse_symbol(ctx, root);
else if (!strcmp(tag, "use"))
- code = svg_parse_use(ctx, root);
+ code = svg_parse_use(ctx, root);
else if (!strcmp(tag, "image"))
- code = svg_parse_image(ctx, root);
+ code = svg_parse_image(ctx, root);
#endif
else if (!strcmp(tag, "path"))
- code = svg_parse_path(ctx, root);
+ code = svg_parse_path(ctx, root);
else if (!strcmp(tag, "rect"))
- code = svg_parse_rect(ctx, root);
+ code = svg_parse_rect(ctx, root);
else if (!strcmp(tag, "circle"))
- code = svg_parse_circle(ctx, root);
+ code = svg_parse_circle(ctx, root);
else if (!strcmp(tag, "ellipse"))
- code = svg_parse_ellipse(ctx, root);
+ code = svg_parse_ellipse(ctx, root);
else if (!strcmp(tag, "line"))
- code = svg_parse_line(ctx, root);
+ code = svg_parse_line(ctx, root);
else if (!strcmp(tag, "polyline"))
- code = svg_parse_polyline(ctx, root);
+ code = svg_parse_polyline(ctx, root);
else if (!strcmp(tag, "polygon"))
- code = svg_parse_polygon(ctx, root);
+ code = svg_parse_polygon(ctx, root);
#if 0
else if (!strcmp(tag, "text"))
- code = svg_parse_text(ctx, root);
+ code = svg_parse_text(ctx, root);
else if (!strcmp(tag, "tspan"))
- code = svg_parse_text_span(ctx, root);
+ code = svg_parse_text_span(ctx, root);
else if (!strcmp(tag, "tref"))
- code = svg_parse_text_ref(ctx, root);
+ code = svg_parse_text_ref(ctx, root);
else if (!strcmp(tag, "textPath"))
- code = svg_parse_text_path(ctx, root);
+ code = svg_parse_text_path(ctx, root);
#endif
else
{
- /* debug print unrecognized tags */
- code = 0;
- svg_debug_item(root, 0);
+ /* debug print unrecognized tags */
+ code = 0;
+ svg_debug_item(root, 0);
}
if (code < 0)
- return gs_rethrow(code, "cannot parse svg element");
+ return gs_rethrow(code, "cannot parse svg element");
return 0;
}
@@ -239,7 +239,7 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root)
float vb_height = 842;
if (strcmp(svg_tag(root), "svg"))
- return gs_throw1(-1, "expected svg element (found %s)", svg_tag(root));
+ return gs_throw1(-1, "expected svg element (found %s)", svg_tag(root));
version_att = svg_att(root, "version");
width_att = svg_att(root, "width");
@@ -248,72 +248,72 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root)
version = 10;
if (version_att)
- version = atof(version_att) * 10;
+ version = atof(version_att) * 10;
if (view_box_att)
{
- sscanf(view_box_att, "%g %g %g %g",
- &vb_min_x, &vb_min_y,
- &vb_width, &vb_height);
+ sscanf(view_box_att, "%g %g %g %g",
+ &vb_min_x, &vb_min_y,
+ &vb_width, &vb_height);
}
width = vb_width;
if (!width_att)
- width = svg_parse_length(width_att, vb_width, 12);
+ width = svg_parse_length(width_att, vb_width, 12);
height = vb_height;
if (!height_att)
- height = svg_parse_length(height_att, vb_height, 12);
+ height = svg_parse_length(height_att, vb_height, 12);
if (version > 12)
- gs_warn("svg document version is newer than we support");
+ gs_warn("svg document version is newer than we support");
/* Setup new page */
{
- gs_memory_t *mem = ctx->memory;
- gs_state *pgs = ctx->pgs;
- gx_device *dev = gs_currentdevice(pgs);
- gs_param_float_array fa;
- float fv[2];
- gs_c_param_list list;
- int code;
-
- gs_c_param_list_write(&list, mem);
-
- fv[0] = width;
- fv[1] = height;
- fa.persistent = false;
- fa.data = fv;
- fa.size = 2;
-
- code = param_write_float_array((gs_param_list *)&list, ".MediaSize", &fa);
- if ( code >= 0 )
- {
- gs_c_param_list_read(&list);
- code = gs_putdeviceparams(dev, (gs_param_list *)&list);
- }
- gs_c_param_list_release(&list);
-
- /* nb this is for the demo it is wrong and should be removed */
- gs_initgraphics(pgs);
-
- /* put the origin at the top of the page */
-
- gs_initmatrix(pgs);
-
- code = gs_scale(pgs, 1.0, -1.0);
- if (code < 0)
- return gs_rethrow(code, "cannot set page transform");
-
- code = gs_translate(pgs, 0.0, -height);
- if (code < 0)
- return gs_rethrow(code, "cannot set page transform");
-
- code = gs_erasepage(pgs);
- if (code < 0)
- return gs_rethrow(code, "cannot clear page");
-
- gs_setcolorspace(ctx->pgs, ctx->srgb);
+ gs_memory_t *mem = ctx->memory;
+ gs_state *pgs = ctx->pgs;
+ gx_device *dev = gs_currentdevice(pgs);
+ gs_param_float_array fa;
+ float fv[2];
+ gs_c_param_list list;
+ int code;
+
+ gs_c_param_list_write(&list, mem);
+
+ fv[0] = width;
+ fv[1] = height;
+ fa.persistent = false;
+ fa.data = fv;
+ fa.size = 2;
+
+ code = param_write_float_array((gs_param_list *)&list, ".MediaSize", &fa);
+ if ( code >= 0 )
+ {
+ gs_c_param_list_read(&list);
+ code = gs_putdeviceparams(dev, (gs_param_list *)&list);
+ }
+ gs_c_param_list_release(&list);
+
+ /* nb this is for the demo it is wrong and should be removed */
+ gs_initgraphics(pgs);
+
+ /* put the origin at the top of the page */
+
+ gs_initmatrix(pgs);
+
+ code = gs_scale(pgs, 1.0, -1.0);
+ if (code < 0)
+ return gs_rethrow(code, "cannot set page transform");
+
+ code = gs_translate(pgs, 0.0, -height);
+ if (code < 0)
+ return gs_rethrow(code, "cannot set page transform");
+
+ code = gs_erasepage(pgs);
+ if (code < 0)
+ return gs_rethrow(code, "cannot clear page");
+
+ gs_setcolorspace(ctx->pgs, ctx->srgb);
}
/* Need viewbox dimensions for percentage based units */
@@ -326,32 +326,32 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root)
if (use_transparency)
{
- code = gs_push_pdf14trans_device(ctx->pgs);
- if (code < 0)
- return gs_rethrow(code, "cannot install transparency device");
+ code = gs_push_pdf14trans_device(ctx->pgs);
+ if (code < 0)
+ return gs_rethrow(code, "cannot install transparency device");
}
/* Draw contents */
for (node = svg_down(root); node; node = svg_next(node))
{
- code = svg_parse_element(ctx, node);
- if (code < 0)
- break;
+ code = svg_parse_element(ctx, node);
+ if (code < 0)
+ break;
}
if (use_transparency)
{
- code = gs_pop_pdf14trans_device(ctx->pgs);
- if (code < 0)
- return gs_rethrow(code, "cannot uninstall transparency device");
+ code = gs_pop_pdf14trans_device(ctx->pgs);
+ if (code < 0)
+ return gs_rethrow(code, "cannot uninstall transparency device");
}
/* Flush page */
{
- code = svg_show_page(ctx, 1, true); /* copies, flush */
- if (code < 0)
- return gs_rethrow(code, "cannot flush page");
+ code = svg_show_page(ctx, 1, true); /* copies, flush */
+ if (code < 0)
+ return gs_rethrow(code, "cannot flush page");
}
/* restore the original device, discarding the pdf14 compositor */
@@ -359,4 +359,3 @@ svg_parse_document(svg_context_t *ctx, svg_item_t *root)
return 0;
}
-
diff --git a/svg/svgshapes.c b/svg/svgshapes.c
index 0c4d2b45b..a3f7d5f48 100644
--- a/svg/svgshapes.c
+++ b/svg/svgshapes.c
@@ -19,9 +19,9 @@ static void svg_fill(svg_context_t *ctx)
{
svg_set_fill_color(ctx);
if (ctx->fill_rule == 0)
- gs_eofill(ctx->pgs);
+ gs_eofill(ctx->pgs);
else
- gs_fill(ctx->pgs);
+ gs_fill(ctx->pgs);
}
static void svg_stroke(svg_context_t *ctx)
@@ -58,37 +58,37 @@ svg_parse_rect(svg_context_t *ctx, svg_item_t *node)
if (ry_att) ry = svg_parse_length(ry_att, ctx->viewbox_height, 12);
if (rx_att && !ry_att)
- ry = rx;
+ ry = rx;
if (ry_att && !rx_att)
- rx = ry;
+ rx = ry;
if (rx > w * 0.5)
- rx = w * 0.5;
+ rx = w * 0.5;
if (ry > h * 0.5)
- ry = h * 0.5;
+ ry = h * 0.5;
if (w <= 0 || h <= 0)
- return 0;
+ return 0;
/* TODO: we need elliptical arcs to draw rounded corners */
if (ctx->fill_is_set)
{
- gs_moveto(ctx->pgs, x, y);
- gs_lineto(ctx->pgs, x + w, y);
- gs_lineto(ctx->pgs, x + w, y + h);
- gs_lineto(ctx->pgs, x, y + h);
- gs_closepath(ctx->pgs);
- svg_fill(ctx);
+ gs_moveto(ctx->pgs, x, y);
+ gs_lineto(ctx->pgs, x + w, y);
+ gs_lineto(ctx->pgs, x + w, y + h);
+ gs_lineto(ctx->pgs, x, y + h);
+ gs_closepath(ctx->pgs);
+ svg_fill(ctx);
}
if (ctx->stroke_is_set)
{
- gs_moveto(ctx->pgs, x, y);
- gs_lineto(ctx->pgs, x + w, y);
- gs_lineto(ctx->pgs, x + w, y + h);
- gs_lineto(ctx->pgs, x, y + h);
- gs_closepath(ctx->pgs);
- svg_stroke(ctx);
+ gs_moveto(ctx->pgs, x, y);
+ gs_lineto(ctx->pgs, x + w, y);
+ gs_lineto(ctx->pgs, x + w, y + h);
+ gs_lineto(ctx->pgs, x, y + h);
+ gs_closepath(ctx->pgs);
+ svg_stroke(ctx);
}
return 0;
@@ -112,28 +112,28 @@ svg_parse_circle(svg_context_t *ctx, svg_item_t *node)
if (r_att) r = svg_parse_length(r_att, ctx->viewbox_size, 12);
if (r <= 0)
- return 0;
+ return 0;
if (ctx->fill_is_set)
{
- gs_moveto(ctx->pgs, cx + r, cy);
- gs_arcn(ctx->pgs, cx, cy, r, 0, 90);
- gs_arcn(ctx->pgs, cx, cy, r, 90, 180);
- gs_arcn(ctx->pgs, cx, cy, r, 180, 270);
- gs_arcn(ctx->pgs, cx, cy, r, 270, 360);
- gs_closepath(ctx->pgs);
- svg_fill(ctx);
+ gs_moveto(ctx->pgs, cx + r, cy);
+ gs_arcn(ctx->pgs, cx, cy, r, 0, 90);
+ gs_arcn(ctx->pgs, cx, cy, r, 90, 180);
+ gs_arcn(ctx->pgs, cx, cy, r, 180, 270);
+ gs_arcn(ctx->pgs, cx, cy, r, 270, 360);
+ gs_closepath(ctx->pgs);
+ svg_fill(ctx);
}
if (ctx->stroke_is_set)
{
- gs_moveto(ctx->pgs, cx + r, cy);
- gs_arcn(ctx->pgs, cx, cy, r, 0, 90);
- gs_arcn(ctx->pgs, cx, cy, r, 90, 180);
- gs_arcn(ctx->pgs, cx, cy, r, 180, 270);
- gs_arcn(ctx->pgs, cx, cy, r, 270, 360);
- gs_closepath(ctx->pgs);
- svg_stroke(ctx);
+ gs_moveto(ctx->pgs, cx + r, cy);
+ gs_arcn(ctx->pgs, cx, cy, r, 0, 90);
+ gs_arcn(ctx->pgs, cx, cy, r, 90, 180);
+ gs_arcn(ctx->pgs, cx, cy, r, 180, 270);
+ gs_arcn(ctx->pgs, cx, cy, r, 270, 360);
+ gs_closepath(ctx->pgs);
+ svg_stroke(ctx);
}
return 0;
@@ -160,19 +160,19 @@ svg_parse_ellipse(svg_context_t *ctx, svg_item_t *node)
if (ry_att) ry = svg_parse_length(ry_att, ctx->viewbox_height, 12);
if (rx <= 0 || ry <= 0)
- return 0;
+ return 0;
/* TODO: we need elliptic arcs */
#if 0
if (ctx->fill_is_set)
{
- svg_fill(ctx);
+ svg_fill(ctx);
}
if (ctx->stroke_is_set)
{
- svg_stroke(ctx);
+ svg_stroke(ctx);
}
#endif
@@ -201,10 +201,10 @@ svg_parse_line(svg_context_t *ctx, svg_item_t *node)
if (ctx->stroke_is_set)
{
- gs_moveto(ctx->pgs, x1, y1);
- gs_lineto(ctx->pgs, x2, y2);
+ gs_moveto(ctx->pgs, x1, y1);
+ gs_lineto(ctx->pgs, x2, y2);
- svg_stroke(ctx);
+ svg_stroke(ctx);
}
return 0;
@@ -221,38 +221,38 @@ svg_parse_polygon_imp(svg_context_t *ctx, svg_item_t *node, int doclose)
int isfirst;
if (!str)
- return 0;
+ return 0;
isfirst = 1;
nargs = 0;
while (*str)
{
- while (svg_is_whitespace_or_comma(*str))
- str ++;
-
- if (svg_is_digit(*str))
- {
- numberlen = 0;
- while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
- number[numberlen++] = *str++;
- number[numberlen] = 0;
- args[nargs++] = atof(number);
- }
-
- if (nargs == 2)
- {
- if (isfirst)
- {
- gs_moveto(ctx->pgs, args[0], args[1]);
- isfirst = 0;
- }
- else
- {
- gs_lineto(ctx->pgs, args[0], args[1]);
- }
- nargs = 0;
- }
+ while (svg_is_whitespace_or_comma(*str))
+ str ++;
+
+ if (svg_is_digit(*str))
+ {
+ numberlen = 0;
+ while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
+ number[numberlen++] = *str++;
+ number[numberlen] = 0;
+ args[nargs++] = atof(number);
+ }
+
+ if (nargs == 2)
+ {
+ if (isfirst)
+ {
+ gs_moveto(ctx->pgs, args[0], args[1]);
+ isfirst = 0;
+ }
+ else
+ {
+ gs_lineto(ctx->pgs, args[0], args[1]);
+ }
+ nargs = 0;
+ }
}
return 0;
@@ -265,8 +265,8 @@ svg_parse_polyline(svg_context_t *ctx, svg_item_t *node)
if (ctx->stroke_is_set)
{
- svg_parse_polygon_imp(ctx, node, 0);
- svg_stroke(ctx);
+ svg_parse_polygon_imp(ctx, node, 0);
+ svg_stroke(ctx);
}
return 0;
@@ -279,14 +279,14 @@ svg_parse_polygon(svg_context_t *ctx, svg_item_t *node)
if (ctx->fill_is_set)
{
- svg_parse_polygon_imp(ctx, node, 1);
- svg_fill(ctx);
+ svg_parse_polygon_imp(ctx, node, 1);
+ svg_fill(ctx);
}
if (ctx->stroke_is_set)
{
- svg_parse_polygon_imp(ctx, node, 1);
- svg_stroke(ctx);
+ svg_parse_polygon_imp(ctx, node, 1);
+ svg_stroke(ctx);
}
return 0;
@@ -316,264 +316,263 @@ svg_parse_path_data(svg_context_t *ctx, char *str)
while (*str)
{
- while (svg_is_whitespace_or_comma(*str))
- str ++;
-
- if (svg_is_digit(*str))
- {
- numberlen = 0;
- while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
- number[numberlen++] = *str++;
- number[numberlen] = 0;
- if (nargs == 6)
- return gs_throw(-1, "stack overflow in path data");
- args[nargs++] = atof(number);
- }
- else if (svg_is_alpha(*str))
- {
- cmd = *str++;
- }
- else if (*str == 0)
- {
- return 0;
- }
- else
- {
- return gs_throw1(-1, "syntax error in path data: '%c'", *str);
- }
-
- if (reset_smooth)
- {
- smooth_x = 0.0;
- smooth_y = 0.0;
- }
-
- reset_smooth = 1;
-
- switch (cmd)
- {
- case 'M':
- if (nargs == 2)
- {
- // dprintf2("moveto %g %g\n", args[0], args[1]);
- gs_moveto(ctx->pgs, args[0], args[1]);
- nargs = 0;
- cmd = 'L'; /* implicit lineto after */
- }
- break;
-
- case 'm':
- if (nargs == 2)
- {
- // dprintf2("rmoveto %g %g\n", args[0], args[1]);
- gs_rmoveto(ctx->pgs, args[0], args[1]);
- nargs = 0;
- cmd = 'l'; /* implicit lineto after */
- }
- break;
-
-
- case 'Z':
- case 'z':
- if (nargs == 0)
- {
- // dprintf("closepath\n");
- gs_closepath(ctx->pgs);
- }
- break;
-
- case 'L':
- if (nargs == 2)
- {
- // dprintf2("lineto %g %g\n", args[0], args[1]);
- gs_lineto(ctx->pgs, args[0], args[1]);
- nargs = 0;
- }
- break;
-
- case 'l':
- if (nargs == 2)
- {
- // dprintf2("rlineto %g %g\n", args[0], args[1]);
- gs_rlineto(ctx->pgs, args[0], args[1]);
- nargs = 0;
- }
- break;
-
- case 'H':
- if (nargs == 1)
- {
- gs_currentpoint(ctx->pgs, &pt);
- // dprintf1("hlineto %g\n", args[0]);
- gs_lineto(ctx->pgs, args[0], pt.y);
- nargs = 0;
- }
- break;
-
- case 'h':
- if (nargs == 1)
- {
- // dprintf1("rhlineto %g\n", args[0]);
- gs_rlineto(ctx->pgs, args[0], 0.0);
- nargs = 0;
- }
- break;
-
- case 'V':
- if (nargs == 1)
- {
- gs_currentpoint(ctx->pgs, &pt);
- // dprintf1("vlineto %g\n", args[0]);
- gs_lineto(ctx->pgs, pt.x, args[0]);
- nargs = 0;
- }
- break;
-
- case 'v':
- if (nargs == 1)
- {
- // dprintf1("rvlineto %g\n", args[0]);
- gs_rlineto(ctx->pgs, 0.0, args[0]);
- nargs = 0;
- }
- break;
-
- case 'C':
- reset_smooth = 0;
- if (nargs == 6)
- {
- gs_curveto(ctx->pgs, args[0], args[1], args[2], args[3], args[4], args[5]);
- smooth_x = args[4] - args[2];
- smooth_y = args[5] - args[3];
- nargs = 0;
- }
- break;
-
- case 'c':
- reset_smooth = 0;
- if (nargs == 6)
- {
- gs_rcurveto(ctx->pgs, args[0], args[1], args[2], args[3], args[4], args[5]);
- smooth_x = args[4] - args[2];
- smooth_y = args[5] - args[3];
- nargs = 0;
- }
- break;
-
- case 'S':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- gs_curveto(ctx->pgs,
- pt.x + smooth_x, pt.y + smooth_y,
- args[0], args[1],
- args[2], args[3]);
- smooth_x = args[2] - args[0];
- smooth_y = args[3] - args[1];
- nargs = 0;
- }
- break;
-
- case 's':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- gs_curveto(ctx->pgs,
- pt.x + smooth_x, pt.y + smooth_y,
- pt.x + args[0], pt.y + args[1],
- pt.x + args[2], pt.y + args[3]);
- smooth_x = args[2] - args[0];
- smooth_y = args[3] - args[1];
- nargs = 0;
- }
- break;
-
- case 'Q':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- x1 = args[0];
- y1 = args[1];
- x2 = args[2];
- y2 = args[3];
- gs_curveto(ctx->pgs,
- (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
- (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
- x2, y2);
- smooth_x = x2 - x1;
- smooth_y = y2 - y1;
- nargs = 0;
- }
- break;
-
- case 'q':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- x1 = args[0] + pt.x;
- y1 = args[1] + pt.y;
- x2 = args[2] + pt.x;
- y2 = args[3] + pt.y;
- gs_curveto(ctx->pgs,
- (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
- (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
- x2, y2);
- smooth_x = x2 - x1;
- smooth_y = y2 - y1;
- nargs = 0;
- }
- break;
-
- case 'T':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- x1 = pt.x + smooth_x;
- y1 = pt.y + smooth_y;
- x2 = args[0];
- y2 = args[1];
- gs_curveto(ctx->pgs,
- (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
- (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
- x2, y2);
- smooth_x = x2 - x1;
- smooth_y = y2 - y1;
- nargs = 0;
- }
- break;
-
- case 't':
- reset_smooth = 0;
- if (nargs == 4)
- {
- gs_currentpoint(ctx->pgs, &pt);
- x1 = pt.x + smooth_x;
- y1 = pt.y + smooth_y;
- x2 = args[0] + pt.x;
- y2 = args[1] + pt.y;
- gs_curveto(ctx->pgs,
- (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
- (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
- x2, y2);
- smooth_x = x2 - x1;
- smooth_y = y2 - y1;
- nargs = 0;
- }
- break;
-
- case 0:
- if (nargs != 0)
- return gs_throw(-1, "path data must begin with a command");
- break;
-
- default:
- return gs_throw1(-1, "unrecognized command in path data: '%c'", cmd);
- }
+ while (svg_is_whitespace_or_comma(*str))
+ str ++;
+
+ if (svg_is_digit(*str))
+ {
+ numberlen = 0;
+ while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
+ number[numberlen++] = *str++;
+ number[numberlen] = 0;
+ if (nargs == 6)
+ return gs_throw(-1, "stack overflow in path data");
+ args[nargs++] = atof(number);
+ }
+ else if (svg_is_alpha(*str))
+ {
+ cmd = *str++;
+ }
+ else if (*str == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return gs_throw1(-1, "syntax error in path data: '%c'", *str);
+ }
+
+ if (reset_smooth)
+ {
+ smooth_x = 0.0;
+ smooth_y = 0.0;
+ }
+
+ reset_smooth = 1;
+
+ switch (cmd)
+ {
+ case 'M':
+ if (nargs == 2)
+ {
+ // dprintf2("moveto %g %g\n", args[0], args[1]);
+ gs_moveto(ctx->pgs, args[0], args[1]);
+ nargs = 0;
+ cmd = 'L'; /* implicit lineto after */
+ }
+ break;
+
+ case 'm':
+ if (nargs == 2)
+ {
+ // dprintf2("rmoveto %g %g\n", args[0], args[1]);
+ gs_rmoveto(ctx->pgs, args[0], args[1]);
+ nargs = 0;
+ cmd = 'l'; /* implicit lineto after */
+ }
+ break;
+
+ case 'Z':
+ case 'z':
+ if (nargs == 0)
+ {
+ // dprintf("closepath\n");
+ gs_closepath(ctx->pgs);
+ }
+ break;
+
+ case 'L':
+ if (nargs == 2)
+ {
+ // dprintf2("lineto %g %g\n", args[0], args[1]);
+ gs_lineto(ctx->pgs, args[0], args[1]);
+ nargs = 0;
+ }
+ break;
+
+ case 'l':
+ if (nargs == 2)
+ {
+ // dprintf2("rlineto %g %g\n", args[0], args[1]);
+ gs_rlineto(ctx->pgs, args[0], args[1]);
+ nargs = 0;
+ }
+ break;
+
+ case 'H':
+ if (nargs == 1)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ // dprintf1("hlineto %g\n", args[0]);
+ gs_lineto(ctx->pgs, args[0], pt.y);
+ nargs = 0;
+ }
+ break;
+
+ case 'h':
+ if (nargs == 1)
+ {
+ // dprintf1("rhlineto %g\n", args[0]);
+ gs_rlineto(ctx->pgs, args[0], 0.0);
+ nargs = 0;
+ }
+ break;
+
+ case 'V':
+ if (nargs == 1)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ // dprintf1("vlineto %g\n", args[0]);
+ gs_lineto(ctx->pgs, pt.x, args[0]);
+ nargs = 0;
+ }
+ break;
+
+ case 'v':
+ if (nargs == 1)
+ {
+ // dprintf1("rvlineto %g\n", args[0]);
+ gs_rlineto(ctx->pgs, 0.0, args[0]);
+ nargs = 0;
+ }
+ break;
+
+ case 'C':
+ reset_smooth = 0;
+ if (nargs == 6)
+ {
+ gs_curveto(ctx->pgs, args[0], args[1], args[2], args[3], args[4], args[5]);
+ smooth_x = args[4] - args[2];
+ smooth_y = args[5] - args[3];
+ nargs = 0;
+ }
+ break;
+
+ case 'c':
+ reset_smooth = 0;
+ if (nargs == 6)
+ {
+ gs_rcurveto(ctx->pgs, args[0], args[1], args[2], args[3], args[4], args[5]);
+ smooth_x = args[4] - args[2];
+ smooth_y = args[5] - args[3];
+ nargs = 0;
+ }
+ break;
+
+ case 'S':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ gs_curveto(ctx->pgs,
+ pt.x + smooth_x, pt.y + smooth_y,
+ args[0], args[1],
+ args[2], args[3]);
+ smooth_x = args[2] - args[0];
+ smooth_y = args[3] - args[1];
+ nargs = 0;
+ }
+ break;
+
+ case 's':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ gs_curveto(ctx->pgs,
+ pt.x + smooth_x, pt.y + smooth_y,
+ pt.x + args[0], pt.y + args[1],
+ pt.x + args[2], pt.y + args[3]);
+ smooth_x = args[2] - args[0];
+ smooth_y = args[3] - args[1];
+ nargs = 0;
+ }
+ break;
+
+ case 'Q':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ x1 = args[0];
+ y1 = args[1];
+ x2 = args[2];
+ y2 = args[3];
+ gs_curveto(ctx->pgs,
+ (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
+ (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
+ x2, y2);
+ smooth_x = x2 - x1;
+ smooth_y = y2 - y1;
+ nargs = 0;
+ }
+ break;
+
+ case 'q':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ x1 = args[0] + pt.x;
+ y1 = args[1] + pt.y;
+ x2 = args[2] + pt.x;
+ y2 = args[3] + pt.y;
+ gs_curveto(ctx->pgs,
+ (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
+ (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
+ x2, y2);
+ smooth_x = x2 - x1;
+ smooth_y = y2 - y1;
+ nargs = 0;
+ }
+ break;
+
+ case 'T':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ x1 = pt.x + smooth_x;
+ y1 = pt.y + smooth_y;
+ x2 = args[0];
+ y2 = args[1];
+ gs_curveto(ctx->pgs,
+ (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
+ (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
+ x2, y2);
+ smooth_x = x2 - x1;
+ smooth_y = y2 - y1;
+ nargs = 0;
+ }
+ break;
+
+ case 't':
+ reset_smooth = 0;
+ if (nargs == 4)
+ {
+ gs_currentpoint(ctx->pgs, &pt);
+ x1 = pt.x + smooth_x;
+ y1 = pt.y + smooth_y;
+ x2 = args[0] + pt.x;
+ y2 = args[1] + pt.y;
+ gs_curveto(ctx->pgs,
+ (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3,
+ (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3,
+ x2, y2);
+ smooth_x = x2 - x1;
+ smooth_y = y2 - y1;
+ nargs = 0;
+ }
+ break;
+
+ case 0:
+ if (nargs != 0)
+ return gs_throw(-1, "path data must begin with a command");
+ break;
+
+ default:
+ return gs_throw1(-1, "unrecognized command in path data: '%c'", cmd);
+ }
}
return 0;
@@ -589,17 +588,17 @@ svg_parse_path(svg_context_t *ctx, svg_item_t *node)
if (d_att)
{
- if (ctx->fill_is_set)
- {
- svg_parse_path_data(ctx, d_att);
- svg_fill(ctx);
- }
-
- if (ctx->stroke_is_set)
- {
- svg_parse_path_data(ctx, d_att);
- svg_stroke(ctx);
- }
+ if (ctx->fill_is_set)
+ {
+ svg_parse_path_data(ctx, d_att);
+ svg_fill(ctx);
+ }
+
+ if (ctx->stroke_is_set)
+ {
+ svg_parse_path_data(ctx, d_att);
+ svg_stroke(ctx);
+ }
}
return 0;
diff --git a/svg/svgtop.c b/svg/svgtop.c
index 008600499..ac11a4af0 100644
--- a/svg/svgtop.c
+++ b/svg/svgtop.c
@@ -55,20 +55,20 @@ svg_imp_characteristics(const pl_interp_implementation_t *pimpl)
{
static pl_interp_characteristics_t svg_characteristics =
{
- "SVG",
- "<?xml", /* string to recognize SVG files */
- "Artifex",
- SVG_VERSION,
- SVG_BUILD_DATE,
- SVG_PARSER_MIN_INPUT_SIZE, /* Minimum input size */
+ "SVG",
+ "<?xml", /* string to recognize SVG files */
+ "Artifex",
+ SVG_VERSION,
+ SVG_BUILD_DATE,
+ SVG_PARSER_MIN_INPUT_SIZE, /* Minimum input size */
};
return &svg_characteristics;
}
static int
svg_imp_allocate_interp(pl_interp_t **ppinterp,
- const pl_interp_implementation_t *pimpl,
- gs_memory_t *pmem)
+ const pl_interp_implementation_t *pimpl,
+ gs_memory_t *pmem)
{
static pl_interp_t interp; /* there's only one interpreter */
*ppinterp = &interp;
@@ -78,8 +78,8 @@ svg_imp_allocate_interp(pl_interp_t **ppinterp,
/* Do per-instance interpreter allocation/init. No device is set yet */
static int
svg_imp_allocate_interp_instance(pl_interp_instance_t **ppinstance,
- pl_interp_t *pinterp,
- gs_memory_t *pmem)
+ pl_interp_t *pinterp,
+ gs_memory_t *pmem)
{
svg_interp_instance_t *instance;
svg_context_t *ctx;
@@ -88,10 +88,10 @@ svg_imp_allocate_interp_instance(pl_interp_instance_t **ppinstance,
dputs("-- svg_imp_allocate_interp_instance --\n");
instance = (svg_interp_instance_t *) gs_alloc_bytes(pmem,
- sizeof(svg_interp_instance_t), "svg_imp_allocate_interp_instance");
+ sizeof(svg_interp_instance_t), "svg_imp_allocate_interp_instance");
ctx = (svg_context_t *) gs_alloc_bytes(pmem,
- sizeof(svg_context_t), "svg_imp_allocate_interp_instance");
+ sizeof(svg_context_t), "svg_imp_allocate_interp_instance");
pgs = gs_state_alloc(pmem);
gsicc_init_iccmanager(pgs);
@@ -100,7 +100,7 @@ svg_imp_allocate_interp_instance(pl_interp_instance_t **ppinstance,
if (!instance || !ctx || !pgs)
{
- if (instance)
+ if (instance)
gs_free_object(pmem, instance, "svg_imp_allocate_interp_instance");
if (ctx)
gs_free_object(pmem, ctx, "svg_imp_allocate_interp_instance");
@@ -146,8 +146,8 @@ svg_imp_allocate_interp_instance(pl_interp_instance_t **ppinstance,
/* Set a client language into an interperter instance */
static int
svg_imp_set_client_instance(pl_interp_instance_t *pinstance,
- pl_interp_instance_t *pclient,
- pl_interp_instance_clients_t which_client)
+ pl_interp_instance_t *pclient,
+ pl_interp_instance_clients_t which_client)
{
/* ignore */
return 0;
@@ -155,7 +155,7 @@ svg_imp_set_client_instance(pl_interp_instance_t *pinstance,
static int
svg_imp_set_pre_page_action(pl_interp_instance_t *pinstance,
- pl_page_action_t action, void *closure)
+ pl_page_action_t action, void *closure)
{
svg_interp_instance_t *instance = (svg_interp_instance_t *)pinstance;
instance->pre_page_action = action;
@@ -165,7 +165,7 @@ svg_imp_set_pre_page_action(pl_interp_instance_t *pinstance,
static int
svg_imp_set_post_page_action(pl_interp_instance_t *pinstance,
- pl_page_action_t action, void *closure)
+ pl_page_action_t action, void *closure)
{
svg_interp_instance_t *instance = (svg_interp_instance_t *)pinstance;
instance->post_page_action = action;
@@ -190,7 +190,7 @@ svg_imp_set_device(pl_interp_instance_t *pinstance, gx_device *pdevice)
code = gs_setdevice_no_erase(ctx->pgs, pdevice);
if (code < 0)
- goto cleanup_setdevice;
+ goto cleanup_setdevice;
gs_setaccuratecurves(ctx->pgs, true); /* NB not sure */
@@ -199,15 +199,15 @@ svg_imp_set_device(pl_interp_instance_t *pinstance, gx_device *pdevice)
/* Ensure that now. */
code = gs_gsave(ctx->pgs);
if (code < 0)
- goto cleanup_gsave;
+ goto cleanup_gsave;
code = gs_erasepage(ctx->pgs);
if (code < 0)
- goto cleanup_erase;
+ goto cleanup_erase;
code = svg_install_halftone(ctx, pdevice);
if (code < 0)
- goto cleanup_halftone;
+ goto cleanup_halftone;
return 0;
@@ -247,34 +247,34 @@ svg_imp_process_file(pl_interp_instance_t *pinstance, char *filename)
file = fopen(filename, "rb");
if (!file)
- return gs_error_ioerror;
+ return gs_error_ioerror;
while (!feof(file))
{
- n = fread(buf, 1, sizeof buf, file);
- if (n == 0)
- if (ferror(file))
- return gs_error_ioerror;
- code = svg_feed_xml_parser(ctx, buf, n);
- if (code < 0)
- {
- gs_catch(code, "cannot parse SVG document");
- fclose(file);
- return code;
- }
+ n = fread(buf, 1, sizeof buf, file);
+ if (n == 0)
+ if (ferror(file))
+ return gs_error_ioerror;
+ code = svg_feed_xml_parser(ctx, buf, n);
+ if (code < 0)
+ {
+ gs_catch(code, "cannot parse SVG document");
+ fclose(file);
+ return code;
+ }
}
root = svg_close_xml_parser(ctx);
if (!root)
{
- gs_catch(-1, "cannot parse xml document");
- fclose(file);
- return -1;
+ gs_catch(-1, "cannot parse xml document");
+ fclose(file);
+ return -1;
}
code = svg_parse_document(ctx, root);
if (code < 0)
- gs_catch(code, "cannot parse SVG document");
+ gs_catch(code, "cannot parse SVG document");
svg_free_item(ctx, root);
fclose(file);
@@ -291,7 +291,7 @@ svg_imp_process(pl_interp_instance_t *pinstance, stream_cursor_read *buf)
code = svg_feed_xml_parser(ctx, (const char*)buf->ptr + 1, buf->limit - buf->ptr);
if (code < 0)
- gs_catch(code, "cannot parse SVG document");
+ gs_catch(code, "cannot parse SVG document");
buf->ptr = buf->limit;
@@ -322,11 +322,11 @@ svg_imp_process_eof(pl_interp_instance_t *pinstance)
root = svg_close_xml_parser(ctx);
if (!root)
- return gs_rethrow(-1, "cannot parse xml document");
+ return gs_rethrow(-1, "cannot parse xml document");
code = svg_parse_document(ctx, root);
if (code < 0)
- gs_catch(code, "cannot parse SVG document");
+ gs_catch(code, "cannot parse SVG document");
svg_free_item(ctx, root);
@@ -336,10 +336,10 @@ svg_imp_process_eof(pl_interp_instance_t *pinstance)
/* Report any errors after running a job */
static int
svg_imp_report_errors(pl_interp_instance_t *pinstance,
- int code, /* prev termination status */
- long file_position, /* file position of error, -1 if unknown */
- bool force_to_cout /* force errors to cout */
- )
+ int code, /* prev termination status */
+ long file_position, /* file position of error, -1 if unknown */
+ bool force_to_cout /* force errors to cout */
+ )
{
return 0;
}
@@ -468,7 +468,7 @@ svg_show_page(svg_context_t *ctx, int num_copies, int flush)
/* do post-page action */
if (instance->post_page_action)
{
- code = instance->post_page_action(pinstance, instance->post_page_closure);
+ code = instance->post_page_action(pinstance, instance->post_page_closure);
if (code < 0)
return code;
}
@@ -525,25 +525,24 @@ svg_install_halftone(svg_context_t *ctx, gx_device *pdevice)
if (gx_device_must_halftone(pdevice))
{
- ht.type = ht_type_threshold;
- ht.params.threshold.width = width;
- ht.params.threshold.height = height;
- ht.params.threshold.thresholds.data = thresh.data;
- ht.params.threshold.thresholds.size = thresh.size;
- ht.params.threshold.transfer = 0;
- ht.params.threshold.transfer_closure.proc = 0;
-
- gs_settransfer(ctx->pgs, identity_transfer);
-
- code = gs_sethalftone(ctx->pgs, &ht);
- if (code < 0)
- return gs_throw(code, "could not install halftone");
-
- code = gs_sethalftonephase(ctx->pgs, 0, 0);
- if (code < 0)
- return gs_throw(code, "could not set halftone phase");
+ ht.type = ht_type_threshold;
+ ht.params.threshold.width = width;
+ ht.params.threshold.height = height;
+ ht.params.threshold.thresholds.data = thresh.data;
+ ht.params.threshold.thresholds.size = thresh.size;
+ ht.params.threshold.transfer = 0;
+ ht.params.threshold.transfer_closure.proc = 0;
+
+ gs_settransfer(ctx->pgs, identity_transfer);
+
+ code = gs_sethalftone(ctx->pgs, &ht);
+ if (code < 0)
+ return gs_throw(code, "could not install halftone");
+
+ code = gs_sethalftonephase(ctx->pgs, 0, 0);
+ if (code < 0)
+ return gs_throw(code, "could not set halftone phase");
}
return 0;
}
-
diff --git a/svg/svgtransform.c b/svg/svgtransform.c
index 8ff76cbb9..280be4d96 100644
--- a/svg/svgtransform.c
+++ b/svg/svgtransform.c
@@ -29,151 +29,150 @@ int svg_parse_transform(svg_context_t *ctx, char *str)
while (*str)
{
- keywordlen = 0;
- nargs = 0;
-
- /*
- * Parse keyword and opening parenthesis.
- */
-
- while (svg_is_whitespace(*str))
- str ++;
-
- if (*str == 0)
- break;
-
- while (svg_is_alpha(*str) && keywordlen < sizeof(keyword) - 1)
- keyword[keywordlen++] = *str++;
- keyword[keywordlen] = 0;
-
- if (keywordlen == 0)
- return gs_throw(-1, "syntax error in transform attribute - no keyword");
-
- while (svg_is_whitespace(*str))
- str ++;
-
- if (*str != '(')
- return gs_throw(-1, "syntax error in transform attribute - no open paren");
- str ++;
-
- while (svg_is_whitespace(*str))
- str ++;
-
- /*
- * Parse list of numbers until closing parenthesis
- */
-
- while (nargs < 6)
- {
- numberlen = 0;
-
- while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
- number[numberlen++] = *str++;
- number[numberlen] = 0;
-
- args[nargs++] = atof(number);
-
- while (svg_is_whitespace_or_comma(*str))
- str ++;
-
- if (*str == ')')
- {
- str ++;
- break;
- }
-
- if (*str == 0)
- return gs_throw(-1, "syntax error in transform attribute - no close paren");
- }
-
- while (svg_is_whitespace_or_comma(*str))
- str ++;
-
- /*
- * Execute the transform.
- */
-
- if (!strcmp(keyword, "matrix"))
- {
- gs_matrix mtx;
-
- if (nargs != 6)
- return gs_throw1(-1, "wrong number of arguments to matrix(): %d", nargs);
-
- mtx.xx = args[0];
- mtx.xy = args[1];
- mtx.yx = args[2];
- mtx.yy = args[3];
- mtx.tx = args[4];
- mtx.ty = args[5];
-
- gs_concat(ctx->pgs, &mtx);
- }
-
- else if (!strcmp(keyword, "translate"))
- {
- if (nargs != 2)
- return gs_throw1(-1, "wrong number of arguments to translate(): %d", nargs);
- gs_translate(ctx->pgs, args[0], args[1]);
- }
-
- else if (!strcmp(keyword, "scale"))
- {
- if (nargs == 1)
- gs_scale(ctx->pgs, args[0], args[0]);
- else if (nargs == 2)
- gs_scale(ctx->pgs, args[0], args[1]);
- else
- return gs_throw1(-1, "wrong number of arguments to scale(): %d", nargs);
- }
-
- else if (!strcmp(keyword, "rotate"))
- {
- if (nargs != 1)
- return gs_throw1(-1, "wrong number of arguments to rotate(): %d", nargs);
- gs_rotate(ctx->pgs, args[0]);
- }
-
- else if (!strcmp(keyword, "skewX"))
- {
- gs_matrix mtx;
-
- if (nargs != 1)
- return gs_throw1(-1, "wrong number of arguments to skewX(): %d", nargs);
-
- mtx.xx = 1.0;
- mtx.xy = 0.0;
- mtx.yx = tan(args[0] * 0.0174532925);
- mtx.yy = 1.0;
- mtx.tx = 0.0;
- mtx.ty = 0.0;
-
- gs_concat(ctx->pgs, &mtx);
- }
-
- else if (!strcmp(keyword, "skewY"))
- {
- gs_matrix mtx;
-
- if (nargs != 1)
- return gs_throw1(-1, "wrong number of arguments to skewY(): %d", nargs);
-
- mtx.xx = 1.0;
- mtx.xy = tan(args[0] * 0.0174532925);
- mtx.yx = 0.0;
- mtx.yy = 1.0;
- mtx.tx = 0.0;
- mtx.ty = 0.0;
-
- gs_concat(ctx->pgs, &mtx);
- }
-
- else
- {
- return gs_throw1(-1, "unknown transform function: %d", keyword);
- }
+ keywordlen = 0;
+ nargs = 0;
+
+ /*
+ * Parse keyword and opening parenthesis.
+ */
+
+ while (svg_is_whitespace(*str))
+ str ++;
+
+ if (*str == 0)
+ break;
+
+ while (svg_is_alpha(*str) && keywordlen < sizeof(keyword) - 1)
+ keyword[keywordlen++] = *str++;
+ keyword[keywordlen] = 0;
+
+ if (keywordlen == 0)
+ return gs_throw(-1, "syntax error in transform attribute - no keyword");
+
+ while (svg_is_whitespace(*str))
+ str ++;
+
+ if (*str != '(')
+ return gs_throw(-1, "syntax error in transform attribute - no open paren");
+ str ++;
+
+ while (svg_is_whitespace(*str))
+ str ++;
+
+ /*
+ * Parse list of numbers until closing parenthesis
+ */
+
+ while (nargs < 6)
+ {
+ numberlen = 0;
+
+ while (svg_is_digit(*str) && numberlen < sizeof(number) - 1)
+ number[numberlen++] = *str++;
+ number[numberlen] = 0;
+
+ args[nargs++] = atof(number);
+
+ while (svg_is_whitespace_or_comma(*str))
+ str ++;
+
+ if (*str == ')')
+ {
+ str ++;
+ break;
+ }
+
+ if (*str == 0)
+ return gs_throw(-1, "syntax error in transform attribute - no close paren");
+ }
+
+ while (svg_is_whitespace_or_comma(*str))
+ str ++;
+
+ /*
+ * Execute the transform.
+ */
+
+ if (!strcmp(keyword, "matrix"))
+ {
+ gs_matrix mtx;
+
+ if (nargs != 6)
+ return gs_throw1(-1, "wrong number of arguments to matrix(): %d", nargs);
+
+ mtx.xx = args[0];
+ mtx.xy = args[1];
+ mtx.yx = args[2];
+ mtx.yy = args[3];
+ mtx.tx = args[4];
+ mtx.ty = args[5];
+
+ gs_concat(ctx->pgs, &mtx);
+ }
+
+ else if (!strcmp(keyword, "translate"))
+ {
+ if (nargs != 2)
+ return gs_throw1(-1, "wrong number of arguments to translate(): %d", nargs);
+ gs_translate(ctx->pgs, args[0], args[1]);
+ }
+
+ else if (!strcmp(keyword, "scale"))
+ {
+ if (nargs == 1)
+ gs_scale(ctx->pgs, args[0], args[0]);
+ else if (nargs == 2)
+ gs_scale(ctx->pgs, args[0], args[1]);
+ else
+ return gs_throw1(-1, "wrong number of arguments to scale(): %d", nargs);
+ }
+
+ else if (!strcmp(keyword, "rotate"))
+ {
+ if (nargs != 1)
+ return gs_throw1(-1, "wrong number of arguments to rotate(): %d", nargs);
+ gs_rotate(ctx->pgs, args[0]);
+ }
+
+ else if (!strcmp(keyword, "skewX"))
+ {
+ gs_matrix mtx;
+
+ if (nargs != 1)
+ return gs_throw1(-1, "wrong number of arguments to skewX(): %d", nargs);
+
+ mtx.xx = 1.0;
+ mtx.xy = 0.0;
+ mtx.yx = tan(args[0] * 0.0174532925);
+ mtx.yy = 1.0;
+ mtx.tx = 0.0;
+ mtx.ty = 0.0;
+
+ gs_concat(ctx->pgs, &mtx);
+ }
+
+ else if (!strcmp(keyword, "skewY"))
+ {
+ gs_matrix mtx;
+
+ if (nargs != 1)
+ return gs_throw1(-1, "wrong number of arguments to skewY(): %d", nargs);
+
+ mtx.xx = 1.0;
+ mtx.xy = tan(args[0] * 0.0174532925);
+ mtx.yx = 0.0;
+ mtx.yy = 1.0;
+ mtx.tx = 0.0;
+ mtx.ty = 0.0;
+
+ gs_concat(ctx->pgs, &mtx);
+ }
+
+ else
+ {
+ return gs_throw1(-1, "unknown transform function: %d", keyword);
+ }
}
return 0;
}
-
diff --git a/svg/svgtypes.c b/svg/svgtypes.c
index 7ad929775..38e65854d 100644
--- a/svg/svgtypes.c
+++ b/svg/svgtypes.c
@@ -33,11 +33,10 @@ int svg_is_alpha(int c)
int svg_is_digit(int c)
{
return (c >= '0' && c <= '9') ||
- (c == 'e') || (c == 'E') ||
- (c == '+') || (c == '-') || (c == '.');
+ (c == 'e') || (c == 'E') ||
+ (c == '+') || (c == '-') || (c == '.');
}
-
/* Return length/coordinate in points */
float
svg_parse_length(char *str, float percent, float font_size)
@@ -47,7 +46,7 @@ svg_parse_length(char *str, float percent, float font_size)
val = (float)strtod(str, &end);
if (end == str)
- return 0; /* failed */
+ return 0; /* failed */
if (!strcmp(end, "px")) return val;
@@ -61,10 +60,10 @@ svg_parse_length(char *str, float percent, float font_size)
if (!strcmp(end, "ex")) return val * font_size * 0.5;
if (!strcmp(end, "%"))
- return val * percent * 0.01;
+ return val * percent * 0.01;
if (end[0] == 0)
- return val;
+ return val;
return 0;
}
@@ -78,17 +77,16 @@ svg_parse_angle(char *str)
val = (float)strtod(str, &end);
if (end == str)
- return 0; /* failed */
+ return 0; /* failed */
if (!strcmp(end, "deg"))
- return val;
+ return val;
if (!strcmp(end, "grad"))
- return val * 0.9;
+ return val * 0.9;
if (!strcmp(end, "rad"))
- return val * 57.2957795;
+ return val * 57.2957795;
return val;
}
-
diff --git a/svg/svgxml.c b/svg/svgxml.c
index 9d00747e4..ee8bd7903 100644
--- a/svg/svgxml.c
+++ b/svg/svgxml.c
@@ -31,7 +31,7 @@ static void on_open_tag(void *zp, const char *name, const char **atts)
int i;
if (ctx->error)
- return;
+ return;
/* count size to alloc */
@@ -40,14 +40,14 @@ static void on_open_tag(void *zp, const char *name, const char **atts)
textlen = 0;
for (i = 0; atts[i]; i++)
{
- attslen += sizeof(char*);
- textlen += strlen(atts[i]) + 1;
+ attslen += sizeof(char*);
+ textlen += strlen(atts[i]) + 1;
}
item = svg_alloc(ctx, sizeof(svg_item_t) + attslen + namelen + textlen);
if (!item)
{
- ctx->error = "out of memory";
+ ctx->error = "out of memory";
}
/* copy strings to new memory */
@@ -59,9 +59,9 @@ static void on_open_tag(void *zp, const char *name, const char **atts)
strcpy(item->name, name);
for (i = 0; atts[i]; i++)
{
- item->atts[i] = p;
- strcpy(item->atts[i], atts[i]);
- p += strlen(p) + 1;
+ item->atts[i] = p;
+ strcpy(item->atts[i], atts[i]);
+ p += strlen(p) + 1;
}
item->atts[i] = 0;
@@ -74,21 +74,21 @@ static void on_open_tag(void *zp, const char *name, const char **atts)
if (!ctx->head)
{
- ctx->root = item;
- ctx->head = item;
- return;
+ ctx->root = item;
+ ctx->head = item;
+ return;
}
if (!ctx->head->down)
{
- ctx->head->down = item;
- ctx->head = item;
- return;
+ ctx->head->down = item;
+ ctx->head = item;
+ return;
}
tail = ctx->head->down;
while (tail->next)
- tail = tail->next;
+ tail = tail->next;
tail->next = item;
ctx->head = item;
}
@@ -98,10 +98,10 @@ static void on_close_tag(void *zp, const char *name)
svg_context_t *ctx = zp;
if (ctx->error)
- return;
+ return;
if (ctx->head)
- ctx->head = ctx->head->up;
+ ctx->head = ctx->head->up;
}
static inline int is_svg_space(int c)
@@ -116,30 +116,30 @@ static void on_text(void *zp, const char *buf, int len)
int i;
if (ctx->error)
- return;
+ return;
for (i = 0; i < len; i++)
{
- if (!is_svg_space(buf[i]))
- {
- char *tmp = svg_alloc(ctx, len + 1);
- if (!tmp)
- {
- ctx->error = "out of memory";
- return;
- }
-
- atts[0] = "";
- atts[1] = tmp;
- atts[2] = NULL;
-
- memcpy(tmp, buf, len);
- tmp[len] = 0;
- on_open_tag(zp, "", atts);
- on_close_tag(zp, "");
- svg_free(ctx, tmp);
- return;
- }
+ if (!is_svg_space(buf[i]))
+ {
+ char *tmp = svg_alloc(ctx, len + 1);
+ if (!tmp)
+ {
+ ctx->error = "out of memory";
+ return;
+ }
+
+ atts[0] = "";
+ atts[1] = tmp;
+ atts[2] = NULL;
+
+ memcpy(tmp, buf, len);
+ tmp[len] = 0;
+ on_open_tag(zp, "", atts);
+ on_close_tag(zp, "");
+ svg_free(ctx, tmp);
+ return;
+ }
}
}
@@ -151,7 +151,7 @@ svg_open_xml_parser(svg_context_t *ctx)
/* xp = XML_ParserCreateNS(NULL, ns); */
xp = XML_ParserCreate(NULL);
if (!xp)
- return gs_throw(-1, "xml error: could not create expat parser");
+ return gs_throw(-1, "xml error: could not create expat parser");
XML_SetUserData(xp, ctx);
XML_SetParamEntityParsing(xp, XML_PARAM_ENTITY_PARSING_NEVER);
@@ -174,16 +174,16 @@ svg_feed_xml_parser(svg_context_t *ctx, const char *buf, int len)
int code = XML_Parse(xp, buf, len, 0);
if (code == 0)
{
- ctx->root = NULL;
- ctx->head = NULL;
- ctx->error = NULL;
- ctx->parser = NULL;
- gs_throw3(-1, "xml error: %s (line %d, column %d)",
- XML_ErrorString(XML_GetErrorCode(xp)),
- XML_GetCurrentLineNumber(xp),
- XML_GetCurrentColumnNumber(xp));
- XML_ParserFree(xp);
- return -1;
+ ctx->root = NULL;
+ ctx->head = NULL;
+ ctx->error = NULL;
+ ctx->parser = NULL;
+ gs_throw3(-1, "xml error: %s (line %d, column %d)",
+ XML_ErrorString(XML_GetErrorCode(xp)),
+ XML_GetCurrentLineNumber(xp),
+ XML_GetCurrentColumnNumber(xp));
+ XML_ParserFree(xp);
+ return -1;
}
return 0;
}
@@ -197,11 +197,11 @@ svg_close_xml_parser(svg_context_t *ctx)
int code = XML_Parse(xp, "", 0, 1); /* finish parsing */
if (code == 0)
{
- gs_throw3(-1, "xml error: %s (line %d, column %d)",
- XML_ErrorString(XML_GetErrorCode(xp)),
- XML_GetCurrentLineNumber(xp),
- XML_GetCurrentColumnNumber(xp));
- root = NULL;
+ gs_throw3(-1, "xml error: %s (line %d, column %d)",
+ XML_ErrorString(XML_GetErrorCode(xp)),
+ XML_GetCurrentLineNumber(xp),
+ XML_GetCurrentColumnNumber(xp));
+ root = NULL;
}
ctx->root = NULL;
@@ -237,8 +237,8 @@ svg_att(svg_item_t *item, const char *att)
{
int i;
for (i = 0; item->atts[i]; i += 2)
- if (!strcmp(item->atts[i], att))
- return item->atts[i + 1];
+ if (!strcmp(item->atts[i], att))
+ return item->atts[i + 1];
return NULL;
}
@@ -248,18 +248,18 @@ svg_free_item(svg_context_t *ctx, svg_item_t *item)
svg_item_t *next;
while (item)
{
- next = item->next;
- if (item->down)
- svg_free_item(ctx, item->down);
- svg_free(ctx, item);
- item = next;
+ next = item->next;
+ if (item->down)
+ svg_free_item(ctx, item->down);
+ svg_free(ctx, item);
+ item = next;
}
}
static void indent(int n)
{
while (n--)
- printf(" ");
+ printf(" ");
}
static void
@@ -269,32 +269,32 @@ svg_debug_item_imp(svg_item_t *item, int level, int loop)
while (item)
{
- indent(level);
-
- if (strlen(item->name) == 0)
- printf("%s\n", item->atts[1]);
- else
- {
- printf("<%s", item->name);
-
- for (i = 0; item->atts[i]; i += 2)
- printf(" %s=\"%s\"", item->atts[i], item->atts[i+1]);
-
- if (item->down)
- {
- printf(">\n");
- svg_debug_item_imp(item->down, level + 1, 1);
- indent(level);
- printf("</%s>\n", item->name);
- }
- else
- printf(" />\n");
- }
-
- item = item->next;
-
- if (!loop)
- return;
+ indent(level);
+
+ if (strlen(item->name) == 0)
+ printf("%s\n", item->atts[1]);
+ else
+ {
+ printf("<%s", item->name);
+
+ for (i = 0; item->atts[i]; i += 2)
+ printf(" %s=\"%s\"", item->atts[i], item->atts[i+1]);
+
+ if (item->down)
+ {
+ printf(">\n");
+ svg_debug_item_imp(item->down, level + 1, 1);
+ indent(level);
+ printf("</%s>\n", item->name);
+ }
+ else
+ printf(" />\n");
+ }
+
+ item = item->next;
+
+ if (!loop)
+ return;
}
}
@@ -303,4 +303,3 @@ svg_debug_item(svg_item_t *item, int level)
{
svg_debug_item_imp(item, level, 0);
}
-
diff --git a/tools/GOT/detag.c b/tools/GOT/detag.c
index eaa256998..46efe21e2 100644
--- a/tools/GOT/detag.c
+++ b/tools/GOT/detag.c
@@ -6,7 +6,7 @@ int
main(int argc, char *argv[]) {
/* Source output should already have ppm header */
- char line[128];
+ char line[128];
int k,j;
int len;
char *infile;
@@ -53,4 +53,3 @@ main(int argc, char *argv[]) {
fclose(fid_out);
return 0;
}
-
diff --git a/tools/GOT/tagimage.c b/tools/GOT/tagimage.c
index 79abcd686..cf90832e6 100644
--- a/tools/GOT/tagimage.c
+++ b/tools/GOT/tagimage.c
@@ -53,7 +53,7 @@ int
main(int argc, char *argv[]) {
/* Source output should already have ppm header */
- char line[128];
+ char line[128];
int k;
int len;
char *infile;
diff --git a/tools/gslite/gslt.h b/tools/gslite/gslt.h
index 347862ac8..96c6a5de5 100644
--- a/tools/gslite/gslt.h
+++ b/tools/gslite/gslt.h
@@ -61,4 +61,3 @@ void gslt_free_library(gs_memory_t *mem);
void gslt_get_device_param(gs_memory_t *mem, gx_device *dev, char *key);
void gslt_set_device_param(gs_memory_t *mem, gx_device *dev, char *key, char *val);
-
diff --git a/tools/gslite/gslt_alloc.c b/tools/gslite/gslt_alloc.c
index 5e21ad188..10aff0f04 100644
--- a/tools/gslite/gslt_alloc.c
+++ b/tools/gslite/gslt_alloc.c
@@ -75,7 +75,7 @@ gslt_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_name_t
/* NB apparently there is code floating around that does 0 size
mallocs. sigh. */
if ( size == 0 )
- return NULL;
+ return NULL;
/* use 2 starting machine words for size and type - assumes
malloc() returns on max boundary and first 2 words will hold
@@ -85,23 +85,23 @@ gslt_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_name_t
newsize = size + minsize + minsize;
{
- byte *ptr = (byte *)malloc(newsize);
- if ( !ptr )
- return NULL;
- num_alloc_called ++;
+ byte *ptr = (byte *)malloc(newsize);
+ if ( !ptr )
+ return NULL;
+ num_alloc_called ++;
#ifdef DEBUG
- if_debug2('A', "[da]:malloc:%p:%s\n", &ptr[minsize * 2], cname );
+ if_debug2('A', "[da]:malloc:%p:%s\n", &ptr[minsize * 2], cname );
#endif
- /* set the type and size */
- set_type(ptr, type);
- set_size(ptr, size);
- /* initialize for debugging */
+ /* set the type and size */
+ set_type(ptr, type);
+ set_size(ptr, size);
+ /* initialize for debugging */
#ifdef DEBUG
- if ( gs_debug_c('@') )
- memset(&ptr[minsize * 2], 0xff, get_size(&ptr[minsize * 2]));
+ if ( gs_debug_c('@') )
+ memset(&ptr[minsize * 2], 0xff, get_size(&ptr[minsize * 2]));
#endif
- /* return the memory after the size and type words. */
- return &ptr[minsize * 2];
+ /* return the memory after the size and type words. */
+ return &ptr[minsize * 2];
}
}
@@ -119,47 +119,46 @@ gslt_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
static void *
gslt_alloc_struct_immovable(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
return gslt_alloc(mem, pstype->ssize, pstype, cname);
}
static void *
gslt_alloc_struct(gs_memory_t * mem, gs_memory_type_ptr_t pstype,
- client_name_t cname)
+ client_name_t cname)
{
return gslt_alloc(mem, pstype->ssize, pstype, cname);
}
static byte *
gslt_alloc_byte_array_immovable(gs_memory_t * mem, uint num_elements,
- uint elt_size, client_name_t cname)
+ uint elt_size, client_name_t cname)
{
return gslt_alloc_bytes(mem, num_elements * elt_size, cname);
}
static byte *
gslt_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
- client_name_t cname)
+ client_name_t cname)
{
return gslt_alloc_bytes(mem, num_elements * elt_size, cname);
}
static void *
gslt_alloc_struct_array_immovable(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
return gslt_alloc(mem, num_elements * pstype->ssize, pstype, cname);
}
static void *
gslt_alloc_struct_array(gs_memory_t * mem, uint num_elements,
- gs_memory_type_ptr_t pstype, client_name_t cname)
+ gs_memory_type_ptr_t pstype, client_name_t cname)
{
return gslt_alloc(mem, num_elements * pstype->ssize, pstype, cname);
}
-
static void *
gslt_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements, client_name_t cname)
{
@@ -173,8 +172,8 @@ gslt_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements, client_n
ulong new_size = (objs_type->ssize * new_num_elements) + header_size;
/* replace the size field */
ptr = (byte *)realloc(&bptr[-header_size], new_size);
- if ( !ptr )
- return NULL;
+ if ( !ptr )
+ return NULL;
num_resize_called ++;
@@ -186,24 +185,23 @@ gslt_resize_object(gs_memory_t * mem, void *obj, uint new_num_elements, client_n
return &ptr[round_up_to_align(1) * 2];
}
-
static void
gslt_free_object(gs_memory_t * mem, void *ptr, client_name_t cname)
{
if ( ptr != NULL ) {
- byte *bptr = (byte *)ptr;
- uint header_size = round_up_to_align(1) * 2;
+ byte *bptr = (byte *)ptr;
+ uint header_size = round_up_to_align(1) * 2;
#ifdef DEBUG
- if ( gs_debug_c('@') )
- memset(bptr-header_size, 0xee, header_size + get_size(ptr));
+ if ( gs_debug_c('@') )
+ memset(bptr-header_size, 0xee, header_size + get_size(ptr));
#endif
- free(bptr-header_size);
+ free(bptr-header_size);
+
+ num_free_called ++;
- num_free_called ++;
-
#ifdef DEBUG
- /* da for debug allocator - so scripts can parse the trace */
- if_debug2('A', "[da]:free:%p:%s\n", ptr, cname );
+ /* da for debug allocator - so scripts can parse the trace */
+ if_debug2('A', "[da]:free:%p:%s\n", ptr, cname );
#endif
}
}
@@ -224,7 +222,7 @@ gslt_alloc_string(gs_memory_t * mem, uint nbytes, client_name_t cname)
static byte *
gslt_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
- client_name_t cname)
+ client_name_t cname)
{
/* just resize object - ignores old_num */
return gslt_resize_object(mem, data, new_num, cname);
@@ -232,13 +230,12 @@ gslt_resize_string(gs_memory_t * mem, byte * data, uint old_num, uint new_num,
static void
gslt_free_string(gs_memory_t * mem, byte * data, uint nbytes,
- client_name_t cname)
+ client_name_t cname)
{
gslt_free_object(mem, data, cname);
return;
}
-
static void
gslt_status(gs_memory_t * mem, gs_memory_status_t * pstat)
{
@@ -263,7 +260,6 @@ gslt_consolidate_free(gs_memory_t *mem)
return;
}
-
static uint
gslt_object_size(gs_memory_t * mem, const void /*obj_header_t */ *obj)
{
@@ -278,7 +274,7 @@ gslt_object_type(gs_memory_t * mem, const void /*obj_header_t */ *obj)
static int
gslt_register_root(gs_memory_t * mem, gs_gc_root_t * rp, gs_ptr_type_t ptype,
- void **up, client_name_t cname)
+ void **up, client_name_t cname)
{
return 0;
}
@@ -296,11 +292,9 @@ no_recover_proc(gs_memory_retrying_t *rmem, void *proc_data)
return RECOVER_STATUS_NO_RETRY;
}
-
/* forward decl */
static gs_memory_t * gslt_stable(gs_memory_t *mem);
-
gs_memory_retrying_t gslt_mem = {
(gs_memory_t *)&gslt_mem, /* also this is stable_memory since no save/restore */
{ gslt_alloc_bytes_immovable, /* alloc_bytes_immovable */
@@ -310,7 +304,7 @@ gs_memory_retrying_t gslt_mem = {
gslt_status, /* status */
gslt_free_all, /* free_all */
gslt_consolidate_free, /* consolidate_free */
- gslt_alloc_bytes, /* alloc_bytes */
+ gslt_alloc_bytes, /* alloc_bytes */
gslt_alloc_struct, /* alloc_struct */
gslt_alloc_struct_immovable, /* alloc_struct_immovable */
gslt_alloc_byte_array, /* alloc_byte_array */
@@ -323,9 +317,9 @@ gs_memory_retrying_t gslt_mem = {
gslt_alloc_string_immovable, /* alloc_string_immovable */
gslt_resize_string, /* resize_string */
gslt_free_string, /* free_string */
- gslt_register_root, /* register_root */
+ gslt_register_root, /* register_root */
gslt_unregister_root, /* unregister_root */
- gslt_enable_free /* enable_free */
+ gslt_enable_free /* enable_free */
},
NULL, /* gs_lib_ctx */
NULL, /* head */
@@ -350,7 +344,7 @@ const gs_malloc_memory_t gslt_malloc_memory = {
gslt_status, /* status */
gslt_free_all, /* free_all */
gslt_consolidate_free, /* consolidate_free */
- gslt_alloc_bytes, /* alloc_bytes */
+ gslt_alloc_bytes, /* alloc_bytes */
gslt_alloc_struct, /* alloc_struct */
gslt_alloc_struct_immovable, /* alloc_struct_immovable */
gslt_alloc_byte_array, /* alloc_byte_array */
@@ -363,16 +357,16 @@ const gs_malloc_memory_t gslt_malloc_memory = {
gslt_alloc_string_immovable, /* alloc_string_immovable */
gslt_resize_string, /* resize_string */
gslt_free_string, /* free_string */
- gslt_register_root, /* register_root */
+ gslt_register_root, /* register_root */
gslt_unregister_root, /* unregister_root */
- gslt_enable_free /* enable_free */
- },
+ gslt_enable_free /* enable_free */
+ },
NULL, /* gs_lib_ctx */
NULL, /* head */
NULL, /* non_gc_memory */
0, /* allocated */
- 0, /* limit */
- 0, /* used */
+ 0, /* limit */
+ 0, /* used */
0 /* max used */
};
@@ -387,7 +381,7 @@ gs_memory_t *
gslt_alloc_init()
{
if ( gslt_malloc_init() == NULL )
- return NULL;
+ return NULL;
gs_lib_ctx_init((gs_memory_t *)&gslt_mem);
@@ -405,4 +399,3 @@ gslt_alloc_print_leaks(void)
dprintf1("number of resizes: %d\n", num_resize_called);
dprintf1("number of leaked chunks: %d\n", num_alloc_called - num_free_called);
}
-
diff --git a/tools/gslite/gslt_alloc.h b/tools/gslite/gslt_alloc.h
index 280a20dbd..6c84a6498 100644
--- a/tools/gslite/gslt_alloc.h
+++ b/tools/gslite/gslt_alloc.h
@@ -2,4 +2,3 @@
gs_memory_t *gslt_alloc_init(void);
void gslt_alloc_print_leaks(void);
-
diff --git a/tools/gslite/gslt_font.h b/tools/gslite/gslt_font.h
index 8b33e3033..dc26951c7 100644
--- a/tools/gslite/gslt_font.h
+++ b/tools/gslite/gslt_font.h
@@ -135,4 +135,3 @@ void gslt_release_font_glyph(gs_memory_t *mem, gslt_glyph_bitmap_t *slot);
* Return -1 on failure.
*/
int gslt_measure_font_glyph(gs_state *pgs, gslt_font_t *font, int gid, gslt_glyph_metrics_t *mtx);
-
diff --git a/tools/gslite/gslt_font_api.c b/tools/gslite/gslt_font_api.c
index 9b59ce5a9..563c7448a 100644
--- a/tools/gslite/gslt_font_api.c
+++ b/tools/gslite/gslt_font_api.c
@@ -774,4 +774,3 @@ gslt_measure_font_glyph(gslt_font_t *xf, int gid, gslt_glyph_metrics_t *mtx)
return 0;
}
#endif
-
diff --git a/tools/gslite/gslt_font_api.h b/tools/gslite/gslt_font_api.h
index 220328082..a94e42b9a 100644
--- a/tools/gslite/gslt_font_api.h
+++ b/tools/gslite/gslt_font_api.h
@@ -127,4 +127,3 @@ int gslt_render_font_glyph(gs_state *pgs, gslt_font_t *font, gs_matrix *tm, int
* Return -1 on failure.
*/
int gslt_measure_font_glyph(gs_state *pgs, gslt_font_t *font, int gid, gslt_glyph_metrics_t *mtx);
-
diff --git a/tools/gslite/gslt_font_api_test.c b/tools/gslite/gslt_font_api_test.c
index 7425f64dc..1c34e67da 100644
--- a/tools/gslite/gslt_font_api_test.c
+++ b/tools/gslite/gslt_font_api_test.c
@@ -226,7 +226,6 @@ main(int argc, const char *argv[])
continue;
}
-
printf("glyph %3d: v=%f,%f w=%f,%f ", gid, mtx.v[0], mtx.v[1], mtx.w[0], mtx.w[1]);
printf(" -> %dx%d+(%d,%d) w=%f,%f\n",
slot.w, slot.h,
@@ -265,4 +264,3 @@ main(int argc, const char *argv[])
return 0;
}
-
diff --git a/tools/gslite/gslt_font_cache.c b/tools/gslite/gslt_font_cache.c
index 2a7e0022c..f0a27489b 100644
--- a/tools/gslite/gslt_font_cache.c
+++ b/tools/gslite/gslt_font_cache.c
@@ -16,7 +16,6 @@
#include "gslt.h"
#include "gslt_font.h"
-
/*
* The font cache is a gs_font_dir.
* It has some parameters that need to be set,
@@ -53,7 +52,6 @@ gslt_free_font_cache(gs_memory_t *mem, gs_font_dir *fontdir)
gs_free_object(mem, fontdir, "gs_font_dir");
}
-
/*
* Find the offset and length of an SFNT table.
* Return -1 if no table by the specified name is found.
@@ -72,14 +70,14 @@ gslt_find_sfnt_table(gslt_font_t *xf, char *name, int *lengthp)
if (!memcmp(xf->data, "ttcf", 4))
{
- int nfonts = u32(xf->data + 8);
- if (xf->subfontid < 0 || xf->subfontid >= nfonts)
- return -1;
- offset = u32(xf->data + 12 + xf->subfontid * 4);
+ int nfonts = u32(xf->data + 8);
+ if (xf->subfontid < 0 || xf->subfontid >= nfonts)
+ return -1;
+ offset = u32(xf->data + 12 + xf->subfontid * 4);
}
else
{
- offset = 0;
+ offset = 0;
}
ntables = u16(xf->data + offset + 4);
@@ -134,18 +132,18 @@ gslt_new_font(gs_memory_t *mem, gs_font_dir *fontdir, char *buf, int buflen, int
xf->charstrings = 0;
if (memcmp(xf->data, "OTTO", 4) == 0)
- t = gslt_init_postscript_font(mem, fontdir, xf);
+ t = gslt_init_postscript_font(mem, fontdir, xf);
else if (memcmp(xf->data, "\0\1\0\0", 4) == 0)
- t = gslt_init_truetype_font(mem, fontdir, xf);
+ t = gslt_init_truetype_font(mem, fontdir, xf);
else if (memcmp(xf->data, "true", 4) == 0)
- t = gslt_init_truetype_font(mem, fontdir, xf);
+ t = gslt_init_truetype_font(mem, fontdir, xf);
else if (memcmp(xf->data, "ttcf", 4) == 0)
- t = gslt_init_truetype_font(mem, fontdir, xf);
+ t = gslt_init_truetype_font(mem, fontdir, xf);
else
{
gslt_free_font(mem, xf);
- gs_throw(-1, "not an opentype font");
- return NULL;
+ gs_throw(-1, "not an opentype font");
+ return NULL;
}
if (t < 0)
@@ -171,4 +169,3 @@ gslt_free_font(gs_memory_t *mem, gslt_font_t *xf)
gs_free_object(mem, xf->font, "font object");
gs_free_object(mem, xf, "gslt_font struct");
}
-
diff --git a/tools/gslite/gslt_font_cff.c b/tools/gslite/gslt_font_cff.c
index 15cb0a55a..aeee420a2 100644
--- a/tools/gslite/gslt_font_cff.c
+++ b/tools/gslite/gslt_font_cff.c
@@ -62,25 +62,25 @@ gslt_read_cff_real(byte *p, byte *e, float *val)
while (txt < buf + (sizeof buf) - 3 && p < e)
{
- int b, n;
-
- b = *p++;
-
- n = (b >> 4) & 0xf;
- if (n < 0xA) { *txt++ = n + '0'; }
- else if (n == 0xA) { *txt++ = '.'; }
- else if (n == 0xB) { *txt++ = 'E'; }
- else if (n == 0xC) { *txt++ = 'E'; *txt++ = '-'; }
- else if (n == 0xE) { *txt++ = '-'; }
- else if (n == 0xF) { break; }
-
- n = b & 0xf;
- if (n < 0xA) { *txt++ = n + '0'; }
- else if (n == 0xA) { *txt++ = '.'; }
- else if (n == 0xB) { *txt++ = 'E'; }
- else if (n == 0xC) { *txt++ = 'E'; *txt++ = '-'; }
- else if (n == 0xE) { *txt++ = '-'; }
- else if (n == 0xF) { break; }
+ int b, n;
+
+ b = *p++;
+
+ n = (b >> 4) & 0xf;
+ if (n < 0xA) { *txt++ = n + '0'; }
+ else if (n == 0xA) { *txt++ = '.'; }
+ else if (n == 0xB) { *txt++ = 'E'; }
+ else if (n == 0xC) { *txt++ = 'E'; *txt++ = '-'; }
+ else if (n == 0xE) { *txt++ = '-'; }
+ else if (n == 0xF) { break; }
+
+ n = b & 0xf;
+ if (n < 0xA) { *txt++ = n + '0'; }
+ else if (n == 0xA) { *txt++ = '.'; }
+ else if (n == 0xB) { *txt++ = 'E'; }
+ else if (n == 0xC) { *txt++ = 'E'; *txt++ = '-'; }
+ else if (n == 0xE) { *txt++ = '-'; }
+ else if (n == 0xF) { break; }
}
*txt = 0;
@@ -97,55 +97,55 @@ gslt_read_cff_integer(byte *p, byte *e, int b0, int *val)
if (b0 == 28)
{
- if (p + 2 > e)
- {
- gs_throw(-1, "corrupt dictionary (integer)");
- return 0;
- }
- b1 = *p++;
- b2 = *p++;
- *val = (b1 << 8) | b2;
+ if (p + 2 > e)
+ {
+ gs_throw(-1, "corrupt dictionary (integer)");
+ return 0;
+ }
+ b1 = *p++;
+ b2 = *p++;
+ *val = (b1 << 8) | b2;
}
else if (b0 == 29)
{
- if (p + 4 > e)
- {
- gs_throw(-1, "corrupt dictionary (integer)");
- return 0;
- }
- b1 = *p++;
- b2 = *p++;
- b3 = *p++;
- b4 = *p++;
- *val = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ if (p + 4 > e)
+ {
+ gs_throw(-1, "corrupt dictionary (integer)");
+ return 0;
+ }
+ b1 = *p++;
+ b2 = *p++;
+ b3 = *p++;
+ b4 = *p++;
+ *val = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
}
else if (b0 < 247)
{
- *val = b0 - 139;
+ *val = b0 - 139;
}
else if (b0 < 251)
{
- if (p + 1 > e)
- {
- gs_throw(-1, "corrupt dictionary (integer)");
- return 0;
- }
- b1 = *p++;
- *val = (b0 - 247) * 256 + b1 + 108;
+ if (p + 1 > e)
+ {
+ gs_throw(-1, "corrupt dictionary (integer)");
+ return 0;
+ }
+ b1 = *p++;
+ *val = (b0 - 247) * 256 + b1 + 108;
}
else
{
- if (p + 1 > e)
- {
- gs_throw(-1, "corrupt dictionary (integer)");
- return 0;
- }
- b1 = *p++;
- *val = -(b0 - 251) * 256 - b1 - 108;
+ if (p + 1 > e)
+ {
+ gs_throw(-1, "corrupt dictionary (integer)");
+ return 0;
+ }
+ b1 = *p++;
+ *val = -(b0 - 251) * 256 - b1 - 108;
}
return p;
@@ -168,191 +168,191 @@ gslt_read_cff_dict(byte *p, byte *e, gslt_font_t *fontobj, gs_font_type1 *pt1)
n = 0;
while (p < e)
{
- b0 = *p++;
-
- if (b0 < 22)
- {
- if (b0 == 12)
- {
- if (p + 1 > e)
- {
- return gs_throw(-1, "corrupt dictionary (operator)");
- }
- b0 = 0x100 | *p++;
- }
-
- /* some CFF file offsets */
-
- if (b0 == 17)
- {
- fontobj->charstrings = fontobj->cffdata + args[0].ival;
- }
-
- if (b0 == 18)
- {
- privatelen = args[0].ival;
- privateofs = args[1].ival;
- }
-
- if (b0 == 19)
- {
- fontobj->subrs = fontobj->cffdata + offset + args[0].ival;
- }
-
- if (b0 == (256 | 36))
- errprintf("warning: cid cff fonts not supported yet");
- if (b0 == (256 | 37))
- errprintf("warning: cid cff fonts not supported yet");
-
- /* Type1 stuff that need to be set for the pt1 struct */
-
- if (b0 == (256 | 6))
- {
- if (args[0].ival == 1)
- {
- pt1->data.interpret = gs_type1_interpret;
- pt1->data.lenIV = -1; // FIXME
- }
- }
-
- if (b0 == (256 | 7))
- {
- pt1->FontMatrix.xx = args[0].fval * 1000;
- pt1->FontMatrix.xy = args[1].fval * 1000;
- pt1->FontMatrix.yx = args[2].fval * 1000;
- pt1->FontMatrix.yy = args[3].fval * 1000;
- pt1->FontMatrix.tx = args[4].fval * 1000;
- pt1->FontMatrix.ty = args[5].fval * 1000;
- }
-
- if (b0 == 5)
- {
- pt1->FontBBox.p.x = args[0].fval;
- pt1->FontBBox.p.y = args[1].fval;
- pt1->FontBBox.q.x = args[2].fval;
- pt1->FontBBox.q.y = args[3].fval;
- }
-
- if (b0 == 20)
- pt1->data.defaultWidthX = float2fixed(args[0].fval);
-
- if (b0 == 21)
- pt1->data.nominalWidthX = float2fixed(args[0].fval);
-
- if (b0 == (256 | 19))
- pt1->data.initialRandomSeed = args[0].ival;
-
- /* Monday morning blues */
-
- if (b0 == 6)
- {
- pt1->data.BlueValues.count = n / 2;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.BlueValues.values[i] = f;
- }
-
- if (b0 == 7)
- {
- pt1->data.OtherBlues.count = n / 2;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.OtherBlues.values[i] = f;
- }
-
- if (b0 == 8)
- {
- pt1->data.FamilyBlues.count = n / 2;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.FamilyBlues.values[i] = f;
- }
-
- if (b0 == 9)
- {
- pt1->data.FamilyOtherBlues.count = n / 2;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.FamilyOtherBlues.values[i] = f;
- }
-
- if (b0 == 10)
- {
- pt1->data.StdHW.count = 1;
- pt1->data.StdHW.values[0] = args[0].fval;
- }
-
- if (b0 == 11)
- {
- pt1->data.StdVW.count = 1;
- pt1->data.StdVW.values[0] = args[0].fval;
- }
-
- if (b0 == (256 | 9))
- pt1->data.BlueScale = args[0].fval;
-
- if (b0 == (256 | 10))
- pt1->data.BlueShift = args[0].fval;
-
- if (b0 == (256 | 11))
- pt1->data.BlueFuzz = args[0].fval;
-
- if (b0 == (256 | 12))
- {
- pt1->data.StemSnapH.count = n;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.StemSnapH.values[i] = f;
- }
-
- if (b0 == (256 | 13))
- {
- pt1->data.StemSnapV.count = n;
- for (f = 0, i = 0; i < n; f += args[i].fval, i++)
- pt1->data.StemSnapV.values[i] = f;
- }
-
- if (b0 == (256 | 14))
- pt1->data.ForceBold = args[0].ival;
-
- if (b0 == (256 | 17))
- pt1->data.LanguageGroup = args[0].ival;
-
- if (b0 == (256 | 18))
- pt1->data.ExpansionFactor = args[0].fval;
-
- n = 0;
- }
-
- else
- {
- if (b0 == 30)
- {
- p = gslt_read_cff_real(p, e, &args[n].fval);
- if (!p)
- return gs_throw(-1, "corrupt dictionary operand");
- args[n].ival = (int) args[n].fval;
- n++;
- }
- else if (b0 == 28 || b0 == 29 || (b0 >= 32 && b0 <= 254))
- {
- p = gslt_read_cff_integer(p, e, b0, &args[n].ival);
- if (!p)
- return gs_throw(-1, "corrupt dictionary operand");
- args[n].fval = (float) args[n].ival;
- n++;
- }
- else
- {
- return gs_throw1(-1, "corrupt dictionary operand (b0 = %d)", b0);
- }
- }
+ b0 = *p++;
+
+ if (b0 < 22)
+ {
+ if (b0 == 12)
+ {
+ if (p + 1 > e)
+ {
+ return gs_throw(-1, "corrupt dictionary (operator)");
+ }
+ b0 = 0x100 | *p++;
+ }
+
+ /* some CFF file offsets */
+
+ if (b0 == 17)
+ {
+ fontobj->charstrings = fontobj->cffdata + args[0].ival;
+ }
+
+ if (b0 == 18)
+ {
+ privatelen = args[0].ival;
+ privateofs = args[1].ival;
+ }
+
+ if (b0 == 19)
+ {
+ fontobj->subrs = fontobj->cffdata + offset + args[0].ival;
+ }
+
+ if (b0 == (256 | 36))
+ errprintf("warning: cid cff fonts not supported yet");
+ if (b0 == (256 | 37))
+ errprintf("warning: cid cff fonts not supported yet");
+
+ /* Type1 stuff that need to be set for the pt1 struct */
+
+ if (b0 == (256 | 6))
+ {
+ if (args[0].ival == 1)
+ {
+ pt1->data.interpret = gs_type1_interpret;
+ pt1->data.lenIV = -1; // FIXME
+ }
+ }
+
+ if (b0 == (256 | 7))
+ {
+ pt1->FontMatrix.xx = args[0].fval * 1000;
+ pt1->FontMatrix.xy = args[1].fval * 1000;
+ pt1->FontMatrix.yx = args[2].fval * 1000;
+ pt1->FontMatrix.yy = args[3].fval * 1000;
+ pt1->FontMatrix.tx = args[4].fval * 1000;
+ pt1->FontMatrix.ty = args[5].fval * 1000;
+ }
+
+ if (b0 == 5)
+ {
+ pt1->FontBBox.p.x = args[0].fval;
+ pt1->FontBBox.p.y = args[1].fval;
+ pt1->FontBBox.q.x = args[2].fval;
+ pt1->FontBBox.q.y = args[3].fval;
+ }
+
+ if (b0 == 20)
+ pt1->data.defaultWidthX = float2fixed(args[0].fval);
+
+ if (b0 == 21)
+ pt1->data.nominalWidthX = float2fixed(args[0].fval);
+
+ if (b0 == (256 | 19))
+ pt1->data.initialRandomSeed = args[0].ival;
+
+ /* Monday morning blues */
+
+ if (b0 == 6)
+ {
+ pt1->data.BlueValues.count = n / 2;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.BlueValues.values[i] = f;
+ }
+
+ if (b0 == 7)
+ {
+ pt1->data.OtherBlues.count = n / 2;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.OtherBlues.values[i] = f;
+ }
+
+ if (b0 == 8)
+ {
+ pt1->data.FamilyBlues.count = n / 2;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.FamilyBlues.values[i] = f;
+ }
+
+ if (b0 == 9)
+ {
+ pt1->data.FamilyOtherBlues.count = n / 2;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.FamilyOtherBlues.values[i] = f;
+ }
+
+ if (b0 == 10)
+ {
+ pt1->data.StdHW.count = 1;
+ pt1->data.StdHW.values[0] = args[0].fval;
+ }
+
+ if (b0 == 11)
+ {
+ pt1->data.StdVW.count = 1;
+ pt1->data.StdVW.values[0] = args[0].fval;
+ }
+
+ if (b0 == (256 | 9))
+ pt1->data.BlueScale = args[0].fval;
+
+ if (b0 == (256 | 10))
+ pt1->data.BlueShift = args[0].fval;
+
+ if (b0 == (256 | 11))
+ pt1->data.BlueFuzz = args[0].fval;
+
+ if (b0 == (256 | 12))
+ {
+ pt1->data.StemSnapH.count = n;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.StemSnapH.values[i] = f;
+ }
+
+ if (b0 == (256 | 13))
+ {
+ pt1->data.StemSnapV.count = n;
+ for (f = 0, i = 0; i < n; f += args[i].fval, i++)
+ pt1->data.StemSnapV.values[i] = f;
+ }
+
+ if (b0 == (256 | 14))
+ pt1->data.ForceBold = args[0].ival;
+
+ if (b0 == (256 | 17))
+ pt1->data.LanguageGroup = args[0].ival;
+
+ if (b0 == (256 | 18))
+ pt1->data.ExpansionFactor = args[0].fval;
+
+ n = 0;
+ }
+
+ else
+ {
+ if (b0 == 30)
+ {
+ p = gslt_read_cff_real(p, e, &args[n].fval);
+ if (!p)
+ return gs_throw(-1, "corrupt dictionary operand");
+ args[n].ival = (int) args[n].fval;
+ n++;
+ }
+ else if (b0 == 28 || b0 == 29 || (b0 >= 32 && b0 <= 254))
+ {
+ p = gslt_read_cff_integer(p, e, b0, &args[n].ival);
+ if (!p)
+ return gs_throw(-1, "corrupt dictionary operand");
+ args[n].fval = (float) args[n].ival;
+ n++;
+ }
+ else
+ {
+ return gs_throw1(-1, "corrupt dictionary operand (b0 = %d)", b0);
+ }
+ }
}
/* recurse for the private dictionary */
if (privatelen)
{
- int code = gslt_read_cff_dict(
- fontobj->cffdata + privateofs,
- fontobj->cffdata + privateofs + privatelen,
- fontobj, pt1);
- if (code < 0)
- return gs_rethrow(code, "cannot read private dictionary");
+ int code = gslt_read_cff_dict(
+ fontobj->cffdata + privateofs,
+ fontobj->cffdata + privateofs + privatelen,
+ fontobj, pt1);
+ if (code < 0)
+ return gs_rethrow(code, "cannot read private dictionary");
}
return 0;
@@ -370,28 +370,28 @@ gslt_count_cff_index(byte *p, byte *e, int *countp)
if (p + 3 > e)
{
- gs_throw(-1, "not enough data for index header");
- return 0;
+ gs_throw(-1, "not enough data for index header");
+ return 0;
}
count = u16(p); p += 2;
*countp = count;
if (count == 0)
- return p;
+ return p;
offsize = *p++;
if (offsize < 1 || offsize > 4)
{
- gs_throw(-1, "corrupt index header");
- return 0;
+ gs_throw(-1, "corrupt index header");
+ return 0;
}
if (p + count * offsize > e)
{
- gs_throw(-1, "not enough data for index offset table");
- return 0;
+ gs_throw(-1, "not enough data for index offset table");
+ return 0;
}
p += count * offsize;
@@ -401,8 +401,8 @@ gslt_count_cff_index(byte *p, byte *e, int *countp)
if (p + last > e)
{
- gs_throw(-1, "not enough data for index data");
- return 0;
+ gs_throw(-1, "not enough data for index data");
+ return 0;
}
p += last;
@@ -423,32 +423,32 @@ gslt_find_cff_index(byte *p, byte *e, int idx, byte **pp, byte **ep)
if (p + 3 > e)
{
- gs_throw(-1, "not enough data for index header");
- return 0;
+ gs_throw(-1, "not enough data for index header");
+ return 0;
}
count = u16(p); p += 2;
if (count == 0)
- return 0;
+ return 0;
offsize = *p++;
if (offsize < 1 || offsize > 4)
{
- gs_throw(-1, "corrupt index header");
- return 0;
+ gs_throw(-1, "corrupt index header");
+ return 0;
}
if (p + count * offsize > e)
{
- gs_throw(-1, "not enough data for index offset table");
- return 0;
+ gs_throw(-1, "not enough data for index offset table");
+ return 0;
}
if (idx < 0 || idx >= count)
{
- gs_throw(-1, "tried to access non-existing index item");
- return 0;
+ gs_throw(-1, "tried to access non-existing index item");
+ return 0;
}
sofs = uofs(p + idx * offsize, offsize);
@@ -461,14 +461,14 @@ gslt_find_cff_index(byte *p, byte *e, int idx, byte **pp, byte **ep)
if (p + last > e)
{
- gs_throw(-1, "not enough data for index data");
- return 0;
+ gs_throw(-1, "not enough data for index data");
+ return 0;
}
if (sofs < 0 || eofs < 0 || sofs > eofs || eofs > last)
{
- gs_throw(-1, "corrupt index offset table");
- return 0;
+ gs_throw(-1, "corrupt index offset table");
+ return 0;
}
*pp = p + sofs;
@@ -494,66 +494,66 @@ gslt_read_cff_file(gslt_font_t *fontobj, gs_font_type1 *pt1)
/* CFF header */
{
- int major, minor, hdrsize, offsize;
+ int major, minor, hdrsize, offsize;
- if (p + 4 > e)
- return gs_throw(-1, "not enough data for header");
+ if (p + 4 > e)
+ return gs_throw(-1, "not enough data for header");
- major = *p++;
- minor = *p++;
- hdrsize = *p++;
- offsize = *p++;
+ major = *p++;
+ minor = *p++;
+ hdrsize = *p++;
+ offsize = *p++;
- if (major != 1 || minor != 0)
- return gs_throw(-1, "not a CFF 1.0 file");
+ if (major != 1 || minor != 0)
+ return gs_throw(-1, "not a CFF 1.0 file");
- if (p + hdrsize - 4 > e)
- return gs_throw(-1, "not enough data for extended header");
+ if (p + hdrsize - 4 > e)
+ return gs_throw(-1, "not enough data for extended header");
}
/* Name INDEX */
p = gslt_count_cff_index(p, e, &count);
if (!p)
- return gs_throw(-1, "cannot read name index");
+ return gs_throw(-1, "cannot read name index");
if (count != 1)
- return gs_throw(-1, "file did not contain exactly one font");
+ return gs_throw(-1, "file did not contain exactly one font");
/* Top Dict INDEX */
p = gslt_find_cff_index(p, e, 0, &dictp, &dicte);
if (!p)
- return gs_throw(-1, "cannot read top dict index");
+ return gs_throw(-1, "cannot read top dict index");
/* String index */
p = gslt_count_cff_index(p, e, &count);
if (!p)
- return gs_throw(-1, "cannot read string index");
+ return gs_throw(-1, "cannot read string index");
/* Global Subr INDEX */
fontobj->gsubrs = p;
p = gslt_count_cff_index(p, e, &ngsubrs);
if (!p)
- return gs_throw(-1, "cannot read gsubr index");
+ return gs_throw(-1, "cannot read gsubr index");
/* Read the top and private dictionaries */
code = gslt_read_cff_dict(dictp, dicte, fontobj, pt1);
if (code < 0)
- return gs_rethrow(code, "cannot read top dictionary");
+ return gs_rethrow(code, "cannot read top dictionary");
/* Check the subrs index */
nsubrs = 0;
if (fontobj->subrs)
{
- p = gslt_count_cff_index(fontobj->subrs, e, &nsubrs);
- if (!p)
- return gs_rethrow(-1, "cannot read subrs index");
+ p = gslt_count_cff_index(fontobj->subrs, e, &nsubrs);
+ if (!p)
+ return gs_rethrow(-1, "cannot read subrs index");
}
/* Check the charstrings index */
if (fontobj->charstrings)
{
- p = gslt_count_cff_index(fontobj->charstrings, e, &count);
- if (!p)
- return gs_rethrow(-1, "cannot read charstrings index");
+ p = gslt_count_cff_index(fontobj->charstrings, e, &count);
+ if (!p)
+ return gs_rethrow(-1, "cannot read charstrings index");
}
pt1->data.subroutineNumberBias = subrbias(nsubrs);
@@ -563,7 +563,6 @@ gslt_read_cff_file(gslt_font_t *fontobj, gs_font_type1 *pt1)
return 0;
}
-
/*
*
*/
@@ -575,7 +574,7 @@ gslt_post_callback_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t spc
int value;
value = gslt_encode_font_char(xf, chr);
if (value == 0)
- return gs_no_glyph;
+ return gs_no_glyph;
return value;
}
@@ -593,14 +592,14 @@ gslt_post_callback_glyph_name(gs_font *pf, gs_glyph glyph, gs_const_string *pstr
static int
gslt_post_callback_glyph_info(gs_font *font, gs_glyph glyph,
- const gs_matrix *pmat, int members, gs_glyph_info_t *info)
+ const gs_matrix *pmat, int members, gs_glyph_info_t *info)
{
return -1;
}
static int
gslt_post_callback_glyph_outline(gs_font *font, int wmode, gs_glyph glyph,
- const gs_matrix *pmat, gx_path *ppath, double sbw[4])
+ const gs_matrix *pmat, gx_path *ppath, double sbw[4])
{
dprintf2("glyph_outline wmode=%d glyph=%d\n", wmode, glyph);
return -1;
@@ -637,7 +636,7 @@ gslt_post_callback_glyph_data(gs_font_type1 * pfont, gs_glyph glyph, gs_glyph_da
p = gslt_find_cff_index(fontobj->charstrings, fontobj->cffend, glyph, &s, &e);
if (!p)
- return gs_rethrow(-1, "cannot find charstring");
+ return gs_rethrow(-1, "cannot find charstring");
gs_glyph_data_from_string(pgd, s, e - s, NULL);
@@ -646,7 +645,7 @@ gslt_post_callback_glyph_data(gs_font_type1 * pfont, gs_glyph glyph, gs_glyph_da
static int
gslt_post_callback_subr_data(gs_font_type1 * pfont,
- int subr_num, bool global, gs_glyph_data_t *pgd)
+ int subr_num, bool global, gs_glyph_data_t *pgd)
{
gslt_font_t *fontobj = pfont->client_data;
byte *s, *e;
@@ -656,15 +655,15 @@ gslt_post_callback_subr_data(gs_font_type1 * pfont,
if (global)
{
- p = gslt_find_cff_index(fontobj->gsubrs, fontobj->cffend, subr_num, &s, &e);
- if (!p)
- return gs_rethrow(-1, "cannot find gsubr");
+ p = gslt_find_cff_index(fontobj->gsubrs, fontobj->cffend, subr_num, &s, &e);
+ if (!p)
+ return gs_rethrow(-1, "cannot find gsubr");
}
else
{
- p = gslt_find_cff_index(fontobj->subrs, fontobj->cffend, subr_num, &s, &e);
- if (!p)
- return gs_rethrow(-1, "cannot find subr");
+ p = gslt_find_cff_index(fontobj->subrs, fontobj->cffend, subr_num, &s, &e);
+ if (!p)
+ return gs_rethrow(-1, "cannot find subr");
}
gs_glyph_data_from_string(pgd, s, e - s, NULL);
@@ -674,7 +673,7 @@ gslt_post_callback_subr_data(gs_font_type1 * pfont,
static int
gslt_post_callback_seac_data(gs_font_type1 * pfont, int ccode, gs_glyph * pglyph,
- gs_const_string *gstr, gs_glyph_data_t *pgd)
+ gs_const_string *gstr, gs_glyph_data_t *pgd)
{
return gs_throw(-1, "seac is deprecated in CFF fonts");
}
@@ -691,7 +690,6 @@ gslt_post_callback_pop(void *callback_data, fixed *value)
return gs_throw(-1, "pop not implemented");;
}
-
static int
gslt_cff_append(gs_state *pgs, gs_font_type1 *pt1, gs_glyph glyph, int donthint)
{
@@ -708,7 +706,7 @@ gslt_cff_append(gs_state *pgs, gs_font_type1 *pt1, gs_glyph glyph, int donthint)
// get charstring data
code = gslt_post_callback_glyph_data(pt1, glyph, pgd);
if (code < 0)
- return gs_rethrow(code, "cannot get glyph data");
+ return gs_rethrow(code, "cannot get glyph data");
mtx.xx = ctm_only(pgs).xx;
mtx.xy = ctm_only(pgs).xy;
@@ -722,7 +720,7 @@ gslt_cff_append(gs_state *pgs, gs_font_type1 *pt1, gs_glyph glyph, int donthint)
code = gs_type1_interp_init(&cxs.cis, pgis, pgs->path, NULL, NULL, donthint, 0, pt1);
if (code < 0)
- return gs_throw(code, "cannot init type1 interpreter");
+ return gs_throw(code, "cannot init type1 interpreter");
gs_type1_set_callback_data(pcis, &cxs);
@@ -734,26 +732,26 @@ gslt_cff_append(gs_state *pgs, gs_font_type1 *pt1, gs_glyph glyph, int donthint)
while (1)
{
- code = pt1->data.interpret(pcis, pgd, &value);
- switch (code)
- {
- case type1_result_callothersubr: /* unknown OtherSubr */
- return_error(-15); /* can't handle it */
- case type1_result_sbw: /* [h]sbw, just continue */
- type1_cis_get_metrics(pcis, cxs.sbw);
- type1_cis_get_metrics(pcis, sbw);
- pgd = 0;
- break;
- case 0: /* all done */
- default: /* code < 0, error */
- return code;
- }
+ code = pt1->data.interpret(pcis, pgd, &value);
+ switch (code)
+ {
+ case type1_result_callothersubr: /* unknown OtherSubr */
+ return_error(-15); /* can't handle it */
+ case type1_result_sbw: /* [h]sbw, just continue */
+ type1_cis_get_metrics(pcis, cxs.sbw);
+ type1_cis_get_metrics(pcis, sbw);
+ pgd = 0;
+ break;
+ case 0: /* all done */
+ default: /* code < 0, error */
+ return code;
+ }
}
}
static int
gslt_post_callback_build_char(gs_text_enum_t *ptextenum, gs_state *pgs,
- gs_font *pfont, gs_char chr, gs_glyph glyph)
+ gs_font *pfont, gs_char chr, gs_glyph glyph)
{
gs_show_enum *penum = (gs_show_enum*)ptextenum;
gs_font_type1 *pt1 = (gs_font_type1*)pfont;
@@ -776,32 +774,32 @@ gslt_post_callback_build_char(gs_text_enum_t *ptextenum, gs_state *pgs,
/* Expand the bbox when stroking */
if ( pfont->PaintType )
{
- float expand = max(1.415, gs_currentmiterlimit(pgs)) * gs_currentlinewidth(pgs) / 2;
- w2[2] -= expand, w2[3] -= expand;
- w2[4] += expand, w2[5] += expand;
+ float expand = max(1.415, gs_currentmiterlimit(pgs)) * gs_currentlinewidth(pgs) / 2;
+ w2[2] -= expand, w2[3] -= expand;
+ w2[4] += expand, w2[5] += expand;
}
if ( (code = gs_moveto(pgs, 0.0, 0.0)) < 0 )
- return code;
-
+ return code;
+
if ( (code = gs_setcachedevice(penum, pgs, w2)) < 0 )
- return code;
+ return code;
code = gslt_cff_append(pgs, pt1, glyph,
- gs_show_in_charpath(penum) != cpm_show);
+ gs_show_in_charpath(penum) != cpm_show);
if (code < 0)
- return code;
+ return code;
code = (pfont->PaintType ? gs_stroke(pgs) : gs_fill(pgs));
if (code < 0)
- return code;
+ return code;
return 0;
}
int
gslt_init_postscript_font(gs_memory_t *mem,
- gs_font_dir *fontdir, gslt_font_t *fontobj)
+ gs_font_dir *fontdir, gslt_font_t *fontobj)
{
gs_font_type1 *pt1;
int cffofs;
@@ -815,23 +813,23 @@ gslt_init_postscript_font(gs_memory_t *mem,
#if 0
gs_glyph_data_t;
gs_type1_data_procs_t {
- z1_glyph_data, z1_subr_data, z1_seac_data, z1_push, z1_pop
+ z1_glyph_data, z1_subr_data, z1_seac_data, z1_push, z1_pop
};
gs_type1_data_s { procs; ...;
- subroutineNumberBias;
- gsubrNumberBias;
- defaultWidthX;
- nominalWidthX;
+ subroutineNumberBias;
+ gsubrNumberBias;
+ defaultWidthX;
+ nominalWidthX;
}
gs_font_type1 { font_base_common; data }
#endif
cffofs = gslt_find_sfnt_table(fontobj, "CFF ", &cfflen);
if (cffofs < 0)
- return gs_throw(-1, "cannot find CFF table");
+ return gs_throw(-1, "cannot find CFF table");
if (cfflen < 0 || cffofs + cfflen > fontobj->length)
- return gs_throw(-1, "corrupt CFF table location");
+ return gs_throw(-1, "corrupt CFF table location");
fontobj->cffdata = fontobj->data + cffofs;
fontobj->cffend = fontobj->data + cffofs + cfflen;
@@ -842,7 +840,7 @@ gslt_init_postscript_font(gs_memory_t *mem,
pt1 = (void*) gs_alloc_struct(mem, gs_font_type1, &st_gs_font_type1, "gslt_font type1");
if (!pt1)
- return gs_throw(-1, "out of memory");
+ return gs_throw(-1, "out of memory");
fontobj->font = (void*) pt1;
@@ -891,7 +889,7 @@ gslt_init_postscript_font(gs_memory_t *mem,
pt1->procs.make_font = gs_no_make_font;
pt1->procs.font_info = gs_default_font_info;
// same_font
- pt1->procs.encode_char = gslt_post_callback_encode_char;
+ pt1->procs.encode_char = gslt_post_callback_encode_char;
pt1->procs.decode_glyph = gslt_post_callback_decode_glyph;
// enumerate_glyph
pt1->procs.glyph_info = gslt_post_callback_glyph_info;;
@@ -960,12 +958,11 @@ gslt_init_postscript_font(gs_memory_t *mem,
code = gslt_read_cff_file(fontobj, pt1);
if (code < 0)
{
- // TODO free pt1 here?
- return gs_rethrow(code, "cannot read cff file structure");
+ // TODO free pt1 here?
+ return gs_rethrow(code, "cannot read cff file structure");
}
gs_definefont(fontdir, fontobj->font);
return 0;
}
-
diff --git a/tools/gslite/gslt_font_encoding.c b/tools/gslite/gslt_font_encoding.c
index fc0eb47af..122e97f21 100644
--- a/tools/gslite/gslt_font_encoding.c
+++ b/tools/gslite/gslt_font_encoding.c
@@ -69,7 +69,7 @@ gslt_identify_font_encoding(gslt_font_t *xf, int idx, int *pid, int *eid)
byte *cmapdata, *entry;
if (idx < 0 || idx >= xf->cmapsubcount)
return -1;
- cmapdata = xf->data + xf->cmaptable;
+ cmapdata = xf->data + xf->cmaptable;
entry = cmapdata + 4 + idx * 8;
*pid = u16(entry + 0);
*eid = u16(entry + 2);
@@ -165,34 +165,34 @@ gslt_encode_font_char_int(gslt_font_t *xf, int code)
}
case 10: /* Trimmed array (like 6) */
- {
- int startCharCode = u32(table + 12);
- int numChars = u32(table + 16);
- if ( code < startCharCode || code >= startCharCode + numChars )
- return 0;
- return u32(table + 20 + (code - startCharCode) * 4);
- }
+ {
+ int startCharCode = u32(table + 12);
+ int numChars = u32(table + 16);
+ if ( code < startCharCode || code >= startCharCode + numChars )
+ return 0;
+ return u32(table + 20 + (code - startCharCode) * 4);
+ }
case 12: /* Segmented coverage. (like 4) */
- {
- int nGroups = u32(table + 12);
- byte *group = table + 16;
- int i;
-
- for (i = 0; i < nGroups; i++)
- {
- int startCharCode = u32(group + 0);
- int endCharCode = u32(group + 4);
- int startGlyphID = u32(group + 8);
- if ( code < startCharCode )
- return 0;
- if ( code <= endCharCode )
- return startGlyphID + (code - startCharCode);
- group += 12;
- }
-
- return 0;
- }
+ {
+ int nGroups = u32(table + 12);
+ byte *group = table + 16;
+ int i;
+
+ for (i = 0; i < nGroups; i++)
+ {
+ int startCharCode = u32(group + 0);
+ int endCharCode = u32(group + 4);
+ int startGlyphID = u32(group + 8);
+ if ( code < startCharCode )
+ return 0;
+ if ( code <= endCharCode )
+ return startGlyphID + (code - startCharCode);
+ group += 12;
+ }
+
+ return 0;
+ }
case 2: /* High-byte mapping through table. */
case 8: /* Mixed 16-bit and 32-bit coverage (like 2) */
@@ -209,7 +209,6 @@ gslt_encode_font_char(gslt_font_t *xf, int code)
{
int gid = gslt_encode_font_char_int(xf, code);
if (gid == 0 && xf->usepua)
- gid = gslt_encode_font_char_int(xf, 0xF000 | code);
+ gid = gslt_encode_font_char_int(xf, 0xF000 | code);
return gid;
}
-
diff --git a/tools/gslite/gslt_font_glyph.c b/tools/gslite/gslt_font_glyph.c
index f4f809edd..8aa61a42e 100644
--- a/tools/gslite/gslt_font_glyph.c
+++ b/tools/gslite/gslt_font_glyph.c
@@ -78,14 +78,14 @@ gslt_render_font_glyph(gs_state *pgs, gslt_font_t *xf, gs_matrix *tm, int gid, g
params.data.d_glyph = gid;
params.size = 1;
- gs_moveto(pgs, 100.0, 100.0); // why?
+ gs_moveto(pgs, 100.0, 100.0); // why?
code = gs_text_begin(pgs, &params, xf->font->memory, &textenum);
- if (code != 0)
+ if (code != 0)
return gs_throw1(-1, "cannot gs_text_begin() (%d)", code);
code = gs_text_process(textenum);
- if (code != 0)
+ if (code != 0)
return gs_throw1(-1, "cannot gs_text_process() (%d)", code);
gs_text_release(textenum, "gslt font render");
@@ -230,24 +230,24 @@ gslt_measure_font_glyph(gs_state *pgs, gslt_font_t *xf, int gid, gslt_glyph_metr
ofs = gslt_find_sfnt_table(xf, "hhea", &len);
if (ofs < 0)
- return gs_throw(-1, "cannot find hhea table");
+ return gs_throw(-1, "cannot find hhea table");
if (len < 2 * 18)
- return gs_throw(-1, "hhea table is too short");
+ return gs_throw(-1, "hhea table is too short");
vorg = s16(xf->data + ofs + 4); /* ascender is default vorg */
desc = s16(xf->data + ofs + 6); /* descender */
if (desc < 0)
- desc = -desc;
+ desc = -desc;
n = u16(xf->data + ofs + 17 * 2);
ofs = gslt_find_sfnt_table(xf, "hmtx", &len);
if (ofs < 0)
- return gs_throw(-1, "cannot find hmtx table");
+ return gs_throw(-1, "cannot find hmtx table");
idx = gid;
if (idx > n - 1)
- idx = n - 1;
+ idx = n - 1;
hadv = u16(xf->data + ofs + idx * 4);
vadv = 0;
@@ -259,71 +259,71 @@ gslt_measure_font_glyph(gs_state *pgs, gslt_font_t *xf, int gid, gslt_glyph_metr
head = gslt_find_sfnt_table(xf, "head", &len);
if (head > 0)
{
- scale = u16(xf->data + head + 18); /* units per em */
+ scale = u16(xf->data + head + 18); /* units per em */
}
ofs = gslt_find_sfnt_table(xf, "OS/2", &len);
if (ofs > 0 && len > 70)
{
- vorg = s16(xf->data + ofs + 68); /* sTypoAscender */
- desc = s16(xf->data + ofs + 70); /* sTypoDescender */
- if (desc < 0)
- desc = -desc;
+ vorg = s16(xf->data + ofs + 68); /* sTypoAscender */
+ desc = s16(xf->data + ofs + 70); /* sTypoDescender */
+ if (desc < 0)
+ desc = -desc;
}
ofs = gslt_find_sfnt_table(xf, "vhea", &len);
if (ofs > 0)
{
- if (len < 2 * 18)
- return gs_throw(-1, "vhea table is too short");
+ if (len < 2 * 18)
+ return gs_throw(-1, "vhea table is too short");
- n = u16(xf->data + ofs + 17 * 2);
+ n = u16(xf->data + ofs + 17 * 2);
- ofs = gslt_find_sfnt_table(xf, "vmtx", &len);
- if (ofs < 0)
- return gs_throw(-1, "cannot find vmtx table");
+ ofs = gslt_find_sfnt_table(xf, "vmtx", &len);
+ if (ofs < 0)
+ return gs_throw(-1, "cannot find vmtx table");
- idx = gid;
- if (idx > n - 1)
- idx = n - 1;
+ idx = gid;
+ if (idx > n - 1)
+ idx = n - 1;
- vadv = u16(xf->data + ofs + idx * 4);
- vtop = u16(xf->data + ofs + idx * 4 + 2);
+ vadv = u16(xf->data + ofs + idx * 4);
+ vtop = u16(xf->data + ofs + idx * 4 + 2);
- glyf = gslt_find_sfnt_table(xf, "glyf", &len);
- loca = gslt_find_sfnt_table(xf, "loca", &len);
- if (head > 0 && glyf > 0 && loca > 0)
- {
- format = u16(xf->data + head + 50); /* indexToLocaFormat */
+ glyf = gslt_find_sfnt_table(xf, "glyf", &len);
+ loca = gslt_find_sfnt_table(xf, "loca", &len);
+ if (head > 0 && glyf > 0 && loca > 0)
+ {
+ format = u16(xf->data + head + 50); /* indexToLocaFormat */
- if (format == 0)
- ofs = u16(xf->data + loca + gid * 2) * 2;
- else
- ofs = u32(xf->data + loca + gid * 4);
+ if (format == 0)
+ ofs = u16(xf->data + loca + gid * 2) * 2;
+ else
+ ofs = u32(xf->data + loca + gid * 4);
- ymax = u16(xf->data + glyf + ofs + 8); /* yMax */
+ ymax = u16(xf->data + glyf + ofs + 8); /* yMax */
- vorg = ymax + vtop;
- }
+ vorg = ymax + vtop;
+ }
}
ofs = gslt_find_sfnt_table(xf, "VORG", &len);
if (ofs > 0)
{
- vorg = u16(xf->data + ofs + 6);
- n = u16(xf->data + ofs + 6);
- for (i = 0; i < n; i++)
- {
- if (u16(xf->data + ofs + 8 + 4 * i) == gid)
- {
- vorg = s16(xf->data + ofs + 8 + 4 * i + 2);
- break;
- }
- }
+ vorg = u16(xf->data + ofs + 6);
+ n = u16(xf->data + ofs + 6);
+ for (i = 0; i < n; i++)
+ {
+ if (u16(xf->data + ofs + 8 + 4 * i) == gid)
+ {
+ vorg = s16(xf->data + ofs + 8 + 4 * i + 2);
+ break;
+ }
+ }
}
if (vadv == 0)
- vadv = vorg + desc;
+ vadv = vorg + desc;
mtx->hadv = hadv / (float) scale;
mtx->vadv = vadv / (float) scale;
@@ -331,4 +331,3 @@ gslt_measure_font_glyph(gs_state *pgs, gslt_font_t *xf, int gid, gslt_glyph_metr
return 0;
}
-
diff --git a/tools/gslite/gslt_font_int.h b/tools/gslite/gslt_font_int.h
index 3fe0001ba..88a61688e 100644
--- a/tools/gslite/gslt_font_int.h
+++ b/tools/gslite/gslt_font_int.h
@@ -104,4 +104,3 @@ static inline int u32(byte *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
-
diff --git a/tools/gslite/gslt_font_test.c b/tools/gslite/gslt_font_test.c
index 44fa42352..9f7611542 100644
--- a/tools/gslite/gslt_font_test.c
+++ b/tools/gslite/gslt_font_test.c
@@ -35,22 +35,22 @@ int readfile(char *filename, char **datap, int *lengthp)
fp = fopen(filename, "rb");
if (!fp) {
printf("cannot open font file\n");
- return 1;
+ return 1;
}
t = fseek(fp, 0, 2);
if (t < 0)
{
fclose(fp);
- printf("cannot seek in font file\n");
- return 1;
+ printf("cannot seek in font file\n");
+ return 1;
}
n = ftell(fp);
if (n < 0)
{
fclose(fp);
- printf("cannot tell in font file\n");
- return 1;
+ printf("cannot tell in font file\n");
+ return 1;
}
t = fseek(fp, 0, 0);
@@ -58,15 +58,15 @@ int readfile(char *filename, char **datap, int *lengthp)
{
fclose(fp);
printf("cannot seek in font file\n");
- return 1;
+ return 1;
}
p = malloc(n);
if (!p)
{
fclose(fp);
- printf("out of memory\n");
- return 1;
+ printf("out of memory\n");
+ return 1;
}
t = fread(p, 1, n, fp);
@@ -74,8 +74,8 @@ int readfile(char *filename, char **datap, int *lengthp)
{
free(p);
fclose(fp);
- printf("cannot read font file data\n");
- return 1;
+ printf("cannot read font file data\n");
+ return 1;
}
t = fclose(fp);
@@ -158,8 +158,8 @@ main(int argc, const char *argv[])
if (argc < 2)
{
filename = "/Users/tor/src/work/gslite/TrajanPro-Regular.otf";
- // filename = "/Users/tor/src/work/gslite/GenR102.TTF";
- // return gs_throw(1, "usage: gslt_font_api_test font.otf [subfontid]");
+ // filename = "/Users/tor/src/work/gslite/GenR102.TTF";
+ // return gs_throw(1, "usage: gslt_font_api_test font.otf [subfontid]");
}
else
{
@@ -168,14 +168,14 @@ main(int argc, const char *argv[])
subfontid = 0;
if (argc == 3)
- subfontid = atoi(argv[2]);
+ subfontid = atoi(argv[2]);
printf("Loading font '%s' subfont %d.\n", filename, subfontid);
n = readfile(filename, &buf, &len);
if (n < 0) {
printf("cannot read font file '%s'", filename);
- return 1;
+ return 1;
}
/*
@@ -185,7 +185,6 @@ main(int argc, const char *argv[])
// gslt_get_device_param(mem, dev, "Name");
gslt_set_device_param(mem, dev, "OutputFile", "-");
-
/*
* Create a font cache
*/
@@ -193,7 +192,7 @@ main(int argc, const char *argv[])
cache = gslt_new_font_cache(mem);
if (!cache) {
printf("cannot create font cache\n");
- return 1;
+ return 1;
}
/*
@@ -203,33 +202,33 @@ main(int argc, const char *argv[])
font = gslt_new_font(mem, cache, buf, len, subfontid);
if (!font) {
printf("cannot create font");
- return 1;
+ return 1;
}
static struct { int pid, eid; } xps_cmap_list[] =
{
- { 3, 10 }, /* Unicode with surrogates */
- { 3, 1 }, /* Unicode without surrogates */
- { 3, 5 }, /* Wansung */
- { 3, 4 }, /* Big5 */
- { 3, 3 }, /* Prc */
- { 3, 2 }, /* ShiftJis */
- { 3, 0 }, /* Symbol */
- // { 0, * }, -- Unicode (deprecated)
- { 1, 0 },
- { -1, -1 },
+ { 3, 10 }, /* Unicode with surrogates */
+ { 3, 1 }, /* Unicode without surrogates */
+ { 3, 5 }, /* Wansung */
+ { 3, 4 }, /* Big5 */
+ { 3, 3 }, /* Prc */
+ { 3, 2 }, /* ShiftJis */
+ { 3, 0 }, /* Symbol */
+ // { 0, * }, -- Unicode (deprecated)
+ { 1, 0 },
+ { -1, -1 },
};
n = gslt_count_font_encodings(font);
best = -1;
for (k = 0; xps_cmap_list[k].pid != -1; k++)
{
- for (i = 0; i < n; i++)
- {
- gslt_identify_font_encoding(font, i, &pid, &eid);
- if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid)
- goto found_cmap;
- }
+ for (i = 0; i < n; i++)
+ {
+ gslt_identify_font_encoding(font, i, &pid, &eid);
+ if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid)
+ goto found_cmap;
+ }
}
gs_throw(-1, "could not find a suitable cmap");
return 1;
@@ -257,7 +256,7 @@ found_cmap:
/*
* Test bitmap rendering.
*/
-
+
printf("getting bitmaps\n");
text = "Pack my box with five dozen liquor jugs!";
@@ -274,10 +273,10 @@ text = "This";
{
int gid = gslt_encode_font_char(font, *s);
- if (s == text)
- gid = 2119;
+ if (s == text)
+ gid = 2119;
- printf("char '%c' -> glyph %d\n", *s, gid);
+ printf("char '%c' -> glyph %d\n", *s, gid);
code = gslt_measure_font_glyph(pgs, font, gid, &mtx);
if (code < 0)
@@ -291,14 +290,14 @@ text = "This";
if (code < 0)
{
printf("error in gslt_render_font_glyph\n");
- return 1;
+ return 1;
}
printf(" -> %dx%d+(%d,%d)\n",
slot.w, slot.h,
slot.lsb, slot.top);
- gslt_release_font_glyph(mem, &slot);
+ gslt_release_font_glyph(mem, &slot);
}
/*
@@ -316,4 +315,3 @@ text = "This";
return 0;
}
-
diff --git a/tools/gslite/gslt_font_ttf.c b/tools/gslite/gslt_font_ttf.c
index f3a5b9ab9..ad60424db 100644
--- a/tools/gslite/gslt_font_ttf.c
+++ b/tools/gslite/gslt_font_ttf.c
@@ -79,7 +79,7 @@ gslt_true_callback_build_char(gs_text_enum_t *ptextenum, gs_state *pgs, gs_font
w2[3] = pbbox->p.y;
w2[4] = pbbox->q.x;
w2[5] = pbbox->q.y;
-
+
dprintf6(" bbox (%g %g) %g %g %g %g\n", w2[0], w2[1], w2[2], w2[3], w2[4], w2[5]);
/* Expand the bbox when stroking */
@@ -97,9 +97,9 @@ gslt_true_callback_build_char(gs_text_enum_t *ptextenum, gs_state *pgs, gs_font
return code;
code = gs_type42_append(glyph, pgs,
- gx_current_path(pgs),
- ptextenum, (gs_font*)p42,
- gs_show_in_charpath(penum) != cpm_show);
+ gx_current_path(pgs),
+ ptextenum, (gs_font*)p42,
+ gs_show_in_charpath(penum) != cpm_show);
if (code < 0)
return code;
@@ -193,4 +193,3 @@ gslt_init_truetype_font(gs_memory_t *mem, gs_font_dir *fontdir, gslt_font_t *xf)
return 0;
}
-
diff --git a/tools/gslite/gslt_image.c b/tools/gslite/gslt_image.c
index 09f463f76..7dab2097c 100644
--- a/tools/gslite/gslt_image.c
+++ b/tools/gslite/gslt_image.c
@@ -40,12 +40,11 @@
/* define the gslt_image_t structure descriptor */
public_st_gslt_image();
-
/*
* Strip alpha channel from an image
* assumes a collapsed stride
*/
-static void
+static void
gslt_strip_alpha(gslt_image_t *image)
{
gslt_image_colorspace cs = image->colorspace;
@@ -109,9 +108,9 @@ void
gslt_image_free(gs_memory_t *mem, gslt_image_t *image)
{
if (image != NULL) {
- if (image->samples) {
- gs_free_object(mem, image->samples, "free gslt_image samples");
- }
- gs_free_object(mem, image, "free gslt_image");
+ if (image->samples) {
+ gs_free_object(mem, image->samples, "free gslt_image samples");
+ }
+ gs_free_object(mem, image, "free gslt_image");
}
}
diff --git a/tools/gslite/gslt_image.h b/tools/gslite/gslt_image.h
index bdafb9a45..89087e8cf 100644
--- a/tools/gslite/gslt_image.h
+++ b/tools/gslite/gslt_image.h
@@ -26,10 +26,10 @@ typedef enum {
GSLT_GRAY_A,
GSLT_RGB,
GSLT_RGB_A,
- GSLT_CMYK,
+ GSLT_CMYK,
GSLT_CMYK_A,
GSLT_UNDEFINED /* sentinel for the last defined colorspace */
-} gslt_image_colorspace;
+} gslt_image_colorspace;
/* definition of the image object structure */
struct gslt_image_s {
@@ -50,7 +50,6 @@ gslt_image_t *gslt_image_decode(gs_memory_t *mem, byte *buf, int len);
/* free an image object when it is no longer needed */
void gslt_image_free(gs_memory_t *mem, gslt_image_t *image);
-
/* decode a memory buffer as a particular image format */
gslt_image_t *gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len);
gslt_image_t *gslt_image_decode_png( gs_memory_t *mem, byte *buf, int len);
diff --git a/tools/gslite/gslt_image_jpeg.c b/tools/gslite/gslt_image_jpeg.c
index ebc6b4957..d7ea4261f 100644
--- a/tools/gslite/gslt_image_jpeg.c
+++ b/tools/gslite/gslt_image_jpeg.c
@@ -60,7 +60,7 @@ gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len)
if ((code = gs_jpeg_create_decompress(&state)) < 0) {
error = gs_throw(-1, "cannot gs_jpeg_create_decompress");
- return NULL;
+ return NULL;
}
s_DCTD_template.init((stream_state*)&state);
@@ -74,16 +74,16 @@ gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len)
code = s_DCTD_template.process((stream_state*)&state, &rp, &wp, true);
if (code != 1) {
- error = gs_throw(-1, "premature EOF or error in jpeg");
- return NULL;
+ error = gs_throw(-1, "premature EOF or error in jpeg");
+ return NULL;
}
image = gs_alloc_struct_immovable(mem, gslt_image_t,
- &st_gslt_image, "jpeg gslt_image");
+ &st_gslt_image, "jpeg gslt_image");
if (image == NULL) {
- error = gs_throw(-1, "unable to allocate jpeg gslt_image");
- gs_jpeg_destroy(&state);
- return NULL;
+ error = gs_throw(-1, "unable to allocate jpeg gslt_image");
+ gs_jpeg_destroy(&state);
+ return NULL;
}
image->width = jddp.dinfo.output_width;
@@ -119,9 +119,9 @@ gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len)
wbuf = gs_alloc_bytes(mem, wlen, "decodejpeg");
if (!wbuf) {
error = gs_throw1(-1, "out of memory allocating samples: %d", wlen);
- gs_free_object(mem, image, "free jpeg gslt_image");
- gs_jpeg_destroy(&state);
- return NULL;
+ gs_free_object(mem, image, "free jpeg gslt_image");
+ gs_jpeg_destroy(&state);
+ return NULL;
}
image->samples = wbuf;
@@ -132,9 +132,9 @@ gslt_image_decode_jpeg(gs_memory_t *mem, byte *buf, int len)
if (code != EOFC) {
error = gs_throw1(-1, "error in jpeg (code = %d)", code);
#ifndef DEBUG /* return whatever we got when debugging */
- gs_free_object(mem, image, "free jpeg gslt_image");
- gs_jpeg_destroy(&state);
- return NULL;
+ gs_free_object(mem, image, "free jpeg gslt_image");
+ gs_jpeg_destroy(&state);
+ return NULL;
#endif
}
diff --git a/tools/gslite/gslt_image_png.c b/tools/gslite/gslt_image_png.c
index b46eab8ca..dad09af81 100644
--- a/tools/gslite/gslt_image_png.c
+++ b/tools/gslite/gslt_image_png.c
@@ -79,14 +79,14 @@ gslt_image_decode_png(gs_memory_t *mem, byte *buf, int len)
NULL, NULL, NULL, /* error callbacks */
mem, gslt_png_malloc, gslt_png_free);
if (!png) {
- gs_throw(-1, "png_create_read_struct_2 failed");
- return NULL;
+ gs_throw(-1, "png_create_read_struct_2 failed");
+ return NULL;
}
info = png_create_info_struct(png);
if (!info) {
gs_throw(-1, "png_create_info_struct");
- png_destroy_read_struct(&png, NULL, NULL);
- return NULL;
+ png_destroy_read_struct(&png, NULL, NULL);
+ return NULL;
}
png_set_read_fn(png, &io, gslt_png_read);
@@ -98,7 +98,7 @@ gslt_image_decode_png(gs_memory_t *mem, byte *buf, int len)
{
png_destroy_read_struct(&png, &info, NULL);
gs_throw(-1, "png reading failed");
- return NULL;
+ return NULL;
}
/*
@@ -108,11 +108,11 @@ gslt_image_decode_png(gs_memory_t *mem, byte *buf, int len)
png_read_info(png, info);
image = gs_alloc_struct_immovable(mem, gslt_image_t,
- &st_gslt_image, "new png gslt_image");
+ &st_gslt_image, "new png gslt_image");
if (image == NULL) {
- gs_throw(-1, "unable to allocate png gslt_image");
- png_destroy_read_struct(&png, &info, NULL);
- return NULL;
+ gs_throw(-1, "unable to allocate png gslt_image");
+ png_destroy_read_struct(&png, &info, NULL);
+ return NULL;
}
image->width = png_get_image_width(png, info);
@@ -176,9 +176,9 @@ gslt_image_decode_png(gs_memory_t *mem, byte *buf, int len)
default:
gs_throw(-1, "cannot handle this png color type");
- png_destroy_read_struct(&png, &info, NULL);
- gs_free_object(mem, image, "free png gslt_image");
- return NULL;
+ png_destroy_read_struct(&png, &info, NULL);
+ gs_free_object(mem, image, "free png gslt_image");
+ return NULL;
}
image->stride = (image->width * image->components * image->bits + 7) / 8;
diff --git a/tools/gslite/gslt_image_test.c b/tools/gslite/gslt_image_test.c
index bdae1393b..2efe91051 100644
--- a/tools/gslite/gslt_image_test.c
+++ b/tools/gslite/gslt_image_test.c
@@ -39,8 +39,8 @@ decode_image_file(gs_memory_t *mem, FILE *in)
bytes = fread(buf, 1, len, in);
if (bytes != len) {
- free(buf);
- return NULL;
+ free(buf);
+ return NULL;
}
image = gslt_image_decode(mem, buf, len);
@@ -68,46 +68,46 @@ decode_image_filename(gs_memory_t *mem, const char *filename)
int
write_image_file(gslt_image_t *image, FILE *out)
{
- byte *row;
+ byte *row;
int j, bytes;
if (image == NULL || image->samples == NULL) {
- fprintf(stderr, "ignoring empty image object\n");
- return -1;
+ fprintf(stderr, "ignoring empty image object\n");
+ return -1;
}
if (image->components == 1 && image->bits == 1) {
- /* PBM file */
- int i;
- int rowbytes = (image->width+7)>>3;
- byte *local = malloc(rowbytes);
-
- fprintf(out, "P4\n%d %d\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- /* PBM images are inverted relative to our XPS/PS convention */
- for (i = 0; i < rowbytes; i++)
- local[i] = row[i] ^ 0xFF;
- bytes = fwrite(local, 1, rowbytes, out);
- row += image->stride;
- }
- free(local);
+ /* PBM file */
+ int i;
+ int rowbytes = (image->width+7)>>3;
+ byte *local = malloc(rowbytes);
+
+ fprintf(out, "P4\n%d %d\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ /* PBM images are inverted relative to our XPS/PS convention */
+ for (i = 0; i < rowbytes; i++)
+ local[i] = row[i] ^ 0xFF;
+ bytes = fwrite(local, 1, rowbytes, out);
+ row += image->stride;
+ }
+ free(local);
} else if (image->components == 1 && image->bits == 8) {
- /* PGM file */
- fprintf(out, "P5\n%d %d\n255\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- bytes = fwrite(row, 1, image->width, out);
- row += image->stride;
- }
+ /* PGM file */
+ fprintf(out, "P5\n%d %d\n255\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ bytes = fwrite(row, 1, image->width, out);
+ row += image->stride;
+ }
} else {
- /* PPM file */
- fprintf(out, "P6\n%d %d\n255\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- bytes = fwrite(row, image->components, image->width, out);
- row += image->stride;
- }
+ /* PPM file */
+ fprintf(out, "P6\n%d %d\n255\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ bytes = fwrite(row, image->components, image->width, out);
+ row += image->stride;
+ }
}
return 0;
@@ -121,8 +121,8 @@ write_image_filename(gslt_image_t *image, const char *filename)
out = fopen(filename, "wb");
if (out == NULL) {
- fprintf(stderr, "could not open '%s' for writing\n", filename);
- return -1;
+ fprintf(stderr, "could not open '%s' for writing\n", filename);
+ return -1;
}
error = write_image_file(image, out);
@@ -161,8 +161,8 @@ main(int argc, const char *argv[])
/* load and decode the image */
image = decode_image_filename(mem, argv[argc-1]);
if (image == NULL) {
- fprintf(stderr, "reading image failed.\n");
- code = -1;
+ fprintf(stderr, "reading image failed.\n");
+ code = -1;
}
/* save an uncompressed copy for verification */
write_image_filename(image, "out.pnm");
@@ -178,4 +178,3 @@ main(int argc, const char *argv[])
gslt_free_library(mem);
return code;
}
-
diff --git a/tools/gslite/gslt_image_threads_test.c b/tools/gslite/gslt_image_threads_test.c
index 0cdab1d2f..431dba6c2 100644
--- a/tools/gslite/gslt_image_threads_test.c
+++ b/tools/gslite/gslt_image_threads_test.c
@@ -44,8 +44,8 @@ decode_image_file(gs_memory_t *mem, FILE *in)
bytes = fread(buf, 1, len, in);
if (bytes != len) {
- free(buf);
- return NULL;
+ free(buf);
+ return NULL;
}
image = gslt_image_decode(mem, buf, len);
@@ -73,46 +73,46 @@ decode_image_filename(gs_memory_t *mem, const char *filename)
int
write_image_file(gslt_image_t *image, FILE *out)
{
- byte *row;
+ byte *row;
int j, bytes;
if (image == NULL || image->samples == NULL) {
- fprintf(stderr, "ignoring empty image object\n");
- return -1;
+ fprintf(stderr, "ignoring empty image object\n");
+ return -1;
}
if (image->components == 1 && image->bits == 1) {
- /* PBM file */
- int i;
- int rowbytes = (image->width+7)>>3;
- byte *local = malloc(rowbytes);
-
- fprintf(out, "P4\n%d %d\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- /* PBM images are inverted relative to our XPS/PS convention */
- for (i = 0; i < rowbytes; i++)
- local[i] = row[i] ^ 0xFF;
- bytes = fwrite(local, 1, rowbytes, out);
- row += image->stride;
- }
- free(local);
+ /* PBM file */
+ int i;
+ int rowbytes = (image->width+7)>>3;
+ byte *local = malloc(rowbytes);
+
+ fprintf(out, "P4\n%d %d\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ /* PBM images are inverted relative to our XPS/PS convention */
+ for (i = 0; i < rowbytes; i++)
+ local[i] = row[i] ^ 0xFF;
+ bytes = fwrite(local, 1, rowbytes, out);
+ row += image->stride;
+ }
+ free(local);
} else if (image->components == 1 && image->bits == 8) {
- /* PGM file */
- fprintf(out, "P5\n%d %d\n255\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- bytes = fwrite(row, 1, image->width, out);
- row += image->stride;
- }
+ /* PGM file */
+ fprintf(out, "P5\n%d %d\n255\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ bytes = fwrite(row, 1, image->width, out);
+ row += image->stride;
+ }
} else {
- /* PPM file */
- fprintf(out, "P6\n%d %d\n255\n", image->width, image->height);
- row = image->samples;
- for (j = 0; j < image->height; j++) {
- bytes = fwrite(row, image->components, image->width, out);
- row += image->stride;
- }
+ /* PPM file */
+ fprintf(out, "P6\n%d %d\n255\n", image->width, image->height);
+ row = image->samples;
+ for (j = 0; j < image->height; j++) {
+ bytes = fwrite(row, image->components, image->width, out);
+ row += image->stride;
+ }
}
return 0;
@@ -126,8 +126,8 @@ write_image_filename(gslt_image_t *image, const char *filename)
out = fopen(filename, "wb");
if (out == NULL) {
- fprintf(stderr, "could not open '%s' for writing\n", filename);
- return -1;
+ fprintf(stderr, "could not open '%s' for writing\n", filename);
+ return -1;
}
error = write_image_file(image, out);
@@ -166,12 +166,11 @@ print_image(void *threadid)
gs_erasepage(gs);
gs_moveto(gs, 72.0, 72.0);
-
/* load and decode the image */
image = decode_image_filename(mem, filename);
if (image == NULL) {
- fprintf(stderr, "reading image failed.\n");
- code = -1;
+ fprintf(stderr, "reading image failed.\n");
+ code = -1;
}
/* save an uncompressed copy for verification */
{
@@ -188,7 +187,7 @@ print_image(void *threadid)
/* output the page (unused) */
gs_output_page(gs, 1, 1);
-
+
/* clean up the library */
gslt_free_state(mem, gs);
gslt_free_device(mem, dev);
@@ -208,7 +207,7 @@ main(int argc, const char *argv[])
filename = argv[argc-1];
fprintf(stderr, "loading '%s'\n", filename);
-
+
if ( ((ret=pthread_create(&thread1, NULL, print_image, (void *)t1)) != 0) ||
((ret=pthread_create(&thread2, NULL, print_image, (void *)t2)) != 0) ) {
fprintf(stderr, "Error creating thread code=%d", ret);
@@ -216,4 +215,3 @@ main(int argc, const char *argv[])
}
pthread_exit(NULL);
}
-
diff --git a/tools/gslite/gslt_image_tiff.c b/tools/gslite/gslt_image_tiff.c
index 51419d5c2..7f6775baf 100644
--- a/tools/gslite/gslt_image_tiff.c
+++ b/tools/gslite/gslt_image_tiff.c
@@ -686,31 +686,31 @@ gslt_decode_tiff_strips(gs_memory_t *mem, gslt_tiff_t *tiff, gslt_image_t *image
switch (tiff->compression)
{
case 1:
- error = gslt_decode_tiff_uncompressed(mem, tiff, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_uncompressed(mem, tiff, rp, rp + rlen, wp, wp + wlen);
break;
case 2:
- error = gslt_decode_tiff_fax(mem, tiff, 2, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_fax(mem, tiff, 2, rp, rp + rlen, wp, wp + wlen);
break;
case 3:
- error = gslt_decode_tiff_fax(mem, tiff, 3, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_fax(mem, tiff, 3, rp, rp + rlen, wp, wp + wlen);
break;
case 4:
- error = gslt_decode_tiff_fax(mem, tiff, 4, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_fax(mem, tiff, 4, rp, rp + rlen, wp, wp + wlen);
break;
case 5:
- error = gslt_decode_tiff_lzw(mem, tiff, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_lzw(mem, tiff, rp, rp + rlen, wp, wp + wlen);
break;
case 6:
- error = gs_throw(-1, "deprecated JPEG in TIFF compression not supported");
+ error = gs_throw(-1, "deprecated JPEG in TIFF compression not supported");
break;
case 7:
- error = gslt_decode_tiff_jpeg(mem, tiff, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_jpeg(mem, tiff, rp, rp + rlen, wp, wp + wlen);
break;
case 8:
- error = gslt_decode_tiff_flate(mem, tiff, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_flate(mem, tiff, rp, rp + rlen, wp, wp + wlen);
break;
case 32773:
- error = gslt_decode_tiff_packbits(mem, tiff, rp, rp + rlen, wp, wp + wlen);
+ error = gslt_decode_tiff_packbits(mem, tiff, rp, rp + rlen, wp, wp + wlen);
break;
default:
error = gs_throw1(-1, "unknown TIFF compression: %d", tiff->compression);
@@ -797,7 +797,7 @@ gslt_read_tiff_tag_value(unsigned *p, gslt_tiff_t *tiff, unsigned type, unsigned
}
}
-static int
+static int
gslt_read_tiff_tag(gs_memory_t *mem, gslt_tiff_t *tiff, unsigned offset)
{
unsigned tag;
@@ -981,8 +981,8 @@ gslt_image_decode_tiff(gs_memory_t *mem, byte *buf, int len)
error = gslt_read_tiff_tag(mem, tiff, offset);
if (error) {
error = gs_rethrow(error, "could not read TIFF header tag");
- return NULL;
- }
+ return NULL;
+ }
offset += 12;
}
#ifdef GSLT_DEBUG_TIFF
@@ -990,17 +990,17 @@ gslt_image_decode_tiff(gs_memory_t *mem, byte *buf, int len)
#endif
/* new image */
image = gs_alloc_struct_immovable(mem, gslt_image_t,
- &st_gslt_image, "new tiff gslt_image");
+ &st_gslt_image, "new tiff gslt_image");
if (image == NULL) {
- error = gs_throw(-1, "unable to allocate tiff gslt_image");
- return NULL;
+ error = gs_throw(-1, "unable to allocate tiff gslt_image");
+ return NULL;
}
image->samples = gs_alloc_bytes(mem, image->stride * image->height,
- "decoded tiff data");
+ "decoded tiff data");
if (image->samples == NULL) {
- error = gs_throw(-1, "unable to allocate tiff gslt_image pixel data");
- gs_free_object(mem, image, "free tiff gslt_image");
- return NULL;
+ error = gs_throw(-1, "unable to allocate tiff gslt_image pixel data");
+ gs_free_object(mem, image, "free tiff gslt_image");
+ return NULL;
}
/*
@@ -1012,8 +1012,8 @@ gslt_image_decode_tiff(gs_memory_t *mem, byte *buf, int len)
error = gslt_decode_tiff_strips(mem, tiff, image);
if (error) {
- error = gs_rethrow(error, "could not decode image data");
- return NULL;
+ error = gs_rethrow(error, "could not decode image data");
+ return NULL;
}
/*
diff --git a/tools/gslite/gslt_init.c b/tools/gslite/gslt_init.c
index 4d58f984c..e3003177a 100644
--- a/tools/gslite/gslt_init.c
+++ b/tools/gslite/gslt_init.c
@@ -1,12 +1,12 @@
/* Copyright (C) 1995, 2000 Aladdin Enterprises. All rights reserved.
-
+
This software is provided AS-IS with no warranty, either express or
implied.
-
+
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
-
+
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
@@ -212,4 +212,3 @@ main(int argc, const char *argv[])
}
#endif
-
diff --git a/tools/gslite/gslt_test.c b/tools/gslite/gslt_test.c
index 855c08c79..aadca1e37 100644
--- a/tools/gslite/gslt_test.c
+++ b/tools/gslite/gslt_test.c
@@ -66,7 +66,7 @@ static int (*tests[]) (gs_state *, gs_memory_t *) =
test1, test2, test3, test4, test5,
test6,
#ifdef HALFTONE_FIX
- test7,
+ test7,
#else
0,
#endif
@@ -79,7 +79,6 @@ extern_gs_lib_device_list();
/* Forward references */
static float odsf(floatp, floatp);
-
/* return index in gs device list -1 if not found */
static inline int
get_device_index(const gs_memory_t *mem, const char *value)
@@ -89,11 +88,11 @@ get_device_index(const gs_memory_t *mem, const char *value)
int di;
for ( di = 0; di < num_devs; ++di )
- if ( !strcmp(gs_devicename(dev_list[di]), value) )
- break;
+ if ( !strcmp(gs_devicename(dev_list[di]), value) )
+ break;
if ( di == num_devs ) {
- lprintf1("Unknown device name %s.\n", value);
- return -1;
+ lprintf1("Unknown device name %s.\n", value);
+ return -1;
}
return di;
}
@@ -116,10 +115,10 @@ main(int argc, const char *argv[])
gp_init();
gs_lib_init1(mem);
if (argc < 3 || (achar = argv[2][0]) < '1' ||
- achar > '0' + countof(tests)
- ) {
- lprintf1("Usage: gslt [device] 1..%c\n", '0' + (char)countof(tests));
- exit(1);
+ achar > '0' + countof(tests)
+ ) {
+ lprintf1("Usage: gslt [device] 1..%c\n", '0' + (char)countof(tests));
+ exit(1);
}
memset(gs_debug, 0, 128);
gs_debug['@'] = 1;
@@ -136,7 +135,7 @@ main(int argc, const char *argv[])
int devindex = get_device_index(mem, argv[1]);
if (devindex < 0) {
lprintf1("device %s not found\n", argv[1]);
- exit(1);
+ exit(1);
}
gs_lib_device_list(&list, NULL);
gs_copydevice(&dev, list[devindex], mem);
@@ -146,60 +145,60 @@ main(int argc, const char *argv[])
gx_device_fill_in_procs(dev);
/* Print out the device name just to test the gsparam.c API. */
{
- gs_c_param_list list;
- gs_param_string nstr;
-
- gs_c_param_list_write(&list, mem);
- code = gs_getdeviceparams(dev, (gs_param_list *) & list);
- if (code < 0) {
- lprintf1("getdeviceparams failed! code = %d\n", code);
- exit(1);
- }
- gs_c_param_list_read(&list);
- code = param_read_string((gs_param_list *) & list, "Name", &nstr);
- if (code < 0) {
- lprintf1("reading Name failed! code = %d\n", code);
- exit(1);
- }
- dputs("Device name = ");
- debug_print_string(nstr.data, nstr.size);
- dputs("\n");
- gs_c_param_list_release(&list);
+ gs_c_param_list list;
+ gs_param_string nstr;
+
+ gs_c_param_list_write(&list, mem);
+ code = gs_getdeviceparams(dev, (gs_param_list *) & list);
+ if (code < 0) {
+ lprintf1("getdeviceparams failed! code = %d\n", code);
+ exit(1);
+ }
+ gs_c_param_list_read(&list);
+ code = param_read_string((gs_param_list *) & list, "Name", &nstr);
+ if (code < 0) {
+ lprintf1("reading Name failed! code = %d\n", code);
+ exit(1);
+ }
+ dputs("Device name = ");
+ debug_print_string(nstr.data, nstr.size);
+ dputs("\n");
+ gs_c_param_list_release(&list);
}
/*
* If this is a device that takes an OutputFile, set the OutputFile
* to "-" in the copy.
*/
{
- gs_c_param_list list;
- gs_param_string nstr;
-
- gs_c_param_list_write(&list, mem);
- param_string_from_string(nstr, "-");
- code = param_write_string((gs_param_list *)&list, "OutputFile", &nstr);
- if (code < 0) {
- lprintf1("writing OutputFile failed! code = %d\n", code);
- exit(1);
- }
- gs_c_param_list_read(&list);
- code = gs_putdeviceparams(dev, (gs_param_list *)&list);
- gs_c_param_list_release(&list);
- if (code < 0 && code != gs_error_undefined) {
- lprintf1("putdeviceparams failed! code = %d\n", code);
- exit(1);
- }
+ gs_c_param_list list;
+ gs_param_string nstr;
+
+ gs_c_param_list_write(&list, mem);
+ param_string_from_string(nstr, "-");
+ code = param_write_string((gs_param_list *)&list, "OutputFile", &nstr);
+ if (code < 0) {
+ lprintf1("writing OutputFile failed! code = %d\n", code);
+ exit(1);
+ }
+ gs_c_param_list_read(&list);
+ code = gs_putdeviceparams(dev, (gs_param_list *)&list);
+ gs_c_param_list_release(&list);
+ if (code < 0 && code != gs_error_undefined) {
+ lprintf1("putdeviceparams failed! code = %d\n", code);
+ exit(1);
+ }
}
pgs = gs_state_alloc(mem);
gs_setdevice_no_erase(pgs, dev); /* can't erase yet */
{
- gs_point dpi;
- gs_screen_halftone ht;
-
- gs_dtransform(pgs, 72.0, 72.0, &dpi);
- ht.frequency = min(fabs(dpi.x), fabs(dpi.y)) / 16.001;
- ht.angle = 0;
- ht.spot_function = odsf;
- gs_setscreen(pgs, &ht);
+ gs_point dpi;
+ gs_screen_halftone ht;
+
+ gs_dtransform(pgs, 72.0, 72.0, &dpi);
+ ht.frequency = min(fabs(dpi.x), fabs(dpi.y)) / 16.001;
+ ht.angle = 0;
+ ht.spot_function = odsf;
+ gs_setscreen(pgs, &ht);
}
/* gsave and grestore (among other places) assume that */
/* there are at least 2 gstates on the graphics stack. */
@@ -208,7 +207,7 @@ main(int argc, const char *argv[])
gs_erasepage(pgs);
if (tests[achar - '1']) {
- dprintf1("gslt test case = %d\n", achar - '1');
+ dprintf1("gslt test case = %d\n", achar - '1');
code = (*tests[achar - '1']) (pgs, mem);
gs_output_page(pgs, 1, 1);
if (code)
@@ -220,7 +219,7 @@ main(int argc, const char *argv[])
}
gs_lib_finit(0, 0, mem);
return code;
-
+
#undef mem
}
/* Ordered dither spot function */
@@ -229,22 +228,22 @@ odsf(floatp x, floatp y)
{
static const byte dither[256] =
{
- 0x0E, 0x8E, 0x2E, 0xAE, 0x06, 0x86, 0x26, 0xA6, 0x0C, 0x8C, 0x2C, 0xAC, 0x04, 0x84, 0x24, 0xA4,
- 0xCE, 0x4E, 0xEE, 0x6E, 0xC6, 0x46, 0xE6, 0x66, 0xCC, 0x4C, 0xEC, 0x6C, 0xC4, 0x44, 0xE4, 0x64,
- 0x3E, 0xBE, 0x1E, 0x9E, 0x36, 0xB6, 0x16, 0x96, 0x3C, 0xBC, 0x1C, 0x9C, 0x34, 0xB4, 0x14, 0x94,
- 0xFE, 0x7E, 0xDE, 0x5E, 0xF6, 0x76, 0xD6, 0x56, 0xFC, 0x7C, 0xDC, 0x5C, 0xF4, 0x74, 0xD4, 0x54,
- 0x01, 0x81, 0x21, 0xA1, 0x09, 0x89, 0x29, 0xA9, 0x03, 0x83, 0x23, 0xA3, 0x0B, 0x8B, 0x2B, 0xAB,
- 0xC1, 0x41, 0xE1, 0x61, 0xC9, 0x49, 0xE9, 0x69, 0xC3, 0x43, 0xE3, 0x63, 0xCB, 0x4B, 0xEB, 0x6B,
- 0x31, 0xB1, 0x11, 0x91, 0x39, 0xB9, 0x19, 0x99, 0x33, 0xB3, 0x13, 0x93, 0x3B, 0xBB, 0x1B, 0x9B,
- 0xF1, 0x71, 0xD1, 0x51, 0xF9, 0x79, 0xD9, 0x59, 0xF3, 0x73, 0xD3, 0x53, 0xFB, 0x7B, 0xDB, 0x5B,
- 0x0D, 0x8D, 0x2D, 0xAD, 0x05, 0x85, 0x25, 0xA5, 0x0F, 0x8F, 0x2F, 0xAF, 0x07, 0x87, 0x27, 0xA7,
- 0xCD, 0x4D, 0xED, 0x6D, 0xC5, 0x45, 0xE5, 0x65, 0xCF, 0x4F, 0xEF, 0x6F, 0xC7, 0x47, 0xE7, 0x67,
- 0x3D, 0xBD, 0x1D, 0x9D, 0x35, 0xB5, 0x15, 0x95, 0x3F, 0xBF, 0x1F, 0x9F, 0x37, 0xB7, 0x17, 0x97,
- 0xFD, 0x7D, 0xDD, 0x5D, 0xF5, 0x75, 0xD5, 0x55, 0xFF, 0x7F, 0xDF, 0x5F, 0xF7, 0x77, 0xD7, 0x57,
- 0x02, 0x82, 0x22, 0xA2, 0x0A, 0x8A, 0x2A, 0xAA, 0x00, 0x80, 0x20, 0xA0, 0x08, 0x88, 0x28, 0xA8,
- 0xC2, 0x42, 0xE2, 0x62, 0xCA, 0x4A, 0xEA, 0x6A, 0xC0, 0x40, 0xE0, 0x60, 0xC8, 0x48, 0xE8, 0x68,
- 0x32, 0xB2, 0x12, 0x92, 0x3A, 0xBA, 0x1A, 0x9A, 0x30, 0xB0, 0x10, 0x90, 0x38, 0xB8, 0x18, 0x98,
- 0xF2, 0x72, 0xD2, 0x52, 0xFA, 0x7A, 0xDA, 0x5A, 0xF0, 0x70, 0xD0, 0x50, 0xF8, 0x78, 0xD8, 0x58
+ 0x0E, 0x8E, 0x2E, 0xAE, 0x06, 0x86, 0x26, 0xA6, 0x0C, 0x8C, 0x2C, 0xAC, 0x04, 0x84, 0x24, 0xA4,
+ 0xCE, 0x4E, 0xEE, 0x6E, 0xC6, 0x46, 0xE6, 0x66, 0xCC, 0x4C, 0xEC, 0x6C, 0xC4, 0x44, 0xE4, 0x64,
+ 0x3E, 0xBE, 0x1E, 0x9E, 0x36, 0xB6, 0x16, 0x96, 0x3C, 0xBC, 0x1C, 0x9C, 0x34, 0xB4, 0x14, 0x94,
+ 0xFE, 0x7E, 0xDE, 0x5E, 0xF6, 0x76, 0xD6, 0x56, 0xFC, 0x7C, 0xDC, 0x5C, 0xF4, 0x74, 0xD4, 0x54,
+ 0x01, 0x81, 0x21, 0xA1, 0x09, 0x89, 0x29, 0xA9, 0x03, 0x83, 0x23, 0xA3, 0x0B, 0x8B, 0x2B, 0xAB,
+ 0xC1, 0x41, 0xE1, 0x61, 0xC9, 0x49, 0xE9, 0x69, 0xC3, 0x43, 0xE3, 0x63, 0xCB, 0x4B, 0xEB, 0x6B,
+ 0x31, 0xB1, 0x11, 0x91, 0x39, 0xB9, 0x19, 0x99, 0x33, 0xB3, 0x13, 0x93, 0x3B, 0xBB, 0x1B, 0x9B,
+ 0xF1, 0x71, 0xD1, 0x51, 0xF9, 0x79, 0xD9, 0x59, 0xF3, 0x73, 0xD3, 0x53, 0xFB, 0x7B, 0xDB, 0x5B,
+ 0x0D, 0x8D, 0x2D, 0xAD, 0x05, 0x85, 0x25, 0xA5, 0x0F, 0x8F, 0x2F, 0xAF, 0x07, 0x87, 0x27, 0xA7,
+ 0xCD, 0x4D, 0xED, 0x6D, 0xC5, 0x45, 0xE5, 0x65, 0xCF, 0x4F, 0xEF, 0x6F, 0xC7, 0x47, 0xE7, 0x67,
+ 0x3D, 0xBD, 0x1D, 0x9D, 0x35, 0xB5, 0x15, 0x95, 0x3F, 0xBF, 0x1F, 0x9F, 0x37, 0xB7, 0x17, 0x97,
+ 0xFD, 0x7D, 0xDD, 0x5D, 0xF5, 0x75, 0xD5, 0x55, 0xFF, 0x7F, 0xDF, 0x5F, 0xF7, 0x77, 0xD7, 0x57,
+ 0x02, 0x82, 0x22, 0xA2, 0x0A, 0x8A, 0x2A, 0xAA, 0x00, 0x80, 0x20, 0xA0, 0x08, 0x88, 0x28, 0xA8,
+ 0xC2, 0x42, 0xE2, 0x62, 0xCA, 0x4A, 0xEA, 0x6A, 0xC0, 0x40, 0xE0, 0x60, 0xC8, 0x48, 0xE8, 0x68,
+ 0x32, 0xB2, 0x12, 0x92, 0x3A, 0xBA, 0x1A, 0x9A, 0x30, 0xB0, 0x10, 0x90, 0x38, 0xB8, 0x18, 0x98,
+ 0xF2, 0x72, 0xD2, 0x52, 0xFA, 0x7A, 0xDA, 0x5A, 0xF0, 0x70, 0xD0, 0x50, 0xF8, 0x78, 0xD8, 0x58
};
int i = (int)((x + 1) * 7.9999);
int j = (int)((y + 1) * 7.9999);
@@ -295,10 +294,9 @@ void
gs_abort(const gs_memory_t *mem)
{
gs_to_exit(mem, 1); /* cleanup */
- gp_do_exit(1); /* system independent exit() */
+ gp_do_exit(1); /* system independent exit() */
}
-
/* Return the number with the magnitude of x and the sign of y. */
/* This is a BSD addition to libm; not all compilers have it. */
static double
@@ -307,7 +305,6 @@ gs_copysign(floatp x, floatp y)
return ( y >= 0 ? fabs(x) : -fabs(x) );
}
-
/* ---------------- Test program 1 ---------------- */
/* Draw a colored kaleidoscope. */
@@ -323,7 +320,7 @@ rand(void)
rand_state = A * (rand_state % Q) - R * (rand_state / Q);
/* Note that rand_state cannot be 0 here. */
if (rand_state <= 0)
- rand_state += M;
+ rand_state += M;
#undef A
#undef M
#undef Q
@@ -340,22 +337,22 @@ test1(gs_state * pgs, gs_memory_t * mem)
gs_scale(pgs, 4.0, 4.0);
gs_newpath(pgs);
for (n = 200; --n >= 0;) {
- int j;
+ int j;
#define rf() (rand() / (1.0 * 0x10000 * 0x8000))
- double r = rf(), g = rf(), b = rf();
- double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();
-
- gs_setrgbcolor(pgs, r, g, b);
- for (j = 0; j < 6; j++) {
- gs_gsave(pgs);
- gs_rotate(pgs, 60.0 * j);
- gs_moveto(pgs, x0, y0);
- gs_lineto(pgs, x1, y1);
- gs_lineto(pgs, x2, y2);
- gs_fill(pgs);
- gs_grestore(pgs);
- }
+ double r = rf(), g = rf(), b = rf();
+ double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();
+
+ gs_setrgbcolor(pgs, r, g, b);
+ for (j = 0; j < 6; j++) {
+ gs_gsave(pgs);
+ gs_rotate(pgs, 60.0 * j);
+ gs_moveto(pgs, x0, y0);
+ gs_lineto(pgs, x1, y1);
+ gs_lineto(pgs, x2, y2);
+ gs_fill(pgs);
+ gs_grestore(pgs);
+ }
}
#undef mem
return 0;
@@ -379,8 +376,8 @@ test2(gs_state * pgs, gs_memory_t * mem)
.x....
x.....
*/
- 0x3c, 0, 0, 0, 0x04, 0, 0, 0, 0x04, 0, 0, 0, 0x3c, 0, 0, 0,
- 0x40, 0, 0, 0, 0x80, 0, 0, 0
+ 0x3c, 0, 0, 0, 0x04, 0, 0, 0, 0x04, 0, 0, 0, 0x3c, 0, 0, 0,
+ 0x40, 0, 0, 0, 0x80, 0, 0, 0
};
gs_newpath(pgs);
@@ -452,14 +449,14 @@ test3(gs_state * pgs, gs_memory_t * mem)
tile.id = gs_next_ids(mem, 1);
tile.rep_width = tile.rep_height = 4;
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- &tile, white_black, 100, 100, 150, 150, 0, 0, rop3_T);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ &tile, white_black, 100, 100, 150, 150, 0, 0, rop3_T);
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- NULL, NULL, 120, 120, 110, 110, 0, 0, ~rop3_S & rop3_1);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ NULL, NULL, 120, 120, 110, 110, 0, 0, ~rop3_S & rop3_1);
(*dev_proc(dev, copy_rop))
- (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
- &tile, white_black, 110, 110, 130, 130, 0, 0, rop3_T ^ rop3_D);
+ (dev, NULL, 0, 0, gx_no_bitmap_id, black2,
+ &tile, white_black, 110, 110, 130, 130, 0, 0, rop3_T ^ rop3_D);
#undef pbytes
return 0;
}
@@ -482,26 +479,26 @@ test4(gs_state * pgs, gs_memory_t * mem)
ares.size = 2;
ares.persistent = true;
code = param_write_float_array((gs_param_list *) & list,
- "HWResolution", &ares);
+ "HWResolution", &ares);
if (code < 0) {
- lprintf1("Writing HWResolution failed: %d\n", code);
- exit(1);
+ lprintf1("Writing HWResolution failed: %d\n", code);
+ exit(1);
}
gs_c_param_list_read(&list);
code = gs_putdeviceparams(dev, (gs_param_list *) & list);
gs_c_param_list_release(&list);
if (code < 0) {
- lprintf1("Setting HWResolution failed: %d\n", code);
- exit(1);
+ lprintf1("Setting HWResolution failed: %d\n", code);
+ exit(1);
}
gs_initmatrix(pgs);
gs_initclip(pgs);
if (code == 1) {
- code = (*dev_proc(dev, open_device)) (dev);
- if (code < 0) {
- lprintf1("Reopening device failed: %d\n", code);
- exit(1);
- }
+ code = (*dev_proc(dev, open_device)) (dev);
+ if (code < 0) {
+ lprintf1("Reopening device failed: %d\n", code);
+ exit(1);
+ }
}
gs_moveto(pgs, 0.0, 72.0);
gs_rlineto(pgs, 72.0, 0.0);
@@ -524,10 +521,10 @@ test5(gs_state * pgs, gs_memory_t * mem)
int code;
static const byte data3[] =
{
- 0x00, 0x44, 0x88, 0xcc,
- 0x44, 0x88, 0xcc, 0x00,
- 0x88, 0xcc, 0x00, 0x44,
- 0xcc, 0x00, 0x44, 0x88
+ 0x00, 0x44, 0x88, 0xcc,
+ 0x44, 0x88, 0xcc, 0x00,
+ 0x88, 0xcc, 0x00, 0x44,
+ 0xcc, 0x00, 0x44, 0x88
};
gs_color_space gray_cs;
@@ -541,14 +538,14 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Scale everything up, and fill the background. */
{
- gs_matrix mat;
-
- gs_currentmatrix(pgs, &mat);
- mat.xx = gs_copysign(98.6, mat.xx);
- mat.yy = gs_copysign(98.6, mat.yy);
- mat.tx = floor(mat.tx) + 0.499;
- mat.ty = floor(mat.ty) + 0.499;
- gs_setmatrix(pgs, &mat);
+ gs_matrix mat;
+
+ gs_currentmatrix(pgs, &mat);
+ mat.xx = gs_copysign(98.6, mat.xx);
+ mat.yy = gs_copysign(98.6, mat.yy);
+ mat.tx = floor(mat.tx) + 0.499;
+ mat.ty = floor(mat.ty) + 0.499;
+ gs_setmatrix(pgs, &mat);
}
gs_setrgbcolor(pgs, 1.0, 0.9, 0.9);
fill_rect1(pgs, 0.25, 0.25, 4.0, 6.0);
@@ -581,37 +578,37 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Test an unmasked image. */
gs_gsave(pgs);
{
- gs_image1_t image1;
- void *info1;
+ gs_image1_t image1;
+ void *info1;
gs_color_space cs;
gs_cspace_init_DeviceGray(mem, &cs);
- gs_image_t_init(&image1, &cs);
- /* image */
- image1.ImageMatrix.xx = W;
- image1.ImageMatrix.yy = -H;
- image1.ImageMatrix.ty = H;
- /* data_image */
- image1.Width = W;
- image1.Height = H;
- image1.BitsPerComponent = 8;
-
- gs_translate(pgs, 0.5, 4.0);
+ gs_image_t_init(&image1, &cs);
+ /* image */
+ image1.ImageMatrix.xx = W;
+ image1.ImageMatrix.yy = -H;
+ image1.ImageMatrix.ty = H;
+ /* data_image */
+ image1.Width = W;
+ image1.Height = H;
+ image1.BitsPerComponent = 8;
+
+ gs_translate(pgs, 0.5, 4.0);
code = (*dev_proc(dev, begin_image))
(dev, (const gs_imager_state *)pgs, &image1,
gs_image_format_chunky, (const gs_int_rect *)0,
&dcolor, NULL, mem, &info1);
/****** TEST code >= 0 ******/
- planes[0].data = data3;
- planes[0].data_x = 0;
- planes[0].raster =
- (image1.Height * image1.BitsPerComponent + 7) >> 3;
- /* Use the old image_data API. */
- code = (*dev_proc(dev, image_data))
+ planes[0].data = data3;
+ planes[0].data_x = 0;
+ planes[0].raster =
+ (image1.Height * image1.BitsPerComponent + 7) >> 3;
+ /* Use the old image_data API. */
+ code = (*dev_proc(dev, image_data))
(dev, info1, &planes[0].data, 0,
planes[0].raster, image1.Height);
/****** TEST code == 1 ******/
- code = (*dev_proc(dev, end_image))(dev, info1, true);
+ code = (*dev_proc(dev, end_image))(dev, info1, true);
/****** TEST code >= 0 ******/
}
gs_grestore(pgs);
@@ -619,87 +616,87 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Test an explicitly masked image. */
gs_gsave(pgs);
{
- gs_image3_t image3;
- static const byte data3mask[] =
- {
- 0x60,
- 0x90,
- 0x90,
- 0x60
- };
- static const byte data3x2mask[] =
- {
- 0x66,
- 0x99,
- 0x99,
- 0x66,
- 0x66,
- 0x99,
- 0x99,
- 0x66
- };
-
- gs_image3_t_init(&image3, &gray_cs, interleave_scan_lines);
- /* image */
- image3.ImageMatrix.xx = W;
- image3.ImageMatrix.yy = -H;
- image3.ImageMatrix.ty = H;
- /* data_image */
- image3.Width = W;
- image3.Height = H;
- image3.BitsPerComponent = 8;
- /* MaskDict */
- image3.MaskDict.ImageMatrix = image3.ImageMatrix;
- image3.MaskDict.Width = image3.Width;
- image3.MaskDict.Height = image3.Height;
-
- /* Display with 1-for-1 mask and image. */
- gs_translate(pgs, 0.5, 2.0);
- code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
- NULL, (gs_image_common_t *) & image3,
- NULL, &dcolor, NULL, mem, &info);
+ gs_image3_t image3;
+ static const byte data3mask[] =
+ {
+ 0x60,
+ 0x90,
+ 0x90,
+ 0x60
+ };
+ static const byte data3x2mask[] =
+ {
+ 0x66,
+ 0x99,
+ 0x99,
+ 0x66,
+ 0x66,
+ 0x99,
+ 0x99,
+ 0x66
+ };
+
+ gs_image3_t_init(&image3, &gray_cs, interleave_scan_lines);
+ /* image */
+ image3.ImageMatrix.xx = W;
+ image3.ImageMatrix.yy = -H;
+ image3.ImageMatrix.ty = H;
+ /* data_image */
+ image3.Width = W;
+ image3.Height = H;
+ image3.BitsPerComponent = 8;
+ /* MaskDict */
+ image3.MaskDict.ImageMatrix = image3.ImageMatrix;
+ image3.MaskDict.Width = image3.Width;
+ image3.MaskDict.Height = image3.Height;
+
+ /* Display with 1-for-1 mask and image. */
+ gs_translate(pgs, 0.5, 2.0);
+ code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
+ NULL, (gs_image_common_t *) & image3,
+ NULL, &dcolor, NULL, mem, &info);
/****** TEST code >= 0 ******/
- planes[0].data = data3mask;
- planes[0].data_x = 0;
- planes[0].raster = (image3.MaskDict.Height + 7) >> 3;
- planes[1].data = data3;
- planes[1].data_x = 0;
- planes[1].raster =
- (image3.Height * image3.BitsPerComponent + 7) >> 3;
- code = gx_image_plane_data(info, planes, image3.Height);
+ planes[0].data = data3mask;
+ planes[0].data_x = 0;
+ planes[0].raster = (image3.MaskDict.Height + 7) >> 3;
+ planes[1].data = data3;
+ planes[1].data_x = 0;
+ planes[1].raster =
+ (image3.Height * image3.BitsPerComponent + 7) >> 3;
+ code = gx_image_plane_data(info, planes, image3.Height);
/****** TEST code == 1 ******/
- code = gx_image_end(info, true);
+ code = gx_image_end(info, true);
/****** TEST code >= 0 ******/
- /* Display with 2-for-1 mask and image. */
- image3.MaskDict.ImageMatrix.xx *= 2;
- image3.MaskDict.ImageMatrix.yy *= 2;
- image3.MaskDict.ImageMatrix.ty *= 2;
- image3.MaskDict.Width *= 2;
- image3.MaskDict.Height *= 2;
- gs_translate(pgs, 1.5, 0.0);
- code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
- NULL, (gs_image_common_t *) & image3,
- NULL, &dcolor, NULL, mem, &info);
+ /* Display with 2-for-1 mask and image. */
+ image3.MaskDict.ImageMatrix.xx *= 2;
+ image3.MaskDict.ImageMatrix.yy *= 2;
+ image3.MaskDict.ImageMatrix.ty *= 2;
+ image3.MaskDict.Width *= 2;
+ image3.MaskDict.Height *= 2;
+ gs_translate(pgs, 1.5, 0.0);
+ code = gx_device_begin_typed_image(dev, (gs_imager_state *) pgs,
+ NULL, (gs_image_common_t *) & image3,
+ NULL, &dcolor, NULL, mem, &info);
/****** TEST code >= 0 ******/
- planes[0].data = data3x2mask;
- planes[0].raster = (image3.MaskDict.Width + 7) >> 3;
- {
- int i;
-
- for (i = 0; i < H; ++i) {
- planes[1].data = 0;
- code = gx_image_plane_data(info, planes, 1);
- planes[0].data += planes[0].raster;
+ planes[0].data = data3x2mask;
+ planes[0].raster = (image3.MaskDict.Width + 7) >> 3;
+ {
+ int i;
+
+ for (i = 0; i < H; ++i) {
+ planes[1].data = 0;
+ code = gx_image_plane_data(info, planes, 1);
+ planes[0].data += planes[0].raster;
/****** TEST code == 0 ******/
- planes[1].data = data3 + i * planes[1].raster;
- code = gx_image_plane_data(info, planes, 1);
- planes[0].data += planes[0].raster;
+ planes[1].data = data3 + i * planes[1].raster;
+ code = gx_image_plane_data(info, planes, 1);
+ planes[0].data += planes[0].raster;
/****** TEST code >= 0 ******/
- }
- }
+ }
+ }
/****** TEST code == 1 ******/
- code = gx_image_end(info, true);
+ code = gx_image_end(info, true);
/****** TEST code >= 0 ******/
}
gs_grestore(pgs);
@@ -707,31 +704,31 @@ test5(gs_state * pgs, gs_memory_t * mem)
/* Test a chroma-keyed masked image. */
gs_gsave(pgs);
{
- gs_image4_t image4;
- const byte *data4 = data3;
-
- gs_image4_t_init(&image4, &gray_cs);
- /* image */
- image4.ImageMatrix.xx = W;
- image4.ImageMatrix.yy = -H;
- image4.ImageMatrix.ty = H;
- /* data_image */
- image4.Width = W;
- image4.Height = H;
- image4.BitsPerComponent = 8;
-
- /* Display with a single mask color. */
- gs_translate(pgs, 0.5, 0.5);
- image4.MaskColor_is_range = false;
- image4.MaskColor[0] = 0xcc;
- do_image(image4, data4);
-
- /* Display a second time with a color range. */
- gs_translate(pgs, 1.5, 0.0);
- image4.MaskColor_is_range = true;
- image4.MaskColor[0] = 0x40;
- image4.MaskColor[1] = 0x90;
- do_image(image4, data4);
+ gs_image4_t image4;
+ const byte *data4 = data3;
+
+ gs_image4_t_init(&image4, &gray_cs);
+ /* image */
+ image4.ImageMatrix.xx = W;
+ image4.ImageMatrix.yy = -H;
+ image4.ImageMatrix.ty = H;
+ /* data_image */
+ image4.Width = W;
+ image4.Height = H;
+ image4.BitsPerComponent = 8;
+
+ /* Display with a single mask color. */
+ gs_translate(pgs, 0.5, 0.5);
+ image4.MaskColor_is_range = false;
+ image4.MaskColor[0] = 0xcc;
+ do_image(image4, data4);
+
+ /* Display a second time with a color range. */
+ gs_translate(pgs, 1.5, 0.0);
+ image4.MaskColor_is_range = true;
+ image4.MaskColor[0] = 0x40;
+ image4.MaskColor[1] = 0x90;
+ do_image(image4, data4);
}
gs_grestore(pgs);
@@ -753,19 +750,19 @@ spectrum(gs_state * pgs, int n)
int a, b, c;
for (a = 0; a < n; ++a)
- for (b = 0; b < n; ++b)
- for (c = 0; c < n; ++c) {
- double size = (n * 2 - c * 2 - 1) / den2;
- gs_client_color cc;
-
- cc.paint.values[0] = a / den1;
- cc.paint.values[1] = b / den1;
- cc.paint.values[2] = c / den1;
- gs_setcolor(pgs, &cc);
- fill_rect1(pgs,
- a / den + c / den2, b / den + c / den2,
- size, size);
- }
+ for (b = 0; b < n; ++b)
+ for (c = 0; c < n; ++c) {
+ double size = (n * 2 - c * 2 - 1) / den2;
+ gs_client_color cc;
+
+ cc.paint.values[0] = a / den1;
+ cc.paint.values[1] = b / den1;
+ cc.paint.values[2] = c / den1;
+ gs_setcolor(pgs, &cc);
+ fill_rect1(pgs,
+ a / den + c / den2, b / den + c / den2,
+ size, size);
+ }
}
static float
render_abc(floatp v, const gs_cie_render * ignore_crd)
@@ -783,7 +780,7 @@ test6(gs_state * pgs, gs_memory_t * mem)
{1, 1, 1};
static const gs_cie_render_proc3 encode_abc =
{
- {render_abc, render_abc, render_abc}
+ {render_abc, render_abc, render_abc}
};
#ifdef COLOR_MAP_DEVICE
gx_device_cmap *cmdev;
@@ -801,12 +798,12 @@ test6(gs_state * pgs, gs_memory_t * mem)
/* We must set the CRD before the color space. */
code = gs_cie_render1_build(&pcrd, mem, "test6");
if (code < 0)
- return code;
+ return code;
gs_cie_render1_initialize(mem, pcrd, NULL, &white_point, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, &encode_abc, NULL,
- NULL);
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, &encode_abc, NULL,
+ NULL);
gs_setcolorrendering(pgs, pcrd);
gs_cspace_build_CIEABC(&pcs, NULL, mem);
/* There should be an API for initializing CIE color spaces too.... */
@@ -819,10 +816,10 @@ test6(gs_state * pgs, gs_memory_t * mem)
#ifdef COLOR_MAP_DEVICE
/* Now test color snapping. */
cmdev =
- gs_alloc_struct_immovable(mem, gx_device_cmap, &st_device_cmap,
- "cmap device");
+ gs_alloc_struct_immovable(mem, gx_device_cmap, &st_device_cmap,
+ "cmap device");
gdev_cmap_init(cmdev, gs_currentdevice(pgs),
- device_cmap_snap_to_primaries);
+ device_cmap_snap_to_primaries);
gs_setdevice_no_init(pgs, (gx_device *) cmdev);
#endif /* COLOR_MAP_DEVICE */
gs_setrgbcolor(pgs, 0.0, 0.0, 0.0); /* back to DeviceRGB space */
@@ -852,13 +849,13 @@ test7(gs_state * pgs, gs_memory_t * mem)
static const byte masks[1 * 4 * 4] =
{
/* 0% */
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
/* 25% */
- 0x80, 0x40, 0x20, 0x10,
+ 0x80, 0x40, 0x20, 0x10,
/* 50% */
- 0xa0, 0xa0, 0x50, 0x50,
+ 0xa0, 0xa0, 0x50, 0x50,
/* 75% */
- 0xd0, 0xe0, 0x70, 0xb0
+ 0xd0, 0xe0, 0x70, 0xb0
};
gs_ht *pht;
int code;
@@ -868,13 +865,13 @@ test7(gs_state * pgs, gs_memory_t * mem)
code = gs_ht_build(&pht, 1, mem);
dprintf1("ht build code = %d\n", code);
code = gs_ht_set_mask_comp(pht, 0,
- 4, 4, 4, masks, NULL, NULL);
+ 4, 4, 4, masks, NULL, NULL);
dprintf1("set mask code = %d\n", code);
code = gs_sethalftone(pgs, pht);
dprintf1("sethalftone code = %d\n", code);
for (i = 0; i <= 4; ++i) {
- gs_setgray(pgs, i / 4.0);
- fill_rect1(pgs, 100 + i * 100, 100, 50, 50);
+ gs_setgray(pgs, i / 4.0);
+ fill_rect1(pgs, 100 + i * 100, 100, 50, 50);
}
return 0;
}
@@ -892,22 +889,22 @@ test8(gs_state * pgs, gs_memory_t * mem)
*/
static const byte pdata[] =
{
- 0x7f, 0xff, 0x00, 0x03,
- 0x7f, 0xff, 0x00, 0x0c,
- 0x50, 0x00, 0x00, 0x30,
- 0x50, 0x00, 0x00, 0xc0,
- 0x50, 0x00, 0x03, 0x00,
- 0x50, 0x00, 0x0c, 0x00,
- 0x50, 0x00, 0x30, 0x00,
- 0x50, 0x00, 0xc0, 0x00,
- 0xf0, 0x00, 0xc0, 0x00,
- 0xf0, 0x00, 0x30, 0x00,
- 0xf0, 0x00, 0x0c, 0x00,
- 0xf0, 0x00, 0x03, 0x00,
- 0xf0, 0x00, 0x00, 0xc0,
- 0xf0, 0x00, 0x00, 0x30,
- 0xea, 0x55, 0xaa, 0x5c,
- 0xea, 0x55, 0xaa, 0x57,
+ 0x7f, 0xff, 0x00, 0x03,
+ 0x7f, 0xff, 0x00, 0x0c,
+ 0x50, 0x00, 0x00, 0x30,
+ 0x50, 0x00, 0x00, 0xc0,
+ 0x50, 0x00, 0x03, 0x00,
+ 0x50, 0x00, 0x0c, 0x00,
+ 0x50, 0x00, 0x30, 0x00,
+ 0x50, 0x00, 0xc0, 0x00,
+ 0xf0, 0x00, 0xc0, 0x00,
+ 0xf0, 0x00, 0x30, 0x00,
+ 0xf0, 0x00, 0x0c, 0x00,
+ 0xf0, 0x00, 0x03, 0x00,
+ 0xf0, 0x00, 0x00, 0xc0,
+ 0xf0, 0x00, 0x00, 0x30,
+ 0xea, 0x55, 0xaa, 0x5c,
+ 0xea, 0x55, 0xaa, 0x57,
};
gs_depth_bitmap ptile;
gs_const_string table;
@@ -918,7 +915,7 @@ test8(gs_state * pgs, gs_memory_t * mem)
gs_cspace_init_DeviceRGB(mem, &rgb_cs);
table.data =
- (const byte *)"\377\377\377\377\000\000\000\377\000\000\000\000";
+ (const byte *)"\377\377\377\377\000\000\000\377\000\000\000\000";
table.size = 12;
gs_cspace_build_Indexed(&pcs, &rgb_cs, 4, &table, mem);
ptile.data = pdata;
@@ -928,26 +925,26 @@ test8(gs_state * pgs, gs_memory_t * mem)
ptile.pix_depth = 2;
ptile.num_comps = 1;
gs_makepixmappattern(&ccolor, &ptile, false /*mask */ , NULL /*pmat */ ,
- gs_no_id, pcs, 0 /*white_index */ , pgs, mem);
+ gs_no_id, pcs, 0 /*white_index */ , pgs, mem);
{
- gs_rect r;
-
- r.p.x = 100;
- r.p.y = 100;
- r.q.x = 200;
- r.q.y = 200;
- gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
- gs_rectfill(pgs, &r, 1);
- gs_setpattern(pgs, &ccolor);
- // gs_settexturetransparent(pgs, true);
- gs_rectfill(pgs, &r, 1);
- r.p.x += 150;
- r.q.x += 150;
- gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
- gs_rectfill(pgs, &r, 1);
- gs_setpattern(pgs, &ccolor);
- // gs_settexturetransparent(pgs, false);
- gs_rectfill(pgs, &r, 1);
+ gs_rect r;
+
+ r.p.x = 100;
+ r.p.y = 100;
+ r.q.x = 200;
+ r.q.y = 200;
+ gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
+ gs_rectfill(pgs, &r, 1);
+ gs_setpattern(pgs, &ccolor);
+ // gs_settexturetransparent(pgs, true);
+ gs_rectfill(pgs, &r, 1);
+ r.p.x += 150;
+ r.q.x += 150;
+ gs_setrgbcolor(pgs, 1.0, 1.0, 0.0);
+ gs_rectfill(pgs, &r, 1);
+ gs_setpattern(pgs, &ccolor);
+ // gs_settexturetransparent(pgs, false);
+ gs_rectfill(pgs, &r, 1);
}
return 0;
}
@@ -968,25 +965,25 @@ test8(gs_state * pgs, gs_memory_t * mem)
static int
test9_get_int16(const byte *bptr)
-{
+{
return get_int16(bptr);
}
static uint
test9_get_uint16(const byte *bptr)
-{
+{
return get_uint16(bptr);
}
static long
test9_get_int32(const byte *bptr)
-{
+{
return ((long)get_int16(bptr) << 16) | get_uint16(bptr + 2);
}
static ulong
test9_get_uint32(const byte *bptr)
-{
+{
return ((ulong)get_uint16(bptr) << 16) | get_uint16(bptr + 2);
}
@@ -1011,7 +1008,7 @@ test9_tt_find_table(gs_font_type42 *pfont, const char *tname, uint *plen)
uint i;
ulong table_dir_offset = 0;
int (*string_proc)(gs_font_type42 *, ulong, uint, const byte **) =
- pfont->data.string_proc;
+ pfont->data.string_proc;
/* nb check return values */
ACCESS(pfont->memory, 0, 12, OffsetTable);
@@ -1052,7 +1049,7 @@ test9_tt_glyph_name(gs_font *pf, gs_glyph glyph, gs_const_string *pstr)
static int
test9_tt_string_proc(gs_font *p42, ulong offset, uint length, const byte **pdata)
{
-
+
/* NB bounds check offset + length - use gs_object_size for memory
buffers - if file read should fail */
*pdata = p42->client_data + offset;
@@ -1071,7 +1068,7 @@ test9_tt_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont, gs_char
return code;
w2[0] = sbw[2], w2[1] = sbw[3];
/* don't ask me about the following, I just work here. */
- {
+ {
#define pbfont ((gs_font_base *)pfont)
const gs_rect *pbbox = &pbfont->FontBBox;
@@ -1079,7 +1076,7 @@ test9_tt_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont, gs_char
w2[2] = pbbox->p.x, w2[3] = pbbox->p.y;
w2[4] = pbbox->q.x, w2[5] = pbbox->q.y;
- if ( pfont->PaintType ) {
+ if ( pfont->PaintType ) {
double expand = max(1.415, gs_currentmiterlimit(pgs)) *
gs_currentlinewidth(pgs) / 2;
@@ -1093,7 +1090,7 @@ test9_tt_build_char(gs_show_enum *penum, gs_state *pgs, gs_font *pfont, gs_char
if ( (code = gs_setcachedevice(penum, pgs, w2)) < 0 )
return code;
-
+
code = gs_type42_append(glyph,
(gs_imager_state *)pgs,
gx_current_path(pgs),
@@ -1117,7 +1114,7 @@ test9_load_font_data(const char *filename, gs_memory_t * mem)
size = (fseek(in, 0L, SEEK_END), ftell(in));
rewind(in);
data = gs_alloc_bytes(mem, size, "test9_load_font data");
- if ( data == 0 ) {
+ if ( data == 0 ) {
fclose(in);
return NULL;
}
@@ -1127,7 +1124,7 @@ test9_load_font_data(const char *filename, gs_memory_t * mem)
fclose(in);
return data;
}
-
+
/* windows tt file name */
#define TTF_FILENAME "/windows/fonts/A028-Ext.ttf"
@@ -1149,14 +1146,14 @@ test9_load_font_data(const char *filename, gs_memory_t * mem)
static int
test9(gs_state * pgs, gs_memory_t * mem)
{
-
+
gs_font_type42 *p42 = gs_alloc_struct(mem, gs_font_type42,
&st_gs_font_type42,
"new p42");
gs_font_dir *pfont_dir = gs_font_dir_alloc(mem);
byte *pfont_data = test9_load_font_data(TTF_FILENAME, mem);
-
+
if (!pfont_data || !pfont_dir || !p42)
return -1;
@@ -1199,7 +1196,7 @@ test9(gs_state * pgs, gs_memory_t * mem)
/* Initialize Type 42 specific data. */
p42->data.string_proc = test9_tt_string_proc;
gs_type42_font_init(p42);
-
+
gs_definefont(pfont_dir, (gs_font *)p42);
gs_setfont(pgs, (gs_font *)p42);
{
@@ -1220,7 +1217,6 @@ test9(gs_state * pgs, gs_memory_t * mem)
text_params.data.bytes = mystr + i;
text_params.size = 1;
-
gs_make_identity(&fmat);
if ((gs_matrix_scale(&fmat, FontRenderingEmSize, FontRenderingEmSize, &fmat) != 0) ||
(gs_setcharmatrix(pgs, &fmat) != 0) ||
@@ -1243,19 +1239,19 @@ test9(gs_state * pgs, gs_memory_t * mem)
false,
&ppair);
- cc = gx_lookup_cached_char(penum->current_font,
- ppair,
+ cc = gx_lookup_cached_char(penum->current_font,
+ ppair,
penum->returned.current_glyph,
/* nb next three assume
no veritcal writing
'0', bitdepth '1'
and no sub pixel
stuff */
- 0,
- 1,
+ 0,
+ 1,
&sub_pix_or);
- debug_dump_bitmap(cc_bits(cc),
+ debug_dump_bitmap(cc_bits(cc),
cc_raster(cc),
cc->height, "");
/* update point (device space) */
diff --git a/tools/tt2pcl.c b/tools/tt2pcl.c
index 56583ddfc..04d68a844 100644
--- a/tools/tt2pcl.c
+++ b/tools/tt2pcl.c
@@ -79,7 +79,7 @@ typedef struct pcl_segment_s {
#define SYMSET_NUM 1023
#define SYMSET_LETTER 'Z'
-
+
#define NUM_TABLES 8
/* alphabetical */
const char *tables[NUM_TABLES] = {
@@ -93,7 +93,6 @@ const char *tables[NUM_TABLES] = {
"prep"
};
-
typedef struct table_directory_s {
unsigned long sfnt_version; /* should be fixed 16.16 */
unsigned short num_tables;
@@ -108,7 +107,7 @@ typedef struct table_s {
unsigned long offset;
unsigned long length;
} table_t;
-
+
static void
write_pcl_header()
{
@@ -160,11 +159,11 @@ write_table_directory()
td.searchRange = htons(NUM_TABLES * 16);
td.entrySelector = htons(log2(NUM_TABLES));
td.rangeShift = htons(0); /* since power of 2 */
-
+
stdout_offset += fwrite(&td, 1, sizeof(table_directory_t), stdout);
}
-static int
+static int
get_tt_buffer(char *filename, unsigned char **pptt_font_data, unsigned long *size)
{
@@ -192,7 +191,7 @@ get_tt_buffer(char *filename, unsigned char **pptt_font_data, unsigned long *siz
/* offset of table "table_name" */
static unsigned long
-find_table(const unsigned char *ptt_data, const char *table_name, unsigned long *table_size)
+find_table(const unsigned char *ptt_data, const char *table_name, unsigned long *table_size)
{
unsigned int num_tables;
const unsigned char *ptt_table_directory;
@@ -212,7 +211,6 @@ find_table(const unsigned char *ptt_data, const char *table_name, unsigned long
return 0;
}
-
static int
write_table_entrys(unsigned char *ptt_data)
{
@@ -260,7 +258,7 @@ write_tables(unsigned char *ptt_data)
fprintf(stderr, "table %s not found\n", tables[i]);
exit(EXIT_FAILURE);
}
- fprintf(stderr, "writing table %c%c%c%c at %d\n",
+ fprintf(stderr, "writing table %c%c%c%c at %d\n",
tables[i][0], tables[i][1], tables[i][2], tables[i][3], stdout_offset);
stdout_offset += fwrite(ptt_data+offset, 1, length, stdout);
}
@@ -299,7 +297,7 @@ write_GT_segment(unsigned char *ptt_data)
write_table_directory();
write_table_entrys(ptt_data);
write_tables(ptt_data);
-
+
}
static void
@@ -312,7 +310,6 @@ write_NULL_segment()
stdout_offset += fwrite(&NULL_seg, 1, sizeof(pcl_segment_t), stdout);
}
-
static void
set_id(char *fontname)
{
@@ -469,7 +466,6 @@ write_CC_segment()
stdout_offset += fwrite(&CharacterComplement, 1, 8, stdout);
}
-
static void
write_character_descriptor(unsigned char *ptt_data)
{
@@ -479,13 +475,13 @@ write_character_descriptor(unsigned char *ptt_data)
unsigned char *start_charp;
unsigned char *end_charp;
unsigned char *id_deltap;
- unsigned char *id_rangeoffsetp;
+ unsigned char *id_rangeoffsetp;
unsigned char *glyph_id_arrayp;
if ( (table = get_mac_glyph_index(ptt_data)) == 0 ) {
fprintf(stderr, "mac table not found\n");
exit(EXIT_FAILURE);
}
-
+
segment_count = pl_get_uint16(table + 6) / 2;
fprintf(stderr, "number of segments %d\n", segment_count);
end_charp = table + 14;
@@ -518,7 +514,7 @@ write_character_descriptor(unsigned char *ptt_data)
glyph_data = find_glyph_data(glyph, ptt_data, &glyph_length);
if (glyph_length == 0)
continue;
- fprintf(stderr, "contours=%d, minx=%d, miny=%d, maxx=%d, maxy=%d\n",
+ fprintf(stderr, "contours=%d, minx=%d, miny=%d, maxx=%d, maxy=%d\n",
pl_get_uint16(glyph_data), (short)pl_get_uint16(glyph_data+2),
(short)pl_get_uint16(glyph_data+4), (short)pl_get_uint16(glyph_data+6),
(short)pl_get_uint16(glyph_data+8));
@@ -536,7 +532,7 @@ write_character_descriptor(unsigned char *ptt_data)
int i;
for ( i = 0; i < glyph_length; i++ )
sum += glyph_data[i];
-
+
fprintf(stderr, "checksum=%d\n", sum);
}
stdout_offset += fwrite(&tt_char_des, 1, sizeof(character_descriptor_t), stdout);
@@ -554,7 +550,7 @@ write_test(unsigned char *ptt_data, char *fontname)
unsigned char *start_charp;
unsigned char *end_charp;
unsigned char *id_deltap;
- unsigned char *id_rangeoffsetp;
+ unsigned char *id_rangeoffsetp;
unsigned char *glyph_id_arrayp;
int i;
@@ -562,7 +558,7 @@ write_test(unsigned char *ptt_data, char *fontname)
fprintf(stderr, "mac table not found\n");
exit(EXIT_FAILURE);
}
- stdout_offset += fprintf(stdout, "\033(s1P\033(s14V\033(1X");
+ stdout_offset += fprintf(stdout, "\033(s1P\033(s14V\033(1X");
segment_count = pl_get_uint16(table + 6) / 2;
end_charp = table + 14;
start_charp = end_charp + (segment_count * 2) + 2 /* reservedpad */;
@@ -575,7 +571,6 @@ write_test(unsigned char *ptt_data, char *fontname)
unsigned short last_char = pl_get_uint16(end_charp + 2 * seg);
unsigned short this_char;
-
// NB doesn't handle 0xffff terminating a segment with valid
// characters in it - don't think this happens in practice.
if ( last_char == 0xffff )
@@ -602,7 +597,7 @@ main(int argc, char **argv)
return -1;
{
unsigned long total_bytes =
- sizeof(pcl_font_header_t) +
+ sizeof(pcl_font_header_t) +
sizeof(table_directory_t) +
sizeof(table_t) * NUM_TABLES +
total_segments_size(ptt_data) +
diff --git a/tools/xps2tiff/xps2tiff/stdafx.h b/tools/xps2tiff/xps2tiff/stdafx.h
index f3469f363..f3469f363 100755..100644
--- a/tools/xps2tiff/xps2tiff/stdafx.h
+++ b/tools/xps2tiff/xps2tiff/stdafx.h
diff --git a/xps/xpsgradient.c b/xps/xpsgradient.c
index 633cc357f..1df0b4f17 100644
--- a/xps/xpsgradient.c
+++ b/xps/xpsgradient.c
@@ -83,8 +83,8 @@ xps_parse_gradient_stops(xps_context_t *ctx, char *base_uri, xps_item_t *node,
rendering_params.rendering_intent = gsPERCEPTUAL;
/* Get link to map from source to sRGB */
- icclink = gsicc_get_link((gs_imager_state*) ctx->pgs,
- NULL, colorspace, ctx->srgb,
+ icclink = gsicc_get_link((gs_imager_state*) ctx->pgs,
+ NULL, colorspace, ctx->srgb,
&rendering_params, ctx->memory, false);
if (icclink != NULL && !icclink->is_identity)